aitable-workflow-cli 0.1.28 → 0.1.29-beta.1790736949347
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assistant/assets/index-BA6il19d.css +1 -0
- package/dist/assistant/assets/{index-B3LvYfRW.js → index-BMzAOp70.js} +31 -31
- package/dist/assistant/index.html +2 -2
- package/dist/chunk-BBP5RVFU.js +15 -0
- package/dist/cli.js +180 -73
- package/dist/{config-ui-server-4SVD42Z3.js → config-ui-server-UWELHUH4.js} +1 -1
- package/dist/web/assets/index-Bnmnydwk.css +1 -0
- package/dist/web/assets/index-Dbs1xWB9.js +331 -0
- package/dist/web/index.html +2 -2
- package/dist/web/install.ps1 +173 -0
- package/dist/web/install.sh +188 -0
- package/package.json +3 -3
- package/templates/ai-native-sdlc/.env.example +11 -0
- package/templates/ai-native-sdlc/aitable-workflow.config.yml +47 -0
- package/templates/ai-native-sdlc/coding-agents.config.json +17 -0
- package/templates/ai-native-sdlc/docs/plans/2026-09-15-ai-native-sdlc-dual-staff-implementation-plan.md +150 -0
- package/templates/ai-native-sdlc/docs/plans/2026-09-15-ai-native-sdlc-dual-staff.md +213 -0
- package/templates/ai-native-sdlc/docs/plans/2026-09-16-domain-role-notification-routing.md +36 -0
- package/templates/ai-native-sdlc/docs/plans/2026-09-16-execution-resume-and-cr-loop.md +29 -0
- package/templates/ai-native-sdlc/docs/plans/2026-09-16-project-handoff.md +148 -0
- package/templates/ai-native-sdlc/docs/plans/2026-09-17-prd-code-context-and-readable-prompts.md +37 -0
- package/templates/ai-native-sdlc/docs/plans/2026-09-21-plan-merge-sync-and-agent-source.md +19 -0
- package/templates/ai-native-sdlc/docs/plans/2026-09-21-sdlc-base-ref-and-review-notification.md +18 -0
- package/templates/ai-native-sdlc/docs/plans/2026-09-29-borrow-from-joe-design.md +943 -0
- package/templates/ai-native-sdlc/lib/artifacts.ts +126 -0
- package/templates/ai-native-sdlc/lib/recipe-config.ts +34 -0
- package/templates/ai-native-sdlc/lib/recipe-helpers.ts +595 -0
- package/templates/ai-native-sdlc/npmrc +1 -0
- package/templates/ai-native-sdlc/package.json +19 -0
- package/templates/ai-native-sdlc/profile/profile.yml +115 -0
- package/templates/ai-native-sdlc/setup/module-config.seed.json +37 -0
- package/templates/ai-native-sdlc/test/artifacts.test.ts +72 -0
- package/templates/ai-native-sdlc/test/recipe-helpers.test.ts +931 -0
- package/templates/ai-native-sdlc/tsconfig.json +17 -0
- package/templates/ai-native-sdlc/workflows/.gitkeep +3 -0
- package/templates/ai-native-sdlc/workflows/execution/automations/blocked-questions-dev.json +91 -0
- package/templates/ai-native-sdlc/workflows/execution/automations/blocked-questions.json +91 -0
- package/templates/ai-native-sdlc/workflows/execution/automations/cr-review-dev.json +80 -0
- package/templates/ai-native-sdlc/workflows/execution/automations/cr-review.json +81 -0
- package/templates/ai-native-sdlc/workflows/execution/automations/resume-answers.json +42 -0
- package/templates/ai-native-sdlc/workflows/execution/automations/spec-review-dev.json +138 -0
- package/templates/ai-native-sdlc/workflows/execution/recipes/coding.recipe.ts +161 -0
- package/templates/ai-native-sdlc/workflows/execution/recipes/prd-review.recipe.ts +200 -0
- package/templates/ai-native-sdlc/workflows/execution/recipes/prd.recipe.ts +163 -0
- package/templates/ai-native-sdlc/workflows/execution/recipes/review.recipe.ts +257 -0
- package/templates/ai-native-sdlc/workflows/execution/recipes/spec-review.recipe.ts +242 -0
- package/templates/ai-native-sdlc/workflows/execution/recipes/spec.recipe.ts +173 -0
- package/templates/ai-native-sdlc/workflows/execution/workflow.yml +79 -0
- package/templates/ai-native-sdlc/workflows/intake/automations/accept-intake.json +101 -0
- package/templates/ai-native-sdlc/workflows/intake/recipes/classify-module.recipe.ts +133 -0
- package/templates/ai-native-sdlc/workflows/intake/recipes/create-change.recipe.ts +94 -0
- package/templates/ai-native-sdlc/workflows/intake/recipes/mechanical-deduplicate.recipe.ts +33 -0
- package/templates/ai-native-sdlc/workflows/intake/workflow.yml +62 -0
- package/templates/ai-native-sdlc/workspaces/dev/AGENTS.md +69 -0
- package/templates/ai-native-sdlc/workspaces/pm/AGENTS.md +48 -0
- package/templates/ai-native-sdlc/workspaces/reviewer/AGENTS.md +79 -0
- package/dist/assistant/assets/index-CCEHOkkJ.css +0 -1
- package/dist/chunk-YDJTCQW4.js +0 -15
- package/dist/web/assets/index-DPc2WOdp.css +0 -1
- package/dist/web/assets/index-HTw8K38o.js +0 -332
|
@@ -1,332 +0,0 @@
|
|
|
1
|
-
var uA=Object.defineProperty;var dA=(e,t,n)=>t in e?uA(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var ue=(e,t,n)=>dA(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 Sb(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var kb={exports:{}},Zu={},Nb={exports:{}},de={};/**
|
|
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 Za=Symbol.for("react.element"),fA=Symbol.for("react.portal"),hA=Symbol.for("react.fragment"),pA=Symbol.for("react.strict_mode"),mA=Symbol.for("react.profiler"),gA=Symbol.for("react.provider"),vA=Symbol.for("react.context"),yA=Symbol.for("react.forward_ref"),xA=Symbol.for("react.suspense"),_A=Symbol.for("react.memo"),wA=Symbol.for("react.lazy"),wy=Symbol.iterator;function bA(e){return e===null||typeof e!="object"?null:(e=wy&&e[wy]||e["@@iterator"],typeof e=="function"?e:null)}var Eb={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Cb=Object.assign,Tb={};function ro(e,t,n){this.props=e,this.context=t,this.refs=Tb,this.updater=n||Eb}ro.prototype.isReactComponent={};ro.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")};ro.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function Pb(){}Pb.prototype=ro.prototype;function Rm(e,t,n){this.props=e,this.context=t,this.refs=Tb,this.updater=n||Eb}var Im=Rm.prototype=new Pb;Im.constructor=Rm;Cb(Im,ro.prototype);Im.isPureReactComponent=!0;var by=Array.isArray,Ab=Object.prototype.hasOwnProperty,Mm={current:null},Rb={key:!0,ref:!0,__self:!0,__source:!0};function Ib(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)Ab.call(t,r)&&!Rb.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:Za,type:e,key:i,ref:o,props:s,_owner:Mm.current}}function jA(e,t){return{$$typeof:Za,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function Om(e){return typeof e=="object"&&e!==null&&e.$$typeof===Za}function SA(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var jy=/\/+/g;function rf(e,t){return typeof e=="object"&&e!==null&&e.key!=null?SA(""+e.key):t.toString(36)}function hc(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 Za:case fA:o=!0}}if(o)return o=e,s=s(o),e=r===""?"."+rf(o,0):r,by(s)?(n="",e!=null&&(n=e.replace(jy,"$&/")+"/"),hc(s,t,n,"",function(u){return u})):s!=null&&(Om(s)&&(s=jA(s,n+(!s.key||o&&o.key===s.key?"":(""+s.key).replace(jy,"$&/")+"/")+e)),t.push(s)),1;if(o=0,r=r===""?".":r+":",by(e))for(var l=0;l<e.length;l++){i=e[l];var c=r+rf(i,l);o+=hc(i,t,n,c,s)}else if(c=bA(e),typeof c=="function")for(e=c.call(e),l=0;!(i=e.next()).done;)i=i.value,c=r+rf(i,l++),o+=hc(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 Sl(e,t,n){if(e==null)return e;var r=[],s=0;return hc(e,r,"","",function(i){return t.call(n,i,s++)}),r}function kA(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 ht={current:null},pc={transition:null},NA={ReactCurrentDispatcher:ht,ReactCurrentBatchConfig:pc,ReactCurrentOwner:Mm};function Mb(){throw Error("act(...) is not supported in production builds of React.")}de.Children={map:Sl,forEach:function(e,t,n){Sl(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return Sl(e,function(){t++}),t},toArray:function(e){return Sl(e,function(t){return t})||[]},only:function(e){if(!Om(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};de.Component=ro;de.Fragment=hA;de.Profiler=mA;de.PureComponent=Rm;de.StrictMode=pA;de.Suspense=xA;de.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=NA;de.act=Mb;de.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=Cb({},e.props),s=e.key,i=e.ref,o=e._owner;if(t!=null){if(t.ref!==void 0&&(i=t.ref,o=Mm.current),t.key!==void 0&&(s=""+t.key),e.type&&e.type.defaultProps)var l=e.type.defaultProps;for(c in t)Ab.call(t,c)&&!Rb.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:Za,type:e.type,key:s,ref:i,props:r,_owner:o}};de.createContext=function(e){return e={$$typeof:vA,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:gA,_context:e},e.Consumer=e};de.createElement=Ib;de.createFactory=function(e){var t=Ib.bind(null,e);return t.type=e,t};de.createRef=function(){return{current:null}};de.forwardRef=function(e){return{$$typeof:yA,render:e}};de.isValidElement=Om;de.lazy=function(e){return{$$typeof:wA,_payload:{_status:-1,_result:e},_init:kA}};de.memo=function(e,t){return{$$typeof:_A,type:e,compare:t===void 0?null:t}};de.startTransition=function(e){var t=pc.transition;pc.transition={};try{e()}finally{pc.transition=t}};de.unstable_act=Mb;de.useCallback=function(e,t){return ht.current.useCallback(e,t)};de.useContext=function(e){return ht.current.useContext(e)};de.useDebugValue=function(){};de.useDeferredValue=function(e){return ht.current.useDeferredValue(e)};de.useEffect=function(e,t){return ht.current.useEffect(e,t)};de.useId=function(){return ht.current.useId()};de.useImperativeHandle=function(e,t,n){return ht.current.useImperativeHandle(e,t,n)};de.useInsertionEffect=function(e,t){return ht.current.useInsertionEffect(e,t)};de.useLayoutEffect=function(e,t){return ht.current.useLayoutEffect(e,t)};de.useMemo=function(e,t){return ht.current.useMemo(e,t)};de.useReducer=function(e,t,n){return ht.current.useReducer(e,t,n)};de.useRef=function(e){return ht.current.useRef(e)};de.useState=function(e){return ht.current.useState(e)};de.useSyncExternalStore=function(e,t,n){return ht.current.useSyncExternalStore(e,t,n)};de.useTransition=function(){return ht.current.useTransition()};de.version="18.3.1";Nb.exports=de;var _=Nb.exports;const or=Sb(_);/**
|
|
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 EA=_,CA=Symbol.for("react.element"),TA=Symbol.for("react.fragment"),PA=Object.prototype.hasOwnProperty,AA=EA.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,RA={key:!0,ref:!0,__self:!0,__source:!0};function Ob(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)PA.call(t,r)&&!RA.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:CA,type:e,key:i,ref:o,props:s,_owner:AA.current}}Zu.Fragment=TA;Zu.jsx=Ob;Zu.jsxs=Ob;kb.exports=Zu;var a=kb.exports,Lb={exports:{}},Ot={},$b={exports:{}},Db={};/**
|
|
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(R,M){var B=R.length;R.push(M);e:for(;0<B;){var $=B-1>>>1,F=R[$];if(0<s(F,M))R[$]=M,R[B]=F,B=$;else break e}}function n(R){return R.length===0?null:R[0]}function r(R){if(R.length===0)return null;var M=R[0],B=R.pop();if(B!==M){R[0]=B;e:for(var $=0,F=R.length,H=F>>>1;$<H;){var W=2*($+1)-1,U=R[W],q=W+1,Q=R[q];if(0>s(U,B))q<F&&0>s(Q,U)?(R[$]=Q,R[q]=B,$=q):(R[$]=U,R[W]=B,$=W);else if(q<F&&0>s(Q,B))R[$]=Q,R[q]=B,$=q;else break e}}return M}function s(R,M){var B=R.sortIndex-M.sortIndex;return B!==0?B:R.id-M.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,g=!1,x=!1,w=typeof setTimeout=="function"?setTimeout:null,v=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(R){for(var M=n(u);M!==null;){if(M.callback===null)r(u);else if(M.startTime<=R)r(u),M.sortIndex=M.expirationTime,t(c,M);else break;M=n(u)}}function b(R){if(x=!1,m(R),!g)if(n(c)!==null)g=!0,P(j);else{var M=n(u);M!==null&&C(b,M.startTime-R)}}function j(R,M){g=!1,x&&(x=!1,v(N),N=-1),p=!0;var B=h;try{for(m(M),f=n(c);f!==null&&(!(f.expirationTime>M)||R&&!D());){var $=f.callback;if(typeof $=="function"){f.callback=null,h=f.priorityLevel;var F=$(f.expirationTime<=M);M=e.unstable_now(),typeof F=="function"?f.callback=F:f===n(c)&&r(c),m(M)}else r(c);f=n(c)}if(f!==null)var H=!0;else{var W=n(u);W!==null&&C(b,W.startTime-M),H=!1}return H}finally{f=null,h=B,p=!1}}var S=!1,k=null,N=-1,A=5,O=-1;function D(){return!(e.unstable_now()-O<A)}function I(){if(k!==null){var R=e.unstable_now();O=R;var M=!0;try{M=k(!0,R)}finally{M?z():(S=!1,k=null)}}else S=!1}var z;if(typeof y=="function")z=function(){y(I)};else if(typeof MessageChannel<"u"){var T=new MessageChannel,E=T.port2;T.port1.onmessage=I,z=function(){E.postMessage(null)}}else z=function(){w(I,0)};function P(R){k=R,S||(S=!0,z())}function C(R,M){N=w(function(){R(e.unstable_now())},M)}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(R){R.callback=null},e.unstable_continueExecution=function(){g||p||(g=!0,P(j))},e.unstable_forceFrameRate=function(R){0>R||125<R?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):A=0<R?Math.floor(1e3/R):5},e.unstable_getCurrentPriorityLevel=function(){return h},e.unstable_getFirstCallbackNode=function(){return n(c)},e.unstable_next=function(R){switch(h){case 1:case 2:case 3:var M=3;break;default:M=h}var B=h;h=M;try{return R()}finally{h=B}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(R,M){switch(R){case 1:case 2:case 3:case 4:case 5:break;default:R=3}var B=h;h=R;try{return M()}finally{h=B}},e.unstable_scheduleCallback=function(R,M,B){var $=e.unstable_now();switch(typeof B=="object"&&B!==null?(B=B.delay,B=typeof B=="number"&&0<B?$+B:$):B=$,R){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,R={id:d++,callback:M,priorityLevel:R,startTime:B,expirationTime:F,sortIndex:-1},B>$?(R.sortIndex=B,t(u,R),n(c)===null&&R===n(u)&&(x?(v(N),N=-1):x=!0,C(b,B-$))):(R.sortIndex=F,t(c,R),g||p||(g=!0,P(j))),R},e.unstable_shouldYield=D,e.unstable_wrapCallback=function(R){var M=h;return function(){var B=h;h=M;try{return R.apply(this,arguments)}finally{h=B}}}})(Db);$b.exports=Db;var IA=$b.exports;/**
|
|
26
|
-
* @license React
|
|
27
|
-
* react-dom.production.min.js
|
|
28
|
-
*
|
|
29
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
30
|
-
*
|
|
31
|
-
* This source code is licensed under the MIT license found in the
|
|
32
|
-
* LICENSE file in the root directory of this source tree.
|
|
33
|
-
*/var MA=_,Rt=IA;function X(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 zb=new Set,ua={};function Bs(e,t){Mi(e,t),Mi(e+"Capture",t)}function Mi(e,t){for(ua[e]=t,e=0;e<t.length;e++)zb.add(t[e])}var pr=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),kh=Object.prototype.hasOwnProperty,OA=/^[: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]*$/,Sy={},ky={};function LA(e){return kh.call(ky,e)?!0:kh.call(Sy,e)?!1:OA.test(e)?ky[e]=!0:(Sy[e]=!0,!1)}function $A(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 DA(e,t,n,r){if(t===null||typeof t>"u"||$A(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 pt(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 et={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){et[e]=new pt(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];et[t]=new pt(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){et[e]=new pt(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){et[e]=new pt(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){et[e]=new pt(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){et[e]=new pt(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){et[e]=new pt(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){et[e]=new pt(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){et[e]=new pt(e,5,!1,e.toLowerCase(),null,!1,!1)});var Lm=/[\-:]([a-z])/g;function $m(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(Lm,$m);et[t]=new pt(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(Lm,$m);et[t]=new pt(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(Lm,$m);et[t]=new pt(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){et[e]=new pt(e,1,!1,e.toLowerCase(),null,!1,!1)});et.xlinkHref=new pt("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){et[e]=new pt(e,1,!1,e.toLowerCase(),null,!0,!0)});function Dm(e,t,n,r){var s=et.hasOwnProperty(t)?et[t]:null;(s!==null?s.type!==0:r||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(DA(t,n,s,r)&&(n=null),r||s===null?LA(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 jr=MA.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,kl=Symbol.for("react.element"),ni=Symbol.for("react.portal"),ri=Symbol.for("react.fragment"),zm=Symbol.for("react.strict_mode"),Nh=Symbol.for("react.profiler"),Fb=Symbol.for("react.provider"),Vb=Symbol.for("react.context"),Fm=Symbol.for("react.forward_ref"),Eh=Symbol.for("react.suspense"),Ch=Symbol.for("react.suspense_list"),Vm=Symbol.for("react.memo"),Pr=Symbol.for("react.lazy"),Bb=Symbol.for("react.offscreen"),Ny=Symbol.iterator;function yo(e){return e===null||typeof e!="object"?null:(e=Ny&&e[Ny]||e["@@iterator"],typeof e=="function"?e:null)}var Oe=Object.assign,sf;function Io(e){if(sf===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);sf=t&&t[1]||""}return`
|
|
34
|
-
`+sf+e}var of=!1;function af(e,t){if(!e||of)return"";of=!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{of=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?Io(e):""}function zA(e){switch(e.tag){case 5:return Io(e.type);case 16:return Io("Lazy");case 13:return Io("Suspense");case 19:return Io("SuspenseList");case 0:case 2:case 15:return e=af(e.type,!1),e;case 11:return e=af(e.type.render,!1),e;case 1:return e=af(e.type,!0),e;default:return""}}function Th(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 ri:return"Fragment";case ni:return"Portal";case Nh:return"Profiler";case zm:return"StrictMode";case Eh:return"Suspense";case Ch:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case Vb:return(e.displayName||"Context")+".Consumer";case Fb:return(e._context.displayName||"Context")+".Provider";case Fm:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Vm:return t=e.displayName||null,t!==null?t:Th(e.type)||"Memo";case Pr:t=e._payload,e=e._init;try{return Th(e(t))}catch{}}return null}function FA(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 Th(t);case 8:return t===zm?"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 qr(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Ub(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function VA(e){var t=Ub(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 Nl(e){e._valueTracker||(e._valueTracker=VA(e))}function Hb(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=Ub(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function Hc(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 Ph(e,t){var n=t.checked;return Oe({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function Ey(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=qr(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 Wb(e,t){t=t.checked,t!=null&&Dm(e,"checked",t,!1)}function Ah(e,t){Wb(e,t);var n=qr(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")?Rh(e,t.type,n):t.hasOwnProperty("defaultValue")&&Rh(e,t.type,qr(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Cy(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 Rh(e,t,n){(t!=="number"||Hc(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var Mo=Array.isArray;function Si(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=""+qr(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 Ih(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(X(91));return Oe({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function Ty(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(X(92));if(Mo(n)){if(1<n.length)throw Error(X(93));n=n[0]}t=n}t==null&&(t=""),n=t}e._wrapperState={initialValue:qr(n)}}function Kb(e,t){var n=qr(t.value),r=qr(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 Py(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function qb(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 Mh(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?qb(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var El,Gb=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(El=El||document.createElement("div"),El.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=El.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function da(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Wo={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},BA=["Webkit","ms","Moz","O"];Object.keys(Wo).forEach(function(e){BA.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Wo[t]=Wo[e]})});function Yb(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Wo.hasOwnProperty(e)&&Wo[e]?(""+t).trim():t+"px"}function Xb(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,s=Yb(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,s):e[n]=s}}var UA=Oe({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 Oh(e,t){if(t){if(UA[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(X(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(X(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(X(61))}if(t.style!=null&&typeof t.style!="object")throw Error(X(62))}}function Lh(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 $h=null;function Bm(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Dh=null,ki=null,Ni=null;function Ay(e){if(e=tl(e)){if(typeof Dh!="function")throw Error(X(280));var t=e.stateNode;t&&(t=rd(t),Dh(e.stateNode,e.type,t))}}function Qb(e){ki?Ni?Ni.push(e):Ni=[e]:ki=e}function Zb(){if(ki){var e=ki,t=Ni;if(Ni=ki=null,Ay(e),t)for(e=0;e<t.length;e++)Ay(t[e])}}function Jb(e,t){return e(t)}function ej(){}var lf=!1;function tj(e,t,n){if(lf)return e(t,n);lf=!0;try{return Jb(e,t,n)}finally{lf=!1,(ki!==null||Ni!==null)&&(ej(),Zb())}}function fa(e,t){var n=e.stateNode;if(n===null)return null;var r=rd(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(X(231,t,typeof n));return n}var zh=!1;if(pr)try{var xo={};Object.defineProperty(xo,"passive",{get:function(){zh=!0}}),window.addEventListener("test",xo,xo),window.removeEventListener("test",xo,xo)}catch{zh=!1}function HA(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 Ko=!1,Wc=null,Kc=!1,Fh=null,WA={onError:function(e){Ko=!0,Wc=e}};function KA(e,t,n,r,s,i,o,l,c){Ko=!1,Wc=null,HA.apply(WA,arguments)}function qA(e,t,n,r,s,i,o,l,c){if(KA.apply(this,arguments),Ko){if(Ko){var u=Wc;Ko=!1,Wc=null}else throw Error(X(198));Kc||(Kc=!0,Fh=u)}}function Us(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function nj(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function Ry(e){if(Us(e)!==e)throw Error(X(188))}function GA(e){var t=e.alternate;if(!t){if(t=Us(e),t===null)throw Error(X(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 Ry(s),e;if(i===r)return Ry(s),t;i=i.sibling}throw Error(X(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(X(189))}}if(n.alternate!==r)throw Error(X(190))}if(n.tag!==3)throw Error(X(188));return n.stateNode.current===n?e:t}function rj(e){return e=GA(e),e!==null?sj(e):null}function sj(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=sj(e);if(t!==null)return t;e=e.sibling}return null}var ij=Rt.unstable_scheduleCallback,Iy=Rt.unstable_cancelCallback,YA=Rt.unstable_shouldYield,XA=Rt.unstable_requestPaint,Be=Rt.unstable_now,QA=Rt.unstable_getCurrentPriorityLevel,Um=Rt.unstable_ImmediatePriority,oj=Rt.unstable_UserBlockingPriority,qc=Rt.unstable_NormalPriority,ZA=Rt.unstable_LowPriority,aj=Rt.unstable_IdlePriority,Ju=null,$n=null;function JA(e){if($n&&typeof $n.onCommitFiberRoot=="function")try{$n.onCommitFiberRoot(Ju,e,void 0,(e.current.flags&128)===128)}catch{}}var gn=Math.clz32?Math.clz32:nR,eR=Math.log,tR=Math.LN2;function nR(e){return e>>>=0,e===0?32:31-(eR(e)/tR|0)|0}var Cl=64,Tl=4194304;function Oo(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 Gc(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=Oo(l):(i&=o,i!==0&&(r=Oo(i)))}else o=n&~s,o!==0?r=Oo(o):i!==0&&(r=Oo(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-gn(t),s=1<<n,r|=e[n],t&=~s;return r}function rR(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 sR(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,s=e.expirationTimes,i=e.pendingLanes;0<i;){var o=31-gn(i),l=1<<o,c=s[o];c===-1?(!(l&n)||l&r)&&(s[o]=rR(l,t)):c<=t&&(e.expiredLanes|=l),i&=~l}}function Vh(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function lj(){var e=Cl;return Cl<<=1,!(Cl&4194240)&&(Cl=64),e}function cf(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Ja(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-gn(t),e[t]=n}function iR(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-gn(n),i=1<<s;t[s]=0,r[s]=-1,e[s]=-1,n&=~i}}function Hm(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-gn(n),s=1<<r;s&t|e[r]&t&&(e[r]|=t),n&=~s}}var _e=0;function cj(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var uj,Wm,dj,fj,hj,Bh=!1,Pl=[],Dr=null,zr=null,Fr=null,ha=new Map,pa=new Map,Rr=[],oR="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 My(e,t){switch(e){case"focusin":case"focusout":Dr=null;break;case"dragenter":case"dragleave":zr=null;break;case"mouseover":case"mouseout":Fr=null;break;case"pointerover":case"pointerout":ha.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":pa.delete(t.pointerId)}}function _o(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=tl(t),t!==null&&Wm(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,s!==null&&t.indexOf(s)===-1&&t.push(s),e)}function aR(e,t,n,r,s){switch(t){case"focusin":return Dr=_o(Dr,e,t,n,r,s),!0;case"dragenter":return zr=_o(zr,e,t,n,r,s),!0;case"mouseover":return Fr=_o(Fr,e,t,n,r,s),!0;case"pointerover":var i=s.pointerId;return ha.set(i,_o(ha.get(i)||null,e,t,n,r,s)),!0;case"gotpointercapture":return i=s.pointerId,pa.set(i,_o(pa.get(i)||null,e,t,n,r,s)),!0}return!1}function pj(e){var t=gs(e.target);if(t!==null){var n=Us(t);if(n!==null){if(t=n.tag,t===13){if(t=nj(n),t!==null){e.blockedOn=t,hj(e.priority,function(){dj(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function mc(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);$h=r,n.target.dispatchEvent(r),$h=null}else return t=tl(n),t!==null&&Wm(t),e.blockedOn=n,!1;t.shift()}return!0}function Oy(e,t,n){mc(e)&&n.delete(t)}function lR(){Bh=!1,Dr!==null&&mc(Dr)&&(Dr=null),zr!==null&&mc(zr)&&(zr=null),Fr!==null&&mc(Fr)&&(Fr=null),ha.forEach(Oy),pa.forEach(Oy)}function wo(e,t){e.blockedOn===t&&(e.blockedOn=null,Bh||(Bh=!0,Rt.unstable_scheduleCallback(Rt.unstable_NormalPriority,lR)))}function ma(e){function t(s){return wo(s,e)}if(0<Pl.length){wo(Pl[0],e);for(var n=1;n<Pl.length;n++){var r=Pl[n];r.blockedOn===e&&(r.blockedOn=null)}}for(Dr!==null&&wo(Dr,e),zr!==null&&wo(zr,e),Fr!==null&&wo(Fr,e),ha.forEach(t),pa.forEach(t),n=0;n<Rr.length;n++)r=Rr[n],r.blockedOn===e&&(r.blockedOn=null);for(;0<Rr.length&&(n=Rr[0],n.blockedOn===null);)pj(n),n.blockedOn===null&&Rr.shift()}var Ei=jr.ReactCurrentBatchConfig,Yc=!0;function cR(e,t,n,r){var s=_e,i=Ei.transition;Ei.transition=null;try{_e=1,Km(e,t,n,r)}finally{_e=s,Ei.transition=i}}function uR(e,t,n,r){var s=_e,i=Ei.transition;Ei.transition=null;try{_e=4,Km(e,t,n,r)}finally{_e=s,Ei.transition=i}}function Km(e,t,n,r){if(Yc){var s=Uh(e,t,n,r);if(s===null)xf(e,t,r,Xc,n),My(e,r);else if(aR(s,e,t,n,r))r.stopPropagation();else if(My(e,r),t&4&&-1<oR.indexOf(e)){for(;s!==null;){var i=tl(s);if(i!==null&&uj(i),i=Uh(e,t,n,r),i===null&&xf(e,t,r,Xc,n),i===s)break;s=i}s!==null&&r.stopPropagation()}else xf(e,t,r,null,n)}}var Xc=null;function Uh(e,t,n,r){if(Xc=null,e=Bm(r),e=gs(e),e!==null)if(t=Us(e),t===null)e=null;else if(n=t.tag,n===13){if(e=nj(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null);return Xc=e,null}function mj(e){switch(e){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(QA()){case Um:return 1;case oj:return 4;case qc:case ZA:return 16;case aj:return 536870912;default:return 16}default:return 16}}var Or=null,qm=null,gc=null;function gj(){if(gc)return gc;var e,t=qm,n=t.length,r,s="value"in Or?Or.value:Or.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 gc=s.slice(e,1<r?1-r:void 0)}function vc(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 Al(){return!0}function Ly(){return!1}function Lt(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)?Al:Ly,this.isPropagationStopped=Ly,this}return Oe(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=Al)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=Al)},persist:function(){},isPersistent:Al}),t}var so={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Gm=Lt(so),el=Oe({},so,{view:0,detail:0}),dR=Lt(el),uf,df,bo,ed=Oe({},el,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Ym,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!==bo&&(bo&&e.type==="mousemove"?(uf=e.screenX-bo.screenX,df=e.screenY-bo.screenY):df=uf=0,bo=e),uf)},movementY:function(e){return"movementY"in e?e.movementY:df}}),$y=Lt(ed),fR=Oe({},ed,{dataTransfer:0}),hR=Lt(fR),pR=Oe({},el,{relatedTarget:0}),ff=Lt(pR),mR=Oe({},so,{animationName:0,elapsedTime:0,pseudoElement:0}),gR=Lt(mR),vR=Oe({},so,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),yR=Lt(vR),xR=Oe({},so,{data:0}),Dy=Lt(xR),_R={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},wR={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"},bR={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function jR(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=bR[e])?!!t[e]:!1}function Ym(){return jR}var SR=Oe({},el,{key:function(e){if(e.key){var t=_R[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=vc(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?wR[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Ym,charCode:function(e){return e.type==="keypress"?vc(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?vc(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),kR=Lt(SR),NR=Oe({},ed,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),zy=Lt(NR),ER=Oe({},el,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Ym}),CR=Lt(ER),TR=Oe({},so,{propertyName:0,elapsedTime:0,pseudoElement:0}),PR=Lt(TR),AR=Oe({},ed,{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}),RR=Lt(AR),IR=[9,13,27,32],Xm=pr&&"CompositionEvent"in window,qo=null;pr&&"documentMode"in document&&(qo=document.documentMode);var MR=pr&&"TextEvent"in window&&!qo,vj=pr&&(!Xm||qo&&8<qo&&11>=qo),Fy=" ",Vy=!1;function yj(e,t){switch(e){case"keyup":return IR.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function xj(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var si=!1;function OR(e,t){switch(e){case"compositionend":return xj(t);case"keypress":return t.which!==32?null:(Vy=!0,Fy);case"textInput":return e=t.data,e===Fy&&Vy?null:e;default:return null}}function LR(e,t){if(si)return e==="compositionend"||!Xm&&yj(e,t)?(e=gj(),gc=qm=Or=null,si=!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 vj&&t.locale!=="ko"?null:t.data;default:return null}}var $R={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 By(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!$R[e.type]:t==="textarea"}function _j(e,t,n,r){Qb(r),t=Qc(t,"onChange"),0<t.length&&(n=new Gm("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var Go=null,ga=null;function DR(e){Aj(e,0)}function td(e){var t=ai(e);if(Hb(t))return e}function zR(e,t){if(e==="change")return t}var wj=!1;if(pr){var hf;if(pr){var pf="oninput"in document;if(!pf){var Uy=document.createElement("div");Uy.setAttribute("oninput","return;"),pf=typeof Uy.oninput=="function"}hf=pf}else hf=!1;wj=hf&&(!document.documentMode||9<document.documentMode)}function Hy(){Go&&(Go.detachEvent("onpropertychange",bj),ga=Go=null)}function bj(e){if(e.propertyName==="value"&&td(ga)){var t=[];_j(t,ga,e,Bm(e)),tj(DR,t)}}function FR(e,t,n){e==="focusin"?(Hy(),Go=t,ga=n,Go.attachEvent("onpropertychange",bj)):e==="focusout"&&Hy()}function VR(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return td(ga)}function BR(e,t){if(e==="click")return td(t)}function UR(e,t){if(e==="input"||e==="change")return td(t)}function HR(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var wn=typeof Object.is=="function"?Object.is:HR;function va(e,t){if(wn(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(!kh.call(t,s)||!wn(e[s],t[s]))return!1}return!0}function Wy(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Ky(e,t){var n=Wy(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=Wy(n)}}function jj(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?jj(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Sj(){for(var e=window,t=Hc();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Hc(e.document)}return t}function Qm(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 WR(e){var t=Sj(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&jj(n.ownerDocument.documentElement,n)){if(r!==null&&Qm(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=Ky(n,i);var o=Ky(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 KR=pr&&"documentMode"in document&&11>=document.documentMode,ii=null,Hh=null,Yo=null,Wh=!1;function qy(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Wh||ii==null||ii!==Hc(r)||(r=ii,"selectionStart"in r&&Qm(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}),Yo&&va(Yo,r)||(Yo=r,r=Qc(Hh,"onSelect"),0<r.length&&(t=new Gm("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=ii)))}function Rl(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var oi={animationend:Rl("Animation","AnimationEnd"),animationiteration:Rl("Animation","AnimationIteration"),animationstart:Rl("Animation","AnimationStart"),transitionend:Rl("Transition","TransitionEnd")},mf={},kj={};pr&&(kj=document.createElement("div").style,"AnimationEvent"in window||(delete oi.animationend.animation,delete oi.animationiteration.animation,delete oi.animationstart.animation),"TransitionEvent"in window||delete oi.transitionend.transition);function nd(e){if(mf[e])return mf[e];if(!oi[e])return e;var t=oi[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in kj)return mf[e]=t[n];return e}var Nj=nd("animationend"),Ej=nd("animationiteration"),Cj=nd("animationstart"),Tj=nd("transitionend"),Pj=new Map,Gy="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 Zr(e,t){Pj.set(e,t),Bs(t,[e])}for(var gf=0;gf<Gy.length;gf++){var vf=Gy[gf],qR=vf.toLowerCase(),GR=vf[0].toUpperCase()+vf.slice(1);Zr(qR,"on"+GR)}Zr(Nj,"onAnimationEnd");Zr(Ej,"onAnimationIteration");Zr(Cj,"onAnimationStart");Zr("dblclick","onDoubleClick");Zr("focusin","onFocus");Zr("focusout","onBlur");Zr(Tj,"onTransitionEnd");Mi("onMouseEnter",["mouseout","mouseover"]);Mi("onMouseLeave",["mouseout","mouseover"]);Mi("onPointerEnter",["pointerout","pointerover"]);Mi("onPointerLeave",["pointerout","pointerover"]);Bs("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));Bs("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));Bs("onBeforeInput",["compositionend","keypress","textInput","paste"]);Bs("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));Bs("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));Bs("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Lo="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(" "),YR=new Set("cancel close invalid load scroll toggle".split(" ").concat(Lo));function Yy(e,t,n){var r=e.type||"unknown-event";e.currentTarget=n,qA(r,t,void 0,e),e.currentTarget=null}function Aj(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;Yy(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;Yy(s,l,u),i=c}}}if(Kc)throw e=Fh,Kc=!1,Fh=null,e}function je(e,t){var n=t[Xh];n===void 0&&(n=t[Xh]=new Set);var r=e+"__bubble";n.has(r)||(Rj(t,e,2,!1),n.add(r))}function yf(e,t,n){var r=0;t&&(r|=4),Rj(n,e,r,t)}var Il="_reactListening"+Math.random().toString(36).slice(2);function ya(e){if(!e[Il]){e[Il]=!0,zb.forEach(function(n){n!=="selectionchange"&&(YR.has(n)||yf(n,!1,e),yf(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Il]||(t[Il]=!0,yf("selectionchange",!1,t))}}function Rj(e,t,n,r){switch(mj(t)){case 1:var s=cR;break;case 4:s=uR;break;default:s=Km}n=s.bind(null,t,n,e),s=void 0,!zh||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 xf(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=gs(l),o===null)return;if(c=o.tag,c===5||c===6){r=i=o;continue e}l=l.parentNode}}r=r.return}tj(function(){var u=i,d=Bm(n),f=[];e:{var h=Pj.get(e);if(h!==void 0){var p=Gm,g=e;switch(e){case"keypress":if(vc(n)===0)break e;case"keydown":case"keyup":p=kR;break;case"focusin":g="focus",p=ff;break;case"focusout":g="blur",p=ff;break;case"beforeblur":case"afterblur":p=ff;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=$y;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":p=hR;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":p=CR;break;case Nj:case Ej:case Cj:p=gR;break;case Tj:p=PR;break;case"scroll":p=dR;break;case"wheel":p=RR;break;case"copy":case"cut":case"paste":p=yR;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":p=zy}var x=(t&4)!==0,w=!x&&e==="scroll",v=x?h!==null?h+"Capture":null:h;x=[];for(var y=u,m;y!==null;){m=y;var b=m.stateNode;if(m.tag===5&&b!==null&&(m=b,v!==null&&(b=fa(y,v),b!=null&&x.push(xa(y,b,m)))),w)break;y=y.return}0<x.length&&(h=new p(h,g,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!==$h&&(g=n.relatedTarget||n.fromElement)&&(gs(g)||g[mr]))break e;if((p||h)&&(h=d.window===d?d:(h=d.ownerDocument)?h.defaultView||h.parentWindow:window,p?(g=n.relatedTarget||n.toElement,p=u,g=g?gs(g):null,g!==null&&(w=Us(g),g!==w||g.tag!==5&&g.tag!==6)&&(g=null)):(p=null,g=u),p!==g)){if(x=$y,b="onMouseLeave",v="onMouseEnter",y="mouse",(e==="pointerout"||e==="pointerover")&&(x=zy,b="onPointerLeave",v="onPointerEnter",y="pointer"),w=p==null?h:ai(p),m=g==null?h:ai(g),h=new x(b,y+"leave",p,n,d),h.target=w,h.relatedTarget=m,b=null,gs(d)===u&&(x=new x(v,y+"enter",g,n,d),x.target=m,x.relatedTarget=w,b=x),w=b,p&&g)t:{for(x=p,v=g,y=0,m=x;m;m=Qs(m))y++;for(m=0,b=v;b;b=Qs(b))m++;for(;0<y-m;)x=Qs(x),y--;for(;0<m-y;)v=Qs(v),m--;for(;y--;){if(x===v||v!==null&&x===v.alternate)break t;x=Qs(x),v=Qs(v)}x=null}else x=null;p!==null&&Xy(f,h,p,x,!1),g!==null&&w!==null&&Xy(f,w,g,x,!0)}}e:{if(h=u?ai(u):window,p=h.nodeName&&h.nodeName.toLowerCase(),p==="select"||p==="input"&&h.type==="file")var j=zR;else if(By(h))if(wj)j=UR;else{j=VR;var S=FR}else(p=h.nodeName)&&p.toLowerCase()==="input"&&(h.type==="checkbox"||h.type==="radio")&&(j=BR);if(j&&(j=j(e,u))){_j(f,j,n,d);break e}S&&S(e,h,u),e==="focusout"&&(S=h._wrapperState)&&S.controlled&&h.type==="number"&&Rh(h,"number",h.value)}switch(S=u?ai(u):window,e){case"focusin":(By(S)||S.contentEditable==="true")&&(ii=S,Hh=u,Yo=null);break;case"focusout":Yo=Hh=ii=null;break;case"mousedown":Wh=!0;break;case"contextmenu":case"mouseup":case"dragend":Wh=!1,qy(f,n,d);break;case"selectionchange":if(KR)break;case"keydown":case"keyup":qy(f,n,d)}var k;if(Xm)e:{switch(e){case"compositionstart":var N="onCompositionStart";break e;case"compositionend":N="onCompositionEnd";break e;case"compositionupdate":N="onCompositionUpdate";break e}N=void 0}else si?yj(e,n)&&(N="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(N="onCompositionStart");N&&(vj&&n.locale!=="ko"&&(si||N!=="onCompositionStart"?N==="onCompositionEnd"&&si&&(k=gj()):(Or=d,qm="value"in Or?Or.value:Or.textContent,si=!0)),S=Qc(u,N),0<S.length&&(N=new Dy(N,e,null,n,d),f.push({event:N,listeners:S}),k?N.data=k:(k=xj(n),k!==null&&(N.data=k)))),(k=MR?OR(e,n):LR(e,n))&&(u=Qc(u,"onBeforeInput"),0<u.length&&(d=new Dy("onBeforeInput","beforeinput",null,n,d),f.push({event:d,listeners:u}),d.data=k))}Aj(f,t)})}function xa(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Qc(e,t){for(var n=t+"Capture",r=[];e!==null;){var s=e,i=s.stateNode;s.tag===5&&i!==null&&(s=i,i=fa(e,n),i!=null&&r.unshift(xa(e,i,s)),i=fa(e,t),i!=null&&r.push(xa(e,i,s))),e=e.return}return r}function Qs(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function Xy(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=fa(n,i),c!=null&&o.unshift(xa(n,c,l))):s||(c=fa(n,i),c!=null&&o.push(xa(n,c,l)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var XR=/\r\n?/g,QR=/\u0000|\uFFFD/g;function Qy(e){return(typeof e=="string"?e:""+e).replace(XR,`
|
|
38
|
-
`).replace(QR,"")}function Ml(e,t,n){if(t=Qy(t),Qy(e)!==t&&n)throw Error(X(425))}function Zc(){}var Kh=null,qh=null;function Gh(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 Yh=typeof setTimeout=="function"?setTimeout:void 0,ZR=typeof clearTimeout=="function"?clearTimeout:void 0,Zy=typeof Promise=="function"?Promise:void 0,JR=typeof queueMicrotask=="function"?queueMicrotask:typeof Zy<"u"?function(e){return Zy.resolve(null).then(e).catch(eI)}:Yh;function eI(e){setTimeout(function(){throw e})}function _f(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),ma(t);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=s}while(n);ma(t)}function Vr(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 Jy(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 io=Math.random().toString(36).slice(2),In="__reactFiber$"+io,_a="__reactProps$"+io,mr="__reactContainer$"+io,Xh="__reactEvents$"+io,tI="__reactListeners$"+io,nI="__reactHandles$"+io;function gs(e){var t=e[In];if(t)return t;for(var n=e.parentNode;n;){if(t=n[mr]||n[In]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=Jy(e);e!==null;){if(n=e[In])return n;e=Jy(e)}return t}e=n,n=e.parentNode}return null}function tl(e){return e=e[In]||e[mr],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function ai(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(X(33))}function rd(e){return e[_a]||null}var Qh=[],li=-1;function Jr(e){return{current:e}}function ke(e){0>li||(e.current=Qh[li],Qh[li]=null,li--)}function we(e,t){li++,Qh[li]=e.current,e.current=t}var Gr={},lt=Jr(Gr),yt=Jr(!1),Es=Gr;function Oi(e,t){var n=e.type.contextTypes;if(!n)return Gr;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 xt(e){return e=e.childContextTypes,e!=null}function Jc(){ke(yt),ke(lt)}function ex(e,t,n){if(lt.current!==Gr)throw Error(X(168));we(lt,t),we(yt,n)}function Ij(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(X(108,FA(e)||"Unknown",s));return Oe({},n,r)}function eu(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Gr,Es=lt.current,we(lt,e),we(yt,yt.current),!0}function tx(e,t,n){var r=e.stateNode;if(!r)throw Error(X(169));n?(e=Ij(e,t,Es),r.__reactInternalMemoizedMergedChildContext=e,ke(yt),ke(lt),we(lt,e)):ke(yt),we(yt,n)}var Zn=null,sd=!1,wf=!1;function Mj(e){Zn===null?Zn=[e]:Zn.push(e)}function rI(e){sd=!0,Mj(e)}function es(){if(!wf&&Zn!==null){wf=!0;var e=0,t=_e;try{var n=Zn;for(_e=1;e<n.length;e++){var r=n[e];do r=r(!0);while(r!==null)}Zn=null,sd=!1}catch(s){throw Zn!==null&&(Zn=Zn.slice(e+1)),ij(Um,es),s}finally{_e=t,wf=!1}}return null}var ci=[],ui=0,tu=null,nu=0,Wt=[],Kt=0,Cs=null,nr=1,rr="";function ls(e,t){ci[ui++]=nu,ci[ui++]=tu,tu=e,nu=t}function Oj(e,t,n){Wt[Kt++]=nr,Wt[Kt++]=rr,Wt[Kt++]=Cs,Cs=e;var r=nr;e=rr;var s=32-gn(r)-1;r&=~(1<<s),n+=1;var i=32-gn(t)+s;if(30<i){var o=s-s%5;i=(r&(1<<o)-1).toString(32),r>>=o,s-=o,nr=1<<32-gn(t)+s|n<<s|r,rr=i+e}else nr=1<<i|n<<s|r,rr=e}function Zm(e){e.return!==null&&(ls(e,1),Oj(e,1,0))}function Jm(e){for(;e===tu;)tu=ci[--ui],ci[ui]=null,nu=ci[--ui],ci[ui]=null;for(;e===Cs;)Cs=Wt[--Kt],Wt[Kt]=null,rr=Wt[--Kt],Wt[Kt]=null,nr=Wt[--Kt],Wt[Kt]=null}var Tt=null,Et=null,Pe=!1,dn=null;function Lj(e,t){var n=Yt(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 nx(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,Tt=e,Et=Vr(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,Tt=e,Et=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(n=Cs!==null?{id:nr,overflow:rr}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=Yt(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,Tt=e,Et=null,!0):!1;default:return!1}}function Zh(e){return(e.mode&1)!==0&&(e.flags&128)===0}function Jh(e){if(Pe){var t=Et;if(t){var n=t;if(!nx(e,t)){if(Zh(e))throw Error(X(418));t=Vr(n.nextSibling);var r=Tt;t&&nx(e,t)?Lj(r,n):(e.flags=e.flags&-4097|2,Pe=!1,Tt=e)}}else{if(Zh(e))throw Error(X(418));e.flags=e.flags&-4097|2,Pe=!1,Tt=e}}}function rx(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;Tt=e}function Ol(e){if(e!==Tt)return!1;if(!Pe)return rx(e),Pe=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!Gh(e.type,e.memoizedProps)),t&&(t=Et)){if(Zh(e))throw $j(),Error(X(418));for(;t;)Lj(e,t),t=Vr(t.nextSibling)}if(rx(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(X(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"){if(t===0){Et=Vr(e.nextSibling);break e}t--}else n!=="$"&&n!=="$!"&&n!=="$?"||t++}e=e.nextSibling}Et=null}}else Et=Tt?Vr(e.stateNode.nextSibling):null;return!0}function $j(){for(var e=Et;e;)e=Vr(e.nextSibling)}function Li(){Et=Tt=null,Pe=!1}function eg(e){dn===null?dn=[e]:dn.push(e)}var sI=jr.ReactCurrentBatchConfig;function jo(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(X(309));var r=n.stateNode}if(!r)throw Error(X(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(X(284));if(!n._owner)throw Error(X(290,e))}return e}function Ll(e,t){throw e=Object.prototype.toString.call(t),Error(X(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function sx(e){var t=e._init;return t(e._payload)}function Dj(e){function t(v,y){if(e){var m=v.deletions;m===null?(v.deletions=[y],v.flags|=16):m.push(y)}}function n(v,y){if(!e)return null;for(;y!==null;)t(v,y),y=y.sibling;return null}function r(v,y){for(v=new Map;y!==null;)y.key!==null?v.set(y.key,y):v.set(y.index,y),y=y.sibling;return v}function s(v,y){return v=Wr(v,y),v.index=0,v.sibling=null,v}function i(v,y,m){return v.index=m,e?(m=v.alternate,m!==null?(m=m.index,m<y?(v.flags|=2,y):m):(v.flags|=2,y)):(v.flags|=1048576,y)}function o(v){return e&&v.alternate===null&&(v.flags|=2),v}function l(v,y,m,b){return y===null||y.tag!==6?(y=Cf(m,v.mode,b),y.return=v,y):(y=s(y,m),y.return=v,y)}function c(v,y,m,b){var j=m.type;return j===ri?d(v,y,m.props.children,b,m.key):y!==null&&(y.elementType===j||typeof j=="object"&&j!==null&&j.$$typeof===Pr&&sx(j)===y.type)?(b=s(y,m.props),b.ref=jo(v,y,m),b.return=v,b):(b=Sc(m.type,m.key,m.props,null,v.mode,b),b.ref=jo(v,y,m),b.return=v,b)}function u(v,y,m,b){return y===null||y.tag!==4||y.stateNode.containerInfo!==m.containerInfo||y.stateNode.implementation!==m.implementation?(y=Tf(m,v.mode,b),y.return=v,y):(y=s(y,m.children||[]),y.return=v,y)}function d(v,y,m,b,j){return y===null||y.tag!==7?(y=bs(m,v.mode,b,j),y.return=v,y):(y=s(y,m),y.return=v,y)}function f(v,y,m){if(typeof y=="string"&&y!==""||typeof y=="number")return y=Cf(""+y,v.mode,m),y.return=v,y;if(typeof y=="object"&&y!==null){switch(y.$$typeof){case kl:return m=Sc(y.type,y.key,y.props,null,v.mode,m),m.ref=jo(v,null,y),m.return=v,m;case ni:return y=Tf(y,v.mode,m),y.return=v,y;case Pr:var b=y._init;return f(v,b(y._payload),m)}if(Mo(y)||yo(y))return y=bs(y,v.mode,m,null),y.return=v,y;Ll(v,y)}return null}function h(v,y,m,b){var j=y!==null?y.key:null;if(typeof m=="string"&&m!==""||typeof m=="number")return j!==null?null:l(v,y,""+m,b);if(typeof m=="object"&&m!==null){switch(m.$$typeof){case kl:return m.key===j?c(v,y,m,b):null;case ni:return m.key===j?u(v,y,m,b):null;case Pr:return j=m._init,h(v,y,j(m._payload),b)}if(Mo(m)||yo(m))return j!==null?null:d(v,y,m,b,null);Ll(v,m)}return null}function p(v,y,m,b,j){if(typeof b=="string"&&b!==""||typeof b=="number")return v=v.get(m)||null,l(y,v,""+b,j);if(typeof b=="object"&&b!==null){switch(b.$$typeof){case kl:return v=v.get(b.key===null?m:b.key)||null,c(y,v,b,j);case ni:return v=v.get(b.key===null?m:b.key)||null,u(y,v,b,j);case Pr:var S=b._init;return p(v,y,m,S(b._payload),j)}if(Mo(b)||yo(b))return v=v.get(m)||null,d(y,v,b,j,null);Ll(y,b)}return null}function g(v,y,m,b){for(var j=null,S=null,k=y,N=y=0,A=null;k!==null&&N<m.length;N++){k.index>N?(A=k,k=null):A=k.sibling;var O=h(v,k,m[N],b);if(O===null){k===null&&(k=A);break}e&&k&&O.alternate===null&&t(v,k),y=i(O,y,N),S===null?j=O:S.sibling=O,S=O,k=A}if(N===m.length)return n(v,k),Pe&&ls(v,N),j;if(k===null){for(;N<m.length;N++)k=f(v,m[N],b),k!==null&&(y=i(k,y,N),S===null?j=k:S.sibling=k,S=k);return Pe&&ls(v,N),j}for(k=r(v,k);N<m.length;N++)A=p(k,v,N,m[N],b),A!==null&&(e&&A.alternate!==null&&k.delete(A.key===null?N:A.key),y=i(A,y,N),S===null?j=A:S.sibling=A,S=A);return e&&k.forEach(function(D){return t(v,D)}),Pe&&ls(v,N),j}function x(v,y,m,b){var j=yo(m);if(typeof j!="function")throw Error(X(150));if(m=j.call(m),m==null)throw Error(X(151));for(var S=j=null,k=y,N=y=0,A=null,O=m.next();k!==null&&!O.done;N++,O=m.next()){k.index>N?(A=k,k=null):A=k.sibling;var D=h(v,k,O.value,b);if(D===null){k===null&&(k=A);break}e&&k&&D.alternate===null&&t(v,k),y=i(D,y,N),S===null?j=D:S.sibling=D,S=D,k=A}if(O.done)return n(v,k),Pe&&ls(v,N),j;if(k===null){for(;!O.done;N++,O=m.next())O=f(v,O.value,b),O!==null&&(y=i(O,y,N),S===null?j=O:S.sibling=O,S=O);return Pe&&ls(v,N),j}for(k=r(v,k);!O.done;N++,O=m.next())O=p(k,v,N,O.value,b),O!==null&&(e&&O.alternate!==null&&k.delete(O.key===null?N:O.key),y=i(O,y,N),S===null?j=O:S.sibling=O,S=O);return e&&k.forEach(function(I){return t(v,I)}),Pe&&ls(v,N),j}function w(v,y,m,b){if(typeof m=="object"&&m!==null&&m.type===ri&&m.key===null&&(m=m.props.children),typeof m=="object"&&m!==null){switch(m.$$typeof){case kl:e:{for(var j=m.key,S=y;S!==null;){if(S.key===j){if(j=m.type,j===ri){if(S.tag===7){n(v,S.sibling),y=s(S,m.props.children),y.return=v,v=y;break e}}else if(S.elementType===j||typeof j=="object"&&j!==null&&j.$$typeof===Pr&&sx(j)===S.type){n(v,S.sibling),y=s(S,m.props),y.ref=jo(v,S,m),y.return=v,v=y;break e}n(v,S);break}else t(v,S);S=S.sibling}m.type===ri?(y=bs(m.props.children,v.mode,b,m.key),y.return=v,v=y):(b=Sc(m.type,m.key,m.props,null,v.mode,b),b.ref=jo(v,y,m),b.return=v,v=b)}return o(v);case ni:e:{for(S=m.key;y!==null;){if(y.key===S)if(y.tag===4&&y.stateNode.containerInfo===m.containerInfo&&y.stateNode.implementation===m.implementation){n(v,y.sibling),y=s(y,m.children||[]),y.return=v,v=y;break e}else{n(v,y);break}else t(v,y);y=y.sibling}y=Tf(m,v.mode,b),y.return=v,v=y}return o(v);case Pr:return S=m._init,w(v,y,S(m._payload),b)}if(Mo(m))return g(v,y,m,b);if(yo(m))return x(v,y,m,b);Ll(v,m)}return typeof m=="string"&&m!==""||typeof m=="number"?(m=""+m,y!==null&&y.tag===6?(n(v,y.sibling),y=s(y,m),y.return=v,v=y):(n(v,y),y=Cf(m,v.mode,b),y.return=v,v=y),o(v)):n(v,y)}return w}var $i=Dj(!0),zj=Dj(!1),ru=Jr(null),su=null,di=null,tg=null;function ng(){tg=di=su=null}function rg(e){var t=ru.current;ke(ru),e._currentValue=t}function ep(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 Ci(e,t){su=e,tg=di=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(gt=!0),e.firstContext=null)}function en(e){var t=e._currentValue;if(tg!==e)if(e={context:e,memoizedValue:t,next:null},di===null){if(su===null)throw Error(X(308));di=e,su.dependencies={lanes:0,firstContext:e}}else di=di.next=e;return t}var vs=null;function sg(e){vs===null?vs=[e]:vs.push(e)}function Fj(e,t,n,r){var s=t.interleaved;return s===null?(n.next=n,sg(t)):(n.next=s.next,s.next=n),t.interleaved=n,gr(e,r)}function gr(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 Ar=!1;function ig(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Vj(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 ar(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Br(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,he&2){var s=r.pending;return s===null?t.next=t:(t.next=s.next,s.next=t),r.pending=t,gr(e,n)}return s=r.interleaved,s===null?(t.next=t,sg(r)):(t.next=s.next,s.next=t),r.interleaved=t,gr(e,n)}function yc(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,Hm(e,n)}}function ix(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 iu(e,t,n,r){var s=e.updateQueue;Ar=!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 g=e,x=l;switch(h=t,p=n,x.tag){case 1:if(g=x.payload,typeof g=="function"){f=g.call(p,f,h);break e}f=g;break e;case 3:g.flags=g.flags&-65537|128;case 0:if(g=x.payload,h=typeof g=="function"?g.call(p,f,h):g,h==null)break e;f=Oe({},f,h);break e;case 2:Ar=!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);Ps|=o,e.lanes=o,e.memoizedState=f}}function ox(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(X(191,s));s.call(r)}}}var nl={},Dn=Jr(nl),wa=Jr(nl),ba=Jr(nl);function ys(e){if(e===nl)throw Error(X(174));return e}function og(e,t){switch(we(ba,t),we(wa,e),we(Dn,nl),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:Mh(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=Mh(t,e)}ke(Dn),we(Dn,t)}function Di(){ke(Dn),ke(wa),ke(ba)}function Bj(e){ys(ba.current);var t=ys(Dn.current),n=Mh(t,e.type);t!==n&&(we(wa,e),we(Dn,n))}function ag(e){wa.current===e&&(ke(Dn),ke(wa))}var Re=Jr(0);function ou(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 bf=[];function lg(){for(var e=0;e<bf.length;e++)bf[e]._workInProgressVersionPrimary=null;bf.length=0}var xc=jr.ReactCurrentDispatcher,jf=jr.ReactCurrentBatchConfig,Ts=0,Me=null,We=null,qe=null,au=!1,Xo=!1,ja=0,iI=0;function tt(){throw Error(X(321))}function cg(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!wn(e[n],t[n]))return!1;return!0}function ug(e,t,n,r,s,i){if(Ts=i,Me=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,xc.current=e===null||e.memoizedState===null?cI:uI,e=n(r,s),Xo){i=0;do{if(Xo=!1,ja=0,25<=i)throw Error(X(301));i+=1,qe=We=null,t.updateQueue=null,xc.current=dI,e=n(r,s)}while(Xo)}if(xc.current=lu,t=We!==null&&We.next!==null,Ts=0,qe=We=Me=null,au=!1,t)throw Error(X(300));return e}function dg(){var e=ja!==0;return ja=0,e}function Pn(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return qe===null?Me.memoizedState=qe=e:qe=qe.next=e,qe}function tn(){if(We===null){var e=Me.alternate;e=e!==null?e.memoizedState:null}else e=We.next;var t=qe===null?Me.memoizedState:qe.next;if(t!==null)qe=t,We=e;else{if(e===null)throw Error(X(310));We=e,e={memoizedState:We.memoizedState,baseState:We.baseState,baseQueue:We.baseQueue,queue:We.queue,next:null},qe===null?Me.memoizedState=qe=e:qe=qe.next=e}return qe}function Sa(e,t){return typeof t=="function"?t(e):t}function Sf(e){var t=tn(),n=t.queue;if(n===null)throw Error(X(311));n.lastRenderedReducer=e;var r=We,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((Ts&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,Me.lanes|=d,Ps|=d}u=u.next}while(u!==null&&u!==i);c===null?o=r:c.next=l,wn(r,t.memoizedState)||(gt=!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,Me.lanes|=i,Ps|=i,s=s.next;while(s!==e)}else s===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function kf(e){var t=tn(),n=t.queue;if(n===null)throw Error(X(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);wn(i,t.memoizedState)||(gt=!0),t.memoizedState=i,t.baseQueue===null&&(t.baseState=i),n.lastRenderedState=i}return[i,r]}function Uj(){}function Hj(e,t){var n=Me,r=tn(),s=t(),i=!wn(r.memoizedState,s);if(i&&(r.memoizedState=s,gt=!0),r=r.queue,fg(qj.bind(null,n,r,e),[e]),r.getSnapshot!==t||i||qe!==null&&qe.memoizedState.tag&1){if(n.flags|=2048,ka(9,Kj.bind(null,n,r,s,t),void 0,null),Ge===null)throw Error(X(349));Ts&30||Wj(n,t,s)}return s}function Wj(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=Me.updateQueue,t===null?(t={lastEffect:null,stores:null},Me.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function Kj(e,t,n,r){t.value=n,t.getSnapshot=r,Gj(t)&&Yj(e)}function qj(e,t,n){return n(function(){Gj(t)&&Yj(e)})}function Gj(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!wn(e,n)}catch{return!0}}function Yj(e){var t=gr(e,1);t!==null&&vn(t,e,1,-1)}function ax(e){var t=Pn();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Sa,lastRenderedState:e},t.queue=e,e=e.dispatch=lI.bind(null,Me,e),[t.memoizedState,e]}function ka(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},t=Me.updateQueue,t===null?(t={lastEffect:null,stores:null},Me.updateQueue=t,t.lastEffect=e.next=e):(n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e)),e}function Xj(){return tn().memoizedState}function _c(e,t,n,r){var s=Pn();Me.flags|=e,s.memoizedState=ka(1|t,n,void 0,r===void 0?null:r)}function id(e,t,n,r){var s=tn();r=r===void 0?null:r;var i=void 0;if(We!==null){var o=We.memoizedState;if(i=o.destroy,r!==null&&cg(r,o.deps)){s.memoizedState=ka(t,n,i,r);return}}Me.flags|=e,s.memoizedState=ka(1|t,n,i,r)}function lx(e,t){return _c(8390656,8,e,t)}function fg(e,t){return id(2048,8,e,t)}function Qj(e,t){return id(4,2,e,t)}function Zj(e,t){return id(4,4,e,t)}function Jj(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 eS(e,t,n){return n=n!=null?n.concat([e]):null,id(4,4,Jj.bind(null,t,e),n)}function hg(){}function tS(e,t){var n=tn();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&cg(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function nS(e,t){var n=tn();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&cg(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function rS(e,t,n){return Ts&21?(wn(n,t)||(n=lj(),Me.lanes|=n,Ps|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,gt=!0),e.memoizedState=n)}function oI(e,t){var n=_e;_e=n!==0&&4>n?n:4,e(!0);var r=jf.transition;jf.transition={};try{e(!1),t()}finally{_e=n,jf.transition=r}}function sS(){return tn().memoizedState}function aI(e,t,n){var r=Hr(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},iS(e))oS(t,n);else if(n=Fj(e,t,n,r),n!==null){var s=ft();vn(n,e,r,s),aS(n,t,r)}}function lI(e,t,n){var r=Hr(e),s={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(iS(e))oS(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,wn(l,o)){var c=t.interleaved;c===null?(s.next=s,sg(t)):(s.next=c.next,c.next=s),t.interleaved=s;return}}catch{}finally{}n=Fj(e,t,s,r),n!==null&&(s=ft(),vn(n,e,r,s),aS(n,t,r))}}function iS(e){var t=e.alternate;return e===Me||t!==null&&t===Me}function oS(e,t){Xo=au=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function aS(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Hm(e,n)}}var lu={readContext:en,useCallback:tt,useContext:tt,useEffect:tt,useImperativeHandle:tt,useInsertionEffect:tt,useLayoutEffect:tt,useMemo:tt,useReducer:tt,useRef:tt,useState:tt,useDebugValue:tt,useDeferredValue:tt,useTransition:tt,useMutableSource:tt,useSyncExternalStore:tt,useId:tt,unstable_isNewReconciler:!1},cI={readContext:en,useCallback:function(e,t){return Pn().memoizedState=[e,t===void 0?null:t],e},useContext:en,useEffect:lx,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,_c(4194308,4,Jj.bind(null,t,e),n)},useLayoutEffect:function(e,t){return _c(4194308,4,e,t)},useInsertionEffect:function(e,t){return _c(4,2,e,t)},useMemo:function(e,t){var n=Pn();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Pn();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=aI.bind(null,Me,e),[r.memoizedState,e]},useRef:function(e){var t=Pn();return e={current:e},t.memoizedState=e},useState:ax,useDebugValue:hg,useDeferredValue:function(e){return Pn().memoizedState=e},useTransition:function(){var e=ax(!1),t=e[0];return e=oI.bind(null,e[1]),Pn().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=Me,s=Pn();if(Pe){if(n===void 0)throw Error(X(407));n=n()}else{if(n=t(),Ge===null)throw Error(X(349));Ts&30||Wj(r,t,n)}s.memoizedState=n;var i={value:n,getSnapshot:t};return s.queue=i,lx(qj.bind(null,r,i,e),[e]),r.flags|=2048,ka(9,Kj.bind(null,r,i,n,t),void 0,null),n},useId:function(){var e=Pn(),t=Ge.identifierPrefix;if(Pe){var n=rr,r=nr;n=(r&~(1<<32-gn(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=ja++,0<n&&(t+="H"+n.toString(32)),t+=":"}else n=iI++,t=":"+t+"r"+n.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},uI={readContext:en,useCallback:tS,useContext:en,useEffect:fg,useImperativeHandle:eS,useInsertionEffect:Qj,useLayoutEffect:Zj,useMemo:nS,useReducer:Sf,useRef:Xj,useState:function(){return Sf(Sa)},useDebugValue:hg,useDeferredValue:function(e){var t=tn();return rS(t,We.memoizedState,e)},useTransition:function(){var e=Sf(Sa)[0],t=tn().memoizedState;return[e,t]},useMutableSource:Uj,useSyncExternalStore:Hj,useId:sS,unstable_isNewReconciler:!1},dI={readContext:en,useCallback:tS,useContext:en,useEffect:fg,useImperativeHandle:eS,useInsertionEffect:Qj,useLayoutEffect:Zj,useMemo:nS,useReducer:kf,useRef:Xj,useState:function(){return kf(Sa)},useDebugValue:hg,useDeferredValue:function(e){var t=tn();return We===null?t.memoizedState=e:rS(t,We.memoizedState,e)},useTransition:function(){var e=kf(Sa)[0],t=tn().memoizedState;return[e,t]},useMutableSource:Uj,useSyncExternalStore:Hj,useId:sS,unstable_isNewReconciler:!1};function ln(e,t){if(e&&e.defaultProps){t=Oe({},t),e=e.defaultProps;for(var n in e)t[n]===void 0&&(t[n]=e[n]);return t}return t}function tp(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:Oe({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var od={isMounted:function(e){return(e=e._reactInternals)?Us(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=ft(),s=Hr(e),i=ar(r,s);i.payload=t,n!=null&&(i.callback=n),t=Br(e,i,s),t!==null&&(vn(t,e,s,r),yc(t,e,s))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=ft(),s=Hr(e),i=ar(r,s);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=Br(e,i,s),t!==null&&(vn(t,e,s,r),yc(t,e,s))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=ft(),r=Hr(e),s=ar(n,r);s.tag=2,t!=null&&(s.callback=t),t=Br(e,s,r),t!==null&&(vn(t,e,r,n),yc(t,e,r))}};function cx(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?!va(n,r)||!va(s,i):!0}function lS(e,t,n){var r=!1,s=Gr,i=t.contextType;return typeof i=="object"&&i!==null?i=en(i):(s=xt(t)?Es:lt.current,r=t.contextTypes,i=(r=r!=null)?Oi(e,s):Gr),t=new t(n,i),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=od,e.stateNode=t,t._reactInternals=e,r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=s,e.__reactInternalMemoizedMaskedChildContext=i),t}function ux(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&&od.enqueueReplaceState(t,t.state,null)}function np(e,t,n,r){var s=e.stateNode;s.props=n,s.state=e.memoizedState,s.refs={},ig(e);var i=t.contextType;typeof i=="object"&&i!==null?s.context=en(i):(i=xt(t)?Es:lt.current,s.context=Oi(e,i)),s.state=e.memoizedState,i=t.getDerivedStateFromProps,typeof i=="function"&&(tp(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&&od.enqueueReplaceState(s,s.state,null),iu(e,n,s,r),s.state=e.memoizedState),typeof s.componentDidMount=="function"&&(e.flags|=4194308)}function zi(e,t){try{var n="",r=t;do n+=zA(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 Nf(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function rp(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var fI=typeof WeakMap=="function"?WeakMap:Map;function cS(e,t,n){n=ar(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){uu||(uu=!0,hp=r),rp(e,t)},n}function uS(e,t,n){n=ar(-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(){rp(e,t)}}var i=e.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(n.callback=function(){rp(e,t),typeof r!="function"&&(Ur===null?Ur=new Set([this]):Ur.add(this));var o=t.stack;this.componentDidCatch(t.value,{componentStack:o!==null?o:""})}),n}function dx(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new fI;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=NI.bind(null,e,t,n),t.then(e,e))}function fx(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 hx(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=ar(-1,1),t.tag=2,Br(n,t,1))),n.lanes|=1),e)}var hI=jr.ReactCurrentOwner,gt=!1;function ut(e,t,n,r){t.child=e===null?zj(t,null,n,r):$i(t,e.child,n,r)}function px(e,t,n,r,s){n=n.render;var i=t.ref;return Ci(t,s),r=ug(e,t,n,r,i,s),n=dg(),e!==null&&!gt?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~s,vr(e,t,s)):(Pe&&n&&Zm(t),t.flags|=1,ut(e,t,r,s),t.child)}function mx(e,t,n,r,s){if(e===null){var i=n.type;return typeof i=="function"&&!wg(i)&&i.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=i,dS(e,t,i,r,s)):(e=Sc(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:va,n(o,r)&&e.ref===t.ref)return vr(e,t,s)}return t.flags|=1,e=Wr(i,r),e.ref=t.ref,e.return=t,t.child=e}function dS(e,t,n,r,s){if(e!==null){var i=e.memoizedProps;if(va(i,r)&&e.ref===t.ref)if(gt=!1,t.pendingProps=r=i,(e.lanes&s)!==0)e.flags&131072&&(gt=!0);else return t.lanes=e.lanes,vr(e,t,s)}return sp(e,t,n,r,s)}function fS(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},we(hi,bt),bt|=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,we(hi,bt),bt|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=i!==null?i.baseLanes:n,we(hi,bt),bt|=r}else i!==null?(r=i.baseLanes|n,t.memoizedState=null):r=n,we(hi,bt),bt|=r;return ut(e,t,s,n),t.child}function hS(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function sp(e,t,n,r,s){var i=xt(n)?Es:lt.current;return i=Oi(t,i),Ci(t,s),n=ug(e,t,n,r,i,s),r=dg(),e!==null&&!gt?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~s,vr(e,t,s)):(Pe&&r&&Zm(t),t.flags|=1,ut(e,t,n,s),t.child)}function gx(e,t,n,r,s){if(xt(n)){var i=!0;eu(t)}else i=!1;if(Ci(t,s),t.stateNode===null)wc(e,t),lS(t,n,r),np(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=en(u):(u=xt(n)?Es:lt.current,u=Oi(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)&&ux(t,o,r,u),Ar=!1;var h=t.memoizedState;o.state=h,iu(t,r,o,s),c=t.memoizedState,l!==r||h!==c||yt.current||Ar?(typeof d=="function"&&(tp(t,n,d,r),c=t.memoizedState),(l=Ar||cx(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,Vj(e,t),l=t.memoizedProps,u=t.type===t.elementType?l:ln(t.type,l),o.props=u,f=t.pendingProps,h=o.context,c=n.contextType,typeof c=="object"&&c!==null?c=en(c):(c=xt(n)?Es:lt.current,c=Oi(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)&&ux(t,o,r,c),Ar=!1,h=t.memoizedState,o.state=h,iu(t,r,o,s);var g=t.memoizedState;l!==f||h!==g||yt.current||Ar?(typeof p=="function"&&(tp(t,n,p,r),g=t.memoizedState),(u=Ar||cx(t,n,u,r,h,g,c)||!1)?(d||typeof o.UNSAFE_componentWillUpdate!="function"&&typeof o.componentWillUpdate!="function"||(typeof o.componentWillUpdate=="function"&&o.componentWillUpdate(r,g,c),typeof o.UNSAFE_componentWillUpdate=="function"&&o.UNSAFE_componentWillUpdate(r,g,c)),typeof o.componentDidUpdate=="function"&&(t.flags|=4),typeof o.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof o.componentDidUpdate!="function"||l===e.memoizedProps&&h===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&h===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=g),o.props=r,o.state=g,o.context=c,r=u):(typeof o.componentDidUpdate!="function"||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 ip(e,t,n,r,i,s)}function ip(e,t,n,r,s,i){hS(e,t);var o=(t.flags&128)!==0;if(!r&&!o)return s&&tx(t,n,!1),vr(e,t,i);r=t.stateNode,hI.current=t;var l=o&&typeof n.getDerivedStateFromError!="function"?null:r.render();return t.flags|=1,e!==null&&o?(t.child=$i(t,e.child,null,i),t.child=$i(t,null,l,i)):ut(e,t,l,i),t.memoizedState=r.state,s&&tx(t,n,!0),t.child}function pS(e){var t=e.stateNode;t.pendingContext?ex(e,t.pendingContext,t.pendingContext!==t.context):t.context&&ex(e,t.context,!1),og(e,t.containerInfo)}function vx(e,t,n,r,s){return Li(),eg(s),t.flags|=256,ut(e,t,n,r),t.child}var op={dehydrated:null,treeContext:null,retryLane:0};function ap(e){return{baseLanes:e,cachePool:null,transitions:null}}function mS(e,t,n){var r=t.pendingProps,s=Re.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),we(Re,s&1),e===null)return Jh(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=cd(o,r,0,null),e=bs(e,r,n,null),i.return=t,e.return=t,i.sibling=e,t.child=i,t.child.memoizedState=ap(n),t.memoizedState=op,e):pg(t,o));if(s=e.memoizedState,s!==null&&(l=s.dehydrated,l!==null))return pI(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=Wr(s,c),r.subtreeFlags=s.subtreeFlags&14680064),l!==null?i=Wr(l,i):(i=bs(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?ap(n):{baseLanes:o.baseLanes|n,cachePool:null,transitions:o.transitions},i.memoizedState=o,i.childLanes=e.childLanes&~n,t.memoizedState=op,r}return i=e.child,e=i.sibling,r=Wr(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 pg(e,t){return t=cd({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function $l(e,t,n,r){return r!==null&&eg(r),$i(t,e.child,null,n),e=pg(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function pI(e,t,n,r,s,i,o){if(n)return t.flags&256?(t.flags&=-257,r=Nf(Error(X(422))),$l(e,t,o,r)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(i=r.fallback,s=t.mode,r=cd({mode:"visible",children:r.children},s,0,null),i=bs(i,s,o,null),i.flags|=2,r.return=t,i.return=t,r.sibling=i,t.child=r,t.mode&1&&$i(t,e.child,null,o),t.child.memoizedState=ap(o),t.memoizedState=op,i);if(!(t.mode&1))return $l(e,t,o,null);if(s.data==="$!"){if(r=s.nextSibling&&s.nextSibling.dataset,r)var l=r.dgst;return r=l,i=Error(X(419)),r=Nf(i,r,void 0),$l(e,t,o,r)}if(l=(o&e.childLanes)!==0,gt||l){if(r=Ge,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,gr(e,s),vn(r,e,s,-1))}return _g(),r=Nf(Error(X(421))),$l(e,t,o,r)}return s.data==="$?"?(t.flags|=128,t.child=e.child,t=EI.bind(null,e),s._reactRetry=t,null):(e=i.treeContext,Et=Vr(s.nextSibling),Tt=t,Pe=!0,dn=null,e!==null&&(Wt[Kt++]=nr,Wt[Kt++]=rr,Wt[Kt++]=Cs,nr=e.id,rr=e.overflow,Cs=t),t=pg(t,r.children),t.flags|=4096,t)}function yx(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),ep(e.return,t,n)}function Ef(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 gS(e,t,n){var r=t.pendingProps,s=r.revealOrder,i=r.tail;if(ut(e,t,r.children,n),r=Re.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&&yx(e,n,t);else if(e.tag===19)yx(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(we(Re,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&&ou(e)===null&&(s=n),n=n.sibling;n=s,n===null?(s=t.child,t.child=null):(s=n.sibling,n.sibling=null),Ef(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&&ou(e)===null){t.child=s;break}e=s.sibling,s.sibling=n,n=s,s=e}Ef(t,!0,n,null,i);break;case"together":Ef(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function wc(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function vr(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Ps|=t.lanes,!(n&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(X(153));if(t.child!==null){for(e=t.child,n=Wr(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Wr(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function mI(e,t,n){switch(t.tag){case 3:pS(t),Li();break;case 5:Bj(t);break;case 1:xt(t.type)&&eu(t);break;case 4:og(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,s=t.memoizedProps.value;we(ru,r._currentValue),r._currentValue=s;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?(we(Re,Re.current&1),t.flags|=128,null):n&t.child.childLanes?mS(e,t,n):(we(Re,Re.current&1),e=vr(e,t,n),e!==null?e.sibling:null);we(Re,Re.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return gS(e,t,n);t.flags|=128}if(s=t.memoizedState,s!==null&&(s.rendering=null,s.tail=null,s.lastEffect=null),we(Re,Re.current),r)break;return null;case 22:case 23:return t.lanes=0,fS(e,t,n)}return vr(e,t,n)}var vS,lp,yS,xS;vS=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}};lp=function(){};yS=function(e,t,n,r){var s=e.memoizedProps;if(s!==r){e=t.stateNode,ys(Dn.current);var i=null;switch(n){case"input":s=Ph(e,s),r=Ph(e,r),i=[];break;case"select":s=Oe({},s,{value:void 0}),r=Oe({},r,{value:void 0}),i=[];break;case"textarea":s=Ih(e,s),r=Ih(e,r),i=[];break;default:typeof s.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=Zc)}Oh(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"&&(ua.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"&&(ua.hasOwnProperty(u)?(c!=null&&u==="onScroll"&&je("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)}};xS=function(e,t,n,r){n!==r&&(t.flags|=4)};function So(e,t){if(!Pe)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 nt(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 gI(e,t,n){var r=t.pendingProps;switch(Jm(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return nt(t),null;case 1:return xt(t.type)&&Jc(),nt(t),null;case 3:return r=t.stateNode,Di(),ke(yt),ke(lt),lg(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(Ol(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,dn!==null&&(gp(dn),dn=null))),lp(e,t),nt(t),null;case 5:ag(t);var s=ys(ba.current);if(n=t.type,e!==null&&t.stateNode!=null)yS(e,t,n,r,s),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(t.stateNode===null)throw Error(X(166));return nt(t),null}if(e=ys(Dn.current),Ol(t)){r=t.stateNode,n=t.type;var i=t.memoizedProps;switch(r[In]=t,r[_a]=i,e=(t.mode&1)!==0,n){case"dialog":je("cancel",r),je("close",r);break;case"iframe":case"object":case"embed":je("load",r);break;case"video":case"audio":for(s=0;s<Lo.length;s++)je(Lo[s],r);break;case"source":je("error",r);break;case"img":case"image":case"link":je("error",r),je("load",r);break;case"details":je("toggle",r);break;case"input":Ey(r,i),je("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!i.multiple},je("invalid",r);break;case"textarea":Ty(r,i),je("invalid",r)}Oh(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&&Ml(r.textContent,l,e),s=["children",l]):typeof l=="number"&&r.textContent!==""+l&&(i.suppressHydrationWarning!==!0&&Ml(r.textContent,l,e),s=["children",""+l]):ua.hasOwnProperty(o)&&l!=null&&o==="onScroll"&&je("scroll",r)}switch(n){case"input":Nl(r),Cy(r,i,!0);break;case"textarea":Nl(r),Py(r);break;case"select":case"option":break;default:typeof i.onClick=="function"&&(r.onclick=Zc)}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=qb(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[In]=t,e[_a]=r,vS(e,t,!1,!1),t.stateNode=e;e:{switch(o=Lh(n,r),n){case"dialog":je("cancel",e),je("close",e),s=r;break;case"iframe":case"object":case"embed":je("load",e),s=r;break;case"video":case"audio":for(s=0;s<Lo.length;s++)je(Lo[s],e);s=r;break;case"source":je("error",e),s=r;break;case"img":case"image":case"link":je("error",e),je("load",e),s=r;break;case"details":je("toggle",e),s=r;break;case"input":Ey(e,r),s=Ph(e,r),je("invalid",e);break;case"option":s=r;break;case"select":e._wrapperState={wasMultiple:!!r.multiple},s=Oe({},r,{value:void 0}),je("invalid",e);break;case"textarea":Ty(e,r),s=Ih(e,r),je("invalid",e);break;default:s=r}Oh(n,s),l=s;for(i in l)if(l.hasOwnProperty(i)){var c=l[i];i==="style"?Xb(e,c):i==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,c!=null&&Gb(e,c)):i==="children"?typeof c=="string"?(n!=="textarea"||c!=="")&&da(e,c):typeof c=="number"&&da(e,""+c):i!=="suppressContentEditableWarning"&&i!=="suppressHydrationWarning"&&i!=="autoFocus"&&(ua.hasOwnProperty(i)?c!=null&&i==="onScroll"&&je("scroll",e):c!=null&&Dm(e,i,c,o))}switch(n){case"input":Nl(e),Cy(e,r,!1);break;case"textarea":Nl(e),Py(e);break;case"option":r.value!=null&&e.setAttribute("value",""+qr(r.value));break;case"select":e.multiple=!!r.multiple,i=r.value,i!=null?Si(e,!!r.multiple,i,!1):r.defaultValue!=null&&Si(e,!!r.multiple,r.defaultValue,!0);break;default:typeof s.onClick=="function"&&(e.onclick=Zc)}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 nt(t),null;case 6:if(e&&t.stateNode!=null)xS(e,t,e.memoizedProps,r);else{if(typeof r!="string"&&t.stateNode===null)throw Error(X(166));if(n=ys(ba.current),ys(Dn.current),Ol(t)){if(r=t.stateNode,n=t.memoizedProps,r[In]=t,(i=r.nodeValue!==n)&&(e=Tt,e!==null))switch(e.tag){case 3:Ml(r.nodeValue,n,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&Ml(r.nodeValue,n,(e.mode&1)!==0)}i&&(t.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[In]=t,t.stateNode=r}return nt(t),null;case 13:if(ke(Re),r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(Pe&&Et!==null&&t.mode&1&&!(t.flags&128))$j(),Li(),t.flags|=98560,i=!1;else if(i=Ol(t),r!==null&&r.dehydrated!==null){if(e===null){if(!i)throw Error(X(318));if(i=t.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(X(317));i[In]=t}else Li(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;nt(t),i=!1}else dn!==null&&(gp(dn),dn=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||Re.current&1?Ke===0&&(Ke=3):_g())),t.updateQueue!==null&&(t.flags|=4),nt(t),null);case 4:return Di(),lp(e,t),e===null&&ya(t.stateNode.containerInfo),nt(t),null;case 10:return rg(t.type._context),nt(t),null;case 17:return xt(t.type)&&Jc(),nt(t),null;case 19:if(ke(Re),i=t.memoizedState,i===null)return nt(t),null;if(r=(t.flags&128)!==0,o=i.rendering,o===null)if(r)So(i,!1);else{if(Ke!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=ou(e),o!==null){for(t.flags|=128,So(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 we(Re,Re.current&1|2),t.child}e=e.sibling}i.tail!==null&&Be()>Fi&&(t.flags|=128,r=!0,So(i,!1),t.lanes=4194304)}else{if(!r)if(e=ou(o),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),So(i,!0),i.tail===null&&i.tailMode==="hidden"&&!o.alternate&&!Pe)return nt(t),null}else 2*Be()-i.renderingStartTime>Fi&&n!==1073741824&&(t.flags|=128,r=!0,So(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=Be(),t.sibling=null,n=Re.current,we(Re,r?n&1|2:n&1),t):(nt(t),null);case 22:case 23:return xg(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?bt&1073741824&&(nt(t),t.subtreeFlags&6&&(t.flags|=8192)):nt(t),null;case 24:return null;case 25:return null}throw Error(X(156,t.tag))}function vI(e,t){switch(Jm(t),t.tag){case 1:return xt(t.type)&&Jc(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Di(),ke(yt),ke(lt),lg(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return ag(t),null;case 13:if(ke(Re),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(X(340));Li()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return ke(Re),null;case 4:return Di(),null;case 10:return rg(t.type._context),null;case 22:case 23:return xg(),null;case 24:return null;default:return null}}var Dl=!1,ot=!1,yI=typeof WeakSet=="function"?WeakSet:Set,ee=null;function fi(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){De(e,t,r)}else n.current=null}function cp(e,t,n){try{n()}catch(r){De(e,t,r)}}var xx=!1;function xI(e,t){if(Kh=Yc,e=Sj(),Qm(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(qh={focusedElem:e,selectionRange:n},Yc=!1,ee=t;ee!==null;)if(t=ee,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,ee=e;else for(;ee!==null;){t=ee;try{var g=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(g!==null){var x=g.memoizedProps,w=g.memoizedState,v=t.stateNode,y=v.getSnapshotBeforeUpdate(t.elementType===t.type?x:ln(t.type,x),w);v.__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(X(163))}}catch(b){De(t,t.return,b)}if(e=t.sibling,e!==null){e.return=t.return,ee=e;break}ee=t.return}return g=xx,xx=!1,g}function Qo(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&&cp(t,n,i)}s=s.next}while(s!==r)}}function ad(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 up(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 _S(e){var t=e.alternate;t!==null&&(e.alternate=null,_S(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[In],delete t[_a],delete t[Xh],delete t[tI],delete t[nI])),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 wS(e){return e.tag===5||e.tag===3||e.tag===4}function _x(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||wS(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 dp(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=Zc));else if(r!==4&&(e=e.child,e!==null))for(dp(e,t,n),e=e.sibling;e!==null;)dp(e,t,n),e=e.sibling}function fp(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(fp(e,t,n),e=e.sibling;e!==null;)fp(e,t,n),e=e.sibling}var Ye=null,cn=!1;function kr(e,t,n){for(n=n.child;n!==null;)bS(e,t,n),n=n.sibling}function bS(e,t,n){if($n&&typeof $n.onCommitFiberUnmount=="function")try{$n.onCommitFiberUnmount(Ju,n)}catch{}switch(n.tag){case 5:ot||fi(n,t);case 6:var r=Ye,s=cn;Ye=null,kr(e,t,n),Ye=r,cn=s,Ye!==null&&(cn?(e=Ye,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):Ye.removeChild(n.stateNode));break;case 18:Ye!==null&&(cn?(e=Ye,n=n.stateNode,e.nodeType===8?_f(e.parentNode,n):e.nodeType===1&&_f(e,n),ma(e)):_f(Ye,n.stateNode));break;case 4:r=Ye,s=cn,Ye=n.stateNode.containerInfo,cn=!0,kr(e,t,n),Ye=r,cn=s;break;case 0:case 11:case 14:case 15:if(!ot&&(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)&&cp(n,t,o),s=s.next}while(s!==r)}kr(e,t,n);break;case 1:if(!ot&&(fi(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(l){De(n,t,l)}kr(e,t,n);break;case 21:kr(e,t,n);break;case 22:n.mode&1?(ot=(r=ot)||n.memoizedState!==null,kr(e,t,n),ot=r):kr(e,t,n);break;default:kr(e,t,n)}}function wx(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new yI),t.forEach(function(r){var s=CI.bind(null,e,r);n.has(r)||(n.add(r),r.then(s,s))})}}function on(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:Ye=l.stateNode,cn=!1;break e;case 3:Ye=l.stateNode.containerInfo,cn=!0;break e;case 4:Ye=l.stateNode.containerInfo,cn=!0;break e}l=l.return}if(Ye===null)throw Error(X(160));bS(i,o,s),Ye=null,cn=!1;var c=s.alternate;c!==null&&(c.return=null),s.return=null}catch(u){De(s,t,u)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)jS(t,e),t=t.sibling}function jS(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(on(t,e),Cn(e),r&4){try{Qo(3,e,e.return),ad(3,e)}catch(x){De(e,e.return,x)}try{Qo(5,e,e.return)}catch(x){De(e,e.return,x)}}break;case 1:on(t,e),Cn(e),r&512&&n!==null&&fi(n,n.return);break;case 5:if(on(t,e),Cn(e),r&512&&n!==null&&fi(n,n.return),e.flags&32){var s=e.stateNode;try{da(s,"")}catch(x){De(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&&Wb(s,i),Lh(l,o);var u=Lh(l,i);for(o=0;o<c.length;o+=2){var d=c[o],f=c[o+1];d==="style"?Xb(s,f):d==="dangerouslySetInnerHTML"?Gb(s,f):d==="children"?da(s,f):Dm(s,d,f,u)}switch(l){case"input":Ah(s,i);break;case"textarea":Kb(s,i);break;case"select":var h=s._wrapperState.wasMultiple;s._wrapperState.wasMultiple=!!i.multiple;var p=i.value;p!=null?Si(s,!!i.multiple,p,!1):h!==!!i.multiple&&(i.defaultValue!=null?Si(s,!!i.multiple,i.defaultValue,!0):Si(s,!!i.multiple,i.multiple?[]:"",!1))}s[_a]=i}catch(x){De(e,e.return,x)}}break;case 6:if(on(t,e),Cn(e),r&4){if(e.stateNode===null)throw Error(X(162));s=e.stateNode,i=e.memoizedProps;try{s.nodeValue=i}catch(x){De(e,e.return,x)}}break;case 3:if(on(t,e),Cn(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{ma(t.containerInfo)}catch(x){De(e,e.return,x)}break;case 4:on(t,e),Cn(e);break;case 13:on(t,e),Cn(e),s=e.child,s.flags&8192&&(i=s.memoizedState!==null,s.stateNode.isHidden=i,!i||s.alternate!==null&&s.alternate.memoizedState!==null||(vg=Be())),r&4&&wx(e);break;case 22:if(d=n!==null&&n.memoizedState!==null,e.mode&1?(ot=(u=ot)||d,on(t,e),ot=u):on(t,e),Cn(e),r&8192){if(u=e.memoizedState!==null,(e.stateNode.isHidden=u)&&!d&&e.mode&1)for(ee=e,d=e.child;d!==null;){for(f=ee=d;ee!==null;){switch(h=ee,p=h.child,h.tag){case 0:case 11:case 14:case 15:Qo(4,h,h.return);break;case 1:fi(h,h.return);var g=h.stateNode;if(typeof g.componentWillUnmount=="function"){r=h,n=h.return;try{t=r,g.props=t.memoizedProps,g.state=t.memoizedState,g.componentWillUnmount()}catch(x){De(r,n,x)}}break;case 5:fi(h,h.return);break;case 22:if(h.memoizedState!==null){jx(f);continue}}p!==null?(p.return=h,ee=p):jx(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=Yb("display",o))}catch(x){De(e,e.return,x)}}}else if(f.tag===6){if(d===null)try{f.stateNode.nodeValue=u?"":f.memoizedProps}catch(x){De(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:on(t,e),Cn(e),r&4&&wx(e);break;case 21:break;default:on(t,e),Cn(e)}}function Cn(e){var t=e.flags;if(t&2){try{e:{for(var n=e.return;n!==null;){if(wS(n)){var r=n;break e}n=n.return}throw Error(X(160))}switch(r.tag){case 5:var s=r.stateNode;r.flags&32&&(da(s,""),r.flags&=-33);var i=_x(e);fp(e,i,s);break;case 3:case 4:var o=r.stateNode.containerInfo,l=_x(e);dp(e,l,o);break;default:throw Error(X(161))}}catch(c){De(e,e.return,c)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function _I(e,t,n){ee=e,SS(e)}function SS(e,t,n){for(var r=(e.mode&1)!==0;ee!==null;){var s=ee,i=s.child;if(s.tag===22&&r){var o=s.memoizedState!==null||Dl;if(!o){var l=s.alternate,c=l!==null&&l.memoizedState!==null||ot;l=Dl;var u=ot;if(Dl=o,(ot=c)&&!u)for(ee=s;ee!==null;)o=ee,c=o.child,o.tag===22&&o.memoizedState!==null?Sx(s):c!==null?(c.return=o,ee=c):Sx(s);for(;i!==null;)ee=i,SS(i),i=i.sibling;ee=s,Dl=l,ot=u}bx(e)}else s.subtreeFlags&8772&&i!==null?(i.return=s,ee=i):bx(e)}}function bx(e){for(;ee!==null;){var t=ee;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:ot||ad(5,t);break;case 1:var r=t.stateNode;if(t.flags&4&&!ot)if(n===null)r.componentDidMount();else{var s=t.elementType===t.type?n.memoizedProps:ln(t.type,n.memoizedProps);r.componentDidUpdate(s,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var i=t.updateQueue;i!==null&&ox(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}ox(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&&ma(f)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(X(163))}ot||t.flags&512&&up(t)}catch(h){De(t,t.return,h)}}if(t===e){ee=null;break}if(n=t.sibling,n!==null){n.return=t.return,ee=n;break}ee=t.return}}function jx(e){for(;ee!==null;){var t=ee;if(t===e){ee=null;break}var n=t.sibling;if(n!==null){n.return=t.return,ee=n;break}ee=t.return}}function Sx(e){for(;ee!==null;){var t=ee;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{ad(4,t)}catch(c){De(t,n,c)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount=="function"){var s=t.return;try{r.componentDidMount()}catch(c){De(t,s,c)}}var i=t.return;try{up(t)}catch(c){De(t,i,c)}break;case 5:var o=t.return;try{up(t)}catch(c){De(t,o,c)}}}catch(c){De(t,t.return,c)}if(t===e){ee=null;break}var l=t.sibling;if(l!==null){l.return=t.return,ee=l;break}ee=t.return}}var wI=Math.ceil,cu=jr.ReactCurrentDispatcher,mg=jr.ReactCurrentOwner,Zt=jr.ReactCurrentBatchConfig,he=0,Ge=null,Ue=null,Je=0,bt=0,hi=Jr(0),Ke=0,Na=null,Ps=0,ld=0,gg=0,Zo=null,mt=null,vg=0,Fi=1/0,Qn=null,uu=!1,hp=null,Ur=null,zl=!1,Lr=null,du=0,Jo=0,pp=null,bc=-1,jc=0;function ft(){return he&6?Be():bc!==-1?bc:bc=Be()}function Hr(e){return e.mode&1?he&2&&Je!==0?Je&-Je:sI.transition!==null?(jc===0&&(jc=lj()),jc):(e=_e,e!==0||(e=window.event,e=e===void 0?16:mj(e.type)),e):1}function vn(e,t,n,r){if(50<Jo)throw Jo=0,pp=null,Error(X(185));Ja(e,n,r),(!(he&2)||e!==Ge)&&(e===Ge&&(!(he&2)&&(ld|=n),Ke===4&&Ir(e,Je)),_t(e,r),n===1&&he===0&&!(t.mode&1)&&(Fi=Be()+500,sd&&es()))}function _t(e,t){var n=e.callbackNode;sR(e,t);var r=Gc(e,e===Ge?Je:0);if(r===0)n!==null&&Iy(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&Iy(n),t===1)e.tag===0?rI(kx.bind(null,e)):Mj(kx.bind(null,e)),JR(function(){!(he&6)&&es()}),n=null;else{switch(cj(r)){case 1:n=Um;break;case 4:n=oj;break;case 16:n=qc;break;case 536870912:n=aj;break;default:n=qc}n=RS(n,kS.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function kS(e,t){if(bc=-1,jc=0,he&6)throw Error(X(327));var n=e.callbackNode;if(Ti()&&e.callbackNode!==n)return null;var r=Gc(e,e===Ge?Je:0);if(r===0)return null;if(r&30||r&e.expiredLanes||t)t=fu(e,r);else{t=r;var s=he;he|=2;var i=ES();(Ge!==e||Je!==t)&&(Qn=null,Fi=Be()+500,ws(e,t));do try{SI();break}catch(l){NS(e,l)}while(!0);ng(),cu.current=i,he=s,Ue!==null?t=0:(Ge=null,Je=0,t=Ke)}if(t!==0){if(t===2&&(s=Vh(e),s!==0&&(r=s,t=mp(e,s))),t===1)throw n=Na,ws(e,0),Ir(e,r),_t(e,Be()),n;if(t===6)Ir(e,r);else{if(s=e.current.alternate,!(r&30)&&!bI(s)&&(t=fu(e,r),t===2&&(i=Vh(e),i!==0&&(r=i,t=mp(e,i))),t===1))throw n=Na,ws(e,0),Ir(e,r),_t(e,Be()),n;switch(e.finishedWork=s,e.finishedLanes=r,t){case 0:case 1:throw Error(X(345));case 2:cs(e,mt,Qn);break;case 3:if(Ir(e,r),(r&130023424)===r&&(t=vg+500-Be(),10<t)){if(Gc(e,0)!==0)break;if(s=e.suspendedLanes,(s&r)!==r){ft(),e.pingedLanes|=e.suspendedLanes&s;break}e.timeoutHandle=Yh(cs.bind(null,e,mt,Qn),t);break}cs(e,mt,Qn);break;case 4:if(Ir(e,r),(r&4194240)===r)break;for(t=e.eventTimes,s=-1;0<r;){var o=31-gn(r);i=1<<o,o=t[o],o>s&&(s=o),r&=~i}if(r=s,r=Be()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*wI(r/1960))-r,10<r){e.timeoutHandle=Yh(cs.bind(null,e,mt,Qn),r);break}cs(e,mt,Qn);break;case 5:cs(e,mt,Qn);break;default:throw Error(X(329))}}}return _t(e,Be()),e.callbackNode===n?kS.bind(null,e):null}function mp(e,t){var n=Zo;return e.current.memoizedState.isDehydrated&&(ws(e,t).flags|=256),e=fu(e,t),e!==2&&(t=mt,mt=n,t!==null&&gp(t)),e}function gp(e){mt===null?mt=e:mt.push.apply(mt,e)}function bI(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(!wn(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 Ir(e,t){for(t&=~gg,t&=~ld,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-gn(t),r=1<<n;e[n]=-1,t&=~r}}function kx(e){if(he&6)throw Error(X(327));Ti();var t=Gc(e,0);if(!(t&1))return _t(e,Be()),null;var n=fu(e,t);if(e.tag!==0&&n===2){var r=Vh(e);r!==0&&(t=r,n=mp(e,r))}if(n===1)throw n=Na,ws(e,0),Ir(e,t),_t(e,Be()),n;if(n===6)throw Error(X(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,cs(e,mt,Qn),_t(e,Be()),null}function yg(e,t){var n=he;he|=1;try{return e(t)}finally{he=n,he===0&&(Fi=Be()+500,sd&&es())}}function As(e){Lr!==null&&Lr.tag===0&&!(he&6)&&Ti();var t=he;he|=1;var n=Zt.transition,r=_e;try{if(Zt.transition=null,_e=1,e)return e()}finally{_e=r,Zt.transition=n,he=t,!(he&6)&&es()}}function xg(){bt=hi.current,ke(hi)}function ws(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,ZR(n)),Ue!==null)for(n=Ue.return;n!==null;){var r=n;switch(Jm(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&Jc();break;case 3:Di(),ke(yt),ke(lt),lg();break;case 5:ag(r);break;case 4:Di();break;case 13:ke(Re);break;case 19:ke(Re);break;case 10:rg(r.type._context);break;case 22:case 23:xg()}n=n.return}if(Ge=e,Ue=e=Wr(e.current,null),Je=bt=t,Ke=0,Na=null,gg=ld=Ps=0,mt=Zo=null,vs!==null){for(t=0;t<vs.length;t++)if(n=vs[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}vs=null}return e}function NS(e,t){do{var n=Ue;try{if(ng(),xc.current=lu,au){for(var r=Me.memoizedState;r!==null;){var s=r.queue;s!==null&&(s.pending=null),r=r.next}au=!1}if(Ts=0,qe=We=Me=null,Xo=!1,ja=0,mg.current=null,n===null||n.return===null){Ke=1,Na=t,Ue=null;break}e:{var i=e,o=n.return,l=n,c=t;if(t=Je,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=fx(o);if(p!==null){p.flags&=-257,hx(p,o,l,i,t),p.mode&1&&dx(i,u,t),t=p,c=u;var g=t.updateQueue;if(g===null){var x=new Set;x.add(c),t.updateQueue=x}else g.add(c);break e}else{if(!(t&1)){dx(i,u,t),_g();break e}c=Error(X(426))}}else if(Pe&&l.mode&1){var w=fx(o);if(w!==null){!(w.flags&65536)&&(w.flags|=256),hx(w,o,l,i,t),eg(zi(c,l));break e}}i=c=zi(c,l),Ke!==4&&(Ke=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 v=cS(i,c,t);ix(i,v);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"&&(Ur===null||!Ur.has(m)))){i.flags|=65536,t&=-t,i.lanes|=t;var b=uS(i,l,t);ix(i,b);break e}}i=i.return}while(i!==null)}TS(n)}catch(j){t=j,Ue===n&&n!==null&&(Ue=n=n.return);continue}break}while(!0)}function ES(){var e=cu.current;return cu.current=lu,e===null?lu:e}function _g(){(Ke===0||Ke===3||Ke===2)&&(Ke=4),Ge===null||!(Ps&268435455)&&!(ld&268435455)||Ir(Ge,Je)}function fu(e,t){var n=he;he|=2;var r=ES();(Ge!==e||Je!==t)&&(Qn=null,ws(e,t));do try{jI();break}catch(s){NS(e,s)}while(!0);if(ng(),he=n,cu.current=r,Ue!==null)throw Error(X(261));return Ge=null,Je=0,Ke}function jI(){for(;Ue!==null;)CS(Ue)}function SI(){for(;Ue!==null&&!YA();)CS(Ue)}function CS(e){var t=AS(e.alternate,e,bt);e.memoizedProps=e.pendingProps,t===null?TS(e):Ue=t,mg.current=null}function TS(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=vI(n,t),n!==null){n.flags&=32767,Ue=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{Ke=6,Ue=null;return}}else if(n=gI(n,t,bt),n!==null){Ue=n;return}if(t=t.sibling,t!==null){Ue=t;return}Ue=t=e}while(t!==null);Ke===0&&(Ke=5)}function cs(e,t,n){var r=_e,s=Zt.transition;try{Zt.transition=null,_e=1,kI(e,t,n,r)}finally{Zt.transition=s,_e=r}return null}function kI(e,t,n,r){do Ti();while(Lr!==null);if(he&6)throw Error(X(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(X(177));e.callbackNode=null,e.callbackPriority=0;var i=n.lanes|n.childLanes;if(iR(e,i),e===Ge&&(Ue=Ge=null,Je=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||zl||(zl=!0,RS(qc,function(){return Ti(),null})),i=(n.flags&15990)!==0,n.subtreeFlags&15990||i){i=Zt.transition,Zt.transition=null;var o=_e;_e=1;var l=he;he|=4,mg.current=null,xI(e,n),jS(n,e),WR(qh),Yc=!!Kh,qh=Kh=null,e.current=n,_I(n),XA(),he=l,_e=o,Zt.transition=i}else e.current=n;if(zl&&(zl=!1,Lr=e,du=s),i=e.pendingLanes,i===0&&(Ur=null),JA(n.stateNode),_t(e,Be()),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(uu)throw uu=!1,e=hp,hp=null,e;return du&1&&e.tag!==0&&Ti(),i=e.pendingLanes,i&1?e===pp?Jo++:(Jo=0,pp=e):Jo=0,es(),null}function Ti(){if(Lr!==null){var e=cj(du),t=Zt.transition,n=_e;try{if(Zt.transition=null,_e=16>e?16:e,Lr===null)var r=!1;else{if(e=Lr,Lr=null,du=0,he&6)throw Error(X(331));var s=he;for(he|=4,ee=e.current;ee!==null;){var i=ee,o=i.child;if(ee.flags&16){var l=i.deletions;if(l!==null){for(var c=0;c<l.length;c++){var u=l[c];for(ee=u;ee!==null;){var d=ee;switch(d.tag){case 0:case 11:case 15:Qo(8,d,i)}var f=d.child;if(f!==null)f.return=d,ee=f;else for(;ee!==null;){d=ee;var h=d.sibling,p=d.return;if(_S(d),d===u){ee=null;break}if(h!==null){h.return=p,ee=h;break}ee=p}}}var g=i.alternate;if(g!==null){var x=g.child;if(x!==null){g.child=null;do{var w=x.sibling;x.sibling=null,x=w}while(x!==null)}}ee=i}}if(i.subtreeFlags&2064&&o!==null)o.return=i,ee=o;else e:for(;ee!==null;){if(i=ee,i.flags&2048)switch(i.tag){case 0:case 11:case 15:Qo(9,i,i.return)}var v=i.sibling;if(v!==null){v.return=i.return,ee=v;break e}ee=i.return}}var y=e.current;for(ee=y;ee!==null;){o=ee;var m=o.child;if(o.subtreeFlags&2064&&m!==null)m.return=o,ee=m;else e:for(o=y;ee!==null;){if(l=ee,l.flags&2048)try{switch(l.tag){case 0:case 11:case 15:ad(9,l)}}catch(j){De(l,l.return,j)}if(l===o){ee=null;break e}var b=l.sibling;if(b!==null){b.return=l.return,ee=b;break e}ee=l.return}}if(he=s,es(),$n&&typeof $n.onPostCommitFiberRoot=="function")try{$n.onPostCommitFiberRoot(Ju,e)}catch{}r=!0}return r}finally{_e=n,Zt.transition=t}}return!1}function Nx(e,t,n){t=zi(n,t),t=cS(e,t,1),e=Br(e,t,1),t=ft(),e!==null&&(Ja(e,1,t),_t(e,t))}function De(e,t,n){if(e.tag===3)Nx(e,e,n);else for(;t!==null;){if(t.tag===3){Nx(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(Ur===null||!Ur.has(r))){e=zi(n,e),e=uS(t,e,1),t=Br(t,e,1),e=ft(),t!==null&&(Ja(t,1,e),_t(t,e));break}}t=t.return}}function NI(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),t=ft(),e.pingedLanes|=e.suspendedLanes&n,Ge===e&&(Je&n)===n&&(Ke===4||Ke===3&&(Je&130023424)===Je&&500>Be()-vg?ws(e,0):gg|=n),_t(e,t)}function PS(e,t){t===0&&(e.mode&1?(t=Tl,Tl<<=1,!(Tl&130023424)&&(Tl=4194304)):t=1);var n=ft();e=gr(e,t),e!==null&&(Ja(e,t,n),_t(e,n))}function EI(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),PS(e,n)}function CI(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(X(314))}r!==null&&r.delete(t),PS(e,n)}var AS;AS=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||yt.current)gt=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return gt=!1,mI(e,t,n);gt=!!(e.flags&131072)}else gt=!1,Pe&&t.flags&1048576&&Oj(t,nu,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;wc(e,t),e=t.pendingProps;var s=Oi(t,lt.current);Ci(t,n),s=ug(null,t,r,e,s,n);var i=dg();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,xt(r)?(i=!0,eu(t)):i=!1,t.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,ig(t),s.updater=od,t.stateNode=s,s._reactInternals=t,np(t,r,e,n),t=ip(null,t,r,!0,i,n)):(t.tag=0,Pe&&i&&Zm(t),ut(null,t,s,n),t=t.child),t;case 16:r=t.elementType;e:{switch(wc(e,t),e=t.pendingProps,s=r._init,r=s(r._payload),t.type=r,s=t.tag=PI(r),e=ln(r,e),s){case 0:t=sp(null,t,r,e,n);break e;case 1:t=gx(null,t,r,e,n);break e;case 11:t=px(null,t,r,e,n);break e;case 14:t=mx(null,t,r,ln(r.type,e),n);break e}throw Error(X(306,r,""))}return t;case 0:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:ln(r,s),sp(e,t,r,s,n);case 1:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:ln(r,s),gx(e,t,r,s,n);case 3:e:{if(pS(t),e===null)throw Error(X(387));r=t.pendingProps,i=t.memoizedState,s=i.element,Vj(e,t),iu(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=zi(Error(X(423)),t),t=vx(e,t,r,n,s);break e}else if(r!==s){s=zi(Error(X(424)),t),t=vx(e,t,r,n,s);break e}else for(Et=Vr(t.stateNode.containerInfo.firstChild),Tt=t,Pe=!0,dn=null,n=zj(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Li(),r===s){t=vr(e,t,n);break e}ut(e,t,r,n)}t=t.child}return t;case 5:return Bj(t),e===null&&Jh(t),r=t.type,s=t.pendingProps,i=e!==null?e.memoizedProps:null,o=s.children,Gh(r,s)?o=null:i!==null&&Gh(r,i)&&(t.flags|=32),hS(e,t),ut(e,t,o,n),t.child;case 6:return e===null&&Jh(t),null;case 13:return mS(e,t,n);case 4:return og(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=$i(t,null,r,n):ut(e,t,r,n),t.child;case 11:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:ln(r,s),px(e,t,r,s,n);case 7:return ut(e,t,t.pendingProps,n),t.child;case 8:return ut(e,t,t.pendingProps.children,n),t.child;case 12:return ut(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,we(ru,r._currentValue),r._currentValue=o,i!==null)if(wn(i.value,o)){if(i.children===s.children&&!yt.current){t=vr(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=ar(-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),ep(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(X(341));o.lanes|=n,l=o.alternate,l!==null&&(l.lanes|=n),ep(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}ut(e,t,s.children,n),t=t.child}return t;case 9:return s=t.type,r=t.pendingProps.children,Ci(t,n),s=en(s),r=r(s),t.flags|=1,ut(e,t,r,n),t.child;case 14:return r=t.type,s=ln(r,t.pendingProps),s=ln(r.type,s),mx(e,t,r,s,n);case 15:return dS(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:ln(r,s),wc(e,t),t.tag=1,xt(r)?(e=!0,eu(t)):e=!1,Ci(t,n),lS(t,r,s),np(t,r,s,n),ip(null,t,r,!0,e,n);case 19:return gS(e,t,n);case 22:return fS(e,t,n)}throw Error(X(156,t.tag))};function RS(e,t){return ij(e,t)}function TI(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 Yt(e,t,n,r){return new TI(e,t,n,r)}function wg(e){return e=e.prototype,!(!e||!e.isReactComponent)}function PI(e){if(typeof e=="function")return wg(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Fm)return 11;if(e===Vm)return 14}return 2}function Wr(e,t){var n=e.alternate;return n===null?(n=Yt(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 Sc(e,t,n,r,s,i){var o=2;if(r=e,typeof e=="function")wg(e)&&(o=1);else if(typeof e=="string")o=5;else e:switch(e){case ri:return bs(n.children,s,i,t);case zm:o=8,s|=8;break;case Nh:return e=Yt(12,n,t,s|2),e.elementType=Nh,e.lanes=i,e;case Eh:return e=Yt(13,n,t,s),e.elementType=Eh,e.lanes=i,e;case Ch:return e=Yt(19,n,t,s),e.elementType=Ch,e.lanes=i,e;case Bb:return cd(n,s,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Fb:o=10;break e;case Vb:o=9;break e;case Fm:o=11;break e;case Vm:o=14;break e;case Pr:o=16,r=null;break e}throw Error(X(130,e==null?e:typeof e,""))}return t=Yt(o,n,t,s),t.elementType=e,t.type=r,t.lanes=i,t}function bs(e,t,n,r){return e=Yt(7,e,r,t),e.lanes=n,e}function cd(e,t,n,r){return e=Yt(22,e,r,t),e.elementType=Bb,e.lanes=n,e.stateNode={isHidden:!1},e}function Cf(e,t,n){return e=Yt(6,e,null,t),e.lanes=n,e}function Tf(e,t,n){return t=Yt(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function AI(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=cf(0),this.expirationTimes=cf(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=cf(0),this.identifierPrefix=r,this.onRecoverableError=s,this.mutableSourceEagerHydrationData=null}function bg(e,t,n,r,s,i,o,l,c){return e=new AI(e,t,n,l,c),t===1?(t=1,i===!0&&(t|=8)):t=0,i=Yt(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},ig(i),e}function RI(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:ni,key:r==null?null:""+r,children:e,containerInfo:t,implementation:n}}function IS(e){if(!e)return Gr;e=e._reactInternals;e:{if(Us(e)!==e||e.tag!==1)throw Error(X(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(xt(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(X(171))}if(e.tag===1){var n=e.type;if(xt(n))return Ij(e,n,t)}return t}function MS(e,t,n,r,s,i,o,l,c){return e=bg(n,r,!0,e,s,i,o,l,c),e.context=IS(null),n=e.current,r=ft(),s=Hr(n),i=ar(r,s),i.callback=t??null,Br(n,i,s),e.current.lanes=s,Ja(e,s,r),_t(e,r),e}function ud(e,t,n,r){var s=t.current,i=ft(),o=Hr(s);return n=IS(n),t.context===null?t.context=n:t.pendingContext=n,t=ar(i,o),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=Br(s,t,o),e!==null&&(vn(e,s,o,i),yc(e,s,o)),o}function hu(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 Ex(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function jg(e,t){Ex(e,t),(e=e.alternate)&&Ex(e,t)}function II(){return null}var OS=typeof reportError=="function"?reportError:function(e){console.error(e)};function Sg(e){this._internalRoot=e}dd.prototype.render=Sg.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(X(409));ud(e,t,null,null)};dd.prototype.unmount=Sg.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;As(function(){ud(null,e,null,null)}),t[mr]=null}};function dd(e){this._internalRoot=e}dd.prototype.unstable_scheduleHydration=function(e){if(e){var t=fj();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Rr.length&&t!==0&&t<Rr[n].priority;n++);Rr.splice(n,0,e),n===0&&pj(e)}};function kg(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function fd(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function Cx(){}function MI(e,t,n,r,s){if(s){if(typeof r=="function"){var i=r;r=function(){var u=hu(o);i.call(u)}}var o=MS(t,r,e,0,null,!1,!1,"",Cx);return e._reactRootContainer=o,e[mr]=o.current,ya(e.nodeType===8?e.parentNode:e),As(),o}for(;s=e.lastChild;)e.removeChild(s);if(typeof r=="function"){var l=r;r=function(){var u=hu(c);l.call(u)}}var c=bg(e,0,!1,null,null,!1,!1,"",Cx);return e._reactRootContainer=c,e[mr]=c.current,ya(e.nodeType===8?e.parentNode:e),As(function(){ud(t,c,n,r)}),c}function hd(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=hu(o);l.call(c)}}ud(t,o,e,s)}else o=MI(n,t,e,s,r);return hu(o)}uj=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=Oo(t.pendingLanes);n!==0&&(Hm(t,n|1),_t(t,Be()),!(he&6)&&(Fi=Be()+500,es()))}break;case 13:As(function(){var r=gr(e,1);if(r!==null){var s=ft();vn(r,e,1,s)}}),jg(e,1)}};Wm=function(e){if(e.tag===13){var t=gr(e,134217728);if(t!==null){var n=ft();vn(t,e,134217728,n)}jg(e,134217728)}};dj=function(e){if(e.tag===13){var t=Hr(e),n=gr(e,t);if(n!==null){var r=ft();vn(n,e,t,r)}jg(e,t)}};fj=function(){return _e};hj=function(e,t){var n=_e;try{return _e=e,t()}finally{_e=n}};Dh=function(e,t,n){switch(t){case"input":if(Ah(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=rd(r);if(!s)throw Error(X(90));Hb(r),Ah(r,s)}}}break;case"textarea":Kb(e,n);break;case"select":t=n.value,t!=null&&Si(e,!!n.multiple,t,!1)}};Jb=yg;ej=As;var OI={usingClientEntryPoint:!1,Events:[tl,ai,rd,Qb,Zb,yg]},ko={findFiberByHostInstance:gs,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},LI={bundleType:ko.bundleType,version:ko.version,rendererPackageName:ko.rendererPackageName,rendererConfig:ko.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:jr.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=rj(e),e===null?null:e.stateNode},findFiberByHostInstance:ko.findFiberByHostInstance||II,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 Fl=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Fl.isDisabled&&Fl.supportsFiber)try{Ju=Fl.inject(LI),$n=Fl}catch{}}Ot.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=OI;Ot.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!kg(t))throw Error(X(200));return RI(e,t,null,n)};Ot.createRoot=function(e,t){if(!kg(e))throw Error(X(299));var n=!1,r="",s=OS;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onRecoverableError!==void 0&&(s=t.onRecoverableError)),t=bg(e,1,!1,null,null,n,!1,r,s),e[mr]=t.current,ya(e.nodeType===8?e.parentNode:e),new Sg(t)};Ot.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(X(188)):(e=Object.keys(e).join(","),Error(X(268,e)));return e=rj(t),e=e===null?null:e.stateNode,e};Ot.flushSync=function(e){return As(e)};Ot.hydrate=function(e,t,n){if(!fd(t))throw Error(X(200));return hd(null,e,t,!0,n)};Ot.hydrateRoot=function(e,t,n){if(!kg(e))throw Error(X(405));var r=n!=null&&n.hydratedSources||null,s=!1,i="",o=OS;if(n!=null&&(n.unstable_strictMode===!0&&(s=!0),n.identifierPrefix!==void 0&&(i=n.identifierPrefix),n.onRecoverableError!==void 0&&(o=n.onRecoverableError)),t=MS(t,null,e,1,n??null,s,!1,i,o),e[mr]=t.current,ya(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 dd(t)};Ot.render=function(e,t,n){if(!fd(t))throw Error(X(200));return hd(null,e,t,!1,n)};Ot.unmountComponentAtNode=function(e){if(!fd(e))throw Error(X(40));return e._reactRootContainer?(As(function(){hd(null,null,e,!1,function(){e._reactRootContainer=null,e[mr]=null})}),!0):!1};Ot.unstable_batchedUpdates=yg;Ot.unstable_renderSubtreeIntoContainer=function(e,t,n,r){if(!fd(n))throw Error(X(200));if(e==null||e._reactInternals===void 0)throw Error(X(38));return hd(e,t,n,!1,r)};Ot.version="18.3.1-next-f1338f8080-20240426";function LS(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(LS)}catch(e){console.error(e)}}LS(),Lb.exports=Ot;var $S=Lb.exports,DS,Tx=$S;DS=Tx.createRoot,Tx.hydrateRoot;/**
|
|
41
|
-
* react-router v7.18.2
|
|
42
|
-
*
|
|
43
|
-
* Copyright (c) Remix Software Inc.
|
|
44
|
-
*
|
|
45
|
-
* This source code is licensed under the MIT license found in the
|
|
46
|
-
* LICENSE.md file in the root directory of this source tree.
|
|
47
|
-
*
|
|
48
|
-
* @license MIT
|
|
49
|
-
*/var Ng=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,zS=/^[\\/]{2}/;function $I(e,t){return t+e.replace(/\\/g,"/")}var Px="popstate";function Ax(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function DI(e={}){function t(r,s){var u;let i=(u=s.state)==null?void 0:u.masked,{pathname:o,search:l,hash:c}=i||r.location;return vp("",{pathname:o,search:l,hash:c},s.state&&s.state.usr||null,s.state&&s.state.key||"default",i?{pathname:r.location.pathname,search:r.location.search,hash:r.location.hash}:void 0)}function n(r,s){return typeof s=="string"?s:Ea(s)}return FI(t,n,null,e)}function Ne(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function nn(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function zI(){return Math.random().toString(36).substring(2,10)}function Rx(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function vp(e,t,n=null,r,s){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?oo(t):t,state:n,key:t&&t.key||r||zI(),mask:s}}function Ea({pathname:e="/",search:t="",hash:n=""}){return t&&t!=="?"&&(e+=t.charAt(0)==="?"?t:"?"+t),n&&n!=="#"&&(e+=n.charAt(0)==="#"?n:"#"+n),e}function oo(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function FI(e,t,n,r={}){let{window:s=document.defaultView,v5Compat:i=!1}=r,o=s.history,l="POP",c=null,u=d();u==null&&(u=0,o.replaceState({...o.state,idx:u},""));function d(){return(o.state||{idx:null}).idx}function f(){l="POP";let w=d(),v=w==null?null:w-u;u=w,c&&c({action:l,location:x.location,delta:v})}function h(w,v){l="PUSH";let y=Ax(w)?w:vp(x.location,w,v);u=d()+1;let m=Rx(y,u),b=x.createHref(y.mask||y);try{o.pushState(m,"",b)}catch(j){if(j instanceof DOMException&&j.name==="DataCloneError")throw j;s.location.assign(b)}i&&c&&c({action:l,location:x.location,delta:1})}function p(w,v){l="REPLACE";let y=Ax(w)?w:vp(x.location,w,v);u=d();let m=Rx(y,u),b=x.createHref(y.mask||y);o.replaceState(m,"",b),i&&c&&c({action:l,location:x.location,delta:0})}function g(w){return VI(s,w)}let x={get action(){return l},get location(){return e(s,o)},listen(w){if(c)throw new Error("A history only accepts one active listener");return s.addEventListener(Px,f),c=w,()=>{s.removeEventListener(Px,f),c=null}},createHref(w){return t(s,w)},createURL:g,encodeLocation(w){let v=g(w);return{pathname:v.pathname,search:v.search,hash:v.hash}},push:h,replace:p,go(w){return o.go(w)}};return x}function VI(e,t,n=!1){let r="http://localhost";e&&(r=e.location.origin!=="null"?e.location.origin:e.location.href),Ne(r,"No window.location.(origin|href) available to create URL");let s=typeof t=="string"?t:Ea(t);return s=s.replace(/ $/,"%20"),!n&&zS.test(s)&&(s=r+s),new URL(s,r)}function FS(e,t,n="/"){return BI(e,t,n,!1)}function BI(e,t,n,r,s){let i=typeof t=="string"?oo(t):t,o=yr(i.pathname||"/",n);if(o==null)return null;let l=UI(e),c=null,u=WS(o);for(let d=0;c==null&&d<l.length;++d)c=JI(l[d],u,r);return c}function UI(e){let t=VS(e);return HI(t),t}function VS(e,t=[],n=[],r="",s=!1){let i=(o,l,c=s,u)=>{let d={relativePath:u===void 0?o.path||"":u,caseSensitive:o.caseSensitive===!0,childrenIndex:l,route:o};if(d.relativePath.startsWith("/")){if(!d.relativePath.startsWith(r)&&c)return;Ne(d.relativePath.startsWith(r),`Absolute route path "${d.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),d.relativePath=d.relativePath.slice(r.length)}let f=yn([r,d.relativePath]),h=n.concat(d);o.children&&o.children.length>0&&(Ne(o.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${f}".`),VS(o.children,t,h,f,c)),!(o.path==null&&!o.index)&&t.push({path:f,score:QI(f,o.index),routesMeta:h.map((p,g)=>{let[x,w]=HS(p.relativePath,p.caseSensitive,g===h.length-1);return{...p,matcher:x,compiledParams:w}})})};return e.forEach((o,l)=>{var c;if(o.path===""||!((c=o.path)!=null&&c.includes("?")))i(o,l);else for(let u of BS(o.path))i(o,l,!0,u)}),t}function BS(e){let t=e.split("/");if(t.length===0)return[];let[n,...r]=t,s=n.endsWith("?"),i=n.replace(/\?$/,"");if(r.length===0)return s?[i,""]:[i];let o=BS(r.join("/")),l=[];return l.push(...o.map(c=>c===""?i:[i,c].join("/"))),s&&l.push(...o),l.map(c=>e.startsWith("/")&&c===""?"/":c)}function HI(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:ZI(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}var WI=/^:[\w-]+$/,KI=3,qI=2,GI=1,YI=10,XI=-2,Ix=e=>e==="*";function QI(e,t){let n=e.split("/"),r=n.length;return n.some(Ix)&&(r+=XI),t&&(r+=qI),n.filter(s=>!Ix(s)).reduce((s,i)=>s+(WI.test(i)?KI:i===""?GI:YI),r)}function ZI(e,t){return e.length===t.length&&e.slice(0,-1).every((r,s)=>r===t[s])?e[e.length-1]-t[t.length-1]:0}function JI(e,t,n=!1){let{routesMeta:r}=e,s={},i="/",o=[];for(let l=0;l<r.length;++l){let c=r[l],u=l===r.length-1,d=i==="/"?t:t.slice(i.length)||"/",f={path:c.relativePath,caseSensitive:c.caseSensitive,end:u},h=c.matcher&&c.compiledParams?US(f,d,c.matcher,c.compiledParams):Ca(f,d),p=c.route;if(!h&&u&&n&&!r[r.length-1].route.index&&(h=Ca({path:c.relativePath,caseSensitive:c.caseSensitive,end:!1},d)),!h)return null;Object.assign(s,h.params),o.push({params:s,pathname:yn([i,h.pathname]),pathnameBase:n2(yn([i,h.pathnameBase])),route:p}),h.pathnameBase!=="/"&&(i=yn([i,h.pathnameBase]))}return o}function Ca(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=HS(e.path,e.caseSensitive,e.end);return US(e,t,n,r)}function US(e,t,n,r){let s=t.match(n);if(!s)return null;let i=s[0],o=i.replace(/(.)\/+$/,"$1"),l=s.slice(1);return{params:r.reduce((u,{paramName:d,isOptional:f},h)=>{if(d==="*"){let g=l[h]||"";o=i.slice(0,i.length-g.length).replace(/(.)\/+$/,"$1")}const p=l[h];return f&&!p?u[d]=void 0:u[d]=(p||"").replace(/%2F/g,"/"),u},{}),pathname:i,pathnameBase:o,pattern:e}}function HS(e,t=!1,n=!0){nn(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let r=[],s="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,l,c,u,d)=>{if(r.push({paramName:l,isOptional:c!=null}),c){let f=d.charAt(u+o.length);return f&&f!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(r.push({paramName:"*"}),s+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?s+="\\/*$":e!==""&&e!=="/"&&(s+="(?:(?=\\/|$))"),[new RegExp(s,t?void 0:"i"),r]}function WS(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return nn(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function yr(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&r!=="/"?null:e.slice(n)||"/"}function e2(e,t="/"){let{pathname:n,search:r="",hash:s=""}=typeof e=="string"?oo(e):e,i;return n?(n=KS(n),n.startsWith("/")?i=Mx(n.substring(1),"/"):i=Mx(n,t)):i=t,{pathname:i,search:r2(r),hash:s2(s)}}function Mx(e,t){let n=pu(t).split("/");return e.split("/").forEach(s=>{s===".."?n.length>1&&n.pop():s!=="."&&n.push(s)}),n.length>1?n.join("/"):"/"}function Pf(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function t2(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function Eg(e){let t=t2(e);return t.map((n,r)=>r===t.length-1?n.pathname:n.pathnameBase)}function pd(e,t,n,r=!1){let s;typeof e=="string"?s=oo(e):(s={...e},Ne(!s.pathname||!s.pathname.includes("?"),Pf("?","pathname","search",s)),Ne(!s.pathname||!s.pathname.includes("#"),Pf("#","pathname","hash",s)),Ne(!s.search||!s.search.includes("#"),Pf("#","search","hash",s)));let i=e===""||s.pathname==="",o=i?"/":s.pathname,l;if(o==null)l=n;else{let f=t.length-1;if(!r&&o.startsWith("..")){let h=o.split("/");for(;h[0]==="..";)h.shift(),f-=1;s.pathname=h.join("/")}l=f>=0?t[f]:"/"}let c=e2(s,l),u=o&&o!=="/"&&o.endsWith("/"),d=(i||o===".")&&n.endsWith("/");return!c.pathname.endsWith("/")&&(u||d)&&(c.pathname+="/"),c}var KS=e=>e.replace(/[\\/]{2,}/g,"/"),yn=e=>KS(e.join("/")),pu=e=>e.replace(/\/+$/,""),n2=e=>pu(e).replace(/^\/*/,"/"),r2=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,s2=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,i2=class{constructor(e,t,n,r=!1){this.status=e,this.statusText=t||"",this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function o2(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function a2(e){let t=e.map(n=>n.route.path).filter(Boolean);return yn(t)||"/"}var qS=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function GS(e,t){let n=e;if(typeof n!="string"||!Ng.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,s=!1;if(qS)try{let i=new URL(window.location.href),o=zS.test(n)?new URL($I(n,i.protocol)):new URL(n),l=yr(o.pathname,t);o.origin===i.origin&&l!=null?n=l+o.search+o.hash:s=!0}catch{nn(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:s,to:n}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var YS=["POST","PUT","PATCH","DELETE"];new Set(YS);var l2=["GET",...YS];new Set(l2);var c2=["about:","blob:","chrome:","chrome-untrusted:","content:","data:","devtools:","file:","filesystem:","javascript:"];function u2(e){try{return c2.includes(new URL(e).protocol)}catch{return!1}}var ao=_.createContext(null);ao.displayName="DataRouter";var md=_.createContext(null);md.displayName="DataRouterState";var XS=_.createContext(!1);function d2(){return _.useContext(XS)}var QS=_.createContext({isTransitioning:!1});QS.displayName="ViewTransition";var f2=_.createContext(new Map);f2.displayName="Fetchers";var h2=_.createContext(null);h2.displayName="Await";var $t=_.createContext(null);$t.displayName="Navigation";var rl=_.createContext(null);rl.displayName="Location";var rn=_.createContext({outlet:null,matches:[],isDataRoute:!1});rn.displayName="Route";var Cg=_.createContext(null);Cg.displayName="RouteError";var ZS="REACT_ROUTER_ERROR",p2="REDIRECT",m2="ROUTE_ERROR_RESPONSE";function g2(e){if(e.startsWith(`${ZS}:${p2}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.location=="string"&&typeof t.reloadDocument=="boolean"&&typeof t.replace=="boolean")return t}catch{}}function v2(e){if(e.startsWith(`${ZS}:${m2}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new i2(t.status,t.statusText,t.data)}catch{}}function y2(e,{relative:t}={}){Ne(Hs(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:r}=_.useContext($t),{hash:s,pathname:i,search:o}=sl(e,{relative:t}),l=i;return n!=="/"&&(l=i==="/"?n:yn([n,i])),r.createHref({pathname:l,search:o,hash:s})}function Hs(){return _.useContext(rl)!=null}function Dt(){return Ne(Hs(),"useLocation() may be used only in the context of a <Router> component."),_.useContext(rl).location}function $o(e){Ne(Hs(),"useMatch() may be used only in the context of a <Router> component.");let{pathname:t}=Dt();return _.useMemo(()=>Ca(e,WS(t)),[t,e])}var JS="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function e1(e){_.useContext($t).static||_.useLayoutEffect(e)}function Sr(){let{isDataRoute:e}=_.useContext(rn);return e?I2():x2()}function x2(){Ne(Hs(),"useNavigate() may be used only in the context of a <Router> component.");let e=_.useContext(ao),{basename:t,navigator:n}=_.useContext($t),{matches:r}=_.useContext(rn),{pathname:s}=Dt(),i=JSON.stringify(Eg(r)),o=_.useRef(!1);return e1(()=>{o.current=!0}),_.useCallback((c,u={})=>{if(nn(o.current,JS),!o.current)return;if(typeof c=="number"){n.go(c);return}let d=pd(c,JSON.parse(i),s,u.relative==="path");e==null&&t!=="/"&&(d.pathname=d.pathname==="/"?t:yn([t,d.pathname])),(u.replace?n.replace:n.push)(d,u.state,u)},[t,n,i,s,e])}var _2=_.createContext(null);function w2(e){let t=_.useContext(rn).outlet;return _.useMemo(()=>t&&_.createElement(_2.Provider,{value:e},t),[t,e])}function Tg(){let{matches:e}=_.useContext(rn),t=e[e.length-1];return(t==null?void 0:t.params)??{}}function sl(e,{relative:t}={}){let{matches:n}=_.useContext(rn),{pathname:r}=Dt(),s=JSON.stringify(Eg(n));return _.useMemo(()=>pd(e,JSON.parse(s),r,t==="path"),[e,s,r,t])}function b2(e,t){return t1(e,t)}function t1(e,t,n){var w;Ne(Hs(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:r}=_.useContext($t),{matches:s}=_.useContext(rn),i=s[s.length-1],o=i?i.params:{},l=i?i.pathname:"/",c=i?i.pathnameBase:"/",u=i&&i.route;{let v=u&&u.path||"";r1(l,!u||v.endsWith("*")||v.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${l}" (under <Route path="${v}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
|
|
50
|
-
|
|
51
|
-
Please change the parent <Route path="${v}"> to <Route path="${v==="/"?"*":`${v}/*`}">.`)}let d=Dt(),f;if(t){let v=typeof t=="string"?oo(t):t;Ne(c==="/"||((w=v.pathname)==null?void 0:w.startsWith(c)),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${c}" but pathname "${v.pathname}" was given in the \`location\` prop.`),f=v}else f=d;let h=f.pathname||"/",p=h;if(c!=="/"){let v=c.replace(/^\//,"").split("/");p="/"+h.replace(/^\//,"").split("/").slice(v.length).join("/")}let g=n&&n.state.matches.length?n.state.matches.map(v=>Object.assign(v,{route:n.manifest[v.route.id]||v.route})):FS(e,{pathname:p});nn(u||g!=null,`No routes matched location "${f.pathname}${f.search}${f.hash}" `),nn(g==null||g[g.length-1].route.element!==void 0||g[g.length-1].route.Component!==void 0||g[g.length-1].route.lazy!==void 0,`Matched leaf route at location "${f.pathname}${f.search}${f.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let x=E2(g&&g.map(v=>Object.assign({},v,{params:Object.assign({},o,v.params),pathname:yn([c,r.encodeLocation?r.encodeLocation(v.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:v.pathname]),pathnameBase:v.pathnameBase==="/"?c:yn([c,r.encodeLocation?r.encodeLocation(v.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:v.pathnameBase])})),s,n);return t&&x?_.createElement(rl.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",mask:void 0,...f},navigationType:"POP"}},x):x}function j2(){let e=R2(),t=o2(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,r="rgba(200,200,200, 0.5)",s={padding:"0.5rem",backgroundColor:r},i={padding:"2px 4px",backgroundColor:r},o=null;return console.error("Error handled by React Router default ErrorBoundary:",e),o=_.createElement(_.Fragment,null,_.createElement("p",null,"💿 Hey developer 👋"),_.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",_.createElement("code",{style:i},"ErrorBoundary")," or"," ",_.createElement("code",{style:i},"errorElement")," prop on your route.")),_.createElement(_.Fragment,null,_.createElement("h2",null,"Unexpected Application Error!"),_.createElement("h3",{style:{fontStyle:"italic"}},t),n?_.createElement("pre",{style:s},n):null,o)}var S2=_.createElement(j2,null),n1=class extends _.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error("React Router caught the following error during render",e)}render(){let e=this.state.error;if(this.context&&typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){const n=v2(e.digest);n&&(e=n)}let t=e!==void 0?_.createElement(rn.Provider,{value:this.props.routeContext},_.createElement(Cg.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?_.createElement(k2,{error:e},t):t}};n1.contextType=XS;var Af=new WeakMap;function k2({children:e,error:t}){let{basename:n}=_.useContext($t);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let r=g2(t.digest);if(r){let s=Af.get(t);if(s)throw s;let i=GS(r.location,n),o=i.absoluteURL||i.to;if(u2(o))throw new Error("Invalid redirect location");if(qS&&!Af.get(t))if(i.isExternal||r.reloadDocument)window.location.href=o;else{const l=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(i.to,{replace:r.replace}));throw Af.set(t,l),l}return _.createElement("meta",{httpEquiv:"refresh",content:`0;url=${o}`})}}return e}function N2({routeContext:e,match:t,children:n}){let r=_.useContext(ao);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),_.createElement(rn.Provider,{value:e},n)}function E2(e,t=[],n){let r=n==null?void 0:n.state;if(e==null){if(!r)return null;if(r.errors)e=r.matches;else if(t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let s=e,i=r==null?void 0:r.errors;if(i!=null){let d=s.findIndex(f=>f.route.id&&(i==null?void 0:i[f.route.id])!==void 0);Ne(d>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(i).join(",")}`),s=s.slice(0,Math.min(s.length,d+1))}let o=!1,l=-1;if(n&&r){o=r.renderFallback;for(let d=0;d<s.length;d++){let f=s[d];if((f.route.HydrateFallback||f.route.hydrateFallbackElement)&&(l=d),f.route.id){let{loaderData:h,errors:p}=r,g=f.route.loader&&!h.hasOwnProperty(f.route.id)&&(!p||p[f.route.id]===void 0);if(f.route.lazy||g){n.isStatic&&(o=!0),l>=0?s=s.slice(0,l+1):s=[s[0]];break}}}}let c=n==null?void 0:n.onError,u=r&&c?(d,f)=>{var h,p;c(d,{location:r.location,params:((p=(h=r.matches)==null?void 0:h[0])==null?void 0:p.params)??{},pattern:a2(r.matches),errorInfo:f})}:void 0;return s.reduceRight((d,f,h)=>{let p,g=!1,x=null,w=null;r&&(p=i&&f.route.id?i[f.route.id]:void 0,x=f.route.errorElement||S2,o&&(l<0&&h===0?(r1("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),g=!0,w=null):l===h&&(g=!0,w=f.route.hydrateFallbackElement||null)));let v=t.concat(s.slice(0,h+1)),y=()=>{let m;return p?m=x:g?m=w:f.route.Component?m=_.createElement(f.route.Component,null):f.route.element?m=f.route.element:m=d,_.createElement(N2,{match:f,routeContext:{outlet:d,matches:v,isDataRoute:r!=null},children:m})};return r&&(f.route.ErrorBoundary||f.route.errorElement||h===0)?_.createElement(n1,{location:r.location,revalidation:r.revalidation,component:x,error:p,children:y(),routeContext:{outlet:null,matches:v,isDataRoute:!0},onError:u}):y()},null)}function Pg(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function C2(e){let t=_.useContext(ao);return Ne(t,Pg(e)),t}function T2(e){let t=_.useContext(md);return Ne(t,Pg(e)),t}function P2(e){let t=_.useContext(rn);return Ne(t,Pg(e)),t}function Ag(e){let t=P2(e),n=t.matches[t.matches.length-1];return Ne(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function A2(){return Ag("useRouteId")}function R2(){var r;let e=_.useContext(Cg),t=T2("useRouteError"),n=Ag("useRouteError");return e!==void 0?e:(r=t.errors)==null?void 0:r[n]}function I2(){let{router:e}=C2("useNavigate"),t=Ag("useNavigate"),n=_.useRef(!1);return e1(()=>{n.current=!0}),_.useCallback(async(s,i={})=>{nn(n.current,JS),n.current&&(typeof s=="number"?await e.navigate(s):await e.navigate(s,{fromRouteId:t,...i}))},[e,t])}var Ox={};function r1(e,t,n){!t&&!Ox[e]&&(Ox[e]=!0,nn(!1,n))}_.memo(M2);function M2({routes:e,manifest:t,future:n,state:r,isStatic:s,onError:i}){return t1(e,void 0,{manifest:t,state:r,isStatic:s,onError:i})}function s1({to:e,replace:t,state:n,relative:r}){Ne(Hs(),"<Navigate> may be used only in the context of a <Router> component.");let{static:s}=_.useContext($t);nn(!s,"<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.");let{matches:i}=_.useContext(rn),{pathname:o}=Dt(),l=Sr(),c=pd(e,Eg(i),o,r==="path"),u=JSON.stringify(c);return _.useEffect(()=>{l(JSON.parse(u),{replace:t,state:n,relative:r})},[l,u,r,t,n]),null}function i1(e){return w2(e.context)}function rt(e){Ne(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function O2({basename:e="/",children:t=null,location:n,navigationType:r="POP",navigator:s,static:i=!1,useTransitions:o}){Ne(!Hs(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let l=e.replace(/^\/*/,"/"),c=_.useMemo(()=>({basename:l,navigator:s,static:i,useTransitions:o,future:{}}),[l,s,i,o]);typeof n=="string"&&(n=oo(n));let{pathname:u="/",search:d="",hash:f="",state:h=null,key:p="default",mask:g}=n,x=_.useMemo(()=>{let w=yr(u,l);return w==null?null:{location:{pathname:w,search:d,hash:f,state:h,key:p,mask:g},navigationType:r}},[l,u,d,f,h,p,r,g]);return nn(x!=null,`<Router basename="${l}"> is not able to match the URL "${u}${d}${f}" because it does not start with the basename, so the <Router> won't render anything.`),x==null?null:_.createElement($t.Provider,{value:c},_.createElement(rl.Provider,{children:t,value:x}))}function L2({children:e,location:t}){return b2(yp(e),t)}function yp(e,t=[]){let n=[];return _.Children.forEach(e,(r,s)=>{if(!_.isValidElement(r))return;let i=[...t,s];if(r.type===_.Fragment){n.push.apply(n,yp(r.props.children,i));return}Ne(r.type===rt,`[${typeof r.type=="string"?r.type:r.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),Ne(!r.props.index||!r.props.children,"An index route cannot have child routes.");let o={id:r.props.id||i.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,middleware:r.props.middleware,loader:r.props.loader,action:r.props.action,hydrateFallbackElement:r.props.hydrateFallbackElement,HydrateFallback:r.props.HydrateFallback,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.hasErrorBoundary===!0||r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(o.children=yp(r.props.children,i)),n.push(o)}),n}var kc="get",Nc="application/x-www-form-urlencoded";function gd(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function $2(e){return gd(e)&&e.tagName.toLowerCase()==="button"}function D2(e){return gd(e)&&e.tagName.toLowerCase()==="form"}function z2(e){return gd(e)&&e.tagName.toLowerCase()==="input"}function F2(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function V2(e,t){return e.button===0&&(!t||t==="_self")&&!F2(e)}function xp(e=""){return new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let r=e[n];return t.concat(Array.isArray(r)?r.map(s=>[n,s]):[[n,r]])},[]))}function B2(e,t){let n=xp(e);return t&&t.forEach((r,s)=>{n.has(s)||t.getAll(s).forEach(i=>{n.append(s,i)})}),n}var Vl=null;function U2(){if(Vl===null)try{new FormData(document.createElement("form"),0),Vl=!1}catch{Vl=!0}return Vl}var H2=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Rf(e){return e!=null&&!H2.has(e)?(nn(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Nc}"`),null):e}function W2(e,t){let n,r,s,i,o;if(D2(e)){let l=e.getAttribute("action");r=l?yr(l,t):null,n=e.getAttribute("method")||kc,s=Rf(e.getAttribute("enctype"))||Nc,i=new FormData(e)}else if($2(e)||z2(e)&&(e.type==="submit"||e.type==="image")){let l=e.form;if(l==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let c=e.getAttribute("formaction")||l.getAttribute("action");if(r=c?yr(c,t):null,n=e.getAttribute("formmethod")||l.getAttribute("method")||kc,s=Rf(e.getAttribute("formenctype"))||Rf(l.getAttribute("enctype"))||Nc,i=new FormData(l,e),!U2()){let{name:u,type:d,value:f}=e;if(d==="image"){let h=u?`${u}.`:"";i.append(`${h}x`,"0"),i.append(`${h}y`,"0")}else u&&i.append(u,f)}}else{if(gd(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=kc,r=null,s=Nc,o=e}return i&&s==="text/plain"&&(o=i,i=void 0),{action:r,method:n.toLowerCase(),encType:s,formData:i,body:o}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function Rg(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function o1(e,t,n,r){let s=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return n?s.pathname.endsWith("/")?s.pathname=`${s.pathname}_.${r}`:s.pathname=`${s.pathname}.${r}`:s.pathname==="/"?s.pathname=`_root.${r}`:t&&yr(s.pathname,t)==="/"?s.pathname=`${pu(t)}/_root.${r}`:s.pathname=`${pu(s.pathname)}.${r}`,s}async function K2(e,t){if(e.id in t)return t[e.id];try{let n=await import(e.module);return t[e.id]=n,n}catch(n){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(n),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function q2(e){return e==null?!1:e.href==null?e.rel==="preload"&&typeof e.imageSrcSet=="string"&&typeof e.imageSizes=="string":typeof e.rel=="string"&&typeof e.href=="string"}async function G2(e,t,n){let r=await Promise.all(e.map(async s=>{let i=t.routes[s.route.id];if(i){let o=await K2(i,n);return o.links?o.links():[]}return[]}));return Z2(r.flat(1).filter(q2).filter(s=>s.rel==="stylesheet"||s.rel==="preload").map(s=>s.rel==="stylesheet"?{...s,rel:"prefetch",as:"style"}:{...s,rel:"prefetch"}))}function Lx(e,t,n,r,s,i){let o=(c,u)=>n[u]?c.route.id!==n[u].route.id:!0,l=(c,u)=>{var d;return n[u].pathname!==c.pathname||((d=n[u].route.path)==null?void 0:d.endsWith("*"))&&n[u].params["*"]!==c.params["*"]};return i==="assets"?t.filter((c,u)=>o(c,u)||l(c,u)):i==="data"?t.filter((c,u)=>{var f;let d=r.routes[c.route.id];if(!d||!d.hasLoader)return!1;if(o(c,u)||l(c,u))return!0;if(c.route.shouldRevalidate){let h=c.route.shouldRevalidate({currentUrl:new URL(s.pathname+s.search+s.hash,window.origin),currentParams:((f=n[0])==null?void 0:f.params)||{},nextUrl:new URL(e,window.origin),nextParams:c.params,defaultShouldRevalidate:!0});if(typeof h=="boolean")return h}return!0}):[]}function Y2(e,t,{includeHydrateFallback:n}={}){return X2(e.map(r=>{let s=t.routes[r.route.id];if(!s)return[];let i=[s.module];return s.clientActionModule&&(i=i.concat(s.clientActionModule)),s.clientLoaderModule&&(i=i.concat(s.clientLoaderModule)),n&&s.hydrateFallbackModule&&(i=i.concat(s.hydrateFallbackModule)),s.imports&&(i=i.concat(s.imports)),i}).flat(1))}function X2(e){return[...new Set(e)]}function Q2(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function Z2(e,t){let n=new Set;return new Set(t),e.reduce((r,s)=>{let i=JSON.stringify(Q2(s));return n.has(i)||(n.add(i),r.push({key:i,link:s})),r},[])}function Ig(){let e=_.useContext(ao);return Rg(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function J2(){let e=_.useContext(md);return Rg(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var Mg=_.createContext(void 0);Mg.displayName="FrameworkContext";function vd(){let e=_.useContext(Mg);return Rg(e,"You must render this element inside a <HydratedRouter> element"),e}function eM(e,t){let n=_.useContext(Mg),[r,s]=_.useState(!1),[i,o]=_.useState(!1),{onFocus:l,onBlur:c,onMouseEnter:u,onMouseLeave:d,onTouchStart:f}=t,h=_.useRef(null);_.useEffect(()=>{if(e==="render"&&o(!0),e==="viewport"){let x=v=>{v.forEach(y=>{o(y.isIntersecting)})},w=new IntersectionObserver(x,{threshold:.5});return h.current&&w.observe(h.current),()=>{w.disconnect()}}},[e]),_.useEffect(()=>{if(r){let x=setTimeout(()=>{o(!0)},100);return()=>{clearTimeout(x)}}},[r]);let p=()=>{s(!0)},g=()=>{s(!1),o(!1)};return n?e!=="intent"?[i,h,{}]:[i,h,{onFocus:No(l,p),onBlur:No(c,g),onMouseEnter:No(u,p),onMouseLeave:No(d,g),onTouchStart:No(f,p)}]:[!1,h,{}]}function No(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function tM({page:e,...t}){let n=d2(),{nonce:r}=vd(),{router:s}=Ig(),i=_.useMemo(()=>FS(s.routes,e,s.basename),[s.routes,e,s.basename]);return i?(t.nonce==null&&r&&(t={...t,nonce:r}),n?_.createElement(rM,{page:e,matches:i,...t}):_.createElement(sM,{page:e,matches:i,...t})):null}function nM(e){let{manifest:t,routeModules:n}=vd(),[r,s]=_.useState([]);return _.useEffect(()=>{let i=!1;return G2(e,t,n).then(o=>{i||s(o)}),()=>{i=!0}},[e,t,n]),r}function rM({page:e,matches:t,...n}){let r=Dt(),{future:s}=vd(),{basename:i}=Ig(),o=_.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let l=o1(e,i,s.v8_trailingSlashAwareDataRequests,"rsc"),c=!1,u=[];for(let d of t)typeof d.route.shouldRevalidate=="function"?c=!0:u.push(d.route.id);return c&&u.length>0&&l.searchParams.set("_routes",u.join(",")),[l.pathname+l.search]},[i,s.v8_trailingSlashAwareDataRequests,e,r,t]);return _.createElement(_.Fragment,null,o.map(l=>_.createElement("link",{key:l,rel:"prefetch",as:"fetch",href:l,...n})))}function sM({page:e,matches:t,...n}){let r=Dt(),{future:s,manifest:i,routeModules:o}=vd(),{basename:l}=Ig(),{loaderData:c,matches:u}=J2(),d=_.useMemo(()=>Lx(e,t,u,i,r,"data"),[e,t,u,i,r]),f=_.useMemo(()=>Lx(e,t,u,i,r,"assets"),[e,t,u,i,r]),h=_.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let x=new Set,w=!1;if(t.forEach(y=>{var b;let m=i.routes[y.route.id];!m||!m.hasLoader||(!d.some(j=>j.route.id===y.route.id)&&y.route.id in c&&((b=o[y.route.id])!=null&&b.shouldRevalidate)||m.hasClientLoader?w=!0:x.add(y.route.id))}),x.size===0)return[];let v=o1(e,l,s.v8_trailingSlashAwareDataRequests,"data");return w&&x.size>0&&v.searchParams.set("_routes",t.filter(y=>x.has(y.route.id)).map(y=>y.route.id).join(",")),[v.pathname+v.search]},[l,s.v8_trailingSlashAwareDataRequests,c,r,i,d,t,e,o]),p=_.useMemo(()=>Y2(f,i),[f,i]),g=nM(f);return _.createElement(_.Fragment,null,h.map(x=>_.createElement("link",{key:x,rel:"prefetch",as:"fetch",href:x,...n})),p.map(x=>_.createElement("link",{key:x,rel:"modulepreload",href:x,...n})),g.map(({key:x,link:w})=>_.createElement("link",{key:x,nonce:n.nonce,...w,crossOrigin:w.crossOrigin??n.crossOrigin})))}function iM(...e){return t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})}}var oM=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{oM&&(window.__reactRouterVersion="7.18.2")}catch{}function aM({basename:e,children:t,useTransitions:n,window:r}){let s=_.useRef();s.current==null&&(s.current=DI({window:r,v5Compat:!0}));let i=s.current,[o,l]=_.useState({action:i.action,location:i.location}),c=_.useCallback(u=>{n===!1?l(u):_.startTransition(()=>l(u))},[n]);return _.useLayoutEffect(()=>i.listen(c),[i,c]),_.createElement(O2,{basename:e,children:t,location:o.location,navigationType:o.action,navigator:i,useTransitions:n})}var ze=_.forwardRef(function({onClick:t,discover:n="render",prefetch:r="none",relative:s,reloadDocument:i,replace:o,mask:l,state:c,target:u,to:d,preventScrollReset:f,viewTransition:h,defaultShouldRevalidate:p,...g},x){let{basename:w,navigator:v,useTransitions:y}=_.useContext($t),m=typeof d=="string"&&Ng.test(d),b=GS(d,w);d=b.to;let j=y2(d,{relative:s}),S=Dt(),k=null;if(l){let E=pd(l,[],S.mask?S.mask.pathname:"/",!0);w!=="/"&&(E.pathname=E.pathname==="/"?w:yn([w,E.pathname])),k=v.createHref(E)}let[N,A,O]=eM(r,g),D=uM(d,{replace:o,mask:l,state:c,target:u,preventScrollReset:f,relative:s,viewTransition:h,defaultShouldRevalidate:p,useTransitions:y});function I(E){t&&t(E),E.defaultPrevented||D(E)}let z=!(b.isExternal||i),T=_.createElement("a",{...g,...O,href:(z?k:void 0)||b.absoluteURL||j,onClick:z?I:t,ref:iM(x,A),target:u,"data-discover":!m&&n==="render"?"true":void 0});return N&&!m?_.createElement(_.Fragment,null,T,_.createElement(tM,{page:j})):T});ze.displayName="Link";var a1=_.forwardRef(function({"aria-current":t="page",caseSensitive:n=!1,className:r="",end:s=!1,style:i,to:o,viewTransition:l,children:c,...u},d){let f=sl(o,{relative:u.relative}),h=Dt(),p=_.useContext(md),{navigator:g,basename:x}=_.useContext($t),w=p!=null&&mM(f)&&l===!0,v=g.encodeLocation?g.encodeLocation(f).pathname:f.pathname,y=h.pathname,m=p&&p.navigation&&p.navigation.location?p.navigation.location.pathname:null;n||(y=y.toLowerCase(),m=m?m.toLowerCase():null,v=v.toLowerCase()),m&&x&&(m=yr(m,x)||m);const b=v!=="/"&&v.endsWith("/")?v.length-1:v.length;let j=y===v||!s&&y.startsWith(v)&&y.charAt(b)==="/",S=m!=null&&(m===v||!s&&m.startsWith(v)&&m.charAt(v.length)==="/"),k={isActive:j,isPending:S,isTransitioning:w},N=j?t:void 0,A;typeof r=="function"?A=r(k):A=[r,j?"active":null,S?"pending":null,w?"transitioning":null].filter(Boolean).join(" ");let O=typeof i=="function"?i(k):i;return _.createElement(ze,{...u,"aria-current":N,className:A,ref:d,style:O,to:o,viewTransition:l},typeof c=="function"?c(k):c)});a1.displayName="NavLink";var lM=_.forwardRef(({discover:e="render",fetcherKey:t,navigate:n,reloadDocument:r,replace:s,state:i,method:o=kc,action:l,onSubmit:c,relative:u,preventScrollReset:d,viewTransition:f,defaultShouldRevalidate:h,...p},g)=>{let{useTransitions:x}=_.useContext($t),w=hM(),v=pM(l,{relative:u}),y=o.toLowerCase()==="get"?"get":"post",m=typeof l=="string"&&Ng.test(l),b=j=>{if(c&&c(j),j.defaultPrevented)return;j.preventDefault();let S=j.nativeEvent.submitter,k=(S==null?void 0:S.getAttribute("formmethod"))||o,N=()=>w(S||j.currentTarget,{fetcherKey:t,method:k,navigate:n,replace:s,state:i,relative:u,preventScrollReset:d,viewTransition:f,defaultShouldRevalidate:h});x&&n!==!1?_.startTransition(()=>N()):N()};return _.createElement("form",{ref:g,method:y,action:v,onSubmit:r?c:b,...p,"data-discover":!m&&e==="render"?"true":void 0})});lM.displayName="Form";function cM(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function l1(e){let t=_.useContext(ao);return Ne(t,cM(e)),t}function uM(e,{target:t,replace:n,mask:r,state:s,preventScrollReset:i,relative:o,viewTransition:l,defaultShouldRevalidate:c,useTransitions:u}={}){let d=Sr(),f=Dt(),h=sl(e,{relative:o});return _.useCallback(p=>{if(V2(p,t)){p.preventDefault();let g=n!==void 0?n:Ea(f)===Ea(h),x=()=>d(e,{replace:g,mask:r,state:s,preventScrollReset:i,relative:o,viewTransition:l,defaultShouldRevalidate:c});u?_.startTransition(()=>x()):x()}},[f,d,h,n,r,s,t,e,i,o,l,c,u])}function Og(e){nn(typeof URLSearchParams<"u","You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let t=_.useRef(xp(e)),n=_.useRef(!1),r=Dt(),s=_.useMemo(()=>B2(r.search,n.current?null:t.current),[r.search]),i=Sr(),o=_.useCallback((l,c)=>{const u=xp(typeof l=="function"?l(new URLSearchParams(s)):l);n.current=!0,i("?"+u,c)},[i,s]);return[s,o]}var dM=0,fM=()=>`__${String(++dM)}__`;function hM(){let{router:e}=l1("useSubmit"),{basename:t}=_.useContext($t),n=A2(),r=e.fetch,s=e.navigate;return _.useCallback(async(i,o={})=>{let{action:l,method:c,encType:u,formData:d,body:f}=W2(i,t);if(o.navigate===!1){let h=o.fetcherKey||fM();await r(h,n,o.action||l,{defaultShouldRevalidate:o.defaultShouldRevalidate,preventScrollReset:o.preventScrollReset,formData:d,body:f,formMethod:o.method||c,formEncType:o.encType||u,flushSync:o.flushSync})}else await s(o.action||l,{defaultShouldRevalidate:o.defaultShouldRevalidate,preventScrollReset:o.preventScrollReset,formData:d,body:f,formMethod:o.method||c,formEncType:o.encType||u,replace:o.replace,state:o.state,fromRouteId:n,flushSync:o.flushSync,viewTransition:o.viewTransition})},[r,s,t,n])}function pM(e,{relative:t}={}){let{basename:n}=_.useContext($t),r=_.useContext(rn);Ne(r,"useFormAction must be used inside a RouteContext");let[s]=r.matches.slice(-1),i={...sl(e||".",{relative:t})},o=Dt();if(e==null){i.search=o.search;let l=new URLSearchParams(i.search),c=l.getAll("index");if(c.some(d=>d==="")){l.delete("index"),c.filter(f=>f).forEach(f=>l.append("index",f));let d=l.toString();i.search=d?`?${d}`:""}}return(!e||e===".")&&s.route.index&&(i.search=i.search?i.search.replace(/^\?/,"?index&"):"?index"),n!=="/"&&(i.pathname=i.pathname==="/"?n:yn([n,i.pathname])),Ea(i)}function mM(e,{relative:t}={}){let n=_.useContext(QS);Ne(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=l1("useViewTransitionState"),s=sl(e,{relative:t});if(!n.isTransitioning)return!1;let i=yr(n.currentLocation.pathname,r)||n.currentLocation.pathname,o=yr(n.nextLocation.pathname,r)||n.nextLocation.pathname;return Ca(s.pathname,o)!=null||Ca(s.pathname,i)!=null}function pe(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 gM={};function yd(){return typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:gM}var c1=Object.assign,mu=Object.getOwnPropertyDescriptor,zn=Object.defineProperty,xd=Object.prototype,_p=[];Object.freeze(_p);var u1={};Object.freeze(u1);var vM=typeof Proxy<"u",yM=Object.toString();function d1(){vM||pe("Proxy not available")}function f1(e){var t=!1;return function(){if(!t)return t=!0,e.apply(this,arguments)}}var pi=function(){};function bn(e){return typeof e=="function"}function Rs(e){var t=typeof e;switch(t){case"string":case"symbol":case"number":return!0}return!1}function _d(e){return e!==null&&typeof e=="object"}function Yr(e){if(!_d(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()===yM}function h1(e){var t=e==null?void 0:e.constructor;return t?t.name==="GeneratorFunction"||t.displayName==="GeneratorFunction":!1}function wd(e,t,n){zn(e,t,{enumerable:!1,writable:!0,configurable:!0,value:n})}function p1(e,t,n){zn(e,t,{enumerable:!1,writable:!1,configurable:!0,value:n})}function Ws(e,t){var n="isMobX"+e;return t.prototype[n]=!0,function(r){return _d(r)&&r[n]===!0}}function lo(e){return e!=null&&Object.prototype.toString.call(e)==="[object Map]"}function xM(e){var t=Object.getPrototypeOf(e),n=Object.getPrototypeOf(t),r=Object.getPrototypeOf(n);return r===null}function Jn(e){return e!=null&&Object.prototype.toString.call(e)==="[object Set]"}var m1=typeof Object.getOwnPropertySymbols<"u";function _M(e){var t=Object.keys(e);if(!m1)return t;var n=Object.getOwnPropertySymbols(e);return n.length?[].concat(t,n.filter(function(r){return xd.propertyIsEnumerable.call(e,r)})):t}var bd=typeof Reflect<"u"&&Reflect.ownKeys?Reflect.ownKeys:m1?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames;function g1(e){return e===null?null:typeof e=="object"?""+e:e}function lr(e,t){return xd.hasOwnProperty.call(e,t)}var wM=Object.getOwnPropertyDescriptors||function(t){var n={};return bd(t).forEach(function(r){n[r]=mu(t,r)}),n};function St(e,t){return!!(e&t)}function kt(e,t,n){return n?e|=t:e&=~t,e}function $x(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 bM(e,t,n){if(v1())return Reflect.construct.apply(null,arguments);var r=[null];r.push.apply(r,t);var s=new(e.bind.apply(e,r));return n&&Ta(s,n.prototype),s}function jM(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,NM(r.key),r)}}function co(e,t,n){return t&&jM(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function mi(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=EM(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.
|
|
52
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Is(){return Is=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},Is.apply(null,arguments)}function wp(e){return wp=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},wp(e)}function Lg(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,Ta(e,t)}function SM(e){try{return Function.toString.call(e).indexOf("[native code]")!==-1}catch{return typeof e=="function"}}function v1(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(v1=function(){return!!e})()}function Ta(e,t){return Ta=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},Ta(e,t)}function kM(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 NM(e){var t=kM(e,"string");return typeof t=="symbol"?t:t+""}function EM(e,t){if(e){if(typeof e=="string")return $x(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)?$x(e,t):void 0}}function bp(e){var t=typeof Map=="function"?new Map:void 0;return bp=function(n){if(n===null||!SM(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 bM(n,arguments,wp(this).constructor)}return r.prototype=Object.create(n.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),Ta(r,n)},bp(e)}var Ln=Symbol("mobx-stored-annotations");function Fn(e){function t(n,r){if(ol(r))return e.decorate_20223_(n,r);il(n,r,e)}return Object.assign(t,e)}function il(e,t,n){lr(e,Ln)||wd(e,Ln,Is({},e[Ln])),MM(n)||(e[Ln][t]=n)}function CM(e){return lr(e,Ln)||wd(e,Ln,Is({},e[Ln])),e[Ln]}function ol(e){return typeof e=="object"&&typeof e.kind=="string"}var ae=Symbol("mobx administration"),ts=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_=ve.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 M1(this)},t.reportChanged=function(){Xt(),O1(this),Qt()},t.toString=function(){return this.name_},co(e,[{key:"isBeingObserved",get:function(){return St(this.flags_,e.isBeingObservedMask_)},set:function(r){this.flags_=kt(this.flags_,e.isBeingObservedMask_,r)}},{key:"isPendingUnobservation",get:function(){return St(this.flags_,e.isPendingUnobservationMask_)},set:function(r){this.flags_=kt(this.flags_,e.isPendingUnobservationMask_,r)}},{key:"diffValue",get:function(){return St(this.flags_,e.diffValueMask_)?1:0},set:function(r){this.flags_=kt(this.flags_,e.diffValueMask_,r===1)}}])}();ts.isBeingObservedMask_=1;ts.isPendingUnobservationMask_=2;ts.diffValueMask_=4;var $g=Ws("Atom",ts);function y1(e,t,n){t===void 0&&(t=pi),n===void 0&&(n=pi);var r=new ts(e);return t!==pi&&LO(r,t),n!==pi&&B1(r,n),r}function TM(e,t){return tk(e,t)}function PM(e,t){return Object.is?Object.is(e,t):e===t?e!==0||1/e===1/t:e!==e&&t!==t}var gu={structural:TM,default:PM};function Ms(e,t,n){return K1(e)?e:Array.isArray(e)?xe.array(e,{name:n}):Yr(e)?xe.object(e,void 0,{name:n}):lo(e)?xe.map(e,{name:n}):Jn(e)?xe.set(e,{name:n}):typeof e=="function"&&!Vi(e)&&!Aa(e)?h1(e)?Bi(e):Pa(n,e):e}function AM(e,t,n){if(e==null||Ed(e)||Nd(e)||qs(e)||Mn(e))return e;if(Array.isArray(e))return xe.array(e,{name:n,deep:!1});if(Yr(e))return xe.object(e,void 0,{name:n,deep:!1});if(lo(e))return xe.map(e,{name:n,deep:!1});if(Jn(e))return xe.set(e,{name:n,deep:!1})}function jd(e){return e}function RM(e,t){return tk(e,t)?t:e}var IM="override";function MM(e){return e.annotationType_===IM}function al(e,t){return{annotationType_:e,options_:t,make_:OM,extend_:LM,decorate_20223_:$M}}function OM(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(Vi(n.value))return 1;var i=x1(e,this,t,n,!1);return zn(r,t,i),2}function LM(e,t,n,r){var s=x1(e,this,t,n);return e.defineProperty_(t,s,r)}function $M(e,t){var n=t.kind,r=t.name,s=t.addInitializer,i=this,o=function(u){var d,f,h,p;return Os((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 Vi(d)||(d=o(d)),(u=i.options_)!=null&&u.bound&&(d=d.bind(this),d.isMobxAction=!0),d};if(n=="method"){var l;return Vi(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}pe("Cannot apply '"+i.annotationType_+"' to '"+String(r)+"' (kind: "+n+"):"+(`
|
|
53
|
-
'`+i.annotationType_+"' can only be used on properties with a function value."))}function DM(e,t,n,r){t.annotationType_,r.value}function x1(e,t,n,r,s){var i,o,l,c,u,d,f;s===void 0&&(s=Z.safeDescriptors),DM(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:Os((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 _1(e,t){return{annotationType_:e,options_:t,make_:zM,extend_:FM,decorate_20223_:VM}}function zM(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&&(!lr(e.target_,t)||!Aa(e.target_[t]))&&this.extend_(e,t,n,!1)===null)return 0;if(Aa(n.value))return 1;var i=w1(e,this,t,n,!1,!1);return zn(r,t,i),2}function FM(e,t,n,r){var s,i=w1(e,this,t,n,(s=this.options_)==null?void 0:s.bound);return e.defineProperty_(t,i,r)}function VM(e,t){var n,r=t.name,s=t.addInitializer;return Aa(e)||(e=Bi(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 BM(e,t,n,r){t.annotationType_,r.value}function w1(e,t,n,r,s,i){i===void 0&&(i=Z.safeDescriptors),BM(e,t,n,r);var o=r.value;if(Aa(o)||(o=Bi(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 Dg(e,t){return{annotationType_:e,options_:t,make_:UM,extend_:HM,decorate_20223_:WM}}function UM(e,t,n){return this.extend_(e,t,n,!1)===null?0:1}function HM(e,t,n,r){return KM(e,this,t,n),e.defineComputedProperty_(t,Is({},this.options_,{get:n.get,set:n.set}),r)}function WM(e,t){var n=this,r=t.name,s=t.addInitializer,i;function o(l,c){var u=Is({},n.options_,{get:e,context:l});return u.name||(u.name="ObservableObject."+r.toString()),new Pt(u)}return s(function(){var l,c=uo(this)[ae],u=this,d=c.values_.get(r);d instanceof Pt&&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[ae],c=l.values_.get(r);if(c instanceof Pt&&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 KM(e,t,n,r){t.annotationType_,r.get}function Sd(e,t){return{annotationType_:e,options_:t,make_:qM,extend_:GM,decorate_20223_:YM}}function qM(e,t,n){return this.extend_(e,t,n,!1)===null?0:1}function GM(e,t,n,r){var s,i;return XM(e,this),e.defineObservableProperty_(t,n.value,(s=(i=this.options_)==null?void 0:i.enhancer)!=null?s:Ms,r)}function YM(e,t){var n=this,r=t.kind,s=t.name;if(r!=="accessor")return;function i(o,l){var c,u=uo(o)[ae];return((c=u.lazyObservableKeys_)!=null?c:u.lazyObservableKeys_=new Map).set(s,function(){var d,f;return new js(l,(d=(f=n.options_)==null?void 0:f.enhancer)!=null?d:Ms,"ObservableObject."+s.toString(),!1)}),u}return{get:function(){var l,c=(l=this[ae])!=null?l:i(this,e.get.call(this));return c.getObservablePropValue_(s)},set:function(l){var c,u=(c=this[ae])!=null?c:i(this,l);return u.setObservablePropValue_(s,l)},init:function(l){return i(this,l),l}}}function XM(e,t,n,r){t.annotationType_}var QM="true",ZM=b1();function b1(e){return{annotationType_:QM,options_:e,make_:JM,extend_:eO,decorate_20223_:tO}}function JM(e,t,n,r){var s,i;if(n.get)return er.make_(e,t,n,r);if(n.set){var o=Vi(n.set)?n.set:Os(t.toString(),n.set);return r===e.target_?e.defineProperty_(t,{configurable:Z.safeDescriptors?e.isPlainObject_:!0,set:o})===null?0:2:(zn(r,t,{configurable:!0,set:o}),2)}if(r!==e.target_&&typeof n.value=="function"){var l;if(h1(n.value)){var c,u=(c=this.options_)!=null&&c.autoBind?Bi.bound:Bi;return u.make_(e,t,n,r)}var d=(l=this.options_)!=null&&l.autoBind?Pa.bound:Pa;return d.make_(e,t,n,r)}var f=((s=this.options_)==null?void 0:s.deep)===!1?xe.ref:xe;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 eO(e,t,n,r){var s,i;if(n.get)return er.extend_(e,t,n,r);if(n.set)return e.defineProperty_(t,{configurable:Z.safeDescriptors?e.isPlainObject_:!0,set:Os(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?xe.ref:xe;return l.extend_(e,t,n,r)}function tO(e,t){pe("'"+this.annotationType_+"' cannot be used as a decorator")}var nO="observable",rO="observable.ref",sO="observable.shallow",iO="observable.struct",j1={deep:!0,name:void 0,defaultDecorator:void 0,proxy:!0};Object.freeze(j1);function Bl(e){return e||j1}var jp=Sd(nO),oO=Sd(rO,{enhancer:jd}),aO=Sd(sO,{enhancer:AM}),lO=Sd(iO,{enhancer:RM}),S1=Fn(jp);function Ul(e){return e.deep===!0?Ms:e.deep===!1?jd:uO(e.defaultDecorator)}function cO(e){var t;return e?(t=e.defaultDecorator)!=null?t:b1(e):void 0}function uO(e){var t,n;return e&&(t=(n=e.options_)==null?void 0:n.enhancer)!=null?t:Ms}function k1(e,t,n){if(ol(t))return jp.decorate_20223_(e,t);if(Rs(t)){il(e,t,jp);return}return K1(e)?e:Yr(e)?xe.object(e,t,n):Array.isArray(e)?xe.array(e,t):lo(e)?xe.map(e,t):Jn(e)?xe.set(e,t):typeof e=="object"&&e!==null?e:xe.box(e,t)}c1(k1,S1);var dO={box:function(t,n){var r=Bl(n);return new js(t,Ul(r),r.name,!0,r.equals)},array:function(t,n){var r=Bl(n);return(Z.useProxies===!1||r.proxy===!1?oL:XO)(t,Ul(r),r.name)},map:function(t,n){var r=Bl(n);return new Y1(t,Ul(r),r.name)},set:function(t,n){var r=Bl(n);return new X1(t,Ul(r),r.name)},object:function(t,n,r){return Gs(function(){return zO(Z.useProxies===!1||(r==null?void 0:r.proxy)===!1?uo({},r):qO({},r),t,n)})},ref:Fn(oO),shallow:Fn(aO),deep:S1,struct:Fn(lO)},xe=c1(k1,dO),N1="computed",fO="computed.struct",Sp=Dg(N1),hO=Dg(fO,{equals:gu.structural}),er=function(t,n){if(ol(n))return Sp.decorate_20223_(t,n);if(Rs(n))return il(t,n,Sp);if(Yr(t))return Fn(Dg(N1,t));var r=Yr(n)?n:{};return r.get=t,r.name||(r.name=t.name||""),new Pt(r)};Object.assign(er,Sp);er.struct=Fn(hO);var Dx,zx,vu=0,pO=1,mO=(Dx=(zx=mu(function(){},"name"))==null?void 0:zx.configurable)!=null?Dx:!1,Fx={value:"action",configurable:!0,writable:!1,enumerable:!1};function Os(e,t,n,r){n===void 0&&(n=!1);function s(){return E1(e,n,t,r||this,arguments)}return s.isMobxAction=!0,s.toString=function(){return t.toString()},mO&&(Fx.value=e,zn(s,"name",Fx)),s}function E1(e,t,n,r,s){var i=gO(e,t);try{return n.apply(r,s)}catch(o){throw i.error_=o,o}finally{vO(i)}}function gO(e,t,n,r){var s=!1,i=0,o=Z.trackingDerivation,l=!t||!o;Xt();var c=Z.allowStateChanges;l&&(Ks(),c=zg(!0));var u=Vg(!0),d={runAsAction_:l,prevDerivation_:o,prevAllowStateChanges_:c,prevAllowStateReads_:u,notifySpy_:s,startTime_:i,actionId_:pO++,parentActionId_:vu};return vu=d.actionId_,d}function vO(e){vu!==e.actionId_&&pe(30),vu=e.parentActionId_,e.error_!==void 0&&(Z.suppressReactionErrors=!0),Fg(e.prevAllowStateChanges_),ea(e.prevAllowStateReads_),Qt(),e.runAsAction_&&cr(e.prevDerivation_),Z.suppressReactionErrors=!1}function zg(e){var t=Z.allowStateChanges;return Z.allowStateChanges=e,t}function Fg(e){Z.allowStateChanges=e}var js=function(e){function t(r,s,i,o,l){var c;return i===void 0&&(i="ObservableValue"),l===void 0&&(l=gu.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}Lg(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!==Z.UNCHANGED&&this.setNewValue_(s)},n.prepareNewValue_=function(s){if(qt(this)){var i=Gt(this,{object:this,type:Vn,newValue:s});if(!i)return Z.UNCHANGED;s=i.newValue}return s=this.enhancer(s,this.value_,this.name_),this.equals(this.value_,s)?Z.UNCHANGED:s},n.setNewValue_=function(s){var i=this.value_;this.value_=s,this.reportChanged(),xn(this)&&_n(this,{type:Vn,object:this,newValue:s,oldValue:i})},n.get=function(){return this.reportObserved(),this.dehanceValue(this.value_)},n.intercept_=function(s){return ll(this,s)},n.observe_=function(s,i){return i&&s({observableKind:"value",debugObjectName:this.name_,object:this,type:Vn,newValue:this.value_,oldValue:void 0}),cl(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 g1(this.get())},n[Symbol.toPrimitive]=function(){return this.valueOf()},t}(ts),Pt=function(){function e(n){this.dependenciesState_=ve.NOT_TRACKING_,this.observing_=[],this.newObserving_=null,this.observers_=new Set,this.runId_=0,this.lastAccessedBy_=0,this.lowestObserverState_=ve.UP_TO_DATE_,this.unboundDepsCount_=0,this.value_=new xu(null),this.name_=void 0,this.triggeredBy_=void 0,this.flags_=0,this.derivation=void 0,this.setter_=void 0,this.isTracing_=yu.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||pe(31),this.derivation=n.get,this.name_=n.name||"ComputedValue",n.set&&(this.setter_=Os("ComputedValue-setter",n.set)),this.equals_=n.equals||(n.compareStructural||n.struct?gu.structural:gu.default),this.scope_=n.context,this.requiresReaction_=n.requiresReaction,this.keepAlive_=!!n.keepAlive}var t=e.prototype;return t.onBecomeStale_=function(){bO(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&&pe(32,this.name_,this.derivation),Z.inBatch===0&&this.observers_.size===0&&!this.keepAlive_)kp(this)&&(this.warnAboutUntrackedRead_(),Xt(),this.value_=this.computeValue_(!1),Qt());else if(M1(this),kp(this)){var r=Z.trackingContext;this.keepAlive_&&!r&&(Z.trackingContext=this),this.trackAndCompute()&&wO(this),Z.trackingContext=r}var s=this.value_;if(Ec(s))throw s.cause;return s},t.set=function(r){if(this.setter_){this.isRunningSetter&&pe(33,this.name_),this.isRunningSetter=!0;try{this.setter_.call(this.scope_,r)}finally{this.isRunningSetter=!1}}else pe(34,this.name_)},t.trackAndCompute=function(){var r=this.value_,s=this.dependenciesState_===ve.NOT_TRACKING_,i=this.computeValue_(!0),o=s||Ec(r)||Ec(i)||!this.equals_(r,i);return o&&(this.value_=i),o},t.computeValue_=function(r){this.isComputing=!0;var s=zg(!1),i;if(r)i=C1(this,this.derivation,this.scope_);else if(Z.disableErrorBoundaries===!0)i=this.derivation.call(this.scope_);else try{i=this.derivation.call(this.scope_)}catch(o){i=new xu(o)}return Fg(s),this.isComputing=!1,i},t.suspend_=function(){this.keepAlive_||(Np(this),this.value_=void 0)},t.observe_=function(r,s){var i=this,o=!0,l=void 0;return V1(function(){var c=i.get();if(!o||s){var u=Ks();r({observableKind:"computed",debugObjectName:i.name_,type:Vn,object:i,newValue:c,oldValue:l}),cr(u)}o=!1,l=c})},t.warnAboutUntrackedRead_=function(){},t.toString=function(){return this.name_+"["+this.derivation.toString()+"]"},t.valueOf=function(){return g1(this.get())},t[Symbol.toPrimitive]=function(){return this.valueOf()},co(e,[{key:"isComputing",get:function(){return St(this.flags_,e.isComputingMask_)},set:function(r){this.flags_=kt(this.flags_,e.isComputingMask_,r)}},{key:"isRunningSetter",get:function(){return St(this.flags_,e.isRunningSetterMask_)},set:function(r){this.flags_=kt(this.flags_,e.isRunningSetterMask_,r)}},{key:"isBeingObserved",get:function(){return St(this.flags_,e.isBeingObservedMask_)},set:function(r){this.flags_=kt(this.flags_,e.isBeingObservedMask_,r)}},{key:"isPendingUnobservation",get:function(){return St(this.flags_,e.isPendingUnobservationMask_)},set:function(r){this.flags_=kt(this.flags_,e.isPendingUnobservationMask_,r)}},{key:"diffValue",get:function(){return St(this.flags_,e.diffValueMask_)?1:0},set:function(r){this.flags_=kt(this.flags_,e.diffValueMask_,r===1)}}])}();Pt.isComputingMask_=1;Pt.isRunningSetterMask_=2;Pt.isBeingObservedMask_=4;Pt.isPendingUnobservationMask_=8;Pt.diffValueMask_=16;var kd=Ws("ComputedValue",Pt),ve;(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_"})(ve||(ve={}));var yu;(function(e){e[e.NONE=0]="NONE",e[e.LOG=1]="LOG",e[e.BREAK=2]="BREAK"})(yu||(yu={}));var xu=function(t){this.cause=void 0,this.cause=t};function Ec(e){return e instanceof xu}function kp(e){switch(e.dependenciesState_){case ve.UP_TO_DATE_:return!1;case ve.NOT_TRACKING_:case ve.STALE_:return!0;case ve.POSSIBLY_STALE_:{for(var t=Vg(!0),n=Ks(),r=e.observing_,s=r.length,i=0;i<s;i++){var o=r[i];if(kd(o)){if(Z.disableErrorBoundaries)o.get();else try{o.get()}catch{return cr(n),ea(t),!0}if(e.dependenciesState_===ve.STALE_)return cr(n),ea(t),!0}}return P1(e),cr(n),ea(t),!1}}}function C1(e,t,n){var r=Vg(!0);P1(e),e.newObserving_=new Array(e.runId_===0?100:e.observing_.length),e.unboundDepsCount_=0,e.runId_=++Z.runId;var s=Z.trackingDerivation;Z.trackingDerivation=e,Z.inBatch++;var i;if(Z.disableErrorBoundaries===!0)i=t.call(n);else try{i=t.call(n)}catch(o){i=new xu(o)}return Z.inBatch--,Z.trackingDerivation=s,yO(e),ea(r),i}function yO(e){for(var t=e.observing_,n=e.observing_=e.newObserving_,r=ve.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&&R1(c,e),c.diffValue=0}for(;s--;){var u=n[s];u.diffValue===1&&(u.diffValue=0,_O(u,e))}r!==ve.UP_TO_DATE_&&(e.dependenciesState_=r,e.onBecomeStale_())}function Np(e){var t=e.observing_;e.observing_=[];for(var n=t.length;n--;)R1(t[n],e);e.dependenciesState_=ve.NOT_TRACKING_}function T1(e){var t=Ks();try{return e()}finally{cr(t)}}function Ks(){var e=Z.trackingDerivation;return Z.trackingDerivation=null,e}function cr(e){Z.trackingDerivation=e}function Vg(e){var t=Z.allowStateReads;return Z.allowStateReads=e,t}function ea(e){Z.allowStateReads=e}function P1(e){if(e.dependenciesState_!==ve.UP_TO_DATE_){e.dependenciesState_=ve.UP_TO_DATE_;for(var t=e.observing_,n=t.length;n--;)t[n].lowestObserverState_=ve.UP_TO_DATE_}}var Cc=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},Tc=!0,A1=!1,Z=function(){var e=yd();return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(Tc=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==new Cc().version&&(Tc=!1),Tc?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new Cc):(setTimeout(function(){A1||pe(35)},1),new Cc)}();function xO(){if((Z.pendingReactions.length||Z.inBatch||Z.isRunningReactions)&&pe(36),A1=!0,Tc){var e=yd();--e.__mobxInstanceCount===0&&(e.__mobxGlobals=void 0),Z=new Cc}}function _O(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function R1(e,t){e.observers_.delete(t),e.observers_.size===0&&I1(e)}function I1(e){e.isPendingUnobservation===!1&&(e.isPendingUnobservation=!0,Z.pendingUnobservations.push(e))}function Xt(){Z.inBatch++}function Qt(){if(--Z.inBatch===0){L1();for(var e=Z.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 Pt&&n.suspend_())}Z.pendingUnobservations=[]}}function M1(e){var t=Z.trackingDerivation;return t!==null?(t.runId_!==e.lastAccessedBy_&&(e.lastAccessedBy_=t.runId_,t.newObserving_[t.unboundDepsCount_++]=e,!e.isBeingObserved&&Z.trackingContext&&(e.isBeingObserved=!0,e.onBO())),e.isBeingObserved):(e.observers_.size===0&&Z.inBatch>0&&I1(e),!1)}function O1(e){e.lowestObserverState_!==ve.STALE_&&(e.lowestObserverState_=ve.STALE_,e.observers_.forEach(function(t){t.dependenciesState_===ve.UP_TO_DATE_&&t.onBecomeStale_(),t.dependenciesState_=ve.STALE_}))}function wO(e){e.lowestObserverState_!==ve.STALE_&&(e.lowestObserverState_=ve.STALE_,e.observers_.forEach(function(t){t.dependenciesState_===ve.POSSIBLY_STALE_?t.dependenciesState_=ve.STALE_:t.dependenciesState_===ve.UP_TO_DATE_&&(e.lowestObserverState_=ve.UP_TO_DATE_)}))}function bO(e){e.lowestObserverState_===ve.UP_TO_DATE_&&(e.lowestObserverState_=ve.POSSIBLY_STALE_,e.observers_.forEach(function(t){t.dependenciesState_===ve.UP_TO_DATE_&&(t.dependenciesState_=ve.POSSIBLY_STALE_,t.onBecomeStale_())}))}var xr=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_=ve.NOT_TRACKING_,this.runId_=0,this.unboundDepsCount_=0,this.flags_=0,this.isTracing_=yu.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,Z.pendingReactions.push(this),L1())},t.runReaction_=function(){if(!this.isDisposed){Xt(),this.isScheduled=!1;var r=Z.trackingContext;if(Z.trackingContext=this,kp(this)){this.isTrackPending=!0;try{this.onInvalidate_()}catch(s){this.reportExceptionInDerivation_(s)}}Z.trackingContext=r,Qt()}},t.track=function(r){if(!this.isDisposed){Xt(),this.isRunning=!0;var s=Z.trackingContext;Z.trackingContext=this;var i=C1(this,r,void 0);Z.trackingContext=s,this.isRunning=!1,this.isTrackPending=!1,this.isDisposed&&Np(this),Ec(i)&&this.reportExceptionInDerivation_(i.cause),Qt()}},t.reportExceptionInDerivation_=function(r){var s=this;if(this.errorHandler_){this.errorHandler_(r,this);return}if(Z.disableErrorBoundaries)throw r;var i="[mobx] uncaught error in '"+this+"'";Z.suppressReactionErrors||console.error(i,r),Z.globalReactionErrorHandlers.forEach(function(o){return o(r,s)})},t.dispose=function(){this.isDisposed||(this.isDisposed=!0,this.isRunning||(Xt(),Np(this),Qt()))},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[ae]=this,"dispose"in Symbol&&typeof Symbol.dispose=="symbol"&&(i[Symbol.dispose]=i),i},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(r){},co(e,[{key:"isDisposed",get:function(){return St(this.flags_,e.isDisposedMask_)},set:function(r){this.flags_=kt(this.flags_,e.isDisposedMask_,r)}},{key:"isScheduled",get:function(){return St(this.flags_,e.isScheduledMask_)},set:function(r){this.flags_=kt(this.flags_,e.isScheduledMask_,r)}},{key:"isTrackPending",get:function(){return St(this.flags_,e.isTrackPendingMask_)},set:function(r){this.flags_=kt(this.flags_,e.isTrackPendingMask_,r)}},{key:"isRunning",get:function(){return St(this.flags_,e.isRunningMask_)},set:function(r){this.flags_=kt(this.flags_,e.isRunningMask_,r)}},{key:"diffValue",get:function(){return St(this.flags_,e.diffValueMask_)?1:0},set:function(r){this.flags_=kt(this.flags_,e.diffValueMask_,r===1)}}])}();xr.isDisposedMask_=1;xr.isScheduledMask_=2;xr.isTrackPendingMask_=4;xr.isRunningMask_=8;xr.diffValueMask_=16;var jO=100,Ep=function(t){return t()};function L1(){Z.inBatch>0||Z.isRunningReactions||Ep(SO)}function SO(){Z.isRunningReactions=!0;for(var e=Z.pendingReactions,t=0;e.length>0;){++t===jO&&(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_()}Z.isRunningReactions=!1}var _u=Ws("Reaction",xr);function kO(e){var t=Ep;Ep=function(r){return e(function(){return t(r)})}}function ta(){return!1}function NO(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}}var $1="action",EO="action.bound",D1="autoAction",CO="autoAction.bound",z1="<unnamed action>",Cp=al($1),TO=al(EO,{bound:!0}),Tp=al(D1,{autoAction:!0}),PO=al(CO,{autoAction:!0,bound:!0});function F1(e){var t=function(r,s){if(bn(r))return Os(r.name||z1,r,e);if(bn(s))return Os(r,s,e);if(ol(s))return(e?Tp:Cp).decorate_20223_(r,s);if(Rs(s))return il(r,s,e?Tp:Cp);if(Rs(r))return Fn(al(e?D1:$1,{name:r,autoAction:e}))};return t}var oe=F1(!1);Object.assign(oe,Cp);var Pa=F1(!0);Object.assign(Pa,Tp);oe.bound=Fn(TO);Pa.bound=Fn(PO);function AO(e){return E1(e.name||z1,!1,e,this,void 0)}function Vi(e){return bn(e)&&e.isMobxAction===!0}function V1(e,t){var n,r,s,i;t===void 0&&(t=u1);var o=(n=(r=t)==null?void 0:r.name)!=null?n:"Autorun",l=!t.scheduler&&!t.delay,c;if(l)c=new xr(o,function(){this.track(f)},t.onError,t.requiresObservable);else{var u=IO(t),d=!1;c=new xr(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 RO=function(t){return t()};function IO(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:RO}var MO="onBO",OO="onBUO";function LO(e,t,n){return U1(MO,e,t,n)}function B1(e,t,n){return U1(OO,e,t,n)}function U1(e,t,n,r){var s=ju(t),i=bn(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 $O="never",Hl="always",DO="observed";function H1(e){e.isolateGlobalState===!0&&xO();var t=e.useProxies,n=e.enforceActions;if(t!==void 0&&(Z.useProxies=t===Hl?!0:t===$O?!1:typeof Proxy<"u"),t==="ifavailable"&&(Z.verifyProxies=!0),n!==void 0){var r=n===Hl?Hl:n===DO;Z.enforceActions=r,Z.allowStateChanges=!(r===!0||r===Hl)}["computedRequiresReaction","reactionRequiresObservable","observableRequiresReaction","disableErrorBoundaries","safeDescriptors"].forEach(function(s){s in e&&(Z[s]=!!e[s])}),Z.allowStateReads=!Z.observableRequiresReaction,e.reactionScheduler&&kO(e.reactionScheduler)}function zO(e,t,n,r){var s=wM(t);return Gs(function(){var i=uo(e,r)[ae];bd(s).forEach(function(o){i.extend_(o,s[o],n&&o in n?n[o]:!0)})}),e}function FO(e,t){return W1(ju(e,t))}function W1(e){var t={name:e.name_};return e.observing_&&e.observing_.length>0&&(t.dependencies=VO(e.observing_).map(W1)),t}function VO(e){return Array.from(new Set(e))}var BO=0,UO=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}Lg(t,e);var n=t.prototype;return n.toString=function(){return"Error: "+this.message},t}(bp(Error)),If=_1("flow"),HO=_1("flow.bound",{bound:!0}),Bi=Object.assign(function(t,n){if(ol(n))return If.decorate_20223_(t,n);if(Rs(n))return il(t,n,If);var r=t,s=r.name||"<unnamed flow>",i=function(){var l=this,c=arguments,u=++BO,d=oe(s+" - runid: "+u+" - init",r).apply(l,c),f,h=void 0,p=new Promise(function(g,x){var w=0;f=x;function v(b){h=void 0;var j;try{j=oe(s+" - runid: "+u+" - yield "+w++,d.next).call(d,b)}catch(S){return x(S)}m(j)}function y(b){h=void 0;var j;try{j=oe(s+" - runid: "+u+" - yield "+w++,d.throw).call(d,b)}catch(S){return x(S)}m(j)}function m(b){if(bn(b==null?void 0:b.then)){b.then(m,x);return}return b.done?g(b.value):(h=Promise.resolve(b.value),h.then(v,y))}v(void 0)});return p.cancel=oe(s+" - runid: "+u+" - cancel",function(){try{h&&Vx(h);var g=d.return(void 0),x=Promise.resolve(g.value);x.then(pi,pi),Vx(x),f(new UO)}catch(w){f(w)}}),p};return i.isMobXFlow=!0,i},If);Bi.bound=Fn(HO);function Vx(e){bn(e.cancel)&&e.cancel()}function Aa(e){return(e==null?void 0:e.isMobXFlow)===!0}function WO(e,t){return e?Ed(e)||!!e[ae]||$g(e)||_u(e)||kd(e):!1}function K1(e){return WO(e)}function tr(e,t){t===void 0&&(t=void 0),Xt();try{return e.apply(t)}finally{Qt()}}function Zs(e){return e[ae]}var KO={has:function(t,n){return Zs(t).has_(n)},get:function(t,n){return Zs(t).get_(n)},set:function(t,n,r){var s;return Rs(n)?(s=Zs(t).set_(n,r,!0))!=null?s:!0:!1},deleteProperty:function(t,n){var r;return Rs(n)?(r=Zs(t).delete_(n,!0))!=null?r:!0:!1},defineProperty:function(t,n,r){var s;return(s=Zs(t).defineProperty_(n,r))!=null?s:!0},ownKeys:function(t){return Zs(t).ownKeys_()},preventExtensions:function(t){pe(13)}};function qO(e,t){var n,r;return d1(),e=uo(e,t),(r=(n=e[ae]).proxy_)!=null?r:n.proxy_=new Proxy(e,KO)}function qt(e){return e.interceptors_!==void 0&&e.interceptors_.length>0}function ll(e,t){var n=e.interceptors_||(e.interceptors_=[]);return n.push(t),f1(function(){var r=n.indexOf(t);r!==-1&&n.splice(r,1)})}function Gt(e,t){var n=Ks();try{for(var r=[].concat(e.interceptors_||[]),s=0,i=r.length;s<i&&(t=r[s](t),t&&!t.type&&pe(14),!!t);s++);return t}finally{cr(n)}}function xn(e){return e.changeListeners_!==void 0&&e.changeListeners_.length>0}function cl(e,t){var n=e.changeListeners_||(e.changeListeners_=[]);return n.push(t),f1(function(){var r=n.indexOf(t);r!==-1&&n.splice(r,1)})}function _n(e,t){var n=Ks(),r=e.changeListeners_;if(r){r=r.slice();for(var s=0,i=r.length;s<i;s++)r[s](t);cr(n)}}function q1(e,t,n){return Gs(function(){var r,s=uo(e,n)[ae];(r=t)!=null||(t=CM(e)),bd(t).forEach(function(i){return s.make_(i,t[i])})}),e}var Bx="splice",Vn="update",GO=1e4,YO={get:function(t,n){var r=t[ae];return n===ae?r:n==="length"?r.getArrayLength_():typeof n=="string"&&!isNaN(n)?r.get_(parseInt(n)):lr(wu,n)?wu[n]:t[n]},set:function(t,n,r){var s=t[ae];return n==="length"&&s.setArrayLength_(r),typeof n=="symbol"||isNaN(n)?t[n]=r:s.set_(parseInt(n),r),!0},preventExtensions:function(){pe(15)}},Bg=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 ts(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 ll(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}),cl(this,r)},t.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},t.setArrayLength_=function(r){(typeof r!="number"||isNaN(r)||r<0)&&pe("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_&&pe(16),this.lastKnownLength_+=s,this.legacyMode_&&s>0&&ek(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=_p),qt(this)){var c=Gt(this,{object:this.proxy_,type:Bx,index:r,removedCount:s,added:i});if(!c)return _p;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<GO){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_&&ta(),l=xn(this),c=l||o?{observableKind:"array",object:this.proxy_,type:Vn,debugObjectName:this.atom_.name_,index:r,newValue:s,oldValue:i}:null;this.atom_.reportChanged(),l&&_n(this,c)},t.notifyArraySplice_=function(r,s,i){var o=!this.owned_&&ta(),l=xn(this),c=l||o?{observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:Bx,index:r,removed:i,added:s,removedCount:i.length,addedCount:s.length}:null;this.atom_.reportChanged(),l&&_n(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&&pe(17,r,i.length),r<i.length){this.atom_;var o=i[r];if(qt(this)){var l=Gt(this,{type:Vn,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 XO(e,t,n,r){return n===void 0&&(n="ObservableArray"),r===void 0&&(r=!1),d1(),Gs(function(){var s=new Bg(n,t,r,!1);p1(s.values_,ae,s);var i=new Proxy(s.values_,YO);return s.proxy_=i,e&&e.length&&s.spliceWithArray_(0,0,e),i})}var wu={clear:function(){return this.splice(0)},replace:function(t){var n=this[ae];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[ae];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[ae].spliceWithArray_(t,n,r)},push:function(){for(var t=this[ae],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[ae].values_.length-1,0),1)[0]},shift:function(){return this.splice(0,1)[0]},unshift:function(){for(var t=this[ae],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 Z.trackingDerivation&&pe(37,"reverse"),this.replace(this.slice().reverse()),this},sort:function(){Z.trackingDerivation&&pe(37,"sort");var t=this.slice();return t.sort.apply(t,arguments),this.replace(t),this},remove:function(t){var n=this[ae],r=n.dehanceValues_(n.values_).indexOf(t);return r>-1?(this.splice(r,1),!0):!1}};be("at",zt);be("concat",zt);be("flat",zt);be("includes",zt);be("indexOf",zt);be("join",zt);be("lastIndexOf",zt);be("slice",zt);be("toString",zt);be("toLocaleString",zt);be("toSorted",zt);be("toSpliced",zt);be("with",zt);be("every",Sn);be("filter",Sn);be("find",Sn);be("findIndex",Sn);be("findLast",Sn);be("findLastIndex",Sn);be("flatMap",Sn);be("forEach",Sn);be("map",Sn);be("some",Sn);be("toReversed",Sn);be("reduce",G1);be("reduceRight",G1);function be(e,t){typeof Array.prototype[e]=="function"&&(wu[e]=t(e))}function zt(e){return function(){var t=this[ae];t.atom_.reportObserved();var n=t.dehanceValues_(t.values_);return n[e].apply(n,arguments)}}function Sn(e){return function(t,n){var r=this,s=this[ae];s.atom_.reportObserved();var i=s.dehanceValues_(s.values_);return i[e](function(o,l){return t.call(n,o,l,r)})}}function G1(e){return function(){var t=this,n=this[ae];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 QO=Ws("ObservableArrayAdministration",Bg);function Nd(e){return _d(e)&&QO(e[ae])}var ZO={},$r="add",bu="delete",Y1=function(){function e(n,r,s){var i=this;r===void 0&&(r=Ms),s===void 0&&(s="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[ae]=ZO,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,bn(Map)||pe(18),Gs(function(){i.keysAtom_=y1("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(!Z.trackingDerivation)return this.has_(r);var i=this.hasMap_.get(r);if(!i){var o=i=new js(this.has_(r),jd,"ObservableMap.key?",!1);this.hasMap_.set(r,o),B1(o,function(){return s.hasMap_.delete(r)})}return i.get()},t.set=function(r,s){var i=this.has_(r);if(qt(this)){var o=Gt(this,{type:i?Vn:$r,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_,qt(this)){var i=Gt(this,{type:bu,object:this,name:r});if(!i)return!1}if(this.has_(r)){var o=ta(),l=xn(this),c=l||o?{observableKind:"map",debugObjectName:this.name_,type:bu,object:this,oldValue:this.data_.get(r).value_,name:r}:null;return tr(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&&_n(this,c),!0}return!1},t.updateValue_=function(r,s){var i=this.data_.get(r);if(s=i.prepareNewValue_(s),s!==Z.UNCHANGED){var o=ta(),l=xn(this),c=l||o?{observableKind:"map",debugObjectName:this.name_,type:Vn,object:this,oldValue:i.value_,name:r,newValue:s}:null;i.setNewValue_(s),l&&_n(this,c)}},t.addValue_=function(r,s){var i=this;this.keysAtom_,tr(function(){var u,d=new js(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=ta(),l=xn(this),c=l||o?{observableKind:"map",debugObjectName:this.name_,type:$r,object:this,name:r,newValue:s}:null;l&&_n(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 Ux({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 Ux({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=mi(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 qs(r)&&(r=new Map(r)),tr(function(){Yr(r)?_M(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)}):lo(r)?(xM(r)||pe(19,r),r.forEach(function(i,o){return s.set(o,i)})):r!=null&&pe(20,r)}),this},t.clear=function(){var r=this;tr(function(){T1(function(){for(var s=mi(r.keys()),i;!(i=s()).done;){var o=i.value;r.delete(o)}})})},t.replace=function(r){var s=this;return tr(function(){for(var i=JO(r),o=new Map,l=!1,c=mi(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=mi(i.entries()),g;!(g=p()).done;){var x=g.value,w=x[0],v=x[1],y=s.data_.has(w);if(s.set(w,v),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 b=s.data_.keys(),j=o.keys(),S=b.next(),k=j.next();!S.done;){if(S.value!==k.value){s.keysAtom_.reportChanged();break}S=b.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 cl(this,r)},t.intercept_=function(r){return ll(this,r)},co(e,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:Symbol.toStringTag,get:function(){return"Map"}}])}(),qs=Ws("ObservableMap",Y1);function Ux(e){return e[Symbol.toStringTag]="MapIterator",Hg(e)}function JO(e){if(lo(e)||qs(e))return e;if(Array.isArray(e))return new Map(e);if(Yr(e)){var t=new Map;for(var n in e)t.set(n,e[n]);return t}else return pe(21,e)}var eL={},X1=function(){function e(n,r,s){var i=this;r===void 0&&(r=Ms),s===void 0&&(s="ObservableSet"),this.name_=void 0,this[ae]=eL,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,bn(Set)||pe(22),this.enhancer_=function(o,l){return r(o,l,s)},Gs(function(){i.atom_=y1(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;tr(function(){T1(function(){for(var s=mi(r.data_.values()),i;!(i=s()).done;){var o=i.value;r.delete(o)}})})},t.forEach=function(r,s){for(var i=mi(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_,qt(this)){var i=Gt(this,{type:$r,object:this,newValue:r});if(!i)return this;r=i.newValue}if(!this.has(r)){tr(function(){s.data_.add(s.enhancer_(r,void 0)),s.atom_.reportChanged()});var o=!1,l=xn(this),c=l||o?{observableKind:"set",debugObjectName:this.name_,type:$r,object:this,newValue:r}:null;l&&_n(this,c)}return this},t.delete=function(r){var s=this;if(qt(this)){var i=Gt(this,{type:bu,object:this,oldValue:r});if(!i)return!1}if(this.has(r)){var o=!1,l=xn(this),c=l||o?{observableKind:"set",debugObjectName:this.name_,type:bu,object:this,oldValue:r}:null;return tr(function(){s.atom_.reportChanged(),s.data_.delete(r)}),l&&_n(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 Hx({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 Hx({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(Jn(r)&&!Mn(r))return r.intersection(this);var s=new Set(this);return s.intersection(r)},t.union=function(r){if(Jn(r)&&!Mn(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(Jn(r)&&!Mn(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(Jn(r)&&!Mn(r))return r.isDisjointFrom(this);var s=new Set(this);return s.isDisjointFrom(r)},t.replace=function(r){var s=this;return Mn(r)&&(r=new Set(r)),tr(function(){Array.isArray(r)?(s.clear(),r.forEach(function(i){return s.add(i)})):Jn(r)?(s.clear(),r.forEach(function(i){return s.add(i)})):r!=null&&pe("Cannot initialize set from "+r)}),this},t.observe_=function(r,s){return cl(this,r)},t.intercept_=function(r){return ll(this,r)},t.toJSON=function(){return Array.from(this)},t.toString=function(){return"[object ObservableSet]"},t[Symbol.iterator]=function(){return this.values()},co(e,[{key:"size",get:function(){return this.atom_.reportObserved(),this.data_.size}},{key:Symbol.toStringTag,get:function(){return"Set"}}])}(),Mn=Ws("ObservableSet",X1);function Hx(e){return e[Symbol.toStringTag]="SetIterator",Hg(e)}var Wx=Object.create(null),Kx="remove",Q1=function(){function e(n,r,s,i){r===void 0&&(r=new Map),i===void 0&&(i=ZM),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 ts("ObservableObject.keys"),this.isPlainObject_=Yr(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 Pt)return l.set(s),!0;if(qt(this)){var c=Gt(this,{type:Vn,object:this.proxy_||this.target_,name:r,newValue:s});if(!c)return null;s=c.newValue}if(s=l.prepareNewValue_(s),s!==Z.UNCHANGED){var u=xn(this),d=!1,f=u||d?{type:Vn,observableKind:"object",debugObjectName:this.name_,object:this.proxy_||this.target_,oldValue:l.value_,name:r,newValue:s}:null;l.setNewValue_(s),u&&_n(this,f)}return!0},t.get_=function(r){return Z.trackingDerivation&&!lr(this.target_,r)&&this.has_(r),this.target_[r]},t.set_=function(r,s,i){return i===void 0&&(i=!1),lr(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(!Z.trackingDerivation)return r in this.target_;this.pendingKeys_||(this.pendingKeys_=new Map);var s=this.pendingKeys_.get(r);return s||(s=new js(r in this.target_,jd,"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_[Ln])!=null&&i[r])return;pe(1,s.annotationType_,this.name_+"."+r.toString())}for(var o=this.target_;o&&o!==xd;){var l=mu(o,r);if(l){var c=s.make_(this,r,l,o);if(c===0)return;if(c===1)break}o=Object.getPrototypeOf(o)}Gx(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&&Gx(this,i,r),l},t.defineProperty_=function(r,s,i){i===void 0&&(i=!1),this.keysAtom_;try{Xt();var o=this.delete_(r);if(!o)return o;if(qt(this)){var l=Gt(this,{object:this.proxy_||this.target_,name:r,type:$r,newValue:s.value});if(!l)return null;var c=l.newValue;s.value!==c&&(s=Is({},s,{value:c}))}if(i){if(!Reflect.defineProperty(this.target_,r,s))return!1}else zn(this.target_,r,s);this.notifyPropertyAddition_(r,s.value)}finally{Qt()}return!0},t.defineObservableProperty_=function(r,s,i,o){o===void 0&&(o=!1),this.keysAtom_;try{Xt();var l=this.delete_(r);if(!l)return l;if(qt(this)){var c=Gt(this,{object:this.proxy_||this.target_,name:r,type:$r,newValue:s});if(!c)return null;s=c.newValue}var u=qx(r),d={configurable:Z.safeDescriptors?this.isPlainObject_:!0,enumerable:!0,get:u.get,set:u.set};if(o){if(!Reflect.defineProperty(this.target_,r,d))return!1}else zn(this.target_,r,d);var f=new js(s,i,"ObservableObject.key",!1);this.values_.set(r,f),this.notifyPropertyAddition_(r,f.value_)}finally{Qt()}return!0},t.defineComputedProperty_=function(r,s,i){i===void 0&&(i=!1),this.keysAtom_;try{Xt();var o=this.delete_(r);if(!o)return o;if(qt(this)){var l=Gt(this,{object:this.proxy_||this.target_,name:r,type:$r,newValue:void 0});if(!l)return null}s.name||(s.name="ObservableObject.key"),s.context=this.proxy_||this.target_;var c=qx(r),u={configurable:Z.safeDescriptors?this.isPlainObject_:!0,enumerable:!1,get:c.get,set:c.set};if(i){if(!Reflect.defineProperty(this.target_,r,u))return!1}else zn(this.target_,r,u);this.values_.set(r,new Pt(s)),this.notifyPropertyAddition_(r,void 0)}finally{Qt()}return!0},t.delete_=function(r,s){if(s===void 0&&(s=!1),this.keysAtom_,!lr(this.target_,r))return!0;if(qt(this)){var i=Gt(this,{object:this.proxy_||this.target_,name:r,type:Kx});if(!i)return null}try{var o;Xt();var l=xn(this),c=!1,u=this.values_.get(r),d=void 0;if(!u&&(l||c)){var f;d=(f=mu(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 js&&(d=u.value_),O1(u)),this.keysAtom_.reportChanged(),(o=this.pendingKeys_)==null||(o=o.get(r))==null||o.set(r in this.target_),l||c){var h={type:Kx,observableKind:"object",object:this.proxy_||this.target_,debugObjectName:this.name_,oldValue:d,name:r};l&&_n(this,h)}}finally{Qt()}return!0},t.observe_=function(r,s){return cl(this,r)},t.intercept_=function(r){return ll(this,r)},t.notifyPropertyAddition_=function(r,s){var i,o=xn(this),l=!1;if(o||l){var c=o||l?{type:$r,observableKind:"object",debugObjectName:this.name_,object:this.proxy_||this.target_,name:r,newValue:s}:null;o&&_n(this,c)}(i=this.pendingKeys_)==null||(i=i.get(r))==null||i.set(!0),this.keysAtom_.reportChanged()},t.ownKeys_=function(){return this.keysAtom_.reportObserved(),bd(this.target_)},t.keys_=function(){return this.keysAtom_.reportObserved(),Object.keys(this.target_)},e}();function uo(e,t){var n;if(lr(e,ae))return e;var r=(n=t==null?void 0:t.name)!=null?n:"ObservableObject",s=new Q1(e,new Map,String(r),cO(t));return wd(e,ae,s),e}var tL=Ws("ObservableObjectAdministration",Q1);function qx(e){return Wx[e]||(Wx[e]={get:function(){return this[ae].getObservablePropValue_(e)},set:function(n){return this[ae].setObservablePropValue_(e,n)}})}function Ed(e){return _d(e)?tL(e[ae]):!1}function Gx(e,t,n){var r;(r=e.target_[Ln])==null||delete r[n]}var nL=J1(0),rL=function(){var e=!1,t={};return Object.defineProperty(t,"0",{set:function(){e=!0}}),Object.create(t)[0]=1,e===!1}(),Mf=0,Z1=function(){};function sL(e,t){Object.setPrototypeOf?Object.setPrototypeOf(e.prototype,t):e.prototype.__proto__!==void 0?e.prototype.__proto__=t:e.prototype=t}sL(Z1,Array.prototype);var Ug=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,Gs(function(){var c=new Bg(i,s,o,!0);c.proxy_=l,p1(l,ae,c),r&&r.length&&l.spliceWithArray(0,0,r),rL&&Object.defineProperty(l,"0",nL)}),l}Lg(t,e);var n=t.prototype;return n.concat=function(){this[ae].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 Nd(l)?l.slice():l}))},n[Symbol.iterator]=function(){var r=this,s=0;return Hg({next:function(){return s<r.length?{value:r[s++],done:!1}:{done:!0,value:void 0}}})},co(t,[{key:"length",get:function(){return this[ae].getArrayLength_()},set:function(s){this[ae].setArrayLength_(s)}},{key:Symbol.toStringTag,get:function(){return"Array"}}])}(Z1);Object.entries(wu).forEach(function(e){var t=e[0],n=e[1];t!=="concat"&&wd(Ug.prototype,t,n)});function J1(e){return{enumerable:!1,configurable:!0,get:function(){return this[ae].get_(e)},set:function(n){this[ae].set_(e,n)}}}function iL(e){zn(Ug.prototype,""+e,J1(e))}function ek(e){if(e>Mf){for(var t=Mf;t<e+100;t++)iL(t);Mf=e}}ek(1e3);function oL(e,t,n){return new Ug(e,t,n)}function ju(e,t){if(typeof e=="object"&&e!==null){if(Nd(e))return t!==void 0&&pe(23),e[ae].atom_;if(Mn(e))return e.atom_;if(qs(e)){if(t===void 0)return e.keysAtom_;var n=e.data_.get(t)||e.hasMap_.get(t);return n||pe(25,t,Pp(e)),n}if(Ed(e)){var r,s;if(!t)return pe(26);var i=e[ae],o=(r=(s=i.values_.get(t))!=null?s:i.materializeLazyComputed_(t))!=null?r:i.materializeLazyObservable_(t);return o||pe(27,t,Pp(e)),o}if($g(e)||kd(e)||_u(e))return e}else if(bn(e)&&_u(e[ae]))return e[ae];pe(28)}function aL(e,t){if(e||pe(29),$g(e)||kd(e)||_u(e)||qs(e)||Mn(e))return e;if(e[ae])return e[ae];pe(24,e)}function Pp(e,t){var n;if(t!==void 0)n=ju(e,t);else{if(Vi(e))return e.name;Ed(e)||qs(e)||Mn(e)?n=aL(e):n=ju(e)}return n.name_}function Gs(e){var t=Ks(),n=zg(!0);Xt();try{return e()}finally{Qt(),Fg(n),cr(t)}}var Yx=xd.toString;function tk(e,t,n){return n===void 0&&(n=-1),Ap(e,t,n)}function Ap(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=Yx.call(e);if(o!==Yx.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=Xx(e),t=Xx(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&&!(bn(c)&&c instanceof c&&bn(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(!Ap(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 g=f[p];if(!(lr(t,g)&&Ap(e[g],t[g],n-1,r,s)))return!1}}return r.pop(),s.pop(),!0}function Xx(e){return Nd(e)?e.slice():lo(e)||qs(e)||Jn(e)||Mn(e)?Array.from(e.entries()):e}var Qx,lL=yd(),cL=((Qx=lL.Iterator)==null?void 0:Qx.prototype)||{};function Hg(e){return e[Symbol.iterator]=uL,Object.assign(Object.create(cL),e)}function uL(){return this}["Symbol","Map","Set"].forEach(function(e){var t=yd();typeof t[e]>"u"&&pe("MobX requires global '"+e+"' to be available or polyfilled")});typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__=="object"&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:NO,extras:{getDebugName:Pp},$mobx:ae});if(!_.useState)throw new Error("mobx-react-lite requires React with Hooks support");if(!q1)throw new Error("mobx-react-lite@3 requires mobx at least version 6 to be available");function dL(e){e()}function fL(e){e||(e=dL),H1({reactionScheduler:e})}function hL(e){return FO(e)}var pL=1e4,mL=1e4,gL=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=pL),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,mL))}}),e}(),vL=typeof FinalizationRegistry<"u"?FinalizationRegistry:gL,Rp=new vL(function(e){var t;(t=e.reaction)===null||t===void 0||t.dispose(),e.reaction=null}),nk={exports:{}},rk={};/**
|
|
54
|
-
* @license React
|
|
55
|
-
* use-sync-external-store-shim.production.js
|
|
56
|
-
*
|
|
57
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
58
|
-
*
|
|
59
|
-
* This source code is licensed under the MIT license found in the
|
|
60
|
-
* LICENSE file in the root directory of this source tree.
|
|
61
|
-
*/var Ui=_;function yL(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var xL=typeof Object.is=="function"?Object.is:yL,_L=Ui.useState,wL=Ui.useEffect,bL=Ui.useLayoutEffect,jL=Ui.useDebugValue;function SL(e,t){var n=t(),r=_L({inst:{value:n,getSnapshot:t}}),s=r[0].inst,i=r[1];return bL(function(){s.value=n,s.getSnapshot=t,Of(s)&&i({inst:s})},[e,n,t]),wL(function(){return Of(s)&&i({inst:s}),e(function(){Of(s)&&i({inst:s})})},[e]),jL(n),n}function Of(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!xL(e,n)}catch{return!0}}function kL(e,t){return t()}var NL=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?kL:SL;rk.useSyncExternalStore=Ui.useSyncExternalStore!==void 0?Ui.useSyncExternalStore:NL;nk.exports=rk;var sk=nk.exports;function Zx(e){e.reaction=new xr("observer".concat(e.name),function(){var t;e.stateVersion=Symbol(),(t=e.onStoreChange)===null||t===void 0||t.call(e)})}function EL(e,t){t===void 0&&(t="observed");var n=or.useRef(null);if(!n.current){var r={reaction:null,onStoreChange:null,stateVersion:Symbol(),name:t,subscribe:function(l){return Rp.unregister(r),r.onStoreChange=l,r.reaction||(Zx(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||(Zx(s),Rp.register(n,s,s)),or.useDebugValue(s.reaction,hL),sk.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 Lf,$f,ik=typeof Symbol=="function"&&Symbol.for,CL=($f=(Lf=Object.getOwnPropertyDescriptor(function(){},"name"))===null||Lf===void 0?void 0:Lf.configurable)!==null&&$f!==void 0?$f:!1,Jx=ik?Symbol.for("react.forward_ref"):typeof _.forwardRef=="function"&&_.forwardRef(function(e){return null}).$$typeof,e_=ik?Symbol.for("react.memo"):typeof _.memo=="function"&&_.memo(function(e){return null}).$$typeof;function ct(e,t){var n;if(e_&&e.$$typeof===e_)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(Jx&&e.$$typeof===Jx&&(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 EL(function(){return s(l,c)},i)};return o.displayName=e.displayName,CL&&Object.defineProperty(o,"name",{value:e.name,writable:!0,configurable:!0}),e.contextTypes&&(o.contextTypes=e.contextTypes),r&&(o=_.forwardRef(o)),o=_.memo(o),PL(e,o),o}var TL={$$typeof:!0,render:!0,compare:!0,type:!0,displayName:!0};function PL(e,t){Object.keys(e).forEach(function(n){TL[n]||Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(e,n))})}var Df;fL($S.unstable_batchedUpdates);Df=Rp.finalizeAllImmediately;const AL="local-app".toLowerCase();function RL(e,t){return e==="mock"||e==="app"||e==="local"?e:"local"}const ok=RL(AL),ge=ok!=="mock",it=ok==="app",IL={configuring:"正在生成项目配置",ready:"配置已完成",failed:"配置生成失败"},ML={clarify_probing:"Agent 正在判读需求,可能会提出澄清问题",clarify_awaiting:"等待确认需求澄清",clarify_failed:"需求澄清准备失败",precheck:"需求已确认,正在准备生成",generating:"正在生成工作流方案",validating:"正在校验流程方案",syncing_schema:"正在把字段与视图计划同步到配置",ready:"工作流设计完成",generate_failed:"工作流设计未通过"},OL={preflight:"正在加载配置与工作流模板",provisioning_table:"正在创建 AI 表格",syncing_schema:"正在创建字段和视图",auth_awaiting:"等待 AI 表格授权",ready:"AI 表格搭建完成",failed:"AI 表格搭建失败"},LL={starting:"正在启动运行服务",listening:"正在监听 AI 表格中的待处理记录",stopped:"运行服务已停止",failed:"运行启动失败",awaiting_machine:"已请求运行,等待执行机器认领",running_on_machine:"运行中"},$L={init:IL,design:ML,setup:OL,run:LL},us={init:"尚未开始配置",design:"尚未开始设计",setup:"尚未开始搭建",adjust:"尚未开始参数调整",test:"尚未开始试运行",run:"尚未开始运行"};function ak(e,t){const n=$L[e][t.phase]??t.phase;if("error"in t&&t.error)return t.error.message;if(e==="design"){const r=t;if(r.phase==="generating")return`第 ${r.round} 轮${r.isFix?"修正":"生成"}进行中`;if(r.phase==="validating")return r.errors.length>0?`第 ${r.round} 轮校验发现 ${r.errors.length} 个问题,准备修正`:`第 ${r.round} 轮校验通过`;if(r.phase==="ready")return`工作流设计完成(${r.rounds} 轮)`}if(e==="run"){const r=t;if(r.phase==="listening")return`${r.workflowName} 正在监听,${r.stepCount} 个步骤,间隔 ${Math.round(r.intervalMs/1e3)} 秒`;if(r.phase==="running_on_machine")return`运行中 · 执行机器 ${r.machineId}`;if(r.phase==="awaiting_machine"&&r.stalledSince)return"无可用执行机器认领本工作流,请检查 daemon 是否在线"}return n}const t_={"workflow.yml":"流程编排","aitable-workflow.config.yml":"运行配置","coding-agents.config.json":"执行引擎",".gitkeep":"目录占位"};function lk(e){return{label:DL(e.toolName,e.toolInput),detail:zL(e.toolName,e.toolInput,e.projectId)}}function DL(e,t){if(!e)return"处理生成进度";const n=e.toLowerCase();if(n==="bash")return FL(Ip(t));if(n.includes("write")||n.includes("edit")){const r=Cd(Ip(t));return r?r.name:"更新生成文件"}return n.includes("read")?"读取上下文":n.includes("mkdir")?"创建目录":n.includes("grep")||n.includes("search")?"检索项目内容":"执行生成动作"}function zL(e,t,n){const r=Ip(t);if((e==null?void 0:e.toLowerCase())==="bash"&&r)return VL(r,n);const s=r?Cd(r):null;return s?s.purpose:t?Wg(t.replace(/\s+/g," "),64):void 0}function Cd(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:t_[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/")?"步骤脚本":t_[i]??"项目文件";return{name:i,purpose:o}}function Wg(e,t){return e.length>t?`${e.slice(0,t-1)}…`:e}function FL(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 VL(e,t){const n=e.replace(/\s+/g," ").trim(),r=t?BL(n,t):null;if(r)return r;const s=Cd(n);return s?`${s.purpose} · ${s.name}`:`命令 · ${Wg(UL(n),72)}`}function Ip(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 BL(e,t){var i;const n=HL(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 UL(e){return e.replace(/\/Users\/[^/\s]+\/Documents\/Work\/code\/[^\s]+\/?/g,"").replace(/\/private\/var\/folders\/[^\s]+\/?/g,"").replace(/\/var\/folders\/[^\s]+\/?/g,"")}function HL(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}const WL=300,Su=200,KL=4e3;function ku(e,t=Su){return e.length>t?`${e.slice(0,t)}…`:e}function Mp(e,t=KL){return e.length>t?`${e.slice(0,t)}…`:e}function qL(e,t,n=WL){if(!t.length)return e;const r=[...e,...t];return r.length>n?r.slice(r.length-n):r}const n_=new Set(["askuserquestion","askuser","requestuserinput","requestapproval","humanconfirm","askhuman"]);function r_(e){return e.toLowerCase().replace(/[^a-z0-9]/g,"")}function GL(e){if(!e)return!1;if(n_.has(r_(e)))return!0;const t=e.split(".").at(-1);return t&&t!==e?n_.has(r_(t)):!1}function YL(e){if(e)try{const t=JSON.parse(e);return t&&typeof t=="object"&&!Array.isArray(t)?t:void 0}catch{return}}function XL(e){const t=e.toolInputRaw??YL(e.toolInput);let n,r;if(t){const u=Array.isArray(t.questions)?t.questions[0]:void 0,d=u&&typeof u=="object"?u:t,f=d.question??d.prompt??d.text??d.header;typeof f=="string"&&f.trim()&&(n=f.trim());const h=d.options??d.choices;Array.isArray(h)&&(r=h.map(p=>String(p&&typeof p=="object"?p.label??"":p)).map(p=>p.trim()).filter(Boolean))}const s=(e.toolInput??e.content??"").trim(),i=n??(s?ku(s):"Agent 请求人工输入"),o=r&&r.length?`${i}(选项:${r.join(" / ")})`:i,l=n&&s&&s!==n?s:void 0,c=l&&l.length>Su?Mp(l):void 0;return{text:ku(o),fullText:c}}function ck(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":{if(GL(e.toolName)){const{text:h,fullText:p}=XL(e);return p?{kind:"ask",text:h,toolName:e.toolName,round:t,fullText:p}:{kind:"ask",text:h,toolName:e.toolName,round:t}}const d=lk({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?`↩ ${ku(d)}`:f?`↩ ${f} 返回结果`:"↩ 工具返回结果",p=d&&d.length>Su?Mp(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} — ${ku(f)}`:h,g=f&&f.length>Su?Mp(f):void 0;return g?{kind:"permission",text:p,toolName:d,round:t,fullText:g}:{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 QL(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}const ZL={init:{configuring:!0,ready:!1,failed:!1},design:{clarify_probing:!0,clarify_awaiting:!0,clarify_failed:!1,precheck:!0,generating:!0,validating:!0,syncing_schema:!0,ready:!1,generate_failed:!1},setup:{preflight:!0,provisioning_table:!0,syncing_schema:!0,auth_awaiting:!0,ready:!1,failed:!1},run:{starting:!0,listening:!0,stopped:!1,failed:!1,awaiting_machine:!0,running_on_machine:!0}};function JL(e,t){const r=ZL[e][t.phase];if(r===void 0)throw new Error(`phase 未登记推进中/终态:${e}.${t.phase}`);return r}const e$=["precheck","generating","validating","syncing_schema"];function t$(e){return!!e&&e$.includes(e.phase)}function s_(e){return(e==null?void 0:e.phase)==="clarify_failed"||(e==null?void 0:e.phase)==="generate_failed"}function n$(e,t,n){return JL(t,n)?t:e===t?null:e}function r$(e,t){return e===void 0?!1:Array.isArray(e)?e.includes(t):typeof e=="boolean"?String(e)===t:e===t}function uk(e,t){return e.showIf?r$(t[e.showIf.questionId],e.showIf.hasValue):!0}function s$(e,t){return e.questions.filter(n=>uk(n,t))}function i$(e,t){var r;const n=[];for(const s of s$(e,t)){const i=t[s.id];if(s.required&&i_(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)&&!i_(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 i_(e){return e===void 0?!0:typeof e=="string"?e.trim()==="":Array.isArray(e)?e.length===0:!1}const o$=300;function a$(e,t,n={}){var s;const r=l$(n);if(t.type==="run.record.detected")return{records:c$(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:ds(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:Eo(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:ds(e.logs,t.itemId,t.stepId,i,`开始执行步骤:${t.stepName}`,r)}}return t.type==="run.step.succeeded"?{records:Eo(e.records,t.itemId,i=>({...i,doneStepIds:o_(i.doneStepIds,t.stepId),updatedAt:r.now()})),logs:zf(ds(e.logs,t.itemId,t.stepId,"ok",`步骤完成:${t.stepName}`,r),t.itemId,t.stepId,"info",t.logs,r)}:t.type==="run.step.failed"?{records:Eo(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:zf(ds(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:Eo(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:o_(i.doneStepIds,t.stepId),updatedAt:r.now()})),logs:zf(ds(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:Eo(e.records,t.itemId,i=>({...i,status:"done",currentStepId:null,updatedAt:r.now()})),logs:ds(e.logs,t.itemId,"run","ok","流程完成",r)}:e}function l$(e){return{now:e.now??Date.now,id:e.id??u$,maxLogs:e.maxLogs??o$}}function c$(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 Eo(e,t,n){return e.map(r=>r.id===t?n(r):r)}function o_(e,t){return e.includes(t)?e:[...e,t]}function ds(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 zf(e,t,n,r,s,i){return s!=null&&s.length?s.reduce((o,l)=>ds(o,t,n,r,l,i),e):e}function u$(){return`run_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,7)}`}function d$(e){var n,r;if(e.type==="error")return{kind:"status",text:`[setup] 错误: ${((r=(n=e.error)==null?void 0:n.message)==null?void 0:r.trim())||"未知错误"}`};if(e.type!=="stage.changed")return null;const t=e.stageState.state;return t.phase==="ready"?{kind:"status",text:"[setup] 完成",boundary:!0}:{kind:"status",text:`[setup] ${ak("setup",t)}`}}function f$(e){var t,n,r,s,i,o,l,c,u,d,f;switch(e.type){case"run.agent_event":{const h=e.kind==="tool_use"?{type:"tool_use",toolName:e.tool,toolInput:e.args}:{type:e.kind,toolName:e.tool,content:e.text};return ck(h,e.round)}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"stage.changed":return e.stageState.state.phase==="stopped"?{kind:"status",text:"[run] 停止",boundary:!0}:null;case"error":return{kind:"status",text:`[run] 错误: ${((f=(d=e.error)==null?void 0:d.message)==null?void 0:f.trim())||"未知错误"}`};default:return null}}const dk="";async function Kg(){return(await(await ce("/api/projects",{method:"POST"})).json()).project}async function h$(e,t){const n={};return e&&e.trim()&&(n.title=e.trim()),t&&t.length>0&&(n.files=t),await(await ce("/api/projects",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(n)})).json()}async function p$(e,t){const n=t&&t.trim()?`?title=${encodeURIComponent(t.trim())}`:"";return await(await ce(`/api/projects/import-zip${n}`,{method:"POST",headers:{"content-type":e.type||"application/zip"},body:e})).json()}async function m$(e){return await(await ce(`/api/projects/${e}`,{method:"DELETE"})).json()}async function g$(e){return await(await ce(`/api/projects/${e}/export`)).json()}async function v$(e){return await(await ce(`/api/projects/${e}/validate`,{method:"POST"})).json()}async function Op(e){return(await(await ce(`/api/projects/${e}/workflows`)).json()).workflows}async function y$(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 ce(`/api/projects/${e}/workflows`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(n)})).json()}async function fk(e,t){return await(await ce(`/api/projects/${e}/workflows/${t}`)).json()}async function x$(e,t){return await(await ce(`/api/projects/${e}/workflows/${t}`,{method:"DELETE"})).json()}async function hk(){await ce("/api/health")}async function _$(){return await(await ce("/api/agents")).json()}async function qg(){return(await(await ce("/api/projects")).json()).projects}async function w$(e,t){return(await(await ce(`/api/projects/${e}`,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({title:t})})).json()).project}async function Gg(e){return await(await ce(`/api/projects/${e}/state`)).json()}async function b$(e,t){return await(await ce(`/api/projects/${e}/init`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(t)})).json()}async function j$(e){return await(await ce(`/api/projects/${e}/design/discovery`,{method:"POST"})).json()}async function S$(e,t){return await(await ce(`/api/projects/${e}/design/discovery/confirm`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({answers:t})})).json()}async function Td(e,t){const n=t?`?workflowId=${encodeURIComponent(t)}`:"",s=await(await ce(`/api/projects/${e}/workflow${n}`)).json();return V$(s.workflow)}async function Yg(e){return(await(await ce(`/api/projects/${e}/files`)).json()).files}async function k$(e,t){await mk(`/api/projects/${e}/design`,t)}async function N$(e){return await(await ce(`/api/projects/${e}/design/events`)).json()}async function E$(e,t){await mk(`/api/projects/${e}/setup`,t)}async function C$(e,t,n){const r=`/api/projects/${e}/run`,s=await ce(r,{method:"POST",signal:n==null?void 0:n.signal,...n!=null&&n.runMode?{headers:{"content-type":"application/json"},body:JSON.stringify({runMode:n.runMode})}:{}});return I$(s)?{mode:"relay",schedule:(await s.json()).schedule}:(await gk(r,s,t,n),{mode:"local"})}async function T$(e){return await(await ce(`/api/projects/${e}/run/stop`,{method:"POST"})).json()}async function P$(e){return await(await ce(`/api/projects/${e}/run/status`)).json()}async function A$(e,t){return await(await ce(`/api/projects/${e}/run/records`)).json()}async function R$(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 ce(`/api/projects/${e}/run/events${r}`)).json()}function I$(e){return(e.headers.get("content-type")??"").includes("application/json")}async function M$(e,t,n){return(await(await ce(`/api/projects/${e}/run/records/${t}/human-action`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:n})})).json()).state}async function O$(){return(await(await ce("/api/machines")).json()).machines}async function Pc(e){return await(await ce(`/api/projects/${e}/engine`)).json()}async function pk(e,t){await ce(`/api/projects/${e}/engine`,{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify({machineId:t})})}async function L$(e){return await(await ce(`/api/projects/${e}/agents`)).json()}async function $$(e,t){return await(await ce(`/api/projects/${e}/agents`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(t)})).json()}async function ce(e,t){var r,s;let n;try{n=await fetch(`${dk}${e}`,t)}catch(i){const o=i instanceof Error?i.message:String(i);throw new Error(`无法连接真实后端服务(当前站点):${o}`)}if(!n.ok){const i=await n.text();if(n.status===401){let o;try{o=(r=JSON.parse(i).error)==null?void 0:r.loginUrl}catch{}if(o&&typeof window<"u")return window.location.href=o,new Promise(()=>{});throw new Error("登录已过期,请重新登录")}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 ${n.status}`)}return n}const D$=5,z$=500,F$=8e3;async function mk(e,t,n){const r=await ce(e,{method:"POST",signal:n==null?void 0:n.signal});await gk(e,r,t,n)}async function gk(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 ce(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 g=f.split(`
|
|
62
|
-
|
|
63
|
-
`);f=g.pop()??"";for(const x of g){const w=x.split(`
|
|
64
|
-
`),v=w.find(m=>m.startsWith("id: "));v&&(s=v.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>D$)throw u;const d=Math.min(F$,z$*2**(i-1));await new Promise(f=>setTimeout(f,d))}}}function V$(e){return{steps:e.steps.map(t=>({id:t.id,name:t.name,recipe:t.recipe??"",engine:B$(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 B$(e){return e==="claude"||e==="codex"||e==="qoder"||e==="qwenwork"||e==="llm_only"?e:"llm_only"}function U$(e){return{projectId:e,activeStage:null,stages:{},updatedAt:new Date().toISOString()}}function Xg(e,t){const n=e.projectState??U$(e.projectId);return{...n,activeStage:n$(n.activeStage,t.stage,t.stageState.state),stages:{...n.stages,[t.stage]:t.stageState},updatedAt:t.stageState.identity.updatedAt}}function H$(e,t){switch(t.type){case"stage.changed":return{projectState:Xg(e,t)};case"design.agent_event":return{live:{designAgentEvents:e.live.designAgentEvents+1,designLiveText:t.event.type==="tool_use"?`Agent 调用工具:${t.event.toolName??""}`.trim():"Agent 正在输出内容"}};case"design.files":return{files:t.files};case"error":return{live:{designLiveText:`真实设计中断:${t.error.message}`}};default:return{}}}function W$(e,t){switch(t.type){case"stage.changed":return{projectState:Xg(e,t)};default:return{}}}function K$(e,t){if(t.type==="stage.changed")return{projectState:Xg(e,t)};if(t.type==="error")return{live:{logs:vk(e.live.logs,yk("error",t.error.message))}};if(!tD(t))return{};const n=a$(nD(e),t,{stepLevel:r=>{var s,i;return(i=(s=e.steps)==null?void 0:s.find(o=>o.id===r))!=null&&i.requiresAgent?"ai":"info"}});return{live:rD(n)}}function q$(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??G$(n),currentStepId:n.currentStepId,doneStepIds:n.doneStepIds,createdAt:Date.parse(n.updatedAt)||Date.now()}))}}}function G$(e){return e.completedAt?"done":e.currentStepId?"running":"todo"}function Y$(e,t){const n=`evt_${t.seq}`;if(e.live.logs.some(c=>c.id===n))return{};const r=Date.parse(t.at)||Date.now(),s=t.itemId??"run",i=t.stepId??"run",o={id:n,ts:r,ticketId:s,stepId:i,level:Z$(t.type),text:J$(t)},l=X$(t.payload).map((c,u)=>({id:`${n}_log_${u}`,ts:r,ticketId:s,stepId:i,level:"info",text:c}));return{live:{logs:[...e.live.logs,o,...l]}}}function X$(e){return Array.isArray(e.logs)?e.logs.filter(t=>typeof t=="string"&&t.trim().length>0):[]}function Q$(e,t){return e.live.logs.some(n=>n.ticketId==="run"&&n.text===t)?{}:{live:{logs:vk(e.live.logs,yk("error",t))}}}function Z$(e){return e.endsWith("failed")?"error":e.endsWith("blocked")?"warn":e.endsWith("succeeded")||e.endsWith("completed")?"ok":"info"}function J$(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"工单已完成";case"run.agent_event":return eD(e);default:return e.type}}function eD(e){const t=typeof e.payload.kind=="string"?e.payload.kind:"",n=typeof e.payload.round=="number"?e.payload.round:null,r=typeof e.payload.tool=="string"?e.payload.tool:null,s=typeof e.payload.text=="string"?e.payload.text:typeof e.payload.args=="string"?e.payload.args:"",i=n!=null?`第${n}轮 `:"",o=t==="tool_use"?`${i}调用工具 ${r??""}`.trim():t==="tool_result"?`${i}工具返回`:t==="thinking"?`${i}思考`:t==="result"?"助手回答":`${i}${t}`.trim();if(!s)return o||e.type;const l=s.replace(/\s+/g," ").trim(),c=l.length>160?`${l.slice(0,160)}…`:l;return`${o}:${c}`}function tD(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 nD(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 rD(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 vk(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 yk(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 Wl(){return{designAgentEvents:0,designLiveText:"",tickets:[],logs:[]}}const sD={init:["ready"],design:["ready"],setup:["ready"],run:["stopped"]};function Ls(e,t){var n;return!!t&&(((n=sD[e])==null?void 0:n.includes(t))??!1)}const iD=["init","design","setup","adjust","test","run"];function oD(e){return typeof e=="string"&&iD.includes(e)}function a_(){return{init:{message:us.init},design:{message:us.design},setup:{message:us.setup},adjust:{message:us.adjust,local:!0},test:{message:us.test,local:!0},run:{message:us.run}}}const Qg=["init","design","setup","run"];function aD(e,t){if(!e)return{message:us[t]};const n=t,r="error"in e.state?e.state.error:void 0;return{phase:e.state.phase,taskId:e.identity.id,message:ak(n,e.state),retryable:(r==null?void 0:r.retryable)??e.next.kind==="await_user",error:r,next:e.next}}function fo(e){var r;const t=(r=e.projectState)==null?void 0:r.stages;if(!t)return a_();const n=a_();for(const s of Qg)n[s]=aD(t[s],s);return n}function xk(e){return e.files.some(t=>/(^|\/)workflow\.ya?ml$/i.test(t.path.replace(/\\/g,"/")))}function Lp(e){return xk(e)&&(!!e.workflow||e.files.some(t=>/(^|\/)workflows\/[^/]+\/workflow\.ya?ml$/i.test(t.path.replace(/\\/g,"/"))))}function Zg(e,t){var n;return((n=e==null?void 0:e.stages[t])==null?void 0:n.state)??null}function lD(e){return Zg(e.projectState,"design")}function Jg(e){return Zg(e.projectState,"setup")}function cD(e){return Zg(e.projectState,"run")}function uD(e,t,n){var s;return n!=="live"?{kind:"open"}:Ls("design",t.design.phase)||xk(e)||(((s=e.workflow)==null?void 0:s.steps.length)??0)>0?{kind:"open"}:{kind:"blocked",reason:"搭建阶段必须使用当前流程生成的 workflow 和 recipes,请先完成设计阶段。",backTo:"design"}}function _k(e,t,n){return t!=="live"||Ls("setup",e.setup.phase)?{kind:"open"}:{kind:"blocked",reason:n,backTo:"setup"}}function dD(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 wk(e){const t=Jg(e);return(t==null?void 0:t.phase)==="ready"?t.tableUrl:null}function fD(e){const t=Jg(e);return(t==null?void 0:t.phase)!=="ready"?{fields:[],views:[]}:{fields:t.schema.fields,views:t.schema.views}}function hD(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 Qg){const i=(r=t.stages[s])==null?void 0:r.identity;i&&(!n||i.updatedAt.localeCompare(n.updatedAt)>=0)&&(n={stage:s,updatedAt:i.updatedAt})}return(n==null?void 0:n.stage)??null}function bk(e,t="init"){const n=fo(e),r=jk(e);if(r)return r.stage;if(n.setup.phase==="auth_awaiting"||n.setup.phase==="failed")return"setup";const s=hD(e);return(s===null||s==="init")&&Lp(e)||s==="design"&&Ls("design",n.design.phase)&&Lp(e)?"setup":s??t}function jk(e){var n,r;const t=(n=e.projectState)==null?void 0:n.stages;if(!t)return null;for(const s of["design","setup","run"]){const i=(r=t[s])==null?void 0:r.next;if((i==null?void 0:i.kind)==="attach_stream")return{stage:s,endpoint:i.endpoint}}return null}function pD(e){var r,s;const t=(r=e.projectState)==null?void 0:r.stages;if(!t)return null;let n=null;for(const i of Qg){const o=(s=t[i])==null?void 0:s.next;(o==null?void 0:o.kind)==="poll"&&(n=n===null?o.intervalMs:Math.min(n,o.intervalMs))}return n}function mD(e,t){return e.phase==="loading"?{kind:"loading",projectId:e.projectId}:e.phase==="error"?{kind:"load_error",projectId:e.projectId,message:e.error??"项目加载失败"}:t.projectId?{kind:"ready"}:{kind:"no_project"}}function Sk(e){return{runtime:fo(e.snapshot).design,state:lD(e.snapshot),unsupported:e.mode!=="live",hasArtifacts:Lp(e.snapshot),agentEvents:e.live.designAgentEvents,liveText:e.live.designLiveText}}function kk(e){const t=fo(e.snapshot);return{runtime:t.setup,state:Jg(e.snapshot),gate:uD(e.snapshot,t,e.mode),schema:e.mode==="mock"&&e.mockSetup?{fields:e.mockSetup.fields,views:e.mockSetup.views}:fD(e.snapshot),tableUrl:e.mode==="mock"&&e.mockSetup?e.mockSetup.tableUrl:wk(e.snapshot)}}function gD(e){const t=fo(e.snapshot);return{runtime:t.test,gate:_k(t,e.mode,"试运行必须基于已搭建完成的 AI 表格,请先完成搭建阶段。")}}function vD(e){const t=fo(e.snapshot);return{runtime:t.run,state:cD(e.snapshot),gate:_k(t,e.mode,"正式运行必须基于已搭建完成的 AI 表格,请先完成搭建阶段。"),tickets:e.live.tickets,logs:e.live.logs}}function ms(){return{projectId:null,projects:[],files:[],projectState:null,workflow:null,workflows:[],currentWorkflowId:null,workflowFiles:[],engineBinding:null,init:null}}H1({enforceActions:"always",computedRequiresReaction:!1});const l_="aitable-workflow:shell-state:v3",yD=["aitable-workflow:shell-state:v2"],Ff={name:"",agentsSelected:[],selectedMachineId:"",tableConnected:!1,tableBaseId:"",tableId:"",llmProvider:"",llmModel:"",roles:[],sop:""};class xD{constructor(){ue(this,"theme","light");ue(this,"layout",{railCollapsed:!1,chatCollapsed:!1,chatWidth:460});ue(this,"projectSource","new");ue(this,"agentTraceOpen",!1);ue(this,"agentTraceLog",[]);ue(this,"initDraft",{...Ff});ue(this,"validation",{});ue(this,"stepStatus",{});ue(this,"mockSetup",{fields:[],views:[],tableUrl:null});ue(this,"mode",ge?"live":"mock");ue(this,"snapshot",ms());ue(this,"loading",{phase:"idle",projectId:null});ue(this,"live",Wl());q1(this,{theme:xe,layout:xe,projectSource:xe,agentTraceOpen:xe,agentTraceLog:xe.ref,initDraft:xe,validation:xe,stepStatus:xe,mockSetup:xe,snapshot:xe,loading:xe,live:xe,stageRuntime:er,stream:er,recommendedStage:er,steps:er,edges:er,toggleTheme:oe,setRailCollapsed:oe,setChatCollapsed:oe,setChatWidth:oe,setProjectSource:oe,setAgentTraceOpen:oe,toggleAgentTrace:oe,appendAgentTrace:oe,clearAgentTrace:oe,patchInitDraft:oe,setValidation:oe,setStepStatus:oe,addMockField:oe,addMockView:oe,setMockTableUrl:oe,addTicket:oe,updateTicket:oe,appendLog:oe,startNewWorkflow:oe,beginNewProject:oe,setEngineBinding:oe,reset:oe,beginLoad:oe,failLoad:oe,applyLoadedProject:oe,applySnapshotPatch:oe,applyServerFiles:oe,applyServerWorkflow:oe,setCurrentWorkflow:oe,setProjects:oe,setWorkflows:oe,clearProject:oe,patchLive:oe,applyDesignEvent:oe,applySetupEvent:oe,applyRunEvent:oe,applyRunRecords:oe,refreshProjectState:oe,appendRunTimelineEntry:oe,appendRunPollError:oe}),this.hydrateFromStorage(),this.installPersistence()}get stageRuntime(){return fo(this.snapshot)}get stream(){return jk(this.snapshot)}get pollIntervalMs(){return pD(this.snapshot)}get recommendedStage(){return bk(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:wk(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}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=qL(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={...ms(),projects:this.snapshot.projects,projectId:t},this.initDraft={...Ff,name:n},this.loading={phase:"ready",projectId:t}}startNewWorkflow(){this.initDraft={...Ff},this.live=Wl(),this.stepStatus={},this.mockSetup={fields:[],views:[],tableUrl:null},this.validation={},this.agentTraceLog=[],this.snapshot={...ms(),projects:this.snapshot.projects,projectId:this.snapshot.projectId}}reset(){this.projectSource="new",this.startNewWorkflow(),this.snapshot={...ms(),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={...Wl(),...t.live},this.stepStatus={},t.snapshot.init&&(this.initDraft=t.snapshot.init),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={...ms(),projects:t},this.live=Wl(),this.stepStatus={},this.loading={phase:"idle",projectId:null},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=>H$(r,n))}applySetupEvent(t,n){return this.applyReducerPatch(t,r=>W$(r,n))}applyRunEvent(t,n){return this.applyReducerPatch(t,r=>K$(r,n))}async refreshProjectState(t){if(this.snapshot.projectId!==t)return!1;const n=await Gg(t).catch(()=>null);return!n||this.snapshot.projectId!==t?!1:(this.snapshot={...this.snapshot,projectState:n},!0)}applyRunRecords(t,n){return this.applyReducerPatch(t,r=>q$(r,n))}appendRunTimelineEntry(t,n){return this.applyReducerPatch(t,r=>Y$(r,n))}appendRunPollError(t,n){return this.applyReducerPatch(t,r=>Q$(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=[l_,...yD].map(s=>window.localStorage.getItem(s)).find(s=>s!==null);if(!t)return;const n=JSON.parse(t);if(typeof n!="object"||n===null)return;const r=n;AO(()=>{(r.theme==="dark"||r.theme==="light")&&(this.theme=r.theme),typeof r.layout=="object"&&r.layout!==null&&(this.layout={...this.layout,...r.layout})})}catch{}}installPersistence(){typeof window>"u"||V1(()=>{const t={version:3,theme:this.theme,layout:this.layout};try{window.localStorage.setItem(l_,JSON.stringify(t))}catch{}})}}const V=new xD,_D={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 L({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:_D[e]})})}async function wD(){return await(await ce("/api/account/profile")).json()}let Co={user:null};const $p=new Set;function Vf(){for(const e of $p)e()}const Nu={get(){return Co},isLoggedIn(){return Co.user!==null},setUser(e){Co={user:e},Vf()},clear(){Co={user:null},Vf()},async loadProfile(){Co={user:(await wD()).user},Vf()},logout(){this.clear(),typeof window<"u"&&(window.location.href="/")},subscribe(e){return $p.add(e),()=>{$p.delete(e)}}},bD={user:null};function Nk(){return _.useSyncExternalStore(Nu.subscribe,()=>Nu.get(),()=>bD)}const jD=[{id:"init",label:"配置"},{id:"design",label:"设计"},{id:"setup",label:"搭建"},{id:"test",label:"试运行"},{id:"run",label:"运行"}],SD=[{id:"adjust",label:"参数调整"}],kD=ct(function({projectId:t}){const n=V.stageRuntime,r=V.projectSource,s=t?jD:SD;return a.jsx("nav",{className:"stepper","aria-label":"阶段进度",children:s.map((i,o)=>{const l=Ls(i.id,n[i.id].phase),c=r==="imported"&&(i.id==="init"||i.id==="design"||i.id==="setup"),u=a.jsx("span",{className:"stepper__num",children:l||c?a.jsx(L,{name:"check",size:12}):o+1}),d=l||c?" is-done":"",f=c?"已随包导入":void 0;return a.jsxs(_.Fragment,{children:[o>0&&a.jsx("span",{className:"stepper__sep"}),t?a.jsxs(a1,{to:`/p/${t}/${i.id}`,className:({isActive:h})=>"stepper__item"+(h?" is-active":"")+d,title:f,children:[u,i.label]}):a.jsxs("span",{className:"stepper__item is-active"+d,title:f,children:[u,i.label]})]},i.id)})})});function ND(e){return e?e!=="ready"&&e!=="generate_failed"&&e!=="clarify_failed":!1}function Ek(e){return e==="starting"||e==="listening"||e==="awaiting_machine"||e==="running_on_machine"}const ED=300,CD=80,TD=48;function PD(e){return e.scrollHeight-e.scrollTop-e.clientHeight<=TD}function AD({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(L,{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(L,{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(L,{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(L,{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(L,{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(L,{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(L,{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(L,{name:"dot",size:12}),a.jsx("span",{children:c.text})]},u);if(c.kind==="thinking"&&c.text.length>ED)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,CD)}…`}),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 RD=ct(function({onDesign:t=!1,onRun:n=!1}){const r=V.agentTraceOpen,s=V.agentTraceLog,i=_.useMemo(()=>QL(s),[s]),o=t?Sk({snapshot:V.snapshot,live:V.live,mode:V.mode}).state:null,l=ND(o==null?void 0:o.phase),c=n&&Ek(V.stageRuntime.run.phase),u=l||c,d=_.useRef(null),f=_.useRef(!0);_.useEffect(()=>{const p=d.current;!p||!f.current||(p.scrollTop=p.scrollHeight)},[i,r]);function h(){const p=d.current;p&&(f.current=PD(p))}return _.useEffect(()=>{if(!r)return;function p(g){g.key==="Escape"&&V.setAgentTraceOpen(!1)}return document.addEventListener("keydown",p),()=>document.removeEventListener("keydown",p)},[r]),r?a.jsx(AD,{groups:i,live:u,onClose:()=>V.setAgentTraceOpen(!1),bodyRef:d,onScroll:h}):null}),ID={init:"一次性配置",design:"工作流设计",setup:"AI 表格搭建",adjust:"参数调整",test:"试运行",run:"运行监控"};function Ck({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:ID[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 c_({message:e,onRetry:t,title:n="项目加载失败",subtitle:r="服务端状态未取到"}){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:n}),a.jsx("div",{className:"work-head__sub",children:r})]})}),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(L,{name:"play",size:14,color:"#fff"}),"重试"]})})]})})]})})}let Hi=null;const ev="aitable-workflow-dev-token";function MD(e){try{localStorage.setItem(ev,e)}catch{}}function OD(){try{return localStorage.getItem(ev)}catch{return null}}function LD(e){if(Hi=e,e)MD(e);else try{localStorage.removeItem(ev)}catch{}}function $D(){return Hi!==null}function Tk(){const t=new URLSearchParams(window.location.search).get("token");if(t){LD(t);const n=new URL(window.location.href);n.searchParams.delete("token"),window.history.replaceState({},"",n.toString())}else if(!Hi){const n=OD();n&&(Hi=n)}return $D()}async function Ce(e,t){if(!Hi)throw new Error("Dev token not set");const n=await fetch(e,{...t,headers:{...t==null?void 0:t.headers,Authorization:`Bearer ${Hi}`}});if(!n.ok){const r=await n.text();try{const s=JSON.parse(r),i=s.error??s.message;if(i)throw new Error(i)}catch(s){if(s instanceof Error&&s.message!==r)throw s}throw new Error(r||`HTTP ${n.status}`)}return n}async function Dp(e){return await(await Ce("/dev/config/save",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({updates:e})})).json()}async function Pk(){await Ce("/dev/setup/complete",{method:"POST"})}async function u_(){return await(await Ce("/dev/setup/progress")).json()}async function DD(e,t){return await(await Ce("/dev/kb/upload",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({roleId:e,files:t})})).json()}async function zD(e,t){return await(await Ce("/dev/kb/ingest",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({roleId:e,source:t})})).json()}async function Ak(){return await(await Ce("/dev/config/enriched")).json()}async function FD(e){return await(await Ce(`/dev/file/read?path=${encodeURIComponent(e)}`)).json()}async function VD(e,t){return await(await Ce("/dev/file/write",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:e,content:t})})).json()}async function d_(){return await(await Ce("/dev/setup/artifacts")).json()}async function BD(){return await(await Ce("/dev/console/state")).json()}async function zp(){return await(await Ce("/dev/console/mode")).json()}async function UD(){return await(await Ce("/dev/console/promote",{method:"POST"})).json()}async function f_(){return await(await Ce("/dev/console/dws-auth")).json()}async function HD(){return await(await Ce("/dev/console/dws-auth/login",{method:"POST"})).json()}async function WD(){return await(await Ce("/dev/console/dws-auth/login")).json()}async function KD(){return await(await Ce("/dev/console/admin-groups")).json()}async function qD(e){return await(await Ce(`/dev/console/groups/${encodeURIComponent(e.conversationId)}/add-enterprise-bot`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:e.title,groupType:e.groupType})})).json()}async function Rk(e){return await(await Ce(`/dev/console/groups/${encodeURIComponent(e.conversationId)}/custom-bot`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:e.title,groupType:e.groupType,name:e.name,webhook:e.webhook,secret:e.secret})})).json()}async function Ik(){return await(await Ce("/dev/console/group-config-table")).json()}async function GD(){return await(await Ce("/dev/console/group-config-table/flush-staging",{method:"POST"})).json()}async function h_(e,t){return await(await Ce(`/dev/console/group-config-table/${encodeURIComponent(e)}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})).json()}async function YD(e,t){return await(await Ce("/dev/kb/official",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({roleId:e,enabled:t})})).json()}async function XD(){return await(await Ce("/dev/run/status")).json()}const QD={start:"/dev/run/start",stop:"/dev/run/stop"};async function ZD(e){return await(await Ce(QD[e],{method:"POST"})).json()}async function JD(e){return await(await Ce("/dev/workflow/trigger-once",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workflowId:e})})).json()}function e3(){const e=Nk(),[t,n]=_.useState(!1),r=_.useRef(null);return _.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(L,{name:"user",size:15}),a.jsx("span",{className:"user-menu__name",children:e.user.username}),a.jsx(L,{name:"chevron-down",size:12})]}),t&&a.jsxs("div",{className:"user-menu__dropdown",children:[a.jsxs(ze,{className:"user-menu__item",to:"/account",onClick:()=>n(!1),children:[a.jsx(L,{name:"user",size:14}),"用户中心"]}),a.jsxs(ze,{className:"user-menu__item",to:"/engines",onClick:()=>n(!1),children:[a.jsx(L,{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:()=>{Nu.logout(),n(!1)},children:[a.jsx(L,{name:"close",size:14}),"退出登录"]})]})]})}const t3=ct(function(){const[t]=_.useState(()=>Tk()),[n,r]=_.useState(it&&!t),s=V.theme;_.useEffect(()=>{if(!it||t){r(!1);return}let d=!1;return Nu.loadProfile().then(()=>{d||r(!1)}).catch(()=>{d||r(!1)}),()=>{d=!0}},[t]);const i=$o({path:"/p/:projectId",end:!1}),o=$o("/setup"),l=!!i||!!o,c=$o("/p/:projectId/design"),u=$o("/p/:projectId/run");return n?a.jsx(Ck,{stage:"init"}):a.jsxs("div",{className:"app-root",children:[a.jsxs("header",{className:"chrome",children:[a.jsxs(ze,{className:"chrome__brand",to:"/",title:"返回首页",children:[a.jsx("span",{className:"chrome__brand-mark",children:a.jsx(L,{name:"sparkle",size:15,color:"#fff"})}),"aitable-workflow"]}),l&&a.jsx(kD,{projectId:i==null?void 0:i.params.projectId}),a.jsx("div",{className:"chrome__spacer"}),a.jsx("button",{type:"button",className:"chrome__theme",onClick:()=>V.toggleTheme(),title:s==="light"?"切换到暗色":"切换到亮色","aria-label":"切换主题",children:a.jsx(L,{name:s==="light"?"moon":"sun",size:17})}),a.jsx(e3,{})]}),a.jsx(i1,{}),a.jsx(RD,{onDesign:!!c,onRun:!!u})]})});async function Mk(e,t){const n=await Op(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 fk(e,r)).files}catch{}return{workflows:n,currentWorkflowId:r,workflowFiles:s}}function n3(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=An(t,"name")??"",r=An(t,"default_base_id")??An(t,"base_id"),s=An(t,"table_id")??"",i=An(t,"provider"),o=An(t,"model"),l=An(t,"engine"),c=s3(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:r3(e),sop:c}}function r3(e){return e.filter(t=>t.path.startsWith("roles/")&&t.path.endsWith(".role.yml")&&t.content).map(t=>{const n=An(t.content,"id")??"",r=An(t.content,"name")??"",s=An(t.content,"persona")??"";return{id:n,name:r,persona:s,skills:[],knowledge:[]}}).filter(t=>t.id&&t.name)}function An(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 s3(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(`
|
|
65
|
-
`).map(i=>i.replace(/^ /,"")).join(`
|
|
66
|
-
`).trim()||null}async function Eu(e){if(!ge)return;const t=Bf.get(e);if(t)return t;const n=i3(e).finally(()=>{Bf.delete(e)});return Bf.set(e,n),n}const Bf=new Map;async function i3(e){V.beginLoad(e);try{await hk();const t=await qg();if(!t.some(r=>r.id===e)){V.clearProject(t);return}const n=await o3(e,t);V.applyLoadedProject({snapshot:n,live:dD(n)})}catch(t){V.failLoad(e,t instanceof Error?t.message:String(t))}}async function Wi(e){if(!ge)return null;const t=await Gg(e).catch(()=>null);return t&&V.applySnapshotPatch(e,{projectState:t})?t:null}async function o3(e,t){const n=await Yg(e),r=await Gg(e).catch(()=>null),s=await Mk(e,null).catch(()=>({workflows:[],currentWorkflowId:null,workflowFiles:[]})),i=n.some(c=>c.path==="workflow.yml"||c.path.endsWith("/workflow.yml"))?await Td(e,s.currentWorkflowId).catch(()=>null):null,o=it?await Pc(e).catch(()=>null):null,l=n3(n);return l&&(o!=null&&o.machineId)&&(l.selectedMachineId=o.machineId),{...ms(),projectId:e,projects:t,files:n,projectState:r,workflow:i,workflows:s.workflows,currentWorkflowId:s.currentWorkflowId,workflowFiles:s.workflowFiles,engineBinding:o,init:l}}function a3(){var t;const[e]=Og();return e.get("w")??((t=V.workflows[0])==null?void 0:t.id)??null}function l3(){const e=V.projectId,t=V.pollIntervalMs;_.useEffect(()=>{if(V.mode!=="live"||!e||t===null)return;let n=!1,r;const s=async()=>{await Wi(e).catch(()=>{}),n||(r=setTimeout(()=>void s(),t))};return r=setTimeout(()=>void s(),t),()=>{n=!0,r!==void 0&&clearTimeout(r)}},[e,t])}function Ok({onConfirm:e,onCancel:t}){const[n,r]=_.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(L,{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 p_={},c3=function(e,t,n,r,s){var i=new Worker(p_[t]||(p_[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},Ae=Uint8Array,dt=Uint16Array,ul=Int32Array,ho=new Ae([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]),po=new Ae([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]),Ra=new Ae([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Lk=function(e,t){for(var n=new dt(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];for(var s=new ul(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}},$k=Lk(ho,2),tv=$k.b,Cu=$k.r;tv[28]=258,Cu[258]=28;var Dk=Lk(po,0),zk=Dk.b,Fp=Dk.r,Ia=new dt(32768);for(var Se=0;Se<32768;++Se){var Nr=(Se&43690)>>1|(Se&21845)<<1;Nr=(Nr&52428)>>2|(Nr&13107)<<2,Nr=(Nr&61680)>>4|(Nr&3855)<<4,Ia[Se]=((Nr&65280)>>8|(Nr&255)<<8)>>1}var Jt=function(e,t,n){for(var r=e.length,s=0,i=new dt(t);s<r;++s)e[s]&&++i[e[s]-1];var o=new dt(t);for(s=1;s<t;++s)o[s]=o[s-1]+i[s-1]<<1;var l;if(n){l=new dt(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[Ia[f]>>c]=u}else for(l=new dt(r),s=0;s<r;++s)e[s]&&(l[s]=Ia[o[e[s]-1]++]>>15-e[s]);return l},_r=new Ae(288);for(var Se=0;Se<144;++Se)_r[Se]=8;for(var Se=144;Se<256;++Se)_r[Se]=9;for(var Se=256;Se<280;++Se)_r[Se]=7;for(var Se=280;Se<288;++Se)_r[Se]=8;var Ki=new Ae(32);for(var Se=0;Se<32;++Se)Ki[Se]=5;var Fk=Jt(_r,9,0),Vk=Jt(_r,9,1),Bk=Jt(Ki,5,0),Uk=Jt(Ki,5,1),Ac=function(e){for(var t=e[0],n=1;n<e.length;++n)e[n]>t&&(t=e[n]);return t},Bt=function(e,t,n){var r=t/8|0;return(e[r]|e[r+1]<<8)>>(t&7)&n},Rc=function(e,t){var n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(t&7)},dl=function(e){return(e+7)/8|0},Ys=function(e,t,n){return(t==null||t<0)&&(t=0),(n==null||n>e.length)&&(n=e.length),new Ae(e.subarray(t,n))},Hk=["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"],Ve=function(e,t,n){var r=new Error(t||Hk[e]);if(r.code=e,Error.captureStackTrace&&Error.captureStackTrace(r,Ve),!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 Ae(0);var o=!n,l=o||t.i!=2,c=t.i;o&&(n=new Ae(s*3));var u=function(ne){var Y=n.length;if(ne>Y){var J=new Ae(Math.max(Y*2,ne));J.set(n),n=J}},d=t.f||0,f=t.p||0,h=t.b||0,p=t.l,g=t.d,x=t.m,w=t.n,v=s*8;do{if(!p){d=Bt(e,f,1);var y=Bt(e,f+1,3);if(f+=3,y)if(y==1)p=Vk,g=Uk,x=9,w=5;else if(y==2){var S=Bt(e,f,31)+257,k=Bt(e,f+10,15)+4,N=S+Bt(e,f+5,31)+1;f+=14;for(var A=new Ae(N),O=new Ae(19),D=0;D<k;++D)O[Ra[D]]=Bt(e,f+D*3,7);f+=k*3;for(var I=Ac(O),z=(1<<I)-1,T=Jt(O,I,1),D=0;D<N;){var E=T[Bt(e,f,z)];f+=E&15;var m=E>>4;if(m<16)A[D++]=m;else{var P=0,C=0;for(m==16?(C=3+Bt(e,f,3),f+=2,P=A[D-1]):m==17?(C=3+Bt(e,f,7),f+=3):m==18&&(C=11+Bt(e,f,127),f+=7);C--;)A[D++]=P}}var R=A.subarray(0,S),M=A.subarray(S);x=Ac(R),w=Ac(M),p=Jt(R,x,1),g=Jt(M,w,1)}else Ve(1);else{var m=dl(f)+4,b=e[m-4]|e[m-3]<<8,j=m+b;if(j>s){c&&Ve(0);break}l&&u(h+b),n.set(e.subarray(m,j),h),t.b=h+=b,t.p=f=j*8,t.f=d;continue}if(f>v){c&&Ve(0);break}}l&&u(h+131072);for(var B=(1<<x)-1,$=(1<<w)-1,F=f;;F=f){var P=p[Rc(e,f)&B],H=P>>4;if(f+=P&15,f>v){c&&Ve(0);break}if(P||Ve(2),H<256)n[h++]=H;else if(H==256){F=f,p=null;break}else{var W=H-254;if(H>264){var D=H-257,U=ho[D];W=Bt(e,f,(1<<U)-1)+tv[D],f+=U}var q=g[Rc(e,f)&$],Q=q>>4;q||Ve(3),f+=q&15;var M=zk[Q];if(Q>3){var U=po[Q];M+=Rc(e,f)&(1<<U)-1,f+=U}if(f>v){c&&Ve(0);break}l&&u(h+131072);var K=h+W;if(h<M){var G=i-M,te=Math.min(M,K);for(G+h<0&&Ve(3);h<te;++h)n[h]=r[G+h]}for(;h<K;++h)n[h]=n[h-M]}}t.l=p,t.p=F,t.b=h,t.f=d,p&&(d=1,t.m=x,t.d=g,t.n=w)}while(!d);return h!=n.length&&o?Ys(n,0,h):n.subarray(0,h)},Tn=function(e,t,n){n<<=t&7;var r=t/8|0;e[r]|=n,e[r+1]|=n>>8},ei=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},Ic=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:rv,l:0};if(s==1){var o=new Ae(n[0].s+1);return o[n[0].s]=1,{t:o,l:1}}n.sort(function(j,S){return j.f-S.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 dt(h+1),g=Tu(n[d-1],p,0);if(g>t){var r=0,x=0,w=g-t,v=1<<w;for(i.sort(function(S,k){return p[k.s]-p[S.s]||S.f-k.f});r<s;++r){var y=i[r].s;if(p[y]>t)x+=v-(1<<g-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 b=i[r].s;p[b]==t&&(--p[b],++x)}g=t}return{t:new Ae(p),l:g}},Tu=function(e,t,n){return e.s==-1?Math.max(Tu(e.l,t,n+1),Tu(e.r,t,n+1)):t[e.s]=n},Vp=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new dt(++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}},ti=function(e,t){for(var n=0,r=0;r<t.length;++r)n+=e[r]*t[r];return n},nv=function(e,t,n){var r=n.length,s=dl(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},Bp=function(e,t,n,r,s,i,o,l,c,u,d){Tn(t,d++,n),++s[256];for(var f=Ic(s,15),h=f.t,p=f.l,g=Ic(i,15),x=g.t,w=g.l,v=Vp(h),y=v.c,m=v.n,b=Vp(x),j=b.c,S=b.n,k=new dt(19),N=0;N<y.length;++N)++k[y[N]&31];for(var N=0;N<j.length;++N)++k[j[N]&31];for(var A=Ic(k,7),O=A.t,D=A.l,I=19;I>4&&!O[Ra[I-1]];--I);var z=u+5<<3,T=ti(s,_r)+ti(i,Ki)+o,E=ti(s,h)+ti(i,x)+o+14+3*I+ti(k,O)+2*k[16]+3*k[17]+7*k[18];if(c>=0&&z<=T&&z<=E)return nv(t,d,e.subarray(c,c+u));var P,C,R,M;if(Tn(t,d,1+(E<T)),d+=2,E<T){P=Jt(h,p,0),C=h,R=Jt(x,w,0),M=x;var B=Jt(O,D,0);Tn(t,d,m-257),Tn(t,d+5,S-1),Tn(t,d+10,I-4),d+=14;for(var N=0;N<I;++N)Tn(t,d+3*N,O[Ra[N]]);d+=3*I;for(var $=[y,j],F=0;F<2;++F)for(var H=$[F],N=0;N<H.length;++N){var W=H[N]&31;Tn(t,d,B[W]),d+=O[W],W>15&&(Tn(t,d,H[N]>>5&127),d+=H[N]>>12)}}else P=Fk,C=_r,R=Bk,M=Ki;for(var N=0;N<l;++N){var U=r[N];if(U>255){var W=U>>18&31;ei(t,d,P[W+257]),d+=C[W+257],W>7&&(Tn(t,d,U>>23&31),d+=ho[W]);var q=U&31;ei(t,d,R[q]),d+=M[q],q>3&&(ei(t,d,U>>5&8191),d+=po[q])}else ei(t,d,P[U]),d+=C[U]}return ei(t,d,P[256]),d+C[256]},Kk=new ul([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),rv=new Ae(0),qk=function(e,t,n,r,s,i){var o=i.z||e.length,l=new Ae(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=Kk[t-1],h=f>>13,p=f&8191,g=(1<<n)-1,x=i.p||new dt(32768),w=i.h||new dt(g+1),v=Math.ceil(n/3),y=2*v,m=function(se){return(e[se]^e[se+1]<<v^e[se+2]<<y)&g},b=new ul(25e3),j=new dt(288),S=new dt(32),k=0,N=0,A=i.i||0,O=0,D=i.w||0,I=0;A+2<o;++A){var z=m(A),T=A&32767,E=w[z];if(x[T]=E,w[z]=T,D<=A){var P=o-A;if((k>7e3||O>24576)&&(P>423||!u)){d=Bp(e,c,0,b,j,S,N,O,I,A-I,d),O=k=N=0,I=A;for(var C=0;C<286;++C)j[C]=0;for(var C=0;C<30;++C)S[C]=0}var R=2,M=0,B=p,$=T-E&32767;if(P>2&&z==m(A-$))for(var F=Math.min(h,P)-1,H=Math.min(32767,A),W=Math.min(258,P);$<=H&&--B&&T!=E;){if(e[A+R]==e[A+R-$]){for(var U=0;U<W&&e[A+U]==e[A+U-$];++U);if(U>R){if(R=U,M=$,U>F)break;for(var q=Math.min($,U-2),Q=0,C=0;C<q;++C){var K=A-$+C&32767,G=x[K],te=K-G&32767;te>Q&&(Q=te,E=K)}}}T=E,E=x[T],$+=T-E&32767}if(M){b[O++]=268435456|Cu[R]<<18|Fp[M];var ne=Cu[R]&31,Y=Fp[M]&31;N+=ho[ne]+po[Y],++j[257+ne],++S[Y],D=A+R,++k}else b[O++]=e[A],++j[e[A]]}}for(A=Math.max(A,D);A<o;++A)b[O++]=e[A],++j[e[A]];d=Bp(e,c,u,b,j,S,N,O,I,A-I,d),u||(i.r=d&7|c[d/8|0]<<3,d-=7,i.h=w,i.p=x,i.i=A,i.w=D)}else{for(var A=i.w||0;A<o+u;A+=65535){var J=A+65535;J>=o&&(c[d/8|0]=u,J=o),d=nv(c,d+1,e.subarray(A,J))}i.i=o}return Ys(l,0,r+dl(d)+s)},u3=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}(),d3=function(){var e=-1;return{p:function(t){for(var n=e,r=0;r<t.length;++r)n=u3[n&255^t[r]]^n>>>8;e=n},d:function(){return~e}}},Gk=function(e,t,n,r,s){if(!s&&(s={l:1},t.dictionary)){var i=t.dictionary.subarray(-32768),o=new Ae(i.length+e.length);o.set(i),o.set(e,i.length),e=o,s.w=i.length}return qk(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)},sv=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},m_=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},Kl=[],f3=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},h3=function(e,t,n,r){if(!Kl[n]){for(var s="",i={},o=e.length-1,l=0;l<o;++l)s=m_(e[l],s,i);Kl[n]={c:m_(e[o],s,i),e:i}}var c=sv({},Kl[n].e);return c3(Kl[n].c+";onmessage=function(e){for(var k in e.data)self[k]=e.data[k];onmessage="+t.toString()+"}",n,c,f3(c),r)},p3=function(){return[Ae,dt,ul,ho,po,Ra,tv,zk,Vk,Uk,Ia,Hk,Jt,Ac,Bt,Rc,dl,Ys,Ve,Wk,ov,Pd,Yk]},m3=function(){return[Ae,dt,ul,ho,po,Ra,Cu,Fp,Fk,_r,Bk,Ki,Ia,Kk,rv,Jt,Tn,ei,Ic,Tu,Vp,ti,nv,Bp,dl,Ys,qk,Gk,iv,Pd]},Pd=function(e){return postMessage(e,[e.buffer])},Yk=function(e){return e&&{out:e.size&&new Ae(e.size),dictionary:e.dictionary}},Xk=function(e,t,n,r,s,i){var o=h3(n,r,s,function(l,c){o.terminate(),i(l,c)});return o.postMessage([e,t],t.consume?[e.buffer]:[]),function(){o.terminate()}},On=function(e,t){return e[t]|e[t+1]<<8},Ht=function(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0},Uf=function(e,t){return Ht(e,t)+Ht(e,t+4)*4294967296},Xe=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8};function g3(e,t,n){return n||(n=t,t={}),typeof n!="function"&&Ve(7),Xk(e,t,[m3],function(r){return Pd(iv(r.data[0],r.data[1]))},0,n)}function iv(e,t){return Gk(e,t||{},0,0)}function v3(e,t,n){return n||(n=t,t={}),typeof n!="function"&&Ve(7),Xk(e,t,[p3],function(r){return Pd(ov(r.data[0],Yk(r.data[1])))},1,n)}function ov(e,t){return Wk(e,{i:2},t&&t.out,t&&t.dictionary)}var Qk=function(e,t,n,r){for(var s in e){var i=e[s],o=t+s,l=r;Array.isArray(i)&&(l=sv(r,i[1]),i=i[0]),ArrayBuffer.isView(i)?n[o]=[i,l]:(n[o+="/"]=[new Ae(0),l],Qk(i,o,n,r))}},g_=typeof TextEncoder<"u"&&new TextEncoder,Up=typeof TextDecoder<"u"&&new TextDecoder,y3=0;try{Up.decode(rv,{stream:!0}),y3=1}catch{}var x3=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:Ys(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 Hp(e,t){var n;if(g_)return g_.encode(e);for(var r=e.length,s=new Ae(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 Ae(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 Ys(s,0,i)}function Zk(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(Up)return Up.decode(e);var s=x3(e),i=s.s,n=s.r;return n.length&&Ve(8),i}}var _3=function(e,t){return t+30+On(e,t+26)+On(e,t+28)},w3=function(e,t,n){var r=On(e,t+28),s=On(e,t+30),i=Zk(e.subarray(t+46,t+46+r),!(On(e,t+8)&2048)),o=t+46+r,l=b3(e,o,s,n,Ht(e,t+20),Ht(e,t+24),Ht(e,t+42)),c=l[0],u=l[1],d=l[2];return[On(e,t+10),c,u,i,o+s+On(e,t+32),d]},b3=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+On(e,t+2))if(On(e,t)==1)return[l?Uf(e,t+4+8*c):s,c?Uf(e,t+4):i,u?Uf(e,t+4+8*(c+l)):o,1];r<2&&Ve(13)}return[s,i,o,0]},Wp=function(e){var t=0;if(e)for(var n in e){var r=e[n].length;r>65535&&Ve(9),t+=r+4}return t},v_=function(e,t,n,r,s,i,o,l){var c=r.length,u=n.extra,d=l&&l.length,f=Wp(u);Xe(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)&&Ve(10),Xe(e,t,p<<25|h.getMonth()+1<<21|h.getDate()<<16|h.getHours()<<11|h.getMinutes()<<5|h.getSeconds()>>1),t+=4,i!=-1&&(Xe(e,t,n.crc),Xe(e,t+4,i<0?-i-2:i),Xe(e,t+8,n.size)),Xe(e,t+12,c),Xe(e,t+14,f),t+=16,o!=null&&(Xe(e,t,d),Xe(e,t+6,n.attrs),Xe(e,t+10,o),t+=14),e.set(r,t),t+=c,f)for(var g in u){var x=u[g],w=x.length;Xe(e,t,+g),Xe(e,t+2,w),e.set(x,t+4),t+=4+w}return d&&(e.set(l,t),t+=d),t},j3=function(e,t,n,r,s){Xe(e,t,101010256),Xe(e,t+8,n),Xe(e,t+10,n),Xe(e,t+12,r),Xe(e,t+16,s)};function S3(e,t,n){n||(n=t,t={}),typeof n!="function"&&Ve(7);var r={};Qk(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,v){Pu(function(){n(w,v)})};Pu(function(){h=n});var p=function(){var w=new Ae(l+22),v=o,y=l-o;l=0;for(var m=0;m<c;++m){var b=u[m];try{var j=b.c.length;v_(w,l,b,b.f,b.u,j);var S=30+b.f.length+Wp(b.extra),k=l+S;w.set(b.c,k),v_(w,o,b,b.f,b.u,j,l,b.m),o+=16+S+(b.m?b.m.length:0),l=k+j}catch(N){return h(N,null)}}j3(w,o,u.length,y,v),h(null,w)};i||p();for(var g=function(w){var v=s[w],y=r[v],m=y[0],b=y[1],j=d3(),S=m.length;j.p(m);var k=Hp(v),N=k.length,A=b.comment,O=A&&Hp(A),D=O&&O.length,I=Wp(b.extra),z=b.level==0?0:8,T=function(E,P){if(E)f(),h(E,null);else{var C=P.length;u[w]=sv(b,{size:S,crc:j.d(),c:P,f:k,m:O,u:N!=v.length||O&&A.length!=D,compression:z}),o+=30+N+I+C,l+=76+2*(N+I)+(D||0)+C,--i||p()}};if(N>65535&&T(Ve(11,0,1),null),!z)T(null,m);else if(S<16e4)try{T(null,iv(m,b))}catch(E){T(E,null)}else d.push(g3(m,b,T))},x=0;x<c;++x)g(x);return f}var Pu=typeof queueMicrotask=="function"?queueMicrotask:typeof setTimeout=="function"?setTimeout:function(e){e()};function k3(e,t,n){n||(n=t,t={}),typeof n!="function"&&Ve(7);var r=[],s=function(){for(var w=0;w<r.length;++w)r[w]()},i={},o=function(w,v){Pu(function(){n(w,v)})};Pu(function(){o=n});for(var l=e.length-22;Ht(e,l)!=101010256;--l)if(!l||e.length-l>65558)return o(Ve(13,0,1),null),s;var c=On(e,l+8);if(c){var u=c,d=Ht(e,l+16),f=Ht(e,l-20)==117853008;if(f){var h=Ht(e,l-12);f=Ht(e,h)==101075792,f&&(u=c=Ht(e,h+32),d=Ht(e,h+48))}for(var p=t&&t.filter,g=function(w){var v=w3(e,d,f),y=v[0],m=v[1],b=v[2],j=v[3],S=v[4],k=v[5],N=_3(e,k);d=S;var A=function(D,I){D?(s(),o(D,null)):(I&&(i[j]=I),--c||o(null,i))};if(!p||p({name:j,size:m,originalSize:b,compression:y}))if(!y)A(null,Ys(e,N,N+m));else if(y==8){var O=e.subarray(N,N+m);if(b<524288||m>.8*b)try{A(null,ov(O,{out:new Ae(b)}))}catch(D){A(D,null)}else r.push(v3(O,{size:b},A))}else A(Ve(14,"unknown compression type "+y,1),null);else A(null,null)},x=0;x<u;++x)g(x)}else o(null,{});return s}const Kp="project-manifest.json",N3=".aitable-workflow.zip",E3=/\.(json|ya?ml|ts|js|md|txt)$/i,C3=new Set(["runtime","traces","node_modules"]),Jk=/(^|\/)\.(_|DS_Store)/;async function T3(e){const{project:t,files:n,checksums:r,exportedAt:s}=e,i={};for(const l of n)tN(l.path)||Jk.test(l.path)||(i[l.path]=l.content);const o={version:1,title:t.title??"",scene:O3(n),checksums:r,exportedAt:s,projectId:t.id};return i[Kp]=JSON.stringify(o,null,2),P3(i)}function P3(e){const t={};for(const[n,r]of Object.entries(e))t[n]=Hp(r);return new Promise((n,r)=>{S3(t,{level:6},(s,i)=>{s?r(s):n(new Blob([i.slice()],{type:"application/zip"}))})})}async function eN(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)=>{k3(t,(o,l)=>o?i(o):s(l))}),r={};for(const[s,i]of Object.entries(n))s.endsWith("/")||(r[s]=Zk(i));return r}function A3(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 R3(e){const t=await eN(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||Jk.test(c)||tN(c)||!E3.test(c)||s.push({path:c,content:l})}s.sort((o,l)=>o.path.localeCompare(l.path));const i=await M3(n,s);return{title:(n==null?void 0:n.title)??"",files:s,manifest:n,checksumWarnings:i}}async function I3(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 M3(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 I3(i);o&&o!==s.sha256&&n.push(`checksum 不一致:${s.path}`)}return n}function O3(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 tN(e){const t=e.split("/")[0]??"";return C3.has(t)}function L3(e){return e.trim().replace(/[^\w一-龥.\- ]+/g,"_").replace(/_{2,}/g,"_")||"project"}function $3(e){return`${L3(e)}${N3}`}function Ma(e,t){const n=e.filter(r=>r.id!==t.id);return[t,...n].sort((r,s)=>s.updatedAt.localeCompare(r.updatedAt))}function qp(e,t){var n;return(n=e.title)!=null&&n.trim()?e.title.trim():`工作流 #${t+1} · ${e.id.slice(-6)}`}const D3=ct(function(){const t=V.workflows,n=V.currentWorkflowId,r=V.workflowFiles,s=V.projectId,[,i]=Og(),[o,l]=_.useState(!1),[c,u]=_.useState(null),[d,f]=_.useState(!1),[h,p]=_.useState(null),g=y=>{if(!y)return null;const m=t.find(b=>b.id===y);return(m==null?void 0:m.fileCount)!=null?m.fileCount:y!==n?null:r.length};function x(y){!s||y===n||i(m=>{const b=new URLSearchParams(m);return b.set("w",y),b})}async function w(){if(s)try{const y=await Op(s);V.setWorkflows(y)}catch{}}async function v(){if(!(!c||!s)){f(!0),p(null);try{await x$(s,c);const y=await Op(s),m=c===n;if(V.setWorkflows(y),m){const b=y[0];i(j=>{const S=new URLSearchParams(j);return b?S.set("w",b.id):S.delete("w"),S}),b||V.setCurrentWorkflow(null,[])}u(null)}catch(y){const m=y instanceof Error?y.message:String(y);p(/运行中|project_busy|活跃|无法删除/i.test(m)?"项目运行中,无法删除工作流":m)}finally{f(!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:()=>l(!0),children:[a.jsx(L,{name:"plus",size:14,style:{flex:"0 0 auto"}}),a.jsx("span",{children:"新建工作流"})]}),h&&a.jsx("div",{className:"rail__workflow-error",children:h}),o&&a.jsx(y_,{onCancel:()=>l(!1),onCreated:async()=>{l(!1),await w()}})]}):a.jsxs("div",{className:"rail__workflow-list",children:[t.map(y=>{const m=y.id===n,b=g(y.id);return a.jsxs("div",{className:"rail__workflow-card-wrap",children:[a.jsxs("button",{type:"button",className:"rail__item rail__item--workflow"+(m?" is-active":""),onClick:()=>x(y.id),disabled:d,title:`${y.name}${y.domain?" · "+y.domain:""}${y.tableId?" · "+y.tableId:""}`,children:[a.jsx(L,{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:y.name}),a.jsx("span",{className:"rail__item-sub",children:[y.domain,y.tableId].filter(Boolean).join(" · ")||y.id})]}),b!==null&&a.jsx("span",{className:"rail__badge",children:b})]}),a.jsx("button",{type:"button",className:"rail__item-delete",title:"删除工作流","aria-label":"删除工作流",disabled:d,onClick:()=>{u(y.id),p(null)},children:a.jsx(L,{name:"close",size:12})})]},y.id)}),a.jsxs("button",{type:"button",className:"rail__item rail__workflow-add",onClick:()=>l(!0),children:[a.jsx(L,{name:"plus",size:14,style:{flex:"0 0 auto"}}),a.jsx("span",{children:"新建工作流"})]}),h&&a.jsx("div",{className:"rail__workflow-error",children:h}),o&&a.jsx(y_,{onCancel:()=>l(!1),onCreated:async()=>{l(!1),await w()}}),c&&a.jsx("div",{className:"modal-overlay",onClick:()=>!d&&u(null),children:a.jsxs("div",{className:"modal-card",onClick:y=>y.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:()=>u(null),disabled:d,children:a.jsx(L,{name:"close",size:14})})]}),a.jsxs("div",{className:"modal-card__body",children:[a.jsx("p",{className:"cfg-muted",children:"删除后该工作流的 workflow.yml / recipes / views 将一并移除,且不可恢复。"}),h&&a.jsxs("div",{className:"import-env-warn",children:[a.jsx(L,{name:"warn",size:13}),h]})]}),a.jsxs("div",{className:"modal-card__foot",children:[a.jsx("button",{type:"button",className:"modal-card__btn",onClick:()=>u(null),disabled:d,children:"取消"}),a.jsx("button",{type:"button",className:"primary modal-card__btn",disabled:d,onClick:()=>void v(),children:d?"删除中...":"确认删除"})]})]})})]})});function y_({onCancel:e,onCreated:t}){const n=V.projectId,[r,s]=_.useState(""),[i,o]=_.useState(""),[l,c]=_.useState(""),[u,d]=_.useState(!1),[f,h]=_.useState(null),p=_.useRef(null);async function g(w){if(!w||w.length===0)return[];const v=Array.from(w),y=[];for(const m of v){const b=m.webkitRelativePath||m.name,j=await m.text();y.push({path:nN(b),content:j})}return y}function x(){if(!n)return;const w=r.trim();if(!w){h("工作流名称不能为空");return}d(!0),h(null),(async()=>{var v;try{const y=[];if(i.trim()&&y.push({path:"workflow.yml",content:i}),l.trim()){const b=z3(l);y.push(...b)}if((v=p.current)!=null&&v.files){const b=await g(p.current.files);y.push(...b)}const m=await y$(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(L,{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:
|
|
67
|
-
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 ---
|
|
68
|
-
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(L,{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 z3(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:nN(l),content:c})}return n}function nN(e){let t=e.replace(/^\.\//,"");const n=/^workflows\/[^/]+\//;return n.test(t)&&(t=t.replace(n,"")),t}const F3=ct(function(){const t=Sr(),{projectId:n}=Tg(),r=V.projectId,s=V.projects,i=V.steps.length,l=$o("/p/:projectId/setup")?kk({snapshot:V.snapshot,mode:V.mode,mockSetup:V.mockSetup}).schema:null,c=(l==null?void 0:l.fields.length)??0,u=(l==null?void 0:l.views.length)??0,d=i>0,[f,h]=_.useState(!1),[p,g]=_.useState(null),[x,w]=_.useState(!1),[v,y]=_.useState(null),[m,b]=_.useState(null),[j,S]=_.useState(null),k=[`${i} 步工作流`,c>0?`${c} 字段`:null,u>0?`${u} 视图`:null].filter(Boolean).join(" · "),N=r?[{id:r,title:V.initDraft.name||(V.projectSource==="imported"?"导入项目":"新建项目"),dir:"",createdAt:"",updatedAt:""}]:[],A=ge?s:N;function O(E){t(`/p/${E}`)}async function D(E){if(!ge){V.beginNewProject(`mock-${Date.now()}`,E);return}const P=await Kg();V.beginNewProject(P.id,E),V.setProjects(Ma(s,P))}async function I(){if(!ge||!r)return;const E=s.find(R=>R.id===r),P=window.prompt("项目名称",(E==null?void 0:E.title)??"");if(!(P!=null&&P.trim()))return;const C=await w$(r,P.trim());V.setProjects(Ma(s,C))}async function z(){if(p){w(!0),y(null);try{await m$(p);const E=await qg().catch(()=>s.filter(P=>P.id!==p));p===r?(V.clearProject(E),t("/")):V.setProjects(E),g(null)}catch(E){const P=E instanceof Error?E.message:String(E);y(/运行中|project_busy|活跃|无法删除/i.test(P)?"项目运行中,无法删除":P)}finally{w(!1)}}}async function T(E){if(ge){b(E),S(null);try{const P=await g$(E),C=await T3(P),R=$3(P.project.title??E);A3(C,R)}catch(P){S(P instanceof Error?P.message:String(P))}finally{b(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:()=>V.setRailCollapsed(!0),title:"收起项目列表","aria-label":"收起项目列表",children:a.jsx(L,{name:"chevron-left",size:14})})]}),a.jsx("div",{className:"rail__list",children:A.map((E,P)=>{const C=ge?E.id===n:!0;return a.jsxs("div",{className:"rail__project",children:[a.jsxs("button",{type:"button",className:"rail__item rail__item--project"+(C?" is-active":""),onClick:()=>O(E.id),onDoubleClick:()=>void I(),title:ge?`${qp(E,P)} · ${E.id}`:void 0,children:[a.jsx(L,{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:qp(E,P)}),ge&&a.jsx("span",{className:"rail__item-sub",children:E.id})]})]}),ge&&a.jsx("button",{type:"button",className:"rail__item-delete",style:{right:30},title:m===E.id?"导出中...":"导出项目包","aria-label":"导出项目包",disabled:m===E.id,onClick:()=>void T(E.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"})})}),ge&&a.jsx("button",{type:"button",className:"rail__item-delete",title:"删除项目","aria-label":"删除项目",onClick:()=>{g(E.id),y(null)},children:a.jsx(L,{name:"close",size:12})}),C&&a.jsx(D3,{})]},E.id)})}),p&&a.jsx("div",{className:"modal-overlay",onClick:()=>!x&&g(null),children:a.jsxs("div",{className:"modal-card",onClick:E=>E.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:()=>g(null),disabled:x,children:a.jsx(L,{name:"close",size:14})})]}),a.jsxs("div",{className:"modal-card__body",children:[a.jsx("p",{className:"cfg-muted",children:"删除后项目配置与工作流文件将一并移除,且不可恢复。"}),v&&a.jsxs("div",{className:"import-env-warn",children:[a.jsx(L,{name:"warn",size:13}),v]})]}),a.jsxs("div",{className:"modal-card__foot",children:[a.jsx("button",{type:"button",className:"modal-card__btn",onClick:()=>g(null),disabled:x,children:"取消"}),a.jsx("button",{type:"button",className:"primary modal-card__btn",disabled:x,onClick:()=>void z(),children:x?"删除中...":"确认删除"})]})]})}),a.jsxs("button",{type:"button",className:"rail__item rail__new",onClick:()=>h(!0),children:[a.jsx(L,{name:"plus",size:17,style:{flex:"0 0 auto"}}),a.jsx("span",{children:"新建项目"})]}),f&&a.jsx(Ok,{onConfirm:E=>{D(E),h(!1)},onCancel:()=>h(!1)}),a.jsx("div",{className:"rail__spacer"}),ge&&a.jsxs("button",{type:"button",className:"rail__item rail__machines",onClick:()=>V.toggleAgentTrace(),title:"查看 Agent 执行记录",children:[a.jsx(L,{name:"bolt",size:17,style:{flex:"0 0 auto"}}),a.jsx("span",{children:"执行记录"})]}),a.jsxs("div",{className:"rail__foot",children:[d?k:"尚未创建工作流",a.jsx("br",{}),"aitable-workflow 原型"]}),j&&a.jsx("div",{className:"modal-overlay",onClick:()=>S(null),children:a.jsxs("div",{className:"modal-card",onClick:E=>E.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:()=>S(null),children:a.jsx(L,{name:"close",size:14})})]}),a.jsx("div",{className:"modal-card__body",children:a.jsxs("div",{className:"import-env-warn",children:[a.jsx(L,{name:"warn",size:13}),j]})}),a.jsx("div",{className:"modal-card__foot",children:a.jsx("button",{type:"button",className:"primary modal-card__btn",onClick:()=>S(null),children:"知道了"})})]})})]})});function V3(){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:["可以从左侧列表选一个项目,或回到首页新建。",a.jsx("div",{style:{marginTop:16},children:a.jsx(ze,{className:"primary",to:"/",children:"回到首页"})})]})})]})})}const B3=ct(function(){const{projectId:t}=Tg(),{pathname:n}=Dt();_.useEffect(()=>{t&&Eu(t)},[t]),l3();const r=a3(),[s,i]=_.useState(null),[o,l]=_.useState(0);_.useEffect(()=>{if(!t||!r||r===V.currentWorkflowId)return;let h=!1;return(async()=>{try{const[p,g]=await Promise.all([fk(t,r),Td(t,r).catch(()=>null)]);if(h)return;V.setCurrentWorkflow(r,p.files),g&&V.applyServerWorkflow(t,g),i(null)}catch{if(h)return;i(r)}})(),()=>{h=!0}},[t,r,o]);const c=mD(V.loading,V.snapshot),u=V.layout.railCollapsed,d=n.split("/").filter(Boolean).pop(),f=oD(d)?d:"init";return a.jsxs("div",{className:"body"+(u?" body--rail-collapsed":""),children:[u?a.jsx("button",{type:"button",className:"rail-peek",onClick:()=>V.setRailCollapsed(!1),title:"展开工作流列表","aria-label":"展开工作流列表",children:a.jsx(L,{name:"chevron-right",size:14})}):a.jsx(F3,{}),c.kind==="loading"?a.jsx(Ck,{stage:f}):c.kind==="load_error"?a.jsx(c_,{message:c.message,onRetry:()=>void Eu(t)}):c.kind==="no_project"?a.jsx(V3,{}):s&&s===r?a.jsx(c_,{title:"工作流切换失败",subtitle:`?w=${s} 的内容没取到`,message:"没能读取该工作流的详情,画布未切换。请重试,或改用左侧列表选择其他工作流。",onRetry:()=>l(h=>h+1)}):a.jsx(i1,{},t)]})}),U3=ct(function(){const t=bk(V.snapshot);return a.jsx(s1,{to:t,replace:!0})}),av=_.createContext({});function lv(e){const t=_.useRef(null);return t.current===null&&(t.current=e()),t.current}const Ad=_.createContext(null),cv=_.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});class H3 extends _.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 W3({children:e,isPresent:t}){const n=_.useId(),r=_.useRef(null),s=_.useRef({width:0,height:0,top:0,left:0}),{nonce:i}=_.useContext(cv);return _.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(`
|
|
69
|
-
[data-motion-pop-id="${n}"] {
|
|
70
|
-
position: absolute !important;
|
|
71
|
-
width: ${o}px !important;
|
|
72
|
-
height: ${l}px !important;
|
|
73
|
-
top: ${c}px !important;
|
|
74
|
-
left: ${u}px !important;
|
|
75
|
-
}
|
|
76
|
-
`),()=>{document.head.removeChild(d)}},[t]),a.jsx(H3,{isPresent:t,childRef:r,sizeRef:s,children:_.cloneElement(e,{ref:r})})}const K3=({children:e,initial:t,isPresent:n,onExitComplete:r,custom:s,presenceAffectsLayout:i,mode:o})=>{const l=lv(q3),c=_.useId(),u=_.useCallback(f=>{l.set(f,!0);for(const h of l.values())if(!h)return;r&&r()},[l,r]),d=_.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 _.useMemo(()=>{l.forEach((f,h)=>l.set(h,!1))},[n]),_.useEffect(()=>{!n&&!l.size&&r&&r()},[n]),o==="popLayout"&&(e=a.jsx(W3,{isPresent:n,children:e})),a.jsx(Ad.Provider,{value:d,children:e})};function q3(){return new Map}function rN(e=!0){const t=_.useContext(Ad);if(t===null)return[!0,null];const{isPresent:n,onExitComplete:r,register:s}=t,i=_.useId();_.useEffect(()=>{e&&s(i)},[e]);const o=_.useCallback(()=>e&&r&&r(i),[i,r,e]);return!n&&r?[!1,o]:[!0]}const ql=e=>e.key||"";function x_(e){const t=[];return _.Children.forEach(e,n=>{_.isValidElement(n)&&t.push(n)}),t}const uv=typeof window<"u",sN=uv?_.useLayoutEffect:_.useEffect,na=({children:e,custom:t,initial:n=!0,onExitComplete:r,presenceAffectsLayout:s=!0,mode:i="sync",propagate:o=!1})=>{const[l,c]=rN(o),u=_.useMemo(()=>x_(e),[e]),d=o&&!l?[]:u.map(ql),f=_.useRef(!0),h=_.useRef(u),p=lv(()=>new Map),[g,x]=_.useState(u),[w,v]=_.useState(u);sN(()=>{f.current=!1,h.current=u;for(let b=0;b<w.length;b++){const j=ql(w[b]);d.includes(j)?p.delete(j):p.get(j)!==!0&&p.set(j,!1)}},[w,d.length,d.join("-")]);const y=[];if(u!==g){let b=[...u];for(let j=0;j<w.length;j++){const S=w[j],k=ql(S);d.includes(k)||(b.splice(j,0,S),y.push(S))}i==="wait"&&y.length&&(b=y),v(x_(b)),x(u);return}const{forceRender:m}=_.useContext(av);return a.jsx(a.Fragment,{children:w.map(b=>{const j=ql(b),S=o&&!l?!1:u===w||d.includes(j),k=()=>{if(p.has(j))p.set(j,!0);else return;let N=!0;p.forEach(A=>{A||(N=!1)}),N&&(m==null||m(),v(h.current),o&&(c==null||c()),r&&r())};return a.jsx(K3,{isPresent:S,initial:!f.current||n?void 0:!1,custom:S?void 0:t,presenceAffectsLayout:s,mode:i,onExitComplete:S?void 0:k,children:b},j)})})},At=e=>e;let iN=At;const G3={useManualTiming:!1};function Y3(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 Gl=["read","resolveKeyframes","update","preRender","render","postRender"],X3=40;function oN(e,t){let n=!1,r=!0;const s={delta:0,timestamp:0,isProcessing:!1},i=()=>n=!0,o=Gl.reduce((v,y)=>(v[y]=Y3(i),v),{}),{read:l,resolveKeyframes:c,update:u,preRender:d,render:f,postRender:h}=o,p=()=>{const v=performance.now();n=!1,s.delta=r?1e3/60:Math.max(Math.min(v-s.timestamp,X3),1),s.timestamp=v,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))},g=()=>{n=!0,r=!0,s.isProcessing||e(p)};return{schedule:Gl.reduce((v,y)=>{const m=o[y];return v[y]=(b,j=!1,S=!1)=>(n||g(),m.schedule(b,j,S)),v},{}),cancel:v=>{for(let y=0;y<Gl.length;y++)o[Gl[y]].cancel(v)},state:s,steps:o}}const{schedule:Ee,cancel:Xr,state:Qe,steps:Hf}=oN(typeof requestAnimationFrame<"u"?requestAnimationFrame:At,!0),aN=_.createContext({strict:!1}),__={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"]},qi={};for(const e in __)qi[e]={isEnabled:t=>__[e].some(n=>!!t[n])};function Q3(e){for(const t in e)qi[t]={...qi[t],...e[t]}}const Z3=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 Au(e){return e.startsWith("while")||e.startsWith("drag")&&e!=="draggable"||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||Z3.has(e)}let lN=e=>!Au(e);function J3(e){e&&(lN=t=>t.startsWith("on")?!Au(t):e(t))}try{J3(require("@emotion/is-prop-valid").default)}catch{}function ez(e,t,n){const r={};for(const s in e)s==="values"&&typeof e.values=="object"||(lN(s)||n===!0&&Au(s)||!t&&!Au(s)||e.draggable&&s.startsWith("onDrag"))&&(r[s]=e[s]);return r}function tz(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 Rd=_.createContext({});function Oa(e){return typeof e=="string"||Array.isArray(e)}function Id(e){return e!==null&&typeof e=="object"&&typeof e.start=="function"}const dv=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],fv=["initial",...dv];function Md(e){return Id(e.animate)||fv.some(t=>Oa(e[t]))}function cN(e){return!!(Md(e)||e.variants)}function nz(e,t){if(Md(e)){const{initial:n,animate:r}=e;return{initial:n===!1||Oa(n)?n:void 0,animate:Oa(r)?r:void 0}}return e.inherit!==!1?t:{}}function rz(e){const{initial:t,animate:n}=nz(e,_.useContext(Rd));return _.useMemo(()=>({initial:t,animate:n}),[w_(t),w_(n)])}function w_(e){return Array.isArray(e)?e.join(" "):e}const sz=Symbol.for("motionComponentSymbol");function gi(e){return e&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function iz(e,t,n){return _.useCallback(r=>{r&&e.onMount&&e.onMount(r),t&&(r?t.mount(r):t.unmount()),n&&(typeof n=="function"?n(r):gi(n)&&(n.current=r))},[t])}const hv=e=>e.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),oz="framerAppearId",uN="data-"+hv(oz),{schedule:pv}=oN(queueMicrotask,!1),dN=_.createContext({});function az(e,t,n,r,s){var i,o;const{visualElement:l}=_.useContext(Rd),c=_.useContext(aN),u=_.useContext(Ad),d=_.useContext(cv).reducedMotion,f=_.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=_.useContext(dN);h&&!h.projection&&s&&(h.type==="html"||h.type==="svg")&&lz(f.current,n,s,p);const g=_.useRef(!1);_.useInsertionEffect(()=>{h&&g.current&&h.update(n,u)});const x=n[uN],w=_.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 sN(()=>{h&&(g.current=!0,window.MotionIsMounted=!0,h.updateFeatures(),pv.render(h.render),w.current&&h.animationState&&h.animationState.animateChanges())}),_.useEffect(()=>{h&&(!w.current&&h.animationState&&h.animationState.animateChanges(),w.current&&(queueMicrotask(()=>{var v;(v=window.MotionHandoffMarkAsComplete)===null||v===void 0||v.call(window,x)}),w.current=!1))}),h}function lz(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:fN(e.parent)),e.projection.setOptions({layoutId:s,layout:i,alwaysMeasureLayout:!!o||l&&gi(l),visualElement:e,animationType:typeof i=="string"?i:"both",initialPromotionConfig:r,layoutScroll:c,layoutRoot:u})}function fN(e){if(e)return e.options.allowProjection!==!1?e.projection:fN(e.parent)}function cz({preloadedFeatures:e,createVisualElement:t,useRender:n,useVisualState:r,Component:s}){var i,o;e&&Q3(e);function l(u,d){let f;const h={..._.useContext(cv),...u,layoutId:uz(u)},{isStatic:p}=h,g=rz(u),x=r(u,p);if(!p&&uv){dz();const w=fz(h);f=w.MeasureLayout,g.visualElement=az(s,x,h,t,w.ProjectionNode)}return a.jsxs(Rd.Provider,{value:g,children:[f&&g.visualElement?a.jsx(f,{visualElement:g.visualElement,...h}):null,n(s,u,iz(x,g.visualElement,d),x,p,g.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=_.forwardRef(l);return c[sz]=s,c}function uz({layoutId:e}){const t=_.useContext(av).id;return t&&e!==void 0?t+"-"+e:e}function dz(e,t){_.useContext(aN).strict}function fz(e){const{drag:t,layout:n}=qi;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 hz=["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 mv(e){return typeof e!="string"||e.includes("-")?!1:!!(hz.indexOf(e)>-1||/[A-Z]/u.test(e))}function b_(e){const t=[{},{}];return e==null||e.values.forEach((n,r)=>{t[0][r]=n.get(),t[1][r]=n.getVelocity()}),t}function gv(e,t,n,r){if(typeof t=="function"){const[s,i]=b_(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]=b_(r);t=t(n!==void 0?n:e.custom,s,i)}return t}const Gp=e=>Array.isArray(e),pz=e=>!!(e&&typeof e=="object"&&e.mix&&e.toValue),mz=e=>Gp(e)?e[e.length-1]||0:e,at=e=>!!(e&&e.getVelocity);function Mc(e){const t=at(e)?e.get():e;return pz(t)?t.toValue():t}function gz({scrapeMotionValuesFromProps:e,createRenderState:t,onUpdate:n},r,s,i){const o={latestValues:vz(r,s,i,e),renderState:t()};return n&&(o.onMount=l=>n({props:r,current:l,...o}),o.onUpdate=l=>n(l)),o}const hN=e=>(t,n)=>{const r=_.useContext(Rd),s=_.useContext(Ad),i=()=>gz(e,t,r,s);return n?i():lv(i)};function vz(e,t,n,r){const s={},i=r(e,{});for(const h in i)s[h]=Mc(i[h]);let{initial:o,animate:l}=e;const c=Md(e),u=cN(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"&&!Id(f)){const h=Array.isArray(f)?f:[f];for(let p=0;p<h.length;p++){const g=gv(e,h[p]);if(g){const{transitionEnd:x,transition:w,...v}=g;for(const y in v){let m=v[y];if(Array.isArray(m)){const b=d?m.length-1:0;m=m[b]}m!==null&&(s[y]=m)}for(const y in x)s[y]=x[y]}}}return s}const mo=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Xs=new Set(mo),pN=e=>t=>typeof t=="string"&&t.startsWith(e),mN=pN("--"),yz=pN("var(--"),vv=e=>yz(e)?xz.test(e.split("/*")[0].trim()):!1,xz=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,gN=(e,t)=>t&&typeof e=="number"?t.transform(e):e,wr=(e,t,n)=>n>t?t:n<e?e:n,go={test:e=>typeof e=="number",parse:parseFloat,transform:e=>e},La={...go,transform:e=>wr(0,1,e)},Yl={...go,default:1},fl=e=>({test:t=>typeof t=="string"&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),Tr=fl("deg"),Bn=fl("%"),ie=fl("px"),_z=fl("vh"),wz=fl("vw"),j_={...Bn,parse:e=>Bn.parse(e)/100,transform:e=>Bn.transform(e*100)},bz={borderWidth:ie,borderTopWidth:ie,borderRightWidth:ie,borderBottomWidth:ie,borderLeftWidth:ie,borderRadius:ie,radius:ie,borderTopLeftRadius:ie,borderTopRightRadius:ie,borderBottomRightRadius:ie,borderBottomLeftRadius:ie,width:ie,maxWidth:ie,height:ie,maxHeight:ie,top:ie,right:ie,bottom:ie,left:ie,padding:ie,paddingTop:ie,paddingRight:ie,paddingBottom:ie,paddingLeft:ie,margin:ie,marginTop:ie,marginRight:ie,marginBottom:ie,marginLeft:ie,backgroundPositionX:ie,backgroundPositionY:ie},jz={rotate:Tr,rotateX:Tr,rotateY:Tr,rotateZ:Tr,scale:Yl,scaleX:Yl,scaleY:Yl,scaleZ:Yl,skew:Tr,skewX:Tr,skewY:Tr,distance:ie,translateX:ie,translateY:ie,translateZ:ie,x:ie,y:ie,z:ie,perspective:ie,transformPerspective:ie,opacity:La,originX:j_,originY:j_,originZ:ie},S_={...go,transform:Math.round},yv={...bz,...jz,zIndex:S_,size:ie,fillOpacity:La,strokeOpacity:La,numOctaves:S_},Sz={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},kz=mo.length;function Nz(e,t,n){let r="",s=!0;for(let i=0;i<kz;i++){const o=mo[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=gN(l,yv[o]);if(!c){s=!1;const d=Sz[o]||o;r+=`${d}(${u}) `}n&&(t[o]=u)}}return r=r.trim(),n?r=n(t,s?"":r):s&&(r="none"),r}function xv(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(Xs.has(c)){o=!0;continue}else if(mN(c)){s[c]=u;continue}else{const d=gN(u,yv[c]);c.startsWith("origin")?(l=!0,i[c]=d):r[c]=d}}if(t.transform||(o||n?r.transform=Nz(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 Ez={offset:"stroke-dashoffset",array:"stroke-dasharray"},Cz={offset:"strokeDashoffset",array:"strokeDasharray"};function Tz(e,t,n=1,r=0,s=!0){e.pathLength=1;const i=s?Ez:Cz;e[i.offset]=ie.transform(-r);const o=ie.transform(t),l=ie.transform(n);e[i.array]=`${o} ${l}`}function k_(e,t,n){return typeof e=="string"?e:ie.transform(t+n*e)}function Pz(e,t,n){const r=k_(t,e.x,e.width),s=k_(n,e.y,e.height);return`${r} ${s}`}function _v(e,{attrX:t,attrY:n,attrScale:r,originX:s,originY:i,pathLength:o,pathSpacing:l=1,pathOffset:c=0,...u},d,f){if(xv(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:g}=e;h.transform&&(g&&(p.transform=h.transform),delete h.transform),g&&(s!==void 0||i!==void 0||p.transform)&&(p.transformOrigin=Pz(g,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&&Tz(h,o,l,c,!1)}const wv=()=>({style:{},transform:{},transformOrigin:{},vars:{}}),vN=()=>({...wv(),attrs:{}}),bv=e=>typeof e=="string"&&e.toLowerCase()==="svg";function yN(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 xN=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 _N(e,t,n,r){yN(e,t,void 0,r);for(const s in t.attrs)e.setAttribute(xN.has(s)?s:hv(s),t.attrs[s])}const Ru={};function Az(e){Object.assign(Ru,e)}function wN(e,{layout:t,layoutId:n}){return Xs.has(e)||e.startsWith("origin")||(t||n!==void 0)&&(!!Ru[e]||e==="opacity")}function jv(e,t,n){var r;const{style:s}=e,i={};for(const o in s)(at(s[o])||t.style&&at(t.style[o])||wN(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 bN(e,t,n){const r=jv(e,t,n);for(const s in e)if(at(e[s])||at(t[s])){const i=mo.indexOf(s)!==-1?"attr"+s.charAt(0).toUpperCase()+s.substring(1):s;r[i]=e[s]}return r}function Rz(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 N_=["x","y","width","height","cx","cy","r"],Iz={useVisualState:hN({scrapeMotionValuesFromProps:bN,createRenderState:vN,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(Xs.has(l)){i=!0;break}}if(!i)return;let o=!t;if(t)for(let l=0;l<N_.length;l++){const c=N_[l];e[c]!==t[c]&&(o=!0)}o&&Ee.read(()=>{Rz(n,r),Ee.render(()=>{_v(r,s,bv(n.tagName),e.transformTemplate),_N(n,r)})})}})},Mz={useVisualState:hN({scrapeMotionValuesFromProps:jv,createRenderState:wv})};function jN(e,t,n){for(const r in t)!at(t[r])&&!wN(r,n)&&(e[r]=t[r])}function Oz({transformTemplate:e},t){return _.useMemo(()=>{const n=wv();return xv(n,t,e),Object.assign({},n.vars,n.style)},[t])}function Lz(e,t){const n=e.style||{},r={};return jN(r,n,e),Object.assign(r,Oz(e,t)),r}function $z(e,t){const n={},r=Lz(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 Dz(e,t,n,r){const s=_.useMemo(()=>{const i=vN();return _v(i,t,bv(r),e.transformTemplate),{...i.attrs,style:{...i.style}}},[t]);if(e.style){const i={};jN(i,e.style,e),s.style={...i,...s.style}}return s}function zz(e=!1){return(n,r,s,{latestValues:i},o)=>{const c=(mv(n)?Dz:$z)(r,i,o,n),u=ez(r,typeof n=="string",e),d=n!==_.Fragment?{...u,...c,ref:s}:{},{children:f}=r,h=_.useMemo(()=>at(f)?f.get():f,[f]);return _.createElement(n,{...d,children:h})}}function Fz(e,t){return function(r,{forwardMotionProps:s}={forwardMotionProps:!1}){const o={...mv(r)?Iz:Mz,preloadedFeatures:e,useRender:zz(s),createVisualElement:t,Component:r};return cz(o)}}function SN(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 Od(e,t,n){const r=e.getProps();return gv(r,t,n!==void 0?n:r.custom,e)}function Sv(e,t){return e?e[t]||e.default||e:void 0}const kN=new Set(["width","height","top","left","right","bottom",...mo]);let Oc;function Vz(){Oc=void 0}const Un={now:()=>(Oc===void 0&&Un.set(Qe.isProcessing||G3.useManualTiming?Qe.timestamp:performance.now()),Oc),set:e=>{Oc=e,queueMicrotask(Vz)}};function kv(e,t){e.indexOf(t)===-1&&e.push(t)}function Nv(e,t){const n=e.indexOf(t);n>-1&&e.splice(n,1)}class Ev{constructor(){this.subscriptions=[]}add(t){return kv(this.subscriptions,t),()=>Nv(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 NN(e,t){return t?e*(1e3/t):0}const E_=30,Bz=e=>!isNaN(parseFloat(e));class Uz{constructor(t,n={}){this.version="11.18.2",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(r,s=!0)=>{const i=Un.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=Un.now(),this.canTrackVelocity===null&&t!==void 0&&(this.canTrackVelocity=Bz(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 Ev);const r=this.events[t].add(n);return t==="change"?()=>{r(),Ee.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=Un.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||t-this.updatedAt>E_)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,E_);return NN(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 Uz(e,t)}function Hz(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,$a(n))}function Wz(e,t){const n=Od(e,t);let{transitionEnd:r={},transition:s={},...i}=n||{};i={...i,...r};for(const o in i){const l=mz(i[o]);Hz(e,o,l)}}function Kz(e){return!!(at(e)&&e.add)}function Yp(e,t){const n=e.getValue("willChange");if(Kz(n))return n.add(t)}function EN(e){return e.props[uN]}function Cv(e){let t;return()=>(t===void 0&&(t=e()),t)}const qz=Cv(()=>window.ScrollTimeline!==void 0);class Gz{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(qz()&&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 Yz extends Gz{then(t,n){return Promise.all(this.animations).then(t).catch(n)}}const ur=e=>e*1e3,dr=e=>e/1e3;function Tv(e){return typeof e=="function"}function C_(e,t){e.timeline=t,e.onfinish=null}const Pv=e=>Array.isArray(e)&&typeof e[0]=="number",Xz={linearEasing:void 0};function Qz(e,t){const n=Cv(e);return()=>{var r;return(r=Xz[t])!==null&&r!==void 0?r:n()}}const Iu=Qz(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),Gi=(e,t,n)=>{const r=t-e;return r===0?1:(n-e)/r},CN=(e,t,n=10)=>{let r="";const s=Math.max(Math.round(t/n),2);for(let i=0;i<s;i++)r+=e(Gi(0,s-1,i))+", ";return`linear(${r.substring(0,r.length-2)})`};function TN(e){return!!(typeof e=="function"&&Iu()||!e||typeof e=="string"&&(e in Xp||Iu())||Pv(e)||Array.isArray(e)&&e.every(TN))}const Do=([e,t,n,r])=>`cubic-bezier(${e}, ${t}, ${n}, ${r})`,Xp={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Do([0,.65,.55,1]),circOut:Do([.55,0,1,.45]),backIn:Do([.31,.01,.66,-.59]),backOut:Do([.33,1.53,.69,.99])};function PN(e,t){if(e)return typeof e=="function"&&Iu()?CN(e,t):Pv(e)?Do(e):Array.isArray(e)?e.map(n=>PN(n,t)||Xp.easeOut):Xp[e]}const AN=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,Zz=1e-7,Jz=12;function eF(e,t,n,r,s){let i,o,l=0;do o=t+(n-t)/2,i=AN(o,r,s)-e,i>0?n=o:t=o;while(Math.abs(i)>Zz&&++l<Jz);return o}function hl(e,t,n,r){if(e===t&&n===r)return At;const s=i=>eF(i,0,1,e,n);return i=>i===0||i===1?i:AN(s(i),t,r)}const RN=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,IN=e=>t=>1-e(1-t),MN=hl(.33,1.53,.69,.99),Av=IN(MN),ON=RN(Av),LN=e=>(e*=2)<1?.5*Av(e):.5*(2-Math.pow(2,-10*(e-1))),Rv=e=>1-Math.sin(Math.acos(e)),$N=IN(Rv),DN=RN(Rv),zN=e=>/^0[^.\s]+$/u.test(e);function tF(e){return typeof e=="number"?e===0:e!==null?e==="none"||e==="0"||zN(e):!0}const ra=e=>Math.round(e*1e5)/1e5,Iv=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function nF(e){return e==null}const rF=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Mv=(e,t)=>n=>!!(typeof n=="string"&&rF.test(n)&&n.startsWith(e)||t&&!nF(n)&&Object.prototype.hasOwnProperty.call(n,t)),FN=(e,t,n)=>r=>{if(typeof r!="string")return r;const[s,i,o,l]=r.match(Iv);return{[e]:parseFloat(s),[t]:parseFloat(i),[n]:parseFloat(o),alpha:l!==void 0?parseFloat(l):1}},sF=e=>wr(0,255,e),Wf={...go,transform:e=>Math.round(sF(e))},xs={test:Mv("rgb","red"),parse:FN("red","green","blue"),transform:({red:e,green:t,blue:n,alpha:r=1})=>"rgba("+Wf.transform(e)+", "+Wf.transform(t)+", "+Wf.transform(n)+", "+ra(La.transform(r))+")"};function iF(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 Qp={test:Mv("#"),parse:iF,transform:xs.transform},vi={test:Mv("hsl","hue"),parse:FN("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:n,alpha:r=1})=>"hsla("+Math.round(e)+", "+Bn.transform(ra(t))+", "+Bn.transform(ra(n))+", "+ra(La.transform(r))+")"},st={test:e=>xs.test(e)||Qp.test(e)||vi.test(e),parse:e=>xs.test(e)?xs.parse(e):vi.test(e)?vi.parse(e):Qp.parse(e),transform:e=>typeof e=="string"?e:e.hasOwnProperty("red")?xs.transform(e):vi.transform(e)},oF=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function aF(e){var t,n;return isNaN(e)&&typeof e=="string"&&(((t=e.match(Iv))===null||t===void 0?void 0:t.length)||0)+(((n=e.match(oF))===null||n===void 0?void 0:n.length)||0)>0}const VN="number",BN="color",lF="var",cF="var(",T_="${}",uF=/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 Da(e){const t=e.toString(),n=[],r={color:[],number:[],var:[]},s=[];let i=0;const l=t.replace(uF,c=>(st.test(c)?(r.color.push(i),s.push(BN),n.push(st.parse(c))):c.startsWith(cF)?(r.var.push(i),s.push(lF),n.push(c)):(r.number.push(i),s.push(VN),n.push(parseFloat(c))),++i,T_)).split(T_);return{values:n,split:l,indexes:r,types:s}}function UN(e){return Da(e).values}function HN(e){const{split:t,types:n}=Da(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===VN?i+=ra(s[o]):l===BN?i+=st.transform(s[o]):i+=s[o]}return i}}const dF=e=>typeof e=="number"?0:e;function fF(e){const t=UN(e);return HN(e)(t.map(dF))}const Qr={test:aF,parse:UN,createTransformer:HN,getAnimatableNone:fF},hF=new Set(["brightness","contrast","saturate","opacity"]);function pF(e){const[t,n]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[r]=n.match(Iv)||[];if(!r)return e;const s=n.replace(r,"");let i=hF.has(t)?1:0;return r!==n&&(i*=100),t+"("+i+s+")"}const mF=/\b([a-z-]*)\(.*?\)/gu,Zp={...Qr,getAnimatableNone:e=>{const t=e.match(mF);return t?t.map(pF).join(" "):e}},gF={...yv,color:st,backgroundColor:st,outlineColor:st,fill:st,stroke:st,borderColor:st,borderTopColor:st,borderRightColor:st,borderBottomColor:st,borderLeftColor:st,filter:Zp,WebkitFilter:Zp},Ov=e=>gF[e];function WN(e,t){let n=Ov(e);return n!==Zp&&(n=Qr),n.getAnimatableNone?n.getAnimatableNone(t):void 0}const vF=new Set(["auto","none","0"]);function yF(e,t,n){let r=0,s;for(;r<e.length&&!s;){const i=e[r];typeof i=="string"&&!vF.has(i)&&Da(i).values.length&&(s=e[r]),r++}if(s&&n)for(const i of t)e[i]=WN(n,s)}const P_=e=>e===go||e===ie,A_=(e,t)=>parseFloat(e.split(", ")[t]),R_=(e,t)=>(n,{transform:r})=>{if(r==="none"||!r)return 0;const s=r.match(/^matrix3d\((.+)\)$/u);if(s)return A_(s[1],t);{const i=r.match(/^matrix\((.+)\)$/u);return i?A_(i[1],e):0}},xF=new Set(["x","y","z"]),_F=mo.filter(e=>!xF.has(e));function wF(e){const t=[];return _F.forEach(n=>{const r=e.getValue(n);r!==void 0&&(t.push([n,r.get()]),r.set(n.startsWith("scale")?1:0))}),t}const Yi={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:R_(4,13),y:R_(5,14)};Yi.translateX=Yi.x;Yi.translateY=Yi.y;const Ss=new Set;let Jp=!1,em=!1;function KN(){if(em){const e=Array.from(Ss).filter(r=>r.needsMeasurement),t=new Set(e.map(r=>r.element)),n=new Map;t.forEach(r=>{const s=wF(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)})}em=!1,Jp=!1,Ss.forEach(e=>e.complete()),Ss.clear()}function qN(){Ss.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(em=!0)})}function bF(){qN(),KN()}class Lv{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?(Ss.add(this),Jp||(Jp=!0,Ee.read(qN),Ee.resolveKeyframes(KN))):(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),Ss.delete(this)}cancel(){this.isComplete||(this.isScheduled=!1,Ss.delete(this))}resume(){this.isComplete||this.scheduleResolve()}}const GN=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e),jF=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function SF(e){const t=jF.exec(e);if(!t)return[,];const[,n,r,s]=t;return[`--${n??r}`,s]}function YN(e,t,n=1){const[r,s]=SF(e);if(!r)return;const i=window.getComputedStyle(t).getPropertyValue(r);if(i){const o=i.trim();return GN(o)?parseFloat(o):o}return vv(s)?YN(s,t,n+1):s}const XN=e=>t=>t.test(e),kF={test:e=>e==="auto",parse:e=>e},QN=[go,ie,Bn,Tr,wz,_z,kF],I_=e=>QN.find(XN(e));class ZN extends Lv{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(),vv(u))){const d=YN(u,n.current);d!==void 0&&(t[c]=d),c===t.length-1&&(this.finalKeyframe=u)}}if(this.resolveNoneKeyframes(),!kN.has(r)||t.length!==2)return;const[s,i]=t,o=I_(s),l=I_(i);if(o!==l)if(P_(o)&&P_(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++)tF(t[s])&&r.push(s);r.length&&yF(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=Yi[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]=Yi[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 M_=(e,t)=>t==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&(Qr.test(e)||e==="0")&&!e.startsWith("url("));function NF(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 EF(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=M_(s,t),l=M_(i,t);return!o||!l?!1:NF(e)||(n==="spring"||Tv(n))&&r}const CF=e=>e!==null;function Ld(e,{repeat:t,repeatType:n="loop"},r){const s=e.filter(CF),i=t&&n!=="loop"&&t%2===1?0:s.length-1;return!i||r===void 0?s[i]:r}const TF=40;class JN{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=Un.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>TF?this.resolvedAt:this.createdAt:this.createdAt}get resolved(){return!this._resolved&&!this.hasAttemptedResolve&&bF(),this._resolved}onKeyframesResolved(t,n){this.resolvedAt=Un.now(),this.hasAttemptedResolve=!0;const{name:r,type:s,velocity:i,delay:o,onComplete:l,onUpdate:c,isGenerator:u}=this.options;if(!u&&!EF(t,r,s,i))if(o)this.options.duration=0;else{c&&c(Ld(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 tm=2e4;function eE(e){let t=0;const n=50;let r=e.next(t);for(;!r.done&&t<tm;)t+=n,r=e.next(t);return t>=tm?1/0:t}const Ie=(e,t,n)=>e+(t-e)*n;function Kf(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 PF({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=Kf(c,l,e+1/3),i=Kf(c,l,e),o=Kf(c,l,e-1/3)}return{red:Math.round(s*255),green:Math.round(i*255),blue:Math.round(o*255),alpha:r}}function Mu(e,t){return n=>n>0?t:e}const qf=(e,t,n)=>{const r=e*e,s=n*(t*t-r)+r;return s<0?0:Math.sqrt(s)},AF=[Qp,xs,vi],RF=e=>AF.find(t=>t.test(e));function O_(e){const t=RF(e);if(!t)return!1;let n=t.parse(e);return t===vi&&(n=PF(n)),n}const L_=(e,t)=>{const n=O_(e),r=O_(t);if(!n||!r)return Mu(e,t);const s={...n};return i=>(s.red=qf(n.red,r.red,i),s.green=qf(n.green,r.green,i),s.blue=qf(n.blue,r.blue,i),s.alpha=Ie(n.alpha,r.alpha,i),xs.transform(s))},IF=(e,t)=>n=>t(e(n)),pl=(...e)=>e.reduce(IF),nm=new Set(["none","hidden"]);function MF(e,t){return nm.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function OF(e,t){return n=>Ie(e,t,n)}function $v(e){return typeof e=="number"?OF:typeof e=="string"?vv(e)?Mu:st.test(e)?L_:DF:Array.isArray(e)?tE:typeof e=="object"?st.test(e)?L_:LF:Mu}function tE(e,t){const n=[...e],r=n.length,s=e.map((i,o)=>$v(i)(i,t[o]));return i=>{for(let o=0;o<r;o++)n[o]=s[o](i);return n}}function LF(e,t){const n={...e,...t},r={};for(const s in n)e[s]!==void 0&&t[s]!==void 0&&(r[s]=$v(e[s])(e[s],t[s]));return s=>{for(const i in r)n[i]=r[i](s);return n}}function $F(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 DF=(e,t)=>{const n=Qr.createTransformer(t),r=Da(e),s=Da(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?nm.has(e)&&!s.values.length||nm.has(t)&&!r.values.length?MF(e,t):pl(tE($F(r,s),s.values),n):Mu(e,t)};function nE(e,t,n){return typeof e=="number"&&typeof t=="number"&&typeof n=="number"?Ie(e,t,n):$v(e)(e,t)}const zF=5;function rE(e,t,n){const r=Math.max(t-zF,0);return NN(n-e(r),t-r)}const $e={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},Gf=.001;function FF({duration:e=$e.duration,bounce:t=$e.bounce,velocity:n=$e.velocity,mass:r=$e.mass}){let s,i,o=1-t;o=wr($e.minDamping,$e.maxDamping,o),e=wr($e.minDuration,$e.maxDuration,dr(e)),o<1?(s=u=>{const d=u*o,f=d*e,h=d-n,p=rm(u,o),g=Math.exp(-f);return Gf-h/p*g},i=u=>{const f=u*o*e,h=f*n+n,p=Math.pow(o,2)*Math.pow(u,2)*e,g=Math.exp(-f),x=rm(Math.pow(u,2),o);return(-s(u)+Gf>0?-1:1)*((h-p)*g)/x}):(s=u=>{const d=Math.exp(-u*e),f=(u-n)*e+1;return-Gf+d*f},i=u=>{const d=Math.exp(-u*e),f=(n-u)*(e*e);return d*f});const l=5/e,c=BF(s,i,l);if(e=ur(e),isNaN(c))return{stiffness:$e.stiffness,damping:$e.damping,duration:e};{const u=Math.pow(c,2)*r;return{stiffness:u,damping:o*2*Math.sqrt(r*u),duration:e}}}const VF=12;function BF(e,t,n){let r=n;for(let s=1;s<VF;s++)r=r-e(r)/t(r);return r}function rm(e,t){return e*Math.sqrt(1-t*t)}const UF=["duration","bounce"],HF=["stiffness","damping","mass"];function $_(e,t){return t.some(n=>e[n]!==void 0)}function WF(e){let t={velocity:$e.velocity,stiffness:$e.stiffness,damping:$e.damping,mass:$e.mass,isResolvedFromDuration:!1,...e};if(!$_(e,HF)&&$_(e,UF))if(e.visualDuration){const n=e.visualDuration,r=2*Math.PI/(n*1.2),s=r*r,i=2*wr(.05,1,1-(e.bounce||0))*Math.sqrt(s);t={...t,mass:$e.mass,stiffness:s,damping:i}}else{const n=FF(e);t={...t,...n,mass:$e.mass},t.isResolvedFromDuration=!0}return t}function sE(e=$e.visualDuration,t=$e.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}=WF({...n,velocity:-dr(n.velocity||0)}),g=h||0,x=u/(2*Math.sqrt(c*d)),w=o-i,v=dr(Math.sqrt(c/d)),y=Math.abs(w)<5;r||(r=y?$e.restSpeed.granular:$e.restSpeed.default),s||(s=y?$e.restDelta.granular:$e.restDelta.default);let m;if(x<1){const j=rm(v,x);m=S=>{const k=Math.exp(-x*v*S);return o-k*((g+x*v*w)/j*Math.sin(j*S)+w*Math.cos(j*S))}}else if(x===1)m=j=>o-Math.exp(-v*j)*(w+(g+v*w)*j);else{const j=v*Math.sqrt(x*x-1);m=S=>{const k=Math.exp(-x*v*S),N=Math.min(j*S,300);return o-k*((g+x*v*w)*Math.sinh(N)+j*w*Math.cosh(N))/j}}const b={calculatedDuration:p&&f||null,next:j=>{const S=m(j);if(p)l.done=j>=f;else{let k=0;x<1&&(k=j===0?ur(g):rE(m,j,S));const N=Math.abs(k)<=r,A=Math.abs(o-S)<=s;l.done=N&&A}return l.value=l.done?o:S,l},toString:()=>{const j=Math.min(eE(b),tm),S=CN(k=>b.next(j*k).value,j,30);return j+"ms "+S}};return b}function D_({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=N=>l!==void 0&&N<l||c!==void 0&&N>c,g=N=>l===void 0?c:c===void 0||Math.abs(l-N)<Math.abs(c-N)?l:c;let x=n*t;const w=f+x,v=o===void 0?w:o(w);v!==w&&(x=v-f);const y=N=>-x*Math.exp(-N/r),m=N=>v+y(N),b=N=>{const A=y(N),O=m(N);h.done=Math.abs(A)<=u,h.value=h.done?v:O};let j,S;const k=N=>{p(h.value)&&(j=N,S=sE({keyframes:[h.value,g(h.value)],velocity:rE(m,N,h.value),damping:s,stiffness:i,restDelta:u,restSpeed:d}))};return k(0),{calculatedDuration:null,next:N=>{let A=!1;return!S&&j===void 0&&(A=!0,b(N),k(N)),j!==void 0&&N>=j?S.next(N-j):(!A&&b(N),h)}}}const KF=hl(.42,0,1,1),qF=hl(0,0,.58,1),iE=hl(.42,0,.58,1),GF=e=>Array.isArray(e)&&typeof e[0]!="number",YF={linear:At,easeIn:KF,easeInOut:iE,easeOut:qF,circIn:Rv,circInOut:DN,circOut:$N,backIn:Av,backInOut:ON,backOut:MN,anticipate:LN},z_=e=>{if(Pv(e)){iN(e.length===4);const[t,n,r,s]=e;return hl(t,n,r,s)}else if(typeof e=="string")return YF[e];return e};function XF(e,t,n){const r=[],s=n||nE,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]||At:t;l=pl(c,l)}r.push(l)}return r}function QF(e,t,{clamp:n=!0,ease:r,mixer:s}={}){const i=e.length;if(iN(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=XF(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=Gi(e[f],e[f+1],d);return l[f](h)};return n?d=>u(wr(e[0],e[i-1],d)):u}function ZF(e,t){const n=e[e.length-1];for(let r=1;r<=t;r++){const s=Gi(0,t,r);e.push(Ie(n,1,s))}}function JF(e){const t=[0];return ZF(t,e.length-1),t}function e4(e,t){return e.map(n=>n*t)}function t4(e,t){return e.map(()=>t||iE).splice(0,e.length-1)}function Ou({duration:e=300,keyframes:t,times:n,ease:r="easeInOut"}){const s=GF(r)?r.map(z_):z_(r),i={done:!1,value:t[0]},o=e4(n&&n.length===t.length?n:JF(t),e),l=QF(o,t,{ease:Array.isArray(s)?s:t4(t,s)});return{calculatedDuration:e,next:c=>(i.value=l(c),i.done=c>=e,i)}}const n4=e=>{const t=({timestamp:n})=>e(n);return{start:()=>Ee.update(t,!0),stop:()=>Xr(t),now:()=>Qe.isProcessing?Qe.timestamp:Un.now()}},r4={decay:D_,inertia:D_,tween:Ou,keyframes:Ou,spring:sE},s4=e=>e/100;class Dv extends JN{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)||Lv,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=Tv(n)?n:r4[n]||Ou;let c,u;l!==Ou&&typeof t[0]!="number"&&(c=pl(s4,nE(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=eE(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:N}=this.options;return{done:!0,value:N[N.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:g,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 v=this.currentTime-h*(this.speed>=0?1:-1),y=this.speed>=0?v<0:v>d;this.currentTime=Math.max(v,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=d);let m=this.currentTime,b=i;if(p){const N=Math.min(this.currentTime,d)/f;let A=Math.floor(N),O=N%1;!O&&N>=1&&(O=1),O===1&&A--,A=Math.min(A,p+1),!!(A%2)&&(g==="reverse"?(O=1-O,x&&(O-=x/f)):g==="mirror"&&(b=o)),m=wr(0,1,O)*f}const j=y?{done:!1,value:c[0]}:b.next(m);l&&(j.value=l(j.value));let{done:S}=j;!y&&u!==null&&(S=this.speed>=0?this.currentTime>=d:this.currentTime<=0);const k=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&S);return k&&s!==void 0&&(j.value=Ld(c,this.options,s)),w&&w(j.value),k&&this.finish(),j}get duration(){const{resolved:t}=this;return t?dr(t.calculatedDuration):0}get time(){return dr(this.currentTime)}set time(t){t=ur(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=dr(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved){this.pendingPlayState="running";return}if(this.isStopped)return;const{driver:t=n4,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 i4=new Set(["opacity","clipPath","filter","transform"]);function o4(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=PN(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 a4=Cv(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),Lu=10,l4=2e4;function c4(e){return Tv(e.type)||e.type==="spring"||!TN(e.ease)}function u4(e,t){const n=new Dv({...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<l4;)r=n.sample(i),s.push(r.value),i+=Lu;return{times:void 0,keyframes:s,duration:i-Lu,ease:"linear"}}const oE={anticipate:LN,backInOut:ON,circInOut:DN};function d4(e){return e in oE}class F_ extends JN{constructor(t){super(t);const{name:n,motionValue:r,element:s,keyframes:i}=this.options;this.resolver=new ZN(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"&&Iu()&&d4(i)&&(i=oE[i]),c4(this.options)){const{onComplete:f,onUpdate:h,motionValue:p,element:g,...x}=this.options,w=u4(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=o4(l.owner.current,c,t,{...this.options,duration:r,times:s,ease:i});return d.startTime=u??this.calcStartTime(),this.pendingTimeline?(C_(d,this.pendingTimeline),this.pendingTimeline=void 0):d.onfinish=()=>{const{onComplete:f}=this.options;l.set(Ld(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 dr(n)}get time(){const{resolved:t}=this;if(!t)return 0;const{animation:n}=t;return dr(n.currentTime||0)}set time(t){const{resolved:n}=this;if(!n)return;const{animation:r}=n;r.currentTime=ur(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 At;const{animation:r}=n;C_(r,t)}return At}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,g=new Dv({...p,keyframes:r,duration:s,type:i,ease:o,times:l,isGenerator:!0}),x=ur(this.time);u.setWithVelocity(g.sample(x-Lu).value,g.sample(x).value,Lu)}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 a4()&&r&&i4.has(r)&&!c&&!u&&!s&&i!=="mirror"&&o!==0&&l!=="inertia"}}const f4={type:"spring",stiffness:500,damping:25,restSpeed:10},h4=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),p4={type:"keyframes",duration:.8},m4={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},g4=(e,{keyframes:t})=>t.length>2?p4:Xs.has(e)?e.startsWith("scale")?h4(t[1]):f4:m4;function v4({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 zv=(e,t,n,r={},s,i)=>o=>{const l=Sv(r,e)||{},c=l.delay||r.delay||0;let{elapsed:u=0}=r;u=u-ur(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};v4(l)||(d={...d,...g4(e,d)}),d.duration&&(d.duration=ur(d.duration)),d.repeatDelay&&(d.repeatDelay=ur(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=Ld(d.keyframes,l);if(h!==void 0)return Ee.update(()=>{d.onUpdate(h),d.onComplete()}),new Yz([])}return!i&&F_.supports(d)?new F_(d):new Dv(d)};function y4({protectedKeys:e,needsAnimating:t},n){const r=e.hasOwnProperty(n)&&t[n]!==!0;return t[n]=!1,r}function aE(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&&y4(d,f))continue;const g={delay:n,...Sv(o||{},f)};let x=!1;if(window.MotionHandoffAnimation){const v=EN(e);if(v){const y=window.MotionHandoffAnimation(v,f,Ee);y!==null&&(g.startTime=y,x=!0)}}Yp(e,f),h.start(zv(f,h,p,e.shouldReduceMotion&&kN.has(f)?{type:!1}:g,e,x));const w=h.animation;w&&u.push(w)}return l&&Promise.all(u).then(()=>{Ee.update(()=>{l&&Wz(e,l)})}),u}function sm(e,t,n={}){var r;const s=Od(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(aE(e,s,n)):()=>Promise.resolve(),l=e.variantChildren&&e.variantChildren.size?(u=0)=>{const{delayChildren:d=0,staggerChildren:f,staggerDirection:h}=i;return x4(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 x4(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(_4).forEach((u,d)=>{u.notify("AnimationStart",t),o.push(sm(u,t,{...i,delay:n+c(d)}).then(()=>u.notify("AnimationComplete",t)))}),Promise.all(o)}function _4(e,t){return e.sortNodePosition(t)}function w4(e,t,n={}){e.notify("AnimationStart",t);let r;if(Array.isArray(t)){const s=t.map(i=>sm(e,i,n));r=Promise.all(s)}else if(typeof t=="string")r=sm(e,t,n);else{const s=typeof t=="function"?Od(e,t,n.custom):t;r=Promise.all(aE(e,s,n))}return r.then(()=>{e.notify("AnimationComplete",t)})}const b4=fv.length;function lE(e){if(!e)return;if(!e.isControllingVariants){const n=e.parent?lE(e.parent)||{}:{};return e.props.initial!==void 0&&(n.initial=e.props.initial),n}const t={};for(let n=0;n<b4;n++){const r=fv[n],s=e.props[r];(Oa(s)||s===!1)&&(t[r]=s)}return t}const j4=[...dv].reverse(),S4=dv.length;function k4(e){return t=>Promise.all(t.map(({animation:n,options:r})=>w4(e,n,r)))}function N4(e){let t=k4(e),n=V_(),r=!0;const s=c=>(u,d)=>{var f;const h=Od(e,d,c==="exit"?(f=e.presenceContext)===null||f===void 0?void 0:f.custom:void 0);if(h){const{transition:p,transitionEnd:g,...x}=h;u={...u,...x,...g}}return u};function i(c){t=c(e)}function o(c){const{props:u}=e,d=lE(e.parent)||{},f=[],h=new Set;let p={},g=1/0;for(let w=0;w<S4;w++){const v=j4[w],y=n[v],m=u[v]!==void 0?u[v]:d[v],b=Oa(m),j=v===c?y.isActive:null;j===!1&&(g=w);let S=m===d[v]&&m!==u[v]&&b;if(S&&r&&e.manuallyAnimateOnMount&&(S=!1),y.protectedKeys={...p},!y.isActive&&j===null||!m&&!y.prevProp||Id(m)||typeof m=="boolean")continue;const k=E4(y.prevProp,m);let N=k||v===c&&y.isActive&&!S&&b||w>g&&b,A=!1;const O=Array.isArray(m)?m:[m];let D=O.reduce(s(v),{});j===!1&&(D={});const{prevResolvedValues:I={}}=y,z={...I,...D},T=C=>{N=!0,h.has(C)&&(A=!0,h.delete(C)),y.needsAnimating[C]=!0;const R=e.getValue(C);R&&(R.liveStyle=!1)};for(const C in z){const R=D[C],M=I[C];if(p.hasOwnProperty(C))continue;let B=!1;Gp(R)&&Gp(M)?B=!SN(R,M):B=R!==M,B?R!=null?T(C):h.add(C):R!==void 0&&h.has(C)?T(C):y.protectedKeys[C]=!0}y.prevProp=m,y.prevResolvedValues=D,y.isActive&&(p={...p,...D}),r&&e.blockInitialAnimation&&(N=!1),N&&(!(S&&k)||A)&&f.push(...O.map(C=>({animation:C,options:{type:v}})))}if(h.size){const w={};h.forEach(v=>{const y=e.getBaseTarget(v),m=e.getValue(v);m&&(m.liveStyle=!0),w[v]=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=V_(),r=!0}}}function E4(e,t){return typeof t=="string"?t!==e:Array.isArray(t)?!SN(t,e):!1}function os(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function V_(){return{animate:os(!0),whileInView:os(),whileHover:os(),whileTap:os(),whileDrag:os(),whileFocus:os(),exit:os()}}class ns{constructor(t){this.isMounted=!1,this.node=t}update(){}}class C4 extends ns{constructor(t){super(t),t.animationState||(t.animationState=N4(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();Id(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 T4=0;class P4 extends ns{constructor(){super(...arguments),this.id=T4++}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 A4={animation:{Feature:C4},exit:{Feature:P4}},an={x:!1,y:!1};function cE(){return an.x||an.y}function R4(e){return e==="x"||e==="y"?an[e]?null:(an[e]=!0,()=>{an[e]=!1}):an.x||an.y?null:(an.x=an.y=!0,()=>{an.x=an.y=!1})}const Fv=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1;function za(e,t,n,r={passive:!0}){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n)}function ml(e){return{point:{x:e.pageX,y:e.pageY}}}const I4=e=>t=>Fv(t)&&e(t,ml(t));function sa(e,t,n,r){return za(e,t,I4(n),r)}const B_=(e,t)=>Math.abs(e-t);function M4(e,t){const n=B_(e.x,t.x),r=B_(e.y,t.y);return Math.sqrt(n**2+r**2)}class uE{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=Xf(this.lastMoveEventInfo,this.history),h=this.startEvent!==null,p=M4(f.offset,{x:0,y:0})>=3;if(!h&&!p)return;const{point:g}=f,{timestamp:x}=Qe;this.history.push({...g,timestamp:x});const{onStart:w,onMove:v}=this.handlers;h||(w&&w(this.lastMoveEvent,f),this.startEvent=this.lastMoveEvent),v&&v(this.lastMoveEvent,f)},this.handlePointerMove=(f,h)=>{this.lastMoveEvent=f,this.lastMoveEventInfo=Yf(h,this.transformPagePoint),Ee.update(this.updatePoint,!0)},this.handlePointerUp=(f,h)=>{this.end();const{onEnd:p,onSessionEnd:g,resumeAnimation:x}=this.handlers;if(this.dragSnapToOrigin&&x&&x(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const w=Xf(f.type==="pointercancel"?this.lastMoveEventInfo:Yf(h,this.transformPagePoint),this.history);this.startEvent&&p&&p(f,w),g&&g(f,w)},!Fv(t))return;this.dragSnapToOrigin=i,this.handlers=n,this.transformPagePoint=r,this.contextWindow=s||window;const o=ml(t),l=Yf(o,this.transformPagePoint),{point:c}=l,{timestamp:u}=Qe;this.history=[{...c,timestamp:u}];const{onSessionStart:d}=n;d&&d(t,Xf(l,this.history)),this.removeListeners=pl(sa(this.contextWindow,"pointermove",this.handlePointerMove),sa(this.contextWindow,"pointerup",this.handlePointerUp),sa(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),Xr(this.updatePoint)}}function Yf(e,t){return t?{point:t(e.point)}:e}function U_(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Xf({point:e},t){return{point:e,delta:U_(e,dE(t)),offset:U_(e,O4(t)),velocity:L4(t,.1)}}function O4(e){return e[0]}function dE(e){return e[e.length-1]}function L4(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,r=null;const s=dE(e);for(;n>=0&&(r=e[n],!(s.timestamp-r.timestamp>ur(t)));)n--;if(!r)return{x:0,y:0};const i=dr(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 fE=1e-4,$4=1-fE,D4=1+fE,hE=.01,z4=0-hE,F4=0+hE;function It(e){return e.max-e.min}function V4(e,t,n){return Math.abs(e-t)<=n}function H_(e,t,n,r=.5){e.origin=r,e.originPoint=Ie(t.min,t.max,e.origin),e.scale=It(n)/It(t),e.translate=Ie(n.min,n.max,e.origin)-e.originPoint,(e.scale>=$4&&e.scale<=D4||isNaN(e.scale))&&(e.scale=1),(e.translate>=z4&&e.translate<=F4||isNaN(e.translate))&&(e.translate=0)}function ia(e,t,n,r){H_(e.x,t.x,n.x,r?r.originX:void 0),H_(e.y,t.y,n.y,r?r.originY:void 0)}function W_(e,t,n){e.min=n.min+t.min,e.max=e.min+It(t)}function B4(e,t,n){W_(e.x,t.x,n.x),W_(e.y,t.y,n.y)}function K_(e,t,n){e.min=t.min-n.min,e.max=e.min+It(t)}function oa(e,t,n){K_(e.x,t.x,n.x),K_(e.y,t.y,n.y)}function U4(e,{min:t,max:n},r){return t!==void 0&&e<t?e=r?Ie(t,e,r.min):Math.max(e,t):n!==void 0&&e>n&&(e=r?Ie(n,e,r.max):Math.min(e,n)),e}function q_(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 H4(e,{top:t,left:n,bottom:r,right:s}){return{x:q_(e.x,n,s),y:q_(e.y,t,r)}}function G_(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 W4(e,t){return{x:G_(e.x,t.x),y:G_(e.y,t.y)}}function K4(e,t){let n=.5;const r=It(e),s=It(t);return s>r?n=Gi(t.min,t.max-r,e.min):r>s&&(n=Gi(e.min,e.max-s,t.min)),wr(0,1,n)}function q4(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 im=.35;function G4(e=im){return e===!1?e=0:e===!0&&(e=im),{x:Y_(e,"left","right"),y:Y_(e,"top","bottom")}}function Y_(e,t,n){return{min:X_(e,t),max:X_(e,n)}}function X_(e,t){return typeof e=="number"?e:e[t]||0}const Q_=()=>({translate:0,scale:1,origin:0,originPoint:0}),yi=()=>({x:Q_(),y:Q_()}),Z_=()=>({min:0,max:0}),Fe=()=>({x:Z_(),y:Z_()});function Ut(e){return[e("x"),e("y")]}function pE({top:e,left:t,right:n,bottom:r}){return{x:{min:t,max:n},y:{min:e,max:r}}}function Y4({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function X4(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 Qf(e){return e===void 0||e===1}function om({scale:e,scaleX:t,scaleY:n}){return!Qf(e)||!Qf(t)||!Qf(n)}function fs(e){return om(e)||mE(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function mE(e){return J_(e.x)||J_(e.y)}function J_(e){return e&&e!=="0%"}function $u(e,t,n){const r=e-n,s=t*r;return n+s}function e0(e,t,n,r,s){return s!==void 0&&(e=$u(e,s,r)),$u(e,n,r)+t}function am(e,t=0,n=1,r,s){e.min=e0(e.min,t,n,r,s),e.max=e0(e.max,t,n,r,s)}function gE(e,{x:t,y:n}){am(e.x,t.translate,t.scale,t.originPoint),am(e.y,n.translate,n.scale,n.originPoint)}const t0=.999999999999,n0=1.0000000000001;function Q4(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&&_i(e,{x:-i.scroll.offset.x,y:-i.scroll.offset.y}),o&&(t.x*=o.x.scale,t.y*=o.y.scale,gE(e,o)),r&&fs(i.latestValues)&&_i(e,i.latestValues))}t.x<n0&&t.x>t0&&(t.x=1),t.y<n0&&t.y>t0&&(t.y=1)}function xi(e,t){e.min=e.min+t,e.max=e.max+t}function r0(e,t,n,r,s=.5){const i=Ie(e.min,e.max,s);am(e,t,n,i,r)}function _i(e,t){r0(e.x,t.x,t.scaleX,t.scale,t.originX),r0(e.y,t.y,t.scaleY,t.scale,t.originY)}function vE(e,t){return pE(X4(e.getBoundingClientRect(),t))}function Z4(e,t,n){const r=vE(e,n),{scroll:s}=t;return s&&(xi(r.x,s.offset.x),xi(r.y,s.offset.y)),r}const yE=({current:e})=>e?e.ownerDocument.defaultView:null,J4=new WeakMap;class eV{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=Fe(),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(ml(d).point)},i=(d,f)=>{const{drag:h,dragPropagation:p,onDragStart:g}=this.getProps();if(h&&!p&&(this.openDragLock&&this.openDragLock(),this.openDragLock=R4(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),Ut(w=>{let v=this.getAxisMotionValue(w).get()||0;if(Bn.test(v)){const{projection:y}=this.visualElement;if(y&&y.layout){const m=y.layout.layoutBox[w];m&&(v=It(m)*(parseFloat(v)/100))}}this.originPoint[w]=v}),g&&Ee.postRender(()=>g(d,f)),Yp(this.visualElement,"transform");const{animationState:x}=this.visualElement;x&&x.setActive("whileDrag",!0)},o=(d,f)=>{const{dragPropagation:h,dragDirectionLock:p,onDirectionLock:g,onDrag:x}=this.getProps();if(!h&&!this.openDragLock)return;const{offset:w}=f;if(p&&this.currentDirection===null){this.currentDirection=tV(w),this.currentDirection!==null&&g&&g(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=()=>Ut(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 uE(t,{onSessionStart:s,onStart:i,onMove:o,onSessionEnd:l,resumeAnimation:c},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:u,contextWindow:yE(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&&Ee.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||!Xl(t,s,this.currentDirection))return;const i=this.getAxisMotionValue(t);let o=this.originPoint[t]+r[t];this.constraints&&this.constraints[t]&&(o=U4(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&&gi(n)?this.constraints||(this.constraints=this.resolveRefConstraints()):n&&s?this.constraints=H4(s.layoutBox,n):this.constraints=!1,this.elastic=G4(r),i!==this.constraints&&s&&this.constraints&&!this.hasMutatedConstraints&&Ut(o=>{this.constraints!==!1&&this.getAxisMotionValue(o)&&(this.constraints[o]=q4(s.layoutBox[o],this.constraints[o]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:n}=this.getProps();if(!t||!gi(t))return!1;const r=t.current,{projection:s}=this.visualElement;if(!s||!s.layout)return!1;const i=Z4(r,s.root,this.visualElement.getTransformPagePoint());let o=W4(s.layout.layoutBox,i);if(n){const l=n(Y4(o));this.hasMutatedConstraints=!!l,l&&(o=pE(l))}return o}startAnimation(t){const{drag:n,dragMomentum:r,dragElastic:s,dragTransition:i,dragSnapToOrigin:o,onDragTransitionEnd:l}=this.getProps(),c=this.constraints||{},u=Ut(d=>{if(!Xl(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,g={type:"inertia",velocity:r?t[d]:0,bounceStiffness:h,bounceDamping:p,timeConstant:750,restDelta:1,restSpeed:10,...i,...f};return this.startAxisValueAnimation(d,g)});return Promise.all(u).then(l)}startAxisValueAnimation(t,n){const r=this.getAxisMotionValue(t);return Yp(this.visualElement,t),r.start(zv(t,r,0,n,this.visualElement,!1))}stopAnimation(){Ut(t=>this.getAxisMotionValue(t).stop())}pauseAnimation(){Ut(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){Ut(n=>{const{drag:r}=this.getProps();if(!Xl(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]-Ie(o,l,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:n}=this.getProps(),{projection:r}=this.visualElement;if(!gi(n)||!r||!this.constraints)return;this.stopAnimation();const s={x:0,y:0};Ut(o=>{const l=this.getAxisMotionValue(o);if(l&&this.constraints!==!1){const c=l.get();s[o]=K4({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(),Ut(o=>{if(!Xl(o,t,null))return;const l=this.getAxisMotionValue(o),{min:c,max:u}=this.constraints[o];l.set(Ie(c,u,s[o]))})}addListeners(){if(!this.visualElement.current)return;J4.set(this.visualElement,this);const t=this.visualElement.current,n=sa(t,"pointerdown",c=>{const{drag:u,dragListener:d=!0}=this.getProps();u&&d&&this.start(c)}),r=()=>{const{dragConstraints:c}=this.getProps();gi(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()),Ee.read(r);const o=za(window,"resize",()=>this.scalePositionWithinConstraints()),l=s.addEventListener("didUpdate",({delta:c,hasLayoutChanged:u})=>{this.isDragging&&u&&(Ut(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=im,dragMomentum:l=!0}=t;return{...t,drag:n,dragDirectionLock:r,dragPropagation:s,dragConstraints:i,dragElastic:o,dragMomentum:l}}}function Xl(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function tV(e,t=10){let n=null;return Math.abs(e.y)>t?n="y":Math.abs(e.x)>t&&(n="x"),n}class nV extends ns{constructor(t){super(t),this.removeGroupControls=At,this.removeListeners=At,this.controls=new eV(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||At}unmount(){this.removeGroupControls(),this.removeListeners()}}const s0=e=>(t,n)=>{e&&Ee.postRender(()=>e(t,n))};class rV extends ns{constructor(){super(...arguments),this.removePointerDownListener=At}onPointerDown(t){this.session=new uE(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:yE(this.node)})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:n,onPan:r,onPanEnd:s}=this.node.getProps();return{onSessionStart:s0(t),onStart:s0(n),onMove:r,onEnd:(i,o)=>{delete this.session,s&&Ee.postRender(()=>s(i,o))}}}mount(){this.removePointerDownListener=sa(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 Lc={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function i0(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}const To={correct:(e,t)=>{if(!t.target)return e;if(typeof e=="string")if(ie.test(e))e=parseFloat(e);else return e;const n=i0(e,t.target.x),r=i0(e,t.target.y);return`${n}% ${r}%`}},sV={correct:(e,{treeScale:t,projectionDelta:n})=>{const r=e,s=Qr.parse(e);if(s.length>5)return r;const i=Qr.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=Ie(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 iV extends _.Component{componentDidMount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:r,layoutId:s}=this.props,{projection:i}=t;Az(oV),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()})),Lc.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()||Ee.postRender(()=>{const l=o.getStack();(!l||!l.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:t}=this.props.visualElement;t&&(t.root.didUpdate(),pv.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 xE(e){const[t,n]=rN(),r=_.useContext(av);return a.jsx(iV,{...e,layoutGroup:r,switchLayoutGroup:_.useContext(dN),isPresent:t,safeToRemove:n})}const oV={borderRadius:{...To,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:To,borderTopRightRadius:To,borderBottomLeftRadius:To,borderBottomRightRadius:To,boxShadow:sV};function aV(e,t,n){const r=at(e)?e:$a(e);return r.start(zv("",r,t,n)),r.animation}function lV(e){return e instanceof SVGElement&&e.tagName!=="svg"}const cV=(e,t)=>e.depth-t.depth;class uV{constructor(){this.children=[],this.isDirty=!1}add(t){kv(this.children,t),this.isDirty=!0}remove(t){Nv(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(cV),this.isDirty=!1,this.children.forEach(t)}}function dV(e,t){const n=Un.now(),r=({timestamp:s})=>{const i=s-n;i>=t&&(Xr(r),e(i-t))};return Ee.read(r,!0),()=>Xr(r)}const _E=["TopLeft","TopRight","BottomLeft","BottomRight"],fV=_E.length,o0=e=>typeof e=="string"?parseFloat(e):e,a0=e=>typeof e=="number"||ie.test(e);function hV(e,t,n,r,s,i){s?(e.opacity=Ie(0,n.opacity!==void 0?n.opacity:1,pV(r)),e.opacityExit=Ie(t.opacity!==void 0?t.opacity:1,0,mV(r))):i&&(e.opacity=Ie(t.opacity!==void 0?t.opacity:1,n.opacity!==void 0?n.opacity:1,r));for(let o=0;o<fV;o++){const l=`border${_E[o]}Radius`;let c=l0(t,l),u=l0(n,l);if(c===void 0&&u===void 0)continue;c||(c=0),u||(u=0),c===0||u===0||a0(c)===a0(u)?(e[l]=Math.max(Ie(o0(c),o0(u),r),0),(Bn.test(u)||Bn.test(c))&&(e[l]+="%")):e[l]=u}(t.rotate||n.rotate)&&(e.rotate=Ie(t.rotate||0,n.rotate||0,r))}function l0(e,t){return e[t]!==void 0?e[t]:e.borderRadius}const pV=wE(0,.5,$N),mV=wE(.5,.95,At);function wE(e,t,n){return r=>r<e?0:r>t?1:n(Gi(e,t,r))}function c0(e,t){e.min=t.min,e.max=t.max}function Vt(e,t){c0(e.x,t.x),c0(e.y,t.y)}function u0(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}function d0(e,t,n,r,s){return e-=t,e=$u(e,1/n,r),s!==void 0&&(e=$u(e,1/s,r)),e}function gV(e,t=0,n=1,r=.5,s,i=e,o=e){if(Bn.test(t)&&(t=parseFloat(t),t=Ie(o.min,o.max,t/100)-o.min),typeof t!="number")return;let l=Ie(i.min,i.max,r);e===i&&(l-=t),e.min=d0(e.min,t,n,l,s),e.max=d0(e.max,t,n,l,s)}function f0(e,t,[n,r,s],i,o){gV(e,t[n],t[r],t[s],t.scale,i,o)}const vV=["x","scaleX","originX"],yV=["y","scaleY","originY"];function h0(e,t,n,r){f0(e.x,t,vV,n?n.x:void 0,r?r.x:void 0),f0(e.y,t,yV,n?n.y:void 0,r?r.y:void 0)}function p0(e){return e.translate===0&&e.scale===1}function bE(e){return p0(e.x)&&p0(e.y)}function m0(e,t){return e.min===t.min&&e.max===t.max}function xV(e,t){return m0(e.x,t.x)&&m0(e.y,t.y)}function g0(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function jE(e,t){return g0(e.x,t.x)&&g0(e.y,t.y)}function v0(e){return It(e.x)/It(e.y)}function y0(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}class _V{constructor(){this.members=[]}add(t){kv(this.members,t),t.scheduleRender()}remove(t){if(Nv(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 wV(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:g}=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) `),g&&(r+=`skewY(${g}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 hs={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0},zo=typeof window<"u"&&window.MotionDebug!==void 0,Zf=["","X","Y","Z"],bV={visibility:"hidden"},x0=1e3;let jV=0;function Jf(e,t,n,r){const{latestValues:s}=t;s[e]&&(n[e]=s[e],t.setStaticValue(e,0),r&&(r[e]=0))}function SE(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;const{visualElement:t}=e.options;if(!t)return;const n=EN(t);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:s,layoutId:i}=e.options;window.MotionCancelOptimisedAnimation(n,"transform",Ee,!(s||i))}const{parent:r}=e;r&&!r.hasCheckedOptimisedAppear&&SE(r)}function kE({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:r,resetTransform:s}){return class{constructor(o={},l=t==null?void 0:t()){this.id=jV++,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,zo&&(hs.totalNodes=hs.resolvedTargetDeltas=hs.recalculatedProjection=0),this.nodes.forEach(NV),this.nodes.forEach(AV),this.nodes.forEach(RV),this.nodes.forEach(EV),zo&&window.MotionDebug.record(hs)},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 uV)}addEventListener(o,l){return this.eventHandlers.has(o)||this.eventHandlers.set(o,new Ev),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=lV(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=dV(h,250),Lc.hasAnimatedSinceResize&&(Lc.hasAnimatedSinceResize=!1,this.nodes.forEach(w0))})}c&&this.root.registerSharedNode(c,this),this.options.animate!==!1&&d&&(c||u)&&this.addEventListener("didUpdate",({delta:f,hasLayoutChanged:h,hasRelativeTargetChanged:p,layout:g})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const x=this.options.transition||d.getDefaultTransition()||$V,{onLayoutAnimationStart:w,onLayoutAnimationComplete:v}=d.getProps(),y=!this.targetLayout||!jE(this.targetLayout,g)||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 b={...Sv(x,"layout"),onPlay:w,onComplete:v};(d.shouldReduceMotion||this.options.layoutRoot)&&(b.delay=0,b.type=!1),this.startAnimation(b)}else h||w0(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=g})}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,Xr(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(IV),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&&SE(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(_0);return}this.isUpdating||this.nodes.forEach(TV),this.isUpdating=!1,this.nodes.forEach(PV),this.nodes.forEach(SV),this.nodes.forEach(kV),this.clearAllSnapshots();const l=Un.now();Qe.delta=wr(0,1e3/60,l-Qe.timestamp),Qe.timestamp=l,Qe.isProcessing=!0,Hf.update.process(Qe),Hf.preRender.process(Qe),Hf.render.process(Qe),Qe.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,pv.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(CV),this.sharedNodes.forEach(MV)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,Ee.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){Ee.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=Fe(),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&&!bE(this.projectionDelta),c=this.getTransformTemplate(),u=c?c(this.latestValues,""):void 0,d=u!==this.prevTransformTemplateValue;o&&(l||fs(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)),DV(c),{animationId:this.root.animationId,measuredBox:l,layoutBox:c,latestValues:{},source:this.id}}measurePageBox(){var o;const{visualElement:l}=this.options;if(!l)return Fe();const c=l.measureViewportBox();if(!(((o=this.scroll)===null||o===void 0?void 0:o.wasRoot)||this.path.some(zV))){const{scroll:d}=this.root;d&&(xi(c.x,d.offset.x),xi(c.y,d.offset.y))}return c}removeElementScroll(o){var l;const c=Fe();if(Vt(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&&Vt(c,o),xi(c.x,f.offset.x),xi(c.y,f.offset.y))}return c}applyTransform(o,l=!1){const c=Fe();Vt(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&&_i(c,{x:-d.scroll.offset.x,y:-d.scroll.offset.y}),fs(d.latestValues)&&_i(c,d.latestValues)}return fs(this.latestValues)&&_i(c,this.latestValues),c}removeTransform(o){const l=Fe();Vt(l,o);for(let c=0;c<this.path.length;c++){const u=this.path[c];if(!u.instance||!fs(u.latestValues))continue;om(u.latestValues)&&u.updateSnapshot();const d=Fe(),f=u.measurePageBox();Vt(d,f),h0(l,u.latestValues,u.snapshot?u.snapshot.layoutBox:void 0,d)}return fs(this.latestValues)&&h0(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=Fe(),this.relativeTargetOrigin=Fe(),oa(this.relativeTargetOrigin,this.layout.layoutBox,p.layout.layoutBox),Vt(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}if(!(!this.relativeTarget&&!this.targetDelta)){if(this.target||(this.target=Fe(),this.targetWithTransforms=Fe()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),B4(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):Vt(this.target,this.layout.layoutBox),gE(this.target,this.targetDelta)):Vt(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=Fe(),this.relativeTargetOrigin=Fe(),oa(this.relativeTargetOrigin,this.target,p.target),Vt(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}zo&&hs.resolvedTargetDeltas++}}}getClosestProjectingParent(){if(!(!this.parent||om(this.parent.latestValues)||mE(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;Vt(this.layoutCorrected,this.layout.layoutBox);const h=this.treeScale.x,p=this.treeScale.y;Q4(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=Fe());const{target:g}=l;if(!g){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(u0(this.prevProjectionDelta.x,this.projectionDelta.x),u0(this.prevProjectionDelta.y,this.projectionDelta.y)),ia(this.projectionDelta,this.layoutCorrected,g,this.latestValues),(this.treeScale.x!==h||this.treeScale.y!==p||!y0(this.projectionDelta.x,this.prevProjectionDelta.x)||!y0(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",g)),zo&&hs.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=yi(),this.projectionDelta=yi(),this.projectionDeltaWithTransform=yi()}setAnimationOrigin(o,l=!1){const c=this.snapshot,u=c?c.latestValues:{},d={...this.latestValues},f=yi();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!l;const h=Fe(),p=c?c.source:void 0,g=this.layout?this.layout.source:void 0,x=p!==g,w=this.getStack(),v=!w||w.members.length<=1,y=!!(x&&!v&&this.options.crossfade===!0&&!this.path.some(LV));this.animationProgress=0;let m;this.mixTargetDelta=b=>{const j=b/1e3;b0(f.x,o.x,j),b0(f.y,o.y,j),this.setTargetDelta(f),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(oa(h,this.layout.layoutBox,this.relativeParent.layout.layoutBox),OV(this.relativeTarget,this.relativeTargetOrigin,h,j),m&&xV(this.relativeTarget,m)&&(this.isProjectionDirty=!1),m||(m=Fe()),Vt(m,this.relativeTarget)),x&&(this.animationValues=d,hV(d,u,this.latestValues,j,y,v)),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&&(Xr(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=Ee.update(()=>{Lc.hasAnimatedSinceResize=!0,this.currentAnimation=aV(0,x0,{...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(x0),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&&NE(this.options.animationType,this.layout.layoutBox,u.layoutBox)){c=this.target||Fe();const f=It(this.layout.layoutBox.x);c.x.min=o.target.x.min,c.x.max=c.x.min+f;const h=It(this.layout.layoutBox.y);c.y.min=o.target.y.min,c.y.max=c.y.min+h}Vt(l,c),_i(l,d),ia(this.projectionDeltaWithTransform,this.layoutCorrected,l,d)}}registerSharedNode(o,l){this.sharedNodes.has(o)||this.sharedNodes.set(o,new _V),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&&Jf("z",o,u,this.animationValues);for(let d=0;d<Zf.length;d++)Jf(`rotate${Zf[d]}`,o,u,this.animationValues),Jf(`skew${Zf[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 bV;const u={visibility:""},d=this.getTransformTemplate();if(this.needsReset)return this.needsReset=!1,u.opacity="",u.pointerEvents=Mc(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=Mc(o==null?void 0:o.pointerEvents)||""),this.hasProjected&&!fs(this.latestValues)&&(x.transform=d?d({},""):"none",this.hasProjected=!1),x}const h=f.animationValues||f.latestValues;this.applyTransformsToTarget(),u.transform=wV(this.projectionDeltaWithTransform,this.treeScale,h),d&&(u.transform=d(h,u.transform));const{x:p,y:g}=this.projectionDelta;u.transformOrigin=`${p.origin*100}% ${g.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:v}=Ru[x],y=u.transform==="none"?h[x]:w(h[x],f);if(v){const m=v.length;for(let b=0;b<m;b++)u[v[b]]=y}else u[x]=y}return this.options.layoutId&&(u.pointerEvents=f===this?Mc(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(_0),this.root.sharedNodes.clear()}}}function SV(e){e.updateLayout()}function kV(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"?Ut(f=>{const h=o?n.measuredBox[f]:n.layoutBox[f],p=It(h);h.min=r[f].min,h.max=h.min+p}):NE(i,n.layoutBox,r)&&Ut(f=>{const h=o?n.measuredBox[f]:n.layoutBox[f],p=It(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=yi();ia(l,r,n.layoutBox);const c=yi();o?ia(c,e.applyTransform(s,!0),n.measuredBox):ia(c,r,n.layoutBox);const u=!bE(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 g=Fe();oa(g,n.layoutBox,h.layoutBox);const x=Fe();oa(x,r,p.layoutBox),jE(g,x)||(d=!0),f.options.layoutRoot&&(e.relativeTarget=x,e.relativeTargetOrigin=g,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 NV(e){zo&&hs.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 EV(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function CV(e){e.clearSnapshot()}function _0(e){e.clearMeasurements()}function TV(e){e.isLayoutDirty=!1}function PV(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function w0(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function AV(e){e.resolveTargetDelta()}function RV(e){e.calcProjection()}function IV(e){e.resetSkewAndRotation()}function MV(e){e.removeLeadSnapshot()}function b0(e,t,n){e.translate=Ie(t.translate,0,n),e.scale=Ie(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function j0(e,t,n,r){e.min=Ie(t.min,n.min,r),e.max=Ie(t.max,n.max,r)}function OV(e,t,n,r){j0(e.x,t.x,n.x,r),j0(e.y,t.y,n.y,r)}function LV(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}const $V={duration:.45,ease:[.4,0,.1,1]},S0=e=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),k0=S0("applewebkit/")&&!S0("chrome/")?Math.round:At;function N0(e){e.min=k0(e.min),e.max=k0(e.max)}function DV(e){N0(e.x),N0(e.y)}function NE(e,t,n){return e==="position"||e==="preserve-aspect"&&!V4(v0(t),v0(n),.2)}function zV(e){var t;return e!==e.root&&((t=e.scroll)===null||t===void 0?void 0:t.wasRoot)}const FV=kE({attachResizeListener:(e,t)=>za(e,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),eh={current:void 0},EE=kE({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!eh.current){const e=new FV({});e.mount(window),e.setOptions({layoutScroll:!0}),eh.current=e}return eh.current},resetTransform:(e,t)=>{e.style.transform=t!==void 0?t:"none"},checkIsScrollRoot:e=>window.getComputedStyle(e).position==="fixed"}),VV={pan:{Feature:rV},drag:{Feature:nV,ProjectionNode:EE,MeasureLayout:xE}};function BV(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 CE(e,t){const n=BV(e),r=new AbortController,s={passive:!0,...t,signal:r.signal};return[n,s,()=>r.abort()]}function E0(e){return t=>{t.pointerType==="touch"||cE()||e(t)}}function UV(e,t,n={}){const[r,s,i]=CE(e,n),o=E0(l=>{const{target:c}=l,u=t(l);if(typeof u!="function"||!c)return;const d=E0(f=>{u(f),c.removeEventListener("pointerleave",d)});c.addEventListener("pointerleave",d,s)});return r.forEach(l=>{l.addEventListener("pointerenter",o,s)}),i}function C0(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&&Ee.postRender(()=>i(t,ml(t)))}class HV extends ns{mount(){const{current:t}=this.node;t&&(this.unmount=UV(t,n=>(C0(this.node,n,"Start"),r=>C0(this.node,r,"End"))))}unmount(){}}class WV extends ns{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=pl(za(this.node.current,"focus",()=>this.onFocus()),za(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}const TE=(e,t)=>t?e===t?!0:TE(e,t.parentElement):!1,KV=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function qV(e){return KV.has(e.tagName)||e.tabIndex!==-1}const Fo=new WeakSet;function T0(e){return t=>{t.key==="Enter"&&e(t)}}function th(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}const GV=(e,t)=>{const n=e.currentTarget;if(!n)return;const r=T0(()=>{if(Fo.has(n))return;th(n,"down");const s=T0(()=>{th(n,"up")}),i=()=>th(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 P0(e){return Fv(e)&&!cE()}function YV(e,t,n={}){const[r,s,i]=CE(e,n),o=l=>{const c=l.currentTarget;if(!P0(l)||Fo.has(c))return;Fo.add(c);const u=t(l),d=(p,g)=>{window.removeEventListener("pointerup",f),window.removeEventListener("pointercancel",h),!(!P0(p)||!Fo.has(c))&&(Fo.delete(c),typeof u=="function"&&u(p,{success:g}))},f=p=>{d(p,n.useGlobalTarget||TE(c,p.target))},h=p=>{d(p,!1)};window.addEventListener("pointerup",f,s),window.addEventListener("pointercancel",h,s)};return r.forEach(l=>{!qV(l)&&l.getAttribute("tabindex")===null&&(l.tabIndex=0),(n.useGlobalTarget?window:l).addEventListener("pointerdown",o,s),l.addEventListener("focus",u=>GV(u,s),s)}),i}function A0(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&&Ee.postRender(()=>i(t,ml(t)))}class XV extends ns{mount(){const{current:t}=this.node;t&&(this.unmount=YV(t,n=>(A0(this.node,n,"Start"),(r,{success:s})=>A0(this.node,r,s?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const lm=new WeakMap,nh=new WeakMap,QV=e=>{const t=lm.get(e.target);t&&t(e)},ZV=e=>{e.forEach(QV)};function JV({root:e,...t}){const n=e||document;nh.has(n)||nh.set(n,{});const r=nh.get(n),s=JSON.stringify(t);return r[s]||(r[s]=new IntersectionObserver(ZV,{root:e,...t})),r[s]}function e5(e,t,n){const r=JV(t);return lm.set(e,n),r.observe(e),()=>{lm.delete(e),r.unobserve(e)}}const t5={some:0,all:1};class n5 extends ns{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:t5[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 e5(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(r5(t,n))&&this.startObserver()}unmount(){}}function r5({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}const s5={inView:{Feature:n5},tap:{Feature:XV},focus:{Feature:WV},hover:{Feature:HV}},i5={layout:{ProjectionNode:EE,MeasureLayout:xE}},cm={current:null},PE={current:!1};function o5(){if(PE.current=!0,!!uv)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>cm.current=e.matches;e.addListener(t),t()}else cm.current=!1}const a5=[...QN,st,Qr],l5=e=>a5.find(XN(e)),R0=new WeakMap;function c5(e,t,n){for(const r in t){const s=t[r],i=n[r];if(at(s))e.addValue(r,s);else if(at(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 I0=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class u5{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=Lv,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=Un.now();this.renderScheduledAt<p&&(this.renderScheduledAt=p,Ee.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=Md(n),this.isVariantNode=cN(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 g=h[p];c[p]!==void 0&&at(g)&&g.set(c[p],!1)}}mount(t){this.current=t,R0.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)),PE.current||o5(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:cm.current,this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){R0.delete(this.current),this.projection&&this.projection.unmount(),Xr(this.notifyUpdate),Xr(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=Xs.has(t),s=n.on("change",l=>{this.latestValues[t]=l,this.props.onUpdate&&Ee.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 qi){const n=qi[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):Fe()}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<I0.length;r++){const s=I0[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=c5(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"&&(GN(s)||zN(s))?s=parseFloat(s):!l5(s)&&Qr.test(n)&&(s=WN(t,n)),this.setBaseTarget(t,at(s)?s.get():s)),at(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=gv(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&&!at(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 Ev),this.events[t].add(n)}notify(t,...n){this.events[t]&&this.events[t].notify(...n)}}class AE extends u5{constructor(){super(...arguments),this.KeyframeResolver=ZN}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;at(t)&&(this.childSubscription=t.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}}function d5(e){return window.getComputedStyle(e)}class f5 extends AE{constructor(){super(...arguments),this.type="html",this.renderInstance=yN}readValueFromInstance(t,n){if(Xs.has(n)){const r=Ov(n);return r&&r.default||0}else{const r=d5(t),s=(mN(n)?r.getPropertyValue(n):r[n])||0;return typeof s=="string"?s.trim():s}}measureInstanceViewportBox(t,{transformPagePoint:n}){return vE(t,n)}build(t,n,r){xv(t,n,r.transformTemplate)}scrapeMotionValuesFromProps(t,n,r){return jv(t,n,r)}}class h5 extends AE{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=Fe}getBaseTargetFromProps(t,n){return t[n]}readValueFromInstance(t,n){if(Xs.has(n)){const r=Ov(n);return r&&r.default||0}return n=xN.has(n)?n:hv(n),t.getAttribute(n)}scrapeMotionValuesFromProps(t,n,r){return bN(t,n,r)}build(t,n,r){_v(t,n,this.isSVGTag,r.transformTemplate)}renderInstance(t,n,r,s){_N(t,n,r,s)}mount(t){this.isSVGTag=bv(t.tagName),super.mount(t)}}const p5=(e,t)=>mv(e)?new h5(t):new f5(t,{allowProjection:e!==_.Fragment}),m5=Fz({...A4,...s5,...VV,...i5},p5),Ze=tz(m5),Vv={type:"spring",stiffness:500,damping:30,mass:.8};({...Vv});const g5={hidden:{opacity:0,scale:.95},visible:{opacity:1,scale:1,transition:Vv},exit:{opacity:0,scale:.97,transition:{duration:.15}}},Ct={hidden:{opacity:0,y:8},visible:{opacity:1,y:0},exit:{opacity:0,y:-4,transition:{duration:.1}}},RE={hidden:{opacity:0},visible:{opacity:1,transition:{staggerChildren:.06,delayChildren:.02}}},v5={hidden:{opacity:0,scale:.9},visible:{opacity:1,scale:1,transition:{...Vv,stiffness:420,damping:26}}},M0=[{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 IE(){return M0}function rh(e){return IE().find(n=>n.id===e)??null}const O0=/\.(json|ya?ml|ts|js|md|txt)$/i,y5=new Set(["runtime","traces","node_modules"]),L0=/(^|\/)\.(_|DS_Store)/;function $0(e){const t=e.split("/")[0]??"";return y5.has(t)}async function x5(e){const t=Array.from(e),n=[];for(const s of t)if(s.name.toLowerCase().endsWith(".zip")){const o=await eN(s),l=w5(Object.keys(o));for(const[c,u]of Object.entries(o)){const d=l(c).replace(/^\/+/,"");!d||L0.test(d)||$0(d)||!O0.test(d)||n.push({path:d,content:u})}}else{const o=_5(s);if(!o||L0.test(o)||$0(o)||!O0.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 _5(e){var n;const t=(n=e.webkitRelativePath)==null?void 0:n.trim();return t&&t.includes("/")?ME(t):e.name}function w5(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=>ME(s):s=>s}function ME(e){const t=e.split("/");return t.length>1?t.slice(1).join("/"):e}function D0(e){return/\.zip$/i.test(e.name)}function z0(e){return e.name.replace(/\.aitable-workflow\.zip$|\.zip$/i,"")||"导入项目"}function OE(e){return e.some(t=>/(^|\/)workflow\.ya?ml$/i.test(t.path.replace(/\\/g,"/")))}function b5(e,t){return{identity:{id:"imported_init",projectId:e,stage:"init",attempt:1,startedAt:t,updatedAt:t,completedAt:t},state:{phase:"ready",warnings:[],roleFiles:[]},next:{kind:"idle"}}}function j5(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:"未检测到角色定义,可后续添加"}),OE(e)||t.push({path:"workflow.yml",status:"warning",detail:"未包含工作流,导入后可在「设计」阶段生成"}),{items:t,envMissing:n}}function S5({onClose:e}){const t=Sr(),n=IE(),r=_.useRef(null),[s,i]=_.useState("upload"),[o,l]=_.useState(!1),[c,u]=_.useState(!1),[d,f]=_.useState(null),[h,p]=_.useState([]),[g,x]=_.useState([]),[w,v]=_.useState([]),[y,m]=_.useState(null),[b,j]=_.useState(!1),[S,k]=_.useState(!1),[N,A]=_.useState(null),[O,D]=_.useState(""),[I,z]=_.useState(null);async function T($){var W,U,q,Q,K;u(!0),f(null);const F=Array.from($),H=F.length===1&&D0(F[0]);z(H?F[0]:null);try{const G=F.length>=1&&F.every(ye=>/\.aitable-workflow\.zip$|\.zip$/i.test(ye.name))?await E(F).catch(()=>null):null,te=(G==null?void 0:G.files)??await x5($);if(te.length===0){if(H){p([]),x([{path:F[0].name,status:"warning",detail:"浏览器未解析出可预览文件,导入时将交给服务端 import-zip 解析"}]),v([]),l(!0),D(z0(F[0]));return}f("未解析到可导入的文件(仅支持 .json/.yml/.yaml/.ts/.js/.md/.txt,且不能位于 runtime/traces/node_modules)"),l(!1),p([]),x([]),v([]);return}const{items:ne,envMissing:Y}=j5(te);for(const ye of(G==null?void 0:G.checksumWarnings)??[])ne.push({path:ye,status:"warning",detail:"checksum 校验"});p(te),x(ne),v(Y),l(!0);const J=(W=G==null?void 0:G.title)==null?void 0:W.trim(),se=(U=te.find(ye=>ye.path==="aitable-workflow.config.yml"||ye.path.endsWith(".config.yml")))==null?void 0:U.content,le=se?((q=/^name:\s*(?:"([^"]*)"|'([^']*)'|([^#\n]*))/m.exec(se))==null?void 0:q[1])??((Q=/^name:\s*(?:"([^"]*)"|'([^']*)'|([^#\n]*))/m.exec(se))==null?void 0:Q[3]):null,fe=J||(le!=null&&le.trim()?le.trim():"")||((K=F.find(D0))==null?void 0:K.name.replace(/\.aitable-workflow\.zip$|\.zip$/i,""))||"导入项目";D(fe)}catch(G){if(H){p([]),x([{path:F[0].name,status:"warning",detail:"本地预览失败,导入时将交给服务端 import-zip 解析"}]),v([]),l(!0),D(z0(F[0]));return}f(G instanceof Error?G.message:String(G)),l(!1)}finally{u(!1)}}async function E($){const F=[];let H;const W=[];let U=!1;const q=new Map;for(const Q of $)try{const K=await R3(Q);if(!K.manifest)continue;U=!0,!H&&K.title&&(H=K.title);for(const G of K.checksumWarnings)W.push(G);for(const G of K.files)q.set(G.path,G)}catch{}if(!U)return null;for(const Q of q.values())F.push(Q);return F.sort((Q,K)=>Q.path.localeCompare(K.path)),{files:F,title:H,checksumWarnings:W}}function P($){!$.target.files||$.target.files.length===0||(T($.target.files),$.target.value="")}function C($){m($),z(null);const F=rh($);D((F==null?void 0:F.name)??$),p([]),f(null),x([{path:`examples/${$}/config.yml`,status:"ok"},{path:`examples/${$}/workflow.yml`,status:"ok"},{path:`examples/${$}/recipes/`,status:"ok"},{path:`examples/${$}/roles/`,status:"ok"}]),v([]),l(!0)}function R(){if(!O){const $=y?rh(y):null;D(($==null?void 0:$.name)??"导入项目")}j(!0)}async function M(){if(k(!0),A(null),ge)try{const U=I?await p$(I,O):await h$(O,h),{project:q}=U;V.setProjectSource("imported"),await Eu(q.id);const Q=V.projectFiles.length>0?V.projectFiles:U.files??h;t(`/p/${q.id}/${OE(Q)?"setup":"init"}`),e();return}catch(U){A(U instanceof Error?U.message:String(U)),k(!1);return}const $=`mock-imported-${Date.now()}`,F=y?rh(y):null,H=((F==null?void 0:F.steps.length)??0)>0,W=new Date().toISOString();V.setProjectSource("imported"),V.applyLoadedProject({snapshot:{...ms(),projectId:$,projects:Ma(V.projects,{id:$,title:O,dir:"",createdAt:W,updatedAt:W}),files:h,workflow:F?{steps:F.steps,edges:F.edges}:null,projectState:{projectId:$,activeStage:null,stages:{init:b5($,W)},updatedAt:W},init:{name:O,agentsSelected:[],selectedMachineId:"",tableConnected:!1,tableBaseId:"",tableId:"",llmProvider:"",llmModel:"",roles:[],sop:""}}}),t(`/p/${$}/${H?"setup":"design"}`),e()}const B=o&&(s==="upload"||y);return a.jsx("div",{className:"modal-overlay",onClick:e,children:a.jsxs("div",{className:"import-panel",onClick:$=>$.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(L,{name:"close",size:14})})]}),a.jsx("div",{className:"import-panel__body",children:b?a.jsxs("div",{className:"import-confirm",children:[a.jsx("div",{className:"import-confirm__icon",children:a.jsx(L,{name:"file",size:22})}),a.jsx("h4",{className:"import-confirm__title",children:"确认导入到我的项目?"}),a.jsxs("p",{className:"import-confirm__desc",children:["将在你的账号下新建项目,并导入已解析的工作流配置。",y&&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:O,onChange:$=>D($.target.value),placeholder:"输入项目名称"})]}),N&&a.jsxs("div",{className:"import-env-warn",children:[a.jsx(L,{name:"warn",size:13}),N]})]}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"import-panel__sources",children:[a.jsxs("label",{className:`import-source${s==="upload"?" is-selected":""}`,children:[a.jsx("input",{type:"radio",name:"source",checked:s==="upload",onChange:()=>{i("upload"),l(!1),m(null),f(null),p([]),x([]),z(null)}}),"上传项目包"]}),a.jsxs("label",{className:`import-source${s==="template"?" is-selected":""}`,children:[a.jsx("input",{type:"radio",name:"source",checked:s==="template",onChange:()=>{i("template"),l(!1),f(null),p([]),z(null)}}),"从模板库选择"]})]}),s==="upload"&&a.jsxs(a.Fragment,{children:[a.jsx("input",{ref:r,type:"file",multiple:!0,accept:".zip,.json,.yml,.yaml,.ts,.js,.md,.txt",style:{display:"none"},onChange:P}),a.jsxs("button",{type:"button",className:"import-drop",disabled:c,onClick:()=>{var $;return($=r.current)==null?void 0:$.click()},children:[a.jsx(L,{name:"plus",size:20}),a.jsx("span",{children:c?"解析中...":o?"重新选择文件 (.zip / 多选 / 目录)":"拖拽或点击上传 (.zip / 多选)"})]}),d&&a.jsxs("div",{className:"import-env-warn",children:[a.jsx(L,{name:"warn",size:13}),d]})]}),s==="template"&&a.jsx("div",{className:"import-templates",children:n.map($=>a.jsxs("button",{type:"button",className:`import-template${y===$.id?" is-selected":""}`,onClick:()=>C($.id),children:[a.jsx("span",{className:"import-template__icon",children:a.jsx(L,{name:"flow",size:14})}),a.jsx("span",{className:"import-template__name",children:$.name}),a.jsxs("span",{className:"cfg-muted",children:["examples/",$.id]})]},$.id))}),o&&a.jsxs("div",{className:"import-preview",children:[a.jsxs("div",{className:"import-preview__title",children:["解析结果预览(",h.length||g.length," 项):"]}),a.jsx("ul",{className:"import-preview__list",children:g.map($=>a.jsxs("li",{className:`import-preview__item import-preview__item--${$.status}`,children:[a.jsx("span",{className:"import-preview__icon",children:$.status==="ok"?"✓":$.status==="warning"?"⚠":"✗"}),a.jsx("span",{className:"import-preview__path",children:$.path}),$.detail&&a.jsx("span",{className:"import-preview__detail",children:$.detail})]},$.path))}),w.length>0&&a.jsxs("div",{className:"import-env-warn",children:[a.jsx(L,{name:"warn",size:13}),"需要补齐 ",w.length," 个环境变量"]})]})]})}),a.jsx("div",{className:"import-panel__foot",children:b?a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",className:"modal-card__btn",onClick:()=>j(!1),children:"返回"}),a.jsx("button",{type:"button",className:"primary modal-card__btn",disabled:!O.trim()||S,onClick:()=>void M(),children:S?"导入中...":"确认导入"})]}):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:!B,onClick:R,children:"下一步 →"})]})})]})})}function $d({children:e}){return a.jsx("div",{className:"body body--norail",children:e})}const k5=[{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:"用一条真实记录验证流程"}],N5=ct(function(){const[t,n]=_.useState(!1),[r,s]=_.useState(!1),i=Sr(),o=V.projects,[l,c]=_.useState(!1),[u,d]=_.useState(0);_.useEffect(()=>{if(!ge)return;let g=!1;return qg().then(x=>{g||(V.setProjects(x),c(!1))}).catch(()=>{g||c(!0)}),()=>{g=!0}},[u]);const[f,h]=_.useState(null);async function p(g){if(!ge){const x=`mock-${Date.now()}`;V.beginNewProject(x,g),i(`/p/${x}/init`);return}h(null);try{const x=await Kg();V.beginNewProject(x.id,g),V.setProjects(Ma(V.projects,x)),i(`/p/${x.id}/init`)}catch(x){h(x instanceof Error?x.message:String(x))}}return a.jsx($d,{children:a.jsxs("div",{className:"home-hero",children:[a.jsx(Ze.span,{className:"home-hero__mark",variants:g5,initial:"hidden",animate:"visible",children:a.jsx(L,{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:()=>s(!0),children:[a.jsx(L,{name:"play",size:16,color:"#fff"}),"新建项目"]}),a.jsxs("button",{type:"button",className:"home-hero__cta home-hero__cta--ghost",onClick:()=>n(!0),children:[a.jsx(L,{name:"plus",size:16}),"导入已有项目"]})]}),f&&a.jsxs("div",{className:"home-hero__error",children:["新建项目失败:",f]}),a.jsxs("div",{className:"home-projects",children:[a.jsx("div",{className:"home-projects__title",children:"我的项目"}),l&&o.length===0?a.jsxs("div",{className:"home-projects__empty",children:["项目列表没取到。",a.jsx("button",{type:"button",className:"home-projects__retry",onClick:()=>d(g=>g+1),children:"重试"})]}):o.length===0?a.jsx("div",{className:"home-projects__empty",children:"还没有项目,从上面新建一个开始。"}):a.jsx("ul",{className:"home-projects__list",children:o.map((g,x)=>a.jsx("li",{children:a.jsxs(ze,{className:"home-projects__item",to:`/p/${g.id}`,children:[a.jsx(L,{name:"file",size:15}),a.jsx("span",{className:"home-projects__name",children:qp(g,x)}),a.jsx("span",{className:"home-projects__id",children:g.id})]})},g.id))})]}),a.jsx(Ze.div,{className:"home-beats",variants:RE,initial:"hidden",animate:"visible",children:k5.map((g,x)=>a.jsxs(Ze.div,{className:"home-beat",variants:Ct,children:[a.jsx("span",{className:"home-beat__idx",children:x+1}),a.jsx("span",{className:"home-beat__icon",children:a.jsx(L,{name:g.icon,size:18})}),a.jsx("span",{className:"home-beat__label",children:g.label}),a.jsx("span",{className:"home-beat__desc",children:g.desc})]},g.stage))}),t&&a.jsx(S5,{onClose:()=>n(!1)}),r&&a.jsx(Ok,{onConfirm:g=>{p(g),s(!1)},onCancel:()=>s(!1)})]})})});function E5({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(L,{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 C5=".md,.txt,.text,.rst,.csv,.json,.yaml,.yml,.xml,.html,.htm,.docx,.pdf,.xlsx",T5=new Set([".docx",".pdf",".xlsx"]);let P5=0;function A5(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 R5(e){const t=e.lastIndexOf(".");return t>=0?e.slice(t).toLowerCase():""}function I5({roleId:e,onIngestUrl:t,onUploadFiles:n}){const[r,s]=_.useState([]),[i,o]=_.useState([]),[l,c]=_.useState(!1),u=_.useRef(null),d=_.useRef(null),f=_.useRef(null),h=_.useCallback(()=>{s(b=>[...b,{id:++P5,type:"file",url:"",files:[]}])},[]),p=_.useCallback(b=>{s(j=>j.filter(S=>S.id!==b))},[]),g=_.useCallback((b,j)=>{s(S=>S.map(k=>k.id===b?{...k,type:j,url:"",files:[]}:k))},[]),x=_.useCallback((b,j)=>{s(S=>S.map(k=>k.id===b?{...k,url:j}:k))},[]),w=_.useCallback((b,j)=>{var S,k;f.current=b,j==="folder"?(S=d.current)==null||S.click():(k=u.current)==null||k.click()},[]),v=_.useCallback(b=>{const j=f.current;if(j===null)return;const S=Array.from(b.target.files??[]);S.length>0&&s(k=>k.map(N=>N.id===j?{...N,files:S}:N)),b.target.value=""},[]),y=_.useCallback(async()=>{if(l)return;c(!0);const b=[];for(const j of r)if(j.type==="url"){if(!j.url.trim())continue;try{const S=await t(e,j.url.trim());b.push({ok:S.ok,message:S.message??(S.ok?"导入成功":"导入失败")})}catch(S){b.push({ok:!1,message:S instanceof Error?S.message:"导入失败"})}}else{if(j.files.length===0)continue;try{const S=[];for(const N of j.files){const A=R5(N.name),O=N.webkitRelativePath||N.name;if(T5.has(A)){const D=await N.arrayBuffer();S.push({name:N.name,relativePath:O,content:A5(D),encoding:"base64"})}else{const D=await N.text();S.push({name:N.name,relativePath:O,content:D,encoding:"utf8"})}}const k=await n(e,S);b.push({ok:k.ok,message:k.message??(k.ok?`导入成功 (${j.files.length} 个文件)`:"导入失败")})}catch(S){b.push({ok:!1,message:S instanceof Error?S.message:"文件上传失败"})}}o(j=>[...j,...b]),s([]),c(!1)},[l,r,e,t,n]),m=r.some(b=>b.type==="url"&&b.url.trim()||b.type==="file"&&b.files.length>0);return a.jsxs("div",{className:"kb-panel",children:[a.jsx("input",{ref:u,type:"file",multiple:!0,accept:C5,style:{display:"none"},onChange:v}),a.jsx("input",{ref:d,type:"file",webkitdirectory:"",directory:"",multiple:!0,style:{display:"none"},onChange:v}),i.length>0&&a.jsx("div",{className:"kb-panel__results",children:i.map((b,j)=>a.jsxs("div",{className:`kb-panel__result ${b.ok?"is-ok":"is-error"}`,children:[a.jsx(L,{name:b.ok?"check":"warn",size:12,color:b.ok?"var(--green)":"var(--red)"}),a.jsx("span",{children:b.message})]},j))}),r.length>0&&a.jsx("div",{className:"kb-panel__rows",children:r.map(b=>a.jsxs("div",{className:"kb-panel__row",children:[a.jsxs("select",{className:"kb-panel__type-select",value:b.type,onChange:j=>g(b.id,j.target.value),disabled:l,children:[a.jsx("option",{value:"file",children:"本地文件"}),a.jsx("option",{value:"url",children:"在线文档链接"})]}),b.type==="file"?a.jsxs("div",{className:"kb-panel__file-area",children:[b.files.length>0?a.jsxs("span",{className:"kb-panel__file-info",title:b.files.map(j=>j.name).join(`
|
|
77
|
-
`),children:["已选 ",b.files.length," 个文件"]}):a.jsx("span",{className:"kb-panel__file-placeholder",children:"未选择文件"}),a.jsx("button",{type:"button",className:"kb-panel__file-btn",onClick:()=>w(b.id,"file"),disabled:l,children:"选择文件"}),a.jsx("button",{type:"button",className:"kb-panel__file-btn",onClick:()=>w(b.id,"folder"),disabled:l,children:"选择文件夹"})]}):a.jsx("input",{type:"text",className:"qf-input kb-panel__url-input",value:b.url,placeholder:"输入在线文档链接",onChange:j=>x(b.id,j.target.value),disabled:l}),a.jsx("button",{type:"button",className:"kb-panel__row-remove",onClick:()=>p(b.id),disabled:l,title:"删除此行",children:a.jsx(L,{name:"close",size:12})})]},b.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 M5({fileRef:e}){const[t,n]=_.useState(!1),[r,s]=_.useState(null),[i,o]=_.useState(""),[l,c]=_.useState(!1),[u,d]=_.useState(!1),[f,h]=_.useState(!1),[p,g]=_.useState(null),[x,w]=_.useState(!1);async function v(){if(t){n(!1);return}if(n(!0),r===null){d(!0),g(null);try{const b=await FD(e.path);s(b.content),o(b.content)}catch(b){g(b instanceof Error?b.message:String(b))}finally{d(!1)}}}async function y(){h(!0),g(null);try{await VD(e.path,i),s(i),c(!1),w(!0),setTimeout(()=>w(!1),2400)}catch(b){g(b instanceof Error?b.message:String(b))}finally{h(!1)}}const m=(e.summary??[]).map(b=>b.count!==void 0?`${b.key} ${b.count}`:b.key).join(" · ");return a.jsxs("div",{className:"file-ref",children:[a.jsxs("button",{type:"button",className:"file-ref__toggle",onClick:()=>void v(),children:[a.jsx("span",{className:`file-ref__chevron${t?" is-open":""}`,children:a.jsx(L,{name:"chevron-right",size:11})}),a.jsx(L,{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(L,{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(L,{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),g(null)},children:"编辑内容"}),x&&a.jsxs("span",{className:"file-ref__saved",children:[a.jsx(L,{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:b=>o(b.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),g(null)},disabled:f,children:"取消"}),a.jsxs("span",{className:"file-ref__hint file-ref__hint--inline",children:["保存前会校验",e.format==="json"?" JSON":" YAML","语法,语法错误不会写入"]})]})]})]})]})}const O5=/secret|token|password|api_key/i;let LE=1;function L5(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:LE++,name:r,fields:i}})}catch{return[]}}function F0(e){const t={};for(const n of e.valueFields)t[n]="";return{id:LE++,name:"",fields:t}}function $5({spec:e,initialValue:t,saving:n,onSave:r,onCancel:s}){const[i,o]=_.useState(()=>{const p=L5(t,e);return p.length>0?p:[F0(e)]}),l=e.keyLabel??"名称",c=_.useMemo(()=>{const p=i.map(g=>g.name.trim());return p.some(g=>!g)?`每一项都需要填写「${l}」`:new Set(p).size!==p.length?`「${l}」不能重复`:null},[i,l]);function u(p,g){o(x=>x.map(w=>w.id===p?{...w,...g}:w))}function d(p,g,x){o(w=>w.map(v=>v.id===p?{...v,fields:{...v.fields,[g]:x}}:v))}function f(p){o(g=>g.filter(x=>x.id!==p))}async function h(){if(c)return;const p={};for(const g of i)p[g.name.trim()]=g.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,g)=>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:["#",g+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(L,{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:O5.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,F0(e)]),disabled:n,children:[a.jsx(L,{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 V0={ok:{icon:"check",color:"var(--green)"},error:{icon:"warn",color:"var(--red)"},warn:{icon:"warn",color:"var(--amber)"},suggestion:{icon:"dot",color:"var(--blue)"}},B0=".knowledge_scope.kb_collections";function D5(e){if(!e.endsWith(B0))return null;const t=e.slice(0,-B0.length),n=t.lastIndexOf(".");return n>=0?t.slice(n+1):t}function fn({item:e,onSave:t,onKbIngest:n,onKbUpload:r,suggestedDefault:s}){var S,k,N,A,O,D,I,z,T,E,P,C;const[i,o]=_.useState(!1),[l,c]=_.useState(Vo(e)),[u,d]=_.useState(!1),f=((S=e.surface)==null?void 0:S.label)??e.key,h=((k=e.surface)==null?void 0:k.description)??e.message,p=e.writeTarget&&((N=e.surface)==null?void 0:N.editable)!==!1,g=e.sensitive,x=V0[e.status]??V0.suggestion,w=D5(e.key),y=w!==null&&n&&r,m=(A=e.surface)==null?void 0:A.envJsonSpec;async function b(R){if(!(!e.writeTarget||!R.trim())){d(!0);try{await t(e.writeTarget,R),o(!1)}finally{d(!1)}}}async function j(){await b(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(L,{name:x.icon,size:14,color:x.color})}),a.jsx("span",{className:"cfg-item__label",children:f}),g&&a.jsx("span",{className:"cfg-item__badge cfg-item__badge--sensitive",children:"敏感"}),((O=e.surface)==null?void 0:O.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?z5(e,m.keyLabel):g&&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(g?"":Vo(e)||s||""),o(!0)},children:"编辑"})]}),!i&&p&&s&&!Vo(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(M5,{fileRef:e.surface.fileRef}),i&&m&&a.jsx("div",{className:"cfg-item__edit",children:a.jsx($5,{spec:m,initialValue:g?"":Vo(e),saving:u,onSave:b,onCancel:()=>o(!1)})}),i&&!m&&a.jsxs("div",{className:"cfg-item__edit",children:[((z=e.surface)==null?void 0:z.valueType)==="string[]"||((T=e.surface)==null?void 0:T.valueType)==="text"?a.jsx("textarea",{className:"qf-textarea cfg-item__input",rows:((E=e.surface)==null?void 0:E.valueType)==="text"?10:3,value:l,placeholder:((P=e.surface)==null?void 0:P.valueType)==="text"?`输入 ${f}`:"每行一个值,或用逗号分隔",onChange:R=>c(R.target.value),autoFocus:!0}):a.jsx("input",{type:g?"password":"text",className:"qf-input cfg-item__input",value:l,placeholder:((C=e.surface)==null?void 0:C.description)??`输入 ${f}`,onChange:R=>c(R.target.value),onKeyDown:R=>{R.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(I5,{roleId:w,onIngestUrl:n,onUploadFiles:r})]})}function Vo(e){return e.value===void 0||e.value===null?"":Array.isArray(e.value)?e.value.join(", "):String(e.value)}function z5(e,t){const n=Vo(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 Du({items:e}){const[t,n]=_.useState(!1);if(e.length===0)return null;const r=e.map(i=>`[${i.status}] ${i.key}: ${i.message}`).join(`
|
|
78
|
-
`);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(L,{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(L,{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 F5=new Set(["workflow","agent.engine"]);function V5({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]=_.useState(!1),p=_.useRef(!1),g=_.useCallback(async m=>{if(!(!(c!=null&&c.writeTarget)||!m)){h(!0);try{const b=[{writeTarget:c.writeTarget,value:m}];(u==null?void 0:u.status)==="error"&&u.writeTarget&&b.push({writeTarget:u.writeTarget,value:"true"}),await s(b)}finally{h(!1)}}},[c,u,s]);_.useEffect(()=>{p.current||(c==null?void 0:c.status)==="error"&&d&&t.available.some(m=>m.engine===d)&&c.writeTarget&&(p.current=!0,g(d))},[c,d,t.available,g]);const x=((i==null?void 0:i.items)??[]).filter(m=>!F5.has(m.key)&&(m.status!=="ok"||m.writeTarget)),w=((l==null?void 0:l.items)??[]).filter(m=>m.writeTarget&&(!n||n.includes(m.key))),v=((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).filter(m=>!m.key.startsWith("kb_compile.")),...(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(L,{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 g(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(L,{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(L,{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]})]}),v.length>0&&a.jsxs("section",{className:"adjust__section",children:[a.jsxs("h3",{className:"adjust__section-title",children:[a.jsx(L,{name:"robot",size:15}),"引擎配置"]}),v.map(m=>a.jsx(fn,{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(L,{name:"folder",size:15}),"项目参数"]}),x.map(m=>a.jsx(fn,{item:m,onSave:r},m.key)),w.map(m=>a.jsx(fn,{item:m,onSave:r},m.key))]}),x.length===0&&w.length===0&&v.length===0&&(c==null?void 0:c.status)==="ok"&&a.jsxs("div",{className:"adjust__empty",children:[a.jsx(L,{name:"check",size:20,color:"var(--green)"}),a.jsx("span",{children:"项目参数已完整"})]}),a.jsx(Du,{items:y})]})}const um=new Set(["roles.enabled","roles_dir","roles"]);function B5(e){const t=new Map;for(const n of e){if(um.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 U5({config:e,onSave:t,onKbIngest:n,onKbUpload:r}){const s=e.modules.find(d=>d.id==="roles");if(!s)return a.jsx("div",{className:"adjust__empty",children:"角色系统未启用"});const o=s.items.filter(d=>um.has(d.key)).find(d=>d.status==="error");if(o){const d=((s==null?void 0:s.items)??[]).filter(f=>!f.writeTarget&&f.status!=="ok"&&f!==o);return a.jsxs("div",{className:"adjust__tab-inner",children:[a.jsxs("div",{className:"adjust__error",children:[a.jsx(L,{name:"warn",size:16,color:"var(--red)"}),a.jsx("span",{children:o.message})]}),a.jsx(Du,{items:d})]})}const l=B5(s.items),c=new Map;for(const d of e.modules.filter(f=>f.id==="profile"))for(const f of d.items){const h=f.key.match(/^kb_compile\.([^.]+)\./);if(!h)continue;const p=h[1];c.has(p)||c.set(p,[]),c.get(p).push(f)}for(const d of c.values())d.sort((f,h)=>(f.status==="error"?0:1)-(h.status==="error"?0:1));if(l.length===0)return a.jsx("div",{className:"adjust__tab-inner",children:a.jsxs("div",{className:"adjust__empty",children:[a.jsx(L,{name:"user",size:20,color:"var(--text-muted)"}),a.jsx("span",{children:"暂无角色配置"})]})});const u=((s==null?void 0:s.items)??[]).filter(d=>um.has(d.key)&&!d.writeTarget&&d.status!=="ok");return a.jsxs("div",{className:"adjust__tab-inner",children:[l.map(d=>a.jsx(H5,{role:d,kbItems:c.get(d.roleId)??[],onSave:t,onKbIngest:n,onKbUpload:r},d.roleId)),a.jsx(Du,{items:u})]})}function H5({role:e,kbItems:t,onSave:n,onKbIngest:r,onKbUpload:s}){const i=e.items.find(c=>c.key===`role.${e.roleId}`),o=(i==null?void 0:i.status)==="ok"&&!t.some(c=>c.status==="error"),l=e.items.filter(c=>c.key!==`role.${e.roleId}`);return a.jsxs("div",{className:`role-card${o?" is-ok":""}`,children:[a.jsxs("div",{className:"role-card__head",children:[a.jsx(L,{name:"user",size:15}),a.jsx("span",{className:"role-card__name",children:e.roleId}),a.jsx("span",{className:`role-card__status${o?" is-ok":""}`,children:o?a.jsxs(a.Fragment,{children:[a.jsx(L,{name:"check",size:12})," 通过"]}):"需配置"})]}),(l.length>0||t.length>0)&&a.jsxs("div",{className:"role-card__body",children:[l.map(c=>a.jsx(fn,{item:c,onSave:n,onKbIngest:r,onKbUpload:s},c.key)),t.length>0&&a.jsxs("div",{className:"role-card__kb",children:[a.jsx("div",{className:"role-card__kb-title",children:"知识库编译配置"}),t.map(c=>a.jsx(fn,{item:c,onSave:n},c.key))]})]})]})}function He(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=He(e[n]))!==""&&(t+=(t&&" ")+r);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var W5={value:()=>{}};function Dd(){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 $c(n)}function $c(e){this._=e}function K5(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}})}$c.prototype=Dd.prototype={constructor:$c,on:function(e,t){var n=this._,r=K5(e+"",n),s,i=-1,o=r.length;if(arguments.length<2){for(;++i<o;)if((s=(e=r[i]).type)&&(s=q5(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]=U0(n[s],e.name,t);else if(t==null)for(s in n)n[s]=U0(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 $c(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 q5(e,t){for(var n=0,r=e.length,s;n<r;++n)if((s=e[n]).name===t)return s.value}function U0(e,t,n){for(var r=0,s=e.length;r<s;++r)if(e[r].name===t){e[r]=W5,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var dm="http://www.w3.org/1999/xhtml";const H0={svg:"http://www.w3.org/2000/svg",xhtml:dm,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function zd(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),H0.hasOwnProperty(t)?{space:H0[t],local:e}:e}function G5(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===dm&&t.documentElement.namespaceURI===dm?t.createElement(e):t.createElementNS(n,e)}}function Y5(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function $E(e){var t=zd(e);return(t.local?Y5:G5)(t)}function X5(){}function Bv(e){return e==null?X5:function(){return this.querySelector(e)}}function Q5(e){typeof e!="function"&&(e=Bv(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 Mt(r,this._parents)}function Z5(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function J5(){return[]}function DE(e){return e==null?J5:function(){return this.querySelectorAll(e)}}function eB(e){return function(){return Z5(e.apply(this,arguments))}}function tB(e){typeof e=="function"?e=eB(e):e=DE(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 Mt(r,s)}function zE(e){return function(){return this.matches(e)}}function FE(e){return function(t){return t.matches(e)}}var nB=Array.prototype.find;function rB(e){return function(){return nB.call(this.children,e)}}function sB(){return this.firstElementChild}function iB(e){return this.select(e==null?sB:rB(typeof e=="function"?e:FE(e)))}var oB=Array.prototype.filter;function aB(){return Array.from(this.children)}function lB(e){return function(){return oB.call(this.children,e)}}function cB(e){return this.selectAll(e==null?aB:lB(typeof e=="function"?e:FE(e)))}function uB(e){typeof e!="function"&&(e=zE(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 Mt(r,this._parents)}function VE(e){return new Array(e.length)}function dB(){return new Mt(this._enter||this._groups.map(VE),this._parents)}function zu(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}zu.prototype={constructor:zu,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 fB(e){return function(){return e}}function hB(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 zu(e,i[o]);for(;o<c;++o)(l=t[o])&&(s[o]=l)}function pB(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 zu(e,i[l]);for(l=0;l<d;++l)(c=t[l])&&u.get(h[l])===c&&(s[l]=c)}function mB(e){return e.__data__}function gB(e,t){if(!arguments.length)return Array.from(this,mB);var n=t?pB:hB,r=this._parents,s=this._groups;typeof e!="function"&&(e=fB(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=vB(e.call(d,d&&d.__data__,u,r)),g=p.length,x=l[u]=new Array(g),w=o[u]=new Array(g),v=c[u]=new Array(h);n(d,f,x,w,v,p,t);for(var y=0,m=0,b,j;y<g;++y)if(b=x[y]){for(y>=m&&(m=y+1);!(j=w[m])&&++m<g;);b._next=j||null}}return o=new Mt(o,r),o._enter=l,o._exit=c,o}function vB(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function yB(){return new Mt(this._exit||this._groups.map(VE),this._parents)}function xB(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 _B(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,g=0;g<f;++g)(p=u[g]||d[g])&&(h[g]=p);for(;c<s;++c)l[c]=n[c];return new Mt(l,this._parents)}function wB(){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 bB(e){e||(e=jB);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 Mt(s,this._parents).order()}function jB(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function SB(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function kB(){return Array.from(this)}function NB(){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 EB(){let e=0;for(const t of this)++e;return e}function CB(){return!this.node()}function TB(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 PB(e){return function(){this.removeAttribute(e)}}function AB(e){return function(){this.removeAttributeNS(e.space,e.local)}}function RB(e,t){return function(){this.setAttribute(e,t)}}function IB(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function MB(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function OB(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 LB(e,t){var n=zd(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?AB:PB:typeof t=="function"?n.local?OB:MB:n.local?IB:RB)(n,t))}function BE(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function $B(e){return function(){this.style.removeProperty(e)}}function DB(e,t,n){return function(){this.style.setProperty(e,t,n)}}function zB(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function FB(e,t,n){return arguments.length>1?this.each((t==null?$B:typeof t=="function"?zB:DB)(e,t,n??"")):Xi(this.node(),e)}function Xi(e,t){return e.style.getPropertyValue(t)||BE(e).getComputedStyle(e,null).getPropertyValue(t)}function VB(e){return function(){delete this[e]}}function BB(e,t){return function(){this[e]=t}}function UB(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function HB(e,t){return arguments.length>1?this.each((t==null?VB:typeof t=="function"?UB:BB)(e,t)):this.node()[e]}function UE(e){return e.trim().split(/^|\s+/)}function Uv(e){return e.classList||new HE(e)}function HE(e){this._node=e,this._names=UE(e.getAttribute("class")||"")}HE.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 WE(e,t){for(var n=Uv(e),r=-1,s=t.length;++r<s;)n.add(t[r])}function KE(e,t){for(var n=Uv(e),r=-1,s=t.length;++r<s;)n.remove(t[r])}function WB(e){return function(){WE(this,e)}}function KB(e){return function(){KE(this,e)}}function qB(e,t){return function(){(t.apply(this,arguments)?WE:KE)(this,e)}}function GB(e,t){var n=UE(e+"");if(arguments.length<2){for(var r=Uv(this.node()),s=-1,i=n.length;++s<i;)if(!r.contains(n[s]))return!1;return!0}return this.each((typeof t=="function"?qB:t?WB:KB)(n,t))}function YB(){this.textContent=""}function XB(e){return function(){this.textContent=e}}function QB(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function ZB(e){return arguments.length?this.each(e==null?YB:(typeof e=="function"?QB:XB)(e)):this.node().textContent}function JB(){this.innerHTML=""}function e6(e){return function(){this.innerHTML=e}}function t6(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function n6(e){return arguments.length?this.each(e==null?JB:(typeof e=="function"?t6:e6)(e)):this.node().innerHTML}function r6(){this.nextSibling&&this.parentNode.appendChild(this)}function s6(){return this.each(r6)}function i6(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function o6(){return this.each(i6)}function a6(e){var t=typeof e=="function"?e:$E(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function l6(){return null}function c6(e,t){var n=typeof e=="function"?e:$E(e),r=t==null?l6:typeof t=="function"?t:Bv(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function u6(){var e=this.parentNode;e&&e.removeChild(this)}function d6(){return this.each(u6)}function f6(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function h6(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function p6(e){return this.select(e?h6:f6)}function m6(e){return arguments.length?this.property("__data__",e):this.node().__data__}function g6(e){return function(t){e.call(this,t,this.__data__)}}function v6(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 y6(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 x6(e,t,n){return function(){var r=this.__on,s,i=g6(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 _6(e,t,n){var r=v6(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?x6:y6,s=0;s<i;++s)this.each(l(r[s],t,n));return this}function qE(e,t,n){var r=BE(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 w6(e,t){return function(){return qE(this,e,t)}}function b6(e,t){return function(){return qE(this,e,t.apply(this,arguments))}}function j6(e,t){return this.each((typeof t=="function"?b6:w6)(e,t))}function*S6(){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 GE=[null];function Mt(e,t){this._groups=e,this._parents=t}function gl(){return new Mt([[document.documentElement]],GE)}function k6(){return this}Mt.prototype=gl.prototype={constructor:Mt,select:Q5,selectAll:tB,selectChild:iB,selectChildren:cB,filter:uB,data:gB,enter:dB,exit:yB,join:xB,merge:_B,selection:k6,order:wB,sort:bB,call:SB,nodes:kB,node:NB,size:EB,empty:CB,each:TB,attr:LB,style:FB,property:HB,classed:GB,text:ZB,html:n6,raise:s6,lower:o6,append:a6,insert:c6,remove:d6,clone:p6,datum:m6,on:_6,dispatch:j6,[Symbol.iterator]:S6};function Nt(e){return typeof e=="string"?new Mt([[document.querySelector(e)]],[document.documentElement]):new Mt([[e]],GE)}function N6(e){let t;for(;t=e.sourceEvent;)e=t;return e}function un(e,t){if(e=N6(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 E6={passive:!1},Fa={capture:!0,passive:!1};function sh(e){e.stopImmediatePropagation()}function Pi(e){e.preventDefault(),e.stopImmediatePropagation()}function YE(e){var t=e.document.documentElement,n=Nt(e).on("dragstart.drag",Pi,Fa);"onselectstart"in t?n.on("selectstart.drag",Pi,Fa):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function XE(e,t){var n=e.document.documentElement,r=Nt(e).on("dragstart.drag",null);t&&(r.on("click.drag",Pi,Fa),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 Ql=e=>()=>e;function fm(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}})}fm.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function C6(e){return!e.ctrlKey&&!e.button}function T6(){return this.parentNode}function P6(e,t){return t??{x:e.x,y:e.y}}function A6(){return navigator.maxTouchPoints||"ontouchstart"in this}function QE(){var e=C6,t=T6,n=P6,r=A6,s={},i=Dd("start","drag","end"),o=0,l,c,u,d,f=0;function h(b){b.on("mousedown.drag",p).filter(r).on("touchstart.drag",w).on("touchmove.drag",v,E6).on("touchend.drag touchcancel.drag",y).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function p(b,j){if(!(d||!e.call(this,b,j))){var S=m(this,t.call(this,b,j),b,j,"mouse");S&&(Nt(b.view).on("mousemove.drag",g,Fa).on("mouseup.drag",x,Fa),YE(b.view),sh(b),u=!1,l=b.clientX,c=b.clientY,S("start",b))}}function g(b){if(Pi(b),!u){var j=b.clientX-l,S=b.clientY-c;u=j*j+S*S>f}s.mouse("drag",b)}function x(b){Nt(b.view).on("mousemove.drag mouseup.drag",null),XE(b.view,u),Pi(b),s.mouse("end",b)}function w(b,j){if(e.call(this,b,j)){var S=b.changedTouches,k=t.call(this,b,j),N=S.length,A,O;for(A=0;A<N;++A)(O=m(this,k,b,j,S[A].identifier,S[A]))&&(sh(b),O("start",b,S[A]))}}function v(b){var j=b.changedTouches,S=j.length,k,N;for(k=0;k<S;++k)(N=s[j[k].identifier])&&(Pi(b),N("drag",b,j[k]))}function y(b){var j=b.changedTouches,S=j.length,k,N;for(d&&clearTimeout(d),d=setTimeout(function(){d=null},500),k=0;k<S;++k)(N=s[j[k].identifier])&&(sh(b),N("end",b,j[k]))}function m(b,j,S,k,N,A){var O=i.copy(),D=un(A||S,j),I,z,T;if((T=n.call(b,new fm("beforestart",{sourceEvent:S,target:h,identifier:N,active:o,x:D[0],y:D[1],dx:0,dy:0,dispatch:O}),k))!=null)return I=T.x-D[0]||0,z=T.y-D[1]||0,function E(P,C,R){var M=D,B;switch(P){case"start":s[N]=E,B=o++;break;case"end":delete s[N],--o;case"drag":D=un(R||C,j),B=o;break}O.call(P,b,new fm(P,{sourceEvent:C,subject:T,target:h,identifier:N,active:B,x:D[0]+I,y:D[1]+z,dx:D[0]-M[0],dy:D[1]-M[1],dispatch:O}),k)}}return h.filter=function(b){return arguments.length?(e=typeof b=="function"?b:Ql(!!b),h):e},h.container=function(b){return arguments.length?(t=typeof b=="function"?b:Ql(b),h):t},h.subject=function(b){return arguments.length?(n=typeof b=="function"?b:Ql(b),h):n},h.touchable=function(b){return arguments.length?(r=typeof b=="function"?b:Ql(!!b),h):r},h.on=function(){var b=i.on.apply(i,arguments);return b===i?h:b},h.clickDistance=function(b){return arguments.length?(f=(b=+b)*b,h):Math.sqrt(f)},h}function Hv(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function ZE(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function vl(){}var Va=.7,Fu=1/Va,Ai="\\s*([+-]?\\d+)\\s*",Ba="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Hn="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",R6=/^#([0-9a-f]{3,8})$/,I6=new RegExp(`^rgb\\(${Ai},${Ai},${Ai}\\)$`),M6=new RegExp(`^rgb\\(${Hn},${Hn},${Hn}\\)$`),O6=new RegExp(`^rgba\\(${Ai},${Ai},${Ai},${Ba}\\)$`),L6=new RegExp(`^rgba\\(${Hn},${Hn},${Hn},${Ba}\\)$`),$6=new RegExp(`^hsl\\(${Ba},${Hn},${Hn}\\)$`),D6=new RegExp(`^hsla\\(${Ba},${Hn},${Hn},${Ba}\\)$`),W0={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};Hv(vl,$s,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:K0,formatHex:K0,formatHex8:z6,formatHsl:F6,formatRgb:q0,toString:q0});function K0(){return this.rgb().formatHex()}function z6(){return this.rgb().formatHex8()}function F6(){return JE(this).formatHsl()}function q0(){return this.rgb().formatRgb()}function $s(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=R6.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?G0(t):n===3?new vt(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Zl(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Zl(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=I6.exec(e))?new vt(t[1],t[2],t[3],1):(t=M6.exec(e))?new vt(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=O6.exec(e))?Zl(t[1],t[2],t[3],t[4]):(t=L6.exec(e))?Zl(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=$6.exec(e))?Q0(t[1],t[2]/100,t[3]/100,1):(t=D6.exec(e))?Q0(t[1],t[2]/100,t[3]/100,t[4]):W0.hasOwnProperty(e)?G0(W0[e]):e==="transparent"?new vt(NaN,NaN,NaN,0):null}function G0(e){return new vt(e>>16&255,e>>8&255,e&255,1)}function Zl(e,t,n,r){return r<=0&&(e=t=n=NaN),new vt(e,t,n,r)}function V6(e){return e instanceof vl||(e=$s(e)),e?(e=e.rgb(),new vt(e.r,e.g,e.b,e.opacity)):new vt}function hm(e,t,n,r){return arguments.length===1?V6(e):new vt(e,t,n,r??1)}function vt(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}Hv(vt,hm,ZE(vl,{brighter(e){return e=e==null?Fu:Math.pow(Fu,e),new vt(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Va:Math.pow(Va,e),new vt(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new vt(ks(this.r),ks(this.g),ks(this.b),Vu(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:Y0,formatHex:Y0,formatHex8:B6,formatRgb:X0,toString:X0}));function Y0(){return`#${_s(this.r)}${_s(this.g)}${_s(this.b)}`}function B6(){return`#${_s(this.r)}${_s(this.g)}${_s(this.b)}${_s((isNaN(this.opacity)?1:this.opacity)*255)}`}function X0(){const e=Vu(this.opacity);return`${e===1?"rgb(":"rgba("}${ks(this.r)}, ${ks(this.g)}, ${ks(this.b)}${e===1?")":`, ${e})`}`}function Vu(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function ks(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function _s(e){return e=ks(e),(e<16?"0":"")+e.toString(16)}function Q0(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new hn(e,t,n,r)}function JE(e){if(e instanceof hn)return new hn(e.h,e.s,e.l,e.opacity);if(e instanceof vl||(e=$s(e)),!e)return new hn;if(e instanceof hn)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 hn(o,l,c,e.opacity)}function U6(e,t,n,r){return arguments.length===1?JE(e):new hn(e,t,n,r??1)}function hn(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}Hv(hn,U6,ZE(vl,{brighter(e){return e=e==null?Fu:Math.pow(Fu,e),new hn(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Va:Math.pow(Va,e),new hn(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 vt(ih(e>=240?e-240:e+120,s,r),ih(e,s,r),ih(e<120?e+240:e-120,s,r),this.opacity)},clamp(){return new hn(Z0(this.h),Jl(this.s),Jl(this.l),Vu(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=Vu(this.opacity);return`${e===1?"hsl(":"hsla("}${Z0(this.h)}, ${Jl(this.s)*100}%, ${Jl(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Z0(e){return e=(e||0)%360,e<0?e+360:e}function Jl(e){return Math.max(0,Math.min(1,e||0))}function ih(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 Wv=e=>()=>e;function H6(e,t){return function(n){return e+n*t}}function W6(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 K6(e){return(e=+e)==1?eC:function(t,n){return n-t?W6(t,n,e):Wv(isNaN(t)?n:t)}}function eC(e,t){var n=t-e;return n?H6(e,n):Wv(isNaN(e)?t:e)}const Bu=function e(t){var n=K6(t);function r(s,i){var o=n((s=hm(s)).r,(i=hm(i)).r),l=n(s.g,i.g),c=n(s.b,i.b),u=eC(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 q6(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 G6(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function Y6(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]=aa(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 X6(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function Rn(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function Q6(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]=aa(e[s],t[s]):r[s]=t[s];return function(i){for(s in n)r[s]=n[s](i);return r}}var pm=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,oh=new RegExp(pm.source,"g");function Z6(e){return function(){return e}}function J6(e){return function(t){return e(t)+""}}function tC(e,t){var n=pm.lastIndex=oh.lastIndex=0,r,s,i,o=-1,l=[],c=[];for(e=e+"",t=t+"";(r=pm.exec(e))&&(s=oh.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:Rn(r,s)})),n=oh.lastIndex;return n<t.length&&(i=t.slice(n),l[o]?l[o]+=i:l[++o]=i),l.length<2?c[0]?J6(c[0].x):Z6(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 aa(e,t){var n=typeof t,r;return t==null||n==="boolean"?Wv(t):(n==="number"?Rn:n==="string"?(r=$s(t))?(t=r,Bu):tC:t instanceof $s?Bu:t instanceof Date?X6:G6(t)?q6:Array.isArray(t)?Y6:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?Q6:Rn)(e,t)}var J0=180/Math.PI,mm={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function nC(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)*J0,skewX:Math.atan(c)*J0,scaleX:o,scaleY:l}}var ec;function e8(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?mm:nC(t.a,t.b,t.c,t.d,t.e,t.f)}function t8(e){return e==null||(ec||(ec=document.createElementNS("http://www.w3.org/2000/svg","g")),ec.setAttribute("transform",e),!(e=ec.transform.baseVal.consolidate()))?mm:(e=e.matrix,nC(e.a,e.b,e.c,e.d,e.e,e.f))}function rC(e,t,n,r){function s(u){return u.length?u.pop()+" ":""}function i(u,d,f,h,p,g){if(u!==f||d!==h){var x=p.push("translate(",null,t,null,n);g.push({i:x-4,x:Rn(u,f)},{i:x-2,x:Rn(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:Rn(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:Rn(u,d)}):d&&f.push(s(f)+"skewX("+d+r)}function c(u,d,f,h,p,g){if(u!==f||d!==h){var x=p.push(s(p)+"scale(",null,",",null,")");g.push({i:x-4,x:Rn(u,f)},{i:x-2,x:Rn(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 g=-1,x=h.length,w;++g<x;)f[(w=h[g]).i]=w.x(p);return f.join("")}}}var n8=rC(e8,"px, ","px)","deg)"),r8=rC(t8,", ",")",")"),s8=1e-12;function ew(e){return((e=Math.exp(e))+1/e)/2}function i8(e){return((e=Math.exp(e))-1/e)/2}function o8(e){return((e=Math.exp(2*e))-1)/(e+1)}const Dc=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,g=f-c,x=p*p+g*g,w,v;if(x<s8)v=Math.log(h/u)/t,w=function(k){return[l+k*p,c+k*g,u*Math.exp(t*k*v)]};else{var y=Math.sqrt(x),m=(h*h-u*u+r*x)/(2*u*n*y),b=(h*h-u*u-r*x)/(2*h*n*y),j=Math.log(Math.sqrt(m*m+1)-m),S=Math.log(Math.sqrt(b*b+1)-b);v=(S-j)/t,w=function(k){var N=k*v,A=ew(j),O=u/(n*y)*(A*o8(t*N+j)-i8(j));return[l+O*p,c+O*g,u*A/ew(t*N+j)]}}return w.duration=v*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 Qi=0,Bo=0,Po=0,sC=1e3,Uu,Uo,Hu=0,Ds=0,Fd=0,Ua=typeof performance=="object"&&performance.now?performance:Date,iC=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Kv(){return Ds||(iC(a8),Ds=Ua.now()+Fd)}function a8(){Ds=0}function Wu(){this._call=this._time=this._next=null}Wu.prototype=oC.prototype={constructor:Wu,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?Kv():+n)+(t==null?0:+t),!this._next&&Uo!==this&&(Uo?Uo._next=this:Uu=this,Uo=this),this._call=e,this._time=n,gm()},stop:function(){this._call&&(this._call=null,this._time=1/0,gm())}};function oC(e,t,n){var r=new Wu;return r.restart(e,t,n),r}function l8(){Kv(),++Qi;for(var e=Uu,t;e;)(t=Ds-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Qi}function tw(){Ds=(Hu=Ua.now())+Fd,Qi=Bo=0;try{l8()}finally{Qi=0,u8(),Ds=0}}function c8(){var e=Ua.now(),t=e-Hu;t>sC&&(Fd-=t,Hu=e)}function u8(){for(var e,t=Uu,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:Uu=n);Uo=e,gm(r)}function gm(e){if(!Qi){Bo&&(Bo=clearTimeout(Bo));var t=e-Ds;t>24?(e<1/0&&(Bo=setTimeout(tw,e-Ua.now()-Fd)),Po&&(Po=clearInterval(Po))):(Po||(Hu=Ua.now(),Po=setInterval(c8,sC)),Qi=1,iC(tw))}}function nw(e,t,n){var r=new Wu;return t=t==null?0:+t,r.restart(s=>{r.stop(),e(s+t)},t,n),r}var d8=Dd("start","end","cancel","interrupt"),f8=[],aC=0,rw=1,vm=2,zc=3,sw=4,ym=5,Fc=6;function Vd(e,t,n,r,s,i){var o=e.__transition;if(!o)e.__transition={};else if(n in o)return;h8(e,n,{name:t,index:r,group:s,on:d8,tween:f8,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:aC})}function qv(e,t){var n=kn(e,t);if(n.state>aC)throw new Error("too late; already scheduled");return n}function Wn(e,t){var n=kn(e,t);if(n.state>zc)throw new Error("too late; already running");return n}function kn(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function h8(e,t,n){var r=e.__transition,s;r[t]=n,n.timer=oC(i,0,n.time);function i(u){n.state=rw,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!==rw)return c();for(d in r)if(p=r[d],p.name===n.name){if(p.state===zc)return nw(o);p.state===sw?(p.state=Fc,p.timer.stop(),p.on.call("interrupt",e,e.__data__,p.index,p.group),delete r[d]):+d<t&&(p.state=Fc,p.timer.stop(),p.on.call("cancel",e,e.__data__,p.index,p.group),delete r[d])}if(nw(function(){n.state===zc&&(n.state=sw,n.timer.restart(l,n.delay,n.time),l(u))}),n.state=vm,n.on.call("start",e,e.__data__,n.index,n.group),n.state===vm){for(n.state=zc,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=ym,1),f=-1,h=s.length;++f<h;)s[f].call(e,d);n.state===ym&&(n.on.call("end",e,e.__data__,n.index,n.group),c())}function c(){n.state=Fc,n.timer.stop(),delete r[t];for(var u in r)return;delete e.__transition}}function Vc(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>vm&&r.state<ym,r.state=Fc,r.timer.stop(),r.on.call(s?"interrupt":"cancel",e,e.__data__,r.index,r.group),delete n[o]}i&&delete e.__transition}}function p8(e){return this.each(function(){Vc(this,e)})}function m8(e,t){var n,r;return function(){var s=Wn(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 g8(e,t,n){var r,s;if(typeof n!="function")throw new Error;return function(){var i=Wn(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 v8(e,t){var n=this._id;if(e+="",arguments.length<2){for(var r=kn(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?m8:g8)(n,e,t))}function Gv(e,t,n){var r=e._id;return e.each(function(){var s=Wn(this,r);(s.value||(s.value={}))[t]=n.apply(this,arguments)}),function(s){return kn(s,r).value[t]}}function lC(e,t){var n;return(typeof t=="number"?Rn:t instanceof $s?Bu:(n=$s(t))?(t=n,Bu):tC)(e,t)}function y8(e){return function(){this.removeAttribute(e)}}function x8(e){return function(){this.removeAttributeNS(e.space,e.local)}}function _8(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 w8(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 b8(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 j8(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 S8(e,t){var n=zd(e),r=n==="transform"?r8:lC;return this.attrTween(e,typeof t=="function"?(n.local?j8:b8)(n,r,Gv(this,"attr."+e,t)):t==null?(n.local?x8:y8)(n):(n.local?w8:_8)(n,r,t))}function k8(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function N8(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function E8(e,t){var n,r;function s(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&N8(e,i)),n}return s._value=t,s}function C8(e,t){var n,r;function s(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&k8(e,i)),n}return s._value=t,s}function T8(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=zd(e);return this.tween(n,(r.local?E8:C8)(r,t))}function P8(e,t){return function(){qv(this,e).delay=+t.apply(this,arguments)}}function A8(e,t){return t=+t,function(){qv(this,e).delay=t}}function R8(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?P8:A8)(t,e)):kn(this.node(),t).delay}function I8(e,t){return function(){Wn(this,e).duration=+t.apply(this,arguments)}}function M8(e,t){return t=+t,function(){Wn(this,e).duration=t}}function O8(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?I8:M8)(t,e)):kn(this.node(),t).duration}function L8(e,t){if(typeof t!="function")throw new Error;return function(){Wn(this,e).ease=t}}function $8(e){var t=this._id;return arguments.length?this.each(L8(t,e)):kn(this.node(),t).ease}function D8(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;Wn(this,e).ease=n}}function z8(e){if(typeof e!="function")throw new Error;return this.each(D8(this._id,e))}function F8(e){typeof e!="function"&&(e=zE(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 br(r,this._parents,this._name,this._id)}function V8(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 br(o,this._parents,this._name,this._id)}function B8(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 U8(e,t,n){var r,s,i=B8(t)?qv:Wn;return function(){var o=i(this,e),l=o.on;l!==r&&(s=(r=l).copy()).on(t,n),o.on=s}}function H8(e,t){var n=this._id;return arguments.length<2?kn(this.node(),n).on.on(e):this.each(U8(n,e,t))}function W8(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function K8(){return this.on("end.remove",W8(this._id))}function q8(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Bv(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,Vd(u[h],t,n,h,u,kn(d,n)));return new br(i,this._parents,t,n)}function G8(e){var t=this._name,n=this._id;typeof e!="function"&&(e=DE(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,g=kn(d,n),x=0,w=h.length;x<w;++x)(p=h[x])&&Vd(p,t,n,x,h,g);i.push(h),o.push(d)}return new br(i,o,t,n)}var Y8=gl.prototype.constructor;function X8(){return new Y8(this._groups,this._parents)}function Q8(e,t){var n,r,s;return function(){var i=Xi(this,e),o=(this.style.removeProperty(e),Xi(this,e));return i===o?null:i===n&&o===r?s:s=t(n=i,r=o)}}function cC(e){return function(){this.style.removeProperty(e)}}function Z8(e,t,n){var r,s=n+"",i;return function(){var o=Xi(this,e);return o===s?null:o===r?i:i=t(r=o,n)}}function J8(e,t,n){var r,s,i;return function(){var o=Xi(this,e),l=n(this),c=l+"";return l==null&&(c=l=(this.style.removeProperty(e),Xi(this,e))),o===c?null:o===r&&c===s?i:(s=c,i=t(r=o,l))}}function eU(e,t){var n,r,s,i="style."+t,o="end."+i,l;return function(){var c=Wn(this,e),u=c.on,d=c.value[i]==null?l||(l=cC(t)):void 0;(u!==n||s!==d)&&(r=(n=u).copy()).on(o,s=d),c.on=r}}function tU(e,t,n){var r=(e+="")=="transform"?n8:lC;return t==null?this.styleTween(e,Q8(e,r)).on("end.style."+e,cC(e)):typeof t=="function"?this.styleTween(e,J8(e,r,Gv(this,"style."+e,t))).each(eU(this._id,e)):this.styleTween(e,Z8(e,r,t),n).on("end.style."+e,null)}function nU(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function rU(e,t,n){var r,s;function i(){var o=t.apply(this,arguments);return o!==s&&(r=(s=o)&&nU(e,o,n)),r}return i._value=t,i}function sU(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,rU(e,t,n??""))}function iU(e){return function(){this.textContent=e}}function oU(e){return function(){var t=e(this);this.textContent=t??""}}function aU(e){return this.tween("text",typeof e=="function"?oU(Gv(this,"text",e)):iU(e==null?"":e+""))}function lU(e){return function(t){this.textContent=e.call(this,t)}}function cU(e){var t,n;function r(){var s=e.apply(this,arguments);return s!==n&&(t=(n=s)&&lU(s)),t}return r._value=e,r}function uU(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,cU(e))}function dU(){for(var e=this._name,t=this._id,n=uC(),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=kn(c,t);Vd(c,e,n,u,o,{time:d.time+d.delay+d.duration,delay:0,duration:d.duration,ease:d.ease})}return new br(r,this._parents,e,n)}function fU(){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=Wn(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 hU=0;function br(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function uC(){return++hU}var Xn=gl.prototype;br.prototype={constructor:br,select:q8,selectAll:G8,selectChild:Xn.selectChild,selectChildren:Xn.selectChildren,filter:F8,merge:V8,selection:X8,transition:dU,call:Xn.call,nodes:Xn.nodes,node:Xn.node,size:Xn.size,empty:Xn.empty,each:Xn.each,on:H8,attr:S8,attrTween:T8,style:tU,styleTween:sU,text:aU,textTween:uU,remove:K8,tween:v8,delay:R8,duration:O8,ease:$8,easeVarying:z8,end:fU,[Symbol.iterator]:Xn[Symbol.iterator]};function pU(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var mU={time:null,delay:0,duration:250,ease:pU};function gU(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 vU(e){var t,n;e instanceof br?(t=e._id,e=e._name):(t=uC(),(n=mU).time=Kv(),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])&&Vd(c,e,t,u,o,n||gU(c,t));return new br(r,this._parents,e,t)}gl.prototype.interrupt=p8;gl.prototype.transition=vU;const tc=e=>()=>e;function yU(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 sr(e,t,n){this.k=e,this.x=t,this.y=n}sr.prototype={constructor:sr,scale:function(e){return e===1?this:new sr(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new sr(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 Bd=new sr(1,0,0);dC.prototype=sr.prototype;function dC(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Bd;return e.__zoom}function ah(e){e.stopImmediatePropagation()}function Ao(e){e.preventDefault(),e.stopImmediatePropagation()}function xU(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function _U(){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 iw(){return this.__zoom||Bd}function wU(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function bU(){return navigator.maxTouchPoints||"ontouchstart"in this}function jU(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 fC(){var e=xU,t=_U,n=jU,r=wU,s=bU,i=[0,1/0],o=[[-1/0,-1/0],[1/0,1/0]],l=250,c=Dc,u=Dd("start","zoom","end"),d,f,h,p=500,g=150,x=0,w=10;function v(T){T.property("__zoom",iw).on("wheel.zoom",N,{passive:!1}).on("mousedown.zoom",A).on("dblclick.zoom",O).filter(s).on("touchstart.zoom",D).on("touchmove.zoom",I).on("touchend.zoom touchcancel.zoom",z).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}v.transform=function(T,E,P,C){var R=T.selection?T.selection():T;R.property("__zoom",iw),T!==R?j(T,E,P,C):R.interrupt().each(function(){S(this,arguments).event(C).start().zoom(null,typeof E=="function"?E.apply(this,arguments):E).end()})},v.scaleBy=function(T,E,P,C){v.scaleTo(T,function(){var R=this.__zoom.k,M=typeof E=="function"?E.apply(this,arguments):E;return R*M},P,C)},v.scaleTo=function(T,E,P,C){v.transform(T,function(){var R=t.apply(this,arguments),M=this.__zoom,B=P==null?b(R):typeof P=="function"?P.apply(this,arguments):P,$=M.invert(B),F=typeof E=="function"?E.apply(this,arguments):E;return n(m(y(M,F),B,$),R,o)},P,C)},v.translateBy=function(T,E,P,C){v.transform(T,function(){return n(this.__zoom.translate(typeof E=="function"?E.apply(this,arguments):E,typeof P=="function"?P.apply(this,arguments):P),t.apply(this,arguments),o)},null,C)},v.translateTo=function(T,E,P,C,R){v.transform(T,function(){var M=t.apply(this,arguments),B=this.__zoom,$=C==null?b(M):typeof C=="function"?C.apply(this,arguments):C;return n(Bd.translate($[0],$[1]).scale(B.k).translate(typeof E=="function"?-E.apply(this,arguments):-E,typeof P=="function"?-P.apply(this,arguments):-P),M,o)},C,R)};function y(T,E){return E=Math.max(i[0],Math.min(i[1],E)),E===T.k?T:new sr(E,T.x,T.y)}function m(T,E,P){var C=E[0]-P[0]*T.k,R=E[1]-P[1]*T.k;return C===T.x&&R===T.y?T:new sr(T.k,C,R)}function b(T){return[(+T[0][0]+ +T[1][0])/2,(+T[0][1]+ +T[1][1])/2]}function j(T,E,P,C){T.on("start.zoom",function(){S(this,arguments).event(C).start()}).on("interrupt.zoom end.zoom",function(){S(this,arguments).event(C).end()}).tween("zoom",function(){var R=this,M=arguments,B=S(R,M).event(C),$=t.apply(R,M),F=P==null?b($):typeof P=="function"?P.apply(R,M):P,H=Math.max($[1][0]-$[0][0],$[1][1]-$[0][1]),W=R.__zoom,U=typeof E=="function"?E.apply(R,M):E,q=c(W.invert(F).concat(H/W.k),U.invert(F).concat(H/U.k));return function(Q){if(Q===1)Q=U;else{var K=q(Q),G=H/K[2];Q=new sr(G,F[0]-K[0]*G,F[1]-K[1]*G)}B.zoom(null,Q)}})}function S(T,E,P){return!P&&T.__zooming||new k(T,E)}function k(T,E){this.that=T,this.args=E,this.active=0,this.sourceEvent=null,this.extent=t.apply(T,E),this.taps=0}k.prototype={event:function(T){return T&&(this.sourceEvent=T),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(T,E){return this.mouse&&T!=="mouse"&&(this.mouse[1]=E.invert(this.mouse[0])),this.touch0&&T!=="touch"&&(this.touch0[1]=E.invert(this.touch0[0])),this.touch1&&T!=="touch"&&(this.touch1[1]=E.invert(this.touch1[0])),this.that.__zoom=E,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(T){var E=Nt(this.that).datum();u.call(T,this.that,new yU(T,{sourceEvent:this.sourceEvent,target:v,transform:this.that.__zoom,dispatch:u}),E)}};function N(T,...E){if(!e.apply(this,arguments))return;var P=S(this,E).event(T),C=this.__zoom,R=Math.max(i[0],Math.min(i[1],C.k*Math.pow(2,r.apply(this,arguments)))),M=un(T);if(P.wheel)(P.mouse[0][0]!==M[0]||P.mouse[0][1]!==M[1])&&(P.mouse[1]=C.invert(P.mouse[0]=M)),clearTimeout(P.wheel);else{if(C.k===R)return;P.mouse=[M,C.invert(M)],Vc(this),P.start()}Ao(T),P.wheel=setTimeout(B,g),P.zoom("mouse",n(m(y(C,R),P.mouse[0],P.mouse[1]),P.extent,o));function B(){P.wheel=null,P.end()}}function A(T,...E){if(h||!e.apply(this,arguments))return;var P=T.currentTarget,C=S(this,E,!0).event(T),R=Nt(T.view).on("mousemove.zoom",F,!0).on("mouseup.zoom",H,!0),M=un(T,P),B=T.clientX,$=T.clientY;YE(T.view),ah(T),C.mouse=[M,this.__zoom.invert(M)],Vc(this),C.start();function F(W){if(Ao(W),!C.moved){var U=W.clientX-B,q=W.clientY-$;C.moved=U*U+q*q>x}C.event(W).zoom("mouse",n(m(C.that.__zoom,C.mouse[0]=un(W,P),C.mouse[1]),C.extent,o))}function H(W){R.on("mousemove.zoom mouseup.zoom",null),XE(W.view,C.moved),Ao(W),C.event(W).end()}}function O(T,...E){if(e.apply(this,arguments)){var P=this.__zoom,C=un(T.changedTouches?T.changedTouches[0]:T,this),R=P.invert(C),M=P.k*(T.shiftKey?.5:2),B=n(m(y(P,M),C,R),t.apply(this,E),o);Ao(T),l>0?Nt(this).transition().duration(l).call(j,B,C,T):Nt(this).call(v.transform,B,C,T)}}function D(T,...E){if(e.apply(this,arguments)){var P=T.touches,C=P.length,R=S(this,E,T.changedTouches.length===C).event(T),M,B,$,F;for(ah(T),B=0;B<C;++B)$=P[B],F=un($,this),F=[F,this.__zoom.invert(F),$.identifier],R.touch0?!R.touch1&&R.touch0[2]!==F[2]&&(R.touch1=F,R.taps=0):(R.touch0=F,M=!0,R.taps=1+!!d);d&&(d=clearTimeout(d)),M&&(R.taps<2&&(f=F[0],d=setTimeout(function(){d=null},p)),Vc(this),R.start())}}function I(T,...E){if(this.__zooming){var P=S(this,E).event(T),C=T.changedTouches,R=C.length,M,B,$,F;for(Ao(T),M=0;M<R;++M)B=C[M],$=un(B,this),P.touch0&&P.touch0[2]===B.identifier?P.touch0[0]=$:P.touch1&&P.touch1[2]===B.identifier&&(P.touch1[0]=$);if(B=P.that.__zoom,P.touch1){var H=P.touch0[0],W=P.touch0[1],U=P.touch1[0],q=P.touch1[1],Q=(Q=U[0]-H[0])*Q+(Q=U[1]-H[1])*Q,K=(K=q[0]-W[0])*K+(K=q[1]-W[1])*K;B=y(B,Math.sqrt(Q/K)),$=[(H[0]+U[0])/2,(H[1]+U[1])/2],F=[(W[0]+q[0])/2,(W[1]+q[1])/2]}else if(P.touch0)$=P.touch0[0],F=P.touch0[1];else return;P.zoom("touch",n(m(B,$,F),P.extent,o))}}function z(T,...E){if(this.__zooming){var P=S(this,E).event(T),C=T.changedTouches,R=C.length,M,B;for(ah(T),h&&clearTimeout(h),h=setTimeout(function(){h=null},p),M=0;M<R;++M)B=C[M],P.touch0&&P.touch0[2]===B.identifier?delete P.touch0:P.touch1&&P.touch1[2]===B.identifier&&delete P.touch1;if(P.touch1&&!P.touch0&&(P.touch0=P.touch1,delete P.touch1),P.touch0)P.touch0[1]=this.__zoom.invert(P.touch0[0]);else if(P.end(),P.taps===2&&(B=un(B,this),Math.hypot(f[0]-B[0],f[1]-B[1])<w)){var $=Nt(this).on("dblclick.zoom");$&&$.apply(this,arguments)}}}return v.wheelDelta=function(T){return arguments.length?(r=typeof T=="function"?T:tc(+T),v):r},v.filter=function(T){return arguments.length?(e=typeof T=="function"?T:tc(!!T),v):e},v.touchable=function(T){return arguments.length?(s=typeof T=="function"?T:tc(!!T),v):s},v.extent=function(T){return arguments.length?(t=typeof T=="function"?T:tc([[+T[0][0],+T[0][1]],[+T[1][0],+T[1][1]]]),v):t},v.scaleExtent=function(T){return arguments.length?(i[0]=+T[0],i[1]=+T[1],v):[i[0],i[1]]},v.translateExtent=function(T){return arguments.length?(o[0][0]=+T[0][0],o[1][0]=+T[1][0],o[0][1]=+T[0][1],o[1][1]=+T[1][1],v):[[o[0][0],o[0][1]],[o[1][0],o[1][1]]]},v.constrain=function(T){return arguments.length?(n=T,v):n},v.duration=function(T){return arguments.length?(l=+T,v):l},v.interpolate=function(T){return arguments.length?(c=T,v):c},v.on=function(){var T=u.on.apply(u,arguments);return T===u?v:T},v.clickDistance=function(T){return arguments.length?(x=(T=+T)*T,v):Math.sqrt(x)},v.tapDistance=function(T){return arguments.length?(w=+T,v):w},v}const jn={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.`},Ha=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],hC=["Enter"," ","Escape"],pC={"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 Zi;(function(e){e.Strict="strict",e.Loose="loose"})(Zi||(Zi={}));var Ns;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Ns||(Ns={}));var Wa;(function(e){e.Partial="partial",e.Full="full"})(Wa||(Wa={}));const mC={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var Mr;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Mr||(Mr={}));var Ku;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(Ku||(Ku={}));var re;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(re||(re={}));const ow={[re.Left]:re.Right,[re.Right]:re.Left,[re.Top]:re.Bottom,[re.Bottom]:re.Top};function gC(e){return e===null?null:e?"valid":"invalid"}const vC=e=>!!e&&typeof e=="object"&&"id"in e&&"source"in e&&"target"in e,SU=e=>!!e&&typeof e=="object"&&"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),Yv=e=>!!e&&typeof e=="object"&&"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),yl=(e,t=[0,0])=>{const{width:n,height:r}=Kn(e),s=e.origin??t,i=n*s[0],o=r*s[1];return{x:e.position.x-i,y:e.position.y-o}},kU=(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):Yv(s)?s:t.nodeLookup.get(s.id));const l=o?qu(o,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return Ud(r,l)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return Hd(n)},xl=(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=Ud(n,qu(s)),r=!0)}),r?Hd(n):{x:0,y:0,width:0,height:0}},Xv=(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:g=!0,hidden:x=!1}=h;if(o&&!g||x)continue;const w=p.width??h.width??h.initialWidth??0,v=p.height??h.height??h.initialHeight??0,{x:y,y:m}=h.internals.positionAbsolute,b=wC(l,c,u,d,y,m,w,v),j=w*v,S=i&&b>0;(!h.internals.handleBounds||S||b>=j||h.dragging)&&f.push(h)}return f},NU=(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 EU(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}=Kn(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 CU({nodes:e,width:t,height:n,panZoom:r,minZoom:s,maxZoom:i},o){if(e.size===0)return!0;const l=EU(e,o),c=xl(l),u=Zv(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 yC({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",jn.error005());else{const p=l.measured.width,g=l.measured.height;p&&g&&(f=[[c,u],[c+p,u+g]])}else l&&Fs(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=Fs(f)?zs(t,f,o.measured):t;return(o.measured.width===void 0||o.measured.height===void 0)&&(i==null||i("015",jn.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 TU({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),g=!p&&h.parentId&&o.find(x=>x.id===h.parentId);(p||g)&&o.push(h)}const l=new Set(t.map(h=>h.id)),c=r.filter(h=>h.deletable!==!1),d=NU(o,c);for(const h of c)l.has(h.id)&&!d.find(g=>g.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 Ji=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),zs=(e={x:0,y:0},t,n)=>({x:Ji(e.x,t[0][0],t[1][0]-((n==null?void 0:n.width)??0)),y:Ji(e.y,t[0][1],t[1][1]-((n==null?void 0:n.height)??0))});function xC(e,t,n){const{width:r,height:s}=Kn(n),{x:i,y:o}=n.internals.positionAbsolute;return zs(e,[[i,o],[i+r,o+s]],t)}const aw=(e,t,n)=>e<t?Ji(Math.abs(e-t),1,t)/t:e>n?-Ji(Math.abs(e-n),1,t)/t:0,Qv=(e,t,n=15,r=40)=>{const s=aw(e.x,r,t.width-r)*n,i=aw(e.y,r,t.height-r)*n;return[s,i]},Ud=(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)}),xm=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),Hd=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),Ka=(e,t=[0,0])=>{var s,i;const{x:n,y:r}=Yv(e)?e.internals.positionAbsolute:yl(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}},qu=(e,t=[0,0])=>{var s,i;const{x:n,y:r}=Yv(e)?e.internals.positionAbsolute:yl(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)}},_C=(e,t)=>Hd(Ud(xm(e),xm(t))),wC=(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)},Gu=(e,t)=>wC(e.x,e.y,e.width,e.height,t.x,t.y,t.width,t.height),lw=e=>pn(e.width)&&pn(e.height)&&pn(e.x)&&pn(e.y),pn=e=>!isNaN(e)&&isFinite(e),bC=(e,t)=>(n,r)=>{},_l=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),wl=({x:e,y:t},[n,r,s],i=!1,o=[1,1])=>{const l={x:(e-n)/s,y:(t-r)/s};return i?_l(l,o):l},eo=({x:e,y:t},[n,r,s])=>({x:e*s+n,y:t*s+r});function Js(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 PU(e,t,n){if(typeof e=="string"||typeof e=="number"){const r=Js(e,n),s=Js(e,t);return{top:r,right:s,bottom:r,left:s,x:s*2,y:r*2}}if(typeof e=="object"){const r=Js(e.top??e.y??0,n),s=Js(e.bottom??e.y??0,n),i=Js(e.left??e.x??0,t),o=Js(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 AU(e,t,n,r,s,i){const{x:o,y:l}=eo(e,[t,n,r]),{x:c,y:u}=eo({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 Zv=(e,t,n,r,s,i)=>{const o=PU(i,t,n),l=(t-o.x)/e.width,c=(n-o.y)/e.height,u=Math.min(l,c),d=Ji(u,r,s),f=e.x+e.width/2,h=e.y+e.height/2,p=t/2-f*d,g=n/2-h*d,x=AU(e,p,g,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:g-w.top+w.bottom,zoom:d}},qa=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function Fs(e){return e!=null&&e!=="parent"}function Kn(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 jC(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 SC(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 cw(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function RU(){let e,t;return{promise:new Promise((r,s)=>{e=r,t=s}),resolve:e,reject:t}}function IU(e){return{...pC,...e||{}}}function la(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:s}){const{x:i,y:o}=mn(e),l=wl({x:i-((s==null?void 0:s.left)??0),y:o-((s==null?void 0:s.top)??0)},r),{x:c,y:u}=n?_l(l,t):l;return{xSnapped:c,ySnapped:u,...l}}const Jv=e=>({width:e.offsetWidth,height:e.offsetHeight}),kC=e=>{var t;return((t=e==null?void 0:e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},MU=["INPUT","SELECT","TEXTAREA"];function NC(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:MU.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const EC=e=>"clientX"in e,mn=(e,t)=>{var i,o;const n=EC(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)}},uw=(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,...Jv(o)}})};function CC({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 nc(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function dw({pos:e,x1:t,y1:n,x2:r,y2:s,c:i}){switch(e){case re.Left:return[t-nc(t-r,i),n];case re.Right:return[t+nc(r-t,i),n];case re.Top:return[t,n-nc(n-s,i)];case re.Bottom:return[t,n+nc(s-n,i)]}}function TC({sourceX:e,sourceY:t,sourcePosition:n=re.Bottom,targetX:r,targetY:s,targetPosition:i=re.Top,curvature:o=.25}){const[l,c]=dw({pos:n,x1:e,y1:t,x2:r,y2:s,c:o}),[u,d]=dw({pos:i,x1:r,y1:s,x2:e,y2:t,c:o}),[f,h,p,g]=CC({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,g]}function PC({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 OU({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 LU({sourceNode:e,targetNode:t,width:n,height:r,transform:s}){const i=Ud(qu(e),qu(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 Gu(o,Hd(i))>0}const $U=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||""}-${n}${r||""}`,DU=(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)),zU=(e,t,n={})=>{var i;if(!e.source||!e.target)return(i=n.onError)==null||i.call(n,"006",jn.error006()),t;const r=n.getEdgeId||$U;let s;return vC(e)?s={...e}:s={...e,id:r(e)},DU(s,t)?t:(s.sourceHandle===null&&delete s.sourceHandle,s.targetHandle===null&&delete s.targetHandle,t.concat(s))};function AC({sourceX:e,sourceY:t,targetX:n,targetY:r}){const[s,i,o,l]=PC({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,s,i,o,l]}const fw={[re.Left]:{x:-1,y:0},[re.Right]:{x:1,y:0},[re.Top]:{x:0,y:-1},[re.Bottom]:{x:0,y:1}},FU=({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},hw=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function VU({source:e,sourcePosition:t=re.Bottom,target:n,targetPosition:r=re.Top,center:s,offset:i,stepPosition:o}){const l=fw[t],c=fw[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=FU({source:u,sourcePosition:t,target:d}),h=f.x!==0?"x":"y",p=f[h];let g=[],x,w;const v={x:0,y:0},y={x:0,y:0},[,,m,b]=PC({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 N=[{x,y:u.y},{x,y:d.y}],A=[{x:u.x,y:w},{x:d.x,y:w}];l[h]===p?g=h==="x"?N:A:g=h==="x"?A:N}else{const N=[{x:u.x,y:d.y}],A=[{x:d.x,y:u.y}];if(h==="x"?g=l.x===p?A:N:g=l.y===p?N:A,t===r){const T=Math.abs(e[h]-n[h]);if(T<=i){const E=Math.min(i-1,i-T);l[h]===p?v[h]=(u[h]>e[h]?-1:1)*E:y[h]=(d[h]>n[h]?-1:1)*E}}if(t!==r){const T=h==="x"?"y":"x",E=l[h]===c[T],P=u[T]>d[T],C=u[T]<d[T];(l[h]===1&&(!E&&P||E&&C)||l[h]!==1&&(!E&&C||E&&P))&&(g=h==="x"?N:A)}const O={x:u.x+v.x,y:u.y+v.y},D={x:d.x+y.x,y:d.y+y.y},I=Math.max(Math.abs(O.x-g[0].x),Math.abs(D.x-g[0].x)),z=Math.max(Math.abs(O.y-g[0].y),Math.abs(D.y-g[0].y));I>=z?(x=(O.x+D.x)/2,w=g[0].y):(x=g[0].x,w=(O.y+D.y)/2)}const j={x:u.x+v.x,y:u.y+v.y},S={x:d.x+y.x,y:d.y+y.y};return[[e,...j.x!==g[0].x||j.y!==g[0].y?[j]:[],...g,...S.x!==g[g.length-1].x||S.y!==g[g.length-1].y?[S]:[],n],x,w,m,b]}function BU(e,t,n,r){const s=Math.min(hw(e,t)/2,hw(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 _m({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,g,x]=VU({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 v=1;v<f.length-1;v++)w+=BU(f[v-1],f[v],f[v+1],o);return w+=`L${f[f.length-1].x} ${f[f.length-1].y}`,[w,h,p,g,x]}function pw(e){var t;return e&&!!(e.internals.handleBounds||(t=e.handles)!=null&&t.length)&&!!(e.measured.width||e.width||e.initialWidth)}function UU(e){var f;const{sourceNode:t,targetNode:n}=e;if(!pw(t)||!pw(n))return null;const r=t.internals.handleBounds||mw(t.handles),s=n.internals.handleBounds||mw(n.handles),i=gw((r==null?void 0:r.source)??[],e.sourceHandle),o=gw(e.connectionMode===Zi.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",jn.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=Vs(t,i,l),d=Vs(n,o,c);return{sourceX:u.x,sourceY:u.y,targetX:d.x,targetY:d.y,sourcePosition:l,targetPosition:c}}function mw(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 Vs(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??Kn(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 gw(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function wm(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`:""}function HU(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=wm(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 RC=1e3,WU=10,ey={nodeOrigin:[0,0],nodeExtent:Ha,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},KU={...ey,checkEquality:!0};function ty(e,t){const n={...e};for(const r in t)t[r]!==void 0&&(n[r]=t[r]);return n}function qU(e,t,n){const r=ty(ey,n);for(const s of e.values())if(s.parentId)ry(s,e,t,r);else{const i=yl(s,r.nodeOrigin),o=Fs(s.extent)?s.extent:r.nodeExtent,l=zs(i,o,Kn(s));s.internals.positionAbsolute=l}}function GU(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 ny(e){return e==="manual"}function bm(e,t,n,r={}){var d,f;const s=ty(KU,r),i={i:0},o=new Map(t),l=s!=null&&s.elevateNodesOnSelect&&!ny(s.zIndexMode)?RC: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 g=yl(h,s.nodeOrigin),x=Fs(h.extent)?h.extent:s.nodeExtent,w=zs(g,x,Kn(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:GU(h,p),z:IC(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&&ry(p,t,n,r,i),u||(u=h.selected??!1)}return{nodesInitialized:c,hasSelectedNodes:u}}function YU(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 ry(e,t,n,r,s){const{elevateNodesOnSelect:i,nodeOrigin:o,nodeExtent:l,zIndexMode:c}=ty(ey,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}YU(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*WU),s&&d.internals.rootParentIndex!==void 0&&(s.i=d.internals.rootParentIndex);const f=i&&!ny(c)?RC:0,{x:h,y:p,z:g}=XU(e,d,o,l,f,c),{positionAbsolute:x}=e.internals,w=h!==x.x||p!==x.y;(w||g!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:w?{x:h,y:p}:x,z:g}})}function IC(e,t,n){const r=pn(e.zIndex)?e.zIndex:0;return ny(n)?r:r+(e.selected?t:0)}function XU(e,t,n,r,s,i){const{x:o,y:l}=t.internals.positionAbsolute,c=Kn(e),u=yl(e,n),d=Fs(e.extent)?zs(u,e.extent,c):u;let f=zs({x:o+d.x,y:l+d.y},r,c);e.extent==="parent"&&(f=xC(f,c,t));const h=IC(e,s,i),p=t.internals.z??0;return{x:f.x,y:f.y,z:p>=h?p+1:h}}function sy(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)??Ka(c),d=_C(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=Kn(c),h=c.origin??r,p=l.x<d.x?Math.round(Math.abs(d.x-l.x)):0,g=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)),v=(x-f.width)*h[0],y=(w-f.height)*h[1];(p>0||g>0||v||y)&&(s.push({id:u,type:"position",position:{x:c.position.x-p+v,y:c.position.y-g+y}}),(m=n.get(u))==null||m.forEach(b=>{e.some(j=>j.id===b.id)||s.push({id:b.id,type:"position",position:{x:b.position.x+p,y:b.position.y+g}})})),(f.width<l.width||f.height<l.height||p||g)&&s.push({id:u,type:"dimensions",setAttributes:!0,dimensions:{width:x+(p?h[0]*p-v:0),height:w+(g?h[1]*g-y:0)}})}),s}function QU(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 g=t.get(p.id);if(!g)continue;if(g.hidden){t.set(g.id,{...g,internals:{...g.internals,handleBounds:void 0}}),c=!0;continue}const x=Jv(p.nodeElement),w=g.measured.width!==x.width||g.measured.height!==x.height;if(!!(x.width&&x.height&&(w||!g.internals.handleBounds||p.force))){const y=p.nodeElement.getBoundingClientRect(),m=Fs(g.extent)?g.extent:i;let{positionAbsolute:b}=g.internals;if(g.parentId&&g.extent==="parent"){const S=t.get(g.parentId);S&&(b=xC(b,x,S))}else m&&(b=zs(b,m,x));const j={...g,measured:x,internals:{...g.internals,positionAbsolute:b,handleBounds:{source:uw("source",p.nodeElement,y,f,g.id),target:uw("target",p.nodeElement,y,f,g.id)}}};t.set(g.id,j),g.parentId&&ry(j,t,n,{nodeOrigin:s,zIndexMode:o}),c=!0,w&&(u.push({id:g.id,type:"dimensions",dimensions:x}),g.expandParent&&g.parentId&&h.push({id:g.id,parentId:g.parentId,rect:Ka(j,s)}))}}if(h.length>0){const p=sy(h,t,n,s);u.push(...p)}return{changes:u,updatedInternals:c}}async function ZU({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 vw(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 MC(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}`;vw("source",c,d,e,s,o),vw("target",c,u,e,i,l),t.set(r.id,r)}}function OC(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:OC(n,t):!1}function yw(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 JU(e,t,n,r){const s=new Map;for(const[i,o]of e)if((o.selected||o.id===r)&&(!o.parentId||!OC(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 lh({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 eH({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=_l(i,t);return{x:o.x-i.x,y:o.y-i.y}}function tH({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,g=!1,x=null;function w({noDragClassName:y,handleSelector:m,domNode:b,isSelectable:j,nodeId:S,nodeClickDistance:k=0}){h=Nt(b);function N({x:I,y:z}){const{nodeLookup:T,nodeExtent:E,snapGrid:P,snapToGrid:C,nodeOrigin:R,onNodeDrag:M,onSelectionDrag:B,onError:$,updateNodePositions:F}=t();i={x:I,y:z};let H=!1;const W=l.size>1,U=W&&E?xm(xl(l)):null,q=W&&C?eH({dragItems:l,snapGrid:P,x:I,y:z}):null;for(const[Q,K]of l){if(!T.has(Q))continue;let G={x:I-K.distance.x,y:z-K.distance.y};C&&(G=q?{x:Math.round(G.x+q.x),y:Math.round(G.y+q.y)}:_l(G,P));let te=null;if(W&&E&&!K.extent&&U){const{positionAbsolute:J}=K.internals,se=J.x-U.x+E[0][0],le=J.x+K.measured.width-U.x2+E[1][0],fe=J.y-U.y+E[0][1],ye=J.y+K.measured.height-U.y2+E[1][1];te=[[se,fe],[le,ye]]}const{position:ne,positionAbsolute:Y}=yC({nodeId:Q,nextPosition:G,nodeLookup:T,nodeExtent:te||E,nodeOrigin:R,onError:$});H=H||K.position.x!==ne.x||K.position.y!==ne.y,K.position=ne,K.internals.positionAbsolute=Y}if(g=g||H,!!H&&(F(l,!0),x&&(r||M||!S&&B))){const[Q,K]=lh({nodeId:S,dragItems:l,nodeLookup:T});r==null||r(x,l,Q,K),M==null||M(x,Q,K),S||B==null||B(x,K)}}async function A(){if(!d)return;const{transform:I,panBy:z,autoPanSpeed:T,autoPanOnNodeDrag:E}=t();if(!E){c=!1,cancelAnimationFrame(o);return}const[P,C]=Qv(u,d,T);(P!==0||C!==0)&&(i.x=(i.x??0)-P/I[2],i.y=(i.y??0)-C/I[2],await z({x:P,y:C})&&N(i)),o=requestAnimationFrame(A)}function O(I){var W;const{nodeLookup:z,multiSelectionActive:T,nodesDraggable:E,transform:P,snapGrid:C,snapToGrid:R,selectNodesOnDrag:M,onNodeDragStart:B,onSelectionDragStart:$,unselectNodesAndEdges:F}=t();f=!0,(!M||!j)&&!T&&S&&((W=z.get(S))!=null&&W.selected||F()),j&&M&&S&&(e==null||e(S));const H=la(I.sourceEvent,{transform:P,snapGrid:C,snapToGrid:R,containerBounds:d});if(i=H,l=JU(z,E,H,S),l.size>0&&(n||B||!S&&$)){const[U,q]=lh({nodeId:S,dragItems:l,nodeLookup:z});n==null||n(I.sourceEvent,l,U,q),B==null||B(I.sourceEvent,U,q),S||$==null||$(I.sourceEvent,q)}}const D=QE().clickDistance(k).on("start",I=>{const{domNode:z,nodeDragThreshold:T,transform:E,snapGrid:P,snapToGrid:C}=t();d=(z==null?void 0:z.getBoundingClientRect())||null,p=!1,g=!1,x=I.sourceEvent,T===0&&O(I),i=la(I.sourceEvent,{transform:E,snapGrid:P,snapToGrid:C,containerBounds:d}),u=mn(I.sourceEvent,d)}).on("drag",I=>{const{autoPanOnNodeDrag:z,transform:T,snapGrid:E,snapToGrid:P,nodeDragThreshold:C,nodeLookup:R}=t(),M=la(I.sourceEvent,{transform:T,snapGrid:E,snapToGrid:P,containerBounds:d});if(x=I.sourceEvent,(I.sourceEvent.type==="touchmove"&&I.sourceEvent.touches.length>1||S&&!R.has(S))&&(p=!0),!p){if(!c&&z&&f&&(c=!0,A()),!f){const B=mn(I.sourceEvent,d),$=B.x-u.x,F=B.y-u.y;Math.sqrt($*$+F*F)>C&&O(I)}(i.x!==M.xSnapped||i.y!==M.ySnapped)&&l&&f&&(u=mn(I.sourceEvent,d),N(M))}}).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:z,updateNodePositions:T,onNodeDragStop:E,onSelectionDragStop:P}=t();if(g&&(T(l,!1),g=!1),s||E||!S&&P){const[C,R]=lh({nodeId:S,dragItems:l,nodeLookup:z,dragging:!1});s==null||s(I.sourceEvent,l,C,R),E==null||E(I.sourceEvent,C,R),S||P==null||P(I.sourceEvent,R)}}}).filter(I=>{const z=I.target;return!I.button&&(!y||!yw(z,`.${y}`,b))&&(!m||yw(z,m,b))});h.call(D)}function v(){h==null||h.on(".drag",null)}return{update:w,destroy:v}}function nH(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())Gu(s,Ka(i))>0&&r.push(i);return r}const rH=250;function sH(e,t,n,r){var l,c;let s=[],i=1/0;const o=nH(e,n,t+rH);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}=Vs(u,f,f.position,!0),g=Math.sqrt(Math.pow(h-e.x,2)+Math.pow(p-e.y,2));g>t||(g<i?(s=[{...f,x:h,y:p}],i=g):g===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 LC(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,...Vs(o,c,c.position,!0)}:c}function $C(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function iH(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const DC=()=>!0;function oH(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:g,onConnect:x,onConnectEnd:w,isValidConnection:v=DC,onReconnectEnd:y,updateConnection:m,getTransform:b,getFromHandle:j,autoPanSpeed:S,dragThreshold:k=1,handleDomNode:N}){const A=kC(e.target);let O=0,D;const{x:I,y:z}=mn(e),T=$C(i,N),E=l==null?void 0:l.getBoundingClientRect();let P=!1;if(!E||!T)return;const C=LC(s,T,r,c,t);if(!C)return;let R=mn(e,E),M=!1,B=null,$=!1,F=null;function H(){if(!d||!E)return;const[ne,Y]=Qv(R,E,S);h({x:ne,y:Y}),O=requestAnimationFrame(H)}const W={...C,nodeId:s,type:T,position:C.position},U=c.get(s);let Q={inProgress:!0,isValid:null,from:Vs(U,W,re.Left,!0),fromHandle:W,fromPosition:W.position,fromNode:U,to:R,toHandle:null,toPosition:ow[W.position],toNode:null,pointer:R};function K(){P=!0,m(Q),g==null||g(e,{nodeId:s,handleId:r,handleType:T})}k===0&&K();function G(ne){if(!P){const{x:ye,y:Ft}=mn(ne),Nn=ye-I,En=Ft-z;if(!(Nn*Nn+En*En>k*k))return;K()}if(!j()||!W){te(ne);return}const Y=b();R=mn(ne,E),D=sH(wl(R,Y,!1,[1,1]),n,c,W),M||(H(),M=!0);const J=zC(ne,{handle:D,connectionMode:t,fromNodeId:s,fromHandleId:r,fromType:o?"target":"source",isValidConnection:v,doc:A,lib:u,flowId:f,nodeLookup:c});F=J.handleDomNode,B=J.connection,$=iH(!!D,J.isValid);const se=c.get(s),le=se?Vs(se,W,re.Left,!0):Q.from,fe={...Q,from:le,isValid:$,to:J.toHandle&&$?eo({x:J.toHandle.x,y:J.toHandle.y},Y):R,toHandle:J.toHandle,toPosition:$&&J.toHandle?J.toHandle.position:ow[W.position],toNode:J.toHandle?c.get(J.toHandle.nodeId):null,pointer:R};m(fe),Q=fe}function te(ne){if(!("touches"in ne&&ne.touches.length>0)){if(P){(D||F)&&B&&$&&(x==null||x(B));const{inProgress:Y,...J}=Q,se={...J,toPosition:Q.toHandle?Q.toPosition:null};w==null||w(ne,se),i&&(y==null||y(ne,se))}p(),cancelAnimationFrame(O),M=!1,$=!1,B=null,F=null,A.removeEventListener("mousemove",G),A.removeEventListener("mouseup",te),A.removeEventListener("touchmove",G),A.removeEventListener("touchend",te)}}A.addEventListener("mousemove",G),A.addEventListener("mouseup",te),A.addEventListener("touchmove",G),A.addEventListener("touchend",te)}function zC(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:s,fromType:i,doc:o,lib:l,flowId:c,isValidConnection:u=DC,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:g}=mn(e),x=o.elementFromPoint(p,g),w=x!=null&&x.classList.contains(`${l}-flow__handle`)?x:h,v={handleDomNode:w,isValid:!1,connection:null,toHandle:null};if(w){const y=$C(void 0,w),m=w.getAttribute("data-nodeid"),b=w.getAttribute("data-handleid"),j=w.classList.contains("connectable"),S=w.classList.contains("connectableend");if(!m||!y)return v;const k={source:f?m:r,sourceHandle:f?b:s,target:f?r:m,targetHandle:f?s:b};v.connection=k;const A=j&&S&&(n===Zi.Strict?f&&y==="source"||!f&&y==="target":m!==r||b!==s);v.isValid=A&&u(k),v.toHandle=LC(m,y,b,d,n,!0)}return v}const jm={onPointerDown:oH,isValid:zC};function aH({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){const s=Nt(e);function i({translateExtent:l,width:c,height:u,zoomStep:d=1,pannable:f=!0,zoomable:h=!0,inversePan:p=!1}){const g=m=>{if(m.sourceEvent.type!=="wheel"||!t)return;const b=n(),j=m.sourceEvent.ctrlKey&&qa()?10:1,S=-m.sourceEvent.deltaY*(m.sourceEvent.deltaMode===1?.05:m.sourceEvent.deltaMode?1:.002)*d,k=b[2]*Math.pow(2,S*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])},v=m=>{const b=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],S=[j[0]-x[0],j[1]-x[1]];x=j;const k=r()*Math.max(b[2],Math.log(b[2]))*(p?-1:1),N={x:b[0]-S[0]*k,y:b[1]-S[1]*k},A=[[0,0],[c,u]];t.setViewportConstrained({x:N.x,y:N.y,zoom:b[2]},A,l)},y=fC().on("start",w).on("zoom",f?v:null).on("zoom.wheel",h?g:null);s.call(y,{})}function o(){s.on("zoom",null)}return{update:i,destroy:o,pointer:un}}const Wd=e=>({x:e.x,y:e.y,zoom:e.k}),ch=({x:e,y:t,zoom:n})=>Bd.translate(e,t).scale(n),wi=(e,t)=>e.target.closest(`.${t}`),FC=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),lH=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,uh=(e,t=0,n=lH,r=()=>{})=>{const s=typeof t=="number"&&t>0;return s||r(),s?e.transition().duration(t).ease(n).on("end",r):e},VC=e=>{const t=e.ctrlKey&&qa()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function cH({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:s,panOnScrollSpeed:i,zoomOnPinch:o,onPanZoomStart:l,onPanZoom:c,onPanZoomEnd:u}){return d=>{if(wi(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=un(d),v=VC(d),y=f*Math.pow(2,v);r.scaleTo(n,y,w,d);return}const h=d.deltaMode===1?20:1;let p=s===Ns.Vertical?0:d.deltaX*h,g=s===Ns.Horizontal?0:d.deltaY*h;!qa()&&d.shiftKey&&s!==Ns.Vertical&&(p=d.deltaY*h,g=0),r.translateBy(n,-(p/f)*i,-(g/f)*i,{internal:!0});const x=Wd(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 uH({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,s){const i=r.type==="wheel",o=!t&&i&&!r.ctrlKey,l=wi(r,e);if(r.ctrlKey&&i&&l&&r.preventDefault(),o||l)return null;r.preventDefault(),n.call(this,r,s)}}function dH({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{var i,o,l;if((i=r.sourceEvent)!=null&&i.internal)return;const s=Wd(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 fH({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:s}){return i=>{var o,l;e.usedRightMouseButton=!!(n&&FC(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,Wd(i.transform)))}}function hH({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&&FC(t,e.mouseButton??0)&&!e.usedRightMouseButton&&o.sourceEvent&&i(o.sourceEvent),e.usedRightMouseButton=!1,r(!1),s)){const c=Wd(o.transform);e.prevViewport=c,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{s==null||s(o.sourceEvent,c)},n?150:0)}}}function pH({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,g=f.type==="wheel";if(f.button===1&&f.type==="mousedown"&&(wi(f,`${u}-flow__node`)||wi(f,`${u}-flow__edge`)))return!0;if(!r&&!h&&!s&&!i&&!n||o||d&&!g||wi(f,l)&&g||wi(f,c)&&(!g||s&&g&&!e)||!n&&f.ctrlKey&&g)return!1;if(!n&&f.type==="touchstart"&&((w=f.touches)==null?void 0:w.length)>1)return f.preventDefault(),!1;if(!h&&!s&&!p&&g||!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||g)&&x}}function mH({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(z=>{const T=z[0];T&&(f=[[0,0],[T.contentRect.width,T.contentRect.height]])}):null;h==null||h.observe(e);const p=fC().extent(()=>f).scaleExtent([t,n]).translateExtent(r),g=Nt(e).call(p);b({x:s.x,y:s.y,zoom:Ji(s.zoom,t,n)},[[0,0],[d.width,d.height]],r);const x=g.on("wheel.zoom"),w=g.on("dblclick.zoom");p.wheelDelta(VC);async function v(z,T){return g?new Promise(E=>{p==null||p.interpolate((T==null?void 0:T.interpolate)==="linear"?aa:Dc).transform(uh(g,T==null?void 0:T.duration,T==null?void 0:T.ease,()=>E(!0)),z)}):!1}function y({noWheelClassName:z,noPanClassName:T,onPaneContextMenu:E,userSelectionActive:P,panOnScroll:C,panOnDrag:R,panOnScrollMode:M,panOnScrollSpeed:B,preventScrolling:$,zoomOnPinch:F,zoomOnScroll:H,zoomOnDoubleClick:W,zoomActivationKeyPressed:U,lib:q,onTransformChange:Q,connectionInProgress:K,paneClickDistance:G,selectionOnDrag:te}){P&&!u.isZoomingOrPanning&&m();const ne=C&&!U&&!P;p.clickDistance(te?1/0:!pn(G)||G<0?0:G);const Y=ne?cH({zoomPanValues:u,noWheelClassName:z,d3Selection:g,d3Zoom:p,panOnScrollMode:M,panOnScrollSpeed:B,zoomOnPinch:F,onPanZoomStart:o,onPanZoom:i,onPanZoomEnd:l}):uH({noWheelClassName:z,preventScrolling:$,d3ZoomHandler:x});g.on("wheel.zoom",Y,{passive:!1});const J=dH({zoomPanValues:u,onDraggingChange:c,onPanZoomStart:o});p.on("start",J);const se=fH({zoomPanValues:u,panOnDrag:R,onPaneContextMenu:!!E,onPanZoom:i,onTransformChange:Q});p.on("zoom",se);const le=hH({zoomPanValues:u,panOnDrag:R,panOnScroll:C,onPaneContextMenu:E,onPanZoomEnd:l,onDraggingChange:c});p.on("end",le);const fe=pH({zoomActivationKeyPressed:U,panOnDrag:R,zoomOnScroll:H,panOnScroll:C,zoomOnDoubleClick:W,zoomOnPinch:F,userSelectionActive:P,noPanClassName:T,noWheelClassName:z,lib:q,connectionInProgress:K});p.filter(fe),W?g.on("dblclick.zoom",w):g.on("dblclick.zoom",null)}function m(){p.on("zoom",null)}async function b(z,T,E){const P=ch(z),C=p==null?void 0:p.constrain()(P,T,E);return C&&await v(C),C}async function j(z,T){const E=ch(z);return await v(E,T),E}function S(z){if(g){const T=ch(z),E=g.property("__zoom");(E.k!==z.zoom||E.x!==z.x||E.y!==z.y)&&(p==null||p.transform(g,T,null,{sync:!0}))}}function k(){const z=g?dC(g.node()):{x:0,y:0,k:1};return{x:z.x,y:z.y,zoom:z.k}}async function N(z,T){return g?new Promise(E=>{p==null||p.interpolate((T==null?void 0:T.interpolate)==="linear"?aa:Dc).scaleTo(uh(g,T==null?void 0:T.duration,T==null?void 0:T.ease,()=>E(!0)),z)}):!1}async function A(z,T){return g?new Promise(E=>{p==null||p.interpolate((T==null?void 0:T.interpolate)==="linear"?aa:Dc).scaleBy(uh(g,T==null?void 0:T.duration,T==null?void 0:T.ease,()=>E(!0)),z)}):!1}function O(z){p==null||p.scaleExtent(z)}function D(z){p==null||p.translateExtent(z)}function I(z){const T=!pn(z)||z<0?0:z;p==null||p.clickDistance(T)}return{update:y,destroy:m,setViewport:j,setViewportConstrained:b,getViewport:k,scaleTo:N,scaleBy:A,setScaleExtent:O,setTranslateExtent:D,syncViewport:S,setClickDistance:I}}var to;(function(e){e.Line="line",e.Handle="handle"})(to||(to={}));function gH({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 xw(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 Er(e,t){return Math.max(0,t-e)}function Cr(e,t){return Math.max(0,e-t)}function rc(e,t,n){return Math.max(0,t-e,e-n)}function _w(e,t){return e?!t:t}function vH(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:g}=n,{minWidth:x,maxWidth:w,minHeight:v,maxHeight:y}=r,{x:m,y:b,width:j,height:S,aspectRatio:k}=e;let N=Math.floor(d?p-e.pointerX:0),A=Math.floor(f?g-e.pointerY:0);const O=j+(c?-N:N),D=S+(u?-A:A),I=-i[0]*j,z=-i[1]*S;let T=rc(O,x,w),E=rc(D,v,y);if(o){let R=0,M=0;c&&N<0?R=Er(m+N+I,o[0][0]):!c&&N>0&&(R=Cr(m+O+I,o[1][0])),u&&A<0?M=Er(b+A+z,o[0][1]):!u&&A>0&&(M=Cr(b+D+z,o[1][1])),T=Math.max(T,R),E=Math.max(E,M)}if(l){let R=0,M=0;c&&N>0?R=Cr(m+N,l[0][0]):!c&&N<0&&(R=Er(m+O,l[1][0])),u&&A>0?M=Cr(b+A,l[0][1]):!u&&A<0&&(M=Er(b+D,l[1][1])),T=Math.max(T,R),E=Math.max(E,M)}if(s){if(d){const R=rc(O/k,v,y)*k;if(T=Math.max(T,R),o){let M=0;!c&&!u||c&&!u&&h?M=Cr(b+z+O/k,o[1][1])*k:M=Er(b+z+(c?N:-N)/k,o[0][1])*k,T=Math.max(T,M)}if(l){let M=0;!c&&!u||c&&!u&&h?M=Er(b+O/k,l[1][1])*k:M=Cr(b+(c?N:-N)/k,l[0][1])*k,T=Math.max(T,M)}}if(f){const R=rc(D*k,x,w)/k;if(E=Math.max(E,R),o){let M=0;!c&&!u||u&&!c&&h?M=Cr(m+D*k+I,o[1][0])/k:M=Er(m+(u?A:-A)*k+I,o[0][0])/k,E=Math.max(E,M)}if(l){let M=0;!c&&!u||u&&!c&&h?M=Er(m+D*k,l[1][0])/k:M=Cr(m+(u?A:-A)*k,l[0][0])/k,E=Math.max(E,M)}}}A=A+(A<0?E:-E),N=N+(N<0?T:-T),s&&(h?O>D*k?A=(_w(c,u)?-N:N)/k:N=(_w(c,u)?-A:A)*k:d?(A=N/k,u=c):(N=A*k,c=u));const P=c?m+N:m,C=u?b+A:b;return{width:j+(c?-N:N),height:S+(u?-A:A),x:i[0]*N*(c?-1:1)+P,y:i[1]*A*(u?-1:1)+C}}const BC={width:0,height:0,x:0,y:0},yH={...BC,pointerX:0,pointerY:0,aspectRatio:1};function xH(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 _H({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:s}){const i=Nt(e);let o={controlDirection:xw("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:g,onResizeEnd:x,shouldResize:w}){let v={...BC},y={...yH};o={boundaries:d,resizeDirection:h,keepAspectRatio:f,controlDirection:xw(u)};let m,b=null,j=[],S,k,N,A=!1;const O=QE().on("start",D=>{const{nodeLookup:I,transform:z,snapGrid:T,snapToGrid:E,nodeOrigin:P,paneDomNode:C}=n();if(m=I.get(t),!m)return;b=(C==null?void 0:C.getBoundingClientRect())??null;const{xSnapped:R,ySnapped:M}=la(D.sourceEvent,{transform:z,snapGrid:T,snapToGrid:E,containerBounds:b});v={width:m.measured.width??0,height:m.measured.height??0,x:m.position.x??0,y:m.position.y??0},y={...v,pointerX:R,pointerY:M,aspectRatio:v.width/v.height},S=void 0,k=Fs(m.extent)?m.extent:void 0,m.parentId&&(m.extent==="parent"||m.expandParent)&&(S=I.get(m.parentId)),S&&m.extent==="parent"&&(k=[[0,0],[S.measured.width,S.measured.height]]),j=[],N=void 0;for(const[B,$]of I)if($.parentId===t&&(j.push({id:B,position:{...$.position},extent:$.extent}),$.extent==="parent"||$.expandParent)){const F=xH($,m,$.origin??P);N?N=[[Math.min(F[0][0],N[0][0]),Math.min(F[0][1],N[0][1])],[Math.max(F[1][0],N[1][0]),Math.max(F[1][1],N[1][1])]]:N=F}p==null||p(D,{...v})}).on("drag",D=>{const{transform:I,snapGrid:z,snapToGrid:T,nodeOrigin:E}=n(),P=la(D.sourceEvent,{transform:I,snapGrid:z,snapToGrid:T,containerBounds:b}),C=[];if(!m)return;const{x:R,y:M,width:B,height:$}=v,F={},H=m.origin??E,{width:W,height:U,x:q,y:Q}=vH(y,o.controlDirection,P,o.boundaries,o.keepAspectRatio,H,k,N),K=W!==B,G=U!==$,te=q!==R&&K,ne=Q!==M&&G;if(!te&&!ne&&!K&&!G)return;if((te||ne||H[0]===1||H[1]===1)&&(F.x=te?q:v.x,F.y=ne?Q:v.y,v.x=F.x,v.y=F.y,j.length>0)){const le=q-R,fe=Q-M;for(const ye of j)ye.position={x:ye.position.x-le+H[0]*(W-B),y:ye.position.y-fe+H[1]*(U-$)},C.push(ye)}if((K||G)&&(F.width=K&&(!o.resizeDirection||o.resizeDirection==="horizontal")?W:v.width,F.height=G&&(!o.resizeDirection||o.resizeDirection==="vertical")?U:v.height,v.width=F.width,v.height=F.height),S&&m.expandParent){const le=H[0]*(F.width??0);F.x&&F.x<le&&(v.x=le,y.x=y.x-(F.x-le));const fe=H[1]*(F.height??0);F.y&&F.y<fe&&(v.y=fe,y.y=y.y-(F.y-fe))}const Y=gH({width:v.width,prevWidth:B,height:v.height,prevHeight:$,affectsX:o.controlDirection.affectsX,affectsY:o.controlDirection.affectsY}),J={...v,direction:Y};(w==null?void 0:w(D,J))!==!1&&(A=!0,g==null||g(D,J),r(F,C))}).on("end",D=>{A&&(x==null||x(D,{...v}),s==null||s({...v}),A=!1)});i.call(O)}function c(){i.on(".drag",null)}return{update:l,destroy:c}}var UC={exports:{}},HC={};/**
|
|
79
|
-
* @license React
|
|
80
|
-
* use-sync-external-store-shim/with-selector.production.js
|
|
81
|
-
*
|
|
82
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
83
|
-
*
|
|
84
|
-
* This source code is licensed under the MIT license found in the
|
|
85
|
-
* LICENSE file in the root directory of this source tree.
|
|
86
|
-
*/var Kd=_,wH=sk;function bH(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var jH=typeof Object.is=="function"?Object.is:bH,SH=wH.useSyncExternalStore,kH=Kd.useRef,NH=Kd.useEffect,EH=Kd.useMemo,CH=Kd.useDebugValue;HC.useSyncExternalStoreWithSelector=function(e,t,n,r,s){var i=kH(null);if(i.current===null){var o={hasValue:!1,value:null};i.current=o}else o=i.current;i=EH(function(){function c(p){if(!u){if(u=!0,d=p,p=r(p),s!==void 0&&o.hasValue){var g=o.value;if(s(g,p))return f=g}return f=p}if(g=f,jH(d,p))return g;var x=r(p);return s!==void 0&&s(g,x)?(d=p,g):(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=SH(e,i[0],i[1]);return NH(function(){o.hasValue=!0,o.value=l},[l]),CH(l),l};UC.exports=HC;var TH=UC.exports;const PH=Sb(TH),AH={},ww=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(g=>g(t,p))}},s=()=>t,c={setState:r,getState:s,getInitialState:()=>u,subscribe:d=>(n.add(d),()=>n.delete(d)),destroy:()=>{(AH?"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},RH=e=>e?ww(e):ww,{useDebugValue:IH}=or,{useSyncExternalStoreWithSelector:MH}=PH,OH=e=>e;function WC(e,t=OH,n){const r=MH(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return IH(r),r}const bw=(e,t)=>{const n=RH(e),r=(s,i=t)=>WC(n,s,i);return Object.assign(r,n),r},LH=(e,t)=>e?bw(e,t):bw;function Le(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 qd=_.createContext(null),$H=qd.Provider,KC=jn.error001("react");function me(e,t){const n=_.useContext(qd);if(n===null)throw new Error(KC);return WC(n,e,t)}function Te(){const e=_.useContext(qd);if(e===null)throw new Error(KC);return _.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const jw={display:"none"},DH={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},qC="react-flow__node-desc",GC="react-flow__edge-desc",zH="react-flow__aria-live",FH=e=>e.ariaLiveMessage,VH=e=>e.ariaLabelConfig;function BH({rfId:e}){const t=me(FH);return a.jsx("div",{id:`${zH}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:DH,children:t})}function UH({rfId:e,disableKeyboardA11y:t}){const n=me(VH);return a.jsxs(a.Fragment,{children:[a.jsx("div",{id:`${qC}-${e}`,style:jw,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),a.jsx("div",{id:`${GC}-${e}`,style:jw,children:n["edge.a11yDescription.default"]}),!t&&a.jsx(BH,{rfId:e})]})}const Gd=_.forwardRef(({position:e="top-left",children:t,className:n,style:r,...s},i)=>{const o=`${e}`.split("-");return a.jsx("div",{className:He(["react-flow__panel",n,...o]),style:r,ref:i,...s,children:t})});Gd.displayName="Panel";const Sw="https://reactflow.dev?utm_source=attribution";function HH({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:a.jsx(Gd,{position:t,className:"react-flow__attribution","data-message":`Please only hide this attribution when you are subscribed to React Flow Pro: ${Sw}`,children:a.jsx("a",{href:Sw,target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const WH=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}},sc=e=>e.id;function KH(e,t){return Le(e.selectedNodes.map(sc),t.selectedNodes.map(sc))&&Le(e.selectedEdges.map(sc),t.selectedEdges.map(sc))}function qH({onSelectionChange:e}){const t=Te(),{selectedNodes:n,selectedEdges:r}=me(WH,KH);return _.useEffect(()=>{const s={nodes:n,edges:r};e==null||e(s),t.getState().onSelectionChangeHandlers.forEach(i=>i(s))},[n,r,e]),null}const GH=e=>!!e.onSelectionChangeHandlers;function YH({onSelectionChange:e}){const t=me(GH);return e||t?a.jsx(qH,{onSelectionChange:e}):null}const YC=[0,0],XH={x:0,y:0,zoom:1},QH=["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"],kw=[...QH,"rfId"],ZH=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}),Nw={translateExtent:Ha,nodeOrigin:YC,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function JH(e){const{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:s,setTranslateExtent:i,setNodeExtent:o,reset:l,setDefaultNodesAndEdges:c}=me(ZH,Le),u=Te();_.useEffect(()=>(c(e.defaultNodes,e.defaultEdges),()=>{d.current=Nw,l()}),[]);const d=_.useRef(Nw);return _.useEffect(()=>{for(const f of kw){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:IU(h)}):f==="fitView"?u.setState({fitViewQueued:h}):f==="fitViewOptions"?u.setState({fitViewOptions:h}):u.setState({[f]:h})))}d.current=e},kw.map(f=>e[f])),null}function Ew(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function eW(e){var r;const[t,n]=_.useState(e==="system"?null:e);return _.useEffect(()=>{if(e!=="system"){n(e);return}const s=Ew(),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=Ew())!=null&&r.matches?"dark":"light"}const Cw=typeof document<"u"?document:null;function Ga(e=null,t={target:Cw,actInsideInputWithModifier:!0}){const[n,r]=_.useState(!1),s=_.useRef(!1),i=_.useRef(new Set([])),[o,l]=_.useMemo(()=>{if(e!==null){const u=(Array.isArray(e)?e:[e]).filter(f=>typeof f=="string").map(f=>f.replace("+",`
|
|
87
|
-
`).replace(`
|
|
88
|
-
|
|
89
|
-
`,`
|
|
90
|
-
+`).split(`
|
|
91
|
-
`)),d=u.reduce((f,h)=>f.concat(...h),[]);return[u,d]}return[[],[]]},[e]);return _.useEffect(()=>{const c=(t==null?void 0:t.target)??Cw,u=(t==null?void 0:t.actInsideInputWithModifier)??!0;if(e!==null){const d=p=>{var w,v;if(s.current=p.ctrlKey||p.metaKey||p.shiftKey||p.altKey,(!s.current||s.current&&!u)&&NC(p))return!1;const x=Pw(p.code,l);if(i.current.add(p[x]),Tw(o,i.current,!1)){const y=((v=(w=p.composedPath)==null?void 0:w.call(p))==null?void 0:v[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 g=Pw(p.code,l);Tw(o,i.current,!0)?(r(!1),i.current.clear()):i.current.delete(p[g]),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 Tw(e,t,n){return e.filter(r=>n||r.length===t.size).some(r=>r.every(s=>t.has(s)))}function Pw(e,t){return t.includes(e)?"code":"key"}const tW=()=>{const e=Te();return _.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=Zv(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 wl(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=eo(t,n);return{x:o.x+s,y:o.y+i}}}),[])};function XC(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)nW(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 nW(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 rW(e,t){return XC(e,t)}function sW(e,t){return XC(e,t)}function ps(e,t){return{id:e,type:"select",selected:t}}function bi(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(ps(i.id,o)))}return r}function Aw({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 Rw(e){return{id:e.id,type:"remove"}}const iW=bC();function oW(e,t,n={}){return zU(e,t,{...n,onError:n.onError??iW})}const Iw=e=>SU(e),aW=e=>vC(e);function QC(e){return _.forwardRef(e)}const ZC=typeof window<"u"?_.useLayoutEffect:_.useEffect;function Mw(e){const[t,n]=_.useState(BigInt(0)),[r]=_.useState(()=>lW(()=>n(s=>s+BigInt(1))));return ZC(()=>{const s=r.get();s.length&&(e(s),r.reset())},[t]),r}function lW(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}const JC=_.createContext(null);function cW({children:e}){const t=Te(),n=_.useCallback(l=>{const{nodes:c=[],setNodes:u,hasDefaultNodes:d,onNodesChange:f,nodeLookup:h,fitViewQueued:p,onNodesChangeMiddlewareMap:g}=t.getState();let x=c;for(const v of l)x=typeof v=="function"?v(x):v;let w=Aw({items:x,lookup:h});for(const v of g.values())w=v(w);d&&u(x),w.length>0?f==null||f(w):p&&window.requestAnimationFrame(()=>{const{fitViewQueued:v,nodes:y,setNodes:m}=t.getState();v&&m(y)})},[]),r=Mw(n),s=_.useCallback(l=>{const{edges:c=[],setEdges:u,hasDefaultEdges:d,onEdgesChange:f,edgeLookup:h}=t.getState();let p=c;for(const g of l)p=typeof g=="function"?g(p):g;d?u(p):f&&f(Aw({items:p,lookup:h}))},[]),i=Mw(s),o=_.useMemo(()=>({nodeQueue:r,edgeQueue:i}),[]);return a.jsx(JC.Provider,{value:o,children:e})}function uW(){const e=_.useContext(JC);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const dW=e=>!!e.panZoom;function iy(){const e=tW(),t=Te(),n=uW(),r=me(dW),s=_.useMemo(()=>{const i=f=>t.getState().nodeLookup.get(f),o=f=>{n.nodeQueue.push(f)},l=f=>{n.edgeQueue.push(f)},c=f=>{var v,y;const{nodeLookup:h,nodeOrigin:p}=t.getState(),g=Iw(f)?f:h.get(f.id),x=g.parentId?SC(g.position,g.measured,g.parentId,h,p):g.position,w={...g,position:x,width:((v=g.measured)==null?void 0:v.width)??g.width,height:((y=g.measured)==null?void 0:y.height)??g.height};return Ka(w)},u=(f,h,p={replace:!1})=>{o(g=>g.map(x=>{if(x.id===f){const w=typeof h=="function"?h(x):h;return p.replace&&Iw(w)?w:{...x,...w}}return x}))},d=(f,h,p={replace:!1})=>{l(g=>g.map(x=>{if(x.id===f){const w=typeof h=="function"?h(x):h;return p.replace&&aW(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(),[g,x,w]=p;return{nodes:f.map(v=>({...v})),edges:h.map(v=>({...v})),viewport:{x:g,y:x,zoom:w}}},deleteElements:async({nodes:f=[],edges:h=[]})=>{const{nodes:p,edges:g,onNodesDelete:x,onEdgesDelete:w,triggerNodeChanges:v,triggerEdgeChanges:y,onDelete:m,onBeforeDelete:b}=t.getState(),{nodes:j,edges:S}=await TU({nodesToRemove:f,edgesToRemove:h,nodes:p,edges:g,onBeforeDelete:b}),k=S.length>0,N=j.length>0;if(k){const A=S.map(Rw);w==null||w(S),y(A)}if(N){const A=j.map(Rw);x==null||x(j),v(A)}return(N||k)&&(m==null||m({nodes:j,edges:S})),{deletedNodes:j,deletedEdges:S}},getIntersectingNodes:(f,h=!0,p)=>{const g=lw(f),x=g?f:c(f),w=p!==void 0;return x?(p||t.getState().nodes).filter(v=>{const y=t.getState().nodeLookup.get(v.id);if(y&&!g&&(v.id===f.id||!y.internals.positionAbsolute))return!1;const m=Ka(w?v:y),b=Gu(m,x);return h&&b>0||b>=m.width*m.height||b>=x.width*x.height}):[]},isNodeIntersecting:(f,h,p=!0)=>{const x=lw(f)?f:c(f);if(!x)return!1;const w=Gu(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,g=>{const x=typeof h=="function"?h(g):h;return p.replace?{...g,data:x}:{...g,data:{...g.data,...x}}},p)},updateEdge:d,updateEdgeData:(f,h,p={replace:!1})=>{d(f,g=>{const x=typeof h=="function"?h(g):h;return p.replace?{...g,data:x}:{...g,data:{...g.data,...x}}},p)},getNodesBounds:f=>{const{nodeLookup:h,nodeOrigin:p}=t.getState();return kU(f,{nodeLookup:h,nodeOrigin:p})},getHandleConnections:({type:f,id:h,nodeId:p})=>{var g;return Array.from(((g=t.getState().connectionLookup.get(`${p}-${f}${h?`-${h}`:""}`))==null?void 0:g.values())??[])},getNodeConnections:({type:f,handleId:h,nodeId:p})=>{var g;return Array.from(((g=t.getState().connectionLookup.get(`${p}${f?h?`-${f}-${h}`:`-${f}`:""}`))==null?void 0:g.values())??[])},fitView:async f=>{const h=t.getState().fitViewResolver??RU();return t.setState({fitViewQueued:!0,fitViewOptions:f,fitViewResolver:h}),n.nodeQueue.push(p=>[...p]),h.promise}}},[]);return _.useMemo(()=>({...s,...e,viewportInitialized:r}),[r])}const Ow=e=>e.selected,fW=typeof window<"u"?window:void 0;function hW({deleteKeyCode:e,multiSelectionKeyCode:t}){const n=Te(),{deleteElements:r}=iy(),s=Ga(e,{actInsideInputWithModifier:!1}),i=Ga(t,{target:fW});_.useEffect(()=>{if(s){const{edges:o,nodes:l}=n.getState();r({nodes:l.filter(Ow),edges:o.filter(Ow)}),n.setState({nodesSelectionActive:!1})}},[s]),_.useEffect(()=>{n.setState({multiSelectionActive:i})},[i])}function pW(e){const t=Te();_.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=Jv(e.current);(r.height===0||r.width===0)&&((l=(o=t.getState()).onError)==null||l.call(o,"004",jn.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 Yd={position:"absolute",width:"100%",height:"100%",top:0,left:0},mW=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function gW({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:r=!1,panOnScrollSpeed:s=.5,panOnScrollMode:i=Ns.Free,zoomOnDoubleClick:o=!0,panOnDrag:l=!0,defaultViewport:c,translateExtent:u,minZoom:d,maxZoom:f,zoomActivationKeyCode:h,preventScrolling:p=!0,children:g,noWheelClassName:x,noPanClassName:w,onViewportChange:v,isControlledViewport:y,paneClickDistance:m,selectionOnDrag:b}){const j=Te(),S=_.useRef(null),{userSelectionActive:k,lib:N,connectionInProgress:A}=me(mW,Le),O=Ga(h),D=_.useRef();pW(S);const I=_.useCallback(z=>{v==null||v({x:z[0],y:z[1],zoom:z[2]}),y||j.setState({transform:z})},[v,y]);return _.useEffect(()=>{if(S.current){D.current=mH({domNode:S.current,minZoom:d,maxZoom:f,translateExtent:u,viewport:c,onDraggingChange:P=>j.setState(C=>C.paneDragging===P?C:{paneDragging:P}),onPanZoomStart:(P,C)=>{const{onViewportChangeStart:R,onMoveStart:M}=j.getState();M==null||M(P,C),R==null||R(C)},onPanZoom:(P,C)=>{const{onViewportChange:R,onMove:M}=j.getState();M==null||M(P,C),R==null||R(C)},onPanZoomEnd:(P,C)=>{const{onViewportChangeEnd:R,onMoveEnd:M}=j.getState();M==null||M(P,C),R==null||R(C)}});const{x:z,y:T,zoom:E}=D.current.getViewport();return j.setState({panZoom:D.current,transform:[z,T,E],domNode:S.current.closest(".react-flow")}),()=>{var P;(P=D.current)==null||P.destroy()}}},[]),_.useEffect(()=>{var z;(z=D.current)==null||z.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:r,panOnScrollSpeed:s,panOnScrollMode:i,zoomOnDoubleClick:o,panOnDrag:l,zoomActivationKeyPressed:O,preventScrolling:p,noPanClassName:w,userSelectionActive:k,noWheelClassName:x,lib:N,onTransformChange:I,connectionInProgress:A,selectionOnDrag:b,paneClickDistance:m})},[e,t,n,r,s,i,o,l,O,p,w,k,x,N,I,A,b,m]),a.jsx("div",{className:"react-flow__renderer",ref:S,style:Yd,children:g})}const vW=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function yW(){const{userSelectionActive:e,userSelectionRect:t}=me(vW,Le);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 dh=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},xW=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging,panBy:e.panBy,autoPanSpeed:e.autoPanSpeed});function _W({isSelecting:e,selectionKeyPressed:t,selectionMode:n=Wa.Full,panOnDrag:r,autoPanOnSelection:s,paneClickDistance:i,selectionOnDrag:o,onSelectionStart:l,onSelectionEnd:c,onPaneClick:u,onPaneContextMenu:d,onPaneScroll:f,onPaneMouseEnter:h,onPaneMouseMove:p,onPaneMouseLeave:g,children:x}){const w=_.useRef(0),v=Te(),{userSelectionActive:y,elementsSelectable:m,dragging:b,panBy:j,autoPanSpeed:S}=me(xW,Le),k=m&&(e||y),N=_.useRef(null),A=_.useRef(),O=_.useRef(new Set),D=_.useRef(new Set),I=_.useRef(!1),z=_.useRef(!1),T=_.useRef({x:0,y:0}),E=_.useRef(!1),P=K=>{if(z.current||I.current||v.getState().connection.inProgress){z.current=!1,I.current=!1;return}u==null||u(K),v.getState().resetSelectedElements(),v.setState({nodesSelectionActive:!1})},C=K=>{if(Array.isArray(r)&&(r!=null&&r.includes(2))){K.preventDefault();return}d==null||d(K)},R=f?K=>f(K):void 0,M=K=>{z.current&&(K.stopPropagation(),z.current=!1)},B=K=>{var ye,Ft;const{domNode:G,transform:te}=v.getState();if(A.current=G==null?void 0:G.getBoundingClientRect(),!A.current)return;const ne=K.target===N.current;if(!ne&&!!K.target.closest(".nokey")||!e||!(o&&ne||t)||K.button!==0||!K.isPrimary)return;(Ft=(ye=K.target)==null?void 0:ye.setPointerCapture)==null||Ft.call(ye,K.pointerId),z.current=!1;const{x:se,y:le}=mn(K.nativeEvent,A.current),fe=wl({x:se,y:le},te);v.setState({userSelectionRect:{width:0,height:0,startX:fe.x,startY:fe.y,x:se,y:le}}),ne||(K.stopPropagation(),K.preventDefault())};function $(K,G){const{userSelectionRect:te}=v.getState();if(!te)return;const{transform:ne,nodeLookup:Y,edgeLookup:J,connectionLookup:se,triggerNodeChanges:le,triggerEdgeChanges:fe,defaultEdgeOptions:ye}=v.getState(),Ft={x:te.startX,y:te.startY},{x:Nn,y:En}=eo(Ft,ne),qn={startX:Ft.x,startY:Ft.y,x:K<Nn?K:Nn,y:G<En?G:En,width:Math.abs(K-Nn),height:Math.abs(G-En)},vo=O.current,rs=D.current;O.current=new Set(Xv(Y,qn,ne,n===Wa.Partial,!0).map(sn=>sn.id)),D.current=new Set;const ss=(ye==null?void 0:ye.selectable)??!0;for(const sn of O.current){const Gn=se.get(sn);if(Gn)for(const{edgeId:Yn}of Gn.values()){const is=J.get(Yn);is&&(is.selectable??ss)&&D.current.add(Yn)}}if(!cw(vo,O.current)){const sn=bi(Y,O.current,!0);le(sn)}if(!cw(rs,D.current)){const sn=bi(J,D.current);fe(sn)}v.setState({userSelectionRect:qn,userSelectionActive:!0,nodesSelectionActive:!1})}function F(){if(!s||!A.current)return;const[K,G]=Qv(T.current,A.current,S);j({x:K,y:G}).then(te=>{if(!z.current||!te){w.current=requestAnimationFrame(F);return}const{x:ne,y:Y}=T.current;$(ne,Y),w.current=requestAnimationFrame(F)})}const H=()=>{cancelAnimationFrame(w.current),w.current=0,E.current=!1};_.useEffect(()=>()=>H(),[]);const W=K=>{const{userSelectionRect:G,transform:te,resetSelectedElements:ne}=v.getState();if(!A.current||!G)return;const{x:Y,y:J}=mn(K.nativeEvent,A.current);T.current={x:Y,y:J};const se=eo({x:G.startX,y:G.startY},te);if(!z.current){const le=t?0:i;if(Math.hypot(Y-se.x,J-se.y)<=le)return;ne(),l==null||l(K)}z.current=!0,E.current||(F(),E.current=!0),$(Y,J)},U=K=>{var G,te;if(!k){K.target===N.current&&v.getState().connection.inProgress&&(I.current=!0);return}K.button===0&&((te=(G=K.target)==null?void 0:G.releasePointerCapture)==null||te.call(G,K.pointerId),!y&&K.target===N.current&&v.getState().userSelectionRect&&(P==null||P(K)),v.setState({userSelectionActive:!1,userSelectionRect:null}),z.current&&(c==null||c(K),v.setState({nodesSelectionActive:O.current.size>0})),H())},q=K=>{var G,te;(te=(G=K.target)==null?void 0:G.releasePointerCapture)==null||te.call(G,K.pointerId),H()},Q=r===!0||Array.isArray(r)&&r.includes(0);return a.jsxs("div",{className:He(["react-flow__pane",{draggable:Q,dragging:b,selection:e}]),onClick:k?void 0:dh(P,N),onContextMenu:dh(C,N),onWheel:dh(R,N),onPointerEnter:k?void 0:h,onPointerMove:k?W:p,onPointerUp:U,onPointerCancel:k?q:void 0,onPointerDownCapture:k?B:void 0,onClickCapture:k?M:void 0,onPointerLeave:g,ref:N,style:Yd,children:[x,a.jsx(yW,{})]})}function Sm({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",jn.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 eT({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:s,isSelectable:i,nodeClickDistance:o}){const l=Te(),[c,u]=_.useState(!1),d=_.useRef();return _.useEffect(()=>{if(!t)return d.current=tH({getStoreItems:()=>l.getState(),onNodeMouseDown:f=>{Sm({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]),_.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 wW=e=>t=>t.selected&&(t.draggable||e&&typeof t.draggable>"u");function tT(){const e=Te();return _.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=wW(o),p=s?i[0]:5,g=s?i[1]:5,x=n.direction.x*p*n.factor,w=n.direction.y*g*n.factor;for(const[,v]of u){if(!h(v))continue;let y={x:v.internals.positionAbsolute.x+x,y:v.internals.positionAbsolute.y+w};s&&(y=_l(y,i));const{position:m,positionAbsolute:b}=yC({nodeId:v.id,nextPosition:y,nodeLookup:u,nodeExtent:r,nodeOrigin:d,onError:l});v.position=m,v.internals.positionAbsolute=b,f.set(v.id,v)}c(f)},[])}const oy=_.createContext(null),bW=oy.Provider;oy.Consumer;const nT=()=>_.useContext(oy),jW=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),rT=_.createContext(null);function SW({children:e}){const t=me(jW,Le);return a.jsx(rT.Provider,{value:t,children:e})}function kW(){const e=_.useContext(rT);if(!e)throw new Error("useHandleConfig must be used within a HandleConfigProvider");return e}const NW={connectingFrom:!1,connectingTo:!1,clickConnecting:!1,isPossibleEndHandle:!0,connectionInProcess:!1,clickConnectionInProcess:!1,valid:!1},EW=(e,t,n)=>r=>{const{connectionClickStartHandle:s,connectionMode:i,connection:o}=r,{fromHandle:l,toHandle:c,isValid:u}=o;if(!l&&!s)return NW;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===Zi.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 CW({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 E,P;const g=o||null,x=e==="target",w=Te(),v=nT(),{connectOnClick:y,noPanClassName:m,rfId:b}=kW(),{connectingFrom:j,connectingTo:S,clickConnecting:k,isPossibleEndHandle:N,connectionInProcess:A,clickConnectionInProcess:O,valid:D}=me(EW(v,g,e),Le);v||(P=(E=w.getState()).onError)==null||P.call(E,"010",jn.error010());const I=C=>{const{defaultEdgeOptions:R,onConnect:M,hasDefaultEdges:B}=w.getState(),$={...R,...C};if(B){const{edges:F,setEdges:H,onError:W}=w.getState();H(oW($,F,{onError:W}))}M==null||M($),l==null||l($)},z=C=>{if(!v)return;const R=EC(C.nativeEvent);if(s&&(R&&C.button===0||!R)){const M=w.getState();jm.onPointerDown(C.nativeEvent,{handleDomNode:C.currentTarget,autoPanOnConnect:M.autoPanOnConnect,connectionMode:M.connectionMode,connectionRadius:M.connectionRadius,domNode:M.domNode,nodeLookup:M.nodeLookup,lib:M.lib,isTarget:x,handleId:g,nodeId:v,flowId:M.rfId,panBy:M.panBy,cancelConnection:M.cancelConnection,onConnectStart:M.onConnectStart,onConnectEnd:(...B)=>{var $,F;return(F=($=w.getState()).onConnectEnd)==null?void 0:F.call($,...B)},updateConnection:M.updateConnection,onConnect:I,isValidConnection:n||((...B)=>{var $,F;return((F=($=w.getState()).isValidConnection)==null?void 0:F.call($,...B))??!0}),getTransform:()=>w.getState().transform,getFromHandle:()=>w.getState().connection.fromHandle,autoPanSpeed:M.autoPanSpeed,dragThreshold:M.connectionDragThreshold})}R?d==null||d(C):f==null||f(C)},T=C=>{const{onClickConnectStart:R,onClickConnectEnd:M,connectionClickStartHandle:B,connectionMode:$,isValidConnection:F,lib:H,rfId:W,nodeLookup:U,connection:q}=w.getState();if(!v||!B&&!s)return;if(!B){R==null||R(C.nativeEvent,{nodeId:v,handleId:g,handleType:e}),w.setState({connectionClickStartHandle:{nodeId:v,type:e,id:g}});return}const Q=kC(C.target),K=n||F,{connection:G,isValid:te}=jm.isValid(C.nativeEvent,{handle:{nodeId:v,id:g,type:e},connectionMode:$,fromNodeId:B.nodeId,fromHandleId:B.id||null,fromType:B.type,isValidConnection:K,flowId:W,doc:Q,lib:H,nodeLookup:U});te&&G&&I(G);const ne=structuredClone(q);delete ne.inProgress,ne.toPosition=ne.toHandle?ne.toHandle.position:null,M==null||M(C,ne),w.setState({connectionClickStartHandle:null})};return a.jsx("div",{"data-handleid":g,"data-nodeid":v,"data-handlepos":t,"data-id":`${b}-${v}-${g}-${e}`,className:He(["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:S,valid:D,connectionindicator:r&&(!A||N)&&(A||O?i:s)}]),onMouseDown:z,onTouchStart:z,onClick:y?T:void 0,ref:p,...h,children:c})}const no=_.memo(QC(CW));function TW({data:e,isConnectable:t,sourcePosition:n=re.Bottom}){return a.jsxs(a.Fragment,{children:[e==null?void 0:e.label,a.jsx(no,{type:"source",position:n,isConnectable:t})]})}function PW({data:e,isConnectable:t,targetPosition:n=re.Top,sourcePosition:r=re.Bottom}){return a.jsxs(a.Fragment,{children:[a.jsx(no,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,a.jsx(no,{type:"source",position:r,isConnectable:t})]})}function AW(){return null}function RW({data:e,isConnectable:t,targetPosition:n=re.Top}){return a.jsxs(a.Fragment,{children:[a.jsx(no,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label]})}const Yu={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},Lw={input:TW,default:PW,output:RW,group:AW};function IW(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 MW=e=>{const{width:t,height:n,x:r,y:s}=xl(e.nodeLookup,{filter:i=>!!i.selected});return{width:pn(t)?t:null,height:pn(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 OW({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const r=Te(),{width:s,height:i,transformString:o,userSelectionActive:l}=me(MW,Le),c=tT(),u=_.useRef(null);_.useEffect(()=>{var p;n||(p=u.current)==null||p.focus({preventScroll:!0})},[n]);const d=!l&&s!==null&&i!==null;if(eT({nodeRef:u,disabled:!d}),!d)return null;const f=e?p=>{const g=r.getState().nodes.filter(x=>x.selected);e(p,g)}:void 0,h=p=>{Object.prototype.hasOwnProperty.call(Yu,p.key)&&(p.preventDefault(),c({direction:Yu[p.key],factor:p.shiftKey?4:1}))};return a.jsx("div",{className:He(["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 $w=typeof window<"u"?window:void 0,LW=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function sT({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:g,panActivationKeyCode:x,zoomActivationKeyCode:w,elementsSelectable:v,zoomOnScroll:y,zoomOnPinch:m,panOnScroll:b,panOnScrollSpeed:j,panOnScrollMode:S,zoomOnDoubleClick:k,panOnDrag:N,autoPanOnSelection:A,defaultViewport:O,translateExtent:D,minZoom:I,maxZoom:z,preventScrolling:T,onSelectionContextMenu:E,noWheelClassName:P,noPanClassName:C,disableKeyboardA11y:R,onViewportChange:M,isControlledViewport:B}){const{nodesSelectionActive:$,userSelectionActive:F}=me(LW,Le),H=Ga(u,{target:$w}),W=Ga(x,{target:$w}),U=W||N,q=W||b,Q=d&&U!==!0,K=H||F||Q;return hW({deleteKeyCode:c,multiSelectionKeyCode:g}),a.jsx(gW,{onPaneContextMenu:i,elementsSelectable:v,zoomOnScroll:y,zoomOnPinch:m,panOnScroll:q,panOnScrollSpeed:j,panOnScrollMode:S,zoomOnDoubleClick:k,panOnDrag:!H&&U,defaultViewport:O,translateExtent:D,minZoom:I,maxZoom:z,zoomActivationKeyCode:w,preventScrolling:T,noWheelClassName:P,noPanClassName:C,onViewportChange:M,isControlledViewport:B,paneClickDistance:l,selectionOnDrag:Q,children:a.jsxs(_W,{onSelectionStart:h,onSelectionEnd:p,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:s,onPaneContextMenu:i,onPaneScroll:o,panOnDrag:U,autoPanOnSelection:A,isSelecting:!!K,selectionMode:f,selectionKeyPressed:H,paneClickDistance:l,selectionOnDrag:Q,children:[e,$&&a.jsx(OW,{onSelectionContextMenu:E,noPanClassName:C,disableKeyboardA11y:R})]})})}sT.displayName="FlowRenderer";const $W=_.memo(sT),DW=e=>t=>e?Xv(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 zW(e){return me(_.useCallback(DW(e),[e]),Le)}const FW=e=>e.updateNodeInternals;function VW(){const e=me(FW),[t]=_.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 _.useEffect(()=>()=>{t==null||t.disconnect()},[t]),t}function BW({node:e,nodeType:t,hasDimensions:n,resizeObserver:r}){const s=Te(),i=_.useRef(null),o=_.useRef(null),l=_.useRef(e.sourcePosition),c=_.useRef(e.targetPosition),u=_.useRef(t),d=n&&!!e.internals.handleBounds;return _.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]),_.useEffect(()=>()=>{o.current&&(r==null||r.unobserve(o.current),o.current=null)},[]),_.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 UW({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:g,rfId:x,nodeTypes:w,nodeClickDistance:v,onError:y}){const{node:m,internals:b,isParent:j}=me(K=>{const G=K.nodeLookup.get(e),te=K.parentLookup.has(e);return{node:G,internals:G.internals,isParent:te}},Le);let S=m.type||"default",k=(w==null?void 0:w[S])||Lw[S];k===void 0&&(y==null||y("003",jn.error003(S)),S="default",k=(w==null?void 0:w.default)||Lw.default);const N=!!(m.draggable||l&&typeof m.draggable>"u"),A=!!(m.selectable||c&&typeof m.selectable>"u"),O=!!(m.connectable||u&&typeof m.connectable>"u"),D=!!(m.focusable||d&&typeof m.focusable>"u"),I=Te(),z=jC(m),T=BW({node:m,nodeType:S,hasDimensions:z,resizeObserver:f}),E=eT({nodeRef:T,disabled:m.hidden||!N,noDragClassName:h,handleSelector:m.dragHandle,nodeId:e,isSelectable:A,nodeClickDistance:v}),P=tT();if(m.hidden)return null;const C=Kn(m),R=IW(m),M=A||N||t||n||r||s,B=n?K=>n(K,{...b.userNode}):void 0,$=r?K=>r(K,{...b.userNode}):void 0,F=s?K=>s(K,{...b.userNode}):void 0,H=i?K=>i(K,{...b.userNode}):void 0,W=o?K=>o(K,{...b.userNode}):void 0,U=K=>{const{selectNodesOnDrag:G,nodeDragThreshold:te}=I.getState();A&&(!G||!N||te>0)&&Sm({id:e,store:I,nodeRef:T}),t&&t(K,{...b.userNode})},q=K=>{if(!(NC(K.nativeEvent)||g)){if(hC.includes(K.key)&&A){const G=K.key==="Escape";Sm({id:e,store:I,unselect:G,nodeRef:T})}else if(N&&m.selected&&Object.prototype.hasOwnProperty.call(Yu,K.key)){K.preventDefault();const{ariaLabelConfig:G}=I.getState();I.setState({ariaLiveMessage:G["node.a11yDescription.ariaLiveMessage"]({direction:K.key.replace("Arrow","").toLowerCase(),x:~~b.positionAbsolute.x,y:~~b.positionAbsolute.y})}),P({direction:Yu[K.key],factor:K.shiftKey?4:1})}}},Q=()=>{var se;if(g||!((se=T.current)!=null&&se.matches(":focus-visible")))return;const{transform:K,width:G,height:te,autoPanOnNodeFocus:ne,setCenter:Y}=I.getState();if(!ne)return;Xv(new Map([[e,m]]),{x:0,y:0,width:G,height:te},K,!0).length>0||Y(m.position.x+C.width/2,m.position.y+C.height/2,{zoom:K[2]})};return a.jsx("div",{className:He(["react-flow__node",`react-flow__node-${S}`,{[p]:N},m.className,{selected:m.selected,selectable:A,parent:j,draggable:N,dragging:E}]),ref:T,style:{zIndex:b.z,transform:`translate(${b.positionAbsolute.x}px,${b.positionAbsolute.y}px)`,pointerEvents:M?"all":"none",visibility:z?"visible":"hidden",...m.style,...R},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:B,onMouseMove:$,onMouseLeave:F,onContextMenu:H,onClick:U,onDoubleClick:W,onKeyDown:D?q:void 0,tabIndex:D?0:void 0,onFocus:D?Q:void 0,role:m.ariaRole??(D?"group":void 0),"aria-roledescription":"node","aria-describedby":g?void 0:`${qC}-${x}`,"aria-label":m.ariaLabel,...m.domAttributes,children:a.jsx(bW,{value:e,children:a.jsx(k,{id:e,data:m.data,type:S,positionAbsoluteX:b.positionAbsolute.x,positionAbsoluteY:b.positionAbsolute.y,selected:m.selected??!1,selectable:A,draggable:N,deletable:m.deletable??!0,isConnectable:O,sourcePosition:m.sourcePosition,targetPosition:m.targetPosition,dragging:E,dragHandle:m.dragHandle,zIndex:b.z,parentId:m.parentId,...C})})})}var HW=_.memo(UW);const WW=e=>({nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function iT(e){const{nodesConnectable:t,nodesFocusable:n,elementsSelectable:r,onError:s}=me(WW,Le),i=zW(e.onlyRenderVisibleElements),o=VW();return a.jsx("div",{className:"react-flow__nodes",style:Yd,children:i.map(l=>a.jsx(HW,{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))})}iT.displayName="NodeRenderer";const KW=_.memo(iT);function qW(e){return me(_.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&&LU({sourceNode:i,targetNode:o,width:n.width,height:n.height,transform:n.transform})&&r.push(s.id)}return r},[e]),Le)}const GW=({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"})},YW=({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"})},Dw={[Ku.Arrow]:GW,[Ku.ArrowClosed]:YW};function XW(e){const t=Te();return _.useMemo(()=>{var s,i;return Object.prototype.hasOwnProperty.call(Dw,e)?Dw[e]:((i=(s=t.getState()).onError)==null||i.call(s,"009",jn.error009(e)),null)},[e])}const QW=({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=XW(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},oT=({defaultColor:e,rfId:t})=>{const n=me(i=>i.edges),r=me(i=>i.defaultEdgeOptions),s=_.useMemo(()=>HU(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(QW,{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};oT.displayName="MarkerDefinitions";var ZW=_.memo(oT);function aT({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]=_.useState({x:1,y:0,width:0,height:0}),p=He(["react-flow__edge-textwrapper",u]),g=_.useRef(null);return _.useEffect(()=>{if(g.current){const x=g.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:g,style:r,children:n}),c]}):null}aT.displayName="EdgeText";const JW=_.memo(aT);function Xd({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:He(["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&&pn(t)&&pn(n)?a.jsx(JW,{x:t,y:n,label:r,labelStyle:s,labelShowBg:i,labelBgStyle:o,labelBgPadding:l,labelBgBorderRadius:c}):null]})}function zw({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 lT({sourceX:e,sourceY:t,sourcePosition:n=re.Bottom,targetX:r,targetY:s,targetPosition:i=re.Top}){const[o,l]=zw({pos:n,x1:e,y1:t,x2:r,y2:s}),[c,u]=zw({pos:i,x1:r,y1:s,x2:e,y2:t}),[d,f,h,p]=CC({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 cT(e){return _.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:g,markerEnd:x,markerStart:w,interactionWidth:v})=>{const[y,m,b]=lT({sourceX:n,sourceY:r,sourcePosition:o,targetX:s,targetY:i,targetPosition:l}),j=e.isInternal?void 0:t;return a.jsx(Xd,{id:j,path:y,labelX:m,labelY:b,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:p,style:g,markerEnd:x,markerStart:w,interactionWidth:v})})}const e7=cT({isInternal:!1}),uT=cT({isInternal:!0});e7.displayName="SimpleBezierEdge";uT.displayName="SimpleBezierEdgeInternal";function dT(e){return _.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:g=re.Top,markerEnd:x,markerStart:w,pathOptions:v,interactionWidth:y})=>{const[m,b,j]=_m({sourceX:n,sourceY:r,sourcePosition:p,targetX:s,targetY:i,targetPosition:g,borderRadius:v==null?void 0:v.borderRadius,offset:v==null?void 0:v.offset,stepPosition:v==null?void 0:v.stepPosition}),S=e.isInternal?void 0:t;return a.jsx(Xd,{id:S,path:m,labelX:b,labelY:j,label:o,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:h,markerEnd:x,markerStart:w,interactionWidth:y})})}const fT=dT({isInternal:!1}),hT=dT({isInternal:!0});fT.displayName="SmoothStepEdge";hT.displayName="SmoothStepEdgeInternal";function pT(e){return _.memo(({id:t,...n})=>{var s;const r=e.isInternal?void 0:t;return a.jsx(fT,{...n,id:r,pathOptions:_.useMemo(()=>{var i;return{borderRadius:0,offset:(i=n.pathOptions)==null?void 0:i.offset}},[(s=n.pathOptions)==null?void 0:s.offset])})})}const t7=pT({isInternal:!1}),mT=pT({isInternal:!0});t7.displayName="StepEdge";mT.displayName="StepEdgeInternal";function gT(e){return _.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:g,interactionWidth:x})=>{const[w,v,y]=AC({sourceX:n,sourceY:r,targetX:s,targetY:i}),m=e.isInternal?void 0:t;return a.jsx(Xd,{id:m,path:w,labelX:v,labelY:y,label:o,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:h,markerEnd:p,markerStart:g,interactionWidth:x})})}const n7=gT({isInternal:!1}),vT=gT({isInternal:!0});n7.displayName="StraightEdge";vT.displayName="StraightEdgeInternal";function yT(e){return _.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:g,markerEnd:x,markerStart:w,pathOptions:v,interactionWidth:y})=>{const[m,b,j]=TC({sourceX:n,sourceY:r,sourcePosition:o,targetX:s,targetY:i,targetPosition:l,curvature:v==null?void 0:v.curvature}),S=e.isInternal?void 0:t;return a.jsx(Xd,{id:S,path:m,labelX:b,labelY:j,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:p,style:g,markerEnd:x,markerStart:w,interactionWidth:y})})}const r7=yT({isInternal:!1}),xT=yT({isInternal:!0});r7.displayName="BezierEdge";xT.displayName="BezierEdgeInternal";const Fw={default:xT,straight:vT,step:mT,smoothstep:hT,simplebezier:uT},Vw={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null,zIndex:void 0},s7=(e,t,n)=>n===re.Left?e-t:n===re.Right?e+t:e,i7=(e,t,n)=>n===re.Top?e-t:n===re.Bottom?e+t:e,Bw="react-flow__edgeupdater";function Uw({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:He([Bw,`${Bw}-${l}`]),cx:s7(t,r,e),cy:i7(n,r,e),r,stroke:"transparent",fill:"transparent"})}function o7({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 g=Te(),x=(b,j)=>{if(b.button!==0)return;const{autoPanOnConnect:S,domNode:k,connectionMode:N,connectionRadius:A,lib:O,onConnectStart:D,cancelConnection:I,nodeLookup:z,rfId:T,panBy:E,updateConnection:P}=g.getState(),C=j.type==="target",R=($,F)=>{h(!1),f==null||f($,n,j.type,F)},M=$=>u==null?void 0:u(n,$),B=($,F)=>{h(!0),d==null||d(b,n,j.type),D==null||D($,F)};jm.onPointerDown(b.nativeEvent,{autoPanOnConnect:S,connectionMode:N,connectionRadius:A,domNode:k,handleId:j.id,nodeId:j.nodeId,nodeLookup:z,isTarget:C,edgeUpdaterType:j.type,lib:O,flowId:T,cancelConnection:I,panBy:E,isValidConnection:(...$)=>{var F,H;return((H=(F=g.getState()).isValidConnection)==null?void 0:H.call(F,...$))??!0},onConnect:M,onConnectStart:B,onConnectEnd:(...$)=>{var F,H;return(H=(F=g.getState()).onConnectEnd)==null?void 0:H.call(F,...$)},onReconnectEnd:R,updateConnection:P,getTransform:()=>g.getState().transform,getFromHandle:()=>g.getState().connection.fromHandle,dragThreshold:g.getState().connectionDragThreshold,handleDomNode:b.currentTarget})},w=b=>x(b,{nodeId:n.target,id:n.targetHandle??null,type:"target"}),v=b=>x(b,{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(Uw,{position:l,centerX:r,centerY:s,radius:t,onMouseDown:w,onMouseEnter:y,onMouseOut:m,type:"source"}),(e===!0||e==="target")&&a.jsx(Uw,{position:c,centerX:i,centerY:o,radius:t,onMouseDown:v,onMouseEnter:y,onMouseOut:m,type:"target"})]})}function a7({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:g,edgeTypes:x,noPanClassName:w,onError:v,disableKeyboardA11y:y}){let m=me(Y=>Y.edgeLookup.get(e));const b=me(Y=>Y.defaultEdgeOptions);m=b?{...b,...m}:m;let j=m.type||"default",S=(x==null?void 0:x[j])||Fw[j];S===void 0&&(v==null||v("011",jn.error011(j)),j="default",S=(x==null?void 0:x.default)||Fw.default);const k=!!(m.focusable||t&&typeof m.focusable>"u"),N=typeof f<"u"&&(m.reconnectable||n&&typeof m.reconnectable>"u"),A=!!(m.selectable||r&&typeof m.selectable>"u"),O=_.useRef(null),[D,I]=_.useState(!1),[z,T]=_.useState(!1),E=Te(),{zIndex:P=m.zIndex,sourceX:C,sourceY:R,targetX:M,targetY:B,sourcePosition:$,targetPosition:F}=me(_.useCallback(Y=>{const J=Y.nodeLookup.get(m.source),se=Y.nodeLookup.get(m.target);if(!J||!se)return Vw;const le=UU({id:e,sourceNode:J,targetNode:se,sourceHandle:m.sourceHandle||null,targetHandle:m.targetHandle||null,connectionMode:Y.connectionMode,onError:v}),fe=OU({selected:m.selected,zIndex:m.zIndex,sourceNode:J,targetNode:se,elevateOnSelect:Y.elevateEdgesOnSelect,zIndexMode:Y.zIndexMode});return{...le||Vw,zIndex:fe}},[m.source,m.target,m.sourceHandle,m.targetHandle,m.selected,m.zIndex]),Le),H=_.useMemo(()=>m.markerStart?`url('#${wm(m.markerStart,g)}')`:void 0,[m.markerStart,g]),W=_.useMemo(()=>m.markerEnd?`url('#${wm(m.markerEnd,g)}')`:void 0,[m.markerEnd,g]);if(m.hidden||C===null||R===null||M===null||B===null)return null;const U=Y=>{var fe;const{addSelectedEdges:J,unselectNodesAndEdges:se,multiSelectionActive:le}=E.getState();A&&(E.setState({nodesSelectionActive:!1}),m.selected&&le?(se({nodes:[],edges:[m]}),(fe=O.current)==null||fe.blur()):J([e])),s&&s(Y,m)},q=i?Y=>{i(Y,{...m})}:void 0,Q=o?Y=>{o(Y,{...m})}:void 0,K=l?Y=>{l(Y,{...m})}:void 0,G=c?Y=>{c(Y,{...m})}:void 0,te=u?Y=>{u(Y,{...m})}:void 0,ne=Y=>{var J;if(!y&&hC.includes(Y.key)&&A){const{unselectNodesAndEdges:se,addSelectedEdges:le}=E.getState();Y.key==="Escape"?((J=O.current)==null||J.blur(),se({edges:[m]})):le([e])}};return a.jsx("svg",{style:{zIndex:P},children:a.jsxs("g",{className:He(["react-flow__edge",`react-flow__edge-${j}`,m.className,w,{selected:m.selected,animated:m.animated,inactive:!A&&!s,updating:D,selectable:A}]),onClick:U,onDoubleClick:q,onContextMenu:Q,onMouseEnter:K,onMouseMove:G,onMouseLeave:te,onKeyDown:k?ne: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?`${GC}-${g}`:void 0,ref:O,...m.domAttributes,children:[!z&&a.jsx(S,{id:e,source:m.source,target:m.target,type:m.type,selected:m.selected,animated:m.animated,selectable:A,deletable:m.deletable??!0,label:m.label,labelStyle:m.labelStyle,labelShowBg:m.labelShowBg,labelBgStyle:m.labelBgStyle,labelBgPadding:m.labelBgPadding,labelBgBorderRadius:m.labelBgBorderRadius,sourceX:C,sourceY:R,targetX:M,targetY:B,sourcePosition:$,targetPosition:F,data:m.data,style:m.style,sourceHandleId:m.sourceHandle,targetHandleId:m.targetHandle,markerStart:H,markerEnd:W,pathOptions:"pathOptions"in m?m.pathOptions:void 0,interactionWidth:m.interactionWidth}),N&&a.jsx(o7,{edge:m,isReconnectable:N,reconnectRadius:d,onReconnect:f,onReconnectStart:h,onReconnectEnd:p,sourceX:C,sourceY:R,targetX:M,targetY:B,sourcePosition:$,targetPosition:F,setUpdateHover:I,setReconnecting:T})]})})}var l7=_.memo(a7);const c7=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function _T({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:g,disableKeyboardA11y:x}){const{edgesFocusable:w,edgesReconnectable:v,elementsSelectable:y,onError:m}=me(c7,Le),b=qW(t);return a.jsxs("div",{className:"react-flow__edges",children:[a.jsx(ZW,{defaultColor:e,rfId:n}),b.map(j=>a.jsx(l7,{id:j,edgesFocusable:w,edgesReconnectable:v,elementsSelectable:y,noPanClassName:s,onReconnect:i,onContextMenu:o,onMouseEnter:l,onMouseMove:c,onMouseLeave:u,onClick:d,reconnectRadius:f,onDoubleClick:h,onReconnectStart:p,onReconnectEnd:g,rfId:n,onError:m,edgeTypes:r,disableKeyboardA11y:x},j))]})}_T.displayName="EdgeRenderer";const u7=_.memo(_T),Hw=e=>`translate(${e[0]}px,${e[1]}px) scale(${e[2]})`;function d7({children:e}){const t=Te(),n=_.useRef(null),[r]=_.useState(()=>t.getState().transform);return ZC(()=>{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=Hw(o)))};return i(),t.subscribe(i)},[t]),a.jsx("div",{ref:n,className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:Hw(r)},children:e})}function f7(e){const t=iy(),n=_.useRef(!1);_.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const h7=e=>{var t;return(t=e.panZoom)==null?void 0:t.syncViewport};function p7(e){const t=me(h7),n=Te();return _.useEffect(()=>{e&&(t==null||t(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function m7(e){return e.connection.inProgress?{...e.connection,to:wl(e.connection.to,e.transform)}:{...e.connection}}function g7(e){return m7}function v7(e){const t=g7();return me(t,Le)}const y7=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function x7({containerStyle:e,style:t,type:n,component:r}){const{nodesConnectable:s,width:i,height:o,isValid:l,inProgress:c}=me(y7,Le);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:He(["react-flow__connection",gC(l)]),children:a.jsx(wT,{style:t,type:n,CustomComponent:r,isValid:l})})})}const wT=({style:e,type:t=Mr.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}=v7();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:gC(r),toNode:d,toHandle:f,pointer:p});let g="";const x={sourceX:i.x,sourceY:i.y,sourcePosition:c,targetX:u.x,targetY:u.y,targetPosition:h};switch(t){case Mr.Bezier:[g]=TC(x);break;case Mr.SimpleBezier:[g]=lT(x);break;case Mr.Step:[g]=_m({...x,borderRadius:0});break;case Mr.SmoothStep:[g]=_m(x);break;default:[g]=AC(x)}return a.jsx("path",{d:g,fill:"none",className:"react-flow__connection-path",style:e})};wT.displayName="ConnectionLine";const _7={};function Ww(e=_7){_.useRef(e),Te(),_.useEffect(()=>{},[e])}function w7(){Te(),_.useRef(!1),_.useEffect(()=>{},[])}function bT({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:g,connectionLineStyle:x,connectionLineComponent:w,connectionLineContainerStyle:v,selectionKeyCode:y,selectionOnDrag:m,selectionMode:b,multiSelectionKeyCode:j,panActivationKeyCode:S,zoomActivationKeyCode:k,deleteKeyCode:N,onlyRenderVisibleElements:A,elementsSelectable:O,defaultViewport:D,translateExtent:I,minZoom:z,maxZoom:T,preventScrolling:E,defaultMarkerColor:P,zoomOnScroll:C,zoomOnPinch:R,panOnScroll:M,panOnScrollSpeed:B,panOnScrollMode:$,zoomOnDoubleClick:F,panOnDrag:H,autoPanOnSelection:W,onPaneClick:U,onPaneMouseEnter:q,onPaneMouseMove:Q,onPaneMouseLeave:K,onPaneScroll:G,onPaneContextMenu:te,paneClickDistance:ne,nodeClickDistance:Y,onEdgeContextMenu:J,onEdgeMouseEnter:se,onEdgeMouseMove:le,onEdgeMouseLeave:fe,reconnectRadius:ye,onReconnect:Ft,onReconnectStart:Nn,onReconnectEnd:En,noDragClassName:qn,noWheelClassName:vo,noPanClassName:rs,disableKeyboardA11y:ss,nodeExtent:sn,rfId:Gn,viewport:Yn,onViewportChange:is,nodesDraggable:ef}){return Ww(e),Ww(t),w7(),f7(n),p7(Yn),a.jsx($W,{onPaneClick:U,onPaneMouseEnter:q,onPaneMouseMove:Q,onPaneMouseLeave:K,onPaneContextMenu:te,onPaneScroll:G,paneClickDistance:ne,deleteKeyCode:N,selectionKeyCode:y,selectionOnDrag:m,selectionMode:b,onSelectionStart:h,onSelectionEnd:p,multiSelectionKeyCode:j,panActivationKeyCode:S,zoomActivationKeyCode:k,elementsSelectable:O,zoomOnScroll:C,zoomOnPinch:R,zoomOnDoubleClick:F,panOnScroll:M,panOnScrollSpeed:B,panOnScrollMode:$,panOnDrag:H,autoPanOnSelection:W,defaultViewport:D,translateExtent:I,minZoom:z,maxZoom:T,onSelectionContextMenu:f,preventScrolling:E,noDragClassName:qn,noWheelClassName:vo,noPanClassName:rs,disableKeyboardA11y:ss,onViewportChange:is,isControlledViewport:!!Yn,children:a.jsxs(d7,{children:[a.jsx(u7,{edgeTypes:t,onEdgeClick:s,onEdgeDoubleClick:o,onReconnect:Ft,onReconnectStart:Nn,onReconnectEnd:En,onlyRenderVisibleElements:A,onEdgeContextMenu:J,onEdgeMouseEnter:se,onEdgeMouseMove:le,onEdgeMouseLeave:fe,reconnectRadius:ye,defaultMarkerColor:P,noPanClassName:rs,disableKeyboardA11y:ss,rfId:Gn}),a.jsx(x7,{style:x,type:g,component:w,containerStyle:v}),a.jsx("div",{className:"react-flow__edgelabel-renderer"}),a.jsx(KW,{nodeTypes:e,onNodeClick:r,onNodeDoubleClick:i,onNodeMouseEnter:l,onNodeMouseMove:c,onNodeMouseLeave:u,onNodeContextMenu:d,nodeClickDistance:Y,onlyRenderVisibleElements:A,noPanClassName:rs,noDragClassName:qn,disableKeyboardA11y:ss,nodeExtent:sn,rfId:Gn,nodesDraggable:ef}),a.jsx("div",{className:"react-flow__viewport-portal"})]})})}bT.displayName="GraphView";const b7=_.memo(bT),j7=bC(),Kw=({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,g=new Map,x=new Map,w=new Map,v=r??t??[],y=n??e??[],m=d??[0,0],b=f??Ha;MC(x,w,v);const{nodesInitialized:j}=bm(y,p,g,{nodeOrigin:m,nodeExtent:b,zIndexMode:h});let S=[0,0,1];if(o&&s&&i){const k=xl(p,{filter:D=>!!((D.width||D.initialWidth)&&(D.height||D.initialHeight))}),{x:N,y:A,zoom:O}=Zv(k,s,i,c,u,(l==null?void 0:l.padding)??.1);S=[N,A,O]}return{rfId:"1",width:s??0,height:i??0,transform:S,nodes:y,nodesInitialized:j,nodeLookup:p,parentLookup:g,edges:v,edgeLookup:w,connectionLookup:x,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:r!==void 0,panZoom:null,minZoom:c,maxZoom:u,translateExtent:Ha,nodeExtent:b,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:Zi.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:{...mC},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:j7,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:pC,zIndexMode:h,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},S7=({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})=>LH((p,g)=>{async function x(){const{nodeLookup:w,panZoom:v,fitViewOptions:y,fitViewResolver:m,width:b,height:j,minZoom:S,maxZoom:k}=g();v&&(await CU({nodes:w,width:b,height:j,panZoom:v,minZoom:S,maxZoom:k},y),m==null||m.resolve(!0),p({fitViewResolver:null}))}return{...Kw({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:v,parentLookup:y,nodeOrigin:m,elevateNodesOnSelect:b,fitViewQueued:j,zIndexMode:S,nodesSelectionActive:k}=g(),{nodesInitialized:N,hasSelectedNodes:A}=bm(w,v,y,{nodeOrigin:m,nodeExtent:f,elevateNodesOnSelect:b,checkEquality:!0,zIndexMode:S}),O=k&&A;j&&N?(x(),p({nodes:w,nodesInitialized:N,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:O})):p({nodes:w,nodesInitialized:N,nodesSelectionActive:O})},setEdges:w=>{const{connectionLookup:v,edgeLookup:y}=g();MC(v,y,w),p({edges:w})},setDefaultNodesAndEdges:(w,v)=>{if(w){const{setNodes:y}=g();y(w),p({hasDefaultNodes:!0})}if(v){const{setEdges:y}=g();y(v),p({hasDefaultEdges:!0})}},updateNodeInternals:w=>{const{triggerNodeChanges:v,nodeLookup:y,parentLookup:m,domNode:b,nodeOrigin:j,nodeExtent:S,debug:k,fitViewQueued:N,zIndexMode:A}=g(),{changes:O,updatedInternals:D}=QU(w,y,m,b,j,S,A);D&&(qU(y,m,{nodeOrigin:j,nodeExtent:S,zIndexMode:A}),N?(x(),p({fitViewQueued:!1,fitViewOptions:void 0})):p({}),(O==null?void 0:O.length)>0&&(k&&console.log("React Flow: trigger node changes",O),v==null||v(O)))},updateNodePositions:(w,v=!1)=>{const y=[];let m=[];const{nodeLookup:b,triggerNodeChanges:j,connection:S,updateConnection:k,onNodesChangeMiddlewareMap:N}=g();for(const[A,O]of w){const D=b.get(A),I=!!(D!=null&&D.expandParent&&(D!=null&&D.parentId)&&(O!=null&&O.position)),z={id:A,type:"position",position:I?{x:Math.max(0,O.position.x),y:Math.max(0,O.position.y)}:O.position,dragging:v};if(D&&S.inProgress&&S.fromNode.id===D.id){const T=Vs(D,S.fromHandle,re.Left,!0);k({...S,from:T})}I&&D.parentId&&y.push({id:A,parentId:D.parentId,rect:{...O.internals.positionAbsolute,width:O.measured.width??0,height:O.measured.height??0}}),m.push(z)}if(y.length>0){const{parentLookup:A,nodeOrigin:O}=g(),D=sy(y,b,A,O);m.push(...D)}for(const A of N.values())m=A(m);j(m)},triggerNodeChanges:w=>{const{onNodesChange:v,setNodes:y,nodes:m,hasDefaultNodes:b,debug:j}=g();if(w!=null&&w.length){if(b){const S=rW(w,m);y(S)}j&&console.log("React Flow: trigger node changes",w),v==null||v(w)}},triggerEdgeChanges:w=>{const{onEdgesChange:v,setEdges:y,edges:m,hasDefaultEdges:b,debug:j}=g();if(w!=null&&w.length){if(b){const S=sW(w,m);y(S)}j&&console.log("React Flow: trigger edge changes",w),v==null||v(w)}},addSelectedNodes:w=>{const{multiSelectionActive:v,edgeLookup:y,nodeLookup:m,triggerNodeChanges:b,triggerEdgeChanges:j}=g();if(v){const S=w.map(k=>ps(k,!0));b(S);return}b(bi(m,new Set([...w]),!0)),j(bi(y))},addSelectedEdges:w=>{const{multiSelectionActive:v,edgeLookup:y,nodeLookup:m,triggerNodeChanges:b,triggerEdgeChanges:j}=g();if(v){const S=w.map(k=>ps(k,!0));j(S);return}j(bi(y,new Set([...w]))),b(bi(m,new Set,!0))},unselectNodesAndEdges:({nodes:w,edges:v}={})=>{const{edges:y,nodes:m,nodeLookup:b,triggerNodeChanges:j,triggerEdgeChanges:S}=g(),k=w||m,N=v||y,A=[];for(const D of k){if(!D.selected)continue;const I=b.get(D.id);I&&(I.selected=!1),A.push(ps(D.id,!1))}const O=[];for(const D of N)D.selected&&O.push(ps(D.id,!1));j(A),S(O)},setMinZoom:w=>{const{panZoom:v,maxZoom:y}=g();v==null||v.setScaleExtent([w,y]),p({minZoom:w})},setMaxZoom:w=>{const{panZoom:v,minZoom:y}=g();v==null||v.setScaleExtent([y,w]),p({maxZoom:w})},setTranslateExtent:w=>{var v;(v=g().panZoom)==null||v.setTranslateExtent(w),p({translateExtent:w})},resetSelectedElements:()=>{const{edges:w,nodes:v,triggerNodeChanges:y,triggerEdgeChanges:m,elementsSelectable:b}=g();if(!b)return;const j=v.reduce((k,N)=>N.selected?[...k,ps(N.id,!1)]:k,[]),S=w.reduce((k,N)=>N.selected?[...k,ps(N.id,!1)]:k,[]);y(j),m(S)},setNodeExtent:w=>{const{nodes:v,nodeLookup:y,parentLookup:m,nodeOrigin:b,elevateNodesOnSelect:j,nodeExtent:S,zIndexMode:k}=g();w[0][0]===S[0][0]&&w[0][1]===S[0][1]&&w[1][0]===S[1][0]&&w[1][1]===S[1][1]||(bm(v,y,m,{nodeOrigin:b,nodeExtent:w,elevateNodesOnSelect:j,checkEquality:!1,zIndexMode:k}),p({nodeExtent:w}))},panBy:w=>{const{transform:v,width:y,height:m,panZoom:b,translateExtent:j}=g();return ZU({delta:w,panZoom:b,transform:v,translateExtent:j,width:y,height:m})},setCenter:async(w,v,y)=>{const{width:m,height:b,maxZoom:j,panZoom:S}=g();if(!S)return!1;const k=typeof(y==null?void 0:y.zoom)<"u"?y.zoom:j;return await S.setViewport({x:m/2-w*k,y:b/2-v*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:{...mC}})},updateConnection:w=>{p({connection:w})},reset:()=>p({...Kw()})}},Object.is);function k7({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[g]=_.useState(()=>S7({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($H,{value:g,children:a.jsx(cW,{children:a.jsx(SW,{children:p})})})}function N7({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 _.useContext(qd)?a.jsx(a.Fragment,{children:e}):a.jsx(k7,{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 E7={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function C7({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:g,onConnectEnd:x,onClickConnectStart:w,onClickConnectEnd:v,onNodeMouseEnter:y,onNodeMouseMove:m,onNodeMouseLeave:b,onNodeContextMenu:j,onNodeDoubleClick:S,onNodeDragStart:k,onNodeDrag:N,onNodeDragStop:A,onNodesDelete:O,onEdgesDelete:D,onDelete:I,onSelectionChange:z,onSelectionDragStart:T,onSelectionDrag:E,onSelectionDragStop:P,onSelectionContextMenu:C,onSelectionStart:R,onSelectionEnd:M,onBeforeDelete:B,connectionMode:$,connectionLineType:F=Mr.Bezier,connectionLineStyle:H,connectionLineComponent:W,connectionLineContainerStyle:U,deleteKeyCode:q="Backspace",selectionKeyCode:Q="Shift",selectionOnDrag:K=!1,selectionMode:G=Wa.Full,panActivationKeyCode:te="Space",multiSelectionKeyCode:ne=qa()?"Meta":"Control",zoomActivationKeyCode:Y=qa()?"Meta":"Control",snapToGrid:J,snapGrid:se,onlyRenderVisibleElements:le=!1,selectNodesOnDrag:fe,nodesDraggable:ye,autoPanOnNodeFocus:Ft,nodesConnectable:Nn,nodesFocusable:En,nodeOrigin:qn=YC,edgesFocusable:vo,edgesReconnectable:rs,elementsSelectable:ss=!0,defaultViewport:sn=XH,minZoom:Gn=.5,maxZoom:Yn=2,translateExtent:is=Ha,preventScrolling:ef=!0,nodeExtent:tf,defaultMarkerColor:aP="#b1b1b7",zoomOnScroll:lP=!0,zoomOnPinch:cP=!0,panOnScroll:uP=!1,panOnScrollSpeed:dP=.5,panOnScrollMode:fP=Ns.Free,zoomOnDoubleClick:hP=!0,panOnDrag:pP=!0,onPaneClick:mP,onPaneMouseEnter:gP,onPaneMouseMove:vP,onPaneMouseLeave:yP,onPaneScroll:xP,onPaneContextMenu:_P,paneClickDistance:wP=1,nodeClickDistance:bP=0,children:jP,onReconnect:SP,onReconnectStart:kP,onReconnectEnd:NP,onEdgeContextMenu:EP,onEdgeDoubleClick:CP,onEdgeMouseEnter:TP,onEdgeMouseMove:PP,onEdgeMouseLeave:AP,reconnectRadius:RP=10,onNodesChange:IP,onEdgesChange:MP,noDragClassName:OP="nodrag",noWheelClassName:LP="nowheel",noPanClassName:py="nopan",fitView:my,fitViewOptions:gy,connectOnClick:$P,attributionPosition:DP,proOptions:zP,defaultEdgeOptions:FP,elevateNodesOnSelect:VP=!0,elevateEdgesOnSelect:BP=!1,disableKeyboardA11y:vy=!1,autoPanOnConnect:UP,autoPanOnNodeDrag:HP,autoPanOnSelection:WP=!0,autoPanSpeed:KP,connectionRadius:qP,isValidConnection:GP,onError:YP,style:XP,id:yy,nodeDragThreshold:QP,connectionDragThreshold:ZP,viewport:JP,onViewportChange:eA,width:tA,height:nA,colorMode:rA="light",debug:sA,onScroll:jl,ariaLabelConfig:iA,zIndexMode:xy="basic",...oA},aA){const nf=yy||"1",lA=eW(rA),cA=_.useCallback(_y=>{_y.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),jl==null||jl(_y)},[jl]);return a.jsx("div",{"data-testid":"rf__wrapper",...oA,onScroll:cA,style:{...XP,...E7},ref:aA,className:He(["react-flow",s,lA]),id:yy,role:"application",children:a.jsxs(N7,{nodes:e,edges:t,width:tA,height:nA,fitView:my,fitViewOptions:gy,minZoom:Gn,maxZoom:Yn,nodeOrigin:qn,nodeExtent:tf,zIndexMode:xy,children:[a.jsx(JH,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:p,onConnectStart:g,onConnectEnd:x,onClickConnectStart:w,onClickConnectEnd:v,nodesDraggable:ye,autoPanOnNodeFocus:Ft,nodesConnectable:Nn,nodesFocusable:En,edgesFocusable:vo,edgesReconnectable:rs,elementsSelectable:ss,elevateNodesOnSelect:VP,elevateEdgesOnSelect:BP,minZoom:Gn,maxZoom:Yn,nodeExtent:tf,onNodesChange:IP,onEdgesChange:MP,snapToGrid:J,snapGrid:se,connectionMode:$,translateExtent:is,connectOnClick:$P,defaultEdgeOptions:FP,fitView:my,fitViewOptions:gy,onNodesDelete:O,onEdgesDelete:D,onDelete:I,onNodeDragStart:k,onNodeDrag:N,onNodeDragStop:A,onSelectionDrag:E,onSelectionDragStart:T,onSelectionDragStop:P,onMove:d,onMoveStart:f,onMoveEnd:h,noPanClassName:py,nodeOrigin:qn,rfId:nf,autoPanOnConnect:UP,autoPanOnNodeDrag:HP,autoPanSpeed:KP,onError:YP,connectionRadius:qP,isValidConnection:GP,selectNodesOnDrag:fe,nodeDragThreshold:QP,connectionDragThreshold:ZP,onBeforeDelete:B,debug:sA,ariaLabelConfig:iA,zIndexMode:xy}),a.jsx(b7,{onInit:u,onNodeClick:l,onEdgeClick:c,onNodeMouseEnter:y,onNodeMouseMove:m,onNodeMouseLeave:b,onNodeContextMenu:j,onNodeDoubleClick:S,nodeTypes:i,edgeTypes:o,connectionLineType:F,connectionLineStyle:H,connectionLineComponent:W,connectionLineContainerStyle:U,selectionKeyCode:Q,selectionOnDrag:K,selectionMode:G,deleteKeyCode:q,multiSelectionKeyCode:ne,panActivationKeyCode:te,zoomActivationKeyCode:Y,onlyRenderVisibleElements:le,defaultViewport:sn,translateExtent:is,minZoom:Gn,maxZoom:Yn,preventScrolling:ef,zoomOnScroll:lP,zoomOnPinch:cP,zoomOnDoubleClick:hP,panOnScroll:uP,panOnScrollSpeed:dP,panOnScrollMode:fP,panOnDrag:pP,autoPanOnSelection:WP,onPaneClick:mP,onPaneMouseEnter:gP,onPaneMouseMove:vP,onPaneMouseLeave:yP,onPaneScroll:xP,onPaneContextMenu:_P,paneClickDistance:wP,nodeClickDistance:bP,onSelectionContextMenu:C,onSelectionStart:R,onSelectionEnd:M,onReconnect:SP,onReconnectStart:kP,onReconnectEnd:NP,onEdgeContextMenu:EP,onEdgeDoubleClick:CP,onEdgeMouseEnter:TP,onEdgeMouseMove:PP,onEdgeMouseLeave:AP,reconnectRadius:RP,defaultMarkerColor:aP,noDragClassName:OP,noWheelClassName:LP,noPanClassName:py,rfId:nf,disableKeyboardA11y:vy,nodeExtent:tf,viewport:JP,onViewportChange:eA,nodesDraggable:ye}),a.jsx(YH,{onSelectionChange:z}),jP,a.jsx(HH,{proOptions:zP,position:DP}),a.jsx(UH,{rfId:nf,disableKeyboardA11y:vy})]})})}var T7=QC(C7);function P7({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:He(["react-flow__background-pattern",n,r])})}function A7({radius:e,className:t}){return a.jsx("circle",{cx:e,cy:e,r:e,className:He(["react-flow__background-pattern","dots",t])})}var fr;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(fr||(fr={}));const R7={[fr.Dots]:1,[fr.Lines]:1,[fr.Cross]:6},I7=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function jT({id:e,variant:t=fr.Dots,gap:n=20,size:r,lineWidth:s=1,offset:i=0,color:o,bgColor:l,style:c,className:u,patternClassName:d}){const f=_.useRef(null),{transform:h,patternId:p}=me(I7,Le),g=r||R7[t],x=t===fr.Dots,w=t===fr.Cross,v=Array.isArray(n)?n:[n,n],y=[v[0]*h[2]||1,v[1]*h[2]||1],m=g*h[2],b=Array.isArray(i)?i:[i,i],j=w?[m,m]:y,S=[b[0]*h[2]||1+j[0]/2,b[1]*h[2]||1+j[1]/2],k=`${p}${e||""}`;return a.jsxs("svg",{className:He(["react-flow__background",u]),style:{...c,...Yd,"--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(-${S[0]},-${S[1]})`,children:x?a.jsx(A7,{radius:m/2,className:d}):a.jsx(P7,{dimensions:j,lineWidth:s,variant:t,className:d})}),a.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${k})`})]})}jT.displayName="Background";const M7=_.memo(jT);function O7(){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 L7(){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 $7(){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 D7(){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 z7(){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 ic({children:e,className:t,...n}){return a.jsx("button",{type:"button",className:He(["react-flow__controls-button",t]),...n,children:e})}const F7=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function ST({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 g=Te(),{isInteractive:x,minZoomReached:w,maxZoomReached:v,ariaLabelConfig:y}=me(F7,Le),{zoomIn:m,zoomOut:b,fitView:j}=iy(),S=()=>{m(),i==null||i()},k=()=>{b(),o==null||o()},N=()=>{j(s),l==null||l()},A=()=>{g.setState({nodesDraggable:!x,nodesConnectable:!x,elementsSelectable:!x}),c==null||c(!x)},O=h==="horizontal"?"horizontal":"vertical";return a.jsxs(Gd,{className:He(["react-flow__controls",O,u]),position:f,style:e,"data-testid":"rf__controls","aria-label":p??y["controls.ariaLabel"],children:[t&&a.jsxs(a.Fragment,{children:[a.jsx(ic,{onClick:S,className:"react-flow__controls-zoomin",title:y["controls.zoomIn.ariaLabel"],"aria-label":y["controls.zoomIn.ariaLabel"],disabled:v,children:a.jsx(O7,{})}),a.jsx(ic,{onClick:k,className:"react-flow__controls-zoomout",title:y["controls.zoomOut.ariaLabel"],"aria-label":y["controls.zoomOut.ariaLabel"],disabled:w,children:a.jsx(L7,{})})]}),n&&a.jsx(ic,{className:"react-flow__controls-fitview",onClick:N,title:y["controls.fitView.ariaLabel"],"aria-label":y["controls.fitView.ariaLabel"],children:a.jsx($7,{})}),r&&a.jsx(ic,{className:"react-flow__controls-interactive",onClick:A,title:y["controls.interactive.ariaLabel"],"aria-label":y["controls.interactive.ariaLabel"],children:x?a.jsx(z7,{}):a.jsx(D7,{})}),d]})}ST.displayName="Controls";const V7=_.memo(ST);function B7({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:g,backgroundColor:x}=i||{},w=o||g||x;return a.jsx("rect",{className:He(["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?v=>p(v,e):void 0})}const U7=_.memo(B7),H7=e=>e.nodes.map(t=>t.id),fh=e=>e instanceof Function?e:()=>e;function W7({nodeStrokeColor:e,nodeColor:t,nodeClassName:n="",nodeBorderRadius:r=5,nodeStrokeWidth:s,nodeComponent:i=U7,onClick:o}){const l=me(H7,Le),c=fh(t),u=fh(e),d=fh(n),f=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return a.jsx(a.Fragment,{children:l.map(h=>a.jsx(q7,{id:h,nodeColorFunc:c,nodeStrokeColorFunc:u,nodeClassNameFunc:d,nodeBorderRadius:r,nodeStrokeWidth:s,NodeComponent:i,onClick:o,shapeRendering:f},h))})}function K7({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}=me(g=>{const x=g.nodeLookup.get(e);if(!x)return{node:void 0,x:0,y:0,width:0,height:0};const w=x.internals.userNode,{x:v,y}=x.internals.positionAbsolute,{width:m,height:b}=Kn(w);return{node:w,x:v,y,width:m,height:b}},Le);return!u||u.hidden||!jC(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 q7=_.memo(K7);var G7=_.memo(W7);const Y7=200,X7=150,Q7=e=>!e.hidden,Z7=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?_C(xl(e.nodeLookup,{filter:Q7}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},qw=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,J7=(e,t)=>qw(e.viewBB,t.viewBB)&&qw(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,e9="react-flow__minimap-desc";function kT({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:g,pannable:x=!1,zoomable:w=!1,ariaLabel:v,inversePan:y,zoomStep:m=1,offsetScale:b=5}){const j=Te(),S=_.useRef(null),{boundingRect:k,viewBB:N,rfId:A,panZoom:O,translateExtent:D,flowWidth:I,flowHeight:z,ariaLabelConfig:T}=me(Z7,J7),E=(e==null?void 0:e.width)??Y7,P=(e==null?void 0:e.height)??X7,C=k.width/E,R=k.height/P,M=Math.max(C,R),B=M*E,$=M*P,F=b*M,H=k.x-(B-k.width)/2-F,W=k.y-($-k.height)/2-F,U=B+F*2,q=$+F*2,Q=`${e9}-${A}`,K=_.useRef(0),G=_.useRef();K.current=M,_.useEffect(()=>{if(S.current&&O)return G.current=aH({domNode:S.current,panZoom:O,getTransform:()=>j.getState().transform,getViewScale:()=>K.current}),()=>{var J;(J=G.current)==null||J.destroy()}},[O]),_.useEffect(()=>{var J;(J=G.current)==null||J.update({translateExtent:D,width:I,height:z,inversePan:y,pannable:x,zoomStep:m,zoomable:w})},[x,w,y,m,D,I,z]);const te=p?J=>{var fe;const[se,le]=((fe=G.current)==null?void 0:fe.pointer(J))||[0,0];p(J,{x:se,y:le})}:void 0,ne=g?_.useCallback((J,se)=>{const le=j.getState().nodeLookup.get(se).internals.userNode;g(J,le)},[]):void 0,Y=v??T["minimap.ariaLabel"];return a.jsx(Gd,{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*M: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:He(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:a.jsxs("svg",{width:E,height:P,viewBox:`${H} ${W} ${U} ${q}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":Q,ref:S,onClick:te,children:[Y&&a.jsx("title",{id:Q,children:Y}),a.jsx(G7,{onClick:ne,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:i,nodeClassName:s,nodeStrokeWidth:o,nodeComponent:l}),a.jsx("path",{className:"react-flow__minimap-mask",d:`M${H-F},${W-F}h${U+F*2}v${q+F*2}h${-U-F*2}z
|
|
92
|
-
M${N.x},${N.y}h${N.width}v${N.height}h${-N.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}kT.displayName="MiniMap";_.memo(kT);const t9=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,n9={[to.Line]:"right",[to.Handle]:"bottom-right"};function r9({nodeId:e,position:t,variant:n=to.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:g,onResizeStart:x,onResize:w,onResizeEnd:v}){const y=nT(),m=typeof e=="string"?e:y,b=Te(),j=_.useRef(null),S=n===to.Handle,k=me(_.useCallback(t9(S&&p),[S,p]),Le),N=_.useRef(null),A=t??n9[n];_.useEffect(()=>{if(!(!j.current||!m))return N.current||(N.current=_H({domNode:j.current,nodeId:m,getStoreItems:()=>{const{nodeLookup:D,transform:I,snapGrid:z,snapToGrid:T,nodeOrigin:E,domNode:P}=b.getState();return{nodeLookup:D,transform:I,snapGrid:z,snapToGrid:T,nodeOrigin:E,paneDomNode:P}},onChange:(D,I)=>{const{triggerNodeChanges:z,nodeLookup:T,parentLookup:E,nodeOrigin:P}=b.getState(),C=[],R={x:D.x,y:D.y},M=T.get(m);if(M&&M.expandParent&&M.parentId){const B=M.origin??P,$=D.width??M.measured.width??0,F=D.height??M.measured.height??0,H={id:M.id,parentId:M.parentId,rect:{width:$,height:F,...SC({x:D.x??M.position.x,y:D.y??M.position.y},{width:$,height:F},M.parentId,T,B)}},W=sy([H],T,E,P);C.push(...W),R.x=D.x?Math.max(B[0]*$,D.x):void 0,R.y=D.y?Math.max(B[1]*F,D.y):void 0}if(R.x!==void 0&&R.y!==void 0){const B={id:m,type:"position",position:{...R}};C.push(B)}if(D.width!==void 0&&D.height!==void 0){const $={id:m,type:"dimensions",resizing:!0,setAttributes:h?h==="horizontal"?"width":"height":!0,dimensions:{width:D.width,height:D.height}};C.push($)}for(const B of I){const $={...B,type:"position"};C.push($)}z(C)},onEnd:({width:D,height:I})=>{const z={id:m,type:"dimensions",resizing:!1,dimensions:{width:D,height:I}};b.getState().triggerNodeChanges([z])}})),N.current.update({controlPosition:A,boundaries:{minWidth:l,minHeight:c,maxWidth:u,maxHeight:d},keepAspectRatio:f,resizeDirection:h,onResizeStart:x,onResize:w,onResizeEnd:v,shouldResize:g}),()=>{var D;(D=N.current)==null||D.destroy()}},[A,l,c,u,d,f,x,w,v,g]);const O=A.split("-");return a.jsx("div",{className:He(["react-flow__resize-control","nodrag",...O,n,r]),ref:j,style:{...s,scale:k,...o&&{[S?"backgroundColor":"borderColor"]:o}},children:i})}_.memo(r9);const s9={llm_only:"AI",claude:"Claude",codex:"Codex",qoder:"Qoder",qwenwork:"千问办公"};function i9(e){return e.requiresAgent?{key:e.engine==="llm_only"?"llm":e.engine,label:s9[e.engine]}:null}function o9({data:e,selected:t}){var l;const n=e.step,r=i9(n),s=n.status??"idle",i=n.configStatus==="missing",o=((l=n.missingConfigKeys)==null?void 0:l.length)??0;return a.jsxs(Ze.div,{variants:v5,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(no,{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(L,{name:"user",size:11})}):a.jsx("span",{className:"wf-node__flag",title:"自动",children:a.jsx(L,{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(no,{type:"source",position:re.Bottom,className:"wf-node__handle"})]})}const a9={step:o9};function NT({steps:e,edges:t,selectedId:n,onSelect:r}){const s=_.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=_.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(T7,{nodes:s,edges:i,nodeTypes:a9,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(M7,{variant:fr.Dots,gap:16,size:1}),a.jsx(V7,{showInteractive:!1})]})})}function Bc(e){const t=e.slice(e.lastIndexOf(".")+1);return t==="base_id"||t==="baseId"}function l9({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]=_.useState(null),l=(r==null?void 0:r.workflows)??[],c=_.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(L,{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(c9,{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 c9({workflow:e,topology:t,envItems:n,suggestedBaseId:r,isOpen:s,onToggle:i,onSave:o}){const[l,c]=_.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=_.useMemo(()=>{const k=new Set((t==null?void 0:t.envRefs)??[]);for(const N of Object.values((t==null?void 0:t.stepEnvRefs)??{}))for(const A of N){const O=n.find(D=>D.key===A);O&&O.status==="error"&&k.add(A)}return[...k].map(N=>n.find(A=>A.key===N)).filter(N=>!!N&&!!N.writeTarget)},[t,n]),h=_.useMemo(()=>{const k=new Set((t==null?void 0:t.envRefs)??[]);for(const N of Object.values((t==null?void 0:t.stepEnvRefs)??{}))for(const A of N)k.add(A);return n.filter(N=>k.has(N.key)&&N.status==="error")},[t,n]),p=e.ok&&h.length===0,g=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=_.useMemo(()=>{const k=new Set((t==null?void 0:t.envRefs)??[]);for(const N of Object.values((t==null?void 0:t.stepEnvRefs)??{}))for(const A of N)k.add(A);return[...e.items.filter(N=>!N.writeTarget&&(N.status==="error"||N.status==="warn")),...n.filter(N=>k.has(N.key)&&!N.writeTarget&&(N.status==="error"||N.status==="warn"))]},[t,n,e.items]),v=_.useMemo(()=>t?t.steps.map(k=>{const N=e.items.filter(A=>A.key.startsWith(`step.${k.id}.config.`)&&A.status==="error");return{id:k.id,name:k.name,recipe:k.recipe??"",engine:k.engine??"llm_only",auto:k.auto,inputs:[],outputs:[],configStatus:N.length>0?"missing":"ok",missingConfigKeys:N.map(A=>A.key)}}):[],[t,e.items]),y=_.useMemo(()=>t?t.edges:[],[t]),m=_.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(N=>n.find(A=>A.key===N)).filter(N=>!!N&&N.status!=="ok"),[l,t,n]),j=t==null?void 0:t.steps.find(k=>k.id===l),S=l&&(m.length>0||b.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(L,{name:"flow",size:15})}),a.jsx("span",{className:"wf-card__name",children:e.name}),g>0&&a.jsxs("span",{className:"wf-card__badge",children:[g," 项需配置"]}),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(L,{name:"check",size:12})," 通过"]}):g>0?"需配置":"有异常"}),a.jsx("span",{className:`wf-card__chevron${s?" is-open":""}`,children:a.jsx(L,{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(fn,{item:k,onSave:o,suggestedDefault:Bc(k.key)?r:void 0},k.key))}),t&&v.length>0&&a.jsxs("div",{className:`wf-card__canvas-row${S?" has-panel":""}`,children:[a.jsx("div",{className:"wf-card__canvas",children:a.jsx(NT,{steps:v,edges:y,selectedId:l,onSelect:c})}),S&&j&&a.jsxs("div",{className:"wf-card__panel",children:[a.jsxs("div",{className:"wf-card__panel-head",children:[a.jsx(L,{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(L,{name:"close",size:14})})]}),a.jsxs("div",{className:"wf-card__panel-body",children:[m.map(k=>a.jsx(fn,{item:k,onSave:o,suggestedDefault:Bc(k.key)?r:void 0},k.key)),b.length>0&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"wf-card__panel-divider",children:"参数与凭据"}),b.map(k=>a.jsx(fn,{item:k,onSave:o},k.key))]})]})]}),l&&!S&&j&&a.jsxs("div",{className:"wf-card__panel",children:[a.jsxs("div",{className:"wf-card__panel-head",children:[a.jsx(L,{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(L,{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(L,{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(L,{name:"bolt",size:13,color:"var(--text-muted)"}),"事件源配置"]}),d.map(k=>a.jsx(fn,{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(L,{name:"lock",size:13,color:"var(--text-muted)"}),"参数与凭据"]}),f.map(k=>a.jsx(fn,{item:k,onSave:o},k.key))]}),a.jsx(Du,{items:w})]})]})}const u9=[{id:"project",label:"项目配置",icon:"folder"},{id:"roles",label:"角色配置",icon:"user"},{id:"workflows",label:"工作流配置",icon:"flow"}];function d9(){const[e,t]=_.useState(null),[n,r]=_.useState(!0),[s,i]=_.useState(null),[o,l]=_.useState(!1),[c,u]=_.useState(!1),[d,f]=_.useState("project"),[h,p]=_.useState(!1),g=_.useRef(!1),x=_.useCallback(async()=>{var j,S,k;r(!0),i(null);try{const N=await Ak();if(t(N),!N.config.ok){const A=((j=N.config.modules.find(I=>I.id==="project"))==null?void 0:j.ok)??!0,O=((S=N.config.modules.find(I=>I.id==="coding_agent"))==null?void 0:S.ok)??!0,D=((k=N.config.modules.find(I=>I.id==="roles"))==null?void 0:k.ok)??!0;f(!A||!O?"project":D?"workflows":"roles")}}catch(N){i(N instanceof Error?N.message:String(N))}finally{r(!1)}},[]);_.useEffect(()=>{x()},[x]),_.useEffect(()=>{if(e&&!c){const j=S=>{S.preventDefault()};return window.addEventListener("beforeunload",j),()=>window.removeEventListener("beforeunload",j)}},[e,c]);const w=_.useCallback(async()=>{if(!(g.current||c)){g.current=!0,l(!0);try{await Pk(),u(!0)}catch(j){i(j instanceof Error?j.message:String(j))}finally{l(!1),g.current=!1}}},[c]),v=_.useCallback(async(j,S)=>{const k=await Dp([{writeTarget:j,value:S}]);t(N=>N&&{...N,config:k.recheck})},[]),y=_.useCallback(async j=>{const S=await Dp(j);t(k=>k&&{...k,config:S.recheck})},[]),m=_.useCallback(async(j,S)=>{try{const k=await zD(j,S);return t(N=>N&&{...N,config:k.recheck}),{ok:k.ok,message:k.message}}catch(k){const N=k instanceof Error?k.message:"知识库导入失败";return i(N),{ok:!1,message:N}}},[]),b=_.useCallback(async(j,S)=>{try{const k=await DD(j,S);return t(N=>N&&{...N,config:k.recheck}),{ok:k.ok,message:k.message}}catch(k){const N=k instanceof Error?k.message:"文件上传失败";return i(N),{ok:!1,message:N}}},[]);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(L,{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(L,{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(L,{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:u9.map(j=>{var D,I,z,T,E;const S=((D=e.config.modules.find(P=>P.id==="env"))==null?void 0:D.items)??[],k=new Set(e.projectEnvRefs??S.map(P=>P.key)),N=new Set;for(const P of Object.values(e.workflowTopology)){for(const C of P.envRefs??[])N.add(C);for(const C of Object.values(P.stepEnvRefs??{}))for(const R of C)N.add(R)}const A=P=>S.some(C=>C.status==="error"&&P.has(C.key)),O=j.id==="project"?(((I=e.config.modules.find(P=>P.id==="project"))==null?void 0:I.ok)??!0)&&(((z=e.config.modules.find(P=>P.id==="coding_agent"))==null?void 0:z.ok)??!0)&&!A(k):j.id==="roles"?((T=e.config.modules.find(P=>P.id==="roles"))==null?void 0:T.ok)??!0:(((E=e.config.modules.find(P=>P.id==="workflow"))==null?void 0:E.ok)??!0)&&!A(N);return a.jsxs("button",{type:"button",className:`adjust__tab${d===j.id?" is-active":""}${O?"":" has-error"}`,onClick:()=>f(j.id),children:[a.jsx(L,{name:j.icon,size:13}),j.label,!O&&a.jsx("span",{className:"adjust__tab-dot"})]},j.id)})}),a.jsxs("div",{className:"adjust__tab-content",children:[d==="project"&&a.jsx(V5,{config:e.config,engines:e.engines,projectEnvRefs:e.projectEnvRefs,onSave:v,onBatchSave:y}),d==="roles"&&a.jsx(U5,{config:e.config,onSave:v,onKbIngest:m,onKbUpload:b}),d==="workflows"&&a.jsx(l9,{config:e.config,workflowTopology:e.workflowTopology,onSave:v})]})]}),a.jsx(E5,{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(L,{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(L,{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 f9(){return a.jsx($d,{children:a.jsx(d9,{})})}function ET({onCancel:e,onConfirm:t}){const[n,r]=_.useState([]),[s,i]=_.useState(!0),[o,l]=_.useState(null),[c,u]=_.useState(""),[d,f]=_.useState(new Set);async function h(){i(!0),l(null);try{const w=await KD();w.ok?r(w.groups):l(w.message)}catch(w){l(w instanceof Error?w.message:String(w))}finally{i(!1)}}_.useEffect(()=>{h()},[]);const p=_.useMemo(()=>{const w=c.trim().toLowerCase();return w?n.filter(v=>v.title.toLowerCase().includes(w)):n},[n,c]);function g(w){f(v=>{const y=new Set(v);return y.has(w)?y.delete(w):y.add(w),y})}function x(){const w=n.filter(v=>d.has(v.conversationId));t(w)}return a.jsxs("div",{className:"console-sub",children:[a.jsxs("div",{className:"console-sub__head",children:[a.jsxs("button",{type:"button",className:"console-sub__back",onClick:e,children:[a.jsx(L,{name:"chevron-left",size:14}),"返回首页"]}),a.jsx("h2",{className:"console-sub__title",children:"选择要绑定的群聊"}),a.jsx("p",{className:"console-sub__desc",children:"从你作为群主/管理员的钉钉群中多选,确认后为每个群绑定机器人"})]}),a.jsx("div",{className:"group-select__search",children:a.jsx("input",{className:"qf-input",placeholder:"搜索群名…",value:c,onChange:w=>u(w.target.value)})}),s?a.jsx("div",{className:"console-sub__saving",children:"正在拉取你管理的群…"}):o?a.jsxs("div",{className:"console-sub__err",children:[a.jsx(L,{name:"warn",size:13,color:"var(--red)"}),o,a.jsx("button",{type:"button",className:"console-retry",onClick:()=>void h(),children:"重试"})]}):a.jsx("div",{className:"group-select__list",children:p.length===0?a.jsx("div",{className:"console-sub__saving",children:"没有匹配的群"}):p.map(w=>a.jsxs("label",{className:"group-select__item",children:[a.jsx("input",{type:"checkbox",checked:d.has(w.conversationId),onChange:()=>g(w.conversationId)}),a.jsx("span",{className:"group-select__name",children:w.title||w.conversationId}),a.jsx("span",{className:"group-select__type",children:CT(w.groupType)})]},w.conversationId))}),a.jsxs("div",{className:"console-sub__foot",children:[a.jsxs("span",{className:"group-select__count",children:["已选 ",d.size," 个群"]}),a.jsxs("div",{className:"group-select__foot-actions",children:[a.jsx("button",{type:"button",className:"ghost",onClick:e,children:"取消"}),a.jsx("button",{type:"button",className:"primary",onClick:x,disabled:d.size===0,children:"确认选择"})]})]})]})}function CT(e){return e==="internal"?"内部群":e==="external"?"外部群":"未知"}function TT({rows:e,mode:t,onBack:n,onAddBot:r,onEditBot:s,onToggleEnabled:i,footer:o}){return a.jsxs("div",{className:"console-sub",children:[a.jsxs("div",{className:"console-sub__head",children:[a.jsxs("button",{type:"button",className:"console-sub__back",onClick:n,children:[a.jsx(L,{name:"chevron-left",size:14}),"返回首页"]}),a.jsx("h2",{className:"console-sub__title",children:"群聊-机器人配置"}),a.jsx("p",{className:"console-sub__desc",children:t==="view"?"当前群配置表内容,可编辑机器人或启停群":"为每个群绑定机器人后即可开始搭建"})]}),a.jsxs("div",{className:"group-bot-table",children:[a.jsxs("div",{className:"group-bot-table__head",children:[a.jsx("span",{className:"group-bot-table__col group-bot-table__col--name",children:"群名"}),a.jsx("span",{className:"group-bot-table__col group-bot-table__col--type",children:"类型"}),a.jsx("span",{className:"group-bot-table__col group-bot-table__col--bot",children:"机器人"}),a.jsx("span",{className:"group-bot-table__col group-bot-table__col--enabled",children:"是否启用"})]}),e.length===0?a.jsx("div",{className:"console-sub__saving",children:"还没有群配置"}):e.map(l=>a.jsxs("div",{className:"group-bot-table__row",children:[a.jsx("span",{className:"group-bot-table__col group-bot-table__col--name",title:l.title,children:l.title||l.conversationId}),a.jsx("span",{className:"group-bot-table__col group-bot-table__col--type",children:CT(l.groupType)}),a.jsx("span",{className:"group-bot-table__col group-bot-table__col--bot",children:l.botLabel?a.jsxs(a.Fragment,{children:[a.jsxs("span",{className:"group-bot-table__bot-name",children:[a.jsx(L,{name:"robot",size:13,color:"var(--accent)"}),l.botLabel]}),a.jsxs("button",{type:"button",className:"group-bot-table__edit",onClick:()=>s(l),children:[a.jsx(L,{name:"bolt",size:12}),"编辑"]})]}):a.jsxs("button",{type:"button",className:"ghost group-bot-table__add",onClick:()=>r(l),children:[a.jsx(L,{name:"plus",size:12}),"添加机器人"]})}),a.jsx("span",{className:"group-bot-table__col group-bot-table__col--enabled",children:a.jsxs("label",{className:"group-bot-table__switch",children:[a.jsx("input",{type:"checkbox",checked:l.enabled,onChange:c=>i(l,c.target.checked)}),a.jsx("span",{children:l.enabled?"已启用":"已停用"})]})})]},l.conversationId))]}),o&&a.jsx("div",{className:"console-sub__foot",children:o})]})}function PT({conversationId:e,groupTitle:t,groupType:n,onCancel:r,onEnterpriseDone:s,onPickCustom:i}){const o=n==="external",[l,c]=_.useState(null),[u,d]=_.useState(!1),[f,h]=_.useState(null),p=l==="custom"||l==="enterprise"&&!o&&!u;async function g(){if(l==="custom"){i();return}if(!(l!=="enterprise"||o)){d(!0),h(null);try{const x=await qD({conversationId:e,title:t,...n?{groupType:n}:{}});x.ok?s():h(x.message)}catch(x){h(x instanceof Error?x.message:String(x))}finally{d(!1)}}}return a.jsx("div",{className:"modal-overlay",onClick:r,children:a.jsxs("div",{className:"modal-card",onClick:x=>x.stopPropagation(),children:[a.jsxs("div",{className:"modal-card__head",children:[a.jsxs("span",{className:"modal-card__title",children:["为「",t,"」添加机器人"]}),a.jsx("button",{type:"button",className:"modal-card__close",onClick:r,children:a.jsx(L,{name:"close",size:14})})]}),a.jsxs("div",{className:"modal-card__body",children:[a.jsxs("label",{className:`addbot__option${l==="enterprise"?" is-active":""}${o?" is-disabled":""}`,children:[a.jsx("input",{type:"radio",name:"botChoice",disabled:o,checked:l==="enterprise",onChange:()=>c("enterprise")}),a.jsxs("div",{children:[a.jsx("div",{className:"addbot__option-title",children:"一键添加「企业机器人」"}),a.jsx("div",{className:"addbot__option-desc",children:o?"外部群仅支持自定义机器人 webhook":"仅内部群可用,自动创建/复用「ai表格群答疑助手」并入群"})]})]}),l==="enterprise"&&!o&&a.jsx("div",{className:"addbot__creds",children:a.jsxs("div",{className:"console-field",children:[a.jsx("span",{className:"console-field__label",children:"企业机器人"}),a.jsx("div",{className:"addbot__enterprise-hint",children:"ai表格群答疑助手(按当前 dws 组织自动创建/复用)"})]})}),a.jsxs("label",{className:`addbot__option${l==="custom"?" is-active":""}`,children:[a.jsx("input",{type:"radio",name:"botChoice",checked:l==="custom",onChange:()=>c("custom")}),a.jsxs("div",{children:[a.jsx("div",{className:"addbot__option-title",children:"配置「自定义机器人」"}),a.jsx("div",{className:"addbot__option-desc",children:"所有群都可用,需手动在群设置里添加 Webhook"})]})]}),f&&a.jsxs("div",{className:"console-sub__err",children:[a.jsx(L,{name:"warn",size:13,color:"var(--red)"}),f]})]}),a.jsxs("div",{className:"modal-card__foot",children:[a.jsx("button",{type:"button",className:"qf-btn qf-btn--secondary",onClick:r,children:"取消"}),a.jsx("button",{type:"button",className:"qf-btn qf-btn--primary",disabled:!p,onClick:g,children:u?"添加中…":l==="custom"?"去配置":"去添加"})]})]})})}function AT({groupTitle:e,onCancel:t,onSave:n}){const[r,s]=_.useState(""),[i,o]=_.useState(""),[l,c]=_.useState(""),[u,d]=_.useState(!1),[f,h]=_.useState(null),p=/^https?:\/\//.test(i.trim()),g=r.trim().length>0&&p&&l.trim().length>0&&!u;async function x(){d(!0),h(null);try{await n({name:r.trim(),webhook:i.trim(),secret:l.trim()})}catch(w){h(w instanceof Error?w.message:String(w)),d(!1)}}return a.jsx("div",{className:"modal-overlay",onClick:t,children:a.jsxs("div",{className:"modal-card",onClick:w=>w.stopPropagation(),children:[a.jsxs("div",{className:"modal-card__head",children:[a.jsxs("span",{className:"modal-card__title",children:["为「",e,"」配置自定义机器人"]}),a.jsx("button",{type:"button",className:"modal-card__close",onClick:t,children:a.jsx(L,{name:"close",size:14})})]}),a.jsxs("div",{className:"modal-card__body",children:[a.jsxs("div",{className:"console-note",children:[a.jsx(L,{name:"bolt",size:13,color:"var(--blue)"}),a.jsxs("div",{children:["请按以下步骤在钉钉群里添加自定义机器人:",a.jsx("br",{}),"1. 打开群设置 → 2. 选择「机器人」→ 3. 选择「自定义机器人」→ 4. 输入机器人名字",a.jsx("br",{}),"完成后把 Webhook 地址与加签密钥填入下方。"]})]}),a.jsxs("label",{className:"console-field",children:[a.jsx("span",{className:"console-field__label",children:"机器人名字"}),a.jsx("input",{className:"qf-input",value:r,placeholder:"如:群答疑助手",onChange:w=>s(w.target.value)})]}),a.jsxs("label",{className:"console-field",children:[a.jsx("span",{className:"console-field__label",children:"Webhook URL"}),a.jsx("input",{className:"qf-input",value:i,placeholder:"https://oapi.dingtalk.com/robot/send?access_token=...",onChange:w=>o(w.target.value)})]}),i.trim()&&!p&&a.jsxs("div",{className:"console-sub__err",children:[a.jsx(L,{name:"warn",size:13,color:"var(--red)"}),"Webhook 需以 http(s):// 开头"]}),a.jsxs("label",{className:"console-field",children:[a.jsx("span",{className:"console-field__label",children:"Secret"}),a.jsx("input",{className:"qf-input",type:"password",value:l,placeholder:"加签密钥",onChange:w=>c(w.target.value)})]}),f&&a.jsxs("div",{className:"console-sub__err",children:[a.jsx(L,{name:"warn",size:13,color:"var(--red)"}),f]})]}),a.jsxs("div",{className:"modal-card__foot",children:[a.jsx("button",{type:"button",className:"modal-card__btn",onClick:t,children:"取消"}),a.jsx("button",{type:"button",className:"modal-card__btn primary",onClick:()=>void x(),disabled:!g,children:u?"保存中…":"保存"})]})]})})}function h9(e){return e?e.type==="enterprise"?e.name?`企业机器人-「${e.name}」`:"企业机器人":`自定义机器人-「${e.name}」`:null}function p9(e){return e.appKey?e.botNick?`企业机器人-「${e.botNick}」`:"企业机器人":e.webhookUrl?`自定义机器人-「${e.botNick||"自定义"}」`:null}function m9({mode:e,state:t,onBack:n,onReload:r}){return e==="view"?a.jsx(v9,{onBack:n}):a.jsx(g9,{state:t,onBack:n,onReload:r})}function g9({state:e,onBack:t,onReload:n}){const r=e.groupBotsStaging??[],[s,i]=_.useState(null),[o,l]=_.useState(r.length===0),[c,u]=_.useState(null);if(o)return a.jsx(ET,{onCancel:()=>{r.length>0||(s??[]).length>0?l(!1):t()},onConfirm:g=>{i(x=>{const w=new Map((x??[]).map(v=>[v.conversationId,v]));for(const v of g)w.set(v.conversationId,v);return Array.from(w.values())}),l(!1)}});const d=new Map(r.map(g=>[g.conversationId,g])),f=new Map;for(const g of s??[])f.set(g.conversationId,g);for(const g of r)f.has(g.conversationId)||f.set(g.conversationId,{conversationId:g.conversationId,title:g.title,groupType:g.groupType});const h=Array.from(f.values()).map(g=>{const x=d.get(g.conversationId);return{conversationId:g.conversationId,title:g.title,...g.groupType?{groupType:g.groupType}:{},botLabel:x?h9(x.bot):null,enabled:(x==null?void 0:x.enabled)??!0}}),p=()=>{u(null),n()};return a.jsxs(a.Fragment,{children:[a.jsx(TT,{rows:h,mode:"setup",onBack:t,onAddBot:g=>u({kind:"add",row:g}),onEditBot:g=>u({kind:"add",row:g}),onToggleEnabled:()=>{},footer:a.jsxs("div",{className:"console-sub__foot",style:{display:"flex",gap:12},children:[a.jsx("button",{type:"button",className:"ghost",onClick:()=>l(!0),children:"添加更多群"}),a.jsx("button",{type:"button",className:"primary",onClick:t,children:"完成,返回首页"})]})}),(c==null?void 0:c.kind)==="add"&&a.jsx(PT,{conversationId:c.row.conversationId,groupTitle:c.row.title,...c.row.groupType?{groupType:c.row.groupType}:{},onCancel:()=>u(null),onEnterpriseDone:p,onPickCustom:()=>u({kind:"custom",row:c.row})}),(c==null?void 0:c.kind)==="custom"&&a.jsx(AT,{groupTitle:c.row.title,onCancel:()=>u(null),onSave:async({name:g,webhook:x,secret:w})=>{await Rk({conversationId:c.row.conversationId,title:c.row.title,...c.row.groupType?{groupType:c.row.groupType}:{},name:g,webhook:x,secret:w}),p()}})]})}function v9({onBack:e}){const[t,n]=_.useState([]),[r,s]=_.useState(!1),[i,o]=_.useState(!0),[l,c]=_.useState(null),[u,d]=_.useState(null),[f,h]=_.useState([]),[p,g]=_.useState(!1),x=_.useCallback(async()=>{o(!0),c(null);try{const j=await Ik();j.ok?n(j.groups):c("群配置表尚未就绪")}catch(j){c(j instanceof Error?j.message:String(j))}finally{s(!0),o(!1)}},[]);_.useEffect(()=>{x()},[x]);const w=_.useCallback(async()=>{const j=await GD().catch(()=>null);j!=null&&j.ok&&h([]),await x()},[x]);if(r&&!i&&!l&&t.length===0&&f.length===0||p)return a.jsx(ET,{onCancel:()=>{t.length>0||f.length>0?g(!1):e()},onConfirm:j=>{h(S=>{const k=new Map(S.map(N=>[N.conversationId,N]));for(const N of j)k.set(N.conversationId,N);return Array.from(k.values())}),g(!1)}});if(i)return a.jsx("div",{className:"console-sub",children:a.jsx("div",{className:"console-sub__saving",children:"正在读取群配置表…"})});const y=t.map(j=>({conversationId:j.groupId,title:j.groupName,...j.groupType?{groupType:j.groupType}:{},botLabel:p9(j),enabled:j.enabled,recordId:j.recordId})),m=new Set(t.map(j=>j.groupId)),b=f.filter(j=>!m.has(j.conversationId)).map(j=>({conversationId:j.conversationId,title:j.title,...j.groupType?{groupType:j.groupType}:{},botLabel:null,enabled:!0}));return a.jsxs(a.Fragment,{children:[a.jsx(TT,{rows:[...y,...b],mode:"view",onBack:e,onAddBot:j=>d({kind:"add",row:j}),onEditBot:j=>d({kind:"add",row:j}),onToggleEnabled:async(j,S)=>{j.recordId&&(await h_(j.recordId,{enabled:S}),await x())},footer:l?a.jsx("span",{className:"console-sub__err",children:l}):a.jsxs("div",{style:{display:"flex",gap:12,alignItems:"center"},children:[a.jsx("button",{type:"button",className:"ghost",onClick:()=>g(!0),children:"添加群聊"}),a.jsx("span",{className:"console-build__hint",children:"修改后将在下一次配置同步(约 5 分钟)后生效"})]})}),(u==null?void 0:u.kind)==="add"&&a.jsx(PT,{conversationId:u.row.conversationId,groupTitle:u.row.title,...u.row.groupType?{groupType:u.row.groupType}:{},onCancel:()=>d(null),onEnterpriseDone:()=>{d(null),u.row.recordId?x():w()},onPickCustom:()=>d({kind:"custom",row:u.row})}),(u==null?void 0:u.kind)==="custom"&&a.jsx(AT,{groupTitle:u.row.title,onCancel:()=>d(null),onSave:async({name:j,webhook:S,secret:k})=>{u.row.recordId?(await h_(u.row.recordId,{inbound:"dws",outbound:"webhook",botNick:j,webhookUrl:S,...k?{webhookSecret:k}:{}}),d(null),await x()):(await Rk({conversationId:u.row.conversationId,title:u.row.title,...u.row.groupType?{groupType:u.row.groupType}:{},name:j,webhook:S,secret:k}),d(null),await w())}})]})}const Gw=[{id:"home",label:"首页",icon:"folder"},{id:"kb",label:"知识库",icon:"file"},{id:"records",label:"答疑记录",icon:"table"},{id:"experts",label:"专家配置",icon:"user"}];function Ya(e,t){if(!(e!=null&&e.baseId)||!e.tableId)return null;const n=`https://docs.dingtalk.com/i/nodes/${e.baseId}?iframeQuery=sheetId%3D${encodeURIComponent(e.tableId)}`;if(!(t!=null&&t.embed))return n;const r=`sheetId=${encodeURIComponent(e.tableId)}&side_bar=false&top_bar=false&foot_bar=false&disable_guide=true&ntCatalogCollapsed=true&ntDisableGuide=true`;return`https://docs.dingtalk.com/i/nodes/${e.baseId}?iframeQuery=${encodeURIComponent(r)}&sideCollapsed=true&ntCatalogCollapsed=true&ntDisableGuide=true`}function y9(e,t,n,r={}){var d;const i=(n??[]).filter(f=>f.enabled&&f.bot),o=i.length>0,l=r.groupsLoading===!0,c=(d=t==null?void 0:t.modules.find(f=>f.id==="coding_agent"))==null?void 0:d.items.find(f=>f.key==="coding_agent.engine"),u=(c==null?void 0:c.status)==="ok";return[{id:"groups",title:"一键添加群聊并绑定机器人",desc:"拉取你管理的钉钉群,多选后为每个群绑定企业机器人或自定义机器人",done:o,loading:l,hint:l?"正在读取群配置…":o?`已配置 ${i.length} 个群`:"还没添加群聊或有群未配置机器人"},{id:"other",title:"其他配置",desc:"选择本机用于作答的 Coding Agent 引擎",done:!0,hint:u?`引擎:${String((c==null?void 0:c.value)??"")}`:"默认使用 qoder,可点击修改"}]}function x9(e){return e.map(t=>({conversationId:t.groupId,title:t.groupName,...t.groupType?{groupType:t.groupType}:{},enabled:t.enabled,bot:t.appKey?{type:"enterprise",appKey:t.appKey,...t.botNick?{name:t.botNick}:{}}:t.webhookUrl?{type:"custom",name:t.botNick||"自定义",webhookUrl:t.webhookUrl}:null}))}function Yw(e){return e.length>0&&e.every(t=>t.done)}function _9(e){return e!=null&&e.tableId?"view":"setup"}function Xw(e){return(e==null?void 0:e.status)==="starting"?{label:"正在启动…",action:"start",tone:"primary",disabled:!0,statusLabel:"启动中"}:(e==null?void 0:e.status)==="stopping"?{label:"正在停止…",action:"stop",tone:"danger",disabled:!0,statusLabel:"停止中"}:(e==null?void 0:e.status)==="running"?{label:"停止",action:"stop",tone:"danger",disabled:!1,statusLabel:"运行中"}:(e==null?void 0:e.status)==="stopped"?{label:"重启运行",action:"start",tone:"primary",disabled:!1,statusLabel:"已停止"}:(e==null?void 0:e.status)==="error"?{label:"重启运行",action:"start",tone:"primary",disabled:!1,statusLabel:"运行异常"}:{label:"启动运行",action:"start",tone:"primary",disabled:!1,statusLabel:(e==null?void 0:e.status)==="idle"?"未运行":"状态未知"}}function w9(e,t){const n=r=>{if(r)return r.baseId?r:{...r,baseId:t}};return[{field:"admin_table",label:"管理员配置表",purpose:"指定哪些人是管理员。管理员可以在「知识收件箱」里补充答案,补充后会自动沉淀进知识库。",howTo:"在表格中每行填一位管理员的钉钉 userId(或按表内列说明填写)。改完点下方「同步配置」,助手会立刻重新读取名单。",ref:n(e==null?void 0:e.admin_table)},{field:"owner_table",label:"模块负责人配置表",purpose:"按功能模块指定专家。助手判定问题属于某模块且需要升级时,会在群里 @ 对应负责人。",howTo:"每行填「模块名 + 负责人 userId」。模块名要和助手回答里出现的模块口径一致。改完点下方「同步配置」,助手会立刻重新读取名单。",ref:n(e==null?void 0:e.owner_table)}]}function ay(e,t){var n;if(e)return t&&((n=e[t])!=null&&n.tableId)?e[t]:Object.values(e).find(r=>r.baseId&&r.tableId)}function b9({mode:e,state:t,config:n,engines:r,artifacts:s,buildDone:i,buildBaseUrl:o,onSave:l,onReload:c,onStartBuild:u,building:d}){const[f,h]=_.useState(null),p=_9(t==null?void 0:t.groupTableRef),[g,x]=_.useState(null),[w,v]=_.useState(!1),[y,m]=_.useState("idle"),[b,j]=_.useState(null),[S,k]=_.useState(null),N=_.useRef([]),A=C=>(N.current.push(C),C);_.useEffect(()=>()=>N.current.forEach(C=>clearInterval(C)),[]),_.useEffect(()=>{let C=!1;return f_().then(R=>{C||v(!R.loggedIn)}).catch(()=>{}),()=>{C=!0}},[]);async function O(){k(null),m("starting");const C=await HD().catch(B=>({ok:!1,message:String(B)}));if(!C.ok){k(C.message??"登录发起失败"),m("idle");return}m("waiting-link");const R=Date.now()+6e4,M=A(window.setInterval(async()=>{const B=await WD().catch(()=>({verifyUrl:null}));if(B.verifyUrl){clearInterval(M),j(B.verifyUrl),m("waiting-auth");const $=A(window.setInterval(async()=>{const F=await f_().catch(()=>null);F!=null&&F.loggedIn&&(clearInterval($),v(!1),m("idle"),j(null),c())},5e3))}else Date.now()>R&&(clearInterval(M),k("等待授权链接超时,请重试或在终端手动执行 dws auth login"),m("idle"))},2e3))}_.useEffect(()=>{if(p!=="view"){x(null);return}let C=!1;return Ik().then(R=>{C||x(R.ok?R.groups:[])}).catch(()=>{C||x([])}),()=>{C=!0}},[p]);const D=p==="view"&&g?x9(g):t==null?void 0:t.groupBotsStaging,z=y9(t,n,D,{groupsLoading:p==="view"&&g===null}),T=ay(s==null?void 0:s.trackers,(t==null?void 0:t.workflowId)??null),E=o??Ya(T),P=_.useRef(!1);return _.useEffect(()=>{var $,F;if(P.current)return;const C=n==null?void 0:n.modules.find(H=>H.id==="coding_agent"),R=C==null?void 0:C.items.find(H=>H.key==="coding_agent.engine");if(!(R!=null&&R.writeTarget)||R.status!=="error")return;const M=(($=r.find(H=>H.engine==="qoder"))==null?void 0:$.engine)??((F=r[0])==null?void 0:F.engine);if(!M)return;P.current=!0;const B=C==null?void 0:C.items.find(H=>H.key==="coding_agent.config.enabled");(async()=>(await l(R.writeTarget,M),(B==null?void 0:B.status)==="error"&&B.writeTarget&&await l(B.writeTarget,"true")))()},[n,r,l]),f==="groups"&&t?a.jsx(m9,{mode:p,state:t,onBack:()=>h(null),onReload:c}):f==="other"?a.jsx(j9,{config:n,engines:r,onSave:l,onBack:()=>h(null)}):a.jsxs("div",{className:"console-page",children:[w&&a.jsxs("div",{className:"console-auth-banner",children:[a.jsx(L,{name:"warn",size:14,color:"var(--red)"}),a.jsxs("span",{className:"console-auth-banner__text",children:["钉钉(dws)登录已失效:引擎无法装配、群配置与表格读写都会失败。",y==="waiting-auth"&&b?" 请在浏览器完成授权,本页会自动恢复。":" 请重新登录。"]}),y==="idle"&&a.jsx("button",{type:"button",className:"primary console-auth-banner__btn",onClick:()=>void O(),children:"重新登录"}),(y==="starting"||y==="waiting-link")&&a.jsx("span",{className:"console-auth-banner__wait",children:"正在启动登录…"}),y==="waiting-auth"&&b&&a.jsx("a",{className:"primary console-auth-banner__btn",href:b,target:"_blank",rel:"noreferrer",children:"打开授权页面"}),S&&a.jsx("span",{className:"console-auth-banner__err",children:S})]}),a.jsxs("section",{className:"console-section",children:[a.jsx("h2",{className:"console-section__title",children:"答疑助手能做什么"}),a.jsxs("div",{className:"console-intro",children:[a.jsxs("div",{className:"console-intro__item",children:[a.jsx("span",{className:"console-intro__icon",children:a.jsx(L,{name:"robot",size:16,color:"var(--accent)"})}),a.jsxs("div",{children:[a.jsx("div",{className:"console-intro__head",children:"自动回答群里的常见问题"}),a.jsx("div",{className:"console-intro__body",children:"监听你指定的钉钉群,识别出真正的提问后,基于知识库给出有依据的回答; 没有依据时保持静默,不编造答案。"})]})]}),a.jsxs("div",{className:"console-intro__item",children:[a.jsx("span",{className:"console-intro__icon",children:a.jsx(L,{name:"user",size:16,color:"var(--accent)"})}),a.jsxs("div",{children:[a.jsx("div",{className:"console-intro__head",children:"该找人的时候自动找人"}),a.jsx("div",{className:"console-intro__body",children:"判定为缺陷、需求或知识库缺口时,按「模块负责人配置表」在群里 @ 对应专家, 并把待处理事项留痕到 AI 表格。"})]})]})]})]}),a.jsxs("section",{className:"console-section",children:[a.jsx("h2",{className:"console-section__title",children:"快速配置"}),a.jsx("p",{className:"console-section__sub",children:"下面两项配齐后就能开始搭建 AI 表格"}),a.jsx("div",{className:"console-quick",children:z.map(C=>{const R=C.id==="groups"&&p==="view"?"查看配置":C.done?"查看 / 修改":"去配置";return a.jsxs("div",{className:`console-quick__card${C.done?" is-done":""}`,children:[a.jsx("span",{className:`console-quick__badge${C.loading?" is-loading":""}`,children:a.jsx(L,{name:C.loading?"refresh":C.done?"check":"dot",size:13,color:C.loading?"var(--text-faint)":C.done?"var(--green)":"var(--amber)"})}),a.jsx("div",{className:"console-quick__title",children:C.title}),a.jsx("div",{className:"console-quick__desc",children:C.desc}),a.jsx("div",{className:`console-quick__hint${C.done?" is-done":""}${C.loading?" is-loading":""}`,children:C.hint}),a.jsxs("button",{type:"button",className:C.done?"ghost console-quick__cta":"primary console-quick__cta",onClick:()=>h(C.id),children:[R,a.jsx(L,{name:"chevron-right",size:13})]})]},C.id)})}),a.jsx("div",{className:"console-build",children:i?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"console-build__icon",children:a.jsx(L,{name:"check",size:18,color:"var(--green)"})}),a.jsx("span",{className:"console-build__hint",children:e==="runtime"?"已搭建。点右上角「启动运行」开始服务;群配置修改在下一次配置同步(约 5 分钟)后生效。点击「重新搭建」自动补齐。":"已搭建。如需启动运行请使用 aitable-workflow start 命令。点击「重新搭建」自动补齐。"}),E&&a.jsx("a",{href:E,target:"_blank",rel:"noreferrer",className:"console-build__link",children:"查看 AI 表格"}),a.jsxs("button",{type:"button",className:"ghost console-build__rebuild",onClick:u,disabled:d,title:"自动检查并补齐缺失的表、字段与视图,已有数据不受影响",children:[a.jsx(L,{name:"refresh",size:13}),d?"搭建中…":"重新搭建"]})]}):a.jsxs(a.Fragment,{children:[a.jsxs("button",{type:"button",className:"primary console-build__btn",onClick:u,disabled:!Yw(z)||d,children:[a.jsx(L,{name:"play",size:15,color:"#fff"}),d?"搭建中…":"开始搭建"]}),a.jsx("span",{className:"console-build__hint",children:Yw(z)?"将自动创建「群问答记录表」「群配置表」及其字段与视图":"两项配置全部完成后可开始搭建"})]})})]})]})}function j9({config:e,engines:t,onSave:n,onBack:r}){const s=e==null?void 0:e.modules.find(f=>f.id==="coding_agent"),i=s==null?void 0:s.items.find(f=>f.key==="coding_agent.engine"),o=s==null?void 0:s.items.find(f=>f.key==="coding_agent.config.enabled"),[l,c]=_.useState(!1);async function u(f){if(!(!(i!=null&&i.writeTarget)||!f)){c(!0);try{await n(i.writeTarget,f),(o==null?void 0:o.status)==="error"&&o.writeTarget&&await n(o.writeTarget,"true")}finally{c(!1)}}}const d=((s==null?void 0:s.items)??[]).filter(f=>f.key!=="coding_agent.engine"&&f.writeTarget&&f.status==="error");return a.jsxs("div",{className:"console-sub",children:[a.jsxs("div",{className:"console-sub__head",children:[a.jsxs("button",{type:"button",className:"console-sub__back",onClick:r,children:[a.jsx(L,{name:"chevron-left",size:14}),"返回首页"]}),a.jsx("h2",{className:"console-sub__title",children:"配置其他"}),a.jsx("p",{className:"console-sub__desc",children:"选择本机用于作答的 Coding Agent 引擎"})]}),a.jsxs("div",{className:"console-card",children:[a.jsxs("label",{className:"console-field",children:[a.jsx("span",{className:"console-field__label",children:"执行引擎"}),a.jsxs("select",{className:"qf-select",value:(i==null?void 0:i.value)??"",disabled:l,onChange:f=>void u(f.target.value),children:[a.jsx("option",{value:"",children:"请选择…"}),t.map(f=>a.jsxs("option",{value:f.engine,children:[f.engine,"(",f.cmd,f.version?` v${f.version}`:"",")"]},f.engine)),!t.some(f=>f.engine==="llm_only")&&a.jsx("option",{value:"llm_only",children:"llm_only(无需本地 CLI)"})]})]}),(i==null?void 0:i.status)==="error"&&a.jsxs("div",{className:"console-sub__err",children:[a.jsx(L,{name:"warn",size:13,color:"var(--red)"}),i.message]}),l&&a.jsx("div",{className:"console-sub__saving",children:"保存中…"})]}),d.length>0&&a.jsxs("div",{className:"console-card",children:[a.jsx("div",{className:"console-card__head",children:a.jsx("span",{className:"console-card__title",children:"引擎补充配置"})}),d.map(f=>a.jsx(fn,{item:f,onSave:n},f.key))]})]})}function Qd({ref_:e,placeholder:t}){const n=Ya(e,{embed:!0}),r=Ya(e),[s,i]=_.useState(!1);return _.useEffect(()=>{i(!1)},[n]),!n||!r?a.jsxs("div",{className:"console-frame__empty",children:[a.jsx(L,{name:"table",size:26,color:"var(--text-faint)"}),a.jsx("p",{className:"console-frame__empty-text",children:t})]}):a.jsxs("div",{className:"console-frame",children:[a.jsxs("div",{className:"console-frame__stage",children:[!s&&a.jsxs("div",{className:"console-frame__loading",children:[a.jsx("span",{className:"console-frame__spinner"}),"正在加载表格…"]}),a.jsx("iframe",{className:"console-frame__iframe",src:n,title:(e==null?void 0:e.label)??"AI 表格",allow:"clipboard-read; clipboard-write",onLoad:()=>i(!0)})]}),a.jsxs("div",{className:"console-frame__foot",children:[a.jsx(L,{name:"link",size:11,color:"var(--text-muted)"}),a.jsx("span",{children:"若显示登录页,请先在浏览器登录钉钉"}),a.jsx("a",{className:"console-frame__link",href:r,target:"_blank",rel:"noreferrer",children:"在新标签页打开"})]})]})}const S9="wiki/official-aitable-faq",k9="knowledge-ingest";function N9({state:e,artifacts:t,onReload:n}){var y;const[r,s]=_.useState(null),[i,o]=_.useState(null),l=(e==null?void 0:e.kbRoleId)??null,c=(e==null?void 0:e.kb.userCollection)??null,u=(e==null?void 0:e.kb.officialOn)??!1,d=(e==null?void 0:e.kb.stats)??{},f=c?d[c]:void 0,h=d[S9],p=(y=t==null?void 0:t.trackers)==null?void 0:y[k9],g=(c?1:0)+(u?1:0),x=Object.values(d).some(m=>m.status==="compiling"),w=_.useRef(n);w.current=n,_.useEffect(()=>{if(!x)return;const m=setInterval(()=>w.current(),4e3);return()=>clearInterval(m)},[x]);async function v(m){if(l){s("official"),o(null);try{const b=await YD(l,m);if(!b.ok){o(b.message);return}n()}catch(b){o(b instanceof Error?b.message:String(b))}finally{s(null)}}}return a.jsx("div",{className:"console-page console-page--frame",children:a.jsxs("section",{className:"console-section console-section--frame",children:[a.jsxs("div",{className:"console-kb__title-row",children:[a.jsx("h2",{className:"console-section__title",children:"知识库"}),a.jsxs("span",{className:"console-kb__count",children:["已启用 ",g," 个"]})]}),a.jsx("p",{className:"console-section__sub",children:"助手可同时使用多个知识库作答:在「我的知识库」上传你自己的知识,添加后助手会自动学习; 官方知识库是内置的 AI 表格官方答疑知识库,只读,可随时启用作为补充。"}),!l&&a.jsxs("div",{className:"console-note console-note--warn",children:[a.jsx(L,{name:"warn",size:13,color:"var(--amber)"}),a.jsx("div",{children:"未在 profile 中找到带知识库的角色,知识库功能不可用。"})]}),a.jsxs("div",{className:"console-kb",children:[a.jsxs("div",{className:"console-kb__card console-kb__card--official",children:[a.jsxs("div",{className:"console-kb__head",children:[a.jsx(L,{name:"file",size:16,color:"var(--accent)"}),a.jsx("span",{className:"console-kb__title",children:"官方知识库 · 钉钉 AI 表格 FAQ"}),a.jsx("span",{className:"console-kb__badge",children:"只读"}),a.jsxs("label",{className:"console-kb__switch",children:[a.jsx("input",{type:"checkbox",checked:u,disabled:r!==null||!l,onChange:m=>void v(m.target.checked)}),r==="official"?"切换中…":u?"已启用":"未启用"]})]}),a.jsx("p",{className:"console-kb__desc",children:"内置的 AI 表格官方答疑知识库,覆盖快速入门、字段与视图、自动化、仪表盘等常见问题。 只读,不可查看或修改;启用后助手会把它和你的知识库一起作为作答参考。"}),a.jsx("div",{className:"console-kb__stats",children:u?Qw(h):"未启用,不参与作答"})]}),a.jsxs("div",{className:"console-kb__card",children:[a.jsxs("div",{className:"console-kb__head",children:[a.jsx(L,{name:"table",size:16,color:"var(--accent)"}),a.jsx("span",{className:"console-kb__title",children:"我的知识库"}),a.jsx("span",{className:"console-kb__stats",children:Qw(f)})]}),a.jsx("p",{className:"console-kb__desc",children:"在这里上传和管理你自己的知识。在下方表格新增一行就是一条知识:填写「标题」和「内容」, 或提供「来源附件」/「来源链接」;然后把「状态」拨为「待处理」, 助手运行期间会自动学习并编译,完成后状态变为「就绪」。"}),a.jsx(Qd,{ref_:p,placeholder:"还没有「我的知识库」表。请先在首页完成配置并点「开始搭建」,系统会自动创建这张录入表。"})]})]}),i&&a.jsxs("div",{className:"console-note console-note--err",children:[a.jsx(L,{name:"warn",size:13,color:"var(--red)"}),a.jsx("div",{children:i})]})]})})}function Qw(e){if(!e||e.status==="unknown")return"尚未编译";if(e.status==="compiling")return"正在编译…";const t=[];return typeof e.sourceCount=="number"&&t.push(`${e.sourceCount} 个来源`),typeof e.articleCount=="number"&&t.push(`${e.articleCount} 篇知识文章`),e.finishedAt&&t.push(`更新于 ${E9(e.finishedAt)}`),t.length===0?e.status==="failed"?"上次编译失败":"尚未编译":e.status==="failed"?`${t.join(" · ")}(上次编译失败)`:t.join(" · ")}function E9(e){const t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString()}function C9({artifacts:e,workflowId:t}){const n=ay(e==null?void 0:e.trackers,t),r=Ya(n);return a.jsx("div",{className:"console-page console-page--frame",children:a.jsxs("section",{className:"console-section console-section--frame",children:[a.jsx("h2",{className:"console-section__title",children:"答疑记录"}),a.jsx("p",{className:"console-section__sub",children:"助手处理过的每条群消息都会留痕在这里:原始提问、处置动作、回答内容与知识沉淀状态。 管理员在「★ 知识收件箱」视图里补充答案,即可把缺口沉淀进知识库。"}),r&&a.jsxs("p",{className:"console-section__tablelink",children:["详情可见 AI 表格 ——"," ",a.jsxs("a",{href:r,target:"_blank",rel:"noreferrer",children:["「",(n==null?void 0:n.label)??"群问答记录表","」"]})]}),a.jsx(Qd,{ref_:n,placeholder:"还没有「群问答记录表」。请先在首页完成配置并点「开始搭建」,系统会自动创建这张表。"})]})})}function T9({artifacts:e,workflowId:t}){const n=ay(e==null?void 0:e.trackers,t),r=w9(e==null?void 0:e.configTables,(n==null?void 0:n.baseId)??""),[s,i]=_.useState(0),[o,l]=_.useState(!1),[c,u]=_.useState(null),[d,f]=_.useState(null),h=r[s]??r[0],p=Ya(h.ref);async function g(){l(!0),f(null),u(null);try{const x=await JD(P9);u(x.actions>0?{tone:"ok",text:`同步完成:处理了 ${x.actions} 条配置动作,新的管理员与负责人名单已生效。`}:{tone:"warn",text:"配置同步已执行,但没有产出任何动作。请检查表格里是否有可用行(空表、必填列没填都会这样)。"})}catch(x){f(x instanceof Error?x.message:String(x))}finally{l(!1)}}return a.jsx("div",{className:"console-page console-page--frame",children:a.jsxs("section",{className:"console-section console-section--frame",children:[a.jsx("h2",{className:"console-section__title",children:"专家配置"}),a.jsx("div",{className:"console-tabs",children:r.map((x,w)=>a.jsxs("button",{type:"button",className:`console-tabs__tab${w===s?" is-active":""}`,onClick:()=>i(w),children:[x.label,!A9(x.ref)&&a.jsx("span",{className:"console-tabs__dot"})]},x.field))}),a.jsxs("div",{className:"console-note",children:[a.jsx(L,{name:"user",size:13,color:"var(--blue)"}),a.jsxs("div",{children:[a.jsxs("div",{className:"console-note__title",children:[h.label,"有什么用"]}),a.jsx("div",{children:h.purpose}),a.jsxs("div",{className:"console-note__howto",children:[a.jsx("strong",{children:"怎么配:"}),h.howTo]})]})]}),p&&a.jsxs("p",{className:"console-section__tablelink",children:["详情可见 AI 表格 ——"," ",a.jsxs("a",{href:p,target:"_blank",rel:"noreferrer",children:["「",h.label,"」"]})]}),a.jsx(Qd,{ref_:h.ref,placeholder:`还没有「${h.label}」。请先在首页完成搭建,系统会在同一个 AI 表格里创建这张配置表。`}),a.jsxs("div",{className:"console-sync",children:[a.jsxs("button",{type:"button",className:"primary",onClick:()=>void g(),disabled:o,children:[a.jsx(L,{name:"refresh",size:14,color:"#fff"}),o?"同步中…":"同步配置"]}),a.jsx("span",{className:"console-sync__hint",children:"在表格里改完管理员或模块负责人后,点这里让助手立刻重新读取名单"}),(c==null?void 0:c.tone)==="ok"&&a.jsxs("span",{className:"console-sub__ok",children:[a.jsx(L,{name:"check",size:13,color:"var(--green)"}),c.text]}),(c==null?void 0:c.tone)==="warn"&&a.jsxs("span",{className:"console-sub__warn",children:[a.jsx(L,{name:"warn",size:13,color:"var(--amber)"}),c.text]}),d&&a.jsxs("span",{className:"console-sub__err",children:[a.jsx(L,{name:"warn",size:13,color:"var(--red)"}),d]})]})]})})}const P9="config-sync";function A9(e){return!!(e!=null&&e.baseId)&&!!e.tableId}const Zw=8e3,R9=2e3;function I9({mode:e,onFallback:t}){var F;const[n,r]=_.useState(e),[s,i]=_.useState("home"),[o,l]=_.useState(null),[c,u]=_.useState(null),[d,f]=_.useState(null),[h,p]=_.useState(null),[g,x]=_.useState(!0),[w,v]=_.useState(null),[y,m]=_.useState(!1),[b,j]=_.useState(!1),[S,k]=_.useState(null),[N,A]=_.useState(null),[O,D]=_.useState(!1),[I,z]=_.useState(null),T=_.useRef(!1),E=_.useCallback(async(H=!1)=>{v(null);try{const[W,U,q]=await Promise.all([H?Promise.resolve(null):Ak(),BD(),d_().catch(()=>null)]);W&&l(W),u(U),f(q),q!=null&&q.ready&&j(!0)}catch(W){v(W instanceof Error?W.message:String(W))}finally{x(!1)}},[]);_.useEffect(()=>{E()},[E]),_.useEffect(()=>{if(n){zp().then(W=>D(!!W.promotable)).catch(()=>{});return}let H=!1;return zp().then(W=>{H||(r(W.mode),D(!!W.promotable))}).catch(()=>{H||r("setup")}),()=>{H=!0}},[n]),_.useEffect(()=>{if(n!=="runtime")return;let H=!1,W;const U=async()=>{try{const q=await XD();if(H)return;p(q);const Q=q.status==="starting"||q.status==="stopping";W=setTimeout(()=>void U(),Q?R9:Zw)}catch{H||(W=setTimeout(()=>void U(),Zw))}};return U(),()=>{H=!0,W&&clearTimeout(W)}},[n]);const P=_.useCallback(async(H,W)=>{const U=await Dp([{writeTarget:H,value:W}]);l(q=>q&&{...q,config:U.recheck})},[]);async function C(){m(!0),k({phase:"running",logs:[]});try{await Pk()}catch(W){const U=W instanceof Error?W.message:String(W);v(U),m(!1),k({phase:"error",message:U});return}const H=async()=>{try{const W=await u_();if(k(W),W.phase==="done"){j(!0),A(W.baseUrl),m(!1),z(W.promotionError??null),W.mode&&W.mode!==n&&r(W.mode);const U=await d_().catch(()=>null);U&&f(U)}else W.phase==="error"?(v(W.message),m(!1)):setTimeout(()=>void H(),2e3)}catch(W){const U=W instanceof Error?W.message:String(W);v(U),m(!1),k({phase:"error",message:U})}};H()}async function R(){if(T.current)return;const H=Xw(h);if(!H.disabled){T.current=!0;try{const W=await ZD(H.action);p(W.status)}catch(W){v(W instanceof Error?W.message:String(W))}finally{T.current=!1}}}async function M(){try{await UD(),r("runtime"),z(null);const H=await u_().catch(()=>null);(H==null?void 0:H.phase)==="done"&&k(H)}catch(H){z(H instanceof Error?H.message:String(H))}}const B=n==="runtime"?Xw(h):null,$=((B==null?void 0:B.disabled)??!0)||!b;return a.jsxs("div",{className:"console",children:[a.jsxs("aside",{className:"console__rail",children:[a.jsxs("div",{className:"console__brand",children:[a.jsx("span",{className:"console__brand-mark",children:a.jsx(L,{name:"sparkle",size:14,color:"#fff"})}),a.jsx("span",{className:"console__brand-text",children:"群答疑助手"})]}),a.jsx("nav",{className:"console__nav",children:Gw.map(H=>a.jsxs("button",{type:"button",className:`console__nav-item${s===H.id?" is-active":""}`,onClick:()=>i(H.id),children:[a.jsx(L,{name:H.icon,size:15}),H.label]},H.id))}),a.jsxs("button",{type:"button",className:"console__fallback",onClick:t,children:[a.jsx(L,{name:"bolt",size:13}),"切换到通用配置"]})]}),a.jsxs("div",{className:"console__main",children:[a.jsxs("header",{className:"console__topbar",children:[a.jsx("div",{className:"console__topbar-title",children:(F=Gw.find(H=>H.id===s))==null?void 0:F.label}),a.jsx("div",{className:"console__spacer"}),n==="runtime"&&B&&a.jsxs(a.Fragment,{children:[a.jsxs("span",{className:`console__status console__status--${(h==null?void 0:h.status)??"unknown"}`,children:[a.jsx(L,{name:"dot",size:11}),B.statusLabel]}),a.jsxs("button",{type:"button",className:B.tone==="danger"?"ghost console__run console__run--danger":"primary console__run",onClick:()=>void R(),disabled:$,title:b?void 0:"请先完成搭建",children:[a.jsx(L,{name:B.action==="stop"?"pause":"play",size:13,color:B.tone==="danger"?void 0:"#fff"}),B.label]})]}),n==="setup"&&O&&a.jsxs("button",{type:"button",className:"primary console__run",disabled:!0,title:"完成搭建后可启动运行",children:[a.jsx(L,{name:"play",size:13,color:"#fff"}),"启动运行"]})]}),w&&a.jsxs("div",{className:"console__error",children:[a.jsx(L,{name:"warn",size:14,color:"var(--red)"}),a.jsx("span",{children:w}),a.jsx("button",{type:"button",className:"console__retry",onClick:()=>void E(),children:"重试"})]}),n==="setup"&&I&&a.jsxs("div",{className:"console__error",children:[a.jsx(L,{name:"warn",size:14,color:"var(--red)"}),a.jsxs("span",{children:["进入运行模式失败:",I]}),a.jsx("button",{type:"button",className:"console__retry",onClick:()=>void M(),children:"重试进入运行模式"})]}),(h==null?void 0:h.lastError)&&a.jsxs("div",{className:"console__error",children:[a.jsx(L,{name:"warn",size:14,color:"var(--amber)"}),a.jsxs("span",{children:["上次运行报错:",h.lastError]})]}),g||!n?a.jsx("div",{className:"console__loading",children:"正在读取配置…"}):y?a.jsx(M9,{progress:S}):s==="home"?a.jsx(b9,{mode:n,state:c,config:(o==null?void 0:o.config)??null,engines:(o==null?void 0:o.engines.available)??[],artifacts:d,buildDone:b,buildBaseUrl:N,onSave:P,onReload:()=>void E(),onStartBuild:()=>void C(),building:y}):s==="kb"?a.jsx(N9,{state:c,artifacts:d,onReload:()=>void E(!0)}):s==="records"?a.jsx(C9,{artifacts:d,workflowId:(c==null?void 0:c.workflowId)??null}):a.jsx(T9,{artifacts:d,workflowId:(c==null?void 0:c.workflowId)??null})]}),a.jsxs("a",{className:"console-joingroup",href:"https://qr.dingtalk.com/action/joingroup?code=v1,k1,/xIPTTGROCslSemXwkUCiBNuwoP52KHYqXWhiIoOFnWdR7ksupjDEA==&_dt_no_comment=1&origin=1",target:"_blank",rel:"noopener noreferrer",children:[a.jsx(L,{name:"user",size:14,color:"#fff"}),"加入交流群"]})]})}function M9({progress:e}){return a.jsx("div",{className:"console-page",children:a.jsxs("div",{className:"console-build console-build--center",children:[a.jsx("span",{className:"console-build__spinner"}),a.jsx("h2",{className:"console-build__title",children:"正在搭建 AI 表格"}),a.jsx("p",{className:"console-build__hint",children:(e==null?void 0:e.phase)==="running"?"正在创建数据表、字段、视图与自动化…":"正在启动搭建任务…"})]})})}function O9(){const e=Sr(),[t]=_.useState(()=>(Tk(),zp().then(s=>r(s.mode)).catch(()=>r("setup")),null)),[n,r]=_.useState(t);return a.jsx(I9,{mode:n,onFallback:()=>e("/setup")})}async function L9(){return(await(await ce("/api/account/profile")).json()).user}async function ly(){return(await(await ce("/api/account/machines")).json()).machines}async function $9(e){await ce(`/api/account/machines/${e}`,{method:"DELETE"})}async function D9(e,t){await ce(`/api/account/machines/${e}`,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(t)})}async function z9(e){return(await(await ce(`/api/account/machines/${e}/regenerate-key`,{method:"POST"})).json()).key}async function RT(){return(await(await ce("/api/account/owner-token")).json()).token}let km;async function F9(){try{const e=await fetch(`${dk}/api/public-config`);if(e.ok){const t=await e.json();t.relayGatewayUrl&&(km=t.relayGatewayUrl)}}catch{}}function IT(){return km||(typeof window<"u"?window.location.origin.replace(/^http/,"ws"):"ws://your-server:8787")}const Jw="@ali/aitable-workflow@latest",V9="";function B9(e){return e?`npm i -g --registry=${e} ${Jw}`:`npm i -g ${Jw}`}function U9(e=V9){return B9(e)}function H9(e,t=IT()){return["aitable-workflow connect",` --server-url ${t}`,` --key ${e}`," --name <此机器名>"].join(` \\
|
|
93
|
-
`)}function W9(e,t="<此机器名>",n=IT()){return["aitable-workflow connect",` --server-url ${n}`,` --token ${e}`,` --name ${t}`].join(` \\
|
|
94
|
-
`)}function Nm({machineKey:e,ownerToken:t,machineName:n,title:r,persistent:s,onClose:i}){const[o,l]=_.useState(!1),[c,u]=_.useState(!1),[d,f]=_.useState(!1),h=!!t,p=t??e??"",g=h?"Owner Token":"Machine Key",x=U9(),w=h?W9(t,n||void 0):H9(e??"");function v(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(L,{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(L,{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:g}),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:()=>v(p,l),title:"复制凭证",children:[o?a.jsx(L,{name:"check",size:12}):a.jsx(L,{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:()=>v(x,f),title:"复制安装命令",children:[d?a.jsx(L,{name:"check",size:12}):a.jsx(L,{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:()=>v(w,u),title:"复制命令",children:[c?a.jsx(L,{name:"check",size:12}):a.jsx(L,{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 K9(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 q9(e){return e.length<=12?e:e.slice(0,6)+"..."+e.slice(-4)}const G9={claudecode:"Claude",codex:"Codex",qoder:"Qoder",codebuddy:"Codebuddy",opencode:"OpenCode",qwen:"Qwen",deepseek:"DeepSeek",trae:"Trae",qwenwork:"千问办公"};function Y9({machine:e,onRevoke:t,onUpdated:n}){const[r,s]=_.useState(!1),[i,o]=_.useState(!1),[l,c]=_.useState(""),[u,d]=_.useState(!1),[f,h]=_.useState(null),[p,g]=_.useState(null);function x(){navigator.clipboard.writeText(e.machineId).then(()=>{s(!0),setTimeout(()=>s(!1),1500)})}async function w(){d(!0);try{const N=await RT();h(N)}catch(N){window.alert("获取接入指令失败:"+(N instanceof Error?N.message:String(N)))}finally{d(!1)}}async function v(){if(window.confirm(`确定要为「${e.displayName||e.name}」重新生成密钥吗?旧密钥将立即失效,需用新密钥重新接入。`)){d(!0);try{const A=await z9(e.machineId);g(A)}catch(A){window.alert("重新生成失败:"+(A instanceof Error?A.message:String(A)))}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 b(){const N=l.trim();if(N){try{await D9(e.machineId,{displayName:N}),n==null||n(e.machineId,{displayName:N})}catch(A){window.alert("修改失败:"+(A instanceof Error?A.message:String(A)))}o(!1)}}const j=e.displayName||e.name,S=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 ${S?"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:N=>c(N.target.value),onKeyDown:N=>{N.key==="Enter"&&b(),N.key==="Escape"&&o(!1)},autoFocus:!0}),a.jsx("button",{type:"button",className:"machine-card__edit-save",onClick:()=>void b(),title:"保存",children:a.jsx(L,{name:"check",size:12})}),a.jsx("button",{type:"button",className:"machine-card__edit-cancel",onClick:()=>o(!1),title:"取消",children:a.jsx(L,{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${S?"":" machine-card__runtimes--offline"}`,children:[k.map(N=>a.jsx("span",{className:"machine-card__runtime-tag",children:G9[N]??N},N)),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: ",q9(e.machineId),a.jsx("button",{type:"button",className:"machine-card__copy",onClick:x,title:"复制 Machine ID",children:r?a.jsx(L,{name:"check",size:12}):a.jsx(L,{name:"link",size:12})})]}),a.jsx("span",{className:"machine-card__seen",children:S?"在线":e.lastSeen?`最后在线 ${K9(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(L,{name:"file",size:12})," 编辑"]}),a.jsxs("button",{type:"button",className:"machine-card__action-btn",onClick:()=>void w(),disabled:u,title:"查看该机器的接入指令(Key + 启动命令)",children:[a.jsx(L,{name:"link",size:12})," 查看指令"]}),a.jsxs("button",{type:"button",className:"machine-card__action-btn",onClick:()=>void v(),disabled:u,title:"重新生成密钥(旧密钥失效)",children:[a.jsx(L,{name:"refresh",size:12})," 重生成密钥"]}),a.jsx("button",{type:"button",className:"machine-card__revoke",onClick:y,children:"撤销"})]}),f&&a.jsx(Nm,{ownerToken:f,machineName:e.name,title:`「${j}」接入指令`,onClose:()=>h(null)}),p&&a.jsx(Nm,{machineKey:p,machineName:j,title:`「${j}」新密钥已生成`,onClose:()=>g(null)})]})}function MT(){const[e,t]=_.useState([]),[n,r]=_.useState(!0),[s,i]=_.useState(""),[o,l]=_.useState(!1),[c,u]=_.useState(null);async function d(){r(!0),i("");try{const w=await ly();t(w)}catch(w){i(w instanceof Error?w.message:String(w))}finally{r(!1)}}_.useEffect(()=>{d()},[]);async function f(){l(!0);try{const w=await RT();u(w)}catch(w){window.alert("获取接入指令失败:"+(w instanceof Error?w.message:String(w)))}finally{l(!1)}}async function h(w){try{await $9(w),t(v=>v.filter(y=>y.machineId!==w))}catch(v){window.alert("撤销失败:"+(v instanceof Error?v.message:String(v)))}}function p(w,v){t(y=>y.map(m=>m.machineId===w?{...m,...v}: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 g=e.filter(w=>w.status==="online"||w.lastSeen),x=g.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:["已接入 ",g.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(L,{name:"refresh",size:14}),"刷新"]}),a.jsxs("button",{type:"button",className:"primary machine-list__add",onClick:()=>void f(),disabled:o,children:[a.jsx(L,{name:"plus",size:14}),o?"获取中...":"添加引擎"]})]})]}),c&&a.jsx(Nm,{ownerToken:c,title:"添加执行引擎",onClose:()=>u(null)}),g.length===0&&!c?a.jsx("div",{className:"machine-list__empty",children:"暂无已接入的执行引擎。点击「添加引擎」获取自注册接入指令,在目标机器上执行 daemon 启动命令(填入机器名);接入成功后点「刷新」即可看到。"}):a.jsx("div",{className:"machine-list__grid",children:g.map(w=>a.jsx(Y9,{machine:w,onRevoke:h,onUpdated:p},w.machineId))})]})}const X9={admin:"管理员",user:"普通用户"};function Q9(e){try{return new Date(e).toLocaleDateString("zh-CN",{year:"numeric",month:"long",day:"numeric"})}catch{return e}}function Z9(){var u,d,f;const e=Nk(),[t,n]=_.useState(null),[r,s]=_.useState(!0);_.useEffect(()=>{(async()=>{try{const h=await L9();n(h)}catch{}finally{s(!1)}})()},[]);const i=(t==null?void 0:t.username)??((u=e.user)==null?void 0:u.username)??"---",o=(t==null?void 0:t.role)??((d=e.user)==null?void 0:d.role)??"user",l=(t==null?void 0:t.createdAt)??null,c=(t==null?void 0:t.avatarUrl)||((f=e.user)==null?void 0:f.avatarUrl)||"";return a.jsx($d,{children: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(ze,{className:"account-back-btn",to:"/",title:"返回首页",children:[a.jsx(L,{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:c?a.jsx("img",{className:"account-card__avatar-img",src:c,alt:""}):a.jsx(L,{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:X9[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:Q9(l)})]})]})})]}),a.jsxs("section",{className:"account-section",children:[a.jsx("h3",{className:"account-section__title",children:"执行引擎管理"}),a.jsx(MT,{})]})]})})]})})})}function J9(){return a.jsx($d,{children: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(ze,{className:"account-back-btn",to:"/",title:"返回首页",children:[a.jsx(L,{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(MT,{})})})})]})})})}function eK(e,t){return uk(e,t)}function Em(e,t){return e.questions.filter(n=>eK(n,t))}const hh={required:()=>"此项必填",max_selections:e=>`最多选 ${e.maxSelections} 项`};function tK(e,t){var s;const n=new Map(e.questions.map(i=>[i.id,i])),r={};for(const i of i$(e,t)){const o=n.get(i.questionId);r[i.questionId]=o?((s=hh[i.code])==null?void 0:s.call(hh,o))??i.message:i.message}return r}function nK(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 cy(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:nK(t.options)}))}}function rK(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 eb(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 tb(e,t){return rK(e,t)}function Cm(e,t){const n=[`[表单答复 · ${e.title}]`];for(const r of Em(e,t)){const s=t[r.id];let i;Array.isArray(s)?i=s.length>0?s.map(o=>tb(r,o)).join("、"):"(跳过)":typeof s=="string"&&s.trim().length>0?i=tb(r,s.trim()):typeof s=="boolean"?i=s?"是":"否":i="(跳过)",n.push(`· ${r.label}:${i}`)}return n.join(`
|
|
95
|
-
`)}let sK=0;const wt=e=>`${e}_${(sK++).toString(36)}`,as=e=>new Promise(t=>setTimeout(t,e));class uy{constructor(){ue(this,"state",{messages:[],busy:!1,pendingForm:null,formTransitioning:!1});ue(this,"listeners",new Set);ue(this,"formResolver",null);ue(this,"currentAssistantId",null);ue(this,"currentTextId",null);ue(this,"agentTextMsgId",null);ue(this,"agentTextSegId",null);ue(this,"agentThinkingMsgId",null);ue(this,"agentThinkingSegId",null);ue(this,"animQueue",[]);ue(this,"consuming",!1);ue(this,"activeTasks",0);ue(this,"onFormSubmit",null);ue(this,"subscribe",t=>(this.listeners.add(t),()=>this.listeners.delete(t)));ue(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=wt("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:wt("u"),role:"user",segments:[{kind:"text",id:wt("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=wt("tool");this.resetAgentStream(),this.addSegment({kind:"tool",id:s,tool:{id:wt("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 as(Math.min(t,6));return}await as(t)}}async step(t){var n;switch(t.kind){case"wait":await as(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:wt("td"),text:s,status:i===0?"active":"pending"}));this.addSegment({kind:"todo",id:wt("todo"),items:r}),await as(240);return}case"todo-advance":this.advanceTodo(),await as(300);return;case"tool":{this.resetAgentStream();const r=this.ensureAssistant(),s=wt("tool"),i={id:wt("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=wt("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=wt("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=wt("athink");this.agentThinkingMsgId=n,this.agentThinkingSegId=r,this.addSegment({kind:"agent-thinking",id:r,text:t})}async streamText(t){const n=this.ensureAssistant(),r=wt("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 as(12)}this.patchSegment(n,r,i=>i.kind==="text"?{...i,text:t}:i),await as(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(Cm(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 OT(e){return _.useSyncExternalStore(e.subscribe,e.getState,e.getState)}function LT({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(L,{name:"check",size:14}),a.jsx("span",{children:"执行清单"}),a.jsxs("span",{className:"todo-card__count",children:[t,"/",e.length]})]}),a.jsx(Ze.ul,{className:"todo-card__list",variants:RE,initial:"hidden",animate:"visible",children:e.map(n=>a.jsxs(Ze.li,{className:`todo-item is-${n.status}`,variants:Ct,children:[a.jsx("span",{className:"todo-item__mark",children:n.status==="done"?a.jsx(L,{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 iK({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(L,{name:"warn",size:14}):a.jsx(L,{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 $T=_.forwardRef(function({form:t,interactive:n,submittedAnswers:r,hideInternalSubmit:s=!1,onReadyChange:i,onSubmit:o},l){const c=_.useMemo(()=>lK(t,r),[t,r]),[u,d]=_.useState(c),[f,h]=_.useState({}),[p,g]=_.useState({}),x=!n||!o||r!==void 0,w=r??u;_.useEffect(()=>{d(I=>{let z=!1;const T={...I};for(const E of t.questions)T[E.id]===void 0&&(z=!0,T[E.id]=E.defaultValue!==void 0?Tm(E,E.defaultValue):DT(E));return z?T:I})},[t]);function v(I,z){x||(h(T=>T[I]?T:{...T,[I]:!0}),d(T=>({...T,[I]:z})))}function y(I,z,T){x||(h(E=>E[I]?E:{...E,[I]:!0}),d(E=>{const P=Array.isArray(E[I])?E[I]:[],C=P.includes(z);if(!C&&T!==void 0&&P.length>=T)return E;const R=C?P.filter(M=>M!==z):[...P,z];return{...E,[I]:R}}))}function m(I){x||(g(z=>({...z,[I]:!0})),h(z=>z[I]?z:{...z,[I]:!0}),d(z=>({...z,[I]:""})))}function b(I,z){x||(g(T=>T[I]?{...T,[I]:!1}:T),v(I,z))}function j(I,z){if(x)return;h(P=>P[I.id]?P:{...P,[I.id]:!0});const T=new Set((I.options??[]).map(P=>P.value)),E=z.split(/[,,]/).map(P=>P.trim()).filter(Boolean);d(P=>{const C=Array.isArray(P[I.id])?P[I.id]:[];return{...P,[I.id]:[...C.filter(R=>T.has(R)),...E]}})}const S=Em(t,w),k=tK(t,w),N=Object.keys(k).length===0;function A(I){const z={};for(const T of Em(t,I)){const E=I[T.id];E!==void 0&&(z[T.id]=E)}return z}function O(){if(x||!o||!N)return;const I=A(u);o(Cm(t,I),I)}function D(){x||!o||o(Cm(t,{}),{})}return _.useImperativeHandle(l,()=>({submit:O,skipAll:D})),_.useEffect(()=>{i==null||i(!x&&N)},[i,x,N]),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:S.map(I=>{const z=w[I.id],T=f[I.id]?k[I.id]:void 0;return a.jsxs("div",{className:`qf-field${T?" 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,T?a.jsx("div",{className:"qf-error",children:T}):null,I.type==="radio"&&I.options?a.jsxs("div",{className:"qf-choices",role:"radiogroup",children:[I.options.map(E=>a.jsxs("label",{className:`qf-choice${z===E.value?" is-on":""}${x?" is-disabled":""}`,title:E.description,children:[a.jsx("input",{type:"radio",name:`${t.id}-${I.id}`,checked:!oc(I,z,p)&&z===E.value,disabled:x,onChange:()=>b(I.id,E.value)}),a.jsx(ph,{option:E})]},E.value)),Uc(I)?a.jsxs("label",{className:`qf-choice${oc(I,z,p)?" is-on":""}${x?" is-disabled":""}`,children:[a.jsx("input",{type:"radio",name:`${t.id}-${I.id}`,checked:oc(I,z,p),disabled:x,onChange:()=>m(I.id)}),a.jsx(ph,{option:{label:"其他 — 我自己说",value:oK}})]}):null,Uc(I)&&oc(I,z,p)?a.jsx("input",{type:"text",className:"qf-input",value:typeof z=="string"?z:"",placeholder:I.placeholder??"按你的想法写,不用挑上面的选项",disabled:x,onChange:E=>v(I.id,E.target.value)}):null]}):null,I.type==="checkbox"&&I.options?a.jsxs("div",{className:"qf-choices",children:[I.options.map(E=>{const P=Array.isArray(z)?z:[],C=P.includes(E.value),R=I.maxSelections!==void 0&&!C&&P.length>=I.maxSelections;return a.jsxs("label",{title:E.description,className:`qf-choice${C?" is-on":""}${R||x?" is-disabled":""}`,children:[a.jsx("input",{type:"checkbox",checked:C,disabled:x||R,onChange:()=>y(I.id,E.value,I.maxSelections)}),a.jsx(ph,{option:E})]},E.value)}),Uc(I)?a.jsx("input",{type:"text",className:"qf-input",value:aK(I,z).join(","),placeholder:"其他(多个用逗号分隔)",disabled:x,onChange:E=>j(I,E.target.value)}):null]}):null,I.type==="select"&&I.options?a.jsxs("select",{className:"qf-select",value:typeof z=="string"?z:"",disabled:x,onChange:E=>v(I.id,E.target.value),children:[a.jsx("option",{value:"",disabled:!0,children:I.placeholder??"请选择…"}),I.options.map(E=>a.jsx("option",{value:E.value,children:E.label},E.value))]}):null,I.type==="text"?a.jsx("input",{type:"text",className:"qf-input",value:typeof z=="string"?z:"",placeholder:I.placeholder,disabled:x,onChange:E=>v(I.id,E.target.value)}):null,I.type==="number"?a.jsx("input",{type:"number",className:"qf-input",value:typeof z=="string"?z:"",placeholder:I.placeholder,min:I.min,max:I.max,step:I.step,disabled:x,onChange:E=>v(I.id,E.target.value)}):null,I.type==="textarea"?a.jsx("textarea",{className:"qf-textarea",value:typeof z=="string"?z:"",placeholder:I.placeholder,rows:3,disabled:x,onChange:E=>v(I.id,E.target.value)}):null,I.type==="range"?a.jsxs("div",{className:"qf-range-wrap",children:[a.jsx("input",{type:"range",className:"qf-range",value:typeof z=="string"&&z.trim()?z:String(I.min??0),min:I.min,max:I.max,step:I.step,disabled:x,onChange:E=>v(I.id,E.target.value)}),a.jsx("output",{className:"qf-range-value",children:typeof z=="string"&&z.trim()?z:String(I.min??0)})]}):null,I.type==="color"?a.jsx("input",{type:"color",className:"qf-color",value:cK(z),disabled:x,onChange:E=>v(I.id,E.target.value)}):null,I.type==="switch"?a.jsxs("label",{className:"qf-switch",children:[a.jsx("input",{type:"checkbox",role:"switch",checked:z===!0||z==="true",disabled:x,onChange:E=>v(I.id,E.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:O,disabled:!N,children:t.submitLabel??"提交"})]})]})}),oK="__custom__";function Uc(e){return e.type!=="radio"&&e.type!=="checkbox"?!1:e.allowCustom!==!1}function oc(e,t,n){return!Uc(e)||e.type!=="radio"?!1:n[e.id]?!0:typeof t!="string"||t===""?!1:!(e.options??[]).some(r=>r.value===t)}function aK(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 ph({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 lK(e,t){const n={};for(const r of e.questions)t&&t[r.id]!==void 0?n[r.id]=Tm(r,t[r.id]):r.defaultValue!==void 0?n[r.id]=Tm(r,r.defaultValue):n[r.id]=DT(r);return n}function DT(e){return e.type==="checkbox"?[]:e.type==="switch"?!1:e.type==="range"?String(e.min??0):e.type==="color"?"#000000":""}function Tm(e,t){return typeof t=="boolean"?t:Array.isArray(t)?t.map(n=>eb(e,n)):eb(e,t)}function cK(e){return typeof e=="string"&&/^#[0-9a-fA-F]{6}$/.test(e)?e:"#000000"}function uK({msg:e}){if(e.role==="user"){const t=e.segments.map(n=>n.kind==="text"?n.text:"").join("");return a.jsx(Ze.div,{className:"msg msg--user",variants:Ct,initial:"hidden",animate:"visible",children:a.jsx("div",{className:"msg__bubble",children:t})})}return a.jsxs(Ze.div,{className:"msg msg--assistant",variants:Ct,initial:"hidden",animate:"visible",children:[a.jsx("div",{className:"msg__avatar","aria-hidden":!0,children:a.jsx(L,{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(dK,{text:t.text},t.id);case"todo":return a.jsx(LT,{items:t.items},t.id);case"tool":return a.jsx(iK,{tool:t.tool},t.id);case"form":return t.answers?a.jsx($T,{form:t.form,interactive:!1,submittedAnswers:t.answers},t.id):a.jsxs("div",{className:"msg__form-hint",children:[a.jsx(L,{name:"chevron-right",size:14}),"请在右侧「问题」面板作答"]},t.id)}})})]})}function dK({text:e}){return a.jsxs("details",{className:"think-block",children:[a.jsxs("summary",{className:"think-block__summary",children:[a.jsx(L,{name:"sparkle",size:12}),"思考过程"]}),a.jsx("div",{className:"think-block__body",children:e})]})}function fK({chat:e,placeholder:t,emptyHint:n,onSend:r,title:s,subtitle:i}){const{messages:o,busy:l}=OT(e),[c,u]=_.useState(""),d=_.useRef(null);_.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(na,{initial:!1,children:o.map(h=>a.jsx(uK,{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(L,{name:"send",size:16,color:"#fff"})})]}):null]})}const hK=280;function pK({form:e,formKey:t=null,interactive:n,submittedAnswers:r,onSubmit:s}){const i=_.useRef(null),[o,l]=_.useState(!1),c=(e==null?void 0:e.questions.length)??0,u=r!==void 0,[d,f]=_.useState(0);_.useEffect(()=>{f(u?c:0)},[t,u,c]),_.useEffect(()=>{if(u){f(c);return}if(d>=c)return;const y=window.setTimeout(()=>f(m=>Math.min(m+1,c)),hK);return()=>window.clearTimeout(y)},[u,c,d]);const h=d>=c,p=u?c:Math.min(d,c),g=e?{...e,questions:e.questions.slice(0,p)}:null,x=!u&&!h,w=!!e&&n&&!x,v=w&&o;return a.jsxs("div",{className:"questions-panel",children:[a.jsx("div",{className:"questions-panel-body",children:g?a.jsxs(a.Fragment,{children:[a.jsx($T,{ref:i,form:g,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:!v,onClick:()=>{var y;return(y=i.current)==null?void 0:y.submit()},children:"继续"})]})]})}const Xu=ct(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}=OT(t),h=V.layout,p=!s&&h.chatCollapsed;function g(w){w.preventDefault();const v=w.clientX,y=h.chatWidth,m=w.pointerId;w.currentTarget.setPointerCapture(m);function b(S){const k=Math.max(280,Math.min(720,y+S.clientX-v));V.setChatWidth(k)}function j(S){y+S.clientX-v<340&&V.setChatCollapsed(!0),window.removeEventListener("pointermove",b),window.removeEventListener("pointerup",j)}window.addEventListener("pointermove",b),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:()=>V.setChatCollapsed(!1),title:"展开对话","aria-label":"展开对话",children:a.jsx(mK,{})}):a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"split__chat",children:a.jsx(fK,{chat:t,onSend:i,title:o,subtitle:l,placeholder:c,emptyHint:u})}),!s&&a.jsx("button",{type:"button",className:"split-resizer",onPointerDown:g,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(pK,{form:d.form,formKey:d.segmentId,interactive:!0,onSubmit:(w,v)=>t.submitForm(v)})]}):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 mK(){return a.jsx("span",{"aria-hidden":!0,children:"›"})}function zT({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(L,{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(L,{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:["[",nb(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:["[",nb(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 nb(e){switch(e){case"project":return"项目";case"workflow":return"工作流";case"step":return"步骤";case"env":return"环境变量"}}const gK=[{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:"启动千问办公桌面应用后可作为候选执行引擎"}],vK=[{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:["发送状态"]}],FT=[{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"}],VT=[{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:"按入职日期查看事项"}],dy="ZQYprEoWoPLkorKyuBeBDRd9V1waOeDk",BT="1HixpC7",yK="epHNF75";function UT(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())}`}UT(dy,BT,yK);const xK=[{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"]}],_K=`# HR 入职协同 — 工作流模板
|
|
96
|
-
meta:
|
|
97
|
-
name: "HR 入职协同"
|
|
98
|
-
version: "1.0.0"
|
|
99
|
-
domain: hr_onboarding
|
|
100
|
-
|
|
101
|
-
steps:
|
|
102
|
-
- id: classify
|
|
103
|
-
name: "信息校验"
|
|
104
|
-
recipe: validate-onboarding
|
|
105
|
-
engine: llm_only
|
|
106
|
-
auto: true
|
|
107
|
-
input_mapping: { employee: 员工姓名, start_date: 入职日期 }
|
|
108
|
-
output_mapping: { result: 校验结论, issues: 异常项 }
|
|
109
|
-
|
|
110
|
-
- id: investigate
|
|
111
|
-
name: "权限准备"
|
|
112
|
-
recipe: prepare-access
|
|
113
|
-
engine: qoder
|
|
114
|
-
auto: true
|
|
115
|
-
output_mapping: { access: 权限清单 }
|
|
116
|
-
|
|
117
|
-
- id: draft_reply
|
|
118
|
-
name: "入职指引草拟"
|
|
119
|
-
recipe: draft-onboarding-guide
|
|
120
|
-
engine: llm_only
|
|
121
|
-
auto: true
|
|
122
|
-
output_mapping: { guide: 入职指引 }
|
|
123
|
-
|
|
124
|
-
- id: quality_check
|
|
125
|
-
name: "法务与 HR 复核"
|
|
126
|
-
recipe: hr-legal-review
|
|
127
|
-
engine: llm_only
|
|
128
|
-
auto: false # 人工审批节点
|
|
129
|
-
compliance: true
|
|
130
|
-
|
|
131
|
-
- id: send_reply
|
|
132
|
-
name: "发送入职通知"
|
|
133
|
-
recipe: send-onboarding-notice
|
|
134
|
-
engine: llm_only
|
|
135
|
-
auto: true
|
|
136
|
-
|
|
137
|
-
edges:
|
|
138
|
-
- { from: __start__, to: classify }
|
|
139
|
-
- { from: classify, to: investigate }
|
|
140
|
-
- { from: investigate, to: draft_reply }
|
|
141
|
-
- { from: draft_reply, to: quality_check }
|
|
142
|
-
- { from: quality_check, to: send_reply }
|
|
143
|
-
- { from: send_reply, to: __end__ }
|
|
144
|
-
`,wK=`# aitable-workflow.config.yml
|
|
145
|
-
name: "HR 入职协同"
|
|
146
|
-
agent:
|
|
147
|
-
engines: [claude, qoder]
|
|
148
|
-
table:
|
|
149
|
-
space: "人力协同"
|
|
150
|
-
base: "入职流程"
|
|
151
|
-
llm:
|
|
152
|
-
provider: dashscope
|
|
153
|
-
model: qwen-max
|
|
154
|
-
roles:
|
|
155
|
-
- HR 业务伙伴
|
|
156
|
-
- 法务顾问
|
|
157
|
-
sop: |
|
|
158
|
-
1. 入职通知需经 HR 确认后再发送
|
|
159
|
-
2. 合同、隐私或跨境事项需法务复核
|
|
160
|
-
`,bK={"validate-onboarding.recipe.ts":`/**
|
|
161
|
-
* Recipe: 信息校验 — 校验入职员工的基本信息与材料完整性
|
|
162
|
-
*/
|
|
163
|
-
import type { RecipeDefinition, RecipeContext, RecipeResult } from '../runtime/types';
|
|
164
|
-
|
|
165
|
-
const recipe: RecipeDefinition = {
|
|
166
|
-
meta: {
|
|
167
|
-
id: 'validate-onboarding',
|
|
168
|
-
name: '信息校验',
|
|
169
|
-
role: 'HR 业务伙伴',
|
|
170
|
-
engine: 'llm_only',
|
|
171
|
-
requiresAgent: false,
|
|
172
|
-
timeoutMs: 60_000,
|
|
173
|
-
},
|
|
174
|
-
inputs: [
|
|
175
|
-
{ name: 'employee', type: 'string', required: true },
|
|
176
|
-
{ name: 'id_number', type: 'string', required: true },
|
|
177
|
-
{ name: 'start_date', type: 'string', required: true },
|
|
178
|
-
],
|
|
179
|
-
outputs: [
|
|
180
|
-
{ name: 'result', type: 'string' },
|
|
181
|
-
{ name: 'issues', type: 'string' },
|
|
182
|
-
],
|
|
183
|
-
|
|
184
|
-
async execute(ctx: RecipeContext): Promise<RecipeResult> {
|
|
185
|
-
const { employee, id_number, start_date } = ctx.input;
|
|
186
|
-
ctx.log(\`校验入职信息: \${employee}\`);
|
|
187
|
-
const result = await ctx.toolkit.ai.chatJSON(
|
|
188
|
-
\`你是 HR 信息校验专员。请核对以下入职员工信息是否完整且合规。
|
|
189
|
-
员工姓名: \${employee}
|
|
190
|
-
身份证号: \${id_number}
|
|
191
|
-
入职日期: \${start_date}
|
|
192
|
-
检查项: 身份信息/学历证明/体检报告/劳动合同/银行账户
|
|
193
|
-
输出: 校验结论(通过/需补充材料)、异常项列表\`,
|
|
194
|
-
{ type: 'object', properties: { result: {}, issues: {} } }
|
|
195
|
-
);
|
|
196
|
-
return { status: 'success', output: result };
|
|
197
|
-
},
|
|
198
|
-
};
|
|
199
|
-
|
|
200
|
-
export default recipe;
|
|
201
|
-
`,"prepare-access.recipe.ts":`/**
|
|
202
|
-
* Recipe: 权限准备 — 调用 coding agent 根据岗位自动开通系统权限
|
|
203
|
-
*/
|
|
204
|
-
import type { RecipeDefinition, RecipeContext, RecipeResult } from '../runtime/types';
|
|
205
|
-
|
|
206
|
-
const recipe: RecipeDefinition = {
|
|
207
|
-
meta: {
|
|
208
|
-
id: 'prepare-access',
|
|
209
|
-
name: '权限准备',
|
|
210
|
-
role: 'HR 业务伙伴',
|
|
211
|
-
engine: 'qoder',
|
|
212
|
-
requiresAgent: true,
|
|
213
|
-
timeoutMs: 1_800_000,
|
|
214
|
-
},
|
|
215
|
-
inputs: [
|
|
216
|
-
{ name: 'employee', type: 'string', required: true },
|
|
217
|
-
{ name: 'department', type: 'string' },
|
|
218
|
-
{ name: 'position', type: 'string' },
|
|
219
|
-
{ name: 'result', type: 'string' },
|
|
220
|
-
],
|
|
221
|
-
outputs: [{ name: 'access', type: 'string' }],
|
|
222
|
-
|
|
223
|
-
async execute(ctx: RecipeContext): Promise<RecipeResult> {
|
|
224
|
-
ctx.log('根据岗位查询权限模板并开通…');
|
|
225
|
-
const template = await ctx.toolkit.kb.search(\`\${ctx.input.position} 权限模板\`);
|
|
226
|
-
const access = await ctx.toolkit.coding.run({
|
|
227
|
-
prompt: \`根据岗位「\${ctx.input.position}」和部门「\${ctx.input.department}」,生成权限开通清单。\\n员工: \${ctx.input.employee}\`,
|
|
228
|
-
context: template,
|
|
229
|
-
});
|
|
230
|
-
return { status: 'success', output: { access } };
|
|
231
|
-
},
|
|
232
|
-
};
|
|
233
|
-
|
|
234
|
-
export default recipe;
|
|
235
|
-
`,"draft-onboarding-guide.recipe.ts":`/**
|
|
236
|
-
* Recipe: 入职指引草拟 — 基于权限清单生成个性化入职指引文档
|
|
237
|
-
*/
|
|
238
|
-
import type { RecipeDefinition, RecipeContext, RecipeResult } from '../runtime/types';
|
|
239
|
-
|
|
240
|
-
const recipe: RecipeDefinition = {
|
|
241
|
-
meta: { id: 'draft-onboarding-guide', name: '入职指引草拟', engine: 'llm_only', timeoutMs: 60_000 },
|
|
242
|
-
inputs: [
|
|
243
|
-
{ name: 'employee', type: 'string' },
|
|
244
|
-
{ name: 'department', type: 'string' },
|
|
245
|
-
{ name: 'position', type: 'string' },
|
|
246
|
-
{ name: 'access', type: 'string' },
|
|
247
|
-
],
|
|
248
|
-
outputs: [{ name: 'guide', type: 'string' }],
|
|
249
|
-
|
|
250
|
-
async execute(ctx: RecipeContext): Promise<RecipeResult> {
|
|
251
|
-
const guide = await ctx.toolkit.ai.chat(
|
|
252
|
-
\`为新员工 \${ctx.input.employee}(\${ctx.input.department} · \${ctx.input.position})草拟入职指引。
|
|
253
|
-
包含: 报到流程、系统账号与权限说明、团队介绍、首周安排。
|
|
254
|
-
权限清单: \${ctx.input.access}\`
|
|
255
|
-
);
|
|
256
|
-
return { status: 'success', output: { guide } };
|
|
257
|
-
},
|
|
258
|
-
};
|
|
259
|
-
|
|
260
|
-
export default recipe;
|
|
261
|
-
`,"hr-legal-review.recipe.ts":`/**
|
|
262
|
-
* Recipe: 法务与 HR 复核 — 人工审批节点(auto: false)
|
|
263
|
-
* AI 先给出合规风险评估,等待法务或 HR 确认后放行
|
|
264
|
-
*/
|
|
265
|
-
import type { RecipeDefinition, RecipeContext, RecipeResult } from '../runtime/types';
|
|
266
|
-
|
|
267
|
-
const recipe: RecipeDefinition = {
|
|
268
|
-
meta: { id: 'hr-legal-review', name: '法务与 HR 复核', engine: 'llm_only', needsHuman: true },
|
|
269
|
-
inputs: [
|
|
270
|
-
{ name: 'guide', type: 'string' },
|
|
271
|
-
{ name: 'issues', type: 'string' },
|
|
272
|
-
],
|
|
273
|
-
outputs: [{ name: 'approved', type: 'boolean' }],
|
|
274
|
-
|
|
275
|
-
async execute(ctx: RecipeContext): Promise<RecipeResult> {
|
|
276
|
-
const review = await ctx.toolkit.ai.chatJSON(
|
|
277
|
-
\`审核入职指引和校验异常项,评估合规风险(0-1)并给出复核结论。
|
|
278
|
-
入职指引: \${ctx.input.guide}
|
|
279
|
-
异常项: \${ctx.input.issues ?? '无'}\`,
|
|
280
|
-
{ type: 'object', properties: { risk_score: {}, conclusion: {}, advice: {} } }
|
|
281
|
-
);
|
|
282
|
-
ctx.log(\`合规风险评分: \${review.risk_score},等待法务/HR 审批\`);
|
|
283
|
-
return { status: 'pending_human', output: review };
|
|
284
|
-
},
|
|
285
|
-
};
|
|
286
|
-
|
|
287
|
-
export default recipe;
|
|
288
|
-
`,"send-onboarding-notice.recipe.ts":`/**
|
|
289
|
-
* Recipe: 发送入职通知 — 通过 IM 通道把审核通过的入职指引发给新员工
|
|
290
|
-
*/
|
|
291
|
-
import type { RecipeDefinition, RecipeContext, RecipeResult } from '../runtime/types';
|
|
292
|
-
|
|
293
|
-
const recipe: RecipeDefinition = {
|
|
294
|
-
meta: { id: 'send-onboarding-notice', name: '发送入职通知', engine: 'llm_only' },
|
|
295
|
-
inputs: [
|
|
296
|
-
{ name: 'employee', type: 'string' },
|
|
297
|
-
{ name: 'guide', type: 'string' },
|
|
298
|
-
{ name: 'conclusion', type: 'string' },
|
|
299
|
-
],
|
|
300
|
-
outputs: [{ name: 'sent', type: 'boolean' }],
|
|
301
|
-
|
|
302
|
-
async execute(ctx: RecipeContext): Promise<RecipeResult> {
|
|
303
|
-
await ctx.toolkit.messaging.send({ to: ctx.input.employee, text: ctx.input.guide });
|
|
304
|
-
ctx.log('入职通知已发送至新员工');
|
|
305
|
-
return { status: 'success', output: { sent: true } };
|
|
306
|
-
},
|
|
307
|
-
};
|
|
308
|
-
|
|
309
|
-
export default recipe;
|
|
310
|
-
`},jK={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"},SK=[{title:"张三入职办理",customer:"张三 · 产品研发部",category:"入职办理",priority:"P0-紧急"},{title:"李四合同确认",customer:"李四 · 市场营销部",category:"合同确认",priority:"P2-中"},{title:"王五设备申领",customer:"王五 · 数据分析部",category:"设备申领",priority:"P1-高"},{title:"赵六权限开通",customer:"赵六 · 财务部",category:"权限开通",priority:"P1-高"}];function kK(){return ge?null:{workflowYml:_K,configYml:wK,recipeFiles:bK,stepToRecipeFile:jK}}function HT(){return ge?null:{steps:vK,incomingTickets:SK}}function mh(){return ge?null:{fieldCount:FT.length,viewCount:VT.length}}function WT(){return ge?[]:gK}const NK=[{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 EK(){let e=new Map;try{const t=await _$();e=new Map(t.available.map(n=>[n.type,{version:n.version,cmd:n.cmd}]))}catch{}return NK.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 CK(){return ge?[]:xK}function TK(){return ge?"":dy}function PK(){return ge?null:{fields:FT,views:VT,tableBaseId:dy,tableSheetId:BT}}const AK=WT();function KT(e){return cy({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 RK=KT(AK),IK=cy({id:"init-table",title:"连接 AI 表格",description:"填写目标 Base Id;每个工作流的数据表由 setup 阶段在该 Base 下自动创建。",submitLabel:"连接",questions:[{id:"baseId",label:"Base Id",type:"text",required:!0,placeholder:"如:ZQYprEoWoPLkorKyuBeBDRd9V1waOeDk",defaultValue:TK(),help:"AI 表格所在多维表格(Base)的节点 Id。"}]});cy({id:"init-sop",title:"补充 SOP 指引",description:"SOP 不是越长越好,建议写清楚触发条件、处理步骤、人工把关点、异常升级规则。",submitLabel:"完成配置",questions:[{id:"sop",label:"用户 SOP / 处理规则",type:"textarea",placeholder:`建议格式:
|
|
311
|
-
1. 什么时候触发流程?
|
|
312
|
-
2. 每一步输入什么、产出什么?
|
|
313
|
-
3. 哪些情况必须人工审核?
|
|
314
|
-
4. 超时、失败、风险命中时通知谁?
|
|
315
|
-
5. 哪些话术、动作或自动化行为必须避免?`,help:"可以先写要点,不需要一次写完;后续 design 阶段会再基于场景做澄清。"}]});const ac=CK(),Pm=[{kind:"say",text:"欢迎!我们先做一次性配置,之后就能反复复用。第一步:扫描本地可用的执行引擎。"},{kind:"tool",label:"扫描本地执行引擎",detail:"Claude Code · Qoder · Codex",ms:900},{kind:"form",form:RK},{kind:"say",text:"引擎已就绪。接下来连接你的 AI 表格 —— 这是工作流读写数据的地方。"},{kind:"form",form:IK},{kind:"tool",label:"校验表格连接",detail:"connected",ms:800},{kind:"say",text:ac.length>0?"表格已连接。接下来先构建角色。右侧已预置 HR 业务伙伴和法务顾问,你可以直接编辑人设、技能与共享知识库;确认角色后再补充 SOP。":"表格已连接。接下来构建角色。请在右侧添加角色并定义人设与共享知识库。参考示例:HR 业务伙伴、法务顾问。"},{kind:"do",run:()=>{if(ac.length===0)return;const e=V.initDraft.roles,t=e.some(n=>n.name.includes("客服")||n.name.includes("排查")||n.name.includes("质检"));V.patchInitDraft({roles:e.length&&!t?e:ac})}},{kind:"say",text:ac.length>0?"角色已预置。请在右侧同一个界面里确认角色人设、技能、知识库,并按需补充 SOP;准备好后点击进入设计阶段。":"准备好后点击「下一步:设计 →」进入设计阶段。"}];function MK(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:KT(e)},...Pm.slice(3)]}function OK({roles:e,onChange:t}){var p;const[n,r]=_.useState(((p=e[0])==null?void 0:p.id)??null),s=_.useRef(null),[i,o]=_.useState(null);function l(g,x){t(e.map(w=>w.id===g?{...w,...x}:w))}function c(){const g=`role_${Date.now().toString(36)}`,x={id:g,name:"",persona:"",skills:[],knowledge:[]};t([...e,x]),r(g)}function u(g){t(e.filter(x=>x.id!==g)),n===g&&r(null)}function d(g,x){const w=e.find(v=>v.id===g);w&&l(g,{knowledge:w.knowledge.filter(v=>v!==x)})}function f(g){var x;o(g),(x=s.current)==null||x.click()}function h(g){if(!i||!g.target.files)return;const x=e.find(v=>v.id===i);if(!x)return;const w=new Set(x.knowledge);for(const v of Array.from(g.target.files)){const y=v.webkitRelativePath.split("/");y.length>=1&&w.add(y[0])}l(i,{knowledge:Array.from(w)}),o(null),g.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(g=>{const x=n===g.id;return a.jsxs(Ze.div,{className:`role-item${x?" is-open":""}`,variants:Ct,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:g.id),children:[a.jsx(L,{name:x?"chevron-down":"chevron-right",size:14}),a.jsx("span",{className:"role-item__avatar",children:a.jsx(L,{name:"user",size:13})}),a.jsx("input",{className:"role-item__name",value:g.name,onClick:w=>w.stopPropagation(),onChange:w=>l(g.id,{name:w.target.value}),placeholder:"角色名称"})]}),a.jsxs("span",{className:"role-item__summary",children:[g.knowledge.length," 知识库"]}),a.jsx("button",{type:"button",className:"role-item__remove",title:"删除角色",onClick:()=>u(g.id),children:a.jsx(L,{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:g.persona,placeholder:"描述角色定位、职责与语气…",onChange:w=>l(g.id,{persona:w.target.value})})]}),a.jsxs("div",{className:"role-field",children:[a.jsx("label",{className:"role-field__label",children:"共享知识库"}),g.knowledge.length>0&&a.jsx("div",{className:"kb-folder-list",children:g.knowledge.map(w=>a.jsxs("span",{className:"kb-folder-chip",children:[a.jsx(L,{name:"file",size:12}),w,a.jsx("button",{type:"button",className:"kb-folder-chip__remove",onClick:()=>d(g.id,w),children:a.jsx(L,{name:"close",size:10})})]},w))}),a.jsxs("button",{type:"button",className:"kb-folder-pick",onClick:()=>f(g.id),children:[a.jsx(L,{name:"plus",size:14}),"选择本地文件夹"]})]})]})]},g.id)}),a.jsxs("button",{type:"button",className:"role-add",onClick:c,children:[a.jsx(L,{name:"plus",size:14})," 添加角色"]})]})}function qT(e,t){switch(t){case"init":return LK(e);case"design":return GT(e);case"setup":return $K(e);case"adjust":return DK();case"test":return zK();default:return{ok:!0,missing:[],warnings:[]}}}function LK(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 GT(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 $K(e){const t=[],n=[];return Ls("setup",e.stageRuntime.setup.phase)||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 DK(e){return{ok:!1,missing:[{code:"ADJUST_NOT_COMPLETE",scope:"project",target:"adjust",label:"参数调整尚未完成",locate:{stage:"adjust",panel:"adjust"}}],warnings:[]}}function zK(e){return{ok:!1,missing:[{code:"TEST_NOT_PASSED",scope:"project",target:"test",label:"试运行尚未通过",locate:{stage:"test",panel:"test"}}],warnings:[]}}async function FK(e,t){const n=GT(t),r=await v$(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 VK={claude:"Claude",qoder:"Qoder",codex:"Codex",qwenwork:"千问办公",llm:"LLM"},Am={claudecode:"Claude",codex:"Codex",qoder:"Qoder",codebuddy:"Codebuddy",opencode:"OpenCode",qwen:"Qwen",deepseek:"DeepSeek",trae:"Trae",qwenwork:"千问办公"};function BK(e){return e.some(t=>/(^|\/)workflow\.ya?ml$/i.test(t.path.replace(/\\/g,"/")))}function UK(e){return e==="claudecode"?"claude":e==="codex"?"codex":e==="qoder"?"qoder":e==="qwenwork"?"qwenwork":null}function lc({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(L,{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(L,{name:"check",size:12})," 已配置"]}):"待配置"})]}),a.jsx("div",{className:"cfg-card__body",children:s})]})}function HK({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(ze,{className:"engine-empty__link",to:"/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(ze,{className:"engine-empty__link",to:"/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(UK).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=>Am[d]??d).join(" · "),c.hasDws&&" · dws ✓"]})]}),t===c.machineId&&a.jsx(L,{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 WK=ct(function(){const t=Sr(),n=_.useRef();n.current||(n.current=new uy);const r=n.current,s=_.useRef(!1),i=V.initDraft;V.mode;const o=V.projectId,[l,c]=_.useState(!1),[u,d]=_.useState(!1),f=Ls("init",V.stageRuntime.init.phase),[h,p]=_.useState([]),[g,x]=_.useState(it),[w,v]=_.useState(!1),[y,m]=_.useState(WT()),b=_.useCallback(async()=>{x(!0);try{const P=await ly();p(P),v(!1)}catch{v(!0)}finally{x(!1)}},[]);_.useEffect(()=>{it&&b()},[b]);const j=h.find(P=>P.machineId===i.selectedMachineId&&P.status==="online"),S=it&&!g&&!!i.selectedMachineId&&!j,k=it?!g&&!!j&&i.agentsSelected.length>0:!0;_.useEffect(()=>{if(r.onFormSubmit=(P,C)=>{P==="init-agents"?V.patchInitDraft({agentsSelected:C.agents??[]}):P==="init-table"?V.patchInitDraft({tableConnected:!0,tableBaseId:String(C.baseId??"")}):P==="init-sop"&&V.patchInitDraft({sop:String(C.sop??"")})},!s.current){s.current=!0;const P=Ls("init",V.stageRuntime.init.phase);ge&&P?r.run([{kind:"say",text:"配置已完成,可直接进入设计阶段。"}]):it?r.run([{kind:"say",text:"请在右侧选择执行引擎,然后继续完成后续配置。"}]):ge?(async()=>{const C=await EK();m(C),await r.run(MK(C))})():r.run(Pm)}return()=>{r.onFormSubmit=null}},[r]);const N=_.useRef("");_.useEffect(()=>{if(!it||!k||!j||N.current===j.machineId)return;N.current=j.machineId;const P=Pm.slice(3),C=`${j.displayName||j.name}(${j.runtimes.map(R=>Am[R]??R).join(" · ")}${j.hasDws?" · dws ✓":""})`;r.run([{kind:"say",text:`✅ 执行引擎已选定:${C}
|
|
316
|
-
|
|
317
|
-
接下来配置 AI 表格、模型服务、角色和 SOP。`},...P])},[k,j,r]);const A=i.agentsSelected.length>0,O=ge?k&&A&&i.roles.length>0:i.roles.length>0,[D,I]=_.useState(null);function z(P,C){V.patchInitDraft({selectedMachineId:P,agentsSelected:C});const R=V.projectId;R&&pk(R,P)}async function T(){const P=qT(V.validationContext,"init");if(V.setValidation("init",P),!P.ok){I(P);return}if(d(!0),ge){c(!0);try{await hk();let C=o;C||(await r.run([{kind:"tool",label:"创建真实项目工作区",detail:".sandbox/projects",ms:360}]),C=(await Kg()).id),await r.run([{kind:"tool",label:"写入真实配置",detail:"config / roles / recipes",ms:420}]);const R={...V.initDraft,machineId:V.initDraft.selectedMachineId||void 0},M=await b$(C,R);V.setProjects(Ma(V.projects,M.project)),await Eu(M.project.id),await r.run([{kind:"say",text:M.warnings.length?`真实配置已生成。注意:${M.warnings[0]}`:"真实配置已生成:config、coding agent 配置和 roles 都已落盘。"}])}catch(C){await r.run([{kind:"say",text:`真实 init 失败:${C instanceof Error?C.message:String(C)}`}]),c(!1),d(!1);return}c(!1)}t(BK(V.projectFiles)?"../setup":"../design")}const E=u?a.jsx("div",{className:"work-body",style:{padding:16},children:a.jsx("div",{className:"empty-hint",children:ge?"正在写入真实配置并准备进入设计阶段…":"正在进入设计阶段…"})}):a.jsxs("div",{className:"work-body",style:{padding:16},children:[a.jsxs("div",{className:"cfg-grid",children:[it&&a.jsx(lc,{icon:"bolt",title:"执行引擎",done:k,children:k&&j?a.jsxs("div",{className:"engine-selected",children:[a.jsx("span",{className:"machine-status machine-status--online"}),a.jsx("span",{children:j.displayName||j.name}),a.jsx("span",{className:"cfg-muted",style:{marginLeft:8},children:j.runtimes.map(P=>Am[P]??P).join(" · ")}),a.jsx("button",{type:"button",className:"engine-change-btn",onClick:()=>{V.patchInitDraft({selectedMachineId:"",agentsSelected:[]}),N.current=""},children:"更换"})]}):a.jsxs(a.Fragment,{children:[S&&a.jsx("div",{className:"engine-empty",children:a.jsxs("div",{className:"engine-empty__text",children:["⚠️ 此前绑定的执行引擎当前不可用(已离线或被移除),请重新选择或前往",a.jsx(ze,{className:"engine-empty__link",to:"/engines",children:"执行引擎管理"}),"。"]})}),a.jsx(HK,{machines:h,selectedId:i.selectedMachineId,onSelect:z,loading:g,error:w,onRetry:()=>void b()})]})}),!it&&a.jsx(lc,{icon:"robot",title:"Agent 引擎",done:A,children:A?a.jsx("div",{className:"agent-chips",children:i.agentsSelected.map(P=>a.jsxs("span",{className:"agent-chip",style:{"--c":`var(--agent-${P})`},children:[a.jsx("span",{className:"agent-chip__dot"}),VK[P]]},P))}):a.jsxs("span",{className:"cfg-muted",children:["待扫描 · ",y.filter(P=>P.detected).length," 个已检测"]})}),a.jsx(lc,{icon:"user",title:"角色",done:i.roles.length>0,wide:!0,children:a.jsx(OK,{roles:i.roles,onChange:P=>V.patchInitDraft({roles:P})})}),a.jsx(lc,{icon:"file",title:"SOP 指引",done:!!i.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:i.sop,placeholder:`建议格式:
|
|
318
|
-
1. 什么时候触发流程?
|
|
319
|
-
2. 每一步输入什么、产出什么?
|
|
320
|
-
3. 哪些情况必须人工审核?
|
|
321
|
-
4. 超时、失败、风险命中时通知谁?
|
|
322
|
-
5. 哪些话术、动作或自动化行为必须避免?`,onChange:P=>V.patchInitDraft({sop:P.target.value})}),a.jsx("span",{className:"cfg-muted",children:"可以先写要点,不需要一次写完;Design 阶段会继续澄清。"})]})}),O||f?a.jsxs("div",{className:"cfg-cta",children:[a.jsxs("div",{className:"cfg-cta__text",children:[a.jsx(L,{name:"check",size:16}),"配置完成,可以进入设计阶段"]}),a.jsx("button",{type:"button",className:"primary cfg-cta__btn",onClick:()=>void T(),disabled:l,children:l?"写入配置中...":"下一步:设计 →"})]}):a.jsxs("div",{className:"cfg-cta cfg-cta--pending",children:[a.jsxs("div",{className:"cfg-cta__text cfg-cta__text--pending",children:[a.jsx(L,{name:"warn",size:16}),i.roles.length===0?"请至少添加一个角色后继续":"请完成上方配置后继续"]}),a.jsx("button",{type:"button",className:"primary cfg-cta__btn",disabled:!0,children:"下一步:设计 →"})]})]}),D&&!D.ok&&a.jsx(zT,{title:"无法进入设计阶段",missing:D.missing,warnings:D.warnings,onClose:()=>I(null),onLocate:P=>{I(null)}})]});return a.jsx(Xu,{chat:r,chatTitle:"一次性配置向导",chatSubtitle:`${it?"执行引擎 · ":""}角色 · SOP · ${ge?"真实模式":"演示模式"}`,work:E})}),rb={claudecode:"Claude",codex:"Codex",qoder:"Qoder"};function KK({projectId:e}){var w,v,y;const[t,n]=_.useState(null),[r,s]=_.useState(!1),[i,o]=_.useState([]),[l,c]=_.useState(!1);if(_.useEffect(()=>{!it||!e||Pc(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=((v=t.machine)==null?void 0:v.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 b=setInterval(async()=>{m++;try{const j=await Pc(e);j.status==="online"?(clearInterval(b),n(j),c(!1)):m>=12&&(clearInterval(b),c(!1))}catch{m>=12&&(clearInterval(b),c(!1))}},5e3)}async function g(){try{const m=await ly();o(m.filter(b=>b.status==="online"))}catch{}s(!0)}async function x(m){e&&(await pk(e,m),n(await Pc(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=>rb[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 g(),children:"切换引擎"}),a.jsx(ze,{className:"engine-bar__action",to:"/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(b=>rb[b]??b).join(" · ")})]},m.machineId)),a.jsx("button",{type:"button",className:"engine-switch-dialog__cancel",onClick:()=>s(!1),children:"取消"})]})})]})}class YT{constructor(t,n){ue(this,"lastFilesSummary","");ue(this,"lastPhase",null);ue(this,"round");this.chat=t,this.projectId=n}isCurrent(){return V.projectId===this.projectId}async narrate(t){if(this.isCurrent())switch(t.type){case"stage.changed":await this.narratePhase(t.stageState.state);return;case"error":await this.chat.run([{kind:"say",text:`真实设计中断:${t.error.message}。已保留当前生成文件,右侧可查看并继续重试。`}]);return;case"design.agent_event":{const n=ck(t.event,this.round);if(n&&V.appendAgentTrace(n),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 r=lk({toolName:t.event.toolName,toolInput:t.event.toolInput,projectId:this.projectId});this.chat.enqueue([{kind:"tool",label:r.label,detail:r.detail,ms:80}])}return}case"design.files":{const n=XK(t.files);if(n===this.lastFilesSummary)return;this.lastFilesSummary=n,await this.chat.run([{kind:"tool",label:"同步生成文件",detail:n,ms:80}]);return}default:return}}async narratePhase(t){if(t.phase===this.lastPhase&&t.phase!=="generating")return;const n=this.lastPhase;switch(this.lastPhase=t.phase,t.phase){case"clarify_probing":await this.chat.run([{kind:"tool",label:"Agent 判读需求",detail:this.projectId,ms:80}]);return;case"clarify_awaiting":await this.chat.run([{kind:"say",text:"请先确认需求澄清卡片,再开始生成。"}]);return;case"clarify_failed":await this.chat.run([{kind:"say",text:`${t.error.message}。可以重新开始需求澄清。`}]);return;case"precheck":await this.chat.run([{kind:"tool",label:"形成需求摘要",detail:YK(t.confirmed.summary),ms:120}]);return;case"generating":t.round===1&&n!=="generating"&&V.clearAgentTrace(),this.round=t.round,await this.chat.run([{kind:"tool",label:t.isFix?"完善流程方案":"生成流程方案",detail:`第 ${t.round} 轮 · 真实 Agent 执行中`,ms:100}]);return;case"validating":await this.chat.run([{kind:"tool",label:"校验流程方案",detail:t.errors.length===0?"通过":`${t.errors.length} 个问题`,ms:100}]);return;case"syncing_schema":await this.chat.run([{kind:"tool",label:"同步字段与视图计划",detail:"写回配置",ms:80}]);return;case"ready":V.appendAgentTrace({kind:"status",text:"",boundary:!0}),await this.chat.run([{kind:"say",text:`真实工作流已生成:${V.steps.length} 个步骤;实际执行 ${t.rounds} 轮,收到 ${V.live.designAgentEvents} 个 Agent 事件。右侧画布和配置面板已切换为真实产物。`}]);return;case"generate_failed":V.appendAgentTrace({kind:"status",text:"",boundary:!0}),await this.chat.run([{kind:"say",text:`${t.error.message}。已保留当前生成文件,右侧可以先查看文件内容,再重试生成。`}]);return}}}async function qK(e,t,n){if(V.projectId!==t)return;const r=d$(n);if(r&&V.appendAgentTrace(r),n.type==="error"){await e.run([{kind:"say",text:`真实 setup 失败:${n.error.message}`}]);return}if(n.type!=="stage.changed")return;const s=n.stageState.state;switch(s.phase){case"preflight":await e.run([{kind:"say",text:"正在加载配置与工作流模板"}]);return;case"provisioning_table":await e.run([{kind:"todo-advance"},{kind:"say",text:"正在创建 AI 表格"}]);return;case"syncing_schema":await e.run([{kind:"todo-advance"},{kind:"say",text:"正在创建字段和视图"}]);return;case"auth_awaiting":await e.run([{kind:"say",text:s.error.message}]);return;case"failed":await e.run([{kind:"say",text:`真实 setup 失败:${s.error.message}`}]);return;case"ready":await e.run([{kind:"todo-advance"},{kind:"todo-advance"},{kind:"say",text:`真实 setup 已完成,AI 表格链接已生成,Table Id 已写回:${s.tableId}。`}]);return}}function GK(e,t){if(V.projectId!==e)return;t.type==="run.step.started"&&V.clearAgentTrace();const n=f$(t);n&&V.appendAgentTrace(n)}function YK(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 Wg(r,96)}function XK(e){return e.filter(n=>!n.path.endsWith("project.json")).map(n=>{var r;return((r=Cd(n.path))==null?void 0:r.name)??n.path.split("/").pop()??n.path}).join(" · ")}async function QK(e,t){const n=new YT(e,t);await e.run([{kind:"say",text:"我会调用真实设计服务,先理解你的 SOP 与角色配置,再生成可落地的工作流方案。主要耗时在真实 Agent 生成阶段。"}]);const r=e.beginTask("真实 Agent 生成工作流",t);try{await k$(t,async s=>{V.applyDesignEvent(t,s)&&(s.type==="design.files"&&await QT(t,s.files),s.type==="error"&&await gh(t),s.type==="stage.changed"&&s.stageState.state.phase==="ready"&&await nq(t),s.type==="stage.changed"&&s.stageState.state.phase==="generate_failed"&&await gh(t),await n.narrate(s))}),r(V.stageRuntime.design.phase==="ready"?"done":"error")}catch(s){r("error");const i=s instanceof Error?s.message:String(s);if(V.projectId!==t)return;V.patchLive(t,{designLiveText:`真实设计请求失败:${i}`}),await gh(t),await e.run([{kind:"say",text:`真实设计请求失败:${i}。已保留当前生成文件,右侧可查看并重新进入设计。`}])}}async function ZK(e,t){const n=new YT(e,t),r=await N$(t).catch(()=>null);if(!(!r||r.events.length===0)){for(const s of r.events)if(s.type!=="stage.changed"){if(V.projectId!==t)return;await n.narrate(s)}}}async function JK(e,t){await e.run([{kind:"say",text:"开始搭建真实 AI 表格结构。该步骤会通过 dws 对目标 AI 表格产生真实字段/视图变更。"},{kind:"todo",items:["加载配置","读取 workflow","创建字段与视图","生成 AI 表格链接"]}]),await E$(t,async n=>{V.applySetupEvent(t,n)&&(n.type==="stage.changed"&&n.stageState.state.phase==="ready"&&"tableId"in n.stageState.state&&V.patchInitDraft({tableConnected:!0,tableBaseId:n.stageState.state.baseId,tableId:n.stageState.state.tableId}),await qK(e,t,n))})}async function eq(e,t){if(V.projectId!==e)return;(await C$(e,async r=>{V.applyRunEvent(e,r)&&GK(e,r)},t)).mode==="relay"&&await XT(e,t)}const tq=3e3;async function XT(e,t){var s;let n=0,r=!1;for(;!((s=t==null?void 0:t.signal)!=null&&s.aborted)&&V.projectId===e;){try{const[i,o,l]=await Promise.all([P$(e),A$(e),R$(e,{afterSeq:n}).catch(u=>(r||(r=!0,V.appendRunPollError(e,`运行事件时间线拉取失败:${u instanceof Error?u.message:String(u)}`)),null))]);if(V.projectId!==e)return;const c=i.schedule??null;if(await V.refreshProjectState(e),V.applyRunRecords(e,o.items),l){r=!1,n=l.lastSeq;for(const u of l.events)V.appendRunTimelineEntry(e,u)}if(c&&c.desiredState==="stopped"&&!c.machineId)return}catch(i){V.appendRunPollError(e,i instanceof Error?i.message:String(i))}await new Promise(i=>setTimeout(i,tq))}}async function nq(e){const t=await Mk(e,V.currentWorkflowId).catch(()=>null);t&&V.projectId===e&&t.currentWorkflowId&&(V.setWorkflows(t.workflows),V.setCurrentWorkflow(t.currentWorkflowId,t.workflowFiles));const n=V.currentWorkflowId,[r,s]=await Promise.all([Td(e,n).catch(()=>null),Yg(e).catch(()=>null)]);s&&V.applyServerFiles(e,s),r&&V.applyServerWorkflow(e,r)}async function gh(e){try{const t=await Yg(e);if(!V.applyServerFiles(e,t))return;await QT(e,t)}catch{}}async function QT(e,t){if(t.some(n=>n.path==="workflow.yml"||n.path.endsWith("/workflow.yml")))try{const n=await Td(e,V.currentWorkflowId);V.applyServerWorkflow(e,n)}catch{}}function fy(e,t){const n=V.stream,r=V.projectId,s=n==null?void 0:n.stage,i=(n==null?void 0:n.endpoint)??null;_.useEffect(()=>{V.mode!=="live"||!r||s!==e||Zd(e,r,t)},[t,r,e,s,i])}const Ri=new Map,Xa=new Map;function Zd(e,t,n,r){const s=`${e}:${t}`,i=Ri.get(s);if(i)return i;const o=new AbortController;Xa.set(s,o);const l=(async()=>{var c;try{e==="run"?await eq(t,{signal:o.signal,runMode:r}):e==="design"?await QK(n,t):await JK(n,t)}finally{Ri.delete(s),Xa.delete(s),V.projectId===t&&((c=V.stream)==null?void 0:c.stage)===e&&await Wi(t)}})();return Ri.set(s,l),l}function rq(e){const t=`run:${e}`,n=Ri.get(t);if(n)return n;const r=new AbortController;Xa.set(t,r);const s=(async()=>{try{await XT(e,{signal:r.signal})}finally{Ri.delete(t),Xa.delete(t)}})();return Ri.set(t,s),s}function sb(e,t){var n;(n=Xa.get(`${e}:${t}`))==null||n.abort()}function ib(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 sq(e){if(Array.isArray(e))return e}function iq(e,t,n){return(t=fq(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function oq(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 aq(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
323
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ob(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 ab(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?ob(Object(n),!0).forEach(function(r){iq(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ob(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function lq(e,t){if(e==null)return{};var n,r,s=cq(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 cq(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 uq(e,t){return sq(e)||oq(e,t)||hq(e,t)||aq()}function dq(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 fq(e){var t=dq(e,"string");return typeof t=="symbol"?t:t+""}function hq(e,t){if(e){if(typeof e=="string")return ib(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)?ib(e,t):void 0}}function pq(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function lb(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 cb(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?lb(Object(n),!0).forEach(function(r){pq(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):lb(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function mq(){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 Ho(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 Qu(e){return{}.toString.call(e).includes("Object")}function gq(e){return!Object.keys(e).length}function Qa(e){return typeof e=="function"}function vq(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function yq(e,t){return Qu(t)||Kr("changeType"),Object.keys(t).some(function(n){return!vq(e,n)})&&Kr("changeField"),t}function xq(e){Qa(e)||Kr("selectorType")}function _q(e){Qa(e)||Qu(e)||Kr("handlerType"),Qu(e)&&Object.values(e).some(function(t){return!Qa(t)})&&Kr("handlersType")}function wq(e){e||Kr("initialIsRequired"),Qu(e)||Kr("initialType"),gq(e)&&Kr("initialContent")}function bq(e,t){throw new Error(e[t]||e.default)}var jq={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"},Kr=Ho(bq)(jq),cc={changes:yq,selector:xq,handler:_q,initial:wq};function Sq(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};cc.initial(e),cc.handler(t);var n={current:e},r=Ho(Eq)(n,t),s=Ho(Nq)(n),i=Ho(cc.changes)(e),o=Ho(kq)(n);function l(){var u=arguments.length>0&&arguments[0]!==void 0?arguments[0]:function(d){return d};return cc.selector(u),u(n.current)}function c(u){mq(r,s,i,o)(u)}return[l,c]}function kq(e,t){return Qa(t)?t(e.current):t}function Nq(e,t){return e.current=cb(cb({},e.current),t),t}function Eq(e,t,n){return Qa(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 Cq={create:Sq},Tq={paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.55.1/min/vs"}};function Pq(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 Aq(e){return{}.toString.call(e).includes("Object")}function Rq(e){return e||ub("configIsRequired"),Aq(e)||ub("configType"),e.urls?(Iq(),{paths:{vs:e.urls.monacoBase}}):e}function Iq(){console.warn(ZT.deprecation)}function Mq(e,t){throw new Error(e[t]||e.default)}var ZT={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!
|
|
324
|
-
You are using deprecated way of configuration.
|
|
325
|
-
|
|
326
|
-
Instead of using
|
|
327
|
-
monaco.config({ urls: { monacoBase: '...' } })
|
|
328
|
-
use
|
|
329
|
-
monaco.config({ paths: { vs: '...' } })
|
|
330
|
-
|
|
331
|
-
For more please check the link https://github.com/suren-atoyan/monaco-loader#config
|
|
332
|
-
`},ub=Pq(Mq)(ZT),Oq={config:Rq},Lq=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 JT(e,t){return Object.keys(t).forEach(function(n){t[n]instanceof Object&&e[n]&&Object.assign(t[n],JT(e[n],t[n]))}),ab(ab({},e),t)}var $q={type:"cancelation",msg:"operation is manually canceled"};function vh(e){var t=!1,n=new Promise(function(r,s){e.then(function(i){return t?s($q):r(i)}),e.catch(s)});return n.cancel=function(){return t=!0},n}var Dq=["monaco"],zq=Cq.create({config:Tq,isInitialized:!1,resolve:null,reject:null,monaco:null}),eP=uq(zq,2),bl=eP[0],Jd=eP[1];function Fq(e){var t=Oq.config(e),n=t.monaco,r=lq(t,Dq);Jd(function(s){return{config:JT(s.config,r),monaco:n}})}function Vq(){var e=bl(function(t){var n=t.monaco,r=t.isInitialized,s=t.resolve;return{monaco:n,isInitialized:r,resolve:s}});if(!e.isInitialized){if(Jd({isInitialized:!0}),e.monaco)return e.resolve(e.monaco),vh(yh);if(window.monaco&&window.monaco.editor)return tP(window.monaco),e.resolve(window.monaco),vh(yh);Lq(Bq,Hq)(Wq)}return vh(yh)}function Bq(e){return document.body.appendChild(e)}function Uq(e){var t=document.createElement("script");return e&&(t.src=e),t}function Hq(e){var t=bl(function(r){var s=r.config,i=r.reject;return{config:s,reject:i}}),n=Uq("".concat(t.config.paths.vs,"/loader.js"));return n.onload=function(){return e()},n.onerror=t.reject,n}function Wq(){var e=bl(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;tP(r),e.resolve(r)},function(n){e.reject(n)})}function tP(e){bl().monaco||Jd({monaco:e})}function Kq(){return bl(function(e){var t=e.monaco;return t})}var yh=new Promise(function(e,t){return Jd({resolve:e,reject:t})}),nP={config:Fq,init:Vq,__getMonacoInstance:Kq},qq={wrapper:{display:"flex",position:"relative",textAlign:"initial"},fullWidth:{width:"100%"},hide:{display:"none"}},xh=qq,Gq={container:{display:"flex",height:"100%",width:"100%",justifyContent:"center",alignItems:"center"}},Yq=Gq;function Xq({children:e}){return or.createElement("div",{style:Yq.container},e)}var Qq=Xq,Zq=Qq;function Jq({width:e,height:t,isEditorReady:n,loading:r,_ref:s,className:i,wrapperProps:o}){return or.createElement("section",{style:{...xh.wrapper,width:e,height:t},...o},!n&&or.createElement(Zq,null,r),or.createElement("div",{ref:s,style:{...xh.fullWidth,...!n&&xh.hide},className:i}))}var eG=Jq,rP=_.memo(eG);function tG(e){_.useEffect(e,[])}var sP=tG;function nG(e,t,n=!0){let r=_.useRef(!0);_.useEffect(r.current||!n?()=>{r.current=!1}:e,t)}var jt=nG;function ca(){}function ji(e,t,n,r){return rG(e,r)||sG(e,t,n,r)}function rG(e,t){return e.editor.getModel(iP(e,t))}function sG(e,t,n,r){return e.editor.createModel(t,n,r?iP(e,r):void 0)}function iP(e,t){return e.Uri.parse(t)}function iG({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:g,wrapperProps:x={},beforeMount:w=ca,onMount:v=ca}){let[y,m]=_.useState(!1),[b,j]=_.useState(!0),S=_.useRef(null),k=_.useRef(null),N=_.useRef(null),A=_.useRef(v),O=_.useRef(w),D=_.useRef(!1);sP(()=>{let E=nP.init();return E.then(P=>(k.current=P)&&j(!1)).catch(P=>(P==null?void 0:P.type)!=="cancelation"&&console.error("Monaco initialization: error:",P)),()=>S.current?T():E.cancel()}),jt(()=>{if(S.current&&k.current){let E=S.current.getOriginalEditor(),P=ji(k.current,e||"",r||n||"text",i||"");P!==E.getModel()&&E.setModel(P)}},[i],y),jt(()=>{if(S.current&&k.current){let E=S.current.getModifiedEditor(),P=ji(k.current,t||"",s||n||"text",o||"");P!==E.getModel()&&E.setModel(P)}},[o],y),jt(()=>{let E=S.current.getModifiedEditor();E.getOption(k.current.editor.EditorOption.readOnly)?E.setValue(t||""):t!==E.getValue()&&(E.executeEdits("",[{range:E.getModel().getFullModelRange(),text:t||"",forceMoveMarkers:!0}]),E.pushUndoStop())},[t],y),jt(()=>{var E,P;(P=(E=S.current)==null?void 0:E.getModel())==null||P.original.setValue(e||"")},[e],y),jt(()=>{let{original:E,modified:P}=S.current.getModel();k.current.editor.setModelLanguage(E,r||n||"text"),k.current.editor.setModelLanguage(P,s||n||"text")},[n,r,s],y),jt(()=>{var E;(E=k.current)==null||E.editor.setTheme(u)},[u],y),jt(()=>{var E;(E=S.current)==null||E.updateOptions(f)},[f],y);let I=_.useCallback(()=>{var C;if(!k.current)return;O.current(k.current);let E=ji(k.current,e||"",r||n||"text",i||""),P=ji(k.current,t||"",s||n||"text",o||"");(C=S.current)==null||C.setModel({original:E,modified:P})},[n,t,s,e,r,i,o]),z=_.useCallback(()=>{var E;!D.current&&N.current&&(S.current=k.current.editor.createDiffEditor(N.current,{automaticLayout:!0,...f}),I(),(E=k.current)==null||E.editor.setTheme(u),m(!0),D.current=!0)},[f,u,I]);_.useEffect(()=>{y&&A.current(S.current,k.current)},[y]),_.useEffect(()=>{!b&&!y&&z()},[b,y,z]);function T(){var P,C,R,M;let E=(P=S.current)==null?void 0:P.getModel();l||((C=E==null?void 0:E.original)==null||C.dispose()),c||((R=E==null?void 0:E.modified)==null||R.dispose()),(M=S.current)==null||M.dispose()}return or.createElement(rP,{width:p,height:h,isEditorReady:y,loading:d,_ref:N,className:g,wrapperProps:x})}var oG=iG;_.memo(oG);function aG(e){let t=_.useRef();return _.useEffect(()=>{t.current=e},[e]),t.current}var lG=aG,uc=new Map;function cG({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:g="100%",className:x,wrapperProps:w={},beforeMount:v=ca,onMount:y=ca,onChange:m,onValidate:b=ca}){let[j,S]=_.useState(!1),[k,N]=_.useState(!0),A=_.useRef(null),O=_.useRef(null),D=_.useRef(null),I=_.useRef(y),z=_.useRef(v),T=_.useRef(),E=_.useRef(r),P=lG(i),C=_.useRef(!1),R=_.useRef(!1);sP(()=>{let $=nP.init();return $.then(F=>(A.current=F)&&N(!1)).catch(F=>(F==null?void 0:F.type)!=="cancelation"&&console.error("Monaco initialization: error:",F)),()=>O.current?B():$.cancel()}),jt(()=>{var F,H,W,U;let $=ji(A.current,e||r||"",t||s||"",i||n||"");$!==((F=O.current)==null?void 0:F.getModel())&&(f&&uc.set(P,(H=O.current)==null?void 0:H.saveViewState()),(W=O.current)==null||W.setModel($),f&&((U=O.current)==null||U.restoreViewState(uc.get(i))))},[i],j),jt(()=>{var $;($=O.current)==null||$.updateOptions(u)},[u],j),jt(()=>{!O.current||r===void 0||(O.current.getOption(A.current.editor.EditorOption.readOnly)?O.current.setValue(r):r!==O.current.getValue()&&(R.current=!0,O.current.executeEdits("",[{range:O.current.getModel().getFullModelRange(),text:r,forceMoveMarkers:!0}]),O.current.pushUndoStop(),R.current=!1))},[r],j),jt(()=>{var F,H;let $=(F=O.current)==null?void 0:F.getModel();$&&s&&((H=A.current)==null||H.editor.setModelLanguage($,s))},[s],j),jt(()=>{var $;l!==void 0&&(($=O.current)==null||$.revealLine(l))},[l],j),jt(()=>{var $;($=A.current)==null||$.editor.setTheme(o)},[o],j);let M=_.useCallback(()=>{var $;if(!(!D.current||!A.current)&&!C.current){z.current(A.current);let F=i||n,H=ji(A.current,r||e||"",t||s||"",F||"");O.current=($=A.current)==null?void 0:$.editor.create(D.current,{model:H,automaticLayout:!0,...u},d),f&&O.current.restoreViewState(uc.get(F)),A.current.editor.setTheme(o),l!==void 0&&O.current.revealLine(l),S(!0),C.current=!0}},[e,t,n,r,s,i,u,d,f,o,l]);_.useEffect(()=>{j&&I.current(O.current,A.current)},[j]),_.useEffect(()=>{!k&&!j&&M()},[k,j,M]),E.current=r,_.useEffect(()=>{var $,F;j&&m&&(($=T.current)==null||$.dispose(),T.current=(F=O.current)==null?void 0:F.onDidChangeModelContent(H=>{R.current||m(O.current.getValue(),H)}))},[j,m]),_.useEffect(()=>{if(j){let $=A.current.editor.onDidChangeMarkers(F=>{var W;let H=(W=O.current.getModel())==null?void 0:W.uri;if(H&&F.find(U=>U.path===H.path)){let U=A.current.editor.getModelMarkers({resource:H});b==null||b(U)}});return()=>{$==null||$.dispose()}}return()=>{}},[j,b]);function B(){var $,F;($=T.current)==null||$.dispose(),h?f&&uc.set(i,O.current.saveViewState()):(F=O.current.getModel())==null||F.dispose(),O.current.dispose()}return or.createElement(rP,{width:p,height:g,isEditorReady:j,loading:c,_ref:D,className:x,wrapperProps:w})}var uG=cG,dG=_.memo(uG),fG=dG;const hG={"workflow.yml":"流程编排","aitable-workflow.config.yml":"运行配置","config.yml":"运行配置","coding-agents.config.json":"执行引擎"},ir=kK(),db=ir?[{path:"workflow.yml",label:"workflow.yml",lang:"yaml",content:ir.workflowYml,summary:"流程编排"},{path:"config.yml",label:"config.yml",lang:"yaml",content:ir.configYml,summary:"运行配置"},...Object.entries(ir.recipeFiles).map(([e,t])=>({path:`recipes/${e}`,label:e,lang:"typescript",content:t,folder:"recipes",summary:"步骤脚本"}))]:[],pG=ir?Object.fromEntries(Object.entries(ir.stepToRecipeFile).map(([e,t])=>[`recipes/${t}`,e])):{},mG=ct(function({selectedStepId:t,onPickStep:n}){const r=V.theme,s=V.projectFiles,i=V.workflowFiles,o=V.steps,[l,c]=_.useState("workflow.yml"),[u,d]=_.useState(!1),f=i.length>0?i:s,h=_.useMemo(()=>f.length===0?db:f.map(m=>{const b=m.path.split("/").pop()??m.path;return{path:m.path,label:b,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/")?"步骤脚本":hG[b]??"项目文件"}}),[f]),p=_.useMemo(()=>f.length===0?(ir==null?void 0:ir.stepToRecipeFile)??{}:Object.fromEntries(o.filter(m=>m.recipe).map(m=>{var j;const b=(j=f.find(S=>S.path.endsWith(`${m.recipe}.recipe.ts`)))==null?void 0:j.path;return[m.id,(b==null?void 0:b.replace(/^recipes\//,""))??`${m.recipe}.recipe.ts`]})),[f,o]),g=_.useMemo(()=>f.length===0?pG:Object.fromEntries(Object.entries(p).map(([m,b])=>[b.startsWith("recipes/")?b:`recipes/${b}`,m])),[f.length,p]);_.useEffect(()=>{t&&p[t]&&c(`recipes/${p[t]}`)},[t,p]);const x=_.useMemo(()=>h.find(m=>m.path===l)??h[0]??db[0],[l,h]),w=h.filter(m=>!m.folder),v=h.filter(m=>m.folder==="recipes");function y(m){c(m),n(g[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(L,{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(L,{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(L,{name:"folder",size:13}),"步骤脚本 recipes"]}),v.map(m=>{const b=g[m.path],j=b&&b===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(L,{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(L,{name:"chevron-right",size:14})}),a.jsxs("div",{className:"code-editor",children:[a.jsxs("div",{className:"code-editor__head",children:[a.jsx(L,{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(fG,{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 gG({step:e,fields:t,values:n,onSave:r,onReset:s}){const[i,o]=_.useState({...n});function l(h,p){o(g=>({...g,[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 g=p.filter(x=>!x.isEnvRef);g.length>0&&d.set(h,g)}function f(){r(i)}return a.jsxs("div",{className:"step-config-form",children:[a.jsxs("div",{className:"step-config-form__head",children:[a.jsx(L,{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(g=>a.jsx(fb,{field:g,value:i[g.key]??"",onChange:x=>l(g.key,x)},g.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(fb,{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 fb({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 vG=ct(function(){const t=V.steps,n=V.edges,[r,s]=_.useState(null),[i,o]=_.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(L,{name:"flow",size:13}),"预览"]}),a.jsxs("button",{type:"button",className:`dw-tabs__tab${i==="code"?" is-active":""}`,onClick:()=>o("code"),children:[a.jsx(L,{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(NT,{steps:t,edges:n,selectedId:r,onSelect:s})}),l&&a.jsx(gG,{step:l,fields:c,values:{},onSave:u=>{console.log("保存配置",l.id,u)},onReset:()=>{}})]}):a.jsx("div",{className:"dw-code-view",children:a.jsx(mG,{selectedStepId:r,onPickStep:s})})]})}),Ro={discovery:"理解业务目标与 SOP",generate:"生成流程方案",validate:"校验配置完整性",render:"渲染真实画布与配置"};function yG({state:e,message: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(L,{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:t})]})]}),a.jsx(LT,{items:_G(e)})]})}const xG={clarify_probing:0,clarify_awaiting:0,clarify_failed:0,precheck:1,generating:1,validating:2,syncing_schema:3,ready:4,generate_failed:4};function _G(e){const t=xG[e.phase],n=e.phase==="generating"?`${Ro.generate}(第 ${e.round} 轮)`:Ro.generate;return[{id:"design-discovery",text:Ro.discovery,status:dc(0,t)},{id:"design-generate",text:n,status:dc(1,t)},{id:"design-validate",text:Ro.validate,status:dc(2,t)},{id:"design-render",text:Ro.render,status:dc(3,t)}]}function dc(e,t){return t>=4||e<t?"done":e===t?"active":"pending"}const wG={label:"交给设计 Agent 判读需求",detail:"缺口分析 / 决定是否提问"};function bG(e,t){switch(e.phase){case"clarify_probing":return{acts:[{kind:"say",text:"设计 Agent 正在判读你的 SOP、角色与表格信息,看还缺什么——需要澄清就会问你,已经清楚就直接开始生成。这一步可能要一两分钟,停在本页等即可。"}],pin:wG};case"clarify_awaiting":return{acts:[{kind:"say",text:"请确认以下设计约束,确认后我会继续生成工作流方案。"},{kind:"form",form:{...e.form,submitLabel:t.submitLabel}}]};case"precheck":return{acts:[{kind:"say",text:e.confirmed.summary}]};case"generating":case"validating":case"syncing_schema":return{acts:[]};case"ready":return{acts:t.resumed?[{kind:"say",text:`已恢复当前流程 ${t.projectId} 的设计产物,不会重复启动生成任务。右侧可继续查看流程与配置。`}]:[]};case"clarify_failed":case"generate_failed":return{acts:[{kind:"say",text:`${e.error.message}。请重新生成 Design,系统会保留当前可查看的文件。`}]}}}function jG(e){return e?e.phase==="clarify_awaiting"?`clarify_awaiting:${e.form.id}`:e.phase:"none"}const SG="正在连接设计 Agent…",_h=new Map;async function kG(e,t){const n=_h.get(e);if(n)return n;const r=(async()=>{let s=!1;const i=j$(e).catch(async o=>{const l=o instanceof Error?o.message:String(o);await t.run([{kind:"say",text:`需求澄清准备失败:${l}`}])}).finally(()=>{s=!0});for(;!s;){const o=await Wi(e);if(o!=null&&o.stages.design)break;await new Promise(l=>setTimeout(l,500))}await i,await Wi(e)})().finally(()=>{_h.delete(e)});return _h.set(e,r),r}const NG=ct(function(){var E,P;const t=Sr(),n=_.useRef();n.current||(n.current=new uy);const r=n.current,s=_.useRef(null),i=_.useRef(null),[o,l]=_.useState(null),c=V.projectId,u=V.mode,d=V.steps,f=V.projectFiles,h=Sk({snapshot:V.snapshot,live:V.live,mode:u}),p=h.state,g=h.runtime,x=h.agentEvents,w=p!==null,v=jG(p),y=((E=g.next)==null?void 0:E.kind)==="await_user"?g.next.action.label:"确认并开始设计";fy("design",r);const m=_.useRef(null),b=((P=V.stream)==null?void 0:P.stage)==="design";_.useEffect(()=>{u!=="live"||!c||b||!w||m.current===c||i.current!==null||(m.current=c,ZK(r,c))},[r,u,c,b,w]);async function j(){const C=u==="live"&&c?await FK(c,V.validationContext):qT(V.validationContext,"design");if(V.setValidation("design",C),!C.ok){l(C);return}t("../setup")}function S(){u!=="live"||!c||(V.patchLive(c,{designLiveText:"重新连接真实设计服务",designAgentEvents:0}),Zd("design",c,r))}_.useEffect(()=>(r.onFormSubmit=(C,R)=>{u!=="live"||!c||(p==null?void 0:p.phase)!=="clarify_awaiting"||C===p.form.id&&(async()=>{try{const{stageState:M}=await S$(c,R);V.applyDesignEvent(c,{type:"stage.changed",stage:"design",stageState:M})}catch(M){await r.run([{kind:"say",text:`确认需求失败:${M instanceof Error?M.message:String(M)}`}])}})()},()=>{r.onFormSubmit=null}),[r,u,c,v]),_.useEffect(()=>{u!=="live"||!c||w||kG(c,r)},[r,u,c,w]),_.useEffect(()=>{if(u!=="live")return;const C=c?v:"no-project";if(i.current===C)return;const R=i.current===null;if(i.current=C,!c){r.run([{kind:"say",text:"缺少真实项目工作区,请先返回 Init 阶段完成真实配置。"}]);return}const M=s.current;if(M&&(M(p&&s_(p)?"error":"done"),s.current=null),!p)return;const B=bG(p,{projectId:c,submitLabel:y,resumed:R});let $=!1;return(async()=>(B.acts.length>0&&await r.run(B.acts),!($||!B.pin)&&(s.current=r.beginTask(B.pin.label,B.pin.detail))))(),()=>{$=!0}},[r,u,c,v]);const k=t$(p),N=s_(p),A=f.length>0,O=d.length>0||A,D=(p==null?void 0:p.phase)==="clarify_probing"||!w||!O,I=()=>{var C;return k&&p?a.jsx(yG,{state:p,message:g.message}):O?a.jsx(vG,{}):N?a.jsx("div",{className:"work-body",children:a.jsxs("div",{className:"empty-hint",children:[p.error.message,a.jsx("br",{}),a.jsxs("button",{type:"button",className:"primary",style:{marginTop:14},onClick:S,children:[a.jsx(L,{name:"refresh",size:14,color:"#fff"}),((C=g.next)==null?void 0:C.kind)==="await_user"?g.next.action.label:"重新生成工作流设计"]})]})}):a.jsx("div",{className:"work-body",children:a.jsx("div",{className:"empty-hint",children:"先确认需求澄清卡片,确认后将启动真实设计生成。"})})},z=a.jsxs(a.Fragment,{children:[ge&&a.jsx(KK,{projectId:c}),I(),o&&!o.ok&&a.jsx(zT,{title:"无法进入搭建阶段",missing:o.missing,warnings:o.warnings,onClose:()=>l(null),onLocate:C=>{l(null)}})]}),T=()=>u!=="live"?"演示模式不提供":(p==null?void 0:p.phase)==="ready"?`完成 ${p.rounds} 轮 · ${x} 个 Agent 事件`:(p==null?void 0:p.phase)==="generating"?`第 ${p.round} 轮进行中 · ${x} 个 Agent 事件`:(p==null?void 0:p.phase)==="clarify_awaiting"?"等待确认需求澄清":p?g.message:d.length?`${d.length} 步 · 真实方案`:A?`${f.length} 个文件 · 等待真实设计启动`:"真实生成待启动";return a.jsx(Xu,{chat:r,chatTitle:"工作流设计",chatSubtitle:`需求对齐 → 可视化编排 · ${u==="live"?"真实模式":"演示模式"}`,chatEmptyHint:SG,onSend:C=>{r.addUserMessage(C),r.run([{kind:"say",text:"收到,我会据此调整工作流细节。"}])},workHead:a.jsxs("div",{className:"work-head",children:[a.jsx(L,{name:"flow",size:16}),a.jsx("div",{className:"work-head__title",children:"工作流"}),a.jsx("div",{className:"work-head__sub",children:T()}),d.length>0&&a.jsxs("button",{type:"button",className:"primary work-head__cta",onClick:j,children:["进入搭建阶段",a.jsx(L,{name:"chevron-right",size:14,color:"#fff"})]}),N&&(d.length>0||A)&&a.jsxs("button",{type:"button",className:"primary work-head__cta",onClick:S,style:{marginLeft:8},children:[a.jsx(L,{name:"refresh",size:14,color:"#fff"}),"重新生成"]})]}),work:z,hideWork:D})}),hr=PK(),hy=(hr==null?void 0:hr.fields)??[],wh=(hr==null?void 0:hr.views)??[],hb=hy.filter(e=>e.group==="business"),pb=hy.filter(e=>e.group==="process");function mb(e){return[{kind:"do",run:()=>V.addMockField(e)},{kind:"wait",ms:130}]}function EG(e){return[{kind:"do",run:()=>V.addMockView(e)},{kind:"wait",ms:260}]}const CG=[{kind:"say",text:"开始搭建演示 AI 表格。我会依次创建字段、视图,并绑定事件源。"},{kind:"todo",items:["创建业务字段","创建流程字段","创建视图","绑定事件源 · 生成链接"]},{kind:"tool",label:"创建业务字段",detail:`${hb.length} 个`,ms:520},...hb.flatMap(mb),{kind:"todo-advance"},{kind:"tool",label:"创建流程字段",detail:`${pb.length} 个`,ms:520},...pb.flatMap(mb),{kind:"todo-advance"},{kind:"tool",label:"创建视图",detail:`${wh.length} 个`,ms:520},...wh.flatMap(EG),{kind:"todo-advance"},{kind:"tool",label:"绑定事件源 · 新记录触发",detail:"on_record_created",ms:760},{kind:"do",run:()=>{if(!hr)return;const e=V.initDraft,t=e.tableBaseId||hr.tableBaseId,n=e.tableId||hr.tableSheetId;V.setMockTableUrl(UT(t,n))}},{kind:"todo-advance"},{kind:"say",text:`搭建完成:${hy.length} 字段 · ${wh.length} 视图已就绪,事件源已绑定。可打开 AI 表格,或进入「运行」阶段启动工作流。`}];function gb(e){return e.isLive?String(e.current):`${e.current}/${e.mockTotal}`}const TG={grid:"表格",kanban:"看板",calendar:"日历",form:"表单",gantt:"甘特"},vb={text:"文本",single_select:"单选",user:"成员",datetime:"日期",number:"数字"},PG=ct(function(){var T,E,P;const t=_.useRef();t.current||(t.current=new uy);const n=t.current,r=_.useRef(!1),[s,i]=_.useState(!1),[o,l]=_.useState(""),[c,u]=_.useState(!1),d=V.mode,f=kk({snapshot:V.snapshot,mode:d,mockSetup:V.mockSetup}),h=f.schema.fields,p=f.schema.views,g=f.tableUrl,x=V.projectId,w=V.stageRuntime.setup,v=w.phase,y=v==="auth_awaiting",m=v==="failed",b=v==="ready",j=v==="preflight"||v==="provisioning_table"||v==="syncing_schema",S=d==="live",k=f.gate.kind==="open";fy("setup",n),_.useEffect(()=>{r.current||!k||(r.current=!0,n.run([{kind:"say",text:"工作流已就绪。准备好后点击右侧「开始搭建」,我会自动创建 AI 表格的字段与视图。"}]))},[n,k]),_.useEffect(()=>{(y||m||b)&&i(!1)},[y,m,b]);function N(){if(d==="live"&&!k){n.run([{kind:"say",text:"当前流程还没有完成设计,请先回到设计阶段生成 workflow 和 recipes。"}]);return}if(!(j||s&&!(y||m))){if(i(!0),d==="live"){x?Zd("setup",x,n).finally(()=>i(!1)):(i(!1),n.run([{kind:"say",text:"缺少真实项目工作区,请先返回 Init 阶段完成真实配置。"}]));return}n.run(CG).finally(()=>i(!1))}}const A=h.filter(C=>C.group==="business"),O=h.filter(C=>C.group==="process"),D=d==="live"?b:!!g||b,I=s||!!v||D;if(!k)return a.jsx(Xu,{chat:n,chatTitle:"AI 表格搭建",chatSubtitle:"创建字段 · 视图 · 绑定事件源",chatEmptyHint:"当前流程尚未到达搭建阶段",onSend:C=>{n.addUserMessage(C),n.run([{kind:"say",text:"当前流程还没有完成设计,请先回到设计阶段生成工作流。"}])},workHead:a.jsxs("div",{className:"work-head",children:[a.jsx(L,{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(L,{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(ze,{className:"primary setup-intro__cta",to:"../design",children:[a.jsx(L,{name:"chevron-right",size:15,color:"#fff"}),"返回设计阶段"]})]})})});const z=a.jsx("div",{className:"work-body setup-theater",children:I?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"setup-section",children:[a.jsxs("div",{className:"setup-section__head",children:[a.jsx(L,{name:y||m?"sparkle":"table",size:14}),y?"等待授权":m?"搭建失败":b?"搭建完成":"搭建进度"]}),a.jsx("p",{className:"setup-intro__desc",children:w.message}),(y||m)&&a.jsxs("button",{type:"button",className:"primary setup-intro__cta",onClick:N,children:[a.jsx(L,{name:"play",size:15,color:"#fff"}),((T=w.next)==null?void 0:T.kind)==="await_user"?w.next.action.label:"重试搭建"]})]}),D&&a.jsxs(Ze.div,{className:"table-link-card",variants:Ct,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(L,{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:g??"#",target:"_blank",rel:"noreferrer",children:[a.jsx(L,{name:"link",size:14,color:"#fff"}),"打开 AI 表格"]})]}),a.jsxs("div",{className:"setup-section",children:[a.jsxs("div",{className:"setup-section__head",children:[a.jsx(L,{name:"table",size:14}),"字段",a.jsx("span",{className:"setup-section__count",children:gb({current:h.length,mockTotal:((E=mh())==null?void 0:E.fieldCount)??0,isLive:S})})]}),A.length>0&&a.jsx("div",{className:"setup-group-label",children:"业务字段"}),a.jsx("div",{className:"field-grid",children:A.map(C=>a.jsxs(Ze.div,{className:"field-chip",variants:Ct,initial:"hidden",animate:"visible",children:[a.jsx("span",{className:"field-chip__name",children:C.name}),a.jsx("span",{className:"field-chip__type",children:vb[C.type]??C.type})]},C.id))}),O.length>0&&a.jsx("div",{className:"setup-group-label",children:"流程字段"}),a.jsx("div",{className:"field-grid",children:O.map(C=>a.jsxs(Ze.div,{className:"field-chip field-chip--process",variants:Ct,initial:"hidden",animate:"visible",children:[a.jsx("span",{className:"field-chip__name",children:C.name}),a.jsx("span",{className:"field-chip__type",children:vb[C.type]??C.type})]},C.id))})]}),p.length>0&&a.jsxs("div",{className:"setup-section",children:[a.jsxs("div",{className:"setup-section__head",children:[a.jsx(L,{name:"flow",size:14}),"视图",a.jsx("span",{className:"setup-section__count",children:gb({current:p.length,mockTotal:((P=mh())==null?void 0:P.viewCount)??0,isLive:S})})]}),a.jsx("div",{className:"view-grid",children:p.map(C=>a.jsxs(Ze.div,{className:"view-card",variants:Ct,initial:"hidden",animate:"visible",children:[a.jsx("span",{className:`view-card__kind view-card__kind--${C.kind}`,children:TG[C.kind]}),a.jsx("div",{className:"view-card__name",children:C.name}),a.jsx("div",{className:"view-card__desc",children:C.desc})]},C.id))})]}),D&&a.jsxs("div",{className:"cfg-cta",children:[a.jsxs("div",{className:"cfg-cta__text",children:[a.jsx(L,{name:"check",size:16}),"表格搭建完成,可进入试运行验证流程。"]}),a.jsxs(ze,{className:"primary",to:"../test",children:["进入试运行",a.jsx(L,{name:"chevron-right",size:15,color:"#fff"})]})]})]}):a.jsxs("div",{className:"setup-intro",children:[a.jsx("div",{className:"setup-intro__icon",children:a.jsx(L,{name:"table",size:30,color:"#fff"})}),a.jsx("h3",{className:"setup-intro__title",children:d==="live"?"搭建真实 AI 表格结构":"搭建演示 AI 表格结构"}),a.jsx("p",{className:"setup-intro__desc",children:d==="live"?"将根据真实工作流方案创建字段与视图,并绑定新记录触发方式。":(()=>{const C=mh();return`将创建 ${(C==null?void 0:C.fieldCount)??0} 个示例字段、${(C==null?void 0:C.viewCount)??0} 个示例视图,并绑定新记录触发方式。`})()}),a.jsxs("button",{type:"button",className:"primary setup-intro__cta",onClick:N,children:[a.jsx(L,{name:"play",size:15,color:"#fff"}),"开始搭建"]})]})});return a.jsx(Xu,{chat:n,chatTitle:"AI 表格搭建",chatSubtitle:"创建字段 · 视图 · 绑定事件源",chatEmptyHint:"agent 正在准备建表…",onSend:C=>{n.addUserMessage(C),n.run([{kind:"say",text:"好的,我会据此调整表结构。"}])},workHead:a.jsxs("div",{className:"work-head",children:[a.jsx(L,{name:"table",size:16}),a.jsx("div",{className:"work-head__title",children:"AI 表格"}),a.jsx("div",{className:"work-head__sub",children:D?"已就绪":y?"等待授权":m?"可重试":I?"搭建中":"待搭建"})]}),work:z})}),bh=e=>new Promise(t=>setTimeout(t,e));async function AG(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 bh(300),n!=null&&n.aborted||(t({type:"step-ai",stepIndex:r,step:s}),await bh(500),n!=null&&n.aborted)||(t({type:"step-done",stepIndex:r,step:s}),r<e.length-1&&(await bh(400),n!=null&&n.aborted)))return}t({type:"all-done",stepIndex:e.length-1})}const RG={info:"dot",ai:"sparkle",ok:"check",warn:"warn",error:"close"},IG=ct(function(){const t=V.steps,n=V.mode;V.projectId;const r=V.tableUrl,i=gD({snapshot:V.snapshot,mode:n}).gate.kind==="open",[o,l]=_.useState("guide"),[c,u]=_.useState([]),[d,f]=_.useState(-1),[h,p]=_.useState(null),g=_.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(L,{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(L,{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(ze,{className:"primary test-intro__cta",to:"../setup",children:[a.jsx(L,{name:"chevron-right",size:15,color:"#fff"}),"返回搭建阶段"]})]})})]})});async function x(){var v;l("running"),u([]),f(0),p(null),(v=g.current)==null||v.abort();const w=new AbortController;g.current=w,await AG(t,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(L,{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(ze,{className:"primary work-head__cta",to:"../run",children:["进入正式运行",a.jsx(L,{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(L,{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:r??"#",target:"_blank",rel:"noreferrer",children:[a.jsx(L,{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(L,{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(L,{name:"check",size:24,color:"#fff"})}),a.jsx("h3",{className:"test-result__title",children:"试运行通过"}),a.jsxs("p",{className:"test-result__desc",children:["全部 ",t.length," 个步骤执行成功。可以进入正式运行阶段。"]}),a.jsxs(ze,{className:"primary test-result__cta",to:"../run",children:["进入正式运行",a.jsx(L,{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(L,{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(ze,{className:"primary test-result__btn",to:"../design",children:"去修正该步骤配置 →"})]})]})]}),a.jsxs("div",{className:"test-flow",children:[a.jsx("div",{className:"test-flow__head",children:"步骤流转"}),a.jsx("div",{className:"step-chain",children:t.map((w,v)=>{const y=o==="success"||v<d?"done":v===d?"active":"pending";return a.jsxs("div",{className:`chain-node is-${y}`,children:[v>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(L,{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(L,{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(na,{initial:!1,children:c.map(w=>{var v;return a.jsxs(Ze.div,{layout:!0,variants:Ct,initial:"hidden",animate:"visible",className:`log-line log-line--${w.level}`,children:[a.jsx("span",{className:"log-line__icon",children:a.jsx(L,{name:RG[w.level],size:11})}),a.jsxs("div",{className:"log-line__content",children:[a.jsx("span",{className:"log-line__step",children:((v=t.find(y=>y.id===w.stepId))==null?void 0:v.name)??w.stepId}),a.jsx("span",{className:"log-line__text",children:w.text})]})]},w.id)})})})]})]})}),MG={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}」,工单关闭"}]},OG=[{level:"warn",text:"人工驳回,退回「草拟回复」重写"},{level:"ai",text:"参考驳回意见重新生成回复…"},{level:"ok",text:"新草稿已生成,再次送审"}],LG={classify:1400,investigate:2e3,draft_reply:1700,quality_check:0,send_reply:1400},$G=3200,DG=520;function zG(e,t){return e.replace("{title}",t.title).replace("{customer}",t.customer).replace("{category}",t.category).replace("{priority}",t.priority)}const Ii=HT(),FG=(Ii==null?void 0:Ii.steps)??[],jh=(Ii==null?void 0:Ii.incomingTickets)??[],Sh=e=>new Promise(t=>setTimeout(t,e));let VG=0;const yb=e=>`${e}_${(VG++).toString(36)}`;class BG{constructor(){ue(this,"state",{running:!1,arrived:0,total:jh.length});ue(this,"listeners",new Set);ue(this,"approvals",new Map);ue(this,"subscribe",t=>(this.listeners.add(t),()=>this.listeners.delete(t)));ue(this,"getState",()=>this.state)}emit(){this.listeners.forEach(t=>t())}set(t){this.state={...this.state,...t},this.emit()}log(t,n,r,s){V.appendLog({id:yb("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<jh.length;t++){if(!this.state.running)return;const n=jh[t],r={id:yb("tk"),title:n.title,customer:n.customer,category:n.category,priority:n.priority,status:"todo",currentStepId:null,doneStepIds:[],createdAt:Date.now()};V.addTicket(r),this.set({arrived:this.state.arrived+1}),this.process(r.id,n),await Sh($G)}}markDone(t,n){const r=V.live.tickets.find(s=>s.id===t);r&&V.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,zG(i.text,r)),await Sh(DG)}}async process(t,n){for(const r of FG){if(!this.state.running)return;const s=r.needsHuman?"review":"running";if(V.updateTicket(t,{currentStepId:r.id,status:s}),await this.streamLogs(t,r.id,n,MG[r.id]??[]),r.needsHuman){let i=!1;for(;!i&&this.state.running;)if(i=await this.awaitApproval(t),!i){V.updateTicket(t,{currentStepId:"draft_reply",status:"running"});const o=V.live.tickets.find(l=>l.id===t);o&&V.updateTicket(t,{doneStepIds:o.doneStepIds.filter(l=>l!=="draft_reply")}),await this.streamLogs(t,"draft_reply",n,OG),this.markDone(t,"draft_reply"),V.updateTicket(t,{currentStepId:r.id,status:"review"})}if(!this.state.running)return}else await Sh(LG[r.id]??1200);this.markDone(t,r.id)}V.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 UG(e){return _.useSyncExternalStore(e.subscribe,e.getState,e.getState)}function HG(e,t){return e.length===0?null:((t?e.find(r=>r.id===t):void 0)??e[e.length-1]).id}function WG(e,t){if(!e)return null;let n=null,r=null;const s=/\/i\/nodes\/([^/?#]+)/.exec(e);s&&(n=s[1]);const i=e.indexOf("?");if(i>=0){const o=new URLSearchParams(e.slice(i+1)),l=o.get("iframeQuery");l&&(r=new URLSearchParams(l).get("sheetId")),r||(r=o.get("sheetId"))}return!n||!r?null:{baseId:n,tableId:r,label:t}}const xb={todo:{label:"待处理",cls:"muted"},running:{label:"处理中",cls:"blue"},review:{label:"审核中",cls:"amber"},done:{label:"已完成",cls:"green"},blocked:{label:"受阻",cls:"red"}},_b={info:"dot",ai:"sparkle",ok:"check",warn:"warn",error:"close"};function wb(e,t){return e.doneStepIds.includes(t)?"done":e.currentStepId===t?"active":"pending"}const KG=ct(function(){const t=_.useRef();t.current||(t.current=new BG);const n=t.current,r=UG(n),s=V.mode,i=vD({snapshot:V.snapshot,live:V.live,mode:s}),o=i.tickets,l=i.logs,c=V.steps,u=V.projectId,d=V.stageRuntime.run,[f,h]=_.useState(null),[p,g]=_.useState(!1),[x,w]=_.useState(""),[v,y]=_.useState(!1),[m,b]=_.useState(null),[j,S]=_.useState(!0),k=s==="live",N=i.gate.kind==="open",A=HT(),O=k||c.length>0?c:(A==null?void 0:A.steps)??[],D=d.phase,I=D==="failed",z=D==="stopped",T=Ek(D),E=k?T||p:r.running,[P]=Og();_.useEffect(()=>{if(f)return;const U=HG(o,P.get("ticket"));U&&h(U)},[o,f,P]);const C=o.find(U=>U.id===f)??null,R=l.filter(U=>U.ticketId===f),M=_.useRef(null);_.useEffect(()=>{var U;(U=M.current)==null||U.scrollIntoView({behavior:"smooth",block:"end"})},[R.length]),fy("run"),_.useEffect(()=>{!k||!u||D!=="awaiting_machine"&&D!=="running_on_machine"||rq(u).catch(()=>{})},[k,u,D]),_.useEffect(()=>()=>{u&&sb("run",u)},[u]);const B=V.agentTraceLog.length,$={running:o.filter(U=>U.status==="running").length,review:o.filter(U=>U.status==="review").length,done:o.filter(U=>U.status==="done").length};function F(){if(k){if(!N)return;if(!u){V.appendLog(fc("缺少真实项目工作区,请先从配置阶段重新进入真实设计。"));return}if(O.length===0){V.appendLog(fc("当前流程没有可运行的真实 workflow,请先返回设计阶段重新生成。"));return}g(!0),V.patchLive(u,{tickets:[],logs:[]}),x&&V.appendLog({id:`run_mode_${Date.now().toString(36)}`,ts:Date.now(),ticketId:"run",stepId:"run",level:"info",text:`本次启动方式:${oP[x]}(覆盖部署默认)`}),Zd("run",u,void 0,x||void 0).catch(U=>V.appendLog(fc(U instanceof Error?U.message:String(U)))).finally(()=>g(!1));return}n.start()}async function H(){if(!(!u||v)){y(!0);try{sb("run",u),(await T$(u)).mode==="local"&&await Wi(u)}catch(U){V.appendLog(fc(U instanceof Error?U.message:String(U)))}finally{y(!1),g(!1)}}}async function W(U,q){if(!(!u||m)){b(q);try{await M$(u,U,q),await Wi(u)}catch(Q){const K=Q instanceof Error?Q.message:String(Q);V.appendLog({id:`human_action_${Date.now().toString(36)}`,ts:Date.now(),ticketId:U,stepId:(C==null?void 0:C.currentStepId)??"run",level:"error",text:K})}finally{b(null)}}}if(k&&N){const U=l.filter(Y=>Y.ticketId==="run"),q=C??o[0]??null,Q=q?l.filter(Y=>Y.ticketId===q.id):U,K=T?"blue":z?"green":I?"red":"muted",G=T?"监听中":I?"启动失败":z?"已停止":"待启动",te=WG(V.tableUrl,"当前数据表"),ne=!!te&&j;return a.jsxs("div",{className:`run-stage run-stage--live${ne?" has-table":""}`,children:[ne&&te&&a.jsxs("aside",{className:"run-table",children:[a.jsxs("div",{className:"run-table__head",children:[a.jsx("span",{children:"当前数据表"}),a.jsxs("button",{type:"button",className:"run-table__toggle",onClick:()=>S(!1),children:[a.jsx(L,{name:"close",size:13})," 收起"]})]}),a.jsx("div",{className:"run-table__frame",children:a.jsx(Qd,{ref_:te,placeholder:"表格地址解析失败,请回到搭建阶段确认已建表。"})})]}),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} 条`:G}),a.jsxs(ze,{className:"run-board__agents-link",to:"../agents",title:"管理智能体登记表",children:[a.jsx(L,{name:"robot",size:12})," 智能体"]}),te&&!j&&a.jsxs("button",{type:"button",className:"run-board__table-toggle",onClick:()=>S(!0),title:"在左侧内嵌当前表",children:[a.jsx(L,{name:"table",size:12})," 显示表格"]})]}),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--${K}`,children:G}),a.jsx("span",{className:"ticket-card__prio",children:d.phase??"run"})]}),a.jsx("div",{className:"ticket-card__title",children:"真实 AI 表格监听"}),a.jsx("div",{className:"ticket-card__meta",children:d.message}),a.jsxs("div",{className:"ticket-card__progress",children:[O.length," 个步骤 · ",U.length," 条服务日志"]})]}):o.map(Y=>{const J=xb[Y.status];return a.jsxs("button",{type:"button",className:`ticket-card${Y.id===(q==null?void 0:q.id)?" is-selected":""}`,onClick:()=>h(Y.id),children:[a.jsxs("div",{className:"ticket-card__top",children:[a.jsx("span",{className:`pill pill--${J.cls}`,children:J.label}),a.jsx("span",{className:"ticket-card__prio",children:Y.priority})]}),a.jsx("div",{className:"ticket-card__title",children:Y.title}),a.jsxs("div",{className:"ticket-card__meta",children:[Y.customer," · ",Y.category]}),a.jsxs("div",{className:"ticket-card__progress",children:[Y.doneStepIds.length,"/",O.length," 步",Y.status==="review"&&a.jsx("span",{className:"ticket-card__await",children:"待人工"})]})]},Y.id)})}),a.jsxs("div",{className:"run-board__foot",children:[a.jsx(bb,{value:x,disabled:E,onChange:w}),a.jsxs("button",{type:"button",className:"primary run-live-start",onClick:F,disabled:E,children:[a.jsx(L,{name:"play",size:15,color:"#fff"}),I?"重试运行":E?"运行中":"启动运行"]}),E&&a.jsxs("button",{type:"button",className:"ghost run-live-stop",onClick:H,disabled:v,children:[a.jsx(L,{name:"close",size:13}),v?"停止中…":"停止运行"]})]})]}),a.jsxs("div",{className:"run-flow",children:[a.jsxs("div",{className:"run-flow__head",children:[a.jsx("div",{className:"run-flow__title",children:q?q.title:"当前 workflow"}),a.jsx("div",{className:"run-flow__sub",children:q?`${q.customer} · ${q.status}`:`${O.length} 个真实步骤 · ${d.message}`}),a.jsxs("button",{type:"button",className:`run-flow__trace${V.agentTraceOpen?" is-active":""}`,onClick:()=>V.toggleAgentTrace(),title:"查看 Agent 逐轮执行过程(思考 / 工具调用 / 工具返回)",children:[a.jsx(L,{name:"bolt",size:12}),B>0?`执行过程 · ${B}`:"执行过程",T&&a.jsx("span",{className:"run-flow__trace-dot","aria-hidden":!0})]})]}),a.jsx("div",{className:"step-chain",children:O.map((Y,J)=>{const se=!!q&&q.status==="review"&&q.currentStepId===Y.id&&!!Y.needsHuman,le=q?se?"active":wb(q,Y.id):z?"done":T&&J===0?"active":"pending";return a.jsxs("div",{className:`chain-node is-${le}`,children:[J>0&&a.jsx("div",{className:`chain-node__line is-${le}`}),a.jsxs("div",{className:"chain-node__row",children:[a.jsx("span",{className:"chain-node__dot",children:le==="done"?a.jsx(L,{name:"check",size:12,color:"#fff"}):le==="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:Y.name}),Y.requiresAgent&&a.jsx("span",{className:"chain-node__engine",style:{"--c":"var(--agent-llm)"},children:"AI"}),Y.needsHuman&&a.jsx("span",{className:"pill pill--amber",children:"人工"}),!Y.requiresAgent&&!Y.needsHuman&&a.jsx("span",{className:"pill pill--muted",children:"自动"})]}),a.jsx("div",{className:"chain-node__recipe",children:Y.recipe||"自动处理"}),se&&a.jsxs("div",{className:"chain-node__approve",children:[a.jsxs("button",{type:"button",className:"primary btn-approve",disabled:m!==null,onClick:()=>void W(q.id,"confirm"),children:[a.jsx(L,{name:"check",size:13,color:"#fff"})," 确认发送"]}),a.jsxs("button",{type:"button",className:"btn-reject",disabled:m!==null,onClick:()=>void W(q.id,"terminate"),children:[a.jsx(L,{name:"close",size:13})," 终止流程"]})]})]})]})]},Y.id)})})]}),a.jsxs("div",{className:"run-logs",children:[a.jsxs("div",{className:"run-logs__head",children:[a.jsx(L,{name:"file",size:14}),q?"记录执行日志":"真实运行日志",a.jsx("span",{className:"run-logs__sub",children:(q==null?void 0:q.title)??"run"})]}),a.jsx("div",{className:"run-logs__body",children:Q.length===0?a.jsx("div",{className:"empty-hint",style:{padding:20},children:q?"等待该记录的执行日志…":"启动后这里会显示服务端 SSE 返回的真实运行日志"}):a.jsx(na,{initial:!1,children:Q.map(Y=>{var J;return a.jsxs(Ze.div,{layout:!0,variants:Ct,initial:"hidden",animate:"visible",className:`log-line log-line--${Y.level}`,children:[a.jsx("span",{className:"log-line__icon",children:a.jsx(L,{name:_b[Y.level],size:11})}),a.jsxs("div",{className:"log-line__content",children:[a.jsx("span",{className:"log-line__step",children:((J=O.find(se=>se.id===Y.stepId))==null?void 0:J.name)??Y.stepId}),a.jsx("span",{className:"log-line__text",children:Y.text})]})]},Y.id)})})})]})]})}return N?!E&&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(L,{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(L,{name:"play",size:28,color:"#fff"})}),a.jsx("h3",{className:"run-intro__title",children:k?"启动真实工作流":"启动模拟工作流"}),a.jsx("p",{className:"run-intro__desc",children:k?"启动后会连接真实运行服务,监听 AI 表格中的待处理记录,并按当前流程方案执行。":"启动后记录将陆续进入,系统自动执行分类、处理、审核与发送,人工把关环节会等待确认。"}),k&&a.jsx(bb,{value:x,disabled:E,onChange:w}),a.jsxs("button",{type:"button",className:"primary run-intro__cta",onClick:F,children:[a.jsx(L,{name:"play",size:15,color:"#fff"}),k?"启动真实运行":"启动模拟运行"]})]})})]})}):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:k?E?"1/1 已连接":"0/1 待连接":`${r.arrived}/${r.total} 进入`})]}),a.jsx("div",{className:"run-board__list",children:a.jsx(na,{initial:!1,children:o.map(U=>{const q=xb[U.status];return a.jsxs(Ze.button,{type:"button",layout:!0,variants:Ct,initial:"hidden",animate:"visible",exit:"exit",className:`ticket-card${U.id===f?" is-selected":""}`,onClick:()=>h(U.id),children:[a.jsxs("div",{className:"ticket-card__top",children:[a.jsx("span",{className:`pill pill--${q.cls}`,children:q.label}),a.jsx("span",{className:"ticket-card__prio",children:U.priority})]}),a.jsx("div",{className:"ticket-card__title",children:U.title}),a.jsxs("div",{className:"ticket-card__meta",children:[U.customer," · ",U.category]}),a.jsxs("div",{className:"ticket-card__progress",children:[U.doneStepIds.length,"/",O.length," 步",!k&&n.isAwaiting(U.id)&&a.jsx("span",{className:"ticket-card__await",children:"待审批"})]})]},U.id)})})}),a.jsxs("div",{className:"run-board__foot",children:["处理中 ",$.running," · 审核中 ",$.review," · 已完成 ",$.done]})]}),a.jsxs("div",{className:"run-flow",children:[a.jsx("div",{className:"run-flow__head",children:C?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"run-flow__title",children:C.title}),a.jsx("div",{className:"run-flow__sub",children:C.customer})]}):a.jsx("div",{className:"run-flow__sub",children:"选择左侧工单查看步骤流转"})}),C&&a.jsx("div",{className:"step-chain",children:O.map((U,q)=>{const Q=wb(C,U.id),K=!k&&Q==="active"&&U.needsHuman&&n.isAwaiting(C.id);return a.jsxs("div",{className:`chain-node is-${Q}`,children:[q>0&&a.jsx("div",{className:`chain-node__line is-${Q}`}),a.jsxs("div",{className:"chain-node__row",children:[a.jsx("span",{className:"chain-node__dot",children:Q==="done"?a.jsx(L,{name:"check",size:12,color:"#fff"}):Q==="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:U.name}),U.requiresAgent&&a.jsx("span",{className:"chain-node__engine",style:{"--c":"var(--agent-llm)"},children:"AI"}),U.needsHuman&&a.jsx("span",{className:"pill pill--amber",children:"人工"}),!U.requiresAgent&&!U.needsHuman&&a.jsx("span",{className:"pill pill--muted",children:"自动"})]}),a.jsx("div",{className:"chain-node__recipe",children:U.recipe||"自动处理"}),K&&a.jsxs("div",{className:"chain-node__approve",children:[a.jsxs("button",{type:"button",className:"primary btn-approve",onClick:()=>n.approve(C.id),children:[a.jsx(L,{name:"check",size:13,color:"#fff"})," 通过"]}),a.jsxs("button",{type:"button",className:"btn-reject",onClick:()=>n.reject(C.id),children:[a.jsx(L,{name:"close",size:13})," 驳回"]})]})]})]})]},U.id)})})]}),a.jsxs("div",{className:"run-logs",children:[a.jsxs("div",{className:"run-logs__head",children:[a.jsx(L,{name:"file",size:14}),"执行日志",C&&a.jsx("span",{className:"run-logs__sub",children:C.title})]}),a.jsxs("div",{className:"run-logs__body",children:[R.length===0?a.jsx("div",{className:"empty-hint",style:{padding:20},children:C?"等待执行日志…":"选择工单查看日志"}):a.jsx(na,{initial:!1,children:R.map(U=>{const q=O.find(Q=>Q.id===U.stepId);return a.jsxs(Ze.div,{layout:!0,variants:Ct,initial:"hidden",animate:"visible",className:`log-line log-line--${U.level}`,children:[a.jsx("span",{className:"log-line__icon",children:a.jsx(L,{name:_b[U.level],size:11})}),a.jsxs("div",{className:"log-line__content",children:[a.jsx("span",{className:"log-line__step",children:(q==null?void 0:q.name)??U.stepId}),a.jsx("span",{className:"log-line__text",children:U.text})]})]},U.id)})}),a.jsx("div",{ref:M})]})]})]}):a.jsx("div",{className:"split split--chatonly",children:a.jsxs("div",{className:"split__work",children:[a.jsxs("div",{className:"work-head",children:[a.jsx(L,{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(L,{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(ze,{className:"primary run-intro__cta",to:"../setup",children:[a.jsx(L,{name:"chevron-right",size:15,color:"#fff"}),"返回搭建阶段"]})]})})]})})});function fc(e){return{id:`run_preflight_${Date.now().toString(36)}`,ts:Date.now(),ticketId:"run",stepId:"run",level:"error",text:e}}const oP={"workflow-pull-claim":"整条下发本机 daemon(pull-claim)","server-run-relay-agent":"服务端跑引擎 + agent/dws 下发(server-run)"};function bb({value:e,disabled:t,onChange:n}){return a.jsxs("label",{className:"run-mode-picker",title:"本次启动用哪种执行方式(覆盖部署默认);已被 daemon 认领的运行不可切回进程内",children:[a.jsx("span",{className:"run-mode-picker__label",children:"执行方式"}),a.jsxs("select",{value:e,disabled:t,onChange:r=>n(r.target.value),children:[a.jsx("option",{value:"",children:"部署默认"}),Object.entries(oP).map(([r,s])=>a.jsx("option",{value:r,children:s},r))]})]})}const qG=["本地型","平台型"],GG=["在线","离线"],YG=["私有","团队","公开"],jb={name:"",description:"",type:"本地型",runtime:"",owner:"",online:"在线",visibility:"私有",enabled:!0};function XG(){const{projectId:e}=Tg(),[t,n]=_.useState(null),[r,s]=_.useState([]),[i,o]=_.useState([]),[l,c]=_.useState(""),[u,d]=_.useState(!0),[f,h]=_.useState(""),[p,g]=_.useState(jb),[x,w]=_.useState(!1),[v,y]=_.useState("");async function m(){if(e){d(!0),h("");try{const[S,k]=await Promise.all([L$(e),O$().catch(()=>[])]);n(S.registry),s(S.agents??[]),c(S.listError??""),o([...new Set(k.flatMap(N=>N.runtimes??[]))])}catch(S){h(S instanceof Error?S.message:String(S))}finally{d(!1)}}}_.useEffect(()=>{m()},[e]);const b=_.useMemo(()=>{const S=v.trim().toLowerCase();return S?i.filter(k=>k.toLowerCase().includes(S)):i},[i,v]);async function j(S){if(S.preventDefault(),!(!e||!p.name.trim())){w(!0),h("");try{await $$(e,{name:p.name.trim(),description:p.description.trim()||void 0,type:p.type||void 0,runtime:p.runtime.trim()||void 0,owner:p.owner.trim()||void 0,online:p.online||void 0,visibility:p.visibility||void 0,enabled:p.enabled}),g(jb),await m()}catch(k){h(k instanceof Error?k.message:String(k))}finally{w(!1)}}}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(ze,{className:"account-back-btn",to:"../run",title:"返回运行工作台",children:[a.jsx(L,{name:"chevron-left",size:16}),"返回工作台"]}),a.jsxs("div",{children:[a.jsxs("div",{className:"work-head__title",children:[a.jsx(L,{name:"robot",size:16})," 智能体登记表"]}),a.jsx("div",{className:"work-head__sub",children:"管理本项目的智能体身份:一行 = 一个可指派、可认领的智能体"})]})]})}),a.jsx("div",{className:"work-body",children:a.jsx("div",{className:"agents-page",children:u?a.jsx("div",{className:"agents-loading",children:"加载中…"}):f&&!t?a.jsx("div",{className:"agents-error",children:f}):t?a.jsxs(a.Fragment,{children:[f&&a.jsx("div",{className:"agents-error",children:f}),a.jsxs("section",{className:"agents-section",children:[a.jsxs("div",{className:"agents-section__head",children:[a.jsxs("span",{children:["已有智能体(",r.length,")"]}),a.jsxs("button",{type:"button",className:"ghost agents-refresh",onClick:()=>void m(),children:[a.jsx(L,{name:"refresh",size:13})," 刷新"]})]}),l&&a.jsxs("div",{className:"agents-error",children:["读取登记表失败:",l]}),r.length===0?a.jsx("div",{className:"agents-empty",children:l?"暂无法读取登记表行。":"登记表暂无智能体行,用下方表单新建一个。"}):a.jsxs("table",{className:"agents-table",children:[a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("th",{children:"名称"}),a.jsx("th",{children:"类型"}),a.jsx("th",{children:"运行时"}),a.jsx("th",{children:"在线"}),a.jsx("th",{children:"可见范围"}),a.jsx("th",{children:"启用"}),a.jsx("th",{children:"agent_id(行 ID)"})]})}),a.jsx("tbody",{children:r.map(S=>a.jsxs("tr",{children:[a.jsx("td",{className:"agents-cell__name",children:S.name||"(未命名)"}),a.jsx("td",{children:S.type??"—"}),a.jsx("td",{children:S.runtime??"—"}),a.jsx("td",{children:S.online??"—"}),a.jsx("td",{children:S.visibility??"—"}),a.jsx("td",{children:S.enabled===void 0?"—":S.enabled?"✓":"✕"}),a.jsx("td",{className:"agents-cell__id",title:S.recordId,children:S.recordId})]},S.recordId))})]})]}),a.jsxs("section",{className:"agents-section",children:[a.jsx("div",{className:"agents-section__head",children:a.jsx("span",{children:"新建智能体"})}),a.jsxs("form",{className:"agents-form",onSubmit:S=>void j(S),children:[a.jsxs("label",{className:"agents-field",children:[a.jsx("span",{className:"agents-field__label",children:"名称 *"}),a.jsx("input",{type:"text",value:p.name,placeholder:"例如:小舟",onChange:S=>g(k=>({...k,name:S.target.value}))})]}),a.jsxs("label",{className:"agents-field",children:[a.jsx("span",{className:"agents-field__label",children:"类型"}),a.jsx("select",{value:p.type,onChange:S=>g(k=>({...k,type:S.target.value})),children:qG.map(S=>a.jsx("option",{value:S,children:S},S))})]}),a.jsxs("label",{className:"agents-field",children:[a.jsx("span",{className:"agents-field__label",children:"在线"}),a.jsx("select",{value:p.online,onChange:S=>g(k=>({...k,online:S.target.value})),children:GG.map(S=>a.jsx("option",{value:S,children:S},S))})]}),a.jsxs("label",{className:"agents-field",children:[a.jsx("span",{className:"agents-field__label",children:"可见范围"}),a.jsx("select",{value:p.visibility,onChange:S=>g(k=>({...k,visibility:S.target.value})),children:YG.map(S=>a.jsx("option",{value:S,children:S},S))})]}),a.jsxs("label",{className:"agents-field",children:[a.jsx("span",{className:"agents-field__label",children:"owner"}),a.jsx("input",{type:"text",value:p.owner,placeholder:"归属人(个人 owner)",onChange:S=>g(k=>({...k,owner:S.target.value}))})]}),a.jsxs("div",{className:"agents-field agents-field--full",children:[a.jsx("span",{className:"agents-field__label",children:"运行时绑定"}),a.jsx("input",{type:"text",className:"agents-runtime__search",value:v,placeholder:"搜索运行时…",onChange:S=>y(S.target.value)}),a.jsx("div",{className:"agents-runtime__chips",children:b.length===0?a.jsx("span",{className:"agents-runtime__none",children:i.length===0?"本机引擎未探测到可用运行时":"无匹配,可直接填写"}):b.map(S=>a.jsx("button",{type:"button",className:`agents-runtime__chip${p.runtime===S?" is-selected":""}`,onClick:()=>g(k=>({...k,runtime:S})),children:S},S))}),a.jsx("input",{type:"text",value:p.runtime,placeholder:"运行时(可手填,如 qoder)",onChange:S=>g(k=>({...k,runtime:S.target.value}))})]}),a.jsxs("label",{className:"agents-field agents-field--full",children:[a.jsx("span",{className:"agents-field__label",children:"描述"}),a.jsx("textarea",{rows:2,value:p.description,placeholder:"这个智能体做什么(可选)",onChange:S=>g(k=>({...k,description:S.target.value}))})]}),a.jsxs("label",{className:"agents-field agents-field--check",children:[a.jsx("input",{type:"checkbox",checked:p.enabled,onChange:S=>g(k=>({...k,enabled:S.target.checked}))}),a.jsx("span",{children:"启用"})]}),a.jsx("div",{className:"agents-form__actions",children:a.jsxs("button",{type:"submit",className:"primary",disabled:x||!p.name.trim(),children:[a.jsx(L,{name:"plus",size:14,color:"#fff"}),x?"创建中…":"新建智能体"]})})]}),a.jsxs("p",{className:"agents-hint",children:["Prompt / Skills 仍以 ",a.jsx("code",{children:"profile.yml"})," 为事实源,登记表只承载身份 / 类型 / owner / 运行时 / 在线 / 可见范围; 新行的 ",a.jsx("code",{children:"agent_id"})," 即其在登记表的行 ID。"]})]})]}):a.jsxs("div",{className:"agents-empty",children:["该项目未配置 ",a.jsx("code",{children:"identity.registry"}),",登记表管理面不可用。可在配置里指定智能体登记表后重试。"]})})})]})})}function QG(){return a.jsxs(L2,{children:[a.jsx(rt,{path:"/workbench/group-qa",element:a.jsx(O9,{})}),a.jsxs(rt,{path:"/",element:a.jsx(t3,{}),children:[a.jsx(rt,{index:!0,element:a.jsx(N5,{})}),a.jsx(rt,{path:"account",element:a.jsx(Z9,{})}),a.jsx(rt,{path:"engines",element:a.jsx(J9,{})}),a.jsx(rt,{path:"setup",element:a.jsx(f9,{})}),a.jsxs(rt,{path:"p/:projectId",element:a.jsx(B3,{}),children:[a.jsx(rt,{index:!0,element:a.jsx(U3,{})}),a.jsx(rt,{path:"init",element:a.jsx(WK,{})}),a.jsx(rt,{path:"design",element:a.jsx(NG,{})}),a.jsx(rt,{path:"setup",element:a.jsx(PG,{})}),a.jsx(rt,{path:"test",element:a.jsx(IG,{})}),a.jsx(rt,{path:"run",element:a.jsx(KG,{})}),a.jsx(rt,{path:"agents",element:a.jsx(XG,{})})]}),a.jsx(rt,{path:"*",element:a.jsx(s1,{to:"/",replace:!0})})]})]})}function ZG(){return a.jsx(aM,{children:a.jsx(QG,{})})}const JG=new URLSearchParams(window.location.search).has("token");JG||F9();DS(document.getElementById("root")).render(a.jsx(ZG,{}));
|