@whispering233/ai-editor-server 0.0.5 → 0.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/client-dist/assets/index-CAmSH6A0.js +14 -0
- package/client-dist/index.html +1 -1
- package/dist/backup.d.ts +142 -0
- package/dist/backup.d.ts.map +1 -0
- package/dist/backup.js +629 -0
- package/dist/backup.js.map +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/middleware/project.d.ts +6 -1
- package/dist/middleware/project.d.ts.map +1 -1
- package/dist/middleware/project.js +16 -2
- package/dist/middleware/project.js.map +1 -1
- package/dist/routes/project.d.ts.map +1 -1
- package/dist/routes/project.js +209 -191
- package/dist/routes/project.js.map +1 -1
- package/package.json +7 -6
- package/client-dist/assets/index-D3Qif2tG.js +0 -14
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
function SN(n,o){for(var r=0;r<o.length;r++){const l=o[r];if(typeof l!="string"&&!Array.isArray(l)){for(const c in l)if(c!=="default"&&!(c in n)){const d=Object.getOwnPropertyDescriptor(l,c);d&&Object.defineProperty(n,c,d.get?d:{enumerable:!0,get:()=>l[c]})}}}return Object.freeze(Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}))}(function(){const o=document.createElement("link").relList;if(o&&o.supports&&o.supports("modulepreload"))return;for(const c of document.querySelectorAll('link[rel="modulepreload"]'))l(c);new MutationObserver(c=>{for(const d of c)if(d.type==="childList")for(const m of d.addedNodes)m.tagName==="LINK"&&m.rel==="modulepreload"&&l(m)}).observe(document,{childList:!0,subtree:!0});function r(c){const d={};return c.integrity&&(d.integrity=c.integrity),c.referrerPolicy&&(d.referrerPolicy=c.referrerPolicy),c.crossOrigin==="use-credentials"?d.credentials="include":c.crossOrigin==="anonymous"?d.credentials="omit":d.credentials="same-origin",d}function l(c){if(c.ep)return;c.ep=!0;const d=r(c);fetch(c.href,d)}})();function yv(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var hf={exports:{}},yl={};var Eb;function EN(){if(Eb)return yl;Eb=1;var n=Symbol.for("react.transitional.element"),o=Symbol.for("react.fragment");function r(l,c,d){var m=null;if(d!==void 0&&(m=""+d),c.key!==void 0&&(m=""+c.key),"key"in c){d={};for(var g in c)g!=="key"&&(d[g]=c[g])}else d=c;return c=d.ref,{$$typeof:n,type:l,key:m,ref:c!==void 0?c:null,props:d}}return yl.Fragment=o,yl.jsx=r,yl.jsxs=r,yl}var Nb;function NN(){return Nb||(Nb=1,hf.exports=EN()),hf.exports}var i=NN(),gf={exports:{}},ot={};var jb;function jN(){if(jb)return ot;jb=1;var n=Symbol.for("react.transitional.element"),o=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),l=Symbol.for("react.strict_mode"),c=Symbol.for("react.profiler"),d=Symbol.for("react.consumer"),m=Symbol.for("react.context"),g=Symbol.for("react.forward_ref"),b=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),v=Symbol.for("react.lazy"),x=Symbol.for("react.activity"),S=Symbol.iterator;function j(D){return D===null||typeof D!="object"?null:(D=S&&D[S]||D["@@iterator"],typeof D=="function"?D:null)}var N={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},k=Object.assign,O={};function E(D,G,L){this.props=D,this.context=G,this.refs=O,this.updater=L||N}E.prototype.isReactComponent={},E.prototype.setState=function(D,G){if(typeof D!="object"&&typeof D!="function"&&D!=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,D,G,"setState")},E.prototype.forceUpdate=function(D){this.updater.enqueueForceUpdate(this,D,"forceUpdate")};function T(){}T.prototype=E.prototype;function _(D,G,L){this.props=D,this.context=G,this.refs=O,this.updater=L||N}var R=_.prototype=new T;R.constructor=_,k(R,E.prototype),R.isPureReactComponent=!0;var H=Array.isArray;function A(){}var B={H:null,A:null,T:null,S:null},M=Object.prototype.hasOwnProperty;function Q(D,G,L){var q=L.ref;return{$$typeof:n,type:D,key:G,ref:q!==void 0?q:null,props:L}}function ne(D,G){return Q(D.type,G,D.props)}function me(D){return typeof D=="object"&&D!==null&&D.$$typeof===n}function se(D){var G={"=":"=0",":":"=2"};return"$"+D.replace(/[=:]/g,function(L){return G[L]})}var X=/\/+/g;function te(D,G){return typeof D=="object"&&D!==null&&D.key!=null?se(""+D.key):G.toString(36)}function $(D){switch(D.status){case"fulfilled":return D.value;case"rejected":throw D.reason;default:switch(typeof D.status=="string"?D.then(A,A):(D.status="pending",D.then(function(G){D.status==="pending"&&(D.status="fulfilled",D.value=G)},function(G){D.status==="pending"&&(D.status="rejected",D.reason=G)})),D.status){case"fulfilled":return D.value;case"rejected":throw D.reason}}throw D}function w(D,G,L,q,Z){var V=typeof D;(V==="undefined"||V==="boolean")&&(D=null);var be=!1;if(D===null)be=!0;else switch(V){case"bigint":case"string":case"number":be=!0;break;case"object":switch(D.$$typeof){case n:case o:be=!0;break;case v:return be=D._init,w(be(D._payload),G,L,q,Z)}}if(be)return Z=Z(D),be=q===""?"."+te(D,0):q,H(Z)?(L="",be!=null&&(L=be.replace(X,"$&/")+"/"),w(Z,G,L,"",function(Le){return Le})):Z!=null&&(me(Z)&&(Z=ne(Z,L+(Z.key==null||D&&D.key===Z.key?"":(""+Z.key).replace(X,"$&/")+"/")+be)),G.push(Z)),1;be=0;var ue=q===""?".":q+":";if(H(D))for(var he=0;he<D.length;he++)q=D[he],V=ue+te(q,he),be+=w(q,G,L,V,Z);else if(he=j(D),typeof he=="function")for(D=he.call(D),he=0;!(q=D.next()).done;)q=q.value,V=ue+te(q,he++),be+=w(q,G,L,V,Z);else if(V==="object"){if(typeof D.then=="function")return w($(D),G,L,q,Z);throw G=String(D),Error("Objects are not valid as a React child (found: "+(G==="[object Object]"?"object with keys {"+Object.keys(D).join(", ")+"}":G)+"). If you meant to render a collection of children, use an array instead.")}return be}function U(D,G,L){if(D==null)return D;var q=[],Z=0;return w(D,q,"","",function(V){return G.call(L,V,Z++)}),q}function Y(D){if(D._status===-1){var G=D._result;G=G(),G.then(function(L){(D._status===0||D._status===-1)&&(D._status=1,D._result=L)},function(L){(D._status===0||D._status===-1)&&(D._status=2,D._result=L)}),D._status===-1&&(D._status=0,D._result=G)}if(D._status===1)return D._result.default;throw D._result}var z=typeof reportError=="function"?reportError:function(D){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var G=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof D=="object"&&D!==null&&typeof D.message=="string"?String(D.message):String(D),error:D});if(!window.dispatchEvent(G))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",D);return}console.error(D)},I={map:U,forEach:function(D,G,L){U(D,function(){G.apply(this,arguments)},L)},count:function(D){var G=0;return U(D,function(){G++}),G},toArray:function(D){return U(D,function(G){return G})||[]},only:function(D){if(!me(D))throw Error("React.Children.only expected to receive a single React element child.");return D}};return ot.Activity=x,ot.Children=I,ot.Component=E,ot.Fragment=r,ot.Profiler=c,ot.PureComponent=_,ot.StrictMode=l,ot.Suspense=b,ot.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=B,ot.__COMPILER_RUNTIME={__proto__:null,c:function(D){return B.H.useMemoCache(D)}},ot.cache=function(D){return function(){return D.apply(null,arguments)}},ot.cacheSignal=function(){return null},ot.cloneElement=function(D,G,L){if(D==null)throw Error("The argument must be a React element, but you passed "+D+".");var q=k({},D.props),Z=D.key;if(G!=null)for(V in G.key!==void 0&&(Z=""+G.key),G)!M.call(G,V)||V==="key"||V==="__self"||V==="__source"||V==="ref"&&G.ref===void 0||(q[V]=G[V]);var V=arguments.length-2;if(V===1)q.children=L;else if(1<V){for(var be=Array(V),ue=0;ue<V;ue++)be[ue]=arguments[ue+2];q.children=be}return Q(D.type,Z,q)},ot.createContext=function(D){return D={$$typeof:m,_currentValue:D,_currentValue2:D,_threadCount:0,Provider:null,Consumer:null},D.Provider=D,D.Consumer={$$typeof:d,_context:D},D},ot.createElement=function(D,G,L){var q,Z={},V=null;if(G!=null)for(q in G.key!==void 0&&(V=""+G.key),G)M.call(G,q)&&q!=="key"&&q!=="__self"&&q!=="__source"&&(Z[q]=G[q]);var be=arguments.length-2;if(be===1)Z.children=L;else if(1<be){for(var ue=Array(be),he=0;he<be;he++)ue[he]=arguments[he+2];Z.children=ue}if(D&&D.defaultProps)for(q in be=D.defaultProps,be)Z[q]===void 0&&(Z[q]=be[q]);return Q(D,V,Z)},ot.createRef=function(){return{current:null}},ot.forwardRef=function(D){return{$$typeof:g,render:D}},ot.isValidElement=me,ot.lazy=function(D){return{$$typeof:v,_payload:{_status:-1,_result:D},_init:Y}},ot.memo=function(D,G){return{$$typeof:p,type:D,compare:G===void 0?null:G}},ot.startTransition=function(D){var G=B.T,L={};B.T=L;try{var q=D(),Z=B.S;Z!==null&&Z(L,q),typeof q=="object"&&q!==null&&typeof q.then=="function"&&q.then(A,z)}catch(V){z(V)}finally{G!==null&&L.types!==null&&(G.types=L.types),B.T=G}},ot.unstable_useCacheRefresh=function(){return B.H.useCacheRefresh()},ot.use=function(D){return B.H.use(D)},ot.useActionState=function(D,G,L){return B.H.useActionState(D,G,L)},ot.useCallback=function(D,G){return B.H.useCallback(D,G)},ot.useContext=function(D){return B.H.useContext(D)},ot.useDebugValue=function(){},ot.useDeferredValue=function(D,G){return B.H.useDeferredValue(D,G)},ot.useEffect=function(D,G){return B.H.useEffect(D,G)},ot.useEffectEvent=function(D){return B.H.useEffectEvent(D)},ot.useId=function(){return B.H.useId()},ot.useImperativeHandle=function(D,G,L){return B.H.useImperativeHandle(D,G,L)},ot.useInsertionEffect=function(D,G){return B.H.useInsertionEffect(D,G)},ot.useLayoutEffect=function(D,G){return B.H.useLayoutEffect(D,G)},ot.useMemo=function(D,G){return B.H.useMemo(D,G)},ot.useOptimistic=function(D,G){return B.H.useOptimistic(D,G)},ot.useReducer=function(D,G,L){return B.H.useReducer(D,G,L)},ot.useRef=function(D){return B.H.useRef(D)},ot.useState=function(D){return B.H.useState(D)},ot.useSyncExternalStore=function(D,G,L){return B.H.useSyncExternalStore(D,G,L)},ot.useTransition=function(){return B.H.useTransition()},ot.version="19.2.8",ot}var Tb;function Vl(){return Tb||(Tb=1,gf.exports=jN()),gf.exports}var h=Vl();const Re=yv(h),TN=SN({__proto__:null,default:Re},[h]);var xf={exports:{}},vl={},bf={exports:{}},yf={};var wb;function wN(){return wb||(wb=1,(function(n){function o(w,U){var Y=w.length;w.push(U);e:for(;0<Y;){var z=Y-1>>>1,I=w[z];if(0<c(I,U))w[z]=U,w[Y]=I,Y=z;else break e}}function r(w){return w.length===0?null:w[0]}function l(w){if(w.length===0)return null;var U=w[0],Y=w.pop();if(Y!==U){w[0]=Y;e:for(var z=0,I=w.length,D=I>>>1;z<D;){var G=2*(z+1)-1,L=w[G],q=G+1,Z=w[q];if(0>c(L,Y))q<I&&0>c(Z,L)?(w[z]=Z,w[q]=Y,z=q):(w[z]=L,w[G]=Y,z=G);else if(q<I&&0>c(Z,Y))w[z]=Z,w[q]=Y,z=q;else break e}}return U}function c(w,U){var Y=w.sortIndex-U.sortIndex;return Y!==0?Y:w.id-U.id}if(n.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var d=performance;n.unstable_now=function(){return d.now()}}else{var m=Date,g=m.now();n.unstable_now=function(){return m.now()-g}}var b=[],p=[],v=1,x=null,S=3,j=!1,N=!1,k=!1,O=!1,E=typeof setTimeout=="function"?setTimeout:null,T=typeof clearTimeout=="function"?clearTimeout:null,_=typeof setImmediate<"u"?setImmediate:null;function R(w){for(var U=r(p);U!==null;){if(U.callback===null)l(p);else if(U.startTime<=w)l(p),U.sortIndex=U.expirationTime,o(b,U);else break;U=r(p)}}function H(w){if(k=!1,R(w),!N)if(r(b)!==null)N=!0,A||(A=!0,se());else{var U=r(p);U!==null&&$(H,U.startTime-w)}}var A=!1,B=-1,M=5,Q=-1;function ne(){return O?!0:!(n.unstable_now()-Q<M)}function me(){if(O=!1,A){var w=n.unstable_now();Q=w;var U=!0;try{e:{N=!1,k&&(k=!1,T(B),B=-1),j=!0;var Y=S;try{t:{for(R(w),x=r(b);x!==null&&!(x.expirationTime>w&&ne());){var z=x.callback;if(typeof z=="function"){x.callback=null,S=x.priorityLevel;var I=z(x.expirationTime<=w);if(w=n.unstable_now(),typeof I=="function"){x.callback=I,R(w),U=!0;break t}x===r(b)&&l(b),R(w)}else l(b);x=r(b)}if(x!==null)U=!0;else{var D=r(p);D!==null&&$(H,D.startTime-w),U=!1}}break e}finally{x=null,S=Y,j=!1}U=void 0}}finally{U?se():A=!1}}}var se;if(typeof _=="function")se=function(){_(me)};else if(typeof MessageChannel<"u"){var X=new MessageChannel,te=X.port2;X.port1.onmessage=me,se=function(){te.postMessage(null)}}else se=function(){E(me,0)};function $(w,U){B=E(function(){w(n.unstable_now())},U)}n.unstable_IdlePriority=5,n.unstable_ImmediatePriority=1,n.unstable_LowPriority=4,n.unstable_NormalPriority=3,n.unstable_Profiling=null,n.unstable_UserBlockingPriority=2,n.unstable_cancelCallback=function(w){w.callback=null},n.unstable_forceFrameRate=function(w){0>w||125<w?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):M=0<w?Math.floor(1e3/w):5},n.unstable_getCurrentPriorityLevel=function(){return S},n.unstable_next=function(w){switch(S){case 1:case 2:case 3:var U=3;break;default:U=S}var Y=S;S=U;try{return w()}finally{S=Y}},n.unstable_requestPaint=function(){O=!0},n.unstable_runWithPriority=function(w,U){switch(w){case 1:case 2:case 3:case 4:case 5:break;default:w=3}var Y=S;S=w;try{return U()}finally{S=Y}},n.unstable_scheduleCallback=function(w,U,Y){var z=n.unstable_now();switch(typeof Y=="object"&&Y!==null?(Y=Y.delay,Y=typeof Y=="number"&&0<Y?z+Y:z):Y=z,w){case 1:var I=-1;break;case 2:I=250;break;case 5:I=1073741823;break;case 4:I=1e4;break;default:I=5e3}return I=Y+I,w={id:v++,callback:U,priorityLevel:w,startTime:Y,expirationTime:I,sortIndex:-1},Y>z?(w.sortIndex=Y,o(p,w),r(b)===null&&w===r(p)&&(k?(T(B),B=-1):k=!0,$(H,Y-z))):(w.sortIndex=I,o(b,w),N||j||(N=!0,A||(A=!0,se()))),w},n.unstable_shouldYield=ne,n.unstable_wrapCallback=function(w){var U=S;return function(){var Y=S;S=U;try{return w.apply(this,arguments)}finally{S=Y}}}})(yf)),yf}var Cb;function CN(){return Cb||(Cb=1,bf.exports=wN()),bf.exports}var vf={exports:{}},vn={};var Rb;function RN(){if(Rb)return vn;Rb=1;var n=Vl();function o(b){var p="https://react.dev/errors/"+b;if(1<arguments.length){p+="?args[]="+encodeURIComponent(arguments[1]);for(var v=2;v<arguments.length;v++)p+="&args[]="+encodeURIComponent(arguments[v])}return"Minified React error #"+b+"; visit "+p+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function r(){}var l={d:{f:r,r:function(){throw Error(o(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},c=Symbol.for("react.portal");function d(b,p,v){var x=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:c,key:x==null?null:""+x,children:b,containerInfo:p,implementation:v}}var m=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function g(b,p){if(b==="font")return"";if(typeof p=="string")return p==="use-credentials"?p:""}return vn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=l,vn.createPortal=function(b,p){var v=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!p||p.nodeType!==1&&p.nodeType!==9&&p.nodeType!==11)throw Error(o(299));return d(b,p,null,v)},vn.flushSync=function(b){var p=m.T,v=l.p;try{if(m.T=null,l.p=2,b)return b()}finally{m.T=p,l.p=v,l.d.f()}},vn.preconnect=function(b,p){typeof b=="string"&&(p?(p=p.crossOrigin,p=typeof p=="string"?p==="use-credentials"?p:"":void 0):p=null,l.d.C(b,p))},vn.prefetchDNS=function(b){typeof b=="string"&&l.d.D(b)},vn.preinit=function(b,p){if(typeof b=="string"&&p&&typeof p.as=="string"){var v=p.as,x=g(v,p.crossOrigin),S=typeof p.integrity=="string"?p.integrity:void 0,j=typeof p.fetchPriority=="string"?p.fetchPriority:void 0;v==="style"?l.d.S(b,typeof p.precedence=="string"?p.precedence:void 0,{crossOrigin:x,integrity:S,fetchPriority:j}):v==="script"&&l.d.X(b,{crossOrigin:x,integrity:S,fetchPriority:j,nonce:typeof p.nonce=="string"?p.nonce:void 0})}},vn.preinitModule=function(b,p){if(typeof b=="string")if(typeof p=="object"&&p!==null){if(p.as==null||p.as==="script"){var v=g(p.as,p.crossOrigin);l.d.M(b,{crossOrigin:v,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0})}}else p==null&&l.d.M(b)},vn.preload=function(b,p){if(typeof b=="string"&&typeof p=="object"&&p!==null&&typeof p.as=="string"){var v=p.as,x=g(v,p.crossOrigin);l.d.L(b,v,{crossOrigin:x,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0,type:typeof p.type=="string"?p.type:void 0,fetchPriority:typeof p.fetchPriority=="string"?p.fetchPriority:void 0,referrerPolicy:typeof p.referrerPolicy=="string"?p.referrerPolicy:void 0,imageSrcSet:typeof p.imageSrcSet=="string"?p.imageSrcSet:void 0,imageSizes:typeof p.imageSizes=="string"?p.imageSizes:void 0,media:typeof p.media=="string"?p.media:void 0})}},vn.preloadModule=function(b,p){if(typeof b=="string")if(p){var v=g(p.as,p.crossOrigin);l.d.m(b,{as:typeof p.as=="string"&&p.as!=="script"?p.as:void 0,crossOrigin:v,integrity:typeof p.integrity=="string"?p.integrity:void 0})}else l.d.m(b)},vn.requestFormReset=function(b){l.d.r(b)},vn.unstable_batchedUpdates=function(b,p){return b(p)},vn.useFormState=function(b,p,v){return m.H.useFormState(b,p,v)},vn.useFormStatus=function(){return m.H.useHostTransitionStatus()},vn.version="19.2.8",vn}var Ob;function vv(){if(Ob)return vf.exports;Ob=1;function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(o){console.error(o)}}return n(),vf.exports=RN(),vf.exports}var kb;function ON(){if(kb)return vl;kb=1;var n=CN(),o=Vl(),r=vv();function l(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var s=2;s<arguments.length;s++)t+="&args[]="+encodeURIComponent(arguments[s])}return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function c(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function d(e){var t=e,s=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,(t.flags&4098)!==0&&(s=t.return),e=t.return;while(e)}return t.tag===3?s:null}function m(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function g(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function b(e){if(d(e)!==e)throw Error(l(188))}function p(e){var t=e.alternate;if(!t){if(t=d(e),t===null)throw Error(l(188));return t!==e?null:e}for(var s=e,a=t;;){var u=s.return;if(u===null)break;var f=u.alternate;if(f===null){if(a=u.return,a!==null){s=a;continue}break}if(u.child===f.child){for(f=u.child;f;){if(f===s)return b(u),e;if(f===a)return b(u),t;f=f.sibling}throw Error(l(188))}if(s.return!==a.return)s=u,a=f;else{for(var y=!1,C=u.child;C;){if(C===s){y=!0,s=u,a=f;break}if(C===a){y=!0,a=u,s=f;break}C=C.sibling}if(!y){for(C=f.child;C;){if(C===s){y=!0,s=f,a=u;break}if(C===a){y=!0,a=f,s=u;break}C=C.sibling}if(!y)throw Error(l(189))}}if(s.alternate!==a)throw Error(l(190))}if(s.tag!==3)throw Error(l(188));return s.stateNode.current===s?e:t}function v(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=v(e),t!==null)return t;e=e.sibling}return null}var x=Object.assign,S=Symbol.for("react.element"),j=Symbol.for("react.transitional.element"),N=Symbol.for("react.portal"),k=Symbol.for("react.fragment"),O=Symbol.for("react.strict_mode"),E=Symbol.for("react.profiler"),T=Symbol.for("react.consumer"),_=Symbol.for("react.context"),R=Symbol.for("react.forward_ref"),H=Symbol.for("react.suspense"),A=Symbol.for("react.suspense_list"),B=Symbol.for("react.memo"),M=Symbol.for("react.lazy"),Q=Symbol.for("react.activity"),ne=Symbol.for("react.memo_cache_sentinel"),me=Symbol.iterator;function se(e){return e===null||typeof e!="object"?null:(e=me&&e[me]||e["@@iterator"],typeof e=="function"?e:null)}var X=Symbol.for("react.client.reference");function te(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===X?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case k:return"Fragment";case E:return"Profiler";case O:return"StrictMode";case H:return"Suspense";case A:return"SuspenseList";case Q:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case N:return"Portal";case _:return e.displayName||"Context";case T:return(e._context.displayName||"Context")+".Consumer";case R:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case B:return t=e.displayName||null,t!==null?t:te(e.type)||"Memo";case M:t=e._payload,e=e._init;try{return te(e(t))}catch{}}return null}var $=Array.isArray,w=o.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,U=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Y={pending:!1,data:null,method:null,action:null},z=[],I=-1;function D(e){return{current:e}}function G(e){0>I||(e.current=z[I],z[I]=null,I--)}function L(e,t){I++,z[I]=e.current,e.current=t}var q=D(null),Z=D(null),V=D(null),be=D(null);function ue(e,t){switch(L(V,t),L(Z,e),L(q,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?qx(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=qx(t),e=Fx(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}G(q),L(q,e)}function he(){G(q),G(Z),G(V)}function Le(e){e.memoizedState!==null&&L(be,e);var t=q.current,s=Fx(t,e.type);t!==s&&(L(Z,e),L(q,s))}function qe(e){Z.current===e&&(G(q),G(Z)),be.current===e&&(G(be),hl._currentValue=Y)}var we,De;function Ae(e){if(we===void 0)try{throw Error()}catch(s){var t=s.stack.trim().match(/\n( *(at )?)/);we=t&&t[1]||"",De=-1<s.stack.indexOf(`
|
|
2
|
-
at`)?" (<anonymous>)":-1<s.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
3
|
-
`+we+e+De}var ye=!1;function Ie(e,t){if(!e||ye)return"";ye=!0;var s=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var a={DetermineComponentFrameRoot:function(){try{if(t){var Ee=function(){throw Error()};if(Object.defineProperty(Ee.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Ee,[])}catch(fe){var le=fe}Reflect.construct(e,[],Ee)}else{try{Ee.call()}catch(fe){le=fe}e.call(Ee.prototype)}}else{try{throw Error()}catch(fe){le=fe}(Ee=e())&&typeof Ee.catch=="function"&&Ee.catch(function(){})}}catch(fe){if(fe&&le&&typeof fe.stack=="string")return[fe.stack,le.stack]}return[null,null]}};a.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var u=Object.getOwnPropertyDescriptor(a.DetermineComponentFrameRoot,"name");u&&u.configurable&&Object.defineProperty(a.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var f=a.DetermineComponentFrameRoot(),y=f[0],C=f[1];if(y&&C){var P=y.split(`
|
|
4
|
-
`),ae=C.split(`
|
|
5
|
-
`);for(u=a=0;a<P.length&&!P[a].includes("DetermineComponentFrameRoot");)a++;for(;u<ae.length&&!ae[u].includes("DetermineComponentFrameRoot");)u++;if(a===P.length||u===ae.length)for(a=P.length-1,u=ae.length-1;1<=a&&0<=u&&P[a]!==ae[u];)u--;for(;1<=a&&0<=u;a--,u--)if(P[a]!==ae[u]){if(a!==1||u!==1)do if(a--,u--,0>u||P[a]!==ae[u]){var ge=`
|
|
6
|
-
`+P[a].replace(" at new "," at ");return e.displayName&&ge.includes("<anonymous>")&&(ge=ge.replace("<anonymous>",e.displayName)),ge}while(1<=a&&0<=u);break}}}finally{ye=!1,Error.prepareStackTrace=s}return(s=e?e.displayName||e.name:"")?Ae(s):""}function oe(e,t){switch(e.tag){case 26:case 27:case 5:return Ae(e.type);case 16:return Ae("Lazy");case 13:return e.child!==t&&t!==null?Ae("Suspense Fallback"):Ae("Suspense");case 19:return Ae("SuspenseList");case 0:case 15:return Ie(e.type,!1);case 11:return Ie(e.type.render,!1);case 1:return Ie(e.type,!0);case 31:return Ae("Activity");default:return""}}function ce(e){try{var t="",s=null;do t+=oe(e,s),s=e,e=e.return;while(e);return t}catch(a){return`
|
|
7
|
-
Error generating stack: `+a.message+`
|
|
8
|
-
`+a.stack}}var de=Object.prototype.hasOwnProperty,Te=n.unstable_scheduleCallback,Me=n.unstable_cancelCallback,_e=n.unstable_shouldYield,it=n.unstable_requestPaint,ie=n.unstable_now,F=n.unstable_getCurrentPriorityLevel,pe=n.unstable_ImmediatePriority,J=n.unstable_UserBlockingPriority,je=n.unstable_NormalPriority,Fe=n.unstable_LowPriority,Ne=n.unstable_IdlePriority,Oe=n.log,Xe=n.unstable_setDisableYieldValue,st=null,Et=null;function kt(e){if(typeof Oe=="function"&&Xe(e),Et&&typeof Et.setStrictMode=="function")try{Et.setStrictMode(st,e)}catch{}}var xt=Math.clz32?Math.clz32:Ke,yn=Math.log,an=Math.LN2;function Ke(e){return e>>>=0,e===0?32:31-(yn(e)/an|0)|0}var Tt=256,tn=262144,Gt=4194304;function ee(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64: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 e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function xe(e,t,s){var a=e.pendingLanes;if(a===0)return 0;var u=0,f=e.suspendedLanes,y=e.pingedLanes;e=e.warmLanes;var C=a&134217727;return C!==0?(a=C&~f,a!==0?u=ee(a):(y&=C,y!==0?u=ee(y):s||(s=C&~e,s!==0&&(u=ee(s))))):(C=a&~f,C!==0?u=ee(C):y!==0?u=ee(y):s||(s=a&~e,s!==0&&(u=ee(s)))),u===0?0:t!==0&&t!==u&&(t&f)===0&&(f=u&-u,s=t&-t,f>=s||f===32&&(s&4194048)!==0)?t:u}function Ce(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function $e(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+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 t+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 et(){var e=Gt;return Gt<<=1,(Gt&62914560)===0&&(Gt=4194304),e}function rt(e){for(var t=[],s=0;31>s;s++)t.push(e);return t}function nt(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Vt(e,t,s,a,u,f){var y=e.pendingLanes;e.pendingLanes=s,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=s,e.entangledLanes&=s,e.errorRecoveryDisabledLanes&=s,e.shellSuspendCounter=0;var C=e.entanglements,P=e.expirationTimes,ae=e.hiddenUpdates;for(s=y&~s;0<s;){var ge=31-xt(s),Ee=1<<ge;C[ge]=0,P[ge]=-1;var le=ae[ge];if(le!==null)for(ae[ge]=null,ge=0;ge<le.length;ge++){var fe=le[ge];fe!==null&&(fe.lane&=-536870913)}s&=~Ee}a!==0&&Xn(e,a,0),f!==0&&u===0&&e.tag!==0&&(e.suspendedLanes|=f&~(y&~t))}function Xn(e,t,s){e.pendingLanes|=t,e.suspendedLanes&=~t;var a=31-xt(t);e.entangledLanes|=t,e.entanglements[a]=e.entanglements[a]|1073741824|s&261930}function Kt(e,t){var s=e.entangledLanes|=t;for(e=e.entanglements;s;){var a=31-xt(s),u=1<<a;u&t|e[a]&t&&(e[a]|=t),s&=~u}}function mn(e,t){var s=t&-t;return s=(s&42)!==0?1:fo(s),(s&(e.suspendedLanes|t))!==0?0:s}function fo(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=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:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function Ln(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function Rs(){var e=U.p;return e!==0?e:(e=window.event,e===void 0?32:hb(e.type))}function Kl(e,t){var s=U.p;try{return U.p=e,t()}finally{U.p=s}}var fs=Math.random().toString(36).slice(2),nn="__reactFiber$"+fs,wn="__reactProps$"+fs,Or="__reactContainer$"+fs,ru="__reactEvents$"+fs,uS="__reactListeners$"+fs,dS="__reactHandles$"+fs,Mp="__reactResources$"+fs,ka="__reactMarker$"+fs;function au(e){delete e[nn],delete e[wn],delete e[ru],delete e[uS],delete e[dS]}function kr(e){var t=e[nn];if(t)return t;for(var s=e.parentNode;s;){if(t=s[Or]||s[nn]){if(s=t.alternate,t.child!==null||s!==null&&s.child!==null)for(e=Wx(e);e!==null;){if(s=e[nn])return s;e=Wx(e)}return t}e=s,s=e.parentNode}return null}function _r(e){if(e=e[nn]||e[Or]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function _a(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(l(33))}function Mr(e){var t=e[Mp];return t||(t=e[Mp]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function ln(e){e[ka]=!0}var Ap=new Set,Dp={};function Fo(e,t){Ar(e,t),Ar(e+"Capture",t)}function Ar(e,t){for(Dp[e]=t,e=0;e<t.length;e++)Ap.add(t[e])}var fS=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]*$"),zp={},Lp={};function mS(e){return de.call(Lp,e)?!0:de.call(zp,e)?!1:fS.test(e)?Lp[e]=!0:(zp[e]=!0,!1)}function $l(e,t,s){if(mS(t))if(s===null)e.removeAttribute(t);else{switch(typeof s){case"undefined":case"function":case"symbol":e.removeAttribute(t);return;case"boolean":var a=t.toLowerCase().slice(0,5);if(a!=="data-"&&a!=="aria-"){e.removeAttribute(t);return}}e.setAttribute(t,""+s)}}function Ql(e,t,s){if(s===null)e.removeAttribute(t);else{switch(typeof s){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(t);return}e.setAttribute(t,""+s)}}function Os(e,t,s,a){if(a===null)e.removeAttribute(s);else{switch(typeof a){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(s);return}e.setAttributeNS(t,s,""+a)}}function Kn(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Ip(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function pS(e,t,s){var a=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&typeof a<"u"&&typeof a.get=="function"&&typeof a.set=="function"){var u=a.get,f=a.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return u.call(this)},set:function(y){s=""+y,f.call(this,y)}}),Object.defineProperty(e,t,{enumerable:a.enumerable}),{getValue:function(){return s},setValue:function(y){s=""+y},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function lu(e){if(!e._valueTracker){var t=Ip(e)?"checked":"value";e._valueTracker=pS(e,t,""+e[t])}}function Up(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var s=t.getValue(),a="";return e&&(a=Ip(e)?e.checked?"true":"false":e.value),e=a,e!==s?(t.setValue(e),!0):!1}function Zl(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var hS=/[\n"\\]/g;function $n(e){return e.replace(hS,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function iu(e,t,s,a,u,f,y,C){e.name="",y!=null&&typeof y!="function"&&typeof y!="symbol"&&typeof y!="boolean"?e.type=y:e.removeAttribute("type"),t!=null?y==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+Kn(t)):e.value!==""+Kn(t)&&(e.value=""+Kn(t)):y!=="submit"&&y!=="reset"||e.removeAttribute("value"),t!=null?cu(e,y,Kn(t)):s!=null?cu(e,y,Kn(s)):a!=null&&e.removeAttribute("value"),u==null&&f!=null&&(e.defaultChecked=!!f),u!=null&&(e.checked=u&&typeof u!="function"&&typeof u!="symbol"),C!=null&&typeof C!="function"&&typeof C!="symbol"&&typeof C!="boolean"?e.name=""+Kn(C):e.removeAttribute("name")}function Hp(e,t,s,a,u,f,y,C){if(f!=null&&typeof f!="function"&&typeof f!="symbol"&&typeof f!="boolean"&&(e.type=f),t!=null||s!=null){if(!(f!=="submit"&&f!=="reset"||t!=null)){lu(e);return}s=s!=null?""+Kn(s):"",t=t!=null?""+Kn(t):s,C||t===e.value||(e.value=t),e.defaultValue=t}a=a??u,a=typeof a!="function"&&typeof a!="symbol"&&!!a,e.checked=C?e.checked:!!a,e.defaultChecked=!!a,y!=null&&typeof y!="function"&&typeof y!="symbol"&&typeof y!="boolean"&&(e.name=y),lu(e)}function cu(e,t,s){t==="number"&&Zl(e.ownerDocument)===e||e.defaultValue===""+s||(e.defaultValue=""+s)}function Dr(e,t,s,a){if(e=e.options,t){t={};for(var u=0;u<s.length;u++)t["$"+s[u]]=!0;for(s=0;s<e.length;s++)u=t.hasOwnProperty("$"+e[s].value),e[s].selected!==u&&(e[s].selected=u),u&&a&&(e[s].defaultSelected=!0)}else{for(s=""+Kn(s),t=null,u=0;u<e.length;u++){if(e[u].value===s){e[u].selected=!0,a&&(e[u].defaultSelected=!0);return}t!==null||e[u].disabled||(t=e[u])}t!==null&&(t.selected=!0)}}function Bp(e,t,s){if(t!=null&&(t=""+Kn(t),t!==e.value&&(e.value=t),s==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=s!=null?""+Kn(s):""}function Yp(e,t,s,a){if(t==null){if(a!=null){if(s!=null)throw Error(l(92));if($(a)){if(1<a.length)throw Error(l(93));a=a[0]}s=a}s==null&&(s=""),t=s}s=Kn(t),e.defaultValue=s,a=e.textContent,a===s&&a!==""&&a!==null&&(e.value=a),lu(e)}function zr(e,t){if(t){var s=e.firstChild;if(s&&s===e.lastChild&&s.nodeType===3){s.nodeValue=t;return}}e.textContent=t}var gS=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 Vp(e,t,s){var a=t.indexOf("--")===0;s==null||typeof s=="boolean"||s===""?a?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":a?e.setProperty(t,s):typeof s!="number"||s===0||gS.has(t)?t==="float"?e.cssFloat=s:e[t]=(""+s).trim():e[t]=s+"px"}function Pp(e,t,s){if(t!=null&&typeof t!="object")throw Error(l(62));if(e=e.style,s!=null){for(var a in s)!s.hasOwnProperty(a)||t!=null&&t.hasOwnProperty(a)||(a.indexOf("--")===0?e.setProperty(a,""):a==="float"?e.cssFloat="":e[a]="");for(var u in t)a=t[u],t.hasOwnProperty(u)&&s[u]!==a&&Vp(e,u,a)}else for(var f in t)t.hasOwnProperty(f)&&Vp(e,f,t[f])}function uu(e){if(e.indexOf("-")===-1)return!1;switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var xS=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"]]),bS=/^[\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 Jl(e){return bS.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function ks(){}var du=null;function fu(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Lr=null,Ir=null;function Gp(e){var t=_r(e);if(t&&(e=t.stateNode)){var s=e[wn]||null;e:switch(e=t.stateNode,t.type){case"input":if(iu(e,s.value,s.defaultValue,s.defaultValue,s.checked,s.defaultChecked,s.type,s.name),t=s.name,s.type==="radio"&&t!=null){for(s=e;s.parentNode;)s=s.parentNode;for(s=s.querySelectorAll('input[name="'+$n(""+t)+'"][type="radio"]'),t=0;t<s.length;t++){var a=s[t];if(a!==e&&a.form===e.form){var u=a[wn]||null;if(!u)throw Error(l(90));iu(a,u.value,u.defaultValue,u.defaultValue,u.checked,u.defaultChecked,u.type,u.name)}}for(t=0;t<s.length;t++)a=s[t],a.form===e.form&&Up(a)}break e;case"textarea":Bp(e,s.value,s.defaultValue);break e;case"select":t=s.value,t!=null&&Dr(e,!!s.multiple,t,!1)}}}var mu=!1;function qp(e,t,s){if(mu)return e(t,s);mu=!0;try{var a=e(t);return a}finally{if(mu=!1,(Lr!==null||Ir!==null)&&(Hi(),Lr&&(t=Lr,e=Ir,Ir=Lr=null,Gp(t),e)))for(t=0;t<e.length;t++)Gp(e[t])}}function Ma(e,t){var s=e.stateNode;if(s===null)return null;var a=s[wn]||null;if(a===null)return null;s=a[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(a=!a.disabled)||(e=e.type,a=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!a;break e;default:e=!1}if(e)return null;if(s&&typeof s!="function")throw Error(l(231,t,typeof s));return s}var _s=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),pu=!1;if(_s)try{var Aa={};Object.defineProperty(Aa,"passive",{get:function(){pu=!0}}),window.addEventListener("test",Aa,Aa),window.removeEventListener("test",Aa,Aa)}catch{pu=!1}var mo=null,hu=null,Wl=null;function Fp(){if(Wl)return Wl;var e,t=hu,s=t.length,a,u="value"in mo?mo.value:mo.textContent,f=u.length;for(e=0;e<s&&t[e]===u[e];e++);var y=s-e;for(a=1;a<=y&&t[s-a]===u[f-a];a++);return Wl=u.slice(e,1<a?1-a:void 0)}function ei(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function ti(){return!0}function Xp(){return!1}function Cn(e){function t(s,a,u,f,y){this._reactName=s,this._targetInst=u,this.type=a,this.nativeEvent=f,this.target=y,this.currentTarget=null;for(var C in e)e.hasOwnProperty(C)&&(s=e[C],this[C]=s?s(f):f[C]);return this.isDefaultPrevented=(f.defaultPrevented!=null?f.defaultPrevented:f.returnValue===!1)?ti:Xp,this.isPropagationStopped=Xp,this}return x(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var s=this.nativeEvent;s&&(s.preventDefault?s.preventDefault():typeof s.returnValue!="unknown"&&(s.returnValue=!1),this.isDefaultPrevented=ti)},stopPropagation:function(){var s=this.nativeEvent;s&&(s.stopPropagation?s.stopPropagation():typeof s.cancelBubble!="unknown"&&(s.cancelBubble=!0),this.isPropagationStopped=ti)},persist:function(){},isPersistent:ti}),t}var Xo={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},ni=Cn(Xo),Da=x({},Xo,{view:0,detail:0}),yS=Cn(Da),gu,xu,za,si=x({},Da,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:yu,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==za&&(za&&e.type==="mousemove"?(gu=e.screenX-za.screenX,xu=e.screenY-za.screenY):xu=gu=0,za=e),gu)},movementY:function(e){return"movementY"in e?e.movementY:xu}}),Kp=Cn(si),vS=x({},si,{dataTransfer:0}),SS=Cn(vS),ES=x({},Da,{relatedTarget:0}),bu=Cn(ES),NS=x({},Xo,{animationName:0,elapsedTime:0,pseudoElement:0}),jS=Cn(NS),TS=x({},Xo,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),wS=Cn(TS),CS=x({},Xo,{data:0}),$p=Cn(CS),RS={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},OS={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"},kS={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function _S(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=kS[e])?!!t[e]:!1}function yu(){return _S}var MS=x({},Da,{key:function(e){if(e.key){var t=RS[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=ei(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?OS[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:yu,charCode:function(e){return e.type==="keypress"?ei(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?ei(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),AS=Cn(MS),DS=x({},si,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Qp=Cn(DS),zS=x({},Da,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:yu}),LS=Cn(zS),IS=x({},Xo,{propertyName:0,elapsedTime:0,pseudoElement:0}),US=Cn(IS),HS=x({},si,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),BS=Cn(HS),YS=x({},Xo,{newState:0,oldState:0}),VS=Cn(YS),PS=[9,13,27,32],vu=_s&&"CompositionEvent"in window,La=null;_s&&"documentMode"in document&&(La=document.documentMode);var GS=_s&&"TextEvent"in window&&!La,Zp=_s&&(!vu||La&&8<La&&11>=La),Jp=" ",Wp=!1;function eh(e,t){switch(e){case"keyup":return PS.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function th(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Ur=!1;function qS(e,t){switch(e){case"compositionend":return th(t);case"keypress":return t.which!==32?null:(Wp=!0,Jp);case"textInput":return e=t.data,e===Jp&&Wp?null:e;default:return null}}function FS(e,t){if(Ur)return e==="compositionend"||!vu&&eh(e,t)?(e=Fp(),Wl=hu=mo=null,Ur=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return Zp&&t.locale!=="ko"?null:t.data;default:return null}}var XS={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 nh(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!XS[e.type]:t==="textarea"}function sh(e,t,s,a){Lr?Ir?Ir.push(a):Ir=[a]:Lr=a,t=Fi(t,"onChange"),0<t.length&&(s=new ni("onChange","change",null,s,a),e.push({event:s,listeners:t}))}var Ia=null,Ua=null;function KS(e){Hx(e,0)}function oi(e){var t=_a(e);if(Up(t))return e}function oh(e,t){if(e==="change")return t}var rh=!1;if(_s){var Su;if(_s){var Eu="oninput"in document;if(!Eu){var ah=document.createElement("div");ah.setAttribute("oninput","return;"),Eu=typeof ah.oninput=="function"}Su=Eu}else Su=!1;rh=Su&&(!document.documentMode||9<document.documentMode)}function lh(){Ia&&(Ia.detachEvent("onpropertychange",ih),Ua=Ia=null)}function ih(e){if(e.propertyName==="value"&&oi(Ua)){var t=[];sh(t,Ua,e,fu(e)),qp(KS,t)}}function $S(e,t,s){e==="focusin"?(lh(),Ia=t,Ua=s,Ia.attachEvent("onpropertychange",ih)):e==="focusout"&&lh()}function QS(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return oi(Ua)}function ZS(e,t){if(e==="click")return oi(t)}function JS(e,t){if(e==="input"||e==="change")return oi(t)}function WS(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var In=typeof Object.is=="function"?Object.is:WS;function Ha(e,t){if(In(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var s=Object.keys(e),a=Object.keys(t);if(s.length!==a.length)return!1;for(a=0;a<s.length;a++){var u=s[a];if(!de.call(t,u)||!In(e[u],t[u]))return!1}return!0}function ch(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function uh(e,t){var s=ch(e);e=0;for(var a;s;){if(s.nodeType===3){if(a=e+s.textContent.length,e<=t&&a>=t)return{node:s,offset:t-e};e=a}e:{for(;s;){if(s.nextSibling){s=s.nextSibling;break e}s=s.parentNode}s=void 0}s=ch(s)}}function dh(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?dh(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function fh(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Zl(e.document);t instanceof e.HTMLIFrameElement;){try{var s=typeof t.contentWindow.location.href=="string"}catch{s=!1}if(s)e=t.contentWindow;else break;t=Zl(e.document)}return t}function Nu(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}var eE=_s&&"documentMode"in document&&11>=document.documentMode,Hr=null,ju=null,Ba=null,Tu=!1;function mh(e,t,s){var a=s.window===s?s.document:s.nodeType===9?s:s.ownerDocument;Tu||Hr==null||Hr!==Zl(a)||(a=Hr,"selectionStart"in a&&Nu(a)?a={start:a.selectionStart,end:a.selectionEnd}:(a=(a.ownerDocument&&a.ownerDocument.defaultView||window).getSelection(),a={anchorNode:a.anchorNode,anchorOffset:a.anchorOffset,focusNode:a.focusNode,focusOffset:a.focusOffset}),Ba&&Ha(Ba,a)||(Ba=a,a=Fi(ju,"onSelect"),0<a.length&&(t=new ni("onSelect","select",null,t,s),e.push({event:t,listeners:a}),t.target=Hr)))}function Ko(e,t){var s={};return s[e.toLowerCase()]=t.toLowerCase(),s["Webkit"+e]="webkit"+t,s["Moz"+e]="moz"+t,s}var Br={animationend:Ko("Animation","AnimationEnd"),animationiteration:Ko("Animation","AnimationIteration"),animationstart:Ko("Animation","AnimationStart"),transitionrun:Ko("Transition","TransitionRun"),transitionstart:Ko("Transition","TransitionStart"),transitioncancel:Ko("Transition","TransitionCancel"),transitionend:Ko("Transition","TransitionEnd")},wu={},ph={};_s&&(ph=document.createElement("div").style,"AnimationEvent"in window||(delete Br.animationend.animation,delete Br.animationiteration.animation,delete Br.animationstart.animation),"TransitionEvent"in window||delete Br.transitionend.transition);function $o(e){if(wu[e])return wu[e];if(!Br[e])return e;var t=Br[e],s;for(s in t)if(t.hasOwnProperty(s)&&s in ph)return wu[e]=t[s];return e}var hh=$o("animationend"),gh=$o("animationiteration"),xh=$o("animationstart"),tE=$o("transitionrun"),nE=$o("transitionstart"),sE=$o("transitioncancel"),bh=$o("transitionend"),yh=new Map,Cu="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(" ");Cu.push("scrollEnd");function is(e,t){yh.set(e,t),Fo(t,[e])}var ri=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},Qn=[],Yr=0,Ru=0;function ai(){for(var e=Yr,t=Ru=Yr=0;t<e;){var s=Qn[t];Qn[t++]=null;var a=Qn[t];Qn[t++]=null;var u=Qn[t];Qn[t++]=null;var f=Qn[t];if(Qn[t++]=null,a!==null&&u!==null){var y=a.pending;y===null?u.next=u:(u.next=y.next,y.next=u),a.pending=u}f!==0&&vh(s,u,f)}}function li(e,t,s,a){Qn[Yr++]=e,Qn[Yr++]=t,Qn[Yr++]=s,Qn[Yr++]=a,Ru|=a,e.lanes|=a,e=e.alternate,e!==null&&(e.lanes|=a)}function Ou(e,t,s,a){return li(e,t,s,a),ii(e)}function Qo(e,t){return li(e,null,null,t),ii(e)}function vh(e,t,s){e.lanes|=s;var a=e.alternate;a!==null&&(a.lanes|=s);for(var u=!1,f=e.return;f!==null;)f.childLanes|=s,a=f.alternate,a!==null&&(a.childLanes|=s),f.tag===22&&(e=f.stateNode,e===null||e._visibility&1||(u=!0)),e=f,f=f.return;return e.tag===3?(f=e.stateNode,u&&t!==null&&(u=31-xt(s),e=f.hiddenUpdates,a=e[u],a===null?e[u]=[t]:a.push(t),t.lane=s|536870912),f):null}function ii(e){if(50<il)throw il=0,Ud=null,Error(l(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Vr={};function oE(e,t,s,a){this.tag=e,this.key=s,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=a,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Un(e,t,s,a){return new oE(e,t,s,a)}function ku(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Ms(e,t){var s=e.alternate;return s===null?(s=Un(e.tag,t,e.key,e.mode),s.elementType=e.elementType,s.type=e.type,s.stateNode=e.stateNode,s.alternate=e,e.alternate=s):(s.pendingProps=t,s.type=e.type,s.flags=0,s.subtreeFlags=0,s.deletions=null),s.flags=e.flags&65011712,s.childLanes=e.childLanes,s.lanes=e.lanes,s.child=e.child,s.memoizedProps=e.memoizedProps,s.memoizedState=e.memoizedState,s.updateQueue=e.updateQueue,t=e.dependencies,s.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},s.sibling=e.sibling,s.index=e.index,s.ref=e.ref,s.refCleanup=e.refCleanup,s}function Sh(e,t){e.flags&=65011714;var s=e.alternate;return s===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=s.childLanes,e.lanes=s.lanes,e.child=s.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=s.memoizedProps,e.memoizedState=s.memoizedState,e.updateQueue=s.updateQueue,e.type=s.type,t=s.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function ci(e,t,s,a,u,f){var y=0;if(a=e,typeof e=="function")ku(e)&&(y=1);else if(typeof e=="string")y=cN(e,s,q.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case Q:return e=Un(31,s,t,u),e.elementType=Q,e.lanes=f,e;case k:return Zo(s.children,u,f,t);case O:y=8,u|=24;break;case E:return e=Un(12,s,t,u|2),e.elementType=E,e.lanes=f,e;case H:return e=Un(13,s,t,u),e.elementType=H,e.lanes=f,e;case A:return e=Un(19,s,t,u),e.elementType=A,e.lanes=f,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case _:y=10;break e;case T:y=9;break e;case R:y=11;break e;case B:y=14;break e;case M:y=16,a=null;break e}y=29,s=Error(l(130,e===null?"null":typeof e,"")),a=null}return t=Un(y,s,t,u),t.elementType=e,t.type=a,t.lanes=f,t}function Zo(e,t,s,a){return e=Un(7,e,a,t),e.lanes=s,e}function _u(e,t,s){return e=Un(6,e,null,t),e.lanes=s,e}function Eh(e){var t=Un(18,null,null,0);return t.stateNode=e,t}function Mu(e,t,s){return t=Un(4,e.children!==null?e.children:[],e.key,t),t.lanes=s,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var Nh=new WeakMap;function Zn(e,t){if(typeof e=="object"&&e!==null){var s=Nh.get(e);return s!==void 0?s:(t={value:e,source:t,stack:ce(t)},Nh.set(e,t),t)}return{value:e,source:t,stack:ce(t)}}var Pr=[],Gr=0,ui=null,Ya=0,Jn=[],Wn=0,po=null,ms=1,ps="";function As(e,t){Pr[Gr++]=Ya,Pr[Gr++]=ui,ui=e,Ya=t}function jh(e,t,s){Jn[Wn++]=ms,Jn[Wn++]=ps,Jn[Wn++]=po,po=e;var a=ms;e=ps;var u=32-xt(a)-1;a&=~(1<<u),s+=1;var f=32-xt(t)+u;if(30<f){var y=u-u%5;f=(a&(1<<y)-1).toString(32),a>>=y,u-=y,ms=1<<32-xt(t)+u|s<<u|a,ps=f+e}else ms=1<<f|s<<u|a,ps=e}function Au(e){e.return!==null&&(As(e,1),jh(e,1,0))}function Du(e){for(;e===ui;)ui=Pr[--Gr],Pr[Gr]=null,Ya=Pr[--Gr],Pr[Gr]=null;for(;e===po;)po=Jn[--Wn],Jn[Wn]=null,ps=Jn[--Wn],Jn[Wn]=null,ms=Jn[--Wn],Jn[Wn]=null}function Th(e,t){Jn[Wn++]=ms,Jn[Wn++]=ps,Jn[Wn++]=po,ms=t.id,ps=t.overflow,po=e}var pn=null,Bt=null,bt=!1,ho=null,es=!1,zu=Error(l(519));function go(e){var t=Error(l(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Va(Zn(t,e)),zu}function wh(e){var t=e.stateNode,s=e.type,a=e.memoizedProps;switch(t[nn]=e,t[wn]=a,s){case"dialog":dt("cancel",t),dt("close",t);break;case"iframe":case"object":case"embed":dt("load",t);break;case"video":case"audio":for(s=0;s<ul.length;s++)dt(ul[s],t);break;case"source":dt("error",t);break;case"img":case"image":case"link":dt("error",t),dt("load",t);break;case"details":dt("toggle",t);break;case"input":dt("invalid",t),Hp(t,a.value,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name,!0);break;case"select":dt("invalid",t);break;case"textarea":dt("invalid",t),Yp(t,a.value,a.defaultValue,a.children)}s=a.children,typeof s!="string"&&typeof s!="number"&&typeof s!="bigint"||t.textContent===""+s||a.suppressHydrationWarning===!0||Px(t.textContent,s)?(a.popover!=null&&(dt("beforetoggle",t),dt("toggle",t)),a.onScroll!=null&&dt("scroll",t),a.onScrollEnd!=null&&dt("scrollend",t),a.onClick!=null&&(t.onclick=ks),t=!0):t=!1,t||go(e,!0)}function Ch(e){for(pn=e.return;pn;)switch(pn.tag){case 5:case 31:case 13:es=!1;return;case 27:case 3:es=!0;return;default:pn=pn.return}}function qr(e){if(e!==pn)return!1;if(!bt)return Ch(e),bt=!0,!1;var t=e.tag,s;if((s=t!==3&&t!==27)&&((s=t===5)&&(s=e.type,s=!(s!=="form"&&s!=="button")||Wd(e.type,e.memoizedProps)),s=!s),s&&Bt&&go(e),Ch(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(l(317));Bt=Jx(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(l(317));Bt=Jx(e)}else t===27?(t=Bt,ko(e.type)?(e=of,of=null,Bt=e):Bt=t):Bt=pn?ns(e.stateNode.nextSibling):null;return!0}function Jo(){Bt=pn=null,bt=!1}function Lu(){var e=ho;return e!==null&&(_n===null?_n=e:_n.push.apply(_n,e),ho=null),e}function Va(e){ho===null?ho=[e]:ho.push(e)}var Iu=D(null),Wo=null,Ds=null;function xo(e,t,s){L(Iu,t._currentValue),t._currentValue=s}function zs(e){e._currentValue=Iu.current,G(Iu)}function Uu(e,t,s){for(;e!==null;){var a=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,a!==null&&(a.childLanes|=t)):a!==null&&(a.childLanes&t)!==t&&(a.childLanes|=t),e===s)break;e=e.return}}function Hu(e,t,s,a){var u=e.child;for(u!==null&&(u.return=e);u!==null;){var f=u.dependencies;if(f!==null){var y=u.child;f=f.firstContext;e:for(;f!==null;){var C=f;f=u;for(var P=0;P<t.length;P++)if(C.context===t[P]){f.lanes|=s,C=f.alternate,C!==null&&(C.lanes|=s),Uu(f.return,s,e),a||(y=null);break e}f=C.next}}else if(u.tag===18){if(y=u.return,y===null)throw Error(l(341));y.lanes|=s,f=y.alternate,f!==null&&(f.lanes|=s),Uu(y,s,e),y=null}else y=u.child;if(y!==null)y.return=u;else for(y=u;y!==null;){if(y===e){y=null;break}if(u=y.sibling,u!==null){u.return=y.return,y=u;break}y=y.return}u=y}}function Fr(e,t,s,a){e=null;for(var u=t,f=!1;u!==null;){if(!f){if((u.flags&524288)!==0)f=!0;else if((u.flags&262144)!==0)break}if(u.tag===10){var y=u.alternate;if(y===null)throw Error(l(387));if(y=y.memoizedProps,y!==null){var C=u.type;In(u.pendingProps.value,y.value)||(e!==null?e.push(C):e=[C])}}else if(u===be.current){if(y=u.alternate,y===null)throw Error(l(387));y.memoizedState.memoizedState!==u.memoizedState.memoizedState&&(e!==null?e.push(hl):e=[hl])}u=u.return}e!==null&&Hu(t,e,s,a),t.flags|=262144}function di(e){for(e=e.firstContext;e!==null;){if(!In(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function er(e){Wo=e,Ds=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function hn(e){return Rh(Wo,e)}function fi(e,t){return Wo===null&&er(e),Rh(e,t)}function Rh(e,t){var s=t._currentValue;if(t={context:t,memoizedValue:s,next:null},Ds===null){if(e===null)throw Error(l(308));Ds=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Ds=Ds.next=t;return s}var rE=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(s,a){e.push(a)}};this.abort=function(){t.aborted=!0,e.forEach(function(s){return s()})}},aE=n.unstable_scheduleCallback,lE=n.unstable_NormalPriority,Zt={$$typeof:_,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Bu(){return{controller:new rE,data:new Map,refCount:0}}function Pa(e){e.refCount--,e.refCount===0&&aE(lE,function(){e.controller.abort()})}var Ga=null,Yu=0,Xr=0,Kr=null;function iE(e,t){if(Ga===null){var s=Ga=[];Yu=0,Xr=Gd(),Kr={status:"pending",value:void 0,then:function(a){s.push(a)}}}return Yu++,t.then(Oh,Oh),t}function Oh(){if(--Yu===0&&Ga!==null){Kr!==null&&(Kr.status="fulfilled");var e=Ga;Ga=null,Xr=0,Kr=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function cE(e,t){var s=[],a={status:"pending",value:null,reason:null,then:function(u){s.push(u)}};return e.then(function(){a.status="fulfilled",a.value=t;for(var u=0;u<s.length;u++)(0,s[u])(t)},function(u){for(a.status="rejected",a.reason=u,u=0;u<s.length;u++)(0,s[u])(void 0)}),a}var kh=w.S;w.S=function(e,t){mx=ie(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&iE(e,t),kh!==null&&kh(e,t)};var tr=D(null);function Vu(){var e=tr.current;return e!==null?e:It.pooledCache}function mi(e,t){t===null?L(tr,tr.current):L(tr,t.pool)}function _h(){var e=Vu();return e===null?null:{parent:Zt._currentValue,pool:e}}var $r=Error(l(460)),Pu=Error(l(474)),pi=Error(l(542)),hi={then:function(){}};function Mh(e){return e=e.status,e==="fulfilled"||e==="rejected"}function Ah(e,t,s){switch(s=e[s],s===void 0?e.push(t):s!==t&&(t.then(ks,ks),t=s),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,zh(e),e;default:if(typeof t.status=="string")t.then(ks,ks);else{if(e=It,e!==null&&100<e.shellSuspendCounter)throw Error(l(482));e=t,e.status="pending",e.then(function(a){if(t.status==="pending"){var u=t;u.status="fulfilled",u.value=a}},function(a){if(t.status==="pending"){var u=t;u.status="rejected",u.reason=a}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,zh(e),e}throw sr=t,$r}}function nr(e){try{var t=e._init;return t(e._payload)}catch(s){throw s!==null&&typeof s=="object"&&typeof s.then=="function"?(sr=s,$r):s}}var sr=null;function Dh(){if(sr===null)throw Error(l(459));var e=sr;return sr=null,e}function zh(e){if(e===$r||e===pi)throw Error(l(483))}var Qr=null,qa=0;function gi(e){var t=qa;return qa+=1,Qr===null&&(Qr=[]),Ah(Qr,e,t)}function Fa(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function xi(e,t){throw t.$$typeof===S?Error(l(525)):(e=Object.prototype.toString.call(t),Error(l(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function Lh(e){function t(W,K){if(e){var re=W.deletions;re===null?(W.deletions=[K],W.flags|=16):re.push(K)}}function s(W,K){if(!e)return null;for(;K!==null;)t(W,K),K=K.sibling;return null}function a(W){for(var K=new Map;W!==null;)W.key!==null?K.set(W.key,W):K.set(W.index,W),W=W.sibling;return K}function u(W,K){return W=Ms(W,K),W.index=0,W.sibling=null,W}function f(W,K,re){return W.index=re,e?(re=W.alternate,re!==null?(re=re.index,re<K?(W.flags|=67108866,K):re):(W.flags|=67108866,K)):(W.flags|=1048576,K)}function y(W){return e&&W.alternate===null&&(W.flags|=67108866),W}function C(W,K,re,ve){return K===null||K.tag!==6?(K=_u(re,W.mode,ve),K.return=W,K):(K=u(K,re),K.return=W,K)}function P(W,K,re,ve){var Qe=re.type;return Qe===k?ge(W,K,re.props.children,ve,re.key):K!==null&&(K.elementType===Qe||typeof Qe=="object"&&Qe!==null&&Qe.$$typeof===M&&nr(Qe)===K.type)?(K=u(K,re.props),Fa(K,re),K.return=W,K):(K=ci(re.type,re.key,re.props,null,W.mode,ve),Fa(K,re),K.return=W,K)}function ae(W,K,re,ve){return K===null||K.tag!==4||K.stateNode.containerInfo!==re.containerInfo||K.stateNode.implementation!==re.implementation?(K=Mu(re,W.mode,ve),K.return=W,K):(K=u(K,re.children||[]),K.return=W,K)}function ge(W,K,re,ve,Qe){return K===null||K.tag!==7?(K=Zo(re,W.mode,ve,Qe),K.return=W,K):(K=u(K,re),K.return=W,K)}function Ee(W,K,re){if(typeof K=="string"&&K!==""||typeof K=="number"||typeof K=="bigint")return K=_u(""+K,W.mode,re),K.return=W,K;if(typeof K=="object"&&K!==null){switch(K.$$typeof){case j:return re=ci(K.type,K.key,K.props,null,W.mode,re),Fa(re,K),re.return=W,re;case N:return K=Mu(K,W.mode,re),K.return=W,K;case M:return K=nr(K),Ee(W,K,re)}if($(K)||se(K))return K=Zo(K,W.mode,re,null),K.return=W,K;if(typeof K.then=="function")return Ee(W,gi(K),re);if(K.$$typeof===_)return Ee(W,fi(W,K),re);xi(W,K)}return null}function le(W,K,re,ve){var Qe=K!==null?K.key:null;if(typeof re=="string"&&re!==""||typeof re=="number"||typeof re=="bigint")return Qe!==null?null:C(W,K,""+re,ve);if(typeof re=="object"&&re!==null){switch(re.$$typeof){case j:return re.key===Qe?P(W,K,re,ve):null;case N:return re.key===Qe?ae(W,K,re,ve):null;case M:return re=nr(re),le(W,K,re,ve)}if($(re)||se(re))return Qe!==null?null:ge(W,K,re,ve,null);if(typeof re.then=="function")return le(W,K,gi(re),ve);if(re.$$typeof===_)return le(W,K,fi(W,re),ve);xi(W,re)}return null}function fe(W,K,re,ve,Qe){if(typeof ve=="string"&&ve!==""||typeof ve=="number"||typeof ve=="bigint")return W=W.get(re)||null,C(K,W,""+ve,Qe);if(typeof ve=="object"&&ve!==null){switch(ve.$$typeof){case j:return W=W.get(ve.key===null?re:ve.key)||null,P(K,W,ve,Qe);case N:return W=W.get(ve.key===null?re:ve.key)||null,ae(K,W,ve,Qe);case M:return ve=nr(ve),fe(W,K,re,ve,Qe)}if($(ve)||se(ve))return W=W.get(re)||null,ge(K,W,ve,Qe,null);if(typeof ve.then=="function")return fe(W,K,re,gi(ve),Qe);if(ve.$$typeof===_)return fe(W,K,re,fi(K,ve),Qe);xi(K,ve)}return null}function Ve(W,K,re,ve){for(var Qe=null,wt=null,Pe=K,lt=K=0,pt=null;Pe!==null&<<re.length;lt++){Pe.index>lt?(pt=Pe,Pe=null):pt=Pe.sibling;var Ct=le(W,Pe,re[lt],ve);if(Ct===null){Pe===null&&(Pe=pt);break}e&&Pe&&Ct.alternate===null&&t(W,Pe),K=f(Ct,K,lt),wt===null?Qe=Ct:wt.sibling=Ct,wt=Ct,Pe=pt}if(lt===re.length)return s(W,Pe),bt&&As(W,lt),Qe;if(Pe===null){for(;lt<re.length;lt++)Pe=Ee(W,re[lt],ve),Pe!==null&&(K=f(Pe,K,lt),wt===null?Qe=Pe:wt.sibling=Pe,wt=Pe);return bt&&As(W,lt),Qe}for(Pe=a(Pe);lt<re.length;lt++)pt=fe(Pe,W,lt,re[lt],ve),pt!==null&&(e&&pt.alternate!==null&&Pe.delete(pt.key===null?lt:pt.key),K=f(pt,K,lt),wt===null?Qe=pt:wt.sibling=pt,wt=pt);return e&&Pe.forEach(function(zo){return t(W,zo)}),bt&&As(W,lt),Qe}function Ze(W,K,re,ve){if(re==null)throw Error(l(151));for(var Qe=null,wt=null,Pe=K,lt=K=0,pt=null,Ct=re.next();Pe!==null&&!Ct.done;lt++,Ct=re.next()){Pe.index>lt?(pt=Pe,Pe=null):pt=Pe.sibling;var zo=le(W,Pe,Ct.value,ve);if(zo===null){Pe===null&&(Pe=pt);break}e&&Pe&&zo.alternate===null&&t(W,Pe),K=f(zo,K,lt),wt===null?Qe=zo:wt.sibling=zo,wt=zo,Pe=pt}if(Ct.done)return s(W,Pe),bt&&As(W,lt),Qe;if(Pe===null){for(;!Ct.done;lt++,Ct=re.next())Ct=Ee(W,Ct.value,ve),Ct!==null&&(K=f(Ct,K,lt),wt===null?Qe=Ct:wt.sibling=Ct,wt=Ct);return bt&&As(W,lt),Qe}for(Pe=a(Pe);!Ct.done;lt++,Ct=re.next())Ct=fe(Pe,W,lt,Ct.value,ve),Ct!==null&&(e&&Ct.alternate!==null&&Pe.delete(Ct.key===null?lt:Ct.key),K=f(Ct,K,lt),wt===null?Qe=Ct:wt.sibling=Ct,wt=Ct);return e&&Pe.forEach(function(vN){return t(W,vN)}),bt&&As(W,lt),Qe}function zt(W,K,re,ve){if(typeof re=="object"&&re!==null&&re.type===k&&re.key===null&&(re=re.props.children),typeof re=="object"&&re!==null){switch(re.$$typeof){case j:e:{for(var Qe=re.key;K!==null;){if(K.key===Qe){if(Qe=re.type,Qe===k){if(K.tag===7){s(W,K.sibling),ve=u(K,re.props.children),ve.return=W,W=ve;break e}}else if(K.elementType===Qe||typeof Qe=="object"&&Qe!==null&&Qe.$$typeof===M&&nr(Qe)===K.type){s(W,K.sibling),ve=u(K,re.props),Fa(ve,re),ve.return=W,W=ve;break e}s(W,K);break}else t(W,K);K=K.sibling}re.type===k?(ve=Zo(re.props.children,W.mode,ve,re.key),ve.return=W,W=ve):(ve=ci(re.type,re.key,re.props,null,W.mode,ve),Fa(ve,re),ve.return=W,W=ve)}return y(W);case N:e:{for(Qe=re.key;K!==null;){if(K.key===Qe)if(K.tag===4&&K.stateNode.containerInfo===re.containerInfo&&K.stateNode.implementation===re.implementation){s(W,K.sibling),ve=u(K,re.children||[]),ve.return=W,W=ve;break e}else{s(W,K);break}else t(W,K);K=K.sibling}ve=Mu(re,W.mode,ve),ve.return=W,W=ve}return y(W);case M:return re=nr(re),zt(W,K,re,ve)}if($(re))return Ve(W,K,re,ve);if(se(re)){if(Qe=se(re),typeof Qe!="function")throw Error(l(150));return re=Qe.call(re),Ze(W,K,re,ve)}if(typeof re.then=="function")return zt(W,K,gi(re),ve);if(re.$$typeof===_)return zt(W,K,fi(W,re),ve);xi(W,re)}return typeof re=="string"&&re!==""||typeof re=="number"||typeof re=="bigint"?(re=""+re,K!==null&&K.tag===6?(s(W,K.sibling),ve=u(K,re),ve.return=W,W=ve):(s(W,K),ve=_u(re,W.mode,ve),ve.return=W,W=ve),y(W)):s(W,K)}return function(W,K,re,ve){try{qa=0;var Qe=zt(W,K,re,ve);return Qr=null,Qe}catch(Pe){if(Pe===$r||Pe===pi)throw Pe;var wt=Un(29,Pe,null,W.mode);return wt.lanes=ve,wt.return=W,wt}}}var or=Lh(!0),Ih=Lh(!1),bo=!1;function Gu(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function qu(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function yo(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function vo(e,t,s){var a=e.updateQueue;if(a===null)return null;if(a=a.shared,(Rt&2)!==0){var u=a.pending;return u===null?t.next=t:(t.next=u.next,u.next=t),a.pending=t,t=ii(e),vh(e,null,s),t}return li(e,a,t,s),ii(e)}function Xa(e,t,s){if(t=t.updateQueue,t!==null&&(t=t.shared,(s&4194048)!==0)){var a=t.lanes;a&=e.pendingLanes,s|=a,t.lanes=s,Kt(e,s)}}function Fu(e,t){var s=e.updateQueue,a=e.alternate;if(a!==null&&(a=a.updateQueue,s===a)){var u=null,f=null;if(s=s.firstBaseUpdate,s!==null){do{var y={lane:s.lane,tag:s.tag,payload:s.payload,callback:null,next:null};f===null?u=f=y:f=f.next=y,s=s.next}while(s!==null);f===null?u=f=t:f=f.next=t}else u=f=t;s={baseState:a.baseState,firstBaseUpdate:u,lastBaseUpdate:f,shared:a.shared,callbacks:a.callbacks},e.updateQueue=s;return}e=s.lastBaseUpdate,e===null?s.firstBaseUpdate=t:e.next=t,s.lastBaseUpdate=t}var Xu=!1;function Ka(){if(Xu){var e=Kr;if(e!==null)throw e}}function $a(e,t,s,a){Xu=!1;var u=e.updateQueue;bo=!1;var f=u.firstBaseUpdate,y=u.lastBaseUpdate,C=u.shared.pending;if(C!==null){u.shared.pending=null;var P=C,ae=P.next;P.next=null,y===null?f=ae:y.next=ae,y=P;var ge=e.alternate;ge!==null&&(ge=ge.updateQueue,C=ge.lastBaseUpdate,C!==y&&(C===null?ge.firstBaseUpdate=ae:C.next=ae,ge.lastBaseUpdate=P))}if(f!==null){var Ee=u.baseState;y=0,ge=ae=P=null,C=f;do{var le=C.lane&-536870913,fe=le!==C.lane;if(fe?(mt&le)===le:(a&le)===le){le!==0&&le===Xr&&(Xu=!0),ge!==null&&(ge=ge.next={lane:0,tag:C.tag,payload:C.payload,callback:null,next:null});e:{var Ve=e,Ze=C;le=t;var zt=s;switch(Ze.tag){case 1:if(Ve=Ze.payload,typeof Ve=="function"){Ee=Ve.call(zt,Ee,le);break e}Ee=Ve;break e;case 3:Ve.flags=Ve.flags&-65537|128;case 0:if(Ve=Ze.payload,le=typeof Ve=="function"?Ve.call(zt,Ee,le):Ve,le==null)break e;Ee=x({},Ee,le);break e;case 2:bo=!0}}le=C.callback,le!==null&&(e.flags|=64,fe&&(e.flags|=8192),fe=u.callbacks,fe===null?u.callbacks=[le]:fe.push(le))}else fe={lane:le,tag:C.tag,payload:C.payload,callback:C.callback,next:null},ge===null?(ae=ge=fe,P=Ee):ge=ge.next=fe,y|=le;if(C=C.next,C===null){if(C=u.shared.pending,C===null)break;fe=C,C=fe.next,fe.next=null,u.lastBaseUpdate=fe,u.shared.pending=null}}while(!0);ge===null&&(P=Ee),u.baseState=P,u.firstBaseUpdate=ae,u.lastBaseUpdate=ge,f===null&&(u.shared.lanes=0),To|=y,e.lanes=y,e.memoizedState=Ee}}function Uh(e,t){if(typeof e!="function")throw Error(l(191,e));e.call(t)}function Hh(e,t){var s=e.callbacks;if(s!==null)for(e.callbacks=null,e=0;e<s.length;e++)Uh(s[e],t)}var Zr=D(null),bi=D(0);function Bh(e,t){e=Gs,L(bi,e),L(Zr,t),Gs=e|t.baseLanes}function Ku(){L(bi,Gs),L(Zr,Zr.current)}function $u(){Gs=bi.current,G(Zr),G(bi)}var Hn=D(null),ts=null;function So(e){var t=e.alternate;L($t,$t.current&1),L(Hn,e),ts===null&&(t===null||Zr.current!==null||t.memoizedState!==null)&&(ts=e)}function Qu(e){L($t,$t.current),L(Hn,e),ts===null&&(ts=e)}function Yh(e){e.tag===22?(L($t,$t.current),L(Hn,e),ts===null&&(ts=e)):Eo()}function Eo(){L($t,$t.current),L(Hn,Hn.current)}function Bn(e){G(Hn),ts===e&&(ts=null),G($t)}var $t=D(0);function yi(e){for(var t=e;t!==null;){if(t.tag===13){var s=t.memoizedState;if(s!==null&&(s=s.dehydrated,s===null||nf(s)||sf(s)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder==="forwards"||t.memoizedProps.revealOrder==="backwards"||t.memoizedProps.revealOrder==="unstable_legacy-backwards"||t.memoizedProps.revealOrder==="together")){if((t.flags&128)!==0)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var Ls=0,at=null,At=null,Jt=null,vi=!1,Jr=!1,rr=!1,Si=0,Qa=0,Wr=null,uE=0;function qt(){throw Error(l(321))}function Zu(e,t){if(t===null)return!1;for(var s=0;s<t.length&&s<e.length;s++)if(!In(e[s],t[s]))return!1;return!0}function Ju(e,t,s,a,u,f){return Ls=f,at=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,w.H=e===null||e.memoizedState===null?jg:md,rr=!1,f=s(a,u),rr=!1,Jr&&(f=Ph(t,s,a,u)),Vh(e),f}function Vh(e){w.H=Wa;var t=At!==null&&At.next!==null;if(Ls=0,Jt=At=at=null,vi=!1,Qa=0,Wr=null,t)throw Error(l(300));e===null||Wt||(e=e.dependencies,e!==null&&di(e)&&(Wt=!0))}function Ph(e,t,s,a){at=e;var u=0;do{if(Jr&&(Wr=null),Qa=0,Jr=!1,25<=u)throw Error(l(301));if(u+=1,Jt=At=null,e.updateQueue!=null){var f=e.updateQueue;f.lastEffect=null,f.events=null,f.stores=null,f.memoCache!=null&&(f.memoCache.index=0)}w.H=Tg,f=t(s,a)}while(Jr);return f}function dE(){var e=w.H,t=e.useState()[0];return t=typeof t.then=="function"?Za(t):t,e=e.useState()[0],(At!==null?At.memoizedState:null)!==e&&(at.flags|=1024),t}function Wu(){var e=Si!==0;return Si=0,e}function ed(e,t,s){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~s}function td(e){if(vi){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}vi=!1}Ls=0,Jt=At=at=null,Jr=!1,Qa=Si=0,Wr=null}function Nn(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Jt===null?at.memoizedState=Jt=e:Jt=Jt.next=e,Jt}function Qt(){if(At===null){var e=at.alternate;e=e!==null?e.memoizedState:null}else e=At.next;var t=Jt===null?at.memoizedState:Jt.next;if(t!==null)Jt=t,At=e;else{if(e===null)throw at.alternate===null?Error(l(467)):Error(l(310));At=e,e={memoizedState:At.memoizedState,baseState:At.baseState,baseQueue:At.baseQueue,queue:At.queue,next:null},Jt===null?at.memoizedState=Jt=e:Jt=Jt.next=e}return Jt}function Ei(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Za(e){var t=Qa;return Qa+=1,Wr===null&&(Wr=[]),e=Ah(Wr,e,t),t=at,(Jt===null?t.memoizedState:Jt.next)===null&&(t=t.alternate,w.H=t===null||t.memoizedState===null?jg:md),e}function Ni(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return Za(e);if(e.$$typeof===_)return hn(e)}throw Error(l(438,String(e)))}function nd(e){var t=null,s=at.updateQueue;if(s!==null&&(t=s.memoCache),t==null){var a=at.alternate;a!==null&&(a=a.updateQueue,a!==null&&(a=a.memoCache,a!=null&&(t={data:a.data.map(function(u){return u.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),s===null&&(s=Ei(),at.updateQueue=s),s.memoCache=t,s=t.data[t.index],s===void 0)for(s=t.data[t.index]=Array(e),a=0;a<e;a++)s[a]=ne;return t.index++,s}function Is(e,t){return typeof t=="function"?t(e):t}function ji(e){var t=Qt();return sd(t,At,e)}function sd(e,t,s){var a=e.queue;if(a===null)throw Error(l(311));a.lastRenderedReducer=s;var u=e.baseQueue,f=a.pending;if(f!==null){if(u!==null){var y=u.next;u.next=f.next,f.next=y}t.baseQueue=u=f,a.pending=null}if(f=e.baseState,u===null)e.memoizedState=f;else{t=u.next;var C=y=null,P=null,ae=t,ge=!1;do{var Ee=ae.lane&-536870913;if(Ee!==ae.lane?(mt&Ee)===Ee:(Ls&Ee)===Ee){var le=ae.revertLane;if(le===0)P!==null&&(P=P.next={lane:0,revertLane:0,gesture:null,action:ae.action,hasEagerState:ae.hasEagerState,eagerState:ae.eagerState,next:null}),Ee===Xr&&(ge=!0);else if((Ls&le)===le){ae=ae.next,le===Xr&&(ge=!0);continue}else Ee={lane:0,revertLane:ae.revertLane,gesture:null,action:ae.action,hasEagerState:ae.hasEagerState,eagerState:ae.eagerState,next:null},P===null?(C=P=Ee,y=f):P=P.next=Ee,at.lanes|=le,To|=le;Ee=ae.action,rr&&s(f,Ee),f=ae.hasEagerState?ae.eagerState:s(f,Ee)}else le={lane:Ee,revertLane:ae.revertLane,gesture:ae.gesture,action:ae.action,hasEagerState:ae.hasEagerState,eagerState:ae.eagerState,next:null},P===null?(C=P=le,y=f):P=P.next=le,at.lanes|=Ee,To|=Ee;ae=ae.next}while(ae!==null&&ae!==t);if(P===null?y=f:P.next=C,!In(f,e.memoizedState)&&(Wt=!0,ge&&(s=Kr,s!==null)))throw s;e.memoizedState=f,e.baseState=y,e.baseQueue=P,a.lastRenderedState=f}return u===null&&(a.lanes=0),[e.memoizedState,a.dispatch]}function od(e){var t=Qt(),s=t.queue;if(s===null)throw Error(l(311));s.lastRenderedReducer=e;var a=s.dispatch,u=s.pending,f=t.memoizedState;if(u!==null){s.pending=null;var y=u=u.next;do f=e(f,y.action),y=y.next;while(y!==u);In(f,t.memoizedState)||(Wt=!0),t.memoizedState=f,t.baseQueue===null&&(t.baseState=f),s.lastRenderedState=f}return[f,a]}function Gh(e,t,s){var a=at,u=Qt(),f=bt;if(f){if(s===void 0)throw Error(l(407));s=s()}else s=t();var y=!In((At||u).memoizedState,s);if(y&&(u.memoizedState=s,Wt=!0),u=u.queue,ld(Xh.bind(null,a,u,e),[e]),u.getSnapshot!==t||y||Jt!==null&&Jt.memoizedState.tag&1){if(a.flags|=2048,ea(9,{destroy:void 0},Fh.bind(null,a,u,s,t),null),It===null)throw Error(l(349));f||(Ls&127)!==0||qh(a,t,s)}return s}function qh(e,t,s){e.flags|=16384,e={getSnapshot:t,value:s},t=at.updateQueue,t===null?(t=Ei(),at.updateQueue=t,t.stores=[e]):(s=t.stores,s===null?t.stores=[e]:s.push(e))}function Fh(e,t,s,a){t.value=s,t.getSnapshot=a,Kh(t)&&$h(e)}function Xh(e,t,s){return s(function(){Kh(t)&&$h(e)})}function Kh(e){var t=e.getSnapshot;e=e.value;try{var s=t();return!In(e,s)}catch{return!0}}function $h(e){var t=Qo(e,2);t!==null&&Mn(t,e,2)}function rd(e){var t=Nn();if(typeof e=="function"){var s=e;if(e=s(),rr){kt(!0);try{s()}finally{kt(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Is,lastRenderedState:e},t}function Qh(e,t,s,a){return e.baseState=s,sd(e,At,typeof a=="function"?a:Is)}function fE(e,t,s,a,u){if(Ci(e))throw Error(l(485));if(e=t.action,e!==null){var f={payload:u,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(y){f.listeners.push(y)}};w.T!==null?s(!0):f.isTransition=!1,a(f),s=t.pending,s===null?(f.next=t.pending=f,Zh(t,f)):(f.next=s.next,t.pending=s.next=f)}}function Zh(e,t){var s=t.action,a=t.payload,u=e.state;if(t.isTransition){var f=w.T,y={};w.T=y;try{var C=s(u,a),P=w.S;P!==null&&P(y,C),Jh(e,t,C)}catch(ae){ad(e,t,ae)}finally{f!==null&&y.types!==null&&(f.types=y.types),w.T=f}}else try{f=s(u,a),Jh(e,t,f)}catch(ae){ad(e,t,ae)}}function Jh(e,t,s){s!==null&&typeof s=="object"&&typeof s.then=="function"?s.then(function(a){Wh(e,t,a)},function(a){return ad(e,t,a)}):Wh(e,t,s)}function Wh(e,t,s){t.status="fulfilled",t.value=s,eg(t),e.state=s,t=e.pending,t!==null&&(s=t.next,s===t?e.pending=null:(s=s.next,t.next=s,Zh(e,s)))}function ad(e,t,s){var a=e.pending;if(e.pending=null,a!==null){a=a.next;do t.status="rejected",t.reason=s,eg(t),t=t.next;while(t!==a)}e.action=null}function eg(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function tg(e,t){return t}function ng(e,t){if(bt){var s=It.formState;if(s!==null){e:{var a=at;if(bt){if(Bt){t:{for(var u=Bt,f=es;u.nodeType!==8;){if(!f){u=null;break t}if(u=ns(u.nextSibling),u===null){u=null;break t}}f=u.data,u=f==="F!"||f==="F"?u:null}if(u){Bt=ns(u.nextSibling),a=u.data==="F!";break e}}go(a)}a=!1}a&&(t=s[0])}}return s=Nn(),s.memoizedState=s.baseState=t,a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:tg,lastRenderedState:t},s.queue=a,s=Sg.bind(null,at,a),a.dispatch=s,a=rd(!1),f=fd.bind(null,at,!1,a.queue),a=Nn(),u={state:t,dispatch:null,action:e,pending:null},a.queue=u,s=fE.bind(null,at,u,f,s),u.dispatch=s,a.memoizedState=e,[t,s,!1]}function sg(e){var t=Qt();return og(t,At,e)}function og(e,t,s){if(t=sd(e,t,tg)[0],e=ji(Is)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var a=Za(t)}catch(y){throw y===$r?pi:y}else a=t;t=Qt();var u=t.queue,f=u.dispatch;return s!==t.memoizedState&&(at.flags|=2048,ea(9,{destroy:void 0},mE.bind(null,u,s),null)),[a,f,e]}function mE(e,t){e.action=t}function rg(e){var t=Qt(),s=At;if(s!==null)return og(t,s,e);Qt(),t=t.memoizedState,s=Qt();var a=s.queue.dispatch;return s.memoizedState=e,[t,a,!1]}function ea(e,t,s,a){return e={tag:e,create:s,deps:a,inst:t,next:null},t=at.updateQueue,t===null&&(t=Ei(),at.updateQueue=t),s=t.lastEffect,s===null?t.lastEffect=e.next=e:(a=s.next,s.next=e,e.next=a,t.lastEffect=e),e}function ag(){return Qt().memoizedState}function Ti(e,t,s,a){var u=Nn();at.flags|=e,u.memoizedState=ea(1|t,{destroy:void 0},s,a===void 0?null:a)}function wi(e,t,s,a){var u=Qt();a=a===void 0?null:a;var f=u.memoizedState.inst;At!==null&&a!==null&&Zu(a,At.memoizedState.deps)?u.memoizedState=ea(t,f,s,a):(at.flags|=e,u.memoizedState=ea(1|t,f,s,a))}function lg(e,t){Ti(8390656,8,e,t)}function ld(e,t){wi(2048,8,e,t)}function pE(e){at.flags|=4;var t=at.updateQueue;if(t===null)t=Ei(),at.updateQueue=t,t.events=[e];else{var s=t.events;s===null?t.events=[e]:s.push(e)}}function ig(e){var t=Qt().memoizedState;return pE({ref:t,nextImpl:e}),function(){if((Rt&2)!==0)throw Error(l(440));return t.impl.apply(void 0,arguments)}}function cg(e,t){return wi(4,2,e,t)}function ug(e,t){return wi(4,4,e,t)}function dg(e,t){if(typeof t=="function"){e=e();var s=t(e);return function(){typeof s=="function"?s():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function fg(e,t,s){s=s!=null?s.concat([e]):null,wi(4,4,dg.bind(null,t,e),s)}function id(){}function mg(e,t){var s=Qt();t=t===void 0?null:t;var a=s.memoizedState;return t!==null&&Zu(t,a[1])?a[0]:(s.memoizedState=[e,t],e)}function pg(e,t){var s=Qt();t=t===void 0?null:t;var a=s.memoizedState;if(t!==null&&Zu(t,a[1]))return a[0];if(a=e(),rr){kt(!0);try{e()}finally{kt(!1)}}return s.memoizedState=[a,t],a}function cd(e,t,s){return s===void 0||(Ls&1073741824)!==0&&(mt&261930)===0?e.memoizedState=t:(e.memoizedState=s,e=hx(),at.lanes|=e,To|=e,s)}function hg(e,t,s,a){return In(s,t)?s:Zr.current!==null?(e=cd(e,s,a),In(e,t)||(Wt=!0),e):(Ls&42)===0||(Ls&1073741824)!==0&&(mt&261930)===0?(Wt=!0,e.memoizedState=s):(e=hx(),at.lanes|=e,To|=e,t)}function gg(e,t,s,a,u){var f=U.p;U.p=f!==0&&8>f?f:8;var y=w.T,C={};w.T=C,fd(e,!1,t,s);try{var P=u(),ae=w.S;if(ae!==null&&ae(C,P),P!==null&&typeof P=="object"&&typeof P.then=="function"){var ge=cE(P,a);Ja(e,t,ge,Pn(e))}else Ja(e,t,a,Pn(e))}catch(Ee){Ja(e,t,{then:function(){},status:"rejected",reason:Ee},Pn())}finally{U.p=f,y!==null&&C.types!==null&&(y.types=C.types),w.T=y}}function hE(){}function ud(e,t,s,a){if(e.tag!==5)throw Error(l(476));var u=xg(e).queue;gg(e,u,t,Y,s===null?hE:function(){return bg(e),s(a)})}function xg(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:Y,baseState:Y,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Is,lastRenderedState:Y},next:null};var s={};return t.next={memoizedState:s,baseState:s,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Is,lastRenderedState:s},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function bg(e){var t=xg(e);t.next===null&&(t=e.alternate.memoizedState),Ja(e,t.next.queue,{},Pn())}function dd(){return hn(hl)}function yg(){return Qt().memoizedState}function vg(){return Qt().memoizedState}function gE(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var s=Pn();e=yo(s);var a=vo(t,e,s);a!==null&&(Mn(a,t,s),Xa(a,t,s)),t={cache:Bu()},e.payload=t;return}t=t.return}}function xE(e,t,s){var a=Pn();s={lane:a,revertLane:0,gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null},Ci(e)?Eg(t,s):(s=Ou(e,t,s,a),s!==null&&(Mn(s,e,a),Ng(s,t,a)))}function Sg(e,t,s){var a=Pn();Ja(e,t,s,a)}function Ja(e,t,s,a){var u={lane:a,revertLane:0,gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null};if(Ci(e))Eg(t,u);else{var f=e.alternate;if(e.lanes===0&&(f===null||f.lanes===0)&&(f=t.lastRenderedReducer,f!==null))try{var y=t.lastRenderedState,C=f(y,s);if(u.hasEagerState=!0,u.eagerState=C,In(C,y))return li(e,t,u,0),It===null&&ai(),!1}catch{}if(s=Ou(e,t,u,a),s!==null)return Mn(s,e,a),Ng(s,t,a),!0}return!1}function fd(e,t,s,a){if(a={lane:2,revertLane:Gd(),gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},Ci(e)){if(t)throw Error(l(479))}else t=Ou(e,s,a,2),t!==null&&Mn(t,e,2)}function Ci(e){var t=e.alternate;return e===at||t!==null&&t===at}function Eg(e,t){Jr=vi=!0;var s=e.pending;s===null?t.next=t:(t.next=s.next,s.next=t),e.pending=t}function Ng(e,t,s){if((s&4194048)!==0){var a=t.lanes;a&=e.pendingLanes,s|=a,t.lanes=s,Kt(e,s)}}var Wa={readContext:hn,use:Ni,useCallback:qt,useContext:qt,useEffect:qt,useImperativeHandle:qt,useLayoutEffect:qt,useInsertionEffect:qt,useMemo:qt,useReducer:qt,useRef:qt,useState:qt,useDebugValue:qt,useDeferredValue:qt,useTransition:qt,useSyncExternalStore:qt,useId:qt,useHostTransitionStatus:qt,useFormState:qt,useActionState:qt,useOptimistic:qt,useMemoCache:qt,useCacheRefresh:qt};Wa.useEffectEvent=qt;var jg={readContext:hn,use:Ni,useCallback:function(e,t){return Nn().memoizedState=[e,t===void 0?null:t],e},useContext:hn,useEffect:lg,useImperativeHandle:function(e,t,s){s=s!=null?s.concat([e]):null,Ti(4194308,4,dg.bind(null,t,e),s)},useLayoutEffect:function(e,t){return Ti(4194308,4,e,t)},useInsertionEffect:function(e,t){Ti(4,2,e,t)},useMemo:function(e,t){var s=Nn();t=t===void 0?null:t;var a=e();if(rr){kt(!0);try{e()}finally{kt(!1)}}return s.memoizedState=[a,t],a},useReducer:function(e,t,s){var a=Nn();if(s!==void 0){var u=s(t);if(rr){kt(!0);try{s(t)}finally{kt(!1)}}}else u=t;return a.memoizedState=a.baseState=u,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:u},a.queue=e,e=e.dispatch=xE.bind(null,at,e),[a.memoizedState,e]},useRef:function(e){var t=Nn();return e={current:e},t.memoizedState=e},useState:function(e){e=rd(e);var t=e.queue,s=Sg.bind(null,at,t);return t.dispatch=s,[e.memoizedState,s]},useDebugValue:id,useDeferredValue:function(e,t){var s=Nn();return cd(s,e,t)},useTransition:function(){var e=rd(!1);return e=gg.bind(null,at,e.queue,!0,!1),Nn().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,s){var a=at,u=Nn();if(bt){if(s===void 0)throw Error(l(407));s=s()}else{if(s=t(),It===null)throw Error(l(349));(mt&127)!==0||qh(a,t,s)}u.memoizedState=s;var f={value:s,getSnapshot:t};return u.queue=f,lg(Xh.bind(null,a,f,e),[e]),a.flags|=2048,ea(9,{destroy:void 0},Fh.bind(null,a,f,s,t),null),s},useId:function(){var e=Nn(),t=It.identifierPrefix;if(bt){var s=ps,a=ms;s=(a&~(1<<32-xt(a)-1)).toString(32)+s,t="_"+t+"R_"+s,s=Si++,0<s&&(t+="H"+s.toString(32)),t+="_"}else s=uE++,t="_"+t+"r_"+s.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:dd,useFormState:ng,useActionState:ng,useOptimistic:function(e){var t=Nn();t.memoizedState=t.baseState=e;var s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=s,t=fd.bind(null,at,!0,s),s.dispatch=t,[e,t]},useMemoCache:nd,useCacheRefresh:function(){return Nn().memoizedState=gE.bind(null,at)},useEffectEvent:function(e){var t=Nn(),s={impl:e};return t.memoizedState=s,function(){if((Rt&2)!==0)throw Error(l(440));return s.impl.apply(void 0,arguments)}}},md={readContext:hn,use:Ni,useCallback:mg,useContext:hn,useEffect:ld,useImperativeHandle:fg,useInsertionEffect:cg,useLayoutEffect:ug,useMemo:pg,useReducer:ji,useRef:ag,useState:function(){return ji(Is)},useDebugValue:id,useDeferredValue:function(e,t){var s=Qt();return hg(s,At.memoizedState,e,t)},useTransition:function(){var e=ji(Is)[0],t=Qt().memoizedState;return[typeof e=="boolean"?e:Za(e),t]},useSyncExternalStore:Gh,useId:yg,useHostTransitionStatus:dd,useFormState:sg,useActionState:sg,useOptimistic:function(e,t){var s=Qt();return Qh(s,At,e,t)},useMemoCache:nd,useCacheRefresh:vg};md.useEffectEvent=ig;var Tg={readContext:hn,use:Ni,useCallback:mg,useContext:hn,useEffect:ld,useImperativeHandle:fg,useInsertionEffect:cg,useLayoutEffect:ug,useMemo:pg,useReducer:od,useRef:ag,useState:function(){return od(Is)},useDebugValue:id,useDeferredValue:function(e,t){var s=Qt();return At===null?cd(s,e,t):hg(s,At.memoizedState,e,t)},useTransition:function(){var e=od(Is)[0],t=Qt().memoizedState;return[typeof e=="boolean"?e:Za(e),t]},useSyncExternalStore:Gh,useId:yg,useHostTransitionStatus:dd,useFormState:rg,useActionState:rg,useOptimistic:function(e,t){var s=Qt();return At!==null?Qh(s,At,e,t):(s.baseState=e,[e,s.queue.dispatch])},useMemoCache:nd,useCacheRefresh:vg};Tg.useEffectEvent=ig;function pd(e,t,s,a){t=e.memoizedState,s=s(a,t),s=s==null?t:x({},t,s),e.memoizedState=s,e.lanes===0&&(e.updateQueue.baseState=s)}var hd={enqueueSetState:function(e,t,s){e=e._reactInternals;var a=Pn(),u=yo(a);u.payload=t,s!=null&&(u.callback=s),t=vo(e,u,a),t!==null&&(Mn(t,e,a),Xa(t,e,a))},enqueueReplaceState:function(e,t,s){e=e._reactInternals;var a=Pn(),u=yo(a);u.tag=1,u.payload=t,s!=null&&(u.callback=s),t=vo(e,u,a),t!==null&&(Mn(t,e,a),Xa(t,e,a))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var s=Pn(),a=yo(s);a.tag=2,t!=null&&(a.callback=t),t=vo(e,a,s),t!==null&&(Mn(t,e,s),Xa(t,e,s))}};function wg(e,t,s,a,u,f,y){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(a,f,y):t.prototype&&t.prototype.isPureReactComponent?!Ha(s,a)||!Ha(u,f):!0}function Cg(e,t,s,a){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(s,a),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(s,a),t.state!==e&&hd.enqueueReplaceState(t,t.state,null)}function ar(e,t){var s=t;if("ref"in t){s={};for(var a in t)a!=="ref"&&(s[a]=t[a])}if(e=e.defaultProps){s===t&&(s=x({},s));for(var u in e)s[u]===void 0&&(s[u]=e[u])}return s}function Rg(e){ri(e)}function Og(e){console.error(e)}function kg(e){ri(e)}function Ri(e,t){try{var s=e.onUncaughtError;s(t.value,{componentStack:t.stack})}catch(a){setTimeout(function(){throw a})}}function _g(e,t,s){try{var a=e.onCaughtError;a(s.value,{componentStack:s.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(u){setTimeout(function(){throw u})}}function gd(e,t,s){return s=yo(s),s.tag=3,s.payload={element:null},s.callback=function(){Ri(e,t)},s}function Mg(e){return e=yo(e),e.tag=3,e}function Ag(e,t,s,a){var u=s.type.getDerivedStateFromError;if(typeof u=="function"){var f=a.value;e.payload=function(){return u(f)},e.callback=function(){_g(t,s,a)}}var y=s.stateNode;y!==null&&typeof y.componentDidCatch=="function"&&(e.callback=function(){_g(t,s,a),typeof u!="function"&&(wo===null?wo=new Set([this]):wo.add(this));var C=a.stack;this.componentDidCatch(a.value,{componentStack:C!==null?C:""})})}function bE(e,t,s,a,u){if(s.flags|=32768,a!==null&&typeof a=="object"&&typeof a.then=="function"){if(t=s.alternate,t!==null&&Fr(t,s,u,!0),s=Hn.current,s!==null){switch(s.tag){case 31:case 13:return ts===null?Bi():s.alternate===null&&Ft===0&&(Ft=3),s.flags&=-257,s.flags|=65536,s.lanes=u,a===hi?s.flags|=16384:(t=s.updateQueue,t===null?s.updateQueue=new Set([a]):t.add(a),Yd(e,a,u)),!1;case 22:return s.flags|=65536,a===hi?s.flags|=16384:(t=s.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([a])},s.updateQueue=t):(s=t.retryQueue,s===null?t.retryQueue=new Set([a]):s.add(a)),Yd(e,a,u)),!1}throw Error(l(435,s.tag))}return Yd(e,a,u),Bi(),!1}if(bt)return t=Hn.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=u,a!==zu&&(e=Error(l(422),{cause:a}),Va(Zn(e,s)))):(a!==zu&&(t=Error(l(423),{cause:a}),Va(Zn(t,s))),e=e.current.alternate,e.flags|=65536,u&=-u,e.lanes|=u,a=Zn(a,s),u=gd(e.stateNode,a,u),Fu(e,u),Ft!==4&&(Ft=2)),!1;var f=Error(l(520),{cause:a});if(f=Zn(f,s),ll===null?ll=[f]:ll.push(f),Ft!==4&&(Ft=2),t===null)return!0;a=Zn(a,s),s=t;do{switch(s.tag){case 3:return s.flags|=65536,e=u&-u,s.lanes|=e,e=gd(s.stateNode,a,e),Fu(s,e),!1;case 1:if(t=s.type,f=s.stateNode,(s.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||f!==null&&typeof f.componentDidCatch=="function"&&(wo===null||!wo.has(f))))return s.flags|=65536,u&=-u,s.lanes|=u,u=Mg(u),Ag(u,e,s,a),Fu(s,u),!1}s=s.return}while(s!==null);return!1}var xd=Error(l(461)),Wt=!1;function gn(e,t,s,a){t.child=e===null?Ih(t,null,s,a):or(t,e.child,s,a)}function Dg(e,t,s,a,u){s=s.render;var f=t.ref;if("ref"in a){var y={};for(var C in a)C!=="ref"&&(y[C]=a[C])}else y=a;return er(t),a=Ju(e,t,s,y,f,u),C=Wu(),e!==null&&!Wt?(ed(e,t,u),Us(e,t,u)):(bt&&C&&Au(t),t.flags|=1,gn(e,t,a,u),t.child)}function zg(e,t,s,a,u){if(e===null){var f=s.type;return typeof f=="function"&&!ku(f)&&f.defaultProps===void 0&&s.compare===null?(t.tag=15,t.type=f,Lg(e,t,f,a,u)):(e=ci(s.type,null,a,t,t.mode,u),e.ref=t.ref,e.return=t,t.child=e)}if(f=e.child,!Td(e,u)){var y=f.memoizedProps;if(s=s.compare,s=s!==null?s:Ha,s(y,a)&&e.ref===t.ref)return Us(e,t,u)}return t.flags|=1,e=Ms(f,a),e.ref=t.ref,e.return=t,t.child=e}function Lg(e,t,s,a,u){if(e!==null){var f=e.memoizedProps;if(Ha(f,a)&&e.ref===t.ref)if(Wt=!1,t.pendingProps=a=f,Td(e,u))(e.flags&131072)!==0&&(Wt=!0);else return t.lanes=e.lanes,Us(e,t,u)}return bd(e,t,s,a,u)}function Ig(e,t,s,a){var u=a.children,f=e!==null?e.memoizedState:null;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),a.mode==="hidden"){if((t.flags&128)!==0){if(f=f!==null?f.baseLanes|s:s,e!==null){for(a=t.child=e.child,u=0;a!==null;)u=u|a.lanes|a.childLanes,a=a.sibling;a=u&~f}else a=0,t.child=null;return Ug(e,t,f,s,a)}if((s&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&mi(t,f!==null?f.cachePool:null),f!==null?Bh(t,f):Ku(),Yh(t);else return a=t.lanes=536870912,Ug(e,t,f!==null?f.baseLanes|s:s,s,a)}else f!==null?(mi(t,f.cachePool),Bh(t,f),Eo(),t.memoizedState=null):(e!==null&&mi(t,null),Ku(),Eo());return gn(e,t,u,s),t.child}function el(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function Ug(e,t,s,a,u){var f=Vu();return f=f===null?null:{parent:Zt._currentValue,pool:f},t.memoizedState={baseLanes:s,cachePool:f},e!==null&&mi(t,null),Ku(),Yh(t),e!==null&&Fr(e,t,a,!0),t.childLanes=u,null}function Oi(e,t){return t=_i({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function Hg(e,t,s){return or(t,e.child,null,s),e=Oi(t,t.pendingProps),e.flags|=2,Bn(t),t.memoizedState=null,e}function yE(e,t,s){var a=t.pendingProps,u=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(bt){if(a.mode==="hidden")return e=Oi(t,a),t.lanes=536870912,el(null,e);if(Qu(t),(e=Bt)?(e=Zx(e,es),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:po!==null?{id:ms,overflow:ps}:null,retryLane:536870912,hydrationErrors:null},s=Eh(e),s.return=t,t.child=s,pn=t,Bt=null)):e=null,e===null)throw go(t);return t.lanes=536870912,null}return Oi(t,a)}var f=e.memoizedState;if(f!==null){var y=f.dehydrated;if(Qu(t),u)if(t.flags&256)t.flags&=-257,t=Hg(e,t,s);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(l(558));else if(Wt||Fr(e,t,s,!1),u=(s&e.childLanes)!==0,Wt||u){if(a=It,a!==null&&(y=mn(a,s),y!==0&&y!==f.retryLane))throw f.retryLane=y,Qo(e,y),Mn(a,e,y),xd;Bi(),t=Hg(e,t,s)}else e=f.treeContext,Bt=ns(y.nextSibling),pn=t,bt=!0,ho=null,es=!1,e!==null&&Th(t,e),t=Oi(t,a),t.flags|=4096;return t}return e=Ms(e.child,{mode:a.mode,children:a.children}),e.ref=t.ref,t.child=e,e.return=t,e}function ki(e,t){var s=t.ref;if(s===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof s!="function"&&typeof s!="object")throw Error(l(284));(e===null||e.ref!==s)&&(t.flags|=4194816)}}function bd(e,t,s,a,u){return er(t),s=Ju(e,t,s,a,void 0,u),a=Wu(),e!==null&&!Wt?(ed(e,t,u),Us(e,t,u)):(bt&&a&&Au(t),t.flags|=1,gn(e,t,s,u),t.child)}function Bg(e,t,s,a,u,f){return er(t),t.updateQueue=null,s=Ph(t,a,s,u),Vh(e),a=Wu(),e!==null&&!Wt?(ed(e,t,f),Us(e,t,f)):(bt&&a&&Au(t),t.flags|=1,gn(e,t,s,f),t.child)}function Yg(e,t,s,a,u){if(er(t),t.stateNode===null){var f=Vr,y=s.contextType;typeof y=="object"&&y!==null&&(f=hn(y)),f=new s(a,f),t.memoizedState=f.state!==null&&f.state!==void 0?f.state:null,f.updater=hd,t.stateNode=f,f._reactInternals=t,f=t.stateNode,f.props=a,f.state=t.memoizedState,f.refs={},Gu(t),y=s.contextType,f.context=typeof y=="object"&&y!==null?hn(y):Vr,f.state=t.memoizedState,y=s.getDerivedStateFromProps,typeof y=="function"&&(pd(t,s,y,a),f.state=t.memoizedState),typeof s.getDerivedStateFromProps=="function"||typeof f.getSnapshotBeforeUpdate=="function"||typeof f.UNSAFE_componentWillMount!="function"&&typeof f.componentWillMount!="function"||(y=f.state,typeof f.componentWillMount=="function"&&f.componentWillMount(),typeof f.UNSAFE_componentWillMount=="function"&&f.UNSAFE_componentWillMount(),y!==f.state&&hd.enqueueReplaceState(f,f.state,null),$a(t,a,f,u),Ka(),f.state=t.memoizedState),typeof f.componentDidMount=="function"&&(t.flags|=4194308),a=!0}else if(e===null){f=t.stateNode;var C=t.memoizedProps,P=ar(s,C);f.props=P;var ae=f.context,ge=s.contextType;y=Vr,typeof ge=="object"&&ge!==null&&(y=hn(ge));var Ee=s.getDerivedStateFromProps;ge=typeof Ee=="function"||typeof f.getSnapshotBeforeUpdate=="function",C=t.pendingProps!==C,ge||typeof f.UNSAFE_componentWillReceiveProps!="function"&&typeof f.componentWillReceiveProps!="function"||(C||ae!==y)&&Cg(t,f,a,y),bo=!1;var le=t.memoizedState;f.state=le,$a(t,a,f,u),Ka(),ae=t.memoizedState,C||le!==ae||bo?(typeof Ee=="function"&&(pd(t,s,Ee,a),ae=t.memoizedState),(P=bo||wg(t,s,P,a,le,ae,y))?(ge||typeof f.UNSAFE_componentWillMount!="function"&&typeof f.componentWillMount!="function"||(typeof f.componentWillMount=="function"&&f.componentWillMount(),typeof f.UNSAFE_componentWillMount=="function"&&f.UNSAFE_componentWillMount()),typeof f.componentDidMount=="function"&&(t.flags|=4194308)):(typeof f.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=a,t.memoizedState=ae),f.props=a,f.state=ae,f.context=y,a=P):(typeof f.componentDidMount=="function"&&(t.flags|=4194308),a=!1)}else{f=t.stateNode,qu(e,t),y=t.memoizedProps,ge=ar(s,y),f.props=ge,Ee=t.pendingProps,le=f.context,ae=s.contextType,P=Vr,typeof ae=="object"&&ae!==null&&(P=hn(ae)),C=s.getDerivedStateFromProps,(ae=typeof C=="function"||typeof f.getSnapshotBeforeUpdate=="function")||typeof f.UNSAFE_componentWillReceiveProps!="function"&&typeof f.componentWillReceiveProps!="function"||(y!==Ee||le!==P)&&Cg(t,f,a,P),bo=!1,le=t.memoizedState,f.state=le,$a(t,a,f,u),Ka();var fe=t.memoizedState;y!==Ee||le!==fe||bo||e!==null&&e.dependencies!==null&&di(e.dependencies)?(typeof C=="function"&&(pd(t,s,C,a),fe=t.memoizedState),(ge=bo||wg(t,s,ge,a,le,fe,P)||e!==null&&e.dependencies!==null&&di(e.dependencies))?(ae||typeof f.UNSAFE_componentWillUpdate!="function"&&typeof f.componentWillUpdate!="function"||(typeof f.componentWillUpdate=="function"&&f.componentWillUpdate(a,fe,P),typeof f.UNSAFE_componentWillUpdate=="function"&&f.UNSAFE_componentWillUpdate(a,fe,P)),typeof f.componentDidUpdate=="function"&&(t.flags|=4),typeof f.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof f.componentDidUpdate!="function"||y===e.memoizedProps&&le===e.memoizedState||(t.flags|=4),typeof f.getSnapshotBeforeUpdate!="function"||y===e.memoizedProps&&le===e.memoizedState||(t.flags|=1024),t.memoizedProps=a,t.memoizedState=fe),f.props=a,f.state=fe,f.context=P,a=ge):(typeof f.componentDidUpdate!="function"||y===e.memoizedProps&&le===e.memoizedState||(t.flags|=4),typeof f.getSnapshotBeforeUpdate!="function"||y===e.memoizedProps&&le===e.memoizedState||(t.flags|=1024),a=!1)}return f=a,ki(e,t),a=(t.flags&128)!==0,f||a?(f=t.stateNode,s=a&&typeof s.getDerivedStateFromError!="function"?null:f.render(),t.flags|=1,e!==null&&a?(t.child=or(t,e.child,null,u),t.child=or(t,null,s,u)):gn(e,t,s,u),t.memoizedState=f.state,e=t.child):e=Us(e,t,u),e}function Vg(e,t,s,a){return Jo(),t.flags|=256,gn(e,t,s,a),t.child}var yd={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function vd(e){return{baseLanes:e,cachePool:_h()}}function Sd(e,t,s){return e=e!==null?e.childLanes&~s:0,t&&(e|=Vn),e}function Pg(e,t,s){var a=t.pendingProps,u=!1,f=(t.flags&128)!==0,y;if((y=f)||(y=e!==null&&e.memoizedState===null?!1:($t.current&2)!==0),y&&(u=!0,t.flags&=-129),y=(t.flags&32)!==0,t.flags&=-33,e===null){if(bt){if(u?So(t):Eo(),(e=Bt)?(e=Zx(e,es),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:po!==null?{id:ms,overflow:ps}:null,retryLane:536870912,hydrationErrors:null},s=Eh(e),s.return=t,t.child=s,pn=t,Bt=null)):e=null,e===null)throw go(t);return sf(e)?t.lanes=32:t.lanes=536870912,null}var C=a.children;return a=a.fallback,u?(Eo(),u=t.mode,C=_i({mode:"hidden",children:C},u),a=Zo(a,u,s,null),C.return=t,a.return=t,C.sibling=a,t.child=C,a=t.child,a.memoizedState=vd(s),a.childLanes=Sd(e,y,s),t.memoizedState=yd,el(null,a)):(So(t),Ed(t,C))}var P=e.memoizedState;if(P!==null&&(C=P.dehydrated,C!==null)){if(f)t.flags&256?(So(t),t.flags&=-257,t=Nd(e,t,s)):t.memoizedState!==null?(Eo(),t.child=e.child,t.flags|=128,t=null):(Eo(),C=a.fallback,u=t.mode,a=_i({mode:"visible",children:a.children},u),C=Zo(C,u,s,null),C.flags|=2,a.return=t,C.return=t,a.sibling=C,t.child=a,or(t,e.child,null,s),a=t.child,a.memoizedState=vd(s),a.childLanes=Sd(e,y,s),t.memoizedState=yd,t=el(null,a));else if(So(t),sf(C)){if(y=C.nextSibling&&C.nextSibling.dataset,y)var ae=y.dgst;y=ae,a=Error(l(419)),a.stack="",a.digest=y,Va({value:a,source:null,stack:null}),t=Nd(e,t,s)}else if(Wt||Fr(e,t,s,!1),y=(s&e.childLanes)!==0,Wt||y){if(y=It,y!==null&&(a=mn(y,s),a!==0&&a!==P.retryLane))throw P.retryLane=a,Qo(e,a),Mn(y,e,a),xd;nf(C)||Bi(),t=Nd(e,t,s)}else nf(C)?(t.flags|=192,t.child=e.child,t=null):(e=P.treeContext,Bt=ns(C.nextSibling),pn=t,bt=!0,ho=null,es=!1,e!==null&&Th(t,e),t=Ed(t,a.children),t.flags|=4096);return t}return u?(Eo(),C=a.fallback,u=t.mode,P=e.child,ae=P.sibling,a=Ms(P,{mode:"hidden",children:a.children}),a.subtreeFlags=P.subtreeFlags&65011712,ae!==null?C=Ms(ae,C):(C=Zo(C,u,s,null),C.flags|=2),C.return=t,a.return=t,a.sibling=C,t.child=a,el(null,a),a=t.child,C=e.child.memoizedState,C===null?C=vd(s):(u=C.cachePool,u!==null?(P=Zt._currentValue,u=u.parent!==P?{parent:P,pool:P}:u):u=_h(),C={baseLanes:C.baseLanes|s,cachePool:u}),a.memoizedState=C,a.childLanes=Sd(e,y,s),t.memoizedState=yd,el(e.child,a)):(So(t),s=e.child,e=s.sibling,s=Ms(s,{mode:"visible",children:a.children}),s.return=t,s.sibling=null,e!==null&&(y=t.deletions,y===null?(t.deletions=[e],t.flags|=16):y.push(e)),t.child=s,t.memoizedState=null,s)}function Ed(e,t){return t=_i({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function _i(e,t){return e=Un(22,e,null,t),e.lanes=0,e}function Nd(e,t,s){return or(t,e.child,null,s),e=Ed(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Gg(e,t,s){e.lanes|=t;var a=e.alternate;a!==null&&(a.lanes|=t),Uu(e.return,t,s)}function jd(e,t,s,a,u,f){var y=e.memoizedState;y===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:a,tail:s,tailMode:u,treeForkCount:f}:(y.isBackwards=t,y.rendering=null,y.renderingStartTime=0,y.last=a,y.tail=s,y.tailMode=u,y.treeForkCount=f)}function qg(e,t,s){var a=t.pendingProps,u=a.revealOrder,f=a.tail;a=a.children;var y=$t.current,C=(y&2)!==0;if(C?(y=y&1|2,t.flags|=128):y&=1,L($t,y),gn(e,t,a,s),a=bt?Ya:0,!C&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Gg(e,s,t);else if(e.tag===19)Gg(e,s,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(u){case"forwards":for(s=t.child,u=null;s!==null;)e=s.alternate,e!==null&&yi(e)===null&&(u=s),s=s.sibling;s=u,s===null?(u=t.child,t.child=null):(u=s.sibling,s.sibling=null),jd(t,!1,u,s,f,a);break;case"backwards":case"unstable_legacy-backwards":for(s=null,u=t.child,t.child=null;u!==null;){if(e=u.alternate,e!==null&&yi(e)===null){t.child=u;break}e=u.sibling,u.sibling=s,s=u,u=e}jd(t,!0,s,null,f,a);break;case"together":jd(t,!1,null,null,void 0,a);break;default:t.memoizedState=null}return t.child}function Us(e,t,s){if(e!==null&&(t.dependencies=e.dependencies),To|=t.lanes,(s&t.childLanes)===0)if(e!==null){if(Fr(e,t,s,!1),(s&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(l(153));if(t.child!==null){for(e=t.child,s=Ms(e,e.pendingProps),t.child=s,s.return=t;e.sibling!==null;)e=e.sibling,s=s.sibling=Ms(e,e.pendingProps),s.return=t;s.sibling=null}return t.child}function Td(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&di(e)))}function vE(e,t,s){switch(t.tag){case 3:ue(t,t.stateNode.containerInfo),xo(t,Zt,e.memoizedState.cache),Jo();break;case 27:case 5:Le(t);break;case 4:ue(t,t.stateNode.containerInfo);break;case 10:xo(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,Qu(t),null;break;case 13:var a=t.memoizedState;if(a!==null)return a.dehydrated!==null?(So(t),t.flags|=128,null):(s&t.child.childLanes)!==0?Pg(e,t,s):(So(t),e=Us(e,t,s),e!==null?e.sibling:null);So(t);break;case 19:var u=(e.flags&128)!==0;if(a=(s&t.childLanes)!==0,a||(Fr(e,t,s,!1),a=(s&t.childLanes)!==0),u){if(a)return qg(e,t,s);t.flags|=128}if(u=t.memoizedState,u!==null&&(u.rendering=null,u.tail=null,u.lastEffect=null),L($t,$t.current),a)break;return null;case 22:return t.lanes=0,Ig(e,t,s,t.pendingProps);case 24:xo(t,Zt,e.memoizedState.cache)}return Us(e,t,s)}function Fg(e,t,s){if(e!==null)if(e.memoizedProps!==t.pendingProps)Wt=!0;else{if(!Td(e,s)&&(t.flags&128)===0)return Wt=!1,vE(e,t,s);Wt=(e.flags&131072)!==0}else Wt=!1,bt&&(t.flags&1048576)!==0&&jh(t,Ya,t.index);switch(t.lanes=0,t.tag){case 16:e:{var a=t.pendingProps;if(e=nr(t.elementType),t.type=e,typeof e=="function")ku(e)?(a=ar(e,a),t.tag=1,t=Yg(null,t,e,a,s)):(t.tag=0,t=bd(null,t,e,a,s));else{if(e!=null){var u=e.$$typeof;if(u===R){t.tag=11,t=Dg(null,t,e,a,s);break e}else if(u===B){t.tag=14,t=zg(null,t,e,a,s);break e}}throw t=te(e)||e,Error(l(306,t,""))}}return t;case 0:return bd(e,t,t.type,t.pendingProps,s);case 1:return a=t.type,u=ar(a,t.pendingProps),Yg(e,t,a,u,s);case 3:e:{if(ue(t,t.stateNode.containerInfo),e===null)throw Error(l(387));a=t.pendingProps;var f=t.memoizedState;u=f.element,qu(e,t),$a(t,a,null,s);var y=t.memoizedState;if(a=y.cache,xo(t,Zt,a),a!==f.cache&&Hu(t,[Zt],s,!0),Ka(),a=y.element,f.isDehydrated)if(f={element:a,isDehydrated:!1,cache:y.cache},t.updateQueue.baseState=f,t.memoizedState=f,t.flags&256){t=Vg(e,t,a,s);break e}else if(a!==u){u=Zn(Error(l(424)),t),Va(u),t=Vg(e,t,a,s);break e}else for(e=t.stateNode.containerInfo,e.nodeType===9?e=e.body:e=e.nodeName==="HTML"?e.ownerDocument.body:e,Bt=ns(e.firstChild),pn=t,bt=!0,ho=null,es=!0,s=Ih(t,null,a,s),t.child=s;s;)s.flags=s.flags&-3|4096,s=s.sibling;else{if(Jo(),a===u){t=Us(e,t,s);break e}gn(e,t,a,s)}t=t.child}return t;case 26:return ki(e,t),e===null?(s=sb(t.type,null,t.pendingProps,null))?t.memoizedState=s:bt||(s=t.type,e=t.pendingProps,a=Xi(V.current).createElement(s),a[nn]=t,a[wn]=e,xn(a,s,e),ln(a),t.stateNode=a):t.memoizedState=sb(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return Le(t),e===null&&bt&&(a=t.stateNode=eb(t.type,t.pendingProps,V.current),pn=t,es=!0,u=Bt,ko(t.type)?(of=u,Bt=ns(a.firstChild)):Bt=u),gn(e,t,t.pendingProps.children,s),ki(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&bt&&((u=a=Bt)&&(a=QE(a,t.type,t.pendingProps,es),a!==null?(t.stateNode=a,pn=t,Bt=ns(a.firstChild),es=!1,u=!0):u=!1),u||go(t)),Le(t),u=t.type,f=t.pendingProps,y=e!==null?e.memoizedProps:null,a=f.children,Wd(u,f)?a=null:y!==null&&Wd(u,y)&&(t.flags|=32),t.memoizedState!==null&&(u=Ju(e,t,dE,null,null,s),hl._currentValue=u),ki(e,t),gn(e,t,a,s),t.child;case 6:return e===null&&bt&&((e=s=Bt)&&(s=ZE(s,t.pendingProps,es),s!==null?(t.stateNode=s,pn=t,Bt=null,e=!0):e=!1),e||go(t)),null;case 13:return Pg(e,t,s);case 4:return ue(t,t.stateNode.containerInfo),a=t.pendingProps,e===null?t.child=or(t,null,a,s):gn(e,t,a,s),t.child;case 11:return Dg(e,t,t.type,t.pendingProps,s);case 7:return gn(e,t,t.pendingProps,s),t.child;case 8:return gn(e,t,t.pendingProps.children,s),t.child;case 12:return gn(e,t,t.pendingProps.children,s),t.child;case 10:return a=t.pendingProps,xo(t,t.type,a.value),gn(e,t,a.children,s),t.child;case 9:return u=t.type._context,a=t.pendingProps.children,er(t),u=hn(u),a=a(u),t.flags|=1,gn(e,t,a,s),t.child;case 14:return zg(e,t,t.type,t.pendingProps,s);case 15:return Lg(e,t,t.type,t.pendingProps,s);case 19:return qg(e,t,s);case 31:return yE(e,t,s);case 22:return Ig(e,t,s,t.pendingProps);case 24:return er(t),a=hn(Zt),e===null?(u=Vu(),u===null&&(u=It,f=Bu(),u.pooledCache=f,f.refCount++,f!==null&&(u.pooledCacheLanes|=s),u=f),t.memoizedState={parent:a,cache:u},Gu(t),xo(t,Zt,u)):((e.lanes&s)!==0&&(qu(e,t),$a(t,null,null,s),Ka()),u=e.memoizedState,f=t.memoizedState,u.parent!==a?(u={parent:a,cache:a},t.memoizedState=u,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=u),xo(t,Zt,a)):(a=f.cache,xo(t,Zt,a),a!==u.cache&&Hu(t,[Zt],s,!0))),gn(e,t,t.pendingProps.children,s),t.child;case 29:throw t.pendingProps}throw Error(l(156,t.tag))}function Hs(e){e.flags|=4}function wd(e,t,s,a,u){if((t=(e.mode&32)!==0)&&(t=!1),t){if(e.flags|=16777216,(u&335544128)===u)if(e.stateNode.complete)e.flags|=8192;else if(yx())e.flags|=8192;else throw sr=hi,Pu}else e.flags&=-16777217}function Xg(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!ib(t))if(yx())e.flags|=8192;else throw sr=hi,Pu}function Mi(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?et():536870912,e.lanes|=t,oa|=t)}function tl(e,t){if(!bt)switch(e.tailMode){case"hidden":t=e.tail;for(var s=null;t!==null;)t.alternate!==null&&(s=t),t=t.sibling;s===null?e.tail=null:s.sibling=null;break;case"collapsed":s=e.tail;for(var a=null;s!==null;)s.alternate!==null&&(a=s),s=s.sibling;a===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:a.sibling=null}}function Yt(e){var t=e.alternate!==null&&e.alternate.child===e.child,s=0,a=0;if(t)for(var u=e.child;u!==null;)s|=u.lanes|u.childLanes,a|=u.subtreeFlags&65011712,a|=u.flags&65011712,u.return=e,u=u.sibling;else for(u=e.child;u!==null;)s|=u.lanes|u.childLanes,a|=u.subtreeFlags,a|=u.flags,u.return=e,u=u.sibling;return e.subtreeFlags|=a,e.childLanes=s,t}function SE(e,t,s){var a=t.pendingProps;switch(Du(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Yt(t),null;case 1:return Yt(t),null;case 3:return s=t.stateNode,a=null,e!==null&&(a=e.memoizedState.cache),t.memoizedState.cache!==a&&(t.flags|=2048),zs(Zt),he(),s.pendingContext&&(s.context=s.pendingContext,s.pendingContext=null),(e===null||e.child===null)&&(qr(t)?Hs(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,Lu())),Yt(t),null;case 26:var u=t.type,f=t.memoizedState;return e===null?(Hs(t),f!==null?(Yt(t),Xg(t,f)):(Yt(t),wd(t,u,null,a,s))):f?f!==e.memoizedState?(Hs(t),Yt(t),Xg(t,f)):(Yt(t),t.flags&=-16777217):(e=e.memoizedProps,e!==a&&Hs(t),Yt(t),wd(t,u,e,a,s)),null;case 27:if(qe(t),s=V.current,u=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==a&&Hs(t);else{if(!a){if(t.stateNode===null)throw Error(l(166));return Yt(t),null}e=q.current,qr(t)?wh(t):(e=eb(u,a,s),t.stateNode=e,Hs(t))}return Yt(t),null;case 5:if(qe(t),u=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==a&&Hs(t);else{if(!a){if(t.stateNode===null)throw Error(l(166));return Yt(t),null}if(f=q.current,qr(t))wh(t);else{var y=Xi(V.current);switch(f){case 1:f=y.createElementNS("http://www.w3.org/2000/svg",u);break;case 2:f=y.createElementNS("http://www.w3.org/1998/Math/MathML",u);break;default:switch(u){case"svg":f=y.createElementNS("http://www.w3.org/2000/svg",u);break;case"math":f=y.createElementNS("http://www.w3.org/1998/Math/MathML",u);break;case"script":f=y.createElement("div"),f.innerHTML="<script><\/script>",f=f.removeChild(f.firstChild);break;case"select":f=typeof a.is=="string"?y.createElement("select",{is:a.is}):y.createElement("select"),a.multiple?f.multiple=!0:a.size&&(f.size=a.size);break;default:f=typeof a.is=="string"?y.createElement(u,{is:a.is}):y.createElement(u)}}f[nn]=t,f[wn]=a;e:for(y=t.child;y!==null;){if(y.tag===5||y.tag===6)f.appendChild(y.stateNode);else if(y.tag!==4&&y.tag!==27&&y.child!==null){y.child.return=y,y=y.child;continue}if(y===t)break e;for(;y.sibling===null;){if(y.return===null||y.return===t)break e;y=y.return}y.sibling.return=y.return,y=y.sibling}t.stateNode=f;e:switch(xn(f,u,a),u){case"button":case"input":case"select":case"textarea":a=!!a.autoFocus;break e;case"img":a=!0;break e;default:a=!1}a&&Hs(t)}}return Yt(t),wd(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,s),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==a&&Hs(t);else{if(typeof a!="string"&&t.stateNode===null)throw Error(l(166));if(e=V.current,qr(t)){if(e=t.stateNode,s=t.memoizedProps,a=null,u=pn,u!==null)switch(u.tag){case 27:case 5:a=u.memoizedProps}e[nn]=t,e=!!(e.nodeValue===s||a!==null&&a.suppressHydrationWarning===!0||Px(e.nodeValue,s)),e||go(t,!0)}else e=Xi(e).createTextNode(a),e[nn]=t,t.stateNode=e}return Yt(t),null;case 31:if(s=t.memoizedState,e===null||e.memoizedState!==null){if(a=qr(t),s!==null){if(e===null){if(!a)throw Error(l(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(l(557));e[nn]=t}else Jo(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Yt(t),e=!1}else s=Lu(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=s),e=!0;if(!e)return t.flags&256?(Bn(t),t):(Bn(t),null);if((t.flags&128)!==0)throw Error(l(558))}return Yt(t),null;case 13:if(a=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(u=qr(t),a!==null&&a.dehydrated!==null){if(e===null){if(!u)throw Error(l(318));if(u=t.memoizedState,u=u!==null?u.dehydrated:null,!u)throw Error(l(317));u[nn]=t}else Jo(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Yt(t),u=!1}else u=Lu(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=u),u=!0;if(!u)return t.flags&256?(Bn(t),t):(Bn(t),null)}return Bn(t),(t.flags&128)!==0?(t.lanes=s,t):(s=a!==null,e=e!==null&&e.memoizedState!==null,s&&(a=t.child,u=null,a.alternate!==null&&a.alternate.memoizedState!==null&&a.alternate.memoizedState.cachePool!==null&&(u=a.alternate.memoizedState.cachePool.pool),f=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(f=a.memoizedState.cachePool.pool),f!==u&&(a.flags|=2048)),s!==e&&s&&(t.child.flags|=8192),Mi(t,t.updateQueue),Yt(t),null);case 4:return he(),e===null&&Kd(t.stateNode.containerInfo),Yt(t),null;case 10:return zs(t.type),Yt(t),null;case 19:if(G($t),a=t.memoizedState,a===null)return Yt(t),null;if(u=(t.flags&128)!==0,f=a.rendering,f===null)if(u)tl(a,!1);else{if(Ft!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(f=yi(e),f!==null){for(t.flags|=128,tl(a,!1),e=f.updateQueue,t.updateQueue=e,Mi(t,e),t.subtreeFlags=0,e=s,s=t.child;s!==null;)Sh(s,e),s=s.sibling;return L($t,$t.current&1|2),bt&&As(t,a.treeForkCount),t.child}e=e.sibling}a.tail!==null&&ie()>Ii&&(t.flags|=128,u=!0,tl(a,!1),t.lanes=4194304)}else{if(!u)if(e=yi(f),e!==null){if(t.flags|=128,u=!0,e=e.updateQueue,t.updateQueue=e,Mi(t,e),tl(a,!0),a.tail===null&&a.tailMode==="hidden"&&!f.alternate&&!bt)return Yt(t),null}else 2*ie()-a.renderingStartTime>Ii&&s!==536870912&&(t.flags|=128,u=!0,tl(a,!1),t.lanes=4194304);a.isBackwards?(f.sibling=t.child,t.child=f):(e=a.last,e!==null?e.sibling=f:t.child=f,a.last=f)}return a.tail!==null?(e=a.tail,a.rendering=e,a.tail=e.sibling,a.renderingStartTime=ie(),e.sibling=null,s=$t.current,L($t,u?s&1|2:s&1),bt&&As(t,a.treeForkCount),e):(Yt(t),null);case 22:case 23:return Bn(t),$u(),a=t.memoizedState!==null,e!==null?e.memoizedState!==null!==a&&(t.flags|=8192):a&&(t.flags|=8192),a?(s&536870912)!==0&&(t.flags&128)===0&&(Yt(t),t.subtreeFlags&6&&(t.flags|=8192)):Yt(t),s=t.updateQueue,s!==null&&Mi(t,s.retryQueue),s=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(s=e.memoizedState.cachePool.pool),a=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(a=t.memoizedState.cachePool.pool),a!==s&&(t.flags|=2048),e!==null&&G(tr),null;case 24:return s=null,e!==null&&(s=e.memoizedState.cache),t.memoizedState.cache!==s&&(t.flags|=2048),zs(Zt),Yt(t),null;case 25:return null;case 30:return null}throw Error(l(156,t.tag))}function EE(e,t){switch(Du(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return zs(Zt),he(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return qe(t),null;case 31:if(t.memoizedState!==null){if(Bn(t),t.alternate===null)throw Error(l(340));Jo()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(Bn(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(l(340));Jo()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return G($t),null;case 4:return he(),null;case 10:return zs(t.type),null;case 22:case 23:return Bn(t),$u(),e!==null&&G(tr),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return zs(Zt),null;case 25:return null;default:return null}}function Kg(e,t){switch(Du(t),t.tag){case 3:zs(Zt),he();break;case 26:case 27:case 5:qe(t);break;case 4:he();break;case 31:t.memoizedState!==null&&Bn(t);break;case 13:Bn(t);break;case 19:G($t);break;case 10:zs(t.type);break;case 22:case 23:Bn(t),$u(),e!==null&&G(tr);break;case 24:zs(Zt)}}function nl(e,t){try{var s=t.updateQueue,a=s!==null?s.lastEffect:null;if(a!==null){var u=a.next;s=u;do{if((s.tag&e)===e){a=void 0;var f=s.create,y=s.inst;a=f(),y.destroy=a}s=s.next}while(s!==u)}}catch(C){Mt(t,t.return,C)}}function No(e,t,s){try{var a=t.updateQueue,u=a!==null?a.lastEffect:null;if(u!==null){var f=u.next;a=f;do{if((a.tag&e)===e){var y=a.inst,C=y.destroy;if(C!==void 0){y.destroy=void 0,u=t;var P=s,ae=C;try{ae()}catch(ge){Mt(u,P,ge)}}}a=a.next}while(a!==f)}}catch(ge){Mt(t,t.return,ge)}}function $g(e){var t=e.updateQueue;if(t!==null){var s=e.stateNode;try{Hh(t,s)}catch(a){Mt(e,e.return,a)}}}function Qg(e,t,s){s.props=ar(e.type,e.memoizedProps),s.state=e.memoizedState;try{s.componentWillUnmount()}catch(a){Mt(e,t,a)}}function sl(e,t){try{var s=e.ref;if(s!==null){switch(e.tag){case 26:case 27:case 5:var a=e.stateNode;break;case 30:a=e.stateNode;break;default:a=e.stateNode}typeof s=="function"?e.refCleanup=s(a):s.current=a}}catch(u){Mt(e,t,u)}}function hs(e,t){var s=e.ref,a=e.refCleanup;if(s!==null)if(typeof a=="function")try{a()}catch(u){Mt(e,t,u)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof s=="function")try{s(null)}catch(u){Mt(e,t,u)}else s.current=null}function Zg(e){var t=e.type,s=e.memoizedProps,a=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":s.autoFocus&&a.focus();break e;case"img":s.src?a.src=s.src:s.srcSet&&(a.srcset=s.srcSet)}}catch(u){Mt(e,e.return,u)}}function Cd(e,t,s){try{var a=e.stateNode;GE(a,e.type,s,t),a[wn]=t}catch(u){Mt(e,e.return,u)}}function Jg(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&ko(e.type)||e.tag===4}function Rd(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Jg(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&ko(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Od(e,t,s){var a=e.tag;if(a===5||a===6)e=e.stateNode,t?(s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s).insertBefore(e,t):(t=s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s,t.appendChild(e),s=s._reactRootContainer,s!=null||t.onclick!==null||(t.onclick=ks));else if(a!==4&&(a===27&&ko(e.type)&&(s=e.stateNode,t=null),e=e.child,e!==null))for(Od(e,t,s),e=e.sibling;e!==null;)Od(e,t,s),e=e.sibling}function Ai(e,t,s){var a=e.tag;if(a===5||a===6)e=e.stateNode,t?s.insertBefore(e,t):s.appendChild(e);else if(a!==4&&(a===27&&ko(e.type)&&(s=e.stateNode),e=e.child,e!==null))for(Ai(e,t,s),e=e.sibling;e!==null;)Ai(e,t,s),e=e.sibling}function Wg(e){var t=e.stateNode,s=e.memoizedProps;try{for(var a=e.type,u=t.attributes;u.length;)t.removeAttributeNode(u[0]);xn(t,a,s),t[nn]=e,t[wn]=s}catch(f){Mt(e,e.return,f)}}var Bs=!1,en=!1,kd=!1,ex=typeof WeakSet=="function"?WeakSet:Set,cn=null;function NE(e,t){if(e=e.containerInfo,Zd=ec,e=fh(e),Nu(e)){if("selectionStart"in e)var s={start:e.selectionStart,end:e.selectionEnd};else e:{s=(s=e.ownerDocument)&&s.defaultView||window;var a=s.getSelection&&s.getSelection();if(a&&a.rangeCount!==0){s=a.anchorNode;var u=a.anchorOffset,f=a.focusNode;a=a.focusOffset;try{s.nodeType,f.nodeType}catch{s=null;break e}var y=0,C=-1,P=-1,ae=0,ge=0,Ee=e,le=null;t:for(;;){for(var fe;Ee!==s||u!==0&&Ee.nodeType!==3||(C=y+u),Ee!==f||a!==0&&Ee.nodeType!==3||(P=y+a),Ee.nodeType===3&&(y+=Ee.nodeValue.length),(fe=Ee.firstChild)!==null;)le=Ee,Ee=fe;for(;;){if(Ee===e)break t;if(le===s&&++ae===u&&(C=y),le===f&&++ge===a&&(P=y),(fe=Ee.nextSibling)!==null)break;Ee=le,le=Ee.parentNode}Ee=fe}s=C===-1||P===-1?null:{start:C,end:P}}else s=null}s=s||{start:0,end:0}}else s=null;for(Jd={focusedElem:e,selectionRange:s},ec=!1,cn=t;cn!==null;)if(t=cn,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,cn=e;else for(;cn!==null;){switch(t=cn,f=t.alternate,e=t.flags,t.tag){case 0:if((e&4)!==0&&(e=t.updateQueue,e=e!==null?e.events:null,e!==null))for(s=0;s<e.length;s++)u=e[s],u.ref.impl=u.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&f!==null){e=void 0,s=t,u=f.memoizedProps,f=f.memoizedState,a=s.stateNode;try{var Ve=ar(s.type,u);e=a.getSnapshotBeforeUpdate(Ve,f),a.__reactInternalSnapshotBeforeUpdate=e}catch(Ze){Mt(s,s.return,Ze)}}break;case 3:if((e&1024)!==0){if(e=t.stateNode.containerInfo,s=e.nodeType,s===9)tf(e);else if(s===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":tf(e);break;default:e.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((e&1024)!==0)throw Error(l(163))}if(e=t.sibling,e!==null){e.return=t.return,cn=e;break}cn=t.return}}function tx(e,t,s){var a=s.flags;switch(s.tag){case 0:case 11:case 15:Vs(e,s),a&4&&nl(5,s);break;case 1:if(Vs(e,s),a&4)if(e=s.stateNode,t===null)try{e.componentDidMount()}catch(y){Mt(s,s.return,y)}else{var u=ar(s.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(u,t,e.__reactInternalSnapshotBeforeUpdate)}catch(y){Mt(s,s.return,y)}}a&64&&$g(s),a&512&&sl(s,s.return);break;case 3:if(Vs(e,s),a&64&&(e=s.updateQueue,e!==null)){if(t=null,s.child!==null)switch(s.child.tag){case 27:case 5:t=s.child.stateNode;break;case 1:t=s.child.stateNode}try{Hh(e,t)}catch(y){Mt(s,s.return,y)}}break;case 27:t===null&&a&4&&Wg(s);case 26:case 5:Vs(e,s),t===null&&a&4&&Zg(s),a&512&&sl(s,s.return);break;case 12:Vs(e,s);break;case 31:Vs(e,s),a&4&&ox(e,s);break;case 13:Vs(e,s),a&4&&rx(e,s),a&64&&(e=s.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(s=ME.bind(null,s),JE(e,s))));break;case 22:if(a=s.memoizedState!==null||Bs,!a){t=t!==null&&t.memoizedState!==null||en,u=Bs;var f=en;Bs=a,(en=t)&&!f?Ps(e,s,(s.subtreeFlags&8772)!==0):Vs(e,s),Bs=u,en=f}break;case 30:break;default:Vs(e,s)}}function nx(e){var t=e.alternate;t!==null&&(e.alternate=null,nx(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&au(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var Pt=null,Rn=!1;function Ys(e,t,s){for(s=s.child;s!==null;)sx(e,t,s),s=s.sibling}function sx(e,t,s){if(Et&&typeof Et.onCommitFiberUnmount=="function")try{Et.onCommitFiberUnmount(st,s)}catch{}switch(s.tag){case 26:en||hs(s,t),Ys(e,t,s),s.memoizedState?s.memoizedState.count--:s.stateNode&&(s=s.stateNode,s.parentNode.removeChild(s));break;case 27:en||hs(s,t);var a=Pt,u=Rn;ko(s.type)&&(Pt=s.stateNode,Rn=!1),Ys(e,t,s),fl(s.stateNode),Pt=a,Rn=u;break;case 5:en||hs(s,t);case 6:if(a=Pt,u=Rn,Pt=null,Ys(e,t,s),Pt=a,Rn=u,Pt!==null)if(Rn)try{(Pt.nodeType===9?Pt.body:Pt.nodeName==="HTML"?Pt.ownerDocument.body:Pt).removeChild(s.stateNode)}catch(f){Mt(s,t,f)}else try{Pt.removeChild(s.stateNode)}catch(f){Mt(s,t,f)}break;case 18:Pt!==null&&(Rn?(e=Pt,$x(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,s.stateNode),fa(e)):$x(Pt,s.stateNode));break;case 4:a=Pt,u=Rn,Pt=s.stateNode.containerInfo,Rn=!0,Ys(e,t,s),Pt=a,Rn=u;break;case 0:case 11:case 14:case 15:No(2,s,t),en||No(4,s,t),Ys(e,t,s);break;case 1:en||(hs(s,t),a=s.stateNode,typeof a.componentWillUnmount=="function"&&Qg(s,t,a)),Ys(e,t,s);break;case 21:Ys(e,t,s);break;case 22:en=(a=en)||s.memoizedState!==null,Ys(e,t,s),en=a;break;default:Ys(e,t,s)}}function ox(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{fa(e)}catch(s){Mt(t,t.return,s)}}}function rx(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{fa(e)}catch(s){Mt(t,t.return,s)}}function jE(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new ex),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new ex),t;default:throw Error(l(435,e.tag))}}function Di(e,t){var s=jE(e);t.forEach(function(a){if(!s.has(a)){s.add(a);var u=AE.bind(null,e,a);a.then(u,u)}})}function On(e,t){var s=t.deletions;if(s!==null)for(var a=0;a<s.length;a++){var u=s[a],f=e,y=t,C=y;e:for(;C!==null;){switch(C.tag){case 27:if(ko(C.type)){Pt=C.stateNode,Rn=!1;break e}break;case 5:Pt=C.stateNode,Rn=!1;break e;case 3:case 4:Pt=C.stateNode.containerInfo,Rn=!0;break e}C=C.return}if(Pt===null)throw Error(l(160));sx(f,y,u),Pt=null,Rn=!1,f=u.alternate,f!==null&&(f.return=null),u.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)ax(t,e),t=t.sibling}var cs=null;function ax(e,t){var s=e.alternate,a=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:On(t,e),kn(e),a&4&&(No(3,e,e.return),nl(3,e),No(5,e,e.return));break;case 1:On(t,e),kn(e),a&512&&(en||s===null||hs(s,s.return)),a&64&&Bs&&(e=e.updateQueue,e!==null&&(a=e.callbacks,a!==null&&(s=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=s===null?a:s.concat(a))));break;case 26:var u=cs;if(On(t,e),kn(e),a&512&&(en||s===null||hs(s,s.return)),a&4){var f=s!==null?s.memoizedState:null;if(a=e.memoizedState,s===null)if(a===null)if(e.stateNode===null){e:{a=e.type,s=e.memoizedProps,u=u.ownerDocument||u;t:switch(a){case"title":f=u.getElementsByTagName("title")[0],(!f||f[ka]||f[nn]||f.namespaceURI==="http://www.w3.org/2000/svg"||f.hasAttribute("itemprop"))&&(f=u.createElement(a),u.head.insertBefore(f,u.querySelector("head > title"))),xn(f,a,s),f[nn]=e,ln(f),a=f;break e;case"link":var y=ab("link","href",u).get(a+(s.href||""));if(y){for(var C=0;C<y.length;C++)if(f=y[C],f.getAttribute("href")===(s.href==null||s.href===""?null:s.href)&&f.getAttribute("rel")===(s.rel==null?null:s.rel)&&f.getAttribute("title")===(s.title==null?null:s.title)&&f.getAttribute("crossorigin")===(s.crossOrigin==null?null:s.crossOrigin)){y.splice(C,1);break t}}f=u.createElement(a),xn(f,a,s),u.head.appendChild(f);break;case"meta":if(y=ab("meta","content",u).get(a+(s.content||""))){for(C=0;C<y.length;C++)if(f=y[C],f.getAttribute("content")===(s.content==null?null:""+s.content)&&f.getAttribute("name")===(s.name==null?null:s.name)&&f.getAttribute("property")===(s.property==null?null:s.property)&&f.getAttribute("http-equiv")===(s.httpEquiv==null?null:s.httpEquiv)&&f.getAttribute("charset")===(s.charSet==null?null:s.charSet)){y.splice(C,1);break t}}f=u.createElement(a),xn(f,a,s),u.head.appendChild(f);break;default:throw Error(l(468,a))}f[nn]=e,ln(f),a=f}e.stateNode=a}else lb(u,e.type,e.stateNode);else e.stateNode=rb(u,a,e.memoizedProps);else f!==a?(f===null?s.stateNode!==null&&(s=s.stateNode,s.parentNode.removeChild(s)):f.count--,a===null?lb(u,e.type,e.stateNode):rb(u,a,e.memoizedProps)):a===null&&e.stateNode!==null&&Cd(e,e.memoizedProps,s.memoizedProps)}break;case 27:On(t,e),kn(e),a&512&&(en||s===null||hs(s,s.return)),s!==null&&a&4&&Cd(e,e.memoizedProps,s.memoizedProps);break;case 5:if(On(t,e),kn(e),a&512&&(en||s===null||hs(s,s.return)),e.flags&32){u=e.stateNode;try{zr(u,"")}catch(Ve){Mt(e,e.return,Ve)}}a&4&&e.stateNode!=null&&(u=e.memoizedProps,Cd(e,u,s!==null?s.memoizedProps:u)),a&1024&&(kd=!0);break;case 6:if(On(t,e),kn(e),a&4){if(e.stateNode===null)throw Error(l(162));a=e.memoizedProps,s=e.stateNode;try{s.nodeValue=a}catch(Ve){Mt(e,e.return,Ve)}}break;case 3:if(Qi=null,u=cs,cs=Ki(t.containerInfo),On(t,e),cs=u,kn(e),a&4&&s!==null&&s.memoizedState.isDehydrated)try{fa(t.containerInfo)}catch(Ve){Mt(e,e.return,Ve)}kd&&(kd=!1,lx(e));break;case 4:a=cs,cs=Ki(e.stateNode.containerInfo),On(t,e),kn(e),cs=a;break;case 12:On(t,e),kn(e);break;case 31:On(t,e),kn(e),a&4&&(a=e.updateQueue,a!==null&&(e.updateQueue=null,Di(e,a)));break;case 13:On(t,e),kn(e),e.child.flags&8192&&e.memoizedState!==null!=(s!==null&&s.memoizedState!==null)&&(Li=ie()),a&4&&(a=e.updateQueue,a!==null&&(e.updateQueue=null,Di(e,a)));break;case 22:u=e.memoizedState!==null;var P=s!==null&&s.memoizedState!==null,ae=Bs,ge=en;if(Bs=ae||u,en=ge||P,On(t,e),en=ge,Bs=ae,kn(e),a&8192)e:for(t=e.stateNode,t._visibility=u?t._visibility&-2:t._visibility|1,u&&(s===null||P||Bs||en||lr(e)),s=null,t=e;;){if(t.tag===5||t.tag===26){if(s===null){P=s=t;try{if(f=P.stateNode,u)y=f.style,typeof y.setProperty=="function"?y.setProperty("display","none","important"):y.display="none";else{C=P.stateNode;var Ee=P.memoizedProps.style,le=Ee!=null&&Ee.hasOwnProperty("display")?Ee.display:null;C.style.display=le==null||typeof le=="boolean"?"":(""+le).trim()}}catch(Ve){Mt(P,P.return,Ve)}}}else if(t.tag===6){if(s===null){P=t;try{P.stateNode.nodeValue=u?"":P.memoizedProps}catch(Ve){Mt(P,P.return,Ve)}}}else if(t.tag===18){if(s===null){P=t;try{var fe=P.stateNode;u?Qx(fe,!0):Qx(P.stateNode,!1)}catch(Ve){Mt(P,P.return,Ve)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;s===t&&(s=null),t=t.return}s===t&&(s=null),t.sibling.return=t.return,t=t.sibling}a&4&&(a=e.updateQueue,a!==null&&(s=a.retryQueue,s!==null&&(a.retryQueue=null,Di(e,s))));break;case 19:On(t,e),kn(e),a&4&&(a=e.updateQueue,a!==null&&(e.updateQueue=null,Di(e,a)));break;case 30:break;case 21:break;default:On(t,e),kn(e)}}function kn(e){var t=e.flags;if(t&2){try{for(var s,a=e.return;a!==null;){if(Jg(a)){s=a;break}a=a.return}if(s==null)throw Error(l(160));switch(s.tag){case 27:var u=s.stateNode,f=Rd(e);Ai(e,f,u);break;case 5:var y=s.stateNode;s.flags&32&&(zr(y,""),s.flags&=-33);var C=Rd(e);Ai(e,C,y);break;case 3:case 4:var P=s.stateNode.containerInfo,ae=Rd(e);Od(e,ae,P);break;default:throw Error(l(161))}}catch(ge){Mt(e,e.return,ge)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function lx(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;lx(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function Vs(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)tx(e,t.alternate,t),t=t.sibling}function lr(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:No(4,t,t.return),lr(t);break;case 1:hs(t,t.return);var s=t.stateNode;typeof s.componentWillUnmount=="function"&&Qg(t,t.return,s),lr(t);break;case 27:fl(t.stateNode);case 26:case 5:hs(t,t.return),lr(t);break;case 22:t.memoizedState===null&&lr(t);break;case 30:lr(t);break;default:lr(t)}e=e.sibling}}function Ps(e,t,s){for(s=s&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var a=t.alternate,u=e,f=t,y=f.flags;switch(f.tag){case 0:case 11:case 15:Ps(u,f,s),nl(4,f);break;case 1:if(Ps(u,f,s),a=f,u=a.stateNode,typeof u.componentDidMount=="function")try{u.componentDidMount()}catch(ae){Mt(a,a.return,ae)}if(a=f,u=a.updateQueue,u!==null){var C=a.stateNode;try{var P=u.shared.hiddenCallbacks;if(P!==null)for(u.shared.hiddenCallbacks=null,u=0;u<P.length;u++)Uh(P[u],C)}catch(ae){Mt(a,a.return,ae)}}s&&y&64&&$g(f),sl(f,f.return);break;case 27:Wg(f);case 26:case 5:Ps(u,f,s),s&&a===null&&y&4&&Zg(f),sl(f,f.return);break;case 12:Ps(u,f,s);break;case 31:Ps(u,f,s),s&&y&4&&ox(u,f);break;case 13:Ps(u,f,s),s&&y&4&&rx(u,f);break;case 22:f.memoizedState===null&&Ps(u,f,s),sl(f,f.return);break;case 30:break;default:Ps(u,f,s)}t=t.sibling}}function _d(e,t){var s=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(s=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==s&&(e!=null&&e.refCount++,s!=null&&Pa(s))}function Md(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Pa(e))}function us(e,t,s,a){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)ix(e,t,s,a),t=t.sibling}function ix(e,t,s,a){var u=t.flags;switch(t.tag){case 0:case 11:case 15:us(e,t,s,a),u&2048&&nl(9,t);break;case 1:us(e,t,s,a);break;case 3:us(e,t,s,a),u&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Pa(e)));break;case 12:if(u&2048){us(e,t,s,a),e=t.stateNode;try{var f=t.memoizedProps,y=f.id,C=f.onPostCommit;typeof C=="function"&&C(y,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(P){Mt(t,t.return,P)}}else us(e,t,s,a);break;case 31:us(e,t,s,a);break;case 13:us(e,t,s,a);break;case 23:break;case 22:f=t.stateNode,y=t.alternate,t.memoizedState!==null?f._visibility&2?us(e,t,s,a):ol(e,t):f._visibility&2?us(e,t,s,a):(f._visibility|=2,ta(e,t,s,a,(t.subtreeFlags&10256)!==0||!1)),u&2048&&_d(y,t);break;case 24:us(e,t,s,a),u&2048&&Md(t.alternate,t);break;default:us(e,t,s,a)}}function ta(e,t,s,a,u){for(u=u&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var f=e,y=t,C=s,P=a,ae=y.flags;switch(y.tag){case 0:case 11:case 15:ta(f,y,C,P,u),nl(8,y);break;case 23:break;case 22:var ge=y.stateNode;y.memoizedState!==null?ge._visibility&2?ta(f,y,C,P,u):ol(f,y):(ge._visibility|=2,ta(f,y,C,P,u)),u&&ae&2048&&_d(y.alternate,y);break;case 24:ta(f,y,C,P,u),u&&ae&2048&&Md(y.alternate,y);break;default:ta(f,y,C,P,u)}t=t.sibling}}function ol(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var s=e,a=t,u=a.flags;switch(a.tag){case 22:ol(s,a),u&2048&&_d(a.alternate,a);break;case 24:ol(s,a),u&2048&&Md(a.alternate,a);break;default:ol(s,a)}t=t.sibling}}var rl=8192;function na(e,t,s){if(e.subtreeFlags&rl)for(e=e.child;e!==null;)cx(e,t,s),e=e.sibling}function cx(e,t,s){switch(e.tag){case 26:na(e,t,s),e.flags&rl&&e.memoizedState!==null&&uN(s,cs,e.memoizedState,e.memoizedProps);break;case 5:na(e,t,s);break;case 3:case 4:var a=cs;cs=Ki(e.stateNode.containerInfo),na(e,t,s),cs=a;break;case 22:e.memoizedState===null&&(a=e.alternate,a!==null&&a.memoizedState!==null?(a=rl,rl=16777216,na(e,t,s),rl=a):na(e,t,s));break;default:na(e,t,s)}}function ux(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function al(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var s=0;s<t.length;s++){var a=t[s];cn=a,fx(a,e)}ux(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)dx(e),e=e.sibling}function dx(e){switch(e.tag){case 0:case 11:case 15:al(e),e.flags&2048&&No(9,e,e.return);break;case 3:al(e);break;case 12:al(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,zi(e)):al(e);break;default:al(e)}}function zi(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var s=0;s<t.length;s++){var a=t[s];cn=a,fx(a,e)}ux(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:No(8,t,t.return),zi(t);break;case 22:s=t.stateNode,s._visibility&2&&(s._visibility&=-3,zi(t));break;default:zi(t)}e=e.sibling}}function fx(e,t){for(;cn!==null;){var s=cn;switch(s.tag){case 0:case 11:case 15:No(8,s,t);break;case 23:case 22:if(s.memoizedState!==null&&s.memoizedState.cachePool!==null){var a=s.memoizedState.cachePool.pool;a!=null&&a.refCount++}break;case 24:Pa(s.memoizedState.cache)}if(a=s.child,a!==null)a.return=s,cn=a;else e:for(s=e;cn!==null;){a=cn;var u=a.sibling,f=a.return;if(nx(a),a===s){cn=null;break e}if(u!==null){u.return=f,cn=u;break e}cn=f}}}var TE={getCacheForType:function(e){var t=hn(Zt),s=t.data.get(e);return s===void 0&&(s=e(),t.data.set(e,s)),s},cacheSignal:function(){return hn(Zt).controller.signal}},wE=typeof WeakMap=="function"?WeakMap:Map,Rt=0,It=null,ut=null,mt=0,_t=0,Yn=null,jo=!1,sa=!1,Ad=!1,Gs=0,Ft=0,To=0,ir=0,Dd=0,Vn=0,oa=0,ll=null,_n=null,zd=!1,Li=0,mx=0,Ii=1/0,Ui=null,wo=null,sn=0,Co=null,ra=null,qs=0,Ld=0,Id=null,px=null,il=0,Ud=null;function Pn(){return(Rt&2)!==0&&mt!==0?mt&-mt:w.T!==null?Gd():Rs()}function hx(){if(Vn===0)if((mt&536870912)===0||bt){var e=tn;tn<<=1,(tn&3932160)===0&&(tn=262144),Vn=e}else Vn=536870912;return e=Hn.current,e!==null&&(e.flags|=32),Vn}function Mn(e,t,s){(e===It&&(_t===2||_t===9)||e.cancelPendingCommit!==null)&&(aa(e,0),Ro(e,mt,Vn,!1)),nt(e,s),((Rt&2)===0||e!==It)&&(e===It&&((Rt&2)===0&&(ir|=s),Ft===4&&Ro(e,mt,Vn,!1)),gs(e))}function gx(e,t,s){if((Rt&6)!==0)throw Error(l(327));var a=!s&&(t&127)===0&&(t&e.expiredLanes)===0||Ce(e,t),u=a?OE(e,t):Bd(e,t,!0),f=a;do{if(u===0){sa&&!a&&Ro(e,t,0,!1);break}else{if(s=e.current.alternate,f&&!CE(s)){u=Bd(e,t,!1),f=!1;continue}if(u===2){if(f=t,e.errorRecoveryDisabledLanes&f)var y=0;else y=e.pendingLanes&-536870913,y=y!==0?y:y&536870912?536870912:0;if(y!==0){t=y;e:{var C=e;u=ll;var P=C.current.memoizedState.isDehydrated;if(P&&(aa(C,y).flags|=256),y=Bd(C,y,!1),y!==2){if(Ad&&!P){C.errorRecoveryDisabledLanes|=f,ir|=f,u=4;break e}f=_n,_n=u,f!==null&&(_n===null?_n=f:_n.push.apply(_n,f))}u=y}if(f=!1,u!==2)continue}}if(u===1){aa(e,0),Ro(e,t,0,!0);break}e:{switch(a=e,f=u,f){case 0:case 1:throw Error(l(345));case 4:if((t&4194048)!==t)break;case 6:Ro(a,t,Vn,!jo);break e;case 2:_n=null;break;case 3:case 5:break;default:throw Error(l(329))}if((t&62914560)===t&&(u=Li+300-ie(),10<u)){if(Ro(a,t,Vn,!jo),xe(a,0,!0)!==0)break e;qs=t,a.timeoutHandle=Xx(xx.bind(null,a,s,_n,Ui,zd,t,Vn,ir,oa,jo,f,"Throttled",-0,0),u);break e}xx(a,s,_n,Ui,zd,t,Vn,ir,oa,jo,f,null,-0,0)}}break}while(!0);gs(e)}function xx(e,t,s,a,u,f,y,C,P,ae,ge,Ee,le,fe){if(e.timeoutHandle=-1,Ee=t.subtreeFlags,Ee&8192||(Ee&16785408)===16785408){Ee={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:ks},cx(t,f,Ee);var Ve=(f&62914560)===f?Li-ie():(f&4194048)===f?mx-ie():0;if(Ve=dN(Ee,Ve),Ve!==null){qs=f,e.cancelPendingCommit=Ve(Tx.bind(null,e,t,f,s,a,u,y,C,P,ge,Ee,null,le,fe)),Ro(e,f,y,!ae);return}}Tx(e,t,f,s,a,u,y,C,P)}function CE(e){for(var t=e;;){var s=t.tag;if((s===0||s===11||s===15)&&t.flags&16384&&(s=t.updateQueue,s!==null&&(s=s.stores,s!==null)))for(var a=0;a<s.length;a++){var u=s[a],f=u.getSnapshot;u=u.value;try{if(!In(f(),u))return!1}catch{return!1}}if(s=t.child,t.subtreeFlags&16384&&s!==null)s.return=t,t=s;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function Ro(e,t,s,a){t&=~Dd,t&=~ir,e.suspendedLanes|=t,e.pingedLanes&=~t,a&&(e.warmLanes|=t),a=e.expirationTimes;for(var u=t;0<u;){var f=31-xt(u),y=1<<f;a[f]=-1,u&=~y}s!==0&&Xn(e,s,t)}function Hi(){return(Rt&6)===0?(cl(0),!1):!0}function Hd(){if(ut!==null){if(_t===0)var e=ut.return;else e=ut,Ds=Wo=null,td(e),Qr=null,qa=0,e=ut;for(;e!==null;)Kg(e.alternate,e),e=e.return;ut=null}}function aa(e,t){var s=e.timeoutHandle;s!==-1&&(e.timeoutHandle=-1,XE(s)),s=e.cancelPendingCommit,s!==null&&(e.cancelPendingCommit=null,s()),qs=0,Hd(),It=e,ut=s=Ms(e.current,null),mt=t,_t=0,Yn=null,jo=!1,sa=Ce(e,t),Ad=!1,oa=Vn=Dd=ir=To=Ft=0,_n=ll=null,zd=!1,(t&8)!==0&&(t|=t&32);var a=e.entangledLanes;if(a!==0)for(e=e.entanglements,a&=t;0<a;){var u=31-xt(a),f=1<<u;t|=e[u],a&=~f}return Gs=t,ai(),s}function bx(e,t){at=null,w.H=Wa,t===$r||t===pi?(t=Dh(),_t=3):t===Pu?(t=Dh(),_t=4):_t=t===xd?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,Yn=t,ut===null&&(Ft=1,Ri(e,Zn(t,e.current)))}function yx(){var e=Hn.current;return e===null?!0:(mt&4194048)===mt?ts===null:(mt&62914560)===mt||(mt&536870912)!==0?e===ts:!1}function vx(){var e=w.H;return w.H=Wa,e===null?Wa:e}function Sx(){var e=w.A;return w.A=TE,e}function Bi(){Ft=4,jo||(mt&4194048)!==mt&&Hn.current!==null||(sa=!0),(To&134217727)===0&&(ir&134217727)===0||It===null||Ro(It,mt,Vn,!1)}function Bd(e,t,s){var a=Rt;Rt|=2;var u=vx(),f=Sx();(It!==e||mt!==t)&&(Ui=null,aa(e,t)),t=!1;var y=Ft;e:do try{if(_t!==0&&ut!==null){var C=ut,P=Yn;switch(_t){case 8:Hd(),y=6;break e;case 3:case 2:case 9:case 6:Hn.current===null&&(t=!0);var ae=_t;if(_t=0,Yn=null,la(e,C,P,ae),s&&sa){y=0;break e}break;default:ae=_t,_t=0,Yn=null,la(e,C,P,ae)}}RE(),y=Ft;break}catch(ge){bx(e,ge)}while(!0);return t&&e.shellSuspendCounter++,Ds=Wo=null,Rt=a,w.H=u,w.A=f,ut===null&&(It=null,mt=0,ai()),y}function RE(){for(;ut!==null;)Ex(ut)}function OE(e,t){var s=Rt;Rt|=2;var a=vx(),u=Sx();It!==e||mt!==t?(Ui=null,Ii=ie()+500,aa(e,t)):sa=Ce(e,t);e:do try{if(_t!==0&&ut!==null){t=ut;var f=Yn;t:switch(_t){case 1:_t=0,Yn=null,la(e,t,f,1);break;case 2:case 9:if(Mh(f)){_t=0,Yn=null,Nx(t);break}t=function(){_t!==2&&_t!==9||It!==e||(_t=7),gs(e)},f.then(t,t);break e;case 3:_t=7;break e;case 4:_t=5;break e;case 7:Mh(f)?(_t=0,Yn=null,Nx(t)):(_t=0,Yn=null,la(e,t,f,7));break;case 5:var y=null;switch(ut.tag){case 26:y=ut.memoizedState;case 5:case 27:var C=ut;if(y?ib(y):C.stateNode.complete){_t=0,Yn=null;var P=C.sibling;if(P!==null)ut=P;else{var ae=C.return;ae!==null?(ut=ae,Yi(ae)):ut=null}break t}}_t=0,Yn=null,la(e,t,f,5);break;case 6:_t=0,Yn=null,la(e,t,f,6);break;case 8:Hd(),Ft=6;break e;default:throw Error(l(462))}}kE();break}catch(ge){bx(e,ge)}while(!0);return Ds=Wo=null,w.H=a,w.A=u,Rt=s,ut!==null?0:(It=null,mt=0,ai(),Ft)}function kE(){for(;ut!==null&&!_e();)Ex(ut)}function Ex(e){var t=Fg(e.alternate,e,Gs);e.memoizedProps=e.pendingProps,t===null?Yi(e):ut=t}function Nx(e){var t=e,s=t.alternate;switch(t.tag){case 15:case 0:t=Bg(s,t,t.pendingProps,t.type,void 0,mt);break;case 11:t=Bg(s,t,t.pendingProps,t.type.render,t.ref,mt);break;case 5:td(t);default:Kg(s,t),t=ut=Sh(t,Gs),t=Fg(s,t,Gs)}e.memoizedProps=e.pendingProps,t===null?Yi(e):ut=t}function la(e,t,s,a){Ds=Wo=null,td(t),Qr=null,qa=0;var u=t.return;try{if(bE(e,u,t,s,mt)){Ft=1,Ri(e,Zn(s,e.current)),ut=null;return}}catch(f){if(u!==null)throw ut=u,f;Ft=1,Ri(e,Zn(s,e.current)),ut=null;return}t.flags&32768?(bt||a===1?e=!0:sa||(mt&536870912)!==0?e=!1:(jo=e=!0,(a===2||a===9||a===3||a===6)&&(a=Hn.current,a!==null&&a.tag===13&&(a.flags|=16384))),jx(t,e)):Yi(t)}function Yi(e){var t=e;do{if((t.flags&32768)!==0){jx(t,jo);return}e=t.return;var s=SE(t.alternate,t,Gs);if(s!==null){ut=s;return}if(t=t.sibling,t!==null){ut=t;return}ut=t=e}while(t!==null);Ft===0&&(Ft=5)}function jx(e,t){do{var s=EE(e.alternate,e);if(s!==null){s.flags&=32767,ut=s;return}if(s=e.return,s!==null&&(s.flags|=32768,s.subtreeFlags=0,s.deletions=null),!t&&(e=e.sibling,e!==null)){ut=e;return}ut=e=s}while(e!==null);Ft=6,ut=null}function Tx(e,t,s,a,u,f,y,C,P){e.cancelPendingCommit=null;do Vi();while(sn!==0);if((Rt&6)!==0)throw Error(l(327));if(t!==null){if(t===e.current)throw Error(l(177));if(f=t.lanes|t.childLanes,f|=Ru,Vt(e,s,f,y,C,P),e===It&&(ut=It=null,mt=0),ra=t,Co=e,qs=s,Ld=f,Id=u,px=a,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,DE(je,function(){return kx(),null})):(e.callbackNode=null,e.callbackPriority=0),a=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||a){a=w.T,w.T=null,u=U.p,U.p=2,y=Rt,Rt|=4;try{NE(e,t,s)}finally{Rt=y,U.p=u,w.T=a}}sn=1,wx(),Cx(),Rx()}}function wx(){if(sn===1){sn=0;var e=Co,t=ra,s=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||s){s=w.T,w.T=null;var a=U.p;U.p=2;var u=Rt;Rt|=4;try{ax(t,e);var f=Jd,y=fh(e.containerInfo),C=f.focusedElem,P=f.selectionRange;if(y!==C&&C&&C.ownerDocument&&dh(C.ownerDocument.documentElement,C)){if(P!==null&&Nu(C)){var ae=P.start,ge=P.end;if(ge===void 0&&(ge=ae),"selectionStart"in C)C.selectionStart=ae,C.selectionEnd=Math.min(ge,C.value.length);else{var Ee=C.ownerDocument||document,le=Ee&&Ee.defaultView||window;if(le.getSelection){var fe=le.getSelection(),Ve=C.textContent.length,Ze=Math.min(P.start,Ve),zt=P.end===void 0?Ze:Math.min(P.end,Ve);!fe.extend&&Ze>zt&&(y=zt,zt=Ze,Ze=y);var W=uh(C,Ze),K=uh(C,zt);if(W&&K&&(fe.rangeCount!==1||fe.anchorNode!==W.node||fe.anchorOffset!==W.offset||fe.focusNode!==K.node||fe.focusOffset!==K.offset)){var re=Ee.createRange();re.setStart(W.node,W.offset),fe.removeAllRanges(),Ze>zt?(fe.addRange(re),fe.extend(K.node,K.offset)):(re.setEnd(K.node,K.offset),fe.addRange(re))}}}}for(Ee=[],fe=C;fe=fe.parentNode;)fe.nodeType===1&&Ee.push({element:fe,left:fe.scrollLeft,top:fe.scrollTop});for(typeof C.focus=="function"&&C.focus(),C=0;C<Ee.length;C++){var ve=Ee[C];ve.element.scrollLeft=ve.left,ve.element.scrollTop=ve.top}}ec=!!Zd,Jd=Zd=null}finally{Rt=u,U.p=a,w.T=s}}e.current=t,sn=2}}function Cx(){if(sn===2){sn=0;var e=Co,t=ra,s=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||s){s=w.T,w.T=null;var a=U.p;U.p=2;var u=Rt;Rt|=4;try{tx(e,t.alternate,t)}finally{Rt=u,U.p=a,w.T=s}}sn=3}}function Rx(){if(sn===4||sn===3){sn=0,it();var e=Co,t=ra,s=qs,a=px;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?sn=5:(sn=0,ra=Co=null,Ox(e,e.pendingLanes));var u=e.pendingLanes;if(u===0&&(wo=null),Ln(s),t=t.stateNode,Et&&typeof Et.onCommitFiberRoot=="function")try{Et.onCommitFiberRoot(st,t,void 0,(t.current.flags&128)===128)}catch{}if(a!==null){t=w.T,u=U.p,U.p=2,w.T=null;try{for(var f=e.onRecoverableError,y=0;y<a.length;y++){var C=a[y];f(C.value,{componentStack:C.stack})}}finally{w.T=t,U.p=u}}(qs&3)!==0&&Vi(),gs(e),u=e.pendingLanes,(s&261930)!==0&&(u&42)!==0?e===Ud?il++:(il=0,Ud=e):il=0,cl(0)}}function Ox(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Pa(t)))}function Vi(){return wx(),Cx(),Rx(),kx()}function kx(){if(sn!==5)return!1;var e=Co,t=Ld;Ld=0;var s=Ln(qs),a=w.T,u=U.p;try{U.p=32>s?32:s,w.T=null,s=Id,Id=null;var f=Co,y=qs;if(sn=0,ra=Co=null,qs=0,(Rt&6)!==0)throw Error(l(331));var C=Rt;if(Rt|=4,dx(f.current),ix(f,f.current,y,s),Rt=C,cl(0,!1),Et&&typeof Et.onPostCommitFiberRoot=="function")try{Et.onPostCommitFiberRoot(st,f)}catch{}return!0}finally{U.p=u,w.T=a,Ox(e,t)}}function _x(e,t,s){t=Zn(s,t),t=gd(e.stateNode,t,2),e=vo(e,t,2),e!==null&&(nt(e,2),gs(e))}function Mt(e,t,s){if(e.tag===3)_x(e,e,s);else for(;t!==null;){if(t.tag===3){_x(t,e,s);break}else if(t.tag===1){var a=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof a.componentDidCatch=="function"&&(wo===null||!wo.has(a))){e=Zn(s,e),s=Mg(2),a=vo(t,s,2),a!==null&&(Ag(s,a,t,e),nt(a,2),gs(a));break}}t=t.return}}function Yd(e,t,s){var a=e.pingCache;if(a===null){a=e.pingCache=new wE;var u=new Set;a.set(t,u)}else u=a.get(t),u===void 0&&(u=new Set,a.set(t,u));u.has(s)||(Ad=!0,u.add(s),e=_E.bind(null,e,t,s),t.then(e,e))}function _E(e,t,s){var a=e.pingCache;a!==null&&a.delete(t),e.pingedLanes|=e.suspendedLanes&s,e.warmLanes&=~s,It===e&&(mt&s)===s&&(Ft===4||Ft===3&&(mt&62914560)===mt&&300>ie()-Li?(Rt&2)===0&&aa(e,0):Dd|=s,oa===mt&&(oa=0)),gs(e)}function Mx(e,t){t===0&&(t=et()),e=Qo(e,t),e!==null&&(nt(e,t),gs(e))}function ME(e){var t=e.memoizedState,s=0;t!==null&&(s=t.retryLane),Mx(e,s)}function AE(e,t){var s=0;switch(e.tag){case 31:case 13:var a=e.stateNode,u=e.memoizedState;u!==null&&(s=u.retryLane);break;case 19:a=e.stateNode;break;case 22:a=e.stateNode._retryCache;break;default:throw Error(l(314))}a!==null&&a.delete(t),Mx(e,s)}function DE(e,t){return Te(e,t)}var Pi=null,ia=null,Vd=!1,Gi=!1,Pd=!1,Oo=0;function gs(e){e!==ia&&e.next===null&&(ia===null?Pi=ia=e:ia=ia.next=e),Gi=!0,Vd||(Vd=!0,LE())}function cl(e,t){if(!Pd&&Gi){Pd=!0;do for(var s=!1,a=Pi;a!==null;){if(e!==0){var u=a.pendingLanes;if(u===0)var f=0;else{var y=a.suspendedLanes,C=a.pingedLanes;f=(1<<31-xt(42|e)+1)-1,f&=u&~(y&~C),f=f&201326741?f&201326741|1:f?f|2:0}f!==0&&(s=!0,Lx(a,f))}else f=mt,f=xe(a,a===It?f:0,a.cancelPendingCommit!==null||a.timeoutHandle!==-1),(f&3)===0||Ce(a,f)||(s=!0,Lx(a,f));a=a.next}while(s);Pd=!1}}function zE(){Ax()}function Ax(){Gi=Vd=!1;var e=0;Oo!==0&&FE()&&(e=Oo);for(var t=ie(),s=null,a=Pi;a!==null;){var u=a.next,f=Dx(a,t);f===0?(a.next=null,s===null?Pi=u:s.next=u,u===null&&(ia=s)):(s=a,(e!==0||(f&3)!==0)&&(Gi=!0)),a=u}sn!==0&&sn!==5||cl(e),Oo!==0&&(Oo=0)}function Dx(e,t){for(var s=e.suspendedLanes,a=e.pingedLanes,u=e.expirationTimes,f=e.pendingLanes&-62914561;0<f;){var y=31-xt(f),C=1<<y,P=u[y];P===-1?((C&s)===0||(C&a)!==0)&&(u[y]=$e(C,t)):P<=t&&(e.expiredLanes|=C),f&=~C}if(t=It,s=mt,s=xe(e,e===t?s:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),a=e.callbackNode,s===0||e===t&&(_t===2||_t===9)||e.cancelPendingCommit!==null)return a!==null&&a!==null&&Me(a),e.callbackNode=null,e.callbackPriority=0;if((s&3)===0||Ce(e,s)){if(t=s&-s,t===e.callbackPriority)return t;switch(a!==null&&Me(a),Ln(s)){case 2:case 8:s=J;break;case 32:s=je;break;case 268435456:s=Ne;break;default:s=je}return a=zx.bind(null,e),s=Te(s,a),e.callbackPriority=t,e.callbackNode=s,t}return a!==null&&a!==null&&Me(a),e.callbackPriority=2,e.callbackNode=null,2}function zx(e,t){if(sn!==0&&sn!==5)return e.callbackNode=null,e.callbackPriority=0,null;var s=e.callbackNode;if(Vi()&&e.callbackNode!==s)return null;var a=mt;return a=xe(e,e===It?a:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),a===0?null:(gx(e,a,t),Dx(e,ie()),e.callbackNode!=null&&e.callbackNode===s?zx.bind(null,e):null)}function Lx(e,t){if(Vi())return null;gx(e,t,!0)}function LE(){KE(function(){(Rt&6)!==0?Te(pe,zE):Ax()})}function Gd(){if(Oo===0){var e=Xr;e===0&&(e=Tt,Tt<<=1,(Tt&261888)===0&&(Tt=256)),Oo=e}return Oo}function Ix(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:Jl(""+e)}function Ux(e,t){var s=t.ownerDocument.createElement("input");return s.name=t.name,s.value=t.value,e.id&&s.setAttribute("form",e.id),t.parentNode.insertBefore(s,t),e=new FormData(e),s.parentNode.removeChild(s),e}function IE(e,t,s,a,u){if(t==="submit"&&s&&s.stateNode===u){var f=Ix((u[wn]||null).action),y=a.submitter;y&&(t=(t=y[wn]||null)?Ix(t.formAction):y.getAttribute("formAction"),t!==null&&(f=t,y=null));var C=new ni("action","action",null,a,u);e.push({event:C,listeners:[{instance:null,listener:function(){if(a.defaultPrevented){if(Oo!==0){var P=y?Ux(u,y):new FormData(u);ud(s,{pending:!0,data:P,method:u.method,action:f},null,P)}}else typeof f=="function"&&(C.preventDefault(),P=y?Ux(u,y):new FormData(u),ud(s,{pending:!0,data:P,method:u.method,action:f},f,P))},currentTarget:u}]})}}for(var qd=0;qd<Cu.length;qd++){var Fd=Cu[qd],UE=Fd.toLowerCase(),HE=Fd[0].toUpperCase()+Fd.slice(1);is(UE,"on"+HE)}is(hh,"onAnimationEnd"),is(gh,"onAnimationIteration"),is(xh,"onAnimationStart"),is("dblclick","onDoubleClick"),is("focusin","onFocus"),is("focusout","onBlur"),is(tE,"onTransitionRun"),is(nE,"onTransitionStart"),is(sE,"onTransitionCancel"),is(bh,"onTransitionEnd"),Ar("onMouseEnter",["mouseout","mouseover"]),Ar("onMouseLeave",["mouseout","mouseover"]),Ar("onPointerEnter",["pointerout","pointerover"]),Ar("onPointerLeave",["pointerout","pointerover"]),Fo("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Fo("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Fo("onBeforeInput",["compositionend","keypress","textInput","paste"]),Fo("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Fo("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Fo("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var ul="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(" "),BE=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(ul));function Hx(e,t){t=(t&4)!==0;for(var s=0;s<e.length;s++){var a=e[s],u=a.event;a=a.listeners;e:{var f=void 0;if(t)for(var y=a.length-1;0<=y;y--){var C=a[y],P=C.instance,ae=C.currentTarget;if(C=C.listener,P!==f&&u.isPropagationStopped())break e;f=C,u.currentTarget=ae;try{f(u)}catch(ge){ri(ge)}u.currentTarget=null,f=P}else for(y=0;y<a.length;y++){if(C=a[y],P=C.instance,ae=C.currentTarget,C=C.listener,P!==f&&u.isPropagationStopped())break e;f=C,u.currentTarget=ae;try{f(u)}catch(ge){ri(ge)}u.currentTarget=null,f=P}}}}function dt(e,t){var s=t[ru];s===void 0&&(s=t[ru]=new Set);var a=e+"__bubble";s.has(a)||(Bx(t,e,2,!1),s.add(a))}function Xd(e,t,s){var a=0;t&&(a|=4),Bx(s,e,a,t)}var qi="_reactListening"+Math.random().toString(36).slice(2);function Kd(e){if(!e[qi]){e[qi]=!0,Ap.forEach(function(s){s!=="selectionchange"&&(BE.has(s)||Xd(s,!1,e),Xd(s,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[qi]||(t[qi]=!0,Xd("selectionchange",!1,t))}}function Bx(e,t,s,a){switch(hb(t)){case 2:var u=pN;break;case 8:u=hN;break;default:u=uf}s=u.bind(null,t,s,e),u=void 0,!pu||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(u=!0),a?u!==void 0?e.addEventListener(t,s,{capture:!0,passive:u}):e.addEventListener(t,s,!0):u!==void 0?e.addEventListener(t,s,{passive:u}):e.addEventListener(t,s,!1)}function $d(e,t,s,a,u){var f=a;if((t&1)===0&&(t&2)===0&&a!==null)e:for(;;){if(a===null)return;var y=a.tag;if(y===3||y===4){var C=a.stateNode.containerInfo;if(C===u)break;if(y===4)for(y=a.return;y!==null;){var P=y.tag;if((P===3||P===4)&&y.stateNode.containerInfo===u)return;y=y.return}for(;C!==null;){if(y=kr(C),y===null)return;if(P=y.tag,P===5||P===6||P===26||P===27){a=f=y;continue e}C=C.parentNode}}a=a.return}qp(function(){var ae=f,ge=fu(s),Ee=[];e:{var le=yh.get(e);if(le!==void 0){var fe=ni,Ve=e;switch(e){case"keypress":if(ei(s)===0)break e;case"keydown":case"keyup":fe=AS;break;case"focusin":Ve="focus",fe=bu;break;case"focusout":Ve="blur",fe=bu;break;case"beforeblur":case"afterblur":fe=bu;break;case"click":if(s.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":fe=Kp;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":fe=SS;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":fe=LS;break;case hh:case gh:case xh:fe=jS;break;case bh:fe=US;break;case"scroll":case"scrollend":fe=yS;break;case"wheel":fe=BS;break;case"copy":case"cut":case"paste":fe=wS;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":fe=Qp;break;case"toggle":case"beforetoggle":fe=VS}var Ze=(t&4)!==0,zt=!Ze&&(e==="scroll"||e==="scrollend"),W=Ze?le!==null?le+"Capture":null:le;Ze=[];for(var K=ae,re;K!==null;){var ve=K;if(re=ve.stateNode,ve=ve.tag,ve!==5&&ve!==26&&ve!==27||re===null||W===null||(ve=Ma(K,W),ve!=null&&Ze.push(dl(K,ve,re))),zt)break;K=K.return}0<Ze.length&&(le=new fe(le,Ve,null,s,ge),Ee.push({event:le,listeners:Ze}))}}if((t&7)===0){e:{if(le=e==="mouseover"||e==="pointerover",fe=e==="mouseout"||e==="pointerout",le&&s!==du&&(Ve=s.relatedTarget||s.fromElement)&&(kr(Ve)||Ve[Or]))break e;if((fe||le)&&(le=ge.window===ge?ge:(le=ge.ownerDocument)?le.defaultView||le.parentWindow:window,fe?(Ve=s.relatedTarget||s.toElement,fe=ae,Ve=Ve?kr(Ve):null,Ve!==null&&(zt=d(Ve),Ze=Ve.tag,Ve!==zt||Ze!==5&&Ze!==27&&Ze!==6)&&(Ve=null)):(fe=null,Ve=ae),fe!==Ve)){if(Ze=Kp,ve="onMouseLeave",W="onMouseEnter",K="mouse",(e==="pointerout"||e==="pointerover")&&(Ze=Qp,ve="onPointerLeave",W="onPointerEnter",K="pointer"),zt=fe==null?le:_a(fe),re=Ve==null?le:_a(Ve),le=new Ze(ve,K+"leave",fe,s,ge),le.target=zt,le.relatedTarget=re,ve=null,kr(ge)===ae&&(Ze=new Ze(W,K+"enter",Ve,s,ge),Ze.target=re,Ze.relatedTarget=zt,ve=Ze),zt=ve,fe&&Ve)t:{for(Ze=YE,W=fe,K=Ve,re=0,ve=W;ve;ve=Ze(ve))re++;ve=0;for(var Qe=K;Qe;Qe=Ze(Qe))ve++;for(;0<re-ve;)W=Ze(W),re--;for(;0<ve-re;)K=Ze(K),ve--;for(;re--;){if(W===K||K!==null&&W===K.alternate){Ze=W;break t}W=Ze(W),K=Ze(K)}Ze=null}else Ze=null;fe!==null&&Yx(Ee,le,fe,Ze,!1),Ve!==null&&zt!==null&&Yx(Ee,zt,Ve,Ze,!0)}}e:{if(le=ae?_a(ae):window,fe=le.nodeName&&le.nodeName.toLowerCase(),fe==="select"||fe==="input"&&le.type==="file")var wt=oh;else if(nh(le))if(rh)wt=JS;else{wt=QS;var Pe=$S}else fe=le.nodeName,!fe||fe.toLowerCase()!=="input"||le.type!=="checkbox"&&le.type!=="radio"?ae&&uu(ae.elementType)&&(wt=oh):wt=ZS;if(wt&&(wt=wt(e,ae))){sh(Ee,wt,s,ge);break e}Pe&&Pe(e,le,ae),e==="focusout"&&ae&&le.type==="number"&&ae.memoizedProps.value!=null&&cu(le,"number",le.value)}switch(Pe=ae?_a(ae):window,e){case"focusin":(nh(Pe)||Pe.contentEditable==="true")&&(Hr=Pe,ju=ae,Ba=null);break;case"focusout":Ba=ju=Hr=null;break;case"mousedown":Tu=!0;break;case"contextmenu":case"mouseup":case"dragend":Tu=!1,mh(Ee,s,ge);break;case"selectionchange":if(eE)break;case"keydown":case"keyup":mh(Ee,s,ge)}var lt;if(vu)e:{switch(e){case"compositionstart":var pt="onCompositionStart";break e;case"compositionend":pt="onCompositionEnd";break e;case"compositionupdate":pt="onCompositionUpdate";break e}pt=void 0}else Ur?eh(e,s)&&(pt="onCompositionEnd"):e==="keydown"&&s.keyCode===229&&(pt="onCompositionStart");pt&&(Zp&&s.locale!=="ko"&&(Ur||pt!=="onCompositionStart"?pt==="onCompositionEnd"&&Ur&&(lt=Fp()):(mo=ge,hu="value"in mo?mo.value:mo.textContent,Ur=!0)),Pe=Fi(ae,pt),0<Pe.length&&(pt=new $p(pt,e,null,s,ge),Ee.push({event:pt,listeners:Pe}),lt?pt.data=lt:(lt=th(s),lt!==null&&(pt.data=lt)))),(lt=GS?qS(e,s):FS(e,s))&&(pt=Fi(ae,"onBeforeInput"),0<pt.length&&(Pe=new $p("onBeforeInput","beforeinput",null,s,ge),Ee.push({event:Pe,listeners:pt}),Pe.data=lt)),IE(Ee,e,ae,s,ge)}Hx(Ee,t)})}function dl(e,t,s){return{instance:e,listener:t,currentTarget:s}}function Fi(e,t){for(var s=t+"Capture",a=[];e!==null;){var u=e,f=u.stateNode;if(u=u.tag,u!==5&&u!==26&&u!==27||f===null||(u=Ma(e,s),u!=null&&a.unshift(dl(e,u,f)),u=Ma(e,t),u!=null&&a.push(dl(e,u,f))),e.tag===3)return a;e=e.return}return[]}function YE(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Yx(e,t,s,a,u){for(var f=t._reactName,y=[];s!==null&&s!==a;){var C=s,P=C.alternate,ae=C.stateNode;if(C=C.tag,P!==null&&P===a)break;C!==5&&C!==26&&C!==27||ae===null||(P=ae,u?(ae=Ma(s,f),ae!=null&&y.unshift(dl(s,ae,P))):u||(ae=Ma(s,f),ae!=null&&y.push(dl(s,ae,P)))),s=s.return}y.length!==0&&e.push({event:t,listeners:y})}var VE=/\r\n?/g,PE=/\u0000|\uFFFD/g;function Vx(e){return(typeof e=="string"?e:""+e).replace(VE,`
|
|
9
|
-
`).replace(PE,"")}function Px(e,t){return t=Vx(t),Vx(e)===t}function Dt(e,t,s,a,u,f){switch(s){case"children":typeof a=="string"?t==="body"||t==="textarea"&&a===""||zr(e,a):(typeof a=="number"||typeof a=="bigint")&&t!=="body"&&zr(e,""+a);break;case"className":Ql(e,"class",a);break;case"tabIndex":Ql(e,"tabindex",a);break;case"dir":case"role":case"viewBox":case"width":case"height":Ql(e,s,a);break;case"style":Pp(e,a,f);break;case"data":if(t!=="object"){Ql(e,"data",a);break}case"src":case"href":if(a===""&&(t!=="a"||s!=="href")){e.removeAttribute(s);break}if(a==null||typeof a=="function"||typeof a=="symbol"||typeof a=="boolean"){e.removeAttribute(s);break}a=Jl(""+a),e.setAttribute(s,a);break;case"action":case"formAction":if(typeof a=="function"){e.setAttribute(s,"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 f=="function"&&(s==="formAction"?(t!=="input"&&Dt(e,t,"name",u.name,u,null),Dt(e,t,"formEncType",u.formEncType,u,null),Dt(e,t,"formMethod",u.formMethod,u,null),Dt(e,t,"formTarget",u.formTarget,u,null)):(Dt(e,t,"encType",u.encType,u,null),Dt(e,t,"method",u.method,u,null),Dt(e,t,"target",u.target,u,null)));if(a==null||typeof a=="symbol"||typeof a=="boolean"){e.removeAttribute(s);break}a=Jl(""+a),e.setAttribute(s,a);break;case"onClick":a!=null&&(e.onclick=ks);break;case"onScroll":a!=null&&dt("scroll",e);break;case"onScrollEnd":a!=null&&dt("scrollend",e);break;case"dangerouslySetInnerHTML":if(a!=null){if(typeof a!="object"||!("__html"in a))throw Error(l(61));if(s=a.__html,s!=null){if(u.children!=null)throw Error(l(60));e.innerHTML=s}}break;case"multiple":e.multiple=a&&typeof a!="function"&&typeof a!="symbol";break;case"muted":e.muted=a&&typeof a!="function"&&typeof a!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(a==null||typeof a=="function"||typeof a=="boolean"||typeof a=="symbol"){e.removeAttribute("xlink:href");break}s=Jl(""+a),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",s);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":a!=null&&typeof a!="function"&&typeof a!="symbol"?e.setAttribute(s,""+a):e.removeAttribute(s);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":a&&typeof a!="function"&&typeof a!="symbol"?e.setAttribute(s,""):e.removeAttribute(s);break;case"capture":case"download":a===!0?e.setAttribute(s,""):a!==!1&&a!=null&&typeof a!="function"&&typeof a!="symbol"?e.setAttribute(s,a):e.removeAttribute(s);break;case"cols":case"rows":case"size":case"span":a!=null&&typeof a!="function"&&typeof a!="symbol"&&!isNaN(a)&&1<=a?e.setAttribute(s,a):e.removeAttribute(s);break;case"rowSpan":case"start":a==null||typeof a=="function"||typeof a=="symbol"||isNaN(a)?e.removeAttribute(s):e.setAttribute(s,a);break;case"popover":dt("beforetoggle",e),dt("toggle",e),$l(e,"popover",a);break;case"xlinkActuate":Os(e,"http://www.w3.org/1999/xlink","xlink:actuate",a);break;case"xlinkArcrole":Os(e,"http://www.w3.org/1999/xlink","xlink:arcrole",a);break;case"xlinkRole":Os(e,"http://www.w3.org/1999/xlink","xlink:role",a);break;case"xlinkShow":Os(e,"http://www.w3.org/1999/xlink","xlink:show",a);break;case"xlinkTitle":Os(e,"http://www.w3.org/1999/xlink","xlink:title",a);break;case"xlinkType":Os(e,"http://www.w3.org/1999/xlink","xlink:type",a);break;case"xmlBase":Os(e,"http://www.w3.org/XML/1998/namespace","xml:base",a);break;case"xmlLang":Os(e,"http://www.w3.org/XML/1998/namespace","xml:lang",a);break;case"xmlSpace":Os(e,"http://www.w3.org/XML/1998/namespace","xml:space",a);break;case"is":$l(e,"is",a);break;case"innerText":case"textContent":break;default:(!(2<s.length)||s[0]!=="o"&&s[0]!=="O"||s[1]!=="n"&&s[1]!=="N")&&(s=xS.get(s)||s,$l(e,s,a))}}function Qd(e,t,s,a,u,f){switch(s){case"style":Pp(e,a,f);break;case"dangerouslySetInnerHTML":if(a!=null){if(typeof a!="object"||!("__html"in a))throw Error(l(61));if(s=a.__html,s!=null){if(u.children!=null)throw Error(l(60));e.innerHTML=s}}break;case"children":typeof a=="string"?zr(e,a):(typeof a=="number"||typeof a=="bigint")&&zr(e,""+a);break;case"onScroll":a!=null&&dt("scroll",e);break;case"onScrollEnd":a!=null&&dt("scrollend",e);break;case"onClick":a!=null&&(e.onclick=ks);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Dp.hasOwnProperty(s))e:{if(s[0]==="o"&&s[1]==="n"&&(u=s.endsWith("Capture"),t=s.slice(2,u?s.length-7:void 0),f=e[wn]||null,f=f!=null?f[s]:null,typeof f=="function"&&e.removeEventListener(t,f,u),typeof a=="function")){typeof f!="function"&&f!==null&&(s in e?e[s]=null:e.hasAttribute(s)&&e.removeAttribute(s)),e.addEventListener(t,a,u);break e}s in e?e[s]=a:a===!0?e.setAttribute(s,""):$l(e,s,a)}}}function xn(e,t,s){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":dt("error",e),dt("load",e);var a=!1,u=!1,f;for(f in s)if(s.hasOwnProperty(f)){var y=s[f];if(y!=null)switch(f){case"src":a=!0;break;case"srcSet":u=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(l(137,t));default:Dt(e,t,f,y,s,null)}}u&&Dt(e,t,"srcSet",s.srcSet,s,null),a&&Dt(e,t,"src",s.src,s,null);return;case"input":dt("invalid",e);var C=f=y=u=null,P=null,ae=null;for(a in s)if(s.hasOwnProperty(a)){var ge=s[a];if(ge!=null)switch(a){case"name":u=ge;break;case"type":y=ge;break;case"checked":P=ge;break;case"defaultChecked":ae=ge;break;case"value":f=ge;break;case"defaultValue":C=ge;break;case"children":case"dangerouslySetInnerHTML":if(ge!=null)throw Error(l(137,t));break;default:Dt(e,t,a,ge,s,null)}}Hp(e,f,C,P,ae,y,u,!1);return;case"select":dt("invalid",e),a=y=f=null;for(u in s)if(s.hasOwnProperty(u)&&(C=s[u],C!=null))switch(u){case"value":f=C;break;case"defaultValue":y=C;break;case"multiple":a=C;default:Dt(e,t,u,C,s,null)}t=f,s=y,e.multiple=!!a,t!=null?Dr(e,!!a,t,!1):s!=null&&Dr(e,!!a,s,!0);return;case"textarea":dt("invalid",e),f=u=a=null;for(y in s)if(s.hasOwnProperty(y)&&(C=s[y],C!=null))switch(y){case"value":a=C;break;case"defaultValue":u=C;break;case"children":f=C;break;case"dangerouslySetInnerHTML":if(C!=null)throw Error(l(91));break;default:Dt(e,t,y,C,s,null)}Yp(e,a,u,f);return;case"option":for(P in s)s.hasOwnProperty(P)&&(a=s[P],a!=null)&&(P==="selected"?e.selected=a&&typeof a!="function"&&typeof a!="symbol":Dt(e,t,P,a,s,null));return;case"dialog":dt("beforetoggle",e),dt("toggle",e),dt("cancel",e),dt("close",e);break;case"iframe":case"object":dt("load",e);break;case"video":case"audio":for(a=0;a<ul.length;a++)dt(ul[a],e);break;case"image":dt("error",e),dt("load",e);break;case"details":dt("toggle",e);break;case"embed":case"source":case"link":dt("error",e),dt("load",e);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(ae in s)if(s.hasOwnProperty(ae)&&(a=s[ae],a!=null))switch(ae){case"children":case"dangerouslySetInnerHTML":throw Error(l(137,t));default:Dt(e,t,ae,a,s,null)}return;default:if(uu(t)){for(ge in s)s.hasOwnProperty(ge)&&(a=s[ge],a!==void 0&&Qd(e,t,ge,a,s,void 0));return}}for(C in s)s.hasOwnProperty(C)&&(a=s[C],a!=null&&Dt(e,t,C,a,s,null))}function GE(e,t,s,a){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var u=null,f=null,y=null,C=null,P=null,ae=null,ge=null;for(fe in s){var Ee=s[fe];if(s.hasOwnProperty(fe)&&Ee!=null)switch(fe){case"checked":break;case"value":break;case"defaultValue":P=Ee;default:a.hasOwnProperty(fe)||Dt(e,t,fe,null,a,Ee)}}for(var le in a){var fe=a[le];if(Ee=s[le],a.hasOwnProperty(le)&&(fe!=null||Ee!=null))switch(le){case"type":f=fe;break;case"name":u=fe;break;case"checked":ae=fe;break;case"defaultChecked":ge=fe;break;case"value":y=fe;break;case"defaultValue":C=fe;break;case"children":case"dangerouslySetInnerHTML":if(fe!=null)throw Error(l(137,t));break;default:fe!==Ee&&Dt(e,t,le,fe,a,Ee)}}iu(e,y,C,P,ae,ge,f,u);return;case"select":fe=y=C=le=null;for(f in s)if(P=s[f],s.hasOwnProperty(f)&&P!=null)switch(f){case"value":break;case"multiple":fe=P;default:a.hasOwnProperty(f)||Dt(e,t,f,null,a,P)}for(u in a)if(f=a[u],P=s[u],a.hasOwnProperty(u)&&(f!=null||P!=null))switch(u){case"value":le=f;break;case"defaultValue":C=f;break;case"multiple":y=f;default:f!==P&&Dt(e,t,u,f,a,P)}t=C,s=y,a=fe,le!=null?Dr(e,!!s,le,!1):!!a!=!!s&&(t!=null?Dr(e,!!s,t,!0):Dr(e,!!s,s?[]:"",!1));return;case"textarea":fe=le=null;for(C in s)if(u=s[C],s.hasOwnProperty(C)&&u!=null&&!a.hasOwnProperty(C))switch(C){case"value":break;case"children":break;default:Dt(e,t,C,null,a,u)}for(y in a)if(u=a[y],f=s[y],a.hasOwnProperty(y)&&(u!=null||f!=null))switch(y){case"value":le=u;break;case"defaultValue":fe=u;break;case"children":break;case"dangerouslySetInnerHTML":if(u!=null)throw Error(l(91));break;default:u!==f&&Dt(e,t,y,u,a,f)}Bp(e,le,fe);return;case"option":for(var Ve in s)le=s[Ve],s.hasOwnProperty(Ve)&&le!=null&&!a.hasOwnProperty(Ve)&&(Ve==="selected"?e.selected=!1:Dt(e,t,Ve,null,a,le));for(P in a)le=a[P],fe=s[P],a.hasOwnProperty(P)&&le!==fe&&(le!=null||fe!=null)&&(P==="selected"?e.selected=le&&typeof le!="function"&&typeof le!="symbol":Dt(e,t,P,le,a,fe));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 Ze in s)le=s[Ze],s.hasOwnProperty(Ze)&&le!=null&&!a.hasOwnProperty(Ze)&&Dt(e,t,Ze,null,a,le);for(ae in a)if(le=a[ae],fe=s[ae],a.hasOwnProperty(ae)&&le!==fe&&(le!=null||fe!=null))switch(ae){case"children":case"dangerouslySetInnerHTML":if(le!=null)throw Error(l(137,t));break;default:Dt(e,t,ae,le,a,fe)}return;default:if(uu(t)){for(var zt in s)le=s[zt],s.hasOwnProperty(zt)&&le!==void 0&&!a.hasOwnProperty(zt)&&Qd(e,t,zt,void 0,a,le);for(ge in a)le=a[ge],fe=s[ge],!a.hasOwnProperty(ge)||le===fe||le===void 0&&fe===void 0||Qd(e,t,ge,le,a,fe);return}}for(var W in s)le=s[W],s.hasOwnProperty(W)&&le!=null&&!a.hasOwnProperty(W)&&Dt(e,t,W,null,a,le);for(Ee in a)le=a[Ee],fe=s[Ee],!a.hasOwnProperty(Ee)||le===fe||le==null&&fe==null||Dt(e,t,Ee,le,a,fe)}function Gx(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function qE(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,s=performance.getEntriesByType("resource"),a=0;a<s.length;a++){var u=s[a],f=u.transferSize,y=u.initiatorType,C=u.duration;if(f&&C&&Gx(y)){for(y=0,C=u.responseEnd,a+=1;a<s.length;a++){var P=s[a],ae=P.startTime;if(ae>C)break;var ge=P.transferSize,Ee=P.initiatorType;ge&&Gx(Ee)&&(P=P.responseEnd,y+=ge*(P<C?1:(C-ae)/(P-ae)))}if(--a,t+=8*(f+y)/(u.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var Zd=null,Jd=null;function Xi(e){return e.nodeType===9?e:e.ownerDocument}function qx(e){switch(e){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function Fx(e,t){if(e===0)switch(t){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&t==="foreignObject"?0:e}function Wd(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.children=="bigint"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var ef=null;function FE(){var e=window.event;return e&&e.type==="popstate"?e===ef?!1:(ef=e,!0):(ef=null,!1)}var Xx=typeof setTimeout=="function"?setTimeout:void 0,XE=typeof clearTimeout=="function"?clearTimeout:void 0,Kx=typeof Promise=="function"?Promise:void 0,KE=typeof queueMicrotask=="function"?queueMicrotask:typeof Kx<"u"?function(e){return Kx.resolve(null).then(e).catch($E)}:Xx;function $E(e){setTimeout(function(){throw e})}function ko(e){return e==="head"}function $x(e,t){var s=t,a=0;do{var u=s.nextSibling;if(e.removeChild(s),u&&u.nodeType===8)if(s=u.data,s==="/$"||s==="/&"){if(a===0){e.removeChild(u),fa(t);return}a--}else if(s==="$"||s==="$?"||s==="$~"||s==="$!"||s==="&")a++;else if(s==="html")fl(e.ownerDocument.documentElement);else if(s==="head"){s=e.ownerDocument.head,fl(s);for(var f=s.firstChild;f;){var y=f.nextSibling,C=f.nodeName;f[ka]||C==="SCRIPT"||C==="STYLE"||C==="LINK"&&f.rel.toLowerCase()==="stylesheet"||s.removeChild(f),f=y}}else s==="body"&&fl(e.ownerDocument.body);s=u}while(s);fa(t)}function Qx(e,t){var s=e;e=0;do{var a=s.nextSibling;if(s.nodeType===1?t?(s._stashedDisplay=s.style.display,s.style.display="none"):(s.style.display=s._stashedDisplay||"",s.getAttribute("style")===""&&s.removeAttribute("style")):s.nodeType===3&&(t?(s._stashedText=s.nodeValue,s.nodeValue=""):s.nodeValue=s._stashedText||""),a&&a.nodeType===8)if(s=a.data,s==="/$"){if(e===0)break;e--}else s!=="$"&&s!=="$?"&&s!=="$~"&&s!=="$!"||e++;s=a}while(s)}function tf(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var s=t;switch(t=t.nextSibling,s.nodeName){case"HTML":case"HEAD":case"BODY":tf(s),au(s);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(s.rel.toLowerCase()==="stylesheet")continue}e.removeChild(s)}}function QE(e,t,s,a){for(;e.nodeType===1;){var u=s;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!a&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(a){if(!e[ka])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(f=e.getAttribute("rel"),f==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(f!==u.rel||e.getAttribute("href")!==(u.href==null||u.href===""?null:u.href)||e.getAttribute("crossorigin")!==(u.crossOrigin==null?null:u.crossOrigin)||e.getAttribute("title")!==(u.title==null?null:u.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(f=e.getAttribute("src"),(f!==(u.src==null?null:u.src)||e.getAttribute("type")!==(u.type==null?null:u.type)||e.getAttribute("crossorigin")!==(u.crossOrigin==null?null:u.crossOrigin))&&f&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var f=u.name==null?null:""+u.name;if(u.type==="hidden"&&e.getAttribute("name")===f)return e}else return e;if(e=ns(e.nextSibling),e===null)break}return null}function ZE(e,t,s){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!s||(e=ns(e.nextSibling),e===null))return null;return e}function Zx(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=ns(e.nextSibling),e===null))return null;return e}function nf(e){return e.data==="$?"||e.data==="$~"}function sf(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function JE(e,t){var s=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||s.readyState!=="loading")t();else{var a=function(){t(),s.removeEventListener("DOMContentLoaded",a)};s.addEventListener("DOMContentLoaded",a),e._reactRetry=a}}function ns(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?"||t==="$~"||t==="&"||t==="F!"||t==="F")break;if(t==="/$"||t==="/&")return null}}return e}var of=null;function Jx(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var s=e.data;if(s==="/$"||s==="/&"){if(t===0)return ns(e.nextSibling);t--}else s!=="$"&&s!=="$!"&&s!=="$?"&&s!=="$~"&&s!=="&"||t++}e=e.nextSibling}return null}function Wx(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var s=e.data;if(s==="$"||s==="$!"||s==="$?"||s==="$~"||s==="&"){if(t===0)return e;t--}else s!=="/$"&&s!=="/&"||t++}e=e.previousSibling}return null}function eb(e,t,s){switch(t=Xi(s),e){case"html":if(e=t.documentElement,!e)throw Error(l(452));return e;case"head":if(e=t.head,!e)throw Error(l(453));return e;case"body":if(e=t.body,!e)throw Error(l(454));return e;default:throw Error(l(451))}}function fl(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);au(e)}var ss=new Map,tb=new Set;function Ki(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Fs=U.d;U.d={f:WE,r:eN,D:tN,C:nN,L:sN,m:oN,X:aN,S:rN,M:lN};function WE(){var e=Fs.f(),t=Hi();return e||t}function eN(e){var t=_r(e);t!==null&&t.tag===5&&t.type==="form"?bg(t):Fs.r(e)}var ca=typeof document>"u"?null:document;function nb(e,t,s){var a=ca;if(a&&typeof t=="string"&&t){var u=$n(t);u='link[rel="'+e+'"][href="'+u+'"]',typeof s=="string"&&(u+='[crossorigin="'+s+'"]'),tb.has(u)||(tb.add(u),e={rel:e,crossOrigin:s,href:t},a.querySelector(u)===null&&(t=a.createElement("link"),xn(t,"link",e),ln(t),a.head.appendChild(t)))}}function tN(e){Fs.D(e),nb("dns-prefetch",e,null)}function nN(e,t){Fs.C(e,t),nb("preconnect",e,t)}function sN(e,t,s){Fs.L(e,t,s);var a=ca;if(a&&e&&t){var u='link[rel="preload"][as="'+$n(t)+'"]';t==="image"&&s&&s.imageSrcSet?(u+='[imagesrcset="'+$n(s.imageSrcSet)+'"]',typeof s.imageSizes=="string"&&(u+='[imagesizes="'+$n(s.imageSizes)+'"]')):u+='[href="'+$n(e)+'"]';var f=u;switch(t){case"style":f=ua(e);break;case"script":f=da(e)}ss.has(f)||(e=x({rel:"preload",href:t==="image"&&s&&s.imageSrcSet?void 0:e,as:t},s),ss.set(f,e),a.querySelector(u)!==null||t==="style"&&a.querySelector(ml(f))||t==="script"&&a.querySelector(pl(f))||(t=a.createElement("link"),xn(t,"link",e),ln(t),a.head.appendChild(t)))}}function oN(e,t){Fs.m(e,t);var s=ca;if(s&&e){var a=t&&typeof t.as=="string"?t.as:"script",u='link[rel="modulepreload"][as="'+$n(a)+'"][href="'+$n(e)+'"]',f=u;switch(a){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":f=da(e)}if(!ss.has(f)&&(e=x({rel:"modulepreload",href:e},t),ss.set(f,e),s.querySelector(u)===null)){switch(a){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(s.querySelector(pl(f)))return}a=s.createElement("link"),xn(a,"link",e),ln(a),s.head.appendChild(a)}}}function rN(e,t,s){Fs.S(e,t,s);var a=ca;if(a&&e){var u=Mr(a).hoistableStyles,f=ua(e);t=t||"default";var y=u.get(f);if(!y){var C={loading:0,preload:null};if(y=a.querySelector(ml(f)))C.loading=5;else{e=x({rel:"stylesheet",href:e,"data-precedence":t},s),(s=ss.get(f))&&rf(e,s);var P=y=a.createElement("link");ln(P),xn(P,"link",e),P._p=new Promise(function(ae,ge){P.onload=ae,P.onerror=ge}),P.addEventListener("load",function(){C.loading|=1}),P.addEventListener("error",function(){C.loading|=2}),C.loading|=4,$i(y,t,a)}y={type:"stylesheet",instance:y,count:1,state:C},u.set(f,y)}}}function aN(e,t){Fs.X(e,t);var s=ca;if(s&&e){var a=Mr(s).hoistableScripts,u=da(e),f=a.get(u);f||(f=s.querySelector(pl(u)),f||(e=x({src:e,async:!0},t),(t=ss.get(u))&&af(e,t),f=s.createElement("script"),ln(f),xn(f,"link",e),s.head.appendChild(f)),f={type:"script",instance:f,count:1,state:null},a.set(u,f))}}function lN(e,t){Fs.M(e,t);var s=ca;if(s&&e){var a=Mr(s).hoistableScripts,u=da(e),f=a.get(u);f||(f=s.querySelector(pl(u)),f||(e=x({src:e,async:!0,type:"module"},t),(t=ss.get(u))&&af(e,t),f=s.createElement("script"),ln(f),xn(f,"link",e),s.head.appendChild(f)),f={type:"script",instance:f,count:1,state:null},a.set(u,f))}}function sb(e,t,s,a){var u=(u=V.current)?Ki(u):null;if(!u)throw Error(l(446));switch(e){case"meta":case"title":return null;case"style":return typeof s.precedence=="string"&&typeof s.href=="string"?(t=ua(s.href),s=Mr(u).hoistableStyles,a=s.get(t),a||(a={type:"style",instance:null,count:0,state:null},s.set(t,a)),a):{type:"void",instance:null,count:0,state:null};case"link":if(s.rel==="stylesheet"&&typeof s.href=="string"&&typeof s.precedence=="string"){e=ua(s.href);var f=Mr(u).hoistableStyles,y=f.get(e);if(y||(u=u.ownerDocument||u,y={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},f.set(e,y),(f=u.querySelector(ml(e)))&&!f._p&&(y.instance=f,y.state.loading=5),ss.has(e)||(s={rel:"preload",as:"style",href:s.href,crossOrigin:s.crossOrigin,integrity:s.integrity,media:s.media,hrefLang:s.hrefLang,referrerPolicy:s.referrerPolicy},ss.set(e,s),f||iN(u,e,s,y.state))),t&&a===null)throw Error(l(528,""));return y}if(t&&a!==null)throw Error(l(529,""));return null;case"script":return t=s.async,s=s.src,typeof s=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=da(s),s=Mr(u).hoistableScripts,a=s.get(t),a||(a={type:"script",instance:null,count:0,state:null},s.set(t,a)),a):{type:"void",instance:null,count:0,state:null};default:throw Error(l(444,e))}}function ua(e){return'href="'+$n(e)+'"'}function ml(e){return'link[rel="stylesheet"]['+e+"]"}function ob(e){return x({},e,{"data-precedence":e.precedence,precedence:null})}function iN(e,t,s,a){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?a.loading=1:(t=e.createElement("link"),a.preload=t,t.addEventListener("load",function(){return a.loading|=1}),t.addEventListener("error",function(){return a.loading|=2}),xn(t,"link",s),ln(t),e.head.appendChild(t))}function da(e){return'[src="'+$n(e)+'"]'}function pl(e){return"script[async]"+e}function rb(e,t,s){if(t.count++,t.instance===null)switch(t.type){case"style":var a=e.querySelector('style[data-href~="'+$n(s.href)+'"]');if(a)return t.instance=a,ln(a),a;var u=x({},s,{"data-href":s.href,"data-precedence":s.precedence,href:null,precedence:null});return a=(e.ownerDocument||e).createElement("style"),ln(a),xn(a,"style",u),$i(a,s.precedence,e),t.instance=a;case"stylesheet":u=ua(s.href);var f=e.querySelector(ml(u));if(f)return t.state.loading|=4,t.instance=f,ln(f),f;a=ob(s),(u=ss.get(u))&&rf(a,u),f=(e.ownerDocument||e).createElement("link"),ln(f);var y=f;return y._p=new Promise(function(C,P){y.onload=C,y.onerror=P}),xn(f,"link",a),t.state.loading|=4,$i(f,s.precedence,e),t.instance=f;case"script":return f=da(s.src),(u=e.querySelector(pl(f)))?(t.instance=u,ln(u),u):(a=s,(u=ss.get(f))&&(a=x({},s),af(a,u)),e=e.ownerDocument||e,u=e.createElement("script"),ln(u),xn(u,"link",a),e.head.appendChild(u),t.instance=u);case"void":return null;default:throw Error(l(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(a=t.instance,t.state.loading|=4,$i(a,s.precedence,e));return t.instance}function $i(e,t,s){for(var a=s.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),u=a.length?a[a.length-1]:null,f=u,y=0;y<a.length;y++){var C=a[y];if(C.dataset.precedence===t)f=C;else if(f!==u)break}f?f.parentNode.insertBefore(e,f.nextSibling):(t=s.nodeType===9?s.head:s,t.insertBefore(e,t.firstChild))}function rf(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function af(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var Qi=null;function ab(e,t,s){if(Qi===null){var a=new Map,u=Qi=new Map;u.set(s,a)}else u=Qi,a=u.get(s),a||(a=new Map,u.set(s,a));if(a.has(e))return a;for(a.set(e,null),s=s.getElementsByTagName(e),u=0;u<s.length;u++){var f=s[u];if(!(f[ka]||f[nn]||e==="link"&&f.getAttribute("rel")==="stylesheet")&&f.namespaceURI!=="http://www.w3.org/2000/svg"){var y=f.getAttribute(t)||"";y=e+y;var C=a.get(y);C?C.push(f):a.set(y,[f])}}return a}function lb(e,t,s){e=e.ownerDocument||e,e.head.insertBefore(s,t==="title"?e.querySelector("head > title"):null)}function cN(e,t,s){if(s===1||t.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;return t.rel==="stylesheet"?(e=t.disabled,typeof t.precedence=="string"&&e==null):!0;case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function ib(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function uN(e,t,s,a){if(s.type==="stylesheet"&&(typeof a.media!="string"||matchMedia(a.media).matches!==!1)&&(s.state.loading&4)===0){if(s.instance===null){var u=ua(a.href),f=t.querySelector(ml(u));if(f){t=f._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=Zi.bind(e),t.then(e,e)),s.state.loading|=4,s.instance=f,ln(f);return}f=t.ownerDocument||t,a=ob(a),(u=ss.get(u))&&rf(a,u),f=f.createElement("link"),ln(f);var y=f;y._p=new Promise(function(C,P){y.onload=C,y.onerror=P}),xn(f,"link",a),s.instance=f}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(s,t),(t=s.state.preload)&&(s.state.loading&3)===0&&(e.count++,s=Zi.bind(e),t.addEventListener("load",s),t.addEventListener("error",s))}}var lf=0;function dN(e,t){return e.stylesheets&&e.count===0&&Wi(e,e.stylesheets),0<e.count||0<e.imgCount?function(s){var a=setTimeout(function(){if(e.stylesheets&&Wi(e,e.stylesheets),e.unsuspend){var f=e.unsuspend;e.unsuspend=null,f()}},6e4+t);0<e.imgBytes&&lf===0&&(lf=62500*qE());var u=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Wi(e,e.stylesheets),e.unsuspend)){var f=e.unsuspend;e.unsuspend=null,f()}},(e.imgBytes>lf?50:800)+t);return e.unsuspend=s,function(){e.unsuspend=null,clearTimeout(a),clearTimeout(u)}}:null}function Zi(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Wi(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Ji=null;function Wi(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Ji=new Map,t.forEach(fN,e),Ji=null,Zi.call(e))}function fN(e,t){if(!(t.state.loading&4)){var s=Ji.get(e);if(s)var a=s.get(null);else{s=new Map,Ji.set(e,s);for(var u=e.querySelectorAll("link[data-precedence],style[data-precedence]"),f=0;f<u.length;f++){var y=u[f];(y.nodeName==="LINK"||y.getAttribute("media")!=="not all")&&(s.set(y.dataset.precedence,y),a=y)}a&&s.set(null,a)}u=t.instance,y=u.getAttribute("data-precedence"),f=s.get(y)||a,f===a&&s.set(null,u),s.set(y,u),this.count++,a=Zi.bind(this),u.addEventListener("load",a),u.addEventListener("error",a),f?f.parentNode.insertBefore(u,f.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(u,e.firstChild)),t.state.loading|=4}}var hl={$$typeof:_,Provider:null,Consumer:null,_currentValue:Y,_currentValue2:Y,_threadCount:0};function mN(e,t,s,a,u,f,y,C,P){this.tag=1,this.containerInfo=e,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=rt(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=rt(0),this.hiddenUpdates=rt(null),this.identifierPrefix=a,this.onUncaughtError=u,this.onCaughtError=f,this.onRecoverableError=y,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=P,this.incompleteTransitions=new Map}function cb(e,t,s,a,u,f,y,C,P,ae,ge,Ee){return e=new mN(e,t,s,y,P,ae,ge,Ee,C),t=1,f===!0&&(t|=24),f=Un(3,null,null,t),e.current=f,f.stateNode=e,t=Bu(),t.refCount++,e.pooledCache=t,t.refCount++,f.memoizedState={element:a,isDehydrated:s,cache:t},Gu(f),e}function ub(e){return e?(e=Vr,e):Vr}function db(e,t,s,a,u,f){u=ub(u),a.context===null?a.context=u:a.pendingContext=u,a=yo(t),a.payload={element:s},f=f===void 0?null:f,f!==null&&(a.callback=f),s=vo(e,a,t),s!==null&&(Mn(s,e,t),Xa(s,e,t))}function fb(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var s=e.retryLane;e.retryLane=s!==0&&s<t?s:t}}function cf(e,t){fb(e,t),(e=e.alternate)&&fb(e,t)}function mb(e){if(e.tag===13||e.tag===31){var t=Qo(e,67108864);t!==null&&Mn(t,e,67108864),cf(e,67108864)}}function pb(e){if(e.tag===13||e.tag===31){var t=Pn();t=fo(t);var s=Qo(e,t);s!==null&&Mn(s,e,t),cf(e,t)}}var ec=!0;function pN(e,t,s,a){var u=w.T;w.T=null;var f=U.p;try{U.p=2,uf(e,t,s,a)}finally{U.p=f,w.T=u}}function hN(e,t,s,a){var u=w.T;w.T=null;var f=U.p;try{U.p=8,uf(e,t,s,a)}finally{U.p=f,w.T=u}}function uf(e,t,s,a){if(ec){var u=df(a);if(u===null)$d(e,t,a,tc,s),gb(e,a);else if(xN(u,e,t,s,a))a.stopPropagation();else if(gb(e,a),t&4&&-1<gN.indexOf(e)){for(;u!==null;){var f=_r(u);if(f!==null)switch(f.tag){case 3:if(f=f.stateNode,f.current.memoizedState.isDehydrated){var y=ee(f.pendingLanes);if(y!==0){var C=f;for(C.pendingLanes|=2,C.entangledLanes|=2;y;){var P=1<<31-xt(y);C.entanglements[1]|=P,y&=~P}gs(f),(Rt&6)===0&&(Ii=ie()+500,cl(0))}}break;case 31:case 13:C=Qo(f,2),C!==null&&Mn(C,f,2),Hi(),cf(f,2)}if(f=df(a),f===null&&$d(e,t,a,tc,s),f===u)break;u=f}u!==null&&a.stopPropagation()}else $d(e,t,a,null,s)}}function df(e){return e=fu(e),ff(e)}var tc=null;function ff(e){if(tc=null,e=kr(e),e!==null){var t=d(e);if(t===null)e=null;else{var s=t.tag;if(s===13){if(e=m(t),e!==null)return e;e=null}else if(s===31){if(e=g(t),e!==null)return e;e=null}else if(s===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return tc=e,null}function hb(e){switch(e){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(F()){case pe:return 2;case J:return 8;case je:case Fe:return 32;case Ne:return 268435456;default:return 32}default:return 32}}var mf=!1,_o=null,Mo=null,Ao=null,gl=new Map,xl=new Map,Do=[],gN="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 gb(e,t){switch(e){case"focusin":case"focusout":_o=null;break;case"dragenter":case"dragleave":Mo=null;break;case"mouseover":case"mouseout":Ao=null;break;case"pointerover":case"pointerout":gl.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":xl.delete(t.pointerId)}}function bl(e,t,s,a,u,f){return e===null||e.nativeEvent!==f?(e={blockedOn:t,domEventName:s,eventSystemFlags:a,nativeEvent:f,targetContainers:[u]},t!==null&&(t=_r(t),t!==null&&mb(t)),e):(e.eventSystemFlags|=a,t=e.targetContainers,u!==null&&t.indexOf(u)===-1&&t.push(u),e)}function xN(e,t,s,a,u){switch(t){case"focusin":return _o=bl(_o,e,t,s,a,u),!0;case"dragenter":return Mo=bl(Mo,e,t,s,a,u),!0;case"mouseover":return Ao=bl(Ao,e,t,s,a,u),!0;case"pointerover":var f=u.pointerId;return gl.set(f,bl(gl.get(f)||null,e,t,s,a,u)),!0;case"gotpointercapture":return f=u.pointerId,xl.set(f,bl(xl.get(f)||null,e,t,s,a,u)),!0}return!1}function xb(e){var t=kr(e.target);if(t!==null){var s=d(t);if(s!==null){if(t=s.tag,t===13){if(t=m(s),t!==null){e.blockedOn=t,Kl(e.priority,function(){pb(s)});return}}else if(t===31){if(t=g(s),t!==null){e.blockedOn=t,Kl(e.priority,function(){pb(s)});return}}else if(t===3&&s.stateNode.current.memoizedState.isDehydrated){e.blockedOn=s.tag===3?s.stateNode.containerInfo:null;return}}}e.blockedOn=null}function nc(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var s=df(e.nativeEvent);if(s===null){s=e.nativeEvent;var a=new s.constructor(s.type,s);du=a,s.target.dispatchEvent(a),du=null}else return t=_r(s),t!==null&&mb(t),e.blockedOn=s,!1;t.shift()}return!0}function bb(e,t,s){nc(e)&&s.delete(t)}function bN(){mf=!1,_o!==null&&nc(_o)&&(_o=null),Mo!==null&&nc(Mo)&&(Mo=null),Ao!==null&&nc(Ao)&&(Ao=null),gl.forEach(bb),xl.forEach(bb)}function sc(e,t){e.blockedOn===t&&(e.blockedOn=null,mf||(mf=!0,n.unstable_scheduleCallback(n.unstable_NormalPriority,bN)))}var oc=null;function yb(e){oc!==e&&(oc=e,n.unstable_scheduleCallback(n.unstable_NormalPriority,function(){oc===e&&(oc=null);for(var t=0;t<e.length;t+=3){var s=e[t],a=e[t+1],u=e[t+2];if(typeof a!="function"){if(ff(a||s)===null)continue;break}var f=_r(s);f!==null&&(e.splice(t,3),t-=3,ud(f,{pending:!0,data:u,method:s.method,action:a},a,u))}}))}function fa(e){function t(P){return sc(P,e)}_o!==null&&sc(_o,e),Mo!==null&&sc(Mo,e),Ao!==null&&sc(Ao,e),gl.forEach(t),xl.forEach(t);for(var s=0;s<Do.length;s++){var a=Do[s];a.blockedOn===e&&(a.blockedOn=null)}for(;0<Do.length&&(s=Do[0],s.blockedOn===null);)xb(s),s.blockedOn===null&&Do.shift();if(s=(e.ownerDocument||e).$$reactFormReplay,s!=null)for(a=0;a<s.length;a+=3){var u=s[a],f=s[a+1],y=u[wn]||null;if(typeof f=="function")y||yb(s);else if(y){var C=null;if(f&&f.hasAttribute("formAction")){if(u=f,y=f[wn]||null)C=y.formAction;else if(ff(u)!==null)continue}else C=y.action;typeof C=="function"?s[a+1]=C:(s.splice(a,3),a-=3),yb(s)}}}function vb(){function e(f){f.canIntercept&&f.info==="react-transition"&&f.intercept({handler:function(){return new Promise(function(y){return u=y})},focusReset:"manual",scroll:"manual"})}function t(){u!==null&&(u(),u=null),a||setTimeout(s,20)}function s(){if(!a&&!navigation.transition){var f=navigation.currentEntry;f&&f.url!=null&&navigation.navigate(f.url,{state:f.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var a=!1,u=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(s,100),function(){a=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),u!==null&&(u(),u=null)}}}function pf(e){this._internalRoot=e}rc.prototype.render=pf.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(l(409));var s=t.current,a=Pn();db(s,a,e,t,null,null)},rc.prototype.unmount=pf.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;db(e.current,2,null,e,null,null),Hi(),t[Or]=null}};function rc(e){this._internalRoot=e}rc.prototype.unstable_scheduleHydration=function(e){if(e){var t=Rs();e={blockedOn:null,target:e,priority:t};for(var s=0;s<Do.length&&t!==0&&t<Do[s].priority;s++);Do.splice(s,0,e),s===0&&xb(e)}};var Sb=o.version;if(Sb!=="19.2.8")throw Error(l(527,Sb,"19.2.8"));U.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(l(188)):(e=Object.keys(e).join(","),Error(l(268,e)));return e=p(t),e=e!==null?v(e):null,e=e===null?null:e.stateNode,e};var yN={bundleType:0,version:"19.2.8",rendererPackageName:"react-dom",currentDispatcherRef:w,reconcilerVersion:"19.2.8"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var ac=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!ac.isDisabled&&ac.supportsFiber)try{st=ac.inject(yN),Et=ac}catch{}}return vl.createRoot=function(e,t){if(!c(e))throw Error(l(299));var s=!1,a="",u=Rg,f=Og,y=kg;return t!=null&&(t.unstable_strictMode===!0&&(s=!0),t.identifierPrefix!==void 0&&(a=t.identifierPrefix),t.onUncaughtError!==void 0&&(u=t.onUncaughtError),t.onCaughtError!==void 0&&(f=t.onCaughtError),t.onRecoverableError!==void 0&&(y=t.onRecoverableError)),t=cb(e,1,!1,null,null,s,a,null,u,f,y,vb),e[Or]=t.current,Kd(e),new pf(t)},vl.hydrateRoot=function(e,t,s){if(!c(e))throw Error(l(299));var a=!1,u="",f=Rg,y=Og,C=kg,P=null;return s!=null&&(s.unstable_strictMode===!0&&(a=!0),s.identifierPrefix!==void 0&&(u=s.identifierPrefix),s.onUncaughtError!==void 0&&(f=s.onUncaughtError),s.onCaughtError!==void 0&&(y=s.onCaughtError),s.onRecoverableError!==void 0&&(C=s.onRecoverableError),s.formState!==void 0&&(P=s.formState)),t=cb(e,1,!0,t,s??null,a,u,P,f,y,C,vb),t.context=ub(null),s=t.current,a=Pn(),a=fo(a),u=yo(a),u.callback=null,vo(s,u,a),s=a,t.current.lanes=s,nt(t,s),gs(t),e[Or]=t.current,Kd(e),new rc(t)},vl.version="19.2.8",vl}var _b;function kN(){if(_b)return xf.exports;_b=1;function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(o){console.error(o)}}return n(),xf.exports=ON(),xf.exports}var _N=kN();const Na=["character","setting","location","hook","event"],Kf=["belongs_to","owns","masters","ally","rival","mentor","family","kills","appears_in","occurs_at","plot_edge","plants","advances","resolves","depends_on","involves","occurs_in"],MN="plot_edge",AN=["mystery","relationship","item","character_growth","world_building"],Sv=["inner","personal","extra_personal"];function ls(n){const o=new Date(n);if(Number.isNaN(o.getTime()))return n;const r=l=>String(l).padStart(2,"0");return`${o.getFullYear()}-${r(o.getMonth()+1)}-${r(o.getDate())} ${r(o.getHours())}:${r(o.getMinutes())}`}function xr(n){const o=new Date(n);if(Number.isNaN(o.getTime()))return n;const r=Math.floor((Date.now()-o.getTime())/6e4);if(r<1)return"刚刚";if(r<60)return`${r} 分钟前`;const l=Math.floor(r/60);if(l<24)return`${l} 小时前`;const c=Math.floor(l/24);return c<30?`${c} 天前`:ls(n)}const DN=["outline","entities","canvas","hooks","timeline","trash","settings"];function Mb(n){const o=n.replace(/^#/,"").replace(/^\/+/,""),r=o===""?[]:o.split("/").filter(c=>c!=="");return r.length>0&&!DN.includes(r[0])?{path:"/",segments:[],isFallback:!0}:{path:`/${r.join("/")}`,segments:r,isFallback:!1}}function zN(){const[n,o]=h.useState(()=>Mb(window.location.hash));return h.useEffect(()=>{const r=()=>{const l=Mb(window.location.hash);o(l),l.isFallback&&window.location.hash!=="#/"&&window.location.replace("#/")};return window.addEventListener("hashchange",r),r(),()=>window.removeEventListener("hashchange",r)},[]),n}function Tn(n){const o=n.startsWith("#")?n:`#${n.startsWith("/")?n:`/${n}`}`;window.location.hash!==o&&(window.location.hash=o)}const Ev=(...n)=>n.filter((o,r,l)=>!!o&&o.trim()!==""&&l.indexOf(o)===r).join(" ").trim();const LN=n=>n.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();const IN=n=>n.replace(/^([A-Z])|[\s-_]+(\w)/g,(o,r,l)=>l?l.toUpperCase():r.toLowerCase());const Ab=n=>{const o=IN(n);return o.charAt(0).toUpperCase()+o.slice(1)};var Sf={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 UN=n=>{for(const o in n)if(o.startsWith("aria-")||o==="role"||o==="title")return!0;return!1},HN=h.createContext({}),BN=()=>h.useContext(HN),YN=h.forwardRef(({color:n,size:o,strokeWidth:r,absoluteStrokeWidth:l,className:c="",children:d,iconNode:m,...g},b)=>{const{size:p=24,strokeWidth:v=2,absoluteStrokeWidth:x=!1,color:S="currentColor",className:j=""}=BN()??{},N=l??x?Number(r??v)*24/Number(o??p):r??v;return h.createElement("svg",{ref:b,...Sf,width:o??p??Sf.width,height:o??p??Sf.height,stroke:n??S,strokeWidth:N,className:Ev("lucide",j,c),...!d&&!UN(g)&&{"aria-hidden":"true"},...g},[...m.map(([k,O])=>h.createElement(k,O)),...Array.isArray(d)?d:[d]])});const St=(n,o)=>{const r=h.forwardRef(({className:l,...c},d)=>h.createElement(YN,{ref:d,iconNode:o,className:Ev(`lucide-${LN(Ab(n))}`,`lucide-${n}`,l),...c}));return r.displayName=Ab(n),r};const VN=[["path",{d:"M12 5v16",key:"1f6ucr"}],["path",{d:"M20.001 19A2 2 0 0022 17V5a2 2 0 00-1.999-2L16 3.002A5 5 0 0012 5a5 5 0 00-4-2H4a2 2 0 00-2 2v12a2 2 0 001.999 2H8a5 5 0 014 2 5 5 0 014-2z",key:"1fyvmf"}]],vm=St("book-open",VN);const PN=[["path",{d:"M16 14v2.2l1.6 1",key:"fo4ql5"}],["path",{d:"M16 2v3",key:"otl347"}],["path",{d:"M21 7.338V5a2 2 0 00-2-2H5a2 2 0 00-2 2v14a2 2 0 002 2h2.338",key:"7hb8p4"}],["path",{d:"M3 9h5.859",key:"numkqi"}],["path",{d:"M8 2v3",key:"1ioesn"}],["circle",{cx:"16",cy:"16",r:"6",key:"qoo3c4"}]],GN=St("calendar-clock",PN);const qN=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],FN=St("chevron-down",qN);const XN=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Nv=St("chevron-right",XN);const KN=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],Sm=St("circle-alert",KN);const $N=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Em=St("circle-check",$N);const QN=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],ZN=St("circle",QN);const JN=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],WN=St("download",JN);const ej=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],jv=St("ellipsis",ej);const tj=[["path",{d:"M12 6a2 2 0 0 1 3.414-1.414l6 6a2 2 0 0 1 0 2.828l-6 6A2 2 0 0 1 12 18z",key:"b19h5q"}],["path",{d:"M2 6a2 2 0 0 1 3.414-1.414l6 6a2 2 0 0 1 0 2.828l-6 6A2 2 0 0 1 2 18z",key:"h7h5ge"}]],nj=St("fast-forward",tj);const sj=[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]],oj=St("grip-vertical",sj);const rj=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],Tv=St("info",rj);const aj=[["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"}]],lj=St("layout-grid",aj);const ij=[["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"M3 10a2 2 0 0 0 2 2h3",key:"1npucw"}],["path",{d:"M3 5v12a2 2 0 0 0 2 2h3",key:"x1gjn2"}]],cj=St("list-tree",ij);const uj=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Nm=St("loader-circle",uj);const dj=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]],zl=St("message-square",dj);const fj=[["path",{d:"M5 12h14",key:"1ays0h"}]],mj=St("minus",fj);const pj=[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]],hj=St("moon",pj);const gj=[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]],xj=St("network",gj);const bj=[["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"}]],yj=St("octagon-x",bj);const vj=[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z",key:"1nkz8b"}]],Sj=St("pin",vj);const Ej=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],jm=St("plus",Ej);const Nj=[["path",{d:"M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z",key:"w46dr5"}]],jj=St("puzzle",Nj);const Tj=[["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"}]],wj=St("refresh-cw",Tj);const Cj=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],Rj=St("rotate-ccw",Cj);const Oj=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],kj=St("send",Oj);const _j=[["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"}]],Mj=St("settings",_j);const Aj=[["path",{d:"M8.3 10a.7.7 0 0 1-.626-1.079L11.4 3a.7.7 0 0 1 1.198-.043L16.3 8.9a.7.7 0 0 1-.572 1.1Z",key:"1bo67w"}],["rect",{x:"3",y:"14",width:"7",height:"7",rx:"1",key:"1bkyp8"}],["circle",{cx:"17.5",cy:"17.5",r:"3.5",key:"w3z12y"}]],Dj=St("shapes",Aj);const zj=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],wv=St("sparkles",zj);const Lj=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],Ij=St("sun",Lj);const Uj=[["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"}]],Cv=St("trash-2",Uj);const Hj=[["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"}]],Tm=St("triangle-alert",Hj);const Bj=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]],Yj=St("upload",Bj);const Vj=[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]],Pj=St("wrench",Vj);const Gj=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],ro=St("x",Gj);function Rv(n){const[o,r]=h.useState(()=>window.matchMedia(n).matches);return h.useEffect(()=>{const l=window.matchMedia(n),c=d=>r(d.matches);return r(l.matches),l.addEventListener("change",c),()=>l.removeEventListener("change",c)},[n]),o}const Db=n=>{let o;const r=new Set,l=(p,v)=>{const x=typeof p=="function"?p(o):p;if(!Object.is(x,o)){const S=o;o=v??(typeof x!="object"||x===null)?x:Object.assign({},o,x),r.forEach(j=>j(o,S))}},c=()=>o,g={setState:l,getState:c,getInitialState:()=>b,subscribe:p=>(r.add(p),()=>r.delete(p))},b=o=n(l,c,g);return g},qj=(n=>n?Db(n):Db),Fj=n=>n;function Xj(n,o=Fj){const r=Re.useSyncExternalStore(n.subscribe,Re.useCallback(()=>o(n.getState()),[n,o]),Re.useCallback(()=>o(n.getInitialState()),[n,o]));return Re.useDebugValue(r),r}const zb=n=>{const o=qj(n),r=l=>Xj(o,l);return Object.assign(r,o),r},wm=(n=>n?zb(n):zb),Kj="/api/v1",vt="CLIENT_NETWORK_ERROR";class Ue extends Error{code;constructor(o,r){super(r),this.name="ApiError",this.code=o}}function $j(n){const o=new URLSearchParams;for(const[l,c]of Object.entries(n))c!=null&&o.set(l,String(c));const r=o.toString();return r?`?${r}`:""}function Ov(n,o){const r=n.startsWith("/")?n:`/${n}`;return`${Kj}${r}${$j(o??{})}`}function Qj(n){return typeof n=="object"&&n!==null&&n.success===!0}function kv(n){if(typeof n!="object"||n===null)return!1;const o=n.error;return n.success===!1&&typeof o=="object"&&o!==null&&typeof o.code=="string"&&typeof o.message=="string"}async function gt(n,o={}){const{method:r="GET",body:l,query:c,headers:d,signal:m}=o;let g;try{g=await fetch(Ov(n,c),{method:r,headers:l===void 0||l instanceof FormData?d:{"Content-Type":"application/json",...d},body:l===void 0?void 0:l instanceof FormData?l:JSON.stringify(l),signal:m})}catch(p){throw new Ue(vt,p instanceof Error?p.message:"网络请求失败")}const b=await g.json().catch(()=>null);if(Qj(b))return b.data;throw kv(b)?new Ue(b.error.code,b.error.message):new Ue(vt,`非预期响应(HTTP ${g.status})`)}function Zj(){return gt("/project/config")}function Jj(n){return gt("/project/config",{method:"PUT",body:n})}function Wj(){return gt("/outline")}function eT(n){return gt("/outline",{method:"POST",body:n})}function _v(n,o){return gt(`/outline/${n}`,{method:"PUT",body:o})}function Lb(n,o){return gt(`/outline/${n}/move`,{method:"PUT",body:o})}function tT(n){return gt(`/outline/${n}`,{method:"DELETE"})}function nT(){return gt("/trash")}function sT(n,o){return gt(`/trash/entity/${n}/${o}/restore`,{method:"POST"})}function oT(n,o){return gt(`/trash/entity/${n}/${o}`,{method:"DELETE"})}function Ib(n){return gt(`/trash/outline/${n}/restore`,{method:"POST"})}function rT(n){return gt(`/trash/outline/${n}`,{method:"DELETE"})}function br(n,o={}){return gt(`/entity/${n}`,{query:o})}function mr(n,o){return gt(`/entity/${n}/${o}`)}function Cm(n,o){return gt(`/entity/${n}`,{method:"POST",body:o})}function Ra(n,o,r){return gt(`/entity/${n}/${o}`,{method:"PUT",body:r})}function Hc(n,o){return gt(`/entity/${n}/${o}`,{method:"DELETE"})}function aT(n,o){return gt(`/entity/event/${n}/move`,{method:"PUT",body:o})}function ja(n){return gt("/relation",{query:{source_type:n.source_type,source_id:n.source_id,target_type:n.target_type,target_id:n.target_id,relation_type:n.relation_type,depth:n.depth}})}function Oa(n){return gt("/relation",{method:"POST",body:n})}function Bc(n){return gt(`/relation/${n}`,{method:"DELETE"})}function lT(n,o){return gt(`/relation/${n}`,{method:"PUT",body:{metadata:o}})}function iT(n){return gt(`/delta/node/${n}`)}function cT(n){return gt("/delta/compute",{method:"POST",body:n})}function Rm(n){return gt("/delta",{method:"POST",body:n})}function uT(){return gt("/project/list")}function dT(n,o){return gt("/project/create",{method:"POST",body:{path:n,...o!==void 0?{config:o}:{}}})}function fT(n){return gt("/project/open",{method:"POST",body:{path:n}})}function mT(){return gt("/project/close",{method:"POST"})}function pT(n){if(n!==null){const o=/filename\*\s*=\s*UTF-8''([^;]+)/i.exec(n);if(o)try{return decodeURIComponent(o[1])}catch{}const r=/filename\s*=\s*"?([^";]+)"?/i.exec(n);if(r)return r[1]}return"project.zip"}async function hT(){let n;try{n=await fetch(Ov("/project/export"))}catch(r){throw new Ue(vt,r instanceof Error?r.message:"网络请求失败")}const o=n.headers.get("content-type")??"";if(n.ok&&(o.includes("zip")||o.includes("octet-stream")))return{blob:await n.blob(),filename:pT(n.headers.get("content-disposition"))};if(o.includes("application/json")){const r=await n.json().catch(()=>null);if(kv(r))throw new Ue(r.error.code,r.error.message)}throw new Ue(vt,`非预期响应(HTTP ${n.status})`)}async function gT(n,o){const r=new FormData;return r.append("file",n,"backup.zip"),r.append("name",o),gt("/project/import",{method:"POST",body:r})}function xT(){return gt("/settings/llm")}function Ef(n){return gt("/settings/llm",{method:"PUT",body:n})}function bT(){return gt("/chat/sessions").then(n=>n.sessions)}function yT(n){return gt(`/chat/sessions/${n}/messages`)}function vT(n){return gt(`/proposal/${n}/confirm`,{method:"POST"})}function ST(n){return gt(`/proposal/${n}/reject`,{method:"POST"})}const $f=3e3;let ET=0;const ke=wm((n,o)=>({error:null,showError:(r,l)=>n({error:{code:r,message:l}}),clearError:()=>n({error:null}),toast:null,showToast:(r,l="success")=>{const c=++ET;n({toast:{id:c,kind:l,text:r}}),setTimeout(()=>{n(d=>d.toast?.id===c?{toast:null}:{})},$f)},clearToast:()=>n({toast:null}),confirmState:null,confirm:r=>new Promise(l=>{n({confirmState:{...r,resolve:l}})}),resolveConfirm:r=>{const l=o().confirmState;l&&(l.resolve(r),n({confirmState:null}))},focusOutlineNodeId:null,setFocusOutlineNode:r=>n({focusOutlineNodeId:r}),clearFocusOutlineNode:()=>n({focusOutlineNodeId:null}),dataVersion:0,notifyDataChanged:()=>n(r=>({dataVersion:r.dataVersion+1}))})),ze=wm((n,o)=>({config:null,configLoading:!1,loadError:null,outline:null,outlineLoading:!1,bookshelf:null,bookshelfLoading:!1,bookshelfError:null,loadConfig:async()=>{if(!o().configLoading){n({configLoading:!0});try{const r=await Zj();n({config:r,loadError:null})}catch(r){const l=r instanceof Ue?r.code:"CLIENT_NETWORK_ERROR";n({config:null,loadError:l})}finally{n({configLoading:!1})}}},updateConfig:async r=>{await Jj(r),await o().loadConfig()},loadOutline:async()=>{if(!o().outlineLoading){n({outlineLoading:!0});try{const r=await Wj();n({outline:r})}catch{n({outline:null})}finally{n({outlineLoading:!1})}}},loadBookshelf:async()=>{if(!o().bookshelfLoading){n({bookshelfLoading:!0});try{const r=await uT();n({bookshelf:r,bookshelfError:null})}catch(r){const l=r instanceof Ue?r.code:"CLIENT_NETWORK_ERROR";n({bookshelf:null,bookshelfError:l})}finally{n({bookshelfLoading:!1})}}},openProjectAt:async r=>{const l=await fT(r);n({config:l.config,loadError:null}),ke.getState().clearFocusOutlineNode(),l.rebuilt?ke.getState().showToast(`项目已按新版本重建${l.fromVersion!==void 0?`(v${l.fromVersion})`:""},备份已保留`):l.migrated&&ke.getState().showToast(`项目数据已自动升级${l.fromVersion!==void 0?`(v${l.fromVersion} → 当前版本)`:""},快照已保留`),await o().loadOutline()},createProjectAt:async(r,l)=>{await dT(r,l),await o().openProjectAt(r)},closeProject:async()=>{await mT(),n({config:null,loadError:null,outline:null}),ke.getState().clearFocusOutlineNode()}}));function Mv(n,o){if(n.id===o)return n;if("children"in n&&n.children)for(const r of n.children){const l=Mv(r,o);if(l)return l}return null}function Av(n,o){if(!n||!o)return null;for(const r of n.children){const l=Mv(r,o);if(l)return l.title}return null}function Dv(n,o){return`${n.replace(/\/+$/,"")}/books/${o.trim()}`}const NT="[DONE]",jT=6e4;function TT(n){const o=[];let r=n,l;for(;(l=r.indexOf(`
|
|
10
|
-
|
|
11
|
-
`))!==-1;)o.push(r.slice(0,l)),r=r.slice(l+2);return{frames:o,rest:r}}function Ub(n){let o="message";const r=[];for(const l of n.split(`
|
|
12
|
-
`))if(!(l===""||l.startsWith(":"))){if(l.startsWith("event:"))o=l.slice(6).trim();else if(l.startsWith("data:")){let c=l.slice(5);c.startsWith(" ")&&(c=c.slice(1)),r.push(c)}}return r.length===0?null:{event:o,data:r.join(`
|
|
13
|
-
`)}}function Hb(n){if(typeof n!="object"||n===null)return!1;const o=n.error;return typeof o=="object"&&o!==null&&typeof o.code=="string"&&typeof o.message=="string"}function wT(n,o){const{onEvent:r,timeoutMs:l=jT,onTimeout:c,onEnd:d,signal:m,body:g}=o,b=new AbortController,p=()=>b.abort();m&&(m.aborted?b.abort():m.addEventListener("abort",p));let v="",x=!1,S=!1,j=!1,N=!1,k=null;const O=()=>{k!==null&&(clearTimeout(k),k=null)},E=()=>{O(),k=setTimeout(()=>{x||(S=!0,x=!0,c?.(),b.abort())},l)},T=_=>{if(_.data===NT)return!1;let R=_.data;try{R=JSON.parse(_.data)}catch{}return r(_.event,R),_.event!=="error"};return E(),(async()=>{try{const _=await fetch(n,{method:"POST",headers:{"Content-Type":"application/json",Accept:"text/event-stream"},body:g===void 0?void 0:JSON.stringify(g),signal:b.signal});if(!_.ok||!_.body){const A=await _.json().catch(()=>null),B=Hb(A)?A.error.code:vt,M=Hb(A)?A.error.message:`SSE 请求失败(HTTP ${_.status})`;x=!0,N=!0,r("error",{code:B,message:M});return}const R=_.body.getReader(),H=new TextDecoder;for(;!x;){const{done:A,value:B}=await R.read();if(A)break;v=(v+H.decode(B,{stream:!0})).replace(/\r\n/g,`
|
|
14
|
-
`);const{frames:M,rest:Q}=TT(v);v=Q;for(const ne of M){const me=Ub(ne);if(me){if(!T(me)){x=!0;break}E()}}}if(!x&&v.trim()!==""){const A=Ub(v.trim());A&&!T(A)&&(x=!0)}}catch{!S&&!j&&(x=!0,N=!0,r("error",{code:vt,message:"网络请求失败"}))}finally{O(),m&&m.removeEventListener("abort",p),x=!0,!S&&!j&&!N&&d?.()}})(),()=>{x||(j=!0,x=!0,O(),b.abort())}}function CT(n,o){return o.includes("HTTP 404")?"聊天服务暂不可用":n==="CLIENT_NETWORK_ERROR"&&!o.includes("HTTP ")?"连接失败,请确认服务已启动":o}function RT(n,o){switch(n){case"INTERNAL_ERROR":return"提案执行失败,请让 AI 重新生成提案";case"CLIENT_NETWORK_ERROR":return"网络请求失败,请重试";default:return o}}let ma=0,pa=0,Bb=0,cr=null,xs=null,ha=null;const Nt=wm((n,o)=>{const r=async(l,c,d)=>{const m=o().proposals.find(g=>g.proposalId===l);if(!(!m||m.status!=="pending"||m.processing===!0)){n(g=>({proposals:g.proposals.map(b=>b.proposalId===l?{...b,processing:!0}:b)}));try{await c(l),n(g=>({proposals:g.proposals.map(b=>b.proposalId===l?{...b,status:d,processing:!1}:b)})),d==="confirmed"&&ke.getState().notifyDataChanged()}catch(g){const b=g instanceof Ue?g.code:"CLIENT_NETWORK_ERROR",p=g instanceof Error?g.message:"网络请求失败";switch(b){case"PROPOSAL_STALE":n(v=>({proposals:v.proposals.map(x=>x.proposalId===l?{...x,status:"stale",processing:!1}:x)}));return;case"PROPOSAL_NOT_FOUND":case"PROPOSAL_PROJECT_MISMATCH":n(v=>({proposals:v.proposals.filter(x=>x.proposalId!==l)}));return;default:ke.getState().showToast(RT(b,p),"error"),n(v=>({proposals:v.proposals.map(x=>x.proposalId===l?{...x,processing:!1}:x)}));return}}}};return{sessions:null,sessionsLoading:!1,sessionsError:null,currentSessionId:null,messages:[],messagesLoading:!1,loadSessions:async()=>{if(o().sessionsLoading)return;const l=++ma;n({sessionsLoading:!0});try{const c=await bT();if(l!==ma)return;n({sessions:c,sessionsError:null}),o().currentSessionId===null&&c.length>0&&o().setCurrentSession(c[0].id)}catch(c){if(l!==ma)return;const d=c instanceof Ue?c.code:"CLIENT_NETWORK_ERROR";n({sessions:null,sessionsError:d})}finally{l===ma&&n({sessionsLoading:!1})}},setCurrentSession:l=>{l!==o().currentSessionId&&(pa++,cr?.(),cr=null,xs=null,ha=null,n({currentSessionId:l,messages:[],messagesLoading:!1,streaming:!1,streamError:null,disconnected:!1,focusContext:null,proposals:[],streamTools:[]}),l!==null&&o().loadMessages(l))},newSession:()=>{ma++,o().setCurrentSession(null)},clearSessions:()=>{ma++,pa++,cr?.(),cr=null,xs=null,ha=null,n({sessions:null,sessionsLoading:!1,sessionsError:null,currentSessionId:null,messages:[],messagesLoading:!1,streaming:!1,streamError:null,disconnected:!1,focusContext:null,proposals:[],streamTools:[]})},loadMessages:async l=>{const c=++pa;n({messagesLoading:!0});try{const d=await yT(l);if(c!==pa)return;const m=d.messages.map(g=>({...g,sessionId:d.sessionId}));n({messages:m})}catch{if(c!==pa)return;n({messages:[]})}finally{c===pa&&n({messagesLoading:!1})}},streaming:!1,streamError:null,setStreamError:l=>n({streamError:l}),focusContext:null,setFocusContext:l=>n({focusContext:l}),clearFocusContext:()=>n({focusContext:null}),disconnected:!1,setDisconnected:l=>n({disconnected:l}),proposals:[],streamTools:[],sendMessage:l=>{const{streaming:c,messagesLoading:d,currentSessionId:m,focusContext:g}=o(),b=l.trim();if(!b||c||d)return;cr?.(),cr=null;const p=new Date().toISOString(),v=m??"",x=`local-${++Bb}`;xs=x,ha=b,n(j=>({messages:[...j.messages,{id:`local-${++Bb}`,sessionId:v,role:"user",content:b,createdAt:p},{id:x,sessionId:v,role:"assistant",content:"",createdAt:p}],streaming:!0,streamError:null,disconnected:!1,proposals:[],streamTools:[]}));const S={message:b};m&&(S.session_id=m),g&&(S.context=g),cr=wT("/api/v1/chat",{body:S,onEvent:(j,N)=>{switch(j){case"ping":break;case"text":{const k=N?.delta??"";xs&&n(O=>({messages:O.messages.map(E=>E.id===xs?{...E,content:(E.content??"")+k}:E)}));break}case"tool_call":{const{tool:k,args:O,id:E}=N;if(!E||!k)break;n(T=>({streamTools:[...T.streamTools,{id:E,tool:k,args:O,status:"running"}]}));break}case"tool_result":{const{id:k}=N;if(!k)break;n(O=>({streamTools:O.streamTools.map(E=>E.id===k?{...E,result:N.result,status:"ok"}:E)}));break}case"proposal":{const{proposal_id:k,type:O,preview:E}=N;if(!k||!O)break;n(T=>({proposals:[...T.proposals,{proposalId:k,type:O,preview:E,status:"pending"}]}));break}case"done":{if(xs===null)break;const k=N?.session_id;n({streaming:!1,currentSessionId:k??o().currentSessionId}),k&&o().loadSessions();break}case"error":{const{code:k,message:O}=N;n({streaming:!1,streamError:CT(k??"",O??"")});break}}},onTimeout:()=>{xs===x&&(xs=null,n({streaming:!1,disconnected:!0,proposals:[],streamTools:[]}))},onEnd:()=>{xs===x&&(xs=null,n(j=>j.streaming?{streaming:!1}:{}))}})},resendLast:()=>{const{messages:l,streaming:c}=o();if(c||!ha)return;let d=l;d[d.length-1]?.role==="assistant"&&(d=d.slice(0,-1));const g=d[d.length-1];g?.role==="user"&&g.content===ha&&(d=d.slice(0,-1)),n({messages:d}),o().sendMessage(ha)},confirmProposal:l=>r(l,vT,"confirmed"),rejectProposal:l=>r(l,ST,"rejected")}});let Yb=ze.getState().config?.id??null;ze.subscribe(n=>{const o=n.config?.id??null;o!==Yb&&(Yb=o,Nt.getState().clearSessions(),o!==null&&Nt.getState().loadSessions())});function zv(n){var o,r,l="";if(typeof n=="string"||typeof n=="number")l+=n;else if(typeof n=="object")if(Array.isArray(n)){var c=n.length;for(o=0;o<c;o++)n[o]&&(r=zv(n[o]))&&(l&&(l+=" "),l+=r)}else for(r in n)n[r]&&(l&&(l+=" "),l+=r);return l}function Lv(){for(var n,o,r=0,l="",c=arguments.length;r<c;r++)(n=arguments[r])&&(o=zv(n))&&(l&&(l+=" "),l+=o);return l}const OT=(n,o)=>{const r=new Array(n.length+o.length);for(let l=0;l<n.length;l++)r[l]=n[l];for(let l=0;l<o.length;l++)r[n.length+l]=o[l];return r},kT=(n,o)=>({classGroupId:n,validator:o}),Iv=(n=new Map,o=null,r)=>({nextPart:n,validators:o,classGroupId:r}),Cc="-",Vb=[],_T="arbitrary..",MT=n=>{const o=DT(n),{conflictingClassGroups:r,conflictingClassGroupModifiers:l}=n;return{getClassGroupId:m=>{if(m.startsWith("[")&&m.endsWith("]"))return AT(m);const g=m.split(Cc),b=g[0]===""&&g.length>1?1:0;return Uv(g,b,o)},getConflictingClassGroupIds:(m,g)=>{if(g){const b=l[m],p=r[m];return b?p?OT(p,b):b:p||Vb}return r[m]||Vb}}},Uv=(n,o,r)=>{if(n.length-o===0)return r.classGroupId;const c=n[o],d=r.nextPart.get(c);if(d){const p=Uv(n,o+1,d);if(p)return p}const m=r.validators;if(m===null)return;const g=o===0?n.join(Cc):n.slice(o).join(Cc),b=m.length;for(let p=0;p<b;p++){const v=m[p];if(v.validator(g))return v.classGroupId}},AT=n=>n.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const o=n.slice(1,-1),r=o.indexOf(":"),l=o.slice(0,r);return l?_T+l:void 0})(),DT=n=>{const{theme:o,classGroups:r}=n;return zT(r,o)},zT=(n,o)=>{const r=Iv();for(const l in n){const c=n[l];Om(c,r,l,o)}return r},Om=(n,o,r,l)=>{const c=n.length;for(let d=0;d<c;d++){const m=n[d];LT(m,o,r,l)}},LT=(n,o,r,l)=>{if(typeof n=="string"){IT(n,o,r);return}if(typeof n=="function"){UT(n,o,r,l);return}HT(n,o,r,l)},IT=(n,o,r)=>{const l=n===""?o:Hv(o,n);l.classGroupId=r},UT=(n,o,r,l)=>{if(BT(n)){Om(n(l),o,r,l);return}o.validators===null&&(o.validators=[]),o.validators.push(kT(r,n))},HT=(n,o,r,l)=>{const c=Object.entries(n),d=c.length;for(let m=0;m<d;m++){const[g,b]=c[m];Om(b,Hv(o,g),r,l)}},Hv=(n,o)=>{let r=n;const l=o.split(Cc),c=l.length;for(let d=0;d<c;d++){const m=l[d];let g=r.nextPart.get(m);g||(g=Iv(),r.nextPart.set(m,g)),r=g}return r},BT=n=>"isThemeGetter"in n&&n.isThemeGetter===!0,YT=n=>{if(n<1)return{get:()=>{},set:()=>{}};let o=0,r=Object.create(null),l=Object.create(null);const c=(d,m)=>{r[d]=m,o++,o>n&&(o=0,l=r,r=Object.create(null))};return{get(d){let m=r[d];if(m!==void 0)return m;if((m=l[d])!==void 0)return c(d,m),m},set(d,m){d in r?r[d]=m:c(d,m)}}},Qf="!",Pb=":",VT=[],Gb=(n,o,r,l,c)=>({modifiers:n,hasImportantModifier:o,baseClassName:r,maybePostfixModifierPosition:l,isExternal:c}),PT=n=>{const{prefix:o,experimentalParseClassName:r}=n;let l=c=>{const d=[];let m=0,g=0,b=0,p;const v=c.length;for(let k=0;k<v;k++){const O=c[k];if(m===0&&g===0){if(O===Pb){d.push(c.slice(b,k)),b=k+1;continue}if(O==="/"){p=k;continue}}O==="["?m++:O==="]"?m--:O==="("?g++:O===")"&&g--}const x=d.length===0?c:c.slice(b);let S=x,j=!1;x.endsWith(Qf)?(S=x.slice(0,-1),j=!0):x.startsWith(Qf)&&(S=x.slice(1),j=!0);const N=p&&p>b?p-b:void 0;return Gb(d,j,S,N)};if(o){const c=o+Pb,d=l;l=m=>m.startsWith(c)?d(m.slice(c.length)):Gb(VT,!1,m,void 0,!0)}if(r){const c=l;l=d=>r({className:d,parseClassName:c})}return l},GT=n=>{const o=new Map;return n.orderSensitiveModifiers.forEach((r,l)=>{o.set(r,1e6+l)}),r=>{const l=[];let c=[];for(let d=0;d<r.length;d++){const m=r[d],g=m[0]==="[",b=o.has(m);g||b?(c.length>0&&(c.sort(),l.push(...c),c=[]),l.push(m)):c.push(m)}return c.length>0&&(c.sort(),l.push(...c)),l}},qT=n=>({cache:YT(n.cacheSize),parseClassName:PT(n),sortModifiers:GT(n),postfixLookupClassGroupIds:FT(n),...MT(n)}),FT=n=>{const o=Object.create(null),r=n.postfixLookupClassGroups;if(r)for(let l=0;l<r.length;l++)o[r[l]]=!0;return o},XT=/\s+/,KT=(n,o)=>{const{parseClassName:r,getClassGroupId:l,getConflictingClassGroupIds:c,sortModifiers:d,postfixLookupClassGroupIds:m}=o,g=[],b=n.trim().split(XT);let p="";for(let v=b.length-1;v>=0;v-=1){const x=b[v],{isExternal:S,modifiers:j,hasImportantModifier:N,baseClassName:k,maybePostfixModifierPosition:O}=r(x);if(S){p=x+(p.length>0?" "+p:p);continue}let E=!!O,T;if(E){const B=k.substring(0,O);T=l(B);const M=T&&m[T]?l(k):void 0;M&&M!==T&&(T=M,E=!1)}else T=l(k);if(!T){if(!E){p=x+(p.length>0?" "+p:p);continue}if(T=l(k),!T){p=x+(p.length>0?" "+p:p);continue}E=!1}const _=j.length===0?"":j.length===1?j[0]:d(j).join(":"),R=N?_+Qf:_,H=R+T;if(g.indexOf(H)>-1)continue;g.push(H);const A=c(T,E);for(let B=0;B<A.length;++B){const M=A[B];g.push(R+M)}p=x+(p.length>0?" "+p:p)}return p},$T=(...n)=>{let o=0,r,l,c="";for(;o<n.length;)(r=n[o++])&&(l=Bv(r))&&(c&&(c+=" "),c+=l);return c},Bv=n=>{if(typeof n=="string")return n;let o,r="";for(let l=0;l<n.length;l++)n[l]&&(o=Bv(n[l]))&&(r&&(r+=" "),r+=o);return r},QT=(n,...o)=>{let r,l,c,d;const m=b=>{const p=o.reduce((v,x)=>x(v),n());return r=qT(p),l=r.cache.get,c=r.cache.set,d=g,g(b)},g=b=>{const p=l(b);if(p)return p;const v=KT(b,r);return c(b,v),v};return d=m,(...b)=>d($T(...b))},ZT=[],on=n=>{const o=r=>r[n]||ZT;return o.isThemeGetter=!0,o},Yv=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Vv=/^\((?:(\w[\w-]*):)?(.+)\)$/i,JT=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,WT=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,e2=/\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$/,t2=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,n2=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,s2=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Lo=n=>JT.test(n),ct=n=>!!n&&!Number.isNaN(Number(n)),bs=n=>!!n&&Number.isInteger(Number(n)),Nf=n=>n.endsWith("%")&&ct(n.slice(0,-1)),Xs=n=>WT.test(n),Pv=()=>!0,o2=n=>e2.test(n)&&!t2.test(n),km=()=>!1,r2=n=>n2.test(n),a2=n=>s2.test(n),l2=n=>!He(n)&&!Be(n),i2=n=>n.startsWith("@container")&&(n[10]==="/"&&n[11]!==void 0||n[11]==="s"&&n[16]!==void 0&&n.startsWith("-size/",10)||n[11]==="n"&&n[18]!==void 0&&n.startsWith("-normal/",10)),c2=n=>Po(n,Fv,km),He=n=>Yv.test(n),ur=n=>Po(n,Xv,o2),qb=n=>Po(n,x2,ct),u2=n=>Po(n,$v,Pv),d2=n=>Po(n,Kv,km),Fb=n=>Po(n,Gv,km),f2=n=>Po(n,qv,a2),lc=n=>Po(n,Qv,r2),Be=n=>Vv.test(n),Sl=n=>Nr(n,Xv),m2=n=>Nr(n,Kv),Xb=n=>Nr(n,Gv),p2=n=>Nr(n,Fv),h2=n=>Nr(n,qv),ic=n=>Nr(n,Qv,!0),g2=n=>Nr(n,$v,!0),Po=(n,o,r)=>{const l=Yv.exec(n);return l?l[1]?o(l[1]):r(l[2]):!1},Nr=(n,o,r=!1)=>{const l=Vv.exec(n);return l?l[1]?o(l[1]):r:!1},Gv=n=>n==="position"||n==="percentage",qv=n=>n==="image"||n==="url",Fv=n=>n==="length"||n==="size"||n==="bg-size",Xv=n=>n==="length",x2=n=>n==="number",Kv=n=>n==="family-name",$v=n=>n==="number"||n==="weight",Qv=n=>n==="shadow",b2=()=>{const n=on("color"),o=on("font"),r=on("text"),l=on("font-weight"),c=on("tracking"),d=on("leading"),m=on("breakpoint"),g=on("container"),b=on("spacing"),p=on("radius"),v=on("shadow"),x=on("inset-shadow"),S=on("text-shadow"),j=on("drop-shadow"),N=on("blur"),k=on("perspective"),O=on("aspect"),E=on("ease"),T=on("animate"),_=()=>["auto","avoid","all","avoid-page","page","left","right","column"],R=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],H=()=>[...R(),Be,He],A=()=>["auto","hidden","clip","visible","scroll"],B=()=>["auto","contain","none"],M=()=>[Be,He,b],Q=()=>[Lo,"full","auto",...M()],ne=()=>[bs,"none","subgrid",Be,He],me=()=>["auto",{span:["full",bs,Be,He]},bs,Be,He],se=()=>[bs,"auto",Be,He],X=()=>["auto","min","max","fr",Be,He],te=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],$=()=>["start","end","center","stretch","center-safe","end-safe"],w=()=>["auto",...M()],U=()=>[Lo,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...M()],Y=()=>[Lo,"screen","full","dvw","lvw","svw","min","max","fit",...M()],z=()=>[Lo,"screen","full","lh","dvh","lvh","svh","min","max","fit",...M()],I=()=>[n,Be,He],D=()=>[...R(),Xb,Fb,{position:[Be,He]}],G=()=>["no-repeat",{repeat:["","x","y","space","round"]}],L=()=>["auto","cover","contain",p2,c2,{size:[Be,He]}],q=()=>[Nf,Sl,ur],Z=()=>["","none","full",p,Be,He],V=()=>["",ct,Sl,ur],be=()=>["solid","dashed","dotted","double"],ue=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],he=()=>[ct,Nf,Xb,Fb],Le=()=>["","none",N,Be,He],qe=()=>["none",ct,Be,He],we=()=>["none",ct,Be,He],De=()=>[ct,Be,He],Ae=()=>[Lo,"full",...M()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Xs],breakpoint:[Xs],color:[Pv],container:[Xs],"drop-shadow":[Xs],ease:["in","out","in-out"],font:[l2],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Xs],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Xs],shadow:[Xs],spacing:["px",ct],text:[Xs],"text-shadow":[Xs],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Lo,He,Be,O]}],container:["container"],"container-type":[{"@container":["","normal","size",Be,He]}],"container-named":[i2],columns:[{columns:[ct,He,Be,g]}],"break-after":[{"break-after":_()}],"break-before":[{"break-before":_()}],"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:H()}],overflow:[{overflow:A()}],"overflow-x":[{"overflow-x":A()}],"overflow-y":[{"overflow-y":A()}],overscroll:[{overscroll:B()}],"overscroll-x":[{"overscroll-x":B()}],"overscroll-y":[{"overscroll-y":B()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:Q()}],"inset-x":[{"inset-x":Q()}],"inset-y":[{"inset-y":Q()}],start:[{"inset-s":Q(),start:Q()}],end:[{"inset-e":Q(),end:Q()}],"inset-bs":[{"inset-bs":Q()}],"inset-be":[{"inset-be":Q()}],top:[{top:Q()}],right:[{right:Q()}],bottom:[{bottom:Q()}],left:[{left:Q()}],visibility:["visible","invisible","collapse"],z:[{z:[bs,"auto",Be,He]}],basis:[{basis:[Lo,"full","auto",g,...M()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[ct,Lo,"auto","initial","none",He]}],grow:[{grow:["",ct,Be,He]}],shrink:[{shrink:["",ct,Be,He]}],order:[{order:[bs,"first","last","none",Be,He]}],"grid-cols":[{"grid-cols":ne()}],"col-start-end":[{col:me()}],"col-start":[{"col-start":se()}],"col-end":[{"col-end":se()}],"grid-rows":[{"grid-rows":ne()}],"row-start-end":[{row:me()}],"row-start":[{"row-start":se()}],"row-end":[{"row-end":se()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":X()}],"auto-rows":[{"auto-rows":X()}],gap:[{gap:M()}],"gap-x":[{"gap-x":M()}],"gap-y":[{"gap-y":M()}],"justify-content":[{justify:[...te(),"normal"]}],"justify-items":[{"justify-items":[...$(),"normal"]}],"justify-self":[{"justify-self":["auto",...$()]}],"align-content":[{content:["normal",...te()]}],"align-items":[{items:[...$(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...$(),{baseline:["","last"]}]}],"place-content":[{"place-content":te()}],"place-items":[{"place-items":[...$(),"baseline"]}],"place-self":[{"place-self":["auto",...$()]}],p:[{p:M()}],px:[{px:M()}],py:[{py:M()}],ps:[{ps:M()}],pe:[{pe:M()}],pbs:[{pbs:M()}],pbe:[{pbe:M()}],pt:[{pt:M()}],pr:[{pr:M()}],pb:[{pb:M()}],pl:[{pl:M()}],m:[{m:w()}],mx:[{mx:w()}],my:[{my:w()}],ms:[{ms:w()}],me:[{me:w()}],mbs:[{mbs:w()}],mbe:[{mbe:w()}],mt:[{mt:w()}],mr:[{mr:w()}],mb:[{mb:w()}],ml:[{ml:w()}],"space-x":[{"space-x":M()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":M()}],"space-y-reverse":["space-y-reverse"],size:[{size:U()}],"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:[g,"screen",...U()]}],"min-w":[{"min-w":[g,"screen","none",...U()]}],"max-w":[{"max-w":[g,"screen","none","prose",{screen:[m]},...U()]}],h:[{h:["screen","lh",...U()]}],"min-h":[{"min-h":["screen","lh","none",...U()]}],"max-h":[{"max-h":["screen","lh",...U()]}],"font-size":[{text:["base",r,Sl,ur]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[l,g2,u2]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Nf,He]}],"font-family":[{font:[m2,d2,o]}],"font-features":[{"font-features":[He]}],"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:[c,Be,He]}],"line-clamp":[{"line-clamp":[ct,"none",Be,qb]}],leading:[{leading:[d,...M()]}],"list-image":[{"list-image":["none",Be,He]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Be,He]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:I()}],"text-color":[{text:I()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...be(),"wavy"]}],"text-decoration-thickness":[{decoration:[ct,"from-font","auto",Be,ur]}],"text-decoration-color":[{decoration:I()}],"underline-offset":[{"underline-offset":[ct,"auto",Be,He]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:M()}],"tab-size":[{tab:[bs,Be,He]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Be,He]}],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",Be,He]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:D()}],"bg-repeat":[{bg:G()}],"bg-size":[{bg:L()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},bs,Be,He],radial:["",Be,He],conic:[bs,Be,He]},h2,f2]}],"bg-color":[{bg:I()}],"gradient-from-pos":[{from:q()}],"gradient-via-pos":[{via:q()}],"gradient-to-pos":[{to:q()}],"gradient-from":[{from:I()}],"gradient-via":[{via:I()}],"gradient-to":[{to:I()}],rounded:[{rounded:Z()}],"rounded-s":[{"rounded-s":Z()}],"rounded-e":[{"rounded-e":Z()}],"rounded-t":[{"rounded-t":Z()}],"rounded-r":[{"rounded-r":Z()}],"rounded-b":[{"rounded-b":Z()}],"rounded-l":[{"rounded-l":Z()}],"rounded-ss":[{"rounded-ss":Z()}],"rounded-se":[{"rounded-se":Z()}],"rounded-ee":[{"rounded-ee":Z()}],"rounded-es":[{"rounded-es":Z()}],"rounded-tl":[{"rounded-tl":Z()}],"rounded-tr":[{"rounded-tr":Z()}],"rounded-br":[{"rounded-br":Z()}],"rounded-bl":[{"rounded-bl":Z()}],"border-w":[{border:V()}],"border-w-x":[{"border-x":V()}],"border-w-y":[{"border-y":V()}],"border-w-s":[{"border-s":V()}],"border-w-e":[{"border-e":V()}],"border-w-bs":[{"border-bs":V()}],"border-w-be":[{"border-be":V()}],"border-w-t":[{"border-t":V()}],"border-w-r":[{"border-r":V()}],"border-w-b":[{"border-b":V()}],"border-w-l":[{"border-l":V()}],"divide-x":[{"divide-x":V()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":V()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...be(),"hidden","none"]}],"divide-style":[{divide:[...be(),"hidden","none"]}],"border-color":[{border:I()}],"border-color-x":[{"border-x":I()}],"border-color-y":[{"border-y":I()}],"border-color-s":[{"border-s":I()}],"border-color-e":[{"border-e":I()}],"border-color-bs":[{"border-bs":I()}],"border-color-be":[{"border-be":I()}],"border-color-t":[{"border-t":I()}],"border-color-r":[{"border-r":I()}],"border-color-b":[{"border-b":I()}],"border-color-l":[{"border-l":I()}],"divide-color":[{divide:I()}],"outline-style":[{outline:[...be(),"none","hidden"]}],"outline-offset":[{"outline-offset":[ct,Be,He]}],"outline-w":[{outline:["",ct,Sl,ur]}],"outline-color":[{outline:I()}],shadow:[{shadow:["","none",v,ic,lc]}],"shadow-color":[{shadow:I()}],"inset-shadow":[{"inset-shadow":["none",x,ic,lc]}],"inset-shadow-color":[{"inset-shadow":I()}],"ring-w":[{ring:V()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:I()}],"ring-offset-w":[{"ring-offset":[ct,ur]}],"ring-offset-color":[{"ring-offset":I()}],"inset-ring-w":[{"inset-ring":V()}],"inset-ring-color":[{"inset-ring":I()}],"text-shadow":[{"text-shadow":["none",S,ic,lc]}],"text-shadow-color":[{"text-shadow":I()}],opacity:[{opacity:[ct,Be,He]}],"mix-blend":[{"mix-blend":[...ue(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ue()}],"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":[ct]}],"mask-image-linear-from-pos":[{"mask-linear-from":he()}],"mask-image-linear-to-pos":[{"mask-linear-to":he()}],"mask-image-linear-from-color":[{"mask-linear-from":I()}],"mask-image-linear-to-color":[{"mask-linear-to":I()}],"mask-image-t-from-pos":[{"mask-t-from":he()}],"mask-image-t-to-pos":[{"mask-t-to":he()}],"mask-image-t-from-color":[{"mask-t-from":I()}],"mask-image-t-to-color":[{"mask-t-to":I()}],"mask-image-r-from-pos":[{"mask-r-from":he()}],"mask-image-r-to-pos":[{"mask-r-to":he()}],"mask-image-r-from-color":[{"mask-r-from":I()}],"mask-image-r-to-color":[{"mask-r-to":I()}],"mask-image-b-from-pos":[{"mask-b-from":he()}],"mask-image-b-to-pos":[{"mask-b-to":he()}],"mask-image-b-from-color":[{"mask-b-from":I()}],"mask-image-b-to-color":[{"mask-b-to":I()}],"mask-image-l-from-pos":[{"mask-l-from":he()}],"mask-image-l-to-pos":[{"mask-l-to":he()}],"mask-image-l-from-color":[{"mask-l-from":I()}],"mask-image-l-to-color":[{"mask-l-to":I()}],"mask-image-x-from-pos":[{"mask-x-from":he()}],"mask-image-x-to-pos":[{"mask-x-to":he()}],"mask-image-x-from-color":[{"mask-x-from":I()}],"mask-image-x-to-color":[{"mask-x-to":I()}],"mask-image-y-from-pos":[{"mask-y-from":he()}],"mask-image-y-to-pos":[{"mask-y-to":he()}],"mask-image-y-from-color":[{"mask-y-from":I()}],"mask-image-y-to-color":[{"mask-y-to":I()}],"mask-image-radial":[{"mask-radial":[Be,He]}],"mask-image-radial-from-pos":[{"mask-radial-from":he()}],"mask-image-radial-to-pos":[{"mask-radial-to":he()}],"mask-image-radial-from-color":[{"mask-radial-from":I()}],"mask-image-radial-to-color":[{"mask-radial-to":I()}],"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":R()}],"mask-image-conic-pos":[{"mask-conic":[ct]}],"mask-image-conic-from-pos":[{"mask-conic-from":he()}],"mask-image-conic-to-pos":[{"mask-conic-to":he()}],"mask-image-conic-from-color":[{"mask-conic-from":I()}],"mask-image-conic-to-color":[{"mask-conic-to":I()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:D()}],"mask-repeat":[{mask:G()}],"mask-size":[{mask:L()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Be,He]}],filter:[{filter:["","none",Be,He]}],blur:[{blur:Le()}],brightness:[{brightness:[ct,Be,He]}],contrast:[{contrast:[ct,Be,He]}],"drop-shadow":[{"drop-shadow":["","none",j,ic,lc]}],"drop-shadow-color":[{"drop-shadow":I()}],grayscale:[{grayscale:["",ct,Be,He]}],"hue-rotate":[{"hue-rotate":[ct,Be,He]}],invert:[{invert:["",ct,Be,He]}],saturate:[{saturate:[ct,Be,He]}],sepia:[{sepia:["",ct,Be,He]}],"backdrop-filter":[{"backdrop-filter":["","none",Be,He]}],"backdrop-blur":[{"backdrop-blur":Le()}],"backdrop-brightness":[{"backdrop-brightness":[ct,Be,He]}],"backdrop-contrast":[{"backdrop-contrast":[ct,Be,He]}],"backdrop-grayscale":[{"backdrop-grayscale":["",ct,Be,He]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[ct,Be,He]}],"backdrop-invert":[{"backdrop-invert":["",ct,Be,He]}],"backdrop-opacity":[{"backdrop-opacity":[ct,Be,He]}],"backdrop-saturate":[{"backdrop-saturate":[ct,Be,He]}],"backdrop-sepia":[{"backdrop-sepia":["",ct,Be,He]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":M()}],"border-spacing-x":[{"border-spacing-x":M()}],"border-spacing-y":[{"border-spacing-y":M()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Be,He]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[ct,"initial",Be,He]}],ease:[{ease:["linear","initial",E,Be,He]}],delay:[{delay:[ct,Be,He]}],animate:[{animate:["none",T,Be,He]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[k,Be,He]}],"perspective-origin":[{"perspective-origin":H()}],rotate:[{rotate:qe()}],"rotate-x":[{"rotate-x":qe()}],"rotate-y":[{"rotate-y":qe()}],"rotate-z":[{"rotate-z":qe()}],scale:[{scale:we()}],"scale-x":[{"scale-x":we()}],"scale-y":[{"scale-y":we()}],"scale-z":[{"scale-z":we()}],"scale-3d":["scale-3d"],skew:[{skew:De()}],"skew-x":[{"skew-x":De()}],"skew-y":[{"skew-y":De()}],transform:[{transform:[Be,He,"","none","gpu","cpu"]}],"transform-origin":[{origin:H()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Ae()}],"translate-x":[{"translate-x":Ae()}],"translate-y":[{"translate-y":Ae()}],"translate-z":[{"translate-z":Ae()}],"translate-none":["translate-none"],zoom:[{zoom:[bs,Be,He]}],accent:[{accent:I()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:I()}],"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",Be,He]}],"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":I()}],"scrollbar-track-color":[{"scrollbar-track":I()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":M()}],"scroll-mx":[{"scroll-mx":M()}],"scroll-my":[{"scroll-my":M()}],"scroll-ms":[{"scroll-ms":M()}],"scroll-me":[{"scroll-me":M()}],"scroll-mbs":[{"scroll-mbs":M()}],"scroll-mbe":[{"scroll-mbe":M()}],"scroll-mt":[{"scroll-mt":M()}],"scroll-mr":[{"scroll-mr":M()}],"scroll-mb":[{"scroll-mb":M()}],"scroll-ml":[{"scroll-ml":M()}],"scroll-p":[{"scroll-p":M()}],"scroll-px":[{"scroll-px":M()}],"scroll-py":[{"scroll-py":M()}],"scroll-ps":[{"scroll-ps":M()}],"scroll-pe":[{"scroll-pe":M()}],"scroll-pbs":[{"scroll-pbs":M()}],"scroll-pbe":[{"scroll-pbe":M()}],"scroll-pt":[{"scroll-pt":M()}],"scroll-pr":[{"scroll-pr":M()}],"scroll-pb":[{"scroll-pb":M()}],"scroll-pl":[{"scroll-pl":M()}],"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",Be,He]}],fill:[{fill:["none",...I()]}],"stroke-w":[{stroke:[ct,Sl,ur,qb]}],stroke:[{stroke:["none",...I()]}],"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"]}},y2=QT(b2);function We(...n){return y2(Lv(n))}function Yc(){return typeof window<"u"}function bn(n){return _m(n)?(n.nodeName||"").toLowerCase():"#document"}function Xt(n){var o;return(n==null||(o=n.ownerDocument)==null?void 0:o.defaultView)||window}function co(n){var o;return(o=(_m(n)?n.ownerDocument:n.document)||window.document)==null?void 0:o.documentElement}function _m(n){return Yc()?n instanceof Node||n instanceof Xt(n).Node:!1}function ht(n){return Yc()?n instanceof Element||n instanceof Xt(n).Element:!1}function Ut(n){return Yc()?n instanceof HTMLElement||n instanceof Xt(n).HTMLElement:!1}function Ta(n){return!Yc()||typeof ShadowRoot>"u"?!1:n instanceof ShadowRoot||n instanceof Xt(n).ShadowRoot}function jr(n){const{overflow:o,overflowX:r,overflowY:l,display:c}=qn(n);return/auto|scroll|overlay|hidden|clip/.test(o+l+r)&&c!=="inline"&&c!=="contents"}function v2(n){return/^(table|td|th)$/.test(bn(n))}function Vc(n){try{if(n.matches(":popover-open"))return!0}catch{}try{return n.matches(":modal")}catch{return!1}}const S2=/transform|translate|scale|rotate|perspective|filter/,E2=/paint|layout|strict|content/,dr=n=>!!n&&n!=="none";let jf;function Mm(n){const o=ht(n)?qn(n):n;return dr(o.transform)||dr(o.translate)||dr(o.scale)||dr(o.rotate)||dr(o.perspective)||!Am()&&(dr(o.backdropFilter)||dr(o.filter))||S2.test(o.willChange||"")||E2.test(o.contain||"")}function N2(n){let o=ao(n);for(;Ut(o)&&!eo(o);){if(Mm(o))return o;if(Vc(o))return null;o=ao(o)}return null}function Am(){return jf==null&&(jf=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),jf}function eo(n){return/^(html|body|#document)$/.test(bn(n))}function qn(n){return Xt(n).getComputedStyle(n)}function Pc(n){return ht(n)?{scrollLeft:n.scrollLeft,scrollTop:n.scrollTop}:{scrollLeft:n.scrollX,scrollTop:n.scrollY}}function ao(n){if(bn(n)==="html")return n;const o=n.assignedSlot||n.parentNode||Ta(n)&&n.host||co(n);return Ta(o)?o.host:o}function Zv(n){const o=ao(n);return eo(o)?(n.ownerDocument||n).body:Ut(o)&&jr(o)?o:Zv(o)}function Ll(n,o,r){var l;o===void 0&&(o=[]),r===void 0&&(r=!0);const c=Zv(n),d=c===((l=n.ownerDocument)==null?void 0:l.body),m=Xt(c);if(d){const g=Zf(m);return o.concat(m,m.visualViewport||[],jr(c)?c:[],g&&r?Ll(g):[])}else return o.concat(c,Ll(c,[],r))}function Zf(n){return n.parent&&Object.getPrototypeOf(n.parent)?n.frameElement:null}const Dm={...TN},Kb={};function zn(n,o){const r=h.useRef(Kb);return r.current===Kb&&(r.current=n(o)),r}const Tf=Dm.useInsertionEffect,j2=Tf&&Tf!==Dm.useLayoutEffect?Tf:n=>n();function tt(n){const o=zn(T2).current;return o.next=n,j2(o.effect),o.trampoline}function T2(){const n={next:void 0,callback:w2,trampoline:(...o)=>n.callback?.(...o),effect:()=>{n.callback=n.next}};return n}function w2(){}const C2=()=>{},Ge=typeof document<"u"?h.useLayoutEffect:C2;function Jf(n,o){if(n&&!o)return n;if(!n&&o)return o;if(n||o)return{...n,...o}}const zm={};function to(n,o,r,l,c){if(!r&&!l&&!c&&!n)return Rc(o);let d=Rc(n);return o&&(d=Ol(d,o)),r&&(d=Ol(d,r)),l&&(d=Ol(d,l)),c&&(d=Ol(d,c)),d}function R2(n){if(n.length===0)return zm;if(n.length===1)return Rc(n[0]);let o=Rc(n[0]);for(let r=1;r<n.length;r+=1)o=Ol(o,n[r]);return o}function Rc(n){return Lm(n)?{...Wv(n,zm)}:O2(n)}function Ol(n,o){return Lm(o)?Wv(o,n):k2(n,o)}function O2(n){const o={...n};for(const r in o){const l=o[r];Jv(r,l)&&(o[r]=e0(l))}return o}function k2(n,o){if(!o)return n;for(const r in o){const l=o[r];switch(r){case"style":{n[r]=Jf(n.style,l);break}case"className":{n[r]=t0(n.className,l);break}default:Jv(r,l)?n[r]=_2(n[r],l):n[r]=l}}return n}function Jv(n,o){const r=n.charCodeAt(0),l=n.charCodeAt(1),c=n.charCodeAt(2);return r===111&&l===110&&c>=65&&c<=90&&(typeof o=="function"||typeof o>"u")}function Lm(n){return typeof n=="function"}function Wv(n,o){return Lm(n)?n(o):n??zm}function _2(n,o){return o?n?(...r)=>{const l=r[0];if(n0(l)){const d=l;Oc(d);const m=o(...r);return d.baseUIHandlerPrevented||n?.(...r),m}const c=o(...r);return n?.(...r),c}:e0(o):n}function e0(n){return n&&((...o)=>{const r=o[0];return n0(r)&&Oc(r),n(...o)})}function Oc(n){return n.preventBaseUIHandler=()=>{n.baseUIHandlerPrevented=!0},n}function t0(n,o){return o?n?o+" "+n:o:n}function n0(n){return n!=null&&typeof n=="object"&&"nativeEvent"in n}function M2(n,o){return function(l,...c){const d=new URL(n);return d.searchParams.set("code",l.toString()),c.forEach(m=>d.searchParams.append("args[]",m)),`${o} error #${l}; visit ${d} for the full message.`}}const En=M2("https://base-ui.com/production-error","Base UI"),A2=h.createContext(void 0);function Im(n=!1){const o=h.useContext(A2);if(o===void 0&&!n)throw new Error(En(16));return o}function D2(n){const{focusableWhenDisabled:o,disabled:r,composite:l=!1,tabIndex:c=0,isNativeButton:d}=n,m=l&&o!==!1,g=l&&o===!1;return{props:h.useMemo(()=>{const p={onKeyDown(v){r&&o&&v.key!=="Tab"&&v.preventDefault()}};return l||(p.tabIndex=c,!d&&r&&(p.tabIndex=o?c:-1)),(d&&(o||m)||!d&&r)&&(p["aria-disabled"]=r),d&&(!o||g)&&(p.disabled=r),p},[l,r,o,m,g,d,c])}}function Pl(n={}){const{disabled:o=!1,focusableWhenDisabled:r,tabIndex:l=0,native:c=!0,composite:d}=n,m=h.useRef(null),g=Im(!0),b=d??g!==void 0,{props:p}=D2({focusableWhenDisabled:r,disabled:o,composite:b,tabIndex:l,isNativeButton:c}),v=h.useCallback(()=>{const j=m.current;wf(j)&&b&&o&&p.disabled===void 0&&j.disabled&&(j.disabled=!1)},[o,p.disabled,b]);Ge(v,[v]);const x=h.useCallback((j={})=>{const{onClick:N,onMouseDown:k,onKeyUp:O,onKeyDown:E,onPointerDown:T,..._}=j;return to({onClick(R){if(o){R.preventDefault();return}N?.(R)},onMouseDown(R){o||k?.(R)},onKeyDown(R){if(o||(Oc(R),E?.(R),R.baseUIHandlerPrevented))return;const H=R.target===R.currentTarget,A=R.currentTarget,B=wf(A),M=!c&&z2(A),Q=H&&(c?B:!M),ne=R.key==="Enter",me=R.key===" ",se=A.getAttribute("role"),X=se?.startsWith("menuitem")||se==="option"||se==="gridcell";if(H&&b&&me){if(R.defaultPrevented&&X)return;R.preventDefault(),M||c&&B?(A.click(),R.preventBaseUIHandler()):Q&&(N?.(R),R.preventBaseUIHandler());return}Q&&(!c&&(me||ne)&&R.preventDefault(),!c&&ne&&N?.(R))},onKeyUp(R){if(!o){if(Oc(R),O?.(R),R.target===R.currentTarget&&c&&b&&wf(R.currentTarget)&&R.key===" "){R.preventDefault();return}R.baseUIHandlerPrevented||R.target===R.currentTarget&&!c&&!b&&R.key===" "&&N?.(R)}},onPointerDown(R){if(o){R.preventDefault();return}T?.(R)}},c?{type:"button"}:{role:"button"},p,_)},[o,p,b,c]),S=tt(j=>{m.current=j,v()});return{getButtonProps:x,buttonRef:S}}function wf(n){return Ut(n)&&n.tagName==="BUTTON"}function z2(n){return!!(n?.tagName==="A"&&n?.href)}function wa(n,o,r,l){const c=zn(s0).current;return I2(c,n,o,r,l)&&o0(c,[n,o,r,l]),c.callback}function L2(n){const o=zn(s0).current;return U2(o,n)&&o0(o,n),o.callback}function s0(){return{callback:null,cleanup:null,refs:[]}}function I2(n,o,r,l,c){return n.refs[0]!==o||n.refs[1]!==r||n.refs[2]!==l||n.refs[3]!==c}function U2(n,o){return n.refs.length!==o.length||n.refs.some((r,l)=>r!==o[l])}function o0(n,o){if(n.refs=o,o.every(r=>r==null)){n.callback=null;return}n.callback=r=>{if(n.cleanup&&(n.cleanup(),n.cleanup=null),r!=null){const l=Array(o.length).fill(null);for(let c=0;c<o.length;c+=1){const d=o[c];if(d!=null)switch(typeof d){case"function":{const m=d(r);typeof m=="function"&&(l[c]=m);break}case"object":{d.current=r;break}}}n.cleanup=()=>{for(let c=0;c<o.length;c+=1){const d=o[c];if(d!=null)switch(typeof d){case"function":{const m=l[c];typeof m=="function"?m():d(null);break}case"object":{d.current=null;break}}}}}}}const H2=parseInt(h.version,10);function Um(n){return H2>=n}function $b(n){if(!h.isValidElement(n))return null;const o=n,r=o.props;return(Um(19)?r?.ref:o.ref)??null}function un(){}const kc=Object.freeze([]),Ht=Object.freeze({});function B2(n,o){const r={};for(const l in n){const c=n[l];if(o?.hasOwnProperty(l)){const d=o[l](c);d!=null&&Object.assign(r,d);continue}c===!0?r[`data-${l.toLowerCase()}`]="":c&&(r[`data-${l.toLowerCase()}`]=c.toString())}return r}function Y2(n,o){return typeof n=="function"?n(o):n}function V2(n,o){return typeof n=="function"?n(o):n}function fn(n,o,r={}){const l=o.render,c=P2(o,r);if(r.enabled===!1)return null;const d=r.state??Ht;return F2(n,l,c,d)}function P2(n,o={}){const{className:r,style:l,render:c}=n,{state:d=Ht,ref:m,props:g,stateAttributesMapping:b,enabled:p=!0}=o,v=p?Y2(r,d):void 0,x=p?V2(l,d):void 0,S=p?B2(d,b):Ht,j=p&&g?G2(g):void 0,N=p?Jf(S,j)??{}:Ht;return typeof document<"u"&&(p?Array.isArray(m)?N.ref=L2([N.ref,$b(c),...m]):N.ref=wa(N.ref,$b(c),m):wa(null,null)),p?(v!==void 0&&(N.className=t0(N.className,v)),x!==void 0&&(N.style=Jf(N.style,x)),N):Ht}function G2(n){return Array.isArray(n)?R2(n):to(void 0,n)}const q2=Symbol.for("react.lazy");function F2(n,o,r,l){if(o){if(typeof o=="function")return o(r,l);const c=to(r,o.props);c.ref=r.ref;let d=o;return d?.$$typeof===q2&&(d=h.Children.toArray(o)[0]),h.cloneElement(d,c)}if(n&&typeof n=="string")return X2(n,r);throw new Error(En(8))}function X2(n,o){return n==="button"?h.createElement("button",{type:"button",...o,key:o.key}):n==="img"?h.createElement("img",{alt:"",...o,key:o.key}):h.createElement(n,o)}const K2=h.forwardRef(function(o,r){const{render:l,className:c,disabled:d=!1,focusableWhenDisabled:m=!1,nativeButton:g=!0,style:b,...p}=o,{getButtonProps:v,buttonRef:x}=Pl({disabled:d,focusableWhenDisabled:m,native:g});return fn("button",o,{state:{disabled:d},ref:[r,x],props:[p,v]})}),Qb=n=>typeof n=="boolean"?`${n}`:n===0?"0":n,Zb=Lv,$2=(n,o)=>r=>{var l;if(o?.variants==null)return Zb(n,r?.class,r?.className);const{variants:c,defaultVariants:d}=o,m=Object.keys(c).map(p=>{const v=r?.[p],x=d?.[p];if(v===null)return null;const S=Qb(v)||Qb(x);return c[p][S]}),g=r&&Object.entries(r).reduce((p,v)=>{let[x,S]=v;return S===void 0||(p[x]=S),p},{}),b=o==null||(l=o.compoundVariants)===null||l===void 0?void 0:l.reduce((p,v)=>{let{class:x,className:S,...j}=v;return Object.entries(j).every(N=>{let[k,O]=N;return Array.isArray(O)?O.includes({...d,...g}[k]):{...d,...g}[k]===O})?[...p,x,S]:p},[]);return Zb(n,m,b,r?.class,r?.className)},Wf=$2("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 Se({className:n,variant:o="default",size:r="default",...l}){return i.jsx(K2,{"data-slot":"button",className:We(Wf({variant:o,size:r,className:n})),...l})}const r0=h.createContext(void 0);function a0(n){const o=h.useContext(r0);if(o===void 0&&!n)throw new Error(En(33));return o}const l0=h.createContext(void 0);function Tr(n){const o=h.useContext(l0);if(o===void 0&&!n)throw new Error(En(36));return o}let Il=(function(n){return n.startingStyle="data-starting-style",n.endingStyle="data-ending-style",n})({});const Q2={[Il.startingStyle]:""},Z2={[Il.endingStyle]:""},Gc={transitionStatus(n){return n==="starting"?Q2:n==="ending"?Z2:null}};let pr=(function(n){return n.open="data-open",n.closed="data-closed",n[n.startingStyle=Il.startingStyle]="startingStyle",n[n.endingStyle=Il.endingStyle]="endingStyle",n.anchorHidden="data-anchor-hidden",n.side="data-side",n.align="data-align",n})({}),em=(function(n){return n.popupOpen="data-popup-open",n.pressed="data-pressed",n})({});const J2={[em.popupOpen]:""},W2={[em.popupOpen]:"",[em.pressed]:""},ew={[pr.open]:""},tw={[pr.closed]:""},nw={[pr.anchorHidden]:""},sw={open(n){return n?J2:null}},tm={open(n){return n?W2:null}},Gl={open(n){return n?ew:tw},anchorHidden(n){return n?nw:null}},ow=h.createContext(void 0);function qc(n=!0){const o=h.useContext(ow);if(o===void 0&&!n)throw new Error(En(25));return o}const i0="none",yr="trigger-press",dn="trigger-hover",Ml="trigger-focus",Hm="outside-press",c0="item-press",u0="close-press",vr="focus-out",Fc="escape-key",nm="list-navigation",rw="cancel-open",kl="sibling-open",Bm="imperative-action";function aw({controlled:n,default:o,name:r,state:l="value"}){const{current:c}=h.useRef(n!==void 0),[d,m]=h.useState(o),g=c?n:d,b=h.useCallback(p=>{c||m(p)},[]);return[g,b]}function lw(){return typeof navigator>"u"?{userAgent:"",platform:"",maxTouchPoints:0}:{userAgent:navigator.userAgent,platform:navigator.platform??"",maxTouchPoints:navigator.maxTouchPoints??0}}const{userAgent:iw,platform:cw,maxTouchPoints:uw}=lw(),Xc=iw.toLowerCase(),Ul=cw.toLowerCase(),Kc=/^i(os$|p)/.test(Ul)||Ul==="macintel"&&uw>1,Jb="android",sm=Ul===Jb||Xc.includes(Jb),Ym=!Kc&&Ul.startsWith("mac");Ul.startsWith("win");const dw=Ym||Kc,wr=typeof CSS<"u"&&!!CSS.supports?.("-webkit-backdrop-filter:none");!wr&&Xc.includes("firefox");!wr&&Xc.includes("chrom");const fw=dw,Vm=/jsdom|happydom/.test(Xc);function mw(n){const{closeOnClick:o,highlighted:r,id:l,nodeId:c,store:d,typingRef:m,itemRef:g,itemMetadata:b}=n,{events:p}=d.useState("floatingTreeRoot"),v=d.useState("open"),x=qc(!0),S=x!==void 0;return h.useMemo(()=>({id:l,role:"menuitem",tabIndex:v&&r?0:-1,onKeyDown(j){j.key===" "&&m?.current&&j.preventDefault()},onMouseMove(j){c&&p.emit("itemhover",{nodeId:c,target:j.currentTarget})},onClick(j){o&&p.emit("close",{domEvent:j,reason:c0})},onMouseUp(j){if(x){const N=x.initialCursorPointRef.current;if(x.initialCursorPointRef.current=null,S&&N&&Math.abs(j.clientX-N.x)<=1&&Math.abs(j.clientY-N.y)<=1||S&&!Ym&&j.button===2)return}g.current&&d.context.allowMouseUpTriggerRef.current&&(!S||j.button===2)&&(!b||b.type==="regular-item")&&g.current.click()}}),[o,r,l,p,c,v,d,m,g,x,S,b])}const pw={type:"regular-item"};function hw(n){const{closeOnClick:o,disabled:r=!1,highlighted:l,id:c,store:d,typingRef:m=d.context.typingRef,nativeButton:g,itemMetadata:b,nodeId:p}=n,v=d.useState("disabled"),x=r||v,S=h.useRef(null),{getButtonProps:j,buttonRef:N}=Pl({disabled:x,focusableWhenDisabled:!0,native:g,composite:!0}),k=mw({closeOnClick:o,highlighted:l,id:c,nodeId:p,store:d,typingRef:m,itemRef:S,itemMetadata:b}),O=h.useCallback(T=>to(k,{onMouseEnter(){b.type==="submenu-trigger"&&b.setActive()}},T,j),[k,j,b]),E=wa(S,N);return h.useMemo(()=>({getItemProps:O,itemRef:E}),[O,E])}const d0=h.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},elementsRef:{current:[]},nextIndexRef:{current:0}});function gw(){return h.useContext(d0)}let xw=(function(n){return n[n.None=0]="None",n[n.GuessFromOrder=1]="GuessFromOrder",n})({});function f0(n={}){const{label:o,metadata:r,textRef:l,indexGuessBehavior:c,index:d}=n,{register:m,unregister:g,subscribeMapChange:b,elementsRef:p,labelsRef:v,nextIndexRef:x}=gw(),S=h.useRef(-1),[j,N]=h.useState(d??(c===xw.GuessFromOrder?()=>{if(S.current===-1){const E=x.current;x.current+=1,S.current=E}return S.current}:-1)),k=h.useRef(null),O=h.useCallback(E=>{if(k.current=E,j!==-1&&E!==null&&(p.current[j]=E,v)){const T=o!==void 0;v.current[j]=T?o:l?.current?.textContent??E.textContent}},[j,p,v,o,l]);return Ge(()=>{if(d!=null)return;const E=k.current;if(E)return m(E,r),()=>{g(E)}},[d,m,g,r]),Ge(()=>{if(d==null)return b(E=>{const T=k.current?E.get(k.current)?.index:null;T!=null&&N(T)})},[d,b,N]),{ref:O,index:j}}let Wb=0;function bw(n,o="mui"){const[r,l]=h.useState(n),c=n||r;return h.useEffect(()=>{r==null&&(Wb+=1,l(`${o}-${Wb}`))},[r,o]),c}const ey=Dm.useId;function Sr(n,o){if(ey!==void 0){const r=ey();return n??(o?`${o}-${r}`:r)}return bw(n,o)}function Cr(n){return Sr(n,"base-ui")}function jt(n,o,r,l){let c=!1,d=!1;const m=Ht;return{reason:n,event:o??new Event("base-ui"),cancel(){c=!0},allowPropagation(){d=!0},get isCanceled(){return c},get isPropagationAllowed(){return d},trigger:r,...m}}const yw=[];function Pm(n){h.useEffect(n,yw)}const cc=null;class vw{callbacks=[];callbacksCount=0;nextId=1;startId=1;isScheduled=!1;tick=o=>{this.isScheduled=!1;const r=this.callbacks,l=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,l>0)for(let c=0;c<r.length;c+=1)r[c]?.(o)};request(o){const r=this.nextId;return this.nextId+=1,this.callbacks.push(o),this.callbacksCount+=1,!this.isScheduled&&(requestAnimationFrame(this.tick),this.isScheduled=!0),r}cancel(o){const r=o-this.startId;r<0||r>=this.callbacks.length||(this.callbacks[r]=null,this.callbacksCount-=1)}}const uc=new vw;class Ss{static create(){return new Ss}static request(o){return uc.request(o)}static cancel(o){return uc.cancel(o)}currentId=cc;request(o){this.cancel(),this.currentId=uc.request(()=>{this.currentId=cc,o()})}cancel=()=>{this.currentId!==cc&&(uc.cancel(this.currentId),this.currentId=cc)};disposeEffect=()=>this.cancel}function Hl(){const n=zn(Ss.create).current;return Pm(n.disposeEffect),n}function Sw(n,o=!1,r=!1){const[l,c]=h.useState(n&&o?"idle":void 0),[d,m]=h.useState(n);return n&&!d&&(m(!0),c("starting")),!n&&d&&l!=="ending"&&!r&&c("ending"),!n&&!d&&l==="ending"&&c(void 0),Ge(()=>{if(!n&&d&&l!=="ending"&&r){const g=Ss.request(()=>{c("ending")});return()=>{Ss.cancel(g)}}},[n,d,l,r]),Ge(()=>{if(!n||o)return;const g=Ss.request(()=>{c(void 0)});return()=>{Ss.cancel(g)}},[o,n]),Ge(()=>{if(!n||!o)return;n&&d&&l!=="idle"&&c("starting");const g=Ss.request(()=>{c("idle")});return()=>{Ss.cancel(g)}},[o,n,d,l]),{mounted:d,setMounted:m,transitionStatus:l}}var lo=vv();const Ew=yv(lo);function Ks(n){return n==null?n:"current"in n?n.current:n}function Gm(n,o=!1,r=!0){const l=Hl();return tt((c,d=null)=>{l.cancel();const m=Ks(n);if(m==null)return;const g=m,b=()=>{lo.flushSync(c)};if(typeof g.getAnimations!="function"||globalThis.BASE_UI_ANIMATIONS_DISABLED){c();return}function p(){Promise.all(g.getAnimations().map(v=>v.finished)).then(()=>{d?.aborted||b()}).catch(()=>{if(r){d?.aborted||b();return}const v=g.getAnimations();!d?.aborted&&v.length>0&&v.some(x=>x.pending||x.playState!=="finished")&&p()})}if(o){const v=Il.startingStyle;if(!g.hasAttribute(v)){l.request(p);return}const x=new MutationObserver(()=>{g.hasAttribute(v)||(x.disconnect(),p())});x.observe(g,{attributes:!0,attributeFilter:[v]}),d?.addEventListener("abort",()=>x.disconnect(),{once:!0});return}l.request(p)})}function $c(n){const{enabled:o=!0,open:r,ref:l,onComplete:c}=n,d=tt(c),m=Gm(l,r,!1);h.useEffect(()=>{if(!o)return;const g=new AbortController;return m(d,g.signal),()=>{g.abort()}},[o,r,d,m])}const m0=h.createContext(void 0);function Nw(){const n=h.useContext(m0);if(n===void 0)throw new Error(En(31));return n}const jw=h.forwardRef(function(o,r){const{render:l,className:c,style:d,...m}=o,[g,b]=h.useState(void 0),p=fn("div",o,{ref:r,props:{role:"group","aria-labelledby":g,...m}});return i.jsx(m0.Provider,{value:b,children:p})}),Tw=h.forwardRef(function(o,r){const{render:l,className:c,style:d,id:m,...g}=o,b=Cr(m),p=Nw();return Ge(()=>(p(b),()=>{p(void 0)}),[p,b]),fn("div",o,{ref:r,props:{id:b,role:"presentation",...g}})}),ww=h.forwardRef(function(o,r){const{render:l,className:c,id:d,label:m,nativeButton:g=!1,disabled:b=!1,closeOnClick:p=!0,style:v,...x}=o,S=f0({label:m}),j=a0(!0),N=Cr(d),{store:k}=Tr(),O=k.useState("isActive",S.index),E=k.useState("itemProps"),{getItemProps:T,itemRef:_}=hw({closeOnClick:p,disabled:b,highlighted:O,id:N,store:k,nativeButton:g,nodeId:j?.context.nodeId,itemMetadata:pw});return fn("div",o,{state:{disabled:b,highlighted:O},props:[E,x,T],ref:[_,r,S.ref]})}),El=0;class ds{static create(){return new ds}currentId=El;start(o,r){this.clear(),this.currentId=setTimeout(()=>{this.currentId=El,r()},o)}isStarted(){return this.currentId!==El}clear=()=>{this.currentId!==El&&(clearTimeout(this.currentId),this.currentId=El)};disposeEffect=()=>this.clear}function Fn(){const n=zn(ds.create).current;return Pm(n.disposeEffect),n}function vs(n){n.preventDefault(),n.stopPropagation()}function Cw(n){return"nativeEvent"in n}function p0(n){return n.pointerType===""&&n.isTrusted?!0:sm&&n.pointerType?n.type==="click"&&n.buttons===1:n.detail===0&&!n.pointerType}function h0(n){return Vm?!1:!sm&&n.width===0&&n.height===0||sm&&n.width===1&&n.height===1&&n.pressure===0&&n.detail===0&&n.pointerType==="mouse"||n.width<1&&n.height<1&&n.pressure===0&&n.detail===0&&n.pointerType==="touch"}function Bl(n,o){const r=["mouse","pen"];return o||r.push("",void 0),r.includes(n)}function Rw(n){const o=n.type;return o==="click"||o==="mousedown"||o==="keydown"||o==="keyup"}const om="data-base-ui-focusable",g0="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])",Qc="ArrowLeft",Zc="ArrowRight",x0="ArrowUp",qm="ArrowDown";function jn(n){let o=n.activeElement;for(;o?.shadowRoot?.activeElement!=null;)o=o.shadowRoot.activeElement;return o}function Je(n,o){if(!n||!o)return!1;const r=o.getRootNode?.();if(n.contains(o))return!0;if(r&&Ta(r)){let l=o;for(;l;){if(n===l)return!0;l=l.parentNode||l.host}}return!1}function Dn(n){return"composedPath"in n?n.composedPath()[0]:n.target}function _c(n,o){if(!ht(n))return!1;const r=n;if(o.hasElement(r))return!r.hasAttribute("data-trigger-disabled");for(const[,l]of o.entries())if(Je(l,r))return!l.hasAttribute("data-trigger-disabled");return!1}function Cf(n,o){if(o==null)return!1;if("composedPath"in n)return n.composedPath().includes(o);const r=n;return r.target!=null&&o.contains(r.target)}function Ow(n){return n.matches("html,body")}function Jc(n){return Ut(n)&&n.matches(g0)}function kw(n){return n?.closest(`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),${g0}`)!=null}function rm(n){return n?n.getAttribute("role")==="combobox"&&Jc(n):!1}function _w(n){if(!n||Vm)return!0;try{return n.matches(":focus-visible")}catch{return!0}}function am(n){return n?n.hasAttribute(om)?n:n.querySelector(`[${om}]`)||n:null}function Mw(n,o){return o!=null&&!Bl(o)?0:typeof n=="function"?n():n}function lm(n,o,r){const l=Mw(n,r);return typeof l=="number"?l:l?.[o]}function ty(n){return typeof n=="function"?n():n}function b0(n,o){return o||n==="click"||n==="mousedown"}function Aw(n){return n?.includes("mouse")&&n!=="mousedown"}function ft(n,o,r,l){return n.addEventListener(o,r,l),()=>{n.removeEventListener(o,r,l)}}function Ts(...n){return()=>{for(let o=0;o<n.length;o+=1){const r=n[o];r&&r()}}}function rn(n){const o=zn(Dw,n).current;return o.next=n,Ge(o.effect),o}function Dw(n){const o={current:n,next:n,effect:()=>{o.current=o.next}};return o}function yt(n){return n?.ownerDocument||document}const zw={clipPath:"inset(50%)",overflow:"hidden",whiteSpace:"nowrap",border:0,padding:0,width:1,height:1,margin:-1},Lw={...zw,position:"fixed",top:0,left:0},Yo=h.forwardRef(function(o,r){const[l,c]=h.useState();Ge(()=>{fw&&wr&&c("button")},[]);const d={tabIndex:0,role:l};return i.jsx("span",{...o,ref:r,style:Lw,"aria-hidden":l?void 0:!0,...d,"data-base-ui-focus-guard":""})}),Iw=["top","right","bottom","left"],Ca=Math.min,no=Math.max,Mc=Math.round,dc=Math.floor,so=n=>({x:n,y:n}),Uw={left:"right",right:"left",bottom:"top",top:"bottom"};function y0(n,o,r){return no(n,Ca(o,r))}function io(n,o){return typeof n=="function"?n(o):n}function Gn(n){return n.split("-")[0]}function Go(n){return n.split("-")[1]}function Fm(n){return n==="x"?"y":"x"}function Xm(n){return n==="y"?"height":"width"}function as(n){const o=n[0];return o==="t"||o==="b"?"y":"x"}function Km(n){return Fm(as(n))}function Hw(n,o,r){r===void 0&&(r=!1);const l=Go(n),c=Km(n),d=Xm(c);let m=c==="x"?l===(r?"end":"start")?"right":"left":l==="start"?"bottom":"top";return o.reference[d]>o.floating[d]&&(m=Ac(m)),[m,Ac(m)]}function Bw(n){const o=Ac(n);return[im(n),o,im(o)]}function im(n){return n.includes("start")?n.replace("start","end"):n.replace("end","start")}const ny=["left","right"],sy=["right","left"],Yw=["top","bottom"],Vw=["bottom","top"];function Pw(n,o,r){switch(n){case"top":case"bottom":return r?o?sy:ny:o?ny:sy;case"left":case"right":return o?Yw:Vw;default:return[]}}function Gw(n,o,r,l){const c=Go(n);let d=Pw(Gn(n),r==="start",l);return c&&(d=d.map(m=>m+"-"+c),o&&(d=d.concat(d.map(im)))),d}function Ac(n){const o=Gn(n);return Uw[o]+n.slice(o.length)}function qw(n){var o,r,l,c;return{top:(o=n.top)!=null?o:0,right:(r=n.right)!=null?r:0,bottom:(l=n.bottom)!=null?l:0,left:(c=n.left)!=null?c:0}}function v0(n){return typeof n!="number"?qw(n):{top:n,right:n,bottom:n,left:n}}function Dc(n){const{x:o,y:r,width:l,height:c}=n;return{width:l,height:c,top:r,left:o,right:o+l,bottom:r+c,x:o,y:r}}function oy(n,o){return o<0||o>=n.length}function Rf(n,o){return va(n.current,{disabledIndices:o})}function ry(n,o){return va(n.current,{decrement:!0,startingIndex:n.current.length,disabledIndices:o})}function va(n,{startingIndex:o=-1,decrement:r=!1,disabledIndices:l,amount:c=1}={}){let d=o;do d+=r?-c:c;while(d>=0&&d<=n.length-1&&S0(n,d,l));return d}function S0(n,o,r){if(typeof r=="function"?r(o):r?.includes(o)??!1)return!0;const c=n[o];return c?Wc(c)?!r&&(c.hasAttribute("disabled")||c.getAttribute("aria-disabled")==="true"):!0:!1}function Fw(n){return n.visibility==="hidden"||n.visibility==="collapse"}function Wc(n,o=n?qn(n):null){return!n||!n.isConnected||!o||Fw(o)?!1:typeof n.checkVisibility=="function"?n.checkVisibility():o.display!=="none"&&o.display!=="contents"}const Xw='a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]';function Kw(n){const o=n.assignedSlot;if(o)return o;if(n.parentElement)return n.parentElement;const r=n.getRootNode();return Ta(r)?r.host:null}function cm(n){for(const o of Array.from(n.children))if(bn(o)==="summary")return o;return null}function $w(n,o){const r=cm(o);return!!r&&(n===r||Je(r,n))}function E0(n){const o=n?bn(n):"";return n!=null&&n.matches(Xw)&&(o!=="summary"||n.parentElement!=null&&bn(n.parentElement)==="details"&&cm(n.parentElement)===n)&&(o!=="details"||cm(n)==null)&&(o!=="input"||n.type!=="hidden")}function N0(n){if(!E0(n)||!n.isConnected||n.matches(":disabled"))return!1;for(let o=n;o;o=Kw(o)){const r=o!==n,l=bn(o)==="slot";if(o.hasAttribute("inert")||r&&bn(o)==="details"&&!o.open&&!$w(n,o)||o.hasAttribute("hidden")||!l&&!Qw(o,r))return!1}return!0}function Qw(n,o){const r=qn(n);return o?r.display!=="none":Wc(n,r)}function j0(n){const o=n.tabIndex;if(o<0){const r=bn(n);if(r==="details"||r==="audio"||r==="video"||Ut(n)&&n.isContentEditable)return 0}return o}function Of(n){if(bn(n)!=="input")return null;const o=n;return o.type==="radio"&&o.name!==""?o:null}function Zw(n,o){const r=Of(n);if(!r)return!0;const l=o.find(c=>{const d=Of(c);return d?.name===r.name&&d.form===r.form&&d.checked});return l?l===r:o.find(c=>{const d=Of(c);return d?.name===r.name&&d.form===r.form})===r}function T0(n){if(Ut(n)&&bn(n)==="slot"){const o=n.assignedElements({flatten:!0});if(o.length>0)return o}return Ut(n)&&n.shadowRoot?Array.from(n.shadowRoot.children):Array.from(n.children)}function w0(n,o){T0(n).forEach(r=>{E0(r)&&o.push(r),w0(r,o)})}function C0(n,o,r){T0(n).forEach(l=>{Ut(l)&&l.matches(o)&&r.push(l),C0(l,o,r)})}function $m(n){return N0(n)&&j0(n)>=0}function R0(n){const o=[];return w0(n,o),o.filter(N0)}function ql(n){const o=R0(n);return o.filter(r=>j0(r)>=0&&Zw(r,o))}function O0(n,o){const r=ql(n),l=r.length;if(l===0)return;const c=jn(yt(n)),d=r.indexOf(c),m=d===-1?o===1?0:l-1:d+o;return r[m]}function Qm(n){return O0(yt(n).body,1)||n}function k0(n){return O0(yt(n).body,-1)||n}function _0(n,o){if(!n)return null;const r=ql(yt(n).body),l=r.length;if(l===0)return null;const c=r.indexOf(n);if(c===-1)return null;const d=(c+o+l)%l;return r[d]}function Jw(n){return _0(n,1)}function Ww(n){return _0(n,-1)}function Sa(n,o){const r=o||n.currentTarget,l=n.relatedTarget;return!l||!Je(r,l)}function eC(n){ql(n).forEach(r=>{r.dataset.tabindex=r.getAttribute("tabindex")||"",r.setAttribute("tabindex","-1")})}function ay(n){const o=[];C0(n,"[data-tabindex]",o),o.forEach(r=>{const l=r.dataset.tabindex;delete r.dataset.tabindex,l?r.setAttribute("tabindex",l):r.removeAttribute("tabindex")})}function Vo(n,o,r=!0){return n.filter(c=>c.parentId===o).flatMap(c=>[...!r||c.context?.open?[c]:[],...Vo(n,c.id,r)])}function ly(n,o){let r=[],l=n.find(c=>c.id===o)?.parentId;for(;l;){const c=n.find(d=>d.id===l);l=c?.parentId,c&&(r=r.concat(c))}return r}function Yl(n){return`data-base-ui-${n}`}let fc=0;function Nc(n,o={}){const{preventScroll:r=!1,sync:l=!1,shouldFocus:c}=o;cancelAnimationFrame(fc);function d(){c&&!c()||n?.focus({preventScroll:r})}if(l)return d(),un;const m=requestAnimationFrame(d);return fc=m,()=>{fc===m&&(cancelAnimationFrame(m),fc=0)}}const kf={inert:new WeakMap,"aria-hidden":new WeakMap},iy="data-base-ui-inert",um={inert:new WeakSet,"aria-hidden":new WeakSet};let Nl=new WeakMap,_f=0;function tC(n){return um[n]}function M0(n){return n?Ta(n)?n.host:M0(n.parentNode):null}const cy=(n,o)=>o.map(r=>{if(n.contains(r))return r;const l=M0(r);return n.contains(l)?l:null}).filter(r=>r!=null),uy=n=>{const o=new Set;return n.forEach(r=>{let l=r;for(;l&&!o.has(l);)o.add(l),l=l.parentNode}),o},dy=(n,o,r)=>{const l=[],c=d=>{!d||r.has(d)||Array.from(d.children).forEach(m=>{bn(m)!=="script"&&(o.has(m)?c(m):l.push(m))})};return c(n),l};function nC(n,o,r,l,{mark:c=!0}){let d=null;l?d="inert":r&&(d="aria-hidden");let m=null,g=null;const b=cy(o,n),p=c?dy(o,uy(b),new Set(b)):[],v=[],x=[];if(d){const S=kf[d],j=tC(d);g=j,m=S;const N=cy(o,Array.from(o.querySelectorAll("[aria-live]"))),k=b.concat(N);dy(o,uy(k),new Set(k)).forEach(E=>{const T=E.getAttribute(d),_=T!==null&&T!=="false",R=(S.get(E)||0)+1;S.set(E,R),v.push(E),R===1&&_&&j.add(E),_||E.setAttribute(d,d==="inert"?"":"true")})}return c&&p.forEach(S=>{const j=(Nl.get(S)||0)+1;Nl.set(S,j),x.push(S),j===1&&S.setAttribute(iy,"")}),_f+=1,()=>{m&&v.forEach(S=>{const N=(m.get(S)||0)-1;m.set(S,N),N||(!g?.has(S)&&d&&S.removeAttribute(d),g?.delete(S))}),c&&x.forEach(S=>{const j=(Nl.get(S)||0)-1;Nl.set(S,j),j||S.removeAttribute(iy)}),_f-=1,_f||(kf.inert=new WeakMap,kf["aria-hidden"]=new WeakMap,um.inert=new WeakSet,um["aria-hidden"]=new WeakSet,Nl=new WeakMap)}}function fy(n,o={}){const{ariaHidden:r=!1,inert:l=!1,mark:c=!0}=o,d=yt(n[0]).body;return nC(n,d,r,l,{mark:c})}const sC=500,A0=500,oC={style:{transition:"none"}},D0="data-base-ui-click-trigger",rC={fallbackAxisSide:"none"},z0={fallbackAxisSide:"end"},aC={clipPath:"inset(50%)",position:"fixed",top:0,left:0},L0=h.createContext(null),I0=()=>h.useContext(L0),lC=Yl("portal");function iC(n={}){const{ref:o,container:r,componentProps:l=Ht,elementProps:c}=n,d=Sr(),g=I0()?.portalNode,[b,p]=h.useState(null),[v,x]=h.useState(null),S=tt(O=>{O!==null&&x(O)}),j=h.useRef(null);Ge(()=>{if(r===null){j.current&&(j.current=null,x(null),p(null));return}if(d==null)return;const O=(r&&(_m(r)?r:r.current))??g??document.body;if(O==null){j.current&&(j.current=null,x(null),p(null));return}j.current!==O&&(j.current=O,x(null),p(O))},[r,g,d]);const N=fn("div",l,{ref:[o,S],props:[{id:d,[lC]:""},c]});return{portalNode:v,portalSubtree:b&&N?lo.createPortal(N,b):null}}const Zm=h.forwardRef(function(o,r){const{render:l,className:c,style:d,children:m,container:g,renderGuards:b,...p}=o,{portalNode:v,portalSubtree:x}=iC({container:g,ref:r,componentProps:o,elementProps:p}),S=h.useRef(null),j=h.useRef(null),N=h.useRef(null),k=h.useRef(null),[O,E]=h.useState(null),T=h.useRef(!1),_=O?.modal,R=O?.open,H=typeof b=="boolean"?b:!!O&&!O.modal&&O.open&&!!v;h.useEffect(()=>{if(!v||_)return;function B(M){v&&M.relatedTarget&&Sa(M)&&(M.type==="focusin"?T.current&&(ay(v),T.current=!1):(eC(v),T.current=!0))}return Ts(ft(v,"focusin",B,!0),ft(v,"focusout",B,!0))},[v,_]),Ge(()=>{!v||R!==!0||!T.current||(ay(v),T.current=!1)},[R,v]);const A=h.useMemo(()=>({beforeOutsideRef:S,afterOutsideRef:j,beforeInsideRef:N,afterInsideRef:k,portalNode:v,setFocusManagerState:E}),[v]);return i.jsxs(h.Fragment,{children:[x,i.jsxs(L0.Provider,{value:A,children:[H&&v&&i.jsx(Yo,{"data-type":"outside",ref:S,onFocus:B=>{if(Sa(B,v))N.current?.focus();else{const M=O?O.domReference:null;k0(M)?.focus()}}}),H&&v&&i.jsx("span",{"aria-owns":v.id,style:aC}),v&&lo.createPortal(m,v),H&&v&&i.jsx(Yo,{"data-type":"outside",ref:j,onFocus:B=>{if(Sa(B,v))k.current?.focus();else{const M=O?O.domReference:null;Qm(M)?.focus(),O?.closeOnFocusOut&&O?.onOpenChange(!1,jt(vr,B.nativeEvent))}}})]})]})});function U0(){const n=new Map;return{emit(o,r){n.get(o)?.forEach(l=>l(r))},on(o,r){n.has(o)||n.set(o,new Set),n.get(o).add(r)},off(o,r){n.get(o)?.delete(r)}}}class Jm{nodesRef={current:[]};events=U0();addNode(o){this.nodesRef.current.push(o)}removeNode(o){const r=this.nodesRef.current.findIndex(l=>l===o);r!==-1&&this.nodesRef.current.splice(r,1)}}const H0=h.createContext(null),B0=h.createContext(null),uo=()=>h.useContext(H0)?.id||null,qo=n=>{const o=h.useContext(B0);return n??o};function Wm(n){const o=Sr(),r=qo(n),l=uo();return Ge(()=>{if(!o)return;const c={id:o,parentId:l};return r?.addNode(c),()=>{r?.removeNode(c)}},[r,o,l]),o}function Y0(n){const{children:o,id:r}=n,l=uo();return i.jsx(H0.Provider,{value:h.useMemo(()=>({id:r,parentId:l}),[r,l]),children:o})}function V0(n){const{children:o,externalTree:r}=n,l=zn(()=>r??new Jm).current;return i.jsx(B0.Provider,{value:l,children:o})}function cC(n,o){const r=Xt(Dn(n));return n instanceof r.KeyboardEvent?"keyboard":n instanceof r.FocusEvent?o||"keyboard":"pointerType"in n?n.pointerType||"keyboard":"touches"in n?"touch":n instanceof r.MouseEvent?o||(n.detail===0?"keyboard":"mouse"):""}const my=20;let Uo=[];function ep(){Uo=Uo.filter(n=>n.deref()?.isConnected)}function py(n){ep(),n&&bn(n)!=="body"&&(Uo.push(new WeakRef(n)),Uo.length>my&&(Uo=Uo.slice(-my)))}function hy(){return ep(),Uo[Uo.length-1]?.deref()}function uC(n){return n?$m(n)?n:ql(n)[0]||n:null}function gy(n){if(n.hasAttribute("tabindex")&&!n.hasAttribute("data-tabindex")||!n.getAttribute("role")?.includes("dialog"))return;const r=R0(n).filter(c=>{const d=c.getAttribute("data-tabindex")||"";return $m(c)||c.hasAttribute("data-tabindex")&&!d.startsWith("-")}),l=n.getAttribute("tabindex");r.length===0?l!=="0"&&(n.setAttribute("tabindex","0"),n.setAttribute("data-tabindex","0")):(l!=="-1"||n.hasAttribute("data-tabindex")&&n.getAttribute("data-tabindex")!=="-1")&&(n.setAttribute("tabindex","-1"),n.setAttribute("data-tabindex","-1"))}function tp(n){const{context:o,children:r,disabled:l=!1,initialFocus:c=!0,returnFocus:d=!0,restoreFocus:m=!1,modal:g=!0,closeOnFocusOut:b=!0,openInteractionType:p="",nextFocusableElement:v,previousFocusableElement:x,beforeContentFocusGuardRef:S,externalTree:j,getInsideElements:N}=n,k="rootStore"in o?o.rootStore:o,O=k.useState("open"),E=k.useState("domReferenceElement"),T=k.useState("floatingElement"),{events:_,dataRef:R}=k.context,H=tt(()=>R.current.floatingContext?.nodeId),A=c===!1,B=rm(E)&&A,M=rn(c),Q=rn(d),ne=rn(p),me=rn(O),se=qo(j),X=I0(),te=h.useRef(!1),$=h.useRef(!1),w=h.useRef(!1),U=h.useRef(null),Y=h.useRef(""),z=h.useRef(""),I=h.useRef(null),D=h.useRef(null),G=wa(I,S,X?.beforeInsideRef),L=wa(D,X?.afterInsideRef),q=Fn(),Z=Fn(),V=Hl(),be=X!=null,ue=am(T),he=tt((we=ue)=>we?ql(we):[]),Le=tt(()=>N?.().filter(we=>we!=null)??[]);h.useEffect(()=>{if(l||!g)return;function we(Ae){Ae.key==="Tab"&&Je(ue,jn(yt(ue)))&&he().length===0&&!B&&vs(Ae)}const De=yt(ue);return ft(De,"keydown",we)},[l,ue,g,B,he]),h.useEffect(()=>{if(l||!O)return;const we=yt(ue);function De(){w.current=!1}function Ae(Ie){const oe=Dn(Ie),ce=Le(),de=Je(T,oe)||Je(E,oe)||Je(X?.portalNode,oe)||ce.some(Te=>Te===oe||Je(Te,oe));w.current=!de,z.current=Ie.pointerType||"keyboard",oe?.closest(`[${D0}]`)&&($.current=!0,Z.start(0,()=>{$.current=!1}))}function ye(){z.current="keyboard"}return Ts(ft(we,"pointerdown",Ae,!0),ft(we,"pointerup",De,!0),ft(we,"pointercancel",De,!0),ft(we,"keydown",ye,!0),De)},[l,T,E,ue,O,X,Z,Le]),h.useEffect(()=>{if(l||!b)return;const we=yt(ue);function De(){$.current=!0,Z.start(0,()=>{$.current=!1})}function Ae(ce){const de=Dn(ce);$m(de)&&(U.current=de)}function ye(ce){const de=ce.relatedTarget,Te=ce.currentTarget,Me=Dn(ce);g&&de==null&&Me!=null&&Je(T,Me)&&py(Me),queueMicrotask(()=>{const _e=H(),it=k.context.triggerElements,ie=Le(),F=de?.hasAttribute(Yl("focus-guard"))&&[I.current,D.current,X?.beforeInsideRef.current,X?.afterInsideRef.current,X?.beforeOutsideRef.current,X?.afterOutsideRef.current,Ks(x),Ks(v)].includes(de),pe=!(Je(E,de)||Je(T,de)||Je(de,T)||Je(X?.portalNode,de)||ie.some(J=>J===de||Je(J,de))||de!=null&&it.hasElement(de)||it.hasMatchingElement(J=>Je(J,de))||F||se&&(Vo(se.nodesRef.current,_e).find(J=>Je(J.context?.elements.floating,de)||Je(J.context?.elements.domReference,de))||ly(se.nodesRef.current,_e).find(J=>[J.context?.elements.floating,am(J.context?.elements.floating)].includes(de)||J.context?.elements.domReference===de)));if(Te===E&&ue&&gy(ue),m&&Te!==E&&!Wc(Me)&&jn(we)===we.body){if(Ut(ue)&&(ue.focus(),m==="popup")){V.request(()=>{ue.focus()});return}const J=he(),je=U.current,Fe=(je&&J.includes(je)?je:null)||J[J.length-1]||ue;Ut(Fe)&&Fe.focus()}if(R.current.insideReactTree){R.current.insideReactTree=!1;return}(B||!g)&&de&&pe&&!$.current&&(B||de!==hy())&&(te.current=!0,k.setOpen(!1,jt(vr,ce)))})}function Ie(){w.current||(R.current.insideReactTree=!0,q.start(0,()=>{R.current.insideReactTree=!1}))}const oe=Ut(E)?E:null;if(!(!T&&!oe))return Ts(oe&&ft(oe,"focusout",ye),oe&&ft(oe,"pointerdown",De),T&&ft(T,"focusin",Ae),T&&ft(T,"focusout",ye),T&&X&&ft(T,"focusout",Ie,!0))},[l,E,T,ue,g,se,X,k,b,m,he,B,H,R,q,Z,V,v,x,Le]),h.useEffect(()=>{if(l||!T||!O)return;const we=Array.from(X?.portalNode?.querySelectorAll(`[${Yl("portal")}]`)||[]),Ae=(se?ly(se.nodesRef.current,H()):[]).find(Te=>rm(Te.context?.elements.domReference||null))?.context?.elements.domReference,Ie=[...[T,...we,I.current,D.current,X?.beforeOutsideRef.current,X?.afterOutsideRef.current,...Le()],Ae,Ks(x),Ks(v),B?E:null].filter(Te=>Te!=null),oe=fy(Ie,{ariaHidden:g||B,mark:!1}),ce=[T,...we].filter(Te=>Te!=null),de=fy(ce);return()=>{de(),oe()}},[O,l,E,T,g,X,B,se,H,v,x,Le]),Ge(()=>{if(!O||l||!Ut(ue))return;const we=yt(ue),De=jn(we);queueMicrotask(()=>{const Ae=M.current,ye=typeof Ae=="function"?Ae(ne.current||""):Ae;if(ye===void 0||ye===!1||Je(ue,De))return;let oe=null;const ce=()=>(oe==null&&(oe=he(ue)),oe[0]||ue);let de;ye===!0||ye===null?de=ce():de=Ks(ye),de=de||ce();const Te=Je(ue,jn(we));Nc(de,{preventScroll:de===ue,shouldFocus(){if(!me.current)return!1;if(Te)return!0;const Me=jn(we);return!(Me!==de&&Je(ue,Me))}})})},[l,O,ue,he,M,ne,me]),Ge(()=>{if(l||!ue)return;const we=yt(ue),De=jn(we),Ae=ne.current==null;py(De);function ye(oe){if(oe.open||(Y.current=cC(oe.nativeEvent,z.current)),oe.reason===dn&&oe.nativeEvent.type==="mouseleave"&&(te.current=!0),oe.reason===Hm)if(oe.nested)te.current=!1;else if(p0(oe.nativeEvent)||h0(oe.nativeEvent))te.current=!1;else{let ce=!1;yt(ue).createElement("div").focus({get preventScroll(){return ce=!0,!1}}),ce?te.current=!1:te.current=!0}}_.on("openchange",ye);function Ie(){const oe=Q.current;let ce=typeof oe=="function"?oe(Y.current):oe;if(ce===void 0||ce===!1)return null;ce===null&&(ce=!0);const de=E?.isConnected?E:null,Te=De?.isConnected&&bn(De)!=="body"?De:null;let Me=Ae?Te||de:de||Te;return Me||(Me=hy()||null),typeof ce=="boolean"?Me:Ks(ce)||Me||null}return()=>{_.off("openchange",ye);const oe=jn(we),ce=Le(),de=Je(T,oe)||ce.some(_e=>_e===oe||Je(_e,oe))||se&&Vo(se.nodesRef.current,H(),!1).some(_e=>Je(_e.context?.elements.floating,oe)),Te=Q.current,Me=Ie();queueMicrotask(()=>{const _e=uC(Me),it=typeof Te!="boolean";Te&&!te.current&&Ut(_e)&&(!(!it&&_e!==oe&&oe!==we.body)||de)&&_e.focus({preventScroll:!0}),te.current=!1})}},[l,T,ue,Q,ne,_,se,E,H,Le]),Ge(()=>{if(!wr||O||!T)return;const we=jn(yt(T));!Ut(we)||!Jc(we)||Je(T,we)&&we.blur()},[O,T]),Ge(()=>{if(!(l||!X))return X.setFocusManagerState({modal:g,closeOnFocusOut:b,open:O,onOpenChange:k.setOpen,domReference:E}),()=>{X.setFocusManagerState(null)}},[l,X,g,O,k,b,E]),Ge(()=>{if(!(l||!ue))return gy(ue),()=>{queueMicrotask(ep)}},[l,ue]);const qe=!l&&(g?!B:!0)&&(be||g);return i.jsxs(h.Fragment,{children:[qe&&i.jsx(Yo,{"data-type":"inside",ref:G,onFocus:we=>{if(g){const De=he();Nc(De[De.length-1])}else X?.portalNode&&(te.current=!1,Sa(we,X.portalNode)?Qm(E)?.focus():Ks(x??X.beforeOutsideRef)?.focus())}}),r,qe&&i.jsx(Yo,{"data-type":"inside",ref:L,onFocus:we=>{g?Nc(he()[0]):X?.portalNode&&(b&&(te.current=!0),Sa(we,X.portalNode)?k0(E)?.focus():Ks(v??X.afterOutsideRef)?.focus())}})]})}function P0(n,o={}){const{enabled:r=!0,event:l="click",toggle:c=!0,ignoreMouse:d=!1,stickIfOpen:m=!0,touchOpenDelay:g=0,reason:b=yr}=o,p="rootStore"in n?n.rootStore:n,v=p.context.dataRef,x=h.useRef(void 0),S=Hl(),j=Fn(),N=h.useMemo(()=>{function k(E,T,_,R){const H=jt(b,T,_);E&&R==="touch"&&g>0?j.start(g,()=>{p.setOpen(!0,H)}):p.setOpen(E,H)}function O(E,T,_){const R=v.current.openEvent,H=p.select("domReferenceElement")!==T;return E&&H||!E||!c?!0:R&&m?!_(R.type):!1}return{onPointerDown(E){x.current=E.pointerType},onMouseDown(E){const T=x.current,_=E.nativeEvent,R=p.select("open");if(E.button!==0||l==="click"||Bl(T,!0)&&d)return;const H=O(R,E.currentTarget,M=>M==="click"||M==="mousedown"),A=Dn(_);if(Jc(A)){k(H,_,A,T);return}const B=E.currentTarget;S.request(()=>{k(H,_,B,T)})},onClick(E){if(l==="mousedown-only")return;const T=x.current;if(l==="mousedown"&&T){x.current=void 0;return}if(Bl(T,!0)&&d)return;const _=p.select("open"),R=O(_,E.currentTarget,H=>H==="click"||H==="mousedown"||H==="keydown"||H==="keyup");k(R,E.nativeEvent,E.currentTarget,T)},onKeyDown(){x.current=void 0}}},[v,l,d,b,p,m,c,S,j,g]);return h.useMemo(()=>r?{reference:N}:Ht,[r,N])}function dC(){return!1}function fC(n){return{escapeKey:typeof n=="boolean"?n:n?.escapeKey??!1,outsidePress:typeof n=="boolean"?n:n?.outsidePress??!0}}function np(n,o={}){const{enabled:r=!0,escapeKey:l=!0,outsidePress:c=!0,outsidePressEvent:d="sloppy",referencePress:m=dC,bubbles:g,externalTree:b}=o,p="rootStore"in n?n.rootStore:n,v=p.useState("open"),x=p.useState("floatingElement"),{dataRef:S}=p.context,j=qo(b),N=tt(typeof c=="function"?c:()=>!1),k=typeof c=="function"?N:c,O=k!==!1,E=tt(()=>d),{escapeKey:T,outsidePress:_}=fC(g),R=h.useRef(!1),H=h.useRef(!1),A=h.useRef(!1),B=h.useRef(!1),M=h.useRef(""),Q=h.useRef(null),ne=Fn(),me=Fn(),se=tt(()=>{me.clear(),S.current.insideReactTree=!1}),X=tt(G=>{const L=S.current.floatingContext?.nodeId;return(j?Vo(j.nodesRef.current,L):[]).some(Z=>Z.context?.open&&!Z.context.dataRef.current[G])}),te=tt(G=>Cf(G,p.select("floatingElement"))||Cf(G,p.select("domReferenceElement"))),$=tt(G=>{m()&&p.setOpen(!1,jt(yr,G.nativeEvent))}),w=tt(G=>{if(!v||!r||!l||G.key!=="Escape"||B.current||!T&&X("__escapeKeyBubbles"))return;const L=Cw(G)?G.nativeEvent:G,q=jt(Fc,L);p.setOpen(!1,q),q.isCanceled||G.preventDefault(),!T&&!q.isPropagationAllowed&&G.stopPropagation()}),U=tt(()=>{S.current.insideReactTree=!0,me.start(0,se)}),Y=tt(G=>{if(!v||!r||G.button!==0)return;const L=Dn(G.nativeEvent);Je(p.select("floatingElement"),L)&&(R.current||(R.current=!0,H.current=!1))}),z=tt(G=>{!v||!r||(G.defaultPrevented||G.nativeEvent.defaultPrevented)&&R.current&&(H.current=!0)});h.useEffect(()=>{if(!v||!r)return;S.current.__escapeKeyBubbles=T,S.current.__outsidePressBubbles=_;const G=new ds,L=new ds;function q(){G.clear(),B.current=!0}function Z(){G.start(wr?5:0,()=>{B.current=!1})}function V(){A.current=!0,L.start(0,()=>{A.current=!1})}function be(){R.current=!1,H.current=!1}function ue(){const ie=M.current,F=ie==="pen"||!ie?"mouse":ie,pe=E(),J=typeof pe=="function"?pe():pe;return typeof J=="string"?J:J[F]}function he(ie){const F=ue();return F==="intentional"&&ie.type!=="click"||F==="sloppy"&&ie.type==="click"}function Le(ie){const F=S.current.floatingContext?.nodeId,pe=j&&Vo(j.nodesRef.current,F).some(J=>Cf(ie,J.context?.elements.floating));return te(ie)||pe}function qe(ie){if(he(ie)){ie.type!=="click"&&!te(ie)&&(L.clear(),A.current=!1),se();return}if(S.current.insideReactTree){se();return}const F=Dn(ie),pe=`[${Yl("inert")}]`,J=ht(F)?F.getRootNode():null,je=Array.from((Ta(J)?J:yt(p.select("floatingElement"))).querySelectorAll(pe)),Fe=p.context.triggerElements;if(F&&(Fe.hasElement(F)||Fe.hasMatchingElement(Oe=>Je(Oe,F))))return;let Ne=ht(F)?F:null;for(;Ne&&!eo(Ne);){const Oe=ao(Ne);if(eo(Oe)||!ht(Oe))break;Ne=Oe}if(!(je.length&&ht(F)&&!Ow(F)&&!Je(F,p.select("floatingElement"))&&je.every(Oe=>!Je(Ne,Oe)))){if(Ut(F)&&!("touches"in ie)){const Oe=eo(F),Xe=qn(F),st=/auto|scroll/,Et=Oe||st.test(Xe.overflowX),kt=Oe||st.test(Xe.overflowY),xt=Et&&F.clientWidth>0&&F.scrollWidth>F.clientWidth,yn=kt&&F.clientHeight>0&&F.scrollHeight>F.clientHeight,an=Xe.direction==="rtl",Ke=yn&&(an?ie.offsetX<=F.offsetWidth-F.clientWidth:ie.offsetX>F.clientWidth),Tt=xt&&ie.offsetY>F.clientHeight;if(Ke||Tt)return}if(!Le(ie)){if(ue()==="intentional"&&A.current){L.clear(),A.current=!1;return}typeof k=="function"&&!k(ie)||X("__outsidePressBubbles")||(p.setOpen(!1,jt(Hm,ie)),se())}}}function we(ie){ue()!=="sloppy"||ie.pointerType==="touch"||!p.select("open")||!r||te(ie)||qe(ie)}function De(ie){if(ue()!=="sloppy"||!p.select("open")||!r||te(ie))return;const F=ie.touches[0];F&&(Q.current={startTime:Date.now(),startX:F.clientX,startY:F.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},ne.start(1e3,()=>{Q.current&&(Q.current.dismissOnTouchEnd=!1,Q.current.dismissOnMouseDown=!1)}))}function Ae(ie,F){const pe=Dn(ie);if(!pe)return;const J=ft(pe,ie.type,()=>{F(ie),J()})}function ye(ie){M.current="touch",Ae(ie,De)}function Ie(ie){ne.clear(),ie.type==="pointerdown"&&(M.current=ie.pointerType),!(ie.type==="mousedown"&&Q.current&&!Q.current.dismissOnMouseDown)&&Ae(ie,F=>{F.type==="pointerdown"?we(F):qe(F)})}function oe(ie){if(!R.current)return;const F=H.current;if(be(),ue()==="intentional"){if(ie.type==="pointercancel"){F&&V();return}if(!Le(ie)){if(F){V();return}typeof k=="function"&&!k(ie)||(L.clear(),A.current=!0,se())}}}function ce(ie){if(ue()!=="sloppy"||!Q.current||te(ie))return;const F=ie.touches[0];if(!F)return;const pe=Math.abs(F.clientX-Q.current.startX),J=Math.abs(F.clientY-Q.current.startY),je=Math.sqrt(pe*pe+J*J);je>5&&(Q.current.dismissOnTouchEnd=!0),je>10&&(qe(ie),ne.clear(),Q.current=null)}function de(ie){Ae(ie,ce)}function Te(ie){ue()!=="sloppy"||!Q.current||te(ie)||(Q.current.dismissOnTouchEnd&&qe(ie),ne.clear(),Q.current=null)}function Me(ie){Ae(ie,Te)}const _e=yt(x),it=Ts(l&&Ts(ft(_e,"keydown",w),ft(_e,"compositionstart",q),ft(_e,"compositionend",Z)),O&&Ts(ft(_e,"click",Ie,!0),ft(_e,"pointerdown",Ie,!0),ft(_e,"pointerup",oe,!0),ft(_e,"pointercancel",oe,!0),ft(_e,"mousedown",Ie,!0),ft(_e,"mouseup",oe,!0),ft(_e,"touchstart",ye,!0),ft(_e,"touchmove",de,!0),ft(_e,"touchend",Me,!0)));return()=>{it(),G.clear(),L.clear(),be(),A.current=!1}},[S,x,l,O,k,v,r,T,_,w,se,E,X,te,j,p,ne]),h.useEffect(se,[k,se]);const I=h.useMemo(()=>({onKeyDown:w,onPointerDown:$,onClick:$}),[w,$]),D=h.useMemo(()=>({onKeyDown:w,onPointerDown:z,onMouseDown:z,onClickCapture:U,onMouseDownCapture(G){U(),Y(G)},onPointerDownCapture(G){U(),Y(G)},onMouseUpCapture:U,onTouchEndCapture:U,onTouchMoveCapture:U}),[w,U,Y,z]);return h.useMemo(()=>r?{reference:I,floating:D,trigger:I}:{},[r,I,D])}function xy(n,o,r){let{reference:l,floating:c}=n;const d=as(o),m=Km(o),g=Xm(m),b=Gn(o),p=d==="y",v=l.x+l.width/2-c.width/2,x=l.y+l.height/2-c.height/2,S=l[g]/2-c[g]/2;let j;switch(b){case"top":j={x:v,y:l.y-c.height};break;case"bottom":j={x:v,y:l.y+l.height};break;case"right":j={x:l.x+l.width,y:x};break;case"left":j={x:l.x-c.width,y:x};break;default:j={x:l.x,y:l.y}}const N=Go(o);return N&&(j[m]+=S*(N==="end"?1:-1)*(r&&p?-1:1)),j}async function mC(n,o){var r;o===void 0&&(o={});const{x:l,y:c,platform:d,rects:m,elements:g,strategy:b}=n,{boundary:p="clippingAncestors",rootBoundary:v="viewport",elementContext:x="floating",altBoundary:S=!1,padding:j=0}=io(o,n),N=v0(j),O=g[S?x==="floating"?"reference":"floating":x],E=Dc(await d.getClippingRect({element:(r=await(d.isElement==null?void 0:d.isElement(O)))==null||r?O:O.contextElement||await(d.getDocumentElement==null?void 0:d.getDocumentElement(g.floating)),boundary:p,rootBoundary:v,strategy:b})),T=x==="floating"?{x:l,y:c,width:m.floating.width,height:m.floating.height}:m.reference,_=await(d.getOffsetParent==null?void 0:d.getOffsetParent(g.floating)),R=await(d.isElement==null?void 0:d.isElement(_))&&await(d.getScale==null?void 0:d.getScale(_))||{x:1,y:1},H=Dc(d.convertOffsetParentRelativeRectToViewportRelativeRect?await d.convertOffsetParentRelativeRectToViewportRelativeRect({elements:g,rect:T,offsetParent:_,strategy:b}):T);return{top:(E.top-H.top+N.top)/R.y,bottom:(H.bottom-E.bottom+N.bottom)/R.y,left:(E.left-H.left+N.left)/R.x,right:(H.right-E.right+N.right)/R.x}}const pC=50,hC=async(n,o,r)=>{const{placement:l="bottom",strategy:c="absolute",middleware:d=[],platform:m}=r,g=m.detectOverflow?m:{...m,detectOverflow:mC},b=await(m.isRTL==null?void 0:m.isRTL(o));let p=await m.getElementRects({reference:n,floating:o,strategy:c}),{x:v,y:x}=xy(p,l,b),S=l,j=0;const N={};for(let k=0;k<d.length;k++){const O=d[k];if(!O)continue;const{name:E,fn:T}=O,{x:_,y:R,data:H,reset:A}=await T({x:v,y:x,initialPlacement:l,placement:S,strategy:c,middlewareData:N,rects:p,platform:g,elements:{reference:n,floating:o}});v=_??v,x=R??x,N[E]={...N[E],...H},A&&j<pC&&(j++,typeof A=="object"&&(A.placement&&(S=A.placement),A.rects&&(p=A.rects===!0?await m.getElementRects({reference:n,floating:o,strategy:c}):A.rects),{x:v,y:x}=xy(p,S,b)),k=-1)}return{x:v,y:x,placement:S,strategy:c,middlewareData:N}},gC=function(n){return n===void 0&&(n={}),{name:"flip",options:n,async fn(o){var r,l;const{placement:c,middlewareData:d,rects:m,initialPlacement:g,platform:b,elements:p}=o,{mainAxis:v=!0,crossAxis:x=!0,fallbackPlacements:S,fallbackStrategy:j="bestFit",fallbackAxisSideDirection:N="none",flipAlignment:k=!0,...O}=io(n,o);if((r=d.arrow)!=null&&r.alignmentOffset)return{};const E=Gn(c),T=as(g),_=Gn(g)===g,R=await(b.isRTL==null?void 0:b.isRTL(p.floating)),H=S||(_||!k?[Ac(g)]:Bw(g)),A=N!=="none";!S&&A&&H.push(...Gw(g,k,N,R));const B=[g,...H],M=await b.detectOverflow(o,O),Q=[];let ne=((l=d.flip)==null?void 0:l.overflows)||[];if(v&&Q.push(M[E]),x){const te=Hw(c,m,R);Q.push(M[te[0]],M[te[1]])}if(ne=[...ne,{placement:c,overflows:Q}],!Q.every(te=>te<=0)){var me,se;const te=(((me=d.flip)==null?void 0:me.index)||0)+1,$=B[te];if($&&(!(x==="alignment"?T!==as($):!1)||ne.every(Y=>as(Y.placement)===T?Y.overflows[0]>0:!0)))return{data:{index:te,overflows:ne},reset:{placement:$}};let w=(se=ne.filter(U=>U.overflows[0]<=0).sort((U,Y)=>U.overflows[1]-Y.overflows[1])[0])==null?void 0:se.placement;if(!w)switch(j){case"bestFit":{var X;const U=(X=ne.filter(Y=>{if(A){const z=as(Y.placement);return z===T||z==="y"}return!0}).map(Y=>[Y.placement,Y.overflows.filter(z=>z>0).reduce((z,I)=>z+I,0)]).sort((Y,z)=>Y[1]-z[1])[0])==null?void 0:X[0];U&&(w=U);break}case"initialPlacement":w=g;break}if(c!==w)return{reset:{placement:w}}}return{}}}};function by(n,o){return{top:n.top-o.height,right:n.right-o.width,bottom:n.bottom-o.height,left:n.left-o.width}}function yy(n){return Iw.some(o=>n[o]>=0)}const xC=function(n){return n===void 0&&(n={}),{name:"hide",options:n,async fn(o){const{rects:r,platform:l}=o,{strategy:c="referenceHidden",...d}=io(n,o);switch(c){case"referenceHidden":{const m=await l.detectOverflow(o,{...d,elementContext:"reference"}),g=by(m,r.reference);return{data:{referenceHiddenOffsets:g,referenceHidden:yy(g)}}}case"escaped":{const m=await l.detectOverflow(o,{...d,altBoundary:!0}),g=by(m,r.floating);return{data:{escapedOffsets:g,escaped:yy(g)}}}default:return{}}}}},G0=new Set(["left","top"]);async function bC(n,o){const{placement:r,platform:l,elements:c}=n,d=await(l.isRTL==null?void 0:l.isRTL(c.floating)),m=Gn(r),g=Go(r),b=as(r)==="y",p=G0.has(m)?-1:1,v=d&&b?-1:1,x=io(o,n);let{mainAxis:S,crossAxis:j,alignmentAxis:N}=typeof x=="number"?{mainAxis:x,crossAxis:0,alignmentAxis:null}:{mainAxis:x.mainAxis||0,crossAxis:x.crossAxis||0,alignmentAxis:x.alignmentAxis};return g&&typeof N=="number"&&(j=g==="end"?N*-1:N),b?{x:j*v,y:S*p}:{x:S*p,y:j*v}}const yC=function(n){return n===void 0&&(n=0),{name:"offset",options:n,async fn(o){var r,l;const{x:c,y:d,placement:m,middlewareData:g}=o,b=await bC(o,n);return m===((r=g.offset)==null?void 0:r.placement)&&(l=g.arrow)!=null&&l.alignmentOffset?{}:{x:c+b.x,y:d+b.y,data:{...b,placement:m}}}}},vC=function(n){return n===void 0&&(n={}),{name:"shift",options:n,async fn(o){const{x:r,y:l,placement:c,platform:d}=o,{mainAxis:m=!0,crossAxis:g=!1,limiter:b={fn:T=>{let{x:_,y:R}=T;return{x:_,y:R}}},...p}=io(n,o),v={x:r,y:l},x=await d.detectOverflow(o,p),S=as(c),j=Fm(S);let N=v[j],k=v[S];const O=(T,_)=>y0(_+x[T==="y"?"top":"left"],_,_-x[T==="y"?"bottom":"right"]);m&&(N=O(j,N)),g&&(k=O(S,k));const E=b.fn({...o,[j]:N,[S]:k});return{...E,data:{x:E.x-r,y:E.y-l,enabled:{[j]:m,[S]:g}}}}}},SC=function(n){return n===void 0&&(n={}),{options:n,fn(o){var r,l;const{x:c,y:d,placement:m,rects:g,middlewareData:b}=o,{offset:p=0,mainAxis:v=!0,crossAxis:x=!0}=io(n,o),S={x:c,y:d},j=as(m),N=Fm(j);let k=S[N],O=S[j];const E=io(p,o),T=typeof E=="number"?{mainAxis:E,crossAxis:0}:{mainAxis:(r=E.mainAxis)!=null?r:0,crossAxis:(l=E.crossAxis)!=null?l:0};if(v){const H=N==="y"?"height":"width",A=g.reference[N]-g.floating[H]+T.mainAxis,B=g.reference[N]+g.reference[H]-T.mainAxis;k<A?k=A:k>B&&(k=B)}if(x){var _,R;const H=N==="y"?"width":"height",A=G0.has(Gn(m)),B=g.reference[j]-g.floating[H]+(A&&((_=b.offset)==null?void 0:_[j])||0)+(A?0:T.crossAxis),M=g.reference[j]+g.reference[H]+(A?0:((R=b.offset)==null?void 0:R[j])||0)-(A?T.crossAxis:0);O<B?O=B:O>M&&(O=M)}return{[N]:k,[j]:O}}}},EC=function(n){return n===void 0&&(n={}),{name:"size",options:n,async fn(o){const{placement:r,rects:l,platform:c,elements:d}=o,{apply:m=()=>{},...g}=io(n,o),b=await c.detectOverflow(o,g),p=Gn(r),v=Go(r),x=as(r)==="y",{width:S,height:j}=l.floating;let N,k;p==="top"||p==="bottom"?(N=p,k=v===(await(c.isRTL==null?void 0:c.isRTL(d.floating))?"start":"end")?"left":"right"):(k=p,N=v==="end"?"top":"bottom");const O=j-b.top-b.bottom,E=S-b.left-b.right,T=Ca(j-b[N],O),_=Ca(S-b[k],E),R=o.middlewareData.shift,H=!R;let A=T,B=_;R!=null&&R.enabled.x&&(B=E),R!=null&&R.enabled.y&&(A=O),H&&!v&&(x?B=S-2*no(b.left,b.right):A=j-2*no(b.top,b.bottom)),await m({...o,availableWidth:B,availableHeight:A});const M=await c.getDimensions(d.floating);return S!==M.width||j!==M.height?{reset:{rects:!0}}:{}}}};function q0(n){const o=qn(n);let r=parseFloat(o.width)||0,l=parseFloat(o.height)||0;const c=Ut(n),d=c?n.offsetWidth:r,m=c?n.offsetHeight:l,g=Mc(r)!==d||Mc(l)!==m;return g&&(r=d,l=m),{width:r,height:l,$:g}}function sp(n){return ht(n)?n:n.contextElement}function Ea(n){const o=sp(n);if(!Ut(o))return so(1);const r=o.getBoundingClientRect(),{width:l,height:c,$:d}=q0(o);let m=(d?Mc(r.width):r.width)/l,g=(d?Mc(r.height):r.height)/c;return(!m||!Number.isFinite(m))&&(m=1),(!g||!Number.isFinite(g))&&(g=1),{x:m,y:g}}const NC=so(0);function F0(n){const o=Xt(n);return!Am()||!o.visualViewport?NC:{x:o.visualViewport.offsetLeft,y:o.visualViewport.offsetTop}}function jC(n,o,r){return o===void 0&&(o=!1),!!r&&o&&r===Xt(n)}function Er(n,o,r,l){o===void 0&&(o=!1),r===void 0&&(r=!1);const c=n.getBoundingClientRect(),d=sp(n);let m=so(1);o&&(l?ht(l)&&(m=Ea(l)):m=Ea(n));const g=jC(d,r,l)?F0(d):so(0);let b=(c.left+g.x)/m.x,p=(c.top+g.y)/m.y,v=c.width/m.x,x=c.height/m.y;if(d&&l){const S=Xt(d),j=ht(l)?Xt(l):l;let N=S,k=Zf(N);for(;k&&j!==N;){const O=Ea(k),E=k.getBoundingClientRect(),T=qn(k),_=E.left+(k.clientLeft+parseFloat(T.paddingLeft))*O.x,R=E.top+(k.clientTop+parseFloat(T.paddingTop))*O.y;b*=O.x,p*=O.y,v*=O.x,x*=O.y,b+=_,p+=R,N=Xt(k),k=Zf(N)}}return Dc({width:v,height:x,x:b,y:p})}function eu(n,o){const r=Pc(n).scrollLeft;return o?o.left+r:Er(co(n)).left+r}function X0(n,o){const r=n.getBoundingClientRect(),l=r.left+o.scrollLeft-eu(n,r),c=r.top+o.scrollTop;return{x:l,y:c}}function TC(n){let{elements:o,rect:r,offsetParent:l,strategy:c}=n;const d=c==="fixed",m=co(l),g=o?Vc(o.floating):!1;if(l===m||g&&d)return r;let b={scrollLeft:0,scrollTop:0},p=so(1);const v=so(0),x=Ut(l);if((x||!d)&&((bn(l)!=="body"||jr(m))&&(b=Pc(l)),x)){const j=Er(l);p=Ea(l),v.x=j.x+l.clientLeft,v.y=j.y+l.clientTop}const S=m&&!x&&!d?X0(m,b):so(0);return{width:r.width*p.x,height:r.height*p.y,x:r.x*p.x-b.scrollLeft*p.x+v.x+S.x,y:r.y*p.y-b.scrollTop*p.y+v.y+S.y}}function wC(n){return n.getClientRects?Array.from(n.getClientRects()):[]}function CC(n){const o=Pc(n),r=n.ownerDocument.body,l=no(n.scrollWidth,n.clientWidth,r.scrollWidth,r.clientWidth),c=no(n.scrollHeight,n.clientHeight,r.scrollHeight,r.clientHeight);let d=-o.scrollLeft+eu(n);const m=-o.scrollTop;return qn(r).direction==="rtl"&&(d+=no(n.clientWidth,r.clientWidth)-l),{width:l,height:c,x:d,y:m}}const RC=25;function OC(n,o,r){r===void 0&&(r="viewport");const l=r==="layoutViewport",c=Xt(n),d=co(n),m=c.visualViewport;let g=d.clientWidth,b=d.clientHeight,p=0,v=0;if(m){const S=!Am()||o==="fixed";l?S||(p=-m.offsetLeft,v=-m.offsetTop):(g=m.width,b=m.height,S&&(p=m.offsetLeft,v=m.offsetTop))}if(eu(d)<=0){const S=d.ownerDocument,j=S.body,N=getComputedStyle(j),k=S.compatMode==="CSS1Compat"&&parseFloat(N.marginLeft)+parseFloat(N.marginRight)||0,O=Math.abs(d.clientWidth-j.clientWidth-k),E=getComputedStyle(d).scrollbarGutter==="stable both-edges"?O/2:O;E<=RC&&(g-=E)}return{width:g,height:b,x:p,y:v}}function kC(n,o){const r=Er(n,!0,o==="fixed"),l=r.top+n.clientTop,c=r.left+n.clientLeft,d=Ea(n),m=n.clientWidth*d.x,g=n.clientHeight*d.y,b=c*d.x,p=l*d.y;return{width:m,height:g,x:b,y:p}}function vy(n,o,r){let l;if(o==="viewport"||o==="layoutViewport")l=OC(n,r,o);else if(o==="document")l=CC(co(n));else if(ht(o))l=kC(o,r);else{const c=F0(n);l={x:o.x-c.x,y:o.y-c.y,width:o.width,height:o.height}}return Dc(l)}function _C(n,o){const r=o.get(n);if(r)return r;let l=Ll(n,[],!1).filter(g=>ht(g)&&bn(g)!=="body"),c=null;const d=qn(n).position==="fixed";let m=d?ao(n):n;for(;ht(m)&&!eo(m);){const g=qn(m),b=Mm(m),p=c?c.position:d?"fixed":"";!b&&(p==="fixed"||p==="absolute"&&g.position==="static")?l=l.filter(x=>x!==m):c=g,m=ao(m)}return o.set(n,l),l}function MC(n){let{element:o,boundary:r,rootBoundary:l,strategy:c}=n;const m=[...r==="clippingAncestors"?Vc(o)?[]:_C(o,this._c):[].concat(r),l],g=vy(o,m[0],c);let b=g.top,p=g.right,v=g.bottom,x=g.left;for(let S=1;S<m.length;S++){const j=vy(o,m[S],c);b=no(j.top,b),p=Ca(j.right,p),v=Ca(j.bottom,v),x=no(j.left,x)}return{width:p-x,height:v-b,x,y:b}}function AC(n){const{width:o,height:r}=q0(n);return{width:o,height:r}}function DC(n,o,r){const l=Ut(o),c=co(o),d=r==="fixed",m=Er(n,!0,d,o);let g={scrollLeft:0,scrollTop:0};const b=so(0);if((l||!d)&&((bn(o)!=="body"||jr(c))&&(g=Pc(o)),l)){const S=Er(o,!0,d,o);b.x=S.x+o.clientLeft,b.y=S.y+o.clientTop}!l&&c&&(b.x=eu(c));const p=c&&!l&&!d?X0(c,g):so(0),v=m.left+g.scrollLeft-b.x-p.x,x=m.top+g.scrollTop-b.y-p.y;return{x:v,y:x,width:m.width,height:m.height}}function Mf(n){return qn(n).position==="static"}function Sy(n,o){if(!Ut(n)||qn(n).position==="fixed")return null;if(o)return o(n);let r=n.offsetParent;return co(n)===r&&(r=r.ownerDocument.body),r}function K0(n,o){const r=Xt(n);if(Vc(n))return r;if(!Ut(n)){let c=ao(n);for(;c&&!eo(c);){if(ht(c)&&!Mf(c))return c;c=ao(c)}return r}let l=Sy(n,o);for(;l&&v2(l)&&Mf(l);)l=Sy(l,o);return l&&eo(l)&&Mf(l)&&!Mm(l)?r:l||N2(n)||r}const zC=async function(n){const o=this.getOffsetParent||K0,r=this.getDimensions,l=await r(n.floating);return{reference:DC(n.reference,await o(n.floating),n.strategy),floating:{x:0,y:0,width:l.width,height:l.height}}};function LC(n){return qn(n).direction==="rtl"}const IC={convertOffsetParentRelativeRectToViewportRelativeRect:TC,getDocumentElement:co,getClippingRect:MC,getOffsetParent:K0,getElementRects:zC,getClientRects:wC,getDimensions:AC,getScale:Ea,isElement:ht,isRTL:LC};function $0(n,o){return n.x===o.x&&n.y===o.y&&n.width===o.width&&n.height===o.height}function UC(n,o,r){let l=null,c;const d=co(n);function m(){var v;clearTimeout(c),(v=l)==null||v.disconnect(),l=null}function g(v,x){v===void 0&&(v=!1),x===void 0&&(x=1),m();const S=n.getBoundingClientRect(),{left:j,top:N,width:k,height:O}=S;if(v||o(),!k||!O)return;const E=dc(N),T=dc(d.clientWidth-(j+k)),_=dc(d.clientHeight-(N+O)),R=dc(j),A={rootMargin:-E+"px "+-T+"px "+-_+"px "+-R+"px",threshold:no(0,Ca(1,x))||1};let B=!0;function M(Q){const ne=Q[0].intersectionRatio;if(!$0(S,n.getBoundingClientRect()))return g();if(ne!==x){if(!B)return g();ne?g(!1,ne):c=setTimeout(()=>{g(!1,1e-7)},1e3)}B=!1}try{l=new IntersectionObserver(M,{...A,root:d.ownerDocument})}catch{l=new IntersectionObserver(M,A)}l.observe(n)}const b=Xt(n),p=()=>g(r);return b.addEventListener("resize",p),g(!0),()=>{b.removeEventListener("resize",p),m()}}function Ey(n,o,r,l){l===void 0&&(l={});const{ancestorScroll:c=!0,ancestorResize:d=!0,elementResize:m=typeof ResizeObserver=="function",layoutShift:g=typeof IntersectionObserver=="function",animationFrame:b=!1}=l,p=sp(n),v=c||d?[...p?Ll(p):[],...o?Ll(o):[]]:[];v.forEach(E=>{c&&E.addEventListener("scroll",r),d&&E.addEventListener("resize",r)});const x=p&&g?UC(p,r,d):null;let S=-1,j=null;m&&(j=new ResizeObserver(E=>{let[T]=E;T&&T.target===p&&j&&o&&(j.unobserve(o),cancelAnimationFrame(S),S=requestAnimationFrame(()=>{var _;(_=j)==null||_.observe(o)})),r()}),p&&!b&&j.observe(p),o&&j.observe(o));let N,k=b?Er(n):null;b&&O();function O(){const E=Er(n);k&&!$0(k,E)&&r(),k=E,N=requestAnimationFrame(O)}return r(),()=>{var E;v.forEach(T=>{c&&T.removeEventListener("scroll",r),d&&T.removeEventListener("resize",r)}),x?.(),(E=j)==null||E.disconnect(),j=null,b&&cancelAnimationFrame(N)}}const HC=yC,BC=vC,YC=gC,VC=EC,PC=xC,GC=SC,qC=(n,o,r)=>{const l=new Map,c=r??{},d={...IC,...c.platform,_c:l};return hC(n,o,{...c,platform:d})};var FC=typeof document<"u",XC=function(){},jc=FC?h.useLayoutEffect:XC;function zc(n,o){if(n===o)return!0;if(typeof n!=typeof o)return!1;if(typeof n=="function"&&n.toString()===o.toString())return!0;let r,l,c;if(n&&o&&typeof n=="object"){if(Array.isArray(n)){if(r=n.length,r!==o.length)return!1;for(l=r;l--!==0;)if(!zc(n[l],o[l]))return!1;return!0}if(c=Object.keys(n),r=c.length,r!==Object.keys(o).length)return!1;for(l=r;l--!==0;)if(!{}.hasOwnProperty.call(o,c[l]))return!1;for(l=r;l--!==0;){const d=c[l];if(!(d==="_owner"&&n.$$typeof)&&!zc(n[d],o[d]))return!1}return!0}return n!==n&&o!==o}function Q0(n){return typeof window>"u"?1:(n.ownerDocument.defaultView||window).devicePixelRatio||1}function Ny(n,o){const r=Q0(n);return Math.round(o*r)/r}function Af(n){const o=h.useRef(n);return jc(()=>{o.current=n}),o}function KC(n){n===void 0&&(n={});const{placement:o="bottom",strategy:r="absolute",middleware:l=[],platform:c,elements:{reference:d,floating:m}={},transform:g=!0,whileElementsMounted:b,open:p}=n,[v,x]=h.useState({x:0,y:0,strategy:r,placement:o,middlewareData:{},isPositioned:!1}),[S,j]=h.useState(l);zc(S,l)||j(l);const[N,k]=h.useState(null),[O,E]=h.useState(null),T=h.useCallback(Y=>{Y!==A.current&&(A.current=Y,k(Y))},[]),_=h.useCallback(Y=>{Y!==B.current&&(B.current=Y,E(Y))},[]),R=d||N,H=m||O,A=h.useRef(null),B=h.useRef(null),M=h.useRef(v),Q=b!=null,ne=Af(b),me=Af(c),se=Af(p),X=h.useCallback(()=>{if(!A.current||!B.current)return;const Y={placement:o,strategy:r,middleware:S};me.current&&(Y.platform=me.current),qC(A.current,B.current,Y).then(z=>{const I={...z,isPositioned:se.current!==!1};te.current&&!zc(M.current,I)&&(M.current=I,lo.flushSync(()=>{x(I)}))})},[S,o,r,me,se]);jc(()=>{p===!1&&M.current.isPositioned&&(M.current.isPositioned=!1,x(Y=>({...Y,isPositioned:!1})))},[p]);const te=h.useRef(!1);jc(()=>(te.current=!0,()=>{te.current=!1}),[]),jc(()=>{if(R&&(A.current=R),H&&(B.current=H),R&&H){if(ne.current)return ne.current(R,H,X);X()}},[R,H,X,ne,Q]);const $=h.useMemo(()=>({reference:A,floating:B,setReference:T,setFloating:_}),[T,_]),w=h.useMemo(()=>({reference:R,floating:H}),[R,H]),U=h.useMemo(()=>{const Y={position:r,left:0,top:0};if(!w.floating)return Y;const z=Ny(w.floating,v.x),I=Ny(w.floating,v.y);return g?{...Y,transform:"translate("+z+"px, "+I+"px)",...Q0(w.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:z,top:I}},[r,g,w.floating,v.x,v.y]);return h.useMemo(()=>({...v,update:X,refs:$,elements:w,floatingStyles:U}),[v,X,$,w,U])}const $C=(n,o)=>{const r=HC(n);return{name:r.name,fn:r.fn,options:[n,o]}},QC=(n,o)=>{const r=BC(n);return{name:r.name,fn:r.fn,options:[n,o]}},ZC=(n,o)=>({fn:GC(n).fn,options:[n,o]}),JC=(n,o)=>{const r=YC(n);return{name:r.name,fn:r.fn,options:[n,o]}},WC=(n,o)=>{const r=VC(n);return{name:r.name,fn:r.fn,options:[n,o]}},eR=(n,o)=>{const r=PC(n);return{name:r.name,fn:r.fn,options:[n,o]}};function Z0(n){const o=h.useRef(!0);o.current&&(o.current=!1,n())}const Ye=(n,o,r,l,c,d,...m)=>{if(m.length>0)throw new Error(En(1));let g;if(n)g=n;else throw new Error("Missing arguments");return g};var Df={exports:{}},zf={};var jy;function tR(){if(jy)return zf;jy=1;var n=Vl();function o(x,S){return x===S&&(x!==0||1/x===1/S)||x!==x&&S!==S}var r=typeof Object.is=="function"?Object.is:o,l=n.useState,c=n.useEffect,d=n.useLayoutEffect,m=n.useDebugValue;function g(x,S){var j=S(),N=l({inst:{value:j,getSnapshot:S}}),k=N[0].inst,O=N[1];return d(function(){k.value=j,k.getSnapshot=S,b(k)&&O({inst:k})},[x,j,S]),c(function(){return b(k)&&O({inst:k}),x(function(){b(k)&&O({inst:k})})},[x]),m(j),j}function b(x){var S=x.getSnapshot;x=x.value;try{var j=S();return!r(x,j)}catch{return!0}}function p(x,S){return S()}var v=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?p:g;return zf.useSyncExternalStore=n.useSyncExternalStore!==void 0?n.useSyncExternalStore:v,zf}var Ty;function J0(){return Ty||(Ty=1,Df.exports=tR()),Df.exports}var W0=J0(),Lf={exports:{}},If={};var wy;function nR(){if(wy)return If;wy=1;var n=Vl(),o=J0();function r(p,v){return p===v&&(p!==0||1/p===1/v)||p!==p&&v!==v}var l=typeof Object.is=="function"?Object.is:r,c=o.useSyncExternalStore,d=n.useRef,m=n.useEffect,g=n.useMemo,b=n.useDebugValue;return If.useSyncExternalStoreWithSelector=function(p,v,x,S,j){var N=d(null);if(N.current===null){var k={hasValue:!1,value:null};N.current=k}else k=N.current;N=g(function(){function E(A){if(!T){if(T=!0,_=A,A=S(A),j!==void 0&&k.hasValue){var B=k.value;if(j(B,A))return R=B}return R=A}if(B=R,l(_,A))return B;var M=S(A);return j!==void 0&&j(B,M)?(_=A,B):(_=A,R=M)}var T=!1,_,R,H=x===void 0?null:x;return[function(){return E(v())},H===null?void 0:function(){return E(H())}]},[v,x,S,j]);var O=c(p,N[0],N[1]);return m(function(){k.hasValue=!0,k.value=O},[O]),b(O),O},If}var Cy;function sR(){return Cy||(Cy=1,Lf.exports=nR()),Lf.exports}var oR=sR();const dm=[];let fm;function rR(){return fm}function aR(n){dm.push(n)}function e1(n){const o=(r,l)=>{const c=zn(iR).current;let d;try{fm=c;for(const m of dm)m.before(c);d=n(r,l);for(const m of dm)m.after(c);c.didInitialize=!0}finally{fm=void 0}return d};return o.displayName=n.displayName||n.name,o}function lR(n){return h.forwardRef(e1(n))}function iR(){return{didInitialize:!1}}const cR=Um(19),uR=cR?fR:mR;function t1(n,o,r,l,c){return uR(n,o,r,l,c)}function dR(n,o,r,l,c){const d=h.useCallback(()=>o(n.getSnapshot(),r,l,c),[n,o,r,l,c]);return W0.useSyncExternalStore(n.subscribe,d,d)}aR({before(n){n.syncIndex=0,n.didInitialize||(n.syncTick=1,n.syncHooks=[],n.didChangeStore=!0,n.getSnapshot=()=>{let o=!1;for(let r=0;r<n.syncHooks.length;r+=1){const l=n.syncHooks[r],c=l.selector(l.store.state,l.a1,l.a2,l.a3);Object.is(l.value,c)||(o=!0,l.value=c)}return o&&(n.syncTick+=1),n.syncTick})},after(n){n.syncHooks.length>0&&(n.didChangeStore&&(n.didChangeStore=!1,n.subscribe=o=>{const r=new Set;for(const c of n.syncHooks)r.add(c.store);const l=[];for(const c of r)l.push(c.subscribe(o));return()=>{for(const c of l)c()}}),W0.useSyncExternalStore(n.subscribe,n.getSnapshot,n.getSnapshot))}});function fR(n,o,r,l,c){const d=rR();if(!d)return dR(n,o,r,l,c);const m=d.syncIndex;d.syncIndex+=1;let g;return d.didInitialize?(g=d.syncHooks[m],(g.store!==n||g.selector!==o||!Object.is(g.a1,r)||!Object.is(g.a2,l)||!Object.is(g.a3,c))&&(g.store!==n&&(d.didChangeStore=!0),g.store=n,g.selector=o,g.a1=r,g.a2=l,g.a3=c,g.value=o(n.getSnapshot(),r,l,c))):(g={store:n,selector:o,a1:r,a2:l,a3:c,value:o(n.getSnapshot(),r,l,c)},d.syncHooks.push(g)),g.value}function mR(n,o,r,l,c){return oR.useSyncExternalStoreWithSelector(n.subscribe,n.getSnapshot,n.getSnapshot,d=>o(d,r,l,c))}class pR{constructor(o){this.state=o,this.listeners=new Set,this.updateTick=0}subscribe=o=>(this.listeners.add(o),()=>{this.listeners.delete(o)});getSnapshot=()=>this.state;setState(o){if(this.state===o)return;this.state=o,this.updateTick+=1;const r=this.updateTick;for(const l of this.listeners){if(r!==this.updateTick)return;l(o)}}update(o){for(const r in o)if(!Object.is(this.state[r],o[r])){this.setState({...this.state,...o});return}}set(o,r){Object.is(this.state[o],r)||this.setState({...this.state,[o]:r})}notifyAll(){const o={...this.state};this.setState(o)}use(o,r,l,c){return t1(this,o,r,l,c)}}class tu extends pR{constructor(o,r={},l){super(o),this.context=r,this.selectors=l}useSyncedValue(o,r){h.useDebugValue(o);const l=this;Ge(()=>{l.state[o]!==r&&l.set(o,r)},[l,o,r])}useSyncedValueWithCleanup(o,r){const l=this;Ge(()=>(l.state[o]!==r&&l.set(o,r),()=>{l.set(o,void 0)}),[l,o,r])}useSyncedValues(o){const r=this,l=Object.values(o);Ge(()=>{r.update(o)},[r,...l])}useControlledProp(o,r){h.useDebugValue(o);const l=this,c=r!==void 0;Ge(()=>{c&&!Object.is(l.state[o],r)&&l.setState({...l.state,[o]:r})},[l,o,r,c])}select(o,r,l,c){const d=this.selectors[o];return d(this.state,r,l,c)}useState(o,r,l,c){return h.useDebugValue(o),t1(this,this.selectors[o],r,l,c)}useContextCallback(o,r){h.useDebugValue(o);const l=tt(r??un);this.context[o]=l}useStateSetter(o){const r=h.useRef(void 0);return r.current===void 0&&(r.current=l=>{this.set(o,l)}),r.current}observe(o,r){let l;typeof o=="function"?l=o:l=this.selectors[o];let c=l(this.state);return r(c,c,this),this.subscribe(d=>{const m=l(d);if(!Object.is(c,m)){const g=c;c=m,r(m,g,this)}})}}const hR={open:Ye(n=>n.open),transitionStatus:Ye(n=>n.transitionStatus),domReferenceElement:Ye(n=>n.domReferenceElement),referenceElement:Ye(n=>n.positionReference??n.referenceElement),floatingElement:Ye(n=>n.floatingElement),floatingId:Ye(n=>n.floatingId)};class nu extends tu{constructor(o){const{syncOnly:r,nested:l,onOpenChange:c,triggerElements:d,...m}=o;super({...m,positionReference:m.referenceElement,domReferenceElement:m.referenceElement},{onOpenChange:c,dataRef:{current:{}},events:U0(),nested:l,triggerElements:d},hR),this.syncOnly=r}syncOpenEvent=(o,r)=>{(!o||!this.state.open||r!=null&&Rw(r))&&(this.context.dataRef.current.openEvent=o?r:void 0)};dispatchOpenChange=(o,r)=>{this.syncOpenEvent(o,r.event);const l={open:o,reason:r.reason,nativeEvent:r.event,nested:this.context.nested,triggerElement:r.trigger};this.context.events.emit("openchange",l)};setOpen=(o,r)=>{if(this.syncOnly){this.context.onOpenChange?.(o,r);return}this.dispatchOpenChange(o,r),this.context.onOpenChange?.(o,r)}}function n1(n){const{popupStore:o,treatPopupAsFloatingElement:r=!1,floatingRootContext:l,floatingId:c,nested:d,onOpenChange:m}=n,g=o.useState("open"),b=o.useState("activeTriggerElement"),p=o.useState(r?"popupElement":"positionerElement"),v=o.context.triggerElements,x=m,S=h.useRef(null);l===void 0&&S.current===null&&(S.current=new nu({open:g,transitionStatus:void 0,referenceElement:b,floatingElement:p,triggerElements:v,onOpenChange:x,floatingId:c,syncOnly:!0,nested:d}));const j=l??S.current;return o.useSyncedValue("floatingId",c),Ge(()=>{const N={open:g,floatingId:c,referenceElement:b,floatingElement:p};ht(b)&&(N.domReferenceElement=b),j.state.positionReference===j.state.referenceElement&&(N.positionReference=b),j.update(N)},[g,c,b,p,j]),j.context.onOpenChange=x,j.context.nested=d,j}const su={tabIndex:-1,[om]:""};function s1(n){return o=>o==="touch"?n.current:!0}function o1(n,o,r=!1){const l=Sr(),c=uo()!=null,d=h.useRef(null);n===void 0&&d.current===null&&(d.current=o(l,c));const m=n??d.current;return n1({popupStore:m,treatPopupAsFloatingElement:r,floatingRootContext:m.state.floatingRootContext,floatingId:l,nested:c,onOpenChange:m.setOpen}),{store:m,internalStore:d.current}}function gR(n,o){const r=h.useRef(null),l=h.useRef(null);return h.useCallback(c=>{if(n===void 0)return;let d=!1;if(r.current!==null){const m=r.current,g=l.current,b=o.context.triggerElements.getById(m);g&&b===g&&(o.context.triggerElements.delete(m),d=!0),r.current=null,l.current=null}if(c!==null&&(r.current=n,l.current=c,o.context.triggerElements.add(n,c),d=!0),d){const m=o.context.triggerElements.size;o.select("open")&&o.state.triggerCount!==m&&o.set("triggerCount",m)}},[o,n])}function op(n,o,r,l=!1){o?n.preventUnmountingOnClose=!1:l&&(n.preventUnmountingOnClose=!0);const c=r?.id??null;(c||o)&&(n.activeTriggerId=c,n.activeTriggerElement=r??null)}function r1(n){let o=!1;return n.preventUnmountOnClose=()=>{o=!0},()=>o}function a1(n,o,r,l){Z0(()=>{o===void 0&&n.state.open===!1&&r&&(n.state={...n.state,open:!0,activeTriggerId:l,preventUnmountingOnClose:!1})})}function l1(n,o,r,l){const c=r.useState("isMountedByTrigger",n),d=gR(n,r),m=tt(g=>{if(d(g),!g)return;const b=r.select("open"),p=r.select("activeTriggerId");if(p===n){r.update({activeTriggerElement:g,...b?l:null});return}p==null&&b&&r.update({activeTriggerId:n,activeTriggerElement:g,...l})});return Ge(()=>{c&&r.update({activeTriggerElement:o.current,...l})},[c,r,o,...Object.values(l)]),{registerTrigger:m,isMountedByThisTrigger:c}}function rp(n,o={}){const{closeOnActiveTriggerUnmount:r=!1}=o,l=n.useState("open"),c=n.useState("triggerCount");Ge(()=>{if(!l){n.state.triggerCount!==0&&n.set("triggerCount",0);return}const d=n.context.triggerElements.size,m={};n.state.triggerCount!==d&&(m.triggerCount=d);const g=n.select("activeTriggerId");let b=null;if(g){const p=n.context.triggerElements.getById(g);p?p!==n.state.activeTriggerElement&&(m.activeTriggerElement=p):b=g}if(!b&&!g&&d===1){const p=n.context.triggerElements.entries().next();if(!p.done){const[v,x]=p.value;m.activeTriggerId=v,m.activeTriggerElement=x}}(m.triggerCount!==void 0||m.activeTriggerId!==void 0||m.activeTriggerElement!==void 0)&&n.update(m),b&&r&&queueMicrotask(()=>{if(n.select("open")&&n.select("activeTriggerId")===b&&!n.context.triggerElements.getById(b)){const p=jt(i0);n.setOpen(!1,p),p.isCanceled||n.update({activeTriggerId:null,activeTriggerElement:null})}})},[l,n,c,r])}function ap(n,o,r){const{mounted:l,setMounted:c,transitionStatus:d}=Sw(n),m=o.useState("preventUnmountingOnClose"),g=n?!1:m;o.useSyncedValues({mounted:l,transitionStatus:d,preventUnmountingOnClose:g});const b=tt(()=>{c(!1),o.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1,preventUnmountingOnClose:!1}),r?.(),o.context.onOpenChangeComplete?.(!1)});return $c({enabled:l&&!n&&!g,open:n,ref:o.context.popupRef,onComplete(){n||b()}}),{forceUnmount:b,transitionStatus:d}}function lp(n,o){n.useSyncedValues(o),Ge(()=>()=>{n.update({activeTriggerProps:Ht,inactiveTriggerProps:Ht,popupProps:Ht})},[n])}function i1(n,o){Ge(()=>{!o&&n.state.openMethod!==null&&n.set("openMethod",null)},[o,n]),Ge(()=>()=>{n.state.openMethod!==null&&n.set("openMethod",null)},[n])}class Fl{constructor(){this.elementsSet=new Set,this.idMap=new Map}add(o,r){const l=this.idMap.get(o);l!==r&&(l!==void 0&&this.elementsSet.delete(l),this.elementsSet.add(r),this.idMap.set(o,r))}delete(o){const r=this.idMap.get(o);r&&(this.elementsSet.delete(r),this.idMap.delete(o))}hasElement(o){return this.elementsSet.has(o)}hasMatchingElement(o){for(const r of this.elementsSet)if(o(r))return!0;return!1}getById(o){return this.idMap.get(o)}entries(){return this.idMap.entries()}elements(){return this.elementsSet.values()}get size(){return this.idMap.size}}function xR(){return new nu({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:new Fl,floatingId:void 0,syncOnly:!1,nested:!1,onOpenChange:void 0})}function ip(){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:xR(),floatingId:void 0,triggerCount:0,preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:Ht,inactiveTriggerProps:Ht,popupProps:Ht}}function c1(n,o,r=!1){return new nu({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:n,floatingId:o,syncOnly:!0,nested:r,onOpenChange:void 0})}const Al=Ye(n=>n.triggerIdProp??n.activeTriggerId),cp=Ye(n=>n.openProp??n.open),Ry=Ye(n=>(n.popupElement?.id??n.floatingId)||void 0);function u1(n,o){return o!==void 0&&cp(n)&&Al(n)===o}function bR(n,o){return u1(n,o)?!0:o!==void 0&&cp(n)&&Al(n)==null&&n.triggerCount===1}const up={open:cp,mounted:Ye(n=>n.mounted),transitionStatus:Ye(n=>n.transitionStatus),floatingRootContext:Ye(n=>n.floatingRootContext),triggerCount:Ye(n=>n.triggerCount),preventUnmountingOnClose:Ye(n=>n.preventUnmountingOnClose),payload:Ye(n=>n.payload),activeTriggerId:Al,activeTriggerElement:Ye(n=>n.mounted?n.activeTriggerElement:null),popupId:Ry,isTriggerActive:Ye((n,o)=>o!==void 0&&Al(n)===o),isOpenedByTrigger:Ye((n,o)=>u1(n,o)),isMountedByTrigger:Ye((n,o)=>o!==void 0&&Al(n)===o&&n.mounted),triggerProps:Ye((n,o)=>o?n.activeTriggerProps:n.inactiveTriggerProps),triggerPopupId:Ye((n,o)=>bR(n,o)?Ry(n):void 0),popupProps:Ye(n=>n.popupProps),popupElement:Ye(n=>n.popupElement),positionerElement:Ye(n=>n.positionerElement)};function yR(n){const{open:o=!1,onOpenChange:r,elements:l={}}=n,c=Sr(),d=uo()!=null,m=zn(()=>new nu({open:o,transitionStatus:void 0,onOpenChange:r,referenceElement:l.reference??null,floatingElement:l.floating??null,triggerElements:new Fl,floatingId:c,syncOnly:!1,nested:d})).current;return Ge(()=>{const g={open:o,floatingId:c};l.reference!==void 0&&(g.referenceElement=l.reference,g.domReferenceElement=ht(l.reference)?l.reference:null),l.floating!==void 0&&(g.floatingElement=l.floating),m.update(g)},[o,c,l.reference,l.floating,m]),m.context.onOpenChange=r,m.context.nested=d,m}function vR(n={}){const{nodeId:o,externalTree:r}=n,l=yR(n),c=n.rootContext||l,d=c.useState("referenceElement"),m=c.useState("floatingElement"),g=c.useState("domReferenceElement"),b=c.useState("open"),p=c.useState("floatingId"),[v,x]=h.useState(null),[S,j]=h.useState(void 0),[N,k]=h.useState(void 0),O=h.useRef(null),E=qo(r),T=h.useMemo(()=>({reference:d,floating:m,domReference:g}),[d,m,g]),_=KC({...n,elements:{...T,...v&&{reference:v}}}),R=ht(S)?S:null,H=N===void 0?c.state.floatingElement:N;c.useSyncedValue("referenceElement",S??null),c.useSyncedValue("domReferenceElement",S===void 0?g:R),c.useSyncedValue("floatingElement",H);const A=h.useCallback(se=>{const X=ht(se)?{getBoundingClientRect:()=>se.getBoundingClientRect(),getClientRects:()=>se.getClientRects(),contextElement:se}:se;x(X),_.refs.setReference(X)},[_.refs]),B=h.useCallback(se=>{(ht(se)||se===null)&&(O.current=se,j(se)),(ht(_.refs.reference.current)||_.refs.reference.current===null||se!==null&&!ht(se))&&_.refs.setReference(se)},[_.refs,j]),M=h.useCallback(se=>{k(se),_.refs.setFloating(se)},[_.refs]),Q=h.useMemo(()=>({..._.refs,setReference:B,setFloating:M,setPositionReference:A,domReference:O}),[_.refs,B,M,A]),ne=h.useMemo(()=>({..._.elements,domReference:g}),[_.elements,g]),me=h.useMemo(()=>({..._,dataRef:c.context.dataRef,open:b,onOpenChange:c.setOpen,events:c.context.events,floatingId:p,refs:Q,elements:ne,nodeId:o,rootStore:c}),[_,Q,ne,o,c,b,p]);return Ge(()=>{g&&(O.current=g)},[g]),Ge(()=>{c.context.dataRef.current.floatingContext=me;const se=E?.nodesRef.current.find(X=>X.id===o);se&&(se.context=me)}),h.useMemo(()=>({..._,context:me,refs:Q,elements:ne,rootStore:c}),[_,Q,ne,me,c])}const Uf=Ym&≀function SR(n,o={}){const{enabled:r=!0,delay:l}=o,c="rootStore"in n?n.rootStore:n,{events:d,dataRef:m}=c.context,g=h.useRef(!1),b=h.useRef(null),p=h.useRef(!0),v=Fn();h.useEffect(()=>{const S=c.select("domReferenceElement");if(!r)return;const j=Xt(S);function N(){const E=c.select("domReferenceElement");!c.select("open")&&Ut(E)&&E===jn(yt(E))&&(g.current=!0)}function k(){p.current=!0}function O(){p.current=!1}return Ts(ft(j,"blur",N),Uf&&ft(j,"keydown",k,!0),Uf&&ft(j,"pointerdown",O,!0))},[c,r]),h.useEffect(()=>{if(!r)return;function S(j){if(j.reason===yr||j.reason===Fc){const N=c.select("domReferenceElement");ht(N)&&(b.current=N,g.current=!0)}}return d.on("openchange",S),()=>{d.off("openchange",S)}},[d,r,c]);const x=h.useMemo(()=>{function S(){g.current=!1,b.current=null}return{onMouseLeave(){S()},onFocus(j){const N=j.currentTarget;if(g.current){if(b.current===N)return;S()}const k=Dn(j.nativeEvent);if(ht(k)){if(Uf&&!j.relatedTarget){if(!p.current&&!Jc(k))return}else if(!_w(k))return}const O=_c(j.relatedTarget,c.context.triggerElements),{nativeEvent:E,currentTarget:T}=j,_=typeof l=="function"?l():l;if(c.select("open")&&O||_===0||_===void 0){c.setOpen(!0,jt(Ml,E,T));return}v.start(_,()=>{g.current||c.setOpen(!0,jt(Ml,E,T))})},onBlur(j){S();const N=j.relatedTarget,k=j.nativeEvent,O=ht(N)&&N.hasAttribute(Yl("focus-guard"))&&N.getAttribute("data-type")==="outside";v.start(0,()=>{const E=c.select("domReferenceElement"),T=jn(yt(E));!N&&T===E||Je(m.current.floatingContext?.refs.floating.current,T)||Je(E,T)||O||_c(N??T,c.context.triggerElements)||c.setOpen(!1,jt(Ml,k))})}}},[m,l,c,v]);return h.useMemo(()=>r?{reference:x,trigger:x}:{},[r,x])}class dp{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 ds,this.restTimeout=new ds,this.handleCloseOptions=void 0}static create(){return new dp}dispose=()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()};disposeEffect=()=>this.dispose}const Lc=new WeakMap;function Ic(n){if(!n.performedPointerEventsMutation)return;const o=n.pointerEventsScopeElement;o&&Lc.get(o)===n&&(n.pointerEventsScopeElement?.style.removeProperty("pointer-events"),n.pointerEventsReferenceElement?.style.removeProperty("pointer-events"),n.pointerEventsFloatingElement?.style.removeProperty("pointer-events"),Lc.delete(o)),n.performedPointerEventsMutation=!1,n.pointerEventsScopeElement=null,n.pointerEventsReferenceElement=null,n.pointerEventsFloatingElement=null}function d1(n,o){const{scopeElement:r,referenceElement:l,floatingElement:c}=o,d=Lc.get(r);d&&d!==n&&Ic(d),Ic(n),n.performedPointerEventsMutation=!0,n.pointerEventsScopeElement=r,n.pointerEventsReferenceElement=l,n.pointerEventsFloatingElement=c,Lc.set(r,n),r.style.pointerEvents="none",l.style.pointerEvents="auto",c.style.pointerEvents="auto"}function f1(n){const o=n.context.dataRef.current,r=zn(()=>o.hoverInteractionState??dp.create()).current;return o.hoverInteractionState||(o.hoverInteractionState=r),Pm(o.hoverInteractionState.disposeEffect),o.hoverInteractionState}function m1(n,o={}){const{enabled:r=!0,closeDelay:l=0,nodeId:c}=o,d="rootStore"in n?n.rootStore:n,m=d.useState("open"),g=d.useState("floatingElement"),b=d.useState("domReferenceElement"),{dataRef:p}=d.context,v=qo(),x=uo(),S=f1(d),j=Fn(),N=tt(()=>b0(p.current.openEvent?.type,S.interactedInside)),k=tt(()=>Aw(p.current.openEvent?.type)),O=tt(()=>{Ic(S)});Ge(()=>{m||(S.pointerType=void 0,S.restTimeoutPending=!1,S.interactedInside=!1,O())},[m,S,O]),h.useEffect(()=>O,[O]),Ge(()=>{if(r&&m&&S.handleCloseOptions?.blockPointerEvents&&k()&&ht(b)&&g){const E=b,T=g,_=yt(g),R=v?.nodesRef.current.find(M=>M.id===x)?.context?.elements.floating;R&&(R.style.pointerEvents="");const H=S.pointerEventsScopeElement!==T?S.pointerEventsScopeElement:null,A=R!==T?R:null,B=S.handleCloseOptions?.getScope?.()??H??A??E.closest("[data-rootownerid]")??_.body;return d1(S,{scopeElement:B,referenceElement:E,floatingElement:T}),()=>{O()}}},[r,m,b,g,S,k,v,x,O]),h.useEffect(()=>{if(!r)return;function E(){return!!(v&&x&&Vo(v.nodesRef.current,x).length>0)}function T(M){const Q=lm(l,"close",S.pointerType),ne=()=>{d.setOpen(!1,jt(dn,M)),v?.events.emit("floating.closed",M)};Q?S.openChangeTimeout.start(Q,ne):(S.openChangeTimeout.clear(),ne())}function _(M){const Q=Dn(M);if(!kw(Q)){S.interactedInside=!1;return}S.interactedInside=Q?.closest("[aria-haspopup]")!=null}function R(){S.openChangeTimeout.clear(),j.clear(),v?.events.off("floating.closed",A),O()}function H(M){if(E()&&v){v.events.on("floating.closed",A);return}if(_c(M.relatedTarget,d.context.triggerElements))return;const Q=p.current.floatingContext?.nodeId??c,ne=M.relatedTarget;if(!(v&&Q&&ht(ne)&&Vo(v.nodesRef.current,Q,!1).some(se=>Je(se.context?.elements.floating,ne)))){if(S.handler){S.handler(M);return}O(),k()&&!N()&&T(M)}}function A(M){!v||!x||E()||j.start(0,()=>{v.events.off("floating.closed",A),d.setOpen(!1,jt(dn,M)),v.events.emit("floating.closed",M)})}const B=g;return Ts(B&&ft(B,"mouseenter",R),B&&ft(B,"mouseleave",H),B&&ft(B,"pointerdown",_,!0),()=>{v?.events.off("floating.closed",A)})},[r,g,d,p,l,c,k,N,O,S,v,x,j])}const ER={current:null};function p1(n,o={}){const{enabled:r=!0,delay:l=0,handleClose:c=null,mouseOnly:d=!1,restMs:m=0,move:g=!0,triggerElementRef:b=ER,externalTree:p,isActiveTrigger:v=!0,getHandleCloseContext:x,isClosing:S,shouldOpen:j}=o,N="rootStore"in n?n.rootStore:n,{dataRef:k,events:O}=N.context,E=qo(p),T=f1(N),_=h.useRef(!1),R=rn(c),H=rn(l),A=rn(m),B=rn(r),M=rn(j),Q=rn(S),ne=tt(()=>b0(k.current.openEvent?.type,T.interactedInside)),me=tt(()=>M.current?.()!==!1),se=tt(($,w,U)=>{const Y=N.context.triggerElements;if(Y.hasElement(w))return!$||!Je($,w);if(!ht(U))return!1;const z=U;return Y.hasMatchingElement(I=>Je(I,z))&&(!$||!Je($,z))}),X=tt(()=>{if(!T.handler)return;yt(N.select("domReferenceElement")).removeEventListener("mousemove",T.handler),T.handler=void 0}),te=tt(()=>{Ic(T)});return v&&(T.handleCloseOptions=R.current?.__options),h.useEffect(()=>X,[X]),h.useEffect(()=>{if(!r)return;function $(w){w.open?_.current=!1:(_.current=w.reason===dn,X(),T.openChangeTimeout.clear(),T.restTimeout.clear(),T.blockMouseMove=!0,T.restTimeoutPending=!1)}return O.on("openchange",$),()=>{O.off("openchange",$)}},[r,O,T,X]),h.useEffect(()=>{if(!r)return;function $(z,I=!0){const D=lm(H.current,"close",T.pointerType);D?T.openChangeTimeout.start(D,()=>{N.setOpen(!1,jt(dn,z)),E?.events.emit("floating.closed",z)}):I&&(T.openChangeTimeout.clear(),N.setOpen(!1,jt(dn,z)),E?.events.emit("floating.closed",z))}const w=b.current??(v?N.select("domReferenceElement"):null);if(!ht(w))return;function U(z){if(T.openChangeTimeout.clear(),T.blockMouseMove=!1,d&&!Bl(T.pointerType))return;const I=ty(A.current),D=lm(H.current,"open",T.pointerType),G=Dn(z),L=z.currentTarget??null,q=N.select("domReferenceElement");let Z=L;if(ht(G)&&!N.context.triggerElements.hasElement(G)){for(const Ae of N.context.triggerElements.elements())if(Je(Ae,G)){Z=Ae;break}}ht(L)&&ht(q)&&!N.context.triggerElements.hasElement(L)&&Je(L,q)&&(Z=q);const V=Z==null?!1:se(q,Z,G),be=N.select("open"),ue=Q.current?.()??N.select("transitionStatus")==="ending",he=!be&&ue&&_.current,Le=!V&&ht(Z)&&ht(q)&&Je(q,Z)&&he,qe=I>0&&!D,we=V&&(be||he)||Le,De=!be||V;if(we){me()&&N.setOpen(!0,jt(dn,z,Z));return}qe||(D?T.openChangeTimeout.start(D,()=>{De&&me()&&N.setOpen(!0,jt(dn,z,Z))}):De&&me()&&N.setOpen(!0,jt(dn,z,Z)))}function Y(z){if(ne()){te();return}X();const I=N.select("domReferenceElement"),D=yt(I);T.restTimeout.clear(),T.restTimeoutPending=!1;const G=k.current.floatingContext??x?.();if(_c(z.relatedTarget,N.context.triggerElements))return;if(R.current&&G){N.select("open")||T.openChangeTimeout.clear();const q=b.current;T.handler=R.current({...G,tree:E,x:z.clientX,y:z.clientY,onClose(){te(),X(),B.current&&!ne()&&q===N.select("domReferenceElement")&&$(z,!0)}}),D.addEventListener("mousemove",T.handler),T.handler(z);return}(T.pointerType!=="touch"||!Je(N.select("floatingElement"),z.relatedTarget))&&$(z)}return g?Ts(ft(w,"mousemove",U,{once:!0}),ft(w,"mouseenter",U),ft(w,"mouseleave",Y)):Ts(ft(w,"mouseenter",U),ft(w,"mouseleave",Y))},[X,te,k,H,N,r,R,T,v,se,ne,d,g,A,b,E,B,x,Q,me]),h.useMemo(()=>{if(!r)return;function $(w){T.pointerType=w.pointerType}return{onPointerDown:$,onPointerEnter:$,onMouseMove(w){const{nativeEvent:U}=w,Y=w.currentTarget,z=N.select("domReferenceElement"),I=N.select("open"),D=se(z,Y,w.target);if(d&&!Bl(T.pointerType))return;if(I&&D&&T.handleCloseOptions?.blockPointerEvents){const q=N.select("floatingElement");if(q){const Z=T.handleCloseOptions?.getScope?.()??Y.ownerDocument.body;d1(T,{scopeElement:Z,referenceElement:Y,floatingElement:q})}}const G=ty(A.current);if(I&&!D||G===0||!D&&T.restTimeoutPending&&w.movementX**2+w.movementY**2<2)return;T.restTimeout.clear();function L(){if(T.restTimeoutPending=!1,ne())return;const q=N.select("open");!T.blockMouseMove&&(!q||D)&&me()&&N.setOpen(!0,jt(dn,U,Y))}T.pointerType==="touch"?lo.flushSync(()=>{L()}):D&&I?L():(T.restTimeoutPending=!0,T.restTimeout.start(G,L))}}},[r,T,ne,se,d,N,A,me])}const NR="Escape";function ou(n,o,r){switch(n){case"vertical":return o;case"horizontal":return r;default:return o||r}}function mc(n,o){return ou(o,n===x0||n===qm,n===Qc||n===Zc)}function Hf(n,o,r){return ou(o,n===qm,r?n===Qc:n===Zc)||n==="Enter"||n===" "||n===""}function jR(n,o,r){return ou(o,r?n===Qc:n===Zc,n===qm)}function TR(n,o,r,l){const c=r?n===Zc:n===Qc,d=n===x0;return o==="both"||o==="horizontal"&&l?n===NR:ou(o,c,d)}function wR(n,o){const{listRef:r,activeIndex:l,onNavigate:c=()=>{},enabled:d=!0,selectedIndex:m=null,allowEscape:g=!1,loopFocus:b=!1,nested:p=!1,rtl:v=!1,virtual:x=!1,focusItemOnOpen:S="auto",focusItemOnHover:j=!0,openOnArrowKeyDown:N=!0,disabledIndices:k=void 0,orientation:O="vertical",parentOrientation:E,id:T,resetOnPointerLeave:_=!0,externalTree:R,grid:H}=o,A=H!=null,B="rootStore"in n?n.rootStore:n,M=B.useState("open"),Q=B.useState("floatingElement"),ne=B.useState("domReferenceElement"),me=B.context.dataRef,se=am(Q),X=rm(ne),te=rn(se),$=uo(),w=qo(R),U=h.useRef(S),Y=h.useRef(m??-1),z=h.useRef(null),I=h.useRef(!0),D=tt(ie=>{c(Y.current===-1?null:Y.current,ie)}),G=h.useRef(!!Q),L=h.useRef(M),q=h.useRef(!1),Z=h.useRef(!1),V=h.useRef(null),be=rn(k),ue=rn(M),he=rn(m),Le=rn(_),qe=Hl(),we=Hl(),De=tt(()=>{function ie(je){x?w?.events.emit("virtualfocus",je):V.current=Nc(je,{sync:q.current,preventScroll:!0})}const F=r.current[Y.current],pe=Z.current;F&&ie(F),(q.current?je=>je():je=>qe.request(je))(()=>{const je=r.current[Y.current]||F;if(!je)return;F||ie(je),de&&(pe||!I.current)&&je.scrollIntoView?.({block:"nearest",inline:"nearest"})})});Ge(()=>{me.current.orientation=O},[me,O]),Ge(()=>{d&&(M&&Q?(Y.current=m??-1,U.current&&m!=null&&(Z.current=!0,D())):G.current&&(Y.current=-1,D()))},[d,M,Q,m,D]),Ge(()=>{if(d){if(!M){q.current=!1;return}if(Q)if(l==null){if(q.current=!1,he.current!=null)return;if(G.current&&(Y.current=-1,De()),(!L.current||!G.current)&&U.current&&(z.current!=null||U.current===!0&&z.current==null)){let ie=0;const F=()=>{r.current[0]==null?(ie<2&&(ie?J=>we.request(J):queueMicrotask)(F),ie+=1):(Y.current=z.current==null||Hf(z.current,O,v)||p?Rf(r):ry(r),z.current=null,D())};F()}}else oy(r.current,l)||(Y.current=l,De(),Z.current=!1)}},[d,M,Q,l,he,p,r,O,v,D,De,we]),Ge(()=>{if(!d||Q||!w||x||!G.current)return;const ie=w.nodesRef.current,F=ie.find(je=>je.id===$)?.context?.elements.floating,pe=jn(yt(ne??F??null)),J=ie.some(je=>je.context&&Je(je.context.elements.floating,pe));F&&!J&&I.current&&F.focus({preventScroll:!0})},[d,Q,ne,w,$,x]),Ge(()=>{L.current=M,G.current=!!Q}),Ge(()=>{M||(z.current=null,U.current=S)},[M,S]);const Ae=l!=null,ye=tt(ie=>{if(!ue.current)return;const F=r.current.indexOf(ie.currentTarget);F!==-1&&(Y.current!==F||l!==F)&&(Y.current=F,D(ie))}),Ie=tt(()=>E??w?.nodesRef.current.find(ie=>ie.id===$)?.context?.dataRef?.current.orientation),oe=tt(()=>Rf(r,be.current)),ce=tt(ie=>{if(I.current=!1,q.current=!0,ie.which===229||!ue.current&&ie.currentTarget===te.current)return;if(p&&TR(ie.key,O,v,A)){mc(ie.key,Ie())||vs(ie),B.setOpen(!1,jt(nm,ie.nativeEvent)),Ut(ne)&&(x?w?.events.emit("virtualfocus",ne):ne.focus());return}const F=Y.current,pe=Rf(r,k),J=ry(r,k);if(X||(ie.key==="Home"&&(vs(ie),Y.current=pe,D(ie)),ie.key==="End"&&(vs(ie),Y.current=J,D(ie))),H!=null){const je=H(ie,Y.current,r,O,b,v,k,pe,J);if(je!=null&&(Y.current=je,D(ie)),O==="both")return}if(mc(ie.key,O)){if(vs(ie),M&&!x&&jn(ie.currentTarget.ownerDocument)===ie.currentTarget){Y.current=Hf(ie.key,O,v)?pe:J,D(ie);return}Hf(ie.key,O,v)?b?F>=J?g&&F!==r.current.length?Y.current=-1:(q.current=!1,Y.current=pe):Y.current=va(r.current,{startingIndex:F,disabledIndices:k}):Y.current=Math.min(J,va(r.current,{startingIndex:F,disabledIndices:k})):b?F<=pe?g&&F!==-1?Y.current=r.current.length:(q.current=!1,Y.current=J):Y.current=va(r.current,{startingIndex:F,decrement:!0,disabledIndices:k}):Y.current=Math.max(pe,va(r.current,{startingIndex:F,decrement:!0,disabledIndices:k})),oy(r.current,Y.current)&&(Y.current=-1),D(ie)}}),de=h.useMemo(()=>({onFocus(F){q.current=!0,ye(F)},onClick:({currentTarget:F})=>F.focus({preventScroll:!0}),onMouseMove(F){q.current=!0,Z.current=!1,j&&ye(F)},onPointerLeave(F){if(!ue.current||!I.current||F.pointerType==="touch")return;q.current=!0;const pe=F.relatedTarget;if(!(!j||r.current.includes(pe))&&Le.current&&(V.current?.(),V.current=null,Y.current=-1,D(F),!x)){const J=te.current,je=jn(yt(J));J&&Je(J,je)&&J.focus({preventScroll:!0})}}}),[ye,ue,te,j,r,D,Le,x]),Te=h.useMemo(()=>x&&M&&Ae&&{"aria-activedescendant":`${T}-${l}`},[x,M,Ae,T,l]),Me=h.useMemo(()=>({"aria-orientation":O==="both"?void 0:O,...X?{}:Te,onKeyDown(ie){if(ie.key==="Tab"&&ie.shiftKey&&M&&!x){const F=Dn(ie.nativeEvent);if(F&&!Je(te.current,F))return;vs(ie),B.setOpen(!1,jt(vr,ie.nativeEvent)),Ut(ne)&&ne.focus();return}ce(ie)},onPointerMove(){I.current=!0}}),[Te,ce,te,O,X,B,M,x,ne]),_e=h.useMemo(()=>{function ie(J){B.setOpen(!0,jt(nm,J.nativeEvent,J.currentTarget))}function F(J){S==="auto"&&p0(J.nativeEvent)&&(U.current=!x)}function pe(J){U.current=S,S==="auto"&&h0(J.nativeEvent)&&(U.current=!0)}return{onKeyDown(J){const je=B.select("open");I.current=!1;const Fe=J.key.startsWith("Arrow"),Ne=jR(J.key,Ie(),v),Oe=mc(J.key,O),Xe=(p?Ne:Oe)||J.key==="Enter"||J.key.trim()==="";if(x&&je)return ce(J);if(!(!je&&!N&&Fe)){if(Xe){const st=mc(J.key,Ie());z.current=p&&st?null:J.key}if(p){Ne&&(vs(J),je?(Y.current=oe(),D(J)):ie(J));return}Oe&&(he.current!=null&&(Y.current=he.current),vs(J),!je&&N?ie(J):ce(J),je&&D(J))}},onFocus(J){B.select("open")&&!x&&(Y.current=-1,D(J))},onPointerDown:pe,onPointerEnter:pe,onMouseDown:F,onClick:F}},[ce,S,oe,p,D,B,N,O,Ie,v,he,x]),it=h.useMemo(()=>({...Te,..._e}),[Te,_e]);return h.useMemo(()=>d?{reference:it,floating:Me,item:de,trigger:_e}:{},[d,it,Me,_e,de])}function CR(n,o){const{listRef:r,elementsRef:l,activeIndex:c,onMatch:d,disabledIndices:m,onTyping:g,enabled:b=!0,resetMs:p=750,selectedIndex:v=null}=o,x="rootStore"in n?n.rootStore:n,S=x.useState("open"),j=Fn(),N=h.useRef(""),k=h.useRef(v??c??-1),O=h.useRef(null),E=tt(R=>{function H(te){const $=l?.current[te];return!$||Wc($)}function A(te){return H(te)?m==null||!S0(kc,te,m):!1}function B(te,$,w=0){if(te.length===0)return-1;const U=(w%te.length+te.length)%te.length,Y=$.toLowerCase();for(let z=0;z<te.length;z+=1){const I=(U+z)%te.length;if(!(!te[I]?.toLowerCase().startsWith(Y)||!A(I)))return I}return-1}const M=r.current;if(N.current.length>0&&R.key===" "&&(vs(R),g?.(!0)),N.current.length>0&&N.current[0]!==" "&&B(M,N.current)===-1&&R.key!==" "&&g?.(!1),M==null||R.key.length!==1||R.ctrlKey||R.metaKey||R.altKey)return;S&&R.key!==" "&&(vs(R),g?.(!0));const Q=N.current==="";Q&&(k.current=v??c??-1),M.every((te,$)=>te&&A($)?te[0]?.toLowerCase()!==te[1]?.toLowerCase():!0)&&N.current===R.key&&(N.current="",k.current=O.current),N.current+=R.key,j.start(p,()=>{N.current="",k.current=O.current,g?.(!1)});const se=((Q?v??c??-1:k.current)??0)+1,X=B(M,N.current,se);X!==-1?(d?.(X),O.current=X):R.key!==" "&&(N.current="",g?.(!1))}),T=tt(R=>{const H=R.relatedTarget,A=x.select("domReferenceElement"),B=x.select("floatingElement");Je(A,H)||Je(B,H)||(j.clear(),N.current="",k.current=O.current,g?.(!1))});Ge(()=>{!S&&v!==null||(j.clear(),O.current=null,N.current!==""&&(N.current=""))},[S,v,j]),Ge(()=>{S&&N.current===""&&(k.current=v??c??-1)},[S,v,c]);const _=h.useMemo(()=>({onKeyDown:E,onBlur:T}),[E,T]);return h.useMemo(()=>b?{reference:_,floating:_}:{},[b,_])}const Oy=.1,RR=Oy*Oy,Lt=.5;function pc(n,o,r,l,c,d){return l>=o!=d>=o&&n<=(c-r)*(o-l)/(d-l)+r}function hc(n,o,r,l,c,d,m,g,b,p){let v=!1;return pc(n,o,r,l,c,d)&&(v=!v),pc(n,o,c,d,m,g)&&(v=!v),pc(n,o,m,g,b,p)&&(v=!v),pc(n,o,b,p,r,l)&&(v=!v),v}function OR(n,o,r){return n>=r.x&&n<=r.x+r.width&&o>=r.y&&o<=r.y+r.height}function gc(n,o,r,l,c,d){const m=Math.min(r,c),g=Math.max(r,c),b=Math.min(l,d),p=Math.max(l,d);return n>=m&&n<=g&&o>=b&&o<=p}function h1(n={}){const{blockPointerEvents:o=!1}=n,r=new ds,l=({x:c,y:d,placement:m,elements:g,onClose:b,nodeId:p,tree:v})=>{const x=m?.split("-")[0];let S=!1,j=null,N=null,k=typeof performance<"u"?performance.now():0;function O(T,_){const R=performance.now(),H=R-k;if(j===null||N===null||H===0)return j=T,N=_,k=R,!1;const A=T-j,B=_-N,M=A*A+B*B,Q=H*H*RR;return j=T,N=_,k=R,M<Q}function E(){r.clear(),b()}return function(_){r.clear();const R=g.domReference,H=g.floating;if(!R||!H||x==null||c==null||d==null)return;const{clientX:A,clientY:B}=_,M=Dn(_),Q=_.type==="mouseleave",ne=Je(H,M),me=Je(R,M);if(ne&&(S=!0,!Q))return;if(me&&(S=!1,!Q)){S=!0;return}if(Q&&ht(_.relatedTarget)&&Je(H,_.relatedTarget))return;function se(){return!!(v&&Vo(v.nodesRef.current,p).length>0)}function X(){se()||E()}if(se())return;const te=R.getBoundingClientRect(),$=H.getBoundingClientRect(),w=c>$.right-$.width/2,U=d>$.bottom-$.height/2,Y=$.width>te.width,z=$.height>te.height,I=(Y?te:$).left,D=(Y?te:$).right,G=(z?te:$).top,L=(z?te:$).bottom;if(x==="top"&&d>=te.bottom-1||x==="bottom"&&d<=te.top+1||x==="left"&&c>=te.right-1||x==="right"&&c<=te.left+1){X();return}let q=!1;switch(x){case"top":q=gc(A,B,I,te.top+1,D,$.bottom-1);break;case"bottom":q=gc(A,B,I,$.top+1,D,te.bottom-1);break;case"left":q=gc(A,B,$.right-1,L,te.left+1,G);break;case"right":q=gc(A,B,te.right-1,L,$.left+1,G);break}if(q)return;if(S&&!OR(A,B,te)){X();return}if(!Q&&O(A,B)){X();return}let Z=!1;switch(x){case"top":{const V=Y?Lt/2:Lt*4,be=Y||w?c+V:c-V,ue=Y?c-V:w?c+V:c-V,he=d+Lt+1,Le=w||Y?$.bottom-Lt:$.top,qe=w?Y?$.bottom-Lt:$.top:$.bottom-Lt;Z=hc(A,B,be,he,ue,he,$.left,Le,$.right,qe);break}case"bottom":{const V=Y?Lt/2:Lt*4,be=Y||w?c+V:c-V,ue=Y?c-V:w?c+V:c-V,he=d-Lt,Le=w||Y?$.top+Lt:$.bottom,qe=w?Y?$.top+Lt:$.bottom:$.top+Lt;Z=hc(A,B,be,he,ue,he,$.left,Le,$.right,qe);break}case"left":{const V=z?Lt/2:Lt*4,be=z||U?d+V:d-V,ue=z?d-V:U?d+V:d-V,he=c+Lt+1,Le=U||z?$.right-Lt:$.left,qe=U?z?$.right-Lt:$.left:$.right-Lt;Z=hc(A,B,Le,$.top,qe,$.bottom,he,be,he,ue);break}case"right":{const V=z?Lt/2:Lt*4,be=z||U?d+V:d-V,ue=z?d-V:U?d+V:d-V,he=c-Lt,Le=U||z?$.left+Lt:$.right,qe=U?z?$.left+Lt:$.right:$.left+Lt;Z=hc(A,B,he,be,he,ue,Le,$.top,qe,$.bottom);break}}Z?S||r.start(40,X):X()}};return l.__options={...n,blockPointerEvents:o},l}const kR=h.createContext(void 0);function g1(n){return h.useContext(kR)}const _R="ArrowUp",MR="ArrowDown",AR="ArrowLeft",DR="ArrowRight",zR="Home",LR="End",IR=new Set([AR,DR]),UR=new Set([_R,MR]),HR=new Set([...IR,...UR]),fp=new Set([...HR,zR,LR]);function mp(n){return n==="starting"?oC:Ht}const BR={...Gl,...Gc},YR=h.forwardRef(function(o,r){const{render:l,className:c,style:d,finalFocus:m,...g}=o,{store:b}=Tr(),{side:p,align:v}=a0(),x=g1()!=null,S=b.useState("open"),j=b.useState("transitionStatus"),N=b.useState("popupProps"),k=b.useState("mounted"),O=b.useState("instantType"),E=b.useState("activeTriggerElement"),T=b.useState("parent"),_=b.useState("lastOpenChangeReason"),R=b.useState("rootId"),H=b.useState("floatingRootContext"),A=b.useState("floatingTreeRoot"),B=b.useState("closeDelay"),M=b.useState("activeTriggerElement"),Q=b.useState("hoverEnabled"),ne=b.useState("disabled"),me=b.useState("openMethod"),se=T.type==="context-menu";$c({open:S,ref:b.context.popupRef,onComplete(){S&&b.context.onOpenChangeComplete?.(!0)}}),h.useEffect(()=>{function U(Y){b.setOpen(!1,jt(Y.reason,Y.domEvent))}return A.events.on("close",U),()=>{A.events.off("close",U)}},[A.events,b]),m1(H,{enabled:Q&&!ne&&!se&&T.type!=="menubar",closeDelay:B});const X=h.useCallback(U=>{b.set("popupElement",U)},[b]),te={transitionStatus:j,side:p,align:v,open:S,nested:T.type==="menu",instant:O},$=fn("div",o,{state:te,ref:[r,b.context.popupRef,X],stateAttributesMapping:BR,props:[N,{onKeyDown(U){x&&fp.has(U.key)&&U.stopPropagation()}},mp(j),g,{"data-rootownerid":R}]});let w=T.type===void 0||se;return(E||T.type==="menubar"&&_!==Hm)&&(w=!0),i.jsx(tp,{context:H,openInteractionType:me,modal:se,disabled:!k,returnFocus:m===void 0?w:m,initialFocus:T.type!=="menu",restoreFocus:!0,externalTree:T.type!=="menubar"?A:void 0,previousFocusableElement:M,nextFocusableElement:T.type===void 0?b.context.triggerFocusTargetRef:void 0,beforeContentFocusGuardRef:T.type===void 0?b.context.beforeContentFocusGuardRef:void 0,children:$})}),x1=h.createContext(void 0);function VR(){const n=h.useContext(x1);if(n===void 0)throw new Error(En(32));return n}const PR=h.forwardRef(function(o,r){const{keepMounted:l=!1,...c}=o,{store:d}=Tr();return d.useState("mounted")||l?i.jsx(x1.Provider,{value:l,children:i.jsx(Zm,{ref:r,...c})}):null});function pp(n){return Um(19)?n:n?"true":void 0}const GR=h.createContext(void 0);function b1(){return h.useContext(GR)?.direction??"ltr"}const qR=n=>({name:"arrow",options:n,async fn(o){const{x:r,y:l,placement:c,rects:d,platform:m,elements:g,middlewareData:b}=o,{element:p,padding:v=0,offsetParent:x="real"}=io(n,o)||{};if(p==null)return{};const S=v0(v),j={x:r,y:l},N=Km(c),k=Xm(N),O=await m.getDimensions(p),E=N==="y",T=E?"top":"left",_=E?"bottom":"right",R=E?"clientHeight":"clientWidth",H=d.reference[k]+d.reference[N]-j[N]-d.floating[k],A=j[N]-d.reference[N],B=x==="real"?await m.getOffsetParent?.(p):g.floating;let M=g.floating[R]||d.floating[k];(!M||!await m.isElement?.(B))&&(M=g.floating[R]||d.floating[k]);const Q=H/2-A/2,ne=M/2-O[k]/2-1,me=Math.min(S[T],ne),se=Math.min(S[_],ne),X=me,te=M-O[k]-se,$=M/2-O[k]/2+Q,w=y0(X,$,te),U=!b.arrow&&Go(c)!=null&&$!==w&&d.reference[k]/2-($<X?me:se)-O[k]/2<0,Y=U?$<X?$-X:$-te:0;return{[N]:j[N]+Y,data:{[N]:w,centerOffset:$-w-Y,...U&&{alignmentOffset:Y}},reset:U}}}),FR=(n,o)=>({...qR(n),options:[n,o]}),XR=eR().fn,KR={name:"hide",async fn(n){const{width:o,height:r,x:l,y:c}=n.rects.reference,d=o===0&&r===0&&l===0&&c===0;return{data:{referenceHidden:(await XR(n)).data?.referenceHidden||d}}}},Tc={sideX:"left",sideY:"top"},y1={name:"adaptiveOrigin",async fn(n){const{x:o,y:r,rects:{floating:l},elements:{floating:c},platform:d,strategy:m,placement:g}=n,b=Xt(c),p=b.getComputedStyle(c);if(!(p.transitionDuration!=="0s"&&p.transitionDuration!==""))return{x:o,y:r,data:Tc};const x=await d.getOffsetParent?.(c);let S={width:0,height:0};if(m==="fixed"&&b?.visualViewport)S={width:b.visualViewport.width,height:b.visualViewport.height};else if(x===b){const T=yt(c);S={width:T.documentElement.clientWidth,height:T.documentElement.clientHeight}}else await d.isElement?.(x)&&(S=await d.getDimensions(x));const j=Gn(g);let N=o,k=r;j==="left"&&(N=S.width-(o+l.width)),j==="top"&&(k=S.height-(r+l.height));const O=j==="left"?"right":Tc.sideX,E=j==="top"?"bottom":Tc.sideY;return{x:N,y:k,data:{sideX:O,sideY:E}}}};function v1(n,o,r){const l=n==="inline-start"||n==="inline-end";return{top:"top",right:l?r?"inline-start":"inline-end":"right",bottom:"bottom",left:l?r?"inline-end":"inline-start":"left"}[o]}function ky(n,o,r){const{rects:l,placement:c}=n;return{side:v1(o,Gn(c),r),align:Go(c)||"center",anchor:{width:l.reference.width,height:l.reference.height},positioner:{width:l.floating.width,height:l.floating.height}}}function S1(n){const{anchor:o,positionMethod:r="absolute",side:l="bottom",sideOffset:c=0,align:d="center",alignOffset:m=0,collisionBoundary:g,collisionPadding:b=5,sticky:p=!1,arrowPadding:v=5,disableAnchorTracking:x=!1,inline:S,keepMounted:j=!1,floatingRootContext:N,mounted:k,collisionAvoidance:O,shiftCrossAxis:E=!1,nodeId:T,adaptiveOrigin:_,lazyFlip:R=!1,externalTree:H}=n,[A,B]=h.useState(null);!k&&A!==null&&B(null);const M=O.side||"flip",Q=O.align||"flip",ne=O.fallbackAxisSide||"end",me=typeof o=="function"?o:void 0,se=tt(me),X=me?se:o,te=rn(o),$=rn(k),U=b1()==="rtl",Y=A||{top:"top",right:"right",bottom:"bottom",left:"left","inline-end":U?"left":"right","inline-start":U?"right":"left"}[l],z=d==="center"?Y:`${Y}-${d}`;let I=b;const D=1,G=l==="bottom"?D:0,L=l==="top"?D:0,q=l==="right"?D:0,Z=l==="left"?D:0;typeof I=="number"?I={top:I+G,right:I+Z,bottom:I+L,left:I+q}:I&&(I={top:(I.top||0)+G,right:(I.right||0)+Z,bottom:(I.bottom||0)+L,left:(I.left||0)+q});const V={boundary:g==="clipping-ancestors"?"clippingAncestors":g,padding:I},be=h.useRef(null),ue=rn(c),he=rn(m),Le=typeof c!="function"?c:0,qe=typeof m!="function"?m:0,we=[];S&&we.push(S),we.push($C(Ke=>{const Tt=ky(Ke,l,U),tn=typeof ue.current=="function"?ue.current(Tt):ue.current,Gt=typeof he.current=="function"?he.current(Tt):he.current;return{mainAxis:tn,crossAxis:Gt,alignmentAxis:Gt}},[Le,qe,U,l]));const De=Q==="none"&&M!=="shift",Ae=!De&&(p||E||M==="shift"),ye=M==="none"?null:JC({...V,padding:{top:I.top+D,right:I.right+D,bottom:I.bottom+D,left:I.left+D},mainAxis:!E&&M==="flip",crossAxis:Q==="flip"?"alignment":!1,fallbackAxisSideDirection:ne}),Ie=De?null:QC(Ke=>{const Tt=yt(Ke.elements.floating).documentElement;return{...V,rootBoundary:E?{x:0,y:0,width:Tt.clientWidth,height:Tt.clientHeight}:void 0,mainAxis:Q!=="none",crossAxis:Ae,limiter:p||E?void 0:ZC(tn=>{if(!be.current)return{};const{width:Gt,height:ee}=be.current.getBoundingClientRect(),xe=as(Gn(tn.placement)),Ce=xe==="y"?Gt:ee,$e=xe==="y"?I.left+I.right:I.top+I.bottom;return{offset:Ce/2+$e/2}})}},[V,p,E,I,Q]);M==="shift"||Q==="shift"||d==="center"?we.push(Ie,ye):we.push(ye,Ie),we.push(WC({...V,apply({elements:{floating:Ke},availableWidth:Tt,availableHeight:tn,rects:Gt}){if(!$.current)return;const ee=Ke.style;ee.setProperty("--available-width",`${Tt}px`),ee.setProperty("--available-height",`${tn}px`);const xe=Xt(Ke).devicePixelRatio||1,{x:Ce,y:$e,width:et,height:rt}=Gt.reference,nt=(Math.round((Ce+et)*xe)-Math.round(Ce*xe))/xe,Vt=(Math.round(($e+rt)*xe)-Math.round($e*xe))/xe;ee.setProperty("--anchor-width",`${nt}px`),ee.setProperty("--anchor-height",`${Vt}px`)}}),FR(Ke=>({element:be.current||yt(Ke.elements.floating).createElement("div"),padding:v,offsetParent:"floating"}),[v]),{name:"transformOrigin",fn(Ke){const{elements:Tt,middlewareData:tn,placement:Gt,rects:ee,y:xe}=Ke,Ce=Gn(Gt),$e=as(Ce),et=be.current,rt=tn.arrow?.x||0,nt=tn.arrow?.y||0,Vt=et?.clientWidth||0,Xn=et?.clientHeight||0,Kt=rt+Vt/2,mn=nt+Xn/2,fo=Math.abs(tn.shift?.y||0),Ln=ee.reference.height/2,Rs=typeof c=="function"?c(ky(Ke,l,U)):c,Kl=fo>Rs,fs={top:`${Kt}px calc(100% + ${Rs}px)`,bottom:`${Kt}px ${-Rs}px`,left:`calc(100% + ${Rs}px) ${mn}px`,right:`${-Rs}px ${mn}px`}[Ce],nn=`${Kt}px ${ee.reference.y+Ln-xe}px`;return Tt.floating.style.setProperty("--transform-origin",Ae&&$e==="y"&&Kl?nn:fs),{}}},KR,_),Ge(()=>{!k&&N&&N.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[k,N]);const oe=h.useMemo(()=>({elementResize:!x&&typeof ResizeObserver<"u",layoutShift:!x&&typeof IntersectionObserver<"u"}),[x]),{refs:ce,elements:de,x:Te,y:Me,middlewareData:_e,update:it,placement:ie,context:F,isPositioned:pe,floatingStyles:J}=vR({rootContext:N,open:j?k:void 0,placement:z,middleware:we,strategy:r,whileElementsMounted:j?void 0:(...Ke)=>Ey(...Ke,oe),nodeId:T,externalTree:H}),{sideX:je,sideY:Fe}=_e.adaptiveOrigin||Tc,Ne=pe?r:"fixed",Oe=h.useMemo(()=>{const Ke=_?{position:Ne,[je]:Te,[Fe]:Me}:{position:Ne,...J};return pe||(Ke.opacity=0),Ke},[_,Ne,je,Te,Fe,Me,J,pe]),Xe=h.useRef(null);Ge(()=>{if(!k)return;const Ke=te.current,Tt=typeof Ke=="function"?Ke():Ke,Gt=(_y(Tt)?Tt.current:Tt)||null||null;Gt!==Xe.current&&(ce.setPositionReference(Gt),Xe.current=Gt)},[k,ce,X,te]),h.useEffect(()=>{if(!k)return;const Ke=te.current;typeof Ke!="function"&&_y(Ke)&&Ke.current!==Xe.current&&(ce.setPositionReference(Ke.current),Xe.current=Ke.current)},[k,ce,X,te]),h.useEffect(()=>{if(j&&k&&de.reference&&de.floating)return Ey(de.reference,de.floating,it,oe)},[j,k,de,it,oe]);const st=Gn(ie),Et=v1(l,st,U),kt=Go(ie)||"center",xt=!!_e.hide?.referenceHidden;Ge(()=>{R&&k&&pe&&B(st)},[R,k,pe,st]);const yn=h.useMemo(()=>({position:"absolute",top:_e.arrow?.y,left:_e.arrow?.x}),[_e.arrow]),an=_e.arrow?.centerOffset!==0;return h.useMemo(()=>({positionerStyles:Oe,arrowStyles:yn,arrowRef:be,arrowUncentered:an,side:Et,align:kt,physicalSide:st,anchorHidden:xt,refs:ce,context:F,isPositioned:pe,update:it}),[Oe,yn,be,an,Et,kt,st,xt,ce,F,pe,it])}function _y(n){return n!=null&&"current"in n}function $R(n){const{children:o,elementsRef:r,labelsRef:l,onMapChange:c}=n,d=tt(c),m=h.useRef(0),g=zn(ZR).current,b=zn(QR).current,[p,v]=h.useState(0),x=h.useRef(p),S=tt((E,T)=>{b.set(E,T??null),x.current+=1,v(x.current)}),j=tt(E=>{b.delete(E),x.current+=1,v(x.current)}),N=h.useMemo(()=>{const E=new Map;return Array.from(b.keys()).filter(_=>_.isConnected).sort(JR).forEach((_,R)=>{const H=b.get(_)??{};E.set(_,{...H,index:R})}),E},[b,p]);Ge(()=>{if(typeof MutationObserver!="function"||N.size===0)return;const E=new MutationObserver(T=>{const _=new Set,R=H=>_.has(H)?_.delete(H):_.add(H);T.forEach(H=>{H.removedNodes.forEach(R),H.addedNodes.forEach(R)}),_.size===0&&(x.current+=1,v(x.current))});return N.forEach((T,_)=>{_.parentElement&&E.observe(_.parentElement,{childList:!0})}),()=>{E.disconnect()}},[N]),Ge(()=>{x.current===p&&(r.current.length!==N.size&&(r.current.length=N.size),l&&l.current.length!==N.size&&(l.current.length=N.size),m.current=N.size),d(N)},[d,N,r,l,p]),Ge(()=>()=>{r.current=[]},[r]),Ge(()=>()=>{l&&(l.current=[])},[l]);const k=tt(E=>(g.add(E),()=>{g.delete(E)}));Ge(()=>{g.forEach(E=>E(N))},[g,N]);const O=h.useMemo(()=>({register:S,unregister:j,subscribeMapChange:k,elementsRef:r,labelsRef:l,nextIndexRef:m}),[S,j,k,r,l,m]);return i.jsx(d0.Provider,{value:O,children:o})}function QR(){return new Map}function ZR(){return new Set}function JR(n,o){const r=n.compareDocumentPosition(o);return r&Node.DOCUMENT_POSITION_FOLLOWING||r&Node.DOCUMENT_POSITION_CONTAINED_BY?-1:r&Node.DOCUMENT_POSITION_PRECEDING||r&Node.DOCUMENT_POSITION_CONTAINS?1:0}const hp=h.forwardRef(function(o,r){const{cutout:l,...c}=o;let d;if(l){const m=l.getBoundingClientRect();d=`polygon(0% 0%,100% 0%,100% 100%,0% 100%,0% 0%,${m.left}px ${m.top}px,${m.left}px ${m.bottom}px,${m.right}px ${m.bottom}px,${m.right}px ${m.top}px,${m.left}px ${m.top}px)`}return i.jsx("div",{ref:r,role:"presentation","data-base-ui-inert":"",...c,style:{position:"fixed",inset:0,userSelect:"none",WebkitUserSelect:"none",clipPath:d}})});function E1(n,o,{styles:r,transitionStatus:l,props:c,refs:d,hidden:m,inert:g=!1}){const b={...r};return g&&(b.pointerEvents="none"),fn("div",n,{state:o,ref:d,props:[{role:"presentation",hidden:m,style:b},mp(l),c],stateAttributesMapping:Gl})}let My={},Ay={},Dy="";function WR(n){if(typeof document>"u")return!1;const o=yt(n);return Xt(o).innerWidth-o.documentElement.clientWidth>0}function eO(n){if(!(typeof CSS<"u"&&CSS.supports&&CSS.supports("scrollbar-gutter","stable"))||typeof document>"u")return!1;const r=yt(n),l=r.documentElement,c=r.body,d=jr(l)?l:c,m=d.style.overflowY,g=l.style.scrollbarGutter;l.style.scrollbarGutter="stable",d.style.overflowY="scroll";const b=d.offsetWidth;d.style.overflowY="hidden";const p=d.offsetWidth;return d.style.overflowY=m,l.style.scrollbarGutter=g,b===p}function tO(n){const o=yt(n),r=o.documentElement,l=o.body,c=jr(r)?r:l,d={overflowY:c.style.overflowY,overflowX:c.style.overflowX};return Object.assign(c.style,{overflowY:"hidden",overflowX:"hidden"}),()=>{Object.assign(c.style,d)}}function nO(n){const o=yt(n),r=o.documentElement,l=o.body,c=Xt(r);let d=0,m=0,g=!1;const b=Ss.create();if(wr&&(c.visualViewport?.scale??1)!==1)return()=>{};function p(){const j=c.getComputedStyle(r),N=c.getComputedStyle(l),E=(j.scrollbarGutter||"").includes("both-edges")?"stable both-edges":"stable";d=r.scrollTop,m=r.scrollLeft,My={scrollbarGutter:r.style.scrollbarGutter,overflowY:r.style.overflowY,overflowX:r.style.overflowX},Dy=r.style.scrollBehavior,Ay={position:l.style.position,height:l.style.height,width:l.style.width,boxSizing:l.style.boxSizing,overflowY:l.style.overflowY,overflowX:l.style.overflowX,scrollBehavior:l.style.scrollBehavior};const T=r.scrollHeight>r.clientHeight,_=r.scrollWidth>r.clientWidth,R=j.overflowY==="scroll"||N.overflowY==="scroll",H=j.overflowX==="scroll"||N.overflowX==="scroll",A=Math.max(0,c.innerWidth-l.clientWidth),B=Math.max(0,c.innerHeight-l.clientHeight),M=parseFloat(N.marginTop)+parseFloat(N.marginBottom),Q=parseFloat(N.marginLeft)+parseFloat(N.marginRight),ne=jr(r)?r:l;if(g=eO(n),g){r.style.scrollbarGutter=E,ne.style.overflowY="hidden",ne.style.overflowX="hidden";return}Object.assign(r.style,{scrollbarGutter:E,overflowY:"hidden",overflowX:"hidden"}),(T||R)&&(r.style.overflowY="scroll"),(_||H)&&(r.style.overflowX="scroll"),Object.assign(l.style,{position:"relative",height:M||B?`calc(100dvh - ${M+B}px)`:"100dvh",width:Q||A?`calc(100vw - ${Q+A}px)`:"100vw",boxSizing:"border-box",overflow:"hidden",scrollBehavior:"unset"}),l.scrollTop=d,l.scrollLeft=m,r.setAttribute("data-base-ui-scroll-locked",""),r.style.scrollBehavior="unset"}function v(){Object.assign(r.style,My),Object.assign(l.style,Ay),g||(r.scrollTop=d,r.scrollLeft=m,r.removeAttribute("data-base-ui-scroll-locked"),r.style.scrollBehavior=Dy)}function x(){v(),b.request(p)}p();const S=ft(c,"resize",x);return()=>{b.cancel(),v(),typeof c.removeEventListener=="function"&&S()}}class sO{lockCount=0;restore=null;timeoutLock=ds.create();timeoutUnlock=ds.create();acquire(o){return this.lockCount+=1,this.lockCount===1&&this.restore===null&&this.timeoutLock.start(0,()=>this.lock(o)),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(o){if(this.lockCount===0||this.restore!==null)return;const l=yt(o).documentElement,c=Xt(l).getComputedStyle(l).overflowY;if(c==="hidden"||c==="clip"){this.restore=un;return}const d=Kc||!WR(o);this.restore=d?tO(o):nO(o)}}const oO=new sO;function N1(n=!0,o=null){Ge(()=>{if(n)return oO.acquire(o)},[n,o])}const rO=20;function j1(n,o,r,l){const[c,d]=h.useState(!1);Ge(()=>{if(!n||!o||r==null){d(!1);return}const m=yt(r).documentElement.clientWidth,g=r.offsetWidth;d(m>0&&g>0&&g>=m-rO)},[n,o,r]),N1(n&&(!o||c),l)}const aO=h.forwardRef(function(o,r){const{anchor:l,positionMethod:c="absolute",className:d,render:m,side:g,align:b,sideOffset:p=0,alignOffset:v=0,collisionBoundary:x="clipping-ancestors",collisionPadding:S=5,arrowPadding:j=5,sticky:N=!1,disableAnchorTracking:k=!1,collisionAvoidance:O=rC,style:E,...T}=o,{store:_}=Tr(),R=VR(),H=qc(!0),A=_.useState("parent"),B=_.useState("floatingRootContext"),M=_.useState("floatingTreeRoot"),Q=_.useState("mounted"),ne=_.useState("open"),me=_.useState("modal"),se=_.useState("openMethod"),X=_.useState("activeTriggerElement"),te=_.useState("transitionStatus"),$=_.useState("positionerElement"),w=_.useState("instantType"),U=_.useState("hasViewport"),Y=_.useState("lastOpenChangeReason"),z=_.useState("floatingNodeId"),I=_.useState("floatingParentNodeId"),D=B.useState("domReferenceElement"),G=h.useRef(null),L=Gm($,!1,!1);let q=l,Z=p,V=v,be=b,ue=O;A.type==="context-menu"&&(q=l??A.context?.anchor,be=be??"start",!g&&be!=="center"&&(V=o.alignOffset??2,Z=o.sideOffset??-5));let he=g,Le=be;A.type==="menu"?(he=he??"inline-end",Le=Le??"start",ue=o.collisionAvoidance??z0):A.type==="menubar"&&(he=he??(A.context.orientation==="vertical"?"inline-end":"bottom"),Le=Le??"start");const qe=A.type==="context-menu",we=S1({anchor:q,floatingRootContext:B,positionMethod:H?"fixed":c,mounted:Q,side:he,sideOffset:Z,align:Le,alignOffset:V,arrowPadding:qe?0:j,collisionBoundary:x,collisionPadding:S,sticky:N,nodeId:z,keepMounted:R,disableAnchorTracking:k,collisionAvoidance:ue,shiftCrossAxis:qe&&!("side"in ue&&ue.side==="flip"),externalTree:M,adaptiveOrigin:U?y1:void 0});h.useEffect(()=>{function Te(Me){Me.open&&(Me.parentNodeId===z&&_.set("hoverEnabled",!1),Me.nodeId!==z&&Me.parentNodeId===_.select("floatingParentNodeId")&&_.setOpen(!1,jt(kl)))}return M.events.on("menuopenchange",Te),()=>{M.events.off("menuopenchange",Te)}},[_,M.events,z]),h.useEffect(()=>{if(_.select("floatingParentNodeId")==null)return;function Te(Me){if(Me.open||Me.nodeId!==_.select("floatingParentNodeId"))return;const _e=Me.reason??kl;_.setOpen(!1,jt(_e))}return M.events.on("menuopenchange",Te),()=>{M.events.off("menuopenchange",Te)}},[M.events,_]);const De=Fn();h.useEffect(()=>{ne||De.clear()},[ne,De]),h.useEffect(()=>{function Te(Me){if(!(!ne||Me.nodeId!==_.select("floatingParentNodeId")))if(Me.target&&X&&X!==Me.target){const _e=_.select("closeDelay");_e>0?De.isStarted()||De.start(_e,()=>{_.setOpen(!1,jt(kl))}):_.setOpen(!1,jt(kl))}else De.clear()}return M.events.on("itemhover",Te),()=>{M.events.off("itemhover",Te)}},[M.events,ne,X,_,De]),h.useEffect(()=>{const Te={open:ne,nodeId:z,parentNodeId:I,reason:_.select("lastOpenChangeReason")};M.events.emit("menuopenchange",Te)},[M.events,ne,_,z,I]),Ge(()=>{const Te=D,Me=G.current;if(Te&&(G.current=Te),Me&&Te&&Te!==Me){_.set("instantType",void 0);const _e=new AbortController;return L(()=>{_.set("instantType","trigger-change")},_e.signal),()=>{_e.abort()}}},[D,L,_]);const Ae={open:ne,side:we.side,align:we.align,anchorHidden:we.anchorHidden,nested:A.type==="menu",instant:w},ye=A.type==="menubar"&&A.context.modal;j1(ne&&(ye||me&&Y!==dn),se==="touch",$,X);const oe=E1(o,Ae,{styles:we.positionerStyles,transitionStatus:te,props:T,refs:[r,_.useStateSetter("positionerElement")],hidden:!Q,inert:!ne}),ce=Q&&A.type!=="menu"&&(A.type!=="menubar"&&me&&Y!==dn||A.type==="menubar"&&A.context.modal);let de=null;return A.type==="menubar"?de=A.context.contentElement:A.type===void 0&&(de=X),i.jsxs(r0.Provider,{value:we,children:[ce&&i.jsx(hp,{ref:A.type==="context-menu"||A.type==="nested-context-menu"?A.context.internalBackdropRef:null,inert:pp(!ne),cutout:de}),i.jsx(Y0,{id:z,children:i.jsx($R,{elementsRef:_.context.itemDomElements,labelsRef:_.context.itemLabels,children:oe})})]})}),lO=h.createContext(null);function T1(n){return h.useContext(lO)}function iO(n){const o=h.useRef(""),r=h.useCallback(c=>{c.defaultPrevented||(o.current=c.pointerType,n(c,c.pointerType))},[n]);return{onClick:h.useCallback(c=>{if(c.detail===0){n(c,"keyboard");return}"pointerType"in c?n(c,c.pointerType):n(c,o.current),o.current=""},[n]),onPointerDown:r}}function cO(n,o){const r=h.useRef(n),l=tt(o);Ge(()=>{r.current!==n&&l(r.current)},[n,l]),Ge(()=>{r.current=n},[n])}function w1(n,o){const r=tt((d,m)=>{(typeof n=="function"?n():n)||o(m||(Kc?"touch":""))}),{onClick:l,onPointerDown:c}=iO(r);return h.useMemo(()=>({onClick:l,onPointerDown:c}),[l,c])}function uO(n){const[o,r]=h.useState(null),l=w1(n,r);return cO(n,c=>{c&&!n&&r(null)}),h.useMemo(()=>({openMethod:o,triggerProps:l}),[o,l])}const dO={...up,disabled:Ye(n=>n.parent.type==="menubar"&&n.parent.context.disabled||n.disabled),modal:Ye(n=>(n.parent.type===void 0||n.parent.type==="context-menu")&&(n.modal??!0)),openMethod:Ye(n=>n.openMethod),allowMouseEnter:Ye(n=>n.allowMouseEnter),highlightItemOnHover:Ye(n=>n.highlightItemOnHover),stickIfOpen:Ye(n=>n.stickIfOpen),parent:Ye(n=>n.parent),rootId:Ye(n=>n.parent.type==="menu"?n.parent.store.select("rootId"):n.parent.type!==void 0?n.parent.context.rootId:n.rootId),activeIndex:Ye(n=>n.activeIndex),isActive:Ye((n,o)=>n.activeIndex===o),hoverEnabled:Ye(n=>n.hoverEnabled),instantType:Ye(n=>n.instantType),lastOpenChangeReason:Ye(n=>n.openChangeReason),floatingTreeRoot:Ye(n=>n.parent.type==="menu"?n.parent.store.select("floatingTreeRoot"):n.floatingTreeRoot),floatingNodeId:Ye(n=>n.floatingNodeId),floatingParentNodeId:Ye(n=>n.floatingParentNodeId),itemProps:Ye(n=>n.itemProps),closeDelay:Ye(n=>n.closeDelay),hasViewport:Ye(n=>n.hasViewport),keyboardEventRelay:Ye(n=>{if(n.keyboardEventRelay)return n.keyboardEventRelay;if(n.parent.type==="menu")return n.parent.store.select("keyboardEventRelay")})};class gp extends tu{constructor(o){super({...fO(),...o},{positionerRef:h.createRef(),popupRef:h.createRef(),typingRef:{current:!1},itemDomElements:{current:[]},itemLabels:{current:[]},allowMouseUpTriggerRef:{current:!1},triggerFocusTargetRef:h.createRef(),beforeContentFocusGuardRef:h.createRef(),onOpenChangeComplete:void 0,triggerElements:new Fl},dO),this.unsubscribeParentListener=this.observe("parent",r=>{if(this.unsubscribeParentListener?.(),r.type==="menu"){let l=r.store.select("rootId"),c=r.store.select("floatingTreeRoot"),d=r.store.select("keyboardEventRelay");this.unsubscribeParentListener=r.store.subscribe(()=>{const m=r.store.select("rootId"),g=r.store.select("floatingTreeRoot"),b=r.store.select("keyboardEventRelay");l===m&&c===g&&d===b||(l=m,c=g,d=b,this.notifyAll())}),this.context.allowMouseUpTriggerRef=r.store.context.allowMouseUpTriggerRef;return}r.type!==void 0&&(this.context.allowMouseUpTriggerRef=r.context.allowMouseUpTriggerRef),this.unsubscribeParentListener=null})}setOpen(o,r){this.state.floatingRootContext.context.events.emit("setOpen",{open:o,eventDetails:r})}static useStore(o,r){const l=zn(()=>new gp(r)).current;return o??l}unsubscribeParentListener=null}function fO(){return{...ip(),disabled:!1,modal:!0,openMethod:null,allowMouseEnter:!1,highlightItemOnHover:!0,stickIfOpen:!0,parent:{type:void 0},rootId:void 0,activeIndex:null,hoverEnabled:!0,instantType:void 0,openChangeReason:null,floatingTreeRoot:new Jm,floatingNodeId:void 0,floatingParentNodeId:null,itemProps:Ht,keyboardEventRelay:void 0,closeDelay:0,hasViewport:!1}}const mO=h.createContext(void 0);function pO(){return h.useContext(mO)}const hO=e1(function(o){const{children:r,open:l,onOpenChange:c,onOpenChangeComplete:d,defaultOpen:m=!1,disabled:g=!1,modal:b,loopFocus:p=!0,orientation:v="vertical",actionsRef:x,closeParentOnEsc:S=!1,handle:j,triggerId:N,defaultTriggerId:k=null,highlightItemOnHover:O=!0}=o,E=qc(!0),T=Tr(!0),_=T1(!0),R=pO(),H=h.useMemo(()=>R&&T?{type:"menu",store:T.store}:_?{type:"menubar",context:_}:E&&!T?{type:"context-menu",context:E}:{type:void 0},[E,T,_,R]),A=gp.useStore(j?.store,{open:m,openProp:l,activeTriggerId:k,triggerIdProp:N,parent:H});a1(A,l,m,k),A.useControlledProp("openProp",l),A.useControlledProp("triggerIdProp",N),A.useContextCallback("onOpenChangeComplete",d);const B=Sr(),M=Sr(),Q=A.useState("floatingTreeRoot"),ne=Wm(Q),me=uo(),se=A.useState("open"),X=A.useState("activeTriggerElement"),te=A.useState("positionerElement"),$=A.useState("hoverEnabled"),w=A.useState("disabled"),U=A.useState("lastOpenChangeReason"),Y=A.useState("parent"),z=A.useState("activeIndex"),I=A.useState("payload"),D=A.useState("floatingParentNodeId"),G=h.useRef(null),L=h.useRef(Y.type!=="context-menu"),q=Fn(),Z=h.useRef(!0),V=Fn(),be=D!=null,{openMethod:ue,triggerProps:he}=uO(se);A.useSyncedValues({disabled:g,highlightItemOnHover:O,modal:Y.type===void 0?b:void 0,openMethod:ue,rootId:B}),rp(A);const{forceUnmount:Le}=ap(se,A,()=>{A.update({allowMouseEnter:!1,stickIfOpen:!0})});Ge(()=>{E&&!T?A.update({parent:{type:"context-menu",context:E},floatingNodeId:ne,floatingParentNodeId:me}):T&&A.update({floatingNodeId:ne,floatingParentNodeId:me})},[E,T,ne,me,A]),h.useEffect(()=>{if(se||(G.current=null),Y.type==="context-menu"){if(!se){q.clear(),L.current=!1;return}q.start(500,()=>{L.current=!0})}},[q,se,Y.type]),Ge(()=>{!se&&!$&&A.set("hoverEnabled",!0)},[se,$,A]);const qe=tt((je,Fe)=>{const Ne=Fe.reason;if(se===je&&Fe.trigger===X&&U===Ne)return;const Oe=r1(Fe);if(!je&&Fe.trigger==null&&(Fe.trigger=X??void 0),c?.(je,Fe),Fe.isCanceled)return;A.state.floatingRootContext.dispatchOpenChange(je,Fe);const Xe=Fe.event;if(je===!1&&Xe?.type==="click"&&Xe.pointerType==="touch"&&!Z.current)return;je&&Ne===Ml?(Z.current=!1,V.start(300,()=>{Z.current=!0})):(Z.current=!0,V.clear());const st=(Ne===yr||Ne===c0)&&Xe.detail===0&&Xe?.isTrusted,Et=!je&&(Ne===Fc||Ne==null),kt={open:je,openChangeReason:Ne};G.current=Fe.event??null,op(kt,je,Fe.trigger,Oe()),A.update(kt),Y.type==="menubar"&&(Ne===Ml||Ne===vr||Ne===dn||Ne===nm||Ne===kl)?A.set("instantType","group"):st||Et?A.set("instantType",st?"click":"dismiss"):A.set("instantType",void 0)}),we=n1({popupStore:A,floatingId:M,nested:me!=null,onOpenChange:qe}),De=we.context.events;h.useEffect(()=>{const je=({open:Fe,eventDetails:Ne})=>qe(Fe,Ne);return De.on("setOpen",je),()=>{De?.off("setOpen",je)}},[De,qe]);const Ae=h.useCallback(()=>{A.setOpen(!1,jt(Bm))},[A]);h.useImperativeHandle(x,()=>({unmount:Le,close:Ae}),[Le,Ae]);let ye;Y.type==="context-menu"&&(ye=Y.context),h.useImperativeHandle(ye?.positionerRef,()=>te,[te]),h.useImperativeHandle(ye?.actionsRef,()=>({setOpen:qe}),[qe]);const Ie=np(we,{enabled:!w,bubbles:{escapeKey:S&&Y.type==="menu"},outsidePress(){return Y.type!=="context-menu"||G.current?.type==="contextmenu"?!0:L.current},externalTree:be?Q:void 0}),oe=b1(),ce=h.useCallback(je=>{A.select("activeIndex")!==je&&A.set("activeIndex",je)},[A]),de=wR(we,{enabled:!w,listRef:A.context.itemDomElements,activeIndex:z,nested:Y.type!==void 0,loopFocus:p,orientation:v,parentOrientation:Y.type==="menubar"?Y.context.orientation:void 0,rtl:oe==="rtl",disabledIndices:kc,onNavigate:ce,openOnArrowKeyDown:Y.type!=="context-menu",externalTree:be?Q:void 0,focusItemOnHover:O}),Te=h.useCallback(je=>{A.context.typingRef.current=je},[A]),Me=CR(we,{enabled:!w,listRef:A.context.itemLabels,elementsRef:A.context.itemDomElements,activeIndex:z,resetMs:sC,onMatch:je=>{se&&je!==z&&A.set("activeIndex",je)},onTyping:Te}),_e=h.useMemo(()=>{const je=to(Me.reference,de.reference,Ie.reference,{onMouseMove(){A.set("allowMouseEnter",!0)}},he);return je["aria-haspopup"]="menu",je["aria-expanded"]=se,je},[A,Me.reference,de.reference,Ie.reference,he,se]),it=h.useMemo(()=>{const je=to(de.trigger,Ie.trigger,he);return je["aria-haspopup"]="menu",je["aria-expanded"]=!1,je},[de.trigger,Ie.trigger,he]),ie=h.useMemo(()=>to(su,{id:M,role:"menu","aria-labelledby":X?.id,onMouseMove(){A.set("allowMouseEnter",!0),Y.type==="menu"&&A.set("hoverEnabled",!1)},onClick(){A.select("hoverEnabled")&&A.set("hoverEnabled",!1)},onKeyDown(je){const Fe=A.select("keyboardEventRelay");Fe&&!je.isPropagationStopped()&&Fe(je)}},Me.floating,de.floating,Ie.floating),[X,M,Y.type,A,Me.floating,de.floating,Ie.floating]),F=de.item??Ht;lp(A,{floatingRootContext:we,activeTriggerProps:_e,inactiveTriggerProps:it,popupProps:ie,itemProps:F});const pe=h.useMemo(()=>({store:A,parent:H}),[A,H]),J=i.jsx(l0.Provider,{value:pe,children:typeof r=="function"?r({payload:I}):r});return Y.type===void 0||Y.type==="context-menu"?i.jsx(V0,{externalTree:Q,children:J}):J});function gO(n){const o=n.getBoundingClientRect(),r=Xt(n);if(Vm)return o;const l=r.getComputedStyle(n,"::before"),c=r.getComputedStyle(n,"::after");if(!(l.content!=="none"||c.content!=="none"))return o;const m=parseFloat(l.width)||0,g=parseFloat(l.height)||0,b=parseFloat(c.width)||0,p=parseFloat(c.height)||0,v=Math.max(o.width,m,b),x=Math.max(o.height,g,p),S=v-o.width,j=x-o.height;return{left:o.left-S/2,right:o.right+S/2,top:o.top-j/2,bottom:o.bottom+j/2}}function xO(n={}){const{highlightItemOnHover:o,highlightedIndex:r,onHighlightedIndexChange:l}=Im(),{ref:c,index:d}=f0(n),m=r===d,g=h.useRef(null),b=wa(c,g);return{compositeProps:{tabIndex:m?0:-1,onFocus(){l(d)},onMouseMove(){const v=g.current;if(!o||!v)return;const x=v.hasAttribute("disabled")||v.ariaDisabled==="true";!m&&!x&&v.focus()}},compositeRef:b,index:d}}function bO(n){const{render:o,className:r,style:l,state:c=Ht,props:d=kc,refs:m=kc,metadata:g,stateAttributesMapping:b,tag:p="div",...v}=n,{compositeProps:x,compositeRef:S}=xO({metadata:g});return fn(p,n,{state:c,ref:[...m,S],props:[x,...d,v],stateAttributesMapping:b})}function C1(n){if(Ut(n)&&n.hasAttribute("data-rootownerid"))return n.getAttribute("data-rootownerid")??void 0;if(!eo(n))return C1(ao(n))}function R1(n,o){const r=h.useRef(null);function l(d){lo.flushSync(()=>{n.setOpen(!1,jt(vr,d.nativeEvent,d.currentTarget))}),Ww(r.current)?.focus()}function c(d){const m=n.select("positionerElement");if(m&&Sa(d,m))n.context.beforeContentFocusGuardRef.current?.focus();else{lo.flushSync(()=>{n.setOpen(!1,jt(vr,d.nativeEvent,d.currentTarget))});let g=Jw(n.context.triggerFocusTargetRef.current||o.current);for(;g!==null&&Je(m,g);){const b=g;if(g=Qm(g),g===b)break}g?.focus()}}return{preFocusGuardRef:r,handlePreFocusGuardFocus:l,handleFocusTargetFocus:c}}function yO(n){const{enabled:o=!0,mouseDownAction:r,open:l}=n,c=h.useRef(!1);return h.useMemo(()=>o?{onMouseDown:d=>{(r==="open"&&!l||r==="close"&&l)&&(c.current=!0,yt(d.currentTarget).addEventListener("click",()=>{c.current=!1},{once:!0}))},onClick:d=>{c.current&&(c.current=!1,d.preventBaseUIHandler())}}:Ht,[o,r,l])}const xc=2,vO=lR(function(o,r){const{render:l,className:c,style:d,disabled:m=!1,nativeButton:g=!0,id:b,openOnHover:p,delay:v=100,closeDelay:x=0,handle:S,payload:j,...N}=o,k=Tr(!0),O=S?.store??k?.store;if(!O)throw new Error(En(85));const E=Cr(b),T=O.useState("isTriggerActive",E),_=O.useState("floatingRootContext"),R=O.useState("isOpenedByTrigger",E),H=O.useState("triggerPopupId",E),A=h.useRef(null),B=EO(),M=Im(!0),Q=qo(),ne=h.useMemo(()=>Q??new Jm,[Q]),me=Wm(ne),se=uo(),{registerTrigger:X,isMountedByThisTrigger:te}=l1(E,A,O,{payload:j,closeDelay:x,parent:B,floatingTreeRoot:ne,floatingNodeId:me,floatingParentNodeId:se,keyboardEventRelay:M?.relayKeyboardEvent}),$=B.type==="menubar",w=O.useState("disabled"),U=m||w||$&&B.context.disabled,{getButtonProps:Y,buttonRef:z}=Pl({disabled:U,native:g});h.useEffect(()=>{!R&&B.type===void 0&&(O.context.allowMouseUpTriggerRef.current=!1)},[O,R,B.type]);const I=h.useRef(null),D=Fn(),G=tt(de=>{if(!I.current)return;D.clear(),O.context.allowMouseUpTriggerRef.current=!1;const Te=de.target;if(Je(I.current,Te)||Je(O.select("positionerElement"),Te)||Te===I.current||Te!=null&&C1(Te)===O.select("rootId"))return;const Me=gO(I.current);de.clientX>=Me.left-xc&&de.clientX<=Me.right+xc&&de.clientY>=Me.top-xc&&de.clientY<=Me.bottom+xc||ne.events.emit("close",{domEvent:de,reason:rw})});h.useEffect(()=>{R&&O.select("lastOpenChangeReason")===dn&&yt(I.current).addEventListener("mouseup",G,{once:!0})},[R,G,O]);const L=$&&B.context.hasSubmenuOpen,Z=p1(_,{enabled:(p??L)&&!U&&B.type!=="context-menu"&&(!$||L&&!te),handleClose:h1({blockPointerEvents:!$}),mouseOnly:!0,move:!1,restMs:B.type===void 0?v:void 0,delay:{close:x},triggerElementRef:A,externalTree:ne,isActiveTrigger:T,isClosing:()=>O.select("transitionStatus")==="ending"}),V=SO(R,O.select("lastOpenChangeReason")),be=P0(_,{enabled:!U&&B.type!=="context-menu",event:R&&$?"click":"mousedown",toggle:!0,ignoreMouse:!1,stickIfOpen:B.type===void 0?V:!1}),ue=SR(_,{enabled:!U&&L}),he=yO({open:R,enabled:$,mouseDownAction:"open"}),Le=h.useMemo(()=>to(ue.reference,be.reference),[ue.reference,be.reference]),qe=O.useState("triggerProps",te),{preFocusGuardRef:we,handlePreFocusGuardFocus:De,handleFocusTargetFocus:Ae}=R1(O,A),ye={disabled:U,open:R},Ie=[I,r,z,X,A],oe=[Le,Z??Ht,qe,{"aria-haspopup":"menu","aria-controls":H,id:E,onMouseDown:de=>{if(O.select("open"))return;D.start(200,()=>{O.context.allowMouseUpTriggerRef.current=!0}),yt(de.currentTarget).addEventListener("mouseup",G,{once:!0})}},$?{role:"menuitem"}:{},he,N,Y],ce=fn("button",o,{enabled:!$,stateAttributesMapping:tm,state:ye,ref:Ie,props:oe});return $?i.jsx(bO,{tag:"button",render:l,className:c,style:d,state:ye,refs:Ie,props:oe,stateAttributesMapping:tm}):R?i.jsxs(h.Fragment,{children:[i.jsx(Yo,{ref:we,onFocus:De},`${E}-pre-focus-guard`),i.jsx(h.Fragment,{children:ce},E),i.jsx(Yo,{ref:O.context.triggerFocusTargetRef,onFocus:Ae},`${E}-post-focus-guard`)]}):i.jsx(h.Fragment,{children:ce},E)});function SO(n,o){const r=Fn(),[l,c]=h.useState(!1);return Ge(()=>{n&&o==="trigger-hover"?(c(!0),r.start(A0,()=>{c(!1)})):n||(r.clear(),c(!1))},[n,o,r]),l}function EO(){const n=qc(!0),o=Tr(!0),r=T1();return h.useMemo(()=>r?{type:"menubar",context:r}:n&&!o?{type:"context-menu",context:n}:{type:void 0},[n,o,r])}const NO=h.forwardRef(function(o,r){const{className:l,render:c,orientation:d="horizontal",style:m,...g}=o;return fn("div",o,{state:{orientation:d},ref:r,props:[{role:"separator","aria-orientation":d},g]})});function xp({...n}){return i.jsx(hO,{"data-slot":"dropdown-menu",...n})}function bp({...n}){return i.jsx(vO,{"data-slot":"dropdown-menu-trigger",...n})}function yp({align:n="start",alignOffset:o=0,side:r="bottom",sideOffset:l=4,className:c,...d}){return i.jsx(PR,{children:i.jsx(aO,{className:"isolate z-50 outline-none",align:n,alignOffset:o,side:r,sideOffset:l,children:i.jsx(YR,{"data-slot":"dropdown-menu-content",className:We("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",c),...d})})})}function jO({...n}){return i.jsx(jw,{"data-slot":"dropdown-menu-group",...n})}function TO({className:n,inset:o,...r}){return i.jsx(Tw,{"data-slot":"dropdown-menu-label","data-inset":o,className:We("px-1.5 py-1 text-xs font-medium text-muted-foreground data-inset:pl-7",n),...r})}function Es({className:n,inset:o,variant:r="default",...l}){return i.jsx(ww,{"data-slot":"dropdown-menu-item","data-inset":o,"data-variant":r,className:We("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",n),...l})}function vp({className:n,...o}){return i.jsx(NO,{"data-slot":"dropdown-menu-separator",className:We("-mx-1 my-1 h-px bg-border",n),...o})}const wO={propose_create_entity:"新建实体",propose_update_entity:"更新实体",propose_add_relation:"新增关系",propose_outline_node:"新建大纲节点"},CO={character:"角色",setting:"设定",location:"地点",hook:"伏笔"};function RO(n){const o=n.focus_entity_id??n.focus_node_id??"",r=n.focus_entity_type?CO[n.focus_entity_type]??n.focus_entity_type:n.focus_node_id?"大纲节点":"";return r?`${r} ${o}`:o||"当前内容"}const OO=n=>typeof n=="object"&&n!==null?n:{};function kO({disabled:n,onClose:o}){const r=Nt(b=>b.sessions),l=Nt(b=>b.currentSessionId),c=Nt(b=>b.setCurrentSession),d=Nt(b=>b.newSession),m=r?.find(b=>b.id===l)??null,g=m?m.lastMessage||"(空会话)":"新会话";return i.jsxs("div",{className:"flex h-12 shrink-0 items-center gap-1 border-b border-border px-2.5",children:[i.jsx(zl,{className:"size-4 shrink-0 text-muted-foreground"}),i.jsxs(xp,{children:[i.jsx(bp,{render:i.jsxs(Se,{variant:"ghost",size:"sm",disabled:n,className:"max-w-44 justify-start gap-1 px-1.5",children:[i.jsx("span",{className:"truncate text-sm font-medium",title:g,children:g}),i.jsx(FN,{className:"size-3.5 shrink-0 text-muted-foreground"})]})}),i.jsxs(yp,{align:"start",className:"w-64",children:[i.jsx(jO,{children:i.jsx(TO,{children:"会话(本项目)"})}),i.jsx(vp,{}),r&&r.length===0&&i.jsx("div",{className:"px-2 py-2 text-xs text-muted-foreground",children:"暂无历史会话"}),r?.map(b=>i.jsx(Es,{onClick:()=>c(b.id),className:We(b.id===l&&"bg-accent text-accent-foreground"),children:i.jsxs("span",{className:"flex min-w-0 flex-1 flex-col",children:[i.jsx("span",{className:"truncate text-sm",children:b.lastMessage||"(空会话)"}),i.jsxs("span",{className:"text-xs text-muted-foreground",children:[b.messageCount," 条 · ",xr(b.updatedAt)]})]})},b.id))]})]}),i.jsx(Se,{variant:"ghost",size:"icon-sm",className:"shrink-0 text-muted-foreground",disabled:n,onClick:d,"aria-label":"新会话",title:"新会话",children:i.jsx(jm,{className:"size-4"})}),o&&i.jsx(Se,{variant:"ghost",size:"icon-sm",className:"ml-auto shrink-0 text-muted-foreground",onClick:o,"aria-label":"关闭聊天面板",children:i.jsx(ro,{className:"size-4"})})]})}function _O(){const n=Nt(l=>l.disconnected),o=Nt(l=>l.setDisconnected),r=Nt(l=>l.resendLast);return n?i.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-b border-destructive/30 bg-destructive/10 px-3 py-1.5 text-xs text-destructive",children:[i.jsx(Tm,{className:"size-3.5 shrink-0"}),i.jsx("span",{className:"min-w-0 flex-1 truncate",children:"上次会话已取消"}),i.jsx(Se,{size:"xs",variant:"outline",className:"shrink-0",onClick:r,children:"重新发送"}),i.jsx("button",{className:"shrink-0 rounded p-0.5 hover:bg-destructive/15",onClick:()=>o(!1),"aria-label":"关闭断连提示",children:i.jsx(ro,{className:"size-3.5"})})]}):null}function MO(){const n=Nt(r=>r.streamError),o=Nt(r=>r.setStreamError);return n?i.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-b border-destructive/30 bg-destructive/10 px-3 py-1.5 text-xs text-destructive",children:[i.jsx(Sm,{className:"size-3.5 shrink-0"}),i.jsx("span",{className:"min-w-0 flex-1 truncate",children:n}),i.jsx("button",{className:"shrink-0 rounded p-0.5 hover:bg-destructive/15",onClick:()=>o(null),"aria-label":"关闭错误提示",children:i.jsx(ro,{className:"size-3.5"})})]}):null}function O1({toolName:n,args:o,result:r,status:l}){const[c,d]=h.useState(!1),m=l==="ok"||r!==void 0;return i.jsxs("div",{className:"rounded-md border border-border/70 bg-muted/40 px-2 py-1",children:[i.jsxs("button",{className:"flex w-full items-center gap-1.5 text-left text-xs text-muted-foreground",onClick:()=>d(g=>!g),"aria-expanded":c,children:[i.jsx(Nv,{className:We("size-3 shrink-0 transition-transform",c&&"rotate-90")}),i.jsx(Pj,{className:"size-3 shrink-0"}),i.jsxs("span",{className:"min-w-0 flex-1 truncate",children:["调用了 ",n]}),l==="error"&&i.jsx("span",{className:"shrink-0 text-destructive",children:"✗"}),m&&i.jsx("span",{className:"shrink-0 text-primary",children:"✓"})]}),c&&i.jsx("pre",{className:"mt-1 max-h-40 overflow-auto whitespace-pre-wrap text-xs text-muted-foreground",children:typeof o=="string"?o:JSON.stringify(o??{},null,2)})]})}function AO({message:n,toolResults:o}){if(n.role==="user")return i.jsx("div",{className:"flex justify-end",children:i.jsx("div",{className:"max-w-[85%] rounded-lg bg-secondary px-3 py-2 text-sm text-secondary-foreground",children:n.content})});if(n.role==="tool")return null;const r=Array.isArray(n.toolCalls)?n.toolCalls:[];return i.jsxs("div",{className:"space-y-1.5",children:[r.map((l,c)=>{const d=OO(l),m=d.id??`hist-${c}`,g=m?o.get(m):void 0;return i.jsx(O1,{toolName:d.tool??d.name??"工具",args:d.args,result:g?.content,status:g?"ok":void 0},m)}),n.content?i.jsx("p",{className:"whitespace-pre-wrap font-serif text-[17px] leading-[1.72] text-foreground",children:n.content}):null]})}function DO({proposal:n}){const o=Nt(d=>d.confirmProposal),r=Nt(d=>d.rejectProposal),l=wO[n.type]??n.type,c=n.status!=="pending"||n.processing===!0;return i.jsxs("div",{className:"rounded-lg border border-primary/25 bg-primary/5 p-2.5",children:[i.jsxs("div",{className:"flex items-center gap-1.5 text-sm font-medium text-foreground",children:[i.jsx(wv,{className:"size-3.5 shrink-0 text-primary"}),i.jsxs("span",{className:"min-w-0 flex-1 truncate",children:["提案:",l]}),n.status==="confirmed"&&i.jsx("span",{className:"shrink-0 text-xs text-primary",children:"✓ 已确认"}),n.status==="rejected"&&i.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:"已拒绝"}),n.status==="stale"&&i.jsx("span",{className:"shrink-0 text-xs text-destructive",children:"⚠ 数据已变化,此提案已失效"})]}),n.preview!==void 0&&i.jsx("pre",{className:"mt-1 max-h-32 overflow-auto whitespace-pre-wrap text-xs text-muted-foreground",children:typeof n.preview=="string"?n.preview:JSON.stringify(n.preview,null,2)}),i.jsxs("div",{className:"mt-2 flex gap-1.5",children:[i.jsx(Se,{size:"xs",disabled:c,onClick:()=>{o(n.proposalId)},children:"确认"}),i.jsx(Se,{size:"xs",variant:"outline",disabled:c,onClick:()=>{r(n.proposalId)},children:"拒绝"})]})]})}function zO(){const n=Nt(r=>r.focusContext),o=Nt(r=>r.clearFocusContext);return n?i.jsxs("div",{className:"flex shrink-0 items-center gap-1.5 border-t border-border bg-accent/40 px-3 py-1.5 text-xs",children:[i.jsx(wv,{className:"size-3.5 shrink-0 text-primary"}),i.jsxs("span",{className:"min-w-0 flex-1 truncate text-muted-foreground",children:["正在讨论:",RO(n)]}),i.jsx("button",{className:"shrink-0 rounded p-0.5 text-muted-foreground hover:bg-muted",onClick:o,"aria-label":"清除讨论上下文",children:i.jsx(ro,{className:"size-3.5"})})]}):null}function LO({disabled:n}){const[o,r]=h.useState(""),l=Nt(g=>g.streaming),c=Nt(g=>g.sendMessage),d=!n&&!l&&o.trim().length>0,m=()=>{d&&(c(o),r(""))};return i.jsx("div",{className:"shrink-0 border-t border-border p-3",children:i.jsxs("div",{className:"flex items-end gap-2",children:[i.jsx("textarea",{value:o,onChange:g=>r(g.target.value),onKeyDown:g=>{g.key==="Enter"&&!g.shiftKey&&!g.nativeEvent.isComposing&&(g.preventDefault(),m())},placeholder:l?"AI 思考中…":"输入消息…",rows:1,disabled:n||l,className:"max-h-32 min-h-9 flex-1 resize-none rounded-lg border border-input bg-transparent px-2.5 py-1.5 text-sm outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50"}),i.jsxs(Se,{onClick:m,disabled:!d,className:"shrink-0",children:[l?i.jsx(Nm,{className:"size-4 animate-spin"}):i.jsx(kj,{className:"size-4"}),l?"思考中":"发送"]})]})})}function IO({disabled:n}){const o=Nt(p=>p.messages),r=Nt(p=>p.messagesLoading),l=Nt(p=>p.streamTools),c=Nt(p=>p.proposals),d=h.useRef(null),m=h.useMemo(()=>{const p=new Map;for(const v of o)v.role==="tool"&&v.toolCallId&&p.set(v.toolCallId,v);return p},[o]),g=o.length;if(h.useEffect(()=>{const p=d.current;p&&(p.scrollTop=p.scrollHeight)},[g,r,l.length,c.length]),n)return i.jsxs("div",{className:"flex min-h-0 flex-1 flex-col items-center justify-center gap-2 p-4",children:[i.jsx(zl,{className:"size-8 text-muted-foreground/40"}),i.jsx("p",{className:"text-sm text-muted-foreground/70",children:"打开项目后可用"})]});if(r)return i.jsx("div",{className:"flex min-h-0 flex-1 flex-col gap-3 p-4",children:[0,1].map(p=>i.jsx("div",{className:"animate-pulse rounded-lg bg-muted/60",style:{height:40,width:p%2?"70%":"90%"}},p))});const b=o.length===0&&l.length===0&&c.length===0;return i.jsx("div",{ref:d,className:"min-h-0 flex-1 overflow-y-auto px-3 py-3",children:b?i.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-1.5 p-4 text-center",children:[i.jsx(zl,{className:"size-7 text-muted-foreground/40"}),i.jsx("p",{className:"text-sm text-muted-foreground",children:"试试问:这个设定有没有漏洞?"}),i.jsx("p",{className:"text-sm text-muted-foreground",children:"第 4 章剧情往哪走合理?"})]}):i.jsxs("div",{className:"flex flex-col gap-3",children:[o.map(p=>i.jsx(AO,{message:p,toolResults:m},p.id)),l.map(p=>i.jsx(O1,{toolName:p.tool,args:p.args,result:p.result,status:p.status},p.id)),c.map(p=>i.jsx(DO,{proposal:p},p.proposalId))]})})}function zy({onClose:n}){const r=!ze(l=>l.config);return i.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[i.jsx(kO,{disabled:r,onClose:n}),!r&&i.jsxs(i.Fragment,{children:[i.jsx(_O,{}),i.jsx(MO,{})]}),i.jsx(IO,{disabled:r}),!r&&i.jsxs(i.Fragment,{children:[i.jsx(zO,{}),i.jsx(LO,{disabled:r})]})]})}function UO({open:n,onClose:o}){return Rv("(min-width: 1024px)")?i.jsx("aside",{className:"flex min-w-0 flex-[4_1_40%] flex-col border-l border-border bg-background",children:i.jsx(zy,{})}):n?i.jsxs("div",{className:"fixed inset-0 z-50",children:[i.jsx("div",{className:"absolute inset-0 bg-foreground/40 animate-in fade-in",onClick:o}),i.jsx("div",{className:"absolute inset-y-0 right-0 w-[85vw] max-w-md border-l border-border bg-background shadow-xl animate-in slide-in-from-right duration-300",children:i.jsx(zy,{onClose:o})})]}):null}function HO(n){if(typeof document>"u")return;let o=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",o.appendChild(r),r.styleSheet?r.styleSheet.cssText=n:r.appendChild(document.createTextNode(n))}const BO=n=>{switch(n){case"success":return PO;case"info":return qO;case"warning":return GO;case"error":return FO;default:return null}},YO=Array(12).fill(0),VO=({visible:n,className:o})=>Re.createElement("div",{className:["sonner-loading-wrapper",o].filter(Boolean).join(" "),"data-visible":n},Re.createElement("div",{className:"sonner-spinner"},YO.map((r,l)=>Re.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${l}`})))),PO=Re.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},Re.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"})),GO=Re.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},Re.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"})),qO=Re.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},Re.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"})),FO=Re.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},Re.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"})),XO=Re.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"},Re.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),Re.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),KO=()=>{const[n,o]=Re.useState(document.hidden);return Re.useEffect(()=>{const r=()=>{o(document.hidden)};return document.addEventListener("visibilitychange",r),()=>window.removeEventListener("visibilitychange",r)},[]),n};let mm=1;class $O{constructor(){this.subscribe=o=>(this.subscribers.push(o),()=>{const r=this.subscribers.indexOf(o);this.subscribers.splice(r,1)}),this.publish=o=>{this.subscribers.forEach(r=>r(o))},this.addToast=o=>{this.publish(o),this.toasts=[...this.toasts,o]},this.create=o=>{var r;const{message:l,...c}=o,d=typeof o?.id=="number"||((r=o.id)==null?void 0:r.length)>0?o.id:mm++,m=this.toasts.find(b=>b.id===d),g=o.dismissible===void 0?!0:o.dismissible;return this.dismissedToasts.has(d)&&this.dismissedToasts.delete(d),m?this.toasts=this.toasts.map(b=>b.id===d?(this.publish({...b,...o,id:d,title:l}),{...b,...o,id:d,dismissible:g,title:l}):b):this.addToast({title:l,...c,dismissible:g,id:d}),d},this.dismiss=o=>(o?(this.dismissedToasts.add(o),requestAnimationFrame(()=>this.subscribers.forEach(r=>r({id:o,dismiss:!0})))):this.toasts.forEach(r=>{this.subscribers.forEach(l=>l({id:r.id,dismiss:!0}))}),o),this.message=(o,r)=>this.create({...r,message:o}),this.error=(o,r)=>this.create({...r,message:o,type:"error"}),this.success=(o,r)=>this.create({...r,type:"success",message:o}),this.info=(o,r)=>this.create({...r,type:"info",message:o}),this.warning=(o,r)=>this.create({...r,type:"warning",message:o}),this.loading=(o,r)=>this.create({...r,type:"loading",message:o}),this.promise=(o,r)=>{if(!r)return;let l;r.loading!==void 0&&(l=this.create({...r,promise:o,type:"loading",message:r.loading,description:typeof r.description!="function"?r.description:void 0}));const c=Promise.resolve(o instanceof Function?o():o);let d=l!==void 0,m;const g=c.then(async p=>{if(m=["resolve",p],Re.isValidElement(p))d=!1,this.create({id:l,type:"default",message:p});else if(ZO(p)&&!p.ok){d=!1;const x=typeof r.error=="function"?await r.error(`HTTP error! status: ${p.status}`):r.error,S=typeof r.description=="function"?await r.description(`HTTP error! status: ${p.status}`):r.description,N=typeof x=="object"&&!Re.isValidElement(x)?x:{message:x};this.create({id:l,type:"error",description:S,...N})}else if(p instanceof Error){d=!1;const x=typeof r.error=="function"?await r.error(p):r.error,S=typeof r.description=="function"?await r.description(p):r.description,N=typeof x=="object"&&!Re.isValidElement(x)?x:{message:x};this.create({id:l,type:"error",description:S,...N})}else if(r.success!==void 0){d=!1;const x=typeof r.success=="function"?await r.success(p):r.success,S=typeof r.description=="function"?await r.description(p):r.description,N=typeof x=="object"&&!Re.isValidElement(x)?x:{message:x};this.create({id:l,type:"success",description:S,...N})}}).catch(async p=>{if(m=["reject",p],r.error!==void 0){d=!1;const v=typeof r.error=="function"?await r.error(p):r.error,x=typeof r.description=="function"?await r.description(p):r.description,j=typeof v=="object"&&!Re.isValidElement(v)?v:{message:v};this.create({id:l,type:"error",description:x,...j})}}).finally(()=>{d&&(this.dismiss(l),l=void 0),r.finally==null||r.finally.call(r)}),b=()=>new Promise((p,v)=>g.then(()=>m[0]==="reject"?v(m[1]):p(m[1])).catch(v));return typeof l!="string"&&typeof l!="number"?{unwrap:b}:Object.assign(l,{unwrap:b})},this.custom=(o,r)=>{const l=r?.id||mm++;return this.create({jsx:o(l),id:l,...r}),l},this.getActiveToasts=()=>this.toasts.filter(o=>!this.dismissedToasts.has(o.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}}const An=new $O,QO=(n,o)=>{const r=o?.id||mm++;return An.addToast({title:n,...o,id:r}),r},ZO=n=>n&&typeof n=="object"&&"ok"in n&&typeof n.ok=="boolean"&&"status"in n&&typeof n.status=="number",JO=QO,WO=()=>An.toasts,ek=()=>An.getActiveToasts(),Ly=Object.assign(JO,{success:An.success,info:An.info,warning:An.warning,error:An.error,custom:An.custom,message:An.message,promise:An.promise,dismiss:An.dismiss,loading:An.loading},{getHistory:WO,getToasts:ek});HO("[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}[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(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);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]{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 bc(n){return n.label!==void 0}const tk=3,nk="24px",sk="16px",Iy=4e3,ok=356,rk=14,ak=45,lk=200;function ys(...n){return n.filter(Boolean).join(" ")}function ik(n){const[o,r]=n.split("-"),l=[];return o&&l.push(o),r&&l.push(r),l}const ck=n=>{var o,r,l,c,d,m,g,b,p;const{invert:v,toast:x,unstyled:S,interacting:j,setHeights:N,visibleToasts:k,heights:O,index:E,toasts:T,expanded:_,removeToast:R,defaultRichColors:H,closeButton:A,style:B,cancelButtonStyle:M,actionButtonStyle:Q,className:ne="",descriptionClassName:me="",duration:se,position:X,gap:te,expandByDefault:$,classNames:w,icons:U,closeButtonAriaLabel:Y="Close toast"}=n,[z,I]=Re.useState(null),[D,G]=Re.useState(null),[L,q]=Re.useState(!1),[Z,V]=Re.useState(!1),[be,ue]=Re.useState(!1),[he,Le]=Re.useState(!1),[qe,we]=Re.useState(!1),[De,Ae]=Re.useState(0),[ye,Ie]=Re.useState(0),oe=Re.useRef(x.duration||se||Iy),ce=Re.useRef(null),de=Re.useRef(null),Te=E===0,Me=E+1<=k,_e=x.type,it=x.dismissible!==!1,ie=x.className||"",F=x.descriptionClassName||"",pe=Re.useMemo(()=>O.findIndex(xe=>xe.toastId===x.id)||0,[O,x.id]),J=Re.useMemo(()=>{var xe;return(xe=x.closeButton)!=null?xe:A},[x.closeButton,A]),je=Re.useMemo(()=>x.duration||se||Iy,[x.duration,se]),Fe=Re.useRef(0),Ne=Re.useRef(0),Oe=Re.useRef(0),Xe=Re.useRef(null),[st,Et]=X.split("-"),kt=Re.useMemo(()=>O.reduce((xe,Ce,$e)=>$e>=pe?xe:xe+Ce.height,0),[O,pe]),xt=KO(),yn=x.invert||v,an=_e==="loading";Ne.current=Re.useMemo(()=>pe*te+kt,[pe,kt]),Re.useEffect(()=>{oe.current=je},[je]),Re.useEffect(()=>{q(!0)},[]),Re.useEffect(()=>{const xe=de.current;if(xe){const Ce=xe.getBoundingClientRect().height;return Ie(Ce),N($e=>[{toastId:x.id,height:Ce,position:x.position},...$e]),()=>N($e=>$e.filter(et=>et.toastId!==x.id))}},[N,x.id]),Re.useLayoutEffect(()=>{if(!L)return;const xe=de.current,Ce=xe.style.height;xe.style.height="auto";const $e=xe.getBoundingClientRect().height;xe.style.height=Ce,Ie($e),N(et=>et.find(nt=>nt.toastId===x.id)?et.map(nt=>nt.toastId===x.id?{...nt,height:$e}:nt):[{toastId:x.id,height:$e,position:x.position},...et])},[L,x.title,x.description,N,x.id,x.jsx,x.action,x.cancel]);const Ke=Re.useCallback(()=>{V(!0),Ae(Ne.current),N(xe=>xe.filter(Ce=>Ce.toastId!==x.id)),setTimeout(()=>{R(x)},lk)},[x,R,N,Ne]);Re.useEffect(()=>{if(x.promise&&_e==="loading"||x.duration===1/0||x.type==="loading")return;let xe;return _||j||xt?(()=>{if(Oe.current<Fe.current){const et=new Date().getTime()-Fe.current;oe.current=oe.current-et}Oe.current=new Date().getTime()})():oe.current!==1/0&&(Fe.current=new Date().getTime(),xe=setTimeout(()=>{x.onAutoClose==null||x.onAutoClose.call(x,x),Ke()},oe.current)),()=>clearTimeout(xe)},[_,j,x,_e,xt,Ke]),Re.useEffect(()=>{x.delete&&(Ke(),x.onDismiss==null||x.onDismiss.call(x,x))},[Ke,x.delete]);function Tt(){var xe;if(U?.loading){var Ce;return Re.createElement("div",{className:ys(w?.loader,x==null||(Ce=x.classNames)==null?void 0:Ce.loader,"sonner-loader"),"data-visible":_e==="loading"},U.loading)}return Re.createElement(VO,{className:ys(w?.loader,x==null||(xe=x.classNames)==null?void 0:xe.loader),visible:_e==="loading"})}const tn=x.icon||U?.[_e]||BO(_e);var Gt,ee;return Re.createElement("li",{tabIndex:0,ref:de,className:ys(ne,ie,w?.toast,x==null||(o=x.classNames)==null?void 0:o.toast,w?.default,w?.[_e],x==null||(r=x.classNames)==null?void 0:r[_e]),"data-sonner-toast":"","data-rich-colors":(Gt=x.richColors)!=null?Gt:H,"data-styled":!(x.jsx||x.unstyled||S),"data-mounted":L,"data-promise":!!x.promise,"data-swiped":qe,"data-removed":Z,"data-visible":Me,"data-y-position":st,"data-x-position":Et,"data-index":E,"data-front":Te,"data-swiping":be,"data-dismissible":it,"data-type":_e,"data-invert":yn,"data-swipe-out":he,"data-swipe-direction":D,"data-expanded":!!(_||$&&L),"data-testid":x.testId,style:{"--index":E,"--toasts-before":E,"--z-index":T.length-E,"--offset":`${Z?De:Ne.current}px`,"--initial-height":$?"auto":`${ye}px`,...B,...x.style},onDragEnd:()=>{ue(!1),I(null),Xe.current=null},onPointerDown:xe=>{xe.button!==2&&(an||!it||(ce.current=new Date,Ae(Ne.current),xe.target.setPointerCapture(xe.pointerId),xe.target.tagName!=="BUTTON"&&(ue(!0),Xe.current={x:xe.clientX,y:xe.clientY})))},onPointerUp:()=>{var xe,Ce,$e;if(he||!it)return;Xe.current=null;const et=Number(((xe=de.current)==null?void 0:xe.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),rt=Number(((Ce=de.current)==null?void 0:Ce.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),nt=new Date().getTime()-(($e=ce.current)==null?void 0:$e.getTime()),Vt=z==="x"?et:rt,Xn=Math.abs(Vt)/nt;if(Math.abs(Vt)>=ak||Xn>.11){Ae(Ne.current),x.onDismiss==null||x.onDismiss.call(x,x),G(z==="x"?et>0?"right":"left":rt>0?"down":"up"),Ke(),Le(!0);return}else{var Kt,mn;(Kt=de.current)==null||Kt.style.setProperty("--swipe-amount-x","0px"),(mn=de.current)==null||mn.style.setProperty("--swipe-amount-y","0px")}we(!1),ue(!1),I(null)},onPointerMove:xe=>{var Ce,$e,et;if(!Xe.current||!it||((Ce=window.getSelection())==null?void 0:Ce.toString().length)>0)return;const nt=xe.clientY-Xe.current.y,Vt=xe.clientX-Xe.current.x;var Xn;const Kt=(Xn=n.swipeDirections)!=null?Xn:ik(X);!z&&(Math.abs(Vt)>1||Math.abs(nt)>1)&&I(Math.abs(Vt)>Math.abs(nt)?"x":"y");let mn={x:0,y:0};const fo=Ln=>1/(1.5+Math.abs(Ln)/20);if(z==="y"){if(Kt.includes("top")||Kt.includes("bottom"))if(Kt.includes("top")&&nt<0||Kt.includes("bottom")&&nt>0)mn.y=nt;else{const Ln=nt*fo(nt);mn.y=Math.abs(Ln)<Math.abs(nt)?Ln:nt}}else if(z==="x"&&(Kt.includes("left")||Kt.includes("right")))if(Kt.includes("left")&&Vt<0||Kt.includes("right")&&Vt>0)mn.x=Vt;else{const Ln=Vt*fo(Vt);mn.x=Math.abs(Ln)<Math.abs(Vt)?Ln:Vt}(Math.abs(mn.x)>0||Math.abs(mn.y)>0)&&we(!0),($e=de.current)==null||$e.style.setProperty("--swipe-amount-x",`${mn.x}px`),(et=de.current)==null||et.style.setProperty("--swipe-amount-y",`${mn.y}px`)}},J&&!x.jsx&&_e!=="loading"?Re.createElement("button",{"aria-label":Y,"data-disabled":an,"data-close-button":!0,onClick:an||!it?()=>{}:()=>{Ke(),x.onDismiss==null||x.onDismiss.call(x,x)},className:ys(w?.closeButton,x==null||(l=x.classNames)==null?void 0:l.closeButton)},(ee=U?.close)!=null?ee:XO):null,(_e||x.icon||x.promise)&&x.icon!==null&&(U?.[_e]!==null||x.icon)?Re.createElement("div",{"data-icon":"",className:ys(w?.icon,x==null||(c=x.classNames)==null?void 0:c.icon)},x.promise||x.type==="loading"&&!x.icon?x.icon||Tt():null,x.type!=="loading"?tn:null):null,Re.createElement("div",{"data-content":"",className:ys(w?.content,x==null||(d=x.classNames)==null?void 0:d.content)},Re.createElement("div",{"data-title":"",className:ys(w?.title,x==null||(m=x.classNames)==null?void 0:m.title)},x.jsx?x.jsx:typeof x.title=="function"?x.title():x.title),x.description?Re.createElement("div",{"data-description":"",className:ys(me,F,w?.description,x==null||(g=x.classNames)==null?void 0:g.description)},typeof x.description=="function"?x.description():x.description):null),Re.isValidElement(x.cancel)?x.cancel:x.cancel&&bc(x.cancel)?Re.createElement("button",{"data-button":!0,"data-cancel":!0,style:x.cancelButtonStyle||M,onClick:xe=>{bc(x.cancel)&&it&&(x.cancel.onClick==null||x.cancel.onClick.call(x.cancel,xe),Ke())},className:ys(w?.cancelButton,x==null||(b=x.classNames)==null?void 0:b.cancelButton)},x.cancel.label):null,Re.isValidElement(x.action)?x.action:x.action&&bc(x.action)?Re.createElement("button",{"data-button":!0,"data-action":!0,style:x.actionButtonStyle||Q,onClick:xe=>{bc(x.action)&&(x.action.onClick==null||x.action.onClick.call(x.action,xe),!xe.defaultPrevented&&Ke())},className:ys(w?.actionButton,x==null||(p=x.classNames)==null?void 0:p.actionButton)},x.action.label):null)};function Uy(){if(typeof window>"u"||typeof document>"u")return"ltr";const n=document.documentElement.getAttribute("dir");return n==="auto"||!n?window.getComputedStyle(document.documentElement).direction:n}function uk(n,o){const r={};return[n,o].forEach((l,c)=>{const d=c===1,m=d?"--mobile-offset":"--offset",g=d?sk:nk;function b(p){["top","right","bottom","left"].forEach(v=>{r[`${m}-${v}`]=typeof p=="number"?`${p}px`:p})}typeof l=="number"||typeof l=="string"?b(l):typeof l=="object"?["top","right","bottom","left"].forEach(p=>{l[p]===void 0?r[`${m}-${p}`]=g:r[`${m}-${p}`]=typeof l[p]=="number"?`${l[p]}px`:l[p]}):b(g)}),r}const dk=Re.forwardRef(function(o,r){const{id:l,invert:c,position:d="bottom-right",hotkey:m=["altKey","KeyT"],expand:g,closeButton:b,className:p,offset:v,mobileOffset:x,theme:S="light",richColors:j,duration:N,style:k,visibleToasts:O=tk,toastOptions:E,dir:T=Uy(),gap:_=rk,icons:R,containerAriaLabel:H="Notifications"}=o,[A,B]=Re.useState([]),M=Re.useMemo(()=>l?A.filter(L=>L.toasterId===l):A.filter(L=>!L.toasterId),[A,l]),Q=Re.useMemo(()=>Array.from(new Set([d].concat(M.filter(L=>L.position).map(L=>L.position)))),[M,d]),[ne,me]=Re.useState([]),[se,X]=Re.useState(!1),[te,$]=Re.useState(!1),[w,U]=Re.useState(S!=="system"?S:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),Y=Re.useRef(null),z=m.join("+").replace(/Key/g,"").replace(/Digit/g,""),I=Re.useRef(null),D=Re.useRef(!1),G=Re.useCallback(L=>{B(q=>{var Z;return(Z=q.find(V=>V.id===L.id))!=null&&Z.delete||An.dismiss(L.id),q.filter(({id:V})=>V!==L.id)})},[]);return Re.useEffect(()=>An.subscribe(L=>{if(L.dismiss){requestAnimationFrame(()=>{B(q=>q.map(Z=>Z.id===L.id?{...Z,delete:!0}:Z))});return}setTimeout(()=>{Ew.flushSync(()=>{B(q=>{const Z=q.findIndex(V=>V.id===L.id);return Z!==-1?[...q.slice(0,Z),{...q[Z],...L},...q.slice(Z+1)]:[L,...q]})})})}),[A]),Re.useEffect(()=>{if(S!=="system"){U(S);return}if(S==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?U("dark"):U("light")),typeof window>"u")return;const L=window.matchMedia("(prefers-color-scheme: dark)");try{L.addEventListener("change",({matches:q})=>{U(q?"dark":"light")})}catch{L.addListener(({matches:Z})=>{try{U(Z?"dark":"light")}catch(V){console.error(V)}})}},[S]),Re.useEffect(()=>{A.length<=1&&X(!1)},[A]),Re.useEffect(()=>{const L=q=>{var Z;if(m.every(ue=>q[ue]||q.code===ue)){var be;X(!0),(be=Y.current)==null||be.focus()}q.code==="Escape"&&(document.activeElement===Y.current||(Z=Y.current)!=null&&Z.contains(document.activeElement))&&X(!1)};return document.addEventListener("keydown",L),()=>document.removeEventListener("keydown",L)},[m]),Re.useEffect(()=>{if(Y.current)return()=>{I.current&&(I.current.focus({preventScroll:!0}),I.current=null,D.current=!1)}},[Y.current]),Re.createElement("section",{ref:r,"aria-label":`${H} ${z}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},Q.map((L,q)=>{var Z;const[V,be]=L.split("-");return M.length?Re.createElement("ol",{key:L,dir:T==="auto"?Uy():T,tabIndex:-1,ref:Y,className:p,"data-sonner-toaster":!0,"data-sonner-theme":w,"data-y-position":V,"data-x-position":be,style:{"--front-toast-height":`${((Z=ne[0])==null?void 0:Z.height)||0}px`,"--width":`${ok}px`,"--gap":`${_}px`,...k,...uk(v,x)},onBlur:ue=>{D.current&&!ue.currentTarget.contains(ue.relatedTarget)&&(D.current=!1,I.current&&(I.current.focus({preventScroll:!0}),I.current=null))},onFocus:ue=>{ue.target instanceof HTMLElement&&ue.target.dataset.dismissible==="false"||D.current||(D.current=!0,I.current=ue.relatedTarget)},onMouseEnter:()=>X(!0),onMouseMove:()=>X(!0),onMouseLeave:()=>{te||X(!1)},onDragEnd:()=>X(!1),onPointerDown:ue=>{ue.target instanceof HTMLElement&&ue.target.dataset.dismissible==="false"||$(!0)},onPointerUp:()=>$(!1)},M.filter(ue=>!ue.position&&q===0||ue.position===L).map((ue,he)=>{var Le,qe;return Re.createElement(ck,{key:ue.id,icons:R,index:he,toast:ue,defaultRichColors:j,duration:(Le=E?.duration)!=null?Le:N,className:E?.className,descriptionClassName:E?.descriptionClassName,invert:c,visibleToasts:O,closeButton:(qe=E?.closeButton)!=null?qe:b,interacting:te,position:L,style:E?.style,unstyled:E?.unstyled,classNames:E?.classNames,cancelButtonStyle:E?.cancelButtonStyle,actionButtonStyle:E?.actionButtonStyle,closeButtonAriaLabel:E?.closeButtonAriaLabel,removeToast:G,toasts:M.filter(we=>we.position==ue.position),heights:ne.filter(we=>we.position==ue.position),setHeights:me,expandByDefault:g,gap:_,expanded:se,swipeDirections:o.swipeDirections})})):null}))}),k1=h.createContext(!1),_1=h.createContext(void 0);function Rr(n){const o=h.useContext(_1);if(n===!1&&o===void 0)throw new Error(En(27));return o}const fk={...Gl,...Gc},mk=h.forwardRef(function(o,r){const{render:l,className:c,style:d,forceRender:m=!1,...g}=o,{store:b}=Rr(),p=b.useState("open"),v=b.useState("nested"),x=b.useState("mounted"),S=b.useState("transitionStatus");return fn("div",o,{state:{open:p,transitionStatus:S},ref:[b.context.backdropRef,r],stateAttributesMapping:fk,props:[{role:"presentation",hidden:!x,style:{userSelect:"none",WebkitUserSelect:"none"}},g],enabled:m||!v})}),M1=h.forwardRef(function(o,r){const{render:l,className:c,style:d,disabled:m=!1,nativeButton:g=!0,...b}=o,{store:p}=Rr(),v=p.useState("open"),{getButtonProps:x,buttonRef:S}=Pl({disabled:m,native:g}),j={disabled:m};function N(k){v&&p.setOpen(!1,jt(u0,k.nativeEvent))}return fn("button",o,{state:j,ref:[r,S],props:[{onClick:N},b,x]})}),pk=h.forwardRef(function(o,r){const{render:l,className:c,style:d,id:m,...g}=o,{store:b}=Rr(),p=Cr(m);return b.useSyncedValueWithCleanup("descriptionElementId",p),fn("p",o,{ref:r,props:[{id:p},g]})});let hk=(function(n){return n.nestedDialogs="--nested-dialogs",n})({}),gk=(function(n){return n[n.open=pr.open]="open",n[n.closed=pr.closed]="closed",n[n.startingStyle=pr.startingStyle]="startingStyle",n[n.endingStyle=pr.endingStyle]="endingStyle",n.nested="data-nested",n.nestedDialogOpen="data-nested-dialog-open",n})({});const A1=h.createContext(void 0);function xk(){const n=h.useContext(A1);if(n===void 0)throw new Error(En(26));return n}const bk={...Gl,...Gc,nestedDialogOpen(n){return n?{[gk.nestedDialogOpen]:""}:null}},yk=h.forwardRef(function(o,r){const{render:l,className:c,style:d,finalFocus:m,initialFocus:g,...b}=o,{store:p}=Rr(),v=p.useState("descriptionElementId"),x=p.useState("disablePointerDismissal"),S=p.useState("floatingRootContext"),j=p.useState("popupProps"),N=p.useState("modal"),k=p.useState("mounted"),O=p.useState("nested"),E=p.useState("nestedOpenDialogCount"),T=p.useState("open"),_=p.useState("openMethod"),R=p.useState("titleElementId"),H=p.useState("transitionStatus"),A=p.useState("role"),B=S.useState("floatingId"),M=b.id??B;xk(),$c({open:T,ref:p.context.popupRef,onComplete(){T&&p.context.onOpenChangeComplete?.(!0)}});const Q=g===void 0?s1(p.context.popupRef):g,ne=E>0,me=p.useStateSetter("popupElement"),X=fn("div",o,{state:{open:T,nested:O,transitionStatus:H,nestedDialogOpen:ne},props:[j,{id:M,"aria-labelledby":R??void 0,"aria-describedby":v??void 0,role:A,...su,hidden:!k,onKeyDown(te){fp.has(te.key)&&te.stopPropagation()},style:{[hk.nestedDialogs]:E}},b],ref:[r,p.context.popupRef,me],stateAttributesMapping:bk});return i.jsx(tp,{context:S,openInteractionType:_,disabled:!k,closeOnFocusOut:!x,initialFocus:Q,returnFocus:m,modal:N!==!1,restoreFocus:"popup",children:X})}),vk=h.forwardRef(function(o,r){const{keepMounted:l=!1,...c}=o,{store:d}=Rr(),m=d.useState("mounted"),g=d.useState("modal"),b=d.useState("open");return m||l?i.jsx(A1.Provider,{value:l,children:i.jsxs(Zm,{ref:r,...c,children:[m&&g===!0&&i.jsx(hp,{ref:d.context.internalBackdropRef,inert:pp(!b)}),o.children]})}):null});function Sk(n){const{store:o,actionsRef:r}=n,l=o.useState("open");i1(o,l),rp(o);const{forceUnmount:c}=ap(l,o),d=h.useCallback(()=>{o.setOpen(!1,jt(Bm))},[o]);h.useImperativeHandle(r,()=>({unmount:c,close:d}),[c,d])}function Ek({store:n,parentContext:o,isDrawer:r}){const l=n.useState("open"),c=n.useState("disablePointerDismissal"),d=n.useState("modal"),m=n.useState("popupElement"),g=n.useState("floatingRootContext"),[b,p]=h.useState(0),[v,x]=h.useState(0),S=b===0,j=np(g,{outsidePressEvent(){return n.context.internalBackdropRef.current||n.context.backdropRef.current?"intentional":{mouse:d==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}},outsidePress(E){if(!n.context.outsidePressEnabledRef.current||"button"in E&&E.button!==0||"touches"in E&&E.touches.length!==1)return!1;const T=Dn(E);return S&&!c?d&&(n.context.internalBackdropRef.current||n.context.backdropRef.current)?n.context.internalBackdropRef.current===T||n.context.backdropRef.current===T||Je(T,m)&&!T?.hasAttribute("data-base-ui-portal"):!0:!1},escapeKey:S});N1(l&&d===!0,m),n.useContextCallback("onNestedDialogOpen",(E,T)=>{p(E),x(T)}),n.useContextCallback("onNestedDialogClose",()=>{p(0),x(0)}),h.useEffect(()=>(o?.onNestedDialogOpen&&l&&o.onNestedDialogOpen(b+1,v+(r?1:0)),o?.onNestedDialogClose&&!l&&o.onNestedDialogClose(),()=>{o?.onNestedDialogClose&&l&&o.onNestedDialogClose()}),[r,l,b,v,o]);const N=j.reference??Ht,k=j.trigger??Ht,O=j.floating??Ht;return lp(n,{activeTriggerProps:N,inactiveTriggerProps:k,popupProps:O,nestedOpenDialogCount:b,nestedOpenDrawerCount:v}),null}const Nk={...up,modal:Ye(n=>n.modal),nested:Ye(n=>n.nested),nestedOpenDialogCount:Ye(n=>n.nestedOpenDialogCount),nestedOpenDrawerCount:Ye(n=>n.nestedOpenDrawerCount),disablePointerDismissal:Ye(n=>n.disablePointerDismissal),openMethod:Ye(n=>n.openMethod),descriptionElementId:Ye(n=>n.descriptionElementId),titleElementId:Ye(n=>n.titleElementId),viewportElement:Ye(n=>n.viewportElement),role:Ye(n=>n.role)};class Sp extends tu{constructor(o,r,l=!1){const c=new Fl,d=jk(o);d.floatingRootContext=c1(c,r,l),super(d,{popupRef:h.createRef(),backdropRef:h.createRef(),internalBackdropRef:h.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:c,onOpenChange:void 0,onOpenChangeComplete:void 0},Nk)}setOpen=(o,r)=>{if(r.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},!o&&r.trigger==null&&this.state.activeTriggerId!=null&&(r.trigger=this.state.activeTriggerElement??void 0),this.context.onOpenChange?.(o,r),r.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(o,r);const l={open:o};op(l,o,r.trigger),this.update(l)};static useStore(o,r){return o1(o,(c,d)=>new Sp(r,c,d),!0).store}}function jk(n={}){return{...ip(),modal:!0,disablePointerDismissal:!1,popupElement:null,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,nestedOpenDrawerCount:0,role:"dialog",...n}}function Tk(n,o="dialog"){const{children:r,open:l,defaultOpen:c=!1,onOpenChange:d,onOpenChangeComplete:m,disablePointerDismissal:g=!1,modal:b=!0,actionsRef:p,handle:v,triggerId:x,defaultTriggerId:S=null}=n,j=o==="drawer",N=o==="alert-dialog",k=N?!0:b,O=N||g,E=N?"alertdialog":"dialog",T=Rr(!0),R={modal:k,disablePointerDismissal:O,nested:!!T,role:E},H=Sp.useStore(v?.store,{open:c,openProp:l,activeTriggerId:S,triggerIdProp:x,...R});Z0(()=>{const me=l===void 0&&H.state.open===!1&&c===!0?{open:!0,activeTriggerId:S}:null;N?H.update(me?{...R,...me}:R):me&&H.update(me)}),H.useControlledProp("openProp",l),H.useControlledProp("triggerIdProp",x),H.useSyncedValues(R),H.useContextCallback("onOpenChange",d),H.useContextCallback("onOpenChangeComplete",m);const A=H.useState("open"),B=H.useState("mounted"),M=H.useState("payload");Sk({store:H,actionsRef:p});const Q=A||B,ne=h.useMemo(()=>({store:H}),[H]);return i.jsx(k1.Provider,{value:!1,children:i.jsxs(_1.Provider,{value:ne,children:[Q&&i.jsx(Ek,{store:H,parentContext:T?.store.context,isDrawer:j}),typeof r=="function"?r({payload:M}):r]})})}function wk(n){const o=h.useContext(k1)?"drawer":"dialog";return Tk(n,o)}const Ck=h.forwardRef(function(o,r){const{render:l,className:c,style:d,id:m,...g}=o,{store:b}=Rr(),p=Cr(m);return b.useSyncedValueWithCleanup("titleElementId",p),fn("h2",o,{ref:r,props:[{id:p},g]})});function $s({...n}){return i.jsx(wk,{"data-slot":"dialog",...n})}function Rk({...n}){return i.jsx(vk,{"data-slot":"dialog-portal",...n})}function Ok({className:n,...o}){return i.jsx(mk,{"data-slot":"dialog-overlay",className:We("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",n),...o})}function Qs({className:n,children:o,showCloseButton:r=!0,...l}){return i.jsxs(Rk,{children:[i.jsx(Ok,{}),i.jsxs(yk,{"data-slot":"dialog-content",className:We("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 max-w-lg 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",n),...l,children:[o,r&&i.jsxs(M1,{"data-slot":"dialog-close",render:i.jsx(Se,{variant:"ghost",className:"absolute top-2 right-2",size:"icon-sm"}),children:[i.jsx(ro,{}),i.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function Zs({className:n,...o}){return i.jsx("div",{"data-slot":"dialog-header",className:We("flex flex-col gap-2",n),...o})}function Js({className:n,showCloseButton:o=!1,children:r,...l}){return i.jsxs("div",{"data-slot":"dialog-footer",className:We("-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",n),...l,children:[r,o&&i.jsx(M1,{render:i.jsx(Se,{variant:"outline"}),children:"Close"})]})}function Ws({className:n,...o}){return i.jsx(Ck,{"data-slot":"dialog-title",className:We("font-heading text-base leading-none font-medium",n),...o})}function kk({className:n,...o}){return i.jsx(pk,{"data-slot":"dialog-description",className:We("text-sm text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground",n),...o})}const os={volume:"卷",chapter:"章",scene:"场"},_k={volume:"chapter",chapter:"scene",scene:null};function ws({title:n,description:o,confirmLabel:r,danger:l=!1,onConfirm:c,onClose:d}){const[m,g]=h.useState(null),[b,p]=h.useState(!1);async function v(){p(!0),g(null);try{await c(),d()}catch(x){g(x instanceof Ue?x.message:"操作失败,请稍后重试")}finally{p(!1)}}return i.jsx($s,{open:!0,onOpenChange:x=>!x&&d(),children:i.jsxs(Qs,{className:"sm:max-w-md",children:[i.jsx(Zs,{children:i.jsx(Ws,{children:n})}),i.jsx("p",{className:"text-sm text-muted-foreground",children:o}),m&&i.jsx("p",{className:"mt-2 text-sm text-destructive",children:m}),i.jsxs(Js,{children:[i.jsx(Se,{variant:"outline",type:"button",onClick:d,disabled:b,children:"取消"}),i.jsx(Se,{variant:l?"destructive":"default",type:"button",onClick:()=>{v()},disabled:b,children:r})]})]})})}const Hy="ai-editor:theme";function D1(){const[n,o]=h.useState("light");h.useEffect(()=>{const c=localStorage.getItem(Hy)==="dark"?"dark":"light";o(c),document.documentElement.classList.toggle("dark",c==="dark")},[]);function r(){const l=n==="dark"?"light":"dark";localStorage.setItem(Hy,l),document.documentElement.classList.toggle("dark",l==="dark"),o(l)}return{theme:n,toggleTheme:r}}const Mk=({...n})=>{const{theme:o="light"}=D1();return i.jsx(dk,{theme:o,position:"top-right",className:"toaster group",icons:{success:i.jsx(Em,{className:"size-4"}),info:i.jsx(Tv,{className:"size-4"}),warning:i.jsx(Tm,{className:"size-4"}),error:i.jsx(yj,{className:"size-4"}),loading:i.jsx(Nm,{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"}},...n})};function Ak(n,o){return n!==null&&n.id!==o}function Dk(){const n=ke(r=>r.confirmState),o=ke(r=>r.resolveConfirm);return n===null?null:i.jsx(ws,{title:n.title,description:n.description??"",confirmLabel:"确认",danger:n.danger,onConfirm:async()=>o(!0),onClose:()=>o(!1)})}function zk(){const n=ke(c=>c.toast),o=ke(c=>c.error),r=ke(c=>c.clearError),l=h.useRef(null);return h.useEffect(()=>{!n||!Ak(n,l.current)||(l.current=n.id,n.kind==="error"?Ly.error(n.text,{duration:$f}):Ly.success(n.text,{duration:$f}))},[n]),i.jsxs(i.Fragment,{children:[i.jsx(Mk,{}),i.jsx(Dk,{}),o&&i.jsxs("div",{role:"alert",className:"fixed top-4 left-1/2 z-50 flex w-[min(92vw,32rem)] -translate-x-1/2 items-center gap-2 rounded-lg border border-destructive/30 bg-destructive/10 px-3 py-2 text-sm text-destructive shadow-lg",children:[i.jsx(Sm,{className:"size-4 shrink-0"}),i.jsx("p",{className:"min-w-0 flex-1",children:o.message}),i.jsx("button",{type:"button","aria-label":"关闭错误提示",onClick:r,className:"shrink-0 rounded p-0.5 hover:bg-destructive/15",children:i.jsx(ro,{className:"size-4"})})]})]})}function Lk({chatOpen:n,onToggleChat:o}){const r=ze(v=>v.config),l=ze(v=>v.configLoading),c=ze(v=>v.outline),d=ke(v=>v.setFocusOutlineNode),m=ke(v=>v.notifyDataChanged),g=Rv("(min-width: 1024px)"),b=r?.currentPosition!=null?Av(c,r.currentPosition)??r.currentPosition:null,p=l?"加载中…":r?.name??"书架";return i.jsxs("div",{className:"flex h-12 shrink-0 items-center gap-3 border-b border-border px-4",children:[i.jsxs("a",{href:"#/",className:"flex min-w-0 items-center gap-1.5 font-serif text-base font-medium text-foreground hover:text-primary",children:[i.jsx("span",{className:"text-primary",children:"◈"}),i.jsx("span",{className:"truncate",children:p})]}),i.jsxs("a",{href:"#/outline",onClick:()=>{r?.currentPosition!=null&&d(r.currentPosition)},title:r?.currentPosition!=null?"跳转大纲并定位该节点":void 0,className:"flex min-w-0 items-center gap-1 text-sm text-muted-foreground transition-colors hover:text-foreground",children:[i.jsx("span",{className:"shrink-0",children:"当前位置:"}),i.jsx("span",{className:"truncate text-foreground",children:b??"未设置"})]}),i.jsx(Se,{variant:"ghost",size:"icon-sm",className:"ml-auto shrink-0 text-muted-foreground",onClick:m,"aria-label":"刷新数据",title:"刷新数据",children:i.jsx(wj,{className:"size-4"})}),i.jsxs("span",{className:"shrink-0 text-sm text-muted-foreground",children:["语言: ",r?.language??"—"]}),!g&&i.jsx(Se,{variant:"ghost",size:"icon-sm",className:n?"bg-secondary text-foreground":"text-muted-foreground",onClick:o,"aria-label":n?"关闭聊天面板":"打开聊天面板",children:i.jsx(zl,{className:"size-4"})})]})}const Ik=[{label:"概览",href:"#/",segment:null,icon:lj},{label:"大纲",href:"#/outline",segment:"outline",icon:cj},{label:"画布",href:"#/canvas",segment:"canvas",icon:Dj},{label:"实体关系",href:"#/entities/character",segment:"entities",icon:xj},{label:"伏笔",href:"#/hooks",segment:"hooks",icon:jj},{label:"时间轴",href:"#/timeline",segment:"timeline",icon:GN},{label:"回收站",href:"#/trash",segment:"trash",icon:Cv}];function Uk({route:n}){const o=n.segments[0]??null,r=ze(d=>d.loadError==="NO_PROJECT_OPEN"),l=ke(d=>d.showToast),c=(d,m)=>{!r||m.segment===null||(d.preventDefault(),window.location.hash="#/",l("请先创建或打开项目"))};return i.jsx("nav",{"aria-label":"页面导航",className:"flex items-center gap-1 rounded-lg bg-secondary/30 p-1",children:Ik.map(d=>{const m=d.icon,g=o===d.segment;return i.jsxs("a",{href:d.href,"aria-current":g?"page":void 0,onClick:b=>c(b,d),className:We("flex min-w-0 flex-1 items-center justify-center gap-1.5 rounded-md px-2 py-1.5 text-sm text-muted-foreground transition-colors hover:text-foreground",g&&"bg-card text-foreground shadow-sm"),children:[i.jsx(m,{className:"size-4 shrink-0"}),i.jsx("span",{className:"truncate",children:d.label})]},d.label)})})}function Hk({route:n,chatOpen:o,onToggleChat:r,children:l}){const c=ze(d=>d.loadConfig);return h.useEffect(()=>{c()},[c]),i.jsxs("main",{className:"flex min-w-0 flex-[5_1_50%] flex-col",children:[i.jsx(Lk,{chatOpen:o,onToggleChat:r}),i.jsx("div",{className:"shrink-0 px-3 py-2",children:i.jsx(Uk,{route:n})}),i.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto p-6",children:l})]})}function Dl(n){switch(n){case"INVALID_PROJECT_PATH":return"路径无效:请使用绝对路径,且目标目录须已含 project.json(不是项目目录)";case"PROJECT_ALREADY_EXISTS":return"该目录已是项目,请直接打开(书架列表或「打开其他路径」)";case"PROJECT_VERSION_NEWER":return"该项目由更高版本的 ai-editor 创建,请升级程序后再打开(避免降级导致数据丢失)";case"NO_PROJECT_OPEN":return"";case"CLIENT_NETWORK_ERROR":return"无法连接服务,请确认 ai-editor 服务已启动";default:return"操作失败,请稍后重试"}}function Bk(n,o){switch(n){case"PROJECT_ALREADY_EXISTS":return"同名书籍已存在,请换一个书名";case"SCHEMA_VERSION_MISMATCH":return o;case"VALIDATION_ERROR":return o;case"NO_PROJECT_OPEN":return"";case"CLIENT_NETWORK_ERROR":return"无法连接服务,请确认 ai-editor 服务已启动";default:return"导入失败,请稍后重试"}}function Yk(n,o){return n==="CLIENT_NETWORK_ERROR"?"无法连接服务,请确认 ai-editor 服务已启动":o}function pm(n){const o=n.trim();return o===""?"请输入书名":/[\\/]|^\.+$|[\u0000-\u001f]/.test(o)?"书名不能包含 /、\\ 或为 . / ..":null}let By=(function(n){return n.disabled="data-disabled",n.valid="data-valid",n.invalid="data-invalid",n.touched="data-touched",n.dirty="data-dirty",n.filled="data-filled",n.focused="data-focused",n})({});const Vk={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},_l={valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},Pk={disabled:!1,..._l},Gk={valid(n){return n===null?null:n?{[By.valid]:""}:{[By.invalid]:""}}},qk={invalid:void 0,name:void 0,validityData:{state:Vk,errors:[],error:"",value:"",initialValue:null},setValidityData:un,disabled:void 0,touched:_l.touched,setTouched:un,dirty:_l.dirty,setDirty:un,filled:_l.filled,setFilled:un,focused:_l.focused,setFocused:un,validate:()=>null,validationMode:"onSubmit",validationDebounceTime:0,shouldValidateOnChange:()=>!1,state:Pk,markedDirtyRef:{current:!1},registerFieldControl:un,validation:{getValidationProps:(n,o=Ht)=>o,inputRef:{current:null},registerInput:un,commit:async()=>{},change:un}},Fk=h.createContext(qk);function z1(n=!0){const o=h.useContext(Fk);if(o.setValidityData===un&&!n)throw new Error(En(28));return o}const Xk=h.createContext({formRef:{current:{fields:new Map}},errors:{},clearErrors:un,validationMode:"onSubmit",submitAttemptedRef:{current:!1}});function Kk(){return h.useContext(Xk)}const $k=h.createContext({controlId:void 0,registerControlId:un,labelId:void 0,setLabelId:un,messageIds:[],setMessageIds:un,getDescriptionProps:n=>n});function L1(){return h.useContext($k)}function Qk(n={}){const{id:o,implicit:r=!1,controlRef:l}=n,{controlId:c,registerControlId:d}=L1(),m=Cr(o),g=r?c:void 0,b=zn(()=>Symbol("labelable-control")),p=h.useRef(!1),v=h.useRef(o!=null),x=tt(()=>{!p.current||d===un||(p.current=!1,d(b.current,void 0))});return Ge(()=>{if(d===un)return;let S;if(r){const j=l?.current;ht(j)&&j.closest("label")!=null?S=o??null:S=g??m}else if(o!=null)v.current=!0,S=o;else if(v.current)S=m;else{x();return}if(S===void 0){x();return}p.current=!0,d(b.current,S)},[o,l,g,d,r,m,b,x]),h.useEffect(()=>x,[x]),c??m}function Zk(n,o,r,l,c=!0,d){const{registerFieldControl:m}=z1(),g=h.useRef(null);g.current||(g.current=Symbol()),Ge(()=>{const b=g.current;return!b||!c?void 0:(m(b,{controlRef:n,getValue:l,id:o,name:d,value:r}),()=>{m(b,void 0)})},[n,c,l,o,d,m,r])}const Jk=h.forwardRef(function(o,r){const{render:l,className:c,id:d,name:m,value:g,disabled:b=!1,onValueChange:p,defaultValue:v,autoFocus:x=!1,style:S,...j}=o,{state:N,name:k,disabled:O,setTouched:E,setDirty:T,validityData:_,setFocused:R,setFilled:H,validationMode:A,validation:B}=z1(),{clearErrors:M}=Kk(),Q=O||b,ne=k??m,me={...N,disabled:Q},{labelId:se}=L1(),X=Qk({id:d});Ge(()=>{const I=g!=null;B.inputRef.current?.value||I&&g!==""?H(!0):I&&g===""&&H(!1)},[B.inputRef,H,g]);const te=h.useRef(null);Ge(()=>{x&&te.current===jn(yt(te.current))&&R(!0)},[x,R]);const[$]=aw({controlled:g,default:v,name:"FieldControl",state:"value"}),w=g!==void 0,U=w?$:void 0,Y=tt(()=>B.inputRef.current?.value);return Zk(B.inputRef,X,U,Y,!Q,m),fn("input",o,{ref:[r,te],state:me,props:[{id:X,disabled:Q,name:ne,ref:B.inputRef,"aria-labelledby":se,autoFocus:x,...w?{value:U}:{defaultValue:v},onChange(I){const D=I.currentTarget.value;p?.(D,jt(i0,I.nativeEvent)),T(D!==_.initialValue),H(D!==""),I.nativeEvent.defaultPrevented||(M(ne),B.change(D))},onFocus(){R(!0)},onBlur(I){E(!0),R(!1),A==="onBlur"&&B.commit(I.currentTarget.value)},onKeyDown(I){I.currentTarget.tagName==="INPUT"&&I.key==="Enter"&&(E(!0),B.commit(I.currentTarget.value))}},j,I=>B.getValidationProps(Q,I)],stateAttributesMapping:Gk})}),Wk=h.forwardRef(function(o,r){return i.jsx(Jk,{ref:r,...o})});function Ot({className:n,type:o,...r}){return i.jsx(Wk,{type:o,"data-slot":"input",className:We("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",n),...r})}function e_(n){const o=new Date(n);if(Number.isNaN(o.getTime()))return n;const r=c=>String(c).padStart(2,"0");return o.getFullYear()===new Date().getFullYear()?`${r(o.getMonth()+1)}-${r(o.getDate())}`:`${String(o.getFullYear()).slice(-2)}-${r(o.getMonth()+1)}-${r(o.getDate())}`}function t_(){const n=Nt(m=>m.sessions),o=Nt(m=>m.sessionsLoading),r=Nt(m=>m.sessionsError),l=Nt(m=>m.loadSessions),c=Nt(m=>m.currentSessionId),d=Nt(m=>m.setCurrentSession);return h.useEffect(()=>{n===null&&!o&&r===null&&l()},[n,o,r,l]),n===null?r!==null?r==="NO_PROJECT_OPEN"?i.jsx("p",{className:"ml-3 border-l border-border py-1 pl-2 text-xs text-muted-foreground/60",children:"打开项目后查看会话"}):i.jsxs("div",{className:"ml-3 border-l border-border py-1 pl-2",children:[i.jsx("p",{className:"text-xs text-muted-foreground",children:"会话加载失败"}),i.jsx(Se,{variant:"ghost",size:"xs",className:"mt-0.5",onClick:()=>{l()},children:"重试"})]}):i.jsx("p",{className:"ml-3 border-l border-border py-1 pl-2 text-xs text-muted-foreground/60",children:"会话加载中…"}):n.length===0?i.jsx("p",{className:"ml-3 border-l border-border py-1 pl-2 text-xs text-muted-foreground/60",children:"暂无会话"}):i.jsx("ul",{className:"ml-3 border-l border-border py-0.5 pl-1.5",children:n.map(m=>i.jsx("li",{children:i.jsxs("button",{type:"button",title:m.lastMessage||"空会话",onClick:()=>d(m.id),className:We("flex h-7 w-full min-w-0 items-center gap-1.5 rounded-md px-2 text-left text-xs transition-colors",c===m.id?"bg-accent font-medium text-accent-foreground":"text-muted-foreground hover:bg-muted hover:text-foreground"),children:[i.jsx(zl,{className:"size-3 shrink-0 opacity-70"}),i.jsx("span",{className:"min-w-0 flex-1 truncate",children:m.lastMessage||"(空会话)"}),i.jsx("span",{className:"shrink-0 text-[10px] text-muted-foreground/60",children:xr(m.updatedAt)})]})},m.id))})}function n_(){const{theme:n,toggleTheme:o}=D1(),r=ze(L=>L.config),l=ze(L=>L.bookshelf),c=ze(L=>L.bookshelfLoading),d=ze(L=>L.bookshelfError),m=ze(L=>L.loadBookshelf),g=ze(L=>L.openProjectAt),b=ze(L=>L.createProjectAt),[p,v]=h.useState(null),[x,S]=h.useState(!1),[j,N]=h.useState(""),[k,O]=h.useState(null),[E,T]=h.useState(!1),[_,R]=h.useState(!1),[H,A]=h.useState(null),[B,M]=h.useState(""),[Q,ne]=h.useState(null),[me,se]=h.useState(!1),[X,te]=h.useState(!1);h.useEffect(()=>{!c&&l===null&&d===null&&m()},[c,l,d,m]);async function $(L){try{await g(L),v(L)}catch(q){ke.getState().showToast(Dl(q instanceof Ue?q.code:null),"error")}}const w=r?.id??null,U=h.useRef(w);h.useEffect(()=>{U.current!==w&&(U.current=w,v(null))},[w]);function Y(){N(""),O(null),S(!1)}async function z(L){L.preventDefault();const q=j.trim(),Z=pm(q);if(Z!==null){O(Z);return}if(!l){O("书架未加载,请稍后重试");return}T(!0),O(null);try{await b(Dv(l.rootPath,q),{name:q,language:"zh"}),ke.getState().showToast(`已创建并打开《${q}》`),await m();const V=ze.getState().bookshelf?.books.find(be=>be.name===q);V&&v(V.path),N(""),S(!1)}catch(V){O(Dl(V instanceof Ue?V.code:null))}finally{T(!1)}}async function I(L){if(!X){te(!0);try{const{blob:q,filename:Z}=await hT(),V=URL.createObjectURL(q),be=document.createElement("a");be.href=V,be.download=Z,document.body.appendChild(be),be.click(),be.remove(),setTimeout(()=>URL.revokeObjectURL(V),0),ke.getState().showToast(`已导出《${L}》备份`)}catch(q){ke.getState().showToast(Yk(q instanceof Ue?q.code:null,q instanceof Ue?q.message:"导出失败,请重试"),"error")}finally{te(!1)}}}function D(L){const q=L.target.files?.[0]??null;A(q),ne(null),q&&M(Z=>Z.trim()===""?q.name.replace(/\.zip$/i,""):Z)}async function G(L){L.preventDefault();const q=B.trim();if(!H){ne("请选择备份文件");return}const Z=pm(q);if(Z!==null){ne(Z);return}se(!0),ne(null);try{await gT(H,q),ke.getState().showToast(`已导入《${q}》`),await m(),R(!1),A(null),M("")}catch(V){const be=Bk(V instanceof Ue?V.code:null,V instanceof Ue?V.message:"导入失败,请重试");ne(be),be!==""&&ke.getState().showToast(be,"error")}finally{se(!1)}}return i.jsxs("aside",{className:"flex min-w-0 flex-[1_1_10%] flex-col border-r border-border bg-sidebar",children:[i.jsxs("a",{href:"#/",className:"flex h-12 shrink-0 items-center gap-1.5 border-b border-border px-3 font-serif text-base italic text-foreground hover:text-primary",children:[i.jsx("span",{className:"text-primary",children:"◈"}),i.jsx("span",{className:"truncate",children:"我的小说"})]}),i.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto px-2 py-2",children:[i.jsxs("div",{className:"mb-1 flex items-center justify-between px-1",children:[i.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"书架"}),i.jsxs("div",{className:"flex items-center gap-0.5",children:[i.jsx(Se,{variant:"ghost",size:"icon-xs",onClick:()=>R(!0),"aria-label":"导入备份",title:"导入备份(zip)",children:i.jsx(Yj,{})}),x?i.jsx(Se,{variant:"ghost",size:"icon-xs",onClick:Y,"aria-label":"取消新建项目",title:"取消新建",children:i.jsx(ro,{})}):i.jsx(Se,{variant:"ghost",size:"icon-xs",onClick:()=>S(!0),"aria-label":"新建项目",title:"新建项目",children:i.jsx(jm,{})})]})]}),x&&i.jsxs("form",{onSubmit:z,className:"mb-1 flex flex-col gap-1 px-1","aria-label":"新建项目",children:[i.jsx(Ot,{value:j,onChange:L=>N(L.target.value),onKeyDown:L=>{L.key==="Escape"&&Y()},onBlur:Y,placeholder:"书名,回车创建",maxLength:60,disabled:E,autoFocus:!0,"aria-label":"书名"}),k&&i.jsx("p",{className:"text-xs text-destructive",children:k})]}),d!==null&&i.jsxs("div",{className:"flex flex-col items-start gap-1 px-1 py-2",children:[i.jsx("p",{className:"text-xs text-muted-foreground",children:d===vt?"无法连接服务":"书架加载失败"}),i.jsx(Se,{variant:"ghost",size:"xs",onClick:()=>{m()},children:"重试"})]}),c&&l===null&&i.jsx("div",{className:"space-y-1 px-1 py-2",children:[0,1,2].map(L=>i.jsx("div",{className:"h-8 animate-pulse rounded-lg bg-muted"},L))}),d===null&&!c&&l&&l.books.length===0&&i.jsx("p",{className:"px-1 py-2 text-xs text-muted-foreground/70",children:"还没有书,先创建一本"}),d===null&&l&&l.books.length>0&&i.jsx("ul",{className:"space-y-0.5",children:l.books.map(L=>{const q=p===L.path,Z=r!==null&&L.name===r.name;return i.jsxs("li",{children:[i.jsxs("div",{className:"flex items-center",children:[i.jsxs("button",{type:"button",title:`打开《${L.name}》`,onClick:()=>{$(L.path)},className:We("flex h-8 min-w-0 flex-1 items-center gap-1.5 rounded-lg px-2 text-left text-sm transition-colors",Z?"bg-muted font-medium text-foreground":"text-muted-foreground hover:bg-muted hover:text-foreground"),children:[i.jsx(vm,{className:We("size-3.5 shrink-0",Z?"text-primary":"text-muted-foreground/60")}),i.jsx("span",{className:"min-w-0 flex-1 truncate",children:L.name}),i.jsx("span",{className:"shrink-0 text-[10px] text-muted-foreground/60",title:ls(L.updatedAt),children:e_(L.updatedAt)})]}),Z&&i.jsx("button",{type:"button",onClick:()=>{I(L.name)},disabled:X,"aria-label":`导出《${L.name}》备份`,title:"导出备份(zip)",className:"flex h-8 w-6 shrink-0 items-center justify-center rounded-lg text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:pointer-events-none disabled:opacity-50",children:X?i.jsx(Nm,{className:"size-3.5 animate-spin"}):i.jsx(WN,{className:"size-3.5"})}),i.jsx("button",{type:"button",onClick:()=>v(V=>V===L.path?null:L.path),"aria-expanded":q,"aria-label":q?`收起《${L.name}》会话`:`展开《${L.name}》会话`,className:"flex h-8 w-6 shrink-0 items-center justify-center rounded-lg text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",children:i.jsx(Nv,{className:We("size-4 transition-transform duration-200",q&&"rotate-90")})})]}),q&&i.jsx(t_,{})]},L.path)})})]}),i.jsxs("div",{className:"flex shrink-0 flex-col gap-1 border-t border-border p-2",children:[i.jsxs("a",{href:"#/settings",className:"flex h-8 items-center gap-2 rounded-lg px-2 text-sm text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",children:[i.jsx(Mj,{className:"size-4 shrink-0"}),i.jsx("span",{className:"truncate",children:"设置"})]}),i.jsxs(Se,{variant:"ghost",size:"sm",className:"justify-start text-muted-foreground",onClick:o,"aria-label":"切换主题",children:[n==="dark"?i.jsx(Ij,{className:"size-4 shrink-0"}):i.jsx(hj,{className:"size-4 shrink-0"}),i.jsx("span",{className:"truncate",children:n==="dark"?"浅色模式":"深色模式"})]})]}),i.jsx($s,{open:_,onOpenChange:L=>{R(L),L||(ne(null),A(null),M(""))},children:i.jsxs(Qs,{className:"sm:max-w-sm",children:[i.jsxs(Zs,{children:[i.jsx(Ws,{children:"导入书籍"}),i.jsx(kk,{children:"从备份 zip 导入为新书,数据原样恢复;导入后从书架打开"})]}),i.jsxs("form",{id:"import-book-form",onSubmit:G,className:"flex flex-col gap-3",children:[i.jsx("input",{type:"file",accept:".zip,application/zip",onChange:D,disabled:me,"aria-label":"选择备份文件",className:"block w-full cursor-pointer rounded-md border border-border bg-card px-3 py-1.5 text-sm text-foreground file:mr-2 file:cursor-pointer file:rounded file:border-0 file:bg-muted file:px-2 file:py-1 file:text-xs file:text-muted-foreground disabled:opacity-50"}),i.jsx(Ot,{value:B,onChange:L=>M(L.target.value),placeholder:"书名(默认取文件名)",maxLength:60,disabled:me}),Q&&i.jsx("p",{className:"text-sm text-destructive",children:Q})]}),i.jsxs(Js,{children:[i.jsx(Se,{variant:"outline",type:"button",onClick:()=>R(!1),disabled:me,children:"取消"}),i.jsx(Se,{type:"submit",form:"import-book-form",disabled:me||H===null,children:me?"导入中…":"导入"})]})]})})]})}function s_({route:n,children:o}){const[r,l]=h.useState(!1);return i.jsxs("div",{className:"flex h-screen overflow-hidden",children:[i.jsx(n_,{}),i.jsx(Hk,{route:n,chatOpen:r,onToggleChat:()=>l(c=>!c),children:o}),i.jsx(UO,{open:r,onClose:()=>l(!1)}),i.jsx(zk,{})]})}class o_ extends h.Component{state={error:null};static getDerivedStateFromError(o){return{error:o}}componentDidCatch(o,r){console.error("[ErrorBoundary] 渲染异常:",o,r.componentStack)}render(){const{error:o}=this.state;return o===null?this.props.children:i.jsx("div",{className:"flex h-full min-h-64 flex-col items-center justify-center gap-3 p-8",children:i.jsxs("div",{className:"flex flex-col items-center gap-2 rounded-xl border border-destructive/30 bg-destructive/10 px-8 py-6 text-center",children:[i.jsx(Sm,{className:"size-8 text-destructive"}),i.jsx("p",{className:"font-serif text-base font-medium text-foreground",children:"界面出现异常"}),i.jsx("p",{className:"max-w-md text-sm text-muted-foreground",children:"数据不会丢失,请重新加载页面继续写作。"}),i.jsx("p",{className:"max-w-md break-all font-mono text-xs text-destructive/80",children:o.message||String(o)}),i.jsxs("div",{className:"mt-2 flex gap-2",children:[i.jsxs(Se,{type:"button",onClick:()=>window.location.reload(),children:[i.jsx(Rj,{className:"size-4"}),"重新加载"]}),i.jsx(Se,{variant:"outline",type:"button",onClick:()=>{window.location.hash="#/",window.location.reload()},children:"回到首页"})]})]})})}}function Cs(n){const o=ke(l=>l.dataVersion),r=h.useRef(o);h.useEffect(()=>{o!==r.current&&(r.current=o,n())},[o])}const Yy={character:"人物",setting:"设定",location:"地点",hook:"伏笔",event:"事件"},Vy=["character","setting","location","hook"];function r_(n){const o={volumes:0,chapters:0,scenes:0,updatedAt:null},r=l=>{for(const c of l)c.type==="volume"?o.volumes+=1:c.type==="chapter"?o.chapters+=1:o.scenes+=1,(o.updatedAt===null||c.updatedAt>o.updatedAt)&&(o.updatedAt=c.updatedAt),c.type!=="scene"&&c.children&&r(c.children)};return r(n),o}function Bf(n){return n instanceof Ue?n.code:null}function Py(){const n=ze(ye=>ye.config),o=ze(ye=>ye.configLoading),r=ze(ye=>ye.outline),l=ze(ye=>ye.outlineLoading),c=ze(ye=>ye.loadOutline),d=ze(ye=>ye.bookshelf),m=ze(ye=>ye.bookshelfLoading),g=ze(ye=>ye.bookshelfError),b=ze(ye=>ye.loadBookshelf),p=ze(ye=>ye.openProjectAt),v=ze(ye=>ye.createProjectAt),x=Nt(ye=>ye.sessions),S=Nt(ye=>ye.sessionsLoading),j=Nt(ye=>ye.sessionsError),N=Nt(ye=>ye.loadSessions),k=Nt(ye=>ye.setCurrentSession),O=Nt(ye=>ye.currentSessionId),E=ke(ye=>ye.setFocusOutlineNode),[T,_]=h.useState(""),[R,H]=h.useState(null),[A,B]=h.useState(null),[M,Q]=h.useState(!1),[ne,me]=h.useState(!1),[se,X]=h.useState(""),[te,$]=h.useState(null),[w,U]=h.useState(!1),[Y,z]=h.useState(null),[I,D]=h.useState(!1),[G,L]=h.useState(null),[q,Z]=h.useState(0),[V,be]=h.useState(!1),ue=n===null&&!o,he=r?r_(r.children):null,Le=n?.currentPosition!=null?Av(r,n.currentPosition)??n.currentPosition:null;h.useEffect(()=>{ue&&!m&&d===null&&g===null&&b()},[ue,m,d,g,b]),h.useEffect(()=>{be(!1)},[n?.id]),Cs(()=>{Z(ye=>ye+1),c(),N()}),h.useEffect(()=>{B(null)},[n?.id]),h.useEffect(()=>{n!==null&&r===null&&!l&&!V&&(be(!0),c())},[n,r,l,V,c]),h.useEffect(()=>{if(n===null)return;let ye=!1;return z(null),D(!0),L(null),Promise.allSettled(Vy.map(async Ie=>({type:Ie,total:(await br(Ie,{limit:1})).total}))).then(Ie=>{if(ye)return;const oe={};let ce=!1;for(const de of Ie)de.status==="fulfilled"?oe[de.value.type]=de.value.total:ce=!0;z(oe),L(ce?"要素统计加载失败":null),D(!1)}),()=>{ye=!0}},[n,q]),h.useEffect(()=>{n!==null&&x===null&&!S&&j===null&&N()},[n,x,S,j,N]);async function qe(ye){ye.preventDefault();const Ie=T.trim(),oe=pm(Ie);if(oe!==null){H(oe);return}if(!d){H("书架未加载,请稍后重试");return}U(!0),H(null);try{await v(Dv(d.rootPath,Ie),{name:Ie,language:"zh"}),await b(),ke.getState().showToast(`已创建并打开《${Ie}》`),_("")}catch(ce){H(Dl(Bf(ce)))}finally{U(!1)}}async function we(ye){if(ye.preventDefault(),!se.trim()){$("请输入项目目录路径(绝对路径)");return}U(!0),$(null);try{await p(se.trim())}catch(Ie){$(Dl(Bf(Ie)))}finally{U(!1)}}async function De(ye){B(null);try{await p(ye)}catch(Ie){B(Dl(Bf(Ie)))}}function Ae(){n?.currentPosition!=null&&E(n.currentPosition)}if(o)return i.jsx("section",{children:i.jsx("p",{className:"mt-4 text-sm text-muted-foreground",children:"加载中…"})});if(ue){let ye=function(de){return i.jsxs("form",{onSubmit:qe,className:de,children:[i.jsxs("div",{className:"flex gap-2",children:[i.jsx(Ot,{value:T,onChange:Te=>_(Te.target.value),placeholder:"书名",maxLength:60,disabled:w}),i.jsx(Se,{type:"submit",disabled:w||d===null,children:"新建"})]}),R&&i.jsx("p",{className:"text-left text-sm text-destructive",children:R})]})};const Ie=d===null&&m,oe=g!==null,ce=d!==null&&d.books.length>0;return i.jsxs("section",{children:[g!==null&&i.jsxs("div",{className:"mx-auto mt-2 max-w-md rounded-md border border-border bg-card p-3",children:[i.jsx("p",{className:"text-sm text-muted-foreground",children:g===vt?"无法连接服务,请确认 ai-editor 服务已启动后重试。":"书架加载失败,请重试。"}),i.jsx(Se,{variant:"outline",size:"sm",className:"mt-2",onClick:()=>{b()},type:"button",children:"重试"})]}),i.jsx("div",{className:"mx-auto mt-10 max-w-md rounded-2xl border border-dashed border-border bg-card px-6 py-8 text-center",children:Ie?i.jsxs("div",{className:"py-2",children:[i.jsx("div",{className:"mx-auto h-6 w-2/3 animate-pulse rounded bg-muted"}),i.jsx("div",{className:"mx-auto mt-2 h-4 w-1/2 animate-pulse rounded bg-muted"}),i.jsxs("div",{className:"mt-5 space-y-2",children:[i.jsx("div",{className:"h-10 animate-pulse rounded-lg bg-muted"}),i.jsx("div",{className:"h-10 animate-pulse rounded-lg bg-muted"})]})]}):i.jsxs(i.Fragment,{children:[ce?i.jsxs(i.Fragment,{children:[i.jsx("h1",{className:"font-serif text-lg text-foreground",children:"书架里有书,打开即可写作"}),i.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"选择一本书打开,或新建一本"}),i.jsx("ul",{className:"mt-5 divide-y divide-border overflow-hidden rounded-lg border border-border text-left",children:d.books.map(de=>i.jsx("li",{children:i.jsxs("button",{type:"button",title:`打开《${de.name}》`,onClick:()=>{De(de.path)},className:"flex w-full items-center gap-3 px-3 py-2.5 text-left transition-colors hover:bg-muted",children:[i.jsx(vm,{className:"size-4 shrink-0 text-muted-foreground/60"}),i.jsx("span",{className:"min-w-0 flex-1 truncate text-sm text-foreground",children:de.name}),i.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:xr(de.updatedAt)})]})},de.path))}),A!==null&&i.jsx("p",{className:"mt-3 text-left text-sm text-destructive",children:A}),i.jsxs("div",{className:"mt-4 border-t border-border pt-3",children:[i.jsx("button",{type:"button",className:"text-sm text-muted-foreground transition-colors hover:text-foreground",onClick:()=>Q(de=>!de),children:M?"收起":"新建一本…"}),M&&ye("mt-2 flex flex-col gap-2 text-left")]})]}):oe?i.jsx("p",{className:"py-6 text-sm text-muted-foreground",children:"书架加载失败,重试后可查看书籍或新建"}):i.jsxs(i.Fragment,{children:[i.jsx("h1",{className:"font-serif text-lg text-foreground",children:"还没有书,先创建一本"}),i.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"每本书一个独立目录(books/书名/),写作数据互不干扰"}),ye("mx-auto mt-5 flex flex-col gap-2"),i.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:"创建于 创作根/books/书名/ 目录"})]}),i.jsxs("div",{className:"mt-4 border-t border-border pt-3",children:[i.jsx("button",{type:"button",className:"text-sm text-muted-foreground transition-colors hover:text-foreground",onClick:()=>me(de=>!de),children:ne?"收起":"打开其他路径…"}),ne&&i.jsxs("form",{onSubmit:we,className:"mt-2 flex flex-col gap-2 text-left",children:[i.jsx(Ot,{value:se,onChange:de=>X(de.target.value),placeholder:"/absolute/path/to/project(须含 project.json)",disabled:w}),i.jsx("div",{children:i.jsx(Se,{type:"submit",variant:"outline",disabled:w,children:"打开"})}),te&&i.jsx("p",{className:"text-sm text-destructive",children:te})]})]})]})})]})}return i.jsxs("section",{children:[i.jsx("div",{className:"mb-4",children:i.jsx("h1",{className:"font-serif text-xl font-medium text-foreground",children:"项目概览"})}),i.jsxs("div",{className:"grid gap-4 lg:grid-cols-2",children:[i.jsxs("section",{className:"rounded-xl border border-border bg-card p-4",children:[i.jsx("h2",{className:"font-serif text-base text-foreground",children:"项目信息"}),i.jsxs("dl",{className:"mt-3 space-y-2 text-sm",children:[i.jsxs("div",{className:"flex items-baseline gap-2",children:[i.jsx("dt",{className:"w-16 shrink-0 text-muted-foreground",children:"名称"}),i.jsx("dd",{className:"min-w-0 truncate font-medium text-foreground",children:n?.name})]}),i.jsxs("div",{className:"flex items-baseline gap-2",children:[i.jsx("dt",{className:"w-16 shrink-0 text-muted-foreground",children:"语言"}),i.jsx("dd",{className:"text-foreground",children:n?.language==="zh"?"中文":"English"})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("dt",{className:"w-16 shrink-0 text-muted-foreground",children:"当前位置"}),i.jsx("dd",{className:"min-w-0 flex-1 truncate",children:n?.currentPosition!=null?i.jsx("a",{href:"#/outline",onClick:Ae,className:"text-primary hover:underline",children:Le??n.currentPosition}):i.jsx("span",{className:"text-muted-foreground",children:"未设置"})}),i.jsx("a",{href:"#/outline",onClick:Ae,className:Wf({variant:"outline",size:"xs"}),children:"去大纲"})]})]}),i.jsxs("div",{className:"mt-3 border-t border-border pt-3",children:[i.jsx("p",{className:"text-xs text-muted-foreground",children:"项目提示词"}),i.jsx("p",{className:"mt-1 line-clamp-2 text-sm text-foreground/90",children:n?.prompt||"(未设置)"})]})]}),i.jsxs("section",{className:"rounded-xl border border-border bg-card p-4",children:[i.jsx("h2",{className:"font-serif text-base text-foreground",children:"创作要素"}),I&&Y===null?i.jsx("div",{className:"mt-3 grid grid-cols-2 gap-2",children:[0,1,2,3].map(ye=>i.jsx("div",{className:"h-20 animate-pulse rounded-lg bg-muted"},ye))}):i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"mt-3 grid grid-cols-2 gap-2",children:Vy.map(ye=>i.jsxs("a",{href:`#/entities/${ye}`,className:"group rounded-lg border border-border bg-background p-3 transition-colors hover:border-primary/40 hover:bg-muted",title:`查看${Yy[ye]}列表`,children:[i.jsx("p",{className:"font-serif text-2xl font-semibold text-foreground",children:Y?.[ye]??"–"}),i.jsx("p",{className:"mt-0.5 text-xs text-muted-foreground transition-colors group-hover:text-foreground",children:Yy[ye]})]},ye))}),G!==null&&i.jsxs("div",{className:"mt-2 flex items-center gap-2 text-xs text-destructive",children:[G,i.jsx(Se,{variant:"outline",size:"xs",type:"button",onClick:()=>Z(ye=>ye+1),children:"重试"})]})]})]}),i.jsxs("section",{className:"rounded-xl border border-border bg-card p-4 lg:col-span-2",children:[i.jsx("h2",{className:"font-serif text-base text-foreground",children:"大纲概览"}),r===null&&(l||!V)?i.jsxs("div",{className:"mt-3 space-y-2",children:[i.jsx("div",{className:"h-5 w-2/5 animate-pulse rounded bg-muted"}),i.jsx("div",{className:"h-4 w-1/3 animate-pulse rounded bg-muted"})]}):r===null?i.jsxs("div",{className:"mt-3 flex items-center gap-2 text-sm text-muted-foreground",children:["大纲加载失败",i.jsx(Se,{variant:"outline",size:"xs",type:"button",onClick:()=>be(!1),children:"重试"})]}):i.jsxs(i.Fragment,{children:[i.jsxs("p",{className:"mt-3 text-sm text-foreground",children:["卷 ",he?.volumes??0," · 章 ",he?.chapters??0," · 场景"," ",he?.scenes??0]}),i.jsxs("p",{className:"mt-1 text-xs text-muted-foreground",children:["最近更新: ",he?.updatedAt?xr(he.updatedAt):"—"]}),r.children.length===0&&i.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-2",children:[i.jsx("p",{className:"text-xs text-muted-foreground",children:"大纲还是空的"}),i.jsx(Se,{variant:"ghost",size:"xs",type:"button",onClick:()=>k(null),children:"和 AI 聊聊设定"})]}),i.jsx("div",{className:"mt-3",children:i.jsx("a",{href:"#/outline",onClick:Ae,className:We(Wf({variant:"outline",size:"sm"})),children:"去大纲编辑"})})]})]}),i.jsxs("section",{className:"rounded-xl border border-border bg-card p-4 lg:col-span-2",children:[i.jsx("h2",{className:"font-serif text-base text-foreground",children:"最近会话"}),x===null?j!==null?i.jsxs("div",{className:"mt-3 flex items-center gap-2 text-sm text-muted-foreground",children:["会话加载失败",i.jsx(Se,{variant:"outline",size:"xs",type:"button",onClick:()=>{N()},children:"重试"})]}):i.jsx("div",{className:"mt-3 space-y-2",children:[0,1,2].map(ye=>i.jsx("div",{className:"h-8 animate-pulse rounded-md bg-muted"},ye))}):x.length===0?i.jsxs("div",{className:"mt-3",children:[i.jsx("p",{className:"text-sm text-muted-foreground",children:"还没有会话,和 AI 聊聊设定吧"}),i.jsx(Se,{variant:"outline",size:"sm",className:"mt-3",type:"button",onClick:()=>k(null),children:"开始新对话"})]}):i.jsxs(i.Fragment,{children:[i.jsx("ul",{className:"mt-3 divide-y divide-border rounded-lg border border-border",children:x.slice(0,5).map(ye=>i.jsx("li",{children:i.jsxs("button",{type:"button",title:ye.lastMessage||"空会话",onClick:()=>k(ye.id),className:We("flex w-full items-center gap-3 px-3 py-2 text-left transition-colors hover:bg-muted",O===ye.id&&"bg-accent/40 hover:bg-accent/40"),children:[i.jsx("span",{className:"min-w-0 flex-1 truncate text-sm text-foreground",children:ye.lastMessage||"(空会话)"}),i.jsxs("span",{className:"shrink-0 text-xs text-muted-foreground",children:[ye.messageCount," 条消息"]}),i.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:xr(ye.updatedAt)})]})},ye.id))}),i.jsx("div",{className:"mt-3",children:i.jsx(Se,{variant:"outline",size:"sm",type:"button",onClick:()=>k(null),children:"开始新对话"})})]})]})]})]})}const Gy={plants:"埋设",advances:"推进",resolves:"回收"},a_={plants:Sj,advances:nj,resolves:Em};function I1({mark:n}){const o=a_[n.relationType];return i.jsx("span",{className:"shrink-0 rounded px-0.5 text-muted-foreground hover:text-foreground",title:`${Gy[n.relationType]}伏笔:${n.hookName}`,"aria-label":`${Gy[n.relationType]}伏笔:${n.hookName}`,children:i.jsx(o,{className:"size-3"})})}const Ep=["plants","advances","resolves"],qy=["plants","advances","resolves"];function Fy(n){const o=qy.indexOf(n);return o===-1?qy.length:o}function U1(n){const o=new Map;for(const r of n){if(!Ep.includes(r.relationType)||r.sourceType!=="outline_node"||r.targetType!=="hook")continue;const l={relationType:r.relationType,hookId:r.targetId,hookName:r.targetName??r.targetId},c=o.get(r.sourceId);c===void 0?o.set(r.sourceId,[l]):c.push(l)}for(const r of o.values())r.sort((l,c)=>Fy(l.relationType)-Fy(c.relationType)||(l.hookName<c.hookName?-1:l.hookName>c.hookName?1:0)||(l.hookId<c.hookId?-1:l.hookId>c.hookId?1:0));return o}const Sn="root",Xy={id:Sn,label:"(根)",depth:0};function l_(n,o){if(o==="volume")return[Xy];const r=o==="chapter"?[Xy]:[],l=(c,d)=>{for(const m of c)o==="chapter"&&m.type==="volume"?r.push({id:m.id,label:m.title,depth:d}):o==="scene"&&m.type==="chapter"&&r.push({id:m.id,label:m.title,depth:d}),m.children&&l(m.children,d+1)};return l(n,1),r}function Ho(n,o){for(const r of n){if(r.id===o)return r;if(r.type!=="scene"&&r.children){const l=Ho(r.children,o);if(l)return l}}return null}function Np(n,o,r=[]){for(const l of n){const c=[...r,l.id];if(l.id===o)return c;if(l.type!=="scene"&&l.children){const d=Np(l.children,o,c);if(d)return d}}return null}function oo(n,o=0,r=[]){for(const l of n)r.push({id:l.id,label:l.title,depth:o}),l.type!=="scene"&&l.children&&oo(l.children,o+1,r);return r}function i_(n,o,r){const l=Ho(n,o);if(!l)return!1;const c=d=>d.id===r?!0:d.type!=="scene"&&d.children?d.children.some(m=>c(m)):!1;return c(l)}function yc(n,o,r){return o===n.id||i_(r,n.id,o)?!1:l_(r,n.type).some(l=>l.id===o)}function H1(n,o){const r=o.trim();return r!==""&&r!==n.trim()}function B1(n,o){return o.trim()!==(n??"").trim()}function c_(n){return n==="OUTLINE_NODE_NOT_FOUND"?"abandon":"restore"}function Y1(n,o){if(o===Sn)return n;const r=l=>{for(const c of l){if(c.id===o)return c.children??[];if(c.children){const d=r(c.children);if(d)return d}}return null};return r(n)}function Ky(n,o,r){const l=r===void 0?n:n.filter(d=>d.id!==r);if(o.kind==="end")return l.length;const c=l.findIndex(d=>d.id===o.nodeId);return c===-1?l.length:o.kind==="before"?c:c+1}function $y(n,o){return n===null||o===null?n===o:n.kind==="root-end"||o.kind==="root-end"?n.kind===o.kind:n.kind===o.kind&&n.nodeId===o.nodeId}function hm(n,o){const r=(l,c)=>{for(const d of l){if(d.id===o)return c;if(d.children){const m=r(d.children,d.id);if(m!==null)return m}}return null};return r(n,Sn)}function u_(n,o){const r=hm(n,o);if(r===null)return null;const c=(Y1(n,r)??[]).findIndex(d=>d.id===o);return c===-1?null:{parentId:r,index:c}}function Qy(n,o,r,l){const c=u_(n,o);return c===null||c.parentId!==r?!1:l===c.index}function vc(n){return n instanceof Ue?n.code:null}function ga(n){switch(n){case"OUTLINE_NODE_NOT_FOUND":return"节点不存在(可能已被彻底删除),大纲已刷新";case"CLIENT_NETWORK_ERROR":return"无法连接服务,请确认 ai-editor 服务已启动";default:return"操作失败,请稍后重试"}}function wc(n,o,r,l,c){return i.jsx("input",{autoFocus:!0,value:n,onChange:d=>o(d.target.value),onKeyDown:r,onBlur:l,maxLength:200,placeholder:c,className:"min-w-0 flex-1 rounded border border-border bg-card px-1.5 py-0.5 text-sm text-foreground focus:outline-none focus-visible:ring-2 focus-visible:ring-ring"})}function Zy({type:n,onTypeChange:o,value:r,onChange:l,onKeyDown:c,onCancel:d,className:m}){return i.jsxs("div",{className:We("flex items-center gap-2 rounded-md px-2 py-1",m),children:[i.jsx("div",{className:"flex shrink-0 gap-1",children:["volume","chapter"].map(g=>i.jsx("button",{type:"button",onClick:()=>o(g),className:We("rounded border px-2 py-0.5 text-xs transition-colors",n===g?"border-primary bg-primary text-primary-foreground":"border-border text-muted-foreground hover:bg-muted hover:text-foreground"),children:os[g]},g))}),wc(r,l,c,d,`新${os[n]}标题,Enter 创建`)]})}function d_(){const n=ze(F=>F.outline),o=ze(F=>F.outlineLoading),r=ze(F=>F.config),l=ze(F=>F.configLoading),c=ze(F=>F.loadOutline),d=ke(F=>F.focusOutlineNodeId),m=ke(F=>F.clearFocusOutlineNode);Cs(()=>{c()});const[g,b]=h.useState(!1),[p,v]=h.useState(null),[x,S]=h.useState(new Set),[j,N]=h.useState(null),[k,O]=h.useState(!1),[E,T]=h.useState(null),[_,R]=h.useState(null),[H,A]=h.useState(null),[B,M]=h.useState(""),[Q,ne]=h.useState(null),[me,se]=h.useState(""),[X,te]=h.useState(null),[$,w]=h.useState(null),[U,Y]=h.useState(null),z=r===null&&!l;h.useEffect(()=>{n===null&&!o&&!g&&(b(!0),c())},[n,o,g,c]),h.useEffect(()=>{if(n===null){Y(null);return}let F=!1;return Promise.all(Ep.map(pe=>ja({source_type:"outline_node",relation_type:pe,depth:1}).then(J=>J.relations).catch(()=>[]))).then(pe=>{F||Y(U1(pe.flat()))}),()=>{F=!0}},[n]),h.useEffect(()=>{if(E===null)return;const F=setTimeout(()=>T(null),3e3);return()=>clearTimeout(F)},[E]),h.useEffect(()=>{if(d===null||n===null)return;const F=d,pe=Np(n.children,F);if(pe===null){m();return}S(je=>{if(pe.every(Ne=>!je.has(Ne)))return je;const Fe=new Set(je);for(const Ne of pe)Fe.delete(Ne);return Fe});const J=setTimeout(()=>{const je=document.querySelector(`[data-node-id="${F}"]`);je&&(je.scrollIntoView({block:"center"}),R(F)),m()},0);return()=>clearTimeout(J)},[d,n,m]),h.useEffect(()=>{if(_===null)return;const F=setTimeout(()=>R(null),3e3);return()=>clearTimeout(F)},[_]);async function I(F,pe){F&&G(F),await c(),pe&&T(pe)}function D(F){S(pe=>{const J=new Set(pe);return J.has(F)?J.delete(F):J.add(F),J})}function G(F){S(pe=>{if(!pe.has(F))return pe;const J=new Set(pe);return J.delete(F),J})}function L(F,pe=[]){for(const J of F)J.type!=="scene"&&J.children&&J.children.length>0&&(pe.push(J.id),L(J.children,pe));return pe}function q(F,pe){he(),A({nodeId:F.id,field:pe}),M(pe==="title"?F.title:F.summary??"")}function Z(){A(null),M("")}async function V(F,pe){if(!H||H.nodeId!==F.id||H.field!==pe||k)return;const J=B;if(!(pe==="title"?H1(F.title,J):B1(F.summary,J))){Z();return}O(!0);try{await _v(F.id,pe==="title"?{title:J.trim()}:{summary:J.trim()}),Z(),ke.getState().showToast("已保存"),await I()}catch(Fe){const Ne=vc(Fe);if(c_(Ne)==="abandon"){Z(),v(ga(Ne)),await I();return}v(ga(Ne))}finally{O(!1)}}function be(F,pe){return J=>{J.key==="Enter"?(J.preventDefault(),V(F,pe)):J.key==="Escape"&&Z()}}function ue(F,pe){Z(),ne({parentId:F,type:pe}),se(""),F!==Sn&&G(F)}function he(){ne(null),se("")}async function Le(){if(!Q)return;const F=me.trim(),{parentId:pe,type:J}=Q;if(!F){he();return}he();try{const je=await eT({type:J,title:F,parent_id:pe});ke.getState().showToast(`已创建${os[J]}《${F}》`),await I(pe,je.id)}catch(je){v(ga(vc(je)))}}function qe(F){F.key==="Enter"?(F.preventDefault(),Le()):F.key==="Escape"&&he()}function we(F,pe){F.dataTransfer.setData("text/plain",pe.id),F.dataTransfer.effectAllowed="move",te(pe.id),w(null)}function De(){te(null),w(null)}function Ae(F){const pe=F.currentTarget.getBoundingClientRect();return F.clientY<pe.top+pe.height/2?"before":"after"}function ye(F,pe){F.stopPropagation();const J=X?Ho(n?.children??[],X):null;if(!J)return;const je=hm(n?.children??[],pe)??Sn;if(!yc(J,je,n?.children??[]))return;F.preventDefault(),F.dataTransfer.dropEffect="move";const Fe={kind:Ae(F),nodeId:pe};w(Ne=>$y(Ne,Fe)?Ne:Fe)}function Ie(F,pe){F.currentTarget.contains(F.relatedTarget)||w(J=>J!==null&&J.kind!=="root-end"&&J.nodeId===pe?null:J)}async function oe(F,pe){if(F.stopPropagation(),F.preventDefault(),!X)return;const J=Ho(n?.children??[],X);if(!J)return;const je=hm(n?.children??[],pe)??Sn;if(!yc(J,je,n?.children??[]))return;if(pe===J.id){te(null),w(null);return}const Fe=Y1(n?.children??[],je)??[],Ne=Ky(Fe,{kind:Ae(F),nodeId:pe},J.id);if(Qy(n?.children??[],J.id,je,Ne)){te(null),w(null);return}O(!0);try{await Lb(J.id,{parent_id:je,order:Ne}),ke.getState().showToast(`已移动《${J.title}》`),await I(je)}catch(Oe){v(ga(vc(Oe)))}finally{O(!1),te(null),w(null)}}function ce(F){const pe=X?Ho(n?.children??[],X):null;!pe||!yc(pe,Sn,n?.children??[])||(F.preventDefault(),F.dataTransfer.dropEffect="move",w(J=>$y(J,{kind:"root-end"})?J:{kind:"root-end"}))}function de(F){F.currentTarget.contains(F.relatedTarget)||w(pe=>pe?.kind==="root-end"?null:pe)}async function Te(F){if(F.preventDefault(),!X)return;const pe=Ho(n?.children??[],X);if(!pe||!yc(pe,Sn,n?.children??[]))return;const J=Ky(n?.children??[],{kind:"end"},pe.id);if(Qy(n?.children??[],pe.id,Sn,J)){te(null),w(null);return}O(!0);try{await Lb(pe.id,{parent_id:Sn,order:J}),ke.getState().showToast(`已移动《${pe.title}》`),await I()}catch(je){v(ga(vc(je)))}finally{O(!1),te(null),w(null)}}async function Me(){if(j)try{const F=await tT(j.id),{children:pe,relations:J,deltas:je}=F.cascaded,Fe=[];pe>0&&Fe.push(`${pe} 个子节点`),J>0&&Fe.push(`${J} 条关联`),je>0&&Fe.push(`${je} 条变化记录`),ke.getState().showToast(`已移入回收站${Fe.length>0?`(含 ${Fe.join("、")})`:""}`),N(null),await I()}catch(F){if(F instanceof Ue&&F.code==="OUTLINE_NODE_NOT_FOUND"){v(ga("OUTLINE_NODE_NOT_FOUND")),N(null),await I();return}throw F}}function _e(){return Q?.parentId!==Sn?null:i.jsx(Zy,{className:"mb-1",type:Q.type,onTypeChange:F=>ne({parentId:Sn,type:F}),value:me,onChange:se,onKeyDown:qe,onCancel:he})}function it(F,pe){return F.map(J=>{const je=J.type!=="scene"&&(J.children?.length??0)>0,Fe=x.has(J.id),Ne=r?.currentPosition===J.id,Oe=_k[J.type],Xe=H?.nodeId===J.id&&H.field==="title",st=H?.nodeId===J.id&&H.field==="summary",Et=$?.kind==="before"&&$.nodeId===J.id,kt=$?.kind==="after"&&$.nodeId===J.id,xt=X===J.id,yn=Q?.parentId===J.id,an=J.id===_;return i.jsxs("div",{children:[i.jsxs("div",{"data-node-id":J.id,draggable:!Xe&&!st&&!xt&&!k,onDragStart:Ke=>we(Ke,J),onDragEnd:De,onDragOver:Ke=>ye(Ke,J.id),onDragLeave:Ke=>Ie(Ke,J.id),onDrop:Ke=>{oe(Ke,J.id)},className:We("relative cursor-grab rounded-md px-2 py-1 transition-colors hover:bg-muted/60 active:cursor-grabbing",J.id===E&&"bg-accent/40",an&&"bg-accent ring-1 ring-inset ring-ring",xt&&"opacity-50"),style:{paddingLeft:pe*20+8},title:"拖动到目标行即可移动(上半=插前、下半=插后)",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[je?i.jsx("button",{type:"button",className:"w-4 shrink-0 text-muted-foreground hover:text-foreground",onClick:()=>D(J.id),"aria-label":Fe?"展开":"折叠",children:Fe?"▸":"▾"}):i.jsx("span",{className:"w-4 shrink-0"}),i.jsx("span",{className:"flex h-5 w-7 shrink-0 items-center justify-center rounded bg-muted text-xs text-muted-foreground",children:os[J.type]}),Xe?wc(B,M,be(J,"title"),()=>{V(J,"title")},"标题"):i.jsx("span",{className:We("min-w-0 cursor-text truncate text-sm hover:underline",an?"text-accent-foreground":"text-foreground"),title:"点击编辑标题",onClick:()=>q(J,"title"),children:J.title}),U!==null&&(U.get(J.id)?.length??0)>0&&i.jsx("span",{className:"flex shrink-0 items-center gap-0.5",children:(U.get(J.id)??[]).map(Ke=>i.jsx(I1,{mark:Ke},`${Ke.relationType}-${Ke.hookId}`))}),Oe!==null&&i.jsx("button",{type:"button",className:"shrink-0 rounded px-1 text-muted-foreground hover:bg-muted hover:text-foreground",title:`就地新建${os[Oe]}`,"aria-label":`新建${os[Oe]}`,onClick:()=>ue(J.id,Oe),children:"+"}),i.jsx("button",{type:"button",className:"shrink-0 rounded p-1 text-muted-foreground hover:bg-muted hover:text-foreground",title:"详情","aria-label":"详情",onClick:()=>Tn(`/outline/${J.id}`),children:i.jsx(vm,{className:"size-3.5"})}),i.jsx("button",{type:"button",className:"shrink-0 rounded p-1 text-muted-foreground hover:bg-muted hover:text-destructive",title:"移入回收站","aria-label":"移入回收站",onClick:()=>N(J),children:i.jsx(Cv,{className:"size-3.5"})}),Ne&&i.jsx("span",{className:"shrink-0 rounded bg-accent px-1.5 py-0.5 text-xs text-accent-foreground",children:"当前位置"}),i.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:ls(J.updatedAt)})]}),st||J.summary?i.jsxs("div",{className:"mt-0.5 flex items-center gap-2",children:[i.jsx("span",{className:"w-4 shrink-0"}),i.jsx("span",{className:"w-7 shrink-0"}),st?wc(B,M,be(J,"summary"),()=>{V(J,"summary")},"摘要"):i.jsx("span",{className:"min-w-0 cursor-text truncate text-xs text-muted-foreground hover:underline",title:"点击编辑摘要",onClick:()=>q(J,"summary"),children:J.summary})]}):null,Et&&i.jsx("span",{className:"pointer-events-none absolute inset-x-0 -top-px h-0.5 rounded bg-accent"}),kt&&i.jsx("span",{className:"pointer-events-none absolute inset-x-0 -bottom-px h-0.5 rounded bg-accent"})]}),je&&!Fe&&i.jsx("div",{children:it(J.children??[],pe+1)}),yn&&i.jsxs("div",{className:"flex items-center gap-2 rounded-md px-2 py-1",style:{paddingLeft:(pe+1)*20+8},children:[i.jsx("span",{className:"w-4 shrink-0"}),i.jsx("span",{className:"flex h-5 w-7 shrink-0 items-center justify-center rounded bg-muted text-xs text-muted-foreground",children:os[Q.type]}),wc(me,se,qe,he,`新${os[Q.type]}标题,Enter 创建`)]})]},J.id)})}function ie(){n&&(x.size>0?S(new Set):S(new Set(L(n.children))))}return i.jsxs("section",{children:[i.jsxs("div",{className:"mb-4 flex items-center justify-between gap-4",children:[i.jsx("h1",{className:"text-xl font-semibold",children:"大纲"}),i.jsxs("div",{className:"flex gap-2",children:[i.jsx(Se,{variant:"outline",type:"button",onClick:ie,disabled:!n||n.children.length===0,children:x.size>0?"全部展开":"全部折叠"}),i.jsx(Se,{type:"button",onClick:()=>ue(Sn,"volume"),children:"+ 新建"})]})]}),p&&i.jsx("div",{className:"mb-3 rounded-md border border-destructive/30 bg-destructive/10 px-3 py-2 text-sm text-destructive",children:p}),z?i.jsxs("div",{className:"rounded-md border border-dashed border-zinc-300 px-6 py-10 text-center",children:[i.jsx("p",{className:"text-sm text-zinc-600",children:"未打开项目,无法编辑大纲"}),i.jsx("a",{href:"#/",className:"mt-2 inline-block text-sm text-zinc-500 underline hover:text-zinc-700",children:"回到首页打开或创建书籍"})]}):o&&n===null?i.jsx("div",{className:"space-y-2 rounded-md border border-zinc-200 p-3",children:Array.from({length:6},(F,pe)=>i.jsx("div",{className:"h-5 animate-pulse rounded bg-zinc-100",style:{width:`${92-pe%3*24}%`,marginLeft:pe%3*20}},pe))}):n===null?i.jsxs("div",{className:"rounded-md border border-zinc-200 p-4 text-sm text-zinc-600",children:["大纲加载失败",i.jsx(Se,{variant:"outline",className:"ml-3",type:"button",onClick:()=>b(!1),children:"重试"})]}):n.children.length===0?Q?.parentId===Sn?i.jsxs("div",{className:"rounded-lg border border-dashed border-zinc-300 px-6 py-12 text-center",children:[i.jsx("p",{className:"text-sm text-zinc-600",children:"输入第一卷标题,Enter 创建"}),i.jsx("div",{className:"mx-auto mt-4 max-w-sm",children:i.jsx(Zy,{type:Q.type,onTypeChange:F=>ne({parentId:Sn,type:F}),value:me,onChange:se,onKeyDown:qe,onCancel:he})})]}):i.jsxs("div",{className:"rounded-lg border border-dashed border-zinc-300 px-6 py-12 text-center",children:[i.jsx("p",{className:"text-sm text-zinc-600",children:"大纲还是空的,先建第一卷"}),i.jsx("p",{className:"mt-1 text-xs text-zinc-400",children:"大纲是三层结构:卷 → 章 → 场景"}),i.jsx(Se,{className:"mt-4",type:"button",onClick:()=>ue(Sn,"volume"),children:"新建第一卷"})]}):i.jsxs("div",{className:We("rounded-md border border-border p-2",$?.kind==="root-end"&&"ring-1 ring-inset ring-accent"),onDragOver:ce,onDragLeave:de,onDrop:F=>{Te(F)},children:[_e(),it(n.children,0)]}),j&&i.jsx(ws,{title:"移入回收站",description:`将《${j.title}》移入回收站。子节点与关联的关系、变化记录将一并移入,可在回收站还原。`,confirmLabel:"移入回收站",danger:!0,onConfirm:Me,onClose:()=>N(null)})]})}const jl=20;function f_(n,o){return Math.max(1,Math.ceil(n/o))}const m_={character:{key1:"role",label1:"角色",key2:"status",label2:"状态"},setting:{key1:"category",label1:"类别"},location:{key1:"type",label1:"类型"},hook:{key1:"status",label1:"状态",key2:"payoff_timing",label2:"回收时机"},event:{key1:"description",label1:"描述"}},jp={planted:"已埋设",progressing:"推进中",resolved:"已回收",abandoned:"已弃用"},Tp={immediate:"立即",near_term:"近期",mid_arc:"中段",slow_burn:"慢热",endgame:"终局"};function Yf(n,o,r){return r==null||r===""?"—":n==="hook"&&o==="status"?jp[String(r)]??String(r):n==="hook"&&o==="payoff_timing"?Tp[String(r)]??String(r):String(r)}const Jy={character:{key:"role",label:"角色定位",input:"text"},setting:{key:"category",label:"类别",input:"text"},location:{key:"type",label:"地点类型",input:"text"},hook:{key:"status",label:"状态",input:"select",options:["planted","progressing","resolved","abandoned"]},event:{key:"description",label:"描述",input:"text"}};function wp(n){switch(n){case"character":return[{key:"role",label:"角色定位",control:"text"},{key:"gender",label:"性别",control:"text"},{key:"age",label:"年龄",control:"number"},{key:"personality",label:"性格",control:"tags"},{key:"motivation",label:"动机",control:"textarea"},{key:"abilities",label:"能力",control:"tags"},{key:"status",label:"状态",control:"text"}];case"setting":return[{key:"category",label:"类别",control:"text"},{key:"parent_id",label:"上级设定",control:"text"},{key:"description",label:"描述",control:"textarea"},{key:"rules",label:"规则",control:"tags"}];case"location":return[{key:"type",label:"地点类型",control:"text"},{key:"parent_id",label:"上级地点",control:"text"},{key:"description",label:"描述",control:"textarea"}];case"hook":return[{key:"status",label:"状态",control:"select",options:["planted","progressing","resolved","abandoned"],optionsLabels:jp},{key:"category",label:"类别",control:"text"},{key:"expected_payoff",label:"预期回收",control:"textarea"},{key:"payoff_timing",label:"回收时机",control:"select",options:["immediate","near_term","mid_arc","slow_burn","endgame"],optionsLabels:Tp},{key:"half_life",label:"半衰期(章数)",control:"number"},{key:"is_core",label:"主线伏笔",control:"toggle"},{key:"notes",label:"备注",control:"textarea"},{key:"expected_resolve_node_id",label:"预计回收节点",control:"outline-node"}];case"event":return[{key:"description",label:"描述",control:"textarea"},{key:"time_label",label:"时间标注",control:"text"},{key:"tags",label:"标签",control:"tags"}]}}const p_={belongs_to:"所属",owns:"拥有",masters:"掌握",ally:"盟友",rival:"对手",mentor:"师徒",family:"家族",kills:"击杀",appears_in:"出现于",occurs_at:"发生于",plot_edge:"剧情连线",plants:"埋设",advances:"推进",resolves:"回收",depends_on:"依赖",involves:"涉及"};function hr(n){return p_[n]??n}function Cp(n,o){const r={};for(const l of new Set([...Object.keys(n),...Object.keys(o)])){const c=o[l];if(c===void 0)continue;const d=Wy(n[l]),m=Wy(c);JSON.stringify(d)!==JSON.stringify(m)&&(r[l]=c)}return Object.keys(r).length>0?r:null}function Wy(n){return n==null||n===""||Array.isArray(n)&&n.length===0?null:n}const Vf={character:"人物",setting:"设定",location:"地点",hook:"伏笔",event:"事件"},xa="w-full rounded-md border border-border bg-card px-3 py-1.5 text-sm text-foreground focus:outline-none focus-visible:ring-2 focus-visible:ring-ring";function Rp({source:n,onCreated:o,onClose:r}){const l=ze(M=>M.outline),[c,d]=h.useState("character"),[m,g]=h.useState(null),[b,p]=h.useState(""),[v,x]=h.useState("character"),[S,j]=h.useState(null),[N,k]=h.useState(""),[O,E]=h.useState(Kf[0]),[T,_]=h.useState(null),[R,H]=h.useState(!1);h.useEffect(()=>{n||(p(""),g(null),br(c,{limit:100}).then(M=>g(M.items)).catch(()=>g([])))},[n,c]),h.useEffect(()=>{if(k(""),v==="outline_node"){j(null);return}j(null),br(v,{limit:100}).then(M=>j(M.items)).catch(()=>j([]))},[v]);const A=oo(l?.children??[]);async function B(M){if(M.preventDefault(),!n&&!b){_("请选择源实体");return}if(!N){_("请选择关联对象");return}H(!0),_(null);try{const Q={source_type:n?n.type:c,source_id:n?n.id:b,target_type:v,target_id:N,relation_type:O};await Oa(Q),ke.getState().showToast("已建立关系"),await o(),r()}catch(Q){Q instanceof Ue&&Q.code==="RELATION_EXISTS"?_("这条关系已经存在"):_(Q instanceof Ue?Q.message:"创建失败,请重试")}finally{H(!1)}}return i.jsx($s,{open:!0,onOpenChange:M=>!M&&r(),children:i.jsxs(Qs,{className:"sm:max-w-2xl",children:[i.jsx(Zs,{children:i.jsx(Ws,{children:"新增关联"})}),i.jsxs("form",{id:"create-relation-form",onSubmit:B,className:"flex flex-col gap-3",children:[i.jsxs("div",{className:"grid grid-cols-1 items-start gap-3 sm:grid-cols-[1fr_auto_1fr]",children:[i.jsxs("div",{className:"flex flex-col gap-2",children:[i.jsx("p",{className:"text-sm font-medium text-foreground",children:"源实体"}),n?i.jsxs("div",{title:n.name,className:"min-w-0 truncate rounded-md border border-border bg-muted/40 px-3 py-1.5 text-sm text-foreground",children:[n.type==="outline_node"?"本节点":"本实体",":",n.name]}):i.jsxs(i.Fragment,{children:[i.jsx("select",{value:c,onChange:M=>d(M.target.value),className:xa,children:Na.map(M=>i.jsx("option",{value:M,children:Vf[M]},M))}),i.jsxs("select",{value:b,onChange:M=>p(M.target.value),className:xa,children:[i.jsxs("option",{value:"",children:["选择",Vf[c],"…"]}),(m??[]).map(M=>i.jsx("option",{value:M.id,children:M.name},M.id))]})]})]}),i.jsxs("div",{className:"flex flex-col gap-2 sm:w-44",children:[i.jsx("p",{className:"text-sm font-medium text-foreground",children:"关系类型"}),i.jsx("select",{value:O,onChange:M=>E(M.target.value),className:xa,children:Kf.map(M=>i.jsx("option",{value:M,children:hr(M)},M))}),i.jsx("span",{"aria-hidden":"true",className:"mt-auto select-none pb-1 text-center text-xl leading-none text-muted-foreground",children:"→"})]}),i.jsxs("div",{className:"flex flex-col gap-2",children:[i.jsx("p",{className:"text-sm font-medium text-foreground",children:"目标实体"}),i.jsxs("select",{value:v,onChange:M=>x(M.target.value),className:xa,children:[i.jsx("option",{value:"character",children:"人物"}),i.jsx("option",{value:"setting",children:"设定"}),i.jsx("option",{value:"location",children:"地点"}),i.jsx("option",{value:"hook",children:"伏笔"}),i.jsx("option",{value:"outline_node",children:"大纲节点"})]}),v==="outline_node"?i.jsxs("select",{value:N,onChange:M=>k(M.target.value),className:xa,children:[i.jsx("option",{value:"",children:"选择大纲节点…"}),A.map(M=>i.jsxs("option",{value:M.id,children:[" ".repeat(M.depth),M.label]},M.id))]}):i.jsxs("select",{value:N,onChange:M=>k(M.target.value),className:xa,children:[i.jsxs("option",{value:"",children:["选择",Vf[v],"…"]}),(S??[]).map(M=>i.jsx("option",{value:M.id,children:M.name},M.id))]})]})]}),T&&i.jsx("p",{className:"text-sm text-destructive",children:T})]}),i.jsxs(Js,{children:[i.jsx(Se,{variant:"outline",type:"button",onClick:r,disabled:R,children:"取消"}),i.jsx(Se,{type:"submit",form:"create-relation-form",disabled:R,children:"建立"})]})]})})}const V1={character:"人物",setting:"设定",location:"地点",hook:"伏笔",outline_node:"大纲节点"},ev={endpointType:"",relationType:"",nameQuery:""};function h_(n,o){const r=o.nameQuery.trim().toLowerCase();return n.filter(l=>{if(o.endpointType!==""&&l.sourceType!==o.endpointType&&l.targetType!==o.endpointType||o.relationType!==""&&l.relationType!==o.relationType)return!1;if(r){const c=(l.sourceName??l.sourceId).toLowerCase(),d=(l.targetName??l.targetId).toLowerCase();if(!c.includes(r)&&!d.includes(r))return!1}return!0})}function tv({type:n}){return i.jsx("span",{className:"shrink-0 rounded bg-muted px-1.5 py-0.5 text-xs text-muted-foreground",children:V1[n]??n})}function Pf({type:n,id:o,name:r}){const l=r??o;if(!(Na.includes(n)||n==="outline_node"))return i.jsxs("span",{className:"flex min-w-0 items-center gap-1.5",children:[i.jsx("span",{className:"min-w-0 truncate text-muted-foreground",title:l,children:l}),i.jsx(tv,{type:n})]});const d=n==="outline_node"?`/outline/${o}`:`/entities/${n}/${o}`;return i.jsxs("span",{className:"flex min-w-0 items-center gap-1.5",children:[i.jsx("button",{type:"button",onClick:()=>Tn(d),title:`打开《${l}》`,className:"min-w-0 truncate font-medium text-foreground underline-offset-2 hover:text-primary hover:underline",children:l}),i.jsx(tv,{type:n})]})}function nv(n,o){const r=o==="source"?n.sourceName:n.targetName,l=o==="source"?n.sourceId:n.targetId;return r??l}function P1({reloadKey:n,onOpenCreate:o,scope:r}){const[l,c]=h.useState(null),[d,m]=h.useState(!1),[g,b]=h.useState(null),[p,v]=h.useState(0),[x,S]=h.useState(ev),[j,N]=h.useState(null);h.useEffect(()=>{let E=!1;m(!0),b(null);const T=r!==void 0?{source_type:r.type,source_id:r.id,depth:1}:{depth:1};return ja(T).then(_=>{E||c(_.relations)}).catch(_=>{E||(c(null),b(_ instanceof Ue?_.code:vt))}).finally(()=>{E||m(!1)}),()=>{E=!0}},[n,p,r?.type,r?.id]);async function k(){if(j)try{await Bc(j.id),ke.getState().showToast("已删除关系"),N(null),v(E=>E+1)}catch(E){throw E}}const O=l===null?[]:h_(l,x);return i.jsxs("div",{children:[r===void 0&&i.jsxs("div",{className:"mb-2 mt-3 flex flex-wrap items-center gap-3",children:[i.jsxs("select",{value:x.endpointType,onChange:E=>S(T=>({...T,endpointType:E.target.value})),"aria-label":"端点类型过滤",className:"rounded-md border border-border bg-card px-2 py-1 text-sm text-foreground focus:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:[i.jsx("option",{value:"",children:"全部端点类型"}),Object.entries(V1).map(([E,T])=>i.jsx("option",{value:E,children:T},E))]}),i.jsxs("select",{value:x.relationType,onChange:E=>S(T=>({...T,relationType:E.target.value})),"aria-label":"关系类型过滤",className:"rounded-md border border-border bg-card px-2 py-1 text-sm text-foreground focus:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:[i.jsx("option",{value:"",children:"全部关系类型"}),Kf.map(E=>i.jsx("option",{value:E,children:hr(E)},E))]}),i.jsx(Ot,{value:x.nameQuery,onChange:E=>S(T=>({...T,nameQuery:E.target.value})),placeholder:"搜索源/目标名称…",className:"w-52"})]}),g!==null&&i.jsxs("div",{className:"mb-3 rounded-md border border-border bg-muted px-3 py-2 text-sm text-muted-foreground",children:[g===vt?"无法连接服务,请确认 ai-editor 服务已启动。":"关系加载失败,请重试。",i.jsx(Se,{variant:"outline",className:"ml-3",type:"button",onClick:()=>v(E=>E+1),children:"重试"})]}),d&&l===null&&g===null&&i.jsx("div",{className:"overflow-hidden rounded-md border border-border",children:Array.from({length:5},(E,T)=>i.jsxs("div",{className:"flex items-center gap-3 border-b border-border px-3 py-3 last:border-0",children:[i.jsx("div",{className:"h-4 w-1/4 animate-pulse rounded bg-muted"}),i.jsx("div",{className:"h-4 w-1/6 animate-pulse rounded bg-muted"}),i.jsx("div",{className:"h-4 w-1/4 animate-pulse rounded bg-muted"}),i.jsx("div",{className:"ml-auto h-4 w-12 animate-pulse rounded bg-muted"})]},T))}),!d&&l!==null&&l.length===0&&i.jsxs("div",{className:"rounded-lg border border-dashed border-border px-6 py-12 text-center",children:[i.jsx("p",{className:"text-sm text-muted-foreground",children:"还没有关联,建立一条"}),i.jsx(Se,{className:"mt-4",type:"button",onClick:o,children:"+ 建立关联"})]}),!d&&l!==null&&l.length>0&&O.length===0&&i.jsxs("div",{className:"rounded-lg border border-dashed border-border px-6 py-12 text-center",children:[i.jsx("p",{className:"text-sm text-muted-foreground",children:"没有匹配的关联"}),i.jsx(Se,{variant:"outline",className:"mt-4",type:"button",onClick:()=>S(ev),children:"清空过滤"})]}),!d&&l!==null&&O.length>0&&i.jsxs("div",{className:"overflow-hidden rounded-md border border-border",children:[r===void 0&&i.jsxs("div",{className:"flex items-center gap-2 border-b border-border bg-muted/40 px-3 py-2 text-xs text-muted-foreground",children:[i.jsx("span",{className:"w-1/4 shrink-0",children:"源"}),i.jsx("span",{className:"w-1/4 shrink-0",children:"关系"}),i.jsx("span",{className:"flex-1",children:"目标"}),i.jsx("span",{className:"w-14 shrink-0"})]}),i.jsx("ul",{className:"divide-y divide-border",children:O.map(E=>i.jsxs("li",{className:"flex items-center gap-2 px-3 py-2 text-sm",children:[r!==void 0?i.jsxs(i.Fragment,{children:[i.jsxs("span",{className:"shrink-0 truncate rounded bg-muted px-1.5 py-0.5 text-center text-xs text-muted-foreground",children:[hr(E.relationType)," →"]}),i.jsx("span",{className:"min-w-0 flex-1",children:i.jsx(Pf,{type:E.targetType,id:E.targetId,name:E.targetName})})]}):i.jsxs(i.Fragment,{children:[i.jsx("span",{className:"w-1/4 min-w-0 shrink-0",children:i.jsx(Pf,{type:E.sourceType,id:E.sourceId,name:E.sourceName})}),i.jsxs("span",{className:"w-1/4 shrink-0 truncate rounded bg-muted px-1.5 py-0.5 text-center text-xs text-muted-foreground",children:[hr(E.relationType)," →"]}),i.jsx("span",{className:"min-w-0 flex-1",children:i.jsx(Pf,{type:E.targetType,id:E.targetId,name:E.targetName})})]}),i.jsx(Se,{variant:"outline",type:"button",className:"h-7 w-14 shrink-0 px-2 text-xs text-destructive hover:bg-destructive/10",onClick:()=>N(E),children:"删除"})]},E.id))})]}),j&&i.jsx(ws,{title:"删除关系",description:`删除关系「${nv(j,"source")} ${hr(j.relationType)} ${nv(j,"target")}」?物理删除不可恢复,可重新建立。`,confirmLabel:"删除",danger:!0,onConfirm:k,onClose:()=>N(null)})]})}const g_={set:"设为",update:"更新",add:"追加",remove:"移除"},x_={character:"人物",setting:"设定",location:"地点",hook:"伏笔",outline_node:"大纲节点"};function Op(n){return x_[n]??n}function rs(n){return n==null?"空":typeof n=="object"?JSON.stringify(n):String(n)}function b_(n){switch(n.op){case"set":return`${n.field} = ${rs(n.to)}`;case"update":return`${n.field} ${rs(n.from)} → ${rs(n.to)}`;case"add":return`${n.field} +${rs(n.value??n.to)}`;case"remove":return`${n.field} -${rs(n.value??n.to)}`}}function y_(n,o){const r=[];for(const l of new Set([...Object.keys(n),...Object.keys(o)])){const c=n[l]??null,d=o[l]??null;JSON.stringify(c)!==JSON.stringify(d)&&r.push({field:l,from:n[l],to:o[l]})}return r}function G1({changes:n,skipped:o}){const r=o?new Set(o):null;return i.jsx("div",{className:"flex flex-wrap items-center gap-1",children:n.map((l,c)=>{const d=r?.has(c)??!1;return i.jsxs("span",{title:d?"该变更未应用(数据与变更记录不一致,见冲突标注)":void 0,className:We("inline-flex items-center gap-1 rounded bg-muted px-1.5 py-0.5 text-xs",d?"text-destructive":"text-muted-foreground"),children:[i.jsx("span",{className:We("shrink-0 font-medium",d?"text-destructive":"text-foreground/70"),children:g_[l.op]}),b_(l)]},c)})})}function v_({nodeId:n,reloadKey:o}){const[r,l]=h.useState(null),[c,d]=h.useState(!1),[m,g]=h.useState(null),[b,p]=h.useState(0);return h.useEffect(()=>{let v=!1;return d(!0),g(null),iT(n).then(x=>{v||l([...x.deltas].sort((S,j)=>S.order-j.order))}).catch(x=>{v||g(x instanceof Ue?x.code:vt)}).finally(()=>{v||d(!1)}),()=>{v=!0}},[n,b,o]),i.jsxs("div",{children:[c&&r===null&&m===null&&i.jsxs("div",{className:"space-y-2 py-1",children:[i.jsx("div",{className:"h-4 w-2/3 animate-pulse rounded bg-muted"}),i.jsx("div",{className:"h-4 w-1/2 animate-pulse rounded bg-muted"})]}),m!==null&&i.jsxs("div",{className:"flex items-center gap-2 text-xs text-destructive",children:[i.jsx("span",{children:m==="OUTLINE_NODE_NOT_FOUND"?"节点不存在(可能已被删除),变更记录不可用":m===vt?"无法连接服务,请确认 ai-editor 服务已启动":"变更记录加载失败"}),m!=="OUTLINE_NODE_NOT_FOUND"&&i.jsx(Se,{variant:"outline",size:"xs",type:"button",onClick:()=>p(v=>v+1),children:"重试"})]}),!c&&m===null&&r!==null&&r.length===0&&i.jsx("p",{className:"py-1 text-xs text-muted-foreground",children:"该节点没有变更记录"}),!c&&m===null&&r!==null&&r.length>0&&i.jsx("ul",{className:"divide-y divide-border/70",children:r.map(v=>i.jsxs("li",{className:"py-2 first:pt-0 last:pb-0",children:[i.jsxs("div",{className:"flex items-baseline gap-2",children:[i.jsx("span",{className:"min-w-0 flex-1 truncate text-sm text-foreground",title:v.description,children:v.description}),i.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:ls(v.createdAt)})]}),i.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-1.5",children:[i.jsxs("span",{className:"shrink-0 rounded bg-muted px-1.5 py-0.5 text-xs text-muted-foreground",children:[Op(v.targetType),"《",v.targetName??v.targetId,"》"]}),i.jsx(G1,{changes:v.changes})]})]},v.id))})]})}const S_=Na.filter(n=>n!=="event").map(n=>({value:n,label:Op(n)})),E_={character:["role","gender","age","personality","motivation","abilities","status","custom_fields"],setting:["category","parent_id","description","rules","custom_fields"],location:["type","parent_id","description","custom_fields"],hook:["status","category","expected_payoff","payoff_timing","half_life","is_core","notes","expected_resolve_node_id"]},N_={character:Sc("character"),setting:Sc("setting"),location:Sc("location"),hook:Sc("hook")};function Sc(n){return Object.fromEntries(wp(n).map(o=>[o.key,o.label]))}const j_={character:["personality","abilities"],setting:["rules"]},T_={character:["age"],hook:["half_life"]};function gm(n,o){return(j_[n]??[]).includes(o)}function w_(n,o){return(T_[n]??[]).includes(o)}function C_(n){return(E_[n]??[]).filter(r=>r!=="custom_fields").map(r=>({key:r,label:N_[n]?.[r]??r,array:gm(n,r)}))}function q1(n){if(n!==void 0){if(n===null)return null;if(typeof n=="string"||typeof n=="number")return n}}function sv(n){return n.array?{options:["add","remove"],default:"add"}:q1(n.currentValue)!==void 0?{options:["update","set"],default:"update"}:{options:["set"],default:"set"}}function R_(n){const o=n.rawValue.trim();if(o==="")return{error:"请填写值"};const r=Number(o),l=n.numeric&&!Number.isNaN(r)?r:o;switch(n.op){case"add":return{change:{field:n.field,op:"add",value:l}};case"remove":return{change:{field:n.field,op:"remove",value:l}};case"set":return{change:{field:n.field,op:"set",to:l}};case"update":{const c=q1(n.currentValue);return c===void 0?{error:"无法确定旧值(当前数据无此字段或类型不可表达),请改用「设为」"}:{change:{field:n.field,op:"update",from:c,to:l}}}}}const ba="w-full rounded-md border border-border bg-card px-2 py-1 text-sm text-foreground focus:outline-none focus-visible:ring-2 focus-visible:ring-ring",O_={set:"设为",update:"更新",add:"追加",remove:"移除"};function k_({nodeId:n,onCreated:o,onClose:r}){const[l,c]=h.useState(""),[d,m]=h.useState(""),[g,b]=h.useState(""),[p,v]=h.useState("add"),[x,S]=h.useState(""),[j,N]=h.useState(""),[k,O]=h.useState(!1),[E,T]=h.useState(null),[_,R]=h.useState(null),[H,A]=h.useState(null),[B,M]=h.useState(0),[Q,ne]=h.useState(null),[me,se]=h.useState(null);h.useEffect(()=>{if(m(""),ne(null),se(null),l===""){R(null),A(null);return}let z=!1;return R(null),A(null),br(l).then(I=>{z||R(I.items)}).catch(I=>{z||(R(null),A(I instanceof Ue?I.code:vt))}),()=>{z=!0}},[l,B]),h.useEffect(()=>{if(l===""||d==="")return;let z=!1;return ne(null),se(null),mr(l,d).then(I=>{z||ne(I.data)}).catch(I=>{z||(ne(null),se(I instanceof Ue?I.code:vt))}),()=>{z=!0}},[l,d]),h.useEffect(()=>{b(""),S(""),T(null)},[l,d]);const X=C_(l),te=Q?.[g],$=sv({array:gm(l,g),currentValue:te});function w(z){b(z),v(sv({array:gm(l,z),currentValue:Q?.[z]}).default)}async function U(){if(k)return;if(l===""||d===""){T("请选择变更目标");return}if(g===""){T("请选择变更字段");return}const z=j.trim();if(z===""){T("请填写描述(本节点触发了什么变化)");return}const I=R_({field:g,op:p,rawValue:x,numeric:w_(l,g),currentValue:te});if("error"in I){T(I.error);return}O(!0),T(null);try{await Rm({node_id:n,target_type:l,target_id:d,changes:[I.change],description:z}),ke.getState().showToast("已记录变更"),o()}catch(D){if(D instanceof Ue&&D.code==="OUTLINE_NODE_NOT_FOUND"){ke.getState().showToast("节点不存在(可能已被删除),无法记录变更","error"),r();return}T(D instanceof Ue?D.message:"提交失败,请重试")}finally{O(!1)}}const Y=l;return i.jsxs("div",{className:"mb-3 space-y-3 rounded-md border border-border bg-muted/40 p-3",children:[i.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[i.jsxs("div",{children:[i.jsx("p",{className:"mb-1 text-xs font-medium text-foreground",children:"目标类型"}),i.jsxs("select",{value:l,onChange:z=>c(z.target.value),className:We(ba,l===""&&"text-muted-foreground"),"aria-label":"目标类型",children:[i.jsx("option",{value:"",children:"请选择目标类型"}),S_.map(z=>i.jsx("option",{value:z.value,children:z.label},z.value))]})]}),i.jsxs("div",{children:[i.jsx("p",{className:"mb-1 text-xs font-medium text-foreground",children:"目标"}),l===""?i.jsx("p",{className:"py-1 text-xs text-muted-foreground",children:"请先选择目标类型"}):H!==null?i.jsxs("div",{className:"flex items-center gap-2 text-xs text-destructive",children:[i.jsx("span",{children:H===vt?"无法连接服务,请确认 ai-editor 服务已启动":"实体列表加载失败"}),i.jsx(Se,{variant:"outline",size:"xs",type:"button",onClick:()=>M(z=>z+1),children:"重试"})]}):_===null?i.jsx("p",{className:"py-1 text-xs text-muted-foreground",children:"加载中…"}):_.length===0?i.jsxs("p",{className:"py-1 text-xs text-muted-foreground",children:["暂无",ov(Y)]}):i.jsxs("select",{value:d,onChange:z=>m(z.target.value),className:We(ba,d===""&&"text-muted-foreground"),"aria-label":"目标实体",children:[i.jsxs("option",{value:"",children:["请选择",ov(Y)]}),_.map(z=>i.jsx("option",{value:z.id,children:z.name},z.id))]})]})]}),i.jsxs("div",{className:"grid gap-3 sm:grid-cols-[1fr_auto_1fr]",children:[i.jsxs("div",{children:[i.jsx("p",{className:"mb-1 text-xs font-medium text-foreground",children:"字段"}),i.jsxs("select",{value:g,onChange:z=>w(z.target.value),className:We(ba,g===""&&"text-muted-foreground"),"aria-label":"变更字段",children:[i.jsx("option",{value:"",children:"请选择字段"}),X.map(z=>i.jsx("option",{value:z.key,children:z.label},z.key))]})]}),i.jsxs("div",{children:[i.jsx("p",{className:"mb-1 text-xs font-medium text-foreground",children:"操作"}),i.jsx("select",{value:p,onChange:z=>v(z.target.value),className:We(ba,"min-w-20"),"aria-label":"操作",children:$.options.map(z=>i.jsx("option",{value:z,children:O_[z]},z))})]}),i.jsxs("div",{children:[i.jsx("p",{className:"mb-1 text-xs font-medium text-foreground",children:p==="set"||p==="update"?"新值":p==="add"?"追加值":"移除值"}),i.jsx("input",{value:x,onChange:z=>S(z.target.value),placeholder:p==="remove"?"按值匹配删除":"",className:ba})]})]}),p==="update"&&i.jsx("p",{className:"text-xs text-muted-foreground",children:me!==null?i.jsxs(i.Fragment,{children:["目标数据获取失败,无法自动取旧值(",me==="ENTITY_NOT_FOUND"?"目标已不存在":"请稍后重试",")——可将操作改为「设为」"]}):i.jsxs(i.Fragment,{children:["旧值:",rs(te),"(自动取自目标当前数据,无需手填)"]})}),i.jsxs("div",{children:[i.jsx("p",{className:"mb-1 text-xs font-medium text-foreground",children:"描述"}),i.jsx("textarea",{value:j,onChange:z=>N(z.target.value),rows:2,maxLength:500,placeholder:"本节点触发了什么变化,如:张三获得断剑认可",className:We(ba,"resize-none")})]}),E!==null&&i.jsx("p",{className:"text-sm text-destructive",children:E}),i.jsxs("div",{className:"flex items-center justify-end gap-2",children:[i.jsx(Se,{variant:"ghost",size:"sm",type:"button",onClick:r,disabled:k,children:"取消"}),i.jsx(Se,{size:"sm",type:"button",onClick:()=>{U()},disabled:k,children:k?"提交中…":"创建变更"})]})]})}function ov(n){return Op(n)}function kp({items:n,className:o}){return i.jsx("nav",{"aria-label":"面包屑",className:We("inline-flex items-center gap-1",o),children:n.map((r,l)=>{const c=l===n.length-1;return i.jsxs("span",{className:"inline-flex items-center gap-1",children:[r.href?i.jsx("button",{type:"button",onClick:()=>Tn(r.href),className:"rounded-md px-2.5 py-1 text-sm text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",children:r.label}):i.jsx("span",{"aria-current":"page",className:"max-w-40 truncate rounded-md bg-foreground px-2.5 py-1 text-sm font-medium text-background",children:r.label}),!c&&i.jsx("span",{className:"select-none text-sm text-muted-foreground/40",children:"›"})]},l)})})}const __={inner:"内心冲突",personal:"人际冲突",extra_personal:"社会冲突"};function M_(n){switch(n){case"scene":return[{key:"goal",label:"场景目标",control:"textarea",maxLength:1e3},{key:"conflict_levels",label:"冲突层次",control:"checkbox-group",options:Sv,optionsLabels:__},{key:"value_from",label:"开场价值",control:"text",maxLength:200},{key:"value_to",label:"收场价值",control:"text",maxLength:200}];case"chapter":return[{key:"reversal",label:"章末反转",control:"textarea",maxLength:1e3},{key:"climax_scene",label:"章高潮场景",control:"scene-select"}];case"volume":return[{key:"climax_scene",label:"幕高潮场景",control:"scene-select"},{key:"inciting_scene",label:"激励事件",control:"scene-select"}]}}function A_(n,o){return Sv.includes(o)?n.includes(o)?n.filter(r=>r!==o):[...n,o]:n}function D_(n){const o=[],r=(l,c)=>{for(const d of l)d.type==="scene"?o.push({id:d.id,label:d.title,depth:c}):d.children&&r(d.children,c+1)};return r(n,0),o}function z_(n){return typeof n=="string"&&n!==""?n:""}const xm="w-full rounded-md border border-border bg-card px-3 py-1.5 text-sm text-foreground focus:outline-none focus-visible:ring-2 focus-visible:ring-ring";function Tl({title:n,children:o,className:r,action:l}){return i.jsxs("div",{className:We("rounded-xl border border-border bg-card p-4",r),children:[i.jsxs("div",{className:"mb-3 flex items-center justify-between gap-2",children:[i.jsx("h2",{className:"font-serif text-base",children:n}),l]}),o]})}function L_({nodeId:n}){const o=ze(L=>L.outline),r=ze(L=>L.outlineLoading),l=ze(L=>L.config),c=ze(L=>L.configLoading),d=ze(L=>L.loadOutline),m=ze(L=>L.updateConfig),[g,b]=h.useState(!1),[p,v]=h.useState(""),[x,S]=h.useState(""),[j,N]=h.useState(null),[k,O]=h.useState(!1),[E,T]=h.useState(null),[_,R]=h.useState(!1),[H,A]=h.useState(!1),[B,M]=h.useState(0),[Q,ne]=h.useState(!1),[me,se]=h.useState(0);h.useEffect(()=>{o===null&&!r&&!g&&(b(!0),d())},[o,r,g,d]),Cs(()=>{d(),M(L=>L+1),se(L=>L+1)});const X=o===null?null:Ho(o.children,n),te=o!==null&&X===null,$=X?M_(X.type):[],w=D_(o?.children??[]),U=l?.currentPosition===n;h.useEffect(()=>{X!==null&&(v(X.title),S(X.summary??""),N(JSON.parse(JSON.stringify(X.data??{}))))},[X]);async function Y(){if(X===null||k)return;const L=p.trim();if(L===""){T("标题不能为空");return}const q={};H1(X.title,p)&&(q.title=L),B1(X.summary,x)&&(q.summary=x.trim());const Z=Cp(X.data??{},j??{});if(Z!==null&&(q.data=Z),Object.keys(q).length===0){ke.getState().showToast("没有变更");return}O(!0),T(null);try{await _v(X.id,q),ke.getState().showToast("已保存"),await d()}catch(V){if(V instanceof Ue&&V.code==="OUTLINE_NODE_NOT_FOUND"){await d();return}T(V instanceof Ue?V.message:"保存失败,请重试")}finally{O(!1)}}function z(L,q){N(Z=>Z&&{...Z,[L]:q})}async function I(){if(!(X===null||_||U)){R(!0);try{await m({current_position:X.id}),ke.getState().showToast("已设为当前位置")}catch{ke.getState().showToast("设置失败:该节点可能已删除,无法设为当前位置","error")}finally{R(!1)}}}if(te)return i.jsx("section",{children:i.jsxs("div",{className:"rounded-lg border border-dashed border-border px-6 py-14 text-center",children:[i.jsx("p",{className:"text-sm text-muted-foreground",children:"该节点不存在或已被删除"}),i.jsxs("div",{className:"mt-4 flex justify-center gap-2",children:[i.jsx("a",{href:"#/trash",className:"rounded-md border border-border px-4 py-1.5 text-sm text-muted-foreground hover:bg-muted",children:"去回收站"}),i.jsx(Se,{variant:"outline",type:"button",onClick:()=>Tn("/outline"),children:"返回大纲"})]})]})});const D=l===null&&!c,G=[{label:"大纲",href:"/outline"}];if(X!==null){const L=Np(o?.children??[],n)??[];for(const q of L.slice(0,-1)){const Z=Ho(o?.children??[],q);Z&&G.push({label:Z.title,href:`/outline/${q}`})}G.push({label:X.title})}return i.jsxs("section",{children:[i.jsxs("div",{className:"mb-1 flex items-center gap-3",children:[i.jsx(kp,{items:G}),i.jsx("h1",{className:"min-w-0 truncate text-xl font-semibold",children:X?.title??"…"}),i.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[i.jsx(Se,{variant:"outline",type:"button",disabled:X===null||U||_,title:U?"当前节点已是创作进度位置":"标记为创作进度位置(InfoBar 展示 + 定位跳转基准)",onClick:()=>{I()},children:U?"当前位置":"设为当前位置"}),i.jsx(Se,{type:"button",onClick:()=>{Y()},disabled:X===null||k,children:k?"保存中…":"保存"})]})]}),X&&i.jsxs("div",{className:"mb-4 flex items-center gap-2 text-xs text-muted-foreground",children:[i.jsx("span",{className:"shrink-0 rounded bg-muted px-1.5 py-0.5 text-xs",children:os[X.type]}),i.jsxs("span",{children:["更新于 ",ls(X.updatedAt)]}),U&&i.jsx("span",{className:"shrink-0 rounded bg-accent px-1.5 py-0.5 text-xs text-accent-foreground",children:"当前位置"})]}),D?i.jsxs("div",{className:"rounded-md border border-dashed border-border px-6 py-10 text-center",children:[i.jsx("p",{className:"text-sm text-muted-foreground",children:"未打开项目,无法编辑大纲"}),i.jsx("a",{href:"#/",className:"mt-2 inline-block text-sm text-muted-foreground underline hover:text-foreground",children:"回到首页打开或创建书籍"})]}):r&&o===null?i.jsx("div",{className:"space-y-2 rounded-md border border-border p-3",children:Array.from({length:6},(L,q)=>i.jsx("div",{className:"h-5 animate-pulse rounded bg-muted",style:{width:`${92-q%3*24}%`,marginLeft:q%3*20}},q))}):o===null?i.jsxs("div",{className:"rounded-md border border-border p-4 text-sm text-muted-foreground",children:["大纲加载失败",i.jsx(Se,{variant:"outline",className:"ml-3",type:"button",onClick:()=>b(!1),children:"重试"})]}):X===null||j===null?null:i.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[i.jsxs("div",{className:"flex min-w-0 flex-col gap-4",children:[i.jsx(Tl,{title:"基础信息",children:i.jsxs("div",{className:"flex flex-col gap-3",children:[i.jsxs("div",{children:[i.jsx("p",{className:"mb-1 text-sm font-medium text-foreground",children:"标题"}),i.jsx(Ot,{value:p,onChange:L=>v(L.target.value),maxLength:200,placeholder:`${os[X.type]}标题`,className:"h-8 text-sm"})]}),i.jsxs("div",{children:[i.jsx("p",{className:"mb-1 text-sm font-medium text-foreground",children:"摘要"}),i.jsx("textarea",{value:x,onChange:L=>S(L.target.value),maxLength:200,rows:3,placeholder:"一句话概括本节点内容(可选)",className:xm})]})]})}),i.jsxs(Tl,{title:`结构化信息(${os[X.type]})`,children:[i.jsx("div",{className:"flex flex-col gap-3",children:$.map(L=>i.jsxs("div",{children:[i.jsx("p",{className:"mb-1 text-sm font-medium text-foreground",children:L.label}),i.jsx(I_,{field:L,value:j?.[L.key],sceneOptions:w,onChange:q=>z(L.key,q)})]},L.key))}),E&&i.jsx("p",{className:"mt-3 text-sm text-destructive",children:E})]}),i.jsxs(Tl,{title:"变更记录",action:i.jsx(Se,{variant:"outline",size:"sm",type:"button",onClick:()=>ne(L=>!L),children:Q?"收起":"+ 新建变更"}),children:[Q&&i.jsx(k_,{nodeId:n,onCreated:()=>{ne(!1),se(L=>L+1)},onClose:()=>ne(!1)}),i.jsx(v_,{nodeId:n,reloadKey:me})]}),i.jsx(Tl,{title:"伏笔标记",className:"border-dashed",children:i.jsx("p",{className:"text-sm text-muted-foreground",children:"伏笔标记将在伏笔面板(S9)落地"})})]}),i.jsx("div",{className:"flex min-w-0 flex-col gap-4",children:i.jsxs(Tl,{title:"相关实体",children:[i.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[i.jsx("p",{className:"text-xs text-muted-foreground",children:"本节点作为源的关系(1 跳)"}),i.jsx(Se,{variant:"outline",type:"button",className:"h-8 px-2 text-xs",onClick:()=>A(!0),children:"+ 新增关联"})]}),i.jsx(P1,{scope:{type:"outline_node",id:n},reloadKey:B,onOpenCreate:()=>A(!0)})]})})]}),H&&X!==null&&i.jsx(Rp,{source:{type:"outline_node",id:X.id,name:X.title},onCreated:()=>M(L=>L+1),onClose:()=>A(!1)})]})}function I_({field:n,value:o,sceneOptions:r,onChange:l}){switch(n.control){case"textarea":return i.jsx("textarea",{value:typeof o=="string"?o:"",onChange:c=>l(c.target.value),maxLength:n.maxLength,rows:3,className:xm});case"checkbox-group":{const c=Array.isArray(o)?o:[];return i.jsx("div",{className:"flex flex-wrap gap-x-4 gap-y-1.5",children:(n.options??[]).map(d=>i.jsxs("label",{className:"flex cursor-pointer items-center gap-1.5 text-sm text-foreground",children:[i.jsx("input",{type:"checkbox",checked:c.includes(d),onChange:()=>l(A_(c,d)),className:"size-4 accent-primary"}),n.optionsLabels?.[d]??d]},d))})}case"scene-select":{const c=z_(o),d=c!==""&&!r.some(m=>m.id===c);return i.jsxs("select",{value:c,onChange:m=>l(m.target.value),className:We(xm,c===""&&"text-muted-foreground"),children:[i.jsx("option",{value:"",children:"(未设置)"}),d&&i.jsxs("option",{value:c,children:[c,"(已删除)"]}),r.map(m=>i.jsxs("option",{value:m.id,children:[" ".repeat(m.depth),m.label]},m.id))]})}default:return i.jsx(Ot,{value:typeof o=="string"?o:"",onChange:c=>l(c.target.value),maxLength:n.maxLength,className:"h-8 text-sm"})}}const gr={volume:248,chapter:208,scene:168},js={volume:96,chapter:88,scene:76},Io={padX:48,padY:48,colGap:304,rowGap:28,indentChapter:28,indentScene:56},F1=.5,X1=2,U_="ai-editor:canvas:";function bm(n){return Math.min(X1,Math.max(F1,n))}function H_(n){if(!n)return[];const o=[],r=(l,c,d)=>{for(const m of l)o.push({id:m.id,type:m.type,title:m.title,summary:m.summary,parentId:c,depth:d}),m.type!=="scene"&&m.children&&r(m.children,m.id,d+1)};return r(n.children,null,0),o}function rv(n){const o={};let r=0;for(const l of n){if(l.depth!==0)continue;const c=Io.padX+r*Io.colGap;let d=Io.padY;o[l.id]={x:c,y:d},d+=js[l.type]+Io.rowGap;for(const m of n)if(m.parentId===l.id){o[m.id]={x:c+Io.indentChapter,y:d},d+=js[m.type]+Io.rowGap;for(const g of n)g.parentId===m.id&&(o[g.id]={x:c+Io.indentScene,y:d},d+=js.scene+Io.rowGap)}r+=1}return o}function K1(n){return`${U_}${n}`}function B_(n){if(typeof n!="object"||n===null)return null;const o=n.nodes;if(typeof o!="object"||o===null||Array.isArray(o))return null;const r={};for(const[d,m]of Object.entries(o)){if(typeof m!="object"||m===null)return null;const g=m;if(typeof g.x!="number"||typeof g.y!="number"||!Number.isFinite(g.x)||!Number.isFinite(g.y))return null;r[d]={x:g.x,y:g.y}}const l=n.zoom,c=typeof l=="number"&&Number.isFinite(l)?bm(l):1;return{nodes:r,zoom:c}}function Y_(n){try{const o=localStorage.getItem(K1(n));return o===null?null:B_(JSON.parse(o))}catch{return null}}function Gf(n,o){try{localStorage.setItem(K1(n),JSON.stringify(o))}catch{}}function av(n,o,r){const l={};for(const c of r)l[c.id]=n?.[c.id]??o[c.id];return l}function V_(n){const o=[];for(const r of n){if(r.relationType!==MN||r.sourceType!=="outline_node"||r.targetType!=="outline_node")continue;const l=r.metadata?.label,c=typeof l=="string"&&l.trim()!==""?l.trim():void 0;o.push({id:r.id,sourceId:r.sourceId,targetId:r.targetId,label:c})}return o.sort((r,l)=>r.id<l.id?-1:r.id>l.id?1:0),o}function P_(n){return n.filter(o=>o.type==="scene")}function G_(n,o){return n.filter(r=>o.has(r.sourceId)&&o.has(r.targetId))}function lv(n,o){const r=Math.max(32,Math.abs(o.x-n.x)*.5),l=n.x+r,c=o.x-r;return`M ${n.x} ${n.y} C ${l} ${n.y}, ${c} ${o.y}, ${o.x} ${o.y}`}function q_(n,o){const r=Math.max(32,Math.abs(o.x-n.x)*.5),l={x:n.x+r,y:n.y},c={x:o.x-r,y:o.y};return{x:(n.x+3*l.x+3*c.x+o.x)/8,y:(n.y+3*l.y+3*c.y+o.y)/8}}function qf(n,o){return{x:n.x+gr[o]/2,y:n.y+js[o]/2}}function iv(n,o,r,l){const c=o.x-n.x,d=o.y-n.y;if(c===0&&d===0)return n;const m=c===0?Number.POSITIVE_INFINITY:r/2/Math.abs(c),g=d===0?Number.POSITIVE_INFINITY:l/2/Math.abs(d),b=Math.min(m,g);return{x:n.x+b*c,y:n.y+b*d}}const Ns={highlight:"#a855f7",scene:"#f59e0b",chapter:"#3b82f6",volume:"#06b6d4",default:"#94a3b8"};function F_(n,o={}){if(o.onPath||o.selected)return Ns.highlight;switch(n){case"scene":return Ns.scene;case"chapter":return Ns.chapter;case"volume":return Ns.volume;default:return Ns.default}}function X_(n={}){return n.onPath||n.selected?2.5:1.5}function K_(n={}){return n.offPath?.2:1}const $1="canvas-edge-arrow";function $_(){return`url(#${$1})`}const Uc={w:180,h:120},Ec=4,Q_=1,Z_=.02;function J_(n,o,r,l){let c=Number.POSITIVE_INFINITY,d=Number.POSITIVE_INFINITY,m=Number.NEGATIVE_INFINITY,g=Number.NEGATIVE_INFINITY,b=0;for(const R of n){const H=o[R.id];H&&(c=Math.min(c,H.x),d=Math.min(d,H.y),m=Math.max(m,H.x+gr[R.type]),g=Math.max(g,H.y+js[R.type]),b+=1)}if(b===0)return{nodeRects:[],viewportRect:null};const p=m-c,v=g-d,x=Uc.w-2*Ec,S=Uc.h-2*Ec,j=Math.min(x/p,S/v),N=Math.min(Q_,Math.max(Z_,j)),k=Ec+(x-p*N)/2,O=Ec+(S-v*N)/2,E=[];for(const R of n){const H=o[R.id];H&&E.push({id:R.id,x:k+(H.x-c)*N,y:O+(H.y-d)*N,w:gr[R.type]*N,h:js[R.type]*N,type:R.type})}let T=null;const _=r>0?r:1;if(l!==null&&l.width>0&&l.height>0){const R={x:l.x/_,y:l.y/_,width:l.width/_,height:l.height/_};T={x:k+(R.x-c)*N,y:O+(R.y-d)*N,w:R.width*N,h:R.height*N}}return{nodeRects:E,viewportRect:T}}function W_(n,o){const r=new Set([n]),l=new Set,c=[n];for(;c.length>0;){const d=c.pop();for(const m of o)m.sourceId!==d||l.has(m.id)||(l.add(m.id),r.has(m.targetId)||(r.add(m.targetId),c.push(m.targetId)))}return{nodeIds:r,edgeIds:l}}function cv(n){switch(n){case"RELATION_EXISTS":return"这条连线已经存在";case"VALIDATION_ERROR":return"连线参数有误";case"CLIENT_NETWORK_ERROR":return"无法连接服务,请确认 ai-editor 服务已启动";default:return null}}function e3(){const n=ze(ee=>ee.outline),o=ze(ee=>ee.outlineLoading),r=ze(ee=>ee.config),l=ze(ee=>ee.configLoading),c=ze(ee=>ee.loadOutline),[d,m]=h.useState({}),[g,b]=h.useState(1),[p,v]=h.useState(!1),[x,S]=h.useState(!0),[j,N]=h.useState(!1),[k,O]=h.useState(null),[E,T]=h.useState(null),[_,R]=h.useState(null),[H,A]=h.useState(null),[B,M]=h.useState(null),[Q,ne]=h.useState(null),[me,se]=h.useState(null),[X,te]=h.useState(null),[$,w]=h.useState(null),[U,Y]=h.useState(null),[z,I]=h.useState(!1),D=h.useRef(null),G=h.useRef(null),L=h.useRef(null),q=h.useRef(d);q.current=d;const Z=h.useRef(0),V=r?.id??null,be=r===null&&!l,ue=h.useCallback(async()=>{if(V===null)return;const xe=++Z.current;try{const Ce=await ja({source_type:"outline_node",relation_type:"plot_edge",depth:1});if(xe!==Z.current)return;O(V_(Ce.relations)),T(null)}catch(Ce){if(xe!==Z.current)return;T(Ce instanceof Ue?Ce.code:vt)}},[V]);Cs(()=>{c(),ue()});const he=h.useMemo(()=>H_(n),[n]),Le=h.useMemo(()=>new Map(he.map(ee=>[ee.id,ee])),[he]),[qe,we]=h.useState(null);h.useEffect(()=>{if(V===null){we(null),m({}),b(1);return}const ee=Y_(V);we(V),b(ee?.zoom??1),m(ee?.nodes??{})},[V]);const De=qe===V;h.useEffect(()=>{he.length===0||!De||m(ee=>av(ee,rv(he),he))},[he,De]),h.useEffect(()=>{if(!(V===null||!De))return L.current!==null&&window.clearTimeout(L.current),L.current=window.setTimeout(()=>{Gf(V,{nodes:d,zoom:g})},300),()=>{L.current!==null&&(window.clearTimeout(L.current),L.current=null,q.current===d&&V!==null&&De&&Gf(V,{nodes:d,zoom:g}))}},[d,V,g,De]),h.useEffect(()=>{V===null||!De||Gf(V,{nodes:d,zoom:g})},[g,V,De]),h.useEffect(()=>{n===null&&!o&&!j&&(N(!0),c())},[n,o,j,c]),h.useEffect(()=>{if(V===null){O(null),T(null);return}ue()},[V,ue]),h.useEffect(()=>{if(n===null){R(null);return}let ee=!1;return Promise.all(Ep.map(xe=>ja({source_type:"outline_node",relation_type:xe,depth:1}).then(Ce=>Ce.relations).catch(()=>[]))).then(xe=>{ee||R(U1(xe.flat()))}),()=>{ee=!0}},[n]);const Ae=h.useRef(null),ye=h.useRef(null),Ie=h.useCallback(()=>{const ee=D.current,xe=G.current;if(ee===null||xe===null)return;const Ce=ee.getBoundingClientRect(),$e=xe.getBoundingClientRect(),et={x:Math.round(Ce.left-$e.left),y:Math.round(Ce.top-$e.top),width:Math.round(Ce.width),height:Math.round(Ce.height)};ne(rt=>rt!==null&&rt.x===et.x&&rt.y===et.y&&rt.width===et.width&&rt.height===et.height?rt:et)},[]),oe=h.useCallback(ee=>{if(D.current=ee,Ae.current?.(),Ae.current=null,ye.current?.(),ye.current=null,ee===null)return;const xe=$e=>{$e.preventDefault(),b(et=>bm(Math.round((et+($e.deltaY<0?.1:-.1))*10)/10))};ee.addEventListener("wheel",xe,{passive:!1}),Ae.current=()=>ee.removeEventListener("wheel",xe),Ie();const Ce=new ResizeObserver(()=>Ie());Ce.observe(ee),ye.current=()=>Ce.disconnect()},[Ie]);h.useEffect(()=>()=>{Ae.current?.(),Ae.current=null,ye.current?.(),ye.current=null},[]),h.useEffect(()=>{if(X===null)return;const ee=xe=>{xe.key==="Escape"&&te(null)};return window.addEventListener("keydown",ee),()=>window.removeEventListener("keydown",ee)},[X]);const ce=p?P_(he):he,de=h.useMemo(()=>new Set(ce.map(ee=>ee.id)),[ce]),Te=h.useMemo(()=>G_(k??[],de),[k,de]);h.useEffect(()=>{B!==null&&!de.has(B)&&M(null)},[B,de]);const Me=h.useMemo(()=>{const ee=[];for(const xe of Te){const Ce=d[xe.sourceId],$e=d[xe.targetId],et=Le.get(xe.sourceId),rt=Le.get(xe.targetId);if(!Ce||!$e||!et||!rt)continue;const nt=qf(Ce,et.type),Vt=qf($e,rt.type),Xn=iv(nt,Vt,gr[et.type],js[et.type]),Kt=iv(Vt,nt,gr[rt.type],js[rt.type]);ee.push({edge:xe,d:lv(Xn,Kt),mid:q_(Xn,Kt),targetType:rt.type})}return ee},[Te,d,Le]),_e=h.useMemo(()=>B!==null&&X===null?W_(B,Te):null,[B,X,Te]),it=h.useMemo(()=>Me.map(ee=>{const xe=ee.edge.id===H,Ce=_e?.edgeIds.has(ee.edge.id)??!1;return{...ee,stroke:F_(ee.targetType,{onPath:Ce,selected:xe}),strokeWidth:X_({onPath:Ce,selected:xe}),opacity:K_({offPath:_e!==null&&!Ce}),dash:Ce||xe}}),[Me,_e,H]),ie=h.useMemo(()=>J_(ce,d,g,Q),[ce,d,g,Q]),F=h.useMemo(()=>{let ee=0,xe=0;for(const Ce of he){const $e=d[Ce.id];$e&&(ee=Math.max(ee,$e.x+gr[Ce.type]),xe=Math.max(xe,$e.y+js[Ce.type]))}return{w:ee+96,h:xe+96}},[he,d]),pe=h.useMemo(()=>Me.find(ee=>ee.edge.id===H)??null,[Me,H]),J=h.useMemo(()=>{if(X===null||$===null)return null;const ee=Le.get(X),xe=d[X];return!ee||!xe?null:lv(qf(xe,ee.type),$)},[X,$,d,Le]);function je(ee,xe){const Ce=G.current?.getBoundingClientRect();return Ce?{x:(ee-Ce.left)/g,y:(xe-Ce.top)/g}:{x:0,y:0}}function Fe(ee,xe){if(ee.target.closest("[data-canvas-handle]")||ee.button!==0)return;ee.preventDefault();const Ce=d[xe.id];Ce&&(ee.currentTarget.setPointerCapture(ee.pointerId),se({nodeId:xe.id,startClientX:ee.clientX,startClientY:ee.clientY,origX:Ce.x,origY:Ce.y}))}function Ne(ee,xe){if(me===null||me.nodeId!==xe)return;const Ce=(ee.clientX-me.startClientX)/g,$e=(ee.clientY-me.startClientY)/g;m(et=>et[xe]?{...et,[xe]:{x:me.origX+Ce,y:me.origY+$e}}:et)}function Oe(){se(null)}function Xe(ee,xe){ee.stopPropagation(),ee.preventDefault(),ee.button===0&&(ee.currentTarget.setPointerCapture(ee.pointerId),A(null),te(xe.id),w(je(ee.clientX,ee.clientY)))}function st(ee){X!==null&&w(je(ee.clientX,ee.clientY))}async function Et(ee){if(X===null)return;const xe=X,et=document.elementFromPoint(ee.clientX,ee.clientY)?.closest("[data-canvas-node-id]")?.getAttribute("data-canvas-node-id")??null;if(te(null),w(null),!(et===null||et===xe))try{await Oa({source_type:"outline_node",source_id:xe,target_type:"outline_node",target_id:et,relation_type:"plot_edge"}),ke.getState().showToast("已建立连线"),await ue()}catch(rt){const nt=rt instanceof Ue?rt.code:null,Vt=cv(nt);if(Vt!==null){ke.getState().showToast(Vt,"error"),await ue();return}ke.getState().showToast(rt instanceof Ue?rt.message:"创建失败,请重试","error")}}const kt=h.useRef(!1);function xt(ee){kt.current=!1,Y({edgeId:ee.id,draft:ee.label??""})}async function yn(ee,xe){if(!z){I(!0),Y(null);try{const Ce=xe.trim();await lT(ee,Ce===""?{}:{label:Ce}),ke.getState().showToast("已保存标签"),await ue()}catch(Ce){ke.getState().showToast(Ce instanceof Ue?Ce.message:"保存失败,请重试","error")}finally{I(!1)}}}function an(ee){ee.key==="Enter"?(ee.preventDefault(),kt.current=!0,U!==null&&yn(U.edgeId,U.draft)):ee.key==="Escape"&&(ee.preventDefault(),kt.current=!0,Y(null))}function Ke(){kt.current||U!==null&&yn(U.edgeId,U.draft)}async function Tt(){if(pe===null)return;const ee=pe.edge;if(await ke.getState().confirm({title:"删除连线",description:`删除连线「${ee.label??"未命名"}」?物理删除不可恢复,可随时重建。`,danger:!0}))try{kt.current=!0,Y(null),await Bc(ee.id),ke.getState().showToast("已删除连线"),A(null),await ue()}catch(Ce){const $e=Ce instanceof Ue?Ce.code:null,et=cv($e);ke.getState().showToast(et??(Ce instanceof Ue?Ce.message:"删除失败,请重试"),"error"),$e==="RELATION_NOT_FOUND"&&(A(null),await ue())}}function tn(){m(ee=>av(ee,rv(he),he))}function Gt(ee){b(xe=>bm(Math.round((xe+ee)*10)/10))}return i.jsxs("section",{className:"flex h-full min-h-0 flex-col gap-3",children:[i.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[i.jsx("h1",{className:"mr-auto font-serif text-xl font-medium",children:"画布"}),i.jsx(Se,{variant:"outline",type:"button",onClick:tn,disabled:he.length===0,children:"重新布局"}),i.jsxs("div",{className:"flex items-center gap-1.5",children:[i.jsx(Se,{variant:"outline",size:"icon-sm",type:"button","aria-label":"缩小",disabled:g<=F1,onClick:()=>Gt(-.1),children:i.jsx(mj,{})}),i.jsxs("span",{className:"w-12 text-center text-sm tabular-nums text-muted-foreground",children:[Math.round(g*100),"%"]}),i.jsx(Se,{variant:"outline",size:"icon-sm",type:"button","aria-label":"放大",disabled:g>=X1,onClick:()=>Gt(.1),children:i.jsx(jm,{})})]}),i.jsx("div",{className:"flex items-center gap-1 rounded-lg bg-secondary/30 p-1",role:"group","aria-label":"显示模式",children:[!1,!0].map(ee=>i.jsx("button",{type:"button",onClick:()=>v(ee),"aria-pressed":p===ee,className:We("rounded-md px-2.5 py-1 text-xs transition-colors",p===ee?"bg-card text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:ee?"仅场景":"全部节点"},String(ee)))}),i.jsxs(Se,{variant:"ghost",size:"sm",type:"button",onClick:()=>S(ee=>!ee),"aria-expanded":x,children:[i.jsx(Tv,{}),"画布说明"]})]}),x&&i.jsxs("p",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:["连线与坐标仅用于推演展示,不参与状态计算",i.jsx("button",{type:"button",className:"rounded p-0.5 hover:bg-muted hover:text-foreground","aria-label":"收起说明",onClick:()=>S(!1),children:i.jsx(ro,{className:"size-3"})})]}),E!==null&&i.jsxs("div",{className:"rounded-md border border-destructive/30 bg-destructive/10 px-3 py-2 text-sm text-destructive",children:[E===vt?"无法连接服务,请确认 ai-editor 服务已启动。":"连线加载失败,请重试。",i.jsx(Se,{variant:"outline",className:"ml-3",type:"button",onClick:()=>{ue()},children:"重试"})]}),be?i.jsxs("div",{className:"rounded-md border border-dashed border-border px-6 py-10 text-center",children:[i.jsx("p",{className:"text-sm text-muted-foreground",children:"未打开项目,无法查看画布"}),i.jsx("a",{href:"#/",className:"mt-2 inline-block text-sm text-muted-foreground underline hover:text-foreground",children:"回到首页打开或创建书籍"})]}):o&&n===null?i.jsx("div",{className:"flex-1 overflow-hidden rounded-md border border-border bg-muted/20 p-4",children:Array.from({length:3},(ee,xe)=>i.jsxs("div",{className:"mb-4 flex gap-4",children:[i.jsx("div",{className:"h-24 w-60 animate-pulse rounded-lg bg-muted"}),i.jsx("div",{className:"mt-6 h-24 w-52 animate-pulse rounded-lg bg-muted"}),i.jsx("div",{className:"mt-12 h-20 w-44 animate-pulse rounded-lg bg-muted"})]},xe))}):n===null?i.jsxs("div",{className:"rounded-md border border-border p-4 text-sm text-muted-foreground",children:["大纲加载失败",i.jsx(Se,{variant:"outline",className:"ml-3",type:"button",onClick:()=>N(!1),children:"重试"})]}):n.children.length===0?i.jsxs("div",{className:"rounded-lg border border-dashed border-border px-6 py-12 text-center",children:[i.jsx("p",{className:"text-sm text-muted-foreground",children:"大纲还是空的,先去搭大纲"}),i.jsx(Se,{className:"mt-4",type:"button",onClick:()=>Tn("/outline"),children:"去大纲"})]}):ce.length===0?i.jsxs("div",{className:"rounded-lg border border-dashed border-border px-6 py-12 text-center",children:[i.jsx("p",{className:"text-sm text-muted-foreground",children:"当前大纲还没有场景节点"}),i.jsx(Se,{variant:"outline",className:"mt-4",type:"button",onClick:()=>v(!1),children:"显示全部节点"})]}):i.jsxs("div",{ref:oe,className:"relative min-h-0 flex-1 overflow-auto rounded-md border border-border bg-muted/20",onScroll:Ie,onClick:ee=>{ee.target===ee.currentTarget&&A(null)},children:[i.jsxs("div",{ref:G,className:"relative",style:{width:F.w,height:F.h,transform:`scale(${g})`,transformOrigin:"0 0"},onClick:ee=>{ee.target===ee.currentTarget&&A(null)},children:[i.jsxs("svg",{className:"pointer-events-none absolute left-0 top-0",width:F.w,height:F.h,style:{overflow:"visible"},children:[i.jsx("defs",{children:i.jsx("marker",{id:$1,viewBox:"0 0 10 10",refX:10,refY:5,markerWidth:10,markerHeight:10,markerUnits:"userSpaceOnUse",orient:"auto",children:i.jsx("path",{d:"M 0 0 L 10 5 L 0 10 Z",fill:"context-stroke"})})}),it.map(({edge:ee,d:xe,stroke:Ce,strokeWidth:$e,opacity:et,dash:rt})=>{const nt=ee.id===H;return i.jsxs("g",{opacity:et,children:[i.jsx("path",{d:xe,fill:"none",stroke:Ce,strokeWidth:$e,strokeDasharray:rt?"6 4":void 0,vectorEffect:"non-scaling-stroke",markerEnd:$_(),className:rt?"canvas-edge-flow":void 0}),i.jsx("path",{d:xe,fill:"none",stroke:"transparent",strokeWidth:14,vectorEffect:"non-scaling-stroke",className:"pointer-events-auto cursor-pointer",onClick:()=>A(nt?null:ee.id)})]},ee.id)}),J!==null&&i.jsx("path",{d:J,fill:"none",stroke:"var(--primary)",strokeWidth:2,strokeDasharray:"6 4",vectorEffect:"non-scaling-stroke"})]}),it.map(({edge:ee,mid:xe,opacity:Ce})=>{const $e=ee.id===H;return $e&&U!==null&&U.edgeId===ee.id?i.jsx("div",{className:"absolute z-20 -translate-x-1/2 -translate-y-1/2",style:{left:xe.x,top:xe.y},children:i.jsx(Ot,{value:U.draft,onChange:rt=>Y({edgeId:ee.id,draft:rt.target.value}),onKeyDown:an,onBlur:Ke,onFocus:rt=>rt.currentTarget.select(),maxLength:50,placeholder:"+ 标签",autoFocus:!0,"aria-label":"编辑连线标签",className:"h-7 w-44 rounded-md px-1.5 py-0.5 text-xs"})},`label-${ee.id}`):i.jsx("span",{className:We("pointer-events-none absolute max-w-44 -translate-x-1/2 -translate-y-1/2 truncate whitespace-nowrap rounded border bg-card px-1.5 py-0.5 text-[10px] text-muted-foreground",$e&&"pointer-events-auto cursor-text"),style:{left:xe.x,top:xe.y,opacity:Ce,...$e?{borderColor:Ns.highlight,color:Ns.highlight}:{}},title:$e?ee.label===void 0?"添加标签":"编辑标签":void 0,onClick:rt=>{rt.stopPropagation(),xt(ee)},children:ee.label??($e?"+ 标签":"未命名连线")},`label-${ee.id}`)}),pe!==null&&i.jsxs("div",{className:"absolute z-10 flex -translate-x-1/2 items-center gap-1 rounded-lg border border-border bg-card p-1 shadow-sm",style:{left:pe.mid.x,top:pe.mid.y+26},children:[i.jsx("span",{className:"max-w-36 truncate px-1.5 text-xs text-muted-foreground",children:pe.edge.label??"未命名连线"}),i.jsx(Se,{variant:"outline",size:"xs",type:"button",className:"text-destructive hover:bg-destructive/10",onClick:()=>{Tt()},children:"删除连线"}),i.jsx("button",{type:"button","aria-label":"取消选择",className:"rounded p-0.5 text-muted-foreground hover:bg-muted hover:text-foreground",onClick:()=>A(null),children:i.jsx(ro,{className:"size-3.5"})})]}),ce.map(ee=>{const xe=d[ee.id];if(!xe)return null;const Ce=_?.get(ee.id)??[],$e=X===ee.id,et=me?.nodeId===ee.id,rt=_e?.nodeIds.has(ee.id)??!1;return i.jsxs("div",{"data-canvas-node-id":ee.id,className:We("group absolute cursor-grab touch-none select-none rounded-lg border bg-card p-2.5 transition-colors active:cursor-grabbing",$e?"border-primary ring-2 ring-ring/40":"border-border",et&&"opacity-80"),style:{left:xe.x,top:xe.y,width:gr[ee.type],height:js[ee.type],..._e!==null?{opacity:rt?1:.2,boxShadow:rt?`0 0 0 2px ${Ns.highlight}`:void 0}:{}},title:"拖动调整位置",onPointerDown:nt=>Fe(nt,ee),onPointerMove:nt=>Ne(nt,ee.id),onPointerUp:Oe,onMouseEnter:()=>M(ee.id),onMouseLeave:()=>M(nt=>nt===ee.id?null:nt),children:[i.jsxs("div",{className:"flex items-center gap-1.5",children:[i.jsx("span",{className:"shrink-0 rounded bg-muted px-1.5 py-0.5 text-xs text-muted-foreground",children:os[ee.type]}),i.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-medium text-foreground",title:ee.title,children:ee.title}),Ce.length>0&&i.jsx("span",{className:"flex shrink-0 items-center gap-0.5",children:Ce.map(nt=>i.jsx(I1,{mark:nt},`${nt.relationType}-${nt.hookId}`))})]}),ee.summary&&i.jsx("p",{className:"mt-1 line-clamp-2 text-xs leading-4 text-muted-foreground",children:ee.summary}),i.jsx("span",{"data-canvas-handle":!0,className:We("absolute top-1/2 -right-2 h-4 w-4 -translate-y-1/2 cursor-crosshair rounded-full border bg-card transition-colors",$e?"border-primary bg-primary/10":"border-border hover:border-primary hover:bg-accent"),title:"拖出连线","aria-label":"拖出连线",onPointerDown:nt=>Xe(nt,ee),onPointerMove:st,onPointerUp:Et})]},ee.id)})]}),i.jsx("div",{className:"pointer-events-none absolute right-2 bottom-2 z-10 overflow-hidden rounded-md border border-border bg-card/90 shadow-sm",children:i.jsxs("svg",{width:Uc.w,height:Uc.h,children:[ie.nodeRects.map(ee=>i.jsx("rect",{x:ee.x,y:ee.y,width:ee.w,height:ee.h,rx:2,fill:Ns[ee.type],opacity:.85},ee.id)),ie.viewportRect!==null&&i.jsx("rect",{x:ie.viewportRect.x,y:ie.viewportRect.y,width:ie.viewportRect.w,height:ie.viewportRect.h,fill:"none",stroke:Ns.highlight,strokeWidth:1})]})})]})]})}const ya={character:"人物",setting:"设定",location:"地点",hook:"伏笔",event:"事件"},uv=[{value:"updated_at:desc",label:"更新时间(新→旧)",sort:"updated_at",order:"desc"},{value:"updated_at:asc",label:"更新时间(旧→新)",sort:"updated_at",order:"asc"},{value:"name:asc",label:"名称(A→Z)",sort:"name",order:"asc"},{value:"name:desc",label:"名称(Z→A)",sort:"name",order:"desc"},{value:"created_at:desc",label:"创建时间(新→旧)",sort:"created_at",order:"desc"},{value:"created_at:asc",label:"创建时间(旧→新)",sort:"created_at",order:"asc"}];function dv({type:n}){const o=n==="relations",r=Na.includes(n)?n:"character",[l,c]=h.useState(null),[d,m]=h.useState(0),[g,b]=h.useState(!1),[p,v]=h.useState(null),[x,S]=h.useState(""),[j,N]=h.useState(""),[k,O]=h.useState(0),[E,T]=h.useState("updated_at"),[_,R]=h.useState("desc"),[H,A]=h.useState(0);Cs(()=>A(V=>V+1));const[B,M]=h.useState(!1),[Q,ne]=h.useState(""),[me,se]=h.useState(""),[X,te]=h.useState(null),[$,w]=h.useState(!1),U=m_[r],Y=Jy[r],z=f_(d,jl),I=Math.floor(k/jl)+1;h.useEffect(()=>{S(""),N(""),O(0),T("updated_at"),R("desc"),c(null),v(null),M(!1)},[n]),h.useEffect(()=>{const V=setTimeout(()=>{N(x.trim()),O(0)},300);return()=>clearTimeout(V)},[x]),h.useEffect(()=>{if(o)return;let V=!1;return b(!0),v(null),br(r,{q:j||void 0,offset:k,limit:jl,sort:E,order:_}).then(be=>{V||(c(be.items),m(be.total))}).catch(be=>{V||(c(null),v(be instanceof Ue?be.code:vt))}).finally(()=>{V||b(!1)}),()=>{V=!0}},[r,j,k,E,_,H,o]);function D(V){const be=uv.find(ue=>ue.value===V);be&&(T(be.sort),R(be.order),O(0))}function G(){ne(""),se(""),te(null),M(!0)}function L(){M(!1),te(null)}async function q(V){V.preventDefault();const be=Q.trim();if(!be){te("请输入名称");return}w(!0),te(null);try{const ue=Jy[r],he={};me.trim()&&(he[ue.key]=me.trim());const Le=await Cm(r,{name:be,data:he});ke.getState().showToast(`已创建${ya[r]}《${be}》`),M(!1),Tn(`/entities/${r}/${Le.id}`)}catch(ue){te(ue instanceof Ue?ue.message:"创建失败,请重试")}finally{w(!1)}}function Z(){S(""),N(""),O(0)}return i.jsxs("section",{children:[i.jsx("h1",{className:"mb-4 text-xl font-semibold",children:"实体"}),i.jsxs("div",{className:"flex flex-wrap items-center gap-3 border-b border-zinc-200 pb-3",children:[i.jsxs("div",{className:"flex gap-1",children:[Na.map(V=>i.jsx("button",{type:"button",onClick:()=>Tn(`/entities/${V}`),className:We("rounded-md px-3 py-1.5 text-sm",!o&&r===V?"bg-zinc-900 text-white":"text-zinc-500 hover:bg-zinc-100 hover:text-zinc-800"),children:ya[V]},V)),i.jsx("button",{type:"button",onClick:()=>Tn("/entities/relations"),className:We("rounded-md px-3 py-1.5 text-sm",o?"bg-foreground font-medium text-background":"text-muted-foreground hover:bg-muted hover:text-foreground"),children:"关联"})]}),i.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[!o&&i.jsx(Ot,{value:x,onChange:V=>S(V.target.value),placeholder:`搜索${ya[r]}名称…`,className:"w-52"}),i.jsx(Se,{type:"button",onClick:o?()=>M(!0):G,children:o?"+ 建立关联":"+ 新建"})]})]}),o?i.jsx(P1,{reloadKey:H,onOpenCreate:()=>M(!0)}):i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"mb-2 mt-3 flex items-center gap-3",children:[i.jsxs("label",{className:"flex items-center gap-2 text-sm text-zinc-500",children:["排序:",i.jsx("select",{value:`${E}:${_}`,onChange:V=>D(V.target.value),className:"rounded-md border border-zinc-300 bg-white px-2 py-1 text-sm focus:outline-none focus-visible:ring-2 focus-visible:ring-zinc-400",children:uv.map(V=>i.jsx("option",{value:V.value,children:V.label},V.value))})]}),i.jsxs("span",{className:"ml-auto text-sm text-zinc-400",children:["共 ",d," 个"]})]}),B&&i.jsxs("form",{id:"create-entity-row",onSubmit:q,className:"mb-3 flex flex-wrap items-center gap-2 rounded-md border border-border bg-card px-3 py-2",children:[i.jsx(Ot,{value:Q,onChange:V=>ne(V.target.value),onKeyDown:V=>{V.key==="Escape"&&L()},placeholder:`名称(如:${r==="character"?"张三":"示例名称"})`,maxLength:100,disabled:$,autoFocus:!0,"aria-label":"名称",className:"w-48"}),Y.input==="select"?i.jsxs("select",{value:me,onChange:V=>se(V.target.value),disabled:$,"aria-label":Y.label,className:"rounded-md border border-input bg-background px-2 py-1.5 text-sm focus:outline-none focus-visible:ring-2 focus-visible:ring-ring/50",children:[i.jsxs("option",{value:"",children:[Y.label,"(选填)"]}),Y.options?.map(V=>i.jsx("option",{value:V,children:Yf(r,Y.key,V)},V))]}):i.jsx(Ot,{value:me,onChange:V=>se(V.target.value),placeholder:`${Y.label}(选填)`,disabled:$,"aria-label":Y.label,className:"w-40"}),i.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[i.jsx(Se,{variant:"outline",type:"button",size:"sm",onClick:L,disabled:$,children:"取消"}),i.jsx(Se,{type:"submit",size:"sm",disabled:$,children:$?"创建中…":"创建"})]}),X&&i.jsx("p",{className:"w-full text-sm text-destructive",children:X})]}),p!==null&&i.jsxs("div",{className:"mb-3 rounded-md border border-red-200 bg-red-50 px-3 py-2 text-sm text-red-700",children:[p===vt?"无法连接服务,请确认 ai-editor 服务已启动。":"列表加载失败,请重试。",i.jsx(Se,{variant:"outline",className:"ml-3",type:"button",onClick:()=>A(V=>V+1),children:"重试"})]}),g&&l===null&&p===null&&i.jsx("div",{className:"overflow-hidden rounded-md border border-zinc-200",children:Array.from({length:6},(V,be)=>i.jsxs("div",{className:"flex items-center gap-3 border-b border-zinc-100 px-3 py-3 last:border-0",children:[i.jsx("div",{className:"h-4 w-1/4 animate-pulse rounded bg-zinc-100"}),i.jsx("div",{className:"h-4 w-1/6 animate-pulse rounded bg-zinc-100"}),U.key2&&i.jsx("div",{className:"h-4 w-1/6 animate-pulse rounded bg-zinc-100"}),i.jsx("div",{className:"ml-auto h-4 w-16 animate-pulse rounded bg-zinc-100"})]},be))}),!g&&l!==null&&l.length===0&&i.jsx("div",{className:"rounded-lg border border-dashed border-zinc-300 px-6 py-12 text-center",children:j?i.jsxs(i.Fragment,{children:[i.jsxs("p",{className:"text-sm text-zinc-600",children:["没有匹配「",j,"」的",ya[r]]}),i.jsx(Se,{variant:"outline",className:"mt-4",type:"button",onClick:Z,children:"清空搜索"})]}):i.jsxs(i.Fragment,{children:[i.jsxs("p",{className:"text-sm text-zinc-600",children:["还没有",ya[r],",新建一个"]}),i.jsxs(Se,{className:"mt-4",type:"button",onClick:G,children:["+ 新建",ya[r]]})]})}),!g&&l!==null&&l.length>0&&i.jsx("div",{className:"overflow-hidden rounded-md border border-zinc-200",children:i.jsxs("table",{className:"w-full text-left text-sm",children:[i.jsx("thead",{children:i.jsxs("tr",{className:"border-b border-zinc-200 bg-zinc-50 text-xs text-zinc-400",children:[i.jsx("th",{className:"px-3 py-2 font-normal",children:"名称"}),i.jsx("th",{className:"px-3 py-2 font-normal",children:U.label1}),U.key2&&i.jsx("th",{className:"px-3 py-2 font-normal",children:U.label2}),i.jsx("th",{className:"px-3 py-2 text-right font-normal",children:"更新时间"})]})}),i.jsx("tbody",{children:l.map(V=>i.jsxs("tr",{className:"cursor-pointer border-b border-zinc-100 transition-colors last:border-0 hover:bg-zinc-50",onClick:()=>Tn(`/entities/${r}/${V.id}`),title:`打开《${V.name}》`,children:[i.jsx("td",{className:"max-w-64 truncate px-3 py-2 font-medium text-zinc-800",children:V.name}),i.jsx("td",{className:"max-w-40 truncate px-3 py-2 text-zinc-600",children:Yf(r,U.key1,V.summary[U.key1])}),U.key2&&i.jsx("td",{className:"max-w-40 truncate px-3 py-2 text-zinc-600",children:Yf(r,U.key2,V.summary[U.key2])}),i.jsx("td",{className:"whitespace-nowrap px-3 py-2 text-right text-xs text-zinc-400",children:ls(V.updatedAt)})]},V.id))})]})}),!g&&l!==null&&l.length>0&&i.jsxs("div",{className:"mt-4 flex items-center justify-center gap-3 text-sm",children:[i.jsx("button",{type:"button",disabled:I<=1||g,className:"rounded-md border border-zinc-300 px-3 py-1 text-zinc-600 hover:bg-zinc-100 disabled:opacity-40",onClick:()=>O((I-2)*jl),children:"‹ 上一页"}),i.jsxs("span",{className:"text-zinc-500",children:["第 ",I," / ",z," 页"]}),i.jsx("button",{type:"button",disabled:I>=z||g,className:"rounded-md border border-zinc-300 px-3 py-1 text-zinc-600 hover:bg-zinc-100 disabled:opacity-40",onClick:()=>O(I*jl),children:"下一页 ›"})]})]}),o&&B&&i.jsx(Rp,{source:null,onCreated:()=>A(V=>V+1),onClose:()=>M(!1)})]})}function t3({type:n,id:o,currentData:r,deltaCount:l}){const c=ze(T=>T.outline),d=ze(T=>T.config),m=ze(T=>T.loadOutline),[g,b]=h.useState(()=>{const T=ze.getState().config?.currentPosition??"",_=ze.getState().outline?.children??[];return T!==""&&oo(_).some(R=>R.id===T)?T:""}),[p,v]=h.useState(!1),[x,S]=h.useState(null),[j,N]=h.useState(null);h.useEffect(()=>{b(T=>{if(T!=="")return T;const _=d?.currentPosition??"";return _!==""&&oo(c?.children??[]).some(R=>R.id===_)?_:""})},[d?.currentPosition,c]);const k=oo(c?.children??[]),O=new Map(k.map(T=>[T.id,T.label]));async function E(){if(!(!g||p)){v(!0),N(null);try{const T=await cT({target_type:n,target_id:o,at_node_id:g});S(T)}catch(T){S(null),T instanceof Ue&&T.code==="OUTLINE_NODE_NOT_FOUND"?N("该节点已不存在,请重新选择计算节点"):N(T instanceof Ue?T.message:"无法连接服务,请确认 ai-editor 服务已启动")}finally{v(!1)}}}return i.jsxs("div",{className:"mb-4 rounded-md border border-border p-4",children:[i.jsxs("h2",{className:"mb-2 text-sm font-semibold text-foreground",children:["变更记录 · 状态预览",i.jsxs("span",{className:"ml-2 text-xs font-normal text-muted-foreground",children:[l," 条"]})]}),l===0?i.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无变更记录——实体当前状态即初始状态"}):i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"flex flex-wrap items-end gap-2",children:[i.jsxs("div",{className:"flex flex-col gap-1",children:[i.jsx("span",{className:"text-xs text-muted-foreground",children:"计算节点(到达该节点时的累积状态)"}),c===null?i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"text-xs text-muted-foreground",children:"大纲未加载"}),i.jsx(Se,{variant:"outline",size:"xs",type:"button",onClick:()=>{m()},children:"加载大纲"})]}):i.jsxs("select",{value:g,onChange:T=>b(T.target.value),"aria-label":"计算节点",className:We("min-w-56 rounded-md border border-border bg-card px-2 py-1 text-sm text-foreground focus:outline-none focus-visible:ring-2 focus-visible:ring-ring",g===""&&"text-muted-foreground"),children:[i.jsx("option",{value:"",children:"请选择大纲节点"}),k.map(T=>i.jsxs("option",{value:T.id,children:[" ".repeat(T.depth),T.label]},T.id))]})]}),i.jsx(Se,{variant:"outline",size:"sm",type:"button",disabled:!g||p,onClick:()=>{E()},children:p?"计算中…":"计算"})]}),d?.currentPosition==null&&i.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"未设置当前位置,请手动选择计算节点"}),j!==null&&i.jsx("div",{className:"mt-3 rounded-md border border-destructive/30 bg-destructive/10 px-3 py-2 text-sm text-destructive",children:j}),p&&i.jsxs("div",{className:"mt-3 space-y-2",children:[i.jsx("div",{className:"h-4 w-2/3 animate-pulse rounded bg-muted"}),i.jsx("div",{className:"h-4 w-1/2 animate-pulse rounded bg-muted"}),i.jsx("div",{className:"h-16 animate-pulse rounded bg-muted/60"})]}),!p&&x!==null&&i.jsx(n3,{result:x,currentData:r,nodeTitles:O})]})]})}function n3({result:n,currentData:o,nodeTitles:r}){const l=y_(o,n.state),c=r.get(n.atNodeId)??n.atNodeId;return i.jsxs("div",{className:"mt-3 space-y-3",children:[n.conflicts.length>0&&i.jsxs("div",{className:"rounded-md border border-destructive/30 bg-destructive/10 px-3 py-2",children:[i.jsxs("div",{className:"flex items-center gap-1.5 text-sm font-medium text-destructive",children:[i.jsx(Tm,{className:"size-3.5 shrink-0"}),"发现 ",n.conflicts.length," 处状态冲突"]}),i.jsx("p",{className:"mt-0.5 text-xs text-destructive/90",children:"手动编辑的数据与变更记录不一致,以下变更未应用(可直接修改当前数据,或调整变更记录):"}),i.jsx("ul",{className:"mt-1 space-y-0.5",children:n.conflicts.map((d,m)=>i.jsxs("li",{className:"text-xs text-destructive",children:[d.field,":记录应为 ",rs(d.expected),",实际为 ",rs(d.actual)]},m))})]}),i.jsxs("div",{children:[i.jsxs("h3",{className:"mb-1.5 text-xs font-medium text-muted-foreground",children:["状态差异(相对当前数据 · 到达《",c,"》",l.length>0?`,${l.length} 处`:"",")"]}),l.length===0?i.jsx("p",{className:"text-xs text-muted-foreground",children:"计算状态与当前数据一致"}):i.jsx("ul",{className:"space-y-1",children:l.map(d=>i.jsxs("li",{className:"flex items-baseline gap-2 text-xs",children:[i.jsx("span",{className:"shrink-0 font-medium text-foreground",children:d.field}),i.jsxs("span",{className:"text-muted-foreground",children:[d.from===void 0?"(无)":rs(d.from)," →"," ",d.to===void 0?"(已移除)":rs(d.to)]})]},d.field))})]}),i.jsxs("div",{children:[i.jsxs("h3",{className:"mb-1.5 text-xs font-medium text-muted-foreground",children:["应用的变更记录(",n.appliedDeltas.length,")"]}),n.appliedDeltas.length===0?i.jsx("p",{className:"text-xs text-muted-foreground",children:"到达该节点前没有变更被应用"}):i.jsx("ul",{className:"divide-y divide-border/70 rounded-md border border-border",children:n.appliedDeltas.map((d,m)=>i.jsxs("li",{className:"px-3 py-2",children:[i.jsxs("div",{className:"flex flex-wrap items-baseline gap-2",children:[i.jsx("span",{className:"min-w-0 flex-1 truncate text-sm text-foreground",title:d.description,children:d.description}),i.jsxs("span",{className:"shrink-0 text-xs text-muted-foreground",children:["《",r.get(d.nodeId)??d.nodeId,"》"]})]}),d.skipped!==void 0&&d.skipped.length>0&&i.jsx("ul",{className:"mt-1 space-y-0.5",children:d.skipped.map(g=>i.jsxs("li",{className:"text-xs text-destructive",children:[g.field,":记录应为 ",rs(g.expected),",实际 ",rs(g.actual),"(已跳过)"]},g.index))}),i.jsx("div",{className:"mt-1.5",children:i.jsx(G1,{changes:d.changes,skipped:d.skipped?.map(g=>g.index)})})]},m))})]})]})}const s3={character:"人物",setting:"设定",location:"地点",hook:"伏笔",event:"事件"};function wl(n,o){const r=n[o];return r==null?"":String(r)}function o3({values:n,onChange:o,placeholder:r}){return i.jsxs("div",{className:"flex flex-col gap-1.5",children:[n.map((l,c)=>i.jsxs("div",{className:"flex items-center gap-1.5",children:[i.jsx(Ot,{value:l,onChange:d=>{const m=[...n];m[c]=d.target.value,o(m)},placeholder:r,className:"h-8 flex-1 text-sm"}),i.jsx(Se,{variant:"outline",type:"button",className:"h-8 px-2 text-xs",onClick:()=>o(n.filter((d,m)=>m!==c)),children:"删除"})]},c)),i.jsx(Se,{variant:"outline",type:"button",className:"h-8 self-start px-2 text-xs",onClick:()=>o([...n,""]),children:"+ 添加"})]})}function r3({value:n,onChange:o}){const[r,l]=h.useState(()=>Object.entries(n??{}).map(([d,m])=>({key:d,value:String(m??"")})));h.useEffect(()=>{l(Object.entries(n??{}).map(([d,m])=>({key:d,value:String(m??"")})))},[n]);function c(d){l(d);const m={};for(const g of d)g.key.trim()&&(m[g.key.trim()]=g.value);o(m)}return i.jsxs("div",{className:"flex flex-col gap-1.5",children:[r.map((d,m)=>i.jsxs("div",{className:"flex items-center gap-1.5",children:[i.jsx(Ot,{value:d.key,onChange:g=>c(r.map((b,p)=>p===m?{...b,key:g.target.value}:b)),placeholder:"键",className:"h-8 w-28 text-sm"}),i.jsx(Ot,{value:d.value,onChange:g=>c(r.map((b,p)=>p===m?{...b,value:g.target.value}:b)),placeholder:"值",className:"h-8 flex-1 text-sm"}),i.jsx(Se,{variant:"outline",type:"button",className:"h-8 px-2 text-xs",onClick:()=>c(r.filter((g,b)=>b!==m)),children:"删除"})]},m)),i.jsx(Se,{variant:"outline",type:"button",className:"h-8 self-start px-2 text-xs",onClick:()=>c([...r,{key:"",value:""}]),children:"+ 添加字段"})]})}function a3({type:n,id:o}){const r=n,[l,c]=h.useState(null),[d,m]=h.useState(!1),[g,b]=h.useState(!1),[p,v]=h.useState(null),[x,S]=h.useState(null),[j,N]=h.useState(!1),[k,O]=h.useState(null),[E,T]=h.useState(!1),[_,R]=h.useState(null),[H,A]=h.useState(!1),[B,M]=h.useState(!1),Q=wp(r);async function ne(){m(!0),v(null),b(!1);try{const w=await mr(r,o);c(w),S(JSON.parse(JSON.stringify(w.data)))}catch(w){c(null),S(null),w instanceof Ue&&w.code==="ENTITY_NOT_FOUND"?b(!0):v(w instanceof Ue?w.code:vt)}finally{m(!1)}}h.useEffect(()=>{ne()},[r,o]),Cs(()=>{ne()});async function me(){if(!l||!x||j)return;const w=Cp(l.data,x);if(!w){ke.getState().showToast("没有变更");return}N(!0),O(null);try{await Ra(r,o,{data:w}),ke.getState().showToast("已保存"),await ne()}catch(U){if(U instanceof Ue&&U.code==="ENTITY_NOT_FOUND"){b(!0);return}O(U instanceof Ue?U.message:"保存失败,请重试")}finally{N(!1)}}function se(w,U){S(Y=>Y&&{...Y,[w]:U})}async function X(){if(l)try{const w=await Hc(r,o),U=[];w.cascaded.relations>0&&U.push(`${w.cascaded.relations} 条关联`),w.cascaded.deltas>0&&U.push(`${w.cascaded.deltas} 条变更记录`),ke.getState().showToast(`已移入回收站,可随时还原${U.length>0?`(含 ${U.join("、")})`:""}`),A(!1),Tn(`/entities/${r}`)}catch(w){throw w}}async function te(){if(_)try{await Bc(_.id),ke.getState().showToast("已删除关系"),R(null),await ne()}catch(w){throw w}}function $(w,U){return(U==="source"?w.sourceId:w.targetId)===o?l?.name??"本实体":(U==="source"?w.sourceName:w.targetName)??(U==="source"?w.sourceId:w.targetId)}return g?i.jsx("section",{children:i.jsxs("div",{className:"rounded-lg border border-dashed border-zinc-300 px-6 py-14 text-center",children:[i.jsx("p",{className:"text-sm text-zinc-600",children:"该实体不存在或已被删除"}),i.jsxs("div",{className:"mt-4 flex justify-center gap-2",children:[i.jsx("a",{href:"#/trash",className:"rounded-md border border-zinc-300 px-4 py-1.5 text-sm text-zinc-600 hover:bg-zinc-100",children:"去回收站"}),i.jsx(Se,{variant:"outline",type:"button",onClick:()=>Tn(`/entities/${r}`),children:"返回列表"})]})]})}):i.jsxs("section",{children:[i.jsxs("div",{className:"mb-1 flex items-center gap-3",children:[i.jsx(kp,{items:[{label:"实体",href:"/entities/character"},{label:s3[r],href:`/entities/${r}`},{label:l?.name??"…"}]}),i.jsx("h1",{className:"min-w-0 truncate text-xl font-semibold",children:l?.name??"…"}),i.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[i.jsx(Se,{variant:"outline",type:"button",onClick:()=>{me()},disabled:!l||j,children:j?"保存中…":"保存"}),i.jsx(Se,{variant:"outline",type:"button",disabled:!l,className:"text-red-600 hover:bg-red-50",onClick:()=>A(!0),children:"移入回收站"})]})]}),l&&i.jsxs("p",{className:"mb-4 text-xs text-muted-foreground",children:["创建于 ",ls(l.createdAt)," · 更新于 ",ls(l.updatedAt)," ·"," ",i.jsxs("button",{type:"button",onClick:()=>M(w=>!w),title:"展开状态预览:计算该实体在任意大纲节点处的累积状态",className:"text-muted-foreground underline-offset-2 hover:text-primary hover:underline",children:["变更记录 ",l.deltaCount," 条"]})]}),l&&B&&i.jsx(t3,{type:r,id:o,currentData:l.data,deltaCount:l.deltaCount}),d&&!l&&i.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[i.jsx("div",{className:"space-y-3 rounded-md border border-zinc-200 p-4",children:Array.from({length:5},(w,U)=>i.jsx("div",{className:"h-9 animate-pulse rounded bg-zinc-100"},U))}),i.jsx("div",{className:"space-y-3 rounded-md border border-zinc-200 p-4",children:Array.from({length:3},(w,U)=>i.jsx("div",{className:"h-9 animate-pulse rounded bg-zinc-100"},U))})]}),!d&&!l&&p!==null&&i.jsxs("div",{className:"rounded-md border border-zinc-200 p-4 text-sm text-zinc-600",children:[p===vt?"无法连接服务,请确认 ai-editor 服务已启动。":"详情加载失败,请重试。",i.jsx(Se,{variant:"outline",className:"ml-3",type:"button",onClick:()=>{ne()},children:"重试"})]}),l&&x&&i.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[i.jsxs("div",{className:"rounded-md border border-zinc-200 p-4",children:[i.jsx("h2",{className:"mb-3 text-sm font-semibold text-zinc-700",children:"基础信息"}),i.jsxs("div",{className:"flex flex-col gap-3",children:[Q.map(w=>i.jsxs("div",{children:[i.jsx("p",{className:"mb-1 text-sm font-medium text-zinc-700",children:w.label}),i.jsx(l3,{field:w,value:x[w.key],onChange:U=>se(w.key,U)})]},w.key)),"custom_fields"in l.data&&i.jsxs("div",{children:[i.jsx("p",{className:"mb-1 text-sm font-medium text-zinc-700",children:"自定义字段"}),i.jsx(r3,{value:x.custom_fields,onChange:w=>se("custom_fields",w)})]})]}),k&&i.jsx("p",{className:"mt-3 text-sm text-red-600",children:k})]}),i.jsxs("div",{className:"rounded-md border border-zinc-200 p-4",children:[i.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[i.jsx("h2",{className:"text-sm font-semibold text-zinc-700",children:"关联(1 跳)"}),i.jsx(Se,{variant:"outline",type:"button",className:"h-8 px-2 text-xs",onClick:()=>T(!0),children:"+ 新增关联"})]}),l.relations.length===0?i.jsx("p",{className:"py-6 text-center text-sm text-zinc-400",children:"暂无关联,新增一个"}):i.jsx("ul",{className:"divide-y divide-zinc-100",children:l.relations.map(w=>{const U=w.sourceId===o,Y=$(w,"source"),z=$(w,"target");return i.jsxs("li",{className:"flex items-center gap-2 py-2 text-sm",children:[i.jsx("span",{className:"min-w-0 max-w-28 truncate text-zinc-700",children:Y}),i.jsxs("span",{className:"shrink-0 rounded bg-zinc-100 px-1.5 py-0.5 text-xs text-zinc-500",children:[hr(w.relationType)," ",U?"→":"←"]}),i.jsx("span",{className:"min-w-0 flex-1 truncate text-zinc-700",children:z}),i.jsx(Se,{variant:"outline",type:"button",className:"h-7 shrink-0 px-2 text-xs text-red-600 hover:bg-red-50",onClick:()=>R(w),children:"删除"})]},w.id)})})]})]}),E&&i.jsx(Rp,{source:{type:r,id:o,name:l?.name??""},onCreated:ne,onClose:()=>T(!1)}),_&&i.jsx(ws,{title:"删除关系",description:`删除关系「${$(_,"source")} ${hr(_.relationType)} ${$(_,"target")}」?物理删除不可恢复,可重新建立。`,confirmLabel:"删除",danger:!0,onConfirm:te,onClose:()=>R(null)}),H&&i.jsx(ws,{title:"移入回收站",description:`将《${l?.name??""}》移入回收站。关联关系与变更记录将一并移入,可在回收站还原。`,confirmLabel:"移入回收站",danger:!0,onConfirm:X,onClose:()=>A(!1)})]})}function l3({field:n,value:o,onChange:r}){switch(n.control){case"textarea":return i.jsx("textarea",{value:wl({[n.key]:o},n.key),onChange:l=>r(l.target.value),rows:3,className:"w-full rounded-md border border-zinc-300 px-3 py-1.5 text-sm focus:outline-none focus-visible:ring-2 focus-visible:ring-zinc-400"});case"number":return i.jsx(Ot,{type:"number",value:wl({[n.key]:o},n.key),onChange:l=>r(l.target.value===""?void 0:Number(l.target.value)),className:"h-8 text-sm"});case"tags":return i.jsx(o3,{values:Array.isArray(o)?o:[],onChange:r,placeholder:"输入后回车添加下一项"});case"select":return i.jsx("select",{value:wl({[n.key]:o},n.key),onChange:l=>r(l.target.value),className:"w-full rounded-md border border-zinc-300 bg-white px-3 py-1.5 text-sm focus:outline-none focus-visible:ring-2 focus-visible:ring-zinc-400",children:n.options?.map(l=>i.jsx("option",{value:l,children:n.optionsLabels?.[l]??l},l))});case"toggle":return i.jsx("input",{type:"checkbox",checked:o===!0,onChange:l=>r(l.target.checked),className:"h-4 w-4 accent-zinc-900"});case"outline-node":return i.jsx(i3,{value:wl({[n.key]:o},n.key),onChange:r});default:return i.jsx(Ot,{value:wl({[n.key]:o},n.key),onChange:l=>r(l.target.value),className:"h-8 text-sm"})}}function i3({value:n,onChange:o}){const r=ze(c=>c.outline),l=oo(r?.children??[]);return i.jsxs("select",{value:n,onChange:c=>o(c.target.value===""?null:c.target.value),className:We("w-full rounded-md border border-zinc-300 bg-white px-3 py-1.5 text-sm focus:outline-none focus-visible:ring-2 focus-visible:ring-zinc-400",n===""&&"text-zinc-400"),children:[i.jsx("option",{value:"",children:"未设置"}),l.map(c=>i.jsxs("option",{value:c.id,children:[" ".repeat(c.depth),c.label]},c.id))]})}function c3(n){return n==="resolved"?"resolved":n==="abandoned"?"abandoned":"active"}function u3(n){const o={active:[],resolved:[],abandoned:[]};for(const r of n)o[c3(r.summary.status)].push(r);return o}function Bo(n,o){return n.filter(r=>r.relationType===o)}function Q1(n,o){return Bo(n,"depends_on").filter(r=>r.sourceId===o).map(r=>r.targetName??r.targetId)}function d3(n,o){return Bo(n,"depends_on").filter(r=>r.targetId===o).map(r=>r.sourceName??r.sourceId)}function fv(n,o){return d3(n,o).length}function f3(n,o){return Bo(n,"involves").map(r=>r.sourceId===o?r.targetName??r.targetId:r.sourceName??r.sourceId)}const m3=3;function p3(n){const o=n.maxDepth??m3,r=[],l=new Set([n.startHookId]),c=[{hookId:n.startHookId,depth:0}];for(;c.length>0;){const{hookId:d,depth:m}=c.shift();if(r.push({hookId:d,name:n.names.get(d)??d,depth:m}),!(m>=o))for(const g of n.depsOf.get(d)??[])g.relationType!=="depends_on"||g.sourceId!==d||l.has(g.targetId)||(l.add(g.targetId),c.push({hookId:g.targetId,depth:m+1}))}return r}function Z1(n,o){if(!n)return!1;const r=[...n.children];for(;r.length>0;){const l=r.pop();if(l.id===o)return l.deleted!==!0;l.type!=="scene"&&l.children&&r.push(...l.children)}return!1}function h3(n){if(!n)return null;let o=null;const r=l=>{if(l.deleted!==!0&&(o=l.id,l.type!=="scene"&&l.children))for(const c of l.children)r(c)};for(const l of n.children)r(l);return o}function g3(n,o){const r=n?.currentPosition;return r!=null&&r!==""&&Z1(o,r)?r:h3(o)}const J1={advance:"progressing",resolve:"resolved",abandon:"abandoned"},x3={advance:"advances",resolve:"resolves"};function mv(n){const o=n.status;return typeof o=="string"&&o!==""?o:"planted"}function W1(n,o){return{field:"status",op:"update",from:n,to:o}}function b3(n,o,r){return{source_type:"outline_node",source_id:r,target_type:"hook",target_id:o,relation_type:x3[n]}}function y3(n,o){return{source_type:"outline_node",source_id:o,target_type:"hook",target_id:n,relation_type:"plants"}}function eS(n){return{status:n}}async function v3(n){const o=J1[n.kind];await Rm({node_id:n.nodeId,target_type:"hook",target_id:n.hookId,changes:[W1(n.fromStatus,o)],description:n.description});try{await Oa(b3(n.kind,n.hookId,n.nodeId))}catch(r){if(!(r instanceof Ue&&r.code==="RELATION_EXISTS"))throw r}await Ra("hook",n.hookId,{data:eS(o)})}async function S3(n){await Rm({node_id:n.nodeId,target_type:"hook",target_id:n.hookId,changes:[W1(n.fromStatus,"abandoned")],description:n.description}),await Ra("hook",n.hookId,{data:eS("abandoned")})}const Ff={advance:"推进",resolve:"回收",abandon:"废弃"};function E3(n){return n==="resolved"||n==="abandoned"}function Cl(n,o){const r=n[o];return r==null?"":String(r)}function N3(){const[n,o]=h.useState(null),[r,l]=h.useState(!1),[c,d]=h.useState(null),[m,g]=h.useState(0);Cs(()=>g(Ne=>Ne+1));const[b,p]=h.useState([]),[v,x]=h.useState(!1),[S,j]=h.useState(null),[N,k]=h.useState(!1),[O,E]=h.useState(null),[T,_]=h.useState(null),[R,H]=h.useState("advance"),[A,B]=h.useState(""),[M,Q]=h.useState(""),[ne,me]=h.useState(null),[se,X]=h.useState(!1),[te,$]=h.useState(null),[w,U]=h.useState(null),[Y,z]=h.useState(null),[I,D]=h.useState(!1),[G,L]=h.useState(null),[q,Z]=h.useState(!1),[V,be]=h.useState(""),[ue,he]=h.useState({}),[Le,qe]=h.useState(""),[we,De]=h.useState(null),[Ae,ye]=h.useState(!1),[Ie,oe]=h.useState({}),ce=ze(Ne=>Ne.config),de=ze(Ne=>Ne.outline),Te=oo(de?.children??[]),Me=n===null?null:u3(n);h.useEffect(()=>{let Ne=!1;return l(!0),d(null),x(!1),oe({}),br("hook",{}).then(Oe=>{Ne||o(Oe.items)}).catch(Oe=>{Ne||(o(null),d(Oe instanceof Ue?Oe.code:vt))}),ja({source_type:"hook",relation_type:"depends_on",depth:1}).then(Oe=>{Ne||p(Oe.relations)}).catch(()=>{Ne||x(!0)}).finally(()=>{Ne||l(!1)}),()=>{Ne=!0}},[m]),h.useEffect(()=>{ze.getState().outline===null&&ze.getState().config!==null&&ze.getState().loadOutline()},[]);async function _e(Ne){j(null),k(!0),E(null);try{j(await mr("hook",Ne.id))}catch(Oe){E(Oe instanceof Ue?Oe.message:"详情加载失败,请重试")}finally{k(!1)}}async function it(Ne,Oe){_(null),me(null),Q("");try{const Xe=await mr("hook",Oe.id),st=ze.getState().config?.currentPosition,Et=st!=null&&st!==""&&Z1(de,st)?st:"";B(Et),H(Ne),_(Xe)}catch{ke.getState().showToast("无法读取伏笔状态,请重试","error")}}async function ie(){const Ne=T;if(!Ne||se)return;const Oe=R;X(!0),me(null);try{if(Oe==="abandon"){const Xe=g3(ce,de);if(Xe===null){me("大纲为空,无法记录废弃变更");return}await S3({hookId:Ne.id,fromStatus:mv(Ne.data),nodeId:Xe,description:M.trim()})}else{if(A===""){me("请选择大纲节点");return}await v3({kind:Oe,hookId:Ne.id,fromStatus:mv(Ne.data),nodeId:A,description:M.trim()})}ke.getState().showToast(`已${Ff[Oe]}`),_(null),g(Xe=>Xe+1)}catch(Xe){me(Xe instanceof Ue?Xe.message:"操作失败,请重试")}finally{X(!1)}}async function F(Ne){$(null),z(null);try{const Oe=await mr("hook",Ne.id);$(Oe),U(JSON.parse(JSON.stringify(Oe.data)))}catch{ke.getState().showToast("无法读取伏笔数据,请重试","error")}}async function pe(){if(!te||!w||I)return;const Ne=Cp(te.data,w);if(!Ne){ke.getState().showToast("没有变更"),$(null);return}D(!0),z(null);try{await Ra("hook",te.id,{data:Ne}),ke.getState().showToast("已保存"),$(null),g(Oe=>Oe+1)}catch(Oe){z(Oe instanceof Ue?Oe.message:"保存失败,请重试")}finally{D(!1)}}async function J(Ne){Ne.preventDefault();const Oe=V.trim();if(!Oe){De("请输入名称");return}ye(!0),De(null);try{const Xe=await Cm("hook",{name:Oe,data:ue});if(Le!=="")try{await Oa(y3(Xe.id,Le))}catch(st){ke.getState().showToast(`已创建伏笔《${Oe}》,但埋点关联失败:${st instanceof Ue?st.message:"未知错误"}`,"error"),Z(!1),g(Et=>Et+1);return}ke.getState().showToast(`已创建伏笔《${Oe}》`),Z(!1),be(""),he({}),qe(""),g(st=>st+1)}catch(Xe){De(Xe instanceof Ue?Xe.message:"创建失败,请重试")}finally{ye(!1)}}async function je(){const Ne=G;if(Ne)try{const Oe=await Hc("hook",Ne.id),Xe=[];Oe.cascaded.relations>0&&Xe.push(`${Oe.cascaded.relations} 条关联`),Oe.cascaded.deltas>0&&Xe.push(`${Oe.cascaded.deltas} 条变更记录`),ke.getState().showToast(`已移入回收站,可随时还原${Xe.length>0?`(含 ${Xe.join("、")})`:""}`),L(null),g(st=>st+1)}catch(Oe){throw Oe}}async function Fe(Ne){if(Ie[Ne.id]){oe(Oe=>{const Xe={...Oe};return delete Xe[Ne.id],Xe});return}oe(Oe=>({...Oe,[Ne.id]:{status:"loading",nodes:[]}}));try{const Oe=new Map,Xe=new Map,st=[{id:Ne.id,depth:0}],Et=new Set;for(;st.length>0;){const{id:xt,depth:yn}=st.shift();if(Et.has(xt))continue;Et.add(xt);const an=await mr("hook",xt);Xe.set(xt,an.name);const Ke=Bo(an.relations,"depends_on").filter(Tt=>Tt.sourceId===xt);if(Oe.set(xt,Ke),!(yn>=2))for(const Tt of Ke)Xe.has(Tt.targetId)||Xe.set(Tt.targetId,Tt.targetName??Tt.targetId),st.push({id:Tt.targetId,depth:yn+1})}const kt=p3({startHookId:Ne.id,depsOf:Oe,names:Xe});oe(xt=>({...xt,[Ne.id]:{status:"ready",nodes:kt}}))}catch{oe(Oe=>({...Oe,[Ne.id]:{status:"error",nodes:[]}}))}}return i.jsxs("section",{children:[i.jsxs("div",{className:"mb-4 flex items-center gap-3",children:[i.jsx("h1",{className:"text-xl font-semibold",children:"伏笔池"}),i.jsx(Se,{type:"button",className:"ml-auto",onClick:()=>Z(!0),children:"+ 新建伏笔"})]}),c!==null&&i.jsxs("div",{className:"mb-3 flex items-center gap-2 rounded-md border border-destructive/30 bg-destructive/10 px-3 py-2 text-sm text-destructive",children:[c===vt?"无法连接服务,请确认 ai-editor 服务已启动。":"伏笔池加载失败,请重试。",i.jsx(Se,{variant:"outline",className:"ml-auto h-7 px-2 text-xs",type:"button",onClick:()=>g(Ne=>Ne+1),children:"重试"})]}),r&&Me===null&&c===null&&i.jsx("div",{className:"space-y-4",children:Array.from({length:3},(Ne,Oe)=>i.jsxs("div",{className:"rounded-md border border-border",children:[i.jsx("div",{className:"h-4 w-20 animate-pulse rounded bg-muted px-3 py-1.5"}),Array.from({length:Oe===0?3:1},(Xe,st)=>i.jsxs("div",{className:"flex items-center gap-3 border-t border-border/70 px-3 py-2.5",children:[i.jsx("div",{className:"h-4 w-1/3 animate-pulse rounded bg-muted"}),i.jsx("div",{className:"h-3 w-16 animate-pulse rounded bg-muted"}),i.jsx("div",{className:"ml-auto h-6 w-6 animate-pulse rounded bg-muted"})]},st))]},Oe))}),!r&&Me!==null&&n?.length===0&&i.jsxs("div",{className:"rounded-lg border border-dashed border-border px-6 py-12 text-center",children:[i.jsx("p",{className:"text-sm text-muted-foreground",children:"还没有伏笔。好伏笔要趁早埋下——先新建一个,或在聊天里让 AI 帮你规划。"}),i.jsx(Se,{className:"mt-4",type:"button",onClick:()=>Z(!0),children:"+ 新建伏笔"})]}),Me!==null&&n&&n.length>0&&i.jsxs("div",{className:"space-y-4",children:[i.jsx(Xf,{title:"活跃",icon:i.jsx("span",{className:"size-2 shrink-0 rounded-full bg-primary"}),hooks:Me.active,depEdges:b,depEdgesFailed:v,chains:Ie,onToggleChain:Fe,onDetail:_e,onLifecycle:it,onEdit:F,onDelete:L}),i.jsx(Xf,{title:"已回收",icon:i.jsx(Em,{className:"size-3.5 shrink-0 text-primary"}),hooks:Me.resolved,depEdges:b,depEdgesFailed:v,chains:Ie,onToggleChain:Fe,onDetail:_e,onLifecycle:it,onEdit:F,onDelete:L}),i.jsx(Xf,{title:"已废弃",icon:i.jsx(ZN,{className:"size-3.5 shrink-0 text-muted-foreground"}),hooks:Me.abandoned,depEdges:b,depEdgesFailed:v,chains:Ie,onToggleChain:Fe,onDetail:_e,onLifecycle:it,onEdit:F,onDelete:L})]}),i.jsx($s,{open:q,onOpenChange:Ne=>!Ne&&Z(!1),children:i.jsxs(Qs,{className:"sm:max-w-md",children:[i.jsx(Zs,{children:i.jsx(Ws,{children:"新建伏笔"})}),i.jsxs("form",{id:"create-hook-form",onSubmit:J,className:"flex flex-col gap-3",children:[i.jsxs("div",{children:[i.jsx("p",{className:"mb-1 text-sm font-medium text-foreground",children:"名称(必填)"}),i.jsx(Ot,{value:V,onChange:Ne=>be(Ne.target.value),placeholder:"如:身世之谜",maxLength:100})]}),i.jsx(pv,{fields:T3,data:ue,onChange:he,nodeOptions:Te}),i.jsxs("div",{children:[i.jsx("p",{className:"mb-1 text-sm font-medium text-foreground",children:"埋点节点(选填,可空)"}),i.jsx(ym,{value:Le,onChange:qe,nodeOptions:Te})]}),we&&i.jsx("p",{className:"text-sm text-destructive",children:we})]}),i.jsxs(Js,{children:[i.jsx(Se,{variant:"outline",type:"button",onClick:()=>Z(!1),disabled:Ae,children:"取消"}),i.jsx(Se,{type:"submit",form:"create-hook-form",disabled:Ae,children:"创建"})]})]})}),i.jsx($s,{open:S!==null||N,onOpenChange:Ne=>!Ne&&j(null),children:i.jsxs(Qs,{className:"sm:max-w-lg",children:[i.jsx(Zs,{children:i.jsx(Ws,{children:"伏笔详情"})}),N&&i.jsx("p",{className:"py-4 text-sm text-muted-foreground",children:"加载中…"}),O&&i.jsx("p",{className:"py-4 text-sm text-destructive",children:O}),S&&i.jsx(j3,{detail:S}),i.jsx(Js,{children:i.jsx(Se,{variant:"outline",type:"button",onClick:()=>j(null),children:"关闭"})})]})}),T&&i.jsx($s,{open:!0,onOpenChange:Ne=>!Ne&&!se&&_(null),children:i.jsxs(Qs,{className:"sm:max-w-md",children:[i.jsx(Zs,{children:i.jsxs(Ws,{children:[Ff[R],"伏笔《",T.name,"》"]})}),i.jsxs("div",{className:"flex flex-col gap-3",children:[R!=="abandon"&&i.jsxs("div",{children:[i.jsx("p",{className:"mb-1 text-sm font-medium text-foreground",children:"大纲节点(默认当前位置)"}),i.jsx(ym,{value:A,onChange:B,nodeOptions:Te,placeholder:"请选择节点"})]}),i.jsxs("div",{children:[i.jsx("p",{className:"mb-1 text-sm font-medium text-foreground",children:"描述"}),i.jsx("textarea",{value:M,onChange:Ne=>Q(Ne.target.value),rows:2,placeholder:R==="abandon"?"说明废弃原因":"说明伏笔如何被推进/回收",className:"w-full rounded-md border border-border bg-background px-3 py-1.5 text-sm focus:outline-none focus-visible:ring-2 focus-visible:ring-ring/50"})]}),i.jsxs("div",{className:"rounded-md border border-primary/25 bg-primary/5 px-3 py-2 text-sm",children:[i.jsx("p",{className:"font-medium text-foreground",children:"将写入:"}),i.jsxs("p",{className:"mt-1 text-muted-foreground",children:["status → ",J1[R],R==="advance"&&" + advances 关系",R==="resolve"&&" + resolves 关系"," + 同步 status"]}),R==="resolve"&&v&&i.jsx("p",{className:"mt-2 text-sm text-destructive",children:"依赖关系加载失败,无法确认依赖者"}),R==="resolve"&&!v&&fv(b,T.id)>0&&i.jsxs("p",{className:"mt-2 text-sm text-destructive",children:["有 ",fv(b,T.id)," 个伏笔依赖此伏笔"]})]}),ne&&i.jsx("p",{className:"text-sm text-destructive",children:ne})]}),i.jsxs(Js,{children:[i.jsx(Se,{variant:"outline",type:"button",onClick:()=>_(null),disabled:se,children:"取消"}),i.jsx(Se,{type:"button",onClick:()=>{ie()},disabled:se,children:se?"提交中…":`确认${Ff[R]}`})]})]})}),te&&w&&i.jsx($s,{open:!0,onOpenChange:Ne=>!Ne&&!I&&$(null),children:i.jsxs(Qs,{className:"sm:max-w-md",children:[i.jsx(Zs,{children:i.jsxs(Ws,{children:["编辑伏笔《",te.name,"》"]})}),i.jsxs("div",{className:"flex flex-col gap-3",children:[i.jsx(pv,{fields:wp("hook"),data:w,onChange:Ne=>U(Oe=>Oe&&{...Oe,...Ne}),nodeOptions:Te}),Y&&i.jsx("p",{className:"text-sm text-destructive",children:Y})]}),i.jsxs(Js,{children:[i.jsx(Se,{variant:"outline",type:"button",onClick:()=>$(null),disabled:I,children:"取消"}),i.jsx(Se,{type:"button",onClick:()=>{pe()},disabled:I,children:I?"保存中…":"保存"})]})]})}),G&&i.jsx(ws,{title:"移入回收站",description:`将《${G.name}》移入回收站。关联关系与变更记录将一并移入,可在回收站还原。`,confirmLabel:"移入回收站",danger:!0,onConfirm:je,onClose:()=>L(null)})]})}function Xf({title:n,icon:o,hooks:r,depEdges:l,depEdgesFailed:c,chains:d,onToggleChain:m,onDetail:g,onLifecycle:b,onEdit:p,onDelete:v}){return i.jsxs("div",{className:"overflow-hidden rounded-md border border-border",children:[i.jsxs("div",{className:"flex items-center gap-1.5 border-b border-border bg-muted/30 px-3 py-1.5 text-sm font-medium text-foreground",children:[o,i.jsx("span",{children:n}),i.jsxs("span",{className:"text-muted-foreground",children:["(",r.length,")"]})]}),r.length===0?i.jsx("p",{className:"px-3 py-2 text-xs text-muted-foreground/70",children:"(空)"}):i.jsx("ul",{className:"divide-y divide-border/70",children:r.map(x=>{const S=E3(x.summary.status),j=c?[]:Q1(l,x.id),N=d[x.id],k=typeof x.summary.category=="string"?x.summary.category:"";return i.jsxs("li",{className:"px-3 py-2",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"min-w-0 truncate font-medium text-foreground",title:x.name,children:x.name}),k&&i.jsx("span",{className:"shrink-0 rounded bg-muted px-1.5 py-0.5 text-xs text-muted-foreground",children:k}),i.jsx("span",{className:"ml-auto shrink-0",children:i.jsxs(xp,{children:[i.jsx(bp,{render:i.jsx(Se,{variant:"ghost",size:"icon-sm",className:"text-muted-foreground","aria-label":`${x.name} 操作`,children:i.jsx(jv,{})})}),i.jsxs(yp,{align:"end",children:[i.jsx(Es,{onClick:()=>g(x),children:"详情"}),i.jsx(Es,{disabled:S,onClick:()=>b("advance",x),children:"推进"}),i.jsx(Es,{disabled:S,onClick:()=>b("resolve",x),children:"回收"}),i.jsx(Es,{disabled:S,onClick:()=>b("abandon",x),children:"废弃"}),i.jsx(Es,{onClick:()=>p(x),children:"编辑"}),i.jsx(vp,{}),i.jsx(Es,{variant:"destructive",onClick:()=>v(x),children:"移入回收站"})]})]})})]}),j.length>0&&i.jsxs("button",{type:"button",onClick:()=>m(x),className:"mt-0.5 flex items-center gap-1 text-xs text-muted-foreground underline-offset-2 hover:text-primary hover:underline",children:["依赖: ",j.join("、")]}),N?.status==="loading"&&i.jsx("p",{className:"mt-0.5 text-xs text-muted-foreground",children:"依赖链展开中…"}),N?.status==="error"&&i.jsx("p",{className:"mt-0.5 text-xs text-destructive",children:"依赖链加载失败"}),N?.status==="ready"&&N.nodes.length>1&&i.jsx("ul",{className:"mt-1 space-y-0.5 border-l border-border pl-2",children:N.nodes.slice(1).map(O=>i.jsxs("li",{className:"text-xs text-muted-foreground",children:[" ".repeat(O.depth-1),O.name]},`${O.depth}-${O.hookId}`))})]},x.id)})})]})}function j3({detail:n}){const o=n.id,r=typeof n.data.status=="string"?n.data.status:"",l=typeof n.data.category=="string"?n.data.category:"",c=Bo(n.relations,"plants"),d=Bo(n.relations,"advances"),m=Bo(n.relations,"resolves"),g=Q1(n.relations,o),b=Bo(n.relations,"depends_on").filter(x=>x.targetId===o).map(x=>x.sourceName??x.sourceId),p=f3(n.relations,o),v=typeof n.data.expected_resolve_node_id=="string"?n.data.expected_resolve_node_id:"";return i.jsxs("div",{className:"flex flex-col gap-3 text-sm",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"font-medium text-foreground",children:n.name}),l&&i.jsx("span",{className:"rounded bg-muted px-1.5 py-0.5 text-xs text-muted-foreground",children:l}),r&&i.jsx("span",{className:"rounded bg-muted px-1.5 py-0.5 text-xs text-muted-foreground",children:jp[r]??r})]}),i.jsxs("p",{className:"text-xs text-muted-foreground",children:["创建于 ",ls(n.createdAt)," · 更新于 ",ls(n.updatedAt)]}),i.jsx(fr,{title:"埋点节点(plants)",items:c.map(x=>x.sourceName??x.sourceId)}),i.jsx(fr,{title:"推进节点(advances)",items:d.map(x=>x.sourceName??x.sourceId)}),i.jsx(fr,{title:"回收节点(resolves)",items:m.map(x=>x.sourceName??x.sourceId)}),i.jsx(fr,{title:"预计回收节点",items:v?[v]:[]}),i.jsx(fr,{title:"依赖(depends_on)",items:g}),i.jsx(fr,{title:"被依赖(其他伏笔依赖本伏笔)",items:b}),i.jsx(fr,{title:"涉及(involves)",items:p})]})}function fr({title:n,items:o}){return i.jsxs("div",{children:[i.jsx("p",{className:"mb-0.5 text-xs font-medium text-muted-foreground",children:n}),o.length===0?i.jsx("p",{className:"text-xs text-muted-foreground/70",children:"无"}):i.jsx("ul",{className:"flex flex-wrap gap-1",children:o.map((r,l)=>i.jsx("li",{className:"rounded bg-muted px-1.5 py-0.5 font-mono text-xs text-foreground",children:r},`${r}-${l}`))})]})}const T3=[{key:"category",label:"类别",control:"text"},{key:"expected_payoff",label:"预期回收",control:"textarea"},{key:"payoff_timing",label:"回收时机",control:"select",options:["immediate","near_term","mid_arc","slow_burn","endgame"],optionsLabels:Tp},{key:"half_life",label:"半衰期(章数)",control:"number"},{key:"is_core",label:"主线伏笔",control:"toggle"},{key:"notes",label:"备注",control:"textarea"},{key:"expected_resolve_node_id",label:"预计回收节点",control:"outline-node"}];function pv({fields:n,data:o,onChange:r,nodeOptions:l}){return i.jsx(i.Fragment,{children:n.map(c=>i.jsxs("div",{children:[i.jsx("p",{className:"mb-1 text-sm font-medium text-foreground",children:c.label}),i.jsx(w3,{field:c,value:o[c.key],nodeOptions:l,onValue:d=>r({...o,[c.key]:d})})]},c.key))})}function w3({field:n,value:o,nodeOptions:r,onValue:l}){switch(n.control){case"textarea":return i.jsx("textarea",{value:Cl({[n.key]:o},n.key),onChange:c=>l(c.target.value),rows:2,className:"w-full rounded-md border border-border bg-background px-3 py-1.5 text-sm focus:outline-none focus-visible:ring-2 focus-visible:ring-ring/50"});case"number":return i.jsx(Ot,{type:"number",value:Cl({[n.key]:o},n.key),onChange:c=>l(c.target.value===""?void 0:Number(c.target.value)),className:"h-8 text-sm"});case"select":return i.jsxs("select",{value:Cl({[n.key]:o},n.key),onChange:c=>l(c.target.value),className:"w-full rounded-md border border-border bg-background px-3 py-1.5 text-sm focus:outline-none focus-visible:ring-2 focus-visible:ring-ring/50",children:[i.jsx("option",{value:"",children:"未设置"}),n.options?.map(c=>i.jsx("option",{value:c,children:n.optionsLabels?.[c]??c},c))]});case"toggle":return i.jsx("input",{type:"checkbox",checked:o===!0,onChange:c=>l(c.target.checked),className:"h-4 w-4 accent-primary"});case"outline-node":return i.jsx(ym,{value:Cl({[n.key]:o},n.key),onChange:l,nodeOptions:r});default:return i.jsx(Ot,{value:Cl({[n.key]:o},n.key),onChange:c=>l(c.target.value),placeholder:n.key==="category"?`如:${AN.join(" / ")}`:void 0,className:"h-8 text-sm"})}}function ym({value:n,onChange:o,nodeOptions:r,placeholder:l="未设置"}){return i.jsxs("select",{value:n,onChange:c=>o(c.target.value),className:We("w-full rounded-md border border-border bg-background px-3 py-1.5 text-sm focus:outline-none focus-visible:ring-2 focus-visible:ring-ring/50",n===""&&"text-muted-foreground"),children:[i.jsx("option",{value:"",children:l}),r.map(c=>i.jsxs("option",{value:c.id,children:[" ".repeat(c.depth),c.label]},c.id))]})}function C3(n,o,r){const l=r===void 0?n:n.filter(d=>d!==r);if(o.kind==="end")return l.length;const c=l.indexOf(o.id);return c===-1?l.length:o.kind==="before"?c:c+1}function tS(n){const o=n.summary.tags;return Array.isArray(o)?o.filter(r=>typeof r=="string"):[]}function R3(n){const o=new Set,r=[];for(const l of n)for(const c of tS(l))c!==""&&!o.has(c)&&(o.add(c),r.push(c));return r}function O3(n,o){return o===null||o===""?n:n.filter(r=>tS(r).includes(o))}function nS(n){const o=[],r=new Set;for(const l of n.split(/[,,、\n]/)){const c=l.trim();c!==""&&!r.has(c)&&(r.add(c),o.push(c))}return o}function sS(n){return Array.isArray(n)?n.filter(o=>typeof o=="string").join(","):""}function k3(n){const o=n.data;return{name:n.name,description:typeof o.description=="string"?o.description:"",timeLabel:typeof o.time_label=="string"?o.time_label:"",tagsInput:sS(o.tags)}}function oS(n,o){const r={};o.name.trim()!==n.name&&(r.name=o.name.trim());const l={};o.description.trim()!==""&&(l.description=o.description.trim()),o.timeLabel.trim()!==""&&(l.time_label=o.timeLabel.trim());const c=nS(o.tagsInput);c.length>0&&(l.tags=c);const d={};for(const m of["description","time_label","tags"])JSON.stringify(l[m])!==JSON.stringify(n.data[m])&&(d[m]=l[m]);return Object.keys(d).length>0&&(r.data=d),r.name===void 0&&r.data===void 0?null:r}const hv={name:"",description:"",timeLabel:"",tagsInput:""};function _3(){const[n,o]=h.useState(null),[r,l]=h.useState(!1),[c,d]=h.useState(null),[m,g]=h.useState(0);Cs(()=>g(oe=>oe+1));const[b,p]=h.useState([]),[v,x]=h.useState(!1),[S,j]=h.useState(null),[N,k]=h.useState(null),[O,E]=h.useState(null),[T,_]=h.useState(!1),[R,H]=h.useState(!1),[A,B]=h.useState(hv),[M,Q]=h.useState(""),[ne,me]=h.useState(null),[se,X]=h.useState(!1),[te,$]=h.useState(null),[w,U]=h.useState(null),[Y,z]=h.useState(null),[I,D]=h.useState(!1),[G,L]=h.useState(null),q=ze(oe=>oe.outline),Z=oo(q?.children??[]);h.useEffect(()=>{let oe=!1;return l(!0),d(null),x(!1),Promise.allSettled([br("event",{}).then(ce=>{oe||o(ce.items)}).catch(ce=>{oe||(o(null),d(ce instanceof Ue?ce.code:vt))}),ja({source_type:"event",relation_type:"occurs_in",depth:1}).then(ce=>{oe||p(ce.relations)}).catch(()=>{oe||x(!0)})]).finally(()=>{oe||l(!1)}),()=>{oe=!0}},[m]),h.useEffect(()=>{ze.getState().outline===null&&ze.getState().config!==null&&ze.getState().loadOutline()},[]);async function V(oe){oe.preventDefault();const ce=A.name.trim();if(!ce){me("请输入名称");return}X(!0),me(null);try{const de={};A.description.trim()!==""&&(de.description=A.description.trim()),A.timeLabel.trim()!==""&&(de.time_label=A.timeLabel.trim());const Te=nS(A.tagsInput);Te.length>0&&(de.tags=Te);const Me=await Cm("event",{name:ce,data:de});if(M!=="")try{await Oa({source_type:"event",source_id:Me.id,target_type:"outline_node",target_id:M,relation_type:"occurs_in"})}catch(_e){ke.getState().showToast(`已创建事件《${ce}》,但节点关联失败:${_e instanceof Ue?_e.message:"未知错误"}`,"error"),H(!1),g(it=>it+1);return}ke.getState().showToast(`已创建事件《${ce}》`),H(!1),B(hv),Q(""),g(_e=>_e+1)}catch(de){me(de instanceof Ue?de.message:"创建失败,请重试")}finally{X(!1)}}function be(oe){const ce=oe.summary;$(oe),z(null),U({name:oe.name,description:typeof ce.description=="string"?ce.description:"",timeLabel:typeof ce.time_label=="string"?ce.time_label:"",tagsInput:sS(ce.tags)})}async function ue(){const oe=te,ce=w;if(!(!oe||!ce||I)){D(!0),z(null);try{const de=oS({name:oe.name,data:oe.summary},ce);if(de===null){ke.getState().showToast("没有变更"),$(null);return}await Ra("event",oe.id,de),ke.getState().showToast("已保存"),$(null),g(Te=>Te+1)}catch(de){z(de instanceof Ue?de.message:"保存失败,请重试")}finally{D(!1)}}}async function he(){const oe=G;if(oe)try{const ce=await Hc("event",oe.id),de=[];ce.cascaded.relations>0&&de.push(`${ce.cascaded.relations} 条关联`),ce.cascaded.deltas>0&&de.push(`${ce.cascaded.deltas} 条变更记录`),ke.getState().showToast(`已移入回收站,可随时还原${de.length>0?`(含 ${de.join("、")})`:""}`),L(null),g(Te=>Te+1)}catch(ce){throw ce}}function Le(oe){const ce=oe.currentTarget.getBoundingClientRect();return oe.clientY<ce.top+ce.height/2?"before":"after"}function qe(oe,ce){oe.preventDefault(),oe.dataTransfer.dropEffect="move";const de=Le(oe);E(Te=>Te!==null&&Te.kind!=="end"&&Te.kind===de&&Te.id===ce?Te:{kind:de,id:ce})}async function we(oe,ce){if(oe.preventDefault(),!N||T)return;if(ce===N){k(null),E(null);return}const de=(n??[]).map(Me=>Me.id),Te=C3(de,{kind:Le(oe),id:ce},N);_(!0);try{await aT(N,{order:Te}),ke.getState().showToast("已调整事件顺序"),g(Me=>Me+1)}catch(Me){ke.getState().showToast(Me instanceof Ue?`排序失败:${Me.message}`:"排序失败,请重试","error")}finally{_(!1),k(null),E(null)}}const De=n===null?[]:R3(n),Ae=n===null?null:O3(n,S),ye=oe=>v?0:b.filter(ce=>ce.sourceId===oe).length,Ie=!v;return i.jsxs("section",{children:[i.jsxs("div",{className:"mb-4 flex items-center gap-3",children:[i.jsx("h1",{className:"text-xl font-semibold",children:"时间轴"}),i.jsx(Se,{type:"button",className:"ml-auto",onClick:()=>H(!0),children:"+ 新建事件"})]}),c!==null&&i.jsxs("div",{className:"mb-3 flex items-center gap-2 rounded-md border border-destructive/30 bg-destructive/10 px-3 py-2 text-sm text-destructive",children:[c===vt?"无法连接服务,请确认 ai-editor 服务已启动。":"时间轴加载失败,请重试。",i.jsx(Se,{variant:"outline",className:"ml-auto h-7 px-2 text-xs",type:"button",onClick:()=>g(oe=>oe+1),children:"重试"})]}),r&&n===null&&c===null&&i.jsx("div",{className:"space-y-2",children:Array.from({length:4},(oe,ce)=>i.jsxs("div",{className:"flex items-center gap-3 rounded-md border border-border px-3 py-2.5",children:[i.jsx("div",{className:"h-4 w-4 animate-pulse rounded bg-muted"}),i.jsx("div",{className:"h-4 w-1/3 animate-pulse rounded bg-muted"}),i.jsx("div",{className:"h-3 w-20 animate-pulse rounded bg-muted"}),i.jsx("div",{className:"ml-auto h-6 w-6 animate-pulse rounded bg-muted"})]},ce))}),!r&&n!==null&&n.length===0&&i.jsxs("div",{className:"rounded-lg border border-dashed border-border px-6 py-12 text-center",children:[i.jsx("p",{className:"text-sm text-muted-foreground",children:"还没有事件。先定义一个关键事件,再把它们排成故事的时间骨架。"}),i.jsx(Se,{className:"mt-4",type:"button",onClick:()=>H(!0),children:"+ 新建事件"})]}),n!==null&&n.length>0&&i.jsxs("div",{className:"mb-3 flex flex-wrap items-center gap-1.5",children:[i.jsx("button",{type:"button",onClick:()=>j(null),className:We("rounded-full px-2.5 py-0.5 text-xs transition-colors",S===null?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground hover:text-foreground"),children:"全部"}),De.map(oe=>i.jsx("button",{type:"button",onClick:()=>j(ce=>ce===oe?null:oe),className:We("rounded-full px-2.5 py-0.5 text-xs transition-colors",S===oe?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground hover:text-foreground"),children:oe},oe))]}),!r&&Ae!==null&&Ae.length>0&&i.jsx("ul",{className:"divide-y divide-border/70 overflow-hidden rounded-md border border-border",children:Ae.map(oe=>{const ce=oe.summary,de=typeof ce.time_label=="string"?ce.time_label:"",Te=Array.isArray(ce.tags)?ce.tags.filter(ie=>typeof ie=="string"):[],Me=ye(oe.id),_e=O?.kind==="before"&&O.id===oe.id,it=O?.kind==="after"&&O.id===oe.id;return i.jsxs("li",{draggable:!T,onDragStart:ie=>{ie.dataTransfer.setData("text/plain",oe.id),ie.dataTransfer.effectAllowed="move",k(oe.id),E(null)},onDragEnd:()=>{k(null),E(null)},onDragOver:ie=>qe(ie,oe.id),onDrop:ie=>{we(ie,oe.id)},className:"relative px-3 py-2",children:[_e&&i.jsx("div",{className:"absolute inset-x-0 -top-px h-0.5 bg-primary"}),it&&i.jsx("div",{className:"absolute inset-x-0 -bottom-px h-0.5 bg-primary"}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"cursor-grab text-muted-foreground/60 active:cursor-grabbing",title:"拖拽调整事件先后顺序","aria-hidden":"true",children:i.jsx(oj,{className:"size-4"})}),i.jsx("span",{className:"min-w-0 truncate font-medium text-foreground",title:oe.name,children:oe.name}),i.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:de!==""?de:"未标注时间"}),Te.map(ie=>i.jsx("span",{className:"shrink-0 rounded bg-muted px-1.5 py-0.5 text-xs text-muted-foreground",children:ie},ie)),Ie&&i.jsxs("span",{className:"shrink-0 text-xs text-muted-foreground",children:[Me," 节点"]}),i.jsx("span",{className:"ml-auto shrink-0",children:i.jsxs(xp,{children:[i.jsx(bp,{render:i.jsx(Se,{variant:"ghost",size:"icon-sm",className:"text-muted-foreground","aria-label":`${oe.name} 操作`,children:i.jsx(jv,{})})}),i.jsxs(yp,{align:"end",children:[i.jsx(Es,{onClick:()=>Tn(`/timeline/${oe.id}`),children:"详情"}),i.jsx(Es,{onClick:()=>be(oe),children:"编辑"}),i.jsx(vp,{}),i.jsx(Es,{variant:"destructive",onClick:()=>L(oe),children:"移入回收站"})]})]})})]})]},oe.id)})}),!r&&n!==null&&n.length>0&&Ae!==null&&Ae.length===0&&i.jsxs("div",{className:"rounded-lg border border-dashed border-border px-6 py-8 text-center text-sm text-muted-foreground",children:["没有匹配「",S,"」的事件"]}),i.jsx($s,{open:R,onOpenChange:oe=>!oe&&H(!1),children:i.jsxs(Qs,{className:"sm:max-w-md",children:[i.jsx(Zs,{children:i.jsx(Ws,{children:"新建事件"})}),i.jsxs("form",{id:"create-event-form",onSubmit:V,className:"flex flex-col gap-3",children:[i.jsxs("div",{children:[i.jsx("p",{className:"mb-1 text-sm font-medium text-foreground",children:"名称(必填)"}),i.jsx(Ot,{value:A.name,onChange:oe=>B(ce=>({...ce,name:oe.target.value})),placeholder:"如:主角踏入宗门",maxLength:100})]}),i.jsxs("div",{children:[i.jsx("p",{className:"mb-1 text-sm font-medium text-foreground",children:"描述"}),i.jsx("textarea",{value:A.description,onChange:oe=>B(ce=>({...ce,description:oe.target.value})),rows:2,placeholder:"事件发生了什么",className:"w-full rounded-md border border-border bg-background px-3 py-1.5 text-sm focus:outline-none focus-visible:ring-2 focus-visible:ring-ring/50"})]}),i.jsxs("div",{children:[i.jsx("p",{className:"mb-1 text-sm font-medium text-foreground",children:"时间标签"}),i.jsx(Ot,{value:A.timeLabel,onChange:oe=>B(ce=>({...ce,timeLabel:oe.target.value})),placeholder:"如:第二天黄昏(自由文本,不参与排序)"})]}),i.jsxs("div",{children:[i.jsx("p",{className:"mb-1 text-sm font-medium text-foreground",children:"标签"}),i.jsx(Ot,{value:A.tagsInput,onChange:oe=>B(ce=>({...ce,tagsInput:oe.target.value})),placeholder:"如:主线,战争(逗号/回车分隔)"})]}),i.jsxs("div",{children:[i.jsx("p",{className:"mb-1 text-sm font-medium text-foreground",children:"关联大纲节点(选填,可空)"}),i.jsx(M3,{value:M,onChange:Q,nodeOptions:Z})]}),ne&&i.jsx("p",{className:"text-sm text-destructive",children:ne})]}),i.jsxs(Js,{children:[i.jsx(Se,{variant:"outline",type:"button",onClick:()=>H(!1),disabled:se,children:"取消"}),i.jsx(Se,{type:"submit",form:"create-event-form",disabled:se,children:"创建"})]})]})}),te&&w&&i.jsx($s,{open:!0,onOpenChange:oe=>!oe&&!I&&$(null),children:i.jsxs(Qs,{className:"sm:max-w-md",children:[i.jsx(Zs,{children:i.jsxs(Ws,{children:["编辑事件《",te.name,"》"]})}),i.jsxs("div",{className:"flex flex-col gap-3",children:[i.jsxs("div",{children:[i.jsx("p",{className:"mb-1 text-sm font-medium text-foreground",children:"名称(必填)"}),i.jsx(Ot,{value:w.name,onChange:oe=>U(ce=>ce&&{...ce,name:oe.target.value}),maxLength:100})]}),i.jsxs("div",{children:[i.jsx("p",{className:"mb-1 text-sm font-medium text-foreground",children:"描述"}),i.jsx("textarea",{value:w.description,onChange:oe=>U(ce=>ce&&{...ce,description:oe.target.value}),rows:2,className:"w-full rounded-md border border-border bg-background px-3 py-1.5 text-sm focus:outline-none focus-visible:ring-2 focus-visible:ring-ring/50"})]}),i.jsxs("div",{children:[i.jsx("p",{className:"mb-1 text-sm font-medium text-foreground",children:"时间标签"}),i.jsx(Ot,{value:w.timeLabel,onChange:oe=>U(ce=>ce&&{...ce,timeLabel:oe.target.value}),placeholder:"如:第二天黄昏(自由文本,不参与排序)"})]}),i.jsxs("div",{children:[i.jsx("p",{className:"mb-1 text-sm font-medium text-foreground",children:"标签"}),i.jsx(Ot,{value:w.tagsInput,onChange:oe=>U(ce=>ce&&{...ce,tagsInput:oe.target.value}),placeholder:"如:主线,战争(逗号/回车分隔)"})]}),Y&&i.jsx("p",{className:"text-sm text-destructive",children:Y})]}),i.jsxs(Js,{children:[i.jsx(Se,{variant:"outline",type:"button",onClick:()=>$(null),disabled:I,children:"取消"}),i.jsx(Se,{type:"button",onClick:()=>{ue()},disabled:I,children:I?"保存中…":"保存"})]})]})}),G&&i.jsx(ws,{title:"移入回收站",description:`将《${G.name}》移入回收站。关联关系与变更记录将一并移入,可在回收站还原。`,confirmLabel:"移入回收站",danger:!0,onConfirm:he,onClose:()=>L(null)})]})}function M3({value:n,onChange:o,nodeOptions:r,placeholder:l="未设置"}){return i.jsxs("select",{value:n,onChange:c=>o(c.target.value),className:We("w-full rounded-md border border-border bg-background px-3 py-1.5 text-sm focus:outline-none focus-visible:ring-2 focus-visible:ring-ring/50",n===""&&"text-muted-foreground"),children:[i.jsx("option",{value:"",children:l}),r.map(c=>i.jsxs("option",{value:c.id,children:[" ".repeat(c.depth),c.label]},c.id))]})}const rS=h.createContext(void 0);function Xl(n){const o=h.useContext(rS);if(o===void 0&&!n)throw new Error(En(47));return o}function A3(){return{...ip(),disabled:!1,modal:!1,focusManagerModal:!1,instantType:void 0,openMethod:null,openChangeReason:null,titleElementId:void 0,descriptionElementId:void 0,stickIfOpen:!0,nested:!1,openOnHover:!1,closeDelay:0,hasViewport:!1}}const D3={...up,disabled:Ye(n=>n.disabled),instantType:Ye(n=>n.instantType),openMethod:Ye(n=>n.openMethod),openChangeReason:Ye(n=>n.openChangeReason),modal:Ye(n=>n.modal),focusManagerModal:Ye(n=>n.focusManagerModal),stickIfOpen:Ye(n=>n.stickIfOpen),titleElementId:Ye(n=>n.titleElementId),descriptionElementId:Ye(n=>n.descriptionElementId),openOnHover:Ye(n=>n.openOnHover),closeDelay:Ye(n=>n.closeDelay),hasViewport:Ye(n=>n.hasViewport)};class _p extends tu{constructor(o,r,l=!1){const c={...A3(),...o},d=new Fl;c.open&&o?.mounted===void 0&&(c.mounted=!0),c.floatingRootContext=c1(d,r,l),super(c,{popupRef:h.createRef(),backdropRef:h.createRef(),internalBackdropRef:h.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerFocusTargetRef:h.createRef(),beforeContentFocusGuardRef:h.createRef(),stickIfOpenTimeout:new ds,triggerElements:d},D3)}setOpen=(o,r)=>{const l=r.reason===dn,c=r.reason===yr&&r.event.detail===0,d=!o&&(r.reason===Fc||r.reason==null),m=r1(r),g=this.select("activeTriggerId");if(!o&&r.reason===u0&&r.trigger==null&&g!=null&&(r.trigger=this.context.triggerElements.getById(g)??this.select("activeTriggerElement")??void 0),this.context.onOpenChange?.(o,r),r.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(o,r);const b=()=>{const p={open:o,openChangeReason:r.reason};op(p,o,r.trigger,m()),this.update(p)};l?(this.set("stickIfOpen",!0),this.context.stickIfOpenTimeout.start(A0,()=>{this.set("stickIfOpen",!1)}),lo.flushSync(b)):b(),c||d?this.set("instantType",c?"click":"dismiss"):r.reason===vr?this.set("instantType","focus"):this.set("instantType",void 0)};static useStore(o,r){const{store:l,internalStore:c}=o1(o,(d,m)=>new _p(r,d,m));return h.useEffect(()=>c?.disposeEffect(),[c]),l}disposeEffect=()=>this.context.stickIfOpenTimeout.disposeEffect()}function gv({props:n}){const{children:o,open:r,defaultOpen:l=!1,onOpenChange:c,onOpenChangeComplete:d,modal:m=!1,handle:g,triggerId:b,defaultTriggerId:p=null}=n,v=_p.useStore(g?.store,{modal:m,open:l,openProp:r,activeTriggerId:p,triggerIdProp:b});a1(v,r,l,p),v.useControlledProp("openProp",r),v.useControlledProp("triggerIdProp",b);const x=v.useState("open"),S=v.useState("mounted"),j=v.useState("payload"),N=uo()!=null;v.useContextCallback("onOpenChange",c),v.useContextCallback("onOpenChangeComplete",d),i1(v,x),rp(v);const{forceUnmount:k}=ap(x,v,()=>{v.update({stickIfOpen:!0,openChangeReason:null})});v.useSyncedValues({modal:m,nested:N}),h.useEffect(()=>{x||v.context.stickIfOpenTimeout.clear()},[v,x]);const O=h.useCallback(()=>{v.setOpen(!1,jt(Bm))},[v]);h.useImperativeHandle(n.actionsRef,()=>({unmount:k,close:O}),[k,O]);const E=x||S,T=h.useMemo(()=>({store:v}),[v]);return i.jsxs(rS.Provider,{value:T,children:[E&&i.jsx(L3,{store:v,modal:m}),typeof o=="function"?o({payload:j}):o]})}function z3(n){return Xl(!0)?i.jsx(gv,{props:n}):i.jsx(V0,{children:i.jsx(gv,{props:n})})}function L3({store:n,modal:o}){const r=n.useState("floatingRootContext"),l=np(r,{outsidePressEvent:{mouse:o==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}}),c=l.reference??Ht,d=l.trigger??Ht,m=h.useMemo(()=>to(su,l.floating),[l.floating]);return lp(n,{activeTriggerProps:c,inactiveTriggerProps:d,popupProps:m}),null}const I3=300,U3=h.forwardRef(function(o,r){const{render:l,className:c,style:d,disabled:m=!1,nativeButton:g=!0,handle:b,payload:p,openOnHover:v=!1,delay:x=I3,closeDelay:S=0,id:j,...N}=o,k=Xl(!0),O=b?.store??k?.store;if(!O)throw new Error(En(74));const E=Cr(j),T=O.useState("isTriggerActive",E),_=O.useState("floatingRootContext"),R=O.useState("isOpenedByTrigger",E),H=O.useState("triggerPopupId",E),A=h.useRef(null),{registerTrigger:B,isMountedByThisTrigger:M}=l1(E,A,O,{payload:p,disabled:m,openOnHover:v,closeDelay:S}),Q=O.useState("openChangeReason"),ne=O.useState("stickIfOpen"),me=O.useState("openMethod"),se=O.useState("focusManagerModal"),X=p1(_,{enabled:!m&&_!=null&&v&&(me!=="touch"||Q!==yr),mouseOnly:!0,move:!1,handleClose:h1(),restMs:x,delay:{close:S},triggerElementRef:A,isActiveTrigger:T,isClosing:()=>O.select("transitionStatus")==="ending"}),te=P0(_,{enabled:_!=null,stickIfOpen:ne}),$=w1(()=>O.select("open"),Z=>{O.set("openMethod",Z)}),w=O.useState("triggerProps",M),{getButtonProps:U,buttonRef:Y}=Pl({disabled:m,native:g}),z={open(Z){return Z&&Q===yr?tm.open(Z):sw.open(Z)}},{preFocusGuardRef:I,handlePreFocusGuardFocus:D,handleFocusTargetFocus:G}=R1(O,A),q=fn("button",o,{state:{disabled:m,open:R},ref:[Y,r,B,A],props:[te.reference,X,w,$,{[D0]:"",id:E,"aria-haspopup":"dialog","aria-expanded":R,"aria-controls":H},N,U],stateAttributesMapping:z});return M&&!se?i.jsxs(h.Fragment,{children:[i.jsx(Yo,{ref:I,onFocus:D}),i.jsx(h.Fragment,{children:q},E),i.jsx(Yo,{ref:O.context.triggerFocusTargetRef,onFocus:G})]}):i.jsx(h.Fragment,{children:q},E)}),aS=h.createContext(void 0);function H3(){const n=h.useContext(aS);if(n===void 0)throw new Error(En(45));return n}const B3=h.forwardRef(function(o,r){const{keepMounted:l=!1,...c}=o,{store:d}=Xl();return d.useState("mounted")||l?i.jsx(aS.Provider,{value:l,children:i.jsx(Zm,{ref:r,...c})}):null}),lS=h.createContext(void 0);function Y3(){const n=h.useContext(lS);if(!n)throw new Error(En(46));return n}const V3=h.forwardRef(function(o,r){const{render:l,className:c,style:d,anchor:m,positionMethod:g="absolute",side:b="bottom",align:p="center",sideOffset:v=0,alignOffset:x=0,collisionBoundary:S="clipping-ancestors",collisionPadding:j=5,arrowPadding:N=5,sticky:k=!1,disableAnchorTracking:O=!1,collisionAvoidance:E=z0,...T}=o,{store:_}=Xl(),R=H3(),H=Wm(),A=_.useState("floatingRootContext"),B=_.useState("mounted"),M=_.useState("open"),Q=_.useState("openChangeReason"),ne=_.useState("activeTriggerElement"),me=_.useState("modal"),se=_.useState("openMethod"),X=_.useState("positionerElement"),te=_.useState("instantType"),$=_.useState("transitionStatus"),w=_.useState("hasViewport"),U=h.useRef(null),Y=Gm(X,!1,!1),z=S1({anchor:m,floatingRootContext:A,positionMethod:g,mounted:B,side:b,sideOffset:v,align:p,alignOffset:x,arrowPadding:N,collisionBoundary:S,collisionPadding:j,sticky:k,disableAnchorTracking:O,keepMounted:R,nodeId:H,collisionAvoidance:E,adaptiveOrigin:w?y1:void 0}),I=A.useState("domReferenceElement");Ge(()=>{const q=I,Z=U.current;if(q&&(U.current=q),Z&&q&&q!==Z){_.set("instantType",void 0);const V=new AbortController;return Y(()=>{_.set("instantType","trigger-change")},V.signal),()=>{V.abort()}}},[I,Y,_]),j1(M&&me===!0&&Q!==dn,se==="touch",X,ne);const D=h.useCallback(q=>{_.set("positionerElement",q)},[_]),G={open:M,side:z.side,align:z.align,anchorHidden:z.anchorHidden,instant:te},L=E1(o,G,{styles:z.positionerStyles,transitionStatus:$,props:T,refs:[r,D],hidden:!B,inert:!M});return i.jsxs(lS.Provider,{value:z,children:[B&&me===!0&&Q!==dn&&i.jsx(hp,{ref:_.context.internalBackdropRef,inert:pp(!M),cutout:ne}),i.jsx(Y0,{id:H,children:L})]})}),P3=h.createContext(void 0);function G3(){const[n,o]=h.useState(0),r=tt(()=>(o(c=>c+1),()=>{o(c=>Math.max(0,c-1))}));return{context:h.useMemo(()=>({register:r}),[r]),hasClosePart:n>0}}function q3(n){const{value:o,children:r}=n;return i.jsx(P3.Provider,{value:o,children:r})}const F3={...Gl,...Gc},X3=h.forwardRef(function(o,r){const{render:l,className:c,style:d,initialFocus:m,finalFocus:g,...b}=o,{store:p}=Xl(),v=Y3(),x=g1()!=null,{context:S,hasClosePart:j}=G3(),N=p.useState("open"),k=p.useState("openMethod"),O=p.useState("instantType"),E=p.useState("transitionStatus"),T=p.useState("popupProps"),_=p.useState("titleElementId"),R=p.useState("descriptionElementId"),H=p.useState("modal"),A=p.useState("mounted"),B=p.useState("openChangeReason"),M=p.useState("activeTriggerElement"),Q=p.useState("floatingRootContext"),ne=Q.useState("floatingId"),me=p.useState("disabled"),se=p.useState("openOnHover"),X=p.useState("closeDelay"),te=b.id??ne;$c({open:N,ref:p.context.popupRef,onComplete(){N&&p.context.onOpenChangeComplete?.(!0)}}),m1(Q,{enabled:se&&!me,closeDelay:X});const $=m===void 0?s1(p.context.popupRef):m,w=H!==!1&&j;p.useSyncedValue("focusManagerModal",w);const U=h.useCallback(I=>{p.set("popupElement",I)},[p]),Y={open:N,side:v.side,align:v.align,instant:O,transitionStatus:E},z=fn("div",o,{state:Y,ref:[r,p.context.popupRef,U],props:[T,{id:te,role:"dialog",...su,"aria-labelledby":_,"aria-describedby":R,onKeyDown(I){x&&fp.has(I.key)&&I.stopPropagation()}},mp(E),b],stateAttributesMapping:F3});return i.jsx(tp,{context:Q,openInteractionType:k,modal:w,disabled:!A||B===dn,initialFocus:$,returnFocus:g,restoreFocus:"popup",previousFocusableElement:Ut(M)?M:void 0,nextFocusableElement:p.context.triggerFocusTargetRef,beforeContentFocusGuardRef:p.context.beforeContentFocusGuardRef,children:i.jsx(q3,{value:S,children:z})})});function K3({...n}){return i.jsx(z3,{"data-slot":"popover",...n})}function $3({...n}){return i.jsx(U3,{"data-slot":"popover-trigger",...n})}function Q3({align:n="start",alignOffset:o=0,side:r="bottom",sideOffset:l=8,className:c,...d}){return i.jsx(B3,{children:i.jsx(V3,{className:"isolate z-50 outline-none",align:n,alignOffset:o,side:r,sideOffset:l,children:i.jsx(X3,{"data-slot":"popover-content",className:We("z-50 min-w-64 origin-(--transform-origin) rounded-lg bg-popover p-3 text-sm 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:fade-out-0 data-closed:zoom-out-95",c),...d})})})}const iS="occurs_in";function Z3(n,o){return n.filter(r=>r.relationType===iS&&r.sourceId===o)}function J3(n,o){return{source_type:"event",source_id:n,target_type:"outline_node",target_id:o,relation_type:iS}}function W3({id:n}){const[o,r]=h.useState(null),[l,c]=h.useState(!1),[d,m]=h.useState(!1),[g,b]=h.useState(null),[p,v]=h.useState(null),[x,S]=h.useState(!1),[j,N]=h.useState(null),[k,O]=h.useState(!1),[E,T]=h.useState(""),[_,R]=h.useState(null),[H,A]=h.useState(!1),[B,M]=h.useState(null),[Q,ne]=h.useState(!1),me=ze(z=>z.outline),se=oo(me?.children??[]);async function X(){c(!0),b(null),m(!1);try{const z=await mr("event",n);r(z),v(k3(z))}catch(z){r(null),v(null),z instanceof Ue&&z.code==="ENTITY_NOT_FOUND"?m(!0):b(z instanceof Ue?z.code:vt)}finally{c(!1)}}h.useEffect(()=>{X()},[n]),Cs(()=>{X()}),h.useEffect(()=>{ze.getState().outline===null&&ze.getState().config!==null&&ze.getState().loadOutline()},[]);async function te(){if(!o||!p||x)return;const z=oS({name:o.name,data:o.data},p);if(z===null){ke.getState().showToast("没有变更");return}S(!0),N(null);try{await Ra("event",n,z),ke.getState().showToast("已保存"),await X()}catch(I){if(I instanceof Ue&&I.code==="ENTITY_NOT_FOUND"){m(!0);return}N(I instanceof Ue?I.message:"保存失败,请重试")}finally{S(!1)}}async function $(){if(!(E===""||H)){A(!0),R(null);try{await Oa(J3(n,E)),ke.getState().showToast("已关联大纲节点"),O(!1),await X()}catch(z){if(z instanceof Ue&&z.code==="RELATION_EXISTS"){R("这条关系已经存在");return}R(z instanceof Ue?z.message:"关联失败,请重试")}finally{A(!1)}}}async function w(){if(B)try{await Bc(B.id),ke.getState().showToast("已取消关联"),M(null),await X()}catch(z){throw z}}async function U(){if(o)try{const z=await Hc("event",n),I=[];z.cascaded.relations>0&&I.push(`${z.cascaded.relations} 条关联`),z.cascaded.deltas>0&&I.push(`${z.cascaded.deltas} 条变更记录`),ke.getState().showToast(`已移入回收站,可随时还原${I.length>0?`(含 ${I.join("、")})`:""}`),ne(!1),Tn("/timeline")}catch(z){throw z}}if(d)return i.jsx("section",{children:i.jsxs("div",{className:"rounded-lg border border-dashed border-border px-6 py-14 text-center",children:[i.jsx("p",{className:"text-sm text-muted-foreground",children:"该事件不存在或已被删除"}),i.jsxs("div",{className:"mt-4 flex justify-center gap-2",children:[i.jsx("a",{href:"#/trash",className:"rounded-md border border-border px-4 py-1.5 text-sm text-muted-foreground hover:bg-muted",children:"去回收站"}),i.jsx(Se,{variant:"outline",type:"button",onClick:()=>Tn("/timeline"),children:"返回列表"})]})]})});const Y=o===null?[]:Z3(o.relations,n);return i.jsxs("section",{children:[i.jsxs("div",{className:"mb-1 flex items-center gap-3",children:[i.jsx(kp,{items:[{label:"时间轴",href:"/timeline"},{label:o?.name??"…"}]}),i.jsx("h1",{className:"min-w-0 truncate text-xl font-semibold",children:o?.name??"…"}),i.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[i.jsx(Se,{variant:"outline",type:"button",onClick:()=>{te()},disabled:!o||x,children:x?"保存中…":"保存"}),i.jsx(Se,{variant:"outline",type:"button",disabled:!o,className:"text-destructive hover:bg-destructive/10",onClick:()=>ne(!0),children:"移入回收站"})]})]}),o&&i.jsxs("p",{className:"mb-4 text-xs text-muted-foreground",children:["创建于 ",ls(o.createdAt)," · 更新于 ",ls(o.updatedAt)]}),l&&!o&&i.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[i.jsx("div",{className:"space-y-3 rounded-md border border-border p-4",children:Array.from({length:5},(z,I)=>i.jsx("div",{className:"h-9 animate-pulse rounded bg-muted"},I))}),i.jsx("div",{className:"space-y-3 rounded-md border border-border p-4",children:Array.from({length:3},(z,I)=>i.jsx("div",{className:"h-9 animate-pulse rounded bg-muted"},I))})]}),!l&&!o&&g!==null&&i.jsxs("div",{className:"rounded-md border border-border p-4 text-sm text-muted-foreground",children:[g===vt?"无法连接服务,请确认 ai-editor 服务已启动。":"详情加载失败,请重试。",i.jsx(Se,{variant:"outline",className:"ml-3",type:"button",onClick:()=>{X()},children:"重试"})]}),o&&p&&i.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[i.jsxs("div",{className:"rounded-md border border-border p-4",children:[i.jsx("h2",{className:"mb-3 text-sm font-semibold text-foreground",children:"基础信息"}),i.jsxs("div",{className:"flex flex-col gap-3",children:[i.jsxs("div",{children:[i.jsx("p",{className:"mb-1 text-sm font-medium text-foreground",children:"名称(必填)"}),i.jsx(Ot,{value:p.name,onChange:z=>v(I=>I&&{...I,name:z.target.value}),maxLength:100})]}),i.jsxs("div",{children:[i.jsx("p",{className:"mb-1 text-sm font-medium text-foreground",children:"描述"}),i.jsx("textarea",{value:p.description,onChange:z=>v(I=>I&&{...I,description:z.target.value}),rows:3,placeholder:"事件发生了什么",className:"w-full rounded-md border border-border bg-background px-3 py-1.5 text-sm focus:outline-none focus-visible:ring-2 focus-visible:ring-ring/50"})]}),i.jsxs("div",{children:[i.jsx("p",{className:"mb-1 text-sm font-medium text-foreground",children:"时间标签"}),i.jsx(Ot,{value:p.timeLabel,onChange:z=>v(I=>I&&{...I,timeLabel:z.target.value}),placeholder:"如:第二天黄昏(自由文本,不参与排序)"})]}),i.jsxs("div",{children:[i.jsx("p",{className:"mb-1 text-sm font-medium text-foreground",children:"标签"}),i.jsx(Ot,{value:p.tagsInput,onChange:z=>v(I=>I&&{...I,tagsInput:z.target.value}),placeholder:"如:主线,战争(逗号/回车分隔)"})]}),j&&i.jsx("p",{className:"text-sm text-destructive",children:j})]})]}),i.jsxs("div",{className:"rounded-md border border-border p-4",children:[i.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[i.jsx("h2",{className:"text-sm font-semibold text-foreground",children:"关联节点(occurs_in)"}),i.jsxs(K3,{open:k,onOpenChange:z=>{z?(T(""),R(null),O(!0)):H||O(!1)},children:[i.jsx($3,{render:i.jsx(Se,{variant:"outline",type:"button",className:"h-8 px-2 text-xs",children:"+ 关联场景/章节"})}),i.jsxs(Q3,{className:"flex flex-col gap-3",children:[i.jsxs("div",{children:[i.jsx("p",{className:"mb-1 text-sm font-medium text-foreground",children:"大纲节点"}),i.jsx(eM,{value:E,onChange:T,nodeOptions:se,placeholder:"请选择节点"})]}),_&&i.jsx("p",{className:"text-sm text-destructive",children:_}),i.jsxs("div",{className:"flex justify-end gap-2",children:[i.jsx(Se,{variant:"outline",type:"button",size:"sm",onClick:()=>O(!1),disabled:H,children:"取消"}),i.jsx(Se,{type:"button",size:"sm",onClick:()=>{$()},disabled:H||E==="",children:H?"关联中…":"关联"})]})]})]})]}),Y.length===0?i.jsx("p",{className:"py-6 text-center text-sm text-muted-foreground",children:"暂无关联节点,新增一个"}):i.jsx("ul",{className:"divide-y divide-border/70",children:Y.map(z=>i.jsxs("li",{className:"flex items-center gap-2 py-2 text-sm",children:[i.jsx("button",{type:"button",onClick:()=>Tn(`/outline/${z.targetId}`),title:"跳转大纲定位",className:"min-w-0 flex-1 truncate text-left text-foreground underline-offset-2 hover:text-primary hover:underline",children:z.targetName??z.targetId}),i.jsx(Se,{variant:"outline",type:"button",className:"h-7 shrink-0 px-2 text-xs text-destructive hover:bg-destructive/10",onClick:()=>M(z),children:"取消关联"})]},z.id))})]})]}),B&&i.jsx(ws,{title:"取消关联",description:`取消《${B.targetName??B.targetId}》与事件的关联?物理删除不可恢复,可重新建立。`,confirmLabel:"取消关联",danger:!0,onConfirm:w,onClose:()=>M(null)}),Q&&i.jsx(ws,{title:"移入回收站",description:`将《${o?.name??""}》移入回收站。关联关系与变更记录将一并移入,可在回收站还原。`,confirmLabel:"移入回收站",danger:!0,onConfirm:U,onClose:()=>ne(!1)})]})}function eM({value:n,onChange:o,nodeOptions:r,placeholder:l="未设置"}){return i.jsxs("select",{value:n,onChange:c=>o(c.target.value),className:We("w-full rounded-md border border-border bg-background px-3 py-1.5 text-sm focus:outline-none focus-visible:ring-2 focus-visible:ring-ring/50",n===""&&"text-muted-foreground"),children:[i.jsx("option",{value:"",children:l}),r.map(c=>i.jsxs("option",{value:c.id,children:[" ".repeat(c.depth),c.label]},c.id))]})}function tM(n,o){const r=[];return n>0&&r.push(`${n} 条关系`),o>0&&r.push(`${o} 条变更记录`),r.length>0?`已还原,连带恢复 ${r.join("、")}`:"已还原"}function nM(n){return n>0?`已还原(含 ${n} 个子节点)`:"已还原"}function sM(n){return/软删祖先\s+([^\s,,]+)/.exec(n)?.[1]??null}const xv={character:"人物",setting:"设定",location:"地点",hook:"伏笔",event:"事件"},oM={volume:"卷",chapter:"章",scene:"场"};function bv({label:n}){return i.jsx("span",{className:"shrink-0 rounded bg-muted px-1.5 py-0.5 text-xs text-muted-foreground",children:n})}function rM(){const[n,o]=h.useState(null),[r,l]=h.useState(!1),[c,d]=h.useState(null),[m,g]=h.useState(0);Cs(()=>g(R=>R+1));const[b,p]=h.useState(null),[v,x]=h.useState(null);h.useEffect(()=>{let R=!1;return l(!0),d(null),nT().then(H=>{R||o(H)}).catch(H=>{R||d(H instanceof Ue?H.code:vt)}).finally(()=>{R||l(!1)}),()=>{R=!0}},[m]);async function S(){g(R=>R+1)}function j(R){return R instanceof Ue&&(R.code==="ENTITY_NOT_FOUND"||R.code==="OUTLINE_NODE_NOT_FOUND")}function N(R){ke.getState().showError(R instanceof Ue?R.code:vt,R instanceof Ue?R.message:"操作失败,请重试")}async function k(R){try{const H=await sT(R.type,R.id);ke.getState().showToast(tM(H.restoredRelations,H.restoredDeltas)),await S()}catch(H){if(j(H)){ke.getState().showToast("该对象已不存在","error"),await S();return}N(H)}}async function O(R){x(null);try{const H=await Ib(R.id);ke.getState().showToast(nM(H.restoredChildren)),await S(),ze.getState().loadOutline()}catch(H){if(H instanceof Ue&&H.code==="OUTLINE_ANCESTOR_DELETED"){const A=sM(H.message);if(A===null){ke.getState().showError("OUTLINE_ANCESTOR_DELETED","上级节点也在回收站,请先还原上级");return}x({node:R,ancestorId:A,ancestorName:n?.nodes.find(B=>B.id===A)?.title??A});return}if(j(H)){ke.getState().showToast("该对象已不存在","error"),await S();return}N(H)}}async function E(){const R=v;if(R)try{await Ib(R.ancestorId),ze.getState().loadOutline(),await O(R.node)}catch(H){if(j(H)){ke.getState().showToast("该对象已不存在","error"),x(null),await S();return}N(H)}}async function T(){if(b)try{b.kind==="entity"?await oT(b.item.type,b.item.id):(await rT(b.item.id),ze.getState().loadOutline()),ke.getState().showToast("已彻底删除"),await S()}catch(R){if(j(R)){ke.getState().showToast("该对象已不存在","error"),await S();return}throw R}}const _=n!==null&&n.entities.length===0&&n.nodes.length===0;return i.jsxs("section",{children:[i.jsxs("div",{className:"mb-1 flex items-center gap-3",children:[i.jsx("h1",{className:"text-xl font-semibold",children:"回收站"}),i.jsx(Se,{variant:"outline",type:"button",className:"ml-auto",onClick:()=>{S()},disabled:r,children:"刷新"})]}),i.jsx("p",{className:"mb-4 text-xs text-muted-foreground",children:"软删对象会保留一段时间,可在此还原,或彻底删除(不可恢复)。"}),c!==null&&i.jsxs("div",{className:"mb-3 rounded-md border border-destructive/30 bg-destructive/10 px-3 py-2 text-sm text-destructive",children:[c===vt?"无法连接服务,请确认 ai-editor 服务已启动。":"回收站加载失败,请重试。",i.jsx(Se,{variant:"outline",className:"ml-3",type:"button",onClick:()=>{S()},children:"重试"})]}),r&&n===null&&c===null&&i.jsx("div",{className:"grid gap-4 md:grid-cols-2",children:[0,1].map(R=>i.jsxs("div",{className:"overflow-hidden rounded-md border border-border",children:[i.jsx("div",{className:"h-9 animate-pulse bg-muted/60"}),Array.from({length:3},(H,A)=>i.jsxs("div",{className:"flex items-center gap-2 border-b border-border/70 px-3 py-2.5 last:border-0",children:[i.jsx("div",{className:"h-4 w-10 animate-pulse rounded bg-muted"}),i.jsx("div",{className:"h-4 flex-1 animate-pulse rounded bg-muted"}),i.jsx("div",{className:"h-4 w-16 animate-pulse rounded bg-muted"})]},A))]},R))}),!r&&_&&i.jsx("div",{className:"rounded-lg border border-dashed border-border px-6 py-12 text-center text-sm text-muted-foreground",children:"回收站是空的"}),n!==null&&!_&&i.jsxs("div",{className:"grid items-start gap-4 md:grid-cols-2",children:[i.jsxs("div",{className:"overflow-hidden rounded-md border border-border",children:[i.jsxs("div",{className:"border-b border-border bg-muted/40 px-3 py-2 text-sm font-medium text-foreground",children:["实体 (",n.entities.length,")"]}),n.entities.length===0?i.jsx("p",{className:"px-3 py-6 text-center text-sm text-muted-foreground",children:"暂无实体"}):i.jsx("ul",{className:"divide-y divide-border/70",children:n.entities.map(R=>i.jsxs("li",{className:"flex items-center gap-2 px-3 py-2",children:[i.jsx(bv,{label:xv[R.type]}),i.jsx("span",{className:"min-w-0 flex-1 truncate text-sm text-foreground",title:R.name,children:R.name}),i.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:xr(R.deletedAt)}),i.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[i.jsx(Se,{variant:"outline",size:"xs",type:"button",onClick:()=>{k(R)},children:"还原"}),i.jsx(Se,{variant:"outline",size:"xs",type:"button",className:"text-destructive hover:bg-destructive/10",onClick:()=>p({kind:"entity",item:R}),children:"彻底删除"})]})]},R.id))})]}),i.jsxs("div",{className:"overflow-hidden rounded-md border border-border",children:[i.jsxs("div",{className:"border-b border-border bg-muted/40 px-3 py-2 text-sm font-medium text-foreground",children:["大纲节点 (",n.nodes.length,")"]}),n.nodes.length===0?i.jsx("p",{className:"px-3 py-6 text-center text-sm text-muted-foreground",children:"暂无节点"}):i.jsx("ul",{className:"divide-y divide-border/70",children:n.nodes.map(R=>i.jsxs("li",{className:"px-3 py-2",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(bv,{label:oM[R.type]}),i.jsx("span",{className:"min-w-0 flex-1 truncate text-sm text-foreground",title:R.title,children:R.title}),i.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:xr(R.deletedAt)}),i.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[i.jsx(Se,{variant:"outline",size:"xs",type:"button",onClick:()=>{O(R)},children:"还原"}),i.jsx(Se,{variant:"outline",size:"xs",type:"button",className:"text-destructive hover:bg-destructive/10",onClick:()=>p({kind:"node",item:R}),children:"彻底删除"})]})]}),v?.node.id===R.id&&i.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-2 rounded-md border border-destructive/30 bg-destructive/10 px-3 py-2 text-sm",children:[i.jsxs("span",{className:"text-destructive",children:["上级节点《",v.ancestorName,"》也在回收站,请先还原上级"]}),i.jsxs(Se,{variant:"outline",size:"xs",type:"button",className:"border-destructive/40 text-destructive hover:bg-destructive/10",onClick:()=>{E()},children:["还原上级《",v.ancestorName,"》"]})]})]},R.id))})]})]}),b&&i.jsx(ws,{title:"彻底删除",description:b.kind==="entity"?`将彻底删除《${b.item.name}》(${xv[b.item.type]})及其关联关系、变更记录,不可恢复。`:`将彻底删除《${b.item.title}》及整棵子树、关联关系、变更记录,不可恢复。`,confirmLabel:"确认彻底删除",danger:!0,onConfirm:T,onClose:()=>p(null)})]})}function Rl(n){return n instanceof Ue?n.code:vt}function aM(){const n=ke(z=>z.showToast),o=ke(z=>z.showError),r=ke(z=>z.notifyDataChanged),l=ze(z=>z.config),c=ze(z=>z.configLoading),d=ze(z=>z.updateConfig),[m,g]=h.useState(!0),[b,p]=h.useState(""),[v,x]=h.useState(!1),[S,j]=h.useState(void 0),[N,k]=h.useState(""),[O,E]=h.useState(!1),[T,_]=h.useState(null),[R,H]=h.useState(null),[A,B]=h.useState(""),[M,Q]=h.useState(null),[ne,me]=h.useState(!1),[se,X]=h.useState(null);async function te(){try{const z=await xT();p(z.model),x(z.apiKeySet),j(z.apiKeyMasked)}catch(z){o(Rl(z),"读取 LLM 配置失败")}finally{g(!1)}}h.useEffect(()=>{te()},[]),h.useEffect(()=>{const z=ze.getState();z.config===null&&!z.configLoading&&z.loadConfig()},[]),h.useEffect(()=>{if(l===null){Q(null);return}l.id!==M&&(B(l.prompt),Q(l.id))},[l,M]);async function $(){X(null),me(!0);try{const z=A.trim();await d({prompt:z}),B(z),n("提示词已保存,仅影响新请求"),r()}catch(z){Rl(z)===vt?o("CLIENT_NETWORK_ERROR","无法连接服务,提示词未保存"):X("保存失败,请重试")}finally{me(!1)}}async function w(){if(!b.trim()){_("模型名不能为空");return}_(null),E(!0);try{await Ef({model:b.trim()}),n("已保存,仅影响新请求"),p(b.trim())}catch(z){Rl(z)===vt?o("CLIENT_NETWORK_ERROR","无法连接服务,模型配置未保存"):_("保存失败,请重试")}finally{E(!1)}}async function U(){if(!N.trim()){H("请输入新 key");return}H(null),E(!0);try{await Ef({api_key:N.trim()}),k(""),n("Key 已保存,仅影响新请求"),await te()}catch(z){Rl(z)===vt?o("CLIENT_NETWORK_ERROR","无法连接服务,Key 未保存"):H("保存失败,请重试")}finally{E(!1)}}async function Y(){H(null),E(!0);try{await Ef({api_key:""}),k(""),n("Key 已清除"),await te()}catch(z){Rl(z)===vt?o("CLIENT_NETWORK_ERROR","无法连接服务,Key 未清除"):H("清除失败,请重试")}finally{E(!1)}}return i.jsxs("section",{className:"max-w-lg",children:[i.jsx("h1",{className:"mb-4 text-xl font-semibold",children:"设置"}),m?i.jsx("p",{className:"text-sm text-zinc-500",children:"加载中…"}):i.jsxs("div",{className:"flex flex-col gap-6",children:[i.jsxs("div",{children:[i.jsx("h2",{className:"mb-1 text-sm font-semibold text-zinc-700",children:"AI 模型"}),i.jsx("p",{className:"mb-2 text-xs text-zinc-500",children:"默认 deepseek-v4-flash(可在服务端设置页或环境变量覆盖)"}),i.jsxs("div",{className:"flex max-w-sm gap-2",children:[i.jsx(Ot,{value:b,onChange:z=>p(z.target.value),placeholder:"deepseek-v4-flash"}),i.jsx(Se,{onClick:()=>{w()},disabled:O,type:"button",children:"保存设置"})]}),T&&i.jsx("p",{className:"mt-1 text-sm text-red-600",children:T})]}),i.jsxs("div",{children:[i.jsx("h2",{className:"mb-1 text-sm font-semibold text-zinc-700",children:"API Key"}),i.jsxs("p",{className:"mb-2 text-xs text-zinc-500",children:["状态:",v?`已配置(${S??""})`:"未配置"]}),i.jsxs("div",{className:"flex max-w-sm gap-2",children:[i.jsx(Ot,{value:N,onChange:z=>k(z.target.value),placeholder:"输入新 key(覆盖旧 key)"}),i.jsx(Se,{onClick:()=>{U()},disabled:O,type:"button",children:"保存 Key"}),i.jsx(Se,{variant:"outline",onClick:()=>{Y()},disabled:O,type:"button",children:"清除 Key"})]}),R&&i.jsx("p",{className:"mt-1 text-sm text-red-600",children:R})]}),i.jsxs("div",{className:"rounded-md border border-zinc-200 bg-zinc-50 p-3 text-xs leading-relaxed text-zinc-600",children:[i.jsx("p",{children:"· key 保存在用户目录配置文件(~/.ai-editor/config.json),不写入项目文件(决策 17)"}),i.jsx("p",{children:"· 环境变量 DEEPSEEK_API_KEY 优先于此处配置;保存的 key 仅影响新请求"})]}),i.jsxs("div",{children:[i.jsx("h2",{className:"mb-1 text-sm font-semibold text-foreground",children:"项目提示词"}),i.jsx("p",{className:"mb-2 text-xs text-muted-foreground",children:"注入 AI 上下文「## 项目设定」段(每轮有效);承载项目级规则/行业要求;空 = 整段跳过"}),i.jsx("p",{className:"mb-2 text-xs text-muted-foreground/70",children:"建议用 ### 及以下层级的小标题组织内容(如「### 写作规则」);避免使用 ## 顶层标题(与系统分段标题冲突)"}),i.jsx("textarea",{value:A,onChange:z=>B(z.target.value),rows:6,disabled:l===null||l.id!==M,placeholder:"输入项目级规则/行业要求…",className:"w-full resize-y rounded-lg border border-input bg-transparent px-2.5 py-1.5 text-sm outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50"}),i.jsxs("div",{className:"mt-2 flex items-center gap-3",children:[i.jsx(Se,{onClick:()=>{$()},disabled:ne||l===null||l.id!==M,type:"button",children:"保存提示词"}),l===null&&!c&&i.jsx("p",{className:"text-xs text-muted-foreground/70",children:"打开项目后可用"})]}),se&&i.jsx("p",{className:"mt-1 text-sm text-destructive",children:se})]})]})]})}function lM(n){const[o,r,l]=n.segments;switch(o){case void 0:return i.jsx(Py,{});case"outline":return r!==void 0?i.jsx(L_,{nodeId:r},r):i.jsx(d_,{});case"canvas":return i.jsx(e3,{});case"entities":{if(r==="relations")return i.jsx(dv,{type:"relations"});const c=r!==void 0&&Na.includes(r)?r:"character";return l!==void 0?i.jsx(a3,{type:c,id:l},`${c}:${l}`):i.jsx(dv,{type:c})}case"hooks":return i.jsx(N3,{});case"timeline":return r!==void 0?i.jsx(W3,{id:r},r):i.jsx(_3,{});case"trash":return i.jsx(rM,{});case"settings":return i.jsx(aM,{});default:return i.jsx(Py,{})}}function iM(){const n=zN();return i.jsx(s_,{route:n,children:lM(n)})}const cS=document.getElementById("root");if(!cS)throw new Error("#root 元素缺失(index.html)");_N.createRoot(cS).render(i.jsx(h.StrictMode,{children:i.jsx(o_,{children:i.jsx(iM,{})})}));
|