@siming-org/server 0.4.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,150 @@
1
+ function rB(e,t){for(var n=0;n<t.length;n++){const r=t[n];if(typeof r!="string"&&!Array.isArray(r)){for(const o in r)if(o!=="default"&&!(o in e)){const i=Object.getOwnPropertyDescriptor(r,o);i&&Object.defineProperty(e,o,i.get?i:{enumerable:!0,get:()=>r[o]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))r(o);new MutationObserver(o=>{for(const i of o)if(i.type==="childList")for(const s of i.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&r(s)}).observe(document,{childList:!0,subtree:!0});function n(o){const i={};return o.integrity&&(i.integrity=o.integrity),o.referrerPolicy&&(i.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?i.credentials="include":o.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(o){if(o.ep)return;o.ep=!0;const i=n(o);fetch(o.href,i)}})();function wh(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Wb={exports:{}},sf={};var I_;function oB(){if(I_)return sf;I_=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(r,o,i){var s=null;if(i!==void 0&&(s=""+i),o.key!==void 0&&(s=""+o.key),"key"in o){i={};for(var c in o)c!=="key"&&(i[c]=o[c])}else i=o;return o=i.ref,{$$typeof:e,type:r,key:s,ref:o!==void 0?o:null,props:i}}return sf.Fragment=t,sf.jsx=n,sf.jsxs=n,sf}var z_;function iB(){return z_||(z_=1,Wb.exports=oB()),Wb.exports}var f=iB(),Jb={exports:{}},$t={};var L_;function sB(){if(L_)return $t;L_=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),i=Symbol.for("react.consumer"),s=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),u=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),m=Symbol.for("react.activity"),g=Symbol.iterator;function y(H){return H===null||typeof H!="object"?null:(H=g&&H[g]||H["@@iterator"],typeof H=="function"?H:null)}var v={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},S=Object.assign,w={};function E(H,U,B){this.props=H,this.context=U,this.refs=w,this.updater=B||v}E.prototype.isReactComponent={},E.prototype.setState=function(H,U){if(typeof H!="object"&&typeof H!="function"&&H!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,H,U,"setState")},E.prototype.forceUpdate=function(H){this.updater.enqueueForceUpdate(this,H,"forceUpdate")};function k(){}k.prototype=E.prototype;function j(H,U,B){this.props=H,this.context=U,this.refs=w,this.updater=B||v}var N=j.prototype=new k;N.constructor=j,S(N,E.prototype),N.isPureReactComponent=!0;var A=Array.isArray;function R(){}var M={H:null,A:null,T:null,S:null},T=Object.prototype.hasOwnProperty;function O(H,U,B){var X=B.ref;return{$$typeof:e,type:H,key:U,ref:X!==void 0?X:null,props:B}}function z(H,U){return O(H.type,U,H.props)}function q(H){return typeof H=="object"&&H!==null&&H.$$typeof===e}function $(H){var U={"=":"=0",":":"=2"};return"$"+H.replace(/[=:]/g,function(B){return U[B]})}var G=/\/+/g;function L(H,U){return typeof H=="object"&&H!==null&&H.key!=null?$(""+H.key):U.toString(36)}function F(H){switch(H.status){case"fulfilled":return H.value;case"rejected":throw H.reason;default:switch(typeof H.status=="string"?H.then(R,R):(H.status="pending",H.then(function(U){H.status==="pending"&&(H.status="fulfilled",H.value=U)},function(U){H.status==="pending"&&(H.status="rejected",H.reason=U)})),H.status){case"fulfilled":return H.value;case"rejected":throw H.reason}}throw H}function P(H,U,B,X,J){var Q=typeof H;(Q==="undefined"||Q==="boolean")&&(H=null);var oe=!1;if(H===null)oe=!0;else switch(Q){case"bigint":case"string":case"number":oe=!0;break;case"object":switch(H.$$typeof){case e:case t:oe=!0;break;case p:return oe=H._init,P(oe(H._payload),U,B,X,J)}}if(oe)return J=J(H),oe=X===""?"."+L(H,0):X,A(J)?(B="",oe!=null&&(B=oe.replace(G,"$&/")+"/"),P(J,U,B,"",function(je){return je})):J!=null&&(q(J)&&(J=z(J,B+(J.key==null||H&&H.key===J.key?"":(""+J.key).replace(G,"$&/")+"/")+oe)),U.push(J)),1;oe=0;var W=X===""?".":X+":";if(A(H))for(var ne=0;ne<H.length;ne++)X=H[ne],Q=W+L(X,ne),oe+=P(X,U,B,Q,J);else if(ne=y(H),typeof ne=="function")for(H=ne.call(H),ne=0;!(X=H.next()).done;)X=X.value,Q=W+L(X,ne++),oe+=P(X,U,B,Q,J);else if(Q==="object"){if(typeof H.then=="function")return P(F(H),U,B,X,J);throw U=String(H),Error("Objects are not valid as a React child (found: "+(U==="[object Object]"?"object with keys {"+Object.keys(H).join(", ")+"}":U)+"). If you meant to render a collection of children, use an array instead.")}return oe}function I(H,U,B){if(H==null)return H;var X=[],J=0;return P(H,X,"","",function(Q){return U.call(B,Q,J++)}),X}function Y(H){if(H._status===-1){var U=H._result;U=U(),U.then(function(B){(H._status===0||H._status===-1)&&(H._status=1,H._result=B)},function(B){(H._status===0||H._status===-1)&&(H._status=2,H._result=B)}),H._status===-1&&(H._status=0,H._result=U)}if(H._status===1)return H._result.default;throw H._result}var Z=typeof reportError=="function"?reportError:function(H){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var U=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof H=="object"&&H!==null&&typeof H.message=="string"?String(H.message):String(H),error:H});if(!window.dispatchEvent(U))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",H);return}console.error(H)},D={map:I,forEach:function(H,U,B){I(H,function(){U.apply(this,arguments)},B)},count:function(H){var U=0;return I(H,function(){U++}),U},toArray:function(H){return I(H,function(U){return U})||[]},only:function(H){if(!q(H))throw Error("React.Children.only expected to receive a single React element child.");return H}};return $t.Activity=m,$t.Children=D,$t.Component=E,$t.Fragment=n,$t.Profiler=o,$t.PureComponent=j,$t.StrictMode=r,$t.Suspense=d,$t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=M,$t.__COMPILER_RUNTIME={__proto__:null,c:function(H){return M.H.useMemoCache(H)}},$t.cache=function(H){return function(){return H.apply(null,arguments)}},$t.cacheSignal=function(){return null},$t.cloneElement=function(H,U,B){if(H==null)throw Error("The argument must be a React element, but you passed "+H+".");var X=S({},H.props),J=H.key;if(U!=null)for(Q in U.key!==void 0&&(J=""+U.key),U)!T.call(U,Q)||Q==="key"||Q==="__self"||Q==="__source"||Q==="ref"&&U.ref===void 0||(X[Q]=U[Q]);var Q=arguments.length-2;if(Q===1)X.children=B;else if(1<Q){for(var oe=Array(Q),W=0;W<Q;W++)oe[W]=arguments[W+2];X.children=oe}return O(H.type,J,X)},$t.createContext=function(H){return H={$$typeof:s,_currentValue:H,_currentValue2:H,_threadCount:0,Provider:null,Consumer:null},H.Provider=H,H.Consumer={$$typeof:i,_context:H},H},$t.createElement=function(H,U,B){var X,J={},Q=null;if(U!=null)for(X in U.key!==void 0&&(Q=""+U.key),U)T.call(U,X)&&X!=="key"&&X!=="__self"&&X!=="__source"&&(J[X]=U[X]);var oe=arguments.length-2;if(oe===1)J.children=B;else if(1<oe){for(var W=Array(oe),ne=0;ne<oe;ne++)W[ne]=arguments[ne+2];J.children=W}if(H&&H.defaultProps)for(X in oe=H.defaultProps,oe)J[X]===void 0&&(J[X]=oe[X]);return O(H,Q,J)},$t.createRef=function(){return{current:null}},$t.forwardRef=function(H){return{$$typeof:c,render:H}},$t.isValidElement=q,$t.lazy=function(H){return{$$typeof:p,_payload:{_status:-1,_result:H},_init:Y}},$t.memo=function(H,U){return{$$typeof:u,type:H,compare:U===void 0?null:U}},$t.startTransition=function(H){var U=M.T,B={};M.T=B;try{var X=H(),J=M.S;J!==null&&J(B,X),typeof X=="object"&&X!==null&&typeof X.then=="function"&&X.then(R,Z)}catch(Q){Z(Q)}finally{U!==null&&B.types!==null&&(U.types=B.types),M.T=U}},$t.unstable_useCacheRefresh=function(){return M.H.useCacheRefresh()},$t.use=function(H){return M.H.use(H)},$t.useActionState=function(H,U,B){return M.H.useActionState(H,U,B)},$t.useCallback=function(H,U){return M.H.useCallback(H,U)},$t.useContext=function(H){return M.H.useContext(H)},$t.useDebugValue=function(){},$t.useDeferredValue=function(H,U){return M.H.useDeferredValue(H,U)},$t.useEffect=function(H,U){return M.H.useEffect(H,U)},$t.useEffectEvent=function(H){return M.H.useEffectEvent(H)},$t.useId=function(){return M.H.useId()},$t.useImperativeHandle=function(H,U,B){return M.H.useImperativeHandle(H,U,B)},$t.useInsertionEffect=function(H,U){return M.H.useInsertionEffect(H,U)},$t.useLayoutEffect=function(H,U){return M.H.useLayoutEffect(H,U)},$t.useMemo=function(H,U){return M.H.useMemo(H,U)},$t.useOptimistic=function(H,U){return M.H.useOptimistic(H,U)},$t.useReducer=function(H,U,B){return M.H.useReducer(H,U,B)},$t.useRef=function(H){return M.H.useRef(H)},$t.useState=function(H){return M.H.useState(H)},$t.useSyncExternalStore=function(H,U,B){return M.H.useSyncExternalStore(H,U,B)},$t.useTransition=function(){return M.H.useTransition()},$t.version="19.2.8",$t}var F_;function Sh(){return F_||(F_=1,Jb.exports=sB()),Jb.exports}var b=Sh();const Ne=wh(b),dc=rB({__proto__:null,default:Ne},[b]);var e0={exports:{}},af={},t0={exports:{}},n0={};var $_;function aB(){return $_||($_=1,(function(e){function t(P,I){var Y=P.length;P.push(I);e:for(;0<Y;){var Z=Y-1>>>1,D=P[Z];if(0<o(D,I))P[Z]=I,P[Y]=D,Y=Z;else break e}}function n(P){return P.length===0?null:P[0]}function r(P){if(P.length===0)return null;var I=P[0],Y=P.pop();if(Y!==I){P[0]=Y;e:for(var Z=0,D=P.length,H=D>>>1;Z<H;){var U=2*(Z+1)-1,B=P[U],X=U+1,J=P[X];if(0>o(B,Y))X<D&&0>o(J,B)?(P[Z]=J,P[X]=Y,Z=X):(P[Z]=B,P[U]=Y,Z=U);else if(X<D&&0>o(J,Y))P[Z]=J,P[X]=Y,Z=X;else break e}}return I}function o(P,I){var Y=P.sortIndex-I.sortIndex;return Y!==0?Y:P.id-I.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var s=Date,c=s.now();e.unstable_now=function(){return s.now()-c}}var d=[],u=[],p=1,m=null,g=3,y=!1,v=!1,S=!1,w=!1,E=typeof setTimeout=="function"?setTimeout:null,k=typeof clearTimeout=="function"?clearTimeout:null,j=typeof setImmediate<"u"?setImmediate:null;function N(P){for(var I=n(u);I!==null;){if(I.callback===null)r(u);else if(I.startTime<=P)r(u),I.sortIndex=I.expirationTime,t(d,I);else break;I=n(u)}}function A(P){if(S=!1,N(P),!v)if(n(d)!==null)v=!0,R||(R=!0,$());else{var I=n(u);I!==null&&F(A,I.startTime-P)}}var R=!1,M=-1,T=5,O=-1;function z(){return w?!0:!(e.unstable_now()-O<T)}function q(){if(w=!1,R){var P=e.unstable_now();O=P;var I=!0;try{e:{v=!1,S&&(S=!1,k(M),M=-1),y=!0;var Y=g;try{t:{for(N(P),m=n(d);m!==null&&!(m.expirationTime>P&&z());){var Z=m.callback;if(typeof Z=="function"){m.callback=null,g=m.priorityLevel;var D=Z(m.expirationTime<=P);if(P=e.unstable_now(),typeof D=="function"){m.callback=D,N(P),I=!0;break t}m===n(d)&&r(d),N(P)}else r(d);m=n(d)}if(m!==null)I=!0;else{var H=n(u);H!==null&&F(A,H.startTime-P),I=!1}}break e}finally{m=null,g=Y,y=!1}I=void 0}}finally{I?$():R=!1}}}var $;if(typeof j=="function")$=function(){j(q)};else if(typeof MessageChannel<"u"){var G=new MessageChannel,L=G.port2;G.port1.onmessage=q,$=function(){L.postMessage(null)}}else $=function(){E(q,0)};function F(P,I){M=E(function(){P(e.unstable_now())},I)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(P){P.callback=null},e.unstable_forceFrameRate=function(P){0>P||125<P?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):T=0<P?Math.floor(1e3/P):5},e.unstable_getCurrentPriorityLevel=function(){return g},e.unstable_next=function(P){switch(g){case 1:case 2:case 3:var I=3;break;default:I=g}var Y=g;g=I;try{return P()}finally{g=Y}},e.unstable_requestPaint=function(){w=!0},e.unstable_runWithPriority=function(P,I){switch(P){case 1:case 2:case 3:case 4:case 5:break;default:P=3}var Y=g;g=P;try{return I()}finally{g=Y}},e.unstable_scheduleCallback=function(P,I,Y){var Z=e.unstable_now();switch(typeof Y=="object"&&Y!==null?(Y=Y.delay,Y=typeof Y=="number"&&0<Y?Z+Y:Z):Y=Z,P){case 1:var D=-1;break;case 2:D=250;break;case 5:D=1073741823;break;case 4:D=1e4;break;default:D=5e3}return D=Y+D,P={id:p++,callback:I,priorityLevel:P,startTime:Y,expirationTime:D,sortIndex:-1},Y>Z?(P.sortIndex=Y,t(u,P),n(d)===null&&P===n(u)&&(S?(k(M),M=-1):S=!0,F(A,Y-Z))):(P.sortIndex=D,t(d,P),v||y||(v=!0,R||(R=!0,$()))),P},e.unstable_shouldYield=z,e.unstable_wrapCallback=function(P){var I=g;return function(){var Y=g;g=I;try{return P.apply(this,arguments)}finally{g=Y}}}})(n0)),n0}var V_;function lB(){return V_||(V_=1,t0.exports=aB()),t0.exports}var r0={exports:{}},Qr={};var B_;function cB(){if(B_)return Qr;B_=1;var e=Sh();function t(d){var u="https://react.dev/errors/"+d;if(1<arguments.length){u+="?args[]="+encodeURIComponent(arguments[1]);for(var p=2;p<arguments.length;p++)u+="&args[]="+encodeURIComponent(arguments[p])}return"Minified React error #"+d+"; visit "+u+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function n(){}var r={d:{f:n,r:function(){throw Error(t(522))},D:n,C:n,L:n,m:n,X:n,S:n,M:n},p:0,findDOMNode:null},o=Symbol.for("react.portal");function i(d,u,p){var m=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:o,key:m==null?null:""+m,children:d,containerInfo:u,implementation:p}}var s=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function c(d,u){if(d==="font")return"";if(typeof u=="string")return u==="use-credentials"?u:""}return Qr.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,Qr.createPortal=function(d,u){var p=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!u||u.nodeType!==1&&u.nodeType!==9&&u.nodeType!==11)throw Error(t(299));return i(d,u,null,p)},Qr.flushSync=function(d){var u=s.T,p=r.p;try{if(s.T=null,r.p=2,d)return d()}finally{s.T=u,r.p=p,r.d.f()}},Qr.preconnect=function(d,u){typeof d=="string"&&(u?(u=u.crossOrigin,u=typeof u=="string"?u==="use-credentials"?u:"":void 0):u=null,r.d.C(d,u))},Qr.prefetchDNS=function(d){typeof d=="string"&&r.d.D(d)},Qr.preinit=function(d,u){if(typeof d=="string"&&u&&typeof u.as=="string"){var p=u.as,m=c(p,u.crossOrigin),g=typeof u.integrity=="string"?u.integrity:void 0,y=typeof u.fetchPriority=="string"?u.fetchPriority:void 0;p==="style"?r.d.S(d,typeof u.precedence=="string"?u.precedence:void 0,{crossOrigin:m,integrity:g,fetchPriority:y}):p==="script"&&r.d.X(d,{crossOrigin:m,integrity:g,fetchPriority:y,nonce:typeof u.nonce=="string"?u.nonce:void 0})}},Qr.preinitModule=function(d,u){if(typeof d=="string")if(typeof u=="object"&&u!==null){if(u.as==null||u.as==="script"){var p=c(u.as,u.crossOrigin);r.d.M(d,{crossOrigin:p,integrity:typeof u.integrity=="string"?u.integrity:void 0,nonce:typeof u.nonce=="string"?u.nonce:void 0})}}else u==null&&r.d.M(d)},Qr.preload=function(d,u){if(typeof d=="string"&&typeof u=="object"&&u!==null&&typeof u.as=="string"){var p=u.as,m=c(p,u.crossOrigin);r.d.L(d,p,{crossOrigin:m,integrity:typeof u.integrity=="string"?u.integrity:void 0,nonce:typeof u.nonce=="string"?u.nonce:void 0,type:typeof u.type=="string"?u.type:void 0,fetchPriority:typeof u.fetchPriority=="string"?u.fetchPriority:void 0,referrerPolicy:typeof u.referrerPolicy=="string"?u.referrerPolicy:void 0,imageSrcSet:typeof u.imageSrcSet=="string"?u.imageSrcSet:void 0,imageSizes:typeof u.imageSizes=="string"?u.imageSizes:void 0,media:typeof u.media=="string"?u.media:void 0})}},Qr.preloadModule=function(d,u){if(typeof d=="string")if(u){var p=c(u.as,u.crossOrigin);r.d.m(d,{as:typeof u.as=="string"&&u.as!=="script"?u.as:void 0,crossOrigin:p,integrity:typeof u.integrity=="string"?u.integrity:void 0})}else r.d.m(d)},Qr.requestFormReset=function(d){r.d.r(d)},Qr.unstable_batchedUpdates=function(d,u){return d(u)},Qr.useFormState=function(d,u,p){return s.H.useFormState(d,u,p)},Qr.useFormStatus=function(){return s.H.useHostTransitionStatus()},Qr.version="19.2.8",Qr}var H_;function j2(){if(H_)return r0.exports;H_=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),r0.exports=cB(),r0.exports}var U_;function uB(){if(U_)return af;U_=1;var e=lB(),t=Sh(),n=j2();function r(a){var l="https://react.dev/errors/"+a;if(1<arguments.length){l+="?args[]="+encodeURIComponent(arguments[1]);for(var h=2;h<arguments.length;h++)l+="&args[]="+encodeURIComponent(arguments[h])}return"Minified React error #"+a+"; visit "+l+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function o(a){return!(!a||a.nodeType!==1&&a.nodeType!==9&&a.nodeType!==11)}function i(a){var l=a,h=a;if(a.alternate)for(;l.return;)l=l.return;else{a=l;do l=a,(l.flags&4098)!==0&&(h=l.return),a=l.return;while(a)}return l.tag===3?h:null}function s(a){if(a.tag===13){var l=a.memoizedState;if(l===null&&(a=a.alternate,a!==null&&(l=a.memoizedState)),l!==null)return l.dehydrated}return null}function c(a){if(a.tag===31){var l=a.memoizedState;if(l===null&&(a=a.alternate,a!==null&&(l=a.memoizedState)),l!==null)return l.dehydrated}return null}function d(a){if(i(a)!==a)throw Error(r(188))}function u(a){var l=a.alternate;if(!l){if(l=i(a),l===null)throw Error(r(188));return l!==a?null:a}for(var h=a,x=l;;){var C=h.return;if(C===null)break;var _=C.alternate;if(_===null){if(x=C.return,x!==null){h=x;continue}break}if(C.child===_.child){for(_=C.child;_;){if(_===h)return d(C),a;if(_===x)return d(C),l;_=_.sibling}throw Error(r(188))}if(h.return!==x.return)h=C,x=_;else{for(var V=!1,K=C.child;K;){if(K===h){V=!0,h=C,x=_;break}if(K===x){V=!0,x=C,h=_;break}K=K.sibling}if(!V){for(K=_.child;K;){if(K===h){V=!0,h=_,x=C;break}if(K===x){V=!0,x=_,h=C;break}K=K.sibling}if(!V)throw Error(r(189))}}if(h.alternate!==x)throw Error(r(190))}if(h.tag!==3)throw Error(r(188));return h.stateNode.current===h?a:l}function p(a){var l=a.tag;if(l===5||l===26||l===27||l===6)return a;for(a=a.child;a!==null;){if(l=p(a),l!==null)return l;a=a.sibling}return null}var m=Object.assign,g=Symbol.for("react.element"),y=Symbol.for("react.transitional.element"),v=Symbol.for("react.portal"),S=Symbol.for("react.fragment"),w=Symbol.for("react.strict_mode"),E=Symbol.for("react.profiler"),k=Symbol.for("react.consumer"),j=Symbol.for("react.context"),N=Symbol.for("react.forward_ref"),A=Symbol.for("react.suspense"),R=Symbol.for("react.suspense_list"),M=Symbol.for("react.memo"),T=Symbol.for("react.lazy"),O=Symbol.for("react.activity"),z=Symbol.for("react.memo_cache_sentinel"),q=Symbol.iterator;function $(a){return a===null||typeof a!="object"?null:(a=q&&a[q]||a["@@iterator"],typeof a=="function"?a:null)}var G=Symbol.for("react.client.reference");function L(a){if(a==null)return null;if(typeof a=="function")return a.$$typeof===G?null:a.displayName||a.name||null;if(typeof a=="string")return a;switch(a){case S:return"Fragment";case E:return"Profiler";case w:return"StrictMode";case A:return"Suspense";case R:return"SuspenseList";case O:return"Activity"}if(typeof a=="object")switch(a.$$typeof){case v:return"Portal";case j:return a.displayName||"Context";case k:return(a._context.displayName||"Context")+".Consumer";case N:var l=a.render;return a=a.displayName,a||(a=l.displayName||l.name||"",a=a!==""?"ForwardRef("+a+")":"ForwardRef"),a;case M:return l=a.displayName||null,l!==null?l:L(a.type)||"Memo";case T:l=a._payload,a=a._init;try{return L(a(l))}catch{}}return null}var F=Array.isArray,P=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,I=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Y={pending:!1,data:null,method:null,action:null},Z=[],D=-1;function H(a){return{current:a}}function U(a){0>D||(a.current=Z[D],Z[D]=null,D--)}function B(a,l){D++,Z[D]=a.current,a.current=l}var X=H(null),J=H(null),Q=H(null),oe=H(null);function W(a,l){switch(B(Q,l),B(J,a),B(X,null),l.nodeType){case 9:case 11:a=(a=l.documentElement)&&(a=a.namespaceURI)?i_(a):0;break;default:if(a=l.tagName,l=l.namespaceURI)l=i_(l),a=s_(l,a);else switch(a){case"svg":a=1;break;case"math":a=2;break;default:a=0}}U(X),B(X,a)}function ne(){U(X),U(J),U(Q)}function je(a){a.memoizedState!==null&&B(oe,a);var l=X.current,h=s_(l,a.type);l!==h&&(B(J,a),B(X,h))}function Ee(a){J.current===a&&(U(X),U(J)),oe.current===a&&(U(oe),tf._currentValue=Y)}var pe,re;function ge(a){if(pe===void 0)try{throw Error()}catch(h){var l=h.stack.trim().match(/\n( *(at )?)/);pe=l&&l[1]||"",re=-1<h.stack.indexOf(`
2
+ at`)?" (<anonymous>)":-1<h.stack.indexOf("@")?"@unknown:0:0":""}return`
3
+ `+pe+a+re}var _e=!1;function De(a,l){if(!a||_e)return"";_e=!0;var h=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var x={DetermineComponentFrameRoot:function(){try{if(l){var Fe=function(){throw Error()};if(Object.defineProperty(Fe.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Fe,[])}catch(Re){var be=Re}Reflect.construct(a,[],Fe)}else{try{Fe.call()}catch(Re){be=Re}a.call(Fe.prototype)}}else{try{throw Error()}catch(Re){be=Re}(Fe=a())&&typeof Fe.catch=="function"&&Fe.catch(function(){})}}catch(Re){if(Re&&be&&typeof Re.stack=="string")return[Re.stack,be.stack]}return[null,null]}};x.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var C=Object.getOwnPropertyDescriptor(x.DetermineComponentFrameRoot,"name");C&&C.configurable&&Object.defineProperty(x.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var _=x.DetermineComponentFrameRoot(),V=_[0],K=_[1];if(V&&K){var se=V.split(`
4
+ `),xe=K.split(`
5
+ `);for(C=x=0;x<se.length&&!se[x].includes("DetermineComponentFrameRoot");)x++;for(;C<xe.length&&!xe[C].includes("DetermineComponentFrameRoot");)C++;if(x===se.length||C===xe.length)for(x=se.length-1,C=xe.length-1;1<=x&&0<=C&&se[x]!==xe[C];)C--;for(;1<=x&&0<=C;x--,C--)if(se[x]!==xe[C]){if(x!==1||C!==1)do if(x--,C--,0>C||se[x]!==xe[C]){var Oe=`
6
+ `+se[x].replace(" at new "," at ");return a.displayName&&Oe.includes("<anonymous>")&&(Oe=Oe.replace("<anonymous>",a.displayName)),Oe}while(1<=x&&0<=C);break}}}finally{_e=!1,Error.prepareStackTrace=h}return(h=a?a.displayName||a.name:"")?ge(h):""}function we(a,l){switch(a.tag){case 26:case 27:case 5:return ge(a.type);case 16:return ge("Lazy");case 13:return a.child!==l&&l!==null?ge("Suspense Fallback"):ge("Suspense");case 19:return ge("SuspenseList");case 0:case 15:return De(a.type,!1);case 11:return De(a.type.render,!1);case 1:return De(a.type,!0);case 31:return ge("Activity");default:return""}}function $e(a){try{var l="",h=null;do l+=we(a,h),h=a,a=a.return;while(a);return l}catch(x){return`
7
+ Error generating stack: `+x.message+`
8
+ `+x.stack}}var Me=Object.prototype.hasOwnProperty,Le=e.unstable_scheduleCallback,He=e.unstable_cancelCallback,Ge=e.unstable_shouldYield,ot=e.unstable_requestPaint,me=e.unstable_now,ke=e.unstable_getCurrentPriorityLevel,de=e.unstable_ImmediatePriority,ue=e.unstable_UserBlockingPriority,Se=e.unstable_NormalPriority,Ue=e.unstable_LowPriority,Ye=e.unstable_IdlePriority,kt=e.log,ee=e.unstable_setDisableYieldValue,ie=null,le=null;function Ce(a){if(typeof kt=="function"&&ee(a),le&&typeof le.setStrictMode=="function")try{le.setStrictMode(ie,a)}catch{}}var ve=Math.clz32?Math.clz32:qe,Be=Math.log,Pe=Math.LN2;function qe(a){return a>>>=0,a===0?32:31-(Be(a)/Pe|0)|0}var Ke=256,nt=262144,it=4194304;function jt(a){var l=a&42;if(l!==0)return l;switch(a&-a){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:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return a&261888;case 262144:case 524288:case 1048576:case 2097152:return a&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return a&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return a}}function Ut(a,l,h){var x=a.pendingLanes;if(x===0)return 0;var C=0,_=a.suspendedLanes,V=a.pingedLanes;a=a.warmLanes;var K=x&134217727;return K!==0?(x=K&~_,x!==0?C=jt(x):(V&=K,V!==0?C=jt(V):h||(h=K&~a,h!==0&&(C=jt(h))))):(K=x&~_,K!==0?C=jt(K):V!==0?C=jt(V):h||(h=x&~a,h!==0&&(C=jt(h)))),C===0?0:l!==0&&l!==C&&(l&_)===0&&(_=C&-C,h=l&-l,_>=h||_===32&&(h&4194048)!==0)?l:C}function qt(a,l){return(a.pendingLanes&~(a.suspendedLanes&~a.pingedLanes)&l)===0}function at(a,l){switch(a){case 1:case 2:case 4:case 8:case 64:return l+250;case 16:case 32: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 l+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Rt(){var a=it;return it<<=1,(it&62914560)===0&&(it=4194304),a}function Gt(a){for(var l=[],h=0;31>h;h++)l.push(a);return l}function Nt(a,l){a.pendingLanes|=l,l!==268435456&&(a.suspendedLanes=0,a.pingedLanes=0,a.warmLanes=0)}function Qn(a,l,h,x,C,_){var V=a.pendingLanes;a.pendingLanes=h,a.suspendedLanes=0,a.pingedLanes=0,a.warmLanes=0,a.expiredLanes&=h,a.entangledLanes&=h,a.errorRecoveryDisabledLanes&=h,a.shellSuspendCounter=0;var K=a.entanglements,se=a.expirationTimes,xe=a.hiddenUpdates;for(h=V&~h;0<h;){var Oe=31-ve(h),Fe=1<<Oe;K[Oe]=0,se[Oe]=-1;var be=xe[Oe];if(be!==null)for(xe[Oe]=null,Oe=0;Oe<be.length;Oe++){var Re=be[Oe];Re!==null&&(Re.lane&=-536870913)}h&=~Fe}x!==0&&hn(a,x,0),_!==0&&C===0&&a.tag!==0&&(a.suspendedLanes|=_&~(V&~l))}function hn(a,l,h){a.pendingLanes|=l,a.suspendedLanes&=~l;var x=31-ve(l);a.entangledLanes|=l,a.entanglements[x]=a.entanglements[x]|1073741824|h&261930}function In(a,l){var h=a.entangledLanes|=l;for(a=a.entanglements;h;){var x=31-ve(h),C=1<<x;C&l|a[x]&l&&(a[x]|=l),h&=~C}}function te(a,l){var h=l&-l;return h=(h&42)!==0?1:ae(h),(h&(a.suspendedLanes|l))!==0?0:h}function ae(a){switch(a){case 2:a=1;break;case 8:a=4;break;case 32:a=16;break;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:a=128;break;case 268435456:a=134217728;break;default:a=0}return a}function fe(a){return a&=-a,2<a?8<a?(a&134217727)!==0?32:268435456:8:2}function Ae(){var a=I.p;return a!==0?a:(a=window.event,a===void 0?32:N_(a.type))}function ze(a,l){var h=I.p;try{return I.p=a,l()}finally{I.p=h}}var Je=Math.random().toString(36).slice(2),Xe="__reactFiber$"+Je,et="__reactProps$"+Je,tt="__reactContainer$"+Je,dt="__reactEvents$"+Je,mt="__reactListeners$"+Je,Ft="__reactHandles$"+Je,St="__reactResources$"+Je,Kt="__reactMarker$"+Je;function pn(a){delete a[Xe],delete a[et],delete a[dt],delete a[mt],delete a[Ft]}function zn(a){var l=a[Xe];if(l)return l;for(var h=a.parentNode;h;){if(l=h[tt]||h[Xe]){if(h=l.alternate,l.child!==null||h!==null&&h.child!==null)for(a=h_(a);a!==null;){if(h=a[Xe])return h;a=h_(a)}return l}a=h,h=a.parentNode}return null}function xn(a){if(a=a[Xe]||a[tt]){var l=a.tag;if(l===5||l===6||l===13||l===31||l===26||l===27||l===3)return a}return null}function sn(a){var l=a.tag;if(l===5||l===26||l===27||l===6)return a.stateNode;throw Error(r(33))}function tr(a){var l=a[St];return l||(l=a[St]={hoistableStyles:new Map,hoistableScripts:new Map}),l}function un(a){a[Kt]=!0}var qi=new Set,Ao={};function Xr(a,l){zr(a,l),zr(a+"Capture",l)}function zr(a,l){for(Ao[a]=l,a=0;a<l.length;a++)qi.add(l[a])}var fo=RegExp("^[: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]*$"),la={},ho={};function ca(a){return Me.call(ho,a)?!0:Me.call(la,a)?!1:fo.test(a)?ho[a]=!0:(la[a]=!0,!1)}function bi(a,l,h){if(ca(l))if(h===null)a.removeAttribute(l);else{switch(typeof h){case"undefined":case"function":case"symbol":a.removeAttribute(l);return;case"boolean":var x=l.toLowerCase().slice(0,5);if(x!=="data-"&&x!=="aria-"){a.removeAttribute(l);return}}a.setAttribute(l,""+h)}}function wi(a,l,h){if(h===null)a.removeAttribute(l);else{switch(typeof h){case"undefined":case"function":case"symbol":case"boolean":a.removeAttribute(l);return}a.setAttribute(l,""+h)}}function Tt(a,l,h,x){if(x===null)a.removeAttribute(h);else{switch(typeof x){case"undefined":case"function":case"symbol":case"boolean":a.removeAttribute(h);return}a.setAttributeNS(l,h,""+x)}}function jn(a){switch(typeof a){case"bigint":case"boolean":case"number":case"string":case"undefined":return a;case"object":return a;default:return""}}function io(a){var l=a.type;return(a=a.nodeName)&&a.toLowerCase()==="input"&&(l==="checkbox"||l==="radio")}function Oo(a,l,h){var x=Object.getOwnPropertyDescriptor(a.constructor.prototype,l);if(!a.hasOwnProperty(l)&&typeof x<"u"&&typeof x.get=="function"&&typeof x.set=="function"){var C=x.get,_=x.set;return Object.defineProperty(a,l,{configurable:!0,get:function(){return C.call(this)},set:function(V){h=""+V,_.call(this,V)}}),Object.defineProperty(a,l,{enumerable:x.enumerable}),{getValue:function(){return h},setValue:function(V){h=""+V},stopTracking:function(){a._valueTracker=null,delete a[l]}}}}function ua(a){if(!a._valueTracker){var l=io(a)?"checked":"value";a._valueTracker=Oo(a,l,""+a[l])}}function vs(a){if(!a)return!1;var l=a._valueTracker;if(!l)return!0;var h=l.getValue(),x="";return a&&(x=io(a)?a.checked?"true":"false":a.value),a=x,a!==h?(l.setValue(a),!0):!1}function Sn(a){if(a=a||(typeof document<"u"?document:void 0),typeof a>"u")return null;try{return a.activeElement||a.body}catch{return a.body}}var Jo=/[\n"\\]/g;function Lr(a){return a.replace(Jo,function(l){return"\\"+l.charCodeAt(0).toString(16)+" "})}function hl(a,l,h,x,C,_,V,K){a.name="",V!=null&&typeof V!="function"&&typeof V!="symbol"&&typeof V!="boolean"?a.type=V:a.removeAttribute("type"),l!=null?V==="number"?(l===0&&a.value===""||a.value!=l)&&(a.value=""+jn(l)):a.value!==""+jn(l)&&(a.value=""+jn(l)):V!=="submit"&&V!=="reset"||a.removeAttribute("value"),l!=null?gd(a,V,jn(l)):h!=null?gd(a,V,jn(h)):x!=null&&a.removeAttribute("value"),C==null&&_!=null&&(a.defaultChecked=!!_),C!=null&&(a.checked=C&&typeof C!="function"&&typeof C!="symbol"),K!=null&&typeof K!="function"&&typeof K!="symbol"&&typeof K!="boolean"?a.name=""+jn(K):a.removeAttribute("name")}function Ec(a,l,h,x,C,_,V,K){if(_!=null&&typeof _!="function"&&typeof _!="symbol"&&typeof _!="boolean"&&(a.type=_),l!=null||h!=null){if(!(_!=="submit"&&_!=="reset"||l!=null)){ua(a);return}h=h!=null?""+jn(h):"",l=l!=null?""+jn(l):h,K||l===a.value||(a.value=l),a.defaultValue=l}x=x??C,x=typeof x!="function"&&typeof x!="symbol"&&!!x,a.checked=K?a.checked:!!x,a.defaultChecked=!!x,V!=null&&typeof V!="function"&&typeof V!="symbol"&&typeof V!="boolean"&&(a.name=V),ua(a)}function gd(a,l,h){l==="number"&&Sn(a.ownerDocument)===a||a.defaultValue===""+h||(a.defaultValue=""+h)}function da(a,l,h,x){if(a=a.options,l){l={};for(var C=0;C<h.length;C++)l["$"+h[C]]=!0;for(h=0;h<a.length;h++)C=l.hasOwnProperty("$"+a[h].value),a[h].selected!==C&&(a[h].selected=C),C&&x&&(a[h].defaultSelected=!0)}else{for(h=""+jn(h),l=null,C=0;C<a.length;C++){if(a[C].value===h){a[C].selected=!0,x&&(a[C].defaultSelected=!0);return}l!==null||a[C].disabled||(l=a[C])}l!==null&&(l.selected=!0)}}function yd(a,l,h){if(l!=null&&(l=""+jn(l),l!==a.value&&(a.value=l),h==null)){a.defaultValue!==l&&(a.defaultValue=l);return}a.defaultValue=h!=null?""+jn(h):""}function tk(a,l,h,x){if(l==null){if(x!=null){if(h!=null)throw Error(r(92));if(F(x)){if(1<x.length)throw Error(r(93));x=x[0]}h=x}h==null&&(h=""),l=h}h=jn(l),a.defaultValue=h,x=a.textContent,x===h&&x!==""&&x!==null&&(a.value=x),ua(a)}function Cc(a,l){if(l){var h=a.firstChild;if(h&&h===a.lastChild&&h.nodeType===3){h.nodeValue=l;return}}a.textContent=l}var W$=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function nk(a,l,h){var x=l.indexOf("--")===0;h==null||typeof h=="boolean"||h===""?x?a.setProperty(l,""):l==="float"?a.cssFloat="":a[l]="":x?a.setProperty(l,h):typeof h!="number"||h===0||W$.has(l)?l==="float"?a.cssFloat=h:a[l]=(""+h).trim():a[l]=h+"px"}function rk(a,l,h){if(l!=null&&typeof l!="object")throw Error(r(62));if(a=a.style,h!=null){for(var x in h)!h.hasOwnProperty(x)||l!=null&&l.hasOwnProperty(x)||(x.indexOf("--")===0?a.setProperty(x,""):x==="float"?a.cssFloat="":a[x]="");for(var C in l)x=l[C],l.hasOwnProperty(C)&&h[C]!==x&&nk(a,C,x)}else for(var _ in l)l.hasOwnProperty(_)&&nk(a,_,l[_])}function Gx(a){if(a.indexOf("-")===-1)return!1;switch(a){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 J$=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),e5=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function up(a){return e5.test(""+a)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":a}function bs(){}var Kx=null;function Xx(a){return a=a.target||a.srcElement||window,a.correspondingUseElement&&(a=a.correspondingUseElement),a.nodeType===3?a.parentNode:a}var kc=null,jc=null;function ok(a){var l=xn(a);if(l&&(a=l.stateNode)){var h=a[et]||null;e:switch(a=l.stateNode,l.type){case"input":if(hl(a,h.value,h.defaultValue,h.defaultValue,h.checked,h.defaultChecked,h.type,h.name),l=h.name,h.type==="radio"&&l!=null){for(h=a;h.parentNode;)h=h.parentNode;for(h=h.querySelectorAll('input[name="'+Lr(""+l)+'"][type="radio"]'),l=0;l<h.length;l++){var x=h[l];if(x!==a&&x.form===a.form){var C=x[et]||null;if(!C)throw Error(r(90));hl(x,C.value,C.defaultValue,C.defaultValue,C.checked,C.defaultChecked,C.type,C.name)}}for(l=0;l<h.length;l++)x=h[l],x.form===a.form&&vs(x)}break e;case"textarea":yd(a,h.value,h.defaultValue);break e;case"select":l=h.value,l!=null&&da(a,!!h.multiple,l,!1)}}}var Qx=!1;function ik(a,l,h){if(Qx)return a(l,h);Qx=!0;try{var x=a(l);return x}finally{if(Qx=!1,(kc!==null||jc!==null)&&(Qp(),kc&&(l=kc,a=jc,jc=kc=null,ok(l),a)))for(l=0;l<a.length;l++)ok(a[l])}}function xd(a,l){var h=a.stateNode;if(h===null)return null;var x=h[et]||null;if(x===null)return null;h=x[l];e:switch(l){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(x=!x.disabled)||(a=a.type,x=!(a==="button"||a==="input"||a==="select"||a==="textarea")),a=!x;break e;default:a=!1}if(a)return null;if(h&&typeof h!="function")throw Error(r(231,l,typeof h));return h}var ws=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Wx=!1;if(ws)try{var vd={};Object.defineProperty(vd,"passive",{get:function(){Wx=!0}}),window.addEventListener("test",vd,vd),window.removeEventListener("test",vd,vd)}catch{Wx=!1}var fa=null,Jx=null,dp=null;function sk(){if(dp)return dp;var a,l=Jx,h=l.length,x,C="value"in fa?fa.value:fa.textContent,_=C.length;for(a=0;a<h&&l[a]===C[a];a++);var V=h-a;for(x=1;x<=V&&l[h-x]===C[_-x];x++);return dp=C.slice(a,1<x?1-x:void 0)}function fp(a){var l=a.keyCode;return"charCode"in a?(a=a.charCode,a===0&&l===13&&(a=13)):a=l,a===10&&(a=13),32<=a||a===13?a:0}function hp(){return!0}function ak(){return!1}function po(a){function l(h,x,C,_,V){this._reactName=h,this._targetInst=C,this.type=x,this.nativeEvent=_,this.target=V,this.currentTarget=null;for(var K in a)a.hasOwnProperty(K)&&(h=a[K],this[K]=h?h(_):_[K]);return this.isDefaultPrevented=(_.defaultPrevented!=null?_.defaultPrevented:_.returnValue===!1)?hp:ak,this.isPropagationStopped=ak,this}return m(l.prototype,{preventDefault:function(){this.defaultPrevented=!0;var h=this.nativeEvent;h&&(h.preventDefault?h.preventDefault():typeof h.returnValue!="unknown"&&(h.returnValue=!1),this.isDefaultPrevented=hp)},stopPropagation:function(){var h=this.nativeEvent;h&&(h.stopPropagation?h.stopPropagation():typeof h.cancelBubble!="unknown"&&(h.cancelBubble=!0),this.isPropagationStopped=hp)},persist:function(){},isPersistent:hp}),l}var pl={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(a){return a.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},pp=po(pl),bd=m({},pl,{view:0,detail:0}),t5=po(bd),ev,tv,wd,mp=m({},bd,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:rv,button:0,buttons:0,relatedTarget:function(a){return a.relatedTarget===void 0?a.fromElement===a.srcElement?a.toElement:a.fromElement:a.relatedTarget},movementX:function(a){return"movementX"in a?a.movementX:(a!==wd&&(wd&&a.type==="mousemove"?(ev=a.screenX-wd.screenX,tv=a.screenY-wd.screenY):tv=ev=0,wd=a),ev)},movementY:function(a){return"movementY"in a?a.movementY:tv}}),lk=po(mp),n5=m({},mp,{dataTransfer:0}),r5=po(n5),o5=m({},bd,{relatedTarget:0}),nv=po(o5),i5=m({},pl,{animationName:0,elapsedTime:0,pseudoElement:0}),s5=po(i5),a5=m({},pl,{clipboardData:function(a){return"clipboardData"in a?a.clipboardData:window.clipboardData}}),l5=po(a5),c5=m({},pl,{data:0}),ck=po(c5),u5={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},d5={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"},f5={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function h5(a){var l=this.nativeEvent;return l.getModifierState?l.getModifierState(a):(a=f5[a])?!!l[a]:!1}function rv(){return h5}var p5=m({},bd,{key:function(a){if(a.key){var l=u5[a.key]||a.key;if(l!=="Unidentified")return l}return a.type==="keypress"?(a=fp(a),a===13?"Enter":String.fromCharCode(a)):a.type==="keydown"||a.type==="keyup"?d5[a.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:rv,charCode:function(a){return a.type==="keypress"?fp(a):0},keyCode:function(a){return a.type==="keydown"||a.type==="keyup"?a.keyCode:0},which:function(a){return a.type==="keypress"?fp(a):a.type==="keydown"||a.type==="keyup"?a.keyCode:0}}),m5=po(p5),g5=m({},mp,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),uk=po(g5),y5=m({},bd,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:rv}),x5=po(y5),v5=m({},pl,{propertyName:0,elapsedTime:0,pseudoElement:0}),b5=po(v5),w5=m({},mp,{deltaX:function(a){return"deltaX"in a?a.deltaX:"wheelDeltaX"in a?-a.wheelDeltaX:0},deltaY:function(a){return"deltaY"in a?a.deltaY:"wheelDeltaY"in a?-a.wheelDeltaY:"wheelDelta"in a?-a.wheelDelta:0},deltaZ:0,deltaMode:0}),S5=po(w5),E5=m({},pl,{newState:0,oldState:0}),C5=po(E5),k5=[9,13,27,32],ov=ws&&"CompositionEvent"in window,Sd=null;ws&&"documentMode"in document&&(Sd=document.documentMode);var j5=ws&&"TextEvent"in window&&!Sd,dk=ws&&(!ov||Sd&&8<Sd&&11>=Sd),fk=" ",hk=!1;function pk(a,l){switch(a){case"keyup":return k5.indexOf(l.keyCode)!==-1;case"keydown":return l.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function mk(a){return a=a.detail,typeof a=="object"&&"data"in a?a.data:null}var Rc=!1;function R5(a,l){switch(a){case"compositionend":return mk(l);case"keypress":return l.which!==32?null:(hk=!0,fk);case"textInput":return a=l.data,a===fk&&hk?null:a;default:return null}}function _5(a,l){if(Rc)return a==="compositionend"||!ov&&pk(a,l)?(a=sk(),dp=Jx=fa=null,Rc=!1,a):null;switch(a){case"paste":return null;case"keypress":if(!(l.ctrlKey||l.altKey||l.metaKey)||l.ctrlKey&&l.altKey){if(l.char&&1<l.char.length)return l.char;if(l.which)return String.fromCharCode(l.which)}return null;case"compositionend":return dk&&l.locale!=="ko"?null:l.data;default:return null}}var N5={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 gk(a){var l=a&&a.nodeName&&a.nodeName.toLowerCase();return l==="input"?!!N5[a.type]:l==="textarea"}function yk(a,l,h,x){kc?jc?jc.push(x):jc=[x]:kc=x,l=om(l,"onChange"),0<l.length&&(h=new pp("onChange","change",null,h,x),a.push({event:h,listeners:l}))}var Ed=null,Cd=null;function T5(a){JR(a,0)}function gp(a){var l=sn(a);if(vs(l))return a}function xk(a,l){if(a==="change")return l}var vk=!1;if(ws){var iv;if(ws){var sv="oninput"in document;if(!sv){var bk=document.createElement("div");bk.setAttribute("oninput","return;"),sv=typeof bk.oninput=="function"}iv=sv}else iv=!1;vk=iv&&(!document.documentMode||9<document.documentMode)}function wk(){Ed&&(Ed.detachEvent("onpropertychange",Sk),Cd=Ed=null)}function Sk(a){if(a.propertyName==="value"&&gp(Cd)){var l=[];yk(l,Cd,a,Xx(a)),ik(T5,l)}}function M5(a,l,h){a==="focusin"?(wk(),Ed=l,Cd=h,Ed.attachEvent("onpropertychange",Sk)):a==="focusout"&&wk()}function A5(a){if(a==="selectionchange"||a==="keyup"||a==="keydown")return gp(Cd)}function O5(a,l){if(a==="click")return gp(l)}function D5(a,l){if(a==="input"||a==="change")return gp(l)}function P5(a,l){return a===l&&(a!==0||1/a===1/l)||a!==a&&l!==l}var Do=typeof Object.is=="function"?Object.is:P5;function kd(a,l){if(Do(a,l))return!0;if(typeof a!="object"||a===null||typeof l!="object"||l===null)return!1;var h=Object.keys(a),x=Object.keys(l);if(h.length!==x.length)return!1;for(x=0;x<h.length;x++){var C=h[x];if(!Me.call(l,C)||!Do(a[C],l[C]))return!1}return!0}function Ek(a){for(;a&&a.firstChild;)a=a.firstChild;return a}function Ck(a,l){var h=Ek(a);a=0;for(var x;h;){if(h.nodeType===3){if(x=a+h.textContent.length,a<=l&&x>=l)return{node:h,offset:l-a};a=x}e:{for(;h;){if(h.nextSibling){h=h.nextSibling;break e}h=h.parentNode}h=void 0}h=Ek(h)}}function kk(a,l){return a&&l?a===l?!0:a&&a.nodeType===3?!1:l&&l.nodeType===3?kk(a,l.parentNode):"contains"in a?a.contains(l):a.compareDocumentPosition?!!(a.compareDocumentPosition(l)&16):!1:!1}function jk(a){a=a!=null&&a.ownerDocument!=null&&a.ownerDocument.defaultView!=null?a.ownerDocument.defaultView:window;for(var l=Sn(a.document);l instanceof a.HTMLIFrameElement;){try{var h=typeof l.contentWindow.location.href=="string"}catch{h=!1}if(h)a=l.contentWindow;else break;l=Sn(a.document)}return l}function av(a){var l=a&&a.nodeName&&a.nodeName.toLowerCase();return l&&(l==="input"&&(a.type==="text"||a.type==="search"||a.type==="tel"||a.type==="url"||a.type==="password")||l==="textarea"||a.contentEditable==="true")}var I5=ws&&"documentMode"in document&&11>=document.documentMode,_c=null,lv=null,jd=null,cv=!1;function Rk(a,l,h){var x=h.window===h?h.document:h.nodeType===9?h:h.ownerDocument;cv||_c==null||_c!==Sn(x)||(x=_c,"selectionStart"in x&&av(x)?x={start:x.selectionStart,end:x.selectionEnd}:(x=(x.ownerDocument&&x.ownerDocument.defaultView||window).getSelection(),x={anchorNode:x.anchorNode,anchorOffset:x.anchorOffset,focusNode:x.focusNode,focusOffset:x.focusOffset}),jd&&kd(jd,x)||(jd=x,x=om(lv,"onSelect"),0<x.length&&(l=new pp("onSelect","select",null,l,h),a.push({event:l,listeners:x}),l.target=_c)))}function ml(a,l){var h={};return h[a.toLowerCase()]=l.toLowerCase(),h["Webkit"+a]="webkit"+l,h["Moz"+a]="moz"+l,h}var Nc={animationend:ml("Animation","AnimationEnd"),animationiteration:ml("Animation","AnimationIteration"),animationstart:ml("Animation","AnimationStart"),transitionrun:ml("Transition","TransitionRun"),transitionstart:ml("Transition","TransitionStart"),transitioncancel:ml("Transition","TransitionCancel"),transitionend:ml("Transition","TransitionEnd")},uv={},_k={};ws&&(_k=document.createElement("div").style,"AnimationEvent"in window||(delete Nc.animationend.animation,delete Nc.animationiteration.animation,delete Nc.animationstart.animation),"TransitionEvent"in window||delete Nc.transitionend.transition);function gl(a){if(uv[a])return uv[a];if(!Nc[a])return a;var l=Nc[a],h;for(h in l)if(l.hasOwnProperty(h)&&h in _k)return uv[a]=l[h];return a}var Nk=gl("animationend"),Tk=gl("animationiteration"),Mk=gl("animationstart"),z5=gl("transitionrun"),L5=gl("transitionstart"),F5=gl("transitioncancel"),Ak=gl("transitionend"),Ok=new Map,dv="abort auxClick beforeToggle 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(" ");dv.push("scrollEnd");function Si(a,l){Ok.set(a,l),Xr(l,[a])}var yp=typeof reportError=="function"?reportError:function(a){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var l=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof a=="object"&&a!==null&&typeof a.message=="string"?String(a.message):String(a),error:a});if(!window.dispatchEvent(l))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",a);return}console.error(a)},ei=[],Tc=0,fv=0;function xp(){for(var a=Tc,l=fv=Tc=0;l<a;){var h=ei[l];ei[l++]=null;var x=ei[l];ei[l++]=null;var C=ei[l];ei[l++]=null;var _=ei[l];if(ei[l++]=null,x!==null&&C!==null){var V=x.pending;V===null?C.next=C:(C.next=V.next,V.next=C),x.pending=C}_!==0&&Dk(h,C,_)}}function vp(a,l,h,x){ei[Tc++]=a,ei[Tc++]=l,ei[Tc++]=h,ei[Tc++]=x,fv|=x,a.lanes|=x,a=a.alternate,a!==null&&(a.lanes|=x)}function hv(a,l,h,x){return vp(a,l,h,x),bp(a)}function yl(a,l){return vp(a,null,null,l),bp(a)}function Dk(a,l,h){a.lanes|=h;var x=a.alternate;x!==null&&(x.lanes|=h);for(var C=!1,_=a.return;_!==null;)_.childLanes|=h,x=_.alternate,x!==null&&(x.childLanes|=h),_.tag===22&&(a=_.stateNode,a===null||a._visibility&1||(C=!0)),a=_,_=_.return;return a.tag===3?(_=a.stateNode,C&&l!==null&&(C=31-ve(h),a=_.hiddenUpdates,x=a[C],x===null?a[C]=[l]:x.push(l),l.lane=h|536870912),_):null}function bp(a){if(50<Gd)throw Gd=0,Sb=null,Error(r(185));for(var l=a.return;l!==null;)a=l,l=a.return;return a.tag===3?a.stateNode:null}var Mc={};function $5(a,l,h,x){this.tag=a,this.key=h,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=l,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=x,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Po(a,l,h,x){return new $5(a,l,h,x)}function pv(a){return a=a.prototype,!(!a||!a.isReactComponent)}function Ss(a,l){var h=a.alternate;return h===null?(h=Po(a.tag,l,a.key,a.mode),h.elementType=a.elementType,h.type=a.type,h.stateNode=a.stateNode,h.alternate=a,a.alternate=h):(h.pendingProps=l,h.type=a.type,h.flags=0,h.subtreeFlags=0,h.deletions=null),h.flags=a.flags&65011712,h.childLanes=a.childLanes,h.lanes=a.lanes,h.child=a.child,h.memoizedProps=a.memoizedProps,h.memoizedState=a.memoizedState,h.updateQueue=a.updateQueue,l=a.dependencies,h.dependencies=l===null?null:{lanes:l.lanes,firstContext:l.firstContext},h.sibling=a.sibling,h.index=a.index,h.ref=a.ref,h.refCleanup=a.refCleanup,h}function Pk(a,l){a.flags&=65011714;var h=a.alternate;return h===null?(a.childLanes=0,a.lanes=l,a.child=null,a.subtreeFlags=0,a.memoizedProps=null,a.memoizedState=null,a.updateQueue=null,a.dependencies=null,a.stateNode=null):(a.childLanes=h.childLanes,a.lanes=h.lanes,a.child=h.child,a.subtreeFlags=0,a.deletions=null,a.memoizedProps=h.memoizedProps,a.memoizedState=h.memoizedState,a.updateQueue=h.updateQueue,a.type=h.type,l=h.dependencies,a.dependencies=l===null?null:{lanes:l.lanes,firstContext:l.firstContext}),a}function wp(a,l,h,x,C,_){var V=0;if(x=a,typeof a=="function")pv(a)&&(V=1);else if(typeof a=="string")V=qV(a,h,X.current)?26:a==="html"||a==="head"||a==="body"?27:5;else e:switch(a){case O:return a=Po(31,h,l,C),a.elementType=O,a.lanes=_,a;case S:return xl(h.children,C,_,l);case w:V=8,C|=24;break;case E:return a=Po(12,h,l,C|2),a.elementType=E,a.lanes=_,a;case A:return a=Po(13,h,l,C),a.elementType=A,a.lanes=_,a;case R:return a=Po(19,h,l,C),a.elementType=R,a.lanes=_,a;default:if(typeof a=="object"&&a!==null)switch(a.$$typeof){case j:V=10;break e;case k:V=9;break e;case N:V=11;break e;case M:V=14;break e;case T:V=16,x=null;break e}V=29,h=Error(r(130,a===null?"null":typeof a,"")),x=null}return l=Po(V,h,l,C),l.elementType=a,l.type=x,l.lanes=_,l}function xl(a,l,h,x){return a=Po(7,a,x,l),a.lanes=h,a}function mv(a,l,h){return a=Po(6,a,null,l),a.lanes=h,a}function Ik(a){var l=Po(18,null,null,0);return l.stateNode=a,l}function gv(a,l,h){return l=Po(4,a.children!==null?a.children:[],a.key,l),l.lanes=h,l.stateNode={containerInfo:a.containerInfo,pendingChildren:null,implementation:a.implementation},l}var zk=new WeakMap;function ti(a,l){if(typeof a=="object"&&a!==null){var h=zk.get(a);return h!==void 0?h:(l={value:a,source:l,stack:$e(l)},zk.set(a,l),l)}return{value:a,source:l,stack:$e(l)}}var Ac=[],Oc=0,Sp=null,Rd=0,ni=[],ri=0,ha=null,Yi=1,Zi="";function Es(a,l){Ac[Oc++]=Rd,Ac[Oc++]=Sp,Sp=a,Rd=l}function Lk(a,l,h){ni[ri++]=Yi,ni[ri++]=Zi,ni[ri++]=ha,ha=a;var x=Yi;a=Zi;var C=32-ve(x)-1;x&=~(1<<C),h+=1;var _=32-ve(l)+C;if(30<_){var V=C-C%5;_=(x&(1<<V)-1).toString(32),x>>=V,C-=V,Yi=1<<32-ve(l)+C|h<<C|x,Zi=_+a}else Yi=1<<_|h<<C|x,Zi=a}function yv(a){a.return!==null&&(Es(a,1),Lk(a,1,0))}function xv(a){for(;a===Sp;)Sp=Ac[--Oc],Ac[Oc]=null,Rd=Ac[--Oc],Ac[Oc]=null;for(;a===ha;)ha=ni[--ri],ni[ri]=null,Zi=ni[--ri],ni[ri]=null,Yi=ni[--ri],ni[ri]=null}function Fk(a,l){ni[ri++]=Yi,ni[ri++]=Zi,ni[ri++]=ha,Yi=l.id,Zi=l.overflow,ha=a}var Fr=null,qn=null,dn=!1,pa=null,oi=!1,vv=Error(r(519));function ma(a){var l=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw _d(ti(l,a)),vv}function $k(a){var l=a.stateNode,h=a.type,x=a.memoizedProps;switch(l[Xe]=a,l[et]=x,h){case"dialog":nn("cancel",l),nn("close",l);break;case"iframe":case"object":case"embed":nn("load",l);break;case"video":case"audio":for(h=0;h<Xd.length;h++)nn(Xd[h],l);break;case"source":nn("error",l);break;case"img":case"image":case"link":nn("error",l),nn("load",l);break;case"details":nn("toggle",l);break;case"input":nn("invalid",l),Ec(l,x.value,x.defaultValue,x.checked,x.defaultChecked,x.type,x.name,!0);break;case"select":nn("invalid",l);break;case"textarea":nn("invalid",l),tk(l,x.value,x.defaultValue,x.children)}h=x.children,typeof h!="string"&&typeof h!="number"&&typeof h!="bigint"||l.textContent===""+h||x.suppressHydrationWarning===!0||r_(l.textContent,h)?(x.popover!=null&&(nn("beforetoggle",l),nn("toggle",l)),x.onScroll!=null&&nn("scroll",l),x.onScrollEnd!=null&&nn("scrollend",l),x.onClick!=null&&(l.onclick=bs),l=!0):l=!1,l||ma(a,!0)}function Vk(a){for(Fr=a.return;Fr;)switch(Fr.tag){case 5:case 31:case 13:oi=!1;return;case 27:case 3:oi=!0;return;default:Fr=Fr.return}}function Dc(a){if(a!==Fr)return!1;if(!dn)return Vk(a),dn=!0,!1;var l=a.tag,h;if((h=l!==3&&l!==27)&&((h=l===5)&&(h=a.type,h=!(h!=="form"&&h!=="button")||zb(a.type,a.memoizedProps)),h=!h),h&&qn&&ma(a),Vk(a),l===13){if(a=a.memoizedState,a=a!==null?a.dehydrated:null,!a)throw Error(r(317));qn=f_(a)}else if(l===31){if(a=a.memoizedState,a=a!==null?a.dehydrated:null,!a)throw Error(r(317));qn=f_(a)}else l===27?(l=qn,Na(a.type)?(a=Bb,Bb=null,qn=a):qn=l):qn=Fr?si(a.stateNode.nextSibling):null;return!0}function vl(){qn=Fr=null,dn=!1}function bv(){var a=pa;return a!==null&&(xo===null?xo=a:xo.push.apply(xo,a),pa=null),a}function _d(a){pa===null?pa=[a]:pa.push(a)}var wv=H(null),bl=null,Cs=null;function ga(a,l,h){B(wv,l._currentValue),l._currentValue=h}function ks(a){a._currentValue=wv.current,U(wv)}function Sv(a,l,h){for(;a!==null;){var x=a.alternate;if((a.childLanes&l)!==l?(a.childLanes|=l,x!==null&&(x.childLanes|=l)):x!==null&&(x.childLanes&l)!==l&&(x.childLanes|=l),a===h)break;a=a.return}}function Ev(a,l,h,x){var C=a.child;for(C!==null&&(C.return=a);C!==null;){var _=C.dependencies;if(_!==null){var V=C.child;_=_.firstContext;e:for(;_!==null;){var K=_;_=C;for(var se=0;se<l.length;se++)if(K.context===l[se]){_.lanes|=h,K=_.alternate,K!==null&&(K.lanes|=h),Sv(_.return,h,a),x||(V=null);break e}_=K.next}}else if(C.tag===18){if(V=C.return,V===null)throw Error(r(341));V.lanes|=h,_=V.alternate,_!==null&&(_.lanes|=h),Sv(V,h,a),V=null}else V=C.child;if(V!==null)V.return=C;else for(V=C;V!==null;){if(V===a){V=null;break}if(C=V.sibling,C!==null){C.return=V.return,V=C;break}V=V.return}C=V}}function Pc(a,l,h,x){a=null;for(var C=l,_=!1;C!==null;){if(!_){if((C.flags&524288)!==0)_=!0;else if((C.flags&262144)!==0)break}if(C.tag===10){var V=C.alternate;if(V===null)throw Error(r(387));if(V=V.memoizedProps,V!==null){var K=C.type;Do(C.pendingProps.value,V.value)||(a!==null?a.push(K):a=[K])}}else if(C===oe.current){if(V=C.alternate,V===null)throw Error(r(387));V.memoizedState.memoizedState!==C.memoizedState.memoizedState&&(a!==null?a.push(tf):a=[tf])}C=C.return}a!==null&&Ev(l,a,h,x),l.flags|=262144}function Ep(a){for(a=a.firstContext;a!==null;){if(!Do(a.context._currentValue,a.memoizedValue))return!0;a=a.next}return!1}function wl(a){bl=a,Cs=null,a=a.dependencies,a!==null&&(a.firstContext=null)}function $r(a){return Bk(bl,a)}function Cp(a,l){return bl===null&&wl(a),Bk(a,l)}function Bk(a,l){var h=l._currentValue;if(l={context:l,memoizedValue:h,next:null},Cs===null){if(a===null)throw Error(r(308));Cs=l,a.dependencies={lanes:0,firstContext:l},a.flags|=524288}else Cs=Cs.next=l;return h}var V5=typeof AbortController<"u"?AbortController:function(){var a=[],l=this.signal={aborted:!1,addEventListener:function(h,x){a.push(x)}};this.abort=function(){l.aborted=!0,a.forEach(function(h){return h()})}},B5=e.unstable_scheduleCallback,H5=e.unstable_NormalPriority,yr={$$typeof:j,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Cv(){return{controller:new V5,data:new Map,refCount:0}}function Nd(a){a.refCount--,a.refCount===0&&B5(H5,function(){a.controller.abort()})}var Td=null,kv=0,Ic=0,zc=null;function U5(a,l){if(Td===null){var h=Td=[];kv=0,Ic=_b(),zc={status:"pending",value:void 0,then:function(x){h.push(x)}}}return kv++,l.then(Hk,Hk),l}function Hk(){if(--kv===0&&Td!==null){zc!==null&&(zc.status="fulfilled");var a=Td;Td=null,Ic=0,zc=null;for(var l=0;l<a.length;l++)(0,a[l])()}}function q5(a,l){var h=[],x={status:"pending",value:null,reason:null,then:function(C){h.push(C)}};return a.then(function(){x.status="fulfilled",x.value=l;for(var C=0;C<h.length;C++)(0,h[C])(l)},function(C){for(x.status="rejected",x.reason=C,C=0;C<h.length;C++)(0,h[C])(void 0)}),x}var Uk=P.S;P.S=function(a,l){RR=me(),typeof l=="object"&&l!==null&&typeof l.then=="function"&&U5(a,l),Uk!==null&&Uk(a,l)};var Sl=H(null);function jv(){var a=Sl.current;return a!==null?a:Ln.pooledCache}function kp(a,l){l===null?B(Sl,Sl.current):B(Sl,l.pool)}function qk(){var a=jv();return a===null?null:{parent:yr._currentValue,pool:a}}var Lc=Error(r(460)),Rv=Error(r(474)),jp=Error(r(542)),Rp={then:function(){}};function Yk(a){return a=a.status,a==="fulfilled"||a==="rejected"}function Zk(a,l,h){switch(h=a[h],h===void 0?a.push(l):h!==l&&(l.then(bs,bs),l=h),l.status){case"fulfilled":return l.value;case"rejected":throw a=l.reason,Kk(a),a;default:if(typeof l.status=="string")l.then(bs,bs);else{if(a=Ln,a!==null&&100<a.shellSuspendCounter)throw Error(r(482));a=l,a.status="pending",a.then(function(x){if(l.status==="pending"){var C=l;C.status="fulfilled",C.value=x}},function(x){if(l.status==="pending"){var C=l;C.status="rejected",C.reason=x}})}switch(l.status){case"fulfilled":return l.value;case"rejected":throw a=l.reason,Kk(a),a}throw Cl=l,Lc}}function El(a){try{var l=a._init;return l(a._payload)}catch(h){throw h!==null&&typeof h=="object"&&typeof h.then=="function"?(Cl=h,Lc):h}}var Cl=null;function Gk(){if(Cl===null)throw Error(r(459));var a=Cl;return Cl=null,a}function Kk(a){if(a===Lc||a===jp)throw Error(r(483))}var Fc=null,Md=0;function _p(a){var l=Md;return Md+=1,Fc===null&&(Fc=[]),Zk(Fc,a,l)}function Ad(a,l){l=l.props.ref,a.ref=l!==void 0?l:null}function Np(a,l){throw l.$$typeof===g?Error(r(525)):(a=Object.prototype.toString.call(l),Error(r(31,a==="[object Object]"?"object with keys {"+Object.keys(l).join(", ")+"}":a)))}function Xk(a){function l(he,ce){if(a){var ye=he.deletions;ye===null?(he.deletions=[ce],he.flags|=16):ye.push(ce)}}function h(he,ce){if(!a)return null;for(;ce!==null;)l(he,ce),ce=ce.sibling;return null}function x(he){for(var ce=new Map;he!==null;)he.key!==null?ce.set(he.key,he):ce.set(he.index,he),he=he.sibling;return ce}function C(he,ce){return he=Ss(he,ce),he.index=0,he.sibling=null,he}function _(he,ce,ye){return he.index=ye,a?(ye=he.alternate,ye!==null?(ye=ye.index,ye<ce?(he.flags|=67108866,ce):ye):(he.flags|=67108866,ce)):(he.flags|=1048576,ce)}function V(he){return a&&he.alternate===null&&(he.flags|=67108866),he}function K(he,ce,ye,Ie){return ce===null||ce.tag!==6?(ce=mv(ye,he.mode,Ie),ce.return=he,ce):(ce=C(ce,ye),ce.return=he,ce)}function se(he,ce,ye,Ie){var gt=ye.type;return gt===S?Oe(he,ce,ye.props.children,Ie,ye.key):ce!==null&&(ce.elementType===gt||typeof gt=="object"&&gt!==null&&gt.$$typeof===T&&El(gt)===ce.type)?(ce=C(ce,ye.props),Ad(ce,ye),ce.return=he,ce):(ce=wp(ye.type,ye.key,ye.props,null,he.mode,Ie),Ad(ce,ye),ce.return=he,ce)}function xe(he,ce,ye,Ie){return ce===null||ce.tag!==4||ce.stateNode.containerInfo!==ye.containerInfo||ce.stateNode.implementation!==ye.implementation?(ce=gv(ye,he.mode,Ie),ce.return=he,ce):(ce=C(ce,ye.children||[]),ce.return=he,ce)}function Oe(he,ce,ye,Ie,gt){return ce===null||ce.tag!==7?(ce=xl(ye,he.mode,Ie,gt),ce.return=he,ce):(ce=C(ce,ye),ce.return=he,ce)}function Fe(he,ce,ye){if(typeof ce=="string"&&ce!==""||typeof ce=="number"||typeof ce=="bigint")return ce=mv(""+ce,he.mode,ye),ce.return=he,ce;if(typeof ce=="object"&&ce!==null){switch(ce.$$typeof){case y:return ye=wp(ce.type,ce.key,ce.props,null,he.mode,ye),Ad(ye,ce),ye.return=he,ye;case v:return ce=gv(ce,he.mode,ye),ce.return=he,ce;case T:return ce=El(ce),Fe(he,ce,ye)}if(F(ce)||$(ce))return ce=xl(ce,he.mode,ye,null),ce.return=he,ce;if(typeof ce.then=="function")return Fe(he,_p(ce),ye);if(ce.$$typeof===j)return Fe(he,Cp(he,ce),ye);Np(he,ce)}return null}function be(he,ce,ye,Ie){var gt=ce!==null?ce.key:null;if(typeof ye=="string"&&ye!==""||typeof ye=="number"||typeof ye=="bigint")return gt!==null?null:K(he,ce,""+ye,Ie);if(typeof ye=="object"&&ye!==null){switch(ye.$$typeof){case y:return ye.key===gt?se(he,ce,ye,Ie):null;case v:return ye.key===gt?xe(he,ce,ye,Ie):null;case T:return ye=El(ye),be(he,ce,ye,Ie)}if(F(ye)||$(ye))return gt!==null?null:Oe(he,ce,ye,Ie,null);if(typeof ye.then=="function")return be(he,ce,_p(ye),Ie);if(ye.$$typeof===j)return be(he,ce,Cp(he,ye),Ie);Np(he,ye)}return null}function Re(he,ce,ye,Ie,gt){if(typeof Ie=="string"&&Ie!==""||typeof Ie=="number"||typeof Ie=="bigint")return he=he.get(ye)||null,K(ce,he,""+Ie,gt);if(typeof Ie=="object"&&Ie!==null){switch(Ie.$$typeof){case y:return he=he.get(Ie.key===null?ye:Ie.key)||null,se(ce,he,Ie,gt);case v:return he=he.get(Ie.key===null?ye:Ie.key)||null,xe(ce,he,Ie,gt);case T:return Ie=El(Ie),Re(he,ce,ye,Ie,gt)}if(F(Ie)||$(Ie))return he=he.get(ye)||null,Oe(ce,he,Ie,gt,null);if(typeof Ie.then=="function")return Re(he,ce,ye,_p(Ie),gt);if(Ie.$$typeof===j)return Re(he,ce,ye,Cp(ce,Ie),gt);Np(ce,Ie)}return null}function ut(he,ce,ye,Ie){for(var gt=null,vn=null,ht=ce,Yt=ce=0,ln=null;ht!==null&&Yt<ye.length;Yt++){ht.index>Yt?(ln=ht,ht=null):ln=ht.sibling;var bn=be(he,ht,ye[Yt],Ie);if(bn===null){ht===null&&(ht=ln);break}a&&ht&&bn.alternate===null&&l(he,ht),ce=_(bn,ce,Yt),vn===null?gt=bn:vn.sibling=bn,vn=bn,ht=ln}if(Yt===ye.length)return h(he,ht),dn&&Es(he,Yt),gt;if(ht===null){for(;Yt<ye.length;Yt++)ht=Fe(he,ye[Yt],Ie),ht!==null&&(ce=_(ht,ce,Yt),vn===null?gt=ht:vn.sibling=ht,vn=ht);return dn&&Es(he,Yt),gt}for(ht=x(ht);Yt<ye.length;Yt++)ln=Re(ht,he,Yt,ye[Yt],Ie),ln!==null&&(a&&ln.alternate!==null&&ht.delete(ln.key===null?Yt:ln.key),ce=_(ln,ce,Yt),vn===null?gt=ln:vn.sibling=ln,vn=ln);return a&&ht.forEach(function(Da){return l(he,Da)}),dn&&Es(he,Yt),gt}function Et(he,ce,ye,Ie){if(ye==null)throw Error(r(151));for(var gt=null,vn=null,ht=ce,Yt=ce=0,ln=null,bn=ye.next();ht!==null&&!bn.done;Yt++,bn=ye.next()){ht.index>Yt?(ln=ht,ht=null):ln=ht.sibling;var Da=be(he,ht,bn.value,Ie);if(Da===null){ht===null&&(ht=ln);break}a&&ht&&Da.alternate===null&&l(he,ht),ce=_(Da,ce,Yt),vn===null?gt=Da:vn.sibling=Da,vn=Da,ht=ln}if(bn.done)return h(he,ht),dn&&Es(he,Yt),gt;if(ht===null){for(;!bn.done;Yt++,bn=ye.next())bn=Fe(he,bn.value,Ie),bn!==null&&(ce=_(bn,ce,Yt),vn===null?gt=bn:vn.sibling=bn,vn=bn);return dn&&Es(he,Yt),gt}for(ht=x(ht);!bn.done;Yt++,bn=ye.next())bn=Re(ht,he,Yt,bn.value,Ie),bn!==null&&(a&&bn.alternate!==null&&ht.delete(bn.key===null?Yt:bn.key),ce=_(bn,ce,Yt),vn===null?gt=bn:vn.sibling=bn,vn=bn);return a&&ht.forEach(function(nB){return l(he,nB)}),dn&&Es(he,Yt),gt}function An(he,ce,ye,Ie){if(typeof ye=="object"&&ye!==null&&ye.type===S&&ye.key===null&&(ye=ye.props.children),typeof ye=="object"&&ye!==null){switch(ye.$$typeof){case y:e:{for(var gt=ye.key;ce!==null;){if(ce.key===gt){if(gt=ye.type,gt===S){if(ce.tag===7){h(he,ce.sibling),Ie=C(ce,ye.props.children),Ie.return=he,he=Ie;break e}}else if(ce.elementType===gt||typeof gt=="object"&&gt!==null&&gt.$$typeof===T&&El(gt)===ce.type){h(he,ce.sibling),Ie=C(ce,ye.props),Ad(Ie,ye),Ie.return=he,he=Ie;break e}h(he,ce);break}else l(he,ce);ce=ce.sibling}ye.type===S?(Ie=xl(ye.props.children,he.mode,Ie,ye.key),Ie.return=he,he=Ie):(Ie=wp(ye.type,ye.key,ye.props,null,he.mode,Ie),Ad(Ie,ye),Ie.return=he,he=Ie)}return V(he);case v:e:{for(gt=ye.key;ce!==null;){if(ce.key===gt)if(ce.tag===4&&ce.stateNode.containerInfo===ye.containerInfo&&ce.stateNode.implementation===ye.implementation){h(he,ce.sibling),Ie=C(ce,ye.children||[]),Ie.return=he,he=Ie;break e}else{h(he,ce);break}else l(he,ce);ce=ce.sibling}Ie=gv(ye,he.mode,Ie),Ie.return=he,he=Ie}return V(he);case T:return ye=El(ye),An(he,ce,ye,Ie)}if(F(ye))return ut(he,ce,ye,Ie);if($(ye)){if(gt=$(ye),typeof gt!="function")throw Error(r(150));return ye=gt.call(ye),Et(he,ce,ye,Ie)}if(typeof ye.then=="function")return An(he,ce,_p(ye),Ie);if(ye.$$typeof===j)return An(he,ce,Cp(he,ye),Ie);Np(he,ye)}return typeof ye=="string"&&ye!==""||typeof ye=="number"||typeof ye=="bigint"?(ye=""+ye,ce!==null&&ce.tag===6?(h(he,ce.sibling),Ie=C(ce,ye),Ie.return=he,he=Ie):(h(he,ce),Ie=mv(ye,he.mode,Ie),Ie.return=he,he=Ie),V(he)):h(he,ce)}return function(he,ce,ye,Ie){try{Md=0;var gt=An(he,ce,ye,Ie);return Fc=null,gt}catch(ht){if(ht===Lc||ht===jp)throw ht;var vn=Po(29,ht,null,he.mode);return vn.lanes=Ie,vn.return=he,vn}}}var kl=Xk(!0),Qk=Xk(!1),ya=!1;function _v(a){a.updateQueue={baseState:a.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Nv(a,l){a=a.updateQueue,l.updateQueue===a&&(l.updateQueue={baseState:a.baseState,firstBaseUpdate:a.firstBaseUpdate,lastBaseUpdate:a.lastBaseUpdate,shared:a.shared,callbacks:null})}function xa(a){return{lane:a,tag:0,payload:null,callback:null,next:null}}function va(a,l,h){var x=a.updateQueue;if(x===null)return null;if(x=x.shared,(En&2)!==0){var C=x.pending;return C===null?l.next=l:(l.next=C.next,C.next=l),x.pending=l,l=bp(a),Dk(a,null,h),l}return vp(a,x,l,h),bp(a)}function Od(a,l,h){if(l=l.updateQueue,l!==null&&(l=l.shared,(h&4194048)!==0)){var x=l.lanes;x&=a.pendingLanes,h|=x,l.lanes=h,In(a,h)}}function Tv(a,l){var h=a.updateQueue,x=a.alternate;if(x!==null&&(x=x.updateQueue,h===x)){var C=null,_=null;if(h=h.firstBaseUpdate,h!==null){do{var V={lane:h.lane,tag:h.tag,payload:h.payload,callback:null,next:null};_===null?C=_=V:_=_.next=V,h=h.next}while(h!==null);_===null?C=_=l:_=_.next=l}else C=_=l;h={baseState:x.baseState,firstBaseUpdate:C,lastBaseUpdate:_,shared:x.shared,callbacks:x.callbacks},a.updateQueue=h;return}a=h.lastBaseUpdate,a===null?h.firstBaseUpdate=l:a.next=l,h.lastBaseUpdate=l}var Mv=!1;function Dd(){if(Mv){var a=zc;if(a!==null)throw a}}function Pd(a,l,h,x){Mv=!1;var C=a.updateQueue;ya=!1;var _=C.firstBaseUpdate,V=C.lastBaseUpdate,K=C.shared.pending;if(K!==null){C.shared.pending=null;var se=K,xe=se.next;se.next=null,V===null?_=xe:V.next=xe,V=se;var Oe=a.alternate;Oe!==null&&(Oe=Oe.updateQueue,K=Oe.lastBaseUpdate,K!==V&&(K===null?Oe.firstBaseUpdate=xe:K.next=xe,Oe.lastBaseUpdate=se))}if(_!==null){var Fe=C.baseState;V=0,Oe=xe=se=null,K=_;do{var be=K.lane&-536870913,Re=be!==K.lane;if(Re?(an&be)===be:(x&be)===be){be!==0&&be===Ic&&(Mv=!0),Oe!==null&&(Oe=Oe.next={lane:0,tag:K.tag,payload:K.payload,callback:null,next:null});e:{var ut=a,Et=K;be=l;var An=h;switch(Et.tag){case 1:if(ut=Et.payload,typeof ut=="function"){Fe=ut.call(An,Fe,be);break e}Fe=ut;break e;case 3:ut.flags=ut.flags&-65537|128;case 0:if(ut=Et.payload,be=typeof ut=="function"?ut.call(An,Fe,be):ut,be==null)break e;Fe=m({},Fe,be);break e;case 2:ya=!0}}be=K.callback,be!==null&&(a.flags|=64,Re&&(a.flags|=8192),Re=C.callbacks,Re===null?C.callbacks=[be]:Re.push(be))}else Re={lane:be,tag:K.tag,payload:K.payload,callback:K.callback,next:null},Oe===null?(xe=Oe=Re,se=Fe):Oe=Oe.next=Re,V|=be;if(K=K.next,K===null){if(K=C.shared.pending,K===null)break;Re=K,K=Re.next,Re.next=null,C.lastBaseUpdate=Re,C.shared.pending=null}}while(!0);Oe===null&&(se=Fe),C.baseState=se,C.firstBaseUpdate=xe,C.lastBaseUpdate=Oe,_===null&&(C.shared.lanes=0),Ca|=V,a.lanes=V,a.memoizedState=Fe}}function Wk(a,l){if(typeof a!="function")throw Error(r(191,a));a.call(l)}function Jk(a,l){var h=a.callbacks;if(h!==null)for(a.callbacks=null,a=0;a<h.length;a++)Wk(h[a],l)}var $c=H(null),Tp=H(0);function ej(a,l){a=Ds,B(Tp,a),B($c,l),Ds=a|l.baseLanes}function Av(){B(Tp,Ds),B($c,$c.current)}function Ov(){Ds=Tp.current,U($c),U(Tp)}var Io=H(null),ii=null;function ba(a){var l=a.alternate;B(cr,cr.current&1),B(Io,a),ii===null&&(l===null||$c.current!==null||l.memoizedState!==null)&&(ii=a)}function Dv(a){B(cr,cr.current),B(Io,a),ii===null&&(ii=a)}function tj(a){a.tag===22?(B(cr,cr.current),B(Io,a),ii===null&&(ii=a)):wa()}function wa(){B(cr,cr.current),B(Io,Io.current)}function zo(a){U(Io),ii===a&&(ii=null),U(cr)}var cr=H(0);function Mp(a){for(var l=a;l!==null;){if(l.tag===13){var h=l.memoizedState;if(h!==null&&(h=h.dehydrated,h===null||$b(h)||Vb(h)))return l}else if(l.tag===19&&(l.memoizedProps.revealOrder==="forwards"||l.memoizedProps.revealOrder==="backwards"||l.memoizedProps.revealOrder==="unstable_legacy-backwards"||l.memoizedProps.revealOrder==="together")){if((l.flags&128)!==0)return l}else if(l.child!==null){l.child.return=l,l=l.child;continue}if(l===a)break;for(;l.sibling===null;){if(l.return===null||l.return===a)return null;l=l.return}l.sibling.return=l.return,l=l.sibling}return null}var js=0,Ht=null,Tn=null,xr=null,Ap=!1,Vc=!1,jl=!1,Op=0,Id=0,Bc=null,Y5=0;function sr(){throw Error(r(321))}function Pv(a,l){if(l===null)return!1;for(var h=0;h<l.length&&h<a.length;h++)if(!Do(a[h],l[h]))return!1;return!0}function Iv(a,l,h,x,C,_){return js=_,Ht=l,l.memoizedState=null,l.updateQueue=null,l.lanes=0,P.H=a===null||a.memoizedState===null?Lj:Qv,jl=!1,_=h(x,C),jl=!1,Vc&&(_=rj(l,h,x,C)),nj(a),_}function nj(a){P.H=Fd;var l=Tn!==null&&Tn.next!==null;if(js=0,xr=Tn=Ht=null,Ap=!1,Id=0,Bc=null,l)throw Error(r(300));a===null||vr||(a=a.dependencies,a!==null&&Ep(a)&&(vr=!0))}function rj(a,l,h,x){Ht=a;var C=0;do{if(Vc&&(Bc=null),Id=0,Vc=!1,25<=C)throw Error(r(301));if(C+=1,xr=Tn=null,a.updateQueue!=null){var _=a.updateQueue;_.lastEffect=null,_.events=null,_.stores=null,_.memoCache!=null&&(_.memoCache.index=0)}P.H=Fj,_=l(h,x)}while(Vc);return _}function Z5(){var a=P.H,l=a.useState()[0];return l=typeof l.then=="function"?zd(l):l,a=a.useState()[0],(Tn!==null?Tn.memoizedState:null)!==a&&(Ht.flags|=1024),l}function zv(){var a=Op!==0;return Op=0,a}function Lv(a,l,h){l.updateQueue=a.updateQueue,l.flags&=-2053,a.lanes&=~h}function Fv(a){if(Ap){for(a=a.memoizedState;a!==null;){var l=a.queue;l!==null&&(l.pending=null),a=a.next}Ap=!1}js=0,xr=Tn=Ht=null,Vc=!1,Id=Op=0,Bc=null}function so(){var a={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return xr===null?Ht.memoizedState=xr=a:xr=xr.next=a,xr}function ur(){if(Tn===null){var a=Ht.alternate;a=a!==null?a.memoizedState:null}else a=Tn.next;var l=xr===null?Ht.memoizedState:xr.next;if(l!==null)xr=l,Tn=a;else{if(a===null)throw Ht.alternate===null?Error(r(467)):Error(r(310));Tn=a,a={memoizedState:Tn.memoizedState,baseState:Tn.baseState,baseQueue:Tn.baseQueue,queue:Tn.queue,next:null},xr===null?Ht.memoizedState=xr=a:xr=xr.next=a}return xr}function Dp(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function zd(a){var l=Id;return Id+=1,Bc===null&&(Bc=[]),a=Zk(Bc,a,l),l=Ht,(xr===null?l.memoizedState:xr.next)===null&&(l=l.alternate,P.H=l===null||l.memoizedState===null?Lj:Qv),a}function Pp(a){if(a!==null&&typeof a=="object"){if(typeof a.then=="function")return zd(a);if(a.$$typeof===j)return $r(a)}throw Error(r(438,String(a)))}function $v(a){var l=null,h=Ht.updateQueue;if(h!==null&&(l=h.memoCache),l==null){var x=Ht.alternate;x!==null&&(x=x.updateQueue,x!==null&&(x=x.memoCache,x!=null&&(l={data:x.data.map(function(C){return C.slice()}),index:0})))}if(l==null&&(l={data:[],index:0}),h===null&&(h=Dp(),Ht.updateQueue=h),h.memoCache=l,h=l.data[l.index],h===void 0)for(h=l.data[l.index]=Array(a),x=0;x<a;x++)h[x]=z;return l.index++,h}function Rs(a,l){return typeof l=="function"?l(a):l}function Ip(a){var l=ur();return Vv(l,Tn,a)}function Vv(a,l,h){var x=a.queue;if(x===null)throw Error(r(311));x.lastRenderedReducer=h;var C=a.baseQueue,_=x.pending;if(_!==null){if(C!==null){var V=C.next;C.next=_.next,_.next=V}l.baseQueue=C=_,x.pending=null}if(_=a.baseState,C===null)a.memoizedState=_;else{l=C.next;var K=V=null,se=null,xe=l,Oe=!1;do{var Fe=xe.lane&-536870913;if(Fe!==xe.lane?(an&Fe)===Fe:(js&Fe)===Fe){var be=xe.revertLane;if(be===0)se!==null&&(se=se.next={lane:0,revertLane:0,gesture:null,action:xe.action,hasEagerState:xe.hasEagerState,eagerState:xe.eagerState,next:null}),Fe===Ic&&(Oe=!0);else if((js&be)===be){xe=xe.next,be===Ic&&(Oe=!0);continue}else Fe={lane:0,revertLane:xe.revertLane,gesture:null,action:xe.action,hasEagerState:xe.hasEagerState,eagerState:xe.eagerState,next:null},se===null?(K=se=Fe,V=_):se=se.next=Fe,Ht.lanes|=be,Ca|=be;Fe=xe.action,jl&&h(_,Fe),_=xe.hasEagerState?xe.eagerState:h(_,Fe)}else be={lane:Fe,revertLane:xe.revertLane,gesture:xe.gesture,action:xe.action,hasEagerState:xe.hasEagerState,eagerState:xe.eagerState,next:null},se===null?(K=se=be,V=_):se=se.next=be,Ht.lanes|=Fe,Ca|=Fe;xe=xe.next}while(xe!==null&&xe!==l);if(se===null?V=_:se.next=K,!Do(_,a.memoizedState)&&(vr=!0,Oe&&(h=zc,h!==null)))throw h;a.memoizedState=_,a.baseState=V,a.baseQueue=se,x.lastRenderedState=_}return C===null&&(x.lanes=0),[a.memoizedState,x.dispatch]}function Bv(a){var l=ur(),h=l.queue;if(h===null)throw Error(r(311));h.lastRenderedReducer=a;var x=h.dispatch,C=h.pending,_=l.memoizedState;if(C!==null){h.pending=null;var V=C=C.next;do _=a(_,V.action),V=V.next;while(V!==C);Do(_,l.memoizedState)||(vr=!0),l.memoizedState=_,l.baseQueue===null&&(l.baseState=_),h.lastRenderedState=_}return[_,x]}function oj(a,l,h){var x=Ht,C=ur(),_=dn;if(_){if(h===void 0)throw Error(r(407));h=h()}else h=l();var V=!Do((Tn||C).memoizedState,h);if(V&&(C.memoizedState=h,vr=!0),C=C.queue,qv(aj.bind(null,x,C,a),[a]),C.getSnapshot!==l||V||xr!==null&&xr.memoizedState.tag&1){if(x.flags|=2048,Hc(9,{destroy:void 0},sj.bind(null,x,C,h,l),null),Ln===null)throw Error(r(349));_||(js&127)!==0||ij(x,l,h)}return h}function ij(a,l,h){a.flags|=16384,a={getSnapshot:l,value:h},l=Ht.updateQueue,l===null?(l=Dp(),Ht.updateQueue=l,l.stores=[a]):(h=l.stores,h===null?l.stores=[a]:h.push(a))}function sj(a,l,h,x){l.value=h,l.getSnapshot=x,lj(l)&&cj(a)}function aj(a,l,h){return h(function(){lj(l)&&cj(a)})}function lj(a){var l=a.getSnapshot;a=a.value;try{var h=l();return!Do(a,h)}catch{return!0}}function cj(a){var l=yl(a,2);l!==null&&vo(l,a,2)}function Hv(a){var l=so();if(typeof a=="function"){var h=a;if(a=h(),jl){Ce(!0);try{h()}finally{Ce(!1)}}}return l.memoizedState=l.baseState=a,l.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Rs,lastRenderedState:a},l}function uj(a,l,h,x){return a.baseState=h,Vv(a,Tn,typeof x=="function"?x:Rs)}function G5(a,l,h,x,C){if(Fp(a))throw Error(r(485));if(a=l.action,a!==null){var _={payload:C,action:a,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(V){_.listeners.push(V)}};P.T!==null?h(!0):_.isTransition=!1,x(_),h=l.pending,h===null?(_.next=l.pending=_,dj(l,_)):(_.next=h.next,l.pending=h.next=_)}}function dj(a,l){var h=l.action,x=l.payload,C=a.state;if(l.isTransition){var _=P.T,V={};P.T=V;try{var K=h(C,x),se=P.S;se!==null&&se(V,K),fj(a,l,K)}catch(xe){Uv(a,l,xe)}finally{_!==null&&V.types!==null&&(_.types=V.types),P.T=_}}else try{_=h(C,x),fj(a,l,_)}catch(xe){Uv(a,l,xe)}}function fj(a,l,h){h!==null&&typeof h=="object"&&typeof h.then=="function"?h.then(function(x){hj(a,l,x)},function(x){return Uv(a,l,x)}):hj(a,l,h)}function hj(a,l,h){l.status="fulfilled",l.value=h,pj(l),a.state=h,l=a.pending,l!==null&&(h=l.next,h===l?a.pending=null:(h=h.next,l.next=h,dj(a,h)))}function Uv(a,l,h){var x=a.pending;if(a.pending=null,x!==null){x=x.next;do l.status="rejected",l.reason=h,pj(l),l=l.next;while(l!==x)}a.action=null}function pj(a){a=a.listeners;for(var l=0;l<a.length;l++)(0,a[l])()}function mj(a,l){return l}function gj(a,l){if(dn){var h=Ln.formState;if(h!==null){e:{var x=Ht;if(dn){if(qn){t:{for(var C=qn,_=oi;C.nodeType!==8;){if(!_){C=null;break t}if(C=si(C.nextSibling),C===null){C=null;break t}}_=C.data,C=_==="F!"||_==="F"?C:null}if(C){qn=si(C.nextSibling),x=C.data==="F!";break e}}ma(x)}x=!1}x&&(l=h[0])}}return h=so(),h.memoizedState=h.baseState=l,x={pending:null,lanes:0,dispatch:null,lastRenderedReducer:mj,lastRenderedState:l},h.queue=x,h=Pj.bind(null,Ht,x),x.dispatch=h,x=Hv(!1),_=Xv.bind(null,Ht,!1,x.queue),x=so(),C={state:l,dispatch:null,action:a,pending:null},x.queue=C,h=G5.bind(null,Ht,C,_,h),C.dispatch=h,x.memoizedState=a,[l,h,!1]}function yj(a){var l=ur();return xj(l,Tn,a)}function xj(a,l,h){if(l=Vv(a,l,mj)[0],a=Ip(Rs)[0],typeof l=="object"&&l!==null&&typeof l.then=="function")try{var x=zd(l)}catch(V){throw V===Lc?jp:V}else x=l;l=ur();var C=l.queue,_=C.dispatch;return h!==l.memoizedState&&(Ht.flags|=2048,Hc(9,{destroy:void 0},K5.bind(null,C,h),null)),[x,_,a]}function K5(a,l){a.action=l}function vj(a){var l=ur(),h=Tn;if(h!==null)return xj(l,h,a);ur(),l=l.memoizedState,h=ur();var x=h.queue.dispatch;return h.memoizedState=a,[l,x,!1]}function Hc(a,l,h,x){return a={tag:a,create:h,deps:x,inst:l,next:null},l=Ht.updateQueue,l===null&&(l=Dp(),Ht.updateQueue=l),h=l.lastEffect,h===null?l.lastEffect=a.next=a:(x=h.next,h.next=a,a.next=x,l.lastEffect=a),a}function bj(){return ur().memoizedState}function zp(a,l,h,x){var C=so();Ht.flags|=a,C.memoizedState=Hc(1|l,{destroy:void 0},h,x===void 0?null:x)}function Lp(a,l,h,x){var C=ur();x=x===void 0?null:x;var _=C.memoizedState.inst;Tn!==null&&x!==null&&Pv(x,Tn.memoizedState.deps)?C.memoizedState=Hc(l,_,h,x):(Ht.flags|=a,C.memoizedState=Hc(1|l,_,h,x))}function wj(a,l){zp(8390656,8,a,l)}function qv(a,l){Lp(2048,8,a,l)}function X5(a){Ht.flags|=4;var l=Ht.updateQueue;if(l===null)l=Dp(),Ht.updateQueue=l,l.events=[a];else{var h=l.events;h===null?l.events=[a]:h.push(a)}}function Sj(a){var l=ur().memoizedState;return X5({ref:l,nextImpl:a}),function(){if((En&2)!==0)throw Error(r(440));return l.impl.apply(void 0,arguments)}}function Ej(a,l){return Lp(4,2,a,l)}function Cj(a,l){return Lp(4,4,a,l)}function kj(a,l){if(typeof l=="function"){a=a();var h=l(a);return function(){typeof h=="function"?h():l(null)}}if(l!=null)return a=a(),l.current=a,function(){l.current=null}}function jj(a,l,h){h=h!=null?h.concat([a]):null,Lp(4,4,kj.bind(null,l,a),h)}function Yv(){}function Rj(a,l){var h=ur();l=l===void 0?null:l;var x=h.memoizedState;return l!==null&&Pv(l,x[1])?x[0]:(h.memoizedState=[a,l],a)}function _j(a,l){var h=ur();l=l===void 0?null:l;var x=h.memoizedState;if(l!==null&&Pv(l,x[1]))return x[0];if(x=a(),jl){Ce(!0);try{a()}finally{Ce(!1)}}return h.memoizedState=[x,l],x}function Zv(a,l,h){return h===void 0||(js&1073741824)!==0&&(an&261930)===0?a.memoizedState=l:(a.memoizedState=h,a=NR(),Ht.lanes|=a,Ca|=a,h)}function Nj(a,l,h,x){return Do(h,l)?h:$c.current!==null?(a=Zv(a,h,x),Do(a,l)||(vr=!0),a):(js&42)===0||(js&1073741824)!==0&&(an&261930)===0?(vr=!0,a.memoizedState=h):(a=NR(),Ht.lanes|=a,Ca|=a,l)}function Tj(a,l,h,x,C){var _=I.p;I.p=_!==0&&8>_?_:8;var V=P.T,K={};P.T=K,Xv(a,!1,l,h);try{var se=C(),xe=P.S;if(xe!==null&&xe(K,se),se!==null&&typeof se=="object"&&typeof se.then=="function"){var Oe=q5(se,x);Ld(a,l,Oe,$o(a))}else Ld(a,l,x,$o(a))}catch(Fe){Ld(a,l,{then:function(){},status:"rejected",reason:Fe},$o())}finally{I.p=_,V!==null&&K.types!==null&&(V.types=K.types),P.T=V}}function Q5(){}function Gv(a,l,h,x){if(a.tag!==5)throw Error(r(476));var C=Mj(a).queue;Tj(a,C,l,Y,h===null?Q5:function(){return Aj(a),h(x)})}function Mj(a){var l=a.memoizedState;if(l!==null)return l;l={memoizedState:Y,baseState:Y,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Rs,lastRenderedState:Y},next:null};var h={};return l.next={memoizedState:h,baseState:h,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Rs,lastRenderedState:h},next:null},a.memoizedState=l,a=a.alternate,a!==null&&(a.memoizedState=l),l}function Aj(a){var l=Mj(a);l.next===null&&(l=a.alternate.memoizedState),Ld(a,l.next.queue,{},$o())}function Kv(){return $r(tf)}function Oj(){return ur().memoizedState}function Dj(){return ur().memoizedState}function W5(a){for(var l=a.return;l!==null;){switch(l.tag){case 24:case 3:var h=$o();a=xa(h);var x=va(l,a,h);x!==null&&(vo(x,l,h),Od(x,l,h)),l={cache:Cv()},a.payload=l;return}l=l.return}}function J5(a,l,h){var x=$o();h={lane:x,revertLane:0,gesture:null,action:h,hasEagerState:!1,eagerState:null,next:null},Fp(a)?Ij(l,h):(h=hv(a,l,h,x),h!==null&&(vo(h,a,x),zj(h,l,x)))}function Pj(a,l,h){var x=$o();Ld(a,l,h,x)}function Ld(a,l,h,x){var C={lane:x,revertLane:0,gesture:null,action:h,hasEagerState:!1,eagerState:null,next:null};if(Fp(a))Ij(l,C);else{var _=a.alternate;if(a.lanes===0&&(_===null||_.lanes===0)&&(_=l.lastRenderedReducer,_!==null))try{var V=l.lastRenderedState,K=_(V,h);if(C.hasEagerState=!0,C.eagerState=K,Do(K,V))return vp(a,l,C,0),Ln===null&&xp(),!1}catch{}if(h=hv(a,l,C,x),h!==null)return vo(h,a,x),zj(h,l,x),!0}return!1}function Xv(a,l,h,x){if(x={lane:2,revertLane:_b(),gesture:null,action:x,hasEagerState:!1,eagerState:null,next:null},Fp(a)){if(l)throw Error(r(479))}else l=hv(a,h,x,2),l!==null&&vo(l,a,2)}function Fp(a){var l=a.alternate;return a===Ht||l!==null&&l===Ht}function Ij(a,l){Vc=Ap=!0;var h=a.pending;h===null?l.next=l:(l.next=h.next,h.next=l),a.pending=l}function zj(a,l,h){if((h&4194048)!==0){var x=l.lanes;x&=a.pendingLanes,h|=x,l.lanes=h,In(a,h)}}var Fd={readContext:$r,use:Pp,useCallback:sr,useContext:sr,useEffect:sr,useImperativeHandle:sr,useLayoutEffect:sr,useInsertionEffect:sr,useMemo:sr,useReducer:sr,useRef:sr,useState:sr,useDebugValue:sr,useDeferredValue:sr,useTransition:sr,useSyncExternalStore:sr,useId:sr,useHostTransitionStatus:sr,useFormState:sr,useActionState:sr,useOptimistic:sr,useMemoCache:sr,useCacheRefresh:sr};Fd.useEffectEvent=sr;var Lj={readContext:$r,use:Pp,useCallback:function(a,l){return so().memoizedState=[a,l===void 0?null:l],a},useContext:$r,useEffect:wj,useImperativeHandle:function(a,l,h){h=h!=null?h.concat([a]):null,zp(4194308,4,kj.bind(null,l,a),h)},useLayoutEffect:function(a,l){return zp(4194308,4,a,l)},useInsertionEffect:function(a,l){zp(4,2,a,l)},useMemo:function(a,l){var h=so();l=l===void 0?null:l;var x=a();if(jl){Ce(!0);try{a()}finally{Ce(!1)}}return h.memoizedState=[x,l],x},useReducer:function(a,l,h){var x=so();if(h!==void 0){var C=h(l);if(jl){Ce(!0);try{h(l)}finally{Ce(!1)}}}else C=l;return x.memoizedState=x.baseState=C,a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:a,lastRenderedState:C},x.queue=a,a=a.dispatch=J5.bind(null,Ht,a),[x.memoizedState,a]},useRef:function(a){var l=so();return a={current:a},l.memoizedState=a},useState:function(a){a=Hv(a);var l=a.queue,h=Pj.bind(null,Ht,l);return l.dispatch=h,[a.memoizedState,h]},useDebugValue:Yv,useDeferredValue:function(a,l){var h=so();return Zv(h,a,l)},useTransition:function(){var a=Hv(!1);return a=Tj.bind(null,Ht,a.queue,!0,!1),so().memoizedState=a,[!1,a]},useSyncExternalStore:function(a,l,h){var x=Ht,C=so();if(dn){if(h===void 0)throw Error(r(407));h=h()}else{if(h=l(),Ln===null)throw Error(r(349));(an&127)!==0||ij(x,l,h)}C.memoizedState=h;var _={value:h,getSnapshot:l};return C.queue=_,wj(aj.bind(null,x,_,a),[a]),x.flags|=2048,Hc(9,{destroy:void 0},sj.bind(null,x,_,h,l),null),h},useId:function(){var a=so(),l=Ln.identifierPrefix;if(dn){var h=Zi,x=Yi;h=(x&~(1<<32-ve(x)-1)).toString(32)+h,l="_"+l+"R_"+h,h=Op++,0<h&&(l+="H"+h.toString(32)),l+="_"}else h=Y5++,l="_"+l+"r_"+h.toString(32)+"_";return a.memoizedState=l},useHostTransitionStatus:Kv,useFormState:gj,useActionState:gj,useOptimistic:function(a){var l=so();l.memoizedState=l.baseState=a;var h={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return l.queue=h,l=Xv.bind(null,Ht,!0,h),h.dispatch=l,[a,l]},useMemoCache:$v,useCacheRefresh:function(){return so().memoizedState=W5.bind(null,Ht)},useEffectEvent:function(a){var l=so(),h={impl:a};return l.memoizedState=h,function(){if((En&2)!==0)throw Error(r(440));return h.impl.apply(void 0,arguments)}}},Qv={readContext:$r,use:Pp,useCallback:Rj,useContext:$r,useEffect:qv,useImperativeHandle:jj,useInsertionEffect:Ej,useLayoutEffect:Cj,useMemo:_j,useReducer:Ip,useRef:bj,useState:function(){return Ip(Rs)},useDebugValue:Yv,useDeferredValue:function(a,l){var h=ur();return Nj(h,Tn.memoizedState,a,l)},useTransition:function(){var a=Ip(Rs)[0],l=ur().memoizedState;return[typeof a=="boolean"?a:zd(a),l]},useSyncExternalStore:oj,useId:Oj,useHostTransitionStatus:Kv,useFormState:yj,useActionState:yj,useOptimistic:function(a,l){var h=ur();return uj(h,Tn,a,l)},useMemoCache:$v,useCacheRefresh:Dj};Qv.useEffectEvent=Sj;var Fj={readContext:$r,use:Pp,useCallback:Rj,useContext:$r,useEffect:qv,useImperativeHandle:jj,useInsertionEffect:Ej,useLayoutEffect:Cj,useMemo:_j,useReducer:Bv,useRef:bj,useState:function(){return Bv(Rs)},useDebugValue:Yv,useDeferredValue:function(a,l){var h=ur();return Tn===null?Zv(h,a,l):Nj(h,Tn.memoizedState,a,l)},useTransition:function(){var a=Bv(Rs)[0],l=ur().memoizedState;return[typeof a=="boolean"?a:zd(a),l]},useSyncExternalStore:oj,useId:Oj,useHostTransitionStatus:Kv,useFormState:vj,useActionState:vj,useOptimistic:function(a,l){var h=ur();return Tn!==null?uj(h,Tn,a,l):(h.baseState=a,[a,h.queue.dispatch])},useMemoCache:$v,useCacheRefresh:Dj};Fj.useEffectEvent=Sj;function Wv(a,l,h,x){l=a.memoizedState,h=h(x,l),h=h==null?l:m({},l,h),a.memoizedState=h,a.lanes===0&&(a.updateQueue.baseState=h)}var Jv={enqueueSetState:function(a,l,h){a=a._reactInternals;var x=$o(),C=xa(x);C.payload=l,h!=null&&(C.callback=h),l=va(a,C,x),l!==null&&(vo(l,a,x),Od(l,a,x))},enqueueReplaceState:function(a,l,h){a=a._reactInternals;var x=$o(),C=xa(x);C.tag=1,C.payload=l,h!=null&&(C.callback=h),l=va(a,C,x),l!==null&&(vo(l,a,x),Od(l,a,x))},enqueueForceUpdate:function(a,l){a=a._reactInternals;var h=$o(),x=xa(h);x.tag=2,l!=null&&(x.callback=l),l=va(a,x,h),l!==null&&(vo(l,a,h),Od(l,a,h))}};function $j(a,l,h,x,C,_,V){return a=a.stateNode,typeof a.shouldComponentUpdate=="function"?a.shouldComponentUpdate(x,_,V):l.prototype&&l.prototype.isPureReactComponent?!kd(h,x)||!kd(C,_):!0}function Vj(a,l,h,x){a=l.state,typeof l.componentWillReceiveProps=="function"&&l.componentWillReceiveProps(h,x),typeof l.UNSAFE_componentWillReceiveProps=="function"&&l.UNSAFE_componentWillReceiveProps(h,x),l.state!==a&&Jv.enqueueReplaceState(l,l.state,null)}function Rl(a,l){var h=l;if("ref"in l){h={};for(var x in l)x!=="ref"&&(h[x]=l[x])}if(a=a.defaultProps){h===l&&(h=m({},h));for(var C in a)h[C]===void 0&&(h[C]=a[C])}return h}function Bj(a){yp(a)}function Hj(a){console.error(a)}function Uj(a){yp(a)}function $p(a,l){try{var h=a.onUncaughtError;h(l.value,{componentStack:l.stack})}catch(x){setTimeout(function(){throw x})}}function qj(a,l,h){try{var x=a.onCaughtError;x(h.value,{componentStack:h.stack,errorBoundary:l.tag===1?l.stateNode:null})}catch(C){setTimeout(function(){throw C})}}function eb(a,l,h){return h=xa(h),h.tag=3,h.payload={element:null},h.callback=function(){$p(a,l)},h}function Yj(a){return a=xa(a),a.tag=3,a}function Zj(a,l,h,x){var C=h.type.getDerivedStateFromError;if(typeof C=="function"){var _=x.value;a.payload=function(){return C(_)},a.callback=function(){qj(l,h,x)}}var V=h.stateNode;V!==null&&typeof V.componentDidCatch=="function"&&(a.callback=function(){qj(l,h,x),typeof C!="function"&&(ka===null?ka=new Set([this]):ka.add(this));var K=x.stack;this.componentDidCatch(x.value,{componentStack:K!==null?K:""})})}function eV(a,l,h,x,C){if(h.flags|=32768,x!==null&&typeof x=="object"&&typeof x.then=="function"){if(l=h.alternate,l!==null&&Pc(l,h,C,!0),h=Io.current,h!==null){switch(h.tag){case 31:case 13:return ii===null?Wp():h.alternate===null&&ar===0&&(ar=3),h.flags&=-257,h.flags|=65536,h.lanes=C,x===Rp?h.flags|=16384:(l=h.updateQueue,l===null?h.updateQueue=new Set([x]):l.add(x),kb(a,x,C)),!1;case 22:return h.flags|=65536,x===Rp?h.flags|=16384:(l=h.updateQueue,l===null?(l={transitions:null,markerInstances:null,retryQueue:new Set([x])},h.updateQueue=l):(h=l.retryQueue,h===null?l.retryQueue=new Set([x]):h.add(x)),kb(a,x,C)),!1}throw Error(r(435,h.tag))}return kb(a,x,C),Wp(),!1}if(dn)return l=Io.current,l!==null?((l.flags&65536)===0&&(l.flags|=256),l.flags|=65536,l.lanes=C,x!==vv&&(a=Error(r(422),{cause:x}),_d(ti(a,h)))):(x!==vv&&(l=Error(r(423),{cause:x}),_d(ti(l,h))),a=a.current.alternate,a.flags|=65536,C&=-C,a.lanes|=C,x=ti(x,h),C=eb(a.stateNode,x,C),Tv(a,C),ar!==4&&(ar=2)),!1;var _=Error(r(520),{cause:x});if(_=ti(_,h),Zd===null?Zd=[_]:Zd.push(_),ar!==4&&(ar=2),l===null)return!0;x=ti(x,h),h=l;do{switch(h.tag){case 3:return h.flags|=65536,a=C&-C,h.lanes|=a,a=eb(h.stateNode,x,a),Tv(h,a),!1;case 1:if(l=h.type,_=h.stateNode,(h.flags&128)===0&&(typeof l.getDerivedStateFromError=="function"||_!==null&&typeof _.componentDidCatch=="function"&&(ka===null||!ka.has(_))))return h.flags|=65536,C&=-C,h.lanes|=C,C=Yj(C),Zj(C,a,h,x),Tv(h,C),!1}h=h.return}while(h!==null);return!1}var tb=Error(r(461)),vr=!1;function Vr(a,l,h,x){l.child=a===null?Qk(l,null,h,x):kl(l,a.child,h,x)}function Gj(a,l,h,x,C){h=h.render;var _=l.ref;if("ref"in x){var V={};for(var K in x)K!=="ref"&&(V[K]=x[K])}else V=x;return wl(l),x=Iv(a,l,h,V,_,C),K=zv(),a!==null&&!vr?(Lv(a,l,C),_s(a,l,C)):(dn&&K&&yv(l),l.flags|=1,Vr(a,l,x,C),l.child)}function Kj(a,l,h,x,C){if(a===null){var _=h.type;return typeof _=="function"&&!pv(_)&&_.defaultProps===void 0&&h.compare===null?(l.tag=15,l.type=_,Xj(a,l,_,x,C)):(a=wp(h.type,null,x,l,l.mode,C),a.ref=l.ref,a.return=l,l.child=a)}if(_=a.child,!cb(a,C)){var V=_.memoizedProps;if(h=h.compare,h=h!==null?h:kd,h(V,x)&&a.ref===l.ref)return _s(a,l,C)}return l.flags|=1,a=Ss(_,x),a.ref=l.ref,a.return=l,l.child=a}function Xj(a,l,h,x,C){if(a!==null){var _=a.memoizedProps;if(kd(_,x)&&a.ref===l.ref)if(vr=!1,l.pendingProps=x=_,cb(a,C))(a.flags&131072)!==0&&(vr=!0);else return l.lanes=a.lanes,_s(a,l,C)}return nb(a,l,h,x,C)}function Qj(a,l,h,x){var C=x.children,_=a!==null?a.memoizedState:null;if(a===null&&l.stateNode===null&&(l.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),x.mode==="hidden"){if((l.flags&128)!==0){if(_=_!==null?_.baseLanes|h:h,a!==null){for(x=l.child=a.child,C=0;x!==null;)C=C|x.lanes|x.childLanes,x=x.sibling;x=C&~_}else x=0,l.child=null;return Wj(a,l,_,h,x)}if((h&536870912)!==0)l.memoizedState={baseLanes:0,cachePool:null},a!==null&&kp(l,_!==null?_.cachePool:null),_!==null?ej(l,_):Av(),tj(l);else return x=l.lanes=536870912,Wj(a,l,_!==null?_.baseLanes|h:h,h,x)}else _!==null?(kp(l,_.cachePool),ej(l,_),wa(),l.memoizedState=null):(a!==null&&kp(l,null),Av(),wa());return Vr(a,l,C,h),l.child}function $d(a,l){return a!==null&&a.tag===22||l.stateNode!==null||(l.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),l.sibling}function Wj(a,l,h,x,C){var _=jv();return _=_===null?null:{parent:yr._currentValue,pool:_},l.memoizedState={baseLanes:h,cachePool:_},a!==null&&kp(l,null),Av(),tj(l),a!==null&&Pc(a,l,x,!0),l.childLanes=C,null}function Vp(a,l){return l=Hp({mode:l.mode,children:l.children},a.mode),l.ref=a.ref,a.child=l,l.return=a,l}function Jj(a,l,h){return kl(l,a.child,null,h),a=Vp(l,l.pendingProps),a.flags|=2,zo(l),l.memoizedState=null,a}function tV(a,l,h){var x=l.pendingProps,C=(l.flags&128)!==0;if(l.flags&=-129,a===null){if(dn){if(x.mode==="hidden")return a=Vp(l,x),l.lanes=536870912,$d(null,a);if(Dv(l),(a=qn)?(a=d_(a,oi),a=a!==null&&a.data==="&"?a:null,a!==null&&(l.memoizedState={dehydrated:a,treeContext:ha!==null?{id:Yi,overflow:Zi}:null,retryLane:536870912,hydrationErrors:null},h=Ik(a),h.return=l,l.child=h,Fr=l,qn=null)):a=null,a===null)throw ma(l);return l.lanes=536870912,null}return Vp(l,x)}var _=a.memoizedState;if(_!==null){var V=_.dehydrated;if(Dv(l),C)if(l.flags&256)l.flags&=-257,l=Jj(a,l,h);else if(l.memoizedState!==null)l.child=a.child,l.flags|=128,l=null;else throw Error(r(558));else if(vr||Pc(a,l,h,!1),C=(h&a.childLanes)!==0,vr||C){if(x=Ln,x!==null&&(V=te(x,h),V!==0&&V!==_.retryLane))throw _.retryLane=V,yl(a,V),vo(x,a,V),tb;Wp(),l=Jj(a,l,h)}else a=_.treeContext,qn=si(V.nextSibling),Fr=l,dn=!0,pa=null,oi=!1,a!==null&&Fk(l,a),l=Vp(l,x),l.flags|=4096;return l}return a=Ss(a.child,{mode:x.mode,children:x.children}),a.ref=l.ref,l.child=a,a.return=l,a}function Bp(a,l){var h=l.ref;if(h===null)a!==null&&a.ref!==null&&(l.flags|=4194816);else{if(typeof h!="function"&&typeof h!="object")throw Error(r(284));(a===null||a.ref!==h)&&(l.flags|=4194816)}}function nb(a,l,h,x,C){return wl(l),h=Iv(a,l,h,x,void 0,C),x=zv(),a!==null&&!vr?(Lv(a,l,C),_s(a,l,C)):(dn&&x&&yv(l),l.flags|=1,Vr(a,l,h,C),l.child)}function eR(a,l,h,x,C,_){return wl(l),l.updateQueue=null,h=rj(l,x,h,C),nj(a),x=zv(),a!==null&&!vr?(Lv(a,l,_),_s(a,l,_)):(dn&&x&&yv(l),l.flags|=1,Vr(a,l,h,_),l.child)}function tR(a,l,h,x,C){if(wl(l),l.stateNode===null){var _=Mc,V=h.contextType;typeof V=="object"&&V!==null&&(_=$r(V)),_=new h(x,_),l.memoizedState=_.state!==null&&_.state!==void 0?_.state:null,_.updater=Jv,l.stateNode=_,_._reactInternals=l,_=l.stateNode,_.props=x,_.state=l.memoizedState,_.refs={},_v(l),V=h.contextType,_.context=typeof V=="object"&&V!==null?$r(V):Mc,_.state=l.memoizedState,V=h.getDerivedStateFromProps,typeof V=="function"&&(Wv(l,h,V,x),_.state=l.memoizedState),typeof h.getDerivedStateFromProps=="function"||typeof _.getSnapshotBeforeUpdate=="function"||typeof _.UNSAFE_componentWillMount!="function"&&typeof _.componentWillMount!="function"||(V=_.state,typeof _.componentWillMount=="function"&&_.componentWillMount(),typeof _.UNSAFE_componentWillMount=="function"&&_.UNSAFE_componentWillMount(),V!==_.state&&Jv.enqueueReplaceState(_,_.state,null),Pd(l,x,_,C),Dd(),_.state=l.memoizedState),typeof _.componentDidMount=="function"&&(l.flags|=4194308),x=!0}else if(a===null){_=l.stateNode;var K=l.memoizedProps,se=Rl(h,K);_.props=se;var xe=_.context,Oe=h.contextType;V=Mc,typeof Oe=="object"&&Oe!==null&&(V=$r(Oe));var Fe=h.getDerivedStateFromProps;Oe=typeof Fe=="function"||typeof _.getSnapshotBeforeUpdate=="function",K=l.pendingProps!==K,Oe||typeof _.UNSAFE_componentWillReceiveProps!="function"&&typeof _.componentWillReceiveProps!="function"||(K||xe!==V)&&Vj(l,_,x,V),ya=!1;var be=l.memoizedState;_.state=be,Pd(l,x,_,C),Dd(),xe=l.memoizedState,K||be!==xe||ya?(typeof Fe=="function"&&(Wv(l,h,Fe,x),xe=l.memoizedState),(se=ya||$j(l,h,se,x,be,xe,V))?(Oe||typeof _.UNSAFE_componentWillMount!="function"&&typeof _.componentWillMount!="function"||(typeof _.componentWillMount=="function"&&_.componentWillMount(),typeof _.UNSAFE_componentWillMount=="function"&&_.UNSAFE_componentWillMount()),typeof _.componentDidMount=="function"&&(l.flags|=4194308)):(typeof _.componentDidMount=="function"&&(l.flags|=4194308),l.memoizedProps=x,l.memoizedState=xe),_.props=x,_.state=xe,_.context=V,x=se):(typeof _.componentDidMount=="function"&&(l.flags|=4194308),x=!1)}else{_=l.stateNode,Nv(a,l),V=l.memoizedProps,Oe=Rl(h,V),_.props=Oe,Fe=l.pendingProps,be=_.context,xe=h.contextType,se=Mc,typeof xe=="object"&&xe!==null&&(se=$r(xe)),K=h.getDerivedStateFromProps,(xe=typeof K=="function"||typeof _.getSnapshotBeforeUpdate=="function")||typeof _.UNSAFE_componentWillReceiveProps!="function"&&typeof _.componentWillReceiveProps!="function"||(V!==Fe||be!==se)&&Vj(l,_,x,se),ya=!1,be=l.memoizedState,_.state=be,Pd(l,x,_,C),Dd();var Re=l.memoizedState;V!==Fe||be!==Re||ya||a!==null&&a.dependencies!==null&&Ep(a.dependencies)?(typeof K=="function"&&(Wv(l,h,K,x),Re=l.memoizedState),(Oe=ya||$j(l,h,Oe,x,be,Re,se)||a!==null&&a.dependencies!==null&&Ep(a.dependencies))?(xe||typeof _.UNSAFE_componentWillUpdate!="function"&&typeof _.componentWillUpdate!="function"||(typeof _.componentWillUpdate=="function"&&_.componentWillUpdate(x,Re,se),typeof _.UNSAFE_componentWillUpdate=="function"&&_.UNSAFE_componentWillUpdate(x,Re,se)),typeof _.componentDidUpdate=="function"&&(l.flags|=4),typeof _.getSnapshotBeforeUpdate=="function"&&(l.flags|=1024)):(typeof _.componentDidUpdate!="function"||V===a.memoizedProps&&be===a.memoizedState||(l.flags|=4),typeof _.getSnapshotBeforeUpdate!="function"||V===a.memoizedProps&&be===a.memoizedState||(l.flags|=1024),l.memoizedProps=x,l.memoizedState=Re),_.props=x,_.state=Re,_.context=se,x=Oe):(typeof _.componentDidUpdate!="function"||V===a.memoizedProps&&be===a.memoizedState||(l.flags|=4),typeof _.getSnapshotBeforeUpdate!="function"||V===a.memoizedProps&&be===a.memoizedState||(l.flags|=1024),x=!1)}return _=x,Bp(a,l),x=(l.flags&128)!==0,_||x?(_=l.stateNode,h=x&&typeof h.getDerivedStateFromError!="function"?null:_.render(),l.flags|=1,a!==null&&x?(l.child=kl(l,a.child,null,C),l.child=kl(l,null,h,C)):Vr(a,l,h,C),l.memoizedState=_.state,a=l.child):a=_s(a,l,C),a}function nR(a,l,h,x){return vl(),l.flags|=256,Vr(a,l,h,x),l.child}var rb={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function ob(a){return{baseLanes:a,cachePool:qk()}}function ib(a,l,h){return a=a!==null?a.childLanes&~h:0,l&&(a|=Fo),a}function rR(a,l,h){var x=l.pendingProps,C=!1,_=(l.flags&128)!==0,V;if((V=_)||(V=a!==null&&a.memoizedState===null?!1:(cr.current&2)!==0),V&&(C=!0,l.flags&=-129),V=(l.flags&32)!==0,l.flags&=-33,a===null){if(dn){if(C?ba(l):wa(),(a=qn)?(a=d_(a,oi),a=a!==null&&a.data!=="&"?a:null,a!==null&&(l.memoizedState={dehydrated:a,treeContext:ha!==null?{id:Yi,overflow:Zi}:null,retryLane:536870912,hydrationErrors:null},h=Ik(a),h.return=l,l.child=h,Fr=l,qn=null)):a=null,a===null)throw ma(l);return Vb(a)?l.lanes=32:l.lanes=536870912,null}var K=x.children;return x=x.fallback,C?(wa(),C=l.mode,K=Hp({mode:"hidden",children:K},C),x=xl(x,C,h,null),K.return=l,x.return=l,K.sibling=x,l.child=K,x=l.child,x.memoizedState=ob(h),x.childLanes=ib(a,V,h),l.memoizedState=rb,$d(null,x)):(ba(l),sb(l,K))}var se=a.memoizedState;if(se!==null&&(K=se.dehydrated,K!==null)){if(_)l.flags&256?(ba(l),l.flags&=-257,l=ab(a,l,h)):l.memoizedState!==null?(wa(),l.child=a.child,l.flags|=128,l=null):(wa(),K=x.fallback,C=l.mode,x=Hp({mode:"visible",children:x.children},C),K=xl(K,C,h,null),K.flags|=2,x.return=l,K.return=l,x.sibling=K,l.child=x,kl(l,a.child,null,h),x=l.child,x.memoizedState=ob(h),x.childLanes=ib(a,V,h),l.memoizedState=rb,l=$d(null,x));else if(ba(l),Vb(K)){if(V=K.nextSibling&&K.nextSibling.dataset,V)var xe=V.dgst;V=xe,x=Error(r(419)),x.stack="",x.digest=V,_d({value:x,source:null,stack:null}),l=ab(a,l,h)}else if(vr||Pc(a,l,h,!1),V=(h&a.childLanes)!==0,vr||V){if(V=Ln,V!==null&&(x=te(V,h),x!==0&&x!==se.retryLane))throw se.retryLane=x,yl(a,x),vo(V,a,x),tb;$b(K)||Wp(),l=ab(a,l,h)}else $b(K)?(l.flags|=192,l.child=a.child,l=null):(a=se.treeContext,qn=si(K.nextSibling),Fr=l,dn=!0,pa=null,oi=!1,a!==null&&Fk(l,a),l=sb(l,x.children),l.flags|=4096);return l}return C?(wa(),K=x.fallback,C=l.mode,se=a.child,xe=se.sibling,x=Ss(se,{mode:"hidden",children:x.children}),x.subtreeFlags=se.subtreeFlags&65011712,xe!==null?K=Ss(xe,K):(K=xl(K,C,h,null),K.flags|=2),K.return=l,x.return=l,x.sibling=K,l.child=x,$d(null,x),x=l.child,K=a.child.memoizedState,K===null?K=ob(h):(C=K.cachePool,C!==null?(se=yr._currentValue,C=C.parent!==se?{parent:se,pool:se}:C):C=qk(),K={baseLanes:K.baseLanes|h,cachePool:C}),x.memoizedState=K,x.childLanes=ib(a,V,h),l.memoizedState=rb,$d(a.child,x)):(ba(l),h=a.child,a=h.sibling,h=Ss(h,{mode:"visible",children:x.children}),h.return=l,h.sibling=null,a!==null&&(V=l.deletions,V===null?(l.deletions=[a],l.flags|=16):V.push(a)),l.child=h,l.memoizedState=null,h)}function sb(a,l){return l=Hp({mode:"visible",children:l},a.mode),l.return=a,a.child=l}function Hp(a,l){return a=Po(22,a,null,l),a.lanes=0,a}function ab(a,l,h){return kl(l,a.child,null,h),a=sb(l,l.pendingProps.children),a.flags|=2,l.memoizedState=null,a}function oR(a,l,h){a.lanes|=l;var x=a.alternate;x!==null&&(x.lanes|=l),Sv(a.return,l,h)}function lb(a,l,h,x,C,_){var V=a.memoizedState;V===null?a.memoizedState={isBackwards:l,rendering:null,renderingStartTime:0,last:x,tail:h,tailMode:C,treeForkCount:_}:(V.isBackwards=l,V.rendering=null,V.renderingStartTime=0,V.last=x,V.tail=h,V.tailMode=C,V.treeForkCount=_)}function iR(a,l,h){var x=l.pendingProps,C=x.revealOrder,_=x.tail;x=x.children;var V=cr.current,K=(V&2)!==0;if(K?(V=V&1|2,l.flags|=128):V&=1,B(cr,V),Vr(a,l,x,h),x=dn?Rd:0,!K&&a!==null&&(a.flags&128)!==0)e:for(a=l.child;a!==null;){if(a.tag===13)a.memoizedState!==null&&oR(a,h,l);else if(a.tag===19)oR(a,h,l);else if(a.child!==null){a.child.return=a,a=a.child;continue}if(a===l)break e;for(;a.sibling===null;){if(a.return===null||a.return===l)break e;a=a.return}a.sibling.return=a.return,a=a.sibling}switch(C){case"forwards":for(h=l.child,C=null;h!==null;)a=h.alternate,a!==null&&Mp(a)===null&&(C=h),h=h.sibling;h=C,h===null?(C=l.child,l.child=null):(C=h.sibling,h.sibling=null),lb(l,!1,C,h,_,x);break;case"backwards":case"unstable_legacy-backwards":for(h=null,C=l.child,l.child=null;C!==null;){if(a=C.alternate,a!==null&&Mp(a)===null){l.child=C;break}a=C.sibling,C.sibling=h,h=C,C=a}lb(l,!0,h,null,_,x);break;case"together":lb(l,!1,null,null,void 0,x);break;default:l.memoizedState=null}return l.child}function _s(a,l,h){if(a!==null&&(l.dependencies=a.dependencies),Ca|=l.lanes,(h&l.childLanes)===0)if(a!==null){if(Pc(a,l,h,!1),(h&l.childLanes)===0)return null}else return null;if(a!==null&&l.child!==a.child)throw Error(r(153));if(l.child!==null){for(a=l.child,h=Ss(a,a.pendingProps),l.child=h,h.return=l;a.sibling!==null;)a=a.sibling,h=h.sibling=Ss(a,a.pendingProps),h.return=l;h.sibling=null}return l.child}function cb(a,l){return(a.lanes&l)!==0?!0:(a=a.dependencies,!!(a!==null&&Ep(a)))}function nV(a,l,h){switch(l.tag){case 3:W(l,l.stateNode.containerInfo),ga(l,yr,a.memoizedState.cache),vl();break;case 27:case 5:je(l);break;case 4:W(l,l.stateNode.containerInfo);break;case 10:ga(l,l.type,l.memoizedProps.value);break;case 31:if(l.memoizedState!==null)return l.flags|=128,Dv(l),null;break;case 13:var x=l.memoizedState;if(x!==null)return x.dehydrated!==null?(ba(l),l.flags|=128,null):(h&l.child.childLanes)!==0?rR(a,l,h):(ba(l),a=_s(a,l,h),a!==null?a.sibling:null);ba(l);break;case 19:var C=(a.flags&128)!==0;if(x=(h&l.childLanes)!==0,x||(Pc(a,l,h,!1),x=(h&l.childLanes)!==0),C){if(x)return iR(a,l,h);l.flags|=128}if(C=l.memoizedState,C!==null&&(C.rendering=null,C.tail=null,C.lastEffect=null),B(cr,cr.current),x)break;return null;case 22:return l.lanes=0,Qj(a,l,h,l.pendingProps);case 24:ga(l,yr,a.memoizedState.cache)}return _s(a,l,h)}function sR(a,l,h){if(a!==null)if(a.memoizedProps!==l.pendingProps)vr=!0;else{if(!cb(a,h)&&(l.flags&128)===0)return vr=!1,nV(a,l,h);vr=(a.flags&131072)!==0}else vr=!1,dn&&(l.flags&1048576)!==0&&Lk(l,Rd,l.index);switch(l.lanes=0,l.tag){case 16:e:{var x=l.pendingProps;if(a=El(l.elementType),l.type=a,typeof a=="function")pv(a)?(x=Rl(a,x),l.tag=1,l=tR(null,l,a,x,h)):(l.tag=0,l=nb(null,l,a,x,h));else{if(a!=null){var C=a.$$typeof;if(C===N){l.tag=11,l=Gj(null,l,a,x,h);break e}else if(C===M){l.tag=14,l=Kj(null,l,a,x,h);break e}}throw l=L(a)||a,Error(r(306,l,""))}}return l;case 0:return nb(a,l,l.type,l.pendingProps,h);case 1:return x=l.type,C=Rl(x,l.pendingProps),tR(a,l,x,C,h);case 3:e:{if(W(l,l.stateNode.containerInfo),a===null)throw Error(r(387));x=l.pendingProps;var _=l.memoizedState;C=_.element,Nv(a,l),Pd(l,x,null,h);var V=l.memoizedState;if(x=V.cache,ga(l,yr,x),x!==_.cache&&Ev(l,[yr],h,!0),Dd(),x=V.element,_.isDehydrated)if(_={element:x,isDehydrated:!1,cache:V.cache},l.updateQueue.baseState=_,l.memoizedState=_,l.flags&256){l=nR(a,l,x,h);break e}else if(x!==C){C=ti(Error(r(424)),l),_d(C),l=nR(a,l,x,h);break e}else for(a=l.stateNode.containerInfo,a.nodeType===9?a=a.body:a=a.nodeName==="HTML"?a.ownerDocument.body:a,qn=si(a.firstChild),Fr=l,dn=!0,pa=null,oi=!0,h=Qk(l,null,x,h),l.child=h;h;)h.flags=h.flags&-3|4096,h=h.sibling;else{if(vl(),x===C){l=_s(a,l,h);break e}Vr(a,l,x,h)}l=l.child}return l;case 26:return Bp(a,l),a===null?(h=y_(l.type,null,l.pendingProps,null))?l.memoizedState=h:dn||(h=l.type,a=l.pendingProps,x=im(Q.current).createElement(h),x[Xe]=l,x[et]=a,Br(x,h,a),un(x),l.stateNode=x):l.memoizedState=y_(l.type,a.memoizedProps,l.pendingProps,a.memoizedState),null;case 27:return je(l),a===null&&dn&&(x=l.stateNode=p_(l.type,l.pendingProps,Q.current),Fr=l,oi=!0,C=qn,Na(l.type)?(Bb=C,qn=si(x.firstChild)):qn=C),Vr(a,l,l.pendingProps.children,h),Bp(a,l),a===null&&(l.flags|=4194304),l.child;case 5:return a===null&&dn&&((C=x=qn)&&(x=AV(x,l.type,l.pendingProps,oi),x!==null?(l.stateNode=x,Fr=l,qn=si(x.firstChild),oi=!1,C=!0):C=!1),C||ma(l)),je(l),C=l.type,_=l.pendingProps,V=a!==null?a.memoizedProps:null,x=_.children,zb(C,_)?x=null:V!==null&&zb(C,V)&&(l.flags|=32),l.memoizedState!==null&&(C=Iv(a,l,Z5,null,null,h),tf._currentValue=C),Bp(a,l),Vr(a,l,x,h),l.child;case 6:return a===null&&dn&&((a=h=qn)&&(h=OV(h,l.pendingProps,oi),h!==null?(l.stateNode=h,Fr=l,qn=null,a=!0):a=!1),a||ma(l)),null;case 13:return rR(a,l,h);case 4:return W(l,l.stateNode.containerInfo),x=l.pendingProps,a===null?l.child=kl(l,null,x,h):Vr(a,l,x,h),l.child;case 11:return Gj(a,l,l.type,l.pendingProps,h);case 7:return Vr(a,l,l.pendingProps,h),l.child;case 8:return Vr(a,l,l.pendingProps.children,h),l.child;case 12:return Vr(a,l,l.pendingProps.children,h),l.child;case 10:return x=l.pendingProps,ga(l,l.type,x.value),Vr(a,l,x.children,h),l.child;case 9:return C=l.type._context,x=l.pendingProps.children,wl(l),C=$r(C),x=x(C),l.flags|=1,Vr(a,l,x,h),l.child;case 14:return Kj(a,l,l.type,l.pendingProps,h);case 15:return Xj(a,l,l.type,l.pendingProps,h);case 19:return iR(a,l,h);case 31:return tV(a,l,h);case 22:return Qj(a,l,h,l.pendingProps);case 24:return wl(l),x=$r(yr),a===null?(C=jv(),C===null&&(C=Ln,_=Cv(),C.pooledCache=_,_.refCount++,_!==null&&(C.pooledCacheLanes|=h),C=_),l.memoizedState={parent:x,cache:C},_v(l),ga(l,yr,C)):((a.lanes&h)!==0&&(Nv(a,l),Pd(l,null,null,h),Dd()),C=a.memoizedState,_=l.memoizedState,C.parent!==x?(C={parent:x,cache:x},l.memoizedState=C,l.lanes===0&&(l.memoizedState=l.updateQueue.baseState=C),ga(l,yr,x)):(x=_.cache,ga(l,yr,x),x!==C.cache&&Ev(l,[yr],h,!0))),Vr(a,l,l.pendingProps.children,h),l.child;case 29:throw l.pendingProps}throw Error(r(156,l.tag))}function Ns(a){a.flags|=4}function ub(a,l,h,x,C){if((l=(a.mode&32)!==0)&&(l=!1),l){if(a.flags|=16777216,(C&335544128)===C)if(a.stateNode.complete)a.flags|=8192;else if(OR())a.flags|=8192;else throw Cl=Rp,Rv}else a.flags&=-16777217}function aR(a,l){if(l.type!=="stylesheet"||(l.state.loading&4)!==0)a.flags&=-16777217;else if(a.flags|=16777216,!S_(l))if(OR())a.flags|=8192;else throw Cl=Rp,Rv}function Up(a,l){l!==null&&(a.flags|=4),a.flags&16384&&(l=a.tag!==22?Rt():536870912,a.lanes|=l,Zc|=l)}function Vd(a,l){if(!dn)switch(a.tailMode){case"hidden":l=a.tail;for(var h=null;l!==null;)l.alternate!==null&&(h=l),l=l.sibling;h===null?a.tail=null:h.sibling=null;break;case"collapsed":h=a.tail;for(var x=null;h!==null;)h.alternate!==null&&(x=h),h=h.sibling;x===null?l||a.tail===null?a.tail=null:a.tail.sibling=null:x.sibling=null}}function Yn(a){var l=a.alternate!==null&&a.alternate.child===a.child,h=0,x=0;if(l)for(var C=a.child;C!==null;)h|=C.lanes|C.childLanes,x|=C.subtreeFlags&65011712,x|=C.flags&65011712,C.return=a,C=C.sibling;else for(C=a.child;C!==null;)h|=C.lanes|C.childLanes,x|=C.subtreeFlags,x|=C.flags,C.return=a,C=C.sibling;return a.subtreeFlags|=x,a.childLanes=h,l}function rV(a,l,h){var x=l.pendingProps;switch(xv(l),l.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Yn(l),null;case 1:return Yn(l),null;case 3:return h=l.stateNode,x=null,a!==null&&(x=a.memoizedState.cache),l.memoizedState.cache!==x&&(l.flags|=2048),ks(yr),ne(),h.pendingContext&&(h.context=h.pendingContext,h.pendingContext=null),(a===null||a.child===null)&&(Dc(l)?Ns(l):a===null||a.memoizedState.isDehydrated&&(l.flags&256)===0||(l.flags|=1024,bv())),Yn(l),null;case 26:var C=l.type,_=l.memoizedState;return a===null?(Ns(l),_!==null?(Yn(l),aR(l,_)):(Yn(l),ub(l,C,null,x,h))):_?_!==a.memoizedState?(Ns(l),Yn(l),aR(l,_)):(Yn(l),l.flags&=-16777217):(a=a.memoizedProps,a!==x&&Ns(l),Yn(l),ub(l,C,a,x,h)),null;case 27:if(Ee(l),h=Q.current,C=l.type,a!==null&&l.stateNode!=null)a.memoizedProps!==x&&Ns(l);else{if(!x){if(l.stateNode===null)throw Error(r(166));return Yn(l),null}a=X.current,Dc(l)?$k(l):(a=p_(C,x,h),l.stateNode=a,Ns(l))}return Yn(l),null;case 5:if(Ee(l),C=l.type,a!==null&&l.stateNode!=null)a.memoizedProps!==x&&Ns(l);else{if(!x){if(l.stateNode===null)throw Error(r(166));return Yn(l),null}if(_=X.current,Dc(l))$k(l);else{var V=im(Q.current);switch(_){case 1:_=V.createElementNS("http://www.w3.org/2000/svg",C);break;case 2:_=V.createElementNS("http://www.w3.org/1998/Math/MathML",C);break;default:switch(C){case"svg":_=V.createElementNS("http://www.w3.org/2000/svg",C);break;case"math":_=V.createElementNS("http://www.w3.org/1998/Math/MathML",C);break;case"script":_=V.createElement("div"),_.innerHTML="<script><\/script>",_=_.removeChild(_.firstChild);break;case"select":_=typeof x.is=="string"?V.createElement("select",{is:x.is}):V.createElement("select"),x.multiple?_.multiple=!0:x.size&&(_.size=x.size);break;default:_=typeof x.is=="string"?V.createElement(C,{is:x.is}):V.createElement(C)}}_[Xe]=l,_[et]=x;e:for(V=l.child;V!==null;){if(V.tag===5||V.tag===6)_.appendChild(V.stateNode);else if(V.tag!==4&&V.tag!==27&&V.child!==null){V.child.return=V,V=V.child;continue}if(V===l)break e;for(;V.sibling===null;){if(V.return===null||V.return===l)break e;V=V.return}V.sibling.return=V.return,V=V.sibling}l.stateNode=_;e:switch(Br(_,C,x),C){case"button":case"input":case"select":case"textarea":x=!!x.autoFocus;break e;case"img":x=!0;break e;default:x=!1}x&&Ns(l)}}return Yn(l),ub(l,l.type,a===null?null:a.memoizedProps,l.pendingProps,h),null;case 6:if(a&&l.stateNode!=null)a.memoizedProps!==x&&Ns(l);else{if(typeof x!="string"&&l.stateNode===null)throw Error(r(166));if(a=Q.current,Dc(l)){if(a=l.stateNode,h=l.memoizedProps,x=null,C=Fr,C!==null)switch(C.tag){case 27:case 5:x=C.memoizedProps}a[Xe]=l,a=!!(a.nodeValue===h||x!==null&&x.suppressHydrationWarning===!0||r_(a.nodeValue,h)),a||ma(l,!0)}else a=im(a).createTextNode(x),a[Xe]=l,l.stateNode=a}return Yn(l),null;case 31:if(h=l.memoizedState,a===null||a.memoizedState!==null){if(x=Dc(l),h!==null){if(a===null){if(!x)throw Error(r(318));if(a=l.memoizedState,a=a!==null?a.dehydrated:null,!a)throw Error(r(557));a[Xe]=l}else vl(),(l.flags&128)===0&&(l.memoizedState=null),l.flags|=4;Yn(l),a=!1}else h=bv(),a!==null&&a.memoizedState!==null&&(a.memoizedState.hydrationErrors=h),a=!0;if(!a)return l.flags&256?(zo(l),l):(zo(l),null);if((l.flags&128)!==0)throw Error(r(558))}return Yn(l),null;case 13:if(x=l.memoizedState,a===null||a.memoizedState!==null&&a.memoizedState.dehydrated!==null){if(C=Dc(l),x!==null&&x.dehydrated!==null){if(a===null){if(!C)throw Error(r(318));if(C=l.memoizedState,C=C!==null?C.dehydrated:null,!C)throw Error(r(317));C[Xe]=l}else vl(),(l.flags&128)===0&&(l.memoizedState=null),l.flags|=4;Yn(l),C=!1}else C=bv(),a!==null&&a.memoizedState!==null&&(a.memoizedState.hydrationErrors=C),C=!0;if(!C)return l.flags&256?(zo(l),l):(zo(l),null)}return zo(l),(l.flags&128)!==0?(l.lanes=h,l):(h=x!==null,a=a!==null&&a.memoizedState!==null,h&&(x=l.child,C=null,x.alternate!==null&&x.alternate.memoizedState!==null&&x.alternate.memoizedState.cachePool!==null&&(C=x.alternate.memoizedState.cachePool.pool),_=null,x.memoizedState!==null&&x.memoizedState.cachePool!==null&&(_=x.memoizedState.cachePool.pool),_!==C&&(x.flags|=2048)),h!==a&&h&&(l.child.flags|=8192),Up(l,l.updateQueue),Yn(l),null);case 4:return ne(),a===null&&Ab(l.stateNode.containerInfo),Yn(l),null;case 10:return ks(l.type),Yn(l),null;case 19:if(U(cr),x=l.memoizedState,x===null)return Yn(l),null;if(C=(l.flags&128)!==0,_=x.rendering,_===null)if(C)Vd(x,!1);else{if(ar!==0||a!==null&&(a.flags&128)!==0)for(a=l.child;a!==null;){if(_=Mp(a),_!==null){for(l.flags|=128,Vd(x,!1),a=_.updateQueue,l.updateQueue=a,Up(l,a),l.subtreeFlags=0,a=h,h=l.child;h!==null;)Pk(h,a),h=h.sibling;return B(cr,cr.current&1|2),dn&&Es(l,x.treeForkCount),l.child}a=a.sibling}x.tail!==null&&me()>Kp&&(l.flags|=128,C=!0,Vd(x,!1),l.lanes=4194304)}else{if(!C)if(a=Mp(_),a!==null){if(l.flags|=128,C=!0,a=a.updateQueue,l.updateQueue=a,Up(l,a),Vd(x,!0),x.tail===null&&x.tailMode==="hidden"&&!_.alternate&&!dn)return Yn(l),null}else 2*me()-x.renderingStartTime>Kp&&h!==536870912&&(l.flags|=128,C=!0,Vd(x,!1),l.lanes=4194304);x.isBackwards?(_.sibling=l.child,l.child=_):(a=x.last,a!==null?a.sibling=_:l.child=_,x.last=_)}return x.tail!==null?(a=x.tail,x.rendering=a,x.tail=a.sibling,x.renderingStartTime=me(),a.sibling=null,h=cr.current,B(cr,C?h&1|2:h&1),dn&&Es(l,x.treeForkCount),a):(Yn(l),null);case 22:case 23:return zo(l),Ov(),x=l.memoizedState!==null,a!==null?a.memoizedState!==null!==x&&(l.flags|=8192):x&&(l.flags|=8192),x?(h&536870912)!==0&&(l.flags&128)===0&&(Yn(l),l.subtreeFlags&6&&(l.flags|=8192)):Yn(l),h=l.updateQueue,h!==null&&Up(l,h.retryQueue),h=null,a!==null&&a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(h=a.memoizedState.cachePool.pool),x=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(x=l.memoizedState.cachePool.pool),x!==h&&(l.flags|=2048),a!==null&&U(Sl),null;case 24:return h=null,a!==null&&(h=a.memoizedState.cache),l.memoizedState.cache!==h&&(l.flags|=2048),ks(yr),Yn(l),null;case 25:return null;case 30:return null}throw Error(r(156,l.tag))}function oV(a,l){switch(xv(l),l.tag){case 1:return a=l.flags,a&65536?(l.flags=a&-65537|128,l):null;case 3:return ks(yr),ne(),a=l.flags,(a&65536)!==0&&(a&128)===0?(l.flags=a&-65537|128,l):null;case 26:case 27:case 5:return Ee(l),null;case 31:if(l.memoizedState!==null){if(zo(l),l.alternate===null)throw Error(r(340));vl()}return a=l.flags,a&65536?(l.flags=a&-65537|128,l):null;case 13:if(zo(l),a=l.memoizedState,a!==null&&a.dehydrated!==null){if(l.alternate===null)throw Error(r(340));vl()}return a=l.flags,a&65536?(l.flags=a&-65537|128,l):null;case 19:return U(cr),null;case 4:return ne(),null;case 10:return ks(l.type),null;case 22:case 23:return zo(l),Ov(),a!==null&&U(Sl),a=l.flags,a&65536?(l.flags=a&-65537|128,l):null;case 24:return ks(yr),null;case 25:return null;default:return null}}function lR(a,l){switch(xv(l),l.tag){case 3:ks(yr),ne();break;case 26:case 27:case 5:Ee(l);break;case 4:ne();break;case 31:l.memoizedState!==null&&zo(l);break;case 13:zo(l);break;case 19:U(cr);break;case 10:ks(l.type);break;case 22:case 23:zo(l),Ov(),a!==null&&U(Sl);break;case 24:ks(yr)}}function Bd(a,l){try{var h=l.updateQueue,x=h!==null?h.lastEffect:null;if(x!==null){var C=x.next;h=C;do{if((h.tag&a)===a){x=void 0;var _=h.create,V=h.inst;x=_(),V.destroy=x}h=h.next}while(h!==C)}}catch(K){_n(l,l.return,K)}}function Sa(a,l,h){try{var x=l.updateQueue,C=x!==null?x.lastEffect:null;if(C!==null){var _=C.next;x=_;do{if((x.tag&a)===a){var V=x.inst,K=V.destroy;if(K!==void 0){V.destroy=void 0,C=l;var se=h,xe=K;try{xe()}catch(Oe){_n(C,se,Oe)}}}x=x.next}while(x!==_)}}catch(Oe){_n(l,l.return,Oe)}}function cR(a){var l=a.updateQueue;if(l!==null){var h=a.stateNode;try{Jk(l,h)}catch(x){_n(a,a.return,x)}}}function uR(a,l,h){h.props=Rl(a.type,a.memoizedProps),h.state=a.memoizedState;try{h.componentWillUnmount()}catch(x){_n(a,l,x)}}function Hd(a,l){try{var h=a.ref;if(h!==null){switch(a.tag){case 26:case 27:case 5:var x=a.stateNode;break;case 30:x=a.stateNode;break;default:x=a.stateNode}typeof h=="function"?a.refCleanup=h(x):h.current=x}}catch(C){_n(a,l,C)}}function Gi(a,l){var h=a.ref,x=a.refCleanup;if(h!==null)if(typeof x=="function")try{x()}catch(C){_n(a,l,C)}finally{a.refCleanup=null,a=a.alternate,a!=null&&(a.refCleanup=null)}else if(typeof h=="function")try{h(null)}catch(C){_n(a,l,C)}else h.current=null}function dR(a){var l=a.type,h=a.memoizedProps,x=a.stateNode;try{e:switch(l){case"button":case"input":case"select":case"textarea":h.autoFocus&&x.focus();break e;case"img":h.src?x.src=h.src:h.srcSet&&(x.srcset=h.srcSet)}}catch(C){_n(a,a.return,C)}}function db(a,l,h){try{var x=a.stateNode;jV(x,a.type,h,l),x[et]=l}catch(C){_n(a,a.return,C)}}function fR(a){return a.tag===5||a.tag===3||a.tag===26||a.tag===27&&Na(a.type)||a.tag===4}function fb(a){e:for(;;){for(;a.sibling===null;){if(a.return===null||fR(a.return))return null;a=a.return}for(a.sibling.return=a.return,a=a.sibling;a.tag!==5&&a.tag!==6&&a.tag!==18;){if(a.tag===27&&Na(a.type)||a.flags&2||a.child===null||a.tag===4)continue e;a.child.return=a,a=a.child}if(!(a.flags&2))return a.stateNode}}function hb(a,l,h){var x=a.tag;if(x===5||x===6)a=a.stateNode,l?(h.nodeType===9?h.body:h.nodeName==="HTML"?h.ownerDocument.body:h).insertBefore(a,l):(l=h.nodeType===9?h.body:h.nodeName==="HTML"?h.ownerDocument.body:h,l.appendChild(a),h=h._reactRootContainer,h!=null||l.onclick!==null||(l.onclick=bs));else if(x!==4&&(x===27&&Na(a.type)&&(h=a.stateNode,l=null),a=a.child,a!==null))for(hb(a,l,h),a=a.sibling;a!==null;)hb(a,l,h),a=a.sibling}function qp(a,l,h){var x=a.tag;if(x===5||x===6)a=a.stateNode,l?h.insertBefore(a,l):h.appendChild(a);else if(x!==4&&(x===27&&Na(a.type)&&(h=a.stateNode),a=a.child,a!==null))for(qp(a,l,h),a=a.sibling;a!==null;)qp(a,l,h),a=a.sibling}function hR(a){var l=a.stateNode,h=a.memoizedProps;try{for(var x=a.type,C=l.attributes;C.length;)l.removeAttributeNode(C[0]);Br(l,x,h),l[Xe]=a,l[et]=h}catch(_){_n(a,a.return,_)}}var Ts=!1,br=!1,pb=!1,pR=typeof WeakSet=="function"?WeakSet:Set,Mr=null;function iV(a,l){if(a=a.containerInfo,Pb=fm,a=jk(a),av(a)){if("selectionStart"in a)var h={start:a.selectionStart,end:a.selectionEnd};else e:{h=(h=a.ownerDocument)&&h.defaultView||window;var x=h.getSelection&&h.getSelection();if(x&&x.rangeCount!==0){h=x.anchorNode;var C=x.anchorOffset,_=x.focusNode;x=x.focusOffset;try{h.nodeType,_.nodeType}catch{h=null;break e}var V=0,K=-1,se=-1,xe=0,Oe=0,Fe=a,be=null;t:for(;;){for(var Re;Fe!==h||C!==0&&Fe.nodeType!==3||(K=V+C),Fe!==_||x!==0&&Fe.nodeType!==3||(se=V+x),Fe.nodeType===3&&(V+=Fe.nodeValue.length),(Re=Fe.firstChild)!==null;)be=Fe,Fe=Re;for(;;){if(Fe===a)break t;if(be===h&&++xe===C&&(K=V),be===_&&++Oe===x&&(se=V),(Re=Fe.nextSibling)!==null)break;Fe=be,be=Fe.parentNode}Fe=Re}h=K===-1||se===-1?null:{start:K,end:se}}else h=null}h=h||{start:0,end:0}}else h=null;for(Ib={focusedElem:a,selectionRange:h},fm=!1,Mr=l;Mr!==null;)if(l=Mr,a=l.child,(l.subtreeFlags&1028)!==0&&a!==null)a.return=l,Mr=a;else for(;Mr!==null;){switch(l=Mr,_=l.alternate,a=l.flags,l.tag){case 0:if((a&4)!==0&&(a=l.updateQueue,a=a!==null?a.events:null,a!==null))for(h=0;h<a.length;h++)C=a[h],C.ref.impl=C.nextImpl;break;case 11:case 15:break;case 1:if((a&1024)!==0&&_!==null){a=void 0,h=l,C=_.memoizedProps,_=_.memoizedState,x=h.stateNode;try{var ut=Rl(h.type,C);a=x.getSnapshotBeforeUpdate(ut,_),x.__reactInternalSnapshotBeforeUpdate=a}catch(Et){_n(h,h.return,Et)}}break;case 3:if((a&1024)!==0){if(a=l.stateNode.containerInfo,h=a.nodeType,h===9)Fb(a);else if(h===1)switch(a.nodeName){case"HEAD":case"HTML":case"BODY":Fb(a);break;default:a.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((a&1024)!==0)throw Error(r(163))}if(a=l.sibling,a!==null){a.return=l.return,Mr=a;break}Mr=l.return}}function mR(a,l,h){var x=h.flags;switch(h.tag){case 0:case 11:case 15:As(a,h),x&4&&Bd(5,h);break;case 1:if(As(a,h),x&4)if(a=h.stateNode,l===null)try{a.componentDidMount()}catch(V){_n(h,h.return,V)}else{var C=Rl(h.type,l.memoizedProps);l=l.memoizedState;try{a.componentDidUpdate(C,l,a.__reactInternalSnapshotBeforeUpdate)}catch(V){_n(h,h.return,V)}}x&64&&cR(h),x&512&&Hd(h,h.return);break;case 3:if(As(a,h),x&64&&(a=h.updateQueue,a!==null)){if(l=null,h.child!==null)switch(h.child.tag){case 27:case 5:l=h.child.stateNode;break;case 1:l=h.child.stateNode}try{Jk(a,l)}catch(V){_n(h,h.return,V)}}break;case 27:l===null&&x&4&&hR(h);case 26:case 5:As(a,h),l===null&&x&4&&dR(h),x&512&&Hd(h,h.return);break;case 12:As(a,h);break;case 31:As(a,h),x&4&&xR(a,h);break;case 13:As(a,h),x&4&&vR(a,h),x&64&&(a=h.memoizedState,a!==null&&(a=a.dehydrated,a!==null&&(h=pV.bind(null,h),DV(a,h))));break;case 22:if(x=h.memoizedState!==null||Ts,!x){l=l!==null&&l.memoizedState!==null||br,C=Ts;var _=br;Ts=x,(br=l)&&!_?Os(a,h,(h.subtreeFlags&8772)!==0):As(a,h),Ts=C,br=_}break;case 30:break;default:As(a,h)}}function gR(a){var l=a.alternate;l!==null&&(a.alternate=null,gR(l)),a.child=null,a.deletions=null,a.sibling=null,a.tag===5&&(l=a.stateNode,l!==null&&pn(l)),a.stateNode=null,a.return=null,a.dependencies=null,a.memoizedProps=null,a.memoizedState=null,a.pendingProps=null,a.stateNode=null,a.updateQueue=null}var Wn=null,mo=!1;function Ms(a,l,h){for(h=h.child;h!==null;)yR(a,l,h),h=h.sibling}function yR(a,l,h){if(le&&typeof le.onCommitFiberUnmount=="function")try{le.onCommitFiberUnmount(ie,h)}catch{}switch(h.tag){case 26:br||Gi(h,l),Ms(a,l,h),h.memoizedState?h.memoizedState.count--:h.stateNode&&(h=h.stateNode,h.parentNode.removeChild(h));break;case 27:br||Gi(h,l);var x=Wn,C=mo;Na(h.type)&&(Wn=h.stateNode,mo=!1),Ms(a,l,h),Wd(h.stateNode),Wn=x,mo=C;break;case 5:br||Gi(h,l);case 6:if(x=Wn,C=mo,Wn=null,Ms(a,l,h),Wn=x,mo=C,Wn!==null)if(mo)try{(Wn.nodeType===9?Wn.body:Wn.nodeName==="HTML"?Wn.ownerDocument.body:Wn).removeChild(h.stateNode)}catch(_){_n(h,l,_)}else try{Wn.removeChild(h.stateNode)}catch(_){_n(h,l,_)}break;case 18:Wn!==null&&(mo?(a=Wn,c_(a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a,h.stateNode),tu(a)):c_(Wn,h.stateNode));break;case 4:x=Wn,C=mo,Wn=h.stateNode.containerInfo,mo=!0,Ms(a,l,h),Wn=x,mo=C;break;case 0:case 11:case 14:case 15:Sa(2,h,l),br||Sa(4,h,l),Ms(a,l,h);break;case 1:br||(Gi(h,l),x=h.stateNode,typeof x.componentWillUnmount=="function"&&uR(h,l,x)),Ms(a,l,h);break;case 21:Ms(a,l,h);break;case 22:br=(x=br)||h.memoizedState!==null,Ms(a,l,h),br=x;break;default:Ms(a,l,h)}}function xR(a,l){if(l.memoizedState===null&&(a=l.alternate,a!==null&&(a=a.memoizedState,a!==null))){a=a.dehydrated;try{tu(a)}catch(h){_n(l,l.return,h)}}}function vR(a,l){if(l.memoizedState===null&&(a=l.alternate,a!==null&&(a=a.memoizedState,a!==null&&(a=a.dehydrated,a!==null))))try{tu(a)}catch(h){_n(l,l.return,h)}}function sV(a){switch(a.tag){case 31:case 13:case 19:var l=a.stateNode;return l===null&&(l=a.stateNode=new pR),l;case 22:return a=a.stateNode,l=a._retryCache,l===null&&(l=a._retryCache=new pR),l;default:throw Error(r(435,a.tag))}}function Yp(a,l){var h=sV(a);l.forEach(function(x){if(!h.has(x)){h.add(x);var C=mV.bind(null,a,x);x.then(C,C)}})}function go(a,l){var h=l.deletions;if(h!==null)for(var x=0;x<h.length;x++){var C=h[x],_=a,V=l,K=V;e:for(;K!==null;){switch(K.tag){case 27:if(Na(K.type)){Wn=K.stateNode,mo=!1;break e}break;case 5:Wn=K.stateNode,mo=!1;break e;case 3:case 4:Wn=K.stateNode.containerInfo,mo=!0;break e}K=K.return}if(Wn===null)throw Error(r(160));yR(_,V,C),Wn=null,mo=!1,_=C.alternate,_!==null&&(_.return=null),C.return=null}if(l.subtreeFlags&13886)for(l=l.child;l!==null;)bR(l,a),l=l.sibling}var Ei=null;function bR(a,l){var h=a.alternate,x=a.flags;switch(a.tag){case 0:case 11:case 14:case 15:go(l,a),yo(a),x&4&&(Sa(3,a,a.return),Bd(3,a),Sa(5,a,a.return));break;case 1:go(l,a),yo(a),x&512&&(br||h===null||Gi(h,h.return)),x&64&&Ts&&(a=a.updateQueue,a!==null&&(x=a.callbacks,x!==null&&(h=a.shared.hiddenCallbacks,a.shared.hiddenCallbacks=h===null?x:h.concat(x))));break;case 26:var C=Ei;if(go(l,a),yo(a),x&512&&(br||h===null||Gi(h,h.return)),x&4){var _=h!==null?h.memoizedState:null;if(x=a.memoizedState,h===null)if(x===null)if(a.stateNode===null){e:{x=a.type,h=a.memoizedProps,C=C.ownerDocument||C;t:switch(x){case"title":_=C.getElementsByTagName("title")[0],(!_||_[Kt]||_[Xe]||_.namespaceURI==="http://www.w3.org/2000/svg"||_.hasAttribute("itemprop"))&&(_=C.createElement(x),C.head.insertBefore(_,C.querySelector("head > title"))),Br(_,x,h),_[Xe]=a,un(_),x=_;break e;case"link":var V=b_("link","href",C).get(x+(h.href||""));if(V){for(var K=0;K<V.length;K++)if(_=V[K],_.getAttribute("href")===(h.href==null||h.href===""?null:h.href)&&_.getAttribute("rel")===(h.rel==null?null:h.rel)&&_.getAttribute("title")===(h.title==null?null:h.title)&&_.getAttribute("crossorigin")===(h.crossOrigin==null?null:h.crossOrigin)){V.splice(K,1);break t}}_=C.createElement(x),Br(_,x,h),C.head.appendChild(_);break;case"meta":if(V=b_("meta","content",C).get(x+(h.content||""))){for(K=0;K<V.length;K++)if(_=V[K],_.getAttribute("content")===(h.content==null?null:""+h.content)&&_.getAttribute("name")===(h.name==null?null:h.name)&&_.getAttribute("property")===(h.property==null?null:h.property)&&_.getAttribute("http-equiv")===(h.httpEquiv==null?null:h.httpEquiv)&&_.getAttribute("charset")===(h.charSet==null?null:h.charSet)){V.splice(K,1);break t}}_=C.createElement(x),Br(_,x,h),C.head.appendChild(_);break;default:throw Error(r(468,x))}_[Xe]=a,un(_),x=_}a.stateNode=x}else w_(C,a.type,a.stateNode);else a.stateNode=v_(C,x,a.memoizedProps);else _!==x?(_===null?h.stateNode!==null&&(h=h.stateNode,h.parentNode.removeChild(h)):_.count--,x===null?w_(C,a.type,a.stateNode):v_(C,x,a.memoizedProps)):x===null&&a.stateNode!==null&&db(a,a.memoizedProps,h.memoizedProps)}break;case 27:go(l,a),yo(a),x&512&&(br||h===null||Gi(h,h.return)),h!==null&&x&4&&db(a,a.memoizedProps,h.memoizedProps);break;case 5:if(go(l,a),yo(a),x&512&&(br||h===null||Gi(h,h.return)),a.flags&32){C=a.stateNode;try{Cc(C,"")}catch(ut){_n(a,a.return,ut)}}x&4&&a.stateNode!=null&&(C=a.memoizedProps,db(a,C,h!==null?h.memoizedProps:C)),x&1024&&(pb=!0);break;case 6:if(go(l,a),yo(a),x&4){if(a.stateNode===null)throw Error(r(162));x=a.memoizedProps,h=a.stateNode;try{h.nodeValue=x}catch(ut){_n(a,a.return,ut)}}break;case 3:if(lm=null,C=Ei,Ei=sm(l.containerInfo),go(l,a),Ei=C,yo(a),x&4&&h!==null&&h.memoizedState.isDehydrated)try{tu(l.containerInfo)}catch(ut){_n(a,a.return,ut)}pb&&(pb=!1,wR(a));break;case 4:x=Ei,Ei=sm(a.stateNode.containerInfo),go(l,a),yo(a),Ei=x;break;case 12:go(l,a),yo(a);break;case 31:go(l,a),yo(a),x&4&&(x=a.updateQueue,x!==null&&(a.updateQueue=null,Yp(a,x)));break;case 13:go(l,a),yo(a),a.child.flags&8192&&a.memoizedState!==null!=(h!==null&&h.memoizedState!==null)&&(Gp=me()),x&4&&(x=a.updateQueue,x!==null&&(a.updateQueue=null,Yp(a,x)));break;case 22:C=a.memoizedState!==null;var se=h!==null&&h.memoizedState!==null,xe=Ts,Oe=br;if(Ts=xe||C,br=Oe||se,go(l,a),br=Oe,Ts=xe,yo(a),x&8192)e:for(l=a.stateNode,l._visibility=C?l._visibility&-2:l._visibility|1,C&&(h===null||se||Ts||br||_l(a)),h=null,l=a;;){if(l.tag===5||l.tag===26){if(h===null){se=h=l;try{if(_=se.stateNode,C)V=_.style,typeof V.setProperty=="function"?V.setProperty("display","none","important"):V.display="none";else{K=se.stateNode;var Fe=se.memoizedProps.style,be=Fe!=null&&Fe.hasOwnProperty("display")?Fe.display:null;K.style.display=be==null||typeof be=="boolean"?"":(""+be).trim()}}catch(ut){_n(se,se.return,ut)}}}else if(l.tag===6){if(h===null){se=l;try{se.stateNode.nodeValue=C?"":se.memoizedProps}catch(ut){_n(se,se.return,ut)}}}else if(l.tag===18){if(h===null){se=l;try{var Re=se.stateNode;C?u_(Re,!0):u_(se.stateNode,!1)}catch(ut){_n(se,se.return,ut)}}}else if((l.tag!==22&&l.tag!==23||l.memoizedState===null||l===a)&&l.child!==null){l.child.return=l,l=l.child;continue}if(l===a)break e;for(;l.sibling===null;){if(l.return===null||l.return===a)break e;h===l&&(h=null),l=l.return}h===l&&(h=null),l.sibling.return=l.return,l=l.sibling}x&4&&(x=a.updateQueue,x!==null&&(h=x.retryQueue,h!==null&&(x.retryQueue=null,Yp(a,h))));break;case 19:go(l,a),yo(a),x&4&&(x=a.updateQueue,x!==null&&(a.updateQueue=null,Yp(a,x)));break;case 30:break;case 21:break;default:go(l,a),yo(a)}}function yo(a){var l=a.flags;if(l&2){try{for(var h,x=a.return;x!==null;){if(fR(x)){h=x;break}x=x.return}if(h==null)throw Error(r(160));switch(h.tag){case 27:var C=h.stateNode,_=fb(a);qp(a,_,C);break;case 5:var V=h.stateNode;h.flags&32&&(Cc(V,""),h.flags&=-33);var K=fb(a);qp(a,K,V);break;case 3:case 4:var se=h.stateNode.containerInfo,xe=fb(a);hb(a,xe,se);break;default:throw Error(r(161))}}catch(Oe){_n(a,a.return,Oe)}a.flags&=-3}l&4096&&(a.flags&=-4097)}function wR(a){if(a.subtreeFlags&1024)for(a=a.child;a!==null;){var l=a;wR(l),l.tag===5&&l.flags&1024&&l.stateNode.reset(),a=a.sibling}}function As(a,l){if(l.subtreeFlags&8772)for(l=l.child;l!==null;)mR(a,l.alternate,l),l=l.sibling}function _l(a){for(a=a.child;a!==null;){var l=a;switch(l.tag){case 0:case 11:case 14:case 15:Sa(4,l,l.return),_l(l);break;case 1:Gi(l,l.return);var h=l.stateNode;typeof h.componentWillUnmount=="function"&&uR(l,l.return,h),_l(l);break;case 27:Wd(l.stateNode);case 26:case 5:Gi(l,l.return),_l(l);break;case 22:l.memoizedState===null&&_l(l);break;case 30:_l(l);break;default:_l(l)}a=a.sibling}}function Os(a,l,h){for(h=h&&(l.subtreeFlags&8772)!==0,l=l.child;l!==null;){var x=l.alternate,C=a,_=l,V=_.flags;switch(_.tag){case 0:case 11:case 15:Os(C,_,h),Bd(4,_);break;case 1:if(Os(C,_,h),x=_,C=x.stateNode,typeof C.componentDidMount=="function")try{C.componentDidMount()}catch(xe){_n(x,x.return,xe)}if(x=_,C=x.updateQueue,C!==null){var K=x.stateNode;try{var se=C.shared.hiddenCallbacks;if(se!==null)for(C.shared.hiddenCallbacks=null,C=0;C<se.length;C++)Wk(se[C],K)}catch(xe){_n(x,x.return,xe)}}h&&V&64&&cR(_),Hd(_,_.return);break;case 27:hR(_);case 26:case 5:Os(C,_,h),h&&x===null&&V&4&&dR(_),Hd(_,_.return);break;case 12:Os(C,_,h);break;case 31:Os(C,_,h),h&&V&4&&xR(C,_);break;case 13:Os(C,_,h),h&&V&4&&vR(C,_);break;case 22:_.memoizedState===null&&Os(C,_,h),Hd(_,_.return);break;case 30:break;default:Os(C,_,h)}l=l.sibling}}function mb(a,l){var h=null;a!==null&&a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(h=a.memoizedState.cachePool.pool),a=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(a=l.memoizedState.cachePool.pool),a!==h&&(a!=null&&a.refCount++,h!=null&&Nd(h))}function gb(a,l){a=null,l.alternate!==null&&(a=l.alternate.memoizedState.cache),l=l.memoizedState.cache,l!==a&&(l.refCount++,a!=null&&Nd(a))}function Ci(a,l,h,x){if(l.subtreeFlags&10256)for(l=l.child;l!==null;)SR(a,l,h,x),l=l.sibling}function SR(a,l,h,x){var C=l.flags;switch(l.tag){case 0:case 11:case 15:Ci(a,l,h,x),C&2048&&Bd(9,l);break;case 1:Ci(a,l,h,x);break;case 3:Ci(a,l,h,x),C&2048&&(a=null,l.alternate!==null&&(a=l.alternate.memoizedState.cache),l=l.memoizedState.cache,l!==a&&(l.refCount++,a!=null&&Nd(a)));break;case 12:if(C&2048){Ci(a,l,h,x),a=l.stateNode;try{var _=l.memoizedProps,V=_.id,K=_.onPostCommit;typeof K=="function"&&K(V,l.alternate===null?"mount":"update",a.passiveEffectDuration,-0)}catch(se){_n(l,l.return,se)}}else Ci(a,l,h,x);break;case 31:Ci(a,l,h,x);break;case 13:Ci(a,l,h,x);break;case 23:break;case 22:_=l.stateNode,V=l.alternate,l.memoizedState!==null?_._visibility&2?Ci(a,l,h,x):Ud(a,l):_._visibility&2?Ci(a,l,h,x):(_._visibility|=2,Uc(a,l,h,x,(l.subtreeFlags&10256)!==0||!1)),C&2048&&mb(V,l);break;case 24:Ci(a,l,h,x),C&2048&&gb(l.alternate,l);break;default:Ci(a,l,h,x)}}function Uc(a,l,h,x,C){for(C=C&&((l.subtreeFlags&10256)!==0||!1),l=l.child;l!==null;){var _=a,V=l,K=h,se=x,xe=V.flags;switch(V.tag){case 0:case 11:case 15:Uc(_,V,K,se,C),Bd(8,V);break;case 23:break;case 22:var Oe=V.stateNode;V.memoizedState!==null?Oe._visibility&2?Uc(_,V,K,se,C):Ud(_,V):(Oe._visibility|=2,Uc(_,V,K,se,C)),C&&xe&2048&&mb(V.alternate,V);break;case 24:Uc(_,V,K,se,C),C&&xe&2048&&gb(V.alternate,V);break;default:Uc(_,V,K,se,C)}l=l.sibling}}function Ud(a,l){if(l.subtreeFlags&10256)for(l=l.child;l!==null;){var h=a,x=l,C=x.flags;switch(x.tag){case 22:Ud(h,x),C&2048&&mb(x.alternate,x);break;case 24:Ud(h,x),C&2048&&gb(x.alternate,x);break;default:Ud(h,x)}l=l.sibling}}var qd=8192;function qc(a,l,h){if(a.subtreeFlags&qd)for(a=a.child;a!==null;)ER(a,l,h),a=a.sibling}function ER(a,l,h){switch(a.tag){case 26:qc(a,l,h),a.flags&qd&&a.memoizedState!==null&&YV(h,Ei,a.memoizedState,a.memoizedProps);break;case 5:qc(a,l,h);break;case 3:case 4:var x=Ei;Ei=sm(a.stateNode.containerInfo),qc(a,l,h),Ei=x;break;case 22:a.memoizedState===null&&(x=a.alternate,x!==null&&x.memoizedState!==null?(x=qd,qd=16777216,qc(a,l,h),qd=x):qc(a,l,h));break;default:qc(a,l,h)}}function CR(a){var l=a.alternate;if(l!==null&&(a=l.child,a!==null)){l.child=null;do l=a.sibling,a.sibling=null,a=l;while(a!==null)}}function Yd(a){var l=a.deletions;if((a.flags&16)!==0){if(l!==null)for(var h=0;h<l.length;h++){var x=l[h];Mr=x,jR(x,a)}CR(a)}if(a.subtreeFlags&10256)for(a=a.child;a!==null;)kR(a),a=a.sibling}function kR(a){switch(a.tag){case 0:case 11:case 15:Yd(a),a.flags&2048&&Sa(9,a,a.return);break;case 3:Yd(a);break;case 12:Yd(a);break;case 22:var l=a.stateNode;a.memoizedState!==null&&l._visibility&2&&(a.return===null||a.return.tag!==13)?(l._visibility&=-3,Zp(a)):Yd(a);break;default:Yd(a)}}function Zp(a){var l=a.deletions;if((a.flags&16)!==0){if(l!==null)for(var h=0;h<l.length;h++){var x=l[h];Mr=x,jR(x,a)}CR(a)}for(a=a.child;a!==null;){switch(l=a,l.tag){case 0:case 11:case 15:Sa(8,l,l.return),Zp(l);break;case 22:h=l.stateNode,h._visibility&2&&(h._visibility&=-3,Zp(l));break;default:Zp(l)}a=a.sibling}}function jR(a,l){for(;Mr!==null;){var h=Mr;switch(h.tag){case 0:case 11:case 15:Sa(8,h,l);break;case 23:case 22:if(h.memoizedState!==null&&h.memoizedState.cachePool!==null){var x=h.memoizedState.cachePool.pool;x!=null&&x.refCount++}break;case 24:Nd(h.memoizedState.cache)}if(x=h.child,x!==null)x.return=h,Mr=x;else e:for(h=a;Mr!==null;){x=Mr;var C=x.sibling,_=x.return;if(gR(x),x===h){Mr=null;break e}if(C!==null){C.return=_,Mr=C;break e}Mr=_}}}var aV={getCacheForType:function(a){var l=$r(yr),h=l.data.get(a);return h===void 0&&(h=a(),l.data.set(a,h)),h},cacheSignal:function(){return $r(yr).controller.signal}},lV=typeof WeakMap=="function"?WeakMap:Map,En=0,Ln=null,tn=null,an=0,Rn=0,Lo=null,Ea=!1,Yc=!1,yb=!1,Ds=0,ar=0,Ca=0,Nl=0,xb=0,Fo=0,Zc=0,Zd=null,xo=null,vb=!1,Gp=0,RR=0,Kp=1/0,Xp=null,ka=null,Cr=0,ja=null,Gc=null,Ps=0,bb=0,wb=null,_R=null,Gd=0,Sb=null;function $o(){return(En&2)!==0&&an!==0?an&-an:P.T!==null?_b():Ae()}function NR(){if(Fo===0)if((an&536870912)===0||dn){var a=nt;nt<<=1,(nt&3932160)===0&&(nt=262144),Fo=a}else Fo=536870912;return a=Io.current,a!==null&&(a.flags|=32),Fo}function vo(a,l,h){(a===Ln&&(Rn===2||Rn===9)||a.cancelPendingCommit!==null)&&(Kc(a,0),Ra(a,an,Fo,!1)),Nt(a,h),((En&2)===0||a!==Ln)&&(a===Ln&&((En&2)===0&&(Nl|=h),ar===4&&Ra(a,an,Fo,!1)),Ki(a))}function TR(a,l,h){if((En&6)!==0)throw Error(r(327));var x=!h&&(l&127)===0&&(l&a.expiredLanes)===0||qt(a,l),C=x?dV(a,l):Cb(a,l,!0),_=x;do{if(C===0){Yc&&!x&&Ra(a,l,0,!1);break}else{if(h=a.current.alternate,_&&!cV(h)){C=Cb(a,l,!1),_=!1;continue}if(C===2){if(_=l,a.errorRecoveryDisabledLanes&_)var V=0;else V=a.pendingLanes&-536870913,V=V!==0?V:V&536870912?536870912:0;if(V!==0){l=V;e:{var K=a;C=Zd;var se=K.current.memoizedState.isDehydrated;if(se&&(Kc(K,V).flags|=256),V=Cb(K,V,!1),V!==2){if(yb&&!se){K.errorRecoveryDisabledLanes|=_,Nl|=_,C=4;break e}_=xo,xo=C,_!==null&&(xo===null?xo=_:xo.push.apply(xo,_))}C=V}if(_=!1,C!==2)continue}}if(C===1){Kc(a,0),Ra(a,l,0,!0);break}e:{switch(x=a,_=C,_){case 0:case 1:throw Error(r(345));case 4:if((l&4194048)!==l)break;case 6:Ra(x,l,Fo,!Ea);break e;case 2:xo=null;break;case 3:case 5:break;default:throw Error(r(329))}if((l&62914560)===l&&(C=Gp+300-me(),10<C)){if(Ra(x,l,Fo,!Ea),Ut(x,0,!0)!==0)break e;Ps=l,x.timeoutHandle=a_(MR.bind(null,x,h,xo,Xp,vb,l,Fo,Nl,Zc,Ea,_,"Throttled",-0,0),C);break e}MR(x,h,xo,Xp,vb,l,Fo,Nl,Zc,Ea,_,null,-0,0)}}break}while(!0);Ki(a)}function MR(a,l,h,x,C,_,V,K,se,xe,Oe,Fe,be,Re){if(a.timeoutHandle=-1,Fe=l.subtreeFlags,Fe&8192||(Fe&16785408)===16785408){Fe={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:bs},ER(l,_,Fe);var ut=(_&62914560)===_?Gp-me():(_&4194048)===_?RR-me():0;if(ut=ZV(Fe,ut),ut!==null){Ps=_,a.cancelPendingCommit=ut(FR.bind(null,a,l,_,h,x,C,V,K,se,Oe,Fe,null,be,Re)),Ra(a,_,V,!xe);return}}FR(a,l,_,h,x,C,V,K,se)}function cV(a){for(var l=a;;){var h=l.tag;if((h===0||h===11||h===15)&&l.flags&16384&&(h=l.updateQueue,h!==null&&(h=h.stores,h!==null)))for(var x=0;x<h.length;x++){var C=h[x],_=C.getSnapshot;C=C.value;try{if(!Do(_(),C))return!1}catch{return!1}}if(h=l.child,l.subtreeFlags&16384&&h!==null)h.return=l,l=h;else{if(l===a)break;for(;l.sibling===null;){if(l.return===null||l.return===a)return!0;l=l.return}l.sibling.return=l.return,l=l.sibling}}return!0}function Ra(a,l,h,x){l&=~xb,l&=~Nl,a.suspendedLanes|=l,a.pingedLanes&=~l,x&&(a.warmLanes|=l),x=a.expirationTimes;for(var C=l;0<C;){var _=31-ve(C),V=1<<_;x[_]=-1,C&=~V}h!==0&&hn(a,h,l)}function Qp(){return(En&6)===0?(Kd(0),!1):!0}function Eb(){if(tn!==null){if(Rn===0)var a=tn.return;else a=tn,Cs=bl=null,Fv(a),Fc=null,Md=0,a=tn;for(;a!==null;)lR(a.alternate,a),a=a.return;tn=null}}function Kc(a,l){var h=a.timeoutHandle;h!==-1&&(a.timeoutHandle=-1,NV(h)),h=a.cancelPendingCommit,h!==null&&(a.cancelPendingCommit=null,h()),Ps=0,Eb(),Ln=a,tn=h=Ss(a.current,null),an=l,Rn=0,Lo=null,Ea=!1,Yc=qt(a,l),yb=!1,Zc=Fo=xb=Nl=Ca=ar=0,xo=Zd=null,vb=!1,(l&8)!==0&&(l|=l&32);var x=a.entangledLanes;if(x!==0)for(a=a.entanglements,x&=l;0<x;){var C=31-ve(x),_=1<<C;l|=a[C],x&=~_}return Ds=l,xp(),h}function AR(a,l){Ht=null,P.H=Fd,l===Lc||l===jp?(l=Gk(),Rn=3):l===Rv?(l=Gk(),Rn=4):Rn=l===tb?8:l!==null&&typeof l=="object"&&typeof l.then=="function"?6:1,Lo=l,tn===null&&(ar=1,$p(a,ti(l,a.current)))}function OR(){var a=Io.current;return a===null?!0:(an&4194048)===an?ii===null:(an&62914560)===an||(an&536870912)!==0?a===ii:!1}function DR(){var a=P.H;return P.H=Fd,a===null?Fd:a}function PR(){var a=P.A;return P.A=aV,a}function Wp(){ar=4,Ea||(an&4194048)!==an&&Io.current!==null||(Yc=!0),(Ca&134217727)===0&&(Nl&134217727)===0||Ln===null||Ra(Ln,an,Fo,!1)}function Cb(a,l,h){var x=En;En|=2;var C=DR(),_=PR();(Ln!==a||an!==l)&&(Xp=null,Kc(a,l)),l=!1;var V=ar;e:do try{if(Rn!==0&&tn!==null){var K=tn,se=Lo;switch(Rn){case 8:Eb(),V=6;break e;case 3:case 2:case 9:case 6:Io.current===null&&(l=!0);var xe=Rn;if(Rn=0,Lo=null,Xc(a,K,se,xe),h&&Yc){V=0;break e}break;default:xe=Rn,Rn=0,Lo=null,Xc(a,K,se,xe)}}uV(),V=ar;break}catch(Oe){AR(a,Oe)}while(!0);return l&&a.shellSuspendCounter++,Cs=bl=null,En=x,P.H=C,P.A=_,tn===null&&(Ln=null,an=0,xp()),V}function uV(){for(;tn!==null;)IR(tn)}function dV(a,l){var h=En;En|=2;var x=DR(),C=PR();Ln!==a||an!==l?(Xp=null,Kp=me()+500,Kc(a,l)):Yc=qt(a,l);e:do try{if(Rn!==0&&tn!==null){l=tn;var _=Lo;t:switch(Rn){case 1:Rn=0,Lo=null,Xc(a,l,_,1);break;case 2:case 9:if(Yk(_)){Rn=0,Lo=null,zR(l);break}l=function(){Rn!==2&&Rn!==9||Ln!==a||(Rn=7),Ki(a)},_.then(l,l);break e;case 3:Rn=7;break e;case 4:Rn=5;break e;case 7:Yk(_)?(Rn=0,Lo=null,zR(l)):(Rn=0,Lo=null,Xc(a,l,_,7));break;case 5:var V=null;switch(tn.tag){case 26:V=tn.memoizedState;case 5:case 27:var K=tn;if(V?S_(V):K.stateNode.complete){Rn=0,Lo=null;var se=K.sibling;if(se!==null)tn=se;else{var xe=K.return;xe!==null?(tn=xe,Jp(xe)):tn=null}break t}}Rn=0,Lo=null,Xc(a,l,_,5);break;case 6:Rn=0,Lo=null,Xc(a,l,_,6);break;case 8:Eb(),ar=6;break e;default:throw Error(r(462))}}fV();break}catch(Oe){AR(a,Oe)}while(!0);return Cs=bl=null,P.H=x,P.A=C,En=h,tn!==null?0:(Ln=null,an=0,xp(),ar)}function fV(){for(;tn!==null&&!Ge();)IR(tn)}function IR(a){var l=sR(a.alternate,a,Ds);a.memoizedProps=a.pendingProps,l===null?Jp(a):tn=l}function zR(a){var l=a,h=l.alternate;switch(l.tag){case 15:case 0:l=eR(h,l,l.pendingProps,l.type,void 0,an);break;case 11:l=eR(h,l,l.pendingProps,l.type.render,l.ref,an);break;case 5:Fv(l);default:lR(h,l),l=tn=Pk(l,Ds),l=sR(h,l,Ds)}a.memoizedProps=a.pendingProps,l===null?Jp(a):tn=l}function Xc(a,l,h,x){Cs=bl=null,Fv(l),Fc=null,Md=0;var C=l.return;try{if(eV(a,C,l,h,an)){ar=1,$p(a,ti(h,a.current)),tn=null;return}}catch(_){if(C!==null)throw tn=C,_;ar=1,$p(a,ti(h,a.current)),tn=null;return}l.flags&32768?(dn||x===1?a=!0:Yc||(an&536870912)!==0?a=!1:(Ea=a=!0,(x===2||x===9||x===3||x===6)&&(x=Io.current,x!==null&&x.tag===13&&(x.flags|=16384))),LR(l,a)):Jp(l)}function Jp(a){var l=a;do{if((l.flags&32768)!==0){LR(l,Ea);return}a=l.return;var h=rV(l.alternate,l,Ds);if(h!==null){tn=h;return}if(l=l.sibling,l!==null){tn=l;return}tn=l=a}while(l!==null);ar===0&&(ar=5)}function LR(a,l){do{var h=oV(a.alternate,a);if(h!==null){h.flags&=32767,tn=h;return}if(h=a.return,h!==null&&(h.flags|=32768,h.subtreeFlags=0,h.deletions=null),!l&&(a=a.sibling,a!==null)){tn=a;return}tn=a=h}while(a!==null);ar=6,tn=null}function FR(a,l,h,x,C,_,V,K,se){a.cancelPendingCommit=null;do em();while(Cr!==0);if((En&6)!==0)throw Error(r(327));if(l!==null){if(l===a.current)throw Error(r(177));if(_=l.lanes|l.childLanes,_|=fv,Qn(a,h,_,V,K,se),a===Ln&&(tn=Ln=null,an=0),Gc=l,ja=a,Ps=h,bb=_,wb=C,_R=x,(l.subtreeFlags&10256)!==0||(l.flags&10256)!==0?(a.callbackNode=null,a.callbackPriority=0,gV(Se,function(){return UR(),null})):(a.callbackNode=null,a.callbackPriority=0),x=(l.flags&13878)!==0,(l.subtreeFlags&13878)!==0||x){x=P.T,P.T=null,C=I.p,I.p=2,V=En,En|=4;try{iV(a,l,h)}finally{En=V,I.p=C,P.T=x}}Cr=1,$R(),VR(),BR()}}function $R(){if(Cr===1){Cr=0;var a=ja,l=Gc,h=(l.flags&13878)!==0;if((l.subtreeFlags&13878)!==0||h){h=P.T,P.T=null;var x=I.p;I.p=2;var C=En;En|=4;try{bR(l,a);var _=Ib,V=jk(a.containerInfo),K=_.focusedElem,se=_.selectionRange;if(V!==K&&K&&K.ownerDocument&&kk(K.ownerDocument.documentElement,K)){if(se!==null&&av(K)){var xe=se.start,Oe=se.end;if(Oe===void 0&&(Oe=xe),"selectionStart"in K)K.selectionStart=xe,K.selectionEnd=Math.min(Oe,K.value.length);else{var Fe=K.ownerDocument||document,be=Fe&&Fe.defaultView||window;if(be.getSelection){var Re=be.getSelection(),ut=K.textContent.length,Et=Math.min(se.start,ut),An=se.end===void 0?Et:Math.min(se.end,ut);!Re.extend&&Et>An&&(V=An,An=Et,Et=V);var he=Ck(K,Et),ce=Ck(K,An);if(he&&ce&&(Re.rangeCount!==1||Re.anchorNode!==he.node||Re.anchorOffset!==he.offset||Re.focusNode!==ce.node||Re.focusOffset!==ce.offset)){var ye=Fe.createRange();ye.setStart(he.node,he.offset),Re.removeAllRanges(),Et>An?(Re.addRange(ye),Re.extend(ce.node,ce.offset)):(ye.setEnd(ce.node,ce.offset),Re.addRange(ye))}}}}for(Fe=[],Re=K;Re=Re.parentNode;)Re.nodeType===1&&Fe.push({element:Re,left:Re.scrollLeft,top:Re.scrollTop});for(typeof K.focus=="function"&&K.focus(),K=0;K<Fe.length;K++){var Ie=Fe[K];Ie.element.scrollLeft=Ie.left,Ie.element.scrollTop=Ie.top}}fm=!!Pb,Ib=Pb=null}finally{En=C,I.p=x,P.T=h}}a.current=l,Cr=2}}function VR(){if(Cr===2){Cr=0;var a=ja,l=Gc,h=(l.flags&8772)!==0;if((l.subtreeFlags&8772)!==0||h){h=P.T,P.T=null;var x=I.p;I.p=2;var C=En;En|=4;try{mR(a,l.alternate,l)}finally{En=C,I.p=x,P.T=h}}Cr=3}}function BR(){if(Cr===4||Cr===3){Cr=0,ot();var a=ja,l=Gc,h=Ps,x=_R;(l.subtreeFlags&10256)!==0||(l.flags&10256)!==0?Cr=5:(Cr=0,Gc=ja=null,HR(a,a.pendingLanes));var C=a.pendingLanes;if(C===0&&(ka=null),fe(h),l=l.stateNode,le&&typeof le.onCommitFiberRoot=="function")try{le.onCommitFiberRoot(ie,l,void 0,(l.current.flags&128)===128)}catch{}if(x!==null){l=P.T,C=I.p,I.p=2,P.T=null;try{for(var _=a.onRecoverableError,V=0;V<x.length;V++){var K=x[V];_(K.value,{componentStack:K.stack})}}finally{P.T=l,I.p=C}}(Ps&3)!==0&&em(),Ki(a),C=a.pendingLanes,(h&261930)!==0&&(C&42)!==0?a===Sb?Gd++:(Gd=0,Sb=a):Gd=0,Kd(0)}}function HR(a,l){(a.pooledCacheLanes&=l)===0&&(l=a.pooledCache,l!=null&&(a.pooledCache=null,Nd(l)))}function em(){return $R(),VR(),BR(),UR()}function UR(){if(Cr!==5)return!1;var a=ja,l=bb;bb=0;var h=fe(Ps),x=P.T,C=I.p;try{I.p=32>h?32:h,P.T=null,h=wb,wb=null;var _=ja,V=Ps;if(Cr=0,Gc=ja=null,Ps=0,(En&6)!==0)throw Error(r(331));var K=En;if(En|=4,kR(_.current),SR(_,_.current,V,h),En=K,Kd(0,!1),le&&typeof le.onPostCommitFiberRoot=="function")try{le.onPostCommitFiberRoot(ie,_)}catch{}return!0}finally{I.p=C,P.T=x,HR(a,l)}}function qR(a,l,h){l=ti(h,l),l=eb(a.stateNode,l,2),a=va(a,l,2),a!==null&&(Nt(a,2),Ki(a))}function _n(a,l,h){if(a.tag===3)qR(a,a,h);else for(;l!==null;){if(l.tag===3){qR(l,a,h);break}else if(l.tag===1){var x=l.stateNode;if(typeof l.type.getDerivedStateFromError=="function"||typeof x.componentDidCatch=="function"&&(ka===null||!ka.has(x))){a=ti(h,a),h=Yj(2),x=va(l,h,2),x!==null&&(Zj(h,x,l,a),Nt(x,2),Ki(x));break}}l=l.return}}function kb(a,l,h){var x=a.pingCache;if(x===null){x=a.pingCache=new lV;var C=new Set;x.set(l,C)}else C=x.get(l),C===void 0&&(C=new Set,x.set(l,C));C.has(h)||(yb=!0,C.add(h),a=hV.bind(null,a,l,h),l.then(a,a))}function hV(a,l,h){var x=a.pingCache;x!==null&&x.delete(l),a.pingedLanes|=a.suspendedLanes&h,a.warmLanes&=~h,Ln===a&&(an&h)===h&&(ar===4||ar===3&&(an&62914560)===an&&300>me()-Gp?(En&2)===0&&Kc(a,0):xb|=h,Zc===an&&(Zc=0)),Ki(a)}function YR(a,l){l===0&&(l=Rt()),a=yl(a,l),a!==null&&(Nt(a,l),Ki(a))}function pV(a){var l=a.memoizedState,h=0;l!==null&&(h=l.retryLane),YR(a,h)}function mV(a,l){var h=0;switch(a.tag){case 31:case 13:var x=a.stateNode,C=a.memoizedState;C!==null&&(h=C.retryLane);break;case 19:x=a.stateNode;break;case 22:x=a.stateNode._retryCache;break;default:throw Error(r(314))}x!==null&&x.delete(l),YR(a,h)}function gV(a,l){return Le(a,l)}var tm=null,Qc=null,jb=!1,nm=!1,Rb=!1,_a=0;function Ki(a){a!==Qc&&a.next===null&&(Qc===null?tm=Qc=a:Qc=Qc.next=a),nm=!0,jb||(jb=!0,xV())}function Kd(a,l){if(!Rb&&nm){Rb=!0;do for(var h=!1,x=tm;x!==null;){if(a!==0){var C=x.pendingLanes;if(C===0)var _=0;else{var V=x.suspendedLanes,K=x.pingedLanes;_=(1<<31-ve(42|a)+1)-1,_&=C&~(V&~K),_=_&201326741?_&201326741|1:_?_|2:0}_!==0&&(h=!0,XR(x,_))}else _=an,_=Ut(x,x===Ln?_:0,x.cancelPendingCommit!==null||x.timeoutHandle!==-1),(_&3)===0||qt(x,_)||(h=!0,XR(x,_));x=x.next}while(h);Rb=!1}}function yV(){ZR()}function ZR(){nm=jb=!1;var a=0;_a!==0&&_V()&&(a=_a);for(var l=me(),h=null,x=tm;x!==null;){var C=x.next,_=GR(x,l);_===0?(x.next=null,h===null?tm=C:h.next=C,C===null&&(Qc=h)):(h=x,(a!==0||(_&3)!==0)&&(nm=!0)),x=C}Cr!==0&&Cr!==5||Kd(a),_a!==0&&(_a=0)}function GR(a,l){for(var h=a.suspendedLanes,x=a.pingedLanes,C=a.expirationTimes,_=a.pendingLanes&-62914561;0<_;){var V=31-ve(_),K=1<<V,se=C[V];se===-1?((K&h)===0||(K&x)!==0)&&(C[V]=at(K,l)):se<=l&&(a.expiredLanes|=K),_&=~K}if(l=Ln,h=an,h=Ut(a,a===l?h:0,a.cancelPendingCommit!==null||a.timeoutHandle!==-1),x=a.callbackNode,h===0||a===l&&(Rn===2||Rn===9)||a.cancelPendingCommit!==null)return x!==null&&x!==null&&He(x),a.callbackNode=null,a.callbackPriority=0;if((h&3)===0||qt(a,h)){if(l=h&-h,l===a.callbackPriority)return l;switch(x!==null&&He(x),fe(h)){case 2:case 8:h=ue;break;case 32:h=Se;break;case 268435456:h=Ye;break;default:h=Se}return x=KR.bind(null,a),h=Le(h,x),a.callbackPriority=l,a.callbackNode=h,l}return x!==null&&x!==null&&He(x),a.callbackPriority=2,a.callbackNode=null,2}function KR(a,l){if(Cr!==0&&Cr!==5)return a.callbackNode=null,a.callbackPriority=0,null;var h=a.callbackNode;if(em()&&a.callbackNode!==h)return null;var x=an;return x=Ut(a,a===Ln?x:0,a.cancelPendingCommit!==null||a.timeoutHandle!==-1),x===0?null:(TR(a,x,l),GR(a,me()),a.callbackNode!=null&&a.callbackNode===h?KR.bind(null,a):null)}function XR(a,l){if(em())return null;TR(a,l,!0)}function xV(){TV(function(){(En&6)!==0?Le(de,yV):ZR()})}function _b(){if(_a===0){var a=Ic;a===0&&(a=Ke,Ke<<=1,(Ke&261888)===0&&(Ke=256)),_a=a}return _a}function QR(a){return a==null||typeof a=="symbol"||typeof a=="boolean"?null:typeof a=="function"?a:up(""+a)}function WR(a,l){var h=l.ownerDocument.createElement("input");return h.name=l.name,h.value=l.value,a.id&&h.setAttribute("form",a.id),l.parentNode.insertBefore(h,l),a=new FormData(a),h.parentNode.removeChild(h),a}function vV(a,l,h,x,C){if(l==="submit"&&h&&h.stateNode===C){var _=QR((C[et]||null).action),V=x.submitter;V&&(l=(l=V[et]||null)?QR(l.formAction):V.getAttribute("formAction"),l!==null&&(_=l,V=null));var K=new pp("action","action",null,x,C);a.push({event:K,listeners:[{instance:null,listener:function(){if(x.defaultPrevented){if(_a!==0){var se=V?WR(C,V):new FormData(C);Gv(h,{pending:!0,data:se,method:C.method,action:_},null,se)}}else typeof _=="function"&&(K.preventDefault(),se=V?WR(C,V):new FormData(C),Gv(h,{pending:!0,data:se,method:C.method,action:_},_,se))},currentTarget:C}]})}}for(var Nb=0;Nb<dv.length;Nb++){var Tb=dv[Nb],bV=Tb.toLowerCase(),wV=Tb[0].toUpperCase()+Tb.slice(1);Si(bV,"on"+wV)}Si(Nk,"onAnimationEnd"),Si(Tk,"onAnimationIteration"),Si(Mk,"onAnimationStart"),Si("dblclick","onDoubleClick"),Si("focusin","onFocus"),Si("focusout","onBlur"),Si(z5,"onTransitionRun"),Si(L5,"onTransitionStart"),Si(F5,"onTransitionCancel"),Si(Ak,"onTransitionEnd"),zr("onMouseEnter",["mouseout","mouseover"]),zr("onMouseLeave",["mouseout","mouseover"]),zr("onPointerEnter",["pointerout","pointerover"]),zr("onPointerLeave",["pointerout","pointerover"]),Xr("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Xr("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Xr("onBeforeInput",["compositionend","keypress","textInput","paste"]),Xr("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Xr("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Xr("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Xd="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(" "),SV=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Xd));function JR(a,l){l=(l&4)!==0;for(var h=0;h<a.length;h++){var x=a[h],C=x.event;x=x.listeners;e:{var _=void 0;if(l)for(var V=x.length-1;0<=V;V--){var K=x[V],se=K.instance,xe=K.currentTarget;if(K=K.listener,se!==_&&C.isPropagationStopped())break e;_=K,C.currentTarget=xe;try{_(C)}catch(Oe){yp(Oe)}C.currentTarget=null,_=se}else for(V=0;V<x.length;V++){if(K=x[V],se=K.instance,xe=K.currentTarget,K=K.listener,se!==_&&C.isPropagationStopped())break e;_=K,C.currentTarget=xe;try{_(C)}catch(Oe){yp(Oe)}C.currentTarget=null,_=se}}}}function nn(a,l){var h=l[dt];h===void 0&&(h=l[dt]=new Set);var x=a+"__bubble";h.has(x)||(e_(l,a,2,!1),h.add(x))}function Mb(a,l,h){var x=0;l&&(x|=4),e_(h,a,x,l)}var rm="_reactListening"+Math.random().toString(36).slice(2);function Ab(a){if(!a[rm]){a[rm]=!0,qi.forEach(function(h){h!=="selectionchange"&&(SV.has(h)||Mb(h,!1,a),Mb(h,!0,a))});var l=a.nodeType===9?a:a.ownerDocument;l===null||l[rm]||(l[rm]=!0,Mb("selectionchange",!1,l))}}function e_(a,l,h,x){switch(N_(l)){case 2:var C=XV;break;case 8:C=QV;break;default:C=Zb}h=C.bind(null,l,h,a),C=void 0,!Wx||l!=="touchstart"&&l!=="touchmove"&&l!=="wheel"||(C=!0),x?C!==void 0?a.addEventListener(l,h,{capture:!0,passive:C}):a.addEventListener(l,h,!0):C!==void 0?a.addEventListener(l,h,{passive:C}):a.addEventListener(l,h,!1)}function Ob(a,l,h,x,C){var _=x;if((l&1)===0&&(l&2)===0&&x!==null)e:for(;;){if(x===null)return;var V=x.tag;if(V===3||V===4){var K=x.stateNode.containerInfo;if(K===C)break;if(V===4)for(V=x.return;V!==null;){var se=V.tag;if((se===3||se===4)&&V.stateNode.containerInfo===C)return;V=V.return}for(;K!==null;){if(V=zn(K),V===null)return;if(se=V.tag,se===5||se===6||se===26||se===27){x=_=V;continue e}K=K.parentNode}}x=x.return}ik(function(){var xe=_,Oe=Xx(h),Fe=[];e:{var be=Ok.get(a);if(be!==void 0){var Re=pp,ut=a;switch(a){case"keypress":if(fp(h)===0)break e;case"keydown":case"keyup":Re=m5;break;case"focusin":ut="focus",Re=nv;break;case"focusout":ut="blur",Re=nv;break;case"beforeblur":case"afterblur":Re=nv;break;case"click":if(h.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":Re=lk;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Re=r5;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Re=x5;break;case Nk:case Tk:case Mk:Re=s5;break;case Ak:Re=b5;break;case"scroll":case"scrollend":Re=t5;break;case"wheel":Re=S5;break;case"copy":case"cut":case"paste":Re=l5;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Re=uk;break;case"toggle":case"beforetoggle":Re=C5}var Et=(l&4)!==0,An=!Et&&(a==="scroll"||a==="scrollend"),he=Et?be!==null?be+"Capture":null:be;Et=[];for(var ce=xe,ye;ce!==null;){var Ie=ce;if(ye=Ie.stateNode,Ie=Ie.tag,Ie!==5&&Ie!==26&&Ie!==27||ye===null||he===null||(Ie=xd(ce,he),Ie!=null&&Et.push(Qd(ce,Ie,ye))),An)break;ce=ce.return}0<Et.length&&(be=new Re(be,ut,null,h,Oe),Fe.push({event:be,listeners:Et}))}}if((l&7)===0){e:{if(be=a==="mouseover"||a==="pointerover",Re=a==="mouseout"||a==="pointerout",be&&h!==Kx&&(ut=h.relatedTarget||h.fromElement)&&(zn(ut)||ut[tt]))break e;if((Re||be)&&(be=Oe.window===Oe?Oe:(be=Oe.ownerDocument)?be.defaultView||be.parentWindow:window,Re?(ut=h.relatedTarget||h.toElement,Re=xe,ut=ut?zn(ut):null,ut!==null&&(An=i(ut),Et=ut.tag,ut!==An||Et!==5&&Et!==27&&Et!==6)&&(ut=null)):(Re=null,ut=xe),Re!==ut)){if(Et=lk,Ie="onMouseLeave",he="onMouseEnter",ce="mouse",(a==="pointerout"||a==="pointerover")&&(Et=uk,Ie="onPointerLeave",he="onPointerEnter",ce="pointer"),An=Re==null?be:sn(Re),ye=ut==null?be:sn(ut),be=new Et(Ie,ce+"leave",Re,h,Oe),be.target=An,be.relatedTarget=ye,Ie=null,zn(Oe)===xe&&(Et=new Et(he,ce+"enter",ut,h,Oe),Et.target=ye,Et.relatedTarget=An,Ie=Et),An=Ie,Re&&ut)t:{for(Et=EV,he=Re,ce=ut,ye=0,Ie=he;Ie;Ie=Et(Ie))ye++;Ie=0;for(var gt=ce;gt;gt=Et(gt))Ie++;for(;0<ye-Ie;)he=Et(he),ye--;for(;0<Ie-ye;)ce=Et(ce),Ie--;for(;ye--;){if(he===ce||ce!==null&&he===ce.alternate){Et=he;break t}he=Et(he),ce=Et(ce)}Et=null}else Et=null;Re!==null&&t_(Fe,be,Re,Et,!1),ut!==null&&An!==null&&t_(Fe,An,ut,Et,!0)}}e:{if(be=xe?sn(xe):window,Re=be.nodeName&&be.nodeName.toLowerCase(),Re==="select"||Re==="input"&&be.type==="file")var vn=xk;else if(gk(be))if(vk)vn=D5;else{vn=A5;var ht=M5}else Re=be.nodeName,!Re||Re.toLowerCase()!=="input"||be.type!=="checkbox"&&be.type!=="radio"?xe&&Gx(xe.elementType)&&(vn=xk):vn=O5;if(vn&&(vn=vn(a,xe))){yk(Fe,vn,h,Oe);break e}ht&&ht(a,be,xe),a==="focusout"&&xe&&be.type==="number"&&xe.memoizedProps.value!=null&&gd(be,"number",be.value)}switch(ht=xe?sn(xe):window,a){case"focusin":(gk(ht)||ht.contentEditable==="true")&&(_c=ht,lv=xe,jd=null);break;case"focusout":jd=lv=_c=null;break;case"mousedown":cv=!0;break;case"contextmenu":case"mouseup":case"dragend":cv=!1,Rk(Fe,h,Oe);break;case"selectionchange":if(I5)break;case"keydown":case"keyup":Rk(Fe,h,Oe)}var Yt;if(ov)e:{switch(a){case"compositionstart":var ln="onCompositionStart";break e;case"compositionend":ln="onCompositionEnd";break e;case"compositionupdate":ln="onCompositionUpdate";break e}ln=void 0}else Rc?pk(a,h)&&(ln="onCompositionEnd"):a==="keydown"&&h.keyCode===229&&(ln="onCompositionStart");ln&&(dk&&h.locale!=="ko"&&(Rc||ln!=="onCompositionStart"?ln==="onCompositionEnd"&&Rc&&(Yt=sk()):(fa=Oe,Jx="value"in fa?fa.value:fa.textContent,Rc=!0)),ht=om(xe,ln),0<ht.length&&(ln=new ck(ln,a,null,h,Oe),Fe.push({event:ln,listeners:ht}),Yt?ln.data=Yt:(Yt=mk(h),Yt!==null&&(ln.data=Yt)))),(Yt=j5?R5(a,h):_5(a,h))&&(ln=om(xe,"onBeforeInput"),0<ln.length&&(ht=new ck("onBeforeInput","beforeinput",null,h,Oe),Fe.push({event:ht,listeners:ln}),ht.data=Yt)),vV(Fe,a,xe,h,Oe)}JR(Fe,l)})}function Qd(a,l,h){return{instance:a,listener:l,currentTarget:h}}function om(a,l){for(var h=l+"Capture",x=[];a!==null;){var C=a,_=C.stateNode;if(C=C.tag,C!==5&&C!==26&&C!==27||_===null||(C=xd(a,h),C!=null&&x.unshift(Qd(a,C,_)),C=xd(a,l),C!=null&&x.push(Qd(a,C,_))),a.tag===3)return x;a=a.return}return[]}function EV(a){if(a===null)return null;do a=a.return;while(a&&a.tag!==5&&a.tag!==27);return a||null}function t_(a,l,h,x,C){for(var _=l._reactName,V=[];h!==null&&h!==x;){var K=h,se=K.alternate,xe=K.stateNode;if(K=K.tag,se!==null&&se===x)break;K!==5&&K!==26&&K!==27||xe===null||(se=xe,C?(xe=xd(h,_),xe!=null&&V.unshift(Qd(h,xe,se))):C||(xe=xd(h,_),xe!=null&&V.push(Qd(h,xe,se)))),h=h.return}V.length!==0&&a.push({event:l,listeners:V})}var CV=/\r\n?/g,kV=/\u0000|\uFFFD/g;function n_(a){return(typeof a=="string"?a:""+a).replace(CV,`
9
+ `).replace(kV,"")}function r_(a,l){return l=n_(l),n_(a)===l}function Mn(a,l,h,x,C,_){switch(h){case"children":typeof x=="string"?l==="body"||l==="textarea"&&x===""||Cc(a,x):(typeof x=="number"||typeof x=="bigint")&&l!=="body"&&Cc(a,""+x);break;case"className":wi(a,"class",x);break;case"tabIndex":wi(a,"tabindex",x);break;case"dir":case"role":case"viewBox":case"width":case"height":wi(a,h,x);break;case"style":rk(a,x,_);break;case"data":if(l!=="object"){wi(a,"data",x);break}case"src":case"href":if(x===""&&(l!=="a"||h!=="href")){a.removeAttribute(h);break}if(x==null||typeof x=="function"||typeof x=="symbol"||typeof x=="boolean"){a.removeAttribute(h);break}x=up(""+x),a.setAttribute(h,x);break;case"action":case"formAction":if(typeof x=="function"){a.setAttribute(h,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof _=="function"&&(h==="formAction"?(l!=="input"&&Mn(a,l,"name",C.name,C,null),Mn(a,l,"formEncType",C.formEncType,C,null),Mn(a,l,"formMethod",C.formMethod,C,null),Mn(a,l,"formTarget",C.formTarget,C,null)):(Mn(a,l,"encType",C.encType,C,null),Mn(a,l,"method",C.method,C,null),Mn(a,l,"target",C.target,C,null)));if(x==null||typeof x=="symbol"||typeof x=="boolean"){a.removeAttribute(h);break}x=up(""+x),a.setAttribute(h,x);break;case"onClick":x!=null&&(a.onclick=bs);break;case"onScroll":x!=null&&nn("scroll",a);break;case"onScrollEnd":x!=null&&nn("scrollend",a);break;case"dangerouslySetInnerHTML":if(x!=null){if(typeof x!="object"||!("__html"in x))throw Error(r(61));if(h=x.__html,h!=null){if(C.children!=null)throw Error(r(60));a.innerHTML=h}}break;case"multiple":a.multiple=x&&typeof x!="function"&&typeof x!="symbol";break;case"muted":a.muted=x&&typeof x!="function"&&typeof x!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(x==null||typeof x=="function"||typeof x=="boolean"||typeof x=="symbol"){a.removeAttribute("xlink:href");break}h=up(""+x),a.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",h);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":x!=null&&typeof x!="function"&&typeof x!="symbol"?a.setAttribute(h,""+x):a.removeAttribute(h);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":x&&typeof x!="function"&&typeof x!="symbol"?a.setAttribute(h,""):a.removeAttribute(h);break;case"capture":case"download":x===!0?a.setAttribute(h,""):x!==!1&&x!=null&&typeof x!="function"&&typeof x!="symbol"?a.setAttribute(h,x):a.removeAttribute(h);break;case"cols":case"rows":case"size":case"span":x!=null&&typeof x!="function"&&typeof x!="symbol"&&!isNaN(x)&&1<=x?a.setAttribute(h,x):a.removeAttribute(h);break;case"rowSpan":case"start":x==null||typeof x=="function"||typeof x=="symbol"||isNaN(x)?a.removeAttribute(h):a.setAttribute(h,x);break;case"popover":nn("beforetoggle",a),nn("toggle",a),bi(a,"popover",x);break;case"xlinkActuate":Tt(a,"http://www.w3.org/1999/xlink","xlink:actuate",x);break;case"xlinkArcrole":Tt(a,"http://www.w3.org/1999/xlink","xlink:arcrole",x);break;case"xlinkRole":Tt(a,"http://www.w3.org/1999/xlink","xlink:role",x);break;case"xlinkShow":Tt(a,"http://www.w3.org/1999/xlink","xlink:show",x);break;case"xlinkTitle":Tt(a,"http://www.w3.org/1999/xlink","xlink:title",x);break;case"xlinkType":Tt(a,"http://www.w3.org/1999/xlink","xlink:type",x);break;case"xmlBase":Tt(a,"http://www.w3.org/XML/1998/namespace","xml:base",x);break;case"xmlLang":Tt(a,"http://www.w3.org/XML/1998/namespace","xml:lang",x);break;case"xmlSpace":Tt(a,"http://www.w3.org/XML/1998/namespace","xml:space",x);break;case"is":bi(a,"is",x);break;case"innerText":case"textContent":break;default:(!(2<h.length)||h[0]!=="o"&&h[0]!=="O"||h[1]!=="n"&&h[1]!=="N")&&(h=J$.get(h)||h,bi(a,h,x))}}function Db(a,l,h,x,C,_){switch(h){case"style":rk(a,x,_);break;case"dangerouslySetInnerHTML":if(x!=null){if(typeof x!="object"||!("__html"in x))throw Error(r(61));if(h=x.__html,h!=null){if(C.children!=null)throw Error(r(60));a.innerHTML=h}}break;case"children":typeof x=="string"?Cc(a,x):(typeof x=="number"||typeof x=="bigint")&&Cc(a,""+x);break;case"onScroll":x!=null&&nn("scroll",a);break;case"onScrollEnd":x!=null&&nn("scrollend",a);break;case"onClick":x!=null&&(a.onclick=bs);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Ao.hasOwnProperty(h))e:{if(h[0]==="o"&&h[1]==="n"&&(C=h.endsWith("Capture"),l=h.slice(2,C?h.length-7:void 0),_=a[et]||null,_=_!=null?_[h]:null,typeof _=="function"&&a.removeEventListener(l,_,C),typeof x=="function")){typeof _!="function"&&_!==null&&(h in a?a[h]=null:a.hasAttribute(h)&&a.removeAttribute(h)),a.addEventListener(l,x,C);break e}h in a?a[h]=x:x===!0?a.setAttribute(h,""):bi(a,h,x)}}}function Br(a,l,h){switch(l){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":nn("error",a),nn("load",a);var x=!1,C=!1,_;for(_ in h)if(h.hasOwnProperty(_)){var V=h[_];if(V!=null)switch(_){case"src":x=!0;break;case"srcSet":C=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,l));default:Mn(a,l,_,V,h,null)}}C&&Mn(a,l,"srcSet",h.srcSet,h,null),x&&Mn(a,l,"src",h.src,h,null);return;case"input":nn("invalid",a);var K=_=V=C=null,se=null,xe=null;for(x in h)if(h.hasOwnProperty(x)){var Oe=h[x];if(Oe!=null)switch(x){case"name":C=Oe;break;case"type":V=Oe;break;case"checked":se=Oe;break;case"defaultChecked":xe=Oe;break;case"value":_=Oe;break;case"defaultValue":K=Oe;break;case"children":case"dangerouslySetInnerHTML":if(Oe!=null)throw Error(r(137,l));break;default:Mn(a,l,x,Oe,h,null)}}Ec(a,_,K,se,xe,V,C,!1);return;case"select":nn("invalid",a),x=V=_=null;for(C in h)if(h.hasOwnProperty(C)&&(K=h[C],K!=null))switch(C){case"value":_=K;break;case"defaultValue":V=K;break;case"multiple":x=K;default:Mn(a,l,C,K,h,null)}l=_,h=V,a.multiple=!!x,l!=null?da(a,!!x,l,!1):h!=null&&da(a,!!x,h,!0);return;case"textarea":nn("invalid",a),_=C=x=null;for(V in h)if(h.hasOwnProperty(V)&&(K=h[V],K!=null))switch(V){case"value":x=K;break;case"defaultValue":C=K;break;case"children":_=K;break;case"dangerouslySetInnerHTML":if(K!=null)throw Error(r(91));break;default:Mn(a,l,V,K,h,null)}tk(a,x,C,_);return;case"option":for(se in h)h.hasOwnProperty(se)&&(x=h[se],x!=null)&&(se==="selected"?a.selected=x&&typeof x!="function"&&typeof x!="symbol":Mn(a,l,se,x,h,null));return;case"dialog":nn("beforetoggle",a),nn("toggle",a),nn("cancel",a),nn("close",a);break;case"iframe":case"object":nn("load",a);break;case"video":case"audio":for(x=0;x<Xd.length;x++)nn(Xd[x],a);break;case"image":nn("error",a),nn("load",a);break;case"details":nn("toggle",a);break;case"embed":case"source":case"link":nn("error",a),nn("load",a);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(xe in h)if(h.hasOwnProperty(xe)&&(x=h[xe],x!=null))switch(xe){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,l));default:Mn(a,l,xe,x,h,null)}return;default:if(Gx(l)){for(Oe in h)h.hasOwnProperty(Oe)&&(x=h[Oe],x!==void 0&&Db(a,l,Oe,x,h,void 0));return}}for(K in h)h.hasOwnProperty(K)&&(x=h[K],x!=null&&Mn(a,l,K,x,h,null))}function jV(a,l,h,x){switch(l){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var C=null,_=null,V=null,K=null,se=null,xe=null,Oe=null;for(Re in h){var Fe=h[Re];if(h.hasOwnProperty(Re)&&Fe!=null)switch(Re){case"checked":break;case"value":break;case"defaultValue":se=Fe;default:x.hasOwnProperty(Re)||Mn(a,l,Re,null,x,Fe)}}for(var be in x){var Re=x[be];if(Fe=h[be],x.hasOwnProperty(be)&&(Re!=null||Fe!=null))switch(be){case"type":_=Re;break;case"name":C=Re;break;case"checked":xe=Re;break;case"defaultChecked":Oe=Re;break;case"value":V=Re;break;case"defaultValue":K=Re;break;case"children":case"dangerouslySetInnerHTML":if(Re!=null)throw Error(r(137,l));break;default:Re!==Fe&&Mn(a,l,be,Re,x,Fe)}}hl(a,V,K,se,xe,Oe,_,C);return;case"select":Re=V=K=be=null;for(_ in h)if(se=h[_],h.hasOwnProperty(_)&&se!=null)switch(_){case"value":break;case"multiple":Re=se;default:x.hasOwnProperty(_)||Mn(a,l,_,null,x,se)}for(C in x)if(_=x[C],se=h[C],x.hasOwnProperty(C)&&(_!=null||se!=null))switch(C){case"value":be=_;break;case"defaultValue":K=_;break;case"multiple":V=_;default:_!==se&&Mn(a,l,C,_,x,se)}l=K,h=V,x=Re,be!=null?da(a,!!h,be,!1):!!x!=!!h&&(l!=null?da(a,!!h,l,!0):da(a,!!h,h?[]:"",!1));return;case"textarea":Re=be=null;for(K in h)if(C=h[K],h.hasOwnProperty(K)&&C!=null&&!x.hasOwnProperty(K))switch(K){case"value":break;case"children":break;default:Mn(a,l,K,null,x,C)}for(V in x)if(C=x[V],_=h[V],x.hasOwnProperty(V)&&(C!=null||_!=null))switch(V){case"value":be=C;break;case"defaultValue":Re=C;break;case"children":break;case"dangerouslySetInnerHTML":if(C!=null)throw Error(r(91));break;default:C!==_&&Mn(a,l,V,C,x,_)}yd(a,be,Re);return;case"option":for(var ut in h)be=h[ut],h.hasOwnProperty(ut)&&be!=null&&!x.hasOwnProperty(ut)&&(ut==="selected"?a.selected=!1:Mn(a,l,ut,null,x,be));for(se in x)be=x[se],Re=h[se],x.hasOwnProperty(se)&&be!==Re&&(be!=null||Re!=null)&&(se==="selected"?a.selected=be&&typeof be!="function"&&typeof be!="symbol":Mn(a,l,se,be,x,Re));return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var Et in h)be=h[Et],h.hasOwnProperty(Et)&&be!=null&&!x.hasOwnProperty(Et)&&Mn(a,l,Et,null,x,be);for(xe in x)if(be=x[xe],Re=h[xe],x.hasOwnProperty(xe)&&be!==Re&&(be!=null||Re!=null))switch(xe){case"children":case"dangerouslySetInnerHTML":if(be!=null)throw Error(r(137,l));break;default:Mn(a,l,xe,be,x,Re)}return;default:if(Gx(l)){for(var An in h)be=h[An],h.hasOwnProperty(An)&&be!==void 0&&!x.hasOwnProperty(An)&&Db(a,l,An,void 0,x,be);for(Oe in x)be=x[Oe],Re=h[Oe],!x.hasOwnProperty(Oe)||be===Re||be===void 0&&Re===void 0||Db(a,l,Oe,be,x,Re);return}}for(var he in h)be=h[he],h.hasOwnProperty(he)&&be!=null&&!x.hasOwnProperty(he)&&Mn(a,l,he,null,x,be);for(Fe in x)be=x[Fe],Re=h[Fe],!x.hasOwnProperty(Fe)||be===Re||be==null&&Re==null||Mn(a,l,Fe,be,x,Re)}function o_(a){switch(a){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function RV(){if(typeof performance.getEntriesByType=="function"){for(var a=0,l=0,h=performance.getEntriesByType("resource"),x=0;x<h.length;x++){var C=h[x],_=C.transferSize,V=C.initiatorType,K=C.duration;if(_&&K&&o_(V)){for(V=0,K=C.responseEnd,x+=1;x<h.length;x++){var se=h[x],xe=se.startTime;if(xe>K)break;var Oe=se.transferSize,Fe=se.initiatorType;Oe&&o_(Fe)&&(se=se.responseEnd,V+=Oe*(se<K?1:(K-xe)/(se-xe)))}if(--x,l+=8*(_+V)/(C.duration/1e3),a++,10<a)break}}if(0<a)return l/a/1e6}return navigator.connection&&(a=navigator.connection.downlink,typeof a=="number")?a:5}var Pb=null,Ib=null;function im(a){return a.nodeType===9?a:a.ownerDocument}function i_(a){switch(a){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function s_(a,l){if(a===0)switch(l){case"svg":return 1;case"math":return 2;default:return 0}return a===1&&l==="foreignObject"?0:a}function zb(a,l){return a==="textarea"||a==="noscript"||typeof l.children=="string"||typeof l.children=="number"||typeof l.children=="bigint"||typeof l.dangerouslySetInnerHTML=="object"&&l.dangerouslySetInnerHTML!==null&&l.dangerouslySetInnerHTML.__html!=null}var Lb=null;function _V(){var a=window.event;return a&&a.type==="popstate"?a===Lb?!1:(Lb=a,!0):(Lb=null,!1)}var a_=typeof setTimeout=="function"?setTimeout:void 0,NV=typeof clearTimeout=="function"?clearTimeout:void 0,l_=typeof Promise=="function"?Promise:void 0,TV=typeof queueMicrotask=="function"?queueMicrotask:typeof l_<"u"?function(a){return l_.resolve(null).then(a).catch(MV)}:a_;function MV(a){setTimeout(function(){throw a})}function Na(a){return a==="head"}function c_(a,l){var h=l,x=0;do{var C=h.nextSibling;if(a.removeChild(h),C&&C.nodeType===8)if(h=C.data,h==="/$"||h==="/&"){if(x===0){a.removeChild(C),tu(l);return}x--}else if(h==="$"||h==="$?"||h==="$~"||h==="$!"||h==="&")x++;else if(h==="html")Wd(a.ownerDocument.documentElement);else if(h==="head"){h=a.ownerDocument.head,Wd(h);for(var _=h.firstChild;_;){var V=_.nextSibling,K=_.nodeName;_[Kt]||K==="SCRIPT"||K==="STYLE"||K==="LINK"&&_.rel.toLowerCase()==="stylesheet"||h.removeChild(_),_=V}}else h==="body"&&Wd(a.ownerDocument.body);h=C}while(h);tu(l)}function u_(a,l){var h=a;a=0;do{var x=h.nextSibling;if(h.nodeType===1?l?(h._stashedDisplay=h.style.display,h.style.display="none"):(h.style.display=h._stashedDisplay||"",h.getAttribute("style")===""&&h.removeAttribute("style")):h.nodeType===3&&(l?(h._stashedText=h.nodeValue,h.nodeValue=""):h.nodeValue=h._stashedText||""),x&&x.nodeType===8)if(h=x.data,h==="/$"){if(a===0)break;a--}else h!=="$"&&h!=="$?"&&h!=="$~"&&h!=="$!"||a++;h=x}while(h)}function Fb(a){var l=a.firstChild;for(l&&l.nodeType===10&&(l=l.nextSibling);l;){var h=l;switch(l=l.nextSibling,h.nodeName){case"HTML":case"HEAD":case"BODY":Fb(h),pn(h);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(h.rel.toLowerCase()==="stylesheet")continue}a.removeChild(h)}}function AV(a,l,h,x){for(;a.nodeType===1;){var C=h;if(a.nodeName.toLowerCase()!==l.toLowerCase()){if(!x&&(a.nodeName!=="INPUT"||a.type!=="hidden"))break}else if(x){if(!a[Kt])switch(l){case"meta":if(!a.hasAttribute("itemprop"))break;return a;case"link":if(_=a.getAttribute("rel"),_==="stylesheet"&&a.hasAttribute("data-precedence"))break;if(_!==C.rel||a.getAttribute("href")!==(C.href==null||C.href===""?null:C.href)||a.getAttribute("crossorigin")!==(C.crossOrigin==null?null:C.crossOrigin)||a.getAttribute("title")!==(C.title==null?null:C.title))break;return a;case"style":if(a.hasAttribute("data-precedence"))break;return a;case"script":if(_=a.getAttribute("src"),(_!==(C.src==null?null:C.src)||a.getAttribute("type")!==(C.type==null?null:C.type)||a.getAttribute("crossorigin")!==(C.crossOrigin==null?null:C.crossOrigin))&&_&&a.hasAttribute("async")&&!a.hasAttribute("itemprop"))break;return a;default:return a}}else if(l==="input"&&a.type==="hidden"){var _=C.name==null?null:""+C.name;if(C.type==="hidden"&&a.getAttribute("name")===_)return a}else return a;if(a=si(a.nextSibling),a===null)break}return null}function OV(a,l,h){if(l==="")return null;for(;a.nodeType!==3;)if((a.nodeType!==1||a.nodeName!=="INPUT"||a.type!=="hidden")&&!h||(a=si(a.nextSibling),a===null))return null;return a}function d_(a,l){for(;a.nodeType!==8;)if((a.nodeType!==1||a.nodeName!=="INPUT"||a.type!=="hidden")&&!l||(a=si(a.nextSibling),a===null))return null;return a}function $b(a){return a.data==="$?"||a.data==="$~"}function Vb(a){return a.data==="$!"||a.data==="$?"&&a.ownerDocument.readyState!=="loading"}function DV(a,l){var h=a.ownerDocument;if(a.data==="$~")a._reactRetry=l;else if(a.data!=="$?"||h.readyState!=="loading")l();else{var x=function(){l(),h.removeEventListener("DOMContentLoaded",x)};h.addEventListener("DOMContentLoaded",x),a._reactRetry=x}}function si(a){for(;a!=null;a=a.nextSibling){var l=a.nodeType;if(l===1||l===3)break;if(l===8){if(l=a.data,l==="$"||l==="$!"||l==="$?"||l==="$~"||l==="&"||l==="F!"||l==="F")break;if(l==="/$"||l==="/&")return null}}return a}var Bb=null;function f_(a){a=a.nextSibling;for(var l=0;a;){if(a.nodeType===8){var h=a.data;if(h==="/$"||h==="/&"){if(l===0)return si(a.nextSibling);l--}else h!=="$"&&h!=="$!"&&h!=="$?"&&h!=="$~"&&h!=="&"||l++}a=a.nextSibling}return null}function h_(a){a=a.previousSibling;for(var l=0;a;){if(a.nodeType===8){var h=a.data;if(h==="$"||h==="$!"||h==="$?"||h==="$~"||h==="&"){if(l===0)return a;l--}else h!=="/$"&&h!=="/&"||l++}a=a.previousSibling}return null}function p_(a,l,h){switch(l=im(h),a){case"html":if(a=l.documentElement,!a)throw Error(r(452));return a;case"head":if(a=l.head,!a)throw Error(r(453));return a;case"body":if(a=l.body,!a)throw Error(r(454));return a;default:throw Error(r(451))}}function Wd(a){for(var l=a.attributes;l.length;)a.removeAttributeNode(l[0]);pn(a)}var ai=new Map,m_=new Set;function sm(a){return typeof a.getRootNode=="function"?a.getRootNode():a.nodeType===9?a:a.ownerDocument}var Is=I.d;I.d={f:PV,r:IV,D:zV,C:LV,L:FV,m:$V,X:BV,S:VV,M:HV};function PV(){var a=Is.f(),l=Qp();return a||l}function IV(a){var l=xn(a);l!==null&&l.tag===5&&l.type==="form"?Aj(l):Is.r(a)}var Wc=typeof document>"u"?null:document;function g_(a,l,h){var x=Wc;if(x&&typeof l=="string"&&l){var C=Lr(l);C='link[rel="'+a+'"][href="'+C+'"]',typeof h=="string"&&(C+='[crossorigin="'+h+'"]'),m_.has(C)||(m_.add(C),a={rel:a,crossOrigin:h,href:l},x.querySelector(C)===null&&(l=x.createElement("link"),Br(l,"link",a),un(l),x.head.appendChild(l)))}}function zV(a){Is.D(a),g_("dns-prefetch",a,null)}function LV(a,l){Is.C(a,l),g_("preconnect",a,l)}function FV(a,l,h){Is.L(a,l,h);var x=Wc;if(x&&a&&l){var C='link[rel="preload"][as="'+Lr(l)+'"]';l==="image"&&h&&h.imageSrcSet?(C+='[imagesrcset="'+Lr(h.imageSrcSet)+'"]',typeof h.imageSizes=="string"&&(C+='[imagesizes="'+Lr(h.imageSizes)+'"]')):C+='[href="'+Lr(a)+'"]';var _=C;switch(l){case"style":_=Jc(a);break;case"script":_=eu(a)}ai.has(_)||(a=m({rel:"preload",href:l==="image"&&h&&h.imageSrcSet?void 0:a,as:l},h),ai.set(_,a),x.querySelector(C)!==null||l==="style"&&x.querySelector(Jd(_))||l==="script"&&x.querySelector(ef(_))||(l=x.createElement("link"),Br(l,"link",a),un(l),x.head.appendChild(l)))}}function $V(a,l){Is.m(a,l);var h=Wc;if(h&&a){var x=l&&typeof l.as=="string"?l.as:"script",C='link[rel="modulepreload"][as="'+Lr(x)+'"][href="'+Lr(a)+'"]',_=C;switch(x){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":_=eu(a)}if(!ai.has(_)&&(a=m({rel:"modulepreload",href:a},l),ai.set(_,a),h.querySelector(C)===null)){switch(x){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(h.querySelector(ef(_)))return}x=h.createElement("link"),Br(x,"link",a),un(x),h.head.appendChild(x)}}}function VV(a,l,h){Is.S(a,l,h);var x=Wc;if(x&&a){var C=tr(x).hoistableStyles,_=Jc(a);l=l||"default";var V=C.get(_);if(!V){var K={loading:0,preload:null};if(V=x.querySelector(Jd(_)))K.loading=5;else{a=m({rel:"stylesheet",href:a,"data-precedence":l},h),(h=ai.get(_))&&Hb(a,h);var se=V=x.createElement("link");un(se),Br(se,"link",a),se._p=new Promise(function(xe,Oe){se.onload=xe,se.onerror=Oe}),se.addEventListener("load",function(){K.loading|=1}),se.addEventListener("error",function(){K.loading|=2}),K.loading|=4,am(V,l,x)}V={type:"stylesheet",instance:V,count:1,state:K},C.set(_,V)}}}function BV(a,l){Is.X(a,l);var h=Wc;if(h&&a){var x=tr(h).hoistableScripts,C=eu(a),_=x.get(C);_||(_=h.querySelector(ef(C)),_||(a=m({src:a,async:!0},l),(l=ai.get(C))&&Ub(a,l),_=h.createElement("script"),un(_),Br(_,"link",a),h.head.appendChild(_)),_={type:"script",instance:_,count:1,state:null},x.set(C,_))}}function HV(a,l){Is.M(a,l);var h=Wc;if(h&&a){var x=tr(h).hoistableScripts,C=eu(a),_=x.get(C);_||(_=h.querySelector(ef(C)),_||(a=m({src:a,async:!0,type:"module"},l),(l=ai.get(C))&&Ub(a,l),_=h.createElement("script"),un(_),Br(_,"link",a),h.head.appendChild(_)),_={type:"script",instance:_,count:1,state:null},x.set(C,_))}}function y_(a,l,h,x){var C=(C=Q.current)?sm(C):null;if(!C)throw Error(r(446));switch(a){case"meta":case"title":return null;case"style":return typeof h.precedence=="string"&&typeof h.href=="string"?(l=Jc(h.href),h=tr(C).hoistableStyles,x=h.get(l),x||(x={type:"style",instance:null,count:0,state:null},h.set(l,x)),x):{type:"void",instance:null,count:0,state:null};case"link":if(h.rel==="stylesheet"&&typeof h.href=="string"&&typeof h.precedence=="string"){a=Jc(h.href);var _=tr(C).hoistableStyles,V=_.get(a);if(V||(C=C.ownerDocument||C,V={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},_.set(a,V),(_=C.querySelector(Jd(a)))&&!_._p&&(V.instance=_,V.state.loading=5),ai.has(a)||(h={rel:"preload",as:"style",href:h.href,crossOrigin:h.crossOrigin,integrity:h.integrity,media:h.media,hrefLang:h.hrefLang,referrerPolicy:h.referrerPolicy},ai.set(a,h),_||UV(C,a,h,V.state))),l&&x===null)throw Error(r(528,""));return V}if(l&&x!==null)throw Error(r(529,""));return null;case"script":return l=h.async,h=h.src,typeof h=="string"&&l&&typeof l!="function"&&typeof l!="symbol"?(l=eu(h),h=tr(C).hoistableScripts,x=h.get(l),x||(x={type:"script",instance:null,count:0,state:null},h.set(l,x)),x):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,a))}}function Jc(a){return'href="'+Lr(a)+'"'}function Jd(a){return'link[rel="stylesheet"]['+a+"]"}function x_(a){return m({},a,{"data-precedence":a.precedence,precedence:null})}function UV(a,l,h,x){a.querySelector('link[rel="preload"][as="style"]['+l+"]")?x.loading=1:(l=a.createElement("link"),x.preload=l,l.addEventListener("load",function(){return x.loading|=1}),l.addEventListener("error",function(){return x.loading|=2}),Br(l,"link",h),un(l),a.head.appendChild(l))}function eu(a){return'[src="'+Lr(a)+'"]'}function ef(a){return"script[async]"+a}function v_(a,l,h){if(l.count++,l.instance===null)switch(l.type){case"style":var x=a.querySelector('style[data-href~="'+Lr(h.href)+'"]');if(x)return l.instance=x,un(x),x;var C=m({},h,{"data-href":h.href,"data-precedence":h.precedence,href:null,precedence:null});return x=(a.ownerDocument||a).createElement("style"),un(x),Br(x,"style",C),am(x,h.precedence,a),l.instance=x;case"stylesheet":C=Jc(h.href);var _=a.querySelector(Jd(C));if(_)return l.state.loading|=4,l.instance=_,un(_),_;x=x_(h),(C=ai.get(C))&&Hb(x,C),_=(a.ownerDocument||a).createElement("link"),un(_);var V=_;return V._p=new Promise(function(K,se){V.onload=K,V.onerror=se}),Br(_,"link",x),l.state.loading|=4,am(_,h.precedence,a),l.instance=_;case"script":return _=eu(h.src),(C=a.querySelector(ef(_)))?(l.instance=C,un(C),C):(x=h,(C=ai.get(_))&&(x=m({},h),Ub(x,C)),a=a.ownerDocument||a,C=a.createElement("script"),un(C),Br(C,"link",x),a.head.appendChild(C),l.instance=C);case"void":return null;default:throw Error(r(443,l.type))}else l.type==="stylesheet"&&(l.state.loading&4)===0&&(x=l.instance,l.state.loading|=4,am(x,h.precedence,a));return l.instance}function am(a,l,h){for(var x=h.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),C=x.length?x[x.length-1]:null,_=C,V=0;V<x.length;V++){var K=x[V];if(K.dataset.precedence===l)_=K;else if(_!==C)break}_?_.parentNode.insertBefore(a,_.nextSibling):(l=h.nodeType===9?h.head:h,l.insertBefore(a,l.firstChild))}function Hb(a,l){a.crossOrigin==null&&(a.crossOrigin=l.crossOrigin),a.referrerPolicy==null&&(a.referrerPolicy=l.referrerPolicy),a.title==null&&(a.title=l.title)}function Ub(a,l){a.crossOrigin==null&&(a.crossOrigin=l.crossOrigin),a.referrerPolicy==null&&(a.referrerPolicy=l.referrerPolicy),a.integrity==null&&(a.integrity=l.integrity)}var lm=null;function b_(a,l,h){if(lm===null){var x=new Map,C=lm=new Map;C.set(h,x)}else C=lm,x=C.get(h),x||(x=new Map,C.set(h,x));if(x.has(a))return x;for(x.set(a,null),h=h.getElementsByTagName(a),C=0;C<h.length;C++){var _=h[C];if(!(_[Kt]||_[Xe]||a==="link"&&_.getAttribute("rel")==="stylesheet")&&_.namespaceURI!=="http://www.w3.org/2000/svg"){var V=_.getAttribute(l)||"";V=a+V;var K=x.get(V);K?K.push(_):x.set(V,[_])}}return x}function w_(a,l,h){a=a.ownerDocument||a,a.head.insertBefore(h,l==="title"?a.querySelector("head > title"):null)}function qV(a,l,h){if(h===1||l.itemProp!=null)return!1;switch(a){case"meta":case"title":return!0;case"style":if(typeof l.precedence!="string"||typeof l.href!="string"||l.href==="")break;return!0;case"link":if(typeof l.rel!="string"||typeof l.href!="string"||l.href===""||l.onLoad||l.onError)break;return l.rel==="stylesheet"?(a=l.disabled,typeof l.precedence=="string"&&a==null):!0;case"script":if(l.async&&typeof l.async!="function"&&typeof l.async!="symbol"&&!l.onLoad&&!l.onError&&l.src&&typeof l.src=="string")return!0}return!1}function S_(a){return!(a.type==="stylesheet"&&(a.state.loading&3)===0)}function YV(a,l,h,x){if(h.type==="stylesheet"&&(typeof x.media!="string"||matchMedia(x.media).matches!==!1)&&(h.state.loading&4)===0){if(h.instance===null){var C=Jc(x.href),_=l.querySelector(Jd(C));if(_){l=_._p,l!==null&&typeof l=="object"&&typeof l.then=="function"&&(a.count++,a=cm.bind(a),l.then(a,a)),h.state.loading|=4,h.instance=_,un(_);return}_=l.ownerDocument||l,x=x_(x),(C=ai.get(C))&&Hb(x,C),_=_.createElement("link"),un(_);var V=_;V._p=new Promise(function(K,se){V.onload=K,V.onerror=se}),Br(_,"link",x),h.instance=_}a.stylesheets===null&&(a.stylesheets=new Map),a.stylesheets.set(h,l),(l=h.state.preload)&&(h.state.loading&3)===0&&(a.count++,h=cm.bind(a),l.addEventListener("load",h),l.addEventListener("error",h))}}var qb=0;function ZV(a,l){return a.stylesheets&&a.count===0&&dm(a,a.stylesheets),0<a.count||0<a.imgCount?function(h){var x=setTimeout(function(){if(a.stylesheets&&dm(a,a.stylesheets),a.unsuspend){var _=a.unsuspend;a.unsuspend=null,_()}},6e4+l);0<a.imgBytes&&qb===0&&(qb=62500*RV());var C=setTimeout(function(){if(a.waitingForImages=!1,a.count===0&&(a.stylesheets&&dm(a,a.stylesheets),a.unsuspend)){var _=a.unsuspend;a.unsuspend=null,_()}},(a.imgBytes>qb?50:800)+l);return a.unsuspend=h,function(){a.unsuspend=null,clearTimeout(x),clearTimeout(C)}}:null}function cm(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)dm(this,this.stylesheets);else if(this.unsuspend){var a=this.unsuspend;this.unsuspend=null,a()}}}var um=null;function dm(a,l){a.stylesheets=null,a.unsuspend!==null&&(a.count++,um=new Map,l.forEach(GV,a),um=null,cm.call(a))}function GV(a,l){if(!(l.state.loading&4)){var h=um.get(a);if(h)var x=h.get(null);else{h=new Map,um.set(a,h);for(var C=a.querySelectorAll("link[data-precedence],style[data-precedence]"),_=0;_<C.length;_++){var V=C[_];(V.nodeName==="LINK"||V.getAttribute("media")!=="not all")&&(h.set(V.dataset.precedence,V),x=V)}x&&h.set(null,x)}C=l.instance,V=C.getAttribute("data-precedence"),_=h.get(V)||x,_===x&&h.set(null,C),h.set(V,C),this.count++,x=cm.bind(this),C.addEventListener("load",x),C.addEventListener("error",x),_?_.parentNode.insertBefore(C,_.nextSibling):(a=a.nodeType===9?a.head:a,a.insertBefore(C,a.firstChild)),l.state.loading|=4}}var tf={$$typeof:j,Provider:null,Consumer:null,_currentValue:Y,_currentValue2:Y,_threadCount:0};function KV(a,l,h,x,C,_,V,K,se){this.tag=1,this.containerInfo=a,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Gt(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Gt(0),this.hiddenUpdates=Gt(null),this.identifierPrefix=x,this.onUncaughtError=C,this.onCaughtError=_,this.onRecoverableError=V,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=se,this.incompleteTransitions=new Map}function E_(a,l,h,x,C,_,V,K,se,xe,Oe,Fe){return a=new KV(a,l,h,V,se,xe,Oe,Fe,K),l=1,_===!0&&(l|=24),_=Po(3,null,null,l),a.current=_,_.stateNode=a,l=Cv(),l.refCount++,a.pooledCache=l,l.refCount++,_.memoizedState={element:x,isDehydrated:h,cache:l},_v(_),a}function C_(a){return a?(a=Mc,a):Mc}function k_(a,l,h,x,C,_){C=C_(C),x.context===null?x.context=C:x.pendingContext=C,x=xa(l),x.payload={element:h},_=_===void 0?null:_,_!==null&&(x.callback=_),h=va(a,x,l),h!==null&&(vo(h,a,l),Od(h,a,l))}function j_(a,l){if(a=a.memoizedState,a!==null&&a.dehydrated!==null){var h=a.retryLane;a.retryLane=h!==0&&h<l?h:l}}function Yb(a,l){j_(a,l),(a=a.alternate)&&j_(a,l)}function R_(a){if(a.tag===13||a.tag===31){var l=yl(a,67108864);l!==null&&vo(l,a,67108864),Yb(a,67108864)}}function __(a){if(a.tag===13||a.tag===31){var l=$o();l=ae(l);var h=yl(a,l);h!==null&&vo(h,a,l),Yb(a,l)}}var fm=!0;function XV(a,l,h,x){var C=P.T;P.T=null;var _=I.p;try{I.p=2,Zb(a,l,h,x)}finally{I.p=_,P.T=C}}function QV(a,l,h,x){var C=P.T;P.T=null;var _=I.p;try{I.p=8,Zb(a,l,h,x)}finally{I.p=_,P.T=C}}function Zb(a,l,h,x){if(fm){var C=Gb(x);if(C===null)Ob(a,l,x,hm,h),T_(a,x);else if(JV(C,a,l,h,x))x.stopPropagation();else if(T_(a,x),l&4&&-1<WV.indexOf(a)){for(;C!==null;){var _=xn(C);if(_!==null)switch(_.tag){case 3:if(_=_.stateNode,_.current.memoizedState.isDehydrated){var V=jt(_.pendingLanes);if(V!==0){var K=_;for(K.pendingLanes|=2,K.entangledLanes|=2;V;){var se=1<<31-ve(V);K.entanglements[1]|=se,V&=~se}Ki(_),(En&6)===0&&(Kp=me()+500,Kd(0))}}break;case 31:case 13:K=yl(_,2),K!==null&&vo(K,_,2),Qp(),Yb(_,2)}if(_=Gb(x),_===null&&Ob(a,l,x,hm,h),_===C)break;C=_}C!==null&&x.stopPropagation()}else Ob(a,l,x,null,h)}}function Gb(a){return a=Xx(a),Kb(a)}var hm=null;function Kb(a){if(hm=null,a=zn(a),a!==null){var l=i(a);if(l===null)a=null;else{var h=l.tag;if(h===13){if(a=s(l),a!==null)return a;a=null}else if(h===31){if(a=c(l),a!==null)return a;a=null}else if(h===3){if(l.stateNode.current.memoizedState.isDehydrated)return l.tag===3?l.stateNode.containerInfo:null;a=null}else l!==a&&(a=null)}}return hm=a,null}function N_(a){switch(a){case"beforetoggle":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"toggle":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 2;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"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(ke()){case de:return 2;case ue:return 8;case Se:case Ue:return 32;case Ye:return 268435456;default:return 32}default:return 32}}var Xb=!1,Ta=null,Ma=null,Aa=null,nf=new Map,rf=new Map,Oa=[],WV="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".split(" ");function T_(a,l){switch(a){case"focusin":case"focusout":Ta=null;break;case"dragenter":case"dragleave":Ma=null;break;case"mouseover":case"mouseout":Aa=null;break;case"pointerover":case"pointerout":nf.delete(l.pointerId);break;case"gotpointercapture":case"lostpointercapture":rf.delete(l.pointerId)}}function of(a,l,h,x,C,_){return a===null||a.nativeEvent!==_?(a={blockedOn:l,domEventName:h,eventSystemFlags:x,nativeEvent:_,targetContainers:[C]},l!==null&&(l=xn(l),l!==null&&R_(l)),a):(a.eventSystemFlags|=x,l=a.targetContainers,C!==null&&l.indexOf(C)===-1&&l.push(C),a)}function JV(a,l,h,x,C){switch(l){case"focusin":return Ta=of(Ta,a,l,h,x,C),!0;case"dragenter":return Ma=of(Ma,a,l,h,x,C),!0;case"mouseover":return Aa=of(Aa,a,l,h,x,C),!0;case"pointerover":var _=C.pointerId;return nf.set(_,of(nf.get(_)||null,a,l,h,x,C)),!0;case"gotpointercapture":return _=C.pointerId,rf.set(_,of(rf.get(_)||null,a,l,h,x,C)),!0}return!1}function M_(a){var l=zn(a.target);if(l!==null){var h=i(l);if(h!==null){if(l=h.tag,l===13){if(l=s(h),l!==null){a.blockedOn=l,ze(a.priority,function(){__(h)});return}}else if(l===31){if(l=c(h),l!==null){a.blockedOn=l,ze(a.priority,function(){__(h)});return}}else if(l===3&&h.stateNode.current.memoizedState.isDehydrated){a.blockedOn=h.tag===3?h.stateNode.containerInfo:null;return}}}a.blockedOn=null}function pm(a){if(a.blockedOn!==null)return!1;for(var l=a.targetContainers;0<l.length;){var h=Gb(a.nativeEvent);if(h===null){h=a.nativeEvent;var x=new h.constructor(h.type,h);Kx=x,h.target.dispatchEvent(x),Kx=null}else return l=xn(h),l!==null&&R_(l),a.blockedOn=h,!1;l.shift()}return!0}function A_(a,l,h){pm(a)&&h.delete(l)}function eB(){Xb=!1,Ta!==null&&pm(Ta)&&(Ta=null),Ma!==null&&pm(Ma)&&(Ma=null),Aa!==null&&pm(Aa)&&(Aa=null),nf.forEach(A_),rf.forEach(A_)}function mm(a,l){a.blockedOn===l&&(a.blockedOn=null,Xb||(Xb=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,eB)))}var gm=null;function O_(a){gm!==a&&(gm=a,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){gm===a&&(gm=null);for(var l=0;l<a.length;l+=3){var h=a[l],x=a[l+1],C=a[l+2];if(typeof x!="function"){if(Kb(x||h)===null)continue;break}var _=xn(h);_!==null&&(a.splice(l,3),l-=3,Gv(_,{pending:!0,data:C,method:h.method,action:x},x,C))}}))}function tu(a){function l(se){return mm(se,a)}Ta!==null&&mm(Ta,a),Ma!==null&&mm(Ma,a),Aa!==null&&mm(Aa,a),nf.forEach(l),rf.forEach(l);for(var h=0;h<Oa.length;h++){var x=Oa[h];x.blockedOn===a&&(x.blockedOn=null)}for(;0<Oa.length&&(h=Oa[0],h.blockedOn===null);)M_(h),h.blockedOn===null&&Oa.shift();if(h=(a.ownerDocument||a).$$reactFormReplay,h!=null)for(x=0;x<h.length;x+=3){var C=h[x],_=h[x+1],V=C[et]||null;if(typeof _=="function")V||O_(h);else if(V){var K=null;if(_&&_.hasAttribute("formAction")){if(C=_,V=_[et]||null)K=V.formAction;else if(Kb(C)!==null)continue}else K=V.action;typeof K=="function"?h[x+1]=K:(h.splice(x,3),x-=3),O_(h)}}}function D_(){function a(_){_.canIntercept&&_.info==="react-transition"&&_.intercept({handler:function(){return new Promise(function(V){return C=V})},focusReset:"manual",scroll:"manual"})}function l(){C!==null&&(C(),C=null),x||setTimeout(h,20)}function h(){if(!x&&!navigation.transition){var _=navigation.currentEntry;_&&_.url!=null&&navigation.navigate(_.url,{state:_.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var x=!1,C=null;return navigation.addEventListener("navigate",a),navigation.addEventListener("navigatesuccess",l),navigation.addEventListener("navigateerror",l),setTimeout(h,100),function(){x=!0,navigation.removeEventListener("navigate",a),navigation.removeEventListener("navigatesuccess",l),navigation.removeEventListener("navigateerror",l),C!==null&&(C(),C=null)}}}function Qb(a){this._internalRoot=a}ym.prototype.render=Qb.prototype.render=function(a){var l=this._internalRoot;if(l===null)throw Error(r(409));var h=l.current,x=$o();k_(h,x,a,l,null,null)},ym.prototype.unmount=Qb.prototype.unmount=function(){var a=this._internalRoot;if(a!==null){this._internalRoot=null;var l=a.containerInfo;k_(a.current,2,null,a,null,null),Qp(),l[tt]=null}};function ym(a){this._internalRoot=a}ym.prototype.unstable_scheduleHydration=function(a){if(a){var l=Ae();a={blockedOn:null,target:a,priority:l};for(var h=0;h<Oa.length&&l!==0&&l<Oa[h].priority;h++);Oa.splice(h,0,a),h===0&&M_(a)}};var P_=t.version;if(P_!=="19.2.8")throw Error(r(527,P_,"19.2.8"));I.findDOMNode=function(a){var l=a._reactInternals;if(l===void 0)throw typeof a.render=="function"?Error(r(188)):(a=Object.keys(a).join(","),Error(r(268,a)));return a=u(l),a=a!==null?p(a):null,a=a===null?null:a.stateNode,a};var tB={bundleType:0,version:"19.2.8",rendererPackageName:"react-dom",currentDispatcherRef:P,reconcilerVersion:"19.2.8"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var xm=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!xm.isDisabled&&xm.supportsFiber)try{ie=xm.inject(tB),le=xm}catch{}}return af.createRoot=function(a,l){if(!o(a))throw Error(r(299));var h=!1,x="",C=Bj,_=Hj,V=Uj;return l!=null&&(l.unstable_strictMode===!0&&(h=!0),l.identifierPrefix!==void 0&&(x=l.identifierPrefix),l.onUncaughtError!==void 0&&(C=l.onUncaughtError),l.onCaughtError!==void 0&&(_=l.onCaughtError),l.onRecoverableError!==void 0&&(V=l.onRecoverableError)),l=E_(a,1,!1,null,null,h,x,null,C,_,V,D_),a[tt]=l.current,Ab(a),new Qb(l)},af.hydrateRoot=function(a,l,h){if(!o(a))throw Error(r(299));var x=!1,C="",_=Bj,V=Hj,K=Uj,se=null;return h!=null&&(h.unstable_strictMode===!0&&(x=!0),h.identifierPrefix!==void 0&&(C=h.identifierPrefix),h.onUncaughtError!==void 0&&(_=h.onUncaughtError),h.onCaughtError!==void 0&&(V=h.onCaughtError),h.onRecoverableError!==void 0&&(K=h.onRecoverableError),h.formState!==void 0&&(se=h.formState)),l=E_(a,1,!0,l,h??null,x,C,se,_,V,K,D_),l.context=C_(null),h=l.current,x=$o(),x=ae(x),C=xa(x),C.callback=null,va(h,C,x),h=x,l.current.lanes=h,Nt(l,h),Ki(l),a[tt]=l.current,Ab(a),new ym(l)},af.version="19.2.8",af}var q_;function dB(){if(q_)return e0.exports;q_=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),e0.exports=uB(),e0.exports}var fB=dB(),Xu=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},hB=class extends Xu{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<"u"&&window.addEventListener){const t=()=>e();return window.addEventListener("visibilitychange",t,!1),()=>{window.removeEventListener("visibilitychange",t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(t=>{typeof t=="boolean"?this.setFocused(t):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e=="boolean"?this.#e:globalThis.document?.visibilityState!=="hidden"}},nE=new hB,pB={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},mB=class{#e=pB;#t=!1;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}},Fl=new mB;function gB(e){setTimeout(e,0)}var yB=typeof window>"u"||"Deno"in globalThis;function lo(){}function xB(e,t){return typeof e=="function"?e(t):e}function xw(e){return typeof e=="number"&&e>=0&&e!==1/0}function R2(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Ka(e,t){return typeof e=="function"?e(t):e}function Ho(e,t){return typeof e=="function"?e(t):e}function Y_(e,t){const{type:n="all",exact:r,fetchStatus:o,predicate:i,queryKey:s,stale:c}=e;if(s){if(r){if(t.queryHash!==rE(s,t.options))return!1}else if(!Au(t.queryKey,s))return!1}if(n!=="all"){const d=t.isActive();if(n==="active"&&!d||n==="inactive"&&d)return!1}return!(typeof c=="boolean"&&t.isStale()!==c||o&&o!==t.state.fetchStatus||i&&!i(t))}function Z_(e,t){const{exact:n,status:r,predicate:o,mutationKey:i}=e;if(i){if(!t.options.mutationKey)return!1;if(n){if(Gl(t.options.mutationKey)!==Gl(i))return!1}else if(!Au(t.options.mutationKey,i))return!1}return!(r&&t.state.status!==r||o&&!o(t))}function rE(e,t){return(t?.queryKeyHashFn||Gl)(e)}function Gl(e){return JSON.stringify(e,(t,n)=>vw(n)?Object.keys(n).sort().reduce((r,o)=>(r[o]=n[o],r),{}):n)}function Au(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(e&&t&&typeof e=="object"&&typeof t=="object"){if(Array.isArray(e)&&Array.isArray(t)){for(let r=0;r<t.length;r++)if(!Au(e[r],t[r]))return!1;return!0}const n=Object.keys(t);for(const r of n)if(!Au(e[r],t[r]))return!1;return!0}return!1}var vB=Object.prototype.hasOwnProperty;function _2(e,t,n=0){if(e===t)return e;if(n>500)return t;const r=G_(e)&&G_(t);if(!r&&!(vw(e)&&vw(t)))return t;const i=(r?e:Object.keys(e)).length,s=r?t:Object.keys(t),c=s.length,d=r?new Array(c):{};let u=0;for(let p=0;p<c;p++){const m=r?p:s[p],g=e[m],y=t[m];if(g===y){d[m]=g,(r?p<i:vB.call(e,m))&&u++;continue}if(g===null||y===null||typeof g!="object"||typeof y!="object"){d[m]=y;continue}const v=_2(g,y,n+1);d[m]=v,v===g&&u++}return i===c&&u===i?e:d}function Tg(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}function G_(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function vw(e){if(!K_(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!K_(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function K_(e){return Object.prototype.toString.call(e)==="[object Object]"}function bB(e){return new Promise(t=>{Fl.setTimeout(t,e)})}function bw(e,t,n){return typeof n.structuralSharing=="function"?n.structuralSharing(e,t):n.structuralSharing!==!1?_2(e,t):t}function jy(e){return e}function wB(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function SB(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var oE=Symbol();function N2(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===oE?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function iE(e,t){return typeof e=="function"?e(...t):!!e}function EB(e,t,n){let r=!1,o;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(o??=t(),r||(r=!0,o.aborted?n():o.addEventListener("abort",n,{once:!0})),o)}),e}var Zf=(()=>{let e=()=>yB;return{isServer(){return e()},setIsServer(t){e=t}}})();function ww(){let e,t;const n=new Promise((o,i)=>{e=o,t=i});n.status="pending",n.catch(()=>{});function r(o){Object.assign(n,o),delete n.resolve,delete n.reject}return n.resolve=o=>{r({status:"fulfilled",value:o}),e(o)},n.reject=o=>{r({status:"rejected",reason:o}),t(o)},n}var CB=gB;function kB(){let e=[],t=0,n=c=>{c()},r=c=>{c()},o=CB;const i=c=>{t?e.push(c):o(()=>{n(c)})},s=()=>{const c=e;e=[],c.length&&o(()=>{r(()=>{c.forEach(d=>{n(d)})})})};return{batch:c=>{let d;t++;try{d=c()}finally{t--,t||s()}return d},batchCalls:c=>(...d)=>{i(()=>{c(...d)})},schedule:i,setNotifyFunction:c=>{n=c},setBatchNotifyFunction:c=>{r=c},setScheduler:c=>{o=c}}}var Rr=kB(),jB=class extends Xu{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<"u"&&window.addEventListener){const t=()=>e(!0),n=()=>e(!1);return window.addEventListener("online",t,!1),window.addEventListener("offline",n,!1),()=>{window.removeEventListener("online",t),window.removeEventListener("offline",n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(n=>{n(e)}))}isOnline(){return this.#e}},Mg=new jB;function RB(e){return Math.min(1e3*2**e,3e4)}function T2(e){return(e??"online")==="online"?Mg.isOnline():!0}var Sw=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent}};function M2(e){let t=!1,n=0,r;const o=ww(),i=()=>o.status!=="pending",s=S=>{if(!i()){const w=new Sw(S);g(w),e.onCancel?.(w)}},c=()=>{t=!0},d=()=>{t=!1},u=()=>nE.isFocused()&&(e.networkMode==="always"||Mg.isOnline())&&e.canRun(),p=()=>T2(e.networkMode)&&e.canRun(),m=S=>{i()||(r?.(),o.resolve(S))},g=S=>{i()||(r?.(),o.reject(S))},y=()=>new Promise(S=>{r=w=>{(i()||u())&&S(w)},e.onPause?.()}).then(()=>{r=void 0,i()||e.onContinue?.()}),v=()=>{if(i())return;let S;const w=n===0?e.initialPromise:void 0;try{S=w??e.fn()}catch(E){S=Promise.reject(E)}Promise.resolve(S).then(m).catch(E=>{if(i())return;const k=e.retry??(Zf.isServer()?0:3),j=e.retryDelay??RB,N=typeof j=="function"?j(n,E):j,A=k===!0||typeof k=="number"&&n<k||typeof k=="function"&&k(n,E);if(t||!A){g(E);return}n++,e.onFail?.(n,E),bB(N).then(()=>u()?void 0:y()).then(()=>{t?g(E):v()})})};return{promise:o,status:()=>o.status,cancel:s,continue:()=>(r?.(),o),cancelRetry:c,continueRetry:d,canStart:p,start:()=>(p()?v():y().then(v),o)}}var A2=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),xw(this.gcTime)&&(this.#e=Fl.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Zf.isServer()?1/0:300*1e3))}clearGcTimeout(){this.#e!==void 0&&(Fl.clearTimeout(this.#e),this.#e=void 0)}};function _B(e){return{onFetch:(t,n)=>{const r=t.options,o=t.fetchOptions?.meta?.fetchMore?.direction,i=t.state.data?.pages||[],s=t.state.data?.pageParams||[];let c={pages:[],pageParams:[]},d=0;const u=async()=>{let p=!1;const m=v=>{EB(v,()=>t.signal,()=>p=!0)},g=N2(t.options,t.fetchOptions),y=async(v,S,w)=>{if(p)return Promise.reject(t.signal.reason);if(S==null&&v.pages.length)return Promise.resolve(v);const k=(()=>{const R={client:t.client,queryKey:t.queryKey,pageParam:S,direction:w?"backward":"forward",meta:t.options.meta};return m(R),R})(),j=await g(k),{maxPages:N}=t.options,A=w?SB:wB;return{pages:A(v.pages,j,N),pageParams:A(v.pageParams,S,N)}};if(o&&i.length){const v=o==="backward",S=v?NB:X_,w={pages:i,pageParams:s},E=S(r,w);c=await y(w,E,v)}else{const v=e??i.length;do{const S=d===0?s[0]??r.initialPageParam:X_(r,c);if(d>0&&S==null)break;c=await y(c,S),d++}while(d<v)}return c};t.options.persister?t.fetchFn=()=>t.options.persister?.(u,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):t.fetchFn=u}}}function X_(e,{pages:t,pageParams:n}){const r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function NB(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var TB=class extends A2{#e;#t;#n;#r;#i;#o;#a;#s;constructor(e){super(),this.#s=!1,this.#a=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#r=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=W_(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#o?.promise}setOptions(e){if(this.options={...this.#a,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const t=W_(this.options);t.data!==void 0&&(this.setState(Q_(t.data,t.dataUpdatedAt)),this.#t=t)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&this.#r.remove(this)}setData(e,t){const n=bw(this.state.data,e,this.options);return this.#l({data:n,type:"success",dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){this.#l({type:"setState",state:e})}cancel(e){const t=this.#o?.promise;return this.#o?.cancel(e),t?t.then(lo).catch(lo):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>Ho(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===oE||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>Ka(e.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e==="static"?!1:this.state.isInvalidated?!0:!R2(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(t=>t.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#o?.continue()}onOnline(){this.observers.find(t=>t.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#o?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#o&&(this.#s||this.#u()?this.#o.cancel({revert:!0}):this.#o.cancelRetry()),this.scheduleGc()),this.#r.notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}#u(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"}invalidate(){this.state.isInvalidated||this.#l({type:"invalidate"})}async fetch(e,t){if(this.state.fetchStatus!=="idle"&&this.#o?.status()!=="rejected"){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#o)return this.#o.continueRetry(),this.#o.promise}if(e&&this.setOptions(e),!this.options.queryFn){const d=this.observers.find(u=>u.options.queryFn);d&&this.setOptions(d.options)}const n=new AbortController,r=d=>{Object.defineProperty(d,"signal",{enumerable:!0,get:()=>(this.#s=!0,n.signal)})},o=()=>{const d=N2(this.options,t),p=(()=>{const m={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(m),m})();return this.#s=!1,this.options.persister?this.options.persister(d,p,this):d(p)},s=(()=>{const d={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:o};return r(d),d})();(this.#e==="infinite"?_B(this.options.pages):this.options.behavior)?.onFetch(s,this),this.#n=this.state,(this.state.fetchStatus==="idle"||this.state.fetchMeta!==s.fetchOptions?.meta)&&this.#l({type:"fetch",meta:s.fetchOptions?.meta}),this.#o=M2({initialPromise:t?.initialPromise,fn:s.fetchFn,onCancel:d=>{d instanceof Sw&&d.revert&&this.setState({...this.#n,fetchStatus:"idle"}),n.abort()},onFail:(d,u)=>{this.#l({type:"failed",failureCount:d,error:u})},onPause:()=>{this.#l({type:"pause"})},onContinue:()=>{this.#l({type:"continue"})},retry:s.options.retry,retryDelay:s.options.retryDelay,networkMode:s.options.networkMode,canRun:()=>!0});try{const d=await this.#o.start();if(d===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(d),this.#r.config.onSuccess?.(d,this),this.#r.config.onSettled?.(d,this.state.error,this),d}catch(d){if(d instanceof Sw){if(d.silent)return this.#o.promise;if(d.revert){if(this.state.data===void 0)throw d;return this.state.data}}throw this.#l({type:"error",error:d}),this.#r.config.onError?.(d,this),this.#r.config.onSettled?.(this.state.data,d,this),d}finally{this.scheduleGc()}}#l(e){const t=n=>{switch(e.type){case"failed":return{...n,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...n,fetchStatus:"paused"};case"continue":return{...n,fetchStatus:"fetching"};case"fetch":return{...n,...O2(n.data,this.options),fetchMeta:e.meta??null};case"success":const r={...n,...Q_(e.data,e.dataUpdatedAt),dataUpdateCount:n.dataUpdateCount+1,...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return this.#n=e.manual?r:void 0,r;case"error":const o=e.error;return{...n,error:o,errorUpdateCount:n.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:n.fetchFailureCount+1,fetchFailureReason:o,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...n,isInvalidated:!0};case"setState":return{...n,...e.state}}};this.state=t(this.state),Rr.batch(()=>{this.observers.forEach(n=>{n.onQueryUpdate()}),this.#r.notify({query:this,type:"updated",action:e})})}};function O2(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:T2(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function Q_(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function W_(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var MB=class extends Xu{constructor(e,t){super(),this.options=t,this.#e=e,this.#s=null,this.#a=ww(),this.bindMethods(),this.setOptions(t)}#e;#t=void 0;#n=void 0;#r=void 0;#i;#o;#a;#s;#u;#l;#p;#d;#f;#c;#m=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),J_(this.#t,this.options)?this.#h():this.updateResult(),this.#v())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Ew(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Ew(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#w(),this.#t.removeObserver(this)}setOptions(e){const t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Ho(this.options.enabled,this.#t)!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#S(),this.#t.setOptions(this.options),t._defaulted&&!Tg(this.options,t)&&this.#e.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#t,observer:this});const r=this.hasListeners();r&&eN(this.#t,n,this.options,t)&&this.#h(),this.updateResult(),r&&(this.#t!==n||Ho(this.options.enabled,this.#t)!==Ho(t.enabled,this.#t)||Ka(this.options.staleTime,this.#t)!==Ka(t.staleTime,this.#t))&&this.#g();const o=this.#y();r&&(this.#t!==n||Ho(this.options.enabled,this.#t)!==Ho(t.enabled,this.#t)||o!==this.#c)&&this.#x(o)}getOptimisticResult(e){const t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return OB(this,n)&&(this.#r=n,this.#o=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(n,r)=>(this.trackProp(r),t?.(r),r==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&this.#a.status==="pending"&&this.#a.reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(n,r))})}trackProp(e){this.#m.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t);return n.fetch().then(()=>this.createResult(n,t))}fetch(e){return this.#h({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#h(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(lo)),t}#g(){this.#b();const e=Ka(this.options.staleTime,this.#t);if(Zf.isServer()||this.#r.isStale||!xw(e))return;const n=R2(this.#r.dataUpdatedAt,e)+1;this.#d=Fl.setTimeout(()=>{this.#r.isStale||this.updateResult()},n)}#y(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#x(e){this.#w(),this.#c=e,!(Zf.isServer()||Ho(this.options.enabled,this.#t)===!1||!xw(this.#c)||this.#c===0)&&(this.#f=Fl.setInterval(()=>{(this.options.refetchIntervalInBackground||nE.isFocused())&&this.#h()},this.#c))}#v(){this.#g(),this.#x(this.#y())}#b(){this.#d!==void 0&&(Fl.clearTimeout(this.#d),this.#d=void 0)}#w(){this.#f!==void 0&&(Fl.clearInterval(this.#f),this.#f=void 0)}createResult(e,t){const n=this.#t,r=this.options,o=this.#r,i=this.#i,s=this.#o,d=e!==n?e.state:this.#n,{state:u}=e;let p={...u},m=!1,g;if(t._optimisticResults){const T=this.hasListeners(),O=!T&&J_(e,t),z=T&&eN(e,n,t,r);(O||z)&&(p={...p,...O2(u.data,e.options)}),t._optimisticResults==="isRestoring"&&(p.fetchStatus="idle")}let{error:y,errorUpdatedAt:v,status:S}=p;g=p.data;let w=!1;if(t.placeholderData!==void 0&&g===void 0&&S==="pending"){let T;o?.isPlaceholderData&&t.placeholderData===s?.placeholderData?(T=o.data,w=!0):T=typeof t.placeholderData=="function"?t.placeholderData(this.#p?.state.data,this.#p):t.placeholderData,T!==void 0&&(S="success",g=bw(o?.data,T,t),m=!0)}if(t.select&&g!==void 0&&!w)if(o&&g===i?.data&&t.select===this.#u)g=this.#l;else try{this.#u=t.select,g=t.select(g),g=bw(o?.data,g,t),this.#l=g,this.#s=null}catch(T){this.#s=T}this.#s&&(y=this.#s,g=this.#l,v=Date.now(),S="error");const E=p.fetchStatus==="fetching",k=S==="pending",j=S==="error",N=k&&E,A=g!==void 0,M={status:S,fetchStatus:p.fetchStatus,isPending:k,isSuccess:S==="success",isError:j,isInitialLoading:N,isLoading:N,data:g,dataUpdatedAt:p.dataUpdatedAt,error:y,errorUpdatedAt:v,failureCount:p.fetchFailureCount,failureReason:p.fetchFailureReason,errorUpdateCount:p.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:p.dataUpdateCount>d.dataUpdateCount||p.errorUpdateCount>d.errorUpdateCount,isFetching:E,isRefetching:E&&!k,isLoadingError:j&&!A,isPaused:p.fetchStatus==="paused",isPlaceholderData:m,isRefetchError:j&&A,isStale:sE(e,t),refetch:this.refetch,promise:this.#a,isEnabled:Ho(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){const T=M.data!==void 0,O=M.status==="error"&&!T,z=G=>{O?G.reject(M.error):T&&G.resolve(M.data)},q=()=>{const G=this.#a=M.promise=ww();z(G)},$=this.#a;switch($.status){case"pending":e.queryHash===n.queryHash&&z($);break;case"fulfilled":(O||M.data!==$.value)&&q();break;case"rejected":(!O||M.error!==$.reason)&&q();break}}return M}updateResult(){const e=this.#r,t=this.createResult(this.#t,this.options);if(this.#i=this.#t.state,this.#o=this.options,this.#i.data!==void 0&&(this.#p=this.#t),Tg(t,e))return;this.#r=t;const n=()=>{if(!e)return!0;const{notifyOnChangeProps:r}=this.options,o=typeof r=="function"?r():r;if(o==="all"||!o&&!this.#m.size)return!0;const i=new Set(o??this.#m);return this.options.throwOnError&&i.add("error"),Object.keys(this.#r).some(s=>{const c=s;return this.#r[c]!==e[c]&&i.has(c)})};this.#E({listeners:n()})}#S(){const e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;const t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#v()}#E(e){Rr.batch(()=>{e.listeners&&this.listeners.forEach(t=>{t(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:"observerResultsUpdated"})})}};function AB(e,t){return Ho(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&Ho(t.retryOnMount,e)===!1)}function J_(e,t){return AB(e,t)||e.state.data!==void 0&&Ew(e,t,t.refetchOnMount)}function Ew(e,t,n){if(Ho(t.enabled,e)!==!1&&Ka(t.staleTime,e)!=="static"){const r=typeof n=="function"?n(e):n;return r==="always"||r!==!1&&sE(e,t)}return!1}function eN(e,t,n,r){return(e!==t||Ho(r.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&sE(e,n)}function sE(e,t){return Ho(t.enabled,e)!==!1&&e.isStaleByTime(Ka(t.staleTime,e))}function OB(e,t){return!Tg(e.getCurrentResult(),t)}var DB=class extends A2{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||D2(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status==="pending"?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??this.execute(this.state.variables)}async execute(e){const t=()=>{this.#i({type:"continue"})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#r=M2({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(new Error("No mutationFn found")),onFail:(i,s)=>{this.#i({type:"failed",failureCount:i,error:s})},onPause:()=>{this.#i({type:"pause"})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)});const r=this.state.status==="pending",o=!this.#r.canStart();try{if(r)t();else{this.#i({type:"pending",variables:e,isPaused:o}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);const s=await this.options.onMutate?.(e,n);s!==this.state.context&&this.#i({type:"pending",context:s,variables:e,isPaused:o})}const i=await this.#r.start();return await this.#n.config.onSuccess?.(i,e,this.state.context,this,n),await this.options.onSuccess?.(i,e,this.state.context,n),await this.#n.config.onSettled?.(i,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(i,null,e,this.state.context,n),this.#i({type:"success",data:i}),i}catch(i){try{await this.#n.config.onError?.(i,e,this.state.context,this,n)}catch(s){Promise.reject(s)}try{await this.options.onError?.(i,e,this.state.context,n)}catch(s){Promise.reject(s)}try{await this.#n.config.onSettled?.(void 0,i,this.state.variables,this.state.context,this,n)}catch(s){Promise.reject(s)}try{await this.options.onSettled?.(void 0,i,e,this.state.context,n)}catch(s){Promise.reject(s)}throw this.#i({type:"error",error:i}),i}finally{this.#n.runNext(this)}}#i(e){const t=n=>{switch(e.type){case"failed":return{...n,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...n,isPaused:!0};case"continue":return{...n,isPaused:!1};case"pending":return{...n,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...n,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...n,data:void 0,error:e.error,failureCount:n.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}};this.state=t(this.state),Rr.batch(()=>{this.#t.forEach(n=>{n.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:"updated",action:e})})}};function D2(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var PB=class extends Xu{constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}#e;#t;#n;build(e,t,n){const r=new DB({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);const t=vm(e);if(typeof t=="string"){const n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:"added",mutation:e})}remove(e){if(this.#e.delete(e)){const t=vm(e);if(typeof t=="string"){const n=this.#t.get(t);if(n)if(n.length>1){const r=n.indexOf(e);r!==-1&&n.splice(r,1)}else n[0]===e&&this.#t.delete(t)}}this.notify({type:"removed",mutation:e})}canRun(e){const t=vm(e);if(typeof t=="string"){const r=this.#t.get(t)?.find(o=>o.state.status==="pending");return!r||r===e}else return!0}runNext(e){const t=vm(e);return typeof t=="string"?this.#t.get(t)?.find(r=>r!==e&&r.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){Rr.batch(()=>{this.#e.forEach(e=>{this.notify({type:"removed",mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){const t={exact:!0,...e};return this.getAll().find(n=>Z_(t,n))}findAll(e={}){return this.getAll().filter(t=>Z_(e,t))}notify(e){Rr.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){const e=this.getAll().filter(t=>t.state.isPaused);return Rr.batch(()=>Promise.all(e.map(t=>t.continue().catch(lo))))}};function vm(e){return e.options.scope?.id}var IB=class extends Xu{#e;#t=void 0;#n;#r;constructor(t,n){super(),this.#e=t,this.setOptions(n),this.bindMethods(),this.#i()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(t){const n=this.options;this.options=this.#e.defaultMutationOptions(t),Tg(this.options,n)||this.#e.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#n,observer:this}),n?.mutationKey&&this.options.mutationKey&&Gl(n.mutationKey)!==Gl(this.options.mutationKey)?this.reset():this.#n?.state.status==="pending"&&this.#n.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(t){this.#i(),this.#o(t)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#i(),this.#o()}mutate(t,n){return this.#r=n,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(t)}#i(){const t=this.#n?.state??D2();this.#t={...t,isPending:t.status==="pending",isSuccess:t.status==="success",isError:t.status==="error",isIdle:t.status==="idle",mutate:this.mutate,reset:this.reset}}#o(t){Rr.batch(()=>{if(this.#r&&this.hasListeners()){const n=this.#t.variables,r=this.#t.context,o={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(t?.type==="success"){try{this.#r.onSuccess?.(t.data,n,r,o)}catch(i){Promise.reject(i)}try{this.#r.onSettled?.(t.data,null,n,r,o)}catch(i){Promise.reject(i)}}else if(t?.type==="error"){try{this.#r.onError?.(t.error,n,r,o)}catch(i){Promise.reject(i)}try{this.#r.onSettled?.(void 0,t.error,n,r,o)}catch(i){Promise.reject(i)}}}this.listeners.forEach(n=>{n(this.#t)})})}},zB=class extends Xu{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){const r=t.queryKey,o=t.queryHash??rE(r,t);let i=this.get(o);return i||(i=new TB({client:e,queryKey:r,queryHash:o,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(i)),i}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){Rr.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){const t={exact:!0,...e};return this.getAll().find(n=>Y_(t,n))}findAll(e={}){const t=this.getAll();return Object.keys(e).length>0?t.filter(n=>Y_(e,n)):t}notify(e){Rr.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){Rr.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){Rr.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},LB=class{#e;#t;#n;#r;#i;#o;#a;#s;constructor(e={}){this.#e=e.queryCache||new zB,this.#t=e.mutationCache||new PB,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#o=0}mount(){this.#o++,this.#o===1&&(this.#a=nE.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=Mg.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#o--,this.#o===0&&(this.#a?.(),this.#a=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return this.#t.findAll({...e,status:"pending"}).length}getQueryData(e){const t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(Ka(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:t,state:n})=>{const r=n.data;return[t,r]})}setQueryData(e,t,n){const r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,s=xB(t,i);if(s!==void 0)return this.#e.build(this,r).setData(s,{...n,manual:!0})}setQueriesData(e,t,n){return Rr.batch(()=>this.#e.findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){const t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){const t=this.#e;Rr.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=this.#e;return Rr.batch(()=>(n.findAll(e).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},r=Rr.batch(()=>this.#e.findAll(e).map(o=>o.cancel(n)));return Promise.all(r).then(lo).catch(lo)}invalidateQueries(e,t={}){return Rr.batch(()=>(this.#e.findAll(e).forEach(n=>{n.invalidate()}),e?.refetchType==="none"?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??"active"},t)))}refetchQueries(e,t={}){const n={...t,cancelRefetch:t.cancelRefetch??!0},r=Rr.batch(()=>this.#e.findAll(e).filter(o=>!o.isDisabled()&&!o.isStatic()).map(o=>{let i=o.fetch(void 0,n);return n.throwOnError||(i=i.catch(lo)),o.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(r).then(lo)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=this.#e.build(this,t);return n.isStaleByTime(Ka(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(lo).catch(lo)}fetchInfiniteQuery(e){return e._type="infinite",this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(lo).catch(lo)}ensureInfiniteQueryData(e){return e._type="infinite",this.ensureQueryData(e)}resumePausedMutations(){return Mg.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(Gl(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...this.#r.values()],n={};return t.forEach(r=>{Au(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(Gl(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...this.#i.values()],n={};return t.forEach(r=>{Au(e,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=rE(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===oE&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},P2=b.createContext(void 0),Jt=e=>{const t=b.useContext(P2);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},FB=({client:e,children:t})=>(b.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),f.jsx(P2.Provider,{value:e,children:t})),I2=b.createContext(!1),$B=()=>b.useContext(I2);I2.Provider;function VB(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var BB=b.createContext(VB()),HB=()=>b.useContext(BB),UB=(e,t,n)=>{const r=n?.state.error&&typeof e.throwOnError=="function"?iE(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},qB=e=>{b.useEffect(()=>{e.clearReset()},[e])},YB=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:o})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(o&&e.data===void 0||iE(n,[e.error,r])),ZB=e=>{if(e.suspense){const n=o=>o==="static"?o:Math.max(o??1e3,1e3),r=e.staleTime;e.staleTime=typeof r=="function"?(...o)=>n(r(...o)):n(r),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},GB=(e,t)=>e.isLoading&&e.isFetching&&!t,KB=(e,t)=>e?.suspense&&t.isPending,tN=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function XB(e,t,n){const r=$B(),o=HB(),i=Jt(),s=i.defaultQueryOptions(e);i.getDefaultOptions().queries?._experimental_beforeQuery?.(s);const c=i.getQueryCache().get(s.queryHash),d=e.subscribed!==!1;s._optimisticResults=r?"isRestoring":d?"optimistic":void 0,ZB(s),UB(s,o,c),qB(o);const u=!i.getQueryCache().get(s.queryHash),[p]=b.useState(()=>new t(i,s)),m=p.getOptimisticResult(s),g=!r&&d;if(b.useSyncExternalStore(b.useCallback(y=>{const v=g?p.subscribe(Rr.batchCalls(y)):lo;return p.updateResult(),v},[p,g]),()=>p.getCurrentResult(),()=>p.getCurrentResult()),b.useEffect(()=>{p.setOptions(s)},[s,p]),KB(s,m))throw tN(s,p,o);if(YB({result:m,errorResetBoundary:o,throwOnError:s.throwOnError,query:c,suspense:s.suspense}))throw m.error;return i.getDefaultOptions().queries?._experimental_afterQuery?.(s,m),s.experimental_prefetchInRender&&!Zf.isServer()&&GB(m,r)&&(u?tN(s,p,o):c?.promise)?.catch(lo).finally(()=>{p.updateResult()}),s.notifyOnChangeProps?m:p.trackResult(m)}function _r(e,t){return XB(e,MB)}function on(e,t){const n=Jt(),[r]=b.useState(()=>new IB(n,e));b.useEffect(()=>{r.setOptions(e)},[r,e]);const o=b.useSyncExternalStore(b.useCallback(s=>r.subscribe(Rr.batchCalls(s)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),i=b.useCallback((s,c)=>{r.mutate(s,c).catch(lo)},[r]);if(o.error&&iE(r.options.throwOnError,[o.error]))throw o.error;return{...o,mutate:i,mutateAsync:o.mutate}}var z2=e=>{throw TypeError(e)},L2=(e,t,n)=>t.has(e)||z2("Cannot "+n),li=(e,t,n)=>(L2(e,t,"read from private field"),n?n.call(e):t.get(e)),kf=(e,t,n)=>t.has(e)?z2("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),Xi=(e,t,n,r)=>(L2(e,t,"write to private field"),t.set(e,n),n),Ry=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,aE=/^[\\/]{2}/;function F2(e,t){return t+e.replace(/\\/g,"/")}var nN="popstate";function rN(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function QB(e={}){function t(r,o){let i=o.state?.masked,{pathname:s,search:c,hash:d}=i||r.location;return Gf("",{pathname:s,search:c,hash:d},o.state&&o.state.usr||null,o.state&&o.state.key||"default",i?{pathname:r.location.pathname,search:r.location.search,hash:r.location.hash}:void 0)}function n(r,o){return typeof o=="string"?o:ds(o)}return JB(t,n,null,e)}function Xt(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function lr(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function WB(){return Math.random().toString(36).substring(2,10)}function oN(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 Gf(e,t,n=null,r,o){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?hs(t):t,state:n,key:t&&t.key||r||WB(),mask:o}}function ds({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 hs(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 JB(e,t,n,r={}){let{window:o=document.defaultView,v5Compat:i=!1}=r,s=o.history,c="POP",d=null,u=p();u==null&&(u=0,s.replaceState({...s.state,idx:u},""));function p(){return(s.state||{idx:null}).idx}function m(){c="POP";let w=p(),E=w==null?null:w-u;u=w,d&&d({action:c,location:S.location,delta:E})}function g(w,E){c="PUSH";let k=rN(w)?w:Gf(S.location,w,E);u=p()+1;let j=oN(k,u),N=S.createHref(k.mask||k);try{s.pushState(j,"",N)}catch(A){if(A instanceof DOMException&&A.name==="DataCloneError")throw A;o.location.assign(N)}i&&d&&d({action:c,location:S.location,delta:1})}function y(w,E){c="REPLACE";let k=rN(w)?w:Gf(S.location,w,E);u=p();let j=oN(k,u),N=S.createHref(k.mask||k);s.replaceState(j,"",N),i&&d&&d({action:c,location:S.location,delta:0})}function v(w){return $2(o,w)}let S={get action(){return c},get location(){return e(o,s)},listen(w){if(d)throw new Error("A history only accepts one active listener");return o.addEventListener(nN,m),d=w,()=>{o.removeEventListener(nN,m),d=null}},createHref(w){return t(o,w)},createURL:v,encodeLocation(w){let E=v(w);return{pathname:E.pathname,search:E.search,hash:E.hash}},push:g,replace:y,go(w){return s.go(w)}};return S}function $2(e,t,n=!1){let r="http://localhost";e&&(r=e.location.origin!=="null"?e.location.origin:e.location.href),Xt(r,"No window.location.(origin|href) available to create URL");let o=typeof t=="string"?t:ds(t);return o=o.replace(/ $/,"%20"),!n&&aE.test(o)&&(o=r+o),new URL(o,r)}var jf,iN=class{constructor(e){if(kf(this,jf,new Map),e)for(let[t,n]of e)this.set(t,n)}get(e){if(li(this,jf).has(e))return li(this,jf).get(e);if(e.defaultValue!==void 0)return e.defaultValue;throw new Error("No value found for context")}set(e,t){li(this,jf).set(e,t)}};jf=new WeakMap;var eH=new Set(["lazy","caseSensitive","path","id","index","children"]);function tH(e){return eH.has(e)}var nH=new Set(["lazy","caseSensitive","path","id","index","middleware","children"]);function rH(e){return nH.has(e)}function oH(e){return e.index===!0}function Kf(e,t,n=[],r={},o=!1){return e.map((i,s)=>{let c=[...n,String(s)],d=typeof i.id=="string"?i.id:c.join("-");if(Xt(i.index!==!0||!i.children,"Cannot specify children on an index route"),Xt(o||!r[d],`Found a route id collision on id "${d}". Route id's must be globally unique within Data Router usages`),oH(i)){let u={...i,id:d};return r[d]=sN(u,t(u)),u}else{let u={...i,id:d,children:void 0};return r[d]=sN(u,t(u)),i.children&&(u.children=Kf(i.children,t,c,r,o)),u}})}function sN(e,t){return Object.assign(e,{...t,...typeof t.lazy=="object"&&t.lazy!=null?{lazy:{...e.lazy,...t.lazy}}:{}})}function V2(e,t,n="/"){return ji(e,t,n,!1)}function ji(e,t,n,r,o){let i=typeof t=="string"?hs(t):t,s=Co(i.pathname||"/",n);if(s==null)return null;let c=o??dg(e),d=null,u=mH(s);for(let p=0;d==null&&p<c.length;++p)d=pH(c[p],u,r);return d}function B2(e,t){let{route:n,pathname:r,params:o}=e;return{id:n.id,pathname:r,params:o,data:t[n.id],loaderData:t[n.id],handle:n.handle}}function dg(e){let t=H2(e);return iH(t),t}function H2(e,t=[],n=[],r="",o=!1){let i=(s,c,d=o,u)=>{let p={relativePath:u===void 0?s.path||"":u,caseSensitive:s.caseSensitive===!0,childrenIndex:c,route:s};if(p.relativePath.startsWith("/")){if(!p.relativePath.startsWith(r)&&d)return;Xt(p.relativePath.startsWith(r),`Absolute route path "${p.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),p.relativePath=p.relativePath.slice(r.length)}let m=hi([r,p.relativePath]),g=n.concat(p);s.children&&s.children.length>0&&(Xt(s.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${m}".`),H2(s.children,t,g,m,d)),!(s.path==null&&!s.index)&&t.push({path:m,score:fH(m,s.index),routesMeta:g.map((y,v)=>{let[S,w]=Y2(y.relativePath,y.caseSensitive,v===g.length-1);return{...y,matcher:S,compiledParams:w}})})};return e.forEach((s,c)=>{if(s.path===""||!s.path?.includes("?"))i(s,c);else for(let d of U2(s.path))i(s,c,!0,d)}),t}function U2(e){let t=e.split("/");if(t.length===0)return[];let[n,...r]=t,o=n.endsWith("?"),i=n.replace(/\?$/,"");if(r.length===0)return o?[i,""]:[i];let s=U2(r.join("/")),c=[];return c.push(...s.map(d=>d===""?i:[i,d].join("/"))),o&&c.push(...s),c.map(d=>e.startsWith("/")&&d===""?"/":d)}function iH(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:hH(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}var sH=/^:[\w-]+$/,aH=3,lH=2,cH=1,uH=10,dH=-2,aN=e=>e==="*";function fH(e,t){let n=e.split("/"),r=n.length;return n.some(aN)&&(r+=dH),t&&(r+=lH),n.filter(o=>!aN(o)).reduce((o,i)=>o+(sH.test(i)?aH:i===""?cH:uH),r)}function hH(e,t){return e.length===t.length&&e.slice(0,-1).every((r,o)=>r===t[o])?e[e.length-1]-t[t.length-1]:0}function pH(e,t,n=!1){let{routesMeta:r}=e,o={},i="/",s=[];for(let c=0;c<r.length;++c){let d=r[c],u=c===r.length-1,p=i==="/"?t:t.slice(i.length)||"/",m={path:d.relativePath,caseSensitive:d.caseSensitive,end:u},g=d.matcher&&d.compiledParams?q2(m,p,d.matcher,d.compiledParams):Ag(m,p),y=d.route;if(!g&&u&&n&&!r[r.length-1].route.index&&(g=Ag({path:d.relativePath,caseSensitive:d.caseSensitive,end:!1},p)),!g)return null;Object.assign(o,g.params),s.push({params:o,pathname:hi([i,g.pathname]),pathnameBase:xH(hi([i,g.pathnameBase])),route:y}),g.pathnameBase!=="/"&&(i=hi([i,g.pathnameBase]))}return s}function Ag(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=Y2(e.path,e.caseSensitive,e.end);return q2(e,t,n,r)}function q2(e,t,n,r){let o=t.match(n);if(!o)return null;let i=o[0],s=i.replace(/(.)\/+$/,"$1"),c=o.slice(1);return{params:r.reduce((u,{paramName:p,isOptional:m},g)=>{if(p==="*"){let v=c[g]||"";s=i.slice(0,i.length-v.length).replace(/(.)\/+$/,"$1")}const y=c[g];return m&&!y?u[p]=void 0:u[p]=(y||"").replace(/%2F/g,"/"),u},{}),pathname:i,pathnameBase:s,pattern:e}}function Y2(e,t=!1,n=!0){lr(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=[],o="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(s,c,d,u,p)=>{if(r.push({paramName:c,isOptional:d!=null}),d){let m=p.charAt(u+s.length);return m&&m!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(r.push({paramName:"*"}),o+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?o+="\\/*$":e!==""&&e!=="/"&&(o+="(?:(?=\\/|$))"),[new RegExp(o,t?void 0:"i"),r]}function mH(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return lr(!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 Co(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 gH({basename:e,pathname:t}){return t==="/"?e:hi([e,t])}var lE=e=>Ry.test(e);function yH(e,t="/"){let{pathname:n,search:r="",hash:o=""}=typeof e=="string"?hs(e):e,i;return n?(n=cE(n),n.startsWith("/")?i=lN(n.substring(1),"/"):i=lN(n,t)):i=t,{pathname:i,search:vH(r),hash:bH(o)}}function lN(e,t){let n=Og(t).split("/");return e.split("/").forEach(o=>{o===".."?n.length>1&&n.pop():o!=="."&&n.push(o)}),n.length>1?n.join("/"):"/"}function o0(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 Z2(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function _y(e){let t=Z2(e);return t.map((n,r)=>r===t.length-1?n.pathname:n.pathnameBase)}function Eh(e,t,n,r=!1){let o;typeof e=="string"?o=hs(e):(o={...e},Xt(!o.pathname||!o.pathname.includes("?"),o0("?","pathname","search",o)),Xt(!o.pathname||!o.pathname.includes("#"),o0("#","pathname","hash",o)),Xt(!o.search||!o.search.includes("#"),o0("#","search","hash",o)));let i=e===""||o.pathname==="",s=i?"/":o.pathname,c;if(s==null)c=n;else{let m=t.length-1;if(!r&&s.startsWith("..")){let g=s.split("/");for(;g[0]==="..";)g.shift(),m-=1;o.pathname=g.join("/")}c=m>=0?t[m]:"/"}let d=yH(o,c),u=s&&s!=="/"&&s.endsWith("/"),p=(i||s===".")&&n.endsWith("/");return!d.pathname.endsWith("/")&&(u||p)&&(d.pathname+="/"),d}var cE=e=>e.replace(/[\\/]{2,}/g,"/"),hi=e=>cE(e.join("/")),Og=e=>e.replace(/\/+$/,""),xH=e=>Og(e).replace(/^\/*/,"/"),vH=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,bH=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,wH=["EvalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],Ch=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 Xf(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function kh(e){let t=e.map(n=>n.route.path).filter(Boolean);return hi(t)||"/"}var G2=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function K2(e,t){let n=e;if(typeof n!="string"||!Ry.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,o=!1;if(G2)try{let i=new URL(window.location.href),s=aE.test(n)?new URL(F2(n,i.protocol)):new URL(n),c=Co(s.pathname,t);s.origin===i.origin&&c!=null?n=c+s.search+s.hash:o=!0}catch{lr(!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:o,to:n}}var qa=Symbol("Uninstrumented");function SH(e,t){let n={lazy:[],"lazy.loader":[],"lazy.action":[],"lazy.middleware":[],middleware:[],loader:[],action:[]};e.forEach(o=>o({id:t.id,index:t.index,path:t.path,instrument(i){let s=Object.keys(n);for(let c of s)i[c]&&n[c].push(i[c])}}));let r={};if(typeof t.lazy=="function"&&n.lazy.length>0){let o=bu(n.lazy,t.lazy,()=>{});o&&(r.lazy=o)}if(typeof t.lazy=="object"){let o=t.lazy;["middleware","loader","action"].forEach(i=>{let s=o[i],c=n[`lazy.${i}`];if(typeof s=="function"&&c.length>0){let d=bu(c,s,()=>{});d&&(r.lazy=Object.assign(r.lazy||{},{[i]:d}))}})}return["loader","action"].forEach(o=>{let i=t[o];if(typeof i=="function"&&n[o].length>0){let s=i[qa]??i,c=bu(n[o],s,(...d)=>cN(d[0]));c&&(o==="loader"&&s.hydrate===!0&&(c.hydrate=!0),c[qa]=s,r[o]=c)}}),t.middleware&&t.middleware.length>0&&n.middleware.length>0&&(r.middleware=t.middleware.map(o=>{let i=o[qa]??o,s=bu(n.middleware,i,(...c)=>cN(c[0]));return s?(s[qa]=i,s):o})),r}function EH(e,t){let n={navigate:[],fetch:[]};if(t.forEach(r=>r({instrument(o){let i=Object.keys(o);for(let s of i)o[s]&&n[s].push(o[s])}})),n.navigate.length>0){let r=e.navigate[qa]??e.navigate,o=bu(n.navigate,r,(...i)=>{let[s,c]=i;return{to:typeof s=="number"||typeof s=="string"?s:s?ds(s):".",...uN(e,c??{})}});o&&(o[qa]=r,e.navigate=o)}if(n.fetch.length>0){let r=e.fetch[qa]??e.fetch,o=bu(n.fetch,r,(...i)=>{let[s,,c,d]=i;return{href:c??".",fetcherKey:s,...uN(e,d??{})}});o&&(o[qa]=r,e.fetch=o)}return e}function bu(e,t,n){return e.length===0?null:async(...r)=>{let o=await X2(e,n(...r),()=>t(...r),e.length-1);if(o.type==="error")throw o.value;return o.value}}async function X2(e,t,n,r){let o=e[r],i;if(o){let s,c=async()=>(s?console.error("You cannot call instrumented handlers more than once"):s=X2(e,t,n,r-1),i=await s,Xt(i,"Expected a result"),i.type==="error"&&i.value instanceof Error?{status:"error",error:i.value}:{status:"success",error:void 0});try{await o(c,t)}catch(d){console.error("An instrumentation function threw an error:",d)}s||await c(),await s}else try{i={type:"success",value:await n()}}catch(s){i={type:"error",value:s}}return i||{type:"error",value:new Error("No result assigned in instrumentation chain.")}}function cN(e){let{request:t,context:n,params:r,pattern:o}=e;return{request:CH(t),params:{...r},pattern:o,context:kH(n)}}function uN(e,t){return{currentUrl:ds(e.state.location),..."formMethod"in t?{formMethod:t.formMethod}:{},..."formEncType"in t?{formEncType:t.formEncType}:{},..."formData"in t?{formData:t.formData}:{},..."body"in t?{body:t.body}:{}}}function CH(e){return{method:e.method,url:e.url,headers:{get:(...t)=>e.headers.get(...t)}}}function kH(e){if(RH(e)){let t={...e};return Object.freeze(t),t}else return{get:t=>e.get(t)}}var jH=Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function RH(e){if(e===null||typeof e!="object")return!1;const t=Object.getPrototypeOf(e);return t===Object.prototype||t===null||Object.getOwnPropertyNames(t).sort().join("\0")===jH}var Q2=["POST","PUT","PATCH","DELETE"],_H=new Set(Q2),NH=["GET",...Q2],TH=new Set(NH),W2=new Set([301,302,303,307,308]),MH=new Set([307,308]),i0={state:"idle",location:void 0,matches:void 0,historyAction:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},AH={state:"idle",data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},du={state:"unblocked",proceed:void 0,reset:void 0,location:void 0},OH=e=>({hasErrorBoundary:!!e.hasErrorBoundary}),J2="remix-router-transitions",eD=Symbol("ResetLoaderData"),Pl,fu,$a,hu,DH=class{constructor(e){kf(this,Pl),kf(this,fu),kf(this,$a),kf(this,hu),Xi(this,Pl,e),Xi(this,fu,dg(e))}get stableRoutes(){return li(this,Pl)}get activeRoutes(){return li(this,$a)??li(this,Pl)}get branches(){return li(this,hu)??li(this,fu)}get hasHMRRoutes(){return li(this,$a)!=null}setRoutes(e){Xi(this,Pl,e),Xi(this,fu,dg(e))}setHmrRoutes(e){Xi(this,$a,e),Xi(this,hu,dg(e))}commitHmrRoutes(){li(this,$a)&&(Xi(this,Pl,li(this,$a)),Xi(this,fu,li(this,hu)),Xi(this,$a,void 0),Xi(this,hu,void 0))}};Pl=new WeakMap;fu=new WeakMap;$a=new WeakMap;hu=new WeakMap;function PH(e){const t=e.window?e.window:typeof window<"u"?window:void 0,n=typeof t<"u"&&typeof t.document<"u"&&typeof t.document.createElement<"u";Xt(e.routes.length>0,"You must provide a non-empty routes array to createRouter");let r=e.hydrationRouteProperties||[],o=e.mapRouteProperties||OH,i=o;if(e.instrumentations){let te=e.instrumentations;i=ae=>({...o(ae),...SH(te.map(fe=>fe.route).filter(Boolean),ae)})}let s={},c=new DH(Kf(e.routes,i,void 0,s)),d=e.basename||"/";d.startsWith("/")||(d=`/${d}`);let u=e.dataStrategy||$H,p={...e.future},m=null,g=new Set,y=null,v=null,S=null,w=null,E=e.hydrationData!=null,k=ji(c.activeRoutes,e.history.location,d,!1,c.branches),j=!1,N=null,A,R;if(k==null&&!e.patchRoutesOnNavigation){let te=ci(404,{pathname:e.history.location.pathname}),{matches:ae,route:fe}=bm(c.activeRoutes);A=!0,R=!A,k=ae,N={[fe.id]:te}}else if(k&&!e.hydrationData&&Gt(k,c.activeRoutes,e.history.location.pathname).active&&(k=null),k)if(k.some(te=>te.route.lazy))A=!1,R=!A;else if(!k.some(te=>uE(te.route)))A=!0,R=!A;else{let te=e.hydrationData?e.hydrationData.loaderData:null,ae=e.hydrationData?e.hydrationData.errors:null,fe=k;if(ae){let Ae=k.findIndex(ze=>ae[ze.route.id]!==void 0);fe=fe.slice(0,Ae+1)}R=!1,A=!0,fe.forEach(Ae=>{let ze=tD(Ae.route,te,ae);R=R||ze.renderFallback,A=A&&!ze.shouldLoad})}else{A=!1,R=!A,k=[];let te=Gt(null,c.activeRoutes,e.history.location.pathname);te.active&&te.matches&&(j=!0,k=te.matches)}let M,T={historyAction:e.history.action,location:e.history.location,matches:k,initialized:A,renderFallback:R,navigation:i0,restoreScrollPosition:e.hydrationData!=null?!1:null,preventScrollReset:!1,revalidation:"idle",loaderData:e.hydrationData&&e.hydrationData.loaderData||{},actionData:e.hydrationData&&e.hydrationData.actionData||null,errors:e.hydrationData&&e.hydrationData.errors||N,fetchers:new Map,blockers:new Map},O="POP",z=null,q=!1,$,G=!1,L=new Map,F=null,P=!1,I=!1,Y=new Set,Z=new Map,D=0,H=-1,U=new Map,B=new Set,X=new Map,J=new Map,Q=new Set,oe=new Map,W,ne=null;function je(){if(m=e.history.listen(({action:te,location:ae,delta:fe})=>{if(W){W(),W=void 0;return}lr(oe.size===0||fe!=null,"You are trying to use a blocker on a POP navigation to a location that was not created by @remix-run/router. This will fail silently in production. This can happen if you are navigating outside the router via `window.history.pushState`/`window.location.hash` instead of using router navigation APIs. This can also happen if you are using createHashRouter and the user manually changes the URL.");let Ae=it({currentLocation:T.location,nextLocation:ae,historyAction:te});if(Ae&&fe!=null){let ze=new Promise(Je=>{W=Je});e.history.go(fe*-1),nt(Ae,{state:"blocked",location:ae,proceed(){nt(Ae,{state:"proceeding",proceed:void 0,reset:void 0,location:ae}),ze.then(()=>e.history.go(fe))},reset(){let Je=new Map(T.blockers);Je.set(Ae,du),re({blockers:Je})}}),z?.resolve(),z=null;return}return we(te,ae)}),n){iU(t,L);let te=()=>sU(t,L);t.addEventListener("pagehide",te),F=()=>t.removeEventListener("pagehide",te)}return T.initialized||we("POP",T.location,{initialHydration:!0}),M}function Ee(){m&&m(),F&&F(),g.clear(),$&&$.abort(),T.fetchers.forEach((te,ae)=>ie(T.fetchers,ae)),T.blockers.forEach((te,ae)=>Ke(ae))}function pe(te){if(g.add(te),y){let{newErrors:ae}=y;y=null,te(T,{deletedFetchers:[],newErrors:ae,viewTransitionOpts:void 0,flushSync:!1})}return()=>g.delete(te)}function re(te,ae={}){te.matches&&(te.matches=te.matches.map(ze=>{let Je=s[ze.route.id],Xe=ze.route;return Xe.element!==Je.element||Xe.errorElement!==Je.errorElement||Xe.hydrateFallbackElement!==Je.hydrateFallbackElement?{...ze,route:Je}:ze})),T={...T,...te};let fe=[],Ae=[];T.fetchers.forEach((ze,Je)=>{ze.state==="idle"&&(Q.has(Je)?fe.push(Je):Ae.push(Je))}),Q.forEach(ze=>{!T.fetchers.has(ze)&&!Z.has(ze)&&fe.push(ze)}),g.size===0&&(y={newErrors:te.errors??null}),[...g].forEach(ze=>ze(T,{deletedFetchers:fe,newErrors:te.errors??null,viewTransitionOpts:ae.viewTransitionOpts,flushSync:ae.flushSync===!0})),fe.forEach(ze=>ie(T.fetchers,ze)),Ae.forEach(ze=>T.fetchers.delete(ze))}function ge(te,ae,{flushSync:fe}={}){let Ae=T.actionData!=null&&T.navigation.formMethod!=null&&Wr(T.navigation.formMethod)&&T.navigation.state==="loading"&&te.state?._isRedirect!==!0,ze;ae.actionData?Object.keys(ae.actionData).length>0?ze=ae.actionData:ze=null:Ae?ze=T.actionData:ze=null;let Je=ae.loaderData?bN(T.loaderData,ae.loaderData,ae.matches||[],ae.errors):T.loaderData,Xe=T.blockers;Xe.size>0&&(Xe=new Map(Xe),Xe.forEach((mt,Ft)=>Xe.set(Ft,du)));let et=P?!1:Rt(te,ae.matches||T.matches),tt=q===!0||T.navigation.formMethod!=null&&Wr(T.navigation.formMethod)&&te.state?._isRedirect!==!0;c.commitHmrRoutes(),P||O==="POP"||(O==="PUSH"?e.history.push(te,te.state):O==="REPLACE"&&e.history.replace(te,te.state));let dt;if(O==="POP"){let mt=L.get(T.location.pathname);mt&&mt.has(te.pathname)?dt={currentLocation:T.location,nextLocation:te}:L.has(te.pathname)&&(dt={currentLocation:te,nextLocation:T.location})}else if(G){let mt=L.get(T.location.pathname);mt?mt.add(te.pathname):(mt=new Set([te.pathname]),L.set(T.location.pathname,mt)),dt={currentLocation:T.location,nextLocation:te}}re({...ae,actionData:ze,loaderData:Je,historyAction:O,location:te,initialized:!0,renderFallback:!1,navigation:i0,revalidation:"idle",restoreScrollPosition:et,preventScrollReset:tt,blockers:Xe},{viewTransitionOpts:dt,flushSync:fe===!0}),O="POP",q=!1,G=!1,P=!1,I=!1,z?.resolve(),z=null,ne?.resolve(),ne=null}async function _e(te,ae){if(z?.resolve(),z=null,typeof te=="number"){z||(z=CN());let pn=z.promise;return e.history.go(te),pn}let fe=Cw(T.location,T.matches,d,te,ae?.fromRouteId,ae?.relative),{path:Ae,submission:ze,error:Je}=dN(!1,fe,ae),Xe;ae?.mask&&(Xe={pathname:"",search:"",hash:"",...typeof ae.mask=="string"?hs(ae.mask):{...T.location.mask,...ae.mask}});let et=T.location,tt=Gf(et,Ae,ae&&ae.state,void 0,Xe);tt={...tt,...e.history.encodeLocation(tt)};let dt=ae&&ae.replace!=null?ae.replace:void 0,mt="PUSH";dt===!0?mt="REPLACE":dt===!1||ze!=null&&Wr(ze.formMethod)&&ze.formAction===T.location.pathname+T.location.search&&(mt="REPLACE");let Ft=ae&&"preventScrollReset"in ae?ae.preventScrollReset===!0:void 0,St=(ae&&ae.flushSync)===!0,Kt=it({currentLocation:et,nextLocation:tt,historyAction:mt});if(Kt){nt(Kt,{state:"blocked",location:tt,proceed(){nt(Kt,{state:"proceeding",proceed:void 0,reset:void 0,location:tt}),_e(te,ae)},reset(){let pn=new Map(T.blockers);pn.set(Kt,du),re({blockers:pn})}});return}await we(mt,tt,{submission:ze,pendingError:Je,preventScrollReset:Ft,replace:ae&&ae.replace,enableViewTransition:ae&&ae.viewTransition,flushSync:St,callSiteDefaultShouldRevalidate:ae&&ae.defaultShouldRevalidate})}function De(){ne||(ne=CN()),Se(),re({revalidation:"loading"});let te=ne.promise;return T.navigation.state==="submitting"?te:T.navigation.state==="idle"?(we(T.historyAction,T.location,{startUninterruptedRevalidation:!0}),te):(we(O||T.historyAction,T.navigation.location,{overrideNavigation:T.navigation,enableViewTransition:G===!0}),te)}async function we(te,ae,fe){$&&$.abort(),$=null,O=te,P=(fe&&fe.startUninterruptedRevalidation)===!0,at(T.location,T.matches),q=(fe&&fe.preventScrollReset)===!0,G=(fe&&fe.enableViewTransition)===!0;let Ae=c.activeRoutes,ze=fe?.initialHydration&&T.matches&&T.matches.length>0&&!j?T.matches:ji(Ae,ae,d,!1,c.branches),Je=(fe&&fe.flushSync)===!0;if(ze&&T.initialized&&!I&&KH(T.location,ae)&&!(fe&&fe.submission&&Wr(fe.submission.formMethod))){ge(ae,{matches:ze},{flushSync:Je});return}let Xe=Gt(ze,Ae,ae.pathname);if(Xe.active&&Xe.matches&&(ze=Xe.matches),!ze){let{error:xn,notFoundMatches:sn,route:tr}=jt(ae.pathname);ge(ae,{matches:sn,loaderData:{},errors:{[tr.id]:xn}},{flushSync:Je});return}let et=fe&&fe.overrideNavigation?{...fe.overrideNavigation,matches:ze,historyAction:te}:void 0;$=new AbortController;let tt=pu(e.history,ae,$.signal,fe&&fe.submission),dt=e.getContext?await e.getContext():new iN,mt;if(fe&&fe.pendingError)mt=[Ha(ze).route.id,{type:"error",error:fe.pendingError}];else if(fe&&fe.submission&&Wr(fe.submission.formMethod)){let xn=await $e(tt,ae,fe.submission,ze,te,dt,Xe.active,fe&&fe.initialHydration===!0,{replace:fe.replace,flushSync:Je});if(xn.shortCircuited)return;if(xn.pendingActionResult){let[sn,tr]=xn.pendingActionResult;if(Uo(tr)&&Xf(tr.error)&&tr.error.status===404){$=null,ge(ae,{matches:xn.matches,loaderData:{},errors:{[sn]:tr.error}});return}}ze=xn.matches||ze,mt=xn.pendingActionResult,et=s0(ae,ze,te,fe.submission),Je=!1,Xe.active=!1,tt=pu(e.history,tt.url,tt.signal)}let{shortCircuited:Ft,matches:St,loaderData:Kt,errors:pn,workingFetchers:zn}=await Me(tt,ae,ze,te,dt,Xe.active,et,fe&&fe.submission,fe&&fe.fetcherSubmission,fe&&fe.replace,fe&&fe.initialHydration===!0,Je,mt,fe&&fe.callSiteDefaultShouldRevalidate);Ft||($=null,ge(ae,{matches:St||ze,...wN(mt),loaderData:Kt,errors:pn,...zn?{fetchers:zn}:{}}))}async function $e(te,ae,fe,Ae,ze,Je,Xe,et,tt={}){Se();let dt=rU(ae,Ae,ze,fe);if(re({navigation:dt},{flushSync:tt.flushSync===!0}),Xe){let St=await Nt(Ae,ae.pathname,te.signal);if(St.type==="aborted")return{shortCircuited:!0};if(St.type==="error"){if(St.partialMatches.length===0){let{matches:pn,route:zn}=bm(c.activeRoutes);return{matches:pn,pendingActionResult:[zn.id,{type:"error",error:St.error}]}}let Kt=Ha(St.partialMatches).route.id;return{matches:St.partialMatches,pendingActionResult:[Kt,{type:"error",error:St.error}]}}else if(St.matches)Ae=St.matches;else{let{notFoundMatches:Kt,error:pn,route:zn}=jt(ae.pathname);return{matches:Kt,pendingActionResult:[zn.id,{type:"error",error:pn}]}}}let mt,Ft=fg(Ae,ae);if(!Ft.route.action&&!Ft.route.lazy)mt={type:"error",error:ci(405,{method:te.method,pathname:ae.pathname,routeId:Ft.route.id})};else{let St=Eu(i,s,te,ae,Ae,Ft,et?[]:r,Je),Kt=await de(te,ae,St,Je,null);if(mt=Kt[Ft.route.id],!mt){for(let pn of Ae)if(Kt[pn.route.id]){mt=Kt[pn.route.id];break}}if(te.signal.aborted)return{shortCircuited:!0}}if($l(mt)){let St;return tt&&tt.replace!=null?St=tt.replace:St=yN(mt.response.headers.get("Location"),new URL(te.url),d,e.history)===T.location.pathname+T.location.search,await ke(te,mt,!0,{submission:fe,replace:St}),{shortCircuited:!0}}if(Uo(mt)){let St=Ha(Ae,Ft.route.id);return(tt&&tt.replace)!==!0&&(O="PUSH"),{matches:Ae,pendingActionResult:[St.route.id,mt,Ft.route.id]}}return{matches:Ae,pendingActionResult:[Ft.route.id,mt]}}async function Me(te,ae,fe,Ae,ze,Je,Xe,et,tt,dt,mt,Ft,St,Kt){let pn=Xe||s0(ae,fe,Ae,et),zn=et||tt||EN(pn),xn=!P&&!mt;if(Je){if(xn){let jn=Le(St);re({navigation:pn,...jn!==void 0?{actionData:jn}:{}},{flushSync:Ft})}let Tt=await Nt(fe,ae.pathname,te.signal);if(Tt.type==="aborted")return{shortCircuited:!0};if(Tt.type==="error"){if(Tt.partialMatches.length===0){let{matches:io,route:Oo}=bm(c.activeRoutes);return{matches:io,loaderData:{},errors:{[Oo.id]:Tt.error}}}let jn=Ha(Tt.partialMatches).route.id;return{matches:Tt.partialMatches,loaderData:{},errors:{[jn]:Tt.error}}}else if(Tt.matches)fe=Tt.matches;else{let{error:jn,notFoundMatches:io,route:Oo}=jt(ae.pathname);return{matches:io,loaderData:{},errors:{[Oo.id]:jn}}}}let sn=c.activeRoutes,{dsMatches:tr,revalidatingFetchers:un}=fN(te,ze,i,s,e.history,T,fe,zn,ae,mt?[]:r,mt===!0,I,Y,Q,X,B,sn,d,e.patchRoutesOnNavigation!=null,c.branches,St,Kt);if(H=++D,!e.dataStrategy&&!tr.some(Tt=>Tt.shouldLoad)&&!tr.some(Tt=>Tt.route.middleware&&Tt.route.middleware.length>0)&&un.length===0){let Tt=new Map(T.fetchers),jn=Be(Tt);return ge(ae,{matches:fe,loaderData:{},errors:St&&Uo(St[1])?{[St[0]]:St[1].error}:null,...wN(St),...jn?{fetchers:Tt}:{}},{flushSync:Ft}),{shortCircuited:!0}}if(xn){let Tt={};if(!Je){Tt.navigation=pn;let jn=Le(St);jn!==void 0&&(Tt.actionData=jn)}un.length>0&&(Tt.fetchers=He(un)),re(Tt,{flushSync:Ft})}un.forEach(Tt=>{Ce(Tt.key),Tt.controller&&Z.set(Tt.key,Tt.controller)});let qi=()=>un.forEach(Tt=>Ce(Tt.key));$&&$.signal.addEventListener("abort",qi);let{loaderResults:Ao,fetcherResults:Xr}=await ue(tr,un,te,ae,ze);if(te.signal.aborted)return{shortCircuited:!0};$&&$.signal.removeEventListener("abort",qi),un.forEach(Tt=>Z.delete(Tt.key));let zr=wm(Ao);if(zr)return await ke(te,zr.result,!0,{replace:dt}),{shortCircuited:!0};if(zr=wm(Xr),zr)return B.add(zr.key),await ke(te,zr.result,!0,{replace:dt}),{shortCircuited:!0};let fo=new Map(T.fetchers),{loaderData:la,errors:ho}=vN(T,fe,Ao,St,un,Xr,fo);mt&&T.errors&&(ho={...T.errors,...ho});let ca=Be(fo),bi=Pe(H,fo),wi=ca||bi||un.length>0;return{matches:fe,loaderData:la,errors:ho,...wi?{workingFetchers:fo}:{}}}function Le(te){if(te&&!Uo(te[1]))return{[te[0]]:te[1].data};if(T.actionData)return Object.keys(T.actionData).length===0?null:T.actionData}function He(te){let ae=new Map(T.fetchers);return te.forEach(fe=>{let Ae=ae.get(fe.key),ze=lf(void 0,Ae?Ae.data:void 0);ae.set(fe.key,ze)}),ae}async function Ge(te,ae,fe,Ae){Ce(te);let ze=(Ae&&Ae.flushSync)===!0,Je=c.activeRoutes,Xe=Cw(T.location,T.matches,d,fe,ae,Ae?.relative),et=ji(Je,Xe,d,!1,c.branches),tt=Gt(et,Je,Xe);if(tt.active&&tt.matches&&(et=tt.matches),!et){Ye(te,ae,ci(404,{pathname:Xe}),{flushSync:ze});return}let{path:dt,submission:mt,error:Ft}=dN(!0,Xe,Ae);if(Ft){Ye(te,ae,Ft,{flushSync:ze});return}let St=e.getContext?await e.getContext():new iN,Kt=(Ae&&Ae.preventScrollReset)===!0;if(mt&&Wr(mt.formMethod)){await ot(te,ae,dt,et,St,tt.active,ze,Kt,mt,Ae&&Ae.defaultShouldRevalidate);return}X.set(te,{routeId:ae,path:dt}),await me(te,ae,dt,et,St,tt.active,ze,Kt,mt)}async function ot(te,ae,fe,Ae,ze,Je,Xe,et,tt,dt){Se(),X.delete(te);let mt=T.fetchers.get(te);Ue(te,oU(tt,mt),{flushSync:Xe});let Ft=new AbortController,St=pu(e.history,fe,Ft.signal,tt);if(Je){let Sn=await Nt(Ae,new URL(St.url).pathname,St.signal,te);if(Sn.type==="aborted")return;if(Sn.type==="error"){Ye(te,ae,Sn.error,{flushSync:Xe});return}else if(Sn.matches)Ae=Sn.matches;else{Ye(te,ae,ci(404,{pathname:fe}),{flushSync:Xe});return}}let Kt=fg(Ae,fe);if(!Kt.route.action&&!Kt.route.lazy){let Sn=ci(405,{method:tt.formMethod,pathname:fe,routeId:ae});Ye(te,ae,Sn,{flushSync:Xe});return}Z.set(te,Ft);let pn=D,zn=Eu(i,s,St,fe,Ae,Kt,r,ze),xn=await de(St,fe,zn,ze,te),sn=xn[Kt.route.id];if(!sn){for(let Sn of zn)if(xn[Sn.route.id]){sn=xn[Sn.route.id];break}}if(St.signal.aborted){Z.get(te)===Ft&&Z.delete(te);return}if(Q.has(te)){if($l(sn)||Uo(sn)){Ue(te,Ji(void 0));return}}else{if($l(sn))if(Z.delete(te),H>pn){Ue(te,Ji(void 0));return}else return B.add(te),Ue(te,lf(tt)),ke(St,sn,!1,{fetcherSubmission:tt,preventScrollReset:et});if(Uo(sn)){Ye(te,ae,sn.error);return}}let tr=T.navigation.location||T.location,un=pu(e.history,tr,Ft.signal),qi=c.activeRoutes,Ao=T.navigation.state!=="idle"?ji(qi,T.navigation.location,d,!1,c.branches):T.matches;Xt(Ao,"Didn't find any matches after fetcher action");let Xr=++D;U.set(te,Xr);let{dsMatches:zr,revalidatingFetchers:fo}=fN(un,ze,i,s,e.history,T,Ao,tt,tr,r,!1,I,Y,Q,X,B,qi,d,e.patchRoutesOnNavigation!=null,c.branches,[Kt.route.id,sn],dt),la=lf(tt,sn.data),ho=new Map(T.fetchers);ho.set(te,la),fo.filter(Sn=>Sn.key!==te).forEach(Sn=>{let Jo=Sn.key,Lr=ho.get(Jo),hl=lf(void 0,Lr?Lr.data:void 0);ho.set(Jo,hl),Ce(Jo),Sn.controller&&Z.set(Jo,Sn.controller)}),re({fetchers:ho});let ca=()=>fo.forEach(Sn=>Ce(Sn.key));Ft.signal.addEventListener("abort",ca);let{loaderResults:bi,fetcherResults:wi}=await ue(zr,fo,un,tr,ze);if(Ft.signal.aborted)return;Ft.signal.removeEventListener("abort",ca),U.delete(te),Z.delete(te),fo.forEach(Sn=>Z.delete(Sn.key));let Tt=T.fetchers.has(te),jn=Sn=>{if(!Tt)return Sn;let Jo=new Map(Sn.fetchers);return Jo.set(te,Ji(sn.data)),{...Sn,fetchers:Jo}},io=wm(bi);if(io)return T=jn(T),ke(un,io.result,!1,{preventScrollReset:et});if(io=wm(wi),io)return B.add(io.key),T=jn(T),ke(un,io.result,!1,{preventScrollReset:et});let Oo=new Map(T.fetchers);Tt&&Oo.set(te,Ji(sn.data));let{loaderData:ua,errors:vs}=vN(T,Ao,bi,void 0,fo,wi,Oo);Pe(Xr,Oo),T.navigation.state==="loading"&&Xr>H?(Xt(O,"Expected pending action"),$&&$.abort(),ge(T.navigation.location,{matches:Ao,loaderData:ua,errors:vs,fetchers:Oo})):(re({errors:vs,loaderData:bN(T.loaderData,ua,Ao,vs),fetchers:Oo}),I=!1)}async function me(te,ae,fe,Ae,ze,Je,Xe,et,tt){let dt=T.fetchers.get(te);Ue(te,lf(tt,dt?dt.data:void 0),{flushSync:Xe});let mt=new AbortController,Ft=pu(e.history,fe,mt.signal);if(Je){let sn=await Nt(Ae,new URL(Ft.url).pathname,Ft.signal,te);if(sn.type==="aborted")return;if(sn.type==="error"){Ye(te,ae,sn.error,{flushSync:Xe});return}else if(sn.matches)Ae=sn.matches;else{Ye(te,ae,ci(404,{pathname:fe}),{flushSync:Xe});return}}let St=fg(Ae,fe);Z.set(te,mt);let Kt=D,pn=Eu(i,s,Ft,fe,Ae,St,r,ze),zn=await de(Ft,fe,pn,ze,te),xn=zn[St.route.id];if(!xn){for(let sn of Ae)if(zn[sn.route.id]){xn=zn[sn.route.id];break}}if(Z.get(te)===mt&&Z.delete(te),!Ft.signal.aborted){if(Q.has(te)){Ue(te,Ji(void 0));return}if($l(xn))if(H>Kt){Ue(te,Ji(void 0));return}else{B.add(te),await ke(Ft,xn,!1,{preventScrollReset:et});return}if(Uo(xn)){Ye(te,ae,xn.error);return}Ue(te,Ji(xn.data))}}async function ke(te,ae,fe,{submission:Ae,fetcherSubmission:ze,preventScrollReset:Je,replace:Xe}={}){fe||(z?.resolve(),z=null),ae.response.headers.has("X-Remix-Revalidate")&&(I=!0);let et=ae.response.headers.get("Location");Xt(et,"Expected a Location header on the redirect Response"),et=yN(et,new URL(te.url),d,e.history);let tt=Gf(T.location,et,{_isRedirect:!0});if(n){let pn=!1;if(ae.response.headers.has("X-Remix-Reload-Document"))pn=!0;else if(lE(et)){const zn=$2(t,et,!0);pn=zn.origin!==t.location.origin||Co(zn.pathname,d)==null}if(pn){Xe?t.location.replace(et):t.location.assign(et);return}}$=null;let dt=Xe===!0||ae.response.headers.has("X-Remix-Replace")?"REPLACE":"PUSH",{formMethod:mt,formAction:Ft,formEncType:St}=T.navigation;!Ae&&!ze&&mt&&Ft&&St&&(Ae=EN(T.navigation));let Kt=Ae||ze;if(MH.has(ae.response.status)&&Kt&&Wr(Kt.formMethod))await we(dt,tt,{submission:{...Kt,formAction:et},preventScrollReset:Je||q,enableViewTransition:fe?G:void 0});else{let pn=s0(tt,[],dt,Ae);await we(dt,tt,{overrideNavigation:pn,fetcherSubmission:ze,preventScrollReset:Je||q,enableViewTransition:fe?G:void 0})}}async function de(te,ae,fe,Ae,ze){let Je,Xe={};try{Je=await BH(u,te,ae,fe,ze,Ae,!1)}catch(et){return fe.filter(tt=>tt.shouldLoad).forEach(tt=>{Xe[tt.route.id]={type:"error",error:et}}),Xe}if(te.signal.aborted)return Xe;if(!Wr(te.method))for(let et of fe){if(Je[et.route.id]?.type==="error")break;!Je.hasOwnProperty(et.route.id)&&!T.loaderData.hasOwnProperty(et.route.id)&&(!T.errors||!T.errors.hasOwnProperty(et.route.id))&&et.shouldCallHandler()&&(Je[et.route.id]={type:"error",result:new Error(`No result returned from dataStrategy for route ${et.route.id}`)})}for(let[et,tt]of Object.entries(Je))if(JH(tt)){let dt=tt.result;Xe[et]={type:"redirect",response:YH(dt,te,et,fe,d)}}else Xe[et]=await qH(tt);return Xe}async function ue(te,ae,fe,Ae,ze){let Je=de(fe,Ae,te,ze,null),Xe=Promise.all(ae.map(async dt=>{if(dt.matches&&dt.match&&dt.request&&dt.controller){let Ft=(await de(dt.request,dt.path,dt.matches,ze,dt.key))[dt.match.route.id];return{[dt.key]:Ft}}else return Promise.resolve({[dt.key]:{type:"error",error:ci(404,{pathname:dt.path})}})})),et=await Je,tt=(await Xe).reduce((dt,mt)=>Object.assign(dt,mt),{});return{loaderResults:et,fetcherResults:tt}}function Se(){I=!0,X.forEach((te,ae)=>{Z.has(ae)&&Y.add(ae),Ce(ae)})}function Ue(te,ae,fe={}){let Ae=new Map(T.fetchers);Ae.set(te,ae),re({fetchers:Ae},{flushSync:(fe&&fe.flushSync)===!0})}function Ye(te,ae,fe,Ae={}){let ze=Ha(T.matches,ae),Je=new Map(T.fetchers);ie(Je,te),re({errors:{[ze.route.id]:fe},fetchers:Je},{flushSync:(Ae&&Ae.flushSync)===!0})}function kt(te){return J.set(te,(J.get(te)||0)+1),Q.has(te)&&Q.delete(te),T.fetchers.get(te)||AH}function ee(te,ae){Ce(te,ae?.reason),Ue(te,Ji(null))}function ie(te,ae){let fe=T.fetchers.get(ae);Z.has(ae)&&!(fe&&fe.state==="loading"&&U.has(ae))&&Ce(ae),X.delete(ae),U.delete(ae),B.delete(ae),Q.delete(ae),Y.delete(ae),te.delete(ae)}function le(te){let ae=(J.get(te)||0)-1;ae<=0?(J.delete(te),Q.add(te)):J.set(te,ae),re({fetchers:new Map(T.fetchers)})}function Ce(te,ae){let fe=Z.get(te);fe&&(fe.abort(ae),Z.delete(te))}function ve(te,ae){for(let fe of te){let Ae=ae.get(fe);Xt(Ae,`Expected fetcher: ${fe}`);let ze=Ji(Ae.data);ae.set(fe,ze)}}function Be(te){let ae=[],fe=!1;for(let Ae of B){let ze=te.get(Ae);Xt(ze,`Expected fetcher: ${Ae}`),ze.state==="loading"&&(B.delete(Ae),ae.push(Ae),fe=!0)}return ve(ae,te),fe}function Pe(te,ae){let fe=[];for(let[Ae,ze]of U)if(ze<te){let Je=ae.get(Ae);Xt(Je,`Expected fetcher: ${Ae}`),Je.state==="loading"&&(Ce(Ae),U.delete(Ae),fe.push(Ae))}return ve(fe,ae),fe.length>0}function qe(te,ae){let fe=T.blockers.get(te)||du;return oe.get(te)!==ae&&oe.set(te,ae),fe}function Ke(te){T.blockers.delete(te),oe.delete(te)}function nt(te,ae){let fe=T.blockers.get(te)||du;Xt(fe.state==="unblocked"&&ae.state==="blocked"||fe.state==="blocked"&&ae.state==="blocked"||fe.state==="blocked"&&ae.state==="proceeding"||fe.state==="blocked"&&ae.state==="unblocked"||fe.state==="proceeding"&&ae.state==="unblocked",`Invalid blocker state transition: ${fe.state} -> ${ae.state}`);let Ae=new Map(T.blockers);Ae.set(te,ae),re({blockers:Ae})}function it({currentLocation:te,nextLocation:ae,historyAction:fe}){if(oe.size===0)return;oe.size>1&&lr(!1,"A router only supports one blocker at a time");let Ae=Array.from(oe.entries()),[ze,Je]=Ae[Ae.length-1],Xe=T.blockers.get(ze);if(!(Xe&&Xe.state==="proceeding")&&Je({currentLocation:te,nextLocation:ae,historyAction:fe}))return ze}function jt(te){let ae=ci(404,{pathname:te}),fe=c.activeRoutes,{matches:Ae,route:ze}=bm(fe);return{notFoundMatches:Ae,route:ze,error:ae}}function Ut(te,ae,fe){if(v=te,w=ae,S=fe||null,!E&&T.navigation===i0){E=!0;let Ae=Rt(T.location,T.matches);Ae!=null&&re({restoreScrollPosition:Ae})}return()=>{v=null,w=null,S=null}}function qt(te,ae){return S&&S(te,ae.map(Ae=>B2(Ae,T.loaderData)))||te.key}function at(te,ae){if(v&&w){let fe=qt(te,ae);v[fe]=w()}}function Rt(te,ae){if(v){let fe=qt(te,ae),Ae=v[fe];if(typeof Ae=="number")return Ae}return null}function Gt(te,ae,fe){if(e.patchRoutesOnNavigation){let Ae=c.branches;if(te){if(Object.keys(te[0].params).length>0)return{active:!0,matches:ji(ae,fe,d,!0,Ae)}}else return{active:!0,matches:ji(ae,fe,d,!0,Ae)||[]}}return{active:!1,matches:null}}async function Nt(te,ae,fe,Ae){if(!e.patchRoutesOnNavigation)return{type:"success",matches:te};let ze=te;for(;;){let Je=s;try{await e.patchRoutesOnNavigation({signal:fe,path:ae,matches:ze,fetcherKey:Ae,patch:(dt,mt)=>{fe.aborted||hN(dt,mt,c,Je,i,!1)}})}catch(dt){return{type:"error",error:dt,partialMatches:ze}}if(fe.aborted)return{type:"aborted"};let Xe=c.branches,et=ji(c.activeRoutes,ae,d,!1,Xe),tt=null;if(et){if(Object.keys(et[0].params).length===0)return{type:"success",matches:et};if(tt=ji(c.activeRoutes,ae,d,!0,Xe),!(tt&&ze.length<tt.length&&Qn(ze,tt.slice(0,ze.length))))return{type:"success",matches:et}}if(tt||(tt=ji(c.activeRoutes,ae,d,!0,Xe)),!tt||Qn(ze,tt))return{type:"success",matches:null};ze=tt}}function Qn(te,ae){return te.length===ae.length&&te.every((fe,Ae)=>fe.route.id===ae[Ae].route.id)}function hn(te){s={},c.setHmrRoutes(Kf(te,i,void 0,s))}function In(te,ae,fe=!1){hN(te,ae,c,s,i,fe),c.hasHMRRoutes||re({})}return M={get basename(){return d},get future(){return p},get state(){return T},get routes(){return c.stableRoutes},get branches(){return c.branches},get manifest(){return s},get window(){return t},initialize:je,subscribe:pe,enableScrollRestoration:Ut,navigate:_e,fetch:Ge,revalidate:De,createHref:te=>e.history.createHref(te),encodeLocation:te=>e.history.encodeLocation(te),getFetcher:kt,resetFetcher:ee,deleteFetcher:le,dispose:Ee,getBlocker:qe,deleteBlocker:Ke,patchRoutes:In,_internalFetchControllers:Z,_internalSetRoutes:hn,_internalSetStateDoNotUseOrYouWillBreakYourApp(te){re(te)}},e.instrumentations&&(M=EH(M,e.instrumentations.map(te=>te.router).filter(Boolean))),M}function IH(e){return e!=null&&("formData"in e&&e.formData!=null||"body"in e&&e.body!==void 0)}function Cw(e,t,n,r,o,i){let s,c;if(o){s=[];for(let u of t)if(s.push(u),u.route.id===o){c=u;break}}else s=t,c=t[t.length-1];let d=Eh(r||".",_y(s),Co(e.pathname,n)||e.pathname,i==="path");if(r==null&&(d.search=e.search,d.hash=e.hash),(r==null||r===""||r===".")&&c){let u=fE(d.search);if(c.route.index&&!u)d.search=d.search?d.search.replace(/^\?/,"?index&"):"?index";else if(!c.route.index&&u){let p=new URLSearchParams(d.search),m=p.getAll("index");p.delete("index"),m.filter(y=>y).forEach(y=>p.append("index",y));let g=p.toString();d.search=g?`?${g}`:""}}return n!=="/"&&(d.pathname=gH({basename:n,pathname:d.pathname})),ds(d)}function dN(e,t,n){if(!n||!IH(n))return{path:t};if(n.formMethod&&!nU(n.formMethod))return{path:t,error:ci(405,{method:n.formMethod})};let r=()=>({path:t,error:ci(400,{type:"invalid-body"})}),i=(n.formMethod||"get").toUpperCase(),s=lD(t);if(n.body!==void 0){if(n.formEncType==="text/plain"){if(!Wr(i))return r();let m=typeof n.body=="string"?n.body:n.body instanceof FormData||n.body instanceof URLSearchParams?Array.from(n.body.entries()).reduce((g,[y,v])=>`${g}${y}=${v}
10
+ `,""):String(n.body);return{path:t,submission:{formMethod:i,formAction:s,formEncType:n.formEncType,formData:void 0,json:void 0,text:m}}}else if(n.formEncType==="application/json"){if(!Wr(i))return r();try{let m=typeof n.body=="string"?JSON.parse(n.body):n.body;return{path:t,submission:{formMethod:i,formAction:s,formEncType:n.formEncType,formData:void 0,json:m,text:void 0}}}catch{return r()}}}Xt(typeof FormData=="function","FormData is not available in this environment");let c,d;if(n.formData)c=Rw(n.formData),d=n.formData;else if(n.body instanceof FormData)c=Rw(n.body),d=n.body;else if(n.body instanceof URLSearchParams)c=n.body,d=xN(c);else if(n.body==null)c=new URLSearchParams,d=new FormData;else try{c=new URLSearchParams(n.body),d=xN(c)}catch{return r()}let u={formMethod:i,formAction:s,formEncType:n&&n.formEncType||"application/x-www-form-urlencoded",formData:d,json:void 0,text:void 0};if(Wr(u.formMethod))return{path:t,submission:u};let p=hs(t);return e&&p.search&&fE(p.search)&&c.append("index",""),p.search=`?${c}`,{path:ds(p),submission:u}}function fN(e,t,n,r,o,i,s,c,d,u,p,m,g,y,v,S,w,E,k,j,N,A){let R=N?Uo(N[1])?N[1].error:N[1].data:void 0,M=o.createURL(i.location),T=o.createURL(d),O;if(p&&i.errors){let P=Object.keys(i.errors)[0];O=s.findIndex(I=>I.route.id===P)}else if(N&&Uo(N[1])){let P=N[0];O=s.findIndex(I=>I.route.id===P)-1}let z=N?N[1].statusCode:void 0,q=z&&z>=400,$={currentUrl:M,currentParams:i.matches[0]?.params||{},nextUrl:T,nextParams:s[0].params,...c,actionResult:R,actionStatus:z},G=kh(s),L=s.map((P,I)=>{let{route:Y}=P,Z=null;if(O!=null&&I>O)Z=!1;else if(Y.lazy)Z=!0;else if(!uE(Y))Z=!1;else if(p){let{shouldLoad:B}=tD(Y,i.loaderData,i.errors);Z=B}else zH(i.loaderData,i.matches[I],P)&&(Z=!0);if(Z!==null)return kw(n,r,e,d,G,P,u,t,Z);let D=!1;typeof A=="boolean"?D=A:q?D=!1:(m||M.pathname+M.search===T.pathname+T.search||M.search!==T.search||LH(i.matches[I],P))&&(D=!0);let H={...$,defaultShouldRevalidate:D},U=Pf(P,H);return kw(n,r,e,d,G,P,u,t,U,H,A)}),F=[];return v.forEach((P,I)=>{if(p||!s.some(J=>J.route.id===P.routeId)||y.has(I))return;let Y=i.fetchers.get(I),Z=Y&&Y.state!=="idle"&&Y.data===void 0,D=ji(w,P.path,E??"/",!1,j);if(!D){if(k&&Z)return;F.push({key:I,routeId:P.routeId,path:P.path,matches:null,match:null,request:null,controller:null});return}if(S.has(I))return;let H=fg(D,P.path),U=new AbortController,B=pu(o,P.path,U.signal),X=null;if(g.has(I))g.delete(I),X=Eu(n,r,B,P.path,D,H,u,t);else if(Z)m&&(X=Eu(n,r,B,P.path,D,H,u,t));else{let J;typeof A=="boolean"?J=A:q?J=!1:J=m;let Q={...$,defaultShouldRevalidate:J};Pf(H,Q)&&(X=Eu(n,r,B,P.path,D,H,u,t,Q))}X&&F.push({key:I,routeId:P.routeId,path:P.path,matches:X,match:H,request:B,controller:U})}),{dsMatches:L,revalidatingFetchers:F}}function uE(e){return e.loader!=null||e.middleware!=null&&e.middleware.length>0}function tD(e,t,n){if(e.lazy)return{shouldLoad:!0,renderFallback:!0};if(!uE(e))return{shouldLoad:!1,renderFallback:!1};let r=t!=null&&e.id in t,o=n!=null&&n[e.id]!==void 0;if(!r&&o)return{shouldLoad:!1,renderFallback:!1};if(typeof e.loader=="function"&&e.loader.hydrate===!0)return{shouldLoad:!0,renderFallback:!r};let i=!r&&!o;return{shouldLoad:i,renderFallback:i}}function zH(e,t,n){let r=!t||n.route.id!==t.route.id,o=!e.hasOwnProperty(n.route.id);return r||o}function LH(e,t){let n=e.route.path;return e.pathname!==t.pathname||n!=null&&n.endsWith("*")&&e.params["*"]!==t.params["*"]}function Pf(e,t){if(e.route.shouldRevalidate){let n=e.route.shouldRevalidate(t);if(typeof n=="boolean")return n}return t.defaultShouldRevalidate}function hN(e,t,n,r,o,i){let s;if(e){let u=r[e];Xt(u,`No route found to patch children into: routeId = ${e}`),u.children||(u.children=[]),s=u.children}else s=n.activeRoutes;let c=[],d=[];if(t.forEach(u=>{let p=s.find(m=>nD(u,m));p?d.push({existingRoute:p,newRoute:u}):c.push(u)}),c.length>0){let u=Kf(c,o,[e||"_","patch",String(s?.length||"0")],r);s.push(...u)}if(i&&d.length>0)for(let u=0;u<d.length;u++){let{existingRoute:p,newRoute:m}=d[u],g=p,[y]=Kf([m],o,[],{},!0);Object.assign(g,{element:y.element?y.element:g.element,errorElement:y.errorElement?y.errorElement:g.errorElement,hydrateFallbackElement:y.hydrateFallbackElement?y.hydrateFallbackElement:g.hydrateFallbackElement})}n.hasHMRRoutes||n.setRoutes([...n.activeRoutes])}function nD(e,t){return"id"in e&&"id"in t&&e.id===t.id?!0:e.index===t.index&&e.path===t.path&&e.caseSensitive===t.caseSensitive?(!e.children||e.children.length===0)&&(!t.children||t.children.length===0)?!0:e.children?.every((n,r)=>t.children?.some(o=>nD(n,o)))??!1:!1}var pN=new WeakMap,rD=({key:e,route:t,manifest:n,mapRouteProperties:r})=>{let o=n[t.id];if(Xt(o,"No route found in manifest"),!o.lazy||typeof o.lazy!="object")return;let i=o.lazy[e];if(!i)return;let s=pN.get(o);s||(s={},pN.set(o,s));let c=s[e];if(c)return c;let d=(async()=>{let u=tH(e),m=o[e]!==void 0&&e!=="hasErrorBoundary";if(u)lr(!u,"Route property "+e+" is not a supported lazy route property. This property will be ignored."),s[e]=Promise.resolve();else if(m)lr(!1,`Route "${o.id}" has a static property "${e}" defined. The lazy property will be ignored.`);else{let g=await i();g!=null&&(Object.assign(o,{[e]:g}),Object.assign(o,r(o)))}typeof o.lazy=="object"&&(o.lazy[e]=void 0,Object.values(o.lazy).every(g=>g===void 0)&&(o.lazy=void 0))})();return s[e]=d,d},mN=new WeakMap;function FH(e,t,n,r,o){let i=n[e.id];if(Xt(i,"No route found in manifest"),!e.lazy)return{lazyRoutePromise:void 0,lazyHandlerPromise:void 0};if(typeof e.lazy=="function"){let p=mN.get(i);if(p)return{lazyRoutePromise:p,lazyHandlerPromise:p};let m=(async()=>{Xt(typeof e.lazy=="function","No lazy route function found");let g=await e.lazy(),y={};for(let v in g){let S=g[v];if(S===void 0)continue;let w=rH(v),k=i[v]!==void 0&&v!=="hasErrorBoundary";w?lr(!w,"Route property "+v+" is not a supported property to be returned from a lazy route function. This property will be ignored."):k?lr(!k,`Route "${i.id}" has a static property "${v}" defined but its lazy function is also returning a value for this property. The lazy route property "${v}" will be ignored.`):y[v]=S}Object.assign(i,y),Object.assign(i,{...r(i),lazy:void 0})})();return mN.set(i,m),m.catch(()=>{}),{lazyRoutePromise:m,lazyHandlerPromise:m}}let s=Object.keys(e.lazy),c=[],d;for(let p of s){if(o&&o.includes(p))continue;let m=rD({key:p,route:e,manifest:n,mapRouteProperties:r});m&&(c.push(m),p===t&&(d=m))}let u=c.length>0?Promise.all(c).then(()=>{}):void 0;return u?.catch(()=>{}),d?.catch(()=>{}),{lazyRoutePromise:u,lazyHandlerPromise:d}}async function gN(e){let t=e.matches.filter(o=>o.shouldLoad),n={};return(await Promise.all(t.map(o=>o.resolve()))).forEach((o,i)=>{n[t[i].route.id]=o}),n}async function $H(e){return e.matches.some(t=>t.route.middleware)?oD(e,()=>gN(e)):gN(e)}function oD(e,t){return VH(e,t,r=>{if(tU(r))throw r;return r},QH,n);function n(r,o,i){if(i)return Promise.resolve(Object.assign(i.value,{[o]:{type:"error",result:r}}));{let{matches:s}=e,c=Math.min(Math.max(s.findIndex(u=>u.route.id===o),0),Math.max(s.findIndex(u=>u.shouldCallHandler()),0)),d=Ha(s,s[c].route.id).route.id;return Promise.resolve({[d]:{type:"error",result:r}})}}}async function VH(e,t,n,r,o){let{matches:i,...s}=e,c=i.flatMap(u=>u.route.middleware?u.route.middleware.map(p=>[u.route.id,p]):[]);return await iD(s,c,t,n,r,o)}async function iD(e,t,n,r,o,i,s=0){let{request:c}=e;if(c.signal.aborted)throw c.signal.reason??new Error(`Request aborted: ${c.method} ${c.url}`);let d=t[s];if(!d)return await n();let[u,p]=d,m,g=async()=>{if(m)throw new Error("You may only call `next()` once per middleware");try{return m={value:await iD(e,t,n,r,o,i,s+1)},m.value}catch(y){return m={value:await i(y,u,m)},m.value}};try{let y=await p(e,g),v=y!=null?r(y):void 0;return o(v)?v:m?v??m.value:(m={value:await g()},m.value)}catch(y){return await i(y,u,m)}}function sD(e,t,n,r,o){let i=rD({key:"middleware",route:r.route,manifest:t,mapRouteProperties:e}),s=FH(r.route,Wr(n.method)?"action":"loader",t,e,o);return{middleware:i,route:s.lazyRoutePromise,handler:s.lazyHandlerPromise}}function kw(e,t,n,r,o,i,s,c,d,u=null,p){let m=!1,g=sD(e,t,n,i,s);return{...i,_lazyPromises:g,shouldLoad:d,shouldRevalidateArgs:u,shouldCallHandler(y){return m=!0,u?typeof p=="boolean"?Pf(i,{...u,defaultShouldRevalidate:p}):typeof y=="boolean"?Pf(i,{...u,defaultShouldRevalidate:y}):Pf(i,u):d},resolve(y){let{lazy:v,loader:S,middleware:w}=i.route,E=m||d||y&&!Wr(n.method)&&(v||S),k=w&&w.length>0&&!S&&!v;return E&&(Wr(n.method)||!k)?HH({request:n,path:r,pattern:o,match:i,lazyHandlerPromise:g?.handler,lazyRoutePromise:g?.route,handlerOverride:y,scopedContext:c}):Promise.resolve({type:"data",result:void 0})}}}function Eu(e,t,n,r,o,i,s,c,d=null){return o.map(u=>u.route.id!==i.route.id?{...u,shouldLoad:!1,shouldRevalidateArgs:d,shouldCallHandler:()=>!1,_lazyPromises:sD(e,t,n,u,s),resolve:()=>Promise.resolve({type:"data",result:void 0})}:kw(e,t,n,r,kh(o),u,s,c,!0,d))}async function BH(e,t,n,r,o,i,s){r.some(p=>p._lazyPromises?.middleware)&&await Promise.all(r.map(p=>p._lazyPromises?.middleware));let c={request:t,url:aD(t,n),pattern:kh(r),params:r[0].params,context:i,matches:r},u=await e({...c,fetcherKey:o,runClientMiddleware:p=>{let m=c;return oD(m,()=>p({...m,fetcherKey:o,runClientMiddleware:()=>{throw new Error("Cannot call `runClientMiddleware()` from within an `runClientMiddleware` handler")}}))}});try{await Promise.all(r.flatMap(p=>[p._lazyPromises?.handler,p._lazyPromises?.route]))}catch{}return u}async function HH({request:e,path:t,pattern:n,match:r,lazyHandlerPromise:o,lazyRoutePromise:i,handlerOverride:s,scopedContext:c}){let d,u,p=Wr(e.method),m=p?"action":"loader",g=y=>{let v,S=new Promise((k,j)=>v=j);u=()=>v(),e.signal.addEventListener("abort",u);let w=k=>typeof y!="function"?Promise.reject(new Error(`You cannot call the handler for a route which defines a boolean "${m}" [routeId: ${r.route.id}]`)):y({request:e,url:aD(e,t),pattern:n,params:r.params,context:c},...k!==void 0?[k]:[]),E=(async()=>{try{return{type:"data",result:await(s?s(j=>w(j)):w())}}catch(k){return{type:"error",result:k}}})();return Promise.race([E,S])};try{let y=p?r.route.action:r.route.loader;if(o||i)if(y){let v,[S]=await Promise.all([g(y).catch(w=>{v=w}),o,i]);if(v!==void 0)throw v;d=S}else{await o;let v=p?r.route.action:r.route.loader;if(v)[d]=await Promise.all([g(v),i]);else if(m==="action"){let S=new URL(e.url),w=S.pathname+S.search;throw ci(405,{method:e.method,pathname:w,routeId:r.route.id})}else return{type:"data",result:void 0}}else if(y)d=await g(y);else{let v=new URL(e.url),S=v.pathname+v.search;throw ci(404,{pathname:S})}}catch(y){return{type:"error",result:y}}finally{u&&e.signal.removeEventListener("abort",u)}return d}async function UH(e){let t=e.headers.get("Content-Type");return t&&/\bapplication\/json\b/.test(t)?e.body==null?null:e.json():e.text()}async function qH(e){let{result:t,type:n}=e;if(dE(t)){let r;try{r=await UH(t)}catch(o){return{type:"error",error:o}}return n==="error"?{type:"error",error:new Ch(t.status,t.statusText,r),statusCode:t.status,headers:t.headers}:{type:"data",data:r,statusCode:t.status,headers:t.headers}}return n==="error"?SN(t)?t.data instanceof Error?{type:"error",error:t.data,statusCode:t.init?.status,headers:t.init?.headers?new Headers(t.init.headers):void 0}:{type:"error",error:XH(t),statusCode:Xf(t)?t.status:void 0,headers:t.init?.headers?new Headers(t.init.headers):void 0}:{type:"error",error:t,statusCode:Xf(t)?t.status:void 0}:SN(t)?{type:"data",data:t.data,statusCode:t.init?.status,headers:t.init?.headers?new Headers(t.init.headers):void 0}:{type:"data",data:t}}function YH(e,t,n,r,o){let i=e.headers.get("Location");if(Xt(i,"Redirects returned/thrown from loaders/actions must have a Location header"),!lE(i)){let s=r.slice(0,r.findIndex(c=>c.route.id===n)+1);i=Cw(new URL(t.url),s,o,i),e.headers.set("Location",i)}return e}var ZH=["about:","blob:","chrome:","chrome-untrusted:","content:","data:","devtools:","file:","filesystem:","javascript:"];function jw(e){try{return ZH.includes(new URL(e).protocol)}catch{return!1}}function yN(e,t,n,r){if(lE(e)){let o=e,i=aE.test(o)?new URL(F2(o,t.protocol)):new URL(o);if(jw(i.toString()))throw new Error("Invalid redirect location");let s=Co(i.pathname,n)!=null;if(i.origin===t.origin&&s)return cE(i.pathname)+i.search+i.hash}try{let o=r.createURL(e);if(jw(o.toString()))throw new Error("Invalid redirect location")}catch{}return e}function pu(e,t,n,r){let o=e.createURL(lD(t)).toString(),i={signal:n};if(r&&Wr(r.formMethod)){let{formMethod:s,formEncType:c}=r;i.method=s.toUpperCase(),c==="application/json"?(i.headers=new Headers({"Content-Type":c}),i.body=JSON.stringify(r.json)):c==="text/plain"?i.body=r.text:c==="application/x-www-form-urlencoded"&&r.formData?i.body=Rw(r.formData):i.body=r.formData}return new Request(o,i)}function aD(e,t){let n=new URL(e.url),r=typeof t=="string"?hs(t):t;if(n.pathname=r.pathname||"/",r.search){let o=new URLSearchParams(r.search),i=o.getAll("index");o.delete("index");for(let s of i.filter(Boolean))o.append("index",s);n.search=o.size?`?${o.toString()}`:""}else n.search="";return n.hash=r.hash||"",n}function Rw(e){let t=new URLSearchParams;for(let[n,r]of e.entries())t.append(n,typeof r=="string"?r:r.name);return t}function xN(e){let t=new FormData;for(let[n,r]of e.entries())t.append(n,r);return t}function GH(e,t,n,r=!1,o=!1){let i={},s=null,c,d=!1,u={},p=n&&Uo(n[1])?n[1].error:void 0;return e.forEach(m=>{if(!(m.route.id in t))return;let g=m.route.id,y=t[g];if(Xt(!$l(y),"Cannot handle redirect results in processLoaderData"),Uo(y)){let v=y.error;if(p!==void 0&&(v=p,p=void 0),s=s||{},o)s[g]=v;else{let S=Ha(e,g);s[S.route.id]==null&&(s[S.route.id]=v)}r||(i[g]=eD),d||(d=!0,c=Xf(y.error)?y.error.status:500),y.headers&&(u[g]=y.headers)}else i[g]=y.data,y.statusCode&&y.statusCode!==200&&!d&&(c=y.statusCode),y.headers&&(u[g]=y.headers)}),p!==void 0&&n&&(s={[n[0]]:p},n[2]&&(i[n[2]]=void 0)),{loaderData:i,errors:s,statusCode:c||200,loaderHeaders:u}}function vN(e,t,n,r,o,i,s){let{loaderData:c,errors:d}=GH(t,n,r);return o.filter(u=>!u.matches||u.matches.some(p=>p.shouldLoad)).forEach(u=>{let{key:p,match:m,controller:g}=u;if(g&&g.signal.aborted)return;let y=i[p];if(Xt(y,"Did not find corresponding fetcher result"),Uo(y)){let v=Ha(e.matches,m?.route.id);d&&d[v.route.id]||(d={...d,[v.route.id]:y.error}),s.delete(p)}else if($l(y))Xt(!1,"Unhandled fetcher revalidation redirect");else{let v=Ji(y.data);s.set(p,v)}}),{loaderData:c,errors:d}}function bN(e,t,n,r){let o=Object.entries(t).filter(([,i])=>i!==eD).reduce((i,[s,c])=>(i[s]=c,i),{});for(let i of n){let s=i.route.id;if(!t.hasOwnProperty(s)&&e.hasOwnProperty(s)&&i.route.loader&&(o[s]=e[s]),r&&r.hasOwnProperty(s))break}return o}function wN(e){return e?Uo(e[1])?{actionData:{}}:{actionData:{[e[0]]:e[1].data}}:{}}function Ha(e,t){return(t?e.slice(0,e.findIndex(r=>r.route.id===t)+1):[...e]).reverse().find(r=>r.route.hasErrorBoundary===!0)||e[0]}function bm(e){let t=e.length===1?e[0]:e.find(n=>n.index||!n.path||n.path==="/")||{id:"__shim-error-route__"};return{matches:[{params:{},pathname:"",pathnameBase:"",route:t}],route:t}}function ci(e,{pathname:t,routeId:n,method:r,type:o,message:i}={}){let s="Unknown Server Error",c="Unknown @remix-run/router error";return e===400?(s="Bad Request",r&&t&&n?c=`You made a ${r} request to "${t}" but did not provide a \`loader\` for route "${n}", so there is no way to handle the request.`:o==="invalid-body"&&(c="Unable to encode submission body")):e===403?(s="Forbidden",c=`Route "${n}" does not match URL "${t}"`):e===404?(s="Not Found",c=`No route matches URL "${t}"`):e===405&&(s="Method Not Allowed",r&&t&&n?c=`You made a ${r.toUpperCase()} request to "${t}" but did not provide an \`action\` for route "${n}", so there is no way to handle the request.`:r&&(c=`Invalid request method "${r.toUpperCase()}"`)),new Ch(e||500,s,new Error(c),!0)}function wm(e){let t=Object.entries(e);for(let n=t.length-1;n>=0;n--){let[r,o]=t[n];if($l(o))return{key:r,result:o}}}function lD(e){let t=typeof e=="string"?hs(e):e;return ds({...t,hash:""})}function KH(e,t){return e.pathname!==t.pathname||e.search!==t.search?!1:e.hash===""?t.hash!=="":e.hash===t.hash?!0:t.hash!==""}function XH(e){return new Ch(e.init?.status??500,e.init?.statusText??"Internal Server Error",e.data)}function QH(e){return e!=null&&typeof e=="object"&&Object.entries(e).every(([t,n])=>typeof t=="string"&&WH(n))}function WH(e){return e!=null&&typeof e=="object"&&"type"in e&&"result"in e&&(e.type==="data"||e.type==="error")}function JH(e){return dE(e.result)&&W2.has(e.result.status)}function Uo(e){return e.type==="error"}function $l(e){return(e&&e.type)==="redirect"}function SN(e){return typeof e=="object"&&e!=null&&"type"in e&&"data"in e&&"init"in e&&e.type==="DataWithResponseInit"}function dE(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.headers=="object"&&typeof e.body<"u"}function eU(e){return W2.has(e)}function tU(e){return dE(e)&&eU(e.status)&&e.headers.has("Location")}function nU(e){return TH.has(e.toUpperCase())}function Wr(e){return _H.has(e.toUpperCase())}function fE(e){return new URLSearchParams(e).getAll("index").some(t=>t==="")}function fg(e,t){let n=typeof t=="string"?hs(t).search:t.search;if(e[e.length-1].route.index&&fE(n||""))return e[e.length-1];let r=Z2(e);return r[r.length-1]}function EN(e){let{formMethod:t,formAction:n,formEncType:r,text:o,formData:i,json:s}=e;if(!(!t||!n||!r)){if(o!=null)return{formMethod:t,formAction:n,formEncType:r,formData:void 0,json:void 0,text:o};if(i!=null)return{formMethod:t,formAction:n,formEncType:r,formData:i,json:void 0,text:void 0};if(s!==void 0)return{formMethod:t,formAction:n,formEncType:r,formData:void 0,json:s,text:void 0}}}function s0(e,t,n,r){return r?{state:"loading",location:e,matches:t,historyAction:n,formMethod:r.formMethod,formAction:r.formAction,formEncType:r.formEncType,formData:r.formData,json:r.json,text:r.text}:{state:"loading",location:e,matches:t,historyAction:n,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0}}function rU(e,t,n,r){return{state:"submitting",location:e,matches:t,historyAction:n,formMethod:r.formMethod,formAction:r.formAction,formEncType:r.formEncType,formData:r.formData,json:r.json,text:r.text}}function lf(e,t){return e?{state:"loading",formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:t}:{state:"loading",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:t}}function oU(e,t){return{state:"submitting",formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:t?t.data:void 0}}function Ji(e){return{state:"idle",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:e}}function iU(e,t){try{let n=e.sessionStorage.getItem(J2);if(n){let r=JSON.parse(n);for(let[o,i]of Object.entries(r||{}))i&&Array.isArray(i)&&t.set(o,new Set(i||[]))}}catch{}}function sU(e,t){if(t.size>0){let n={};for(let[r,o]of t)n[r]=[...o];try{e.sessionStorage.setItem(J2,JSON.stringify(n))}catch(r){lr(!1,`Failed to save applied view transitions in sessionStorage (${r}).`)}}}function CN(){let e,t,n=new Promise((r,o)=>{e=async i=>{r(i);try{await n}catch{}},t=async i=>{o(i);try{await n}catch{}}});return{promise:n,resolve:e,reject:t}}var fc=b.createContext(null);fc.displayName="DataRouter";var jh=b.createContext(null);jh.displayName="DataRouterState";var cD=b.createContext(!1);function uD(){return b.useContext(cD)}var hE=b.createContext({isTransitioning:!1});hE.displayName="ViewTransition";var dD=b.createContext(new Map);dD.displayName="Fetchers";var aU=b.createContext(null);aU.displayName="Await";var Qo=b.createContext(null);Qo.displayName="Navigation";var Ny=b.createContext(null);Ny.displayName="Location";var yi=b.createContext({outlet:null,matches:[],isDataRoute:!1});yi.displayName="Route";var pE=b.createContext(null);pE.displayName="RouteError";var fD="REACT_ROUTER_ERROR",lU="REDIRECT",cU="ROUTE_ERROR_RESPONSE";function uU(e){if(e.startsWith(`${fD}:${lU}:{`))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 dU(e){if(e.startsWith(`${fD}:${cU}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new Ch(t.status,t.statusText,t.data)}catch{}}function fU(e,{relative:t}={}){Xt(Qu(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:r}=b.useContext(Qo),{hash:o,pathname:i,search:s}=Rh(e,{relative:t}),c=i;return n!=="/"&&(c=i==="/"?n:hi([n,i])),r.createHref({pathname:c,search:s,hash:o})}function Qu(){return b.useContext(Ny)!=null}function Wo(){return Xt(Qu(),"useLocation() may be used only in the context of a <Router> component."),b.useContext(Ny).location}var hD="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function pD(e){b.useContext(Qo).static||b.useLayoutEffect(e)}function ko(){let{isDataRoute:e}=b.useContext(yi);return e?_U():hU()}function hU(){Xt(Qu(),"useNavigate() may be used only in the context of a <Router> component.");let e=b.useContext(fc),{basename:t,navigator:n}=b.useContext(Qo),{matches:r}=b.useContext(yi),{pathname:o}=Wo(),i=JSON.stringify(_y(r)),s=b.useRef(!1);return pD(()=>{s.current=!0}),b.useCallback((d,u={})=>{if(lr(s.current,hD),!s.current)return;if(typeof d=="number"){n.go(d);return}let p=Eh(d,JSON.parse(i),o,u.relative==="path");e==null&&t!=="/"&&(p.pathname=p.pathname==="/"?t:hi([t,p.pathname])),(u.replace?n.replace:n.push)(p,u.state,u)},[t,n,i,o,e])}var pU=b.createContext(null);function mU(e){let t=b.useContext(yi).outlet;return b.useMemo(()=>t&&b.createElement(pU.Provider,{value:e},t),[t,e])}function Wu(){let{matches:e}=b.useContext(yi);return e[e.length-1]?.params??{}}function Rh(e,{relative:t}={}){let{matches:n}=b.useContext(yi),{pathname:r}=Wo(),o=JSON.stringify(_y(n));return b.useMemo(()=>Eh(e,JSON.parse(o),r,t==="path"),[e,o,r,t])}function gU(e,t,n){Xt(Qu(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:r}=b.useContext(Qo),{matches:o}=b.useContext(yi),i=o[o.length-1],s=i?i.params:{},c=i?i.pathname:"/",d=i?i.pathnameBase:"/",u=i&&i.route;{let w=u&&u.path||"";yD(c,!u||w.endsWith("*")||w.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${c}" (under <Route path="${w}">) 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.
11
+
12
+ Please change the parent <Route path="${w}"> to <Route path="${w==="/"?"*":`${w}/*`}">.`)}let p=Wo(),m;m=p;let g=m.pathname||"/",y=g;if(d!=="/"){let w=d.replace(/^\//,"").split("/");y="/"+g.replace(/^\//,"").split("/").slice(w.length).join("/")}let v=n&&n.state.matches.length?n.state.matches.map(w=>Object.assign(w,{route:n.manifest[w.route.id]||w.route})):V2(e,{pathname:y});return lr(u||v!=null,`No routes matched location "${m.pathname}${m.search}${m.hash}" `),lr(v==null||v[v.length-1].route.element!==void 0||v[v.length-1].route.Component!==void 0||v[v.length-1].route.lazy!==void 0,`Matched leaf route at location "${m.pathname}${m.search}${m.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.`),wU(v&&v.map(w=>Object.assign({},w,{params:Object.assign({},s,w.params),pathname:hi([d,r.encodeLocation?r.encodeLocation(w.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:w.pathname]),pathnameBase:w.pathnameBase==="/"?d:hi([d,r.encodeLocation?r.encodeLocation(w.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:w.pathnameBase])})),o,n)}function yU(){let e=kU(),t=Xf(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)",o={padding:"0.5rem",backgroundColor:r},i={padding:"2px 4px",backgroundColor:r},s=null;return console.error("Error handled by React Router default ErrorBoundary:",e),s=b.createElement(b.Fragment,null,b.createElement("p",null,"💿 Hey developer 👋"),b.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",b.createElement("code",{style:i},"ErrorBoundary")," or"," ",b.createElement("code",{style:i},"errorElement")," prop on your route.")),b.createElement(b.Fragment,null,b.createElement("h2",null,"Unexpected Application Error!"),b.createElement("h3",{style:{fontStyle:"italic"}},t),n?b.createElement("pre",{style:o},n):null,s)}var xU=b.createElement(yU,null),mD=class extends b.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=dU(e.digest);n&&(e=n)}let t=e!==void 0?b.createElement(yi.Provider,{value:this.props.routeContext},b.createElement(pE.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?b.createElement(vU,{error:e},t):t}};mD.contextType=cD;var a0=new WeakMap;function vU({children:e,error:t}){let{basename:n}=b.useContext(Qo);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let r=uU(t.digest);if(r){let o=a0.get(t);if(o)throw o;let i=K2(r.location,n),s=i.absoluteURL||i.to;if(jw(s))throw new Error("Invalid redirect location");if(G2&&!a0.get(t))if(i.isExternal||r.reloadDocument)window.location.href=s;else{const c=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(i.to,{replace:r.replace}));throw a0.set(t,c),c}return b.createElement("meta",{httpEquiv:"refresh",content:`0;url=${s}`})}}return e}function bU({routeContext:e,match:t,children:n}){let r=b.useContext(fc);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),b.createElement(yi.Provider,{value:e},n)}function wU(e,t=[],n){let r=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 o=e,i=r?.errors;if(i!=null){let p=o.findIndex(m=>m.route.id&&i?.[m.route.id]!==void 0);Xt(p>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(i).join(",")}`),o=o.slice(0,Math.min(o.length,p+1))}let s=!1,c=-1;if(n&&r){s=r.renderFallback;for(let p=0;p<o.length;p++){let m=o[p];if((m.route.HydrateFallback||m.route.hydrateFallbackElement)&&(c=p),m.route.id){let{loaderData:g,errors:y}=r,v=m.route.loader&&!g.hasOwnProperty(m.route.id)&&(!y||y[m.route.id]===void 0);if(m.route.lazy||v){n.isStatic&&(s=!0),c>=0?o=o.slice(0,c+1):o=[o[0]];break}}}}let d=n?.onError,u=r&&d?(p,m)=>{d(p,{location:r.location,params:r.matches?.[0]?.params??{},pattern:kh(r.matches),errorInfo:m})}:void 0;return o.reduceRight((p,m,g)=>{let y,v=!1,S=null,w=null;r&&(y=i&&m.route.id?i[m.route.id]:void 0,S=m.route.errorElement||xU,s&&(c<0&&g===0?(yD("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),v=!0,w=null):c===g&&(v=!0,w=m.route.hydrateFallbackElement||null)));let E=t.concat(o.slice(0,g+1)),k=()=>{let j;return y?j=S:v?j=w:m.route.Component?j=b.createElement(m.route.Component,null):m.route.element?j=m.route.element:j=p,b.createElement(bU,{match:m,routeContext:{outlet:p,matches:E,isDataRoute:r!=null},children:j})};return r&&(m.route.ErrorBoundary||m.route.errorElement||g===0)?b.createElement(mD,{location:r.location,revalidation:r.revalidation,component:S,error:y,children:k(),routeContext:{outlet:null,matches:E,isDataRoute:!0},onError:u}):k()},null)}function mE(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function gD(e){let t=b.useContext(fc);return Xt(t,mE(e)),t}function gE(e){let t=b.useContext(jh);return Xt(t,mE(e)),t}function SU(e){let t=b.useContext(yi);return Xt(t,mE(e)),t}function yE(e){let t=SU(e),n=t.matches[t.matches.length-1];return Xt(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function EU(){return yE("useRouteId")}function CU(){let{matches:e,loaderData:t}=gE("useMatches");return b.useMemo(()=>e.map(n=>B2(n,t)),[e,t])}function kU(){let e=b.useContext(pE),t=gE("useRouteError"),n=yE("useRouteError");return e!==void 0?e:t.errors?.[n]}var jU=0;function RU(e){let{router:t,basename:n}=gD("useBlocker"),r=gE("useBlocker"),[o,i]=b.useState(""),s=b.useCallback(c=>{if(typeof e!="function")return!!e;if(n==="/")return e(c);let{currentLocation:d,nextLocation:u,historyAction:p}=c;return e({currentLocation:{...d,pathname:Co(d.pathname,n)||d.pathname},nextLocation:{...u,pathname:Co(u.pathname,n)||u.pathname},historyAction:p})},[n,e]);return b.useEffect(()=>{let c=String(++jU);return i(c),()=>t.deleteBlocker(c)},[t]),b.useEffect(()=>{o!==""&&t.getBlocker(o,s)},[t,o,s]),o&&r.blockers.has(o)?r.blockers.get(o):du}function _U(){let{router:e}=gD("useNavigate"),t=yE("useNavigate"),n=b.useRef(!1);return pD(()=>{n.current=!0}),b.useCallback(async(o,i={})=>{lr(n.current,hD),n.current&&(typeof o=="number"?await e.navigate(o):await e.navigate(o,{fromRouteId:t,...i}))},[e,t])}var kN={};function yD(e,t,n){!t&&!kN[e]&&(kN[e]=!0,lr(!1,n))}var jN={};function RN(e,t){!e&&!jN[t]&&(jN[t]=!0,console.warn(t))}var NU="useOptimistic",_N=dc[NU],TU=()=>{};function MU(e){return _N?_N(e):[e,TU]}function AU(e){let t={hasErrorBoundary:e.hasErrorBoundary||e.ErrorBoundary!=null||e.errorElement!=null};return e.Component&&(e.element&&lr(!1,"You should not include both `Component` and `element` on your route - `Component` will be used."),Object.assign(t,{element:b.createElement(e.Component),Component:void 0})),e.HydrateFallback&&(e.hydrateFallbackElement&&lr(!1,"You should not include both `HydrateFallback` and `hydrateFallbackElement` on your route - `HydrateFallback` will be used."),Object.assign(t,{hydrateFallbackElement:b.createElement(e.HydrateFallback),HydrateFallback:void 0})),e.ErrorBoundary&&(e.errorElement&&lr(!1,"You should not include both `ErrorBoundary` and `errorElement` on your route - `ErrorBoundary` will be used."),Object.assign(t,{errorElement:b.createElement(e.ErrorBoundary),ErrorBoundary:void 0})),t}var OU=["HydrateFallback","hydrateFallbackElement"],DU=class{constructor(){this.status="pending",this.promise=new Promise((e,t)=>{this.resolve=n=>{this.status==="pending"&&(this.status="resolved",e(n))},this.reject=n=>{this.status==="pending"&&(this.status="rejected",t(n))}})}};function PU({router:e,flushSync:t,onError:n,useTransitions:r}){r=uD()||r;let[i,s]=b.useState(e.state),[c,d]=MU(i),[u,p]=b.useState(),[m,g]=b.useState({isTransitioning:!1}),[y,v]=b.useState(),[S,w]=b.useState(),[E,k]=b.useState(),j=b.useRef(new Map),N=b.useCallback((T,{deletedFetchers:O,newErrors:z,flushSync:q,viewTransitionOpts:$})=>{z&&n&&Object.values(z).forEach(L=>n(L,{location:T.location,params:T.matches[0]?.params??{},pattern:kh(T.matches)})),T.fetchers.forEach((L,F)=>{L.data!==void 0&&j.current.set(F,L.data)}),O.forEach(L=>j.current.delete(L)),RN(q===!1||t!=null,'You provided the `flushSync` option to a router update, but you are not using the `<RouterProvider>` from `react-router/dom` so `ReactDOM.flushSync()` is unavailable. Please update your app to `import { RouterProvider } from "react-router/dom"` and ensure you have `react-dom` installed as a dependency to use the `flushSync` option.');let G=e.window!=null&&e.window.document!=null&&typeof e.window.document.startViewTransition=="function";if(RN($==null||G,"You provided the `viewTransition` option to a router update, but you do not appear to be running in a DOM environment as `window.startViewTransition` is not available."),!$||!G){t&&q?t(()=>s(T)):r===!1?s(T):b.startTransition(()=>{r===!0&&d(L=>NN(L,T)),s(T)});return}if(t&&q){t(()=>{S&&(y?.resolve(),S.skipTransition()),g({isTransitioning:!0,flushSync:!0,currentLocation:$.currentLocation,nextLocation:$.nextLocation})});let L=e.window.document.startViewTransition(()=>{t(()=>s(T))});L.finished.finally(()=>{t(()=>{v(void 0),w(void 0),p(void 0),g({isTransitioning:!1})})}),t(()=>w(L));return}S?(y?.resolve(),S.skipTransition(),k({state:T,currentLocation:$.currentLocation,nextLocation:$.nextLocation})):(p(T),g({isTransitioning:!0,flushSync:!1,currentLocation:$.currentLocation,nextLocation:$.nextLocation}))},[e.window,t,S,y,r,d,n]);b.useLayoutEffect(()=>e.subscribe(N),[e,N]),b.useEffect(()=>{m.isTransitioning&&!m.flushSync&&v(new DU)},[m]),b.useEffect(()=>{if(y&&u&&e.window){let T=u,O=y.promise,z=e.window.document.startViewTransition(async()=>{r===!1?s(T):b.startTransition(()=>{r===!0&&d(q=>NN(q,T)),s(T)}),await O});z.finished.finally(()=>{v(void 0),w(void 0),p(void 0),g({isTransitioning:!1})}),w(z)}},[u,y,e.window,r,d]),b.useEffect(()=>{y&&u&&c.location.key===u.location.key&&y.resolve()},[y,S,c.location,u]),b.useEffect(()=>{!m.isTransitioning&&E&&(p(E.state),g({isTransitioning:!0,flushSync:!1,currentLocation:E.currentLocation,nextLocation:E.nextLocation}),k(void 0))},[m.isTransitioning,E]);let A=b.useMemo(()=>({createHref:e.createHref,encodeLocation:e.encodeLocation,go:T=>e.navigate(T),push:(T,O,z)=>e.navigate(T,{state:O,preventScrollReset:z?.preventScrollReset}),replace:(T,O,z)=>e.navigate(T,{replace:!0,state:O,preventScrollReset:z?.preventScrollReset})}),[e]),R=e.basename||"/",M=b.useMemo(()=>({router:e,navigator:A,static:!1,basename:R,onError:n}),[e,A,R,n]);return b.createElement(b.Fragment,null,b.createElement(fc.Provider,{value:M},b.createElement(jh.Provider,{value:c},b.createElement(dD.Provider,{value:j.current},b.createElement(hE.Provider,{value:m},b.createElement(LU,{basename:R,location:c.location,navigationType:c.historyAction,navigator:A,useTransitions:r},b.createElement(IU,{routes:e.routes,manifest:e.manifest,future:e.future,state:c,isStatic:!1,onError:n})))))),null)}function NN(e,t){return{...e,navigation:t.navigation.state!=="idle"?t.navigation:e.navigation,revalidation:t.revalidation!=="idle"?t.revalidation:e.revalidation,actionData:t.navigation.state!=="submitting"?t.actionData:e.actionData,fetchers:t.fetchers}}var IU=b.memo(zU);function zU({routes:e,manifest:t,future:n,state:r,isStatic:o,onError:i}){return gU(e,void 0,{manifest:t,state:r,isStatic:o,onError:i})}function Cu({to:e,replace:t,state:n,relative:r}){Xt(Qu(),"<Navigate> may be used only in the context of a <Router> component.");let{static:o}=b.useContext(Qo);lr(!o,"<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}=b.useContext(yi),{pathname:s}=Wo(),c=ko(),d=Eh(e,_y(i),s,r==="path"),u=JSON.stringify(d);return b.useEffect(()=>{c(JSON.parse(u),{replace:t,state:n,relative:r})},[c,u,r,t,n]),null}function xE(e){return mU(e.context)}function LU({basename:e="/",children:t=null,location:n,navigationType:r="POP",navigator:o,static:i=!1,useTransitions:s}){Xt(!Qu(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let c=e.replace(/^\/*/,"/"),d=b.useMemo(()=>({basename:c,navigator:o,static:i,useTransitions:s,future:{}}),[c,o,i,s]);typeof n=="string"&&(n=hs(n));let{pathname:u="/",search:p="",hash:m="",state:g=null,key:y="default",mask:v}=n,S=b.useMemo(()=>{let w=Co(u,c);return w==null?null:{location:{pathname:w,search:p,hash:m,state:g,key:y,mask:v},navigationType:r}},[c,u,p,m,g,y,r,v]);return lr(S!=null,`<Router basename="${c}"> is not able to match the URL "${u}${p}${m}" because it does not start with the basename, so the <Router> won't render anything.`),S==null?null:b.createElement(Qo.Provider,{value:d},b.createElement(Ny.Provider,{children:t,value:S}))}var hg="get",pg="application/x-www-form-urlencoded";function Ty(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function FU(e){return Ty(e)&&e.tagName.toLowerCase()==="button"}function $U(e){return Ty(e)&&e.tagName.toLowerCase()==="form"}function VU(e){return Ty(e)&&e.tagName.toLowerCase()==="input"}function BU(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function HU(e,t){return e.button===0&&(!t||t==="_self")&&!BU(e)}function _w(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(o=>[n,o]):[[n,r]])},[]))}function UU(e,t){let n=_w(e);return t&&t.forEach((r,o)=>{n.has(o)||t.getAll(o).forEach(i=>{n.append(o,i)})}),n}var Sm=null;function qU(){if(Sm===null)try{new FormData(document.createElement("form"),0),Sm=!1}catch{Sm=!0}return Sm}var YU=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function l0(e){return e!=null&&!YU.has(e)?(lr(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${pg}"`),null):e}function ZU(e,t){let n,r,o,i,s;if($U(e)){let c=e.getAttribute("action");r=c?Co(c,t):null,n=e.getAttribute("method")||hg,o=l0(e.getAttribute("enctype"))||pg,i=new FormData(e)}else if(FU(e)||VU(e)&&(e.type==="submit"||e.type==="image")){let c=e.form;if(c==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let d=e.getAttribute("formaction")||c.getAttribute("action");if(r=d?Co(d,t):null,n=e.getAttribute("formmethod")||c.getAttribute("method")||hg,o=l0(e.getAttribute("formenctype"))||l0(c.getAttribute("enctype"))||pg,i=new FormData(c,e),!qU()){let{name:u,type:p,value:m}=e;if(p==="image"){let g=u?`${u}.`:"";i.append(`${g}x`,"0"),i.append(`${g}y`,"0")}else u&&i.append(u,m)}}else{if(Ty(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=hg,r=null,o=pg,s=e}return i&&o==="text/plain"&&(s=i,i=void 0),{action:r,method:n.toLowerCase(),encType:o,formData:i,body:s}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function vE(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function xD(e,t,n,r){let o=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return n?o.pathname.endsWith("/")?o.pathname=`${o.pathname}_.${r}`:o.pathname=`${o.pathname}.${r}`:o.pathname==="/"?o.pathname=`_root.${r}`:t&&Co(o.pathname,t)==="/"?o.pathname=`${Og(t)}/_root.${r}`:o.pathname=`${Og(o.pathname)}.${r}`,o}async function GU(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 KU(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 XU(e,t,n){let r=await Promise.all(e.map(async o=>{let i=t.routes[o.route.id];if(i){let s=await GU(i,n);return s.links?s.links():[]}return[]}));return e6(r.flat(1).filter(KU).filter(o=>o.rel==="stylesheet"||o.rel==="preload").map(o=>o.rel==="stylesheet"?{...o,rel:"prefetch",as:"style"}:{...o,rel:"prefetch"}))}function TN(e,t,n,r,o,i){let s=(d,u)=>n[u]?d.route.id!==n[u].route.id:!0,c=(d,u)=>n[u].pathname!==d.pathname||n[u].route.path?.endsWith("*")&&n[u].params["*"]!==d.params["*"];return i==="assets"?t.filter((d,u)=>s(d,u)||c(d,u)):i==="data"?t.filter((d,u)=>{let p=r.routes[d.route.id];if(!p||!p.hasLoader)return!1;if(s(d,u)||c(d,u))return!0;if(d.route.shouldRevalidate){let m=d.route.shouldRevalidate({currentUrl:new URL(o.pathname+o.search+o.hash,window.origin),currentParams:n[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:d.params,defaultShouldRevalidate:!0});if(typeof m=="boolean")return m}return!0}):[]}function QU(e,t,{includeHydrateFallback:n}={}){return WU(e.map(r=>{let o=t.routes[r.route.id];if(!o)return[];let i=[o.module];return o.clientActionModule&&(i=i.concat(o.clientActionModule)),o.clientLoaderModule&&(i=i.concat(o.clientLoaderModule)),n&&o.hydrateFallbackModule&&(i=i.concat(o.hydrateFallbackModule)),o.imports&&(i=i.concat(o.imports)),i}).flat(1))}function WU(e){return[...new Set(e)]}function JU(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function e6(e,t){let n=new Set;return new Set(t),e.reduce((r,o)=>{let i=JSON.stringify(JU(o));return n.has(i)||(n.add(i),r.push({key:i,link:o})),r},[])}function bE(){let e=b.useContext(fc);return vE(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function t6(){let e=b.useContext(jh);return vE(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var wE=b.createContext(void 0);wE.displayName="FrameworkContext";function My(){let e=b.useContext(wE);return vE(e,"You must render this element inside a <HydratedRouter> element"),e}function n6(e,t){let n=b.useContext(wE),[r,o]=b.useState(!1),[i,s]=b.useState(!1),{onFocus:c,onBlur:d,onMouseEnter:u,onMouseLeave:p,onTouchStart:m}=t,g=b.useRef(null);b.useEffect(()=>{if(e==="render"&&s(!0),e==="viewport"){let S=E=>{E.forEach(k=>{s(k.isIntersecting)})},w=new IntersectionObserver(S,{threshold:.5});return g.current&&w.observe(g.current),()=>{w.disconnect()}}},[e]),b.useEffect(()=>{if(r){let S=setTimeout(()=>{s(!0)},100);return()=>{clearTimeout(S)}}},[r]);let y=()=>{o(!0)},v=()=>{o(!1),s(!1)};return n?e!=="intent"?[i,g,{}]:[i,g,{onFocus:cf(c,y),onBlur:cf(d,v),onMouseEnter:cf(u,y),onMouseLeave:cf(p,v),onTouchStart:cf(m,y)}]:[!1,g,{}]}function cf(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function r6({page:e,...t}){let n=uD(),{nonce:r}=My(),{router:o}=bE(),i=b.useMemo(()=>V2(o.routes,e,o.basename),[o.routes,e,o.basename]);return i?(t.nonce==null&&r&&(t={...t,nonce:r}),n?b.createElement(i6,{page:e,matches:i,...t}):b.createElement(s6,{page:e,matches:i,...t})):null}function o6(e){let{manifest:t,routeModules:n}=My(),[r,o]=b.useState([]);return b.useEffect(()=>{let i=!1;return XU(e,t,n).then(s=>{i||o(s)}),()=>{i=!0}},[e,t,n]),r}function i6({page:e,matches:t,...n}){let r=Wo(),{future:o}=My(),{basename:i}=bE(),s=b.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let c=xD(e,i,o.v8_trailingSlashAwareDataRequests,"rsc"),d=!1,u=[];for(let p of t)typeof p.route.shouldRevalidate=="function"?d=!0:u.push(p.route.id);return d&&u.length>0&&c.searchParams.set("_routes",u.join(",")),[c.pathname+c.search]},[i,o.v8_trailingSlashAwareDataRequests,e,r,t]);return b.createElement(b.Fragment,null,s.map(c=>b.createElement("link",{key:c,rel:"prefetch",as:"fetch",href:c,...n})))}function s6({page:e,matches:t,...n}){let r=Wo(),{future:o,manifest:i,routeModules:s}=My(),{basename:c}=bE(),{loaderData:d,matches:u}=t6(),p=b.useMemo(()=>TN(e,t,u,i,r,"data"),[e,t,u,i,r]),m=b.useMemo(()=>TN(e,t,u,i,r,"assets"),[e,t,u,i,r]),g=b.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let S=new Set,w=!1;if(t.forEach(k=>{let j=i.routes[k.route.id];!j||!j.hasLoader||(!p.some(N=>N.route.id===k.route.id)&&k.route.id in d&&s[k.route.id]?.shouldRevalidate||j.hasClientLoader?w=!0:S.add(k.route.id))}),S.size===0)return[];let E=xD(e,c,o.v8_trailingSlashAwareDataRequests,"data");return w&&S.size>0&&E.searchParams.set("_routes",t.filter(k=>S.has(k.route.id)).map(k=>k.route.id).join(",")),[E.pathname+E.search]},[c,o.v8_trailingSlashAwareDataRequests,d,r,i,p,t,e,s]),y=b.useMemo(()=>QU(m,i),[m,i]),v=o6(m);return b.createElement(b.Fragment,null,g.map(S=>b.createElement("link",{key:S,rel:"prefetch",as:"fetch",href:S,...n})),y.map(S=>b.createElement("link",{key:S,rel:"modulepreload",href:S,...n})),v.map(({key:S,link:w})=>b.createElement("link",{key:S,nonce:n.nonce,...w,crossOrigin:w.crossOrigin??n.crossOrigin})))}function a6(...e){return t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})}}var l6=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{l6&&(window.__reactRouterVersion="7.18.2")}catch{}function c6(e,t){return PH({basename:t?.basename,getContext:t?.getContext,future:t?.future,history:QB({window:t?.window}),hydrationData:u6(),routes:e,mapRouteProperties:AU,hydrationRouteProperties:OU,dataStrategy:t?.dataStrategy,patchRoutesOnNavigation:t?.patchRoutesOnNavigation,window:t?.window,instrumentations:t?.instrumentations}).initialize()}function u6(){let e=window?.__staticRouterHydrationData;return e&&e.errors&&(e={...e,errors:d6(e.errors)}),e}function d6(e){if(!e)return null;let t=Object.entries(e),n={};for(let[r,o]of t)if(o&&o.__type==="RouteErrorResponse")n[r]=new Ch(o.status,o.statusText,o.data,o.internal===!0);else if(o&&o.__type==="Error"){if(typeof o.__subType=="string"&&wH.includes(o.__subType)){let i=window[o.__subType];if(typeof i=="function")try{let s=new i(o.message);s.stack="",n[r]=s}catch{}}if(n[r]==null){let i=new Error(o.message);i.stack="",n[r]=i}}else n[r]=o;return n}var yn=b.forwardRef(function({onClick:t,discover:n="render",prefetch:r="none",relative:o,reloadDocument:i,replace:s,mask:c,state:d,target:u,to:p,preventScrollReset:m,viewTransition:g,defaultShouldRevalidate:y,...v},S){let{basename:w,navigator:E,useTransitions:k}=b.useContext(Qo),j=typeof p=="string"&&Ry.test(p),N=K2(p,w);p=N.to;let A=fU(p,{relative:o}),R=Wo(),M=null;if(c){let F=Eh(c,[],R.mask?R.mask.pathname:"/",!0);w!=="/"&&(F.pathname=F.pathname==="/"?w:hi([w,F.pathname])),M=E.createHref(F)}let[T,O,z]=n6(r,v),q=p6(p,{replace:s,mask:c,state:d,target:u,preventScrollReset:m,relative:o,viewTransition:g,defaultShouldRevalidate:y,useTransitions:k});function $(F){t&&t(F),F.defaultPrevented||q(F)}let G=!(N.isExternal||i),L=b.createElement("a",{...v,...z,href:(G?M:void 0)||N.absoluteURL||A,onClick:G?$:t,ref:a6(S,O),target:u,"data-discover":!j&&n==="render"?"true":void 0});return T&&!j?b.createElement(b.Fragment,null,L,b.createElement(r6,{page:A})):L});yn.displayName="Link";var Vo=b.forwardRef(function({"aria-current":t="page",caseSensitive:n=!1,className:r="",end:o=!1,style:i,to:s,viewTransition:c,children:d,...u},p){let m=Rh(s,{relative:u.relative}),g=Wo(),y=b.useContext(jh),{navigator:v,basename:S}=b.useContext(Qo),w=y!=null&&v6(m)&&c===!0,E=v.encodeLocation?v.encodeLocation(m).pathname:m.pathname,k=g.pathname,j=y&&y.navigation&&y.navigation.location?y.navigation.location.pathname:null;n||(k=k.toLowerCase(),j=j?j.toLowerCase():null,E=E.toLowerCase()),j&&S&&(j=Co(j,S)||j);const N=E!=="/"&&E.endsWith("/")?E.length-1:E.length;let A=k===E||!o&&k.startsWith(E)&&k.charAt(N)==="/",R=j!=null&&(j===E||!o&&j.startsWith(E)&&j.charAt(E.length)==="/"),M={isActive:A,isPending:R,isTransitioning:w},T=A?t:void 0,O;typeof r=="function"?O=r(M):O=[r,A?"active":null,R?"pending":null,w?"transitioning":null].filter(Boolean).join(" ");let z=typeof i=="function"?i(M):i;return b.createElement(yn,{...u,"aria-current":T,className:O,ref:p,style:z,to:s,viewTransition:c},typeof d=="function"?d(M):d)});Vo.displayName="NavLink";var f6=b.forwardRef(({discover:e="render",fetcherKey:t,navigate:n,reloadDocument:r,replace:o,state:i,method:s=hg,action:c,onSubmit:d,relative:u,preventScrollReset:p,viewTransition:m,defaultShouldRevalidate:g,...y},v)=>{let{useTransitions:S}=b.useContext(Qo),w=y6(),E=x6(c,{relative:u}),k=s.toLowerCase()==="get"?"get":"post",j=typeof c=="string"&&Ry.test(c),N=A=>{if(d&&d(A),A.defaultPrevented)return;A.preventDefault();let R=A.nativeEvent.submitter,M=R?.getAttribute("formmethod")||s,T=()=>w(R||A.currentTarget,{fetcherKey:t,method:M,navigate:n,replace:o,state:i,relative:u,preventScrollReset:p,viewTransition:m,defaultShouldRevalidate:g});S&&n!==!1?b.startTransition(()=>T()):T()};return b.createElement("form",{ref:v,method:k,action:E,onSubmit:r?d:N,...y,"data-discover":!j&&e==="render"?"true":void 0})});f6.displayName="Form";function h6(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function vD(e){let t=b.useContext(fc);return Xt(t,h6(e)),t}function p6(e,{target:t,replace:n,mask:r,state:o,preventScrollReset:i,relative:s,viewTransition:c,defaultShouldRevalidate:d,useTransitions:u}={}){let p=ko(),m=Wo(),g=Rh(e,{relative:s});return b.useCallback(y=>{if(HU(y,t)){y.preventDefault();let v=n!==void 0?n:ds(m)===ds(g),S=()=>p(e,{replace:v,mask:r,state:o,preventScrollReset:i,relative:s,viewTransition:c,defaultShouldRevalidate:d});u?b.startTransition(()=>S()):S()}},[m,p,g,n,r,o,t,e,i,s,c,d,u])}function Ay(e){lr(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=b.useRef(_w(e)),n=b.useRef(!1),r=Wo(),o=b.useMemo(()=>UU(r.search,n.current?null:t.current),[r.search]),i=ko(),s=b.useCallback((c,d)=>{const u=_w(typeof c=="function"?c(new URLSearchParams(o)):c);n.current=!0,i("?"+u,d)},[i,o]);return[o,s]}var m6=0,g6=()=>`__${String(++m6)}__`;function y6(){let{router:e}=vD("useSubmit"),{basename:t}=b.useContext(Qo),n=EU(),r=e.fetch,o=e.navigate;return b.useCallback(async(i,s={})=>{let{action:c,method:d,encType:u,formData:p,body:m}=ZU(i,t);if(s.navigate===!1){let g=s.fetcherKey||g6();await r(g,n,s.action||c,{defaultShouldRevalidate:s.defaultShouldRevalidate,preventScrollReset:s.preventScrollReset,formData:p,body:m,formMethod:s.method||d,formEncType:s.encType||u,flushSync:s.flushSync})}else await o(s.action||c,{defaultShouldRevalidate:s.defaultShouldRevalidate,preventScrollReset:s.preventScrollReset,formData:p,body:m,formMethod:s.method||d,formEncType:s.encType||u,replace:s.replace,state:s.state,fromRouteId:n,flushSync:s.flushSync,viewTransition:s.viewTransition})},[r,o,t,n])}function x6(e,{relative:t}={}){let{basename:n}=b.useContext(Qo),r=b.useContext(yi);Xt(r,"useFormAction must be used inside a RouteContext");let[o]=r.matches.slice(-1),i={...Rh(e||".",{relative:t})},s=Wo();if(e==null){i.search=s.search;let c=new URLSearchParams(i.search),d=c.getAll("index");if(d.some(p=>p==="")){c.delete("index"),d.filter(m=>m).forEach(m=>c.append("index",m));let p=c.toString();i.search=p?`?${p}`:""}}return(!e||e===".")&&o.route.index&&(i.search=i.search?i.search.replace(/^\?/,"?index&"):"?index"),n!=="/"&&(i.pathname=i.pathname==="/"?n:hi([n,i.pathname])),ds(i)}function v6(e,{relative:t}={}){let n=b.useContext(hE);Xt(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=vD("useViewTransitionState"),o=Rh(e,{relative:t});if(!n.isTransitioning)return!1;let i=Co(n.currentLocation.pathname,r)||n.currentLocation.pathname,s=Co(n.nextLocation.pathname,r)||n.nextLocation.pathname;return Ag(o.pathname,s)!=null||Ag(o.pathname,i)!=null}var Go=j2();const b6=wh(Go);function w6(e){return b.createElement(PU,{flushSync:Go.flushSync,...e})}const bD=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim();const S6=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();const E6=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase());const MN=e=>{const t=E6(e);return t.charAt(0).toUpperCase()+t.slice(1)};var c0={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const C6=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1},k6=b.createContext({}),j6=()=>b.useContext(k6),R6=b.forwardRef(({color:e,size:t,strokeWidth:n,absoluteStrokeWidth:r,className:o="",children:i,iconNode:s,...c},d)=>{const{size:u=24,strokeWidth:p=2,absoluteStrokeWidth:m=!1,color:g="currentColor",className:y=""}=j6()??{},v=r??m?Number(n??p)*24/Number(t??u):n??p;return b.createElement("svg",{ref:d,...c0,width:t??u??c0.width,height:t??u??c0.height,stroke:e??g,strokeWidth:v,className:bD("lucide",y,o),...!i&&!C6(c)&&{"aria-hidden":"true"},...c},[...s.map(([S,w])=>b.createElement(S,w)),...Array.isArray(i)?i:[i]])});const Hn=(e,t)=>{const n=b.forwardRef(({className:r,...o},i)=>b.createElement(R6,{ref:i,iconNode:t,className:bD(`lucide-${S6(MN(e))}`,`lucide-${e}`,r),...o}));return n.displayName=MN(e),n};const _6=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],N6=Hn("arrow-down",_6);const T6=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],Vl=Hn("arrow-left",T6);const M6=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],A6=Hn("arrow-up",M6);const O6=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Ju=Hn("check",O6);const D6=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Oy=Hn("chevron-down",D6);const P6=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],wD=Hn("chevron-right",P6);const I6=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],z6=Hn("chevron-up",I6);const L6=[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]],_h=Hn("chevrons-up-down",L6);const F6=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],$6=Hn("circle-check",F6);const V6=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],B6=Hn("file-text",V6);const H6=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],U6=Hn("info",H6);const q6=[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]],Y6=Hn("key-round",q6);const Z6=[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]],G6=Hn("layout-grid",Z6);const K6=[["path",{d:"m16 6 4 14",key:"ji33uf"}],["path",{d:"M12 6v14",key:"1n7gus"}],["path",{d:"M8 8v12",key:"1gg7y9"}],["path",{d:"M4 4v16",key:"6qkkli"}]],X6=Hn("library",K6);const Q6=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],W6=Hn("loader-circle",Q6);const J6=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],AN=Hn("log-out",J6);const e8=[["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"M2.586 16.726A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2h6.624a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586z",key:"2d38gg"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],t8=Hn("octagon-x",e8);const n8=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],r8=Hn("pencil",n8);const o8=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Qf=Hn("plus",o8);const i8=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],s8=Hn("refresh-cw",i8);const a8=[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]],l8=Hn("rotate-cw",a8);const c8=[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]],u8=Hn("save",c8);const d8=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],SD=Hn("search",d8);const f8=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],h8=Hn("settings",f8);const p8=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],m8=Hn("trash-2",p8);const g8=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],y8=Hn("triangle-alert",g8);const x8=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Nh=Hn("x",x8);function v8(e){if(typeof document>"u")return;let t=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css",t.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}const b8=e=>{switch(e){case"success":return E8;case"info":return k8;case"warning":return C8;case"error":return j8;default:return null}},w8=Array(12).fill(0),S8=({visible:e,className:t})=>Ne.createElement("div",{className:["sonner-loading-wrapper",t].filter(Boolean).join(" "),"data-visible":e},Ne.createElement("div",{className:"sonner-spinner"},w8.map((n,r)=>Ne.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${r}`})))),E8=Ne.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20","aria-hidden":"true"},Ne.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),C8=Ne.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20","aria-hidden":"true"},Ne.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),k8=Ne.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20","aria-hidden":"true"},Ne.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),j8=Ne.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20","aria-hidden":"true"},Ne.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),R8=Ne.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},Ne.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),Ne.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),_8=()=>{const[e,t]=Ne.useState(document.hidden);return Ne.useEffect(()=>{const n=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",n),()=>document.removeEventListener("visibilitychange",n)},[]),e};let N8=1;const T8=100,ON=e=>{var t;return typeof e?.id=="number"||(e==null||(t=e.id)==null?void 0:t.length)>0?e.id:N8++};class M8{constructor(){this.subscribe=t=>(this.subscribers.push(t),this.getActiveToasts().forEach(n=>t(n)),()=>{const n=this.subscribers.indexOf(t);this.subscribers.splice(n,1)}),this.publish=t=>{this.subscribers.forEach(n=>n(t))},this.addToast=t=>{this.publish(t),this.toasts=[...this.toasts,t],this.trimHistory()},this.trimHistory=()=>{let t=this.toasts.length-T8;t<=0||(this.toasts=this.toasts.filter(n=>t>0&&this.dismissedToasts.has(n.id)?(this.dismissedToasts.delete(n.id),t--,!1):!0))},this.create=t=>{const{message:n,...r}=t,o=ON(t),i=this.pendingDismissals.get(o);i!==void 0&&(cancelAnimationFrame(i),this.pendingDismissals.delete(o),this.dismissedToasts.delete(o));const s=this.dismissedToasts.has(o),c=t.dismissible===void 0?!0:t.dismissible;return s&&(this.dismissedToasts.delete(o),this.toasts=this.toasts.filter(u=>u.id!==o)),(s?void 0:this.toasts.find(u=>u.id===o))?this.toasts=this.toasts.map(u=>u.id===o?(this.publish({...u,...t,id:o,title:n}),{...u,...t,id:o,dismissible:c,title:n}):u):this.addToast({title:n,...r,dismissible:c,id:o}),o},this.dismiss=t=>{if(t==null)return this.getActiveToasts().forEach(r=>{this.dismissedToasts.add(r.id),this.subscribers.forEach(o=>o({id:r.id,dismiss:!0}))}),t;this.dismissedToasts.add(t);const n=this.pendingDismissals.get(t);return n!==void 0&&cancelAnimationFrame(n),this.pendingDismissals.set(t,requestAnimationFrame(()=>{this.pendingDismissals.delete(t),this.subscribers.forEach(r=>r({id:t,dismiss:!0}))})),t},this.message=(t,n)=>this.create({...n,message:t,type:void 0}),this.error=(t,n)=>this.create({...n,message:t,type:"error"}),this.success=(t,n)=>this.create({...n,type:"success",message:t}),this.info=(t,n)=>this.create({...n,type:"info",message:t}),this.warning=(t,n)=>this.create({...n,type:"warning",message:t}),this.loading=(t,n)=>this.create({...n,type:"loading",message:t}),this.promise=(t,n)=>{if(!n)return;let r;n.loading!==void 0&&(r=this.create({...n,promise:t,type:"loading",message:n.loading,description:typeof n.description!="function"?n.description:void 0}));const o=Promise.resolve(t instanceof Function?t():t);let i=r!==void 0,s;const c=o.then(async u=>{if(s=["resolve",u],Ne.isValidElement(u))i=!1,this.create({id:r,type:"default",message:u});else if(O8(u)&&!u.ok){i=!1;const m=typeof n.error=="function"?await n.error(`HTTP error! status: ${u.status}`):n.error,g=typeof n.description=="function"?await n.description(`HTTP error! status: ${u.status}`):n.description,v=typeof m=="object"&&!Ne.isValidElement(m)?m:{message:m};this.create({id:r,type:"error",description:g,...v})}else if(u instanceof Error){i=!1;const m=typeof n.error=="function"?await n.error(u):n.error,g=typeof n.description=="function"?await n.description(u):n.description,v=typeof m=="object"&&!Ne.isValidElement(m)?m:{message:m};this.create({id:r,type:"error",description:g,...v})}else if(n.success!==void 0){i=!1;const m=typeof n.success=="function"?await n.success(u):n.success,g=typeof n.description=="function"?await n.description(u):n.description,v=typeof m=="object"&&!Ne.isValidElement(m)?m:{message:m};this.create({id:r,type:"success",description:g,...v})}}).catch(async u=>{if(s=["reject",u],n.error!==void 0){i=!1;const p=typeof n.error=="function"?await n.error(u):n.error,m=typeof n.description=="function"?await n.description(u):n.description,y=typeof p=="object"&&!Ne.isValidElement(p)?p:{message:p};this.create({id:r,type:"error",description:m,...y})}}).finally(()=>{i&&(this.dismiss(r),r=void 0),n.finally==null||n.finally.call(n)}),d=()=>new Promise((u,p)=>c.then(()=>s[0]==="reject"?p(s[1]):u(s[1])).catch(p));return typeof r!="string"&&typeof r!="number"?{unwrap:d}:Object.assign(r,{unwrap:d})},this.custom=(t,n)=>{const r=ON(n);return this.create({...n,jsx:t(r),id:r,type:void 0}),r},this.getActiveToasts=()=>this.toasts.filter(t=>!this.dismissedToasts.has(t.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set,this.pendingDismissals=new Map}}const wo=new M8,A8=(e,t)=>wo.message(e,t),O8=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",D8=A8,P8=()=>wo.toasts,I8=()=>wo.getActiveToasts(),We=Object.assign(D8,{success:wo.success,info:wo.info,warning:wo.warning,error:wo.error,custom:wo.custom,message:wo.message,promise:wo.promise,dismiss:wo.dismiss,loading:wo.loading},{getHistory:P8,getToasts:I8});v8("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px;flex:1;min-width:0}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--normal-text);background:var(--normal-bg);border:1px solid var(--normal-border);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{-webkit-user-select:none;user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");function Em(e){return e.label!==void 0}const z8=3,L8="24px",F8="16px",DN=4e3,$8=356,V8=14,B8=45,H8=200;function Qi(...e){return e.filter(Boolean).join(" ")}function U8(e){const[t,n]=e.split("-"),r=[];return t&&r.push(t),n&&r.push(n),r}const q8=e=>{var t,n,r,o,i,s,c,d,u;const{invert:p,toast:m,unstyled:g,interacting:y,setHeights:v,visibleToasts:S,heights:w,index:E,toasts:k,expanded:j,removeToast:N,defaultRichColors:A,closeButton:R,style:M,cancelButtonStyle:T,actionButtonStyle:O,className:z="",descriptionClassName:q="",duration:$,position:G,gap:L,expandByDefault:F,classNames:P,icons:I,closeButtonAriaLabel:Y="Close toast"}=e,[Z,D]=Ne.useState(null),[H,U]=Ne.useState(null),[B,X]=Ne.useState(!1),[J,Q]=Ne.useState(!1),[oe,W]=Ne.useState(!1),[ne,je]=Ne.useState(!1),[Ee,pe]=Ne.useState(!1),[re,ge]=Ne.useState(0),[_e,De]=Ne.useState(0),we=Ne.useRef(m.duration||$||DN),$e=Ne.useRef(null),Me=Ne.useRef(null),Le=E===0,He=E+1<=S,Ge=m.type,ot=Ge??"default",me=m.dismissible!==!1,ke=m.className||"",de=m.descriptionClassName||"",ue=Ne.useMemo(()=>w.findIndex(at=>at.toastId===m.id)||0,[w,m.id]),Se=Ne.useMemo(()=>{var at;return(at=m.closeButton)!=null?at:R},[m.closeButton,R]),Ue=Ne.useMemo(()=>m.duration||$||DN,[m.duration,$]),Ye=Ne.useRef(0),kt=Ne.useRef(0),ee=Ne.useRef(0),ie=Ne.useRef(null),[le,Ce]=G.split("-"),ve=Ne.useMemo(()=>w.reduce((at,Rt,Gt)=>Gt>=ue?at:at+Rt.height,0),[w,ue]),Be=_8(),Pe=Ne.useMemo(()=>{var at;return(at=e.swipeDirections)!=null?at:U8(G)},[e.swipeDirections,G]),qe=m.invert||p,Ke=Ge==="loading";kt.current=Ne.useMemo(()=>ue*L+ve,[ue,ve]),Ne.useEffect(()=>{we.current=Ue},[Ue]),Ne.useEffect(()=>{X(!0)},[]),Ne.useEffect(()=>{const at=Me.current;if(at){const Rt=at.getBoundingClientRect().height;return De(Rt),v(Gt=>[{toastId:m.id,height:Rt,position:m.position},...Gt]),()=>v(Gt=>Gt.filter(Nt=>Nt.toastId!==m.id))}},[v,m.id]),Ne.useLayoutEffect(()=>{if(!B)return;const at=Me.current,Rt=at.style.height;at.style.height="auto";const Gt=at.getBoundingClientRect().height;at.style.height=Rt,De(Gt),v(Nt=>Nt.find(hn=>hn.toastId===m.id)?Nt.map(hn=>hn.toastId===m.id?{...hn,height:Gt}:hn):[{toastId:m.id,height:Gt,position:m.position},...Nt])},[B,m.title,m.description,v,m.id,m.jsx,m.action,m.cancel]);const nt=Ne.useCallback(()=>{Q(!0),ge(kt.current),v(at=>at.filter(Rt=>Rt.toastId!==m.id)),setTimeout(()=>{N(m)},H8)},[m,N,v,kt]);Ne.useEffect(()=>{if(m.promise&&Ge==="loading"||m.duration===1/0||m.type==="loading")return;let at;return j||y||Be?(()=>{if(ee.current<Ye.current){const Nt=new Date().getTime()-Ye.current;we.current=we.current-Nt}ee.current=new Date().getTime()})():we.current!==1/0&&(Ye.current=new Date().getTime(),at=setTimeout(()=>{m.onAutoClose==null||m.onAutoClose.call(m,m),nt()},we.current)),()=>clearTimeout(at)},[j,y,m,Ge,Be,nt]),Ne.useEffect(()=>{m.delete&&(nt(),m.onDismiss==null||m.onDismiss.call(m,m))},[nt,m.delete]);function it(){var at;if(I?.loading){var Rt;return Ne.createElement("div",{className:Qi(P?.loader,m==null||(Rt=m.classNames)==null?void 0:Rt.loader,"sonner-loader"),"data-visible":Ge==="loading"},I.loading)}return Ne.createElement(S8,{className:Qi(P?.loader,m==null||(at=m.classNames)==null?void 0:at.loader),visible:Ge==="loading"})}const jt=m.icon||I?.[Ge]||b8(Ge);var Ut,qt;return Ne.createElement("li",{tabIndex:0,ref:Me,className:Qi(z,ke,P?.toast,m==null||(t=m.classNames)==null?void 0:t.toast,P?.[ot],m==null||(n=m.classNames)==null?void 0:n[ot]),"data-sonner-toast":"","data-rich-colors":(Ut=m.richColors)!=null?Ut:A,"data-styled":!(m.jsx||m.unstyled||g),"data-mounted":B,"data-promise":!!m.promise,"data-swiped":Ee,"data-removed":J,"data-visible":He,"data-y-position":le,"data-x-position":Ce,"data-index":E,"data-front":Le,"data-swiping":oe,"data-dismissible":me,"data-type":Ge,"data-invert":qe,"data-swipe-out":ne,"data-swipe-direction":H,"data-expanded":!!(j||F&&B),"data-testid":m.testId,style:{"--index":E,"--toasts-before":E,"--z-index":k.length-E,"--offset":`${J?re:kt.current}px`,"--initial-height":F?"auto":`${_e}px`,...M,...m.style},onDragEnd:()=>{W(!1),D(null),ie.current=null},onPointerDown:at=>{at.button!==2&&(Ke||!me||($e.current=new Date,ge(kt.current),at.target.setPointerCapture(at.pointerId),at.target.tagName!=="BUTTON"&&(W(!0),ie.current={x:at.clientX,y:at.clientY})))},onPointerUp:()=>{var at,Rt,Gt;if(ne||!me)return;ie.current=null;const Nt=Number(((at=Me.current)==null?void 0:at.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),Qn=Number(((Rt=Me.current)==null?void 0:Rt.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),hn=new Date().getTime()-((Gt=$e.current)==null?void 0:Gt.getTime()),In=Z==="x"?Nt:Qn,te=Math.abs(In)/hn;if((Z==="x"?Pe.includes(Nt>0?"right":"left"):Pe.includes(Qn>0?"bottom":"top"))&&(Math.abs(In)>=B8||te>.11)){ge(kt.current),m.onDismiss==null||m.onDismiss.call(m,m),U(Z==="x"?Nt>0?"right":"left":Qn>0?"down":"up"),nt(),je(!0);return}else{var fe,Ae;(fe=Me.current)==null||fe.style.setProperty("--swipe-amount-x","0px"),(Ae=Me.current)==null||Ae.style.setProperty("--swipe-amount-y","0px")}pe(!1),W(!1),D(null)},onPointerMove:at=>{var Rt,Gt,Nt;if(!ie.current||!me||((Rt=window.getSelection())==null?void 0:Rt.toString().length)>0)return;const hn=at.clientY-ie.current.y,In=at.clientX-ie.current.x;!Z&&(Math.abs(In)>1||Math.abs(hn)>1)&&D(Math.abs(In)>Math.abs(hn)?"x":"y");let te={x:0,y:0};const ae=fe=>1/(1.5+Math.abs(fe)/20);if(Z==="y"){if(Pe.includes("top")||Pe.includes("bottom"))if(Pe.includes("top")&&hn<0||Pe.includes("bottom")&&hn>0)te.y=hn;else{const fe=hn*ae(hn);te.y=Math.abs(fe)<Math.abs(hn)?fe:hn}}else if(Z==="x"&&(Pe.includes("left")||Pe.includes("right")))if(Pe.includes("left")&&In<0||Pe.includes("right")&&In>0)te.x=In;else{const fe=In*ae(In);te.x=Math.abs(fe)<Math.abs(In)?fe:In}(Math.abs(te.x)>0||Math.abs(te.y)>0)&&pe(!0),(Gt=Me.current)==null||Gt.style.setProperty("--swipe-amount-x",`${te.x}px`),(Nt=Me.current)==null||Nt.style.setProperty("--swipe-amount-y",`${te.y}px`)}},Se&&!m.jsx&&Ge!=="loading"?Ne.createElement("button",{"aria-label":Y,"data-disabled":Ke,"data-close-button":!0,onClick:Ke||!me?()=>{}:()=>{nt(),m.onDismiss==null||m.onDismiss.call(m,m)},className:Qi(P?.closeButton,m==null||(r=m.classNames)==null?void 0:r.closeButton)},(qt=I?.close)!=null?qt:R8):null,(Ge||m.icon||m.promise)&&m.icon!==null&&(I?.[Ge]!==null||m.icon)?Ne.createElement("div",{"data-icon":"",className:Qi(P?.icon,m==null||(o=m.classNames)==null?void 0:o.icon)},Ge==="loading"?m.icon||it():m.promise?it():null,Ge!=="loading"?jt:null):null,Ne.createElement("div",{"data-content":"",className:Qi(P?.content,m==null||(i=m.classNames)==null?void 0:i.content)},Ne.createElement("div",{"data-title":"",className:Qi(P?.title,m==null||(s=m.classNames)==null?void 0:s.title)},m.jsx?m.jsx:typeof m.title=="function"?m.title():m.title),m.description?Ne.createElement("div",{"data-description":"",className:Qi(q,de,P?.description,m==null||(c=m.classNames)==null?void 0:c.description)},typeof m.description=="function"?m.description():m.description):null),Ne.isValidElement(m.cancel)?m.cancel:m.cancel&&Em(m.cancel)?Ne.createElement("button",{"data-button":!0,"data-cancel":!0,style:m.cancelButtonStyle||T,onClick:at=>{Em(m.cancel)&&me&&(m.cancel.onClick==null||m.cancel.onClick.call(m.cancel,at),nt())},className:Qi(P?.cancelButton,m==null||(d=m.classNames)==null?void 0:d.cancelButton)},m.cancel.label):null,Ne.isValidElement(m.action)?m.action:m.action&&Em(m.action)?Ne.createElement("button",{"data-button":!0,"data-action":!0,style:m.actionButtonStyle||O,onClick:at=>{Em(m.action)&&(m.action.onClick==null||m.action.onClick.call(m.action,at),!at.defaultPrevented&&nt())},className:Qi(P?.actionButton,m==null||(u=m.classNames)==null?void 0:u.actionButton)},m.action.label):null)};function PN(){if(typeof window>"u"||typeof document>"u")return"ltr";const e=document.documentElement.getAttribute("dir");return e==="auto"||!e?window.getComputedStyle(document.documentElement).direction:e}function Y8(e,t){const n={};return[e,t].forEach((r,o)=>{const i=o===1,s=i?"--mobile-offset":"--offset",c=i?F8:L8;function d(u){["top","right","bottom","left"].forEach(p=>{n[`${s}-${p}`]=typeof u=="number"?`${u}px`:u})}typeof r=="number"||typeof r=="string"?d(r):typeof r=="object"?["top","right","bottom","left"].forEach(u=>{r[u]===void 0?n[`${s}-${u}`]=c:n[`${s}-${u}`]=typeof r[u]=="number"?`${r[u]}px`:r[u]}):d(c)}),n}const Z8=Ne.forwardRef(function(t,n){const{id:r,invert:o,position:i="bottom-right",hotkey:s=["altKey","KeyT"],expand:c,closeButton:d,className:u,offset:p,mobileOffset:m,theme:g="light",richColors:y,duration:v,style:S,visibleToasts:w=z8,toastOptions:E,dir:k=PN(),gap:j=V8,icons:N,customAriaLabel:A,containerAriaLabel:R="Notifications"}=t,[M,T]=Ne.useState([]),O=Ne.useMemo(()=>r?M.filter(X=>X.toasterId===r):M.filter(X=>!X.toasterId),[M,r]),z=Ne.useMemo(()=>Array.from(new Set([i].concat(O.filter(X=>X.position).map(X=>X.position)))),[O,i]),[q,$]=Ne.useState([]),[G,L]=Ne.useState(!1),[F,P]=Ne.useState(!1),[I,Y]=Ne.useState(g!=="system"?g:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),Z=Ne.useRef(null),D=s.join("+").replace(/Key/g,"").replace(/Digit/g,""),H=Ne.useRef(null),U=Ne.useRef(!1),B=Ne.useCallback(X=>{T(J=>{var Q;return(Q=J.find(oe=>oe.id===X.id))!=null&&Q.delete||wo.dismiss(X.id),J.filter(({id:oe})=>oe!==X.id)})},[]);return Ne.useEffect(()=>wo.subscribe(X=>{if(X.dismiss){requestAnimationFrame(()=>{T(J=>J.map(Q=>Q.id===X.id?{...Q,delete:!0}:Q))});return}setTimeout(()=>{b6.flushSync(()=>{T(J=>{const Q=J.findIndex(oe=>oe.id===X.id);return Q!==-1?[...J.slice(0,Q),{...J[Q],...X},...J.slice(Q+1)]:[X,...J]})})})}),[]),Ne.useEffect(()=>{if(g!=="system"){Y(g);return}if(g==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?Y("dark"):Y("light")),typeof window>"u")return;const X=window.matchMedia("(prefers-color-scheme: dark)");try{X.addEventListener("change",({matches:J})=>{Y(J?"dark":"light")})}catch{X.addListener(({matches:Q})=>{try{Y(Q?"dark":"light")}catch(oe){console.error(oe)}})}},[g]),Ne.useEffect(()=>{M.length<=1&&L(!1)},[M]),Ne.useEffect(()=>{const X=J=>{var Q;if(s.length>0&&s.every(ne=>J[ne]||J.code===ne)){var W;L(!0),(W=Z.current)==null||W.focus()}J.code==="Escape"&&(document.activeElement===Z.current||(Q=Z.current)!=null&&Q.contains(document.activeElement))&&L(!1)};return document.addEventListener("keydown",X),()=>document.removeEventListener("keydown",X)},[s]),Ne.useEffect(()=>{if(Z.current)return()=>{H.current&&(H.current.focus({preventScroll:!0}),H.current=null,U.current=!1)}},[Z.current]),Ne.createElement("section",{ref:n,"aria-label":A??`${R} ${D}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0,"data-react-aria-top-layer":!0},z.map((X,J)=>{var Q;const[oe,W]=X.split("-");return O.length?Ne.createElement("ol",{key:X,dir:k==="auto"?PN():k,tabIndex:-1,ref:Z,className:u,"data-sonner-toaster":!0,"data-sonner-theme":I,"data-y-position":oe,"data-x-position":W,style:{"--front-toast-height":`${((Q=q[0])==null?void 0:Q.height)||0}px`,"--width":`${$8}px`,"--gap":`${j}px`,...S,...Y8(p,m)},onBlur:ne=>{U.current&&!ne.currentTarget.contains(ne.relatedTarget)&&(U.current=!1,H.current&&(H.current.focus({preventScroll:!0}),H.current=null))},onFocus:ne=>{ne.target instanceof HTMLElement&&ne.target.dataset.dismissible==="false"||U.current||(U.current=!0,H.current=ne.relatedTarget)},onMouseEnter:()=>L(!0),onMouseMove:()=>L(!0),onMouseLeave:()=>{F||L(!1)},onDragEnd:()=>L(!1),onPointerDown:ne=>{ne.target instanceof HTMLElement&&ne.target.dataset.dismissible==="false"||P(!0)},onPointerUp:()=>P(!1)},O.filter(ne=>!ne.position&&J===0||ne.position===X).map((ne,je)=>{var Ee,pe;return Ne.createElement(q8,{key:ne.id,icons:N,index:je,toast:ne,defaultRichColors:y,duration:(Ee=E?.duration)!=null?Ee:v,className:E?.className,descriptionClassName:E?.descriptionClassName,invert:o,visibleToasts:w,closeButton:(pe=E?.closeButton)!=null?pe:d,interacting:F,position:X,style:E?.style,unstyled:E?.unstyled,classNames:E?.classNames,cancelButtonStyle:E?.cancelButtonStyle,actionButtonStyle:E?.actionButtonStyle,closeButtonAriaLabel:E?.closeButtonAriaLabel,removeToast:B,toasts:O.filter(re=>re.position==ne.position),heights:q.filter(re=>re.position==ne.position),setHeights:$,expandByDefault:c,gap:j,expanded:G,swipeDirections:t.swipeDirections})})):null}))});class Dy extends Error{constructor(t,n){super(n),this.status=t,this.name="ApiError"}status;get displayMsg(){return this.message&&!this.message.startsWith("HTTP ")?`${this.message}(${this.status})`:{400:"请求参数错误(400)",404:"资源不存在(404)",409:"状态冲突(409)",422:"数据校验失败(422)"}[this.status]??`请求失败(HTTP ${this.status})`}}async function ED(e){let t;try{const n=await e.json();if(typeof n.message=="string"&&n.message.length>0)t=n.message;else if(typeof n.error=="object"&&n.error!==null&&n.error.name==="ZodError"&&typeof n.error.message=="string")try{const r=JSON.parse(n.error.message),o=Array.isArray(r)?r[0]:void 0;if(o&&typeof o.message=="string"&&o.message.length>0){const i=Array.isArray(o.path)&&o.path.length>0?`(字段:${o.path.join(".")})`:"";t=`${o.message}${i}`}}catch{}}catch{}return new Dy(e.status,t??`HTTP ${e.status}`)}const CD="/api";let kD=null;function IN(e){kD=e}const G8=new Set(["/auth/login","/auth/setup"]);async function K8(e){try{const t=await e.clone().json();return typeof t.error=="string"?t.error:void 0}catch{return}}async function jD(e,t){if(e.status!==401||G8.has(t))return;await K8(e)==="AUTH_REQUIRED"&&kD?.()}async function xt(e,t){const n=await fetch(`${CD}${e}`,{credentials:"same-origin",...t});if(!n.ok)throw await jD(n,e),await ED(n);return await n.json()}async function ol(e,t){const n=await fetch(`${CD}${e}`,{credentials:"same-origin",...t});if(!n.ok)throw await jD(n,e),await ED(n)}function fn(e,t){return{method:e,headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}}function ed(e){return{...e,agents:[...e.agents??[]],...e.sourcePreset?{sourcePreset:{...e.sourcePreset,agents:[...e.sourcePreset.agents??[]]}}:{}}}function Py(e){return{...e,agents:[...e.agents??[]]}}function X8(e){return{...e,dagInstance:{...e.dagInstance,nodes:e.dagInstance.nodes.map(t=>({...t,agents:[...t.agents??[]]}))}}}function Th(e){return{...e,agents:[...e.agents??[]]}}async function RD(e,t){const n=new URLSearchParams;e&&n.set("projectId",e),t&&n.set("q",t);const r=n.toString();return(await xt(r?`/tasks?${r}`:"/tasks")).items}async function Q8(e){return X8(await xt(`/tasks/${encodeURIComponent(e)}`))}async function W8(e){const t=await xt("/tasks",fn("POST",e));return{...t,firstNode:Py(t.firstNode)}}async function J8(e,t){const n=await xt(`/tasks/${encodeURIComponent(e)}/advance`,fn("POST",t?{note:t}:{}));return n.status==="advanced"?{...n,nextNode:Py(n.nextNode)}:n}async function e9(e,t,n){const r=await xt(`/tasks/${encodeURIComponent(e)}/approve`,fn("POST",{decision:t,...n?{comment:n}:{}}));return r.status==="advanced"?{...r,nextNode:Py(r.nextNode)}:r}async function t9(e){const t=await xt(`/tasks/${encodeURIComponent(e)}/context?view=full`);return{...t,currentNode:t.currentNode?Py(t.currentNode):null}}async function n9(e,t){return xt(`/tasks/${encodeURIComponent(e)}/pause`,fn("POST",t?{reason:t}:{}))}async function r9(e,t){return xt(`/tasks/${encodeURIComponent(e)}/resume`,fn("POST",t?{decision:t}:{}))}async function o9(e,t){return xt(`/tasks/${encodeURIComponent(e)}/cancel`,fn("POST",t?{reason:t}:{}))}async function i9(e,t){const n=new URLSearchParams;e&&n.set("projectId",e),t?.includeDisabled&&n.set("includeDisabled","true");const r=n.toString();return(await xt(r?`/dag/templates?${r}`:"/dag/templates")).map(i=>({...i,nodes:i.nodes.map(ed)}))}async function s9(e){const t=await xt(`/dag/templates/${encodeURIComponent(e)}`);return{...t,nodes:t.nodes.map(ed)}}async function a9(e){const t=await xt("/dag/templates",fn("POST",e));return{...t,nodes:t.nodes.map(ed)}}async function l9(e,t){const n=await xt(`/dag/templates/${encodeURIComponent(e)}`,fn("PUT",t));return{...n,nodes:n.nodes.map(ed)}}async function c9(e){return ol(`/dag/templates/${encodeURIComponent(e)}`,{method:"DELETE"})}async function u9(e,t){const n=await xt(`/dag/templates/${encodeURIComponent(e)}/copy`,fn("POST",t));return{...n,nodes:n.nodes.map(ed)}}async function d9(e,t){return xt(`/dag/templates/${encodeURIComponent(e)}/enabled`,fn("POST",{enabled:t}))}async function f9(e){const t=await xt(`/dag/templates/${encodeURIComponent(e)}/export`);return{...t,template:{...t.template,nodes:t.template.nodes.map(ed)}}}async function h9(e){return xt("/dag/templates/import/plan",fn("POST",e))}async function p9(e){return xt("/dag/templates/import/apply",fn("POST",e))}function ps(e){const t=[];return e?.scope&&t.push(`scope=${encodeURIComponent(e.scope)}`),e?.scope==="project"&&e.projectId&&t.push(`projectId=${encodeURIComponent(e.projectId)}`),e?.includeDisabled&&t.push("includeDisabled=true"),t.length>0?`?${t.join("&")}`:""}async function m9(e,t){const n=new URLSearchParams;e&&n.set("projectId",e),t?.includeDisabled&&n.set("includeDisabled","true"),t?.q&&n.set("q",t.q);const r=n.toString();return xt(r?`/skills?${r}`:"/skills")}async function g9(e,t){const n=ps(t);return xt(`/skills/${encodeURIComponent(e)}${n}`)}async function y9(e){return xt("/skills",fn("POST",e))}async function x9(e,t,n){const r=ps(n);return xt(`/skills/${encodeURIComponent(e)}${r}`,fn("PUT",t))}async function v9(e,t){const n=ps(t);return ol(`/skills/${encodeURIComponent(e)}${n}`,{method:"DELETE"})}async function b9(e,t,n){const r=ps(n);return xt(`/skills/${encodeURIComponent(e)}/copy${r}`,fn("POST",t))}async function w9(e,t,n){const r=ps(n);return xt(`/skills/${encodeURIComponent(e)}/enabled${r}`,fn("POST",{enabled:t}))}async function S9(e,t){const n=new URLSearchParams;e&&n.set("projectId",e),t?.includeDisabled&&n.set("includeDisabled","true"),t?.q&&n.set("q",t.q);const r=n.toString();return xt(r?`/agents?${r}`:"/agents")}async function E9(e,t){const n=ps(t);return xt(`/agents/${encodeURIComponent(e)}${n}`)}async function C9(e){return xt("/agents",fn("POST",e))}async function k9(e,t,n){const r=ps(n);return xt(`/agents/${encodeURIComponent(e)}${r}`,fn("PUT",t))}async function j9(e,t){const n=ps(t);return ol(`/agents/${encodeURIComponent(e)}${n}`,{method:"DELETE"})}async function R9(e,t,n){const r=ps(n);return xt(`/agents/${encodeURIComponent(e)}/copy${r}`,fn("POST",t))}async function _9(e,t,n){const r=ps(n);return xt(`/agents/${encodeURIComponent(e)}/enabled${r}`,fn("POST",{enabled:t}))}async function N9(e,t){const n=new URLSearchParams;e&&n.set("projectId",e),t?.includeDisabled&&n.set("includeDisabled","true"),t?.q&&n.set("q",t.q);const r=n.toString();return(await xt(r?`/node-presets?${r}`:"/node-presets")).map(Th)}async function Dg(e,t){const n=t?.includeDisabled?"?includeDisabled=true":"";return Th(await xt(`/node-presets/${encodeURIComponent(e)}${n}`))}async function T9(e){return Th(await xt("/node-presets",fn("POST",e)))}async function M9(e,t){return Th(await xt(`/node-presets/${encodeURIComponent(e)}`,fn("PUT",t)))}async function A9(e){return ol(`/node-presets/${encodeURIComponent(e)}`,{method:"DELETE"})}async function O9(e,t){return xt(`/node-presets/${encodeURIComponent(e)}/enabled`,fn("POST",{enabled:t}))}async function D9(e,t){return Th(await xt(`/node-presets/${encodeURIComponent(e)}/copy`,fn("POST",t)))}async function P9(e){const t=await xt(`/dag/templates/${encodeURIComponent(e)}/upgrade/plan`);return{...t,items:t.items.map(n=>({...n,diff:{...n.diff,agents:n.diff.agents??null}}))}}async function I9(e,t){return xt(`/dag/templates/${encodeURIComponent(e)}/upgrade/apply`,fn("POST",{decisions:t}))}async function _D(){return xt("/projects")}async function z9(e){return xt("/projects",fn("POST",e))}async function L9(e,t){return xt(`/projects/${encodeURIComponent(e)}`,fn("PUT",t))}async function F9(){return xt("/model-aliases")}async function $9(e){return xt("/model-aliases",fn("POST",e))}async function V9(e,t){return xt(`/model-aliases/${encodeURIComponent(e)}`,fn("PUT",t))}async function B9(e){return ol(`/model-aliases/${encodeURIComponent(e)}`,{method:"DELETE"})}async function H9(){return xt("/settings/enums")}async function U9(e,t){return xt(`/settings/enums/${e}`,fn("PUT",t))}async function q9(e,t){return ol(`/settings/enums/${e}/entries/${encodeURIComponent(t)}`,{method:"DELETE"})}async function Y9(){return xt("/auth/status")}async function Z9(){return xt("/auth/me")}async function G9(e){return xt("/auth/login",fn("POST",e))}async function K9(e){return xt("/auth/setup",fn("POST",e))}async function X9(){return ol("/auth/logout",{method:"POST"})}async function Q9(e){return ol("/auth/password",fn("PUT",e))}async function W9(){return xt("/auth/tokens/admin")}async function J9(){return xt("/auth/tokens/admin",fn("POST",{}))}async function eq(){return xt("/auth/tokens/project")}async function tq(e){return xt(`/auth/tokens/project/${encodeURIComponent(e)}`,fn("POST",{}))}const u0="siming.activeProjectId",ND=b.createContext(null);function nq({children:e}){const{data:t,isLoading:n,isError:r,refetch:o}=_r({queryKey:["projects"],queryFn:_D}),[i,s]=b.useState("");b.useEffect(()=>{if(!t)return;const u=t.filter(v=>v.status==="active"),p=window.localStorage.getItem(u0),m=p?u.find(v=>v.id===p):void 0,g=u.find(v=>v.key==="default")??u[0],y=m?.id??g?.id??"";y&&window.localStorage.setItem(u0,y),s(v=>v===y?v:y)},[t]);const c=b.useCallback(u=>{window.localStorage.setItem(u0,u),s(u)},[]),d=b.useMemo(()=>{const u=(t??[]).filter(p=>p.status==="active");return{projects:t??[],activeProjects:u,activeProject:u.find(p=>p.id===i),activeProjectId:i,setActiveProjectId:c,bootstrapReady:!n&&(t??[]).length>0&&i!=="",bootstrapError:r,retryBootstrap:()=>{o()}}},[t,n,r,o,i,c]);return f.jsx(ND.Provider,{value:d,children:e})}function Kr(){const e=b.useContext(ND);if(!e)throw new Error("useProjectContext 必须在 <ProjectProvider> 内使用");return e}const rq=({...e})=>f.jsx(Z8,{className:"toaster group",icons:{success:f.jsx($6,{className:"size-4"}),info:f.jsx(U6,{className:"size-4"}),warning:f.jsx(y8,{className:"size-4"}),error:f.jsx(t8,{className:"size-4"}),loading:f.jsx(W6,{className:"size-4 animate-spin"})},style:{"--normal-bg":"var(--popover)","--normal-text":"var(--popover-foreground)","--normal-border":"var(--border)","--border-radius":"var(--radius)"},toastOptions:{classNames:{toast:"cn-toast"}},...e}),TD=b.createContext(null),zN={ready:!1,bootstrapError:!1,mode:"open",authenticated:!1,username:null,needsSetup:!1};function oq({children:e}){const t=Jt(),[n,r]=b.useState(zN),[o,i]=b.useState(0);b.useEffect(()=>{let m=!1;return r(g=>({...g,ready:!1,bootstrapError:!1})),(async()=>{try{const g=await Y9();if(!g.authEnabled){m||r({...zN,ready:!0,mode:"open"});return}try{const y=await Z9();m||r({ready:!0,bootstrapError:!1,mode:"auth",authenticated:!0,username:y.username,needsSetup:!1})}catch{m||r({ready:!0,bootstrapError:!1,mode:"auth",authenticated:!1,username:null,needsSetup:g.needsSetup})}}catch{m||r(g=>({...g,ready:!0,bootstrapError:!0}))}})(),()=>{m=!0}},[o]),b.useEffect(()=>(IN(()=>{r(m=>m.mode==="auth"&&m.authenticated?{...m,authenticated:!1,username:null}:m)}),()=>IN(null)),[]);const s=b.useCallback(m=>{r(g=>({...g,ready:!0,bootstrapError:!1,mode:"auth",authenticated:!0,username:m,needsSetup:!1})),t.invalidateQueries({queryKey:["projects"]})},[t]),c=b.useCallback(async m=>{const g=await G9(m);s(g.username)},[s]),d=b.useCallback(async m=>{const g=await K9(m);s(g.username)},[s]),u=b.useCallback(async()=>{await X9(),r(m=>({...m,authenticated:!1,username:null}))},[]),p=b.useMemo(()=>({...n,retryBootstrap:()=>i(m=>m+1),login:c,setup:d,logout:u}),[n,c,d,u]);return f.jsxs(TD.Provider,{value:p,children:[f.jsx(rq,{richColors:!0,position:"top-center"}),e??f.jsx(xE,{})]})}function Mh(){const e=b.useContext(TD);if(!e)throw new Error("useAuthContext 必须在 <AuthProvider> 内使用");return e}const MD={clipPath:"inset(50%)",overflow:"hidden",whiteSpace:"nowrap",border:0,padding:0,width:1,height:1,margin:-1},AD={...MD,position:"fixed",top:0,left:0},iq={...MD,position:"absolute"},LN={};function Yr(e,t){const n=b.useRef(LN);return n.current===LN&&(n.current=e(t)),n}function Xa(e,t,n,r){const o=Yr(OD).current;return aq(o,e,t,n,r)&&DD(o,[e,t,n,r]),o.callback}function sq(e){const t=Yr(OD).current;return lq(t,e)&&DD(t,e),t.callback}function OD(){return{callback:null,cleanup:null,refs:[]}}function aq(e,t,n,r,o){return e.refs[0]!==t||e.refs[1]!==n||e.refs[2]!==r||e.refs[3]!==o}function lq(e,t){return e.refs.length!==t.length||e.refs.some((n,r)=>n!==t[r])}function DD(e,t){if(e.refs=t,t.every(n=>n==null)){e.callback=null;return}e.callback=n=>{if(e.cleanup&&(e.cleanup(),e.cleanup=null),n!=null){const r=Array(t.length).fill(null);for(let o=0;o<t.length;o+=1){const i=t[o];if(i!=null)switch(typeof i){case"function":{const s=i(n);typeof s=="function"&&(r[o]=s);break}case"object":{i.current=n;break}}}e.cleanup=()=>{for(let o=0;o<t.length;o+=1){const i=t[o];if(i!=null)switch(typeof i){case"function":{const s=r[o];typeof s=="function"?s():i(null);break}case"object":{i.current=null;break}}}}}}}function cq(e){const t=b.useRef(!0);t.current&&(t.current=!1,e())}function uq(e){const[t,n]=b.useState({current:e,previous:null});return Object.is(e,t.current)||n({current:e,previous:t.current}),t.previous}function PD(e){return e==null||e.hasAttribute("disabled")||e.getAttribute("aria-disabled")==="true"}function Pg({controlled:e,default:t,name:n,state:r="value"}){const{current:o}=b.useRef(e!==void 0),[i,s]=b.useState(t),c=o?e:i,d=b.useCallback(u=>{o||s(u)},[]);return[c,d]}const dq=()=>{},rt=typeof document<"u"?b.useLayoutEffect:dq,SE={...dc},d0=SE.useInsertionEffect,fq=d0&&d0!==SE.useLayoutEffect?d0:e=>e();function st(e){const t=Yr(hq).current;return t.next=e,fq(t.effect),t.trampoline}function hq(){const e={next:void 0,callback:pq,trampoline:(...t)=>e.callback?.(...t),effect:()=>{e.callback=e.next}};return e}function pq(){}function hr(e){const t=Yr(mq,e).current;return t.next=e,rt(t.effect),t}function mq(e){const t={current:e,next:e,effect:()=>{t.current=t.next}};return t}function gq(e,t){return function(r,...o){const i=new URL(e);return i.searchParams.set("code",r.toString()),o.forEach(s=>i.searchParams.append("args[]",s)),`${t} error #${r}; visit ${i} for the full message.`}}const Sr=gq("https://base-ui.com/production-error","Base UI");var f0={exports:{}},h0={};var FN;function yq(){if(FN)return h0;FN=1;var e=Sh();function t(m,g){return m===g&&(m!==0||1/m===1/g)||m!==m&&g!==g}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,o=e.useEffect,i=e.useLayoutEffect,s=e.useDebugValue;function c(m,g){var y=g(),v=r({inst:{value:y,getSnapshot:g}}),S=v[0].inst,w=v[1];return i(function(){S.value=y,S.getSnapshot=g,d(S)&&w({inst:S})},[m,y,g]),o(function(){return d(S)&&w({inst:S}),m(function(){d(S)&&w({inst:S})})},[m]),s(y),y}function d(m){var g=m.getSnapshot;m=m.value;try{var y=g();return!n(m,y)}catch{return!0}}function u(m,g){return g()}var p=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?u:c;return h0.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:p,h0}var $N;function ID(){return $N||($N=1,f0.exports=yq()),f0.exports}var EE=ID(),p0={exports:{}},m0={};var VN;function xq(){if(VN)return m0;VN=1;var e=Sh(),t=ID();function n(u,p){return u===p&&(u!==0||1/u===1/p)||u!==u&&p!==p}var r=typeof Object.is=="function"?Object.is:n,o=t.useSyncExternalStore,i=e.useRef,s=e.useEffect,c=e.useMemo,d=e.useDebugValue;return m0.useSyncExternalStoreWithSelector=function(u,p,m,g,y){var v=i(null);if(v.current===null){var S={hasValue:!1,value:null};v.current=S}else S=v.current;v=c(function(){function E(R){if(!k){if(k=!0,j=R,R=g(R),y!==void 0&&S.hasValue){var M=S.value;if(y(M,R))return N=M}return N=R}if(M=N,r(j,R))return M;var T=g(R);return y!==void 0&&y(M,T)?(j=R,M):(j=R,N=T)}var k=!1,j,N,A=m===void 0?null:m;return[function(){return E(p())},A===null?void 0:function(){return E(A())}]},[p,m,g,y]);var w=o(u,v[0],v[1]);return s(function(){S.hasValue=!0,S.value=w},[w]),d(w),w},m0}var BN;function vq(){return BN||(BN=1,p0.exports=xq()),p0.exports}var CE=vq();const bq=wh(CE),wq=parseInt(b.version,10);function kE(e){return wq>=e}const Nw=[];let Tw;function Sq(){return Tw}function Eq(e){Nw.push(e)}function zD(e){const t=(n,r)=>{const o=Yr(kq).current;let i;try{Tw=o;for(const s of Nw)s.before(o);i=e(n,r);for(const s of Nw)s.after(o);o.didInitialize=!0}finally{Tw=void 0}return i};return t.displayName=e.displayName||e.name,t}function Cq(e){return b.forwardRef(zD(e))}function kq(){return{didInitialize:!1}}const jq=kE(19),Rq=jq?Nq:Tq;function vt(e,t,n,r,o){return Rq(e,t,n,r,o)}function _q(e,t,n,r,o){const i=b.useCallback(()=>t(e.getSnapshot(),n,r,o),[e,t,n,r,o]);return EE.useSyncExternalStore(e.subscribe,i,i)}Eq({before(e){e.syncIndex=0,e.didInitialize||(e.syncTick=1,e.syncHooks=[],e.didChangeStore=!0,e.getSnapshot=()=>{let t=!1;for(let n=0;n<e.syncHooks.length;n+=1){const r=e.syncHooks[n],o=r.selector(r.store.state,r.a1,r.a2,r.a3);Object.is(r.value,o)||(t=!0,r.value=o)}return t&&(e.syncTick+=1),e.syncTick})},after(e){e.syncHooks.length>0&&(e.didChangeStore&&(e.didChangeStore=!1,e.subscribe=t=>{const n=new Set;for(const o of e.syncHooks)n.add(o.store);const r=[];for(const o of n)r.push(o.subscribe(t));return()=>{for(const o of r)o()}}),EE.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getSnapshot))}});function Nq(e,t,n,r,o){const i=Sq();if(!i)return _q(e,t,n,r,o);const s=i.syncIndex;i.syncIndex+=1;let c;return i.didInitialize?(c=i.syncHooks[s],(c.store!==e||c.selector!==t||!Object.is(c.a1,n)||!Object.is(c.a2,r)||!Object.is(c.a3,o))&&(c.store!==e&&(i.didChangeStore=!0),c.store=e,c.selector=t,c.a1=n,c.a2=r,c.a3=o,c.value=t(e.getSnapshot(),n,r,o))):(c={store:e,selector:t,a1:n,a2:r,a3:o,value:t(e.getSnapshot(),n,r,o)},i.syncHooks.push(c)),c.value}function Tq(e,t,n,r,o){return CE.useSyncExternalStoreWithSelector(e.subscribe,e.getSnapshot,e.getSnapshot,i=>t(i,n,r,o))}class Mq{constructor(t){this.state=t,this.listeners=new Set,this.updateTick=0}subscribe=t=>(this.listeners.add(t),()=>{this.listeners.delete(t)});getSnapshot=()=>this.state;setState(t){if(this.state===t)return;this.state=t,this.updateTick+=1;const n=this.updateTick;for(const r of this.listeners){if(n!==this.updateTick)return;r(t)}}update(t){for(const n in t)if(!Object.is(this.state[n],t[n])){this.setState({...this.state,...t});return}}set(t,n){Object.is(this.state[t],n)||this.setState({...this.state,[t]:n})}notifyAll(){const t={...this.state};this.setState(t)}use(t,n,r,o){return vt(this,t,n,r,o)}}function Ar(){}const fs=Object.freeze([]),rr=Object.freeze({});class Ah extends Mq{constructor(t,n={},r){super(t),this.context=n,this.selectors=r}useSyncedValue(t,n){b.useDebugValue(t);const r=this;rt(()=>{r.state[t]!==n&&r.set(t,n)},[r,t,n])}useSyncedValueWithCleanup(t,n){const r=this;rt(()=>(r.state[t]!==n&&r.set(t,n),()=>{r.set(t,void 0)}),[r,t,n])}useSyncedValues(t){const n=this,r=Object.values(t);rt(()=>{n.update(t)},[n,...r])}useControlledProp(t,n){b.useDebugValue(t);const r=this,o=n!==void 0;rt(()=>{o&&!Object.is(r.state[t],n)&&r.setState({...r.state,[t]:n})},[r,t,n,o])}select(t,n,r,o){const i=this.selectors[t];return i(this.state,n,r,o)}useState(t,n,r,o){return b.useDebugValue(t),vt(this,this.selectors[t],n,r,o)}useContextCallback(t,n){b.useDebugValue(t);const r=st(n??Ar);this.context[t]=r}useStateSetter(t){const n=b.useRef(void 0);return n.current===void 0&&(n.current=r=>{this.set(t,r)}),n.current}observe(t,n){let r;typeof t=="function"?r=t:r=this.selectors[t];let o=r(this.state);return n(o,o,this),this.subscribe(i=>{const s=r(i);if(!Object.is(o,s)){const c=o;o=s,n(s,c,this)}})}}function Iy(){return typeof window<"u"}function Zr(e){return jE(e)?(e.nodeName||"").toLowerCase():"#document"}function Gn(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Js(e){var t;return(t=(jE(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function jE(e){return Iy()?e instanceof Node||e instanceof Gn(e).Node:!1}function cn(e){return Iy()?e instanceof Element||e instanceof Gn(e).Element:!1}function Nn(e){return Iy()?e instanceof HTMLElement||e instanceof Gn(e).HTMLElement:!1}function Ou(e){return!Iy()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Gn(e).ShadowRoot}function Oh(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=Ko(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&o!=="inline"&&o!=="contents"}function Aq(e){return/^(table|td|th)$/.test(Zr(e))}function zy(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const Oq=/transform|translate|scale|rotate|perspective|filter/,Dq=/paint|layout|strict|content/,Tl=e=>!!e&&e!=="none";let g0;function RE(e){const t=cn(e)?Ko(e):e;return Tl(t.transform)||Tl(t.translate)||Tl(t.scale)||Tl(t.rotate)||Tl(t.perspective)||!_E()&&(Tl(t.backdropFilter)||Tl(t.filter))||Oq.test(t.willChange||"")||Dq.test(t.contain||"")}function Pq(e){let t=Xs(e);for(;Nn(t)&&!qs(t);){if(RE(t))return t;if(zy(t))return null;t=Xs(t)}return null}function _E(){return g0==null&&(g0=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),g0}function qs(e){return/^(html|body|#document)$/.test(Zr(e))}function Ko(e){return Gn(e).getComputedStyle(e)}function Ly(e){return cn(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Xs(e){if(Zr(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Ou(e)&&e.host||Js(e);return Ou(t)?t.host:t}function LD(e){const t=Xs(e);return qs(t)?(e.ownerDocument||e).body:Nn(t)&&Oh(t)?t:LD(t)}function Wf(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=LD(e),i=o===((r=e.ownerDocument)==null?void 0:r.body),s=Gn(o);if(i){const c=Mw(s);return t.concat(s,s.visualViewport||[],Oh(o)?o:[],c&&n?Wf(c):[])}else return t.concat(o,Wf(o,[],n))}function Mw(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function as(...e){return()=>{for(let t=0;t<e.length;t+=1){const n=e[t];n&&n()}}}function en(e){return e?.ownerDocument||document}function Wt(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}function NE(e){b.useEffect(e,fs)}const Cm=null;class Iq{callbacks=[];callbacksCount=0;nextId=1;startId=1;isScheduled=!1;tick=t=>{this.isScheduled=!1;const n=this.callbacks,r=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,r>0)for(let o=0;o<n.length;o+=1)n[o]?.(t)};request(t){const n=this.nextId;return this.nextId+=1,this.callbacks.push(t),this.callbacksCount+=1,!this.isScheduled&&(requestAnimationFrame(this.tick),this.isScheduled=!0),n}cancel(t){const n=t-this.startId;n<0||n>=this.callbacks.length||(this.callbacks[n]=null,this.callbacksCount-=1)}}let km=new Iq;class rs{static create(){return new rs}static request(t){return km.request(t)}static cancel(t){return km.cancel(t)}currentId=Cm;request(t){this.cancel(),this.currentId=km.request(()=>{this.currentId=Cm,t()})}cancel=()=>{this.currentId!==Cm&&(km.cancel(this.currentId),this.currentId=Cm)};disposeEffect=()=>this.cancel}function Du(){const e=Yr(rs.create).current;return NE(e.disposeEffect),e}const uf=0;class zi{static create(){return new zi}currentId=uf;start(t,n){this.clear(),this.currentId=setTimeout(()=>{this.currentId=uf,n()},t)}isStarted(){return this.currentId!==uf}clear=()=>{this.currentId!==uf&&(clearTimeout(this.currentId),this.currentId=uf)};disposeEffect=()=>this.clear}function qr(){const e=Yr(zi.create).current;return NE(e.disposeEffect),e}function zq(){return typeof navigator>"u"?{userAgent:"",platform:"",maxTouchPoints:0}:{userAgent:navigator.userAgent,platform:navigator.platform??"",maxTouchPoints:navigator.maxTouchPoints??0}}const{userAgent:Lq,platform:Fq,maxTouchPoints:$q}=zq(),Fy=Lq.toLowerCase(),Jf=Fq.toLowerCase(),$y=/^i(os$|p)/.test(Jf)||Jf==="macintel"&&$q>1,HN="android",Aw=Jf===HN||Fy.includes(HN),TE=!$y&&Jf.startsWith("mac");Jf.startsWith("win");const Vq=TE||$y,ea=typeof CSS<"u"&&!!CSS.supports?.("-webkit-backdrop-filter:none");!ea&&Fy.includes("firefox");!ea&&Fy.includes("chrom");const Bq=Vq,ME=/jsdom|happydom/.test(Fy);function ts(e){e.preventDefault(),e.stopPropagation()}function Hq(e){return"nativeEvent"in e}function AE(e){return e.pointerType===""&&e.isTrusted?!0:Aw&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function OE(e){return ME?!1:!Aw&&e.width===0&&e.height===0||Aw&&e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType==="mouse"||e.width<1&&e.height<1&&e.pressure===0&&e.detail===0&&e.pointerType==="touch"}function ku(e,t){const n=["mouse","pen"];return t||n.push("",void 0),n.includes(e)}function Uq(e){const t=e.type;return t==="click"||t==="mousedown"||t==="keydown"||t==="keyup"}const Ow="data-base-ui-focusable",FD="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])",Vy="ArrowLeft",By="ArrowRight",$D="ArrowUp",DE="ArrowDown";function Jr(e){let t=e.activeElement;for(;t?.shadowRoot?.activeElement!=null;)t=t.shadowRoot.activeElement;return t}function yt(e,t){if(!e||!t)return!1;const n=t.getRootNode?.();if(e.contains(t))return!0;if(n&&Ou(n)){let r=t;for(;r;){if(e===r)return!0;r=r.parentNode||r.host}}return!1}function ro(e){return"composedPath"in e?e.composedPath()[0]:e.target}function Ig(e,t){if(!cn(e))return!1;const n=e;if(t.hasElement(n))return!n.hasAttribute("data-trigger-disabled");for(const[,r]of t.entries())if(yt(r,n))return!r.hasAttribute("data-trigger-disabled");return!1}function y0(e,t){if(t==null)return!1;if("composedPath"in e)return e.composedPath().includes(t);const n=e;return n.target!=null&&t.contains(n.target)}function qq(e){return e.matches("html,body")}function Hy(e){return Nn(e)&&e.matches(FD)}function Yq(e){return e?.closest(`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),${FD}`)!=null}function Dw(e){return e?e.getAttribute("role")==="combobox"&&Hy(e):!1}function Zq(e){if(!e||ME)return!0;try{return e.matches(":focus-visible")}catch{return!0}}function zg(e){return e?e.hasAttribute(Ow)?e:e.querySelector(`[${Ow}]`)||e:null}function Gq(e,t){return t!=null&&!ku(t)?0:typeof e=="function"?e():e}function Pw(e,t,n){const r=Gq(e,n);return typeof r=="number"?r:r?.[t]}function UN(e){return typeof e=="function"?e():e}function VD(e,t){return t||e==="click"||e==="mousedown"}function Kq(e){return e?.includes("mouse")&&e!=="mousedown"}const Kl="none",Xl="trigger-press",Dr="trigger-hover",If="trigger-focus",Uy="outside-press",zf="item-press",BD="close-press",Qa="focus-out",qy="escape-key",Iw="list-navigation",HD="cancel-open",Rf="sibling-open",Xq="disabled",qN="missing",YN="initial",PE="imperative-action",Qq="window-resize";function Bt(e,t,n,r){let o=!1,i=!1;const s=r??rr;return{reason:e,event:t??new Event("base-ui"),cancel(){o=!0},allowPropagation(){i=!0},get isCanceled(){return o},get isPropagationAllowed(){return i},trigger:n,...s}}const Wa=b.forwardRef(function(t,n){const[r,o]=b.useState();rt(()=>{Bq&&ea&&o("button")},[]);const i={tabIndex:0,role:r};return f.jsx("span",{...t,ref:n,style:AD,"aria-hidden":r?void 0:!0,...i,"data-base-ui-focus-guard":""})}),Pu=Math.min,Ys=Math.max,Lg=Math.round,jm=Math.floor,Zs=e=>({x:e,y:e}),Wq={left:"right",right:"left",bottom:"top",top:"bottom"};function UD(e,t,n){return Ys(e,Pu(t,n))}function Ja(e,t){return typeof e=="function"?e(t):e}function pi(e){return e.split("-")[0]}function il(e){return e.split("-")[1]}function IE(e){return e==="x"?"y":"x"}function zE(e){return e==="y"?"height":"width"}function fi(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function LE(e){return IE(fi(e))}function Jq(e,t,n){n===void 0&&(n=!1);const r=il(e),o=LE(e),i=zE(o);let s=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(s=Fg(s)),[s,Fg(s)]}function e7(e){const t=Fg(e);return[zw(e),t,zw(t)]}function zw(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const ZN=["left","right"],GN=["right","left"],t7=["top","bottom"],n7=["bottom","top"];function r7(e,t,n){switch(e){case"top":case"bottom":return n?t?GN:ZN:t?ZN:GN;case"left":case"right":return t?t7:n7;default:return[]}}function o7(e,t,n,r){const o=il(e);let i=r7(pi(e),n==="start",r);return o&&(i=i.map(s=>s+"-"+o),t&&(i=i.concat(i.map(zw)))),i}function Fg(e){const t=pi(e);return Wq[t]+e.slice(t.length)}function i7(e){var t,n,r,o;return{top:(t=e.top)!=null?t:0,right:(n=e.right)!=null?n:0,bottom:(r=e.bottom)!=null?r:0,left:(o=e.left)!=null?o:0}}function qD(e){return typeof e!="number"?i7(e):{top:e,right:e,bottom:e,left:e}}function eh(e){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}function Lf(e,t){return t<0||t>=e.length}function mg(e,t){return Bs(e.current,{disabledIndices:t})}function Lw(e,t){return Bs(e.current,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}function Bs(e,{startingIndex:t=-1,decrement:n=!1,disabledIndices:r,amount:o=1}={}){let i=t;do i+=n?-o:o;while(i>=0&&i<=e.length-1&&$g(e,i,r));return i}function $g(e,t,n){if(typeof n=="function"?n(t):n?.includes(t)??!1)return!0;const o=e[t];return o?!Yy(o)||o.matches(":disabled")?!0:!n&&(o.hasAttribute("disabled")||o.getAttribute("aria-disabled")==="true"):!1}function s7(e){return e.visibility==="hidden"||e.visibility==="collapse"}function Yy(e,t=e?Ko(e):null){return!e||!e.isConnected||!t||s7(t)?!1:typeof e.checkVisibility=="function"?e.checkVisibility():t.display!=="none"&&t.display!=="contents"}const a7='a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]';function l7(e){const t=e.assignedSlot;if(t)return t;if(e.parentElement)return e.parentElement;const n=e.getRootNode();return Ou(n)?n.host:null}function Fw(e){for(const t of Array.from(e.children))if(Zr(t)==="summary")return t;return null}function c7(e,t){const n=Fw(t);return!!n&&(e===n||yt(n,e))}function YD(e){const t=e?Zr(e):"";return e!=null&&e.matches(a7)&&(t!=="summary"||e.parentElement!=null&&Zr(e.parentElement)==="details"&&Fw(e.parentElement)===e)&&(t!=="details"||Fw(e)==null)&&(t!=="input"||e.type!=="hidden")}function ZD(e){if(!YD(e)||!e.isConnected||e.matches(":disabled"))return!1;for(let t=e;t;t=l7(t)){const n=t!==e,r=Zr(t)==="slot";if(t.hasAttribute("inert")||n&&Zr(t)==="details"&&!t.open&&!c7(e,t)||t.hasAttribute("hidden")||!r&&!u7(t,n))return!1}return!0}function u7(e,t){const n=Ko(e);return t?n.display!=="none":Yy(e,n)}function GD(e){const t=e.tabIndex;if(t<0){const n=Zr(e);if(n==="details"||n==="audio"||n==="video"||Nn(e)&&e.isContentEditable)return 0}return t}function x0(e){if(Zr(e)!=="input")return null;const t=e;return t.type==="radio"&&t.name!==""?t:null}function d7(e,t){const n=x0(e);if(!n)return!0;const r=t.find(o=>{const i=x0(o);return i?.name===n.name&&i.form===n.form&&i.checked});return r?r===n:t.find(o=>{const i=x0(o);return i?.name===n.name&&i.form===n.form})===n}function KD(e){if(Nn(e)&&Zr(e)==="slot"){const t=e.assignedElements({flatten:!0});if(t.length>0)return t}return Nn(e)&&e.shadowRoot?Array.from(e.shadowRoot.children):Array.from(e.children)}function XD(e,t){KD(e).forEach(n=>{YD(n)&&t.push(n),XD(n,t)})}function QD(e,t,n){KD(e).forEach(r=>{Nn(r)&&r.matches(t)&&n.push(r),QD(r,t,n)})}function FE(e){return ZD(e)&&GD(e)>=0}function WD(e){const t=[];return XD(e,t),t.filter(ZD)}function Dh(e){const t=WD(e);return t.filter(n=>GD(n)>=0&&d7(n,t))}function JD(e,t){const n=Dh(e),r=n.length;if(r===0)return;const o=Jr(en(e)),i=n.indexOf(o),s=i===-1?t===1?0:r-1:i+t;return n[s]}function $E(e){return JD(en(e).body,1)||e}function eP(e){return JD(en(e).body,-1)||e}function tP(e,t){if(!e)return null;const n=Dh(en(e).body),r=n.length;if(r===0)return null;const o=n.indexOf(e);if(o===-1)return null;const i=(o+t+r)%r;return n[i]}function f7(e){return tP(e,1)}function h7(e){return tP(e,-1)}function ju(e,t){const n=t||e.currentTarget,r=e.relatedTarget;return!r||!yt(n,r)}function p7(e){Dh(e).forEach(n=>{n.dataset.tabindex=n.getAttribute("tabindex")||"",n.setAttribute("tabindex","-1")})}function KN(e){const t=[];QD(e,"[data-tabindex]",t),t.forEach(n=>{const r=n.dataset.tabindex;delete n.dataset.tabindex,r?n.setAttribute("tabindex",r):n.removeAttribute("tabindex")})}function el(e,t,n=!0){return e.filter(o=>o.parentId===t).flatMap(o=>[...!n||o.context?.open?[o]:[],...el(e,o.id,n)])}function XN(e,t){let n=[],r=e.find(o=>o.id===t)?.parentId;for(;r;){const o=e.find(i=>i.id===r);r=o?.parentId,o&&(n=n.concat(o))}return n}function th(e){return`data-base-ui-${e}`}let Rm=0;function gg(e,t={}){const{preventScroll:n=!1,sync:r=!1,shouldFocus:o}=t;cancelAnimationFrame(Rm);function i(){o&&!o()||e?.focus({preventScroll:n})}if(r)return i(),Ar;const s=requestAnimationFrame(i);return Rm=s,()=>{Rm===s&&(cancelAnimationFrame(s),Rm=0)}}const v0={inert:new WeakMap,"aria-hidden":new WeakMap},QN="data-base-ui-inert",$w={inert:new WeakSet,"aria-hidden":new WeakSet};let df=new WeakMap,b0=0;function m7(e){return $w[e]}function nP(e){return e?Ou(e)?e.host:nP(e.parentNode):null}const WN=(e,t)=>t.map(n=>{if(e.contains(n))return n;const r=nP(n);return e.contains(r)?r:null}).filter(n=>n!=null),JN=e=>{const t=new Set;return e.forEach(n=>{let r=n;for(;r&&!t.has(r);)t.add(r),r=r.parentNode}),t},eT=(e,t,n)=>{const r=[],o=i=>{!i||n.has(i)||Array.from(i.children).forEach(s=>{Zr(s)!=="script"&&(t.has(s)?o(s):r.push(s))})};return o(e),r};function g7(e,t,n,r,{mark:o=!0}){let i=null;r?i="inert":n&&(i="aria-hidden");let s=null,c=null;const d=WN(t,e),u=o?eT(t,JN(d),new Set(d)):[],p=[],m=[];if(i){const g=v0[i],y=m7(i);c=y,s=g;const v=WN(t,Array.from(t.querySelectorAll("[aria-live]"))),S=d.concat(v);eT(t,JN(S),new Set(S)).forEach(E=>{const k=E.getAttribute(i),j=k!==null&&k!=="false",N=(g.get(E)||0)+1;g.set(E,N),p.push(E),N===1&&j&&y.add(E),j||E.setAttribute(i,i==="inert"?"":"true")})}return o&&u.forEach(g=>{const y=(df.get(g)||0)+1;df.set(g,y),m.push(g),y===1&&g.setAttribute(QN,"")}),b0+=1,()=>{s&&p.forEach(g=>{const v=(s.get(g)||0)-1;s.set(g,v),v||(!c?.has(g)&&i&&g.removeAttribute(i),c?.delete(g))}),o&&m.forEach(g=>{const y=(df.get(g)||0)-1;df.set(g,y),y||g.removeAttribute(QN)}),b0-=1,b0||(v0.inert=new WeakMap,v0["aria-hidden"]=new WeakMap,$w.inert=new WeakSet,$w["aria-hidden"]=new WeakSet,df=new WeakMap)}}function tT(e,t={}){const{ariaHidden:n=!1,inert:r=!1,mark:o=!0}=t,i=en(e[0]).body;return g7(e,i,n,r,{mark:o})}let nT=0;function y7(e,t="mui"){const[n,r]=b.useState(e),o=e||n;return b.useEffect(()=>{n==null&&(nT+=1,r(`${t}-${nT}`))},[n,t]),o}const rT=SE.useId;function Ql(e,t){if(rT!==void 0){const n=rT();return e??(t?`${t}-${n}`:n)}return y7(e,t)}function oT(e){if(!b.isValidElement(e))return null;const t=e,n=t.props;return(kE(19)?n?.ref:t.ref)??null}function Vw(e,t){if(e&&!t)return e;if(!e&&t)return t;if(e||t)return{...e,...t}}function x7(e,t){const n={};for(const r in e){const o=e[r];if(t?.hasOwnProperty(r)){const i=t[r](o);i!=null&&Object.assign(n,i);continue}o===!0?n[`data-${r.toLowerCase()}`]="":o&&(n[`data-${r.toLowerCase()}`]=o.toString())}return n}function v7(e,t){return typeof e=="function"?e(t):e}function b7(e,t){return typeof e=="function"?e(t):e}const VE={};function mi(e,t,n,r,o){if(!n&&!r&&!o&&!e)return Vg(t);let i=Vg(e);return t&&(i=_f(i,t)),n&&(i=_f(i,n)),r&&(i=_f(i,r)),o&&(i=_f(i,o)),i}function w7(e){if(e.length===0)return VE;if(e.length===1)return Vg(e[0]);let t=Vg(e[0]);for(let n=1;n<e.length;n+=1)t=_f(t,e[n]);return t}function Vg(e){return BE(e)?{...oP(e,VE)}:S7(e)}function _f(e,t){return BE(t)?oP(t,e):E7(e,t)}function S7(e){const t={...e};for(const n in t){const r=t[n];rP(n,r)&&(t[n]=iP(r))}return t}function E7(e,t){if(!t)return e;for(const n in t){const r=t[n];switch(n){case"style":{e[n]=Vw(e.style,r);break}case"className":{e[n]=sP(e.className,r);break}default:rP(n,r)?e[n]=C7(e[n],r):e[n]=r}}return e}function rP(e,t){const n=e.charCodeAt(0),r=e.charCodeAt(1),o=e.charCodeAt(2);return n===111&&r===110&&o>=65&&o<=90&&(typeof t=="function"||typeof t>"u")}function BE(e){return typeof e=="function"}function oP(e,t){return BE(e)?e(t):e??VE}function C7(e,t){return t?e?(...n)=>{const r=n[0];if(aP(r)){const i=r;Bg(i);const s=t(...n);return i.baseUIHandlerPrevented||e?.(...n),s}const o=t(...n);return e?.(...n),o}:iP(t):e}function iP(e){return e&&((...t)=>{const n=t[0];return aP(n)&&Bg(n),e(...t)})}function Bg(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}function sP(e,t){return t?e?t+" "+e:t:e}function aP(e){return e!=null&&typeof e=="object"&&"nativeEvent"in e}function wn(e,t,n={}){const r=t.render,o=k7(t,n);if(n.enabled===!1)return null;const i=n.state??rr;return _7(e,r,o,i)}function k7(e,t={}){const{className:n,style:r,render:o}=e,{state:i=rr,ref:s,props:c,stateAttributesMapping:d,enabled:u=!0}=t,p=u?v7(n,i):void 0,m=u?b7(r,i):void 0,g=u?x7(i,d):rr,y=u&&c?j7(c):void 0,v=u?Vw(g,y)??{}:rr;return typeof document<"u"&&(u?Array.isArray(s)?v.ref=sq([v.ref,oT(o),...s]):v.ref=Xa(v.ref,oT(o),s):Xa(null,null)),u?(p!==void 0&&(v.className=sP(v.className,p)),m!==void 0&&(v.style=Vw(v.style,m)),v):rr}function j7(e){return Array.isArray(e)?w7(e):mi(void 0,e)}const R7=Symbol.for("react.lazy");function _7(e,t,n,r){if(t){if(typeof t=="function")return t(n,r);const o=mi(n,t.props);o.ref=n.ref;let i=t;return i?.$$typeof===R7&&(i=b.Children.toArray(t)[0]),b.cloneElement(i,o)}if(e&&typeof e=="string")return N7(e,n);throw new Error(Sr(8))}function N7(e,t){return e==="button"?b.createElement("button",{type:"button",...t,key:t.key}):e==="img"?b.createElement("img",{alt:"",...t,key:t.key}):b.createElement(e,t)}const T7=500,lP=500,M7={style:{transition:"none"}},cP="data-base-ui-click-trigger",uP={fallbackAxisSide:"none"},dP={fallbackAxisSide:"end"},A7={clipPath:"inset(50%)",position:"fixed",top:0,left:0},fP=b.createContext(null),hP=()=>b.useContext(fP),O7=th("portal");function D7(e={}){const{ref:t,container:n,componentProps:r=rr,elementProps:o}=e,i=Ql(),c=hP()?.portalNode,[d,u]=b.useState(null),[p,m]=b.useState(null),g=st(w=>{w!==null&&m(w)}),y=b.useRef(null);rt(()=>{if(n===null){y.current&&(y.current=null,m(null),u(null));return}const w=(n&&(jE(n)?n:n.current))??c??document.body;if(w==null){y.current&&(y.current=null,m(null),u(null));return}y.current!==w&&(y.current=w,m(null),u(w))},[n,c]);const v=wn("div",r,{ref:[t,g],props:[{id:i,[O7]:""},o]}),S=d&&v?Go.createPortal(v,d):null;return{node:p,nodeId:b.isValidElement(v)?v.props.id:void 0,subtree:S}}const Zy=b.forwardRef(function(t,n){const{render:r,className:o,style:i,children:s,container:c,...d}=t,{node:u,nodeId:p,subtree:m}=D7({container:c,ref:n,componentProps:t,elementProps:d}),g=b.useRef(null),y=b.useRef(null),v=b.useRef(null),S=b.useRef(null),[w,E]=b.useState(null),k=b.useRef(!1),j=w?.modal,N=w?.open,A=!!w&&!w.modal&&w.open&&!!u;b.useEffect(()=>{if(!u||j)return;function M(T){u&&T.relatedTarget&&ju(T)&&(T.type==="focusin"?k.current&&(KN(u),k.current=!1):(p7(u),k.current=!0))}return as(Wt(u,"focusin",M,!0),Wt(u,"focusout",M,!0))},[u,j]),rt(()=>{!u||N!==!0||!k.current||(KN(u),k.current=!1)},[N,u]);const R=b.useMemo(()=>({beforeOutsideRef:g,afterOutsideRef:y,beforeInsideRef:v,afterInsideRef:S,portalNode:u,setFocusManagerState:E}),[u]);return f.jsxs(b.Fragment,{children:[m,f.jsxs(fP.Provider,{value:R,children:[A&&u&&f.jsx(Wa,{"data-type":"outside",ref:g,onFocus:M=>{if(ju(M,u))v.current?.focus();else{const T=w?w.domReference:null;eP(T)?.focus()}}}),A&&u&&f.jsx("span",{"aria-owns":p,style:A7}),u&&Go.createPortal(s,u),A&&u&&f.jsx(Wa,{"data-type":"outside",ref:y,onFocus:M=>{if(ju(M,u))S.current?.focus();else{const T=w?w.domReference:null;$E(T)?.focus(),w?.closeOnFocusOut&&w?.onOpenChange(!1,Bt(Qa,M.nativeEvent))}}})]})]})});function pP(){const e=new Map;return{emit(t,n){e.get(t)?.forEach(r=>r(n))},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n)},off(t,n){e.get(t)?.delete(n)}}}class HE{nodesRef={current:[]};events=pP();addNode(t){this.nodesRef.current.push(t)}removeNode(t){const n=this.nodesRef.current.findIndex(r=>r===t);n!==-1&&this.nodesRef.current.splice(n,1)}}const mP=b.createContext(null),gP=b.createContext(null),sl=()=>b.useContext(mP)?.id||null,al=e=>{const t=b.useContext(gP);return e??t};function UE(e){const t=Ql(),n=al(e),r=sl();return rt(()=>{if(!t)return;const o={id:t,parentId:r};return n?.addNode(o),()=>{n?.removeNode(o)}},[n,t,r]),t}function yP(e){const{children:t,id:n}=e,r=sl();return f.jsx(mP.Provider,{value:b.useMemo(()=>({id:n,parentId:r}),[n,r]),children:t})}function xP(e){const{children:t,externalTree:n}=e,r=Yr(()=>n??new HE).current;return f.jsx(gP.Provider,{value:r,children:t})}function $s(e){return e==null?e:"current"in e?e.current:e}function P7(e,t){const n=Gn(ro(e));return e instanceof n.KeyboardEvent?"keyboard":e instanceof n.FocusEvent?t||"keyboard":"pointerType"in e?e.pointerType||"keyboard":"touches"in e?"touch":e instanceof n.MouseEvent?t||(e.detail===0?"keyboard":"mouse"):""}const iT=20;let Ya=[];function qE(){Ya=Ya.filter(e=>e.deref()?.isConnected)}function sT(e){qE(),e&&Zr(e)!=="body"&&(Ya.push(new WeakRef(e)),Ya.length>iT&&(Ya=Ya.slice(-iT)))}function aT(){return qE(),Ya[Ya.length-1]?.deref()}function I7(e){return e?FE(e)?e:Dh(e)[0]||e:null}function lT(e){if(e.hasAttribute("tabindex")&&!e.hasAttribute("data-tabindex")||!e.getAttribute("role")?.includes("dialog"))return;const n=WD(e).filter(o=>{const i=o.getAttribute("data-tabindex")||"";return FE(o)||o.hasAttribute("data-tabindex")&&!i.startsWith("-")}),r=e.getAttribute("tabindex");n.length===0?r!=="0"&&(e.setAttribute("tabindex","0"),e.setAttribute("data-tabindex","0")):(r!=="-1"||e.hasAttribute("data-tabindex")&&e.getAttribute("data-tabindex")!=="-1")&&(e.setAttribute("tabindex","-1"),e.setAttribute("data-tabindex","-1"))}function Gy(e){const{context:t,children:n,disabled:r=!1,initialFocus:o=!0,returnFocus:i=!0,restoreFocus:s=!1,modal:c=!0,closeOnFocusOut:d=!0,openInteractionType:u="",nextFocusableElement:p,previousFocusableElement:m,beforeContentFocusGuardRef:g,externalTree:y,getInsideElements:v}=e,S="rootStore"in t?t.rootStore:t,w=S.useState("open"),E=S.useState("domReferenceElement"),k=S.useState("floatingElement"),{events:j,dataRef:N}=S.context,A=st(()=>N.current.floatingContext?.nodeId),R=o===!1,M=Dw(E)&&R,T=hr(o),O=hr(i),z=hr(u),q=hr(w),$=al(y),G=hP(),L=b.useRef(!1),F=b.useRef(!1),P=b.useRef(!1),I=b.useRef(null),Y=b.useRef(""),Z=b.useRef(""),D=b.useRef(null),H=b.useRef(null),U=Xa(D,g,G?.beforeInsideRef),B=Xa(H,G?.afterInsideRef),X=qr(),J=qr(),Q=Du(),oe=G!=null,W=zg(k),ne=st((pe=W)=>pe?Dh(pe):[]),je=st(()=>v?.().filter(pe=>pe!=null)??[]);b.useEffect(()=>{if(r||!c)return;function pe(ge){ge.key==="Tab"&&yt(W,Jr(en(W)))&&ne().length===0&&!M&&ts(ge)}const re=en(W);return Wt(re,"keydown",pe)},[r,W,c,M,ne]),b.useEffect(()=>{if(r||!w)return;const pe=en(W);function re(){P.current=!1}function ge(De){const we=ro(De),$e=je(),Me=yt(k,we)||yt(E,we)||yt(G?.portalNode,we)||$e.some(Le=>Le===we||yt(Le,we));P.current=!Me,Z.current=De.pointerType||"keyboard",we?.closest(`[${cP}]`)&&(F.current=!0,J.start(0,()=>{F.current=!1}))}function _e(){Z.current="keyboard"}return as(Wt(pe,"pointerdown",ge,!0),Wt(pe,"pointerup",re,!0),Wt(pe,"pointercancel",re,!0),Wt(pe,"keydown",_e,!0),re)},[r,k,E,W,w,G,J,je]),b.useEffect(()=>{if(r||!d)return;const pe=en(W);function re(){F.current=!0,J.start(0,()=>{F.current=!1})}function ge($e){const Me=ro($e);FE(Me)&&(I.current=Me)}function _e($e){const Me=$e.relatedTarget,Le=$e.currentTarget,He=ro($e);c&&Me==null&&He!=null&&yt(k,He)&&sT(He),queueMicrotask(()=>{const Ge=A(),ot=S.context.triggerElements,me=je(),ke=Me?.hasAttribute(th("focus-guard"))&&[D.current,H.current,G?.beforeInsideRef.current,G?.afterInsideRef.current,G?.beforeOutsideRef.current,G?.afterOutsideRef.current,$s(m),$s(p)].includes(Me),de=!(yt(E,Me)||yt(k,Me)||yt(Me,k)||yt(G?.portalNode,Me)||me.some(ue=>ue===Me||yt(ue,Me))||ot.hasMatchingElement(ue=>yt(ue,Me))||ke||$&&(el($.nodesRef.current,Ge).find(ue=>yt(ue.context?.elements.floating,Me)||yt(ue.context?.elements.domReference,Me))||XN($.nodesRef.current,Ge).find(ue=>[ue.context?.elements.floating,zg(ue.context?.elements.floating)].includes(Me)||ue.context?.elements.domReference===Me)));if(Le===E&&W&&lT(W),s&&Le!==E&&!Yy(He)&&Jr(pe)===pe.body){if(Nn(W)&&(W.focus(),s==="popup")){Q.request(()=>{W.focus()});return}const ue=ne(),Se=I.current,Ue=(Se&&ue.includes(Se)?Se:null)||ue[ue.length-1]||W;Nn(Ue)&&Ue.focus()}if(N.current.insideReactTree){N.current.insideReactTree=!1;return}(M||!c)&&Me&&de&&!F.current&&(M||Me!==aT())&&(L.current=!0,S.setOpen(!1,Bt(Qa,$e)))})}function De(){P.current||(N.current.insideReactTree=!0,X.start(0,()=>{N.current.insideReactTree=!1}))}const we=Nn(E)?E:null;if(!(!k&&!we))return as(we&&Wt(we,"focusout",_e),we&&Wt(we,"pointerdown",re),k&&Wt(k,"focusin",ge),k&&Wt(k,"focusout",_e),k&&G&&Wt(k,"focusout",De,!0))},[r,E,k,W,c,$,G,S,d,s,ne,M,A,N,X,J,Q,p,m,je]),b.useEffect(()=>{if(r||!k||!w)return;const pe=Array.from(G?.portalNode?.querySelectorAll(`[${th("portal")}]`)||[]),ge=($?XN($.nodesRef.current,A()):[]).find(Le=>Dw(Le.context?.elements.domReference||null))?.context?.elements.domReference,De=[...[k,...pe,D.current,H.current,G?.beforeOutsideRef.current,G?.afterOutsideRef.current,...je()],ge,$s(m),$s(p),M?E:null].filter(Le=>Le!=null),we=tT(De,{ariaHidden:c||M,mark:!1}),$e=[k,...pe].filter(Le=>Le!=null),Me=tT($e);return()=>{Me(),we()}},[w,r,E,k,c,G,M,$,A,p,m,je]),rt(()=>{if(!w||r||!Nn(W))return;Y.current="",Z.current="";const pe=en(W),re=Jr(pe);queueMicrotask(()=>{const ge=T.current,_e=typeof ge=="function"?ge(z.current||""):ge;if(_e===void 0||_e===!1||yt(W,re))return;let we=null;const $e=()=>(we==null&&(we=ne(W)),we[0]||W);let Me;_e===!0||_e===null?Me=$e():Me=$s(_e),Me=Me||$e();const Le=yt(W,Jr(pe));gg(Me,{preventScroll:Me===W,shouldFocus(){if(!q.current)return!1;if(Le)return!0;const He=Jr(pe);return!(He!==Me&&yt(W,He))}})})},[r,w,W,ne,T,z,q]),rt(()=>{if(r||!W)return;const pe=en(W),re=Jr(pe),ge=z.current==null;sT(re);function _e(we){if(we.open||(Y.current=P7(we.nativeEvent,Z.current)),we.reason===Dr&&we.nativeEvent.type==="mouseleave"&&(L.current=!0),we.reason===Uy)if(we.nested)L.current=!1;else if(AE(we.nativeEvent)||OE(we.nativeEvent))L.current=!1;else{let $e=!1;en(W).createElement("div").focus({get preventScroll(){return $e=!0,!1}}),$e?L.current=!1:L.current=!0}}j.on("openchange",_e);function De(we){const $e=O.current;let Me=typeof $e=="function"?$e(we):$e;if(Me===void 0||Me===!1)return null;Me===null&&(Me=!0);const Le=E?.isConnected?E:null,He=re?.isConnected&&Zr(re)!=="body"?re:null;let Ge=ge?He||Le:Le||He;return Ge||(Ge=aT()||null),typeof Me=="boolean"?Ge:$s(Me)||Ge||null}return()=>{j.off("openchange",_e);const we=Jr(pe),$e=je(),Me=yt(k,we)||$e.some(ot=>ot===we||yt(ot,we))||$&&el($.nodesRef.current,A(),!1).some(ot=>yt(ot.context?.elements.floating,we)),Le=O.current,He=Y.current,Ge=De(He);queueMicrotask(()=>{const ot=I7(Ge),me=typeof Le!="boolean";if(Le&&!L.current&&Nn(ot)&&(!(!me&&ot!==we&&we!==pe.body)||Me)){const ke={preventScroll:!0};He==="keyboard"&&(ke.focusVisible=!0),ot.focus(ke)}L.current=!1})}},[r,k,W,O,z,j,$,E,A,je]),rt(()=>{if(!ea||w||!k)return;const pe=Jr(en(k));!Nn(pe)||!Hy(pe)||yt(k,pe)&&pe.blur()},[w,k]),rt(()=>{if(!(r||!G))return G.setFocusManagerState({modal:c,closeOnFocusOut:d,open:w,onOpenChange:S.setOpen,domReference:E}),()=>{G.setFocusManagerState(null)}},[r,G,c,w,S,d,E]),rt(()=>{if(!(r||!W))return lT(W),()=>{queueMicrotask(qE)}},[r,W]);const Ee=!r&&(c?!M:!0)&&(oe||c);return f.jsxs(b.Fragment,{children:[Ee&&f.jsx(Wa,{"data-type":"inside",ref:U,onFocus:pe=>{if(c){const re=ne();gg(re[re.length-1])}else G?.portalNode&&(L.current=!1,ju(pe,G.portalNode)?$E(E)?.focus():$s(m??G.beforeOutsideRef)?.focus())}}),n,Ee&&f.jsx(Wa,{"data-type":"inside",ref:B,onFocus:pe=>{c?gg(ne()[0]):G?.portalNode&&(d&&(L.current=!0),ju(pe,G.portalNode)?eP(E)?.focus():$s(p??G.afterOutsideRef)?.focus())}})]})}function YE(e,t={}){const{enabled:n=!0,event:r="click",toggle:o=!0,ignoreMouse:i=!1,stickIfOpen:s=!0,touchOpenDelay:c=0,reason:d=Xl}=t,u="rootStore"in e?e.rootStore:e,p=u.context.dataRef,m=b.useRef(void 0),g=Du(),y=qr(),v=b.useMemo(()=>{function S(E,k,j,N){const A=Bt(d,k,j);E&&N==="touch"&&c>0?y.start(c,()=>{u.setOpen(!0,A)}):u.setOpen(E,A)}function w(E,k,j){const N=p.current.openEvent,A=u.select("domReferenceElement")!==k;return E&&A||!E||!o?!0:N&&s?!j(N.type):!1}return{onPointerDown(E){m.current=ku(E.pointerType,!0)&&OE(E.nativeEvent)?"virtual":E.pointerType},onMouseDown(E){const k=m.current,j=E.nativeEvent,N=u.select("open");if(E.button!==0||r==="click"||ku(k,!0)&&i)return;const A=w(N,E.currentTarget,T=>T==="click"||T==="mousedown"),R=ro(j);if(Hy(R)){S(A,j,R,k);return}const M=E.currentTarget;g.request(()=>{S(A,j,M,k)})},onClick(E){if(r==="mousedown-only")return;const k=m.current;if(r==="mousedown"&&k){m.current=void 0;return}if(ku(k,!0)&&i)return;const j=u.select("open"),N=w(j,E.currentTarget,A=>A==="click"||A==="mousedown"||A==="keydown"||A==="keyup");S(N,E.nativeEvent,E.currentTarget,k)},onKeyDown(){m.current=void 0}}},[p,r,i,d,u,s,o,g,y,c]);return b.useMemo(()=>n?{reference:v}:rr,[n,v])}function z7(){return!1}function L7(e){return{escapeKey:typeof e=="boolean"?e:e?.escapeKey??!1,outsidePress:typeof e=="boolean"?e:e?.outsidePress??!0}}function Ky(e,t={}){const{enabled:n=!0,escapeKey:r=!0,outsidePress:o=!0,outsidePressEvent:i="sloppy",referencePress:s=z7,bubbles:c,externalTree:d}=t,u="rootStore"in e?e.rootStore:e,p=u.useState("open"),m=u.useState("floatingElement"),{dataRef:g}=u.context,y=al(d),v=st(typeof o=="function"?o:()=>!1),S=typeof o=="function"?v:o,w=S!==!1,E=st(()=>i),{escapeKey:k,outsidePress:j}=L7(c),N=b.useRef(!1),A=b.useRef(!1),R=b.useRef(!1),M=b.useRef(!1),T=b.useRef(""),O=b.useRef(null),z=qr(),q=qr(),$=st(()=>{q.clear(),g.current.insideReactTree=!1}),G=st(U=>{const B=g.current.floatingContext?.nodeId;return(y?el(y.nodesRef.current,B):[]).some(J=>J.context?.open&&!J.context.dataRef.current[U])}),L=st(U=>y0(U,u.select("floatingElement"))||y0(U,u.select("domReferenceElement"))),F=st(U=>{s()&&u.setOpen(!1,Bt(Xl,U.nativeEvent))}),P=st(U=>{if(!p||!n||!r||U.key!=="Escape"||M.current||!k&&G("__escapeKeyBubbles"))return;const B=Hq(U)?U.nativeEvent:U,X=Bt(qy,B);u.setOpen(!1,X),X.isCanceled||U.preventDefault(),!k&&!X.isPropagationAllowed&&U.stopPropagation()}),I=st(()=>{g.current.insideReactTree=!0,q.start(0,$)}),Y=st(U=>{if(!p||!n||U.button!==0)return;const B=ro(U.nativeEvent);yt(u.select("floatingElement"),B)&&(N.current||(N.current=!0,A.current=!1))}),Z=st(U=>{!p||!n||(U.defaultPrevented||U.nativeEvent.defaultPrevented)&&N.current&&(A.current=!0)});b.useEffect(()=>{if(!p||!n)return $;g.current.__escapeKeyBubbles=k,g.current.__outsidePressBubbles=j;const U=new zi,B=new zi;function X(){U.clear(),M.current=!0}function J(){U.start(ea?5:0,()=>{M.current=!1})}function Q(){R.current=!0,B.start(0,()=>{R.current=!1})}function oe(){N.current=!1,A.current=!1}function W(){const me=T.current,ke=me==="pen"||!me?"mouse":me,de=E(),ue=typeof de=="function"?de():de;return typeof ue=="string"?ue:ue[ke]}function ne(me){const ke=W();return ke==="intentional"&&me.type!=="click"||ke==="sloppy"&&me.type==="click"}function je(me){const ke=g.current.floatingContext?.nodeId,de=y&&el(y.nodesRef.current,ke).some(ue=>y0(me,ue.context?.elements.floating));return L(me)||de}function Ee(me){if(ne(me)){me.type!=="click"&&!L(me)&&(B.clear(),R.current=!1),$();return}if(g.current.insideReactTree){$();return}const ke=ro(me),de=`[${th("inert")}]`,ue=cn(ke)?ke.getRootNode():null,Se=Array.from((Ou(ue)?ue:en(u.select("floatingElement"))).querySelectorAll(de)),Ue=u.context.triggerElements;if(ke&&(Ue.hasElement(ke)||Ue.hasMatchingElement(kt=>yt(kt,ke))))return;let Ye=cn(ke)?ke:null;for(;Ye&&!qs(Ye);){const kt=Xs(Ye);if(qs(kt)||!cn(kt))break;Ye=kt}if(!(Se.length&&cn(ke)&&!qq(ke)&&!yt(ke,u.select("floatingElement"))&&Se.every(kt=>!yt(Ye,kt)))){if(Nn(ke)&&!("touches"in me)){const kt=qs(ke),ee=Ko(ke),ie=/auto|scroll/,le=kt||ie.test(ee.overflowX),Ce=kt||ie.test(ee.overflowY),ve=le&&ke.clientWidth>0&&ke.scrollWidth>ke.clientWidth,Be=Ce&&ke.clientHeight>0&&ke.scrollHeight>ke.clientHeight,Pe=ee.direction==="rtl",qe=Be&&(Pe?me.offsetX<=ke.offsetWidth-ke.clientWidth:me.offsetX>ke.clientWidth),Ke=ve&&me.offsetY>ke.clientHeight;if(qe||Ke)return}if(!je(me)){if(W()==="intentional"&&R.current){B.clear(),R.current=!1;return}typeof S=="function"&&!S(me)||G("__outsidePressBubbles")||(u.setOpen(!1,Bt(Uy,me)),$())}}}function pe(me){W()!=="sloppy"||me.pointerType==="touch"||!u.select("open")||!n||L(me)||Ee(me)}function re(me){if(W()!=="sloppy"||!u.select("open")||!n||L(me))return;const ke=me.touches[0];ke&&(O.current={startTime:Date.now(),startX:ke.clientX,startY:ke.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},z.start(1e3,()=>{O.current&&(O.current.dismissOnTouchEnd=!1,O.current.dismissOnMouseDown=!1)}))}function ge(me,ke){const de=ro(me);if(!de)return;const ue=Wt(de,me.type,()=>{ke(me),ue()})}function _e(me){T.current="touch",ge(me,re)}function De(me){z.clear(),me.type==="pointerdown"&&(T.current=me.pointerType),!(me.type==="mousedown"&&O.current&&!O.current.dismissOnMouseDown)&&ge(me,ke=>{ke.type==="pointerdown"?pe(ke):Ee(ke)})}function we(me){if(!N.current)return;const ke=A.current;if(oe(),W()==="intentional"){if(me.type==="pointercancel"){ke&&Q();return}if(!je(me)){if(ke){Q();return}typeof S=="function"&&!S(me)||(B.clear(),R.current=!0,$())}}}function $e(me){if(W()!=="sloppy"||!O.current||L(me))return;const ke=me.touches[0];if(!ke)return;const de=Math.abs(ke.clientX-O.current.startX),ue=Math.abs(ke.clientY-O.current.startY),Se=Math.sqrt(de*de+ue*ue);Se>5&&(O.current.dismissOnTouchEnd=!0),Se>10&&(Ee(me),z.clear(),O.current=null)}function Me(me){ge(me,$e)}function Le(me){W()!=="sloppy"||!O.current||L(me)||(O.current.dismissOnTouchEnd&&Ee(me),z.clear(),O.current=null)}function He(me){ge(me,Le)}const Ge=en(m),ot=as(r&&as(Wt(Ge,"keydown",P),Wt(Ge,"compositionstart",X),Wt(Ge,"compositionend",J)),w&&as(Wt(Ge,"click",De,!0),Wt(Ge,"pointerdown",De,!0),Wt(Ge,"pointerup",we,!0),Wt(Ge,"pointercancel",we,!0),Wt(Ge,"mousedown",De,!0),Wt(Ge,"mouseup",we,!0),Wt(Ge,"touchstart",_e,!0),Wt(Ge,"touchmove",Me,!0),Wt(Ge,"touchend",He,!0)));return()=>{ot(),U.clear(),B.clear(),oe(),R.current=!1,$()}},[g,m,r,w,S,p,n,k,j,P,$,E,G,L,y,u,z]);const D=b.useMemo(()=>({onKeyDown:P,onPointerDown:F,onClick:F}),[P,F]),H=b.useMemo(()=>({onKeyDown:P,onPointerDown:Z,onMouseDown:Z,onClickCapture:I,onMouseDownCapture(U){I(),Y(U)},onPointerDownCapture(U){I(),Y(U)},onMouseUpCapture:I,onTouchEndCapture:I,onTouchMoveCapture:I}),[P,I,Y,Z]);return b.useMemo(()=>n?{reference:D,floating:H,trigger:D}:{},[n,D,H])}function cT(e,t,n){let{reference:r,floating:o}=e;const i=fi(t),s=LE(t),c=zE(s),d=pi(t),u=i==="y",p=r.x+r.width/2-o.width/2,m=r.y+r.height/2-o.height/2,g=r[c]/2-o[c]/2;let y;switch(d){case"top":y={x:p,y:r.y-o.height};break;case"bottom":y={x:p,y:r.y+r.height};break;case"right":y={x:r.x+r.width,y:m};break;case"left":y={x:r.x-o.width,y:m};break;default:y={x:r.x,y:r.y}}const v=il(t);return v&&(y[s]+=g*(v==="end"?1:-1)*(n&&u?-1:1)),y}async function F7(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:i,rects:s,elements:c,strategy:d}=e,{boundary:u="clippingAncestors",rootBoundary:p="viewport",elementContext:m="floating",altBoundary:g=!1,padding:y=0}=Ja(t,e),v=qD(y),w=c[g?m==="floating"?"reference":"floating":m],E=eh(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(w)))==null||n?w:w.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(c.floating)),boundary:u,rootBoundary:p,strategy:d})),k=m==="floating"?{x:r,y:o,width:s.floating.width,height:s.floating.height}:s.reference,j=await(i.getOffsetParent==null?void 0:i.getOffsetParent(c.floating)),N=await(i.isElement==null?void 0:i.isElement(j))&&await(i.getScale==null?void 0:i.getScale(j))||{x:1,y:1},A=eh(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:k,offsetParent:j,strategy:d}):k);return{top:(E.top-A.top+v.top)/N.y,bottom:(A.bottom-E.bottom+v.bottom)/N.y,left:(E.left-A.left+v.left)/N.x,right:(A.right-E.right+v.right)/N.x}}const $7=50,V7=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:s}=n,c=s.detectOverflow?s:{...s,detectOverflow:F7},d=await(s.isRTL==null?void 0:s.isRTL(t));let u=await s.getElementRects({reference:e,floating:t,strategy:o}),{x:p,y:m}=cT(u,r,d),g=r,y=0;const v={};for(let S=0;S<i.length;S++){const w=i[S];if(!w)continue;const{name:E,fn:k}=w,{x:j,y:N,data:A,reset:R}=await k({x:p,y:m,initialPlacement:r,placement:g,strategy:o,middlewareData:v,rects:u,platform:c,elements:{reference:e,floating:t}});p=j??p,m=N??m,v[E]={...v[E],...A},R&&y<$7&&(y++,typeof R=="object"&&(R.placement&&(g=R.placement),R.rects&&(u=R.rects===!0?await s.getElementRects({reference:e,floating:t,strategy:o}):R.rects),{x:p,y:m}=cT(u,g,d)),S=-1)}return{x:p,y:m,placement:g,strategy:o,middlewareData:v}},B7=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:i,rects:s,initialPlacement:c,platform:d,elements:u}=t,{mainAxis:p=!0,crossAxis:m=!0,fallbackPlacements:g,fallbackStrategy:y="bestFit",fallbackAxisSideDirection:v="none",flipAlignment:S=!0,...w}=Ja(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const E=pi(o),k=fi(c),j=pi(c)===c,N=await(d.isRTL==null?void 0:d.isRTL(u.floating)),A=g||(j||!S?[Fg(c)]:e7(c)),R=v!=="none";!g&&R&&A.push(...o7(c,S,v,N));const M=[c,...A],T=await d.detectOverflow(t,w),O=[];let z=((r=i.flip)==null?void 0:r.overflows)||[];if(p&&O.push(T[E]),m){const L=Jq(o,s,N);O.push(T[L[0]],T[L[1]])}if(z=[...z,{placement:o,overflows:O}],!O.every(L=>L<=0)){var q,$;const L=(((q=i.flip)==null?void 0:q.index)||0)+1,F=M[L];if(F&&(!(m==="alignment"?k!==fi(F):!1)||z.every(Y=>fi(Y.placement)===k?Y.overflows[0]>0:!0)))return{data:{index:L,overflows:z},reset:{placement:F}};let P=($=z.filter(I=>I.overflows[0]<=0).sort((I,Y)=>I.overflows[1]-Y.overflows[1])[0])==null?void 0:$.placement;if(!P)switch(y){case"bestFit":{var G;const I=(G=z.filter(Y=>{if(R){const Z=fi(Y.placement);return Z===k||Z==="y"}return!0}).map(Y=>[Y.placement,Y.overflows.filter(Z=>Z>0).reduce((Z,D)=>Z+D,0)]).sort((Y,Z)=>Y[1]-Z[1])[0])==null?void 0:G[0];I&&(P=I);break}case"initialPlacement":P=c;break}if(o!==P)return{reset:{placement:P}}}return{}}}},vP=new Set(["left","top"]);async function H7(e,t){const{placement:n,platform:r,elements:o}=e,i=await(r.isRTL==null?void 0:r.isRTL(o.floating)),s=pi(n),c=il(n),d=fi(n)==="y",u=vP.has(s)?-1:1,p=i&&d?-1:1,m=Ja(t,e);let{mainAxis:g,crossAxis:y,alignmentAxis:v}=typeof m=="number"?{mainAxis:m,crossAxis:0,alignmentAxis:null}:{mainAxis:m.mainAxis||0,crossAxis:m.crossAxis||0,alignmentAxis:m.alignmentAxis};return c&&typeof v=="number"&&(y=c==="end"?v*-1:v),d?{x:y*p,y:g*u}:{x:g*u,y:y*p}}const U7=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:i,placement:s,middlewareData:c}=t,d=await H7(t,e);return s===((n=c.offset)==null?void 0:n.placement)&&(r=c.arrow)!=null&&r.alignmentOffset?{}:{x:o+d.x,y:i+d.y,data:{...d,placement:s}}}}},q7=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o,platform:i}=t,{mainAxis:s=!0,crossAxis:c=!1,limiter:d={fn:k=>{let{x:j,y:N}=k;return{x:j,y:N}}},...u}=Ja(e,t),p={x:n,y:r},m=await i.detectOverflow(t,u),g=fi(o),y=IE(g);let v=p[y],S=p[g];const w=(k,j)=>UD(j+m[k==="y"?"top":"left"],j,j-m[k==="y"?"bottom":"right"]);s&&(v=w(y,v)),c&&(S=w(g,S));const E=d.fn({...t,[y]:v,[g]:S});return{...E,data:{x:E.x-n,y:E.y-r,enabled:{[y]:s,[g]:c}}}}}},Y7=function(e){return e===void 0&&(e={}),{options:e,fn(t){var n,r;const{x:o,y:i,placement:s,rects:c,middlewareData:d}=t,{offset:u=0,mainAxis:p=!0,crossAxis:m=!0}=Ja(e,t),g={x:o,y:i},y=fi(s),v=IE(y);let S=g[v],w=g[y];const E=Ja(u,t),k=typeof E=="number"?{mainAxis:E,crossAxis:0}:{mainAxis:(n=E.mainAxis)!=null?n:0,crossAxis:(r=E.crossAxis)!=null?r:0};if(p){const A=v==="y"?"height":"width",R=c.reference[v]-c.floating[A]+k.mainAxis,M=c.reference[v]+c.reference[A]-k.mainAxis;S<R?S=R:S>M&&(S=M)}if(m){var j,N;const A=v==="y"?"width":"height",R=vP.has(pi(s)),M=c.reference[y]-c.floating[A]+(R&&((j=d.offset)==null?void 0:j[y])||0)+(R?0:k.crossAxis),T=c.reference[y]+c.reference[A]+(R?0:((N=d.offset)==null?void 0:N[y])||0)-(R?k.crossAxis:0);w<M?w=M:w>T&&(w=T)}return{[v]:S,[y]:w}}}},Z7=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){const{placement:n,rects:r,platform:o,elements:i}=t,{apply:s=()=>{},...c}=Ja(e,t),d=await o.detectOverflow(t,c),u=pi(n),p=il(n),m=fi(n)==="y",{width:g,height:y}=r.floating;let v,S;u==="top"||u==="bottom"?(v=u,S=p===(await(o.isRTL==null?void 0:o.isRTL(i.floating))?"start":"end")?"left":"right"):(S=u,v=p==="end"?"top":"bottom");const w=y-d.top-d.bottom,E=g-d.left-d.right,k=Pu(y-d[v],w),j=Pu(g-d[S],E),N=t.middlewareData.shift,A=!N;let R=k,M=j;N!=null&&N.enabled.x&&(M=E),N!=null&&N.enabled.y&&(R=w),A&&!p&&(m?M=g-2*Ys(d.left,d.right):R=y-2*Ys(d.top,d.bottom)),await s({...t,availableWidth:M,availableHeight:R});const T=await o.getDimensions(i.floating);return g!==T.width||y!==T.height?{reset:{rects:!0}}:{}}}};function bP(e){const t=Ko(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=Nn(e),i=o?e.offsetWidth:n,s=o?e.offsetHeight:r,c=Lg(n)!==i||Lg(r)!==s;return c&&(n=i,r=s),{width:n,height:r,$:c}}function ZE(e){return cn(e)?e:e.contextElement}function Ru(e){const t=ZE(e);if(!Nn(t))return Zs(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=bP(t);let s=(i?Lg(n.width):n.width)/r,c=(i?Lg(n.height):n.height)/o;return(!s||!Number.isFinite(s))&&(s=1),(!c||!Number.isFinite(c))&&(c=1),{x:s,y:c}}const G7=Zs(0);function wP(e){const t=Gn(e);return!_E()||!t.visualViewport?G7:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function K7(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===Gn(e)}function Wl(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),i=ZE(e);let s=Zs(1);t&&(r?cn(r)&&(s=Ru(r)):s=Ru(e));const c=K7(i,n,r)?wP(i):Zs(0);let d=(o.left+c.x)/s.x,u=(o.top+c.y)/s.y,p=o.width/s.x,m=o.height/s.y;if(i&&r){const g=Gn(i),y=cn(r)?Gn(r):r;let v=g,S=Mw(v);for(;S&&y!==v;){const w=Ru(S),E=S.getBoundingClientRect(),k=Ko(S),j=E.left+(S.clientLeft+parseFloat(k.paddingLeft))*w.x,N=E.top+(S.clientTop+parseFloat(k.paddingTop))*w.y;d*=w.x,u*=w.y,p*=w.x,m*=w.y,d+=j,u+=N,v=Gn(S),S=Mw(v)}}return eh({width:p,height:m,x:d,y:u})}function Xy(e,t){const n=Ly(e).scrollLeft;return t?t.left+n:Wl(Js(e)).left+n}function SP(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-Xy(e,n),o=n.top+t.scrollTop;return{x:r,y:o}}function X7(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const i=o==="fixed",s=Js(r),c=t?zy(t.floating):!1;if(r===s||c&&i)return n;let d={scrollLeft:0,scrollTop:0},u=Zs(1);const p=Zs(0),m=Nn(r);if((m||!i)&&((Zr(r)!=="body"||Oh(s))&&(d=Ly(r)),m)){const y=Wl(r);u=Ru(r),p.x=y.x+r.clientLeft,p.y=y.y+r.clientTop}const g=s&&!m&&!i?SP(s,d):Zs(0);return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-d.scrollLeft*u.x+p.x+g.x,y:n.y*u.y-d.scrollTop*u.y+p.y+g.y}}function Q7(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function W7(e){const t=Ly(e),n=e.ownerDocument.body,r=Ys(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),o=Ys(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight);let i=-t.scrollLeft+Xy(e);const s=-t.scrollTop;return Ko(n).direction==="rtl"&&(i+=Ys(e.clientWidth,n.clientWidth)-r),{width:r,height:o,x:i,y:s}}const J7=25;function eY(e,t,n){n===void 0&&(n="viewport");const r=n==="layoutViewport",o=Gn(e),i=Js(e),s=o.visualViewport;let c=i.clientWidth,d=i.clientHeight,u=0,p=0;if(s){const g=!_E()||t==="fixed";r?g||(u=-s.offsetLeft,p=-s.offsetTop):(c=s.width,d=s.height,g&&(u=s.offsetLeft,p=s.offsetTop))}if(Xy(i)<=0){const g=i.ownerDocument,y=g.body,v=getComputedStyle(y),S=g.compatMode==="CSS1Compat"&&parseFloat(v.marginLeft)+parseFloat(v.marginRight)||0,w=Math.abs(i.clientWidth-y.clientWidth-S),E=getComputedStyle(i).scrollbarGutter==="stable both-edges"?w/2:w;E<=J7&&(c-=E)}return{width:c,height:d,x:u,y:p}}function tY(e,t){const n=Wl(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=Ru(e),s=e.clientWidth*i.x,c=e.clientHeight*i.y,d=o*i.x,u=r*i.y;return{width:s,height:c,x:d,y:u}}function uT(e,t,n){let r;if(t==="viewport"||t==="layoutViewport")r=eY(e,n,t);else if(t==="document")r=W7(Js(e));else if(cn(t))r=tY(t,n);else{const o=wP(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return eh(r)}function nY(e,t){const n=t.get(e);if(n)return n;let r=Wf(e,[],!1).filter(c=>cn(c)&&Zr(c)!=="body"),o=null;const i=Ko(e).position==="fixed";let s=i?Xs(e):e;for(;cn(s)&&!qs(s);){const c=Ko(s),d=RE(s),u=o?o.position:i?"fixed":"";!d&&(u==="fixed"||u==="absolute"&&c.position==="static")?r=r.filter(m=>m!==s):o=c,s=Xs(s)}return t.set(e,r),r}function rY(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const s=[...n==="clippingAncestors"?zy(t)?[]:nY(t,this._c):[].concat(n),r],c=uT(t,s[0],o);let d=c.top,u=c.right,p=c.bottom,m=c.left;for(let g=1;g<s.length;g++){const y=uT(t,s[g],o);d=Ys(y.top,d),u=Pu(y.right,u),p=Pu(y.bottom,p),m=Ys(y.left,m)}return{width:u-m,height:p-d,x:m,y:d}}function oY(e){const{width:t,height:n}=bP(e);return{width:t,height:n}}function iY(e,t,n){const r=Nn(t),o=Js(t),i=n==="fixed",s=Wl(e,!0,i,t);let c={scrollLeft:0,scrollTop:0};const d=Zs(0);if((r||!i)&&((Zr(t)!=="body"||Oh(o))&&(c=Ly(t)),r)){const g=Wl(t,!0,i,t);d.x=g.x+t.clientLeft,d.y=g.y+t.clientTop}!r&&o&&(d.x=Xy(o));const u=o&&!r&&!i?SP(o,c):Zs(0),p=s.left+c.scrollLeft-d.x-u.x,m=s.top+c.scrollTop-d.y-u.y;return{x:p,y:m,width:s.width,height:s.height}}function w0(e){return Ko(e).position==="static"}function dT(e,t){if(!Nn(e)||Ko(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Js(e)===n&&(n=n.ownerDocument.body),n}function EP(e,t){const n=Gn(e);if(zy(e))return n;if(!Nn(e)){let o=Xs(e);for(;o&&!qs(o);){if(cn(o)&&!w0(o))return o;o=Xs(o)}return n}let r=dT(e,t);for(;r&&Aq(r)&&w0(r);)r=dT(r,t);return r&&qs(r)&&w0(r)&&!RE(r)?n:r||Pq(e)||n}const sY=async function(e){const t=this.getOffsetParent||EP,n=this.getDimensions,r=await n(e.floating);return{reference:iY(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function aY(e){return Ko(e).direction==="rtl"}const CP={convertOffsetParentRelativeRectToViewportRelativeRect:X7,getDocumentElement:Js,getClippingRect:rY,getOffsetParent:EP,getElementRects:sY,getClientRects:Q7,getDimensions:oY,getScale:Ru,isElement:cn,isRTL:aY};function kP(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function lY(e,t,n){let r=null,o;const i=Js(e);function s(){var p;clearTimeout(o),(p=r)==null||p.disconnect(),r=null}function c(p,m){p===void 0&&(p=!1),m===void 0&&(m=1),s();const g=e.getBoundingClientRect(),{left:y,top:v,width:S,height:w}=g;if(p||t(),!S||!w)return;const E=jm(v),k=jm(i.clientWidth-(y+S)),j=jm(i.clientHeight-(v+w)),N=jm(y),R={rootMargin:-E+"px "+-k+"px "+-j+"px "+-N+"px",threshold:Ys(0,Pu(1,m))||1};let M=!0;function T(O){const z=O[0].intersectionRatio;if(!kP(g,e.getBoundingClientRect()))return c();if(z!==m){if(!M)return c();z?c(!1,z):o=setTimeout(()=>{c(!1,1e-7)},1e3)}M=!1}try{r=new IntersectionObserver(T,{...R,root:i.ownerDocument})}catch{r=new IntersectionObserver(T,R)}r.observe(e)}const d=Gn(e),u=()=>c(n);return d.addEventListener("resize",u),c(!0),()=>{d.removeEventListener("resize",u),s()}}function fT(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:d=!1}=r,u=ZE(e),p=o||i?[...u?Wf(u):[],...t?Wf(t):[]]:[];p.forEach(E=>{o&&E.addEventListener("scroll",n),i&&E.addEventListener("resize",n)});const m=u&&c?lY(u,n,i):null;let g=-1,y=null;s&&(y=new ResizeObserver(E=>{let[k]=E;k&&k.target===u&&y&&t&&(y.unobserve(t),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{var j;(j=y)==null||j.observe(t)})),n()}),u&&!d&&y.observe(u),t&&y.observe(t));let v,S=d?Wl(e):null;d&&w();function w(){const E=Wl(e);S&&!kP(S,E)&&n(),S=E,v=requestAnimationFrame(w)}return n(),()=>{var E;p.forEach(k=>{o&&k.removeEventListener("scroll",n),i&&k.removeEventListener("resize",n)}),m?.(),(E=y)==null||E.disconnect(),y=null,d&&cancelAnimationFrame(v)}}const cY=U7,uY=q7,dY=B7,fY=Z7,hY=Y7,pY=(e,t,n)=>{const r=new Map,o=n??{},i={...CP,...o.platform,_c:r};return V7(e,t,{...o,platform:i})};var mY=typeof document<"u",gY=function(){},yg=mY?b.useLayoutEffect:gY;function Hg(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,o;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!Hg(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;r--!==0;){const i=o[r];if(!(i==="_owner"&&e.$$typeof)&&!Hg(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function jP(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function hT(e,t){const n=jP(e);return Math.round(t*n)/n}function S0(e){const t=b.useRef(e);return yg(()=>{t.current=e}),t}function yY(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:i,floating:s}={},transform:c=!0,whileElementsMounted:d,open:u}=e,[p,m]=b.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[g,y]=b.useState(r);Hg(g,r)||y(r);const[v,S]=b.useState(null),[w,E]=b.useState(null),k=b.useCallback(Y=>{Y!==R.current&&(R.current=Y,S(Y))},[]),j=b.useCallback(Y=>{Y!==M.current&&(M.current=Y,E(Y))},[]),N=i||v,A=s||w,R=b.useRef(null),M=b.useRef(null),T=b.useRef(p),O=d!=null,z=S0(d),q=S0(o),$=S0(u),G=b.useCallback(()=>{if(!R.current||!M.current)return;const Y={placement:t,strategy:n,middleware:g};q.current&&(Y.platform=q.current),pY(R.current,M.current,Y).then(Z=>{const D={...Z,isPositioned:$.current!==!1};L.current&&!Hg(T.current,D)&&(T.current=D,Go.flushSync(()=>{m(D)}))})},[g,t,n,q,$]);yg(()=>{u===!1&&T.current.isPositioned&&(T.current.isPositioned=!1,m(Y=>({...Y,isPositioned:!1})))},[u]);const L=b.useRef(!1);yg(()=>(L.current=!0,()=>{L.current=!1}),[]),yg(()=>{if(N&&(R.current=N),A&&(M.current=A),N&&A){if(z.current)return z.current(N,A,G);G()}},[N,A,G,z,O]);const F=b.useMemo(()=>({reference:R,floating:M,setReference:k,setFloating:j}),[k,j]),P=b.useMemo(()=>({reference:N,floating:A}),[N,A]),I=b.useMemo(()=>{const Y={position:n,left:0,top:0};if(!P.floating)return Y;const Z=hT(P.floating,p.x),D=hT(P.floating,p.y);return c?{...Y,transform:"translate("+Z+"px, "+D+"px)",...jP(P.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:Z,top:D}},[n,c,P.floating,p.x,p.y]);return b.useMemo(()=>({...p,update:G,refs:F,elements:P,floatingStyles:I}),[p,G,F,P,I])}const xY=(e,t)=>{const n=cY(e);return{name:n.name,fn:n.fn,options:[e,t]}},vY=(e,t)=>{const n=uY(e);return{name:n.name,fn:n.fn,options:[e,t]}},bY=(e,t)=>({fn:hY(e).fn,options:[e,t]}),wY=(e,t)=>{const n=dY(e);return{name:n.name,fn:n.fn,options:[e,t]}},SY=(e,t)=>{const n=fY(e);return{name:n.name,fn:n.fn,options:[e,t]}},EY={open:e=>e.open,transitionStatus:e=>e.transitionStatus,domReferenceElement:e=>e.domReferenceElement,referenceElement:e=>e.positionReference??e.referenceElement,floatingElement:e=>e.floatingElement,floatingId:e=>e.floatingId};class Qy extends Ah{constructor(t){const{syncOnly:n,nested:r,onOpenChange:o,triggerElements:i,...s}=t;super({...s,positionReference:s.referenceElement,domReferenceElement:s.referenceElement},{onOpenChange:o,dataRef:{current:{}},events:pP(),nested:r,triggerElements:i},EY),this.syncOnly=n}syncOpenEvent=(t,n)=>{(!t||!this.state.open||n!=null&&Uq(n))&&(this.context.dataRef.current.openEvent=t?n:void 0)};dispatchOpenChange=(t,n)=>{this.syncOpenEvent(t,n.event);const r={open:t,reason:n.reason,nativeEvent:n.event,nested:this.context.nested,triggerElement:n.trigger};this.context.events.emit("openchange",r)};setOpen=(t,n)=>{if(this.syncOnly){this.context.onOpenChange?.(t,n);return}this.dispatchOpenChange(t,n),this.context.onOpenChange?.(t,n)}}function RP(e){const{popupStore:t,treatPopupAsFloatingElement:n=!1,floatingRootContext:r,floatingId:o,nested:i,onOpenChange:s}=e,c=t.useState("open"),d=t.useState("activeTriggerElement"),u=t.useState(n?"popupElement":"positionerElement"),p=t.context.triggerElements,m=s,g=b.useRef(null);r===void 0&&g.current===null&&(g.current=new Qy({open:c,transitionStatus:void 0,referenceElement:d,floatingElement:u,triggerElements:p,onOpenChange:m,floatingId:o,syncOnly:!0,nested:i}));const y=r??g.current;return t.useSyncedValue("floatingId",o),rt(()=>{const v={open:c,floatingId:o,referenceElement:d,floatingElement:u};cn(d)&&(v.domReferenceElement=d),y.state.positionReference===y.state.referenceElement&&(v.positionReference=d),y.update(v)},[c,o,d,u,y]),y.context.onOpenChange=m,y.context.nested=i,y}function Ph(e,t=!1,n=!1){const[r,o]=b.useState(e&&t?"idle":void 0),[i,s]=b.useState(e);return e&&!i&&(s(!0),o("starting")),!e&&i&&r!=="ending"&&!n&&o("ending"),!e&&!i&&r==="ending"&&o(void 0),rt(()=>{if(!e&&i&&r!=="ending"&&n){const c=rs.request(()=>{o("ending")});return()=>{rs.cancel(c)}}},[e,i,r,n]),rt(()=>{if(!e||t)return;const c=rs.request(()=>{o(void 0)});return()=>{rs.cancel(c)}},[t,e]),rt(()=>{if(!e||!t)return;e&&i&&r!=="idle"&&o("starting");const c=rs.request(()=>{o("idle")});return()=>{rs.cancel(c)}},[t,e,i,r]),{mounted:i,setMounted:s,transitionStatus:r}}function GE(e,t=!1){const n=Du();return st((r,o=null)=>{n.cancel();const i=$s(e);if(i==null)return;const s=i,c=()=>{Go.flushSync(r)};if(typeof s.getAnimations!="function"||globalThis.BASE_UI_ANIMATIONS_DISABLED){r();return}function d(){Promise.all(s.getAnimations().map(u=>u.finished)).then(()=>{o?.aborted||c()},()=>{if(o?.aborted)return;if(s.getAnimations().some(p=>p.pending||p.playState!=="finished")){d();return}c()})}if(t){const u="data-starting-style";if(!s.hasAttribute(u)){n.request(d);return}const p=new MutationObserver(()=>{s.hasAttribute(u)||(p.disconnect(),d())});p.observe(s,{attributes:!0,attributeFilter:[u]}),o?.addEventListener("abort",()=>p.disconnect(),{once:!0});return}n.request(d)})}function ta(e){const{enabled:t=!0,open:n,ref:r,onComplete:o}=e,i=st(o),s=GE(r,n);b.useEffect(()=>{if(!t)return;const c=new AbortController;return s(i,c.signal),()=>{c.abort()}},[t,n,i,s])}const Wy={tabIndex:-1,[Ow]:""};function _P(e){return t=>t==="touch"?e.current:!0}function NP(e,t=!1){const n=Ql(),r=sl()!=null,o=Yr(()=>e(n,r)).current;return RP({popupStore:o,treatPopupAsFloatingElement:t,floatingRootContext:o.state.floatingRootContext,floatingId:n,nested:r,onOpenChange:o.setOpen}),o}function KE({handle:e,store:t}){return rt(()=>e.attachStore(t),[e,t]),null}function CY(e,t){const n=b.useRef(null),r=b.useRef(null);return b.useCallback(o=>{if(e===void 0)return;let i=!1;if(n.current!==null){const s=n.current,c=r.current,d=t.context.triggerElements.getById(s);c&&d===c&&(t.context.triggerElements.delete(s),i=!0),n.current=null,r.current=null}if(o!==null&&(n.current=e,r.current=o,t.context.triggerElements.add(e,o),i=!0),i){const s=t.context.triggerElements.size;t.select("open")&&t.state.triggerCount!==s&&t.set("triggerCount",s)}},[t,e])}function XE(e,t,n,r=!1){t?e.preventUnmountingOnClose=!1:r&&(e.preventUnmountingOnClose=!0);const o=n?.id??null;(o||t)&&(e.activeTriggerId=o,e.activeTriggerElement=n??null)}function TP(e){let t=!1;return e.preventUnmountOnClose=()=>{t=!0},()=>t}function MP(e,t,n,r){const o=n.useState("isMountedByTrigger",e),i=CY(e,n),s=st(d=>{const u=n.select("open"),p=n.select("activeTriggerId");if(p===e){n.update({activeTriggerElement:d,...u?r:null});return}p==null&&u&&n.update({activeTriggerId:e,activeTriggerElement:d,...r})}),c=b.useCallback(d=>{i(d),d&&s(d)},[i,s]);return rt(()=>{o&&n.update({activeTriggerElement:t.current,...r})},[o,n,t,...Object.values(r)]),{registerTrigger:c,isMountedByThisTrigger:o}}function QE(e,t={}){const{closeOnActiveTriggerUnmount:n=!1}=t,r=b.useRef(null),o=e.useState("open"),i=e.useState("triggerCount"),s=e.useState("activeTriggerId"),c=e.useState("activeTriggerElement");rt(()=>{if(!o){r.current=null,e.state.triggerCount!==0&&e.set("triggerCount",0);return}const d=e.context.triggerElements.size,u={};e.state.triggerCount!==d&&(u.triggerCount=d);const p=e.select("activeTriggerId");let m=null;if(p){const g=e.context.triggerElements.getById(p);if(g)r.current=p,g!==e.state.activeTriggerElement&&(u.activeTriggerElement=g);else{for(const[y,v]of e.context.triggerElements.entries())if(v===e.state.activeTriggerElement){u.activeTriggerId=y,u.activeTriggerElement=v,r.current=y;break}u.activeTriggerId===void 0&&(r.current===p?m=p:r.current=null)}}else r.current=null;if(!m&&!p&&d===1){const g=e.context.triggerElements.entries().next();if(!g.done){const[y,v]=g.value;u.activeTriggerId=y,u.activeTriggerElement=v,r.current=y}}(u.triggerCount!==void 0||u.activeTriggerId!==void 0||u.activeTriggerElement!==void 0)&&e.update(u),m&&n&&queueMicrotask(()=>{if(e.select("open")&&e.select("activeTriggerId")===m&&!e.context.triggerElements.getById(m)){const g=Bt(Kl);e.setOpen(!1,g),g.isCanceled||e.update({activeTriggerId:null,activeTriggerElement:null})}})},[o,e,i,s,c,n])}function WE(e,t,n){const{mounted:r,setMounted:o,transitionStatus:i}=Ph(e),s=t.useState("preventUnmountingOnClose"),c=e?!1:s;t.useSyncedValues({mounted:r,transitionStatus:i,preventUnmountingOnClose:c});const d=st(()=>{o(!1),t.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1,preventUnmountingOnClose:!1}),n?.(),t.context.onOpenChangeComplete?.(!1)});return ta({enabled:r&&!e&&!c,open:e,ref:t.context.popupRef,onComplete(){e||d()}}),{forceUnmount:d,transitionStatus:i}}function JE(e,t){e.useSyncedValues(t),rt(()=>()=>{e.update({activeTriggerProps:rr,inactiveTriggerProps:rr,popupProps:rr})},[e])}function AP(e,t){rt(()=>{!t&&e.state.openMethod!==null&&e.set("openMethod",null)},[t,e]),rt(()=>()=>{e.state.openMethod!==null&&e.set("openMethod",null)},[e])}class Ih{constructor(){this.idMap=new Map}add(t,n){this.idMap.set(t,n)}delete(t){this.idMap.delete(t)}hasElement(t){for(const n of this.idMap.values())if(n===t)return!0;return!1}hasMatchingElement(t){for(const n of this.idMap.values())if(t(n))return!0;return!1}getById(t){return this.idMap.get(t)}entries(){return this.idMap.entries()}elements(){return this.idMap.values()}get size(){return this.idMap.size}}function kY(){return new Qy({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:new Ih,floatingId:void 0,syncOnly:!1,nested:!1,onOpenChange:void 0})}function e1(){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:kY(),floatingId:void 0,triggerCount:0,preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:rr,inactiveTriggerProps:rr,popupProps:rr}}function OP(e,t,n=!1){return new Qy({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:e,floatingId:t,syncOnly:!0,nested:n,onOpenChange:void 0})}const Ff=e=>e.triggerIdProp??e.activeTriggerId,t1=e=>e.openProp??e.open,pT=e=>(e.popupElement?.id??e.floatingId)||void 0;function DP(e,t){return t!==void 0&&t1(e)&&Ff(e)===t}function jY(e,t){return DP(e,t)?!0:t!==void 0&&t1(e)&&Ff(e)==null&&e.triggerCount===1}const n1={open:t1,mounted:e=>e.mounted,transitionStatus:e=>e.transitionStatus,floatingRootContext:e=>e.floatingRootContext,triggerCount:e=>e.triggerCount,preventUnmountingOnClose:e=>e.preventUnmountingOnClose,payload:e=>e.payload,activeTriggerId:Ff,activeTriggerElement:e=>e.mounted?e.activeTriggerElement:null,popupId:pT,isTriggerActive:(e,t)=>t!==void 0&&Ff(e)===t,isOpenedByTrigger:(e,t)=>DP(e,t),isMountedByTrigger:(e,t)=>t!==void 0&&Ff(e)===t&&e.mounted,triggerProps:(e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps,triggerPopupId:(e,t)=>jY(e,t)?pT(e):void 0,popupProps:e=>e.popupProps,popupElement:e=>e.popupElement,positionerElement:e=>e.positionerElement};function PP(e){const t=b.useCallback(r=>e===void 0?Ar:e.subscribeStore(r),[e]),n=b.useCallback(()=>e===void 0?void 0:e.store,[e]);return EE.useSyncExternalStore(t,n,()=>e?.serverStore)}function RY(e){const{open:t=!1,onOpenChange:n,elements:r={}}=e,o=Ql(),i=sl()!=null,s=Yr(()=>new Qy({open:t,transitionStatus:void 0,onOpenChange:n,referenceElement:r.reference??null,floatingElement:r.floating??null,triggerElements:new Ih,floatingId:o,syncOnly:!1,nested:i})).current;return rt(()=>{const c={open:t,floatingId:o};r.reference!==void 0&&(c.referenceElement=r.reference,c.domReferenceElement=cn(r.reference)?r.reference:null),r.floating!==void 0&&(c.floatingElement=r.floating),s.update(c)},[t,o,r.reference,r.floating,s]),s.context.onOpenChange=n,s.context.nested=i,s}function _Y(e){return NY(e,e.rootContext)}function NY(e,t){const{nodeId:n,externalTree:r}=e,o=t.useState("referenceElement"),i=t.useState("floatingElement"),s=t.useState("domReferenceElement"),c=t.useState("open"),d=t.useState("floatingId"),[u,p]=b.useState(null),[m,g]=b.useState(void 0),[y,v]=b.useState(void 0),S=b.useRef(null),w=al(r),E=b.useMemo(()=>({reference:o,floating:i,domReference:s}),[o,i,s]),k=yY({...e,elements:{...E,...u&&{reference:u}}}),j=cn(m)?m:null,N=y===void 0?t.state.floatingElement:y;t.useSyncedValue("referenceElement",m??null),t.useSyncedValue("domReferenceElement",m===void 0?s:j),t.useSyncedValue("floatingElement",N);const A=b.useCallback(q=>{const $=cn(q)?{getBoundingClientRect:()=>q.getBoundingClientRect(),getClientRects:()=>q.getClientRects(),contextElement:q}:q;p($),k.refs.setReference($)},[k.refs]),R=b.useCallback(q=>{(cn(q)||q===null)&&(S.current=q,g(q)),(cn(k.refs.reference.current)||k.refs.reference.current===null||q!==null&&!cn(q))&&k.refs.setReference(q)},[k.refs,g]),M=b.useCallback(q=>{v(q),k.refs.setFloating(q)},[k.refs]),T=b.useMemo(()=>({...k.refs,setReference:R,setFloating:M,setPositionReference:A,domReference:S}),[k.refs,R,M,A]),O=b.useMemo(()=>({...k.elements,domReference:s}),[k.elements,s]),z=b.useMemo(()=>({...k,dataRef:t.context.dataRef,open:c,onOpenChange:t.setOpen,events:t.context.events,floatingId:d,refs:T,elements:O,nodeId:n,rootStore:t}),[k,T,O,n,t,c,d]);return rt(()=>{s&&(S.current=s)},[s]),rt(()=>{t.context.dataRef.current.floatingContext=z;const q=w?.nodesRef.current.find($=>$.id===n);q&&(q.context=z)}),b.useMemo(()=>({...k,context:z,refs:T,elements:O,rootStore:t}),[k,T,O,z,t])}const E0=TE&&ea;function TY(e,t={}){const{enabled:n=!0,delay:r}=t,o="rootStore"in e?e.rootStore:e,{events:i,dataRef:s}=o.context,c=b.useRef(!1),d=b.useRef(null),u=b.useRef(!0),p=qr();b.useEffect(()=>{const g=o.select("domReferenceElement");if(!n)return;const y=Gn(g);function v(){const E=o.select("domReferenceElement");!o.select("open")&&Nn(E)&&E===Jr(en(E))&&(c.current=!0)}function S(){u.current=!0}function w(){u.current=!1}return as(Wt(y,"blur",v),E0&&Wt(y,"keydown",S,!0),E0&&Wt(y,"pointerdown",w,!0))},[o,n]),b.useEffect(()=>{if(!n)return;function g(y){if(y.reason===Xl||y.reason===qy){const v=o.select("domReferenceElement");cn(v)&&(d.current=v,c.current=!0)}}return i.on("openchange",g),()=>{i.off("openchange",g)}},[i,n,o]);const m=b.useMemo(()=>{function g(){c.current=!1,d.current=null}return{onMouseLeave(){g()},onFocus(y){const v=y.currentTarget;if(c.current){if(d.current===v)return;g()}const S=ro(y.nativeEvent);if(cn(S)){if(E0&&!y.relatedTarget){if(!u.current&&!Hy(S))return}else if(!Zq(S))return}const w=Ig(y.relatedTarget,o.context.triggerElements),{nativeEvent:E,currentTarget:k}=y,j=typeof r=="function"?r():r;if(o.select("open")&&w||j===0||j===void 0){o.setOpen(!0,Bt(If,E,k));return}p.start(j,()=>{c.current||o.setOpen(!0,Bt(If,E,k))})},onBlur(y){g();const v=y.relatedTarget,S=y.nativeEvent,w=cn(v)&&v.hasAttribute(th("focus-guard"))&&v.getAttribute("data-type")==="outside";p.start(0,()=>{const E=o.select("domReferenceElement"),k=Jr(en(E));!v&&k===E||yt(s.current.floatingContext?.refs.floating.current,k)||yt(E,k)||w||Ig(v??k,o.context.triggerElements)||o.setOpen(!1,Bt(If,S))})}}},[s,r,o,p]);return b.useMemo(()=>n?{reference:m,trigger:m}:{},[n,m])}class r1{constructor(){this.pointerType=void 0,this.interactedInside=!1,this.handler=void 0,this.blockMouseMove=!0,this.performedPointerEventsMutation=!1,this.pointerEventsScopeElement=null,this.pointerEventsReferenceElement=null,this.pointerEventsFloatingElement=null,this.restTimeoutPending=!1,this.openChangeTimeout=new zi,this.restTimeout=new zi,this.handleCloseOptions=void 0}static create(){return new r1}dispose=()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()};disposeEffect=()=>this.dispose}const Ug=new WeakMap;function qg(e){if(!e.performedPointerEventsMutation)return;const t=e.pointerEventsScopeElement;t&&Ug.get(t)===e&&(e.pointerEventsScopeElement?.style.removeProperty("pointer-events"),e.pointerEventsReferenceElement?.style.removeProperty("pointer-events"),e.pointerEventsFloatingElement?.style.removeProperty("pointer-events"),Ug.delete(t)),e.performedPointerEventsMutation=!1,e.pointerEventsScopeElement=null,e.pointerEventsReferenceElement=null,e.pointerEventsFloatingElement=null}function IP(e,t){const{scopeElement:n,referenceElement:r,floatingElement:o}=t,i=Ug.get(n);i&&i!==e&&qg(i),qg(e),e.performedPointerEventsMutation=!0,e.pointerEventsScopeElement=n,e.pointerEventsReferenceElement=r,e.pointerEventsFloatingElement=o,Ug.set(n,e),n.style.pointerEvents="none",r.style.pointerEvents="auto",o.style.pointerEvents="auto"}function zP(e){const t=e.context.dataRef.current,n=Yr(()=>t.hoverInteractionState??r1.create()).current;return t.hoverInteractionState||(t.hoverInteractionState=n),NE(t.hoverInteractionState.disposeEffect),t.hoverInteractionState}function LP(e,t={}){const{enabled:n=!0,closeDelay:r=0,nodeId:o}=t,i="rootStore"in e?e.rootStore:e,s=i.useState("open"),c=i.useState("floatingElement"),d=i.useState("domReferenceElement"),{dataRef:u}=i.context,p=al(),m=sl(),g=zP(i),y=qr(),v=st(()=>VD(u.current.openEvent?.type,g.interactedInside)),S=st(()=>Kq(u.current.openEvent?.type)),w=st(()=>{qg(g)});rt(()=>{s||(g.pointerType=void 0,g.restTimeoutPending=!1,g.interactedInside=!1,w())},[s,g,w]),b.useEffect(()=>w,[w]),rt(()=>{if(n&&s&&g.handleCloseOptions?.blockPointerEvents&&S()&&cn(d)&&c){const E=d,k=c,j=en(c),N=p?.nodesRef.current.find(T=>T.id===m)?.context?.elements.floating;N&&(N.style.pointerEvents="");const A=g.pointerEventsScopeElement!==k?g.pointerEventsScopeElement:null,R=N!==k?N:null,M=g.handleCloseOptions?.getScope?.()??A??R??E.closest("[data-rootownerid]")??j.body;return IP(g,{scopeElement:M,referenceElement:E,floatingElement:k}),()=>{w()}}},[n,s,d,c,g,S,p,m,w]),b.useEffect(()=>{if(!n)return;function E(){return!!(p&&m&&el(p.nodesRef.current,m).length>0)}function k(T){const O=Pw(r,"close",g.pointerType),z=()=>{i.setOpen(!1,Bt(Dr,T)),p?.events.emit("floating.closed",T)};O?g.openChangeTimeout.start(O,z):(g.openChangeTimeout.clear(),z())}function j(T){const O=ro(T);if(!Yq(O)){g.interactedInside=!1;return}g.interactedInside=O?.closest("[aria-haspopup]")!=null}function N(){g.openChangeTimeout.clear(),y.clear(),p?.events.off("floating.closed",R),w()}function A(T){if(E()&&p){p.events.on("floating.closed",R);return}if(Ig(T.relatedTarget,i.context.triggerElements))return;const O=u.current.floatingContext?.nodeId??o,z=T.relatedTarget;if(!(p&&O&&cn(z)&&el(p.nodesRef.current,O,!1).some($=>yt($.context?.elements.floating,z)))){if(g.handler){g.handler(T);return}w(),S()&&!v()&&k(T)}}function R(T){!p||!m||E()||y.start(0,()=>{p.events.off("floating.closed",R),i.setOpen(!1,Bt(Dr,T)),p.events.emit("floating.closed",T)})}const M=c;return as(M&&Wt(M,"mouseenter",N),M&&Wt(M,"mouseleave",A),M&&Wt(M,"pointerdown",j,!0),()=>{p?.events.off("floating.closed",R)})},[n,c,i,u,r,o,S,v,w,g,p,m,y])}const MY={current:null};function FP(e,t={}){const{enabled:n=!0,delay:r=0,handleClose:o=null,mouseOnly:i=!1,restMs:s=0,move:c=!0,triggerElementRef:d=MY,externalTree:u,isActiveTrigger:p=!0,getHandleCloseContext:m,isClosing:g,shouldOpen:y,guardStaleOpen:v=!1}=t,S="rootStore"in e?e.rootStore:e,{dataRef:w,events:E}=S.context,k=al(u),j=zP(S),N=b.useRef(!1),A=hr(o),R=hr(r),M=hr(s),T=hr(n),O=hr(y),z=hr(g),q=st(()=>VD(w.current.openEvent?.type,j.interactedInside)),$=st(()=>O.current?.()!==!1),G=st((P,I,Y)=>{const Z=S.context.triggerElements;if(Z.hasElement(I))return!P||!yt(P,I);if(!cn(Y))return!1;const D=Y;return Z.hasMatchingElement(H=>yt(H,D))&&(!P||!yt(P,D))}),L=st(()=>{if(!j.handler)return;en(S.select("domReferenceElement")).removeEventListener("mousemove",j.handler),j.handler=void 0}),F=st(()=>{qg(j)});return p&&(j.handleCloseOptions=A.current?.__options),b.useEffect(()=>L,[L]),b.useEffect(()=>{if(!n)return;function P(I){I.open?N.current=!1:(N.current=I.reason===Dr,L(),j.openChangeTimeout.clear(),j.restTimeout.clear(),j.blockMouseMove=!0,j.restTimeoutPending=!1)}return E.on("openchange",P),()=>{E.off("openchange",P)}},[n,E,j,L]),b.useEffect(()=>{if(!n)return;function P(U,B=!0){const X=Pw(R.current,"close",j.pointerType);X?j.openChangeTimeout.start(X,()=>{S.setOpen(!1,Bt(Dr,U)),k?.events.emit("floating.closed",U)}):B&&(j.openChangeTimeout.clear(),S.setOpen(!1,Bt(Dr,U)),k?.events.emit("floating.closed",U))}const I=d.current??(p?S.select("domReferenceElement"):null);if(!cn(I))return;function Y(U){if(j.openChangeTimeout.clear(),j.blockMouseMove=!1,i&&!ku(j.pointerType))return;const B=UN(M.current),X=Pw(R.current,"open",j.pointerType),J=ro(U),Q=U.currentTarget??null,oe=S.select("domReferenceElement");let W=Q;if(cn(J)&&!S.context.triggerElements.hasElement(J)){for(const we of S.context.triggerElements.elements())if(yt(we,J)){W=we;break}}cn(Q)&&cn(oe)&&!S.context.triggerElements.hasElement(Q)&&yt(Q,oe)&&(W=oe);const ne=W==null?!1:G(oe,W,J),je=S.select("open"),Ee=z.current?.()??S.select("transitionStatus")==="ending",pe=!je&&Ee&&N.current,re=!ne&&cn(W)&&cn(oe)&&yt(oe,W)&&pe,ge=B>0&&!X,_e=ne&&(je||pe)||re,De=!je||ne;if(_e){$()&&S.setOpen(!0,Bt(Dr,U,W));return}ge||(X?j.openChangeTimeout.start(X,()=>{De&&$()&&S.setOpen(!0,Bt(Dr,U,W))}):De&&$()&&S.setOpen(!0,Bt(Dr,U,W)))}function Z(U){if(q()){F();return}L();const B=S.select("domReferenceElement"),X=en(B);j.restTimeout.clear(),j.restTimeoutPending=!1;const J=w.current.floatingContext??m?.();if(Ig(U.relatedTarget,S.context.triggerElements))return;if(A.current&&J){S.select("open")||j.openChangeTimeout.clear();const oe=d.current;j.handler=A.current({...J,tree:k,x:U.clientX,y:U.clientY,onClose(){F(),L(),T.current&&!q()&&oe===S.select("domReferenceElement")&&P(U,!0)}}),X.addEventListener("mousemove",j.handler),j.handler(U);return}(j.pointerType!=="touch"||!yt(S.select("floatingElement"),U.relatedTarget))&&P(U)}function D(U){yt(I,U.relatedTarget)||(j.openChangeTimeout.clear(),j.restTimeout.clear(),j.restTimeoutPending=!1)}const H=v?Wt(I,"mouseout",D):void 0;return c?as(Wt(I,"mousemove",Y,{once:!0}),Wt(I,"mouseenter",Y),Wt(I,"mouseleave",Z),H):as(Wt(I,"mouseenter",Y),Wt(I,"mouseleave",Z),H)},[L,F,w,R,S,n,A,j,p,G,q,i,c,M,d,k,T,m,z,$,v]),b.useMemo(()=>{if(!n)return;function P(I){j.pointerType=I.pointerType}return{onPointerDown:P,onPointerEnter:P,onMouseMove(I){const{nativeEvent:Y}=I,Z=I.currentTarget,D=S.select("domReferenceElement"),H=S.select("open"),U=G(D,Z,I.target);if(i&&!ku(j.pointerType))return;if(H&&U&&j.handleCloseOptions?.blockPointerEvents){const J=S.select("floatingElement");if(J){const Q=j.handleCloseOptions?.getScope?.()??Z.ownerDocument.body;IP(j,{scopeElement:Q,referenceElement:Z,floatingElement:J})}}const B=UN(M.current);if(H&&!U||B===0||!U&&j.restTimeoutPending&&I.movementX**2+I.movementY**2<2)return;j.restTimeout.clear();function X(){if(j.restTimeoutPending=!1,q())return;const J=S.select("open");!j.blockMouseMove&&(!J||U)&&$()&&S.setOpen(!0,Bt(Dr,Y,Z))}j.pointerType==="touch"?Go.flushSync(()=>{X()}):U&&H?X():(j.restTimeoutPending=!0,j.restTimeout.start(B,X))}}},[n,j,q,G,i,S,M,$])}const AY="Escape";function mT(e){return ea&&e.movementX===0&&e.movementY===0}function Jy(e,t,n){switch(e){case"vertical":return t;case"horizontal":return n;default:return t||n}}function _m(e,t){return Jy(t,e===$D||e===DE,e===Vy||e===By)}function C0(e,t,n){return Jy(t,e===DE,n?e===Vy:e===By)||e==="Enter"||e===" "||e===""}function OY(e,t,n){return Jy(t,n?e===Vy:e===By,e===DE)}function DY(e,t,n,r){const o=n?e===By:e===Vy,i=e===$D;return t==="both"||t==="horizontal"&&r?e===AY:Jy(t,o,i)}function $P(e,t){const{listRef:n,activeIndex:r,onNavigate:o=()=>{},enabled:i=!0,selectedIndex:s=null,allowEscape:c=!1,loopFocus:d=!1,nested:u=!1,rtl:p=!1,virtual:m=!1,focusItemOnOpen:g="auto",focusItemOnHover:y=!0,openOnArrowKeyDown:v=!0,disabledIndices:S=void 0,orientation:w="vertical",parentOrientation:E,id:k,resetOnPointerLeave:j=!0,externalTree:N,grid:A}=t,R=A!=null,M="rootStore"in e?e.rootStore:e,T=M.useState("open"),O=M.useState("floatingElement"),z=M.useState("domReferenceElement"),q=M.context.dataRef,$=zg(O),G=Dw(z),L=hr($),F=sl(),P=al(N),I=b.useRef(g),Y=b.useRef(s??-1),Z=b.useRef(null),D=b.useRef(!0),H=st(me=>{o(Y.current===-1?null:Y.current,me)}),U=b.useRef(!!O),B=b.useRef(T),X=b.useRef(!1),J=b.useRef(!1),Q=b.useRef(null),oe=hr(S),W=hr(T),ne=hr(s),je=hr(j),Ee=Du(),pe=Du(),re=st(()=>{function me(Se){m?P?.events.emit("virtualfocus",Se):Q.current=gg(Se,{sync:X.current,preventScroll:!0})}const ke=n.current[Y.current],de=J.current;ke&&me(ke),(X.current?Se=>Se():Se=>Ee.request(Se))(()=>{const Se=n.current[Y.current]||ke;if(!Se)return;ke||me(Se),Me&&(de||!D.current)&&Se.scrollIntoView?.({block:"nearest",inline:"nearest"})})});rt(()=>{q.current.orientation=w},[q,w]),rt(()=>{i&&(T&&O?(Y.current=s??-1,I.current&&s!=null&&(J.current=!0,H())):U.current&&(Y.current=-1,H()))},[i,T,O,s,H]),rt(()=>{if(i){if(!T){X.current=!1;return}if(O)if(r==null){if(X.current=!1,ne.current!=null)return;if(U.current&&(Y.current=-1,re()),(!B.current||!U.current)&&I.current&&(Z.current!=null||I.current===!0&&Z.current==null)){let me=0;const ke=()=>{n.current[0]==null?(me<2&&(me?ue=>pe.request(ue):queueMicrotask)(ke),me+=1):(Y.current=Z.current==null||C0(Z.current,w,p)||u?mg(n):Lw(n),Z.current=null,H())};ke()}}else Lf(n.current,r)||(Y.current=r,re(),J.current=!1)}},[i,T,O,r,ne,u,n,w,p,H,re,pe]),rt(()=>{if(!i||O||!P||m||!U.current)return;const me=P.nodesRef.current,ke=me.find(Se=>Se.id===F)?.context?.elements.floating,de=Jr(en(z??ke??null)),ue=me.some(Se=>Se.context&&yt(Se.context.elements.floating,de));ke&&!ue&&D.current&&ke.focus({preventScroll:!0})},[i,O,z,P,F,m]),rt(()=>{B.current=T,U.current=!!O}),rt(()=>{T||(Z.current=null,I.current=g)},[T,g]);const ge=r!=null,_e=st(me=>{if(!W.current)return;const ke=n.current.indexOf(me.currentTarget);ke!==-1&&(Y.current!==ke||r!==ke)&&(Y.current=ke,H(me))}),De=st(()=>E??P?.nodesRef.current.find(me=>me.id===F)?.context?.dataRef?.current.orientation),we=st(()=>mg(n,oe.current)),$e=st(me=>{if(D.current=!1,X.current=!0,me.which===229||!W.current&&me.currentTarget===L.current)return;if(u&&DY(me.key,w,p,R)){_m(me.key,De())||ts(me),M.setOpen(!1,Bt(Iw,me.nativeEvent)),Nn(z)&&(m?P?.events.emit("virtualfocus",z):z.focus());return}const ke=Y.current,de=mg(n,S),ue=Lw(n,S);if(G||(me.key==="Home"&&(ts(me),Y.current=de,H(me)),me.key==="End"&&(ts(me),Y.current=ue,H(me))),A!=null){const Se=A(me,Y.current,n,w,d,p,S,de,ue);if(Se!=null&&(Y.current=Se,H(me)),w==="both")return}if(_m(me.key,w)){if(ts(me),T&&!m&&Jr(me.currentTarget.ownerDocument)===me.currentTarget){Y.current=C0(me.key,w,p)?de:ue,H(me);return}C0(me.key,w,p)?d?ke>=ue?c&&ke!==n.current.length?Y.current=-1:(X.current=!1,Y.current=de):Y.current=Bs(n.current,{startingIndex:ke,disabledIndices:S}):Y.current=Math.min(ue,Bs(n.current,{startingIndex:ke,disabledIndices:S})):d?ke<=de?c&&ke!==-1?Y.current=n.current.length:(X.current=!1,Y.current=ue):Y.current=Bs(n.current,{startingIndex:ke,decrement:!0,disabledIndices:S}):Y.current=Math.max(de,Bs(n.current,{startingIndex:ke,decrement:!0,disabledIndices:S})),Lf(n.current,Y.current)&&(Y.current=-1),H(me)}}),Me=b.useMemo(()=>({onFocus(ke){X.current=!0,_e(ke)},onClick:({currentTarget:ke})=>ke.focus({preventScroll:!0}),onMouseMove(ke){mT(ke)||(X.current=!0,J.current=!1,y&&_e(ke))},onPointerLeave(ke){if(!W.current||!D.current||ke.pointerType==="touch")return;X.current=!0;const de=ke.relatedTarget;if(!(!y||n.current.includes(de))&&je.current&&(Q.current?.(),Q.current=null,Y.current=-1,H(ke),!m)){const ue=L.current,Se=Jr(en(ue));ue&&yt(ue,Se)&&ue.focus({preventScroll:!0})}}}),[_e,W,L,y,n,H,je,m]),Le=b.useMemo(()=>m&&T&&ge&&{"aria-activedescendant":`${k}-${r}`},[m,T,ge,k,r]),He=b.useMemo(()=>({"aria-orientation":w==="both"?void 0:w,...G?{}:Le,onKeyDown(me){if(me.key==="Tab"&&me.shiftKey&&T&&!m){const ke=ro(me.nativeEvent);if(ke&&!yt(L.current,ke))return;ts(me),M.setOpen(!1,Bt(Qa,me.nativeEvent)),Nn(z)&&z.focus();return}$e(me)},onPointerMove(me){mT(me)||(D.current=!0)}}),[Le,$e,L,w,G,M,T,m,z]),Ge=b.useMemo(()=>{function me(ue){M.setOpen(!0,Bt(Iw,ue.nativeEvent,ue.currentTarget))}function ke(ue){g==="auto"&&AE(ue.nativeEvent)&&(I.current=!m)}function de(ue){I.current=g,g==="auto"&&OE(ue.nativeEvent)&&(I.current=!0)}return{onKeyDown(ue){const Se=M.select("open");D.current=!1;const Ue=ue.key.startsWith("Arrow"),Ye=OY(ue.key,De(),p),kt=_m(ue.key,w),ee=(u?Ye:kt)||ue.key==="Enter"||ue.key.trim()==="";if(m&&Se)return $e(ue);if(!(!Se&&!v&&Ue)){if(ee){const ie=_m(ue.key,De());Z.current=u&&ie?null:ue.key}if(u){Ye&&(ts(ue),Se?(Y.current=we(),H(ue)):me(ue));return}kt&&(ne.current!=null&&(Y.current=ne.current),ts(ue),!Se&&v?me(ue):$e(ue),Se&&H(ue))}},onFocus(ue){M.select("open")&&!m&&(Y.current=-1,H(ue))},onPointerDown:de,onPointerEnter:de,onMouseDown:ke,onClick:ke}},[$e,g,we,u,H,M,v,w,De,p,ne,m]),ot=b.useMemo(()=>({...Le,...Ge}),[Le,Ge]);return b.useMemo(()=>i?{reference:ot,floating:He,item:Me,trigger:Ge}:{},[i,ot,He,Ge,Me])}function VP(e,t){const{listRef:n,elementsRef:r,activeIndex:o,onMatch:i,disabledIndices:s,onTyping:c,enabled:d=!0,resetMs:u=750,selectedIndex:p=null}=t,m="rootStore"in e?e.rootStore:e,g=m.useState("open"),y=qr(),v=b.useRef(""),S=b.useRef(p??o??-1),w=b.useRef(null),E=st(N=>{function A(L){return r?.current[L]}function R(L){const F=A(L);return F&&!Yy(F)||F?.matches(":disabled")?!1:s==null||!$g(fs,L,s)}function M(L,F,P=0){if(L.length===0)return-1;const I=(P%L.length+L.length)%L.length,Y=F.toLowerCase();for(let Z=0;Z<L.length;Z+=1){const D=(I+Z)%L.length;if(!(!L[D]?.toLowerCase().startsWith(Y)||!R(D)))return D}return-1}const T=n.current;if(v.current.length>0&&N.key===" "&&(ts(N),c?.(!0)),v.current.length>0&&v.current[0]!==" "&&M(T,v.current)===-1&&N.key!==" "&&c?.(!1),T==null||N.key.length!==1||N.ctrlKey||N.metaKey||N.altKey)return;g&&N.key!==" "&&(ts(N),c?.(!0));const O=v.current==="";O&&(S.current=p??o??-1),T.every((L,F)=>L&&R(F)?L[0]?.toLowerCase()!==L[1]?.toLowerCase():!0)&&v.current===N.key&&(v.current="",S.current=w.current),v.current+=N.key,y.start(u,()=>{v.current="",S.current=w.current,c?.(!1)});const $=((O?p??o??-1:S.current)??0)+1,G=M(T,v.current,$);G!==-1?(i?.(G),w.current=G):N.key!==" "&&(v.current="",c?.(!1))}),k=st(N=>{const A=N.relatedTarget,R=m.select("domReferenceElement"),M=m.select("floatingElement");yt(R,A)||yt(M,A)||(y.clear(),v.current="",S.current=w.current,c?.(!1))});rt(()=>{!g&&p!==null||(y.clear(),w.current=null,v.current!==""&&(v.current=""))},[g,p,y]);const j=b.useMemo(()=>({onKeyDown:E,onBlur:k}),[E,k]);return b.useMemo(()=>d?{reference:j,floating:j}:{},[d,j])}const gT=.1,PY=gT*gT,On=.5;function Nm(e,t,n,r,o,i){return r>=t!=i>=t&&e<=(o-n)*(t-r)/(i-r)+n}function Tm(e,t,n,r,o,i,s,c,d,u){let p=!1;return Nm(e,t,n,r,o,i)&&(p=!p),Nm(e,t,o,i,s,c)&&(p=!p),Nm(e,t,s,c,d,u)&&(p=!p),Nm(e,t,d,u,n,r)&&(p=!p),p}function IY(e,t,n){return e>=n.x&&e<=n.x+n.width&&t>=n.y&&t<=n.y+n.height}function Mm(e,t,n,r,o,i){const s=Math.min(n,o),c=Math.max(n,o),d=Math.min(r,i),u=Math.max(r,i);return e>=s&&e<=c&&t>=d&&t<=u}function BP(e={}){const{blockPointerEvents:t=!1}=e,n=new zi,r=({x:o,y:i,placement:s,elements:c,onClose:d,nodeId:u,tree:p})=>{const m=s?.split("-")[0];let g=!1,y=null,v=null,S=typeof performance<"u"?performance.now():0;function w(k,j){const N=performance.now(),A=N-S;if(y===null||v===null||A===0)return y=k,v=j,S=N,!1;const R=k-y,M=j-v,T=R*R+M*M,O=A*A*PY;return y=k,v=j,S=N,T<O}function E(){n.clear(),d()}return function(j){n.clear();const N=c.domReference,A=c.floating;if(!N||!A||m==null||o==null||i==null)return;const{clientX:R,clientY:M}=j,T=ro(j),O=j.type==="mouseleave",z=yt(A,T),q=yt(N,T);if(z&&(g=!0,!O))return;if(q&&(g=!1,!O)){g=!0;return}if(O&&cn(j.relatedTarget)&&yt(A,j.relatedTarget))return;function $(){return!!(p&&el(p.nodesRef.current,u).length>0)}function G(){$()||E()}if($())return;const L=N.getBoundingClientRect(),F=A.getBoundingClientRect(),P=o>F.right-F.width/2,I=i>F.bottom-F.height/2,Y=F.width>L.width,Z=F.height>L.height,D=(Y?L:F).left,H=(Y?L:F).right,U=(Z?L:F).top,B=(Z?L:F).bottom;if(m==="top"&&i>=L.bottom-1||m==="bottom"&&i<=L.top+1||m==="left"&&o>=L.right-1||m==="right"&&o<=L.left+1){G();return}let X=!1;switch(m){case"top":X=Mm(R,M,D,L.top+1,H,F.bottom-1);break;case"bottom":X=Mm(R,M,D,F.top+1,H,L.bottom-1);break;case"left":X=Mm(R,M,F.right-1,B,L.left+1,U);break;case"right":X=Mm(R,M,L.right-1,B,F.left+1,U);break}if(X)return;if(g&&!IY(R,M,L)){G();return}if(!O&&w(R,M)){G();return}let J=!1;switch(m){case"top":{const Q=Y?On/2:On*4,oe=Y||P?o+Q:o-Q,W=Y?o-Q:P?o+Q:o-Q,ne=i+On+1,je=P||Y?F.bottom-On:F.top,Ee=P?Y?F.bottom-On:F.top:F.bottom-On;J=Tm(R,M,oe,ne,W,ne,F.left,je,F.right,Ee);break}case"bottom":{const Q=Y?On/2:On*4,oe=Y||P?o+Q:o-Q,W=Y?o-Q:P?o+Q:o-Q,ne=i-On,je=P||Y?F.top+On:F.bottom,Ee=P?Y?F.top+On:F.bottom:F.top+On;J=Tm(R,M,oe,ne,W,ne,F.left,je,F.right,Ee);break}case"left":{const Q=Z?On/2:On*4,oe=Z||I?i+Q:i-Q,W=Z?i-Q:I?i+Q:i-Q,ne=o+On+1,je=I||Z?F.right-On:F.left,Ee=I?Z?F.right-On:F.left:F.right-On;J=Tm(R,M,je,F.top,Ee,F.bottom,ne,oe,ne,W);break}case"right":{const Q=Z?On/2:On*4,oe=Z||I?i+Q:i-Q,W=Z?i-Q:I?i+Q:i-Q,ne=o-On,je=I||Z?F.left+On:F.right,Ee=I?Z?F.left+On:F.right:F.left+On;J=Tm(R,M,ne,oe,ne,W,je,F.top,Ee,F.bottom);break}}J?g||n.start(40,G):G()}};return r.__options={...e,blockPointerEvents:t},r}const HP=b.createContext(null);function ms(){const e=b.useContext(HP);if(e===null)throw new Error(Sr(60));return e}const zY={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},LY={valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},FY={disabled:!1,...LY},UP={valid(e){return e===null?null:e?{"data-valid":""}:{"data-invalid":""}}},$Y={invalid:void 0,name:void 0,validityData:{state:zY,errors:[],error:"",value:"",initialValue:null},setValidityData:Ar,disabled:void 0,setTouched:Ar,setDirty:Ar,setFilled:Ar,setFocused:Ar,validationMode:"onSubmit",shouldValidateOnChange:()=>!1,state:FY,registerFieldControl:Ar,validation:{getValidationProps:(e,t=rr)=>t,inputRef:{current:null},registeredInputs:new Map,registerInput:Ar,getInputControl:()=>null,commit:async()=>{},change:Ar}},VY=b.createContext($Y);function ex(e=!0){const t=b.useContext(VY);if(t.setValidityData===Ar&&!e)throw new Error(Sr(28));return t}function qP(e,t,n,r,o=!0,i){const{registerFieldControl:s}=ex(),c=Yr(()=>Symbol());rt(()=>{const d=c.current;if(!o){s(d,void 0);return}s(d,{controlRef:e,getValue:r,id:t,name:i,value:n})},[e,o,r,t,i,s,c,n]),rt(()=>{const d=c.current;return()=>{s(d,void 0)}},[s,c])}function na(e){return Ql(e,"base-ui")}const BY=b.createContext({controlId:void 0,registerControlId:Ar,labelId:void 0,setLabelId:Ar,messageIds:[],setMessageIds:Ar,getDescriptionProps:e=>e});function o1(){return b.useContext(BY)}function i1(e={}){const{id:t,implicit:n=!1,controlRef:r}=e,{controlId:o,registerControlId:i}=o1(),s=na(t),c=n?o:void 0,d=Yr(()=>Symbol()),u=b.useRef(!1),p=b.useRef(t!=null),m=st(()=>{!u.current||i===Ar||(u.current=!1,i(d.current,void 0))});return rt(()=>{if(i===Ar)return;let g;if(n){const y=r?.current;cn(y)&&y.closest("label")!=null?g=t??null:g=c??s}else if(t!=null)p.current=!0,g=t;else if(p.current)g=s;else{m();return}if(g===void 0){m();return}u.current=!0,i(d.current,g)},[t,r,c,i,n,s,d,m]),b.useEffect(()=>m,[m]),o??s}const HY=(e,t)=>Object.is(e,t);function Iu(e,t,n){return e==null||t==null?Object.is(e,t):n(e,t)}function xg(e,t,n){return!e||e.length===0?-1:e.findIndex(r=>r===void 0?!1:Iu(r,t,n))}function UY(e,t,n){return e.filter(r=>!Iu(t,r,n))}function Bw(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return String(e)}}function YP(e){return e!=null&&e.length>0&&typeof e[0]=="object"&&e[0]!=null&&"items"in e[0]}function qY(e){if(!Array.isArray(e))return e!=null&&"null"in e;const t=e;if(YP(t)){for(const n of t)for(const r of n.items)if(r&&r.value==null&&r.label!=null)return!0;return!1}for(const n of t)if(n&&n.value==null&&n.label!=null)return!0;return!1}function ZP(e,t){if(t&&e!=null)return t(e)??"";if(e&&typeof e=="object"){if("label"in e&&e.label!=null)return String(e.label);if("value"in e)return String(e.value)}return Bw(e)}function mu(e,t){return t&&e!=null?t(e)??"":e&&typeof e=="object"&&"value"in e&&"label"in e?Bw(e.value):Bw(e)}function GP(e,t,n){function r(){return ZP(e,n)}if(n&&e!=null)return n(e);if(e&&typeof e=="object"&&"label"in e&&e.label!=null)return e.label;if(t&&!Array.isArray(t))return t[e]??r();if(Array.isArray(t)){const o=t,i=YP(o)?o.flatMap(s=>s.items):o;if(e==null||typeof e!="object"){const s=i.find(c=>c.value===e);return s&&s.label!=null?s.label:r()}if("value"in e){const s=i.find(c=>c&&c.value===e.value);if(s&&s.label!=null)return s.label}}return r()}function YY(e,t,n){return e.reduce((r,o,i)=>(i>0&&r.push(", "),r.push(f.jsx(b.Fragment,{children:GP(o,t,n)},i)),r),[])}const bt={id:e=>e.id,labelId:e=>e.labelId,modal:e=>e.modal,items:e=>e.items,itemToStringLabel:e=>e.itemToStringLabel,isItemEqualToValue:e=>e.isItemEqualToValue,value:e=>e.value,hasSelectedValue:e=>{const{value:t,multiple:n,itemToStringValue:r}=e;return t==null?!1:n&&Array.isArray(t)?t.length>0:mu(t,r)!==""},hasNullItemLabel:(e,t)=>t?qY(e.items):!1,open:e=>e.open,mounted:e=>e.mounted,forceMount:e=>e.forceMount,transitionStatus:e=>e.transitionStatus,openMethod:e=>e.openMethod,activeIndex:e=>e.activeIndex,selectedIndex:e=>e.selectedIndex,isActive:(e,t)=>e.activeIndex===t,isSelected:(e,t)=>{const n=e.isItemEqualToValue,r=e.value;return e.multiple?Array.isArray(r)&&r.some(o=>Iu(t,o,n)):Iu(t,r,n)},isSelectedByFocus:(e,t)=>e.selectedIndex===t,popupProps:e=>e.popupProps,triggerProps:e=>e.triggerProps,triggerElement:e=>e.triggerElement,positionerElement:e=>e.positionerElement,listElement:e=>e.listElement,popupSide:e=>e.popupSide,scrollUpArrowVisible:e=>e.scrollUpArrowVisible,scrollDownArrowVisible:e=>e.scrollDownArrowVisible,hasScrollArrows:e=>e.hasScrollArrows},ZY=b.createContext({elementRef:{current:null},formRef:{current:{fields:new Map}},errors:{},clearErrors:Ar,validationMode:"onSubmit",submitAttemptedRef:{current:!1}});function KP(){return b.useContext(ZY)}function GY(e,t,n=(r,o)=>r===o){return e.length===t.length&&e.every((r,o)=>n(r,t[o]))}function XP(e,t){const n=b.useRef(e),r=st(t);rt(()=>{n.current!==e&&r(n.current),n.current=e},[e,r])}function KY(e){const t=b.useRef(""),n=b.useCallback(o=>{o.defaultPrevented||(t.current=o.pointerType,e(o,o.pointerType))},[e]);return{onClick:b.useCallback(o=>{if(o.detail===0){e(o,"keyboard");return}"pointerType"in o?e(o,o.pointerType):e(o,t.current),t.current=""},[e]),onPointerDown:n}}function QP(e,t){const n=st((i,s)=>{(typeof e=="function"?e():e)||t(s||($y?"touch":""))}),{onClick:r,onPointerDown:o}=KY(n);return b.useMemo(()=>({onClick:r,onPointerDown:o}),[r,o])}function WP(e){const[t,n]=b.useState(null),r=QP(e,n);return XP(e,o=>{o&&!e&&n(null)}),b.useMemo(()=>({openMethod:t,triggerProps:r}),[t,r])}function Nf(e,t=Number.MIN_SAFE_INTEGER,n=Number.MAX_SAFE_INTEGER){return Math.max(t,Math.min(e,n))}const _i=1;function s1(e,t){return Math.max(0,e-t)}function Yg(e,t){if(t<=0)return 0;const n=Nf(e,0,t),r=n,o=t-n,i=r<=_i,s=o<=_i;return i&&s?r<=o?0:t:i?0:s?t:n}function XY(e){const{id:t,value:n,defaultValue:r=null,onValueChange:o,open:i,defaultOpen:s=!1,onOpenChange:c,name:d,form:u,autoComplete:p,disabled:m=!1,readOnly:g=!1,required:y=!1,modal:v=!0,actionsRef:S,inputRef:w,onOpenChangeComplete:E,items:k,multiple:j=!1,itemToStringLabel:N,itemToStringValue:A,isItemEqualToValue:R=HY,highlightItemOnHover:M=!0,children:T}=e,{clearErrors:O}=KP(),{setDirty:z,setTouched:q,setFocused:$,validityData:G,setFilled:L,name:F,disabled:P,validation:I,validationMode:Y}=ex(),Z=i1({id:t}),D=P||m,H=F??d,[U,B]=Pg({controlled:n,default:j?r??fs:r,name:"Select",state:"value"}),[X,J]=Pg({controlled:i,default:s,name:"Select",state:"open"}),Q=b.useRef([]),oe=b.useRef([]),W=b.useRef(null),ne=b.useRef(null),je=b.useRef(0),Ee=b.useRef(null),pe=b.useRef([]),re=b.useRef(!1),ge=b.useRef(null),_e=b.useRef(null),De=b.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0}),we=b.useRef(!1),{mounted:$e,setMounted:Me,transitionStatus:Le}=Ph(X),{openMethod:He,triggerProps:Ge}=WP(X),ot=Yr(()=>new Ah({id:Z,labelId:void 0,modal:v,multiple:j,itemToStringLabel:N,itemToStringValue:A,isItemEqualToValue:R,value:U,open:X,mounted:$e,transitionStatus:Le,items:k,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:{},triggerProps:{},triggerElement:null,positionerElement:null,listElement:null,popupSide:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1})).current,me=vt(ot,bt.activeIndex),ke=vt(ot,bt.selectedIndex),de=vt(ot,bt.triggerElement),ue=vt(ot,bt.positionerElement),Se=uq(He),Ue=He??Se,Ye=b.useMemo(()=>j?"":mu(U,A),[j,U,A]),kt=b.useMemo(()=>j&&Array.isArray(U)?U.map(te=>mu(te,A)):mu(U,A),[j,U,A]),ee=hr(de),ie=st(()=>kt);qP(ee,Z,U,ie,!D,d);const le=b.useRef(U),Ce=j?Array.isArray(U)&&U.length>0:U!=null&&Ye!=="";rt(()=>{L(Ce)},[Ce,L]),rt(function(){let ae=U,fe=!1;if(j){const Je=Array.isArray(U)?U:[];fe=Je.length===0,ae=Je[Je.length-1]}const Ae=fe?-1:xg(pe.current,ae,R),ze=Ae===-1?null:Ae;ze===null&&(_e.current=null),!X&&ot.set("selectedIndex",ze)},[j,X,U,R,ot]);function ve(te){const ae=G.initialValue;return Array.isArray(te)&&Array.isArray(ae)?!GY(te,ae,(fe,Ae)=>Iu(fe,Ae,R)):te!==ae}XP(U,()=>{O(H),z(ve(U)),I.change(U)});const Be=st((te,ae)=>{c?.(te,ae),!ae.isCanceled&&(J(te),!te&&(ae.reason===Qa||ae.reason===Uy)&&(q(!0),$(!1),Y==="onBlur"&&I.commit(U)))}),Pe=st(()=>{Me(!1),ot.update({activeIndex:null,openMethod:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1}),E?.(!1)});ta({enabled:!S,open:X,ref:W,onComplete(){X||Pe()}}),b.useImperativeHandle(S,()=>({unmount:Pe}),[Pe]);const qe=st((te,ae)=>{o?.(te,ae),!ae.isCanceled&&B(te)}),Ke=st(te=>{const ae=s1(te.scrollHeight,te.clientHeight),fe=Yg(te.scrollTop,ae),Ae=fe>0,ze=fe<ae;ot.set("scrollUpArrowVisible",Ae),ot.set("scrollDownArrowVisible",ze)}),nt=RY({open:X,onOpenChange:Be,elements:{reference:de,floating:ue}}),it=YE(nt,{enabled:!g&&!D,event:"mousedown"}),jt=Ky(nt),Ut=$P(nt,{enabled:!g&&!D,listRef:Q,activeIndex:me,selectedIndex:ke,disabledIndices:fs,onNavigate(te){te===null&&!X||ot.set("activeIndex",te)},focusItemOnHover:M}),qt=VP(nt,{enabled:!g&&!D&&(X||!j),listRef:oe,activeIndex:me,selectedIndex:ke,disabledIndices:te=>PD(Q.current[te]),onMatch(te){X?ot.set("activeIndex",te):qe(pe.current[te],Bt(Kl))},onTyping(te){re.current=te}}),at=b.useMemo(()=>mi(qt.reference,Ut.reference,jt.reference,it.reference,Ge),[it.reference,qt.reference,Ut.reference,jt.reference,Ge]),Rt=b.useMemo(()=>mi(Wy,qt.floating,Ut.floating,jt.floating),[qt.floating,Ut.floating,jt.floating]),Gt=Ut.item??rr;cq(()=>{ot.update({popupProps:Rt,triggerProps:at})}),ot.useSyncedValues({id:Z,modal:v,multiple:j,value:U,open:X,mounted:$e,transitionStatus:Le,popupProps:Rt,triggerProps:at,items:k,itemToStringLabel:N,itemToStringValue:A,isItemEqualToValue:R,openMethod:Ue});const Nt=b.useMemo(()=>({store:ot,floatingContext:nt,required:y,disabled:D,readOnly:g,multiple:j,highlightItemOnHover:M,setValue:qe,setOpen:Be,listRef:Q,popupRef:W,scrollHandlerRef:ne,handleScrollArrowVisibility:Ke,scrollArrowsMountedCountRef:je,itemProps:Gt,valueRef:Ee,valuesRef:pe,labelsRef:oe,typingRef:re,selectionRef:De,firstItemTextRef:ge,selectedItemTextRef:_e,validation:I,onOpenChangeComplete:E,alignItemWithTriggerActiveRef:we,initialValueRef:le}),[ot,nt,y,D,g,j,M,qe,Be,Gt,I,E,Ke]),Qn=Xa(w,I.inputRef),hn=j?void 0:H,In=b.useMemo(()=>!j||!Array.isArray(U)||!H?null:U.map(te=>{const ae=mu(te,A);return f.jsx("input",{type:"hidden",form:u,name:H,value:ae,disabled:D},ae)}),[j,U,u,H,A,D]);return f.jsxs(HP.Provider,{value:Nt,children:[T,f.jsx("input",{...I.getValidationProps(D,{onFocus(){ot.state.triggerElement?.focus({focusVisible:!0})},onChange(te){if(te.nativeEvent.defaultPrevented||D||g)return;const ae=te.currentTarget.value,fe=Bt(Kl,te.nativeEvent);function Ae(){if(j)return;const ze=ae.toLowerCase();let Je=pe.current.findIndex(et=>mu(et,A).toLowerCase()===ze||ZP(et,N).toLowerCase()===ze);Je===-1&&(Je=pe.current.findIndex((et,tt)=>{const dt=oe.current[tt];return dt!=null&&dt.toLowerCase()===ze}));const Xe=pe.current[Je];Xe!=null&&qe(Xe,fe)}ot.set("forceMount",!0),queueMicrotask(Ae)}}),id:Z&&hn==null?`${Z}-hidden-input`:void 0,form:u,name:hn,autoComplete:p,value:Ye,disabled:D,required:y&&!(j&&Ce),readOnly:g,ref:Qn,style:H?iq:AD,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),In]})}function QY(e,t){return e??t}let yT=(function(e){return e.startingStyle="data-starting-style",e.endingStyle="data-ending-style",e})({});const WY={"data-starting-style":""},JY={"data-ending-style":""},td={transitionStatus(e){return e==="starting"?WY:e==="ending"?JY:null}};(function(e){return e.open="data-open",e.closed="data-closed",e[e.startingStyle=yT.startingStyle]="startingStyle",e[e.endingStyle=yT.endingStyle]="endingStyle",e.anchorHidden="data-anchor-hidden",e.side="data-side",e.align="data-align",e})({});const eZ={"data-popup-open":""},tZ={"data-popup-open":"","data-pressed":""},nZ={"data-open":""},rZ={"data-closed":""},oZ={"data-anchor-hidden":""},JP={open(e){return e?eZ:null}},Zg={open(e){return e?tZ:null}},tx={open(e){return e?nZ:rZ},anchorHidden(e){return e?oZ:null}},a1={...tx,...td},Am=5;function eI(e,t){const n=iZ(t);return e.clientX>=n.left-Am&&e.clientX<=n.right+Am&&e.clientY>=n.top-Am&&e.clientY<=n.bottom+Am}function iZ(e){const t=e.getBoundingClientRect(),n=Gn(e);if(ME)return t;const r=n.getComputedStyle(e,"::before"),o=n.getComputedStyle(e,"::after");if(!(r.content!=="none"||o.content!=="none"))return t;const s=parseFloat(r.width)||0,c=parseFloat(r.height)||0,d=parseFloat(o.width)||0,u=parseFloat(o.height)||0,p=Math.max(t.width,s,d),m=Math.max(t.height,c,u),g=p-t.width,y=m-t.height;return{left:t.left-g/2,right:t.right+g/2,top:t.top-y/2,bottom:t.bottom+y/2}}const tI=b.createContext(void 0);function nx(e=!1){const t=b.useContext(tI);if(t===void 0&&!e)throw new Error(Sr(16));return t}function sZ(e){const{focusableWhenDisabled:t,disabled:n,composite:r=!1,tabIndex:o=0,isNativeButton:i}=e,s=r&&t!==!1,c=r&&t===!1;return{props:b.useMemo(()=>{const u={onKeyDown(p){n&&t&&p.key!=="Tab"&&p.preventDefault()}};return r||(u.tabIndex=o,!i&&n&&(u.tabIndex=t?o:-1)),(i&&(t||s)||!i&&n)&&(u["aria-disabled"]=n),i&&(!t||c)&&(u.disabled=n),u},[r,n,t,s,c,i,o])}}function vg(e,t,{detail:n=0}={}){e.dispatchEvent(new(Gn(e)).PointerEvent("click",{bubbles:!0,cancelable:!0,composed:!0,detail:n,shiftKey:t.shiftKey,ctrlKey:t.ctrlKey,altKey:t.altKey,metaKey:t.metaKey}))}function ll(e={}){const{disabled:t=!1,focusableWhenDisabled:n,tabIndex:r=0,native:o=!0,composite:i}=e,s=b.useRef(null),c=nx(!0),d=i??c!==void 0,{props:u}=sZ({focusableWhenDisabled:n,disabled:t,composite:d,tabIndex:r,isNativeButton:o}),p=b.useCallback(()=>{const y=s.current;k0(y)&&d&&t&&u.disabled===void 0&&y.disabled&&(y.disabled=!1)},[t,u.disabled,d]);rt(p,[p]);const m=b.useCallback((y={})=>{const{onClick:v,onMouseDown:S,onKeyUp:w,onKeyDown:E,onPointerDown:k,...j}=y;return mi({onClick(N){if(t){N.preventDefault();return}v?.(N)},onMouseDown(N){t||S?.(N)},onKeyDown(N){if(t||(Bg(N),E?.(N),N.baseUIHandlerPrevented))return;const A=N.target===N.currentTarget,R=N.currentTarget,M=k0(R),T=!o&&aZ(R),O=A&&(o?M:!T),z=N.key==="Enter",q=N.key===" ",$=R.getAttribute("role"),G=$?.startsWith("menuitem")||$==="option"||$==="gridcell";if(A&&d&&q){if(N.defaultPrevented&&G)return;N.preventDefault(),(!o||M)&&(N.preventBaseUIHandler(),vg(R,N));return}if(!O||o||!q&&!z){A&&T&&q&&N.preventDefault();return}N.defaultPrevented||(N.preventDefault(),z&&(N.preventBaseUIHandler(),vg(R,N)))},onKeyUp(N){if(!t){if(Bg(N),w?.(N),N.target===N.currentTarget&&o&&d&&k0(N.currentTarget)&&N.key===" "){N.preventDefault();return}N.baseUIHandlerPrevented||N.target===N.currentTarget&&!o&&!d&&!N.defaultPrevented&&N.key===" "&&(N.preventBaseUIHandler(),vg(N.currentTarget,N))}},onPointerDown(N){if(t){N.preventDefault();return}k?.(N)}},o?{type:"button"}:{role:"button"},u,j)},[t,u,d,o]),g=st(y=>{s.current=y,p()});return{getButtonProps:m,buttonRef:g}}function k0(e){return Nn(e)&&e.tagName==="BUTTON"}function aZ(e){return Nn(e)&&e.tagName==="A"&&!!e.href}const lZ=400,cZ={...Zg,...UP,popupSide:e=>e?{"data-popup-side":e}:null,value:()=>null},uZ=b.forwardRef(function(t,n){const{render:r,className:o,id:i,disabled:s=!1,nativeButton:c=!0,style:d,...u}=t,{setTouched:p,setFocused:m,validationMode:g,state:y,disabled:v}=ex(),{labelId:S}=o1(),{store:w,setOpen:E,selectionRef:k,validation:j,readOnly:N,required:A,alignItemWithTriggerActiveRef:R,disabled:M}=ms(),T=v||M||s,O=vt(w,bt.open),z=vt(w,bt.mounted),q=vt(w,bt.value),$=vt(w,bt.triggerProps),G=vt(w,bt.positionerElement),L=vt(w,bt.listElement),F=vt(w,bt.popupSide),P=vt(w,bt.id),I=vt(w,bt.labelId),Y=vt(w,bt.hasSelectedValue),Z=z&&G?F:null,D=i??P,H=QY(S,I);i1({id:D});const U=hr(G),B=b.useRef(null),{getButtonProps:X,buttonRef:J}=ll({disabled:T,native:c}),Q=w.useStateSetter("triggerElement"),oe=qr(),W=qr(),ne=qr();b.useEffect(()=>{if(O)return ne.start(lZ,()=>{k.current.allowUnselectedMouseUp=!0,k.current.allowSelectedMouseUp=!0}),()=>{ne.clear()};k.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0},W.clear()},[O,k,W,ne]);const je=mi($,{id:D,role:"combobox","aria-expanded":O,"aria-haspopup":"listbox","aria-controls":O?L?.id??zg(G)?.id:void 0,"aria-labelledby":H,"aria-readonly":N||void 0,"aria-required":A||void 0,tabIndex:T?-1:0,onFocus(re){m(!0),O&&R.current&&E(!1,Bt(Kl,re.nativeEvent)),oe.start(0,()=>{w.set("forceMount",!0)})},onBlur(re){yt(G,re.relatedTarget)||(p(!0),m(!1),g==="onBlur"&&j.commit(q))},onMouseDown(re){if(O)return;const ge=en(re.currentTarget);function _e(De){if(!B.current)return;const we=De.target;yt(B.current,we)||yt(U.current,we)||eI(De,B.current)||E(!1,Bt(HD,De))}W.start(0,()=>{ge.addEventListener("mouseup",_e,{once:!0})})}},u,X),Ee=j.getValidationProps(T,je);Ee.role="combobox";const pe={...y,open:O,disabled:T,value:q,readOnly:N,popupSide:Z,placeholder:!Y};return wn("button",t,{ref:[n,B,J,Q],state:pe,stateAttributesMapping:cZ,props:Ee})}),dZ={value:()=>null},fZ=b.forwardRef(function(t,n){const{className:r,render:o,children:i,placeholder:s,style:c,...d}=t,{store:u,valueRef:p}=ms(),m=vt(u,bt.value),g=vt(u,bt.items),y=vt(u,bt.itemToStringLabel),v=vt(u,bt.hasSelectedValue),S=!v&&s!=null&&i==null,w=vt(u,bt.hasNullItemLabel,S),E={value:m,placeholder:!v};let k=null;return typeof i=="function"?k=i(m):i!=null?k=i:S&&!w?k=s:Array.isArray(m)?k=YY(m,g,y):k=GP(m,g,y),wn("span",t,{state:E,ref:[n,p],props:[{children:k},d],stateAttributesMapping:dZ})}),hZ=b.forwardRef(function(t,n){const{render:r,className:o,style:i,...s}=t,{store:c}=ms(),u={open:vt(c,bt.open)};return wn("span",t,{state:u,ref:n,props:[{"aria-hidden":!0,children:"▼"},s],stateAttributesMapping:JP})}),pZ=b.forwardRef(function(t,n){const{store:r}=ms(),o=vt(r,bt.mounted),i=vt(r,bt.forceMount);return o||i?f.jsx(Zy,{ref:n,...t}):null});function zh(e){return kE(19)?e:e?"true":void 0}const nI=b.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},nextIndexRef:{current:0}});function mZ(){return b.useContext(nI)}function rx(e){const{children:t,elementsRef:n,labelsRef:r,onMapChange:o}=e,i=st(o),[,s]=b.useState(!1),c=Yr(yZ).current,d=Yr(gZ).current,u=b.useRef(0),p=b.useRef(!0),m=b.useRef([]),g=b.useRef(null),y=st(()=>{p.current||(p.current=!0,s(A=>!A))}),v=st((A,R)=>{d.set(A,R),y()}),S=st(A=>{d.delete(A),y()}),w=st(A=>{const R=new Map;return n.current.length=0,r&&(r.current.length=0),A.forEach(M=>{R.set(M.element,{...M.registration.metadata??{},index:M.index}),n.current[M.index]=M.element,r&&(r.current[M.index]=M.registration.label!==void 0?M.registration.label:M.registration.textRef?.current?.textContent??M.element.textContent)}),u.current=n.current.length,R});function E(A){if(g.current?.disconnect(),g.current=null,typeof MutationObserver!="function"||A.length<2)return;const R=new MutationObserver(T=>{if(!bZ(T))return;let O=null;for(const z of A)if(z.isConnected){if(O&&rI(O,z)>0){R.disconnect(),y();return}O=z}});g.current=R;const M=new Set;for(let T=1;T<A.length;T+=1){const O=vZ(A[T-1],A[T]);O&&M.add(O)}M.forEach(T=>R.observe(T,{childList:!0}))}const k=st(()=>{const[A,R]=xZ(d),M=w(A);E(R),m.current=A,p.current=!1,c.forEach(T=>T(M)),i(M)});rt(()=>(p.current||w(m.current),()=>{n.current=[],r&&(r.current=[])}),[n,r,w]),rt(()=>{p.current&&k()}),rt(()=>()=>{g.current?.disconnect(),p.current=!0},[]);const j=st(A=>(c.add(A),()=>{c.delete(A)})),N=b.useMemo(()=>({register:v,unregister:S,subscribeMapChange:j,nextIndexRef:u}),[v,S,j,u]);return f.jsx(nI.Provider,{value:N,children:t})}function gZ(){return new Map}function yZ(){return new Set}function xZ(e){const t=new Set,n=[],r=[];e.forEach((i,s)=>{if(!s.isConnected)return;const c=i.index,d={index:c??-1,element:s,registration:i};c===null?r.push(d):c>=0&&(t.add(c),n.push(d))});let o=0;return r.sort((i,s)=>rI(i.element,s.element)),r.forEach(i=>{for(;t.has(o);)o+=1;i.index=o,n.push(i),o+=1}),t.size>0&&n.sort((i,s)=>i.index-s.index),[n,r.map(i=>i.element)]}function vZ(e,t){let n=e.parentElement;for(;n&&!n.contains(t);)n=n.parentElement;return n}function bZ(e){for(const t of e)for(let n=0;n<t.removedNodes.length;n+=1)if(t.removedNodes[n].isConnected)return!0;return!1}function rI(e,t){return e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1}const wZ=b.createContext(void 0);function ox(){return b.useContext(wZ)?.direction??"ltr"}const SZ=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:i,platform:s,elements:c,middlewareData:d}=t,{element:u,padding:p=0,offsetParent:m="real"}=Ja(e,t)||{};if(u==null)return{};const g=qD(p),y={x:n,y:r},v=LE(o),S=zE(v),w=await s.getDimensions(u),E=v==="y",k=E?"top":"left",j=E?"bottom":"right",N=E?"clientHeight":"clientWidth",A=i.reference[S]+i.reference[v]-y[v]-i.floating[S],R=y[v]-i.reference[v],M=m==="real"?await s.getOffsetParent?.(u):c.floating;let T=c.floating[N]||i.floating[S];(!T||!await s.isElement?.(M))&&(T=c.floating[N]||i.floating[S]);const O=A/2-R/2,z=T/2-w[S]/2-1,q=Math.min(g[k],z),$=Math.min(g[j],z),G=q,L=T-w[S]-$,F=T/2-w[S]/2+O,P=UD(G,F,L),I=!d.arrow&&il(o)!=null&&F!==P&&i.reference[S]/2-(F<G?q:$)-w[S]/2<0,Y=I?F<G?F-G:F-L:0;return{[v]:y[v]+Y,data:{[v]:P,centerOffset:F-P-Y,...I&&{alignmentOffset:Y}},reset:I}}}),EZ=(e,t)=>({...SZ(e),options:[e,t]}),CZ={name:"hide",async fn(e){const{width:t,height:n,x:r,y:o}=e.rects.reference,i=t===0&&n===0&&r===0&&o===0,s=await e.platform.detectOverflow(e,{elementContext:"reference"});return{data:{referenceHidden:s.top-n>=0||s.right-t>=0||s.bottom-n>=0||s.left-t>=0||i}}}},kZ={sideX:"left",sideY:"top"},xT="--available-width",vT="--available-height";function oI(e,t,n){const r=e==="inline-start"||e==="inline-end";return{top:"top",right:r?n?"inline-start":"inline-end":"right",bottom:"bottom",left:r?n?"inline-end":"inline-start":"left"}[t]}function bT(e,t,n){const{rects:r,placement:o}=e;return{side:oI(t,pi(o),n),align:il(o)||"center",anchor:{width:r.reference.width,height:r.reference.height},positioner:{width:r.floating.width,height:r.floating.height}}}function l1(e){return jZ(e,_Y)}function jZ(e,t){const{anchor:n,positionMethod:r="absolute",side:o="bottom",sideOffset:i=0,align:s="center",alignOffset:c=0,collisionBoundary:d,collisionPadding:u=5,sticky:p=!1,arrowPadding:m=5,disableAnchorTracking:g=!1,inline:y,keepMounted:v=!1,floatingRootContext:S,mounted:w,collisionAvoidance:E,shift:k,nodeId:j,adaptiveOrigin:N,lazyFlip:A=!1,externalTree:R}=e,[M,T]=b.useState(null);!w&&M!==null&&T(null);const O=E.side||"flip",z=E.align||"flip",q=E.fallbackAxisSide||"end",$=k?.crossAxis??!1,G=k?.rootBoundary,L=typeof n=="function"?n:void 0,F=st(L),P=L?F:n,I=hr(n),Y=hr(w),D=ox()==="rtl",H=M||{top:"top",right:"right",bottom:"bottom",left:"left","inline-end":D?"left":"right","inline-start":D?"right":"left"}[o],U=s==="center"?H:`${H}-${s}`;let B=u;typeof B=="number"?B={top:B,right:B,bottom:B,left:B}:B&&(B={top:B.top||0,right:B.right||0,bottom:B.bottom||0,left:B.left||0});const X=1,J=o==="bottom"?X:0,Q=o==="top"?X:0,oe=o==="right"?X:0,W=o==="left"?X:0,ne={boundary:d==="clipping-ancestors"?"clippingAncestors":d,padding:B},je=b.useRef(null),Ee=hr(i),pe=hr(c),re=typeof i!="function"?i:0,ge=typeof c!="function"?c:0,_e=[];y&&_e.push(y),_e.push(xY(it=>{const jt=bT(it,o,D),Ut=typeof Ee.current=="function"?Ee.current(jt):Ee.current,qt=typeof pe.current=="function"?pe.current(jt):pe.current;return{mainAxis:Ut,crossAxis:qt,alignmentAxis:qt}},[re,ge,D,o]));const De=z==="none"&&O!=="shift",we=!De&&(p||$||O==="shift"),$e=O==="none"?null:wY({...ne,padding:{top:B.top+X+J,right:B.right+X+W,bottom:B.bottom+X+Q,left:B.left+X+oe},mainAxis:!$&&O==="flip",crossAxis:z==="flip"?"alignment":!1,fallbackAxisSideDirection:q}),Me=De?null:vY({...ne,rootBoundary:G,mainAxis:z!=="none",crossAxis:we,limiter:p||$?void 0:bY(it=>{if(!je.current)return{};const{width:jt,height:Ut}=je.current.getBoundingClientRect(),qt=fi(pi(it.placement)),at=qt==="y"?jt:Ut,Rt=qt==="y"?B.left+B.right:B.top+B.bottom;return{offset:at/2+Rt/2}})},[ne,p,$,G,B,z]);O==="shift"||z==="shift"||s==="center"?_e.push(Me,$e):_e.push($e,Me),_e.push(SY({...ne,apply({elements:{floating:it},availableWidth:jt,availableHeight:Ut,rects:qt}){if(!Y.current)return;const at=it.style;at.setProperty(xT,`${jt}px`),at.setProperty(vT,`${Ut}px`);const Rt=Gn(it).devicePixelRatio||1,{x:Gt,y:Nt,width:Qn,height:hn}=qt.reference,In=(Math.round((Gt+Qn)*Rt)-Math.round(Gt*Rt))/Rt,te=(Math.round((Nt+hn)*Rt)-Math.round(Nt*Rt))/Rt;at.setProperty("--anchor-width",`${In}px`),at.setProperty("--anchor-height",`${te}px`)}}),EZ(it=>({element:je.current||en(it.elements.floating).createElement("div"),padding:m,offsetParent:"floating"}),[m]),{name:"transformOrigin",fn(it){const{elements:jt,middlewareData:Ut,placement:qt,rects:at,y:Rt}=it,Gt=pi(qt),Nt=fi(Gt),Qn=je.current,hn=Ut.arrow?.x||0,In=Ut.arrow?.y||0,te=Qn?.clientWidth||0,ae=Qn?.clientHeight||0,fe=hn+te/2,Ae=In+ae/2,ze=Math.abs(Ut.shift?.y||0),Je=at.reference.height/2,Xe=typeof i=="function"?i(bT(it,o,D)):i,et=ze>Xe,tt={top:`${fe}px calc(100% + ${Xe}px)`,bottom:`${fe}px ${-Xe}px`,left:`calc(100% + ${Xe}px) ${Ae}px`,right:`${-Xe}px ${Ae}px`}[Gt],dt=`${fe}px ${at.reference.y+Je-Rt}px`;return jt.floating.style.setProperty("--transform-origin",we&&Nt==="y"&&et?dt:tt),{}}},CZ,N),rt(()=>{!w&&S&&S.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[w,S]);const Le=b.useMemo(()=>({elementResize:!g&&typeof ResizeObserver<"u",layoutShift:!g&&typeof IntersectionObserver<"u"}),[g]),{refs:He,elements:Ge,x:ot,y:me,middlewareData:ke,update:de,placement:ue,context:Se,isPositioned:Ue,floatingStyles:Ye}=t({rootContext:S,open:v?w:void 0,placement:U,middleware:_e,strategy:r,whileElementsMounted:v?void 0:(...it)=>fT(...it,Le),nodeId:j,externalTree:R}),{sideX:kt,sideY:ee}=ke.adaptiveOrigin||kZ,ie=Ue?r:"fixed",le=b.useMemo(()=>{let it;return Ue?N?it={position:ie,[kt]:ot,[ee]:me}:it={...Ye,position:ie}:it={position:ie,top:0,left:0},it[xT]="100vw",it[vT]="100vh",Ue||(it.opacity=0),it},[N,ie,kt,ot,ee,me,Ye,Ue]),Ce=b.useRef(null);rt(()=>{if(!w)return;const it=I.current,jt=typeof it=="function"?it():it,qt=(wT(jt)?jt.current:jt)||null||null;qt!==Ce.current&&(He.setPositionReference(qt),Ce.current=qt)},[w,He,P,I]),b.useEffect(()=>{if(!w)return;const it=I.current;typeof it!="function"&&wT(it)&&it.current!==Ce.current&&(He.setPositionReference(it.current),Ce.current=it.current)},[w,He,P,I]),b.useEffect(()=>{if(v&&w&&Ge.reference&&Ge.floating)return fT(Ge.reference,Ge.floating,de,Le)},[v,w,Ge,de,Le]);const ve=pi(ue),Be=oI(o,ve,D),Pe=il(ue)||"center",qe=!!ke.hide?.referenceHidden;rt(()=>{A&&w&&Ue&&ve!==H&&T(ve)},[A,w,Ue,ve,H]);const Ke=b.useMemo(()=>({position:"absolute",top:ke.arrow?.y,left:ke.arrow?.x}),[ke.arrow]),nt=ke.arrow?.centerOffset!==0;return b.useMemo(()=>({positionerStyles:le,arrowStyles:Ke,arrowRef:je,arrowUncentered:nt,side:Be,align:Pe,physicalSide:ve,anchorHidden:qe,refs:He,context:Se,isPositioned:Ue,update:de}),[le,Ke,je,nt,Be,Pe,ve,qe,He,Se,Ue,de])}function wT(e){return e!=null&&"current"in e}const iI=b.createContext(void 0);function c1(){const e=b.useContext(iI);if(!e)throw new Error(Sr(59));return e}const ix=b.forwardRef(function(t,n){const{cutout:r,...o}=t;let i;if(r){const s=r.getBoundingClientRect();i=`polygon(0% 0%,100% 0%,100% 100%,0% 100%,0% 0%,${s.left}px ${s.top}px,${s.left}px ${s.bottom}px,${s.right}px ${s.bottom}px,${s.right}px ${s.top}px,${s.left}px ${s.top}px)`}return f.jsx("div",{ref:n,role:"presentation","data-base-ui-inert":"",...o,style:{position:"fixed",inset:0,userSelect:"none",WebkitUserSelect:"none",clipPath:i}})});function Gg(e,t){e&&Object.assign(e.style,t)}const sI={position:"relative",maxHeight:"100%",overflowX:"hidden",overflowY:"auto"};function sx(e){return e==="starting"?M7:rr}function u1(e,t,{styles:n,transitionStatus:r,props:o,refs:i,hidden:s,inert:c=!1}){const d={...n};return c&&(d.pointerEvents="none"),wn("div",e,{state:t,ref:i,props:[{role:"presentation",hidden:s,style:d},sx(r),o],stateAttributesMapping:tx})}let ST={},ET={},CT="";function ax(e,t){return Oh(e)?e:t}function kT(e,t,n){return/hidden|clip/.test(e.getComputedStyle(ax(t,n)).overflowY)}function RZ(e){if(typeof document>"u")return!1;const t=en(e);return Gn(t).innerWidth-t.documentElement.clientWidth>0}function _Z(e){if(!(typeof CSS<"u"&&CSS.supports&&CSS.supports("scrollbar-gutter","stable"))||typeof document>"u")return!1;const n=en(e),r=n.documentElement,o=n.body,i=ax(r,o),s=i.style.overflowY,c=r.style.scrollbarGutter;r.style.scrollbarGutter="stable",i.style.overflowY="scroll";const d=i.offsetWidth;i.style.overflowY="hidden";const u=i.offsetWidth;return i.style.overflowY=s,r.style.scrollbarGutter=c,d===u}function NZ(e){const t=en(e),n=t.documentElement,r=t.body,o=ax(n,r),i={overflowY:o.style.overflowY,overflowX:o.style.overflowX};return Object.assign(o.style,{overflowY:"hidden",overflowX:"hidden"}),()=>{Object.assign(o.style,i)}}function TZ(e){const t=en(e),n=t.documentElement,r=t.body,o=Gn(n);let i=0,s=0,c=!1;const d=rs.create();if(ea&&(o.visualViewport?.scale??1)!==1)return()=>{};function u(){const y=o.getComputedStyle(n),v=o.getComputedStyle(r),E=(y.scrollbarGutter||"").includes("both-edges")?"stable both-edges":"stable";i=n.scrollTop,s=n.scrollLeft,ST={scrollbarGutter:n.style.scrollbarGutter,overflowY:n.style.overflowY,overflowX:n.style.overflowX},CT=n.style.scrollBehavior,ET={position:r.style.position,height:r.style.height,width:r.style.width,boxSizing:r.style.boxSizing,overflowY:r.style.overflowY,overflowX:r.style.overflowX,scrollBehavior:r.style.scrollBehavior};const k=n.scrollHeight>n.clientHeight,j=n.scrollWidth>n.clientWidth,N=y.overflowY==="scroll"||v.overflowY==="scroll",A=y.overflowX==="scroll"||v.overflowX==="scroll",R=Math.max(0,o.innerWidth-r.clientWidth),M=Math.max(0,o.innerHeight-r.clientHeight),T=parseFloat(v.marginTop)+parseFloat(v.marginBottom),O=parseFloat(v.marginLeft)+parseFloat(v.marginRight),z=ax(n,r);if(c=_Z(e),c){n.style.scrollbarGutter=E,z.style.overflowY="hidden",z.style.overflowX="hidden";return}Object.assign(n.style,{scrollbarGutter:E,overflowY:"hidden",overflowX:"hidden"}),(k||N)&&(n.style.overflowY="scroll"),(j||A)&&(n.style.overflowX="scroll"),Object.assign(r.style,{position:"relative",height:T||M?`calc(100dvh - ${T+M}px)`:"100dvh",width:O||R?`calc(100vw - ${O+R}px)`:"100vw",boxSizing:"border-box",overflowY:"hidden",overflowX:"hidden",scrollBehavior:"unset"}),r.scrollTop=i,r.scrollLeft=s,n.setAttribute("data-base-ui-scroll-locked",""),n.style.scrollBehavior="unset"}function p(){Object.assign(n.style,ST),Object.assign(r.style,ET),c||(n.scrollTop=i,n.scrollLeft=s,n.removeAttribute("data-base-ui-scroll-locked"),n.style.scrollBehavior=CT)}function m(){p(),d.request(u)}u();const g=Wt(o,"resize",m);return()=>{d.cancel(),p(),typeof o.removeEventListener=="function"&&g()}}class MZ{lockCount=0;restore=null;timeoutLock=zi.create();timeoutUnlock=zi.create();acquire(t){return this.lockCount+=1,this.lockCount===1&&this.restore===null&&this.timeoutLock.start(0,()=>this.lock(t)),this.release}release=()=>{this.lockCount-=1,this.lockCount===0&&this.restore&&this.timeoutUnlock.start(0,this.unlock)};unlock=()=>{this.lockCount===0&&this.restore&&(this.restore?.(),this.restore=null)};lock(t){if(this.lockCount===0||this.restore!==null)return;const n=en(t),r=n.documentElement,o=n.body,i=Gn(r);if(kT(i,r,o)){const c=new i.MutationObserver(()=>{kT(i,r,o)||(c.disconnect(),this.restore=null,this.lock(t))}),d={attributes:!0};c.observe(r,d),c.observe(o,d),this.restore=()=>c.disconnect();return}const s=$y||!RZ(t);this.restore=s?NZ(t):TZ(t)}}const AZ=new MZ;function aI(e=!0,t=null){rt(()=>{if(e)return AZ.acquire(t)},[e,t])}const OZ=20;function d1(e,t,n,r){const[o,i]=b.useState(!1);rt(()=>{if(!e||!t||n==null){i(!1);return}const s=en(n).documentElement.clientWidth,c=n.offsetWidth;i(s>0&&c>0&&c>=s-OZ)},[e,t,n]),aI(e&&(!t||o),r)}const DZ={position:"fixed"},PZ=b.forwardRef(function(t,n){const{anchor:r,className:o,render:i,positionMethod:s,side:c,align:d,sideOffset:u,alignOffset:p,collisionBoundary:m="clipping-ancestors",collisionPadding:g,arrowPadding:y,sticky:v,disableAnchorTracking:S,alignItemWithTrigger:w=!0,collisionAvoidance:E=uP,style:k,...j}=t,{store:N,listRef:A,labelsRef:R,alignItemWithTriggerActiveRef:M,selectedItemTextRef:T,valuesRef:O,initialValueRef:z,popupRef:q,setValue:$,floatingContext:G}=ms(),L=vt(N,bt.open),F=vt(N,bt.mounted),P=vt(N,bt.modal),I=vt(N,bt.value),Y=vt(N,bt.openMethod),Z=vt(N,bt.positionerElement),D=vt(N,bt.triggerElement),H=vt(N,bt.isItemEqualToValue),U=vt(N,bt.transitionStatus),B=b.useRef(null),X=b.useRef(null),[J,Q]=b.useState(w),oe=F&&J&&Y!=="touch";!F&&J!==w&&Q(w),b.useImperativeHandle(M,()=>oe),d1((oe||P)&&L,Y==="touch",Z,D);const W=l1({anchor:r,floatingRootContext:G,positionMethod:s,mounted:F,side:c,sideOffset:u,align:d,alignOffset:p,arrowPadding:y,collisionBoundary:m,collisionPadding:g,sticky:v,disableAnchorTracking:S??oe,collisionAvoidance:E,keepMounted:!0}),ne=oe?"none":W.side,je=oe?DZ:W.positionerStyles,Ee={open:L,side:ne,align:W.align,anchorHidden:W.anchorHidden};rt(()=>{N.set("popupSide",W.side)},[N,W.side]);const pe=N.useStateSetter("positionerElement"),re=u1(t,Ee,{styles:je,transitionStatus:U,props:j,refs:[n,pe],hidden:!F,inert:!L}),ge=b.useRef(0),_e=st(we=>{if(O.current.length===0)return;const $e=ge.current;if(ge.current=we.size,we.size===$e)return;const Me=Bt(Kl);if($e!==0&&!N.state.multiple&&I!==null&&xg(O.current,I,H)===-1){const He=z.current,ot=He!=null&&xg(O.current,He,H)!==-1?He:null;$(ot,Me),ot===null&&(N.set("selectedIndex",null),T.current=null)}if($e!==0&&N.state.multiple&&Array.isArray(I)){const Le=I.filter(He=>xg(O.current,He,H)!==-1);Le.length!==I.length&&($(Le,Me),Le.length===0&&(N.set("selectedIndex",null),T.current=null))}if(L&&oe){N.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});const Le={height:""};Gg(Z,Le),Gg(q.current,Le)}}),De=b.useMemo(()=>({...W,side:ne,alignItemWithTriggerActive:oe,setControlledAlignItemWithTrigger:Q,scrollUpArrowRef:B,scrollDownArrowRef:X}),[W,ne,oe,Q]);return f.jsx(rx,{elementsRef:A,labelsRef:R,onMapChange:_e,children:f.jsxs(iI.Provider,{value:De,children:[F&&P&&f.jsx(ix,{inert:zh(!L),cutout:D}),re]})})}),Om="base-ui-disable-scrollbar",Hw={className:Om,getElement(e){return f.jsx("style",{nonce:e,href:Om,precedence:"base-ui:low",children:`.${Om}{scrollbar-width:none}.${Om}::-webkit-scrollbar{display:none}`})}},IZ=b.createContext(void 0);function f1(e){return b.useContext(IZ)}const Uw="ArrowUp",qw="ArrowDown",Yw="ArrowLeft",Zw="ArrowRight",Gw="Home",Kw="End",Lh=new Set([Uw,qw,Yw,Zw,Gw,Kw]),zZ="Shift",LZ=[zZ,"Control","Alt","Meta"];function FZ(e){return Nn(e)&&e.tagName==="INPUT"}function jT(e){return!!(FZ(e)&&e.selectionStart!=null||Nn(e)&&e.tagName==="TEXTAREA")}function RT(e,t,n,r){if(!e||!t||!t.scrollTo)return;let o=e.scrollLeft,i=e.scrollTop;const s=e.clientWidth<e.scrollWidth,c=e.clientHeight<e.scrollHeight;if(s&&r!=="vertical"){const d=_T(e,t,"left"),u=Dm(e),p=Dm(t);n==="ltr"&&(d+t.offsetWidth+p.scrollMarginRight>e.scrollLeft+e.clientWidth-u.scrollPaddingRight?o=d+t.offsetWidth+p.scrollMarginRight-e.clientWidth+u.scrollPaddingRight:d-p.scrollMarginLeft<e.scrollLeft+u.scrollPaddingLeft&&(o=d-p.scrollMarginLeft-u.scrollPaddingLeft)),n==="rtl"&&(d-p.scrollMarginLeft<e.scrollLeft+u.scrollPaddingLeft?o=d-p.scrollMarginLeft-u.scrollPaddingLeft:d+t.offsetWidth+p.scrollMarginRight>e.scrollLeft+e.clientWidth-u.scrollPaddingRight&&(o=d+t.offsetWidth+p.scrollMarginRight-e.clientWidth+u.scrollPaddingRight))}if(c&&r!=="horizontal"){const d=_T(e,t,"top"),u=Dm(e),p=Dm(t);d-p.scrollMarginTop<e.scrollTop+u.scrollPaddingTop?i=d-p.scrollMarginTop-u.scrollPaddingTop:d+t.offsetHeight+p.scrollMarginBottom>e.scrollTop+e.clientHeight-u.scrollPaddingBottom&&(i=d+t.offsetHeight+p.scrollMarginBottom-e.clientHeight+u.scrollPaddingBottom)}e.scrollTo({left:o,top:i,behavior:"auto"})}function _T(e,t,n){const r=n==="left"?"offsetLeft":"offsetTop";let o=0;for(;t.offsetParent&&(o+=t[r],t.offsetParent!==e);)t=t.offsetParent;return o}function Dm(e){const t=getComputedStyle(e);return{scrollMarginTop:parseFloat(t.scrollMarginTop)||0,scrollMarginRight:parseFloat(t.scrollMarginRight)||0,scrollMarginBottom:parseFloat(t.scrollMarginBottom)||0,scrollMarginLeft:parseFloat(t.scrollMarginLeft)||0,scrollPaddingTop:parseFloat(t.scrollPaddingTop)||0,scrollPaddingRight:parseFloat(t.scrollPaddingRight)||0,scrollPaddingBottom:parseFloat(t.scrollPaddingBottom)||0,scrollPaddingLeft:parseFloat(t.scrollPaddingLeft)||0}}const $Z=b.createContext(void 0),VZ={disableStyleElements:!1};function BZ(){return b.useContext($Z)??VZ}const HZ={...tx,...td},UZ=b.forwardRef(function(t,n){const{render:r,className:o,style:i,finalFocus:s,...c}=t,{store:d,popupRef:u,onOpenChangeComplete:p,setOpen:m,valueRef:g,firstItemTextRef:y,selectedItemTextRef:v,multiple:S,handleScrollArrowVisibility:w,scrollHandlerRef:E,listRef:k,highlightItemOnHover:j,floatingContext:N}=ms(),{side:A,align:R,alignItemWithTriggerActive:M,isPositioned:T,setControlledAlignItemWithTrigger:O}=c1(),z=f1()!=null,q=ox(),{nonce:$,disableStyleElements:G}=BZ(),L=vt(d,bt.id),F=vt(d,bt.open),P=vt(d,bt.openMethod),I=vt(d,bt.mounted),Y=vt(d,bt.popupProps),Z=vt(d,bt.transitionStatus),D=vt(d,bt.triggerElement),H=vt(d,bt.positionerElement),U=vt(d,bt.listElement),B=b.useRef(!1),X=b.useRef(!1),J=b.useRef({}),Q=Du(),oe=st(Ee=>{if(!H||!u.current||!X.current)return;const pe=H.style.top==="0px",re=H.style.bottom==="0px";if(B.current||!M||!pe&&!re){w(Ee);return}const ge=TT(H),_e=Tf(H.getBoundingClientRect().height,"y",ge),De=en(H),we=Gn(H),$e=we.getComputedStyle(H),Me=parseFloat($e.marginTop),Le=parseFloat($e.marginBottom),He=NT(we.getComputedStyle(u.current)),Ge=Math.min(De.documentElement.clientHeight-Me-Le,He),ot=Ee.scrollTop,me=Pm(Ee);let ke=null;const de=Ye=>{H.style.height=`${Ye}px`},ue=pe?me-ot:ot,Se=Math.min(_e+ue,Ge);if(ue<=_i){const Ye=Nf(ue,0,Ge-_e);Ye>0&&de(_e+Ye),Ee.scrollTop=pe?me:0,Ge-(_e+Ye)<=_i&&(B.current=!0),w(Ee);return}if(Ge-Se>_i)ke=pe?1/0:0;else if(re&&ot<me){const Ye=_e+ue-Ge;ke=ot-(ue-Ye)}const Ue=Math.ceil(Se);if(Ue!==0&&de(Ue),ke!=null){const Ye=Nf(ke,0,Pm(Ee));Math.abs(Ee.scrollTop-Ye)>_i&&(Ee.scrollTop=Ye)}Ue>=Ge-_i&&(B.current=!0),w(Ee)});b.useImperativeHandle(E,()=>oe,[oe]),ta({open:F,ref:u,onComplete(){F&&p?.(!0)}});const W={open:F,transitionStatus:Z,side:A,align:R};rt(()=>{!H||!u.current||Object.keys(J.current).length||(J.current={top:H.style.top||"0",left:H.style.left||"0",right:H.style.right,height:H.style.height,bottom:H.style.bottom,minHeight:H.style.minHeight,maxHeight:H.style.maxHeight,marginTop:H.style.marginTop,marginBottom:H.style.marginBottom})},[u,H]),rt(()=>{F||M||(X.current=!1,B.current=!1,Gg(H,J.current))},[F,M,H,u]),rt(()=>{const Ee=u.current;if(!F||!D||!H||!Ee||M&&!T||d.state.transitionStatus==="ending")return;if(X.current=!0,Ee.style.removeProperty("--transform-origin"),!M){Q.request(()=>w(U||Ee));return}const pe=qZ(Ee);try{let re=v.current;re?.isConnected||(re=!bt.hasSelectedValue(d.state)&&y.current?.isConnected?y.current:null);const ge=g.current,_e=Gn(H),De=_e.getComputedStyle(H),we=_e.getComputedStyle(Ee),$e=en(D),Me=TT(D),Le=Im(D.getBoundingClientRect(),Me),He=Im(H.getBoundingClientRect(),Me),Ge=Le.height,ot=U||Ee,me=ot.scrollHeight,ke=parseFloat(we.borderBottomWidth),de=parseFloat(De.marginTop)||10,ue=parseFloat(De.marginBottom)||10,Se=parseFloat(De.minHeight)||100,Ue=NT(we),Ye=5,kt=5,ee=20,ie=$e.documentElement.clientHeight-de-ue,le=$e.documentElement.clientWidth,Ce=ie-Le.bottom+Ge;let ve,Be=q==="rtl"?Le.right-He.width:Le.left,Pe=0;if(re&&ge){const Nt=Im(ge.getBoundingClientRect(),Me);ve=Im(re.getBoundingClientRect(),Me),Be=He.left+(q==="rtl"?Nt.right-ve.right:Nt.left-ve.left);const Qn=Nt.top-Le.top+Nt.height/2;Pe=ve.top-He.top+ve.height/2-Qn}const qe=Ce+Pe+ue+ke;let Ke=Math.min(ie,qe);const nt=ie-de-ue,it=qe-Ke,jt=le-kt;H.style.left=`${Nf(Be,Ye,jt-He.width)}px`,H.style.height=`${Ke}px`,H.style.maxHeight="none",H.style.marginTop=`${de}px`,H.style.marginBottom=`${ue}px`,Ee.style.height="100%";const Ut=Pm(ot),qt=it>=Ut-_i;qt&&(Ke=Math.min(ie,He.height)-(it-Ut));const at=Le.top<ee||Le.bottom>ie-ee||Math.ceil(Ke)+_i<Math.min(me,Se),Rt=(_e.visualViewport?.scale??1)!==1&&ea;if(at||Rt){Gg(H,J.current),O(!1);return}const Gt=Math.max(Se,Ke);if(qt){const Nt=Math.max(0,ie-qe);H.style.top=He.height>=nt?"0":`${Nt}px`,H.style.height=`${Ke}px`,ot.scrollTop=Pm(ot)}else H.style.bottom="0",ot.scrollTop=it;if(ve){const Nt=He.top,Qn=He.height,hn=ve.top+ve.height/2,In=Nf(Qn>0?(hn-Nt)/Qn*100:50,0,100);Ee.style.setProperty("--transform-origin",`50% ${In}%`)}(Gt===ie||Ke>=Ue)&&(B.current=!0),w(ot),j&&d.state.selectedIndex===null&&d.state.activeIndex===null&&k.current[0]!=null&&d.set("activeIndex",0)}finally{pe()}},[d,F,H,D,g,y,v,u,w,M,O,Q,U,k,j,q,T]),b.useEffect(()=>{if(!M||!H||!F)return;const Ee=Gn(H);function pe(re){m(!1,Bt(Qq,re))}return Wt(Ee,"resize",pe)},[m,M,H,F]);const ne={...U?{role:"presentation","aria-orientation":void 0}:{role:"listbox","aria-multiselectable":S||void 0,id:`${L}-list`},onKeyDown(Ee){z&&Lh.has(Ee.key)&&Ee.stopPropagation()},onScroll(Ee){U||oe(Ee.currentTarget)},...M&&{style:U?{height:"100%"}:sI},className:!U&&M?Hw.className:void 0},je=wn("div",t,{ref:[n,u],state:W,stateAttributesMapping:HZ,props:[Y,ne,sx(Z),c]});return f.jsxs(b.Fragment,{children:[!G&&Hw.getElement($),f.jsx(Gy,{context:N,modal:!1,disabled:!I,openInteractionType:P,returnFocus:s,restoreFocus:!0,children:je})]})});function NT(e){const t=e.maxHeight;return t.endsWith("px")&&parseFloat(t)||1/0}function Pm(e){return s1(e.scrollHeight,e.clientHeight)}function TT(e){return CP.getScale(e)}function Tf(e,t,n){return e/n[t]}function Im(e,t){return eh({x:Tf(e.x,"x",t),y:Tf(e.y,"y",t),width:Tf(e.width,"x",t),height:Tf(e.height,"y",t)})}const MT=[["transform","none"],["scale","1"],["translate","0 0"]];function qZ(e){const{style:t}=e,n={};for(const[r,o]of MT)n[r]=t.getPropertyValue(r),t.setProperty(r,o,"important");return()=>{for(const[r]of MT){const o=n[r];o?t.setProperty(r,o):t.removeProperty(r)}}}const YZ=b.forwardRef(function(t,n){const{render:r,className:o,style:i,...s}=t,{store:c,scrollHandlerRef:d,multiple:u}=ms(),{alignItemWithTriggerActive:p}=c1(),m=vt(c,bt.hasScrollArrows),g=vt(c,bt.openMethod),v={id:`${vt(c,bt.id)}-list`,role:"listbox","aria-multiselectable":u||void 0,onScroll(w){d.current?.(w.currentTarget)},...p&&{style:sI},className:m&&g!=="touch"?Hw.className:void 0},S=c.useStateSetter("listElement");return wn("div",t,{ref:[n,S],props:[v,s]})});function lx(e={}){const{guess:t,label:n,metadata:r,textRef:o,index:i}=e,{register:s,unregister:c,subscribeMapChange:d,nextIndexRef:u}=mZ(),p=b.useRef(-1),[m,g]=b.useState(i==null&&t?()=>{if(p.current===-1){const w=u.current;u.current+=1,p.current=w}return p.current}:-1),y=i??m,v=b.useRef(null),S=b.useCallback(w=>{const E=v.current;E&&c(E),v.current=w,w&&s(w,{metadata:r??null,index:i??null,label:n,textRef:o})},[i,s,c,r,n,o]);return rt(()=>{if(i==null)return d(w=>{const E=v.current?w.get(v.current)?.index:null;E!=null&&g(E)})},[i,d]),{ref:S,index:y}}const lI=b.createContext(void 0);function h1(){const e=b.useContext(lI);if(!e)throw new Error(Sr(57));return e}const ZZ=b.memo(b.forwardRef(function(t,n){const{render:r,className:o,style:i,value:s=null,label:c,disabled:d=!1,nativeButton:u=!1,...p}=t,m=b.useRef(null),g=lx({guess:!0,label:c,textRef:m}),{store:y,itemProps:v,setOpen:S,setValue:w,selectionRef:E,typingRef:k,valuesRef:j,multiple:N,selectedItemTextRef:A,disabled:R,readOnly:M}=ms(),T=R||d,O=vt(y,bt.isActive,g.index),z=vt(y,bt.open),q=vt(y,bt.isSelected,s),$=vt(y,bt.isSelectedByFocus,g.index),G=vt(y,bt.isItemEqualToValue),L=g.index,F=b.useRef(null);rt(()=>{const Q=j.current;return Q[L]=s,()=>{delete Q[L]}},[L,s,j]),rt(()=>{const Q=y.state.value;let oe=Q;N&&Array.isArray(Q)&&(oe=Q.length>0?Q[Q.length-1]:void 0),oe!==void 0&&Iu(s,oe,G)&&(y.set("selectedIndex",L),m.current&&(A.current=m.current))},[L,N,G,y,s,A]);const P=b.useRef("mouse"),I=b.useRef(!1),{getButtonProps:Y,buttonRef:Z}=ll({disabled:T,focusableWhenDisabled:!0,native:u,composite:!0}),D={disabled:T,selected:q,highlighted:O};function H(Q){if(R||M)return;const oe=y.state.value;if(N){const W=Array.isArray(oe)?oe:[],ne=q?UY(W,s,G):[...W,s];w(ne,Bt(zf,Q))}else w(s,Bt(zf,Q)),S(!1,Bt(zf,Q))}function U(){E.current.dragY=0}const B={role:"option","aria-selected":q,tabIndex:z&&O?0:-1,onKeyDown(Q){y.set("activeIndex",L),Q.key===" "&&k.current&&Q.preventDefault()},onClick(Q){const oe=P.current!=="touch",W=Q.nativeEvent.pointerType,ne=oe&&AE(Q.nativeEvent)&&(W!==void 0||O),je=oe&&!ne&&!I.current;I.current=!1,!(T||je)&&H(Q.nativeEvent)},onPointerEnter(Q){P.current=Q.pointerType},onPointerMove(Q){if(Q.pointerType==="mouse"&&Q.buttons===1){const oe=E.current;oe.dragY+=Q.movementY,oe.dragY**2>=64&&(oe.allowUnselectedMouseUp=!0)}},onPointerDown(Q){P.current=Q.pointerType,I.current=!0,U()},onMouseUp(){if(U(),T||P.current==="touch"||I.current)return;const Q=!E.current.allowSelectedMouseUp&&q,oe=!E.current.allowUnselectedMouseUp&&!q;Q||oe||(I.current=!0,F.current?.click(),I.current=!1)}},X=wn("div",t,{ref:[Z,n,g.ref,F],state:D,props:[v,B,p,Y]}),J=b.useMemo(()=>({selected:q,index:L,textRef:m,selectedByFocus:$}),[q,L,m,$]);return f.jsx(lI.Provider,{value:J,children:X})})),GZ=b.forwardRef(function(t,n){const{selected:r}=h1();return t.keepMounted||r?f.jsx(KZ,{...t,ref:n}):null}),KZ=b.memo(b.forwardRef((e,t)=>{const{render:n,className:r,style:o,keepMounted:i,...s}=e,{selected:c}=h1(),d=b.useRef(null),{transitionStatus:u,setMounted:p}=Ph(c),g=wn("span",e,{ref:[t,d],state:{selected:c,transitionStatus:u},props:[{"aria-hidden":!0,children:"✔️"},s],stateAttributesMapping:td});return ta({open:c,ref:d,onComplete(){c||p(!1)}}),g})),XZ=b.memo(b.forwardRef(function(t,n){const{index:r,textRef:o,selectedByFocus:i}=h1(),{firstItemTextRef:s,selectedItemTextRef:c}=ms(),{render:d,className:u,style:p,...m}=t,g=b.useCallback(v=>{v&&(r===0&&(s.current=v),i&&(c.current=v))},[s,c,r,i]);return wn("div",t,{ref:[g,n,o],props:m})})),cI=b.forwardRef(function(t,n){const{render:r,className:o,style:i,direction:s,keepMounted:c,...d}=t,u=s==="up",{store:p,popupRef:m,listRef:g,handleScrollArrowVisibility:y,scrollArrowsMountedCountRef:v}=ms(),{side:S,scrollDownArrowRef:w,scrollUpArrowRef:E}=c1(),k=u?bt.scrollUpArrowVisible:bt.scrollDownArrowVisible,j=vt(p,k),N=vt(p,bt.openMethod),A=j&&N!=="touch",R=qr(),M=u?E:w,{mounted:T,transitionStatus:O,setMounted:z}=Ph(A);rt(()=>(v.current+=1,p.set("hasScrollArrows",!0),()=>{v.current=Math.max(0,v.current-1),v.current===0&&p.set("hasScrollArrows",!1)}),[p,v]),ta({open:A,ref:M,onComplete(){A||z(!1)}});const G=wn("div",t,{ref:[n,M],state:{direction:s,visible:A,side:S,transitionStatus:O},props:[{"aria-hidden":!0,children:u?"▲":"▼",style:{position:"absolute"},onMouseMove(F){if(F.movementX===0&&F.movementY===0||R.isStarted())return;p.set("activeIndex",null);function P(){const I=p.state.listElement??m.current;if(!I)return;p.set("activeIndex",null),y(I);const Y=s1(I.scrollHeight,I.clientHeight),Z=Yg(I.scrollTop,Y),D=Z===(u?0:Y),H=g.current;if(Z!==I.scrollTop&&(I.scrollTop=Z),D){R.clear();return}if(H.length>0){const U=M.current?.offsetHeight||0;I.scrollTop=QZ(H,u,Z,I.clientHeight,U,Y)}R.start(40,P)}R.start(40,P)},onMouseLeave(){R.clear()}},d],stateAttributesMapping:td});return T||c?G:null});function QZ(e,t,n,r,o,i){if(t){let p=0;const m=n+o-_i;for(let v=0;v<e.length;v+=1){const S=e[v];if(S&&S.offsetTop>=m){p=v;break}}const g=Math.max(0,p-1),y=e[g];return g<p&&y?Yg(y.offsetTop-o,i):0}let s=e.length-1;const c=n+r-o+_i;for(let p=0;p<e.length;p+=1){const m=e[p];if(m&&m.offsetTop+m.offsetHeight>c){s=Math.max(0,p-1);break}}const d=Math.min(e.length-1,s+1),u=e[d];return d>s&&u?Yg(u.offsetTop+u.offsetHeight-r+o,i):i}const WZ=b.forwardRef(function(t,n){return f.jsx(cI,{...t,ref:n,direction:"down"})}),JZ=b.forwardRef(function(t,n){return f.jsx(cI,{...t,ref:n,direction:"up"})});function uI(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(n=uI(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function dI(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=uI(e))&&(r&&(r+=" "),r+=t);return r}const eG=(e,t)=>{const n=new Array(e.length+t.length);for(let r=0;r<e.length;r++)n[r]=e[r];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},tG=(e,t)=>({classGroupId:e,validator:t}),fI=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),Kg="-",AT=[],nG="arbitrary..",rG=e=>{const t=iG(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:s=>{if(s.startsWith("[")&&s.endsWith("]"))return oG(s);const c=s.split(Kg),d=c[0]===""&&c.length>1?1:0;return hI(c,d,t)},getConflictingClassGroupIds:(s,c)=>{if(c){const d=r[s],u=n[s];return d?u?eG(u,d):d:u||AT}return n[s]||AT}}},hI=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const o=e[t],i=n.nextPart.get(o);if(i){const u=hI(e,t+1,i);if(u)return u}const s=n.validators;if(s===null)return;const c=t===0?e.join(Kg):e.slice(t).join(Kg),d=s.length;for(let u=0;u<d;u++){const p=s[u];if(p.validator(c))return p.classGroupId}},oG=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),n=t.indexOf(":"),r=t.slice(0,n);return r?nG+r:void 0})(),iG=e=>{const{theme:t,classGroups:n}=e;return sG(n,t)},sG=(e,t)=>{const n=fI();for(const r in e){const o=e[r];p1(o,n,r,t)}return n},p1=(e,t,n,r)=>{const o=e.length;for(let i=0;i<o;i++){const s=e[i];aG(s,t,n,r)}},aG=(e,t,n,r)=>{if(typeof e=="string"){lG(e,t,n);return}if(typeof e=="function"){cG(e,t,n,r);return}uG(e,t,n,r)},lG=(e,t,n)=>{const r=e===""?t:pI(t,e);r.classGroupId=n},cG=(e,t,n,r)=>{if(dG(e)){p1(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(tG(n,e))},uG=(e,t,n,r)=>{const o=Object.entries(e),i=o.length;for(let s=0;s<i;s++){const[c,d]=o[s];p1(d,pI(t,c),n,r)}},pI=(e,t)=>{let n=e;const r=t.split(Kg),o=r.length;for(let i=0;i<o;i++){const s=r[i];let c=n.nextPart.get(s);c||(c=fI(),n.nextPart.set(s,c)),n=c}return n},dG=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,fG=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null);const o=(i,s)=>{n[i]=s,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(i){let s=n[i];if(s!==void 0)return s;if((s=r[i])!==void 0)return o(i,s),s},set(i,s){i in n?n[i]=s:o(i,s)}}},Xw="!",OT=":",hG=[],DT=(e,t,n,r,o)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:o}),pG=e=>{const{prefix:t,experimentalParseClassName:n}=e;let r=o=>{const i=[];let s=0,c=0,d=0,u;const p=o.length;for(let S=0;S<p;S++){const w=o[S];if(s===0&&c===0){if(w===OT){i.push(o.slice(d,S)),d=S+1;continue}if(w==="/"){u=S;continue}}w==="["?s++:w==="]"?s--:w==="("?c++:w===")"&&c--}const m=i.length===0?o:o.slice(d);let g=m,y=!1;m.endsWith(Xw)?(g=m.slice(0,-1),y=!0):m.startsWith(Xw)&&(g=m.slice(1),y=!0);const v=u&&u>d?u-d:void 0;return DT(i,y,g,v)};if(t){const o=t+OT,i=r;r=s=>s.startsWith(o)?i(s.slice(o.length)):DT(hG,!1,s,void 0,!0)}if(n){const o=r;r=i=>n({className:i,parseClassName:o})}return r},mG=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((n,r)=>{t.set(n,1e6+r)}),n=>{const r=[];let o=[];for(let i=0;i<n.length;i++){const s=n[i],c=s[0]==="[",d=t.has(s);c||d?(o.length>0&&(o.sort(),r.push(...o),o=[]),r.push(s)):o.push(s)}return o.length>0&&(o.sort(),r.push(...o)),r}},gG=e=>({cache:fG(e.cacheSize),parseClassName:pG(e),sortModifiers:mG(e),postfixLookupClassGroupIds:yG(e),...rG(e)}),yG=e=>{const t=Object.create(null),n=e.postfixLookupClassGroups;if(n)for(let r=0;r<n.length;r++)t[n[r]]=!0;return t},xG=/\s+/,vG=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:o,sortModifiers:i,postfixLookupClassGroupIds:s}=t,c=[],d=e.trim().split(xG);let u="";for(let p=d.length-1;p>=0;p-=1){const m=d[p],{isExternal:g,modifiers:y,hasImportantModifier:v,baseClassName:S,maybePostfixModifierPosition:w}=n(m);if(g){u=m+(u.length>0?" "+u:u);continue}let E=!!w,k;if(E){const M=S.substring(0,w);k=r(M);const T=k&&s[k]?r(S):void 0;T&&T!==k&&(k=T,E=!1)}else k=r(S);if(!k){if(!E){u=m+(u.length>0?" "+u:u);continue}if(k=r(S),!k){u=m+(u.length>0?" "+u:u);continue}E=!1}const j=y.length===0?"":y.length===1?y[0]:i(y).join(":"),N=v?j+Xw:j,A=N+k;if(c.indexOf(A)>-1)continue;c.push(A);const R=o(k,E);for(let M=0;M<R.length;++M){const T=R[M];c.push(N+T)}u=m+(u.length>0?" "+u:u)}return u},bG=(...e)=>{let t=0,n,r,o="";for(;t<e.length;)(n=e[t++])&&(r=mI(n))&&(o&&(o+=" "),o+=r);return o},mI=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=mI(e[r]))&&(n&&(n+=" "),n+=t);return n},wG=(e,...t)=>{let n,r,o,i;const s=d=>{const u=t.reduce((p,m)=>m(p),e());return n=gG(u),r=n.cache.get,o=n.cache.set,i=c,c(d)},c=d=>{const u=r(d);if(u)return u;const p=vG(d,n);return o(d,p),p};return i=s,(...d)=>i(bG(...d))},SG=[],kr=e=>{const t=n=>n[e]||SG;return t.isThemeGetter=!0,t},gI=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,yI=/^\((?:(\w[\w-]*):)?(.+)\)$/i,EG=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,CG=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,kG=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,jG=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,RG=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,_G=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Pa=e=>EG.test(e),Qt=e=>!!e&&!Number.isNaN(Number(e)),Wi=e=>!!e&&Number.isInteger(Number(e)),j0=e=>e.endsWith("%")&&Qt(e.slice(0,-1)),zs=e=>CG.test(e),xI=()=>!0,NG=e=>kG.test(e)&&!jG.test(e),m1=()=>!1,TG=e=>RG.test(e),MG=e=>_G.test(e),AG=e=>!lt(e)&&!ct(e),OG=e=>e.startsWith("@container")&&(e[10]==="/"&&e[11]!==void 0||e[11]==="s"&&e[16]!==void 0&&e.startsWith("-size/",10)||e[11]==="n"&&e[18]!==void 0&&e.startsWith("-normal/",10)),DG=e=>cl(e,wI,m1),lt=e=>gI.test(e),Ml=e=>cl(e,SI,NG),PT=e=>cl(e,BG,Qt),PG=e=>cl(e,CI,xI),IG=e=>cl(e,EI,m1),IT=e=>cl(e,vI,m1),zG=e=>cl(e,bI,MG),zm=e=>cl(e,kI,TG),ct=e=>yI.test(e),ff=e=>hc(e,SI),LG=e=>hc(e,EI),zT=e=>hc(e,vI),FG=e=>hc(e,wI),$G=e=>hc(e,bI),Lm=e=>hc(e,kI,!0),VG=e=>hc(e,CI,!0),cl=(e,t,n)=>{const r=gI.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},hc=(e,t,n=!1)=>{const r=yI.exec(e);return r?r[1]?t(r[1]):n:!1},vI=e=>e==="position"||e==="percentage",bI=e=>e==="image"||e==="url",wI=e=>e==="length"||e==="size"||e==="bg-size",SI=e=>e==="length",BG=e=>e==="number",EI=e=>e==="family-name",CI=e=>e==="number"||e==="weight",kI=e=>e==="shadow",HG=()=>{const e=kr("color"),t=kr("font"),n=kr("text"),r=kr("font-weight"),o=kr("tracking"),i=kr("leading"),s=kr("breakpoint"),c=kr("container"),d=kr("spacing"),u=kr("radius"),p=kr("shadow"),m=kr("inset-shadow"),g=kr("text-shadow"),y=kr("drop-shadow"),v=kr("blur"),S=kr("perspective"),w=kr("aspect"),E=kr("ease"),k=kr("animate"),j=()=>["auto","avoid","all","avoid-page","page","left","right","column"],N=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],A=()=>[...N(),ct,lt],R=()=>["auto","hidden","clip","visible","scroll"],M=()=>["auto","contain","none"],T=()=>[ct,lt,d],O=()=>[Pa,"full","auto",...T()],z=()=>[Wi,"none","subgrid",ct,lt],q=()=>["auto",{span:["full",Wi,ct,lt]},Wi,ct,lt],$=()=>[Wi,"auto",ct,lt],G=()=>["auto","min","max","fr",ct,lt],L=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],F=()=>["start","end","center","stretch","center-safe","end-safe"],P=()=>["auto",...T()],I=()=>[Pa,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...T()],Y=()=>[Pa,"screen","full","dvw","lvw","svw","min","max","fit",...T()],Z=()=>[Pa,"screen","full","lh","dvh","lvh","svh","min","max","fit",...T()],D=()=>[e,ct,lt],H=()=>[...N(),zT,IT,{position:[ct,lt]}],U=()=>["no-repeat",{repeat:["","x","y","space","round"]}],B=()=>["auto","cover","contain",FG,DG,{size:[ct,lt]}],X=()=>[j0,ff,Ml],J=()=>["","none","full",u,ct,lt],Q=()=>["",Qt,ff,Ml],oe=()=>["solid","dashed","dotted","double"],W=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ne=()=>[Qt,j0,zT,IT],je=()=>["","none",v,ct,lt],Ee=()=>["none",Qt,ct,lt],pe=()=>["none",Qt,ct,lt],re=()=>[Qt,ct,lt],ge=()=>[Pa,"full",...T()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[zs],breakpoint:[zs],color:[xI],container:[zs],"drop-shadow":[zs],ease:["in","out","in-out"],font:[AG],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[zs],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[zs],shadow:[zs],spacing:["px",Qt],text:[zs],"text-shadow":[zs],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Pa,lt,ct,w]}],container:["container"],"container-type":[{"@container":["","normal","size",ct,lt]}],"container-named":[OG],columns:[{columns:[Qt,lt,ct,c]}],"break-after":[{"break-after":j()}],"break-before":[{"break-before":j()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:A()}],overflow:[{overflow:R()}],"overflow-x":[{"overflow-x":R()}],"overflow-y":[{"overflow-y":R()}],overscroll:[{overscroll:M()}],"overscroll-x":[{"overscroll-x":M()}],"overscroll-y":[{"overscroll-y":M()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:O()}],"inset-x":[{"inset-x":O()}],"inset-y":[{"inset-y":O()}],start:[{"inset-s":O(),start:O()}],end:[{"inset-e":O(),end:O()}],"inset-bs":[{"inset-bs":O()}],"inset-be":[{"inset-be":O()}],top:[{top:O()}],right:[{right:O()}],bottom:[{bottom:O()}],left:[{left:O()}],visibility:["visible","invisible","collapse"],z:[{z:[Wi,"auto",ct,lt]}],basis:[{basis:[Pa,"full","auto",c,...T()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Qt,Pa,"auto","initial","none",lt]}],grow:[{grow:["",Qt,ct,lt]}],shrink:[{shrink:["",Qt,ct,lt]}],order:[{order:[Wi,"first","last","none",ct,lt]}],"grid-cols":[{"grid-cols":z()}],"col-start-end":[{col:q()}],"col-start":[{"col-start":$()}],"col-end":[{"col-end":$()}],"grid-rows":[{"grid-rows":z()}],"row-start-end":[{row:q()}],"row-start":[{"row-start":$()}],"row-end":[{"row-end":$()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":G()}],"auto-rows":[{"auto-rows":G()}],gap:[{gap:T()}],"gap-x":[{"gap-x":T()}],"gap-y":[{"gap-y":T()}],"justify-content":[{justify:[...L(),"normal"]}],"justify-items":[{"justify-items":[...F(),"normal"]}],"justify-self":[{"justify-self":["auto",...F()]}],"align-content":[{content:["normal",...L()]}],"align-items":[{items:[...F(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...F(),{baseline:["","last"]}]}],"place-content":[{"place-content":L()}],"place-items":[{"place-items":[...F(),"baseline"]}],"place-self":[{"place-self":["auto",...F()]}],p:[{p:T()}],px:[{px:T()}],py:[{py:T()}],ps:[{ps:T()}],pe:[{pe:T()}],pbs:[{pbs:T()}],pbe:[{pbe:T()}],pt:[{pt:T()}],pr:[{pr:T()}],pb:[{pb:T()}],pl:[{pl:T()}],m:[{m:P()}],mx:[{mx:P()}],my:[{my:P()}],ms:[{ms:P()}],me:[{me:P()}],mbs:[{mbs:P()}],mbe:[{mbe:P()}],mt:[{mt:P()}],mr:[{mr:P()}],mb:[{mb:P()}],ml:[{ml:P()}],"space-x":[{"space-x":T()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":T()}],"space-y-reverse":["space-y-reverse"],size:[{size:I()}],"inline-size":[{inline:["auto",...Y()]}],"min-inline-size":[{"min-inline":["auto",...Y()]}],"max-inline-size":[{"max-inline":["none",...Y()]}],"block-size":[{block:["auto",...Z()]}],"min-block-size":[{"min-block":["auto",...Z()]}],"max-block-size":[{"max-block":["none",...Z()]}],w:[{w:[c,"screen",...I()]}],"min-w":[{"min-w":[c,"screen","none",...I()]}],"max-w":[{"max-w":[c,"screen","none","prose",{screen:[s]},...I()]}],h:[{h:["screen","lh",...I()]}],"min-h":[{"min-h":["screen","lh","none",...I()]}],"max-h":[{"max-h":["screen","lh",...I()]}],"font-size":[{text:["base",n,ff,Ml]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,VG,PG]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",j0,lt]}],"font-family":[{font:[LG,IG,t]}],"font-features":[{"font-features":[lt]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[o,ct,lt]}],"line-clamp":[{"line-clamp":[Qt,"none",ct,PT]}],leading:[{leading:[i,...T()]}],"list-image":[{"list-image":["none",ct,lt]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",ct,lt]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:D()}],"text-color":[{text:D()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...oe(),"wavy"]}],"text-decoration-thickness":[{decoration:[Qt,"from-font","auto",ct,Ml]}],"text-decoration-color":[{decoration:D()}],"underline-offset":[{"underline-offset":[Qt,"auto",ct,lt]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:T()}],"tab-size":[{tab:[Wi,ct,lt]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ct,lt]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",ct,lt]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:H()}],"bg-repeat":[{bg:U()}],"bg-size":[{bg:B()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Wi,ct,lt],radial:["",ct,lt],conic:[Wi,ct,lt]},$G,zG]}],"bg-color":[{bg:D()}],"gradient-from-pos":[{from:X()}],"gradient-via-pos":[{via:X()}],"gradient-to-pos":[{to:X()}],"gradient-from":[{from:D()}],"gradient-via":[{via:D()}],"gradient-to":[{to:D()}],rounded:[{rounded:J()}],"rounded-s":[{"rounded-s":J()}],"rounded-e":[{"rounded-e":J()}],"rounded-t":[{"rounded-t":J()}],"rounded-r":[{"rounded-r":J()}],"rounded-b":[{"rounded-b":J()}],"rounded-l":[{"rounded-l":J()}],"rounded-ss":[{"rounded-ss":J()}],"rounded-se":[{"rounded-se":J()}],"rounded-ee":[{"rounded-ee":J()}],"rounded-es":[{"rounded-es":J()}],"rounded-tl":[{"rounded-tl":J()}],"rounded-tr":[{"rounded-tr":J()}],"rounded-br":[{"rounded-br":J()}],"rounded-bl":[{"rounded-bl":J()}],"border-w":[{border:Q()}],"border-w-x":[{"border-x":Q()}],"border-w-y":[{"border-y":Q()}],"border-w-s":[{"border-s":Q()}],"border-w-e":[{"border-e":Q()}],"border-w-bs":[{"border-bs":Q()}],"border-w-be":[{"border-be":Q()}],"border-w-t":[{"border-t":Q()}],"border-w-r":[{"border-r":Q()}],"border-w-b":[{"border-b":Q()}],"border-w-l":[{"border-l":Q()}],"divide-x":[{"divide-x":Q()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":Q()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...oe(),"hidden","none"]}],"divide-style":[{divide:[...oe(),"hidden","none"]}],"border-color":[{border:D()}],"border-color-x":[{"border-x":D()}],"border-color-y":[{"border-y":D()}],"border-color-s":[{"border-s":D()}],"border-color-e":[{"border-e":D()}],"border-color-bs":[{"border-bs":D()}],"border-color-be":[{"border-be":D()}],"border-color-t":[{"border-t":D()}],"border-color-r":[{"border-r":D()}],"border-color-b":[{"border-b":D()}],"border-color-l":[{"border-l":D()}],"divide-color":[{divide:D()}],"outline-style":[{outline:[...oe(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Qt,ct,lt]}],"outline-w":[{outline:["",Qt,ff,Ml]}],"outline-color":[{outline:D()}],shadow:[{shadow:["","none",p,Lm,zm]}],"shadow-color":[{shadow:D()}],"inset-shadow":[{"inset-shadow":["none",m,Lm,zm]}],"inset-shadow-color":[{"inset-shadow":D()}],"ring-w":[{ring:Q()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:D()}],"ring-offset-w":[{"ring-offset":[Qt,Ml]}],"ring-offset-color":[{"ring-offset":D()}],"inset-ring-w":[{"inset-ring":Q()}],"inset-ring-color":[{"inset-ring":D()}],"text-shadow":[{"text-shadow":["none",g,Lm,zm]}],"text-shadow-color":[{"text-shadow":D()}],opacity:[{opacity:[Qt,ct,lt]}],"mix-blend":[{"mix-blend":[...W(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":W()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Qt]}],"mask-image-linear-from-pos":[{"mask-linear-from":ne()}],"mask-image-linear-to-pos":[{"mask-linear-to":ne()}],"mask-image-linear-from-color":[{"mask-linear-from":D()}],"mask-image-linear-to-color":[{"mask-linear-to":D()}],"mask-image-t-from-pos":[{"mask-t-from":ne()}],"mask-image-t-to-pos":[{"mask-t-to":ne()}],"mask-image-t-from-color":[{"mask-t-from":D()}],"mask-image-t-to-color":[{"mask-t-to":D()}],"mask-image-r-from-pos":[{"mask-r-from":ne()}],"mask-image-r-to-pos":[{"mask-r-to":ne()}],"mask-image-r-from-color":[{"mask-r-from":D()}],"mask-image-r-to-color":[{"mask-r-to":D()}],"mask-image-b-from-pos":[{"mask-b-from":ne()}],"mask-image-b-to-pos":[{"mask-b-to":ne()}],"mask-image-b-from-color":[{"mask-b-from":D()}],"mask-image-b-to-color":[{"mask-b-to":D()}],"mask-image-l-from-pos":[{"mask-l-from":ne()}],"mask-image-l-to-pos":[{"mask-l-to":ne()}],"mask-image-l-from-color":[{"mask-l-from":D()}],"mask-image-l-to-color":[{"mask-l-to":D()}],"mask-image-x-from-pos":[{"mask-x-from":ne()}],"mask-image-x-to-pos":[{"mask-x-to":ne()}],"mask-image-x-from-color":[{"mask-x-from":D()}],"mask-image-x-to-color":[{"mask-x-to":D()}],"mask-image-y-from-pos":[{"mask-y-from":ne()}],"mask-image-y-to-pos":[{"mask-y-to":ne()}],"mask-image-y-from-color":[{"mask-y-from":D()}],"mask-image-y-to-color":[{"mask-y-to":D()}],"mask-image-radial":[{"mask-radial":[ct,lt]}],"mask-image-radial-from-pos":[{"mask-radial-from":ne()}],"mask-image-radial-to-pos":[{"mask-radial-to":ne()}],"mask-image-radial-from-color":[{"mask-radial-from":D()}],"mask-image-radial-to-color":[{"mask-radial-to":D()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":N()}],"mask-image-conic-pos":[{"mask-conic":[Qt]}],"mask-image-conic-from-pos":[{"mask-conic-from":ne()}],"mask-image-conic-to-pos":[{"mask-conic-to":ne()}],"mask-image-conic-from-color":[{"mask-conic-from":D()}],"mask-image-conic-to-color":[{"mask-conic-to":D()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:H()}],"mask-repeat":[{mask:U()}],"mask-size":[{mask:B()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",ct,lt]}],filter:[{filter:["","none",ct,lt]}],blur:[{blur:je()}],brightness:[{brightness:[Qt,ct,lt]}],contrast:[{contrast:[Qt,ct,lt]}],"drop-shadow":[{"drop-shadow":["","none",y,Lm,zm]}],"drop-shadow-color":[{"drop-shadow":D()}],grayscale:[{grayscale:["",Qt,ct,lt]}],"hue-rotate":[{"hue-rotate":[Qt,ct,lt]}],invert:[{invert:["",Qt,ct,lt]}],saturate:[{saturate:[Qt,ct,lt]}],sepia:[{sepia:["",Qt,ct,lt]}],"backdrop-filter":[{"backdrop-filter":["","none",ct,lt]}],"backdrop-blur":[{"backdrop-blur":je()}],"backdrop-brightness":[{"backdrop-brightness":[Qt,ct,lt]}],"backdrop-contrast":[{"backdrop-contrast":[Qt,ct,lt]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Qt,ct,lt]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Qt,ct,lt]}],"backdrop-invert":[{"backdrop-invert":["",Qt,ct,lt]}],"backdrop-opacity":[{"backdrop-opacity":[Qt,ct,lt]}],"backdrop-saturate":[{"backdrop-saturate":[Qt,ct,lt]}],"backdrop-sepia":[{"backdrop-sepia":["",Qt,ct,lt]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":T()}],"border-spacing-x":[{"border-spacing-x":T()}],"border-spacing-y":[{"border-spacing-y":T()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",ct,lt]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Qt,"initial",ct,lt]}],ease:[{ease:["linear","initial",E,ct,lt]}],delay:[{delay:[Qt,ct,lt]}],animate:[{animate:["none",k,ct,lt]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[S,ct,lt]}],"perspective-origin":[{"perspective-origin":A()}],rotate:[{rotate:Ee()}],"rotate-x":[{"rotate-x":Ee()}],"rotate-y":[{"rotate-y":Ee()}],"rotate-z":[{"rotate-z":Ee()}],scale:[{scale:pe()}],"scale-x":[{"scale-x":pe()}],"scale-y":[{"scale-y":pe()}],"scale-z":[{"scale-z":pe()}],"scale-3d":["scale-3d"],skew:[{skew:re()}],"skew-x":[{"skew-x":re()}],"skew-y":[{"skew-y":re()}],transform:[{transform:[ct,lt,"","none","gpu","cpu"]}],"transform-origin":[{origin:A()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:ge()}],"translate-x":[{"translate-x":ge()}],"translate-y":[{"translate-y":ge()}],"translate-z":[{"translate-z":ge()}],"translate-none":["translate-none"],zoom:[{zoom:[Wi,ct,lt]}],accent:[{accent:D()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:D()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",ct,lt]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scrollbar-thumb-color":[{"scrollbar-thumb":D()}],"scrollbar-track-color":[{"scrollbar-track":D()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":T()}],"scroll-mx":[{"scroll-mx":T()}],"scroll-my":[{"scroll-my":T()}],"scroll-ms":[{"scroll-ms":T()}],"scroll-me":[{"scroll-me":T()}],"scroll-mbs":[{"scroll-mbs":T()}],"scroll-mbe":[{"scroll-mbe":T()}],"scroll-mt":[{"scroll-mt":T()}],"scroll-mr":[{"scroll-mr":T()}],"scroll-mb":[{"scroll-mb":T()}],"scroll-ml":[{"scroll-ml":T()}],"scroll-p":[{"scroll-p":T()}],"scroll-px":[{"scroll-px":T()}],"scroll-py":[{"scroll-py":T()}],"scroll-ps":[{"scroll-ps":T()}],"scroll-pe":[{"scroll-pe":T()}],"scroll-pbs":[{"scroll-pbs":T()}],"scroll-pbe":[{"scroll-pbe":T()}],"scroll-pt":[{"scroll-pt":T()}],"scroll-pr":[{"scroll-pr":T()}],"scroll-pb":[{"scroll-pb":T()}],"scroll-pl":[{"scroll-pl":T()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",ct,lt]}],fill:[{fill:["none",...D()]}],"stroke-w":[{stroke:[Qt,ff,Ml,PT]}],stroke:[{stroke:["none",...D()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{"container-named":["container-type"],overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},postfixLookupClassGroups:["container-type"],orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},UG=wG(HG);function Ct(...e){return UG(dI(e))}const pr=XY;function Gs({className:e,...t}){return f.jsx(fZ,{"data-slot":"select-value",className:Ct("flex flex-1 text-left",e),...t})}function mr({className:e,size:t="default",children:n,...r}){return f.jsxs(uZ,{"data-slot":"select-trigger","data-size":t,className:Ct("flex w-fit items-center justify-between gap-1.5 rounded-lg border border-input bg-transparent py-2 pr-2 pl-2.5 text-sm whitespace-nowrap transition-colors outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-placeholder:text-muted-foreground data-[size=default]:h-8 data-[size=sm]:h-7 data-[size=sm]:rounded-[min(var(--radius-md),10px)] *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...r,children:[n,f.jsx(hZ,{render:f.jsx(Oy,{className:"pointer-events-none size-4 text-muted-foreground"})})]})}function gr({className:e,children:t,side:n="bottom",sideOffset:r=4,align:o="center",alignOffset:i=0,alignItemWithTrigger:s=!0,...c}){return f.jsx(pZ,{children:f.jsx(PZ,{side:n,sideOffset:r,align:o,alignOffset:i,alignItemWithTrigger:s,className:"isolate z-50",children:f.jsxs(UZ,{"data-slot":"select-content","data-align-trigger":s,className:Ct("relative isolate z-50 max-h-(--available-height) w-(--anchor-width) min-w-36 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[align-trigger=true]:animate-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",e),...c,children:[f.jsx(qG,{}),f.jsx(YZ,{children:t}),f.jsx(YG,{})]})})})}function Un({className:e,children:t,...n}){return f.jsxs(ZZ,{"data-slot":"select-item",className:Ct("relative flex w-full cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",e),...n,children:[f.jsx(XZ,{className:"flex flex-1 shrink-0 gap-2 whitespace-nowrap",children:t}),f.jsx(GZ,{render:f.jsx("span",{className:"pointer-events-none absolute right-2 flex size-4 items-center justify-center"}),children:f.jsx(Ju,{className:"pointer-events-none"})})]})}function qG({className:e,...t}){return f.jsx(JZ,{"data-slot":"select-scroll-up-button",className:Ct("top-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",e),...t,children:f.jsx(z6,{})})}function YG({className:e,...t}){return f.jsx(WZ,{"data-slot":"select-scroll-down-button",className:Ct("bottom-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",e),...t,children:f.jsx(Oy,{})})}const ZG=b.forwardRef(function(t,n){const{render:r,className:o,disabled:i=!1,focusableWhenDisabled:s=!1,nativeButton:c=!0,style:d,...u}=t,{getButtonProps:p,buttonRef:m}=ll({disabled:i,focusableWhenDisabled:s,native:c});return wn("button",t,{state:{disabled:i},ref:[n,m],props:[u,p]})}),LT=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,FT=dI,Fh=(e,t)=>n=>{var r;if(t?.variants==null)return FT(e,n?.class,n?.className);const{variants:o,defaultVariants:i}=t,s=Object.keys(o).map(u=>{const p=n?.[u],m=i?.[u];if(p===null)return null;const g=LT(p)||LT(m);return o[u][g]}),c=n&&Object.entries(n).reduce((u,p)=>{let[m,g]=p;return g===void 0||(u[m]=g),u},{}),d=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((u,p)=>{let{class:m,className:g,...y}=p;return Object.entries(y).every(v=>{let[S,w]=v;return Array.isArray(w)?w.includes({...i,...c}[S]):{...i,...c}[S]===w})?[...u,m,g]:u},[]);return FT(e,s,d,n?.class,n?.className)},GG=Fh("group/button inline-flex shrink-0 items-center justify-center rounded-lg border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/80",outline:"border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)] aria-expanded:bg-secondary aria-expanded:text-secondary-foreground",ghost:"hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50",destructive:"bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",xs:"h-6 gap-1 rounded-[min(var(--radius-md),10px)] px-2 text-xs in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3",sm:"h-7 gap-1 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5",lg:"h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",icon:"size-8","icon-xs":"size-6 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-lg [&_svg:not([class*='size-'])]:size-3","icon-sm":"size-7 rounded-[min(var(--radius-md),12px)] in-data-[slot=button-group]:rounded-lg","icon-lg":"size-9"}},defaultVariants:{variant:"default",size:"default"}});function Te({className:e,variant:t="default",size:n="default",...r}){return f.jsx(ZG,{"data-slot":"button",className:Ct(GG({variant:t,size:n,className:e})),...r})}const jI=b.createContext(void 0);function RI(e){const t=b.useContext(jI);if(t===void 0&&!e)throw new Error(Sr(33));return t}const _I=b.createContext(void 0);function nd(e){const t=b.useContext(_I);if(t===void 0&&!e)throw new Error(Sr(36));return t}const KG=b.createContext(void 0);function g1(e=!0){const t=b.useContext(KG);if(t===void 0&&!e)throw new Error(Sr(25));return t}function XG(e){const{closeOnClick:t,highlighted:n,id:r,nodeId:o,store:i,typingRef:s,itemRef:c,itemMetadata:d}=e,{events:u}=i.useState("floatingTreeRoot"),p=i.useState("open"),m=g1(!0),g=m!==void 0;return b.useMemo(()=>({id:r,role:"menuitem",tabIndex:p&&n?0:-1,onKeyDown(y){y.key===" "&&s?.current&&y.preventDefault()},onMouseMove(y){o&&u.emit("itemhover",{nodeId:o,target:y.currentTarget})},onClick(y){t&&u.emit("close",{domEvent:y,reason:zf})},onMouseUp(y){if(m){const v=m.initialCursorPointRef.current;if(m.initialCursorPointRef.current=null,g&&v&&Math.abs(y.clientX-v.x)<=1&&Math.abs(y.clientY-v.y)<=1||g&&!TE&&y.button===2)return}c.current&&i.context.allowMouseUpTriggerRef.current&&(!g||y.button===2)&&d.type==="regular-item"&&vg(c.current,y,{detail:1})}}),[t,n,r,u,o,p,i,s,c,m,g,d])}const QG={type:"regular-item"};function WG(e){const{closeOnClick:t,disabled:n,highlighted:r,id:o,store:i,typingRef:s=i.context.typingRef,nativeButton:c,itemMetadata:d,nodeId:u}=e,p=b.useRef(null),{getButtonProps:m,buttonRef:g}=ll({disabled:n,focusableWhenDisabled:!0,native:c,composite:!0}),y=XG({closeOnClick:t,highlighted:r,id:o,nodeId:u,store:i,typingRef:s,itemRef:p,itemMetadata:d}),v=b.useCallback(w=>mi(y,{onMouseEnter(){d.type==="submenu-trigger"&&d.setActive()}},w,m),[y,m,d]),S=Xa(p,g);return b.useMemo(()=>({getItemProps:v,itemRef:S}),[v,S])}const NI=b.createContext(void 0);function JG(){const e=b.useContext(NI);if(e===void 0)throw new Error(Sr(31));return e}const eK=b.forwardRef(function(t,n){const{render:r,className:o,style:i,...s}=t,[c,d]=b.useState(void 0),u=wn("div",t,{ref:n,props:{role:"group","aria-labelledby":c,...s}});return f.jsx(NI.Provider,{value:d,children:u})}),tK=b.forwardRef(function(t,n){const{render:r,className:o,style:i,id:s,...c}=t,d=na(s),u=JG();return rt(()=>(u(d),()=>{u(p=>p===d?void 0:p)}),[u,d]),wn("div",t,{ref:n,props:{id:d,role:"presentation",...c}})}),nK=b.forwardRef(function(t,n){const{render:r,className:o,id:i,label:s,nativeButton:c=!1,disabled:d=!1,closeOnClick:u=!0,style:p,...m}=t,g=lx({guess:!0,label:s}),y=RI(!0),v=na(i),{store:S}=nd(),w=S.useState("disabled"),E=d||w,k=S.useState("isActive",g.index),j=S.useState("itemProps"),{getItemProps:N,itemRef:A}=WG({closeOnClick:u,disabled:E,highlighted:k,id:v,store:S,nativeButton:c,nodeId:y?.context.nodeId,itemMetadata:QG});return wn("div",t,{state:{disabled:E,highlighted:k},props:[j,m,N],ref:[A,n,g.ref]})}),rK=b.forwardRef(function(t,n){const{render:r,className:o,style:i,finalFocus:s,...c}=t,{store:d}=nd(),{side:u,align:p}=RI(),m=f1()!=null,g=d.useState("open"),y=d.useState("transitionStatus"),v=d.useState("popupProps"),S=d.useState("mounted"),w=d.useState("instantType"),E=d.useState("activeTriggerElement"),k=d.useState("parent"),j=d.useState("lastOpenChangeReason"),N=d.useState("rootId"),A=d.useState("floatingRootContext"),R=d.useState("floatingTreeRoot"),M=d.useState("closeDelay"),T=d.useState("hoverEnabled"),O=d.useState("disabled"),z=d.useState("openMethod"),q=k.type==="context-menu";ta({open:g,ref:d.context.popupRef,onComplete(){g&&d.context.onOpenChangeComplete?.(!0)}}),b.useEffect(()=>{function P(I){d.setOpen(!1,Bt(I.reason,I.domEvent))}return R.events.on("close",P),()=>{R.events.off("close",P)}},[R.events,d]),LP(A,{enabled:T&&!O&&!q&&k.type!=="menubar",closeDelay:M});const $=d.useStateSetter("popupElement"),G={transitionStatus:y,side:u,align:p,open:g,nested:k.type==="menu",instant:w},L=wn("div",t,{state:G,ref:[n,d.context.popupRef,$],stateAttributesMapping:a1,props:[v,{onKeyDown(P){m&&Lh.has(P.key)&&P.stopPropagation()}},sx(y),c,{"data-rootownerid":N}]});let F=k.type===void 0||q;return(E||k.type==="menubar"&&j!==Uy)&&(F=!0),f.jsx(Gy,{context:A,openInteractionType:z,modal:q,disabled:!S,returnFocus:s===void 0?F:s,initialFocus:k.type!=="menu",restoreFocus:!0,externalTree:k.type!=="menubar"?R:void 0,previousFocusableElement:E,nextFocusableElement:k.type===void 0?d.context.triggerFocusTargetRef:void 0,beforeContentFocusGuardRef:k.type===void 0?d.context.beforeContentFocusGuardRef:void 0,children:L})}),TI=b.createContext(void 0);function oK(){const e=b.useContext(TI);if(e===void 0)throw new Error(Sr(32));return e}const iK=b.forwardRef(function(t,n){const{keepMounted:r=!1,...o}=t,{store:i}=nd();return i.useState("mounted")||r?f.jsx(TI.Provider,{value:r,children:f.jsx(Zy,{ref:n,...o})}):null}),sK=b.forwardRef(function(t,n){const{anchor:r,positionMethod:o="absolute",className:i,render:s,side:c,align:d,sideOffset:u=0,alignOffset:p=0,collisionBoundary:m="clipping-ancestors",collisionPadding:g=5,arrowPadding:y=5,sticky:v=!1,disableAnchorTracking:S=!1,collisionAvoidance:w=uP,style:E,...k}=t,{store:j}=nd(),N=oK(),A=g1(!0),R=j.useState("parent"),M=j.useState("floatingRootContext"),T=j.useState("floatingTreeRoot"),O=j.useState("mounted"),z=j.useState("open"),q=j.useState("modal"),$=j.useState("openMethod"),G=j.useState("activeTriggerElement"),L=j.useState("transitionStatus"),F=j.useState("positionerElement"),P=j.useState("instantType"),I=j.useState("adaptiveOrigin"),Y=j.useState("lastOpenChangeReason"),Z=j.useState("floatingNodeId"),D=j.useState("floatingParentNodeId"),H=M.useState("domReferenceElement"),U=b.useRef(null),B=GE(F);let X=r,J=u,Q=p,oe=d,W=w;R.type==="context-menu"&&(X=r??R.context?.anchor,oe=oe??"start",!c&&oe!=="center"&&(Q=t.alignOffset??2,J=t.sideOffset??-5));let ne=c,je=oe;R.type==="menu"?(ne=ne??"inline-end",je=je??"start",W=t.collisionAvoidance??dP):R.type==="menubar"&&(ne=ne??(R.context.orientation==="vertical"?"inline-end":"bottom"),je=je??"start");const Ee=R.type==="context-menu",pe=l1({anchor:X,floatingRootContext:M,positionMethod:A?"fixed":o,mounted:O,side:ne,sideOffset:J,align:je,alignOffset:Q,arrowPadding:Ee?0:y,collisionBoundary:m,collisionPadding:g,sticky:v,nodeId:Z,keepMounted:N,disableAnchorTracking:S,collisionAvoidance:W,shift:Ee?{crossAxis:!("side"in W&&W.side==="flip"),rootBoundary:"layoutViewport"}:void 0,externalTree:T,adaptiveOrigin:I});b.useEffect(()=>{function Le(He){He.open&&(He.parentNodeId===Z&&j.set("hoverEnabled",!1),He.nodeId!==Z&&He.parentNodeId===j.select("floatingParentNodeId")&&j.setOpen(!1,Bt(Rf)))}return T.events.on("menuopenchange",Le),()=>{T.events.off("menuopenchange",Le)}},[j,T.events,Z]),b.useEffect(()=>{if(j.select("floatingParentNodeId")==null)return;function Le(He){if(He.open||He.nodeId!==j.select("floatingParentNodeId"))return;const Ge=He.reason??Rf;j.setOpen(!1,Bt(Ge))}return T.events.on("menuopenchange",Le),()=>{T.events.off("menuopenchange",Le)}},[T.events,j]);const re=qr();b.useEffect(()=>{z||re.clear()},[z,re]),b.useEffect(()=>{function Le(He){if(!(!z||He.nodeId!==j.select("floatingParentNodeId")))if(He.target&&G&&G!==He.target){const Ge=j.select("closeDelay");Ge>0?re.isStarted()||re.start(Ge,()=>{j.setOpen(!1,Bt(Rf))}):j.setOpen(!1,Bt(Rf))}else re.clear()}return T.events.on("itemhover",Le),()=>{T.events.off("itemhover",Le)}},[T.events,z,G,j,re]),b.useEffect(()=>{const Le={open:z,nodeId:Z,parentNodeId:D,reason:j.select("lastOpenChangeReason")};T.events.emit("menuopenchange",Le)},[T.events,z,j,Z,D]),rt(()=>{const Le=H,He=U.current;if(Le&&(U.current=Le),He&&Le&&Le!==He){j.set("instantType",void 0);const Ge=new AbortController;return B(()=>{j.set("instantType","trigger-change")},Ge.signal),()=>{Ge.abort()}}},[H,B,j]);const ge={open:z,side:pe.side,align:pe.align,anchorHidden:pe.anchorHidden,nested:R.type==="menu",instant:P},_e=R.type==="menubar"&&R.context.modal;d1(z&&(_e||q&&Y!==Dr),$==="touch",F,G);const we=u1(t,ge,{styles:pe.positionerStyles,transitionStatus:L,props:k,refs:[n,j.useStateSetter("positionerElement")],hidden:!O,inert:!z}),$e=O&&R.type!=="menu"&&(R.type!=="menubar"&&q&&Y!==Dr||R.type==="menubar"&&R.context.modal);let Me=null;return R.type==="menubar"?Me=R.context.contentElement:R.type===void 0&&(Me=G),f.jsxs(jI.Provider,{value:pe,children:[$e&&f.jsx(ix,{ref:R.type==="context-menu"||R.type==="nested-context-menu"?R.context.internalBackdropRef:null,inert:zh(!z),cutout:Me}),f.jsx(yP,{id:Z,children:f.jsx(rx,{elementsRef:j.context.itemDomElements,labelsRef:j.context.itemLabels,children:we})})]})}),aK=b.createContext(null);function MI(e){return b.useContext(aK)}const lK={...n1,disabled:e=>e.parent.type==="menubar"&&e.parent.context.disabled||e.disabled,modal:e=>(e.parent.type===void 0||e.parent.type==="context-menu")&&(e.modal??!0),openMethod:e=>e.openMethod,allowMouseEnter:e=>e.allowMouseEnter,highlightItemOnHover:e=>e.highlightItemOnHover,parent:e=>e.parent,rootId:e=>e.parent.type==="menu"?e.parent.store.select("rootId"):e.parent.type!==void 0?e.parent.context.rootId:e.rootId,activeIndex:e=>e.activeIndex,isActive:(e,t)=>e.activeIndex===t,hoverEnabled:e=>e.hoverEnabled,instantType:e=>e.instantType,lastOpenChangeReason:e=>e.openChangeReason,floatingTreeRoot:e=>e.parent.type==="menu"?e.parent.store.select("floatingTreeRoot"):e.floatingTreeRoot,floatingNodeId:e=>e.floatingNodeId,floatingParentNodeId:e=>e.floatingParentNodeId,itemProps:e=>e.itemProps,closeDelay:e=>e.closeDelay,adaptiveOrigin:e=>e.adaptiveOrigin,keyboardEventRelay:e=>{if(e.keyboardEventRelay)return e.keyboardEventRelay;if(e.parent.type==="menu")return e.parent.store.select("keyboardEventRelay")}};class cK extends Ah{constructor(t){super({...dK(),...t},uK(),lK),this.unsubscribeParentListener=this.observe("parent",n=>{if(this.unsubscribeParentListener?.(),n.type==="menu"){let r=n.store.select("rootId"),o=n.store.select("floatingTreeRoot"),i=n.store.select("keyboardEventRelay");this.unsubscribeParentListener=n.store.subscribe(()=>{const s=n.store.select("rootId"),c=n.store.select("floatingTreeRoot"),d=n.store.select("keyboardEventRelay");r===s&&o===c&&i===d||(r=s,o=c,i=d,this.notifyAll())}),this.context.allowMouseUpTriggerRef=n.store.context.allowMouseUpTriggerRef;return}n.type!==void 0&&(this.context.allowMouseUpTriggerRef=n.context.allowMouseUpTriggerRef),this.unsubscribeParentListener=null})}setOpen(t,n){this.state.floatingRootContext.context.events.emit("setOpen",{open:t,eventDetails:n})}unsubscribeParentListener=null}function uK(){return{positionerRef:b.createRef(),popupRef:b.createRef(),typingRef:{current:!1},itemDomElements:{current:[]},itemLabels:{current:[]},allowMouseUpTriggerRef:{current:!1},triggerFocusTargetRef:b.createRef(),beforeContentFocusGuardRef:b.createRef(),onOpenChangeComplete:void 0,triggerElements:new Ih}}function dK(){return{...e1(),disabled:!1,modal:!0,openMethod:null,allowMouseEnter:!1,highlightItemOnHover:!0,parent:{type:void 0},rootId:void 0,activeIndex:null,hoverEnabled:!0,instantType:void 0,openChangeReason:null,floatingTreeRoot:new HE,floatingNodeId:void 0,floatingParentNodeId:null,itemProps:rr,keyboardEventRelay:void 0,closeDelay:0,adaptiveOrigin:void 0}}const fK=b.createContext(void 0);function hK(){return b.useContext(fK)}const pK=zD(function(t){const{children:n,open:r,onOpenChange:o,onOpenChangeComplete:i,defaultOpen:s=!1,disabled:c=!1,modal:d,loopFocus:u=!0,orientation:p="vertical",actionsRef:m,closeParentOnEsc:g=!1,handle:y,triggerId:v,defaultTriggerId:S=null,highlightItemOnHover:w=!0}=t,E=g1(!0),k=nd(!0),j=MI(!0),N=hK(),A=b.useMemo(()=>N&&k?{type:"menu",store:k.store}:j?{type:"menubar",context:j}:E&&!k?{type:"context-menu",context:E}:{type:void 0},[E,k,j,N]),R=mK({open:s,openProp:r,activeTriggerId:S,triggerIdProp:v,parent:A});R.useControlledProp("openProp",r),R.useControlledProp("triggerIdProp",v),R.useContextCallback("onOpenChangeComplete",i);const M=Ql(),T=Ql(),O=R.useState("floatingTreeRoot"),z=UE(O),q=sl(),$=R.useState("open"),G=R.useState("activeTriggerElement"),L=R.useState("positionerElement"),F=R.useState("hoverEnabled"),P=R.useState("disabled"),I=R.useState("lastOpenChangeReason"),Y=R.useState("parent"),Z=R.useState("activeIndex"),D=R.useState("payload"),H=R.useState("floatingParentNodeId"),U=b.useRef(null),B=b.useRef(Y.type!=="context-menu"),X=qr(),J=b.useRef(!0),Q=qr(),oe=H!=null,{openMethod:W,triggerProps:ne}=WP($);R.useSyncedValues({disabled:c,highlightItemOnHover:w,modal:Y.type===void 0?d:void 0,openMethod:W,rootId:M}),QE(R);const{forceUnmount:je}=WE($,R,()=>{R.set("allowMouseEnter",!1)});rt(()=>{E&&!k?R.update({parent:{type:"context-menu",context:E},floatingNodeId:z,floatingParentNodeId:q}):k&&R.update({floatingNodeId:z,floatingParentNodeId:q})},[E,k,z,q,R]),b.useEffect(()=>{if($||(U.current=null),Y.type==="context-menu"){if(!$){X.clear(),B.current=!1;return}X.start(500,()=>{B.current=!0})}},[X,$,Y.type]),rt(()=>{!$&&!F&&R.set("hoverEnabled",!0)},[$,F,R]);const Ee=st((Se,Ue)=>{const Ye=Ue.reason;if(!Se&&!R.select("open")||$===Se&&Ue.trigger===G&&I===Ye)return;const kt=TP(Ue);if(!Se&&Ue.trigger==null&&(Ue.trigger=G??void 0),o?.(Se,Ue),Ue.isCanceled)return;R.state.floatingRootContext.dispatchOpenChange(Se,Ue);const ee=Ue.event;if(Se===!1&&ee?.type==="click"&&ee.pointerType==="touch"&&!J.current)return;Se&&Ye===If?(J.current=!1,Q.start(300,()=>{J.current=!0})):(J.current=!0,Q.clear());const ie=(Ye===Xl||Ye===zf)&&ee.detail===0,le=!Se&&(Ye===qy||Ye==null),Ce={open:Se,openChangeReason:Ye};U.current=Ue.event,XE(Ce,Se,Ue.trigger,kt()),R.update(Ce),Y.type==="menubar"&&(Ye===If||Ye===Qa||Ye===Dr||Ye===Iw||Ye===Rf)?R.set("instantType","group"):ie||le?R.set("instantType",ie?"click":"dismiss"):R.set("instantType",void 0)}),pe=RP({popupStore:R,floatingId:T,nested:q!=null,onOpenChange:Ee}),re=pe.context.events;rt(()=>{const Se=({open:Ue,eventDetails:Ye})=>Ee(Ue,Ye);return re.on("setOpen",Se),()=>{re?.off("setOpen",Se)}},[re,Ee]);const ge=b.useCallback(()=>{R.setOpen(!1,Bt(PE))},[R]);b.useImperativeHandle(m,()=>({unmount:je,close:ge}),[je,ge]);let _e;Y.type==="context-menu"&&(_e=Y.context),b.useImperativeHandle(_e?.positionerRef,()=>L,[L]),b.useImperativeHandle(_e?.actionsRef,()=>({setOpen:Ee}),[Ee]);const De=Ky(pe,{enabled:!P,bubbles:{escapeKey:g&&Y.type==="menu"},outsidePress(){return Y.type!=="context-menu"||U.current?.type==="contextmenu"?!0:B.current},externalTree:oe?O:void 0}),we=ox(),$e=b.useCallback(Se=>{R.select("activeIndex")!==Se&&R.set("activeIndex",Se)},[R]),Me=$P(pe,{enabled:!P,listRef:R.context.itemDomElements,activeIndex:Z,nested:Y.type!==void 0,loopFocus:u,orientation:p,parentOrientation:Y.type==="menubar"?Y.context.orientation:void 0,rtl:we==="rtl",disabledIndices:fs,onNavigate:$e,openOnArrowKeyDown:Y.type!=="context-menu",externalTree:oe?O:void 0,focusItemOnHover:w}),Le=b.useCallback(Se=>{R.context.typingRef.current=Se},[R]),He=VP(pe,{enabled:!P,listRef:R.context.itemLabels,elementsRef:R.context.itemDomElements,activeIndex:Z,resetMs:T7,onMatch:Se=>{$&&Se!==Z&&R.set("activeIndex",Se)},onTyping:Le}),Ge=b.useMemo(()=>{const Se=mi(He.reference,Me.reference,De.reference,{onMouseMove(){R.set("allowMouseEnter",!0)}},ne);return Se["aria-haspopup"]="menu",Se["aria-expanded"]=$,Se},[R,He.reference,Me.reference,De.reference,ne,$]),ot=b.useMemo(()=>{const Se=mi(Me.trigger,De.trigger,ne);return Se["aria-haspopup"]="menu",Se["aria-expanded"]=!1,Se},[Me.trigger,De.trigger,ne]),me=b.useMemo(()=>mi(Wy,{id:T,role:"menu","aria-labelledby":G?.id,onMouseMove(){R.set("allowMouseEnter",!0),Y.type==="menu"&&R.set("hoverEnabled",!1)},onClick(){R.select("hoverEnabled")&&R.set("hoverEnabled",!1)},onKeyDown(Se){const Ue=R.select("keyboardEventRelay");Ue&&!Se.isPropagationStopped()&&Ue(Se)}},He.floating,Me.floating,De.floating),[G,T,Y.type,R,He.floating,Me.floating,De.floating]),ke=Me.item??rr;JE(R,{floatingRootContext:pe,activeTriggerProps:Ge,inactiveTriggerProps:ot,popupProps:me,itemProps:ke});const de=b.useMemo(()=>({store:R,parent:A}),[R,A]),ue=f.jsxs(_I.Provider,{value:de,children:[y&&f.jsx(KE,{handle:y,store:R}),typeof n=="function"?n({payload:D}):n]});return Y.type===void 0||Y.type==="context-menu"?f.jsx(xP,{externalTree:O,children:ue}):ue});function mK(e){return Yr(()=>new cK(e)).current}function AI(e={}){const{highlightItemOnHover:t,highlightedIndex:n,onHighlightedIndexChange:r}=nx(),{ref:o,index:i}=lx(e),s=n===i,c=b.useRef(null),d=Xa(o,c);return{compositeProps:{tabIndex:s?0:-1,onFocus(){r(i)},onMouseMove(){const p=c.current;if(!t||!p)return;const m=p.hasAttribute("disabled")||p.ariaDisabled==="true";!s&&!m&&p.focus()}},compositeRef:d,index:i}}function gK(e){const{render:t,className:n,style:r,state:o=rr,props:i=fs,refs:s=fs,metadata:c,stateAttributesMapping:d,tag:u="div",...p}=e,{compositeProps:m,compositeRef:g}=AI({metadata:c});return wn(u,e,{state:o,ref:[g,...s],props:[m,...i,p],stateAttributesMapping:d})}function OI(e){if(Nn(e)&&e.hasAttribute("data-rootownerid"))return e.getAttribute("data-rootownerid");if(!qs(e))return OI(Xs(e))}function DI(e,t){const n=b.useRef(null);function r(i){Go.flushSync(()=>{e.setOpen(!1,Bt(Qa,i.nativeEvent,i.currentTarget))}),h7(n.current)?.focus()}function o(i){const s=e.select("positionerElement");if(s&&ju(i,s))e.context.beforeContentFocusGuardRef.current?.focus();else{Go.flushSync(()=>{e.setOpen(!1,Bt(Qa,i.nativeEvent,i.currentTarget))});let c=f7(e.context.triggerFocusTargetRef.current||t.current);for(;c!==null&&yt(s,c);){const d=c;if(c=$E(c),c===d)break}c?.focus()}}return{preFocusGuardRef:n,handlePreFocusGuardFocus:r,handleFocusTargetFocus:o}}function yK(e){const{enabled:t=!0,mouseDownAction:n,open:r}=e,o=b.useRef(!1);return b.useMemo(()=>t?{onMouseDown:i=>{(n==="open"&&!r||n==="close"&&r)&&(o.current=!0,en(i.currentTarget).addEventListener("click",()=>{o.current=!1},{once:!0}))},onClick:i=>{o.current&&(o.current=!1,i.preventBaseUIHandler())}}:rr,[t,n,r])}const xK=Cq(function(t,n){const{render:r,className:o,style:i,disabled:s=!1,nativeButton:c=!0,id:d,openOnHover:u,delay:p=100,closeDelay:m=0,handle:g,payload:y,...v}=t,S=nd(!0),E=PP(g)??S?.store;if(!E)throw new Error(Sr(85));const k=na(d),j=E.useState("isTriggerActive",k),N=E.useState("floatingRootContext"),A=E.useState("isOpenedByTrigger",k),R=E.useState("triggerPopupId",k),M=b.useRef(null),T=bK(),O=nx(!0),z=al(),q=b.useMemo(()=>z??new HE,[z]),$=UE(q),G=sl(),{registerTrigger:L,isMountedByThisTrigger:F}=MP(k,M,E,{payload:y,closeDelay:m,parent:T,floatingTreeRoot:q,floatingNodeId:$,floatingParentNodeId:G,keyboardEventRelay:O?.relayKeyboardEvent}),P=T.type==="menubar",I=E.useState("disabled"),Y=s||I||P&&T.context.disabled,{getButtonProps:Z,buttonRef:D}=ll({disabled:Y,native:c});b.useEffect(()=>{!A&&T.type===void 0&&(E.context.allowMouseUpTriggerRef.current=!1)},[E,A,T.type]);const H=b.useRef(null),U=qr(),B=st(Le=>{if(!H.current)return;U.clear(),E.context.allowMouseUpTriggerRef.current=!1;const He=Le.target;yt(H.current,He)||yt(E.select("positionerElement"),He)||He===H.current||He!=null&&OI(He)===E.select("rootId")||eI(Le,H.current)||q.events.emit("close",{domEvent:Le,reason:HD})});b.useEffect(()=>{A&&E.select("lastOpenChangeReason")===Dr&&en(H.current).addEventListener("mouseup",B,{once:!0})},[A,B,E]);const X=P&&T.context.hasSubmenuOpen,Q=FP(N,{enabled:(u??X)&&!Y&&(!P||X&&!F),handleClose:BP({blockPointerEvents:!P}),mouseOnly:!0,move:!1,restMs:T.type===void 0?p:void 0,delay:{close:m},triggerElementRef:M,externalTree:q,isActiveTrigger:j,isClosing:()=>E.select("transitionStatus")==="ending"}),oe=vK(A,E.select("lastOpenChangeReason")),W=YE(N,{enabled:!Y,event:A&&P?"click":"mousedown",toggle:!0,ignoreMouse:!1,stickIfOpen:T.type===void 0?oe:!1}),ne=TY(N,{enabled:!Y&&X}),je=yK({open:A,enabled:P,mouseDownAction:"open"}),Ee=b.useMemo(()=>mi(ne.reference,W.reference),[ne.reference,W.reference]),pe=E.useState("triggerProps",F),{preFocusGuardRef:re,handlePreFocusGuardFocus:ge,handleFocusTargetFocus:_e}=DI(E,M),De={disabled:Y,open:A},we=[H,n,D,L,M],$e=[Ee,Q??rr,pe,{"aria-haspopup":"menu","aria-controls":R,id:k,onMouseDown:Le=>{if(E.select("open"))return;U.start(200,()=>{E.context.allowMouseUpTriggerRef.current=!0}),en(Le.currentTarget).addEventListener("mouseup",B,{once:!0})}},P?{role:"menuitem"}:{},je,v,Z],Me=wn("button",t,{enabled:!P,stateAttributesMapping:Zg,state:De,ref:we,props:$e});return P?f.jsx(gK,{tag:"button",render:r,className:o,style:i,state:De,refs:we,props:$e,stateAttributesMapping:Zg}):A?f.jsxs(b.Fragment,{children:[f.jsx(Wa,{ref:re,onFocus:ge},`${k}-pre-focus-guard`),f.jsx(b.Fragment,{children:Me},k),f.jsx(Wa,{ref:E.context.triggerFocusTargetRef,onFocus:_e},`${k}-post-focus-guard`)]}):f.jsx(b.Fragment,{children:Me},k)});function vK(e,t){const n=qr(),[r,o]=b.useState(!1);return rt(()=>{e&&t===Dr?(o(!0),n.start(lP,()=>{o(!1)})):e||(n.clear(),o(!1))},[e,t,n]),r}function bK(){const e=MI();return b.useMemo(()=>e?{type:"menubar",context:e}:{type:void 0},[e])}const wK=b.forwardRef(function(t,n){const{className:r,render:o,orientation:i="horizontal",style:s,...c}=t;return wn("div",t,{state:{orientation:i},ref:n,props:[{role:"separator","aria-orientation":i},c]})});function Qw({...e}){return f.jsx(pK,{"data-slot":"dropdown-menu",...e})}function Ww({...e}){return f.jsx(xK,{"data-slot":"dropdown-menu-trigger",...e})}function Jw({align:e="start",alignOffset:t=0,side:n="bottom",sideOffset:r=4,className:o,...i}){return f.jsx(iK,{children:f.jsx(sK,{className:"isolate z-50 outline-none",align:e,alignOffset:t,side:n,sideOffset:r,children:f.jsx(rK,{"data-slot":"dropdown-menu-content",className:Ct("z-50 max-h-(--available-height) w-(--anchor-width) min-w-32 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 outline-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:overflow-hidden data-closed:fade-out-0 data-closed:zoom-out-95",o),...i})})})}function $T({...e}){return f.jsx(eK,{"data-slot":"dropdown-menu-group",...e})}function VT({className:e,inset:t,...n}){return f.jsx(tK,{"data-slot":"dropdown-menu-label","data-inset":t,className:Ct("px-1.5 py-1 text-xs font-medium text-muted-foreground data-inset:pl-7",e),...n})}function Ni({className:e,inset:t,variant:n="default",...r}){return f.jsx(nK,{"data-slot":"dropdown-menu-item","data-inset":t,"data-variant":n,className:Ct("group/dropdown-menu-item relative flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-[variant=destructive]:*:[svg]:text-destructive",e),...r})}function SK({className:e,...t}){return f.jsx(wK,{"data-slot":"dropdown-menu-separator",className:Ct("-mx-1 my-1 h-px bg-border",e),...t})}function Za({className:e,...t}){return f.jsx("div",{"data-slot":"skeleton",className:Ct("animate-pulse rounded-md bg-muted",e),...t})}function ft(e){return e instanceof Dy?e.displayMsg:e instanceof Error&&e.message?e.message:"未知错误"}function Kn({rows:e=4,cols:t=5}){return f.jsx("div",{className:"space-y-3","aria-label":"加载中",role:"status",children:Array.from({length:e},(n,r)=>f.jsx("div",{className:"flex gap-4 rounded-lg border border-border p-4",children:Array.from({length:t},(o,i)=>f.jsx(Za,{className:"h-4 flex-1"},i))},r))})}function Dn({message:e,actionLabel:t,onAction:n}){return f.jsxs("div",{role:"status",className:"rounded-lg border border-dashed border-border py-16 text-center",children:[f.jsx("p",{className:"text-sm text-muted-foreground",children:e}),t&&n&&f.jsx(Te,{type:"button",onClick:n,className:"mt-4",children:t})]})}function kn({message:e,onRetry:t}){return f.jsxs("div",{role:"alert",className:"rounded-lg border border-destructive/30 bg-destructive/10 p-4",children:[f.jsxs("p",{className:"text-sm text-destructive",children:["加载失败:",e]}),t&&f.jsx(Te,{type:"button",variant:"destructive",size:"sm",onClick:t,className:"mt-3",children:"重试"})]})}function $h({className:e}){return f.jsx("div",{role:"status","aria-label":"加载中",className:`h-9 w-full animate-pulse rounded-md bg-muted ${e??""}`})}function cx({message:e}){return f.jsx("p",{role:"alert",className:"text-xs text-destructive",children:e})}function Vh({message:e}){return f.jsx("p",{className:"text-sm text-muted-foreground",children:e})}function Oi({title:e,children:t}){return f.jsxs("section",{className:"rounded-lg border border-border bg-card p-5 shadow-sm",children:[f.jsx("h2",{className:"mb-3 text-sm font-semibold text-foreground",children:e}),t]})}const Al=({isActive:e})=>`text-sm transition ${e?"border-b-2 border-foreground font-medium text-foreground":"text-muted-foreground hover:text-foreground"}`;function EK(){const{activeProjects:e,activeProject:t,activeProjectId:n,setActiveProjectId:r}=Kr(),o=Mh(),i=o.mode==="auth"&&o.authenticated,s=()=>{o.logout().then(()=>We.success("已登出")).catch(c=>We.error(ft(c)))};return f.jsx("nav",{className:"sticky top-0 z-40 border-b border-border bg-background/95 backdrop-blur",children:f.jsxs("div",{className:"mx-auto flex w-full max-w-5xl items-center gap-8 px-4 py-3",children:[f.jsx("span",{className:"text-sm font-bold tracking-wide text-foreground",children:"司命 · Siming"}),f.jsxs("div",{className:"flex items-center gap-6",children:[f.jsx(Vo,{to:"/",className:Al,children:"看板"}),f.jsx(Vo,{to:"/tasks",className:Al,children:"任务"}),f.jsx(Vo,{to:"/templates",className:Al,children:"模板"}),f.jsx(Vo,{to:"/nodes",className:Al,children:"节点"}),f.jsx(Vo,{to:"/skills",className:Al,children:"技能"}),f.jsx(Vo,{to:"/agents",className:Al,children:"代理"}),f.jsx(Vo,{to:"/projects",className:Al,children:"项目"}),f.jsxs(Qw,{children:[f.jsx(Ww,{render:f.jsx("button",{type:"button",className:"flex items-center gap-1 text-sm text-muted-foreground transition hover:text-foreground","aria-label":"设置",children:f.jsx(h8,{className:"size-4","aria-hidden":"true"})})}),f.jsx(Jw,{align:"start",children:f.jsxs($T,{children:[f.jsx(VT,{children:"设置"}),f.jsx(Ni,{render:f.jsx(Vo,{to:"/settings/models"}),children:"模型映射"}),f.jsx(Ni,{render:f.jsx(Vo,{to:"/settings/enums"}),children:"枚举管理"}),i&&f.jsx(Ni,{render:f.jsx(Vo,{to:"/settings/tokens"}),children:"Token 管理"})]})})]})]}),i&&f.jsxs(Te,{type:"button",variant:"ghost",size:"sm",className:"hidden md:inline-flex","aria-label":"登出",onClick:s,children:[f.jsx(AN,{className:"size-4","aria-hidden":"true"}),"登出"]}),f.jsx("div",{className:"ml-auto hidden md:block",children:f.jsxs(pr,{value:n,onValueChange:c=>{c!==null&&r(c)},children:[f.jsx(mr,{size:"sm",className:"max-w-44","aria-label":"切换项目",children:f.jsx("span",{className:"truncate text-muted-foreground",children:t?t.name:"加载中…"})}),f.jsx(gr,{children:e.map(c=>f.jsx(Un,{value:c.id,children:c.name},c.id))})]})}),f.jsx("div",{className:"ml-auto md:hidden",children:f.jsxs(Qw,{children:[f.jsx(Ww,{render:f.jsx(Te,{variant:"ghost",size:"sm"}),children:f.jsxs("span",{className:"flex max-w-32 items-center gap-1 truncate text-sm text-muted-foreground",children:[t?t.name:"项目",f.jsx(_h,{className:"size-3.5 shrink-0","aria-hidden":"true"})]})}),f.jsxs(Jw,{align:"end",children:[f.jsxs($T,{children:[f.jsx(VT,{children:"切换项目"}),e.map(c=>f.jsx(Ni,{onClick:()=>r(c.id),children:f.jsxs("span",{className:"flex items-center gap-2",children:[f.jsx(Ju,{className:`size-3.5 ${c.id===n?"opacity-100":"opacity-0"}`,"aria-hidden":"true"}),f.jsx("span",{className:"truncate",children:c.name})]})},c.id))]}),f.jsx(SK,{}),f.jsx(Ni,{render:f.jsx(Vo,{to:"/projects"}),children:"项目管理"}),i&&f.jsxs(f.Fragment,{children:[f.jsx(Ni,{render:f.jsx(Vo,{to:"/settings/tokens"}),children:f.jsxs("span",{className:"flex items-center gap-2",children:[f.jsx(Y6,{className:"size-3.5","aria-hidden":"true"}),"Token 管理"]})}),f.jsx(Ni,{onClick:s,children:f.jsxs("span",{className:"flex items-center gap-2",children:[f.jsx(AN,{className:"size-3.5","aria-hidden":"true"}),"登出"]})})]})]})]})})]})})}function CK(){return f.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background px-4 py-10",children:f.jsx("div",{className:"w-full max-w-md",children:f.jsx(xE,{})})})}function kK({children:e}){const t=Mh(),n=Wo();return t.ready?t.bootstrapError?f.jsx("div",{className:"mx-auto w-full max-w-md px-4 py-24",children:f.jsx(kn,{message:"无法连接服务器",onRetry:t.retryBootstrap})}):t.mode==="open"?f.jsx(f.Fragment,{children:e}):t.authenticated?f.jsx(f.Fragment,{children:e}):f.jsx(Cu,{to:"/login",state:{from:n.pathname+n.search},replace:!0}):f.jsx("div",{className:"flex min-h-screen items-center justify-center px-4",role:"status","aria-label":"加载中",children:f.jsxs("div",{className:"w-full max-w-md space-y-4",children:[f.jsx(Za,{className:"h-8 w-2/3"}),f.jsx(Za,{className:"h-4 w-full"}),f.jsx(Za,{className:"h-4 w-5/6"}),f.jsx(Za,{className:"h-40 w-full"})]})})}function jK(e){return RK(e)||typeof e=="function"||_K(e)}function RK(e){return typeof e=="function"&&(()=>{const t=Object.getPrototypeOf(e);return t.prototype&&t.prototype.isReactComponent})()}function _K(e){return typeof e=="object"&&typeof e.$$typeof=="symbol"&&["react.memo","react.forward_ref"].includes(e.$$typeof.description)}function Fm(e,t){return e==null?null:jK(e)?Ne.createElement(e,t):e}function NK(e){if("cell"in e&&e.cell){const t=e.cell,n=t.column.columnDef,r=t,o=n;return r.getIsAggregated?.()?Fm(o.aggregatedCell??n.cell,t.getContext()):r.getIsPlaceholder?.()?null:Fm(n.cell,t.getContext())}return"header"in e&&e.header?Fm(e.header.column.columnDef.header,e.header.getContext()):"footer"in e&&e.footer?Fm(e.footer.column.columnDef.footer,e.footer.getContext()):null}function TK({update:e,notify:t,unwatched:n}){return{link:r,unlink:o,propagate:i,checkDirty:s,shallowPropagate:c};function r(u,p,m){const g=p.depsTail;if(g!==void 0&&g.dep===u)return;const y=g!==void 0?g.nextDep:p.deps;if(y!==void 0&&y.dep===u){y.version=m,p.depsTail=y;return}const v=u.subsTail;if(v!==void 0&&v.version===m&&v.sub===p)return;const S=p.depsTail=u.subsTail={version:m,dep:u,sub:p,prevDep:g,nextDep:y,prevSub:v,nextSub:void 0};y!==void 0&&(y.prevDep=S),g!==void 0?g.nextDep=S:p.deps=S,v!==void 0?v.nextSub=S:u.subs=S}function o(u,p=u.sub){const m=u.dep,g=u.prevDep,y=u.nextDep,v=u.nextSub,S=u.prevSub;return y!==void 0?y.prevDep=g:p.depsTail=g,g!==void 0?g.nextDep=y:p.deps=y,v!==void 0?v.prevSub=S:m.subsTail=S,S!==void 0?S.nextSub=v:(m.subs=v)===void 0&&n(m),y}function i(u){let p=u.nextSub,m;e:do{const g=u.sub;let y=g.flags;if(y&60?y&12?y&4?!(y&48)&&d(u,g)?(g.flags=y|40,y&=1):y=0:g.flags=y&-9|32:y=0:g.flags=y|32,y&2&&t(g),y&1){const v=g.subs;if(v!==void 0){const S=(u=v).nextSub;S!==void 0&&(m={value:p,prev:m},p=S);continue}}if((u=p)!==void 0){p=u.nextSub;continue}for(;m!==void 0;)if(u=m.value,m=m.prev,u!==void 0){p=u.nextSub;continue e}break}while(!0)}function s(u,p){let m,g=0,y=!1;e:do{const v=u.dep,S=v.flags;if(p.flags&16)y=!0;else if((S&17)===17){if(e(v)){const w=v.subs;w.nextSub!==void 0&&c(w),y=!0}}else if((S&33)===33){(u.nextSub!==void 0||u.prevSub!==void 0)&&(m={value:u,prev:m}),u=v.deps,p=v,++g;continue}if(!y){const w=u.nextDep;if(w!==void 0){u=w;continue}}for(;g--;){const w=p.subs,E=w.nextSub!==void 0;if(E?(u=m.value,m=m.prev):u=w,y){if(e(p)){E&&c(w),p=u.sub;continue}y=!1}else p.flags&=-33;p=u.sub;const k=u.nextDep;if(k!==void 0){u=k;continue e}}return y}while(!0)}function c(u){do{const p=u.sub,m=p.flags;(m&48)===32&&(p.flags=m|16,(m&6)===2&&t(p))}while((u=u.nextSub)!==void 0)}function d(u,p){let m=p.depsTail;for(;m!==void 0;){if(m===u)return!0;m=m.prevDep}return!1}}function MK(e,t,n){const r=typeof e=="object",o=r?e:void 0;return{next:(r?e.next:e)?.bind(o),error:(r?e.error:t)?.bind(o),complete:(r?e.complete:n)?.bind(o)}}const eS=[];let bg=0;const{link:BT,unlink:AK,propagate:OK,checkDirty:PI,shallowPropagate:HT}=TK({update(e){return e._update()},notify(e){eS[tS++]=e,e.flags&=-3},unwatched(e){e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=17,Xg(e))}});let $m=0,tS=0,ns,nS=0;function DK(e){try{++nS,e()}finally{--nS||II()}}function Xg(e){const t=e.depsTail;let n=t!==void 0?t.nextDep:e.deps;for(;n!==void 0;)n=AK(n,e)}function II(){if(!(nS>0)){for(;$m<tS;){const e=eS[$m];eS[$m++]=void 0,e.notify()}$m=0,tS=0}}function PK(e,t){const n=typeof e=="function",r=e,o={_snapshot:n?void 0:e,subs:void 0,subsTail:void 0,deps:void 0,depsTail:void 0,flags:n?0:1,get(){return ns!==void 0&&BT(o,ns,bg),o._snapshot},subscribe(i){const s=MK(i),c={current:!1},d=IK(()=>{o.get(),c.current?s.next?.(o._snapshot):c.current=!0});return{unsubscribe:()=>{d.stop()}}},_update(i){const s=ns,c=t?.compare??Object.is;if(n)ns=o,++bg,o.depsTail=void 0;else if(i===void 0)return!1;n&&(o.flags=5);try{const d=o._snapshot,u=typeof i=="function"?i(d):i===void 0&&n?r(d):i;return d===void 0||!c(d,u)?(o._snapshot=u,!0):!1}finally{ns=s,n&&(o.flags&=-5),Xg(o)}}};return n?(o.flags=17,o.get=function(){const i=o.flags;if(i&16||i&32&&PI(o.deps,o)){if(o._update()){const s=o.subs;s!==void 0&&HT(s)}}else i&32&&(o.flags=i&-33);return ns!==void 0&&BT(o,ns,bg),o._snapshot}):o.set=function(i){if(o._update(i)){const s=o.subs;s!==void 0&&(OK(s),HT(s),II())}},o}function IK(e){const t=()=>{const r=ns;ns=n,++bg,n.depsTail=void 0,n.flags=6;try{return e()}finally{ns=r,n.flags&=-5,Xg(n)}},n={deps:void 0,depsTail:void 0,subs:void 0,subsTail:void 0,flags:6,notify(){const r=this.flags;r&16||r&32&&PI(this.deps,this)?t():this.flags=2},stop(){this.flags=0,this.depsTail=void 0,Xg(this)}};return t(),n}function $f(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,o]of e)if(!t.has(r)||!Object.is(o,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}if(e instanceof Date&&t instanceof Date)return e.getTime()===t.getTime();const n=UT(e);if(n.length!==UT(t).length)return!1;for(let r=0;r<n.length;r++)if(!Object.prototype.hasOwnProperty.call(t,n[r])||!Object.is(e[n[r]],t[n[r]]))return!1;return!0}function UT(e){return Object.keys(e).concat(Object.getOwnPropertySymbols(e))}function zK(e,t){return e===t}function zI(e,t=r=>r,n){const r=n?.compare??zK,o=b.useCallback(s=>{const{unsubscribe:c}=e.subscribe(s);return c},[e]),i=b.useCallback(()=>e.get(),[e]);return CE.useSyncExternalStoreWithSelector(o,i,i,t,r)}function LK(e){const t=zI(e.source,e.selector,{compare:$f});return typeof e.children=="function"?e.children(t):e.children}function FK(e){const t=e;return Object.defineProperty(e,"state",{get(){return e.get()}}),"set"in e&&(t.setState=e.set.bind(e)),t}function $K(e){const{createAtom:t,batch:n}=e,r=t(0);return{createOptionsStore:!1,wrapExternalAtoms:!1,addSubscription:()=>{throw new Error("Feature not supported in current reactivity implementation")},unmount:()=>{throw new Error("Feature not supported in current reactivity implementation")},schedule:e.schedule??(o=>queueMicrotask(o)),batch:n,untrack:o=>o(),createReadonlyAtom:(o,i)=>{const s=i?.compare??Object.is;let c=!1,d;const u=()=>{const m=o();return(!c||!s(d,m))&&(d=m,c=!0),d},p=t(()=>(r.get(),u()),{compare:s});return{get:u,subscribe:p.subscribe.bind(p)}},createWritableAtom:(o,i)=>t(o,{compare:i?.compare}),commit:()=>{r.set(o=>o+1)}}}function VK(e,t=Object.is){let n=!1,r;return{get:e.get,markCommitted:o=>{r=o,n=!0},subscribe:o=>e.subscribe(i=>{(!n||!t(r,i))&&o(i)})}}function BK(){return $K({createAtom:PK,batch:DK})}function Bh(e,t){return typeof e=="function"?e(t):e}function tl(e){if(Array.isArray(e))return e.map(tl);if(e&&typeof e=="object"){const t=Object.getPrototypeOf(e);if(t!==Object.prototype&&t!==null)return e;const n=t===null?nl():{},r=Object.keys(e);for(let o=0;o<r.length;o++){const i=r[o];Object.defineProperty(n,i,{configurable:!0,enumerable:!0,value:tl(e[i]),writable:!0})}return n}return e}function HK(e,t){const n=Object.keys(t),r=e;for(let o=0;o<n.length;o++){const i=n[o];!i.startsWith("_memo_")&&i!=="_cellsCache"&&(r[i]=t[i])}return e}function nl(){return Object.create(null)}function Hh(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function LI(e,t){return n=>{(t.options.atoms?.[e]??t.baseAtoms[e]).set(r=>Bh(n,r))}}function qT(e){if(typeof e!="object"||e===null)return!1;if(Array.isArray(e))return!0;const t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function YT(e){return Reflect.ownKeys(e).filter(t=>Object.prototype.propertyIsEnumerable.call(e,t))}const UK=3;function qK(e,t){return FI(e,t,UK)}function FI(e,t,n){if(Object.is(e,t))return!0;if(n<=0||!qT(e)||!qT(t)||(Array.isArray(e)||Array.isArray(t))&&(!Array.isArray(e)||!Array.isArray(t)||e.length!==t.length))return!1;const r=YT(e),o=YT(t);if(r.length!==o.length)return!1;const i=e,s=t;for(let c=0;c<r.length;c++){const d=r[c];if(!Object.prototype.propertyIsEnumerable.call(t,d)||!FI(i[d],s[d],n-1))return!1}return!0}function ux(e,t,n,r=qK){const o=`on${t.charAt(0).toUpperCase()}${t.slice(1)}Change`,i=e.options[o];i&&i(s=>{const c=Bh(n,s);return r(s,c)?s:c})}function YK(e){return e instanceof Function}function ZK(e,t){const n=[],r=o=>{o.forEach(i=>{n.push(i);const s=t(i);s.length&&r(s)})};return r(e),n}const GK=({fn:e,memoDeps:t,onAfterCompare:n,onAfterUpdate:r,onBeforeCompare:o,onBeforeUpdate:i})=>{let s=[],c;return u=>{o?.();const p=t?.(u);let m=!p||p.length!==s?.length;if(!m&&p){for(let g=0;g<p.length;g++)if(p[g]!==s[g]){m=!0;break}}return n?.(m),m&&(s=p,i?.(),c=e(...p??[]),r?.(c)),c}};function $I(e){let t=!1;return()=>{if(!t){t=!0;return}e()}}function Uh({feature:e,fnName:t,objectId:n,onAfterUpdate:r,table:o,...i}){const s=()=>{if(!r)return;const{schedule:d,untrack:u}=o._reactivity;d(()=>u(()=>r()))};return GK({...i,...{onAfterUpdate:()=>{s()}}})}function VI(e,t="_"){const[n,r]=e.split(t);return{fnKey:r,fnName:`${n}.${r}`,parentName:n}}function pc(e,t,n){for(const[r,{fn:o,memoDeps:i}]of Object.entries(n)){const{fnKey:s,fnName:c}=VI(r);t[s]=i?Uh({memoDeps:i,fn:o,fnName:c,table:t,feature:e}):o}}function qh(e,t,n,r){for(const[o,{fn:i,memoDeps:s}]of Object.entries(r)){const{fnKey:c,fnName:d}=VI(o);if(s){const u=`_memo_${c}`;t[c]=function(...p){if(!this[u]){const m=this;this[u]=Uh({memoDeps:g=>s(m,g),fn:(...g)=>i(m,...g),fnName:d,objectId:m.id,table:n,feature:e})}return this[u](...p)}}else t[c]=function(...u){return i(this,...u)}}}function ls(e,t,n,...r){return e[t]?.(...r)??n(e,...r)}function KK(e){return e.row.getValue(e.column.id)}function XK(e){return e.getValue()??e.table.options.renderFallbackValue}function QK(e){return{table:e.table,column:e.column,row:e.row,cell:e,getValue:()=>e.getValue(),renderValue:()=>e.renderValue()}}const WK={assignCellPrototype:(e,t)=>{qh("coreCellsFeature",e,t,{cell_getValue:{fn:n=>KK(n)},cell_renderValue:{fn:n=>XK(n)},cell_getContext:{fn:n=>QK(n),memoDeps:n=>[n]}})}};function JK(e){if(!e._headerPrototype){e._headerPrototype={table:e};const t=Object.values(e._features);for(let n=0;n<t.length;n++)t[n].assignHeaderPrototype?.(e._headerPrototype,e)}return e._headerPrototype}function BI(e,t,n){const r=JK(e),o=Object.create(r);o.colSpan=0,o.column=t,o.depth=n.depth,o.headerGroup=null,o.id=n.id??t.id,o.index=n.index,o.isPlaceholder=!!n.isPlaceholder,o.placeholderId=n.placeholderId,o.rowSpan=0,o.subHeaders=[];const i=e._headerInstanceInitFns;for(let s=0;s<i.length;s++)i[s](o);return o}function eX(){return{start:[],end:[]}}function Jl(e){const t=e.table.atoms.columnVisibility?.get();if(!t)return!0;const n=e.columns;return n.length?n.some(r=>ls(r,"getIsVisible",Jl)):(Hh(t,e.id)?t[e.id]:void 0)??!0}function tX(e){return e.getAllLeafColumns().filter(t=>ls(t,"getIsVisible",Jl))}function HI(e,t=1){let n=t;for(let r=0;r<e.length;r++){const o=e[r];ls(o,"getIsVisible",Jl)&&o.columns.length&&(n=Math.max(n,HI(o.columns,t+1)))}return n}function nX(e,t){return String(t)}function rX(e,t,n,r){let o=e??"";return t&&(o=o?`${o}_${t}`:String(t)),n&&(o=o?`${o}_${n}`:n),r&&(o=o?`${o}_${r}`:r),o}function oX(e,t){let n=0;for(let r=0;r<e.length;r++)e[r].column===t&&n++;return n}function UI(e,t,n,r,o,i){const s={depth:t,id:nX(r,t),headers:[]},c=[];for(let d=0;d<e.length;d++){if(!(d in e))continue;const u=e[d],p=c[c.length-1],m=u.column.depth===s.depth;let g,y=!1;if(m&&u.column.parent?g=u.column.parent:(g=u.column,y=!0),p&&p.column===g)p.subHeaders.push(u);else{const v=BI(n,g,{id:rX(r,t,g.id,u.id),isPlaceholder:y,placeholderId:y?String(oX(c,g)):void 0,depth:t,index:c.length});v.subHeaders.push(u),c.push(v)}s.headers.push(u),u.headerGroup=s}for(let d=0;d<i.length;d++)i[d](s);o.push(s),t>0&&UI(c,t-1,n,r,o,i)}function qI(e){for(let t=0;t<e.length;t++){const n=e[t];if(!ls(n.column,"getIsVisible",Jl))continue;let r=0;if(n.subHeaders.length){qI(n.subHeaders);for(let o=0;o<n.subHeaders.length;o++){const i=n.subHeaders[o];ls(i.column,"getIsVisible",Jl)&&(r+=i.colSpan)}}else r=1;if(n.colSpan=r,n.isPlaceholder&&n.subHeaders.length===1&&n.subHeaders[0].column===n.column){let o=1,i=n.subHeaders[0];for(;i;)i.rowSpan=0,o++,i=i.subHeaders.length===1&&i.subHeaders[0].column===n.column?i.subHeaders[0]:void 0;n.rowSpan=o}else n.rowSpan=1}}function ZT(e,t,n,r){const o=HI(e),i=[],s=n._headerGroupInstanceInitFns,c=new Array(t.length);for(let d=0;d<t.length;d++)d in t&&(c[d]=BI(n,t[d],{depth:o,index:d}));return UI(c,o-1,n,r,i,s),i.reverse(),qI(i[0]?.headers??[]),i}function iX(e){if(!e._columnPrototype){e._columnPrototype={table:e};const t=Object.values(e._features);for(let n=0;n<t.length;n++)t[n].assignColumnPrototype?.(e._columnPrototype,e)}return e._columnPrototype}function sX(e,t,n,r){const o={...e.getDefaultColumnDef(),...t},i=o.accessorKey,s=i===void 0?void 0:String(i),c=o.id??s?.replaceAll(".","_")??(typeof o.header=="string"?o.header:void 0);let d;if(o.accessorFn)d=o.accessorFn;else if(i!==void 0)if(typeof i=="string"&&i.includes(".")){const g=i.split(".");d=y=>{let v=y;for(let S=0;S<g.length;S++){const w=g[S];v=v?.[w]}return v}}else d=g=>g[o.accessorKey];if(!c)throw new Error;const u=iX(e),p=Object.create(u);p.accessorFn=d,p.columnDef=o,p.columns=[],p.depth=n,p.id=`${String(c)}`,p.parent=r;const m=e._columnInstanceInitFns;for(let g=0;g<m.length;g++)m[g](p);return p}function YI(e){const t=e.atoms.columnOrder?.get();return n=>{let r=[];if(!t?.length)r=n;else{const o=new Map;for(let i=0;i<n.length;i++){const s=n[i];o.set(s.id,s)}for(let i=0;i<t.length;i++){const s=t[i],c=o.get(s);c&&(r.push(c),o.delete(s))}for(let i=0;i<n.length;i++){const s=n[i];o.has(s.id)&&r.push(s)}}return aX(e,r)}}function aX(e,t){const n=e.atoms.grouping?.get()??[],{groupedColumnMode:r}=e.options;if(!n.length||!r)return t;const o=t.filter(c=>!n.includes(c.id));if(r==="remove")return o;const i=new Map;for(let c=0;c<t.length;c++){const d=t[c];i.set(d.id,d)}const s=[];for(let c=0;c<n.length;c++){const d=i.get(n[c]);d&&s.push(d)}return[...s,...o]}function lX(e){return[e,...e.columns.flatMap(t=>t.getFlatColumns())]}function cX(e){if(e.columns.length){const t=e.columns.flatMap(n=>n.getLeafColumns());return ls(e.table,"getOrderColumns",YI)(t)}return[e]}function uX(e){return{header:t=>{const n=t.header.column.columnDef;return n.accessorKey?n.accessorKey:n.accessorFn?n.id:null},cell:t=>t.renderValue()?.toString?.()??null,...Object.values(e._features).reduce((t,n)=>Object.assign(t,n.getDefaultColumnDef?.()),{}),...e.options.defaultColumn}}function ZI(e,t,n,r=0){const o=new Array(t.length);for(let i=0;i<t.length;i++){if(!(i in t))continue;const s=t[i],c=sX(e,s,r,n),d=s;c.columns=d.columns?ZI(e,d.columns,c,r+1):[],o[i]=c}return o}function dX(e){return ZI(e,e.options.columns)}function fX(e){return e.getAllColumns().flatMap(t=>t.getFlatColumns())}function hX(e){const t=nl(),n=e.getAllFlatColumns();for(let r=0;r<n.length;r++){const o=n[r];t[o.id]=o}return t}function pX(e){const t=e.getAllColumns().flatMap(n=>n.getLeafColumns());return ls(e,"getOrderColumns",YI)(t)}function mX(e){const t=nl(),n=e.getAllLeafColumns();for(let r=0;r<n.length;r++){const o=n[r];t[o.id]=o}return t}function gX(e,t){return e.getAllFlatColumnsById()[t]}const yX={assignColumnPrototype:(e,t)=>{qh("coreColumnsFeature",e,t,{column_getFlatColumns:{fn:n=>lX(n),memoDeps:n=>[n.table.options.columns]},column_getLeafColumns:{fn:n=>cX(n),memoDeps:n=>[n.table.atoms.columnOrder?.get(),n.table.atoms.grouping?.get(),n.table.options.columns,n.table.options.groupedColumnMode]}})},constructTableAPIs:e=>{pc("coreColumnsFeature",e,{table_getDefaultColumnDef:{fn:()=>uX(e),memoDeps:()=>[e.options.defaultColumn]},table_getAllColumns:{fn:()=>dX(e),memoDeps:()=>[e.options.columns]},table_getAllFlatColumns:{fn:()=>fX(e),memoDeps:()=>[e.options.columns]},table_getAllFlatColumnsById:{fn:()=>hX(e),memoDeps:()=>[e.options.columns]},table_getAllLeafColumns:{fn:()=>pX(e),memoDeps:()=>[e.atoms.columnOrder?.get(),e.atoms.grouping?.get(),e.options.columns,e.options.groupedColumnMode]},table_getAllLeafColumnsById:{fn:()=>mX(e),memoDeps:()=>[e.getAllLeafColumns()]},table_getColumn:{fn:t=>gX(e,t)}})}};function GI(e,t){for(let n=0;n<e.subHeaders.length;n++)GI(e.subHeaders[n],t);t.push(e)}function xX(e){const t=[];return GI(e,t),t}function vX(e){return{column:e.column,header:e,table:e.column.table}}function bX(e){const{start:t,end:n}=e.atoms.columnPinning?.get()??eX(),r=e.getAllColumns(),o=ls(e,"getVisibleLeafColumns",tX);if(!t.length&&!n.length)return ZT(r,o,e);const i=e.getAllLeafColumnsById(),s=[];for(let u=0;u<t.length;u++){const p=i[t[u]];p&&ls(p,"getIsVisible",Jl)&&s.push(p)}const c=[];for(let u=0;u<n.length;u++){const p=i[n[u]];p&&ls(p,"getIsVisible",Jl)&&c.push(p)}const d=o.filter(u=>!t.includes(u.id)&&!n.includes(u.id));return ZT(r,[...s,...d,...c],e)}function wX(e){return[...e.getHeaderGroups()].reverse()}function SX(e){const t=e.getHeaderGroups(),n=[];for(let r=0;r<t.length;r++){const o=t[r].headers;for(let i=0;i<o.length;i++)n.push(o[i])}return n}function EX(e){const t=e.getHeaderGroups()[0]?.headers??[],n=[];for(let r=0;r<t.length;r++){const o=t[r].getLeafHeaders();for(let i=0;i<o.length;i++)n.push(o[i])}return n}const CX={assignHeaderPrototype:(e,t)=>{qh("coreHeadersFeature",e,t,{header_getLeafHeaders:{fn:n=>xX(n),memoDeps:n=>[n.column.table.options.columns]},header_getContext:{fn:n=>vX(n),memoDeps:n=>[n.column.table.options.columns]}})},constructTableAPIs:e=>{pc("coreHeadersFeature",e,{table_getHeaderGroups:{fn:()=>bX(e),memoDeps:()=>[e.options.columns,e.atoms.columnOrder?.get(),e.atoms.grouping?.get(),e.atoms.columnPinning?.get(),e.atoms.columnVisibility?.get(),e.options.groupedColumnMode]},table_getFooterGroups:{fn:()=>wX(e),memoDeps:()=>[e.getHeaderGroups()]},table_getFlatHeaders:{fn:()=>SX(e),memoDeps:()=>[e.getHeaderGroups()]},table_getLeafHeaders:{fn:()=>EX(e),memoDeps:()=>[e.getHeaderGroups()]}})}};function kX(e){if(!e._rowPrototype){e._rowPrototype={table:e};const t=Object.values(e._features);for(let n=0;n<t.length;n++)t[n].assignRowPrototype?.(e._rowPrototype,e)}return e._rowPrototype}const jX=(e,t,n,r,o,i,s)=>{const c=kX(e),d=Object.create(c);d._displayIndexCache=-1,d._uniqueValuesCache=nl(),d._valuesCache=nl(),d.depth=o,d.id=t,d.index=r,d.original=n,d.parentId=s,d.subRows=[];const u=e._rowInstanceInitFns;for(let p=0;p<u.length;p++)u[p](d);return d},RX=/([0-9]+)/gm;function rd(e){const t=Object.assign((n,r,o)=>{let i=n.getValue(o),s=r.getValue(o);const c=t.resolveDataValue;return c&&(i=c(i),s=c(s)),t.sort(i,s,n,r,o)},e);return t}rd({resolveDataValue:e=>dx(e).toLowerCase(),sort:(e,t)=>XI(e,t)});rd({resolveDataValue:e=>dx(e),sort:(e,t)=>XI(e,t)});rd({resolveDataValue:e=>dx(e).toLowerCase(),sort:(e,t)=>y1(e,t)});rd({resolveDataValue:e=>dx(e),sort:(e,t)=>y1(e,t)});rd({resolveDataValue:e=>_X(e),sort:(e,t)=>e>t?1:e<t?-1:0});const KI=rd({sort:(e,t)=>y1(e,t)});function y1(e,t){return e===t?0:e>t?1:-1}function _X(e){return e instanceof Date?e.getTime():e}function dx(e){return typeof e=="number"?isNaN(e)||e===1/0||e===-1/0?"":String(e):typeof e=="string"?e:""}function XI(e,t){let n=0,r=0;const o=e.length,i=t.length;for(;n<o&&r<i;){const s=Qg(e.charCodeAt(n)),c=Qg(t.charCodeAt(r)),d=rS(e,n,s),u=rS(t,r,c);if(!s&&!c){const m=NX(e,n,d,t,r,u);if(m)return m;n=d,r=u;continue}if(s!==c)return s?1:-1;const p=TX(e,n,d,t,r,u);if(p)return p;n=d,r=u}return KT(e,n)-KT(t,r)}function Qg(e){return e>=48&&e<=57}function rS(e,t,n){let r=t+1;for(;r<e.length&&Qg(e.charCodeAt(r))===n;)r++;return r}function NX(e,t,n,r,o,i){const s=n-t,c=i-o,d=s<c?s:c;for(let u=0;u<d;u++){const p=e.charCodeAt(t+u),m=r.charCodeAt(o+u);if(p>m)return 1;if(m>p)return-1}return s>c?1:c>s?-1:0}function TX(e,t,n,r,o,i){let s=t;for(;s<n&&e.charCodeAt(s)===48;)s++;let c=o;for(;c<i&&r.charCodeAt(c)===48;)c++;const d=n-s,u=i-c;if(d===0&&u===0)return 0;if(d<=15&&u<=15){const g=GT(e,s,n),y=GT(r,c,i);return g>y?1:y>g?-1:0}const p=parseInt(e.slice(t,n),10),m=parseInt(r.slice(o,i),10);return p>m?1:m>p?-1:0}function GT(e,t,n){let r=0;for(let o=t;o<n;o++)r=r*10+e.charCodeAt(o)-48;return r}function KT(e,t){let n=0,r=t;for(;r<e.length;)n++,r=rS(e,r,Qg(e.charCodeAt(r)));return n}function MX(){return[]}function AX(e,t){ux(e,"cellSelection",tl(e.initialState.cellSelection)??MX())}function OX(e){e.atoms.cellSelection&&(e.options.autoResetAll??e.options.autoResetCellSelection??!0)&&e._reactivity.schedule(()=>AX(e))}function DX(e){e.atoms.expanded&&(e.options.autoResetAll??e.options.autoResetExpanded??!e.options.manualExpanding)&&e._reactivity.schedule(()=>PX(e))}function PX(e,t){const n=e.initialState.expanded;ux(e,"expanded",n===!0?!0:Object.assign(nl(),tl(n??{})))}function IX(e){const t=e.table.atoms.expanded?.get()??{};return!!(e.table.options.getIsRowExpanded?.(e)??(t===!0||zX(t,e.id)))}function zX(e,t){return!!(e&&e!==!0&&Hh(e,t)&&e[t])}const ec=0,Wg=10;function Jg(){return{pageIndex:ec,pageSize:Wg}}function x1(e){if(e.options.autoResetAll??e.options.autoResetPageIndex??!e.options.manualPagination){if((e.atoms.pagination?.get()?.pageIndex??ec)===ec)return;QI(e,!0)}}function fx(e,t){ux(e,"pagination",t)}function LX(e,t){fx(e,t?Jg():tl(e.initialState.pagination??Jg()))}function od(e,t){fx(e,n=>{let r=Bh(t,n.pageIndex);const o=typeof e.options.pageCount>"u"||e.options.pageCount===-1?Number.MAX_SAFE_INTEGER:e.options.pageCount-1;return r=Math.max(0,Math.min(r,o)),{...n,pageIndex:r}})}function QI(e,t){od(e,t?ec:e.initialState.pagination?.pageIndex??ec)}function FX(e,t){WI(e,t?Wg:e.initialState.pagination?.pageSize??Wg)}function WI(e,t){fx(e,n=>{const r=Math.max(1,Bh(t,n.pageSize)),o=n.pageSize===1/0?0:n.pageSize*n.pageIndex,i=r===1/0?0:Math.floor(o/r);return{...n,pageIndex:i,pageSize:r}})}function $X(e){const t=Yh(e);let n=[];return t&&t>0&&(n=[...new Array(t)].fill(null).map((r,o)=>o)),n}function VX(e){return(e.atoms.pagination?.get()?.pageIndex??0)>0}function BX(e){const t=e.atoms.pagination?.get()?.pageIndex??ec,n=Yh(e);return n===-1?!0:n===0?!1:t<n-1}function HX(e){const t=e.atoms.pagination?.get()?.pageIndex??ec,n=Yh(e);return Number.isFinite(n)&&n>0&&t<n-1}function UX(e){return od(e,t=>t-1)}function qX(e){return od(e,t=>t+1)}function YX(e){return od(e,0)}function ZX(e){const t=Yh(e);if(!(!Number.isFinite(t)||t<=0))return od(e,t-1)}function Yh(e){const t=e.options.pageCount;if(t!=null)return t;const n=JI(e),r=e.atoms.pagination?.get()?.pageSize??Wg;return r===1/0&&Number.isFinite(n)&&n>0?1:Math.ceil(n/r)}function JI(e){return e.options.rowCount??e.getPrePaginatedRowModel().rows.length}function GX(){return[]}function hx(e,t){ux(e,"sorting",t)}function ez(e,t){hx(e,t?[]:tl(e.initialState.sorting??[]))}function KX(e){e.atoms.sorting&&(e.options.autoResetAll??e.options.autoResetSorting??!1)&&ez(e)}function tz(e){const t=e.table._rowModelFns.sortFns,n=e.table.getFilteredRowModel().flatRows.slice(0,10);let r,o=!1;for(let i=0;i<n.length;i++){const s=n[i].getValue(e.id);if(Object.prototype.toString.call(s)==="[object Date]"){r="datetime";break}if(typeof s=="string"&&(o=!0,s.split(RX).length>1)){r="alphanumeric";break}}if(!r&&o&&(r="text"),r){let i=t?.[r];if(i||r==="alphanumeric"&&(i=t?.text),i)return i}return KI}function nz(e){const t=e.table.getFilteredRowModel().flatRows.slice(0,10);for(let n=0;n<t.length;n++){const r=t[n].getValue(e.id);if(r!=null)return typeof r=="string"?"asc":"desc"}return"desc"}function rz(e){const t=e.table._rowModelFns.sortFns;return YK(e.columnDef.sortFn)?e.columnDef.sortFn:e.columnDef.sortFn==="auto"?tz(e):t?.[e.columnDef.sortFn]??KI}function oz(e,t,n){const r=sz(e,n&&ey(e)),o=typeof t<"u";hx(e.table,i=>{const s=i.findIndex(g=>g.id===e.id),c=s===-1?void 0:i[s];let d=[],u;const p=o?t:r==="desc",m=!!(i.length&&ey(e)&&n);return m?c?u="toggle":u="add":c?u="toggle":u="replace",u==="toggle"&&(o||r||(u="remove")),u==="add"?(d=[...i,{id:e.id,desc:p}],d.splice(0,d.length-(e.table.options.maxMultiSortColCount??Number.MAX_SAFE_INTEGER))):u==="toggle"?d=m?i.map(g=>g.id===e.id?{...g,desc:p}:g):[{id:e.id,desc:p}]:u==="remove"?d=m?i.filter(g=>g.id!==e.id):[]:d=[{id:e.id,desc:p}],d})}function iz(e){return e.columnDef.sortDescFirst??e.table.options.sortDescFirst??nz(e)==="desc"?"desc":"asc"}function sz(e,t){const n=iz(e),r=az(e);return r?r!==n&&(e.table.options.enableSortingRemoval??!0)&&(!t||(e.table.options.enableMultiRemove??!0))?!1:r==="desc"?"asc":"desc":n}function v1(e){return(e.columnDef.enableSorting??!0)&&(e.table.options.enableSorting??!0)&&!!e.accessorFn}function ey(e){return e.columnDef.enableMultiSort??e.table.options.enableMultiSort??!!e.accessorFn}function az(e){const t=e.table.atoms.sorting?.get()?.find(n=>n.id===e.id);return t?t.desc?"desc":"asc":!1}function XX(e){return e.table.atoms.sorting?.get()?.findIndex(t=>t.id===e.id)??-1}function QX(e){hx(e.table,t=>t.length?t.filter(n=>n.id!==e.id):[])}function WX(e){const t=v1(e);return n=>{t&&oz(e,void 0,ey(e)?e.table.options.isMultiSortEvent?.(n):!1)}}function JX(){return e=>Uh({feature:"coreRowModelsFeature",table:e,fnName:"table.getCoreRowModel",memoDeps:()=>[e.options.data],fn:()=>eQ(e,e.options.data),onAfterUpdate:$I(()=>{DX(e),x1(e),KX(e),OX(e)})})}function lz(e,t,n,r=0,o){const i=[];for(let s=0;s<n.length;s++){const c=n[s],d=jX(e,e.getRowId(c,s,o),c,s,r,void 0,o?.id);t.flatRows.push(d),t.rowsById[d.id]=d,i.push(d),e.options.getSubRows&&(d.originalSubRows=e.options.getSubRows(c,s),d.originalSubRows?.length&&(d.subRows=lz(e,t,d.originalSubRows,r+1,d)))}return i}function eQ(e,t){const n={rows:[],flatRows:[],rowsById:nl()};return n.rows=lz(e,n,t),n}function tQ(e){return e._rowModels.coreRowModel||(e._rowModels.coreRowModel=e.options.features.coreRowModel?.(e)??JX()(e)),e._rowModels.coreRowModel()}function nQ(e){return e.getCoreRowModel()}function rQ(e){return e._rowModels.filteredRowModel||(e._rowModels.filteredRowModel=e.options.features.filteredRowModel?.(e)),e.options.manualFiltering||!e._rowModels.filteredRowModel?e.getPreFilteredRowModel():e._rowModels.filteredRowModel()}function oQ(e){return e.getFilteredRowModel()}function iQ(e){return e._rowModels.groupedRowModel||(e._rowModels.groupedRowModel=e.options.features.groupedRowModel?.(e)),e.options.manualGrouping||!e._rowModels.groupedRowModel?e.getPreGroupedRowModel():e._rowModels.groupedRowModel()}function sQ(e){return e.getGroupedRowModel()}function aQ(e){return e._rowModels.sortedRowModel||(e._rowModels.sortedRowModel=e.options.features.sortedRowModel?.(e)),e.options.manualSorting||!e._rowModels.sortedRowModel?e.getPreSortedRowModel():e._rowModels.sortedRowModel()}function lQ(e){return e.getSortedRowModel()}function cQ(e){return e._rowModels.expandedRowModel||(e._rowModels.expandedRowModel=e.options.features.expandedRowModel?.(e)),e.options.manualExpanding||!e._rowModels.expandedRowModel?e.getPreExpandedRowModel():e._rowModels.expandedRowModel()}function uQ(e){return e.getExpandedRowModel()}function dQ(e){return e._rowModels.paginatedRowModel||(e._rowModels.paginatedRowModel=e.options.features.paginatedRowModel?.(e)),e.options.manualPagination||!e._rowModels.paginatedRowModel?e.getPrePaginatedRowModel():e._rowModels.paginatedRowModel()}function fQ(e){return e.getPaginatedRowModel()}const hQ={constructTableAPIs:e=>{pc("coreRowModelsFeature",e,{table_getCoreRowModel:{fn:()=>tQ(e)},table_getPreFilteredRowModel:{fn:()=>nQ(e)},table_getFilteredRowModel:{fn:()=>rQ(e)},table_getPreGroupedRowModel:{fn:()=>oQ(e)},table_getGroupedRowModel:{fn:()=>iQ(e)},table_getPreSortedRowModel:{fn:()=>sQ(e)},table_getSortedRowModel:{fn:()=>aQ(e)},table_getPreExpandedRowModel:{fn:()=>lQ(e)},table_getExpandedRowModel:{fn:()=>cQ(e)},table_getPrePaginatedRowModel:{fn:()=>uQ(e)},table_getPaginatedRowModel:{fn:()=>dQ(e)},table_getRowModel:{fn:()=>fQ(e)}})}};function pQ(e){if(!e._cellPrototype){e._cellPrototype={table:e};const t=Object.values(e._features);for(let n=0;n<t.length;n++)t[n].assignCellPrototype?.(e._cellPrototype,e)}return e._cellPrototype}function mQ(e,t,n){const r=pQ(n),o=Object.create(r);o.column=e,o.id=`${t.id}_${e.id}`,o.row=t;const i=n._cellInstanceInitFns;for(let s=0;s<i.length;s++)i[s](o);return o}function gQ(e){const t=e.table.getRowsInDisplayOrder(),n=e._displayIndexCache;return t[n]===e?n:-1}function yQ(e){const t=e.getPrePaginatedRowModel().rows;if(e.options.paginateExpandedRows===!1){const n=[],r=o=>{o._displayIndexCache=n.length,n.push(o),o.subRows.length&&o.getIsExpanded?.()&&o.subRows.forEach(r)};return t.forEach(r),n}for(let n=0;n<t.length;n++)t[n]._displayIndexCache=n;return t}function xQ(e,t){if(Hh(e._valuesCache,t))return e._valuesCache[t];const n=e.table.getColumn(t);if(n?.accessorFn)return e._valuesCache[t]=n.accessorFn(e.original,e.index),e._valuesCache[t]}function vQ(e,t){if(Hh(e._uniqueValuesCache,t))return e._uniqueValuesCache[t];const n=e.table.getColumn(t);if(n?.accessorFn)return n.columnDef.getUniqueValues?(e._uniqueValuesCache[t]=n.columnDef.getUniqueValues(e.original,e.index),e._uniqueValuesCache[t]):(e._uniqueValuesCache[t]=[e.getValue(t)],e._uniqueValuesCache[t])}function bQ(e,t){return e.getValue(t)??e.table.options.renderFallbackValue}function wQ(e){return ZK(e.subRows,t=>t.subRows)}function SQ(e){const t=e.getCoreRowModel().flatRows;let n=0;for(let r=0;r<t.length;r++)n=Math.max(n,t[r].depth);return n}function EQ(e){if(e.parentId)return e.table.getCoreRowModel().rowsById[e.parentId]??e.table.getRow(e.parentId,!0)}function CQ(e){const t=[];let n=e;for(;;){const r=n.getParentRow();if(!r)break;t.push(r),n=r}return t.reverse()}function kQ(e){const t=e.table.getAllLeafColumns();let n=e._cellsCache;n||(n=e._cellsCache=new WeakMap);const r=new Array(t.length);for(let o=0;o<t.length;o++){const i=t[o];let s=n.get(i);s||(s=mQ(i,e,e.table),n.set(i,s)),r[o]=s}return r}function jQ(e){const t=nl(),n=e.getAllCells();for(let r=0;r<n.length;r++){const o=n[r];t[o.column.id]=o}return t}function RQ(e,t,n,r){return t.options.getRowId?.(e,n,r)??(r?`${r.id}.${n}`:String(n))}function _Q(e,t,n){let r=(n?e.getPrePaginatedRowModel():e.getRowModel()).rowsById[t];if(!r&&(r=e.getCoreRowModel().rowsById[t],!r))throw new Error;return r}const NQ={assignRowPrototype:(e,t)=>{qh("coreRowsFeature",e,t,{row_getDisplayIndex:{fn:n=>gQ(n)},row_getAllCellsByColumnId:{fn:n=>jQ(n),memoDeps:n=>[n.getAllCells()]},row_getAllCells:{fn:n=>kQ(n),memoDeps:n=>[n.table.getAllLeafColumns()]},row_getLeafRows:{fn:n=>wQ(n),memoDeps:n=>[n.subRows]},row_getParentRow:{fn:n=>EQ(n)},row_getParentRows:{fn:n=>CQ(n)},row_getUniqueValues:{fn:(n,r)=>vQ(n,r)},row_getValue:{fn:(n,r)=>xQ(n,r)},row_renderValue:{fn:(n,r)=>bQ(n,r)}})},constructTableAPIs:e=>{pc("coreRowsFeature",e,{table_getRowsInDisplayOrder:{fn:()=>yQ(e),memoDeps:()=>[e.getPrePaginatedRowModel().rows,e.options.paginateExpandedRows,e.options.paginateExpandedRows===!1?e.atoms.expanded?.get():void 0]},table_getRowId:{fn:(t,n,r)=>RQ(t,e,n,r)},table_getRow:{fn:(t,n)=>_Q(e,t,n)},table_getMaxSubRowDepth:{fn:()=>SQ(e),memoDeps:()=>[e.getCoreRowModel()]}})}};function cz(e,t,n=(r,o)=>r===o){const r=t===void 0?e.options.state:t;e._reactivity.batch(()=>{if(r)for(const o in r){const i=e.baseAtoms[o];if(!i)continue;const s=r[o],c=s===void 0?e.initialState[o]:s;n(e._reactivity.untrack(()=>i.get()),c)||i.set(()=>c)}})}function uz(e,t,n=(r,o)=>r===o){e._reactivity.batch(()=>{cz(e,t,n),e._reactivity.commit?.()})}function TQ(e){const t=tl(e.initialState);e._reactivity.batch(()=>{const r=Object.keys(t);for(let o=0;o<r.length;o++){const i=r[o];e.baseAtoms[i].set(t[i])}});const n=Object.values(e._features);for(let r=0;r<n.length;r++)n[r].resetTableInstanceData?.(e)}function MQ(e,t){const{features:n,atoms:r,initialState:o}=e.options;if(!e.options.mergeOptions)return{...e.options,...t,features:n,atoms:r,initialState:o};const i=e.options.mergeOptions(e.options,t),s={...Object.getOwnPropertyDescriptors(i)};return Object.defineProperties(Object.create(Object.getPrototypeOf(i)),{...s,features:{value:n,enumerable:!0,configurable:!0,writable:!0},atoms:{value:r,enumerable:!0,configurable:!0,writable:!0},initialState:{value:o,enumerable:!0,configurable:!0,writable:!0}})}function dz(e,t,n){const r=MQ(e,Bh(t,e.options));e.optionsStore?e.optionsStore.set(()=>r):e.options=r,n?.syncExternalState!==!1&&uz(e,r.state??null)}const AQ={constructTableAPIs:e=>{pc("coreTablesFeature",e,{table_reset:{fn:()=>TQ(e)},table_setOptions:{fn:t=>dz(e,t)}})}},OQ={coreCellsFeature:WK,coreColumnsFeature:yX,coreHeadersFeature:CX,coreRowModelsFeature:hQ,coreRowsFeature:NQ,coreTablesFeature:AQ};function mc(){return{accessor:(e,t)=>typeof e=="function"?{...t,accessorFn:e}:{...t,accessorKey:e},columns:e=>e,display:e=>e,group:e=>e}}function DQ(e,t={}){return Object.values(e).forEach(n=>{t=n.getInitialState?.(t)??t}),tl(t)}function PQ(e){const t=e.features.coreReactivityFeature,{aggregationFns:n,columnMeta:r,coreRowModel:o,expandedRowModel:i,facetedMinMaxValues:s,facetedRowModel:c,facetedUniqueValues:d,filterFns:u,filterMeta:p,filteredRowModel:m,groupedRowModel:g,paginatedRowModel:y,sortFns:v,sortedRowModel:S,tableMeta:w,...E}=e.features,k={_cellInstanceInitFns:[],_columnInstanceInitFns:[],_features:{...OQ,...E},_headerGroupInstanceInitFns:[],_headerInstanceInitFns:[],_reactivity:t,_rowInstanceInitFns:[],_rowModelFns:{aggregationFns:n,filterFns:u,sortFns:v},_rowModels:{},atoms:{},baseAtoms:{}},j=Object.values(k._features),N={...j.reduce((R,M)=>Object.assign(R,M.getDefaultTableOptions?.(k)),{}),...e};if(t.wrapExternalAtoms&&N.atoms)for(const[R,M]of Object.entries(N.atoms)){const T=M,O=t.createWritableAtom(T.get(),{debugName:`externalAtom/${R}`});N.atoms[R]=O;let z=!1;const q=T.subscribe(G=>{z||O.set(G)}),$=O.subscribe(G=>{z=!0,T.set(G),z=!1});t.addSubscription(q),t.addSubscription($)}t.createOptionsStore?(k.optionsStore=t.createWritableAtom(N,{debugName:"table/optionsStore"}),Object.defineProperty(k,"options",{configurable:!0,enumerable:!0,get(){return k.optionsStore.get()},set(R){k.optionsStore.set(()=>R)}})):k.options=N,k.initialState=DQ(k._features,k.options.initialState);const A=Object.keys(k.initialState);for(let R=0;R<A.length;R++){const M=A[R];k.baseAtoms[M]=t.createWritableAtom(k.initialState[M],{debugName:`table/baseAtoms/${M}`}),k.atoms[M]=t.createReadonlyAtom(()=>{const T=k.options,O=T.atoms?.[M],z=O?O.get():k.baseAtoms[M].get();if(O)return z;const q=T.state;if(q&&Hh(q,M)){const $=q[M];return $===void 0?k.initialState[M]:$}return z},{debugName:`table/atoms/${M}`})}cz(k),k.store=FK(t.createReadonlyAtom(()=>{const R={};for(let M=0;M<A.length;M++){const T=A[M];R[T]=k.atoms[T].get()}return R},{compare:$f,debugName:"table/store"}));for(let R=0;R<j.length;R++){const M=j[R];M.initTableInstanceData?.(k),M.initCellInstanceData&&k._cellInstanceInitFns.push(M.initCellInstanceData.bind(M)),M.initColumnInstanceData&&k._columnInstanceInitFns.push(M.initColumnInstanceData.bind(M)),M.initHeaderGroupInstanceData&&k._headerGroupInstanceInitFns.push(M.initHeaderGroupInstanceData.bind(M)),M.initHeaderInstanceData&&k._headerInstanceInitFns.push(M.initHeaderInstanceData.bind(M)),M.initRowInstanceData&&k._rowInstanceInitFns.push(M.initRowInstanceData.bind(M)),M.constructTableAPIs?.(k)}return k}const IQ={getInitialState:e=>({...e,pagination:{...Jg(),...e.pagination}}),getDefaultTableOptions:e=>({onPaginationChange:LI("pagination",e)}),constructTableAPIs:e=>{pc("rowPaginationFeature",e,{table_autoResetPageIndex:{fn:()=>x1(e)},table_setPagination:{fn:t=>fx(e,t)},table_resetPagination:{fn:t=>LX(e,t)},table_setPageIndex:{fn:t=>od(e,t)},table_resetPageIndex:{fn:t=>QI(e,t)},table_setPageSize:{fn:t=>WI(e,t)},table_getPageCount:{fn:()=>Yh(e)},table_resetPageSize:{fn:t=>FX(e,t)},table_getPageOptions:{fn:()=>$X(e)},table_getCanPreviousPage:{fn:()=>VX(e)},table_getCanNextPage:{fn:()=>BX(e)},table_getCanLastPage:{fn:()=>HX(e)},table_previousPage:{fn:()=>UX(e)},table_nextPage:{fn:()=>qX(e)},table_firstPage:{fn:()=>YX(e)},table_lastPage:{fn:()=>ZX(e)},table_getRowCount:{fn:()=>JI(e)}})}},zQ={getInitialState(e){return{sorting:GX(),...e}},getDefaultColumnDef(){return{sortFn:"auto",sortUndefined:1}},getDefaultTableOptions(e){return{autoResetSorting:!1,onSortingChange:LI("sorting",e),isMultiSortEvent:t=>t.shiftKey}},assignColumnPrototype(e,t){qh("rowSortingFeature",e,t,{column_getAutoSortFn:{fn:n=>tz(n)},column_getAutoSortDir:{fn:n=>nz(n)},column_getSortFn:{fn:n=>rz(n)},column_toggleSorting:{fn:(n,r,o)=>oz(n,r,o)},column_getFirstSortDir:{fn:n=>iz(n)},column_getNextSortingOrder:{fn:(n,r)=>sz(n,r)},column_getCanSort:{fn:n=>v1(n)},column_getCanMultiSort:{fn:n=>ey(n)},column_getIsSorted:{fn:n=>az(n)},column_getSortIndex:{fn:n=>XX(n)},column_clearSorting:{fn:n=>QX(n)},column_getToggleSortingHandler:{fn:n=>WX(n)}})},constructTableAPIs(e){pc("rowSortingFeature",e,{table_setSorting:{fn:t=>hx(e,t)},table_resetSorting:{fn:t=>ez(e,t)}})}};function LQ(e){const t=[],n=r=>{t.push(r),r.subRows.length&&IX(r)&&r.subRows.forEach(n)};return e.rows.forEach(n),{rows:t,flatRows:e.flatRows,rowsById:e.rowsById}}function FQ(){return e=>{const t=e;return Uh({feature:"rowPaginationFeature",table:t,fnName:"table.getPaginatedRowModel",memoDeps:()=>[t.getPrePaginatedRowModel(),t.atoms.pagination?.get(),t.options.paginateExpandedRows?void 0:t.atoms.expanded?.get()],fn:()=>$Q(t)})}}function $Q(e){const t=e.getPrePaginatedRowModel(),n=e.atoms.pagination?.get();if(!t.rows.length)return t;const{pageSize:r,pageIndex:o}=n??Jg(),{rows:i,flatRows:s,rowsById:c}=t;let d=i;if(r!==1/0||o!==0){const g=r*o,y=g+r;d=i.slice(g,y)}let u;e.options.paginateExpandedRows?u={rows:d,flatRows:s,rowsById:c}:u=LQ({rows:d,flatRows:s,rowsById:c}),u.flatRows=[];const p=new Set,m=g=>{p.has(g.id)||(p.add(g.id),u.flatRows.push(g),g.subRows.length&&g.subRows.forEach(m))};return u.rows.forEach(m),u}function VQ(){return e=>{const t=e;return Uh({feature:"rowSortingFeature",table:t,fnName:"table.getSortedRowModel",memoDeps:()=>[t.atoms.sorting?.get(),t.getPreSortedRowModel()],fn:()=>BQ(t),onAfterUpdate:$I(()=>x1(t))})}}function BQ(e){const t=e.getPreSortedRowModel(),n=e.atoms.sorting?.get();if(!t.rows.length||!n?.length)return t;const r=[],o=n.filter(d=>{const u=e.getColumn(d.id);return u?v1(u):!1});if(!o.length)return t;const i=[];for(let d=0;d<o.length;d++){const u=o[d],p=e.getColumn(u.id);p&&i.push({id:u.id,desc:u.desc,sortUndefined:p.columnDef.sortUndefined,invertSorting:p.columnDef.invertSorting,sortFn:rz(p)})}const s=(d,u)=>{for(let p=0;p<i.length;p++){const m=i[p],g=m.sortUndefined,y=m.desc;let v=0;if(g){const S=d.getValue(m.id),w=u.getValue(m.id),E=S===void 0,k=w===void 0;if(E&&k)continue;if(E||k){if(g==="first")return E?-1:1;if(g==="last")return E?1:-1;v=E?g:-g}}if(v===0&&(v=m.sortFn(d,u,m.id)),v!==0)return y&&(v*=-1),m.invertSorting&&(v*=-1),v}return d.index-u.index},c=d=>{const u=d.slice();u.sort(s);let p=!1;for(let m=0;m<u.length;m++){const g=u[m];g!==d[m]&&(p=!0);const y=r.length;if(r.push(g),g.subRows.length){const v=c(g.subRows);if(v.changed){const S=Object.create(Object.getPrototypeOf(g));HK(S,g),S.subRows=v.rows,u[m]=S,r[y]=S,p=!0}}}return{rows:u,changed:p}};return{rows:c(t.rows).rows,flatRows:r,rowsById:t.rowsById}}const HQ=typeof window>"u"?b.useEffect:b.useLayoutEffect;function UQ(e,t){const[{table:n,rootSource:r}]=b.useState(()=>{const d=PQ({...e,features:{coreReactivityFeature:BK(),...e.features}});return d.Subscribe=(u=>LK({...u,source:u.source??d.store})),d.FlexRender=NK,{table:d,rootSource:VK(d.store,$f)}}),o=n;dz(o,d=>({...d,...e}),{syncExternalState:!1});const i=o.options.state,s=r.get(),c=zI(r,t,{compare:$f});return HQ(()=>{r.markCommitted(s),uz(o,i??null,$f)}),b.useMemo(()=>({...n,options:e,state:c}),[n,e,c])}const fz=b.createContext(void 0);function gc(e){const t=b.useContext(fz);if(!e&&t===void 0)throw new Error(Sr(27));return t}const qQ=b.forwardRef(function(t,n){const{render:r,className:o,style:i,forceRender:s=!1,...c}=t,d=gc(),u=d.useState("open"),p=d.useState("nested"),m=d.useState("mounted"),g=d.useState("transitionStatus");return wn("div",t,{state:{open:u,transitionStatus:g},ref:[d.context.backdropRef,n],stateAttributesMapping:a1,props:[{role:"presentation",hidden:!m,style:{userSelect:"none",WebkitUserSelect:"none"}},c],enabled:s||!p})}),b1=b.forwardRef(function(t,n){const{render:r,className:o,style:i,disabled:s=!1,nativeButton:c=!0,...d}=t,u=gc(),p=u.useState("open"),{getButtonProps:m,buttonRef:g}=ll({disabled:s,native:c}),y={disabled:s};function v(S){p&&u.setOpen(!1,Bt(BD,S.nativeEvent))}return wn("button",t,{state:y,ref:[n,g],props:[{onClick:v},d,m]})}),YQ=b.forwardRef(function(t,n){const{render:r,className:o,style:i,id:s,...c}=t,d=gc(),u=na(s);return d.useSyncedValueWithCleanup("descriptionElementId",u),wn("p",t,{ref:n,props:[{id:u},c]})}),hz=b.createContext(void 0);function ZQ(){const e=b.useContext(hz);if(e===void 0)throw new Error(Sr(26));return e}const GQ={...tx,...td,nestedDialogOpen(e){return e?{"data-nested-dialog-open":""}:null}},KQ=b.forwardRef(function(t,n){const{render:r,className:o,style:i,finalFocus:s,initialFocus:c,...d}=t,u=gc(),p=u.useState("descriptionElementId"),m=u.useState("disablePointerDismissal"),g=u.useState("floatingRootContext"),y=u.useState("popupProps"),v=u.useState("modal"),S=u.useState("mounted"),w=u.useState("nested"),E=u.useState("nestedOpenDialogCount"),k=u.useState("open"),j=u.useState("openMethod"),N=u.useState("titleElementId"),A=u.useState("transitionStatus"),R=u.useState("role"),M=g.useState("floatingId");ZQ(),ta({open:k,ref:u.context.popupRef,onComplete(){k&&u.context.onOpenChangeComplete?.(!0)}});const T=c===void 0?_P(u.context.popupRef):c,O=E>0,z=u.useStateSetter("popupElement"),$=wn("div",t,{state:{open:k,nested:w,transitionStatus:A,nestedDialogOpen:O},props:[y,{id:M,"aria-labelledby":N,"aria-describedby":p,role:R,...Wy,hidden:!S,onKeyDown(G){Lh.has(G.key)&&G.stopPropagation()},style:{"--nested-dialogs":E}},d],ref:[n,u.context.popupRef,z],stateAttributesMapping:GQ});return f.jsx(Gy,{context:g,openInteractionType:j,disabled:!S,closeOnFocusOut:!m,initialFocus:T,returnFocus:s,modal:v!==!1,restoreFocus:"popup",children:$})}),XQ=b.forwardRef(function(t,n){const{keepMounted:r=!1,...o}=t,i=gc(),s=i.useState("mounted"),c=i.useState("modal"),d=i.useState("open");return s||r?f.jsx(hz.Provider,{value:r,children:f.jsxs(Zy,{ref:n,...o,children:[s&&c===!0&&f.jsx(ix,{ref:i.context.internalBackdropRef,inert:zh(!d)}),t.children]})}):null});function QQ({store:e,parentContext:t,isDrawer:n}){const r=e.useState("open"),o=e.useState("disablePointerDismissal"),i=e.useState("modal"),s=e.useState("popupElement"),c=e.useState("floatingRootContext"),[d,u]=b.useState(0),[p,m]=b.useState(0),g=d===0,y=Ky(c,{outsidePressEvent(){return e.context.internalBackdropRef.current||e.context.backdropRef.current?"intentional":{mouse:i==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}},outsidePress(v){if(!e.context.outsidePressEnabledRef.current||"button"in v&&v.button!==0)return!1;if("touches"in v){if(v.type==="touchend"){if(v.changedTouches.length!==1||v.touches.length!==0)return!1}else if(v.touches.length!==1)return!1}const S=ro(v);if(g&&!o){if(i){const w=e.context.internalBackdropRef.current,E=e.context.backdropRef.current;return w||E?w===S||E===S||yt(S,s)&&!S?.hasAttribute("data-base-ui-portal"):!0}return!0}return!1},escapeKey:g});return aI(r&&i===!0,s),e.useContextCallback("onNestedDialogOpen",(v,S)=>{u(v),m(S)}),rt(()=>(t?.onNestedDialogOpen&&(r?t.onNestedDialogOpen(d+1,p+(n?1:0)):t.onNestedDialogOpen(0,0)),()=>{t?.onNestedDialogOpen&&r&&t.onNestedDialogOpen(0,0)}),[n,r,d,p,t]),JE(e,{activeTriggerProps:y.reference,inactiveTriggerProps:y.trigger,popupProps:y.floating,nestedOpenDialogCount:d,nestedOpenDrawerCount:p}),null}const WQ={...n1,modal:e=>e.modal,nested:e=>e.nested,nestedOpenDialogCount:e=>e.nestedOpenDialogCount,nestedOpenDrawerCount:e=>e.nestedOpenDrawerCount,disablePointerDismissal:e=>e.disablePointerDismissal,openMethod:e=>e.openMethod,descriptionElementId:e=>e.descriptionElementId,titleElementId:e=>e.titleElementId,viewportElement:e=>e.viewportElement,role:e=>e.role};class JQ extends Ah{constructor(t,n,r){const o=new Ih,i=eW(t,o,n,r);super(i,tW(o),WQ)}setOpen=(t,n)=>{if(n.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},!t&&n.trigger==null&&this.state.activeTriggerId!=null&&(n.trigger=this.state.activeTriggerElement??void 0),this.context.onOpenChange?.(t,n),n.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(t,n);const r={open:t};XE(r,t,n.trigger),this.update(r)}}function eW(e,t,n,r=!1){const o={...e1(),modal:!0,disablePointerDismissal:!1,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,nestedOpenDrawerCount:0,role:"dialog",...e};return o.floatingRootContext=OP(t,n,r),o}function tW(e){return{popupRef:b.createRef(),backdropRef:b.createRef(),internalBackdropRef:b.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:e,onOpenChange:void 0,onOpenChangeComplete:void 0}}function nW(e,t){const{children:n,open:r,defaultOpen:o=!1,onOpenChange:i,onOpenChangeComplete:s,disablePointerDismissal:c=!1,modal:d=!0,actionsRef:u,handle:p,triggerId:m,defaultTriggerId:g=null}=t,y=e==="drawer",v=d,S=c,w="dialog",E=gc(!0),k=E!=null,j={modal:v,disablePointerDismissal:S,nested:k,role:w},N=NP((z,q)=>new JQ({open:o,openProp:r,activeTriggerId:g,triggerIdProp:m,...j},z,q),!0);N.useControlledProp("openProp",r),N.useControlledProp("triggerIdProp",m),N.useSyncedValues(j),N.useContextCallback("onOpenChange",i),N.useContextCallback("onOpenChangeComplete",s);const A=N.useState("open"),R=N.useState("mounted"),M=N.useState("payload");AP(N,A),QE(N);const{forceUnmount:T}=WE(A,N);b.useImperativeHandle(u,()=>({unmount:T,close:()=>N.setOpen(!1,Bt(PE))}),[T,N]);const O=A||R;return f.jsxs(fz.Provider,{value:N,children:[p&&f.jsx(KE,{handle:p,store:N}),O&&f.jsx(QQ,{store:N,parentContext:E?.context,isDrawer:y}),typeof n=="function"?n({payload:M}):n]})}function rW(e){return nW("dialog",e)}const oW=b.forwardRef(function(t,n){const{render:r,className:o,style:i,id:s,...c}=t,d=gc(),u=na(s);return d.useSyncedValueWithCleanup("titleElementId",u),wn("h2",t,{ref:n,props:[{id:u},c]})});function jo({...e}){return f.jsx(rW,{"data-slot":"dialog",...e})}function iW({...e}){return f.jsx(XQ,{"data-slot":"dialog-portal",...e})}function id({...e}){return f.jsx(b1,{"data-slot":"dialog-close",...e})}function sW({className:e,...t}){return f.jsx(qQ,{"data-slot":"dialog-overlay",className:Ct("fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0",e),...t})}function Ro({className:e,children:t,showCloseButton:n=!0,...r}){return f.jsxs(iW,{children:[f.jsx(sW,{}),f.jsxs(KQ,{"data-slot":"dialog-content",className:Ct("fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-popover p-4 text-sm text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",e),...r,children:[t,n&&f.jsxs(b1,{"data-slot":"dialog-close",render:f.jsx(Te,{variant:"ghost",className:"absolute top-2 right-2",size:"icon-sm"}),children:[f.jsx(Nh,{}),f.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function _o({className:e,...t}){return f.jsx("div",{"data-slot":"dialog-header",className:Ct("flex flex-col gap-2",e),...t})}function $i({className:e,showCloseButton:t=!1,children:n,...r}){return f.jsxs("div",{"data-slot":"dialog-footer",className:Ct("-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t bg-muted/50 p-4 sm:flex-row sm:justify-end",e),...r,children:[n,t&&f.jsx(b1,{render:f.jsx(Te,{variant:"outline"}),children:"Close"})]})}function No({className:e,...t}){return f.jsx(oW,{"data-slot":"dialog-title",className:Ct("font-heading text-base leading-none font-medium",e),...t})}function To({className:e,...t}){return f.jsx(YQ,{"data-slot":"dialog-description",className:Ct("text-sm text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground",e),...t})}function gi({open:e,onOpenChange:t,title:n,description:r,confirmText:o="确认",cancelText:i="取消",destructive:s=!1,onConfirm:c,loading:d=!1}){return f.jsx(jo,{open:e,onOpenChange:t,children:f.jsxs(Ro,{className:"sm:max-w-sm",children:[f.jsxs(_o,{children:[f.jsx(No,{children:n}),r!==void 0&&f.jsx(To,{children:r})]}),f.jsxs($i,{children:[f.jsx(id,{render:f.jsx(Te,{variant:"outline"}),disabled:d,children:i}),f.jsx(Te,{type:"button",variant:s?"destructive":"default",disabled:d,onClick:c,children:d?"处理中…":o})]})]})})}function sd({className:e,...t}){return f.jsx("div",{"data-slot":"table-container",className:"relative w-full overflow-x-auto",children:f.jsx("table",{"data-slot":"table",className:Ct("w-full caption-bottom text-sm",e),...t})})}function ad({className:e,...t}){return f.jsx("thead",{"data-slot":"table-header",className:Ct("[&_tr]:border-b",e),...t})}function ld({className:e,...t}){return f.jsx("tbody",{"data-slot":"table-body",className:Ct("[&_tr:last-child]:border-0",e),...t})}function to({className:e,...t}){return f.jsx("tr",{"data-slot":"table-row",className:Ct("border-b transition-colors hover:bg-muted/50 has-aria-expanded:bg-muted/50 data-[state=selected]:bg-muted",e),...t})}function $n({className:e,...t}){return f.jsx("th",{"data-slot":"table-head",className:Ct("h-10 px-2 text-left align-middle font-medium whitespace-nowrap text-foreground [&:has([role=checkbox])]:pr-0",e),...t})}function Zt({className:e,...t}){return f.jsx("td",{"data-slot":"table-cell",className:Ct("p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0",e),...t})}const aW={rowSortingFeature:zQ,sortedRowModel:VQ(),rowPaginationFeature:IQ,paginatedRowModel:FQ(),columnMeta:{}};function yc({columns:e,data:t,pageSize:n=10,manualPagination:r=!1,emptySlot:o,loading:i=!1}){const s=e.find(w=>w.meta?.initialSortDesc===!0),c=s?.id??(s&&"accessorKey"in s&&s.accessorKey!==void 0?String(s.accessorKey):void 0),d={pagination:{pageIndex:0,pageSize:n},...c?{sorting:[{id:c,desc:!0}]}:{}},u=UQ({features:aW,columns:e,data:t,initialState:d,...r?{pagination:{pageIndex:0,pageSize:Math.max(t.length,1)}}:{}}),p=!i&&t.length===0,m=e.length,g=u.state.pagination.pageIndex,y=u.getRowModel().rows,v=u.getPageCount(),S=!r&&!i&&v>1;return f.jsxs("div",{className:"space-y-3",children:[f.jsxs(sd,{children:[f.jsx(ad,{children:u.getHeaderGroups().map(w=>f.jsx(to,{children:w.headers.map(E=>{const k=E.column.getIsSorted(),j=E.column.getCanSort();return f.jsx($n,{"aria-sort":j&&k!==!1?k==="asc"?"ascending":"descending":void 0,children:j?f.jsxs("button",{type:"button",onClick:E.column.getToggleSortingHandler(),className:"inline-flex items-center gap-1 font-medium hover:text-foreground",children:[f.jsx(u.FlexRender,{header:E}),k==="asc"?f.jsx(A6,{className:"size-3.5","aria-hidden":!0}):k==="desc"?f.jsx(N6,{className:"size-3.5","aria-hidden":!0}):f.jsx(_h,{className:"size-3.5 text-muted-foreground","aria-hidden":!0})]}):f.jsx(u.FlexRender,{header:E})},E.id)})},w.id))}),f.jsx(ld,{children:i?Array.from({length:Math.min(n,5)},(w,E)=>f.jsx(to,{children:Array.from({length:m},(k,j)=>f.jsx(Zt,{children:f.jsx(Za,{className:"h-4 w-full"})},j))},E)):p?f.jsx(to,{children:f.jsx(Zt,{colSpan:m,className:"p-0",children:o??f.jsx(Dn,{message:"暂无数据"})})}):y.map(w=>f.jsx(to,{children:w.getAllCells().map(E=>f.jsx(Zt,{children:f.jsx(u.FlexRender,{cell:E})},E.id))},w.id))})]}),S&&f.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between",children:[f.jsxs("p",{className:"text-sm text-muted-foreground",children:["第 ",g*n+1,"-",Math.min((g+1)*n,t.length)," 条 / 共 ",t.length," 条"]}),f.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[f.jsxs(pr,{value:String(u.state.pagination.pageSize),onValueChange:w=>u.setPageSize(Number(w)),children:[f.jsx(mr,{size:"sm",className:"h-8 w-20","aria-label":"每页条数",children:f.jsx(Gs,{})}),f.jsx(gr,{children:[10,20,50].map(w=>f.jsxs(Un,{value:String(w),children:[w," 条/页"]},w))})]}),f.jsx(Te,{type:"button",variant:"outline",size:"sm",onClick:()=>u.setPageIndex(0),disabled:!u.getCanPreviousPage(),children:"首页"}),f.jsx(Te,{type:"button",variant:"outline",size:"sm",onClick:()=>u.previousPage(),disabled:!u.getCanPreviousPage(),children:"上一页"}),f.jsxs("span",{className:"text-sm tabular-nums text-muted-foreground",children:[g+1," / ",v]}),f.jsx(Te,{type:"button",variant:"outline",size:"sm",onClick:()=>u.nextPage(),disabled:!u.getCanNextPage(),children:"下一页"}),f.jsx(Te,{type:"button",variant:"outline",size:"sm",onClick:()=>u.setPageIndex(v-1),disabled:!u.getCanNextPage(),children:"末页"})]})]})]})}function px({text:e,maxWidth:t="max-w-xs",label:n="描述"}){const[r,o]=b.useState(!1);return e?f.jsxs(f.Fragment,{children:[f.jsx("span",{role:"button",tabIndex:0,"aria-haspopup":"dialog","aria-expanded":r,title:e,className:`block ${t} cursor-pointer truncate text-muted-foreground underline decoration-dotted decoration-muted-foreground/60 underline-offset-4 transition-colors hover:text-foreground focus:outline-none focus-visible:rounded focus-visible:ring-2 focus-visible:ring-foreground`,onClick:()=>o(!0),onKeyDown:i=>{(i.key==="Enter"||i.key===" ")&&(i.preventDefault(),o(!0))},children:e}),f.jsx(jo,{open:r,onOpenChange:o,children:f.jsxs(Ro,{className:"sm:max-w-lg",children:[f.jsxs(_o,{children:[f.jsx(No,{children:n}),f.jsxs(To,{className:"sr-only",children:["完整",n,"内容"]})]}),f.jsx("div",{className:"max-h-96 overflow-y-auto whitespace-pre-wrap break-words text-sm leading-relaxed text-foreground",children:e})]})})]}):f.jsx("span",{className:"text-xs text-muted-foreground",children:"—"})}function lW(e){return wn(e.defaultTagName??"div",e,e)}const cW=Fh("group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!",{variants:{variant:{default:"bg-primary text-primary-foreground [a]:hover:bg-primary/80",secondary:"bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",destructive:"bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20",outline:"border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground",ghost:"hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50",link:"text-primary underline-offset-4 hover:underline"}},defaultVariants:{variant:"default"}});function Vt({className:e,variant:t="default",render:n,...r}){return lW({defaultTagName:"span",props:mi({className:Ct(cW({variant:t}),e)},r),render:n,state:{slot:"badge",variant:t}})}function uW({enabled:e}){return e===!1?f.jsx(Vt,{className:"bg-muted text-muted-foreground",children:"停用"}):f.jsx(Vt,{variant:"secondary",children:"启用"})}function mx({enabled:e,disabled:t,onClick:n}){return f.jsx(Te,{type:"button",variant:"outline",size:"sm",disabled:t,onClick:n,children:e===!1?"启用":"停用"})}function gx(){return{id:"enabled",header:"状态",accessorFn:e=>e.enabled??!0,cell:e=>f.jsx(uW,{enabled:e.getValue()})}}const dW=b.forwardRef(function(t,n){const{render:r,className:o,id:i,name:s,value:c,disabled:d=!1,onValueChange:u,defaultValue:p,autoFocus:m=!1,style:g,...y}=t,{state:v,name:S,disabled:w,setTouched:E,setDirty:k,validityData:j,setFocused:N,setFilled:A,validationMode:R,validation:M}=ex(),{clearErrors:T}=KP(),O=w||d,z=S??s,q={...v,disabled:O},{labelId:$}=o1(),G=i1({id:i});rt(()=>{const D=c!=null;M.inputRef.current?.value||D&&c!==""?A(!0):D&&c===""&&A(!1)},[M.inputRef,A,c]);const L=b.useRef(null);rt(()=>{m&&L.current===Jr(en(L.current))&&N(!0)},[m,N]);const[F]=Pg({controlled:c,default:p,name:"FieldControl",state:"value"}),P=c!==void 0,I=P?F:void 0,Y=st(()=>M.inputRef.current?.value);return qP(M.inputRef,G,I,Y,!O,s),wn("input",t,{ref:[n,L],state:q,props:[{id:G,disabled:O,name:z,ref:M.inputRef,"aria-labelledby":$,autoFocus:m,...P?{value:I}:{defaultValue:p},onChange(D){const H=D.currentTarget.value;u?.(H,Bt(Kl,D.nativeEvent)),k(H!==(j.initialValue??"")),A(H!==""),D.nativeEvent.defaultPrevented||(T(z),M.change(H))},onFocus(){N(!0)},onBlur(D){E(!0),N(!1),R==="onBlur"&&M.commit(D.currentTarget.value)},onKeyDown(D){D.currentTarget.tagName==="INPUT"&&D.key==="Enter"&&(E(!0),M.commit(D.currentTarget.value))}},y,D=>M.getValidationProps(O,D)],stateAttributesMapping:UP})}),fW=b.forwardRef(function(t,n){return f.jsx(dW,{ref:n,...t})});function Lt({className:e,type:t,...n}){return f.jsx(fW,{type:t,"data-slot":"input",className:Ct("h-8 w-full min-w-0 rounded-lg border border-input bg-transparent px-2.5 py-1 text-base transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",e),...n})}function ty({className:e,...t}){return f.jsx("textarea",{"data-slot":"textarea",className:Ct("flex field-sizing-content min-h-16 w-full rounded-lg border border-input bg-transparent px-2.5 py-2 text-base transition-colors outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",e),...t})}function pz({className:e,...t}){return f.jsx("div",{"data-slot":"input-group",role:"group",className:Ct("group/input-group relative flex h-8 w-full min-w-0 items-center rounded-lg border border-input transition-colors outline-none in-data-[slot=combobox-content]:focus-within:border-inherit in-data-[slot=combobox-content]:focus-within:ring-0 has-disabled:bg-input/50 has-disabled:opacity-50 has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-3 has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50 has-[[data-slot][aria-invalid=true]]:border-destructive has-[[data-slot][aria-invalid=true]]:ring-3 has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>textarea]:h-auto dark:bg-input/30 dark:has-disabled:bg-input/80 dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40 has-[>[data-align=block-end]]:[&>input]:pt-3 has-[>[data-align=block-start]]:[&>input]:pb-3 has-[>[data-align=inline-end]]:[&>input]:pr-1.5 has-[>[data-align=inline-start]]:[&>input]:pl-1.5",e),...t})}const hW=Fh("flex h-auto cursor-text items-center justify-center gap-2 py-1.5 text-sm font-medium text-muted-foreground select-none group-data-[disabled=true]/input-group:opacity-50 [&>kbd]:rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-4",{variants:{align:{"inline-start":"order-first pl-2 has-[>button]:ml-[-0.3rem] has-[>kbd]:ml-[-0.15rem]","inline-end":"order-last pr-2 has-[>button]:mr-[-0.3rem] has-[>kbd]:mr-[-0.15rem]","block-start":"order-first w-full justify-start px-2.5 pt-2 group-has-[>input]/input-group:pt-2 [.border-b]:pb-2","block-end":"order-last w-full justify-start px-2.5 pb-2 group-has-[>input]/input-group:pb-2 [.border-t]:pt-2"}},defaultVariants:{align:"inline-start"}});function oS({className:e,align:t="inline-start",...n}){return f.jsx("div",{role:"group","data-slot":"input-group-addon","data-align":t,className:Ct(hW({align:t}),e),onClick:r=>{r.target.closest("button")||r.currentTarget.parentElement?.querySelector("input")?.focus()},...n})}const pW=Fh("flex items-center gap-2 text-sm shadow-none",{variants:{size:{xs:"h-6 gap-1 rounded-[calc(var(--radius)-3px)] px-1.5 [&>svg:not([class*='size-'])]:size-3.5",sm:"","icon-xs":"size-6 rounded-[calc(var(--radius)-3px)] p-0 has-[>svg]:p-0","icon-sm":"size-8 p-0 has-[>svg]:p-0"}},defaultVariants:{size:"xs"}});function mW({className:e,type:t="button",variant:n="ghost",size:r="xs",...o}){return f.jsx(Te,{type:t,"data-size":r,variant:n,className:Ct(pW({size:r}),e),...o})}function gW({className:e,...t}){return f.jsx(Lt,{"data-slot":"input-group-control",className:Ct("flex-1 rounded-none border-0 bg-transparent shadow-none ring-0 focus-visible:ring-0 disabled:bg-transparent aria-invalid:ring-0 dark:bg-transparent dark:disabled:bg-transparent",e),...t})}function yW(e,t=300){const[n,r]=b.useState(e);return b.useEffect(()=>{const o=setTimeout(()=>r(e),t);return()=>clearTimeout(o)},[e,t]),n}function Zh({onDebouncedChange:e,placeholder:t,delay:n=300,className:r}){const[o,i]=b.useState(""),s=yW(o,n),c=b.useRef(e);return c.current=e,b.useEffect(()=>{c.current(s)},[s]),f.jsxs(pz,{className:r,children:[f.jsx(oS,{align:"inline-start",children:f.jsx(SD,{className:"size-4","aria-hidden":!0})}),f.jsx(gW,{type:"text",value:o,placeholder:t,maxLength:100,"aria-label":t??"搜索",onChange:d=>i(d.target.value)}),o.length>0&&f.jsx(oS,{align:"inline-end",children:f.jsx(mW,{size:"icon-xs","aria-label":"清空搜索",onClick:()=>i(""),children:f.jsx(Nh,{className:"size-4","aria-hidden":!0})})})]})}const xW={all:"全部状态",enabled:"启用",disabled:"停用"};function yx(e,t){return t==="all"?e:e.filter(n=>t==="disabled"?n.enabled===!1:n.enabled!==!1)}function xx({value:e,onChange:t,className:n}){return f.jsxs(pr,{value:e,onValueChange:r=>{(r==="all"||r==="enabled"||r==="disabled")&&t(r)},children:[f.jsx(mr,{size:"sm",className:n??"w-28","aria-label":"状态筛选",children:xW[e]}),f.jsxs(gr,{children:[f.jsx(Un,{value:"all",children:"全部状态"}),f.jsx(Un,{value:"enabled",children:"启用"}),f.jsx(Un,{value:"disabled",children:"停用"})]})]})}function mz(e,t=!0,n){return _r({queryKey:["agents",e,{includeDisabled:n?.includeDisabled??!1,q:n?.q??""}],queryFn:()=>S9(e,n),enabled:t&&e.length>0,placeholderData:jy})}function vW(e,t){return _r({queryKey:["agent",e,t?.scope??"global",t?.projectId??"",t?.includeDisabled],queryFn:()=>E9(e,t),enabled:e.length>0})}function bW(){const e=Jt();return on({mutationFn:t=>C9(t),onSuccess:()=>{e.invalidateQueries({queryKey:["agents"]})}})}function wW(){const e=Jt();return on({mutationFn:({name:t,patch:n,scope:r,projectId:o})=>k9(t,n,{...r!==void 0?{scope:r}:{},...o!==void 0?{projectId:o}:{}}),onSuccess:()=>{e.invalidateQueries({queryKey:["agents"]}),e.invalidateQueries({queryKey:["agent"]})}})}function SW(){const e=Jt();return on({mutationFn:({name:t,scope:n,projectId:r})=>j9(t,{...n!==void 0?{scope:n}:{},...r!==void 0?{projectId:r}:{}}),onSuccess:()=>{e.invalidateQueries({queryKey:["agents"]})}})}function EW(){const e=Jt();return on({mutationFn:({name:t,input:n,scope:r,projectId:o})=>R9(t,n,{...r!==void 0?{scope:r}:{},...o!==void 0?{projectId:o}:{}}),onSuccess:()=>{e.invalidateQueries({queryKey:["agents"]})}})}function CW(){const e=Jt();return on({mutationFn:({name:t,enabled:n,scope:r,projectId:o})=>_9(t,n,{...r!==void 0?{scope:r}:{},...o!==void 0?{projectId:o}:{}}),onSuccess:()=>{e.invalidateQueries({queryKey:["agents"]})}})}function vx({mutation:e,assetLabel:t,keyOf:n}){const{mutateAsync:r}=e,o=b.useCallback((s,c)=>{r(s).then(()=>{We.success(`${t}「${c.name}」已${s.enabled?"启用":"停用"}`)}).catch(d=>{We.error(ft(d))})},[r,t,n]),i=e.isPending&&e.variables!==void 0?n(e.variables):null;return{toggle:o,togglingKey:i}}function w1(){return _r({queryKey:["model-aliases"],queryFn:F9})}function kW(){const{data:e}=w1();return b.useMemo(()=>{const t=new Map;for(const n of e??[])t.set(n.code,n);return t},[e])}function jW(){const e=Jt();return on({mutationFn:t=>$9(t),onSuccess:()=>{e.invalidateQueries({queryKey:["model-aliases"]})}})}function RW(){const e=Jt();return on({mutationFn:({code:t,input:n})=>V9(t,n),onSuccess:()=>{e.invalidateQueries({queryKey:["model-aliases"]})}})}function _W(){const e=Jt();return on({mutationFn:t=>B9(t),onSuccess:()=>{e.invalidateQueries({queryKey:["model-aliases"]})}})}function gz(){return _r({queryKey:["settings-enums"],queryFn:H9})}function Vn(e){const{data:t}=gz();return b.useMemo(()=>t?.find(r=>r.category===e)?.entries??[],[t,e])}function NW(){const e=Jt();return on({mutationFn:({category:t,input:n})=>U9(t,n),onSuccess:()=>{e.invalidateQueries({queryKey:["settings-enums"]})}})}function TW(){const e=Jt();return on({mutationFn:({category:t,value:n})=>q9(t,n),onSuccess:()=>{e.invalidateQueries({queryKey:["settings-enums"]})}})}function jr({className:e,...t}){return f.jsx("label",{"data-slot":"label",className:Ct("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",e),...t})}function S1({open:e,onOpenChange:t,assetLabel:n,sourceName:r,projects:o,defaultTargetId:i,onSubmit:s}){const[c,d]=b.useState(""),[u,p]=b.useState("project"),[m,g]=b.useState(i),[y,v]=b.useState(!1),S=Vn("scope");b.useEffect(()=>{e&&(d(`${r}-copy`),p("project"),g(i),v(!1))},[e,r,i]);const w=/^[a-z0-9]+(-[a-z0-9]+)*$/.test(c),k=w&&(u==="global"||m!=="")&&!y,j=()=>{k&&(v(!0),s({newName:c,newScope:u,...u==="project"?{targetProjectId:m}:{}}).then(A=>{We.success(`${n}已复制为「${A.name}」`),t(!1)}).catch(A=>{We.error(ft(A))}).finally(()=>v(!1)))},N=o.find(A=>A.id===m);return f.jsx(jo,{open:e,onOpenChange:t,children:f.jsxs(Ro,{className:"sm:max-w-sm",children:[f.jsxs(_o,{children:[f.jsxs(No,{children:["复制",n]}),f.jsxs(To,{children:["将「",r,"」复制到目标作用域;副本是全新资产,可独立编辑。"]})]}),f.jsxs("div",{className:"space-y-4",children:[f.jsxs("div",{className:"space-y-2",children:[f.jsx(jr,{htmlFor:`copy-${n}-scope`,children:"目标作用域"}),f.jsxs(pr,{value:u,onValueChange:A=>{(A==="global"||A==="project")&&p(A)},children:[f.jsx(mr,{id:`copy-${n}-scope`,"aria-label":"目标作用域",className:"w-full",children:u==="global"?S.find(A=>A.value==="global")?.label??"全局":S.find(A=>A.value==="project")?.label??"项目"}),f.jsx(gr,{children:S.map(A=>f.jsx(Un,{value:A.value,children:A.label},A.value))})]})]}),u==="project"&&f.jsxs("div",{className:"space-y-2",children:[f.jsx(jr,{htmlFor:`copy-${n}-project`,children:"目标项目"}),f.jsxs(pr,{value:m,onValueChange:A=>{A!==null&&g(A)},children:[f.jsx(mr,{id:`copy-${n}-project`,"aria-label":"目标项目",className:"w-full",children:N?N.name:"选择项目"}),f.jsx(gr,{children:o.map(A=>f.jsx(Un,{value:A.id,children:A.name},A.id))})]})]}),f.jsxs("div",{className:"space-y-2",children:[f.jsx(jr,{htmlFor:`copy-${n}-name`,children:"新名称"}),f.jsx(Lt,{id:`copy-${n}-name`,value:c,placeholder:"kebab-case,如 code-review-copy",onChange:A=>d(A.target.value),onKeyDown:A=>{A.key==="Enter"&&j()}}),!w&&c.length>0&&f.jsx("p",{className:"text-xs text-destructive",children:"name 需为 kebab-case(小写字母/数字/中划线)"})]})]}),f.jsxs($i,{children:[f.jsx(id,{render:f.jsx(Te,{variant:"outline"}),disabled:y,children:"取消"}),f.jsx(Te,{type:"button",disabled:!k,onClick:j,children:y?"复制中…":"复制"})]})]})})}function Gh(e){const[t,n]=Ay(),r=t.get("projectId")??"",o=r?e.find(s=>s.id===r):void 0;return{overrideProjectId:r,scopedProject:o,exitScope:()=>{const s=new URLSearchParams(t);s.delete("projectId"),n(s,{replace:!0})}}}function Kh({project:e,onExit:t}){const n=e.status==="archived";return f.jsxs("div",{className:"mb-4 flex flex-wrap items-center justify-between gap-2 rounded-md border border-border bg-muted/40 px-3 py-2 text-sm",role:"status",children:[f.jsx("span",{className:"text-muted-foreground",children:n?f.jsxs(f.Fragment,{children:["正在查看已停用项目「",e.name,"」的资产(只读;模板与专用资产仍可复制出到活跃项目)"]}):f.jsxs(f.Fragment,{children:["正在查看项目「",e.name,"」的资产"]})}),f.jsx(Te,{type:"button",variant:"outline",size:"sm",onClick:t,children:"返回当前项目"})]})}function Ir(e){const t=CU();b.useEffect(()=>{const r=t[t.length-1]?.handle?.meta,o=e??r?.title;o&&(document.title=o)},[t,e])}function xc(e){const t=new Date(e);if(Number.isNaN(t.getTime()))return"—";const n=r=>String(r).padStart(2,"0");return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())} ${n(t.getHours())}:${n(t.getMinutes())}`}const Ls=mc(),XT=e=>e.scope==="project"&&e.projectId?`/agents/${encodeURIComponent(e.name)}/edit?scope=project&projectId=${encodeURIComponent(e.projectId)}`:`/agents/${encodeURIComponent(e.name)}/edit`,MW=e=>({name:e.name,enabled:e.enabled===!1,scope:e.scope,projectId:e.scope==="project"?e.projectId:void 0}),AW=e=>e.name;function OW(){Ir();const e=ko(),{activeProjectId:t,activeProjects:n,projects:r,bootstrapReady:o,bootstrapError:i,retryBootstrap:s}=Kr(),{overrideProjectId:c,scopedProject:d,exitScope:u}=Gh(r),p=d?.status==="archived",m=c||t,[g,y]=b.useState(""),v=mz(m,o,{includeDisabled:!0,q:g||void 0}),S=kW(),w=Vn("agent_function"),E=b.useMemo(()=>Z=>w.find(D=>D.value===Z)?.label.split("(")[0]??Z,[w]),k=SW(),j=EW(),N=CW(),[A,R]=b.useState("all"),{toggle:M,togglingKey:T}=vx({mutation:N,assetLabel:"代理",keyOf:AW}),[O,z]=b.useState(null),[q,$]=b.useState(null),G=b.useMemo(()=>yx(v.data??[],A),[v.data,A]),L=b.useCallback(Z=>r.find(D=>D.id===Z)?.name??"未知项目",[r]),F=()=>{O&&k.mutateAsync({name:O.name,scope:O.scope,projectId:O.scope==="project"?O.projectId:void 0}).then(()=>{We.success(`代理「${O.name}」已删除`),z(null)}).catch(Z=>{We.error(ft(Z)),z(null)})},P=b.useMemo(()=>[Ls.accessor("name",{id:"name",header:"名称",cell:Z=>p&&Z.row.original.scope==="project"?f.jsx("span",{className:"font-mono text-sm font-medium text-foreground",children:Z.getValue()}):f.jsx("button",{type:"button",onClick:()=>e(XT(Z.row.original)),className:"font-mono text-sm font-medium text-foreground hover:text-muted-foreground focus:outline-none focus-visible:ring-2 focus-visible:ring-foreground",children:Z.getValue()})}),Ls.accessor("model",{id:"model",header:"模型",cell:Z=>{const D=S.get(Z.getValue());return D?f.jsxs("span",{className:"font-mono text-xs text-muted-foreground",children:[D.name," (",D.realModel,")"]}):f.jsxs(Vt,{variant:"secondary",children:["未匹配: ",Z.getValue()]})}}),Ls.accessor("function",{id:"function",header:"功能类型",cell:Z=>Z.getValue()==="reviewer"?f.jsx(Vt,{className:"bg-warning/10 text-warning",children:E(Z.getValue())}):f.jsx(Vt,{variant:"secondary",children:E(Z.getValue())})}),Ls.accessor("scope",{id:"scope",header:"作用域",cell:Z=>{const D=Z.row.original;return D.scope==="global"?f.jsx(Vt,{variant:"secondary",children:"全局"}):f.jsx(Vt,{variant:"outline",children:L(D.projectId)})}}),gx(),Ls.accessor("boundSkills",{id:"boundSkills",header:"绑定技能",cell:Z=>f.jsxs(Vt,{variant:"secondary",children:[Z.getValue().length," 项"]})}),Ls.accessor("referenceCount",{id:"referenceCount",header:"引用",cell:Z=>Z.getValue()===void 0||Z.getValue()===0?f.jsx("span",{className:"text-xs text-muted-foreground",children:"—"}):f.jsx(Vt,{variant:"secondary",children:Z.getValue()})}),Ls.accessor("description",{id:"description",header:"描述",cell:Z=>f.jsx(px,{text:Z.getValue()})}),Ls.accessor("updatedAt",{id:"updatedAt",header:"更新时间",cell:Z=>f.jsx("span",{className:"text-xs text-muted-foreground",children:xc(Z.getValue()??"")}),meta:{initialSortDesc:!0}}),Ls.display({id:"actions",header:"操作",cell:({row:Z})=>{const D=p&&Z.original.scope==="project";return f.jsxs("div",{className:"flex gap-2",children:[f.jsx(Te,{type:"button",variant:"outline",size:"sm",disabled:D,onClick:()=>e(XT(Z.original)),children:"编辑"}),f.jsx(Te,{type:"button",variant:"outline",size:"sm",onClick:()=>$(Z.original),children:"复制"}),f.jsx(mx,{enabled:Z.original.enabled,disabled:D||T===Z.original.name,onClick:()=>M(MW(Z.original),{name:Z.original.name})}),f.jsx(Te,{type:"button",variant:"outline",size:"sm",disabled:D,onClick:()=>z(Z.original),children:"删除"})]})}})],[L,p,S,e,E,M,T]),I=v.data??[],Y=g.length>0;return f.jsxs("div",{className:"mx-auto w-full max-w-5xl px-4 py-6",children:[f.jsxs("div",{className:"mb-5 flex items-center justify-between",children:[f.jsxs("div",{children:[f.jsx("h1",{className:"text-xl font-bold text-foreground",children:"代理库"}),f.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Agent 配置与技能绑定管理"})]}),f.jsx(Te,{type:"button",disabled:!o||p,onClick:()=>e("/agents/new"),children:"+ 新建代理"})]}),d&&f.jsx(Kh,{project:d,onExit:u}),o&&(I.length>0||Y)&&f.jsxs("div",{className:"mb-3 flex flex-wrap items-center gap-2",children:[f.jsx(Zh,{className:"w-full sm:max-w-xs",placeholder:"搜索代理名称…",onDebouncedChange:y}),f.jsx(xx,{value:A,onChange:R})]}),i?f.jsx(kn,{message:ft(i),onRetry:s}):!o||v.isLoading?f.jsx(Kn,{rows:4,cols:10}):v.isError?f.jsx(kn,{message:ft(v.error),onRetry:()=>{v.refetch()}}):I.length===0?Y?f.jsx(Dn,{message:`没有匹配「${g}」的代理,试试其他关键词`}):p?f.jsx(Dn,{message:"该项目暂无专用代理(全局代理为空)"}):f.jsx(Dn,{message:"还没有代理,点击「新建代理」创建第一个",actionLabel:"新建代理",onAction:()=>e("/agents/new")}):G.length===0?f.jsx(Dn,{message:"当前筛选状态下没有代理,试试切换状态筛选"}):f.jsx("div",{className:v.isFetching?"pointer-events-none opacity-60 transition-opacity":"transition-opacity",children:f.jsx(yc,{columns:P,data:G})}),f.jsx(gi,{open:O!==null,onOpenChange:Z=>{Z||z(null)},title:"删除代理",description:O?`确定删除代理「${O.name}」?该操作不可恢复。`:"",confirmText:"删除",destructive:!0,loading:k.isPending,onConfirm:F}),f.jsx(S1,{open:q!==null,onOpenChange:Z=>{Z||$(null)},assetLabel:"代理",sourceName:q?.name??"",projects:n,defaultTargetId:t,onSubmit:Z=>j.mutateAsync({name:q?.name??"",input:Z,scope:q?.scope,projectId:q?.projectId})})]})}var Xh=e=>e.type==="checkbox",bx=e=>e.type==="file",Hs=e=>e instanceof Date,Or=e=>e==null;const E1=e=>typeof e=="object";var nr=e=>!Or(e)&&!Array.isArray(e)&&E1(e)&&!Hs(e),iS=e=>nr(e)&&e.target?Xh(e.target)?e.target.checked:bx(e.target)?e.target.files:e.target.value:e,yz=(e,t)=>t.split(".").some((n,r,o)=>!isNaN(Number(n))&&e.has(o.slice(0,r).join("."))),xz=e=>{const t=e.constructor&&e.constructor.prototype;return nr(t)&&t.hasOwnProperty("isPrototypeOf")},wx=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function Jn(e){if(e instanceof Date)return new Date(e);const t=typeof FileList<"u"&&e instanceof FileList;if(wx&&(e instanceof Blob||t))return e;const n=Array.isArray(e);if(!n&&!(nr(e)&&xz(e)))return e;const r=n?[]:Object.create(Object.getPrototypeOf(e));for(const o in e)Object.prototype.hasOwnProperty.call(e,o)&&(r[o]=Jn(e[o]));return r}const Va={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change",SUBMIT:"submit",TRIGGER:"trigger",VALID:"valid"},Mi={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},Ri={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},vz="root",C1=["__proto__","constructor","prototype"],DW=/^\w*$/;var zu=e=>DW.test(e),Zn=e=>e===void 0;const PW=/[.[\]'"]/;var nh=e=>e.split(PW).filter(Boolean),Qe=(e,t,n)=>{if(!t||!nr(e))return n;const r=zu(t)?[t]:nh(t);if(r.some(i=>C1.includes(i)))return n;const o=r.reduce((i,s)=>Or(i)?void 0:i[s],e);return Zn(o)||o===e?Zn(e[t])?n:e[t]:o},qo=e=>typeof e=="boolean",eo=e=>typeof e=="function",Cn=(e,t,n)=>{let r=-1;const o=zu(t)?[t]:nh(t),i=o.length,s=i-1;for(;++r<i;){const c=o[r];let d=n;if(r!==s){const u=e[c];d=nr(u)||Array.isArray(u)?u:isNaN(+o[r+1])?{}:[]}if(C1.includes(c))return;e[c]=d,e=e[c]}};const k1=Ne.createContext(null);k1.displayName="HookFormControlContext";const j1=()=>Ne.useContext(k1);var bz=(e,t,n,r=!0)=>{const o={};for(const i in e)Object.defineProperty(o,i,{get:()=>{const s=i;return t._proxyFormState[s]!==Mi.all&&(t._proxyFormState[s]=!r||Mi.all),n&&(n[s]=!0),e[s]}});return o};const R1=wx?Ne.useLayoutEffect:Ne.useEffect;var sS=e=>Or(e)||!E1(e);const QT=(e,t)=>t.length===0&&!Array.isArray(e)&&!xz(e);function So(e,t,n=new WeakMap){if(e===t)return!0;if(sS(e)||sS(t))return Object.is(e,t);if(Hs(e)&&Hs(t))return Object.is(e.getTime(),t.getTime());const r=Object.keys(e),o=Object.keys(t);if(r.length!==o.length)return!1;if(QT(e,r)||QT(t,o))return Object.is(e,t);if(!r.length&&Array.isArray(e)!==Array.isArray(t))return!1;const i=n.get(e);if(i&&i.has(t))return!0;if(i)i.add(t);else{const s=new WeakSet;s.add(t),n.set(e,s)}for(const s of r){const c=e[s];if(!(s in t))return!1;if(s!=="ref"){const d=t[s];if(Hs(c)&&Hs(d)||(nr(c)||Array.isArray(c))&&(nr(d)||Array.isArray(d))?!So(c,d,n):!Object.is(c,d))return!1}}return!0}function _1(){const e=Ne.useRef(!1),t=Ne.useRef(void 0),n=Ne.useCallback((o,i,s)=>{if(o&&e.current){const c=i();So(t.current,c)||s(c)}e.current=!0},[]),r=Ne.useCallback((o,i)=>{o&&(t.current=Jn(i()))},[]);return{resyncIfNeeded:n,snapshot:r}}function IW(e){const t=j1(),{control:n=t,disabled:r,name:o,exact:i}=e||{},[s,c]=Ne.useState(()=>({...n._formState,defaultValues:n._defaultValues})),d=Ne.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1}),{resyncIfNeeded:u,snapshot:p}=_1();return R1(()=>{const m=()=>({...n._formState,defaultValues:n._defaultValues});u(!r,m,c);const g=n._subscribe({name:o,formState:d.current,exact:i,callback:y=>{!r&&c({...n._formState,...y,defaultValues:n._defaultValues})}});return()=>{g(),p(!r,m)}},[o,r,i,u,p]),Ne.useEffect(()=>{d.current.isValid&&n._setValid(!0)},[n]),Ne.useMemo(()=>bz(s,n,d.current,!1),[s,n])}var Ur=e=>typeof e=="string",aS=(e,t,n,r,o)=>Ur(e)?(r&&t.watch.add(e),Qe(n,e,o)):Array.isArray(e)?e.map(i=>(r&&t.watch.add(i),Qe(n,i))):(r&&(t.watchAll=!0),n);function zW(e){const t=j1(),{control:n=t,name:r,defaultValue:o,disabled:i,exact:s,compute:c}=e||{},d=Ne.useRef(o),u=Ne.useRef(c),p=Ne.useRef(void 0),m=Ne.useRef(n),g=Ne.useRef(r);u.current=c;const[y,v]=Ne.useState(()=>{const T=n._getWatch(r,d.current);return u.current?u.current(T):T}),S=Ne.useCallback(T=>{const O=aS(r,n._names,T||n._formValues,!1,d.current);return u.current?u.current(O):O},[n._formValues,n._names,r]),w=Ne.useCallback(T=>{if(!i){const O=aS(r,n._names,T||n._formValues,!1,d.current);if(u.current){const z=u.current(O);So(z,p.current)||(v(z),p.current=z)}else v(O)}},[n._formValues,n._names,i,r]),{resyncIfNeeded:E,snapshot:k}=_1(),j=Ne.useRef(w);j.current=w;const N=Ne.useRef(S);N.current=S,R1(()=>{m.current!==n||!So(g.current,r)?(m.current=n,g.current=r,j.current()):E(!i,()=>N.current(),O=>{v(O),p.current=O});const T=n._subscribe({name:r,formState:{values:!0},exact:s,callback:O=>{j.current(O.values)}});return()=>{T(),k(!i,()=>N.current())}},[n,s,r,i,E,k]),Ne.useEffect(()=>n._removeUnmounted());const A=m.current!==n,R=g.current,M=Ne.useMemo(()=>{if(i)return null;const T=!A&&!So(R,r);return A||T?S():null},[i,A,r,R,S]);return M!==null?M:y}function LW(e){const t=j1(),{name:n,disabled:r,control:o=t,shouldUnregister:i,defaultValue:s,exact:c=!0}=e,d=yz(o._names.array,n),u=Ne.useMemo(()=>Qe(o._formValues,n,Qe(o._defaultValues,n,s)),[o,n,s]),p=zW({control:o,name:n,defaultValue:u,exact:c}),m=IW({control:o,name:n,exact:c}),g=Ne.useRef(e),y=Ne.useRef(null),v=Ne.useRef(o.register(n,{...e.rules,value:p,...qo(e.disabled)?{disabled:e.disabled}:{}}));g.current=e;const S=Ne.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!Qe(m.errors,n)},isDirty:{enumerable:!0,get:()=>!!Qe(m.dirtyFields,n)},isTouched:{enumerable:!0,get:()=>!!Qe(m.touchedFields,n)},isValidating:{enumerable:!0,get:()=>!!Qe(m.validatingFields,n)},error:{enumerable:!0,get:()=>Qe(m.errors,n)}}),[m,n]),w=Ne.useCallback(N=>{const A=iS(N);return Qe(o._fields,n)||(v.current=o.register(n,{...g.current.rules,value:A})),v.current.onChange({target:{value:iS(N),name:n},type:Va.CHANGE})},[n,o]),E=Ne.useCallback(()=>v.current.onBlur({target:{value:Qe(o._formValues,n),name:n},type:Va.BLUR}),[n,o._formValues]),k=Ne.useCallback(N=>{N&&(y.current={focus:()=>eo(N.focus)&&N.focus(),select:()=>eo(N.select)&&N.select(),setCustomValidity:R=>eo(N.setCustomValidity)&&N.setCustomValidity(R),reportValidity:()=>eo(N.reportValidity)&&N.reportValidity()});const A=Qe(o._fields,n);A&&A._f&&N&&(A._f.ref=y.current)},[o._fields,n]),j=Ne.useMemo(()=>({name:n,value:p,...qo(r)||m.disabled?{disabled:m.disabled||r}:{},onChange:w,onBlur:E,ref:k}),[n,r,m.disabled,w,E,k,p]);return Ne.useEffect(()=>{const N=o._options.shouldUnregister||i;v.current=o.register(n,{...g.current.rules,...qo(g.current.disabled)?{disabled:g.current.disabled}:{}});const A=(R,M)=>{const T=Qe(o._fields,R);T&&T._f&&(T._f.mount=M)};if(A(n,!0),N){const R=Jn(Qe(i?o._defaultValues:o._options.values||o._defaultValues,n,Qe(o._options.defaultValues,n,g.current.defaultValue)));Cn(o._defaultValues,n,R),Zn(Qe(o._formValues,n))&&Cn(o._formValues,n,R)}if(!d&&o.register(n),y.current){const R=Qe(o._fields,n);R&&R._f&&(R._f.ref=y.current)}return()=>{(d?N&&!o._state.action:N)?o.unregister(n):A(n,!1)}},[n,o,d,i]),Ne.useEffect(()=>{o._setDisabledField({disabled:r,name:n})},[r,n,o]),Ne.useMemo(()=>({field:j,formState:m,fieldState:S}),[j,m,S])}const FW=e=>e.render(LW(e));var Vm=e=>({isOnSubmit:!e||e===Mi.onSubmit,isOnBlur:e===Mi.onBlur,isOnChange:e===Mi.onChange,isOnAll:e===Mi.all,isOnTouch:e===Mi.onTouched}),R0=(e,t,n)=>{if(n)return!1;if(t.watchAll||t.watch.has(e))return!0;for(const r of t.watch)if(e.startsWith(r)&&e.charAt(r.length)===".")return!0;return!1};const Vf=(e,t,n,r)=>{for(const o of n||Object.keys(e)){if(o==="_f")continue;const i=n?Qe(e,o):e[o];if(i){const{_f:s}=i;if(s){if(s.refs&&s.refs[0]&&t(s.refs[0],o)&&!r)return!0;if(s.ref&&t(s.ref,s.name)&&!r)return!0;if(Vf(i,t))break}else if((nr(i)||Array.isArray(i))&&Vf(i,t))break}}};var WT=(e,t,n)=>{const r=Qe(e,n),o=Array.isArray(r)?r:[];return Cn(o,vz,t[n]),Cn(e,n,o),e},Hr=e=>nr(e)&&!Object.keys(e).length,ny=e=>{if(!wx)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},N1=e=>e.type==="radio",ry=e=>e instanceof RegExp,T1=(e,t,n,r,o)=>t?{...n[e],types:{...n[e]&&n[e].types?n[e].types:{},[r]:o||!0}}:{};const JT={value:!1,isValid:!1},eM={value:!0,isValid:!0};var wz=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter(n=>n&&n.checked&&!n.disabled).map(n=>n.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!Zn(e[0].attributes.value)?Zn(e[0].value)||e[0].value===""?eM:{value:e[0].value,isValid:!0}:eM:JT}return JT};const tM={isValid:!1,value:null};var Sz=e=>Array.isArray(e)?e.reduce((t,n)=>n&&n.checked&&!n.disabled?{isValid:!0,value:n.value}:t,tM):tM;function nM(e,t,n="validate"){if(Ur(e)||Array.isArray(e)&&e.every(Ur)||qo(e)&&!e)return{type:n,message:Ur(e)?e:"",ref:t}}var nu=e=>nr(e)&&!ry(e)?e:{value:e,message:""},rM=async(e,t,n,r,o,i)=>{const{ref:s,refs:c,required:d,maxLength:u,minLength:p,min:m,max:g,pattern:y,validate:v,name:S,valueAsNumber:w,mount:E}=e._f,k=Qe(n,S);if(!E||t.has(S))return{};const j=c?c[0]:s,N=$=>{if(o&&j.reportValidity){const G=qo($)?"":$||"";c?c.forEach(L=>L.setCustomValidity(G)):j.setCustomValidity(G),j.reportValidity()}},A={},R=N1(s),M=Xh(s),T=R||M,O=(w||bx(s))&&Zn(s.value)&&Zn(k)||ny(s)&&s.value===""||k===""||Array.isArray(k)&&!k.length,z=T1.bind(null,S,r,A),q=($,G,L,F=Ri.maxLength,P=Ri.minLength)=>{const I=$?G:L;A[S]={type:$?F:P,message:I,ref:s,...z($?F:P,I)}};if(i?!Array.isArray(k)||!k.length:d&&(!T&&(O||Or(k))||qo(k)&&!k||M&&!wz(c).isValid||R&&!Sz(c).isValid)){const{value:$,message:G}=Ur(d)?{value:!!d,message:d}:nu(d);if($&&(A[S]={type:Ri.required,message:G,ref:j,...z(Ri.required,G)},!r))return N(G),A}if(!O&&(!Or(m)||!Or(g))){let $,G;const L=nu(g),F=nu(m);if(!Or(k)&&!Hs(k)&&!isNaN(k)){const P=s.valueAsNumber||k&&+k;Or(L.value)||($=P>L.value),Or(F.value)||(G=P<F.value)}else{const P=s.valueAsDate||new Date(k),I=D=>new Date(new Date().toDateString()+" "+D),Y=s.type=="time",Z=s.type=="week";Ur(L.value)&&k&&($=Y?I(k)>I(L.value):Z?k>L.value:P>new Date(L.value)),Ur(F.value)&&k&&(G=Y?I(k)<I(F.value):Z?k<F.value:P<new Date(F.value))}if(($||G)&&(q(!!$,L.message,F.message,Ri.max,Ri.min),!r))return N(A[S].message),A}if((u||p)&&!O&&(Ur(k)||i&&Array.isArray(k))){const $=nu(u),G=nu(p),L=!Or($.value)&&k.length>+$.value,F=!Or(G.value)&&k.length<+G.value;if((L||F)&&(q(L,$.message,G.message),!r))return N(A[S].message),A}if(y&&!O&&Ur(k)){const{value:$,message:G}=nu(y);if(ry($)&&!k.match($)&&(A[S]={type:Ri.pattern,message:G,ref:s,...z(Ri.pattern,G)},!r))return N(G),A}if(v){if(eo(v)){const $=await v(k,n),G=nM($,j);if(G&&(A[S]={...G,...z(Ri.validate,G.message)},!r))return N(G.message),A}else if(nr(v)){let $={};for(const G in v){if(!Hr($)&&!r)break;const L=nM(await v[G](k,n),j,G);L&&($={...L,...z(G,L.message)},N(L.message),r&&(A[S]=$))}if(!Hr($)&&(A[S]={ref:j,...$},!r))return A}}return N(!0),A},wg=e=>Array.isArray(e)?e:[e],Ez=e=>Array.isArray(e)?e.filter(Boolean):[];function $W(e,t){const n=t.length-1;let r=0;for(;r<n;){if(Or(e)){e=void 0;break}e=e[t[r]],r++}return e}function VW(e){for(const t in e)if(e.hasOwnProperty(t)&&!Zn(e[t]))return!1;return!0}function fr(e,t){if(Ur(t)&&Object.prototype.hasOwnProperty.call(e,t))return delete e[t],e;const n=Array.isArray(t)?t:zu(t)?[t]:nh(t);if(n.some(s=>C1.includes(String(s))))return e;const r=n.length===1?e:$W(e,n),o=n.length-1,i=n[o];return r&&delete r[i],o!==0&&(nr(r)&&Hr(r)||Array.isArray(r)&&VW(r))&&fr(e,n.slice(0,-1)),e}const Cz=e=>{const t={};for(const n of Object.keys(e))if(E1(e[n])&&e[n]!==null&&!Hs(e[n])){const r=Cz(e[n]);for(const o of Object.keys(r))t[`${n}.${o}`]=r[o]}else t[n]=e[n];return t},M1=Ne.createContext(null);M1.displayName="HookFormContext";const BW=()=>Ne.useContext(M1),HW=({children:e,watch:t,getValues:n,getFieldState:r,setError:o,clearErrors:i,setValue:s,setValues:c,trigger:d,formState:u,resetField:p,reset:m,resetDefaultValues:g,handleSubmit:y,unregister:v,control:S,register:w,setFocus:E,subscribe:k})=>{const j=Ne.useMemo(()=>({watch:t,getValues:n,getFieldState:r,setError:o,clearErrors:i,setValue:s,setValues:c,trigger:d,formState:u,resetField:p,reset:m,resetDefaultValues:g,handleSubmit:y,unregister:v,control:S,register:w,setFocus:E,subscribe:k}),[i,S,u,r,n,y,w,m,g,p,o,E,s,c,k,d,v,t]);return Ne.createElement(M1.Provider,{value:j},Ne.createElement(k1.Provider,{value:j.control},e))};var oM=()=>{let e=[];return{get observers(){return e},next:o=>{for(const i of e)i.next&&i.next(o)},subscribe:o=>(e.push(o),{unsubscribe:()=>{e=e.filter(i=>i!==o)}}),unsubscribe:()=>{e=[]}}};function kz(e,t){const n={};for(const r in e)if(e.hasOwnProperty(r)){const o=e[r],i=t[r];if(o&&nr(o)&&i){const s=kz(o,i);nr(s)&&(n[r]=s)}else e[r]&&(n[r]=i)}return n}var jz=e=>e.type==="select-multiple",UW=e=>N1(e)||Xh(e),_0=e=>ny(e)&&e.isConnected;function iM(e){return Array.isArray(e)||nr(e)}function Rz(e,t,n="",r=[]){for(const o in e){const i=n?`${n}.${o}`:o,s=e[o];iM(s)&&iM(Qe(t,i))?Rz(s,t,i,r):r.push(i)}return r}var qW=e=>{for(const t in e)if(eo(e[t]))return!0;return!1};function _z(e){return Array.isArray(e)||nr(e)&&!qW(e)}function Nz(e){return!!(e&&"_f"in e)}function Tz(e){return Array.isArray(e)?!e.some(t=>!Zn(t)):!Object.keys(e).length}function lS(e,t){Array.isArray(e)?e[t]=void 0:delete e[t]}function cS(e,t={},n){for(const r in e){const o=e[r],i=n&&n[r];_z(o)&&(!Array.isArray(o)||!Nz(i))?(t[r]=Array.isArray(o)?[]:{},cS(o,t[r],i),Tz(t[r])&&lS(t,r)):Zn(o)||(t[r]=!0)}return t}function Il(e,t,n,r){n||(n=cS(t,{},r));for(const o in e){const i=e[o],s=r&&r[o];_z(i)&&(!Array.isArray(i)||!Nz(s))?(Zn(t)||sS(n[o])?n[o]=cS(i,Array.isArray(i)?[]:{},s):Il(i,Or(t)?{}:t[o],n[o],s),Tz(n[o])&&lS(n,o)):So(i,t[o])?lS(n,o):n[o]=!0}return n}var Mz=(e,{valueAsNumber:t,valueAsDate:n,setValueAs:r})=>Zn(e)?e:t?e===""?NaN:e&&+e:n&&Ur(e)?new Date(e):r?r(e):e;function sM(e){const t=e.ref;return bx(t)?t.files:N1(t)?Sz(e.refs).value:jz(t)?[...t.selectedOptions].map(({value:n})=>n):Xh(t)?wz(e.refs).value:Mz(t.value,e)}var YW=(e,t,n,r)=>{const o={};for(const i of e){const s=Qe(t,i);s&&Cn(o,i,s._f)}return{criteriaMode:n,names:[...e],fields:o,shouldUseNativeValidation:r}},hf=e=>Zn(e)?e:ry(e)?e.source:nr(e)?ry(e.value)?e.value.source:e.value:e;const aM="AsyncFunction";var ZW=e=>{if(!e||!e.validate)return!1;if(eo(e.validate))return e.validate.constructor.name===aM;if(nr(e.validate)){for(const t in e.validate)if(e.validate[t].constructor.name===aM)return!0}return!1},GW=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate);function lM(e,t,n){const r=Qe(e,n);if(r||zu(n))return{error:r,name:n};const o=n.split(".");for(;o.length;){const i=o.join("."),s=Qe(t,i),c=Qe(e,i);if(s&&!Array.isArray(s)&&n!==i)return{name:n};if(c&&c.type)return{name:i,error:c};if(c&&c.root&&c.root.type)return{name:`${i}.root`,error:c.root};o.pop()}return{name:n}}var KW=(e,t,n,r)=>{n(e);const o=Object.keys(e).filter(i=>i!=="name");return!o.length||r&&o.length>=Object.keys(t).length||o.find(i=>t[i]===(!r||Mi.all))},XW=(e,t,n)=>!e||!t||e===t||wg(e).some(r=>r&&(n?r===t||r.startsWith(t+"."):r.startsWith(t)||t.startsWith(r))),QW=(e,t,n,r,o)=>o.isOnAll?!1:!n&&o.isOnTouch?!(t||e):(n?r.isOnBlur:o.isOnBlur)?!e:(n?r.isOnChange:o.isOnChange)?e:!0,WW=(e,t)=>{const n=Qe(e,t);!Ez(n).length&&!n?.root&&fr(e,t)};const JW={mode:Mi.onSubmit,reValidateMode:Mi.onChange,shouldFocusError:!0},N0="form",eJ=(e,t)=>{for(const n in e)n in t||delete e[n];Object.assign(e,t)},Az={submitCount:0,isDirty:!1,isReady:!1,isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{}};function tJ(e={}){let t={...JW,...e},n={...Jn(Az),isLoading:eo(t.defaultValues),errors:t.errors||{},disabled:t.disabled||!1},r={},o=nr(t.defaultValues)||nr(t.values)?Jn(t.defaultValues||t.values)||{}:{},i=t.shouldUnregister?{}:Jn(o),s={action:!1,actionArrayLengths:new Map,mount:!1,watch:!1,keepIsValid:!1},c={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set,registerName:new Set};const d={},u={};let p=0,m=Vm(t.mode),g=Vm(t.reValidateMode);const y={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},v={...y};let S={...v};const w={array:oM(),state:oM()};let E=0;const k=t.criteriaMode===Mi.all,j=(ee,ie)=>le=>{clearTimeout(u[ee]),u[ee]=setTimeout(ie,le)},N=async ee=>{if(!s.keepIsValid&&!t.disabled&&(v.isValid||S.isValid||ee)){const ie=++E;let le;t.resolver?(le=Hr((await F()).errors),ie===E&&A()):le=await Y({fields:r,onlyCheckValid:!0,eventType:Va.VALID}),ie===E&&le!==n.isValid&&w.state.next({isValid:le})}},A=(ee,ie)=>{!t.disabled&&(v.isValidating||v.validatingFields||S.isValidating||S.validatingFields)&&((ee||Array.from(c.mount)).forEach(le=>{le&&(ie?Cn(n.validatingFields,le,ie):fr(n.validatingFields,le))}),w.state.next({validatingFields:n.validatingFields,isValidating:!Hr(n.validatingFields)}))},R=()=>{n.dirtyFields=Il(o,i,void 0,r)},M=(ee,ie=[],le,Ce,ve=!0,Be=!0)=>{if(Ce&&le&&!t.disabled){if(s.action=!0,!s.actionArrayLengths.has(ee)){const Pe=Qe(r,ee);s.actionArrayLengths.set(ee,Array.isArray(Pe)?Pe.length:0)}if(Be&&Array.isArray(Qe(r,ee))){const Pe=le(Qe(r,ee),Ce.argA,Ce.argB);ve&&Cn(r,ee,Pe)}if(Be&&Array.isArray(Qe(n.errors,ee))){const Pe=Qe(n.errors,ee),qe=Pe.root,Ke=le(Pe,Ce.argA,Ce.argB)||Pe;qe&&(Ke.root=qe),ve&&Cn(n.errors,ee,Ke),WW(n.errors,ee)}if((v.touchedFields||S.touchedFields)&&Be&&Array.isArray(Qe(n.touchedFields,ee))){const Pe=le(Qe(n.touchedFields,ee),Ce.argA,Ce.argB);ve&&Cn(n.touchedFields,ee,Pe)}(v.dirtyFields||S.dirtyFields)&&R(),w.state.next({name:ee,isDirty:D(ee,ie),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else Cn(i,ee,ie)},T=(ee,ie)=>{Cn(n.errors,ee,ie),n.errors={...n.errors},w.state.next({errors:n.errors})},O=ee=>{n.errors=ee,w.state.next({errors:n.errors,isValid:!1})},z=ee=>{const ie=zu(ee)?[ee]:nh(ee);let le=i,Ce=o;for(let ve=0;ve<ie.length-1;ve++){const Be=ie[ve];if(le=Or(le)?le:le[Be],Ce=Or(Ce)?Ce:Ce[Be],le===null&&Ce!==null)return!0}return!1},q=ee=>{if(!s.actionArrayLengths.size)return!1;const ie=zu(ee)?[ee]:nh(ee);let le=i,Ce="",ve=-1,Be=0;for(let Pe=0;Pe<ie.length;Pe++){if(Or(le))return!1;const qe=ie[Pe];if(Ce=Ce?`${Ce}.${qe}`:qe,Array.isArray(le)&&+qe>=le.length)return ve===-1?!1:Pe===ve?+qe<Be:!0;s.actionArrayLengths.has(Ce)&&(ve=Pe+1,Be=s.actionArrayLengths.get(Ce)),le=le[qe]}return!1},$=(ee,ie,le,Ce)=>{const ve=Qe(r,ee);if(ve){if(z(ee)||q(ee))return;const Be=Zn(Qe(i,ee)),Pe=Qe(i,ee,Zn(le)?Qe(o,ee):le);Zn(Pe)||Ce&&Ce.defaultChecked||ie?Cn(i,ee,ie?Pe:sM(ve._f)):B(ee,Pe),s.mount&&!s.action&&(N(),Be&&n.isDirty&&(v.isDirty||S.isDirty)&&(D()||(n.isDirty=!1,w.state.next({...n}))),e.shouldUnregister&&Be&&!Zn(Qe(i,ee))&&R0(ee,c)&&(s.watch=!0))}},G=(ee,ie,le,Ce,ve)=>{let Be=!1,Pe=!1;const qe={name:ee};if(!t.disabled||Ce===!0){if(!le||Ce){const Ke=So(Qe(o,ee),ie);(v.isDirty||S.isDirty)&&(Pe=n.isDirty,n.isDirty=qe.isDirty=!Ke||D(),Be=Pe!==qe.isDirty),Pe=!!Qe(n.dirtyFields,ee),Ke!==n.isDirty?eJ(n.dirtyFields,Il(o,i,void 0,r)):Ke?fr(n.dirtyFields,ee):Cn(n.dirtyFields,ee,!0),qe.dirtyFields=n.dirtyFields,Be=Be||(v.dirtyFields||S.dirtyFields)&&Pe!==!Ke}if(le){const Ke=Qe(n.touchedFields,ee);Ke||(Cn(n.touchedFields,ee,le),qe.touchedFields=n.touchedFields,Be=Be||(v.touchedFields||S.touchedFields)&&Ke!==le)}Be&&ve&&w.state.next(qe)}return Be?qe:{}},L=(ee,ie,le,Ce)=>{const ve=Qe(n.errors,ee),Be=(v.isValid||S.isValid)&&qo(ie)&&n.isValid!==ie;if(t.delayError&&le?(d[ee]=j(ee,()=>T(ee,le)),d[ee](t.delayError)):(clearTimeout(u[ee]),delete d[ee],le?Cn(n.errors,ee,le):fr(n.errors,ee),n.errors={...n.errors}),(le?!So(ve,le):ve)||!Hr(Ce)||Be){const Pe={...Ce,...Be&&qo(ie)?{isValid:ie}:{},errors:n.errors,name:ee};n={...n,...Pe},w.state.next(Pe)}},F=async ee=>(A(ee,!0),await t.resolver(i,t.context,YW(ee||c.mount,r,t.criteriaMode,t.shouldUseNativeValidation))),P=async ee=>{const{errors:ie}=await F(ee);if(A(ee),ee){for(const le of ee){const Ce=Qe(ie,le);Ce?c.array.has(le)&&nr(Ce)&&!Object.keys(Ce).some(ve=>!Number.isNaN(Number(ve)))?WT(n.errors,{[le]:Ce},le):Cn(n.errors,le,Ce):fr(n.errors,le)}n.errors={...n.errors}}else n.errors=ie;return ie},I=async({name:ee,eventType:ie})=>{if(e.validate){const le=await e.validate({formValues:i,formState:n,name:ee,eventType:ie});if(nr(le))for(const Ce in le){const ve=le[Ce];ve&&ge(`${N0}.${Ce}`,{message:Ur(ve.message)?ve.message:"",type:ve.type||Ri.validate})}else Ur(le)||!le?ge(N0,{message:le||"",type:Ri.validate}):re(N0);return le}return!0},Y=async({fields:ee,onlyCheckValid:ie,name:le,eventType:Ce,context:ve={valid:!0,runRootValidation:!1}})=>{if(e.validate&&(ve.runRootValidation=!0,!await I({name:le,eventType:Ce})&&(ve.valid=!1,ie)))return ve.valid;for(const Be in ee){const Pe=ee[Be];if(Pe){const{_f:qe,...Ke}=Pe;if(qe){const nt=c.array.has(qe.name),it=Pe._f&&ZW(Pe._f),jt=v.validatingFields||v.isValidating||S.validatingFields||S.isValidating;it&&jt&&A([qe.name],!0);const Ut=await rM(Pe,c.disabled,i,k,t.shouldUseNativeValidation&&!ie,nt);if(it&&jt&&A([qe.name]),Ut[qe.name]&&(ve.valid=!1,ie)||(!ie&&(Qe(Ut,qe.name)?nt?WT(n.errors,Ut,qe.name):Cn(n.errors,qe.name,Ut[qe.name]):fr(n.errors,qe.name)),e.shouldUseNativeValidation&&Ut[qe.name]))break}!Hr(Ke)&&await Y({context:ve,onlyCheckValid:ie,fields:Ke,name:Be,eventType:Ce})}}return ve.valid},Z=()=>{for(const ee of c.unMount){const ie=Qe(r,ee);ie&&(ie._f.refs?ie._f.refs.every(le=>!_0(le)):!_0(ie._f.ref))&&$e(ee)}c.unMount=new Set},D=(ee,ie)=>(ee&&ie&&Cn(i,ee,ie),!So(s.mount?i:o,o)),H=(ee,ie,le)=>aS(ee,c,{...s.mount?i:Zn(ie)||Ur(ee)?o:ie},le,ie),U=ee=>Ez(Qe(s.mount?i:o,ee,t.shouldUnregister?Qe(o,ee,[]):[])),B=(ee,ie,le={},Ce=!1,ve=!1,Be=!1)=>{const Pe=Qe(r,ee);let qe=ie;if(Pe){const Ke=Pe._f;Ke&&(!Ke.disabled&&Cn(i,ee,Mz(ie,Ke)),qe=ny(Ke.ref)&&Or(ie)?"":ie,jz(Ke.ref)?[...Ke.ref.options].forEach(nt=>nt.selected=qe.includes(nt.value)):Ke.refs?Xh(Ke.ref)?Ke.refs.forEach(nt=>{(!nt.defaultChecked||!nt.disabled)&&(Array.isArray(qe)?nt.checked=!!qe.find(it=>it===nt.value):nt.checked=qe===nt.value||!!qe)}):Ke.refs.forEach(nt=>nt.checked=nt.value===qe):bx(Ke.ref)?Ke.ref.value="":(Ke.ref.value=qe,!Ke.ref.type&&!ve&&!Be&&w.state.next({name:ee,values:Ce?i:Jn(i)})))}(le.shouldDirty||le.shouldTouch)&&G(ee,qe,le.shouldTouch,le.shouldDirty,!ve),le.shouldValidate&&je(ee,{delayError:le.delayError})},X=(ee,ie,le,Ce=!1,ve=!1,Be=!1)=>{c.array.has(ee)&&w.array.next({name:ee,values:Ce?i:Jn(i)});for(const Pe in ie){if(!ie.hasOwnProperty(Pe))return;const qe=ie[Pe],Ke=ee+"."+Pe,nt=Qe(r,Ke);(c.array.has(ee)||nr(qe)||nt&&!nt._f)&&!Hs(qe)?X(Ke,qe,le,Ce,ve,Be):B(Ke,qe,le,Ce,ve,Be)}},J=(ee,ie,le,Ce,ve=!1)=>{const Be=Qe(r,ee),Pe=c.array.has(ee),qe=Ce?ie:Jn(ie),Ke=Qe(i,ee),nt=So(Ke,qe);if(nt||Cn(i,ee,qe),Pe)w.array.next({name:ee,values:Ce?i:Jn(i)}),(v.isDirty||v.dirtyFields||S.isDirty||S.dirtyFields)&&le.shouldDirty&&(R(),ve||w.state.next({name:ee,dirtyFields:n.dirtyFields,isDirty:D(ee,qe)}));else{const it=Array.isArray(qe)&&!qe.length||Hr(qe),jt=!nt&&!ve;!Be||Be._f||Or(qe)||it?B(ee,qe,le,Ce,ve,jt):X(ee,qe,le,Ce,ve,jt)}if(!nt&&!ve){const it=R0(ee,c),jt=Ce?i:Jn(i);w.state.next({...it&&n,name:s.mount||it?ee:void 0,values:jt})}},Q=(ee,ie,le={})=>J(ee,ie,le,!1),oe=(ee,ie={})=>{const le=eo(ee)?ee(i):ee;if(!So(i,le)){i={...i,...le};const Ce=Cz(le);for(const ve of c.mount)ve in Ce&&J(ve,Ce[ve],ie,!0,!0);w.state.next({...n,name:void 0,type:void 0,...p?{values:i}:{}}),ie.shouldValidate&&N()}},W=async ee=>{s.mount=!0;const ie=ee.target;let le=ie.name,Ce=!0;const ve=Qe(r,le),Be=Pe=>{Ce=Number.isNaN(Pe)||Hs(Pe)&&isNaN(Pe.getTime())||So(Pe,Qe(i,le,Pe))};if(ve){let Pe,qe;const Ke=ie.type?sM(ve._f):iS(ee),nt=ee.type===Va.BLUR||ee.type===Va.FOCUS_OUT,it=!GW(ve._f)&&!e.validate&&!t.resolver&&!Qe(n.errors,le)&&!ve._f.deps,jt=it||QW(nt,Qe(n.touchedFields,le),n.isSubmitted,g,m),Ut=R0(le,c,nt);if(Cn(i,le,Ke),nt){if(!ie||!ie.readOnly){ve._f.onBlur&&ve._f.onBlur(ee);const Rt=d[le];Rt&&Rt(0)}}else ve._f.onChange&&ve._f.onChange(ee);const qt=G(le,Ke,nt),at=!Hr(qt)||Ut;if(!nt&&w.state.next({name:le,type:ee.type,...p?{values:Jn(i)}:{}}),jt)return(!it||!n.isValid)&&(v.isValid||S.isValid)&&(t.mode==="onBlur"?nt&&N():nt||N()),at&&w.state.next({name:le,...Ut?{}:qt});if(!t.resolver&&e.validate&&await I({name:le,eventType:ee.type}),!nt&&Ut&&w.state.next({...n}),t.resolver){const{errors:Rt}=await F([le]);if(A([le]),Be(Ke),!Ce){!Hr(qt)&&w.state.next(qt);return}const Gt=lM(n.errors,r,le),Nt=lM(Rt,r,Gt.name||le);Pe=Nt.error,le=Nt.name,qe=Hr(Rt)}else A([le],!0),Pe=(await rM(ve,c.disabled,i,k,t.shouldUseNativeValidation))[le],A([le]),Be(Ke),Ce&&(Pe?qe=!1:(v.isValid||S.isValid)&&(qe=await Y({fields:r,onlyCheckValid:!0,name:le,eventType:ee.type})));Ce&&(ve._f.deps&&(!Array.isArray(ve._f.deps)||ve._f.deps.length>0)&&je(ve._f.deps),L(le,qe,Pe,qt))}},ne=(ee,ie)=>{if(Qe(n.errors,ie)&&ee.focus)return ee.focus(),1},je=async(ee,ie={})=>{let le,Ce;const ve=wg(ee);if(t.resolver){const Be=await P(Zn(ee)?ee:ve);le=Hr(Be),Ce=ee?!ve.some(Pe=>Qe(Be,Pe)):le}else ee?(Ce=(await Promise.all(ve.map(async Be=>{const Pe=Qe(r,Be);return await Y({fields:Pe&&Pe._f?{[Be]:Pe}:Pe,eventType:Va.TRIGGER})}))).every(Boolean),!(!Ce&&!n.isValid)&&N()):Ce=le=await Y({fields:r,name:ee,eventType:Va.TRIGGER});if(ie.delayError&&t.delayError&&Ur(ee)){const Be=Qe(n.errors,ee);Be?(fr(n.errors,ee),d[ee]=j(ee,()=>T(ee,Be)),d[ee](t.delayError)):(clearTimeout(u[ee]),delete d[ee])}return w.state.next({...!Ur(ee)||(v.isValid||S.isValid)&&le!==n.isValid?{}:{name:ee},...t.resolver||!ee?{isValid:le}:{},errors:n.errors}),ie.shouldFocus&&!Ce&&Vf(r,ne,ee?ve:c.mount),Ce},Ee=(ee,ie)=>{let le={...s.mount?i:o};return ie&&(le=kz(ie.dirtyFields?n.dirtyFields:n.touchedFields,le)),Zn(ee)?le:Ur(ee)?Qe(le,ee):ee.map(Ce=>Qe(le,Ce))},pe=(ee,ie)=>({invalid:!!Qe((ie||n).errors,ee),isDirty:!!Qe((ie||n).dirtyFields,ee),error:Qe((ie||n).errors,ee),isValidating:!!Qe(n.validatingFields,ee),isTouched:!!Qe((ie||n).touchedFields,ee)}),re=ee=>{const ie=ee?wg(ee):void 0;ie?.forEach(le=>fr(n.errors,le)),ie?ie.forEach(le=>{w.state.next({name:le,errors:n.errors})}):(n.errors={},w.state.next({errors:n.errors}))},ge=(ee,ie,le)=>{const Ce=(Qe(r,ee,{_f:{}})._f||{}).ref,ve=Qe(n.errors,ee)||{},{ref:Be,message:Pe,type:qe,...Ke}=ve;Cn(n.errors,ee,{...Ke,...ie,ref:Ce}),w.state.next({name:ee,errors:n.errors,isValid:!1}),le&&le.shouldFocus&&Ce&&Ce.focus&&Ce.focus()},_e=(ee,ie)=>{if(eo(ee)){p++;const{unsubscribe:le}=w.state.subscribe({next:ve=>"values"in ve&&ee(ve.values||H(void 0,ie),ve)});let Ce=!1;return{unsubscribe:()=>{Ce||(Ce=!0,p--,le())}}}return H(ee,ie,!0)},De=ee=>{var ie;const le=!!(!((ie=ee.formState)===null||ie===void 0)&&ie.values);le&&p++;const{unsubscribe:Ce}=w.state.subscribe({next:Be=>{if(XW(ee.name,Be.name,ee.exact)&&KW(Be,ee.formState||v,Se,ee.reRenderRoot)){const Pe={...i};ee.callback({values:Pe,...n,...Be,defaultValues:o})}}});if(!le)return Ce;let ve=!1;return()=>{ve||(ve=!0,p--,Ce())}},we=ee=>(s.mount=!0,S={...S,...ee.formState},De({...ee,formState:{...y,...ee.formState}})),$e=(ee,ie={})=>{for(const le of ee?wg(ee):c.mount)c.mount.delete(le),c.array.delete(le),ie.keepValue||(fr(r,le),fr(i,le)),!ie.keepError&&fr(n.errors,le),!ie.keepDirty&&fr(n.dirtyFields,le),!ie.keepTouched&&fr(n.touchedFields,le),!ie.keepIsValidating&&fr(n.validatingFields,le),!t.shouldUnregister&&!ie.keepDefaultValue&&fr(o,le);w.state.next({values:Jn(i)}),w.state.next({...n,...ie.keepDirty?{isDirty:D()}:{}}),!ie.keepIsValid&&N()},Me=({disabled:ee,name:ie})=>{if(qo(ee)&&s.mount||ee||c.disabled.has(ie)){const ve=c.disabled.has(ie)!==!!ee;ee?c.disabled.add(ie):c.disabled.delete(ie),ve&&s.mount&&!s.action&&N()}},Le=(ee,ie={})=>{let le=Qe(r,ee);const Ce=qo(ie.disabled)||qo(t.disabled),ve=!c.registerName.has(ee)&&le&&le._f&&!le._f.mount;return Cn(r,ee,{...le||{},_f:{...le&&le._f?le._f:{ref:{name:ee}},name:ee,mount:!0,...ie}}),c.mount.add(ee),le&&!ve?Me({disabled:qo(ie.disabled)?ie.disabled:t.disabled,name:ee}):$(ee,!0,ie.value),{...Ce?{disabled:ie.disabled||t.disabled}:{},...t.progressive?{required:!!ie.required,min:hf(ie.min),max:hf(ie.max),minLength:hf(ie.minLength),maxLength:hf(ie.maxLength),pattern:hf(ie.pattern)}:{},name:ee,onChange:W,onBlur:W,ref:Be=>{if(Be){c.registerName.add(ee),Le(ee,ie),c.registerName.delete(ee),le=Qe(r,ee);const Pe=Zn(Be.value)&&Be.querySelectorAll&&Be.querySelectorAll("input,select,textarea")[0]||Be,qe=UW(Pe),Ke=le._f.refs||[];if(qe?Ke.find(it=>it===Pe):Pe===le._f.ref)return;const nt={...le._f};qe?(nt.refs=[...Ke.filter(_0),Pe,...Array.isArray(Qe(o,ee))?[{}]:[]],nt.ref={type:Pe.type,name:ee}):(nt.ref=Pe,delete nt.refs),Cn(r,ee,{_f:nt}),$(ee,!1,void 0,Pe)}else le=Qe(r,ee,{}),le._f&&(le._f.mount=!1),(t.shouldUnregister||ie.shouldUnregister)&&!(yz(c.array,ee)&&s.action)&&c.unMount.add(ee)}}},He=()=>t.shouldFocusError&&!t.shouldUseNativeValidation&&Vf(r,ne,c.mount),Ge=ee=>{qo(ee)&&(w.state.next({disabled:ee}),Vf(r,(ie,le)=>{const Ce=Qe(r,le);Ce&&(ie.disabled=Ce._f.disabled||ee,Array.isArray(Ce._f.refs)&&Ce._f.refs.forEach(ve=>{ve.disabled=Ce._f.disabled||ee}))},0,!1))},ot=(ee,ie)=>async le=>{let Ce,ve;le&&(le.preventDefault&&le.preventDefault(),le.persist&&le.persist());let Be=Jn(i);if(w.state.next({isSubmitting:!0}),t.resolver){const{errors:Pe,values:qe}=await F();A(),n.errors=Pe,Be=Jn(qe)}else await Y({fields:r,eventType:Va.SUBMIT});if(c.disabled.size)for(const Pe of c.disabled)fr(Be,Pe);if(fr(n.errors,vz),Hr(n.errors)){w.state.next({errors:{}});try{Ce=await ee(Be,le)}catch(Pe){ve=Pe}}else ie&&await ie({...n.errors},le),He(),setTimeout(He);if(w.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:Hr(n.errors)&&!ve,submitCount:n.submitCount+1,errors:n.errors}),ve)throw ve;return Ce},me=(ee,ie={})=>{Qe(r,ee)&&(Zn(ie.defaultValue)?Q(ee,Jn(Qe(o,ee))):(Q(ee,ie.defaultValue),Cn(o,ee,Jn(ie.defaultValue))),ie.keepTouched||fr(n.touchedFields,ee),ie.keepDirty||(fr(n.dirtyFields,ee),n.isDirty=ie.defaultValue?D(ee,Jn(Qe(o,ee))):D()),ie.keepError||(fr(n.errors,ee),v.isValid&&N()),w.state.next({...n}))},ke=(ee,ie={})=>{const le=ee?Jn(ee):o,Ce=Jn(le),ve=Hr(ee),Be=Ce,Pe=r;if(ie.keepDefaultValues||(o=le),!ie.keepValues){if(ie.keepDirtyValues){const qe=new Set([...c.mount,...Rz(Il(o,i,void 0,Pe),n.dirtyFields)]);for(const Ke of Array.from(qe)){const nt=Qe(n.dirtyFields,Ke),it=Qe(i,Ke),jt=Qe(Be,Ke);nt&&!Zn(it)?Cn(Be,Ke,it):!nt&&!Zn(jt)&&Q(Ke,jt)}}else{if(wx&&Zn(ee))for(const qe of c.mount){const Ke=Qe(r,qe);if(Ke&&Ke._f){const nt=Array.isArray(Ke._f.refs)?Ke._f.refs[0]:Ke._f.ref;if(ny(nt)){const it=nt.closest("form");if(it){it.reset();break}}}}if(ie.keepFieldsRef)for(const qe of c.mount)Q(qe,Qe(Be,qe));else r={}}if(t.shouldUnregister){if(i=ie.keepDefaultValues?Jn(o):{},ie.keepFieldsRef)for(const qe of c.mount)Cn(i,qe,Qe(Be,qe))}else i=Jn(Be);w.array.next({values:{...Be}}),w.state.next({name:void 0,type:void 0,values:{...Be}})}c={mount:ie.keepDirtyValues?c.mount:new Set,unMount:new Set,array:new Set,registerName:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},s.mount=!v.isValid||!!ie.keepIsValid||!!ie.keepDirtyValues||!t.shouldUnregister&&!Hr(Be),s.watch=!!t.shouldUnregister,s.keepIsValid=!!ie.keepIsValid,s.action=!1,s.actionArrayLengths.clear(),ie.keepErrors||(n.errors={}),w.state.next({submitCount:ie.keepSubmitCount?n.submitCount:0,isDirty:ve?!1:ie.keepDirty?n.isDirty:ie.keepValues?D():!!(ie.keepDefaultValues&&!So(ee,o)),isSubmitted:ie.keepIsSubmitted?n.isSubmitted:!1,dirtyFields:ve?{}:ie.keepDirtyValues?ie.keepDefaultValues&&i?Il(o,i,void 0,Pe):n.dirtyFields:ie.keepDefaultValues&&ee?Il(o,ee,void 0,Pe):ie.keepDirty?n.dirtyFields:{},touchedFields:ie.keepTouched?n.touchedFields:{},errors:ie.keepErrors?n.errors:{},isSubmitSuccessful:ie.keepIsSubmitSuccessful?n.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:o})},de=(ee,ie)=>ke(eo(ee)?ee(i):ee,{...t.resetOptions,...ie}),ue=(ee,ie={})=>{const le=Qe(r,ee),Ce=le&&le._f;if(Ce){const ve=Ce.refs?Ce.refs[0]:Ce.ref;ve.focus&&setTimeout(()=>{ve.focus(),ie.shouldSelect&&eo(ve.select)&&ve.select()})}},Se=ee=>{const{name:ie,type:le,values:Ce,...ve}=ee;n={...n,...ve}};w.state.subscribe({next:Se});const kt={control:{register:Le,unregister:$e,getFieldState:pe,handleSubmit:ot,setError:ge,_subscribe:De,_runSchema:F,_updateIsValidating:A,_focusError:He,_getWatch:H,_getDirty:D,_setValid:N,_setFieldArray:M,_setDisabledField:Me,_setErrors:O,_getFieldArray:U,_reset:ke,_resetDefaultValues:()=>eo(t.defaultValues)&&t.defaultValues().then(ee=>{de(ee,t.resetOptions),w.state.next({isLoading:!1})}),_removeUnmounted:Z,_disableForm:Ge,_subjects:w,_proxyFormState:v,get _fields(){return r},get _formValues(){return i},get _state(){return s},set _state(ee){s=ee},get _defaultValues(){return o},get _names(){return c},set _names(ee){c=ee},get _formState(){return n},get _options(){return t},set _options(ee){t={...t,...ee},m=Vm(t.mode),g=Vm(t.reValidateMode)}},subscribe:we,trigger:je,register:Le,handleSubmit:ot,watch:_e,setValue:Q,setValues:oe,getValues:Ee,reset:de,resetField:me,resetDefaultValues:(ee,ie={})=>{if(o=Jn(ee),!ie.keepDirty){const le=Il(o,i,void 0,r);n.dirtyFields=le,n.isDirty=!Hr(le)}ie.keepIsValid||N(),w.state.next({...n,defaultValues:o})},clearErrors:re,unregister:$e,setError:ge,setFocus:ue,getFieldState:pe};return{...kt,formControl:kt}}function ra(e={}){const t=Ne.useRef(void 0),n=Ne.useRef(void 0),r=Ne.useRef(e.formControl),[o,i]=Ne.useState(()=>({...Jn(Az),isLoading:eo(e.defaultValues),errors:e.errors||{},disabled:e.disabled||!1,defaultValues:eo(e.defaultValues)?void 0:e.defaultValues}));if(!t.current||e.formControl&&r.current!==e.formControl)if(r.current=e.formControl,e.formControl)t.current={...e.formControl,formState:o},e.defaultValues&&!eo(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:u,...p}=tJ(e);t.current={...p,formState:o}}const s=t.current.control;s._options=e;const{resyncIfNeeded:c,snapshot:d}=_1();return R1(()=>{const u=()=>({...s._formState,defaultValues:s._defaultValues});c(!0,u,i);const p=s._subscribe({formState:s._proxyFormState,callback:()=>i({...s._formState,defaultValues:s._defaultValues}),reRenderRoot:!0});return i(m=>({...m,isReady:!0})),s._formState.isReady=!0,()=>{p(),d(!0,u)}},[s,c,d]),Ne.useEffect(()=>s._disableForm(e.disabled),[s,e.disabled]),Ne.useEffect(()=>{e.mode&&(s._options.mode=e.mode),e.reValidateMode&&(s._options.reValidateMode=e.reValidateMode)},[s,e.mode,e.reValidateMode]),Ne.useEffect(()=>{e.errors&&(s._setErrors(e.errors),s._focusError())},[s,e.errors]),Ne.useEffect(()=>{e.shouldUnregister&&s._subjects.state.next({values:s._getWatch()})},[s,e.shouldUnregister]),Ne.useEffect(()=>{if(s._proxyFormState.isDirty){const u=s._getDirty();u!==o.isDirty&&s._subjects.state.next({isDirty:u})}},[s,o.isDirty]),Ne.useEffect(()=>{var u;e.values&&!So(e.values,n.current)?(s._reset(e.values,{keepFieldsRef:!0,...s._options.resetOptions}),!((u=s._options.resetOptions)===null||u===void 0)&&u.keepIsValid||s._setValid(),n.current=e.values,i(p=>({...p}))):s._resetDefaultValues()},[s,e.values]),Ne.useEffect(()=>{s._state.mount||(s._setValid(),s._state.mount=!0),s._state.watch&&(s._state.watch=!1,s._subjects.state.next({...s._formState})),s._removeUnmounted()}),t.current.formState=Ne.useMemo(()=>bz(o,s),[s,o]),t.current}const cM=(e,t,n)=>{if(e&&"reportValidity"in e){const r=Qe(n,t);e.setCustomValidity(r&&r.message||""),e.reportValidity()}},uS=(e,t)=>{for(const n in t.fields){const r=t.fields[n];r&&r.ref&&"reportValidity"in r.ref?cM(r.ref,n,e):r&&r.refs&&r.refs.forEach(o=>cM(o,n,e))}},uM=(e,t)=>{t.shouldUseNativeValidation&&uS(e,t);const n={};for(const r in e){const o=Qe(t.fields,r),i=Object.assign(e[r]||{},{ref:o&&o.refs?o.refs[0]:o&&o.ref});if(nJ(t.names||Object.keys(e),r)){const s=Object.assign({},Qe(n,r));Cn(s,"root",i),Cn(n,r,s)}else Cn(n,r,i)}return n},nJ=(e,t)=>{const n=dM(t).replace(/[.*+?^${}()|\\]/g,"\\$&");return e.some(r=>dM(r).match(`^${n}\\.\\d+`))};function dM(e){return e.replace(/[\[\]]/g,"")}function dS(){return dS=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},dS.apply(null,arguments)}function fM(e,t){try{var n=e()}catch(r){return t(r)}return n&&n.then?n.then(void 0,t):n}function rJ(e,t){for(var n=Object.create(null);e.length;){var r=e[0],o=r.code,i=r.message,s=r.path.join(".");if(!n[s])if("unionErrors"in r){var c,d,u=r.unionErrors.reduce(function(g,y){return y.errors.length<g.errors.length?y:g}).errors[0];n[s]={message:(c=u?.message)!=null?c:i,type:(d=u?.code)!=null?d:o}}else n[s]={message:i,type:o};if("unionErrors"in r&&r.unionErrors.forEach(function(g){return g.errors.forEach(function(y){return e.push(y)})}),t){var p=n[s].types,m=p&&p[r.code];n[s]=T1(s,t,n,o,m?[].concat(m,r.message):r.message)}e.shift()}return n}function oJ(e,t){for(var n=Object.create(null),r=function(){var o=e[0],i=o.code,s=o.message,c=o.path.join(".");if(!n[c])if(o.code==="invalid_union"&&o.errors.length>0){var d,u,p=o.errors.reduce(function(y,v){return v.length<y.length?v:y})[0];n[c]={message:(d=p?.message)!=null?d:s,type:(u=p?.code)!=null?u:i}}else n[c]={message:s,type:i};if(o.code==="invalid_union"&&o.errors.forEach(function(y){return y.forEach(function(v){return e.push(dS({},v,{path:[].concat(o.path,v.path)}))})}),t){var m=n[c].types,g=m&&m[o.code];n[c]=T1(c,t,n,i,g?[].concat(g,o.message):o.message)}e.shift()};e.length;)r();return n}function oa(e,t,n){if(n===void 0&&(n={}),(function(r){return"_zod"in r&&typeof r._zod=="object"})(e))return function(r,o,i){try{return Promise.resolve(fM(function(){function s(d){return i.shouldUseNativeValidation&&uS({},i),{errors:{},values:n.raw?Object.assign({},r):d}}var c=e;return n.mode==="sync"?s(c.parse(r,t)):Promise.resolve(c.parseAsync(r,t)).then(s)},function(s){if((function(c){var d;return!(c==null||(d=c._zod)==null||(d=d.traits)==null||!d.has("$ZodError"))})(s))return{values:{},errors:uM(oJ(s.issues,!i.shouldUseNativeValidation&&i.criteriaMode==="all"),i)};throw s}))}catch(s){return Promise.reject(s)}};if((function(r){return"_def"in r&&typeof r._def=="object"})(e))return function(r,o,i){try{return Promise.resolve(fM(function(){return Promise.resolve(e[n.mode==="sync"?"parse":"parseAsync"](r,t)).then(function(s){return i.shouldUseNativeValidation&&uS({},i),{errors:{},values:n.raw?Object.assign({},r):s}})},function(s){if((function(c){return Array.isArray(c?.issues)})(s))return{values:{},errors:uM(rJ(s.errors,!i.shouldUseNativeValidation&&i.criteriaMode==="all"),i)};throw s}))}catch(s){return Promise.reject(s)}};throw new Error("Invalid input: not a Zod schema")}var hM;function Ve(e,t,n){function r(c,d){if(c._zod||Object.defineProperty(c,"_zod",{value:{def:d,constr:s,traits:new Set},enumerable:!1}),c._zod.traits.has(e))return;c._zod.traits.add(e),t(c,d);const u=s.prototype,p=Object.keys(u);for(let m=0;m<p.length;m++){const g=p[m];g in c||(c[g]=u[g].bind(c))}}const o=n?.Parent??Object;class i extends o{}Object.defineProperty(i,"name",{value:e});function s(c){var d;const u=n?.Parent?new i:this;r(u,c),(d=u._zod).deferred??(d.deferred=[]);for(const p of u._zod.deferred)p();return u}return Object.defineProperty(s,"init",{value:r}),Object.defineProperty(s,Symbol.hasInstance,{value:c=>n?.Parent&&c instanceof n.Parent?!0:c?._zod?.traits?.has(e)}),Object.defineProperty(s,"name",{value:e}),s}class _u extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Oz extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}(hM=globalThis).__zod_globalConfig??(hM.__zod_globalConfig={});const A1=globalThis.__zod_globalConfig;function tc(e){return A1}function Dz(e){const t=Object.values(e).filter(r=>typeof r=="number");return Object.entries(e).filter(([r,o])=>t.indexOf(+r)===-1).map(([r,o])=>o)}function fS(e,t){return typeof t=="bigint"?t.toString():t}function O1(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function D1(e){return e==null}function P1(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}const pM=Symbol("evaluating");function Pn(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==pM)return r===void 0&&(r=pM,r=n()),r},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function vc(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function ul(...e){const t={};for(const n of e){const r=Object.getOwnPropertyDescriptors(n);Object.assign(t,r)}return Object.defineProperties({},t)}function mM(e){return JSON.stringify(e)}function iJ(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const Pz="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function oy(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const sJ=O1(()=>{if(A1.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function rh(e){if(oy(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const n=t.prototype;return!(oy(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function Iz(e){return rh(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}const aJ=new Set(["string","number","symbol"]);function Sx(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function dl(e,t,n){const r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function Mt(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function lJ(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}function cJ(e,t){const n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const i=ul(e._zod.def,{get shape(){const s={};for(const c in t){if(!(c in n.shape))throw new Error(`Unrecognized key: "${c}"`);t[c]&&(s[c]=n.shape[c])}return vc(this,"shape",s),s},checks:[]});return dl(e,i)}function uJ(e,t){const n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const i=ul(e._zod.def,{get shape(){const s={...e._zod.def.shape};for(const c in t){if(!(c in n.shape))throw new Error(`Unrecognized key: "${c}"`);t[c]&&delete s[c]}return vc(this,"shape",s),s},checks:[]});return dl(e,i)}function dJ(e,t){if(!rh(t))throw new Error("Invalid input to extend: expected a plain object");const n=e._zod.def.checks;if(n&&n.length>0){const i=e._zod.def.shape;for(const s in t)if(Object.getOwnPropertyDescriptor(i,s)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const o=ul(e._zod.def,{get shape(){const i={...e._zod.def.shape,...t};return vc(this,"shape",i),i}});return dl(e,o)}function fJ(e,t){if(!rh(t))throw new Error("Invalid input to safeExtend: expected a plain object");const n=ul(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t};return vc(this,"shape",r),r}});return dl(e,n)}function hJ(e,t){if(e._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");const n=ul(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t._zod.def.shape};return vc(this,"shape",r),r},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return dl(e,n)}function pJ(e,t,n){const o=t._zod.def.checks;if(o&&o.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const s=ul(t._zod.def,{get shape(){const c=t._zod.def.shape,d={...c};if(n)for(const u in n){if(!(u in c))throw new Error(`Unrecognized key: "${u}"`);n[u]&&(d[u]=e?new e({type:"optional",innerType:c[u]}):c[u])}else for(const u in c)d[u]=e?new e({type:"optional",innerType:c[u]}):c[u];return vc(this,"shape",d),d},checks:[]});return dl(t,s)}function mJ(e,t,n){const r=ul(t._zod.def,{get shape(){const o=t._zod.def.shape,i={...o};if(n)for(const s in n){if(!(s in i))throw new Error(`Unrecognized key: "${s}"`);n[s]&&(i[s]=new e({type:"nonoptional",innerType:o[s]}))}else for(const s in o)i[s]=new e({type:"nonoptional",innerType:o[s]});return vc(this,"shape",i),i}});return dl(t,r)}function wu(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function gJ(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function zz(e,t){return t.map(n=>{var r;return(r=n).path??(r.path=[]),n.path.unshift(e),n})}function Bm(e){return typeof e=="string"?e:e?.message}function nc(e,t,n){const r=e.message?e.message:Bm(e.inst?._zod.def?.error?.(e))??Bm(t?.error?.(e))??Bm(n.customError?.(e))??Bm(n.localeError?.(e))??"Invalid input",{inst:o,continue:i,input:s,...c}=e;return c.path??(c.path=[]),c.message=r,t?.reportInput&&(c.input=s),c}function I1(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function oh(...e){const[t,n,r]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:r}:{...t}}const Lz=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,fS,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Fz=Ve("$ZodError",Lz),$z=Ve("$ZodError",Lz,{Parent:Error});function yJ(e,t=n=>n.message){const n={},r=[];for(const o of e.issues)o.path.length>0?(n[o.path[0]]=n[o.path[0]]||[],n[o.path[0]].push(t(o))):r.push(t(o));return{formErrors:r,fieldErrors:n}}function xJ(e,t=n=>n.message){const n={_errors:[]},r=(o,i=[])=>{for(const s of o.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map(c=>r({issues:c},[...i,...s.path]));else if(s.code==="invalid_key")r({issues:s.issues},[...i,...s.path]);else if(s.code==="invalid_element")r({issues:s.issues},[...i,...s.path]);else{const c=[...i,...s.path];if(c.length===0)n._errors.push(t(s));else{let d=n,u=0;for(;u<c.length;){const p=c[u];u===c.length-1?(d[p]=d[p]||{_errors:[]},d[p]._errors.push(t(s))):d[p]=d[p]||{_errors:[]},d=d[p],u++}}}};return r(e),n}const z1=e=>(t,n,r,o)=>{const i=r?{...r,async:!1}:{async:!1},s=t._zod.run({value:n,issues:[]},i);if(s instanceof Promise)throw new _u;if(s.issues.length){const c=new(o?.Err??e)(s.issues.map(d=>nc(d,i,tc())));throw Pz(c,o?.callee),c}return s.value},L1=e=>async(t,n,r,o)=>{const i=r?{...r,async:!0}:{async:!0};let s=t._zod.run({value:n,issues:[]},i);if(s instanceof Promise&&(s=await s),s.issues.length){const c=new(o?.Err??e)(s.issues.map(d=>nc(d,i,tc())));throw Pz(c,o?.callee),c}return s.value},Ex=e=>(t,n,r)=>{const o=r?{...r,async:!1}:{async:!1},i=t._zod.run({value:n,issues:[]},o);if(i instanceof Promise)throw new _u;return i.issues.length?{success:!1,error:new(e??Fz)(i.issues.map(s=>nc(s,o,tc())))}:{success:!0,data:i.value}},vJ=Ex($z),Cx=e=>async(t,n,r)=>{const o=r?{...r,async:!0}:{async:!0};let i=t._zod.run({value:n,issues:[]},o);return i instanceof Promise&&(i=await i),i.issues.length?{success:!1,error:new e(i.issues.map(s=>nc(s,o,tc())))}:{success:!0,data:i.value}},bJ=Cx($z),wJ=e=>(t,n,r)=>{const o=r?{...r,direction:"backward"}:{direction:"backward"};return z1(e)(t,n,o)},SJ=e=>(t,n,r)=>z1(e)(t,n,r),EJ=e=>async(t,n,r)=>{const o=r?{...r,direction:"backward"}:{direction:"backward"};return L1(e)(t,n,o)},CJ=e=>async(t,n,r)=>L1(e)(t,n,r),kJ=e=>(t,n,r)=>{const o=r?{...r,direction:"backward"}:{direction:"backward"};return Ex(e)(t,n,o)},jJ=e=>(t,n,r)=>Ex(e)(t,n,r),RJ=e=>async(t,n,r)=>{const o=r?{...r,direction:"backward"}:{direction:"backward"};return Cx(e)(t,n,o)},_J=e=>async(t,n,r)=>Cx(e)(t,n,r),NJ=/^[cC][0-9a-z]{6,}$/,TJ=/^[0-9a-z]+$/,MJ=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,AJ=/^[0-9a-vA-V]{20}$/,OJ=/^[A-Za-z0-9]{27}$/,DJ=/^[a-zA-Z0-9_-]{21}$/,PJ=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,IJ=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,gM=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,zJ=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,LJ="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function FJ(){return new RegExp(LJ,"u")}const $J=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,VJ=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,BJ=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,HJ=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,UJ=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Vz=/^[A-Za-z0-9_-]*$/,qJ=/^https?$/,YJ=/^\+[1-9]\d{6,14}$/,Bz="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",ZJ=new RegExp(`^${Bz}$`);function Hz(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function GJ(e){return new RegExp(`^${Hz(e)}$`)}function KJ(e){const t=Hz({precision:e.precision}),n=["Z"];e.local&&n.push(""),e.offset&&n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const r=`${t}(?:${n.join("|")})`;return new RegExp(`^${Bz}T(?:${r})$`)}const XJ=e=>{const t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},QJ=/^[^A-Z]*$/,WJ=/^[^a-z]*$/,gs=Ve("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),JJ=Ve("$ZodCheckMaxLength",(e,t)=>{var n;gs.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!D1(o)&&o.length!==void 0}),e._zod.onattach.push(r=>{const o=r._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<o&&(r._zod.bag.maximum=t.maximum)}),e._zod.check=r=>{const o=r.value;if(o.length<=t.maximum)return;const s=I1(o);r.issues.push({origin:s,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),eee=Ve("$ZodCheckMinLength",(e,t)=>{var n;gs.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!D1(o)&&o.length!==void 0}),e._zod.onattach.push(r=>{const o=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>o&&(r._zod.bag.minimum=t.minimum)}),e._zod.check=r=>{const o=r.value;if(o.length>=t.minimum)return;const s=I1(o);r.issues.push({origin:s,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),tee=Ve("$ZodCheckLengthEquals",(e,t)=>{var n;gs.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!D1(o)&&o.length!==void 0}),e._zod.onattach.push(r=>{const o=r._zod.bag;o.minimum=t.length,o.maximum=t.length,o.length=t.length}),e._zod.check=r=>{const o=r.value,i=o.length;if(i===t.length)return;const s=I1(o),c=i>t.length;r.issues.push({origin:s,...c?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),kx=Ve("$ZodCheckStringFormat",(e,t)=>{var n,r;gs.init(e,t),e._zod.onattach.push(o=>{const i=o._zod.bag;i.format=t.format,t.pattern&&(i.patterns??(i.patterns=new Set),i.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=o=>{t.pattern.lastIndex=0,!t.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),nee=Ve("$ZodCheckRegex",(e,t)=>{kx.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),ree=Ve("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=QJ),kx.init(e,t)}),oee=Ve("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=WJ),kx.init(e,t)}),iee=Ve("$ZodCheckIncludes",(e,t)=>{gs.init(e,t);const n=Sx(t.includes),r=new RegExp(typeof t.position=="number"?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(o=>{const i=o._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(r)}),e._zod.check=o=>{o.value.includes(t.includes,t.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),see=Ve("$ZodCheckStartsWith",(e,t)=>{gs.init(e,t);const n=new RegExp(`^${Sx(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push(r=>{const o=r._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),e._zod.check=r=>{r.value.startsWith(t.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:r.value,inst:e,continue:!t.abort})}}),aee=Ve("$ZodCheckEndsWith",(e,t)=>{gs.init(e,t);const n=new RegExp(`.*${Sx(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push(r=>{const o=r._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),e._zod.check=r=>{r.value.endsWith(t.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:r.value,inst:e,continue:!t.abort})}}),lee=Ve("$ZodCheckOverwrite",(e,t)=>{gs.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class cee{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const r=t.split(`
13
+ `).filter(s=>s),o=Math.min(...r.map(s=>s.length-s.trimStart().length)),i=r.map(s=>s.slice(o)).map(s=>" ".repeat(this.indent*2)+s);for(const s of i)this.content.push(s)}compile(){const t=Function,n=this?.args,o=[...(this?.content??[""]).map(i=>` ${i}`)];return new t(...n,o.join(`
14
+ `))}}const uee={major:4,minor:4,patch:3},Nr=Ve("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=uee;const r=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&r.unshift(e);for(const o of r)for(const i of o._zod.onattach)i(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const o=(s,c,d)=>{let u=wu(s),p;for(const m of c){if(m._zod.def.when){if(gJ(s)||!m._zod.def.when(s))continue}else if(u)continue;const g=s.issues.length,y=m._zod.check(s);if(y instanceof Promise&&d?.async===!1)throw new _u;if(p||y instanceof Promise)p=(p??Promise.resolve()).then(async()=>{await y,s.issues.length!==g&&(u||(u=wu(s,g)))});else{if(s.issues.length===g)continue;u||(u=wu(s,g))}}return p?p.then(()=>s):s},i=(s,c,d)=>{if(wu(s))return s.aborted=!0,s;const u=o(c,r,d);if(u instanceof Promise){if(d.async===!1)throw new _u;return u.then(p=>e._zod.parse(p,d))}return e._zod.parse(u,d)};e._zod.run=(s,c)=>{if(c.skipChecks)return e._zod.parse(s,c);if(c.direction==="backward"){const u=e._zod.parse({value:s.value,issues:[]},{...c,skipChecks:!0});return u instanceof Promise?u.then(p=>i(p,s,c)):i(u,s,c)}const d=e._zod.parse(s,c);if(d instanceof Promise){if(c.async===!1)throw new _u;return d.then(u=>o(u,r,c))}return o(d,r,c)}}Pn(e,"~standard",()=>({validate:o=>{try{const i=vJ(e,o);return i.success?{value:i.data}:{issues:i.error?.issues}}catch{return bJ(e,o).then(s=>s.success?{value:s.data}:{issues:s.error?.issues})}},vendor:"zod",version:1}))}),F1=Ve("$ZodString",(e,t)=>{Nr.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??XJ(e._zod.bag),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value=="string"||n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}}),er=Ve("$ZodStringFormat",(e,t)=>{kx.init(e,t),F1.init(e,t)}),dee=Ve("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=IJ),er.init(e,t)}),fee=Ve("$ZodUUID",(e,t)=>{if(t.version){const r={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(r===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=gM(r))}else t.pattern??(t.pattern=gM());er.init(e,t)}),hee=Ve("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=zJ),er.init(e,t)}),pee=Ve("$ZodURL",(e,t)=>{er.init(e,t),e._zod.check=n=>{try{const r=n.value.trim();if(!t.normalize&&t.protocol?.source===qJ.source&&!/^https?:\/\//i.test(r)){n.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:n.value,inst:e,continue:!t.abort});return}const o=new URL(r);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(o.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=o.href:n.value=r;return}catch{n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),mee=Ve("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=FJ()),er.init(e,t)}),gee=Ve("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=DJ),er.init(e,t)}),yee=Ve("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=NJ),er.init(e,t)}),xee=Ve("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=TJ),er.init(e,t)}),vee=Ve("$ZodULID",(e,t)=>{t.pattern??(t.pattern=MJ),er.init(e,t)}),bee=Ve("$ZodXID",(e,t)=>{t.pattern??(t.pattern=AJ),er.init(e,t)}),wee=Ve("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=OJ),er.init(e,t)}),See=Ve("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=KJ(t)),er.init(e,t)}),Eee=Ve("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=ZJ),er.init(e,t)}),Cee=Ve("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=GJ(t)),er.init(e,t)}),kee=Ve("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=PJ),er.init(e,t)}),jee=Ve("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=$J),er.init(e,t),e._zod.bag.format="ipv4"}),Ree=Ve("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=VJ),er.init(e,t),e._zod.bag.format="ipv6",e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}}),_ee=Ve("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=BJ),er.init(e,t)}),Nee=Ve("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=HJ),er.init(e,t),e._zod.check=n=>{const r=n.value.split("/");try{if(r.length!==2)throw new Error;const[o,i]=r;if(!i)throw new Error;const s=Number(i);if(`${s}`!==i)throw new Error;if(s<0||s>128)throw new Error;new URL(`http://[${o}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}}});function Uz(e){if(e==="")return!0;if(/\s/.test(e)||e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const Tee=Ve("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=UJ),er.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=n=>{Uz(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});function Mee(e){if(!Vz.test(e))return!1;const t=e.replace(/[-_]/g,r=>r==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return Uz(n)}const Aee=Ve("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Vz),er.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=n=>{Mee(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),Oee=Ve("$ZodE164",(e,t)=>{t.pattern??(t.pattern=YJ),er.init(e,t)});function Dee(e,t=null){try{const n=e.split(".");if(n.length!==3)return!1;const[r]=n;if(!r)return!1;const o=JSON.parse(atob(r));return!("typ"in o&&o?.typ!=="JWT"||!o.alg||t&&(!("alg"in o)||o.alg!==t))}catch{return!1}}const Pee=Ve("$ZodJWT",(e,t)=>{er.init(e,t),e._zod.check=n=>{Dee(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),Iee=Ve("$ZodUnknown",(e,t)=>{Nr.init(e,t),e._zod.parse=n=>n}),zee=Ve("$ZodNever",(e,t)=>{Nr.init(e,t),e._zod.parse=(n,r)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)});function yM(e,t,n){e.issues.length&&t.issues.push(...zz(n,e.issues)),t.value[n]=e.value}const Lee=Ve("$ZodArray",(e,t)=>{Nr.init(e,t),e._zod.parse=(n,r)=>{const o=n.value;if(!Array.isArray(o))return n.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),n;n.value=Array(o.length);const i=[];for(let s=0;s<o.length;s++){const c=o[s],d=t.element._zod.run({value:c,issues:[]},r);d instanceof Promise?i.push(d.then(u=>yM(u,n,s))):yM(d,n,s)}return i.length?Promise.all(i).then(()=>n):n}});function iy(e,t,n,r,o,i){const s=n in r;if(e.issues.length){if(o&&i&&!s)return;t.issues.push(...zz(n,e.issues))}if(!s&&!o){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[n]});return}e.value===void 0?s&&(t.value[n]=void 0):t.value[n]=e.value}function qz(e){const t=Object.keys(e.shape);for(const r of t)if(!e.shape?.[r]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${r}": expected a Zod schema`);const n=lJ(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function Yz(e,t,n,r,o,i){const s=[],c=o.keySet,d=o.catchall._zod,u=d.def.type,p=d.optin==="optional",m=d.optout==="optional";for(const g in t){if(g==="__proto__"||c.has(g))continue;if(u==="never"){s.push(g);continue}const y=d.run({value:t[g],issues:[]},r);y instanceof Promise?e.push(y.then(v=>iy(v,n,g,t,p,m))):iy(y,n,g,t,p,m)}return s.length&&n.issues.push({code:"unrecognized_keys",keys:s,input:t,inst:i}),e.length?Promise.all(e).then(()=>n):n}const Fee=Ve("$ZodObject",(e,t)=>{if(Nr.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){const c=t.shape;Object.defineProperty(t,"shape",{get:()=>{const d={...c};return Object.defineProperty(t,"shape",{value:d}),d}})}const r=O1(()=>qz(t));Pn(e._zod,"propValues",()=>{const c=t.shape,d={};for(const u in c){const p=c[u]._zod;if(p.values){d[u]??(d[u]=new Set);for(const m of p.values)d[u].add(m)}}return d});const o=oy,i=t.catchall;let s;e._zod.parse=(c,d)=>{s??(s=r.value);const u=c.value;if(!o(u))return c.issues.push({expected:"object",code:"invalid_type",input:u,inst:e}),c;c.value={};const p=[],m=s.shape;for(const g of s.keys){const y=m[g],v=y._zod.optin==="optional",S=y._zod.optout==="optional",w=y._zod.run({value:u[g],issues:[]},d);w instanceof Promise?p.push(w.then(E=>iy(E,c,g,u,v,S))):iy(w,c,g,u,v,S)}return i?Yz(p,u,c,d,r.value,e):p.length?Promise.all(p).then(()=>c):c}}),$ee=Ve("$ZodObjectJIT",(e,t)=>{Fee.init(e,t);const n=e._zod.parse,r=O1(()=>qz(t)),o=g=>{const y=new cee(["shape","payload","ctx"]),v=r.value,S=j=>{const N=mM(j);return`shape[${N}]._zod.run({ value: input[${N}], issues: [] }, ctx)`};y.write("const input = payload.value;");const w=Object.create(null);let E=0;for(const j of v.keys)w[j]=`key_${E++}`;y.write("const newResult = {};");for(const j of v.keys){const N=w[j],A=mM(j),R=g[j],M=R?._zod?.optin==="optional",T=R?._zod?.optout==="optional";y.write(`const ${N} = ${S(j)};`),M&&T?y.write(`
15
+ if (${N}.issues.length) {
16
+ if (${A} in input) {
17
+ payload.issues = payload.issues.concat(${N}.issues.map(iss => ({
18
+ ...iss,
19
+ path: iss.path ? [${A}, ...iss.path] : [${A}]
20
+ })));
21
+ }
22
+ }
23
+
24
+ if (${N}.value === undefined) {
25
+ if (${A} in input) {
26
+ newResult[${A}] = undefined;
27
+ }
28
+ } else {
29
+ newResult[${A}] = ${N}.value;
30
+ }
31
+
32
+ `):M?y.write(`
33
+ if (${N}.issues.length) {
34
+ payload.issues = payload.issues.concat(${N}.issues.map(iss => ({
35
+ ...iss,
36
+ path: iss.path ? [${A}, ...iss.path] : [${A}]
37
+ })));
38
+ }
39
+
40
+ if (${N}.value === undefined) {
41
+ if (${A} in input) {
42
+ newResult[${A}] = undefined;
43
+ }
44
+ } else {
45
+ newResult[${A}] = ${N}.value;
46
+ }
47
+
48
+ `):y.write(`
49
+ const ${N}_present = ${A} in input;
50
+ if (${N}.issues.length) {
51
+ payload.issues = payload.issues.concat(${N}.issues.map(iss => ({
52
+ ...iss,
53
+ path: iss.path ? [${A}, ...iss.path] : [${A}]
54
+ })));
55
+ }
56
+ if (!${N}_present && !${N}.issues.length) {
57
+ payload.issues.push({
58
+ code: "invalid_type",
59
+ expected: "nonoptional",
60
+ input: undefined,
61
+ path: [${A}]
62
+ });
63
+ }
64
+
65
+ if (${N}_present) {
66
+ if (${N}.value === undefined) {
67
+ newResult[${A}] = undefined;
68
+ } else {
69
+ newResult[${A}] = ${N}.value;
70
+ }
71
+ }
72
+
73
+ `)}y.write("payload.value = newResult;"),y.write("return payload;");const k=y.compile();return(j,N)=>k(g,j,N)};let i;const s=oy,c=!A1.jitless,u=c&&sJ.value,p=t.catchall;let m;e._zod.parse=(g,y)=>{m??(m=r.value);const v=g.value;return s(v)?c&&u&&y?.async===!1&&y.jitless!==!0?(i||(i=o(t.shape)),g=i(g,y),p?Yz([],v,g,y,m,e):g):n(g,y):(g.issues.push({expected:"object",code:"invalid_type",input:v,inst:e}),g)}});function xM(e,t,n,r){for(const i of e)if(i.issues.length===0)return t.value=i.value,t;const o=e.filter(i=>!wu(i));return o.length===1?(t.value=o[0].value,o[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(i=>i.issues.map(s=>nc(s,r,tc())))}),t)}const Vee=Ve("$ZodUnion",(e,t)=>{Nr.init(e,t),Pn(e._zod,"optin",()=>t.options.some(r=>r._zod.optin==="optional")?"optional":void 0),Pn(e._zod,"optout",()=>t.options.some(r=>r._zod.optout==="optional")?"optional":void 0),Pn(e._zod,"values",()=>{if(t.options.every(r=>r._zod.values))return new Set(t.options.flatMap(r=>Array.from(r._zod.values)))}),Pn(e._zod,"pattern",()=>{if(t.options.every(r=>r._zod.pattern)){const r=t.options.map(o=>o._zod.pattern);return new RegExp(`^(${r.map(o=>P1(o.source)).join("|")})$`)}});const n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,o)=>{if(n)return n(r,o);let i=!1;const s=[];for(const c of t.options){const d=c._zod.run({value:r.value,issues:[]},o);if(d instanceof Promise)s.push(d),i=!0;else{if(d.issues.length===0)return d;s.push(d)}}return i?Promise.all(s).then(c=>xM(c,r,e,o)):xM(s,r,e,o)}}),Bee=Ve("$ZodIntersection",(e,t)=>{Nr.init(e,t),e._zod.parse=(n,r)=>{const o=n.value,i=t.left._zod.run({value:o,issues:[]},r),s=t.right._zod.run({value:o,issues:[]},r);return i instanceof Promise||s instanceof Promise?Promise.all([i,s]).then(([d,u])=>vM(n,d,u)):vM(n,i,s)}});function hS(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(rh(e)&&rh(t)){const n=Object.keys(t),r=Object.keys(e).filter(i=>n.indexOf(i)!==-1),o={...e,...t};for(const i of r){const s=hS(e[i],t[i]);if(!s.valid)return{valid:!1,mergeErrorPath:[i,...s.mergeErrorPath]};o[i]=s.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let r=0;r<e.length;r++){const o=e[r],i=t[r],s=hS(o,i);if(!s.valid)return{valid:!1,mergeErrorPath:[r,...s.mergeErrorPath]};n.push(s.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function vM(e,t,n){const r=new Map;let o;for(const c of t.issues)if(c.code==="unrecognized_keys"){o??(o=c);for(const d of c.keys)r.has(d)||r.set(d,{}),r.get(d).l=!0}else e.issues.push(c);for(const c of n.issues)if(c.code==="unrecognized_keys")for(const d of c.keys)r.has(d)||r.set(d,{}),r.get(d).r=!0;else e.issues.push(c);const i=[...r].filter(([,c])=>c.l&&c.r).map(([c])=>c);if(i.length&&o&&e.issues.push({...o,keys:i}),wu(e))return e;const s=hS(t.value,n.value);if(!s.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(s.mergeErrorPath)}`);return e.value=s.data,e}const Hee=Ve("$ZodEnum",(e,t)=>{Nr.init(e,t);const n=Dz(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=new RegExp(`^(${n.filter(o=>aJ.has(typeof o)).map(o=>typeof o=="string"?Sx(o):o.toString()).join("|")})$`),e._zod.parse=(o,i)=>{const s=o.value;return r.has(s)||o.issues.push({code:"invalid_value",values:n,input:s,inst:e}),o}}),Uee=Ve("$ZodTransform",(e,t)=>{Nr.init(e,t),e._zod.optin="optional",e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new Oz(e.constructor.name);const o=t.transform(n.value,n);if(r.async)return(o instanceof Promise?o:Promise.resolve(o)).then(s=>(n.value=s,n.fallback=!0,n));if(o instanceof Promise)throw new _u;return n.value=o,n.fallback=!0,n}});function bM(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}const Zz=Ve("$ZodOptional",(e,t)=>{Nr.init(e,t),e._zod.optin="optional",e._zod.optout="optional",Pn(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),Pn(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${P1(n.source)})?$`):void 0}),e._zod.parse=(n,r)=>{if(t.innerType._zod.optin==="optional"){const o=n.value,i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(s=>bM(s,o)):bM(i,o)}return n.value===void 0?n:t.innerType._zod.run(n,r)}}),qee=Ve("$ZodExactOptional",(e,t)=>{Zz.init(e,t),Pn(e._zod,"values",()=>t.innerType._zod.values),Pn(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(n,r)=>t.innerType._zod.run(n,r)}),Yee=Ve("$ZodNullable",(e,t)=>{Nr.init(e,t),Pn(e._zod,"optin",()=>t.innerType._zod.optin),Pn(e._zod,"optout",()=>t.innerType._zod.optout),Pn(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${P1(n.source)}|null)$`):void 0}),Pn(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(n,r)=>n.value===null?n:t.innerType._zod.run(n,r)}),Zee=Ve("$ZodDefault",(e,t)=>{Nr.init(e,t),e._zod.optin="optional",Pn(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);if(n.value===void 0)return n.value=t.defaultValue,n;const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(i=>wM(i,t)):wM(o,t)}});function wM(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const Gee=Ve("$ZodPrefault",(e,t)=>{Nr.init(e,t),e._zod.optin="optional",Pn(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>(r.direction==="backward"||n.value===void 0&&(n.value=t.defaultValue),t.innerType._zod.run(n,r))}),Kee=Ve("$ZodNonOptional",(e,t)=>{Nr.init(e,t),Pn(e._zod,"values",()=>{const n=t.innerType._zod.values;return n?new Set([...n].filter(r=>r!==void 0)):void 0}),e._zod.parse=(n,r)=>{const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(i=>SM(i,e)):SM(o,e)}});function SM(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const Xee=Ve("$ZodCatch",(e,t)=>{Nr.init(e,t),e._zod.optin="optional",Pn(e._zod,"optout",()=>t.innerType._zod.optout),Pn(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(i=>(n.value=i.value,i.issues.length&&(n.value=t.catchValue({...n,error:{issues:i.issues.map(s=>nc(s,r,tc()))},input:n.value}),n.issues=[],n.fallback=!0),n)):(n.value=o.value,o.issues.length&&(n.value=t.catchValue({...n,error:{issues:o.issues.map(i=>nc(i,r,tc()))},input:n.value}),n.issues=[],n.fallback=!0),n)}}),Qee=Ve("$ZodPipe",(e,t)=>{Nr.init(e,t),Pn(e._zod,"values",()=>t.in._zod.values),Pn(e._zod,"optin",()=>t.in._zod.optin),Pn(e._zod,"optout",()=>t.out._zod.optout),Pn(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(n,r)=>{if(r.direction==="backward"){const i=t.out._zod.run(n,r);return i instanceof Promise?i.then(s=>Hm(s,t.in,r)):Hm(i,t.in,r)}const o=t.in._zod.run(n,r);return o instanceof Promise?o.then(i=>Hm(i,t.out,r)):Hm(o,t.out,r)}});function Hm(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},n)}const Wee=Ve("$ZodReadonly",(e,t)=>{Nr.init(e,t),Pn(e._zod,"propValues",()=>t.innerType._zod.propValues),Pn(e._zod,"values",()=>t.innerType._zod.values),Pn(e._zod,"optin",()=>t.innerType?._zod?.optin),Pn(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(EM):EM(o)}});function EM(e){return e.value=Object.freeze(e.value),e}const Jee=Ve("$ZodCustom",(e,t)=>{gs.init(e,t),Nr.init(e,t),e._zod.parse=(n,r)=>n,e._zod.check=n=>{const r=n.value,o=t.fn(r);if(o instanceof Promise)return o.then(i=>CM(i,n,r,e));CM(o,n,r,e)}});function CM(e,t,n,r){if(!e){const o={code:"custom",input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(o.params=r._zod.def.params),t.issues.push(oh(o))}}var kM;class ete{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...n){const r=n[0];return this._map.set(t,r),r&&typeof r=="object"&&"id"in r&&this._idmap.set(r.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){const n=this._map.get(t);return n&&typeof n=="object"&&"id"in n&&this._idmap.delete(n.id),this._map.delete(t),this}get(t){const n=t._zod.parent;if(n){const r={...this.get(n)??{}};delete r.id;const o={...r,...this._map.get(t)};return Object.keys(o).length?o:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}function tte(){return new ete}(kM=globalThis).__zod_globalRegistry??(kM.__zod_globalRegistry=tte());const Mf=globalThis.__zod_globalRegistry;function nte(e,t){return new e({type:"string",...Mt(t)})}function rte(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...Mt(t)})}function jM(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...Mt(t)})}function ote(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...Mt(t)})}function ite(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...Mt(t)})}function ste(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...Mt(t)})}function ate(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...Mt(t)})}function lte(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...Mt(t)})}function cte(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...Mt(t)})}function ute(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...Mt(t)})}function dte(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...Mt(t)})}function fte(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...Mt(t)})}function hte(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...Mt(t)})}function pte(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...Mt(t)})}function mte(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...Mt(t)})}function gte(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...Mt(t)})}function yte(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...Mt(t)})}function xte(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...Mt(t)})}function vte(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...Mt(t)})}function bte(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...Mt(t)})}function wte(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...Mt(t)})}function Ste(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...Mt(t)})}function Ete(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...Mt(t)})}function Cte(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...Mt(t)})}function kte(e,t){return new e({type:"string",format:"date",check:"string_format",...Mt(t)})}function jte(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...Mt(t)})}function Rte(e,t){return new e({type:"string",format:"duration",check:"string_format",...Mt(t)})}function _te(e){return new e({type:"unknown"})}function Nte(e,t){return new e({type:"never",...Mt(t)})}function Gz(e,t){return new JJ({check:"max_length",...Mt(t),maximum:e})}function sy(e,t){return new eee({check:"min_length",...Mt(t),minimum:e})}function Kz(e,t){return new tee({check:"length_equals",...Mt(t),length:e})}function Tte(e,t){return new nee({check:"string_format",format:"regex",...Mt(t),pattern:e})}function Mte(e){return new ree({check:"string_format",format:"lowercase",...Mt(e)})}function Ate(e){return new oee({check:"string_format",format:"uppercase",...Mt(e)})}function Ote(e,t){return new iee({check:"string_format",format:"includes",...Mt(t),includes:e})}function Dte(e,t){return new see({check:"string_format",format:"starts_with",...Mt(t),prefix:e})}function Pte(e,t){return new aee({check:"string_format",format:"ends_with",...Mt(t),suffix:e})}function cd(e){return new lee({check:"overwrite",tx:e})}function Ite(e){return cd(t=>t.normalize(e))}function zte(){return cd(e=>e.trim())}function Lte(){return cd(e=>e.toLowerCase())}function Fte(){return cd(e=>e.toUpperCase())}function $te(){return cd(e=>iJ(e))}function Vte(e,t,n){return new e({type:"array",element:t,...Mt(n)})}function Bte(e,t,n){return new e({type:"custom",check:"custom",fn:t,...Mt(n)})}function Hte(e,t){const n=Ute(r=>(r.addIssue=o=>{if(typeof o=="string")r.issues.push(oh(o,r.value,n._zod.def));else{const i=o;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=r.value),i.inst??(i.inst=n),i.continue??(i.continue=!n._zod.def.abort),r.issues.push(oh(i))}},e(r.value,r)),t);return n}function Ute(e,t){const n=new gs({check:"custom",...Mt(t)});return n._zod.check=e,n}function Xz(e){let t=e?.target??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??Mf,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function Gr(e,t,n={path:[],schemaPath:[]}){var r;const o=e._zod.def,i=t.seen.get(e);if(i)return i.count++,n.schemaPath.includes(e)&&(i.cycle=n.path),i.schema;const s={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,s);const c=e._zod.toJSONSchema?.();if(c)s.schema=c;else{const p={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,s.schema,p);else{const g=s.schema,y=t.processors[o.type];if(!y)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);y(e,t,g,p)}const m=e._zod.parent;m&&(s.ref||(s.ref=m),Gr(m,t,p),t.seen.get(m).isParent=!0)}const d=t.metadataRegistry.get(e);return d&&Object.assign(s.schema,d),t.io==="input"&&ao(e)&&(delete s.schema.examples,delete s.schema.default),t.io==="input"&&"_prefault"in s.schema&&((r=s.schema).default??(r.default=s.schema._prefault)),delete s.schema._prefault,t.seen.get(e).schema}function Qz(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=new Map;for(const s of e.seen.entries()){const c=e.metadataRegistry.get(s[0])?.id;if(c){const d=r.get(c);if(d&&d!==s[0])throw new Error(`Duplicate schema id "${c}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(c,s[0])}}const o=s=>{const c=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const m=e.external.registry.get(s[0])?.id,g=e.external.uri??(v=>v);if(m)return{ref:g(m)};const y=s[1].defId??s[1].schema.id??`schema${e.counter++}`;return s[1].defId=y,{defId:y,ref:`${g("__shared")}#/${c}/${y}`}}if(s[1]===n)return{ref:"#"};const u=`#/${c}/`,p=s[1].schema.id??`__schema${e.counter++}`;return{defId:p,ref:u+p}},i=s=>{if(s[1].schema.$ref)return;const c=s[1],{ref:d,defId:u}=o(s);c.def={...c.schema},u&&(c.defId=u);const p=c.schema;for(const m in p)delete p[m];p.$ref=d};if(e.cycles==="throw")for(const s of e.seen.entries()){const c=s[1];if(c.cycle)throw new Error(`Cycle detected: #/${c.cycle?.join("/")}/<root>
74
+
75
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const s of e.seen.entries()){const c=s[1];if(t===s[0]){i(s);continue}if(e.external){const u=e.external.registry.get(s[0])?.id;if(t!==s[0]&&u){i(s);continue}}if(e.metadataRegistry.get(s[0])?.id){i(s);continue}if(c.cycle){i(s);continue}if(c.count>1&&e.reused==="ref"){i(s);continue}}}function Wz(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=c=>{const d=e.seen.get(c);if(d.ref===null)return;const u=d.def??d.schema,p={...u},m=d.ref;if(d.ref=null,m){r(m);const y=e.seen.get(m),v=y.schema;if(v.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(u.allOf=u.allOf??[],u.allOf.push(v)):Object.assign(u,v),Object.assign(u,p),c._zod.parent===m)for(const w in u)w==="$ref"||w==="allOf"||w in p||delete u[w];if(v.$ref&&y.def)for(const w in u)w==="$ref"||w==="allOf"||w in y.def&&JSON.stringify(u[w])===JSON.stringify(y.def[w])&&delete u[w]}const g=c._zod.parent;if(g&&g!==m){r(g);const y=e.seen.get(g);if(y?.schema.$ref&&(u.$ref=y.schema.$ref,y.def))for(const v in u)v==="$ref"||v==="allOf"||v in y.def&&JSON.stringify(u[v])===JSON.stringify(y.def[v])&&delete u[v]}e.override({zodSchema:c,jsonSchema:u,path:d.path??[]})};for(const c of[...e.seen.entries()].reverse())r(c[0]);const o={};if(e.target==="draft-2020-12"?o.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?o.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?o.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){const c=e.external.registry.get(t)?.id;if(!c)throw new Error("Schema is missing an `id` property");o.$id=e.external.uri(c)}Object.assign(o,n.def??n.schema);const i=e.metadataRegistry.get(t)?.id;i!==void 0&&o.id===i&&delete o.id;const s=e.external?.defs??{};for(const c of e.seen.entries()){const d=c[1];d.def&&d.defId&&(d.def.id===d.defId&&delete d.def.id,s[d.defId]=d.def)}e.external||Object.keys(s).length>0&&(e.target==="draft-2020-12"?o.$defs=s:o.definitions=s);try{const c=JSON.parse(JSON.stringify(o));return Object.defineProperty(c,"~standard",{value:{...t["~standard"],jsonSchema:{input:ay(t,"input",e.processors),output:ay(t,"output",e.processors)}},enumerable:!1,writable:!1}),c}catch{throw new Error("Error converting schema to JSON.")}}function ao(e,t){const n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);const r=e._zod.def;if(r.type==="transform")return!0;if(r.type==="array")return ao(r.element,n);if(r.type==="set")return ao(r.valueType,n);if(r.type==="lazy")return ao(r.getter(),n);if(r.type==="promise"||r.type==="optional"||r.type==="nonoptional"||r.type==="nullable"||r.type==="readonly"||r.type==="default"||r.type==="prefault")return ao(r.innerType,n);if(r.type==="intersection")return ao(r.left,n)||ao(r.right,n);if(r.type==="record"||r.type==="map")return ao(r.keyType,n)||ao(r.valueType,n);if(r.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:ao(r.in,n)||ao(r.out,n);if(r.type==="object"){for(const o in r.shape)if(ao(r.shape[o],n))return!0;return!1}if(r.type==="union"){for(const o of r.options)if(ao(o,n))return!0;return!1}if(r.type==="tuple"){for(const o of r.items)if(ao(o,n))return!0;return!!(r.rest&&ao(r.rest,n))}return!1}const qte=(e,t={})=>n=>{const r=Xz({...n,processors:t});return Gr(e,r),Qz(r,e),Wz(r,e)},ay=(e,t,n={})=>r=>{const{libraryOptions:o,target:i}=r??{},s=Xz({...o??{},target:i,io:t,processors:n});return Gr(e,s),Qz(s,e),Wz(s,e)},Yte={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Zte=(e,t,n,r)=>{const o=n;o.type="string";const{minimum:i,maximum:s,format:c,patterns:d,contentEncoding:u}=e._zod.bag;if(typeof i=="number"&&(o.minLength=i),typeof s=="number"&&(o.maxLength=s),c&&(o.format=Yte[c]??c,o.format===""&&delete o.format,c==="time"&&delete o.format),u&&(o.contentEncoding=u),d&&d.size>0){const p=[...d];p.length===1?o.pattern=p[0].source:p.length>1&&(o.allOf=[...p.map(m=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:m.source}))])}},Gte=(e,t,n,r)=>{n.not={}},Kte=(e,t,n,r)=>{},Xte=(e,t,n,r)=>{const o=e._zod.def,i=Dz(o.entries);i.every(s=>typeof s=="number")&&(n.type="number"),i.every(s=>typeof s=="string")&&(n.type="string"),n.enum=i},Qte=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},Wte=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},Jte=(e,t,n,r)=>{const o=n,i=e._zod.def,{minimum:s,maximum:c}=e._zod.bag;typeof s=="number"&&(o.minItems=s),typeof c=="number"&&(o.maxItems=c),o.type="array",o.items=Gr(i.element,t,{...r,path:[...r.path,"items"]})},ene=(e,t,n,r)=>{const o=n,i=e._zod.def;o.type="object",o.properties={};const s=i.shape;for(const u in s)o.properties[u]=Gr(s[u],t,{...r,path:[...r.path,"properties",u]});const c=new Set(Object.keys(s)),d=new Set([...c].filter(u=>{const p=i.shape[u]._zod;return t.io==="input"?p.optin===void 0:p.optout===void 0}));d.size>0&&(o.required=Array.from(d)),i.catchall?._zod.def.type==="never"?o.additionalProperties=!1:i.catchall?i.catchall&&(o.additionalProperties=Gr(i.catchall,t,{...r,path:[...r.path,"additionalProperties"]})):t.io==="output"&&(o.additionalProperties=!1)},tne=(e,t,n,r)=>{const o=e._zod.def,i=o.inclusive===!1,s=o.options.map((c,d)=>Gr(c,t,{...r,path:[...r.path,i?"oneOf":"anyOf",d]}));i?n.oneOf=s:n.anyOf=s},nne=(e,t,n,r)=>{const o=e._zod.def,i=Gr(o.left,t,{...r,path:[...r.path,"allOf",0]}),s=Gr(o.right,t,{...r,path:[...r.path,"allOf",1]}),c=u=>"allOf"in u&&Object.keys(u).length===1,d=[...c(i)?i.allOf:[i],...c(s)?s.allOf:[s]];n.allOf=d},rne=(e,t,n,r)=>{const o=e._zod.def,i=Gr(o.innerType,t,r),s=t.seen.get(e);t.target==="openapi-3.0"?(s.ref=o.innerType,n.nullable=!0):n.anyOf=[i,{type:"null"}]},one=(e,t,n,r)=>{const o=e._zod.def;Gr(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType},ine=(e,t,n,r)=>{const o=e._zod.def;Gr(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType,n.default=JSON.parse(JSON.stringify(o.defaultValue))},sne=(e,t,n,r)=>{const o=e._zod.def;Gr(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType,t.io==="input"&&(n._prefault=JSON.parse(JSON.stringify(o.defaultValue)))},ane=(e,t,n,r)=>{const o=e._zod.def;Gr(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType;let s;try{s=o.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}n.default=s},lne=(e,t,n,r)=>{const o=e._zod.def,i=o.in._zod.traits.has("$ZodTransform"),s=t.io==="input"?i?o.out:o.in:o.out;Gr(s,t,r);const c=t.seen.get(e);c.ref=s},cne=(e,t,n,r)=>{const o=e._zod.def;Gr(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType,n.readOnly=!0},Jz=(e,t,n,r)=>{const o=e._zod.def;Gr(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType},une=Ve("ZodISODateTime",(e,t)=>{See.init(e,t),ir.init(e,t)});function dne(e){return Cte(une,e)}const fne=Ve("ZodISODate",(e,t)=>{Eee.init(e,t),ir.init(e,t)});function hne(e){return kte(fne,e)}const pne=Ve("ZodISOTime",(e,t)=>{Cee.init(e,t),ir.init(e,t)});function mne(e){return jte(pne,e)}const gne=Ve("ZodISODuration",(e,t)=>{kee.init(e,t),ir.init(e,t)});function yne(e){return Rte(gne,e)}const xne=(e,t)=>{Fz.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>xJ(e,n)},flatten:{value:n=>yJ(e,n)},addIssue:{value:n=>{e.issues.push(n),e.message=JSON.stringify(e.issues,fS,2)}},addIssues:{value:n=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,fS,2)}},isEmpty:{get(){return e.issues.length===0}}})},xi=Ve("ZodError",xne,{Parent:Error}),vne=z1(xi),bne=L1(xi),wne=Ex(xi),Sne=Cx(xi),Ene=wJ(xi),Cne=SJ(xi),kne=EJ(xi),jne=CJ(xi),Rne=kJ(xi),_ne=jJ(xi),Nne=RJ(xi),Tne=_J(xi),RM=new WeakMap;function jx(e,t,n){const r=Object.getPrototypeOf(e);let o=RM.get(r);if(o||(o=new Set,RM.set(r,o)),!o.has(t)){o.add(t);for(const i in n){const s=n[i];Object.defineProperty(r,i,{configurable:!0,enumerable:!1,get(){const c=s.bind(this);return Object.defineProperty(this,i,{configurable:!0,writable:!0,enumerable:!0,value:c}),c},set(c){Object.defineProperty(this,i,{configurable:!0,writable:!0,enumerable:!0,value:c})}})}}}const Tr=Ve("ZodType",(e,t)=>(Nr.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:ay(e,"input"),output:ay(e,"output")}}),e.toJSONSchema=qte(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(n,r)=>vne(e,n,r,{callee:e.parse}),e.safeParse=(n,r)=>wne(e,n,r),e.parseAsync=async(n,r)=>bne(e,n,r,{callee:e.parseAsync}),e.safeParseAsync=async(n,r)=>Sne(e,n,r),e.spa=e.safeParseAsync,e.encode=(n,r)=>Ene(e,n,r),e.decode=(n,r)=>Cne(e,n,r),e.encodeAsync=async(n,r)=>kne(e,n,r),e.decodeAsync=async(n,r)=>jne(e,n,r),e.safeEncode=(n,r)=>Rne(e,n,r),e.safeDecode=(n,r)=>_ne(e,n,r),e.safeEncodeAsync=async(n,r)=>Nne(e,n,r),e.safeDecodeAsync=async(n,r)=>Tne(e,n,r),jx(e,"ZodType",{check(...n){const r=this.def;return this.clone(ul(r,{checks:[...r.checks??[],...n.map(o=>typeof o=="function"?{_zod:{check:o,def:{check:"custom"},onattach:[]}}:o)]}),{parent:!0})},with(...n){return this.check(...n)},clone(n,r){return dl(this,n,r)},brand(){return this},register(n,r){return n.add(this,r),this},refine(n,r){return this.check(bre(n,r))},superRefine(n,r){return this.check(wre(n,r))},overwrite(n){return this.check(cd(n))},optional(){return TM(this)},exactOptional(){return are(this)},nullable(){return MM(this)},nullish(){return TM(MM(this))},nonoptional(n){return hre(this,n)},array(){return Ga(this)},or(n){return tre([this,n])},and(n){return rre(this,n)},transform(n){return AM(this,ire(n))},default(n){return ure(this,n)},prefault(n){return fre(this,n)},catch(n){return mre(this,n)},pipe(n){return AM(this,n)},readonly(){return xre(this)},describe(n){const r=this.clone();return Mf.add(r,{description:n}),r},meta(...n){if(n.length===0)return Mf.get(this);const r=this.clone();return Mf.add(r,n[0]),r},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(n){return n(this)}}),Object.defineProperty(e,"description",{get(){return Mf.get(e)?.description},configurable:!0}),e)),eL=Ve("_ZodString",(e,t)=>{F1.init(e,t),Tr.init(e,t),e._zod.processJSONSchema=(r,o,i)=>Zte(e,r,o);const n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,jx(e,"_ZodString",{regex(...r){return this.check(Tte(...r))},includes(...r){return this.check(Ote(...r))},startsWith(...r){return this.check(Dte(...r))},endsWith(...r){return this.check(Pte(...r))},min(...r){return this.check(sy(...r))},max(...r){return this.check(Gz(...r))},length(...r){return this.check(Kz(...r))},nonempty(...r){return this.check(sy(1,...r))},lowercase(r){return this.check(Mte(r))},uppercase(r){return this.check(Ate(r))},trim(){return this.check(zte())},normalize(...r){return this.check(Ite(...r))},toLowerCase(){return this.check(Lte())},toUpperCase(){return this.check(Fte())},slugify(){return this.check($te())}})}),Mne=Ve("ZodString",(e,t)=>{F1.init(e,t),eL.init(e,t),e.email=n=>e.check(rte(Ane,n)),e.url=n=>e.check(lte(One,n)),e.jwt=n=>e.check(Ete(Gne,n)),e.emoji=n=>e.check(cte(Dne,n)),e.guid=n=>e.check(jM(_M,n)),e.uuid=n=>e.check(ote(Um,n)),e.uuidv4=n=>e.check(ite(Um,n)),e.uuidv6=n=>e.check(ste(Um,n)),e.uuidv7=n=>e.check(ate(Um,n)),e.nanoid=n=>e.check(ute(Pne,n)),e.guid=n=>e.check(jM(_M,n)),e.cuid=n=>e.check(dte(Ine,n)),e.cuid2=n=>e.check(fte(zne,n)),e.ulid=n=>e.check(hte(Lne,n)),e.base64=n=>e.check(bte(qne,n)),e.base64url=n=>e.check(wte(Yne,n)),e.xid=n=>e.check(pte(Fne,n)),e.ksuid=n=>e.check(mte($ne,n)),e.ipv4=n=>e.check(gte(Vne,n)),e.ipv6=n=>e.check(yte(Bne,n)),e.cidrv4=n=>e.check(xte(Hne,n)),e.cidrv6=n=>e.check(vte(Une,n)),e.e164=n=>e.check(Ste(Zne,n)),e.datetime=n=>e.check(dne(n)),e.date=n=>e.check(hne(n)),e.time=n=>e.check(mne(n)),e.duration=n=>e.check(yne(n))});function zt(e){return nte(Mne,e)}const ir=Ve("ZodStringFormat",(e,t)=>{er.init(e,t),eL.init(e,t)}),Ane=Ve("ZodEmail",(e,t)=>{hee.init(e,t),ir.init(e,t)}),_M=Ve("ZodGUID",(e,t)=>{dee.init(e,t),ir.init(e,t)}),Um=Ve("ZodUUID",(e,t)=>{fee.init(e,t),ir.init(e,t)}),One=Ve("ZodURL",(e,t)=>{pee.init(e,t),ir.init(e,t)}),Dne=Ve("ZodEmoji",(e,t)=>{mee.init(e,t),ir.init(e,t)}),Pne=Ve("ZodNanoID",(e,t)=>{gee.init(e,t),ir.init(e,t)}),Ine=Ve("ZodCUID",(e,t)=>{yee.init(e,t),ir.init(e,t)}),zne=Ve("ZodCUID2",(e,t)=>{xee.init(e,t),ir.init(e,t)}),Lne=Ve("ZodULID",(e,t)=>{vee.init(e,t),ir.init(e,t)}),Fne=Ve("ZodXID",(e,t)=>{bee.init(e,t),ir.init(e,t)}),$ne=Ve("ZodKSUID",(e,t)=>{wee.init(e,t),ir.init(e,t)}),Vne=Ve("ZodIPv4",(e,t)=>{jee.init(e,t),ir.init(e,t)}),Bne=Ve("ZodIPv6",(e,t)=>{Ree.init(e,t),ir.init(e,t)}),Hne=Ve("ZodCIDRv4",(e,t)=>{_ee.init(e,t),ir.init(e,t)}),Une=Ve("ZodCIDRv6",(e,t)=>{Nee.init(e,t),ir.init(e,t)}),qne=Ve("ZodBase64",(e,t)=>{Tee.init(e,t),ir.init(e,t)}),Yne=Ve("ZodBase64URL",(e,t)=>{Aee.init(e,t),ir.init(e,t)}),Zne=Ve("ZodE164",(e,t)=>{Oee.init(e,t),ir.init(e,t)}),Gne=Ve("ZodJWT",(e,t)=>{Pee.init(e,t),ir.init(e,t)}),Kne=Ve("ZodUnknown",(e,t)=>{Iee.init(e,t),Tr.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Kte()});function NM(){return _te(Kne)}const Xne=Ve("ZodNever",(e,t)=>{zee.init(e,t),Tr.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Gte(e,n,r)});function Qne(e){return Nte(Xne,e)}const Wne=Ve("ZodArray",(e,t)=>{Lee.init(e,t),Tr.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Jte(e,n,r,o),e.element=t.element,jx(e,"ZodArray",{min(n,r){return this.check(sy(n,r))},nonempty(n){return this.check(sy(1,n))},max(n,r){return this.check(Gz(n,r))},length(n,r){return this.check(Kz(n,r))},unwrap(){return this.element}})});function Ga(e,t){return Vte(Wne,e,t)}const Jne=Ve("ZodObject",(e,t)=>{$ee.init(e,t),Tr.init(e,t),e._zod.processJSONSchema=(n,r,o)=>ene(e,n,r,o),Pn(e,"shape",()=>t.shape),jx(e,"ZodObject",{keyof(){return ih(Object.keys(this._zod.def.shape))},catchall(n){return this.clone({...this._zod.def,catchall:n})},passthrough(){return this.clone({...this._zod.def,catchall:NM()})},loose(){return this.clone({...this._zod.def,catchall:NM()})},strict(){return this.clone({...this._zod.def,catchall:Qne()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(n){return dJ(this,n)},safeExtend(n){return fJ(this,n)},merge(n){return hJ(this,n)},pick(n){return cJ(this,n)},omit(n){return uJ(this,n)},partial(...n){return pJ(tL,this,n[0])},required(...n){return mJ(nL,this,n[0])}})});function Li(e,t){const n={type:"object",shape:e??{},...Mt(t)};return new Jne(n)}const ere=Ve("ZodUnion",(e,t)=>{Vee.init(e,t),Tr.init(e,t),e._zod.processJSONSchema=(n,r,o)=>tne(e,n,r,o),e.options=t.options});function tre(e,t){return new ere({type:"union",options:e,...Mt(t)})}const nre=Ve("ZodIntersection",(e,t)=>{Bee.init(e,t),Tr.init(e,t),e._zod.processJSONSchema=(n,r,o)=>nne(e,n,r,o)});function rre(e,t){return new nre({type:"intersection",left:e,right:t})}const pS=Ve("ZodEnum",(e,t)=>{Hee.init(e,t),Tr.init(e,t),e._zod.processJSONSchema=(r,o,i)=>Xte(e,r,o),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(r,o)=>{const i={};for(const s of r)if(n.has(s))i[s]=t.entries[s];else throw new Error(`Key ${s} not found in enum`);return new pS({...t,checks:[],...Mt(o),entries:i})},e.exclude=(r,o)=>{const i={...t.entries};for(const s of r)if(n.has(s))delete i[s];else throw new Error(`Key ${s} not found in enum`);return new pS({...t,checks:[],...Mt(o),entries:i})}});function ih(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new pS({type:"enum",entries:n,...Mt(t)})}const ore=Ve("ZodTransform",(e,t)=>{Uee.init(e,t),Tr.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Wte(e,n),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new Oz(e.constructor.name);n.addIssue=i=>{if(typeof i=="string")n.issues.push(oh(i,n.value,t));else{const s=i;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=n.value),s.inst??(s.inst=e),n.issues.push(oh(s))}};const o=t.transform(n.value,n);return o instanceof Promise?o.then(i=>(n.value=i,n.fallback=!0,n)):(n.value=o,n.fallback=!0,n)}});function ire(e){return new ore({type:"transform",transform:e})}const tL=Ve("ZodOptional",(e,t)=>{Zz.init(e,t),Tr.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Jz(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function TM(e){return new tL({type:"optional",innerType:e})}const sre=Ve("ZodExactOptional",(e,t)=>{qee.init(e,t),Tr.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Jz(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function are(e){return new sre({type:"optional",innerType:e})}const lre=Ve("ZodNullable",(e,t)=>{Yee.init(e,t),Tr.init(e,t),e._zod.processJSONSchema=(n,r,o)=>rne(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function MM(e){return new lre({type:"nullable",innerType:e})}const cre=Ve("ZodDefault",(e,t)=>{Zee.init(e,t),Tr.init(e,t),e._zod.processJSONSchema=(n,r,o)=>ine(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function ure(e,t){return new cre({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():Iz(t)}})}const dre=Ve("ZodPrefault",(e,t)=>{Gee.init(e,t),Tr.init(e,t),e._zod.processJSONSchema=(n,r,o)=>sne(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function fre(e,t){return new dre({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():Iz(t)}})}const nL=Ve("ZodNonOptional",(e,t)=>{Kee.init(e,t),Tr.init(e,t),e._zod.processJSONSchema=(n,r,o)=>one(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function hre(e,t){return new nL({type:"nonoptional",innerType:e,...Mt(t)})}const pre=Ve("ZodCatch",(e,t)=>{Xee.init(e,t),Tr.init(e,t),e._zod.processJSONSchema=(n,r,o)=>ane(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function mre(e,t){return new pre({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const gre=Ve("ZodPipe",(e,t)=>{Qee.init(e,t),Tr.init(e,t),e._zod.processJSONSchema=(n,r,o)=>lne(e,n,r,o),e.in=t.in,e.out=t.out});function AM(e,t){return new gre({type:"pipe",in:e,out:t})}const yre=Ve("ZodReadonly",(e,t)=>{Wee.init(e,t),Tr.init(e,t),e._zod.processJSONSchema=(n,r,o)=>cne(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function xre(e){return new yre({type:"readonly",innerType:e})}const vre=Ve("ZodCustom",(e,t)=>{Jee.init(e,t),Tr.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Qte(e,n)});function bre(e,t={}){return Bte(vre,e,t)}function wre(e,t){return Hte(e,t)}const ia=HW;function Ot({...e}){return f.jsx(rL.Provider,{value:{name:e.name},children:f.jsx(FW,{...e})})}function Dt({className:e,...t}){const n=b.useId();return f.jsx(oL.Provider,{value:{id:n},children:f.jsx("div",{"data-slot":"form-item",className:Ct("space-y-1.5",e),...t})})}function Pt({className:e,...t}){const{error:n,formItemId:r}=$1();return f.jsx(jr,{"data-error":!!n,className:Ct("data-[error=true]:text-destructive",e),htmlFor:r,...t})}function _t({children:e,...t}){const{error:n,formItemId:r,formMessageId:o}=$1();return b.cloneElement(e,{id:r,"aria-describedby":n?o:void 0,"aria-invalid":!!n,...t})}function It({className:e,children:t,...n}){const{error:r,formMessageId:o}=$1(),i=r?.message??t;return i?f.jsx("p",{role:"alert",id:o,className:Ct("text-xs text-destructive",e),...n,children:i}):null}const rL=b.createContext(null),oL=b.createContext(null);function $1(){const e=b.useContext(rL),t=b.useContext(oL);if(!e)throw new Error("useFormField 必须在 <FormField> 内使用");if(!t)throw new Error("useFormField 必须在 <FormItem> 内使用");const{getFieldState:n,formState:r}=BW(),o=n(e.name,r),{id:i}=t;return{id:i,name:e.name,formItemId:`${i}-item`,formMessageId:`${i}-message`,...o}}const iL=b.createContext(void 0);function Qh(e){const t=b.useContext(iL);if(t===void 0&&!e)throw new Error(Sr(47));return t}const Sre={...n1,disabled:e=>e.disabled,instantType:e=>e.instantType,openMethod:e=>e.openMethod,openChangeReason:e=>e.openChangeReason,modal:e=>e.modal,focusManagerModal:e=>e.focusManagerModal,stickIfOpen:e=>e.stickIfOpen,titleElementId:e=>e.titleElementId,descriptionElementId:e=>e.descriptionElementId,openOnHover:e=>e.openOnHover,closeDelay:e=>e.closeDelay,adaptiveOrigin:e=>e.adaptiveOrigin};class Ere extends Ah{constructor(t,n,r){const o=new Ih;super(Cre(t,o,n,r),kre(o),Sre)}setOpen=(t,n)=>{const r=n.reason===Dr,o=n.reason===Xl&&n.event.detail===0,i=!t&&(n.reason===qy||n.reason==null),s=TP(n),c=this.select("activeTriggerId");if(!t&&n.reason===BD&&n.trigger==null&&c!=null&&(n.trigger=this.context.triggerElements.getById(c)??this.select("activeTriggerElement")??void 0),this.context.onOpenChange?.(t,n),n.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(t,n);const d=()=>{const p={open:t,openChangeReason:n.reason};XE(p,t,n.trigger,s()),this.update(p)};r?(this.set("stickIfOpen",!0),this.context.stickIfOpenTimeout.start(lP,()=>{this.set("stickIfOpen",!1)}),Go.flushSync(d)):d();let u;o?u="click":i?u="dismiss":n.reason===Qa&&(u="focus"),this.set("instantType",u)}}function Cre(e,t,n,r=!1){const o={...e1(),disabled:!1,modal:!1,focusManagerModal:!1,instantType:void 0,openMethod:null,openChangeReason:null,titleElementId:void 0,descriptionElementId:void 0,stickIfOpen:!0,openOnHover:!1,closeDelay:0,adaptiveOrigin:void 0,...e};return o.open&&e?.mounted===void 0&&(o.mounted=!0),o.floatingRootContext=OP(t,n,r),o}function kre(e){return{popupRef:b.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerFocusTargetRef:b.createRef(),beforeContentFocusGuardRef:b.createRef(),stickIfOpenTimeout:new zi,triggerElements:e}}function OM({props:e}){const{children:t,open:n,defaultOpen:r=!1,onOpenChange:o,onOpenChangeComplete:i,modal:s=!1,handle:c,triggerId:d,defaultTriggerId:u=null}=e,p=Rre(c,{modal:s,open:r,openProp:n,activeTriggerId:u,triggerIdProp:d});p.useControlledProp("openProp",n),p.useControlledProp("triggerIdProp",d);const m=p.useState("open"),g=p.useState("mounted"),y=p.useState("payload");p.useContextCallback("onOpenChange",o),p.useContextCallback("onOpenChangeComplete",i),AP(p,m),QE(p);const{forceUnmount:v}=WE(m,p,()=>{p.update({stickIfOpen:!0,openChangeReason:null})});p.useSyncedValues({modal:s}),b.useEffect(()=>{m||p.context.stickIfOpenTimeout.clear()},[p,m]),b.useImperativeHandle(e.actionsRef,()=>({unmount:v,close:()=>p.setOpen(!1,Bt(PE))}),[v,p]);const S=m||g;return f.jsxs(iL.Provider,{value:p,children:[c&&f.jsx(KE,{handle:c,store:p}),S&&f.jsx(_re,{store:p,modal:s}),typeof t=="function"?t({payload:y}):t]})}function jre(e){return Qh(!0)?f.jsx(OM,{props:e}):f.jsx(xP,{children:f.jsx(OM,{props:e})})}function Rre(e,t){const n=NP((r,o)=>new Ere(t,r,o));return b.useEffect(()=>n.context.stickIfOpenTimeout.disposeEffect(),[n]),n}function _re({store:e,modal:t}){const n=e.useState("floatingRootContext"),r=Ky(n,{outsidePressEvent:{mouse:t==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}}),o=r.reference,i=r.floating;return JE(e,{activeTriggerProps:o,inactiveTriggerProps:o,popupProps:i}),null}const Nre=300,Tre=b.forwardRef(function(t,n){const{render:r,className:o,style:i,disabled:s=!1,nativeButton:c=!0,handle:d,payload:u,openOnHover:p=!1,delay:m=Nre,closeDelay:g=0,id:y,...v}=t,S=Qh(!0),E=PP(d)??S;if(!E)throw new Error(Sr(74));const k=na(y),j=E.useState("isTriggerActive",k),N=E.useState("floatingRootContext"),A=E.useState("isOpenedByTrigger",k),R=E.useState("triggerPopupId",k),M=b.useRef(null),{registerTrigger:T,isMountedByThisTrigger:O}=MP(k,M,E,{payload:u,disabled:s,openOnHover:p,closeDelay:g}),z=E.useState("openChangeReason"),q=E.useState("stickIfOpen"),$=E.useState("openMethod"),G=E.useState("focusManagerModal"),L=FP(N,{enabled:!s&&p&&($!=="touch"||z!==Xl),mouseOnly:!0,move:!1,handleClose:BP(),restMs:m,delay:{close:g},triggerElementRef:M,isActiveTrigger:j,isClosing:()=>E.select("transitionStatus")==="ending"}),F=YE(N,{stickIfOpen:q}),P=QP(()=>E.select("open"),oe=>{E.set("openMethod",oe)}),I=E.useState("triggerProps",O),{getButtonProps:Y,buttonRef:Z}=ll({disabled:s,native:c}),D={open(oe){return oe&&z===Xl?Zg.open(oe):JP.open(oe)}},{preFocusGuardRef:H,handlePreFocusGuardFocus:U,handleFocusTargetFocus:B}=DI(E,M),J=wn("button",t,{state:{disabled:s,open:A},ref:[Z,n,T,M],props:[F.reference,L,I,P,{[cP]:"",id:k,"aria-haspopup":"dialog","aria-expanded":A,"aria-controls":R},v,Y],stateAttributesMapping:D}),Q=f.jsx(b.Fragment,{children:J},k);return O&&!G?f.jsxs(b.Fragment,{children:[f.jsx(Wa,{ref:H,onFocus:U}),Q,f.jsx(Wa,{ref:E.context.triggerFocusTargetRef,onFocus:B})]}):Q}),sL=b.createContext(void 0);function Mre(){const e=b.useContext(sL);if(e===void 0)throw new Error(Sr(45));return e}const Are=b.forwardRef(function(t,n){const{keepMounted:r=!1,...o}=t;return Qh().useState("mounted")||r?f.jsx(sL.Provider,{value:r,children:f.jsx(Zy,{ref:n,...o})}):null}),aL=b.createContext(void 0);function Ore(){const e=b.useContext(aL);if(!e)throw new Error(Sr(46));return e}const Dre=b.forwardRef(function(t,n){const{render:r,className:o,style:i,anchor:s,positionMethod:c,side:d,align:u,sideOffset:p,alignOffset:m,collisionBoundary:g="clipping-ancestors",collisionPadding:y,arrowPadding:v,sticky:S,disableAnchorTracking:w=!1,collisionAvoidance:E=dP,...k}=t,j=Qh(),N=Mre(),A=UE(),R=j.useState("floatingRootContext"),M=j.useState("mounted"),T=j.useState("open"),O=j.useState("openChangeReason"),z=j.useState("activeTriggerElement"),q=j.useState("modal"),$=j.useState("openMethod"),G=j.useState("positionerElement"),L=j.useState("instantType"),F=j.useState("transitionStatus"),P=j.useState("adaptiveOrigin"),I=b.useRef(null),Y=GE(G),Z=l1({anchor:s,floatingRootContext:R,positionMethod:c,mounted:M,side:d,sideOffset:p,align:u,alignOffset:m,arrowPadding:v,collisionBoundary:g,collisionPadding:y,sticky:S,disableAnchorTracking:w,keepMounted:N,nodeId:A,collisionAvoidance:E,adaptiveOrigin:P}),D=R.useState("domReferenceElement");rt(()=>{const J=D,Q=I.current;if(J&&(I.current=J),Q&&J&&J!==Q){j.set("instantType",void 0);const oe=new AbortController;return Y(()=>{j.set("instantType","trigger-change")},oe.signal),()=>{oe.abort()}}},[D,Y,j]);const H=q===!0&&O!==Dr;d1(T&&H,$==="touch",G,z);const U=j.useStateSetter("positionerElement"),B={open:T,side:Z.side,align:Z.align,anchorHidden:Z.anchorHidden,instant:L},X=u1(t,B,{styles:Z.positionerStyles,transitionStatus:F,props:k,refs:[n,U],hidden:!M,inert:!T});return f.jsxs(aL.Provider,{value:Z,children:[M&&H&&f.jsx(ix,{inert:zh(!T),cutout:z}),f.jsx(yP,{id:A,children:X})]})}),Pre=b.createContext(void 0);function Ire(){const[e,t]=b.useState(0),n=st(()=>(t(o=>o+1),()=>{t(o=>Math.max(0,o-1))}));return{context:b.useMemo(()=>({register:n}),[n]),hasClosePart:e>0}}const zre=b.forwardRef(function(t,n){const{render:r,className:o,style:i,initialFocus:s,finalFocus:c,...d}=t,u=Qh(),p=Ore(),m=f1()!=null,{context:g,hasClosePart:y}=Ire(),v=u.useState("open"),S=u.useState("openMethod"),w=u.useState("instantType"),E=u.useState("transitionStatus"),k=u.useState("popupProps"),j=u.useState("titleElementId"),N=u.useState("descriptionElementId"),A=u.useState("modal"),R=u.useState("mounted"),M=u.useState("openChangeReason"),T=u.useState("activeTriggerElement"),O=u.useState("floatingRootContext"),z=O.useState("floatingId"),q=u.useState("disabled"),$=u.useState("openOnHover"),G=u.useState("closeDelay");ta({open:v,ref:u.context.popupRef,onComplete(){v&&u.context.onOpenChangeComplete?.(!0)}}),LP(O,{enabled:$&&!q,closeDelay:G});const L=s===void 0?_P(u.context.popupRef):s,F=A!==!1&&y;u.useSyncedValue("focusManagerModal",F);const P=u.useStateSetter("popupElement"),I={open:v,side:p.side,align:p.align,instant:w,transitionStatus:E},Y=wn("div",t,{state:I,ref:[n,u.context.popupRef,P],props:[k,{id:z,role:"dialog",...Wy,"aria-labelledby":j,"aria-describedby":N,onKeyDown(Z){m&&Lh.has(Z.key)&&Z.stopPropagation()}},sx(E),d],stateAttributesMapping:a1});return f.jsx(Gy,{context:O,openInteractionType:S,modal:F,disabled:!R||M===Dr,initialFocus:L,returnFocus:c,restoreFocus:"popup",previousFocusableElement:Nn(T)?T:void 0,nextFocusableElement:u.context.triggerFocusTargetRef,beforeContentFocusGuardRef:u.context.beforeContentFocusGuardRef,children:f.jsx(Pre.Provider,{value:g,children:Y})})});function V1({...e}){return f.jsx(jre,{"data-slot":"popover",...e})}function B1({...e}){return f.jsx(Tre,{"data-slot":"popover-trigger",...e})}function H1({className:e,align:t="center",alignOffset:n=0,side:r="bottom",sideOffset:o=4,...i}){return f.jsx(Are,{children:f.jsx(Dre,{align:t,alignOffset:n,side:r,sideOffset:o,className:"isolate z-50",children:f.jsx(zre,{"data-slot":"popover-content",className:Ct("z-50 flex w-72 origin-(--transform-origin) flex-col gap-2.5 rounded-lg bg-popover p-2.5 text-sm text-popover-foreground shadow-md ring-1 ring-foreground/10 outline-hidden duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",e),...i})})})}var DM=1,Lre=.9,Fre=.8,$re=.17,T0=.1,M0=.999,Vre=.9999,Bre=.99,Hre=/[\\\/_+.#"@\[\(\{&]/,Ure=/[\\\/_+.#"@\[\(\{&]/g,qre=/[\s-]/,lL=/[\s-]/g;function mS(e,t,n,r,o,i,s){if(i===t.length)return o===e.length?DM:Bre;var c=`${o},${i}`;if(s[c]!==void 0)return s[c];for(var d=r.charAt(i),u=n.indexOf(d,o),p=0,m,g,y,v;u>=0;)m=mS(e,t,n,r,u+1,i+1,s),m>p&&(u===o?m*=DM:Hre.test(e.charAt(u-1))?(m*=Fre,y=e.slice(o,u-1).match(Ure),y&&o>0&&(m*=Math.pow(M0,y.length))):qre.test(e.charAt(u-1))?(m*=Lre,v=e.slice(o,u-1).match(lL),v&&o>0&&(m*=Math.pow(M0,v.length))):(m*=$re,o>0&&(m*=Math.pow(M0,u-o))),e.charAt(u)!==t.charAt(i)&&(m*=Vre)),(m<T0&&n.charAt(u-1)===r.charAt(i+1)||r.charAt(i+1)===r.charAt(i)&&n.charAt(u-1)!==r.charAt(i))&&(g=mS(e,t,n,r,u+1,i+2,s),g*T0>m&&(m=g*T0)),m>p&&(p=m),u=n.indexOf(d,u+1);return s[c]=p,p}function PM(e){return e.toLowerCase().replace(lL," ")}function Yre(e,t,n){return e=n&&n.length>0?`${e+" "+n.join(" ")}`:e,mS(e,t,PM(e),PM(t),0,0,{})}var Zre=Object.defineProperty,ud=(e,t)=>Zre(e,"name",{value:t,configurable:!0}),cL=!!(typeof window<"u"&&window.document&&window.document.createElement);function Hl(e,t,{checkForDefaultPrevented:n=!0}={}){return ud(function(o){if(e?.(o),n===!1||!o||!o.defaultPrevented)return t?.(o)},"handleEvent")}ud(Hl,"composeEventHandlers");function Gre(e){if(!cL)throw new Error("Cannot access window outside of the DOM");return e?.ownerDocument?.defaultView??window}ud(Gre,"getOwnerWindow");function gS(e){if(!cL)throw new Error("Cannot access document outside of the DOM");return e?.ownerDocument??document}ud(gS,"getOwnerDocument");function uL(e,t=!1){const{activeElement:n}=gS(e);if(!n?.nodeName)return null;if(dL(n)&&n.contentDocument)return uL(n.contentDocument.body,t);if(t){const r=n.getAttribute("aria-activedescendant");if(r){const o=gS(n).getElementById(r);if(o)return o}}return n}ud(uL,"getActiveElement");function dL(e){return e.tagName==="IFRAME"}ud(dL,"isFrame");var Kre=Object.defineProperty,U1=(e,t)=>Kre(e,"name",{value:t,configurable:!0});function yS(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}U1(yS,"setRef");function rc(...e){return t=>{let n=!1;const r=e.map(o=>{const i=yS(o,t);return!n&&typeof i=="function"&&(n=!0),i});if(n)return()=>{for(let o=0;o<r.length;o++){const i=r[o];typeof i=="function"?i():yS(e[o],null)}}}}U1(rc,"composeRefs");function dd(...e){return b.useCallback(rc(...e),e)}U1(dd,"useComposedRefs");var Xre=Object.defineProperty,di=(e,t)=>Xre(e,"name",{value:t,configurable:!0});function Qre(e,t){const n=b.createContext(t);n.displayName=e+"Context";const r=di(i=>{const{children:s,...c}=i,d=b.useMemo(()=>c,Object.values(c));return f.jsx(n.Provider,{value:d,children:s})},"Provider");r.displayName=e+"Provider";function o(i,s={}){const{optional:c=!1}=s,d=b.useContext(n);if(d)return d;if(t!==void 0)return t;if(!c)throw new Error(`\`${i}\` must be used within \`${e}\``)}return di(o,"useContext"),[r,o]}di(Qre,"createContext");function fL(e,t=[]){let n=[];function r(i,s){const c=b.createContext(s);c.displayName=i+"Context";const d=n.length;n=[...n,s];const u=di(m=>{const{scope:g,children:y,...v}=m,S=g?.[e]?.[d]||c,w=b.useMemo(()=>v,Object.values(v));return f.jsx(S.Provider,{value:w,children:y})},"Provider");u.displayName=i+"Provider";function p(m,g,y={}){const{optional:v=!1}=y,S=g?.[e]?.[d]||c,w=b.useContext(S);if(w)return w;if(s!==void 0)return s;if(!v)throw new Error(`\`${m}\` must be used within \`${i}\``)}return di(p,"useContext"),[u,p]}di(r,"createContext");const o=di(()=>{const i=n.map(s=>b.createContext(s));return di(function(c){const d=c?.[e]||i;return b.useMemo(()=>({[`__scope${e}`]:{...c,[e]:d}}),[c,d])},"useScope")},"createScope");return o.scopeName=e,[r,hL(o,...t)]}di(fL,"createContextScope");function hL(...e){const t=e[0];if(e.length===1)return t;const n=di(()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return di(function(i){const s=r.reduce((c,{useScope:d,scopeName:u})=>{const m=d(i)[`__scope${u}`];return{...c,...m}},{});return b.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])},"useComposedScopes")},"createScope");return n.scopeName=t.scopeName,n}di(hL,"composeContextScopes");var Lu=globalThis?.document?b.useLayoutEffect:()=>{},Wre=Object.defineProperty,Jre=(e,t)=>Wre(e,"name",{value:t,configurable:!0}),eoe=dc[" useId ".trim().toString()]||(()=>{}),toe=0;function cs(e){const[t,n]=b.useState(eoe());return Lu(()=>{e||n(r=>r??String(toe++))},[e]),e||(t?`radix-${t}`:"")}Jre(cs,"useId");var noe=Object.defineProperty,roe=(e,t)=>noe(e,"name",{value:t,configurable:!0}),IM=dc[" useEffectEvent ".trim().toString()],zM=dc[" useInsertionEffect ".trim().toString()];function pL(e){if(typeof IM=="function")return IM(e);const t=b.useRef(()=>{throw new Error("Cannot call an event handler while rendering.")});return typeof zM=="function"?zM(()=>{t.current=e}):Lu(()=>{t.current=e}),b.useMemo(()=>((...n)=>t.current?.(...n)),[])}roe(pL,"useEffectEvent");var ooe=Object.defineProperty,Wh=(e,t)=>ooe(e,"name",{value:t,configurable:!0}),ioe=dc[" useInsertionEffect ".trim().toString()]||Lu;function mL({prop:e,defaultProp:t,onChange:n=Wh(()=>{},"onChange"),caller:r}){const[o,i,s]=gL({defaultProp:t,onChange:n}),c=e!==void 0,d=c?e:o,u=b.useCallback(p=>{if(c){const m=yL(p)?p(e):p;m!==e&&s.current?.(m)}else i(p)},[c,e,i,s]);return[d,u]}Wh(mL,"useControllableState");function gL({defaultProp:e,onChange:t}){const[n,r]=b.useState(e),o=b.useRef(n),i=b.useRef(t);return ioe(()=>{i.current=t},[t]),b.useEffect(()=>{o.current!==n&&(i.current?.(n),o.current=n)},[n,o]),[n,r,i]}Wh(gL,"useUncontrolledState");function yL(e){return typeof e=="function"}Wh(yL,"isFunction");var LM=Symbol("RADIX:SYNC_STATE");function soe(e,t,n,r){const{prop:o,defaultProp:i,onChange:s,caller:c}=t,d=o!==void 0,u=pL(s),p=[{...n,state:i}];r&&p.push(r);const[m,g]=b.useReducer((w,E)=>{if(E.type===LM)return{...w,state:E.state};const k=e(w,E);return d&&!Object.is(k.state,w.state)&&u(k.state),k},...p),y=m.state,v=b.useRef(y);b.useEffect(()=>{v.current!==y&&(v.current=y,d||u(y))},[y,v,d]);const S=b.useMemo(()=>o!==void 0?{...m,state:o}:m,[m,o]);return b.useEffect(()=>{d&&!Object.is(o,m.state)&&g({type:LM,state:o})},[o,m.state,d]),[S,g]}Wh(soe,"useControllableStateReducer");var aoe=Object.defineProperty,Vi=(e,t)=>aoe(e,"name",{value:t,configurable:!0});function q1(e){const t=b.forwardRef((n,r)=>{let{children:o,...i}=n,s=null,c=!1;const d=[];xS(o)&&typeof qm=="function"&&(o=qm(o._payload)),b.Children.forEach(o,g=>{if(wL(g)){c=!0;const y=g;let v="child"in y.props?y.props.child:y.props.children;xS(v)&&typeof qm=="function"&&(v=qm(v._payload)),s=coe(y,v),d.push(s?.props?.children)}else d.push(g)}),s?s=b.cloneElement(s,void 0,d):!c&&b.Children.count(o)===1&&b.isValidElement(o)&&(s=o);const u=s?bL(s):void 0,p=dd(r,u);if(!s){if(o||o===0)throw new Error(c?foe(e):doe(e));return o}const m=vL(i,s.props??{});return s.type!==b.Fragment&&(m.ref=r?p:u),b.cloneElement(s,m)});return t.displayName=`${e}.Slot`,t}Vi(q1,"createSlot");var xL=Symbol.for("radix.slottable");function loe(e){const t=Vi(n=>"child"in n?n.children(n.child):n.children,"Slottable");return t.displayName=`${e}.Slottable`,t.__radixId=xL,t}Vi(loe,"createSlottable");var coe=Vi((e,t)=>{if("child"in e.props){const n=e.props.child;return b.isValidElement(n)?b.cloneElement(n,void 0,e.props.children(n.props.children)):null}return b.isValidElement(t)?t:null},"getSlottableElementFromSlottable");function vL(e,t){const n={...t};for(const r in t){const o=e[r],i=t[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...c)=>{const d=i(...c);return o(...c),d}:o&&(n[r]=o):r==="style"?n[r]={...o,...i}:r==="className"&&(n[r]=[o,i].filter(Boolean).join(" "))}return{...e,...n}}Vi(vL,"mergeProps");function bL(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}Vi(bL,"getElementRef");function wL(e){return b.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===xL}Vi(wL,"isSlottable");var uoe=Symbol.for("react.lazy");function xS(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===uoe&&"_payload"in e&&SL(e._payload)}Vi(xS,"isLazyComponent");function SL(e){return typeof e=="object"&&e!==null&&"then"in e}Vi(SL,"isPromiseLike");var doe=Vi(e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,"createSlotError"),foe=Vi(e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,"createSlottableError"),qm=dc[" use ".trim().toString()],hoe=Object.defineProperty,poe=(e,t)=>hoe(e,"name",{value:t,configurable:!0}),moe=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],vi=moe.reduce((e,t)=>{const n=q1(`Primitive.${t}`),r=b.forwardRef((o,i)=>{const{asChild:s,...c}=o,d=s?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),f.jsx(d,{...c,ref:i})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function EL(e,t){e&&Go.flushSync(()=>e.dispatchEvent(t))}poe(EL,"dispatchDiscreteCustomEvent");var goe=Object.defineProperty,yoe=(e,t)=>goe(e,"name",{value:t,configurable:!0});function Fu(e){const t=b.useRef(e);return b.useEffect(()=>{t.current=e}),b.useMemo(()=>((...n)=>t.current?.(...n)),[])}yoe(Fu,"useCallbackRef");var xoe=Object.defineProperty,Pr=(e,t)=>xoe(e,"name",{value:t,configurable:!0}),vS="dismissableLayer.update",voe="dismissableLayer.pointerDownOutside",boe="dismissableLayer.focusOutside",FM,CL=b.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),woe=b.forwardRef(Pr(function(t,n){const{disableOutsidePointerEvents:r=!1,deferPointerDownOutside:o=!1,onEscapeKeyDown:i,onPointerDownOutside:s,onFocusOutside:c,onInteractOutside:d,onDismiss:u,...p}=t,m=b.useContext(CL),[g,y]=b.useState(null),v=g?.ownerDocument??globalThis?.document,[,S]=b.useState({}),w=dd(n,y),E=Array.from(m.layers),[k]=[...m.layersWithOutsidePointerEventsDisabled].slice(-1),j=k?E.indexOf(k):-1,N=g?E.indexOf(g):-1,A=m.layersWithOutsidePointerEventsDisabled.size>0,R=N>=j,M=b.useRef(!1),T=jL($=>{s?.($),d?.($),$.defaultPrevented||u?.()},{ownerDocument:v,deferPointerDownOutside:o,isDeferredPointerDownOutsideRef:M,dismissableSurfaces:m.dismissableSurfaces,shouldHandlePointerDownOutside:b.useCallback($=>{if(!($ instanceof Node))return!1;const G=[...m.branches].some(L=>L.contains($));return R&&!G},[m.branches,R])}),O=RL($=>{if(o&&M.current)return;const G=$.target;[...m.branches].some(F=>F.contains(G))||(c?.($),d?.($),$.defaultPrevented||u?.())},v),z=g?N===E.length-1:!1,q=Fu($=>{$.key==="Escape"&&(i?.($),!$.defaultPrevented&&u&&($.preventDefault(),u()))});return b.useEffect(()=>{if(z)return v.addEventListener("keydown",q,{capture:!0}),()=>v.removeEventListener("keydown",q,{capture:!0})},[v,z,q]),b.useEffect(()=>{if(g)return r&&(m.layersWithOutsidePointerEventsDisabled.size===0&&(FM=v.body.style.pointerEvents,v.body.style.pointerEvents="none"),m.layersWithOutsidePointerEventsDisabled.add(g)),m.layers.add(g),bS(),()=>{r&&(m.layersWithOutsidePointerEventsDisabled.delete(g),m.layersWithOutsidePointerEventsDisabled.size===0&&(v.body.style.pointerEvents=FM))}},[g,v,r,m]),b.useEffect(()=>()=>{g&&(m.layers.delete(g),m.layersWithOutsidePointerEventsDisabled.delete(g),bS())},[g,m]),b.useEffect(()=>{const $=Pr(()=>S({}),"handleUpdate");return document.addEventListener(vS,$),()=>document.removeEventListener(vS,$)},[]),f.jsx(vi.div,{...p,ref:w,style:{pointerEvents:A?R?"auto":"none":void 0,...t.style},onFocusCapture:Hl(t.onFocusCapture,O.onFocusCapture),onBlurCapture:Hl(t.onBlurCapture,O.onBlurCapture),onPointerDownCapture:Hl(t.onPointerDownCapture,T.onPointerDownCapture)})},"DismissableLayer"));function kL(){const e=b.useContext(CL),[t,n]=b.useState(null);return b.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}Pr(kL,"useDismissableLayerSurface");var Soe=Pr(()=>!0,"IS_TRUE");function jL(e,t){const{ownerDocument:n=globalThis?.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:o,dismissableSurfaces:i,shouldHandlePointerDownOutside:s=Soe}=t,c=Fu(e),d=b.useRef(!1),u=b.useRef(!1),p=b.useRef(new Map),m=b.useRef(()=>{});return b.useEffect(()=>{function g(){u.current=!1,o.current=!1,p.current.clear()}Pr(g,"resetOutsideInteraction");function y(){return Array.from(p.current.values()).some(Boolean)}Pr(y,"isOutsideInteractionIntercepted");function v(j){if(!u.current)return;const N=j.target;N instanceof Node&&[...i].some(R=>R.contains(N))||p.current.set(j.type,!0),j.type==="click"&&window.setTimeout(()=>{u.current&&m.current()},0)}Pr(v,"handleInteractionCapture");function S(j){u.current&&p.current.set(j.type,!1)}Pr(S,"handleInteractionBubble");const w=Pr(j=>{if(j.target&&!d.current){let N=function(){n.removeEventListener("click",m.current);const R=y();g(),R||Y1(voe,c,A,{discrete:!0})};if(Pr(N,"handleAndDispatchPointerDownOutsideEvent"),!s(j.target)){n.removeEventListener("click",m.current),g(),d.current=!1;return}const A={originalEvent:j};u.current=!0,o.current=r&&j.button===0,p.current.clear(),!r||j.button!==0?N():(n.removeEventListener("click",m.current),m.current=N,n.addEventListener("click",m.current,{once:!0}))}else n.removeEventListener("click",m.current),g();d.current=!1},"handlePointerDown"),E=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(const j of E)n.addEventListener(j,v,!0),n.addEventListener(j,S);const k=window.setTimeout(()=>{n.addEventListener("pointerdown",w)},0);return()=>{window.clearTimeout(k),n.removeEventListener("pointerdown",w),n.removeEventListener("click",m.current);for(const j of E)n.removeEventListener(j,v,!0),n.removeEventListener(j,S)}},[n,c,r,o,i,s]),{onPointerDownCapture:Pr(()=>d.current=!0,"onPointerDownCapture")}}Pr(jL,"usePointerDownOutside");function RL(e,t=globalThis?.document){const n=Fu(e),r=b.useRef(!1);return b.useEffect(()=>{const o=Pr(i=>{i.target&&!r.current&&Y1(boe,n,{originalEvent:i},{discrete:!1})},"handleFocus");return t.addEventListener("focusin",o),()=>t.removeEventListener("focusin",o)},[t,n]),{onFocusCapture:Pr(()=>r.current=!0,"onFocusCapture"),onBlurCapture:Pr(()=>r.current=!1,"onBlurCapture")}}Pr(RL,"useFocusOutside");function bS(){const e=new CustomEvent(vS);document.dispatchEvent(e)}Pr(bS,"dispatchUpdate");function Y1(e,t,n,{discrete:r}){const o=n.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?EL(o,i):o.dispatchEvent(i)}Pr(Y1,"handleAndDispatchCustomEvent");var Eoe=Object.defineProperty,uo=(e,t)=>Eoe(e,"name",{value:t,configurable:!0}),A0="focusScope.autoFocusOnMount",O0="focusScope.autoFocusOnUnmount",$M={bubbles:!1,cancelable:!0},Coe=b.forwardRef(uo(function(t,n){const{loop:r=!1,trapped:o=!1,onMountAutoFocus:i,onUnmountAutoFocus:s,...c}=t,[d,u]=b.useState(null),p=Fu(i),m=Fu(s),g=b.useRef(null),y=dd(n,u),v=b.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;b.useEffect(()=>{if(o){let w=function(N){if(v.paused||!d)return;const A=N.target;d.contains(A)?g.current=A:Vs(g.current,{select:!0})},E=function(N){if(v.paused||!d)return;const A=N.relatedTarget;A!==null&&(d.contains(A)||Vs(g.current,{select:!0}))},k=function(N){if(document.activeElement===document.body)for(const R of N)R.removedNodes.length>0&&Vs(d)};uo(w,"handleFocusIn"),uo(E,"handleFocusOut"),uo(k,"handleMutations"),document.addEventListener("focusin",w),document.addEventListener("focusout",E);const j=new MutationObserver(k);return d&&j.observe(d,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",w),document.removeEventListener("focusout",E),j.disconnect()}}},[o,d,v.paused]),b.useEffect(()=>{if(d){VM.add(v);const w=document.activeElement;if(!d.contains(w)){const k=new CustomEvent(A0,$M);d.addEventListener(A0,p),d.dispatchEvent(k),k.defaultPrevented||(_L(OL(Z1(d)),{select:!0}),document.activeElement===w&&Vs(d))}return()=>{d.removeEventListener(A0,p),setTimeout(()=>{const k=new CustomEvent(O0,$M);d.addEventListener(O0,m),d.dispatchEvent(k),k.defaultPrevented||Vs(w??document.body,{select:!0}),d.removeEventListener(O0,m),VM.remove(v)},0)}}},[d,p,m,v]);const S=b.useCallback(w=>{if(!r&&!o||v.paused)return;const E=w.key==="Tab"&&!w.altKey&&!w.ctrlKey&&!w.metaKey,k=document.activeElement;if(E&&k){const j=w.currentTarget,[N,A]=NL(j);N&&A?!w.shiftKey&&k===A?(w.preventDefault(),r&&Vs(N,{select:!0})):w.shiftKey&&k===N&&(w.preventDefault(),r&&Vs(A,{select:!0})):k===j&&w.preventDefault()}},[r,o,v.paused]);return f.jsx(vi.div,{tabIndex:-1,...c,ref:y,onKeyDown:S})},"FocusScope"));function _L(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(Vs(r,{select:t}),document.activeElement!==n)return}uo(_L,"focusFirst");function NL(e){const t=Z1(e),n=wS(t,e),r=wS(t.reverse(),e);return[n,r]}uo(NL,"getTabbableEdges");function Z1(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:uo(r=>{const o=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||o?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP},"acceptNode")});for(;n.nextNode();)t.push(n.currentNode);return t}uo(Z1,"getTabbableCandidates");function wS(e,t){const n=typeof t.checkVisibility=="function"&&t.checkVisibility({checkVisibilityCSS:!0});for(const r of e)if(!(n?!r.checkVisibility({checkVisibilityCSS:!0}):TL(r,{upTo:t})))return r}uo(wS,"findVisible");function TL(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}uo(TL,"isHidden");function ML(e){return e instanceof HTMLInputElement&&"select"in e}uo(ML,"isSelectableInput");function Vs(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&ML(e)&&t&&e.select()}}uo(Vs,"focus");var VM=AL();function AL(){let e=[];return{add(t){const n=e[0];t!==n&&n?.pause(),e=SS(e,t),e.unshift(t)},remove(t){e=SS(e,t),e[0]?.resume()}}}uo(AL,"createFocusScopesStack");function SS(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}uo(SS,"arrayRemove");function OL(e){return e.filter(t=>t.tagName!=="A")}uo(OL,"removeLinks");var koe=Object.defineProperty,joe=(e,t)=>koe(e,"name",{value:t,configurable:!0}),Roe=b.forwardRef(joe(function(t,n){const{container:r,...o}=t,[i,s]=b.useState(!1);Lu(()=>s(!0),[]);const c=r||i&&globalThis?.document?.body;return c?Go.createPortal(f.jsx(vi.div,{...o,ref:n}),c):null},"Portal")),_oe=Object.defineProperty,Qs=(e,t)=>_oe(e,"name",{value:t,configurable:!0});function DL(e,t){return b.useReducer((n,r)=>t[n][r]??n,e)}Qs(DL,"useStateMachine");var G1=Qs(e=>{const{present:t,children:n}=e,r=PL(t),o=typeof n=="function"?n({present:r.isPresent}):b.Children.only(n),i=IL(r.ref,zL(o));return typeof n=="function"||r.isPresent?b.cloneElement(o,{ref:i}):null},"Presence");function PL(e){const[t,n]=b.useState(),r=b.useRef(null),o=b.useRef(e),i=b.useRef("none"),s=b.useRef(void 0),c=e?"mounted":"unmounted",[d,u]=DL(c,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return b.useEffect(()=>{d==="mounted"?(i.current=s.current??gu(r.current),s.current=void 0):i.current="none"},[d]),Lu(()=>{const p=r.current,m=o.current;if(m!==e){const y=i.current,v=gu(p);e?(s.current=v,u("MOUNT")):v==="none"||p?.display==="none"?u("UNMOUNT"):u(m&&y!==v?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,u]),Lu(()=>{if(t){let p;const m=t.ownerDocument.defaultView??window,g=Qs(v=>{const w=gu(r.current).includes(CSS.escape(v.animationName));if(v.target===t&&w&&(u("ANIMATION_END"),!o.current)){const E=t.style.animationFillMode;t.style.animationFillMode="forwards",p=m.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=E)})}},"handleAnimationEnd"),y=Qs(v=>{v.target===t&&(i.current=gu(r.current))},"handleAnimationStart");return t.addEventListener("animationstart",y),t.addEventListener("animationcancel",g),t.addEventListener("animationend",g),()=>{m.clearTimeout(p),t.removeEventListener("animationstart",y),t.removeEventListener("animationcancel",g),t.removeEventListener("animationend",g)}}else u("ANIMATION_END")},[t,u]),{isPresent:["mounted","unmountSuspended"].includes(d),ref:b.useCallback(p=>{if(p){const m=getComputedStyle(p);r.current=m,s.current=gu(m)}else r.current=null;n(p)},[])}}Qs(PL,"usePresence");function ES(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}Qs(ES,"setRef");function IL(...e){const t=b.useRef(e);return t.current=e,b.useCallback(n=>{const r=t.current;let o=!1;const i=r.map(s=>{const c=ES(s,n);return!o&&typeof c=="function"&&(o=!0),c});if(o)return()=>{for(let s=0;s<i.length;s++){const c=i[s];typeof c=="function"?c():ES(r[s],null)}}},[])}Qs(IL,"useStableComposedRefs");function gu(e){return e?.animationName||"none"}Qs(gu,"getAnimationName");function zL(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}Qs(zL,"getElementRef");var Noe=Object.defineProperty,K1=(e,t)=>Noe(e,"name",{value:t,configurable:!0}),Ym=0,ru=null;function Toe(e){return X1(),e.children}K1(Toe,"FocusGuards");function X1(){b.useEffect(()=>{ru||(ru={start:CS(),end:CS()});const{start:e,end:t}=ru;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement("afterbegin",e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement("beforeend",t),Ym++,()=>{Ym===1&&(ru?.start.remove(),ru?.end.remove(),ru=null),Ym=Math.max(0,Ym-1)}},[])}K1(X1,"useFocusGuards");function CS(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}K1(CS,"createFocusGuard");var is=function(){return is=Object.assign||function(t){for(var n,r=1,o=arguments.length;r<o;r++){n=arguments[r];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},is.apply(this,arguments)};function LL(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]]);return n}function Moe(e,t,n){if(n||arguments.length===2)for(var r=0,o=t.length,i;r<o;r++)(i||!(r in t))&&(i||(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||Array.prototype.slice.call(t))}var Sg="right-scroll-bar-position",Eg="width-before-scroll-bar",Aoe="with-scroll-bars-hidden",Ooe="--removed-body-scroll-bar-size";function D0(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function Doe(e,t){var n=b.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var o=n.value;o!==r&&(n.value=r,n.callback(r,o))}}}})[0];return n.callback=t,n.facade}var Poe=typeof window<"u"?b.useLayoutEffect:b.useEffect,BM=new WeakMap;function Ioe(e,t){var n=Doe(null,function(r){return e.forEach(function(o){return D0(o,r)})});return Poe(function(){var r=BM.get(n);if(r){var o=new Set(r),i=new Set(e),s=n.current;o.forEach(function(c){i.has(c)||D0(c,null)}),i.forEach(function(c){o.has(c)||D0(c,s)})}BM.set(n,e)},[e]),n}function zoe(e){return e}function Loe(e,t){t===void 0&&(t=zoe);var n=[],r=!1,o={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(i){var s=t(i,r);return n.push(s),function(){n=n.filter(function(c){return c!==s})}},assignSyncMedium:function(i){for(r=!0;n.length;){var s=n;n=[],s.forEach(i)}n={push:function(c){return i(c)},filter:function(){return n}}},assignMedium:function(i){r=!0;var s=[];if(n.length){var c=n;n=[],c.forEach(i),s=n}var d=function(){var p=s;s=[],p.forEach(i)},u=function(){return Promise.resolve().then(d)};u(),n={push:function(p){s.push(p),u()},filter:function(p){return s=s.filter(p),n}}}};return o}function Foe(e){e===void 0&&(e={});var t=Loe(null);return t.options=is({async:!0,ssr:!1},e),t}var FL=function(e){var t=e.sideCar,n=LL(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return b.createElement(r,is({},n))};FL.isSideCarExport=!0;function $oe(e,t){return e.useMedium(t),FL}var $L=Foe(),P0=function(){},Rx=b.forwardRef(function(e,t){var n=b.useRef(null),r=b.useState({onScrollCapture:P0,onWheelCapture:P0,onTouchMoveCapture:P0}),o=r[0],i=r[1],s=e.forwardProps,c=e.children,d=e.className,u=e.removeScrollBar,p=e.enabled,m=e.shards,g=e.sideCar,y=e.noRelative,v=e.noIsolation,S=e.inert,w=e.allowPinchZoom,E=e.as,k=E===void 0?"div":E,j=e.gapMode,N=LL(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),A=g,R=Ioe([n,t]),M=is(is({},N),o);return b.createElement(b.Fragment,null,p&&b.createElement(A,{sideCar:$L,removeScrollBar:u,shards:m,noRelative:y,noIsolation:v,inert:S,setCallbacks:i,allowPinchZoom:!!w,lockRef:n,gapMode:j}),s?b.cloneElement(b.Children.only(c),is(is({},M),{ref:R})):b.createElement(k,is({},M,{className:d,ref:R}),c))});Rx.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Rx.classNames={fullWidth:Eg,zeroRight:Sg};var Voe=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function Boe(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=Voe();return t&&e.setAttribute("nonce",t),e}function Hoe(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function Uoe(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var qoe=function(){var e=0,t=null;return{add:function(n){e==0&&(t=Boe())&&(Hoe(t,n),Uoe(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Yoe=function(){var e=qoe();return function(t,n){b.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},VL=function(){var e=Yoe(),t=function(n){var r=n.styles,o=n.dynamic;return e(r,o),null};return t},Zoe={left:0,top:0,right:0,gap:0},I0=function(e){return parseInt(e||"",10)||0},Goe=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],o=t[e==="padding"?"paddingRight":"marginRight"];return[I0(n),I0(r),I0(o)]},Koe=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return Zoe;var t=Goe(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},Xoe=VL(),Nu="data-scroll-locked",Qoe=function(e,t,n,r){var o=e.left,i=e.top,s=e.right,c=e.gap;return n===void 0&&(n="margin"),`
76
+ .`.concat(Aoe,` {
77
+ overflow: hidden `).concat(r,`;
78
+ padding-right: `).concat(c,"px ").concat(r,`;
79
+ }
80
+ body[`).concat(Nu,`] {
81
+ overflow: hidden `).concat(r,`;
82
+ overscroll-behavior: contain;
83
+ `).concat([t&&"position: relative ".concat(r,";"),n==="margin"&&`
84
+ padding-left: `.concat(o,`px;
85
+ padding-top: `).concat(i,`px;
86
+ padding-right: `).concat(s,`px;
87
+ margin-left:0;
88
+ margin-top:0;
89
+ margin-right: `).concat(c,"px ").concat(r,`;
90
+ `),n==="padding"&&"padding-right: ".concat(c,"px ").concat(r,";")].filter(Boolean).join(""),`
91
+ }
92
+
93
+ .`).concat(Sg,` {
94
+ right: `).concat(c,"px ").concat(r,`;
95
+ }
96
+
97
+ .`).concat(Eg,` {
98
+ margin-right: `).concat(c,"px ").concat(r,`;
99
+ }
100
+
101
+ .`).concat(Sg," .").concat(Sg,` {
102
+ right: 0 `).concat(r,`;
103
+ }
104
+
105
+ .`).concat(Eg," .").concat(Eg,` {
106
+ margin-right: 0 `).concat(r,`;
107
+ }
108
+
109
+ body[`).concat(Nu,`] {
110
+ `).concat(Ooe,": ").concat(c,`px;
111
+ }
112
+ `)},HM=function(){var e=parseInt(document.body.getAttribute(Nu)||"0",10);return isFinite(e)?e:0},Woe=function(){b.useEffect(function(){return document.body.setAttribute(Nu,(HM()+1).toString()),function(){var e=HM()-1;e<=0?document.body.removeAttribute(Nu):document.body.setAttribute(Nu,e.toString())}},[])},Joe=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,o=r===void 0?"margin":r;Woe();var i=b.useMemo(function(){return Koe(o)},[o]);return b.createElement(Xoe,{styles:Qoe(i,!t,o,n?"":"!important")})},kS=!1;if(typeof window<"u")try{var Zm=Object.defineProperty({},"passive",{get:function(){return kS=!0,!0}});window.addEventListener("test",Zm,Zm),window.removeEventListener("test",Zm,Zm)}catch{kS=!1}var ou=kS?{passive:!1}:!1,eie=function(e){return e.tagName==="TEXTAREA"},BL=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!eie(e)&&n[t]==="visible")},tie=function(e){return BL(e,"overflowY")},nie=function(e){return BL(e,"overflowX")},UM=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var o=HL(e,r);if(o){var i=UL(e,r),s=i[1],c=i[2];if(s>c)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},rie=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},oie=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},HL=function(e,t){return e==="v"?tie(t):nie(t)},UL=function(e,t){return e==="v"?rie(t):oie(t)},iie=function(e,t){return e==="h"&&t==="rtl"?-1:1},sie=function(e,t,n,r,o){var i=iie(e,window.getComputedStyle(t).direction),s=i*r,c=n.target,d=t.contains(c),u=!1,p=s>0,m=0,g=0;do{if(!c)break;var y=UL(e,c),v=y[0],S=y[1],w=y[2],E=S-w-i*v;(v||E)&&HL(e,c)&&(m+=E,g+=v);var k=c.parentNode;c=k&&k.nodeType===Node.DOCUMENT_FRAGMENT_NODE?k.host:k}while(!d&&c!==document.body||d&&(t.contains(c)||t===c));return(p&&Math.abs(m)<1||!p&&Math.abs(g)<1)&&(u=!0),u},Gm=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},qM=function(e){return[e.deltaX,e.deltaY]},YM=function(e){return e&&"current"in e?e.current:e},aie=function(e,t){return e[0]===t[0]&&e[1]===t[1]},lie=function(e){return`
113
+ .block-interactivity-`.concat(e,` {pointer-events: none;}
114
+ .allow-interactivity-`).concat(e,` {pointer-events: all;}
115
+ `)},cie=0,iu=[];function uie(e){var t=b.useRef([]),n=b.useRef([0,0]),r=b.useRef(),o=b.useState(cie++)[0],i=b.useState(VL)[0],s=b.useRef(e);b.useEffect(function(){s.current=e},[e]),b.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var S=Moe([e.lockRef.current],(e.shards||[]).map(YM),!0).filter(Boolean);return S.forEach(function(w){return w.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),S.forEach(function(w){return w.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var c=b.useCallback(function(S,w){if("touches"in S&&S.touches.length===2||S.type==="wheel"&&S.ctrlKey)return!s.current.allowPinchZoom;var E=Gm(S),k=n.current,j="deltaX"in S?S.deltaX:k[0]-E[0],N="deltaY"in S?S.deltaY:k[1]-E[1],A,R=S.target,M=Math.abs(j)>Math.abs(N)?"h":"v";if("touches"in S&&M==="h"&&R.type==="range")return!1;var T=window.getSelection(),O=T&&T.anchorNode,z=O?O===R||O.contains(R):!1;if(z)return!1;var q=UM(M,R);if(!q)return!0;if(q?A=M:(A=M==="v"?"h":"v",q=UM(M,R)),!q)return!1;if(!r.current&&"changedTouches"in S&&(j||N)&&(r.current=A),!A)return!0;var $=r.current||A;return sie($,w,S,$==="h"?j:N)},[]),d=b.useCallback(function(S){var w=S;if(!(!iu.length||iu[iu.length-1]!==i)){var E="deltaY"in w?qM(w):Gm(w),k=t.current.filter(function(A){return A.name===w.type&&(A.target===w.target||w.target===A.shadowParent)&&aie(A.delta,E)})[0];if(k&&k.should){w.cancelable&&w.preventDefault();return}if(!k){var j=(s.current.shards||[]).map(YM).filter(Boolean).filter(function(A){return A.contains(w.target)}),N=j.length>0?c(w,j[0]):!s.current.noIsolation;N&&w.cancelable&&w.preventDefault()}}},[]),u=b.useCallback(function(S,w,E,k){var j={name:S,delta:w,target:E,should:k,shadowParent:die(E)};t.current.push(j),setTimeout(function(){t.current=t.current.filter(function(N){return N!==j})},1)},[]),p=b.useCallback(function(S){n.current=Gm(S),r.current=void 0},[]),m=b.useCallback(function(S){u(S.type,qM(S),S.target,c(S,e.lockRef.current))},[]),g=b.useCallback(function(S){u(S.type,Gm(S),S.target,c(S,e.lockRef.current))},[]);b.useEffect(function(){return iu.push(i),e.setCallbacks({onScrollCapture:m,onWheelCapture:m,onTouchMoveCapture:g}),document.addEventListener("wheel",d,ou),document.addEventListener("touchmove",d,ou),document.addEventListener("touchstart",p,ou),function(){iu=iu.filter(function(S){return S!==i}),document.removeEventListener("wheel",d,ou),document.removeEventListener("touchmove",d,ou),document.removeEventListener("touchstart",p,ou)}},[]);var y=e.removeScrollBar,v=e.inert;return b.createElement(b.Fragment,null,v?b.createElement(i,{styles:lie(o)}):null,y?b.createElement(Joe,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function die(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const fie=$oe($L,uie);var qL=b.forwardRef(function(e,t){return b.createElement(Rx,is({},e,{ref:t,sideCar:fie}))});qL.classNames=Rx.classNames;var hie=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},su=new WeakMap,Km=new WeakMap,Xm={},z0=0,YL=function(e){return e&&(e.host||YL(e.parentNode))},pie=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=YL(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},mie=function(e,t,n,r){var o=pie(t,Array.isArray(e)?e:[e]);Xm[n]||(Xm[n]=new WeakMap);var i=Xm[n],s=[],c=new Set,d=new Set(o),u=function(m){!m||c.has(m)||(c.add(m),u(m.parentNode))};o.forEach(u);var p=function(m){!m||d.has(m)||Array.prototype.forEach.call(m.children,function(g){if(c.has(g))p(g);else try{var y=g.getAttribute(r),v=y!==null&&y!=="false",S=(su.get(g)||0)+1,w=(i.get(g)||0)+1;su.set(g,S),i.set(g,w),s.push(g),S===1&&v&&Km.set(g,!0),w===1&&g.setAttribute(n,"true"),v||g.setAttribute(r,"true")}catch(E){console.error("aria-hidden: cannot operate on ",g,E)}})};return p(t),c.clear(),z0++,function(){s.forEach(function(m){var g=su.get(m)-1,y=i.get(m)-1;su.set(m,g),i.set(m,y),g||(Km.has(m)||m.removeAttribute(r),Km.delete(m)),y||m.removeAttribute(n)}),z0--,z0||(su=new WeakMap,su=new WeakMap,Km=new WeakMap,Xm={})}},gie=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),o=hie(e);return o?(r.push.apply(r,Array.from(o.querySelectorAll("[aria-live], script"))),mie(r,o,n,"aria-hidden")):function(){return null}},yie=Object.defineProperty,sa=(e,t)=>yie(e,"name",{value:t,configurable:!0}),Q1="Dialog",[ZL,mEe]=fL(Q1),[xie,bc]=ZL(Q1),vie=sa(e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:o,onOpenChange:i,modal:s=!0}=e,c=b.useRef(null),d=b.useRef(null),[u,p]=mL({prop:r,defaultProp:o??!1,onChange:i,caller:Q1}),[m,g]=b.useState(0),[y,v]=b.useState(0);return f.jsx(xie,{scope:t,triggerRef:c,contentRef:d,contentId:cs(),titleId:cs(),descriptionId:cs(),titlePresent:m>0,descriptionPresent:y>0,setTitleCount:g,setDescriptionCount:v,open:u,onOpenChange:p,onOpenToggle:b.useCallback(()=>p(S=>!S),[p]),modal:s,children:n})},"Dialog"),GL="DialogPortal",[bie,KL]=ZL(GL,{forceMount:void 0}),wie=sa(e=>{const{__scopeDialog:t,forceMount:n,children:r,container:o}=e,i=bc(GL,t);return f.jsx(bie,{scope:t,forceMount:n,children:b.Children.map(r,s=>f.jsx(G1,{present:n||i.open,children:f.jsx(Roe,{asChild:!0,container:o,children:s})}))})},"DialogPortal"),jS="DialogOverlay",Sie=b.forwardRef(sa(function(t,n){const r=KL(jS,t.__scopeDialog),{forceMount:o=r.forceMount,...i}=t,s=bc(jS,t.__scopeDialog);return s.modal?f.jsx(G1,{present:o||s.open,children:f.jsx(Cie,{...i,ref:n})}):null},"DialogOverlay")),Eie=q1("DialogOverlay.RemoveScroll"),Cie=b.forwardRef(sa(function(t,n){const{__scopeDialog:r,...o}=t,i=bc(jS,r),s=kL(),c=dd(n,s);return f.jsx(qL,{as:Eie,allowPinchZoom:!0,shards:[i.contentRef],children:f.jsx(vi.div,{"data-state":W1(i.open),...o,ref:c,style:{pointerEvents:"auto",...o.style}})})},"DialogOverlayImpl")),sh="DialogContent",kie=b.forwardRef(sa(function(t,n){const r=KL(sh,t.__scopeDialog),{forceMount:o=r.forceMount,...i}=t,s=bc(sh,t.__scopeDialog);return f.jsx(G1,{present:o||s.open,children:s.modal?f.jsx(jie,{...i,ref:n}):f.jsx(Rie,{...i,ref:n})})},"DialogContent")),jie=b.forwardRef(sa(function(t,n){const r=bc(sh,t.__scopeDialog),o=b.useRef(null),i=dd(n,r.contentRef,o);return b.useEffect(()=>{const s=o.current;if(s)return gie(s)},[]),f.jsx(XL,{...t,ref:i,trapFocus:r.open,disableOutsidePointerEvents:r.open,onCloseAutoFocus:Hl(t.onCloseAutoFocus,s=>{s.preventDefault(),r.triggerRef.current?.focus()}),onPointerDownOutside:Hl(t.onPointerDownOutside,s=>{const c=s.detail.originalEvent,d=c.button===0&&c.ctrlKey===!0;(c.button===2||d)&&s.preventDefault()}),onFocusOutside:Hl(t.onFocusOutside,s=>s.preventDefault())})},"DialogContentModal")),Rie=b.forwardRef(sa(function(t,n){const r=bc(sh,t.__scopeDialog),o=b.useRef(!1),i=b.useRef(!1);return f.jsx(XL,{...t,ref:n,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{t.onCloseAutoFocus?.(s),s.defaultPrevented||(o.current||r.triggerRef.current?.focus(),s.preventDefault()),o.current=!1,i.current=!1},onInteractOutside:s=>{t.onInteractOutside?.(s),s.defaultPrevented||(o.current=!0,s.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const c=s.target;r.triggerRef.current?.contains(c)&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&i.current&&s.preventDefault()}})},"DialogContentNonModal")),XL=b.forwardRef(sa(function(t,n){const{__scopeDialog:r,trapFocus:o,onOpenAutoFocus:i,onCloseAutoFocus:s,...c}=t,d=bc(sh,r);return X1(),f.jsx(f.Fragment,{children:f.jsx(Coe,{asChild:!0,loop:!0,trapped:o,onMountAutoFocus:i,onUnmountAutoFocus:s,children:f.jsx(woe,{role:"dialog",id:d.contentId,"aria-describedby":d.descriptionPresent?d.descriptionId:void 0,"aria-labelledby":d.titlePresent?d.titleId:void 0,"data-state":W1(d.open),...c,ref:n,deferPointerDownOutside:!0,onDismiss:()=>d.onOpenChange(!1)})})})},"DialogContentImpl"));function W1(e){return e?"open":"closed"}sa(W1,"getState");var pf='[cmdk-group=""]',L0='[cmdk-group-items=""]',_ie='[cmdk-group-heading=""]',QL='[cmdk-item=""]',ZM=`${QL}:not([aria-disabled="true"])`,RS="cmdk-item-select",yu="data-value",Nie=(e,t,n)=>Yre(e,t,n),WL=b.createContext(void 0),Jh=()=>b.useContext(WL),JL=b.createContext(void 0),J1=()=>b.useContext(JL),e4=b.createContext(void 0),t4=b.forwardRef((e,t)=>{let n=xu(()=>{var U,B;return{search:"",value:(B=(U=e.value)!=null?U:e.defaultValue)!=null?B:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),r=xu(()=>new Set),o=xu(()=>new Map),i=xu(()=>new Map),s=xu(()=>new Set),c=n4(e),{label:d,children:u,value:p,onValueChange:m,filter:g,shouldFilter:y,loop:v,disablePointerSelection:S=!1,vimBindings:w=!0,...E}=e,k=cs(),j=cs(),N=cs(),A=b.useRef(null),R=$ie();oc(()=>{if(p!==void 0){let U=p.trim();n.current.value=U,M.emit()}},[p]),oc(()=>{R(6,G)},[]);let M=b.useMemo(()=>({subscribe:U=>(s.current.add(U),()=>s.current.delete(U)),snapshot:()=>n.current,setState:(U,B,X)=>{var J,Q,oe,W;if(!Object.is(n.current[U],B)){if(n.current[U]=B,U==="search")$(),z(),R(1,q);else if(U==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let ne=document.getElementById(N);ne?ne.focus():(J=document.getElementById(k))==null||J.focus()}if(R(7,()=>{var ne;n.current.selectedItemId=(ne=L())==null?void 0:ne.id,M.emit()}),X||R(5,G),((Q=c.current)==null?void 0:Q.value)!==void 0){let ne=B??"";(W=(oe=c.current).onValueChange)==null||W.call(oe,ne);return}}M.emit()}},emit:()=>{s.current.forEach(U=>U())}}),[]),T=b.useMemo(()=>({value:(U,B,X)=>{var J;B!==((J=i.current.get(U))==null?void 0:J.value)&&(i.current.set(U,{value:B,keywords:X}),n.current.filtered.items.set(U,O(B,X)),R(2,()=>{z(),M.emit()}))},item:(U,B)=>(r.current.add(U),B&&(o.current.has(B)?o.current.get(B).add(U):o.current.set(B,new Set([U]))),R(3,()=>{$(),z(),n.current.value||q(),M.emit()}),()=>{i.current.delete(U),r.current.delete(U),n.current.filtered.items.delete(U);let X=L();R(4,()=>{$(),X?.getAttribute("id")===U&&q(),M.emit()})}),group:U=>(o.current.has(U)||o.current.set(U,new Set),()=>{i.current.delete(U),o.current.delete(U)}),filter:()=>c.current.shouldFilter,label:d||e["aria-label"],getDisablePointerSelection:()=>c.current.disablePointerSelection,listId:k,inputId:N,labelId:j,listInnerRef:A}),[]);function O(U,B){var X,J;let Q=(J=(X=c.current)==null?void 0:X.filter)!=null?J:Nie;return U?Q(U,n.current.search,B):0}function z(){if(!n.current.search||c.current.shouldFilter===!1)return;let U=n.current.filtered.items,B=[];n.current.filtered.groups.forEach(J=>{let Q=o.current.get(J),oe=0;Q.forEach(W=>{let ne=U.get(W);oe=Math.max(ne,oe)}),B.push([J,oe])});let X=A.current;F().sort((J,Q)=>{var oe,W;let ne=J.getAttribute("id"),je=Q.getAttribute("id");return((oe=U.get(je))!=null?oe:0)-((W=U.get(ne))!=null?W:0)}).forEach(J=>{let Q=J.closest(L0);Q?Q.appendChild(J.parentElement===Q?J:J.closest(`${L0} > *`)):X.appendChild(J.parentElement===X?J:J.closest(`${L0} > *`))}),B.sort((J,Q)=>Q[1]-J[1]).forEach(J=>{var Q;let oe=(Q=A.current)==null?void 0:Q.querySelector(`${pf}[${yu}="${encodeURIComponent(J[0])}"]`);oe?.parentElement.appendChild(oe)})}function q(){let U=F().find(X=>X.getAttribute("aria-disabled")!=="true"),B=U?.getAttribute(yu);M.setState("value",B||void 0)}function $(){var U,B,X,J;if(!n.current.search||c.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let Q=0;for(let oe of r.current){let W=(B=(U=i.current.get(oe))==null?void 0:U.value)!=null?B:"",ne=(J=(X=i.current.get(oe))==null?void 0:X.keywords)!=null?J:[],je=O(W,ne);n.current.filtered.items.set(oe,je),je>0&&Q++}for(let[oe,W]of o.current)for(let ne of W)if(n.current.filtered.items.get(ne)>0){n.current.filtered.groups.add(oe);break}n.current.filtered.count=Q}function G(){var U,B,X;let J=L();J&&(((U=J.parentElement)==null?void 0:U.firstChild)===J&&((X=(B=J.closest(pf))==null?void 0:B.querySelector(_ie))==null||X.scrollIntoView({block:"nearest"})),J.scrollIntoView({block:"nearest"}))}function L(){var U;return(U=A.current)==null?void 0:U.querySelector(`${QL}[aria-selected="true"]`)}function F(){var U;return Array.from(((U=A.current)==null?void 0:U.querySelectorAll(ZM))||[])}function P(U){let B=F()[U];B&&M.setState("value",B.getAttribute(yu))}function I(U){var B;let X=L(),J=F(),Q=J.findIndex(W=>W===X),oe=J[Q+U];(B=c.current)!=null&&B.loop&&(oe=Q+U<0?J[J.length-1]:Q+U===J.length?J[0]:J[Q+U]),oe&&M.setState("value",oe.getAttribute(yu))}function Y(U){let B=L(),X=B?.closest(pf),J;for(;X&&!J;)X=U>0?Lie(X,pf):Fie(X,pf),J=X?.querySelector(ZM);J?M.setState("value",J.getAttribute(yu)):I(U)}let Z=()=>P(F().length-1),D=U=>{U.preventDefault(),U.metaKey?Z():U.altKey?Y(1):I(1)},H=U=>{U.preventDefault(),U.metaKey?P(0):U.altKey?Y(-1):I(-1)};return b.createElement(vi.div,{ref:t,tabIndex:-1,...E,"cmdk-root":"",onKeyDown:U=>{var B;(B=E.onKeyDown)==null||B.call(E,U);let X=U.nativeEvent.isComposing||U.keyCode===229;if(!(U.defaultPrevented||X))switch(U.key){case"n":case"j":{w&&U.ctrlKey&&D(U);break}case"ArrowDown":{D(U);break}case"p":case"k":{w&&U.ctrlKey&&H(U);break}case"ArrowUp":{H(U);break}case"Home":{U.preventDefault(),P(0);break}case"End":{U.preventDefault(),Z();break}case"Enter":{U.preventDefault();let J=L();if(J){let Q=new Event(RS);J.dispatchEvent(Q)}}}}},b.createElement("label",{"cmdk-label":"",htmlFor:T.inputId,id:T.labelId,style:Bie},d),_x(e,U=>b.createElement(JL.Provider,{value:M},b.createElement(WL.Provider,{value:T},U))))}),Tie=b.forwardRef((e,t)=>{var n,r;let o=cs(),i=b.useRef(null),s=b.useContext(e4),c=Jh(),d=n4(e),u=(r=(n=d.current)==null?void 0:n.forceMount)!=null?r:s?.forceMount;oc(()=>{if(!u)return c.item(o,s?.id)},[u]);let p=r4(o,i,[e.value,e.children,i],e.keywords),m=J1(),g=rl(R=>R.value&&R.value===p.current),y=rl(R=>u||c.filter()===!1?!0:R.search?R.filtered.items.get(o)>0:!0);b.useEffect(()=>{let R=i.current;if(!(!R||e.disabled))return R.addEventListener(RS,v),()=>R.removeEventListener(RS,v)},[y,e.onSelect,e.disabled]);function v(){var R,M;S(),(M=(R=d.current).onSelect)==null||M.call(R,p.current)}function S(){m.setState("value",p.current,!0)}if(!y)return null;let{disabled:w,value:E,onSelect:k,forceMount:j,keywords:N,...A}=e;return b.createElement(vi.div,{ref:rc(i,t),...A,id:o,"cmdk-item":"",role:"option","aria-disabled":!!w,"aria-selected":!!g,"data-disabled":!!w,"data-selected":!!g,onPointerMove:w||c.getDisablePointerSelection()?void 0:S,onClick:w?void 0:v},e.children)}),Mie=b.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:o,...i}=e,s=cs(),c=b.useRef(null),d=b.useRef(null),u=cs(),p=Jh(),m=rl(y=>o||p.filter()===!1?!0:y.search?y.filtered.groups.has(s):!0);oc(()=>p.group(s),[]),r4(s,c,[e.value,e.heading,d]);let g=b.useMemo(()=>({id:s,forceMount:o}),[o]);return b.createElement(vi.div,{ref:rc(c,t),...i,"cmdk-group":"",role:"presentation",hidden:m?void 0:!0},n&&b.createElement("div",{ref:d,"cmdk-group-heading":"","aria-hidden":!0,id:u},n),_x(e,y=>b.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?u:void 0},b.createElement(e4.Provider,{value:g},y))))}),Aie=b.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,o=b.useRef(null),i=rl(s=>!s.search);return!n&&!i?null:b.createElement(vi.div,{ref:rc(o,t),...r,"cmdk-separator":"",role:"separator"})}),Oie=b.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,o=e.value!=null,i=J1(),s=rl(u=>u.search),c=rl(u=>u.selectedItemId),d=Jh();return b.useEffect(()=>{e.value!=null&&i.setState("search",e.value)},[e.value]),b.createElement(vi.input,{ref:t,...r,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":d.listId,"aria-labelledby":d.labelId,"aria-activedescendant":c,id:d.inputId,type:"text",value:o?e.value:s,onChange:u=>{o||i.setState("search",u.target.value),n?.(u.target.value)}})}),Die=b.forwardRef((e,t)=>{let{children:n,label:r="Suggestions",...o}=e,i=b.useRef(null),s=b.useRef(null),c=rl(u=>u.selectedItemId),d=Jh();return b.useEffect(()=>{if(s.current&&i.current){let u=s.current,p=i.current,m,g=new ResizeObserver(()=>{m=requestAnimationFrame(()=>{let y=u.offsetHeight;p.style.setProperty("--cmdk-list-height",y.toFixed(1)+"px")})});return g.observe(u),()=>{cancelAnimationFrame(m),g.unobserve(u)}}},[]),b.createElement(vi.div,{ref:rc(i,t),...o,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":c,"aria-label":r,id:d.listId},_x(e,u=>b.createElement("div",{ref:rc(s,d.listInnerRef),"cmdk-list-sizer":""},u)))}),Pie=b.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:o,contentClassName:i,container:s,...c}=e;return b.createElement(vie,{open:n,onOpenChange:r},b.createElement(wie,{container:s},b.createElement(Sie,{"cmdk-overlay":"",className:o}),b.createElement(kie,{"aria-label":e.label,"cmdk-dialog":"",className:i},b.createElement(t4,{ref:t,...c}))))}),Iie=b.forwardRef((e,t)=>rl(n=>n.filtered.count===0)?b.createElement(vi.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),zie=b.forwardRef((e,t)=>{let{progress:n,children:r,label:o="Loading...",...i}=e;return b.createElement(vi.div,{ref:t,...i,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":o},_x(e,s=>b.createElement("div",{"aria-hidden":!0},s)))}),fd=Object.assign(t4,{List:Die,Item:Tie,Input:Oie,Group:Mie,Separator:Aie,Dialog:Pie,Empty:Iie,Loading:zie});function Lie(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function Fie(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function n4(e){let t=b.useRef(e);return oc(()=>{t.current=e}),t}var oc=typeof window>"u"?b.useEffect:b.useLayoutEffect;function xu(e){let t=b.useRef();return t.current===void 0&&(t.current=e()),t}function rl(e){let t=J1(),n=()=>e(t.snapshot());return b.useSyncExternalStore(t.subscribe,n,n)}function r4(e,t,n,r=[]){let o=b.useRef(),i=Jh();return oc(()=>{var s;let c=(()=>{var u;for(let p of n){if(typeof p=="string")return p.trim();if(typeof p=="object"&&"current"in p)return p.current?(u=p.current.textContent)==null?void 0:u.trim():o.current}})(),d=r.map(u=>u.trim());i.value(e,c,d),(s=t.current)==null||s.setAttribute(yu,c),o.current=c}),o}var $ie=()=>{let[e,t]=b.useState(),n=xu(()=>new Map);return oc(()=>{n.current.forEach(r=>r()),n.current=new Map},[e]),(r,o)=>{n.current.set(r,o),t({})}};function Vie(e){let t=e.type;return typeof t=="function"?t(e.props):"render"in t?t.render(e.props):e}function _x({asChild:e,children:t},n){return e&&b.isValidElement(t)?b.cloneElement(Vie(t),{ref:t.ref},n(t.props.children)):n(t)}var Bie={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};function eC({className:e,...t}){return f.jsx(fd,{"data-slot":"command",className:Ct("flex size-full flex-col overflow-hidden rounded-xl! bg-popover p-1 text-popover-foreground",e),...t})}function tC({className:e,...t}){return f.jsx("div",{"data-slot":"command-input-wrapper",className:"p-1 pb-0",children:f.jsxs(pz,{className:"h-8! rounded-lg! border-input/30 bg-input/30 shadow-none! *:data-[slot=input-group-addon]:pl-2!",children:[f.jsx(fd.Input,{"data-slot":"command-input",className:Ct("w-full text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50",e),...t}),f.jsx(oS,{children:f.jsx(SD,{className:"size-4 shrink-0 opacity-50"})})]})})}function nC({className:e,...t}){return f.jsx(fd.List,{"data-slot":"command-list",className:Ct("no-scrollbar max-h-72 scroll-py-1 overflow-x-hidden overflow-y-auto outline-none",e),...t})}function rC({className:e,...t}){return f.jsx(fd.Empty,{"data-slot":"command-empty",className:Ct("py-6 text-center text-sm",e),...t})}function oC({className:e,...t}){return f.jsx(fd.Group,{"data-slot":"command-group",className:Ct("overflow-hidden p-1 text-foreground **:[[cmdk-group-heading]]:px-2 **:[[cmdk-group-heading]]:py-1.5 **:[[cmdk-group-heading]]:text-xs **:[[cmdk-group-heading]]:font-medium **:[[cmdk-group-heading]]:text-muted-foreground",e),...t})}function iC({className:e,children:t,...n}){return f.jsxs(fd.Item,{"data-slot":"command-item",className:Ct("group/command-item relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none in-data-[slot=dialog-content]:rounded-lg! data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 data-selected:bg-muted data-selected:text-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-selected:*:[svg]:text-foreground",e),...n,children:[t,f.jsx(Ju,{className:"ml-auto opacity-0 group-has-data-[slot=command-shortcut]/command-item:hidden group-data-[checked=true]/command-item:opacity-100"})]})}function Hie({value:e,onChange:t,disabled:n,invalid:r,id:o,"aria-describedby":i,"aria-invalid":s}){const[c,d]=b.useState(!1),{data:u=[],isLoading:p,isError:m}=w1(),g=u.find(y=>y.code===e);return f.jsxs(V1,{open:c,onOpenChange:d,children:[f.jsx(B1,{render:f.jsxs(Te,{type:"button",variant:"outline",role:"combobox","aria-expanded":c,disabled:n,id:o,"aria-describedby":i,"aria-invalid":s,className:Ct("w-full justify-between font-normal",!g&&"text-muted-foreground",r&&"border-destructive"),children:[g?`${g.name} (${g.code})`:e||"选择模型映射",f.jsx(_h,{className:"size-4 shrink-0 opacity-50"})]})}),f.jsx(H1,{className:"w-[--anchor-width] p-0",children:f.jsxs(eC,{shouldFilter:!0,children:[f.jsx(tC,{placeholder:"搜索模型(名称或 code)..."}),f.jsx(nC,{role:"listbox","aria-label":"模型映射列表",children:p?f.jsx("div",{className:"py-6 text-center text-sm text-muted-foreground",children:"加载中..."}):m?f.jsx("div",{className:"py-6 text-center text-sm text-muted-foreground",children:"映射列表加载失败"}):u.length===0?f.jsxs("div",{className:"flex flex-col items-center gap-2 py-6 text-center text-sm text-muted-foreground",children:[f.jsx("span",{children:"尚未创建任何模型映射"}),f.jsx(Te,{render:f.jsx(yn,{to:"/settings/models"}),nativeButton:!1,variant:"outline",size:"sm",children:"去设置 → 模型映射"})]}):f.jsxs(f.Fragment,{children:[f.jsx(rC,{children:"无匹配的模型映射"}),f.jsx(oC,{children:u.map(y=>f.jsxs(iC,{value:`${y.name} ${y.code} ${y.realModel}`,role:"option","aria-selected":y.code===e,onSelect:()=>{t(y.code),d(!1)},children:[y.name," ",f.jsxs("span",{className:"text-muted-foreground",children:["(",y.code,")"]}),f.jsx("span",{className:"ml-2 text-xs text-muted-foreground font-mono",children:y.realModel}),y.code===e&&f.jsx(Ju,{className:"ml-auto size-4 text-success","aria-hidden":"true"})]},y.code))})]})})]})})]})}function o4({className:e,...t}){return f.jsx(ty,{className:Ct("font-mono min-h-64 max-h-[60vh] resize-y text-sm leading-relaxed",e),spellCheck:!1,...t})}function Uie(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const qie=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Yie=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Zie={};function GM(e,t){return(Zie.jsx?Yie:qie).test(e)}const Gie=/[ \t\n\f\r]/g;function Kie(e){return typeof e=="object"?e.type==="text"?KM(e.value):!1:KM(e)}function KM(e){return e.replace(Gie,"")===""}class ep{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}ep.prototype.normal={};ep.prototype.property={};ep.prototype.space=void 0;function i4(e,t){const n={},r={};for(const o of e)Object.assign(n,o.property),Object.assign(r,o.normal);return new ep(n,r,t)}function _S(e){return e.toLowerCase()}class Mo{constructor(t,n){this.attribute=n,this.property=t}}Mo.prototype.attribute="";Mo.prototype.booleanish=!1;Mo.prototype.boolean=!1;Mo.prototype.commaOrSpaceSeparated=!1;Mo.prototype.commaSeparated=!1;Mo.prototype.defined=!1;Mo.prototype.mustUseProperty=!1;Mo.prototype.number=!1;Mo.prototype.overloadedBoolean=!1;Mo.prototype.property="";Mo.prototype.spaceSeparated=!1;Mo.prototype.space=void 0;let Xie=0;const At=wc(),wr=wc(),NS=wc(),Ze=wc(),Fn=wc(),Ul=wc(),Bo=wc();function wc(){return 2**++Xie}const TS=Object.freeze(Object.defineProperty({__proto__:null,boolean:At,booleanish:wr,commaOrSpaceSeparated:Bo,commaSeparated:Ul,number:Ze,overloadedBoolean:NS,spaceSeparated:Fn},Symbol.toStringTag,{value:"Module"})),F0=Object.keys(TS);class sC extends Mo{constructor(t,n,r,o){let i=-1;if(super(t,n),XM(this,"space",o),typeof r=="number")for(;++i<F0.length;){const s=F0[i];XM(this,F0[i],(r&TS[s])===TS[s])}}}sC.prototype.defined=!0;function XM(e,t,n){n&&(e[t]=n)}function hd(e){const t={},n={};for(const[r,o]of Object.entries(e.properties)){const i=new sC(r,e.transform(e.attributes||{},r),o,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(i.mustUseProperty=!0),t[r]=i,n[_S(r)]=r,n[_S(i.attribute)]=r}return new ep(t,n,e.space)}const s4=hd({properties:{ariaActiveDescendant:null,ariaAtomic:wr,ariaAutoComplete:null,ariaBusy:wr,ariaChecked:wr,ariaColCount:Ze,ariaColIndex:Ze,ariaColSpan:Ze,ariaControls:Fn,ariaCurrent:null,ariaDescribedBy:Fn,ariaDetails:null,ariaDisabled:wr,ariaDropEffect:Fn,ariaErrorMessage:null,ariaExpanded:wr,ariaFlowTo:Fn,ariaGrabbed:wr,ariaHasPopup:null,ariaHidden:wr,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Fn,ariaLevel:Ze,ariaLive:null,ariaModal:wr,ariaMultiLine:wr,ariaMultiSelectable:wr,ariaOrientation:null,ariaOwns:Fn,ariaPlaceholder:null,ariaPosInSet:Ze,ariaPressed:wr,ariaReadOnly:wr,ariaRelevant:null,ariaRequired:wr,ariaRoleDescription:Fn,ariaRowCount:Ze,ariaRowIndex:Ze,ariaRowSpan:Ze,ariaSelected:wr,ariaSetSize:Ze,ariaSort:null,ariaValueMax:Ze,ariaValueMin:Ze,ariaValueNow:Ze,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function a4(e,t){return t in e?e[t]:t}function l4(e,t){return a4(e,t.toLowerCase())}const Qie=hd({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Ul,acceptCharset:Fn,accessKey:Fn,action:null,allow:null,allowFullScreen:At,allowPaymentRequest:At,allowUserMedia:At,alpha:At,alt:null,as:null,async:At,autoCapitalize:null,autoComplete:Fn,autoFocus:At,autoPlay:At,blocking:Fn,capture:null,charSet:null,checked:At,cite:null,className:Fn,closedBy:null,colorSpace:null,cols:Ze,colSpan:Ze,command:null,commandFor:null,content:null,contentEditable:wr,controls:At,controlsList:Fn,coords:Ze|Ul,crossOrigin:null,data:null,dateTime:null,decoding:null,default:At,defer:At,dir:null,dirName:null,disabled:At,download:NS,draggable:wr,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:At,formTarget:null,headers:Fn,height:Ze,hidden:NS,high:Ze,href:null,hrefLang:null,htmlFor:Fn,httpEquiv:Fn,id:null,imageSizes:null,imageSrcSet:null,inert:At,inputMode:null,integrity:null,is:null,isMap:At,itemId:null,itemProp:Fn,itemRef:Fn,itemScope:At,itemType:Fn,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:At,low:Ze,manifest:null,max:null,maxLength:Ze,media:null,method:null,min:null,minLength:Ze,multiple:At,muted:At,name:null,nonce:null,noModule:At,noValidate:At,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:At,optimum:Ze,pattern:null,ping:Fn,placeholder:null,playsInline:At,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:At,referrerPolicy:null,rel:Fn,required:At,reversed:At,rows:Ze,rowSpan:Ze,sandbox:Fn,scope:null,scoped:At,seamless:At,selected:At,shadowRootClonable:At,shadowRootCustomElementRegistry:At,shadowRootDelegatesFocus:At,shadowRootMode:null,shadowRootSerializable:At,shape:null,size:Ze,sizes:null,slot:null,span:Ze,spellCheck:wr,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Ze,step:null,style:null,tabIndex:Ze,target:null,title:null,translate:null,type:null,typeMustMatch:At,useMap:null,value:wr,width:Ze,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Fn,axis:null,background:null,bgColor:null,border:Ze,borderColor:null,bottomMargin:Ze,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:At,declare:At,event:null,face:null,frame:null,frameBorder:null,hSpace:Ze,leftMargin:Ze,link:null,longDesc:null,lowSrc:null,marginHeight:Ze,marginWidth:Ze,noResize:At,noHref:At,noShade:At,noWrap:At,object:null,profile:null,prompt:null,rev:null,rightMargin:Ze,rules:null,scheme:null,scrolling:wr,standby:null,summary:null,text:null,topMargin:Ze,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Ze,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:At,disablePictureInPicture:At,disableRemotePlayback:At,exportParts:Ul,part:Fn,prefix:null,property:null,results:Ze,security:null,unselectable:null},space:"html",transform:l4}),Wie=hd({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",maskType:"mask-type",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:Bo,accentHeight:Ze,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Ze,amplitude:Ze,arabicForm:null,ascent:Ze,attributeName:null,attributeType:null,azimuth:Ze,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Ze,by:null,calcMode:null,capHeight:Ze,className:Fn,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:Ze,diffuseConstant:Ze,direction:null,display:null,dur:null,divisor:Ze,dominantBaseline:null,download:At,dx:null,dy:null,edgeMode:null,editable:null,elevation:Ze,enableBackground:null,end:null,event:null,exponent:Ze,externalResourcesRequired:null,fill:null,fillOpacity:Ze,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Ul,g2:Ul,glyphName:Ul,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Ze,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Ze,horizOriginX:Ze,horizOriginY:Ze,id:null,ideographic:Ze,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Ze,k:Ze,k1:Ze,k2:Ze,k3:Ze,k4:Ze,kernelMatrix:Bo,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Ze,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:Ze,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:Ze,overlineThickness:Ze,paintOrder:null,panose1:null,path:null,pathLength:Ze,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Fn,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Ze,pointsAtY:Ze,pointsAtZ:Ze,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Bo,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Bo,rev:Bo,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Bo,requiredFeatures:Bo,requiredFonts:Bo,requiredFormats:Bo,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:Ze,specularExponent:Ze,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Ze,strikethroughThickness:Ze,string:null,stroke:null,strokeDashArray:Bo,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Ze,strokeOpacity:Ze,strokeWidth:null,style:null,surfaceScale:Ze,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Bo,tabIndex:Ze,tableValues:null,target:null,targetX:Ze,targetY:Ze,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Bo,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Ze,underlineThickness:Ze,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Ze,values:null,vAlphabetic:Ze,vMathematical:Ze,vectorEffect:null,vHanging:Ze,vIdeographic:Ze,version:null,vertAdvY:Ze,vertOriginX:Ze,vertOriginY:Ze,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Ze,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:a4}),c4=hd({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),u4=hd({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:l4}),d4=hd({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),Jie={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},ese=/[A-Z]/g,QM=/-[a-z]/g,tse=/^data[-\w.:]+$/i;function nse(e,t){const n=_S(t);let r=t,o=Mo;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&tse.test(t)){if(t.charAt(4)==="-"){const i=t.slice(5).replace(QM,ose);r="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=t.slice(4);if(!QM.test(i)){let s=i.replace(ese,rse);s.charAt(0)!=="-"&&(s="-"+s),t="data"+s}}o=sC}return new o(r,t)}function rse(e){return"-"+e.toLowerCase()}function ose(e){return e.charAt(1).toUpperCase()}const ise=i4([s4,Qie,c4,u4,d4],"html"),aC=i4([s4,Wie,c4,u4,d4],"svg");function sse(e){return e.join(" ").trim()}var au={},$0,WM;function ase(){if(WM)return $0;WM=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,i=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,s=/^[;\s]*/,c=/^\s+|\s+$/g,d=`
116
+ `,u="/",p="*",m="",g="comment",y="declaration";function v(w,E){if(typeof w!="string")throw new TypeError("First argument must be a string");if(!w)return[];E=E||{};var k=1,j=1;function N(L){var F=L.match(t);F&&(k+=F.length);var P=L.lastIndexOf(d);j=~P?L.length-P:j+L.length}function A(){var L={line:k,column:j};return function(F){return F.position=new R(L),O(),F}}function R(L){this.start=L,this.end={line:k,column:j},this.source=E.source}R.prototype.content=w;function M(L){var F=new Error(E.source+":"+k+":"+j+": "+L);if(F.reason=L,F.filename=E.source,F.line=k,F.column=j,F.source=w,!E.silent)throw F}function T(L){var F=L.exec(w);if(F){var P=F[0];return N(P),w=w.slice(P.length),F}}function O(){T(n)}function z(L){var F;for(L=L||[];F=q();)F!==!1&&L.push(F);return L}function q(){var L=A();if(!(u!=w.charAt(0)||p!=w.charAt(1))){for(var F=2;m!=w.charAt(F)&&(p!=w.charAt(F)||u!=w.charAt(F+1));)++F;if(F+=2,m===w.charAt(F-1))return M("End of comment missing");var P=w.slice(2,F-2);return j+=2,N(P),w=w.slice(F),j+=2,L({type:g,comment:P})}}function $(){var L=A(),F=T(r);if(F){if(q(),!T(o))return M("property missing ':'");var P=T(i),I=L({type:y,property:S(F[0].replace(e,m)),value:P?S(P[0].replace(e,m)):m});return T(s),I}}function G(){var L=[];z(L);for(var F;F=$();)F!==!1&&(L.push(F),z(L));return L}return O(),G()}function S(w){return w?w.replace(c,m):m}return $0=v,$0}var JM;function lse(){if(JM)return au;JM=1;var e=au&&au.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(au,"__esModule",{value:!0}),au.default=n;const t=e(ase());function n(r,o){let i=null;if(!r||typeof r!="string")return i;const s=(0,t.default)(r),c=typeof o=="function";return s.forEach(d=>{if(d.type!=="declaration")return;const{property:u,value:p}=d;c?o(u,p,d):p&&(i=i||{},i[u]=p)}),i}return au}var mf={},eA;function cse(){if(eA)return mf;eA=1,Object.defineProperty(mf,"__esModule",{value:!0}),mf.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,o=/^-(ms)-/,i=function(u){return!u||n.test(u)||e.test(u)},s=function(u,p){return p.toUpperCase()},c=function(u,p){return"".concat(p,"-")},d=function(u,p){return p===void 0&&(p={}),i(u)?u:(u=u.toLowerCase(),p.reactCompat?u=u.replace(o,c):u=u.replace(r,c),u.replace(t,s))};return mf.camelCase=d,mf}var gf,tA;function use(){if(tA)return gf;tA=1;var e=gf&&gf.__importDefault||function(o){return o&&o.__esModule?o:{default:o}},t=e(lse()),n=cse();function r(o,i){var s={};return!o||typeof o!="string"||(0,t.default)(o,function(c,d){c&&d&&(s[(0,n.camelCase)(c,i)]=d)}),s}return r.default=r,gf=r,gf}var dse=use();const fse=wh(dse),f4=h4("end"),lC=h4("start");function h4(e){return t;function t(n){const r=n&&n.position&&n.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function hse(e){const t=lC(e),n=f4(e);if(t&&n)return{start:t,end:n}}function Bf(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?nA(e.position):"start"in e||"end"in e?nA(e):"line"in e||"column"in e?MS(e):""}function MS(e){return rA(e&&e.line)+":"+rA(e&&e.column)}function nA(e){return MS(e&&e.start)+"-"+MS(e&&e.end)}function rA(e){return e&&typeof e=="number"?e:1}class oo extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let o="",i={},s=!1;if(n&&("line"in n&&"column"in n?i={place:n}:"start"in n&&"end"in n?i={place:n}:"type"in n?i={ancestors:[n],place:n.position}:i={...n}),typeof t=="string"?o=t:!i.cause&&t&&(s=!0,o=t.message,i.cause=t),!i.ruleId&&!i.source&&typeof r=="string"){const d=r.indexOf(":");d===-1?i.ruleId=r:(i.source=r.slice(0,d),i.ruleId=r.slice(d+1))}if(!i.place&&i.ancestors&&i.ancestors){const d=i.ancestors[i.ancestors.length-1];d&&(i.place=d.position)}const c=i.place&&"start"in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=c?c.column:void 0,this.fatal=void 0,this.file="",this.message=o,this.line=c?c.line:void 0,this.name=Bf(i.place)||"1:1",this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=s&&i.cause&&typeof i.cause.stack=="string"?i.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}oo.prototype.file="";oo.prototype.name="";oo.prototype.reason="";oo.prototype.message="";oo.prototype.stack="";oo.prototype.column=void 0;oo.prototype.line=void 0;oo.prototype.ancestors=void 0;oo.prototype.cause=void 0;oo.prototype.fatal=void 0;oo.prototype.place=void 0;oo.prototype.ruleId=void 0;oo.prototype.source=void 0;const cC={}.hasOwnProperty,pse=new Map,mse=/[A-Z]/g,gse=new Set(["table","tbody","thead","tfoot","tr"]),yse=new Set(["td","th"]),p4="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function xse(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let r;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=jse(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=kse(n,t.jsx,t.jsxs)}const o={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?aC:ise,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},i=m4(o,e,void 0);return i&&typeof i!="string"?i:o.create(e,o.Fragment,{children:i||void 0},void 0)}function m4(e,t,n){if(t.type==="element")return vse(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return bse(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return Sse(e,t,n);if(t.type==="mdxjsEsm")return wse(e,t);if(t.type==="root")return Ese(e,t,n);if(t.type==="text")return Cse(e,t)}function vse(e,t,n){const r=e.schema;let o=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(o=aC,e.schema=o),e.ancestors.push(t);const i=y4(e,t.tagName,!1),s=Rse(e,t);let c=dC(e,t);return gse.has(t.tagName)&&(c=c.filter(function(d){return typeof d=="string"?!Kie(d):!0})),g4(e,s,i,t),uC(s,c),e.ancestors.pop(),e.schema=r,e.create(t,i,s,n)}function bse(e,t){if(t.data&&t.data.estree&&e.evaluater){const r=t.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}ah(e,t.position)}function wse(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);ah(e,t.position)}function Sse(e,t,n){const r=e.schema;let o=r;t.name==="svg"&&r.space==="html"&&(o=aC,e.schema=o),e.ancestors.push(t);const i=t.name===null?e.Fragment:y4(e,t.name,!0),s=_se(e,t),c=dC(e,t);return g4(e,s,i,t),uC(s,c),e.ancestors.pop(),e.schema=r,e.create(t,i,s,n)}function Ese(e,t,n){const r={};return uC(r,dC(e,t)),e.create(t,e.Fragment,r,n)}function Cse(e,t){return t.value}function g4(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function uC(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function kse(e,t,n){return r;function r(o,i,s,c){const u=Array.isArray(s.children)?n:t;return c?u(i,s,c):u(i,s)}}function jse(e,t){return n;function n(r,o,i,s){const c=Array.isArray(i.children),d=lC(r);return t(o,i,s,c,{columnNumber:d?d.column-1:void 0,fileName:e,lineNumber:d?d.line:void 0},void 0)}}function Rse(e,t){const n={};let r,o;for(o in t.properties)if(o!=="children"&&cC.call(t.properties,o)){const i=Nse(e,o,t.properties[o]);if(i){const[s,c]=i;e.tableCellAlignToStyle&&s==="align"&&typeof c=="string"&&yse.has(t.tagName)?r=c:n[s]=c}}if(r){const i=n.style||(n.style={});i[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function _se(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const i=r.data.estree.body[0];i.type;const s=i.expression;s.type;const c=s.properties[0];c.type,Object.assign(n,e.evaluater.evaluateExpression(c.argument))}else ah(e,t.position);else{const o=r.name;let i;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const c=r.value.data.estree.body[0];c.type,i=e.evaluater.evaluateExpression(c.expression)}else ah(e,t.position);else i=r.value===null?!0:r.value;n[o]=i}return n}function dC(e,t){const n=[];let r=-1;const o=e.passKeys?new Map:pse;for(;++r<t.children.length;){const i=t.children[r];let s;if(e.passKeys){const d=i.type==="element"?i.tagName:i.type==="mdxJsxFlowElement"||i.type==="mdxJsxTextElement"?i.name:void 0;if(d){const u=o.get(d)||0;s=d+"-"+u,o.set(d,u+1)}}const c=m4(e,i,s);c!==void 0&&n.push(c)}return n}function Nse(e,t,n){const r=nse(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?Uie(n):sse(n)),r.property==="style"){let o=typeof n=="object"?n:Tse(e,String(n));return e.stylePropertyNameCase==="css"&&(o=Mse(o)),["style",o]}return[e.elementAttributeNameCase==="react"&&r.space?Jie[r.property]||r.property:r.attribute,n]}}function Tse(e,t){try{return fse(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,o=new oo("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw o.file=e.filePath||void 0,o.url=p4+"#cannot-parse-style-attribute",o}}function y4(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const o=t.split(".");let i=-1,s;for(;++i<o.length;){const c=GM(o[i])?{type:"Identifier",name:o[i]}:{type:"Literal",value:o[i]};s=s?{type:"MemberExpression",object:s,property:c,computed:!!(i&&c.type==="Literal"),optional:!1}:c}r=s}else r=GM(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const o=r.value;return cC.call(e.components,o)?e.components[o]:o}if(e.evaluater)return e.evaluater.evaluateExpression(r);ah(e)}function ah(e,t){const n=new oo("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=p4+"#cannot-handle-mdx-estrees-without-createevaluater",n}function Mse(e){const t={};let n;for(n in e)cC.call(e,n)&&(t[Ase(n)]=e[n]);return t}function Ase(e){let t=e.replace(mse,Ose);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function Ose(e){return"-"+e.toLowerCase()}const V0={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},Dse={};function fC(e,t){const n=Dse,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,o=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return x4(e,r,o)}function x4(e,t,n){if(Pse(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return oA(e.children,t,n)}return Array.isArray(e)?oA(e,t,n):""}function oA(e,t,n){const r=[];let o=-1;for(;++o<e.length;)r[o]=x4(e[o],t,n);return r.join("")}function Pse(e){return!!(e&&typeof e=="object")}const iA=document.createElement("i");function hC(e){const t="&"+e+";";iA.innerHTML=t;const n=iA.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function Zo(e,t,n,r){const o=e.length;let i=0,s;if(t<0?t=-t>o?0:o+t:t=t>o?o:t,n=n>0?n:0,r.length<1e4)s=Array.from(r),s.unshift(t,n),e.splice(...s);else for(n&&e.splice(t,n);i<r.length;)s=r.slice(i,i+1e4),s.unshift(t,0),e.splice(...s),i+=1e4,t+=1e4}function ui(e,t){return e.length>0?(Zo(e,e.length,0,t),e):t}const sA={}.hasOwnProperty;function v4(e){const t={};let n=-1;for(;++n<e.length;)Ise(t,e[n]);return t}function Ise(e,t){let n;for(n in t){const o=(sA.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n];let s;if(i)for(s in i){sA.call(o,s)||(o[s]=[]);const c=i[s];zse(o[s],Array.isArray(c)?c:c?[c]:[])}}}function zse(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);Zo(e,0,0,r)}function b4(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function Ii(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const co=fl(/[A-Za-z]/),no=fl(/[\dA-Za-z]/),Lse=fl(/[#-'*+\--9=?A-Z^-~]/);function ly(e){return e!==null&&(e<32||e===127)}const AS=fl(/\d/),Fse=fl(/[\dA-Fa-f]/),$se=fl(/[!-/:-@[-`{-~]/);function wt(e){return e!==null&&e<-2}function Bn(e){return e!==null&&(e<0||e===32)}function rn(e){return e===-2||e===-1||e===32}const Nx=fl(new RegExp("\\p{P}|\\p{S}","u")),ic=fl(/\s/);function fl(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function pd(e){const t=[];let n=-1,r=0,o=0;for(;++n<e.length;){const i=e.charCodeAt(n);let s="";if(i===37&&no(e.charCodeAt(n+1))&&no(e.charCodeAt(n+2)))o=2;else if(i<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(i))||(s=String.fromCharCode(i));else if(i>55295&&i<57344){const c=e.charCodeAt(n+1);i<56320&&c>56319&&c<57344?(s=String.fromCharCode(i,c),o=1):s="�"}else s=String.fromCharCode(i);s&&(t.push(e.slice(r,n),encodeURIComponent(s)),r=n+o+1,s=""),o&&(n+=o,o=0)}return t.join("")+e.slice(r)}function mn(e,t,n,r){const o=r?r-1:Number.POSITIVE_INFINITY;let i=0;return s;function s(d){return rn(d)?(e.enter(n),c(d)):t(d)}function c(d){return rn(d)&&i++<o?(e.consume(d),c):(e.exit(n),t(d))}}const Vse={tokenize:Bse};function Bse(e){const t=e.attempt(this.parser.constructs.contentInitial,r,o);let n;return t;function r(c){if(c===null){e.consume(c);return}return e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),mn(e,t,"linePrefix")}function o(c){return e.enter("paragraph"),i(c)}function i(c){const d=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=d),n=d,s(c)}function s(c){if(c===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(c);return}return wt(c)?(e.consume(c),e.exit("chunkText"),i):(e.consume(c),s)}}const Hse={tokenize:Use},aA={tokenize:qse};function Use(e){const t=this,n=[];let r=0,o,i,s;return c;function c(j){if(r<n.length){const N=n[r];return t.containerState=N[1],e.attempt(N[0].continuation,d,u)(j)}return u(j)}function d(j){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,o&&k();const N=t.events.length;let A=N,R;for(;A--;)if(t.events[A][0]==="exit"&&t.events[A][1].type==="chunkFlow"){R=t.events[A][1].end;break}E(r);let M=N;for(;M<t.events.length;)t.events[M][1].end={...R},M++;return Zo(t.events,A+1,0,t.events.slice(N)),t.events.length=M,u(j)}return c(j)}function u(j){if(r===n.length){if(!o)return g(j);if(o.currentConstruct&&o.currentConstruct.concrete)return v(j);t.interrupt=!!(o.currentConstruct&&!o._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(aA,p,m)(j)}function p(j){return o&&k(),E(r),g(j)}function m(j){return t.parser.lazy[t.now().line]=r!==n.length,s=t.now().offset,v(j)}function g(j){return t.containerState={},e.attempt(aA,y,v)(j)}function y(j){return r++,n.push([t.currentConstruct,t.containerState]),g(j)}function v(j){if(j===null){o&&k(),E(0),e.consume(j);return}return o=o||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:o,contentType:"flow",previous:i}),S(j)}function S(j){if(j===null){w(e.exit("chunkFlow"),!0),E(0),e.consume(j);return}return wt(j)?(e.consume(j),w(e.exit("chunkFlow")),r=0,t.interrupt=void 0,c):(e.consume(j),S)}function w(j,N){const A=t.sliceStream(j);if(N&&A.push(null),j.previous=i,i&&(i.next=j),i=j,o.defineSkip(j.start),o.write(A),t.parser.lazy[j.start.line]){let R=o.events.length;for(;R--;)if(o.events[R][1].start.offset<s&&(!o.events[R][1].end||o.events[R][1].end.offset>s))return;const M=t.events.length;let T=M,O,z;for(;T--;)if(t.events[T][0]==="exit"&&t.events[T][1].type==="chunkFlow"){if(O){z=t.events[T][1].end;break}O=!0}for(E(r),R=M;R<t.events.length;)t.events[R][1].end={...z},R++;Zo(t.events,T+1,0,t.events.slice(M)),t.events.length=R}}function E(j){let N=n.length;for(;N-- >j;){const A=n[N];t.containerState=A[1],A[0].exit.call(t,e)}n.length=j}function k(){o.write([null]),i=void 0,o=void 0,t.containerState._closeFlow=void 0}}function qse(e,t,n){return mn(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function $u(e){if(e===null||Bn(e)||ic(e))return 1;if(Nx(e))return 2}function Tx(e,t,n){const r=[];let o=-1;for(;++o<e.length;){const i=e[o].resolveAll;i&&!r.includes(i)&&(t=i(t,n),r.push(i))}return t}const OS={name:"attention",resolveAll:Yse,tokenize:Zse};function Yse(e,t){let n=-1,r,o,i,s,c,d,u,p;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;d=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const m={...e[r][1].end},g={...e[n][1].start};lA(m,-d),lA(g,d),s={type:d>1?"strongSequence":"emphasisSequence",start:m,end:{...e[r][1].end}},c={type:d>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:g},i={type:d>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},o={type:d>1?"strong":"emphasis",start:{...s.start},end:{...c.end}},e[r][1].end={...s.start},e[n][1].start={...c.end},u=[],e[r][1].end.offset-e[r][1].start.offset&&(u=ui(u,[["enter",e[r][1],t],["exit",e[r][1],t]])),u=ui(u,[["enter",o,t],["enter",s,t],["exit",s,t],["enter",i,t]]),u=ui(u,Tx(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),u=ui(u,[["exit",i,t],["enter",c,t],["exit",c,t],["exit",o,t]]),e[n][1].end.offset-e[n][1].start.offset?(p=2,u=ui(u,[["enter",e[n][1],t],["exit",e[n][1],t]])):p=0,Zo(e,r-1,n-r+3,u),n=r+u.length-p-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function Zse(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,o=$u(r);let i;return s;function s(d){return i=d,e.enter("attentionSequence"),c(d)}function c(d){if(d===i)return e.consume(d),c;const u=e.exit("attentionSequence"),p=$u(d),m=!p||p===2&&o||n.includes(d),g=!o||o===2&&p||n.includes(r);return u._open=!!(i===42?m:m&&(o||!g)),u._close=!!(i===42?g:g&&(p||!m)),t(d)}}function lA(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const Gse={name:"autolink",tokenize:Kse};function Kse(e,t,n){let r=0;return o;function o(y){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(y),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),i}function i(y){return co(y)?(e.consume(y),s):y===64?n(y):u(y)}function s(y){return y===43||y===45||y===46||no(y)?(r=1,c(y)):u(y)}function c(y){return y===58?(e.consume(y),r=0,d):(y===43||y===45||y===46||no(y))&&r++<32?(e.consume(y),c):(r=0,u(y))}function d(y){return y===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(y),e.exit("autolinkMarker"),e.exit("autolink"),t):y===null||y===32||y===60||ly(y)?n(y):(e.consume(y),d)}function u(y){return y===64?(e.consume(y),p):Lse(y)?(e.consume(y),u):n(y)}function p(y){return no(y)?m(y):n(y)}function m(y){return y===46?(e.consume(y),r=0,p):y===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(y),e.exit("autolinkMarker"),e.exit("autolink"),t):g(y)}function g(y){if((y===45||no(y))&&r++<63){const v=y===45?g:m;return e.consume(y),v}return n(y)}}const tp={partial:!0,tokenize:Xse};function Xse(e,t,n){return r;function r(i){return rn(i)?mn(e,o,"linePrefix")(i):o(i)}function o(i){return i===null||wt(i)?t(i):n(i)}}const w4={continuation:{tokenize:Wse},exit:Jse,name:"blockQuote",tokenize:Qse};function Qse(e,t,n){const r=this;return o;function o(s){if(s===62){const c=r.containerState;return c.open||(e.enter("blockQuote",{_container:!0}),c.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(s),e.exit("blockQuoteMarker"),i}return n(s)}function i(s){return rn(s)?(e.enter("blockQuotePrefixWhitespace"),e.consume(s),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(s))}}function Wse(e,t,n){const r=this;return o;function o(s){return rn(s)?mn(e,i,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(s):i(s)}function i(s){return e.attempt(w4,t,n)(s)}}function Jse(e){e.exit("blockQuote")}const S4={name:"characterEscape",tokenize:eae};function eae(e,t,n){return r;function r(i){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(i),e.exit("escapeMarker"),o}function o(i){return $se(i)?(e.enter("characterEscapeValue"),e.consume(i),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(i)}}const E4={name:"characterReference",tokenize:tae};function tae(e,t,n){const r=this;let o=0,i,s;return c;function c(m){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(m),e.exit("characterReferenceMarker"),d}function d(m){return m===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(m),e.exit("characterReferenceMarkerNumeric"),u):(e.enter("characterReferenceValue"),i=31,s=no,p(m))}function u(m){return m===88||m===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(m),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),i=6,s=Fse,p):(e.enter("characterReferenceValue"),i=7,s=AS,p(m))}function p(m){if(m===59&&o){const g=e.exit("characterReferenceValue");return s===no&&!hC(r.sliceSerialize(g))?n(m):(e.enter("characterReferenceMarker"),e.consume(m),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return s(m)&&o++<i?(e.consume(m),p):n(m)}}const cA={partial:!0,tokenize:rae},uA={concrete:!0,name:"codeFenced",tokenize:nae};function nae(e,t,n){const r=this,o={partial:!0,tokenize:A};let i=0,s=0,c;return d;function d(R){return u(R)}function u(R){const M=r.events[r.events.length-1];return i=M&&M[1].type==="linePrefix"?M[2].sliceSerialize(M[1],!0).length:0,c=R,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),p(R)}function p(R){return R===c?(s++,e.consume(R),p):s<3?n(R):(e.exit("codeFencedFenceSequence"),rn(R)?mn(e,m,"whitespace")(R):m(R))}function m(R){return R===null||wt(R)?(e.exit("codeFencedFence"),r.interrupt?t(R):e.check(cA,S,N)(R)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),g(R))}function g(R){return R===null||wt(R)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),m(R)):rn(R)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),mn(e,y,"whitespace")(R)):R===96&&R===c?n(R):(e.consume(R),g)}function y(R){return R===null||wt(R)?m(R):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),v(R))}function v(R){return R===null||wt(R)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),m(R)):R===96&&R===c?n(R):(e.consume(R),v)}function S(R){return e.attempt(o,N,w)(R)}function w(R){return e.enter("lineEnding"),e.consume(R),e.exit("lineEnding"),E}function E(R){return i>0&&rn(R)?mn(e,k,"linePrefix",i+1)(R):k(R)}function k(R){return R===null||wt(R)?e.check(cA,S,N)(R):(e.enter("codeFlowValue"),j(R))}function j(R){return R===null||wt(R)?(e.exit("codeFlowValue"),k(R)):(e.consume(R),j)}function N(R){return e.exit("codeFenced"),t(R)}function A(R,M,T){let O=0;return z;function z(F){return R.enter("lineEnding"),R.consume(F),R.exit("lineEnding"),q}function q(F){return R.enter("codeFencedFence"),rn(F)?mn(R,$,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(F):$(F)}function $(F){return F===c?(R.enter("codeFencedFenceSequence"),G(F)):T(F)}function G(F){return F===c?(O++,R.consume(F),G):O>=s?(R.exit("codeFencedFenceSequence"),rn(F)?mn(R,L,"whitespace")(F):L(F)):T(F)}function L(F){return F===null||wt(F)?(R.exit("codeFencedFence"),M(F)):T(F)}}}function rae(e,t,n){const r=this;return o;function o(s){return s===null?n(s):(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),i)}function i(s){return r.parser.lazy[r.now().line]?n(s):t(s)}}const B0={name:"codeIndented",tokenize:iae},oae={partial:!0,tokenize:sae};function iae(e,t,n){const r=this;return o;function o(u){return e.enter("codeIndented"),mn(e,i,"linePrefix",5)(u)}function i(u){const p=r.events[r.events.length-1];return p&&p[1].type==="linePrefix"&&p[2].sliceSerialize(p[1],!0).length>=4?s(u):n(u)}function s(u){return u===null?d(u):wt(u)?e.attempt(oae,s,d)(u):(e.enter("codeFlowValue"),c(u))}function c(u){return u===null||wt(u)?(e.exit("codeFlowValue"),s(u)):(e.consume(u),c)}function d(u){return e.exit("codeIndented"),t(u)}}function sae(e,t,n){const r=this;return o;function o(s){return r.parser.lazy[r.now().line]?n(s):wt(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),o):mn(e,i,"linePrefix",5)(s)}function i(s){const c=r.events[r.events.length-1];return c&&c[1].type==="linePrefix"&&c[2].sliceSerialize(c[1],!0).length>=4?t(s):wt(s)?o(s):n(s)}}const aae={name:"codeText",previous:cae,resolve:lae,tokenize:uae};function lae(e){let t=e.length-4,n=3,r,o;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r<t;)if(e[r][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)o===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(o=r):(r===t||e[r][1].type==="lineEnding")&&(e[o][1].type="codeTextData",r!==o+2&&(e[o][1].end=e[r-1][1].end,e.splice(o+2,r-o-2),t-=r-o-2,r=o+2),o=void 0);return e}function cae(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function uae(e,t,n){let r=0,o,i;return s;function s(m){return e.enter("codeText"),e.enter("codeTextSequence"),c(m)}function c(m){return m===96?(e.consume(m),r++,c):(e.exit("codeTextSequence"),d(m))}function d(m){return m===null?n(m):m===32?(e.enter("space"),e.consume(m),e.exit("space"),d):m===96?(i=e.enter("codeTextSequence"),o=0,p(m)):wt(m)?(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),d):(e.enter("codeTextData"),u(m))}function u(m){return m===null||m===32||m===96||wt(m)?(e.exit("codeTextData"),d(m)):(e.consume(m),u)}function p(m){return m===96?(e.consume(m),o++,p):o===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(m)):(i.type="codeTextData",u(m))}}class dae{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(t,r):t>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const o=n||0;this.setCursor(Math.trunc(t));const i=this.right.splice(this.right.length-o,Number.POSITIVE_INFINITY);return r&&yf(this.left,r),i.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),yf(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),yf(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);yf(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);yf(this.left,n.reverse())}}}function yf(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function C4(e){const t={};let n=-1,r,o,i,s,c,d,u;const p=new dae(e);for(;++n<p.length;){for(;n in t;)n=t[n];if(r=p.get(n),n&&r[1].type==="chunkFlow"&&p.get(n-1)[1].type==="listItemPrefix"&&(d=r[1]._tokenizer.events,i=0,i<d.length&&d[i][1].type==="lineEndingBlank"&&(i+=2),i<d.length&&d[i][1].type==="content"))for(;++i<d.length&&d[i][1].type!=="content";)d[i][1].type==="chunkText"&&(d[i][1]._isInFirstContentOfListItem=!0,i++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,fae(p,n)),n=t[n],u=!0);else if(r[1]._container){for(i=n,o=void 0;i--;)if(s=p.get(i),s[1].type==="lineEnding"||s[1].type==="lineEndingBlank")s[0]==="enter"&&(o&&(p.get(o)[1].type="lineEndingBlank"),s[1].type="lineEnding",o=i);else if(!(s[1].type==="linePrefix"||s[1].type==="listItemIndent"))break;o&&(r[1].end={...p.get(o)[1].start},c=p.slice(o,n),c.unshift(r),p.splice(o,n-o+1,c))}}return Zo(e,0,Number.POSITIVE_INFINITY,p.slice(0)),!u}function fae(e,t){const n=e.get(t)[1],r=e.get(t)[2];let o=t-1;const i=[];let s=n._tokenizer;s||(s=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(s._contentTypeTextTrailing=!0));const c=s.events,d=[],u={};let p,m,g=-1,y=n,v=0,S=0;const w=[S];for(;y;){for(;e.get(++o)[1]!==y;);i.push(o),y._tokenizer||(p=r.sliceStream(y),y.next||p.push(null),m&&s.defineSkip(y.start),y._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=!0),s.write(p),y._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=void 0)),m=y,y=y.next}for(y=n;++g<c.length;)c[g][0]==="exit"&&c[g-1][0]==="enter"&&c[g][1].type===c[g-1][1].type&&c[g][1].start.line!==c[g][1].end.line&&(S=g+1,w.push(S),y._tokenizer=void 0,y.previous=void 0,y=y.next);for(s.events=[],y?(y._tokenizer=void 0,y.previous=void 0):w.pop(),g=w.length;g--;){const E=c.slice(w[g],w[g+1]),k=i.pop();d.push([k,k+E.length-1]),e.splice(k,2,E)}for(d.reverse(),g=-1;++g<d.length;)u[v+d[g][0]]=v+d[g][1],v+=d[g][1]-d[g][0]-1;return u}const hae={resolve:mae,tokenize:gae},pae={partial:!0,tokenize:yae};function mae(e){return C4(e),e}function gae(e,t){let n;return r;function r(c){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),o(c)}function o(c){return c===null?i(c):wt(c)?e.check(pae,s,i)(c):(e.consume(c),o)}function i(c){return e.exit("chunkContent"),e.exit("content"),t(c)}function s(c){return e.consume(c),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,o}}function yae(e,t,n){const r=this;return o;function o(s){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),mn(e,i,"linePrefix")}function i(s){if(s===null||wt(s))return n(s);const c=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&c&&c[1].type==="linePrefix"&&c[2].sliceSerialize(c[1],!0).length>=4?t(s):e.interrupt(r.parser.constructs.flow,n,t)(s)}}function k4(e,t,n,r,o,i,s,c,d){const u=d||Number.POSITIVE_INFINITY;let p=0;return m;function m(E){return E===60?(e.enter(r),e.enter(o),e.enter(i),e.consume(E),e.exit(i),g):E===null||E===32||E===41||ly(E)?n(E):(e.enter(r),e.enter(s),e.enter(c),e.enter("chunkString",{contentType:"string"}),S(E))}function g(E){return E===62?(e.enter(i),e.consume(E),e.exit(i),e.exit(o),e.exit(r),t):(e.enter(c),e.enter("chunkString",{contentType:"string"}),y(E))}function y(E){return E===62?(e.exit("chunkString"),e.exit(c),g(E)):E===null||E===60||wt(E)?n(E):(e.consume(E),E===92?v:y)}function v(E){return E===60||E===62||E===92?(e.consume(E),y):y(E)}function S(E){return!p&&(E===null||E===41||Bn(E))?(e.exit("chunkString"),e.exit(c),e.exit(s),e.exit(r),t(E)):p<u&&E===40?(e.consume(E),p++,S):E===41?(e.consume(E),p--,S):E===null||E===32||E===40||ly(E)?n(E):(e.consume(E),E===92?w:S)}function w(E){return E===40||E===41||E===92?(e.consume(E),S):S(E)}}function j4(e,t,n,r,o,i){const s=this;let c=0,d;return u;function u(y){return e.enter(r),e.enter(o),e.consume(y),e.exit(o),e.enter(i),p}function p(y){return c>999||y===null||y===91||y===93&&!d||y===94&&!c&&"_hiddenFootnoteSupport"in s.parser.constructs?n(y):y===93?(e.exit(i),e.enter(o),e.consume(y),e.exit(o),e.exit(r),t):wt(y)?(e.enter("lineEnding"),e.consume(y),e.exit("lineEnding"),p):(e.enter("chunkString",{contentType:"string"}),m(y))}function m(y){return y===null||y===91||y===93||wt(y)||c++>999?(e.exit("chunkString"),p(y)):(e.consume(y),d||(d=!rn(y)),y===92?g:m)}function g(y){return y===91||y===92||y===93?(e.consume(y),c++,m):m(y)}}function R4(e,t,n,r,o,i){let s;return c;function c(g){return g===34||g===39||g===40?(e.enter(r),e.enter(o),e.consume(g),e.exit(o),s=g===40?41:g,d):n(g)}function d(g){return g===s?(e.enter(o),e.consume(g),e.exit(o),e.exit(r),t):(e.enter(i),u(g))}function u(g){return g===s?(e.exit(i),d(s)):g===null?n(g):wt(g)?(e.enter("lineEnding"),e.consume(g),e.exit("lineEnding"),mn(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),p(g))}function p(g){return g===s||g===null||wt(g)?(e.exit("chunkString"),u(g)):(e.consume(g),g===92?m:p)}function m(g){return g===s||g===92?(e.consume(g),p):p(g)}}function Hf(e,t){let n;return r;function r(o){return wt(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),n=!0,r):rn(o)?mn(e,r,n?"linePrefix":"lineSuffix")(o):t(o)}}const xae={name:"definition",tokenize:bae},vae={partial:!0,tokenize:wae};function bae(e,t,n){const r=this;let o;return i;function i(y){return e.enter("definition"),s(y)}function s(y){return j4.call(r,e,c,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(y)}function c(y){return o=Ii(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),y===58?(e.enter("definitionMarker"),e.consume(y),e.exit("definitionMarker"),d):n(y)}function d(y){return Bn(y)?Hf(e,u)(y):u(y)}function u(y){return k4(e,p,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(y)}function p(y){return e.attempt(vae,m,m)(y)}function m(y){return rn(y)?mn(e,g,"whitespace")(y):g(y)}function g(y){return y===null||wt(y)?(e.exit("definition"),r.parser.defined.push(o),t(y)):n(y)}}function wae(e,t,n){return r;function r(c){return Bn(c)?Hf(e,o)(c):n(c)}function o(c){return R4(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(c)}function i(c){return rn(c)?mn(e,s,"whitespace")(c):s(c)}function s(c){return c===null||wt(c)?t(c):n(c)}}const Sae={name:"hardBreakEscape",tokenize:Eae};function Eae(e,t,n){return r;function r(i){return e.enter("hardBreakEscape"),e.consume(i),o}function o(i){return wt(i)?(e.exit("hardBreakEscape"),t(i)):n(i)}}const Cae={name:"headingAtx",resolve:kae,tokenize:jae};function kae(e,t){let n=e.length-2,r=3,o,i;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(o={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},i={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},Zo(e,r,n-r+1,[["enter",o,t],["enter",i,t],["exit",i,t],["exit",o,t]])),e}function jae(e,t,n){let r=0;return o;function o(p){return e.enter("atxHeading"),i(p)}function i(p){return e.enter("atxHeadingSequence"),s(p)}function s(p){return p===35&&r++<6?(e.consume(p),s):p===null||Bn(p)?(e.exit("atxHeadingSequence"),c(p)):n(p)}function c(p){return p===35?(e.enter("atxHeadingSequence"),d(p)):p===null||wt(p)?(e.exit("atxHeading"),t(p)):rn(p)?mn(e,c,"whitespace")(p):(e.enter("atxHeadingText"),u(p))}function d(p){return p===35?(e.consume(p),d):(e.exit("atxHeadingSequence"),c(p))}function u(p){return p===null||p===35||Bn(p)?(e.exit("atxHeadingText"),c(p)):(e.consume(p),u)}}const Rae=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],dA=["pre","script","style","textarea"],_ae={concrete:!0,name:"htmlFlow",resolveTo:Mae,tokenize:Aae},Nae={partial:!0,tokenize:Dae},Tae={partial:!0,tokenize:Oae};function Mae(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function Aae(e,t,n){const r=this;let o,i,s,c,d;return u;function u(B){return p(B)}function p(B){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(B),m}function m(B){return B===33?(e.consume(B),g):B===47?(e.consume(B),i=!0,S):B===63?(e.consume(B),o=3,r.interrupt?t:D):co(B)?(e.consume(B),s=String.fromCharCode(B),w):n(B)}function g(B){return B===45?(e.consume(B),o=2,y):B===91?(e.consume(B),o=5,c=0,v):co(B)?(e.consume(B),o=4,r.interrupt?t:D):n(B)}function y(B){return B===45?(e.consume(B),r.interrupt?t:D):n(B)}function v(B){const X="CDATA[";return B===X.charCodeAt(c++)?(e.consume(B),c===X.length?r.interrupt?t:$:v):n(B)}function S(B){return co(B)?(e.consume(B),s=String.fromCharCode(B),w):n(B)}function w(B){if(B===null||B===47||B===62||Bn(B)){const X=B===47,J=s.toLowerCase();return!X&&!i&&dA.includes(J)?(o=1,r.interrupt?t(B):$(B)):Rae.includes(s.toLowerCase())?(o=6,X?(e.consume(B),E):r.interrupt?t(B):$(B)):(o=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(B):i?k(B):j(B))}return B===45||no(B)?(e.consume(B),s+=String.fromCharCode(B),w):n(B)}function E(B){return B===62?(e.consume(B),r.interrupt?t:$):n(B)}function k(B){return rn(B)?(e.consume(B),k):z(B)}function j(B){return B===47?(e.consume(B),z):B===58||B===95||co(B)?(e.consume(B),N):rn(B)?(e.consume(B),j):z(B)}function N(B){return B===45||B===46||B===58||B===95||no(B)?(e.consume(B),N):A(B)}function A(B){return B===61?(e.consume(B),R):rn(B)?(e.consume(B),A):j(B)}function R(B){return B===null||B===60||B===61||B===62||B===96?n(B):B===34||B===39?(e.consume(B),d=B,M):rn(B)?(e.consume(B),R):T(B)}function M(B){return B===d?(e.consume(B),d=null,O):B===null||wt(B)?n(B):(e.consume(B),M)}function T(B){return B===null||B===34||B===39||B===47||B===60||B===61||B===62||B===96||Bn(B)?A(B):(e.consume(B),T)}function O(B){return B===47||B===62||rn(B)?j(B):n(B)}function z(B){return B===62?(e.consume(B),q):n(B)}function q(B){return B===null||wt(B)?$(B):rn(B)?(e.consume(B),q):n(B)}function $(B){return B===45&&o===2?(e.consume(B),P):B===60&&o===1?(e.consume(B),I):B===62&&o===4?(e.consume(B),H):B===63&&o===3?(e.consume(B),D):B===93&&o===5?(e.consume(B),Z):wt(B)&&(o===6||o===7)?(e.exit("htmlFlowData"),e.check(Nae,U,G)(B)):B===null||wt(B)?(e.exit("htmlFlowData"),G(B)):(e.consume(B),$)}function G(B){return e.check(Tae,L,U)(B)}function L(B){return e.enter("lineEnding"),e.consume(B),e.exit("lineEnding"),F}function F(B){return B===null||wt(B)?G(B):(e.enter("htmlFlowData"),$(B))}function P(B){return B===45?(e.consume(B),D):$(B)}function I(B){return B===47?(e.consume(B),s="",Y):$(B)}function Y(B){if(B===62){const X=s.toLowerCase();return dA.includes(X)?(e.consume(B),H):$(B)}return co(B)&&s.length<8?(e.consume(B),s+=String.fromCharCode(B),Y):$(B)}function Z(B){return B===93?(e.consume(B),D):$(B)}function D(B){return B===62?(e.consume(B),H):B===45&&o===2?(e.consume(B),D):$(B)}function H(B){return B===null||wt(B)?(e.exit("htmlFlowData"),U(B)):(e.consume(B),H)}function U(B){return e.exit("htmlFlow"),t(B)}}function Oae(e,t,n){const r=this;return o;function o(s){return wt(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),i):n(s)}function i(s){return r.parser.lazy[r.now().line]?n(s):t(s)}}function Dae(e,t,n){return r;function r(o){return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),e.attempt(tp,t,n)}}const Pae={name:"htmlText",tokenize:Iae};function Iae(e,t,n){const r=this;let o,i,s;return c;function c(D){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(D),d}function d(D){return D===33?(e.consume(D),u):D===47?(e.consume(D),A):D===63?(e.consume(D),j):co(D)?(e.consume(D),T):n(D)}function u(D){return D===45?(e.consume(D),p):D===91?(e.consume(D),i=0,v):co(D)?(e.consume(D),k):n(D)}function p(D){return D===45?(e.consume(D),y):n(D)}function m(D){return D===null?n(D):D===45?(e.consume(D),g):wt(D)?(s=m,I(D)):(e.consume(D),m)}function g(D){return D===45?(e.consume(D),y):m(D)}function y(D){return D===62?P(D):D===45?g(D):m(D)}function v(D){const H="CDATA[";return D===H.charCodeAt(i++)?(e.consume(D),i===H.length?S:v):n(D)}function S(D){return D===null?n(D):D===93?(e.consume(D),w):wt(D)?(s=S,I(D)):(e.consume(D),S)}function w(D){return D===93?(e.consume(D),E):S(D)}function E(D){return D===62?P(D):D===93?(e.consume(D),E):S(D)}function k(D){return D===null||D===62?P(D):wt(D)?(s=k,I(D)):(e.consume(D),k)}function j(D){return D===null?n(D):D===63?(e.consume(D),N):wt(D)?(s=j,I(D)):(e.consume(D),j)}function N(D){return D===62?P(D):j(D)}function A(D){return co(D)?(e.consume(D),R):n(D)}function R(D){return D===45||no(D)?(e.consume(D),R):M(D)}function M(D){return wt(D)?(s=M,I(D)):rn(D)?(e.consume(D),M):P(D)}function T(D){return D===45||no(D)?(e.consume(D),T):D===47||D===62||Bn(D)?O(D):n(D)}function O(D){return D===47?(e.consume(D),P):D===58||D===95||co(D)?(e.consume(D),z):wt(D)?(s=O,I(D)):rn(D)?(e.consume(D),O):P(D)}function z(D){return D===45||D===46||D===58||D===95||no(D)?(e.consume(D),z):q(D)}function q(D){return D===61?(e.consume(D),$):wt(D)?(s=q,I(D)):rn(D)?(e.consume(D),q):O(D)}function $(D){return D===null||D===60||D===61||D===62||D===96?n(D):D===34||D===39?(e.consume(D),o=D,G):wt(D)?(s=$,I(D)):rn(D)?(e.consume(D),$):(e.consume(D),L)}function G(D){return D===o?(e.consume(D),o=void 0,F):D===null?n(D):wt(D)?(s=G,I(D)):(e.consume(D),G)}function L(D){return D===null||D===34||D===39||D===60||D===61||D===96?n(D):D===47||D===62||Bn(D)?O(D):(e.consume(D),L)}function F(D){return D===47||D===62||Bn(D)?O(D):n(D)}function P(D){return D===62?(e.consume(D),e.exit("htmlTextData"),e.exit("htmlText"),t):n(D)}function I(D){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(D),e.exit("lineEnding"),Y}function Y(D){return rn(D)?mn(e,Z,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(D):Z(D)}function Z(D){return e.enter("htmlTextData"),s(D)}}const pC={name:"labelEnd",resolveAll:$ae,resolveTo:Vae,tokenize:Bae},zae={tokenize:Hae},Lae={tokenize:Uae},Fae={tokenize:qae};function $ae(e){let t=-1;const n=[];for(;++t<e.length;){const r=e[t][1];if(n.push(e[t]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const o=r.type==="labelImage"?4:2;r.type="data",t+=o}}return e.length!==n.length&&Zo(e,0,e.length,n),e}function Vae(e,t){let n=e.length,r=0,o,i,s,c;for(;n--;)if(o=e[n][1],i){if(o.type==="link"||o.type==="labelLink"&&o._inactive)break;e[n][0]==="enter"&&o.type==="labelLink"&&(o._inactive=!0)}else if(s){if(e[n][0]==="enter"&&(o.type==="labelImage"||o.type==="labelLink")&&!o._balanced&&(i=n,o.type!=="labelLink")){r=2;break}}else o.type==="labelEnd"&&(s=n);const d={type:e[i][1].type==="labelLink"?"link":"image",start:{...e[i][1].start},end:{...e[e.length-1][1].end}},u={type:"label",start:{...e[i][1].start},end:{...e[s][1].end}},p={type:"labelText",start:{...e[i+r+2][1].end},end:{...e[s-2][1].start}};return c=[["enter",d,t],["enter",u,t]],c=ui(c,e.slice(i+1,i+r+3)),c=ui(c,[["enter",p,t]]),c=ui(c,Tx(t.parser.constructs.insideSpan.null,e.slice(i+r+4,s-3),t)),c=ui(c,[["exit",p,t],e[s-2],e[s-1],["exit",u,t]]),c=ui(c,e.slice(s+1)),c=ui(c,[["exit",d,t]]),Zo(e,i,e.length,c),e}function Bae(e,t,n){const r=this;let o=r.events.length,i,s;for(;o--;)if((r.events[o][1].type==="labelImage"||r.events[o][1].type==="labelLink")&&!r.events[o][1]._balanced){i=r.events[o][1];break}return c;function c(g){return i?i._inactive?m(g):(s=r.parser.defined.includes(Ii(r.sliceSerialize({start:i.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(g),e.exit("labelMarker"),e.exit("labelEnd"),d):n(g)}function d(g){return g===40?e.attempt(zae,p,s?p:m)(g):g===91?e.attempt(Lae,p,s?u:m)(g):s?p(g):m(g)}function u(g){return e.attempt(Fae,p,m)(g)}function p(g){return t(g)}function m(g){return i._balanced=!0,n(g)}}function Hae(e,t,n){return r;function r(m){return e.enter("resource"),e.enter("resourceMarker"),e.consume(m),e.exit("resourceMarker"),o}function o(m){return Bn(m)?Hf(e,i)(m):i(m)}function i(m){return m===41?p(m):k4(e,s,c,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(m)}function s(m){return Bn(m)?Hf(e,d)(m):p(m)}function c(m){return n(m)}function d(m){return m===34||m===39||m===40?R4(e,u,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(m):p(m)}function u(m){return Bn(m)?Hf(e,p)(m):p(m)}function p(m){return m===41?(e.enter("resourceMarker"),e.consume(m),e.exit("resourceMarker"),e.exit("resource"),t):n(m)}}function Uae(e,t,n){const r=this;return o;function o(c){return j4.call(r,e,i,s,"reference","referenceMarker","referenceString")(c)}function i(c){return r.parser.defined.includes(Ii(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(c):n(c)}function s(c){return n(c)}}function qae(e,t,n){return r;function r(i){return e.enter("reference"),e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),o}function o(i){return i===93?(e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),e.exit("reference"),t):n(i)}}const Yae={name:"labelStartImage",resolveAll:pC.resolveAll,tokenize:Zae};function Zae(e,t,n){const r=this;return o;function o(c){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(c),e.exit("labelImageMarker"),i}function i(c){return c===91?(e.enter("labelMarker"),e.consume(c),e.exit("labelMarker"),e.exit("labelImage"),s):n(c)}function s(c){return c===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(c):t(c)}}const Gae={name:"labelStartLink",resolveAll:pC.resolveAll,tokenize:Kae};function Kae(e,t,n){const r=this;return o;function o(s){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(s),e.exit("labelMarker"),e.exit("labelLink"),i}function i(s){return s===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(s):t(s)}}const H0={name:"lineEnding",tokenize:Xae};function Xae(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),mn(e,t,"linePrefix")}}const Cg={name:"thematicBreak",tokenize:Qae};function Qae(e,t,n){let r=0,o;return i;function i(u){return e.enter("thematicBreak"),s(u)}function s(u){return o=u,c(u)}function c(u){return u===o?(e.enter("thematicBreakSequence"),d(u)):r>=3&&(u===null||wt(u))?(e.exit("thematicBreak"),t(u)):n(u)}function d(u){return u===o?(e.consume(u),r++,d):(e.exit("thematicBreakSequence"),rn(u)?mn(e,c,"whitespace")(u):c(u))}}const bo={continuation:{tokenize:tle},exit:rle,name:"list",tokenize:ele},Wae={partial:!0,tokenize:ole},Jae={partial:!0,tokenize:nle};function ele(e,t,n){const r=this,o=r.events[r.events.length-1];let i=o&&o[1].type==="linePrefix"?o[2].sliceSerialize(o[1],!0).length:0,s=0;return c;function c(y){const v=r.containerState.type||(y===42||y===43||y===45?"listUnordered":"listOrdered");if(v==="listUnordered"?!r.containerState.marker||y===r.containerState.marker:AS(y)){if(r.containerState.type||(r.containerState.type=v,e.enter(v,{_container:!0})),v==="listUnordered")return e.enter("listItemPrefix"),y===42||y===45?e.check(Cg,n,u)(y):u(y);if(!r.interrupt||y===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),d(y)}return n(y)}function d(y){return AS(y)&&++s<10?(e.consume(y),d):(!r.interrupt||s<2)&&(r.containerState.marker?y===r.containerState.marker:y===41||y===46)?(e.exit("listItemValue"),u(y)):n(y)}function u(y){return e.enter("listItemMarker"),e.consume(y),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||y,e.check(tp,r.interrupt?n:p,e.attempt(Wae,g,m))}function p(y){return r.containerState.initialBlankLine=!0,i++,g(y)}function m(y){return rn(y)?(e.enter("listItemPrefixWhitespace"),e.consume(y),e.exit("listItemPrefixWhitespace"),g):n(y)}function g(y){return r.containerState.size=i+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(y)}}function tle(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(tp,o,i);function o(c){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,mn(e,t,"listItemIndent",r.containerState.size+1)(c)}function i(c){return r.containerState.furtherBlankLines||!rn(c)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,s(c)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(Jae,t,s)(c))}function s(c){return r.containerState._closeFlow=!0,r.interrupt=void 0,mn(e,e.attempt(bo,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(c)}}function nle(e,t,n){const r=this;return mn(e,o,"listItemIndent",r.containerState.size+1);function o(i){const s=r.events[r.events.length-1];return s&&s[1].type==="listItemIndent"&&s[2].sliceSerialize(s[1],!0).length===r.containerState.size?t(i):n(i)}}function rle(e){e.exit(this.containerState.type)}function ole(e,t,n){const r=this;return mn(e,o,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function o(i){const s=r.events[r.events.length-1];return!rn(i)&&s&&s[1].type==="listItemPrefixWhitespace"?t(i):n(i)}}const fA={name:"setextUnderline",resolveTo:ile,tokenize:sle};function ile(e,t){let n=e.length,r,o,i;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(o=n)}else e[n][1].type==="content"&&e.splice(n,1),!i&&e[n][1].type==="definition"&&(i=n);const s={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[o][1].type="setextHeadingText",i?(e.splice(o,0,["enter",s,t]),e.splice(i+1,0,["exit",e[r][1],t]),e[r][1].end={...e[i][1].end}):e[r][1]=s,e.push(["exit",s,t]),e}function sle(e,t,n){const r=this;let o;return i;function i(u){let p=r.events.length,m;for(;p--;)if(r.events[p][1].type!=="lineEnding"&&r.events[p][1].type!=="linePrefix"&&r.events[p][1].type!=="content"){m=r.events[p][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||m)?(e.enter("setextHeadingLine"),o=u,s(u)):n(u)}function s(u){return e.enter("setextHeadingLineSequence"),c(u)}function c(u){return u===o?(e.consume(u),c):(e.exit("setextHeadingLineSequence"),rn(u)?mn(e,d,"lineSuffix")(u):d(u))}function d(u){return u===null||wt(u)?(e.exit("setextHeadingLine"),t(u)):n(u)}}const ale={tokenize:lle};function lle(e){const t=this,n=e.attempt(tp,r,e.attempt(this.parser.constructs.flowInitial,o,mn(e,e.attempt(this.parser.constructs.flow,o,e.attempt(hae,o)),"linePrefix")));return n;function r(i){if(i===null){e.consume(i);return}return e.enter("lineEndingBlank"),e.consume(i),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function o(i){if(i===null){e.consume(i);return}return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const cle={resolveAll:N4()},ule=_4("string"),dle=_4("text");function _4(e){return{resolveAll:N4(e==="text"?fle:void 0),tokenize:t};function t(n){const r=this,o=this.parser.constructs[e],i=n.attempt(o,s,c);return s;function s(p){return u(p)?i(p):c(p)}function c(p){if(p===null){n.consume(p);return}return n.enter("data"),n.consume(p),d}function d(p){return u(p)?(n.exit("data"),i(p)):(n.consume(p),d)}function u(p){if(p===null)return!0;const m=o[p];let g=-1;if(m)for(;++g<m.length;){const y=m[g];if(!y.previous||y.previous.call(r,r.previous))return!0}return!1}}}function N4(e){return t;function t(n,r){let o=-1,i;for(;++o<=n.length;)i===void 0?n[o]&&n[o][1].type==="data"&&(i=o,o++):(!n[o]||n[o][1].type!=="data")&&(o!==i+2&&(n[i][1].end=n[o-1][1].end,n.splice(i+2,o-i-2),o=i+2),i=void 0);return e?e(n,r):n}}function fle(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const r=e[n-1][1],o=t.sliceStream(r);let i=o.length,s=-1,c=0,d;for(;i--;){const u=o[i];if(typeof u=="string"){for(s=u.length;u.charCodeAt(s-1)===32;)c++,s--;if(s)break;s=-1}else if(u===-2)d=!0,c++;else if(u!==-1){i++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(c=0),c){const u={type:n===e.length||d||c<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:i?s:r.start._bufferIndex+s,_index:r.start._index+i,line:r.end.line,column:r.end.column-c,offset:r.end.offset-c},end:{...r.end}};r.end={...u.start},r.start.offset===r.end.offset?Object.assign(r,u):(e.splice(n,0,["enter",u,t],["exit",u,t]),n+=2)}n++}return e}const hle={42:bo,43:bo,45:bo,48:bo,49:bo,50:bo,51:bo,52:bo,53:bo,54:bo,55:bo,56:bo,57:bo,62:w4},ple={91:xae},mle={[-2]:B0,[-1]:B0,32:B0},gle={35:Cae,42:Cg,45:[fA,Cg],60:_ae,61:fA,95:Cg,96:uA,126:uA},yle={38:E4,92:S4},xle={[-5]:H0,[-4]:H0,[-3]:H0,33:Yae,38:E4,42:OS,60:[Gse,Pae],91:Gae,92:[Sae,S4],93:pC,95:OS,96:aae},vle={null:[OS,cle]},ble={null:[42,95]},wle={null:[]},Sle=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:ble,contentInitial:ple,disable:wle,document:hle,flow:gle,flowInitial:mle,insideSpan:vle,string:yle,text:xle},Symbol.toStringTag,{value:"Module"}));function Ele(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const o={},i=[];let s=[],c=[];const d={attempt:M(A),check:M(R),consume:k,enter:j,exit:N,interrupt:M(R,{interrupt:!0})},u={code:null,containerState:{},defineSkip:S,events:[],now:v,parser:e,previous:null,sliceSerialize:g,sliceStream:y,write:m};let p=t.tokenize.call(u,d);return t.resolveAll&&i.push(t),u;function m(q){return s=ui(s,q),w(),s[s.length-1]!==null?[]:(T(t,0),u.events=Tx(i,u.events,u),u.events)}function g(q,$){return kle(y(q),$)}function y(q){return Cle(s,q)}function v(){const{_bufferIndex:q,_index:$,line:G,column:L,offset:F}=r;return{_bufferIndex:q,_index:$,line:G,column:L,offset:F}}function S(q){o[q.line]=q.column,z()}function w(){let q;for(;r._index<s.length;){const $=s[r._index];if(typeof $=="string")for(q=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===q&&r._bufferIndex<$.length;)E($.charCodeAt(r._bufferIndex));else E($)}}function E(q){p=p(q)}function k(q){wt(q)?(r.line++,r.column=1,r.offset+=q===-3?2:1,z()):q!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===s[r._index].length&&(r._bufferIndex=-1,r._index++)),u.previous=q}function j(q,$){const G=$||{};return G.type=q,G.start=v(),u.events.push(["enter",G,u]),c.push(G),G}function N(q){const $=c.pop();return $.end=v(),u.events.push(["exit",$,u]),$}function A(q,$){T(q,$.from)}function R(q,$){$.restore()}function M(q,$){return G;function G(L,F,P){let I,Y,Z,D;return Array.isArray(L)?U(L):"tokenize"in L?U([L]):H(L);function H(Q){return oe;function oe(W){const ne=W!==null&&Q[W],je=W!==null&&Q.null,Ee=[...Array.isArray(ne)?ne:ne?[ne]:[],...Array.isArray(je)?je:je?[je]:[]];return U(Ee)(W)}}function U(Q){return I=Q,Y=0,Q.length===0?P:B(Q[Y])}function B(Q){return oe;function oe(W){return D=O(),Z=Q,Q.partial||(u.currentConstruct=Q),Q.name&&u.parser.constructs.disable.null.includes(Q.name)?J():Q.tokenize.call($?Object.assign(Object.create(u),$):u,d,X,J)(W)}}function X(Q){return q(Z,D),F}function J(Q){return D.restore(),++Y<I.length?B(I[Y]):P}}}function T(q,$){q.resolveAll&&!i.includes(q)&&i.push(q),q.resolve&&Zo(u.events,$,u.events.length-$,q.resolve(u.events.slice($),u)),q.resolveTo&&(u.events=q.resolveTo(u.events,u))}function O(){const q=v(),$=u.previous,G=u.currentConstruct,L=u.events.length,F=Array.from(c);return{from:L,restore:P};function P(){r=q,u.previous=$,u.currentConstruct=G,u.events.length=L,c=F,z()}}function z(){r.line in o&&r.column<2&&(r.column=o[r.line],r.offset+=o[r.line]-1)}}function Cle(e,t){const n=t.start._index,r=t.start._bufferIndex,o=t.end._index,i=t.end._bufferIndex;let s;if(n===o)s=[e[n].slice(r,i)];else{if(s=e.slice(n,o),r>-1){const c=s[0];typeof c=="string"?s[0]=c.slice(r):s.shift()}i>0&&s.push(e[o].slice(0,i))}return s}function kle(e,t){let n=-1;const r=[];let o;for(;++n<e.length;){const i=e[n];let s;if(typeof i=="string")s=i;else switch(i){case-5:{s="\r";break}case-4:{s=`
117
+ `;break}case-3:{s=`\r
118
+ `;break}case-2:{s=t?" ":" ";break}case-1:{if(!t&&o)continue;s=" ";break}default:s=String.fromCharCode(i)}o=i===-2,r.push(s)}return r.join("")}function jle(e){const r={constructs:v4([Sle,...(e||{}).extensions||[]]),content:o(Vse),defined:[],document:o(Hse),flow:o(ale),lazy:{},string:o(ule),text:o(dle)};return r;function o(i){return s;function s(c){return Ele(r,i,c)}}}function Rle(e){for(;!C4(e););return e}const hA=/[\0\t\n\r]/g;function _le(){let e=1,t="",n=!0,r;return o;function o(i,s,c){const d=[];let u,p,m,g,y;for(i=t+(typeof i=="string"?i.toString():new TextDecoder(s||void 0).decode(i)),m=0,t="",n&&(i.charCodeAt(0)===65279&&m++,n=void 0);m<i.length;){if(hA.lastIndex=m,u=hA.exec(i),g=u&&u.index!==void 0?u.index:i.length,y=i.charCodeAt(g),!u){t=i.slice(m);break}if(y===10&&m===g&&r)d.push(-3),r=void 0;else switch(r&&(d.push(-5),r=void 0),m<g&&(d.push(i.slice(m,g)),e+=g-m),y){case 0:{d.push(65533),e++;break}case 9:{for(p=Math.ceil(e/4)*4,d.push(-2);e++<p;)d.push(-1);break}case 10:{d.push(-4),e=1;break}default:r=!0,e=1}m=g+1}return c&&(r&&d.push(-5),t&&d.push(t),d.push(null)),d}}const Nle=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function Tle(e){return e.replace(Nle,Mle)}function Mle(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const o=n.charCodeAt(1),i=o===120||o===88;return b4(n.slice(i?2:1),i?16:10)}return hC(n)||e}const T4={}.hasOwnProperty;function Ale(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),Ole(n)(Rle(jle(n).document().write(_le()(e,t,!0))))}function Ole(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(Me),autolinkProtocol:O,autolinkEmail:O,atxHeading:i(_e),blockQuote:i(je),characterEscape:O,characterReference:O,codeFenced:i(Ee),codeFencedFenceInfo:s,codeFencedFenceMeta:s,codeIndented:i(Ee,s),codeText:i(pe,s),codeTextData:O,data:O,codeFlowValue:O,definition:i(re),definitionDestinationString:s,definitionLabelString:s,definitionTitleString:s,emphasis:i(ge),hardBreakEscape:i(De),hardBreakTrailing:i(De),htmlFlow:i(we,s),htmlFlowData:O,htmlText:i(we,s),htmlTextData:O,image:i($e),label:s,link:i(Me),listItem:i(He),listItemValue:g,listOrdered:i(Le,m),listUnordered:i(Le),paragraph:i(Ge),reference:B,referenceString:s,resourceDestinationString:s,resourceTitleString:s,setextHeading:i(_e),strong:i(ot),thematicBreak:i(ke)},exit:{atxHeading:d(),atxHeadingSequence:A,autolink:d(),autolinkEmail:ne,autolinkProtocol:W,blockQuote:d(),characterEscapeValue:z,characterReferenceMarkerHexadecimal:J,characterReferenceMarkerNumeric:J,characterReferenceValue:Q,characterReference:oe,codeFenced:d(w),codeFencedFence:S,codeFencedFenceInfo:y,codeFencedFenceMeta:v,codeFlowValue:z,codeIndented:d(E),codeText:d(F),codeTextData:z,data:z,definition:d(),definitionDestinationString:N,definitionLabelString:k,definitionTitleString:j,emphasis:d(),hardBreakEscape:d($),hardBreakTrailing:d($),htmlFlow:d(G),htmlFlowData:z,htmlText:d(L),htmlTextData:z,image:d(I),label:Z,labelText:Y,lineEnding:q,link:d(P),listItem:d(),listOrdered:d(),listUnordered:d(),paragraph:d(),referenceString:X,resourceDestinationString:D,resourceTitleString:H,resource:U,setextHeading:d(T),setextHeadingLineSequence:M,setextHeadingText:R,strong:d(),thematicBreak:d()}};M4(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(de){let ue={type:"root",children:[]};const Se={stack:[ue],tokenStack:[],config:t,enter:c,exit:u,buffer:s,resume:p,data:n},Ue=[];let Ye=-1;for(;++Ye<de.length;)if(de[Ye][1].type==="listOrdered"||de[Ye][1].type==="listUnordered")if(de[Ye][0]==="enter")Ue.push(Ye);else{const kt=Ue.pop();Ye=o(de,kt,Ye)}for(Ye=-1;++Ye<de.length;){const kt=t[de[Ye][0]];T4.call(kt,de[Ye][1].type)&&kt[de[Ye][1].type].call(Object.assign({sliceSerialize:de[Ye][2].sliceSerialize},Se),de[Ye][1])}if(Se.tokenStack.length>0){const kt=Se.tokenStack[Se.tokenStack.length-1];(kt[1]||pA).call(Se,void 0,kt[0])}for(ue.position={start:Ia(de.length>0?de[0][1].start:{line:1,column:1,offset:0}),end:Ia(de.length>0?de[de.length-2][1].end:{line:1,column:1,offset:0})},Ye=-1;++Ye<t.transforms.length;)ue=t.transforms[Ye](ue)||ue;return ue}function o(de,ue,Se){let Ue=ue-1,Ye=-1,kt=!1,ee,ie,le,Ce;for(;++Ue<=Se;){const ve=de[Ue];switch(ve[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{ve[0]==="enter"?Ye++:Ye--,Ce=void 0;break}case"lineEndingBlank":{ve[0]==="enter"&&(ee&&!Ce&&!Ye&&!le&&(le=Ue),Ce=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Ce=void 0}if(!Ye&&ve[0]==="enter"&&ve[1].type==="listItemPrefix"||Ye===-1&&ve[0]==="exit"&&(ve[1].type==="listUnordered"||ve[1].type==="listOrdered")){if(ee){let Be=Ue;for(ie=void 0;Be--;){const Pe=de[Be];if(Pe[1].type==="lineEnding"||Pe[1].type==="lineEndingBlank"){if(Pe[0]==="exit")continue;ie&&(de[ie][1].type="lineEndingBlank",kt=!0),Pe[1].type="lineEnding",ie=Be}else if(!(Pe[1].type==="linePrefix"||Pe[1].type==="blockQuotePrefix"||Pe[1].type==="blockQuotePrefixWhitespace"||Pe[1].type==="blockQuoteMarker"||Pe[1].type==="listItemIndent"))break}le&&(!ie||le<ie)&&(ee._spread=!0),ee.end=Object.assign({},ie?de[ie][1].start:ve[1].end),de.splice(ie||Ue,0,["exit",ee,ve[2]]),Ue++,Se++}if(ve[1].type==="listItemPrefix"){const Be={type:"listItem",_spread:!1,start:Object.assign({},ve[1].start),end:void 0};ee=Be,de.splice(Ue,0,["enter",Be,ve[2]]),Ue++,Se++,le=void 0,Ce=!0}}}return de[ue][1]._spread=kt,Se}function i(de,ue){return Se;function Se(Ue){c.call(this,de(Ue),Ue),ue&&ue.call(this,Ue)}}function s(){this.stack.push({type:"fragment",children:[]})}function c(de,ue,Se){this.stack[this.stack.length-1].children.push(de),this.stack.push(de),this.tokenStack.push([ue,Se||void 0]),de.position={start:Ia(ue.start),end:void 0}}function d(de){return ue;function ue(Se){de&&de.call(this,Se),u.call(this,Se)}}function u(de,ue){const Se=this.stack.pop(),Ue=this.tokenStack.pop();if(Ue)Ue[0].type!==de.type&&(ue?ue.call(this,de,Ue[0]):(Ue[1]||pA).call(this,de,Ue[0]));else throw new Error("Cannot close `"+de.type+"` ("+Bf({start:de.start,end:de.end})+"): it’s not open");Se.position.end=Ia(de.end)}function p(){return fC(this.stack.pop())}function m(){this.data.expectingFirstListItemValue=!0}function g(de){if(this.data.expectingFirstListItemValue){const ue=this.stack[this.stack.length-2];ue.start=Number.parseInt(this.sliceSerialize(de),10),this.data.expectingFirstListItemValue=void 0}}function y(){const de=this.resume(),ue=this.stack[this.stack.length-1];ue.lang=de}function v(){const de=this.resume(),ue=this.stack[this.stack.length-1];ue.meta=de}function S(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function w(){const de=this.resume(),ue=this.stack[this.stack.length-1];ue.value=de.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function E(){const de=this.resume(),ue=this.stack[this.stack.length-1];ue.value=de.replace(/(\r?\n|\r)$/g,"")}function k(de){const ue=this.resume(),Se=this.stack[this.stack.length-1];Se.label=ue,Se.identifier=Ii(this.sliceSerialize(de)).toLowerCase()}function j(){const de=this.resume(),ue=this.stack[this.stack.length-1];ue.title=de}function N(){const de=this.resume(),ue=this.stack[this.stack.length-1];ue.url=de}function A(de){const ue=this.stack[this.stack.length-1];if(!ue.depth){const Se=this.sliceSerialize(de).length;ue.depth=Se}}function R(){this.data.setextHeadingSlurpLineEnding=!0}function M(de){const ue=this.stack[this.stack.length-1];ue.depth=this.sliceSerialize(de).codePointAt(0)===61?1:2}function T(){this.data.setextHeadingSlurpLineEnding=void 0}function O(de){const Se=this.stack[this.stack.length-1].children;let Ue=Se[Se.length-1];(!Ue||Ue.type!=="text")&&(Ue=me(),Ue.position={start:Ia(de.start),end:void 0},Se.push(Ue)),this.stack.push(Ue)}function z(de){const ue=this.stack.pop();ue.value+=this.sliceSerialize(de),ue.position.end=Ia(de.end)}function q(de){const ue=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Se=ue.children[ue.children.length-1];Se.position.end=Ia(de.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(ue.type)&&(O.call(this,de),z.call(this,de))}function $(){this.data.atHardBreak=!0}function G(){const de=this.resume(),ue=this.stack[this.stack.length-1];ue.value=de}function L(){const de=this.resume(),ue=this.stack[this.stack.length-1];ue.value=de}function F(){const de=this.resume(),ue=this.stack[this.stack.length-1];ue.value=de}function P(){const de=this.stack[this.stack.length-1];if(this.data.inReference){const ue=this.data.referenceType||"shortcut";de.type+="Reference",de.referenceType=ue,delete de.url,delete de.title}else delete de.identifier,delete de.label;this.data.referenceType=void 0}function I(){const de=this.stack[this.stack.length-1];if(this.data.inReference){const ue=this.data.referenceType||"shortcut";de.type+="Reference",de.referenceType=ue,delete de.url,delete de.title}else delete de.identifier,delete de.label;this.data.referenceType=void 0}function Y(de){const ue=this.sliceSerialize(de),Se=this.stack[this.stack.length-2];Se.label=Tle(ue),Se.identifier=Ii(ue).toLowerCase()}function Z(){const de=this.stack[this.stack.length-1],ue=this.resume(),Se=this.stack[this.stack.length-1];if(this.data.inReference=!0,Se.type==="link"){const Ue=de.children;Se.children=Ue}else Se.alt=ue}function D(){const de=this.resume(),ue=this.stack[this.stack.length-1];ue.url=de}function H(){const de=this.resume(),ue=this.stack[this.stack.length-1];ue.title=de}function U(){this.data.inReference=void 0}function B(){this.data.referenceType="collapsed"}function X(de){const ue=this.resume(),Se=this.stack[this.stack.length-1];Se.label=ue,Se.identifier=Ii(this.sliceSerialize(de)).toLowerCase(),this.data.referenceType="full"}function J(de){this.data.characterReferenceType=de.type}function Q(de){const ue=this.sliceSerialize(de),Se=this.data.characterReferenceType;let Ue;Se?(Ue=b4(ue,Se==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Ue=hC(ue);const Ye=this.stack[this.stack.length-1];Ye.value+=Ue}function oe(de){const ue=this.stack.pop();ue.position.end=Ia(de.end)}function W(de){z.call(this,de);const ue=this.stack[this.stack.length-1];ue.url=this.sliceSerialize(de)}function ne(de){z.call(this,de);const ue=this.stack[this.stack.length-1];ue.url="mailto:"+this.sliceSerialize(de)}function je(){return{type:"blockquote",children:[]}}function Ee(){return{type:"code",lang:null,meta:null,value:""}}function pe(){return{type:"inlineCode",value:""}}function re(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function ge(){return{type:"emphasis",children:[]}}function _e(){return{type:"heading",depth:0,children:[]}}function De(){return{type:"break"}}function we(){return{type:"html",value:""}}function $e(){return{type:"image",title:null,url:"",alt:null}}function Me(){return{type:"link",title:null,url:"",children:[]}}function Le(de){return{type:"list",ordered:de.type==="listOrdered",start:null,spread:de._spread,children:[]}}function He(de){return{type:"listItem",spread:de._spread,checked:null,children:[]}}function Ge(){return{type:"paragraph",children:[]}}function ot(){return{type:"strong",children:[]}}function me(){return{type:"text",value:""}}function ke(){return{type:"thematicBreak"}}}function Ia(e){return{line:e.line,column:e.column,offset:e.offset}}function M4(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?M4(e,r):Dle(e,r)}}function Dle(e,t){let n;for(n in t)if(T4.call(t,n))switch(n){case"canContainEols":{const r=t[n];r&&e[n].push(...r);break}case"transforms":{const r=t[n];r&&e[n].push(...r);break}case"enter":case"exit":{const r=t[n];r&&Object.assign(e[n],r);break}}}function pA(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Bf({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Bf({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Bf({start:t.start,end:t.end})+") is still open")}function Ple(e){const t=this;t.parser=n;function n(r){return Ale(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function Ile(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function zle(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
119
+ `}]}function Lle(e,t){const n=t.value?t.value+`
120
+ `:"",r={},o=t.lang?t.lang.split(/\s+/):[];o.length>0&&(r.className=["language-"+o[0]]);let i={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(i.data={meta:t.meta}),e.patch(t,i),i=e.applyData(t,i),i={type:"element",tagName:"pre",properties:{},children:[i]},e.patch(t,i),i}function Fle(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function $le(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Vle(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),o=pd(r.toLowerCase()),i=e.footnoteOrder.indexOf(r);let s,c=e.footnoteCounts.get(r);c===void 0?(c=0,e.footnoteOrder.push(r),s=e.footnoteOrder.length):s=i+1,c+=1,e.footnoteCounts.set(r,c);const d={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+o,id:n+"fnref-"+o+(c>1?"-"+c:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(s)}]};e.patch(t,d);const u={type:"element",tagName:"sup",properties:{},children:[d]};return e.patch(t,u),e.applyData(t,u)}function Ble(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Hle(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function A4(e,t){const n=t.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+r}];const o=e.all(t),i=o[0];i&&i.type==="text"?i.value="["+i.value:o.unshift({type:"text",value:"["});const s=o[o.length-1];return s&&s.type==="text"?s.value+=r:o.push({type:"text",value:r}),o}function Ule(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return A4(e,t);const o={src:pd(r.url||""),alt:t.alt};r.title!==null&&r.title!==void 0&&(o.title=r.title);const i={type:"element",tagName:"img",properties:o,children:[]};return e.patch(t,i),e.applyData(t,i)}function qle(e,t){const n={src:pd(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function Yle(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function Zle(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return A4(e,t);const o={href:pd(r.url||"")};r.title!==null&&r.title!==void 0&&(o.title=r.title);const i={type:"element",tagName:"a",properties:o,children:e.all(t)};return e.patch(t,i),e.applyData(t,i)}function Gle(e,t){const n={href:pd(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function Kle(e,t,n){const r=e.all(t),o=n?Xle(n):O4(t),i={},s=[];if(typeof t.checked=="boolean"){const p=r[0];let m;p&&p.type==="element"&&p.tagName==="p"?m=p:(m={type:"element",tagName:"p",properties:{},children:[]},r.unshift(m)),m.children.length>0&&m.children.unshift({type:"text",value:" "}),m.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),i.className=["task-list-item"]}let c=-1;for(;++c<r.length;){const p=r[c];(o||c!==0||p.type!=="element"||p.tagName!=="p")&&s.push({type:"text",value:`
121
+ `}),p.type==="element"&&p.tagName==="p"&&!o?s.push(...p.children):s.push(p)}const d=r[r.length-1];d&&(o||d.type!=="element"||d.tagName!=="p")&&s.push({type:"text",value:`
122
+ `});const u={type:"element",tagName:"li",properties:i,children:s};return e.patch(t,u),e.applyData(t,u)}function Xle(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const n=e.children;let r=-1;for(;!t&&++r<n.length;)t=O4(n[r])}return t}function O4(e){const t=e.spread;return t??e.children.length>1}function Qle(e,t){const n={},r=e.all(t);let o=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++o<r.length;){const s=r[o];if(s.type==="element"&&s.tagName==="li"&&s.properties&&Array.isArray(s.properties.className)&&s.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const i={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(r,!0)};return e.patch(t,i),e.applyData(t,i)}function Wle(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Jle(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function ece(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function tce(e,t){const n=e.all(t),r=n.shift(),o=[];if(r){const s={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],s),o.push(s)}if(n.length>0){const s={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},c=lC(t.children[1]),d=f4(t.children[t.children.length-1]);c&&d&&(s.position={start:c,end:d}),o.push(s)}const i={type:"element",tagName:"table",properties:{},children:e.wrap(o,!0)};return e.patch(t,i),e.applyData(t,i)}function nce(e,t,n){const r=n?n.children:void 0,i=(r?r.indexOf(t):1)===0?"th":"td",s=n&&n.type==="table"?n.align:void 0,c=s?s.length:t.children.length;let d=-1;const u=[];for(;++d<c;){const m=t.children[d],g={},y=s?s[d]:void 0;y&&(g.align=y);let v={type:"element",tagName:i,properties:g,children:[]};m&&(v.children=e.all(m),e.patch(m,v),v=e.applyData(m,v)),u.push(v)}const p={type:"element",tagName:"tr",properties:{},children:e.wrap(u,!0)};return e.patch(t,p),e.applyData(t,p)}function rce(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const mA=9,gA=32;function oce(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),o=0;const i=[];for(;r;)i.push(yA(t.slice(o,r.index),o>0,!0),r[0]),o=r.index+r[0].length,r=n.exec(t);return i.push(yA(t.slice(o),o>0,!1)),i.join("")}function yA(e,t,n){let r=0,o=e.length;if(t){let i=e.codePointAt(r);for(;i===mA||i===gA;)r++,i=e.codePointAt(r)}if(n){let i=e.codePointAt(o-1);for(;i===mA||i===gA;)o--,i=e.codePointAt(o-1)}return o>r?e.slice(r,o):""}function ice(e,t){const n={type:"text",value:oce(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function sce(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const ace={blockquote:Ile,break:zle,code:Lle,delete:Fle,emphasis:$le,footnoteReference:Vle,heading:Ble,html:Hle,imageReference:Ule,image:qle,inlineCode:Yle,linkReference:Zle,link:Gle,listItem:Kle,list:Qle,paragraph:Wle,root:Jle,strong:ece,table:tce,tableCell:rce,tableRow:nce,text:ice,thematicBreak:sce,toml:Qm,yaml:Qm,definition:Qm,footnoteDefinition:Qm};function Qm(){}const D4=-1,Mx=0,Uf=1,cy=2,mC=3,gC=4,yC=5,xC=6,P4=7,I4=8,{defineProperty:lce}=Object,z4=typeof self=="object"?self:globalThis,xA=(e,t)=>{switch(e){case"Function":case"SharedWorker":case"Worker":case"eval":case"setInterval":case"setTimeout":throw new TypeError("unable to deserialize "+e)}return new z4[e](t)},cce=(e,t)=>{const n=(o,i)=>(e.set(i,o),o),r=o=>{if(e.has(o))return e.get(o);const[i,s]=t[o];switch(i){case Mx:case D4:return n(s,o);case Uf:{const c=n([],o);for(const d of s)c.push(r(d));return c}case cy:{const c=n({},o);for(const[d,u]of s){const p=r(d),m=r(u);p==="__proto__"?lce(c,p,{value:m,configurable:!0,enumerable:!0,writable:!0}):c[p]=m}return c}case mC:return n(new Date(s),o);case gC:{const{source:c,flags:d}=s;return n(new RegExp(c,d),o)}case yC:{const c=n(new Map,o);for(const[d,u]of s)c.set(r(d),r(u));return c}case xC:{const c=n(new Set,o);for(const d of s)c.add(r(d));return c}case P4:{const{name:c,message:d}=s;return n(typeof z4[c]=="function"?xA(c,d):new Error(d),o)}case I4:return n(BigInt(s),o);case"BigInt":return n(Object(BigInt(s)),o);case"ArrayBuffer":return n(new Uint8Array(s).buffer,s);case"DataView":{const{buffer:c}=new Uint8Array(s);return n(new DataView(c),s)}case"-0":return-0}return n(xA(i,s),o)};return r},vA=e=>cce(new Map,e)(0),zl="",{toString:uce}={},{keys:dce,is:fce}=Object,xf=e=>{const t=typeof e;if(t!=="object"||!e)return[Mx,t];const n=uce.call(e).slice(8,-1);switch(n){case"Array":return[Uf,zl];case"Object":return[cy,zl];case"Date":return[mC,zl];case"RegExp":return[gC,zl];case"Map":return[yC,zl];case"Set":return[xC,zl];case"DataView":return[Uf,n]}return n.includes("Array")?[Uf,n]:e instanceof Error?[P4,e.name||"Error"]:[cy,n]},Wm=([e,t])=>e===Mx&&(t==="function"||t==="symbol"),hce=(e,t,n,r)=>{const o=(s,c)=>{const d=r.push(s)-1;return n.set(c,d),d},i=s=>{if(n.has(s))return n.get(s);let[c,d]=xf(s);switch(c){case Mx:{let p=s;switch(d){case"bigint":c=I4,p=s.toString();break;case"number":if(!s&&fce(s,-0))return r.push(["-0"])-1;break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+d);p=null;break;case"undefined":return o([D4],s)}return o([c,p],s)}case Uf:{if(d){let g=s;return d==="DataView"?g=new Uint8Array(s.buffer):d==="ArrayBuffer"&&(g=new Uint8Array(s)),o([d,[...g]],s)}const p=[],m=o([c,p],s);for(const g of s)p.push(i(g));return m}case cy:{if(d)switch(d){case"BigInt":return o([d,s.toString()],s);case"Boolean":case"Number":case"String":return o([d,s.valueOf()],s)}if(t&&"toJSON"in s)return i(s.toJSON());const p=[],m=o([c,p],s);for(const g of dce(s))(e||!Wm(xf(s[g])))&&p.push([i(g),i(s[g])]);return m}case mC:return o([c,isNaN(s.getTime())?zl:s.toISOString()],s);case gC:{const{source:p,flags:m}=s;return o([c,{source:p,flags:m}],s)}case yC:{const p=[],m=o([c,p],s);for(const[g,y]of s)(e||!(Wm(xf(g))||Wm(xf(y))))&&p.push([i(g),i(y)]);return m}case xC:{const p=[],m=o([c,p],s);for(const g of s)(e||!Wm(xf(g)))&&p.push(i(g));return m}}const{message:u}=s;return o([c,{name:d,message:u}],s)};return i},bA=(e,{json:t,lossy:n}={})=>{const r=[];return hce(!(t||n),!!t,new Map,r)(e),r},uy=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?vA(bA(e,t)):structuredClone(e):(e,t)=>vA(bA(e,t));function pce(e,t){const n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function mce(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function gce(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||pce,r=e.options.footnoteBackLabel||mce,o=e.options.footnoteLabel||"Footnotes",i=e.options.footnoteLabelTagName||"h2",s=e.options.footnoteLabelProperties||{className:["sr-only"]},c=[];let d=-1;for(;++d<e.footnoteOrder.length;){const u=e.footnoteById.get(e.footnoteOrder[d]);if(!u)continue;const p=e.all(u),m=String(u.identifier).toUpperCase(),g=pd(m.toLowerCase());let y=0;const v=[],S=e.footnoteCounts.get(m);for(;S!==void 0&&++y<=S;){v.length>0&&v.push({type:"text",value:" "});let k=typeof n=="string"?n:n(d,y);typeof k=="string"&&(k={type:"text",value:k}),v.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+g+(y>1?"-"+y:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(d,y),className:["data-footnote-backref"]},children:Array.isArray(k)?k:[k]})}const w=p[p.length-1];if(w&&w.type==="element"&&w.tagName==="p"){const k=w.children[w.children.length-1];k&&k.type==="text"?k.value+=" ":w.children.push({type:"text",value:" "}),w.children.push(...v)}else p.push(...v);const E={type:"element",tagName:"li",properties:{id:t+"fn-"+g},children:e.wrap(p,!0)};e.patch(u,E),c.push(E)}if(c.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:i,properties:{...uy(s),id:"footnote-label"},children:[{type:"text",value:o}]},{type:"text",value:`
123
+ `},{type:"element",tagName:"ol",properties:{},children:e.wrap(c,!0)},{type:"text",value:`
124
+ `}]}}const Ax=(function(e){if(e==null)return bce;if(typeof e=="function")return Ox(e);if(typeof e=="object")return Array.isArray(e)?yce(e):xce(e);if(typeof e=="string")return vce(e);throw new Error("Expected function, string, or object as test")});function yce(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=Ax(e[n]);return Ox(r);function r(...o){let i=-1;for(;++i<t.length;)if(t[i].apply(this,o))return!0;return!1}}function xce(e){const t=e;return Ox(n);function n(r){const o=r;let i;for(i in e)if(o[i]!==t[i])return!1;return!0}}function vce(e){return Ox(t);function t(n){return n&&n.type===e}}function Ox(e){return t;function t(n,r,o){return!!(wce(n)&&e.call(this,n,typeof r=="number"?r:void 0,o||void 0))}}function bce(){return!0}function wce(e){return e!==null&&typeof e=="object"&&"type"in e}const L4=[],Sce=!0,DS=!1,Ece="skip";function F4(e,t,n,r){let o;typeof t=="function"&&typeof n!="function"?(r=n,n=t):o=t;const i=Ax(o),s=r?-1:1;c(e,void 0,[])();function c(d,u,p){const m=d&&typeof d=="object"?d:{};if(typeof m.type=="string"){const y=typeof m.tagName=="string"?m.tagName:typeof m.name=="string"?m.name:void 0;Object.defineProperty(g,"name",{value:"node ("+(d.type+(y?"<"+y+">":""))+")"})}return g;function g(){let y=L4,v,S,w;if((!t||i(d,u,p[p.length-1]||void 0))&&(y=Cce(n(d,p)),y[0]===DS))return y;if("children"in d&&d.children){const E=d;if(E.children&&y[0]!==Ece)for(S=(r?E.children.length:-1)+s,w=p.concat(E);S>-1&&S<E.children.length;){const k=E.children[S];if(v=c(k,S,w)(),v[0]===DS)return v;S=typeof v[1]=="number"?v[1]:S+s}}return y}}}function Cce(e){return Array.isArray(e)?e:typeof e=="number"?[Sce,e]:e==null?L4:[e]}function vC(e,t,n,r){let o,i,s;typeof t=="function"&&typeof n!="function"?(i=void 0,s=t,o=n):(i=t,s=n,o=r),F4(e,i,c,o);function c(d,u){const p=u[u.length-1],m=p?p.children.indexOf(d):void 0;return s(d,m,p)}}const PS={}.hasOwnProperty,kce={};function jce(e,t){const n=t||kce,r=new Map,o=new Map,i=new Map,s={...ace,...n.handlers},c={all:u,applyData:_ce,definitionById:r,footnoteById:o,footnoteCounts:i,footnoteOrder:[],handlers:s,one:d,options:n,patch:Rce,wrap:Tce};return vC(e,function(p){if(p.type==="definition"||p.type==="footnoteDefinition"){const m=p.type==="definition"?r:o,g=String(p.identifier).toUpperCase();m.has(g)||m.set(g,p)}}),c;function d(p,m){const g=p.type,y=c.handlers[g];if(PS.call(c.handlers,g)&&y)return y(c,p,m);if(c.options.passThrough&&c.options.passThrough.includes(g)){if("children"in p){const{children:S,...w}=p,E=uy(w);return E.children=c.all(p),E}return uy(p)}return(c.options.unknownHandler||Nce)(c,p,m)}function u(p){const m=[];if("children"in p){const g=p.children;let y=-1;for(;++y<g.length;){const v=c.one(g[y],p);if(v){if(y&&g[y-1].type==="break"&&(!Array.isArray(v)&&v.type==="text"&&(v.value=wA(v.value)),!Array.isArray(v)&&v.type==="element")){const S=v.children[0];S&&S.type==="text"&&(S.value=wA(S.value))}Array.isArray(v)?m.push(...v):m.push(v)}}}return m}}function Rce(e,t){e.position&&(t.position=hse(e))}function _ce(e,t){let n=t;if(e&&e.data){const r=e.data.hName,o=e.data.hChildren,i=e.data.hProperties;if(typeof r=="string")if(n.type==="element")n.tagName=r;else{const s="children"in n?n.children:[n];n={type:"element",tagName:r,properties:{},children:s}}n.type==="element"&&i&&Object.assign(n.properties,uy(i)),"children"in n&&n.children&&o!==null&&o!==void 0&&(n.children=o)}return n}function Nce(e,t){const n=t.data||{},r="value"in t&&!(PS.call(n,"hProperties")||PS.call(n,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function Tce(e,t){const n=[];let r=-1;for(t&&n.push({type:"text",value:`
125
+ `});++r<e.length;)r&&n.push({type:"text",value:`
126
+ `}),n.push(e[r]);return t&&e.length>0&&n.push({type:"text",value:`
127
+ `}),n}function wA(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function SA(e,t){const n=jce(e,t),r=n.one(e,void 0),o=gce(n),i=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return o&&i.children.push({type:"text",value:`
128
+ `},o),i}function Mce(e,t){return e&&"run"in e?async function(n,r){const o=SA(n,{file:r,...t});await e.run(o,r)}:function(n,r){return SA(n,{file:r,...e||t})}}function EA(e){if(e)throw e}var U0,CA;function Ace(){if(CA)return U0;CA=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,o=function(u){return typeof Array.isArray=="function"?Array.isArray(u):t.call(u)==="[object Array]"},i=function(u){if(!u||t.call(u)!=="[object Object]")return!1;var p=e.call(u,"constructor"),m=u.constructor&&u.constructor.prototype&&e.call(u.constructor.prototype,"isPrototypeOf");if(u.constructor&&!p&&!m)return!1;var g;for(g in u);return typeof g>"u"||e.call(u,g)},s=function(u,p){n&&p.name==="__proto__"?n(u,p.name,{enumerable:!0,configurable:!0,value:p.newValue,writable:!0}):u[p.name]=p.newValue},c=function(u,p){if(p==="__proto__")if(e.call(u,p)){if(r)return r(u,p).value}else return;return u[p]};return U0=function d(){var u,p,m,g,y,v,S=arguments[0],w=1,E=arguments.length,k=!1;for(typeof S=="boolean"&&(k=S,S=arguments[1]||{},w=2),(S==null||typeof S!="object"&&typeof S!="function")&&(S={});w<E;++w)if(u=arguments[w],u!=null)for(p in u)m=c(S,p),g=c(u,p),S!==g&&(k&&g&&(i(g)||(y=o(g)))?(y?(y=!1,v=m&&o(m)?m:[]):v=m&&i(m)?m:{},s(S,{name:p,newValue:d(k,v,g)})):typeof g<"u"&&s(S,{name:p,newValue:g}));return S},U0}var Oce=Ace();const q0=wh(Oce);function IS(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function Dce(){const e=[],t={run:n,use:r};return t;function n(...o){let i=-1;const s=o.pop();if(typeof s!="function")throw new TypeError("Expected function as last argument, not "+s);c(null,...o);function c(d,...u){const p=e[++i];let m=-1;if(d){s(d);return}for(;++m<o.length;)(u[m]===null||u[m]===void 0)&&(u[m]=o[m]);o=u,p?Pce(p,c)(...u):s(null,...u)}}function r(o){if(typeof o!="function")throw new TypeError("Expected `middelware` to be a function, not "+o);return e.push(o),t}}function Pce(e,t){let n;return r;function r(...s){const c=e.length>s.length;let d;c&&s.push(o);try{d=e.apply(this,s)}catch(u){const p=u;if(c&&n)throw p;return o(p)}c||(d&&d.then&&typeof d.then=="function"?d.then(i,o):d instanceof Error?o(d):i(d))}function o(s,...c){n||(n=!0,t(s,...c))}function i(s){o(null,s)}}const es={basename:Ice,dirname:zce,extname:Lce,join:Fce,sep:"/"};function Ice(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');np(e);let n=0,r=-1,o=e.length,i;if(t===void 0||t.length===0||t.length>e.length){for(;o--;)if(e.codePointAt(o)===47){if(i){n=o+1;break}}else r<0&&(i=!0,r=o+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let s=-1,c=t.length-1;for(;o--;)if(e.codePointAt(o)===47){if(i){n=o+1;break}}else s<0&&(i=!0,s=o+1),c>-1&&(e.codePointAt(o)===t.codePointAt(c--)?c<0&&(r=o):(c=-1,r=s));return n===r?r=s:r<0&&(r=e.length),e.slice(n,r)}function zce(e){if(np(e),e.length===0)return".";let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||(r=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function Lce(e){np(e);let t=e.length,n=-1,r=0,o=-1,i=0,s;for(;t--;){const c=e.codePointAt(t);if(c===47){if(s){r=t+1;break}continue}n<0&&(s=!0,n=t+1),c===46?o<0?o=t:i!==1&&(i=1):o>-1&&(i=-1)}return o<0||n<0||i===0||i===1&&o===n-1&&o===r+1?"":e.slice(o,n)}function Fce(...e){let t=-1,n;for(;++t<e.length;)np(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":$ce(n)}function $ce(e){np(e);const t=e.codePointAt(0)===47;let n=Vce(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function Vce(e,t){let n="",r=0,o=-1,i=0,s=-1,c,d;for(;++s<=e.length;){if(s<e.length)c=e.codePointAt(s);else{if(c===47)break;c=47}if(c===47){if(!(o===s-1||i===1))if(o!==s-1&&i===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(d=n.lastIndexOf("/"),d!==n.length-1){d<0?(n="",r=0):(n=n.slice(0,d),r=n.length-1-n.lastIndexOf("/")),o=s,i=0;continue}}else if(n.length>0){n="",r=0,o=s,i=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(o+1,s):n=e.slice(o+1,s),r=s-o-1;o=s,i=0}else c===46&&i>-1?i++:i=-1}return n}function np(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const Bce={cwd:Hce};function Hce(){return"/"}function zS(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function Uce(e){if(typeof e=="string")e=new URL(e);else if(!zS(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return qce(e)}function qce(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const r=t.codePointAt(n+2);if(r===70||r===102){const o=new TypeError("File URL path must not include encoded / characters");throw o.code="ERR_INVALID_FILE_URL_PATH",o}}return decodeURIComponent(t)}const Y0=["history","path","basename","stem","extname","dirname"];class $4{constructor(t){let n;t?zS(t)?n={path:t}:typeof t=="string"||Yce(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":Bce.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<Y0.length;){const i=Y0[r];i in n&&n[i]!==void 0&&n[i]!==null&&(this[i]=i==="history"?[...n[i]]:n[i])}let o;for(o in n)Y0.includes(o)||(this[o]=n[o])}get basename(){return typeof this.path=="string"?es.basename(this.path):void 0}set basename(t){G0(t,"basename"),Z0(t,"basename"),this.path=es.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?es.dirname(this.path):void 0}set dirname(t){kA(this.basename,"dirname"),this.path=es.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?es.extname(this.path):void 0}set extname(t){if(Z0(t,"extname"),kA(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=es.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){zS(t)&&(t=Uce(t)),G0(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?es.basename(this.path,this.extname):void 0}set stem(t){G0(t,"stem"),Z0(t,"stem"),this.path=es.join(this.dirname||"",t+(this.extname||""))}fail(t,n,r){const o=this.message(t,n,r);throw o.fatal=!0,o}info(t,n,r){const o=this.message(t,n,r);return o.fatal=void 0,o}message(t,n,r){const o=new oo(t,n,r);return this.path&&(o.name=this.path+":"+o.name,o.file=this.path),o.fatal=!1,this.messages.push(o),o}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function Z0(e,t){if(e&&e.includes(es.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+es.sep+"`")}function G0(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function kA(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function Yce(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const Zce=(function(e){const r=this.constructor.prototype,o=r[e],i=function(){return o.apply(i,arguments)};return Object.setPrototypeOf(i,r),i}),Gce={}.hasOwnProperty;class bC extends Zce{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=Dce()}copy(){const t=new bC;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(q0(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(Q0("data",this.frozen),this.namespace[t]=n,this):Gce.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Q0("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const o=n.call(t,...r);typeof o=="function"&&this.transformers.use(o)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=Jm(t),r=this.parser||this.Parser;return K0("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),K0("process",this.parser||this.Parser),X0("process",this.compiler||this.Compiler),n?o(void 0,n):new Promise(o);function o(i,s){const c=Jm(t),d=r.parse(c);r.run(d,c,function(p,m,g){if(p||!m||!g)return u(p);const y=m,v=r.stringify(y,g);Qce(v)?g.value=v:g.result=v,u(p,g)});function u(p,m){p||!m?s(p):i?i(m):n(void 0,m)}}}processSync(t){let n=!1,r;return this.freeze(),K0("processSync",this.parser||this.Parser),X0("processSync",this.compiler||this.Compiler),this.process(t,o),RA("processSync","process",n),r;function o(i,s){n=!0,EA(i),r=s}}run(t,n,r){jA(t),this.freeze();const o=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?i(void 0,r):new Promise(i);function i(s,c){const d=Jm(n);o.run(t,d,u);function u(p,m,g){const y=m||t;p?c(p):s?s(y):r(void 0,y,g)}}}runSync(t,n){let r=!1,o;return this.run(t,n,i),RA("runSync","run",r),o;function i(s,c){EA(s),o=c,r=!0}}stringify(t,n){this.freeze();const r=Jm(n),o=this.compiler||this.Compiler;return X0("stringify",o),jA(t),o(t,r)}use(t,...n){const r=this.attachers,o=this.namespace;if(Q0("use",this.frozen),t!=null)if(typeof t=="function")d(t,n);else if(typeof t=="object")Array.isArray(t)?c(t):s(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function i(u){if(typeof u=="function")d(u,[]);else if(typeof u=="object")if(Array.isArray(u)){const[p,...m]=u;d(p,m)}else s(u);else throw new TypeError("Expected usable value, not `"+u+"`")}function s(u){if(!("plugins"in u)&&!("settings"in u))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");c(u.plugins),u.settings&&(o.settings=q0(!0,o.settings,u.settings))}function c(u){let p=-1;if(u!=null)if(Array.isArray(u))for(;++p<u.length;){const m=u[p];i(m)}else throw new TypeError("Expected a list of plugins, not `"+u+"`")}function d(u,p){let m=-1,g=-1;for(;++m<r.length;)if(r[m][0]===u){g=m;break}if(g===-1)r.push([u,...p]);else if(p.length>0){let[y,...v]=p;const S=r[g][1];IS(S)&&IS(y)&&(y=q0(!0,S,y)),r[g]=[u,y,...v]}}}}const Kce=new bC().freeze();function K0(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function X0(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Q0(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function jA(e){if(!IS(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function RA(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Jm(e){return Xce(e)?e:new $4(e)}function Xce(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function Qce(e){return typeof e=="string"||Wce(e)}function Wce(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const Jce="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",_A=[],NA={allowDangerousHtml:!0},eue=/^(https?|ircs?|mailto|xmpp)$/i,tue=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function nue(e){const t=rue(e),n=oue(e);return iue(t.runSync(t.parse(n),n),e)}function rue(e){const t=e.rehypePlugins||_A,n=e.remarkPlugins||_A,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...NA}:NA;return Kce().use(Ple).use(n).use(Mce,r).use(t)}function oue(e){const t=e.children||"",n=new $4;return typeof t=="string"&&(n.value=t),n}function iue(e,t){const n=t.allowedElements,r=t.allowElement,o=t.components,i=t.disallowedElements,s=t.skipHtml,c=t.unwrapDisallowed,d=t.urlTransform||sue;for(const p of tue)Object.hasOwn(t,p.from)&&(""+p.from+(p.to?"use `"+p.to+"` instead":"remove it")+Jce+p.id,void 0);return vC(e,u),xse(e,{Fragment:f.Fragment,components:o,ignoreInvalidStyle:!0,jsx:f.jsx,jsxs:f.jsxs,passKeys:!0,passNode:!0});function u(p,m,g){if(p.type==="raw"&&g&&typeof m=="number")return s?g.children.splice(m,1):g.children[m]={type:"text",value:p.value},m;if(p.type==="element"){let y;for(y in V0)if(Object.hasOwn(V0,y)&&Object.hasOwn(p.properties,y)){const v=p.properties[y],S=V0[y];(S===null||S.includes(p.tagName))&&(p.properties[y]=d(String(v||""),y,p))}}if(p.type==="element"){let y=n?!n.includes(p.tagName):i?i.includes(p.tagName):!1;if(!y&&r&&typeof m=="number"&&(y=!r(p,m,g)),y&&g&&typeof m=="number")return c&&p.children?g.children.splice(m,1,...p.children):g.children.splice(m,1),m}}}function sue(e){const t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),o=e.indexOf("/");return t===-1||o!==-1&&t>o||n!==-1&&t>n||r!==-1&&t>r||eue.test(e.slice(0,t))?e:""}function TA(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let r=0,o=n.indexOf(t);for(;o!==-1;)r++,o=n.indexOf(t,o+t.length);return r}function aue(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function V4(e,t,n){const o=Ax((n||{}).ignore||[]),i=lue(t);let s=-1;for(;++s<i.length;)F4(e,"text",c);function c(u,p){let m=-1,g;for(;++m<p.length;){const y=p[m],v=g?g.children:void 0;if(o(y,v?v.indexOf(y):void 0,g))return;g=y}if(g)return d(u,p)}function d(u,p){const m=p[p.length-1],g=i[s][0],y=i[s][1];let v=0;const w=m.children.indexOf(u);let E=!1,k=[];g.lastIndex=0;let j=g.exec(u.value);for(;j;){const N=j.index,A={index:j.index,input:j.input,stack:[...p,u]};let R=y(...j,A);if(typeof R=="string"&&(R=R.length>0?{type:"text",value:R}:void 0),R===!1?g.lastIndex=N+1:(v!==N&&k.push({type:"text",value:u.value.slice(v,N)}),Array.isArray(R)?k.push(...R):R&&k.push(R),v=N+j[0].length,E=!0),!g.global)break;j=g.exec(u.value)}return E?(v<u.value.length&&k.push({type:"text",value:u.value.slice(v)}),m.children.splice(w,1,...k)):k=[u],w+k.length}}function lue(e){const t=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const n=!e[0]||Array.isArray(e[0])?e:[e];let r=-1;for(;++r<n.length;){const o=n[r];t.push([cue(o[0]),uue(o[1])])}return t}function cue(e){return typeof e=="string"?new RegExp(aue(e),"g"):e}function uue(e){return typeof e=="function"?e:function(){return e}}const W0="phrasing",J0=["autolink","link","image","label"];function due(){return{transforms:[xue],enter:{literalAutolink:hue,literalAutolinkEmail:ew,literalAutolinkHttp:ew,literalAutolinkWww:ew},exit:{literalAutolink:yue,literalAutolinkEmail:gue,literalAutolinkHttp:pue,literalAutolinkWww:mue}}}function fue(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:W0,notInConstruct:J0},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:W0,notInConstruct:J0},{character:":",before:"[ps]",after:"\\/",inConstruct:W0,notInConstruct:J0}]}}function hue(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function ew(e){this.config.enter.autolinkProtocol.call(this,e)}function pue(e){this.config.exit.autolinkProtocol.call(this,e)}function mue(e){this.config.exit.data.call(this,e);const t=this.stack[this.stack.length-1];t.type,t.url="http://"+this.sliceSerialize(e)}function gue(e){this.config.exit.autolinkEmail.call(this,e)}function yue(e){this.exit(e)}function xue(e){V4(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,vue],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),bue]],{ignore:["link","linkReference"]})}function vue(e,t,n,r,o){let i="";if(!B4(o)||(/^w/i.test(t)&&(n=t+n,t="",i="http://"),!wue(n)))return!1;const s=Sue(n+r);if(!s[0])return!1;const c={type:"link",title:null,url:i+t+s[0],children:[{type:"text",value:t+s[0]}]};return s[1]?[c,{type:"text",value:s[1]}]:c}function bue(e,t,n,r){return!B4(r,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function wue(e){const t=e.split(".");return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function Sue(e){const t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(")");const o=TA(e,"(");let i=TA(e,")");for(;r!==-1&&o>i;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),i++;return[e,n]}function B4(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||ic(n)||Nx(n))&&(!t||n!==47)}H4.peek=Mue;function Eue(){this.buffer()}function Cue(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function kue(){this.buffer()}function jue(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function Rue(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Ii(this.sliceSerialize(e)).toLowerCase(),n.label=t}function _ue(e){this.exit(e)}function Nue(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Ii(this.sliceSerialize(e)).toLowerCase(),n.label=t}function Tue(e){this.exit(e)}function Mue(){return"["}function H4(e,t,n,r){const o=n.createTracker(r);let i=o.move("[^");const s=n.enter("footnoteReference"),c=n.enter("reference");return i+=o.move(n.safe(n.associationId(e),{after:"]",before:i})),c(),s(),i+=o.move("]"),i}function Aue(){return{enter:{gfmFootnoteCallString:Eue,gfmFootnoteCall:Cue,gfmFootnoteDefinitionLabelString:kue,gfmFootnoteDefinition:jue},exit:{gfmFootnoteCallString:Rue,gfmFootnoteCall:_ue,gfmFootnoteDefinitionLabelString:Nue,gfmFootnoteDefinition:Tue}}}function Oue(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:H4},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,o,i,s){const c=i.createTracker(s);let d=c.move("[^");const u=i.enter("footnoteDefinition"),p=i.enter("label");return d+=c.move(i.safe(i.associationId(r),{before:d,after:"]"})),p(),d+=c.move("]:"),r.children&&r.children.length>0&&(c.shift(4),d+=c.move((t?`
129
+ `:" ")+i.indentLines(i.containerFlow(r,c.current()),t?U4:Due))),u(),d}}function Due(e,t,n){return t===0?e:U4(e,t,n)}function U4(e,t,n){return(n?"":" ")+e}const Pue=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];q4.peek=$ue;function Iue(){return{canContainEols:["delete"],enter:{strikethrough:Lue},exit:{strikethrough:Fue}}}function zue(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:Pue}],handlers:{delete:q4}}}function Lue(e){this.enter({type:"delete",children:[]},e)}function Fue(e){this.exit(e)}function q4(e,t,n,r){const o=n.createTracker(r),i=n.enter("strikethrough");let s=o.move("~~");return s+=n.containerPhrasing(e,{...o.current(),before:s,after:"~"}),s+=o.move("~~"),i(),s}function $ue(){return"~"}function Vue(e){return e.length}function Bue(e,t){const n=t||{},r=(n.align||[]).concat(),o=n.stringLength||Vue,i=[],s=[],c=[],d=[];let u=0,p=-1;for(;++p<e.length;){const S=[],w=[];let E=-1;for(e[p].length>u&&(u=e[p].length);++E<e[p].length;){const k=Hue(e[p][E]);if(n.alignDelimiters!==!1){const j=o(k);w[E]=j,(d[E]===void 0||j>d[E])&&(d[E]=j)}S.push(k)}s[p]=S,c[p]=w}let m=-1;if(typeof r=="object"&&"length"in r)for(;++m<u;)i[m]=MA(r[m]);else{const S=MA(r);for(;++m<u;)i[m]=S}m=-1;const g=[],y=[];for(;++m<u;){const S=i[m];let w="",E="";S===99?(w=":",E=":"):S===108?w=":":S===114&&(E=":");let k=n.alignDelimiters===!1?1:Math.max(1,d[m]-w.length-E.length);const j=w+"-".repeat(k)+E;n.alignDelimiters!==!1&&(k=w.length+k+E.length,k>d[m]&&(d[m]=k),y[m]=k),g[m]=j}s.splice(1,0,g),c.splice(1,0,y),p=-1;const v=[];for(;++p<s.length;){const S=s[p],w=c[p];m=-1;const E=[];for(;++m<u;){const k=S[m]||"";let j="",N="";if(n.alignDelimiters!==!1){const A=d[m]-(w[m]||0),R=i[m];R===114?j=" ".repeat(A):R===99?A%2?(j=" ".repeat(A/2+.5),N=" ".repeat(A/2-.5)):(j=" ".repeat(A/2),N=j):N=" ".repeat(A)}n.delimiterStart!==!1&&!m&&E.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&k==="")&&(n.delimiterStart!==!1||m)&&E.push(" "),n.alignDelimiters!==!1&&E.push(j),E.push(k),n.alignDelimiters!==!1&&E.push(N),n.padding!==!1&&E.push(" "),(n.delimiterEnd!==!1||m!==u-1)&&E.push("|")}v.push(n.delimiterEnd===!1?E.join("").replace(/ +$/,""):E.join(""))}return v.join(`
130
+ `)}function Hue(e){return e==null?"":String(e)}function MA(e){const t=typeof e=="string"?e.codePointAt(0):0;return t===67||t===99?99:t===76||t===108?108:t===82||t===114?114:0}function Uue(e,t,n,r){const o=n.enter("blockquote"),i=n.createTracker(r);i.move("> "),i.shift(2);const s=n.indentLines(n.containerFlow(e,i.current()),que);return o(),s}function que(e,t,n){return">"+(n?"":" ")+e}function Yue(e,t){return AA(e,t.inConstruct,!0)&&!AA(e,t.notInConstruct,!1)}function AA(e,t,n){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return n;let r=-1;for(;++r<t.length;)if(e.includes(t[r]))return!0;return!1}function OA(e,t,n,r){let o=-1;for(;++o<n.unsafe.length;)if(n.unsafe[o].character===`
131
+ `&&Yue(n.stack,n.unsafe[o]))return/[ \t]/.test(r.before)?"":" ";return`\\
132
+ `}function Zue(e,t){const n=String(e);let r=n.indexOf(t),o=r,i=0,s=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;r!==-1;)r===o?++i>s&&(s=i):i=1,o=r+t.length,r=n.indexOf(t,o);return s}function Gue(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function Kue(e){const t=e.options.fence||"`";if(t!=="`"&&t!=="~")throw new Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function Xue(e,t,n,r){const o=Kue(n),i=e.value||"",s=o==="`"?"GraveAccent":"Tilde";if(Gue(e,n)){const m=n.enter("codeIndented"),g=n.indentLines(i,Que);return m(),g}const c=n.createTracker(r),d=o.repeat(Math.max(Zue(i,o)+1,3)),u=n.enter("codeFenced");let p=c.move(d);if(e.lang){const m=n.enter(`codeFencedLang${s}`);p+=c.move(n.safe(e.lang,{before:p,after:" ",encode:["`"],...c.current()})),m()}if(e.lang&&e.meta){const m=n.enter(`codeFencedMeta${s}`);p+=c.move(" "),p+=c.move(n.safe(e.meta,{before:p,after:`
133
+ `,encode:["`"],...c.current()})),m()}return p+=c.move(`
134
+ `),i&&(p+=c.move(i+`
135
+ `)),p+=c.move(d),u(),p}function Que(e,t,n){return(n?"":" ")+e}function wC(e){const t=e.options.quote||'"';if(t!=='"'&&t!=="'")throw new Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function Wue(e,t,n,r){const o=wC(n),i=o==='"'?"Quote":"Apostrophe",s=n.enter("definition");let c=n.enter("label");const d=n.createTracker(r);let u=d.move("[");return u+=d.move(n.safe(n.associationId(e),{before:u,after:"]",...d.current()})),u+=d.move("]: "),c(),!e.url||/[\0- \u007F]/.test(e.url)?(c=n.enter("destinationLiteral"),u+=d.move("<"),u+=d.move(n.safe(e.url,{before:u,after:">",...d.current()})),u+=d.move(">")):(c=n.enter("destinationRaw"),u+=d.move(n.safe(e.url,{before:u,after:e.title?" ":`
136
+ `,...d.current()}))),c(),e.title&&(c=n.enter(`title${i}`),u+=d.move(" "+o),u+=d.move(n.safe(e.title,{before:u,after:o,...d.current()})),u+=d.move(o),c()),s(),u}function Jue(e){const t=e.options.emphasis||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function lh(e){return"&#x"+e.toString(16).toUpperCase()+";"}function dy(e,t,n){const r=$u(e),o=$u(t);return r===void 0?o===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:o===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?o===void 0?{inside:!1,outside:!1}:o===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:o===void 0?{inside:!1,outside:!1}:o===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}Y4.peek=ede;function Y4(e,t,n,r){const o=Jue(n),i=n.enter("emphasis"),s=n.createTracker(r),c=s.move(o);let d=s.move(n.containerPhrasing(e,{after:o,before:c,...s.current()}));const u=d.charCodeAt(0),p=dy(r.before.charCodeAt(r.before.length-1),u,o);p.inside&&(d=lh(u)+d.slice(1));const m=d.charCodeAt(d.length-1),g=dy(r.after.charCodeAt(0),m,o);g.inside&&(d=d.slice(0,-1)+lh(m));const y=s.move(o);return i(),n.attentionEncodeSurroundingInfo={after:g.outside,before:p.outside},c+d+y}function ede(e,t,n){return n.options.emphasis||"*"}function tde(e,t){let n=!1;return vC(e,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,DS}),!!((!e.depth||e.depth<3)&&fC(e)&&(t.options.setext||n))}function nde(e,t,n,r){const o=Math.max(Math.min(6,e.depth||1),1),i=n.createTracker(r);if(tde(e,n)){const p=n.enter("headingSetext"),m=n.enter("phrasing"),g=n.containerPhrasing(e,{...i.current(),before:`
137
+ `,after:`
138
+ `});return m(),p(),g+`
139
+ `+(o===1?"=":"-").repeat(g.length-(Math.max(g.lastIndexOf("\r"),g.lastIndexOf(`
140
+ `))+1))}const s="#".repeat(o),c=n.enter("headingAtx"),d=n.enter("phrasing");i.move(s+" ");let u=n.containerPhrasing(e,{before:"# ",after:`
141
+ `,...i.current()});return/^[\t ]/.test(u)&&(u=lh(u.charCodeAt(0))+u.slice(1)),u=u?s+" "+u:s,n.options.closeAtx&&(u+=" "+s),d(),c(),u}Z4.peek=rde;function Z4(e){return e.value||""}function rde(){return"<"}G4.peek=ode;function G4(e,t,n,r){const o=wC(n),i=o==='"'?"Quote":"Apostrophe",s=n.enter("image");let c=n.enter("label");const d=n.createTracker(r);let u=d.move("![");return u+=d.move(n.safe(e.alt,{before:u,after:"]",...d.current()})),u+=d.move("]("),c(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(c=n.enter("destinationLiteral"),u+=d.move("<"),u+=d.move(n.safe(e.url,{before:u,after:">",...d.current()})),u+=d.move(">")):(c=n.enter("destinationRaw"),u+=d.move(n.safe(e.url,{before:u,after:e.title?" ":")",...d.current()}))),c(),e.title&&(c=n.enter(`title${i}`),u+=d.move(" "+o),u+=d.move(n.safe(e.title,{before:u,after:o,...d.current()})),u+=d.move(o),c()),u+=d.move(")"),s(),u}function ode(){return"!"}K4.peek=ide;function K4(e,t,n,r){const o=e.referenceType,i=n.enter("imageReference");let s=n.enter("label");const c=n.createTracker(r);let d=c.move("![");const u=n.safe(e.alt,{before:d,after:"]",...c.current()});d+=c.move(u+"]["),s();const p=n.stack;n.stack=[],s=n.enter("reference");const m=n.safe(n.associationId(e),{before:d,after:"]",...c.current()});return s(),n.stack=p,i(),o==="full"||!u||u!==m?d+=c.move(m+"]"):o==="shortcut"?d=d.slice(0,-1):d+=c.move("]"),d}function ide(){return"!"}X4.peek=sde;function X4(e,t,n){let r=e.value||"",o="`",i=-1;for(;new RegExp("(^|[^`])"+o+"([^`]|$)").test(r);)o+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++i<n.unsafe.length;){const s=n.unsafe[i],c=n.compilePattern(s);let d;if(s.atBreak)for(;d=c.exec(r);){let u=d.index;r.charCodeAt(u)===10&&r.charCodeAt(u-1)===13&&u--,r=r.slice(0,u)+" "+r.slice(d.index+1)}}return o+r+o}function sde(){return"`"}function Q4(e,t){const n=fC(e);return!!(!t.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(n===e.url||"mailto:"+n===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}W4.peek=ade;function W4(e,t,n,r){const o=wC(n),i=o==='"'?"Quote":"Apostrophe",s=n.createTracker(r);let c,d;if(Q4(e,n)){const p=n.stack;n.stack=[],c=n.enter("autolink");let m=s.move("<");return m+=s.move(n.containerPhrasing(e,{before:m,after:">",...s.current()})),m+=s.move(">"),c(),n.stack=p,m}c=n.enter("link"),d=n.enter("label");let u=s.move("[");return u+=s.move(n.containerPhrasing(e,{before:u,after:"](",...s.current()})),u+=s.move("]("),d(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(d=n.enter("destinationLiteral"),u+=s.move("<"),u+=s.move(n.safe(e.url,{before:u,after:">",...s.current()})),u+=s.move(">")):(d=n.enter("destinationRaw"),u+=s.move(n.safe(e.url,{before:u,after:e.title?" ":")",...s.current()}))),d(),e.title&&(d=n.enter(`title${i}`),u+=s.move(" "+o),u+=s.move(n.safe(e.title,{before:u,after:o,...s.current()})),u+=s.move(o),d()),u+=s.move(")"),c(),u}function ade(e,t,n){return Q4(e,n)?"<":"["}J4.peek=lde;function J4(e,t,n,r){const o=e.referenceType,i=n.enter("linkReference");let s=n.enter("label");const c=n.createTracker(r);let d=c.move("[");const u=n.containerPhrasing(e,{before:d,after:"]",...c.current()});d+=c.move(u+"]["),s();const p=n.stack;n.stack=[],s=n.enter("reference");const m=n.safe(n.associationId(e),{before:d,after:"]",...c.current()});return s(),n.stack=p,i(),o==="full"||!u||u!==m?d+=c.move(m+"]"):o==="shortcut"?d=d.slice(0,-1):d+=c.move("]"),d}function lde(){return"["}function SC(e){const t=e.options.bullet||"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function cde(e){const t=SC(e),n=e.options.bulletOther;if(!n)return t==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function ude(e){const t=e.options.bulletOrdered||".";if(t!=="."&&t!==")")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function eF(e){const t=e.options.rule||"*";if(t!=="*"&&t!=="-"&&t!=="_")throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function dde(e,t,n,r){const o=n.enter("list"),i=n.bulletCurrent;let s=e.ordered?ude(n):SC(n);const c=e.ordered?s==="."?")":".":cde(n);let d=t&&n.bulletLastUsed?s===n.bulletLastUsed:!1;if(!e.ordered){const p=e.children?e.children[0]:void 0;if((s==="*"||s==="-")&&p&&(!p.children||!p.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(d=!0),eF(n)===s&&p){let m=-1;for(;++m<e.children.length;){const g=e.children[m];if(g&&g.type==="listItem"&&g.children&&g.children[0]&&g.children[0].type==="thematicBreak"){d=!0;break}}}}d&&(s=c),n.bulletCurrent=s;const u=n.containerFlow(e,r);return n.bulletLastUsed=s,n.bulletCurrent=i,o(),u}function fde(e){const t=e.options.listItemIndent||"one";if(t!=="tab"&&t!=="one"&&t!=="mixed")throw new Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}function hde(e,t,n,r){const o=fde(n);let i=n.bulletCurrent||SC(n);t&&t.type==="list"&&t.ordered&&(i=(typeof t.start=="number"&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+i);let s=i.length+1;(o==="tab"||o==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(s=Math.ceil(s/4)*4);const c=n.createTracker(r);c.move(i+" ".repeat(s-i.length)),c.shift(s);const d=n.enter("listItem"),u=n.indentLines(n.containerFlow(e,c.current()),p);return d(),u;function p(m,g,y){return g?(y?"":" ".repeat(s))+m:(y?i:i+" ".repeat(s-i.length))+m}}function pde(e,t,n,r){const o=n.enter("paragraph"),i=n.enter("phrasing"),s=n.containerPhrasing(e,r);return i(),o(),s}const mde=Ax(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function gde(e,t,n,r){return(e.children.some(function(s){return mde(s)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function yde(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}tF.peek=xde;function tF(e,t,n,r){const o=yde(n),i=n.enter("strong"),s=n.createTracker(r),c=s.move(o+o);let d=s.move(n.containerPhrasing(e,{after:o,before:c,...s.current()}));const u=d.charCodeAt(0),p=dy(r.before.charCodeAt(r.before.length-1),u,o);p.inside&&(d=lh(u)+d.slice(1));const m=d.charCodeAt(d.length-1),g=dy(r.after.charCodeAt(0),m,o);g.inside&&(d=d.slice(0,-1)+lh(m));const y=s.move(o+o);return i(),n.attentionEncodeSurroundingInfo={after:g.outside,before:p.outside},c+d+y}function xde(e,t,n){return n.options.strong||"*"}function vde(e,t,n,r){return n.safe(e.value,r)}function bde(e){const t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function wde(e,t,n){const r=(eF(n)+(n.options.ruleSpaces?" ":"")).repeat(bde(n));return n.options.ruleSpaces?r.slice(0,-1):r}const nF={blockquote:Uue,break:OA,code:Xue,definition:Wue,emphasis:Y4,hardBreak:OA,heading:nde,html:Z4,image:G4,imageReference:K4,inlineCode:X4,link:W4,linkReference:J4,list:dde,listItem:hde,paragraph:pde,root:gde,strong:tF,text:vde,thematicBreak:wde};function Sde(){return{enter:{table:Ede,tableData:DA,tableHeader:DA,tableRow:kde},exit:{codeText:jde,table:Cde,tableData:tw,tableHeader:tw,tableRow:tw}}}function Ede(e){const t=e._align;this.enter({type:"table",align:t.map(function(n){return n==="none"?null:n}),children:[]},e),this.data.inTable=!0}function Cde(e){this.exit(e),this.data.inTable=void 0}function kde(e){this.enter({type:"tableRow",children:[]},e)}function tw(e){this.exit(e)}function DA(e){this.enter({type:"tableCell",children:[]},e)}function jde(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,Rde));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function Rde(e,t){return t==="|"?t:e}function _de(e){const t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,o=t.stringLength,i=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
142
+ `,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:g,table:s,tableCell:d,tableRow:c}};function s(y,v,S,w){return u(p(y,S,w),y.align)}function c(y,v,S,w){const E=m(y,S,w),k=u([E]);return k.slice(0,k.indexOf(`
143
+ `))}function d(y,v,S,w){const E=S.enter("tableCell"),k=S.enter("phrasing"),j=S.containerPhrasing(y,{...w,before:i,after:i});return k(),E(),j}function u(y,v){return Bue(y,{align:v,alignDelimiters:r,padding:n,stringLength:o})}function p(y,v,S){const w=y.children;let E=-1;const k=[],j=v.enter("table");for(;++E<w.length;)k[E]=m(w[E],v,S);return j(),k}function m(y,v,S){const w=y.children;let E=-1;const k=[],j=v.enter("tableRow");for(;++E<w.length;)k[E]=d(w[E],y,v,S);return j(),k}function g(y,v,S){let w=nF.inlineCode(y,v,S);return S.stack.includes("tableCell")&&(w=w.replace(/\|/g,"\\$&")),w}}function Nde(){return{exit:{taskListCheckValueChecked:PA,taskListCheckValueUnchecked:PA,paragraph:Mde}}}function Tde(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:Ade}}}function PA(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function Mde(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const r=n.children[0];if(r&&r.type==="text"){const o=t.children;let i=-1,s;for(;++i<o.length;){const c=o[i];if(c.type==="paragraph"){s=c;break}}s===n&&(r.value=r.value.slice(1),r.value.length===0?n.children.shift():n.position&&r.position&&typeof r.position.start.offset=="number"&&(r.position.start.column++,r.position.start.offset++,n.position.start=Object.assign({},r.position.start)))}}this.exit(e)}function Ade(e,t,n,r){const o=e.children[0],i=typeof e.checked=="boolean"&&o&&o.type==="paragraph",s="["+(e.checked?"x":" ")+"] ",c=n.createTracker(r);i&&c.move(s);let d=nF.listItem(e,t,n,{...r,...c.current()});return i&&(d=d.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,u)),d;function u(p){return p+s}}function Ode(){return[due(),Aue(),Iue(),Sde(),Nde()]}function Dde(e){return{extensions:[fue(),Oue(e),zue(),_de(e),Tde()]}}const Pde={tokenize:Vde,partial:!0},rF={tokenize:Bde,partial:!0},oF={tokenize:Hde,partial:!0},iF={tokenize:Ude,partial:!0},Ide={tokenize:qde,partial:!0},sF={name:"wwwAutolink",tokenize:Fde,previous:lF},aF={name:"protocolAutolink",tokenize:$de,previous:cF},aa={name:"emailAutolink",tokenize:Lde,previous:uF},ys={};function zde(){return{text:ys}}let Ol=48;for(;Ol<123;)ys[Ol]=aa,Ol++,Ol===58?Ol=65:Ol===91&&(Ol=97);ys[43]=aa;ys[45]=aa;ys[46]=aa;ys[95]=aa;ys[72]=[aa,aF];ys[104]=[aa,aF];ys[87]=[aa,sF];ys[119]=[aa,sF];function Lde(e,t,n){const r=this;let o,i;return s;function s(m){return!LS(m)||!uF.call(r,r.previous)||EC(r.events)?n(m):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),c(m))}function c(m){return LS(m)?(e.consume(m),c):m===64?(e.consume(m),d):n(m)}function d(m){return m===46?e.check(Ide,p,u)(m):m===45||m===95||no(m)?(i=!0,e.consume(m),d):p(m)}function u(m){return e.consume(m),o=!0,d}function p(m){return i&&o&&co(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(m)):n(m)}}function Fde(e,t,n){const r=this;return o;function o(s){return s!==87&&s!==119||!lF.call(r,r.previous)||EC(r.events)?n(s):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(Pde,e.attempt(rF,e.attempt(oF,i),n),n)(s))}function i(s){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(s)}}function $de(e,t,n){const r=this;let o="",i=!1;return s;function s(m){return(m===72||m===104)&&cF.call(r,r.previous)&&!EC(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),o+=String.fromCodePoint(m),e.consume(m),c):n(m)}function c(m){if(co(m)&&o.length<5)return o+=String.fromCodePoint(m),e.consume(m),c;if(m===58){const g=o.toLowerCase();if(g==="http"||g==="https")return e.consume(m),d}return n(m)}function d(m){return m===47?(e.consume(m),i?u:(i=!0,d)):n(m)}function u(m){return m===null||ly(m)||Bn(m)||ic(m)||Nx(m)?n(m):e.attempt(rF,e.attempt(oF,p),n)(m)}function p(m){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(m)}}function Vde(e,t,n){let r=0;return o;function o(s){return(s===87||s===119)&&r<3?(r++,e.consume(s),o):s===46&&r===3?(e.consume(s),i):n(s)}function i(s){return s===null?n(s):t(s)}}function Bde(e,t,n){let r,o,i;return s;function s(u){return u===46||u===95?e.check(iF,d,c)(u):u===null||Bn(u)||ic(u)||u!==45&&Nx(u)?d(u):(i=!0,e.consume(u),s)}function c(u){return u===95?r=!0:(o=r,r=void 0),e.consume(u),s}function d(u){return o||r||!i?n(u):t(u)}}function Hde(e,t){let n=0,r=0;return o;function o(s){return s===40?(n++,e.consume(s),o):s===41&&r<n?i(s):s===33||s===34||s===38||s===39||s===41||s===42||s===44||s===46||s===58||s===59||s===60||s===63||s===93||s===95||s===126?e.check(iF,t,i)(s):s===null||Bn(s)||ic(s)?t(s):(e.consume(s),o)}function i(s){return s===41&&r++,e.consume(s),o}}function Ude(e,t,n){return r;function r(c){return c===33||c===34||c===39||c===41||c===42||c===44||c===46||c===58||c===59||c===63||c===95||c===126?(e.consume(c),r):c===38?(e.consume(c),i):c===93?(e.consume(c),o):c===60||c===null||Bn(c)||ic(c)?t(c):n(c)}function o(c){return c===null||c===40||c===91||Bn(c)||ic(c)?t(c):r(c)}function i(c){return co(c)?s(c):n(c)}function s(c){return c===59?(e.consume(c),r):co(c)?(e.consume(c),s):n(c)}}function qde(e,t,n){return r;function r(i){return e.consume(i),o}function o(i){return no(i)?n(i):t(i)}}function lF(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Bn(e)}function cF(e){return!co(e)}function uF(e){return!(e===47||LS(e))}function LS(e){return e===43||e===45||e===46||e===95||no(e)}function EC(e){let t=e.length,n=!1;for(;t--;){const r=e[t][1];if((r.type==="labelLink"||r.type==="labelImage")&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const Yde={tokenize:efe,partial:!0};function Zde(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:Qde,continuation:{tokenize:Wde},exit:Jde}},text:{91:{name:"gfmFootnoteCall",tokenize:Xde},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:Gde,resolveTo:Kde}}}}function Gde(e,t,n){const r=this;let o=r.events.length;const i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let s;for(;o--;){const d=r.events[o][1];if(d.type==="labelImage"){s=d;break}if(d.type==="gfmFootnoteCall"||d.type==="labelLink"||d.type==="label"||d.type==="image"||d.type==="link")break}return c;function c(d){if(!s||!s._balanced)return n(d);const u=Ii(r.sliceSerialize({start:s.end,end:r.now()}));return u.codePointAt(0)!==94||!i.includes(u.slice(1))?n(d):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(d),e.exit("gfmFootnoteCallLabelMarker"),t(d))}}function Kde(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},o={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};o.end.column++,o.end.offset++,o.end._bufferIndex++;const i={type:"gfmFootnoteCallString",start:Object.assign({},o.end),end:Object.assign({},e[e.length-1][1].start)},s={type:"chunkString",contentType:"string",start:Object.assign({},i.start),end:Object.assign({},i.end)},c=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",o,t],["exit",o,t],["enter",i,t],["enter",s,t],["exit",s,t],["exit",i,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...c),e}function Xde(e,t,n){const r=this,o=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i=0,s;return c;function c(m){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(m),e.exit("gfmFootnoteCallLabelMarker"),d}function d(m){return m!==94?n(m):(e.enter("gfmFootnoteCallMarker"),e.consume(m),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",u)}function u(m){if(i>999||m===93&&!s||m===null||m===91||Bn(m))return n(m);if(m===93){e.exit("chunkString");const g=e.exit("gfmFootnoteCallString");return o.includes(Ii(r.sliceSerialize(g)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(m),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(m)}return Bn(m)||(s=!0),i++,e.consume(m),m===92?p:u}function p(m){return m===91||m===92||m===93?(e.consume(m),i++,u):u(m)}}function Qde(e,t,n){const r=this,o=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i,s=0,c;return d;function d(v){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(v),e.exit("gfmFootnoteDefinitionLabelMarker"),u}function u(v){return v===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(v),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",p):n(v)}function p(v){if(s>999||v===93&&!c||v===null||v===91||Bn(v))return n(v);if(v===93){e.exit("chunkString");const S=e.exit("gfmFootnoteDefinitionLabelString");return i=Ii(r.sliceSerialize(S)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(v),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),g}return Bn(v)||(c=!0),s++,e.consume(v),v===92?m:p}function m(v){return v===91||v===92||v===93?(e.consume(v),s++,p):p(v)}function g(v){return v===58?(e.enter("definitionMarker"),e.consume(v),e.exit("definitionMarker"),o.includes(i)||o.push(i),mn(e,y,"gfmFootnoteDefinitionWhitespace")):n(v)}function y(v){return t(v)}}function Wde(e,t,n){return e.check(tp,t,e.attempt(Yde,t,n))}function Jde(e){e.exit("gfmFootnoteDefinition")}function efe(e,t,n){const r=this;return mn(e,o,"gfmFootnoteDefinitionIndent",5);function o(i){const s=r.events[r.events.length-1];return s&&s[1].type==="gfmFootnoteDefinitionIndent"&&s[2].sliceSerialize(s[1],!0).length===4?t(i):n(i)}}function tfe(e){let n=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:i,resolveAll:o};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function o(s,c){let d=-1;for(;++d<s.length;)if(s[d][0]==="enter"&&s[d][1].type==="strikethroughSequenceTemporary"&&s[d][1]._close){let u=d;for(;u--;)if(s[u][0]==="exit"&&s[u][1].type==="strikethroughSequenceTemporary"&&s[u][1]._open&&s[d][1].end.offset-s[d][1].start.offset===s[u][1].end.offset-s[u][1].start.offset){s[d][1].type="strikethroughSequence",s[u][1].type="strikethroughSequence";const p={type:"strikethrough",start:Object.assign({},s[u][1].start),end:Object.assign({},s[d][1].end)},m={type:"strikethroughText",start:Object.assign({},s[u][1].end),end:Object.assign({},s[d][1].start)},g=[["enter",p,c],["enter",s[u][1],c],["exit",s[u][1],c],["enter",m,c]],y=c.parser.constructs.insideSpan.null;y&&Zo(g,g.length,0,Tx(y,s.slice(u+1,d),c)),Zo(g,g.length,0,[["exit",m,c],["enter",s[d][1],c],["exit",s[d][1],c],["exit",p,c]]),Zo(s,u-1,d-u+3,g),d=u+g.length-2;break}}for(d=-1;++d<s.length;)s[d][1].type==="strikethroughSequenceTemporary"&&(s[d][1].type="data");return s}function i(s,c,d){const u=this.previous,p=this.events;let m=0;return g;function g(v){return u===126&&p[p.length-1][1].type!=="characterEscape"?d(v):(s.enter("strikethroughSequenceTemporary"),y(v))}function y(v){const S=$u(u);if(v===126)return m>1?d(v):(s.consume(v),m++,y);if(m<2&&!n)return d(v);const w=s.exit("strikethroughSequenceTemporary"),E=$u(v);return w._open=!E||E===2&&!!S,w._close=!S||S===2&&!!E,c(v)}}}class nfe{constructor(){this.map=[]}add(t,n,r){rfe(this,t,n,r)}consume(t){if(this.map.sort(function(i,s){return i[0]-s[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];r.push(t.slice()),t.length=0;let o=r.pop();for(;o;){for(const i of o)t.push(i);o=r.pop()}this.map.length=0}}function rfe(e,t,n,r){let o=0;if(!(n===0&&r.length===0)){for(;o<e.map.length;){if(e.map[o][0]===t){e.map[o][1]+=n,e.map[o][2].push(...r);return}o+=1}e.map.push([t,n,r])}}function ofe(e,t){let n=!1;const r=[];for(;t<e.length;){const o=e[t];if(n){if(o[0]==="enter")o[1].type==="tableContent"&&r.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(o[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const i=r.length-1;r[i]=r[i]==="left"?"center":"right"}}else if(o[1].type==="tableDelimiterRow")break}else o[0]==="enter"&&o[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return r}function ife(){return{flow:{null:{name:"table",tokenize:sfe,resolveAll:afe}}}}function sfe(e,t,n){const r=this;let o=0,i=0,s;return c;function c(z){let q=r.events.length-1;for(;q>-1;){const L=r.events[q][1].type;if(L==="lineEnding"||L==="linePrefix")q--;else break}const $=q>-1?r.events[q][1].type:null,G=$==="tableHead"||$==="tableRow"?R:d;return G===R&&r.parser.lazy[r.now().line]?n(z):G(z)}function d(z){return e.enter("tableHead"),e.enter("tableRow"),u(z)}function u(z){return z===124||(s=!0,i+=1),p(z)}function p(z){return z===null?n(z):wt(z)?i>1?(i=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(z),e.exit("lineEnding"),y):n(z):rn(z)?mn(e,p,"whitespace")(z):(i+=1,s&&(s=!1,o+=1),z===124?(e.enter("tableCellDivider"),e.consume(z),e.exit("tableCellDivider"),s=!0,p):(e.enter("data"),m(z)))}function m(z){return z===null||z===124||Bn(z)?(e.exit("data"),p(z)):(e.consume(z),z===92?g:m)}function g(z){return z===92||z===124?(e.consume(z),m):m(z)}function y(z){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(z):(e.enter("tableDelimiterRow"),s=!1,rn(z)?mn(e,v,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(z):v(z))}function v(z){return z===45||z===58?w(z):z===124?(s=!0,e.enter("tableCellDivider"),e.consume(z),e.exit("tableCellDivider"),S):A(z)}function S(z){return rn(z)?mn(e,w,"whitespace")(z):w(z)}function w(z){return z===58?(i+=1,s=!0,e.enter("tableDelimiterMarker"),e.consume(z),e.exit("tableDelimiterMarker"),E):z===45?(i+=1,E(z)):z===null||wt(z)?N(z):A(z)}function E(z){return z===45?(e.enter("tableDelimiterFiller"),k(z)):A(z)}function k(z){return z===45?(e.consume(z),k):z===58?(s=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(z),e.exit("tableDelimiterMarker"),j):(e.exit("tableDelimiterFiller"),j(z))}function j(z){return rn(z)?mn(e,N,"whitespace")(z):N(z)}function N(z){return z===124?v(z):z===null||wt(z)?!s||o!==i?A(z):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(z)):A(z)}function A(z){return n(z)}function R(z){return e.enter("tableRow"),M(z)}function M(z){return z===124?(e.enter("tableCellDivider"),e.consume(z),e.exit("tableCellDivider"),M):z===null||wt(z)?(e.exit("tableRow"),t(z)):rn(z)?mn(e,M,"whitespace")(z):(e.enter("data"),T(z))}function T(z){return z===null||z===124||Bn(z)?(e.exit("data"),M(z)):(e.consume(z),z===92?O:T)}function O(z){return z===92||z===124?(e.consume(z),T):T(z)}}function afe(e,t){let n=-1,r=!0,o=0,i=[0,0,0,0],s=[0,0,0,0],c=!1,d=0,u,p,m;const g=new nfe;for(;++n<e.length;){const y=e[n],v=y[1];y[0]==="enter"?v.type==="tableHead"?(c=!1,d!==0&&(IA(g,t,d,u,p),p=void 0,d=0),u={type:"table",start:Object.assign({},v.start),end:Object.assign({},v.end)},g.add(n,0,[["enter",u,t]])):v.type==="tableRow"||v.type==="tableDelimiterRow"?(r=!0,m=void 0,i=[0,0,0,0],s=[0,n+1,0,0],c&&(c=!1,p={type:"tableBody",start:Object.assign({},v.start),end:Object.assign({},v.end)},g.add(n,0,[["enter",p,t]])),o=v.type==="tableDelimiterRow"?2:p?3:1):o&&(v.type==="data"||v.type==="tableDelimiterMarker"||v.type==="tableDelimiterFiller")?(r=!1,s[2]===0&&(i[1]!==0&&(s[0]=s[1],m=eg(g,t,i,o,void 0,m),i=[0,0,0,0]),s[2]=n)):v.type==="tableCellDivider"&&(r?r=!1:(i[1]!==0&&(s[0]=s[1],m=eg(g,t,i,o,void 0,m)),i=s,s=[i[1],n,0,0])):v.type==="tableHead"?(c=!0,d=n):v.type==="tableRow"||v.type==="tableDelimiterRow"?(d=n,i[1]!==0?(s[0]=s[1],m=eg(g,t,i,o,n,m)):s[1]!==0&&(m=eg(g,t,s,o,n,m)),o=0):o&&(v.type==="data"||v.type==="tableDelimiterMarker"||v.type==="tableDelimiterFiller")&&(s[3]=n)}for(d!==0&&IA(g,t,d,u,p),g.consume(t.events),n=-1;++n<t.events.length;){const y=t.events[n];y[0]==="enter"&&y[1].type==="table"&&(y[1]._align=ofe(t.events,n))}return e}function eg(e,t,n,r,o,i){const s=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",c="tableContent";n[0]!==0&&(i.end=Object.assign({},vu(t.events,n[0])),e.add(n[0],0,[["exit",i,t]]));const d=vu(t.events,n[1]);if(i={type:s,start:Object.assign({},d),end:Object.assign({},d)},e.add(n[1],0,[["enter",i,t]]),n[2]!==0){const u=vu(t.events,n[2]),p=vu(t.events,n[3]),m={type:c,start:Object.assign({},u),end:Object.assign({},p)};if(e.add(n[2],0,[["enter",m,t]]),r!==2){const g=t.events[n[2]],y=t.events[n[3]];if(g[1].end=Object.assign({},y[1].end),g[1].type="chunkText",g[1].contentType="text",n[3]>n[2]+1){const v=n[2]+1,S=n[3]-n[2]-1;e.add(v,S,[])}}e.add(n[3]+1,0,[["exit",m,t]])}return o!==void 0&&(i.end=Object.assign({},vu(t.events,o)),e.add(o,0,[["exit",i,t]]),i=void 0),i}function IA(e,t,n,r,o){const i=[],s=vu(t.events,n);o&&(o.end=Object.assign({},s),i.push(["exit",o,t])),r.end=Object.assign({},s),i.push(["exit",r,t]),e.add(n+1,0,i)}function vu(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const lfe={name:"tasklistCheck",tokenize:ufe};function cfe(){return{text:{91:lfe}}}function ufe(e,t,n){const r=this;return o;function o(d){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(d):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(d),e.exit("taskListCheckMarker"),i)}function i(d){return Bn(d)?(e.enter("taskListCheckValueUnchecked"),e.consume(d),e.exit("taskListCheckValueUnchecked"),s):d===88||d===120?(e.enter("taskListCheckValueChecked"),e.consume(d),e.exit("taskListCheckValueChecked"),s):n(d)}function s(d){return d===93?(e.enter("taskListCheckMarker"),e.consume(d),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),c):n(d)}function c(d){return wt(d)?t(d):rn(d)?e.check({tokenize:dfe},t,n)(d):n(d)}}function dfe(e,t,n){return mn(e,r,"whitespace");function r(o){return o===null?n(o):t(o)}}function ffe(e){return v4([zde(),Zde(),tfe(e),ife(),cfe()])}const hfe={};function pfe(e){const t=this,n=e||hfe,r=t.data(),o=r.micromarkExtensions||(r.micromarkExtensions=[]),i=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),s=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);o.push(ffe(n)),i.push(Ode()),s.push(Dde(n))}function mfe(e){V4(e,[/\r?\n|\r/g,gfe])}function gfe(){return{type:"break"}}function yfe(){return function(e){mfe(e)}}function xfe({alt:e="",...t}){const[n,r]=b.useState(!1);return n?f.jsxs("span",{className:"text-xs text-muted-foreground",children:["[图片加载失败",e?`:${e}`:"","]"]}):f.jsx("img",{alt:e,loading:"lazy",onError:()=>r(!0),...t})}const ql=b.memo(function({content:t,className:n,scrollClassName:r,emptyText:o="(无内容)"}){const i=t!=null&&t.trim()!==""?t:null;if(i===null)return f.jsx("p",{className:Ct("text-sm text-muted-foreground",n),children:o});const s=f.jsx("div",{className:Ct("markdown-body text-sm",n),children:f.jsx(nue,{remarkPlugins:[pfe,yfe],components:{a:({node:c,...d})=>f.jsx("a",{target:"_blank",rel:"noopener noreferrer",...d}),img:({node:c,...d})=>f.jsx(xfe,{...d}),pre:({node:c,children:d,...u})=>f.jsx("pre",{tabIndex:0,...u,children:d}),table:({node:c,children:d,...u})=>f.jsx("div",{className:"overflow-x-auto",children:f.jsx("table",{...u,children:d})})},children:i})});return r?f.jsx("div",{tabIndex:0,className:Ct("overflow-y-auto focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring",r),children:s}):s}),dF=b.createContext(void 0);function CC(){const e=b.useContext(dF);if(e===void 0)throw new Error(Sr(64));return e}const Dx={tabActivationDirection:e=>({"data-activation-direction":e})},vfe=b.forwardRef(function(t,n){const{className:r,defaultValue:o=0,onValueChange:i,orientation:s="horizontal",render:c,value:d,style:u,...p}=t,m=t.defaultValue!==void 0,g=b.useRef([]),[y,v]=b.useState(()=>new Map),[S,w]=Pg({controlled:d,default:o,name:"Tabs",state:"value"}),E=d!==void 0,[k,j]=b.useState(()=>new Map),N=b.useRef(void 0),A=b.useCallback(W=>FS(k,W),[k]),[R,M]=b.useState(()=>({previousValue:S,tabActivationDirection:"none"})),{previousValue:T,tabActivationDirection:O}=R;let z=O,q=!1;T!==S&&(z=zA(T,S,s,k),q=T!=null&&S!=null&&A(S)==null);const $=q?T:S,G=T!==$||O!==z;rt(()=>{G&&M({previousValue:$,tabActivationDirection:z})},[$,G,z]);const L=st((W,ne)=>{const je=zA(S,W,s,k);ne.activationDirection=je,i?.(W,ne),!ne.isCanceled&&w(W)}),F=st((W,ne)=>{i?.(W,Bt(ne,void 0,void 0,{activationDirection:"none"}))}),P=st((W,ne)=>(v(je=>{const Ee=new Map(je);return Ee.set(W,ne),Ee}),()=>{v(je=>{if(je.get(W)!==ne)return je;const Ee=new Map(je);return Ee.delete(W),Ee})})),I=b.useCallback(W=>y.get(W),[y]),Y=b.useCallback(W=>{for(const ne of k.values())if(W===ne.value)return ne.id},[k]),Z=b.useMemo(()=>({getTabElementBySelectedValue:A,getTabIdByPanelValue:Y,getTabPanelIdByValue:I,onValueChange:L,orientation:s,registerMountedTabPanel:P,setTabMap:j,tabActivationDirection:z,value:S}),[A,Y,I,L,s,P,j,z,S]),D=b.useMemo(()=>{for(const W of k.values())if(W.value===S)return W},[k,S]),H=b.useMemo(()=>{for(const W of k.values())if(!W.disabled)return W.value},[k]),U=b.useRef(!m),B=b.useRef(o),X=b.useRef(m),J=b.useRef(!1);rt(()=>{if(E)return;function W(pe,re){w(pe),M({previousValue:pe,tabActivationDirection:"none"}),F(pe,re),U.current=!1}if(k.size===0){J.current&&S!==null&&!N.current?.isConnected&&W(null,qN);return}J.current=!0,N.current=k.keys().next().value;const ne=D?.disabled,je=D==null&&S!==null;if(!ne&&S===B.current&&(X.current=!1),X.current&&ne&&S===B.current)return;const Ee=U.current;if(ne||je){const pe=H??null;if(S===pe){U.current=!1;return}let re=qN;Ee?re=YN:ne&&(re=Xq),W(pe,re);return}Ee&&D!=null&&(F(S,YN),U.current=!1)},[H,E,F,D,w,k,S]);const oe=wn("div",t,{state:{orientation:s,tabActivationDirection:z},ref:n,props:p,stateAttributesMapping:Dx});return f.jsx(dF.Provider,{value:Z,children:f.jsx(rx,{elementsRef:g,children:oe})})});function FS(e,t){for(const[n,r]of e.entries())if(t===r.value)return n;return null}function zA(e,t,n,r){if(e==null||t==null)return"none";const[o,i,s]=n==="horizontal"?["left","left","right"]:["top","up","down"],c=FS(r,e),d=FS(r,t);if(c==null||d==null)return c!==d&&(typeof e=="number"||typeof e=="string")&&typeof e==typeof t?t>e?s:i:"none";const u=c.getBoundingClientRect()[o],p=d.getBoundingClientRect()[o];return p<u?i:p>u?s:"none"}const fF="data-composite-item-active",hF=b.createContext(void 0);function bfe(){const e=b.useContext(hF);if(e===void 0)throw new Error(Sr(65));return e}const wfe=b.forwardRef(function(t,n){const{className:r,disabled:o=!1,render:i,value:s,id:c,nativeButton:d=!0,style:u,...p}=t,{value:m,getTabPanelIdByValue:g,onValueChange:y,orientation:v,tabActivationDirection:S}=CC(),{activateOnFocus:w,registerTabResizeObserverElement:E,tabsListElement:k}=bfe(),{highlightedIndex:j,onHighlightedIndexChange:N}=nx(),A=na(c),R=b.useMemo(()=>({disabled:o,id:A,value:s}),[o,A,s]),{compositeProps:M,compositeRef:T,index:O}=AI({metadata:R}),z=s===m,q=b.useRef(!1),$=b.useRef(null),G=st(J=>{$.current?.(),$.current=J?E(J):null});rt(()=>{if(q.current){q.current=!1;return}if(!(z&&O>-1&&j!==O))return;const J=k;if(J!=null){const Q=Jr(en(J));if(Q&&yt(J,Q))return}o||N(O)},[z,O,j,N,o,k]);const{getButtonProps:L,buttonRef:F}=ll({disabled:o,native:d,focusableWhenDisabled:!0}),P=g(s),I=b.useRef(!1),Y=b.useRef(!1);function Z(J){y(s,Bt(Kl,J.nativeEvent,void 0,{activationDirection:"none"}))}function D(J){z||o||Z(J)}function H(J){z||o||w&&(!I.current||Y.current)&&Z(J)}function U(J){if(z||o)return;I.current=!0,Y.current=J.button===0;const Q=en(J.currentTarget);function oe(){I.current=!1,Y.current=!1,Q.removeEventListener("pointerup",oe),Q.removeEventListener("pointercancel",oe)}Q.addEventListener("pointerup",oe),Q.addEventListener("pointercancel",oe)}return wn("button",t,{state:{disabled:o,active:z,orientation:v,tabActivationDirection:S},ref:[n,F,T,G],props:[M,{role:"tab","aria-controls":P,"aria-selected":z,id:A,onClick:D,onFocus:H,onPointerDown:U,[fF]:z?"":void 0,onKeyDownCapture(){q.current=!0}},p,L],stateAttributesMapping:Dx})}),Sfe={...Dx,...td},Efe=b.forwardRef(function(t,n){const{className:r,value:o,render:i,keepMounted:s=!1,style:c,...d}=t,{value:u,getTabIdByPanelValue:p,orientation:m,tabActivationDirection:g,registerMountedTabPanel:y}=CC(),v=na(),{ref:S,index:w}=lx(),E=o===u,{mounted:k,transitionStatus:j,setMounted:N}=Ph(E),A=!k,R=p(o),M={hidden:A,orientation:m,tabActivationDirection:g,transitionStatus:j},T=b.useRef(null),O=wn("div",t,{state:M,ref:[n,S,T],props:[{"aria-labelledby":R,hidden:A,id:v,role:"tabpanel",tabIndex:E?0:-1,inert:zh(!E),"data-index":w},d],stateAttributesMapping:Sfe});return ta({open:E,ref:T,onComplete(){E||N(!1)}}),rt(()=>{if(!(v==null||A&&!s))return y(o,v)},[A,s,o,v,y]),s||k?O:null}),Cfe=[];function kfe(e){const{loopFocus:t=!0,orientation:n="both",grid:r,onLoop:o,direction:i,highlightedIndex:s,onHighlightedIndexChange:c,rootRef:d,enableHomeAndEndKeys:u=!1,stopEventPropagation:p,disabledIndices:m,modifierKeys:g=Cfe}=e,[y,v]=b.useState(0),S=r!=null,w=b.useRef(null),E=Xa(w,d),k=b.useRef([]),j=b.useRef(!1),N=s??y,A=st((z,q=!1)=>{if((c??v)(z),q){const $=k.current[z];RT(w.current,$,i,n)}}),R=st(z=>{if(z.size===0||j.current)return;j.current=!0;const q=Array.from(z.keys()),$=q.find(L=>L?.hasAttribute(fF))??null,G=$?z.get($)?.index??-1:-1;if(G!==-1)A(G);else if($g(q,N,m)){const L=Bs(q,{disabledIndices:m});Lf(q,L)||A(L)}RT(w.current,$,i,n)});rt(()=>{if(m==null||s!=null||!j.current)return;const z=k.current;if($g(z,N,m)){const q=Bs(z,{disabledIndices:m});Lf(z,q)||A(q)}},[m,s,N,k,A]);const M=st((z,q,$)=>o?o(z,q,$,k):$),T=st(z=>{const q=z.key===Gw||z.key===Kw;if(!Lh.has(z.key)||!u&&q||jfe(z,g)||!w.current)return;const G=i==="rtl",L=G?Yw:Zw,F=G?Zw:Yw,P=n==="vertical"?qw:L,I=n==="vertical"?Uw:F,Y=ro(z.nativeEvent);if(Y!=null&&jT(Y)&&!PD(Y)){const X=Y.selectionStart,J=Y.selectionEnd,Q=Y.value;if(X==null||z.shiftKey||X!==J||z.key!==I&&X<Q.length||z.key!==P&&X>0)return}let Z=N;const D=mg(k,m),H=Lw(k,m);r!=null&&(Z=r({disabledIndices:m,elementsRef:k,event:z,highlightedIndex:N,loopFocus:t,maxIndex:H,minIndex:D,onLoop:M,orientation:n,rtl:G}));const U=n!=="vertical"&&z.key===L||n!=="horizontal"&&z.key===qw,B=n!=="vertical"&&z.key===F||n!=="horizontal"&&z.key===Uw;u&&(z.key===Gw?Z=D:z.key===Kw&&(Z=H)),Z===N&&(U||B)&&(t&&Z===H&&U?(Z=D,o&&(Z=o(z,N,Z,k))):t&&Z===D&&B?(Z=H,o&&(Z=o(z,N,Z,k))):Z=Bs(k.current,{startingIndex:Z,decrement:B,disabledIndices:m})),Z!==N&&!Lf(k.current,Z)&&(p&&z.stopPropagation(),(S||q||U||B)&&z.preventDefault(),A(Z,!0),queueMicrotask(()=>{k.current[Z]?.focus()}))});return{props:{ref:E,onFocus(z){const q=w.current,$=ro(z.nativeEvent);!q||$==null||!jT($)||$.setSelectionRange(0,$.value.length)},onKeyDown:T},highlightedIndex:N,onHighlightedIndexChange:A,elementsRef:k,onMapChange:R,relayKeyboardEvent:T}}function jfe(e,t){for(const n of LZ)if(!t.includes(n)&&e.getModifierState(n))return!0;return!1}function Rfe(e){const{render:t,className:n,style:r,refs:o=fs,props:i=fs,state:s=rr,stateAttributesMapping:c,highlightedIndex:d,onHighlightedIndexChange:u,orientation:p,grid:m,loopFocus:g,onLoop:y,enableHomeAndEndKeys:v,onMapChange:S,stopEventPropagation:w=!0,rootRef:E,disabledIndices:k,modifierKeys:j,highlightItemOnHover:N=!1,tag:A="div",...R}=e,M=ox(),{props:T,highlightedIndex:O,onHighlightedIndexChange:z,elementsRef:q,onMapChange:$,relayKeyboardEvent:G}=kfe({grid:m,loopFocus:g,onLoop:y,orientation:p,highlightedIndex:d,onHighlightedIndexChange:u,rootRef:E,stopEventPropagation:w,enableHomeAndEndKeys:v,direction:M,disabledIndices:k,modifierKeys:j}),L=wn(A,e,{state:s,ref:o,props:[T,...i,R],stateAttributesMapping:c}),F=b.useMemo(()=>({highlightedIndex:O,onHighlightedIndexChange:z,highlightItemOnHover:N,relayKeyboardEvent:G}),[O,z,N,G]);return f.jsx(tI.Provider,{value:F,children:f.jsx(rx,{elementsRef:q,onMapChange:P=>{S?.(P),$(P)},children:L})})}const _fe=b.forwardRef(function(t,n){const{activateOnFocus:r=!1,className:o,loopFocus:i=!0,render:s,style:c,...d}=t,{orientation:u,setTabMap:p,tabActivationDirection:m}=CC(),[g,y]=b.useState(0),[v,S]=b.useState(null),w=b.useRef(new Set),E=b.useRef(new Set),k=b.useRef(null);rt(()=>{if(typeof ResizeObserver>"u")return;const T=new ResizeObserver(()=>{w.current.forEach(O=>{O()})});return k.current=T,v&&T.observe(v),E.current.forEach(O=>{T.observe(O)}),()=>{T.disconnect(),k.current=null}},[v]);const j=st(T=>(w.current.add(T),()=>{w.current.delete(T)})),N=st(T=>(E.current.add(T),k.current?.observe(T),()=>{E.current.delete(T),k.current?.unobserve(T)})),A={orientation:u,tabActivationDirection:m},R={"aria-orientation":u==="vertical"?"vertical":void 0,role:"tablist"},M=b.useMemo(()=>({activateOnFocus:r,registerIndicatorUpdateListener:j,registerTabResizeObserverElement:N,tabsListElement:v}),[r,j,N,v]);return f.jsx(hF.Provider,{value:M,children:f.jsx(Rfe,{render:s,className:o,style:c,state:A,refs:[n,S],props:[R,d],stateAttributesMapping:Dx,highlightedIndex:g,enableHomeAndEndKeys:!0,loopFocus:i,orientation:u,onHighlightedIndexChange:y,onMapChange:p,disabledIndices:fs})})});function Nfe({className:e,orientation:t="horizontal",...n}){return f.jsx(vfe,{"data-slot":"tabs","data-orientation":t,className:Ct("group/tabs flex gap-2 data-horizontal:flex-col",e),...n})}const Tfe=Fh("group/tabs-list inline-flex w-fit items-center justify-center rounded-lg p-[3px] text-muted-foreground group-data-horizontal/tabs:h-8 group-data-vertical/tabs:h-fit group-data-vertical/tabs:flex-col data-[variant=line]:rounded-none",{variants:{variant:{default:"bg-muted",line:"gap-1 bg-transparent"}},defaultVariants:{variant:"default"}});function Mfe({className:e,variant:t="default",...n}){return f.jsx(_fe,{"data-slot":"tabs-list","data-variant":t,className:Ct(Tfe({variant:t}),e),...n})}function LA({className:e,...t}){return f.jsx(wfe,{"data-slot":"tabs-trigger",className:Ct("relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-1.5 py-0.5 text-sm font-medium whitespace-nowrap text-foreground/60 transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 has-data-[icon=inline-end]:pr-1 has-data-[icon=inline-start]:pl-1 aria-disabled:pointer-events-none aria-disabled:opacity-50 dark:text-muted-foreground dark:hover:text-foreground group-data-[variant=default]/tabs-list:data-active:shadow-sm group-data-[variant=line]/tabs-list:data-active:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4","group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent dark:group-data-[variant=line]/tabs-list:data-active:border-transparent dark:group-data-[variant=line]/tabs-list:data-active:bg-transparent","data-active:bg-background data-active:text-foreground dark:data-active:border-input dark:data-active:bg-input/30 dark:data-active:text-foreground","after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-horizontal/tabs:after:inset-x-0 group-data-horizontal/tabs:after:bottom-[-5px] group-data-horizontal/tabs:after:h-0.5 group-data-vertical/tabs:after:inset-y-0 group-data-vertical/tabs:after:-right-1 group-data-vertical/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100",e),...t})}function FA({className:e,...t}){return f.jsx(Efe,{"data-slot":"tabs-content",className:Ct("flex-1 text-sm outline-none",e),...t})}function ch({previewClassName:e="min-h-64 max-h-[60vh]",...t}){const[n,r]=b.useState("edit");return f.jsxs(Nfe,{value:n,onValueChange:o=>r(o==="preview"?"preview":"edit"),children:[f.jsx("div",{className:"flex justify-end",children:f.jsxs(Mfe,{"aria-label":"编辑/预览切换",children:[f.jsx(LA,{value:"edit",children:"编辑"}),f.jsx(LA,{value:"preview",children:"预览"})]})}),f.jsx(FA,{value:"edit",keepMounted:!0,children:f.jsx(o4,{...t})}),f.jsx(FA,{value:"preview",children:n==="preview"&&f.jsx(ql,{content:t.value==null?null:String(t.value),scrollClassName:e})})]})}const $S=20;function vf(e){return e.split("/").filter(t=>t!==".").join("/").toLowerCase()}function Afe(e,t,n){const r=e.trim();if(r.length===0)return"请填写引用文档路径";if(r.startsWith("/"))return`禁止绝对路径:${r}`;if(r.includes("\\"))return`禁止反斜杠路径分隔符(须使用正斜杠 /):${r}`;const o=r.split("/");if(o.some(s=>s===""))return`禁止空路径段(连续或尾随斜杠):${r}`;if(o.includes(".."))return`禁止越界回溯(.. 路径段):${r}`;if(o.every(s=>s==="."))return`路径不能只由 "." 组成:${r}`;if(vf(r)===n.toLowerCase())return`与主文档文件名 ${n} 冲突`;if(t.length>=$S)return`引用文档最多 ${$S} 条`;if(t.some(s=>vf(s.path)===vf(r)))return`引用文档路径重复(与现有条目规范化后相同):${r}`;const i=vf(r);return t.some(s=>{const c=vf(s.path);return c.startsWith(`${i}/`)||i.startsWith(`${c}/`)})?`引用文档路径互为目录前缀(落盘时文件与目录冲突):${r}`:null}function pF({value:e,onChange:t,getMainBody:n,mainDocName:r,disabled:o=!1,id:i,"aria-describedby":s,"aria-invalid":c}){const[d,u]=b.useState(null),[p,m]=b.useState(!1),[g,y]=b.useState(""),[v,S]=b.useState(""),[w,E]=b.useState(null),k=b.useRef(null),j=b.useMemo(()=>e.find(T=>T.path===d)??null,[e,d]),N=T=>{u(T),m(!1)},A=T=>{n().includes(T.path)&&!window.confirm(`主文档仍引用此路径「${T.path}」,删除将被服务端拒绝;先移除主文档引用?
144
+ 确认即从本次提交中移除该引用文档。`)||(t(e.filter(O=>O.path!==T.path)),d===T.path&&u(null))},R=()=>{const T=Afe(g,e,r);if(T!==null){E(T);return}const O=g.trim();t([...e,{path:O,content:v}]),y(""),S(""),E(null),u(O),requestAnimationFrame(()=>k.current?.focus())},M=T=>{d&&t(e.map(O=>O.path===d?{...O,content:T}:O))};return f.jsxs("div",{className:"space-y-3",id:i,role:"group","aria-label":"引用文档管理","aria-describedby":s,"aria-invalid":c,children:[e.length===0?f.jsxs("div",{className:"rounded-lg border border-dashed px-4 py-6 text-center",children:[f.jsx("p",{className:"text-sm text-muted-foreground",children:"尚无引用文档——主文档之外的补充材料(模板/清单/手册)可在此随资产一并存储与安装下发。"}),f.jsxs(Te,{type:"button",variant:"outline",size:"sm",className:"mt-3",disabled:o,onClick:()=>m(!0),children:[f.jsx(Qf,{className:"size-4"}),"添加第一个引用文档"]})]}):f.jsx("ul",{className:"divide-y rounded-lg border","aria-label":"引用文档列表",children:e.map(T=>{const O=T.path===d;return f.jsxs("li",{className:"flex items-center gap-2 px-3 py-2",children:[f.jsx(B6,{className:"size-4 shrink-0 text-muted-foreground","aria-hidden":!0}),f.jsx("span",{className:"min-w-0 flex-1 truncate font-mono text-sm text-foreground",title:T.path,children:T.path}),f.jsxs(Vt,{variant:"secondary",children:[T.content.length," 字符"]}),f.jsx(Te,{type:"button",variant:O?"secondary":"ghost",size:"sm",disabled:o,onClick:()=>N(T.path),children:O&&!p?"编辑中":"编辑"}),f.jsx(Te,{type:"button",variant:"destructive",size:"sm",disabled:o,onClick:()=>A(T),"aria-label":`删除引用文档 ${T.path}`,children:"删除"})]},T.path)})}),j!==null&&f.jsxs("div",{className:"space-y-2",children:[f.jsxs(jr,{htmlFor:"reference-content-editor",className:"font-mono text-xs text-muted-foreground",children:["编辑内容 · ",j.path]}),f.jsx(ch,{ref:k,id:"reference-content-editor",value:j.content,disabled:o,onChange:T=>M(T.target.value),"aria-label":`引用文档 ${j.path} 内容`,placeholder:"引用文档正文(Markdown)",className:"max-h-[50vh] min-h-40",previewClassName:"min-h-40 max-h-[50vh]"})]}),p?f.jsxs("div",{className:"space-y-2 rounded-lg border bg-muted/30 p-3",children:[f.jsxs("div",{className:"space-y-1",children:[f.jsx(jr,{htmlFor:"new-ref-path",children:"新引用路径"}),f.jsx(Lt,{id:"new-ref-path",value:g,disabled:o,onChange:T=>{y(T.target.value),w!==null&&E(null)},"aria-invalid":w!==null,"aria-describedby":w!==null?"new-ref-path-error":void 0,placeholder:"相对资产根的正斜杠路径,如 references/guide.md",autoComplete:"off"}),w!==null&&f.jsx("p",{id:"new-ref-path-error",role:"alert",className:"text-sm text-destructive",children:w}),f.jsxs("p",{className:"text-xs text-muted-foreground",children:["相对路径(正斜杠),不可与主文档 ",r," 同名;上限 ",$S," 条。"]})]}),f.jsxs("div",{className:"space-y-1",children:[f.jsx(jr,{htmlFor:"new-ref-content",children:"初始内容"}),f.jsx(ch,{id:"new-ref-content",value:v,disabled:o,onChange:T=>S(T.target.value),placeholder:"可为空,稍后在列表中继续编辑",className:"min-h-24",previewClassName:"min-h-24 max-h-64"})]}),f.jsxs("div",{className:"flex justify-end gap-2",children:[f.jsx(Te,{type:"button",variant:"ghost",size:"sm",disabled:o,onClick:()=>{m(!1),y(""),S(""),E(null)},children:"取消"}),f.jsx(Te,{type:"button",size:"sm",disabled:o,onClick:R,children:"添加"})]})]}):e.length>0&&f.jsxs(Te,{type:"button",variant:"outline",size:"sm",disabled:o,onClick:()=>{u(null),m(!0)},children:[f.jsx(Qf,{className:"size-4"}),"新增引用文档"]})]})}function kC(e,t=!0,n){return _r({queryKey:["skills",e,{includeDisabled:n?.includeDisabled??!1,q:n?.q??""}],queryFn:()=>m9(e,n),enabled:t&&e.length>0,placeholderData:jy})}function Ofe(e,t){return _r({queryKey:["skill",e,t?.scope??"global",t?.projectId??"",t?.includeDisabled],queryFn:()=>g9(e,t),enabled:e.length>0})}function Dfe(){const e=Jt();return on({mutationFn:t=>y9(t),onSuccess:()=>{e.invalidateQueries({queryKey:["skills"]})}})}function Pfe(){const e=Jt();return on({mutationFn:({name:t,patch:n,scope:r,projectId:o})=>x9(t,n,{...r!==void 0?{scope:r}:{},...o!==void 0?{projectId:o}:{}}),onSuccess:()=>{e.invalidateQueries({queryKey:["skills"]})}})}function Ife(){const e=Jt();return on({mutationFn:({name:t,scope:n,projectId:r})=>v9(t,{...n!==void 0?{scope:n}:{},...r!==void 0?{projectId:r}:{}}),onSuccess:()=>{e.invalidateQueries({queryKey:["skills"]})}})}function zfe(){const e=Jt();return on({mutationFn:({name:t,input:n,scope:r,projectId:o})=>b9(t,n,{...r!==void 0?{scope:r}:{},...o!==void 0?{projectId:o}:{}}),onSuccess:()=>{e.invalidateQueries({queryKey:["skills"]})}})}function Lfe(){const e=Jt();return on({mutationFn:({name:t,enabled:n,scope:r,projectId:o})=>w9(t,n,{...r!==void 0?{scope:r}:{},...o!==void 0?{projectId:o}:{}}),onSuccess:()=>{e.invalidateQueries({queryKey:["skills"]})}})}function jC(e){const t=RU(e);b.useEffect(()=>{if(t.state!=="blocked")return;window.confirm("当前页面有未保存的修改,确定离开吗?")?t.proceed():t.reset()},[t]),b.useEffect(()=>{if(!e)return;const n=r=>{r.preventDefault()};return window.addEventListener("beforeunload",n),()=>window.removeEventListener("beforeunload",n)},[e])}const Ffe=Li({name:zt().regex(/^[a-z0-9]+(-[a-z0-9]+)*$/,"name 需为 kebab-case(小写字母/数字/中划线)"),description:zt().min(1,"描述不能为空"),systemPrompt:zt().min(1,"系统提示词不能为空"),model:zt().regex(/^[a-z0-9]+(-[a-z0-9]+)*$/,"请从模型映射中选择"),boundSkills:Ga(zt()),tools:Ga(zt()),permissions:Ga(zt()),scope:ih(["global","project"]),function:ih(["reviewer","executor"]),references:Ga(Li({path:zt().min(1),content:zt()}))}),$fe={name:"",description:"",systemPrompt:"",model:"",boundSkills:[],tools:[],permissions:[],scope:"project",function:"executor",references:[]};function Vfe({options:e,selected:t,onToggle:n,placeholder:r,emptyText:o,disabled:i,id:s,"aria-describedby":c,"aria-invalid":d}){const[u,p]=b.useState(!1),m=b.useMemo(()=>new Set(t),[t]);return f.jsxs("div",{className:"space-y-2",children:[f.jsx("div",{className:"flex flex-wrap gap-1.5",children:t.length===0?f.jsx("span",{className:"text-sm text-muted-foreground",children:"未选择"}):t.map(g=>{const y=e.find(v=>v.value===g);return f.jsxs(Vt,{variant:"outline",className:"gap-1 pr-1",children:[y?.label??g,f.jsx("button",{type:"button",disabled:i,onClick:()=>n(g),"aria-label":`移除 ${g}`,className:"rounded-sm p-0.5 text-muted-foreground hover:text-foreground focus:outline-none focus-visible:ring-2 focus-visible:ring-foreground",children:f.jsx(Nh,{className:"size-3"})})]},g)})}),f.jsxs(V1,{open:u,onOpenChange:p,children:[f.jsx(B1,{render:f.jsxs(Te,{type:"button",variant:"outline",role:"combobox","aria-expanded":u,disabled:i,id:s,"aria-describedby":c,"aria-invalid":d,className:"w-full justify-between font-normal",children:[t.length>0?`已选 ${t.length} 项`:r,f.jsx(_h,{className:"ml-2 size-4 shrink-0 opacity-50"})]})}),f.jsx(H1,{className:"w-[var(--anchor-width)] p-0",align:"start",children:f.jsxs(eC,{children:[f.jsx(tC,{placeholder:`搜索${r}…`}),f.jsxs(nC,{role:"listbox","aria-label":r,children:[f.jsx(rC,{children:o}),f.jsx(oC,{children:e.map(g=>f.jsxs(iC,{value:g.label,role:"option","aria-selected":m.has(g.value),onSelect:()=>n(g.value),children:[g.label,m.has(g.value)&&f.jsx(Ju,{className:"ml-auto size-4 text-success","aria-hidden":"true"})]},g.value))})]})]})})]})]})}function $A({value:e,onChange:t,placeholder:n,disabled:r,id:o,"aria-describedby":i,"aria-invalid":s}){const[c,d]=b.useState(""),u=()=>{const p=c.trim();p.length!==0&&(e.includes(p)||t([...e,p]),d(""))};return f.jsxs("div",{className:"space-y-2",children:[f.jsx("div",{className:"flex flex-wrap gap-1.5",children:e.length===0?f.jsx("span",{className:"text-sm text-muted-foreground",children:"未添加"}):e.map(p=>f.jsxs(Vt,{variant:"secondary",className:"gap-1 pr-1",children:[p,f.jsx("button",{type:"button",disabled:r,onClick:()=>t(e.filter(m=>m!==p)),"aria-label":`移除 ${p}`,className:"rounded-sm p-0.5 text-muted-foreground hover:text-foreground focus:outline-none focus-visible:ring-2 focus-visible:ring-foreground",children:f.jsx(Nh,{className:"size-3"})})]},p))}),f.jsx(Lt,{value:c,disabled:r,id:o,"aria-describedby":i,"aria-invalid":s,placeholder:n,onChange:p=>d(p.target.value),onKeyDown:p=>{p.key==="Enter"?(p.preventDefault(),u()):p.key==="Backspace"&&c.length===0&&e.length>0&&t(e.slice(0,-1))}})]})}function VA(){Ir();const t=Wu().name??"",n=t.length>0,r=ko(),[o]=Ay(),i=o.get("scope")==="project"?"project":"global",s=o.get("projectId")??void 0,c={scope:i,...s!==void 0?{projectId:s}:{},includeDisabled:!0},{activeProjectId:d,projects:u,bootstrapReady:p,bootstrapError:m,retryBootstrap:g}=Kr(),y=vW(n?t:"",c),v=kC(d),S=bW(),w=wW(),E=Vn("scope"),k=P=>E.find(I=>I.value===P)?.label??P,j=Vn("agent_function"),N=P=>j.find(I=>I.value===P)?.label??P,A=b.useMemo(()=>!n||!y.data?!1:y.data.scope==="project"&&(u.find(P=>P.id===y.data?.projectId)?.status??"active")==="archived",[n,y.data,u]),R=ra({resolver:oa(Ffe),defaultValues:$fe}),{isSubmitting:M,isDirty:T}=R.formState,O=!!R.formState.errors.model,[z,q]=b.useState(null),$=b.useMemo(()=>(v.data??[]).map(P=>({value:P.name,label:P.name})),[v.data]),G=b.useMemo(()=>new Set(v.data?.map(P=>P.name)??[]),[v.data]),L=y.data?.name;b.useEffect(()=>{!n||!y.data||L!==t||R.getValues("name")===""&&R.reset({name:y.data.name,description:y.data.description,systemPrompt:y.data.systemPrompt,model:y.data.model,boundSkills:y.data.boundSkills,tools:y.data.tools,permissions:y.data.permissions,scope:y.data.scope,function:y.data.function??"executor",references:y.data.references??[]})},[n,y.data,L,t,R]),jC(T&&!M);const F=async P=>{q(null);try{n?(await w.mutateAsync({name:t,scope:i,projectId:s,patch:{description:P.description,systemPrompt:P.systemPrompt,model:P.model,boundSkills:P.boundSkills,tools:P.tools,permissions:P.permissions,function:P.function,references:P.references}}),We.success("代理已更新")):(await S.mutateAsync({...P,...P.scope==="project"?{projectId:d}:{}}),We.success("代理已创建")),r("/agents")}catch(I){const Y=ft(I);q(Y),We.error(Y)}};return m?f.jsx("div",{className:"mx-auto w-full max-w-4xl px-4 py-6",children:f.jsx(kn,{message:"项目上下文加载失败",onRetry:g})}):p?f.jsxs("div",{className:"mx-auto w-full max-w-4xl px-4 py-6",children:[f.jsxs("div",{className:"mb-6 flex items-center gap-3",children:[f.jsx(Te,{variant:"ghost",size:"icon","aria-label":"返回代理库",render:f.jsx(yn,{to:"/agents"}),nativeButton:!1,children:f.jsx(Vl,{className:"size-4"})}),f.jsxs("div",{children:[f.jsx("h1",{className:"text-xl font-bold text-foreground",children:n?`编辑代理 · ${t}`:"新建代理"}),f.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Agent 配置与技能绑定管理(name 为唯一键)"})]})]}),n&&y.isLoading?f.jsx(Kn,{rows:8,cols:1}):n&&y.isError?f.jsx(kn,{message:ft(y.error),onRetry:()=>{y.refetch()}}):f.jsx(ia,{...R,children:f.jsxs("form",{onSubmit:R.handleSubmit(F),className:"space-y-6",children:[A&&f.jsx("div",{className:"rounded-lg border border-destructive/50 bg-destructive/10 px-4 py-3 text-sm text-destructive",children:"该代理所属项目已停用,资产处于冻结状态(只读)。如需修改,请先启用该项目,或复制到其他作用域。"}),z!==null&&!A&&f.jsx("div",{role:"alert",className:"max-h-40 overflow-y-auto rounded-lg border border-destructive/50 bg-destructive/10 px-4 py-3 text-sm break-all whitespace-pre-wrap text-destructive",children:z}),f.jsxs("div",{className:"grid gap-6 md:grid-cols-2",children:[f.jsx(Ot,{control:R.control,name:"name",render:({field:P})=>f.jsxs(Dt,{children:[f.jsxs(Pt,{children:["名称 ",f.jsx("span",{className:"text-destructive",children:"*"})]}),f.jsx(_t,{children:f.jsx(Lt,{...P,placeholder:"kebab-case,如 backend-dev",disabled:M||n||A})}),f.jsx(It,{})]})}),f.jsx(Ot,{control:R.control,name:"scope",render:({field:P})=>f.jsxs(Dt,{children:[f.jsx(Pt,{children:"作用域"}),n?f.jsx(_t,{children:f.jsx(Lt,{value:P.value==="global"?`${k("global")}(创建后不可变)`:`${u.find(I=>I.id===y.data?.projectId)?.name??"未知项目"}(创建后不可变)`,disabled:!0})}):f.jsxs(pr,{value:P.value,onValueChange:I=>{(I==="global"||I==="project")&&P.onChange(I)},disabled:M,children:[f.jsx(_t,{children:f.jsx(mr,{className:"w-full",children:f.jsx(Gs,{placeholder:"选择作用域"})})}),f.jsx(gr,{children:E.map(I=>f.jsx(Un,{value:I.value,disabled:I.value==="project"&&d==="",children:I.value==="project"?"当前项目":I.label},I.value))})]}),f.jsx(It,{})]})}),f.jsx(Ot,{control:R.control,name:"function",render:({field:P})=>f.jsxs(Dt,{children:[f.jsx(Pt,{children:"功能类型"}),f.jsxs(pr,{value:P.value,onValueChange:I=>{(I==="reviewer"||I==="executor")&&P.onChange(I)},disabled:M||A,children:[f.jsx(_t,{children:f.jsx(mr,{className:"w-full",children:N(P.value)})}),f.jsx(gr,{children:j.filter(I=>I.active).map(I=>f.jsx(Un,{value:I.value,children:I.label},I.value))})]}),f.jsx("p",{className:"text-xs text-muted-foreground",children:"审查类:安装落盘时注入受限信息边界;执行/通用:不受限(缺省)。"}),f.jsx(It,{})]})}),f.jsx(Ot,{control:R.control,name:"description",render:({field:P})=>f.jsxs(Dt,{children:[f.jsxs(Pt,{children:["描述 ",f.jsx("span",{className:"text-destructive",children:"*"})]}),f.jsx(_t,{children:f.jsx(Lt,{...P,placeholder:"一句话说明代理职责",disabled:M||A})}),f.jsx(It,{})]})}),f.jsx(Ot,{control:R.control,name:"model",render:({field:P})=>f.jsxs(Dt,{children:[f.jsxs(Pt,{children:["模型 ",f.jsx("span",{className:"text-destructive",children:"*"})]}),f.jsx(_t,{children:f.jsx(Hie,{value:P.value,onChange:P.onChange,disabled:M||A,invalid:O})}),f.jsx(It,{})]})}),f.jsx(Ot,{control:R.control,name:"boundSkills",render:({field:P})=>f.jsxs(Dt,{children:[f.jsx(Pt,{children:"绑定技能"}),f.jsx(_t,{children:f.jsx(Vfe,{options:$,selected:P.value,onToggle:I=>P.onChange(P.value.includes(I)?P.value.filter(Y=>Y!==I):[...P.value,I]),placeholder:"选择绑定技能…",emptyText:v.isLoading?"技能加载中…":"未找到匹配技能",disabled:M||A})}),P.value.some(I=>!G.has(I))&&f.jsxs("p",{className:"text-sm text-warning",children:["以下绑定技能不存在,保存后该绑定将无法解析:",P.value.filter(I=>!G.has(I)).join("、")]}),f.jsx(It,{})]})}),f.jsx(Ot,{control:R.control,name:"tools",render:({field:P})=>f.jsxs(Dt,{children:[f.jsx(Pt,{children:"工具"}),f.jsx(_t,{children:f.jsx($A,{value:P.value,onChange:P.onChange,placeholder:"输入工具名后回车,如 bash",disabled:M||A})}),f.jsx(It,{})]})}),f.jsx(Ot,{control:R.control,name:"permissions",render:({field:P})=>f.jsxs(Dt,{children:[f.jsx(Pt,{children:"权限"}),f.jsx(_t,{children:f.jsx($A,{value:P.value,onChange:P.onChange,placeholder:"输入权限名后回车,如 read-only",disabled:M||A})}),f.jsx(It,{})]})})]}),f.jsx(Ot,{control:R.control,name:"systemPrompt",render:({field:P})=>f.jsxs(Dt,{children:[f.jsxs(Pt,{children:["系统提示词 ",f.jsx("span",{className:"text-destructive",children:"*"})]}),f.jsx(_t,{children:f.jsx(ch,{...P,placeholder:"Agent 的系统提示词",disabled:M||A})}),f.jsx(It,{})]})}),f.jsx(Ot,{control:R.control,name:"references",render:({field:P})=>f.jsxs(Dt,{children:[f.jsx(Pt,{children:"引用文档"}),f.jsx(_t,{children:f.jsx(pF,{value:P.value,onChange:P.onChange,getMainBody:()=>R.getValues("systemPrompt"),mainDocName:"agent.md",disabled:M||A})}),f.jsx(It,{}),f.jsx("p",{className:"text-xs text-muted-foreground",children:"随代理一并存储与安装下发;install 后主文档中的相对路径引用将在本地真实可达。"})]})}),f.jsxs("div",{className:"flex justify-end gap-2",children:[f.jsx(Te,{type:"button",variant:"outline",render:f.jsx(yn,{to:"/agents"}),nativeButton:!1,disabled:M,children:"取消"}),f.jsx(Te,{type:"submit",disabled:M||A,children:M?"保存中…":"保存"})]})]})})]}):f.jsx("div",{className:"mx-auto w-full max-w-4xl px-4 py-6",children:f.jsx(Kn,{rows:6})})}function Er(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=Er(e[n]))!==""&&(t+=(t&&" ")+r);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var Bfe={value:()=>{}};function Px(){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 kg(n)}function kg(e){this._=e}function Hfe(e,t){return e.trim().split(/^|\s+/).map(function(n){var r="",o=n.indexOf(".");if(o>=0&&(r=n.slice(o+1),n=n.slice(0,o)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}kg.prototype=Px.prototype={constructor:kg,on:function(e,t){var n=this._,r=Hfe(e+"",n),o,i=-1,s=r.length;if(arguments.length<2){for(;++i<s;)if((o=(e=r[i]).type)&&(o=Ufe(n[o],e.name)))return o;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++i<s;)if(o=(e=r[i]).type)n[o]=BA(n[o],e.name,t);else if(t==null)for(o in n)n[o]=BA(n[o],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new kg(e)},call:function(e,t){if((o=arguments.length-2)>0)for(var n=new Array(o),r=0,o,i;r<o;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(i=this._[e],r=0,o=i.length;r<o;++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],o=0,i=r.length;o<i;++o)r[o].value.apply(t,n)}};function Ufe(e,t){for(var n=0,r=e.length,o;n<r;++n)if((o=e[n]).name===t)return o.value}function BA(e,t,n){for(var r=0,o=e.length;r<o;++r)if(e[r].name===t){e[r]=Bfe,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var VS="http://www.w3.org/1999/xhtml";const HA={svg:"http://www.w3.org/2000/svg",xhtml:VS,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Ix(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),HA.hasOwnProperty(t)?{space:HA[t],local:e}:e}function qfe(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===VS&&t.documentElement.namespaceURI===VS?t.createElement(e):t.createElementNS(n,e)}}function Yfe(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function mF(e){var t=Ix(e);return(t.local?Yfe:qfe)(t)}function Zfe(){}function RC(e){return e==null?Zfe:function(){return this.querySelector(e)}}function Gfe(e){typeof e!="function"&&(e=RC(e));for(var t=this._groups,n=t.length,r=new Array(n),o=0;o<n;++o)for(var i=t[o],s=i.length,c=r[o]=new Array(s),d,u,p=0;p<s;++p)(d=i[p])&&(u=e.call(d,d.__data__,p,i))&&("__data__"in d&&(u.__data__=d.__data__),c[p]=u);return new Xo(r,this._parents)}function Kfe(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function Xfe(){return[]}function gF(e){return e==null?Xfe:function(){return this.querySelectorAll(e)}}function Qfe(e){return function(){return Kfe(e.apply(this,arguments))}}function Wfe(e){typeof e=="function"?e=Qfe(e):e=gF(e);for(var t=this._groups,n=t.length,r=[],o=[],i=0;i<n;++i)for(var s=t[i],c=s.length,d,u=0;u<c;++u)(d=s[u])&&(r.push(e.call(d,d.__data__,u,s)),o.push(d));return new Xo(r,o)}function yF(e){return function(){return this.matches(e)}}function xF(e){return function(t){return t.matches(e)}}var Jfe=Array.prototype.find;function ehe(e){return function(){return Jfe.call(this.children,e)}}function the(){return this.firstElementChild}function nhe(e){return this.select(e==null?the:ehe(typeof e=="function"?e:xF(e)))}var rhe=Array.prototype.filter;function ohe(){return Array.from(this.children)}function ihe(e){return function(){return rhe.call(this.children,e)}}function she(e){return this.selectAll(e==null?ohe:ihe(typeof e=="function"?e:xF(e)))}function ahe(e){typeof e!="function"&&(e=yF(e));for(var t=this._groups,n=t.length,r=new Array(n),o=0;o<n;++o)for(var i=t[o],s=i.length,c=r[o]=[],d,u=0;u<s;++u)(d=i[u])&&e.call(d,d.__data__,u,i)&&c.push(d);return new Xo(r,this._parents)}function vF(e){return new Array(e.length)}function lhe(){return new Xo(this._enter||this._groups.map(vF),this._parents)}function fy(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}fy.prototype={constructor:fy,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 che(e){return function(){return e}}function uhe(e,t,n,r,o,i){for(var s=0,c,d=t.length,u=i.length;s<u;++s)(c=t[s])?(c.__data__=i[s],r[s]=c):n[s]=new fy(e,i[s]);for(;s<d;++s)(c=t[s])&&(o[s]=c)}function dhe(e,t,n,r,o,i,s){var c,d,u=new Map,p=t.length,m=i.length,g=new Array(p),y;for(c=0;c<p;++c)(d=t[c])&&(g[c]=y=s.call(d,d.__data__,c,t)+"",u.has(y)?o[c]=d:u.set(y,d));for(c=0;c<m;++c)y=s.call(e,i[c],c,i)+"",(d=u.get(y))?(r[c]=d,d.__data__=i[c],u.delete(y)):n[c]=new fy(e,i[c]);for(c=0;c<p;++c)(d=t[c])&&u.get(g[c])===d&&(o[c]=d)}function fhe(e){return e.__data__}function hhe(e,t){if(!arguments.length)return Array.from(this,fhe);var n=t?dhe:uhe,r=this._parents,o=this._groups;typeof e!="function"&&(e=che(e));for(var i=o.length,s=new Array(i),c=new Array(i),d=new Array(i),u=0;u<i;++u){var p=r[u],m=o[u],g=m.length,y=phe(e.call(p,p&&p.__data__,u,r)),v=y.length,S=c[u]=new Array(v),w=s[u]=new Array(v),E=d[u]=new Array(g);n(p,m,S,w,E,y,t);for(var k=0,j=0,N,A;k<v;++k)if(N=S[k]){for(k>=j&&(j=k+1);!(A=w[j])&&++j<v;);N._next=A||null}}return s=new Xo(s,r),s._enter=c,s._exit=d,s}function phe(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function mhe(){return new Xo(this._exit||this._groups.map(vF),this._parents)}function ghe(e,t,n){var r=this.enter(),o=this,i=this.exit();return typeof e=="function"?(r=e(r),r&&(r=r.selection())):r=r.append(e+""),t!=null&&(o=t(o),o&&(o=o.selection())),n==null?i.remove():n(i),r&&o?r.merge(o).order():o}function yhe(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,o=n.length,i=r.length,s=Math.min(o,i),c=new Array(o),d=0;d<s;++d)for(var u=n[d],p=r[d],m=u.length,g=c[d]=new Array(m),y,v=0;v<m;++v)(y=u[v]||p[v])&&(g[v]=y);for(;d<o;++d)c[d]=n[d];return new Xo(c,this._parents)}function xhe(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r=e[t],o=r.length-1,i=r[o],s;--o>=0;)(s=r[o])&&(i&&s.compareDocumentPosition(i)^4&&i.parentNode.insertBefore(s,i),i=s);return this}function vhe(e){e||(e=bhe);function t(m,g){return m&&g?e(m.__data__,g.__data__):!m-!g}for(var n=this._groups,r=n.length,o=new Array(r),i=0;i<r;++i){for(var s=n[i],c=s.length,d=o[i]=new Array(c),u,p=0;p<c;++p)(u=s[p])&&(d[p]=u);d.sort(t)}return new Xo(o,this._parents).order()}function bhe(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function whe(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function She(){return Array.from(this)}function Ehe(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],o=0,i=r.length;o<i;++o){var s=r[o];if(s)return s}return null}function Che(){let e=0;for(const t of this)++e;return e}function khe(){return!this.node()}function jhe(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var o=t[n],i=0,s=o.length,c;i<s;++i)(c=o[i])&&e.call(c,c.__data__,i,o);return this}function Rhe(e){return function(){this.removeAttribute(e)}}function _he(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Nhe(e,t){return function(){this.setAttribute(e,t)}}function The(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function Mhe(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function Ahe(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 Ohe(e,t){var n=Ix(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?_he:Rhe:typeof t=="function"?n.local?Ahe:Mhe:n.local?The:Nhe)(n,t))}function bF(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function Dhe(e){return function(){this.style.removeProperty(e)}}function Phe(e,t,n){return function(){this.style.setProperty(e,t,n)}}function Ihe(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function zhe(e,t,n){return arguments.length>1?this.each((t==null?Dhe:typeof t=="function"?Ihe:Phe)(e,t,n??"")):Vu(this.node(),e)}function Vu(e,t){return e.style.getPropertyValue(t)||bF(e).getComputedStyle(e,null).getPropertyValue(t)}function Lhe(e){return function(){delete this[e]}}function Fhe(e,t){return function(){this[e]=t}}function $he(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function Vhe(e,t){return arguments.length>1?this.each((t==null?Lhe:typeof t=="function"?$he:Fhe)(e,t)):this.node()[e]}function wF(e){return e.trim().split(/^|\s+/)}function _C(e){return e.classList||new SF(e)}function SF(e){this._node=e,this._names=wF(e.getAttribute("class")||"")}SF.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 EF(e,t){for(var n=_C(e),r=-1,o=t.length;++r<o;)n.add(t[r])}function CF(e,t){for(var n=_C(e),r=-1,o=t.length;++r<o;)n.remove(t[r])}function Bhe(e){return function(){EF(this,e)}}function Hhe(e){return function(){CF(this,e)}}function Uhe(e,t){return function(){(t.apply(this,arguments)?EF:CF)(this,e)}}function qhe(e,t){var n=wF(e+"");if(arguments.length<2){for(var r=_C(this.node()),o=-1,i=n.length;++o<i;)if(!r.contains(n[o]))return!1;return!0}return this.each((typeof t=="function"?Uhe:t?Bhe:Hhe)(n,t))}function Yhe(){this.textContent=""}function Zhe(e){return function(){this.textContent=e}}function Ghe(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function Khe(e){return arguments.length?this.each(e==null?Yhe:(typeof e=="function"?Ghe:Zhe)(e)):this.node().textContent}function Xhe(){this.innerHTML=""}function Qhe(e){return function(){this.innerHTML=e}}function Whe(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function Jhe(e){return arguments.length?this.each(e==null?Xhe:(typeof e=="function"?Whe:Qhe)(e)):this.node().innerHTML}function epe(){this.nextSibling&&this.parentNode.appendChild(this)}function tpe(){return this.each(epe)}function npe(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function rpe(){return this.each(npe)}function ope(e){var t=typeof e=="function"?e:mF(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function ipe(){return null}function spe(e,t){var n=typeof e=="function"?e:mF(e),r=t==null?ipe:typeof t=="function"?t:RC(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function ape(){var e=this.parentNode;e&&e.removeChild(this)}function lpe(){return this.each(ape)}function cpe(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function upe(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function dpe(e){return this.select(e?upe:cpe)}function fpe(e){return arguments.length?this.property("__data__",e):this.node().__data__}function hpe(e){return function(t){e.call(this,t,this.__data__)}}function ppe(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 mpe(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,o=t.length,i;n<o;++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 gpe(e,t,n){return function(){var r=this.__on,o,i=hpe(t);if(r){for(var s=0,c=r.length;s<c;++s)if((o=r[s]).type===e.type&&o.name===e.name){this.removeEventListener(o.type,o.listener,o.options),this.addEventListener(o.type,o.listener=i,o.options=n),o.value=t;return}}this.addEventListener(e.type,i,n),o={type:e.type,name:e.name,value:t,listener:i,options:n},r?r.push(o):this.__on=[o]}}function ype(e,t,n){var r=ppe(e+""),o,i=r.length,s;if(arguments.length<2){var c=this.node().__on;if(c){for(var d=0,u=c.length,p;d<u;++d)for(o=0,p=c[d];o<i;++o)if((s=r[o]).type===p.type&&s.name===p.name)return p.value}return}for(c=t?gpe:mpe,o=0;o<i;++o)this.each(c(r[o],t,n));return this}function kF(e,t,n){var r=bF(e),o=r.CustomEvent;typeof o=="function"?o=new o(t,n):(o=r.document.createEvent("Event"),n?(o.initEvent(t,n.bubbles,n.cancelable),o.detail=n.detail):o.initEvent(t,!1,!1)),e.dispatchEvent(o)}function xpe(e,t){return function(){return kF(this,e,t)}}function vpe(e,t){return function(){return kF(this,e,t.apply(this,arguments))}}function bpe(e,t){return this.each((typeof t=="function"?vpe:xpe)(e,t))}function*wpe(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],o=0,i=r.length,s;o<i;++o)(s=r[o])&&(yield s)}var jF=[null];function Xo(e,t){this._groups=e,this._parents=t}function rp(){return new Xo([[document.documentElement]],jF)}function Spe(){return this}Xo.prototype=rp.prototype={constructor:Xo,select:Gfe,selectAll:Wfe,selectChild:nhe,selectChildren:she,filter:ahe,data:hhe,enter:lhe,exit:mhe,join:ghe,merge:yhe,selection:Spe,order:xhe,sort:vhe,call:whe,nodes:She,node:Ehe,size:Che,empty:khe,each:jhe,attr:Ohe,style:zhe,property:Vhe,classed:qhe,text:Khe,html:Jhe,raise:tpe,lower:rpe,append:ope,insert:spe,remove:lpe,clone:dpe,datum:fpe,on:ype,dispatch:bpe,[Symbol.iterator]:wpe};function Yo(e){return typeof e=="string"?new Xo([[document.querySelector(e)]],[document.documentElement]):new Xo([[e]],jF)}function Epe(e){let t;for(;t=e.sourceEvent;)e=t;return e}function Ti(e,t){if(e=Epe(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 o=t.getBoundingClientRect();return[e.clientX-o.left-t.clientLeft,e.clientY-o.top-t.clientTop]}}return[e.pageX,e.pageY]}const Cpe={passive:!1},uh={capture:!0,passive:!1};function nw(e){e.stopImmediatePropagation()}function Tu(e){e.preventDefault(),e.stopImmediatePropagation()}function RF(e){var t=e.document.documentElement,n=Yo(e).on("dragstart.drag",Tu,uh);"onselectstart"in t?n.on("selectstart.drag",Tu,uh):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function _F(e,t){var n=e.document.documentElement,r=Yo(e).on("dragstart.drag",null);t&&(r.on("click.drag",Tu,uh),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 tg=e=>()=>e;function BS(e,{sourceEvent:t,subject:n,target:r,identifier:o,active:i,x:s,y:c,dx:d,dy:u,dispatch:p}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:o,enumerable:!0,configurable:!0},active:{value:i,enumerable:!0,configurable:!0},x:{value:s,enumerable:!0,configurable:!0},y:{value:c,enumerable:!0,configurable:!0},dx:{value:d,enumerable:!0,configurable:!0},dy:{value:u,enumerable:!0,configurable:!0},_:{value:p}})}BS.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function kpe(e){return!e.ctrlKey&&!e.button}function jpe(){return this.parentNode}function Rpe(e,t){return t??{x:e.x,y:e.y}}function _pe(){return navigator.maxTouchPoints||"ontouchstart"in this}function NF(){var e=kpe,t=jpe,n=Rpe,r=_pe,o={},i=Px("start","drag","end"),s=0,c,d,u,p,m=0;function g(N){N.on("mousedown.drag",y).filter(r).on("touchstart.drag",w).on("touchmove.drag",E,Cpe).on("touchend.drag touchcancel.drag",k).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function y(N,A){if(!(p||!e.call(this,N,A))){var R=j(this,t.call(this,N,A),N,A,"mouse");R&&(Yo(N.view).on("mousemove.drag",v,uh).on("mouseup.drag",S,uh),RF(N.view),nw(N),u=!1,c=N.clientX,d=N.clientY,R("start",N))}}function v(N){if(Tu(N),!u){var A=N.clientX-c,R=N.clientY-d;u=A*A+R*R>m}o.mouse("drag",N)}function S(N){Yo(N.view).on("mousemove.drag mouseup.drag",null),_F(N.view,u),Tu(N),o.mouse("end",N)}function w(N,A){if(e.call(this,N,A)){var R=N.changedTouches,M=t.call(this,N,A),T=R.length,O,z;for(O=0;O<T;++O)(z=j(this,M,N,A,R[O].identifier,R[O]))&&(nw(N),z("start",N,R[O]))}}function E(N){var A=N.changedTouches,R=A.length,M,T;for(M=0;M<R;++M)(T=o[A[M].identifier])&&(Tu(N),T("drag",N,A[M]))}function k(N){var A=N.changedTouches,R=A.length,M,T;for(p&&clearTimeout(p),p=setTimeout(function(){p=null},500),M=0;M<R;++M)(T=o[A[M].identifier])&&(nw(N),T("end",N,A[M]))}function j(N,A,R,M,T,O){var z=i.copy(),q=Ti(O||R,A),$,G,L;if((L=n.call(N,new BS("beforestart",{sourceEvent:R,target:g,identifier:T,active:s,x:q[0],y:q[1],dx:0,dy:0,dispatch:z}),M))!=null)return $=L.x-q[0]||0,G=L.y-q[1]||0,function F(P,I,Y){var Z=q,D;switch(P){case"start":o[T]=F,D=s++;break;case"end":delete o[T],--s;case"drag":q=Ti(Y||I,A),D=s;break}z.call(P,N,new BS(P,{sourceEvent:I,subject:L,target:g,identifier:T,active:D,x:q[0]+$,y:q[1]+G,dx:q[0]-Z[0],dy:q[1]-Z[1],dispatch:z}),M)}}return g.filter=function(N){return arguments.length?(e=typeof N=="function"?N:tg(!!N),g):e},g.container=function(N){return arguments.length?(t=typeof N=="function"?N:tg(N),g):t},g.subject=function(N){return arguments.length?(n=typeof N=="function"?N:tg(N),g):n},g.touchable=function(N){return arguments.length?(r=typeof N=="function"?N:tg(!!N),g):r},g.on=function(){var N=i.on.apply(i,arguments);return N===i?g:N},g.clickDistance=function(N){return arguments.length?(m=(N=+N)*N,g):Math.sqrt(m)},g}function NC(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function TF(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function op(){}var dh=.7,hy=1/dh,Mu="\\s*([+-]?\\d+)\\s*",fh="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",us="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Npe=/^#([0-9a-f]{3,8})$/,Tpe=new RegExp(`^rgb\\(${Mu},${Mu},${Mu}\\)$`),Mpe=new RegExp(`^rgb\\(${us},${us},${us}\\)$`),Ape=new RegExp(`^rgba\\(${Mu},${Mu},${Mu},${fh}\\)$`),Ope=new RegExp(`^rgba\\(${us},${us},${us},${fh}\\)$`),Dpe=new RegExp(`^hsl\\(${fh},${us},${us}\\)$`),Ppe=new RegExp(`^hsla\\(${fh},${us},${us},${fh}\\)$`),UA={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};NC(op,sc,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:qA,formatHex:qA,formatHex8:Ipe,formatHsl:zpe,formatRgb:YA,toString:YA});function qA(){return this.rgb().formatHex()}function Ipe(){return this.rgb().formatHex8()}function zpe(){return MF(this).formatHsl()}function YA(){return this.rgb().formatRgb()}function sc(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=Npe.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?ZA(t):n===3?new Eo(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?ng(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?ng(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=Tpe.exec(e))?new Eo(t[1],t[2],t[3],1):(t=Mpe.exec(e))?new Eo(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Ape.exec(e))?ng(t[1],t[2],t[3],t[4]):(t=Ope.exec(e))?ng(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=Dpe.exec(e))?XA(t[1],t[2]/100,t[3]/100,1):(t=Ppe.exec(e))?XA(t[1],t[2]/100,t[3]/100,t[4]):UA.hasOwnProperty(e)?ZA(UA[e]):e==="transparent"?new Eo(NaN,NaN,NaN,0):null}function ZA(e){return new Eo(e>>16&255,e>>8&255,e&255,1)}function ng(e,t,n,r){return r<=0&&(e=t=n=NaN),new Eo(e,t,n,r)}function Lpe(e){return e instanceof op||(e=sc(e)),e?(e=e.rgb(),new Eo(e.r,e.g,e.b,e.opacity)):new Eo}function HS(e,t,n,r){return arguments.length===1?Lpe(e):new Eo(e,t,n,r??1)}function Eo(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}NC(Eo,HS,TF(op,{brighter(e){return e=e==null?hy:Math.pow(hy,e),new Eo(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?dh:Math.pow(dh,e),new Eo(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Eo(Yl(this.r),Yl(this.g),Yl(this.b),py(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:GA,formatHex:GA,formatHex8:Fpe,formatRgb:KA,toString:KA}));function GA(){return`#${Bl(this.r)}${Bl(this.g)}${Bl(this.b)}`}function Fpe(){return`#${Bl(this.r)}${Bl(this.g)}${Bl(this.b)}${Bl((isNaN(this.opacity)?1:this.opacity)*255)}`}function KA(){const e=py(this.opacity);return`${e===1?"rgb(":"rgba("}${Yl(this.r)}, ${Yl(this.g)}, ${Yl(this.b)}${e===1?")":`, ${e})`}`}function py(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Yl(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Bl(e){return e=Yl(e),(e<16?"0":"")+e.toString(16)}function XA(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Ai(e,t,n,r)}function MF(e){if(e instanceof Ai)return new Ai(e.h,e.s,e.l,e.opacity);if(e instanceof op||(e=sc(e)),!e)return new Ai;if(e instanceof Ai)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,o=Math.min(t,n,r),i=Math.max(t,n,r),s=NaN,c=i-o,d=(i+o)/2;return c?(t===i?s=(n-r)/c+(n<r)*6:n===i?s=(r-t)/c+2:s=(t-n)/c+4,c/=d<.5?i+o:2-i-o,s*=60):c=d>0&&d<1?0:s,new Ai(s,c,d,e.opacity)}function $pe(e,t,n,r){return arguments.length===1?MF(e):new Ai(e,t,n,r??1)}function Ai(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}NC(Ai,$pe,TF(op,{brighter(e){return e=e==null?hy:Math.pow(hy,e),new Ai(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?dh:Math.pow(dh,e),new Ai(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,o=2*n-r;return new Eo(rw(e>=240?e-240:e+120,o,r),rw(e,o,r),rw(e<120?e+240:e-120,o,r),this.opacity)},clamp(){return new Ai(QA(this.h),rg(this.s),rg(this.l),py(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=py(this.opacity);return`${e===1?"hsl(":"hsla("}${QA(this.h)}, ${rg(this.s)*100}%, ${rg(this.l)*100}%${e===1?")":`, ${e})`}`}}));function QA(e){return e=(e||0)%360,e<0?e+360:e}function rg(e){return Math.max(0,Math.min(1,e||0))}function rw(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 TC=e=>()=>e;function Vpe(e,t){return function(n){return e+n*t}}function Bpe(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 Hpe(e){return(e=+e)==1?AF:function(t,n){return n-t?Bpe(t,n,e):TC(isNaN(t)?n:t)}}function AF(e,t){var n=t-e;return n?Vpe(e,n):TC(isNaN(e)?t:e)}const my=(function e(t){var n=Hpe(t);function r(o,i){var s=n((o=HS(o)).r,(i=HS(i)).r),c=n(o.g,i.g),d=n(o.b,i.b),u=AF(o.opacity,i.opacity);return function(p){return o.r=s(p),o.g=c(p),o.b=d(p),o.opacity=u(p),o+""}}return r.gamma=e,r})(1);function Upe(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,r=t.slice(),o;return function(i){for(o=0;o<n;++o)r[o]=e[o]*(1-i)+t[o]*i;return r}}function qpe(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function Ype(e,t){var n=t?t.length:0,r=e?Math.min(n,e.length):0,o=new Array(r),i=new Array(n),s;for(s=0;s<r;++s)o[s]=qf(e[s],t[s]);for(;s<n;++s)i[s]=t[s];return function(c){for(s=0;s<r;++s)i[s]=o[s](c);return i}}function Zpe(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function os(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function Gpe(e,t){var n={},r={},o;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(o in t)o in e?n[o]=qf(e[o],t[o]):r[o]=t[o];return function(i){for(o in n)r[o]=n[o](i);return r}}var US=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,ow=new RegExp(US.source,"g");function Kpe(e){return function(){return e}}function Xpe(e){return function(t){return e(t)+""}}function OF(e,t){var n=US.lastIndex=ow.lastIndex=0,r,o,i,s=-1,c=[],d=[];for(e=e+"",t=t+"";(r=US.exec(e))&&(o=ow.exec(t));)(i=o.index)>n&&(i=t.slice(n,i),c[s]?c[s]+=i:c[++s]=i),(r=r[0])===(o=o[0])?c[s]?c[s]+=o:c[++s]=o:(c[++s]=null,d.push({i:s,x:os(r,o)})),n=ow.lastIndex;return n<t.length&&(i=t.slice(n),c[s]?c[s]+=i:c[++s]=i),c.length<2?d[0]?Xpe(d[0].x):Kpe(t):(t=d.length,function(u){for(var p=0,m;p<t;++p)c[(m=d[p]).i]=m.x(u);return c.join("")})}function qf(e,t){var n=typeof t,r;return t==null||n==="boolean"?TC(t):(n==="number"?os:n==="string"?(r=sc(t))?(t=r,my):OF:t instanceof sc?my:t instanceof Date?Zpe:qpe(t)?Upe:Array.isArray(t)?Ype:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?Gpe:os)(e,t)}var WA=180/Math.PI,qS={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function DF(e,t,n,r,o,i){var s,c,d;return(s=Math.sqrt(e*e+t*t))&&(e/=s,t/=s),(d=e*n+t*r)&&(n-=e*d,r-=t*d),(c=Math.sqrt(n*n+r*r))&&(n/=c,r/=c,d/=c),e*r<t*n&&(e=-e,t=-t,d=-d,s=-s),{translateX:o,translateY:i,rotate:Math.atan2(t,e)*WA,skewX:Math.atan(d)*WA,scaleX:s,scaleY:c}}var og;function Qpe(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?qS:DF(t.a,t.b,t.c,t.d,t.e,t.f)}function Wpe(e){return e==null||(og||(og=document.createElementNS("http://www.w3.org/2000/svg","g")),og.setAttribute("transform",e),!(e=og.transform.baseVal.consolidate()))?qS:(e=e.matrix,DF(e.a,e.b,e.c,e.d,e.e,e.f))}function PF(e,t,n,r){function o(u){return u.length?u.pop()+" ":""}function i(u,p,m,g,y,v){if(u!==m||p!==g){var S=y.push("translate(",null,t,null,n);v.push({i:S-4,x:os(u,m)},{i:S-2,x:os(p,g)})}else(m||g)&&y.push("translate("+m+t+g+n)}function s(u,p,m,g){u!==p?(u-p>180?p+=360:p-u>180&&(u+=360),g.push({i:m.push(o(m)+"rotate(",null,r)-2,x:os(u,p)})):p&&m.push(o(m)+"rotate("+p+r)}function c(u,p,m,g){u!==p?g.push({i:m.push(o(m)+"skewX(",null,r)-2,x:os(u,p)}):p&&m.push(o(m)+"skewX("+p+r)}function d(u,p,m,g,y,v){if(u!==m||p!==g){var S=y.push(o(y)+"scale(",null,",",null,")");v.push({i:S-4,x:os(u,m)},{i:S-2,x:os(p,g)})}else(m!==1||g!==1)&&y.push(o(y)+"scale("+m+","+g+")")}return function(u,p){var m=[],g=[];return u=e(u),p=e(p),i(u.translateX,u.translateY,p.translateX,p.translateY,m,g),s(u.rotate,p.rotate,m,g),c(u.skewX,p.skewX,m,g),d(u.scaleX,u.scaleY,p.scaleX,p.scaleY,m,g),u=p=null,function(y){for(var v=-1,S=g.length,w;++v<S;)m[(w=g[v]).i]=w.x(y);return m.join("")}}}var Jpe=PF(Qpe,"px, ","px)","deg)"),eme=PF(Wpe,", ",")",")"),tme=1e-12;function JA(e){return((e=Math.exp(e))+1/e)/2}function nme(e){return((e=Math.exp(e))-1/e)/2}function rme(e){return((e=Math.exp(2*e))-1)/(e+1)}const jg=(function e(t,n,r){function o(i,s){var c=i[0],d=i[1],u=i[2],p=s[0],m=s[1],g=s[2],y=p-c,v=m-d,S=y*y+v*v,w,E;if(S<tme)E=Math.log(g/u)/t,w=function(M){return[c+M*y,d+M*v,u*Math.exp(t*M*E)]};else{var k=Math.sqrt(S),j=(g*g-u*u+r*S)/(2*u*n*k),N=(g*g-u*u-r*S)/(2*g*n*k),A=Math.log(Math.sqrt(j*j+1)-j),R=Math.log(Math.sqrt(N*N+1)-N);E=(R-A)/t,w=function(M){var T=M*E,O=JA(A),z=u/(n*k)*(O*rme(t*T+A)-nme(A));return[c+z*y,d+z*v,u*O/JA(t*T+A)]}}return w.duration=E*1e3*t/Math.SQRT2,w}return o.rho=function(i){var s=Math.max(.001,+i),c=s*s,d=c*c;return e(s,c,d)},o})(Math.SQRT2,2,4);var Bu=0,Af=0,bf=0,IF=1e3,gy,Of,yy=0,ac=0,zx=0,hh=typeof performance=="object"&&performance.now?performance:Date,zF=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function MC(){return ac||(zF(ome),ac=hh.now()+zx)}function ome(){ac=0}function xy(){this._call=this._time=this._next=null}xy.prototype=LF.prototype={constructor:xy,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?MC():+n)+(t==null?0:+t),!this._next&&Of!==this&&(Of?Of._next=this:gy=this,Of=this),this._call=e,this._time=n,YS()},stop:function(){this._call&&(this._call=null,this._time=1/0,YS())}};function LF(e,t,n){var r=new xy;return r.restart(e,t,n),r}function ime(){MC(),++Bu;for(var e=gy,t;e;)(t=ac-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Bu}function eO(){ac=(yy=hh.now())+zx,Bu=Af=0;try{ime()}finally{Bu=0,ame(),ac=0}}function sme(){var e=hh.now(),t=e-yy;t>IF&&(zx-=t,yy=e)}function ame(){for(var e,t=gy,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:gy=n);Of=e,YS(r)}function YS(e){if(!Bu){Af&&(Af=clearTimeout(Af));var t=e-ac;t>24?(e<1/0&&(Af=setTimeout(eO,e-hh.now()-zx)),bf&&(bf=clearInterval(bf))):(bf||(yy=hh.now(),bf=setInterval(sme,IF)),Bu=1,zF(eO))}}function tO(e,t,n){var r=new xy;return t=t==null?0:+t,r.restart(o=>{r.stop(),e(o+t)},t,n),r}var lme=Px("start","end","cancel","interrupt"),cme=[],FF=0,nO=1,ZS=2,Rg=3,rO=4,GS=5,_g=6;function Lx(e,t,n,r,o,i){var s=e.__transition;if(!s)e.__transition={};else if(n in s)return;ume(e,n,{name:t,index:r,group:o,on:lme,tween:cme,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:FF})}function AC(e,t){var n=Bi(e,t);if(n.state>FF)throw new Error("too late; already scheduled");return n}function xs(e,t){var n=Bi(e,t);if(n.state>Rg)throw new Error("too late; already running");return n}function Bi(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function ume(e,t,n){var r=e.__transition,o;r[t]=n,n.timer=LF(i,0,n.time);function i(u){n.state=nO,n.timer.restart(s,n.delay,n.time),n.delay<=u&&s(u-n.delay)}function s(u){var p,m,g,y;if(n.state!==nO)return d();for(p in r)if(y=r[p],y.name===n.name){if(y.state===Rg)return tO(s);y.state===rO?(y.state=_g,y.timer.stop(),y.on.call("interrupt",e,e.__data__,y.index,y.group),delete r[p]):+p<t&&(y.state=_g,y.timer.stop(),y.on.call("cancel",e,e.__data__,y.index,y.group),delete r[p])}if(tO(function(){n.state===Rg&&(n.state=rO,n.timer.restart(c,n.delay,n.time),c(u))}),n.state=ZS,n.on.call("start",e,e.__data__,n.index,n.group),n.state===ZS){for(n.state=Rg,o=new Array(g=n.tween.length),p=0,m=-1;p<g;++p)(y=n.tween[p].value.call(e,e.__data__,n.index,n.group))&&(o[++m]=y);o.length=m+1}}function c(u){for(var p=u<n.duration?n.ease.call(null,u/n.duration):(n.timer.restart(d),n.state=GS,1),m=-1,g=o.length;++m<g;)o[m].call(e,p);n.state===GS&&(n.on.call("end",e,e.__data__,n.index,n.group),d())}function d(){n.state=_g,n.timer.stop(),delete r[t];for(var u in r)return;delete e.__transition}}function Ng(e,t){var n=e.__transition,r,o,i=!0,s;if(n){t=t==null?null:t+"";for(s in n){if((r=n[s]).name!==t){i=!1;continue}o=r.state>ZS&&r.state<GS,r.state=_g,r.timer.stop(),r.on.call(o?"interrupt":"cancel",e,e.__data__,r.index,r.group),delete n[s]}i&&delete e.__transition}}function dme(e){return this.each(function(){Ng(this,e)})}function fme(e,t){var n,r;return function(){var o=xs(this,e),i=o.tween;if(i!==n){r=n=i;for(var s=0,c=r.length;s<c;++s)if(r[s].name===t){r=r.slice(),r.splice(s,1);break}}o.tween=r}}function hme(e,t,n){var r,o;if(typeof n!="function")throw new Error;return function(){var i=xs(this,e),s=i.tween;if(s!==r){o=(r=s).slice();for(var c={name:t,value:n},d=0,u=o.length;d<u;++d)if(o[d].name===t){o[d]=c;break}d===u&&o.push(c)}i.tween=o}}function pme(e,t){var n=this._id;if(e+="",arguments.length<2){for(var r=Bi(this.node(),n).tween,o=0,i=r.length,s;o<i;++o)if((s=r[o]).name===e)return s.value;return null}return this.each((t==null?fme:hme)(n,e,t))}function OC(e,t,n){var r=e._id;return e.each(function(){var o=xs(this,r);(o.value||(o.value={}))[t]=n.apply(this,arguments)}),function(o){return Bi(o,r).value[t]}}function $F(e,t){var n;return(typeof t=="number"?os:t instanceof sc?my:(n=sc(t))?(t=n,my):OF)(e,t)}function mme(e){return function(){this.removeAttribute(e)}}function gme(e){return function(){this.removeAttributeNS(e.space,e.local)}}function yme(e,t,n){var r,o=n+"",i;return function(){var s=this.getAttribute(e);return s===o?null:s===r?i:i=t(r=s,n)}}function xme(e,t,n){var r,o=n+"",i;return function(){var s=this.getAttributeNS(e.space,e.local);return s===o?null:s===r?i:i=t(r=s,n)}}function vme(e,t,n){var r,o,i;return function(){var s,c=n(this),d;return c==null?void this.removeAttribute(e):(s=this.getAttribute(e),d=c+"",s===d?null:s===r&&d===o?i:(o=d,i=t(r=s,c)))}}function bme(e,t,n){var r,o,i;return function(){var s,c=n(this),d;return c==null?void this.removeAttributeNS(e.space,e.local):(s=this.getAttributeNS(e.space,e.local),d=c+"",s===d?null:s===r&&d===o?i:(o=d,i=t(r=s,c)))}}function wme(e,t){var n=Ix(e),r=n==="transform"?eme:$F;return this.attrTween(e,typeof t=="function"?(n.local?bme:vme)(n,r,OC(this,"attr."+e,t)):t==null?(n.local?gme:mme)(n):(n.local?xme:yme)(n,r,t))}function Sme(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function Eme(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function Cme(e,t){var n,r;function o(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&Eme(e,i)),n}return o._value=t,o}function kme(e,t){var n,r;function o(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&Sme(e,i)),n}return o._value=t,o}function jme(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=Ix(e);return this.tween(n,(r.local?Cme:kme)(r,t))}function Rme(e,t){return function(){AC(this,e).delay=+t.apply(this,arguments)}}function _me(e,t){return t=+t,function(){AC(this,e).delay=t}}function Nme(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Rme:_me)(t,e)):Bi(this.node(),t).delay}function Tme(e,t){return function(){xs(this,e).duration=+t.apply(this,arguments)}}function Mme(e,t){return t=+t,function(){xs(this,e).duration=t}}function Ame(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Tme:Mme)(t,e)):Bi(this.node(),t).duration}function Ome(e,t){if(typeof t!="function")throw new Error;return function(){xs(this,e).ease=t}}function Dme(e){var t=this._id;return arguments.length?this.each(Ome(t,e)):Bi(this.node(),t).ease}function Pme(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;xs(this,e).ease=n}}function Ime(e){if(typeof e!="function")throw new Error;return this.each(Pme(this._id,e))}function zme(e){typeof e!="function"&&(e=yF(e));for(var t=this._groups,n=t.length,r=new Array(n),o=0;o<n;++o)for(var i=t[o],s=i.length,c=r[o]=[],d,u=0;u<s;++u)(d=i[u])&&e.call(d,d.__data__,u,i)&&c.push(d);return new Ws(r,this._parents,this._name,this._id)}function Lme(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,r=t.length,o=n.length,i=Math.min(r,o),s=new Array(r),c=0;c<i;++c)for(var d=t[c],u=n[c],p=d.length,m=s[c]=new Array(p),g,y=0;y<p;++y)(g=d[y]||u[y])&&(m[y]=g);for(;c<r;++c)s[c]=t[c];return new Ws(s,this._parents,this._name,this._id)}function Fme(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 $me(e,t,n){var r,o,i=Fme(t)?AC:xs;return function(){var s=i(this,e),c=s.on;c!==r&&(o=(r=c).copy()).on(t,n),s.on=o}}function Vme(e,t){var n=this._id;return arguments.length<2?Bi(this.node(),n).on.on(e):this.each($me(n,e,t))}function Bme(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function Hme(){return this.on("end.remove",Bme(this._id))}function Ume(e){var t=this._name,n=this._id;typeof e!="function"&&(e=RC(e));for(var r=this._groups,o=r.length,i=new Array(o),s=0;s<o;++s)for(var c=r[s],d=c.length,u=i[s]=new Array(d),p,m,g=0;g<d;++g)(p=c[g])&&(m=e.call(p,p.__data__,g,c))&&("__data__"in p&&(m.__data__=p.__data__),u[g]=m,Lx(u[g],t,n,g,u,Bi(p,n)));return new Ws(i,this._parents,t,n)}function qme(e){var t=this._name,n=this._id;typeof e!="function"&&(e=gF(e));for(var r=this._groups,o=r.length,i=[],s=[],c=0;c<o;++c)for(var d=r[c],u=d.length,p,m=0;m<u;++m)if(p=d[m]){for(var g=e.call(p,p.__data__,m,d),y,v=Bi(p,n),S=0,w=g.length;S<w;++S)(y=g[S])&&Lx(y,t,n,S,g,v);i.push(g),s.push(p)}return new Ws(i,s,t,n)}var Yme=rp.prototype.constructor;function Zme(){return new Yme(this._groups,this._parents)}function Gme(e,t){var n,r,o;return function(){var i=Vu(this,e),s=(this.style.removeProperty(e),Vu(this,e));return i===s?null:i===n&&s===r?o:o=t(n=i,r=s)}}function VF(e){return function(){this.style.removeProperty(e)}}function Kme(e,t,n){var r,o=n+"",i;return function(){var s=Vu(this,e);return s===o?null:s===r?i:i=t(r=s,n)}}function Xme(e,t,n){var r,o,i;return function(){var s=Vu(this,e),c=n(this),d=c+"";return c==null&&(d=c=(this.style.removeProperty(e),Vu(this,e))),s===d?null:s===r&&d===o?i:(o=d,i=t(r=s,c))}}function Qme(e,t){var n,r,o,i="style."+t,s="end."+i,c;return function(){var d=xs(this,e),u=d.on,p=d.value[i]==null?c||(c=VF(t)):void 0;(u!==n||o!==p)&&(r=(n=u).copy()).on(s,o=p),d.on=r}}function Wme(e,t,n){var r=(e+="")=="transform"?Jpe:$F;return t==null?this.styleTween(e,Gme(e,r)).on("end.style."+e,VF(e)):typeof t=="function"?this.styleTween(e,Xme(e,r,OC(this,"style."+e,t))).each(Qme(this._id,e)):this.styleTween(e,Kme(e,r,t),n).on("end.style."+e,null)}function Jme(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function ege(e,t,n){var r,o;function i(){var s=t.apply(this,arguments);return s!==o&&(r=(o=s)&&Jme(e,s,n)),r}return i._value=t,i}function tge(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,ege(e,t,n??""))}function nge(e){return function(){this.textContent=e}}function rge(e){return function(){var t=e(this);this.textContent=t??""}}function oge(e){return this.tween("text",typeof e=="function"?rge(OC(this,"text",e)):nge(e==null?"":e+""))}function ige(e){return function(t){this.textContent=e.call(this,t)}}function sge(e){var t,n;function r(){var o=e.apply(this,arguments);return o!==n&&(t=(n=o)&&ige(o)),t}return r._value=e,r}function age(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,sge(e))}function lge(){for(var e=this._name,t=this._id,n=BF(),r=this._groups,o=r.length,i=0;i<o;++i)for(var s=r[i],c=s.length,d,u=0;u<c;++u)if(d=s[u]){var p=Bi(d,t);Lx(d,e,n,u,s,{time:p.time+p.delay+p.duration,delay:0,duration:p.duration,ease:p.ease})}return new Ws(r,this._parents,e,n)}function cge(){var e,t,n=this,r=n._id,o=n.size();return new Promise(function(i,s){var c={value:s},d={value:function(){--o===0&&i()}};n.each(function(){var u=xs(this,r),p=u.on;p!==e&&(t=(e=p).copy(),t._.cancel.push(c),t._.interrupt.push(c),t._.end.push(d)),u.on=t}),o===0&&i()})}var uge=0;function Ws(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function BF(){return++uge}var Fs=rp.prototype;Ws.prototype={constructor:Ws,select:Ume,selectAll:qme,selectChild:Fs.selectChild,selectChildren:Fs.selectChildren,filter:zme,merge:Lme,selection:Zme,transition:lge,call:Fs.call,nodes:Fs.nodes,node:Fs.node,size:Fs.size,empty:Fs.empty,each:Fs.each,on:Vme,attr:wme,attrTween:jme,style:Wme,styleTween:tge,text:oge,textTween:age,remove:Hme,tween:pme,delay:Nme,duration:Ame,ease:Dme,easeVarying:Ime,end:cge,[Symbol.iterator]:Fs[Symbol.iterator]};function dge(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var fge={time:null,delay:0,duration:250,ease:dge};function hge(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 pge(e){var t,n;e instanceof Ws?(t=e._id,e=e._name):(t=BF(),(n=fge).time=MC(),e=e==null?null:e+"");for(var r=this._groups,o=r.length,i=0;i<o;++i)for(var s=r[i],c=s.length,d,u=0;u<c;++u)(d=s[u])&&Lx(d,e,t,u,s,n||hge(d,t));return new Ws(r,this._parents,e,t)}rp.prototype.interrupt=dme;rp.prototype.transition=pge;const ig=e=>()=>e;function mge(e,{sourceEvent:t,target:n,transform:r,dispatch:o}){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:o}})}function Us(e,t,n){this.k=e,this.x=t,this.y=n}Us.prototype={constructor:Us,scale:function(e){return e===1?this:new Us(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Us(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 Fx=new Us(1,0,0);HF.prototype=Us.prototype;function HF(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Fx;return e.__zoom}function iw(e){e.stopImmediatePropagation()}function wf(e){e.preventDefault(),e.stopImmediatePropagation()}function gge(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function yge(){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 oO(){return this.__zoom||Fx}function xge(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function vge(){return navigator.maxTouchPoints||"ontouchstart"in this}function bge(e,t,n){var r=e.invertX(t[0][0])-n[0][0],o=e.invertX(t[1][0])-n[1][0],i=e.invertY(t[0][1])-n[0][1],s=e.invertY(t[1][1])-n[1][1];return e.translate(o>r?(r+o)/2:Math.min(0,r)||Math.max(0,o),s>i?(i+s)/2:Math.min(0,i)||Math.max(0,s))}function UF(){var e=gge,t=yge,n=bge,r=xge,o=vge,i=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],c=250,d=jg,u=Px("start","zoom","end"),p,m,g,y=500,v=150,S=0,w=10;function E(L){L.property("__zoom",oO).on("wheel.zoom",T,{passive:!1}).on("mousedown.zoom",O).on("dblclick.zoom",z).filter(o).on("touchstart.zoom",q).on("touchmove.zoom",$).on("touchend.zoom touchcancel.zoom",G).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}E.transform=function(L,F,P,I){var Y=L.selection?L.selection():L;Y.property("__zoom",oO),L!==Y?A(L,F,P,I):Y.interrupt().each(function(){R(this,arguments).event(I).start().zoom(null,typeof F=="function"?F.apply(this,arguments):F).end()})},E.scaleBy=function(L,F,P,I){E.scaleTo(L,function(){var Y=this.__zoom.k,Z=typeof F=="function"?F.apply(this,arguments):F;return Y*Z},P,I)},E.scaleTo=function(L,F,P,I){E.transform(L,function(){var Y=t.apply(this,arguments),Z=this.__zoom,D=P==null?N(Y):typeof P=="function"?P.apply(this,arguments):P,H=Z.invert(D),U=typeof F=="function"?F.apply(this,arguments):F;return n(j(k(Z,U),D,H),Y,s)},P,I)},E.translateBy=function(L,F,P,I){E.transform(L,function(){return n(this.__zoom.translate(typeof F=="function"?F.apply(this,arguments):F,typeof P=="function"?P.apply(this,arguments):P),t.apply(this,arguments),s)},null,I)},E.translateTo=function(L,F,P,I,Y){E.transform(L,function(){var Z=t.apply(this,arguments),D=this.__zoom,H=I==null?N(Z):typeof I=="function"?I.apply(this,arguments):I;return n(Fx.translate(H[0],H[1]).scale(D.k).translate(typeof F=="function"?-F.apply(this,arguments):-F,typeof P=="function"?-P.apply(this,arguments):-P),Z,s)},I,Y)};function k(L,F){return F=Math.max(i[0],Math.min(i[1],F)),F===L.k?L:new Us(F,L.x,L.y)}function j(L,F,P){var I=F[0]-P[0]*L.k,Y=F[1]-P[1]*L.k;return I===L.x&&Y===L.y?L:new Us(L.k,I,Y)}function N(L){return[(+L[0][0]+ +L[1][0])/2,(+L[0][1]+ +L[1][1])/2]}function A(L,F,P,I){L.on("start.zoom",function(){R(this,arguments).event(I).start()}).on("interrupt.zoom end.zoom",function(){R(this,arguments).event(I).end()}).tween("zoom",function(){var Y=this,Z=arguments,D=R(Y,Z).event(I),H=t.apply(Y,Z),U=P==null?N(H):typeof P=="function"?P.apply(Y,Z):P,B=Math.max(H[1][0]-H[0][0],H[1][1]-H[0][1]),X=Y.__zoom,J=typeof F=="function"?F.apply(Y,Z):F,Q=d(X.invert(U).concat(B/X.k),J.invert(U).concat(B/J.k));return function(oe){if(oe===1)oe=J;else{var W=Q(oe),ne=B/W[2];oe=new Us(ne,U[0]-W[0]*ne,U[1]-W[1]*ne)}D.zoom(null,oe)}})}function R(L,F,P){return!P&&L.__zooming||new M(L,F)}function M(L,F){this.that=L,this.args=F,this.active=0,this.sourceEvent=null,this.extent=t.apply(L,F),this.taps=0}M.prototype={event:function(L){return L&&(this.sourceEvent=L),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(L,F){return this.mouse&&L!=="mouse"&&(this.mouse[1]=F.invert(this.mouse[0])),this.touch0&&L!=="touch"&&(this.touch0[1]=F.invert(this.touch0[0])),this.touch1&&L!=="touch"&&(this.touch1[1]=F.invert(this.touch1[0])),this.that.__zoom=F,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(L){var F=Yo(this.that).datum();u.call(L,this.that,new mge(L,{sourceEvent:this.sourceEvent,target:E,transform:this.that.__zoom,dispatch:u}),F)}};function T(L,...F){if(!e.apply(this,arguments))return;var P=R(this,F).event(L),I=this.__zoom,Y=Math.max(i[0],Math.min(i[1],I.k*Math.pow(2,r.apply(this,arguments)))),Z=Ti(L);if(P.wheel)(P.mouse[0][0]!==Z[0]||P.mouse[0][1]!==Z[1])&&(P.mouse[1]=I.invert(P.mouse[0]=Z)),clearTimeout(P.wheel);else{if(I.k===Y)return;P.mouse=[Z,I.invert(Z)],Ng(this),P.start()}wf(L),P.wheel=setTimeout(D,v),P.zoom("mouse",n(j(k(I,Y),P.mouse[0],P.mouse[1]),P.extent,s));function D(){P.wheel=null,P.end()}}function O(L,...F){if(g||!e.apply(this,arguments))return;var P=L.currentTarget,I=R(this,F,!0).event(L),Y=Yo(L.view).on("mousemove.zoom",U,!0).on("mouseup.zoom",B,!0),Z=Ti(L,P),D=L.clientX,H=L.clientY;RF(L.view),iw(L),I.mouse=[Z,this.__zoom.invert(Z)],Ng(this),I.start();function U(X){if(wf(X),!I.moved){var J=X.clientX-D,Q=X.clientY-H;I.moved=J*J+Q*Q>S}I.event(X).zoom("mouse",n(j(I.that.__zoom,I.mouse[0]=Ti(X,P),I.mouse[1]),I.extent,s))}function B(X){Y.on("mousemove.zoom mouseup.zoom",null),_F(X.view,I.moved),wf(X),I.event(X).end()}}function z(L,...F){if(e.apply(this,arguments)){var P=this.__zoom,I=Ti(L.changedTouches?L.changedTouches[0]:L,this),Y=P.invert(I),Z=P.k*(L.shiftKey?.5:2),D=n(j(k(P,Z),I,Y),t.apply(this,F),s);wf(L),c>0?Yo(this).transition().duration(c).call(A,D,I,L):Yo(this).call(E.transform,D,I,L)}}function q(L,...F){if(e.apply(this,arguments)){var P=L.touches,I=P.length,Y=R(this,F,L.changedTouches.length===I).event(L),Z,D,H,U;for(iw(L),D=0;D<I;++D)H=P[D],U=Ti(H,this),U=[U,this.__zoom.invert(U),H.identifier],Y.touch0?!Y.touch1&&Y.touch0[2]!==U[2]&&(Y.touch1=U,Y.taps=0):(Y.touch0=U,Z=!0,Y.taps=1+!!p);p&&(p=clearTimeout(p)),Z&&(Y.taps<2&&(m=U[0],p=setTimeout(function(){p=null},y)),Ng(this),Y.start())}}function $(L,...F){if(this.__zooming){var P=R(this,F).event(L),I=L.changedTouches,Y=I.length,Z,D,H,U;for(wf(L),Z=0;Z<Y;++Z)D=I[Z],H=Ti(D,this),P.touch0&&P.touch0[2]===D.identifier?P.touch0[0]=H:P.touch1&&P.touch1[2]===D.identifier&&(P.touch1[0]=H);if(D=P.that.__zoom,P.touch1){var B=P.touch0[0],X=P.touch0[1],J=P.touch1[0],Q=P.touch1[1],oe=(oe=J[0]-B[0])*oe+(oe=J[1]-B[1])*oe,W=(W=Q[0]-X[0])*W+(W=Q[1]-X[1])*W;D=k(D,Math.sqrt(oe/W)),H=[(B[0]+J[0])/2,(B[1]+J[1])/2],U=[(X[0]+Q[0])/2,(X[1]+Q[1])/2]}else if(P.touch0)H=P.touch0[0],U=P.touch0[1];else return;P.zoom("touch",n(j(D,H,U),P.extent,s))}}function G(L,...F){if(this.__zooming){var P=R(this,F).event(L),I=L.changedTouches,Y=I.length,Z,D;for(iw(L),g&&clearTimeout(g),g=setTimeout(function(){g=null},y),Z=0;Z<Y;++Z)D=I[Z],P.touch0&&P.touch0[2]===D.identifier?delete P.touch0:P.touch1&&P.touch1[2]===D.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&&(D=Ti(D,this),Math.hypot(m[0]-D[0],m[1]-D[1])<w)){var H=Yo(this).on("dblclick.zoom");H&&H.apply(this,arguments)}}}return E.wheelDelta=function(L){return arguments.length?(r=typeof L=="function"?L:ig(+L),E):r},E.filter=function(L){return arguments.length?(e=typeof L=="function"?L:ig(!!L),E):e},E.touchable=function(L){return arguments.length?(o=typeof L=="function"?L:ig(!!L),E):o},E.extent=function(L){return arguments.length?(t=typeof L=="function"?L:ig([[+L[0][0],+L[0][1]],[+L[1][0],+L[1][1]]]),E):t},E.scaleExtent=function(L){return arguments.length?(i[0]=+L[0],i[1]=+L[1],E):[i[0],i[1]]},E.translateExtent=function(L){return arguments.length?(s[0][0]=+L[0][0],s[1][0]=+L[1][0],s[0][1]=+L[0][1],s[1][1]=+L[1][1],E):[[s[0][0],s[0][1]],[s[1][0],s[1][1]]]},E.constrain=function(L){return arguments.length?(n=L,E):n},E.duration=function(L){return arguments.length?(c=+L,E):c},E.interpolate=function(L){return arguments.length?(d=L,E):d},E.on=function(){var L=u.on.apply(u,arguments);return L===u?E:L},E.clickDistance=function(L){return arguments.length?(S=(L=+L)*L,E):Math.sqrt(S)},E.tapDistance=function(L){return arguments.length?(w=+L,E):w},E}const Fi={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.`},ph=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],qF=["Enter"," ","Escape"],YF={"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 Hu;(function(e){e.Strict="strict",e.Loose="loose"})(Hu||(Hu={}));var Zl;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Zl||(Zl={}));var mh;(function(e){e.Partial="partial",e.Full="full"})(mh||(mh={}));const ZF={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var Ua;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Ua||(Ua={}));var gh;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(gh||(gh={}));var pt;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(pt||(pt={}));const iO={[pt.Left]:pt.Right,[pt.Right]:pt.Left,[pt.Top]:pt.Bottom,[pt.Bottom]:pt.Top};function GF(e){return e===null?null:e?"valid":"invalid"}const KF=e=>!!e&&typeof e=="object"&&"id"in e&&"source"in e&&"target"in e,wge=e=>!!e&&typeof e=="object"&&"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),DC=e=>!!e&&typeof e=="object"&&"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),ip=(e,t=[0,0])=>{const{width:n,height:r}=Hi(e),o=e.origin??t,i=n*o[0],s=r*o[1];return{x:e.position.x-i,y:e.position.y-s}},Sge=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};let n=!1;const r=e.reduce((o,i)=>{const s=typeof i=="string";let c=!t.nodeLookup&&!s?i:void 0;return t.nodeLookup&&(c=s?t.nodeLookup.get(i):DC(i)?i:t.nodeLookup.get(i.id)),c?(n=!0,$x(o,vy(c,t.nodeOrigin))):o},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return n?Vx(r):{x:0,y:0,width:0,height:0}},sp=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},r=!1;return e.forEach(o=>{(t.filter===void 0||t.filter(o))&&(n=$x(n,vy(o)),r=!0)}),r?Vx(n):{x:0,y:0,width:0,height:0}},PC=(e,t,[n,r,o]=[0,0,1],i=!1,s=!1)=>{const c=(t.x-n)/o,d=(t.y-r)/o,u=t.width/o,p=t.height/o,m=[];for(const g of e.values()){const{measured:y,selectable:v=!0,hidden:S=!1}=g;if(s&&!v||S)continue;const w=y.width??g.width??g.initialWidth??0,E=y.height??g.height??g.initialHeight??0,{x:k,y:j}=g.internals.positionAbsolute,N=JF(c,d,u,p,k,j,w,E),A=w*E,R=i&&N>0;(!g.internals.handleBounds||R||N>=A||g.dragging)&&m.push(g)}return m},Ege=(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 Cge(e,t){const n=new Map,r=t?.nodes?new Set(t.nodes.map(o=>o.id)):null;return e.forEach(o=>{let i;if(t?.includeHiddenNodes){const{width:s,height:c}=Hi(o);i=s>0&&c>0}else i=!!(o.measured.width&&o.measured.height&&!o.hidden);i&&(!r||r.has(o.id))&&n.set(o.id,o)}),n}async function kge({nodes:e,width:t,height:n,panZoom:r,minZoom:o,maxZoom:i},s){if(e.size===0)return!0;const c=Cge(e,s),d=sp(c),u=zC(d,t,n,s?.minZoom??o,s?.maxZoom??i,s?.padding??.1);return await r.setViewport(u,{duration:s?.duration,ease:s?.ease,interpolate:s?.interpolate}),!0}function XF({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:r=[0,0],nodeExtent:o,onError:i}){const s=n.get(e),c=s.parentId?n.get(s.parentId):void 0,{x:d,y:u}=c?c.internals.positionAbsolute:{x:0,y:0},p=s.origin??r;let m=s.extent||o;if(s.extent==="parent"&&!s.expandParent)if(!c)i?.("005",Fi.error005());else{const{width:y,height:v}=Hi(c);y&&v&&(m=[[d,u],[d+y,u+v]])}else c&&cc(s.extent)&&(m=[[s.extent[0][0]+d,s.extent[0][1]+u],[s.extent[1][0]+d,s.extent[1][1]+u]]);const g=cc(m)?lc(t,m,s.measured):t;return(s.measured.width===void 0||s.measured.height===void 0)&&i?.("015",Fi.error015()),{position:{x:g.x-d+(s.measured.width??0)*p[0],y:g.y-u+(s.measured.height??0)*p[1]},positionAbsolute:g}}async function jge({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:r,onBeforeDelete:o}){const i=new Set(e.map(g=>g.id)),s=[];for(const g of n){if(g.deletable===!1)continue;const y=i.has(g.id),v=!y&&g.parentId&&s.find(S=>S.id===g.parentId);(y||v)&&s.push(g)}const c=new Set(t.map(g=>g.id)),d=r.filter(g=>g.deletable!==!1),p=Ege(s,d);for(const g of d)c.has(g.id)&&!p.find(v=>v.id===g.id)&&p.push(g);if(!o)return{edges:p,nodes:s};const m=await o({nodes:s,edges:p});return typeof m=="boolean"?m?{edges:p,nodes:s}:{edges:[],nodes:[]}:m}const Uu=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),lc=(e={x:0,y:0},t,n)=>({x:Uu(e.x,t[0][0],t[1][0]-(n?.width??0)),y:Uu(e.y,t[0][1],t[1][1]-(n?.height??0))});function QF(e,t,n){const{width:r,height:o}=Hi(n),{x:i,y:s}=n.internals.positionAbsolute;return lc(e,[[i,s],[i+r,s+o]],t)}const sO=(e,t,n)=>e<t?Uu(Math.abs(e-t),1,t)/t:e>n?-Uu(Math.abs(e-n),1,t)/t:0,IC=(e,t,n=15,r=40)=>{const o=sO(e.x,r,t.width-r)*n,i=sO(e.y,r,t.height-r)*n;return[o,i]},$x=(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)}),KS=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),Vx=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),yh=(e,t=[0,0])=>{const{x:n,y:r}=DC(e)?e.internals.positionAbsolute:ip(e,t);return{x:n,y:r,width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}},vy=(e,t=[0,0])=>{const{x:n,y:r}=DC(e)?e.internals.positionAbsolute:ip(e,t);return{x:n,y:r,x2:n+(e.measured?.width??e.width??e.initialWidth??0),y2:r+(e.measured?.height??e.height??e.initialHeight??0)}},WF=(e,t)=>Vx($x(KS(e),KS(t))),JF=(e,t,n,r,o,i,s,c)=>{const d=Math.max(0,Math.min(e+n,o+s)-Math.max(e,o)),u=Math.max(0,Math.min(t+r,i+c)-Math.max(t,i));return Math.ceil(d*u)},by=(e,t)=>JF(e.x,e.y,e.width,e.height,t.x,t.y,t.width,t.height),aO=e=>Di(e.width)&&Di(e.height)&&Di(e.x)&&Di(e.y),Di=e=>!isNaN(e)&&isFinite(e),e3=(e,t)=>(n,r)=>{},ap=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),lp=({x:e,y:t},[n,r,o],i=!1,s=[1,1])=>{const c={x:(e-n)/o,y:(t-r)/o};return i?ap(c,s):c},qu=({x:e,y:t},[n,r,o])=>({x:e*o+n,y:t*o+r});function lu(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 Rge(e,t,n){if(typeof e=="string"||typeof e=="number"){const r=lu(e,n),o=lu(e,t);return{top:r,right:o,bottom:r,left:o,x:o*2,y:r*2}}if(typeof e=="object"){const r=lu(e.top??e.y??0,n),o=lu(e.bottom??e.y??0,n),i=lu(e.left??e.x??0,t),s=lu(e.right??e.x??0,t);return{top:r,right:s,bottom:o,left:i,x:i+s,y:r+o}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function _ge(e,t,n,r,o,i){const{x:s,y:c}=qu(e,[t,n,r]),{x:d,y:u}=qu({x:e.x+e.width,y:e.y+e.height},[t,n,r]),p=o-d,m=i-u;return{left:Math.floor(s),top:Math.floor(c),right:Math.floor(p),bottom:Math.floor(m)}}const zC=(e,t,n,r,o,i)=>{const s=Rge(i,t,n),c=(t-s.x)/e.width,d=(n-s.y)/e.height,u=Math.min(c,d),p=Uu(u,r,o),m=e.x+e.width/2,g=e.y+e.height/2,y=t/2-m*p,v=n/2-g*p,S=_ge(e,y,v,p,t,n),w={left:Math.min(S.left-s.left,0),top:Math.min(S.top-s.top,0),right:Math.min(S.right-s.right,0),bottom:Math.min(S.bottom-s.bottom,0)};return{x:y-w.left+w.right,y:v-w.top+w.bottom,zoom:p}},xh=()=>typeof navigator<"u"&&navigator?.userAgent?.indexOf("Mac")>=0;function cc(e){return e!=null&&e!=="parent"}function Hi(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function t3(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function n3(e,t={width:0,height:0},n,r,o){const i={...e},s=r.get(n);if(s){const c=s.origin||o;i.x+=s.internals.positionAbsolute.x-(t.width??0)*c[0],i.y+=s.internals.positionAbsolute.y-(t.height??0)*c[1]}return i}function lO(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function Nge(){let e,t;return{promise:new Promise((r,o)=>{e=r,t=o}),resolve:e,reject:t}}function Tge(e){return{...YF,...e||{}}}function Yf(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:o}){const{x:i,y:s}=Pi(e),c=lp({x:i-(o?.left??0),y:s-(o?.top??0)},r),{x:d,y:u}=n?ap(c,t):c;return{xSnapped:d,ySnapped:u,...c}}const LC=e=>({width:e.offsetWidth,height:e.offsetHeight}),r3=e=>e?.getRootNode?.()||window?.document,Mge=["INPUT","SELECT","TEXTAREA"];function o3(e){const t=e.composedPath?.()?.[0]||e.target;return t?.nodeType!==1?!1:Mge.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const i3=e=>"clientX"in e,Pi=(e,t)=>{const n=i3(e),r=n?e.clientX:e.touches?.[0].clientX,o=n?e.clientY:e.touches?.[0].clientY;return{x:r-(t?.left??0),y:o-(t?.top??0)}},cO=(e,t,n,r,o)=>{const i=t.querySelectorAll(`.${e}`);return!i||!i.length?null:Array.from(i).map(s=>{const c=s.getBoundingClientRect();return{id:s.getAttribute("data-handleid"),type:e,nodeId:o,position:s.getAttribute("data-handlepos"),x:(c.left-n.left)/r,y:(c.top-n.top)/r,...LC(s)}})};function s3({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:o,sourceControlY:i,targetControlX:s,targetControlY:c}){const d=e*.125+o*.375+s*.375+n*.125,u=t*.125+i*.375+c*.375+r*.125,p=Math.abs(d-e),m=Math.abs(u-t);return[d,u,p,m]}function sg(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function uO({pos:e,x1:t,y1:n,x2:r,y2:o,c:i}){switch(e){case pt.Left:return[t-sg(t-r,i),n];case pt.Right:return[t+sg(r-t,i),n];case pt.Top:return[t,n-sg(n-o,i)];case pt.Bottom:return[t,n+sg(o-n,i)]}}function a3({sourceX:e,sourceY:t,sourcePosition:n=pt.Bottom,targetX:r,targetY:o,targetPosition:i=pt.Top,curvature:s=.25}){const[c,d]=uO({pos:n,x1:e,y1:t,x2:r,y2:o,c:s}),[u,p]=uO({pos:i,x1:r,y1:o,x2:e,y2:t,c:s}),[m,g,y,v]=s3({sourceX:e,sourceY:t,targetX:r,targetY:o,sourceControlX:c,sourceControlY:d,targetControlX:u,targetControlY:p});return[`M${e},${t} C${c},${d} ${u},${p} ${r},${o}`,m,g,y,v]}function l3({sourceX:e,sourceY:t,targetX:n,targetY:r}){const o=Math.abs(n-e)/2,i=n<e?n+o:n-o,s=Math.abs(r-t)/2,c=r<t?r+s:r-s;return[i,c,o,s]}function Age({sourceNode:e,targetNode:t,selected:n=!1,zIndex:r=0,elevateOnSelect:o=!1,zIndexMode:i="basic"}){if(i==="manual")return r;const s=o&&n?r+1e3:r,c=Math.max(e.parentId||o&&e.selected?e.internals.z:0,t.parentId||o&&t.selected?t.internals.z:0);return s+c}function Oge({sourceNode:e,targetNode:t,width:n,height:r,transform:o}){const i=$x(vy(e),vy(t));i.x===i.x2&&(i.x2+=1),i.y===i.y2&&(i.y2+=1);const s={x:-o[0]/o[2],y:-o[1]/o[2],width:n/o[2],height:r/o[2]};return by(s,Vx(i))>0}const Dge=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||""}-${n}${r||""}`,Pge=(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)),Ige=(e,t,n={})=>{if(!e.source||!e.target)return n.onError?.("006",Fi.error006()),t;const r=n.getEdgeId||Dge;let o;return KF(e)?o={...e}:o={...e,id:r(e)},Pge(o,t)?t:(o.sourceHandle===null&&delete o.sourceHandle,o.targetHandle===null&&delete o.targetHandle,t.concat(o))};function c3({sourceX:e,sourceY:t,targetX:n,targetY:r}){const[o,i,s,c]=l3({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,o,i,s,c]}const dO={[pt.Left]:{x:-1,y:0},[pt.Right]:{x:1,y:0},[pt.Top]:{x:0,y:-1},[pt.Bottom]:{x:0,y:1}},zge=({source:e,sourcePosition:t=pt.Bottom,target:n})=>t===pt.Left||t===pt.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},fO=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function Lge({source:e,sourcePosition:t=pt.Bottom,target:n,targetPosition:r=pt.Top,center:o,offset:i,stepPosition:s}){const c=dO[t],d=dO[r],u={x:e.x+c.x*i,y:e.y+c.y*i},p={x:n.x+d.x*i,y:n.y+d.y*i},m=zge({source:u,sourcePosition:t,target:p}),g=m.x!==0?"x":"y",y=m[g];let v=[],S,w;const E={x:0,y:0},k={x:0,y:0},[,,j,N]=l3({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(c[g]*d[g]===-1){g==="x"?(S=o.x??u.x+(p.x-u.x)*s,w=o.y??(u.y+p.y)/2):(S=o.x??(u.x+p.x)/2,w=o.y??u.y+(p.y-u.y)*s);const T=[{x:S,y:u.y},{x:S,y:p.y}],O=[{x:u.x,y:w},{x:p.x,y:w}];c[g]===y?v=g==="x"?T:O:v=g==="x"?O:T}else{const T=[{x:u.x,y:p.y}],O=[{x:p.x,y:u.y}];if(g==="x"?v=c.x===y?O:T:v=c.y===y?T:O,t===r){const L=Math.abs(e[g]-n[g]);if(L<=i){const F=Math.min(i-1,i-L);c[g]===y?E[g]=(u[g]>e[g]?-1:1)*F:k[g]=(p[g]>n[g]?-1:1)*F}}if(t!==r){const L=g==="x"?"y":"x",F=c[g]===d[L],P=u[L]>p[L],I=u[L]<p[L];(c[g]===1&&(!F&&P||F&&I)||c[g]!==1&&(!F&&I||F&&P))&&(v=g==="x"?T:O)}const z={x:u.x+E.x,y:u.y+E.y},q={x:p.x+k.x,y:p.y+k.y},$=Math.max(Math.abs(z.x-v[0].x),Math.abs(q.x-v[0].x)),G=Math.max(Math.abs(z.y-v[0].y),Math.abs(q.y-v[0].y));$>=G?(S=(z.x+q.x)/2,w=v[0].y):(S=v[0].x,w=(z.y+q.y)/2)}const A={x:u.x+E.x,y:u.y+E.y},R={x:p.x+k.x,y:p.y+k.y};return[[e,...A.x!==v[0].x||A.y!==v[0].y?[A]:[],...v,...R.x!==v[v.length-1].x||R.y!==v[v.length-1].y?[R]:[],n],S,w,j,N]}function Fge(e,t,n,r){const o=Math.min(fO(e,t)/2,fO(t,n)/2,r),{x:i,y:s}=t;if(e.x===i&&i===n.x||e.y===s&&s===n.y)return`L${i} ${s}`;if(e.y===s){const u=e.x<n.x?-1:1,p=e.y<n.y?1:-1;return`L ${i+o*u},${s}Q ${i},${s} ${i},${s+o*p}`}const c=e.x<n.x?1:-1,d=e.y<n.y?-1:1;return`L ${i},${s+o*d}Q ${i},${s} ${i+o*c},${s}`}function wy({sourceX:e,sourceY:t,sourcePosition:n=pt.Bottom,targetX:r,targetY:o,targetPosition:i=pt.Top,borderRadius:s=5,centerX:c,centerY:d,offset:u=20,stepPosition:p=.5}){const[m,g,y,v,S]=Lge({source:{x:e,y:t},sourcePosition:n,target:{x:r,y:o},targetPosition:i,center:{x:c,y:d},offset:u,stepPosition:p});let w=`M${m[0].x} ${m[0].y}`;for(let E=1;E<m.length-1;E++)w+=Fge(m[E-1],m[E],m[E+1],s);return w+=`L${m[m.length-1].x} ${m[m.length-1].y}`,[w,g,y,v,S]}function hO(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function $ge(e){const{sourceNode:t,targetNode:n}=e;if(!hO(t)||!hO(n))return null;const r=t.internals.handleBounds||pO(t.handles),o=n.internals.handleBounds||pO(n.handles),i=mO(r?.source??[],e.sourceHandle),s=mO(e.connectionMode===Hu.Strict?o?.target??[]:(o?.target??[]).concat(o?.source??[]),e.targetHandle);if(!i||!s)return e.onError?.("008",Fi.error008(i?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const c=i?.position||pt.Bottom,d=s?.position||pt.Top,u=uc(t,i,c),p=uc(n,s,d);return{sourceX:u.x,sourceY:u.y,targetX:p.x,targetY:p.y,sourcePosition:c,targetPosition:d}}function pO(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 uc(e,t,n=pt.Left,r=!1){const o=(t?.x??0)+e.internals.positionAbsolute.x,i=(t?.y??0)+e.internals.positionAbsolute.y,{width:s,height:c}=t??Hi(e);if(r)return{x:o+s/2,y:i+c/2};switch(t?.position??n){case pt.Top:return{x:o+s/2,y:i};case pt.Right:return{x:o+s,y:i+c/2};case pt.Bottom:return{x:o+s/2,y:i+c};case pt.Left:return{x:o,y:i+c/2}}}function mO(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function XS(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`:""}function Vge(e,{id:t,defaultColor:n,defaultMarkerStart:r,defaultMarkerEnd:o}){const i=new Set;return e.reduce((s,c)=>([c.markerStart||r,c.markerEnd||o].forEach(d=>{if(d&&typeof d=="object"){const u=XS(d,t);i.has(u)||(s.push({id:u,color:d.color||n,...d}),i.add(u))}}),s),[]).sort((s,c)=>s.id.localeCompare(c.id))}const u3=1e3,Bge=10,FC={nodeOrigin:[0,0],nodeExtent:ph,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},Hge={...FC,checkEquality:!0};function $C(e,t){const n={...e};for(const r in t)t[r]!==void 0&&(n[r]=t[r]);return n}function Uge(e,t,n){const r=$C(FC,n);for(const o of e.values())if(o.parentId)BC(o,e,t,r);else{const i=ip(o,r.nodeOrigin),s=cc(o.extent)?o.extent:r.nodeExtent,c=lc(i,s,Hi(o));o.internals.positionAbsolute=c}}function qge(e,t){if(!e.handles)return e.measured?t?.internals.handleBounds:void 0;const n=[],r=[];for(const o of e.handles){const i={id:o.id,width:o.width??1,height:o.height??1,nodeId:e.id,x:o.x,y:o.y,position:o.position,type:o.type};o.type==="source"?n.push(i):o.type==="target"&&r.push(i)}return{source:n,target:r}}function VC(e){return e==="manual"}function QS(e,t,n,r={}){const o=$C(Hge,r),i={i:0},s=new Map(t),c=o?.elevateNodesOnSelect&&!VC(o.zIndexMode)?u3:0;let d=e.length>0,u=!1;t.clear(),n.clear();for(const p of e){let m=s.get(p.id);if(o.checkEquality&&p===m?.internals.userNode)t.set(p.id,m);else{const g=ip(p,o.nodeOrigin),y=cc(p.extent)?p.extent:o.nodeExtent,v=lc(g,y,Hi(p));m={...o.defaults,...p,measured:{width:p.measured?.width,height:p.measured?.height},internals:{positionAbsolute:v,handleBounds:qge(p,m),z:d3(p,c,o.zIndexMode),userNode:p}},t.set(p.id,m)}(m.measured===void 0||m.measured.width===void 0||m.measured.height===void 0)&&!m.hidden&&(d=!1),p.parentId&&BC(m,t,n,r,i),u||=p.selected??!1}return{nodesInitialized:d,hasSelectedNodes:u}}function Yge(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 BC(e,t,n,r,o){const{elevateNodesOnSelect:i,nodeOrigin:s,nodeExtent:c,zIndexMode:d}=$C(FC,r),u=e.parentId,p=t.get(u);if(!p){console.warn(`Parent node ${u} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}Yge(e,n),o&&!p.parentId&&p.internals.rootParentIndex===void 0&&d==="auto"&&(p.internals.rootParentIndex=++o.i,p.internals.z=p.internals.z+o.i*Bge),o&&p.internals.rootParentIndex!==void 0&&(o.i=p.internals.rootParentIndex);const m=i&&!VC(d)?u3:0,{x:g,y,z:v}=Zge(e,p,s,c,m,d),{positionAbsolute:S}=e.internals,w=g!==S.x||y!==S.y;(w||v!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:w?{x:g,y}:S,z:v}})}function d3(e,t,n){const r=Di(e.zIndex)?e.zIndex:0;return VC(n)?r:r+(e.selected?t:0)}function Zge(e,t,n,r,o,i){const{x:s,y:c}=t.internals.positionAbsolute,d=Hi(e),u=ip(e,n),p=cc(e.extent)?lc(u,e.extent,d):u;let m=lc({x:s+p.x,y:c+p.y},r,d);e.extent==="parent"&&(m=QF(m,d,t));const g=d3(e,o,i),y=t.internals.z??0;return{x:m.x,y:m.y,z:y>=g?y+1:g}}function HC(e,t,n,r=[0,0]){const o=[],i=new Map;for(const s of e){const c=t.get(s.parentId);if(!c)continue;const d=i.get(s.parentId)?.expandedRect??yh(c),u=WF(d,s.rect);i.set(s.parentId,{expandedRect:u,parent:c})}return i.size>0&&i.forEach(({expandedRect:s,parent:c},d)=>{const u=c.internals.positionAbsolute,p=Hi(c),m=c.origin??r,g=s.x<u.x?Math.round(Math.abs(u.x-s.x)):0,y=s.y<u.y?Math.round(Math.abs(u.y-s.y)):0,v=Math.max(p.width,Math.round(s.width)),S=Math.max(p.height,Math.round(s.height)),w=(v-p.width)*m[0],E=(S-p.height)*m[1];(g>0||y>0||w||E)&&(o.push({id:d,type:"position",position:{x:c.position.x-g+w,y:c.position.y-y+E}}),n.get(d)?.forEach(k=>{e.some(j=>j.id===k.id)||o.push({id:k.id,type:"position",position:{x:k.position.x+g,y:k.position.y+y}})})),(p.width<s.width||p.height<s.height||g||y)&&o.push({id:d,type:"dimensions",setAttributes:!0,dimensions:{width:v+(g?m[0]*g-w:0),height:S+(y?m[1]*y-E:0)}})}),o}function Gge(e,t,n,r,o,i,s){const c=r?.querySelector(".xyflow__viewport");let d=!1;if(!c)return{changes:[],updatedInternals:d};const u=[],p=window.getComputedStyle(c),{m22:m}=new window.DOMMatrixReadOnly(p.transform),g=[];for(const y of e.values()){const v=t.get(y.id);if(!v)continue;if(v.hidden){t.set(v.id,{...v,internals:{...v.internals,handleBounds:void 0}}),d=!0;continue}const S=LC(y.nodeElement),w=v.measured.width!==S.width||v.measured.height!==S.height;if(!!(S.width&&S.height&&(w||!v.internals.handleBounds||y.force))){const k=y.nodeElement.getBoundingClientRect(),j=cc(v.extent)?v.extent:i;let{positionAbsolute:N}=v.internals;if(v.parentId&&v.extent==="parent"){const R=t.get(v.parentId);R&&(N=QF(N,S,R))}else j&&(N=lc(N,j,S));const A={...v,measured:S,internals:{...v.internals,positionAbsolute:N,handleBounds:{source:cO("source",y.nodeElement,k,m,v.id),target:cO("target",y.nodeElement,k,m,v.id)}}};t.set(v.id,A),v.parentId&&BC(A,t,n,{nodeOrigin:o,zIndexMode:s}),d=!0,w&&(u.push({id:v.id,type:"dimensions",dimensions:S}),v.expandParent&&v.parentId&&g.push({id:v.id,parentId:v.parentId,rect:yh(A,o)}))}}if(g.length>0){const y=HC(g,t,n,o);u.push(...y)}return{changes:u,updatedInternals:d}}async function Kge({delta:e,panZoom:t,transform:n,translateExtent:r,width:o,height:i}){if(!t||!e.x&&!e.y)return!1;const s=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[o,i]],r);return!!s&&(s.x!==n[0]||s.y!==n[1]||s.k!==n[2])}function gO(e,t,n,r,o,i){let s=o;const c=r.get(s)||new Map;r.set(s,c.set(n,t)),s=`${o}-${e}`;const d=r.get(s)||new Map;if(r.set(s,d.set(n,t)),i){s=`${o}-${e}-${i}`;const u=r.get(s)||new Map;r.set(s,u.set(n,t))}}function f3(e,t,n){e.clear(),t.clear();for(const r of n){const{source:o,target:i,sourceHandle:s=null,targetHandle:c=null}=r,d={edgeId:r.id,source:o,target:i,sourceHandle:s,targetHandle:c},u=`${o}-${s}--${i}-${c}`,p=`${i}-${c}--${o}-${s}`;gO("source",d,p,e,o,s),gO("target",d,u,e,i,c),t.set(r.id,r)}}function h3(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:h3(n,t):!1}function yO(e,t,n){let r=e;do{if(r?.matches?.(t))return!0;if(r===n)return!1;r=r?.parentElement}while(r);return!1}function Xge(e,t,n,r){const o=new Map;for(const[i,s]of e)if((s.selected||s.id===r)&&(!s.parentId||!h3(s,e))&&(s.draggable||t&&typeof s.draggable>"u")){const c=e.get(i);c&&o.set(i,{id:i,position:c.position||{x:0,y:0},distance:{x:n.x-c.internals.positionAbsolute.x,y:n.y-c.internals.positionAbsolute.y},extent:c.extent,parentId:c.parentId,origin:c.origin,expandParent:c.expandParent,internals:{positionAbsolute:c.internals.positionAbsolute||{x:0,y:0}},measured:{width:c.measured.width??0,height:c.measured.height??0}})}return o}function sw({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){const o=[];for(const[s,c]of t){const d=n.get(s)?.internals.userNode;d&&o.push({...d,position:c.position,dragging:r})}if(!e)return[o[0],o];const i=n.get(e)?.internals.userNode;return[i?{...i,position:t.get(e)?.position||i.position,dragging:r}:o[0],o]}function Qge({dragItems:e,snapGrid:t,x:n,y:r}){const o=e.values().next().value;if(!o)return null;const i={x:n-o.distance.x,y:r-o.distance.y},s=ap(i,t);return{x:s.x-i.x,y:s.y-i.y}}function Wge({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:r,onDragStop:o}){let i={x:null,y:null},s=0,c=new Map,d=!1,u={x:0,y:0},p=null,m=!1,g=null,y=!1,v=!1,S=null;function w({noDragClassName:k,handleSelector:j,domNode:N,isSelectable:A,nodeId:R,nodeClickDistance:M=0}){g=Yo(N);function T({x:$,y:G}){const{nodeLookup:L,nodeExtent:F,snapGrid:P,snapToGrid:I,nodeOrigin:Y,onNodeDrag:Z,onSelectionDrag:D,onError:H,updateNodePositions:U}=t();i={x:$,y:G};let B=!1;const X=c.size>1,J=X&&F?KS(sp(c)):null,Q=X&&I?Qge({dragItems:c,snapGrid:P,x:$,y:G}):null;for(const[oe,W]of c){if(!L.has(oe))continue;let ne={x:$-W.distance.x,y:G-W.distance.y};I&&(ne=Q?{x:Math.round(ne.x+Q.x),y:Math.round(ne.y+Q.y)}:ap(ne,P));let je=null;if(X&&F&&!W.extent&&J){const{positionAbsolute:re}=W.internals,ge=re.x-J.x+F[0][0],_e=re.x+W.measured.width-J.x2+F[1][0],De=re.y-J.y+F[0][1],we=re.y+W.measured.height-J.y2+F[1][1];je=[[ge,De],[_e,we]]}const{position:Ee,positionAbsolute:pe}=XF({nodeId:oe,nextPosition:ne,nodeLookup:L,nodeExtent:je||F,nodeOrigin:Y,onError:H});B=B||W.position.x!==Ee.x||W.position.y!==Ee.y,W.position=Ee,W.internals.positionAbsolute=pe}if(v=v||B,!!B&&(U(c,!0),S&&(r||Z||!R&&D))){const[oe,W]=sw({nodeId:R,dragItems:c,nodeLookup:L});r?.(S,c,oe,W),Z?.(S,oe,W),R||D?.(S,W)}}async function O(){if(!p)return;const{transform:$,panBy:G,autoPanSpeed:L,autoPanOnNodeDrag:F}=t();if(!F){d=!1,cancelAnimationFrame(s);return}const[P,I]=IC(u,p,L);(P!==0||I!==0)&&(i.x=(i.x??0)-P/$[2],i.y=(i.y??0)-I/$[2],await G({x:P,y:I})&&T(i)),s=requestAnimationFrame(O)}function z($){const{nodeLookup:G,multiSelectionActive:L,nodesDraggable:F,transform:P,snapGrid:I,snapToGrid:Y,selectNodesOnDrag:Z,onNodeDragStart:D,onSelectionDragStart:H,unselectNodesAndEdges:U}=t();m=!0,(!Z||!A)&&!L&&R&&(G.get(R)?.selected||U()),A&&Z&&R&&e?.(R);const B=Yf($.sourceEvent,{transform:P,snapGrid:I,snapToGrid:Y,containerBounds:p});if(i=B,c=Xge(G,F,B,R),c.size>0&&(n||D||!R&&H)){const[X,J]=sw({nodeId:R,dragItems:c,nodeLookup:G});n?.($.sourceEvent,c,X,J),D?.($.sourceEvent,X,J),R||H?.($.sourceEvent,J)}}const q=NF().clickDistance(M).on("start",$=>{const{domNode:G,nodeDragThreshold:L,transform:F,snapGrid:P,snapToGrid:I}=t();p=G?.getBoundingClientRect()||null,y=!1,v=!1,S=$.sourceEvent,L===0&&z($),i=Yf($.sourceEvent,{transform:F,snapGrid:P,snapToGrid:I,containerBounds:p}),u=Pi($.sourceEvent,p)}).on("drag",$=>{const{autoPanOnNodeDrag:G,transform:L,snapGrid:F,snapToGrid:P,nodeDragThreshold:I,nodeLookup:Y}=t(),Z=Yf($.sourceEvent,{transform:L,snapGrid:F,snapToGrid:P,containerBounds:p});if(S=$.sourceEvent,($.sourceEvent.type==="touchmove"&&$.sourceEvent.touches.length>1||R&&!Y.has(R))&&(y=!0),!y){if(!d&&G&&m&&(d=!0,O()),!m){const D=Pi($.sourceEvent,p),H=D.x-u.x,U=D.y-u.y;Math.sqrt(H*H+U*U)>I&&z($)}(i.x!==Z.xSnapped||i.y!==Z.ySnapped)&&c&&m&&(u=Pi($.sourceEvent,p),T(Z))}}).on("end",$=>{if(!m||y){y&&c.size>0&&t().updateNodePositions(c,!1);return}if(d=!1,m=!1,cancelAnimationFrame(s),c.size>0){const{nodeLookup:G,updateNodePositions:L,onNodeDragStop:F,onSelectionDragStop:P}=t();if(v&&(L(c,!1),v=!1),o||F||!R&&P){const[I,Y]=sw({nodeId:R,dragItems:c,nodeLookup:G,dragging:!1});o?.($.sourceEvent,c,I,Y),F?.($.sourceEvent,I,Y),R||P?.($.sourceEvent,Y)}}}).filter($=>{const G=$.target;return!$.button&&(!k||!yO(G,`.${k}`,N))&&(!j||yO(G,j,N))});g.call(q)}function E(){g?.on(".drag",null)}return{update:w,destroy:E}}function Jge(e,t,n){const r=[],o={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const i of t.values())by(o,yh(i))>0&&r.push(i);return r}const eye=250;function tye(e,t,n,r){let o=[],i=1/0;const s=Jge(e,n,t+eye);for(const c of s){const d=[...c.internals.handleBounds?.source??[],...c.internals.handleBounds?.target??[]];for(const u of d){if(r.nodeId===u.nodeId&&r.type===u.type&&r.id===u.id)continue;const{x:p,y:m}=uc(c,u,u.position,!0),g=Math.sqrt(Math.pow(p-e.x,2)+Math.pow(m-e.y,2));g>t||(g<i?(o=[{...u,x:p,y:m}],i=g):g===i&&o.push({...u,x:p,y:m}))}}if(!o.length)return null;if(o.length>1){const c=r.type==="source"?"target":"source";return o.find(d=>d.type===c)??o[0]}return o[0]}function p3(e,t,n,r,o,i=!1){const s=r.get(e);if(!s)return null;const c=o==="strict"?s.internals.handleBounds?.[t]:[...s.internals.handleBounds?.source??[],...s.internals.handleBounds?.target??[]],d=(n?c?.find(u=>u.id===n):c?.[0])??null;return d&&i?{...d,...uc(s,d,d.position,!0)}:d}function m3(e,t){return e||(t?.classList.contains("target")?"target":t?.classList.contains("source")?"source":null)}function nye(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const g3=()=>!0;function rye(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:o,edgeUpdaterType:i,isTarget:s,domNode:c,nodeLookup:d,lib:u,autoPanOnConnect:p,flowId:m,panBy:g,cancelConnection:y,onConnectStart:v,onConnect:S,onConnectEnd:w,isValidConnection:E=g3,onReconnectEnd:k,updateConnection:j,getTransform:N,getFromHandle:A,autoPanSpeed:R,dragThreshold:M=1,handleDomNode:T}){const O=r3(e.target);let z=0,q;const{x:$,y:G}=Pi(e),L=m3(i,T),F=c?.getBoundingClientRect();let P=!1;if(!F||!L)return;const I=p3(o,L,r,d,t);if(!I)return;let Y=Pi(e,F),Z=!1,D=null,H=!1,U=null;function B(){if(!p||!F)return;const[Ee,pe]=IC(Y,F,R);g({x:Ee,y:pe}),z=requestAnimationFrame(B)}const X={...I,nodeId:o,type:L,position:I.position},J=d.get(o);let oe={inProgress:!0,isValid:null,from:uc(J,X,pt.Left,!0),fromHandle:X,fromPosition:X.position,fromNode:J,to:Y,toHandle:null,toPosition:iO[X.position],toNode:null,pointer:Y};function W(){P=!0,j(oe),v?.(e,{nodeId:o,handleId:r,handleType:L})}M===0&&W();function ne(Ee){if(!P){const{x:we,y:$e}=Pi(Ee),Me=we-$,Le=$e-G;if(!(Me*Me+Le*Le>M*M))return;W()}if(!A()||!X){je(Ee);return}const pe=N();Y=Pi(Ee,F),q=tye(lp(Y,pe,!1,[1,1]),n,d,X),Z||(B(),Z=!0);const re=y3(Ee,{handle:q,connectionMode:t,fromNodeId:o,fromHandleId:r,fromType:s?"target":"source",isValidConnection:E,doc:O,lib:u,flowId:m,nodeLookup:d});U=re.handleDomNode,D=re.connection,H=nye(!!q,re.isValid);const ge=d.get(o),_e=ge?uc(ge,X,pt.Left,!0):oe.from,De={...oe,from:_e,isValid:H,to:re.toHandle&&H?qu({x:re.toHandle.x,y:re.toHandle.y},pe):Y,toHandle:re.toHandle,toPosition:H&&re.toHandle?re.toHandle.position:iO[X.position],toNode:re.toHandle?d.get(re.toHandle.nodeId):null,pointer:Y};j(De),oe=De}function je(Ee){if(!("touches"in Ee&&Ee.touches.length>0)){if(P){(q||U)&&D&&H&&S?.(D);const{inProgress:pe,...re}=oe,ge={...re,toPosition:oe.toHandle?oe.toPosition:null};w?.(Ee,ge),i&&k?.(Ee,ge)}y(),cancelAnimationFrame(z),Z=!1,H=!1,D=null,U=null,O.removeEventListener("mousemove",ne),O.removeEventListener("mouseup",je),O.removeEventListener("touchmove",ne),O.removeEventListener("touchend",je)}}O.addEventListener("mousemove",ne),O.addEventListener("mouseup",je),O.addEventListener("touchmove",ne),O.addEventListener("touchend",je)}function y3(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:o,fromType:i,doc:s,lib:c,flowId:d,isValidConnection:u=g3,nodeLookup:p}){const m=i==="target",g=t?s.querySelector(`.${c}-flow__handle[data-id="${d}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:y,y:v}=Pi(e),S=s.elementFromPoint(y,v),w=S?.classList.contains(`${c}-flow__handle`)?S:g,E={handleDomNode:w,isValid:!1,connection:null,toHandle:null};if(w){const k=m3(void 0,w),j=w.getAttribute("data-nodeid"),N=w.getAttribute("data-handleid"),A=w.classList.contains("connectable"),R=w.classList.contains("connectableend");if(!j||!k)return E;const M={source:m?j:r,sourceHandle:m?N:o,target:m?r:j,targetHandle:m?o:N};E.connection=M;const O=A&&R&&(n===Hu.Strict?m&&k==="source"||!m&&k==="target":j!==r||N!==o);E.isValid=O&&u(M),E.toHandle=p3(j,k,N,p,n,!0)}return E}const WS={onPointerDown:rye,isValid:y3};function oye({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){const o=Yo(e);function i({translateExtent:c,width:d,height:u,zoomStep:p=1,pannable:m=!0,zoomable:g=!0,inversePan:y=!1}){const v=j=>{if(j.sourceEvent.type!=="wheel"||!t)return;const N=n(),A=j.sourceEvent.ctrlKey&&xh()?10:1,R=-j.sourceEvent.deltaY*(j.sourceEvent.deltaMode===1?.05:j.sourceEvent.deltaMode?1:.002)*p,M=N[2]*Math.pow(2,R*A);t.scaleTo(M)};let S=[0,0];const w=j=>{(j.sourceEvent.type==="mousedown"||j.sourceEvent.type==="touchstart")&&(S=[j.sourceEvent.clientX??j.sourceEvent.touches[0].clientX,j.sourceEvent.clientY??j.sourceEvent.touches[0].clientY])},E=j=>{const N=n();if(j.sourceEvent.type!=="mousemove"&&j.sourceEvent.type!=="touchmove"||!t)return;const A=[j.sourceEvent.clientX??j.sourceEvent.touches[0].clientX,j.sourceEvent.clientY??j.sourceEvent.touches[0].clientY],R=[A[0]-S[0],A[1]-S[1]];S=A;const M=r()*Math.max(N[2],Math.log(N[2]))*(y?-1:1),T={x:N[0]-R[0]*M,y:N[1]-R[1]*M},O=[[0,0],[d,u]];t.setViewportConstrained({x:T.x,y:T.y,zoom:N[2]},O,c)},k=UF().on("start",w).on("zoom",m?E:null).on("zoom.wheel",g?v:null);o.call(k,{})}function s(){o.on("zoom",null)}return{update:i,destroy:s,pointer:Ti}}const Bx=e=>({x:e.x,y:e.y,zoom:e.k}),aw=({x:e,y:t,zoom:n})=>Fx.translate(e,t).scale(n),Ba=(e,t)=>e.target.closest(`.${t}`),x3=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),iye=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,lw=(e,t=0,n=iye,r=()=>{})=>{const o=typeof t=="number"&&t>0;return o||r(),o?e.transition().duration(t).ease(n).on("end",r):e},v3=e=>{const t=e.ctrlKey&&xh()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function sye({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:o,panOnScrollSpeed:i,zoomOnPinch:s,onPanZoomStart:c,onPanZoom:d,onPanZoomEnd:u}){return p=>{if(Ba(p,t))return p.ctrlKey&&p.preventDefault(),!1;p.preventDefault(),p.stopImmediatePropagation();const m=n.property("__zoom").k||1;if(p.ctrlKey&&s){const w=Ti(p),E=v3(p),k=m*Math.pow(2,E);r.scaleTo(n,k,w,p);return}const g=p.deltaMode===1?20:1;let y=o===Zl.Vertical?0:p.deltaX*g,v=o===Zl.Horizontal?0:p.deltaY*g;!xh()&&p.shiftKey&&o!==Zl.Vertical&&(y=p.deltaY*g,v=0),r.translateBy(n,-(y/m)*i,-(v/m)*i,{internal:!0});const S=Bx(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?d?.(p,S):(e.isPanScrolling=!0,c?.(p,S)),e.panScrollTimeout=setTimeout(()=>{u?.(p,S),e.isPanScrolling=!1},150)}}function aye({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,o){const i=r.type==="wheel",s=!t&&i&&!r.ctrlKey,c=Ba(r,e);if(r.ctrlKey&&i&&c&&r.preventDefault(),s||c)return null;r.preventDefault(),n.call(this,r,o)}}function lye({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{if(r.sourceEvent?.internal)return;const o=Bx(r.transform);e.mouseButton=r.sourceEvent?.button||0,e.isZoomingOrPanning=!0,e.prevViewport=o,r.sourceEvent?.type==="mousedown"&&t(!0),n&&n?.(r.sourceEvent,o)}}function cye({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:o}){return i=>{e.usedRightMouseButton=!!(n&&x3(t,e.mouseButton??0)),i.sourceEvent?.sync||r([i.transform.x,i.transform.y,i.transform.k]),o&&!i.sourceEvent?.internal&&o?.(i.sourceEvent,Bx(i.transform))}}function uye({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:o,onPaneContextMenu:i}){return s=>{if(!s.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,i&&x3(t,e.mouseButton??0)&&!e.usedRightMouseButton&&s.sourceEvent&&i(s.sourceEvent),e.usedRightMouseButton=!1,r(!1),o)){const c=Bx(s.transform);e.prevViewport=c,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{o?.(s.sourceEvent,c)},n?150:0)}}}function dye({panActivationKeyPressed:e,zoomActivationKeyPressed:t,zoomOnScroll:n,zoomOnPinch:r,panOnDrag:o,panOnScroll:i,zoomOnDoubleClick:s,userSelectionActive:c,noWheelClassName:d,noPanClassName:u,lib:p,connectionInProgress:m}){return g=>{const y=t||n,v=r&&g.ctrlKey,S=g.type==="wheel";if(g.button===1&&g.type==="mousedown"&&(Ba(g,`${p}-flow__node`)||Ba(g,`${p}-flow__edge`)||Ba(g,`${p}-flow__selection`)||Ba(g,`${p}-flow__nodesselection`)))return!0;if(!o&&!y&&!i&&!s&&!r||c||m&&!S||Ba(g,d)&&S||Ba(g,u)&&(!S||i&&S&&!t)||!r&&g.ctrlKey&&S)return!1;if(!r&&g.type==="touchstart"&&g.touches?.length>1)return g.preventDefault(),!1;if(!y&&!i&&!v&&S||!o&&(g.type==="mousedown"||g.type==="touchstart")||Array.isArray(o)&&!o.includes(g.button)&&g.type==="mousedown")return!1;const w=Array.isArray(o)&&o.includes(g.button)||!g.button||g.button<=1;return(!g.ctrlKey||S||e)&&w}}function fye({domNode:e,minZoom:t,maxZoom:n,translateExtent:r,viewport:o,onPanZoom:i,onPanZoomStart:s,onPanZoomEnd:c,onDraggingChange:d}){const u={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},p=e.getBoundingClientRect();let m=[[0,0],[p.width,p.height]];(typeof ResizeObserver<"u"?new ResizeObserver(G=>{const L=G[0];L&&(m=[[0,0],[L.contentRect.width,L.contentRect.height]])}):null)?.observe(e);const y=UF().extent(()=>m).scaleExtent([t,n]).translateExtent(r),v=Yo(e).call(y);N({x:o.x,y:o.y,zoom:Uu(o.zoom,t,n)},[[0,0],[p.width,p.height]],r);const S=v.on("wheel.zoom"),w=v.on("dblclick.zoom");y.wheelDelta(v3);async function E(G,L){return v?new Promise(F=>{y?.interpolate(L?.interpolate==="linear"?qf:jg).transform(lw(v,L?.duration,L?.ease,()=>F(!0)),G)}):!1}function k({noWheelClassName:G,noPanClassName:L,onPaneContextMenu:F,userSelectionActive:P,panOnScroll:I,panOnDrag:Y,panOnScrollMode:Z,panOnScrollSpeed:D,preventScrolling:H,zoomOnPinch:U,zoomOnScroll:B,zoomOnDoubleClick:X,panActivationKeyPressed:J=!1,zoomActivationKeyPressed:Q,lib:oe,onTransformChange:W,connectionInProgress:ne,paneClickDistance:je,selectionOnDrag:Ee}){P&&!u.isZoomingOrPanning&&j();const pe=I&&!Q&&!P;y.clickDistance(Ee?1/0:!Di(je)||je<0?0:je);const re=pe?sye({zoomPanValues:u,noWheelClassName:G,d3Selection:v,d3Zoom:y,panOnScrollMode:Z,panOnScrollSpeed:D,zoomOnPinch:U,onPanZoomStart:s,onPanZoom:i,onPanZoomEnd:c}):aye({noWheelClassName:G,preventScrolling:H,d3ZoomHandler:S});v.on("wheel.zoom",re,{passive:!1});const ge=lye({zoomPanValues:u,onDraggingChange:d,onPanZoomStart:s});y.on("start",ge);const _e=cye({zoomPanValues:u,panOnDrag:Y,onPaneContextMenu:!!F,onPanZoom:i,onTransformChange:W});y.on("zoom",_e);const De=uye({zoomPanValues:u,panOnDrag:Y,panOnScroll:I,onPaneContextMenu:F,onPanZoomEnd:c,onDraggingChange:d});y.on("end",De);const we=dye({panActivationKeyPressed:J,zoomActivationKeyPressed:Q,panOnDrag:Y,zoomOnScroll:B,panOnScroll:I,zoomOnDoubleClick:X,zoomOnPinch:U,userSelectionActive:P,noPanClassName:L,noWheelClassName:G,lib:oe,connectionInProgress:ne});y.filter(we),X?v.on("dblclick.zoom",w):v.on("dblclick.zoom",null)}function j(){y.on("zoom",null)}async function N(G,L,F){const P=aw(G),I=y?.constrain()(P,L,F);return I&&await E(I),I}async function A(G,L){const F=aw(G);return await E(F,L),F}function R(G){if(v){const L=aw(G),F=v.property("__zoom");(F.k!==G.zoom||F.x!==G.x||F.y!==G.y)&&y?.transform(v,L,null,{sync:!0})}}function M(){const G=v?HF(v.node()):{x:0,y:0,k:1};return{x:G.x,y:G.y,zoom:G.k}}async function T(G,L){return v?new Promise(F=>{y?.interpolate(L?.interpolate==="linear"?qf:jg).scaleTo(lw(v,L?.duration,L?.ease,()=>F(!0)),G)}):!1}async function O(G,L){return v?new Promise(F=>{y?.interpolate(L?.interpolate==="linear"?qf:jg).scaleBy(lw(v,L?.duration,L?.ease,()=>F(!0)),G)}):!1}function z(G){y?.scaleExtent(G)}function q(G){y?.translateExtent(G)}function $(G){const L=!Di(G)||G<0?0:G;y?.clickDistance(L)}return{update:k,destroy:j,setViewport:A,setViewportConstrained:N,getViewport:M,scaleTo:T,scaleBy:O,setScaleExtent:z,setTranslateExtent:q,syncViewport:R,setClickDistance:$}}var Yu;(function(e){e.Line="line",e.Handle="handle"})(Yu||(Yu={}));function hye({width:e,prevWidth:t,height:n,prevHeight:r,affectsX:o,affectsY:i}){const s=e-t,c=n-r,d=[s>0?1:s<0?-1:0,c>0?1:c<0?-1:0];return s&&o&&(d[0]=d[0]*-1),c&&i&&(d[1]=d[1]*-1),d}function xO(e){const t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),r=e.includes("left"),o=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:r,affectsY:o}}function za(e,t){return Math.max(0,t-e)}function La(e,t){return Math.max(0,e-t)}function ag(e,t,n){return Math.max(0,t-e,e-n)}function vO(e,t){return e?!t:t}function pye(e,t,n,r,o,i,s,c){let{affectsX:d,affectsY:u}=t;const{isHorizontal:p,isVertical:m}=t,g=p&&m,{xSnapped:y,ySnapped:v}=n,{minWidth:S,maxWidth:w,minHeight:E,maxHeight:k}=r,{x:j,y:N,width:A,height:R,aspectRatio:M}=e;let T=Math.floor(p?y-e.pointerX:0),O=Math.floor(m?v-e.pointerY:0);const z=A+(d?-T:T),q=R+(u?-O:O),$=-i[0]*A,G=-i[1]*R;let L=ag(z,S,w),F=ag(q,E,k);if(s){let Y=0,Z=0;d&&T<0?Y=za(j+T+$,s[0][0]):!d&&T>0&&(Y=La(j+z+$,s[1][0])),u&&O<0?Z=za(N+O+G,s[0][1]):!u&&O>0&&(Z=La(N+q+G,s[1][1])),L=Math.max(L,Y),F=Math.max(F,Z)}if(c){let Y=0,Z=0;d&&T>0?Y=La(j+T,c[0][0]):!d&&T<0&&(Y=za(j+z,c[1][0])),u&&O>0?Z=La(N+O,c[0][1]):!u&&O<0&&(Z=za(N+q,c[1][1])),L=Math.max(L,Y),F=Math.max(F,Z)}if(o){if(p){const Y=ag(z/M,E,k)*M;if(L=Math.max(L,Y),s){let Z=0;!d&&!u||d&&!u&&g?Z=La(N+G+z/M,s[1][1])*M:Z=za(N+G+(d?T:-T)/M,s[0][1])*M,L=Math.max(L,Z)}if(c){let Z=0;!d&&!u||d&&!u&&g?Z=za(N+z/M,c[1][1])*M:Z=La(N+(d?T:-T)/M,c[0][1])*M,L=Math.max(L,Z)}}if(m){const Y=ag(q*M,S,w)/M;if(F=Math.max(F,Y),s){let Z=0;!d&&!u||u&&!d&&g?Z=La(j+q*M+$,s[1][0])/M:Z=za(j+(u?O:-O)*M+$,s[0][0])/M,F=Math.max(F,Z)}if(c){let Z=0;!d&&!u||u&&!d&&g?Z=za(j+q*M,c[1][0])/M:Z=La(j+(u?O:-O)*M,c[0][0])/M,F=Math.max(F,Z)}}}O=O+(O<0?F:-F),T=T+(T<0?L:-L),o&&(g?z>q*M?O=(vO(d,u)?-T:T)/M:T=(vO(d,u)?-O:O)*M:p?(O=T/M,u=d):(T=O*M,d=u));const P=d?j+T:j,I=u?N+O:N;return{width:A+(d?-T:T),height:R+(u?-O:O),x:i[0]*T*(d?-1:1)+P,y:i[1]*O*(u?-1:1)+I}}const b3={width:0,height:0,x:0,y:0},mye={...b3,pointerX:0,pointerY:0,aspectRatio:1};function gye(e,t,n){const r=t.position.x+e.position.x,o=t.position.y+e.position.y,i=e.measured.width??0,s=e.measured.height??0,c=n[0]*i,d=n[1]*s;return[[r-c,o-d],[r+i-c,o+s-d]]}function yye({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:o}){const i=Yo(e);let s={controlDirection:xO("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function c({controlPosition:u,boundaries:p,keepAspectRatio:m,resizeDirection:g,onResizeStart:y,onResize:v,onResizeEnd:S,shouldResize:w}){let E={...b3},k={...mye};s={boundaries:p,resizeDirection:g,keepAspectRatio:m,controlDirection:xO(u)};let j,N=null,A=[],R,M,T,O=!1;const z=NF().on("start",q=>{const{nodeLookup:$,transform:G,snapGrid:L,snapToGrid:F,nodeOrigin:P,paneDomNode:I}=n();if(j=$.get(t),!j)return;N=I?.getBoundingClientRect()??null;const{xSnapped:Y,ySnapped:Z}=Yf(q.sourceEvent,{transform:G,snapGrid:L,snapToGrid:F,containerBounds:N});E={width:j.measured.width??0,height:j.measured.height??0,x:j.position.x??0,y:j.position.y??0},k={...E,pointerX:Y,pointerY:Z,aspectRatio:E.width/E.height},R=void 0,M=cc(j.extent)?j.extent:void 0,j.parentId&&(j.extent==="parent"||j.expandParent)&&(R=$.get(j.parentId)),R&&j.extent==="parent"&&(M=[[0,0],[R.measured.width,R.measured.height]]),A=[],T=void 0;for(const[D,H]of $)if(H.parentId===t&&(A.push({id:D,position:{...H.position},extent:H.extent}),H.extent==="parent"||H.expandParent)){const U=gye(H,j,H.origin??P);T?T=[[Math.min(U[0][0],T[0][0]),Math.min(U[0][1],T[0][1])],[Math.max(U[1][0],T[1][0]),Math.max(U[1][1],T[1][1])]]:T=U}y?.(q,{...E})}).on("drag",q=>{const{transform:$,snapGrid:G,snapToGrid:L,nodeOrigin:F}=n(),P=Yf(q.sourceEvent,{transform:$,snapGrid:G,snapToGrid:L,containerBounds:N}),I=[];if(!j)return;const{x:Y,y:Z,width:D,height:H}=E,U={},B=j.origin??F,{width:X,height:J,x:Q,y:oe}=pye(k,s.controlDirection,P,s.boundaries,s.keepAspectRatio,B,M,T),W=X!==D,ne=J!==H,je=Q!==Y&&W,Ee=oe!==Z&&ne;if(!je&&!Ee&&!W&&!ne)return;if((je||Ee||B[0]===1||B[1]===1)&&(U.x=je?Q:E.x,U.y=Ee?oe:E.y,E.x=U.x,E.y=U.y,A.length>0)){const _e=Q-Y,De=oe-Z;for(const we of A)we.position={x:we.position.x-_e+B[0]*(X-D),y:we.position.y-De+B[1]*(J-H)},I.push(we)}if((W||ne)&&(U.width=W&&(!s.resizeDirection||s.resizeDirection==="horizontal")?X:E.width,U.height=ne&&(!s.resizeDirection||s.resizeDirection==="vertical")?J:E.height,E.width=U.width,E.height=U.height),R&&j.expandParent){const _e=B[0]*(U.width??0);U.x&&U.x<_e&&(E.x=_e,k.x=k.x-(U.x-_e));const De=B[1]*(U.height??0);U.y&&U.y<De&&(E.y=De,k.y=k.y-(U.y-De))}const pe=hye({width:E.width,prevWidth:D,height:E.height,prevHeight:H,affectsX:s.controlDirection.affectsX,affectsY:s.controlDirection.affectsY}),re={...E,direction:pe};w?.(q,re)!==!1&&(O=!0,v?.(q,re),r(U,I))}).on("end",q=>{O&&(S?.(q,{...E}),o?.({...E}),O=!1)});i.call(z)}function d(){i.on(".drag",null)}return{update:c,destroy:d}}const xye={},bO=e=>{let t;const n=new Set,r=(p,m)=>{const g=typeof p=="function"?p(t):p;if(!Object.is(g,t)){const y=t;t=m??(typeof g!="object"||g===null)?g:Object.assign({},t,g),n.forEach(v=>v(t,y))}},o=()=>t,d={setState:r,getState:o,getInitialState:()=>u,subscribe:p=>(n.add(p),()=>n.delete(p)),destroy:()=>{(xye?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},u=t=e(r,o,d);return d},vye=e=>e?bO(e):bO,{useDebugValue:bye}=Ne,{useSyncExternalStoreWithSelector:wye}=bq,Sye=e=>e;function w3(e,t=Sye,n){const r=wye(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return bye(r),r}const wO=(e,t)=>{const n=vye(e),r=(o,i=t)=>w3(n,o,i);return Object.assign(r,n),r},Eye=(e,t)=>e?wO(e,t):wO;function or(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,o]of e)if(!Object.is(o,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 Hx=b.createContext(null),Cye=Hx.Provider,S3=Fi.error001("react");function gn(e,t){const n=b.useContext(Hx);if(n===null)throw new Error(S3);return w3(n,e,t)}function Xn(){const e=b.useContext(Hx);if(e===null)throw new Error(S3);return b.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const SO={display:"none"},kye={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},E3="react-flow__node-desc",C3="react-flow__edge-desc",jye="react-flow__aria-live",Rye=e=>e.ariaLiveMessage,_ye=e=>e.ariaLabelConfig;function Nye({rfId:e}){const t=gn(Rye);return f.jsx("div",{id:`${jye}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:kye,children:t})}function Tye({rfId:e,disableKeyboardA11y:t}){const n=gn(_ye);return f.jsxs(f.Fragment,{children:[f.jsx("div",{id:`${E3}-${e}`,style:SO,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),f.jsx("div",{id:`${C3}-${e}`,style:SO,children:n["edge.a11yDescription.default"]}),!t&&f.jsx(Nye,{rfId:e})]})}const Ux=b.forwardRef(({position:e="top-left",children:t,className:n,style:r,...o},i)=>{const s=`${e}`.split("-");return f.jsx("div",{className:Er(["react-flow__panel",n,...s]),style:r,ref:i,...o,children:t})});Ux.displayName="Panel";const EO="https://reactflow.dev?utm_source=attribution";function Mye({proOptions:e,position:t="bottom-right"}){return e?.hideAttribution?null:f.jsx(Ux,{position:t,className:"react-flow__attribution","data-message":`Please only hide this attribution when you are subscribed to React Flow Pro: ${EO}`,children:f.jsx("a",{href:EO,target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const Aye=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}},lg=e=>e.id;function Oye(e,t){return or(e.selectedNodes.map(lg),t.selectedNodes.map(lg))&&or(e.selectedEdges.map(lg),t.selectedEdges.map(lg))}function Dye({onSelectionChange:e}){const t=Xn(),{selectedNodes:n,selectedEdges:r}=gn(Aye,Oye);return b.useEffect(()=>{const o={nodes:n,edges:r};e?.(o),t.getState().onSelectionChangeHandlers.forEach(i=>i(o))},[n,r,e]),null}const Pye=e=>!!e.onSelectionChangeHandlers;function Iye({onSelectionChange:e}){const t=gn(Pye);return e||t?f.jsx(Dye,{onSelectionChange:e}):null}const k3=[0,0],zye={x:0,y:0,zoom:1},Lye=["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"],CO=[...Lye,"rfId"],Fye=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}),kO={translateExtent:ph,nodeOrigin:k3,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function $ye(e){const{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:o,setTranslateExtent:i,setNodeExtent:s,reset:c,setDefaultNodesAndEdges:d}=gn(Fye,or),u=Xn();b.useEffect(()=>(d(e.defaultNodes,e.defaultEdges),()=>{p.current=kO,c()}),[]);const p=b.useRef(kO);return b.useEffect(()=>{for(const m of CO){const g=e[m],y=p.current[m];g!==y&&(typeof e[m]>"u"||(m==="nodes"?t(g):m==="edges"?n(g):m==="minZoom"?r(g):m==="maxZoom"?o(g):m==="translateExtent"?i(g):m==="nodeExtent"?s(g):m==="ariaLabelConfig"?u.setState({ariaLabelConfig:Tge(g)}):m==="fitView"?u.setState({fitViewQueued:g}):m==="fitViewOptions"?u.setState({fitViewOptions:g}):u.setState({[m]:g})))}p.current=e},CO.map(m=>e[m])),null}function jO(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function Vye(e){const[t,n]=b.useState(e==="system"?null:e);return b.useEffect(()=>{if(e!=="system"){n(e);return}const r=jO(),o=()=>n(r?.matches?"dark":"light");return o(),r?.addEventListener("change",o),()=>{r?.removeEventListener("change",o)}},[e]),t!==null?t:jO()?.matches?"dark":"light"}const RO=typeof document<"u"?document:null;function vh(e=null,t={target:RO,actInsideInputWithModifier:!0}){const[n,r]=b.useState(!1),o=b.useRef(!1),i=b.useRef(new Set([])),[s,c]=b.useMemo(()=>{if(e!==null){const u=(Array.isArray(e)?e:[e]).filter(m=>typeof m=="string").map(m=>m.replace(/\+/g,`
145
+ `).replace(`
146
+
147
+ `,`
148
+ +`).split(`
149
+ `)),p=u.reduce((m,g)=>m.concat(...g),[]);return[u,p]}return[[],[]]},[e]);return b.useEffect(()=>{const d=t?.target??RO,u=t?.actInsideInputWithModifier??!0;if(e!==null){const p=y=>{if(o.current=y.ctrlKey||y.metaKey||y.shiftKey||y.altKey,(!o.current||o.current&&!u)&&o3(y))return!1;const S=NO(y.code,c);if(i.current.add(y[S]),_O(s,i.current,!1)){const w=y.composedPath?.()?.[0]||y.target,E=w?.nodeName==="BUTTON"||w?.nodeName==="A";t.preventDefault!==!1&&(o.current||!E)&&y.preventDefault(),r(!0)}},m=y=>{const v=NO(y.code,c);_O(s,i.current,!0)?(r(!1),i.current.clear()):i.current.delete(y[v]),y.key==="Meta"&&i.current.clear(),o.current=!1},g=()=>{i.current.clear(),r(!1)};return d?.addEventListener("keydown",p),d?.addEventListener("keyup",m),window.addEventListener("blur",g),window.addEventListener("contextmenu",g),()=>{d?.removeEventListener("keydown",p),d?.removeEventListener("keyup",m),window.removeEventListener("blur",g),window.removeEventListener("contextmenu",g)}}},[e,r]),n}function _O(e,t,n){return e.filter(r=>n||r.length===t.size).some(r=>r.every(o=>t.has(o)))}function NO(e,t){return t.includes(e)?"code":"key"}const Bye=()=>{const e=Xn();return b.useMemo(()=>({zoomIn:async t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1.2,t):!1},zoomOut:async t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1/1.2,t):!1},zoomTo:async(t,n)=>{const{panZoom:r}=e.getState();return r?r.scaleTo(t,n):!1},getZoom:()=>e.getState().transform[2],setViewport:async(t,n)=>{const{transform:[r,o,i],panZoom:s}=e.getState();return s?(await s.setViewport({x:t.x??r,y:t.y??o,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:o,minZoom:i,maxZoom:s,panZoom:c}=e.getState(),d=zC(t,r,o,i,s,n?.padding??.1);return c?(await c.setViewport(d,{duration:n?.duration,ease:n?.ease,interpolate:n?.interpolate}),!0):!1},screenToFlowPosition:(t,n={})=>{const{transform:r,snapGrid:o,snapToGrid:i,domNode:s}=e.getState();if(!s)return t;const{x:c,y:d}=s.getBoundingClientRect(),u={x:t.x-c,y:t.y-d},p=n.snapGrid??o,m=n.snapToGrid??i;return lp(u,r,m,p)},flowToScreenPosition:t=>{const{transform:n,domNode:r}=e.getState();if(!r)return t;const{x:o,y:i}=r.getBoundingClientRect(),s=qu(t,n);return{x:s.x+o,y:s.y+i}}}),[])};function j3(e,t){const n=[],r=new Map,o=[];for(const i of e)if(i.type==="add"){o.push(i);continue}else if(i.type==="remove"||i.type==="replace")r.set(i.id,[i]);else{const s=r.get(i.id);s?s.push(i):r.set(i.id,[i])}for(const i of t){const s=r.get(i.id);if(!s){n.push(i);continue}if(s[0].type==="remove")continue;if(s[0].type==="replace"){n.push({...s[0].item});continue}const c={...i};for(const d of s)Hye(d,c);n.push(c)}return o.length&&o.forEach(i=>{i.index!==void 0?n.splice(i.index,0,{...i.item}):n.push({...i.item})}),n}function Hye(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 R3(e,t){return j3(e,t)}function _3(e,t){return j3(e,t)}function Ll(e,t){return{id:e,type:"select",selected:t}}function Su(e,t=new Set,n=!1){const r=[];for(const[o,i]of e){const s=t.has(o);!(i.selected===void 0&&!s)&&i.selected!==s&&(n&&(i.selected=s),r.push(Ll(i.id,s)))}return r}function TO({items:e=[],lookup:t}){const n=[],r=new Map(e.map(o=>[o.id,o]));for(const[o,i]of e.entries()){const s=t.get(i.id),c=s?.internals?.userNode??s;c!==void 0&&c!==i&&n.push({id:i.id,item:i,type:"replace"}),c===void 0&&n.push({item:i,type:"add",index:o})}for(const[o]of t)r.get(o)===void 0&&n.push({id:o,type:"remove"});return n}function MO(e){return{id:e.id,type:"remove"}}const Uye=e3();function N3(e,t,n={}){return Ige(e,t,{...n,onError:n.onError??Uye})}const AO=e=>wge(e),qye=e=>KF(e);function T3(e){return b.forwardRef(e)}const M3=typeof window<"u"?b.useLayoutEffect:b.useEffect;function OO(e){const[t,n]=b.useState(BigInt(0)),[r]=b.useState(()=>Yye(()=>n(o=>o+BigInt(1))));return M3(()=>{const o=r.get();o.length&&(e(o),r.reset())},[t]),r}function Yye(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}const A3=b.createContext(null);function Zye({children:e}){const t=Xn(),n=b.useCallback(c=>{const{nodes:d=[],setNodes:u,hasDefaultNodes:p,onNodesChange:m,nodeLookup:g,fitViewQueued:y,onNodesChangeMiddlewareMap:v}=t.getState();let S=d;for(const E of c)S=typeof E=="function"?E(S):E;let w=TO({items:S,lookup:g});for(const E of v.values())w=E(w);p&&u(S),w.length>0?m?.(w):y&&window.requestAnimationFrame(()=>{const{fitViewQueued:E,nodes:k,setNodes:j}=t.getState();E&&j(k)})},[]),r=OO(n),o=b.useCallback(c=>{const{edges:d=[],setEdges:u,hasDefaultEdges:p,onEdgesChange:m,edgeLookup:g}=t.getState();let y=d;for(const v of c)y=typeof v=="function"?v(y):v;p?u(y):m&&m(TO({items:y,lookup:g}))},[]),i=OO(o),s=b.useMemo(()=>({nodeQueue:r,edgeQueue:i}),[]);return f.jsx(A3.Provider,{value:s,children:e})}function Gye(){const e=b.useContext(A3);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const Kye=e=>!!e.panZoom;function UC(){const e=Bye(),t=Xn(),n=Gye(),r=gn(Kye),o=b.useMemo(()=>{const i=m=>t.getState().nodeLookup.get(m),s=m=>{n.nodeQueue.push(m)},c=m=>{n.edgeQueue.push(m)},d=m=>{const{nodeLookup:g,nodeOrigin:y}=t.getState(),v=AO(m)?m:g.get(m.id),S=v.parentId?n3(v.position,v.measured,v.parentId,g,y):v.position,w={...v,position:S,width:v.measured?.width??v.width,height:v.measured?.height??v.height};return yh(w)},u=(m,g,y={replace:!1})=>{s(v=>v.map(S=>{if(S.id===m){const w=typeof g=="function"?g(S):g;return y.replace&&AO(w)?w:{...S,...w}}return S}))},p=(m,g,y={replace:!1})=>{c(v=>v.map(S=>{if(S.id===m){const w=typeof g=="function"?g(S):g;return y.replace&&qye(w)?w:{...S,...w}}return S}))};return{getNodes:()=>t.getState().nodes.map(m=>({...m})),getNode:m=>i(m)?.internals.userNode,getInternalNode:i,getEdges:()=>{const{edges:m=[]}=t.getState();return m.map(g=>({...g}))},getEdge:m=>t.getState().edgeLookup.get(m),setNodes:s,setEdges:c,addNodes:m=>{const g=Array.isArray(m)?m:[m];n.nodeQueue.push(y=>[...y,...g])},addEdges:m=>{const g=Array.isArray(m)?m:[m];n.edgeQueue.push(y=>[...y,...g])},toObject:()=>{const{nodes:m=[],edges:g=[],transform:y}=t.getState(),[v,S,w]=y;return{nodes:m.map(E=>({...E})),edges:g.map(E=>({...E})),viewport:{x:v,y:S,zoom:w}}},deleteElements:async({nodes:m=[],edges:g=[]})=>{const{nodes:y,edges:v,onNodesDelete:S,onEdgesDelete:w,triggerNodeChanges:E,triggerEdgeChanges:k,onDelete:j,onBeforeDelete:N}=t.getState(),{nodes:A,edges:R}=await jge({nodesToRemove:m,edgesToRemove:g,nodes:y,edges:v,onBeforeDelete:N}),M=R.length>0,T=A.length>0;if(M){const O=R.map(MO);w?.(R),k(O)}if(T){const O=A.map(MO);S?.(A),E(O)}return(T||M)&&j?.({nodes:A,edges:R}),{deletedNodes:A,deletedEdges:R}},getIntersectingNodes:(m,g=!0,y)=>{const v=aO(m),S=v?m:d(m),w=y!==void 0;return S?(y||t.getState().nodes).filter(E=>{const k=t.getState().nodeLookup.get(E.id);if(k&&!v&&(E.id===m.id||!k.internals.positionAbsolute))return!1;const j=yh(w?E:k),N=by(j,S);return g&&N>0||N>=j.width*j.height||N>=S.width*S.height}):[]},isNodeIntersecting:(m,g,y=!0)=>{const S=aO(m)?m:d(m);if(!S)return!1;const w=by(S,g);return y&&w>0||w>=g.width*g.height||w>=S.width*S.height},updateNode:u,updateNodeData:(m,g,y={replace:!1})=>{u(m,v=>{const S=typeof g=="function"?g(v):g;return y.replace?{...v,data:S}:{...v,data:{...v.data,...S}}},y)},updateEdge:p,updateEdgeData:(m,g,y={replace:!1})=>{p(m,v=>{const S=typeof g=="function"?g(v):g;return y.replace?{...v,data:S}:{...v,data:{...v.data,...S}}},y)},getNodesBounds:m=>{const{nodeLookup:g,nodeOrigin:y}=t.getState();return Sge(m,{nodeLookup:g,nodeOrigin:y})},getHandleConnections:({type:m,id:g,nodeId:y})=>Array.from(t.getState().connectionLookup.get(`${y}-${m}${g?`-${g}`:""}`)?.values()??[]),getNodeConnections:({type:m,handleId:g,nodeId:y})=>Array.from(t.getState().connectionLookup.get(`${y}${m?g?`-${m}-${g}`:`-${m}`:""}`)?.values()??[]),fitView:async m=>{const g=t.getState().fitViewResolver??Nge();return t.setState({fitViewQueued:!0,fitViewOptions:m,fitViewResolver:g}),n.nodeQueue.push(y=>[...y]),g.promise}}},[]);return b.useMemo(()=>({...o,...e,viewportInitialized:r}),[r])}const DO=e=>e.selected,Xye=typeof window<"u"?window:void 0;function Qye({deleteKeyCode:e,multiSelectionKeyCode:t}){const n=Xn(),{deleteElements:r}=UC(),o=vh(e,{actInsideInputWithModifier:!1}),i=vh(t,{target:Xye});b.useEffect(()=>{if(o){const{edges:s,nodes:c}=n.getState();r({nodes:c.filter(DO),edges:s.filter(DO)}),n.setState({nodesSelectionActive:!1})}},[o]),b.useEffect(()=>{n.setState({multiSelectionActive:i})},[i])}function Wye(e){const t=Xn();b.useEffect(()=>{const n=()=>{if(!e.current||!(e.current.checkVisibility?.()??!0))return!1;const r=LC(e.current);(r.height===0||r.width===0)&&t.getState().onError?.("004",Fi.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 qx={position:"absolute",width:"100%",height:"100%",top:0,left:0},Jye=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function exe({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:r=!1,panActivationKeyPressed:o,panOnScrollSpeed:i=.5,panOnScrollMode:s=Zl.Free,zoomOnDoubleClick:c=!0,panOnDrag:d=!0,defaultViewport:u,translateExtent:p,minZoom:m,maxZoom:g,zoomActivationKeyCode:y,preventScrolling:v=!0,children:S,noWheelClassName:w,noPanClassName:E,onViewportChange:k,isControlledViewport:j,paneClickDistance:N,selectionOnDrag:A}){const R=Xn(),M=b.useRef(null),{userSelectionActive:T,lib:O,connectionInProgress:z}=gn(Jye,or),q=vh(y),$=b.useRef();Wye(M);const G=b.useCallback(L=>{k?.({x:L[0],y:L[1],zoom:L[2]}),j||R.setState({transform:L})},[k,j]);return b.useEffect(()=>{if(M.current){$.current=fye({domNode:M.current,minZoom:m,maxZoom:g,translateExtent:p,viewport:u,onDraggingChange:I=>R.setState(Y=>Y.paneDragging===I?Y:{paneDragging:I}),onPanZoomStart:(I,Y)=>{const{onViewportChangeStart:Z,onMoveStart:D}=R.getState();D?.(I,Y),Z?.(Y)},onPanZoom:(I,Y)=>{const{onViewportChange:Z,onMove:D}=R.getState();D?.(I,Y),Z?.(Y)},onPanZoomEnd:(I,Y)=>{const{onViewportChangeEnd:Z,onMoveEnd:D}=R.getState();D?.(I,Y),Z?.(Y)}});const{x:L,y:F,zoom:P}=$.current.getViewport();return R.setState({panZoom:$.current,transform:[L,F,P],domNode:M.current.closest(".react-flow")}),()=>{$.current?.destroy()}}},[]),b.useEffect(()=>{$.current?.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:r,panActivationKeyPressed:o,panOnScrollSpeed:i,panOnScrollMode:s,zoomOnDoubleClick:c,panOnDrag:d,zoomActivationKeyPressed:q,preventScrolling:v,noPanClassName:E,userSelectionActive:T,noWheelClassName:w,lib:O,onTransformChange:G,connectionInProgress:z,selectionOnDrag:A,paneClickDistance:N})},[e,t,n,r,o,i,s,c,d,q,v,E,T,w,O,G,z,A,N]),f.jsx("div",{className:"react-flow__renderer",ref:M,style:qx,children:S})}const txe=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function nxe(){const{userSelectionActive:e,userSelectionRect:t}=gn(txe,or);return e&&t?f.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 cw=(e,t)=>n=>{n.target===t.current&&e?.(n)},rxe=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging,panBy:e.panBy,autoPanSpeed:e.autoPanSpeed});function oxe({isSelecting:e,selectionKeyPressed:t,selectionMode:n=mh.Full,panOnDrag:r,autoPanOnSelection:o,paneClickDistance:i,selectionOnDrag:s,onSelectionStart:c,onSelectionEnd:d,onPaneClick:u,onPaneContextMenu:p,onPaneScroll:m,onPaneMouseEnter:g,onPaneMouseMove:y,onPaneMouseLeave:v,children:S}){const w=b.useRef(0),E=Xn(),{userSelectionActive:k,elementsSelectable:j,dragging:N,panBy:A,autoPanSpeed:R}=gn(rxe,or),M=j&&(e||k),T=b.useRef(null),O=b.useRef(),z=b.useRef(new Set),q=b.useRef(new Set),$=b.useRef(!1),G=b.useRef(!1),L=b.useRef({x:0,y:0}),F=b.useRef(!1),P=W=>{if(G.current||$.current||E.getState().connection.inProgress){G.current=!1,$.current=!1;return}u?.(W),E.getState().resetSelectedElements(),E.setState({nodesSelectionActive:!1})},I=W=>{if(Array.isArray(r)&&r?.includes(2)){W.preventDefault();return}p?.(W)},Y=m?W=>m(W):void 0,Z=W=>{G.current&&(W.stopPropagation(),G.current=!1)},D=W=>{if(W.pointerType==="touch"&&r!==!1&&!t)return;const{domNode:ne,transform:je}=E.getState();if(O.current=ne?.getBoundingClientRect(),!O.current)return;const Ee=W.target===T.current;if(!Ee&&!!W.target.closest(".nokey")||!e||!(s&&Ee||t)||W.button!==0||!W.isPrimary)return;W.target?.setPointerCapture?.(W.pointerId),G.current=!1;const{x:ge,y:_e}=Pi(W.nativeEvent,O.current),De=lp({x:ge,y:_e},je);E.setState({userSelectionRect:{width:0,height:0,startX:De.x,startY:De.y,x:ge,y:_e}}),Ee||(W.stopPropagation(),W.preventDefault())};function H(W,ne){const{userSelectionRect:je}=E.getState();if(!je)return;const{transform:Ee,nodeLookup:pe,edgeLookup:re,connectionLookup:ge,triggerNodeChanges:_e,triggerEdgeChanges:De,defaultEdgeOptions:we}=E.getState(),$e={x:je.startX,y:je.startY},{x:Me,y:Le}=qu($e,Ee),He={startX:$e.x,startY:$e.y,x:W<Me?W:Me,y:ne<Le?ne:Le,width:Math.abs(W-Me),height:Math.abs(ne-Le)},Ge=z.current,ot=q.current;z.current=new Set(PC(pe,He,Ee,n===mh.Partial,!0).map(ke=>ke.id)),q.current=new Set;const me=we?.selectable??!0;for(const ke of z.current){const de=ge.get(ke);if(de)for(const{edgeId:ue}of de.values()){const Se=re.get(ue);Se&&(Se.selectable??me)&&q.current.add(ue)}}if(!lO(Ge,z.current)){const ke=Su(pe,z.current,!0);_e(ke)}if(!lO(ot,q.current)){const ke=Su(re,q.current);De(ke)}E.setState({userSelectionRect:He,userSelectionActive:!0,nodesSelectionActive:!1})}function U(){if(!o||!O.current)return;const[W,ne]=IC(L.current,O.current,R);A({x:W,y:ne}).then(je=>{if(!G.current||!je){w.current=requestAnimationFrame(U);return}const{x:Ee,y:pe}=L.current;H(Ee,pe),w.current=requestAnimationFrame(U)})}const B=()=>{cancelAnimationFrame(w.current),w.current=0,F.current=!1};b.useEffect(()=>()=>B(),[]);const X=W=>{const{userSelectionRect:ne,transform:je,resetSelectedElements:Ee}=E.getState();if(!O.current||!ne)return;const{x:pe,y:re}=Pi(W.nativeEvent,O.current);L.current={x:pe,y:re};const ge=qu({x:ne.startX,y:ne.startY},je);if(!G.current){const _e=t?0:i;if(Math.hypot(pe-ge.x,re-ge.y)<=_e)return;Ee(),c?.(W)}G.current=!0,F.current||(U(),F.current=!0),H(pe,re)},J=W=>{if(!M){W.target===T.current&&E.getState().connection.inProgress&&($.current=!0);return}W.button===0&&(W.target?.releasePointerCapture?.(W.pointerId),!k&&W.target===T.current&&E.getState().userSelectionRect&&P?.(W),E.setState({userSelectionActive:!1,userSelectionRect:null}),G.current&&(d?.(W),E.setState({nodesSelectionActive:z.current.size>0})),B())},Q=W=>{W.target?.releasePointerCapture?.(W.pointerId),B()},oe=r===!0||Array.isArray(r)&&r.includes(0);return f.jsxs("div",{className:Er(["react-flow__pane",{draggable:oe,dragging:N,selection:e}]),onClick:M?void 0:cw(P,T),onContextMenu:cw(I,T),onWheel:cw(Y,T),onPointerEnter:M?void 0:g,onPointerMove:M?X:y,onPointerUp:J,onPointerCancel:M?Q:void 0,onPointerDownCapture:M?D:void 0,onClickCapture:M?Z:void 0,onPointerLeave:v,ref:T,style:qx,children:[S,f.jsx(nxe,{})]})}function JS({id:e,store:t,unselect:n=!1,nodeRef:r}){const{addSelectedNodes:o,unselectNodesAndEdges:i,multiSelectionActive:s,nodeLookup:c,onError:d}=t.getState(),u=c.get(e);if(!u){d?.("012",Fi.error012(e));return}t.setState({nodesSelectionActive:!1}),u.selected?(n||u.selected&&s)&&(i({nodes:[u],edges:[]}),requestAnimationFrame(()=>r?.current?.blur())):o([e])}function O3({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:o,isSelectable:i,nodeClickDistance:s}){const c=Xn(),[d,u]=b.useState(!1),p=b.useRef();return b.useEffect(()=>{if(!t)return p.current=Wge({getStoreItems:()=>c.getState(),onNodeMouseDown:m=>{JS({id:m,store:c,nodeRef:e})},onDragStart:()=>{u(!0)},onDragStop:()=>{u(!1)}}),()=>{p.current?.destroy(),p.current=void 0}},[t,c,e]),b.useEffect(()=>{t||!e.current||!p.current||p.current.update({noDragClassName:n,handleSelector:r,domNode:e.current,isSelectable:i,nodeId:o,nodeClickDistance:s})},[n,r,t,i,e,o,s]),d}const ixe=e=>t=>t.selected&&(t.draggable||e&&typeof t.draggable>"u");function D3(){const e=Xn();return b.useCallback(n=>{const{nodeExtent:r,snapToGrid:o,snapGrid:i,nodesDraggable:s,onError:c,updateNodePositions:d,nodeLookup:u,nodeOrigin:p}=e.getState(),m=new Map,g=ixe(s),y=o?i[0]:5,v=o?i[1]:5,S=n.direction.x*y*n.factor,w=n.direction.y*v*n.factor;for(const[,E]of u){if(!g(E))continue;let k={x:E.internals.positionAbsolute.x+S,y:E.internals.positionAbsolute.y+w};o&&(k=ap(k,i));const{position:j,positionAbsolute:N}=XF({nodeId:E.id,nextPosition:k,nodeLookup:u,nodeExtent:r,nodeOrigin:p,onError:c});E.position=j,E.internals.positionAbsolute=N,m.set(E.id,E)}d(m)},[])}const qC=b.createContext(null),sxe=qC.Provider;qC.Consumer;const P3=()=>b.useContext(qC),axe=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),I3=b.createContext(null);function lxe({children:e}){const t=gn(axe,or);return f.jsx(I3.Provider,{value:t,children:e})}function cxe(){const e=b.useContext(I3);if(!e)throw new Error("useHandleConfig must be used within a HandleConfigProvider");return e}const uxe={connectingFrom:!1,connectingTo:!1,clickConnecting:!1,isPossibleEndHandle:!0,connectionInProcess:!1,clickConnectionInProcess:!1,valid:!1},dxe=(e,t,n)=>r=>{const{connectionClickStartHandle:o,connectionMode:i,connection:s}=r,{fromHandle:c,toHandle:d,isValid:u}=s;if(!c&&!o)return uxe;const p=d?.nodeId===e&&d?.id===t&&d?.type===n;return{connectingFrom:c?.nodeId===e&&c?.id===t&&c?.type===n,connectingTo:p,clickConnecting:o?.nodeId===e&&o?.id===t&&o?.type===n,isPossibleEndHandle:i===Hu.Strict?c?.type!==n:e!==c?.nodeId||t!==c?.id,connectionInProcess:!!c,clickConnectionInProcess:!!o,valid:p&&u}};function fxe({type:e="source",position:t=pt.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:o=!0,isConnectableEnd:i=!0,id:s,onConnect:c,children:d,className:u,onMouseDown:p,onTouchStart:m,...g},y){const v=s||null,S=e==="target",w=Xn(),E=P3(),{connectOnClick:k,noPanClassName:j,rfId:N}=cxe(),{connectingFrom:A,connectingTo:R,clickConnecting:M,isPossibleEndHandle:T,connectionInProcess:O,clickConnectionInProcess:z,valid:q}=gn(dxe(E,v,e),or);E||w.getState().onError?.("010",Fi.error010());const $=F=>{const{defaultEdgeOptions:P,onConnect:I,hasDefaultEdges:Y}=w.getState(),Z={...P,...F};if(Y){const{edges:D,setEdges:H,onError:U}=w.getState();H(N3(Z,D,{onError:U}))}I?.(Z),c?.(Z)},G=F=>{if(!E)return;const P=i3(F.nativeEvent);if(o&&(P&&F.button===0||!P)){const I=w.getState();WS.onPointerDown(F.nativeEvent,{handleDomNode:F.currentTarget,autoPanOnConnect:I.autoPanOnConnect,connectionMode:I.connectionMode,connectionRadius:I.connectionRadius,domNode:I.domNode,nodeLookup:I.nodeLookup,lib:I.lib,isTarget:S,handleId:v,nodeId:E,flowId:I.rfId,panBy:I.panBy,cancelConnection:I.cancelConnection,onConnectStart:I.onConnectStart,onConnectEnd:(...Y)=>w.getState().onConnectEnd?.(...Y),updateConnection:I.updateConnection,onConnect:$,isValidConnection:n||((...Y)=>w.getState().isValidConnection?.(...Y)??!0),getTransform:()=>w.getState().transform,getFromHandle:()=>w.getState().connection.fromHandle,autoPanSpeed:I.autoPanSpeed,dragThreshold:I.connectionDragThreshold})}P?p?.(F):m?.(F)},L=F=>{const{onClickConnectStart:P,onClickConnectEnd:I,connectionClickStartHandle:Y,connectionMode:Z,isValidConnection:D,lib:H,rfId:U,nodeLookup:B,connection:X}=w.getState();if(!E||!Y&&!o)return;if(!Y){P?.(F.nativeEvent,{nodeId:E,handleId:v,handleType:e}),w.setState({connectionClickStartHandle:{nodeId:E,type:e,id:v}});return}const J=r3(F.target),Q=n||D,{connection:oe,isValid:W}=WS.isValid(F.nativeEvent,{handle:{nodeId:E,id:v,type:e},connectionMode:Z,fromNodeId:Y.nodeId,fromHandleId:Y.id||null,fromType:Y.type,isValidConnection:Q,flowId:U,doc:J,lib:H,nodeLookup:B});W&&oe&&$(oe);const ne=structuredClone(X);delete ne.inProgress,ne.toPosition=ne.toHandle?ne.toHandle.position:null,I?.(F,ne),w.setState({connectionClickStartHandle:null})};return f.jsx("div",{"data-handleid":v,"data-nodeid":E,"data-handlepos":t,"data-id":`${N}-${E}-${v}-${e}`,className:Er(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",j,u,{source:!S,target:S,connectable:r,connectablestart:o,connectableend:i,clickconnecting:M,connectingfrom:A,connectingto:R,valid:q,connectionindicator:r&&(!O||T)&&(O||z?i:o)}]),onMouseDown:G,onTouchStart:G,onClick:k?L:void 0,ref:y,...g,children:d})}const Zu=b.memo(T3(fxe));function hxe({data:e,isConnectable:t,sourcePosition:n=pt.Bottom}){return f.jsxs(f.Fragment,{children:[e?.label,f.jsx(Zu,{type:"source",position:n,isConnectable:t})]})}function pxe({data:e,isConnectable:t,targetPosition:n=pt.Top,sourcePosition:r=pt.Bottom}){return f.jsxs(f.Fragment,{children:[f.jsx(Zu,{type:"target",position:n,isConnectable:t}),e?.label,f.jsx(Zu,{type:"source",position:r,isConnectable:t})]})}function mxe(){return null}function gxe({data:e,isConnectable:t,targetPosition:n=pt.Top}){return f.jsxs(f.Fragment,{children:[f.jsx(Zu,{type:"target",position:n,isConnectable:t}),e?.label]})}const Sy={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},PO={input:hxe,default:pxe,output:gxe,group:mxe};function yxe(e){return e.internals.handleBounds===void 0?{width:e.width??e.initialWidth??e.style?.width,height:e.height??e.initialHeight??e.style?.height}:{width:e.width??e.style?.width,height:e.height??e.style?.height}}const xxe=e=>{const{width:t,height:n,x:r,y:o}=sp(e.nodeLookup,{filter:i=>!!i.selected});return{width:Di(t)?t:null,height:Di(n)?n:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${r}px,${o}px)`}};function vxe({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const r=Xn(),{width:o,height:i,transformString:s,userSelectionActive:c}=gn(xxe,or),d=D3(),u=b.useRef(null);b.useEffect(()=>{n||u.current?.focus({preventScroll:!0})},[n]);const p=!c&&o!==null&&i!==null;if(O3({nodeRef:u,disabled:!p}),!p)return null;const m=e?y=>{const v=r.getState().nodes.filter(S=>S.selected);e(y,v)}:void 0,g=y=>{Object.prototype.hasOwnProperty.call(Sy,y.key)&&(y.preventDefault(),d({direction:Sy[y.key],factor:y.shiftKey?4:1}))};return f.jsx("div",{className:Er(["react-flow__nodesselection","react-flow__container",t]),style:{transform:s},children:f.jsx("div",{ref:u,className:"react-flow__nodesselection-rect",onContextMenu:m,tabIndex:n?void 0:-1,onKeyDown:n?void 0:g,style:{width:o,height:i}})})}const IO=typeof window<"u"?window:void 0,bxe=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function z3({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:o,onPaneContextMenu:i,onPaneScroll:s,paneClickDistance:c,deleteKeyCode:d,selectionKeyCode:u,selectionOnDrag:p,selectionMode:m,onSelectionStart:g,onSelectionEnd:y,multiSelectionKeyCode:v,panActivationKeyCode:S,zoomActivationKeyCode:w,elementsSelectable:E,zoomOnScroll:k,zoomOnPinch:j,panOnScroll:N,panOnScrollSpeed:A,panOnScrollMode:R,zoomOnDoubleClick:M,panOnDrag:T,autoPanOnSelection:O,defaultViewport:z,translateExtent:q,minZoom:$,maxZoom:G,preventScrolling:L,onSelectionContextMenu:F,noWheelClassName:P,noPanClassName:I,disableKeyboardA11y:Y,onViewportChange:Z,isControlledViewport:D}){const{nodesSelectionActive:H,userSelectionActive:U}=gn(bxe,or),B=vh(u,{target:IO}),X=vh(S,{target:IO}),J=X||T,Q=X||N,oe=p&&J!==!0,W=B||U||oe;return Qye({deleteKeyCode:d,multiSelectionKeyCode:v}),f.jsx(exe,{onPaneContextMenu:i,elementsSelectable:E,zoomOnScroll:k,zoomOnPinch:j,panOnScroll:Q,panActivationKeyPressed:X,panOnScrollSpeed:A,panOnScrollMode:R,zoomOnDoubleClick:M,panOnDrag:!B&&J,defaultViewport:z,translateExtent:q,minZoom:$,maxZoom:G,zoomActivationKeyCode:w,preventScrolling:L,noWheelClassName:P,noPanClassName:I,onViewportChange:Z,isControlledViewport:D,paneClickDistance:c,selectionOnDrag:oe,children:f.jsxs(oxe,{onSelectionStart:g,onSelectionEnd:y,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:o,onPaneContextMenu:i,onPaneScroll:s,panOnDrag:J,autoPanOnSelection:O,isSelecting:!!W,selectionMode:m,selectionKeyPressed:B,paneClickDistance:c,selectionOnDrag:oe,children:[e,H&&f.jsx(vxe,{onSelectionContextMenu:F,noPanClassName:I,disableKeyboardA11y:Y})]})})}z3.displayName="FlowRenderer";const wxe=b.memo(z3),Sxe=e=>t=>e?PC(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 Exe(e){return gn(b.useCallback(Sxe(e),[e]),or)}const Cxe=e=>e.updateNodeInternals;function kxe(){const e=gn(Cxe),[t]=b.useState(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(n=>{const r=new Map;n.forEach(o=>{const i=o.target.getAttribute("data-id");r.set(i,{id:i,nodeElement:o.target,force:!0})}),e(r)}));return b.useEffect(()=>()=>{t?.disconnect()},[t]),t}function jxe({node:e,nodeType:t,hasDimensions:n,resizeObserver:r}){const o=Xn(),i=b.useRef(null),s=b.useRef(null),c=b.useRef(e.sourcePosition),d=b.useRef(e.targetPosition),u=b.useRef(t),p=n&&!!e.internals.handleBounds;return b.useEffect(()=>{i.current&&!e.hidden&&(!p||s.current!==i.current)&&(s.current&&r?.unobserve(s.current),r?.observe(i.current),s.current=i.current)},[p,e.hidden]),b.useEffect(()=>()=>{s.current&&(r?.unobserve(s.current),s.current=null)},[]),b.useEffect(()=>{if(i.current){const m=u.current!==t,g=c.current!==e.sourcePosition,y=d.current!==e.targetPosition;(m||g||y)&&(u.current=t,c.current=e.sourcePosition,d.current=e.targetPosition,o.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:i.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),i}function Rxe({id:e,onClick:t,onMouseEnter:n,onMouseMove:r,onMouseLeave:o,onContextMenu:i,onDoubleClick:s,nodesDraggable:c,elementsSelectable:d,nodesConnectable:u,nodesFocusable:p,resizeObserver:m,noDragClassName:g,noPanClassName:y,disableKeyboardA11y:v,rfId:S,nodeTypes:w,nodeClickDistance:E,onError:k}){const{node:j,internals:N,isParent:A}=gn(W=>{const ne=W.nodeLookup.get(e),je=W.parentLookup.has(e);return{node:ne,internals:ne.internals,isParent:je}},or);let R=j.type||"default",M=w?.[R]||PO[R];M===void 0&&(k?.("003",Fi.error003(R)),R="default",M=w?.default||PO.default);const T=!!(j.draggable||c&&typeof j.draggable>"u"),O=!!(j.selectable||d&&typeof j.selectable>"u"),z=!!(j.connectable||u&&typeof j.connectable>"u"),q=!!(j.focusable||p&&typeof j.focusable>"u"),$=Xn(),G=t3(j),L=jxe({node:j,nodeType:R,hasDimensions:G,resizeObserver:m}),F=O3({nodeRef:L,disabled:j.hidden||!T,noDragClassName:g,handleSelector:j.dragHandle,nodeId:e,isSelectable:O,nodeClickDistance:E}),P=D3();if(j.hidden)return null;const I=Hi(j),Y=yxe(j),Z=O||T||t||n||r||o,D=n?W=>n(W,{...N.userNode}):void 0,H=r?W=>r(W,{...N.userNode}):void 0,U=o?W=>o(W,{...N.userNode}):void 0,B=i?W=>i(W,{...N.userNode}):void 0,X=s?W=>s(W,{...N.userNode}):void 0,J=W=>{const{selectNodesOnDrag:ne,nodeDragThreshold:je}=$.getState();O&&(!ne||!T||je>0)&&JS({id:e,store:$,nodeRef:L}),t&&t(W,{...N.userNode})},Q=W=>{if(!(o3(W.nativeEvent)||v)){if(qF.includes(W.key)&&O){const ne=W.key==="Escape";JS({id:e,store:$,unselect:ne,nodeRef:L})}else if(T&&j.selected&&Object.prototype.hasOwnProperty.call(Sy,W.key)){W.preventDefault();const{ariaLabelConfig:ne}=$.getState();$.setState({ariaLiveMessage:ne["node.a11yDescription.ariaLiveMessage"]({direction:W.key.replace("Arrow","").toLowerCase(),x:~~N.positionAbsolute.x,y:~~N.positionAbsolute.y})}),P({direction:Sy[W.key],factor:W.shiftKey?4:1})}}},oe=()=>{if(v||!L.current?.matches(":focus-visible"))return;const{transform:W,width:ne,height:je,autoPanOnNodeFocus:Ee,setCenter:pe}=$.getState();if(!Ee)return;PC(new Map([[e,j]]),{x:0,y:0,width:ne,height:je},W,!0).length>0||pe(j.position.x+I.width/2,j.position.y+I.height/2,{zoom:W[2]})};return f.jsx("div",{className:Er(["react-flow__node",`react-flow__node-${R}`,{[y]:T},j.className,{selected:j.selected,selectable:O,parent:A,draggable:T,dragging:F}]),ref:L,style:{zIndex:N.z,transform:`translate(${N.positionAbsolute.x}px,${N.positionAbsolute.y}px)`,pointerEvents:Z?"all":"none",visibility:G?"visible":"hidden",...j.style,...Y},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:D,onMouseMove:H,onMouseLeave:U,onContextMenu:B,onClick:J,onDoubleClick:X,onKeyDown:q?Q:void 0,tabIndex:q?0:void 0,onFocus:q?oe:void 0,role:j.ariaRole??(q?"group":void 0),"aria-roledescription":"node","aria-describedby":v?void 0:`${E3}-${S}`,"aria-label":j.ariaLabel,...j.domAttributes,children:f.jsx(sxe,{value:e,children:f.jsx(M,{id:e,data:j.data,type:R,positionAbsoluteX:N.positionAbsolute.x,positionAbsoluteY:N.positionAbsolute.y,selected:j.selected??!1,selectable:O,draggable:T,deletable:j.deletable??!0,isConnectable:z,sourcePosition:j.sourcePosition,targetPosition:j.targetPosition,dragging:F,dragHandle:j.dragHandle,zIndex:N.z,parentId:j.parentId,...I})})})}var _xe=b.memo(Rxe);const Nxe=e=>({nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function L3(e){const{nodesConnectable:t,nodesFocusable:n,elementsSelectable:r,onError:o}=gn(Nxe,or),i=Exe(e.onlyRenderVisibleElements),s=kxe();return f.jsx("div",{className:"react-flow__nodes",style:qx,children:i.map(c=>f.jsx(_xe,{id:c,nodeTypes:e.nodeTypes,nodeExtent:e.nodeExtent,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,resizeObserver:s,nodesDraggable:e.nodesDraggable??!0,nodesConnectable:t,nodesFocusable:n,elementsSelectable:r,nodeClickDistance:e.nodeClickDistance,onError:o},c))})}L3.displayName="NodeRenderer";const Txe=b.memo(L3);function Mxe(e){return gn(b.useCallback(n=>{if(!e)return n.edges.map(o=>o.id);const r=[];if(n.width&&n.height)for(const o of n.edges){const i=n.nodeLookup.get(o.source),s=n.nodeLookup.get(o.target);i&&s&&Oge({sourceNode:i,targetNode:s,width:n.width,height:n.height,transform:n.transform})&&r.push(o.id)}return r},[e]),or)}const Axe=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e}};return f.jsx("polyline",{className:"arrow",style:n,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},Oxe=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e,fill:e}};return f.jsx("polyline",{className:"arrowclosed",style:n,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},zO={[gh.Arrow]:Axe,[gh.ArrowClosed]:Oxe};function Dxe(e){const t=Xn();return b.useMemo(()=>Object.prototype.hasOwnProperty.call(zO,e)?zO[e]:(t.getState().onError?.("009",Fi.error009(e)),null),[e])}const Pxe=({id:e,type:t,color:n,width:r=12.5,height:o=12.5,markerUnits:i="strokeWidth",strokeWidth:s,orient:c="auto-start-reverse"})=>{const d=Dxe(t);return d?f.jsx("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${r}`,markerHeight:`${o}`,viewBox:"-10 -10 20 20",markerUnits:i,orient:c,refX:"0",refY:"0",children:f.jsx(d,{color:n,strokeWidth:s})}):null},F3=({defaultColor:e,rfId:t})=>{const n=gn(i=>i.edges),r=gn(i=>i.defaultEdgeOptions),o=b.useMemo(()=>Vge(n,{id:t,defaultColor:e,defaultMarkerStart:r?.markerStart,defaultMarkerEnd:r?.markerEnd}),[n,r,t,e]);return o.length?f.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:f.jsx("defs",{children:o.map(i=>f.jsx(Pxe,{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};F3.displayName="MarkerDefinitions";var Ixe=b.memo(F3);function $3({x:e,y:t,label:n,labelStyle:r,labelShowBg:o=!0,labelBgStyle:i,labelBgPadding:s=[2,4],labelBgBorderRadius:c=2,children:d,className:u,...p}){const[m,g]=b.useState({x:1,y:0,width:0,height:0}),y=Er(["react-flow__edge-textwrapper",u]),v=b.useRef(null);return b.useEffect(()=>{if(v.current){const S=v.current.getBBox();g({x:S.x,y:S.y,width:S.width,height:S.height})}},[n]),n?f.jsxs("g",{transform:`translate(${e-m.width/2} ${t-m.height/2})`,className:y,visibility:m.width?"visible":"hidden",...p,children:[o&&f.jsx("rect",{width:m.width+2*s[0],x:-s[0],y:-s[1],height:m.height+2*s[1],className:"react-flow__edge-textbg",style:i,rx:c,ry:c}),f.jsx("text",{className:"react-flow__edge-text",y:m.height/2,dy:"0.3em",ref:v,style:r,children:n}),d]}):null}$3.displayName="EdgeText";const zxe=b.memo($3);function Gu({path:e,labelX:t,labelY:n,label:r,labelStyle:o,labelShowBg:i,labelBgStyle:s,labelBgPadding:c,labelBgBorderRadius:d,interactionWidth:u=20,...p}){return f.jsxs(f.Fragment,{children:[f.jsx("path",{...p,d:e,fill:"none",className:Er(["react-flow__edge-path",p.className])}),u?f.jsx("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:u,className:"react-flow__edge-interaction"}):null,r&&Di(t)&&Di(n)?f.jsx(zxe,{x:t,y:n,label:r,labelStyle:o,labelShowBg:i,labelBgStyle:s,labelBgPadding:c,labelBgBorderRadius:d}):null]})}function LO({pos:e,x1:t,y1:n,x2:r,y2:o}){return e===pt.Left||e===pt.Right?[.5*(t+r),n]:[t,.5*(n+o)]}function V3({sourceX:e,sourceY:t,sourcePosition:n=pt.Bottom,targetX:r,targetY:o,targetPosition:i=pt.Top}){const[s,c]=LO({pos:n,x1:e,y1:t,x2:r,y2:o}),[d,u]=LO({pos:i,x1:r,y1:o,x2:e,y2:t}),[p,m,g,y]=s3({sourceX:e,sourceY:t,targetX:r,targetY:o,sourceControlX:s,sourceControlY:c,targetControlX:d,targetControlY:u});return[`M${e},${t} C${s},${c} ${d},${u} ${r},${o}`,p,m,g,y]}function B3(e){return b.memo(({id:t,sourceX:n,sourceY:r,targetX:o,targetY:i,sourcePosition:s,targetPosition:c,label:d,labelStyle:u,labelShowBg:p,labelBgStyle:m,labelBgPadding:g,labelBgBorderRadius:y,style:v,markerEnd:S,markerStart:w,interactionWidth:E})=>{const[k,j,N]=V3({sourceX:n,sourceY:r,sourcePosition:s,targetX:o,targetY:i,targetPosition:c}),A=e.isInternal?void 0:t;return f.jsx(Gu,{id:A,path:k,labelX:j,labelY:N,label:d,labelStyle:u,labelShowBg:p,labelBgStyle:m,labelBgPadding:g,labelBgBorderRadius:y,style:v,markerEnd:S,markerStart:w,interactionWidth:E})})}const Lxe=B3({isInternal:!1}),H3=B3({isInternal:!0});Lxe.displayName="SimpleBezierEdge";H3.displayName="SimpleBezierEdgeInternal";function U3(e){return b.memo(({id:t,sourceX:n,sourceY:r,targetX:o,targetY:i,label:s,labelStyle:c,labelShowBg:d,labelBgStyle:u,labelBgPadding:p,labelBgBorderRadius:m,style:g,sourcePosition:y=pt.Bottom,targetPosition:v=pt.Top,markerEnd:S,markerStart:w,pathOptions:E,interactionWidth:k})=>{const[j,N,A]=wy({sourceX:n,sourceY:r,sourcePosition:y,targetX:o,targetY:i,targetPosition:v,borderRadius:E?.borderRadius,offset:E?.offset,stepPosition:E?.stepPosition}),R=e.isInternal?void 0:t;return f.jsx(Gu,{id:R,path:j,labelX:N,labelY:A,label:s,labelStyle:c,labelShowBg:d,labelBgStyle:u,labelBgPadding:p,labelBgBorderRadius:m,style:g,markerEnd:S,markerStart:w,interactionWidth:k})})}const q3=U3({isInternal:!1}),Y3=U3({isInternal:!0});q3.displayName="SmoothStepEdge";Y3.displayName="SmoothStepEdgeInternal";function Z3(e){return b.memo(({id:t,...n})=>{const r=e.isInternal?void 0:t;return f.jsx(q3,{...n,id:r,pathOptions:b.useMemo(()=>({borderRadius:0,offset:n.pathOptions?.offset}),[n.pathOptions?.offset])})})}const Fxe=Z3({isInternal:!1}),G3=Z3({isInternal:!0});Fxe.displayName="StepEdge";G3.displayName="StepEdgeInternal";function K3(e){return b.memo(({id:t,sourceX:n,sourceY:r,targetX:o,targetY:i,label:s,labelStyle:c,labelShowBg:d,labelBgStyle:u,labelBgPadding:p,labelBgBorderRadius:m,style:g,markerEnd:y,markerStart:v,interactionWidth:S})=>{const[w,E,k]=c3({sourceX:n,sourceY:r,targetX:o,targetY:i}),j=e.isInternal?void 0:t;return f.jsx(Gu,{id:j,path:w,labelX:E,labelY:k,label:s,labelStyle:c,labelShowBg:d,labelBgStyle:u,labelBgPadding:p,labelBgBorderRadius:m,style:g,markerEnd:y,markerStart:v,interactionWidth:S})})}const $xe=K3({isInternal:!1}),X3=K3({isInternal:!0});$xe.displayName="StraightEdge";X3.displayName="StraightEdgeInternal";function Q3(e){return b.memo(({id:t,sourceX:n,sourceY:r,targetX:o,targetY:i,sourcePosition:s=pt.Bottom,targetPosition:c=pt.Top,label:d,labelStyle:u,labelShowBg:p,labelBgStyle:m,labelBgPadding:g,labelBgBorderRadius:y,style:v,markerEnd:S,markerStart:w,pathOptions:E,interactionWidth:k})=>{const[j,N,A]=a3({sourceX:n,sourceY:r,sourcePosition:s,targetX:o,targetY:i,targetPosition:c,curvature:E?.curvature}),R=e.isInternal?void 0:t;return f.jsx(Gu,{id:R,path:j,labelX:N,labelY:A,label:d,labelStyle:u,labelShowBg:p,labelBgStyle:m,labelBgPadding:g,labelBgBorderRadius:y,style:v,markerEnd:S,markerStart:w,interactionWidth:k})})}const Vxe=Q3({isInternal:!1}),W3=Q3({isInternal:!0});Vxe.displayName="BezierEdge";W3.displayName="BezierEdgeInternal";const FO={default:W3,straight:X3,step:G3,smoothstep:Y3,simplebezier:H3},$O={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null,zIndex:void 0},Bxe=(e,t,n)=>n===pt.Left?e-t:n===pt.Right?e+t:e,Hxe=(e,t,n)=>n===pt.Top?e-t:n===pt.Bottom?e+t:e,VO="react-flow__edgeupdater";function BO({position:e,centerX:t,centerY:n,radius:r=10,onMouseDown:o,onMouseEnter:i,onMouseOut:s,type:c}){return f.jsx("circle",{onMouseDown:o,onMouseEnter:i,onMouseOut:s,className:Er([VO,`${VO}-${c}`]),cx:Bxe(t,r,e),cy:Hxe(n,r,e),r,stroke:"transparent",fill:"transparent"})}function Uxe({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:r,sourceY:o,targetX:i,targetY:s,sourcePosition:c,targetPosition:d,onReconnect:u,onReconnectStart:p,onReconnectEnd:m,setReconnecting:g,setUpdateHover:y}){const v=Xn(),S=(N,A)=>{if(N.button!==0)return;const{autoPanOnConnect:R,domNode:M,connectionMode:T,connectionRadius:O,lib:z,onConnectStart:q,cancelConnection:$,nodeLookup:G,rfId:L,panBy:F,updateConnection:P}=v.getState(),I=A.type==="target",Y=(H,U)=>{g(!1),m?.(H,n,A.type,U)},Z=H=>u?.(n,H),D=(H,U)=>{g(!0),p?.(N,n,A.type),q?.(H,U)};WS.onPointerDown(N.nativeEvent,{autoPanOnConnect:R,connectionMode:T,connectionRadius:O,domNode:M,handleId:A.id,nodeId:A.nodeId,nodeLookup:G,isTarget:I,edgeUpdaterType:A.type,lib:z,flowId:L,cancelConnection:$,panBy:F,isValidConnection:(...H)=>v.getState().isValidConnection?.(...H)??!0,onConnect:Z,onConnectStart:D,onConnectEnd:(...H)=>v.getState().onConnectEnd?.(...H),onReconnectEnd:Y,updateConnection:P,getTransform:()=>v.getState().transform,getFromHandle:()=>v.getState().connection.fromHandle,dragThreshold:v.getState().connectionDragThreshold,handleDomNode:N.currentTarget})},w=N=>S(N,{nodeId:n.target,id:n.targetHandle??null,type:"target"}),E=N=>S(N,{nodeId:n.source,id:n.sourceHandle??null,type:"source"}),k=()=>y(!0),j=()=>y(!1);return f.jsxs(f.Fragment,{children:[(e===!0||e==="source")&&f.jsx(BO,{position:c,centerX:r,centerY:o,radius:t,onMouseDown:w,onMouseEnter:k,onMouseOut:j,type:"source"}),(e===!0||e==="target")&&f.jsx(BO,{position:d,centerX:i,centerY:s,radius:t,onMouseDown:E,onMouseEnter:k,onMouseOut:j,type:"target"})]})}function qxe({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:r,onClick:o,onDoubleClick:i,onContextMenu:s,onMouseEnter:c,onMouseMove:d,onMouseLeave:u,reconnectRadius:p,onReconnect:m,onReconnectStart:g,onReconnectEnd:y,rfId:v,edgeTypes:S,noPanClassName:w,onError:E,disableKeyboardA11y:k}){let j=gn(pe=>pe.edgeLookup.get(e));const N=gn(pe=>pe.defaultEdgeOptions);j=N?{...N,...j}:j;let A=j.type||"default",R=S?.[A]||FO[A];R===void 0&&(E?.("011",Fi.error011(A)),A="default",R=S?.default||FO.default);const M=!!(j.focusable||t&&typeof j.focusable>"u"),T=typeof m<"u"&&(j.reconnectable||n&&typeof j.reconnectable>"u"),O=!!(j.selectable||r&&typeof j.selectable>"u"),z=b.useRef(null),[q,$]=b.useState(!1),[G,L]=b.useState(!1),F=Xn(),{zIndex:P=j.zIndex,sourceX:I,sourceY:Y,targetX:Z,targetY:D,sourcePosition:H,targetPosition:U}=gn(b.useCallback(pe=>{const re=pe.nodeLookup.get(j.source),ge=pe.nodeLookup.get(j.target);if(!re||!ge)return $O;const _e=$ge({id:e,sourceNode:re,targetNode:ge,sourceHandle:j.sourceHandle||null,targetHandle:j.targetHandle||null,connectionMode:pe.connectionMode,onError:E}),De=Age({selected:j.selected,zIndex:j.zIndex,sourceNode:re,targetNode:ge,elevateOnSelect:pe.elevateEdgesOnSelect,zIndexMode:pe.zIndexMode});return{..._e||$O,zIndex:De}},[j.source,j.target,j.sourceHandle,j.targetHandle,j.selected,j.zIndex,E]),or),B=b.useMemo(()=>j.markerStart?`url('#${XS(j.markerStart,v)}')`:void 0,[j.markerStart,v]),X=b.useMemo(()=>j.markerEnd?`url('#${XS(j.markerEnd,v)}')`:void 0,[j.markerEnd,v]);if(j.hidden||I===null||Y===null||Z===null||D===null)return null;const J=pe=>{const{addSelectedEdges:re,unselectNodesAndEdges:ge,multiSelectionActive:_e}=F.getState();O&&(F.setState({nodesSelectionActive:!1}),j.selected&&_e?(ge({nodes:[],edges:[j]}),z.current?.blur()):re([e])),o&&o(pe,j)},Q=i?pe=>{i(pe,{...j})}:void 0,oe=s?pe=>{s(pe,{...j})}:void 0,W=c?pe=>{c(pe,{...j})}:void 0,ne=d?pe=>{d(pe,{...j})}:void 0,je=u?pe=>{u(pe,{...j})}:void 0,Ee=pe=>{if(!k&&qF.includes(pe.key)&&O){const{unselectNodesAndEdges:re,addSelectedEdges:ge}=F.getState();pe.key==="Escape"?(z.current?.blur(),re({edges:[j]})):ge([e])}};return f.jsx("svg",{style:{zIndex:P},children:f.jsxs("g",{className:Er(["react-flow__edge",`react-flow__edge-${A}`,j.className,w,{selected:j.selected,animated:j.animated,inactive:!O&&!o,updating:q,selectable:O}]),onClick:J,onDoubleClick:Q,onContextMenu:oe,onMouseEnter:W,onMouseMove:ne,onMouseLeave:je,onKeyDown:M?Ee:void 0,tabIndex:M?0:void 0,role:j.ariaRole??(M?"group":"img"),"aria-roledescription":"edge","data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":j.ariaLabel===null?void 0:j.ariaLabel||`Edge from ${j.source} to ${j.target}`,"aria-describedby":M?`${C3}-${v}`:void 0,ref:z,...j.domAttributes,children:[!G&&f.jsx(R,{id:e,source:j.source,target:j.target,type:j.type,selected:j.selected,animated:j.animated,selectable:O,deletable:j.deletable??!0,label:j.label,labelStyle:j.labelStyle,labelShowBg:j.labelShowBg,labelBgStyle:j.labelBgStyle,labelBgPadding:j.labelBgPadding,labelBgBorderRadius:j.labelBgBorderRadius,sourceX:I,sourceY:Y,targetX:Z,targetY:D,sourcePosition:H,targetPosition:U,data:j.data,style:j.style,sourceHandleId:j.sourceHandle,targetHandleId:j.targetHandle,markerStart:B,markerEnd:X,pathOptions:"pathOptions"in j?j.pathOptions:void 0,interactionWidth:j.interactionWidth}),T&&f.jsx(Uxe,{edge:j,isReconnectable:T,reconnectRadius:p,onReconnect:m,onReconnectStart:g,onReconnectEnd:y,sourceX:I,sourceY:Y,targetX:Z,targetY:D,sourcePosition:H,targetPosition:U,setUpdateHover:$,setReconnecting:L})]})})}var Yxe=b.memo(qxe);const Zxe=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function J3({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:r,noPanClassName:o,onReconnect:i,onEdgeContextMenu:s,onEdgeMouseEnter:c,onEdgeMouseMove:d,onEdgeMouseLeave:u,onEdgeClick:p,reconnectRadius:m,onEdgeDoubleClick:g,onReconnectStart:y,onReconnectEnd:v,disableKeyboardA11y:S}){const{edgesFocusable:w,edgesReconnectable:E,elementsSelectable:k,onError:j}=gn(Zxe,or),N=Mxe(t);return f.jsxs("div",{className:"react-flow__edges",children:[f.jsx(Ixe,{defaultColor:e,rfId:n}),N.map(A=>f.jsx(Yxe,{id:A,edgesFocusable:w,edgesReconnectable:E,elementsSelectable:k,noPanClassName:o,onReconnect:i,onContextMenu:s,onMouseEnter:c,onMouseMove:d,onMouseLeave:u,onClick:p,reconnectRadius:m,onDoubleClick:g,onReconnectStart:y,onReconnectEnd:v,rfId:n,onError:j,edgeTypes:r,disableKeyboardA11y:S},A))]})}J3.displayName="EdgeRenderer";const Gxe=b.memo(J3),HO=e=>`translate(${e[0]}px,${e[1]}px) scale(${e[2]})`;function Kxe({children:e}){const t=Xn(),n=b.useRef(null),[r]=b.useState(()=>t.getState().transform);return M3(()=>{let o=null;const i=()=>{const s=t.getState().transform;o&&s[0]===o[0]&&s[1]===o[1]&&s[2]===o[2]||(o=s,n.current&&(n.current.style.transform=HO(s)))};return i(),t.subscribe(i)},[t]),f.jsx("div",{ref:n,className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:HO(r)},children:e})}function Xxe(e){const t=UC(),n=b.useRef(!1);b.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const Qxe=e=>e.panZoom?.syncViewport;function Wxe(e){const t=gn(Qxe),n=Xn();return b.useEffect(()=>{e&&(t?.(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function Jxe(e){return e.connection.inProgress?{...e.connection,to:lp(e.connection.to,e.transform)}:{...e.connection}}function eve(e){return Jxe}function tve(e){const t=eve();return gn(t,or)}const nve=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function rve({containerStyle:e,style:t,type:n,component:r}){const{nodesConnectable:o,width:i,height:s,isValid:c,inProgress:d}=gn(nve,or);return!(i&&o&&d)?null:f.jsx("svg",{style:e,width:i,height:s,className:"react-flow__connectionline react-flow__container",children:f.jsx("g",{className:Er(["react-flow__connection",GF(c)]),children:f.jsx(e$,{style:t,type:n,CustomComponent:r,isValid:c})})})}const e$=({style:e,type:t=Ua.Bezier,CustomComponent:n,isValid:r})=>{const{inProgress:o,from:i,fromNode:s,fromHandle:c,fromPosition:d,to:u,toNode:p,toHandle:m,toPosition:g,pointer:y}=tve();if(!o)return;if(n)return f.jsx(n,{connectionLineType:t,connectionLineStyle:e,fromNode:s,fromHandle:c,fromX:i.x,fromY:i.y,toX:u.x,toY:u.y,fromPosition:d,toPosition:g,connectionStatus:GF(r),toNode:p,toHandle:m,pointer:y});let v="";const S={sourceX:i.x,sourceY:i.y,sourcePosition:d,targetX:u.x,targetY:u.y,targetPosition:g};switch(t){case Ua.Bezier:[v]=a3(S);break;case Ua.SimpleBezier:[v]=V3(S);break;case Ua.Step:[v]=wy({...S,borderRadius:0});break;case Ua.SmoothStep:[v]=wy(S);break;default:[v]=c3(S)}return f.jsx("path",{d:v,fill:"none",className:"react-flow__connection-path",style:e})};e$.displayName="ConnectionLine";const ove={};function UO(e=ove){b.useRef(e),Xn(),b.useEffect(()=>{},[e])}function ive(){Xn(),b.useRef(!1),b.useEffect(()=>{},[])}function t$({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:r,onEdgeClick:o,onNodeDoubleClick:i,onEdgeDoubleClick:s,onNodeMouseEnter:c,onNodeMouseMove:d,onNodeMouseLeave:u,onNodeContextMenu:p,onSelectionContextMenu:m,onSelectionStart:g,onSelectionEnd:y,connectionLineType:v,connectionLineStyle:S,connectionLineComponent:w,connectionLineContainerStyle:E,selectionKeyCode:k,selectionOnDrag:j,selectionMode:N,multiSelectionKeyCode:A,panActivationKeyCode:R,zoomActivationKeyCode:M,deleteKeyCode:T,onlyRenderVisibleElements:O,elementsSelectable:z,defaultViewport:q,translateExtent:$,minZoom:G,maxZoom:L,preventScrolling:F,defaultMarkerColor:P,zoomOnScroll:I,zoomOnPinch:Y,panOnScroll:Z,panOnScrollSpeed:D,panOnScrollMode:H,zoomOnDoubleClick:U,panOnDrag:B,autoPanOnSelection:X,onPaneClick:J,onPaneMouseEnter:Q,onPaneMouseMove:oe,onPaneMouseLeave:W,onPaneScroll:ne,onPaneContextMenu:je,paneClickDistance:Ee,nodeClickDistance:pe,onEdgeContextMenu:re,onEdgeMouseEnter:ge,onEdgeMouseMove:_e,onEdgeMouseLeave:De,reconnectRadius:we,onReconnect:$e,onReconnectStart:Me,onReconnectEnd:Le,noDragClassName:He,noWheelClassName:Ge,noPanClassName:ot,disableKeyboardA11y:me,nodeExtent:ke,rfId:de,viewport:ue,onViewportChange:Se,nodesDraggable:Ue}){return UO(e),UO(t),ive(),Xxe(n),Wxe(ue),f.jsx(wxe,{onPaneClick:J,onPaneMouseEnter:Q,onPaneMouseMove:oe,onPaneMouseLeave:W,onPaneContextMenu:je,onPaneScroll:ne,paneClickDistance:Ee,deleteKeyCode:T,selectionKeyCode:k,selectionOnDrag:j,selectionMode:N,onSelectionStart:g,onSelectionEnd:y,multiSelectionKeyCode:A,panActivationKeyCode:R,zoomActivationKeyCode:M,elementsSelectable:z,zoomOnScroll:I,zoomOnPinch:Y,zoomOnDoubleClick:U,panOnScroll:Z,panOnScrollSpeed:D,panOnScrollMode:H,panOnDrag:B,autoPanOnSelection:X,defaultViewport:q,translateExtent:$,minZoom:G,maxZoom:L,onSelectionContextMenu:m,preventScrolling:F,noDragClassName:He,noWheelClassName:Ge,noPanClassName:ot,disableKeyboardA11y:me,onViewportChange:Se,isControlledViewport:!!ue,children:f.jsxs(Kxe,{children:[f.jsx(Gxe,{edgeTypes:t,onEdgeClick:o,onEdgeDoubleClick:s,onReconnect:$e,onReconnectStart:Me,onReconnectEnd:Le,onlyRenderVisibleElements:O,onEdgeContextMenu:re,onEdgeMouseEnter:ge,onEdgeMouseMove:_e,onEdgeMouseLeave:De,reconnectRadius:we,defaultMarkerColor:P,noPanClassName:ot,disableKeyboardA11y:me,rfId:de}),f.jsx(rve,{style:S,type:v,component:w,containerStyle:E}),f.jsx("div",{className:"react-flow__edgelabel-renderer"}),f.jsx(Txe,{nodeTypes:e,onNodeClick:r,onNodeDoubleClick:i,onNodeMouseEnter:c,onNodeMouseMove:d,onNodeMouseLeave:u,onNodeContextMenu:p,nodeClickDistance:pe,onlyRenderVisibleElements:O,noPanClassName:ot,noDragClassName:He,disableKeyboardA11y:me,nodeExtent:ke,rfId:de,nodesDraggable:Ue}),f.jsx("div",{className:"react-flow__viewport-portal"})]})})}t$.displayName="GraphView";const sve=b.memo(t$),ave=e3(),qO=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:o,height:i,fitView:s,fitViewOptions:c,minZoom:d=.5,maxZoom:u=2,nodeOrigin:p,nodeExtent:m,zIndexMode:g="basic"}={})=>{const y=new Map,v=new Map,S=new Map,w=new Map,E=r??t??[],k=n??e??[],j=p??[0,0],N=m??ph;f3(S,w,E);const{nodesInitialized:A}=QS(k,y,v,{nodeOrigin:j,nodeExtent:N,zIndexMode:g});let R=[0,0,1];if(s&&o&&i){const M=sp(y,{filter:q=>!!((q.width||q.initialWidth)&&(q.height||q.initialHeight))}),{x:T,y:O,zoom:z}=zC(M,o,i,d,u,c?.padding??.1);R=[T,O,z]}return{rfId:"1",width:o??0,height:i??0,transform:R,nodes:k,nodesInitialized:A,nodeLookup:y,parentLookup:v,edges:E,edgeLookup:w,connectionLookup:S,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:r!==void 0,panZoom:null,minZoom:d,maxZoom:u,translateExtent:ph,nodeExtent:N,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:Hu.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:j,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:s??!1,fitViewOptions:c,fitViewResolver:null,connection:{...ZF},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:ave,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:YF,zIndexMode:g,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},lve=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:o,height:i,fitView:s,fitViewOptions:c,minZoom:d,maxZoom:u,nodeOrigin:p,nodeExtent:m,zIndexMode:g})=>Eye((y,v)=>{async function S(){const{nodeLookup:w,panZoom:E,fitViewOptions:k,fitViewResolver:j,width:N,height:A,minZoom:R,maxZoom:M}=v();E&&(await kge({nodes:w,width:N,height:A,panZoom:E,minZoom:R,maxZoom:M},k),j?.resolve(!0),y({fitViewResolver:null}))}return{...qO({nodes:e,edges:t,width:o,height:i,fitView:s,fitViewOptions:c,minZoom:d,maxZoom:u,nodeOrigin:p,nodeExtent:m,defaultNodes:n,defaultEdges:r,zIndexMode:g}),setNodes:w=>{const{nodeLookup:E,parentLookup:k,nodeOrigin:j,nodeExtent:N,elevateNodesOnSelect:A,fitViewQueued:R,zIndexMode:M,nodesSelectionActive:T}=v(),{nodesInitialized:O,hasSelectedNodes:z}=QS(w,E,k,{nodeOrigin:j,nodeExtent:N,elevateNodesOnSelect:A,checkEquality:!0,zIndexMode:M}),q=T&&z;R&&O?(S(),y({nodes:w,nodesInitialized:O,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:q})):y({nodes:w,nodesInitialized:O,nodesSelectionActive:q})},setEdges:w=>{const{connectionLookup:E,edgeLookup:k}=v();f3(E,k,w),y({edges:w})},setDefaultNodesAndEdges:(w,E)=>{if(w){const{setNodes:k}=v();k(w),y({hasDefaultNodes:!0})}if(E){const{setEdges:k}=v();k(E),y({hasDefaultEdges:!0})}},updateNodeInternals:w=>{const{triggerNodeChanges:E,nodeLookup:k,parentLookup:j,domNode:N,nodeOrigin:A,nodeExtent:R,debug:M,fitViewQueued:T,zIndexMode:O}=v(),{changes:z,updatedInternals:q}=Gge(w,k,j,N,A,R,O);q&&(Uge(k,j,{nodeOrigin:A,nodeExtent:R,zIndexMode:O}),T?(S(),y({fitViewQueued:!1,fitViewOptions:void 0})):y({}),z?.length>0&&(M&&console.log("React Flow: trigger node changes",z),E?.(z)))},updateNodePositions:(w,E=!1)=>{const k=[];let j=[];const{nodeLookup:N,triggerNodeChanges:A,connection:R,updateConnection:M,onNodesChangeMiddlewareMap:T}=v();for(const[O,z]of w){const q=N.get(O),$=!!(q?.expandParent&&q?.parentId&&z?.position),G={id:O,type:"position",position:$?{x:Math.max(0,z.position.x),y:Math.max(0,z.position.y)}:z.position,dragging:E};if(q&&R.inProgress&&R.fromNode.id===q.id){const L=uc(q,R.fromHandle,pt.Left,!0);M({...R,from:L})}$&&q.parentId&&k.push({id:O,parentId:q.parentId,rect:{...z.internals.positionAbsolute,width:z.measured.width??0,height:z.measured.height??0}}),j.push(G)}if(k.length>0){const{parentLookup:O,nodeOrigin:z}=v(),q=HC(k,N,O,z);j.push(...q)}for(const O of T.values())j=O(j);A(j)},triggerNodeChanges:w=>{const{onNodesChange:E,setNodes:k,nodes:j,hasDefaultNodes:N,debug:A}=v();if(w?.length){if(N){const R=R3(w,j);k(R)}A&&console.log("React Flow: trigger node changes",w),E?.(w)}},triggerEdgeChanges:w=>{const{onEdgesChange:E,setEdges:k,edges:j,hasDefaultEdges:N,debug:A}=v();if(w?.length){if(N){const R=_3(w,j);k(R)}A&&console.log("React Flow: trigger edge changes",w),E?.(w)}},addSelectedNodes:w=>{const{multiSelectionActive:E,edgeLookup:k,nodeLookup:j,triggerNodeChanges:N,triggerEdgeChanges:A}=v();if(E){const R=w.map(M=>Ll(M,!0));N(R);return}N(Su(j,new Set([...w]),!0)),A(Su(k))},addSelectedEdges:w=>{const{multiSelectionActive:E,edgeLookup:k,nodeLookup:j,triggerNodeChanges:N,triggerEdgeChanges:A}=v();if(E){const R=w.map(M=>Ll(M,!0));A(R);return}A(Su(k,new Set([...w]))),N(Su(j,new Set,!0))},unselectNodesAndEdges:({nodes:w,edges:E}={})=>{const{edges:k,nodes:j,nodeLookup:N,triggerNodeChanges:A,triggerEdgeChanges:R}=v(),M=w||j,T=E||k,O=[];for(const q of M){if(!q.selected)continue;const $=N.get(q.id);$&&($.selected=!1),O.push(Ll(q.id,!1))}const z=[];for(const q of T)q.selected&&z.push(Ll(q.id,!1));A(O),R(z)},setMinZoom:w=>{const{panZoom:E,maxZoom:k}=v();E?.setScaleExtent([w,k]),y({minZoom:w})},setMaxZoom:w=>{const{panZoom:E,minZoom:k}=v();E?.setScaleExtent([k,w]),y({maxZoom:w})},setTranslateExtent:w=>{v().panZoom?.setTranslateExtent(w),y({translateExtent:w})},resetSelectedElements:()=>{const{edges:w,nodes:E,triggerNodeChanges:k,triggerEdgeChanges:j,elementsSelectable:N}=v();if(!N)return;const A=E.reduce((M,T)=>T.selected?[...M,Ll(T.id,!1)]:M,[]),R=w.reduce((M,T)=>T.selected?[...M,Ll(T.id,!1)]:M,[]);k(A),j(R)},setNodeExtent:w=>{const{nodes:E,nodeLookup:k,parentLookup:j,nodeOrigin:N,elevateNodesOnSelect:A,nodeExtent:R,zIndexMode:M}=v();w[0][0]===R[0][0]&&w[0][1]===R[0][1]&&w[1][0]===R[1][0]&&w[1][1]===R[1][1]||(QS(E,k,j,{nodeOrigin:N,nodeExtent:w,elevateNodesOnSelect:A,checkEquality:!1,zIndexMode:M}),y({nodeExtent:w}))},panBy:w=>{const{transform:E,width:k,height:j,panZoom:N,translateExtent:A}=v();return Kge({delta:w,panZoom:N,transform:E,translateExtent:A,width:k,height:j})},setCenter:async(w,E,k)=>{const{width:j,height:N,maxZoom:A,panZoom:R}=v();if(!R)return!1;const M=typeof k?.zoom<"u"?k.zoom:A;return await R.setViewport({x:j/2-w*M,y:N/2-E*M,zoom:M},{duration:k?.duration,ease:k?.ease,interpolate:k?.interpolate}),!0},cancelConnection:()=>{y({connection:{...ZF}})},updateConnection:w=>{y({connection:w})},reset:()=>y({...qO()})}},Object.is);function cve({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:r,initialWidth:o,initialHeight:i,initialMinZoom:s,initialMaxZoom:c,initialFitViewOptions:d,fitView:u,nodeOrigin:p,nodeExtent:m,zIndexMode:g,children:y}){const[v]=b.useState(()=>lve({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:o,height:i,fitView:u,minZoom:s,maxZoom:c,fitViewOptions:d,nodeOrigin:p,nodeExtent:m,zIndexMode:g}));return f.jsx(Cye,{value:v,children:f.jsx(Zye,{children:f.jsx(lxe,{children:y})})})}function uve({children:e,nodes:t,edges:n,defaultNodes:r,defaultEdges:o,width:i,height:s,fitView:c,fitViewOptions:d,minZoom:u,maxZoom:p,nodeOrigin:m,nodeExtent:g,zIndexMode:y}){return b.useContext(Hx)?f.jsx(f.Fragment,{children:e}):f.jsx(cve,{initialNodes:t,initialEdges:n,defaultNodes:r,defaultEdges:o,initialWidth:i,initialHeight:s,fitView:c,initialFitViewOptions:d,initialMinZoom:u,initialMaxZoom:p,nodeOrigin:m,nodeExtent:g,zIndexMode:y,children:e})}const dve={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function fve({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:o,nodeTypes:i,edgeTypes:s,onNodeClick:c,onEdgeClick:d,onInit:u,onMove:p,onMoveStart:m,onMoveEnd:g,onConnect:y,onConnectStart:v,onConnectEnd:S,onClickConnectStart:w,onClickConnectEnd:E,onNodeMouseEnter:k,onNodeMouseMove:j,onNodeMouseLeave:N,onNodeContextMenu:A,onNodeDoubleClick:R,onNodeDragStart:M,onNodeDrag:T,onNodeDragStop:O,onNodesDelete:z,onEdgesDelete:q,onDelete:$,onSelectionChange:G,onSelectionDragStart:L,onSelectionDrag:F,onSelectionDragStop:P,onSelectionContextMenu:I,onSelectionStart:Y,onSelectionEnd:Z,onBeforeDelete:D,connectionMode:H,connectionLineType:U=Ua.Bezier,connectionLineStyle:B,connectionLineComponent:X,connectionLineContainerStyle:J,deleteKeyCode:Q="Backspace",selectionKeyCode:oe="Shift",selectionOnDrag:W=!1,selectionMode:ne=mh.Full,panActivationKeyCode:je="Space",multiSelectionKeyCode:Ee=xh()?"Meta":"Control",zoomActivationKeyCode:pe=xh()?"Meta":"Control",snapToGrid:re,snapGrid:ge,onlyRenderVisibleElements:_e=!1,selectNodesOnDrag:De,nodesDraggable:we,autoPanOnNodeFocus:$e,nodesConnectable:Me,nodesFocusable:Le,nodeOrigin:He=k3,edgesFocusable:Ge,edgesReconnectable:ot,elementsSelectable:me=!0,defaultViewport:ke=zye,minZoom:de=.5,maxZoom:ue=2,translateExtent:Se=ph,preventScrolling:Ue=!0,nodeExtent:Ye,defaultMarkerColor:kt="#b1b1b7",zoomOnScroll:ee=!0,zoomOnPinch:ie=!0,panOnScroll:le=!1,panOnScrollSpeed:Ce=.5,panOnScrollMode:ve=Zl.Free,zoomOnDoubleClick:Be=!0,panOnDrag:Pe=!0,onPaneClick:qe,onPaneMouseEnter:Ke,onPaneMouseMove:nt,onPaneMouseLeave:it,onPaneScroll:jt,onPaneContextMenu:Ut,paneClickDistance:qt=1,nodeClickDistance:at=0,children:Rt,onReconnect:Gt,onReconnectStart:Nt,onReconnectEnd:Qn,onEdgeContextMenu:hn,onEdgeDoubleClick:In,onEdgeMouseEnter:te,onEdgeMouseMove:ae,onEdgeMouseLeave:fe,reconnectRadius:Ae=10,onNodesChange:ze,onEdgesChange:Je,noDragClassName:Xe="nodrag",noWheelClassName:et="nowheel",noPanClassName:tt="nopan",fitView:dt,fitViewOptions:mt,connectOnClick:Ft,attributionPosition:St,proOptions:Kt,defaultEdgeOptions:pn,elevateNodesOnSelect:zn=!0,elevateEdgesOnSelect:xn=!1,disableKeyboardA11y:sn=!1,autoPanOnConnect:tr,autoPanOnNodeDrag:un,autoPanOnSelection:qi=!0,autoPanSpeed:Ao,connectionRadius:Xr,isValidConnection:zr,onError:fo,style:la,id:ho,nodeDragThreshold:ca,connectionDragThreshold:bi,viewport:wi,onViewportChange:Tt,width:jn,height:io,colorMode:Oo="light",debug:ua,onScroll:vs,ariaLabelConfig:Sn,zIndexMode:Jo="basic",...Lr},hl){const Ec=ho||"1",gd=Vye(Oo),da=b.useCallback(yd=>{yd.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),vs?.(yd)},[vs]);return f.jsx("div",{"data-testid":"rf__wrapper",...Lr,onScroll:da,style:{...la,...dve},ref:hl,className:Er(["react-flow",o,gd]),id:ho,role:"application",children:f.jsxs(uve,{nodes:e,edges:t,width:jn,height:io,fitView:dt,fitViewOptions:mt,minZoom:de,maxZoom:ue,nodeOrigin:He,nodeExtent:Ye,zIndexMode:Jo,children:[f.jsx($ye,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:y,onConnectStart:v,onConnectEnd:S,onClickConnectStart:w,onClickConnectEnd:E,nodesDraggable:we,autoPanOnNodeFocus:$e,nodesConnectable:Me,nodesFocusable:Le,edgesFocusable:Ge,edgesReconnectable:ot,elementsSelectable:me,elevateNodesOnSelect:zn,elevateEdgesOnSelect:xn,minZoom:de,maxZoom:ue,nodeExtent:Ye,onNodesChange:ze,onEdgesChange:Je,snapToGrid:re,snapGrid:ge,connectionMode:H,translateExtent:Se,connectOnClick:Ft,defaultEdgeOptions:pn,fitView:dt,fitViewOptions:mt,onNodesDelete:z,onEdgesDelete:q,onDelete:$,onNodeDragStart:M,onNodeDrag:T,onNodeDragStop:O,onSelectionDrag:F,onSelectionDragStart:L,onSelectionDragStop:P,onMove:p,onMoveStart:m,onMoveEnd:g,noPanClassName:tt,nodeOrigin:He,rfId:Ec,autoPanOnConnect:tr,autoPanOnNodeDrag:un,autoPanSpeed:Ao,onError:fo,connectionRadius:Xr,isValidConnection:zr,selectNodesOnDrag:De,nodeDragThreshold:ca,connectionDragThreshold:bi,onBeforeDelete:D,debug:ua,ariaLabelConfig:Sn,zIndexMode:Jo}),f.jsx(sve,{onInit:u,onNodeClick:c,onEdgeClick:d,onNodeMouseEnter:k,onNodeMouseMove:j,onNodeMouseLeave:N,onNodeContextMenu:A,onNodeDoubleClick:R,nodeTypes:i,edgeTypes:s,connectionLineType:U,connectionLineStyle:B,connectionLineComponent:X,connectionLineContainerStyle:J,selectionKeyCode:oe,selectionOnDrag:W,selectionMode:ne,deleteKeyCode:Q,multiSelectionKeyCode:Ee,panActivationKeyCode:je,zoomActivationKeyCode:pe,onlyRenderVisibleElements:_e,defaultViewport:ke,translateExtent:Se,minZoom:de,maxZoom:ue,preventScrolling:Ue,zoomOnScroll:ee,zoomOnPinch:ie,zoomOnDoubleClick:Be,panOnScroll:le,panOnScrollSpeed:Ce,panOnScrollMode:ve,panOnDrag:Pe,autoPanOnSelection:qi,onPaneClick:qe,onPaneMouseEnter:Ke,onPaneMouseMove:nt,onPaneMouseLeave:it,onPaneScroll:jt,onPaneContextMenu:Ut,paneClickDistance:qt,nodeClickDistance:at,onSelectionContextMenu:I,onSelectionStart:Y,onSelectionEnd:Z,onReconnect:Gt,onReconnectStart:Nt,onReconnectEnd:Qn,onEdgeContextMenu:hn,onEdgeDoubleClick:In,onEdgeMouseEnter:te,onEdgeMouseMove:ae,onEdgeMouseLeave:fe,reconnectRadius:Ae,defaultMarkerColor:kt,noDragClassName:Xe,noWheelClassName:et,noPanClassName:tt,rfId:Ec,disableKeyboardA11y:sn,nodeExtent:Ye,viewport:wi,onViewportChange:Tt,nodesDraggable:we}),f.jsx(Iye,{onSelectionChange:G}),Rt,f.jsx(Mye,{proOptions:Kt,position:St}),f.jsx(Tye,{rfId:Ec,disableKeyboardA11y:sn})]})})}var hve=T3(fve);const pve=e=>e.domNode?.querySelector(".react-flow__edgelabel-renderer");function mve({children:e}){const t=gn(pve);return t?Go.createPortal(e,t):null}function gve(e){const[t,n]=b.useState(e),r=b.useCallback(o=>n(i=>R3(o,i)),[]);return[t,n,r]}function yve(e){const[t,n]=b.useState(e),r=b.useCallback(o=>n(i=>_3(o,i)),[]);return[t,n,r]}function xve({dimensions:e,lineWidth:t,variant:n,className:r}){return f.jsx("path",{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:Er(["react-flow__background-pattern",n,r])})}function vve({radius:e,className:t}){return f.jsx("circle",{cx:e,cy:e,r:e,className:Er(["react-flow__background-pattern","dots",t])})}var Ks;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(Ks||(Ks={}));const bve={[Ks.Dots]:1,[Ks.Lines]:1,[Ks.Cross]:6},wve=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function n$({id:e,variant:t=Ks.Dots,gap:n=20,size:r,lineWidth:o=1,offset:i=0,color:s,bgColor:c,style:d,className:u,patternClassName:p}){const m=b.useRef(null),{transform:g,patternId:y}=gn(wve,or),v=r||bve[t],S=t===Ks.Dots,w=t===Ks.Cross,E=Array.isArray(n)?n:[n,n],k=[E[0]*g[2]||1,E[1]*g[2]||1],j=v*g[2],N=Array.isArray(i)?i:[i,i],A=w?[j,j]:k,R=[N[0]*g[2]+A[0]/2,N[1]*g[2]+A[1]/2],M=`${y}${e||""}`;return f.jsxs("svg",{className:Er(["react-flow__background",u]),style:{...d,...qx,"--xy-background-color-props":c,"--xy-background-pattern-color-props":s},ref:m,"data-testid":"rf__background",children:[f.jsx("pattern",{id:M,x:g[0]%k[0],y:g[1]%k[1],width:k[0],height:k[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${R[0]},-${R[1]})`,children:S?f.jsx(vve,{radius:j/2,className:p}):f.jsx(xve,{dimensions:A,lineWidth:o,variant:t,className:p})}),f.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${M})`})]})}n$.displayName="Background";const Sve=b.memo(n$);function Eve(){return f.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:f.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function Cve(){return f.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:f.jsx("path",{d:"M0 0h32v4.2H0z"})})}function kve(){return f.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:f.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 jve(){return f.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:f.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 Rve(){return f.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:f.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 cg({children:e,className:t,...n}){return f.jsx("button",{type:"button",className:Er(["react-flow__controls-button",t]),...n,children:e})}const _ve=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function r$({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:r=!0,fitViewOptions:o,onZoomIn:i,onZoomOut:s,onFitView:c,onInteractiveChange:d,className:u,children:p,position:m="bottom-left",orientation:g="vertical","aria-label":y}){const v=Xn(),{isInteractive:S,minZoomReached:w,maxZoomReached:E,ariaLabelConfig:k}=gn(_ve,or),{zoomIn:j,zoomOut:N,fitView:A}=UC(),R=()=>{j(),i?.()},M=()=>{N(),s?.()},T=()=>{A(o),c?.()},O=()=>{v.setState({nodesDraggable:!S,nodesConnectable:!S,elementsSelectable:!S}),d?.(!S)},z=g==="horizontal"?"horizontal":"vertical";return f.jsxs(Ux,{className:Er(["react-flow__controls",z,u]),position:m,style:e,"data-testid":"rf__controls","aria-label":y??k["controls.ariaLabel"],children:[t&&f.jsxs(f.Fragment,{children:[f.jsx(cg,{onClick:R,className:"react-flow__controls-zoomin",title:k["controls.zoomIn.ariaLabel"],"aria-label":k["controls.zoomIn.ariaLabel"],disabled:E,children:f.jsx(Eve,{})}),f.jsx(cg,{onClick:M,className:"react-flow__controls-zoomout",title:k["controls.zoomOut.ariaLabel"],"aria-label":k["controls.zoomOut.ariaLabel"],disabled:w,children:f.jsx(Cve,{})})]}),n&&f.jsx(cg,{className:"react-flow__controls-fitview",onClick:T,title:k["controls.fitView.ariaLabel"],"aria-label":k["controls.fitView.ariaLabel"],children:f.jsx(kve,{})}),r&&f.jsx(cg,{className:"react-flow__controls-interactive",onClick:O,title:k["controls.interactive.ariaLabel"],"aria-label":k["controls.interactive.ariaLabel"],children:S?f.jsx(Rve,{}):f.jsx(jve,{})}),p]})}r$.displayName="Controls";const Nve=b.memo(r$);function Tve({id:e,x:t,y:n,width:r,height:o,style:i,color:s,strokeColor:c,strokeWidth:d,className:u,borderRadius:p,shapeRendering:m,selected:g,onClick:y}){const{background:v,backgroundColor:S}=i||{},w=s||v||S;return f.jsx("rect",{className:Er(["react-flow__minimap-node",{selected:g},u]),x:t,y:n,rx:p,ry:p,width:r,height:o,style:{fill:w,stroke:c,strokeWidth:d},shapeRendering:m,onClick:y?E=>y(E,e):void 0})}const Mve=b.memo(Tve),Ave=e=>e.nodes.map(t=>t.id),uw=e=>e instanceof Function?e:()=>e;function Ove({nodeStrokeColor:e,nodeColor:t,nodeClassName:n="",nodeBorderRadius:r=5,nodeStrokeWidth:o,nodeComponent:i=Mve,onClick:s}){const c=gn(Ave,or),d=uw(t),u=uw(e),p=uw(n),m=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return f.jsx(f.Fragment,{children:c.map(g=>f.jsx(Pve,{id:g,nodeColorFunc:d,nodeStrokeColorFunc:u,nodeClassNameFunc:p,nodeBorderRadius:r,nodeStrokeWidth:o,NodeComponent:i,onClick:s,shapeRendering:m},g))})}function Dve({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:r,nodeBorderRadius:o,nodeStrokeWidth:i,shapeRendering:s,NodeComponent:c,onClick:d}){const{node:u,x:p,y:m,width:g,height:y}=gn(v=>{const S=v.nodeLookup.get(e);if(!S)return{node:void 0,x:0,y:0,width:0,height:0};const w=S.internals.userNode,{x:E,y:k}=S.internals.positionAbsolute,{width:j,height:N}=Hi(w);return{node:w,x:E,y:k,width:j,height:N}},or);return!u||u.hidden||!t3(u)?null:f.jsx(c,{x:p,y:m,width:g,height:y,style:u.style,selected:!!u.selected,className:r(u),color:t(u),borderRadius:o,strokeColor:n(u),strokeWidth:i,shapeRendering:s,onClick:d,id:u.id})}const Pve=b.memo(Dve);var Ive=b.memo(Ove);const zve=200,Lve=150,Fve=e=>!e.hidden,$ve=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?WF(sp(e.nodeLookup,{filter:Fve}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},YO=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,Vve=(e,t)=>YO(e.viewBB,t.viewBB)&&YO(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,Bve="react-flow__minimap-desc";function o$({style:e,className:t,nodeStrokeColor:n,nodeColor:r,nodeClassName:o="",nodeBorderRadius:i=5,nodeStrokeWidth:s,nodeComponent:c,bgColor:d,maskColor:u,maskStrokeColor:p,maskStrokeWidth:m,position:g="bottom-right",onClick:y,onNodeClick:v,pannable:S=!1,zoomable:w=!1,ariaLabel:E,inversePan:k,zoomStep:j=1,offsetScale:N=5}){const A=Xn(),R=b.useRef(null),{boundingRect:M,viewBB:T,rfId:O,panZoom:z,translateExtent:q,flowWidth:$,flowHeight:G,ariaLabelConfig:L}=gn($ve,Vve),F=e?.width??zve,P=e?.height??Lve,I=M.width/F,Y=M.height/P,Z=Math.max(I,Y),D=Z*F,H=Z*P,U=N*Z,B=M.x-(D-M.width)/2-U,X=M.y-(H-M.height)/2-U,J=D+U*2,Q=H+U*2,oe=`${Bve}-${O}`,W=b.useRef(0),ne=b.useRef();W.current=Z,b.useEffect(()=>{if(R.current&&z)return ne.current=oye({domNode:R.current,panZoom:z,getTransform:()=>A.getState().transform,getViewScale:()=>W.current}),()=>{ne.current?.destroy()}},[z]),b.useEffect(()=>{ne.current?.update({translateExtent:q,width:$,height:G,inversePan:k,pannable:S,zoomStep:j,zoomable:w})},[S,w,k,j,q,$,G]);const je=y?re=>{const[ge,_e]=ne.current?.pointer(re)||[0,0];y(re,{x:ge,y:_e})}:void 0,Ee=v?b.useCallback((re,ge)=>{const _e=A.getState().nodeLookup.get(ge).internals.userNode;v(re,_e)},[]):void 0,pe=E??L["minimap.ariaLabel"];return f.jsx(Ux,{position:g,style:{...e,"--xy-minimap-background-color-props":typeof d=="string"?d:void 0,"--xy-minimap-mask-background-color-props":typeof u=="string"?u:void 0,"--xy-minimap-mask-stroke-color-props":typeof p=="string"?p:void 0,"--xy-minimap-mask-stroke-width-props":typeof m=="number"?m*Z: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 s=="number"?s:void 0},className:Er(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:f.jsxs("svg",{width:F,height:P,viewBox:`${B} ${X} ${J} ${Q}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":oe,ref:R,onClick:je,children:[pe&&f.jsx("title",{id:oe,children:pe}),f.jsx(Ive,{onClick:Ee,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:i,nodeClassName:o,nodeStrokeWidth:s,nodeComponent:c}),f.jsx("path",{className:"react-flow__minimap-mask",d:`M${B-U},${X-U}h${J+U*2}v${Q+U*2}h${-J-U*2}z
150
+ M${T.x},${T.y}h${T.width}v${T.height}h${-T.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}o$.displayName="MiniMap";const Hve=b.memo(o$),Uve=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,qve={[Yu.Line]:"right",[Yu.Handle]:"bottom-right"};function Yve({nodeId:e,position:t,variant:n=Yu.Handle,className:r,style:o=void 0,children:i,color:s,minWidth:c=10,minHeight:d=10,maxWidth:u=Number.MAX_VALUE,maxHeight:p=Number.MAX_VALUE,keepAspectRatio:m=!1,resizeDirection:g,autoScale:y=!0,shouldResize:v,onResizeStart:S,onResize:w,onResizeEnd:E}){const k=P3(),j=typeof e=="string"?e:k,N=Xn(),A=b.useRef(null),R=n===Yu.Handle,M=gn(b.useCallback(Uve(R&&y),[R,y]),or),T=b.useRef(null),O=t??qve[n];b.useEffect(()=>{if(!(!A.current||!j))return T.current||(T.current=yye({domNode:A.current,nodeId:j,getStoreItems:()=>{const{nodeLookup:q,transform:$,snapGrid:G,snapToGrid:L,nodeOrigin:F,domNode:P}=N.getState();return{nodeLookup:q,transform:$,snapGrid:G,snapToGrid:L,nodeOrigin:F,paneDomNode:P}},onChange:(q,$)=>{const{triggerNodeChanges:G,nodeLookup:L,parentLookup:F,nodeOrigin:P}=N.getState(),I=[],Y={x:q.x,y:q.y},Z=L.get(j);if(Z&&Z.expandParent&&Z.parentId){const D=Z.origin??P,H=q.width??Z.measured.width??0,U=q.height??Z.measured.height??0,B={id:Z.id,parentId:Z.parentId,rect:{width:H,height:U,...n3({x:q.x??Z.position.x,y:q.y??Z.position.y},{width:H,height:U},Z.parentId,L,D)}},X=HC([B],L,F,P);I.push(...X),Y.x=q.x?Math.max(D[0]*H,q.x):void 0,Y.y=q.y?Math.max(D[1]*U,q.y):void 0}if(Y.x!==void 0&&Y.y!==void 0){const D={id:j,type:"position",position:{...Y}};I.push(D)}if(q.width!==void 0&&q.height!==void 0){const H={id:j,type:"dimensions",resizing:!0,setAttributes:g?g==="horizontal"?"width":"height":!0,dimensions:{width:q.width,height:q.height}};I.push(H)}for(const D of $){const H={...D,type:"position"};I.push(H)}G(I)},onEnd:({width:q,height:$})=>{const G={id:j,type:"dimensions",resizing:!1,dimensions:{width:q,height:$}};N.getState().triggerNodeChanges([G])}})),T.current.update({controlPosition:O,boundaries:{minWidth:c,minHeight:d,maxWidth:u,maxHeight:p},keepAspectRatio:m,resizeDirection:g,onResizeStart:S,onResize:w,onResizeEnd:E,shouldResize:v}),()=>{T.current?.destroy()}},[O,c,d,u,p,m,S,w,E,v]);const z=O.split("-");return f.jsx("div",{className:Er(["react-flow__resize-control","nodrag",...z,n,r]),ref:A,style:{...o,scale:M,...s&&{[R?"backgroundColor":"borderColor"]:s}},children:i})}b.memo(Yve);function Zve(e,t=""){return _r({queryKey:["tasks",e,t],queryFn:()=>RD(e,t||void 0),enabled:e.length>0,placeholderData:jy})}function i$(e){return _r({queryKey:["task",e],queryFn:()=>Q8(e),enabled:e.length>0})}function s$(e,t=!0,n){return _r({queryKey:["templates",e,{includeDisabled:n?.includeDisabled??!1}],queryFn:()=>i9(e,n),enabled:t&&e.length>0})}function YC(e){return _r({queryKey:["template",e],queryFn:()=>s9(e),enabled:e.length>0})}function a$(){const e=Jt();return on({mutationFn:t=>W8(t),onSuccess:()=>{e.invalidateQueries({queryKey:["tasks"]})}})}function Gve(e){const t=Jt();return on({mutationFn:n=>J8(e,n),onSuccess:()=>{t.invalidateQueries({queryKey:["task",e]}),t.invalidateQueries({queryKey:["tasks"]})}})}function Kve(e){const t=Jt();return on({mutationFn:n=>e9(e,n.decision,n.comment),onSuccess:()=>{t.invalidateQueries({queryKey:["task",e]}),t.invalidateQueries({queryKey:["tasks"]}),t.invalidateQueries({queryKey:["taskContext",e]})}})}function Xve(e,t=!0){return _r({queryKey:["taskContext",e],queryFn:()=>t9(e),enabled:t&&e.length>0})}function Qve(e){const t=Jt();return on({mutationFn:n=>n9(e,n),onSuccess:()=>{t.invalidateQueries({queryKey:["task",e]}),t.invalidateQueries({queryKey:["tasks"]})}})}function Wve(e){const t=Jt();return on({mutationFn:n=>r9(e,n),onSuccess:()=>{t.invalidateQueries({queryKey:["task",e]}),t.invalidateQueries({queryKey:["tasks"]})}})}function Jve(e){const t=Jt();return on({mutationFn:n=>o9(e,n),onSuccess:()=>{t.invalidateQueries({queryKey:["task",e]}),t.invalidateQueries({queryKey:["tasks"]})}})}function ebe(){const e=Jt();return on({mutationFn:({id:t,enabled:n})=>d9(t,n),onSuccess:()=>{e.invalidateQueries({queryKey:["templates"]})}})}function tbe(){return on({mutationFn:h9})}function nbe(){const e=Jt();return on({mutationFn:p9,onSuccess:()=>{e.invalidateQueries({queryKey:["templates"]}),e.invalidateQueries({queryKey:["template"]}),e.invalidateQueries({queryKey:["skills"]}),e.invalidateQueries({queryKey:["skill"]}),e.invalidateQueries({queryKey:["agents"]}),e.invalidateQueries({queryKey:["agent"]}),e.invalidateQueries({queryKey:["model-aliases"]})}})}function l$(){const e=Jt();return on({mutationFn:t=>c9(t),onSuccess:()=>{e.invalidateQueries({queryKey:["templates"]})}})}function c$(){const e=Jt();return on({mutationFn:({id:t,patch:n})=>l9(t,n),onSuccess:(t,n)=>{e.invalidateQueries({queryKey:["template",n.id]}),e.invalidateQueries({queryKey:["templates"]})}})}function rbe(e){const t=Jt();return on({mutationFn:n=>a9({name:n,description:"",projectId:e,nodes:[{id:"ENTRY",label:"入口节点",phase:"entry",track:"all",prompt:"",skills:[]}],edges:[]}),onSuccess:()=>{t.invalidateQueries({queryKey:["templates"]})}})}function obe(){const e=Jt();return on({mutationFn:({id:t,input:n})=>u9(t,n),onSuccess:()=>{e.invalidateQueries({queryKey:["templates"]})}})}function u$(e,t=!0,n){return _r({queryKey:["nodePresets",e,{includeDisabled:n?.includeDisabled??!1,q:n?.q??""}],queryFn:()=>N9(e,n),enabled:t&&e.length>0,placeholderData:jy})}function ibe(e,t){return _r({queryKey:["nodePreset",e,t?.includeDisabled??!1],queryFn:()=>Dg(e,t),enabled:e.length>0})}function sbe(){const e=Jt();return on({mutationFn:t=>T9(t),onSuccess:()=>{e.invalidateQueries({queryKey:["nodePresets"]})}})}function abe(){const e=Jt();return on({mutationFn:({code:t,patch:n})=>M9(t,n),onSuccess:()=>{e.invalidateQueries({queryKey:["nodePresets"]}),e.invalidateQueries({queryKey:["nodePreset"]})}})}function lbe(){const e=Jt();return on({mutationFn:t=>A9(t),onSuccess:()=>{e.invalidateQueries({queryKey:["nodePresets"]})}})}function cbe(){const e=Jt();return on({mutationFn:({code:t,enabled:n})=>O9(t,n),onSuccess:()=>{e.invalidateQueries({queryKey:["nodePresets"]}),e.invalidateQueries({queryKey:["nodePreset"]})}})}function ube(){const e=Jt();return on({mutationFn:({code:t,input:n})=>D9(t,n),onSuccess:()=>{e.invalidateQueries({queryKey:["nodePresets"]})}})}function dbe(e,t=!0){return _r({queryKey:["templateUpgradePlan",e],queryFn:()=>P9(e),enabled:t&&e.length>0,staleTime:0})}function fbe(e){const t=Jt();return on({mutationFn:n=>I9(e,n),onSuccess:()=>{t.invalidateQueries({queryKey:["template"]}),t.invalidateQueries({queryKey:["templates"]}),t.invalidateQueries({queryKey:["templateUpgradePlan",e]})}})}function hbe({item:e}){switch(e.status){case"updatable":return f.jsx(Vt,{className:"bg-info/10 text-info",children:"可升级"});case"local-modified":return f.jsx(Vt,{className:"bg-warning/10 text-warning",children:"本地已修改"});case"source-missing":return f.jsx(Vt,{variant:"destructive",children:"来源缺失"});case"source-disabled":return f.jsx(Vt,{variant:"destructive",children:"来源已停用"});default:return f.jsx(Vt,{className:"bg-muted text-muted-foreground",children:"已是最新"})}}const pbe={"up-to-date":"已是最新",updatable:"库有新版本","local-modified":"模板内内容与拷贝基线不一致","source-missing":"来源节点资产已被删除(按缺省跳过)","source-disabled":"来源节点资产已停用(按缺省跳过)"};function mbe({item:e}){const{diff:t}=e,n=[];return t.prompt==="changed"&&n.push("Prompt"),t.label==="changed"&&n.push("标签"),t.phase==="changed"&&n.push("阶段"),t.track==="changed"&&n.push("轨道"),n.length===0&&t.skills===null&&t.agents===null?f.jsx("p",{className:"text-xs text-muted-foreground",children:"无字段差异"}):f.jsxs("ul",{className:"list-disc space-y-0.5 pl-4 text-xs break-all text-muted-foreground",children:[n.map(r=>f.jsxs("li",{children:[r," 有变更"]},r)),t.skills!==null&&f.jsxs("li",{children:["技能:",t.skills.added.length>0&&` 新增 ${t.skills.added.join("、")}`,t.skills.added.length>0&&t.skills.removed.length>0&&";",t.skills.removed.length>0&&` 移除 ${t.skills.removed.join("、")}`]}),t.agents!==null&&f.jsxs("li",{children:["Agent:",t.agents.added.length>0&&` 新增 ${t.agents.added.join("、")}`,t.agents.added.length>0&&t.agents.removed.length>0&&";",t.agents.removed.length>0&&` 移除 ${t.agents.removed.join("、")}`]})]})}function gbe({oldPrompt:e,code:t,latestVersion:n}){const[r,o]=b.useState("loading");return b.useEffect(()=>{let i=!1;return o("loading"),Dg(t).then(s=>{i||o(s)}).catch(()=>{i||o("error")}),()=>{i=!0}},[t,n]),f.jsxs("div",{className:"grid gap-2 md:grid-cols-2",children:[f.jsxs("div",{children:[f.jsx("p",{className:"mb-1 text-xs font-medium text-muted-foreground",children:"当前(模板内)"}),f.jsx("pre",{className:"max-h-48 overflow-y-auto whitespace-pre-wrap rounded-md bg-muted px-3 py-2 font-mono text-xs text-muted-foreground",children:e})]}),f.jsxs("div",{children:[f.jsxs("p",{className:"mb-1 text-xs font-medium text-muted-foreground",children:["最新(库 v",n,")"]}),r==="loading"?f.jsx(Kn,{rows:1,cols:1}):r==="error"?f.jsx(cx,{message:"最新内容加载失败"}):f.jsx("pre",{className:"max-h-48 overflow-y-auto whitespace-pre-wrap rounded-md bg-info/5 px-3 py-2 font-mono text-xs text-foreground",children:r.prompt})]})]})}function d$({open:e,onOpenChange:t,templateId:n,templateName:r,onApplied:o}){const i=dbe(n,e),s=YC(n),c=fbe(n),[d,u]=b.useState({}),[p,m]=b.useState(new Set),[g,y]=b.useState(null),v=b.useRef(!1);b.useEffect(()=>{e||(v.current=!1,u({}),m(new Set),y(null))},[e]);const S=b.useMemo(()=>i.data?.items??[],[i.data]);b.useEffect(()=>{if(!v.current&&S.length>0){const R={};for(const M of S)M.status==="updatable"&&(R[M.nodeId]="upgrade");u(R),v.current=!0}},[S]);const E=S.filter(R=>R.status==="local-modified").filter(R=>d[R.nodeId]===void 0),j=S.some(R=>R.status==="updatable"||R.status==="local-modified")&&E.length===0&&!c.isPending,N=()=>{if(!j)return;const R=S.filter(M=>M.status==="updatable"||M.status==="local-modified").map(M=>({nodeId:M.nodeId,action:d[M.nodeId]??(M.status==="updatable"?"upgrade":"skip"),expected:{status:M.status}}));c.mutate(R,{onSuccess:M=>{We.success(`模板「${r}」已升级到 v${M.template.version}`),y(R),o?.()},onError:M=>We.error(ft(M))})},A=R=>{m(M=>{const T=new Set(M);return T.has(R)?T.delete(R):T.add(R),T})};return f.jsx(jo,{open:e,onOpenChange:t,children:f.jsxs(Ro,{className:"flex h-[85vh] w-[calc(100vw-4rem)] max-w-4xl flex-col gap-4 sm:max-w-none",children:[f.jsxs(_o,{children:[f.jsxs(No,{children:["检查更新 · ",r]}),f.jsx(To,{children:"比对模板内来源节点与节点库最新版;升级为值拷贝(在途任务实例不受影响)。"})]}),f.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto rounded-md border border-border",children:i.isLoading?f.jsx("div",{className:"p-4",children:f.jsx(Kn,{rows:4,cols:3})}):i.isError?f.jsxs("div",{className:"p-4",children:[f.jsx(cx,{message:ft(i.error)}),f.jsx(Te,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:()=>{i.refetch()},children:"重试"})]}):S.length===0?f.jsx("div",{className:"p-4",children:f.jsx(Vh,{message:"模板内没有来自节点库的节点(全部自建),无升级检查项。"})}):g!==null?f.jsxs("div",{className:"p-4",children:[f.jsx("p",{className:"mb-2 text-sm font-medium text-foreground",children:"升级结果:"}),f.jsx("ul",{className:"space-y-1",children:(c.data?.results??[]).map(R=>f.jsxs("li",{className:"flex items-center gap-2 text-sm",children:[f.jsx("span",{className:"font-mono text-xs text-muted-foreground",children:R.nodeId}),f.jsx(Vt,{variant:R.applied?"secondary":"outline",children:R.action==="upgrade"?"升级":R.action==="keep"?"保留本地":"跳过"}),R.reason&&f.jsx("span",{className:"text-xs text-muted-foreground",children:R.reason})]},R.nodeId))})]}):f.jsx("ul",{className:"divide-y divide-border",children:S.map(R=>{const M=s.data?.nodes.find(q=>q.id===R.nodeId),T=p.has(R.nodeId),O=d[R.nodeId],z=R.status==="local-modified"||R.status==="updatable";return f.jsxs("li",{className:"px-3 py-2",children:[f.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[f.jsxs("button",{type:"button",onClick:()=>A(R.nodeId),"aria-expanded":T,className:"flex min-w-0 items-center gap-1.5 rounded px-1 py-0.5 text-left focus:outline-none focus-visible:ring-2 focus-visible:ring-foreground",children:[T?f.jsx(Oy,{className:"size-4 shrink-0 text-muted-foreground","aria-hidden":"true"}):f.jsx(wD,{className:"size-4 shrink-0 text-muted-foreground","aria-hidden":"true"}),f.jsx("span",{className:"font-mono text-sm font-medium text-foreground",children:R.nodeId})]}),f.jsxs("span",{className:"truncate font-mono text-xs text-muted-foreground",children:[R.source.code,":v",R.source.version,R.latest?` → v${R.latest.version}`:""]}),f.jsx(hbe,{item:R}),f.jsx("span",{className:"text-xs text-muted-foreground",children:pbe[R.status]})]}),z&&f.jsx("div",{className:"mt-2 flex flex-wrap items-center gap-3 pl-6",children:R.status==="updatable"?f.jsxs("label",{className:"flex items-center gap-1.5 text-sm",children:[f.jsx("input",{type:"checkbox",checked:O!=="skip",onChange:()=>u(q=>({...q,[R.nodeId]:O==="skip"?"upgrade":"skip"})),className:"size-4 accent-primary"}),"升级到最新"]}):f.jsxs("fieldset",{className:"flex items-center gap-2",children:[f.jsxs("legend",{className:"sr-only",children:["节点 ",R.nodeId," 决策"]}),[{value:"upgrade",label:"升级覆盖"},{value:"keep",label:"保留本地"},{value:"skip",label:"跳过"}].map(q=>f.jsxs("label",{className:"flex items-center gap-1 text-sm",children:[f.jsx("input",{type:"radio",name:`upgrade-decision-${R.nodeId}`,checked:O===q.value,onChange:()=>u($=>({...$,[R.nodeId]:q.value})),className:"size-4 accent-primary"}),q.label]},q.value))]})}),T&&f.jsxs("div",{className:"mt-2 space-y-2 pl-6",children:[f.jsx(mbe,{item:R}),R.latest&&(R.diff.prompt==="changed"||R.status==="local-modified")&&M&&f.jsx(gbe,{oldPrompt:M.prompt,code:R.source.code,latestVersion:R.latest.version})]})]},R.nodeId)})})}),g===null&&E.length>0&&f.jsxs("p",{className:"shrink-0 text-xs text-destructive",role:"alert",children:[E.length," 个本地已修改节点待决策(升级覆盖 / 保留本地 / 跳过)——未决策不可执行升级。"]}),f.jsxs($i,{className:"shrink-0",children:[f.jsx(Te,{type:"button",variant:"outline",disabled:c.isPending,onClick:()=>t(!1),children:"关闭"}),g===null&&f.jsx(Te,{type:"button",disabled:!j,onClick:N,children:c.isPending?"升级中…":"执行升级"})]})]})})}const ybe={entry:"bg-info",track:"bg-primary",test:"bg-warning",exit:"bg-success"};function xbe(e){switch(e){case"completed":return"ring-2 ring-success";case"active":return"ring-2 ring-primary animate-pulse";case"skipped":return"opacity-60 ring-2 ring-dashed ring-muted";default:return"ring-2 ring-muted-foreground/30"}}const vbe=b.memo(function({data:t}){const{node:n,instanceStatus:r}=t,o=Vn("dag_phase"),i=Vn("dag_track"),s=d=>o.find(u=>u.value===d)?.label??d,c=d=>i.find(u=>u.value===d)?.label??d;return f.jsxs("div",{className:`w-50 rounded-md border border-border bg-card shadow-sm ${xbe(r)}`,children:[f.jsx(Zu,{type:"target",position:pt.Top,isConnectableStart:!1}),f.jsx("div",{className:`h-1.5 rounded-t-md ${ybe[n.phase]??"bg-muted"}`}),f.jsxs("div",{className:"flex flex-col gap-1 px-3 py-2",children:[f.jsxs("div",{className:"flex items-center justify-between gap-2",children:[f.jsx("span",{className:`truncate text-sm font-medium ${r==="skipped"?"text-muted-foreground line-through":"text-foreground"}`,children:n.label}),r==="completed"&&f.jsx("span",{role:"img","aria-label":"已完成",className:"shrink-0 rounded bg-success/10 px-1 text-xs text-success",title:"已完成",children:"✓"})]}),f.jsxs("div",{className:"flex items-center gap-1.5 text-[10px] text-muted-foreground",children:[f.jsx("span",{className:"rounded bg-muted px-1 py-0.5 font-mono",children:n.id}),f.jsx("span",{className:"rounded bg-muted px-1 py-0.5",children:s(n.phase)}),f.jsx("span",{className:"rounded bg-muted px-1 py-0.5",children:c(n.track)})]})]}),f.jsx(Zu,{type:"source",position:pt.Bottom})]})}),bbe=b.memo(function({id:t,sourceX:n,sourceY:r,targetX:o,targetY:i,sourcePosition:s=pt.Bottom,targetPosition:c=pt.Top,data:d,markerEnd:u}){const[p,m,g]=wy({sourceX:n,sourceY:r,targetX:o,targetY:i,sourcePosition:s,targetPosition:c}),y=d,v=y?.pausePoint,S=y?.pauseState??"pending";if(!v)return f.jsx(Gu,{id:t,path:p,...u?{markerEnd:u}:{}});const w=S==="awaiting",E=S==="passed",k=v.type==="checkpoint";return f.jsxs(f.Fragment,{children:[f.jsx(Gu,{id:t,path:p,...u?{markerEnd:u}:{},className:[E?"stroke-success":k?"stroke-info":"stroke-warning",w?"stroke-3 animate-pulse motion-reduce:animate-none":"stroke-2"].join(" ")}),f.jsx(mve,{children:f.jsxs("div",{style:{position:"absolute",transform:`translate(-50%, -50%) translate(${m}px, ${g}px)`},className:`flex items-center gap-1 rounded-full border px-2 py-0.5 text-xs pointer-events-none ${E?"border-success bg-success/10 text-success":w?"border-warning bg-warning/10 text-warning animate-pulse font-bold motion-reduce:animate-none":k?"border-info/50 bg-info/5 text-info/70":"border-warning/50 bg-warning/5 text-warning/70"}`,children:[E?"✓":"🖐",f.jsx("span",{children:v.type==="human_approval"?"审批":"检查点"})]})})]})});var f$=Object.defineProperty,wbe=(e,t,n)=>t in e?f$(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Sbe=(e,t)=>{for(var n in t)f$(e,n,{get:t[n],enumerable:!0})},Ebe=(e,t,n)=>wbe(e,t+"",n),h$={};Sbe(h$,{Graph:()=>Ui,alg:()=>GC});var Cbe=Object.defineProperty,p$=(e,t)=>{for(var n in t)Cbe(e,n,{get:t[n],enumerable:!0})},ZC=class{constructor(e){this._isDirected=!0,this._isMultigraph=!1,this._isCompound=!1,this._nodes={},this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={},this._nodeCount=0,this._edgeCount=0,this._defaultNodeLabelFn=()=>{},this._defaultEdgeLabelFn=()=>{},e&&(this._isDirected="directed"in e?e.directed:!0,this._isMultigraph="multigraph"in e?e.multigraph:!1,this._isCompound="compound"in e?e.compound:!1),this._isCompound&&(this._parent={},this._children={},this._children["\0"]={})}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(e){return this._label=e,this}graph(){return this._label}setDefaultNodeLabel(e){return typeof e!="function"?this._defaultNodeLabelFn=()=>e:this._defaultNodeLabelFn=e,this}nodeCount(){return this._nodeCount}nodes(){return Object.keys(this._nodes)}sources(){return this.nodes().filter(e=>Object.keys(this._in[e]).length===0)}sinks(){return this.nodes().filter(e=>Object.keys(this._out[e]).length===0)}setNodes(e,t){return e.forEach(n=>{t!==void 0?this.setNode(n,t):this.setNode(n)}),this}setNode(e,t){return e in this._nodes?(arguments.length>1&&(this._nodes[e]=t),this):(this._nodes[e]=arguments.length>1?t:this._defaultNodeLabelFn(e),this._isCompound&&(this._parent[e]="\0",this._children[e]={},this._children["\0"][e]=!0),this._in[e]={},this._preds[e]={},this._out[e]={},this._sucs[e]={},++this._nodeCount,this)}node(e){return this._nodes[e]}hasNode(e){return e in this._nodes}removeNode(e){if(e in this._nodes){let t=n=>this.removeEdge(this._edgeObjs[n]);delete this._nodes[e],this._isCompound&&(this._removeFromParentsChildList(e),delete this._parent[e],this.children(e).forEach(n=>{this.setParent(n)}),delete this._children[e]),Object.keys(this._in[e]).forEach(t),delete this._in[e],delete this._preds[e],Object.keys(this._out[e]).forEach(t),delete this._out[e],delete this._sucs[e],--this._nodeCount}return this}setParent(e,t){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(t===void 0)t="\0";else{t+="";for(let n=t;n!==void 0;n=this.parent(n))if(n===e)throw new Error("Setting "+t+" as parent of "+e+" would create a cycle");this.setNode(t)}return this.setNode(e),this._removeFromParentsChildList(e),this._parent[e]=t,this._children[t][e]=!0,this}parent(e){if(this._isCompound){let t=this._parent[e];if(t!=="\0")return t}}children(e="\0"){if(this._isCompound){let t=this._children[e];if(t)return Object.keys(t)}else{if(e==="\0")return this.nodes();if(this.hasNode(e))return[]}return[]}predecessors(e){let t=this._preds[e];if(t)return Object.keys(t)}successors(e){let t=this._sucs[e];if(t)return Object.keys(t)}neighbors(e){let t=this.predecessors(e);if(t){let n=new Set(t),r=this.successors(e);if(r)for(let o of r)n.add(o);return Array.from(n.values())}}isLeaf(e){var t;let n;return this.isDirected()?n=this.successors(e):n=this.neighbors(e),((t=n?.length)!=null?t:0)===0}filterNodes(e){let t=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});t.setGraph(this.graph()),Object.entries(this._nodes).forEach(([o,i])=>{e(o)&&t.setNode(o,i)}),Object.values(this._edgeObjs).forEach(o=>{t.hasNode(o.v)&&t.hasNode(o.w)&&t.setEdge(o,this.edge(o))});let n={},r=o=>{let i=this.parent(o);return!i||t.hasNode(i)?(n[o]=i,i):i in n?n[i]:r(i)};return this._isCompound&&t.nodes().forEach(o=>t.setParent(o,r(o))),t}setDefaultEdgeLabel(e){return typeof e!="function"?this._defaultEdgeLabelFn=()=>e:this._defaultEdgeLabelFn=e,this}edgeCount(){return this._edgeCount}edges(){return Object.values(this._edgeObjs)}setPath(e,t){return e.reduce((n,r)=>(t!==void 0?this.setEdge(n,r,t):this.setEdge(n,r),r)),this}setEdge(e,t,n,r){let o,i,s,c,d=!1;typeof e=="object"&&e!==null&&"v"in e?(o=e.v,i=e.w,s=e.name,arguments.length===2&&(c=t,d=!0)):(o=e,i=t,s=r,arguments.length>2&&(c=n,d=!0)),o=""+o,i=""+i,s!==void 0&&(s=""+s);let u=Df(this._isDirected,o,i,s);if(u in this._edgeLabels)return d&&(this._edgeLabels[u]=c),this;if(s!==void 0&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(o),this.setNode(i),this._edgeLabels[u]=d?c:this._defaultEdgeLabelFn(o,i,s);let p=kbe(this._isDirected,o,i,s);return o=p.v,i=p.w,Object.freeze(p),this._edgeObjs[u]=p,ZO(this._preds[i],o),ZO(this._sucs[o],i),this._in[i][u]=p,this._out[o][u]=p,this._edgeCount++,this}edge(e,t,n){let r=arguments.length===1?dw(this._isDirected,e):Df(this._isDirected,e,t,n);return this._edgeLabels[r]}edgeAsObj(e,t,n){let r=arguments.length===1?this.edge(e):this.edge(e,t,n);return typeof r!="object"||r===null?{label:r}:r}hasEdge(e,t,n){return(arguments.length===1?dw(this._isDirected,e):Df(this._isDirected,e,t,n))in this._edgeLabels}removeEdge(e,t,n){let r=arguments.length===1?dw(this._isDirected,e):Df(this._isDirected,e,t,n),o=this._edgeObjs[r];if(o){let i=o.v,s=o.w;delete this._edgeLabels[r],delete this._edgeObjs[r],GO(this._preds[s],i),GO(this._sucs[i],s),delete this._in[s][r],delete this._out[i][r],this._edgeCount--}return this}inEdges(e,t){return this.isDirected()?this.filterEdges(this._in[e],e,t):this.nodeEdges(e,t)}outEdges(e,t){return this.isDirected()?this.filterEdges(this._out[e],e,t):this.nodeEdges(e,t)}nodeEdges(e,t){if(e in this._nodes)return this.filterEdges({...this._in[e],...this._out[e]},e,t)}_removeFromParentsChildList(e){delete this._children[this._parent[e]][e]}filterEdges(e,t,n){if(!e)return;let r=Object.values(e);return n?r.filter(o=>o.v===t&&o.w===n||o.v===n&&o.w===t):r}};function ZO(e,t){e[t]?e[t]++:e[t]=1}function GO(e,t){e[t]!==void 0&&!--e[t]&&delete e[t]}function Df(e,t,n,r){let o=""+t,i=""+n;if(!e&&o>i){let s=o;o=i,i=s}return o+""+i+""+(r===void 0?"\0":r)}function kbe(e,t,n,r){let o=""+t,i=""+n;if(!e&&o>i){let c=o;o=i,i=c}let s={v:o,w:i};return r&&(s.name=r),s}function dw(e,t){return Df(e,t.v,t.w,t.name)}var jbe={};p$(jbe,{read:()=>Tbe,write:()=>Rbe});function Rbe(e){let t={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:_be(e),edges:Nbe(e)},n=e.graph();return n!==void 0&&(t.value=structuredClone(n)),t}function _be(e){return e.nodes().map(t=>{let n=e.node(t),r=e.parent(t),o={v:t};return n!==void 0&&(o.value=n),r!==void 0&&(o.parent=r),o})}function Nbe(e){return e.edges().map(t=>{let n=e.edge(t),r={v:t.v,w:t.w};return t.name!==void 0&&(r.name=t.name),n!==void 0&&(r.value=n),r})}function Tbe(e){let t=new ZC(e.options);return e.value!==void 0&&t.setGraph(e.value),e.nodes.forEach(n=>{t.setNode(n.v,n.value),n.parent&&t.setParent(n.v,n.parent)}),e.edges.forEach(n=>{t.setEdge({v:n.v,w:n.w,name:n.name},n.value)}),t}var GC={};p$(GC,{CycleException:()=>Cy,bellmanFord:()=>m$,components:()=>Obe,dijkstra:()=>Ey,dijkstraAll:()=>Ibe,findCycles:()=>zbe,floydWarshall:()=>Fbe,isAcyclic:()=>Vbe,postorder:()=>Hbe,preorder:()=>Ube,prim:()=>qbe,shortestPaths:()=>Ybe,tarjan:()=>y$,topsort:()=>x$});var Mbe=()=>1;function m$(e,t,n,r){return Abe(e,String(t),n||Mbe,r||function(o){var i;return(i=e.outEdges(o))!=null?i:[]})}function Abe(e,t,n,r){let o={},i,s=0,c=e.nodes(),d=function(m){let g=o[m.v],y=o[m.w];if(!g||!y)return;let v=n(m);g.distance+v<y.distance&&(o[m.w]={distance:g.distance+v,predecessor:m.v},i=!0)},u=function(){c.forEach(function(m){r(m).forEach(function(g){let y=g.v===m?g.v:g.w,v=y===g.v?g.w:g.v;d({v:y,w:v})})})};c.forEach(function(m){let g=m===t?0:Number.POSITIVE_INFINITY;o[m]={distance:g,predecessor:""}});let p=c.length;for(let m=1;m<p&&(i=!1,s++,u(),!!i);m++);if(s===p-1&&(i=!1,u(),i))throw new Error("The graph contains a negative weight cycle");return o}function Obe(e){let t={},n=[],r;function o(i){var s,c;i in t||(t[i]=!0,r.push(i),(s=e.successors(i))==null||s.forEach(o),(c=e.predecessors(i))==null||c.forEach(o))}return e.nodes().forEach(function(i){r=[],o(i),r.length&&n.push(r)}),n}var g$=class{constructor(){this._arr=[],this._keyIndices={}}size(){return this._arr.length}keys(){return this._arr.map(e=>e.key)}has(e){return e in this._keyIndices}priority(e){let t=this._keyIndices[e];if(t!==void 0)return this._arr[t].priority}min(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key}add(e,t){let n=this._keyIndices,r=String(e);if(!(r in n)){let o=this._arr,i=o.length;return n[r]=i,o.push({key:r,priority:t}),this._decrease(i),!0}return!1}removeMin(){if(this.size()===0)throw new Error("Queue underflow");this._swap(0,this._arr.length-1);let e=this._arr.pop();return delete this._keyIndices[e.key],this._heapify(0),e.key}decrease(e,t){let n=this._keyIndices[e];if(n===void 0)throw new Error(`Key not found: ${e}`);let r=this._arr[n].priority;if(t>r)throw new Error(`New priority is greater than current priority. Key: ${e} Old: ${r} New: ${t}`);this._arr[n].priority=t,this._decrease(n)}_heapify(e){let t=this._arr,n=2*e,r=n+1,o=e;n<t.length&&(o=t[n].priority<t[o].priority?n:o,r<t.length&&(o=t[r].priority<t[o].priority?r:o),o!==e&&(this._swap(e,o),this._heapify(o)))}_decrease(e){let t=this._arr,n=t[e].priority,r;for(;e!==0&&(r=e>>1,!(t[r].priority<n));)this._swap(e,r),e=r}_swap(e,t){let n=this._arr,r=this._keyIndices,o=n[e],i=n[t];n[e]=i,n[t]=o,r[i.key]=e,r[o.key]=t}},Dbe=()=>1;function Ey(e,t,n,r){let o=function(i){var s;return(s=e.outEdges(i))!=null?s:[]};return Pbe(e,String(t),n||Dbe,r||o)}function Pbe(e,t,n,r){let o={},i=new g$,s,c,d=function(u){let p=u.v!==s?u.v:u.w,m=o[p];if(!m)return;let g=n(u),y=c.distance+g;if(g<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+u+" Weight: "+g);y<m.distance&&(m.distance=y,m.predecessor=s,i.decrease(p,y))};for(e.nodes().forEach(function(u){let p=u===t?0:Number.POSITIVE_INFINITY;o[u]={distance:p,predecessor:""},i.add(u,p)});i.size()>0;){s=i.removeMin();let u=o[s];if(!u||u.distance===Number.POSITIVE_INFINITY)break;c=u,r(s).forEach(d)}return o}function Ibe(e,t,n){return e.nodes().reduce(function(r,o){return r[o]=Ey(e,o,t,n),r},{})}function y$(e){let t=0,n=[],r={},o=[];function i(s){var c;let d=r[s]={onStack:!0,lowlink:t,index:t++};if(n.push(s),(c=e.successors(s))==null||c.forEach(function(u){if(u in r){let p=r[u];p!=null&&p.onStack&&(d.lowlink=Math.min(d.lowlink,p.index))}else{i(u);let p=r[u];p&&(d.lowlink=Math.min(d.lowlink,p.lowlink))}}),d.lowlink===d.index){let u=[],p;do{p=n.pop();let m=r[p];m&&(m.onStack=!1),u.push(p)}while(s!==p);o.push(u)}}return e.nodes().forEach(function(s){s in r||i(s)}),o}function zbe(e){return y$(e).filter(function(t){var n;let r=t[0];return r?t.length>1||t.length===1&&((n=e.outEdges(r,r))!=null?n:[]).length>0:!1})}var Lbe=()=>1;function Fbe(e,t,n){return $be(e,t||Lbe,n||function(r){var o;return(o=e.outEdges(r))!=null?o:[]})}function $be(e,t,n){let r={},o=e.nodes();return o.forEach(function(i){let s={};r[i]=s,s[i]={distance:0,predecessor:""},o.forEach(function(c){i!==c&&(s[c]={distance:Number.POSITIVE_INFINITY,predecessor:""})}),n(i).forEach(function(c){let d=c.v===i?c.w:c.v,u=t(c);s[d]={distance:u,predecessor:i}})}),o.forEach(function(i){let s=r[i];s&&o.forEach(function(c){let d=r[c];d&&o.forEach(function(u){let p=d[i],m=s[u],g=d[u];if(p&&m&&g){let y=p.distance+m.distance;y<g.distance&&(g.distance=y,g.predecessor=m.predecessor)}})})}),r}var Cy=class extends Error{constructor(e){super(e),this.name="CycleException"}};function x$(e){let t={},n={},r=[];function o(i){var s;if(i in n)throw new Cy;i in t||(n[i]=!0,t[i]=!0,(s=e.predecessors(i))==null||s.forEach(o),delete n[i],r.push(i))}if(e.sinks().forEach(o),Object.keys(t).length!==e.nodeCount())throw new Cy;return r}function Vbe(e){try{x$(e)}catch(t){if(t instanceof Cy)return!1;throw t}return!0}function Bbe(e,t,n,r,o){Array.isArray(t)||(t=[t]);let i=(c=>{var d;return(d=e.isDirected()?e.successors(c):e.neighbors(c))!=null?d:[]}),s={};return t.forEach(function(c){if(!e.hasNode(c))throw new Error("Graph does not have node: "+c);o=v$(e,c,n==="post",s,i,r,o)}),o}function v$(e,t,n,r,o,i,s){return t in r||(r[t]=!0,n||(s=i(s,t)),o(t).forEach(function(c){s=v$(e,c,n,r,o,i,s)}),n&&(s=i(s,t))),s}function b$(e,t,n){return Bbe(e,t,n,function(r,o){return r.push(o),r},[])}function Hbe(e,t){return b$(e,t,"post")}function Ube(e,t){return b$(e,t,"pre")}function qbe(e,t){var n;let r=new ZC,o={},i=new g$,s;function c(p){let m=p.v===s?p.w:p.v,g=i.priority(m);if(g!==void 0){let y=t(p);y<g&&(o[m]=s,i.decrease(m,y))}}if(e.nodeCount()===0)return r;e.nodes().forEach(function(p){i.add(p,Number.POSITIVE_INFINITY),r.setNode(p)});let d=e.nodes()[0];d!==void 0&&i.decrease(d,0);let u=!1;for(;i.size()>0;){if(s=i.removeMin(),s in o)r.setEdge(s,o[s]);else{if(u)throw new Error("Input graph is not connected: "+e);u=!0}(n=e.nodeEdges(s))==null||n.forEach(c)}return r}function Ybe(e,t,n,r){return Zbe(e,t,n,r??(o=>{var i;return(i=e.outEdges(o))!=null?i:[]}))}function Zbe(e,t,n,r){if(n===void 0)return Ey(e,t,n,r);let o=!1,i=e.nodes();for(let s=0;s<i.length;s++){let c=i[s];if(c===void 0)continue;let d=r(c);for(let u=0;u<d.length;u++){let p=d[u];if(!p)continue;let m=p.v===c?p.v:p.w,g=m===p.v?p.w:p.v;n({v:m,w:g})<0&&(o=!0)}if(o)return m$(e,t,n,r)}return Ey(e,t,n,r)}var Ui=ZC;function md(e,t,n,r){let o=r;for(;e.hasNode(o);)o=KC(r);return n.dummy=t,e.setNode(o,n),o}function Gbe(e){let t=new Ui().setGraph(e.graph());return e.nodes().forEach(n=>t.setNode(n,e.node(n))),e.edges().forEach(n=>{let r=t.edge(n.v,n.w)||{weight:0,minlen:1},o=e.edge(n);t.setEdge(n.v,n.w,{weight:r.weight+o.weight,minlen:Math.max(r.minlen,o.minlen)})}),t}function w$(e){let t=new Ui({multigraph:e.isMultigraph()}).setGraph(e.graph());return e.nodes().forEach(n=>{e.children(n).length||t.setNode(n,e.node(n))}),e.edges().forEach(n=>{t.setEdge(n,e.edge(n))}),t}function KO(e,t){let n=e.x,r=e.y,o=t.x-n,i=t.y-r,s=e.width/2,c=e.height/2;if(!o&&!i)throw new Error("Not possible to find intersection inside of the rectangle");let d,u;return Math.abs(i)*s>Math.abs(o)*c?(i<0&&(c=-c),d=c*o/i,u=c):(o<0&&(s=-s),d=s,u=s*i/o),{x:n+d,y:r+u}}function cp(e){let t=bh(E$(e)+1).map(()=>[]);return e.nodes().forEach(n=>{let r=e.node(n),o=r.rank;o!==void 0&&(t[o]||(t[o]=[]),t[o][r.order]=n)}),t}function Kbe(e){let t=e.nodes().map(r=>{let o=e.node(r).rank;return o===void 0?Number.MAX_VALUE:o}),n=ss(Math.min,t);e.nodes().forEach(r=>{let o=e.node(r);Object.hasOwn(o,"rank")&&(o.rank-=n)})}function Xbe(e){let t=e.nodes().map(s=>e.node(s).rank).filter(s=>s!==void 0),n=ss(Math.min,t),r=[];e.nodes().forEach(s=>{let c=e.node(s).rank-n;r[c]||(r[c]=[]),r[c].push(s)});let o=0,i=e.graph().nodeRankFactor;Array.from(r).forEach((s,c)=>{s===void 0&&c%i!==0?--o:s!==void 0&&o&&s.forEach(d=>e.node(d).rank+=o)})}function XO(e,t,n,r){let o={width:0,height:0};return arguments.length>=4&&(o.rank=n,o.order=r),md(e,"border",o,t)}function Qbe(e,t=S$){let n=[];for(let r=0;r<e.length;r+=t){let o=e.slice(r,r+t);n.push(o)}return n}var S$=65535;function ss(e,t){if(t.length>S$){let n=Qbe(t);return e(...n.map(r=>e(...r)))}else return e(...t)}function E$(e){let t=e.nodes().map(n=>{let r=e.node(n).rank;return r===void 0?Number.MIN_VALUE:r});return ss(Math.max,t)}function Wbe(e,t){let n={lhs:[],rhs:[]};return e.forEach(r=>{t(r)?n.lhs.push(r):n.rhs.push(r)}),n}function Jbe(e,t){let n=Date.now();try{return t()}finally{console.log(e+" time: "+(Date.now()-n)+"ms")}}function C$(e,t){return t()}var e0e=0;function KC(e){let t=++e0e;return e+(""+t)}function bh(e,t,n=1){t==null&&(t=e,e=0);let r=i=>i<t;n<0&&(r=i=>t<i);let o=[];for(let i=e;r(i);i+=n)o.push(i);return o}function ky(e,t){let n={};for(let r of t)e[r]!==void 0&&(n[r]=e[r]);return n}function Yx(e,t){let n;return typeof t=="string"?n=r=>r[t]:n=t,Object.entries(e).reduce((r,[o,i])=>(r[o]=n(i,o),r),{})}function t0e(e,t){return e.reduce((n,r,o)=>(n[r]=t[o],n),{})}var Zx="\0";function k$(e,t,n){var r,o,i,s,c,d;if(!(e&&t&&n&&t.dummy==="edge"&&n.dummy==="edge"&&t.edgeObj&&n.edgeObj&&e[t.edgeObj.v]&&e[n.edgeObj.v]&&e[t.edgeObj.w]&&e[n.edgeObj.w]))return 0;let u=!0;t.edgeObj.w===n.edgeObj.w&&(u=!1);let p=u?(o=(r=e[t.edgeObj.v])==null?void 0:r.rank)!=null?o:NaN+1:(s=(i=e[t.edgeObj.w])==null?void 0:i.rank)!=null?s:NaN-1,m=Object.entries(e).find(S=>{var w,E;return((w=S[1].edgeObj)==null?void 0:w.v)===t.edgeObj.v&&((E=S[1].edgeObj)==null?void 0:E.w)===t.edgeObj.w&&S[1].rank===p}),g=Object.entries(e).find(S=>{var w,E;return((w=S[1].edgeObj)==null?void 0:w.v)===n.edgeObj.v&&((E=S[1].edgeObj)==null?void 0:E.w)===n.edgeObj.w&&S[1].rank===p});if(!m||!g)return 0;let y=(c=m[1].order)!=null?c:NaN,v=(d=g[1].order)!=null?d:NaN;return isNaN(y-v)?0:y-v}var n0e="3.1.1",r0e=class{constructor(){Ebe(this,"_sentinel");let e={};e._next=e._prev=e,this._sentinel=e}dequeue(){let e=this._sentinel,t=e._prev;if(t!==e)return QO(t),t}enqueue(e){let t=this._sentinel;e._prev&&e._next&&QO(e),e._next=t._next,t._next._prev=e,t._next=e,e._prev=t}toString(){let e=[],t=this._sentinel,n=t._prev;for(;n!==t;)e.push(JSON.stringify(n,o0e)),n=n._prev;return"["+e.join(", ")+"]"}};function QO(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function o0e(e,t){if(e!=="_next"&&e!=="_prev")return t}var i0e=r0e,s0e=()=>1;function a0e(e,t){if(e.nodeCount()<=1)return[];let n=c0e(e,t||s0e);return l0e(n.graph,n.buckets,n.zeroIdx).flatMap(r=>e.outEdges(r.v,r.w)||[])}function l0e(e,t,n){var r;let o=[],i=t[t.length-1],s=t[0],c;for(;e.nodeCount();){for(;c=s.dequeue();)fw(e,t,n,c);for(;c=i.dequeue();)fw(e,t,n,c);if(e.nodeCount()){for(let d=t.length-2;d>0;--d)if(c=(r=t[d])==null?void 0:r.dequeue(),c){o=o.concat(fw(e,t,n,c,!0)||[]);break}}}return o}function fw(e,t,n,r,o){let i=[],s=o?i:void 0;return(e.inEdges(r.v)||[]).forEach(c=>{let d=e.edge(c),u=e.node(c.v);o&&i.push({v:c.v,w:c.w}),u.out-=d,eE(t,n,u)}),(e.outEdges(r.v)||[]).forEach(c=>{let d=e.edge(c),u=c.w,p=e.node(u);p.in-=d,eE(t,n,p)}),e.removeNode(r.v),s}function c0e(e,t){let n=new Ui,r=0,o=0;e.nodes().forEach(c=>{n.setNode(c,{v:c,in:0,out:0})}),e.edges().forEach(c=>{let d=n.edge(c.v,c.w)||0,u=t(c),p=d+u;n.setEdge(c.v,c.w,p);let m=n.node(c.v),g=n.node(c.w);o=Math.max(o,m.out+=u),r=Math.max(r,g.in+=u)});let i=u0e(o+r+3).map(()=>new i0e),s=r+1;return n.nodes().forEach(c=>{eE(i,s,n.node(c))}),{graph:n,buckets:i,zeroIdx:s}}function eE(e,t,n){var r,o,i;n.out?n.in?(i=e[n.out-n.in+t])==null||i.enqueue(n):(o=e[e.length-1])==null||o.enqueue(n):(r=e[0])==null||r.enqueue(n)}function u0e(e){let t=[];for(let n=0;n<e;n++)t.push(n);return t}function d0e(e,t){(e.graph().acyclicer==="greedy"?a0e(e,n(e)):f0e(e,t??null)).forEach(r=>{let o=e.edge(r);e.removeEdge(r),o.forwardName=r.name,o.reversed=!0,e.setEdge(r.w,r.v,o,KC("rev"))});function n(r){return o=>r.edge(o).weight}}function f0e(e,t){let n=[],r={},o={};function i(d){Object.hasOwn(o,d)||(o[d]=!0,r[d]=!0,e.outEdges(d).forEach(u=>{Object.hasOwn(r,u.w)?n.push(u):i(u.w)}),delete r[d])}function s(d){var u;Object.hasOwn(o,d)||(o[d]=!0,r[d]=!0,(u=e.outEdges(d))==null||u.forEach(p=>{var m,g;Object.hasOwn(r,p.w)||((m=t.node(d))==null?void 0:m.rank)>((g=t.node(p.w))==null?void 0:g.rank)&&p0e(e,p.w,p)?n.push(p):s(p.w)}),delete r[d])}let c=i;return t&&typeof t.node=="function"&&(c=s),e.sources().forEach(c),e.nodes().forEach(c),n}function h0e(e){e.edges().forEach(t=>{let n=e.edge(t);if(n.reversed){e.removeEdge(t);let r=n.forwardName;delete n.reversed,delete n.forwardName,e.setEdge(t.w,t.v,n,r)}})}function p0e(e,t,n){let r=new Set;function o(i){var s;if(e.sources().includes(i))return!0;r.add(i);for(let c of(s=e.inEdges(i))!=null?s:[])if(!(c.v===n.v&&c.w===n.w)&&!r.has(c.v)&&o(c.v))return!0;return!1}return o(t)}function m0e(e){e.graph().dummyChains=[],e.edges().forEach(t=>g0e(e,t))}function g0e(e,t){let n=t.v,r=e.node(n).rank,o=t.w,i=e.node(o).rank,s=t.name,c=e.edge(t),d=c.labelRank;if(i===r+1)return;e.removeEdge(t);let u,p,m;for(m=0,++r;r<i;++m,++r)c.points=[],p={width:0,height:0,edgeLabel:c,edgeObj:t,rank:r},u=md(e,"edge",p,"_d"),r===d&&(p.width=c.width,p.height=c.height,p.dummy="edge-label",p.labelpos=c.labelpos),e.setEdge(n,u,{weight:c.weight},s),m===0&&e.graph().dummyChains.push(u),n=u;e.setEdge(n,o,{weight:c.weight},s)}function y0e(e){e.graph().dummyChains.forEach(t=>{let n=e.node(t),r=n.edgeLabel,o;for(e.setEdge(n.edgeObj,r);n.dummy;)o=e.successors(t)[0],e.removeNode(t),r.points.push({x:n.x,y:n.y}),n.dummy==="edge-label"&&(r.x=n.x,r.y=n.y,r.width=n.width,r.height=n.height),t=o,n=e.node(t)})}function XC(e){let t={};function n(r){let o=e.node(r);if(Object.hasOwn(t,r))return o.rank;t[r]=!0;let i=e.outEdges(r),s=i?i.map(d=>d==null?Number.POSITIVE_INFINITY:n(d.w)-e.edge(d).minlen):[],c=ss(Math.min,s);return c===Number.POSITIVE_INFINITY&&(c=0),o.rank=c}e.sources().forEach(n)}function Ku(e,t){return e.node(t.w).rank-e.node(t.v).rank-e.edge(t).minlen}var j$=x0e;function x0e(e){let t=new Ui({directed:!1}),n=e.nodes();if(n.length===0)throw new Error("Graph must have at least one node");let r=n[0],o=e.nodeCount();t.setNode(r,{});let i,s;for(;v0e(t,e)<o&&(i=b0e(t,e),!!i);)s=t.hasNode(i.v)?Ku(e,i):-Ku(e,i),w0e(t,e,s);return t}function v0e(e,t){function n(r){let o=t.nodeEdges(r);o&&o.forEach(i=>{let s=i.v,c=r===s?i.w:s;!e.hasNode(c)&&!Ku(t,i)&&(e.setNode(c,{}),e.setEdge(r,c,{}),n(c))})}return e.nodes().forEach(n),e.nodeCount()}function b0e(e,t){return t.edges().reduce((n,r)=>{let o=Number.POSITIVE_INFINITY;return e.hasNode(r.v)!==e.hasNode(r.w)&&(o=Ku(t,r)),o<n[0]?[o,r]:n},[Number.POSITIVE_INFINITY,null])[1]}function w0e(e,t,n){e.nodes().forEach(r=>t.node(r).rank+=n)}var{preorder:S0e,postorder:E0e}=GC,C0e=Sc;Sc.initLowLimValues=WC;Sc.initCutValues=QC;Sc.calcCutValue=R$;Sc.leaveEdge=N$;Sc.enterEdge=T$;Sc.exchangeEdges=M$;function Sc(e){e=Gbe(e),XC(e);let t=j$(e);WC(t),QC(t,e);let n,r;for(;n=N$(t);)r=T$(t,e,n),M$(t,e,n,r)}function QC(e,t){let n=E0e(e,e.nodes());n=n.slice(0,n.length-1),n.forEach(r=>k0e(e,t,r))}function k0e(e,t,n){let r=e.node(n).parent,o=e.edge(n,r);o.cutvalue=R$(e,t,n)}function R$(e,t,n){let r=e.node(n).parent,o=!0,i=t.edge(n,r),s=0;i||(o=!1,i=t.edge(r,n)),s=i.weight;let c=t.nodeEdges(n);return c&&c.forEach(d=>{let u=d.v===n,p=u?d.w:d.v;if(p!==r){let m=u===o,g=t.edge(d).weight;if(s+=m?g:-g,R0e(e,n,p)){let y=e.edge(n,p).cutvalue;s+=m?-y:y}}}),s}function WC(e,t){arguments.length<2&&(t=e.nodes()[0]),_$(e,{},1,t)}function _$(e,t,n,r,o){let i=n,s=e.node(r);t[r]=!0;let c=e.neighbors(r);return c&&c.forEach(d=>{Object.hasOwn(t,d)||(n=_$(e,t,n,d,r))}),s.low=i,s.lim=n++,o?s.parent=o:delete s.parent,n}function N$(e){return e.edges().find(t=>e.edge(t).cutvalue<0)}function T$(e,t,n){let r=n.v,o=n.w;t.hasEdge(r,o)||(r=n.w,o=n.v);let i=e.node(r),s=e.node(o),c=i,d=!1;return i.lim>s.lim&&(c=s,d=!0),t.edges().filter(u=>d===WO(e,e.node(u.v),c)&&d!==WO(e,e.node(u.w),c)).reduce((u,p)=>Ku(t,p)<Ku(t,u)?p:u)}function M$(e,t,n,r){let o=n.v,i=n.w;e.removeEdge(o,i),e.setEdge(r.v,r.w,{}),WC(e),QC(e,t),j0e(e,t)}function j0e(e,t){let n=e.nodes().find(o=>!e.node(o).parent);if(!n)return;let r=S0e(e,[n]);r=r.slice(1),r.forEach(o=>{let i=e.node(o).parent,s=t.edge(o,i),c=!1;s||(s=t.edge(i,o),c=!0),t.node(o).rank=t.node(i).rank+(c?s.minlen:-s.minlen)})}function R0e(e,t,n){return e.hasEdge(t,n)}function WO(e,t,n){return n.low<=t.lim&&t.lim<=n.lim}var _0e=N0e;function N0e(e){let t=e.graph().ranker;if(typeof t=="function")return t(e);switch(t){case"network-simplex":JO(e);break;case"tight-tree":M0e(e);break;case"longest-path":T0e(e);break;case"none":break;default:JO(e)}}var T0e=XC;function M0e(e){XC(e),j$(e)}function JO(e){C0e(e)}var A0e=O0e;function O0e(e){let t=P0e(e),n=e.graph();Array.isArray(n.dummyChains)&&n.dummyChains.forEach(r=>{let o=e.node(r),i=o.edgeObj,s=D0e(e,t,i.v,i.w),c=s.path,d=s.lca,u=0,p=c[u],m=!0;for(;r!==i.w;){if(o=e.node(r),m){for(;(p=c[u])!==d&&e.node(p).maxRank<o.rank;)u++;p===d&&(m=!1)}if(!m){for(;u<c.length-1&&e.node(c[u+1]).minRank<=o.rank;)u++;p=c[u]}p!==void 0&&e.setParent(r,p),r=e.successors(r)[0]}})}function D0e(e,t,n,r){let o=[],i=[],s=Math.min(t[n].low,t[r].low),c=Math.max(t[n].lim,t[r].lim),d;d=n;do d=e.parent(d),o.push(d);while(d&&(t[d].low>s||c>t[d].lim));let u=d,p=r;for(;(p=e.parent(p))!==u;)i.push(p);return{path:o.concat(i.reverse()),lca:u}}function P0e(e){let t={},n=0;function r(o){let i=n;e.children(o).forEach(r),t[o]={low:i,lim:n++}}return e.children(Zx).forEach(r),t}function I0e(e){let t=md(e,"root",{},"_root"),n=z0e(e),r=Object.values(n),o=ss(Math.max,r)-1,i=2*o+1;e.graph().nestingRoot=t,e.edges().forEach(c=>e.edge(c).minlen*=i);let s=L0e(e)+1;e.children(Zx).forEach(c=>{A$(e,t,i,s,o,n,c)}),e.graph().nodeRankFactor=i}function A$(e,t,n,r,o,i,s){var c;let d=e.children(s);if(!d.length){s!==t&&e.setEdge(t,s,{weight:0,minlen:n});return}let u=XO(e,"_bt"),p=XO(e,"_bb"),m=e.node(s);e.setParent(u,s),m.borderTop=u,e.setParent(p,s),m.borderBottom=p,d.forEach(g=>{var y;A$(e,t,n,r,o,i,g);let v=e.node(g),S=v.borderTop?v.borderTop:g,w=v.borderBottom?v.borderBottom:g,E=v.borderTop?r:2*r,k=S!==w?1:o-((y=i[s])!=null?y:0)+1;e.setEdge(u,S,{weight:E,minlen:k,nestingEdge:!0}),e.setEdge(w,p,{weight:E,minlen:k,nestingEdge:!0})}),e.parent(s)||e.setEdge(t,u,{weight:0,minlen:o+((c=i[s])!=null?c:0)})}function z0e(e){let t={};function n(r,o){let i=e.children(r);i&&i.length&&i.forEach(s=>n(s,o+1)),t[r]=o}return e.children(Zx).forEach(r=>n(r,1)),t}function L0e(e){return e.edges().reduce((t,n)=>t+e.edge(n).weight,0)}function F0e(e){let t=e.graph();e.removeNode(t.nestingRoot),delete t.nestingRoot,e.edges().forEach(n=>{e.edge(n).nestingEdge&&e.removeEdge(n)})}var $0e=V0e;function V0e(e){function t(n){let r=e.children(n),o=e.node(n);if(r.length&&r.forEach(t),o&&Object.hasOwn(o,"minRank")){o.borderLeft=[],o.borderRight=[];for(let i=o.minRank,s=o.maxRank+1;i<s;++i)e2(e,"borderLeft","_bl",n,o,i),e2(e,"borderRight","_br",n,o,i)}}e.children(Zx).forEach(t)}function e2(e,t,n,r,o,i){let s={width:0,height:0,rank:i,borderType:t},c=o[t][i-1],d=md(e,"border",s,n);o[t][i]=d,e.setParent(d,r),c&&e.setEdge(c,d,{weight:1})}function B0e(e){var t;let n=(t=e.graph().rankdir)==null?void 0:t.toLowerCase();(n==="lr"||n==="rl")&&O$(e)}function H0e(e){var t;let n=(t=e.graph().rankdir)==null?void 0:t.toLowerCase();(n==="bt"||n==="rl")&&U0e(e),(n==="lr"||n==="rl")&&(q0e(e),O$(e))}function O$(e){e.nodes().forEach(t=>t2(e.node(t))),e.edges().forEach(t=>t2(e.edge(t)))}function t2(e){let t=e.width;e.width=e.height,e.height=t}function U0e(e){e.nodes().forEach(t=>hw(e.node(t))),e.edges().forEach(t=>{var n;let r=e.edge(t);(n=r.points)==null||n.forEach(hw),Object.hasOwn(r,"y")&&hw(r)})}function hw(e){e.y=-e.y}function q0e(e){e.nodes().forEach(t=>pw(e.node(t))),e.edges().forEach(t=>{var n;let r=e.edge(t);(n=r.points)==null||n.forEach(pw),Object.hasOwn(r,"x")&&pw(r)})}function pw(e){let t=e.x;e.x=e.y,e.y=t}function Y0e(e,t=null){let n={},r=e.nodes().filter(u=>!e.children(u).length),o=r.map(u=>e.node(u).rank),i=ss(Math.max,o),s=bh(i+1).map(()=>[]);function c(u){if(n[u])return;n[u]=!0;let p=e.node(u);s[p.rank].push(u);let m=e.successors(u);m&&[...m].sort((g,y)=>d(g,y)).forEach(c)}r.sort((u,p)=>e.node(u).rank-e.node(p).rank).forEach(c);function d(u,p){let m=e.node(u),g=e.node(p);return k$(t,m,g)}return s}function Z0e(e,t){let n=0;for(let r=1;r<t.length;++r)n+=G0e(e,t[r-1],t[r]);return n}function G0e(e,t,n){let r=t0e(n,n.map((u,p)=>p)),o=t.flatMap(u=>{let p=e.outEdges(u);return p?p.map(m=>({pos:r[m.w],weight:e.edge(m).weight})).sort((m,g)=>m.pos-g.pos):[]}),i=1;for(;i<n.length;)i<<=1;let s=2*i-1;i-=1;let c=new Array(s).fill(0),d=0;return o.forEach(u=>{let p=u.pos+i;c[p]+=u.weight;let m=0;for(;p>0;)p%2&&(m+=c[p+1]),p=p-1>>1,c[p]+=u.weight;d+=u.weight*m}),d}function K0e(e,t=[]){return t.map(n=>{let r=e.inEdges(n);if(!r||!r.length)return{v:n};{let o=r.reduce((i,s)=>{let c=e.edge(s),d=e.node(s.v);return{sum:i.sum+c.weight*d.order,weight:i.weight+c.weight}},{sum:0,weight:0});return{v:n,barycenter:o.sum/o.weight,weight:o.weight}}})}function X0e(e,t){let n={};e.forEach((o,i)=>{let s={indegree:0,in:[],out:[],vs:[o.v],i};o.barycenter!==void 0&&(s.barycenter=o.barycenter,s.weight=o.weight),n[o.v]=s}),t.edges().forEach(o=>{let i=n[o.v],s=n[o.w];i!==void 0&&s!==void 0&&(s.indegree++,i.out.push(s))});let r=Object.values(n).filter(o=>!o.indegree);return Q0e(r)}function Q0e(e){let t=[];function n(o){return i=>{i.merged||(i.barycenter===void 0||o.barycenter===void 0||i.barycenter>=o.barycenter)&&W0e(o,i)}}function r(o){return i=>{i.in.push(o),--i.indegree===0&&e.push(i)}}for(;e.length;){let o=e.pop();t.push(o),o.in.reverse().forEach(n(o)),o.out.forEach(r(o))}return t.filter(o=>!o.merged).map(o=>ky(o,["vs","i","barycenter","weight"]))}function W0e(e,t){let n=0,r=0;e.weight&&(n+=e.barycenter*e.weight,r+=e.weight),t.weight&&(n+=t.barycenter*t.weight,r+=t.weight),e.vs=t.vs.concat(e.vs),e.barycenter=n/r,e.weight=r,e.i=Math.min(t.i,e.i),t.merged=!0}function J0e(e,t,n,r,o){let i={},s=null,c=null,d=o;typeof t=="boolean"?(d=t,i={}):t&&(i=t,s=n??null,c=r??null);let u=Wbe(e,E=>Object.hasOwn(E,"barycenter")),p=u.lhs,m=u.rhs.sort((E,k)=>k.i-E.i),g=[],y=0,v=0,S=0;p.sort(ewe(c,s,!!d));for(let[E,k]of Object.entries(i)){let j=p.findIndex(N=>N.vs[0]===E);p.splice(j+1,0,k)}S=n2(g,m,S),p.forEach(E=>{S+=E.vs.length,g.push(E.vs),y+=E.barycenter*E.weight,v+=E.weight,S=n2(g,m,S)});let w={vs:g.flat(1)};return v&&(w.barycenter=y/v,w.weight=v),w}function n2(e,t,n){let r;for(;t.length&&(r=t[t.length-1]).i<=n;)t.pop(),e.push(r.vs),n++;return n}function ewe(e,t,n){return(r,o)=>{if(r.barycenter<o.barycenter)return-1;if(r.barycenter>o.barycenter)return 1;if(e&&(typeof r.vs[0]=="string"||typeof o.vs[0]=="string")){let i=e.node(r.vs[0]),s=e.node(o.vs[0]),c=k$(t,i,s);if(c!==0)return c}return n?o.i-r.i:r.i-o.i}}function D$(e,t,n,r,o){var i,s,c,d,u,p,m,g,y,v,S;let w=null,E=o;typeof r=="boolean"?(E=r,w=null):r!==void 0&&(w=r);let k=e.children(t),j=e.node(t),N=j?j.borderLeft:void 0,A=j?j.borderRight:void 0,R={};N&&(k=k.filter($=>$!==N&&$!==A));let M=K0e(e,k);M.forEach($=>{if(e.children($.v).length){let{result:G}=D$(e,$.v,n,w,E);R[$.v]=G,Object.hasOwn(G,"barycenter")&&nwe($,G)}});let T=X0e(M,n);twe(T,R);let O={},z=!1;for(let $=0;$<T.length;$++)for(let G=$+1;G<T.length;G++)if(!(!T[$]||!T[G]||!((i=T[$])!=null&&i.barycenter)||!((s=T[G])!=null&&s.barycenter))&&((c=T[$])==null?void 0:c.barycenter)===T[G].barycenter){let L=(u=(d=T[$])==null?void 0:d.vs[0])!=null?u:"",F=(m=(p=T[G])==null?void 0:p.vs[0])!=null?m:"",P=e.node(L),I=e.node(F);if(P.dummy==="edge"&&I.dummy==="edge"&&((g=P.edgeObj)==null?void 0:g.v)===((y=I.edgeObj)==null?void 0:y.v)&&((v=P.edgeObj)==null?void 0:v.w)===((S=I.edgeObj)==null?void 0:S.w))if(P.edgeLabel.reversed){O[F]=T[$],T.splice($,1),$--;break}else O[L]=T[G],T.splice(G,1),G--;else z=!0}let q=J0e(T,O,w,e,E);if(N&&A){q.vs=[N,q.vs,A].flat(1);let $=e.predecessors(N);if($&&$.length){let G=e.node($[0]),L=e.predecessors(A),F=e.node(L[0]);Object.hasOwn(q,"barycenter")||(q.barycenter=0,q.weight=0),q.barycenter=(q.barycenter*q.weight+G.order+F.order)/(q.weight+2),q.weight+=2}}return Object.defineProperty(q,"result",{value:q,enumerable:!1,configurable:!0,writable:!0}),Object.defineProperty(q,"usedBias",{value:z,enumerable:!1,configurable:!0,writable:!0}),q}function twe(e,t){e.forEach(n=>{n.vs=n.vs.flatMap(r=>t[r]?t[r].vs:r)})}function nwe(e,t){e.barycenter!==void 0?(e.barycenter=(e.barycenter*e.weight+t.barycenter*t.weight)/(e.weight+t.weight),e.weight+=t.weight):(e.barycenter=t.barycenter,e.weight=t.weight)}function rwe(e,t,n,r){r||(r=e.nodes());let o=owe(e),i=new Ui({compound:!0}).setGraph({root:o}).setDefaultNodeLabel(s=>e.node(s));return r.forEach(s=>{let c=e.node(s),d=e.parent(s);if(c.rank===t||c.minRank<=t&&t<=c.maxRank){i.setNode(s),i.setParent(s,d||o);let u=e[n](s);u&&u.forEach(p=>{let m=p.v===s?p.w:p.v,g=i.edge(m,s),y=g!==void 0?g.weight:0;i.setEdge(m,s,{weight:e.edge(p).weight+y})}),Object.hasOwn(c,"minRank")&&i.setNode(s,{borderLeft:c.borderLeft[t],borderRight:c.borderRight[t]})}}),i}function owe(e){let t;for(;e.hasNode(t=KC("_root")););return t}function iwe(e,t,n){let r={},o;n.forEach(i=>{let s=e.parent(i),c,d;for(;s;){if(c=e.parent(s),c?(d=r[c],r[c]=s):(d=o,o=s),d&&d!==s){t.setEdge(d,s);return}s=c}})}function P$(e,t={},n=null){if(typeof t.customOrder=="function"){t.customOrder(e,P$);return}let r=E$(e),o=r2(e,bh(1,r+1),"inEdges"),i=r2(e,bh(r-1,-1,-1),"outEdges"),s=Y0e(e,n);if(o2(e,s),t.disableOptimalOrderHeuristic)return;let c=Number.POSITIVE_INFINITY,d,u=t.constraints||[];for(let p=0,m=0;m<4;++p,++m){swe(p%2?o:i,p%4>=2,u,n),s=cp(e);let g=Z0e(e,s);g<c?(m=0,d=Object.assign({},s),c=g):g===c&&(d=structuredClone(s))}o2(e,d)}function r2(e,t,n){let r=new Map,o=(i,s)=>{r.has(i)||r.set(i,[]),r.get(i).push(s)};for(let i of e.nodes()){let s=e.node(i);if(typeof s.rank=="number"&&o(s.rank,i),typeof s.minRank=="number"&&typeof s.maxRank=="number")for(let c=s.minRank;c<=s.maxRank;c++)c!==s.rank&&o(c,i)}return t.map(function(i){return rwe(e,i,n,r.get(i)||[])})}function swe(e,t,n,r){let o=!0,i=new Ui;e.forEach(function(s){n.forEach(p=>i.setEdge(p.left,p.right));let c=s.graph().root,{result:d,usedBias:u}=D$(s,c,i,r,o);t&&u&&(o=!o),d.vs.forEach((p,m)=>s.node(p).order=m),iwe(s,i,d.vs)})}function o2(e,t){Object.values(t).forEach(n=>n.forEach((r,o)=>e.node(r).order=o))}function awe(e,t){let n={};function r(o,i){let s=0,c=0,d=o.length,u=i[i.length-1];return i.forEach((p,m)=>{let g=cwe(e,p),y=g?e.node(g).order:d;(g||p===u)&&(i.slice(c,m+1).forEach(v=>{let S=e.predecessors(v);S&&S.forEach(w=>{let E=e.node(w),k=E.order;(k<s||y<k)&&!(E.dummy&&e.node(v).dummy)&&I$(n,w,v)})}),c=m+1,s=y)}),i}return t.length&&t.reduce(r),n}function lwe(e,t){let n={};function r(i,s,c,d,u){bh(s,c).forEach(p=>{let m=i[p];if(m!==void 0&&e.node(m).dummy){let g=e.predecessors(m);g&&g.forEach(y=>{if(y===void 0)return;let v=e.node(y);v.dummy&&(v.order<d||v.order>u)&&I$(n,y,m)})}})}function o(i,s){let c=-1,d=-1,u=0;return s.forEach((p,m)=>{if(e.node(p).dummy==="border"){let g=e.predecessors(p);if(g&&g.length){let y=g[0];if(y===void 0)return;d=e.node(y).order,r(s,u,m,c,d),u=m,c=d}}r(s,u,s.length,d,i.length)}),s}return t.length&&t.reduce(o),n}function cwe(e,t){if(e.node(t).dummy){let n=e.predecessors(t);if(n)return n.find(r=>e.node(r).dummy)}}function I$(e,t,n){if(t>n){let o=t;t=n,n=o}let r=e[t];r||(e[t]=r={}),r[n]=!0}function uwe(e,t,n){if(t>n){let o=t;t=n,n=o}let r=e[t];return r!==void 0&&Object.hasOwn(r,n)}function dwe(e,t,n,r,o){let i={},s={},c={};return t.forEach(d=>{d.forEach((u,p)=>{i[u]=u,s[u]=u,c[u]=p})}),t.forEach(d=>{let u=-1,p=-1,m=!1,g=d,y=d.findIndex(v=>o?.includes(v)||i2(v,e,o));y>0&&(g=[d[y],...d.slice(0,y),...d.slice(y+1)],m=!0),g.forEach(v=>{var S;let w=r(v);if(w&&w.length){o!=null&&o.includes(v)&&(w=w.filter(j=>i2(j,e,o)));let E=w.sort((j,N)=>{let A=c[j],R=c[N];return(A!==void 0?A:0)-(R!==void 0?R:0)}),k=(E.length-1)/2;for(let j=Math.floor(k),N=Math.ceil(k);j<=N;++j){let A=E[j];if(A===void 0)continue;let R=c[A];if(R!==void 0&&s[v]===v&&u<R&&c[A]!==p&&!uwe(n,v,A)){let M=i[A];M!==void 0&&(s[A]=v,s[v]=i[v]=M,u=R,m&&(u=-1,p=(S=c[A])!=null?S:-1,m=!1))}}}})}),{root:i,align:s}}function fwe(e,t,n,r,o=!1){let i={},s=hwe(e,t,n,o),c=o?"borderLeft":"borderRight";function d(y,v){let S=s.nodes().slice(),w={},E=S.pop();for(;E;){if(w[E])y(E);else{w[E]=!0,S.push(E);for(let k of v(E))S.push(k)}E=S.pop()}}function u(y){let v=s.inEdges(y);v?i[y]=v.reduce((S,w)=>{var E;let k=(E=i[w.v])!=null?E:0,j=s.edge(w);return Math.max(S,k+(j!==void 0?j:0))},0):i[y]=0}function p(y){let v=s.outEdges(y),S=Number.POSITIVE_INFINITY;v&&(S=v.reduce((E,k)=>{let j=i[k.w],N=s.edge(k);return Math.min(E,(j!==void 0?j:0)-(N!==void 0?N:0))},Number.POSITIVE_INFINITY));let w=e.node(y);S!==Number.POSITIVE_INFINITY&&w.borderType!==c&&(i[y]=Math.max(i[y]!==void 0?i[y]:0,S))}function m(y){return s.predecessors(y)||[]}function g(y){return s.successors(y)||[]}return d(u,m),d(p,g),Object.keys(r).forEach(y=>{var v;let S=n[y];S!==void 0&&(i[y]=(v=i[S])!=null?v:0)}),i}function hwe(e,t,n,r){let o=new Ui,i=e.graph(),s=xwe(i.nodesep,i.edgesep,r);return t.forEach(c=>{let d;c.forEach(u=>{let p=n[u];if(p!==void 0){if(o.setNode(p),d!==void 0){let m=n[d];if(m!==void 0){let g=o.edge(m,p);o.setEdge(m,p,Math.max(s(e,u,d),g||0))}}d=u}})}),o}function pwe(e,t){return Object.values(t).reduce((n,r)=>{let o=Number.NEGATIVE_INFINITY,i=Number.POSITIVE_INFINITY;Object.entries(r).forEach(([c,d])=>{let u=vwe(e,c)/2;o=Math.max(d+u,o),i=Math.min(d-u,i)});let s=o-i;return s<n[0]&&(n=[s,r]),n},[Number.POSITIVE_INFINITY,null])[1]}function mwe(e,t){let n=Object.values(t),r=ss(Math.min,n),o=ss(Math.max,n);["u","d"].forEach(i=>{["l","r"].forEach(s=>{let c=i+s,d=e[c];if(!d||d===t)return;let u=Object.values(d),p=r-ss(Math.min,u);s!=="l"&&(p=o-ss(Math.max,u)),p&&(e[c]=Yx(d,m=>m+p))})})}function gwe(e,t=void 0){let n=e.ul;return n?Yx(n,(r,o)=>{var i,s;if(t){let d=t.toLowerCase(),u=e[d];if(u&&u[o]!==void 0)return u[o]}let c=Object.values(e).map(d=>{let u=d[o];return u!==void 0?u:0}).sort((d,u)=>d-u);return(((i=c[1])!=null?i:0)+((s=c[2])!=null?s:0))/2}):{}}function ywe(e,t){let n=cp(e),r=Object.assign(awe(e,n),lwe(e,n)),o={},i;["u","d"].forEach(c=>{i=c==="u"?n:Object.values(n).reverse(),["l","r"].forEach(d=>{d==="r"&&(i=i.map(m=>Object.values(m).reverse()));let u=dwe(e,i,r,m=>(c==="u"?e.predecessors(m):e.successors(m))||[],t),p=fwe(e,i,u.root,u.align,d==="r");d==="r"&&(p=Yx(p,m=>-m)),o[c+d]=p})});let s=pwe(e,o);return mwe(o,s),gwe(o,e.graph().align)}function xwe(e,t,n){return(r,o,i)=>{let s=r.node(o),c=r.node(i),d=0,u;if(d+=s.width/2,Object.hasOwn(s,"labelpos"))switch(s.labelpos.toLowerCase()){case"l":u=-s.width/2;break;case"r":u=s.width/2;break}if(u&&(d+=n?u:-u),u=void 0,d+=(s.dummy?t:e)/2,d+=(c.dummy?t:e)/2,d+=c.width/2,Object.hasOwn(c,"labelpos"))switch(c.labelpos.toLowerCase()){case"l":u=c.width/2;break;case"r":u=-c.width/2;break}return u&&(d+=n?u:-u),d}}function vwe(e,t){return e.node(t).width}function i2(e,t,n){var r;if(!n)return!1;let o=(r=t.node(e))==null?void 0:r.edgeObj;if(!o||t.node(e).edgeLabel.reversed)return!1;let i=n.indexOf(o?.v),s=n.indexOf(o?.w);return i!==-1&&s!==-1&&i===(s+1)%n.length||i===(s-1)%n.length}function bwe(e,t){e=w$(e),wwe(e),Object.entries(ywe(e,t)).forEach(([n,r])=>e.node(n).x=r)}function wwe(e){let t=cp(e),n=e.graph(),r=n.ranksep,o=n.rankalign,i=0;t.forEach(s=>{let c=s.reduce((d,u)=>{var p;let m=(p=e.node(u).height)!=null?p:0;return d>m?d:m},0);s.forEach(d=>{let u=e.node(d);o==="top"?u.y=i+u.height/2:o==="bottom"?u.y=i+c-u.height/2:u.y=i+c/2}),i+=c+r})}var s2=new WeakMap;function Swe(e,t={}){return z$(e,C$,t),e}function a2(e,t,n){let r=t;for(;r!==void 0;){let o=e.parent(r);if(o===n)return r;r=o}}function z$(e,t,n){var r;let o=e.nodes().filter(k=>e.children(k).length),i={};o.forEach(k=>{let j=e.node(k);if(j&&j.rankdir){let N=new Ui({multigraph:!0,compound:!0});N.setGraph({rankdir:j.rankdir});let A=e.children(k);A.forEach(L=>{let F={...e.node(L)};N.setNode(L,F);let P=e.parent(L);P&&P!==k&&A.includes(P)&&N.setParent(L,P)});let R=new Set;e.edges().forEach(L=>{let F=a2(e,L.v,k),P=a2(e,L.w,k);if(F&&P&&F!==P){let I=`${F}\0${P}`;R.has(I)||(R.add(I),N.setEdge(F,P,{...e.edge(L)}))}}),z$(N,t,n);let M=d2(N);l2(M,t,n,null),c2(N,M);let T=1/0,O=1/0,z=-1/0,q=-1/0;N.nodes().forEach(L=>{if(L===k)return;let F=N.node(L);F&&typeof F.x=="number"&&typeof F.y=="number"&&typeof F.width=="number"&&typeof F.height=="number"&&(T=Math.min(T,F.x-F.width/2),z=Math.max(z,F.x+F.width/2),O=Math.min(O,F.y-F.height/2),q=Math.max(q,F.y+F.height/2))}),(!isFinite(T)||!isFinite(O)||!isFinite(z)||!isFinite(q))&&(T=O=0,z=q=0);let $=z-T,G=q-O;i[k]={minX:T,minY:O,maxX:z,maxY:q,width:$,height:G,offsetX:T,offsetY:O},j._dagreClusterSubgraph=N}});let s=[],c=k=>{let j=[],N=(e.children(k)||[]).filter(A=>A!==k);for(;N.length>0;){let A=N.shift();j.push(A),(e.children(A)||[]).filter(R=>R!==A).forEach(R=>N.push(R))}return j},d=new Map;o.forEach(k=>{let j=e.node(k);j&&j.rankdir&&i[k]&&d.set(k,(e.children(k)||[]).filter(N=>N!==k))});let u=new Set([...d.values()].flat()),p=new Map;d.forEach((k,j)=>{u.has(j)||p.set(j,c(j))});let m=new Set([...p.values()].flat()),g=k=>{for(let[j,N]of p)if(N.includes(k))return j;return k},y=[];e.edges().forEach(k=>{(m.has(k.v)||m.has(k.w))&&y.push({edge:k,label:e.edge(k)})});let v=new Map;m.forEach(k=>{let j=e.parent(k);v.set(k,typeof j=="string"?j:void 0)}),p.forEach((k,j)=>{let N=e.node(j),A=[];k.forEach(T=>{let O=e.node(T);O&&(A.push({id:T,node:O,parent:v.get(T)}),e.removeNode(T))});let R=y.filter(({edge:T})=>k.includes(T.v)||k.includes(T.w)),M=i[j];N&&(s.push({clusterId:j,subgraph:N._dagreClusterSubgraph,bounds:M,children:k,removedNodes:A,removedEdges:R}),N.width=M.width,N.height=M.height)});let S=new Set;y.forEach(({edge:k,label:j})=>{let N=g(k.v),A=g(k.w);if(N!==A&&e.hasNode(N)&&e.hasNode(A)){let R=`${N}\0${A}`;S.has(R)||(S.add(R),e.setEdge(N,A,{...j,width:0,height:0}))}});let w=d2(e),E=l2(w,t,n,(r=s2.get(e))!=null?r:null);s2.set(e,E),c2(e,w),S.forEach(k=>{let j=k.indexOf("\0"),N=k.slice(0,j),A=k.slice(j+1);e.hasEdge(N,A)&&e.removeEdge(N,A)}),s.forEach(({clusterId:k,subgraph:j,bounds:N,removedNodes:A,removedEdges:R})=>{var M,T;let O=e.node(k),z=(M=O?.x)!=null?M:0,q=(T=O?.y)!=null?T:0,$=(N.minX+N.maxX)/2,G=(N.minY+N.maxY)/2;A.forEach(({id:L,node:F,parent:P})=>{e.setNode(L,F),P!==void 0&&e.setParent(L,P)}),R.forEach(({edge:L,label:F})=>{e.setEdge(L,F)}),j.nodes().forEach(L=>{if(L===k)return;let F=j.node(L),P=e.node(L);P&&F&&typeof F.x=="number"&&typeof F.y=="number"&&(P.x=z+(F.x-$),P.y=q+(F.y-G))}),delete O._dagreClusterSubgraph}),o.forEach(k=>{var j,N;let A=e.node(k),R=i[k];if(A&&A.rankdir&&A._dagreClusterSubgraph&&R){let M=A._dagreClusterSubgraph,T=(j=A.x)!=null?j:0,O=(N=A.y)!=null?N:0,z=(R.minX+R.maxX)/2,q=(R.minY+R.maxY)/2;M.nodes().forEach($=>{if($===k)return;let G=M.node($),L=e.node($);if(L&&G&&typeof G.x=="number"&&typeof G.y=="number"){let F=G.x-z,P=G.y-q;L.x=T+F,L.y=O+P}}),delete A._dagreClusterSubgraph}})}function l2(e,t,n,r=null){var o,i;let s=n?.useDynamic!==!1,c=s&&(o=r?.graph)!=null?o:null,d=s&&(i=r?.rawNodes)!=null?i:null;t(" makeSpaceForEdgeLabels",()=>Twe(e)),t(" removeSelfEdges",()=>Fwe(e)),t(" acyclic",()=>d0e(e,c)),t(" nestingGraph.run",()=>I0e(e)),t(" rank",()=>_0e(w$(e))),t(" injectEdgeLabelProxies",()=>Mwe(e)),t(" removeEmptyRanks",()=>Xbe(e)),t(" nestingGraph.cleanup",()=>F0e(e)),t(" normalizeRanks",()=>Kbe(e)),t(" assignRankMinMax",()=>Awe(e)),t(" removeEdgeLabelProxies",()=>Owe(e)),t(" normalize.run",()=>m0e(e)),t(" parentDummyChains",()=>A0e(e)),t(" addBorderSegments",()=>$0e(e)),t(" order",()=>P$(e,n,d)),t(" insertSelfEdges",()=>$we(e)),t(" adjustCoordinateSystem",()=>B0e(e)),t(" position",()=>bwe(e,n.corePath)),t(" positionSelfEdges",()=>Vwe(e));let u=JSON.parse(JSON.stringify(e._nodes));return t(" removeBorderNodes",()=>Lwe(e)),t(" normalize.undo",()=>y0e(e)),t(" fixupEdgeLabelCoords",()=>Iwe(e)),t(" undoCoordinateSystem",()=>H0e(e)),t(" translateGraph",()=>Dwe(e)),t(" assignNodeIntersects",()=>Pwe(e)),t(" reversePoints",()=>zwe(e)),t(" acyclic.undo",()=>h0e(e)),{graph:e,rawNodes:u}}function c2(e,t){e.nodes().forEach(n=>{let r=e.node(n),o=t.node(n);r&&(r.x=o.x,r.y=o.y,r.order=o.order,r.rank=o.rank,t.children(n).length&&(r.width=o.width,r.height=o.height))}),e.edges().forEach(n=>{let r=e.edge(n),o=t.edge(n);r.points=o.points,Object.hasOwn(o,"x")&&(r.x=o.x,r.y=o.y)}),e.graph().width=t.graph().width,e.graph().height=t.graph().height}var Ewe=["nodesep","edgesep","ranksep","marginx","marginy"],Cwe={ranksep:50,edgesep:20,nodesep:50,rankdir:"TB",rankalign:"center"},kwe=["acyclicer","ranker","rankdir","align","rankalign"],jwe=["width","height","rank"],u2={width:0,height:0},Rwe=["minlen","weight","width","height","labeloffset"],_we={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},Nwe=["labelpos"];function d2(e){let t=new Ui({multigraph:!0,compound:!0}),n=gw(e.graph());return t.setGraph(Object.assign({},Cwe,mw(n,Ewe),ky(n,kwe))),e.nodes().forEach(r=>{let o=gw(e.node(r)),i=mw(o,jwe);Object.keys(u2).forEach(c=>{i[c]===void 0&&(i[c]=u2[c])}),t.setNode(r,i);let s=e.parent(r);s!==void 0&&t.setParent(r,s)}),e.edges().forEach(r=>{let o=gw(e.edge(r));t.setEdge(r,Object.assign({},_we,mw(o,Rwe),ky(o,Nwe)))}),t}function Twe(e){let t=e.graph();t.ranksep/=2,e.edges().forEach(n=>{var r;let o=e.edge(n);o.minlen*=2,((r=o.labelpos)!=null?r:"r").toLowerCase()!=="c"&&(t.rankdir==="TB"||t.rankdir==="BT"?o.width+=o.labeloffset:o.height+=o.labeloffset)})}function Mwe(e){e.edges().forEach(t=>{let n=e.edge(t);if(n.width&&n.height){let r=e.node(t.v),o={rank:(e.node(t.w).rank-r.rank)/2+r.rank,e:t};md(e,"edge-proxy",o,"_ep")}})}function Awe(e){let t=0;e.nodes().forEach(n=>{let r=e.node(n);r.borderTop&&(r.minRank=e.node(r.borderTop).rank,r.maxRank=e.node(r.borderBottom).rank,t=Math.max(t,r.maxRank))}),e.graph().maxRank=t}function Owe(e){e.nodes().forEach(t=>{let n=e.node(t);if(n.dummy==="edge-proxy"){let r=n;e.edge(r.e).labelRank=n.rank,e.removeNode(t)}})}function Dwe(e){let t=Number.POSITIVE_INFINITY,n=0,r=Number.POSITIVE_INFINITY,o=0,i=e.graph(),s=i.marginx||0,c=i.marginy||0;function d(u){let p=u.x,m=u.y,g=u.width,y=u.height;t=Math.min(t,p-g/2),n=Math.max(n,p+g/2),r=Math.min(r,m-y/2),o=Math.max(o,m+y/2)}e.nodes().forEach(u=>d(e.node(u))),e.edges().forEach(u=>{let p=e.edge(u);Object.hasOwn(p,"x")&&d(p)}),t-=s,r-=c,e.nodes().forEach(u=>{let p=e.node(u);p.x-=t,p.y-=r}),e.edges().forEach(u=>{let p=e.edge(u);p.points.forEach(m=>{m.x-=t,m.y-=r}),Object.hasOwn(p,"x")&&(p.x-=t),Object.hasOwn(p,"y")&&(p.y-=r)}),i.width=n-t+s,i.height=o-r+c}function Pwe(e){e.edges().forEach(t=>{if(t.v===t.w)return;let n=e.edge(t),r=e.node(t.v),o=e.node(t.w),i,s;n.points?(i=n.points[0],s=n.points[n.points.length-1]):(n.points=[],i=o,s=r),n.points.unshift(KO(r,i)),n.points.push(KO(o,s))})}function Iwe(e){e.edges().forEach(t=>{let n=e.edge(t);if(Object.hasOwn(n,"x"))switch((n.labelpos==="l"||n.labelpos==="r")&&(n.width-=n.labeloffset),n.labelpos){case"l":n.x-=n.width/2+n.labeloffset;break;case"r":n.x+=n.width/2+n.labeloffset;break}})}function zwe(e){e.edges().forEach(t=>{let n=e.edge(t);n.reversed&&n.points.reverse()})}function Lwe(e){e.nodes().forEach(t=>{if(e.children(t).length){let n=e.node(t),r=e.node(n.borderTop),o=e.node(n.borderBottom),i=e.node(n.borderLeft[n.borderLeft.length-1]),s=e.node(n.borderRight[n.borderRight.length-1]);n.width=Math.abs(s.x-i.x),n.height=Math.abs(o.y-r.y),n.x=i.x+n.width/2,n.y=r.y+n.height/2}}),e.nodes().forEach(t=>{e.node(t).dummy==="border"&&e.removeNode(t)})}function Fwe(e){e.edges().forEach(t=>{if(t.v===t.w){let n=e.node(t.v);n.selfEdges||(n.selfEdges=[]),n.selfEdges.push({e:t,label:e.edge(t)}),e.removeEdge(t)}})}function $we(e){cp(e).forEach(t=>{let n=0;t.forEach((r,o)=>{let i=e.node(r);typeof i.rank!="number"&&(i.rank=0),i.order=o+n,(i.selfEdges||[]).forEach(s=>{md(e,"selfedge",{width:s.label.width,height:s.label.height,rank:i.rank,order:o+ ++n,e:s.e,edgeLabel:s.label},"_se"),(!Array.isArray(s.label.points)||s.label.points.length!==7)&&(s.label.points=[{x:0,y:-10},{x:0,y:-10},{x:0,y:0},{x:0,y:10},{x:0,y:10},{x:0,y:0},{x:0,y:0}])}),delete i.selfEdges})})}function Vwe(e){e.nodes().forEach(t=>{let n=e.node(t),r=o=>typeof o=="number"&&isFinite(o);if(n.dummy==="selfedge"){let o=n,i=e.node(o.e.v),s=r(i?.x)?i.x:0,c=r(i?.y)?i.y:0,d=r(i?.width)?i.width:0,u=r(i?.height)?i.height:0,p=r(n.x)?n.x:s,m=r(n.y)?n.y:c,g=d/2,y=u/2;o.edgeLabel.points=[{x:p+g,y:m-y},{x:p+g,y:m-y},{x:p,y:m},{x:p-g,y:m+y},{x:p-g,y:m+y},{x:p,y:m},{x:p,y:m}],o.edgeLabel.x=p,o.edgeLabel.y=m,e.setEdge(o.e,o.edgeLabel),e.removeNode(t)}else n&&Array.isArray(n.selfEdges)&&n.selfEdges.forEach(o=>{if(!Array.isArray(o.label.points)||o.label.points.length!==7){let i=r(n.x)?n.x:0,s=r(n.y)?n.y:0,c=r(n.width)?n.width:0,d=r(n.height)?n.height:0,u=c/2,p=d/2;o.label.points=[{x:i+u,y:s-p},{x:i+u,y:s-p},{x:i,y:s},{x:i-u,y:s+p},{x:i-u,y:s+p},{x:i,y:s},{x:i,y:s}]}})})}function mw(e,t){return Yx(ky(e,t),Number)}function gw(e){let t={};return e&&Object.entries(e).forEach(([n,r])=>{typeof n=="string"&&(n=n.toLowerCase()),t[n]=r}),t}function Bwe(e){let t=cp(e),n=new Ui({compound:!0,multigraph:!0}).setGraph({});return e.nodes().forEach(r=>{n.setNode(r,{label:r}),n.setParent(r,"layer"+e.node(r).rank)}),e.edges().forEach(r=>n.setEdge(r.v,r.w,{},r.name)),t.forEach((r,o)=>{let i="layer"+o;n.setNode(i,{rank:"same"}),r.reduce((s,c)=>(n.setEdge(s,c,{style:"invis"}),c))}),n}var Hwe={graphlib:h$,version:n0e,layout:Swe,debug:Bwe,util:{time:Jbe,notime:C$}},f2=Hwe;const Uwe=200,qwe=64;function L$(e,t){const n=new f2.graphlib.Graph;n.setGraph({rankdir:"TB",nodesep:60,ranksep:80,marginx:40,marginy:40}),n.setDefaultEdgeLabel(()=>({}));for(const o of e)n.setNode(o.id,{width:Uwe,height:qwe});for(const o of t)n.setEdge(o.from,o.to);f2.layout(n);const r={};for(const o of e){const i=n.node(o.id);i&&(r[o.id]={x:i.x-i.width/2,y:i.y-i.height/2})}return r}function h2(e,t,n){const r=n&&e.every(o=>n[o.id])?n:L$(e,t);return e.map(o=>({id:o.id,type:"dagNode",position:r[o.id]??{x:0,y:0},data:{node:o}}))}const F$={type:"smoothstep",markerEnd:{type:gh.ArrowClosed,width:18,height:18}};function ug(e){return e.map(t=>{const n={id:`${t.from}->${t.to}`,source:t.from,target:t.to,label:t.condition??void 0,...F$};return t.pausePoint?{...n,type:"pause",data:{pausePoint:t.pausePoint}}:n})}function Ywe(e,t,n,r){const o={};for(const s of e)o[s.id]={x:s.position.x,y:s.position.y};const i=t.map(s=>r.find(d=>d.from===s.source&&d.to===s.target)??{from:s.source,to:s.target});return{nodes:n,edges:i,layout:o}}function Zwe(e){return!e.source||!e.target?!1:e.source!==e.target}const Gwe={dagNode:vbe},Kwe={pause:bbe};function p2({nodes:e,edges:t,readOnly:n,onNodesChange:r,onEdgesChange:o,onConnect:i,onNodeClick:s,onEdgeClick:c,onPaneClick:d}){const u=b.useCallback(p=>Zwe({source:p.source,target:p.target}),[]);return f.jsx("div",{className:"h-full w-full",children:f.jsxs(hve,{nodes:e,edges:t,nodeTypes:Gwe,edgeTypes:Kwe,nodesDraggable:!n,nodesConnectable:!n,nodesFocusable:!n,edgesFocusable:!n,edgesReconnectable:!n,deleteKeyCode:n?null:"Backspace",onNodesChange:r,onEdgesChange:o,onConnect:i,isValidConnection:u,onNodeClick:s,onEdgeClick:c,...d!==void 0?{onPaneClick:d}:{},fitView:!0,fitViewOptions:{padding:.2},children:[f.jsx(Sve,{variant:Ks.Dots,gap:20}),f.jsx(Nve,{}),f.jsx(Hve,{pannable:!0,zoomable:!0})]})})}function Xwe({edge:e,onConditionChange:t,onPausePointChange:n,onDelete:r,onClose:o}){const i=Vn("pause_type").filter(d=>d.active),s=d=>i.find(u=>u.value===d)?.label??d;if(!e)return null;const c=e.pausePoint;return f.jsxs("div",{role:"region","aria-label":"边编辑",className:"absolute top-3 right-3 z-10 w-64 rounded-lg border border-border bg-card p-3 shadow-md",children:[f.jsxs("div",{className:"mb-2 flex items-center justify-between",children:[f.jsxs("span",{className:"text-xs text-muted-foreground",children:["边 ",f.jsx("span",{className:"font-mono",children:e.from})," → ",f.jsx("span",{className:"font-mono",children:e.to})]}),f.jsx("button",{type:"button","aria-label":"关闭边编辑",className:"text-muted-foreground hover:text-foreground",onClick:o,children:"✕"})]}),f.jsxs("div",{className:"flex flex-col gap-2",children:[f.jsx(jr,{htmlFor:"edge-condition",children:"条件(可选)"}),f.jsx(Lt,{id:"edge-condition",placeholder:"如 backend / ui / always",value:e.condition??"",onChange:d=>t(d.target.value)}),c?f.jsxs("div",{className:"flex flex-col gap-2 rounded-md border border-warning/30 bg-warning/5 p-2",children:[f.jsxs("div",{className:"flex items-center justify-between",children:[f.jsx("span",{className:"text-xs font-medium text-warning",children:"暂停点"}),f.jsx(Te,{type:"button",variant:"ghost",size:"sm",className:"h-6 px-2 text-xs text-destructive hover:text-destructive",onClick:()=>n(void 0),children:"摘除"})]}),f.jsxs(pr,{value:c.type,onValueChange:d=>{d!==null&&n({...c,type:d})},children:[f.jsx(mr,{className:"text-xs",children:s(c.type)}),f.jsx(gr,{children:i.map(d=>f.jsx(Un,{value:d.value,children:d.label},d.value))})]}),f.jsx(Lt,{className:"text-xs",value:c.description,placeholder:"暂停点描述",onChange:d=>n({...c,description:d.target.value})}),f.jsxs("label",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[f.jsx("input",{type:"checkbox",checked:c.autoResume,onChange:d=>n({...c,autoResume:d.target.checked})}),"自动恢复(checkpoint)"]})]}):f.jsx(Te,{type:"button",variant:"outline",size:"sm",onClick:()=>n({type:"human_approval",description:`请审批 ${e.from} 的产出`,autoResume:!1}),children:"⏸ 在此边挂暂停点"}),f.jsx("div",{className:"mt-1 border-t border-border pt-2",children:f.jsx(Te,{type:"button",variant:"ghost",size:"sm","aria-label":"删除边",className:"h-6 px-2 text-xs text-destructive hover:text-destructive",onClick:r,children:"删除边"})})]})]})}function $$({value:e,onChange:t,id:n,label:r,placeholder:o,emptyText:i,suggestions:s,suggestionsLoading:c=!1,suggestionsError:d,onRetrySuggestions:u,disabled:p=!1}){const[m,g]=b.useState(""),[y,v]=b.useState(null),w=!c&&d==null?s.filter(k=>!e.includes(k)):[],E=()=>{const k=m.trim();if(k.length!==0){if(e.includes(k)){v(`${r}「${k}」已绑定`);return}v(null),t([...e,k]),g("")}};return f.jsxs("div",{className:"flex flex-col gap-2",children:[f.jsxs("div",{className:"flex gap-2",children:[f.jsx(Lt,{id:n,list:`${n}-suggestions`,value:m,placeholder:o,"aria-label":`输入${r}名称`,disabled:p,onChange:k=>{g(k.target.value),y!==null&&v(null)},onKeyDown:k=>{k.key==="Enter"&&(k.preventDefault(),E())}}),f.jsx("datalist",{id:`${n}-suggestions`,children:w.map(k=>f.jsx("option",{value:k},k))}),f.jsxs(Te,{type:"button",variant:"outline",size:"sm",className:"shrink-0","aria-label":`添加${r}`,disabled:p||m.trim().length===0,onClick:E,children:[f.jsx(Qf,{"aria-hidden":"true"}),"添加"]})]}),y!==null&&f.jsx(cx,{message:y}),c?f.jsxs("p",{className:"text-xs text-muted-foreground",role:"status",children:[r,"建议加载中,仍可手工输入名称。"]}):d!=null?f.jsxs("div",{className:"flex items-center gap-2",role:"alert",children:[f.jsxs("p",{className:"text-xs text-destructive",children:[r,"建议加载失败:",ft(d),"。仍可手工输入名称。"]}),u&&f.jsxs(Te,{type:"button",variant:"outline",size:"sm","aria-label":`重试加载${r}建议`,disabled:p,onClick:u,children:[f.jsx(l8,{"aria-hidden":"true"}),"重试"]})]}):s.length===0?f.jsxs("p",{className:"text-xs text-muted-foreground",children:["暂无可用",r,"建议,可输入稍后安装的名称。"]}):f.jsxs("p",{className:"text-xs text-muted-foreground",children:["可从当前项目可见",r,"中选择,也可自由输入名称。"]}),e.length===0?f.jsx("p",{className:"text-xs text-muted-foreground",children:i}):f.jsx("ul",{className:"flex flex-wrap gap-1.5","aria-label":`已绑定${r}`,children:e.map(k=>f.jsx("li",{className:"min-w-0 max-w-full",children:f.jsxs(Vt,{variant:"secondary",className:"h-auto max-w-full gap-1 font-mono text-xs whitespace-normal break-all",title:k,children:[k,!p&&f.jsx("button",{type:"button","aria-label":`移除${r} ${k}`,className:"shrink-0 rounded-full text-muted-foreground transition hover:text-foreground focus:outline-none focus-visible:ring-2 focus-visible:ring-foreground",onClick:()=>t(e.filter(j=>j!==k)),children:f.jsx(Nh,{className:"size-3","aria-hidden":"true"})})]})},k))})]})}function V$({value:e,onChange:t,id:n,disabled:r=!1}){const{activeProjectId:o,bootstrapReady:i}=Kr(),s=kC(o,i),c=b.useMemo(()=>(s.data??[]).map(d=>d.name),[s.data]);return f.jsx($$,{id:n,value:e,onChange:t,label:"技能",placeholder:"输入或选择技能名,回车添加",emptyText:"未绑定技能(可留空)",suggestions:c,suggestionsLoading:s.isLoading||s.isFetching,suggestionsError:s.error,onRetrySuggestions:()=>{s.refetch()},disabled:r})}function B$({value:e,onChange:t,id:n,disabled:r=!1}){const{activeProjectId:o,bootstrapReady:i}=Kr(),s=mz(o,i),c=b.useMemo(()=>(s.data??[]).map(d=>d.name),[s.data]);return f.jsx($$,{id:n,value:e,onChange:t,label:"Agent",placeholder:"输入或选择 Agent 名称,回车添加",emptyText:"未绑定 Agent(可留空)",suggestions:c,suggestionsLoading:s.isLoading||s.isFetching,suggestionsError:s.error,onRetrySuggestions:()=>{s.refetch()},disabled:r})}const Sf=[{key:"info",label:"信息"},{key:"prompt",label:"Prompt"}];function m2(e){const n=Vn(e).filter(o=>o.active),r=new Map(n.map(o=>[o.value,o.label]));return{values:n.map(o=>o.value),getLabel:o=>r.get(o)??o}}function H$({node:e,open:t,onOpenChange:n,onChange:r,onDelete:o,onRename:i}){const[s,c]=b.useState("info"),[d,u]=b.useState(""),[p,m]=b.useState(!1),g=m2("dag_phase"),y=m2("dag_track");return b.useEffect(()=>{c("info"),u(e?.id??"")},[e?.id,t]),e?f.jsx(jo,{open:t,onOpenChange:n,children:f.jsxs(Ro,{className:"flex h-[85vh] w-[calc(100vw-4rem)] max-w-5xl flex-col gap-4 sm:max-w-none",children:[f.jsxs(_o,{children:[f.jsx(No,{className:"font-mono text-base",children:e.id}),f.jsx(To,{children:"编辑节点属性(保存模板时生效)"})]}),f.jsx("div",{className:"flex shrink-0 gap-1 rounded-md bg-muted p-1",role:"tablist","aria-label":"节点属性分区",onKeyDown:v=>{if(v.key!=="ArrowRight"&&v.key!=="ArrowLeft")return;v.preventDefault();const S=Sf.findIndex(k=>k.key===s),w=v.key==="ArrowRight"?1:-1,E=Sf[(S+w+Sf.length)%Sf.length];E&&(c(E.key),document.getElementById(`node-tab-${E.key}`)?.focus())},children:Sf.map(v=>f.jsx("button",{type:"button",role:"tab",id:`node-tab-${v.key}`,"aria-selected":s===v.key,"aria-controls":`node-tabpanel-${v.key}`,tabIndex:s===v.key?0:-1,className:`flex-1 rounded px-2 py-1.5 text-sm transition ${s===v.key?"bg-background font-medium text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,onClick:()=>c(v.key),children:v.label},v.key))}),f.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto",role:"tabpanel",id:`node-tabpanel-${s}`,"aria-labelledby":`node-tab-${s}`,children:[s==="info"&&f.jsxs("div",{className:"flex flex-col gap-4",children:[f.jsxs("div",{className:"flex flex-col gap-2",children:[f.jsx(jr,{htmlFor:"node-label",children:"名称"}),f.jsx(Lt,{id:"node-label",value:e.label,onChange:v=>r({label:v.target.value})})]}),f.jsxs("div",{className:"flex flex-col gap-2",children:[f.jsx(jr,{htmlFor:"node-id",children:"ID(重命名会级联更新连线与暂停点)"}),f.jsxs("div",{className:"flex gap-2",children:[f.jsx(Lt,{id:"node-id",className:"font-mono",value:d,onChange:v=>u(v.target.value)}),f.jsx(Te,{type:"button",variant:"outline",size:"sm",disabled:!d||d===e.id,onClick:()=>i(d.trim()),children:"重命名"})]})]}),f.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[f.jsxs("div",{className:"flex flex-col gap-2",children:[f.jsx(jr,{htmlFor:"node-phase",children:"阶段"}),f.jsxs(pr,{value:e.phase,onValueChange:v=>{v!==null&&r({phase:v})},children:[f.jsx(mr,{id:"node-phase",children:g.getLabel(e.phase)}),f.jsx(gr,{children:g.values.map(v=>f.jsx(Un,{value:v,children:g.getLabel(v)},v))})]})]}),f.jsxs("div",{className:"flex flex-col gap-2",children:[f.jsx(jr,{htmlFor:"node-track",children:"轨道"}),f.jsxs(pr,{value:e.track,onValueChange:v=>{v!==null&&r({track:v})},children:[f.jsx(mr,{id:"node-track",children:y.getLabel(e.track)}),f.jsx(gr,{children:y.values.map(v=>f.jsx(Un,{value:v,children:y.getLabel(v)},v))})]})]})]}),e.sourcePreset&&f.jsxs("div",{className:"flex flex-col gap-1 rounded-md bg-muted px-3 py-2",children:[f.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"来源节点(值拷贝基线)"}),f.jsxs("span",{className:"font-mono text-xs text-muted-foreground",children:[e.sourcePreset.code," @ v",e.sourcePreset.version]})]})]}),s==="prompt"&&f.jsxs("div",{className:"flex flex-col gap-4",children:[f.jsxs("div",{className:"flex flex-col gap-2",children:[f.jsx(jr,{htmlFor:"node-skills",children:"绑定技能"}),f.jsx(V$,{id:"node-skills",value:e.skills,onChange:v=>r({skills:v})})]}),f.jsxs("div",{className:"flex flex-col gap-2",children:[f.jsx(jr,{htmlFor:"node-agents",children:"绑定 Agent"}),f.jsx(B$,{id:"node-agents",value:e.agents??[],onChange:v=>r({agents:v})}),f.jsx("p",{className:"text-xs text-muted-foreground",children:"仅保存名称引用,由 AI 宿主按名调用;平台不会自动调度 Agent。"})]}),f.jsxs("div",{className:"flex flex-col gap-2",children:[f.jsxs("div",{className:"flex items-center justify-between",children:[f.jsx(jr,{htmlFor:"node-prompt",children:"节点 Prompt"}),f.jsxs("span",{className:"text-xs text-muted-foreground",children:["支持 ","{{task.title}}"," 等模板变量"]})]}),f.jsx(ch,{id:"node-prompt",value:e.prompt,onChange:v=>r({prompt:v.target.value})})]})]})]}),f.jsxs("div",{className:"flex shrink-0 items-center justify-between border-t border-border pt-3",children:[f.jsx(Te,{type:"button",variant:"destructive",size:"sm",onClick:()=>m(!0),children:"删除节点"}),f.jsx(Te,{type:"button",variant:"outline",size:"sm",onClick:()=>n(!1),children:"关闭"})]}),f.jsx(gi,{open:p,onOpenChange:m,title:`删除节点 ${e.id}?`,description:"将级联删除其所有连线与关联暂停点,保存模板后生效。",confirmText:"删除",destructive:!0,onConfirm:()=>{m(!1),o(),n(!1)}})]})}):null}function Qwe({open:e,onOpenChange:t,existingNodeIds:n,onImport:r}){const{activeProjectId:o,bootstrapReady:i}=Kr(),[s,c]=b.useState(""),[d,u]=b.useState(new Set),[p,m]=b.useState({}),[g,y]=b.useState(!1),v=u$(o,e&&i,{q:s||void 0});b.useEffect(()=>{e&&(c(""),u(new Set),m({}))},[e]);const S=b.useMemo(()=>v.data??[],[v.data]),w=b.useMemo(()=>S.filter(R=>d.has(R.code)),[S,d]),E=b.useMemo(()=>{const R=w.map(M=>M.nodeId);return w.filter((M,T)=>n.includes(M.nodeId)||R.indexOf(M.nodeId)!==T)},[w,n]),k=R=>{u(M=>{const T=new Set(M);return T.has(R.code)?T.delete(R.code):T.add(R.code),T})},j=async R=>{const M=p[R.code];if(M!==void 0&&M!=="loading"&&M!=="error"){m(T=>{const{[R.code]:O,...z}=T;return z});return}if(M!=="loading"){m(T=>({...T,[R.code]:"loading"}));try{const T=await Dg(R.code);m(O=>({...O,[R.code]:T}))}catch(T){m(O=>({...O,[R.code]:"error"})),We.error(ft(T))}}},N=async()=>{if(!(E.length>0||w.length===0)){y(!0);try{const R=[];for(const M of w){const T=p[M.code],O=T!==void 0&&T!=="loading"&&T!=="error"?T:await Dg(M.code);R.push({id:O.nodeId,label:O.label,phase:O.phase,track:O.track,prompt:O.prompt,skills:[...O.skills],agents:[...O.agents],sourcePreset:{code:O.code,version:O.version,contentHash:O.contentHash,agents:[...O.agents]}})}r(R),t(!1)}catch(R){We.error(ft(R))}finally{y(!1)}}},A=w.length>0&&E.length===0&&!g;return f.jsx(jo,{open:e,onOpenChange:t,children:f.jsxs(Ro,{className:"flex h-[85vh] w-[calc(100vw-4rem)] max-w-3xl flex-col gap-4 sm:max-w-none",children:[f.jsxs(_o,{children:[f.jsx(No,{children:"从节点库导入"}),f.jsx(To,{children:"选中节点导入画布——导入即值拷贝快照(记录来源 code/版本/内容指纹,可经「检查更新」一键升级)。"})]}),f.jsx("div",{className:"shrink-0",children:f.jsx(Zh,{className:"w-full sm:max-w-xs",placeholder:"搜索 code / 标签…",onDebouncedChange:c})}),f.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto rounded-md border border-border",children:v.isLoading?f.jsx("div",{className:"p-4",children:f.jsx(Kn,{rows:4,cols:3})}):v.isError?f.jsx("div",{className:"p-4",children:f.jsx(kn,{message:ft(v.error),onRetry:()=>{v.refetch()}})}):S.length===0?s.length>0?f.jsx("div",{className:"p-4",children:f.jsx(Dn,{message:`没有匹配「${s}」的节点,试试放宽关键词`})}):f.jsx("div",{className:"p-4",children:f.jsx(Dn,{message:"节点库为空——可先安装节点库包:siming flow install @siming-org/flow-nodes(接入指引见 siming guide)",actionLabel:"到节点库页手工创建",onAction:()=>t(!1)})}):f.jsx("ul",{className:"divide-y divide-border",children:S.map(R=>{const M=p[R.code],T=M!==void 0,O=n.includes(R.nodeId);return f.jsxs("li",{className:"px-3 py-2",children:[f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx("input",{type:"checkbox",checked:d.has(R.code),onChange:()=>k(R),"aria-label":`选择节点 ${R.label}(${R.code})`,className:"size-4 shrink-0 accent-primary"}),f.jsxs("button",{type:"button",onClick:()=>{j(R)},"aria-expanded":T,className:"flex min-w-0 flex-1 items-center gap-2 rounded px-1 py-0.5 text-left focus:outline-none focus-visible:ring-2 focus-visible:ring-foreground",children:[T?f.jsx(Oy,{className:"size-4 shrink-0 text-muted-foreground","aria-hidden":"true"}):f.jsx(wD,{className:"size-4 shrink-0 text-muted-foreground","aria-hidden":"true"}),f.jsx("span",{className:"font-mono text-sm font-medium text-foreground",children:R.code}),f.jsx("span",{className:"truncate text-sm text-muted-foreground",children:R.label})]}),f.jsx(Vt,{variant:"outline",className:"font-mono text-xs",children:R.nodeId}),f.jsxs(Vt,{variant:"secondary",className:"font-mono text-xs",children:["v",R.version]}),R.scope==="project"&&f.jsx(Vt,{variant:"outline",children:"项目"}),O&&f.jsx(Vt,{variant:"destructive",className:"text-xs",children:"ID 冲突"})]}),T&&f.jsx("div",{className:"mt-2 pl-8",children:M==="loading"?f.jsx(Kn,{rows:1,cols:1}):M==="error"?f.jsx("p",{className:"text-xs text-destructive",role:"alert",children:"详情加载失败,可重新展开重试"}):f.jsxs("div",{className:"space-y-2",children:[f.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[f.jsx("span",{className:"text-xs text-muted-foreground",children:"Skills:"}),M.skills.length>0?M.skills.map(z=>f.jsx(Vt,{variant:"outline",className:"h-auto max-w-full font-mono text-xs whitespace-normal break-all",title:z,children:z},z)):f.jsx("span",{className:"text-xs text-muted-foreground",children:"无"})]}),f.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[f.jsx("span",{className:"text-xs text-muted-foreground",children:"Agents:"}),M.agents.length>0?M.agents.map(z=>f.jsx(Vt,{variant:"secondary",className:"h-auto max-w-full font-mono text-xs whitespace-normal break-all",title:z,children:z},z)):f.jsx("span",{className:"text-xs text-muted-foreground",children:"无"})]}),f.jsx("pre",{className:"max-h-40 overflow-y-auto whitespace-pre-wrap rounded-md bg-muted px-3 py-2 font-mono text-xs text-muted-foreground",children:M.prompt})]})})]},R.code)})})}),E.length>0&&f.jsxs("p",{className:"shrink-0 text-xs text-destructive",role:"alert",children:["标识 ",E.map(R=>R.nodeId).join("、")," 与画布既有节点或同批选中项冲突:复制副本后在编辑页修改默认节点 ID,或调整模板节点后再导入。"]}),f.jsxs($i,{className:"shrink-0",children:[f.jsx(Te,{type:"button",variant:"outline",disabled:g,onClick:()=>t(!1),children:"取消"}),f.jsx(Te,{type:"button",disabled:!A,onClick:()=>{N()},children:g?"导入中…":`导入${w.length>0?`(${w.length})`:""}`})]})]})})}function U$(e,t){const[n,r]=b.useState(null),o=b.useCallback(p=>r(p),[]),i=b.useCallback(()=>r(null),[]),s=b.useCallback(p=>{n!==null&&t({nodes:e.nodes.map(m=>m.id===n?{...m,...p}:m),edges:e.edges})},[n,e,t]),c=b.useCallback(p=>{if(n===null||e.nodes.some(g=>g.id===p))return!1;const m=n;return t({nodes:e.nodes.map(g=>g.id===m?{...g,id:p}:g),edges:e.edges.map(g=>({...g,from:g.from===m?p:g.from,to:g.to===m?p:g.to}))},{rename:{oldId:m,newId:p}}),r(p),!0},[n,e,t]),d=b.useCallback(()=>{if(n===null)return;const p=n;t({nodes:e.nodes.filter(m=>m.id!==p),edges:e.edges.filter(m=>m.from!==p&&m.to!==p)},{deleted:p}),r(null)},[n,e,t]),u=e.nodes.find(p=>p.id===n)??null;return{nodes:e.nodes,edges:e.edges,selectedNodeId:n,selectedNode:u,selectNode:o,clearSelection:i,patchNode:s,renameNode:c,deleteNode:d}}function q$(e,t){const{nodes:n,edges:r}=e,{tracks:o,entryPhase:i}=t,s=[],c=new Set(n.map(y=>y.id));if(c.size!==n.length){const y=new Set;for(const v of n)y.has(v.id)&&s.push(`节点 id 重复:${v.id}`),y.add(v.id)}for(const y of r)(!c.has(y.from)||!c.has(y.to))&&s.push(`边 ${y.from} → ${y.to} 指向不存在的节点`);for(const y of r)y.from===y.to&&s.push(`节点 ${y.from} 存在自环`);for(const y of n)o.includes(y.track)||s.push(`节点 ${y.id} 的 track「${y.track}」不是有效的轨道`);const d=y=>y==="mixed"?new Set(["backend","ui","all"]):new Set([y,"all"]);for(const y of o){const v=d(y);for(const S of n){const w=[];for(const k of r){if(k.from!==S.id)continue;const j=n.find(N=>N.id===k.to);j&&v.has(j.track)&&w.push({targetTrack:j.track})}const E=new Map;for(const k of w)E.set(k.targetTrack,(E.get(k.targetTrack)??0)+1);for(const[k,j]of E)j>1&&s.push(`节点 ${S.id} 在 ${y} 轨有 ${j} 条指向 ${k} 的出边(同轨分叉)`)}}const u=new Map;for(const y of r)if(c.has(y.from)&&c.has(y.to)){const v=u.get(y.from)??[];v.push(y.to),u.set(y.from,v)}const p=new Map,m=new Set,g=(y,v)=>{p.set(y,1),v.push(y);for(const S of u.get(y)??[]){const w=p.get(S)??0;if(w===1){const E=v.indexOf(S);for(const k of v.slice(E===-1?0:E))m.add(k);s.push(`检测到环:${[...v.slice(E===-1?0:E),S].join(" → ")}`)}else w===0&&g(S,v)}v.pop(),p.set(y,2)};for(const y of n)(p.get(y.id)??0)===0&&g(y.id,[]);for(const y of o)n.some(S=>(S.track===y||S.track==="all")&&!r.some(w=>w.from===S.id))||s.push(`${y} 轨缺少终端节点`);return n.some(y=>y.phase===i)||s.push(`模板需要至少一个 ${i} 节点`),s}function tE(e){const t=/^(\d+)\.(\d+)\.(\d+)$/.exec(e);return t?`${t[1]}.${t[2]}.${Number(t[3])+1}`:`${e}.1`}function Wwe(){const{id:e=""}=Wu(),[t]=Ay(),n=t.get("instance"),r=n!==null;Ir(r?"流程图 · 司命":"DAG 编辑器 · 司命");const o=YC(e),i=i$(n??""),s=Vn("dag_track"),c=Vn("node_status"),d=b.useMemo(()=>s.filter(re=>re.active).map(re=>re.value),[s]),u=b.useMemo(()=>c.filter(re=>re.active).map(re=>re.value),[c]),[p,m,g]=gve([]),[y,v,S]=yve([]),[w,E]=b.useState([]),[k,j]=b.useState(!1);b.useEffect(()=>{if(!k&&o.data){const re=o.data;m(h2(re.nodes,re.edges,re.layout)),v(ug(re.edges)),E(re.edges),j(!0)}},[k,o.data,m,v]);const[N,A]=b.useState(null),[R,M]=b.useState([]),[T,O]=b.useState(!1),[z,q]=b.useState(!1),[$,G]=b.useState(!1),L=c$(),F=p.map(re=>re.data.node),P=U$({nodes:F,edges:w},b.useCallback((re,ge)=>{m(_e=>{const De=new Map(re.nodes.map(we=>[we.id,we]));if(ge?.rename){const{oldId:we,newId:$e}=ge.rename,Me=De.get($e);if(Me)return _e.map(Le=>Le.id!==we?Le:{...Le,id:$e,data:{...Le.data,node:Me}})}if(ge?.deleted){const we=ge.deleted;return _e.filter($e=>$e.id!==we)}return _e.map(we=>{const $e=De.get(we.id);return $e?{...we,data:{...we.data,node:$e}}:we})}),v(ug(re.edges)),E(re.edges)},[m,v])),{selectedNodeId:I,selectedNode:Y}=P,Z=Y,D=b.useMemo(()=>{if(N===null)return null;const re=y.find(ge=>ge.id===N);return re?w.find(ge=>ge.from===re.source&&ge.to===re.target)??{from:re.source,to:re.target}:null},[N,y,w]),H=b.useCallback(re=>{D&&E(ge=>{const _e=ge.findIndex(Me=>Me.from===D.from&&Me.to===D.to);if(_e<0)return ge;const De=ge[_e];if(!De)return ge;const we=re?{from:De.from,to:De.to,pausePoint:re,...De.condition?{condition:De.condition}:{}}:{from:De.from,to:De.to,...De.condition?{condition:De.condition}:{}},$e=ge.map((Me,Le)=>Le===_e?we:Me);return v(ug($e)),$e})},[D,v]),U=b.useMemo(()=>{if(!r||!i.data)return null;const re=i.data.dagInstance,ge=o.data?.layout,_e=h2(re.nodes,re.edges,ge).map(we=>{const $e=re.nodeStates[we.id]?.status,Me=u.find(Le=>Le===$e);return{...we,data:{...we.data,...Me!==void 0?{instanceStatus:Me}:{}}}}),De=ug(re.edges).map(we=>{if(we.type!=="pause")return we;const $e=we.data;if(!$e)return we;const Me=re.nodeStates[we.source]?.status,Le=re.nodeStates[we.target]?.status;let He="pending";return(Le==="active"||Le==="completed")&&Me==="completed"?He="passed":i.data.status==="paused"&&i.data.pausedAt===we.source&&(He="awaiting"),{...we,data:{...$e,pauseState:He}}});return{nodes:_e,edges:De}},[r,i.data,o.data?.layout,u]),B=b.useCallback(re=>{const{source:ge,target:_e}=re;ge===null||_e===null||v(De=>N3({id:`${ge}->${_e}`,source:ge,target:_e,...F$},De))},[v]),X=b.useCallback(re=>{const ge=re.filter(_e=>_e.type==="remove");if(ge.length>0){const _e=new Set(ge.map(De=>De.id));E(De=>De.filter(we=>!_e.has(`${we.from}->${we.to}`)))}S(re)},[S]),J=b.useCallback(re=>{D&&E(ge=>{const _e=ge.findIndex($e=>$e.from===D.from&&$e.to===D.to),De=re.trim(),we={from:D.from,to:D.to};return De&&(we.condition=De),_e>=0?ge.map(($e,Me)=>Me===_e?we:$e):[...ge,we]})},[D]),Q=b.useCallback(()=>{N!==null&&(X([{id:N,type:"remove"}]),A(null))},[N,X]),oe=b.useCallback(()=>{let re=1;for(;p.some($e=>$e.id===`NODE_${re}`);)re++;const ge=`NODE_${re}`,_e=p[p.length-1],De=_e?{x:_e.position.x+240,y:_e.position.y}:{x:0,y:0},we={id:ge,label:`节点 ${re}`,phase:"track",track:"all",prompt:"",skills:[],agents:[]};m($e=>[...$e,{id:ge,type:"dagNode",position:De,data:{node:we}}]),We.success(`已添加节点 ${ge}(点击节点可编辑属性)`)},[p,m]),W=b.useCallback(()=>{const re=p.map(_e=>_e.data.node),ge=L$(re,w);m(_e=>_e.map(De=>({...De,position:ge[De.id]??De.position}))),O(!1)},[p,w,m]),ne=b.useCallback(re=>{m(ge=>{const _e=ge[ge.length-1],De=_e?_e.position.x:0,we=_e?_e.position.y:0;return[...ge,...re.map(($e,Me)=>({id:$e.id,type:"dagNode",position:{x:De+240*(Me+1),y:we},data:{node:$e}}))]}),We.success(`已导入 ${re.length} 个节点(值拷贝快照,保存模板后生效)`)},[m]),je=b.useCallback(()=>{o.refetch().then(re=>{if(re.isError){We.error("升级后刷新模板失败,画布仍为旧内容——请勿直接保存(刷新页面后重试)");return}j(!1),We.info("画布已重载为升级后的模板内容")})},[o]),Ee=b.useCallback(()=>{const re=o.data;if(!re)return;const ge=p.map(we=>we.data.node),_e=Ywe(p,y,ge,w),De=q$(_e,{tracks:d,entryPhase:"entry"});if(M(De),De.length>0){We.error(`校验未通过(${De.length} 项),请修复后保存`);return}L.mutate({id:re.id,patch:{nodes:_e.nodes,edges:_e.edges,layout:_e.layout,version:tE(re.version)}},{onSuccess:()=>We.success(`模板已保存(version ${tE(re.version)})`),onError:we=>We.error(ft(we))})},[o.data,p,y,w,L,d]),pe=r?`流程图 · ${i.data?.title??"…"}`:`DAG 编辑器 · ${o.data?.name??"…"}`;return r?i.isLoading?f.jsx("main",{className:"mx-auto w-full max-w-5xl px-4 py-6",children:f.jsx(Kn,{rows:3,cols:3})}):i.isError?f.jsx("main",{className:"mx-auto w-full max-w-5xl px-4 py-6",children:f.jsx(kn,{message:ft(i.error),onRetry:()=>{i.refetch()}})}):U?f.jsxs("main",{className:"mx-auto flex h-[calc(100vh-4rem)] w-full max-w-6xl flex-col px-4 py-4",children:[f.jsxs("div",{className:"mb-3 flex items-center justify-between gap-3",children:[f.jsxs("div",{className:"min-w-0",children:[f.jsx("h1",{className:"truncate text-lg font-semibold text-foreground",children:pe}),f.jsxs("p",{className:"text-xs text-muted-foreground",children:["只读实例视图(task 快照渲染,模板布局",o.isError?"不可用,已自动排列":"应用中",")"]})]}),f.jsxs(Te,{render:f.jsx(yn,{to:`/tasks/${n??""}`}),nativeButton:!1,variant:"outline",size:"sm",children:[f.jsx(Vl,{"aria-hidden":"true"}),"返回任务"]})]}),o.isError&&f.jsx("p",{className:"mb-3 rounded-md border border-warning/30 bg-warning/10 px-3 py-2 text-xs text-warning",children:"关联模板已被删除或不可访问,画布使用自动布局展示任务快照。"}),i.data?.status==="paused"&&f.jsxs("div",{className:"mb-3 flex flex-wrap items-center gap-2 rounded-md border border-warning/30 bg-warning/10 px-3 py-2 text-sm text-warning",children:[f.jsx("span",{"aria-hidden":"true",children:"⏸"}),f.jsxs("span",{children:["任务在此暂停,等待决策:",f.jsx("span",{className:"font-mono",children:i.data.pausedAt??"手动暂停"})]}),f.jsx(yn,{to:`/tasks/${i.data.taskId}`,className:"underline underline-offset-2 hover:text-foreground",children:"前往处理 →"})]}),f.jsxs("div",{className:"mb-3 flex items-center gap-3 text-xs text-muted-foreground","aria-label":"节点状态图例",children:[f.jsxs("span",{className:"flex items-center gap-1",children:[f.jsx("span",{className:"inline-block size-2 rounded-full bg-success","aria-hidden":"true"}),"已完成"]}),f.jsxs("span",{className:"flex items-center gap-1",children:[f.jsx("span",{className:"inline-block size-2 rounded-full bg-primary","aria-hidden":"true"}),"当前节点"]}),f.jsxs("span",{className:"flex items-center gap-1",children:[f.jsx("span",{className:"inline-block size-2 rounded-full bg-muted-foreground/40","aria-hidden":"true"}),"未到达"]}),f.jsxs("span",{className:"flex items-center gap-1",children:[f.jsx("span",{className:"inline-block size-2 rounded-full bg-warning","aria-hidden":"true"}),"暂停点后"]})]}),f.jsx("div",{className:"min-h-0 flex-1 overflow-hidden rounded-lg border border-border",children:f.jsx(p2,{nodes:U.nodes,edges:U.edges,readOnly:!0,onNodesChange:()=>{},onEdgesChange:()=>{},onConnect:()=>{},onNodeClick:()=>{},onEdgeClick:()=>{}})})]}):f.jsx("main",{className:"mx-auto w-full max-w-5xl px-4 py-6",children:f.jsx(Dn,{message:"任务数据不完整,无法渲染流程图"})}):o.isLoading?f.jsx("main",{className:"mx-auto w-full max-w-5xl px-4 py-6",children:f.jsx(Kn,{rows:3,cols:3})}):o.isError?f.jsxs("main",{className:"mx-auto w-full max-w-5xl px-4 py-6",children:[f.jsx(kn,{message:ft(o.error),onRetry:()=>{o.refetch()}}),f.jsx("div",{className:"mt-4 flex justify-center",children:f.jsxs(Te,{render:f.jsx(yn,{to:"/templates"}),nativeButton:!1,variant:"ghost",size:"sm",children:[f.jsx(Vl,{"aria-hidden":"true"}),"返回模板列表"]})})]}):o.data?f.jsxs("main",{className:"mx-auto flex h-[calc(100vh-4rem)] w-full max-w-6xl flex-col px-4 py-4",children:[f.jsxs("div",{className:"mb-3 flex flex-wrap items-center justify-between gap-3",children:[f.jsxs("div",{className:"min-w-0",children:[f.jsx("h1",{className:"truncate text-lg font-semibold text-foreground",children:pe}),f.jsxs("p",{className:"text-xs text-muted-foreground",children:["version ",o.data.version," · ",p.length," 节点 / ",y.length," 边"]})]}),f.jsxs("div",{className:"flex flex-wrap gap-2",children:[f.jsxs(Te,{render:f.jsx(yn,{to:`/templates/${e}`}),nativeButton:!1,variant:"outline",size:"sm",children:[f.jsx(Vl,{"aria-hidden":"true"}),"返回模板详情"]}),f.jsxs(Te,{type:"button",variant:"outline",size:"sm",onClick:oe,children:[f.jsx(Qf,{"aria-hidden":"true"}),"添加节点"]}),f.jsxs(Te,{type:"button",variant:"outline",size:"sm",onClick:()=>q(!0),children:[f.jsx(X6,{"aria-hidden":"true"}),"从节点库导入"]}),f.jsxs(Te,{type:"button",variant:"outline",size:"sm",onClick:()=>G(!0),children:[f.jsx(s8,{"aria-hidden":"true"}),"检查更新"]}),f.jsxs(Te,{type:"button",variant:"outline",size:"sm",onClick:()=>O(!0),children:[f.jsx(G6,{"aria-hidden":"true"}),"自动布局"]}),f.jsxs(Te,{type:"button",size:"sm",disabled:L.isPending,onClick:Ee,children:[f.jsx(u8,{"aria-hidden":"true"}),L.isPending?"保存中…":"保存"]})]})]}),R.length>0&&f.jsxs("div",{className:"mb-3 rounded-md border border-destructive/30 bg-destructive/10 px-3 py-2 text-xs text-destructive",children:[f.jsxs("p",{className:"mb-1 font-medium",children:["校验未通过(",R.length," 项):"]}),f.jsx("ul",{className:"list-disc space-y-0.5 pl-4",children:R.map((re,ge)=>f.jsx("li",{children:re},`${ge}-${re}`))})]}),f.jsx("div",{className:"relative min-h-0 flex-1 overflow-hidden rounded-lg border border-border",children:p.length===0?f.jsx(Dn,{message:"画布为空,点击「添加节点」开始编排"}):f.jsxs(f.Fragment,{children:[f.jsx(p2,{nodes:p,edges:y,readOnly:!1,onNodesChange:g,onEdgesChange:X,onConnect:B,onNodeClick:(re,ge)=>P.selectNode(ge.id),onEdgeClick:(re,ge)=>A(ge.id),onPaneClick:()=>{P.clearSelection(),A(null)}}),f.jsx(Xwe,{edge:D,onConditionChange:J,onPausePointChange:H,onDelete:Q,onClose:()=>A(null)})]})}),f.jsx(H$,{node:Z,open:Z!==null,onOpenChange:re=>{re||P.clearSelection()},onChange:re=>P.patchNode(re),onDelete:()=>P.deleteNode(),onRename:re=>{P.renameNode(re)?We.success(`已重命名为 ${re}(连线与暂停点已级联更新,保存后生效)`):We.error(`节点 id「${re}」已存在`)}}),f.jsx(gi,{open:T,onOpenChange:O,title:"应用自动布局",description:"将按拓扑重新排列全部节点,覆盖当前手动布局(保存模板后生效)。",confirmText:"应用",onConfirm:W}),f.jsx(Qwe,{open:z,onOpenChange:q,existingNodeIds:p.map(re=>re.id),onImport:ne}),f.jsx(d$,{open:$,onOpenChange:G,templateId:e,templateName:o.data?.name??"",onApplied:je})]}):f.jsxs("main",{className:"mx-auto w-full max-w-5xl px-4 py-6",children:[f.jsx(Dn,{message:"模板不存在"}),f.jsx("div",{className:"mt-4 flex justify-center",children:f.jsxs(Te,{render:f.jsx(yn,{to:"/templates"}),nativeButton:!1,variant:"ghost",size:"sm",children:[f.jsx(Vl,{"aria-hidden":"true"}),"返回模板列表"]})})]})}const Jwe=Li({title:zt().min(1,"标题不能为空").max(80,"标题最长 80 个字符"),projectId:zt().min(1,"请选择项目"),track:zt().min(1,"请选择轨道"),templateId:zt().min(1,"请选择 DAG 模板")});function Y$({open:e,projects:t,defaultProjectId:n,onClose:r,onCreate:o}){const i=ra({resolver:oa(Jwe),defaultValues:{title:"",projectId:"",track:"backend",templateId:""}}),{isSubmitting:s}=i.formState,[c,d]=b.useState(!1),u=Vn("dag_track").filter(S=>S.active&&S.value!=="all"),p=S=>u.find(w=>w.value===S)?.label??S,m=i.watch("projectId"),{data:g=[],isLoading:y}=s$(m,e);b.useEffect(()=>{e&&i.reset({title:"",projectId:n,track:"backend",templateId:""})},[e,n]),b.useEffect(()=>{i.setValue("templateId","",{shouldValidate:!1})},[m]),b.useEffect(()=>{if(e&&i.getValues("templateId").length===0){const S=g[0];S&&i.setValue("templateId",S.id,{shouldValidate:!1})}},[e,g]);const v=async S=>{try{await o({title:S.title.trim(),projectId:S.projectId,track:S.track,dagTemplateId:S.templateId}),r()}catch(w){We.error(ft(w))}};return f.jsx(jo,{open:e,onOpenChange:S=>{!S&&!s&&r()},children:f.jsxs(Ro,{className:"sm:max-w-md",children:[f.jsxs(_o,{children:[f.jsx(No,{children:"新建任务"}),f.jsx(To,{className:"sr-only",children:"填写任务信息以启动新的 DAG 执行"})]}),f.jsx(ia,{...i,children:f.jsxs("form",{onSubmit:i.handleSubmit(v),className:"space-y-4",children:[f.jsx(Ot,{control:i.control,name:"title",render:({field:S})=>f.jsxs(Dt,{children:[f.jsxs(Pt,{children:["标题 ",f.jsx("span",{className:"text-destructive",children:"*"})]}),f.jsx(_t,{children:f.jsx(Lt,{...S,placeholder:"例如:实现任务列表页",disabled:s})}),f.jsx(It,{})]})}),f.jsx(Ot,{control:i.control,name:"projectId",render:({field:S})=>{const w=t.find(E=>E.id===S.value);return f.jsxs(Dt,{children:[f.jsxs(Pt,{children:["项目 ",f.jsx("span",{className:"text-destructive",children:"*"})]}),f.jsxs(pr,{value:S.value,onValueChange:E=>{t.some(k=>k.id===E)&&S.onChange(E)},children:[f.jsx(_t,{children:f.jsx(mr,{disabled:s,className:"w-full",children:w?w.name:"选择项目"})}),f.jsx(gr,{children:t.map(E=>f.jsx(Un,{value:E.id,children:E.name},E.id))})]}),f.jsx(It,{})]})}}),f.jsx(Ot,{control:i.control,name:"track",render:({field:S})=>f.jsxs(Dt,{children:[f.jsx(Pt,{children:"轨道"}),f.jsxs(pr,{value:S.value,onValueChange:w=>{w!==null&&u.some(E=>E.value===w)&&S.onChange(w)},children:[f.jsx(_t,{children:f.jsx(mr,{disabled:s,className:"w-full",children:p(S.value)})}),f.jsx(gr,{children:u.map(w=>f.jsx(Un,{value:w.value,children:w.label},w.value))})]}),f.jsx(It,{})]})}),f.jsx(Ot,{control:i.control,name:"templateId",render:({field:S})=>{const w=g.find(E=>E.id===S.value);return f.jsxs(Dt,{children:[f.jsxs(Pt,{children:["DAG 模板 ",f.jsx("span",{className:"text-destructive",children:"*"})]}),y?f.jsx($h,{}):g.length===0?f.jsx(Vh,{message:"该项目暂无模板,请先创建或复制模板到该项目"}):f.jsxs(V1,{open:c,onOpenChange:d,children:[f.jsx(B1,{render:f.jsx(_t,{children:f.jsxs(Te,{type:"button",variant:"outline",disabled:s,className:"w-full justify-between font-normal",children:[w?w.name:"选择 DAG 模板…",f.jsx(_h,{className:"ml-2 size-4 shrink-0 opacity-50"})]})})}),f.jsx(H1,{className:"w-[var(--anchor-width)] p-0",align:"start",children:f.jsxs(eC,{children:[f.jsx(tC,{placeholder:"搜索模板…"}),f.jsxs(nC,{children:[f.jsx(rC,{children:"未找到模板"}),f.jsx(oC,{children:g.map(E=>f.jsxs(iC,{value:E.name,onSelect:k=>{const j=g.find(N=>N.name===k);j&&S.onChange(j.id),d(!1)},children:[E.name,f.jsx(Ju,{className:`ml-auto size-4 text-success ${E.id===S.value?"opacity-100":"opacity-0"}`})]},E.id))})]})]})})]}),f.jsx(It,{})]})}}),f.jsxs($i,{children:[f.jsx(id,{render:f.jsx(Te,{type:"button",variant:"outline",disabled:s}),children:"取消"}),f.jsx(Te,{type:"submit",disabled:s,children:s?"创建中…":"创建"})]})]})})]})})}const eSe={active:{badge:"bg-info/10 text-info",dot:"bg-info"},paused:{badge:"bg-warning/10 text-warning",dot:"bg-warning"},completed:{badge:"bg-success/10 text-success",dot:"bg-success"},cancelled:{badge:"bg-destructive/10 text-destructive",dot:"bg-destructive"}};function JC({status:e}){const n=Vn("task_status").find(o=>o.value===e)?.label??e,r=eSe[e]??{badge:"bg-muted text-muted-foreground",dot:"bg-muted"};return f.jsxs("span",{className:`inline-flex items-center gap-1.5 rounded-full px-2.5 py-0.5 text-xs font-medium ${r.badge}`,children:[f.jsx("span",{className:`h-1.5 w-1.5 rounded-full ${r.dot}`}),n]})}const tSe=[{key:"total",dot:"bg-foreground",registryValue:null},{key:"active",dot:"bg-info",registryValue:"active"},{key:"paused",dot:"bg-warning",registryValue:"paused"},{key:"completed",dot:"bg-success",registryValue:"completed"},{key:"cancelled",dot:"bg-destructive",registryValue:"cancelled"}],cu=mc();function nSe(){Ir();const{activeProjectId:e,activeProjects:t,bootstrapReady:n,bootstrapError:r,retryBootstrap:o}=Kr(),i=_r({queryKey:["tasks",e],queryFn:()=>RD(e),enabled:e.length>0,refetchInterval:5e3}),s=a$(),[c,d]=b.useState(!1),u=Vn("task_status"),p=v=>u.find(S=>S.value===v)?.label??v,m=b.useMemo(()=>{const v=i.data??[],S=w=>v.filter(E=>E.status===w).length;return{total:v.length,active:S("active"),paused:S("paused"),completed:S("completed"),cancelled:S("cancelled")}},[i.data]),g=b.useMemo(()=>(i.data??[]).filter(v=>v.status==="active"||v.status==="paused"),[i.data]),y=b.useMemo(()=>[cu.accessor("taskId",{id:"taskId",header:"ID",cell:v=>f.jsx("span",{className:"font-mono text-xs text-muted-foreground",children:v.getValue()})}),cu.accessor("title",{id:"title",header:"标题",cell:v=>f.jsx(yn,{to:`/tasks/${v.row.original.taskId}`,className:"font-medium text-foreground focus:outline-none focus-visible:ring-2 focus-visible:ring-foreground",children:v.getValue()})}),cu.accessor("currentNode",{id:"currentNode",header:"当前节点",cell:v=>f.jsx("span",{className:"font-mono text-xs text-muted-foreground",children:v.getValue()})}),cu.accessor("status",{id:"status",header:"状态",cell:v=>f.jsx(JC,{status:v.getValue()})}),cu.accessor("updatedAt",{id:"updatedAt",header:"更新时间",cell:v=>f.jsx("span",{className:"text-xs text-muted-foreground",children:xc(v.getValue())}),meta:{initialSortDesc:!0}}),cu.display({id:"actions",header:"操作",cell:({row:v})=>f.jsx(Te,{render:f.jsx(yn,{to:`/tasks/${v.original.taskId}`}),nativeButton:!1,variant:"outline",size:"sm",children:"详情"})})],[]);return f.jsxs("div",{className:"mx-auto w-full max-w-5xl px-4 py-6",children:[f.jsxs("div",{className:"mb-5 flex items-center justify-between",children:[f.jsxs("div",{children:[f.jsx("h1",{className:"text-xl font-bold text-foreground",children:"看板"}),f.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"任务统计与活跃任务总览(每 5 秒自动刷新)"})]}),f.jsx(Te,{type:"button",disabled:!n,onClick:()=>d(!0),children:"+ 新建任务"})]}),r?f.jsx(kn,{message:ft(r),onRetry:o}):!n||i.isLoading?f.jsx(Kn,{rows:4,cols:5}):i.isError?f.jsx(kn,{message:ft(i.error),onRetry:()=>{i.refetch()}}):f.jsxs(f.Fragment,{children:[f.jsx("div",{className:"grid grid-cols-2 gap-4 sm:grid-cols-3 lg:grid-cols-5",children:tSe.map(v=>f.jsxs("div",{className:"rounded-lg border border-border bg-card p-5 shadow-sm",children:[f.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[f.jsx("span",{className:`size-2 rounded-full ${v.dot}`}),v.registryValue===null?"总任务":p(v.registryValue)]}),f.jsx("p",{className:"mt-2 text-2xl font-bold tabular-nums text-foreground",children:m[v.key]})]},v.key))}),f.jsx("div",{className:"mt-6",children:f.jsx(Oi,{title:"活跃任务",children:(i.data?.length??0)===0?f.jsx(Dn,{message:"还没有任务,点击「新建任务」创建第一个",actionLabel:"新建任务",onAction:()=>d(!0)}):f.jsx(yc,{columns:y,data:g,pageSize:5,emptySlot:f.jsx(Dn,{message:"没有进行中的任务,去「全部任务」查看历史"})})})}),f.jsx("div",{className:"mt-6",children:f.jsx(Oi,{title:"快捷入口",children:f.jsxs("div",{className:"flex flex-wrap gap-2",children:[f.jsx(Te,{type:"button",onClick:()=>d(!0),children:"+ 新建任务"}),f.jsx(Te,{render:f.jsx(yn,{to:"/templates"}),nativeButton:!1,variant:"outline",children:"新建模板(模板库)"}),f.jsx(Te,{render:f.jsx(yn,{to:"/tasks"}),nativeButton:!1,variant:"outline",children:"查看全部任务"})]})})})]}),f.jsx(Y$,{open:c,projects:t,defaultProjectId:e,onClose:()=>d(!1),onCreate:async v=>{await s.mutateAsync(v),We.success("任务已创建")}})]})}const rSe=Li({username:zt().min(1,"账号不能为空"),password:zt().min(1,"密码不能为空")}),oSe={username:"",password:""};function iSe(){Ir();const e=Mh(),t=ko(),r=Wo().state?.from??"/",o=ra({resolver:oa(rSe),defaultValues:oSe}),{isSubmitting:i}=o.formState;if(!e.ready)return f.jsx($h,{});if(e.mode==="open")return f.jsx(Cu,{to:"/",replace:!0});if(e.needsSetup)return f.jsx(Cu,{to:"/setup",replace:!0});if(e.authenticated)return f.jsx(Cu,{to:r,replace:!0});const s=async c=>{try{await e.login(c),We.success("登录成功"),t(r,{replace:!0})}catch(d){d instanceof Dy&&d.status===401?(We.error("账号或密码错误"),o.setValue("password",""),o.setFocus("password")):We.error(ft(d))}};return f.jsxs("div",{className:"rounded-lg border border-border bg-card p-6 shadow-sm",children:[f.jsx("h1",{className:"text-lg font-bold text-foreground",children:"登录司命"}),f.jsx("p",{className:"mt-1 mb-5 text-sm text-muted-foreground",children:"请使用管理员账号登录(账号由部署时初始化)"}),f.jsx(ia,{...o,children:f.jsxs("form",{onSubmit:o.handleSubmit(s),className:"space-y-4",noValidate:!0,children:[f.jsx(Ot,{control:o.control,name:"username",render:({field:c})=>f.jsxs(Dt,{children:[f.jsx(Pt,{children:"账号"}),f.jsx(_t,{children:f.jsx(Lt,{...c,autoComplete:"username",autoFocus:!0,placeholder:"管理员账号",disabled:i})}),f.jsx(It,{})]})}),f.jsx(Ot,{control:o.control,name:"password",render:({field:c})=>f.jsxs(Dt,{children:[f.jsx(Pt,{children:"密码"}),f.jsx(_t,{children:f.jsx(Lt,{...c,type:"password",autoComplete:"current-password",placeholder:"密码",disabled:i})}),f.jsx(It,{})]})}),f.jsx(Te,{type:"submit",className:"w-full",disabled:i,children:i?"登录中…":"登录"})]})})]})}const sSe=Li({code:zt().regex(/^[a-z0-9]+(-[a-z0-9]+)*$/,"code 需为 kebab-case(小写字母/数字/中划线)"),name:zt().min(1,"名称不能为空"),realModel:zt().min(1,"真实模型不能为空")}),g2={code:"",name:"",realModel:""};function aSe(){Ir();const e=w1(),t=jW(),n=RW(),r=_W(),[o,i]=b.useState(null),[s,c]=b.useState(null),d=ra({resolver:oa(sSe),defaultValues:g2}),{isSubmitting:u}=d.formState;b.useEffect(()=>{o&&d.reset(o.mode==="edit"?{code:o.alias.code,name:o.alias.name,realModel:o.alias.realModel}:g2)},[o]);const p=async g=>{try{o?.mode==="edit"?(await n.mutateAsync({code:o.alias.code,input:{name:g.name,realModel:g.realModel}}),We.success("模型映射已更新")):(await t.mutateAsync(g),We.success("模型映射已创建")),i(null)}catch(y){We.error(ft(y))}},m=()=>{s&&r.mutateAsync(s.code).then(()=>{We.success(`模型映射「${s.name}」已删除`),c(null)}).catch(g=>{We.error(ft(g)),c(null)})};return f.jsxs("div",{className:"mx-auto w-full max-w-4xl px-4 py-6",children:[f.jsxs("div",{className:"mb-5 flex items-center justify-between",children:[f.jsxs("div",{children:[f.jsx("h1",{className:"text-xl font-bold text-foreground",children:"模型映射"}),f.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Agent 模型引用表:code 全局唯一(创建后不可变),Agent.model 存 code,改 realModel 全局生效"})]}),f.jsx(Te,{type:"button",disabled:e.isLoading,onClick:()=>i({mode:"create"}),children:"+ 新建映射"})]}),e.isLoading?f.jsx(Kn,{rows:4,cols:5}):e.isError?f.jsx(kn,{message:ft(e.error),onRetry:()=>{e.refetch()}}):(e.data?.length??0)===0?f.jsxs("div",{className:"rounded-lg border border-dashed p-10 text-center",children:[f.jsx("p",{className:"text-sm text-muted-foreground",children:"尚未创建任何模型映射。Agent 表单的模型字段依赖映射列表,请先创建至少一条。"}),f.jsx(Te,{type:"button",variant:"outline",className:"mt-4",onClick:()=>i({mode:"create"}),children:"创建第一条映射"})]}):f.jsx("div",{className:"overflow-hidden rounded-lg border",children:f.jsxs(sd,{children:[f.jsx(ad,{children:f.jsxs(to,{children:[f.jsx($n,{className:"px-4 py-3",children:"code"}),f.jsx($n,{className:"px-4 py-3",children:"名称"}),f.jsx($n,{className:"px-4 py-3",children:"真实模型"}),f.jsx($n,{className:"px-4 py-3",children:"引用"}),f.jsx($n,{className:"px-4 py-3 text-right",children:"操作"})]})}),f.jsx(ld,{children:(e.data??[]).map(g=>f.jsxs(to,{className:"hover:bg-muted/30",children:[f.jsx(Zt,{className:"px-4 py-3 font-mono text-xs",children:g.code}),f.jsx(Zt,{className:"px-4 py-3",children:g.name}),f.jsx(Zt,{className:"px-4 py-3 font-mono text-xs text-muted-foreground",children:g.realModel}),f.jsx(Zt,{className:"px-4 py-3",children:f.jsx(Vt,{variant:g.refCount>0?"secondary":"outline",children:g.refCount>0?`${g.refCount} 个 Agent`:"无引用"})}),f.jsx(Zt,{className:"px-4 py-3 text-right",children:f.jsxs("div",{className:"flex justify-end gap-2",children:[f.jsx(Te,{type:"button",variant:"outline",size:"sm",onClick:()=>i({mode:"edit",alias:g}),children:"编辑"}),f.jsx("span",{className:"inline-flex",title:g.refCount>0?`被 ${g.refCount} 个 Agent 引用,禁止删除`:void 0,children:f.jsx(Te,{type:"button",variant:"outline",size:"sm",disabled:g.refCount>0,onClick:()=>c(g),children:"删除"})})]})})]},g.code))})]})}),f.jsx(jo,{open:o!==null,onOpenChange:g=>{!g&&!u&&i(null)},children:f.jsxs(Ro,{className:"sm:max-w-md",children:[f.jsxs(_o,{children:[f.jsx(No,{children:o?.mode==="edit"?`编辑映射 · ${o.alias.code}`:"新建映射"}),f.jsx(To,{className:"sr-only",children:o?.mode==="edit"?"修改映射名称与真实模型":"创建新的模型映射"})]}),f.jsx(ia,{...d,children:f.jsxs("form",{onSubmit:d.handleSubmit(p),className:"space-y-4",children:[f.jsx(Ot,{control:d.control,name:"code",render:({field:g})=>f.jsxs(Dt,{children:[f.jsxs(Pt,{children:["code ",f.jsx("span",{className:"text-destructive",children:"*"})]}),f.jsx(_t,{children:f.jsx(Lt,{...g,placeholder:"kebab-case,如 primary",disabled:u||o?.mode==="edit"})}),f.jsx(It,{})]})}),f.jsx(Ot,{control:d.control,name:"name",render:({field:g})=>f.jsxs(Dt,{children:[f.jsxs(Pt,{children:["名称 ",f.jsx("span",{className:"text-destructive",children:"*"})]}),f.jsx(_t,{children:f.jsx(Lt,{...g,placeholder:"如 主力模型",disabled:u})}),f.jsx(It,{})]})}),f.jsx(Ot,{control:d.control,name:"realModel",render:({field:g})=>f.jsxs(Dt,{children:[f.jsxs(Pt,{children:["真实模型 ",f.jsx("span",{className:"text-destructive",children:"*"})]}),f.jsx(_t,{children:f.jsx(Lt,{...g,placeholder:"如 zhipuai/glm-5.3",disabled:u})}),f.jsx(It,{})]})}),f.jsx($i,{children:f.jsx(Te,{type:"submit",disabled:u,children:u?"保存中…":"保存"})})]})})]})}),f.jsx(gi,{open:s!==null,onOpenChange:g=>{g||c(null)},title:"删除模型映射",description:s?`确定删除映射「${s.name}(${s.code})」?该操作不可恢复。`:"",confirmText:"删除",destructive:!0,loading:r.isPending,onConfirm:m})]})}const y2={dag_phase:{label:"DAG 阶段",desc:"节点阶段(phase):entry/track/test/exit,自定义可流经引擎"},dag_track:{label:"DAG 轨道",desc:"节点轨道(track):backend/ui 为内置双轨,all 为引擎哨兵,其余为自定义轨道"},pause_type:{label:"暂停点类型",desc:"边级暂停点(edge.pausePoint)类型"},task_status:{label:"任务状态",desc:"任务状态机(status):引擎硬依赖内置值"},node_status:{label:"节点状态",desc:"节点状态(nodeStatus):引擎硬依赖内置值"},skill_category:{label:"Skill 分类",desc:"Skill category:可自定义,全放开"},scope:{label:"资产作用域",desc:"资源作用域:value 永锁(承重字段),仅展示"}},yw=new Set(["scope"]);function lSe(e){return{value:e.value,label:e.label,color:e.color??"",order:String(e.order??0),active:e.active}}function x2(e){const t=e.color.trim();return{value:e.value.trim(),label:e.label.trim(),...t!==""?{color:t}:{},order:Number(e.order)||0,builtin:!1,active:e.active}}function cSe(){Ir();const e=gz(),t=NW(),n=TW(),[r,o]=b.useState(null),[i,s]=b.useState(null),c=e.data??[],d=async(g,y,v)=>{if(v.value.trim()===""||v.label.trim()===""){We.error("value 与 label 不能为空");return}const S=c.find(E=>E.category===g);if(!S)return;const w=[...S.entries];if(y===-1)w.push(x2(v));else{const E=w[y];if(!E)return;w[y]={...x2(v),builtin:E.builtin,value:E.builtin?E.value:v.value.trim()}}try{await t.mutateAsync({category:g,input:{entries:w}}),We.success(`「${y2[g]?.label??g}」已保存`),o(null)}catch(E){We.error(ft(E))}},u=async(g,y)=>{try{await n.mutateAsync({category:g,value:y.value}),We.success(`枚举值「${y.label}(${y.value})」已删除`),s(null)}catch(v){We.error(ft(v)),s(null)}},p=(g,y,v)=>{const S=yw.has(g.category),w=y.builtin;if(r?.category===g.category&&r.index===v){const k=r.draft;return f.jsxs(to,{children:[f.jsx(Zt,{className:"px-4 py-2",children:f.jsx(Lt,{value:k.value,disabled:w||S,className:"h-8 font-mono text-xs",onChange:j=>o({...r,draft:{...k,value:j.target.value}})})}),f.jsx(Zt,{className:"px-4 py-2",children:f.jsx(Lt,{value:k.label,className:"h-8",onChange:j=>o({...r,draft:{...k,label:j.target.value}})})}),f.jsx(Zt,{className:"px-4 py-2",children:f.jsxs("div",{className:"flex items-center gap-1.5",children:[f.jsx(Lt,{value:k.color,className:"h-8 w-16 font-mono text-xs",onChange:j=>o({...r,draft:{...k,color:j.target.value}})}),k.color?f.jsx("span",{className:"inline-block size-5 rounded border",style:{backgroundColor:k.color}}):null]})}),f.jsx(Zt,{className:"px-4 py-2",children:f.jsx(Lt,{value:k.order,type:"number",className:"h-8 w-20",onChange:j=>o({...r,draft:{...k,order:j.target.value}})})}),S?null:f.jsx(Zt,{className:"px-4 py-2",children:f.jsxs(pr,{value:k.active?"active":"inactive",onValueChange:j=>o({...r,draft:{...k,active:j==="active"}}),children:[f.jsx(mr,{className:"h-8 w-24",children:f.jsx(Gs,{})}),f.jsxs(gr,{children:[f.jsx(Un,{value:"active",children:"启用"}),f.jsx(Un,{value:"inactive",children:"停用"})]})]})}),f.jsx(Zt,{className:"px-4 py-2",children:f.jsxs("div",{className:"flex justify-end gap-2",children:[f.jsx(Te,{type:"button",variant:"outline",size:"sm",onClick:()=>{d(g.category,v,k)},children:"保存"}),f.jsx(Te,{type:"button",variant:"ghost",size:"sm",onClick:()=>o(null),children:"取消"})]})})]},y.value)}return f.jsxs(to,{className:y.active?"":"opacity-50",children:[f.jsx(Zt,{className:"px-4 py-2",children:f.jsxs("span",{className:"inline-flex items-center gap-2",children:[f.jsx("span",{className:"font-mono text-xs",children:y.value}),w?f.jsx(Vt,{variant:"secondary",className:"text-[10px]",children:"内置"}):null,y.active?null:f.jsx(Vt,{variant:"outline",className:"text-[10px]",children:"停用"})]})}),f.jsx(Zt,{className:"px-4 py-2",children:y.label}),f.jsx(Zt,{className:"px-4 py-2",children:y.color?f.jsxs("span",{className:"inline-flex items-center gap-1.5 text-xs text-muted-foreground",children:[f.jsx("span",{className:"inline-block size-3.5 rounded border",style:{backgroundColor:y.color}}),y.color]}):f.jsx("span",{className:"text-xs text-muted-foreground",children:"—"})}),f.jsx(Zt,{className:"px-4 py-2 font-mono text-xs",children:y.order??0}),S?null:f.jsx(Zt,{className:"px-4 py-2 text-xs",children:y.active?f.jsx("span",{className:"text-foreground",children:"启用"}):f.jsx("span",{className:"text-muted-foreground",children:"停用"})}),f.jsx(Zt,{className:"px-4 py-2",children:f.jsxs("div",{className:"flex justify-end gap-1",children:[f.jsx(Te,{type:"button",variant:"ghost",size:"sm",onClick:()=>o({category:g.category,index:v,draft:lSe(y)}),children:f.jsx(r8,{className:"size-3.5","aria-hidden":"true"})}),S?null:f.jsx("span",{className:"inline-flex",title:w?"内置值不可删除":void 0,children:f.jsx(Te,{type:"button",variant:"ghost",size:"sm",disabled:w,onClick:()=>s({category:g.category,entry:y}),children:f.jsx(m8,{className:"size-3.5","aria-hidden":"true"})})})]})})]},y.value)},m=g=>{const y=yw.has(g.category);if(r?.category!==g.category||r.index!==-1)return null;const v=r.draft;return f.jsxs(to,{children:[f.jsx(Zt,{className:"px-4 py-2",children:f.jsx(Lt,{value:v.value,autoFocus:!0,className:"h-8 font-mono text-xs",placeholder:"value",onChange:S=>o({...r,draft:{...v,value:S.target.value}})})}),f.jsx(Zt,{className:"px-4 py-2",children:f.jsx(Lt,{value:v.label,className:"h-8",placeholder:"label",onChange:S=>o({...r,draft:{...v,label:S.target.value}})})}),f.jsx(Zt,{className:"px-4 py-2",children:f.jsx(Lt,{value:v.color,className:"h-8 w-16 font-mono text-xs",placeholder:"#fff",onChange:S=>o({...r,draft:{...v,color:S.target.value}})})}),f.jsx(Zt,{className:"px-4 py-2",children:f.jsx(Lt,{value:v.order,type:"number",className:"h-8 w-20",placeholder:"0",onChange:S=>o({...r,draft:{...v,order:S.target.value}})})}),y?null:f.jsx(Zt,{className:"px-4 py-2",children:f.jsxs(pr,{value:v.active?"active":"inactive",onValueChange:S=>o({...r,draft:{...v,active:S==="active"}}),children:[f.jsx(mr,{className:"h-8 w-24",children:f.jsx(Gs,{})}),f.jsxs(gr,{children:[f.jsx(Un,{value:"active",children:"启用"}),f.jsx(Un,{value:"inactive",children:"停用"})]})]})}),f.jsx(Zt,{className:"px-4 py-2",children:f.jsxs("div",{className:"flex justify-end gap-2",children:[f.jsx(Te,{type:"button",variant:"outline",size:"sm",onClick:()=>{d(g.category,-1,v)},children:"保存"}),f.jsx(Te,{type:"button",variant:"ghost",size:"sm",onClick:()=>o(null),children:"取消"})]})})]})};return f.jsxs("div",{className:"mx-auto w-full max-w-5xl px-4 py-6",children:[f.jsxs("div",{className:"mb-6",children:[f.jsx("h1",{className:"text-xl font-bold text-foreground",children:"枚举管理"}),f.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"全站下拉选项的统一数据源:各页面下拉读此注册表,不写死。内置值(D8)服务端强制不可删除/改名。"})]}),e.isLoading?f.jsx(Kn,{rows:4,cols:4}):e.isError?f.jsx(kn,{message:ft(e.error),onRetry:()=>{e.refetch()}}):f.jsx("div",{className:"space-y-6",children:c.map(g=>{const y=y2[g.category]??{label:g.category,desc:""},v=yw.has(g.category);return f.jsxs("section",{className:"overflow-hidden rounded-lg border",children:[f.jsxs("div",{className:"flex items-center justify-between border-b px-4 py-3",children:[f.jsxs("div",{children:[f.jsxs("h2",{className:"flex items-center gap-2 text-sm font-semibold text-foreground",children:[y.label,f.jsx("span",{className:"font-mono text-xs font-normal text-muted-foreground",children:g.category})]}),f.jsx("p",{className:"mt-0.5 text-xs text-muted-foreground",children:y.desc})]}),v?null:f.jsxs(Te,{type:"button",variant:"outline",size:"sm",onClick:()=>o({category:g.category,index:-1,draft:{value:"",label:"",color:"",order:String(g.entries.length),active:!0}}),children:[f.jsx(Qf,{className:"size-3.5","aria-hidden":"true"}),"新增"]})]}),f.jsxs(sd,{children:[f.jsx(ad,{children:f.jsxs(to,{children:[f.jsx($n,{className:"px-4 py-2",children:"value"}),f.jsx($n,{className:"px-4 py-2",children:"label"}),f.jsx($n,{className:"px-4 py-2",children:"color"}),f.jsx($n,{className:"px-4 py-2",children:"order"}),v?null:f.jsx($n,{className:"px-4 py-2",children:"状态"}),f.jsx($n,{className:"px-4 py-2 text-right",children:"操作"})]})}),f.jsxs(ld,{children:[g.entries.map((S,w)=>p(g,S,w)),m(g)]})]})]},g.category)})}),f.jsx(gi,{open:i!==null,onOpenChange:g=>{g||s(null)},title:"删除枚举值",description:i?`确定删除枚举值「${i.entry.label}(${i.entry.value})」?引用中的值将被服务端拒绝删除。`:"",confirmText:"删除",destructive:!0,loading:n.isPending,onConfirm:()=>{i&&u(i.category,i.entry)}})]})}const Z$=Li({code:zt().regex(/^[a-z0-9]+(-[a-z0-9]+)*$/,"code 需为 kebab-case(小写字母/数字/中划线)"),label:zt().min(1,"标签不能为空"),nodeId:zt().regex(/^[A-Za-z0-9_-]+$/,"nodeId 只允许字母/数字/下划线/连字符"),phase:zt().min(1,"请选择阶段"),track:zt().min(1,"请选择轨道"),prompt:zt().min(1,"Prompt 不能为空"),skills:Ga(zt()),agents:Ga(zt()),description:zt(),version:zt().min(1,"版本不能为空"),scope:ih(["global","project"])}),uSe=Z$.extend({code:zt().min(1)}),dSe={code:"",label:"",nodeId:"",phase:"track",track:"all",prompt:"",skills:[],agents:[],description:"",version:"1.0.0",scope:"global"},fSe=["label","nodeId","phase","track","prompt","skills","agents"];function hSe(e,t){return fSe.some(n=>n==="skills"||n==="agents"?JSON.stringify([...e[n]].sort())!==JSON.stringify([...t[n]??[]].sort()):e[n]!==t[n])}function v2(){Ir();const t=Wu().code??"",n=t.length>0,r=ko(),{activeProjectId:o,projects:i,bootstrapReady:s,bootstrapError:c,retryBootstrap:d}=Kr(),u=Vn("dag_phase"),p=Vn("dag_track"),m=Vn("scope"),g=O=>m.find(z=>z.value===O)?.label??O,y=ibe(n?t:"",{includeDisabled:!0}),v=sbe(),S=abe(),w=b.useMemo(()=>!n||!y.data?!1:y.data.scope==="project"&&(i.find(O=>O.id===y.data?.projectId)?.status??"active")==="archived",[n,y.data,i]),E=ra({resolver:oa(n?uSe:Z$),defaultValues:dSe}),{isSubmitting:k,isDirty:j}=E.formState,[N,A]=b.useState(null),R=y.data?.code;b.useEffect(()=>{if(!n||!y.data||R!==t||E.getValues("code")!=="")return;const O=y.data;E.reset({code:O.code,label:O.label,nodeId:O.nodeId,phase:O.phase,track:O.track,prompt:O.prompt,skills:[...O.skills],agents:[...O.agents],description:O.description??"",version:O.version,scope:O.scope})},[n,y.data,R,t,E]),jC(j&&!k);const M=n&&y.data!==void 0&&j?hSe(E.watch(),y.data)&&E.getValues("version")===y.data.version:!1,T=async O=>{A(null);try{n?(await S.mutateAsync({code:t,patch:{label:O.label,nodeId:O.nodeId,phase:O.phase,track:O.track,prompt:O.prompt,skills:O.skills,agents:O.agents,description:O.description,version:O.version}}),We.success("节点已更新")):(await v.mutateAsync({code:O.code,label:O.label,nodeId:O.nodeId,phase:O.phase,track:O.track,prompt:O.prompt,skills:O.skills,agents:O.agents,...O.description.length>0?{description:O.description}:{},version:O.version,scope:O.scope,...O.scope==="project"?{projectId:o}:{}}),We.success("节点已创建")),r("/nodes")}catch(z){const q=ft(z);A(q),We.error(q)}};return c?f.jsx("div",{className:"mx-auto w-full max-w-4xl px-4 py-6",children:f.jsx(kn,{message:"项目上下文加载失败",onRetry:d})}):s?f.jsxs("div",{className:"mx-auto w-full max-w-4xl px-4 py-6",children:[f.jsxs("div",{className:"mb-6 flex items-center gap-3",children:[f.jsx(Te,{variant:"ghost",size:"icon","aria-label":"返回节点库",render:f.jsx(yn,{to:"/nodes"}),nativeButton:!1,children:f.jsx(Vl,{className:"size-4"})}),f.jsxs("div",{children:[f.jsx("h1",{className:"text-xl font-bold text-foreground",children:n?`编辑节点 · ${t}`:"新建节点"}),f.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"通用 DAG 节点资产(code 为全局唯一键)"})]})]}),n&&y.isLoading?f.jsx(Kn,{rows:6,cols:1}):n&&y.isError?f.jsx(kn,{message:ft(y.error),onRetry:()=>{y.refetch()}}):f.jsx(ia,{...E,children:f.jsxs("form",{onSubmit:E.handleSubmit(T),className:"space-y-6",children:[w&&f.jsx("div",{className:"rounded-lg border border-destructive/50 bg-destructive/10 px-4 py-3 text-sm text-destructive",children:"该节点所属项目已停用,资产处于冻结状态(只读)。如需修改,请先启用该项目,或复制到其他作用域。"}),N!==null&&!w&&f.jsx("div",{role:"alert",className:"max-h-40 overflow-y-auto rounded-lg border border-destructive/50 bg-destructive/10 px-4 py-3 text-sm break-all whitespace-pre-wrap text-destructive",children:N}),f.jsxs("div",{className:"grid gap-6 md:grid-cols-2",children:[f.jsx(Ot,{control:E.control,name:"code",render:({field:O})=>f.jsxs(Dt,{children:[f.jsxs(Pt,{children:["Code ",f.jsx("span",{className:"text-destructive",children:"*"})]}),f.jsx(_t,{children:f.jsx(Lt,{...O,placeholder:"kebab-case,如 code-review-node",disabled:k||n||w})}),f.jsx(It,{})]})}),f.jsx(Ot,{control:E.control,name:"label",render:({field:O})=>f.jsxs(Dt,{children:[f.jsxs(Pt,{children:["标签 ",f.jsx("span",{className:"text-destructive",children:"*"})]}),f.jsx(_t,{children:f.jsx(Lt,{...O,placeholder:"节点显示名",disabled:k||w})}),f.jsx(It,{})]})}),f.jsx(Ot,{control:E.control,name:"nodeId",render:({field:O})=>f.jsxs(Dt,{children:[f.jsxs(Pt,{children:["默认节点 ID ",f.jsx("span",{className:"text-destructive",children:"*"})]}),f.jsx(_t,{children:f.jsx(Lt,{...O,placeholder:"组装进模板时的默认节点标识,如 CODE_REVIEW",disabled:k||w})}),f.jsx(It,{})]})}),f.jsx(Ot,{control:E.control,name:"scope",render:({field:O})=>f.jsxs(Dt,{children:[f.jsx(Pt,{children:"作用域"}),n?f.jsx(_t,{children:f.jsx(Lt,{value:O.value==="global"?`${g("global")}(创建后不可变)`:`${i.find(z=>z.id===y.data?.projectId)?.name??"未知项目"}(创建后不可变)`,disabled:!0})}):f.jsxs(pr,{value:O.value,onValueChange:z=>{(z==="global"||z==="project")&&O.onChange(z)},disabled:k,children:[f.jsx(_t,{children:f.jsx(mr,{className:"w-full",children:f.jsx(Gs,{placeholder:"选择作用域"})})}),f.jsx(gr,{children:m.map(z=>f.jsx(Un,{value:z.value,disabled:z.value==="project"&&o==="",children:z.value==="project"?"当前项目":z.label},z.value))})]}),f.jsx(It,{})]})}),f.jsx(Ot,{control:E.control,name:"phase",render:({field:O})=>f.jsxs(Dt,{children:[f.jsx(Pt,{children:"阶段"}),f.jsxs(pr,{value:O.value,onValueChange:z=>{z!==null&&u.some(q=>q.value===z)&&O.onChange(z)},disabled:k||w,children:[f.jsx(_t,{children:f.jsx(mr,{className:"w-full",children:f.jsx(Gs,{placeholder:"选择阶段"})})}),f.jsx(gr,{children:u.filter(z=>z.active).map(z=>f.jsx(Un,{value:z.value,children:z.label},z.value))})]}),f.jsx(It,{})]})}),f.jsx(Ot,{control:E.control,name:"track",render:({field:O})=>f.jsxs(Dt,{children:[f.jsx(Pt,{children:"轨道"}),f.jsxs(pr,{value:O.value,onValueChange:z=>{z!==null&&p.some(q=>q.value===z)&&O.onChange(z)},disabled:k||w,children:[f.jsx(_t,{children:f.jsx(mr,{className:"w-full",children:f.jsx(Gs,{placeholder:"选择轨道"})})}),f.jsx(gr,{children:p.filter(z=>z.active).map(z=>f.jsx(Un,{value:z.value,children:z.label},z.value))})]}),f.jsx(It,{})]})}),f.jsx(Ot,{control:E.control,name:"version",render:({field:O})=>f.jsxs(Dt,{children:[f.jsx(Pt,{children:"版本"}),f.jsx(_t,{children:f.jsx(Lt,{...O,placeholder:"1.0.0",disabled:k||w})}),f.jsx(It,{})]})}),f.jsx(Ot,{control:E.control,name:"description",render:({field:O})=>f.jsxs(Dt,{children:[f.jsx(Pt,{children:"描述"}),f.jsx(_t,{children:f.jsx(Lt,{...O,placeholder:"一句话说明节点用途(可选)",disabled:k||w})}),f.jsx(It,{})]})})]}),f.jsx(Ot,{control:E.control,name:"skills",render:({field:O})=>f.jsxs(Dt,{children:[f.jsx(Pt,{children:"绑定技能"}),f.jsx(_t,{children:f.jsx(V$,{id:"node-preset-skills",value:O.value,onChange:O.onChange,disabled:k||w})}),f.jsx(It,{}),f.jsx("p",{className:"text-xs text-muted-foreground",children:"by-name 引用(悬空由模板导入校验兜底);版本要求只存在于 npm 分发层,不在此配置。"})]})}),f.jsx(Ot,{control:E.control,name:"agents",render:({field:O})=>f.jsxs(Dt,{children:[f.jsx(Pt,{children:"绑定 Agent"}),f.jsx(_t,{children:f.jsx(B$,{id:"node-preset-agents",value:O.value,onChange:O.onChange,disabled:k||w})}),f.jsx(It,{}),f.jsx("p",{className:"text-xs text-muted-foreground",children:"仅保存和分发 Agent 名称引用,由 AI 宿主按名调用;平台不会自动运行或调度 Agent。"})]})}),f.jsx(Ot,{control:E.control,name:"prompt",render:({field:O})=>f.jsxs(Dt,{children:[f.jsxs("div",{className:"flex items-center justify-between",children:[f.jsxs(Pt,{children:["Prompt ",f.jsx("span",{className:"text-destructive",children:"*"})]}),w&&f.jsx(Vt,{variant:"outline",children:"冻结"})]}),f.jsx(_t,{children:f.jsx(o4,{...O,placeholder:"节点提示词(组装进模板即值拷贝快照,升级按 code 寻址)",disabled:k||w})}),f.jsx(It,{})]})}),M&&f.jsxs("p",{className:"text-xs text-warning",role:"status",children:["内容字段已修改但版本号未提升——K13 要求内容变更必须升版(如 ",y.data?.version," → 手动递增),否则保存将被拒绝。"]}),f.jsxs("div",{className:"flex justify-end gap-2",children:[f.jsx(Te,{type:"button",variant:"outline",render:f.jsx(yn,{to:"/nodes"}),nativeButton:!1,disabled:k,children:"取消"}),f.jsx(Te,{type:"submit",disabled:k||w,children:k?"保存中…":"保存"})]})]})})]}):f.jsx("div",{className:"mx-auto w-full max-w-4xl px-4 py-6",children:f.jsx(Kn,{rows:6})})}const pSe={global:"全局"},ki=mc(),b2=e=>`/nodes/${encodeURIComponent(e.code)}/edit`,mSe=e=>({code:e.code,enabled:e.enabled===!1}),gSe=e=>e.code;function ySe(){Ir();const e=ko(),{activeProjectId:t,activeProjects:n,projects:r,bootstrapReady:o,bootstrapError:i,retryBootstrap:s}=Kr(),{overrideProjectId:c,scopedProject:d,exitScope:u}=Gh(r),p=d?.status==="archived",m=c||t,[g,y]=b.useState(""),v=u$(m,o,{includeDisabled:!0,q:g||void 0}),S=lbe(),w=ube(),E=cbe(),[k,j]=b.useState("all"),{toggle:N,togglingKey:A}=vx({mutation:E,assetLabel:"节点",keyOf:gSe}),R=Vn("dag_phase"),M=Vn("dag_track"),T=D=>R.find(H=>H.value===D)?.label??D,O=D=>M.find(H=>H.value===D)?.label??D,[z,q]=b.useState(null),[$,G]=b.useState(null),L=b.useMemo(()=>yx(v.data??[],k),[v.data,k]),F=b.useCallback(D=>r.find(H=>H.id===D)?.name??"未知项目",[r]),P=()=>{z&&S.mutateAsync(z.code).then(()=>{We.success(`节点「${z.label}」已删除(既有模板不受影响——快照语义)`),q(null)}).catch(D=>{We.error(ft(D)),q(null)})},I=b.useMemo(()=>[ki.accessor("code",{id:"code",header:"Code",cell:D=>p&&D.row.original.scope==="project"?f.jsx("span",{className:"font-mono text-sm font-medium text-foreground",children:D.getValue()}):f.jsx("button",{type:"button",onClick:()=>e(b2(D.row.original)),className:"font-mono text-sm font-medium text-foreground hover:text-muted-foreground focus:outline-none focus-visible:ring-2 focus-visible:ring-foreground",children:D.getValue()})}),ki.accessor("label",{id:"label",header:"标签",cell:D=>f.jsx("span",{className:"text-sm",children:D.getValue()})}),ki.accessor("nodeId",{id:"nodeId",header:"默认 ID",cell:D=>f.jsx("span",{className:"font-mono text-xs text-muted-foreground",children:D.getValue()})}),ki.accessor("phase",{id:"phase",header:"阶段",cell:D=>f.jsx(Vt,{variant:"outline",children:T(D.getValue())})}),ki.accessor("track",{id:"track",header:"轨道",cell:D=>f.jsx(Vt,{variant:"outline",children:O(D.getValue())})}),ki.accessor("agents",{id:"agents",header:"Agents",cell:D=>{const H=D.getValue();return H.length===0?f.jsx("span",{className:"text-xs text-muted-foreground",children:"—"}):f.jsx("span",{className:"block max-w-48 text-xs break-all text-muted-foreground",title:H.join(", "),children:H.join(", ")})}}),gx(),ki.accessor("version",{id:"version",header:"版本",cell:D=>f.jsx("span",{className:"font-mono text-xs text-muted-foreground",children:D.getValue()})}),ki.accessor("scope",{id:"scope",header:"作用域",cell:D=>{const H=D.row.original;return H.scope==="global"?f.jsx(Vt,{variant:"secondary",children:pSe.global}):f.jsx(Vt,{variant:"outline",children:F(H.projectId)})}}),ki.accessor("description",{id:"description",header:"描述",cell:D=>f.jsx(px,{text:D.getValue()??""})}),ki.accessor("updatedAt",{id:"updatedAt",header:"更新时间",cell:D=>f.jsx("span",{className:"text-xs text-muted-foreground",children:xc(D.getValue()??"")}),meta:{initialSortDesc:!0}}),ki.display({id:"actions",header:"操作",cell:({row:D})=>{const H=p&&D.original.scope==="project";return f.jsxs("div",{className:"flex gap-2",children:[f.jsx(Te,{type:"button",variant:"outline",size:"sm",disabled:H,onClick:()=>e(b2(D.original)),children:"编辑"}),f.jsx(Te,{type:"button",variant:"outline",size:"sm",disabled:H,onClick:()=>G(D.original),children:"复制"}),f.jsx(mx,{enabled:D.original.enabled,disabled:H||A===D.original.code,onClick:()=>N(mSe(D.original),{name:D.original.label})}),f.jsx(Te,{type:"button",variant:"outline",size:"sm",disabled:H,onClick:()=>q(D.original),children:"删除"})]})}})],[F,p,T,O,e,N,A]),Y=v.data??[],Z=g.length>0;return f.jsxs("div",{className:"mx-auto w-full max-w-5xl px-4 py-6",children:[f.jsxs("div",{className:"mb-5 flex items-center justify-between",children:[f.jsxs("div",{children:[f.jsx("h1",{className:"text-xl font-bold text-foreground",children:"节点库"}),f.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"通用 DAG 节点资产管理(code 为全局唯一键)"})]}),f.jsx(Te,{type:"button",disabled:!o||p,onClick:()=>e("/nodes/new"),children:"+ 新建节点"})]}),d&&f.jsx(Kh,{project:d,onExit:u}),o&&(Y.length>0||Z)&&f.jsxs("div",{className:"mb-3 flex flex-wrap items-center gap-2",children:[f.jsx(Zh,{className:"w-full sm:max-w-xs",placeholder:"搜索 code / 标签…",onDebouncedChange:y}),f.jsx(xx,{value:k,onChange:j})]}),i?f.jsx(kn,{message:"项目上下文加载失败",onRetry:s}):!o||v.isLoading?f.jsx(Kn,{rows:4,cols:11}):v.isError?f.jsx(kn,{message:ft(v.error),onRetry:()=>{v.refetch()}}):Y.length===0?Z?f.jsx(Dn,{message:`没有匹配「${g}」的节点,试试其他关键词`}):f.jsx(Dn,{message:"还没有节点资产——可从节点库包安装(siming flow install)或点击「新建节点」创建",actionLabel:"新建节点",onAction:()=>e("/nodes/new")}):L.length===0?f.jsx(Dn,{message:"当前筛选状态下没有节点,试试切换状态筛选"}):f.jsx("div",{className:v.isFetching?"pointer-events-none opacity-60 transition-opacity":"transition-opacity",children:f.jsx(yc,{columns:I,data:L})}),f.jsx(gi,{open:z!==null,onOpenChange:D=>{D||q(null)},title:"删除节点",description:z?`确定删除节点「${z.label}(${z.code})」?已组装进模板的节点是快照副本,不受影响。`:"",confirmText:"删除",destructive:!0,loading:S.isPending,onConfirm:P}),f.jsx(S1,{open:$!==null,onOpenChange:D=>{D||G(null)},assetLabel:"节点",sourceName:$?.code??"",projects:n,defaultTargetId:t,onSubmit:D=>w.mutateAsync({code:$?.code??"",input:{newCode:D.newName,newScope:D.newScope,..."targetProjectId"in D?{targetProjectId:D.targetProjectId}:{}}}).then(H=>({name:H.code}))})]})}function xSe(){return _r({queryKey:["projects"],queryFn:_D})}function vSe(){const e=Jt();return on({mutationFn:t=>z9(t),onSuccess:()=>{e.invalidateQueries({queryKey:["projects"]})}})}function bSe(){const e=Jt();return on({mutationFn:({id:t,patch:n})=>L9(t,n),onSuccess:()=>{e.invalidateQueries({queryKey:["projects"]})}})}const wSe=Li({name:zt().min(1,"名称不能为空").max(50,"名称最多 50 字符"),description:zt().max(500,"描述最多 500 字符").optional()}),w2={name:"",description:""},Ef=mc();function SSe(){Ir();const e=xSe(),t=vSe(),n=bSe(),{activeProjectId:r}=Kr(),[o,i]=b.useState(null),[s,c]=b.useState(null),d=ra({resolver:oa(wSe),defaultValues:w2}),{isSubmitting:u}=d.formState;b.useEffect(()=>{o&&d.reset(o.mode==="edit"?{name:o.project.name,...o.project.description?{description:o.project.description}:{}}:w2)},[o]);const p=async y=>{const v={name:y.name,...y.description?{description:y.description}:{}};try{if(o?.mode==="edit")await n.mutateAsync({id:o.project.id,patch:v}),We.success("项目已更新");else{const S=await t.mutateAsync(v);We.success(`项目「${S.name}」已创建(key: ${S.key})`)}i(null)}catch(S){We.error(ft(S))}},m=y=>{const v=y.status==="active";n.mutateAsync({id:y.id,patch:{status:v?"archived":"active"}}).then(()=>{We.success(v?`项目「${y.name}」已停用`:`项目「${y.name}」已启用`),c(null)}).catch(S=>{We.error(ft(S)),c(null)})},g=[Ef.accessor("name",{id:"name",header:"名称",cell:y=>f.jsx("button",{type:"button",onClick:()=>i({mode:"edit",project:y.row.original}),className:"text-sm font-medium text-foreground hover:text-muted-foreground focus:outline-none focus-visible:ring-2 focus-visible:ring-foreground",children:y.getValue()})}),Ef.accessor("key",{id:"key",header:"标识",cell:y=>f.jsx("span",{className:"font-mono text-xs text-muted-foreground",title:y.getValue(),children:y.getValue()})}),Ef.accessor("status",{id:"status",header:"状态",cell:y=>y.getValue()==="active"?f.jsx(Vt,{variant:"secondary",children:"使用中"}):f.jsx(Vt,{variant:"outline",children:"已停用"})}),Ef.accessor("description",{id:"description",header:"描述",cell:y=>y.getValue()?f.jsx("span",{className:"block max-w-xs truncate text-muted-foreground",title:y.getValue(),children:y.getValue()}):f.jsx("span",{className:"text-xs text-muted-foreground",children:"—"})}),Ef.display({id:"actions",header:"操作",cell:({row:y})=>{const v=y.original,S=v.key==="default";return f.jsxs("div",{className:"flex gap-2",children:[f.jsxs(Qw,{children:[f.jsx(Ww,{render:f.jsx(Te,{variant:"outline",size:"sm"}),children:"查看资产"}),f.jsxs(Jw,{align:"start",children:[f.jsx(Ni,{render:f.jsx(yn,{to:`/tasks?projectId=${v.id}`}),children:"任务"}),f.jsx(Ni,{render:f.jsx(yn,{to:`/templates?projectId=${v.id}`}),children:"模板"}),f.jsx(Ni,{render:f.jsx(yn,{to:`/skills?projectId=${v.id}`}),children:"技能"}),f.jsx(Ni,{render:f.jsx(yn,{to:`/agents?projectId=${v.id}`}),children:"代理"})]})]}),f.jsx(Te,{type:"button",variant:"outline",size:"sm",onClick:()=>i({mode:"edit",project:v}),children:"编辑"}),v.status==="active"?f.jsx(Te,{type:"button",variant:"outline",size:"sm",disabled:S,title:S?"默认项目不可停用":void 0,onClick:()=>c(v),children:"停用"}):f.jsx(Te,{type:"button",variant:"outline",size:"sm",onClick:()=>m(v),children:"启用"})]})}})];return f.jsxs("div",{className:"mx-auto w-full max-w-5xl px-4 py-6",children:[f.jsxs("div",{className:"mb-5 flex items-center justify-between",children:[f.jsxs("div",{children:[f.jsx("h1",{className:"text-xl font-bold text-foreground",children:"项目管理"}),f.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"项目是任务与模板的归属维度;停用项目冻结新变更但保留数据"})]}),f.jsx(Te,{type:"button",onClick:()=>i({mode:"create"}),children:"+ 新建项目"})]}),e.isLoading?f.jsx(Kn,{rows:4,cols:5}):e.isError?f.jsx(kn,{message:ft(e.error),onRetry:()=>{e.refetch()}}):(e.data?.length??0)===0?f.jsx(Dn,{message:"还没有项目,点击「新建项目」创建第一个",actionLabel:"新建项目",onAction:()=>i({mode:"create"})}):f.jsx(yc,{columns:g,data:e.data??[]}),f.jsx(jo,{open:o!==null,onOpenChange:y=>{!y&&!u&&i(null)},children:f.jsxs(Ro,{className:"sm:max-w-sm",children:[f.jsxs(_o,{children:[f.jsx(No,{children:o?.mode==="edit"?`编辑项目 · ${o.project.name}`:"新建项目"}),f.jsx(To,{children:o?.mode==="edit"?"修改项目名称与描述":"项目标识(key)由系统自动生成,创建后不可变"})]}),f.jsx(ia,{...d,children:f.jsxs("form",{onSubmit:d.handleSubmit(p),className:"space-y-4",children:[f.jsx(Ot,{control:d.control,name:"name",render:({field:y})=>f.jsxs(Dt,{children:[f.jsxs(Pt,{children:["名称 ",f.jsx("span",{className:"text-destructive",children:"*"})]}),f.jsx(_t,{children:f.jsx(Lt,{...y,placeholder:"如 司命平台",maxLength:50,disabled:u})}),f.jsx(It,{})]})}),f.jsx(Ot,{control:d.control,name:"description",render:({field:y})=>f.jsxs(Dt,{children:[f.jsx(Pt,{children:"描述"}),f.jsx(_t,{children:f.jsx(ty,{...y,value:y.value??"",rows:3,maxLength:500,placeholder:"一句话说明项目用途(可选)",disabled:u})}),f.jsx(It,{})]})}),f.jsxs($i,{children:[f.jsx(id,{render:f.jsx(Te,{variant:"outline"}),disabled:u,children:"取消"}),f.jsx(Te,{type:"submit",disabled:u,children:u?"保存中…":"保存"})]})]})})]})}),f.jsx(gi,{open:s!==null,onOpenChange:y=>{y||c(null)},title:"停用项目",description:s?`确定停用项目「${s.name}」?停用后该项目下不能新建任务/编辑资产(数据保留,可重新启用)${s.id===r?";当前正在使用该项目,停用后将自动切回默认项目":""}`:"",confirmText:"停用",destructive:!0,loading:n.isPending,onConfirm:()=>s&&m(s)})]})}const ESe=Li({username:zt().min(3,"账号至少 3 个字符").max(50,"账号最多 50 个字符").regex(/^[a-zA-Z0-9_-]+$/,"账号仅允许字母、数字、下划线与连字符"),password:zt().min(8,"密码至少 8 个字符").max(128,"密码最多 128 个字符"),confirmPassword:zt().min(1,"请再次输入密码")}).refine(e=>e.password===e.confirmPassword,{path:["confirmPassword"],message:"两次输入的密码不一致"}),CSe={username:"",password:"",confirmPassword:""};function kSe(){Ir();const e=Mh(),t=ko(),n=ra({resolver:oa(ESe),defaultValues:CSe}),{isSubmitting:r}=n.formState;if(!e.ready)return f.jsx($h,{});if(e.mode==="open")return f.jsx(Cu,{to:"/",replace:!0});if(!e.needsSetup)return f.jsxs("div",{className:"rounded-lg border border-border bg-card p-6 text-center shadow-sm",role:"status",children:[f.jsx("p",{className:"text-sm text-foreground",children:"管理员账号已初始化,无需重复创建"}),f.jsx(Te,{type:"button",className:"mt-4",onClick:()=>t("/login",{replace:!0}),children:"前往登录"})]});if(e.authenticated)return f.jsx(Cu,{to:"/",replace:!0});const o=async i=>{try{await e.setup({username:i.username,password:i.password}),We.success("管理员账号已创建"),t("/",{replace:!0})}catch(s){We.error(s instanceof Error&&s.message?s.message:"初始化失败,请重试")}};return f.jsxs("div",{className:"rounded-lg border border-border bg-card p-6 shadow-sm",children:[f.jsx("h1",{className:"text-lg font-bold text-foreground",children:"初始化管理员账号"}),f.jsx("p",{className:"mt-1 mb-5 text-sm text-muted-foreground",children:"首次开启鉴权需创建唯一管理员账号(仅此一次,之后在登录页登录)"}),f.jsx(ia,{...n,children:f.jsxs("form",{onSubmit:n.handleSubmit(o),className:"space-y-4",noValidate:!0,children:[f.jsx(Ot,{control:n.control,name:"username",render:({field:i})=>f.jsxs(Dt,{children:[f.jsx(Pt,{children:"账号"}),f.jsx(_t,{children:f.jsx(Lt,{...i,autoComplete:"username",autoFocus:!0,placeholder:"3-50 个字符",disabled:r})}),f.jsx(It,{})]})}),f.jsx(Ot,{control:n.control,name:"password",render:({field:i})=>f.jsxs(Dt,{children:[f.jsx(Pt,{children:"密码"}),f.jsx(_t,{children:f.jsx(Lt,{...i,type:"password",autoComplete:"new-password",placeholder:"至少 8 个字符",disabled:r})}),f.jsx(It,{})]})}),f.jsx(Ot,{control:n.control,name:"confirmPassword",render:({field:i})=>f.jsxs(Dt,{children:[f.jsx(Pt,{children:"确认密码"}),f.jsx(_t,{children:f.jsx(Lt,{...i,type:"password",autoComplete:"new-password",placeholder:"再次输入密码",disabled:r})}),f.jsx(It,{})]})}),f.jsx(Te,{type:"submit",className:"w-full",disabled:r,children:r?"创建中…":"创建账号"}),f.jsxs("p",{className:"text-center text-xs text-muted-foreground",children:["已有账号?"," ",f.jsx(yn,{to:"/login",className:"text-foreground underline underline-offset-2",children:"去登录"})]})]})})]})}const G$=Li({name:zt().regex(/^[a-z0-9]+(-[a-z0-9]+)*$/,"name 需为 kebab-case(小写字母/数字/中划线)"),description:zt().min(1,"描述不能为空"),content:zt().min(1,"内容不能为空"),category:zt().min(1,"请选择类别"),version:zt().min(1,"版本不能为空"),scope:ih(["global","project"]),references:Ga(Li({path:zt().min(1),content:zt()}))}),jSe=G$.extend({name:zt().min(1)}),RSe={name:"",description:"",content:"",category:"process",version:"1.0.0",scope:"project",references:[]};function S2(){Ir();const t=Wu().name??"",n=t.length>0,r=ko(),[o]=Ay(),i=o.get("scope")==="project"?"project":"global",s=o.get("projectId")??void 0,c={scope:i,...s!==void 0?{projectId:s}:{},includeDisabled:!0},{activeProjectId:d,projects:u,bootstrapReady:p,bootstrapError:m,retryBootstrap:g}=Kr(),y=Vn("skill_category"),v=Vn("scope"),S=q=>v.find($=>$.value===q)?.label??q,w=Ofe(n?t:"",c),E=Dfe(),k=Pfe(),j=b.useMemo(()=>!n||!w.data?!1:w.data.scope==="project"&&(u.find(q=>q.id===w.data?.projectId)?.status??"active")==="archived",[n,w.data,u]),N=ra({resolver:oa(n?jSe:G$),defaultValues:RSe}),{isSubmitting:A,isDirty:R}=N.formState,[M,T]=b.useState(null),O=w.data?.name;b.useEffect(()=>{!n||!w.data||O!==t||N.getValues("name")===""&&N.reset({name:w.data.name,description:w.data.description,content:w.data.content,category:w.data.category,version:w.data.version,scope:w.data.scope,references:w.data.references??[]})},[n,w.data,O,t,N]),jC(R&&!A);const z=async q=>{T(null);try{n?(await k.mutateAsync({name:t,scope:i,projectId:s,patch:{description:q.description,content:q.content,category:q.category,version:q.version,references:q.references}}),We.success("技能已更新")):(await E.mutateAsync({...q,...q.scope==="project"?{projectId:d}:{}}),We.success("技能已创建")),r("/skills")}catch($){const G=ft($);T(G),We.error(G)}};return m?f.jsx("div",{className:"mx-auto w-full max-w-4xl px-4 py-6",children:f.jsx(kn,{message:"项目上下文加载失败",onRetry:g})}):p?f.jsxs("div",{className:"mx-auto w-full max-w-4xl px-4 py-6",children:[f.jsxs("div",{className:"mb-6 flex items-center gap-3",children:[f.jsx(Te,{variant:"ghost",size:"icon","aria-label":"返回技能库",render:f.jsx(yn,{to:"/skills"}),nativeButton:!1,children:f.jsx(Vl,{className:"size-4"})}),f.jsxs("div",{children:[f.jsx("h1",{className:"text-xl font-bold text-foreground",children:n?`编辑技能 · ${t}`:"新建技能"}),f.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Skill 元数据管理(name 为唯一键)"})]})]}),n&&w.isLoading?f.jsx(Kn,{rows:6,cols:1}):n&&w.isError?f.jsx(kn,{message:ft(w.error),onRetry:()=>{w.refetch()}}):f.jsx(ia,{...N,children:f.jsxs("form",{onSubmit:N.handleSubmit(z),className:"space-y-6",children:[j&&f.jsx("div",{className:"rounded-lg border border-destructive/50 bg-destructive/10 px-4 py-3 text-sm text-destructive",children:"该技能所属项目已停用,资产处于冻结状态(只读)。如需修改,请先在项目中启用该项目,或复制到其他作用域。"}),M!==null&&!j&&f.jsx("div",{role:"alert",className:"max-h-40 overflow-y-auto rounded-lg border border-destructive/50 bg-destructive/10 px-4 py-3 text-sm break-all whitespace-pre-wrap text-destructive",children:M}),f.jsxs("div",{className:"grid gap-6 md:grid-cols-2",children:[f.jsx(Ot,{control:N.control,name:"name",render:({field:q})=>f.jsxs(Dt,{children:[f.jsxs(Pt,{children:["名称 ",f.jsx("span",{className:"text-destructive",children:"*"})]}),f.jsx(_t,{children:f.jsx(Lt,{...q,placeholder:"kebab-case,如 code-review",disabled:A||n||j})}),f.jsx(It,{})]})}),f.jsx(Ot,{control:N.control,name:"description",render:({field:q})=>f.jsxs(Dt,{children:[f.jsxs(Pt,{children:["描述 ",f.jsx("span",{className:"text-destructive",children:"*"})]}),f.jsx(_t,{children:f.jsx(Lt,{...q,placeholder:"一句话说明技能用途",disabled:A||j})}),f.jsx(It,{})]})}),f.jsx(Ot,{control:N.control,name:"category",render:({field:q})=>f.jsxs(Dt,{children:[f.jsx(Pt,{children:"类别"}),f.jsxs(pr,{value:q.value,onValueChange:$=>{$!==null&&y.some(G=>G.value===$)&&q.onChange($)},disabled:A||j,children:[f.jsx(_t,{children:f.jsx(mr,{className:"w-full",children:f.jsx(Gs,{placeholder:"选择类别"})})}),f.jsx(gr,{children:y.filter($=>$.active).map($=>f.jsx(Un,{value:$.value,children:$.label},$.value))})]}),f.jsx(It,{})]})}),f.jsx(Ot,{control:N.control,name:"scope",render:({field:q})=>f.jsxs(Dt,{children:[f.jsx(Pt,{children:"作用域"}),n?f.jsx(_t,{children:f.jsx(Lt,{value:q.value==="global"?`${S("global")}(创建后不可变)`:`${u.find($=>$.id===w.data?.projectId)?.name??"未知项目"}(创建后不可变)`,disabled:!0})}):f.jsxs(pr,{value:q.value,onValueChange:$=>{($==="global"||$==="project")&&q.onChange($)},disabled:A,children:[f.jsx(_t,{children:f.jsx(mr,{className:"w-full",children:f.jsx(Gs,{placeholder:"选择作用域"})})}),f.jsx(gr,{children:v.map($=>f.jsx(Un,{value:$.value,disabled:$.value==="project"&&d==="",children:$.value==="project"?"当前项目":$.label},$.value))})]}),f.jsx(It,{})]})}),f.jsx(Ot,{control:N.control,name:"version",render:({field:q})=>f.jsxs(Dt,{children:[f.jsx(Pt,{children:"版本"}),f.jsx(_t,{children:f.jsx(Lt,{...q,placeholder:"1.0.0",disabled:A||j})}),f.jsx(It,{})]})})]}),f.jsx(Ot,{control:N.control,name:"content",render:({field:q})=>f.jsxs(Dt,{children:[f.jsxs("div",{className:"flex items-center justify-between",children:[f.jsxs(Pt,{children:["内容 ",f.jsx("span",{className:"text-destructive",children:"*"})]}),j&&f.jsx(Vt,{variant:"outline",children:"冻结"})]}),f.jsx(_t,{children:f.jsx(ch,{...q,placeholder:"Markdown 技能指令",disabled:A||j})}),f.jsx(It,{})]})}),f.jsx(Ot,{control:N.control,name:"references",render:({field:q})=>f.jsxs(Dt,{children:[f.jsx(Pt,{children:"引用文档"}),f.jsx(_t,{children:f.jsx(pF,{value:q.value,onChange:q.onChange,getMainBody:()=>N.getValues("content"),mainDocName:"SKILL.md",disabled:A||j})}),f.jsx(It,{}),f.jsx("p",{className:"text-xs text-muted-foreground",children:"随技能一并存储与安装下发;install 后主文档中的相对路径引用将在本地真实可达。"})]})}),f.jsxs("div",{className:"flex justify-end gap-2",children:[f.jsx(Te,{type:"button",variant:"outline",render:f.jsx(yn,{to:"/skills"}),nativeButton:!1,disabled:A,children:"取消"}),f.jsx(Te,{type:"submit",disabled:A||j,children:A?"保存中…":"保存"})]})]})})]}):f.jsx("div",{className:"mx-auto w-full max-w-4xl px-4 py-6",children:f.jsx(Kn,{rows:6})})}const _Se={process:"secondary",domain:"default",tooling:"outline"},NSe={global:"全局"},Fa=mc(),E2=e=>e.scope==="project"&&e.projectId?`/skills/${encodeURIComponent(e.name)}/edit?scope=project&projectId=${encodeURIComponent(e.projectId)}`:`/skills/${encodeURIComponent(e.name)}/edit`,TSe=e=>({name:e.name,enabled:e.enabled===!1,scope:e.scope,projectId:e.scope==="project"?e.projectId:void 0}),MSe=e=>e.name;function ASe(){Ir();const e=ko(),{activeProjectId:t,activeProjects:n,projects:r,bootstrapReady:o,bootstrapError:i,retryBootstrap:s}=Kr(),{overrideProjectId:c,scopedProject:d,exitScope:u}=Gh(r),p=d?.status==="archived",m=c||t,[g,y]=b.useState(""),v=kC(m,o,{includeDisabled:!0,q:g||void 0}),S=Ife(),w=zfe(),E=Lfe(),[k,j]=b.useState("all"),{toggle:N,togglingKey:A}=vx({mutation:E,assetLabel:"技能",keyOf:MSe}),R=Vn("skill_category"),[M,T]=b.useState(null),[O,z]=b.useState(null),q=b.useMemo(()=>yx(v.data??[],k),[v.data,k]),$=b.useCallback(I=>r.find(Y=>Y.id===I)?.name??"未知项目",[r]),G=()=>{M&&S.mutateAsync({name:M.name,scope:M.scope,projectId:M.scope==="project"?M.projectId:void 0}).then(()=>{We.success(`技能「${M.name}」已删除`),T(null)}).catch(I=>{We.error(ft(I)),T(null)})},L=b.useMemo(()=>[Fa.accessor("name",{id:"name",header:"名称",cell:I=>p&&I.row.original.scope==="project"?f.jsx("span",{className:"font-mono text-sm font-medium text-foreground",children:I.getValue()}):f.jsx("button",{type:"button",onClick:()=>e(E2(I.row.original)),className:"font-mono text-sm font-medium text-foreground hover:text-muted-foreground focus:outline-none focus-visible:ring-2 focus-visible:ring-foreground",children:I.getValue()})}),Fa.accessor("category",{id:"category",header:"类别",cell:I=>{const Y=I.getValue(),Z=R.find(H=>H.value===Y)?.label??Y,D=_Se[Y]??"secondary";return f.jsx(Vt,{variant:D,children:Z})}}),Fa.accessor("scope",{id:"scope",header:"作用域",cell:I=>{const Y=I.row.original;return Y.scope==="global"?f.jsx(Vt,{variant:"secondary",children:NSe.global}):f.jsx(Vt,{variant:"outline",children:$(Y.projectId)})}}),gx(),Fa.accessor("version",{id:"version",header:"版本",cell:I=>f.jsx("span",{className:"font-mono text-xs text-muted-foreground",children:I.getValue()})}),Fa.accessor("referenceCount",{id:"referenceCount",header:"引用",cell:I=>I.getValue()===void 0||I.getValue()===0?f.jsx("span",{className:"text-xs text-muted-foreground",children:"—"}):f.jsx(Vt,{variant:"secondary",children:I.getValue()})}),Fa.accessor("description",{id:"description",header:"描述",cell:I=>f.jsx(px,{text:I.getValue()})}),Fa.accessor("updatedAt",{id:"updatedAt",header:"更新时间",cell:I=>f.jsx("span",{className:"text-xs text-muted-foreground",children:xc(I.getValue()??"")}),meta:{initialSortDesc:!0}}),Fa.display({id:"actions",header:"操作",cell:({row:I})=>{const Y=p&&I.original.scope==="project";return f.jsxs("div",{className:"flex gap-2",children:[f.jsx(Te,{type:"button",variant:"outline",size:"sm",disabled:Y,onClick:()=>e(E2(I.original)),children:"编辑"}),f.jsx(Te,{type:"button",variant:"outline",size:"sm",onClick:()=>z(I.original),children:"复制"}),f.jsx(mx,{enabled:I.original.enabled,disabled:Y||A===I.original.name,onClick:()=>N(TSe(I.original),{name:I.original.name})}),f.jsx(Te,{type:"button",variant:"outline",size:"sm",disabled:Y,onClick:()=>T(I.original),children:"删除"})]})}})],[$,p,R,e,N,A]),F=v.data??[],P=g.length>0;return f.jsxs("div",{className:"mx-auto w-full max-w-5xl px-4 py-6",children:[f.jsxs("div",{className:"mb-5 flex items-center justify-between",children:[f.jsxs("div",{children:[f.jsx("h1",{className:"text-xl font-bold text-foreground",children:"技能库"}),f.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Skill 元数据管理(name 为唯一键)"})]}),f.jsx(Te,{type:"button",disabled:!o||p,onClick:()=>e("/skills/new"),children:"+ 新建技能"})]}),d&&f.jsx(Kh,{project:d,onExit:u}),o&&(F.length>0||P)&&f.jsxs("div",{className:"mb-3 flex flex-wrap items-center gap-2",children:[f.jsx(Zh,{className:"w-full sm:max-w-xs",placeholder:"搜索技能名称…",onDebouncedChange:y}),f.jsx(xx,{value:k,onChange:j})]}),i?f.jsx(kn,{message:ft(i),onRetry:s}):!o||v.isLoading?f.jsx(Kn,{rows:4,cols:9}):v.isError?f.jsx(kn,{message:ft(v.error),onRetry:()=>{v.refetch()}}):F.length===0?P?f.jsx(Dn,{message:`没有匹配「${g}」的技能,试试其他关键词`}):p?f.jsx(Dn,{message:"该项目暂无专用技能(全局技能为空)"}):f.jsx(Dn,{message:"还没有技能,点击「新建技能」创建第一个",actionLabel:"新建技能",onAction:()=>e("/skills/new")}):q.length===0?f.jsx(Dn,{message:"当前筛选状态下没有技能,试试切换状态筛选"}):f.jsx("div",{className:v.isFetching?"pointer-events-none opacity-60 transition-opacity":"transition-opacity",children:f.jsx(yc,{columns:L,data:q})}),f.jsx(gi,{open:M!==null,onOpenChange:I=>{I||T(null)},title:"删除技能",description:M?`确定删除技能「${M.name}」?该操作不可恢复。`:"",confirmText:"删除",destructive:!0,loading:S.isPending,onConfirm:G}),f.jsx(S1,{open:O!==null,onOpenChange:I=>{I||z(null)},assetLabel:"技能",sourceName:O?.name??"",projects:n,defaultTargetId:t,onSubmit:I=>w.mutateAsync({name:O?.name??"",input:I,scope:O?.scope,projectId:O?.projectId})})]})}function ek({open:e,onOpenChange:t,title:n,label:r,placeholder:o,optional:i=!1,initialValue:s="",onSubmit:c,loading:d=!1}){const[u,p]=b.useState(s);b.useEffect(()=>{e&&p(s)},[e,s]);const m=b.useRef(null),g=()=>{d||!i&&u.trim()===""||c(u)};return f.jsx(jo,{open:e,onOpenChange:t,children:f.jsxs(Ro,{className:"sm:max-w-sm",children:[f.jsxs(_o,{children:[f.jsx(No,{children:n}),f.jsx(To,{className:"sr-only",children:r})]}),f.jsxs("div",{className:"space-y-2",children:[f.jsx(jr,{htmlFor:"prompt-input",children:r}),f.jsx(Lt,{id:"prompt-input",ref:m,value:u,placeholder:o,autoFocus:!0,onChange:y=>p(y.target.value),onKeyDown:y=>{y.key==="Enter"&&g()}})]}),f.jsxs($i,{children:[f.jsx(id,{render:f.jsx(Te,{variant:"outline"}),disabled:d,children:"取消"}),f.jsx(Te,{type:"button",disabled:d||!i&&u.trim()==="",onClick:g,children:d?"处理中…":"确定"})]})]})})}function OSe({task:e,onAdvance:t,onApprove:n,onPause:r,onResume:o,onError:i}){const s=e.currentNode;let c;e.status==="active"?c="active":e.status==="paused"?c=e.pausedAt?"pause-point":"manual":e.status==="completed"?c="completed":c="cancelled";const[d,u]=b.useState(""),[p,m]=b.useState(""),[g,y]=b.useState(!1),[v,S]=b.useState(null),[w,E]=b.useState(!1);b.useEffect(()=>{u(""),m(""),S(null)},[e.id,e.status,s]);const k=e.pausedAt!==null?e.dagInstance.edges.find(z=>z.from===e.pausedAt&&z.pausePoint)??null:null,j=[...e.history].reverse().find(z=>z.action==="paused"),N=typeof j?.details.reason=="string"&&j.details.reason.length>0?j.details.reason:null,A=async(z,q=!1)=>{y(!0),S(null);try{await z()}catch($){q?i?.($):S(ft($))}finally{y(!1)}},R=()=>{A(()=>t(d.trim()||void 0))},M=z=>{A(()=>n(z,p.trim()||void 0),!0)},T=z=>{A(async()=>{await r(z.length>0?z:void 0),E(!1)},!0)},O=()=>{A(()=>o(),!0)};return f.jsxs("div",{className:"space-y-4",children:[c==="active"&&f.jsxs("div",{children:[f.jsx("p",{className:"mb-2 text-xs text-muted-foreground",children:"填写推进说明(可选),然后推进到下一节点:"}),f.jsx(ty,{value:d,onChange:z=>u(z.target.value),placeholder:"推进说明…",rows:2,disabled:g})]}),c==="pause-point"&&f.jsxs("div",{children:[f.jsxs("div",{className:"rounded-md border border-warning/30 bg-warning/10 p-3",children:[f.jsxs("p",{className:"text-sm font-medium text-warning",children:["任务在暂停点 ",f.jsx("span",{className:"font-mono",children:e.pausedAt})]}),f.jsx("p",{className:"mt-1 text-sm text-warning/90",children:k?.pausePoint?.description??"等待人工审批"})]}),f.jsx(ty,{value:p,onChange:z=>m(z.target.value),placeholder:"审批意见(可选)…",rows:2,disabled:g,className:"mt-3"}),f.jsxs("div",{className:"mt-2 flex gap-2",children:[f.jsx(Te,{type:"button",disabled:g,onClick:()=>M("approved"),variant:"outline",className:"border-success bg-success text-success-foreground hover:bg-success/90",children:"✓ 批准"}),f.jsx(Te,{type:"button",disabled:g,onClick:()=>M("rejected"),variant:"outline",className:"border-destructive bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"✗ 拒绝"})]})]}),c==="manual"&&f.jsxs("div",{className:"rounded-md border border-warning/30 bg-warning/10 p-3",children:[f.jsx("p",{className:"text-sm font-medium text-warning",children:"任务已手动暂停"}),f.jsx("p",{className:"mt-1 text-sm text-warning/90",children:N??"手动暂停"})]}),c==="completed"&&f.jsx("div",{className:"rounded-md border border-success/30 bg-success/10 p-3",children:f.jsx("p",{className:"text-sm font-medium text-success",children:"任务已完成,无需操作 ✓"})}),c==="cancelled"&&f.jsx("div",{className:"rounded-md border border-destructive/30 bg-destructive/10 p-3",children:f.jsx("p",{className:"text-sm font-medium text-destructive",children:"任务已取消,无需操作"})}),c==="active"&&f.jsxs("div",{className:"flex flex-wrap gap-2 border-t border-muted pt-3",children:[f.jsx(Te,{type:"button",disabled:g,onClick:R,children:g?"提交中…":"🟢 推进"}),f.jsx(Te,{type:"button",disabled:g,onClick:()=>E(!0),variant:"outline",className:"border-warning/60 bg-warning/10 text-warning hover:bg-warning/20",children:"🟡 暂停"})]}),c==="manual"&&f.jsx("div",{className:"flex flex-wrap gap-2 border-t border-muted pt-3",children:f.jsx(Te,{type:"button",disabled:g,onClick:O,variant:"outline",className:"border-info/40 bg-info/10 text-info hover:bg-info/20",children:"🔵 恢复"})}),v&&f.jsx(cx,{message:v}),f.jsx(ek,{open:w,onOpenChange:E,title:"暂停任务",label:"暂停原因(可选)",placeholder:"输入暂停原因…",optional:!0,loading:g,onSubmit:T})]})}const DSe={entered:"进入节点",advanced:"推进",paused:"暂停",resumed:"恢复",approved:"审批通过",rejected:"审批拒绝",completed:"完成",cancelled:"取消"};function PSe(e){for(const t of["reason","decision","evidence","message"]){const n=e[t];if(typeof n=="string"&&n.length>0)return n}return null}function ISe({history:e}){return e.length===0?f.jsx(Vh,{message:"暂无操作记录"}):f.jsx("ol",{className:"space-y-0",children:e.map((t,n)=>{const r=PSe(t.details);return f.jsxs("li",{className:"relative flex gap-3 pb-4 last:pb-0",children:[n<e.length-1&&f.jsx("span",{className:"absolute left-1 top-4 h-full w-px bg-border","aria-hidden":"true"}),f.jsx("span",{className:`relative mt-1.5 h-2.5 w-2.5 shrink-0 rounded-full ${t.action==="rejected"?"bg-destructive":t.action==="approved"?"bg-success":"bg-muted-foreground"}`,"aria-hidden":"true"}),f.jsxs("div",{className:"min-w-0 flex-1",children:[f.jsxs("div",{className:"flex flex-wrap items-baseline gap-x-2",children:[f.jsx("span",{className:"text-sm font-medium text-foreground",children:DSe[t.action]??t.action}),f.jsx("span",{className:"font-mono text-xs text-muted-foreground",children:t.nodeId}),f.jsx("span",{className:"text-xs text-muted-foreground/60",children:xc(t.timestamp)})]}),r&&f.jsx("p",{className:"mt-0.5 break-all text-xs text-muted-foreground",children:r})]})]},n)})})}function zSe({task:e,onNodeClick:t}){const{nodes:n,nodeStates:r,prunedNodes:o}=e.dagInstance,i=e.status==="paused"&&e.pausedAt!==null,s=new Map;for(const c of n){const d=r[c.id],u=i&&e.pausedAt===c.id?"paused":d?.status==="completed"?"completed":d?.status==="active"?"active":d?.status==="skipped"?"skipped":"pending";s.set(c.id,{label:c.label,state:u})}for(const c of o)s.has(c)||s.set(c,{label:c,state:"skipped"});return f.jsxs("div",{className:"overflow-x-auto",children:[f.jsx("div",{className:"flex min-w-max items-start gap-2 py-2",children:n.map((c,d)=>{const p=s.get(c.id)?.state??"pending",m=p==="active",g=p==="paused";return f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsxs("button",{type:"button",disabled:!t,onClick:()=>t?.(c.id),className:`flex items-center gap-2 rounded-md border px-3 py-1.5 text-sm transition ${m?"border-success bg-success/10 text-success":g?"border-warning bg-warning/10 text-warning":p==="completed"?"border-border bg-muted text-muted-foreground":p==="skipped"?"border-dashed border-muted text-muted-foreground/60":"border-muted text-muted-foreground"} ${t?"cursor-pointer hover:border-primary/50 hover:bg-primary/5":"cursor-default"}`,title:`${c.id}(${p})${t?"· 点击查看节点信息":""}`,children:[f.jsx("span",{className:`h-2 w-2 shrink-0 rounded-full ${m?"bg-success":g?"bg-warning":p==="completed"?"bg-muted-foreground":p==="skipped"?"bg-muted-foreground/40":"border border-muted-foreground/40 bg-background"}`}),f.jsx("span",{className:"font-mono text-xs",children:c.id})]}),d<n.length-1&&f.jsxs("div",{className:"flex items-center gap-1",children:[f.jsx("div",{className:`h-px w-6 ${m||g?"bg-success":"bg-muted-foreground/40"}`}),f.jsx("span",{className:"text-xs text-muted-foreground/60",children:"→"})]})]},c.id)})}),f.jsxs("div",{className:"mt-1 flex gap-4 text-xs text-muted-foreground",children:[f.jsxs("span",{className:"flex items-center gap-1",children:[f.jsx("span",{className:"h-2 w-2 rounded-full bg-success"})," 当前"]}),f.jsxs("span",{className:"flex items-center gap-1",children:[f.jsx("span",{className:"h-2 w-2 rounded-full bg-warning"})," 暂停点"]}),f.jsxs("span",{className:"flex items-center gap-1",children:[f.jsx("span",{className:"h-2 w-2 rounded-full bg-muted-foreground"})," 已完成"]}),f.jsxs("span",{className:"flex items-center gap-1",children:[f.jsx("span",{className:"h-2 w-2 rounded-full border border-muted-foreground/40 bg-background"})," 待处理"]}),f.jsxs("span",{className:"flex items-center gap-1",children:[f.jsx("span",{className:"h-2 w-2 rounded-full bg-muted-foreground/40"})," 已跳过"]})]})]})}const LSe=[{key:"task",label:"任务信息"},{key:"template",label:"模板信息"}];function FSe({nodeId:e,task:t,open:n,onOpenChange:r}){const[o,i]=b.useState("task");if(!t||!e)return null;const s=t.dagInstance.nodes.find(m=>m.id===e),c=t.dagInstance.nodeStates[e];if(!s)return null;const d=t.dagInstance.edges.filter(m=>m.to===e).map(m=>m.from),u=t.dagInstance.edges.filter(m=>m.from===e).map(m=>m.to),p=t.dagInstance.edges.filter(m=>m.from===e&&m.pausePoint);return f.jsx(jo,{open:n,onOpenChange:r,children:f.jsxs(Ro,{className:"flex h-[85vh] w-[calc(100vw-4rem)] max-w-3xl flex-col gap-4 sm:max-w-none",children:[f.jsxs(_o,{children:[f.jsx(No,{className:"font-mono text-base",children:e}),f.jsx(To,{children:"节点信息(只读)"})]}),f.jsx("div",{className:"flex shrink-0 gap-1 rounded-md bg-muted p-1",role:"tablist","aria-label":"节点信息分区",children:LSe.map(m=>f.jsx("button",{type:"button",role:"tab","aria-selected":o===m.key,className:`flex-1 rounded px-2 py-1.5 text-sm transition ${o===m.key?"bg-background font-medium text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,onClick:()=>i(m.key),children:m.label},m.key))}),f.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto",children:[o==="task"&&f.jsx("div",{className:"space-y-4",children:f.jsxs("div",{className:"grid grid-cols-2 gap-3 text-sm",children:[f.jsxs("div",{children:[f.jsx("span",{className:"text-xs text-muted-foreground",children:"状态"}),f.jsx("p",{className:"font-medium text-foreground",children:c?.status??"未到达"})]}),f.jsxs("div",{children:[f.jsx("span",{className:"text-xs text-muted-foreground",children:"进入时间"}),f.jsx("p",{className:"font-mono text-xs text-foreground",children:c?.enteredAt??"—"})]}),f.jsxs("div",{children:[f.jsx("span",{className:"text-xs text-muted-foreground",children:"完成时间"}),f.jsx("p",{className:"font-mono text-xs text-foreground",children:c?.completedAt??"—"})]}),f.jsxs("div",{children:[f.jsx("span",{className:"text-xs text-muted-foreground",children:"出边暂停点"}),f.jsx("p",{className:"text-xs text-foreground",children:p.length>0?p.map(m=>`${m.pausePoint?.type}(${m.to})`).join(", "):"无"})]}),f.jsxs("div",{children:[f.jsx("span",{className:"text-xs text-muted-foreground",children:"前驱节点"}),f.jsx("p",{className:"font-mono text-xs text-foreground",children:d.length>0?d.join(", "):"无"})]}),f.jsxs("div",{children:[f.jsx("span",{className:"text-xs text-muted-foreground",children:"后继节点"}),f.jsx("p",{className:"font-mono text-xs text-foreground",children:u.length>0?u.join(", "):"无"})]})]})}),o==="template"&&f.jsxs("div",{className:"space-y-4",children:[f.jsxs("div",{className:"grid grid-cols-2 gap-3 text-sm",children:[f.jsxs("div",{children:[f.jsx("span",{className:"text-xs text-muted-foreground",children:"标签"}),f.jsx("p",{className:"font-medium text-foreground",children:s.label})]}),f.jsxs("div",{children:[f.jsx("span",{className:"text-xs text-muted-foreground",children:"阶段"}),f.jsx("p",{className:"text-foreground",children:s.phase})]}),f.jsxs("div",{children:[f.jsx("span",{className:"text-xs text-muted-foreground",children:"轨道"}),f.jsx("p",{className:"text-foreground",children:s.track})]}),f.jsxs("div",{children:[f.jsx("span",{className:"text-xs text-muted-foreground",children:"Skills"}),f.jsx("p",{className:"text-xs break-all text-foreground",title:s.skills.join(", "),children:s.skills.length>0?s.skills.join(", "):"无"})]}),f.jsxs("div",{children:[f.jsx("span",{className:"text-xs text-muted-foreground",children:"Agents"}),f.jsx("p",{className:"text-xs break-all text-foreground",title:(s.agents??[]).join(", "),children:(s.agents??[]).length>0?(s.agents??[]).join(", "):"无"})]})]}),f.jsxs("div",{children:[f.jsx("p",{className:"mb-1 text-xs text-muted-foreground",children:"节点 Prompt"}),f.jsx("div",{className:"rounded-md border border-border bg-muted/50 p-3",children:f.jsx(ql,{content:s.prompt||null,emptyText:"(无 prompt)"})})]})]})]}),f.jsx("div",{className:"flex shrink-0 justify-end border-t border-border pt-3",children:f.jsx("button",{type:"button",className:"rounded-md px-4 py-1.5 text-sm text-muted-foreground transition hover:text-foreground",onClick:()=>r(!1),children:"关闭"})})]})})}function $Se({notice:e,onClose:t}){const n=e.status==="paused"?"border-warning/30 bg-warning/10 text-warning":"border-success/30 bg-success/10 text-success";return f.jsx("div",{className:`rounded-lg border p-4 text-sm ${n}`,children:f.jsxs("div",{className:"flex items-start justify-between gap-3",children:[f.jsxs("div",{className:"min-w-0 space-y-1",children:[e.status==="advanced"&&f.jsxs(f.Fragment,{children:[f.jsxs("p",{className:"font-medium",children:["已推进到「",e.nextNode.label,"」(",e.nextNode.nodeId,")"]}),e.nextNode.upcomingPause&&f.jsxs("p",{className:"text-xs",children:["前方暂停点:",e.nextNode.upcomingPause]})]}),e.status==="paused"&&f.jsxs(f.Fragment,{children:[f.jsxs("p",{className:"font-medium",children:["到达暂停点:",e.pausePoint.description]}),f.jsx("p",{className:"text-xs",children:e.guidance})]}),e.status==="completed"&&f.jsx("p",{className:"font-medium",children:"任务已完成 ✓"})]}),f.jsx(Te,{type:"button",variant:"ghost",size:"icon-sm",onClick:t,"aria-label":"关闭提示",className:"shrink-0 text-inherit hover:bg-transparent",children:"×"})]})})}function K$({project:e}){return e?f.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:["项目:",e.name,e.status==="archived"&&f.jsx(Vt,{variant:"outline",children:"已停用"})]}):null}function VSe({taskDoc:e}){const t=e.acceptance??[],n=e.nonGoals??[];return f.jsxs("div",{className:"space-y-3",children:[f.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[f.jsxs("div",{className:"rounded-md border border-border bg-muted/20 p-3",children:[f.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:"目标(What)"}),f.jsx(ql,{content:e.what??null,className:"mt-1",emptyText:"(未写)"})]}),f.jsxs("div",{className:"rounded-md border border-border bg-muted/20 p-3",children:[f.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:"动机(Why)"}),f.jsx(ql,{content:e.why??null,className:"mt-1",emptyText:"(未写)"})]})]}),e.trackNote&&f.jsxs("div",{children:[f.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:"轨道备注"}),f.jsx(ql,{content:e.trackNote,className:"mt-1"})]}),f.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[f.jsxs("div",{children:[f.jsxs("p",{className:"text-xs font-medium text-muted-foreground",children:["验收标准(",t.length,")"]}),f.jsx("ul",{className:"mt-1.5 space-y-1",children:t.map((r,o)=>f.jsxs("li",{className:"flex gap-1.5 text-sm text-foreground",children:[f.jsx("span",{className:"text-muted-foreground",children:"✓"}),f.jsx("span",{className:"leading-relaxed",children:r})]},o))})]}),f.jsxs("div",{children:[f.jsxs("p",{className:"text-xs font-medium text-muted-foreground",children:["非目标(",n.length,")"]}),f.jsx("ul",{className:"mt-1.5 space-y-1",children:n.map((r,o)=>f.jsxs("li",{className:"flex gap-1.5 text-sm text-muted-foreground",children:[f.jsx("span",{children:"✗"}),f.jsx("span",{className:"leading-relaxed",children:r})]},o))})]})]})]})}function BSe({type:e,path:t,content:n}){const[r,o]=b.useState(!1),[i,s]=b.useTransition(),c=Math.round(n.length/1024*10)/10,d=/\.(md|markdown|mdx)$/i.test(t);return f.jsxs("div",{className:"rounded-md border border-muted",children:[f.jsxs("button",{type:"button",disabled:i,onClick:()=>s(()=>o(u=>!u)),className:"flex w-full items-center gap-2 px-2.5 py-1.5 text-left text-xs hover:bg-muted/30",children:[f.jsx("span",{className:"rounded bg-muted px-1.5 py-0.5 font-mono text-[10px] text-muted-foreground",children:e}),f.jsx("span",{className:"truncate font-mono text-[11px] text-muted-foreground",children:t}),f.jsx("span",{className:"ml-auto shrink-0 text-[10px] text-muted-foreground",children:i?"渲染中…":`全文 ${c} KB ${r?"▼":"▶"}`})]}),r&&(d?f.jsx(ql,{content:n,scrollClassName:"max-h-96 border-t border-muted bg-muted/30 px-3 py-2"}):f.jsx("pre",{className:"max-h-96 overflow-auto whitespace-pre-wrap border-t border-muted bg-muted/30 px-3 py-2 text-xs leading-relaxed text-muted-foreground",children:n}))]})}function HSe({nodeId:e,label:t,record:n}){if(!n)return null;const r=n.checks??[],o=n.decisions??[],i=n.artifacts??[],s=n.confirmations??[];return f.jsxs("div",{className:"rounded-md border border-border",children:[f.jsxs("div",{className:"flex flex-wrap items-center gap-2 border-b border-border bg-muted/30 px-3 py-1.5",children:[f.jsx("span",{className:"rounded bg-muted px-1.5 py-0.5 font-mono text-[10px] text-muted-foreground",children:e}),f.jsx("span",{className:"text-sm font-medium text-foreground",children:t}),n.review&&f.jsxs("span",{className:`ml-auto rounded px-1.5 py-0.5 text-[10px] font-medium ${n.review.verdict==="pass"?"bg-success/10 text-success":"bg-destructive/10 text-destructive"}`,children:["审查 ",n.review.verdict," · ",n.review.rounds," 轮 · critical ",n.review.critical]})]}),f.jsxs("div",{className:"space-y-2.5 px-3 py-2.5",children:[n.summary&&f.jsx(ql,{content:n.summary}),r.length>0&&f.jsx("ul",{className:"space-y-1",children:r.map(c=>f.jsxs("li",{className:"flex gap-1.5 text-sm",children:[f.jsx("span",{className:c.passed?"text-success":"text-destructive",children:c.passed?"✓":"✗"}),f.jsx("span",{className:"leading-relaxed text-foreground",children:c.item})]},c.id))}),o.length>0&&f.jsx("div",{className:"space-y-1",children:o.map(c=>f.jsxs("p",{className:"text-xs text-muted-foreground",children:[f.jsxs("span",{className:"font-medium text-foreground",children:["决策 · ",c.topic,":"]}),c.decision]},c.id))}),i.length>0&&f.jsx("div",{className:"space-y-1.5",children:i.map(c=>c.content?f.jsx(BSe,{type:c.type,path:c.path,content:c.content},c.id):f.jsxs("span",{className:"block rounded bg-muted px-1.5 py-0.5 font-mono text-[10px] text-muted-foreground",children:[c.type,": ",c.path]},c.id))}),s.length>0&&f.jsx("div",{className:"space-y-1.5",children:s.map(c=>f.jsxs("blockquote",{className:"border-l-2 border-border pl-2.5 text-xs italic leading-relaxed text-muted-foreground",children:[c.quote,f.jsxs("span",{className:"ml-2 not-italic",children:["— ",new Date(c.at).toLocaleString()]})]},c.id))})]})]})}function USe({contextQuery:e}){if(e.isLoading)return f.jsx($h,{className:"h-16"});if(e.isError)return f.jsxs("div",{className:"flex flex-col items-center gap-2 py-6 text-center",children:[f.jsxs("p",{className:"text-sm text-destructive",children:["任务信息加载失败:",ft(e.error)]}),f.jsx(Te,{variant:"outline",size:"sm",onClick:()=>{e.refetch()},children:"重试"})]});const t=e.data;if(!t)return null;const n=Object.keys(t.nodeRecords);if(!(t.taskDoc!==null||n.length>0||t.archNotes.length>0))return f.jsx(Vh,{message:"尚无任务信息。执行期间经 siming task doc / record / archnote 命令小步写入后在此呈现。"});const o=[...t.nodes.filter(i=>i.nodeId in t.nodeRecords),...n.filter(i=>!t.nodes.some(s=>s.nodeId===i)).map(i=>({nodeId:i,label:i}))];return f.jsxs("div",{className:"space-y-4",children:[t.taskDoc&&f.jsx(VSe,{taskDoc:t.taskDoc}),o.length>0&&f.jsx("div",{className:"space-y-2.5",children:o.map(({nodeId:i,label:s})=>f.jsx(HSe,{nodeId:i,label:s,record:t.nodeRecords[i]},i))}),t.archNotes.length>0&&f.jsx(qSe,{notes:t.archNotes})]})}function qSe({notes:e}){return f.jsxs("div",{className:"rounded-md border border-dashed border-border p-3",children:[f.jsxs("p",{className:"text-xs font-medium text-muted-foreground",children:["架构信息素材(",e.length,")"]}),f.jsx("ul",{className:"mt-1.5 space-y-1.5",children:e.map(t=>f.jsxs("li",{className:"flex gap-2 text-xs leading-relaxed text-muted-foreground",children:[f.jsx("span",{className:"mt-1 h-1 w-1 shrink-0 rounded-full bg-muted-foreground/60"}),f.jsxs("span",{children:[t.text,f.jsxs("span",{className:"ml-1.5 opacity-70",children:["(",new Date(t.at).toLocaleDateString(),")"]})]})]},t.id))})]})}function YSe(){const{taskId:e=""}=Wu(),t=i$(e),{projects:n}=Kr();Ir(t.data?`任务 ${t.data.taskId} · 司命`:void 0);const r=Gve(e),o=Kve(e),i=Qve(e),s=Wve(e),c=Jve(e),d=Vn("dag_track"),u=Vn("dag_phase"),p=$=>d.find(G=>G.value===$)?.label??$,m=$=>u.find(G=>G.value===$)?.label??$,[g,y]=b.useState(null),[v,S]=b.useState(null),[w,E]=b.useState(!1),[k,j]=b.useState(!1),N=t.data,A=Xve(e),R=async $=>{const G=await r.mutateAsync($);return y(G),G},M=async($,G)=>{try{await o.mutateAsync({decision:$,...G?{comment:G}:{}}),We.success($==="approved"?"已批准,任务继续推进":"已拒绝,任务保持暂停"),y(null)}catch(L){We.error(ft(L))}},T=async $=>{await i.mutateAsync($),We.success("任务已暂停"),y(null)},O=async()=>{await s.mutateAsync(void 0),We.success("任务已恢复"),y(null)},z=$=>{c.mutateAsync($.trim()||void 0).then(()=>{We.success("任务已取消"),j(!1),y(null)}).catch(G=>We.error(ft(G)))},q=$=>{S($),E(!0)};return f.jsxs("div",{className:"mx-auto w-full max-w-5xl px-4 py-6",children:[f.jsx(yn,{to:"/tasks",className:"mb-1 inline-block text-sm text-muted-foreground transition hover:text-foreground",children:"← 返回任务列表"}),t.isLoading?f.jsx("div",{className:"mt-4",children:f.jsx(Kn,{rows:4,cols:4})}):t.isError?f.jsx("div",{className:"mt-4",children:f.jsx(kn,{message:ft(t.error),onRetry:()=>{t.refetch()}})}):N?f.jsxs("div",{className:"mt-4 space-y-5",children:[f.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[f.jsx("h1",{className:"text-xl font-bold text-foreground",children:N.title}),f.jsx(JC,{status:N.status}),f.jsx("span",{className:"rounded bg-muted px-2 py-0.5 font-mono text-xs text-muted-foreground",children:N.taskId}),f.jsxs("span",{className:"text-xs text-muted-foreground",children:["轨道:",p(N.track)]}),f.jsxs("span",{className:"text-xs text-muted-foreground",children:["阶段:",m(N.currentPhase)]}),f.jsx(K$,{project:n.find($=>$.id===N.projectId)}),f.jsx(yn,{to:`/dag/templates/${N.dagTemplateId}?instance=${N.taskId}`,className:"ml-auto text-sm text-primary underline-offset-4 transition hover:underline",children:"查看流程图 →"})]}),g&&f.jsx($Se,{notice:g,onClose:()=>y(null)}),f.jsx(Oi,{title:"流程进度",children:f.jsx(zSe,{task:N,onNodeClick:q})}),f.jsx(Oi,{title:"任务信息",children:f.jsx(USe,{contextQuery:A})}),f.jsxs(Oi,{title:"操作",children:[f.jsx(OSe,{task:N,onAdvance:R,onApprove:M,onPause:T,onResume:O,onError:$=>We.error(ft($))}),(N.status==="active"||N.status==="paused")&&f.jsxs("div",{className:"mt-4 flex items-center gap-3 border-t border-muted pt-3",children:[f.jsx(Te,{type:"button",variant:"destructive",disabled:c.isPending,onClick:()=>j(!0),children:c.isPending?"取消中…":"取消任务"}),f.jsx("p",{className:"text-xs text-muted-foreground",children:"取消后任务进入终态,不可恢复"})]})]}),f.jsx(Oi,{title:"操作历史",children:f.jsx(ISe,{history:N.history})})]}):null,f.jsx(FSe,{nodeId:v,task:N??null,open:w,onOpenChange:E}),f.jsx(ek,{open:k,onOpenChange:j,title:"取消任务(不可恢复)",label:"取消理由(可选,写入操作历史)",placeholder:"输入取消理由…",optional:!0,loading:c.isPending,onSubmit:z})]})}const Cf=mc(),ZSe=[Cf.accessor("taskId",{id:"taskId",header:"ID",cell:e=>f.jsx("span",{className:"font-mono text-xs text-muted-foreground",children:e.getValue()})}),Cf.accessor("title",{id:"title",header:"标题",cell:e=>f.jsx(yn,{to:`/tasks/${e.row.original.taskId}`,className:"font-medium text-foreground focus:outline-none focus-visible:ring-2 focus-visible:ring-foreground",children:e.getValue()})}),Cf.accessor("status",{id:"status",header:"状态",cell:e=>f.jsx(JC,{status:e.getValue()})}),Cf.accessor("currentNode",{id:"currentNode",header:"当前节点",cell:e=>f.jsx("span",{className:"font-mono text-xs text-muted-foreground",children:e.getValue()})}),Cf.accessor("createdAt",{id:"createdAt",header:"创建时间",meta:{initialSortDesc:!0},cell:e=>f.jsx("span",{className:"text-xs text-muted-foreground",children:xc(e.getValue())})})];function GSe({tasks:e}){return f.jsx(yc,{columns:ZSe,data:e})}function KSe(){Ir();const{activeProjectId:e,activeProjects:t,projects:n,bootstrapReady:r,bootstrapError:o,retryBootstrap:i}=Kr(),{overrideProjectId:s,scopedProject:c,exitScope:d}=Gh(n),u=c?.status==="archived",p=s||e,[m,g]=b.useState(""),y=Zve(p,m),v=a$(),[S,w]=b.useState(!1);return f.jsxs("div",{className:"mx-auto w-full max-w-5xl px-4 py-6",children:[f.jsxs("div",{className:"mb-5 flex items-center justify-between",children:[f.jsxs("div",{children:[f.jsx("h1",{className:"text-xl font-bold text-foreground",children:"任务"}),f.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"DAG 驱动的研发任务看板"})]}),f.jsx(Te,{type:"button",disabled:!r||u,onClick:()=>w(!0),children:"+ 新建任务"})]}),c&&f.jsx(Kh,{project:c,onExit:d}),r&&((y.data?.length??0)>0||m.length>0)&&f.jsx("div",{className:"mb-3",children:f.jsx(Zh,{className:"w-full sm:max-w-xs",placeholder:"搜索任务标题…",onDebouncedChange:g})}),o?f.jsx(kn,{message:ft(o),onRetry:i}):r?y.isLoading?f.jsx(Kn,{rows:4,cols:5}):y.isError?f.jsx(kn,{message:ft(y.error),onRetry:()=>{y.refetch()}}):(y.data?.length??0)===0?m.length>0?f.jsx(Dn,{message:`没有匹配「${m}」的任务,试试其他关键词`}):u?f.jsx(Dn,{message:"该项目暂无任务"}):f.jsx(Dn,{message:"还没有任务,点击「新建任务」创建第一个",actionLabel:"新建任务",onAction:()=>w(!0)}):f.jsx("div",{className:y.isFetching?"pointer-events-none opacity-60 transition-opacity":"transition-opacity",children:f.jsx(GSe,{tasks:y.data??[]})}):f.jsx(Kn,{rows:4,cols:5}),f.jsx(Y$,{open:S,projects:t,defaultProjectId:e,onClose:()=>w(!1),onCreate:async E=>{await v.mutateAsync(E),We.success("任务已创建")}})]})}function XSe(){Ir();const{id:e=""}=Wu(),t=ko(),n=YC(e),{projects:r}=Kr(),o=l$(),i=c$(),[s,c]=b.useState(!1),[d,u]=b.useState(!1),[p,m]=b.useState(null),[g,y]=b.useState(void 0),[v,S]=b.useState(!1),w=p??{nodes:n.data?.nodes??[],edges:n.data?.edges??[]},E=b.useCallback((I,Y)=>{m(I);const Z=n.data?.layout;if(Y?.rename){const{oldId:D,newId:H}=Y.rename;y(U=>{const B=U??Z;if(!B)return U;const X=B[D];if(!X)return B;const{[D]:J,...Q}=B;return{...Q,[H]:X}})}if(Y?.deleted){const D=Y.deleted;y(H=>{const U=H??Z;if(!U)return H;if(!(D in U))return U;const{[D]:B,...X}=U;return X})}},[n.data?.layout]),k=U$(w,E),j=Vn("dag_phase"),N=Vn("dag_track"),A=I=>j.find(Y=>Y.value===I)?.label??I,R=I=>N.find(Y=>Y.value===I)?.label??I,M=Vn("pause_type"),T=I=>M.find(Y=>Y.value===I)?.label??I;if(n.isLoading)return f.jsxs("div",{className:"mx-auto w-full max-w-5xl px-4 py-6",children:[f.jsx(yn,{to:"/templates",className:"text-sm text-muted-foreground transition hover:text-foreground",children:"← 返回模板列表"}),f.jsx("div",{className:"mt-4",children:f.jsx(Kn,{rows:4,cols:4})})]});if(n.isError)return f.jsxs("div",{className:"mx-auto w-full max-w-5xl px-4 py-6",children:[f.jsx(yn,{to:"/templates",className:"text-sm text-muted-foreground transition hover:text-foreground",children:"← 返回模板列表"}),f.jsx("div",{className:"mt-4",children:f.jsx(kn,{message:ft(n.error),onRetry:()=>{n.refetch()}})})]});if(!n.data)return null;const O=n.data,z=p!==null,q=r.find(I=>I.id===O.projectId)?.status==="archived",$=N.filter(I=>I.active).map(I=>I.value),G=()=>{if(!p)return;const I=q$(p,{tracks:$,entryPhase:"entry"});if(I.length>0){We.error(`校验未通过(${I.length} 项),请修复后保存`);return}const Y=g??O.layout;i.mutateAsync({id:e,patch:{nodes:p.nodes,edges:p.edges,...Y?{layout:Y}:{},version:tE(O.version)}}).then(()=>{We.success(`模板「${O.name}」已保存`),m(null),y(void 0)}).catch(Z=>We.error(ft(Z)))},L=()=>{m(null),y(void 0),k.clearSelection()},F=()=>{u(!0),f9(e).then(I=>{const Y=new Blob([JSON.stringify(I,null,2)],{type:"application/json"}),Z=URL.createObjectURL(Y),D=document.createElement("a");D.href=Z,D.download=`${I.template.name.replace(/[\\/:*?"<>|]/g,"_")}-v${I.template.version}.json`,D.click(),URL.revokeObjectURL(Z),We.success(`模板「${O.name}」已导出(含 ${I.dependencies.skills.length+I.dependencies.agents.length+I.dependencies.modelAliases.length} 项依赖)`)}).catch(I=>We.error(ft(I))).finally(()=>u(!1))},P=()=>{o.mutateAsync(e).then(()=>{We.success(`模板「${O.name}」已删除`),c(!1),t("/templates")}).catch(I=>{We.error(ft(I)),c(!1)})};return f.jsxs("div",{className:"mx-auto w-full max-w-5xl px-4 py-6",children:[f.jsx(yn,{to:"/templates",className:"text-sm text-muted-foreground transition hover:text-foreground",children:"← 返回模板列表"}),f.jsxs("div",{className:"mt-4 space-y-5",children:[f.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[f.jsx("h1",{className:"text-xl font-bold text-foreground",children:O.name}),O.isDefault&&f.jsx("span",{className:"rounded bg-foreground px-2 py-0.5 text-xs text-background",children:"默认模板"}),f.jsxs("span",{className:"rounded bg-muted px-2 py-0.5 font-mono text-xs text-muted-foreground",children:["v",O.version]}),f.jsx(K$,{project:r.find(I=>I.id===O.projectId)}),f.jsx(Te,{type:"button",variant:"outline",className:"ml-auto",disabled:d,onClick:F,children:d?"导出中…":"导出"}),f.jsx(Te,{type:"button",variant:"outline",disabled:q,onClick:()=>S(!0),children:"检查更新"}),q?f.jsx(Te,{type:"button",variant:"outline",disabled:!0,children:"打开编辑器"}):f.jsx(Te,{render:f.jsx(yn,{to:`/dag/templates/${O.id}`}),nativeButton:!1,variant:"outline",children:"打开编辑器"}),z&&f.jsxs(f.Fragment,{children:[f.jsx(Te,{type:"button",variant:"outline",disabled:i.isPending,onClick:L,children:"取消编辑"}),f.jsx(Te,{type:"button",disabled:i.isPending,onClick:G,children:"保存节点"})]}),f.jsx(Te,{type:"button",variant:"destructive",disabled:o.isPending||q,onClick:()=>c(!0),children:"删除模板"})]}),f.jsx("p",{className:"text-sm text-muted-foreground",children:O.description}),f.jsx(Oi,{title:`节点(${O.nodes.length})`,children:f.jsx("div",{className:"overflow-x-auto",children:f.jsxs("table",{className:"w-full text-left text-sm",children:[f.jsx("thead",{className:"border-b border-border",children:f.jsxs("tr",{children:[f.jsx("th",{scope:"col",className:"px-3 py-2 text-xs font-medium text-muted-foreground",children:"ID"}),f.jsx("th",{scope:"col",className:"px-3 py-2 text-xs font-medium text-muted-foreground",children:"标签"}),f.jsx("th",{scope:"col",className:"px-3 py-2 text-xs font-medium text-muted-foreground",children:"阶段"}),f.jsx("th",{scope:"col",className:"px-3 py-2 text-xs font-medium text-muted-foreground",children:"轨道"}),f.jsx("th",{scope:"col",className:"px-3 py-2 text-xs font-medium text-muted-foreground",children:"Skills"}),f.jsx("th",{scope:"col",className:"px-3 py-2 text-xs font-medium text-muted-foreground",children:"Agents"}),f.jsx("th",{scope:"col",className:"px-3 py-2 text-xs font-medium text-muted-foreground",children:"操作"})]})}),f.jsx("tbody",{children:O.nodes.map(I=>f.jsxs("tr",{className:"border-b border-muted last:border-0",children:[f.jsx("td",{className:"px-3 py-2 font-mono text-xs text-muted-foreground",children:I.id}),f.jsx("td",{className:"px-3 py-2 text-foreground",children:I.label}),f.jsx("td",{className:"px-3 py-2 text-xs text-muted-foreground",children:A(I.phase)}),f.jsx("td",{className:"px-3 py-2 text-xs text-muted-foreground",children:R(I.track)}),f.jsx("td",{className:"px-3 py-2",children:I.skills.length===0?f.jsx("span",{className:"text-xs text-muted-foreground",children:"—"}):f.jsx("span",{className:"text-xs break-all text-muted-foreground",title:I.skills.join(", "),children:I.skills.join(", ")})}),f.jsx("td",{className:"px-3 py-2",children:(I.agents??[]).length===0?f.jsx("span",{className:"text-xs text-muted-foreground",children:"—"}):f.jsx("span",{className:"text-xs break-all text-muted-foreground",title:(I.agents??[]).join(", "),children:(I.agents??[]).join(", ")})}),f.jsx("td",{className:"px-3 py-2",children:f.jsx(Te,{type:"button",variant:"outline",size:"sm",disabled:q||i.isPending,onClick:()=>k.selectNode(I.id),children:"编辑"})})]},I.id))})]})})}),f.jsx(Oi,{title:`边(${O.edges.length})`,children:O.edges.length===0?f.jsx(Vh,{message:"无连线"}):f.jsx("div",{className:"overflow-x-auto",children:f.jsxs("table",{className:"w-full text-left text-sm",children:[f.jsx("thead",{className:"border-b border-border",children:f.jsxs("tr",{children:[f.jsx("th",{scope:"col",className:"px-3 py-2 text-xs font-medium text-muted-foreground",children:"From"}),f.jsx("th",{scope:"col",className:"px-3 py-2 text-xs font-medium text-muted-foreground",children:"To"}),f.jsx("th",{scope:"col",className:"px-3 py-2 text-xs font-medium text-muted-foreground",children:"条件"}),f.jsx("th",{scope:"col",className:"px-3 py-2 text-xs font-medium text-muted-foreground",children:"暂停点"}),f.jsx("th",{scope:"col",className:"px-3 py-2 text-xs font-medium text-muted-foreground",children:"操作"})]})}),f.jsx("tbody",{children:O.edges.map(I=>f.jsxs("tr",{className:"border-b border-muted last:border-0",children:[f.jsx("td",{className:"px-3 py-2 font-mono text-xs text-muted-foreground",children:I.from}),f.jsx("td",{className:"px-3 py-2 font-mono text-xs text-muted-foreground",children:I.to}),f.jsx("td",{className:"px-3 py-2 text-xs text-muted-foreground",children:I.condition??"—"}),f.jsx("td",{className:"px-3 py-2 text-xs text-muted-foreground",children:I.pausePoint?`${T(I.pausePoint.type)}:${I.pausePoint.description}`:"—"}),f.jsx("td",{className:"px-3 py-2 text-xs",children:f.jsx(yn,{to:`/dag/templates/${O.id}`,className:"text-primary hover:underline",children:"编辑"})})]},`${I.from}->${I.to}`))})]})})})]}),f.jsx(H$,{node:k.selectedNode,open:k.selectedNode!==null,onOpenChange:I=>{I||k.clearSelection()},onChange:I=>k.patchNode(I),onDelete:()=>k.deleteNode(),onRename:I=>{k.renameNode(I)?We.success(`已重命名为 ${I}(连线与暂停点已级联更新,保存后生效)`):We.error(`节点 id「${I}」已存在`)}}),f.jsx(gi,{open:s,onOpenChange:c,title:"删除模板",description:`确定删除模板「${O.name}」?该操作不可恢复。`,confirmText:"删除",destructive:!0,loading:o.isPending,onConfirm:P}),f.jsx(d$,{open:v,onOpenChange:S,templateId:e,templateName:O.name})]})}function QSe({open:e,onOpenChange:t,template:n,projects:r,defaultTargetId:o,onCopied:i}){const[s,c]=b.useState(""),[d,u]=b.useState(o),p=obe();b.useEffect(()=>{e&&n&&(c(`${n.name} 副本`),u(o))},[e,n,o]);const m=r.find(S=>S.id===d),g=s.trim().length>=1&&s.trim().length<=50,y=g&&d!==""&&!p.isPending,v=()=>{!n||!y||p.mutateAsync({id:n.id,input:{newName:s.trim(),targetProjectId:d}}).then(S=>{i({id:S.id,name:S.name}),t(!1)}).catch(S=>{We.error(ft(S))})};return f.jsx(jo,{open:e,onOpenChange:t,children:f.jsxs(Ro,{className:"sm:max-w-sm",children:[f.jsxs(_o,{children:[f.jsx(No,{children:"复制模板"}),f.jsx(To,{children:n?`将「${n.name}」复制到目标项目,副本为全新独立模板。`:""})]}),f.jsxs("div",{className:"space-y-4",children:[f.jsxs("div",{className:"space-y-2",children:[f.jsx(jr,{htmlFor:"copy-target-project",children:"目标项目"}),f.jsxs(pr,{value:d,onValueChange:S=>{S!==null&&u(S)},children:[f.jsx(mr,{id:"copy-target-project","aria-label":"目标项目",className:"w-full",children:m?m.name:"选择项目"}),f.jsx(gr,{children:r.map(S=>f.jsx(Un,{value:S.id,children:S.name},S.id))})]})]}),f.jsxs("div",{className:"space-y-2",children:[f.jsx(jr,{htmlFor:"copy-template-name",children:"新模板名称"}),f.jsx(Lt,{id:"copy-template-name",value:s,placeholder:"如:发布流程模板 副本",maxLength:50,"aria-invalid":e&&!g,onChange:S=>c(S.target.value),onKeyDown:S=>{S.key==="Enter"&&v()}}),e&&s.trim().length===0&&f.jsx("p",{className:"text-xs text-destructive",children:"请输入新模板名称"}),e&&s.trim().length>50&&f.jsx("p",{className:"text-xs text-destructive",children:"名称不能超过 50 个字符"})]})]}),f.jsxs($i,{children:[f.jsx(id,{render:f.jsx(Te,{variant:"outline"}),disabled:p.isPending,children:"取消"}),f.jsx(Te,{type:"button",disabled:!y,onClick:v,children:p.isPending?"复制中…":"复制"})]})]})})}function Dl(e){return`${e.kind}::${e.scope??""}::${e.name}`}const X$={skill:"技能",agent:"代理",modelAlias:"模型映射"},WSe={create:"新建",identical:"相同",conflict:"有冲突"},JSe={global:"全局",project:"项目"},C2={created:"已新建",updated:"已覆盖",skipped:"已跳过",identical:"相同(无变更)",failed:"失败"},eEe={create:"bg-info/10 text-info",identical:"bg-success/10 text-success",conflict:"bg-warning/10 text-warning"},tEe={created:"bg-info/10 text-info",updated:"bg-warning/10 text-warning",skipped:"bg-muted text-muted-foreground",identical:"bg-success/10 text-success",failed:"bg-destructive/10 text-destructive"};function nEe(e,t){return e.kind==="modelAlias"?{kind:"modelAlias",name:e.name,action:t}:{kind:e.kind,name:e.name,scope:e.scope??"global",action:t}}function rEe({open:e,onOpenChange:t,projectId:n,onImported:r}){const[o,i]=b.useState("file"),[s,c]=b.useState(null),[d,u]=b.useState(null),[p,m]=b.useState({}),g=tbe(),y=nbe(),v=Vn("scope"),S=M=>v.find(T=>T.value===M)?.label??JSe[M]??M;b.useEffect(()=>{e||(i("file"),c(null),u(null),m({}),g.reset(),y.reset())},[e]);const w=g.data,E=b.useMemo(()=>(w?.dependencies??[]).filter(M=>M.status==="conflict"),[w]),k=M=>{u(null),M.text().then(T=>{let O;try{O=JSON.parse(T)}catch{throw new Error("文件不是合法的 JSON——请确认选择的是模板导出文件")}if(typeof O!="object"||O===null||!("template"in O)||!("dependencies"in O)||!("exportFormatVersion"in O))throw new Error("文件缺少 exportFormatVersion/template/dependencies 字段——可能不是模板导出文件");const z=O;c(z),i("plan"),g.mutate({targetProjectId:n,bundle:z})}).catch(T=>{u(T instanceof Error?T.message:String(T))})},j=()=>{i("file"),c(null),g.reset(),y.reset()},N=M=>{const T={};for(const O of E)T[Dl(O)]=M;m(T)},A=b.useMemo(()=>E.filter(M=>p[Dl(M)]!==void 0).map(M=>nEe(M,p[Dl(M)]??"skip")),[E,p]),R=()=>{s&&y.mutate({targetProjectId:n,bundle:s,decisions:A},{onSuccess:M=>{i("result"),M.dependencies.filter(O=>O.action==="failed").length===0&&(We.success(`模板「${M.template.name}」导入成功`),r?.(M))}})};return f.jsx(jo,{open:e,onOpenChange:t,children:f.jsxs(Ro,{className:"sm:max-w-2xl",children:[f.jsxs(_o,{children:[f.jsx(No,{children:"导入模板"}),f.jsxs(To,{children:[o==="file"&&"选择其他环境导出的模板 JSON 文件,导入到当前项目",o==="plan"&&"预检目标项目环境,确认依赖冲突决策后执行导入",o==="result"&&"导入执行结果(失败项可查看错误信息)"]})]}),o==="file"&&f.jsxs("div",{className:"space-y-3",children:[f.jsx(jr,{htmlFor:"import-template-file",children:"模板导出文件(.json)"}),f.jsx("input",{id:"import-template-file",type:"file",accept:"application/json,.json",className:"w-full rounded-md border border-input bg-background px-3 py-2 text-sm text-foreground file:mr-3 file:rounded file:border-0 file:bg-muted file:px-2 file:py-1 file:text-xs file:text-muted-foreground","aria-invalid":d!==null,onChange:M=>{const T=M.target.files?.[0];T&&k(T),M.target.value=""}}),d&&f.jsx("p",{className:"text-xs text-destructive",children:d}),f.jsx("p",{className:"text-xs text-muted-foreground",children:"导入目标为当前项目——跨项目迁移请先在导航中切换目标项目"})]}),o==="plan"&&f.jsxs("div",{className:"space-y-4",children:[g.isPending&&f.jsxs("div",{className:"space-y-2","aria-busy":"true",children:[f.jsx(Za,{className:"h-16 w-full"}),f.jsx(Za,{className:"h-40 w-full"}),f.jsx("p",{className:"text-xs text-muted-foreground",children:"正在预检目标项目环境…"})]}),g.isError&&f.jsxs("div",{className:"space-y-3",children:[f.jsxs("div",{role:"alert",className:"rounded-md border border-destructive/30 bg-destructive/10 p-3 text-sm text-destructive",children:[f.jsx("p",{className:"font-medium",children:"预检失败"}),f.jsx("p",{className:"mt-1 break-all",children:ft(g.error)})]}),f.jsx(Te,{type:"button",variant:"outline",size:"sm",onClick:j,children:"重新选择文件"})]}),y.isError&&f.jsxs("div",{role:"alert",className:"rounded-md border border-destructive/30 bg-destructive/10 p-3 text-sm text-destructive",children:[f.jsx("p",{className:"font-medium",children:"导入失败(目标环境未被修改的部分保持原状,可修正后重试)"}),f.jsx("p",{className:"mt-1 break-all",children:ft(y.error)})]}),w&&f.jsxs(f.Fragment,{children:[f.jsxs("div",{className:"rounded-md border border-border bg-muted/40 p-3 text-sm",children:[f.jsxs("p",{children:[f.jsx("span",{className:"font-medium",children:w.template.name}),w.template.willOverwrite?f.jsxs("span",{className:"text-warning",children:[" ","— 将覆盖同名模板(v",w.template.currentVersion," → v",w.template.importVersion,")"]}):f.jsxs("span",{className:"text-info",children:[" — 将新建模板(v",w.template.importVersion,")"]})]}),w.template.isDefaultRequested&&!w.template.isDefaultEffect&&f.jsx("p",{className:"mt-1 text-xs text-warning",children:"目标项目已有默认模板——导入后该模板 isDefault 降级为 false,不抢占默认位"}),f.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"覆盖时目标资产启停状态保持现值不变,新建资产默认为启用"})]}),f.jsxs("div",{children:[f.jsxs("h3",{className:"mb-2 text-sm font-medium text-foreground",children:["依赖资产(",w.dependencies.length,")"]}),w.dependencies.length===0?f.jsxs("div",{className:"rounded-md border border-dashed border-border p-3 text-center",children:[f.jsx("p",{className:"text-xs text-muted-foreground",children:"该模板无依赖资产(纯模板结构导入)"}),f.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"无冲突决策,可直接点击「确认导入」完成"})]}):f.jsxs("div",{children:[f.jsx("div",{className:"max-h-64 overflow-auto rounded-md border border-border",children:f.jsxs(sd,{children:[f.jsx(ad,{children:f.jsxs(to,{children:[f.jsx($n,{children:"类型"}),f.jsx($n,{children:"名称"}),f.jsx($n,{children:"作用域"}),f.jsx($n,{children:"版本"}),f.jsx($n,{children:"状态"}),f.jsx($n,{children:"影响"}),f.jsx($n,{children:"冲突决策"})]})}),f.jsx(ld,{children:w.dependencies.map(M=>f.jsxs(to,{children:[f.jsx(Zt,{className:"text-xs text-muted-foreground",children:X$[M.kind]??M.kind}),f.jsx(Zt,{className:"max-w-40 truncate font-mono text-xs",title:M.name,children:M.name}),f.jsx(Zt,{className:"text-xs text-muted-foreground",children:M.scope?S(M.scope):"—"}),f.jsx(Zt,{className:"text-xs text-muted-foreground",children:M.status==="identical"?"—":M.currentVersion?`v${M.currentVersion} → v${M.importVersion??"?"}`:M.kind==="modelAlias"?"新建":`v${M.importVersion??"?"}(新建)`}),f.jsx(Zt,{children:f.jsx("span",{className:`rounded px-1.5 py-0.5 text-xs ${eEe[M.status]}`,children:WSe[M.status]})}),f.jsx(Zt,{children:f.jsx("span",{className:"rounded bg-muted px-1.5 py-0.5 text-xs text-muted-foreground",children:S(M.impact)})}),f.jsx(Zt,{children:M.status==="conflict"?f.jsxs("div",{className:"space-y-1",children:[f.jsxs(pr,{value:p[Dl(M)]??"skip",onValueChange:T=>{(T==="overwrite"||T==="skip")&&m(O=>({...O,[Dl(M)]:T}))},children:[f.jsx(mr,{size:"sm",className:"w-24","aria-label":`${M.name} 冲突决策`,children:p[Dl(M)]==="overwrite"?"覆盖":"跳过"}),f.jsxs(gr,{children:[f.jsx(Un,{value:"skip",children:"跳过"}),f.jsx(Un,{value:"overwrite",children:"覆盖"})]})]}),M.changeSummary&&f.jsxs("p",{className:"max-w-40 truncate text-xs text-muted-foreground",title:M.changeSummary,children:["差异:",M.changeSummary]})]}):f.jsx("span",{className:"text-xs text-muted-foreground",children:"—"})})]},Dl(M)))})]})}),f.jsx("p",{className:"mt-1 text-xs text-muted-foreground sm:hidden",children:"← 左右滑动查看全部列(含冲突决策)"})]})]}),w.warnings.length>0&&f.jsx("div",{className:"rounded-md border border-warning/30 bg-warning/10 p-3 text-xs text-warning",children:w.warnings.map((M,T)=>f.jsx("p",{className:"break-all",children:M},T))}),E.length>0&&f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsxs("span",{className:"text-xs text-muted-foreground",children:[E.length," 项冲突,默认全部跳过"]}),f.jsx(Te,{type:"button",variant:"outline",size:"sm",onClick:()=>N("skip"),children:"全部跳过"}),f.jsx(Te,{type:"button",variant:"destructive",size:"sm",onClick:()=>N("overwrite"),children:"全部覆盖"})]})]})]}),o==="result"&&y.data&&f.jsx(oEe,{result:y.data}),f.jsxs($i,{children:[o==="plan"&&w&&!g.isPending&&f.jsxs(f.Fragment,{children:[f.jsx(Te,{type:"button",variant:"outline",onClick:j,disabled:y.isPending,children:"重新选择文件"}),f.jsx(Te,{type:"button",onClick:R,disabled:y.isPending||n.length===0,children:y.isPending?"导入中…":"确认导入"})]}),o==="result"&&f.jsx(Te,{type:"button",variant:"outline",onClick:()=>t(!1),children:"关闭"})]})]})})}function oEe({result:e}){const t=b.useMemo(()=>{const r={};for(const o of e.dependencies)r[o.action]=(r[o.action]??0)+1;return r},[e.dependencies]),n=["created","updated","skipped","identical","failed"].filter(r=>t[r]).map(r=>`${C2[r]} ${t[r]}`).join(",");return f.jsxs("div",{className:"space-y-3",children:[f.jsxs("div",{className:`rounded-md border p-3 text-sm ${t.failed?"border-destructive/30 bg-destructive/10 text-destructive":"border-success/30 bg-success/10 text-success"}`,role:"status",children:[f.jsxs("p",{className:"font-medium",children:["模板「",e.template.name,"」",e.template.action==="created"?"已新建":"已覆盖",!e.template.isDefaultEffect&&"(默认位未抢占)"]}),e.dependencies.length>0&&f.jsxs("p",{className:"mt-1 text-xs",children:["依赖资产:",n]})]}),e.dependencies.length>0&&f.jsx("div",{className:"max-h-56 overflow-auto rounded-md border border-border",children:f.jsxs(sd,{children:[f.jsx(ad,{children:f.jsxs(to,{children:[f.jsx($n,{children:"类型"}),f.jsx($n,{children:"名称"}),f.jsx($n,{children:"结果"}),f.jsx($n,{children:"错误信息"})]})}),f.jsx(ld,{children:e.dependencies.map(r=>f.jsxs(to,{children:[f.jsx(Zt,{className:"text-xs text-muted-foreground",children:X$[r.kind]??r.kind}),f.jsx(Zt,{className:"max-w-40 truncate font-mono text-xs",title:r.name,children:r.name}),f.jsx(Zt,{children:f.jsx("span",{className:`rounded px-1.5 py-0.5 text-xs ${tEe[r.action]}`,children:C2[r.action]})}),f.jsx(Zt,{className:"max-w-52",children:r.message?f.jsx("span",{className:"block truncate text-xs text-destructive",title:r.message,children:r.message}):f.jsx("span",{className:"text-xs text-muted-foreground",children:"—"})})]},`${r.kind}:${r.scope??""}:${r.name}`))})]})})]})}const uu=mc();function iEe({templates:e,deletingId:t,togglingKey:n,onDelete:r,onCopy:o,onToggleEnabled:i,frozen:s=!1}){const c=b.useMemo(()=>[uu.accessor("name",{id:"name",header:"名称",cell:d=>f.jsxs("span",{className:"flex items-center gap-2 whitespace-nowrap",children:[f.jsx(yn,{to:`/templates/${d.row.original.id}`,className:"font-medium text-foreground hover:text-muted-foreground",children:d.getValue()}),d.row.original.isDefault&&f.jsx("span",{className:"rounded bg-foreground px-1.5 py-0.5 text-xs text-background",children:"默认"})]})}),gx(),uu.accessor("description",{id:"description",header:"描述",cell:d=>f.jsx(px,{text:d.getValue()})}),uu.accessor("nodes",{id:"nodeCount",header:"节点数",cell:d=>f.jsx("span",{className:"whitespace-nowrap text-foreground",children:d.getValue().length})}),uu.accessor(d=>d.edges.filter(u=>u.pausePoint).length,{id:"pausePointCount",header:"暂停点",cell:d=>f.jsx("span",{className:"whitespace-nowrap text-foreground",children:d.getValue()})}),uu.accessor("version",{id:"version",header:"版本",cell:d=>f.jsx("span",{className:"whitespace-nowrap font-mono text-xs text-muted-foreground",children:d.getValue()})}),uu.display({id:"actions",header:"操作",cell:({row:d})=>f.jsxs("div",{className:"flex gap-2 whitespace-nowrap",children:[f.jsx(Te,{render:f.jsx(yn,{to:`/templates/${d.original.id}`}),nativeButton:!1,variant:"outline",size:"sm",children:"查看"}),f.jsx(Te,{type:"button",variant:"outline",size:"sm",onClick:()=>o(d.original.id,d.original.name),children:"复制"}),f.jsx(mx,{enabled:d.original.enabled,disabled:s||n===d.original.id,onClick:()=>i(d.original.id,d.original.name,d.original.enabled===!1)}),f.jsx(Te,{type:"button",variant:"outline",size:"sm",disabled:t===d.original.id||s,onClick:()=>r(d.original.id,d.original.name),children:"删除"})]})})],[t,n,r,o,i,s]);return f.jsx(yc,{columns:c,data:e})}const sEe=e=>e.id;function aEe(){Ir();const{activeProjectId:e,activeProjects:t,projects:n,bootstrapReady:r,bootstrapError:o,retryBootstrap:i}=Kr(),{overrideProjectId:s,scopedProject:c,exitScope:d}=Gh(n),u=c?.status==="archived",p=s||e,m=s$(p,r,{includeDisabled:!0}),g=ko(),y=rbe(e),[v,S]=b.useState(!1),w=l$(),E=ebe(),[k,j]=b.useState("all"),{toggle:N,togglingKey:A}=vx({mutation:E,assetLabel:"模板",keyOf:sEe}),[R,M]=b.useState(null),[T,O]=b.useState(null),[z,q]=b.useState(!1),$=b.useMemo(()=>yx(m.data??[],k),[m.data,k]),G=()=>{if(!R)return;const{id:Y,name:Z}=R;w.mutateAsync(Y).then(()=>{We.success(`模板「${Z}」已删除`),M(null)}).catch(D=>{We.error(ft(D)),M(null)})},L=b.useCallback((Y,Z)=>M({id:Y,name:Z}),[]),F=b.useCallback((Y,Z)=>O({id:Y,name:Z}),[]),P=b.useCallback((Y,Z,D)=>N({id:Y,enabled:D},{name:Z}),[N]),I=m.data??[];return f.jsxs("div",{className:"mx-auto w-full max-w-5xl px-4 py-6",children:[f.jsxs("div",{className:"mb-5 flex flex-wrap items-end justify-between gap-3",children:[f.jsxs("div",{children:[f.jsx("h1",{className:"text-xl font-bold text-foreground",children:"DAG 模板"}),f.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"任务编排模板(可视化编辑请打开编辑器)"})]}),f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx(Te,{type:"button",variant:"outline",disabled:!r||u,onClick:()=>q(!0),children:"导入模板"}),f.jsx(Te,{type:"button",disabled:!r||u,onClick:()=>S(!0),children:"+ 新建空白模板"})]})]}),c&&f.jsx(Kh,{project:c,onExit:d}),r&&I.length>0&&f.jsx("div",{className:"mb-3",children:f.jsx(xx,{value:k,onChange:j})}),o?f.jsx(kn,{message:ft(o),onRetry:i}):!r||m.isLoading?f.jsx(Kn,{rows:3,cols:7}):m.isError?f.jsx(kn,{message:ft(m.error),onRetry:()=>{m.refetch()}}):I.length===0?u?f.jsx(Dn,{message:"该项目暂无模板"}):f.jsx(Dn,{message:"当前项目暂无模板,可新建空白模板、复制其他项目的模板或运行 seed 脚本初始化",actionLabel:"新建空白模板",onAction:()=>S(!0)}):$.length===0?f.jsx(Dn,{message:"当前筛选状态下没有模板,试试切换状态筛选"}):f.jsx(iEe,{templates:$,deletingId:w.isPending?w.variables:null,togglingKey:A,frozen:u,onDelete:L,onCopy:F,onToggleEnabled:P}),f.jsx(ek,{open:v,onOpenChange:S,title:"新建空白模板",label:"模板名称",placeholder:"如:发布流程模板",loading:y.isPending,onSubmit:Y=>{y.mutateAsync(Y.trim()).then(Z=>{We.success(`模板「${Z.name}」已创建`),S(!1),g(`/dag/templates/${Z.id}`)}).catch(Z=>We.error(ft(Z)))}}),f.jsx(gi,{open:R!==null,onOpenChange:Y=>{Y||M(null)},title:"删除模板",description:R?`确定删除模板「${R.name}」?该操作不可恢复。`:void 0,confirmText:"删除",destructive:!0,loading:w.isPending,onConfirm:G}),f.jsx(QSe,{open:T!==null,onOpenChange:Y=>{Y||O(null)},template:T,projects:t,defaultTargetId:e,onCopied:Y=>{We.success(`模板「${Y.name}」已复制`),g(`/dag/templates/${Y.id}`)}}),f.jsx(rEe,{open:z,onOpenChange:q,projectId:p,onImported:Y=>{Y.dependencies.every(Z=>Z.action!=="failed")&&g(`/templates/${Y.template.id}`)}})]})}const lEe=Li({currentPassword:zt().min(1,"请输入当前密码"),newPassword:zt().min(8,"新密码至少 8 个字符").max(128,"新密码最多 128 个字符"),confirmPassword:zt().min(1,"请再次输入新密码")}).refine(e=>e.newPassword===e.confirmPassword,{path:["confirmPassword"],message:"两次输入的新密码不一致"}),k2={currentPassword:"",newPassword:"",confirmPassword:""};function cEe(){Ir();const e=Mh(),t=Jt(),n=ko(),{projects:r,bootstrapReady:o,bootstrapError:i,retryBootstrap:s}=Kr(),c=_r({queryKey:["auth","tokens","admin"],queryFn:W9,enabled:e.mode==="auth"}),d=_r({queryKey:["auth","tokens","project"],queryFn:eq,enabled:e.mode==="auth"}),[u,p]=b.useState(null),[m,g]=b.useState(null),[y,v]=b.useState(!1),S=on({mutationFn:R=>R.kind==="admin"?J9():tq(R.project.id),onSuccess:R=>{t.invalidateQueries({queryKey:["auth","tokens"]}),p(null),g(R)},onError:R=>We.error(ft(R))}),w=ra({resolver:oa(lEe),defaultValues:k2}),{isSubmitting:E}=w.formState,k=async R=>{try{await Q9({currentPassword:R.currentPassword,newPassword:R.newPassword}),We.success("密码已修改(已签发 Token 不受影响)"),w.reset(k2)}catch(M){We.error(ft(M))}},j=R=>{navigator.clipboard.writeText(R).then(()=>We.success("已复制到剪贴板")).catch(()=>We.error("复制失败,请手动选择复制"))};if(e.mode==="open")return f.jsxs("div",{className:"mx-auto w-full max-w-5xl px-4 py-6",children:[f.jsx("h1",{className:"text-xl font-bold text-foreground",children:"Token 管理"}),f.jsx("div",{className:"mt-5",children:f.jsx(Dn,{message:"当前鉴权未开启(本地开发形态),无需管理 Token;开启鉴权后此处可签发管理员/项目 Token"})})]});const N=new Map((d.data?.items??[]).map(R=>[R.projectId,R])),A=(R,M)=>R?f.jsxs(Vt,{variant:"secondary",children:["已签发",M?` · ${xc(M)}`:""]}):f.jsx(Vt,{variant:"outline",children:"未签发"});return f.jsxs("div",{className:"mx-auto w-full max-w-5xl px-4 py-6",children:[f.jsxs("div",{className:"mb-5",children:[f.jsx("h1",{className:"text-xl font-bold text-foreground",children:"Token 管理"}),f.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Token 供 CLI/MCP 访问使用;明文仅在生成时展示一次,请立即保存到本地配置(.siming/dev.json)"})]}),f.jsxs(Oi,{title:"管理员 Token",children:[f.jsx("p",{className:"mb-3 text-xs text-muted-foreground",children:"权限与 Web 登录等同(全部项目全部内容读写);前缀 admin-"}),c.isLoading?f.jsx($h,{}):c.isError?f.jsx(kn,{message:ft(c.error),onRetry:()=>{c.refetch()}}):f.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[f.jsx("div",{className:"text-sm",children:A(c.data?.hasToken??!1,c.data?.createdAt??null)}),f.jsx(Te,{type:"button",variant:c.data?.hasToken?"outline":"default",onClick:()=>p({kind:"admin"}),children:c.data?.hasToken?"重新生成":"生成 Token"})]})]}),f.jsx("div",{className:"mt-5",children:f.jsxs(Oi,{title:"项目 Token",children:[f.jsx("p",{className:"mb-3 text-xs text-muted-foreground",children:"每个项目一枚(重新生成即重置);仅能访问所属项目,全局资产只读;前缀 project-"}),d.isLoading?f.jsx(Kn,{rows:3,cols:4}):i?f.jsx(kn,{message:"项目列表加载失败",onRetry:s}):d.isError?f.jsx(kn,{message:ft(d.error),onRetry:()=>{d.refetch()}}):!o||r.length===0?f.jsx(Dn,{message:"暂无项目;创建项目后此处可为各项目签发 Token",actionLabel:"前往项目管理",onAction:()=>n("/projects")}):f.jsxs(sd,{children:[f.jsx(ad,{children:f.jsxs(to,{children:[f.jsx($n,{children:"项目"}),f.jsx($n,{children:"标识"}),f.jsx($n,{children:"状态"}),f.jsx($n,{className:"text-right",children:"操作"})]})}),f.jsx(ld,{children:r.map(R=>{const M=N.get(R.id),T=R.status==="archived";return f.jsxs(to,{children:[f.jsx(Zt,{className:"text-sm font-medium",children:R.name}),f.jsx(Zt,{children:f.jsx("span",{className:"font-mono text-xs text-muted-foreground",title:R.key,children:R.key})}),f.jsx(Zt,{children:T?f.jsx(Vt,{variant:"outline",children:"已停用"}):A(M?.hasToken??!1,M?.createdAt??null)}),f.jsx(Zt,{className:"text-right",children:f.jsx(Te,{type:"button",variant:"outline",size:"sm",disabled:T,title:T?"已停用项目冻结写操作,恢复启用后可签发 Token":void 0,onClick:()=>p({kind:"project",project:R}),children:M?.hasToken?"重新生成":"生成 Token"})})]},R.id)})})]})]})}),f.jsx("div",{className:"mt-5",children:f.jsxs(Oi,{title:"修改密码",children:[f.jsx("p",{className:"mb-3 text-xs text-muted-foreground",children:"修改密码不影响已签发 Token(Token 独立生命周期)"}),f.jsx(ia,{...w,children:f.jsxs("form",{onSubmit:w.handleSubmit(k),className:"max-w-md space-y-4",noValidate:!0,children:[f.jsx(Ot,{control:w.control,name:"currentPassword",render:({field:R})=>f.jsxs(Dt,{children:[f.jsx(Pt,{children:"当前密码"}),f.jsx(_t,{children:f.jsx(Lt,{...R,type:"password",autoComplete:"current-password",disabled:E})}),f.jsx(It,{})]})}),f.jsx(Ot,{control:w.control,name:"newPassword",render:({field:R})=>f.jsxs(Dt,{children:[f.jsx(Pt,{children:"新密码"}),f.jsx(_t,{children:f.jsx(Lt,{...R,type:"password",autoComplete:"new-password",placeholder:"至少 8 个字符",disabled:E})}),f.jsx(It,{})]})}),f.jsx(Ot,{control:w.control,name:"confirmPassword",render:({field:R})=>f.jsxs(Dt,{children:[f.jsx(Pt,{children:"确认新密码"}),f.jsx(_t,{children:f.jsx(Lt,{...R,type:"password",autoComplete:"new-password",disabled:E})}),f.jsx(It,{})]})}),f.jsx(Te,{type:"submit",disabled:E,children:E?"保存中…":"修改密码"})]})})]})}),f.jsx(gi,{open:u!==null,onOpenChange:R=>{!R&&!S.isPending&&p(null)},title:u?.kind==="admin"?"生成管理员 Token":`生成项目 Token · ${u?.kind==="project"?u.project.name:""}`,description:u?.kind==="admin"?c.data?.hasToken??!1?"将重新生成管理员 Token,旧 Token 立即失效(使用旧 Token 的 CLI/MCP 将 401)。确定继续?":"生成后明文仅展示一次,请保存到使用方本地配置。确定继续?":u?.kind==="project"&&(N.get(u.project.id)?.hasToken??!1)?"将重新生成该项目 Token,旧 Token 立即失效(使用旧 Token 的 CLI/MCP 将 401)。确定继续?":"生成后明文仅展示一次,请保存到使用方本地配置。确定继续?",confirmText:S.isPending?"生成中…":"确认生成",loading:S.isPending,onConfirm:()=>u&&S.mutate(u)}),f.jsx(jo,{open:m!==null,onOpenChange:R=>{!R&&m!==null&&v(!0)},children:f.jsxs(Ro,{className:"sm:max-w-lg",children:[f.jsxs(_o,{children:[f.jsx(No,{children:"Token 已生成"}),f.jsxs(To,{children:[f.jsx("span",{className:"font-medium text-destructive",children:"仅展示一次,关闭后不可再查看"}),"——请立即复制并保存到使用方的 .siming/dev.json(authToken 字段)"]})]}),f.jsx("pre",{className:"overflow-x-auto rounded-md border border-border bg-muted p-3 font-mono text-xs break-all whitespace-pre-wrap select-all",children:m?.token}),f.jsx($i,{children:f.jsx(Te,{type:"button",onClick:()=>m&&j(m.token),children:"一键复制"})})]})}),f.jsx(gi,{open:y,onOpenChange:v,title:"确认已保存 Token?",description:"关闭后将无法再次查看该 Token 明文。若尚未复制保存,请返回复制。",confirmText:"已保存,关闭",onConfirm:()=>{v(!1),g(null),S.reset()}})]})}const uEe=new LB({defaultOptions:{queries:{retry:(e,t)=>t instanceof Dy&&t.status>=400&&t.status<500?!1:e<3}}}),dr={dashboard:{title:"看板 · 司命",description:"任务统计与活跃任务总览"},dagEditor:{title:"DAG 编辑器 · 司命",description:"DAG 模板可视化编辑与实例查看"},skills:{title:"技能库 · 司命",description:"Skill 元数据管理"},agents:{title:"代理库 · 司命",description:"Agent 配置与绑定管理"},nodePresets:{title:"节点库 · 司命",description:"通用 DAG 节点资产管理(code 全局唯一)"},nodePresetEdit:{title:"编辑节点 · 司命",description:"通用 DAG 节点资产编辑"},tasks:{title:"任务列表 · 司命",description:"全部任务与状态总览"},taskDetail:{title:"任务详情 · 司命",description:"任务详情与流转操作"},templates:{title:"模板列表 · 司命",description:"DAG 流程模板管理"},templateDetail:{title:"模板详情 · 司命",description:"DAG 模板拓扑只读查看"},projects:{title:"项目管理 · 司命",description:"项目维度与资产归属管理"},skillEdit:{title:"编辑技能 · 司命",description:"技能元数据与提示词内容编辑"},agentEdit:{title:"编辑代理 · 司命",description:"代理配置与技能绑定管理"},modelAliases:{title:"模型映射 · 司命",description:"Agent 模型映射与引用管理"},settingsEnums:{title:"枚举管理 · 司命",description:"全站下拉选项统一数据源(枚举注册表)"},login:{title:"登录 · 司命",description:"管理员账号密码登录"},setup:{title:"初始化 · 司命",description:"首次开启鉴权创建管理员账号"},settingsTokens:{title:"Token 管理 · 司命",description:"管理员/项目 Token 签发与密码修改"}};function dEe(){return f.jsxs(kK,{children:[f.jsx(EK,{}),f.jsx(xE,{})]})}const fEe=c6([{element:f.jsx(oq,{}),children:[{element:f.jsx(CK,{}),children:[{path:"/login",element:f.jsx(iSe,{}),handle:{meta:dr.login}},{path:"/setup",element:f.jsx(kSe,{}),handle:{meta:dr.setup}}]},{element:f.jsx(dEe,{}),children:[{path:"/",element:f.jsx(nSe,{}),handle:{meta:dr.dashboard}},{path:"/tasks",element:f.jsx(KSe,{}),handle:{meta:dr.tasks}},{path:"/tasks/:taskId",element:f.jsx(YSe,{}),handle:{meta:dr.taskDetail}},{path:"/templates",element:f.jsx(aEe,{}),handle:{meta:dr.templates}},{path:"/templates/:id",element:f.jsx(XSe,{}),handle:{meta:dr.templateDetail}},{path:"/dag/templates/:id",element:f.jsx(Wwe,{}),handle:{meta:dr.dagEditor}},{path:"/skills",element:f.jsx(ASe,{}),handle:{meta:dr.skills}},{path:"/skills/new",element:f.jsx(S2,{}),handle:{meta:dr.skillEdit}},{path:"/skills/:name/edit",element:f.jsx(S2,{}),handle:{meta:dr.skillEdit}},{path:"/agents",element:f.jsx(OW,{}),handle:{meta:dr.agents}},{path:"/agents/new",element:f.jsx(VA,{}),handle:{meta:dr.agentEdit}},{path:"/agents/:name/edit",element:f.jsx(VA,{}),handle:{meta:dr.agentEdit}},{path:"/nodes",element:f.jsx(ySe,{}),handle:{meta:dr.nodePresets}},{path:"/nodes/new",element:f.jsx(v2,{}),handle:{meta:dr.nodePresetEdit}},{path:"/nodes/:code/edit",element:f.jsx(v2,{}),handle:{meta:dr.nodePresetEdit}},{path:"/projects",element:f.jsx(SSe,{}),handle:{meta:dr.projects}},{path:"/settings/models",element:f.jsx(aSe,{}),handle:{meta:dr.modelAliases}},{path:"/settings/enums",element:f.jsx(cSe,{}),handle:{meta:dr.settingsEnums}},{path:"/settings/tokens",element:f.jsx(cEe,{}),handle:{meta:dr.settingsTokens}}]}]}]);function hEe(){return f.jsx(FB,{client:uEe,children:f.jsx(nq,{children:f.jsx(w6,{router:fEe})})})}const Q$=document.getElementById("root");if(!Q$)throw new Error("#root not found");fB.createRoot(Q$).render(f.jsx(b.StrictMode,{children:f.jsx(hEe,{})}));