@agent-plan/pi-adapter 0.2.29 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,329 +0,0 @@
1
- var bS=Object.defineProperty;var wS=(e,a,r)=>a in e?bS(e,a,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[a]=r;var vn=(e,a,r)=>wS(e,typeof a!="symbol"?a+"":a,r);function SS(e,a){for(var r=0;r<a.length;r++){const s=a[r];if(typeof s!="string"&&!Array.isArray(s)){for(const u in s)if(u!=="default"&&!(u in e)){const c=Object.getOwnPropertyDescriptor(s,u);c&&Object.defineProperty(e,u,c.get?c:{enumerable:!0,get:()=>s[u]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const a=document.createElement("link").relList;if(a&&a.supports&&a.supports("modulepreload"))return;for(const u of document.querySelectorAll('link[rel="modulepreload"]'))s(u);new MutationObserver(u=>{for(const c of u)if(c.type==="childList")for(const d of c.addedNodes)d.tagName==="LINK"&&d.rel==="modulepreload"&&s(d)}).observe(document,{childList:!0,subtree:!0});function r(u){const c={};return u.integrity&&(c.integrity=u.integrity),u.referrerPolicy&&(c.referrerPolicy=u.referrerPolicy),u.crossOrigin==="use-credentials"?c.credentials="include":u.crossOrigin==="anonymous"?c.credentials="omit":c.credentials="same-origin",c}function s(u){if(u.ep)return;u.ep=!0;const c=r(u);fetch(u.href,c)}})();function NS(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Ch={exports:{}},yo={};/**
2
- * @license React
3
- * react-jsx-runtime.production.js
4
- *
5
- * Copyright (c) Meta Platforms, Inc. and affiliates.
6
- *
7
- * This source code is licensed under the MIT license found in the
8
- * LICENSE file in the root directory of this source tree.
9
- */var Kv;function ES(){if(Kv)return yo;Kv=1;var e=Symbol.for("react.transitional.element"),a=Symbol.for("react.fragment");function r(s,u,c){var d=null;if(c!==void 0&&(d=""+c),u.key!==void 0&&(d=""+u.key),"key"in u){c={};for(var h in u)h!=="key"&&(c[h]=u[h])}else c=u;return u=c.ref,{$$typeof:e,type:s,key:d,ref:u!==void 0?u:null,props:c}}return yo.Fragment=a,yo.jsx=r,yo.jsxs=r,yo}var Zv;function jS(){return Zv||(Zv=1,Ch.exports=ES()),Ch.exports}var i=jS(),Oh={exports:{}},rt={};/**
10
- * @license React
11
- * react.production.js
12
- *
13
- * Copyright (c) Meta Platforms, Inc. and affiliates.
14
- *
15
- * This source code is licensed under the MIT license found in the
16
- * LICENSE file in the root directory of this source tree.
17
- */var Wv;function RS(){if(Wv)return rt;Wv=1;var e=Symbol.for("react.transitional.element"),a=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),u=Symbol.for("react.profiler"),c=Symbol.for("react.consumer"),d=Symbol.for("react.context"),h=Symbol.for("react.forward_ref"),p=Symbol.for("react.suspense"),g=Symbol.for("react.memo"),v=Symbol.for("react.lazy"),y=Symbol.for("react.activity"),S=Symbol.iterator;function N(A){return A===null||typeof A!="object"?null:(A=S&&A[S]||A["@@iterator"],typeof A=="function"?A:null)}var w={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},j=Object.assign,R={};function M(A,I,K){this.props=A,this.context=I,this.refs=R,this.updater=K||w}M.prototype.isReactComponent={},M.prototype.setState=function(A,I){if(typeof A!="object"&&typeof A!="function"&&A!=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,A,I,"setState")},M.prototype.forceUpdate=function(A){this.updater.enqueueForceUpdate(this,A,"forceUpdate")};function $(){}$.prototype=M.prototype;function B(A,I,K){this.props=A,this.context=I,this.refs=R,this.updater=K||w}var Y=B.prototype=new $;Y.constructor=B,j(Y,M.prototype),Y.isPureReactComponent=!0;var ne=Array.isArray;function ae(){}var U={H:null,A:null,T:null,S:null},k=Object.prototype.hasOwnProperty;function re(A,I,K){var ue=K.ref;return{$$typeof:e,type:A,key:I,ref:ue!==void 0?ue:null,props:K}}function pe(A,I){return re(A.type,I,A.props)}function Se(A){return typeof A=="object"&&A!==null&&A.$$typeof===e}function ye(A){var I={"=":"=0",":":"=2"};return"$"+A.replace(/[=:]/g,function(K){return I[K]})}var he=/\/+/g;function je(A,I){return typeof A=="object"&&A!==null&&A.key!=null?ye(""+A.key):I.toString(36)}function W(A){switch(A.status){case"fulfilled":return A.value;case"rejected":throw A.reason;default:switch(typeof A.status=="string"?A.then(ae,ae):(A.status="pending",A.then(function(I){A.status==="pending"&&(A.status="fulfilled",A.value=I)},function(I){A.status==="pending"&&(A.status="rejected",A.reason=I)})),A.status){case"fulfilled":return A.value;case"rejected":throw A.reason}}throw A}function L(A,I,K,ue,ge){var xe=typeof A;(xe==="undefined"||xe==="boolean")&&(A=null);var ke=!1;if(A===null)ke=!0;else switch(xe){case"bigint":case"string":case"number":ke=!0;break;case"object":switch(A.$$typeof){case e:case a:ke=!0;break;case v:return ke=A._init,L(ke(A._payload),I,K,ue,ge)}}if(ke)return ge=ge(A),ke=ue===""?"."+je(A,0):ue,ne(ge)?(K="",ke!=null&&(K=ke.replace(he,"$&/")+"/"),L(ge,I,K,"",function(Ze){return Ze})):ge!=null&&(Se(ge)&&(ge=pe(ge,K+(ge.key==null||A&&A.key===ge.key?"":(""+ge.key).replace(he,"$&/")+"/")+ke)),I.push(ge)),1;ke=0;var Ie=ue===""?".":ue+":";if(ne(A))for(var Ue=0;Ue<A.length;Ue++)ue=A[Ue],xe=Ie+je(ue,Ue),ke+=L(ue,I,K,xe,ge);else if(Ue=N(A),typeof Ue=="function")for(A=Ue.call(A),Ue=0;!(ue=A.next()).done;)ue=ue.value,xe=Ie+je(ue,Ue++),ke+=L(ue,I,K,xe,ge);else if(xe==="object"){if(typeof A.then=="function")return L(W(A),I,K,ue,ge);throw I=String(A),Error("Objects are not valid as a React child (found: "+(I==="[object Object]"?"object with keys {"+Object.keys(A).join(", ")+"}":I)+"). If you meant to render a collection of children, use an array instead.")}return ke}function F(A,I,K){if(A==null)return A;var ue=[],ge=0;return L(A,ue,"","",function(xe){return I.call(K,xe,ge++)}),ue}function fe(A){if(A._status===-1){var I=A._result;I=I(),I.then(function(K){(A._status===0||A._status===-1)&&(A._status=1,A._result=K)},function(K){(A._status===0||A._status===-1)&&(A._status=2,A._result=K)}),A._status===-1&&(A._status=0,A._result=I)}if(A._status===1)return A._result.default;throw A._result}var P=typeof reportError=="function"?reportError:function(A){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var I=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof A=="object"&&A!==null&&typeof A.message=="string"?String(A.message):String(A),error:A});if(!window.dispatchEvent(I))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",A);return}console.error(A)},se={map:F,forEach:function(A,I,K){F(A,function(){I.apply(this,arguments)},K)},count:function(A){var I=0;return F(A,function(){I++}),I},toArray:function(A){return F(A,function(I){return I})||[]},only:function(A){if(!Se(A))throw Error("React.Children.only expected to receive a single React element child.");return A}};return rt.Activity=y,rt.Children=se,rt.Component=M,rt.Fragment=r,rt.Profiler=u,rt.PureComponent=B,rt.StrictMode=s,rt.Suspense=p,rt.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=U,rt.__COMPILER_RUNTIME={__proto__:null,c:function(A){return U.H.useMemoCache(A)}},rt.cache=function(A){return function(){return A.apply(null,arguments)}},rt.cacheSignal=function(){return null},rt.cloneElement=function(A,I,K){if(A==null)throw Error("The argument must be a React element, but you passed "+A+".");var ue=j({},A.props),ge=A.key;if(I!=null)for(xe in I.key!==void 0&&(ge=""+I.key),I)!k.call(I,xe)||xe==="key"||xe==="__self"||xe==="__source"||xe==="ref"&&I.ref===void 0||(ue[xe]=I[xe]);var xe=arguments.length-2;if(xe===1)ue.children=K;else if(1<xe){for(var ke=Array(xe),Ie=0;Ie<xe;Ie++)ke[Ie]=arguments[Ie+2];ue.children=ke}return re(A.type,ge,ue)},rt.createContext=function(A){return A={$$typeof:d,_currentValue:A,_currentValue2:A,_threadCount:0,Provider:null,Consumer:null},A.Provider=A,A.Consumer={$$typeof:c,_context:A},A},rt.createElement=function(A,I,K){var ue,ge={},xe=null;if(I!=null)for(ue in I.key!==void 0&&(xe=""+I.key),I)k.call(I,ue)&&ue!=="key"&&ue!=="__self"&&ue!=="__source"&&(ge[ue]=I[ue]);var ke=arguments.length-2;if(ke===1)ge.children=K;else if(1<ke){for(var Ie=Array(ke),Ue=0;Ue<ke;Ue++)Ie[Ue]=arguments[Ue+2];ge.children=Ie}if(A&&A.defaultProps)for(ue in ke=A.defaultProps,ke)ge[ue]===void 0&&(ge[ue]=ke[ue]);return re(A,xe,ge)},rt.createRef=function(){return{current:null}},rt.forwardRef=function(A){return{$$typeof:h,render:A}},rt.isValidElement=Se,rt.lazy=function(A){return{$$typeof:v,_payload:{_status:-1,_result:A},_init:fe}},rt.memo=function(A,I){return{$$typeof:g,type:A,compare:I===void 0?null:I}},rt.startTransition=function(A){var I=U.T,K={};U.T=K;try{var ue=A(),ge=U.S;ge!==null&&ge(K,ue),typeof ue=="object"&&ue!==null&&typeof ue.then=="function"&&ue.then(ae,P)}catch(xe){P(xe)}finally{I!==null&&K.types!==null&&(I.types=K.types),U.T=I}},rt.unstable_useCacheRefresh=function(){return U.H.useCacheRefresh()},rt.use=function(A){return U.H.use(A)},rt.useActionState=function(A,I,K){return U.H.useActionState(A,I,K)},rt.useCallback=function(A,I){return U.H.useCallback(A,I)},rt.useContext=function(A){return U.H.useContext(A)},rt.useDebugValue=function(){},rt.useDeferredValue=function(A,I){return U.H.useDeferredValue(A,I)},rt.useEffect=function(A,I){return U.H.useEffect(A,I)},rt.useEffectEvent=function(A){return U.H.useEffectEvent(A)},rt.useId=function(){return U.H.useId()},rt.useImperativeHandle=function(A,I,K){return U.H.useImperativeHandle(A,I,K)},rt.useInsertionEffect=function(A,I){return U.H.useInsertionEffect(A,I)},rt.useLayoutEffect=function(A,I){return U.H.useLayoutEffect(A,I)},rt.useMemo=function(A,I){return U.H.useMemo(A,I)},rt.useOptimistic=function(A,I){return U.H.useOptimistic(A,I)},rt.useReducer=function(A,I,K){return U.H.useReducer(A,I,K)},rt.useRef=function(A){return U.H.useRef(A)},rt.useState=function(A){return U.H.useState(A)},rt.useSyncExternalStore=function(A,I,K){return U.H.useSyncExternalStore(A,I,K)},rt.useTransition=function(){return U.H.useTransition()},rt.version="19.2.7",rt}var Jv;function Am(){return Jv||(Jv=1,Oh.exports=RS()),Oh.exports}var x=Am();const hn=NS(x),kS=SS({__proto__:null,default:hn},[x]);var Mh={exports:{}},bo={},_h={exports:{}},Lh={};/**
18
- * @license React
19
- * scheduler.production.js
20
- *
21
- * Copyright (c) Meta Platforms, Inc. and affiliates.
22
- *
23
- * This source code is licensed under the MIT license found in the
24
- * LICENSE file in the root directory of this source tree.
25
- */var ey;function TS(){return ey||(ey=1,(function(e){function a(L,F){var fe=L.length;L.push(F);e:for(;0<fe;){var P=fe-1>>>1,se=L[P];if(0<u(se,F))L[P]=F,L[fe]=se,fe=P;else break e}}function r(L){return L.length===0?null:L[0]}function s(L){if(L.length===0)return null;var F=L[0],fe=L.pop();if(fe!==F){L[0]=fe;e:for(var P=0,se=L.length,A=se>>>1;P<A;){var I=2*(P+1)-1,K=L[I],ue=I+1,ge=L[ue];if(0>u(K,fe))ue<se&&0>u(ge,K)?(L[P]=ge,L[ue]=fe,P=ue):(L[P]=K,L[I]=fe,P=I);else if(ue<se&&0>u(ge,fe))L[P]=ge,L[ue]=fe,P=ue;else break e}}return F}function u(L,F){var fe=L.sortIndex-F.sortIndex;return fe!==0?fe:L.id-F.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var c=performance;e.unstable_now=function(){return c.now()}}else{var d=Date,h=d.now();e.unstable_now=function(){return d.now()-h}}var p=[],g=[],v=1,y=null,S=3,N=!1,w=!1,j=!1,R=!1,M=typeof setTimeout=="function"?setTimeout:null,$=typeof clearTimeout=="function"?clearTimeout:null,B=typeof setImmediate<"u"?setImmediate:null;function Y(L){for(var F=r(g);F!==null;){if(F.callback===null)s(g);else if(F.startTime<=L)s(g),F.sortIndex=F.expirationTime,a(p,F);else break;F=r(g)}}function ne(L){if(j=!1,Y(L),!w)if(r(p)!==null)w=!0,ae||(ae=!0,ye());else{var F=r(g);F!==null&&W(ne,F.startTime-L)}}var ae=!1,U=-1,k=5,re=-1;function pe(){return R?!0:!(e.unstable_now()-re<k)}function Se(){if(R=!1,ae){var L=e.unstable_now();re=L;var F=!0;try{e:{w=!1,j&&(j=!1,$(U),U=-1),N=!0;var fe=S;try{t:{for(Y(L),y=r(p);y!==null&&!(y.expirationTime>L&&pe());){var P=y.callback;if(typeof P=="function"){y.callback=null,S=y.priorityLevel;var se=P(y.expirationTime<=L);if(L=e.unstable_now(),typeof se=="function"){y.callback=se,Y(L),F=!0;break t}y===r(p)&&s(p),Y(L)}else s(p);y=r(p)}if(y!==null)F=!0;else{var A=r(g);A!==null&&W(ne,A.startTime-L),F=!1}}break e}finally{y=null,S=fe,N=!1}F=void 0}}finally{F?ye():ae=!1}}}var ye;if(typeof B=="function")ye=function(){B(Se)};else if(typeof MessageChannel<"u"){var he=new MessageChannel,je=he.port2;he.port1.onmessage=Se,ye=function(){je.postMessage(null)}}else ye=function(){M(Se,0)};function W(L,F){U=M(function(){L(e.unstable_now())},F)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(L){L.callback=null},e.unstable_forceFrameRate=function(L){0>L||125<L?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):k=0<L?Math.floor(1e3/L):5},e.unstable_getCurrentPriorityLevel=function(){return S},e.unstable_next=function(L){switch(S){case 1:case 2:case 3:var F=3;break;default:F=S}var fe=S;S=F;try{return L()}finally{S=fe}},e.unstable_requestPaint=function(){R=!0},e.unstable_runWithPriority=function(L,F){switch(L){case 1:case 2:case 3:case 4:case 5:break;default:L=3}var fe=S;S=L;try{return F()}finally{S=fe}},e.unstable_scheduleCallback=function(L,F,fe){var P=e.unstable_now();switch(typeof fe=="object"&&fe!==null?(fe=fe.delay,fe=typeof fe=="number"&&0<fe?P+fe:P):fe=P,L){case 1:var se=-1;break;case 2:se=250;break;case 5:se=1073741823;break;case 4:se=1e4;break;default:se=5e3}return se=fe+se,L={id:v++,callback:F,priorityLevel:L,startTime:fe,expirationTime:se,sortIndex:-1},fe>P?(L.sortIndex=fe,a(g,L),r(p)===null&&L===r(g)&&(j?($(U),U=-1):j=!0,W(ne,fe-P))):(L.sortIndex=se,a(p,L),w||N||(w=!0,ae||(ae=!0,ye()))),L},e.unstable_shouldYield=pe,e.unstable_wrapCallback=function(L){var F=S;return function(){var fe=S;S=F;try{return L.apply(this,arguments)}finally{S=fe}}}})(Lh)),Lh}var ty;function AS(){return ty||(ty=1,_h.exports=TS()),_h.exports}var zh={exports:{}},ua={};/**
26
- * @license React
27
- * react-dom.production.js
28
- *
29
- * Copyright (c) Meta Platforms, Inc. and affiliates.
30
- *
31
- * This source code is licensed under the MIT license found in the
32
- * LICENSE file in the root directory of this source tree.
33
- */var ny;function DS(){if(ny)return ua;ny=1;var e=Am();function a(p){var g="https://react.dev/errors/"+p;if(1<arguments.length){g+="?args[]="+encodeURIComponent(arguments[1]);for(var v=2;v<arguments.length;v++)g+="&args[]="+encodeURIComponent(arguments[v])}return"Minified React error #"+p+"; visit "+g+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function r(){}var s={d:{f:r,r:function(){throw Error(a(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},u=Symbol.for("react.portal");function c(p,g,v){var y=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:u,key:y==null?null:""+y,children:p,containerInfo:g,implementation:v}}var d=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function h(p,g){if(p==="font")return"";if(typeof g=="string")return g==="use-credentials"?g:""}return ua.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=s,ua.createPortal=function(p,g){var v=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!g||g.nodeType!==1&&g.nodeType!==9&&g.nodeType!==11)throw Error(a(299));return c(p,g,null,v)},ua.flushSync=function(p){var g=d.T,v=s.p;try{if(d.T=null,s.p=2,p)return p()}finally{d.T=g,s.p=v,s.d.f()}},ua.preconnect=function(p,g){typeof p=="string"&&(g?(g=g.crossOrigin,g=typeof g=="string"?g==="use-credentials"?g:"":void 0):g=null,s.d.C(p,g))},ua.prefetchDNS=function(p){typeof p=="string"&&s.d.D(p)},ua.preinit=function(p,g){if(typeof p=="string"&&g&&typeof g.as=="string"){var v=g.as,y=h(v,g.crossOrigin),S=typeof g.integrity=="string"?g.integrity:void 0,N=typeof g.fetchPriority=="string"?g.fetchPriority:void 0;v==="style"?s.d.S(p,typeof g.precedence=="string"?g.precedence:void 0,{crossOrigin:y,integrity:S,fetchPriority:N}):v==="script"&&s.d.X(p,{crossOrigin:y,integrity:S,fetchPriority:N,nonce:typeof g.nonce=="string"?g.nonce:void 0})}},ua.preinitModule=function(p,g){if(typeof p=="string")if(typeof g=="object"&&g!==null){if(g.as==null||g.as==="script"){var v=h(g.as,g.crossOrigin);s.d.M(p,{crossOrigin:v,integrity:typeof g.integrity=="string"?g.integrity:void 0,nonce:typeof g.nonce=="string"?g.nonce:void 0})}}else g==null&&s.d.M(p)},ua.preload=function(p,g){if(typeof p=="string"&&typeof g=="object"&&g!==null&&typeof g.as=="string"){var v=g.as,y=h(v,g.crossOrigin);s.d.L(p,v,{crossOrigin:y,integrity:typeof g.integrity=="string"?g.integrity:void 0,nonce:typeof g.nonce=="string"?g.nonce:void 0,type:typeof g.type=="string"?g.type:void 0,fetchPriority:typeof g.fetchPriority=="string"?g.fetchPriority:void 0,referrerPolicy:typeof g.referrerPolicy=="string"?g.referrerPolicy:void 0,imageSrcSet:typeof g.imageSrcSet=="string"?g.imageSrcSet:void 0,imageSizes:typeof g.imageSizes=="string"?g.imageSizes:void 0,media:typeof g.media=="string"?g.media:void 0})}},ua.preloadModule=function(p,g){if(typeof p=="string")if(g){var v=h(g.as,g.crossOrigin);s.d.m(p,{as:typeof g.as=="string"&&g.as!=="script"?g.as:void 0,crossOrigin:v,integrity:typeof g.integrity=="string"?g.integrity:void 0})}else s.d.m(p)},ua.requestFormReset=function(p){s.d.r(p)},ua.unstable_batchedUpdates=function(p,g){return p(g)},ua.useFormState=function(p,g,v){return d.H.useFormState(p,g,v)},ua.useFormStatus=function(){return d.H.useHostTransitionStatus()},ua.version="19.2.7",ua}var ay;function Ab(){if(ay)return zh.exports;ay=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(a){console.error(a)}}return e(),zh.exports=DS(),zh.exports}/**
34
- * @license React
35
- * react-dom-client.production.js
36
- *
37
- * Copyright (c) Meta Platforms, Inc. and affiliates.
38
- *
39
- * This source code is licensed under the MIT license found in the
40
- * LICENSE file in the root directory of this source tree.
41
- */var ry;function CS(){if(ry)return bo;ry=1;var e=AS(),a=Am(),r=Ab();function s(t){var n="https://react.dev/errors/"+t;if(1<arguments.length){n+="?args[]="+encodeURIComponent(arguments[1]);for(var l=2;l<arguments.length;l++)n+="&args[]="+encodeURIComponent(arguments[l])}return"Minified React error #"+t+"; visit "+n+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function u(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function c(t){var n=t,l=t;if(t.alternate)for(;n.return;)n=n.return;else{t=n;do n=t,(n.flags&4098)!==0&&(l=n.return),t=n.return;while(t)}return n.tag===3?l:null}function d(t){if(t.tag===13){var n=t.memoizedState;if(n===null&&(t=t.alternate,t!==null&&(n=t.memoizedState)),n!==null)return n.dehydrated}return null}function h(t){if(t.tag===31){var n=t.memoizedState;if(n===null&&(t=t.alternate,t!==null&&(n=t.memoizedState)),n!==null)return n.dehydrated}return null}function p(t){if(c(t)!==t)throw Error(s(188))}function g(t){var n=t.alternate;if(!n){if(n=c(t),n===null)throw Error(s(188));return n!==t?null:t}for(var l=t,o=n;;){var f=l.return;if(f===null)break;var m=f.alternate;if(m===null){if(o=f.return,o!==null){l=o;continue}break}if(f.child===m.child){for(m=f.child;m;){if(m===l)return p(f),t;if(m===o)return p(f),n;m=m.sibling}throw Error(s(188))}if(l.return!==o.return)l=f,o=m;else{for(var b=!1,E=f.child;E;){if(E===l){b=!0,l=f,o=m;break}if(E===o){b=!0,o=f,l=m;break}E=E.sibling}if(!b){for(E=m.child;E;){if(E===l){b=!0,l=m,o=f;break}if(E===o){b=!0,o=m,l=f;break}E=E.sibling}if(!b)throw Error(s(189))}}if(l.alternate!==o)throw Error(s(190))}if(l.tag!==3)throw Error(s(188));return l.stateNode.current===l?t:n}function v(t){var n=t.tag;if(n===5||n===26||n===27||n===6)return t;for(t=t.child;t!==null;){if(n=v(t),n!==null)return n;t=t.sibling}return null}var y=Object.assign,S=Symbol.for("react.element"),N=Symbol.for("react.transitional.element"),w=Symbol.for("react.portal"),j=Symbol.for("react.fragment"),R=Symbol.for("react.strict_mode"),M=Symbol.for("react.profiler"),$=Symbol.for("react.consumer"),B=Symbol.for("react.context"),Y=Symbol.for("react.forward_ref"),ne=Symbol.for("react.suspense"),ae=Symbol.for("react.suspense_list"),U=Symbol.for("react.memo"),k=Symbol.for("react.lazy"),re=Symbol.for("react.activity"),pe=Symbol.for("react.memo_cache_sentinel"),Se=Symbol.iterator;function ye(t){return t===null||typeof t!="object"?null:(t=Se&&t[Se]||t["@@iterator"],typeof t=="function"?t:null)}var he=Symbol.for("react.client.reference");function je(t){if(t==null)return null;if(typeof t=="function")return t.$$typeof===he?null:t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case j:return"Fragment";case M:return"Profiler";case R:return"StrictMode";case ne:return"Suspense";case ae:return"SuspenseList";case re:return"Activity"}if(typeof t=="object")switch(t.$$typeof){case w:return"Portal";case B:return t.displayName||"Context";case $:return(t._context.displayName||"Context")+".Consumer";case Y:var n=t.render;return t=t.displayName,t||(t=n.displayName||n.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case U:return n=t.displayName||null,n!==null?n:je(t.type)||"Memo";case k:n=t._payload,t=t._init;try{return je(t(n))}catch{}}return null}var W=Array.isArray,L=a.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,F=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,fe={pending:!1,data:null,method:null,action:null},P=[],se=-1;function A(t){return{current:t}}function I(t){0>se||(t.current=P[se],P[se]=null,se--)}function K(t,n){se++,P[se]=t.current,t.current=n}var ue=A(null),ge=A(null),xe=A(null),ke=A(null);function Ie(t,n){switch(K(xe,n),K(ge,t),K(ue,null),n.nodeType){case 9:case 11:t=(t=n.documentElement)&&(t=t.namespaceURI)?yv(t):0;break;default:if(t=n.tagName,n=n.namespaceURI)n=yv(n),t=bv(n,t);else switch(t){case"svg":t=1;break;case"math":t=2;break;default:t=0}}I(ue),K(ue,t)}function Ue(){I(ue),I(ge),I(xe)}function Ze(t){t.memoizedState!==null&&K(ke,t);var n=ue.current,l=bv(n,t.type);n!==l&&(K(ge,t),K(ue,l))}function dn(t){ge.current===t&&(I(ue),I(ge)),ke.current===t&&(I(ke),po._currentValue=fe)}var It,pt;function ce(t){if(It===void 0)try{throw Error()}catch(l){var n=l.stack.trim().match(/\n( *(at )?)/);It=n&&n[1]||"",pt=-1<l.stack.indexOf(`
42
- at`)?" (<anonymous>)":-1<l.stack.indexOf("@")?"@unknown:0:0":""}return`
43
- `+It+t+pt}var qe=!1;function st(t,n){if(!t||qe)return"";qe=!0;var l=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var o={DetermineComponentFrameRoot:function(){try{if(n){var oe=function(){throw Error()};if(Object.defineProperty(oe.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(oe,[])}catch(Z){var Q=Z}Reflect.construct(t,[],oe)}else{try{oe.call()}catch(Z){Q=Z}t.call(oe.prototype)}}else{try{throw Error()}catch(Z){Q=Z}(oe=t())&&typeof oe.catch=="function"&&oe.catch(function(){})}}catch(Z){if(Z&&Q&&typeof Z.stack=="string")return[Z.stack,Q.stack]}return[null,null]}};o.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var f=Object.getOwnPropertyDescriptor(o.DetermineComponentFrameRoot,"name");f&&f.configurable&&Object.defineProperty(o.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var m=o.DetermineComponentFrameRoot(),b=m[0],E=m[1];if(b&&E){var C=b.split(`
44
- `),G=E.split(`
45
- `);for(f=o=0;o<C.length&&!C[o].includes("DetermineComponentFrameRoot");)o++;for(;f<G.length&&!G[f].includes("DetermineComponentFrameRoot");)f++;if(o===C.length||f===G.length)for(o=C.length-1,f=G.length-1;1<=o&&0<=f&&C[o]!==G[f];)f--;for(;1<=o&&0<=f;o--,f--)if(C[o]!==G[f]){if(o!==1||f!==1)do if(o--,f--,0>f||C[o]!==G[f]){var te=`
46
- `+C[o].replace(" at new "," at ");return t.displayName&&te.includes("<anonymous>")&&(te=te.replace("<anonymous>",t.displayName)),te}while(1<=o&&0<=f);break}}}finally{qe=!1,Error.prepareStackTrace=l}return(l=t?t.displayName||t.name:"")?ce(l):""}function Ht(t,n){switch(t.tag){case 26:case 27:case 5:return ce(t.type);case 16:return ce("Lazy");case 13:return t.child!==n&&n!==null?ce("Suspense Fallback"):ce("Suspense");case 19:return ce("SuspenseList");case 0:case 15:return st(t.type,!1);case 11:return st(t.type.render,!1);case 1:return st(t.type,!0);case 31:return ce("Activity");default:return""}}function yn(t){try{var n="",l=null;do n+=Ht(t,l),l=t,t=t.return;while(t);return n}catch(o){return`
47
- Error generating stack: `+o.message+`
48
- `+o.stack}}var At=Object.prototype.hasOwnProperty,$t=e.unstable_scheduleCallback,Wt=e.unstable_cancelCallback,Fn=e.unstable_shouldYield,Vn=e.unstable_requestPaint,rn=e.unstable_now,ha=e.unstable_getCurrentPriorityLevel,ma=e.unstable_ImmediatePriority,aa=e.unstable_UserBlockingPriority,Yn=e.unstable_NormalPriority,me=e.unstable_LowPriority,Ae=e.unstable_IdlePriority,De=e.log,Qe=e.unstable_setDisableYieldValue,Pe=null,ee=null;function Dt(t){if(typeof De=="function"&&Qe(t),ee&&typeof ee.setStrictMode=="function")try{ee.setStrictMode(Pe,t)}catch{}}var Jt=Math.clz32?Math.clz32:qa,Qn=Math.log,bn=Math.LN2;function qa(t){return t>>>=0,t===0?32:31-(Qn(t)/bn|0)|0}var _e=256,bt=262144,wt=4194304;function Et(t){var n=t&42;if(n!==0)return n;switch(t&-t){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 t&261888;case 262144:case 524288:case 1048576:case 2097152:return t&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return t&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return t}}function qt(t,n,l){var o=t.pendingLanes;if(o===0)return 0;var f=0,m=t.suspendedLanes,b=t.pingedLanes;t=t.warmLanes;var E=o&134217727;return E!==0?(o=E&~m,o!==0?f=Et(o):(b&=E,b!==0?f=Et(b):l||(l=E&~t,l!==0&&(f=Et(l))))):(E=o&~m,E!==0?f=Et(E):b!==0?f=Et(b):l||(l=o&~t,l!==0&&(f=Et(l)))),f===0?0:n!==0&&n!==f&&(n&m)===0&&(m=f&-f,l=n&-n,m>=l||m===32&&(l&4194048)!==0)?n:f}function Ct(t,n){return(t.pendingLanes&~(t.suspendedLanes&~t.pingedLanes)&n)===0}function ln(t,n){switch(t){case 1:case 2:case 4:case 8:case 64:return n+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 n+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 en(){var t=wt;return wt<<=1,(wt&62914560)===0&&(wt=4194304),t}function Pt(t){for(var n=[],l=0;31>l;l++)n.push(t);return n}function gt(t,n){t.pendingLanes|=n,n!==268435456&&(t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0)}function nt(t,n,l,o,f,m){var b=t.pendingLanes;t.pendingLanes=l,t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0,t.expiredLanes&=l,t.entangledLanes&=l,t.errorRecoveryDisabledLanes&=l,t.shellSuspendCounter=0;var E=t.entanglements,C=t.expirationTimes,G=t.hiddenUpdates;for(l=b&~l;0<l;){var te=31-Jt(l),oe=1<<te;E[te]=0,C[te]=-1;var Q=G[te];if(Q!==null)for(G[te]=null,te=0;te<Q.length;te++){var Z=Q[te];Z!==null&&(Z.lane&=-536870913)}l&=~oe}o!==0&&jn(t,o,0),m!==0&&f===0&&t.tag!==0&&(t.suspendedLanes|=m&~(b&~n))}function jn(t,n,l){t.pendingLanes|=n,t.suspendedLanes&=~n;var o=31-Jt(n);t.entangledLanes|=n,t.entanglements[o]=t.entanglements[o]|1073741824|l&261930}function Ln(t,n){var l=t.entangledLanes|=n;for(t=t.entanglements;l;){var o=31-Jt(l),f=1<<o;f&n|t[o]&n&&(t[o]|=n),l&=~f}}function D(t,n){var l=n&-n;return l=(l&42)!==0?1:_(l),(l&(t.suspendedLanes|n))!==0?0:l}function _(t){switch(t){case 2:t=1;break;case 8:t=4;break;case 32:t=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:t=128;break;case 268435456:t=134217728;break;default:t=0}return t}function q(t){return t&=-t,2<t?8<t?(t&134217727)!==0?32:268435456:8:2}function J(){var t=F.p;return t!==0?t:(t=window.event,t===void 0?32:Pv(t.type))}function ie(t,n){var l=F.p;try{return F.p=t,n()}finally{F.p=l}}var Te=Math.random().toString(36).slice(2),be="__reactFiber$"+Te,Ce="__reactProps$"+Te,Re="__reactContainer$"+Te,Le="__reactEvents$"+Te,$e="__reactListeners$"+Te,We="__reactHandles$"+Te,Oe="__reactResources$"+Te,tt="__reactMarker$"+Te;function Fe(t){delete t[be],delete t[Ce],delete t[Le],delete t[$e],delete t[We]}function Ft(t){var n=t[be];if(n)return n;for(var l=t.parentNode;l;){if(n=l[Re]||l[be]){if(l=n.alternate,n.child!==null||l!==null&&l.child!==null)for(t=kv(t);t!==null;){if(l=t[be])return l;t=kv(t)}return n}t=l,l=t.parentNode}return null}function at(t){if(t=t[be]||t[Re]){var n=t.tag;if(n===5||n===6||n===13||n===31||n===26||n===27||n===3)return t}return null}function ht(t){var n=t.tag;if(n===5||n===26||n===27||n===6)return t.stateNode;throw Error(s(33))}function dt(t){var n=t[Oe];return n||(n=t[Oe]={hoistableStyles:new Map,hoistableScripts:new Map}),n}function mt(t){t[tt]=!0}var tn=new Set,Kn={};function Rn(t,n){zn(t,n),zn(t+"Capture",n)}function zn(t,n){for(Kn[t]=n,t=0;t<n.length;t++)tn.add(n[t])}var $n=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]*$"),Zn={},va={};function hl(t){return At.call(va,t)?!0:At.call(Zn,t)?!1:$n.test(t)?va[t]=!0:(Zn[t]=!0,!1)}function ra(t,n,l){if(hl(n))if(l===null)t.removeAttribute(n);else{switch(typeof l){case"undefined":case"function":case"symbol":t.removeAttribute(n);return;case"boolean":var o=n.toLowerCase().slice(0,5);if(o!=="data-"&&o!=="aria-"){t.removeAttribute(n);return}}t.setAttribute(n,""+l)}}function vr(t,n,l){if(l===null)t.removeAttribute(n);else{switch(typeof l){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(n);return}t.setAttribute(n,""+l)}}function Je(t,n,l,o){if(o===null)t.removeAttribute(l);else{switch(typeof o){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(l);return}t.setAttributeNS(n,l,""+o)}}function Rt(t){switch(typeof t){case"bigint":case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function nn(t){var n=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(n==="checkbox"||n==="radio")}function la(t,n,l){var o=Object.getOwnPropertyDescriptor(t.constructor.prototype,n);if(!t.hasOwnProperty(n)&&typeof o<"u"&&typeof o.get=="function"&&typeof o.set=="function"){var f=o.get,m=o.set;return Object.defineProperty(t,n,{configurable:!0,get:function(){return f.call(this)},set:function(b){l=""+b,m.call(this,b)}}),Object.defineProperty(t,n,{enumerable:o.enumerable}),{getValue:function(){return l},setValue:function(b){l=""+b},stopTracking:function(){t._valueTracker=null,delete t[n]}}}}function Un(t){if(!t._valueTracker){var n=nn(t)?"checked":"value";t._valueTracker=la(t,n,""+t[n])}}function Lr(t){if(!t)return!1;var n=t._valueTracker;if(!n)return!0;var l=n.getValue(),o="";return t&&(o=nn(t)?t.checked?"true":"false":t.value),t=o,t!==l?(n.setValue(t),!0):!1}function kt(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}var Da=/[\n"\\]/g;function Wn(t){return t.replace(Da,function(n){return"\\"+n.charCodeAt(0).toString(16)+" "})}function Wl(t,n,l,o,f,m,b,E){t.name="",b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"?t.type=b:t.removeAttribute("type"),n!=null?b==="number"?(n===0&&t.value===""||t.value!=n)&&(t.value=""+Rt(n)):t.value!==""+Rt(n)&&(t.value=""+Rt(n)):b!=="submit"&&b!=="reset"||t.removeAttribute("value"),n!=null?Ot(t,b,Rt(n)):l!=null?Ot(t,b,Rt(l)):o!=null&&t.removeAttribute("value"),f==null&&m!=null&&(t.defaultChecked=!!m),f!=null&&(t.checked=f&&typeof f!="function"&&typeof f!="symbol"),E!=null&&typeof E!="function"&&typeof E!="symbol"&&typeof E!="boolean"?t.name=""+Rt(E):t.removeAttribute("name")}function Di(t,n,l,o,f,m,b,E){if(m!=null&&typeof m!="function"&&typeof m!="symbol"&&typeof m!="boolean"&&(t.type=m),n!=null||l!=null){if(!(m!=="submit"&&m!=="reset"||n!=null)){Un(t);return}l=l!=null?""+Rt(l):"",n=n!=null?""+Rt(n):l,E||n===t.value||(t.value=n),t.defaultValue=n}o=o??f,o=typeof o!="function"&&typeof o!="symbol"&&!!o,t.checked=E?t.checked:!!o,t.defaultChecked=!!o,b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"&&(t.name=b),Un(t)}function Ot(t,n,l){n==="number"&&kt(t.ownerDocument)===t||t.defaultValue===""+l||(t.defaultValue=""+l)}function yr(t,n,l,o){if(t=t.options,n){n={};for(var f=0;f<l.length;f++)n["$"+l[f]]=!0;for(l=0;l<t.length;l++)f=n.hasOwnProperty("$"+t[l].value),t[l].selected!==f&&(t[l].selected=f),f&&o&&(t[l].defaultSelected=!0)}else{for(l=""+Rt(l),n=null,f=0;f<t.length;f++){if(t[f].value===l){t[f].selected=!0,o&&(t[f].defaultSelected=!0);return}n!==null||t[f].disabled||(n=t[f])}n!==null&&(n.selected=!0)}}function dc(t,n,l){if(n!=null&&(n=""+Rt(n),n!==t.value&&(t.value=n),l==null)){t.defaultValue!==n&&(t.defaultValue=n);return}t.defaultValue=l!=null?""+Rt(l):""}function sr(t,n,l,o){if(n==null){if(o!=null){if(l!=null)throw Error(s(92));if(W(o)){if(1<o.length)throw Error(s(93));o=o[0]}l=o}l==null&&(l=""),n=l}l=Rt(n),t.defaultValue=l,o=t.textContent,o===l&&o!==""&&o!==null&&(t.value=o),Un(t)}function ml(t,n){if(n){var l=t.firstChild;if(l&&l===t.lastChild&&l.nodeType===3){l.nodeValue=n;return}}t.textContent=n}var Cd=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 Ds(t,n,l){var o=n.indexOf("--")===0;l==null||typeof l=="boolean"||l===""?o?t.setProperty(n,""):n==="float"?t.cssFloat="":t[n]="":o?t.setProperty(n,l):typeof l!="number"||l===0||Cd.has(n)?n==="float"?t.cssFloat=l:t[n]=(""+l).trim():t[n]=l+"px"}function ya(t,n,l){if(n!=null&&typeof n!="object")throw Error(s(62));if(t=t.style,l!=null){for(var o in l)!l.hasOwnProperty(o)||n!=null&&n.hasOwnProperty(o)||(o.indexOf("--")===0?t.setProperty(o,""):o==="float"?t.cssFloat="":t[o]="");for(var f in n)o=n[f],n.hasOwnProperty(f)&&l[f]!==o&&Ds(t,f,o)}else for(var m in n)n.hasOwnProperty(m)&&Ds(t,m,n[m])}function Jl(t){if(t.indexOf("-")===-1)return!1;switch(t){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 Cs=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"]]),ba=/^[\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 sn(t){return ba.test(""+t)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":t}function sa(){}var Ca=null;function zr(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var br=null,$r=null;function Ci(t){var n=at(t);if(n&&(t=n.stateNode)){var l=t[Ce]||null;e:switch(t=n.stateNode,n.type){case"input":if(Wl(t,l.value,l.defaultValue,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name),n=l.name,l.type==="radio"&&n!=null){for(l=t;l.parentNode;)l=l.parentNode;for(l=l.querySelectorAll('input[name="'+Wn(""+n)+'"][type="radio"]'),n=0;n<l.length;n++){var o=l[n];if(o!==t&&o.form===t.form){var f=o[Ce]||null;if(!f)throw Error(s(90));Wl(o,f.value,f.defaultValue,f.defaultValue,f.checked,f.defaultChecked,f.type,f.name)}}for(n=0;n<l.length;n++)o=l[n],o.form===t.form&&Lr(o)}break e;case"textarea":dc(t,l.value,l.defaultValue);break e;case"select":n=l.value,n!=null&&yr(t,!!l.multiple,n,!1)}}}var wr=!1;function Oi(t,n,l){if(wr)return t(n,l);wr=!0;try{var o=t(n);return o}finally{if(wr=!1,(br!==null||$r!==null)&&(Wc(),br&&(n=br,t=$r,$r=br=null,Ci(n),t)))for(n=0;n<t.length;n++)Ci(t[n])}}function Pa(t,n){var l=t.stateNode;if(l===null)return null;var o=l[Ce]||null;if(o===null)return null;l=o[n];e:switch(n){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(o=!o.disabled)||(t=t.type,o=!(t==="button"||t==="input"||t==="select"||t==="textarea")),t=!o;break e;default:t=!1}if(t)return null;if(l&&typeof l!="function")throw Error(s(231,n,typeof l));return l}var ir=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Mi=!1;if(ir)try{var Ur={};Object.defineProperty(Ur,"passive",{get:function(){Mi=!0}}),window.addEventListener("test",Ur,Ur),window.removeEventListener("test",Ur,Ur)}catch{Mi=!1}var Fa=null,_i=null,Os=null;function fc(){if(Os)return Os;var t,n=_i,l=n.length,o,f="value"in Fa?Fa.value:Fa.textContent,m=f.length;for(t=0;t<l&&n[t]===f[t];t++);var b=l-t;for(o=1;o<=b&&n[l-o]===f[m-o];o++);return Os=f.slice(t,1<o?1-o:void 0)}function Ms(t){var n=t.keyCode;return"charCode"in t?(t=t.charCode,t===0&&n===13&&(t=13)):t=n,t===10&&(t=13),32<=t||t===13?t:0}function Br(){return!0}function hc(){return!1}function ia(t){function n(l,o,f,m,b){this._reactName=l,this._targetInst=f,this.type=o,this.nativeEvent=m,this.target=b,this.currentTarget=null;for(var E in t)t.hasOwnProperty(E)&&(l=t[E],this[E]=l?l(m):m[E]);return this.isDefaultPrevented=(m.defaultPrevented!=null?m.defaultPrevented:m.returnValue===!1)?Br:hc,this.isPropagationStopped=hc,this}return y(n.prototype,{preventDefault:function(){this.defaultPrevented=!0;var l=this.nativeEvent;l&&(l.preventDefault?l.preventDefault():typeof l.returnValue!="unknown"&&(l.returnValue=!1),this.isDefaultPrevented=Br)},stopPropagation:function(){var l=this.nativeEvent;l&&(l.stopPropagation?l.stopPropagation():typeof l.cancelBubble!="unknown"&&(l.cancelBubble=!0),this.isPropagationStopped=Br)},persist:function(){},isPersistent:Br}),n}var Ir={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Hr=ia(Ir),es=y({},Ir,{view:0,detail:0}),Od=ia(es),pl,ts,ns,qr=y({},es,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:ca,button:0,buttons:0,relatedTarget:function(t){return t.relatedTarget===void 0?t.fromElement===t.srcElement?t.toElement:t.fromElement:t.relatedTarget},movementX:function(t){return"movementX"in t?t.movementX:(t!==ns&&(ns&&t.type==="mousemove"?(pl=t.screenX-ns.screenX,ts=t.screenY-ns.screenY):ts=pl=0,ns=t),pl)},movementY:function(t){return"movementY"in t?t.movementY:ts}}),mc=ia(qr),T=y({},qr,{dataTransfer:0}),X=ia(T),Ee=y({},es,{relatedTarget:0}),we=ia(Ee),Ge=y({},Ir,{animationName:0,elapsedTime:0,pseudoElement:0}),de=ia(Ge),ve=y({},Ir,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),Ne=ia(ve),et=y({},Ir,{data:0}),it=ia(et),Be={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},kn={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"},Ut={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function oa(t){var n=this.nativeEvent;return n.getModifierState?n.getModifierState(t):(t=Ut[t])?!!n[t]:!1}function ca(){return oa}var wa=y({},es,{key:function(t){if(t.key){var n=Be[t.key]||t.key;if(n!=="Unidentified")return n}return t.type==="keypress"?(t=Ms(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?kn[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:ca,charCode:function(t){return t.type==="keypress"?Ms(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?Ms(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),Tn=ia(wa),mn=y({},qr,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Bt=ia(mn),as=y({},es,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:ca}),Sr=ia(as),Md=y({},Ir,{propertyName:0,elapsedTime:0,pseudoElement:0}),pc=ia(Md),gc=y({},qr,{deltaX:function(t){return"deltaX"in t?t.deltaX:"wheelDeltaX"in t?-t.wheelDeltaX:0},deltaY:function(t){return"deltaY"in t?t.deltaY:"wheelDeltaY"in t?-t.wheelDeltaY:"wheelDelta"in t?-t.wheelDelta:0},deltaZ:0,deltaMode:0}),_d=ia(gc),Ld=y({},Ir,{newState:0,oldState:0}),Hw=ia(Ld),qw=[9,13,27,32],zd=ir&&"CompositionEvent"in window,Li=null;ir&&"documentMode"in document&&(Li=document.documentMode);var Pw=ir&&"TextEvent"in window&&!Li,jp=ir&&(!zd||Li&&8<Li&&11>=Li),Rp=" ",kp=!1;function Tp(t,n){switch(t){case"keyup":return qw.indexOf(n.keyCode)!==-1;case"keydown":return n.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Ap(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var _s=!1;function Fw(t,n){switch(t){case"compositionend":return Ap(n);case"keypress":return n.which!==32?null:(kp=!0,Rp);case"textInput":return t=n.data,t===Rp&&kp?null:t;default:return null}}function Vw(t,n){if(_s)return t==="compositionend"||!zd&&Tp(t,n)?(t=fc(),Os=_i=Fa=null,_s=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(n.ctrlKey||n.altKey||n.metaKey)||n.ctrlKey&&n.altKey){if(n.char&&1<n.char.length)return n.char;if(n.which)return String.fromCharCode(n.which)}return null;case"compositionend":return jp&&n.locale!=="ko"?null:n.data;default:return null}}var Yw={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 Dp(t){var n=t&&t.nodeName&&t.nodeName.toLowerCase();return n==="input"?!!Yw[t.type]:n==="textarea"}function Cp(t,n,l,o){br?$r?$r.push(o):$r=[o]:br=o,n=lu(n,"onChange"),0<n.length&&(l=new Hr("onChange","change",null,l,o),t.push({event:l,listeners:n}))}var zi=null,$i=null;function Gw(t){hv(t,0)}function xc(t){var n=ht(t);if(Lr(n))return t}function Op(t,n){if(t==="change")return n}var Mp=!1;if(ir){var $d;if(ir){var Ud="oninput"in document;if(!Ud){var _p=document.createElement("div");_p.setAttribute("oninput","return;"),Ud=typeof _p.oninput=="function"}$d=Ud}else $d=!1;Mp=$d&&(!document.documentMode||9<document.documentMode)}function Lp(){zi&&(zi.detachEvent("onpropertychange",zp),$i=zi=null)}function zp(t){if(t.propertyName==="value"&&xc($i)){var n=[];Cp(n,$i,t,zr(t)),Oi(Gw,n)}}function Xw(t,n,l){t==="focusin"?(Lp(),zi=n,$i=l,zi.attachEvent("onpropertychange",zp)):t==="focusout"&&Lp()}function Qw(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return xc($i)}function Kw(t,n){if(t==="click")return xc(n)}function Zw(t,n){if(t==="input"||t==="change")return xc(n)}function Ww(t,n){return t===n&&(t!==0||1/t===1/n)||t!==t&&n!==n}var Oa=typeof Object.is=="function"?Object.is:Ww;function Ui(t,n){if(Oa(t,n))return!0;if(typeof t!="object"||t===null||typeof n!="object"||n===null)return!1;var l=Object.keys(t),o=Object.keys(n);if(l.length!==o.length)return!1;for(o=0;o<l.length;o++){var f=l[o];if(!At.call(n,f)||!Oa(t[f],n[f]))return!1}return!0}function $p(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function Up(t,n){var l=$p(t);t=0;for(var o;l;){if(l.nodeType===3){if(o=t+l.textContent.length,t<=n&&o>=n)return{node:l,offset:n-t};t=o}e:{for(;l;){if(l.nextSibling){l=l.nextSibling;break e}l=l.parentNode}l=void 0}l=$p(l)}}function Bp(t,n){return t&&n?t===n?!0:t&&t.nodeType===3?!1:n&&n.nodeType===3?Bp(t,n.parentNode):"contains"in t?t.contains(n):t.compareDocumentPosition?!!(t.compareDocumentPosition(n)&16):!1:!1}function Ip(t){t=t!=null&&t.ownerDocument!=null&&t.ownerDocument.defaultView!=null?t.ownerDocument.defaultView:window;for(var n=kt(t.document);n instanceof t.HTMLIFrameElement;){try{var l=typeof n.contentWindow.location.href=="string"}catch{l=!1}if(l)t=n.contentWindow;else break;n=kt(t.document)}return n}function Bd(t){var n=t&&t.nodeName&&t.nodeName.toLowerCase();return n&&(n==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||n==="textarea"||t.contentEditable==="true")}var Jw=ir&&"documentMode"in document&&11>=document.documentMode,Ls=null,Id=null,Bi=null,Hd=!1;function Hp(t,n,l){var o=l.window===l?l.document:l.nodeType===9?l:l.ownerDocument;Hd||Ls==null||Ls!==kt(o)||(o=Ls,"selectionStart"in o&&Bd(o)?o={start:o.selectionStart,end:o.selectionEnd}:(o=(o.ownerDocument&&o.ownerDocument.defaultView||window).getSelection(),o={anchorNode:o.anchorNode,anchorOffset:o.anchorOffset,focusNode:o.focusNode,focusOffset:o.focusOffset}),Bi&&Ui(Bi,o)||(Bi=o,o=lu(Id,"onSelect"),0<o.length&&(n=new Hr("onSelect","select",null,n,l),t.push({event:n,listeners:o}),n.target=Ls)))}function rs(t,n){var l={};return l[t.toLowerCase()]=n.toLowerCase(),l["Webkit"+t]="webkit"+n,l["Moz"+t]="moz"+n,l}var zs={animationend:rs("Animation","AnimationEnd"),animationiteration:rs("Animation","AnimationIteration"),animationstart:rs("Animation","AnimationStart"),transitionrun:rs("Transition","TransitionRun"),transitionstart:rs("Transition","TransitionStart"),transitioncancel:rs("Transition","TransitionCancel"),transitionend:rs("Transition","TransitionEnd")},qd={},qp={};ir&&(qp=document.createElement("div").style,"AnimationEvent"in window||(delete zs.animationend.animation,delete zs.animationiteration.animation,delete zs.animationstart.animation),"TransitionEvent"in window||delete zs.transitionend.transition);function ls(t){if(qd[t])return qd[t];if(!zs[t])return t;var n=zs[t],l;for(l in n)if(n.hasOwnProperty(l)&&l in qp)return qd[t]=n[l];return t}var Pp=ls("animationend"),Fp=ls("animationiteration"),Vp=ls("animationstart"),e1=ls("transitionrun"),t1=ls("transitionstart"),n1=ls("transitioncancel"),Yp=ls("transitionend"),Gp=new Map,Pd="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(" ");Pd.push("scrollEnd");function or(t,n){Gp.set(t,n),Rn(n,[t])}var vc=typeof reportError=="function"?reportError:function(t){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var n=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof t=="object"&&t!==null&&typeof t.message=="string"?String(t.message):String(t),error:t});if(!window.dispatchEvent(n))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",t);return}console.error(t)},Va=[],$s=0,Fd=0;function yc(){for(var t=$s,n=Fd=$s=0;n<t;){var l=Va[n];Va[n++]=null;var o=Va[n];Va[n++]=null;var f=Va[n];Va[n++]=null;var m=Va[n];if(Va[n++]=null,o!==null&&f!==null){var b=o.pending;b===null?f.next=f:(f.next=b.next,b.next=f),o.pending=f}m!==0&&Xp(l,f,m)}}function bc(t,n,l,o){Va[$s++]=t,Va[$s++]=n,Va[$s++]=l,Va[$s++]=o,Fd|=o,t.lanes|=o,t=t.alternate,t!==null&&(t.lanes|=o)}function Vd(t,n,l,o){return bc(t,n,l,o),wc(t)}function ss(t,n){return bc(t,null,null,n),wc(t)}function Xp(t,n,l){t.lanes|=l;var o=t.alternate;o!==null&&(o.lanes|=l);for(var f=!1,m=t.return;m!==null;)m.childLanes|=l,o=m.alternate,o!==null&&(o.childLanes|=l),m.tag===22&&(t=m.stateNode,t===null||t._visibility&1||(f=!0)),t=m,m=m.return;return t.tag===3?(m=t.stateNode,f&&n!==null&&(f=31-Jt(l),t=m.hiddenUpdates,o=t[f],o===null?t[f]=[n]:o.push(n),n.lane=l|536870912),m):null}function wc(t){if(50<io)throw io=0,th=null,Error(s(185));for(var n=t.return;n!==null;)t=n,n=t.return;return t.tag===3?t.stateNode:null}var Us={};function a1(t,n,l,o){this.tag=t,this.key=l,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=n,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=o,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Ma(t,n,l,o){return new a1(t,n,l,o)}function Yd(t){return t=t.prototype,!(!t||!t.isReactComponent)}function Pr(t,n){var l=t.alternate;return l===null?(l=Ma(t.tag,n,t.key,t.mode),l.elementType=t.elementType,l.type=t.type,l.stateNode=t.stateNode,l.alternate=t,t.alternate=l):(l.pendingProps=n,l.type=t.type,l.flags=0,l.subtreeFlags=0,l.deletions=null),l.flags=t.flags&65011712,l.childLanes=t.childLanes,l.lanes=t.lanes,l.child=t.child,l.memoizedProps=t.memoizedProps,l.memoizedState=t.memoizedState,l.updateQueue=t.updateQueue,n=t.dependencies,l.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext},l.sibling=t.sibling,l.index=t.index,l.ref=t.ref,l.refCleanup=t.refCleanup,l}function Qp(t,n){t.flags&=65011714;var l=t.alternate;return l===null?(t.childLanes=0,t.lanes=n,t.child=null,t.subtreeFlags=0,t.memoizedProps=null,t.memoizedState=null,t.updateQueue=null,t.dependencies=null,t.stateNode=null):(t.childLanes=l.childLanes,t.lanes=l.lanes,t.child=l.child,t.subtreeFlags=0,t.deletions=null,t.memoizedProps=l.memoizedProps,t.memoizedState=l.memoizedState,t.updateQueue=l.updateQueue,t.type=l.type,n=l.dependencies,t.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext}),t}function Sc(t,n,l,o,f,m){var b=0;if(o=t,typeof t=="function")Yd(t)&&(b=1);else if(typeof t=="string")b=oS(t,l,ue.current)?26:t==="html"||t==="head"||t==="body"?27:5;else e:switch(t){case re:return t=Ma(31,l,n,f),t.elementType=re,t.lanes=m,t;case j:return is(l.children,f,m,n);case R:b=8,f|=24;break;case M:return t=Ma(12,l,n,f|2),t.elementType=M,t.lanes=m,t;case ne:return t=Ma(13,l,n,f),t.elementType=ne,t.lanes=m,t;case ae:return t=Ma(19,l,n,f),t.elementType=ae,t.lanes=m,t;default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case B:b=10;break e;case $:b=9;break e;case Y:b=11;break e;case U:b=14;break e;case k:b=16,o=null;break e}b=29,l=Error(s(130,t===null?"null":typeof t,"")),o=null}return n=Ma(b,l,n,f),n.elementType=t,n.type=o,n.lanes=m,n}function is(t,n,l,o){return t=Ma(7,t,o,n),t.lanes=l,t}function Gd(t,n,l){return t=Ma(6,t,null,n),t.lanes=l,t}function Kp(t){var n=Ma(18,null,null,0);return n.stateNode=t,n}function Xd(t,n,l){return n=Ma(4,t.children!==null?t.children:[],t.key,n),n.lanes=l,n.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},n}var Zp=new WeakMap;function Ya(t,n){if(typeof t=="object"&&t!==null){var l=Zp.get(t);return l!==void 0?l:(n={value:t,source:n,stack:yn(n)},Zp.set(t,n),n)}return{value:t,source:n,stack:yn(n)}}var Bs=[],Is=0,Nc=null,Ii=0,Ga=[],Xa=0,gl=null,Nr=1,Er="";function Fr(t,n){Bs[Is++]=Ii,Bs[Is++]=Nc,Nc=t,Ii=n}function Wp(t,n,l){Ga[Xa++]=Nr,Ga[Xa++]=Er,Ga[Xa++]=gl,gl=t;var o=Nr;t=Er;var f=32-Jt(o)-1;o&=~(1<<f),l+=1;var m=32-Jt(n)+f;if(30<m){var b=f-f%5;m=(o&(1<<b)-1).toString(32),o>>=b,f-=b,Nr=1<<32-Jt(n)+f|l<<f|o,Er=m+t}else Nr=1<<m|l<<f|o,Er=t}function Qd(t){t.return!==null&&(Fr(t,1),Wp(t,1,0))}function Kd(t){for(;t===Nc;)Nc=Bs[--Is],Bs[Is]=null,Ii=Bs[--Is],Bs[Is]=null;for(;t===gl;)gl=Ga[--Xa],Ga[Xa]=null,Er=Ga[--Xa],Ga[Xa]=null,Nr=Ga[--Xa],Ga[Xa]=null}function Jp(t,n){Ga[Xa++]=Nr,Ga[Xa++]=Er,Ga[Xa++]=gl,Nr=n.id,Er=n.overflow,gl=t}var Jn=null,on=null,jt=!1,xl=null,Qa=!1,Zd=Error(s(519));function vl(t){var n=Error(s(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Hi(Ya(n,t)),Zd}function eg(t){var n=t.stateNode,l=t.type,o=t.memoizedProps;switch(n[be]=t,n[Ce]=o,l){case"dialog":vt("cancel",n),vt("close",n);break;case"iframe":case"object":case"embed":vt("load",n);break;case"video":case"audio":for(l=0;l<co.length;l++)vt(co[l],n);break;case"source":vt("error",n);break;case"img":case"image":case"link":vt("error",n),vt("load",n);break;case"details":vt("toggle",n);break;case"input":vt("invalid",n),Di(n,o.value,o.defaultValue,o.checked,o.defaultChecked,o.type,o.name,!0);break;case"select":vt("invalid",n);break;case"textarea":vt("invalid",n),sr(n,o.value,o.defaultValue,o.children)}l=o.children,typeof l!="string"&&typeof l!="number"&&typeof l!="bigint"||n.textContent===""+l||o.suppressHydrationWarning===!0||xv(n.textContent,l)?(o.popover!=null&&(vt("beforetoggle",n),vt("toggle",n)),o.onScroll!=null&&vt("scroll",n),o.onScrollEnd!=null&&vt("scrollend",n),o.onClick!=null&&(n.onclick=sa),n=!0):n=!1,n||vl(t,!0)}function tg(t){for(Jn=t.return;Jn;)switch(Jn.tag){case 5:case 31:case 13:Qa=!1;return;case 27:case 3:Qa=!0;return;default:Jn=Jn.return}}function Hs(t){if(t!==Jn)return!1;if(!jt)return tg(t),jt=!0,!1;var n=t.tag,l;if((l=n!==3&&n!==27)&&((l=n===5)&&(l=t.type,l=!(l!=="form"&&l!=="button")||gh(t.type,t.memoizedProps)),l=!l),l&&on&&vl(t),tg(t),n===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(s(317));on=Rv(t)}else if(n===31){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(s(317));on=Rv(t)}else n===27?(n=on,Ol(t.type)?(t=wh,wh=null,on=t):on=n):on=Jn?Za(t.stateNode.nextSibling):null;return!0}function os(){on=Jn=null,jt=!1}function Wd(){var t=xl;return t!==null&&(ja===null?ja=t:ja.push.apply(ja,t),xl=null),t}function Hi(t){xl===null?xl=[t]:xl.push(t)}var Jd=A(null),cs=null,Vr=null;function yl(t,n,l){K(Jd,n._currentValue),n._currentValue=l}function Yr(t){t._currentValue=Jd.current,I(Jd)}function ef(t,n,l){for(;t!==null;){var o=t.alternate;if((t.childLanes&n)!==n?(t.childLanes|=n,o!==null&&(o.childLanes|=n)):o!==null&&(o.childLanes&n)!==n&&(o.childLanes|=n),t===l)break;t=t.return}}function tf(t,n,l,o){var f=t.child;for(f!==null&&(f.return=t);f!==null;){var m=f.dependencies;if(m!==null){var b=f.child;m=m.firstContext;e:for(;m!==null;){var E=m;m=f;for(var C=0;C<n.length;C++)if(E.context===n[C]){m.lanes|=l,E=m.alternate,E!==null&&(E.lanes|=l),ef(m.return,l,t),o||(b=null);break e}m=E.next}}else if(f.tag===18){if(b=f.return,b===null)throw Error(s(341));b.lanes|=l,m=b.alternate,m!==null&&(m.lanes|=l),ef(b,l,t),b=null}else b=f.child;if(b!==null)b.return=f;else for(b=f;b!==null;){if(b===t){b=null;break}if(f=b.sibling,f!==null){f.return=b.return,b=f;break}b=b.return}f=b}}function qs(t,n,l,o){t=null;for(var f=n,m=!1;f!==null;){if(!m){if((f.flags&524288)!==0)m=!0;else if((f.flags&262144)!==0)break}if(f.tag===10){var b=f.alternate;if(b===null)throw Error(s(387));if(b=b.memoizedProps,b!==null){var E=f.type;Oa(f.pendingProps.value,b.value)||(t!==null?t.push(E):t=[E])}}else if(f===ke.current){if(b=f.alternate,b===null)throw Error(s(387));b.memoizedState.memoizedState!==f.memoizedState.memoizedState&&(t!==null?t.push(po):t=[po])}f=f.return}t!==null&&tf(n,t,l,o),n.flags|=262144}function Ec(t){for(t=t.firstContext;t!==null;){if(!Oa(t.context._currentValue,t.memoizedValue))return!0;t=t.next}return!1}function us(t){cs=t,Vr=null,t=t.dependencies,t!==null&&(t.firstContext=null)}function ea(t){return ng(cs,t)}function jc(t,n){return cs===null&&us(t),ng(t,n)}function ng(t,n){var l=n._currentValue;if(n={context:n,memoizedValue:l,next:null},Vr===null){if(t===null)throw Error(s(308));Vr=n,t.dependencies={lanes:0,firstContext:n},t.flags|=524288}else Vr=Vr.next=n;return l}var r1=typeof AbortController<"u"?AbortController:function(){var t=[],n=this.signal={aborted:!1,addEventListener:function(l,o){t.push(o)}};this.abort=function(){n.aborted=!0,t.forEach(function(l){return l()})}},l1=e.unstable_scheduleCallback,s1=e.unstable_NormalPriority,An={$$typeof:B,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function nf(){return{controller:new r1,data:new Map,refCount:0}}function qi(t){t.refCount--,t.refCount===0&&l1(s1,function(){t.controller.abort()})}var Pi=null,af=0,Ps=0,Fs=null;function i1(t,n){if(Pi===null){var l=Pi=[];af=0,Ps=ih(),Fs={status:"pending",value:void 0,then:function(o){l.push(o)}}}return af++,n.then(ag,ag),n}function ag(){if(--af===0&&Pi!==null){Fs!==null&&(Fs.status="fulfilled");var t=Pi;Pi=null,Ps=0,Fs=null;for(var n=0;n<t.length;n++)(0,t[n])()}}function o1(t,n){var l=[],o={status:"pending",value:null,reason:null,then:function(f){l.push(f)}};return t.then(function(){o.status="fulfilled",o.value=n;for(var f=0;f<l.length;f++)(0,l[f])(n)},function(f){for(o.status="rejected",o.reason=f,f=0;f<l.length;f++)(0,l[f])(void 0)}),o}var rg=L.S;L.S=function(t,n){Hx=rn(),typeof n=="object"&&n!==null&&typeof n.then=="function"&&i1(t,n),rg!==null&&rg(t,n)};var ds=A(null);function rf(){var t=ds.current;return t!==null?t:an.pooledCache}function Rc(t,n){n===null?K(ds,ds.current):K(ds,n.pool)}function lg(){var t=rf();return t===null?null:{parent:An._currentValue,pool:t}}var Vs=Error(s(460)),lf=Error(s(474)),kc=Error(s(542)),Tc={then:function(){}};function sg(t){return t=t.status,t==="fulfilled"||t==="rejected"}function ig(t,n,l){switch(l=t[l],l===void 0?t.push(n):l!==n&&(n.then(sa,sa),n=l),n.status){case"fulfilled":return n.value;case"rejected":throw t=n.reason,cg(t),t;default:if(typeof n.status=="string")n.then(sa,sa);else{if(t=an,t!==null&&100<t.shellSuspendCounter)throw Error(s(482));t=n,t.status="pending",t.then(function(o){if(n.status==="pending"){var f=n;f.status="fulfilled",f.value=o}},function(o){if(n.status==="pending"){var f=n;f.status="rejected",f.reason=o}})}switch(n.status){case"fulfilled":return n.value;case"rejected":throw t=n.reason,cg(t),t}throw hs=n,Vs}}function fs(t){try{var n=t._init;return n(t._payload)}catch(l){throw l!==null&&typeof l=="object"&&typeof l.then=="function"?(hs=l,Vs):l}}var hs=null;function og(){if(hs===null)throw Error(s(459));var t=hs;return hs=null,t}function cg(t){if(t===Vs||t===kc)throw Error(s(483))}var Ys=null,Fi=0;function Ac(t){var n=Fi;return Fi+=1,Ys===null&&(Ys=[]),ig(Ys,t,n)}function Vi(t,n){n=n.props.ref,t.ref=n!==void 0?n:null}function Dc(t,n){throw n.$$typeof===S?Error(s(525)):(t=Object.prototype.toString.call(n),Error(s(31,t==="[object Object]"?"object with keys {"+Object.keys(n).join(", ")+"}":t)))}function ug(t){function n(H,z){if(t){var V=H.deletions;V===null?(H.deletions=[z],H.flags|=16):V.push(z)}}function l(H,z){if(!t)return null;for(;z!==null;)n(H,z),z=z.sibling;return null}function o(H){for(var z=new Map;H!==null;)H.key!==null?z.set(H.key,H):z.set(H.index,H),H=H.sibling;return z}function f(H,z){return H=Pr(H,z),H.index=0,H.sibling=null,H}function m(H,z,V){return H.index=V,t?(V=H.alternate,V!==null?(V=V.index,V<z?(H.flags|=67108866,z):V):(H.flags|=67108866,z)):(H.flags|=1048576,z)}function b(H){return t&&H.alternate===null&&(H.flags|=67108866),H}function E(H,z,V,le){return z===null||z.tag!==6?(z=Gd(V,H.mode,le),z.return=H,z):(z=f(z,V),z.return=H,z)}function C(H,z,V,le){var He=V.type;return He===j?te(H,z,V.props.children,le,V.key):z!==null&&(z.elementType===He||typeof He=="object"&&He!==null&&He.$$typeof===k&&fs(He)===z.type)?(z=f(z,V.props),Vi(z,V),z.return=H,z):(z=Sc(V.type,V.key,V.props,null,H.mode,le),Vi(z,V),z.return=H,z)}function G(H,z,V,le){return z===null||z.tag!==4||z.stateNode.containerInfo!==V.containerInfo||z.stateNode.implementation!==V.implementation?(z=Xd(V,H.mode,le),z.return=H,z):(z=f(z,V.children||[]),z.return=H,z)}function te(H,z,V,le,He){return z===null||z.tag!==7?(z=is(V,H.mode,le,He),z.return=H,z):(z=f(z,V),z.return=H,z)}function oe(H,z,V){if(typeof z=="string"&&z!==""||typeof z=="number"||typeof z=="bigint")return z=Gd(""+z,H.mode,V),z.return=H,z;if(typeof z=="object"&&z!==null){switch(z.$$typeof){case N:return V=Sc(z.type,z.key,z.props,null,H.mode,V),Vi(V,z),V.return=H,V;case w:return z=Xd(z,H.mode,V),z.return=H,z;case k:return z=fs(z),oe(H,z,V)}if(W(z)||ye(z))return z=is(z,H.mode,V,null),z.return=H,z;if(typeof z.then=="function")return oe(H,Ac(z),V);if(z.$$typeof===B)return oe(H,jc(H,z),V);Dc(H,z)}return null}function Q(H,z,V,le){var He=z!==null?z.key:null;if(typeof V=="string"&&V!==""||typeof V=="number"||typeof V=="bigint")return He!==null?null:E(H,z,""+V,le);if(typeof V=="object"&&V!==null){switch(V.$$typeof){case N:return V.key===He?C(H,z,V,le):null;case w:return V.key===He?G(H,z,V,le):null;case k:return V=fs(V),Q(H,z,V,le)}if(W(V)||ye(V))return He!==null?null:te(H,z,V,le,null);if(typeof V.then=="function")return Q(H,z,Ac(V),le);if(V.$$typeof===B)return Q(H,z,jc(H,V),le);Dc(H,V)}return null}function Z(H,z,V,le,He){if(typeof le=="string"&&le!==""||typeof le=="number"||typeof le=="bigint")return H=H.get(V)||null,E(z,H,""+le,He);if(typeof le=="object"&&le!==null){switch(le.$$typeof){case N:return H=H.get(le.key===null?V:le.key)||null,C(z,H,le,He);case w:return H=H.get(le.key===null?V:le.key)||null,G(z,H,le,He);case k:return le=fs(le),Z(H,z,V,le,He)}if(W(le)||ye(le))return H=H.get(V)||null,te(z,H,le,He,null);if(typeof le.then=="function")return Z(H,z,V,Ac(le),He);if(le.$$typeof===B)return Z(H,z,V,jc(z,le),He);Dc(z,le)}return null}function Me(H,z,V,le){for(var He=null,Mt=null,ze=z,ft=z=0,Nt=null;ze!==null&&ft<V.length;ft++){ze.index>ft?(Nt=ze,ze=null):Nt=ze.sibling;var _t=Q(H,ze,V[ft],le);if(_t===null){ze===null&&(ze=Nt);break}t&&ze&&_t.alternate===null&&n(H,ze),z=m(_t,z,ft),Mt===null?He=_t:Mt.sibling=_t,Mt=_t,ze=Nt}if(ft===V.length)return l(H,ze),jt&&Fr(H,ft),He;if(ze===null){for(;ft<V.length;ft++)ze=oe(H,V[ft],le),ze!==null&&(z=m(ze,z,ft),Mt===null?He=ze:Mt.sibling=ze,Mt=ze);return jt&&Fr(H,ft),He}for(ze=o(ze);ft<V.length;ft++)Nt=Z(ze,H,ft,V[ft],le),Nt!==null&&(t&&Nt.alternate!==null&&ze.delete(Nt.key===null?ft:Nt.key),z=m(Nt,z,ft),Mt===null?He=Nt:Mt.sibling=Nt,Mt=Nt);return t&&ze.forEach(function($l){return n(H,$l)}),jt&&Fr(H,ft),He}function Ye(H,z,V,le){if(V==null)throw Error(s(151));for(var He=null,Mt=null,ze=z,ft=z=0,Nt=null,_t=V.next();ze!==null&&!_t.done;ft++,_t=V.next()){ze.index>ft?(Nt=ze,ze=null):Nt=ze.sibling;var $l=Q(H,ze,_t.value,le);if($l===null){ze===null&&(ze=Nt);break}t&&ze&&$l.alternate===null&&n(H,ze),z=m($l,z,ft),Mt===null?He=$l:Mt.sibling=$l,Mt=$l,ze=Nt}if(_t.done)return l(H,ze),jt&&Fr(H,ft),He;if(ze===null){for(;!_t.done;ft++,_t=V.next())_t=oe(H,_t.value,le),_t!==null&&(z=m(_t,z,ft),Mt===null?He=_t:Mt.sibling=_t,Mt=_t);return jt&&Fr(H,ft),He}for(ze=o(ze);!_t.done;ft++,_t=V.next())_t=Z(ze,H,ft,_t.value,le),_t!==null&&(t&&_t.alternate!==null&&ze.delete(_t.key===null?ft:_t.key),z=m(_t,z,ft),Mt===null?He=_t:Mt.sibling=_t,Mt=_t);return t&&ze.forEach(function(yS){return n(H,yS)}),jt&&Fr(H,ft),He}function Kt(H,z,V,le){if(typeof V=="object"&&V!==null&&V.type===j&&V.key===null&&(V=V.props.children),typeof V=="object"&&V!==null){switch(V.$$typeof){case N:e:{for(var He=V.key;z!==null;){if(z.key===He){if(He=V.type,He===j){if(z.tag===7){l(H,z.sibling),le=f(z,V.props.children),le.return=H,H=le;break e}}else if(z.elementType===He||typeof He=="object"&&He!==null&&He.$$typeof===k&&fs(He)===z.type){l(H,z.sibling),le=f(z,V.props),Vi(le,V),le.return=H,H=le;break e}l(H,z);break}else n(H,z);z=z.sibling}V.type===j?(le=is(V.props.children,H.mode,le,V.key),le.return=H,H=le):(le=Sc(V.type,V.key,V.props,null,H.mode,le),Vi(le,V),le.return=H,H=le)}return b(H);case w:e:{for(He=V.key;z!==null;){if(z.key===He)if(z.tag===4&&z.stateNode.containerInfo===V.containerInfo&&z.stateNode.implementation===V.implementation){l(H,z.sibling),le=f(z,V.children||[]),le.return=H,H=le;break e}else{l(H,z);break}else n(H,z);z=z.sibling}le=Xd(V,H.mode,le),le.return=H,H=le}return b(H);case k:return V=fs(V),Kt(H,z,V,le)}if(W(V))return Me(H,z,V,le);if(ye(V)){if(He=ye(V),typeof He!="function")throw Error(s(150));return V=He.call(V),Ye(H,z,V,le)}if(typeof V.then=="function")return Kt(H,z,Ac(V),le);if(V.$$typeof===B)return Kt(H,z,jc(H,V),le);Dc(H,V)}return typeof V=="string"&&V!==""||typeof V=="number"||typeof V=="bigint"?(V=""+V,z!==null&&z.tag===6?(l(H,z.sibling),le=f(z,V),le.return=H,H=le):(l(H,z),le=Gd(V,H.mode,le),le.return=H,H=le),b(H)):l(H,z)}return function(H,z,V,le){try{Fi=0;var He=Kt(H,z,V,le);return Ys=null,He}catch(ze){if(ze===Vs||ze===kc)throw ze;var Mt=Ma(29,ze,null,H.mode);return Mt.lanes=le,Mt.return=H,Mt}finally{}}}var ms=ug(!0),dg=ug(!1),bl=!1;function sf(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function of(t,n){t=t.updateQueue,n.updateQueue===t&&(n.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,callbacks:null})}function wl(t){return{lane:t,tag:0,payload:null,callback:null,next:null}}function Sl(t,n,l){var o=t.updateQueue;if(o===null)return null;if(o=o.shared,(Lt&2)!==0){var f=o.pending;return f===null?n.next=n:(n.next=f.next,f.next=n),o.pending=n,n=wc(t),Xp(t,null,l),n}return bc(t,o,n,l),wc(t)}function Yi(t,n,l){if(n=n.updateQueue,n!==null&&(n=n.shared,(l&4194048)!==0)){var o=n.lanes;o&=t.pendingLanes,l|=o,n.lanes=l,Ln(t,l)}}function cf(t,n){var l=t.updateQueue,o=t.alternate;if(o!==null&&(o=o.updateQueue,l===o)){var f=null,m=null;if(l=l.firstBaseUpdate,l!==null){do{var b={lane:l.lane,tag:l.tag,payload:l.payload,callback:null,next:null};m===null?f=m=b:m=m.next=b,l=l.next}while(l!==null);m===null?f=m=n:m=m.next=n}else f=m=n;l={baseState:o.baseState,firstBaseUpdate:f,lastBaseUpdate:m,shared:o.shared,callbacks:o.callbacks},t.updateQueue=l;return}t=l.lastBaseUpdate,t===null?l.firstBaseUpdate=n:t.next=n,l.lastBaseUpdate=n}var uf=!1;function Gi(){if(uf){var t=Fs;if(t!==null)throw t}}function Xi(t,n,l,o){uf=!1;var f=t.updateQueue;bl=!1;var m=f.firstBaseUpdate,b=f.lastBaseUpdate,E=f.shared.pending;if(E!==null){f.shared.pending=null;var C=E,G=C.next;C.next=null,b===null?m=G:b.next=G,b=C;var te=t.alternate;te!==null&&(te=te.updateQueue,E=te.lastBaseUpdate,E!==b&&(E===null?te.firstBaseUpdate=G:E.next=G,te.lastBaseUpdate=C))}if(m!==null){var oe=f.baseState;b=0,te=G=C=null,E=m;do{var Q=E.lane&-536870913,Z=Q!==E.lane;if(Z?(St&Q)===Q:(o&Q)===Q){Q!==0&&Q===Ps&&(uf=!0),te!==null&&(te=te.next={lane:0,tag:E.tag,payload:E.payload,callback:null,next:null});e:{var Me=t,Ye=E;Q=n;var Kt=l;switch(Ye.tag){case 1:if(Me=Ye.payload,typeof Me=="function"){oe=Me.call(Kt,oe,Q);break e}oe=Me;break e;case 3:Me.flags=Me.flags&-65537|128;case 0:if(Me=Ye.payload,Q=typeof Me=="function"?Me.call(Kt,oe,Q):Me,Q==null)break e;oe=y({},oe,Q);break e;case 2:bl=!0}}Q=E.callback,Q!==null&&(t.flags|=64,Z&&(t.flags|=8192),Z=f.callbacks,Z===null?f.callbacks=[Q]:Z.push(Q))}else Z={lane:Q,tag:E.tag,payload:E.payload,callback:E.callback,next:null},te===null?(G=te=Z,C=oe):te=te.next=Z,b|=Q;if(E=E.next,E===null){if(E=f.shared.pending,E===null)break;Z=E,E=Z.next,Z.next=null,f.lastBaseUpdate=Z,f.shared.pending=null}}while(!0);te===null&&(C=oe),f.baseState=C,f.firstBaseUpdate=G,f.lastBaseUpdate=te,m===null&&(f.shared.lanes=0),kl|=b,t.lanes=b,t.memoizedState=oe}}function fg(t,n){if(typeof t!="function")throw Error(s(191,t));t.call(n)}function hg(t,n){var l=t.callbacks;if(l!==null)for(t.callbacks=null,t=0;t<l.length;t++)fg(l[t],n)}var Gs=A(null),Cc=A(0);function mg(t,n){t=tl,K(Cc,t),K(Gs,n),tl=t|n.baseLanes}function df(){K(Cc,tl),K(Gs,Gs.current)}function ff(){tl=Cc.current,I(Gs),I(Cc)}var _a=A(null),Ka=null;function Nl(t){var n=t.alternate;K(wn,wn.current&1),K(_a,t),Ka===null&&(n===null||Gs.current!==null||n.memoizedState!==null)&&(Ka=t)}function hf(t){K(wn,wn.current),K(_a,t),Ka===null&&(Ka=t)}function pg(t){t.tag===22?(K(wn,wn.current),K(_a,t),Ka===null&&(Ka=t)):El()}function El(){K(wn,wn.current),K(_a,_a.current)}function La(t){I(_a),Ka===t&&(Ka=null),I(wn)}var wn=A(0);function Oc(t){for(var n=t;n!==null;){if(n.tag===13){var l=n.memoizedState;if(l!==null&&(l=l.dehydrated,l===null||yh(l)||bh(l)))return n}else if(n.tag===19&&(n.memoizedProps.revealOrder==="forwards"||n.memoizedProps.revealOrder==="backwards"||n.memoizedProps.revealOrder==="unstable_legacy-backwards"||n.memoizedProps.revealOrder==="together")){if((n.flags&128)!==0)return n}else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return null;n=n.return}n.sibling.return=n.return,n=n.sibling}return null}var Gr=0,ct=null,Xt=null,Dn=null,Mc=!1,Xs=!1,ps=!1,_c=0,Qi=0,Qs=null,c1=0;function gn(){throw Error(s(321))}function mf(t,n){if(n===null)return!1;for(var l=0;l<n.length&&l<t.length;l++)if(!Oa(t[l],n[l]))return!1;return!0}function pf(t,n,l,o,f,m){return Gr=m,ct=n,n.memoizedState=null,n.updateQueue=null,n.lanes=0,L.H=t===null||t.memoizedState===null?Wg:Df,ps=!1,m=l(o,f),ps=!1,Xs&&(m=xg(n,l,o,f)),gg(t),m}function gg(t){L.H=Wi;var n=Xt!==null&&Xt.next!==null;if(Gr=0,Dn=Xt=ct=null,Mc=!1,Qi=0,Qs=null,n)throw Error(s(300));t===null||Cn||(t=t.dependencies,t!==null&&Ec(t)&&(Cn=!0))}function xg(t,n,l,o){ct=t;var f=0;do{if(Xs&&(Qs=null),Qi=0,Xs=!1,25<=f)throw Error(s(301));if(f+=1,Dn=Xt=null,t.updateQueue!=null){var m=t.updateQueue;m.lastEffect=null,m.events=null,m.stores=null,m.memoCache!=null&&(m.memoCache.index=0)}L.H=Jg,m=n(l,o)}while(Xs);return m}function u1(){var t=L.H,n=t.useState()[0];return n=typeof n.then=="function"?Ki(n):n,t=t.useState()[0],(Xt!==null?Xt.memoizedState:null)!==t&&(ct.flags|=1024),n}function gf(){var t=_c!==0;return _c=0,t}function xf(t,n,l){n.updateQueue=t.updateQueue,n.flags&=-2053,t.lanes&=~l}function vf(t){if(Mc){for(t=t.memoizedState;t!==null;){var n=t.queue;n!==null&&(n.pending=null),t=t.next}Mc=!1}Gr=0,Dn=Xt=ct=null,Xs=!1,Qi=_c=0,Qs=null}function pa(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Dn===null?ct.memoizedState=Dn=t:Dn=Dn.next=t,Dn}function Sn(){if(Xt===null){var t=ct.alternate;t=t!==null?t.memoizedState:null}else t=Xt.next;var n=Dn===null?ct.memoizedState:Dn.next;if(n!==null)Dn=n,Xt=t;else{if(t===null)throw ct.alternate===null?Error(s(467)):Error(s(310));Xt=t,t={memoizedState:Xt.memoizedState,baseState:Xt.baseState,baseQueue:Xt.baseQueue,queue:Xt.queue,next:null},Dn===null?ct.memoizedState=Dn=t:Dn=Dn.next=t}return Dn}function Lc(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Ki(t){var n=Qi;return Qi+=1,Qs===null&&(Qs=[]),t=ig(Qs,t,n),n=ct,(Dn===null?n.memoizedState:Dn.next)===null&&(n=n.alternate,L.H=n===null||n.memoizedState===null?Wg:Df),t}function zc(t){if(t!==null&&typeof t=="object"){if(typeof t.then=="function")return Ki(t);if(t.$$typeof===B)return ea(t)}throw Error(s(438,String(t)))}function yf(t){var n=null,l=ct.updateQueue;if(l!==null&&(n=l.memoCache),n==null){var o=ct.alternate;o!==null&&(o=o.updateQueue,o!==null&&(o=o.memoCache,o!=null&&(n={data:o.data.map(function(f){return f.slice()}),index:0})))}if(n==null&&(n={data:[],index:0}),l===null&&(l=Lc(),ct.updateQueue=l),l.memoCache=n,l=n.data[n.index],l===void 0)for(l=n.data[n.index]=Array(t),o=0;o<t;o++)l[o]=pe;return n.index++,l}function Xr(t,n){return typeof n=="function"?n(t):n}function $c(t){var n=Sn();return bf(n,Xt,t)}function bf(t,n,l){var o=t.queue;if(o===null)throw Error(s(311));o.lastRenderedReducer=l;var f=t.baseQueue,m=o.pending;if(m!==null){if(f!==null){var b=f.next;f.next=m.next,m.next=b}n.baseQueue=f=m,o.pending=null}if(m=t.baseState,f===null)t.memoizedState=m;else{n=f.next;var E=b=null,C=null,G=n,te=!1;do{var oe=G.lane&-536870913;if(oe!==G.lane?(St&oe)===oe:(Gr&oe)===oe){var Q=G.revertLane;if(Q===0)C!==null&&(C=C.next={lane:0,revertLane:0,gesture:null,action:G.action,hasEagerState:G.hasEagerState,eagerState:G.eagerState,next:null}),oe===Ps&&(te=!0);else if((Gr&Q)===Q){G=G.next,Q===Ps&&(te=!0);continue}else oe={lane:0,revertLane:G.revertLane,gesture:null,action:G.action,hasEagerState:G.hasEagerState,eagerState:G.eagerState,next:null},C===null?(E=C=oe,b=m):C=C.next=oe,ct.lanes|=Q,kl|=Q;oe=G.action,ps&&l(m,oe),m=G.hasEagerState?G.eagerState:l(m,oe)}else Q={lane:oe,revertLane:G.revertLane,gesture:G.gesture,action:G.action,hasEagerState:G.hasEagerState,eagerState:G.eagerState,next:null},C===null?(E=C=Q,b=m):C=C.next=Q,ct.lanes|=oe,kl|=oe;G=G.next}while(G!==null&&G!==n);if(C===null?b=m:C.next=E,!Oa(m,t.memoizedState)&&(Cn=!0,te&&(l=Fs,l!==null)))throw l;t.memoizedState=m,t.baseState=b,t.baseQueue=C,o.lastRenderedState=m}return f===null&&(o.lanes=0),[t.memoizedState,o.dispatch]}function wf(t){var n=Sn(),l=n.queue;if(l===null)throw Error(s(311));l.lastRenderedReducer=t;var o=l.dispatch,f=l.pending,m=n.memoizedState;if(f!==null){l.pending=null;var b=f=f.next;do m=t(m,b.action),b=b.next;while(b!==f);Oa(m,n.memoizedState)||(Cn=!0),n.memoizedState=m,n.baseQueue===null&&(n.baseState=m),l.lastRenderedState=m}return[m,o]}function vg(t,n,l){var o=ct,f=Sn(),m=jt;if(m){if(l===void 0)throw Error(s(407));l=l()}else l=n();var b=!Oa((Xt||f).memoizedState,l);if(b&&(f.memoizedState=l,Cn=!0),f=f.queue,Ef(wg.bind(null,o,f,t),[t]),f.getSnapshot!==n||b||Dn!==null&&Dn.memoizedState.tag&1){if(o.flags|=2048,Ks(9,{destroy:void 0},bg.bind(null,o,f,l,n),null),an===null)throw Error(s(349));m||(Gr&127)!==0||yg(o,n,l)}return l}function yg(t,n,l){t.flags|=16384,t={getSnapshot:n,value:l},n=ct.updateQueue,n===null?(n=Lc(),ct.updateQueue=n,n.stores=[t]):(l=n.stores,l===null?n.stores=[t]:l.push(t))}function bg(t,n,l,o){n.value=l,n.getSnapshot=o,Sg(n)&&Ng(t)}function wg(t,n,l){return l(function(){Sg(n)&&Ng(t)})}function Sg(t){var n=t.getSnapshot;t=t.value;try{var l=n();return!Oa(t,l)}catch{return!0}}function Ng(t){var n=ss(t,2);n!==null&&Ra(n,t,2)}function Sf(t){var n=pa();if(typeof t=="function"){var l=t;if(t=l(),ps){Dt(!0);try{l()}finally{Dt(!1)}}}return n.memoizedState=n.baseState=t,n.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Xr,lastRenderedState:t},n}function Eg(t,n,l,o){return t.baseState=l,bf(t,Xt,typeof o=="function"?o:Xr)}function d1(t,n,l,o,f){if(Ic(t))throw Error(s(485));if(t=n.action,t!==null){var m={payload:f,action:t,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(b){m.listeners.push(b)}};L.T!==null?l(!0):m.isTransition=!1,o(m),l=n.pending,l===null?(m.next=n.pending=m,jg(n,m)):(m.next=l.next,n.pending=l.next=m)}}function jg(t,n){var l=n.action,o=n.payload,f=t.state;if(n.isTransition){var m=L.T,b={};L.T=b;try{var E=l(f,o),C=L.S;C!==null&&C(b,E),Rg(t,n,E)}catch(G){Nf(t,n,G)}finally{m!==null&&b.types!==null&&(m.types=b.types),L.T=m}}else try{m=l(f,o),Rg(t,n,m)}catch(G){Nf(t,n,G)}}function Rg(t,n,l){l!==null&&typeof l=="object"&&typeof l.then=="function"?l.then(function(o){kg(t,n,o)},function(o){return Nf(t,n,o)}):kg(t,n,l)}function kg(t,n,l){n.status="fulfilled",n.value=l,Tg(n),t.state=l,n=t.pending,n!==null&&(l=n.next,l===n?t.pending=null:(l=l.next,n.next=l,jg(t,l)))}function Nf(t,n,l){var o=t.pending;if(t.pending=null,o!==null){o=o.next;do n.status="rejected",n.reason=l,Tg(n),n=n.next;while(n!==o)}t.action=null}function Tg(t){t=t.listeners;for(var n=0;n<t.length;n++)(0,t[n])()}function Ag(t,n){return n}function Dg(t,n){if(jt){var l=an.formState;if(l!==null){e:{var o=ct;if(jt){if(on){t:{for(var f=on,m=Qa;f.nodeType!==8;){if(!m){f=null;break t}if(f=Za(f.nextSibling),f===null){f=null;break t}}m=f.data,f=m==="F!"||m==="F"?f:null}if(f){on=Za(f.nextSibling),o=f.data==="F!";break e}}vl(o)}o=!1}o&&(n=l[0])}}return l=pa(),l.memoizedState=l.baseState=n,o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ag,lastRenderedState:n},l.queue=o,l=Qg.bind(null,ct,o),o.dispatch=l,o=Sf(!1),m=Af.bind(null,ct,!1,o.queue),o=pa(),f={state:n,dispatch:null,action:t,pending:null},o.queue=f,l=d1.bind(null,ct,f,m,l),f.dispatch=l,o.memoizedState=t,[n,l,!1]}function Cg(t){var n=Sn();return Og(n,Xt,t)}function Og(t,n,l){if(n=bf(t,n,Ag)[0],t=$c(Xr)[0],typeof n=="object"&&n!==null&&typeof n.then=="function")try{var o=Ki(n)}catch(b){throw b===Vs?kc:b}else o=n;n=Sn();var f=n.queue,m=f.dispatch;return l!==n.memoizedState&&(ct.flags|=2048,Ks(9,{destroy:void 0},f1.bind(null,f,l),null)),[o,m,t]}function f1(t,n){t.action=n}function Mg(t){var n=Sn(),l=Xt;if(l!==null)return Og(n,l,t);Sn(),n=n.memoizedState,l=Sn();var o=l.queue.dispatch;return l.memoizedState=t,[n,o,!1]}function Ks(t,n,l,o){return t={tag:t,create:l,deps:o,inst:n,next:null},n=ct.updateQueue,n===null&&(n=Lc(),ct.updateQueue=n),l=n.lastEffect,l===null?n.lastEffect=t.next=t:(o=l.next,l.next=t,t.next=o,n.lastEffect=t),t}function _g(){return Sn().memoizedState}function Uc(t,n,l,o){var f=pa();ct.flags|=t,f.memoizedState=Ks(1|n,{destroy:void 0},l,o===void 0?null:o)}function Bc(t,n,l,o){var f=Sn();o=o===void 0?null:o;var m=f.memoizedState.inst;Xt!==null&&o!==null&&mf(o,Xt.memoizedState.deps)?f.memoizedState=Ks(n,m,l,o):(ct.flags|=t,f.memoizedState=Ks(1|n,m,l,o))}function Lg(t,n){Uc(8390656,8,t,n)}function Ef(t,n){Bc(2048,8,t,n)}function h1(t){ct.flags|=4;var n=ct.updateQueue;if(n===null)n=Lc(),ct.updateQueue=n,n.events=[t];else{var l=n.events;l===null?n.events=[t]:l.push(t)}}function zg(t){var n=Sn().memoizedState;return h1({ref:n,nextImpl:t}),function(){if((Lt&2)!==0)throw Error(s(440));return n.impl.apply(void 0,arguments)}}function $g(t,n){return Bc(4,2,t,n)}function Ug(t,n){return Bc(4,4,t,n)}function Bg(t,n){if(typeof n=="function"){t=t();var l=n(t);return function(){typeof l=="function"?l():n(null)}}if(n!=null)return t=t(),n.current=t,function(){n.current=null}}function Ig(t,n,l){l=l!=null?l.concat([t]):null,Bc(4,4,Bg.bind(null,n,t),l)}function jf(){}function Hg(t,n){var l=Sn();n=n===void 0?null:n;var o=l.memoizedState;return n!==null&&mf(n,o[1])?o[0]:(l.memoizedState=[t,n],t)}function qg(t,n){var l=Sn();n=n===void 0?null:n;var o=l.memoizedState;if(n!==null&&mf(n,o[1]))return o[0];if(o=t(),ps){Dt(!0);try{t()}finally{Dt(!1)}}return l.memoizedState=[o,n],o}function Rf(t,n,l){return l===void 0||(Gr&1073741824)!==0&&(St&261930)===0?t.memoizedState=n:(t.memoizedState=l,t=Px(),ct.lanes|=t,kl|=t,l)}function Pg(t,n,l,o){return Oa(l,n)?l:Gs.current!==null?(t=Rf(t,l,o),Oa(t,n)||(Cn=!0),t):(Gr&42)===0||(Gr&1073741824)!==0&&(St&261930)===0?(Cn=!0,t.memoizedState=l):(t=Px(),ct.lanes|=t,kl|=t,n)}function Fg(t,n,l,o,f){var m=F.p;F.p=m!==0&&8>m?m:8;var b=L.T,E={};L.T=E,Af(t,!1,n,l);try{var C=f(),G=L.S;if(G!==null&&G(E,C),C!==null&&typeof C=="object"&&typeof C.then=="function"){var te=o1(C,o);Zi(t,n,te,Ua(t))}else Zi(t,n,o,Ua(t))}catch(oe){Zi(t,n,{then:function(){},status:"rejected",reason:oe},Ua())}finally{F.p=m,b!==null&&E.types!==null&&(b.types=E.types),L.T=b}}function m1(){}function kf(t,n,l,o){if(t.tag!==5)throw Error(s(476));var f=Vg(t).queue;Fg(t,f,n,fe,l===null?m1:function(){return Yg(t),l(o)})}function Vg(t){var n=t.memoizedState;if(n!==null)return n;n={memoizedState:fe,baseState:fe,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Xr,lastRenderedState:fe},next:null};var l={};return n.next={memoizedState:l,baseState:l,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Xr,lastRenderedState:l},next:null},t.memoizedState=n,t=t.alternate,t!==null&&(t.memoizedState=n),n}function Yg(t){var n=Vg(t);n.next===null&&(n=t.alternate.memoizedState),Zi(t,n.next.queue,{},Ua())}function Tf(){return ea(po)}function Gg(){return Sn().memoizedState}function Xg(){return Sn().memoizedState}function p1(t){for(var n=t.return;n!==null;){switch(n.tag){case 24:case 3:var l=Ua();t=wl(l);var o=Sl(n,t,l);o!==null&&(Ra(o,n,l),Yi(o,n,l)),n={cache:nf()},t.payload=n;return}n=n.return}}function g1(t,n,l){var o=Ua();l={lane:o,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},Ic(t)?Kg(n,l):(l=Vd(t,n,l,o),l!==null&&(Ra(l,t,o),Zg(l,n,o)))}function Qg(t,n,l){var o=Ua();Zi(t,n,l,o)}function Zi(t,n,l,o){var f={lane:o,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null};if(Ic(t))Kg(n,f);else{var m=t.alternate;if(t.lanes===0&&(m===null||m.lanes===0)&&(m=n.lastRenderedReducer,m!==null))try{var b=n.lastRenderedState,E=m(b,l);if(f.hasEagerState=!0,f.eagerState=E,Oa(E,b))return bc(t,n,f,0),an===null&&yc(),!1}catch{}finally{}if(l=Vd(t,n,f,o),l!==null)return Ra(l,t,o),Zg(l,n,o),!0}return!1}function Af(t,n,l,o){if(o={lane:2,revertLane:ih(),gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null},Ic(t)){if(n)throw Error(s(479))}else n=Vd(t,l,o,2),n!==null&&Ra(n,t,2)}function Ic(t){var n=t.alternate;return t===ct||n!==null&&n===ct}function Kg(t,n){Xs=Mc=!0;var l=t.pending;l===null?n.next=n:(n.next=l.next,l.next=n),t.pending=n}function Zg(t,n,l){if((l&4194048)!==0){var o=n.lanes;o&=t.pendingLanes,l|=o,n.lanes=l,Ln(t,l)}}var Wi={readContext:ea,use:zc,useCallback:gn,useContext:gn,useEffect:gn,useImperativeHandle:gn,useLayoutEffect:gn,useInsertionEffect:gn,useMemo:gn,useReducer:gn,useRef:gn,useState:gn,useDebugValue:gn,useDeferredValue:gn,useTransition:gn,useSyncExternalStore:gn,useId:gn,useHostTransitionStatus:gn,useFormState:gn,useActionState:gn,useOptimistic:gn,useMemoCache:gn,useCacheRefresh:gn};Wi.useEffectEvent=gn;var Wg={readContext:ea,use:zc,useCallback:function(t,n){return pa().memoizedState=[t,n===void 0?null:n],t},useContext:ea,useEffect:Lg,useImperativeHandle:function(t,n,l){l=l!=null?l.concat([t]):null,Uc(4194308,4,Bg.bind(null,n,t),l)},useLayoutEffect:function(t,n){return Uc(4194308,4,t,n)},useInsertionEffect:function(t,n){Uc(4,2,t,n)},useMemo:function(t,n){var l=pa();n=n===void 0?null:n;var o=t();if(ps){Dt(!0);try{t()}finally{Dt(!1)}}return l.memoizedState=[o,n],o},useReducer:function(t,n,l){var o=pa();if(l!==void 0){var f=l(n);if(ps){Dt(!0);try{l(n)}finally{Dt(!1)}}}else f=n;return o.memoizedState=o.baseState=f,t={pending:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:f},o.queue=t,t=t.dispatch=g1.bind(null,ct,t),[o.memoizedState,t]},useRef:function(t){var n=pa();return t={current:t},n.memoizedState=t},useState:function(t){t=Sf(t);var n=t.queue,l=Qg.bind(null,ct,n);return n.dispatch=l,[t.memoizedState,l]},useDebugValue:jf,useDeferredValue:function(t,n){var l=pa();return Rf(l,t,n)},useTransition:function(){var t=Sf(!1);return t=Fg.bind(null,ct,t.queue,!0,!1),pa().memoizedState=t,[!1,t]},useSyncExternalStore:function(t,n,l){var o=ct,f=pa();if(jt){if(l===void 0)throw Error(s(407));l=l()}else{if(l=n(),an===null)throw Error(s(349));(St&127)!==0||yg(o,n,l)}f.memoizedState=l;var m={value:l,getSnapshot:n};return f.queue=m,Lg(wg.bind(null,o,m,t),[t]),o.flags|=2048,Ks(9,{destroy:void 0},bg.bind(null,o,m,l,n),null),l},useId:function(){var t=pa(),n=an.identifierPrefix;if(jt){var l=Er,o=Nr;l=(o&~(1<<32-Jt(o)-1)).toString(32)+l,n="_"+n+"R_"+l,l=_c++,0<l&&(n+="H"+l.toString(32)),n+="_"}else l=c1++,n="_"+n+"r_"+l.toString(32)+"_";return t.memoizedState=n},useHostTransitionStatus:Tf,useFormState:Dg,useActionState:Dg,useOptimistic:function(t){var n=pa();n.memoizedState=n.baseState=t;var l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return n.queue=l,n=Af.bind(null,ct,!0,l),l.dispatch=n,[t,n]},useMemoCache:yf,useCacheRefresh:function(){return pa().memoizedState=p1.bind(null,ct)},useEffectEvent:function(t){var n=pa(),l={impl:t};return n.memoizedState=l,function(){if((Lt&2)!==0)throw Error(s(440));return l.impl.apply(void 0,arguments)}}},Df={readContext:ea,use:zc,useCallback:Hg,useContext:ea,useEffect:Ef,useImperativeHandle:Ig,useInsertionEffect:$g,useLayoutEffect:Ug,useMemo:qg,useReducer:$c,useRef:_g,useState:function(){return $c(Xr)},useDebugValue:jf,useDeferredValue:function(t,n){var l=Sn();return Pg(l,Xt.memoizedState,t,n)},useTransition:function(){var t=$c(Xr)[0],n=Sn().memoizedState;return[typeof t=="boolean"?t:Ki(t),n]},useSyncExternalStore:vg,useId:Gg,useHostTransitionStatus:Tf,useFormState:Cg,useActionState:Cg,useOptimistic:function(t,n){var l=Sn();return Eg(l,Xt,t,n)},useMemoCache:yf,useCacheRefresh:Xg};Df.useEffectEvent=zg;var Jg={readContext:ea,use:zc,useCallback:Hg,useContext:ea,useEffect:Ef,useImperativeHandle:Ig,useInsertionEffect:$g,useLayoutEffect:Ug,useMemo:qg,useReducer:wf,useRef:_g,useState:function(){return wf(Xr)},useDebugValue:jf,useDeferredValue:function(t,n){var l=Sn();return Xt===null?Rf(l,t,n):Pg(l,Xt.memoizedState,t,n)},useTransition:function(){var t=wf(Xr)[0],n=Sn().memoizedState;return[typeof t=="boolean"?t:Ki(t),n]},useSyncExternalStore:vg,useId:Gg,useHostTransitionStatus:Tf,useFormState:Mg,useActionState:Mg,useOptimistic:function(t,n){var l=Sn();return Xt!==null?Eg(l,Xt,t,n):(l.baseState=t,[t,l.queue.dispatch])},useMemoCache:yf,useCacheRefresh:Xg};Jg.useEffectEvent=zg;function Cf(t,n,l,o){n=t.memoizedState,l=l(o,n),l=l==null?n:y({},n,l),t.memoizedState=l,t.lanes===0&&(t.updateQueue.baseState=l)}var Of={enqueueSetState:function(t,n,l){t=t._reactInternals;var o=Ua(),f=wl(o);f.payload=n,l!=null&&(f.callback=l),n=Sl(t,f,o),n!==null&&(Ra(n,t,o),Yi(n,t,o))},enqueueReplaceState:function(t,n,l){t=t._reactInternals;var o=Ua(),f=wl(o);f.tag=1,f.payload=n,l!=null&&(f.callback=l),n=Sl(t,f,o),n!==null&&(Ra(n,t,o),Yi(n,t,o))},enqueueForceUpdate:function(t,n){t=t._reactInternals;var l=Ua(),o=wl(l);o.tag=2,n!=null&&(o.callback=n),n=Sl(t,o,l),n!==null&&(Ra(n,t,l),Yi(n,t,l))}};function ex(t,n,l,o,f,m,b){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(o,m,b):n.prototype&&n.prototype.isPureReactComponent?!Ui(l,o)||!Ui(f,m):!0}function tx(t,n,l,o){t=n.state,typeof n.componentWillReceiveProps=="function"&&n.componentWillReceiveProps(l,o),typeof n.UNSAFE_componentWillReceiveProps=="function"&&n.UNSAFE_componentWillReceiveProps(l,o),n.state!==t&&Of.enqueueReplaceState(n,n.state,null)}function gs(t,n){var l=n;if("ref"in n){l={};for(var o in n)o!=="ref"&&(l[o]=n[o])}if(t=t.defaultProps){l===n&&(l=y({},l));for(var f in t)l[f]===void 0&&(l[f]=t[f])}return l}function nx(t){vc(t)}function ax(t){console.error(t)}function rx(t){vc(t)}function Hc(t,n){try{var l=t.onUncaughtError;l(n.value,{componentStack:n.stack})}catch(o){setTimeout(function(){throw o})}}function lx(t,n,l){try{var o=t.onCaughtError;o(l.value,{componentStack:l.stack,errorBoundary:n.tag===1?n.stateNode:null})}catch(f){setTimeout(function(){throw f})}}function Mf(t,n,l){return l=wl(l),l.tag=3,l.payload={element:null},l.callback=function(){Hc(t,n)},l}function sx(t){return t=wl(t),t.tag=3,t}function ix(t,n,l,o){var f=l.type.getDerivedStateFromError;if(typeof f=="function"){var m=o.value;t.payload=function(){return f(m)},t.callback=function(){lx(n,l,o)}}var b=l.stateNode;b!==null&&typeof b.componentDidCatch=="function"&&(t.callback=function(){lx(n,l,o),typeof f!="function"&&(Tl===null?Tl=new Set([this]):Tl.add(this));var E=o.stack;this.componentDidCatch(o.value,{componentStack:E!==null?E:""})})}function x1(t,n,l,o,f){if(l.flags|=32768,o!==null&&typeof o=="object"&&typeof o.then=="function"){if(n=l.alternate,n!==null&&qs(n,l,f,!0),l=_a.current,l!==null){switch(l.tag){case 31:case 13:return Ka===null?Jc():l.alternate===null&&xn===0&&(xn=3),l.flags&=-257,l.flags|=65536,l.lanes=f,o===Tc?l.flags|=16384:(n=l.updateQueue,n===null?l.updateQueue=new Set([o]):n.add(o),rh(t,o,f)),!1;case 22:return l.flags|=65536,o===Tc?l.flags|=16384:(n=l.updateQueue,n===null?(n={transitions:null,markerInstances:null,retryQueue:new Set([o])},l.updateQueue=n):(l=n.retryQueue,l===null?n.retryQueue=new Set([o]):l.add(o)),rh(t,o,f)),!1}throw Error(s(435,l.tag))}return rh(t,o,f),Jc(),!1}if(jt)return n=_a.current,n!==null?((n.flags&65536)===0&&(n.flags|=256),n.flags|=65536,n.lanes=f,o!==Zd&&(t=Error(s(422),{cause:o}),Hi(Ya(t,l)))):(o!==Zd&&(n=Error(s(423),{cause:o}),Hi(Ya(n,l))),t=t.current.alternate,t.flags|=65536,f&=-f,t.lanes|=f,o=Ya(o,l),f=Mf(t.stateNode,o,f),cf(t,f),xn!==4&&(xn=2)),!1;var m=Error(s(520),{cause:o});if(m=Ya(m,l),so===null?so=[m]:so.push(m),xn!==4&&(xn=2),n===null)return!0;o=Ya(o,l),l=n;do{switch(l.tag){case 3:return l.flags|=65536,t=f&-f,l.lanes|=t,t=Mf(l.stateNode,o,t),cf(l,t),!1;case 1:if(n=l.type,m=l.stateNode,(l.flags&128)===0&&(typeof n.getDerivedStateFromError=="function"||m!==null&&typeof m.componentDidCatch=="function"&&(Tl===null||!Tl.has(m))))return l.flags|=65536,f&=-f,l.lanes|=f,f=sx(f),ix(f,t,l,o),cf(l,f),!1}l=l.return}while(l!==null);return!1}var _f=Error(s(461)),Cn=!1;function ta(t,n,l,o){n.child=t===null?dg(n,null,l,o):ms(n,t.child,l,o)}function ox(t,n,l,o,f){l=l.render;var m=n.ref;if("ref"in o){var b={};for(var E in o)E!=="ref"&&(b[E]=o[E])}else b=o;return us(n),o=pf(t,n,l,b,m,f),E=gf(),t!==null&&!Cn?(xf(t,n,f),Qr(t,n,f)):(jt&&E&&Qd(n),n.flags|=1,ta(t,n,o,f),n.child)}function cx(t,n,l,o,f){if(t===null){var m=l.type;return typeof m=="function"&&!Yd(m)&&m.defaultProps===void 0&&l.compare===null?(n.tag=15,n.type=m,ux(t,n,m,o,f)):(t=Sc(l.type,null,o,n,n.mode,f),t.ref=n.ref,t.return=n,n.child=t)}if(m=t.child,!qf(t,f)){var b=m.memoizedProps;if(l=l.compare,l=l!==null?l:Ui,l(b,o)&&t.ref===n.ref)return Qr(t,n,f)}return n.flags|=1,t=Pr(m,o),t.ref=n.ref,t.return=n,n.child=t}function ux(t,n,l,o,f){if(t!==null){var m=t.memoizedProps;if(Ui(m,o)&&t.ref===n.ref)if(Cn=!1,n.pendingProps=o=m,qf(t,f))(t.flags&131072)!==0&&(Cn=!0);else return n.lanes=t.lanes,Qr(t,n,f)}return Lf(t,n,l,o,f)}function dx(t,n,l,o){var f=o.children,m=t!==null?t.memoizedState:null;if(t===null&&n.stateNode===null&&(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),o.mode==="hidden"){if((n.flags&128)!==0){if(m=m!==null?m.baseLanes|l:l,t!==null){for(o=n.child=t.child,f=0;o!==null;)f=f|o.lanes|o.childLanes,o=o.sibling;o=f&~m}else o=0,n.child=null;return fx(t,n,m,l,o)}if((l&536870912)!==0)n.memoizedState={baseLanes:0,cachePool:null},t!==null&&Rc(n,m!==null?m.cachePool:null),m!==null?mg(n,m):df(),pg(n);else return o=n.lanes=536870912,fx(t,n,m!==null?m.baseLanes|l:l,l,o)}else m!==null?(Rc(n,m.cachePool),mg(n,m),El(),n.memoizedState=null):(t!==null&&Rc(n,null),df(),El());return ta(t,n,f,l),n.child}function Ji(t,n){return t!==null&&t.tag===22||n.stateNode!==null||(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),n.sibling}function fx(t,n,l,o,f){var m=rf();return m=m===null?null:{parent:An._currentValue,pool:m},n.memoizedState={baseLanes:l,cachePool:m},t!==null&&Rc(n,null),df(),pg(n),t!==null&&qs(t,n,o,!0),n.childLanes=f,null}function qc(t,n){return n=Fc({mode:n.mode,children:n.children},t.mode),n.ref=t.ref,t.child=n,n.return=t,n}function hx(t,n,l){return ms(n,t.child,null,l),t=qc(n,n.pendingProps),t.flags|=2,La(n),n.memoizedState=null,t}function v1(t,n,l){var o=n.pendingProps,f=(n.flags&128)!==0;if(n.flags&=-129,t===null){if(jt){if(o.mode==="hidden")return t=qc(n,o),n.lanes=536870912,Ji(null,t);if(hf(n),(t=on)?(t=jv(t,Qa),t=t!==null&&t.data==="&"?t:null,t!==null&&(n.memoizedState={dehydrated:t,treeContext:gl!==null?{id:Nr,overflow:Er}:null,retryLane:536870912,hydrationErrors:null},l=Kp(t),l.return=n,n.child=l,Jn=n,on=null)):t=null,t===null)throw vl(n);return n.lanes=536870912,null}return qc(n,o)}var m=t.memoizedState;if(m!==null){var b=m.dehydrated;if(hf(n),f)if(n.flags&256)n.flags&=-257,n=hx(t,n,l);else if(n.memoizedState!==null)n.child=t.child,n.flags|=128,n=null;else throw Error(s(558));else if(Cn||qs(t,n,l,!1),f=(l&t.childLanes)!==0,Cn||f){if(o=an,o!==null&&(b=D(o,l),b!==0&&b!==m.retryLane))throw m.retryLane=b,ss(t,b),Ra(o,t,b),_f;Jc(),n=hx(t,n,l)}else t=m.treeContext,on=Za(b.nextSibling),Jn=n,jt=!0,xl=null,Qa=!1,t!==null&&Jp(n,t),n=qc(n,o),n.flags|=4096;return n}return t=Pr(t.child,{mode:o.mode,children:o.children}),t.ref=n.ref,n.child=t,t.return=n,t}function Pc(t,n){var l=n.ref;if(l===null)t!==null&&t.ref!==null&&(n.flags|=4194816);else{if(typeof l!="function"&&typeof l!="object")throw Error(s(284));(t===null||t.ref!==l)&&(n.flags|=4194816)}}function Lf(t,n,l,o,f){return us(n),l=pf(t,n,l,o,void 0,f),o=gf(),t!==null&&!Cn?(xf(t,n,f),Qr(t,n,f)):(jt&&o&&Qd(n),n.flags|=1,ta(t,n,l,f),n.child)}function mx(t,n,l,o,f,m){return us(n),n.updateQueue=null,l=xg(n,o,l,f),gg(t),o=gf(),t!==null&&!Cn?(xf(t,n,m),Qr(t,n,m)):(jt&&o&&Qd(n),n.flags|=1,ta(t,n,l,m),n.child)}function px(t,n,l,o,f){if(us(n),n.stateNode===null){var m=Us,b=l.contextType;typeof b=="object"&&b!==null&&(m=ea(b)),m=new l(o,m),n.memoizedState=m.state!==null&&m.state!==void 0?m.state:null,m.updater=Of,n.stateNode=m,m._reactInternals=n,m=n.stateNode,m.props=o,m.state=n.memoizedState,m.refs={},sf(n),b=l.contextType,m.context=typeof b=="object"&&b!==null?ea(b):Us,m.state=n.memoizedState,b=l.getDerivedStateFromProps,typeof b=="function"&&(Cf(n,l,b,o),m.state=n.memoizedState),typeof l.getDerivedStateFromProps=="function"||typeof m.getSnapshotBeforeUpdate=="function"||typeof m.UNSAFE_componentWillMount!="function"&&typeof m.componentWillMount!="function"||(b=m.state,typeof m.componentWillMount=="function"&&m.componentWillMount(),typeof m.UNSAFE_componentWillMount=="function"&&m.UNSAFE_componentWillMount(),b!==m.state&&Of.enqueueReplaceState(m,m.state,null),Xi(n,o,m,f),Gi(),m.state=n.memoizedState),typeof m.componentDidMount=="function"&&(n.flags|=4194308),o=!0}else if(t===null){m=n.stateNode;var E=n.memoizedProps,C=gs(l,E);m.props=C;var G=m.context,te=l.contextType;b=Us,typeof te=="object"&&te!==null&&(b=ea(te));var oe=l.getDerivedStateFromProps;te=typeof oe=="function"||typeof m.getSnapshotBeforeUpdate=="function",E=n.pendingProps!==E,te||typeof m.UNSAFE_componentWillReceiveProps!="function"&&typeof m.componentWillReceiveProps!="function"||(E||G!==b)&&tx(n,m,o,b),bl=!1;var Q=n.memoizedState;m.state=Q,Xi(n,o,m,f),Gi(),G=n.memoizedState,E||Q!==G||bl?(typeof oe=="function"&&(Cf(n,l,oe,o),G=n.memoizedState),(C=bl||ex(n,l,C,o,Q,G,b))?(te||typeof m.UNSAFE_componentWillMount!="function"&&typeof m.componentWillMount!="function"||(typeof m.componentWillMount=="function"&&m.componentWillMount(),typeof m.UNSAFE_componentWillMount=="function"&&m.UNSAFE_componentWillMount()),typeof m.componentDidMount=="function"&&(n.flags|=4194308)):(typeof m.componentDidMount=="function"&&(n.flags|=4194308),n.memoizedProps=o,n.memoizedState=G),m.props=o,m.state=G,m.context=b,o=C):(typeof m.componentDidMount=="function"&&(n.flags|=4194308),o=!1)}else{m=n.stateNode,of(t,n),b=n.memoizedProps,te=gs(l,b),m.props=te,oe=n.pendingProps,Q=m.context,G=l.contextType,C=Us,typeof G=="object"&&G!==null&&(C=ea(G)),E=l.getDerivedStateFromProps,(G=typeof E=="function"||typeof m.getSnapshotBeforeUpdate=="function")||typeof m.UNSAFE_componentWillReceiveProps!="function"&&typeof m.componentWillReceiveProps!="function"||(b!==oe||Q!==C)&&tx(n,m,o,C),bl=!1,Q=n.memoizedState,m.state=Q,Xi(n,o,m,f),Gi();var Z=n.memoizedState;b!==oe||Q!==Z||bl||t!==null&&t.dependencies!==null&&Ec(t.dependencies)?(typeof E=="function"&&(Cf(n,l,E,o),Z=n.memoizedState),(te=bl||ex(n,l,te,o,Q,Z,C)||t!==null&&t.dependencies!==null&&Ec(t.dependencies))?(G||typeof m.UNSAFE_componentWillUpdate!="function"&&typeof m.componentWillUpdate!="function"||(typeof m.componentWillUpdate=="function"&&m.componentWillUpdate(o,Z,C),typeof m.UNSAFE_componentWillUpdate=="function"&&m.UNSAFE_componentWillUpdate(o,Z,C)),typeof m.componentDidUpdate=="function"&&(n.flags|=4),typeof m.getSnapshotBeforeUpdate=="function"&&(n.flags|=1024)):(typeof m.componentDidUpdate!="function"||b===t.memoizedProps&&Q===t.memoizedState||(n.flags|=4),typeof m.getSnapshotBeforeUpdate!="function"||b===t.memoizedProps&&Q===t.memoizedState||(n.flags|=1024),n.memoizedProps=o,n.memoizedState=Z),m.props=o,m.state=Z,m.context=C,o=te):(typeof m.componentDidUpdate!="function"||b===t.memoizedProps&&Q===t.memoizedState||(n.flags|=4),typeof m.getSnapshotBeforeUpdate!="function"||b===t.memoizedProps&&Q===t.memoizedState||(n.flags|=1024),o=!1)}return m=o,Pc(t,n),o=(n.flags&128)!==0,m||o?(m=n.stateNode,l=o&&typeof l.getDerivedStateFromError!="function"?null:m.render(),n.flags|=1,t!==null&&o?(n.child=ms(n,t.child,null,f),n.child=ms(n,null,l,f)):ta(t,n,l,f),n.memoizedState=m.state,t=n.child):t=Qr(t,n,f),t}function gx(t,n,l,o){return os(),n.flags|=256,ta(t,n,l,o),n.child}var zf={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function $f(t){return{baseLanes:t,cachePool:lg()}}function Uf(t,n,l){return t=t!==null?t.childLanes&~l:0,n&&(t|=$a),t}function xx(t,n,l){var o=n.pendingProps,f=!1,m=(n.flags&128)!==0,b;if((b=m)||(b=t!==null&&t.memoizedState===null?!1:(wn.current&2)!==0),b&&(f=!0,n.flags&=-129),b=(n.flags&32)!==0,n.flags&=-33,t===null){if(jt){if(f?Nl(n):El(),(t=on)?(t=jv(t,Qa),t=t!==null&&t.data!=="&"?t:null,t!==null&&(n.memoizedState={dehydrated:t,treeContext:gl!==null?{id:Nr,overflow:Er}:null,retryLane:536870912,hydrationErrors:null},l=Kp(t),l.return=n,n.child=l,Jn=n,on=null)):t=null,t===null)throw vl(n);return bh(t)?n.lanes=32:n.lanes=536870912,null}var E=o.children;return o=o.fallback,f?(El(),f=n.mode,E=Fc({mode:"hidden",children:E},f),o=is(o,f,l,null),E.return=n,o.return=n,E.sibling=o,n.child=E,o=n.child,o.memoizedState=$f(l),o.childLanes=Uf(t,b,l),n.memoizedState=zf,Ji(null,o)):(Nl(n),Bf(n,E))}var C=t.memoizedState;if(C!==null&&(E=C.dehydrated,E!==null)){if(m)n.flags&256?(Nl(n),n.flags&=-257,n=If(t,n,l)):n.memoizedState!==null?(El(),n.child=t.child,n.flags|=128,n=null):(El(),E=o.fallback,f=n.mode,o=Fc({mode:"visible",children:o.children},f),E=is(E,f,l,null),E.flags|=2,o.return=n,E.return=n,o.sibling=E,n.child=o,ms(n,t.child,null,l),o=n.child,o.memoizedState=$f(l),o.childLanes=Uf(t,b,l),n.memoizedState=zf,n=Ji(null,o));else if(Nl(n),bh(E)){if(b=E.nextSibling&&E.nextSibling.dataset,b)var G=b.dgst;b=G,o=Error(s(419)),o.stack="",o.digest=b,Hi({value:o,source:null,stack:null}),n=If(t,n,l)}else if(Cn||qs(t,n,l,!1),b=(l&t.childLanes)!==0,Cn||b){if(b=an,b!==null&&(o=D(b,l),o!==0&&o!==C.retryLane))throw C.retryLane=o,ss(t,o),Ra(b,t,o),_f;yh(E)||Jc(),n=If(t,n,l)}else yh(E)?(n.flags|=192,n.child=t.child,n=null):(t=C.treeContext,on=Za(E.nextSibling),Jn=n,jt=!0,xl=null,Qa=!1,t!==null&&Jp(n,t),n=Bf(n,o.children),n.flags|=4096);return n}return f?(El(),E=o.fallback,f=n.mode,C=t.child,G=C.sibling,o=Pr(C,{mode:"hidden",children:o.children}),o.subtreeFlags=C.subtreeFlags&65011712,G!==null?E=Pr(G,E):(E=is(E,f,l,null),E.flags|=2),E.return=n,o.return=n,o.sibling=E,n.child=o,Ji(null,o),o=n.child,E=t.child.memoizedState,E===null?E=$f(l):(f=E.cachePool,f!==null?(C=An._currentValue,f=f.parent!==C?{parent:C,pool:C}:f):f=lg(),E={baseLanes:E.baseLanes|l,cachePool:f}),o.memoizedState=E,o.childLanes=Uf(t,b,l),n.memoizedState=zf,Ji(t.child,o)):(Nl(n),l=t.child,t=l.sibling,l=Pr(l,{mode:"visible",children:o.children}),l.return=n,l.sibling=null,t!==null&&(b=n.deletions,b===null?(n.deletions=[t],n.flags|=16):b.push(t)),n.child=l,n.memoizedState=null,l)}function Bf(t,n){return n=Fc({mode:"visible",children:n},t.mode),n.return=t,t.child=n}function Fc(t,n){return t=Ma(22,t,null,n),t.lanes=0,t}function If(t,n,l){return ms(n,t.child,null,l),t=Bf(n,n.pendingProps.children),t.flags|=2,n.memoizedState=null,t}function vx(t,n,l){t.lanes|=n;var o=t.alternate;o!==null&&(o.lanes|=n),ef(t.return,n,l)}function Hf(t,n,l,o,f,m){var b=t.memoizedState;b===null?t.memoizedState={isBackwards:n,rendering:null,renderingStartTime:0,last:o,tail:l,tailMode:f,treeForkCount:m}:(b.isBackwards=n,b.rendering=null,b.renderingStartTime=0,b.last=o,b.tail=l,b.tailMode=f,b.treeForkCount=m)}function yx(t,n,l){var o=n.pendingProps,f=o.revealOrder,m=o.tail;o=o.children;var b=wn.current,E=(b&2)!==0;if(E?(b=b&1|2,n.flags|=128):b&=1,K(wn,b),ta(t,n,o,l),o=jt?Ii:0,!E&&t!==null&&(t.flags&128)!==0)e:for(t=n.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&vx(t,l,n);else if(t.tag===19)vx(t,l,n);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===n)break e;for(;t.sibling===null;){if(t.return===null||t.return===n)break e;t=t.return}t.sibling.return=t.return,t=t.sibling}switch(f){case"forwards":for(l=n.child,f=null;l!==null;)t=l.alternate,t!==null&&Oc(t)===null&&(f=l),l=l.sibling;l=f,l===null?(f=n.child,n.child=null):(f=l.sibling,l.sibling=null),Hf(n,!1,f,l,m,o);break;case"backwards":case"unstable_legacy-backwards":for(l=null,f=n.child,n.child=null;f!==null;){if(t=f.alternate,t!==null&&Oc(t)===null){n.child=f;break}t=f.sibling,f.sibling=l,l=f,f=t}Hf(n,!0,l,null,m,o);break;case"together":Hf(n,!1,null,null,void 0,o);break;default:n.memoizedState=null}return n.child}function Qr(t,n,l){if(t!==null&&(n.dependencies=t.dependencies),kl|=n.lanes,(l&n.childLanes)===0)if(t!==null){if(qs(t,n,l,!1),(l&n.childLanes)===0)return null}else return null;if(t!==null&&n.child!==t.child)throw Error(s(153));if(n.child!==null){for(t=n.child,l=Pr(t,t.pendingProps),n.child=l,l.return=n;t.sibling!==null;)t=t.sibling,l=l.sibling=Pr(t,t.pendingProps),l.return=n;l.sibling=null}return n.child}function qf(t,n){return(t.lanes&n)!==0?!0:(t=t.dependencies,!!(t!==null&&Ec(t)))}function y1(t,n,l){switch(n.tag){case 3:Ie(n,n.stateNode.containerInfo),yl(n,An,t.memoizedState.cache),os();break;case 27:case 5:Ze(n);break;case 4:Ie(n,n.stateNode.containerInfo);break;case 10:yl(n,n.type,n.memoizedProps.value);break;case 31:if(n.memoizedState!==null)return n.flags|=128,hf(n),null;break;case 13:var o=n.memoizedState;if(o!==null)return o.dehydrated!==null?(Nl(n),n.flags|=128,null):(l&n.child.childLanes)!==0?xx(t,n,l):(Nl(n),t=Qr(t,n,l),t!==null?t.sibling:null);Nl(n);break;case 19:var f=(t.flags&128)!==0;if(o=(l&n.childLanes)!==0,o||(qs(t,n,l,!1),o=(l&n.childLanes)!==0),f){if(o)return yx(t,n,l);n.flags|=128}if(f=n.memoizedState,f!==null&&(f.rendering=null,f.tail=null,f.lastEffect=null),K(wn,wn.current),o)break;return null;case 22:return n.lanes=0,dx(t,n,l,n.pendingProps);case 24:yl(n,An,t.memoizedState.cache)}return Qr(t,n,l)}function bx(t,n,l){if(t!==null)if(t.memoizedProps!==n.pendingProps)Cn=!0;else{if(!qf(t,l)&&(n.flags&128)===0)return Cn=!1,y1(t,n,l);Cn=(t.flags&131072)!==0}else Cn=!1,jt&&(n.flags&1048576)!==0&&Wp(n,Ii,n.index);switch(n.lanes=0,n.tag){case 16:e:{var o=n.pendingProps;if(t=fs(n.elementType),n.type=t,typeof t=="function")Yd(t)?(o=gs(t,o),n.tag=1,n=px(null,n,t,o,l)):(n.tag=0,n=Lf(null,n,t,o,l));else{if(t!=null){var f=t.$$typeof;if(f===Y){n.tag=11,n=ox(null,n,t,o,l);break e}else if(f===U){n.tag=14,n=cx(null,n,t,o,l);break e}}throw n=je(t)||t,Error(s(306,n,""))}}return n;case 0:return Lf(t,n,n.type,n.pendingProps,l);case 1:return o=n.type,f=gs(o,n.pendingProps),px(t,n,o,f,l);case 3:e:{if(Ie(n,n.stateNode.containerInfo),t===null)throw Error(s(387));o=n.pendingProps;var m=n.memoizedState;f=m.element,of(t,n),Xi(n,o,null,l);var b=n.memoizedState;if(o=b.cache,yl(n,An,o),o!==m.cache&&tf(n,[An],l,!0),Gi(),o=b.element,m.isDehydrated)if(m={element:o,isDehydrated:!1,cache:b.cache},n.updateQueue.baseState=m,n.memoizedState=m,n.flags&256){n=gx(t,n,o,l);break e}else if(o!==f){f=Ya(Error(s(424)),n),Hi(f),n=gx(t,n,o,l);break e}else{switch(t=n.stateNode.containerInfo,t.nodeType){case 9:t=t.body;break;default:t=t.nodeName==="HTML"?t.ownerDocument.body:t}for(on=Za(t.firstChild),Jn=n,jt=!0,xl=null,Qa=!0,l=dg(n,null,o,l),n.child=l;l;)l.flags=l.flags&-3|4096,l=l.sibling}else{if(os(),o===f){n=Qr(t,n,l);break e}ta(t,n,o,l)}n=n.child}return n;case 26:return Pc(t,n),t===null?(l=Cv(n.type,null,n.pendingProps,null))?n.memoizedState=l:jt||(l=n.type,t=n.pendingProps,o=su(xe.current).createElement(l),o[be]=n,o[Ce]=t,na(o,l,t),mt(o),n.stateNode=o):n.memoizedState=Cv(n.type,t.memoizedProps,n.pendingProps,t.memoizedState),null;case 27:return Ze(n),t===null&&jt&&(o=n.stateNode=Tv(n.type,n.pendingProps,xe.current),Jn=n,Qa=!0,f=on,Ol(n.type)?(wh=f,on=Za(o.firstChild)):on=f),ta(t,n,n.pendingProps.children,l),Pc(t,n),t===null&&(n.flags|=4194304),n.child;case 5:return t===null&&jt&&((f=o=on)&&(o=Q1(o,n.type,n.pendingProps,Qa),o!==null?(n.stateNode=o,Jn=n,on=Za(o.firstChild),Qa=!1,f=!0):f=!1),f||vl(n)),Ze(n),f=n.type,m=n.pendingProps,b=t!==null?t.memoizedProps:null,o=m.children,gh(f,m)?o=null:b!==null&&gh(f,b)&&(n.flags|=32),n.memoizedState!==null&&(f=pf(t,n,u1,null,null,l),po._currentValue=f),Pc(t,n),ta(t,n,o,l),n.child;case 6:return t===null&&jt&&((t=l=on)&&(l=K1(l,n.pendingProps,Qa),l!==null?(n.stateNode=l,Jn=n,on=null,t=!0):t=!1),t||vl(n)),null;case 13:return xx(t,n,l);case 4:return Ie(n,n.stateNode.containerInfo),o=n.pendingProps,t===null?n.child=ms(n,null,o,l):ta(t,n,o,l),n.child;case 11:return ox(t,n,n.type,n.pendingProps,l);case 7:return ta(t,n,n.pendingProps,l),n.child;case 8:return ta(t,n,n.pendingProps.children,l),n.child;case 12:return ta(t,n,n.pendingProps.children,l),n.child;case 10:return o=n.pendingProps,yl(n,n.type,o.value),ta(t,n,o.children,l),n.child;case 9:return f=n.type._context,o=n.pendingProps.children,us(n),f=ea(f),o=o(f),n.flags|=1,ta(t,n,o,l),n.child;case 14:return cx(t,n,n.type,n.pendingProps,l);case 15:return ux(t,n,n.type,n.pendingProps,l);case 19:return yx(t,n,l);case 31:return v1(t,n,l);case 22:return dx(t,n,l,n.pendingProps);case 24:return us(n),o=ea(An),t===null?(f=rf(),f===null&&(f=an,m=nf(),f.pooledCache=m,m.refCount++,m!==null&&(f.pooledCacheLanes|=l),f=m),n.memoizedState={parent:o,cache:f},sf(n),yl(n,An,f)):((t.lanes&l)!==0&&(of(t,n),Xi(n,null,null,l),Gi()),f=t.memoizedState,m=n.memoizedState,f.parent!==o?(f={parent:o,cache:o},n.memoizedState=f,n.lanes===0&&(n.memoizedState=n.updateQueue.baseState=f),yl(n,An,o)):(o=m.cache,yl(n,An,o),o!==f.cache&&tf(n,[An],l,!0))),ta(t,n,n.pendingProps.children,l),n.child;case 29:throw n.pendingProps}throw Error(s(156,n.tag))}function Kr(t){t.flags|=4}function Pf(t,n,l,o,f){if((n=(t.mode&32)!==0)&&(n=!1),n){if(t.flags|=16777216,(f&335544128)===f)if(t.stateNode.complete)t.flags|=8192;else if(Gx())t.flags|=8192;else throw hs=Tc,lf}else t.flags&=-16777217}function wx(t,n){if(n.type!=="stylesheet"||(n.state.loading&4)!==0)t.flags&=-16777217;else if(t.flags|=16777216,!zv(n))if(Gx())t.flags|=8192;else throw hs=Tc,lf}function Vc(t,n){n!==null&&(t.flags|=4),t.flags&16384&&(n=t.tag!==22?en():536870912,t.lanes|=n,ei|=n)}function eo(t,n){if(!jt)switch(t.tailMode){case"hidden":n=t.tail;for(var l=null;n!==null;)n.alternate!==null&&(l=n),n=n.sibling;l===null?t.tail=null:l.sibling=null;break;case"collapsed":l=t.tail;for(var o=null;l!==null;)l.alternate!==null&&(o=l),l=l.sibling;o===null?n||t.tail===null?t.tail=null:t.tail.sibling=null:o.sibling=null}}function cn(t){var n=t.alternate!==null&&t.alternate.child===t.child,l=0,o=0;if(n)for(var f=t.child;f!==null;)l|=f.lanes|f.childLanes,o|=f.subtreeFlags&65011712,o|=f.flags&65011712,f.return=t,f=f.sibling;else for(f=t.child;f!==null;)l|=f.lanes|f.childLanes,o|=f.subtreeFlags,o|=f.flags,f.return=t,f=f.sibling;return t.subtreeFlags|=o,t.childLanes=l,n}function b1(t,n,l){var o=n.pendingProps;switch(Kd(n),n.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return cn(n),null;case 1:return cn(n),null;case 3:return l=n.stateNode,o=null,t!==null&&(o=t.memoizedState.cache),n.memoizedState.cache!==o&&(n.flags|=2048),Yr(An),Ue(),l.pendingContext&&(l.context=l.pendingContext,l.pendingContext=null),(t===null||t.child===null)&&(Hs(n)?Kr(n):t===null||t.memoizedState.isDehydrated&&(n.flags&256)===0||(n.flags|=1024,Wd())),cn(n),null;case 26:var f=n.type,m=n.memoizedState;return t===null?(Kr(n),m!==null?(cn(n),wx(n,m)):(cn(n),Pf(n,f,null,o,l))):m?m!==t.memoizedState?(Kr(n),cn(n),wx(n,m)):(cn(n),n.flags&=-16777217):(t=t.memoizedProps,t!==o&&Kr(n),cn(n),Pf(n,f,t,o,l)),null;case 27:if(dn(n),l=xe.current,f=n.type,t!==null&&n.stateNode!=null)t.memoizedProps!==o&&Kr(n);else{if(!o){if(n.stateNode===null)throw Error(s(166));return cn(n),null}t=ue.current,Hs(n)?eg(n):(t=Tv(f,o,l),n.stateNode=t,Kr(n))}return cn(n),null;case 5:if(dn(n),f=n.type,t!==null&&n.stateNode!=null)t.memoizedProps!==o&&Kr(n);else{if(!o){if(n.stateNode===null)throw Error(s(166));return cn(n),null}if(m=ue.current,Hs(n))eg(n);else{var b=su(xe.current);switch(m){case 1:m=b.createElementNS("http://www.w3.org/2000/svg",f);break;case 2:m=b.createElementNS("http://www.w3.org/1998/Math/MathML",f);break;default:switch(f){case"svg":m=b.createElementNS("http://www.w3.org/2000/svg",f);break;case"math":m=b.createElementNS("http://www.w3.org/1998/Math/MathML",f);break;case"script":m=b.createElement("div"),m.innerHTML="<script><\/script>",m=m.removeChild(m.firstChild);break;case"select":m=typeof o.is=="string"?b.createElement("select",{is:o.is}):b.createElement("select"),o.multiple?m.multiple=!0:o.size&&(m.size=o.size);break;default:m=typeof o.is=="string"?b.createElement(f,{is:o.is}):b.createElement(f)}}m[be]=n,m[Ce]=o;e:for(b=n.child;b!==null;){if(b.tag===5||b.tag===6)m.appendChild(b.stateNode);else if(b.tag!==4&&b.tag!==27&&b.child!==null){b.child.return=b,b=b.child;continue}if(b===n)break e;for(;b.sibling===null;){if(b.return===null||b.return===n)break e;b=b.return}b.sibling.return=b.return,b=b.sibling}n.stateNode=m;e:switch(na(m,f,o),f){case"button":case"input":case"select":case"textarea":o=!!o.autoFocus;break e;case"img":o=!0;break e;default:o=!1}o&&Kr(n)}}return cn(n),Pf(n,n.type,t===null?null:t.memoizedProps,n.pendingProps,l),null;case 6:if(t&&n.stateNode!=null)t.memoizedProps!==o&&Kr(n);else{if(typeof o!="string"&&n.stateNode===null)throw Error(s(166));if(t=xe.current,Hs(n)){if(t=n.stateNode,l=n.memoizedProps,o=null,f=Jn,f!==null)switch(f.tag){case 27:case 5:o=f.memoizedProps}t[be]=n,t=!!(t.nodeValue===l||o!==null&&o.suppressHydrationWarning===!0||xv(t.nodeValue,l)),t||vl(n,!0)}else t=su(t).createTextNode(o),t[be]=n,n.stateNode=t}return cn(n),null;case 31:if(l=n.memoizedState,t===null||t.memoizedState!==null){if(o=Hs(n),l!==null){if(t===null){if(!o)throw Error(s(318));if(t=n.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(s(557));t[be]=n}else os(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;cn(n),t=!1}else l=Wd(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=l),t=!0;if(!t)return n.flags&256?(La(n),n):(La(n),null);if((n.flags&128)!==0)throw Error(s(558))}return cn(n),null;case 13:if(o=n.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(f=Hs(n),o!==null&&o.dehydrated!==null){if(t===null){if(!f)throw Error(s(318));if(f=n.memoizedState,f=f!==null?f.dehydrated:null,!f)throw Error(s(317));f[be]=n}else os(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;cn(n),f=!1}else f=Wd(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=f),f=!0;if(!f)return n.flags&256?(La(n),n):(La(n),null)}return La(n),(n.flags&128)!==0?(n.lanes=l,n):(l=o!==null,t=t!==null&&t.memoizedState!==null,l&&(o=n.child,f=null,o.alternate!==null&&o.alternate.memoizedState!==null&&o.alternate.memoizedState.cachePool!==null&&(f=o.alternate.memoizedState.cachePool.pool),m=null,o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(m=o.memoizedState.cachePool.pool),m!==f&&(o.flags|=2048)),l!==t&&l&&(n.child.flags|=8192),Vc(n,n.updateQueue),cn(n),null);case 4:return Ue(),t===null&&dh(n.stateNode.containerInfo),cn(n),null;case 10:return Yr(n.type),cn(n),null;case 19:if(I(wn),o=n.memoizedState,o===null)return cn(n),null;if(f=(n.flags&128)!==0,m=o.rendering,m===null)if(f)eo(o,!1);else{if(xn!==0||t!==null&&(t.flags&128)!==0)for(t=n.child;t!==null;){if(m=Oc(t),m!==null){for(n.flags|=128,eo(o,!1),t=m.updateQueue,n.updateQueue=t,Vc(n,t),n.subtreeFlags=0,t=l,l=n.child;l!==null;)Qp(l,t),l=l.sibling;return K(wn,wn.current&1|2),jt&&Fr(n,o.treeForkCount),n.child}t=t.sibling}o.tail!==null&&rn()>Kc&&(n.flags|=128,f=!0,eo(o,!1),n.lanes=4194304)}else{if(!f)if(t=Oc(m),t!==null){if(n.flags|=128,f=!0,t=t.updateQueue,n.updateQueue=t,Vc(n,t),eo(o,!0),o.tail===null&&o.tailMode==="hidden"&&!m.alternate&&!jt)return cn(n),null}else 2*rn()-o.renderingStartTime>Kc&&l!==536870912&&(n.flags|=128,f=!0,eo(o,!1),n.lanes=4194304);o.isBackwards?(m.sibling=n.child,n.child=m):(t=o.last,t!==null?t.sibling=m:n.child=m,o.last=m)}return o.tail!==null?(t=o.tail,o.rendering=t,o.tail=t.sibling,o.renderingStartTime=rn(),t.sibling=null,l=wn.current,K(wn,f?l&1|2:l&1),jt&&Fr(n,o.treeForkCount),t):(cn(n),null);case 22:case 23:return La(n),ff(),o=n.memoizedState!==null,t!==null?t.memoizedState!==null!==o&&(n.flags|=8192):o&&(n.flags|=8192),o?(l&536870912)!==0&&(n.flags&128)===0&&(cn(n),n.subtreeFlags&6&&(n.flags|=8192)):cn(n),l=n.updateQueue,l!==null&&Vc(n,l.retryQueue),l=null,t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(l=t.memoizedState.cachePool.pool),o=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(o=n.memoizedState.cachePool.pool),o!==l&&(n.flags|=2048),t!==null&&I(ds),null;case 24:return l=null,t!==null&&(l=t.memoizedState.cache),n.memoizedState.cache!==l&&(n.flags|=2048),Yr(An),cn(n),null;case 25:return null;case 30:return null}throw Error(s(156,n.tag))}function w1(t,n){switch(Kd(n),n.tag){case 1:return t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 3:return Yr(An),Ue(),t=n.flags,(t&65536)!==0&&(t&128)===0?(n.flags=t&-65537|128,n):null;case 26:case 27:case 5:return dn(n),null;case 31:if(n.memoizedState!==null){if(La(n),n.alternate===null)throw Error(s(340));os()}return t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 13:if(La(n),t=n.memoizedState,t!==null&&t.dehydrated!==null){if(n.alternate===null)throw Error(s(340));os()}return t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 19:return I(wn),null;case 4:return Ue(),null;case 10:return Yr(n.type),null;case 22:case 23:return La(n),ff(),t!==null&&I(ds),t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 24:return Yr(An),null;case 25:return null;default:return null}}function Sx(t,n){switch(Kd(n),n.tag){case 3:Yr(An),Ue();break;case 26:case 27:case 5:dn(n);break;case 4:Ue();break;case 31:n.memoizedState!==null&&La(n);break;case 13:La(n);break;case 19:I(wn);break;case 10:Yr(n.type);break;case 22:case 23:La(n),ff(),t!==null&&I(ds);break;case 24:Yr(An)}}function to(t,n){try{var l=n.updateQueue,o=l!==null?l.lastEffect:null;if(o!==null){var f=o.next;l=f;do{if((l.tag&t)===t){o=void 0;var m=l.create,b=l.inst;o=m(),b.destroy=o}l=l.next}while(l!==f)}}catch(E){Yt(n,n.return,E)}}function jl(t,n,l){try{var o=n.updateQueue,f=o!==null?o.lastEffect:null;if(f!==null){var m=f.next;o=m;do{if((o.tag&t)===t){var b=o.inst,E=b.destroy;if(E!==void 0){b.destroy=void 0,f=n;var C=l,G=E;try{G()}catch(te){Yt(f,C,te)}}}o=o.next}while(o!==m)}}catch(te){Yt(n,n.return,te)}}function Nx(t){var n=t.updateQueue;if(n!==null){var l=t.stateNode;try{hg(n,l)}catch(o){Yt(t,t.return,o)}}}function Ex(t,n,l){l.props=gs(t.type,t.memoizedProps),l.state=t.memoizedState;try{l.componentWillUnmount()}catch(o){Yt(t,n,o)}}function no(t,n){try{var l=t.ref;if(l!==null){switch(t.tag){case 26:case 27:case 5:var o=t.stateNode;break;case 30:o=t.stateNode;break;default:o=t.stateNode}typeof l=="function"?t.refCleanup=l(o):l.current=o}}catch(f){Yt(t,n,f)}}function jr(t,n){var l=t.ref,o=t.refCleanup;if(l!==null)if(typeof o=="function")try{o()}catch(f){Yt(t,n,f)}finally{t.refCleanup=null,t=t.alternate,t!=null&&(t.refCleanup=null)}else if(typeof l=="function")try{l(null)}catch(f){Yt(t,n,f)}else l.current=null}function jx(t){var n=t.type,l=t.memoizedProps,o=t.stateNode;try{e:switch(n){case"button":case"input":case"select":case"textarea":l.autoFocus&&o.focus();break e;case"img":l.src?o.src=l.src:l.srcSet&&(o.srcset=l.srcSet)}}catch(f){Yt(t,t.return,f)}}function Ff(t,n,l){try{var o=t.stateNode;P1(o,t.type,l,n),o[Ce]=n}catch(f){Yt(t,t.return,f)}}function Rx(t){return t.tag===5||t.tag===3||t.tag===26||t.tag===27&&Ol(t.type)||t.tag===4}function Vf(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||Rx(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.tag===27&&Ol(t.type)||t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function Yf(t,n,l){var o=t.tag;if(o===5||o===6)t=t.stateNode,n?(l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l).insertBefore(t,n):(n=l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l,n.appendChild(t),l=l._reactRootContainer,l!=null||n.onclick!==null||(n.onclick=sa));else if(o!==4&&(o===27&&Ol(t.type)&&(l=t.stateNode,n=null),t=t.child,t!==null))for(Yf(t,n,l),t=t.sibling;t!==null;)Yf(t,n,l),t=t.sibling}function Yc(t,n,l){var o=t.tag;if(o===5||o===6)t=t.stateNode,n?l.insertBefore(t,n):l.appendChild(t);else if(o!==4&&(o===27&&Ol(t.type)&&(l=t.stateNode),t=t.child,t!==null))for(Yc(t,n,l),t=t.sibling;t!==null;)Yc(t,n,l),t=t.sibling}function kx(t){var n=t.stateNode,l=t.memoizedProps;try{for(var o=t.type,f=n.attributes;f.length;)n.removeAttributeNode(f[0]);na(n,o,l),n[be]=t,n[Ce]=l}catch(m){Yt(t,t.return,m)}}var Zr=!1,On=!1,Gf=!1,Tx=typeof WeakSet=="function"?WeakSet:Set,Gn=null;function S1(t,n){if(t=t.containerInfo,mh=hu,t=Ip(t),Bd(t)){if("selectionStart"in t)var l={start:t.selectionStart,end:t.selectionEnd};else e:{l=(l=t.ownerDocument)&&l.defaultView||window;var o=l.getSelection&&l.getSelection();if(o&&o.rangeCount!==0){l=o.anchorNode;var f=o.anchorOffset,m=o.focusNode;o=o.focusOffset;try{l.nodeType,m.nodeType}catch{l=null;break e}var b=0,E=-1,C=-1,G=0,te=0,oe=t,Q=null;t:for(;;){for(var Z;oe!==l||f!==0&&oe.nodeType!==3||(E=b+f),oe!==m||o!==0&&oe.nodeType!==3||(C=b+o),oe.nodeType===3&&(b+=oe.nodeValue.length),(Z=oe.firstChild)!==null;)Q=oe,oe=Z;for(;;){if(oe===t)break t;if(Q===l&&++G===f&&(E=b),Q===m&&++te===o&&(C=b),(Z=oe.nextSibling)!==null)break;oe=Q,Q=oe.parentNode}oe=Z}l=E===-1||C===-1?null:{start:E,end:C}}else l=null}l=l||{start:0,end:0}}else l=null;for(ph={focusedElem:t,selectionRange:l},hu=!1,Gn=n;Gn!==null;)if(n=Gn,t=n.child,(n.subtreeFlags&1028)!==0&&t!==null)t.return=n,Gn=t;else for(;Gn!==null;){switch(n=Gn,m=n.alternate,t=n.flags,n.tag){case 0:if((t&4)!==0&&(t=n.updateQueue,t=t!==null?t.events:null,t!==null))for(l=0;l<t.length;l++)f=t[l],f.ref.impl=f.nextImpl;break;case 11:case 15:break;case 1:if((t&1024)!==0&&m!==null){t=void 0,l=n,f=m.memoizedProps,m=m.memoizedState,o=l.stateNode;try{var Me=gs(l.type,f);t=o.getSnapshotBeforeUpdate(Me,m),o.__reactInternalSnapshotBeforeUpdate=t}catch(Ye){Yt(l,l.return,Ye)}}break;case 3:if((t&1024)!==0){if(t=n.stateNode.containerInfo,l=t.nodeType,l===9)vh(t);else if(l===1)switch(t.nodeName){case"HEAD":case"HTML":case"BODY":vh(t);break;default:t.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((t&1024)!==0)throw Error(s(163))}if(t=n.sibling,t!==null){t.return=n.return,Gn=t;break}Gn=n.return}}function Ax(t,n,l){var o=l.flags;switch(l.tag){case 0:case 11:case 15:Jr(t,l),o&4&&to(5,l);break;case 1:if(Jr(t,l),o&4)if(t=l.stateNode,n===null)try{t.componentDidMount()}catch(b){Yt(l,l.return,b)}else{var f=gs(l.type,n.memoizedProps);n=n.memoizedState;try{t.componentDidUpdate(f,n,t.__reactInternalSnapshotBeforeUpdate)}catch(b){Yt(l,l.return,b)}}o&64&&Nx(l),o&512&&no(l,l.return);break;case 3:if(Jr(t,l),o&64&&(t=l.updateQueue,t!==null)){if(n=null,l.child!==null)switch(l.child.tag){case 27:case 5:n=l.child.stateNode;break;case 1:n=l.child.stateNode}try{hg(t,n)}catch(b){Yt(l,l.return,b)}}break;case 27:n===null&&o&4&&kx(l);case 26:case 5:Jr(t,l),n===null&&o&4&&jx(l),o&512&&no(l,l.return);break;case 12:Jr(t,l);break;case 31:Jr(t,l),o&4&&Ox(t,l);break;case 13:Jr(t,l),o&4&&Mx(t,l),o&64&&(t=l.memoizedState,t!==null&&(t=t.dehydrated,t!==null&&(l=C1.bind(null,l),Z1(t,l))));break;case 22:if(o=l.memoizedState!==null||Zr,!o){n=n!==null&&n.memoizedState!==null||On,f=Zr;var m=On;Zr=o,(On=n)&&!m?el(t,l,(l.subtreeFlags&8772)!==0):Jr(t,l),Zr=f,On=m}break;case 30:break;default:Jr(t,l)}}function Dx(t){var n=t.alternate;n!==null&&(t.alternate=null,Dx(n)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(n=t.stateNode,n!==null&&Fe(n)),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}var fn=null,Sa=!1;function Wr(t,n,l){for(l=l.child;l!==null;)Cx(t,n,l),l=l.sibling}function Cx(t,n,l){if(ee&&typeof ee.onCommitFiberUnmount=="function")try{ee.onCommitFiberUnmount(Pe,l)}catch{}switch(l.tag){case 26:On||jr(l,n),Wr(t,n,l),l.memoizedState?l.memoizedState.count--:l.stateNode&&(l=l.stateNode,l.parentNode.removeChild(l));break;case 27:On||jr(l,n);var o=fn,f=Sa;Ol(l.type)&&(fn=l.stateNode,Sa=!1),Wr(t,n,l),fo(l.stateNode),fn=o,Sa=f;break;case 5:On||jr(l,n);case 6:if(o=fn,f=Sa,fn=null,Wr(t,n,l),fn=o,Sa=f,fn!==null)if(Sa)try{(fn.nodeType===9?fn.body:fn.nodeName==="HTML"?fn.ownerDocument.body:fn).removeChild(l.stateNode)}catch(m){Yt(l,n,m)}else try{fn.removeChild(l.stateNode)}catch(m){Yt(l,n,m)}break;case 18:fn!==null&&(Sa?(t=fn,Nv(t.nodeType===9?t.body:t.nodeName==="HTML"?t.ownerDocument.body:t,l.stateNode),oi(t)):Nv(fn,l.stateNode));break;case 4:o=fn,f=Sa,fn=l.stateNode.containerInfo,Sa=!0,Wr(t,n,l),fn=o,Sa=f;break;case 0:case 11:case 14:case 15:jl(2,l,n),On||jl(4,l,n),Wr(t,n,l);break;case 1:On||(jr(l,n),o=l.stateNode,typeof o.componentWillUnmount=="function"&&Ex(l,n,o)),Wr(t,n,l);break;case 21:Wr(t,n,l);break;case 22:On=(o=On)||l.memoizedState!==null,Wr(t,n,l),On=o;break;default:Wr(t,n,l)}}function Ox(t,n){if(n.memoizedState===null&&(t=n.alternate,t!==null&&(t=t.memoizedState,t!==null))){t=t.dehydrated;try{oi(t)}catch(l){Yt(n,n.return,l)}}}function Mx(t,n){if(n.memoizedState===null&&(t=n.alternate,t!==null&&(t=t.memoizedState,t!==null&&(t=t.dehydrated,t!==null))))try{oi(t)}catch(l){Yt(n,n.return,l)}}function N1(t){switch(t.tag){case 31:case 13:case 19:var n=t.stateNode;return n===null&&(n=t.stateNode=new Tx),n;case 22:return t=t.stateNode,n=t._retryCache,n===null&&(n=t._retryCache=new Tx),n;default:throw Error(s(435,t.tag))}}function Gc(t,n){var l=N1(t);n.forEach(function(o){if(!l.has(o)){l.add(o);var f=O1.bind(null,t,o);o.then(f,f)}})}function Na(t,n){var l=n.deletions;if(l!==null)for(var o=0;o<l.length;o++){var f=l[o],m=t,b=n,E=b;e:for(;E!==null;){switch(E.tag){case 27:if(Ol(E.type)){fn=E.stateNode,Sa=!1;break e}break;case 5:fn=E.stateNode,Sa=!1;break e;case 3:case 4:fn=E.stateNode.containerInfo,Sa=!0;break e}E=E.return}if(fn===null)throw Error(s(160));Cx(m,b,f),fn=null,Sa=!1,m=f.alternate,m!==null&&(m.return=null),f.return=null}if(n.subtreeFlags&13886)for(n=n.child;n!==null;)_x(n,t),n=n.sibling}var cr=null;function _x(t,n){var l=t.alternate,o=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:Na(n,t),Ea(t),o&4&&(jl(3,t,t.return),to(3,t),jl(5,t,t.return));break;case 1:Na(n,t),Ea(t),o&512&&(On||l===null||jr(l,l.return)),o&64&&Zr&&(t=t.updateQueue,t!==null&&(o=t.callbacks,o!==null&&(l=t.shared.hiddenCallbacks,t.shared.hiddenCallbacks=l===null?o:l.concat(o))));break;case 26:var f=cr;if(Na(n,t),Ea(t),o&512&&(On||l===null||jr(l,l.return)),o&4){var m=l!==null?l.memoizedState:null;if(o=t.memoizedState,l===null)if(o===null)if(t.stateNode===null){e:{o=t.type,l=t.memoizedProps,f=f.ownerDocument||f;t:switch(o){case"title":m=f.getElementsByTagName("title")[0],(!m||m[tt]||m[be]||m.namespaceURI==="http://www.w3.org/2000/svg"||m.hasAttribute("itemprop"))&&(m=f.createElement(o),f.head.insertBefore(m,f.querySelector("head > title"))),na(m,o,l),m[be]=t,mt(m),o=m;break e;case"link":var b=_v("link","href",f).get(o+(l.href||""));if(b){for(var E=0;E<b.length;E++)if(m=b[E],m.getAttribute("href")===(l.href==null||l.href===""?null:l.href)&&m.getAttribute("rel")===(l.rel==null?null:l.rel)&&m.getAttribute("title")===(l.title==null?null:l.title)&&m.getAttribute("crossorigin")===(l.crossOrigin==null?null:l.crossOrigin)){b.splice(E,1);break t}}m=f.createElement(o),na(m,o,l),f.head.appendChild(m);break;case"meta":if(b=_v("meta","content",f).get(o+(l.content||""))){for(E=0;E<b.length;E++)if(m=b[E],m.getAttribute("content")===(l.content==null?null:""+l.content)&&m.getAttribute("name")===(l.name==null?null:l.name)&&m.getAttribute("property")===(l.property==null?null:l.property)&&m.getAttribute("http-equiv")===(l.httpEquiv==null?null:l.httpEquiv)&&m.getAttribute("charset")===(l.charSet==null?null:l.charSet)){b.splice(E,1);break t}}m=f.createElement(o),na(m,o,l),f.head.appendChild(m);break;default:throw Error(s(468,o))}m[be]=t,mt(m),o=m}t.stateNode=o}else Lv(f,t.type,t.stateNode);else t.stateNode=Mv(f,o,t.memoizedProps);else m!==o?(m===null?l.stateNode!==null&&(l=l.stateNode,l.parentNode.removeChild(l)):m.count--,o===null?Lv(f,t.type,t.stateNode):Mv(f,o,t.memoizedProps)):o===null&&t.stateNode!==null&&Ff(t,t.memoizedProps,l.memoizedProps)}break;case 27:Na(n,t),Ea(t),o&512&&(On||l===null||jr(l,l.return)),l!==null&&o&4&&Ff(t,t.memoizedProps,l.memoizedProps);break;case 5:if(Na(n,t),Ea(t),o&512&&(On||l===null||jr(l,l.return)),t.flags&32){f=t.stateNode;try{ml(f,"")}catch(Me){Yt(t,t.return,Me)}}o&4&&t.stateNode!=null&&(f=t.memoizedProps,Ff(t,f,l!==null?l.memoizedProps:f)),o&1024&&(Gf=!0);break;case 6:if(Na(n,t),Ea(t),o&4){if(t.stateNode===null)throw Error(s(162));o=t.memoizedProps,l=t.stateNode;try{l.nodeValue=o}catch(Me){Yt(t,t.return,Me)}}break;case 3:if(cu=null,f=cr,cr=iu(n.containerInfo),Na(n,t),cr=f,Ea(t),o&4&&l!==null&&l.memoizedState.isDehydrated)try{oi(n.containerInfo)}catch(Me){Yt(t,t.return,Me)}Gf&&(Gf=!1,Lx(t));break;case 4:o=cr,cr=iu(t.stateNode.containerInfo),Na(n,t),Ea(t),cr=o;break;case 12:Na(n,t),Ea(t);break;case 31:Na(n,t),Ea(t),o&4&&(o=t.updateQueue,o!==null&&(t.updateQueue=null,Gc(t,o)));break;case 13:Na(n,t),Ea(t),t.child.flags&8192&&t.memoizedState!==null!=(l!==null&&l.memoizedState!==null)&&(Qc=rn()),o&4&&(o=t.updateQueue,o!==null&&(t.updateQueue=null,Gc(t,o)));break;case 22:f=t.memoizedState!==null;var C=l!==null&&l.memoizedState!==null,G=Zr,te=On;if(Zr=G||f,On=te||C,Na(n,t),On=te,Zr=G,Ea(t),o&8192)e:for(n=t.stateNode,n._visibility=f?n._visibility&-2:n._visibility|1,f&&(l===null||C||Zr||On||xs(t)),l=null,n=t;;){if(n.tag===5||n.tag===26){if(l===null){C=l=n;try{if(m=C.stateNode,f)b=m.style,typeof b.setProperty=="function"?b.setProperty("display","none","important"):b.display="none";else{E=C.stateNode;var oe=C.memoizedProps.style,Q=oe!=null&&oe.hasOwnProperty("display")?oe.display:null;E.style.display=Q==null||typeof Q=="boolean"?"":(""+Q).trim()}}catch(Me){Yt(C,C.return,Me)}}}else if(n.tag===6){if(l===null){C=n;try{C.stateNode.nodeValue=f?"":C.memoizedProps}catch(Me){Yt(C,C.return,Me)}}}else if(n.tag===18){if(l===null){C=n;try{var Z=C.stateNode;f?Ev(Z,!0):Ev(C.stateNode,!1)}catch(Me){Yt(C,C.return,Me)}}}else if((n.tag!==22&&n.tag!==23||n.memoizedState===null||n===t)&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break e;for(;n.sibling===null;){if(n.return===null||n.return===t)break e;l===n&&(l=null),n=n.return}l===n&&(l=null),n.sibling.return=n.return,n=n.sibling}o&4&&(o=t.updateQueue,o!==null&&(l=o.retryQueue,l!==null&&(o.retryQueue=null,Gc(t,l))));break;case 19:Na(n,t),Ea(t),o&4&&(o=t.updateQueue,o!==null&&(t.updateQueue=null,Gc(t,o)));break;case 30:break;case 21:break;default:Na(n,t),Ea(t)}}function Ea(t){var n=t.flags;if(n&2){try{for(var l,o=t.return;o!==null;){if(Rx(o)){l=o;break}o=o.return}if(l==null)throw Error(s(160));switch(l.tag){case 27:var f=l.stateNode,m=Vf(t);Yc(t,m,f);break;case 5:var b=l.stateNode;l.flags&32&&(ml(b,""),l.flags&=-33);var E=Vf(t);Yc(t,E,b);break;case 3:case 4:var C=l.stateNode.containerInfo,G=Vf(t);Yf(t,G,C);break;default:throw Error(s(161))}}catch(te){Yt(t,t.return,te)}t.flags&=-3}n&4096&&(t.flags&=-4097)}function Lx(t){if(t.subtreeFlags&1024)for(t=t.child;t!==null;){var n=t;Lx(n),n.tag===5&&n.flags&1024&&n.stateNode.reset(),t=t.sibling}}function Jr(t,n){if(n.subtreeFlags&8772)for(n=n.child;n!==null;)Ax(t,n.alternate,n),n=n.sibling}function xs(t){for(t=t.child;t!==null;){var n=t;switch(n.tag){case 0:case 11:case 14:case 15:jl(4,n,n.return),xs(n);break;case 1:jr(n,n.return);var l=n.stateNode;typeof l.componentWillUnmount=="function"&&Ex(n,n.return,l),xs(n);break;case 27:fo(n.stateNode);case 26:case 5:jr(n,n.return),xs(n);break;case 22:n.memoizedState===null&&xs(n);break;case 30:xs(n);break;default:xs(n)}t=t.sibling}}function el(t,n,l){for(l=l&&(n.subtreeFlags&8772)!==0,n=n.child;n!==null;){var o=n.alternate,f=t,m=n,b=m.flags;switch(m.tag){case 0:case 11:case 15:el(f,m,l),to(4,m);break;case 1:if(el(f,m,l),o=m,f=o.stateNode,typeof f.componentDidMount=="function")try{f.componentDidMount()}catch(G){Yt(o,o.return,G)}if(o=m,f=o.updateQueue,f!==null){var E=o.stateNode;try{var C=f.shared.hiddenCallbacks;if(C!==null)for(f.shared.hiddenCallbacks=null,f=0;f<C.length;f++)fg(C[f],E)}catch(G){Yt(o,o.return,G)}}l&&b&64&&Nx(m),no(m,m.return);break;case 27:kx(m);case 26:case 5:el(f,m,l),l&&o===null&&b&4&&jx(m),no(m,m.return);break;case 12:el(f,m,l);break;case 31:el(f,m,l),l&&b&4&&Ox(f,m);break;case 13:el(f,m,l),l&&b&4&&Mx(f,m);break;case 22:m.memoizedState===null&&el(f,m,l),no(m,m.return);break;case 30:break;default:el(f,m,l)}n=n.sibling}}function Xf(t,n){var l=null;t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(l=t.memoizedState.cachePool.pool),t=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(t=n.memoizedState.cachePool.pool),t!==l&&(t!=null&&t.refCount++,l!=null&&qi(l))}function Qf(t,n){t=null,n.alternate!==null&&(t=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==t&&(n.refCount++,t!=null&&qi(t))}function ur(t,n,l,o){if(n.subtreeFlags&10256)for(n=n.child;n!==null;)zx(t,n,l,o),n=n.sibling}function zx(t,n,l,o){var f=n.flags;switch(n.tag){case 0:case 11:case 15:ur(t,n,l,o),f&2048&&to(9,n);break;case 1:ur(t,n,l,o);break;case 3:ur(t,n,l,o),f&2048&&(t=null,n.alternate!==null&&(t=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==t&&(n.refCount++,t!=null&&qi(t)));break;case 12:if(f&2048){ur(t,n,l,o),t=n.stateNode;try{var m=n.memoizedProps,b=m.id,E=m.onPostCommit;typeof E=="function"&&E(b,n.alternate===null?"mount":"update",t.passiveEffectDuration,-0)}catch(C){Yt(n,n.return,C)}}else ur(t,n,l,o);break;case 31:ur(t,n,l,o);break;case 13:ur(t,n,l,o);break;case 23:break;case 22:m=n.stateNode,b=n.alternate,n.memoizedState!==null?m._visibility&2?ur(t,n,l,o):ao(t,n):m._visibility&2?ur(t,n,l,o):(m._visibility|=2,Zs(t,n,l,o,(n.subtreeFlags&10256)!==0||!1)),f&2048&&Xf(b,n);break;case 24:ur(t,n,l,o),f&2048&&Qf(n.alternate,n);break;default:ur(t,n,l,o)}}function Zs(t,n,l,o,f){for(f=f&&((n.subtreeFlags&10256)!==0||!1),n=n.child;n!==null;){var m=t,b=n,E=l,C=o,G=b.flags;switch(b.tag){case 0:case 11:case 15:Zs(m,b,E,C,f),to(8,b);break;case 23:break;case 22:var te=b.stateNode;b.memoizedState!==null?te._visibility&2?Zs(m,b,E,C,f):ao(m,b):(te._visibility|=2,Zs(m,b,E,C,f)),f&&G&2048&&Xf(b.alternate,b);break;case 24:Zs(m,b,E,C,f),f&&G&2048&&Qf(b.alternate,b);break;default:Zs(m,b,E,C,f)}n=n.sibling}}function ao(t,n){if(n.subtreeFlags&10256)for(n=n.child;n!==null;){var l=t,o=n,f=o.flags;switch(o.tag){case 22:ao(l,o),f&2048&&Xf(o.alternate,o);break;case 24:ao(l,o),f&2048&&Qf(o.alternate,o);break;default:ao(l,o)}n=n.sibling}}var ro=8192;function Ws(t,n,l){if(t.subtreeFlags&ro)for(t=t.child;t!==null;)$x(t,n,l),t=t.sibling}function $x(t,n,l){switch(t.tag){case 26:Ws(t,n,l),t.flags&ro&&t.memoizedState!==null&&cS(l,cr,t.memoizedState,t.memoizedProps);break;case 5:Ws(t,n,l);break;case 3:case 4:var o=cr;cr=iu(t.stateNode.containerInfo),Ws(t,n,l),cr=o;break;case 22:t.memoizedState===null&&(o=t.alternate,o!==null&&o.memoizedState!==null?(o=ro,ro=16777216,Ws(t,n,l),ro=o):Ws(t,n,l));break;default:Ws(t,n,l)}}function Ux(t){var n=t.alternate;if(n!==null&&(t=n.child,t!==null)){n.child=null;do n=t.sibling,t.sibling=null,t=n;while(t!==null)}}function lo(t){var n=t.deletions;if((t.flags&16)!==0){if(n!==null)for(var l=0;l<n.length;l++){var o=n[l];Gn=o,Ix(o,t)}Ux(t)}if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Bx(t),t=t.sibling}function Bx(t){switch(t.tag){case 0:case 11:case 15:lo(t),t.flags&2048&&jl(9,t,t.return);break;case 3:lo(t);break;case 12:lo(t);break;case 22:var n=t.stateNode;t.memoizedState!==null&&n._visibility&2&&(t.return===null||t.return.tag!==13)?(n._visibility&=-3,Xc(t)):lo(t);break;default:lo(t)}}function Xc(t){var n=t.deletions;if((t.flags&16)!==0){if(n!==null)for(var l=0;l<n.length;l++){var o=n[l];Gn=o,Ix(o,t)}Ux(t)}for(t=t.child;t!==null;){switch(n=t,n.tag){case 0:case 11:case 15:jl(8,n,n.return),Xc(n);break;case 22:l=n.stateNode,l._visibility&2&&(l._visibility&=-3,Xc(n));break;default:Xc(n)}t=t.sibling}}function Ix(t,n){for(;Gn!==null;){var l=Gn;switch(l.tag){case 0:case 11:case 15:jl(8,l,n);break;case 23:case 22:if(l.memoizedState!==null&&l.memoizedState.cachePool!==null){var o=l.memoizedState.cachePool.pool;o!=null&&o.refCount++}break;case 24:qi(l.memoizedState.cache)}if(o=l.child,o!==null)o.return=l,Gn=o;else e:for(l=t;Gn!==null;){o=Gn;var f=o.sibling,m=o.return;if(Dx(o),o===l){Gn=null;break e}if(f!==null){f.return=m,Gn=f;break e}Gn=m}}}var E1={getCacheForType:function(t){var n=ea(An),l=n.data.get(t);return l===void 0&&(l=t(),n.data.set(t,l)),l},cacheSignal:function(){return ea(An).controller.signal}},j1=typeof WeakMap=="function"?WeakMap:Map,Lt=0,an=null,xt=null,St=0,Vt=0,za=null,Rl=!1,Js=!1,Kf=!1,tl=0,xn=0,kl=0,vs=0,Zf=0,$a=0,ei=0,so=null,ja=null,Wf=!1,Qc=0,Hx=0,Kc=1/0,Zc=null,Tl=null,Bn=0,Al=null,ti=null,nl=0,Jf=0,eh=null,qx=null,io=0,th=null;function Ua(){return(Lt&2)!==0&&St!==0?St&-St:L.T!==null?ih():J()}function Px(){if($a===0)if((St&536870912)===0||jt){var t=bt;bt<<=1,(bt&3932160)===0&&(bt=262144),$a=t}else $a=536870912;return t=_a.current,t!==null&&(t.flags|=32),$a}function Ra(t,n,l){(t===an&&(Vt===2||Vt===9)||t.cancelPendingCommit!==null)&&(ni(t,0),Dl(t,St,$a,!1)),gt(t,l),((Lt&2)===0||t!==an)&&(t===an&&((Lt&2)===0&&(vs|=l),xn===4&&Dl(t,St,$a,!1)),Rr(t))}function Fx(t,n,l){if((Lt&6)!==0)throw Error(s(327));var o=!l&&(n&127)===0&&(n&t.expiredLanes)===0||Ct(t,n),f=o?T1(t,n):ah(t,n,!0),m=o;do{if(f===0){Js&&!o&&Dl(t,n,0,!1);break}else{if(l=t.current.alternate,m&&!R1(l)){f=ah(t,n,!1),m=!1;continue}if(f===2){if(m=n,t.errorRecoveryDisabledLanes&m)var b=0;else b=t.pendingLanes&-536870913,b=b!==0?b:b&536870912?536870912:0;if(b!==0){n=b;e:{var E=t;f=so;var C=E.current.memoizedState.isDehydrated;if(C&&(ni(E,b).flags|=256),b=ah(E,b,!1),b!==2){if(Kf&&!C){E.errorRecoveryDisabledLanes|=m,vs|=m,f=4;break e}m=ja,ja=f,m!==null&&(ja===null?ja=m:ja.push.apply(ja,m))}f=b}if(m=!1,f!==2)continue}}if(f===1){ni(t,0),Dl(t,n,0,!0);break}e:{switch(o=t,m=f,m){case 0:case 1:throw Error(s(345));case 4:if((n&4194048)!==n)break;case 6:Dl(o,n,$a,!Rl);break e;case 2:ja=null;break;case 3:case 5:break;default:throw Error(s(329))}if((n&62914560)===n&&(f=Qc+300-rn(),10<f)){if(Dl(o,n,$a,!Rl),qt(o,0,!0)!==0)break e;nl=n,o.timeoutHandle=wv(Vx.bind(null,o,l,ja,Zc,Wf,n,$a,vs,ei,Rl,m,"Throttled",-0,0),f);break e}Vx(o,l,ja,Zc,Wf,n,$a,vs,ei,Rl,m,null,-0,0)}}break}while(!0);Rr(t)}function Vx(t,n,l,o,f,m,b,E,C,G,te,oe,Q,Z){if(t.timeoutHandle=-1,oe=n.subtreeFlags,oe&8192||(oe&16785408)===16785408){oe={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:sa},$x(n,m,oe);var Me=(m&62914560)===m?Qc-rn():(m&4194048)===m?Hx-rn():0;if(Me=uS(oe,Me),Me!==null){nl=m,t.cancelPendingCommit=Me(Jx.bind(null,t,n,m,l,o,f,b,E,C,te,oe,null,Q,Z)),Dl(t,m,b,!G);return}}Jx(t,n,m,l,o,f,b,E,C)}function R1(t){for(var n=t;;){var l=n.tag;if((l===0||l===11||l===15)&&n.flags&16384&&(l=n.updateQueue,l!==null&&(l=l.stores,l!==null)))for(var o=0;o<l.length;o++){var f=l[o],m=f.getSnapshot;f=f.value;try{if(!Oa(m(),f))return!1}catch{return!1}}if(l=n.child,n.subtreeFlags&16384&&l!==null)l.return=n,n=l;else{if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return!0;n=n.return}n.sibling.return=n.return,n=n.sibling}}return!0}function Dl(t,n,l,o){n&=~Zf,n&=~vs,t.suspendedLanes|=n,t.pingedLanes&=~n,o&&(t.warmLanes|=n),o=t.expirationTimes;for(var f=n;0<f;){var m=31-Jt(f),b=1<<m;o[m]=-1,f&=~b}l!==0&&jn(t,l,n)}function Wc(){return(Lt&6)===0?(oo(0),!1):!0}function nh(){if(xt!==null){if(Vt===0)var t=xt.return;else t=xt,Vr=cs=null,vf(t),Ys=null,Fi=0,t=xt;for(;t!==null;)Sx(t.alternate,t),t=t.return;xt=null}}function ni(t,n){var l=t.timeoutHandle;l!==-1&&(t.timeoutHandle=-1,Y1(l)),l=t.cancelPendingCommit,l!==null&&(t.cancelPendingCommit=null,l()),nl=0,nh(),an=t,xt=l=Pr(t.current,null),St=n,Vt=0,za=null,Rl=!1,Js=Ct(t,n),Kf=!1,ei=$a=Zf=vs=kl=xn=0,ja=so=null,Wf=!1,(n&8)!==0&&(n|=n&32);var o=t.entangledLanes;if(o!==0)for(t=t.entanglements,o&=n;0<o;){var f=31-Jt(o),m=1<<f;n|=t[f],o&=~m}return tl=n,yc(),l}function Yx(t,n){ct=null,L.H=Wi,n===Vs||n===kc?(n=og(),Vt=3):n===lf?(n=og(),Vt=4):Vt=n===_f?8:n!==null&&typeof n=="object"&&typeof n.then=="function"?6:1,za=n,xt===null&&(xn=1,Hc(t,Ya(n,t.current)))}function Gx(){var t=_a.current;return t===null?!0:(St&4194048)===St?Ka===null:(St&62914560)===St||(St&536870912)!==0?t===Ka:!1}function Xx(){var t=L.H;return L.H=Wi,t===null?Wi:t}function Qx(){var t=L.A;return L.A=E1,t}function Jc(){xn=4,Rl||(St&4194048)!==St&&_a.current!==null||(Js=!0),(kl&134217727)===0&&(vs&134217727)===0||an===null||Dl(an,St,$a,!1)}function ah(t,n,l){var o=Lt;Lt|=2;var f=Xx(),m=Qx();(an!==t||St!==n)&&(Zc=null,ni(t,n)),n=!1;var b=xn;e:do try{if(Vt!==0&&xt!==null){var E=xt,C=za;switch(Vt){case 8:nh(),b=6;break e;case 3:case 2:case 9:case 6:_a.current===null&&(n=!0);var G=Vt;if(Vt=0,za=null,ai(t,E,C,G),l&&Js){b=0;break e}break;default:G=Vt,Vt=0,za=null,ai(t,E,C,G)}}k1(),b=xn;break}catch(te){Yx(t,te)}while(!0);return n&&t.shellSuspendCounter++,Vr=cs=null,Lt=o,L.H=f,L.A=m,xt===null&&(an=null,St=0,yc()),b}function k1(){for(;xt!==null;)Kx(xt)}function T1(t,n){var l=Lt;Lt|=2;var o=Xx(),f=Qx();an!==t||St!==n?(Zc=null,Kc=rn()+500,ni(t,n)):Js=Ct(t,n);e:do try{if(Vt!==0&&xt!==null){n=xt;var m=za;t:switch(Vt){case 1:Vt=0,za=null,ai(t,n,m,1);break;case 2:case 9:if(sg(m)){Vt=0,za=null,Zx(n);break}n=function(){Vt!==2&&Vt!==9||an!==t||(Vt=7),Rr(t)},m.then(n,n);break e;case 3:Vt=7;break e;case 4:Vt=5;break e;case 7:sg(m)?(Vt=0,za=null,Zx(n)):(Vt=0,za=null,ai(t,n,m,7));break;case 5:var b=null;switch(xt.tag){case 26:b=xt.memoizedState;case 5:case 27:var E=xt;if(b?zv(b):E.stateNode.complete){Vt=0,za=null;var C=E.sibling;if(C!==null)xt=C;else{var G=E.return;G!==null?(xt=G,eu(G)):xt=null}break t}}Vt=0,za=null,ai(t,n,m,5);break;case 6:Vt=0,za=null,ai(t,n,m,6);break;case 8:nh(),xn=6;break e;default:throw Error(s(462))}}A1();break}catch(te){Yx(t,te)}while(!0);return Vr=cs=null,L.H=o,L.A=f,Lt=l,xt!==null?0:(an=null,St=0,yc(),xn)}function A1(){for(;xt!==null&&!Fn();)Kx(xt)}function Kx(t){var n=bx(t.alternate,t,tl);t.memoizedProps=t.pendingProps,n===null?eu(t):xt=n}function Zx(t){var n=t,l=n.alternate;switch(n.tag){case 15:case 0:n=mx(l,n,n.pendingProps,n.type,void 0,St);break;case 11:n=mx(l,n,n.pendingProps,n.type.render,n.ref,St);break;case 5:vf(n);default:Sx(l,n),n=xt=Qp(n,tl),n=bx(l,n,tl)}t.memoizedProps=t.pendingProps,n===null?eu(t):xt=n}function ai(t,n,l,o){Vr=cs=null,vf(n),Ys=null,Fi=0;var f=n.return;try{if(x1(t,f,n,l,St)){xn=1,Hc(t,Ya(l,t.current)),xt=null;return}}catch(m){if(f!==null)throw xt=f,m;xn=1,Hc(t,Ya(l,t.current)),xt=null;return}n.flags&32768?(jt||o===1?t=!0:Js||(St&536870912)!==0?t=!1:(Rl=t=!0,(o===2||o===9||o===3||o===6)&&(o=_a.current,o!==null&&o.tag===13&&(o.flags|=16384))),Wx(n,t)):eu(n)}function eu(t){var n=t;do{if((n.flags&32768)!==0){Wx(n,Rl);return}t=n.return;var l=b1(n.alternate,n,tl);if(l!==null){xt=l;return}if(n=n.sibling,n!==null){xt=n;return}xt=n=t}while(n!==null);xn===0&&(xn=5)}function Wx(t,n){do{var l=w1(t.alternate,t);if(l!==null){l.flags&=32767,xt=l;return}if(l=t.return,l!==null&&(l.flags|=32768,l.subtreeFlags=0,l.deletions=null),!n&&(t=t.sibling,t!==null)){xt=t;return}xt=t=l}while(t!==null);xn=6,xt=null}function Jx(t,n,l,o,f,m,b,E,C){t.cancelPendingCommit=null;do tu();while(Bn!==0);if((Lt&6)!==0)throw Error(s(327));if(n!==null){if(n===t.current)throw Error(s(177));if(m=n.lanes|n.childLanes,m|=Fd,nt(t,l,m,b,E,C),t===an&&(xt=an=null,St=0),ti=n,Al=t,nl=l,Jf=m,eh=f,qx=o,(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?(t.callbackNode=null,t.callbackPriority=0,M1(Yn,function(){return rv(),null})):(t.callbackNode=null,t.callbackPriority=0),o=(n.flags&13878)!==0,(n.subtreeFlags&13878)!==0||o){o=L.T,L.T=null,f=F.p,F.p=2,b=Lt,Lt|=4;try{S1(t,n,l)}finally{Lt=b,F.p=f,L.T=o}}Bn=1,ev(),tv(),nv()}}function ev(){if(Bn===1){Bn=0;var t=Al,n=ti,l=(n.flags&13878)!==0;if((n.subtreeFlags&13878)!==0||l){l=L.T,L.T=null;var o=F.p;F.p=2;var f=Lt;Lt|=4;try{_x(n,t);var m=ph,b=Ip(t.containerInfo),E=m.focusedElem,C=m.selectionRange;if(b!==E&&E&&E.ownerDocument&&Bp(E.ownerDocument.documentElement,E)){if(C!==null&&Bd(E)){var G=C.start,te=C.end;if(te===void 0&&(te=G),"selectionStart"in E)E.selectionStart=G,E.selectionEnd=Math.min(te,E.value.length);else{var oe=E.ownerDocument||document,Q=oe&&oe.defaultView||window;if(Q.getSelection){var Z=Q.getSelection(),Me=E.textContent.length,Ye=Math.min(C.start,Me),Kt=C.end===void 0?Ye:Math.min(C.end,Me);!Z.extend&&Ye>Kt&&(b=Kt,Kt=Ye,Ye=b);var H=Up(E,Ye),z=Up(E,Kt);if(H&&z&&(Z.rangeCount!==1||Z.anchorNode!==H.node||Z.anchorOffset!==H.offset||Z.focusNode!==z.node||Z.focusOffset!==z.offset)){var V=oe.createRange();V.setStart(H.node,H.offset),Z.removeAllRanges(),Ye>Kt?(Z.addRange(V),Z.extend(z.node,z.offset)):(V.setEnd(z.node,z.offset),Z.addRange(V))}}}}for(oe=[],Z=E;Z=Z.parentNode;)Z.nodeType===1&&oe.push({element:Z,left:Z.scrollLeft,top:Z.scrollTop});for(typeof E.focus=="function"&&E.focus(),E=0;E<oe.length;E++){var le=oe[E];le.element.scrollLeft=le.left,le.element.scrollTop=le.top}}hu=!!mh,ph=mh=null}finally{Lt=f,F.p=o,L.T=l}}t.current=n,Bn=2}}function tv(){if(Bn===2){Bn=0;var t=Al,n=ti,l=(n.flags&8772)!==0;if((n.subtreeFlags&8772)!==0||l){l=L.T,L.T=null;var o=F.p;F.p=2;var f=Lt;Lt|=4;try{Ax(t,n.alternate,n)}finally{Lt=f,F.p=o,L.T=l}}Bn=3}}function nv(){if(Bn===4||Bn===3){Bn=0,Vn();var t=Al,n=ti,l=nl,o=qx;(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?Bn=5:(Bn=0,ti=Al=null,av(t,t.pendingLanes));var f=t.pendingLanes;if(f===0&&(Tl=null),q(l),n=n.stateNode,ee&&typeof ee.onCommitFiberRoot=="function")try{ee.onCommitFiberRoot(Pe,n,void 0,(n.current.flags&128)===128)}catch{}if(o!==null){n=L.T,f=F.p,F.p=2,L.T=null;try{for(var m=t.onRecoverableError,b=0;b<o.length;b++){var E=o[b];m(E.value,{componentStack:E.stack})}}finally{L.T=n,F.p=f}}(nl&3)!==0&&tu(),Rr(t),f=t.pendingLanes,(l&261930)!==0&&(f&42)!==0?t===th?io++:(io=0,th=t):io=0,oo(0)}}function av(t,n){(t.pooledCacheLanes&=n)===0&&(n=t.pooledCache,n!=null&&(t.pooledCache=null,qi(n)))}function tu(){return ev(),tv(),nv(),rv()}function rv(){if(Bn!==5)return!1;var t=Al,n=Jf;Jf=0;var l=q(nl),o=L.T,f=F.p;try{F.p=32>l?32:l,L.T=null,l=eh,eh=null;var m=Al,b=nl;if(Bn=0,ti=Al=null,nl=0,(Lt&6)!==0)throw Error(s(331));var E=Lt;if(Lt|=4,Bx(m.current),zx(m,m.current,b,l),Lt=E,oo(0,!1),ee&&typeof ee.onPostCommitFiberRoot=="function")try{ee.onPostCommitFiberRoot(Pe,m)}catch{}return!0}finally{F.p=f,L.T=o,av(t,n)}}function lv(t,n,l){n=Ya(l,n),n=Mf(t.stateNode,n,2),t=Sl(t,n,2),t!==null&&(gt(t,2),Rr(t))}function Yt(t,n,l){if(t.tag===3)lv(t,t,l);else for(;n!==null;){if(n.tag===3){lv(n,t,l);break}else if(n.tag===1){var o=n.stateNode;if(typeof n.type.getDerivedStateFromError=="function"||typeof o.componentDidCatch=="function"&&(Tl===null||!Tl.has(o))){t=Ya(l,t),l=sx(2),o=Sl(n,l,2),o!==null&&(ix(l,o,n,t),gt(o,2),Rr(o));break}}n=n.return}}function rh(t,n,l){var o=t.pingCache;if(o===null){o=t.pingCache=new j1;var f=new Set;o.set(n,f)}else f=o.get(n),f===void 0&&(f=new Set,o.set(n,f));f.has(l)||(Kf=!0,f.add(l),t=D1.bind(null,t,n,l),n.then(t,t))}function D1(t,n,l){var o=t.pingCache;o!==null&&o.delete(n),t.pingedLanes|=t.suspendedLanes&l,t.warmLanes&=~l,an===t&&(St&l)===l&&(xn===4||xn===3&&(St&62914560)===St&&300>rn()-Qc?(Lt&2)===0&&ni(t,0):Zf|=l,ei===St&&(ei=0)),Rr(t)}function sv(t,n){n===0&&(n=en()),t=ss(t,n),t!==null&&(gt(t,n),Rr(t))}function C1(t){var n=t.memoizedState,l=0;n!==null&&(l=n.retryLane),sv(t,l)}function O1(t,n){var l=0;switch(t.tag){case 31:case 13:var o=t.stateNode,f=t.memoizedState;f!==null&&(l=f.retryLane);break;case 19:o=t.stateNode;break;case 22:o=t.stateNode._retryCache;break;default:throw Error(s(314))}o!==null&&o.delete(n),sv(t,l)}function M1(t,n){return $t(t,n)}var nu=null,ri=null,lh=!1,au=!1,sh=!1,Cl=0;function Rr(t){t!==ri&&t.next===null&&(ri===null?nu=ri=t:ri=ri.next=t),au=!0,lh||(lh=!0,L1())}function oo(t,n){if(!sh&&au){sh=!0;do for(var l=!1,o=nu;o!==null;){if(t!==0){var f=o.pendingLanes;if(f===0)var m=0;else{var b=o.suspendedLanes,E=o.pingedLanes;m=(1<<31-Jt(42|t)+1)-1,m&=f&~(b&~E),m=m&201326741?m&201326741|1:m?m|2:0}m!==0&&(l=!0,uv(o,m))}else m=St,m=qt(o,o===an?m:0,o.cancelPendingCommit!==null||o.timeoutHandle!==-1),(m&3)===0||Ct(o,m)||(l=!0,uv(o,m));o=o.next}while(l);sh=!1}}function _1(){iv()}function iv(){au=lh=!1;var t=0;Cl!==0&&V1()&&(t=Cl);for(var n=rn(),l=null,o=nu;o!==null;){var f=o.next,m=ov(o,n);m===0?(o.next=null,l===null?nu=f:l.next=f,f===null&&(ri=l)):(l=o,(t!==0||(m&3)!==0)&&(au=!0)),o=f}Bn!==0&&Bn!==5||oo(t),Cl!==0&&(Cl=0)}function ov(t,n){for(var l=t.suspendedLanes,o=t.pingedLanes,f=t.expirationTimes,m=t.pendingLanes&-62914561;0<m;){var b=31-Jt(m),E=1<<b,C=f[b];C===-1?((E&l)===0||(E&o)!==0)&&(f[b]=ln(E,n)):C<=n&&(t.expiredLanes|=E),m&=~E}if(n=an,l=St,l=qt(t,t===n?l:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),o=t.callbackNode,l===0||t===n&&(Vt===2||Vt===9)||t.cancelPendingCommit!==null)return o!==null&&o!==null&&Wt(o),t.callbackNode=null,t.callbackPriority=0;if((l&3)===0||Ct(t,l)){if(n=l&-l,n===t.callbackPriority)return n;switch(o!==null&&Wt(o),q(l)){case 2:case 8:l=aa;break;case 32:l=Yn;break;case 268435456:l=Ae;break;default:l=Yn}return o=cv.bind(null,t),l=$t(l,o),t.callbackPriority=n,t.callbackNode=l,n}return o!==null&&o!==null&&Wt(o),t.callbackPriority=2,t.callbackNode=null,2}function cv(t,n){if(Bn!==0&&Bn!==5)return t.callbackNode=null,t.callbackPriority=0,null;var l=t.callbackNode;if(tu()&&t.callbackNode!==l)return null;var o=St;return o=qt(t,t===an?o:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),o===0?null:(Fx(t,o,n),ov(t,rn()),t.callbackNode!=null&&t.callbackNode===l?cv.bind(null,t):null)}function uv(t,n){if(tu())return null;Fx(t,n,!0)}function L1(){G1(function(){(Lt&6)!==0?$t(ma,_1):iv()})}function ih(){if(Cl===0){var t=Ps;t===0&&(t=_e,_e<<=1,(_e&261888)===0&&(_e=256)),Cl=t}return Cl}function dv(t){return t==null||typeof t=="symbol"||typeof t=="boolean"?null:typeof t=="function"?t:sn(""+t)}function fv(t,n){var l=n.ownerDocument.createElement("input");return l.name=n.name,l.value=n.value,t.id&&l.setAttribute("form",t.id),n.parentNode.insertBefore(l,n),t=new FormData(t),l.parentNode.removeChild(l),t}function z1(t,n,l,o,f){if(n==="submit"&&l&&l.stateNode===f){var m=dv((f[Ce]||null).action),b=o.submitter;b&&(n=(n=b[Ce]||null)?dv(n.formAction):b.getAttribute("formAction"),n!==null&&(m=n,b=null));var E=new Hr("action","action",null,o,f);t.push({event:E,listeners:[{instance:null,listener:function(){if(o.defaultPrevented){if(Cl!==0){var C=b?fv(f,b):new FormData(f);kf(l,{pending:!0,data:C,method:f.method,action:m},null,C)}}else typeof m=="function"&&(E.preventDefault(),C=b?fv(f,b):new FormData(f),kf(l,{pending:!0,data:C,method:f.method,action:m},m,C))},currentTarget:f}]})}}for(var oh=0;oh<Pd.length;oh++){var ch=Pd[oh],$1=ch.toLowerCase(),U1=ch[0].toUpperCase()+ch.slice(1);or($1,"on"+U1)}or(Pp,"onAnimationEnd"),or(Fp,"onAnimationIteration"),or(Vp,"onAnimationStart"),or("dblclick","onDoubleClick"),or("focusin","onFocus"),or("focusout","onBlur"),or(e1,"onTransitionRun"),or(t1,"onTransitionStart"),or(n1,"onTransitionCancel"),or(Yp,"onTransitionEnd"),zn("onMouseEnter",["mouseout","mouseover"]),zn("onMouseLeave",["mouseout","mouseover"]),zn("onPointerEnter",["pointerout","pointerover"]),zn("onPointerLeave",["pointerout","pointerover"]),Rn("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Rn("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Rn("onBeforeInput",["compositionend","keypress","textInput","paste"]),Rn("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Rn("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Rn("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var co="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(" "),B1=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(co));function hv(t,n){n=(n&4)!==0;for(var l=0;l<t.length;l++){var o=t[l],f=o.event;o=o.listeners;e:{var m=void 0;if(n)for(var b=o.length-1;0<=b;b--){var E=o[b],C=E.instance,G=E.currentTarget;if(E=E.listener,C!==m&&f.isPropagationStopped())break e;m=E,f.currentTarget=G;try{m(f)}catch(te){vc(te)}f.currentTarget=null,m=C}else for(b=0;b<o.length;b++){if(E=o[b],C=E.instance,G=E.currentTarget,E=E.listener,C!==m&&f.isPropagationStopped())break e;m=E,f.currentTarget=G;try{m(f)}catch(te){vc(te)}f.currentTarget=null,m=C}}}}function vt(t,n){var l=n[Le];l===void 0&&(l=n[Le]=new Set);var o=t+"__bubble";l.has(o)||(mv(n,t,2,!1),l.add(o))}function uh(t,n,l){var o=0;n&&(o|=4),mv(l,t,o,n)}var ru="_reactListening"+Math.random().toString(36).slice(2);function dh(t){if(!t[ru]){t[ru]=!0,tn.forEach(function(l){l!=="selectionchange"&&(B1.has(l)||uh(l,!1,t),uh(l,!0,t))});var n=t.nodeType===9?t:t.ownerDocument;n===null||n[ru]||(n[ru]=!0,uh("selectionchange",!1,n))}}function mv(t,n,l,o){switch(Pv(n)){case 2:var f=hS;break;case 8:f=mS;break;default:f=Rh}l=f.bind(null,n,l,t),f=void 0,!Mi||n!=="touchstart"&&n!=="touchmove"&&n!=="wheel"||(f=!0),o?f!==void 0?t.addEventListener(n,l,{capture:!0,passive:f}):t.addEventListener(n,l,!0):f!==void 0?t.addEventListener(n,l,{passive:f}):t.addEventListener(n,l,!1)}function fh(t,n,l,o,f){var m=o;if((n&1)===0&&(n&2)===0&&o!==null)e:for(;;){if(o===null)return;var b=o.tag;if(b===3||b===4){var E=o.stateNode.containerInfo;if(E===f)break;if(b===4)for(b=o.return;b!==null;){var C=b.tag;if((C===3||C===4)&&b.stateNode.containerInfo===f)return;b=b.return}for(;E!==null;){if(b=Ft(E),b===null)return;if(C=b.tag,C===5||C===6||C===26||C===27){o=m=b;continue e}E=E.parentNode}}o=o.return}Oi(function(){var G=m,te=zr(l),oe=[];e:{var Q=Gp.get(t);if(Q!==void 0){var Z=Hr,Me=t;switch(t){case"keypress":if(Ms(l)===0)break e;case"keydown":case"keyup":Z=Tn;break;case"focusin":Me="focus",Z=we;break;case"focusout":Me="blur",Z=we;break;case"beforeblur":case"afterblur":Z=we;break;case"click":if(l.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":Z=mc;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Z=X;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Z=Sr;break;case Pp:case Fp:case Vp:Z=de;break;case Yp:Z=pc;break;case"scroll":case"scrollend":Z=Od;break;case"wheel":Z=_d;break;case"copy":case"cut":case"paste":Z=Ne;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Z=Bt;break;case"toggle":case"beforetoggle":Z=Hw}var Ye=(n&4)!==0,Kt=!Ye&&(t==="scroll"||t==="scrollend"),H=Ye?Q!==null?Q+"Capture":null:Q;Ye=[];for(var z=G,V;z!==null;){var le=z;if(V=le.stateNode,le=le.tag,le!==5&&le!==26&&le!==27||V===null||H===null||(le=Pa(z,H),le!=null&&Ye.push(uo(z,le,V))),Kt)break;z=z.return}0<Ye.length&&(Q=new Z(Q,Me,null,l,te),oe.push({event:Q,listeners:Ye}))}}if((n&7)===0){e:{if(Q=t==="mouseover"||t==="pointerover",Z=t==="mouseout"||t==="pointerout",Q&&l!==Ca&&(Me=l.relatedTarget||l.fromElement)&&(Ft(Me)||Me[Re]))break e;if((Z||Q)&&(Q=te.window===te?te:(Q=te.ownerDocument)?Q.defaultView||Q.parentWindow:window,Z?(Me=l.relatedTarget||l.toElement,Z=G,Me=Me?Ft(Me):null,Me!==null&&(Kt=c(Me),Ye=Me.tag,Me!==Kt||Ye!==5&&Ye!==27&&Ye!==6)&&(Me=null)):(Z=null,Me=G),Z!==Me)){if(Ye=mc,le="onMouseLeave",H="onMouseEnter",z="mouse",(t==="pointerout"||t==="pointerover")&&(Ye=Bt,le="onPointerLeave",H="onPointerEnter",z="pointer"),Kt=Z==null?Q:ht(Z),V=Me==null?Q:ht(Me),Q=new Ye(le,z+"leave",Z,l,te),Q.target=Kt,Q.relatedTarget=V,le=null,Ft(te)===G&&(Ye=new Ye(H,z+"enter",Me,l,te),Ye.target=V,Ye.relatedTarget=Kt,le=Ye),Kt=le,Z&&Me)t:{for(Ye=I1,H=Z,z=Me,V=0,le=H;le;le=Ye(le))V++;le=0;for(var He=z;He;He=Ye(He))le++;for(;0<V-le;)H=Ye(H),V--;for(;0<le-V;)z=Ye(z),le--;for(;V--;){if(H===z||z!==null&&H===z.alternate){Ye=H;break t}H=Ye(H),z=Ye(z)}Ye=null}else Ye=null;Z!==null&&pv(oe,Q,Z,Ye,!1),Me!==null&&Kt!==null&&pv(oe,Kt,Me,Ye,!0)}}e:{if(Q=G?ht(G):window,Z=Q.nodeName&&Q.nodeName.toLowerCase(),Z==="select"||Z==="input"&&Q.type==="file")var Mt=Op;else if(Dp(Q))if(Mp)Mt=Zw;else{Mt=Qw;var ze=Xw}else Z=Q.nodeName,!Z||Z.toLowerCase()!=="input"||Q.type!=="checkbox"&&Q.type!=="radio"?G&&Jl(G.elementType)&&(Mt=Op):Mt=Kw;if(Mt&&(Mt=Mt(t,G))){Cp(oe,Mt,l,te);break e}ze&&ze(t,Q,G),t==="focusout"&&G&&Q.type==="number"&&G.memoizedProps.value!=null&&Ot(Q,"number",Q.value)}switch(ze=G?ht(G):window,t){case"focusin":(Dp(ze)||ze.contentEditable==="true")&&(Ls=ze,Id=G,Bi=null);break;case"focusout":Bi=Id=Ls=null;break;case"mousedown":Hd=!0;break;case"contextmenu":case"mouseup":case"dragend":Hd=!1,Hp(oe,l,te);break;case"selectionchange":if(Jw)break;case"keydown":case"keyup":Hp(oe,l,te)}var ft;if(zd)e:{switch(t){case"compositionstart":var Nt="onCompositionStart";break e;case"compositionend":Nt="onCompositionEnd";break e;case"compositionupdate":Nt="onCompositionUpdate";break e}Nt=void 0}else _s?Tp(t,l)&&(Nt="onCompositionEnd"):t==="keydown"&&l.keyCode===229&&(Nt="onCompositionStart");Nt&&(jp&&l.locale!=="ko"&&(_s||Nt!=="onCompositionStart"?Nt==="onCompositionEnd"&&_s&&(ft=fc()):(Fa=te,_i="value"in Fa?Fa.value:Fa.textContent,_s=!0)),ze=lu(G,Nt),0<ze.length&&(Nt=new it(Nt,t,null,l,te),oe.push({event:Nt,listeners:ze}),ft?Nt.data=ft:(ft=Ap(l),ft!==null&&(Nt.data=ft)))),(ft=Pw?Fw(t,l):Vw(t,l))&&(Nt=lu(G,"onBeforeInput"),0<Nt.length&&(ze=new it("onBeforeInput","beforeinput",null,l,te),oe.push({event:ze,listeners:Nt}),ze.data=ft)),z1(oe,t,G,l,te)}hv(oe,n)})}function uo(t,n,l){return{instance:t,listener:n,currentTarget:l}}function lu(t,n){for(var l=n+"Capture",o=[];t!==null;){var f=t,m=f.stateNode;if(f=f.tag,f!==5&&f!==26&&f!==27||m===null||(f=Pa(t,l),f!=null&&o.unshift(uo(t,f,m)),f=Pa(t,n),f!=null&&o.push(uo(t,f,m))),t.tag===3)return o;t=t.return}return[]}function I1(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5&&t.tag!==27);return t||null}function pv(t,n,l,o,f){for(var m=n._reactName,b=[];l!==null&&l!==o;){var E=l,C=E.alternate,G=E.stateNode;if(E=E.tag,C!==null&&C===o)break;E!==5&&E!==26&&E!==27||G===null||(C=G,f?(G=Pa(l,m),G!=null&&b.unshift(uo(l,G,C))):f||(G=Pa(l,m),G!=null&&b.push(uo(l,G,C)))),l=l.return}b.length!==0&&t.push({event:n,listeners:b})}var H1=/\r\n?/g,q1=/\u0000|\uFFFD/g;function gv(t){return(typeof t=="string"?t:""+t).replace(H1,`
49
- `).replace(q1,"")}function xv(t,n){return n=gv(n),gv(t)===n}function Qt(t,n,l,o,f,m){switch(l){case"children":typeof o=="string"?n==="body"||n==="textarea"&&o===""||ml(t,o):(typeof o=="number"||typeof o=="bigint")&&n!=="body"&&ml(t,""+o);break;case"className":vr(t,"class",o);break;case"tabIndex":vr(t,"tabindex",o);break;case"dir":case"role":case"viewBox":case"width":case"height":vr(t,l,o);break;case"style":ya(t,o,m);break;case"data":if(n!=="object"){vr(t,"data",o);break}case"src":case"href":if(o===""&&(n!=="a"||l!=="href")){t.removeAttribute(l);break}if(o==null||typeof o=="function"||typeof o=="symbol"||typeof o=="boolean"){t.removeAttribute(l);break}o=sn(""+o),t.setAttribute(l,o);break;case"action":case"formAction":if(typeof o=="function"){t.setAttribute(l,"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 m=="function"&&(l==="formAction"?(n!=="input"&&Qt(t,n,"name",f.name,f,null),Qt(t,n,"formEncType",f.formEncType,f,null),Qt(t,n,"formMethod",f.formMethod,f,null),Qt(t,n,"formTarget",f.formTarget,f,null)):(Qt(t,n,"encType",f.encType,f,null),Qt(t,n,"method",f.method,f,null),Qt(t,n,"target",f.target,f,null)));if(o==null||typeof o=="symbol"||typeof o=="boolean"){t.removeAttribute(l);break}o=sn(""+o),t.setAttribute(l,o);break;case"onClick":o!=null&&(t.onclick=sa);break;case"onScroll":o!=null&&vt("scroll",t);break;case"onScrollEnd":o!=null&&vt("scrollend",t);break;case"dangerouslySetInnerHTML":if(o!=null){if(typeof o!="object"||!("__html"in o))throw Error(s(61));if(l=o.__html,l!=null){if(f.children!=null)throw Error(s(60));t.innerHTML=l}}break;case"multiple":t.multiple=o&&typeof o!="function"&&typeof o!="symbol";break;case"muted":t.muted=o&&typeof o!="function"&&typeof o!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(o==null||typeof o=="function"||typeof o=="boolean"||typeof o=="symbol"){t.removeAttribute("xlink:href");break}l=sn(""+o),t.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",l);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":o!=null&&typeof o!="function"&&typeof o!="symbol"?t.setAttribute(l,""+o):t.removeAttribute(l);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":o&&typeof o!="function"&&typeof o!="symbol"?t.setAttribute(l,""):t.removeAttribute(l);break;case"capture":case"download":o===!0?t.setAttribute(l,""):o!==!1&&o!=null&&typeof o!="function"&&typeof o!="symbol"?t.setAttribute(l,o):t.removeAttribute(l);break;case"cols":case"rows":case"size":case"span":o!=null&&typeof o!="function"&&typeof o!="symbol"&&!isNaN(o)&&1<=o?t.setAttribute(l,o):t.removeAttribute(l);break;case"rowSpan":case"start":o==null||typeof o=="function"||typeof o=="symbol"||isNaN(o)?t.removeAttribute(l):t.setAttribute(l,o);break;case"popover":vt("beforetoggle",t),vt("toggle",t),ra(t,"popover",o);break;case"xlinkActuate":Je(t,"http://www.w3.org/1999/xlink","xlink:actuate",o);break;case"xlinkArcrole":Je(t,"http://www.w3.org/1999/xlink","xlink:arcrole",o);break;case"xlinkRole":Je(t,"http://www.w3.org/1999/xlink","xlink:role",o);break;case"xlinkShow":Je(t,"http://www.w3.org/1999/xlink","xlink:show",o);break;case"xlinkTitle":Je(t,"http://www.w3.org/1999/xlink","xlink:title",o);break;case"xlinkType":Je(t,"http://www.w3.org/1999/xlink","xlink:type",o);break;case"xmlBase":Je(t,"http://www.w3.org/XML/1998/namespace","xml:base",o);break;case"xmlLang":Je(t,"http://www.w3.org/XML/1998/namespace","xml:lang",o);break;case"xmlSpace":Je(t,"http://www.w3.org/XML/1998/namespace","xml:space",o);break;case"is":ra(t,"is",o);break;case"innerText":case"textContent":break;default:(!(2<l.length)||l[0]!=="o"&&l[0]!=="O"||l[1]!=="n"&&l[1]!=="N")&&(l=Cs.get(l)||l,ra(t,l,o))}}function hh(t,n,l,o,f,m){switch(l){case"style":ya(t,o,m);break;case"dangerouslySetInnerHTML":if(o!=null){if(typeof o!="object"||!("__html"in o))throw Error(s(61));if(l=o.__html,l!=null){if(f.children!=null)throw Error(s(60));t.innerHTML=l}}break;case"children":typeof o=="string"?ml(t,o):(typeof o=="number"||typeof o=="bigint")&&ml(t,""+o);break;case"onScroll":o!=null&&vt("scroll",t);break;case"onScrollEnd":o!=null&&vt("scrollend",t);break;case"onClick":o!=null&&(t.onclick=sa);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Kn.hasOwnProperty(l))e:{if(l[0]==="o"&&l[1]==="n"&&(f=l.endsWith("Capture"),n=l.slice(2,f?l.length-7:void 0),m=t[Ce]||null,m=m!=null?m[l]:null,typeof m=="function"&&t.removeEventListener(n,m,f),typeof o=="function")){typeof m!="function"&&m!==null&&(l in t?t[l]=null:t.hasAttribute(l)&&t.removeAttribute(l)),t.addEventListener(n,o,f);break e}l in t?t[l]=o:o===!0?t.setAttribute(l,""):ra(t,l,o)}}}function na(t,n,l){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":vt("error",t),vt("load",t);var o=!1,f=!1,m;for(m in l)if(l.hasOwnProperty(m)){var b=l[m];if(b!=null)switch(m){case"src":o=!0;break;case"srcSet":f=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(s(137,n));default:Qt(t,n,m,b,l,null)}}f&&Qt(t,n,"srcSet",l.srcSet,l,null),o&&Qt(t,n,"src",l.src,l,null);return;case"input":vt("invalid",t);var E=m=b=f=null,C=null,G=null;for(o in l)if(l.hasOwnProperty(o)){var te=l[o];if(te!=null)switch(o){case"name":f=te;break;case"type":b=te;break;case"checked":C=te;break;case"defaultChecked":G=te;break;case"value":m=te;break;case"defaultValue":E=te;break;case"children":case"dangerouslySetInnerHTML":if(te!=null)throw Error(s(137,n));break;default:Qt(t,n,o,te,l,null)}}Di(t,m,E,C,G,b,f,!1);return;case"select":vt("invalid",t),o=b=m=null;for(f in l)if(l.hasOwnProperty(f)&&(E=l[f],E!=null))switch(f){case"value":m=E;break;case"defaultValue":b=E;break;case"multiple":o=E;default:Qt(t,n,f,E,l,null)}n=m,l=b,t.multiple=!!o,n!=null?yr(t,!!o,n,!1):l!=null&&yr(t,!!o,l,!0);return;case"textarea":vt("invalid",t),m=f=o=null;for(b in l)if(l.hasOwnProperty(b)&&(E=l[b],E!=null))switch(b){case"value":o=E;break;case"defaultValue":f=E;break;case"children":m=E;break;case"dangerouslySetInnerHTML":if(E!=null)throw Error(s(91));break;default:Qt(t,n,b,E,l,null)}sr(t,o,f,m);return;case"option":for(C in l)if(l.hasOwnProperty(C)&&(o=l[C],o!=null))switch(C){case"selected":t.selected=o&&typeof o!="function"&&typeof o!="symbol";break;default:Qt(t,n,C,o,l,null)}return;case"dialog":vt("beforetoggle",t),vt("toggle",t),vt("cancel",t),vt("close",t);break;case"iframe":case"object":vt("load",t);break;case"video":case"audio":for(o=0;o<co.length;o++)vt(co[o],t);break;case"image":vt("error",t),vt("load",t);break;case"details":vt("toggle",t);break;case"embed":case"source":case"link":vt("error",t),vt("load",t);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(G in l)if(l.hasOwnProperty(G)&&(o=l[G],o!=null))switch(G){case"children":case"dangerouslySetInnerHTML":throw Error(s(137,n));default:Qt(t,n,G,o,l,null)}return;default:if(Jl(n)){for(te in l)l.hasOwnProperty(te)&&(o=l[te],o!==void 0&&hh(t,n,te,o,l,void 0));return}}for(E in l)l.hasOwnProperty(E)&&(o=l[E],o!=null&&Qt(t,n,E,o,l,null))}function P1(t,n,l,o){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var f=null,m=null,b=null,E=null,C=null,G=null,te=null;for(Z in l){var oe=l[Z];if(l.hasOwnProperty(Z)&&oe!=null)switch(Z){case"checked":break;case"value":break;case"defaultValue":C=oe;default:o.hasOwnProperty(Z)||Qt(t,n,Z,null,o,oe)}}for(var Q in o){var Z=o[Q];if(oe=l[Q],o.hasOwnProperty(Q)&&(Z!=null||oe!=null))switch(Q){case"type":m=Z;break;case"name":f=Z;break;case"checked":G=Z;break;case"defaultChecked":te=Z;break;case"value":b=Z;break;case"defaultValue":E=Z;break;case"children":case"dangerouslySetInnerHTML":if(Z!=null)throw Error(s(137,n));break;default:Z!==oe&&Qt(t,n,Q,Z,o,oe)}}Wl(t,b,E,C,G,te,m,f);return;case"select":Z=b=E=Q=null;for(m in l)if(C=l[m],l.hasOwnProperty(m)&&C!=null)switch(m){case"value":break;case"multiple":Z=C;default:o.hasOwnProperty(m)||Qt(t,n,m,null,o,C)}for(f in o)if(m=o[f],C=l[f],o.hasOwnProperty(f)&&(m!=null||C!=null))switch(f){case"value":Q=m;break;case"defaultValue":E=m;break;case"multiple":b=m;default:m!==C&&Qt(t,n,f,m,o,C)}n=E,l=b,o=Z,Q!=null?yr(t,!!l,Q,!1):!!o!=!!l&&(n!=null?yr(t,!!l,n,!0):yr(t,!!l,l?[]:"",!1));return;case"textarea":Z=Q=null;for(E in l)if(f=l[E],l.hasOwnProperty(E)&&f!=null&&!o.hasOwnProperty(E))switch(E){case"value":break;case"children":break;default:Qt(t,n,E,null,o,f)}for(b in o)if(f=o[b],m=l[b],o.hasOwnProperty(b)&&(f!=null||m!=null))switch(b){case"value":Q=f;break;case"defaultValue":Z=f;break;case"children":break;case"dangerouslySetInnerHTML":if(f!=null)throw Error(s(91));break;default:f!==m&&Qt(t,n,b,f,o,m)}dc(t,Q,Z);return;case"option":for(var Me in l)if(Q=l[Me],l.hasOwnProperty(Me)&&Q!=null&&!o.hasOwnProperty(Me))switch(Me){case"selected":t.selected=!1;break;default:Qt(t,n,Me,null,o,Q)}for(C in o)if(Q=o[C],Z=l[C],o.hasOwnProperty(C)&&Q!==Z&&(Q!=null||Z!=null))switch(C){case"selected":t.selected=Q&&typeof Q!="function"&&typeof Q!="symbol";break;default:Qt(t,n,C,Q,o,Z)}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 Ye in l)Q=l[Ye],l.hasOwnProperty(Ye)&&Q!=null&&!o.hasOwnProperty(Ye)&&Qt(t,n,Ye,null,o,Q);for(G in o)if(Q=o[G],Z=l[G],o.hasOwnProperty(G)&&Q!==Z&&(Q!=null||Z!=null))switch(G){case"children":case"dangerouslySetInnerHTML":if(Q!=null)throw Error(s(137,n));break;default:Qt(t,n,G,Q,o,Z)}return;default:if(Jl(n)){for(var Kt in l)Q=l[Kt],l.hasOwnProperty(Kt)&&Q!==void 0&&!o.hasOwnProperty(Kt)&&hh(t,n,Kt,void 0,o,Q);for(te in o)Q=o[te],Z=l[te],!o.hasOwnProperty(te)||Q===Z||Q===void 0&&Z===void 0||hh(t,n,te,Q,o,Z);return}}for(var H in l)Q=l[H],l.hasOwnProperty(H)&&Q!=null&&!o.hasOwnProperty(H)&&Qt(t,n,H,null,o,Q);for(oe in o)Q=o[oe],Z=l[oe],!o.hasOwnProperty(oe)||Q===Z||Q==null&&Z==null||Qt(t,n,oe,Q,o,Z)}function vv(t){switch(t){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function F1(){if(typeof performance.getEntriesByType=="function"){for(var t=0,n=0,l=performance.getEntriesByType("resource"),o=0;o<l.length;o++){var f=l[o],m=f.transferSize,b=f.initiatorType,E=f.duration;if(m&&E&&vv(b)){for(b=0,E=f.responseEnd,o+=1;o<l.length;o++){var C=l[o],G=C.startTime;if(G>E)break;var te=C.transferSize,oe=C.initiatorType;te&&vv(oe)&&(C=C.responseEnd,b+=te*(C<E?1:(E-G)/(C-G)))}if(--o,n+=8*(m+b)/(f.duration/1e3),t++,10<t)break}}if(0<t)return n/t/1e6}return navigator.connection&&(t=navigator.connection.downlink,typeof t=="number")?t:5}var mh=null,ph=null;function su(t){return t.nodeType===9?t:t.ownerDocument}function yv(t){switch(t){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function bv(t,n){if(t===0)switch(n){case"svg":return 1;case"math":return 2;default:return 0}return t===1&&n==="foreignObject"?0:t}function gh(t,n){return t==="textarea"||t==="noscript"||typeof n.children=="string"||typeof n.children=="number"||typeof n.children=="bigint"||typeof n.dangerouslySetInnerHTML=="object"&&n.dangerouslySetInnerHTML!==null&&n.dangerouslySetInnerHTML.__html!=null}var xh=null;function V1(){var t=window.event;return t&&t.type==="popstate"?t===xh?!1:(xh=t,!0):(xh=null,!1)}var wv=typeof setTimeout=="function"?setTimeout:void 0,Y1=typeof clearTimeout=="function"?clearTimeout:void 0,Sv=typeof Promise=="function"?Promise:void 0,G1=typeof queueMicrotask=="function"?queueMicrotask:typeof Sv<"u"?function(t){return Sv.resolve(null).then(t).catch(X1)}:wv;function X1(t){setTimeout(function(){throw t})}function Ol(t){return t==="head"}function Nv(t,n){var l=n,o=0;do{var f=l.nextSibling;if(t.removeChild(l),f&&f.nodeType===8)if(l=f.data,l==="/$"||l==="/&"){if(o===0){t.removeChild(f),oi(n);return}o--}else if(l==="$"||l==="$?"||l==="$~"||l==="$!"||l==="&")o++;else if(l==="html")fo(t.ownerDocument.documentElement);else if(l==="head"){l=t.ownerDocument.head,fo(l);for(var m=l.firstChild;m;){var b=m.nextSibling,E=m.nodeName;m[tt]||E==="SCRIPT"||E==="STYLE"||E==="LINK"&&m.rel.toLowerCase()==="stylesheet"||l.removeChild(m),m=b}}else l==="body"&&fo(t.ownerDocument.body);l=f}while(l);oi(n)}function Ev(t,n){var l=t;t=0;do{var o=l.nextSibling;if(l.nodeType===1?n?(l._stashedDisplay=l.style.display,l.style.display="none"):(l.style.display=l._stashedDisplay||"",l.getAttribute("style")===""&&l.removeAttribute("style")):l.nodeType===3&&(n?(l._stashedText=l.nodeValue,l.nodeValue=""):l.nodeValue=l._stashedText||""),o&&o.nodeType===8)if(l=o.data,l==="/$"){if(t===0)break;t--}else l!=="$"&&l!=="$?"&&l!=="$~"&&l!=="$!"||t++;l=o}while(l)}function vh(t){var n=t.firstChild;for(n&&n.nodeType===10&&(n=n.nextSibling);n;){var l=n;switch(n=n.nextSibling,l.nodeName){case"HTML":case"HEAD":case"BODY":vh(l),Fe(l);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(l.rel.toLowerCase()==="stylesheet")continue}t.removeChild(l)}}function Q1(t,n,l,o){for(;t.nodeType===1;){var f=l;if(t.nodeName.toLowerCase()!==n.toLowerCase()){if(!o&&(t.nodeName!=="INPUT"||t.type!=="hidden"))break}else if(o){if(!t[tt])switch(n){case"meta":if(!t.hasAttribute("itemprop"))break;return t;case"link":if(m=t.getAttribute("rel"),m==="stylesheet"&&t.hasAttribute("data-precedence"))break;if(m!==f.rel||t.getAttribute("href")!==(f.href==null||f.href===""?null:f.href)||t.getAttribute("crossorigin")!==(f.crossOrigin==null?null:f.crossOrigin)||t.getAttribute("title")!==(f.title==null?null:f.title))break;return t;case"style":if(t.hasAttribute("data-precedence"))break;return t;case"script":if(m=t.getAttribute("src"),(m!==(f.src==null?null:f.src)||t.getAttribute("type")!==(f.type==null?null:f.type)||t.getAttribute("crossorigin")!==(f.crossOrigin==null?null:f.crossOrigin))&&m&&t.hasAttribute("async")&&!t.hasAttribute("itemprop"))break;return t;default:return t}}else if(n==="input"&&t.type==="hidden"){var m=f.name==null?null:""+f.name;if(f.type==="hidden"&&t.getAttribute("name")===m)return t}else return t;if(t=Za(t.nextSibling),t===null)break}return null}function K1(t,n,l){if(n==="")return null;for(;t.nodeType!==3;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!l||(t=Za(t.nextSibling),t===null))return null;return t}function jv(t,n){for(;t.nodeType!==8;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!n||(t=Za(t.nextSibling),t===null))return null;return t}function yh(t){return t.data==="$?"||t.data==="$~"}function bh(t){return t.data==="$!"||t.data==="$?"&&t.ownerDocument.readyState!=="loading"}function Z1(t,n){var l=t.ownerDocument;if(t.data==="$~")t._reactRetry=n;else if(t.data!=="$?"||l.readyState!=="loading")n();else{var o=function(){n(),l.removeEventListener("DOMContentLoaded",o)};l.addEventListener("DOMContentLoaded",o),t._reactRetry=o}}function Za(t){for(;t!=null;t=t.nextSibling){var n=t.nodeType;if(n===1||n===3)break;if(n===8){if(n=t.data,n==="$"||n==="$!"||n==="$?"||n==="$~"||n==="&"||n==="F!"||n==="F")break;if(n==="/$"||n==="/&")return null}}return t}var wh=null;function Rv(t){t=t.nextSibling;for(var n=0;t;){if(t.nodeType===8){var l=t.data;if(l==="/$"||l==="/&"){if(n===0)return Za(t.nextSibling);n--}else l!=="$"&&l!=="$!"&&l!=="$?"&&l!=="$~"&&l!=="&"||n++}t=t.nextSibling}return null}function kv(t){t=t.previousSibling;for(var n=0;t;){if(t.nodeType===8){var l=t.data;if(l==="$"||l==="$!"||l==="$?"||l==="$~"||l==="&"){if(n===0)return t;n--}else l!=="/$"&&l!=="/&"||n++}t=t.previousSibling}return null}function Tv(t,n,l){switch(n=su(l),t){case"html":if(t=n.documentElement,!t)throw Error(s(452));return t;case"head":if(t=n.head,!t)throw Error(s(453));return t;case"body":if(t=n.body,!t)throw Error(s(454));return t;default:throw Error(s(451))}}function fo(t){for(var n=t.attributes;n.length;)t.removeAttributeNode(n[0]);Fe(t)}var Wa=new Map,Av=new Set;function iu(t){return typeof t.getRootNode=="function"?t.getRootNode():t.nodeType===9?t:t.ownerDocument}var al=F.d;F.d={f:W1,r:J1,D:eS,C:tS,L:nS,m:aS,X:lS,S:rS,M:sS};function W1(){var t=al.f(),n=Wc();return t||n}function J1(t){var n=at(t);n!==null&&n.tag===5&&n.type==="form"?Yg(n):al.r(t)}var li=typeof document>"u"?null:document;function Dv(t,n,l){var o=li;if(o&&typeof n=="string"&&n){var f=Wn(n);f='link[rel="'+t+'"][href="'+f+'"]',typeof l=="string"&&(f+='[crossorigin="'+l+'"]'),Av.has(f)||(Av.add(f),t={rel:t,crossOrigin:l,href:n},o.querySelector(f)===null&&(n=o.createElement("link"),na(n,"link",t),mt(n),o.head.appendChild(n)))}}function eS(t){al.D(t),Dv("dns-prefetch",t,null)}function tS(t,n){al.C(t,n),Dv("preconnect",t,n)}function nS(t,n,l){al.L(t,n,l);var o=li;if(o&&t&&n){var f='link[rel="preload"][as="'+Wn(n)+'"]';n==="image"&&l&&l.imageSrcSet?(f+='[imagesrcset="'+Wn(l.imageSrcSet)+'"]',typeof l.imageSizes=="string"&&(f+='[imagesizes="'+Wn(l.imageSizes)+'"]')):f+='[href="'+Wn(t)+'"]';var m=f;switch(n){case"style":m=si(t);break;case"script":m=ii(t)}Wa.has(m)||(t=y({rel:"preload",href:n==="image"&&l&&l.imageSrcSet?void 0:t,as:n},l),Wa.set(m,t),o.querySelector(f)!==null||n==="style"&&o.querySelector(ho(m))||n==="script"&&o.querySelector(mo(m))||(n=o.createElement("link"),na(n,"link",t),mt(n),o.head.appendChild(n)))}}function aS(t,n){al.m(t,n);var l=li;if(l&&t){var o=n&&typeof n.as=="string"?n.as:"script",f='link[rel="modulepreload"][as="'+Wn(o)+'"][href="'+Wn(t)+'"]',m=f;switch(o){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":m=ii(t)}if(!Wa.has(m)&&(t=y({rel:"modulepreload",href:t},n),Wa.set(m,t),l.querySelector(f)===null)){switch(o){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(l.querySelector(mo(m)))return}o=l.createElement("link"),na(o,"link",t),mt(o),l.head.appendChild(o)}}}function rS(t,n,l){al.S(t,n,l);var o=li;if(o&&t){var f=dt(o).hoistableStyles,m=si(t);n=n||"default";var b=f.get(m);if(!b){var E={loading:0,preload:null};if(b=o.querySelector(ho(m)))E.loading=5;else{t=y({rel:"stylesheet",href:t,"data-precedence":n},l),(l=Wa.get(m))&&Sh(t,l);var C=b=o.createElement("link");mt(C),na(C,"link",t),C._p=new Promise(function(G,te){C.onload=G,C.onerror=te}),C.addEventListener("load",function(){E.loading|=1}),C.addEventListener("error",function(){E.loading|=2}),E.loading|=4,ou(b,n,o)}b={type:"stylesheet",instance:b,count:1,state:E},f.set(m,b)}}}function lS(t,n){al.X(t,n);var l=li;if(l&&t){var o=dt(l).hoistableScripts,f=ii(t),m=o.get(f);m||(m=l.querySelector(mo(f)),m||(t=y({src:t,async:!0},n),(n=Wa.get(f))&&Nh(t,n),m=l.createElement("script"),mt(m),na(m,"link",t),l.head.appendChild(m)),m={type:"script",instance:m,count:1,state:null},o.set(f,m))}}function sS(t,n){al.M(t,n);var l=li;if(l&&t){var o=dt(l).hoistableScripts,f=ii(t),m=o.get(f);m||(m=l.querySelector(mo(f)),m||(t=y({src:t,async:!0,type:"module"},n),(n=Wa.get(f))&&Nh(t,n),m=l.createElement("script"),mt(m),na(m,"link",t),l.head.appendChild(m)),m={type:"script",instance:m,count:1,state:null},o.set(f,m))}}function Cv(t,n,l,o){var f=(f=xe.current)?iu(f):null;if(!f)throw Error(s(446));switch(t){case"meta":case"title":return null;case"style":return typeof l.precedence=="string"&&typeof l.href=="string"?(n=si(l.href),l=dt(f).hoistableStyles,o=l.get(n),o||(o={type:"style",instance:null,count:0,state:null},l.set(n,o)),o):{type:"void",instance:null,count:0,state:null};case"link":if(l.rel==="stylesheet"&&typeof l.href=="string"&&typeof l.precedence=="string"){t=si(l.href);var m=dt(f).hoistableStyles,b=m.get(t);if(b||(f=f.ownerDocument||f,b={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},m.set(t,b),(m=f.querySelector(ho(t)))&&!m._p&&(b.instance=m,b.state.loading=5),Wa.has(t)||(l={rel:"preload",as:"style",href:l.href,crossOrigin:l.crossOrigin,integrity:l.integrity,media:l.media,hrefLang:l.hrefLang,referrerPolicy:l.referrerPolicy},Wa.set(t,l),m||iS(f,t,l,b.state))),n&&o===null)throw Error(s(528,""));return b}if(n&&o!==null)throw Error(s(529,""));return null;case"script":return n=l.async,l=l.src,typeof l=="string"&&n&&typeof n!="function"&&typeof n!="symbol"?(n=ii(l),l=dt(f).hoistableScripts,o=l.get(n),o||(o={type:"script",instance:null,count:0,state:null},l.set(n,o)),o):{type:"void",instance:null,count:0,state:null};default:throw Error(s(444,t))}}function si(t){return'href="'+Wn(t)+'"'}function ho(t){return'link[rel="stylesheet"]['+t+"]"}function Ov(t){return y({},t,{"data-precedence":t.precedence,precedence:null})}function iS(t,n,l,o){t.querySelector('link[rel="preload"][as="style"]['+n+"]")?o.loading=1:(n=t.createElement("link"),o.preload=n,n.addEventListener("load",function(){return o.loading|=1}),n.addEventListener("error",function(){return o.loading|=2}),na(n,"link",l),mt(n),t.head.appendChild(n))}function ii(t){return'[src="'+Wn(t)+'"]'}function mo(t){return"script[async]"+t}function Mv(t,n,l){if(n.count++,n.instance===null)switch(n.type){case"style":var o=t.querySelector('style[data-href~="'+Wn(l.href)+'"]');if(o)return n.instance=o,mt(o),o;var f=y({},l,{"data-href":l.href,"data-precedence":l.precedence,href:null,precedence:null});return o=(t.ownerDocument||t).createElement("style"),mt(o),na(o,"style",f),ou(o,l.precedence,t),n.instance=o;case"stylesheet":f=si(l.href);var m=t.querySelector(ho(f));if(m)return n.state.loading|=4,n.instance=m,mt(m),m;o=Ov(l),(f=Wa.get(f))&&Sh(o,f),m=(t.ownerDocument||t).createElement("link"),mt(m);var b=m;return b._p=new Promise(function(E,C){b.onload=E,b.onerror=C}),na(m,"link",o),n.state.loading|=4,ou(m,l.precedence,t),n.instance=m;case"script":return m=ii(l.src),(f=t.querySelector(mo(m)))?(n.instance=f,mt(f),f):(o=l,(f=Wa.get(m))&&(o=y({},l),Nh(o,f)),t=t.ownerDocument||t,f=t.createElement("script"),mt(f),na(f,"link",o),t.head.appendChild(f),n.instance=f);case"void":return null;default:throw Error(s(443,n.type))}else n.type==="stylesheet"&&(n.state.loading&4)===0&&(o=n.instance,n.state.loading|=4,ou(o,l.precedence,t));return n.instance}function ou(t,n,l){for(var o=l.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),f=o.length?o[o.length-1]:null,m=f,b=0;b<o.length;b++){var E=o[b];if(E.dataset.precedence===n)m=E;else if(m!==f)break}m?m.parentNode.insertBefore(t,m.nextSibling):(n=l.nodeType===9?l.head:l,n.insertBefore(t,n.firstChild))}function Sh(t,n){t.crossOrigin==null&&(t.crossOrigin=n.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=n.referrerPolicy),t.title==null&&(t.title=n.title)}function Nh(t,n){t.crossOrigin==null&&(t.crossOrigin=n.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=n.referrerPolicy),t.integrity==null&&(t.integrity=n.integrity)}var cu=null;function _v(t,n,l){if(cu===null){var o=new Map,f=cu=new Map;f.set(l,o)}else f=cu,o=f.get(l),o||(o=new Map,f.set(l,o));if(o.has(t))return o;for(o.set(t,null),l=l.getElementsByTagName(t),f=0;f<l.length;f++){var m=l[f];if(!(m[tt]||m[be]||t==="link"&&m.getAttribute("rel")==="stylesheet")&&m.namespaceURI!=="http://www.w3.org/2000/svg"){var b=m.getAttribute(n)||"";b=t+b;var E=o.get(b);E?E.push(m):o.set(b,[m])}}return o}function Lv(t,n,l){t=t.ownerDocument||t,t.head.insertBefore(l,n==="title"?t.querySelector("head > title"):null)}function oS(t,n,l){if(l===1||n.itemProp!=null)return!1;switch(t){case"meta":case"title":return!0;case"style":if(typeof n.precedence!="string"||typeof n.href!="string"||n.href==="")break;return!0;case"link":if(typeof n.rel!="string"||typeof n.href!="string"||n.href===""||n.onLoad||n.onError)break;switch(n.rel){case"stylesheet":return t=n.disabled,typeof n.precedence=="string"&&t==null;default:return!0}case"script":if(n.async&&typeof n.async!="function"&&typeof n.async!="symbol"&&!n.onLoad&&!n.onError&&n.src&&typeof n.src=="string")return!0}return!1}function zv(t){return!(t.type==="stylesheet"&&(t.state.loading&3)===0)}function cS(t,n,l,o){if(l.type==="stylesheet"&&(typeof o.media!="string"||matchMedia(o.media).matches!==!1)&&(l.state.loading&4)===0){if(l.instance===null){var f=si(o.href),m=n.querySelector(ho(f));if(m){n=m._p,n!==null&&typeof n=="object"&&typeof n.then=="function"&&(t.count++,t=uu.bind(t),n.then(t,t)),l.state.loading|=4,l.instance=m,mt(m);return}m=n.ownerDocument||n,o=Ov(o),(f=Wa.get(f))&&Sh(o,f),m=m.createElement("link"),mt(m);var b=m;b._p=new Promise(function(E,C){b.onload=E,b.onerror=C}),na(m,"link",o),l.instance=m}t.stylesheets===null&&(t.stylesheets=new Map),t.stylesheets.set(l,n),(n=l.state.preload)&&(l.state.loading&3)===0&&(t.count++,l=uu.bind(t),n.addEventListener("load",l),n.addEventListener("error",l))}}var Eh=0;function uS(t,n){return t.stylesheets&&t.count===0&&fu(t,t.stylesheets),0<t.count||0<t.imgCount?function(l){var o=setTimeout(function(){if(t.stylesheets&&fu(t,t.stylesheets),t.unsuspend){var m=t.unsuspend;t.unsuspend=null,m()}},6e4+n);0<t.imgBytes&&Eh===0&&(Eh=62500*F1());var f=setTimeout(function(){if(t.waitingForImages=!1,t.count===0&&(t.stylesheets&&fu(t,t.stylesheets),t.unsuspend)){var m=t.unsuspend;t.unsuspend=null,m()}},(t.imgBytes>Eh?50:800)+n);return t.unsuspend=l,function(){t.unsuspend=null,clearTimeout(o),clearTimeout(f)}}:null}function uu(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)fu(this,this.stylesheets);else if(this.unsuspend){var t=this.unsuspend;this.unsuspend=null,t()}}}var du=null;function fu(t,n){t.stylesheets=null,t.unsuspend!==null&&(t.count++,du=new Map,n.forEach(dS,t),du=null,uu.call(t))}function dS(t,n){if(!(n.state.loading&4)){var l=du.get(t);if(l)var o=l.get(null);else{l=new Map,du.set(t,l);for(var f=t.querySelectorAll("link[data-precedence],style[data-precedence]"),m=0;m<f.length;m++){var b=f[m];(b.nodeName==="LINK"||b.getAttribute("media")!=="not all")&&(l.set(b.dataset.precedence,b),o=b)}o&&l.set(null,o)}f=n.instance,b=f.getAttribute("data-precedence"),m=l.get(b)||o,m===o&&l.set(null,f),l.set(b,f),this.count++,o=uu.bind(this),f.addEventListener("load",o),f.addEventListener("error",o),m?m.parentNode.insertBefore(f,m.nextSibling):(t=t.nodeType===9?t.head:t,t.insertBefore(f,t.firstChild)),n.state.loading|=4}}var po={$$typeof:B,Provider:null,Consumer:null,_currentValue:fe,_currentValue2:fe,_threadCount:0};function fS(t,n,l,o,f,m,b,E,C){this.tag=1,this.containerInfo=t,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=Pt(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Pt(0),this.hiddenUpdates=Pt(null),this.identifierPrefix=o,this.onUncaughtError=f,this.onCaughtError=m,this.onRecoverableError=b,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=C,this.incompleteTransitions=new Map}function $v(t,n,l,o,f,m,b,E,C,G,te,oe){return t=new fS(t,n,l,b,C,G,te,oe,E),n=1,m===!0&&(n|=24),m=Ma(3,null,null,n),t.current=m,m.stateNode=t,n=nf(),n.refCount++,t.pooledCache=n,n.refCount++,m.memoizedState={element:o,isDehydrated:l,cache:n},sf(m),t}function Uv(t){return t?(t=Us,t):Us}function Bv(t,n,l,o,f,m){f=Uv(f),o.context===null?o.context=f:o.pendingContext=f,o=wl(n),o.payload={element:l},m=m===void 0?null:m,m!==null&&(o.callback=m),l=Sl(t,o,n),l!==null&&(Ra(l,t,n),Yi(l,t,n))}function Iv(t,n){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var l=t.retryLane;t.retryLane=l!==0&&l<n?l:n}}function jh(t,n){Iv(t,n),(t=t.alternate)&&Iv(t,n)}function Hv(t){if(t.tag===13||t.tag===31){var n=ss(t,67108864);n!==null&&Ra(n,t,67108864),jh(t,67108864)}}function qv(t){if(t.tag===13||t.tag===31){var n=Ua();n=_(n);var l=ss(t,n);l!==null&&Ra(l,t,n),jh(t,n)}}var hu=!0;function hS(t,n,l,o){var f=L.T;L.T=null;var m=F.p;try{F.p=2,Rh(t,n,l,o)}finally{F.p=m,L.T=f}}function mS(t,n,l,o){var f=L.T;L.T=null;var m=F.p;try{F.p=8,Rh(t,n,l,o)}finally{F.p=m,L.T=f}}function Rh(t,n,l,o){if(hu){var f=kh(o);if(f===null)fh(t,n,o,mu,l),Fv(t,o);else if(gS(f,t,n,l,o))o.stopPropagation();else if(Fv(t,o),n&4&&-1<pS.indexOf(t)){for(;f!==null;){var m=at(f);if(m!==null)switch(m.tag){case 3:if(m=m.stateNode,m.current.memoizedState.isDehydrated){var b=Et(m.pendingLanes);if(b!==0){var E=m;for(E.pendingLanes|=2,E.entangledLanes|=2;b;){var C=1<<31-Jt(b);E.entanglements[1]|=C,b&=~C}Rr(m),(Lt&6)===0&&(Kc=rn()+500,oo(0))}}break;case 31:case 13:E=ss(m,2),E!==null&&Ra(E,m,2),Wc(),jh(m,2)}if(m=kh(o),m===null&&fh(t,n,o,mu,l),m===f)break;f=m}f!==null&&o.stopPropagation()}else fh(t,n,o,null,l)}}function kh(t){return t=zr(t),Th(t)}var mu=null;function Th(t){if(mu=null,t=Ft(t),t!==null){var n=c(t);if(n===null)t=null;else{var l=n.tag;if(l===13){if(t=d(n),t!==null)return t;t=null}else if(l===31){if(t=h(n),t!==null)return t;t=null}else if(l===3){if(n.stateNode.current.memoizedState.isDehydrated)return n.tag===3?n.stateNode.containerInfo:null;t=null}else n!==t&&(t=null)}}return mu=t,null}function Pv(t){switch(t){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(ha()){case ma:return 2;case aa:return 8;case Yn:case me:return 32;case Ae:return 268435456;default:return 32}default:return 32}}var Ah=!1,Ml=null,_l=null,Ll=null,go=new Map,xo=new Map,zl=[],pS="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 Fv(t,n){switch(t){case"focusin":case"focusout":Ml=null;break;case"dragenter":case"dragleave":_l=null;break;case"mouseover":case"mouseout":Ll=null;break;case"pointerover":case"pointerout":go.delete(n.pointerId);break;case"gotpointercapture":case"lostpointercapture":xo.delete(n.pointerId)}}function vo(t,n,l,o,f,m){return t===null||t.nativeEvent!==m?(t={blockedOn:n,domEventName:l,eventSystemFlags:o,nativeEvent:m,targetContainers:[f]},n!==null&&(n=at(n),n!==null&&Hv(n)),t):(t.eventSystemFlags|=o,n=t.targetContainers,f!==null&&n.indexOf(f)===-1&&n.push(f),t)}function gS(t,n,l,o,f){switch(n){case"focusin":return Ml=vo(Ml,t,n,l,o,f),!0;case"dragenter":return _l=vo(_l,t,n,l,o,f),!0;case"mouseover":return Ll=vo(Ll,t,n,l,o,f),!0;case"pointerover":var m=f.pointerId;return go.set(m,vo(go.get(m)||null,t,n,l,o,f)),!0;case"gotpointercapture":return m=f.pointerId,xo.set(m,vo(xo.get(m)||null,t,n,l,o,f)),!0}return!1}function Vv(t){var n=Ft(t.target);if(n!==null){var l=c(n);if(l!==null){if(n=l.tag,n===13){if(n=d(l),n!==null){t.blockedOn=n,ie(t.priority,function(){qv(l)});return}}else if(n===31){if(n=h(l),n!==null){t.blockedOn=n,ie(t.priority,function(){qv(l)});return}}else if(n===3&&l.stateNode.current.memoizedState.isDehydrated){t.blockedOn=l.tag===3?l.stateNode.containerInfo:null;return}}}t.blockedOn=null}function pu(t){if(t.blockedOn!==null)return!1;for(var n=t.targetContainers;0<n.length;){var l=kh(t.nativeEvent);if(l===null){l=t.nativeEvent;var o=new l.constructor(l.type,l);Ca=o,l.target.dispatchEvent(o),Ca=null}else return n=at(l),n!==null&&Hv(n),t.blockedOn=l,!1;n.shift()}return!0}function Yv(t,n,l){pu(t)&&l.delete(n)}function xS(){Ah=!1,Ml!==null&&pu(Ml)&&(Ml=null),_l!==null&&pu(_l)&&(_l=null),Ll!==null&&pu(Ll)&&(Ll=null),go.forEach(Yv),xo.forEach(Yv)}function gu(t,n){t.blockedOn===n&&(t.blockedOn=null,Ah||(Ah=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,xS)))}var xu=null;function Gv(t){xu!==t&&(xu=t,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){xu===t&&(xu=null);for(var n=0;n<t.length;n+=3){var l=t[n],o=t[n+1],f=t[n+2];if(typeof o!="function"){if(Th(o||l)===null)continue;break}var m=at(l);m!==null&&(t.splice(n,3),n-=3,kf(m,{pending:!0,data:f,method:l.method,action:o},o,f))}}))}function oi(t){function n(C){return gu(C,t)}Ml!==null&&gu(Ml,t),_l!==null&&gu(_l,t),Ll!==null&&gu(Ll,t),go.forEach(n),xo.forEach(n);for(var l=0;l<zl.length;l++){var o=zl[l];o.blockedOn===t&&(o.blockedOn=null)}for(;0<zl.length&&(l=zl[0],l.blockedOn===null);)Vv(l),l.blockedOn===null&&zl.shift();if(l=(t.ownerDocument||t).$$reactFormReplay,l!=null)for(o=0;o<l.length;o+=3){var f=l[o],m=l[o+1],b=f[Ce]||null;if(typeof m=="function")b||Gv(l);else if(b){var E=null;if(m&&m.hasAttribute("formAction")){if(f=m,b=m[Ce]||null)E=b.formAction;else if(Th(f)!==null)continue}else E=b.action;typeof E=="function"?l[o+1]=E:(l.splice(o,3),o-=3),Gv(l)}}}function Xv(){function t(m){m.canIntercept&&m.info==="react-transition"&&m.intercept({handler:function(){return new Promise(function(b){return f=b})},focusReset:"manual",scroll:"manual"})}function n(){f!==null&&(f(),f=null),o||setTimeout(l,20)}function l(){if(!o&&!navigation.transition){var m=navigation.currentEntry;m&&m.url!=null&&navigation.navigate(m.url,{state:m.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var o=!1,f=null;return navigation.addEventListener("navigate",t),navigation.addEventListener("navigatesuccess",n),navigation.addEventListener("navigateerror",n),setTimeout(l,100),function(){o=!0,navigation.removeEventListener("navigate",t),navigation.removeEventListener("navigatesuccess",n),navigation.removeEventListener("navigateerror",n),f!==null&&(f(),f=null)}}}function Dh(t){this._internalRoot=t}vu.prototype.render=Dh.prototype.render=function(t){var n=this._internalRoot;if(n===null)throw Error(s(409));var l=n.current,o=Ua();Bv(l,o,t,n,null,null)},vu.prototype.unmount=Dh.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var n=t.containerInfo;Bv(t.current,2,null,t,null,null),Wc(),n[Re]=null}};function vu(t){this._internalRoot=t}vu.prototype.unstable_scheduleHydration=function(t){if(t){var n=J();t={blockedOn:null,target:t,priority:n};for(var l=0;l<zl.length&&n!==0&&n<zl[l].priority;l++);zl.splice(l,0,t),l===0&&Vv(t)}};var Qv=a.version;if(Qv!=="19.2.7")throw Error(s(527,Qv,"19.2.7"));F.findDOMNode=function(t){var n=t._reactInternals;if(n===void 0)throw typeof t.render=="function"?Error(s(188)):(t=Object.keys(t).join(","),Error(s(268,t)));return t=g(n),t=t!==null?v(t):null,t=t===null?null:t.stateNode,t};var vS={bundleType:0,version:"19.2.7",rendererPackageName:"react-dom",currentDispatcherRef:L,reconcilerVersion:"19.2.7"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var yu=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!yu.isDisabled&&yu.supportsFiber)try{Pe=yu.inject(vS),ee=yu}catch{}}return bo.createRoot=function(t,n){if(!u(t))throw Error(s(299));var l=!1,o="",f=nx,m=ax,b=rx;return n!=null&&(n.unstable_strictMode===!0&&(l=!0),n.identifierPrefix!==void 0&&(o=n.identifierPrefix),n.onUncaughtError!==void 0&&(f=n.onUncaughtError),n.onCaughtError!==void 0&&(m=n.onCaughtError),n.onRecoverableError!==void 0&&(b=n.onRecoverableError)),n=$v(t,1,!1,null,null,l,o,null,f,m,b,Xv),t[Re]=n.current,dh(t),new Dh(n)},bo.hydrateRoot=function(t,n,l){if(!u(t))throw Error(s(299));var o=!1,f="",m=nx,b=ax,E=rx,C=null;return l!=null&&(l.unstable_strictMode===!0&&(o=!0),l.identifierPrefix!==void 0&&(f=l.identifierPrefix),l.onUncaughtError!==void 0&&(m=l.onUncaughtError),l.onCaughtError!==void 0&&(b=l.onCaughtError),l.onRecoverableError!==void 0&&(E=l.onRecoverableError),l.formState!==void 0&&(C=l.formState)),n=$v(t,1,!0,n,l??null,o,f,C,m,b,E,Xv),n.context=Uv(null),l=n.current,o=Ua(),o=_(o),f=wl(o),f.callback=null,Sl(l,f,o),l=o,n.current.lanes=l,gt(n,l),Rr(n),t[Re]=n.current,dh(t),new vu(n)},bo.version="19.2.7",bo}var ly;function OS(){if(ly)return Mh.exports;ly=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(a){console.error(a)}}return e(),Mh.exports=CS(),Mh.exports}var MS=OS();/**
50
- * react-router v7.18.0
51
- *
52
- * Copyright (c) Remix Software Inc.
53
- *
54
- * This source code is licensed under the MIT license found in the
55
- * LICENSE.md file in the root directory of this source tree.
56
- *
57
- * @license MIT
58
- */var Db=e=>{throw TypeError(e)},Cb=(e,a,r)=>a.has(e)||Db("Cannot "+r),Ja=(e,a,r)=>(Cb(e,a,"read from private field"),r?r.call(e):a.get(e)),Do=(e,a,r)=>a.has(e)?Db("Cannot add the same private member more than once"):a instanceof WeakSet?a.add(e):a.set(e,r),kr=(e,a,r,s)=>(Cb(e,a,"write to private field"),a.set(e,r),r),sd=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,Dm=/^[\\/]{2}/;function Ob(e,a){return a+e.replace(/\\/g,"/")}var sy="popstate";function iy(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function _S(e={}){function a(s,u){var g;let c=(g=u.state)==null?void 0:g.masked,{pathname:d,search:h,hash:p}=c||s.location;return qo("",{pathname:d,search:h,hash:p},u.state&&u.state.usr||null,u.state&&u.state.key||"default",c?{pathname:s.location.pathname,search:s.location.search,hash:s.location.hash}:void 0)}function r(s,u){return typeof u=="string"?u:Or(u)}return zS(a,r,null,e)}function lt(e,a){if(e===!1||e===null||typeof e>"u")throw new Error(a)}function pn(e,a){if(!e){typeof console<"u"&&console.warn(a);try{throw new Error(a)}catch{}}}function LS(){return Math.random().toString(36).substring(2,10)}function oy(e,a){return{usr:e.state,key:e.key,idx:a,masked:e.mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function qo(e,a,r=null,s,u){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof a=="string"?Mr(a):a,state:r,key:a&&a.key||s||LS(),mask:u}}function Or({pathname:e="/",search:a="",hash:r=""}){return a&&a!=="?"&&(e+=a.charAt(0)==="?"?a:"?"+a),r&&r!=="#"&&(e+=r.charAt(0)==="#"?r:"#"+r),e}function Mr(e){let a={};if(e){let r=e.indexOf("#");r>=0&&(a.hash=e.substring(r),e=e.substring(0,r));let s=e.indexOf("?");s>=0&&(a.search=e.substring(s),e=e.substring(0,s)),e&&(a.pathname=e)}return a}function zS(e,a,r,s={}){let{window:u=document.defaultView,v5Compat:c=!1}=s,d=u.history,h="POP",p=null,g=v();g==null&&(g=0,d.replaceState({...d.state,idx:g},""));function v(){return(d.state||{idx:null}).idx}function y(){h="POP";let R=v(),M=R==null?null:R-g;g=R,p&&p({action:h,location:j.location,delta:M})}function S(R,M){h="PUSH";let $=iy(R)?R:qo(j.location,R,M);g=v()+1;let B=oy($,g),Y=j.createHref($.mask||$);try{d.pushState(B,"",Y)}catch(ne){if(ne instanceof DOMException&&ne.name==="DataCloneError")throw ne;u.location.assign(Y)}c&&p&&p({action:h,location:j.location,delta:1})}function N(R,M){h="REPLACE";let $=iy(R)?R:qo(j.location,R,M);g=v();let B=oy($,g),Y=j.createHref($.mask||$);d.replaceState(B,"",Y),c&&p&&p({action:h,location:j.location,delta:0})}function w(R){return Mb(u,R)}let j={get action(){return h},get location(){return e(u,d)},listen(R){if(p)throw new Error("A history only accepts one active listener");return u.addEventListener(sy,y),p=R,()=>{u.removeEventListener(sy,y),p=null}},createHref(R){return a(u,R)},createURL:w,encodeLocation(R){let M=w(R);return{pathname:M.pathname,search:M.search,hash:M.hash}},push:S,replace:N,go(R){return d.go(R)}};return j}function Mb(e,a,r=!1){let s="http://localhost";e&&(s=e.location.origin!=="null"?e.location.origin:e.location.href),lt(s,"No window.location.(origin|href) available to create URL");let u=typeof a=="string"?a:Or(a);return u=u.replace(/ $/,"%20"),!r&&Dm.test(u)&&(u=s+u),new URL(u,s)}var Co,cy=class{constructor(e){if(Do(this,Co,new Map),e)for(let[a,r]of e)this.set(a,r)}get(e){if(Ja(this,Co).has(e))return Ja(this,Co).get(e);if(e.defaultValue!==void 0)return e.defaultValue;throw new Error("No value found for context")}set(e,a){Ja(this,Co).set(e,a)}};Co=new WeakMap;var $S=new Set(["lazy","caseSensitive","path","id","index","children"]);function US(e){return $S.has(e)}var BS=new Set(["lazy","caseSensitive","path","id","index","middleware","children"]);function IS(e){return BS.has(e)}function HS(e){return e.index===!0}function Po(e,a,r=[],s={},u=!1){return e.map((c,d)=>{let h=[...r,String(d)],p=typeof c.id=="string"?c.id:h.join("-");if(lt(c.index!==!0||!c.children,"Cannot specify children on an index route"),lt(u||!s[p],`Found a route id collision on id "${p}". Route id's must be globally unique within Data Router usages`),HS(c)){let g={...c,id:p};return s[p]=uy(g,a(g)),g}else{let g={...c,id:p,children:void 0};return s[p]=uy(g,a(g)),c.children&&(g.children=Po(c.children,a,h,s,u)),g}})}function uy(e,a){return Object.assign(e,{...a,...typeof a.lazy=="object"&&a.lazy!=null?{lazy:{...e.lazy,...a.lazy}}:{}})}function _b(e,a,r="/"){return fr(e,a,r,!1)}function fr(e,a,r,s,u){let c=typeof a=="string"?Mr(a):a,d=Ha(c.pathname||"/",r);if(d==null)return null;let h=u??$u(e),p=null,g=WS(d);for(let v=0;p==null&&v<h.length;++v)p=ZS(h[v],g,s);return p}function Lb(e,a){let{route:r,pathname:s,params:u}=e;return{id:r.id,pathname:s,params:u,data:a[r.id],loaderData:a[r.id],handle:r.handle}}function $u(e){let a=zb(e);return qS(a),a}function zb(e,a=[],r=[],s="",u=!1){let c=(d,h,p=u,g)=>{let v={relativePath:g===void 0?d.path||"":g,caseSensitive:d.caseSensitive===!0,childrenIndex:h,route:d};if(v.relativePath.startsWith("/")){if(!v.relativePath.startsWith(s)&&p)return;lt(v.relativePath.startsWith(s),`Absolute route path "${v.relativePath}" nested under path "${s}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),v.relativePath=v.relativePath.slice(s.length)}let y=nr([s,v.relativePath]),S=r.concat(v);d.children&&d.children.length>0&&(lt(d.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${y}".`),zb(d.children,a,S,y,p)),!(d.path==null&&!d.index)&&a.push({path:y,score:QS(y,d.index),routesMeta:S.map((N,w)=>{let[j,R]=Bb(N.relativePath,N.caseSensitive,w===S.length-1);return{...N,matcher:j,compiledParams:R}})})};return e.forEach((d,h)=>{var p;if(d.path===""||!((p=d.path)!=null&&p.includes("?")))c(d,h);else for(let g of $b(d.path))c(d,h,!0,g)}),a}function $b(e){let a=e.split("/");if(a.length===0)return[];let[r,...s]=a,u=r.endsWith("?"),c=r.replace(/\?$/,"");if(s.length===0)return u?[c,""]:[c];let d=$b(s.join("/")),h=[];return h.push(...d.map(p=>p===""?c:[c,p].join("/"))),u&&h.push(...d),h.map(p=>e.startsWith("/")&&p===""?"/":p)}function qS(e){e.sort((a,r)=>a.score!==r.score?r.score-a.score:KS(a.routesMeta.map(s=>s.childrenIndex),r.routesMeta.map(s=>s.childrenIndex)))}var PS=/^:[\w-]+$/,FS=3,VS=2,YS=1,GS=10,XS=-2,dy=e=>e==="*";function QS(e,a){let r=e.split("/"),s=r.length;return r.some(dy)&&(s+=XS),a&&(s+=VS),r.filter(u=>!dy(u)).reduce((u,c)=>u+(PS.test(c)?FS:c===""?YS:GS),s)}function KS(e,a){return e.length===a.length&&e.slice(0,-1).every((s,u)=>s===a[u])?e[e.length-1]-a[a.length-1]:0}function ZS(e,a,r=!1){let{routesMeta:s}=e,u={},c="/",d=[];for(let h=0;h<s.length;++h){let p=s[h],g=h===s.length-1,v=c==="/"?a:a.slice(c.length)||"/",y={path:p.relativePath,caseSensitive:p.caseSensitive,end:g},S=p.matcher&&p.compiledParams?Ub(y,v,p.matcher,p.compiledParams):Vu(y,v),N=p.route;if(!S&&g&&r&&!s[s.length-1].route.index&&(S=Vu({path:p.relativePath,caseSensitive:p.caseSensitive,end:!1},v)),!S)return null;Object.assign(u,S.params),d.push({params:u,pathname:nr([c,S.pathname]),pathnameBase:tN(nr([c,S.pathnameBase])),route:N}),S.pathnameBase!=="/"&&(c=nr([c,S.pathnameBase]))}return d}function Vu(e,a){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[r,s]=Bb(e.path,e.caseSensitive,e.end);return Ub(e,a,r,s)}function Ub(e,a,r,s){let u=a.match(r);if(!u)return null;let c=u[0],d=c.replace(/(.)\/+$/,"$1"),h=u.slice(1);return{params:s.reduce((g,{paramName:v,isOptional:y},S)=>{if(v==="*"){let w=h[S]||"";d=c.slice(0,c.length-w.length).replace(/(.)\/+$/,"$1")}const N=h[S];return y&&!N?g[v]=void 0:g[v]=(N||"").replace(/%2F/g,"/"),g},{}),pathname:c,pathnameBase:d,pattern:e}}function Bb(e,a=!1,r=!0){pn(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let s=[],u="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(d,h,p,g,v)=>{if(s.push({paramName:h,isOptional:p!=null}),p){let y=v.charAt(g+d.length);return y&&y!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(s.push({paramName:"*"}),u+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?u+="\\/*$":e!==""&&e!=="/"&&(u+="(?:(?=\\/|$))"),[new RegExp(u,a?void 0:"i"),s]}function WS(e){try{return e.split("/").map(a=>decodeURIComponent(a).replace(/\//g,"%2F")).join("/")}catch(a){return pn(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${a}).`),e}}function Ha(e,a){if(a==="/")return e;if(!e.toLowerCase().startsWith(a.toLowerCase()))return null;let r=a.endsWith("/")?a.length-1:a.length,s=e.charAt(r);return s&&s!=="/"?null:e.slice(r)||"/"}function JS({basename:e,pathname:a}){return a==="/"?e:nr([e,a])}var Cm=e=>sd.test(e);function eN(e,a="/"){let{pathname:r,search:s="",hash:u=""}=typeof e=="string"?Mr(e):e,c;return r?(r=Mm(r),r.startsWith("/")?c=fy(r.substring(1),"/"):c=fy(r,a)):c=a,{pathname:c,search:nN(s),hash:aN(u)}}function fy(e,a){let r=Yu(a).split("/");return e.split("/").forEach(u=>{u===".."?r.length>1&&r.pop():u!=="."&&r.push(u)}),r.length>1?r.join("/"):"/"}function $h(e,a,r,s){return`Cannot include a '${e}' character in a manually specified \`to.${a}\` field [${JSON.stringify(s)}]. Please separate it out to the \`to.${r}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function Ib(e){return e.filter((a,r)=>r===0||a.route.path&&a.route.path.length>0)}function Om(e){let a=Ib(e);return a.map((r,s)=>s===a.length-1?r.pathname:r.pathnameBase)}function id(e,a,r,s=!1){let u;typeof e=="string"?u=Mr(e):(u={...e},lt(!u.pathname||!u.pathname.includes("?"),$h("?","pathname","search",u)),lt(!u.pathname||!u.pathname.includes("#"),$h("#","pathname","hash",u)),lt(!u.search||!u.search.includes("#"),$h("#","search","hash",u)));let c=e===""||u.pathname==="",d=c?"/":u.pathname,h;if(d==null)h=r;else{let y=a.length-1;if(!s&&d.startsWith("..")){let S=d.split("/");for(;S[0]==="..";)S.shift(),y-=1;u.pathname=S.join("/")}h=y>=0?a[y]:"/"}let p=eN(u,h),g=d&&d!=="/"&&d.endsWith("/"),v=(c||d===".")&&r.endsWith("/");return!p.pathname.endsWith("/")&&(g||v)&&(p.pathname+="/"),p}var Mm=e=>e.replace(/[\\/]{2,}/g,"/"),nr=e=>Mm(e.join("/")),Yu=e=>e.replace(/\/+$/,""),tN=e=>Yu(e).replace(/^\/*/,"/"),nN=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,aN=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,En=(e,a=302)=>{let r=a;typeof r=="number"?r={status:r}:typeof r.status>"u"&&(r.status=302);let s=new Headers(r.headers);return s.set("Location",e),new Response(null,{...r,headers:s})},rN=["EvalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],Ko=class{constructor(e,a,r,s=!1){this.status=e,this.statusText=a||"",this.internal=s,r instanceof Error?(this.data=r.toString(),this.error=r):this.data=r}};function Si(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function Zo(e){let a=e.map(r=>r.route.path).filter(Boolean);return nr(a)||"/"}var Hb=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function qb(e,a){let r=e;if(typeof r!="string"||!sd.test(r))return{absoluteURL:void 0,isExternal:!1,to:r};let s=r,u=!1;if(Hb)try{let c=new URL(window.location.href),d=Dm.test(r)?new URL(Ob(r,c.protocol)):new URL(r),h=Ha(d.pathname,a);d.origin===c.origin&&h!=null?r=h+d.search+d.hash:u=!0}catch{pn(!1,`<Link to="${r}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:s,isExternal:u,to:r}}var Pl=Symbol("Uninstrumented");function lN(e,a){let r={lazy:[],"lazy.loader":[],"lazy.action":[],"lazy.middleware":[],middleware:[],loader:[],action:[]};e.forEach(u=>u({id:a.id,index:a.index,path:a.path,instrument(c){let d=Object.keys(r);for(let h of d)c[h]&&r[h].push(c[h])}}));let s={};if(typeof a.lazy=="function"&&r.lazy.length>0){let u=gi(r.lazy,a.lazy,()=>{});u&&(s.lazy=u)}if(typeof a.lazy=="object"){let u=a.lazy;["middleware","loader","action"].forEach(c=>{let d=u[c],h=r[`lazy.${c}`];if(typeof d=="function"&&h.length>0){let p=gi(h,d,()=>{});p&&(s.lazy=Object.assign(s.lazy||{},{[c]:p}))}})}return["loader","action"].forEach(u=>{let c=a[u];if(typeof c=="function"&&r[u].length>0){let d=c[Pl]??c,h=gi(r[u],d,(...p)=>hy(p[0]));h&&(u==="loader"&&d.hydrate===!0&&(h.hydrate=!0),h[Pl]=d,s[u]=h)}}),a.middleware&&a.middleware.length>0&&r.middleware.length>0&&(s.middleware=a.middleware.map(u=>{let c=u[Pl]??u,d=gi(r.middleware,c,(...h)=>hy(h[0]));return d?(d[Pl]=c,d):u})),s}function sN(e,a){let r={navigate:[],fetch:[]};if(a.forEach(s=>s({instrument(u){let c=Object.keys(u);for(let d of c)u[d]&&r[d].push(u[d])}})),r.navigate.length>0){let s=e.navigate[Pl]??e.navigate,u=gi(r.navigate,s,(...c)=>{let[d,h]=c;return{to:typeof d=="number"||typeof d=="string"?d:d?Or(d):".",...my(e,h??{})}});u&&(u[Pl]=s,e.navigate=u)}if(r.fetch.length>0){let s=e.fetch[Pl]??e.fetch,u=gi(r.fetch,s,(...c)=>{let[d,,h,p]=c;return{href:h??".",fetcherKey:d,...my(e,p??{})}});u&&(u[Pl]=s,e.fetch=u)}return e}function gi(e,a,r){return e.length===0?null:async(...s)=>{let u=await Pb(e,r(...s),()=>a(...s),e.length-1);if(u.type==="error")throw u.value;return u.value}}async function Pb(e,a,r,s){let u=e[s],c;if(u){let d,h=async()=>(d?console.error("You cannot call instrumented handlers more than once"):d=Pb(e,a,r,s-1),c=await d,lt(c,"Expected a result"),c.type==="error"&&c.value instanceof Error?{status:"error",error:c.value}:{status:"success",error:void 0});try{await u(h,a)}catch(p){console.error("An instrumentation function threw an error:",p)}d||await h(),await d}else try{c={type:"success",value:await r()}}catch(d){c={type:"error",value:d}}return c||{type:"error",value:new Error("No result assigned in instrumentation chain.")}}function hy(e){let{request:a,context:r,params:s,pattern:u}=e;return{request:iN(a),params:{...s},pattern:u,context:oN(r)}}function my(e,a){return{currentUrl:Or(e.state.location),..."formMethod"in a?{formMethod:a.formMethod}:{},..."formEncType"in a?{formEncType:a.formEncType}:{},..."formData"in a?{formData:a.formData}:{},..."body"in a?{body:a.body}:{}}}function iN(e){return{method:e.method,url:e.url,headers:{get:(...a)=>e.headers.get(...a)}}}function oN(e){if(uN(e)){let a={...e};return Object.freeze(a),a}else return{get:a=>e.get(a)}}var cN=Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function uN(e){if(e===null||typeof e!="object")return!1;const a=Object.getPrototypeOf(e);return a===Object.prototype||a===null||Object.getOwnPropertyNames(a).sort().join("\0")===cN}var Fb=["POST","PUT","PATCH","DELETE"],dN=new Set(Fb),fN=["GET",...Fb],hN=new Set(fN),Vb=new Set([301,302,303,307,308]),mN=new Set([307,308]),Uh={state:"idle",location:void 0,matches:void 0,historyAction:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},Yb={state:"idle",data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},wo={state:"unblocked",proceed:void 0,reset:void 0,location:void 0},pN=e=>({hasErrorBoundary:!!e.hasErrorBoundary}),Gb="remix-router-transitions",Xb=Symbol("ResetLoaderData"),ws,hi,Bl,mi,gN=class{constructor(e){Do(this,ws),Do(this,hi),Do(this,Bl),Do(this,mi),kr(this,ws,e),kr(this,hi,$u(e))}get stableRoutes(){return Ja(this,ws)}get activeRoutes(){return Ja(this,Bl)??Ja(this,ws)}get branches(){return Ja(this,mi)??Ja(this,hi)}get hasHMRRoutes(){return Ja(this,Bl)!=null}setRoutes(e){kr(this,ws,e),kr(this,hi,$u(e))}setHmrRoutes(e){kr(this,Bl,e),kr(this,mi,$u(e))}commitHmrRoutes(){Ja(this,Bl)&&(kr(this,ws,Ja(this,Bl)),kr(this,hi,Ja(this,mi)),kr(this,Bl,void 0),kr(this,mi,void 0))}};ws=new WeakMap;hi=new WeakMap;Bl=new WeakMap;mi=new WeakMap;function xN(e){const a=e.window?e.window:typeof window<"u"?window:void 0,r=typeof a<"u"&&typeof a.document<"u"&&typeof a.document.createElement<"u";lt(e.routes.length>0,"You must provide a non-empty routes array to createRouter");let s=e.hydrationRouteProperties||[],u=e.mapRouteProperties||pN,c=u;if(e.instrumentations){let D=e.instrumentations;c=_=>({...u(_),...lN(D.map(q=>q.route).filter(Boolean),_)})}let d={},h=new gN(Po(e.routes,c,void 0,d)),p=e.basename||"/";p.startsWith("/")||(p=`/${p}`);let g=e.dataStrategy||SN,v={...e.future},y=null,S=new Set,N=null,w=null,j=null,R=null,M=e.hydrationData!=null,$=fr(h.activeRoutes,e.history.location,p,!1,h.branches),B=!1,Y=null,ne,ae;if($==null&&!e.patchRoutesOnNavigation){let D=er(404,{pathname:e.history.location.pathname}),{matches:_,route:q}=bu(h.activeRoutes);ne=!0,ae=!ne,$=_,Y={[q.id]:D}}else if($&&!e.hydrationData&&Pt($,h.activeRoutes,e.history.location.pathname).active&&($=null),$)if($.some(D=>D.route.lazy))ne=!1,ae=!ne;else if(!$.some(D=>_m(D.route)))ne=!0,ae=!ne;else{let D=e.hydrationData?e.hydrationData.loaderData:null,_=e.hydrationData?e.hydrationData.errors:null,q=$;if(_){let J=$.findIndex(ie=>_[ie.route.id]!==void 0);q=q.slice(0,J+1)}ae=!1,ne=!0,q.forEach(J=>{let ie=Qb(J.route,D,_);ae=ae||ie.renderFallback,ne=ne&&!ie.shouldLoad})}else{ne=!1,ae=!ne,$=[];let D=Pt(null,h.activeRoutes,e.history.location.pathname);D.active&&D.matches&&(B=!0,$=D.matches)}let U,k={historyAction:e.history.action,location:e.history.location,matches:$,initialized:ne,renderFallback:ae,navigation:Uh,restoreScrollPosition:e.hydrationData!=null?!1:null,preventScrollReset:!1,revalidation:"idle",loaderData:e.hydrationData&&e.hydrationData.loaderData||{},actionData:e.hydrationData&&e.hydrationData.actionData||null,errors:e.hydrationData&&e.hydrationData.errors||Y,fetchers:new Map,blockers:new Map},re="POP",pe=null,Se=!1,ye,he=!1,je=new Map,W=null,L=!1,F=!1,fe=new Set,P=new Map,se=0,A=-1,I=new Map,K=new Set,ue=new Map,ge=new Map,xe=new Set,ke=new Map,Ie,Ue=null;function Ze(){if(y=e.history.listen(({action:D,location:_,delta:q})=>{if(Ie){Ie(),Ie=void 0;return}pn(ke.size===0||q!=null,"You are trying to use a blocker on a POP navigation to a location that was not created by @remix-run/router. This will fail silently in production. This can happen if you are navigating outside the router via `window.history.pushState`/`window.location.hash` instead of using router navigation APIs. This can also happen if you are using createHashRouter and the user manually changes the URL.");let J=wt({currentLocation:k.location,nextLocation:_,historyAction:D});if(J&&q!=null){let ie=new Promise(Te=>{Ie=Te});e.history.go(q*-1),bt(J,{state:"blocked",location:_,proceed(){bt(J,{state:"proceeding",proceed:void 0,reset:void 0,location:_}),ie.then(()=>e.history.go(q))},reset(){let Te=new Map(k.blockers);Te.set(J,wo),pt({blockers:Te})}}),pe==null||pe.resolve(),pe=null;return}return Ht(D,_)}),r){HN(a,je);let D=()=>qN(a,je);a.addEventListener("pagehide",D),W=()=>a.removeEventListener("pagehide",D)}return k.initialized||Ht("POP",k.location,{initialHydration:!0}),U}function dn(){y&&y(),W&&W(),S.clear(),ye&&ye.abort(),k.fetchers.forEach((D,_)=>Pe(k.fetchers,_)),k.blockers.forEach((D,_)=>_e(_))}function It(D){if(S.add(D),N){let{newErrors:_}=N;N=null,D(k,{deletedFetchers:[],newErrors:_,viewTransitionOpts:void 0,flushSync:!1})}return()=>S.delete(D)}function pt(D,_={}){D.matches&&(D.matches=D.matches.map(ie=>{let Te=d[ie.route.id],be=ie.route;return be.element!==Te.element||be.errorElement!==Te.errorElement||be.hydrateFallbackElement!==Te.hydrateFallbackElement?{...ie,route:Te}:ie})),k={...k,...D};let q=[],J=[];k.fetchers.forEach((ie,Te)=>{ie.state==="idle"&&(xe.has(Te)?q.push(Te):J.push(Te))}),xe.forEach(ie=>{!k.fetchers.has(ie)&&!P.has(ie)&&q.push(ie)}),S.size===0&&(N={newErrors:D.errors??null}),[...S].forEach(ie=>ie(k,{deletedFetchers:q,newErrors:D.errors??null,viewTransitionOpts:_.viewTransitionOpts,flushSync:_.flushSync===!0})),q.forEach(ie=>Pe(k.fetchers,ie)),J.forEach(ie=>k.fetchers.delete(ie))}function ce(D,_,{flushSync:q}={}){var $e,We;let J=k.actionData!=null&&k.navigation.formMethod!=null&&fa(k.navigation.formMethod)&&k.navigation.state==="loading"&&(($e=D.state)==null?void 0:$e._isRedirect)!==!0,ie;_.actionData?Object.keys(_.actionData).length>0?ie=_.actionData:ie=null:J?ie=k.actionData:ie=null;let Te=_.loaderData?Ey(k.loaderData,_.loaderData,_.matches||[],_.errors):k.loaderData,be=k.blockers;be.size>0&&(be=new Map(be),be.forEach((Oe,tt)=>be.set(tt,wo)));let Ce=L?!1:en(D,_.matches||k.matches),Re=Se===!0||k.navigation.formMethod!=null&&fa(k.navigation.formMethod)&&((We=D.state)==null?void 0:We._isRedirect)!==!0;h.commitHmrRoutes(),L||re==="POP"||(re==="PUSH"?e.history.push(D,D.state):re==="REPLACE"&&e.history.replace(D,D.state));let Le;if(re==="POP"){let Oe=je.get(k.location.pathname);Oe&&Oe.has(D.pathname)?Le={currentLocation:k.location,nextLocation:D}:je.has(D.pathname)&&(Le={currentLocation:D,nextLocation:k.location})}else if(he){let Oe=je.get(k.location.pathname);Oe?Oe.add(D.pathname):(Oe=new Set([D.pathname]),je.set(k.location.pathname,Oe)),Le={currentLocation:k.location,nextLocation:D}}pt({..._,actionData:ie,loaderData:Te,historyAction:re,location:D,initialized:!0,renderFallback:!1,navigation:Uh,revalidation:"idle",restoreScrollPosition:Ce,preventScrollReset:Re,blockers:be},{viewTransitionOpts:Le,flushSync:q===!0}),re="POP",Se=!1,he=!1,L=!1,F=!1,pe==null||pe.resolve(),pe=null,Ue==null||Ue.resolve(),Ue=null}async function qe(D,_){if(pe==null||pe.resolve(),pe=null,typeof D=="number"){pe||(pe=Ty());let Fe=pe.promise;return e.history.go(D),Fe}let q=um(k.location,k.matches,p,D,_==null?void 0:_.fromRouteId,_==null?void 0:_.relative),{path:J,submission:ie,error:Te}=py(!1,q,_),be;_!=null&&_.mask&&(be={pathname:"",search:"",hash:"",...typeof _.mask=="string"?Mr(_.mask):{...k.location.mask,..._.mask}});let Ce=k.location,Re=qo(Ce,J,_&&_.state,void 0,be);Re={...Re,...e.history.encodeLocation(Re)};let Le=_&&_.replace!=null?_.replace:void 0,$e="PUSH";Le===!0?$e="REPLACE":Le===!1||ie!=null&&fa(ie.formMethod)&&ie.formAction===k.location.pathname+k.location.search&&($e="REPLACE");let We=_&&"preventScrollReset"in _?_.preventScrollReset===!0:void 0,Oe=(_&&_.flushSync)===!0,tt=wt({currentLocation:Ce,nextLocation:Re,historyAction:$e});if(tt){bt(tt,{state:"blocked",location:Re,proceed(){bt(tt,{state:"proceeding",proceed:void 0,reset:void 0,location:Re}),qe(D,_)},reset(){let Fe=new Map(k.blockers);Fe.set(tt,wo),pt({blockers:Fe})}});return}await Ht($e,Re,{submission:ie,pendingError:Te,preventScrollReset:We,replace:_&&_.replace,enableViewTransition:_&&_.viewTransition,flushSync:Oe,callSiteDefaultShouldRevalidate:_&&_.defaultShouldRevalidate})}function st(){Ue||(Ue=Ty()),Yn(),pt({revalidation:"loading"});let D=Ue.promise;return k.navigation.state==="submitting"?D:k.navigation.state==="idle"?(Ht(k.historyAction,k.location,{startUninterruptedRevalidation:!0}),D):(Ht(re||k.historyAction,k.navigation.location,{overrideNavigation:k.navigation,enableViewTransition:he===!0}),D)}async function Ht(D,_,q){ye&&ye.abort(),ye=null,re=D,L=(q&&q.startUninterruptedRevalidation)===!0,ln(k.location,k.matches),Se=(q&&q.preventScrollReset)===!0,he=(q&&q.enableViewTransition)===!0;let J=h.activeRoutes,ie=q!=null&&q.initialHydration&&k.matches&&k.matches.length>0&&!B?k.matches:fr(J,_,p,!1,h.branches),Te=(q&&q.flushSync)===!0;if(ie&&k.initialized&&!F&&CN(k.location,_)&&!(q&&q.submission&&fa(q.submission.formMethod))){ce(_,{matches:ie},{flushSync:Te});return}let be=Pt(ie,J,_.pathname);if(be.active&&be.matches&&(ie=be.matches),!ie){let{error:at,notFoundMatches:ht,route:dt}=Et(_.pathname);ce(_,{matches:ht,loaderData:{},errors:{[dt.id]:at}},{flushSync:Te});return}let Ce=q&&q.overrideNavigation?{...q.overrideNavigation,matches:ie,historyAction:D}:void 0;ye=new AbortController;let Re=pi(e.history,_,ye.signal,q&&q.submission),Le=e.getContext?await e.getContext():new cy,$e;if(q&&q.pendingError)$e=[ql(ie).route.id,{type:"error",error:q.pendingError}];else if(q&&q.submission&&fa(q.submission.formMethod)){let at=await yn(Re,_,q.submission,ie,D,Le,be.active,q&&q.initialHydration===!0,{replace:q.replace,flushSync:Te});if(at.shortCircuited)return;if(at.pendingActionResult){let[ht,dt]=at.pendingActionResult;if(Ba(dt)&&Si(dt.error)&&dt.error.status===404){ye=null,ce(_,{matches:at.matches,loaderData:{},errors:{[ht]:dt.error}});return}}ie=at.matches||ie,$e=at.pendingActionResult,Ce=Bh(_,ie,D,q.submission),Te=!1,be.active=!1,Re=pi(e.history,Re.url,Re.signal)}let{shortCircuited:We,matches:Oe,loaderData:tt,errors:Fe,workingFetchers:Ft}=await At(Re,_,ie,D,Le,be.active,Ce,q&&q.submission,q&&q.fetcherSubmission,q&&q.replace,q&&q.initialHydration===!0,Te,$e,q&&q.callSiteDefaultShouldRevalidate);We||(ye=null,ce(_,{matches:Oe||ie,...jy($e),loaderData:tt,errors:Fe,...Ft?{fetchers:Ft}:{}}))}async function yn(D,_,q,J,ie,Te,be,Ce,Re={}){Yn();let Le=BN(_,J,ie,q);if(pt({navigation:Le},{flushSync:Re.flushSync===!0}),be){let Oe=await gt(J,_.pathname,D.signal);if(Oe.type==="aborted")return{shortCircuited:!0};if(Oe.type==="error"){if(Oe.partialMatches.length===0){let{matches:Fe,route:Ft}=bu(h.activeRoutes);return{matches:Fe,pendingActionResult:[Ft.id,{type:"error",error:Oe.error}]}}let tt=ql(Oe.partialMatches).route.id;return{matches:Oe.partialMatches,pendingActionResult:[tt,{type:"error",error:Oe.error}]}}else if(Oe.matches)J=Oe.matches;else{let{notFoundMatches:tt,error:Fe,route:Ft}=Et(_.pathname);return{matches:tt,pendingActionResult:[Ft.id,{type:"error",error:Fe}]}}}let $e,We=Uu(J,_);if(!We.route.action&&!We.route.lazy)$e={type:"error",error:er(405,{method:D.method,pathname:_.pathname,routeId:We.route.id})};else{let Oe=yi(c,d,D,_,J,We,Ce?[]:s,Te),tt=await ma(D,_,Oe,Te,null);if($e=tt[We.route.id],!$e){for(let Fe of J)if(tt[Fe.route.id]){$e=tt[Fe.route.id];break}}if(D.signal.aborted)return{shortCircuited:!0}}if(Ss($e)){let Oe;return Re&&Re.replace!=null?Oe=Re.replace:Oe=wy($e.response.headers.get("Location"),new URL(D.url),p,e.history)===k.location.pathname+k.location.search,await ha(D,$e,!0,{submission:q,replace:Oe}),{shortCircuited:!0}}if(Ba($e)){let Oe=ql(J,We.route.id);return(Re&&Re.replace)!==!0&&(re="PUSH"),{matches:J,pendingActionResult:[Oe.route.id,$e,We.route.id]}}return{matches:J,pendingActionResult:[We.route.id,$e]}}async function At(D,_,q,J,ie,Te,be,Ce,Re,Le,$e,We,Oe,tt){let Fe=be||Bh(_,q,J,Ce),Ft=Ce||Re||ky(Fe),at=!L&&!$e;if(Te){if(at){let Rt=$t(Oe);pt({navigation:Fe,...Rt!==void 0?{actionData:Rt}:{}},{flushSync:We})}let Je=await gt(q,_.pathname,D.signal);if(Je.type==="aborted")return{shortCircuited:!0};if(Je.type==="error"){if(Je.partialMatches.length===0){let{matches:nn,route:la}=bu(h.activeRoutes);return{matches:nn,loaderData:{},errors:{[la.id]:Je.error}}}let Rt=ql(Je.partialMatches).route.id;return{matches:Je.partialMatches,loaderData:{},errors:{[Rt]:Je.error}}}else if(Je.matches)q=Je.matches;else{let{error:Rt,notFoundMatches:nn,route:la}=Et(_.pathname);return{matches:nn,loaderData:{},errors:{[la.id]:Rt}}}}let ht=h.activeRoutes,{dsMatches:dt,revalidatingFetchers:mt}=gy(D,ie,c,d,e.history,k,q,Ft,_,$e?[]:s,$e===!0,F,fe,xe,ue,K,ht,p,e.patchRoutesOnNavigation!=null,h.branches,Oe,tt);if(A=++se,!e.dataStrategy&&!dt.some(Je=>Je.shouldLoad)&&!dt.some(Je=>Je.route.middleware&&Je.route.middleware.length>0)&&mt.length===0){let Je=new Map(k.fetchers),Rt=Qn(Je);return ce(_,{matches:q,loaderData:{},errors:Oe&&Ba(Oe[1])?{[Oe[0]]:Oe[1].error}:null,...jy(Oe),...Rt?{fetchers:Je}:{}},{flushSync:We}),{shortCircuited:!0}}if(at){let Je={};if(!Te){Je.navigation=Fe;let Rt=$t(Oe);Rt!==void 0&&(Je.actionData=Rt)}mt.length>0&&(Je.fetchers=Wt(mt)),pt(Je,{flushSync:We})}mt.forEach(Je=>{Dt(Je.key),Je.controller&&P.set(Je.key,Je.controller)});let tn=()=>mt.forEach(Je=>Dt(Je.key));ye&&ye.signal.addEventListener("abort",tn);let{loaderResults:Kn,fetcherResults:Rn}=await aa(dt,mt,D,_,ie);if(D.signal.aborted)return{shortCircuited:!0};ye&&ye.signal.removeEventListener("abort",tn),mt.forEach(Je=>P.delete(Je.key));let zn=wu(Kn);if(zn)return await ha(D,zn.result,!0,{replace:Le}),{shortCircuited:!0};if(zn=wu(Rn),zn)return K.add(zn.key),await ha(D,zn.result,!0,{replace:Le}),{shortCircuited:!0};let $n=new Map(k.fetchers),{loaderData:Zn,errors:va}=Ny(k,q,Kn,Oe,mt,Rn,$n);$e&&k.errors&&(va={...k.errors,...va});let hl=Qn($n),ra=bn(A,$n),vr=hl||ra||mt.length>0;return{matches:q,loaderData:Zn,errors:va,...vr?{workingFetchers:$n}:{}}}function $t(D){if(D&&!Ba(D[1]))return{[D[0]]:D[1].data};if(k.actionData)return Object.keys(k.actionData).length===0?null:k.actionData}function Wt(D){let _=new Map(k.fetchers);return D.forEach(q=>{let J=_.get(q.key),ie=So(void 0,J?J.data:void 0);_.set(q.key,ie)}),_}async function Fn(D,_,q,J){Dt(D);let ie=(J&&J.flushSync)===!0,Te=h.activeRoutes,be=um(k.location,k.matches,p,q,_,J==null?void 0:J.relative),Ce=fr(Te,be,p,!1,h.branches),Re=Pt(Ce,Te,be);if(Re.active&&Re.matches&&(Ce=Re.matches),!Ce){Ae(D,_,er(404,{pathname:be}),{flushSync:ie});return}let{path:Le,submission:$e,error:We}=py(!0,be,J);if(We){Ae(D,_,We,{flushSync:ie});return}let Oe=e.getContext?await e.getContext():new cy,tt=(J&&J.preventScrollReset)===!0;if($e&&fa($e.formMethod)){await Vn(D,_,Le,Ce,Oe,Re.active,ie,tt,$e,J&&J.defaultShouldRevalidate);return}ue.set(D,{routeId:_,path:Le}),await rn(D,_,Le,Ce,Oe,Re.active,ie,tt,$e)}async function Vn(D,_,q,J,ie,Te,be,Ce,Re,Le){Yn(),ue.delete(D);let $e=k.fetchers.get(D);me(D,IN(Re,$e),{flushSync:be});let We=new AbortController,Oe=pi(e.history,q,We.signal,Re);if(Te){let kt=await gt(J,new URL(Oe.url).pathname,Oe.signal,D);if(kt.type==="aborted")return;if(kt.type==="error"){Ae(D,_,kt.error,{flushSync:be});return}else if(kt.matches)J=kt.matches;else{Ae(D,_,er(404,{pathname:q}),{flushSync:be});return}}let tt=Uu(J,q);if(!tt.route.action&&!tt.route.lazy){let kt=er(405,{method:Re.formMethod,pathname:q,routeId:_});Ae(D,_,kt,{flushSync:be});return}P.set(D,We);let Fe=se,Ft=yi(c,d,Oe,q,J,tt,s,ie),at=await ma(Oe,q,Ft,ie,D),ht=at[tt.route.id];if(!ht){for(let kt of Ft)if(at[kt.route.id]){ht=at[kt.route.id];break}}if(Oe.signal.aborted){P.get(D)===We&&P.delete(D);return}if(xe.has(D)){if(Ss(ht)||Ba(ht)){me(D,Ar(void 0));return}}else{if(Ss(ht))if(P.delete(D),A>Fe){me(D,Ar(void 0));return}else return K.add(D),me(D,So(Re)),ha(Oe,ht,!1,{fetcherSubmission:Re,preventScrollReset:Ce});if(Ba(ht)){Ae(D,_,ht.error);return}}let dt=k.navigation.location||k.location,mt=pi(e.history,dt,We.signal),tn=h.activeRoutes,Kn=k.navigation.state!=="idle"?fr(tn,k.navigation.location,p,!1,h.branches):k.matches;lt(Kn,"Didn't find any matches after fetcher action");let Rn=++se;I.set(D,Rn);let{dsMatches:zn,revalidatingFetchers:$n}=gy(mt,ie,c,d,e.history,k,Kn,Re,dt,s,!1,F,fe,xe,ue,K,tn,p,e.patchRoutesOnNavigation!=null,h.branches,[tt.route.id,ht],Le),Zn=So(Re,ht.data),va=new Map(k.fetchers);va.set(D,Zn),$n.filter(kt=>kt.key!==D).forEach(kt=>{let Da=kt.key,Wn=va.get(Da),Wl=So(void 0,Wn?Wn.data:void 0);va.set(Da,Wl),Dt(Da),kt.controller&&P.set(Da,kt.controller)}),pt({fetchers:va});let hl=()=>$n.forEach(kt=>Dt(kt.key));We.signal.addEventListener("abort",hl);let{loaderResults:ra,fetcherResults:vr}=await aa(zn,$n,mt,dt,ie);if(We.signal.aborted)return;We.signal.removeEventListener("abort",hl),I.delete(D),P.delete(D),$n.forEach(kt=>P.delete(kt.key));let Je=k.fetchers.has(D),Rt=kt=>{if(!Je)return kt;let Da=new Map(kt.fetchers);return Da.set(D,Ar(ht.data)),{...kt,fetchers:Da}},nn=wu(ra);if(nn)return k=Rt(k),ha(mt,nn.result,!1,{preventScrollReset:Ce});if(nn=wu(vr),nn)return K.add(nn.key),k=Rt(k),ha(mt,nn.result,!1,{preventScrollReset:Ce});let la=new Map(k.fetchers);Je&&la.set(D,Ar(ht.data));let{loaderData:Un,errors:Lr}=Ny(k,Kn,ra,void 0,$n,vr,la);bn(Rn,la),k.navigation.state==="loading"&&Rn>A?(lt(re,"Expected pending action"),ye&&ye.abort(),ce(k.navigation.location,{matches:Kn,loaderData:Un,errors:Lr,fetchers:la})):(pt({errors:Lr,loaderData:Ey(k.loaderData,Un,Kn,Lr),fetchers:la}),F=!1)}async function rn(D,_,q,J,ie,Te,be,Ce,Re){let Le=k.fetchers.get(D);me(D,So(Re,Le?Le.data:void 0),{flushSync:be});let $e=new AbortController,We=pi(e.history,q,$e.signal);if(Te){let ht=await gt(J,new URL(We.url).pathname,We.signal,D);if(ht.type==="aborted")return;if(ht.type==="error"){Ae(D,_,ht.error,{flushSync:be});return}else if(ht.matches)J=ht.matches;else{Ae(D,_,er(404,{pathname:q}),{flushSync:be});return}}let Oe=Uu(J,q);P.set(D,$e);let tt=se,Fe=yi(c,d,We,q,J,Oe,s,ie),Ft=await ma(We,q,Fe,ie,D),at=Ft[Oe.route.id];if(!at){for(let ht of J)if(Ft[ht.route.id]){at=Ft[ht.route.id];break}}if(P.get(D)===$e&&P.delete(D),!We.signal.aborted){if(xe.has(D)){me(D,Ar(void 0));return}if(Ss(at))if(A>tt){me(D,Ar(void 0));return}else{K.add(D),await ha(We,at,!1,{preventScrollReset:Ce});return}if(Ba(at)){Ae(D,_,at.error);return}me(D,Ar(at.data))}}async function ha(D,_,q,{submission:J,fetcherSubmission:ie,preventScrollReset:Te,replace:be}={}){q||(pe==null||pe.resolve(),pe=null),_.response.headers.has("X-Remix-Revalidate")&&(F=!0);let Ce=_.response.headers.get("Location");lt(Ce,"Expected a Location header on the redirect Response"),Ce=wy(Ce,new URL(D.url),p,e.history);let Re=qo(k.location,Ce,{_isRedirect:!0});if(r){let Fe=!1;if(_.response.headers.has("X-Remix-Reload-Document"))Fe=!0;else if(Cm(Ce)){const Ft=Mb(a,Ce,!0);Fe=Ft.origin!==a.location.origin||Ha(Ft.pathname,p)==null}if(Fe){be?a.location.replace(Ce):a.location.assign(Ce);return}}ye=null;let Le=be===!0||_.response.headers.has("X-Remix-Replace")?"REPLACE":"PUSH",{formMethod:$e,formAction:We,formEncType:Oe}=k.navigation;!J&&!ie&&$e&&We&&Oe&&(J=ky(k.navigation));let tt=J||ie;if(mN.has(_.response.status)&&tt&&fa(tt.formMethod))await Ht(Le,Re,{submission:{...tt,formAction:Ce},preventScrollReset:Te||Se,enableViewTransition:q?he:void 0});else{let Fe=Bh(Re,[],Le,J);await Ht(Le,Re,{overrideNavigation:Fe,fetcherSubmission:ie,preventScrollReset:Te||Se,enableViewTransition:q?he:void 0})}}async function ma(D,_,q,J,ie){var Ce;let Te,be={};try{Te=await EN(g,D,_,q,ie,J,!1)}catch(Re){return q.filter(Le=>Le.shouldLoad).forEach(Le=>{be[Le.route.id]={type:"error",error:Re}}),be}if(D.signal.aborted)return be;if(!fa(D.method))for(let Re of q){if(((Ce=Te[Re.route.id])==null?void 0:Ce.type)==="error")break;!Te.hasOwnProperty(Re.route.id)&&!k.loaderData.hasOwnProperty(Re.route.id)&&(!k.errors||!k.errors.hasOwnProperty(Re.route.id))&&Re.shouldCallHandler()&&(Te[Re.route.id]={type:"error",result:new Error(`No result returned from dataStrategy for route ${Re.route.id}`)})}for(let[Re,Le]of Object.entries(Te))if(LN(Le)){let $e=Le.result;be[Re]={type:"redirect",response:TN($e,D,Re,q,p)}}else be[Re]=await kN(Le);return be}async function aa(D,_,q,J,ie){let Te=ma(q,J,D,ie,null),be=Promise.all(_.map(async Le=>{if(Le.matches&&Le.match&&Le.request&&Le.controller){let We=(await ma(Le.request,Le.path,Le.matches,ie,Le.key))[Le.match.route.id];return{[Le.key]:We}}else return Promise.resolve({[Le.key]:{type:"error",error:er(404,{pathname:Le.path})}})})),Ce=await Te,Re=(await be).reduce((Le,$e)=>Object.assign(Le,$e),{});return{loaderResults:Ce,fetcherResults:Re}}function Yn(){F=!0,ue.forEach((D,_)=>{P.has(_)&&fe.add(_),Dt(_)})}function me(D,_,q={}){let J=new Map(k.fetchers);J.set(D,_),pt({fetchers:J},{flushSync:(q&&q.flushSync)===!0})}function Ae(D,_,q,J={}){let ie=ql(k.matches,_),Te=new Map(k.fetchers);Pe(Te,D),pt({errors:{[ie.route.id]:q},fetchers:Te},{flushSync:(J&&J.flushSync)===!0})}function De(D){return ge.set(D,(ge.get(D)||0)+1),xe.has(D)&&xe.delete(D),k.fetchers.get(D)||Yb}function Qe(D,_){Dt(D,_==null?void 0:_.reason),me(D,Ar(null))}function Pe(D,_){let q=k.fetchers.get(_);P.has(_)&&!(q&&q.state==="loading"&&I.has(_))&&Dt(_),ue.delete(_),I.delete(_),K.delete(_),xe.delete(_),fe.delete(_),D.delete(_)}function ee(D){let _=(ge.get(D)||0)-1;_<=0?(ge.delete(D),xe.add(D)):ge.set(D,_),pt({fetchers:new Map(k.fetchers)})}function Dt(D,_){let q=P.get(D);q&&(q.abort(_),P.delete(D))}function Jt(D,_){for(let q of D){let J=_.get(q);lt(J,`Expected fetcher: ${q}`);let ie=Ar(J.data);_.set(q,ie)}}function Qn(D){let _=[],q=!1;for(let J of K){let ie=D.get(J);lt(ie,`Expected fetcher: ${J}`),ie.state==="loading"&&(K.delete(J),_.push(J),q=!0)}return Jt(_,D),q}function bn(D,_){let q=[];for(let[J,ie]of I)if(ie<D){let Te=_.get(J);lt(Te,`Expected fetcher: ${J}`),Te.state==="loading"&&(Dt(J),I.delete(J),q.push(J))}return Jt(q,_),q.length>0}function qa(D,_){let q=k.blockers.get(D)||wo;return ke.get(D)!==_&&ke.set(D,_),q}function _e(D){k.blockers.delete(D),ke.delete(D)}function bt(D,_){let q=k.blockers.get(D)||wo;lt(q.state==="unblocked"&&_.state==="blocked"||q.state==="blocked"&&_.state==="blocked"||q.state==="blocked"&&_.state==="proceeding"||q.state==="blocked"&&_.state==="unblocked"||q.state==="proceeding"&&_.state==="unblocked",`Invalid blocker state transition: ${q.state} -> ${_.state}`);let J=new Map(k.blockers);J.set(D,_),pt({blockers:J})}function wt({currentLocation:D,nextLocation:_,historyAction:q}){if(ke.size===0)return;ke.size>1&&pn(!1,"A router only supports one blocker at a time");let J=Array.from(ke.entries()),[ie,Te]=J[J.length-1],be=k.blockers.get(ie);if(!(be&&be.state==="proceeding")&&Te({currentLocation:D,nextLocation:_,historyAction:q}))return ie}function Et(D){let _=er(404,{pathname:D}),q=h.activeRoutes,{matches:J,route:ie}=bu(q);return{notFoundMatches:J,route:ie,error:_}}function qt(D,_,q){if(w=D,R=_,j=q||null,!M&&k.navigation===Uh){M=!0;let J=en(k.location,k.matches);J!=null&&pt({restoreScrollPosition:J})}return()=>{w=null,R=null,j=null}}function Ct(D,_){return j&&j(D,_.map(J=>Lb(J,k.loaderData)))||D.key}function ln(D,_){if(w&&R){let q=Ct(D,_);w[q]=R()}}function en(D,_){if(w){let q=Ct(D,_),J=w[q];if(typeof J=="number")return J}return null}function Pt(D,_,q){if(e.patchRoutesOnNavigation){let J=h.branches;if(D){if(Object.keys(D[0].params).length>0)return{active:!0,matches:fr(_,q,p,!0,J)}}else return{active:!0,matches:fr(_,q,p,!0,J)||[]}}return{active:!1,matches:null}}async function gt(D,_,q,J){if(!e.patchRoutesOnNavigation)return{type:"success",matches:D};let ie=D;for(;;){let Te=d;try{await e.patchRoutesOnNavigation({signal:q,path:_,matches:ie,fetcherKey:J,patch:(Le,$e)=>{q.aborted||xy(Le,$e,h,Te,c,!1)}})}catch(Le){return{type:"error",error:Le,partialMatches:ie}}if(q.aborted)return{type:"aborted"};let be=h.branches,Ce=fr(h.activeRoutes,_,p,!1,be),Re=null;if(Ce){if(Object.keys(Ce[0].params).length===0)return{type:"success",matches:Ce};if(Re=fr(h.activeRoutes,_,p,!0,be),!(Re&&ie.length<Re.length&&nt(ie,Re.slice(0,ie.length))))return{type:"success",matches:Ce}}if(Re||(Re=fr(h.activeRoutes,_,p,!0,be)),!Re||nt(ie,Re))return{type:"success",matches:null};ie=Re}}function nt(D,_){return D.length===_.length&&D.every((q,J)=>q.route.id===_[J].route.id)}function jn(D){d={},h.setHmrRoutes(Po(D,c,void 0,d))}function Ln(D,_,q=!1){xy(D,_,h,d,c,q),h.hasHMRRoutes||pt({})}return U={get basename(){return p},get future(){return v},get state(){return k},get routes(){return h.stableRoutes},get branches(){return h.branches},get manifest(){return d},get window(){return a},initialize:Ze,subscribe:It,enableScrollRestoration:qt,navigate:qe,fetch:Fn,revalidate:st,createHref:D=>e.history.createHref(D),encodeLocation:D=>e.history.encodeLocation(D),getFetcher:De,resetFetcher:Qe,deleteFetcher:ee,dispose:dn,getBlocker:qa,deleteBlocker:_e,patchRoutes:Ln,_internalFetchControllers:P,_internalSetRoutes:jn,_internalSetStateDoNotUseOrYouWillBreakYourApp(D){pt(D)}},e.instrumentations&&(U=sN(U,e.instrumentations.map(D=>D.router).filter(Boolean))),U}function vN(e){return e!=null&&("formData"in e&&e.formData!=null||"body"in e&&e.body!==void 0)}function um(e,a,r,s,u,c){let d,h;if(u){d=[];for(let g of a)if(d.push(g),g.route.id===u){h=g;break}}else d=a,h=a[a.length-1];let p=id(s||".",Om(d),Ha(e.pathname,r)||e.pathname,c==="path");if(s==null&&(p.search=e.search,p.hash=e.hash),(s==null||s===""||s===".")&&h){let g=zm(p.search);if(h.route.index&&!g)p.search=p.search?p.search.replace(/^\?/,"?index&"):"?index";else if(!h.route.index&&g){let v=new URLSearchParams(p.search),y=v.getAll("index");v.delete("index"),y.filter(N=>N).forEach(N=>v.append("index",N));let S=v.toString();p.search=S?`?${S}`:""}}return r!=="/"&&(p.pathname=JS({basename:r,pathname:p.pathname})),Or(p)}function py(e,a,r){if(!r||!vN(r))return{path:a};if(r.formMethod&&!UN(r.formMethod))return{path:a,error:er(405,{method:r.formMethod})};let s=()=>({path:a,error:er(400,{type:"invalid-body"})}),c=(r.formMethod||"get").toUpperCase(),d=n0(a);if(r.body!==void 0){if(r.formEncType==="text/plain"){if(!fa(c))return s();let y=typeof r.body=="string"?r.body:r.body instanceof FormData||r.body instanceof URLSearchParams?Array.from(r.body.entries()).reduce((S,[N,w])=>`${S}${N}=${w}
59
- `,""):String(r.body);return{path:a,submission:{formMethod:c,formAction:d,formEncType:r.formEncType,formData:void 0,json:void 0,text:y}}}else if(r.formEncType==="application/json"){if(!fa(c))return s();try{let y=typeof r.body=="string"?JSON.parse(r.body):r.body;return{path:a,submission:{formMethod:c,formAction:d,formEncType:r.formEncType,formData:void 0,json:y,text:void 0}}}catch{return s()}}}lt(typeof FormData=="function","FormData is not available in this environment");let h,p;if(r.formData)h=hm(r.formData),p=r.formData;else if(r.body instanceof FormData)h=hm(r.body),p=r.body;else if(r.body instanceof URLSearchParams)h=r.body,p=Sy(h);else if(r.body==null)h=new URLSearchParams,p=new FormData;else try{h=new URLSearchParams(r.body),p=Sy(h)}catch{return s()}let g={formMethod:c,formAction:d,formEncType:r&&r.formEncType||"application/x-www-form-urlencoded",formData:p,json:void 0,text:void 0};if(fa(g.formMethod))return{path:a,submission:g};let v=Mr(a);return e&&v.search&&zm(v.search)&&h.append("index",""),v.search=`?${h}`,{path:Or(v),submission:g}}function gy(e,a,r,s,u,c,d,h,p,g,v,y,S,N,w,j,R,M,$,B,Y,ne){var L;let ae=Y?Ba(Y[1])?Y[1].error:Y[1].data:void 0,U=u.createURL(c.location),k=u.createURL(p),re;if(v&&c.errors){let F=Object.keys(c.errors)[0];re=d.findIndex(fe=>fe.route.id===F)}else if(Y&&Ba(Y[1])){let F=Y[0];re=d.findIndex(fe=>fe.route.id===F)-1}let pe=Y?Y[1].statusCode:void 0,Se=pe&&pe>=400,ye={currentUrl:U,currentParams:((L=c.matches[0])==null?void 0:L.params)||{},nextUrl:k,nextParams:d[0].params,...h,actionResult:ae,actionStatus:pe},he=Zo(d),je=d.map((F,fe)=>{let{route:P}=F,se=null;if(re!=null&&fe>re)se=!1;else if(P.lazy)se=!0;else if(!_m(P))se=!1;else if(v){let{shouldLoad:ue}=Qb(P,c.loaderData,c.errors);se=ue}else yN(c.loaderData,c.matches[fe],F)&&(se=!0);if(se!==null)return dm(r,s,e,p,he,F,g,a,se);let A=!1;typeof ne=="boolean"?A=ne:Se?A=!1:(y||U.pathname+U.search===k.pathname+k.search||U.search!==k.search||bN(c.matches[fe],F))&&(A=!0);let I={...ye,defaultShouldRevalidate:A},K=_o(F,I);return dm(r,s,e,p,he,F,g,a,K,I,ne)}),W=[];return w.forEach((F,fe)=>{if(v||!d.some(xe=>xe.route.id===F.routeId)||N.has(fe))return;let P=c.fetchers.get(fe),se=P&&P.state!=="idle"&&P.data===void 0,A=fr(R,F.path,M??"/",!1,B);if(!A){if($&&se)return;W.push({key:fe,routeId:F.routeId,path:F.path,matches:null,match:null,request:null,controller:null});return}if(j.has(fe))return;let I=Uu(A,F.path),K=new AbortController,ue=pi(u,F.path,K.signal),ge=null;if(S.has(fe))S.delete(fe),ge=yi(r,s,ue,F.path,A,I,g,a);else if(se)y&&(ge=yi(r,s,ue,F.path,A,I,g,a));else{let xe;typeof ne=="boolean"?xe=ne:Se?xe=!1:xe=y;let ke={...ye,defaultShouldRevalidate:xe};_o(I,ke)&&(ge=yi(r,s,ue,F.path,A,I,g,a,ke))}ge&&W.push({key:fe,routeId:F.routeId,path:F.path,matches:ge,match:I,request:ue,controller:K})}),{dsMatches:je,revalidatingFetchers:W}}function _m(e){return e.loader!=null||e.middleware!=null&&e.middleware.length>0}function Qb(e,a,r){if(e.lazy)return{shouldLoad:!0,renderFallback:!0};if(!_m(e))return{shouldLoad:!1,renderFallback:!1};let s=a!=null&&e.id in a,u=r!=null&&r[e.id]!==void 0;if(!s&&u)return{shouldLoad:!1,renderFallback:!1};if(typeof e.loader=="function"&&e.loader.hydrate===!0)return{shouldLoad:!0,renderFallback:!s};let c=!s&&!u;return{shouldLoad:c,renderFallback:c}}function yN(e,a,r){let s=!a||r.route.id!==a.route.id,u=!e.hasOwnProperty(r.route.id);return s||u}function bN(e,a){let r=e.route.path;return e.pathname!==a.pathname||r!=null&&r.endsWith("*")&&e.params["*"]!==a.params["*"]}function _o(e,a){if(e.route.shouldRevalidate){let r=e.route.shouldRevalidate(a);if(typeof r=="boolean")return r}return a.defaultShouldRevalidate}function xy(e,a,r,s,u,c){let d;if(e){let g=s[e];lt(g,`No route found to patch children into: routeId = ${e}`),g.children||(g.children=[]),d=g.children}else d=r.activeRoutes;let h=[],p=[];if(a.forEach(g=>{let v=d.find(y=>Kb(g,y));v?p.push({existingRoute:v,newRoute:g}):h.push(g)}),h.length>0){let g=Po(h,u,[e||"_","patch",String((d==null?void 0:d.length)||"0")],s);d.push(...g)}if(c&&p.length>0)for(let g=0;g<p.length;g++){let{existingRoute:v,newRoute:y}=p[g],S=v,[N]=Po([y],u,[],{},!0);Object.assign(S,{element:N.element?N.element:S.element,errorElement:N.errorElement?N.errorElement:S.errorElement,hydrateFallbackElement:N.hydrateFallbackElement?N.hydrateFallbackElement:S.hydrateFallbackElement})}r.hasHMRRoutes||r.setRoutes([...r.activeRoutes])}function Kb(e,a){var r;return"id"in e&&"id"in a&&e.id===a.id?!0:e.index===a.index&&e.path===a.path&&e.caseSensitive===a.caseSensitive?(!e.children||e.children.length===0)&&(!a.children||a.children.length===0)?!0:((r=e.children)==null?void 0:r.every((s,u)=>{var c;return(c=a.children)==null?void 0:c.some(d=>Kb(s,d))}))??!1:!1}var vy=new WeakMap,Zb=({key:e,route:a,manifest:r,mapRouteProperties:s})=>{let u=r[a.id];if(lt(u,"No route found in manifest"),!u.lazy||typeof u.lazy!="object")return;let c=u.lazy[e];if(!c)return;let d=vy.get(u);d||(d={},vy.set(u,d));let h=d[e];if(h)return h;let p=(async()=>{let g=US(e),y=u[e]!==void 0&&e!=="hasErrorBoundary";if(g)pn(!g,"Route property "+e+" is not a supported lazy route property. This property will be ignored."),d[e]=Promise.resolve();else if(y)pn(!1,`Route "${u.id}" has a static property "${e}" defined. The lazy property will be ignored.`);else{let S=await c();S!=null&&(Object.assign(u,{[e]:S}),Object.assign(u,s(u)))}typeof u.lazy=="object"&&(u.lazy[e]=void 0,Object.values(u.lazy).every(S=>S===void 0)&&(u.lazy=void 0))})();return d[e]=p,p},yy=new WeakMap;function wN(e,a,r,s,u){let c=r[e.id];if(lt(c,"No route found in manifest"),!e.lazy)return{lazyRoutePromise:void 0,lazyHandlerPromise:void 0};if(typeof e.lazy=="function"){let v=yy.get(c);if(v)return{lazyRoutePromise:v,lazyHandlerPromise:v};let y=(async()=>{lt(typeof e.lazy=="function","No lazy route function found");let S=await e.lazy(),N={};for(let w in S){let j=S[w];if(j===void 0)continue;let R=IS(w),$=c[w]!==void 0&&w!=="hasErrorBoundary";R?pn(!R,"Route property "+w+" is not a supported property to be returned from a lazy route function. This property will be ignored."):$?pn(!$,`Route "${c.id}" has a static property "${w}" defined but its lazy function is also returning a value for this property. The lazy route property "${w}" will be ignored.`):N[w]=j}Object.assign(c,N),Object.assign(c,{...s(c),lazy:void 0})})();return yy.set(c,y),y.catch(()=>{}),{lazyRoutePromise:y,lazyHandlerPromise:y}}let d=Object.keys(e.lazy),h=[],p;for(let v of d){if(u&&u.includes(v))continue;let y=Zb({key:v,route:e,manifest:r,mapRouteProperties:s});y&&(h.push(y),v===a&&(p=y))}let g=h.length>0?Promise.all(h).then(()=>{}):void 0;return g==null||g.catch(()=>{}),p==null||p.catch(()=>{}),{lazyRoutePromise:g,lazyHandlerPromise:p}}async function by(e){let a=e.matches.filter(u=>u.shouldLoad),r={};return(await Promise.all(a.map(u=>u.resolve()))).forEach((u,c)=>{r[a[c].route.id]=u}),r}async function SN(e){return e.matches.some(a=>a.route.middleware)?Wb(e,()=>by(e)):by(e)}function Wb(e,a){return NN(e,a,s=>{if($N(s))throw s;return s},MN,r);function r(s,u,c){if(c)return Promise.resolve(Object.assign(c.value,{[u]:{type:"error",result:s}}));{let{matches:d}=e,h=Math.min(Math.max(d.findIndex(g=>g.route.id===u),0),Math.max(d.findIndex(g=>g.shouldCallHandler()),0)),p=ql(d,d[h].route.id).route.id;return Promise.resolve({[p]:{type:"error",result:s}})}}}async function NN(e,a,r,s,u){let{matches:c,...d}=e,h=c.flatMap(g=>g.route.middleware?g.route.middleware.map(v=>[g.route.id,v]):[]);return await Jb(d,h,a,r,s,u)}async function Jb(e,a,r,s,u,c,d=0){let{request:h}=e;if(h.signal.aborted)throw h.signal.reason??new Error(`Request aborted: ${h.method} ${h.url}`);let p=a[d];if(!p)return await r();let[g,v]=p,y,S=async()=>{if(y)throw new Error("You may only call `next()` once per middleware");try{return y={value:await Jb(e,a,r,s,u,c,d+1)},y.value}catch(N){return y={value:await c(N,g,y)},y.value}};try{let N=await v(e,S),w=N!=null?s(N):void 0;return u(w)?w:y?w??y.value:(y={value:await S()},y.value)}catch(N){return await c(N,g,y)}}function e0(e,a,r,s,u){let c=Zb({key:"middleware",route:s.route,manifest:a,mapRouteProperties:e}),d=wN(s.route,fa(r.method)?"action":"loader",a,e,u);return{middleware:c,route:d.lazyRoutePromise,handler:d.lazyHandlerPromise}}function dm(e,a,r,s,u,c,d,h,p,g=null,v){let y=!1,S=e0(e,a,r,c,d);return{...c,_lazyPromises:S,shouldLoad:p,shouldRevalidateArgs:g,shouldCallHandler(N){return y=!0,g?typeof v=="boolean"?_o(c,{...g,defaultShouldRevalidate:v}):typeof N=="boolean"?_o(c,{...g,defaultShouldRevalidate:N}):_o(c,g):p},resolve(N){let{lazy:w,loader:j,middleware:R}=c.route,M=y||p||N&&!fa(r.method)&&(w||j),$=R&&R.length>0&&!j&&!w;return M&&(fa(r.method)||!$)?jN({request:r,path:s,pattern:u,match:c,lazyHandlerPromise:S==null?void 0:S.handler,lazyRoutePromise:S==null?void 0:S.route,handlerOverride:N,scopedContext:h}):Promise.resolve({type:"data",result:void 0})}}}function yi(e,a,r,s,u,c,d,h,p=null){return u.map(g=>g.route.id!==c.route.id?{...g,shouldLoad:!1,shouldRevalidateArgs:p,shouldCallHandler:()=>!1,_lazyPromises:e0(e,a,r,g,d),resolve:()=>Promise.resolve({type:"data",result:void 0})}:dm(e,a,r,s,Zo(u),g,d,h,!0,p))}async function EN(e,a,r,s,u,c,d){s.some(v=>{var y;return(y=v._lazyPromises)==null?void 0:y.middleware})&&await Promise.all(s.map(v=>{var y;return(y=v._lazyPromises)==null?void 0:y.middleware}));let h={request:a,url:t0(a,r),pattern:Zo(s),params:s[0].params,context:c,matches:s},g=await e({...h,fetcherKey:u,runClientMiddleware:v=>{let y=h;return Wb(y,()=>v({...y,fetcherKey:u,runClientMiddleware:()=>{throw new Error("Cannot call `runClientMiddleware()` from within an `runClientMiddleware` handler")}}))}});try{await Promise.all(s.flatMap(v=>{var y,S;return[(y=v._lazyPromises)==null?void 0:y.handler,(S=v._lazyPromises)==null?void 0:S.route]}))}catch{}return g}async function jN({request:e,path:a,pattern:r,match:s,lazyHandlerPromise:u,lazyRoutePromise:c,handlerOverride:d,scopedContext:h}){let p,g,v=fa(e.method),y=v?"action":"loader",S=N=>{let w,j=new Promise(($,B)=>w=B);g=()=>w(),e.signal.addEventListener("abort",g);let R=$=>typeof N!="function"?Promise.reject(new Error(`You cannot call the handler for a route which defines a boolean "${y}" [routeId: ${s.route.id}]`)):N({request:e,url:t0(e,a),pattern:r,params:s.params,context:h},...$!==void 0?[$]:[]),M=(async()=>{try{return{type:"data",result:await(d?d(B=>R(B)):R())}}catch($){return{type:"error",result:$}}})();return Promise.race([M,j])};try{let N=v?s.route.action:s.route.loader;if(u||c)if(N){let w,[j]=await Promise.all([S(N).catch(R=>{w=R}),u,c]);if(w!==void 0)throw w;p=j}else{await u;let w=v?s.route.action:s.route.loader;if(w)[p]=await Promise.all([S(w),c]);else if(y==="action"){let j=new URL(e.url),R=j.pathname+j.search;throw er(405,{method:e.method,pathname:R,routeId:s.route.id})}else return{type:"data",result:void 0}}else if(N)p=await S(N);else{let w=new URL(e.url),j=w.pathname+w.search;throw er(404,{pathname:j})}}catch(N){return{type:"error",result:N}}finally{g&&e.signal.removeEventListener("abort",g)}return p}async function RN(e){let a=e.headers.get("Content-Type");return a&&/\bapplication\/json\b/.test(a)?e.body==null?null:e.json():e.text()}async function kN(e){var s,u,c,d,h;let{result:a,type:r}=e;if(Lm(a)){let p;try{p=await RN(a)}catch(g){return{type:"error",error:g}}return r==="error"?{type:"error",error:new Ko(a.status,a.statusText,p),statusCode:a.status,headers:a.headers}:{type:"data",data:p,statusCode:a.status,headers:a.headers}}return r==="error"?Ry(a)?a.data instanceof Error?{type:"error",error:a.data,statusCode:(s=a.init)==null?void 0:s.status,headers:(u=a.init)!=null&&u.headers?new Headers(a.init.headers):void 0}:{type:"error",error:ON(a),statusCode:Si(a)?a.status:void 0,headers:(c=a.init)!=null&&c.headers?new Headers(a.init.headers):void 0}:{type:"error",error:a,statusCode:Si(a)?a.status:void 0}:Ry(a)?{type:"data",data:a.data,statusCode:(d=a.init)==null?void 0:d.status,headers:(h=a.init)!=null&&h.headers?new Headers(a.init.headers):void 0}:{type:"data",data:a}}function TN(e,a,r,s,u){let c=e.headers.get("Location");if(lt(c,"Redirects returned/thrown from loaders/actions must have a Location header"),!Cm(c)){let d=s.slice(0,s.findIndex(h=>h.route.id===r)+1);c=um(new URL(a.url),d,u,c),e.headers.set("Location",c)}return e}var AN=["about:","blob:","chrome:","chrome-untrusted:","content:","data:","devtools:","file:","filesystem:","javascript:"];function fm(e){try{return AN.includes(new URL(e).protocol)}catch{return!1}}function wy(e,a,r,s){if(Cm(e)){let u=e,c=Dm.test(u)?new URL(Ob(u,a.protocol)):new URL(u);if(fm(c.toString()))throw new Error("Invalid redirect location");let d=Ha(c.pathname,r)!=null;if(c.origin===a.origin&&d)return Mm(c.pathname)+c.search+c.hash}try{let u=s.createURL(e);if(fm(u.toString()))throw new Error("Invalid redirect location")}catch{}return e}function pi(e,a,r,s){let u=e.createURL(n0(a)).toString(),c={signal:r};if(s&&fa(s.formMethod)){let{formMethod:d,formEncType:h}=s;c.method=d.toUpperCase(),h==="application/json"?(c.headers=new Headers({"Content-Type":h}),c.body=JSON.stringify(s.json)):h==="text/plain"?c.body=s.text:h==="application/x-www-form-urlencoded"&&s.formData?c.body=hm(s.formData):c.body=s.formData}return new Request(u,c)}function t0(e,a){let r=new URL(e.url),s=typeof a=="string"?Mr(a):a;if(r.pathname=s.pathname||"/",s.search){let u=new URLSearchParams(s.search),c=u.getAll("index");u.delete("index");for(let d of c.filter(Boolean))u.append("index",d);r.search=u.size?`?${u.toString()}`:""}else r.search="";return r.hash=s.hash||"",r}function hm(e){let a=new URLSearchParams;for(let[r,s]of e.entries())a.append(r,typeof s=="string"?s:s.name);return a}function Sy(e){let a=new FormData;for(let[r,s]of e.entries())a.append(r,s);return a}function DN(e,a,r,s=!1,u=!1){let c={},d=null,h,p=!1,g={},v=r&&Ba(r[1])?r[1].error:void 0;return e.forEach(y=>{if(!(y.route.id in a))return;let S=y.route.id,N=a[S];if(lt(!Ss(N),"Cannot handle redirect results in processLoaderData"),Ba(N)){let w=N.error;if(v!==void 0&&(w=v,v=void 0),d=d||{},u)d[S]=w;else{let j=ql(e,S);d[j.route.id]==null&&(d[j.route.id]=w)}s||(c[S]=Xb),p||(p=!0,h=Si(N.error)?N.error.status:500),N.headers&&(g[S]=N.headers)}else c[S]=N.data,N.statusCode&&N.statusCode!==200&&!p&&(h=N.statusCode),N.headers&&(g[S]=N.headers)}),v!==void 0&&r&&(d={[r[0]]:v},r[2]&&(c[r[2]]=void 0)),{loaderData:c,errors:d,statusCode:h||200,loaderHeaders:g}}function Ny(e,a,r,s,u,c,d){let{loaderData:h,errors:p}=DN(a,r,s);return u.filter(g=>!g.matches||g.matches.some(v=>v.shouldLoad)).forEach(g=>{let{key:v,match:y,controller:S}=g;if(S&&S.signal.aborted)return;let N=c[v];if(lt(N,"Did not find corresponding fetcher result"),Ba(N)){let w=ql(e.matches,y==null?void 0:y.route.id);p&&p[w.route.id]||(p={...p,[w.route.id]:N.error}),d.delete(v)}else if(Ss(N))lt(!1,"Unhandled fetcher revalidation redirect");else{let w=Ar(N.data);d.set(v,w)}}),{loaderData:h,errors:p}}function Ey(e,a,r,s){let u=Object.entries(a).filter(([,c])=>c!==Xb).reduce((c,[d,h])=>(c[d]=h,c),{});for(let c of r){let d=c.route.id;if(!a.hasOwnProperty(d)&&e.hasOwnProperty(d)&&c.route.loader&&(u[d]=e[d]),s&&s.hasOwnProperty(d))break}return u}function jy(e){return e?Ba(e[1])?{actionData:{}}:{actionData:{[e[0]]:e[1].data}}:{}}function ql(e,a){return(a?e.slice(0,e.findIndex(s=>s.route.id===a)+1):[...e]).reverse().find(s=>s.route.hasErrorBoundary===!0)||e[0]}function bu(e){let a=e.length===1?e[0]:e.find(r=>r.index||!r.path||r.path==="/")||{id:"__shim-error-route__"};return{matches:[{params:{},pathname:"",pathnameBase:"",route:a}],route:a}}function er(e,{pathname:a,routeId:r,method:s,type:u,message:c}={}){let d="Unknown Server Error",h="Unknown @remix-run/router error";return e===400?(d="Bad Request",s&&a&&r?h=`You made a ${s} request to "${a}" but did not provide a \`loader\` for route "${r}", so there is no way to handle the request.`:u==="invalid-body"&&(h="Unable to encode submission body")):e===403?(d="Forbidden",h=`Route "${r}" does not match URL "${a}"`):e===404?(d="Not Found",h=`No route matches URL "${a}"`):e===405&&(d="Method Not Allowed",s&&a&&r?h=`You made a ${s.toUpperCase()} request to "${a}" but did not provide an \`action\` for route "${r}", so there is no way to handle the request.`:s&&(h=`Invalid request method "${s.toUpperCase()}"`)),new Ko(e||500,d,new Error(h),!0)}function wu(e){let a=Object.entries(e);for(let r=a.length-1;r>=0;r--){let[s,u]=a[r];if(Ss(u))return{key:s,result:u}}}function n0(e){let a=typeof e=="string"?Mr(e):e;return Or({...a,hash:""})}function CN(e,a){return e.pathname!==a.pathname||e.search!==a.search?!1:e.hash===""?a.hash!=="":e.hash===a.hash?!0:a.hash!==""}function ON(e){var a,r;return new Ko(((a=e.init)==null?void 0:a.status)??500,((r=e.init)==null?void 0:r.statusText)??"Internal Server Error",e.data)}function MN(e){return e!=null&&typeof e=="object"&&Object.entries(e).every(([a,r])=>typeof a=="string"&&_N(r))}function _N(e){return e!=null&&typeof e=="object"&&"type"in e&&"result"in e&&(e.type==="data"||e.type==="error")}function LN(e){return Lm(e.result)&&Vb.has(e.result.status)}function Ba(e){return e.type==="error"}function Ss(e){return(e&&e.type)==="redirect"}function Ry(e){return typeof e=="object"&&e!=null&&"type"in e&&"data"in e&&"init"in e&&e.type==="DataWithResponseInit"}function Lm(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.headers=="object"&&typeof e.body<"u"}function zN(e){return Vb.has(e)}function $N(e){return Lm(e)&&zN(e.status)&&e.headers.has("Location")}function UN(e){return hN.has(e.toUpperCase())}function fa(e){return dN.has(e.toUpperCase())}function zm(e){return new URLSearchParams(e).getAll("index").some(a=>a==="")}function Uu(e,a){let r=typeof a=="string"?Mr(a).search:a.search;if(e[e.length-1].route.index&&zm(r||""))return e[e.length-1];let s=Ib(e);return s[s.length-1]}function ky(e){let{formMethod:a,formAction:r,formEncType:s,text:u,formData:c,json:d}=e;if(!(!a||!r||!s)){if(u!=null)return{formMethod:a,formAction:r,formEncType:s,formData:void 0,json:void 0,text:u};if(c!=null)return{formMethod:a,formAction:r,formEncType:s,formData:c,json:void 0,text:void 0};if(d!==void 0)return{formMethod:a,formAction:r,formEncType:s,formData:void 0,json:d,text:void 0}}}function Bh(e,a,r,s){return s?{state:"loading",location:e,matches:a,historyAction:r,formMethod:s.formMethod,formAction:s.formAction,formEncType:s.formEncType,formData:s.formData,json:s.json,text:s.text}:{state:"loading",location:e,matches:a,historyAction:r,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0}}function BN(e,a,r,s){return{state:"submitting",location:e,matches:a,historyAction:r,formMethod:s.formMethod,formAction:s.formAction,formEncType:s.formEncType,formData:s.formData,json:s.json,text:s.text}}function So(e,a){return e?{state:"loading",formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:a}:{state:"loading",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:a}}function IN(e,a){return{state:"submitting",formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:a?a.data:void 0}}function Ar(e){return{state:"idle",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:e}}function HN(e,a){try{let r=e.sessionStorage.getItem(Gb);if(r){let s=JSON.parse(r);for(let[u,c]of Object.entries(s||{}))c&&Array.isArray(c)&&a.set(u,new Set(c||[]))}}catch{}}function qN(e,a){if(a.size>0){let r={};for(let[s,u]of a)r[s]=[...u];try{e.sessionStorage.setItem(Gb,JSON.stringify(r))}catch(s){pn(!1,`Failed to save applied view transitions in sessionStorage (${s}).`)}}}function Ty(){let e,a,r=new Promise((s,u)=>{e=async c=>{s(c);try{await r}catch{}},a=async c=>{u(c);try{await r}catch{}}});return{promise:r,resolve:e,reject:a}}var Rs=x.createContext(null);Rs.displayName="DataRouter";var Ei=x.createContext(null);Ei.displayName="DataRouterState";var a0=x.createContext(!1);function r0(){return x.useContext(a0)}var $m=x.createContext({isTransitioning:!1});$m.displayName="ViewTransition";var Um=x.createContext(new Map);Um.displayName="Fetchers";var PN=x.createContext(null);PN.displayName="Await";var Ta=x.createContext(null);Ta.displayName="Navigation";var od=x.createContext(null);od.displayName="Location";var rr=x.createContext({outlet:null,matches:[],isDataRoute:!1});rr.displayName="Route";var Bm=x.createContext(null);Bm.displayName="RouteError";var l0="REACT_ROUTER_ERROR",FN="REDIRECT",VN="ROUTE_ERROR_RESPONSE";function YN(e){if(e.startsWith(`${l0}:${FN}:{`))try{let a=JSON.parse(e.slice(28));if(typeof a=="object"&&a&&typeof a.status=="number"&&typeof a.statusText=="string"&&typeof a.location=="string"&&typeof a.reloadDocument=="boolean"&&typeof a.replace=="boolean")return a}catch{}}function GN(e){if(e.startsWith(`${l0}:${VN}:{`))try{let a=JSON.parse(e.slice(40));if(typeof a=="object"&&a&&typeof a.status=="number"&&typeof a.statusText=="string")return new Ko(a.status,a.statusText,a.data)}catch{}}function XN(e,{relative:a}={}){lt(Wo(),"useHref() may be used only in the context of a <Router> component.");let{basename:r,navigator:s}=x.useContext(Ta),{hash:u,pathname:c,search:d}=Jo(e,{relative:a}),h=c;return r!=="/"&&(h=c==="/"?r:nr([r,c])),s.createHref({pathname:h,search:d,hash:u})}function Wo(){return x.useContext(od)!=null}function Aa(){return lt(Wo(),"useLocation() may be used only in the context of a <Router> component."),x.useContext(od).location}var s0="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function i0(e){x.useContext(Ta).static||x.useLayoutEffect(e)}function _r(){let{isDataRoute:e}=x.useContext(rr);return e?cE():QN()}function QN(){lt(Wo(),"useNavigate() may be used only in the context of a <Router> component.");let e=x.useContext(Rs),{basename:a,navigator:r}=x.useContext(Ta),{matches:s}=x.useContext(rr),{pathname:u}=Aa(),c=JSON.stringify(Om(s)),d=x.useRef(!1);return i0(()=>{d.current=!0}),x.useCallback((p,g={})=>{if(pn(d.current,s0),!d.current)return;if(typeof p=="number"){r.go(p);return}let v=id(p,JSON.parse(c),u,g.relative==="path");e==null&&a!=="/"&&(v.pathname=v.pathname==="/"?a:nr([a,v.pathname])),(g.replace?r.replace:r.push)(v,g.state,g)},[a,r,c,u,e])}var KN=x.createContext(null);function ZN(e){let a=x.useContext(rr).outlet;return x.useMemo(()=>a&&x.createElement(KN.Provider,{value:e},a),[a,e])}function WN(){let{matches:e}=x.useContext(rr),a=e[e.length-1];return(a==null?void 0:a.params)??{}}function Jo(e,{relative:a}={}){let{matches:r}=x.useContext(rr),{pathname:s}=Aa(),u=JSON.stringify(Om(r));return x.useMemo(()=>id(e,JSON.parse(u),s,a==="path"),[e,u,s,a])}function JN(e,a,r){lt(Wo(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:s}=x.useContext(Ta),{matches:u}=x.useContext(rr),c=u[u.length-1],d=c?c.params:{},h=c?c.pathname:"/",p=c?c.pathnameBase:"/",g=c&&c.route;{let R=g&&g.path||"";f0(h,!g||R.endsWith("*")||R.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${h}" (under <Route path="${R}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
60
-
61
- Please change the parent <Route path="${R}"> to <Route path="${R==="/"?"*":`${R}/*`}">.`)}let v=Aa(),y;y=v;let S=y.pathname||"/",N=S;if(p!=="/"){let R=p.replace(/^\//,"").split("/");N="/"+S.replace(/^\//,"").split("/").slice(R.length).join("/")}let w=r&&r.state.matches.length?r.state.matches.map(R=>Object.assign(R,{route:r.manifest[R.route.id]||R.route})):_b(e,{pathname:N});return pn(g||w!=null,`No routes matched location "${y.pathname}${y.search}${y.hash}" `),pn(w==null||w[w.length-1].route.element!==void 0||w[w.length-1].route.Component!==void 0||w[w.length-1].route.lazy!==void 0,`Matched leaf route at location "${y.pathname}${y.search}${y.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`),rE(w&&w.map(R=>Object.assign({},R,{params:Object.assign({},d,R.params),pathname:nr([p,s.encodeLocation?s.encodeLocation(R.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:R.pathname]),pathnameBase:R.pathnameBase==="/"?p:nr([p,s.encodeLocation?s.encodeLocation(R.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:R.pathnameBase])})),u,r)}function eE(){let e=d0(),a=Si(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),r=e instanceof Error?e.stack:null,s="rgba(200,200,200, 0.5)",u={padding:"0.5rem",backgroundColor:s},c={padding:"2px 4px",backgroundColor:s},d=null;return console.error("Error handled by React Router default ErrorBoundary:",e),d=x.createElement(x.Fragment,null,x.createElement("p",null,"💿 Hey developer 👋"),x.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",x.createElement("code",{style:c},"ErrorBoundary")," or"," ",x.createElement("code",{style:c},"errorElement")," prop on your route.")),x.createElement(x.Fragment,null,x.createElement("h2",null,"Unexpected Application Error!"),x.createElement("h3",{style:{fontStyle:"italic"}},a),r?x.createElement("pre",{style:u},r):null,d)}var tE=x.createElement(eE,null),o0=class extends x.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,a){return a.location!==e.location||a.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:a.error,location:a.location,revalidation:e.revalidation||a.revalidation}}componentDidCatch(e,a){this.props.onError?this.props.onError(e,a):console.error("React Router caught the following error during render",e)}render(){let e=this.state.error;if(this.context&&typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){const r=GN(e.digest);r&&(e=r)}let a=e!==void 0?x.createElement(rr.Provider,{value:this.props.routeContext},x.createElement(Bm.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?x.createElement(nE,{error:e},a):a}};o0.contextType=a0;var Ih=new WeakMap;function nE({children:e,error:a}){let{basename:r}=x.useContext(Ta);if(typeof a=="object"&&a&&"digest"in a&&typeof a.digest=="string"){let s=YN(a.digest);if(s){let u=Ih.get(a);if(u)throw u;let c=qb(s.location,r),d=c.absoluteURL||c.to;if(fm(d))throw new Error("Invalid redirect location");if(Hb&&!Ih.get(a))if(c.isExternal||s.reloadDocument)window.location.href=d;else{const h=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(c.to,{replace:s.replace}));throw Ih.set(a,h),h}return x.createElement("meta",{httpEquiv:"refresh",content:`0;url=${d}`})}}return e}function aE({routeContext:e,match:a,children:r}){let s=x.useContext(Rs);return s&&s.static&&s.staticContext&&(a.route.errorElement||a.route.ErrorBoundary)&&(s.staticContext._deepestRenderedBoundaryId=a.route.id),x.createElement(rr.Provider,{value:e},r)}function rE(e,a=[],r){let s=r==null?void 0:r.state;if(e==null){if(!s)return null;if(s.errors)e=s.matches;else if(a.length===0&&!s.initialized&&s.matches.length>0)e=s.matches;else return null}let u=e,c=s==null?void 0:s.errors;if(c!=null){let v=u.findIndex(y=>y.route.id&&(c==null?void 0:c[y.route.id])!==void 0);lt(v>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(c).join(",")}`),u=u.slice(0,Math.min(u.length,v+1))}let d=!1,h=-1;if(r&&s){d=s.renderFallback;for(let v=0;v<u.length;v++){let y=u[v];if((y.route.HydrateFallback||y.route.hydrateFallbackElement)&&(h=v),y.route.id){let{loaderData:S,errors:N}=s,w=y.route.loader&&!S.hasOwnProperty(y.route.id)&&(!N||N[y.route.id]===void 0);if(y.route.lazy||w){r.isStatic&&(d=!0),h>=0?u=u.slice(0,h+1):u=[u[0]];break}}}}let p=r==null?void 0:r.onError,g=s&&p?(v,y)=>{var S,N;p(v,{location:s.location,params:((N=(S=s.matches)==null?void 0:S[0])==null?void 0:N.params)??{},pattern:Zo(s.matches),errorInfo:y})}:void 0;return u.reduceRight((v,y,S)=>{let N,w=!1,j=null,R=null;s&&(N=c&&y.route.id?c[y.route.id]:void 0,j=y.route.errorElement||tE,d&&(h<0&&S===0?(f0("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),w=!0,R=null):h===S&&(w=!0,R=y.route.hydrateFallbackElement||null)));let M=a.concat(u.slice(0,S+1)),$=()=>{let B;return N?B=j:w?B=R:y.route.Component?B=x.createElement(y.route.Component,null):y.route.element?B=y.route.element:B=v,x.createElement(aE,{match:y,routeContext:{outlet:v,matches:M,isDataRoute:s!=null},children:B})};return s&&(y.route.ErrorBoundary||y.route.errorElement||S===0)?x.createElement(o0,{location:s.location,revalidation:s.revalidation,component:j,error:N,children:$(),routeContext:{outlet:null,matches:M,isDataRoute:!0},onError:g}):$()},null)}function Im(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function c0(e){let a=x.useContext(Rs);return lt(a,Im(e)),a}function ks(e){let a=x.useContext(Ei);return lt(a,Im(e)),a}function lE(e){let a=x.useContext(rr);return lt(a,Im(e)),a}function ec(e){let a=lE(e),r=a.matches[a.matches.length-1];return lt(r.route.id,`${e} can only be used on routes that contain a unique "id"`),r.route.id}function sE(){return ec("useRouteId")}function gr(){let e=ks("useNavigation");return x.useMemo(()=>{let{matches:a,historyAction:r,...s}=e.navigation;return s},[e.navigation])}function iE(){let e=c0("useRevalidator"),a=ks("useRevalidator"),r=x.useCallback(async()=>{await e.router.revalidate()},[e.router]);return x.useMemo(()=>({revalidate:r,state:a.revalidation}),[r,a.revalidation])}function u0(){let{matches:e,loaderData:a}=ks("useMatches");return x.useMemo(()=>e.map(r=>Lb(r,a)),[e,a])}function xr(){let e=ks("useLoaderData"),a=ec("useLoaderData");return e.loaderData[a]}function Ts(e){return ks("useRouteLoaderData").loaderData[e]}function oE(){let e=ks("useActionData"),a=ec("useLoaderData");return e.actionData?e.actionData[a]:void 0}function d0(){var s;let e=x.useContext(Bm),a=ks("useRouteError"),r=ec("useRouteError");return e!==void 0?e:(s=a.errors)==null?void 0:s[r]}function cE(){let{router:e}=c0("useNavigate"),a=ec("useNavigate"),r=x.useRef(!1);return i0(()=>{r.current=!0}),x.useCallback(async(u,c={})=>{pn(r.current,s0),r.current&&(typeof u=="number"?await e.navigate(u):await e.navigate(u,{fromRouteId:a,...c}))},[e,a])}var Ay={};function f0(e,a,r){!a&&!Ay[e]&&(Ay[e]=!0,pn(!1,r))}var Dy={};function Cy(e,a){!e&&!Dy[a]&&(Dy[a]=!0,console.warn(a))}var uE="useOptimistic",Oy=kS[uE],dE=()=>{};function fE(e){return Oy?Oy(e):[e,dE]}function hE(e){let a={hasErrorBoundary:e.hasErrorBoundary||e.ErrorBoundary!=null||e.errorElement!=null};return e.Component&&(e.element&&pn(!1,"You should not include both `Component` and `element` on your route - `Component` will be used."),Object.assign(a,{element:x.createElement(e.Component),Component:void 0})),e.HydrateFallback&&(e.hydrateFallbackElement&&pn(!1,"You should not include both `HydrateFallback` and `hydrateFallbackElement` on your route - `HydrateFallback` will be used."),Object.assign(a,{hydrateFallbackElement:x.createElement(e.HydrateFallback),HydrateFallback:void 0})),e.ErrorBoundary&&(e.errorElement&&pn(!1,"You should not include both `ErrorBoundary` and `errorElement` on your route - `ErrorBoundary` will be used."),Object.assign(a,{errorElement:x.createElement(e.ErrorBoundary),ErrorBoundary:void 0})),a}var mE=["HydrateFallback","hydrateFallbackElement"],pE=class{constructor(){this.status="pending",this.promise=new Promise((e,a)=>{this.resolve=r=>{this.status==="pending"&&(this.status="resolved",e(r))},this.reject=r=>{this.status==="pending"&&(this.status="rejected",a(r))}})}};function gE({router:e,flushSync:a,onError:r,useTransitions:s}){s=r0()||s;let[c,d]=x.useState(e.state),[h,p]=fE(c),[g,v]=x.useState(),[y,S]=x.useState({isTransitioning:!1}),[N,w]=x.useState(),[j,R]=x.useState(),[M,$]=x.useState(),B=x.useRef(new Map),Y=x.useCallback((k,{deletedFetchers:re,newErrors:pe,flushSync:Se,viewTransitionOpts:ye})=>{pe&&r&&Object.values(pe).forEach(je=>{var W;return r(je,{location:k.location,params:((W=k.matches[0])==null?void 0:W.params)??{},pattern:Zo(k.matches)})}),k.fetchers.forEach((je,W)=>{je.data!==void 0&&B.current.set(W,je.data)}),re.forEach(je=>B.current.delete(je)),Cy(Se===!1||a!=null,'You provided the `flushSync` option to a router update, but you are not using the `<RouterProvider>` from `react-router/dom` so `ReactDOM.flushSync()` is unavailable. Please update your app to `import { RouterProvider } from "react-router/dom"` and ensure you have `react-dom` installed as a dependency to use the `flushSync` option.');let he=e.window!=null&&e.window.document!=null&&typeof e.window.document.startViewTransition=="function";if(Cy(ye==null||he,"You provided the `viewTransition` option to a router update, but you do not appear to be running in a DOM environment as `window.startViewTransition` is not available."),!ye||!he){a&&Se?a(()=>d(k)):s===!1?d(k):x.startTransition(()=>{s===!0&&p(je=>My(je,k)),d(k)});return}if(a&&Se){a(()=>{j&&(N==null||N.resolve(),j.skipTransition()),S({isTransitioning:!0,flushSync:!0,currentLocation:ye.currentLocation,nextLocation:ye.nextLocation})});let je=e.window.document.startViewTransition(()=>{a(()=>d(k))});je.finished.finally(()=>{a(()=>{w(void 0),R(void 0),v(void 0),S({isTransitioning:!1})})}),a(()=>R(je));return}j?(N==null||N.resolve(),j.skipTransition(),$({state:k,currentLocation:ye.currentLocation,nextLocation:ye.nextLocation})):(v(k),S({isTransitioning:!0,flushSync:!1,currentLocation:ye.currentLocation,nextLocation:ye.nextLocation}))},[e.window,a,j,N,s,p,r]);x.useLayoutEffect(()=>e.subscribe(Y),[e,Y]),x.useEffect(()=>{y.isTransitioning&&!y.flushSync&&w(new pE)},[y]),x.useEffect(()=>{if(N&&g&&e.window){let k=g,re=N.promise,pe=e.window.document.startViewTransition(async()=>{s===!1?d(k):x.startTransition(()=>{s===!0&&p(Se=>My(Se,k)),d(k)}),await re});pe.finished.finally(()=>{w(void 0),R(void 0),v(void 0),S({isTransitioning:!1})}),R(pe)}},[g,N,e.window,s,p]),x.useEffect(()=>{N&&g&&h.location.key===g.location.key&&N.resolve()},[N,j,h.location,g]),x.useEffect(()=>{!y.isTransitioning&&M&&(v(M.state),S({isTransitioning:!0,flushSync:!1,currentLocation:M.currentLocation,nextLocation:M.nextLocation}),$(void 0))},[y.isTransitioning,M]);let ne=x.useMemo(()=>({createHref:e.createHref,encodeLocation:e.encodeLocation,go:k=>e.navigate(k),push:(k,re,pe)=>e.navigate(k,{state:re,preventScrollReset:pe==null?void 0:pe.preventScrollReset}),replace:(k,re,pe)=>e.navigate(k,{replace:!0,state:re,preventScrollReset:pe==null?void 0:pe.preventScrollReset})}),[e]),ae=e.basename||"/",U=x.useMemo(()=>({router:e,navigator:ne,static:!1,basename:ae,onError:r}),[e,ne,ae,r]);return x.createElement(x.Fragment,null,x.createElement(Rs.Provider,{value:U},x.createElement(Ei.Provider,{value:h},x.createElement(Um.Provider,{value:B.current},x.createElement($m.Provider,{value:y},x.createElement(yE,{basename:ae,location:h.location,navigationType:h.historyAction,navigator:ne,useTransitions:s},x.createElement(xE,{routes:e.routes,manifest:e.manifest,future:e.future,state:h,isStatic:!1,onError:r})))))),null)}function My(e,a){return{...e,navigation:a.navigation.state!=="idle"?a.navigation:e.navigation,revalidation:a.revalidation!=="idle"?a.revalidation:e.revalidation,actionData:a.navigation.state!=="submitting"?a.actionData:e.actionData,fetchers:a.fetchers}}var xE=x.memo(vE);function vE({routes:e,manifest:a,future:r,state:s,isStatic:u,onError:c}){return JN(e,void 0,{manifest:a,state:s,isStatic:u,onError:c})}function ji(e){return ZN(e.context)}function yE({basename:e="/",children:a=null,location:r,navigationType:s="POP",navigator:u,static:c=!1,useTransitions:d}){lt(!Wo(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let h=e.replace(/^\/*/,"/"),p=x.useMemo(()=>({basename:h,navigator:u,static:c,useTransitions:d,future:{}}),[h,u,c,d]);typeof r=="string"&&(r=Mr(r));let{pathname:g="/",search:v="",hash:y="",state:S=null,key:N="default",mask:w}=r,j=x.useMemo(()=>{let R=Ha(g,h);return R==null?null:{location:{pathname:R,search:v,hash:y,state:S,key:N,mask:w},navigationType:s}},[h,g,v,y,S,N,s,w]);return pn(j!=null,`<Router basename="${h}"> is not able to match the URL "${g}${v}${y}" because it does not start with the basename, so the <Router> won't render anything.`),j==null?null:x.createElement(Ta.Provider,{value:p},x.createElement(od.Provider,{children:a,value:j}))}var Bu="get",Iu="application/x-www-form-urlencoded";function cd(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function bE(e){return cd(e)&&e.tagName.toLowerCase()==="button"}function wE(e){return cd(e)&&e.tagName.toLowerCase()==="form"}function SE(e){return cd(e)&&e.tagName.toLowerCase()==="input"}function NE(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function EE(e,a){return e.button===0&&(!a||a==="_self")&&!NE(e)}function mm(e=""){return new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((a,r)=>{let s=e[r];return a.concat(Array.isArray(s)?s.map(u=>[r,u]):[[r,s]])},[]))}function jE(e,a){let r=mm(e);return a&&a.forEach((s,u)=>{r.has(u)||a.getAll(u).forEach(c=>{r.append(u,c)})}),r}var Su=null;function RE(){if(Su===null)try{new FormData(document.createElement("form"),0),Su=!1}catch{Su=!0}return Su}var kE=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Hh(e){return e!=null&&!kE.has(e)?(pn(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Iu}"`),null):e}function TE(e,a){let r,s,u,c,d;if(wE(e)){let h=e.getAttribute("action");s=h?Ha(h,a):null,r=e.getAttribute("method")||Bu,u=Hh(e.getAttribute("enctype"))||Iu,c=new FormData(e)}else if(bE(e)||SE(e)&&(e.type==="submit"||e.type==="image")){let h=e.form;if(h==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let p=e.getAttribute("formaction")||h.getAttribute("action");if(s=p?Ha(p,a):null,r=e.getAttribute("formmethod")||h.getAttribute("method")||Bu,u=Hh(e.getAttribute("formenctype"))||Hh(h.getAttribute("enctype"))||Iu,c=new FormData(h,e),!RE()){let{name:g,type:v,value:y}=e;if(v==="image"){let S=g?`${g}.`:"";c.append(`${S}x`,"0"),c.append(`${S}y`,"0")}else g&&c.append(g,y)}}else{if(cd(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');r=Bu,s=null,u=Iu,d=e}return c&&u==="text/plain"&&(d=c,c=void 0),{action:s,method:r.toLowerCase(),encType:u,formData:c,body:d}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var AE={"&":"\\u0026",">":"\\u003e","<":"\\u003c","\u2028":"\\u2028","\u2029":"\\u2029"},DE=/[&><\u2028\u2029]/g;function _y(e){return e.replace(DE,a=>AE[a])}function Hm(e,a){if(e===!1||e===null||typeof e>"u")throw new Error(a)}function h0(e,a,r,s){let u=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return r?u.pathname.endsWith("/")?u.pathname=`${u.pathname}_.${s}`:u.pathname=`${u.pathname}.${s}`:u.pathname==="/"?u.pathname=`_root.${s}`:a&&Ha(u.pathname,a)==="/"?u.pathname=`${Yu(a)}/_root.${s}`:u.pathname=`${Yu(u.pathname)}.${s}`,u}async function CE(e,a){if(e.id in a)return a[e.id];try{let r=await import(e.module);return a[e.id]=r,r}catch(r){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(r),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function OE(e){return e==null?!1:e.href==null?e.rel==="preload"&&typeof e.imageSrcSet=="string"&&typeof e.imageSizes=="string":typeof e.rel=="string"&&typeof e.href=="string"}async function ME(e,a,r){let s=await Promise.all(e.map(async u=>{let c=a.routes[u.route.id];if(c){let d=await CE(c,r);return d.links?d.links():[]}return[]}));return $E(s.flat(1).filter(OE).filter(u=>u.rel==="stylesheet"||u.rel==="preload").map(u=>u.rel==="stylesheet"?{...u,rel:"prefetch",as:"style"}:{...u,rel:"prefetch"}))}function Ly(e,a,r,s,u,c){let d=(p,g)=>r[g]?p.route.id!==r[g].route.id:!0,h=(p,g)=>{var v;return r[g].pathname!==p.pathname||((v=r[g].route.path)==null?void 0:v.endsWith("*"))&&r[g].params["*"]!==p.params["*"]};return c==="assets"?a.filter((p,g)=>d(p,g)||h(p,g)):c==="data"?a.filter((p,g)=>{var y;let v=s.routes[p.route.id];if(!v||!v.hasLoader)return!1;if(d(p,g)||h(p,g))return!0;if(p.route.shouldRevalidate){let S=p.route.shouldRevalidate({currentUrl:new URL(u.pathname+u.search+u.hash,window.origin),currentParams:((y=r[0])==null?void 0:y.params)||{},nextUrl:new URL(e,window.origin),nextParams:p.params,defaultShouldRevalidate:!0});if(typeof S=="boolean")return S}return!0}):[]}function _E(e,a,{includeHydrateFallback:r}={}){return LE(e.map(s=>{let u=a.routes[s.route.id];if(!u)return[];let c=[u.module];return u.clientActionModule&&(c=c.concat(u.clientActionModule)),u.clientLoaderModule&&(c=c.concat(u.clientLoaderModule)),r&&u.hydrateFallbackModule&&(c=c.concat(u.hydrateFallbackModule)),u.imports&&(c=c.concat(u.imports)),c}).flat(1))}function LE(e){return[...new Set(e)]}function zE(e){let a={},r=Object.keys(e).sort();for(let s of r)a[s]=e[s];return a}function $E(e,a){let r=new Set;return new Set(a),e.reduce((s,u)=>{let c=JSON.stringify(zE(u));return r.has(c)||(r.add(c),s.push({key:c,link:u})),s},[])}function qm(){let e=x.useContext(Rs);return Hm(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function UE(){let e=x.useContext(Ei);return Hm(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var ud=x.createContext(void 0);ud.displayName="FrameworkContext";function dd(){let e=x.useContext(ud);return Hm(e,"You must render this element inside a <HydratedRouter> element"),e}function BE(e,a){let r=x.useContext(ud),[s,u]=x.useState(!1),[c,d]=x.useState(!1),{onFocus:h,onBlur:p,onMouseEnter:g,onMouseLeave:v,onTouchStart:y}=a,S=x.useRef(null);x.useEffect(()=>{if(e==="render"&&d(!0),e==="viewport"){let j=M=>{M.forEach($=>{d($.isIntersecting)})},R=new IntersectionObserver(j,{threshold:.5});return S.current&&R.observe(S.current),()=>{R.disconnect()}}},[e]),x.useEffect(()=>{if(s){let j=setTimeout(()=>{d(!0)},100);return()=>{clearTimeout(j)}}},[s]);let N=()=>{u(!0)},w=()=>{u(!1),d(!1)};return r?e!=="intent"?[c,S,{}]:[c,S,{onFocus:No(h,N),onBlur:No(p,w),onMouseEnter:No(g,N),onMouseLeave:No(v,w),onTouchStart:No(y,N)}]:[!1,S,{}]}function No(e,a){return r=>{e&&e(r),r.defaultPrevented||a(r)}}function IE({page:e,...a}){let r=r0(),{nonce:s}=dd(),{router:u}=qm(),c=x.useMemo(()=>_b(u.routes,e,u.basename),[u.routes,e,u.basename]);return c?(a.nonce==null&&s&&(a={...a,nonce:s}),r?x.createElement(qE,{page:e,matches:c,...a}):x.createElement(PE,{page:e,matches:c,...a})):null}function HE(e){let{manifest:a,routeModules:r}=dd(),[s,u]=x.useState([]);return x.useEffect(()=>{let c=!1;return ME(e,a,r).then(d=>{c||u(d)}),()=>{c=!0}},[e,a,r]),s}function qE({page:e,matches:a,...r}){let s=Aa(),{future:u}=dd(),{basename:c}=qm(),d=x.useMemo(()=>{if(e===s.pathname+s.search+s.hash)return[];let h=h0(e,c,u.v8_trailingSlashAwareDataRequests,"rsc"),p=!1,g=[];for(let v of a)typeof v.route.shouldRevalidate=="function"?p=!0:g.push(v.route.id);return p&&g.length>0&&h.searchParams.set("_routes",g.join(",")),[h.pathname+h.search]},[c,u.v8_trailingSlashAwareDataRequests,e,s,a]);return x.createElement(x.Fragment,null,d.map(h=>x.createElement("link",{key:h,rel:"prefetch",as:"fetch",href:h,...r})))}function PE({page:e,matches:a,...r}){let s=Aa(),{future:u,manifest:c,routeModules:d}=dd(),{basename:h}=qm(),{loaderData:p,matches:g}=UE(),v=x.useMemo(()=>Ly(e,a,g,c,s,"data"),[e,a,g,c,s]),y=x.useMemo(()=>Ly(e,a,g,c,s,"assets"),[e,a,g,c,s]),S=x.useMemo(()=>{if(e===s.pathname+s.search+s.hash)return[];let j=new Set,R=!1;if(a.forEach($=>{var Y;let B=c.routes[$.route.id];!B||!B.hasLoader||(!v.some(ne=>ne.route.id===$.route.id)&&$.route.id in p&&((Y=d[$.route.id])!=null&&Y.shouldRevalidate)||B.hasClientLoader?R=!0:j.add($.route.id))}),j.size===0)return[];let M=h0(e,h,u.v8_trailingSlashAwareDataRequests,"data");return R&&j.size>0&&M.searchParams.set("_routes",a.filter($=>j.has($.route.id)).map($=>$.route.id).join(",")),[M.pathname+M.search]},[h,u.v8_trailingSlashAwareDataRequests,p,s,c,v,a,e,d]),N=x.useMemo(()=>_E(y,c),[y,c]),w=HE(y);return x.createElement(x.Fragment,null,S.map(j=>x.createElement("link",{key:j,rel:"prefetch",as:"fetch",href:j,...r})),N.map(j=>x.createElement("link",{key:j,rel:"modulepreload",href:j,...r})),w.map(({key:j,link:R})=>x.createElement("link",{key:j,nonce:r.nonce,...R,crossOrigin:R.crossOrigin??r.crossOrigin})))}function FE(...e){return a=>{e.forEach(r=>{typeof r=="function"?r(a):r!=null&&(r.current=a)})}}var VE=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{VE&&(window.__reactRouterVersion="7.18.0")}catch{}function YE(e,a){return xN({basename:a==null?void 0:a.basename,getContext:a==null?void 0:a.getContext,future:a==null?void 0:a.future,history:_S({window:a==null?void 0:a.window}),hydrationData:GE(),routes:e,mapRouteProperties:hE,hydrationRouteProperties:mE,dataStrategy:a==null?void 0:a.dataStrategy,patchRoutesOnNavigation:a==null?void 0:a.patchRoutesOnNavigation,window:a==null?void 0:a.window,instrumentations:a==null?void 0:a.instrumentations}).initialize()}function GE(){let e=window==null?void 0:window.__staticRouterHydrationData;return e&&e.errors&&(e={...e,errors:XE(e.errors)}),e}function XE(e){if(!e)return null;let a=Object.entries(e),r={};for(let[s,u]of a)if(u&&u.__type==="RouteErrorResponse")r[s]=new Ko(u.status,u.statusText,u.data,u.internal===!0);else if(u&&u.__type==="Error"){if(typeof u.__subType=="string"&&rN.includes(u.__subType)){let c=window[u.__subType];if(typeof c=="function")try{let d=new c(u.message);d.stack="",r[s]=d}catch{}}if(r[s]==null){let c=new Error(u.message);c.stack="",r[s]=c}}else r[s]=u;return r}var Ve=x.forwardRef(function({onClick:a,discover:r="render",prefetch:s="none",relative:u,reloadDocument:c,replace:d,mask:h,state:p,target:g,to:v,preventScrollReset:y,viewTransition:S,defaultShouldRevalidate:N,...w},j){let{basename:R,navigator:M,useTransitions:$}=x.useContext(Ta),B=typeof v=="string"&&sd.test(v),Y=qb(v,R);v=Y.to;let ne=XN(v,{relative:u}),ae=Aa(),U=null;if(h){let W=id(h,[],ae.mask?ae.mask.pathname:"/",!0);R!=="/"&&(W.pathname=W.pathname==="/"?R:nr([R,W.pathname])),U=M.createHref(W)}let[k,re,pe]=BE(s,w),Se=QE(v,{replace:d,mask:h,state:p,target:g,preventScrollReset:y,relative:u,viewTransition:S,defaultShouldRevalidate:N,useTransitions:$});function ye(W){a&&a(W),W.defaultPrevented||Se(W)}let he=!(Y.isExternal||c),je=x.createElement("a",{...w,...pe,href:(he?U:void 0)||Y.absoluteURL||ne,onClick:he?ye:a,ref:FE(j,re),target:g,"data-discover":!B&&r==="render"?"true":void 0});return k&&!B?x.createElement(x.Fragment,null,je,x.createElement(IE,{page:ne})):je});Ve.displayName="Link";var pm=x.forwardRef(function({"aria-current":a="page",caseSensitive:r=!1,className:s="",end:u=!1,style:c,to:d,viewTransition:h,children:p,...g},v){let y=Jo(d,{relative:g.relative}),S=Aa(),N=x.useContext(Ei),{navigator:w,basename:j}=x.useContext(Ta),R=N!=null&&tj(y)&&h===!0,M=w.encodeLocation?w.encodeLocation(y).pathname:y.pathname,$=S.pathname,B=N&&N.navigation&&N.navigation.location?N.navigation.location.pathname:null;r||($=$.toLowerCase(),B=B?B.toLowerCase():null,M=M.toLowerCase()),B&&j&&(B=Ha(B,j)||B);const Y=M!=="/"&&M.endsWith("/")?M.length-1:M.length;let ne=$===M||!u&&$.startsWith(M)&&$.charAt(Y)==="/",ae=B!=null&&(B===M||!u&&B.startsWith(M)&&B.charAt(M.length)==="/"),U={isActive:ne,isPending:ae,isTransitioning:R},k=ne?a:void 0,re;typeof s=="function"?re=s(U):re=[s,ne?"active":null,ae?"pending":null,R?"transitioning":null].filter(Boolean).join(" ");let pe=typeof c=="function"?c(U):c;return x.createElement(Ve,{...g,"aria-current":k,className:re,ref:v,style:pe,to:d,viewTransition:h},typeof p=="function"?p(U):p)});pm.displayName="NavLink";var un=x.forwardRef(({discover:e="render",fetcherKey:a,navigate:r,reloadDocument:s,replace:u,state:c,method:d=Bu,action:h,onSubmit:p,relative:g,preventScrollReset:v,viewTransition:y,defaultShouldRevalidate:S,...N},w)=>{let{useTransitions:j}=x.useContext(Ta),R=Pm(),M=WE(h,{relative:g}),$=d.toLowerCase()==="get"?"get":"post",B=typeof h=="string"&&sd.test(h),Y=ne=>{if(p&&p(ne),ne.defaultPrevented)return;ne.preventDefault();let ae=ne.nativeEvent.submitter,U=(ae==null?void 0:ae.getAttribute("formmethod"))||d,k=()=>R(ae||ne.currentTarget,{fetcherKey:a,method:U,navigate:r,replace:u,state:c,relative:g,preventScrollReset:v,viewTransition:y,defaultShouldRevalidate:S});j&&r!==!1?x.startTransition(()=>k()):k()};return x.createElement("form",{ref:w,method:$,action:M,onSubmit:s?p:Y,...N,"data-discover":!B&&e==="render"?"true":void 0})});un.displayName="Form";function m0({getKey:e,storageKey:a,...r}){let s=x.useContext(ud),{basename:u}=x.useContext(Ta),c=Aa(),d=u0();JE({getKey:e,storageKey:a});let h=x.useMemo(()=>{if(!s||!e)return null;let g=xm(c,d,u,e);return g!==c.key?g:null},[]);if(!s||s.isSpaMode)return null;let p=((g,v)=>{if(!window.history.state||!window.history.state.key){let y=Math.random().toString(32).slice(2);window.history.replaceState({key:y},"")}try{let S=JSON.parse(sessionStorage.getItem(g)||"{}")[v||window.history.state.key];typeof S=="number"&&window.scrollTo(0,S)}catch(y){console.error(y),sessionStorage.removeItem(g)}}).toString();return r.nonce==null&&(s!=null&&s.nonce)&&(r.nonce=s.nonce),x.createElement("script",{...r,suppressHydrationWarning:!0,dangerouslySetInnerHTML:{__html:`(${p})(${_y(JSON.stringify(a||gm))}, ${_y(JSON.stringify(h))})`}})}m0.displayName="ScrollRestoration";function p0(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function fd(e){let a=x.useContext(Rs);return lt(a,p0(e)),a}function g0(e){let a=x.useContext(Ei);return lt(a,p0(e)),a}function QE(e,{target:a,replace:r,mask:s,state:u,preventScrollReset:c,relative:d,viewTransition:h,defaultShouldRevalidate:p,useTransitions:g}={}){let v=_r(),y=Aa(),S=Jo(e,{relative:d});return x.useCallback(N=>{if(EE(N,a)){N.preventDefault();let w=r!==void 0?r:Or(y)===Or(S),j=()=>v(e,{replace:w,mask:s,state:u,preventScrollReset:c,relative:d,viewTransition:h,defaultShouldRevalidate:p});g?x.startTransition(()=>j()):j()}},[y,v,S,r,s,u,a,e,c,d,h,p,g])}function tc(e){pn(typeof URLSearchParams<"u","You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let a=x.useRef(mm(e)),r=x.useRef(!1),s=Aa(),u=x.useMemo(()=>jE(s.search,r.current?null:a.current),[s.search]),c=_r(),d=x.useCallback((h,p)=>{const g=mm(typeof h=="function"?h(new URLSearchParams(u)):h);r.current=!0,c("?"+g,p)},[c,u]);return[u,d]}var KE=0,ZE=()=>`__${String(++KE)}__`;function Pm(){let{router:e}=fd("useSubmit"),{basename:a}=x.useContext(Ta),r=sE(),s=e.fetch,u=e.navigate;return x.useCallback(async(c,d={})=>{let{action:h,method:p,encType:g,formData:v,body:y}=TE(c,a);if(d.navigate===!1){let S=d.fetcherKey||ZE();await s(S,r,d.action||h,{defaultShouldRevalidate:d.defaultShouldRevalidate,preventScrollReset:d.preventScrollReset,formData:v,body:y,formMethod:d.method||p,formEncType:d.encType||g,flushSync:d.flushSync})}else await u(d.action||h,{defaultShouldRevalidate:d.defaultShouldRevalidate,preventScrollReset:d.preventScrollReset,formData:v,body:y,formMethod:d.method||p,formEncType:d.encType||g,replace:d.replace,state:d.state,fromRouteId:r,flushSync:d.flushSync,viewTransition:d.viewTransition})},[s,u,a,r])}function WE(e,{relative:a}={}){let{basename:r}=x.useContext(Ta),s=x.useContext(rr);lt(s,"useFormAction must be used inside a RouteContext");let[u]=s.matches.slice(-1),c={...Jo(e||".",{relative:a})},d=Aa();if(e==null){c.search=d.search;let h=new URLSearchParams(c.search),p=h.getAll("index");if(p.some(v=>v==="")){h.delete("index"),p.filter(y=>y).forEach(y=>h.append("index",y));let v=h.toString();c.search=v?`?${v}`:""}}return(!e||e===".")&&u.route.index&&(c.search=c.search?c.search.replace(/^\?/,"?index&"):"?index"),r!=="/"&&(c.pathname=c.pathname==="/"?r:nr([r,c.pathname])),Or(c)}function Fl({key:e}={}){var ne;let{router:a}=fd("useFetcher"),r=g0("useFetcher"),s=x.useContext(Um),u=x.useContext(rr),c=(ne=u.matches[u.matches.length-1])==null?void 0:ne.route.id;lt(s,"useFetcher must be used inside a FetchersContext"),lt(u,"useFetcher must be used inside a RouteContext"),lt(c!=null,'useFetcher can only be used on routes that contain a unique "id"');let d=x.useId(),[h,p]=x.useState(e||d);e&&e!==h&&p(e);let{deleteFetcher:g,getFetcher:v,resetFetcher:y,fetch:S}=a;x.useEffect(()=>(v(h),()=>g(h)),[g,v,h]);let N=x.useCallback(async(ae,U)=>{lt(c,"No routeId available for fetcher.load()"),await S(h,c,ae,U)},[h,c,S]),w=Pm(),j=x.useCallback(async(ae,U)=>{await w(ae,{...U,navigate:!1,fetcherKey:h})},[h,w]),R=x.useCallback(ae=>y(h,ae),[y,h]),M=x.useMemo(()=>{let ae=x.forwardRef((U,k)=>x.createElement(un,{...U,navigate:!1,fetcherKey:h,ref:k}));return ae.displayName="fetcher.Form",ae},[h]),$=r.fetchers.get(h)||Yb,B=s.get(h);return x.useMemo(()=>({Form:M,submit:j,load:N,reset:R,...$,data:B}),[M,j,N,R,$,B])}var gm="react-router-scroll-positions",Nu={};function xm(e,a,r,s){let u=null;return s&&(r!=="/"?u=s({...e,pathname:Ha(e.pathname,r)||e.pathname},a):u=s(e,a)),u==null&&(u=e.key),u}function JE({getKey:e,storageKey:a}={}){let{router:r}=fd("useScrollRestoration"),{restoreScrollPosition:s,preventScrollReset:u}=g0("useScrollRestoration"),{basename:c}=x.useContext(Ta),d=Aa(),h=u0(),p=gr();x.useEffect(()=>(window.history.scrollRestoration="manual",()=>{window.history.scrollRestoration="auto"}),[]),ej(x.useCallback(()=>{if(p.state==="idle"){let g=xm(d,h,c,e);Nu[g]=window.scrollY}try{sessionStorage.setItem(a||gm,JSON.stringify(Nu))}catch(g){pn(!1,`Failed to save scroll positions in sessionStorage, <ScrollRestoration /> will not work properly (${g}).`)}window.history.scrollRestoration="auto"},[p.state,e,c,d,h,a])),typeof document<"u"&&(x.useLayoutEffect(()=>{try{let g=sessionStorage.getItem(a||gm);g&&(Nu=JSON.parse(g))}catch{}},[a]),x.useLayoutEffect(()=>{let g=r==null?void 0:r.enableScrollRestoration(Nu,()=>window.scrollY,e?(v,y)=>xm(v,y,c,e):void 0);return()=>g&&g()},[r,c,e]),x.useLayoutEffect(()=>{if(s!==!1){if(typeof s=="number"){window.scrollTo(0,s);return}try{if(d.hash){let g=document.getElementById(decodeURIComponent(d.hash.slice(1)));if(g){g.scrollIntoView();return}}}catch{pn(!1,`"${d.hash.slice(1)}" is not a decodable element ID. The view will not scroll to it.`)}u!==!0&&window.scrollTo(0,0)}},[d,s,u]))}function ej(e,a){let{capture:r}={};x.useEffect(()=>{let s=r!=null?{capture:r}:void 0;return window.addEventListener("pagehide",e,s),()=>{window.removeEventListener("pagehide",e,s)}},[e,r])}function tj(e,{relative:a}={}){let r=x.useContext($m);lt(r!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:s}=fd("useViewTransitionState"),u=Jo(e,{relative:a});if(!r.isTransitioning)return!1;let c=Ha(r.currentLocation.pathname,s)||r.currentLocation.pathname,d=Ha(r.nextLocation.pathname,s)||r.nextLocation.pathname;return Vu(u.pathname,d)!=null||Vu(u.pathname,c)!=null}var il=Ab();function nj(e){return x.createElement(gE,{flushSync:il.flushSync,...e})}/**
62
- * @license lucide-react v1.21.0 - ISC
63
- *
64
- * This source code is licensed under the ISC license.
65
- * See the LICENSE file in the root directory of this source tree.
66
- */const x0=(...e)=>e.filter((a,r,s)=>!!a&&a.trim()!==""&&s.indexOf(a)===r).join(" ").trim();/**
67
- * @license lucide-react v1.21.0 - ISC
68
- *
69
- * This source code is licensed under the ISC license.
70
- * See the LICENSE file in the root directory of this source tree.
71
- */const aj=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();/**
72
- * @license lucide-react v1.21.0 - ISC
73
- *
74
- * This source code is licensed under the ISC license.
75
- * See the LICENSE file in the root directory of this source tree.
76
- */const rj=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(a,r,s)=>s?s.toUpperCase():r.toLowerCase());/**
77
- * @license lucide-react v1.21.0 - ISC
78
- *
79
- * This source code is licensed under the ISC license.
80
- * See the LICENSE file in the root directory of this source tree.
81
- */const zy=e=>{const a=rj(e);return a.charAt(0).toUpperCase()+a.slice(1)};/**
82
- * @license lucide-react v1.21.0 - ISC
83
- *
84
- * This source code is licensed under the ISC license.
85
- * See the LICENSE file in the root directory of this source tree.
86
- */var qh={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"};/**
87
- * @license lucide-react v1.21.0 - ISC
88
- *
89
- * This source code is licensed under the ISC license.
90
- * See the LICENSE file in the root directory of this source tree.
91
- */const lj=e=>{for(const a in e)if(a.startsWith("aria-")||a==="role"||a==="title")return!0;return!1},sj=x.createContext({}),ij=()=>x.useContext(sj),oj=x.forwardRef(({color:e,size:a,strokeWidth:r,absoluteStrokeWidth:s,className:u="",children:c,iconNode:d,...h},p)=>{const{size:g=24,strokeWidth:v=2,absoluteStrokeWidth:y=!1,color:S="currentColor",className:N=""}=ij()??{},w=s??y?Number(r??v)*24/Number(a??g):r??v;return x.createElement("svg",{ref:p,...qh,width:a??g??qh.width,height:a??g??qh.height,stroke:e??S,strokeWidth:w,className:x0("lucide",N,u),...!c&&!lj(h)&&{"aria-hidden":"true"},...h},[...d.map(([j,R])=>x.createElement(j,R)),...Array.isArray(c)?c:[c]])});/**
92
- * @license lucide-react v1.21.0 - ISC
93
- *
94
- * This source code is licensed under the ISC license.
95
- * See the LICENSE file in the root directory of this source tree.
96
- */const ut=(e,a)=>{const r=x.forwardRef(({className:s,...u},c)=>x.createElement(oj,{ref:c,iconNode:a,className:x0(`lucide-${aj(zy(e))}`,`lucide-${e}`,s),...u}));return r.displayName=zy(e),r};/**
97
- * @license lucide-react v1.21.0 - ISC
98
- *
99
- * This source code is licensed under the ISC license.
100
- * See the LICENSE file in the root directory of this source tree.
101
- */const cj=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],uj=ut("activity",cj);/**
102
- * @license lucide-react v1.21.0 - ISC
103
- *
104
- * This source code is licensed under the ISC license.
105
- * See the LICENSE file in the root directory of this source tree.
106
- */const dj=[["path",{d:"m7 7 10 10",key:"1fmybs"}],["path",{d:"M17 7v10H7",key:"6fjiku"}]],fj=ut("arrow-down-right",dj);/**
107
- * @license lucide-react v1.21.0 - ISC
108
- *
109
- * This source code is licensed under the ISC license.
110
- * See the LICENSE file in the root directory of this source tree.
111
- */const hj=[["path",{d:"m3 16 4 4 4-4",key:"1co6wj"}],["path",{d:"M7 20V4",key:"1yoxec"}],["path",{d:"M11 4h10",key:"1w87gc"}],["path",{d:"M11 8h7",key:"djye34"}],["path",{d:"M11 12h4",key:"q8tih4"}]],mj=ut("arrow-down-wide-narrow",hj);/**
112
- * @license lucide-react v1.21.0 - ISC
113
- *
114
- * This source code is licensed under the ISC license.
115
- * See the LICENSE file in the root directory of this source tree.
116
- */const pj=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],hd=ut("arrow-left",pj);/**
117
- * @license lucide-react v1.21.0 - ISC
118
- *
119
- * This source code is licensed under the ISC license.
120
- * See the LICENSE file in the root directory of this source tree.
121
- */const gj=[["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}],["path",{d:"M11 12h4",key:"q8tih4"}],["path",{d:"M11 16h7",key:"uosisv"}],["path",{d:"M11 20h10",key:"jvxblo"}]],xj=ut("arrow-up-narrow-wide",gj);/**
122
- * @license lucide-react v1.21.0 - ISC
123
- *
124
- * This source code is licensed under the ISC license.
125
- * See the LICENSE file in the root directory of this source tree.
126
- */const vj=[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]],yj=ut("arrow-up-right",vj);/**
127
- * @license lucide-react v1.21.0 - ISC
128
- *
129
- * This source code is licensed under the ISC license.
130
- * See the LICENSE file in the root directory of this source tree.
131
- */const bj=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M4.929 4.929 19.07 19.071",key:"196cmz"}]],v0=ut("ban",bj);/**
132
- * @license lucide-react v1.21.0 - ISC
133
- *
134
- * This source code is licensed under the ISC license.
135
- * See the LICENSE file in the root directory of this source tree.
136
- */const wj=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]],Sj=ut("chart-column",wj);/**
137
- * @license lucide-react v1.21.0 - ISC
138
- *
139
- * This source code is licensed under the ISC license.
140
- * See the LICENSE file in the root directory of this source tree.
141
- */const Nj=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Ej=ut("check",Nj);/**
142
- * @license lucide-react v1.21.0 - ISC
143
- *
144
- * This source code is licensed under the ISC license.
145
- * See the LICENSE file in the root directory of this source tree.
146
- */const jj=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],As=ut("chevron-down",jj);/**
147
- * @license lucide-react v1.21.0 - ISC
148
- *
149
- * This source code is licensed under the ISC license.
150
- * See the LICENSE file in the root directory of this source tree.
151
- */const Rj=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],y0=ut("chevron-right",Rj);/**
152
- * @license lucide-react v1.21.0 - ISC
153
- *
154
- * This source code is licensed under the ISC license.
155
- * See the LICENSE file in the root directory of this source tree.
156
- */const kj=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],Tj=ut("circle-check-big",kj);/**
157
- * @license lucide-react v1.21.0 - ISC
158
- *
159
- * This source code is licensed under the ISC license.
160
- * See the LICENSE file in the root directory of this source tree.
161
- */const Aj=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Fm=ut("circle-check",Aj);/**
162
- * @license lucide-react v1.21.0 - ISC
163
- *
164
- * This source code is licensed under the ISC license.
165
- * See the LICENSE file in the root directory of this source tree.
166
- */const Dj=[["path",{d:"M10.1 2.182a10 10 0 0 1 3.8 0",key:"5ilxe3"}],["path",{d:"M13.9 21.818a10 10 0 0 1-3.8 0",key:"11zvb9"}],["path",{d:"M17.609 3.721a10 10 0 0 1 2.69 2.7",key:"1iw5b2"}],["path",{d:"M2.182 13.9a10 10 0 0 1 0-3.8",key:"c0bmvh"}],["path",{d:"M20.279 17.609a10 10 0 0 1-2.7 2.69",key:"1ruxm7"}],["path",{d:"M21.818 10.1a10 10 0 0 1 0 3.8",key:"qkgqxc"}],["path",{d:"M3.721 6.391a10 10 0 0 1 2.7-2.69",key:"1mcia2"}],["path",{d:"M6.391 20.279a10 10 0 0 1-2.69-2.7",key:"1fvljs"}]],Cj=ut("circle-dashed",Dj);/**
167
- * @license lucide-react v1.21.0 - ISC
168
- *
169
- * This source code is licensed under the ISC license.
170
- * See the LICENSE file in the root directory of this source tree.
171
- */const Oj=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}]],Mj=ut("circle-minus",Oj);/**
172
- * @license lucide-react v1.21.0 - ISC
173
- *
174
- * This source code is licensed under the ISC license.
175
- * See the LICENSE file in the root directory of this source tree.
176
- */const _j=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"10",x2:"10",y1:"15",y2:"9",key:"c1nkhi"}],["line",{x1:"14",x2:"14",y1:"15",y2:"9",key:"h65svq"}]],Vm=ut("circle-pause",_j);/**
177
- * @license lucide-react v1.21.0 - ISC
178
- *
179
- * This source code is licensed under the ISC license.
180
- * See the LICENSE file in the root directory of this source tree.
181
- */const Lj=[["path",{d:"M9 9.003a1 1 0 0 1 1.517-.859l4.997 2.997a1 1 0 0 1 0 1.718l-4.997 2.997A1 1 0 0 1 9 14.996z",key:"kmsa83"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],b0=ut("circle-play",Lj);/**
182
- * @license lucide-react v1.21.0 - ISC
183
- *
184
- * This source code is licensed under the ISC license.
185
- * See the LICENSE file in the root directory of this source tree.
186
- */const zj=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],$j=ut("circle-x",zj);/**
187
- * @license lucide-react v1.21.0 - ISC
188
- *
189
- * This source code is licensed under the ISC license.
190
- * See the LICENSE file in the root directory of this source tree.
191
- */const Uj=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],md=ut("circle",Uj);/**
192
- * @license lucide-react v1.21.0 - ISC
193
- *
194
- * This source code is licensed under the ISC license.
195
- * See the LICENSE file in the root directory of this source tree.
196
- */const Bj=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6l4 2",key:"mmk7yg"}]],Ij=ut("clock",Bj);/**
197
- * @license lucide-react v1.21.0 - ISC
198
- *
199
- * This source code is licensed under the ISC license.
200
- * See the LICENSE file in the root directory of this source tree.
201
- */const Hj=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],qj=ut("copy",Hj);/**
202
- * @license lucide-react v1.21.0 - ISC
203
- *
204
- * This source code is licensed under the ISC license.
205
- * See the LICENSE file in the root directory of this source tree.
206
- */const Pj=[["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"}]],Fj=ut("download",Pj);/**
207
- * @license lucide-react v1.21.0 - ISC
208
- *
209
- * This source code is licensed under the ISC license.
210
- * See the LICENSE file in the root directory of this source tree.
211
- */const Vj=[["path",{d:"M15 6a9 9 0 0 0-9 9V3",key:"1cii5b"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}]],Yj=ut("git-branch",Vj);/**
212
- * @license lucide-react v1.21.0 - ISC
213
- *
214
- * This source code is licensed under the ISC license.
215
- * See the LICENSE file in the root directory of this source tree.
216
- */const Gj=[["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"}]],Xj=ut("grip-vertical",Gj);/**
217
- * @license lucide-react v1.21.0 - ISC
218
- *
219
- * This source code is licensed under the ISC license.
220
- * See the LICENSE file in the root directory of this source tree.
221
- */const Qj=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],Gu=ut("layers",Qj);/**
222
- * @license lucide-react v1.21.0 - ISC
223
- *
224
- * This source code is licensed under the ISC license.
225
- * See the LICENSE file in the root directory of this source tree.
226
- */const Kj=[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]],w0=ut("lightbulb",Kj);/**
227
- * @license lucide-react v1.21.0 - ISC
228
- *
229
- * This source code is licensed under the ISC license.
230
- * See the LICENSE file in the root directory of this source tree.
231
- */const Zj=[["path",{d:"M13 5h8",key:"a7qcls"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["rect",{x:"3",y:"4",width:"6",height:"6",rx:"1",key:"cif1o7"}]],nc=ut("list-todo",Zj);/**
232
- * @license lucide-react v1.21.0 - ISC
233
- *
234
- * This source code is licensed under the ISC license.
235
- * See the LICENSE file in the root directory of this source tree.
236
- */const Wj=[["line",{x1:"2",x2:"5",y1:"12",y2:"12",key:"bvdh0s"}],["line",{x1:"19",x2:"22",y1:"12",y2:"12",key:"1tbv5k"}],["line",{x1:"12",x2:"12",y1:"2",y2:"5",key:"11lu5j"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}],["circle",{cx:"12",cy:"12",r:"7",key:"fim9np"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],Jj=ut("locate-fixed",Wj);/**
237
- * @license lucide-react v1.21.0 - ISC
238
- *
239
- * This source code is licensed under the ISC license.
240
- * See the LICENSE file in the root directory of this source tree.
241
- */const eR=[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]],tR=ut("menu",eR);/**
242
- * @license lucide-react v1.21.0 - ISC
243
- *
244
- * This source code is licensed under the ISC license.
245
- * See the LICENSE file in the root directory of this source tree.
246
- */const nR=[["path",{d:"M5 12h14",key:"1ays0h"}]],aR=ut("minus",nR);/**
247
- * @license lucide-react v1.21.0 - ISC
248
- *
249
- * This source code is licensed under the ISC license.
250
- * See the LICENSE file in the root directory of this source tree.
251
- */const rR=[["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"}]],lR=ut("moon",rR);/**
252
- * @license lucide-react v1.21.0 - ISC
253
- *
254
- * This source code is licensed under the ISC license.
255
- * See the LICENSE file in the root directory of this source tree.
256
- */const sR=[["path",{d:"M12 16h.01",key:"1drbdi"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M15.312 2a2 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-.586l-4.688-4.688A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2z",key:"1fd625"}]],S0=ut("octagon-alert",sR);/**
257
- * @license lucide-react v1.21.0 - ISC
258
- *
259
- * This source code is licensed under the ISC license.
260
- * See the LICENSE file in the root directory of this source tree.
261
- */const iR=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],Vl=ut("pencil",iR);/**
262
- * @license lucide-react v1.21.0 - ISC
263
- *
264
- * This source code is licensed under the ISC license.
265
- * See the LICENSE file in the root directory of this source tree.
266
- */const oR=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],cR=ut("play",oR);/**
267
- * @license lucide-react v1.21.0 - ISC
268
- *
269
- * This source code is licensed under the ISC license.
270
- * See the LICENSE file in the root directory of this source tree.
271
- */const uR=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],dR=ut("plus",uR);/**
272
- * @license lucide-react v1.21.0 - ISC
273
- *
274
- * This source code is licensed under the ISC license.
275
- * See the LICENSE file in the root directory of this source tree.
276
- */const fR=[["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"}]],N0=ut("rotate-ccw",fR);/**
277
- * @license lucide-react v1.21.0 - ISC
278
- *
279
- * This source code is licensed under the ISC license.
280
- * See the LICENSE file in the root directory of this source tree.
281
- */const hR=[["path",{d:"M15 12h-5",key:"r7krc0"}],["path",{d:"M15 8h-5",key:"1khuty"}],["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3",key:"1ph1d7"}]],E0=ut("scroll-text",hR);/**
282
- * @license lucide-react v1.21.0 - ISC
283
- *
284
- * This source code is licensed under the ISC license.
285
- * See the LICENSE file in the root directory of this source tree.
286
- */const mR=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],pR=ut("search",mR);/**
287
- * @license lucide-react v1.21.0 - ISC
288
- *
289
- * This source code is licensed under the ISC license.
290
- * See the LICENSE file in the root directory of this source tree.
291
- */const gR=[["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"}]],xR=ut("sun",gR);/**
292
- * @license lucide-react v1.21.0 - ISC
293
- *
294
- * This source code is licensed under the ISC license.
295
- * See the LICENSE file in the root directory of this source tree.
296
- */const vR=[["path",{d:"M10 2h4",key:"n1abiw"}],["path",{d:"M12 14v-4",key:"1evpnu"}],["path",{d:"M4 13a8 8 0 0 1 8-7 8 8 0 1 1-5.3 14L4 17.6",key:"1ts96g"}],["path",{d:"M9 17H4v5",key:"8t5av"}]],yR=ut("timer-reset",vR);/**
297
- * @license lucide-react v1.21.0 - ISC
298
- *
299
- * This source code is licensed under the ISC license.
300
- * See the LICENSE file in the root directory of this source tree.
301
- */const bR=[["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"}]],js=ut("trash-2",bR);/**
302
- * @license lucide-react v1.21.0 - ISC
303
- *
304
- * This source code is licensed under the ISC license.
305
- * See the LICENSE file in the root directory of this source tree.
306
- */const wR=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],j0=ut("x",wR),SR="/api",NR=120,ER=40;function Xl(e){return{...e,number:e.number??0,descriptionRef:e.descriptionRef??"",decisions:e.decisions??[],acceptedDecisions:e.acceptedDecisions??[],checklist:e.checklist??[],subtasks:e.subtasks??[],pauseSnapshot:e.pauseSnapshot??null,pauseHistory:e.pauseHistory??[],startedAt:e.startedAt??"",completedAt:e.completedAt??"",descriptionUpdatedAt:e.descriptionUpdatedAt??""}}function Ph(e){return e?{...e,pauseSnapshot:e.pauseSnapshot??null,pendingResume:!!e.pendingResume,deviationId:e.deviationId??""}:null}function pd(e){return{...e,discussedAt:e.discussedAt??"",contextReady:e.contextReady??!1,contextReadyReason:e.contextReadyReason??"",descriptionRef:e.descriptionRef??"",notes:e.notes??"",goals:e.goals??[],nonGoals:e.nonGoals??[],dependencies:e.dependencies??[],risks:e.risks??[],openQuestions:e.openQuestions??[],decisions:e.decisions??[],acceptedDecisions:e.acceptedDecisions??[],completionCriteria:e.completionCriteria??[],taskIds:e.taskIds??[],tasks:(e.tasks??[]).map(Xl),linkedRequirements:e.linkedRequirements??[],handoff:e.handoff??"",handoffUpdatedAt:e.handoffUpdatedAt??"",descriptionUpdatedAt:e.descriptionUpdatedAt??""}}function gd(e){return{...e,number:e.number??0,discussedAt:e.discussedAt??"",contextReady:e.contextReady??!1,contextReadyReason:e.contextReadyReason??"",descriptionRef:e.descriptionRef??"",acceptedDecisions:e.acceptedDecisions??[],phaseIds:e.phaseIds??[],descriptionUpdatedAt:e.descriptionUpdatedAt??""}}function R0(e){var a,r,s,u,c,d;return{...e,descriptionRef:e.descriptionRef??"",projectGuidelines:{content:((a=e.projectGuidelines)==null?void 0:a.content)??"",updatedAt:((r=e.projectGuidelines)==null?void 0:r.updatedAt)??"",sessionInfo:((s=e.projectGuidelines)==null?void 0:s.sessionInfo)??[]},scope:e.scope??[],outOfScope:e.outOfScope??[],decisions:e.decisions??[],globalRules:e.globalRules??[],technologies:e.technologies??[],tools:e.tools??[],acceptedDecisions:e.acceptedDecisions??[],workDeviations:e.workDeviations??[],planRoot:e.planRoot??"",projectRoot:e.projectRoot??"",agentPlanVersion:e.agentPlanVersion??"",workflowRules:{beforePhaseStart:((u=e.workflowRules)==null?void 0:u.beforePhaseStart)??[],beforeTaskStart:((c=e.workflowRules)==null?void 0:c.beforeTaskStart)??[],afterPhaseComplete:((d=e.workflowRules)==null?void 0:d.afterPhaseComplete)??[]}}}function Ym(e){return{...e,description:e.description??"",macroTasks:e.macroTasks??[],linkedPhaseIds:e.linkedPhaseIds??[]}}async function $y(e,a){const r={"Content-Type":"application/json","X-Planner-Source":"web-ui",...a==null?void 0:a.headers};try{return await fetch(`${SR}${e}`,{...a,headers:r})}catch{throw new Response("Planner web server unavailable. Pi or planner-web may have stopped. Restart the planner web UI or Pi, then reload this page.",{status:503,statusText:"Planner web server unavailable"})}}async function ot(e,a){let r=await $y(e,a),s=0;for(;r.status===503&&s<ER;)await new Promise(u=>setTimeout(u,NR)),s+=1,r=await $y(e,a);if(!r.ok){const u=await r.text().catch(()=>r.statusText);throw new Response(u||r.statusText,{status:r.status,statusText:r.statusText})}return r.json()}async function Gm(){return R0(await ot("/project"))}async function jR(e){const{descriptionRef:a,...r}=e,s={...r,...a?{descriptionRef:a}:{}};return R0(await ot("/project",{method:"PUT",body:JSON.stringify(s)}))}async function RR(e){return(await ot("/accepted-decisions",{method:"POST",body:JSON.stringify(e)})).acceptedDecision}async function kR(e){const{id:a,...r}=e;return(await ot(`/accepted-decisions/${a}`,{method:"PUT",body:JSON.stringify(r)})).acceptedDecision}async function TR(e){return ot(`/accepted-decisions/${e.id}`,{method:"DELETE",body:JSON.stringify({targetType:e.targetType,targetRef:e.targetRef,confirmed:!0})})}async function AR(){return ot("/ui-config")}async function DR(e){return ot(`/docs/view?path=${encodeURIComponent(e)}`)}async function CR(e,a){return ot("/docs/save",{method:"PUT",body:JSON.stringify({path:e,content:a,confirmed:!0})})}async function Xm(){return ot("/description-freshness")}async function Qm(){return(await ot("/features")).map(gd)}async function ac(e){return gd(await ot(`/features/${e}`))}async function OR(e){return gd(await ot("/features",{method:"POST",body:JSON.stringify(e)}))}async function k0(e){const{updatedAt:a,...r}=e;return gd(await ot(`/features/${e.id}`,{method:"PUT",body:JSON.stringify({...r,expectedUpdatedAt:a})}))}async function MR(e){return ot(`/features/${e}`,{method:"DELETE"})}async function _R(){return(await ot("/ideas")).ideas}async function LR(e){return ot("/ideas",{method:"POST",body:JSON.stringify(e)})}async function zR(e){return ot(`/ideas/${e.id}`,{method:"PUT",body:JSON.stringify(e)})}async function $R(e){return ot(`/ideas/${e}`,{method:"DELETE"})}async function Km(){return(await ot("/requirements")).requirements.map(Ym)}async function UR(e){return Ym(await ot("/requirements",{method:"POST",body:JSON.stringify(e)}))}async function BR(e){const{updatedAt:a,...r}=e;return Ym(await ot(`/requirements/${e.id}`,{method:"PUT",body:JSON.stringify({...r,expectedUpdatedAt:a})}))}async function IR(e){return ot(`/requirements/${e}`,{method:"DELETE"})}async function xd(e){const a=e?`?featureId=${encodeURIComponent(e)}`:"";return(await ot(`/phases${a}`)).map(pd)}async function vd(e){return pd(await ot(`/phases/${e}`))}async function HR(e){return pd(await ot("/phases",{method:"POST",body:JSON.stringify(e)}))}async function T0(e){const{updatedAt:a,...r}=e;return pd(await ot(`/phases/${e.id}`,{method:"PUT",body:JSON.stringify({...r,expectedUpdatedAt:a})}))}async function qR(e){return ot(`/phases/${e}`,{method:"DELETE"})}async function PR(e,a){return Xl(await ot(`/phases/${e}/tasks`,{method:"POST",body:JSON.stringify(a)}))}async function yd(e){return Xl(await ot(`/tasks/${e}`))}async function Zm(e){const{updatedAt:a,...r}=e;return Xl(await ot(`/tasks/${e.id}`,{method:"PUT",body:JSON.stringify({...r,expectedUpdatedAt:a})}))}async function FR(e){return Xl(await ot(`/tasks/${e}/start`,{method:"POST"}))}async function VR(e){const a=await ot(`/tasks/${e}/reopen`,{method:"POST",body:JSON.stringify({confirmed:!0})});return Xl(a.task)}async function YR(e,a,r){const s=await ot(`/tasks/${e}/subtasks`,{method:"POST",body:JSON.stringify({phaseId:a,...r})});return Xl(s.task)}async function GR(e,a,r){const s=await ot(`/tasks/${e}/dependencies`,{method:"POST",body:JSON.stringify({phaseId:a,dependsOnId:r})});return Xl(s.task)}async function XR(e){return ot(`/tasks/${e}`,{method:"DELETE"})}async function QR(){return ot("/tasks/active")}async function KR(){const e=await ot("/tasks/focus");return{active:(e.active??[]).map(a=>Ph(a)),pendingResume:(e.pendingResume??[]).map(a=>Ph(a)),nextWork:Ph(e.nextWork),nextWorkReason:e.nextWorkReason??""}}async function vm(){return(await ot("/handoffs")).handoffs??[]}async function ZR(){return(await ot("/handoffs/archive")).archived??[]}async function A0(e){return ot(`/phases/${e}/handoff`,{method:"DELETE"})}async function WR(e=!1){return ot(`/export?full=${e?"true":"false"}`)}async function JR(){return ot("/repair",{method:"POST"})}async function Fh(e,a,r,s){return ot("/reorder",{method:"POST",body:JSON.stringify({kind:e,movedId:a,beforeId:r,afterId:s})})}function e2(){const[e,a]=x.useState(()=>{if(typeof window>"u")return"dark";const r=window.localStorage.getItem("plan-ui-theme");return r||(window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light")});return x.useEffect(()=>{document.documentElement.setAttribute("data-theme",e),window.localStorage.setItem("plan-ui-theme",e)},[e]),{theme:e,toggleTheme:()=>a(r=>r==="dark"?"light":"dark")}}function t2({liveStatus:e}){const a=e==="live"?{label:"Live",className:"border-emerald-500/30 bg-emerald-500/10 text-emerald-600 dark:text-emerald-400",dotClassName:"bg-emerald-500"}:e==="reconnecting"?{label:"Reconnecting…",className:"border-amber-500/30 bg-amber-500/10 text-amber-700 dark:text-amber-400",dotClassName:"bg-amber-500 animate-pulse"}:e==="disconnected"?{label:"Disconnected",className:"border-rose-500/30 bg-rose-500/10 text-rose-700 dark:text-rose-400",dotClassName:"bg-rose-500"}:{label:"Connecting…",className:"border-sky-500/30 bg-sky-500/10 text-sky-700 dark:text-sky-400",dotClassName:"bg-sky-500 animate-pulse"};return i.jsxs("span",{className:`inline-flex max-w-full min-h-7 items-center gap-1.5 rounded-[10px] border px-2 py-1 text-xs font-semibold sm:min-h-8 sm:rounded-[12px] sm:px-2.5 sm:py-1.5 sm:text-sm ${a.className}`,children:[i.jsx("span",{className:`h-2 w-2 shrink-0 rounded-full ${a.dotClassName}`}),i.jsx("span",{className:"truncate",children:a.label})]})}function n2({projectName:e,projectRoot:a,planRoot:r,agentPlanVersion:s,liveStatus:u}){const{theme:c,toggleTheme:d}=e2(),[h,p]=x.useState(!1),[g,v]=x.useState(null),[y,S]=x.useState(!1),N=[{to:"/ideas",label:"Ideas",icon:w0},{to:"/features",label:"Features",icon:Gu},{to:"/requirements",label:"Requirements",icon:nc},{to:"/handoff",label:"Handoff",icon:E0}];async function w(j){v(j?"full":"summary");try{const M=await WR(j),$=new Blob([M.markdown],{type:"text/markdown;charset=utf-8"}),B=URL.createObjectURL($),Y=document.createElement("a");Y.href=B,Y.download=j?"EXPORT-full.md":M.filePath||"EXPORT.md",document.body.appendChild(Y),Y.click(),Y.remove(),URL.revokeObjectURL(B),p(!1)}catch(M){window.alert(`Export failed: ${M instanceof Error?M.message:String(M)}`)}finally{v(null)}}return i.jsx("div",{className:"relative z-20 overflow-visible border-b border-[var(--border)] bg-[var(--surface-elevated)] backdrop-blur-xl backdrop-saturate-150",children:i.jsxs("div",{className:"page-container flex items-center gap-2 py-2 sm:gap-3 sm:py-2.5",children:[i.jsxs(Ve,{to:"/",title:a??e??"Agent Plan",className:"flex min-w-0 shrink items-center gap-2 sm:gap-2.5",children:[i.jsx("div",{className:"surface-card flex h-8 w-8 shrink-0 items-center justify-center rounded-xl border border-[var(--border)] text-[var(--accent)] sm:h-9 sm:w-9",children:i.jsx(Gu,{className:"h-4 w-4"})}),i.jsxs("span",{className:"min-w-0 truncate",children:[i.jsx("span",{className:"block truncate text-sm font-black tracking-tight sm:text-base",children:e??"Agent Plan"}),i.jsx("span",{className:"block truncate text-[9px] font-medium tracking-wide text-[var(--text-subtle)] sm:text-[10px]","data-testid":"agent-plan-version",children:s?`v${s}`:"Version unavailable"})]})]}),i.jsx("nav",{className:"ml-1 hidden items-center gap-1 md:flex",children:N.map(j=>i.jsxs(pm,{to:j.to,"aria-label":j.label,className:({isActive:R})=>`inline-flex min-h-7 shrink-0 items-center gap-1.5 rounded-[10px] border px-2 py-1 text-xs font-semibold transition sm:min-h-8 sm:rounded-[12px] sm:px-3 sm:py-1.5 sm:text-sm ${R?"border-transparent bg-[var(--accent-soft)] text-[var(--accent)]":"border-transparent text-[var(--text-muted)] hover:bg-[var(--accent-soft)] hover:text-[var(--text)]"}`,children:[i.jsx(j.icon,{className:"h-3.5 w-3.5 shrink-0 sm:h-4 sm:w-4"}),i.jsx("span",{children:j.label})]},j.to))}),i.jsxs("div",{className:"ml-auto flex shrink-0 items-center gap-1.5 sm:gap-2",children:[i.jsx(t2,{liveStatus:u}),i.jsx("button",{type:"button",onClick:d,"aria-label":c==="dark"?"Switch to light theme":"Switch to dark theme",title:c==="dark"?"Switch to light theme":"Switch to dark theme",className:"inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-[10px] border border-[var(--border-strong)] bg-[var(--surface-elevated)] text-[var(--text-muted)] transition hover:text-[var(--text)] sm:h-9 sm:w-9 sm:rounded-[12px]",children:c==="dark"?i.jsx(xR,{className:"h-4 w-4"}):i.jsx(lR,{className:"h-4 w-4"})}),i.jsxs("div",{className:"relative md:hidden",children:[i.jsx("button",{type:"button","aria-label":"Open menu","aria-haspopup":"menu","aria-expanded":y,onClick:()=>S(j=>!j),className:"inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-[10px] border border-[var(--border-strong)] bg-[var(--surface-elevated)] text-[var(--text-muted)] transition hover:text-[var(--text)]",children:y?i.jsx(j0,{className:"h-4 w-4"}):i.jsx(tR,{className:"h-4 w-4"})}),y?i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"fixed inset-0 z-[150]","aria-hidden":"true",onClick:()=>S(!1)}),i.jsxs("div",{role:"menu",onKeyDown:j=>{j.key==="Escape"&&S(!1)},className:"absolute right-0 top-full z-[200] mt-2 w-52 overflow-hidden rounded-[14px] border border-[var(--border)] bg-[var(--surface-elevated)] p-1 shadow-xl",children:[N.map(j=>i.jsxs(pm,{to:j.to,"aria-label":j.label,onClick:()=>S(!1),className:({isActive:R})=>`flex items-center gap-2 rounded-[10px] px-3 py-2 text-sm font-semibold transition ${R?"bg-[var(--accent-soft)] text-[var(--accent)]":"text-[var(--text)] hover:bg-[var(--accent-soft)]"}`,children:[i.jsx(j.icon,{className:"h-4 w-4 shrink-0"}),i.jsx("span",{children:j.label})]},j.to)),i.jsx("div",{className:"my-1 h-px bg-[var(--border)]"}),i.jsxs("button",{type:"button",role:"menuitem",disabled:g!==null,onClick:()=>{S(!1),w(!1)},className:"flex w-full items-center justify-between rounded-[10px] px-3 py-2 text-left text-sm font-semibold text-[var(--text)] transition hover:bg-[var(--accent-soft)] disabled:cursor-wait disabled:opacity-60",children:["Export summary",g==="summary"?i.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:"…"}):null]}),i.jsxs("button",{type:"button",role:"menuitem",disabled:g!==null,onClick:()=>{S(!1),w(!0)},className:"flex w-full items-center justify-between rounded-[10px] px-3 py-2 text-left text-sm font-semibold text-[var(--text)] transition hover:bg-[var(--accent-soft)] disabled:cursor-wait disabled:opacity-60",children:["Export full",g==="full"?i.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:"…"}):null]})]})]}):null]}),i.jsxs("div",{className:"relative z-30 hidden md:block",children:[i.jsxs("button",{type:"button","aria-haspopup":"menu","aria-expanded":h,"aria-label":"Export",onClick:()=>p(j=>!j),className:"inline-flex min-h-7 items-center gap-1.5 rounded-[10px] border border-[var(--border-strong)] bg-[var(--surface-elevated)] px-2 py-1 text-xs font-semibold text-[var(--text-muted)] transition hover:text-[var(--text)] sm:min-h-8 sm:rounded-[12px] sm:px-3 sm:py-1.5 sm:text-sm",children:[i.jsx(Fj,{className:"h-3.5 w-3.5 shrink-0 sm:h-4 sm:w-4"}),i.jsx("span",{children:"Export"}),i.jsx(As,{className:`h-3.5 w-3.5 shrink-0 transition-transform sm:h-4 sm:w-4 ${h?"rotate-180":""}`})]}),h?i.jsxs("div",{role:"menu",onKeyDown:j=>{var B;const R=Array.from(j.currentTarget.querySelectorAll("[role=menuitem]")).filter(Y=>!Y.hasAttribute("disabled"));if(R.length===0)return;const M=R.indexOf(document.activeElement);let $=M;if(j.key==="ArrowDown")$=M===-1?0:(M+1)%R.length;else if(j.key==="ArrowUp")$=M===-1?R.length-1:(M-1+R.length)%R.length;else if(j.key==="Home")$=0;else if(j.key==="End")$=R.length-1;else return;j.preventDefault(),(B=R[$])==null||B.focus()},className:"absolute right-0 top-full z-[200] mt-2 min-w-44 overflow-hidden rounded-[14px] border border-[var(--border)] bg-[var(--surface-elevated)] p-1 shadow-xl",children:[i.jsxs("button",{type:"button",role:"menuitem",disabled:g!==null,onClick:()=>void w(!1),className:"flex w-full items-center justify-between rounded-[10px] px-3 py-2 text-left text-sm font-semibold text-[var(--text)] transition hover:bg-[var(--accent-soft)] disabled:cursor-wait disabled:opacity-60",children:["Summary",g==="summary"?i.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:"…"}):null]}),i.jsxs("button",{type:"button",role:"menuitem",disabled:g!==null,onClick:()=>void w(!0),className:"flex w-full items-center justify-between rounded-[10px] px-3 py-2 text-left text-sm font-semibold text-[var(--text)] transition hover:bg-[var(--accent-soft)] disabled:cursor-wait disabled:opacity-60",children:["Full",g==="full"?i.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:"…"}):null]})]}):null]})]})]})})}function Vh(e,a,r){e.split(`
307
- `).forEach((u,c)=>{c>0&&a.push(i.jsx("br",{},`${r}-br-${c}`)),u&&a.push(u)})}const Uy=/\.planner\/docs\/[A-Za-z0-9][A-Za-z0-9_\-./]*\.md/g;function a2(e){return`/docs/view?path=${encodeURIComponent(e)}`}function By(e,a){const r=[],s=/(\[([^\]]+)\]\((https?:\/\/[^\s)]+)\))|(\*\*([^*]+)\*\*)|`([^`]+)`|\*([^*]+)\*/g;let u=0,c=null,d=0;for(;(c=s.exec(e))!==null;)c.index>u&&Vh(e.slice(u,c.index),r,`${a}-${d}`),c[2]&&c[3]?r.push(i.jsx("a",{href:c[3],target:"_blank",rel:"noreferrer",className:"font-semibold text-[var(--accent)] underline-offset-4 hover:underline",children:c[2]},`${a}-link-${d}`)):c[5]?r.push(i.jsx("strong",{className:"font-semibold text-[var(--text)]",children:c[5]},`${a}-strong-${d}`)):c[6]?r.push(i.jsx("code",{className:"rounded-md border border-[var(--border)] px-1.5 py-0.5 font-mono text-[0.95em] text-[var(--text)]",children:c[6]},`${a}-code-${d}`)):c[7]?r.push(i.jsx("em",{className:"italic",children:c[7]},`${a}-em-${d}`)):c[1]&&Vh(c[1],r,`${a}-raw-${d}`),u=s.lastIndex,d+=1;return u<e.length&&Vh(e.slice(u),r,`${a}-tail`),r}function Eo(e,a){const r=[];Uy.lastIndex=0;let s=0,u=null,c=0;for(;(u=Uy.exec(e))!==null;){u.index>s&&r.push(...By(e.slice(s,u.index),`${a}-md-${c}`));const d=u[0];r.push(i.jsx("a",{href:a2(d),target:"_blank",rel:"noreferrer",className:"font-semibold text-[var(--accent)] underline-offset-4 hover:underline","aria-label":`Open planner document ${d} in a new tab`,children:d},`${a}-doc-${c}`)),s=u.index+d.length,c+=1}return s<e.length&&r.push(...By(e.slice(s),`${a}-md-tail`)),r}function r2(e,a){var u;const r=e.split(`
308
- `);if(e.startsWith("```")){const c=e.replace(/^```[a-zA-Z]*\n?/,"").replace(/```\s*$/,"");return i.jsx("pre",{className:"overflow-x-auto rounded-lg border border-[var(--border)] bg-[var(--surface-elevated)] p-3 text-sm font-mono text-[var(--text)]",children:i.jsx("code",{children:c})},`code-${a}`)}const s=e.match(/^(#{1,6})\s+(.+)$/);if(s&&s[2]){const c=((u=s[1])==null?void 0:u.length)??1,d=s[2],h=c<=2?"text-base font-bold text-[var(--text)]":"text-sm font-bold text-[var(--text)]";return i.jsx("p",{className:h,children:Eo(d,`h-${a}`)},`h-${a}`)}return r.every(c=>/^\s*>\s?/.test(c))?i.jsx("blockquote",{className:"border-l-2 border-[var(--accent)] pl-4 text-sm italic text-[var(--text-muted)]",children:r.map((c,d)=>i.jsx("div",{children:Eo(c.replace(/^\s*>\s?/,""),`bq-${a}-${d}`)},`bq-${a}-${d}`))},`bq-${a}`):/^\s*([-*_])\1{2,}\s*$/.test(e.trim())?i.jsx("hr",{className:"border-[var(--border)]"},`hr-${a}`):r.every(c=>/^\s*[-*]\s+/.test(c))?i.jsx("ul",{className:"grid gap-2 pl-5 text-sm text-[var(--text-muted)]",children:r.map((c,d)=>i.jsx("li",{className:"list-disc",children:Eo(c.replace(/^\s*[-*]\s+/,""),`ul-${a}-${d}`)},`ul-${a}-${d}`))},`ul-${a}`):r.every(c=>/^\s*\d+\.\s+/.test(c))?i.jsx("ol",{className:"grid gap-2 pl-5 text-sm text-[var(--text-muted)] list-decimal",children:r.map((c,d)=>i.jsx("li",{children:Eo(c.replace(/^\s*\d+\.\s+/,""),`ol-${a}-${d}`)},`ol-${a}-${d}`))},`ol-${a}`):i.jsx("p",{className:"text-sm leading-6 text-[var(--text-muted)] whitespace-pre-wrap",children:Eo(e,`p-${a}`)},`p-${a}`)}function Nn({text:e,className:a=""}){if(!(e!=null&&e.trim()))return null;const r=e.trim().split(/\n\s*\n/).filter(Boolean);return i.jsx("div",{className:`formatted-text grid grid-cols-1 gap-3 ${a}`,children:r.map((s,u)=>r2(s,u))})}function ol(e){return String(e&&e>0?e:0).padStart(3,"0")}function ul({featureNum:e,phaseNum:a,taskNum:r}){const s=[];return e!==void 0&&s.push(`F${ol(e)}`),a!==void 0&&s.push(`P${ol(a)}`),r!==void 0&&s.push(`T${ol(r)}`),s.join("/")}async function l2(e){try{if(navigator.clipboard&&window.isSecureContext)return await navigator.clipboard.writeText(e),!0}catch{}try{const a=document.createElement("textarea");a.value=e,a.style.position="fixed",a.style.top="-1000px",a.style.opacity="0",document.body.appendChild(a),a.focus(),a.select();const r=document.execCommand("copy");return a.remove(),r}catch{return!1}}function D0({type:e,phaseNum:a,featureNum:r}){return e==="feature"?null:e==="phase"?r===void 0?null:i.jsx("div",{className:"shrink-0 inline-flex items-stretch font-mono text-[10.5px] font-semibold rounded-md overflow-hidden border border-[var(--border)] bg-[var(--surface-elevated)]",children:i.jsxs("span",{className:"px-2 py-1 text-[var(--text-muted)]",children:["F",ol(r)]})}):e==="task"?a===void 0?null:i.jsxs("div",{className:"shrink-0 inline-flex items-stretch font-mono text-[10.5px] font-semibold rounded-md overflow-hidden border border-[var(--border)] bg-[var(--surface-elevated)]",children:[i.jsxs("span",{className:"px-2 py-1 text-[var(--text-muted)]",children:["P",ol(a)]}),r!==void 0&&i.jsxs(i.Fragment,{children:[i.jsx("span",{className:"w-[1px] bg-[var(--border)]"}),i.jsxs("span",{className:"px-2 py-1 text-[var(--text-subtle)]",children:["F",ol(r)]})]})]}):null}function ar({featureNum:e,phaseNum:a,taskNum:r,featureId:s,phaseId:u,taskId:c,featureName:d,phaseName:h,taskTitle:p}){const g=d?{title:d}:{},v=h?{title:h}:{},y=p?{title:p}:{},S=s?({children:j})=>i.jsx(Ve,{to:`/features/${s}`,...g,className:"entity-path-seg entity-path-seg--feature entity-path-seg--link",children:j}):({children:j})=>i.jsx("span",{className:"entity-path-seg entity-path-seg--feature",...g,children:j}),N=u?({children:j})=>i.jsx(Ve,{to:`/features/${s}/phases/${u}`,...v,className:"entity-path-seg entity-path-seg--phase entity-path-seg--link",children:j}):({children:j})=>i.jsx("span",{className:"entity-path-seg entity-path-seg--phase",...v,children:j}),w=c?({children:j})=>i.jsx(Ve,{to:`/features/${s}/phases/${u}/tasks/${c}`,...y,className:"entity-path-seg entity-path-seg--task entity-path-seg--link",children:j}):({children:j})=>i.jsx("span",{className:"entity-path-seg entity-path-seg--task",...y,children:j});return i.jsxs("span",{className:"entity-path-badge",children:[e!==void 0?i.jsxs(S,{children:["F",ol(e)]}):null,a!==void 0?i.jsxs(i.Fragment,{children:[i.jsx("span",{className:"entity-path-sep","aria-hidden":"true",children:"/"}),i.jsxs(N,{children:["P",ol(a)]})]}):null,r!==void 0?i.jsxs(i.Fragment,{children:[i.jsx("span",{className:"entity-path-sep","aria-hidden":"true",children:"/"}),i.jsxs(w,{children:["T",ol(r)]})]}):null]})}function lr({id:e,children:a}){const[r,s]=x.useState(!1);return i.jsxs("button",{type:"button",onClick:async u=>{u.preventDefault(),u.stopPropagation(),await l2(e)&&(s(!0),window.setTimeout(()=>s(!1),1200))},title:r?"Copied":`Copy ${e}`,"aria-label":r?"Copied":`Copy ${e}`,className:"copyable-id group inline-flex items-center gap-1.5",children:[a,i.jsx("span",{className:"copyable-id__icon","aria-hidden":"true",children:r?i.jsx(Ej,{className:"h-3 w-3 text-emerald-500"}):i.jsx(qj,{className:"h-3 w-3"})})]})}function dl({shortId:e}){return i.jsx(lr,{id:e,children:i.jsx("span",{className:"short-id-badge",children:e})})}function C0({featureNum:e,phaseNum:a,taskNum:r,featureId:s,phaseId:u,taskId:c,shortId:d,featureName:h,phaseName:p,taskTitle:g}){return i.jsxs(i.Fragment,{children:[i.jsx(ar,{featureNum:e,phaseNum:a,taskNum:r,featureId:s,phaseId:u,taskId:c,featureName:h,phaseName:p,taskTitle:g}),i.jsx(lr,{id:ul({featureNum:e,phaseNum:a,taskNum:r}),children:i.jsx("span",{className:"sr-only",children:"Copy path"})}),d?i.jsx(dl,{shortId:d}):null]})}function Wm({phaseId:e,updatedAt:a}){const r=`Phase handoff pending${a?` · updated ${new Date(a).toLocaleString()}`:""}`;return i.jsxs("a",{href:`/handoff#${e}`,className:"handoff-badge flex items-center gap-1 ml-2 shrink-0",title:r,"aria-label":r,children:[i.jsxs("svg",{viewBox:"0 0 16 16",width:"14",height:"14","aria-hidden":"true",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[i.jsx("path",{d:"M4 2h5l3 3v9a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V3a1 1 0 0 1 1-1z"}),i.jsx("path",{d:"M9 2v3h3"}),i.jsx("path",{d:"M5.5 8h5M5.5 10.5h5"})]}),i.jsx("span",{className:"handoff-badge__label",children:"handoff"})]})}const ym={planned:{colorVar:"--color-status-planned",icon:"circle",pattern:"",label:"Planned",description:"Not started",borderStyle:"solid",bgOpacity:10,borderOpacity:30},started:{colorVar:"--color-status-started",icon:"play-start",pattern:"dashed",label:"Started",description:"Begun but not active now",borderStyle:"dashed",bgOpacity:10,borderOpacity:30},"in-progress":{colorVar:"--color-status-in-progress",icon:"play",pattern:"pulse",label:"In progress",description:"Active now",borderStyle:"solid",bgOpacity:12,borderOpacity:30},waiting:{colorVar:"--color-status-waiting",icon:"clock",pattern:"dashed",label:"Waiting",description:"Waiting on a dependency",borderStyle:"dashed",bgOpacity:10,borderOpacity:30},blocked:{colorVar:"--color-status-blocked",icon:"stop",pattern:"",label:"Blocked",description:"Impediment",borderStyle:"solid",bgOpacity:12,borderOpacity:30},deferred:{colorVar:"--color-status-deferred",icon:"pause",pattern:"dashed",label:"Deferred",description:"Postponed",borderStyle:"dashed",bgOpacity:10,borderOpacity:30},done:{colorVar:"--color-status-done",icon:"check",pattern:"",label:"Done",description:"Completed",borderStyle:"solid",bgOpacity:14,borderOpacity:30},closed:{colorVar:"--color-status-closed",icon:"check-mixed",pattern:"",label:"Closed",description:"Closed with mixed outcomes",borderStyle:"solid",bgOpacity:14,borderOpacity:30},canceled:{colorVar:"--color-status-canceled",icon:"ban",pattern:"hatch",label:"Canceled",description:"Canceled",borderStyle:"solid",bgOpacity:8,borderOpacity:30},rejected:{colorVar:"--color-status-rejected",icon:"x",pattern:"crosshatch",label:"Rejected",description:"Rejected",borderStyle:"solid",bgOpacity:10,borderOpacity:30}};function Ql(e){return ym[e]??ym.planned}function Xu(e,a,r){switch(a){case"bg":return`color-mix(in srgb, var(${e.colorVar}) ${e.bgOpacity}%, transparent)`;case"border":return`color-mix(in srgb, var(${e.colorVar}) ${e.borderOpacity}%, transparent)`}}function s2(e){const a=Ql(e);return{backgroundColor:Xu(a,"bg"),borderStyle:a.borderStyle,borderColor:Xu(a,"border"),borderWidth:"1px"}}function i2(e){const a=Ql(e);return{backgroundColor:Xu(a,"bg"),borderStyle:a.borderStyle,borderColor:Xu(a,"border"),borderWidth:"1px"}}function Jm(e){const{pattern:a}=Ql(e);return a?a==="dashed"?`status-pattern-dashed status-pattern-dashed-${e}`:`status-pattern-${a}`:""}function O0(e){return`status-${e}`}function M0(e,a=30){return`color-mix(in srgb, var(${Ql(e).colorVar}) ${a}%, transparent)`}function _0(e){return e in ym?e:"planned"}function o2(e,a){const s=[Ql(e).label],u=[["done",a.done],["in-progress",a.inProgress],["planned",a.planned],["waiting",a.waiting],["blocked",a.blocked],["deferred",a.deferred],["canceled",a.canceled],["rejected",a.rejected]];for(const[c,d]of u)d>0&&s.push(`${d} ${c}`);return s.join(" · ")}const L0={circle:md,"play-start":cR,play:b0,clock:Ij,stop:S0,pause:Vm,check:Fm,"check-mixed":Tj,ban:v0,x:$j};function c2({status:e,className:a=""}){const r=Ql(e),s=L0[r.icon]??md;return i.jsx(s,{className:`h-4 w-4 shrink-0 ${a}`.trim(),"aria-hidden":"true"})}function hr({status:e}){const a=_0(e),r=Ql(a);return i.jsxs("span",{className:`status-chip ${O0(a)} ${Jm(a)}`,title:r.description,"aria-label":r.description,children:[i.jsx(c2,{status:a,className:"h-3.5 w-3.5"}),i.jsx("span",{children:r.label})]})}function rc({status:e,breakdown:a,size:r="md",children:s}){const u=Ql(e),c=L0[u.icon]??md,d=Jm(e),h=a?o2(e,a):u.description,p=r==="sm"?"px-2 py-0.5 text-[10px]":"px-2.5 py-1 text-[11px]";return i.jsxs("span",{className:`status-chip ${O0(e)} ${d} ${p}`,title:h,"aria-label":h,children:[i.jsx(c,{className:"h-3.5 w-3.5"}),i.jsx("span",{children:u.label}),s]})}function Qu({status:e,breakdown:a,doneTasks:r,totalTasks:s,recentlyChanged:u,className:c}){const d=r!=null&&s!=null;return i.jsxs("div",{className:c,children:[u?i.jsx("span",{className:"rounded-full bg-[color:color-mix(in_srgb,var(--accent)_16%,transparent)] px-2 py-0.5 text-[10px] font-semibold uppercase tracking-[0.12em] text-[var(--accent)]",children:"Updated"}):null,d?i.jsxs("span",{className:"text-xs text-[var(--text-muted)]",children:["(",r,"/",s||0,")"]}):null,i.jsx(rc,{status:e,breakdown:a})]})}function bm({task:e,variant:a="active"}){const r=_r(),s=e.featureId?`/features/${e.featureId}/phases/${e.phaseId}/tasks/${e.id}`:"/features";return i.jsx("article",{className:`min-w-0 rounded-[12px] border bg-[var(--surface-card)] px-3 py-2 text-sm text-[var(--text)] ${a==="next"?"border-dashed border-[var(--accent)] bg-[var(--accent)]/5":e.pendingResume?"border-[var(--accent)]":"border-[var(--border)]"}`,children:i.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[i.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:[i.jsx(ar,{featureNum:e.featureNumber,phaseNum:e.phaseNumber,taskNum:e.number,featureId:e.featureId,phaseId:e.phaseId,taskId:e.id}),i.jsx(lr,{id:ul({featureNum:e.featureNumber,phaseNum:e.phaseNumber,taskNum:e.number}),children:i.jsx("span",{className:"sr-only",children:"Copy task path"})}),e.shortId?i.jsx(dl,{shortId:e.shortId}):null,a==="next"?i.jsx("span",{className:"shrink-0 rounded-full border border-[var(--accent)]/50 px-1.5 py-0.5 text-[9px] font-bold uppercase tracking-[0.16em] text-[var(--accent)]",children:"Next"}):null,i.jsx("span",{className:"shrink-0",children:i.jsx(hr,{status:e.status})}),i.jsx(Ve,{to:s,className:"min-w-0 flex-1 truncate font-medium hover:text-[var(--accent)]",children:e.title})]}),i.jsx("button",{type:"button",onClick:u=>{u.preventDefault(),u.stopPropagation(),r(`/?locate=T${e.number}`)},"aria-label":`Locate T${e.number} in work tree`,title:"Locate in work tree",className:"inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-[8px] text-[var(--text-subtle)] transition-colors hover:bg-[var(--accent)] hover:text-white",children:i.jsx(Jj,{className:"h-4 w-4"})})]})})}function u2({taskFocus:e}){const a=x.useMemo(()=>{const r=s=>{const u=new Set;return s.filter(c=>u.has(c.id)?!1:(u.add(c.id),!0))};return{active:r(e.active),pendingResume:r(e.pendingResume)}},[e.active,e.pendingResume]);return a.active.length===0&&!e.nextWork?null:i.jsx("div",{className:"relative z-10 border-t border-[var(--border)] bg-[var(--surface-elevated)]/95 backdrop-blur-xl",children:i.jsx("div",{className:"page-container grid gap-3 py-2.5",children:a.active.length>0?i.jsxs("section",{"aria-labelledby":"active-task-heading",className:"grid gap-1.5",children:[i.jsxs("h2",{id:"active-task-heading",className:"text-[10px] font-semibold uppercase tracking-[0.22em] text-[var(--text-subtle)]",children:["Active tasks (",a.active.length,")"]}),a.active.map(r=>i.jsx(bm,{task:r},r.id))]}):e.nextWork?i.jsxs("section",{"aria-labelledby":"next-work-heading",className:"grid gap-1.5",children:[i.jsx("h2",{id:"next-work-heading",className:"text-[10px] font-semibold uppercase tracking-[0.22em] text-[var(--text-subtle)]",children:"Next work"}),i.jsx(bm,{task:e.nextWork,variant:"next"}),e.nextWorkReason?i.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:e.nextWorkReason}):null]}):null})})}function d2({project:e,taskFocus:a,serverInfo:r}){const s=gr(),[u,c]=x.useState("connecting");return x.useEffect(()=>{const d=h=>{var g;const p=(g=h.detail)==null?void 0:g.status;p&&c(p)};return window.addEventListener("agent-plan:ws-status",d),()=>window.removeEventListener("agent-plan:ws-status",d)},[]),i.jsxs("div",{className:"page-shell",children:[i.jsxs("header",{className:"sticky top-0 z-30 overflow-visible",children:[i.jsx(n2,{projectName:e==null?void 0:e.name,projectRoot:e==null?void 0:e.projectRoot,planRoot:e==null?void 0:e.planRoot,agentPlanVersion:(e==null?void 0:e.agentPlanVersion)??"",liveStatus:u}),i.jsx(u2,{taskFocus:a})]}),i.jsxs("div",{className:"page-container py-8",children:[i.jsxs("div",{className:"mb-8 flex flex-col gap-3 md:flex-row md:items-end md:justify-between md:gap-6",children:[i.jsxs("div",{className:"min-w-0",children:[i.jsx("p",{className:"text-sm font-semibold uppercase tracking-[0.24em] text-[var(--text-subtle)]",children:"Current project"}),i.jsx("h1",{className:"text-2xl font-black tracking-tight text-[var(--text)] md:text-3xl",children:i.jsx(Ve,{to:"/",className:"hover:text-[var(--accent)]",children:(e==null?void 0:e.name)??"Agent Plan"})}),e!=null&&e.projectRoot?i.jsx("p",{className:"mt-2 truncate font-mono text-xs text-[var(--text-subtle)]",title:e.projectRoot,children:e.projectRoot}):null,r?i.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-2 text-xs",children:[i.jsxs("span",{className:`inline-flex items-center gap-1.5 rounded-full px-2.5 py-1 font-semibold uppercase tracking-[0.12em] ${r.mode==="lan"?"bg-[color:color-mix(in_srgb,var(--accent)_16%,transparent)] text-[var(--accent)]":"bg-[var(--surface-elevated)] text-[var(--text-muted)]"}`,children:[i.jsx("span",{"aria-hidden":"true",className:"inline-block h-1.5 w-1.5 rounded-full bg-current"}),r.mode==="lan"?"LAN visible":"Local only"]}),i.jsx("a",{href:r.localUrl,target:"_blank",rel:"noreferrer",className:"font-mono text-[var(--text-subtle)] underline-offset-2 hover:text-[var(--accent)] hover:underline",children:r.localUrl}),r.lanUrl?i.jsxs(i.Fragment,{children:[i.jsx("span",{className:"text-[var(--text-subtle)]",children:"·"}),i.jsx("a",{href:r.lanUrl,target:"_blank",rel:"noreferrer",className:"font-mono text-[var(--text-subtle)] underline-offset-2 hover:text-[var(--accent)] hover:underline",children:r.lanUrl})]}):null]}):null,e!=null&&e.description?i.jsx(Nn,{text:e.description,className:"mt-2 max-w-3xl"}):null]}),s.state!=="idle"?i.jsx("div",{className:"text-sm font-semibold text-[var(--accent)]",children:"Updating…"}):null]}),i.jsx(ji,{})]})]})}const ka=32,z0=4,f2=Math.PI*1.2;function $0(){if(typeof document>"u")return"#7b68ee";const e=document.createElement("div");e.style.color="var(--accent, #7b68ee)",document.body.appendChild(e);const a=getComputedStyle(e).color||"#7b68ee";return e.remove(),a}function h2(){const e=document.createElement("canvas");e.width=ka,e.height=ka;const a=e.getContext("2d");if(!a)return"";const r=$0();return a.beginPath(),a.arc(ka/2,ka/2,ka/2-z0,0,Math.PI*2),a.fillStyle=r,a.fill(),a.fillStyle="#ffffff",a.font="bold 16px system-ui, sans-serif",a.textAlign="center",a.textBaseline="middle",a.fillText("A",ka/2,ka/2+1),e.toDataURL("image/png")}function m2(e,a){const r=e.getContext("2d");if(!r)return"";const s=$0();r.clearRect(0,0,ka,ka);const u=ka/2,c=ka/2,d=ka/2-z0;return r.beginPath(),r.arc(u,c,d,0,Math.PI*2),r.fillStyle=s,r.globalAlpha=.85,r.fill(),r.globalAlpha=1,r.beginPath(),r.arc(u,c,d-3,a,a+f2),r.strokeStyle="#ffffff",r.lineWidth=3,r.lineCap="round",r.stroke(),r.fillStyle="#ffffff",r.font="bold 14px system-ui, sans-serif",r.textAlign="center",r.textBaseline="middle",r.fillText("A",u,c+1),e.toDataURL("image/png")}function p2(){let e=document.querySelector("link[rel~='icon']");return e||(e=document.createElement("link"),e.rel="icon",e.type="image/png",document.head.appendChild(e)),e}function g2(e){const a=x.useRef(null),r=x.useRef(null),s=x.useRef(null),u=x.useRef(0);x.useEffect(()=>{if(a.current||(a.current=p2()),s.current||(s.current=h2()),!r.current){const h=document.createElement("canvas");h.width=ka,h.height=ka,r.current=h}const c=a.current;if(!e){c.href=s.current;return}const d=window.setInterval(()=>{document.hidden||(u.current+=Math.PI/10,c.href=m2(r.current,u.current))},100);return()=>{window.clearInterval(d),c.href=s.current}},[e])}const Oo={create:{key:"n",primary:!0},edit:{key:"e",primary:!0},delete:{key:"d",primary:!0},submit:{key:"Enter",primary:!0}},U0=x.createContext(Oo);function B0(){return typeof navigator<"u"&&/Mac|iPhone|iPad|iPod/.test(navigator.platform)}function x2(e){return typeof e!="string"}function v2(e){return{create:(e==null?void 0:e.create)??Oo.create,edit:(e==null?void 0:e.edit)??Oo.edit,delete:(e==null?void 0:e.delete)??Oo.delete,submit:(e==null?void 0:e.submit)??Oo.submit}}function y2(e){const a=[],r=B0();e.primary&&a.push(r?"⌘":"Ctrl"),e.meta&&a.push(r?"⌘":"Meta"),e.ctrl&&a.push(r?"⌃":"Ctrl"),e.shift&&a.push(r?"⇧":"Shift"),e.alt&&a.push(r?"⌥":"Alt");const s=e.key==="Backspace"?r?"⌫":"Backspace":e.key==="Enter"?r?"↩":"Enter":e.key.length===1?e.key.toUpperCase():e.key;return a.push(s),r?a.join(""):a.join("+")}function b2(e){return e instanceof HTMLElement?!!e.closest("input, textarea, select, [contenteditable='true']"):!1}function w2(e,a){const r=a.key.length===1?a.key.toLowerCase():a.key,s=e.key.length===1?e.key.toLowerCase():e.key,u=B0(),c=a.meta??(a.primary?u:!1),d=a.ctrl??(a.primary?!u:!1);return s===r&&!!c===e.metaKey&&!!d===e.ctrlKey&&!!a.shift===e.shiftKey&&!!a.alt===e.altKey}function S2({shortcuts:e,children:a}){return x.createElement(U0.Provider,{value:v2(e)},a)}function I0(e){const a=x.useContext(U0);if(e)return x2(e)?e:a[e]}function _n(e,a,r){const s=I0(e);x.useEffect(()=>{if(!s||(r==null?void 0:r.enabled)===!1)return;const u=c=>{!(r!=null&&r.allowInEditable)&&b2(c.target)||w2(c,s)&&(c.preventDefault(),a())};return window.addEventListener("keydown",u),()=>window.removeEventListener("keydown",u)},[a,r==null?void 0:r.allowInEditable,r==null?void 0:r.enabled,s])}const N2=1500,E2=80,j2=12e3,R2=5e3;function k2(){const{revalidate:e}=iE(),a=x.useRef(null),r=x.useRef(null),s=x.useRef(null),u=x.useRef(null),c=x.useRef(null);return x.useEffect(()=>{let d=!0;const h=Y=>{window.dispatchEvent(new CustomEvent("agent-plan:ws-status",{detail:{status:Y}}))},p=()=>{r.current!==null&&(window.clearTimeout(r.current),r.current=null)},g=()=>{s.current!==null&&(window.clearTimeout(s.current),s.current=null)},v=()=>{c.current!==null&&(window.clearTimeout(c.current),c.current=null)},y=()=>{u.current!==null&&(window.clearInterval(u.current),u.current=null)},S=()=>{g(),s.current=window.setTimeout(()=>{e()},E2)},N=()=>{!d||r.current!==null||(h("reconnecting"),r.current=window.setTimeout(()=>{r.current=null,R()},N2))},w=()=>{y(),v();const Y=a.current;if(a.current=null,Y&&(Y.readyState===WebSocket.OPEN||Y.readyState===WebSocket.CONNECTING))try{Y.close()}catch{}},j=()=>{y(),v(),u.current=window.setInterval(()=>{const Y=a.current;if(!(!Y||Y.readyState!==WebSocket.OPEN)){try{Y.send(JSON.stringify({type:"ping"}))}catch{w(),N();return}v(),c.current=window.setTimeout(()=>{w(),N()},R2)}},j2)},R=()=>{if(!d)return;const Y=a.current;if(Y&&(Y.readyState===WebSocket.OPEN||Y.readyState===WebSocket.CONNECTING))return;h(r.current!==null?"reconnecting":"connecting"),p();const ne=window.location.protocol==="https:"?"wss":"ws",ae=new WebSocket(`${ne}://${window.location.host}/ws`);a.current=ae,ae.onopen=()=>{p(),h("live"),j()},ae.onmessage=U=>{v();try{const k=JSON.parse(U.data);if(!k.type||k.type==="pong"||k.type==="connected")return;switch(window.dispatchEvent(new CustomEvent("agent-plan:ws-event",{detail:k})),k.type){case"project-updated":case"features-updated":case"phases-updated":case"requirements-updated":case"plan-rendered":case"file-changed":case"handoffUpdated":case"handoffCleared":S();break;default:break}}catch{}},ae.onclose=()=>{y(),v(),a.current===ae&&(a.current=null),d&&N()},ae.onerror=()=>{try{ae.close()}catch{}}},M=()=>{const Y=a.current;(!Y||Y.readyState===WebSocket.CLOSED||Y.readyState===WebSocket.CLOSING)&&R()},$=()=>{document.visibilityState==="visible"&&M()},B=()=>{M()};return h("connecting"),R(),window.addEventListener("online",B),document.addEventListener("visibilitychange",$),()=>{d=!1,h("disconnected"),window.removeEventListener("online",B),document.removeEventListener("visibilitychange",$),p(),g(),y(),v(),w()}},[e]),null}async function T2(){const[e,a,r]=await Promise.all([Gm(),AR(),KR()]);return{project:e,uiConfig:a,taskFocus:r}}function A2(){const{project:e,uiConfig:a,taskFocus:r}=xr();return x.useEffect(()=>{var d,h;const s=(d=e==null?void 0:e.name)==null?void 0:d.trim(),u=(h=e==null?void 0:e.projectRoot)==null?void 0:h.trim(),c=u?u.split(/[/\\]/).filter(Boolean).pop():void 0;s?c&&c!==s?document.title=`${s} · ${c}`:document.title=`${s} · Agent Plan`:document.title="Agent Plan"},[e==null?void 0:e.name,e==null?void 0:e.projectRoot]),g2(r.active.length>0),i.jsxs(S2,{shortcuts:a.shortcuts,children:[i.jsx(k2,{}),i.jsx(m0,{getKey:s=>s.pathname}),i.jsx(d2,{project:e,taskFocus:r,serverInfo:a.server})]})}function D2(e,a){if(typeof e=="object"&&e!==null&&"message"in e&&typeof e.message=="string")return e.message;if(typeof e=="string"){try{const r=JSON.parse(e);if(typeof r.message=="string")return r.message}catch{return e}return e}return a}function C2(){const e=d0(),a=Si(e),r=a&&e.status===503,s=a&&e.status===423,u=a?r?"Planner web UI disconnected":s?"Planner write already in progress":`Request failed (${e.status})`:"Planner web UI unavailable",c=a?D2(e.data,e.statusText):e instanceof Error?e.message:"The planner web UI could not reach its local server.";return x.useEffect(()=>{document.title="Agent Plan"},[]),i.jsx("div",{className:"page-shell min-h-screen",children:i.jsx("div",{className:"page-container flex min-h-screen items-center justify-center py-12",children:i.jsxs("div",{className:"surface-card max-w-2xl rounded-[24px] px-8 py-8",children:[i.jsx("p",{className:"text-sm font-semibold uppercase tracking-[0.24em] text-[var(--text-subtle)]",children:"Agent Plan"}),i.jsx("h1",{className:"mt-2 text-2xl font-black tracking-tight text-[var(--text)] md:text-3xl",children:u}),i.jsx("p",{className:"mt-4 text-sm text-[var(--text-muted)]",children:String(c)}),i.jsx("div",{className:"mt-6 grid gap-2 text-sm text-[var(--text-muted)]",children:r?i.jsxs(i.Fragment,{children:[i.jsx("p",{children:"Possible cause: Pi was closed or the local planner web server stopped."}),i.jsx("p",{children:"What to do:"}),i.jsxs("ul",{className:"grid gap-1 pl-5",children:[i.jsxs("li",{className:"list-disc",children:["restart Pi or run ",i.jsx("code",{children:"planner-web start"})]}),i.jsx("li",{className:"list-disc",children:"reopen this planner UI from the new session if needed"}),i.jsx("li",{className:"list-disc",children:"then reload this page"})]})]}):s?i.jsxs(i.Fragment,{children:[i.jsx("p",{children:"Another Pi, MCP, CLI, development, or planner-server process is currently mutating this planner root."}),i.jsx("p",{children:"Read-only pages remain available. Wait for that write to finish, then retry without starting another planner server."})]}):i.jsxs(i.Fragment,{children:[i.jsx("p",{children:"The request reached the planner server, but the server rejected it."}),i.jsx("p",{children:"Fix the validation issue above, then try again."})]})}),i.jsx("div",{className:"mt-6 flex flex-wrap gap-3",children:i.jsx("button",{type:"button",onClick:()=>window.location.reload(),className:"inline-flex min-h-9 items-center whitespace-nowrap rounded-[12px] bg-[var(--accent)] px-3 py-1.5 text-sm font-semibold text-white transition hover:opacity-90 sm:min-h-11 sm:rounded-[14px] sm:px-4 sm:py-2",children:"Reload page"})})]})})})}async function O2(){const[e,a,r]=await Promise.all([Qm(),xd(),QR()]);return{features:e,phases:a,activeTasks:r}}function M2({shortcut:e}){const a=I0(e);return a?i.jsx("span",{className:"hidden rounded-md border border-[var(--border-strong)] bg-[var(--surface-elevated)] px-2 py-0.5 text-[11px] font-bold tracking-wide text-[var(--text-muted)] sm:inline-block",children:y2(a)}):null}const _2={primary:"border-transparent bg-[var(--accent)] text-white hover:bg-[var(--accent-hover)]",secondary:"border-[var(--border-strong)] bg-[var(--surface-elevated)] text-[var(--text)] hover:bg-[var(--accent-soft)] hover:text-[var(--text)]",ghost:"border-transparent bg-transparent text-[var(--text-muted)] hover:bg-[var(--accent-soft)] hover:text-[var(--text)]",danger:"border-transparent bg-[var(--danger-soft)] text-[var(--color-status-blocked)] hover:bg-[color-mix(in_srgb,var(--danger-soft)_88%,black_12%)]"};function Ke({variant:e="secondary",className:a="",children:r,shortcut:s,...u}){return i.jsxs("button",{className:`inline-flex min-h-9 items-center justify-center gap-1.5 whitespace-nowrap rounded-[12px] border px-3 py-1.5 text-sm font-semibold transition-colors motion-reduce:transition-none focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--accent)] focus-visible:ring-offset-2 focus-visible:ring-offset-[var(--surface)] disabled:cursor-not-allowed disabled:opacity-60 sm:min-h-11 sm:rounded-[14px] sm:px-4 sm:py-2 sm:gap-2 ${_2[e]} ${a}`,...u,children:[i.jsx("span",{className:"inline-flex items-center gap-1.5 sm:gap-2",children:r}),s?i.jsx(M2,{shortcut:s}):null]})}function Gt({className:e="",children:a,...r}){return i.jsx("div",{className:`surface-card p-6 ${e}`,...r,children:a})}function wm({targetType:e,targetRef:a,returnTo:r}){return i.jsxs(i.Fragment,{children:[i.jsx("input",{type:"hidden",name:"targetType",value:e}),a?i.jsx("input",{type:"hidden",name:"targetRef",value:a}):null,i.jsx("input",{type:"hidden",name:"returnTo",value:r})]})}function H0({decision:e}){return i.jsxs("div",{className:"grid gap-2",children:[i.jsxs("label",{className:"grid gap-1 text-sm font-medium text-[var(--text)]",children:["Title",i.jsx("input",{name:"title",required:!0,defaultValue:(e==null?void 0:e.title)??"",className:"field-control"})]}),i.jsxs("label",{className:"grid gap-1 text-sm font-medium text-[var(--text)]",children:["Decision",i.jsx("textarea",{name:"decision",defaultValue:(e==null?void 0:e.decision)??"",className:"field-control field-textarea min-h-20"})]}),i.jsxs("label",{className:"grid gap-1 text-sm font-medium text-[var(--text)]",children:["Rationale",i.jsx("textarea",{name:"rationale",defaultValue:(e==null?void 0:e.rationale)??"",className:"field-control field-textarea min-h-20"})]}),i.jsxs("label",{className:"grid gap-1 text-sm font-medium text-[var(--text)]",children:["Implementation notes",i.jsx("textarea",{name:"implementationNotes",defaultValue:(e==null?void 0:e.implementationNotes)??"",className:"field-control field-textarea min-h-20"})]})]})}function L2({targetType:e,targetRef:a,returnTo:r}){return i.jsxs("details",{className:"surface-card px-4 py-3",children:[i.jsx("summary",{className:"cursor-pointer select-none text-sm font-semibold text-[var(--text)]",children:"Add accepted decision"}),i.jsxs(un,{method:"post",action:"/accepted-decisions",className:"mt-3 grid gap-3",children:[i.jsx(wm,{targetType:e,targetRef:a,returnTo:r}),i.jsx("input",{type:"hidden",name:"intent",value:"create"}),i.jsx(H0,{}),i.jsx(Ke,{type:"submit",variant:"primary",className:"justify-self-start",children:"Add decision"})]})]})}function z2({entry:e,targetType:a,targetRef:r,returnTo:s}){return i.jsxs("details",{className:"mt-3 rounded-[12px] border border-[var(--border)] bg-[var(--surface-elevated)] px-3 py-2",children:[i.jsx("summary",{className:"cursor-pointer select-none text-sm font-semibold text-[var(--text)]",children:"Manage decision"}),i.jsxs("div",{className:"mt-3 grid gap-3",children:[i.jsxs(un,{method:"post",action:"/accepted-decisions",className:"grid gap-3",children:[i.jsx(wm,{targetType:a,targetRef:r,returnTo:s}),i.jsx("input",{type:"hidden",name:"intent",value:"update"}),i.jsx("input",{type:"hidden",name:"decisionId",value:e.id}),i.jsx(H0,{decision:e}),i.jsx(Ke,{type:"submit",variant:"secondary",className:"justify-self-start",children:"Save decision"})]}),i.jsxs(un,{method:"post",action:"/accepted-decisions",onSubmit:u=>{window.confirm(`Delete accepted decision “${e.title}”? This cannot be undone.`)||u.preventDefault()},children:[i.jsx(wm,{targetType:a,targetRef:r,returnTo:s}),i.jsx("input",{type:"hidden",name:"intent",value:"delete"}),i.jsx("input",{type:"hidden",name:"decisionId",value:e.id}),i.jsx(Ke,{type:"submit",variant:"danger",children:"Delete decision"})]})]})]})}function bd({decisions:e,targetType:a,targetRef:r}){const s=Aa(),u=`${s.pathname}${s.search}${s.hash}`,c=!!a;return e.length===0&&!c?null:i.jsxs("details",{className:"group mt-4",children:[i.jsx("summary",{className:"flex cursor-pointer select-none items-center gap-2 font-semibold text-[var(--text)]",children:i.jsxs("span",{children:["Accepted decisions (",e.length,")"]})}),i.jsxs("div",{className:"mt-2 grid gap-3",children:[c&&a?i.jsx(L2,{targetType:a,targetRef:r,returnTo:u}):null,e.map(d=>i.jsxs("div",{className:"surface-card px-4 py-3",children:[i.jsx("p",{className:"text-sm font-semibold text-[var(--text)]",children:d.title}),d.decision?i.jsxs("div",{className:"mt-2 text-sm text-[var(--text-muted)]",children:[i.jsx("span",{className:"font-semibold text-[var(--text)]",children:"Decision:"}),i.jsx(Nn,{text:d.decision,className:"mt-1"})]}):null,d.rationale?i.jsxs("div",{className:"mt-1 text-sm text-[var(--text-muted)]",children:[i.jsx("span",{className:"font-semibold text-[var(--text)]",children:"Rationale:"}),i.jsx(Nn,{text:d.rationale,className:"mt-1"})]}):null,d.implementationNotes?i.jsxs("div",{className:"mt-1 text-sm text-[var(--text-muted)]",children:[i.jsx("span",{className:"font-semibold text-[var(--text)]",children:"Implementation:"}),i.jsx(Nn,{text:d.implementationNotes,className:"mt-1"})]}):null,c&&a?i.jsx(z2,{entry:d,targetType:a,targetRef:r,returnTo:u}):null]},d.id))]})]},s.key)}function Eu({title:e,items:a}){return a.length===0?null:i.jsxs("section",{children:[i.jsx("h3",{className:"text-sm font-semibold uppercase tracking-[0.18em] text-[var(--text-subtle)]",children:e}),i.jsx("ul",{className:"mt-2 grid gap-2 pl-5 text-sm text-[var(--text-muted)]",children:a.map(r=>i.jsx("li",{className:"list-disc",children:r},r))})]})}function $2({project:e}){const a=e.projectGuidelines.content.trim(),r=e.workflowRules.beforePhaseStart.length+e.workflowRules.beforeTaskStart.length+e.workflowRules.afterPhaseComplete.length,s=e.globalRules.length+r+e.decisions.length;return e.scope.length>0||e.outOfScope.length>0||e.technologies.length>0||e.tools.length>0||a.length>0||e.acceptedDecisions.length>0||s>0?i.jsx(Gt,{className:"grid gap-4",children:i.jsxs("details",{className:"group",children:[i.jsx("summary",{className:"cursor-pointer select-none text-lg font-bold text-[var(--text)]",children:"Project Context"}),i.jsxs("div",{className:"mt-4 grid gap-4",children:[i.jsx(Eu,{title:"In scope",items:e.scope}),i.jsx(Eu,{title:"Out of scope",items:e.outOfScope}),e.technologies.length>0||e.tools.length>0?i.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[i.jsx(Eu,{title:"Technologies",items:e.technologies}),i.jsx(Eu,{title:"Tools",items:e.tools})]}):null,a?i.jsxs("section",{children:[i.jsx("h3",{className:"text-sm font-semibold uppercase tracking-[0.18em] text-[var(--text-subtle)]",children:"Project Guidelines"}),i.jsx("div",{className:"mt-2 text-sm text-[var(--text-muted)]",children:i.jsx(Nn,{text:a})})]}):null,i.jsx(bd,{decisions:e.acceptedDecisions,targetType:"project"}),s>0?i.jsxs("aside",{className:"rounded-[14px] border border-[var(--border)] bg-[var(--surface-elevated)] px-4 py-3 text-sm text-[var(--text-muted)]","aria-label":"Legacy project context",children:[i.jsx("span",{className:"font-semibold text-[var(--text)]",children:"Legacy project context remains."})," ",s," legacy rule or decision ",s===1?"entry will":"entries will"," migrate automatically on the next explicit planner load."]}):null]})]})}):null}function In({className:e="",children:a,...r}){return i.jsx("div",{className:`surface-card p-4 ${e}`,...r,children:a})}function Sm(...e){return e.filter(Boolean).join(" ")}function ep({items:e,className:a}){const r=e.filter(s=>s.visible!==!1);return r.length===0?null:i.jsx("div",{className:Sm("grid gap-4 md:grid-cols-2 xl:grid-cols-4",a),children:r.map(s=>i.jsxs(In,{children:[i.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.22em] text-[var(--text-subtle)]",children:s.label}),i.jsx("div",{className:Sm("mt-2 text-sm font-semibold break-words text-[var(--text)] [overflow-wrap:anywhere]",s.valueClassName),children:s.value})]},s.label))})}function wd(e){return e&&e>0?`P${e}`:""}function Sd({priority:e,className:a}){const r=wd(e);if(!r)return null;const s=`Priority ${e}`;return i.jsx("span",{className:Sm("inline-flex items-center rounded-full border border-[var(--border)] bg-[var(--surface-elevated)] px-2 py-0.5 text-[10px] font-semibold uppercase tracking-[0.08em] text-[var(--text-muted)]",a),"aria-label":s,title:s,children:r})}function U2(e,a){return!e&&!a?"":`${e||"Start not set"} → ${a||"End not set"}`}function B2(e){try{return new Intl.DateTimeFormat(void 0,{dateStyle:"medium",timeStyle:"short"}).format(new Date(e))}catch{return e}}function I2({features:e,phases:a}){const r=x.useMemo(()=>{const s=new Map(e.map(u=>[u.id,u.name]));return a.flatMap(u=>u.tasks.filter(c=>c.status==="done").map(c=>({task:c,phase:u,feature:e.find(d=>d.id===u.featureId),featureName:u.featureId?s.get(u.featureId)??u.featureId:"Unlinked feature",completedAt:c.completedAt||c.updatedAt}))).sort((u,c)=>c.completedAt.localeCompare(u.completedAt)).slice(0,3)},[e,a]);return i.jsxs(Gt,{className:"grid gap-4",children:[i.jsxs("div",{children:[i.jsx("h2",{className:"text-lg font-bold text-[var(--text)]",children:"Latest completed tasks"}),i.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:"Most recently completed tasks, ordered by completion timestamp."})]}),i.jsx("div",{className:"grid gap-3",children:r.length>0?r.map(({task:s,phase:u,feature:c,featureName:d,completedAt:h})=>i.jsxs("div",{className:"surface-card grid min-w-0 grid-cols-1 gap-1 px-4 py-3 transition hover:border-[var(--accent)] hover:bg-[var(--accent-soft)]",children:[i.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[i.jsx(C0,{featureNum:c==null?void 0:c.number,phaseNum:u.number,taskNum:s.number,featureId:c==null?void 0:c.id,phaseId:u.id,taskId:s.id,shortId:s.shortId,featureName:c==null?void 0:c.name,phaseName:u.title,taskTitle:s.title}),i.jsx(Sd,{priority:s.priority}),i.jsx("span",{className:"ml-auto shrink-0",children:i.jsx(hr,{status:s.status})})]}),i.jsx(Ve,{to:u.featureId?`/features/${u.featureId}/phases/${u.id}/tasks/${s.id}`:"/features",className:"entity-link--task min-w-0 break-words text-sm font-semibold underline-offset-4 [overflow-wrap:anywhere]",children:s.title}),i.jsxs("div",{className:"flex min-w-0 items-center gap-2 text-xs text-[var(--text-muted)]",children:[i.jsx(D0,{type:"phase",featureNum:c==null?void 0:c.number}),i.jsxs("span",{className:"min-w-0 truncate",children:[d," · ",u.title]})]}),i.jsxs("div",{className:"text-[11px] text-[var(--text-subtle)]",children:["Completed ",B2(h)]})]},s.id)):i.jsx("p",{className:"py-4 text-center text-sm text-[var(--text-muted)]",children:"No completed tasks yet."})})]})}const Iy=1440*60*1e3;function H2(e){const a=Date.now()-new Date(e).getTime();if(a<0)return"just now";const r=Math.floor(a/1e3);if(r<60)return`${r}s ago`;const s=Math.floor(r/60);return s<60?`${s}m ago`:new Intl.DateTimeFormat(void 0,{dateStyle:"medium",timeStyle:"short"}).format(new Date(e))}function q2({features:e,phases:a}){const[,r]=x.useState(0),s=Date.now(),u=x.useMemo(()=>{const c=new Map(e.map(d=>[d.id,d.name]));return a.flatMap(d=>d.tasks.map(h=>({task:h,phase:d,feature:e.find(p=>p.id===d.featureId),featureName:d.featureId?c.get(d.featureId)??d.featureId:"Unlinked feature",createdAt:h.createdAt}))).filter(d=>{const h=new Date(d.createdAt).getTime();return Number.isFinite(h)&&s-h<Iy&&s-h>=0&&d.task.status==="planned"&&!d.task.startedAt}).sort((d,h)=>h.createdAt.localeCompare(d.createdAt)).slice(0,10)},[e,a,s]);return x.useEffect(()=>{if(u.length===0)return;const c=u.reduce((h,p)=>{const g=new Date(p.createdAt).getTime()+Iy-Date.now();return Math.min(h,g)},1/0);if(!Number.isFinite(c)||c<=0)return;const d=window.setTimeout(()=>r(h=>h+1),c+50);return()=>window.clearTimeout(d)},[u]),u.length===0?null:i.jsxs(Gt,{className:"grid gap-4",children:[i.jsxs("div",{children:[i.jsx("h2",{className:"text-lg font-bold text-[var(--text)]",children:"New Added Tasks"}),i.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:"Tasks created in the last 24 hours."})]}),i.jsx("div",{className:"grid gap-3",children:u.map(({task:c,phase:d,feature:h,featureName:p,createdAt:g})=>i.jsxs("div",{className:"surface-card grid min-w-0 grid-cols-1 gap-1 border-[color:color-mix(in_srgb,var(--color-status-done)_0%,transparent)] px-4 py-3 transition hover:border-[var(--accent)] hover:bg-[var(--accent-soft)]",children:[i.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[i.jsx(C0,{featureNum:h==null?void 0:h.number,phaseNum:d.number,taskNum:c.number,featureId:h==null?void 0:h.id,phaseId:d.id,taskId:c.id,shortId:c.shortId,featureName:h==null?void 0:h.name,phaseName:d.title,taskTitle:c.title}),i.jsx(Sd,{priority:c.priority}),i.jsx("span",{className:"inline-flex items-center rounded-full bg-[color:color-mix(in_srgb,var(--accent)_18%,transparent)] px-2 py-0.5 text-[10px] font-bold uppercase tracking-wider text-[var(--accent)]",children:"New"}),i.jsx("span",{className:"ml-auto shrink-0",children:i.jsx(hr,{status:c.status})})]}),i.jsx(Ve,{to:d.featureId?`/features/${d.featureId}/phases/${d.id}/tasks/${c.id}`:"/features",className:"entity-link--task min-w-0 break-words text-sm font-semibold underline-offset-4 [overflow-wrap:anywhere]",children:c.title}),i.jsxs("div",{className:"flex min-w-0 items-center gap-2 text-xs text-[var(--text-muted)]",children:[i.jsx(D0,{type:"phase",featureNum:h==null?void 0:h.number}),i.jsxs("span",{className:"min-w-0 truncate",children:[p," · ",d.title]})]}),i.jsxs("div",{className:"text-[11px] text-[var(--text-subtle)]",children:["Added ",H2(g)]})]},c.id))})]})}const P2=new Set(["in-progress"]),F2=new Set(["planned","waiting","blocked","deferred"]),V2=new Set(["done","canceled","rejected"]);function q0(e){return e==="discovery"?"in-progress":e==="draft"?"planned":e}function Y2(e){const a={planned:0,inProgress:0,waiting:0,blocked:0,deferred:0,done:0,canceled:0,rejected:0};for(const r of e)switch(r){case"planned":a.planned++;break;case"in-progress":a.inProgress++;break;case"waiting":a.waiting++;break;case"blocked":a.blocked++;break;case"deferred":a.deferred++;break;case"done":a.done++;break;case"canceled":a.canceled++;break;case"rejected":a.rejected++;break}return a}function G2(){return{planned:0,inProgress:0,waiting:0,blocked:0,deferred:0,done:0,canceled:0,rejected:0}}function P0(e){const a=e,r=Y2(a),s=a.length;if(s===0)return{displayStatus:"planned",breakdown:G2(),hasStarted:!1,totalChildren:0,meaningfulChildren:0};const u=a.filter(g=>g!=="canceled"&&g!=="rejected"),c=u.length,d=u.some(g=>g!=="planned");if(u.some(g=>P2.has(g)))return{displayStatus:"in-progress",breakdown:r,hasStarted:d,totalChildren:s,meaningfulChildren:c};if(a.every(g=>V2.has(g)))return a.every(g=>g==="done")?{displayStatus:"done",breakdown:r,hasStarted:d,totalChildren:s,meaningfulChildren:c}:a.every(g=>g==="canceled")?{displayStatus:"canceled",breakdown:r,hasStarted:d,totalChildren:s,meaningfulChildren:c}:a.every(g=>g==="rejected")?{displayStatus:"rejected",breakdown:r,hasStarted:d,totalChildren:s,meaningfulChildren:c}:{displayStatus:"closed",breakdown:r,hasStarted:d,totalChildren:s,meaningfulChildren:c};const h=u.filter(g=>F2.has(g));return h.length>0&&h.every(g=>g==="waiting")?{displayStatus:"waiting",breakdown:r,hasStarted:d,totalChildren:s,meaningfulChildren:c}:h.length>0&&h.every(g=>g==="blocked")?{displayStatus:"blocked",breakdown:r,hasStarted:d,totalChildren:s,meaningfulChildren:c}:h.length>0&&h.every(g=>g==="deferred")?{displayStatus:"deferred",breakdown:r,hasStarted:d,totalChildren:s,meaningfulChildren:c}:h.length>0&&h.every(g=>g==="planned")&&!d?{displayStatus:"planned",breakdown:r,hasStarted:d,totalChildren:s,meaningfulChildren:c}:{displayStatus:"started",breakdown:r,hasStarted:d,totalChildren:s,meaningfulChildren:c}}function tp(e){const a=e.map(r=>q0(r.status));return P0(a)}function np(e){const a=e.map(r=>q0(r.status));return P0(a)}function F0(e){return np(e)}function V0(e){return tp(e)}const Mo={key:"priority",direction:"asc"},X2=4200;function Q2(e){return e.reduce((a,r)=>a+r.tasks.length,0)}function K2(e){return e.reduce((a,r)=>a+r.tasks.filter(s=>s.status==="done").length,0)}function Z2(e){return String(e&&e>0?e:0).padStart(3,"0")}const W2={draft:0,discovery:1,planned:2,waiting:3,blocked:4,deferred:5,"in-progress":7,done:8,canceled:9,rejected:10};function Hy(e,a){if(a==="title")return"name"in e?e.name:e.title;if(a==="status")return W2[e.status]??99;if(a==="startedAt"){if("startedAt"in e){const r=e.startedAt;return r?new Date(r).getTime():Number.MAX_SAFE_INTEGER}return Number.MAX_SAFE_INTEGER}if(a==="completedAt"){if("completedAt"in e){const r=e.completedAt;return r?new Date(r).getTime():Number.MAX_SAFE_INTEGER}return Number.MAX_SAFE_INTEGER}if(a==="shortId")return e.shortId??"";if(a==="priority"||a==="number")return e[a]??0;if(a==="createdAt"||a==="updatedAt"){const r=e[a];return r?new Date(r).getTime():0}return 0}function Lo(e,a,r,s){const u=Hy(e,r),c=Hy(a,r);let d;return typeof u=="number"&&typeof c=="number"?d=u-c:d=String(u).localeCompare(String(c)),d===0&&(d=(e.priority??0)-(a.priority??0)||e.number-a.number||e.createdAt.localeCompare(a.createdAt)),s==="desc"?-d:d}function J2(e,a,r=Mo){const s=new Map;for(const u of a){if(!u.featureId)continue;const c=s.get(u.featureId)??[];c.push(u),s.set(u.featureId,c)}return e.map(u=>{const c=s.get(u.id)??[],d=c.reduce((v,y)=>v+y.tasks.length,0),h=c.reduce((v,y)=>v+y.tasks.filter(S=>S.status==="done").length,0),p=c.map(v=>{const y=[...v.tasks].sort((N,w)=>Lo(N,w,r.key,r.direction)),S=y.some(N=>N.status==="in-progress");return{phase:v,totalTasks:v.tasks.length,doneTasks:v.tasks.filter(N=>N.status==="done").length,allTasks:y,hasActiveTask:S,display:tp(y)}}),g=p.some(({phase:v,allTasks:y})=>v.status==="in-progress"||v.status==="discovery"||y.some(S=>S.status==="in-progress"));return{feature:u,totalTasks:d,doneTasks:h,allPhases:p.sort((v,y)=>Lo(v.phase,y.phase,r.key,r.direction)),hasActiveTask:p.some(v=>v.hasActiveTask),isActive:g,display:np(p.map(v=>v.phase))}}).sort((u,c)=>Lo(u.feature,c.feature,r.key,r.direction))}function ju({title:e,value:a,valueSuffix:r,subtitle:s,icon:u,valueClassName:c,iconClassName:d}){return i.jsxs(Gt,{className:"flex items-start justify-between gap-4",children:[i.jsxs("div",{className:"min-w-0",children:[i.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.22em] text-[var(--text-subtle)]",children:e}),i.jsxs("div",{className:"mt-2 flex items-end gap-2",children:[i.jsx("p",{className:`text-3xl font-black tracking-tight ${c??"text-[var(--text)]"}`,children:a}),r?i.jsx("span",{className:"pb-1 text-sm font-semibold text-[var(--text-muted)]",children:r}):null]}),i.jsx("p",{className:"mt-1 text-sm text-[var(--text-muted)]",children:s})]}),i.jsx("div",{className:`surface-card flex h-11 w-11 shrink-0 items-center justify-center rounded-2xl border border-[var(--border)] bg-[var(--accent-soft)] ${d??"text-[var(--accent)]"}`,children:u})]})}function qy(e){return e>=80?"text-emerald-600 dark:text-emerald-400":e>=30?"text-amber-600 dark:text-amber-400":"text-rose-600 dark:text-rose-400"}function ek({features:e,phases:a}){const r=new Map;for(const y of a)y.featureId&&r.set(y.featureId,[...r.get(y.featureId)??[],y]);const s=e.filter(y=>{const S=r.get(y.id)??[];return np(S).displayStatus==="done"}).length,u=Math.max(e.length-s,0),c=a.filter(y=>tp(y.tasks).displayStatus==="done").length,d=Math.max(a.length-c,0),h=Q2(a),p=K2(a),g=Math.max(h-p,0),v=h>0?Math.round(p/h*100):0;return i.jsxs("div",{className:"grid gap-4 lg:grid-cols-4",children:[i.jsx(ju,{title:"Features",value:String(e.length),valueSuffix:"total",subtitle:i.jsxs(i.Fragment,{children:[i.jsxs("span",{className:"font-semibold text-emerald-600 dark:text-emerald-400",children:[s," done"]}),i.jsx("span",{children:" · "}),i.jsxs("span",{className:"font-semibold text-amber-600 dark:text-amber-400",children:[u," left"]})]}),icon:i.jsx(Gu,{className:"h-4 w-4"})}),i.jsx(ju,{title:"Phases",value:String(a.length),valueSuffix:"total",subtitle:i.jsxs(i.Fragment,{children:[i.jsxs("span",{className:"font-semibold text-emerald-600 dark:text-emerald-400",children:[c," done"]}),i.jsx("span",{children:" · "}),i.jsxs("span",{className:"font-semibold text-amber-600 dark:text-amber-400",children:[d," left"]})]}),icon:i.jsx(Sj,{className:"h-4 w-4"})}),i.jsx(ju,{title:"Tasks",value:String(h),valueSuffix:"total",subtitle:i.jsxs(i.Fragment,{children:[i.jsxs("span",{className:"font-semibold text-emerald-600 dark:text-emerald-400",children:[p," done"]}),i.jsx("span",{children:" · "}),i.jsxs("span",{className:"font-semibold text-amber-600 dark:text-amber-400",children:[g," left"]})]}),icon:i.jsx(nc,{className:"h-4 w-4"})}),i.jsx(ju,{title:"Completion",value:`${v}%`,subtitle:"Task completion rate",valueClassName:qy(v),iconClassName:qy(v),icon:i.jsx(Fm,{className:"h-4 w-4"})})]})}const tk=["done","canceled","rejected"],nk=["planned","in-progress","blocked","waiting","deferred"],ak=1440*60*1e3,rk=10;function zo(e){return tk.includes(e)}function Ku(e){return nk.includes(e)}const Y0=[{label:"0-7d",minDays:0,maxDays:7},{label:"8-14d",minDays:8,maxDays:14},{label:"15-30d",minDays:15,maxDays:30},{label:"31-60d",minDays:31,maxDays:60},{label:"61+d",minDays:61,maxDays:null}];function lk(e){const a=[];for(const r of e)r.tasks&&a.push(...r.tasks);return a}function Il(e){if(!e)return null;const a=Date.parse(e);return Number.isNaN(a)?null:new Date(a).toISOString().slice(0,rk)}function xi(e){return Date.parse(`${e}T00:00:00.000Z`)}function G0(e,a){const r=Date.parse(e.date),s=Date.parse(a.date);return r!==s&&!Number.isNaN(r)&&!Number.isNaN(s)?r-s:e.id<a.id?-1:e.id>a.id?1:0}function sk(e,a){const r=Il(e.createdAt),s=xi(a),u=[...e.statusLog??[]].sort(G0);let c=null;for(const d of u){const h=zo(d.fromStatus);if(!zo(d.toStatus)&&h){const g=Il(d.date);g&&xi(g)<=s&&(c=g)}}return c??r}function Ru(e,a){return a>0?e/a:0}function ik(){return{deletedTasksNotRepresented:!0,legacyHistoryFallbackUsed:!1,notes:["Deleted tasks are absent from the current persisted planner files, so they never appear in any series, count, or backlog total."]}}function ok(){return Y0.map(e=>({...e,count:0,taskIds:[]}))}function Py(e,a){const r=e.filter(c=>c.kind==="added").length,s=e.filter(c=>c.kind==="closed").length,u=e.filter(c=>c.kind==="reopened").length;return{addedTotal:r,closedTotal:s,reopenedTotal:u,netBacklog:r+u-s,activeDays:a,addRatePerActiveDay:Ru(r,a),closeRatePerActiveDay:Ru(s,a),reopenRatePerActiveDay:Ru(u,a),closureRatio:Ru(s,r)}}function X0(e){return{currentOpen:e.filter(a=>Ku(a.status)).length,currentTotal:e.length,currentDone:e.filter(a=>a.status==="done").length,currentCanceled:e.filter(a=>a.status==="canceled").length,currentRejected:e.filter(a=>a.status==="rejected").length}}function ck(e,a,r){const s={addedTotal:0,closedTotal:0,reopenedTotal:0,netBacklog:0,activeDays:0,addRatePerActiveDay:0,closeRatePerActiveDay:0,reopenRatePerActiveDay:0,closureRatio:0};return{windowDays:e,asOf:null,calendarRange:null,dailyPoints:[],cumulativePoints:[],agingBuckets:ok(),summary:{...s,...X0(a)},allTime:s,currentOpenIds:a.filter(u=>Ku(u.status)).map(u=>u.id).sort(),windowAddedIds:[],windowClosedIds:[],windowReopenedIds:[],limitations:r}}function uk(e,a={}){const r=a.windowDays??21,s=ik(),u=new Set(s.notes),c=W=>{u.add(W),s.legacyHistoryFallbackUsed=!0},d=[];for(const W of e){const L=Il(W.createdAt);L&&d.push({day:L,kind:"added",taskId:W.id});const F=[...W.statusLog??[]].sort(G0);let fe=null;for(const se of F){const A=zo(se.fromStatus),I=zo(se.toStatus),K=Il(se.date);K&&(I&&!A?d.push({day:K,kind:"closed",taskId:W.id}):!I&&A&&d.push({day:K,kind:"reopened",taskId:W.id}),fe=I)}const P=zo(W.status);if(P&&fe!==!0){const se=Il(W.completedAt)??Il(W.updatedAt)??L;se&&d.push({day:se,kind:"closed",taskId:W.id}),c("A terminal task's history does not record a closure; a close was inferred from completedAt/updatedAt/createdAt.")}else if(!P&&fe===!0){const se=Il(W.updatedAt)??L;se&&d.push({day:se,kind:"reopened",taskId:W.id}),c("A task whose history ends in a terminal status is currently open; a reopen was inferred from updatedAt/createdAt.")}}if(d.length===0)return s.notes=[...u],ck(r,e,s);const h=d.map(W=>W.day).reduce((W,L)=>L>W?L:W),p=a.asOf&&Il(a.asOf)||h,g=xi(p),v=d.filter(W=>xi(W.day)<=g),y=[...new Set(v.map(W=>W.day))].sort(),S=new Map;for(const W of v){const L=S.get(W.day)??{added:0,closed:0,reopened:0,addedIds:new Set,closedIds:new Set,reopenedIds:new Set};W.kind==="added"?(L.added+=1,L.addedIds.add(W.taskId)):W.kind==="closed"?(L.closed+=1,L.closedIds.add(W.taskId)):(L.reopened+=1,L.reopenedIds.add(W.taskId)),S.set(W.day,L)}const N=[];let w=0,j=0,R=0;for(const W of y){const L=S.get(W)??{added:0,closed:0,reopened:0,addedIds:new Set,closedIds:new Set,reopenedIds:new Set};w+=L.added,j+=L.closed,R+=L.reopened;const F=j-R,fe=w+R-j;N.push({date:W,added:L.added,closed:L.closed,reopened:L.reopened,netBacklog:fe,cumulativeScope:w,cumulativeCompletion:F,addedTaskIds:[...L.addedIds].sort(),closedTaskIds:[...L.closedIds].sort(),reopenedTaskIds:[...L.reopenedIds].sort()})}const M=N.slice(Math.max(0,N.length-r)),$=new Set(M.map(W=>W.date)),B=v.filter(W=>$.has(W.day)),Y=M[0],ne=M[M.length-1],ae=Y&&ne?{start:Y.date,end:ne.date}:null,U=Y0.map(W=>({...W,count:0,taskIds:new Set}));for(const W of e){if(!Ku(W.status))continue;const L=sk(W,p);if(!L||xi(L)>g)continue;const F=Math.max(0,Math.floor((g-xi(L))/ak)),fe=U.find(P=>F>=P.minDays&&(P.maxDays===null||F<=P.maxDays));fe&&(fe.count+=1,fe.taskIds.add(W.id))}const k=U.map(W=>({...W,taskIds:[...W.taskIds].sort()})),re={...Py(B,M.length),...X0(e)},pe=Py(v,y.length),Se=e.filter(W=>Ku(W.status)).map(W=>W.id).sort(),ye=[...new Set(B.filter(W=>W.kind==="added").map(W=>W.taskId))].sort(),he=[...new Set(B.filter(W=>W.kind==="closed").map(W=>W.taskId))].sort(),je=[...new Set(B.filter(W=>W.kind==="reopened").map(W=>W.taskId))].sort();return r>y.length&&u.add(`Requested ${r}-active-day window exceeds the ${y.length} active days available at or before asOf; the window was clamped to all available active days.`),s.notes=[...u],{windowDays:r,asOf:p,calendarRange:ae,dailyPoints:M,cumulativePoints:N,agingBuckets:k,summary:re,allTime:pe,currentOpenIds:Se,windowAddedIds:ye,windowClosedIds:he,windowReopenedIds:je,limitations:s}}const Es=184,Ni=16,Zu=16,ap=30,ga=34;function Q0(e){return 420}function K0(e,a,r){const s=r-ga-Zu;return a<=1?ga+s/2:ga+e/(a-1)*s}function Fo(e,a){const r=Es-Ni-ap;return Ni+r-e/Math.max(a,1)*r}function Z0(e){return e<=3?new Set(Array.from({length:e},(a,r)=>r)):new Set([0,Math.floor((e-1)/2),e-1])}function W0(e){return e.slice(5)}function Vo({title:e,description:a,children:r}){return i.jsxs("article",{className:"min-w-0 max-w-full overflow-hidden [contain:inline-size] rounded-xl border border-[var(--border)] bg-[var(--surface-elevated)] p-3",children:[i.jsx("h3",{className:"text-sm font-bold text-[var(--text)]",children:e}),i.jsx("p",{className:"mt-0.5 text-xs text-[var(--text-muted)]",children:a}),i.jsx("div",{className:"mt-3",children:r})]})}function rl(e,a,r){return`${a} ${a===1?"task":"tasks"} ${e} on ${r}`}function dk({points:e,onSelect:a}){if(e.length===0)return i.jsx(Vo,{title:"Added vs Closed",description:"Task-flow events by active UTC day.",children:i.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:"No active-day flow data."})});const r=Q0(e.length),s=Math.max(1,...e.flatMap(p=>[p.added,p.closed])),u=Es-ap,c=(r-ga-Zu)/Math.max(e.length,1),d=Math.max(1.5,Math.min(10,c*.28)),h=Z0(e.length);return i.jsxs(Vo,{title:"Added vs Closed",description:"Solid bars are additions; striped bars are closures. Reopens and net change are available in the data table.",children:[i.jsxs("div",{className:"flex items-center gap-4 text-xs font-semibold text-[var(--text-muted)]","aria-hidden":"true",children:[i.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[i.jsx("span",{className:"h-2.5 w-4 rounded-sm bg-[var(--accent)]"}),"Added (solid)"]}),i.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[i.jsx("span",{className:"h-2.5 w-4 rounded-sm border border-[var(--text-muted)] bg-[repeating-linear-gradient(135deg,var(--text-muted)_0_1px,transparent_1px_3px)]"}),"Closed (striped)"]})]}),i.jsx("div",{className:"mt-2 w-full min-w-0 max-w-full overflow-x-auto [contain:inline-size] [scrollbar-width:thin] [&::-webkit-scrollbar]:h-1.5","data-responsive-chart":"horizontal-scroll",children:i.jsxs("svg",{width:"100%",viewBox:`0 0 ${r} ${Es}`,"data-coordinate-width":r,className:"block h-auto max-h-[184px] max-w-full",role:"img","aria-labelledby":"flow-chart-title flow-chart-desc",children:[i.jsx("title",{id:"flow-chart-title",children:"Added versus closed tasks by active UTC day"}),i.jsx("desc",{id:"flow-chart-desc",children:"Grouped bars use solid shapes for additions and striped shapes for closures. Exact values are provided in an accessible table."}),i.jsx("defs",{children:i.jsx("pattern",{id:"flow-closed-stripes",width:"4",height:"4",patternUnits:"userSpaceOnUse",patternTransform:"rotate(45)",children:i.jsx("line",{x1:"0",y1:"0",x2:"0",y2:"4",stroke:"currentColor",strokeWidth:"2"})})}),i.jsx("line",{x1:ga,y1:Ni,x2:ga,y2:u,stroke:"var(--border-strong)"}),i.jsx("line",{x1:ga,y1:u,x2:r-Zu,y2:u,stroke:"var(--border-strong)"}),i.jsx("text",{x:ga-6,y:Ni+4,textAnchor:"end",className:"fill-[var(--text-subtle)] text-[10px]",children:s}),i.jsx("text",{x:ga-6,y:u+4,textAnchor:"end",className:"fill-[var(--text-subtle)] text-[10px]",children:"0"}),e.map((p,g)=>{const v=ga+(g+.5)*c,y=Fo(p.added,s),S=Fo(p.closed,s);return i.jsxs("g",{children:[i.jsx("title",{children:`${p.date}: ${p.added} added, ${p.closed} closed, ${p.reopened} reopened, net backlog ${p.netBacklog}`}),a&&p.addedTaskIds.length>0?i.jsx("g",{role:"button",tabIndex:0,"aria-label":`Filter Work Tree to ${rl("added",p.addedTaskIds.length,p.date)}`,className:"cursor-pointer focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--accent)]",onClick:()=>a({key:`added:${p.date}`,label:rl("added",p.addedTaskIds.length,p.date),taskIds:p.addedTaskIds}),onKeyDown:N=>{N.key!=="Enter"&&N.key!==" "||(N.preventDefault(),a({key:`added:${p.date}`,label:rl("added",p.addedTaskIds.length,p.date),taskIds:p.addedTaskIds}))},children:i.jsx("rect",{x:v-d-1,y,width:d,height:Math.max(2,u-y),rx:"1.5",fill:"var(--accent)"})}):i.jsx("rect",{x:v-d-1,y,width:d,height:Math.max(0,u-y),rx:"1.5",fill:"var(--accent)"}),a&&p.closedTaskIds.length>0?i.jsx("g",{role:"button",tabIndex:0,"aria-label":`Filter Work Tree to ${rl("closed",p.closedTaskIds.length,p.date)}`,className:"cursor-pointer focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--accent)]",onClick:()=>a({key:`closed:${p.date}`,label:rl("closed",p.closedTaskIds.length,p.date),taskIds:p.closedTaskIds}),onKeyDown:N=>{N.key!=="Enter"&&N.key!==" "||(N.preventDefault(),a({key:`closed:${p.date}`,label:rl("closed",p.closedTaskIds.length,p.date),taskIds:p.closedTaskIds}))},children:i.jsx("rect",{x:v+1,y:S,width:d,height:Math.max(2,u-S),rx:"1.5",fill:"url(#flow-closed-stripes)",stroke:"var(--text-muted)",strokeWidth:"0.5"})}):i.jsx("rect",{x:v+1,y:S,width:d,height:Math.max(0,u-S),rx:"1.5",fill:"url(#flow-closed-stripes)",stroke:"var(--text-muted)",strokeWidth:"0.5"}),h.has(g)?i.jsx("text",{x:v,y:Es-9,textAnchor:"middle",className:"fill-[var(--text-subtle)] text-[10px]",children:W0(p.date)}):null]},p.date)})]})}),i.jsxs("details",{className:"mt-2 min-w-0 max-w-full overflow-hidden [contain:inline-size] text-xs text-[var(--text-muted)]",children:[i.jsx("summary",{className:"cursor-pointer font-semibold focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--accent)]",children:"View exact flow data"}),i.jsx("div",{className:"mt-2 w-full min-w-0 max-w-full overflow-x-auto [contain:inline-size] [scrollbar-width:thin] [&::-webkit-scrollbar]:h-1.5",children:i.jsxs("table",{className:"w-full table-fixed border-collapse text-left",children:[i.jsx("caption",{className:"sr-only",children:"Exact added, closed, reopened, and net backlog values by active UTC day"}),i.jsx("thead",{children:i.jsxs("tr",{className:"border-b border-[var(--border)]",children:[i.jsx("th",{className:"px-2 py-1",children:"Date"}),i.jsx("th",{className:"px-2 py-1",children:"Added"}),i.jsx("th",{className:"px-2 py-1",children:"Closed"}),i.jsx("th",{className:"px-2 py-1",children:"Reopened"}),i.jsx("th",{className:"px-2 py-1",children:"Net backlog"})]})}),i.jsx("tbody",{children:e.map(p=>i.jsxs("tr",{className:"border-b border-[var(--border)] last:border-0",children:[i.jsx("th",{className:"px-2 py-1 font-mono font-medium",children:p.date}),i.jsx("td",{className:"px-2 py-1",children:a&&p.addedTaskIds.length>0?i.jsx("button",{type:"button",className:"font-bold underline decoration-dotted underline-offset-2 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--accent)]",onClick:()=>a({key:`added:${p.date}`,label:rl("added",p.addedTaskIds.length,p.date),taskIds:p.addedTaskIds}),children:p.added}):p.added}),i.jsx("td",{className:"px-2 py-1",children:a&&p.closedTaskIds.length>0?i.jsx("button",{type:"button",className:"font-bold underline decoration-dotted underline-offset-2 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--accent)]",onClick:()=>a({key:`closed:${p.date}`,label:rl("closed",p.closedTaskIds.length,p.date),taskIds:p.closedTaskIds}),children:p.closed}):p.closed}),i.jsx("td",{className:"px-2 py-1",children:a&&p.reopenedTaskIds.length>0?i.jsx("button",{type:"button",className:"font-bold underline decoration-dotted underline-offset-2 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--accent)]",onClick:()=>a({key:`reopened:${p.date}`,label:rl("reopened",p.reopenedTaskIds.length,p.date),taskIds:p.reopenedTaskIds}),children:p.reopened}):p.reopened}),i.jsx("td",{className:"px-2 py-1",children:p.netBacklog})]},p.date))})]})})]})]})}function Fy(e,a,r,s){return e.map((u,c)=>`${c===0?"M":"L"} ${K0(c,e.length,a).toFixed(2)} ${Fo(Math.max(0,r(u)),s).toFixed(2)}`).join(" ")}function fk({points:e}){if(e.length===0)return i.jsx(Vo,{title:"Scope vs Completion",description:"Cumulative burn-up across the selected active days.",children:i.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:"No cumulative flow data."})});const a=Q0(e.length),r=Math.max(1,...e.flatMap(h=>[h.cumulativeScope,h.cumulativeCompletion])),s=Es-ap,u=Z0(e.length),c=Fy(e,a,h=>h.cumulativeScope,r),d=Fy(e,a,h=>h.cumulativeCompletion,r);return i.jsxs(Vo,{title:"Scope vs Completion",description:"The solid scope line and dashed completion line expose the open-backlog gap without relying on color.",children:[i.jsxs("div",{className:"flex items-center gap-4 text-xs font-semibold text-[var(--text-muted)]","aria-hidden":"true",children:[i.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[i.jsx("span",{className:"h-0.5 w-5 bg-[var(--accent)]"}),"Scope (solid)"]}),i.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[i.jsx("span",{className:"w-5 border-t-2 border-dashed border-[var(--color-status-done)]"}),"Completion (dashed)"]})]}),i.jsx("div",{className:"mt-2 w-full min-w-0 max-w-full overflow-x-auto [contain:inline-size] [scrollbar-width:thin] [&::-webkit-scrollbar]:h-1.5","data-responsive-chart":"horizontal-scroll",children:i.jsxs("svg",{width:"100%",viewBox:`0 0 ${a} ${Es}`,"data-coordinate-width":a,className:"block h-auto max-h-[184px] max-w-full",role:"img","aria-labelledby":"burnup-chart-title burnup-chart-desc",children:[i.jsx("title",{id:"burnup-chart-title",children:"Cumulative scope versus completion"}),i.jsx("desc",{id:"burnup-chart-desc",children:"A solid scope line and dashed completion line show the cumulative open-backlog gap. Exact values are provided in an accessible table."}),i.jsx("line",{x1:ga,y1:Ni,x2:ga,y2:s,stroke:"var(--border-strong)"}),i.jsx("line",{x1:ga,y1:s,x2:a-Zu,y2:s,stroke:"var(--border-strong)"}),i.jsx("text",{x:ga-6,y:Ni+4,textAnchor:"end",className:"fill-[var(--text-subtle)] text-[10px]",children:r}),i.jsx("text",{x:ga-6,y:s+4,textAnchor:"end",className:"fill-[var(--text-subtle)] text-[10px]",children:"0"}),i.jsx("path",{d:c,fill:"none",stroke:"var(--accent)",strokeWidth:"2.5"}),i.jsx("path",{d,fill:"none",stroke:"var(--color-status-done)",strokeWidth:"2.5",strokeDasharray:"6 4"}),e.map((h,p)=>{const g=K0(p,e.length,a);return i.jsxs("g",{children:[i.jsx("title",{children:`${h.date}: cumulative scope ${h.cumulativeScope}, cumulative completion ${h.cumulativeCompletion}, open backlog ${h.netBacklog}`}),i.jsx("circle",{cx:g,cy:Fo(h.cumulativeScope,r),r:"2.5",fill:"var(--accent)"}),i.jsx("rect",{x:g-2.5,y:Fo(Math.max(0,h.cumulativeCompletion),r)-2.5,width:"5",height:"5",fill:"var(--color-status-done)"}),u.has(p)?i.jsx("text",{x:g,y:Es-9,textAnchor:"middle",className:"fill-[var(--text-subtle)] text-[10px]",children:W0(h.date)}):null]},h.date)})]})}),i.jsx("div",{className:"sr-only",children:i.jsxs("table",{children:[i.jsx("caption",{children:"Exact cumulative scope, completion, and open backlog values by active UTC day"}),i.jsx("thead",{children:i.jsxs("tr",{children:[i.jsx("th",{children:"Date"}),i.jsx("th",{children:"Scope"}),i.jsx("th",{children:"Completion"}),i.jsx("th",{children:"Open backlog"})]})}),i.jsx("tbody",{children:e.map(h=>i.jsxs("tr",{children:[i.jsx("th",{children:h.date}),i.jsx("td",{children:h.cumulativeScope}),i.jsx("td",{children:h.cumulativeCompletion}),i.jsx("td",{children:h.netBacklog})]},h.date))})]})})]})}function hk({analytics:e,onSelect:a}){const r=Math.max(1,...e.agingBuckets.map(u=>u.count)),s=e.agingBuckets.reduce((u,c)=>u+c.count,0);return i.jsxs(Vo,{title:"Open-task aging",description:"Whole UTC days since creation or the latest reopen.",children:[s===0?i.jsx("p",{className:"mb-3 text-sm text-[var(--text-muted)]",children:"No open tasks have an aging anchor at this cutoff."}):null,i.jsx("ul",{className:"grid gap-2","aria-label":"Open-task aging buckets",children:e.agingBuckets.map(u=>{const c=i.jsxs(i.Fragment,{children:[i.jsx("span",{className:"font-semibold text-[var(--text-muted)]",children:u.label}),i.jsx("span",{className:"h-3 overflow-hidden rounded-full border border-[var(--border)] bg-[var(--surface-card)]",children:i.jsx("span",{className:"block h-full rounded-full bg-[var(--accent)]",style:{width:`${u.count/r*100}%`}})}),i.jsx("span",{className:"text-right font-bold tabular-nums text-[var(--text)]","aria-label":`${u.count} tasks`,children:u.count})]});return i.jsx("li",{children:a&&u.taskIds.length>0?i.jsx("button",{type:"button",className:"grid w-full grid-cols-[3.75rem_minmax(0,1fr)_2rem] items-center gap-2 rounded-lg text-xs hover:bg-[var(--accent-soft)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--accent)]","aria-label":`Filter Work Tree to ${u.count} ${u.count===1?"task":"tasks"} aged ${u.label}`,onClick:()=>a({key:`aging:${u.label}`,label:`${u.count} ${u.count===1?"task":"tasks"} aged ${u.label}`,taskIds:u.taskIds}),children:c}):i.jsx("div",{className:"grid grid-cols-[3.75rem_minmax(0,1fr)_2rem] items-center gap-2 text-xs",children:c})},u.label)})}),i.jsx("div",{className:"sr-only",children:i.jsxs("table",{children:[i.jsx("caption",{children:"Exact open-task aging bucket counts"}),i.jsx("thead",{children:i.jsxs("tr",{children:[i.jsx("th",{children:"Age"}),i.jsx("th",{children:"Open tasks"})]})}),i.jsx("tbody",{children:e.agingBuckets.map(u=>i.jsxs("tr",{children:[i.jsx("th",{children:u.label}),i.jsx("td",{children:u.count})]},u.label))})]})})]})}function mk({analytics:e,onSelect:a}){const r=a?{onSelect:a}:{};return i.jsxs("div",{className:"grid min-w-0 max-w-full overflow-hidden gap-3 xl:grid-cols-2",children:[i.jsx(dk,{points:e.dailyPoints,...r}),i.jsx(fk,{points:e.dailyPoints}),i.jsx("div",{className:"min-w-0 xl:col-span-2",children:i.jsx(hk,{analytics:e,...r})})]})}const pk=[7,21,60];function gk(e){return e>0?`+${e}`:String(e)}function ku(e){return e.toFixed(1)}function xk(e){return`${(e*100).toFixed(0)}%`}function vk(e){const{netBacklog:a,activeDays:r}=e.summary;if(r===0)return"No task-flow activity is recorded for this period.";if(a>0)return`Backlog grew by ${a} ${a===1?"task":"tasks"} across the selected active days.`;if(a<0){const s=Math.abs(a);return`Backlog shrank by ${s} ${s===1?"task":"tasks"} across the selected active days.`}return"Backlog stayed level across the selected active days."}function yk({value:e}){return e>0?i.jsx(yj,{className:"h-4 w-4","aria-hidden":"true"}):e<0?i.jsx(fj,{className:"h-4 w-4","aria-hidden":"true"}):i.jsx(aR,{className:"h-4 w-4","aria-hidden":"true"})}function ys({label:e,value:a,detail:r,valueClassName:s="text-[var(--text)]",onSelect:u,selected:c}){return i.jsxs("div",{className:`min-w-28 rounded-xl border bg-[var(--surface-elevated)] px-3 py-2.5 ${c?"border-[var(--accent)] ring-1 ring-[var(--accent)]":"border-[var(--border)]"}`,children:[i.jsx("dt",{className:"text-[11px] font-semibold uppercase tracking-[0.16em] text-[var(--text-subtle)]",children:e}),i.jsx("dd",{className:`mt-1 text-xl font-black tracking-tight ${s}`,children:u?i.jsx("button",{type:"button","aria-pressed":c,"aria-label":`Filter Work Tree by ${e}`,onClick:u,className:"rounded-md underline decoration-dotted underline-offset-2 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--accent)]",children:a}):a}),r?i.jsx("p",{className:"mt-0.5 text-xs text-[var(--text-muted)]",children:r}):null]})}function bk({phases:e,asOf:a,activeDrilldown:r,onDrilldown:s,onClearDrilldown:u}){const[c,d]=x.useState(21),h=x.useMemo(()=>lk(e),[e]),p=a??new Date().toISOString().slice(0,10),g=x.useMemo(()=>uk(h,{windowDays:c,asOf:p}),[p,h,c]),v=g.summary.netBacklog>0?"text-rose-600 dark:text-rose-400":g.summary.netBacklog<0?"text-emerald-600 dark:text-emerald-400":"text-[var(--text)]",y=g.limitations.notes.join(" "),S=(N,w,j)=>s&&j.length>0?()=>s({key:N,label:w,taskIds:j}):null;return i.jsx(Gt,{className:"min-w-0 overflow-hidden [contain:inline-size]",children:i.jsxs("section",{"aria-labelledby":"flow-backlog-heading",className:"grid min-w-0 max-w-full gap-4",children:[i.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[i.jsxs("div",{className:"min-w-0",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(uj,{className:"h-4 w-4 text-[var(--accent)]","aria-hidden":"true"}),i.jsx("h2",{id:"flow-backlog-heading",className:"text-lg font-bold text-[var(--text)]",children:"Flow & Backlog"})]}),i.jsx("p",{className:"mt-1 text-sm text-[var(--text-muted)]","aria-live":"polite",children:vk(g)})]}),i.jsx("div",{role:"group","aria-label":"Active-day period",className:"flex w-full min-w-0 items-center gap-1 overflow-x-auto [contain:inline-size] sm:w-auto sm:max-w-full sm:shrink-0 rounded-xl border border-[var(--border)] bg-[var(--surface-card)] p-1 [scrollbar-width:thin] [&::-webkit-scrollbar]:h-1.5",children:pk.map(N=>i.jsxs("button",{type:"button","aria-label":`${N} active days`,"aria-pressed":c===N,onClick:()=>d(N),className:`h-8 shrink-0 rounded-lg px-2.5 text-xs font-bold transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--accent)] focus-visible:ring-offset-1 focus-visible:ring-offset-[var(--surface)] ${c===N?"bg-[var(--accent)] text-white":"text-[var(--text-muted)] hover:bg-[var(--accent-soft)] hover:text-[var(--text)]"}`,children:[i.jsx("span",{children:N}),i.jsx("span",{className:"hidden sm:inline",children:" active days"})]},N))})]}),i.jsx("p",{className:"text-xs text-[var(--text-subtle)]",children:g.calendarRange?i.jsxs(i.Fragment,{children:[i.jsx("span",{children:"UTC range "}),i.jsx("time",{dateTime:g.calendarRange.start,children:g.calendarRange.start}),i.jsx("span",{children:" – "}),i.jsx("time",{dateTime:g.calendarRange.end,children:g.calendarRange.end}),i.jsxs("span",{children:[" · ",g.summary.activeDays," active ",g.summary.activeDays===1?"day":"days"]})]}):"No UTC activity range is available."}),i.jsxs("dl",{className:"grid min-w-0 grid-cols-2 gap-2 sm:grid-cols-3 lg:grid-cols-4 xl:grid-cols-8",children:[i.jsx(ys,{label:"Added",value:String(g.summary.addedTotal),detail:`${ku(g.summary.addRatePerActiveDay)} / active day`,onSelect:S("window-added",`${g.windowAddedIds.length} ${g.windowAddedIds.length===1?"task":"tasks"} added in the selected window`,g.windowAddedIds),selected:(r==null?void 0:r.key)==="window-added"}),i.jsx(ys,{label:"Closed",value:String(g.summary.closedTotal),detail:`${ku(g.summary.closeRatePerActiveDay)} / active day`,onSelect:S("window-closed",`${g.windowClosedIds.length} ${g.windowClosedIds.length===1?"task":"tasks"} closed in the selected window`,g.windowClosedIds),selected:(r==null?void 0:r.key)==="window-closed"}),g.summary.reopenedTotal>0?i.jsx(ys,{label:"Reopened",value:String(g.summary.reopenedTotal),onSelect:S("window-reopened",`${g.windowReopenedIds.length} ${g.windowReopenedIds.length===1?"task":"tasks"} reopened in the selected window`,g.windowReopenedIds),selected:(r==null?void 0:r.key)==="window-reopened"}):null,i.jsxs("div",{className:"min-w-28 rounded-xl border border-[var(--border)] bg-[var(--surface-elevated)] px-3 py-2.5",children:[i.jsx("dt",{className:"text-[11px] font-semibold uppercase tracking-[0.16em] text-[var(--text-subtle)]",children:"Net change"}),i.jsxs("dd",{className:`mt-1 flex items-center gap-1 text-xl font-black tracking-tight ${v}`,children:[i.jsx(yk,{value:g.summary.netBacklog}),gk(g.summary.netBacklog)]})]}),i.jsx(ys,{label:"Open now",value:String(g.summary.currentOpen),detail:`${g.summary.currentTotal} total`,onSelect:S("current-open",`${g.currentOpenIds.length} currently open ${g.currentOpenIds.length===1?"task":"tasks"}`,g.currentOpenIds),selected:(r==null?void 0:r.key)==="current-open"}),i.jsx(ys,{label:"Add rate",value:ku(g.summary.addRatePerActiveDay),detail:"per active day",onSelect:null,selected:!1}),i.jsx(ys,{label:"Close rate",value:ku(g.summary.closeRatePerActiveDay),detail:"per active day",onSelect:null,selected:!1}),i.jsx(ys,{label:"Closure ratio",value:xk(g.summary.closureRatio),detail:"closed / added",onSelect:null,selected:!1})]}),i.jsx(mk,{analytics:g,...s?{onSelect:s}:{}}),r?i.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2 rounded-xl border border-[var(--accent)] bg-[var(--accent-soft)] px-3 py-2 text-sm",role:"status",children:[i.jsxs("span",{className:"font-semibold text-[var(--text)]",children:["Work Tree filter: ",r.label]}),u?i.jsx("button",{type:"button",onClick:u,className:"rounded-lg px-2 py-1 text-xs font-bold text-[var(--accent)] underline decoration-dotted underline-offset-2 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--accent)]",children:"Clear analytics filter"}):null]}):null,i.jsx("p",{className:"text-xs text-[var(--text-subtle)]",title:y,children:"Current planner files exclude deleted tasks; legacy gaps are inferred from available timestamps."})]})})}function wk(){for(var e=arguments.length,a=new Array(e),r=0;r<e;r++)a[r]=arguments[r];return x.useMemo(()=>s=>{a.forEach(u=>u(s))},a)}const Nd=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Ri(e){const a=Object.prototype.toString.call(e);return a==="[object Window]"||a==="[object global]"}function rp(e){return"nodeType"in e}function xa(e){var a,r;return e?Ri(e)?e:rp(e)&&(a=(r=e.ownerDocument)==null?void 0:r.defaultView)!=null?a:window:window}function lp(e){const{Document:a}=xa(e);return e instanceof a}function lc(e){return Ri(e)?!1:e instanceof xa(e).HTMLElement}function J0(e){return e instanceof xa(e).SVGElement}function ki(e){return e?Ri(e)?e.document:rp(e)?lp(e)?e:lc(e)||J0(e)?e.ownerDocument:document:document:document}const mr=Nd?x.useLayoutEffect:x.useEffect;function Ed(e){const a=x.useRef(e);return mr(()=>{a.current=e}),x.useCallback(function(){for(var r=arguments.length,s=new Array(r),u=0;u<r;u++)s[u]=arguments[u];return a.current==null?void 0:a.current(...s)},[])}function Sk(){const e=x.useRef(null),a=x.useCallback((s,u)=>{e.current=setInterval(s,u)},[]),r=x.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[a,r]}function Yo(e,a){a===void 0&&(a=[e]);const r=x.useRef(e);return mr(()=>{r.current!==e&&(r.current=e)},a),r}function sc(e,a){const r=x.useRef();return x.useMemo(()=>{const s=e(r.current);return r.current=s,s},[...a])}function Wu(e){const a=Ed(e),r=x.useRef(null),s=x.useCallback(u=>{u!==r.current&&(a==null||a(u,r.current)),r.current=u},[]);return[r,s]}function Ju(e){const a=x.useRef();return x.useEffect(()=>{a.current=e},[e]),a.current}let Yh={};function ic(e,a){return x.useMemo(()=>{if(a)return a;const r=Yh[e]==null?0:Yh[e]+1;return Yh[e]=r,e+"-"+r},[e,a])}function ew(e){return function(a){for(var r=arguments.length,s=new Array(r>1?r-1:0),u=1;u<r;u++)s[u-1]=arguments[u];return s.reduce((c,d)=>{const h=Object.entries(d);for(const[p,g]of h){const v=c[p];v!=null&&(c[p]=v+e*g)}return c},{...a})}}const bi=ew(1),ed=ew(-1);function Nk(e){return"clientX"in e&&"clientY"in e}function jd(e){if(!e)return!1;const{KeyboardEvent:a}=xa(e.target);return a&&e instanceof a}function Ek(e){if(!e)return!1;const{TouchEvent:a}=xa(e.target);return a&&e instanceof a}function td(e){if(Ek(e)){if(e.touches&&e.touches.length){const{clientX:a,clientY:r}=e.touches[0];return{x:a,y:r}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:a,clientY:r}=e.changedTouches[0];return{x:a,y:r}}}return Nk(e)?{x:e.clientX,y:e.clientY}:null}const Yl=Object.freeze({Translate:{toString(e){if(!e)return;const{x:a,y:r}=e;return"translate3d("+(a?Math.round(a):0)+"px, "+(r?Math.round(r):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:a,scaleY:r}=e;return"scaleX("+a+") scaleY("+r+")"}},Transform:{toString(e){if(e)return[Yl.Translate.toString(e),Yl.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:a,duration:r,easing:s}=e;return a+" "+r+"ms "+s}}}),Vy="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function jk(e){return e.matches(Vy)?e:e.querySelector(Vy)}const Rk={display:"none"};function kk(e){let{id:a,value:r}=e;return hn.createElement("div",{id:a,style:Rk},r)}function Tk(e){let{id:a,announcement:r,ariaLiveType:s="assertive"}=e;const u={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return hn.createElement("div",{id:a,style:u,role:"status","aria-live":s,"aria-atomic":!0},r)}function Ak(){const[e,a]=x.useState("");return{announce:x.useCallback(s=>{s!=null&&a(s)},[]),announcement:e}}const tw=x.createContext(null);function Dk(e){const a=x.useContext(tw);x.useEffect(()=>{if(!a)throw new Error("useDndMonitor must be used within a children of <DndContext>");return a(e)},[e,a])}function Ck(){const[e]=x.useState(()=>new Set),a=x.useCallback(s=>(e.add(s),()=>e.delete(s)),[e]);return[x.useCallback(s=>{let{type:u,event:c}=s;e.forEach(d=>{var h;return(h=d[u])==null?void 0:h.call(d,c)})},[e]),a]}const Ok={draggable:`
309
- To pick up a draggable item, press the space bar.
310
- While dragging, use the arrow keys to move the item.
311
- Press space again to drop the item in its new position, or press escape to cancel.
312
- `},Mk={onDragStart(e){let{active:a}=e;return"Picked up draggable item "+a.id+"."},onDragOver(e){let{active:a,over:r}=e;return r?"Draggable item "+a.id+" was moved over droppable area "+r.id+".":"Draggable item "+a.id+" is no longer over a droppable area."},onDragEnd(e){let{active:a,over:r}=e;return r?"Draggable item "+a.id+" was dropped over droppable area "+r.id:"Draggable item "+a.id+" was dropped."},onDragCancel(e){let{active:a}=e;return"Dragging was cancelled. Draggable item "+a.id+" was dropped."}};function _k(e){let{announcements:a=Mk,container:r,hiddenTextDescribedById:s,screenReaderInstructions:u=Ok}=e;const{announce:c,announcement:d}=Ak(),h=ic("DndLiveRegion"),[p,g]=x.useState(!1);if(x.useEffect(()=>{g(!0)},[]),Dk(x.useMemo(()=>({onDragStart(y){let{active:S}=y;c(a.onDragStart({active:S}))},onDragMove(y){let{active:S,over:N}=y;a.onDragMove&&c(a.onDragMove({active:S,over:N}))},onDragOver(y){let{active:S,over:N}=y;c(a.onDragOver({active:S,over:N}))},onDragEnd(y){let{active:S,over:N}=y;c(a.onDragEnd({active:S,over:N}))},onDragCancel(y){let{active:S,over:N}=y;c(a.onDragCancel({active:S,over:N}))}}),[c,a])),!p)return null;const v=hn.createElement(hn.Fragment,null,hn.createElement(kk,{id:s,value:u.draggable}),hn.createElement(Tk,{id:h,announcement:d}));return r?il.createPortal(v,r):v}var Hn;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(Hn||(Hn={}));function nd(){}function Lk(e,a){return x.useMemo(()=>({sensor:e,options:a??{}}),[e,a])}function zk(){for(var e=arguments.length,a=new Array(e),r=0;r<e;r++)a[r]=arguments[r];return x.useMemo(()=>[...a].filter(s=>s!=null),[...a])}const pr=Object.freeze({x:0,y:0});function $k(e,a){return Math.sqrt(Math.pow(e.x-a.x,2)+Math.pow(e.y-a.y,2))}function Uk(e,a){const r=td(e);if(!r)return"0 0";const s={x:(r.x-a.left)/a.width*100,y:(r.y-a.top)/a.height*100};return s.x+"% "+s.y+"%"}function Bk(e,a){let{data:{value:r}}=e,{data:{value:s}}=a;return r-s}function Ik(e,a){let{data:{value:r}}=e,{data:{value:s}}=a;return s-r}function Hk(e,a){if(!e||e.length===0)return null;const[r]=e;return r[a]}function Yy(e,a,r){return a===void 0&&(a=e.left),r===void 0&&(r=e.top),{x:a+e.width*.5,y:r+e.height*.5}}const qk=e=>{let{collisionRect:a,droppableRects:r,droppableContainers:s}=e;const u=Yy(a,a.left,a.top),c=[];for(const d of s){const{id:h}=d,p=r.get(h);if(p){const g=$k(Yy(p),u);c.push({id:h,data:{droppableContainer:d,value:g}})}}return c.sort(Bk)};function Pk(e,a){const r=Math.max(a.top,e.top),s=Math.max(a.left,e.left),u=Math.min(a.left+a.width,e.left+e.width),c=Math.min(a.top+a.height,e.top+e.height),d=u-s,h=c-r;if(s<u&&r<c){const p=a.width*a.height,g=e.width*e.height,v=d*h,y=v/(p+g-v);return Number(y.toFixed(4))}return 0}const Fk=e=>{let{collisionRect:a,droppableRects:r,droppableContainers:s}=e;const u=[];for(const c of s){const{id:d}=c,h=r.get(d);if(h){const p=Pk(h,a);p>0&&u.push({id:d,data:{droppableContainer:c,value:p}})}}return u.sort(Ik)};function Vk(e,a,r){return{...e,scaleX:a&&r?a.width/r.width:1,scaleY:a&&r?a.height/r.height:1}}function nw(e,a){return e&&a?{x:e.left-a.left,y:e.top-a.top}:pr}function Yk(e){return function(r){for(var s=arguments.length,u=new Array(s>1?s-1:0),c=1;c<s;c++)u[c-1]=arguments[c];return u.reduce((d,h)=>({...d,top:d.top+e*h.y,bottom:d.bottom+e*h.y,left:d.left+e*h.x,right:d.right+e*h.x}),{...r})}}const Gk=Yk(1);function aw(e){if(e.startsWith("matrix3d(")){const a=e.slice(9,-1).split(/, /);return{x:+a[12],y:+a[13],scaleX:+a[0],scaleY:+a[5]}}else if(e.startsWith("matrix(")){const a=e.slice(7,-1).split(/, /);return{x:+a[4],y:+a[5],scaleX:+a[0],scaleY:+a[3]}}return null}function Xk(e,a,r){const s=aw(a);if(!s)return e;const{scaleX:u,scaleY:c,x:d,y:h}=s,p=e.left-d-(1-u)*parseFloat(r),g=e.top-h-(1-c)*parseFloat(r.slice(r.indexOf(" ")+1)),v=u?e.width/u:e.width,y=c?e.height/c:e.height;return{width:v,height:y,top:g,right:p+v,bottom:g+y,left:p}}const Qk={ignoreTransform:!1};function Ti(e,a){a===void 0&&(a=Qk);let r=e.getBoundingClientRect();if(a.ignoreTransform){const{transform:g,transformOrigin:v}=xa(e).getComputedStyle(e);g&&(r=Xk(r,g,v))}const{top:s,left:u,width:c,height:d,bottom:h,right:p}=r;return{top:s,left:u,width:c,height:d,bottom:h,right:p}}function Gy(e){return Ti(e,{ignoreTransform:!0})}function Kk(e){const a=e.innerWidth,r=e.innerHeight;return{top:0,left:0,right:a,bottom:r,width:a,height:r}}function Zk(e,a){return a===void 0&&(a=xa(e).getComputedStyle(e)),a.position==="fixed"}function Wk(e,a){a===void 0&&(a=xa(e).getComputedStyle(e));const r=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(u=>{const c=a[u];return typeof c=="string"?r.test(c):!1})}function sp(e,a){const r=[];function s(u){if(a!=null&&r.length>=a||!u)return r;if(lp(u)&&u.scrollingElement!=null&&!r.includes(u.scrollingElement))return r.push(u.scrollingElement),r;if(!lc(u)||J0(u)||r.includes(u))return r;const c=xa(e).getComputedStyle(u);return u!==e&&Wk(u,c)&&r.push(u),Zk(u,c)?r:s(u.parentNode)}return e?s(e):r}function rw(e){const[a]=sp(e,1);return a??null}function Gh(e){return!Nd||!e?null:Ri(e)?e:rp(e)?lp(e)||e===ki(e).scrollingElement?window:lc(e)?e:null:null}function lw(e){return Ri(e)?e.scrollX:e.scrollLeft}function sw(e){return Ri(e)?e.scrollY:e.scrollTop}function Nm(e){return{x:lw(e),y:sw(e)}}var Xn;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(Xn||(Xn={}));function iw(e){return!Nd||!e?!1:e===document.scrollingElement}function ow(e){const a={x:0,y:0},r=iw(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},s={x:e.scrollWidth-r.width,y:e.scrollHeight-r.height},u=e.scrollTop<=a.y,c=e.scrollLeft<=a.x,d=e.scrollTop>=s.y,h=e.scrollLeft>=s.x;return{isTop:u,isLeft:c,isBottom:d,isRight:h,maxScroll:s,minScroll:a}}const Jk={x:.2,y:.2};function eT(e,a,r,s,u){let{top:c,left:d,right:h,bottom:p}=r;s===void 0&&(s=10),u===void 0&&(u=Jk);const{isTop:g,isBottom:v,isLeft:y,isRight:S}=ow(e),N={x:0,y:0},w={x:0,y:0},j={height:a.height*u.y,width:a.width*u.x};return!g&&c<=a.top+j.height?(N.y=Xn.Backward,w.y=s*Math.abs((a.top+j.height-c)/j.height)):!v&&p>=a.bottom-j.height&&(N.y=Xn.Forward,w.y=s*Math.abs((a.bottom-j.height-p)/j.height)),!S&&h>=a.right-j.width?(N.x=Xn.Forward,w.x=s*Math.abs((a.right-j.width-h)/j.width)):!y&&d<=a.left+j.width&&(N.x=Xn.Backward,w.x=s*Math.abs((a.left+j.width-d)/j.width)),{direction:N,speed:w}}function tT(e){if(e===document.scrollingElement){const{innerWidth:c,innerHeight:d}=window;return{top:0,left:0,right:c,bottom:d,width:c,height:d}}const{top:a,left:r,right:s,bottom:u}=e.getBoundingClientRect();return{top:a,left:r,right:s,bottom:u,width:e.clientWidth,height:e.clientHeight}}function cw(e){return e.reduce((a,r)=>bi(a,Nm(r)),pr)}function nT(e){return e.reduce((a,r)=>a+lw(r),0)}function aT(e){return e.reduce((a,r)=>a+sw(r),0)}function uw(e,a){if(a===void 0&&(a=Ti),!e)return;const{top:r,left:s,bottom:u,right:c}=a(e);rw(e)&&(u<=0||c<=0||r>=window.innerHeight||s>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const rT=[["x",["left","right"],nT],["y",["top","bottom"],aT]];class ip{constructor(a,r){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const s=sp(r),u=cw(s);this.rect={...a},this.width=a.width,this.height=a.height;for(const[c,d,h]of rT)for(const p of d)Object.defineProperty(this,p,{get:()=>{const g=h(s),v=u[c]-g;return this.rect[p]+v},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class $o{constructor(a){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(r=>{var s;return(s=this.target)==null?void 0:s.removeEventListener(...r)})},this.target=a}add(a,r,s){var u;(u=this.target)==null||u.addEventListener(a,r,s),this.listeners.push([a,r,s])}}function lT(e){const{EventTarget:a}=xa(e);return e instanceof a?e:ki(e)}function Xh(e,a){const r=Math.abs(e.x),s=Math.abs(e.y);return typeof a=="number"?Math.sqrt(r**2+s**2)>a:"x"in a&&"y"in a?r>a.x&&s>a.y:"x"in a?r>a.x:"y"in a?s>a.y:!1}var tr;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(tr||(tr={}));function Xy(e){e.preventDefault()}function sT(e){e.stopPropagation()}var zt;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(zt||(zt={}));const dw={start:[zt.Space,zt.Enter],cancel:[zt.Esc],end:[zt.Space,zt.Enter,zt.Tab]},iT=(e,a)=>{let{currentCoordinates:r}=a;switch(e.code){case zt.Right:return{...r,x:r.x+25};case zt.Left:return{...r,x:r.x-25};case zt.Down:return{...r,y:r.y+25};case zt.Up:return{...r,y:r.y-25}}};class fw{constructor(a){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=a;const{event:{target:r}}=a;this.props=a,this.listeners=new $o(ki(r)),this.windowListeners=new $o(xa(r)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(tr.Resize,this.handleCancel),this.windowListeners.add(tr.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(tr.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:a,onStart:r}=this.props,s=a.node.current;s&&uw(s),r(pr)}handleKeyDown(a){if(jd(a)){const{active:r,context:s,options:u}=this.props,{keyboardCodes:c=dw,coordinateGetter:d=iT,scrollBehavior:h="smooth"}=u,{code:p}=a;if(c.end.includes(p)){this.handleEnd(a);return}if(c.cancel.includes(p)){this.handleCancel(a);return}const{collisionRect:g}=s.current,v=g?{x:g.left,y:g.top}:pr;this.referenceCoordinates||(this.referenceCoordinates=v);const y=d(a,{active:r,context:s.current,currentCoordinates:v});if(y){const S=ed(y,v),N={x:0,y:0},{scrollableAncestors:w}=s.current;for(const j of w){const R=a.code,{isTop:M,isRight:$,isLeft:B,isBottom:Y,maxScroll:ne,minScroll:ae}=ow(j),U=tT(j),k={x:Math.min(R===zt.Right?U.right-U.width/2:U.right,Math.max(R===zt.Right?U.left:U.left+U.width/2,y.x)),y:Math.min(R===zt.Down?U.bottom-U.height/2:U.bottom,Math.max(R===zt.Down?U.top:U.top+U.height/2,y.y))},re=R===zt.Right&&!$||R===zt.Left&&!B,pe=R===zt.Down&&!Y||R===zt.Up&&!M;if(re&&k.x!==y.x){const Se=j.scrollLeft+S.x,ye=R===zt.Right&&Se<=ne.x||R===zt.Left&&Se>=ae.x;if(ye&&!S.y){j.scrollTo({left:Se,behavior:h});return}ye?N.x=j.scrollLeft-Se:N.x=R===zt.Right?j.scrollLeft-ne.x:j.scrollLeft-ae.x,N.x&&j.scrollBy({left:-N.x,behavior:h});break}else if(pe&&k.y!==y.y){const Se=j.scrollTop+S.y,ye=R===zt.Down&&Se<=ne.y||R===zt.Up&&Se>=ae.y;if(ye&&!S.x){j.scrollTo({top:Se,behavior:h});return}ye?N.y=j.scrollTop-Se:N.y=R===zt.Down?j.scrollTop-ne.y:j.scrollTop-ae.y,N.y&&j.scrollBy({top:-N.y,behavior:h});break}}this.handleMove(a,bi(ed(y,this.referenceCoordinates),N))}}}handleMove(a,r){const{onMove:s}=this.props;a.preventDefault(),s(r)}handleEnd(a){const{onEnd:r}=this.props;a.preventDefault(),this.detach(),r()}handleCancel(a){const{onCancel:r}=this.props;a.preventDefault(),this.detach(),r()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}fw.activators=[{eventName:"onKeyDown",handler:(e,a,r)=>{let{keyboardCodes:s=dw,onActivation:u}=a,{active:c}=r;const{code:d}=e.nativeEvent;if(s.start.includes(d)){const h=c.activatorNode.current;return h&&e.target!==h?!1:(e.preventDefault(),u==null||u({event:e.nativeEvent}),!0)}return!1}}];function Qy(e){return!!(e&&"distance"in e)}function Ky(e){return!!(e&&"delay"in e)}class op{constructor(a,r,s){var u;s===void 0&&(s=lT(a.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=a,this.events=r;const{event:c}=a,{target:d}=c;this.props=a,this.events=r,this.document=ki(d),this.documentListeners=new $o(this.document),this.listeners=new $o(s),this.windowListeners=new $o(xa(d)),this.initialCoordinates=(u=td(c))!=null?u:pr,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:a,props:{options:{activationConstraint:r,bypassActivationConstraint:s}}}=this;if(this.listeners.add(a.move.name,this.handleMove,{passive:!1}),this.listeners.add(a.end.name,this.handleEnd),a.cancel&&this.listeners.add(a.cancel.name,this.handleCancel),this.windowListeners.add(tr.Resize,this.handleCancel),this.windowListeners.add(tr.DragStart,Xy),this.windowListeners.add(tr.VisibilityChange,this.handleCancel),this.windowListeners.add(tr.ContextMenu,Xy),this.documentListeners.add(tr.Keydown,this.handleKeydown),r){if(s!=null&&s({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Ky(r)){this.timeoutId=setTimeout(this.handleStart,r.delay),this.handlePending(r);return}if(Qy(r)){this.handlePending(r);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(a,r){const{active:s,onPending:u}=this.props;u(s,a,this.initialCoordinates,r)}handleStart(){const{initialCoordinates:a}=this,{onStart:r}=this.props;a&&(this.activated=!0,this.documentListeners.add(tr.Click,sT,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(tr.SelectionChange,this.removeTextSelection),r(a))}handleMove(a){var r;const{activated:s,initialCoordinates:u,props:c}=this,{onMove:d,options:{activationConstraint:h}}=c;if(!u)return;const p=(r=td(a))!=null?r:pr,g=ed(u,p);if(!s&&h){if(Qy(h)){if(h.tolerance!=null&&Xh(g,h.tolerance))return this.handleCancel();if(Xh(g,h.distance))return this.handleStart()}if(Ky(h)&&Xh(g,h.tolerance))return this.handleCancel();this.handlePending(h,g);return}a.cancelable&&a.preventDefault(),d(p)}handleEnd(){const{onAbort:a,onEnd:r}=this.props;this.detach(),this.activated||a(this.props.active),r()}handleCancel(){const{onAbort:a,onCancel:r}=this.props;this.detach(),this.activated||a(this.props.active),r()}handleKeydown(a){a.code===zt.Esc&&this.handleCancel()}removeTextSelection(){var a;(a=this.document.getSelection())==null||a.removeAllRanges()}}const oT={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class cp extends op{constructor(a){const{event:r}=a,s=ki(r.target);super(a,oT,s)}}cp.activators=[{eventName:"onPointerDown",handler:(e,a)=>{let{nativeEvent:r}=e,{onActivation:s}=a;return!r.isPrimary||r.button!==0?!1:(s==null||s({event:r}),!0)}}];const cT={move:{name:"mousemove"},end:{name:"mouseup"}};var Em;(function(e){e[e.RightClick=2]="RightClick"})(Em||(Em={}));class uT extends op{constructor(a){super(a,cT,ki(a.event.target))}}uT.activators=[{eventName:"onMouseDown",handler:(e,a)=>{let{nativeEvent:r}=e,{onActivation:s}=a;return r.button===Em.RightClick?!1:(s==null||s({event:r}),!0)}}];const Qh={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class dT extends op{constructor(a){super(a,Qh)}static setup(){return window.addEventListener(Qh.move.name,a,{capture:!1,passive:!1}),function(){window.removeEventListener(Qh.move.name,a)};function a(){}}}dT.activators=[{eventName:"onTouchStart",handler:(e,a)=>{let{nativeEvent:r}=e,{onActivation:s}=a;const{touches:u}=r;return u.length>1?!1:(s==null||s({event:r}),!0)}}];var Uo;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(Uo||(Uo={}));var ad;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(ad||(ad={}));function fT(e){let{acceleration:a,activator:r=Uo.Pointer,canScroll:s,draggingRect:u,enabled:c,interval:d=5,order:h=ad.TreeOrder,pointerCoordinates:p,scrollableAncestors:g,scrollableAncestorRects:v,delta:y,threshold:S}=e;const N=mT({delta:y,disabled:!c}),[w,j]=Sk(),R=x.useRef({x:0,y:0}),M=x.useRef({x:0,y:0}),$=x.useMemo(()=>{switch(r){case Uo.Pointer:return p?{top:p.y,bottom:p.y,left:p.x,right:p.x}:null;case Uo.DraggableRect:return u}},[r,u,p]),B=x.useRef(null),Y=x.useCallback(()=>{const ae=B.current;if(!ae)return;const U=R.current.x*M.current.x,k=R.current.y*M.current.y;ae.scrollBy(U,k)},[]),ne=x.useMemo(()=>h===ad.TreeOrder?[...g].reverse():g,[h,g]);x.useEffect(()=>{if(!c||!g.length||!$){j();return}for(const ae of ne){if((s==null?void 0:s(ae))===!1)continue;const U=g.indexOf(ae),k=v[U];if(!k)continue;const{direction:re,speed:pe}=eT(ae,k,$,a,S);for(const Se of["x","y"])N[Se][re[Se]]||(pe[Se]=0,re[Se]=0);if(pe.x>0||pe.y>0){j(),B.current=ae,w(Y,d),R.current=pe,M.current=re;return}}R.current={x:0,y:0},M.current={x:0,y:0},j()},[a,Y,s,j,c,d,JSON.stringify($),JSON.stringify(N),w,g,ne,v,JSON.stringify(S)])}const hT={x:{[Xn.Backward]:!1,[Xn.Forward]:!1},y:{[Xn.Backward]:!1,[Xn.Forward]:!1}};function mT(e){let{delta:a,disabled:r}=e;const s=Ju(a);return sc(u=>{if(r||!s||!u)return hT;const c={x:Math.sign(a.x-s.x),y:Math.sign(a.y-s.y)};return{x:{[Xn.Backward]:u.x[Xn.Backward]||c.x===-1,[Xn.Forward]:u.x[Xn.Forward]||c.x===1},y:{[Xn.Backward]:u.y[Xn.Backward]||c.y===-1,[Xn.Forward]:u.y[Xn.Forward]||c.y===1}}},[r,a,s])}function pT(e,a){const r=a!=null?e.get(a):void 0,s=r?r.node.current:null;return sc(u=>{var c;return a==null?null:(c=s??u)!=null?c:null},[s,a])}function gT(e,a){return x.useMemo(()=>e.reduce((r,s)=>{const{sensor:u}=s,c=u.activators.map(d=>({eventName:d.eventName,handler:a(d.handler,s)}));return[...r,...c]},[]),[e,a])}var Go;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(Go||(Go={}));var jm;(function(e){e.Optimized="optimized"})(jm||(jm={}));const Zy=new Map;function xT(e,a){let{dragging:r,dependencies:s,config:u}=a;const[c,d]=x.useState(null),{frequency:h,measure:p,strategy:g}=u,v=x.useRef(e),y=R(),S=Yo(y),N=x.useCallback(function(M){M===void 0&&(M=[]),!S.current&&d($=>$===null?M:$.concat(M.filter(B=>!$.includes(B))))},[S]),w=x.useRef(null),j=sc(M=>{if(y&&!r)return Zy;if(!M||M===Zy||v.current!==e||c!=null){const $=new Map;for(let B of e){if(!B)continue;if(c&&c.length>0&&!c.includes(B.id)&&B.rect.current){$.set(B.id,B.rect.current);continue}const Y=B.node.current,ne=Y?new ip(p(Y),Y):null;B.rect.current=ne,ne&&$.set(B.id,ne)}return $}return M},[e,c,r,y,p]);return x.useEffect(()=>{v.current=e},[e]),x.useEffect(()=>{y||N()},[r,y]),x.useEffect(()=>{c&&c.length>0&&d(null)},[JSON.stringify(c)]),x.useEffect(()=>{y||typeof h!="number"||w.current!==null||(w.current=setTimeout(()=>{N(),w.current=null},h))},[h,y,N,...s]),{droppableRects:j,measureDroppableContainers:N,measuringScheduled:c!=null};function R(){switch(g){case Go.Always:return!1;case Go.BeforeDragging:return r;default:return!r}}}function up(e,a){return sc(r=>e?r||(typeof a=="function"?a(e):e):null,[a,e])}function vT(e,a){return up(e,a)}function yT(e){let{callback:a,disabled:r}=e;const s=Ed(a),u=x.useMemo(()=>{if(r||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:c}=window;return new c(s)},[s,r]);return x.useEffect(()=>()=>u==null?void 0:u.disconnect(),[u]),u}function Rd(e){let{callback:a,disabled:r}=e;const s=Ed(a),u=x.useMemo(()=>{if(r||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:c}=window;return new c(s)},[r]);return x.useEffect(()=>()=>u==null?void 0:u.disconnect(),[u]),u}function bT(e){return new ip(Ti(e),e)}function Wy(e,a,r){a===void 0&&(a=bT);const[s,u]=x.useState(null);function c(){u(p=>{if(!e)return null;if(e.isConnected===!1){var g;return(g=p??r)!=null?g:null}const v=a(e);return JSON.stringify(p)===JSON.stringify(v)?p:v})}const d=yT({callback(p){if(e)for(const g of p){const{type:v,target:y}=g;if(v==="childList"&&y instanceof HTMLElement&&y.contains(e)){c();break}}}}),h=Rd({callback:c});return mr(()=>{c(),e?(h==null||h.observe(e),d==null||d.observe(document.body,{childList:!0,subtree:!0})):(h==null||h.disconnect(),d==null||d.disconnect())},[e]),s}function wT(e){const a=up(e);return nw(e,a)}const Jy=[];function ST(e){const a=x.useRef(e),r=sc(s=>e?s&&s!==Jy&&e&&a.current&&e.parentNode===a.current.parentNode?s:sp(e):Jy,[e]);return x.useEffect(()=>{a.current=e},[e]),r}function NT(e){const[a,r]=x.useState(null),s=x.useRef(e),u=x.useCallback(c=>{const d=Gh(c.target);d&&r(h=>h?(h.set(d,Nm(d)),new Map(h)):null)},[]);return x.useEffect(()=>{const c=s.current;if(e!==c){d(c);const h=e.map(p=>{const g=Gh(p);return g?(g.addEventListener("scroll",u,{passive:!0}),[g,Nm(g)]):null}).filter(p=>p!=null);r(h.length?new Map(h):null),s.current=e}return()=>{d(e),d(c)};function d(h){h.forEach(p=>{const g=Gh(p);g==null||g.removeEventListener("scroll",u)})}},[u,e]),x.useMemo(()=>e.length?a?Array.from(a.values()).reduce((c,d)=>bi(c,d),pr):cw(e):pr,[e,a])}function eb(e,a){a===void 0&&(a=[]);const r=x.useRef(null);return x.useEffect(()=>{r.current=null},a),x.useEffect(()=>{const s=e!==pr;s&&!r.current&&(r.current=e),!s&&r.current&&(r.current=null)},[e]),r.current?ed(e,r.current):pr}function ET(e){x.useEffect(()=>{if(!Nd)return;const a=e.map(r=>{let{sensor:s}=r;return s.setup==null?void 0:s.setup()});return()=>{for(const r of a)r==null||r()}},e.map(a=>{let{sensor:r}=a;return r}))}function jT(e,a){return x.useMemo(()=>e.reduce((r,s)=>{let{eventName:u,handler:c}=s;return r[u]=d=>{c(d,a)},r},{}),[e,a])}function hw(e){return x.useMemo(()=>e?Kk(e):null,[e])}const tb=[];function RT(e,a){a===void 0&&(a=Ti);const[r]=e,s=hw(r?xa(r):null),[u,c]=x.useState(tb);function d(){c(()=>e.length?e.map(p=>iw(p)?s:new ip(a(p),p)):tb)}const h=Rd({callback:d});return mr(()=>{h==null||h.disconnect(),d(),e.forEach(p=>h==null?void 0:h.observe(p))},[e]),u}function mw(e){if(!e)return null;if(e.children.length>1)return e;const a=e.children[0];return lc(a)?a:e}function kT(e){let{measure:a}=e;const[r,s]=x.useState(null),u=x.useCallback(g=>{for(const{target:v}of g)if(lc(v)){s(y=>{const S=a(v);return y?{...y,width:S.width,height:S.height}:S});break}},[a]),c=Rd({callback:u}),d=x.useCallback(g=>{const v=mw(g);c==null||c.disconnect(),v&&(c==null||c.observe(v)),s(v?a(v):null)},[a,c]),[h,p]=Wu(d);return x.useMemo(()=>({nodeRef:h,rect:r,setRef:p}),[r,h,p])}const TT=[{sensor:cp,options:{}},{sensor:fw,options:{}}],AT={current:{}},Hu={draggable:{measure:Gy},droppable:{measure:Gy,strategy:Go.WhileDragging,frequency:jm.Optimized},dragOverlay:{measure:Ti}};class Bo extends Map{get(a){var r;return a!=null&&(r=super.get(a))!=null?r:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(a=>{let{disabled:r}=a;return!r})}getNodeFor(a){var r,s;return(r=(s=this.get(a))==null?void 0:s.node.current)!=null?r:void 0}}const DT={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Bo,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:nd},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Hu,measureDroppableContainers:nd,windowRect:null,measuringScheduled:!1},pw={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:nd,draggableNodes:new Map,over:null,measureDroppableContainers:nd},oc=x.createContext(pw),gw=x.createContext(DT);function CT(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Bo}}}function OT(e,a){switch(a.type){case Hn.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:a.initialCoordinates,active:a.active}};case Hn.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:a.coordinates.x-e.draggable.initialCoordinates.x,y:a.coordinates.y-e.draggable.initialCoordinates.y}}};case Hn.DragEnd:case Hn.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Hn.RegisterDroppable:{const{element:r}=a,{id:s}=r,u=new Bo(e.droppable.containers);return u.set(s,r),{...e,droppable:{...e.droppable,containers:u}}}case Hn.SetDroppableDisabled:{const{id:r,key:s,disabled:u}=a,c=e.droppable.containers.get(r);if(!c||s!==c.key)return e;const d=new Bo(e.droppable.containers);return d.set(r,{...c,disabled:u}),{...e,droppable:{...e.droppable,containers:d}}}case Hn.UnregisterDroppable:{const{id:r,key:s}=a,u=e.droppable.containers.get(r);if(!u||s!==u.key)return e;const c=new Bo(e.droppable.containers);return c.delete(r),{...e,droppable:{...e.droppable,containers:c}}}default:return e}}function MT(e){let{disabled:a}=e;const{active:r,activatorEvent:s,draggableNodes:u}=x.useContext(oc),c=Ju(s),d=Ju(r==null?void 0:r.id);return x.useEffect(()=>{if(!a&&!s&&c&&d!=null){if(!jd(c)||document.activeElement===c.target)return;const h=u.get(d);if(!h)return;const{activatorNode:p,node:g}=h;if(!p.current&&!g.current)return;requestAnimationFrame(()=>{for(const v of[p.current,g.current]){if(!v)continue;const y=jk(v);if(y){y.focus();break}}})}},[s,a,u,d,c]),null}function xw(e,a){let{transform:r,...s}=a;return e!=null&&e.length?e.reduce((u,c)=>c({transform:u,...s}),r):r}function _T(e){return x.useMemo(()=>({draggable:{...Hu.draggable,...e==null?void 0:e.draggable},droppable:{...Hu.droppable,...e==null?void 0:e.droppable},dragOverlay:{...Hu.dragOverlay,...e==null?void 0:e.dragOverlay}}),[e==null?void 0:e.draggable,e==null?void 0:e.droppable,e==null?void 0:e.dragOverlay])}function LT(e){let{activeNode:a,measure:r,initialRect:s,config:u=!0}=e;const c=x.useRef(!1),{x:d,y:h}=typeof u=="boolean"?{x:u,y:u}:u;mr(()=>{if(!d&&!h||!a){c.current=!1;return}if(c.current||!s)return;const g=a==null?void 0:a.node.current;if(!g||g.isConnected===!1)return;const v=r(g),y=nw(v,s);if(d||(y.x=0),h||(y.y=0),c.current=!0,Math.abs(y.x)>0||Math.abs(y.y)>0){const S=rw(g);S&&S.scrollBy({top:y.y,left:y.x})}},[a,d,h,s,r])}const kd=x.createContext({...pr,scaleX:1,scaleY:1});var Hl;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(Hl||(Hl={}));const zT=x.memo(function(a){var r,s,u,c;let{id:d,accessibility:h,autoScroll:p=!0,children:g,sensors:v=TT,collisionDetection:y=Fk,measuring:S,modifiers:N,...w}=a;const j=x.useReducer(OT,void 0,CT),[R,M]=j,[$,B]=Ck(),[Y,ne]=x.useState(Hl.Uninitialized),ae=Y===Hl.Initialized,{draggable:{active:U,nodes:k,translate:re},droppable:{containers:pe}}=R,Se=U!=null?k.get(U):null,ye=x.useRef({initial:null,translated:null}),he=x.useMemo(()=>{var wt;return U!=null?{id:U,data:(wt=Se==null?void 0:Se.data)!=null?wt:AT,rect:ye}:null},[U,Se]),je=x.useRef(null),[W,L]=x.useState(null),[F,fe]=x.useState(null),P=Yo(w,Object.values(w)),se=ic("DndDescribedBy",d),A=x.useMemo(()=>pe.getEnabled(),[pe]),I=_T(S),{droppableRects:K,measureDroppableContainers:ue,measuringScheduled:ge}=xT(A,{dragging:ae,dependencies:[re.x,re.y],config:I.droppable}),xe=pT(k,U),ke=x.useMemo(()=>F?td(F):null,[F]),Ie=bt(),Ue=vT(xe,I.draggable.measure);LT({activeNode:U!=null?k.get(U):null,config:Ie.layoutShiftCompensation,initialRect:Ue,measure:I.draggable.measure});const Ze=Wy(xe,I.draggable.measure,Ue),dn=Wy(xe?xe.parentElement:null),It=x.useRef({activatorEvent:null,active:null,activeNode:xe,collisionRect:null,collisions:null,droppableRects:K,draggableNodes:k,draggingNode:null,draggingNodeRect:null,droppableContainers:pe,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),pt=pe.getNodeFor((r=It.current.over)==null?void 0:r.id),ce=kT({measure:I.dragOverlay.measure}),qe=(s=ce.nodeRef.current)!=null?s:xe,st=ae?(u=ce.rect)!=null?u:Ze:null,Ht=!!(ce.nodeRef.current&&ce.rect),yn=wT(Ht?null:Ze),At=hw(qe?xa(qe):null),$t=ST(ae?pt??xe:null),Wt=RT($t),Fn=xw(N,{transform:{x:re.x-yn.x,y:re.y-yn.y,scaleX:1,scaleY:1},activatorEvent:F,active:he,activeNodeRect:Ze,containerNodeRect:dn,draggingNodeRect:st,over:It.current.over,overlayNodeRect:ce.rect,scrollableAncestors:$t,scrollableAncestorRects:Wt,windowRect:At}),Vn=ke?bi(ke,re):null,rn=NT($t),ha=eb(rn),ma=eb(rn,[Ze]),aa=bi(Fn,ha),Yn=st?Gk(st,Fn):null,me=he&&Yn?y({active:he,collisionRect:Yn,droppableRects:K,droppableContainers:A,pointerCoordinates:Vn}):null,Ae=Hk(me,"id"),[De,Qe]=x.useState(null),Pe=Ht?Fn:bi(Fn,ma),ee=Vk(Pe,(c=De==null?void 0:De.rect)!=null?c:null,Ze),Dt=x.useRef(null),Jt=x.useCallback((wt,Et)=>{let{sensor:qt,options:Ct}=Et;if(je.current==null)return;const ln=k.get(je.current);if(!ln)return;const en=wt.nativeEvent,Pt=new qt({active:je.current,activeNode:ln,event:en,options:Ct,context:It,onAbort(nt){if(!k.get(nt))return;const{onDragAbort:Ln}=P.current,D={id:nt};Ln==null||Ln(D),$({type:"onDragAbort",event:D})},onPending(nt,jn,Ln,D){if(!k.get(nt))return;const{onDragPending:q}=P.current,J={id:nt,constraint:jn,initialCoordinates:Ln,offset:D};q==null||q(J),$({type:"onDragPending",event:J})},onStart(nt){const jn=je.current;if(jn==null)return;const Ln=k.get(jn);if(!Ln)return;const{onDragStart:D}=P.current,_={activatorEvent:en,active:{id:jn,data:Ln.data,rect:ye}};il.unstable_batchedUpdates(()=>{D==null||D(_),ne(Hl.Initializing),M({type:Hn.DragStart,initialCoordinates:nt,active:jn}),$({type:"onDragStart",event:_}),L(Dt.current),fe(en)})},onMove(nt){M({type:Hn.DragMove,coordinates:nt})},onEnd:gt(Hn.DragEnd),onCancel:gt(Hn.DragCancel)});Dt.current=Pt;function gt(nt){return async function(){const{active:Ln,collisions:D,over:_,scrollAdjustedTranslate:q}=It.current;let J=null;if(Ln&&q){const{cancelDrop:ie}=P.current;J={activatorEvent:en,active:Ln,collisions:D,delta:q,over:_},nt===Hn.DragEnd&&typeof ie=="function"&&await Promise.resolve(ie(J))&&(nt=Hn.DragCancel)}je.current=null,il.unstable_batchedUpdates(()=>{M({type:nt}),ne(Hl.Uninitialized),Qe(null),L(null),fe(null),Dt.current=null;const ie=nt===Hn.DragEnd?"onDragEnd":"onDragCancel";if(J){const Te=P.current[ie];Te==null||Te(J),$({type:ie,event:J})}})}}},[k]),Qn=x.useCallback((wt,Et)=>(qt,Ct)=>{const ln=qt.nativeEvent,en=k.get(Ct);if(je.current!==null||!en||ln.dndKit||ln.defaultPrevented)return;const Pt={active:en};wt(qt,Et.options,Pt)===!0&&(ln.dndKit={capturedBy:Et.sensor},je.current=Ct,Jt(qt,Et))},[k,Jt]),bn=gT(v,Qn);ET(v),mr(()=>{Ze&&Y===Hl.Initializing&&ne(Hl.Initialized)},[Ze,Y]),x.useEffect(()=>{const{onDragMove:wt}=P.current,{active:Et,activatorEvent:qt,collisions:Ct,over:ln}=It.current;if(!Et||!qt)return;const en={active:Et,activatorEvent:qt,collisions:Ct,delta:{x:aa.x,y:aa.y},over:ln};il.unstable_batchedUpdates(()=>{wt==null||wt(en),$({type:"onDragMove",event:en})})},[aa.x,aa.y]),x.useEffect(()=>{const{active:wt,activatorEvent:Et,collisions:qt,droppableContainers:Ct,scrollAdjustedTranslate:ln}=It.current;if(!wt||je.current==null||!Et||!ln)return;const{onDragOver:en}=P.current,Pt=Ct.get(Ae),gt=Pt&&Pt.rect.current?{id:Pt.id,rect:Pt.rect.current,data:Pt.data,disabled:Pt.disabled}:null,nt={active:wt,activatorEvent:Et,collisions:qt,delta:{x:ln.x,y:ln.y},over:gt};il.unstable_batchedUpdates(()=>{Qe(gt),en==null||en(nt),$({type:"onDragOver",event:nt})})},[Ae]),mr(()=>{It.current={activatorEvent:F,active:he,activeNode:xe,collisionRect:Yn,collisions:me,droppableRects:K,draggableNodes:k,draggingNode:qe,draggingNodeRect:st,droppableContainers:pe,over:De,scrollableAncestors:$t,scrollAdjustedTranslate:aa},ye.current={initial:st,translated:Yn}},[he,xe,me,Yn,k,qe,st,K,pe,De,$t,aa]),fT({...Ie,delta:re,draggingRect:Yn,pointerCoordinates:Vn,scrollableAncestors:$t,scrollableAncestorRects:Wt});const qa=x.useMemo(()=>({active:he,activeNode:xe,activeNodeRect:Ze,activatorEvent:F,collisions:me,containerNodeRect:dn,dragOverlay:ce,draggableNodes:k,droppableContainers:pe,droppableRects:K,over:De,measureDroppableContainers:ue,scrollableAncestors:$t,scrollableAncestorRects:Wt,measuringConfiguration:I,measuringScheduled:ge,windowRect:At}),[he,xe,Ze,F,me,dn,ce,k,pe,K,De,ue,$t,Wt,I,ge,At]),_e=x.useMemo(()=>({activatorEvent:F,activators:bn,active:he,activeNodeRect:Ze,ariaDescribedById:{draggable:se},dispatch:M,draggableNodes:k,over:De,measureDroppableContainers:ue}),[F,bn,he,Ze,M,se,k,De,ue]);return hn.createElement(tw.Provider,{value:B},hn.createElement(oc.Provider,{value:_e},hn.createElement(gw.Provider,{value:qa},hn.createElement(kd.Provider,{value:ee},g)),hn.createElement(MT,{disabled:(h==null?void 0:h.restoreFocus)===!1})),hn.createElement(_k,{...h,hiddenTextDescribedById:se}));function bt(){const wt=(W==null?void 0:W.autoScrollEnabled)===!1,Et=typeof p=="object"?p.enabled===!1:p===!1,qt=ae&&!wt&&!Et;return typeof p=="object"?{...p,enabled:qt}:{enabled:qt}}}),$T=x.createContext(null),nb="button",UT="Draggable";function BT(e){let{id:a,data:r,disabled:s=!1,attributes:u}=e;const c=ic(UT),{activators:d,activatorEvent:h,active:p,activeNodeRect:g,ariaDescribedById:v,draggableNodes:y,over:S}=x.useContext(oc),{role:N=nb,roleDescription:w="draggable",tabIndex:j=0}=u??{},R=(p==null?void 0:p.id)===a,M=x.useContext(R?kd:$T),[$,B]=Wu(),[Y,ne]=Wu(),ae=jT(d,a),U=Yo(r);mr(()=>(y.set(a,{id:a,key:c,node:$,activatorNode:Y,data:U}),()=>{const re=y.get(a);re&&re.key===c&&y.delete(a)}),[y,a]);const k=x.useMemo(()=>({role:N,tabIndex:j,"aria-disabled":s,"aria-pressed":R&&N===nb?!0:void 0,"aria-roledescription":w,"aria-describedby":v.draggable}),[s,N,j,R,w,v.draggable]);return{active:p,activatorEvent:h,activeNodeRect:g,attributes:k,isDragging:R,listeners:s?void 0:ae,node:$,over:S,setNodeRef:B,setActivatorNodeRef:ne,transform:M}}function vw(){return x.useContext(gw)}const IT="Droppable",HT={timeout:25};function qT(e){let{data:a,disabled:r=!1,id:s,resizeObserverConfig:u}=e;const c=ic(IT),{active:d,dispatch:h,over:p,measureDroppableContainers:g}=x.useContext(oc),v=x.useRef({disabled:r}),y=x.useRef(!1),S=x.useRef(null),N=x.useRef(null),{disabled:w,updateMeasurementsFor:j,timeout:R}={...HT,...u},M=Yo(j??s),$=x.useCallback(()=>{if(!y.current){y.current=!0;return}N.current!=null&&clearTimeout(N.current),N.current=setTimeout(()=>{g(Array.isArray(M.current)?M.current:[M.current]),N.current=null},R)},[R]),B=Rd({callback:$,disabled:w||!d}),Y=x.useCallback((k,re)=>{B&&(re&&(B.unobserve(re),y.current=!1),k&&B.observe(k))},[B]),[ne,ae]=Wu(Y),U=Yo(a);return x.useEffect(()=>{!B||!ne.current||(B.disconnect(),y.current=!1,B.observe(ne.current))},[ne,B]),x.useEffect(()=>(h({type:Hn.RegisterDroppable,element:{id:s,key:c,disabled:r,node:ne,rect:S,data:U}}),()=>h({type:Hn.UnregisterDroppable,key:c,id:s})),[s]),x.useEffect(()=>{r!==v.current.disabled&&(h({type:Hn.SetDroppableDisabled,id:s,key:c,disabled:r}),v.current.disabled=r)},[s,c,r,h]),{active:d,rect:S,isOver:(p==null?void 0:p.id)===s,node:ne,over:p,setNodeRef:ae}}function PT(e){let{animation:a,children:r}=e;const[s,u]=x.useState(null),[c,d]=x.useState(null),h=Ju(r);return!r&&!s&&h&&u(h),mr(()=>{if(!c)return;const p=s==null?void 0:s.key,g=s==null?void 0:s.props.id;if(p==null||g==null){u(null);return}Promise.resolve(a(g,c)).then(()=>{u(null)})},[a,s,c]),hn.createElement(hn.Fragment,null,r,s?x.cloneElement(s,{ref:d}):null)}const FT={x:0,y:0,scaleX:1,scaleY:1};function VT(e){let{children:a}=e;return hn.createElement(oc.Provider,{value:pw},hn.createElement(kd.Provider,{value:FT},a))}const YT={position:"fixed",touchAction:"none"},GT=e=>jd(e)?"transform 250ms ease":void 0,XT=x.forwardRef((e,a)=>{let{as:r,activatorEvent:s,adjustScale:u,children:c,className:d,rect:h,style:p,transform:g,transition:v=GT}=e;if(!h)return null;const y=u?g:{...g,scaleX:1,scaleY:1},S={...YT,width:h.width,height:h.height,top:h.top,left:h.left,transform:Yl.Transform.toString(y),transformOrigin:u&&s?Uk(s,h):void 0,transition:typeof v=="function"?v(s):v,...p};return hn.createElement(r,{className:d,style:S,ref:a},c)}),QT=e=>a=>{let{active:r,dragOverlay:s}=a;const u={},{styles:c,className:d}=e;if(c!=null&&c.active)for(const[h,p]of Object.entries(c.active))p!==void 0&&(u[h]=r.node.style.getPropertyValue(h),r.node.style.setProperty(h,p));if(c!=null&&c.dragOverlay)for(const[h,p]of Object.entries(c.dragOverlay))p!==void 0&&s.node.style.setProperty(h,p);return d!=null&&d.active&&r.node.classList.add(d.active),d!=null&&d.dragOverlay&&s.node.classList.add(d.dragOverlay),function(){for(const[p,g]of Object.entries(u))r.node.style.setProperty(p,g);d!=null&&d.active&&r.node.classList.remove(d.active)}},KT=e=>{let{transform:{initial:a,final:r}}=e;return[{transform:Yl.Transform.toString(a)},{transform:Yl.Transform.toString(r)}]},ZT={duration:250,easing:"ease",keyframes:KT,sideEffects:QT({styles:{active:{opacity:"0"}}})};function WT(e){let{config:a,draggableNodes:r,droppableContainers:s,measuringConfiguration:u}=e;return Ed((c,d)=>{if(a===null)return;const h=r.get(c);if(!h)return;const p=h.node.current;if(!p)return;const g=mw(d);if(!g)return;const{transform:v}=xa(d).getComputedStyle(d),y=aw(v);if(!y)return;const S=typeof a=="function"?a:JT(a);return uw(p,u.draggable.measure),S({active:{id:c,data:h.data,node:p,rect:u.draggable.measure(p)},draggableNodes:r,dragOverlay:{node:d,rect:u.dragOverlay.measure(g)},droppableContainers:s,measuringConfiguration:u,transform:y})})}function JT(e){const{duration:a,easing:r,sideEffects:s,keyframes:u}={...ZT,...e};return c=>{let{active:d,dragOverlay:h,transform:p,...g}=c;if(!a)return;const v={x:h.rect.left-d.rect.left,y:h.rect.top-d.rect.top},y={scaleX:p.scaleX!==1?d.rect.width*p.scaleX/h.rect.width:1,scaleY:p.scaleY!==1?d.rect.height*p.scaleY/h.rect.height:1},S={x:p.x-v.x,y:p.y-v.y,...y},N=u({...g,active:d,dragOverlay:h,transform:{initial:p,final:S}}),[w]=N,j=N[N.length-1];if(JSON.stringify(w)===JSON.stringify(j))return;const R=s==null?void 0:s({active:d,dragOverlay:h,...g}),M=h.node.animate(N,{duration:a,easing:r,fill:"forwards"});return new Promise($=>{M.onfinish=()=>{R==null||R(),$()}})}}let ab=0;function eA(e){return x.useMemo(()=>{if(e!=null)return ab++,ab},[e])}const tA=hn.memo(e=>{let{adjustScale:a=!1,children:r,dropAnimation:s,style:u,transition:c,modifiers:d,wrapperElement:h="div",className:p,zIndex:g=999}=e;const{activatorEvent:v,active:y,activeNodeRect:S,containerNodeRect:N,draggableNodes:w,droppableContainers:j,dragOverlay:R,over:M,measuringConfiguration:$,scrollableAncestors:B,scrollableAncestorRects:Y,windowRect:ne}=vw(),ae=x.useContext(kd),U=eA(y==null?void 0:y.id),k=xw(d,{activatorEvent:v,active:y,activeNodeRect:S,containerNodeRect:N,draggingNodeRect:R.rect,over:M,overlayNodeRect:R.rect,scrollableAncestors:B,scrollableAncestorRects:Y,transform:ae,windowRect:ne}),re=up(S),pe=WT({config:s,draggableNodes:w,droppableContainers:j,measuringConfiguration:$}),Se=re?R.setRef:void 0;return hn.createElement(VT,null,hn.createElement(PT,{animation:pe},y&&U?hn.createElement(XT,{key:U,id:y.id,ref:Se,as:h,activatorEvent:v,adjustScale:a,className:p,transition:c,rect:re,style:{zIndex:g,...u},transform:k},r):null))});function Io(e,a,r){const s=e.slice();return s.splice(r<0?s.length+r:r,0,s.splice(a,1)[0]),s}function nA(e,a){return e.reduce((r,s,u)=>{const c=a.get(s);return c&&(r[u]=c),r},Array(e.length))}function Tu(e){return e!==null&&e>=0}function aA(e,a){if(e===a)return!0;if(e.length!==a.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==a[r])return!1;return!0}function rA(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const yw=e=>{let{rects:a,activeIndex:r,overIndex:s,index:u}=e;const c=Io(a,s,r),d=a[u],h=c[u];return!h||!d?null:{x:h.left-d.left,y:h.top-d.top,scaleX:h.width/d.width,scaleY:h.height/d.height}},Au={scaleX:1,scaleY:1},dp=e=>{var a;let{activeIndex:r,activeNodeRect:s,index:u,rects:c,overIndex:d}=e;const h=(a=c[r])!=null?a:s;if(!h)return null;if(u===r){const g=c[d];return g?{x:0,y:r<d?g.top+g.height-(h.top+h.height):g.top-h.top,...Au}:null}const p=lA(c,u,r);return u>r&&u<=d?{x:0,y:-h.height-p,...Au}:u<r&&u>=d?{x:0,y:h.height+p,...Au}:{x:0,y:0,...Au}};function lA(e,a,r){const s=e[a],u=e[a-1],c=e[a+1];return s?r<a?u?s.top-(u.top+u.height):c?c.top-(s.top+s.height):0:c?c.top-(s.top+s.height):u?s.top-(u.top+u.height):0:0}const bw="Sortable",ww=hn.createContext({activeIndex:-1,containerId:bw,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:yw,disabled:{draggable:!1,droppable:!1}});function fp(e){let{children:a,id:r,items:s,strategy:u=yw,disabled:c=!1}=e;const{active:d,dragOverlay:h,droppableRects:p,over:g,measureDroppableContainers:v}=vw(),y=ic(bw,r),S=h.rect!==null,N=x.useMemo(()=>s.map(ae=>typeof ae=="object"&&"id"in ae?ae.id:ae),[s]),w=d!=null,j=d?N.indexOf(d.id):-1,R=g?N.indexOf(g.id):-1,M=x.useRef(N),$=!aA(N,M.current),B=R!==-1&&j===-1||$,Y=rA(c);mr(()=>{$&&w&&v(N)},[$,N,w,v]),x.useEffect(()=>{M.current=N},[N]);const ne=x.useMemo(()=>({activeIndex:j,containerId:y,disabled:Y,disableTransforms:B,items:N,overIndex:R,useDragOverlay:S,sortedRects:nA(N,p),strategy:u}),[j,y,Y.draggable,Y.droppable,B,N,R,p,S,u]);return hn.createElement(ww.Provider,{value:ne},a)}const sA=e=>{let{id:a,items:r,activeIndex:s,overIndex:u}=e;return Io(r,s,u).indexOf(a)},iA=e=>{let{containerId:a,isSorting:r,wasDragging:s,index:u,items:c,newIndex:d,previousItems:h,previousContainerId:p,transition:g}=e;return!g||!s||h!==c&&u===d?!1:r?!0:d!==u&&a===p},oA={duration:200,easing:"ease"},Sw="transform",cA=Yl.Transition.toString({property:Sw,duration:0,easing:"linear"}),uA={roleDescription:"sortable"};function dA(e){let{disabled:a,index:r,node:s,rect:u}=e;const[c,d]=x.useState(null),h=x.useRef(r);return mr(()=>{if(!a&&r!==h.current&&s.current){const p=u.current;if(p){const g=Ti(s.current,{ignoreTransform:!0}),v={x:p.left-g.left,y:p.top-g.top,scaleX:p.width/g.width,scaleY:p.height/g.height};(v.x||v.y)&&d(v)}}r!==h.current&&(h.current=r)},[a,r,s,u]),x.useEffect(()=>{c&&d(null)},[c]),c}function fA(e){let{animateLayoutChanges:a=iA,attributes:r,disabled:s,data:u,getNewIndex:c=sA,id:d,strategy:h,resizeObserverConfig:p,transition:g=oA}=e;const{items:v,containerId:y,activeIndex:S,disabled:N,disableTransforms:w,sortedRects:j,overIndex:R,useDragOverlay:M,strategy:$}=x.useContext(ww),B=hA(s,N),Y=v.indexOf(d),ne=x.useMemo(()=>({sortable:{containerId:y,index:Y,items:v},...u}),[y,u,Y,v]),ae=x.useMemo(()=>v.slice(v.indexOf(d)),[v,d]),{rect:U,node:k,isOver:re,setNodeRef:pe}=qT({id:d,data:ne,disabled:B.droppable,resizeObserverConfig:{updateMeasurementsFor:ae,...p}}),{active:Se,activatorEvent:ye,activeNodeRect:he,attributes:je,setNodeRef:W,listeners:L,isDragging:F,over:fe,setActivatorNodeRef:P,transform:se}=BT({id:d,data:ne,attributes:{...uA,...r},disabled:B.draggable}),A=wk(pe,W),I=!!Se,K=I&&!w&&Tu(S)&&Tu(R),ue=!M&&F,ge=ue&&K?se:null,ke=K?ge??(h??$)({rects:j,activeNodeRect:he,activeIndex:S,overIndex:R,index:Y}):null,Ie=Tu(S)&&Tu(R)?c({id:d,items:v,activeIndex:S,overIndex:R}):Y,Ue=Se==null?void 0:Se.id,Ze=x.useRef({activeId:Ue,items:v,newIndex:Ie,containerId:y}),dn=v!==Ze.current.items,It=a({active:Se,containerId:y,isDragging:F,isSorting:I,id:d,index:Y,items:v,newIndex:Ze.current.newIndex,previousItems:Ze.current.items,previousContainerId:Ze.current.containerId,transition:g,wasDragging:Ze.current.activeId!=null}),pt=dA({disabled:!It,index:Y,node:k,rect:U});return x.useEffect(()=>{I&&Ze.current.newIndex!==Ie&&(Ze.current.newIndex=Ie),y!==Ze.current.containerId&&(Ze.current.containerId=y),v!==Ze.current.items&&(Ze.current.items=v)},[I,Ie,y,v]),x.useEffect(()=>{if(Ue===Ze.current.activeId)return;if(Ue!=null&&Ze.current.activeId==null){Ze.current.activeId=Ue;return}const qe=setTimeout(()=>{Ze.current.activeId=Ue},50);return()=>clearTimeout(qe)},[Ue]),{active:Se,activeIndex:S,attributes:je,data:ne,rect:U,index:Y,newIndex:Ie,items:v,isOver:re,isSorting:I,isDragging:F,listeners:L,node:k,overIndex:R,over:fe,setNodeRef:A,setActivatorNodeRef:P,setDroppableNodeRef:pe,setDraggableNodeRef:W,transform:pt??ke,transition:ce()};function ce(){if(pt||dn&&Ze.current.newIndex===Y)return cA;if(!(ue&&!jd(ye)||!g)&&(I||It))return Yl.Transition.toString({...g,property:Sw})}}function hA(e,a){var r,s;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(r=e==null?void 0:e.draggable)!=null?r:a.draggable,droppable:(s=e==null?void 0:e.droppable)!=null?s:a.droppable}}zt.Down,zt.Right,zt.Up,zt.Left;const mA=[{value:"priority",label:"Priority"},{value:"number",label:"Number"},{value:"createdAt",label:"Created date"},{value:"updatedAt",label:"Updated date"},{value:"title",label:"Title"},{value:"shortId",label:"Short ID"},{value:"status",label:"Status"},{value:"startedAt",label:"Started"},{value:"completedAt",label:"Completed"}];function hp({sort:e,onChange:a,label:r="Sort by"}){return i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("label",{htmlFor:"sort-control",className:"hidden text-xs text-[var(--text-muted)] sm:inline",children:r}),i.jsxs("div",{className:"inline-flex h-9 items-center gap-1 rounded-lg border border-[var(--border)] bg-[var(--surface-card)] px-2 py-1 shadow-sm",children:[i.jsxs("div",{className:"relative",children:[i.jsx("select",{id:"sort-control",value:e.key,onChange:s=>a({key:s.target.value,direction:e.direction}),className:"h-7 w-full min-w-[7.5rem] cursor-pointer appearance-none border-0 bg-transparent pr-6 pl-1 text-xs font-medium text-[var(--text)] outline-none hover:text-[var(--accent)] sm:w-auto",children:mA.map(s=>i.jsx("option",{value:s.value,children:s.label},s.value))}),i.jsx(As,{className:"pointer-events-none absolute right-0 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-[var(--text-muted)]","aria-hidden":"true"})]}),i.jsx("button",{type:"button",onClick:()=>a({key:e.key,direction:e.direction==="asc"?"desc":"asc"}),className:"inline-flex h-6 w-6 shrink-0 items-center justify-center rounded-md text-[var(--text-muted)] transition hover:bg-[var(--surface-strong)] hover:text-[var(--text)]","aria-label":`Sort direction: ${e.direction}`,title:`Sort direction: ${e.direction}`,children:e.direction==="asc"?i.jsx(xj,{className:"h-3.5 w-3.5","aria-hidden":"true"}):i.jsx(mj,{className:"h-3.5 w-3.5","aria-hidden":"true"})})]})]})}const Td=[{value:"planned",label:"Planned"},{value:"in-progress",label:"In progress"},{value:"done",label:"Done"},{value:"blocked",label:"Blocked"},{value:"canceled",label:"Canceled"},{value:"rejected",label:"Rejected"},{value:"deferred",label:"Deferred"},{value:"waiting",label:"Waiting"}],Ad=[{value:"draft",label:"Draft"},{value:"discovery",label:"Discovery"},{value:"planned",label:"Planned"},{value:"in-progress",label:"In progress"},{value:"done",label:"Done"},{value:"blocked",label:"Blocked"},{value:"canceled",label:"Canceled"},{value:"rejected",label:"Rejected"},{value:"deferred",label:"Deferred"},{value:"waiting",label:"Waiting"}],mp=[{value:"planned",label:"Planned"},{value:"in-progress",label:"In progress"},{value:"done",label:"Done"},{value:"blocked",label:"Blocked"},{value:"canceled",label:"Canceled"},{value:"rejected",label:"Rejected"},{value:"deferred",label:"Deferred"},{value:"waiting",label:"Waiting"}],rd=mp,pA=[{value:"planned",label:"Planned"},{value:"in-progress",label:"In progress"},{value:"done",label:"Done"},{value:"blocked",label:"Blocked"},{value:"canceled",label:"Canceled"},{value:"rejected",label:"Rejected"},{value:"deferred",label:"Deferred"},{value:"waiting",label:"Waiting"}],jo=Td.map(e=>e.value),Ro=Ad.map(e=>e.value),ko=mp.map(e=>e.value);function Kh(e,a,r){if(e.includes(a)){const s=e.filter(u=>u!==a);return s.length===0?[...r]:s}return[...e,a]}function ci(e,a){return a.includes(e)}function dr(e,a){return`agent-plan:dashboard:${e}:${a}`}function Zh(e,a,r){if(typeof window>"u")return a;try{const s=window.localStorage.getItem(e);if(!s)return a;const u=JSON.parse(s);if(!Array.isArray(u))return a;const c=`${e}-schema`,d=r.slice().sort().join(",");if(window.localStorage.getItem(c)!==d)return window.localStorage.setItem(c,d),a;const p=u.filter(g=>typeof g=="string"&&r.includes(g));return p.length>0?p:a}catch{return a}}function Wh(e,a,r){typeof window>"u"||(window.localStorage.setItem(e,JSON.stringify(a)),window.localStorage.setItem(`${e}-schema`,r.slice().sort().join(",")))}function Jh(e,a){if(typeof window>"u")return a;const r=window.localStorage.getItem(e);return r===null?a:r==="true"}const rb={featureNumbers:null,phaseNumbers:null,taskNumbers:null,shortIds:null,status:null,featureStatus:null,phaseStatus:null,text:null},lb=/^(feature-status|phase-status|feature|phase|task|id|status|title):(.*)$/i;function Nw(e){return e.split(",").map(a=>a.trim()).filter(a=>a.length>0)}function gA(e){return new Set(Nw(e).map(a=>Number(a)).filter(a=>Number.isFinite(a)&&a>0))}function sb(e){const a=e.toUpperCase();return a==="AND"||a==="OR"}function wi(e,a){const r=e??new Set;for(const s of gA(a))r.add(s);return r}function xA(e,a){const r=e??new Set;for(const s of Nw(a).map(u=>u.toUpperCase()))r.add(s);return r}function vA(e,a){const r=a.match(/^([fpt])(\d+)$/i);if(!r)return!1;const s=Number(r[2]);if(!Number.isFinite(s)||s<=0)return!1;const u=r[1].toLowerCase();return u==="f"?e.featureNumbers=wi(e.featureNumbers,String(s)):u==="p"?e.phaseNumbers=wi(e.phaseNumbers,String(s)):e.taskNumbers=wi(e.taskNumbers,String(s)),!0}function yA(e){const a=e.trim();if(!a)return{...rb};const r={...rb},s=[],u=[];let c=0;for(;c<a.length;){const h=a[c];if(h==='"'){const p=a.indexOf('"',c+1);if(p===-1){u.push(a.slice(c+1));break}u.push(a.slice(c+1,p)),c=p+1}else if(h===" ")c+=1;else{let p=c;for(;p<a.length&&a[p]!==" ";)p+=1;u.push(a.slice(c,p)),c=p}}let d=0;for(;d<u.length;){const h=u[d];if(sb(h)){d+=1;continue}const p=h.match(lb);if(p){const g=(p[1]??"").toLowerCase();let v=p[2]??"";if(v.trim()===""&&d+1<u.length){let y=d+1;for(;y<u.length&&sb(u[y]);)y+=1;y<u.length&&!u[y].match(lb)&&(v=u[y],d=y)}if(g==="feature"){const y=wi(r.featureNumbers,v);y.size&&(r.featureNumbers=y)}else if(g==="phase"){const y=wi(r.phaseNumbers,v);y.size&&(r.phaseNumbers=y)}else if(g==="task"){const y=wi(r.taskNumbers,v);y.size&&(r.taskNumbers=y)}else if(g==="id"){const y=xA(r.shortIds,v);y.size&&(r.shortIds=y)}else g==="status"?v.trim()&&(r.status=v.toLowerCase()):g==="feature-status"?v.trim()&&(r.featureStatus=v.toLowerCase()):g==="phase-status"?v.trim()&&(r.phaseStatus=v.toLowerCase()):g==="title"&&v.trim()&&(r.text=v.toLowerCase())}else vA(r,h)||s.push(h.toLowerCase());d+=1}return s.length>0&&!r.text&&(r.text=s.join(" ")),r}function bA(e){return!!(e.featureNumbers||e.phaseNumbers||e.taskNumbers||e.shortIds||e.status||e.featureStatus||e.phaseStatus||e.text)}function Ew(e){const a=r=>String(r).padStart(3,"0");return[e.task.title,e.task.shortName??"",e.task.shortId??"",String(e.task.number),`T${a(e.task.number)}`,e.task.description??"",e.task.notes??"",e.phase.title,e.phase.slug??"",e.phase.shortId??"",String(e.phase.number),`P${a(e.phase.number)}`,e.phase.description??"",e.phase.summary??"",e.phase.notes??"",e.feature.name,e.feature.shortId??"",String(e.feature.number),`F${a(e.feature.number)}`,e.feature.description??""].join(" ").toLowerCase()}function wA(e,a,r){if(e.featureNumbers&&!e.featureNumbers.has(a.feature.number)||e.phaseNumbers&&!e.phaseNumbers.has(a.phase.number)||e.taskNumbers&&!e.taskNumbers.has(a.task.number)||e.shortIds&&!(e.shortIds.has(a.task.shortId??"")||e.shortIds.has(a.phase.shortId??"")||e.shortIds.has(a.feature.shortId??""))||e.status&&a.task.status!==e.status||e.featureStatus&&a.feature.status!==e.featureStatus||e.phaseStatus&&a.phase.status!==e.phaseStatus)return!1;if(e.text){const s=e.text;if(!(r??Ew(a)).includes(s))return!1}return!0}function SA({features:e,phases:a,projectStorageScope:r}){const s=dr(r,"show-all-features"),u=dr(r,"tree-open-mode"),c=dr(r,"expanded-features"),d=dr(r,"expanded-phases"),h=dr(r,"feature-status-filters"),p=dr(r,"phase-status-filters"),g=dr(r,"task-status-filters"),v=dr(r,"hide-done"),y=dr(r,"hide-planned"),S=dr(r,"only-active-branches"),N=dr(r,"work-tree-sort"),[w,j]=x.useState(""),[R,M]=x.useState(()=>{if(typeof window>"u")return Mo;try{const me=window.localStorage.getItem(N);if(!me)return Mo;const Ae=JSON.parse(me);if(Ae.key&&Ae.direction)return{key:Ae.key,direction:Ae.direction}}catch{}return Mo}),$=x.useMemo(()=>J2(e,a,R),[e,a,R]),B=x.useMemo(()=>yA(w),[w]),Y=bA(B),ne=x.useMemo(()=>{if(!Y||!B.text)return null;const me=new Map;for(const Ae of $)for(const De of Ae.allPhases)for(const Qe of De.allTasks)me.set(Qe.id,Ew({feature:Ae.feature,phase:De.phase,task:Qe}));return me},[Y,B.text,$]),{matchedTaskIds:ae,matchedFeatureIds:U,matchedPhaseIds:k}=x.useMemo(()=>{const me=new Set,Ae=new Set,De=new Set;if(!Y)return{matchedTaskIds:me,matchedFeatureIds:Ae,matchedPhaseIds:De};for(const Qe of $)for(const Pe of Qe.allPhases)for(const ee of Pe.allTasks)wA(B,{feature:Qe.feature,phase:Pe.phase,task:ee},ne==null?void 0:ne.get(ee.id))&&(me.add(ee.id),Ae.add(Qe.feature.id),De.add(Pe.phase.id));return{matchedTaskIds:me,matchedFeatureIds:Ae,matchedPhaseIds:De}},[Y,B,$,ne]),[re,pe]=x.useState(()=>{if(typeof window>"u")return!0;const me=window.localStorage.getItem(s);return me===null?!0:me==="true"}),[Se,ye]=x.useState(()=>{if(typeof window>"u")return"all";const me=window.localStorage.getItem(u);return me==="smart"||me==="none"||me==="all"?me:"all"}),[he,je]=x.useState(()=>{if(typeof window>"u")return[];try{const me=window.localStorage.getItem(c);return me?JSON.parse(me):[]}catch{return[]}}),[W,L]=x.useState(()=>{if(typeof window>"u")return[];try{const me=window.localStorage.getItem(d);return me?JSON.parse(me):[]}catch{return[]}}),[F,fe]=x.useState(()=>Zh(h,jo,jo)),[P,se]=x.useState(()=>Zh(p,Ro,Ro)),[A,I]=x.useState(()=>Zh(g,ko,ko)),[K,ue]=x.useState(()=>Jh(v,!1)),[ge,xe]=x.useState(()=>Jh(y,!1)),[ke,Ie]=x.useState(()=>Jh(S,!1)),[Ue,Ze]=x.useState([]),[dn,It]=x.useState([]),[pt,ce]=x.useState([]),qe=x.useRef({});x.useEffect(()=>{typeof window>"u"||window.localStorage.setItem(s,String(re))},[re,s]),x.useEffect(()=>{typeof window>"u"||window.localStorage.setItem(u,Se)},[Se,u]),x.useEffect(()=>{typeof window>"u"||window.localStorage.setItem(c,JSON.stringify(he))},[he,c]),x.useEffect(()=>{typeof window>"u"||window.localStorage.setItem(d,JSON.stringify(W))},[W,d]),x.useEffect(()=>{typeof window>"u"||Wh(h,F,jo)},[F,h]),x.useEffect(()=>{typeof window>"u"||Wh(p,P,Ro)},[P,p]),x.useEffect(()=>{typeof window>"u"||Wh(g,A,ko)},[A,g]),x.useEffect(()=>{typeof window>"u"||window.localStorage.setItem(v,String(K))},[K,v]),x.useEffect(()=>{typeof window>"u"||window.localStorage.setItem(y,String(ge))},[ge,y]),x.useEffect(()=>{typeof window>"u"||window.localStorage.setItem(S,String(ke))},[ke,S]),x.useEffect(()=>{typeof window>"u"||window.localStorage.setItem(N,JSON.stringify(R))},[R,N]),x.useEffect(()=>()=>{Object.values(qe.current).forEach(me=>window.clearTimeout(me)),qe.current={}},[]);const st=x.useMemo(()=>{let me=[...F];return K&&(me=me.filter(Ae=>Ae!=="done")),ge&&(me=me.filter(Ae=>Ae!=="planned")),me},[F,K,ge]),Ht=x.useMemo(()=>{let me=[...P];return K&&(me=me.filter(Ae=>Ae!=="done")),ge&&(me=me.filter(Ae=>Ae!=="planned"&&Ae!=="draft")),me},[P,K,ge]),yn=x.useMemo(()=>{let me=[...A];return K&&(me=me.filter(Ae=>Ae!=="done")),ge&&(me=me.filter(Ae=>Ae!=="planned")),me},[A,K,ge]),At=x.useMemo(()=>{if(Y)return $.filter(De=>ci(De.feature.status,st)).map(De=>({...De,allPhases:De.allPhases.filter(Qe=>ci(Qe.phase.status,Ht)).map(Qe=>({...Qe,allTasks:Qe.allTasks.filter(Pe=>ae.has(Pe.id)&&ci(Pe.status,yn))})).filter(Qe=>Qe.allTasks.length>0)})).filter(De=>De.allPhases.length>0);const me=!re||ke;return(re?$:$.filter(De=>De.isActive)).filter(({feature:De})=>ci(De.status,st)).map(De=>({...De,allPhases:De.allPhases.filter(({phase:Qe,hasActiveTask:Pe})=>ci(Qe.status,Ht)?me?Qe.status==="in-progress"||Qe.status==="discovery"||Pe:!0:!1).map(Qe=>({...Qe,allTasks:Qe.allTasks.filter(Pe=>!!ci(Pe.status,yn))})).filter(Qe=>Qe.allTasks.length>0||re||!me)})).filter(({hasActiveTask:De,allPhases:Qe})=>me?De||Qe.some(Pe=>Pe.hasActiveTask):Qe.length>0||re)},[Y,ae,$,st,Ht,yn,ke,re]);x.useEffect(()=>{if(Se==="none"){je([]),L([]);return}if(Se==="all"){je(At.filter(({feature:De})=>De.status!=="done").map(({feature:De})=>De.id)),L(At.flatMap(({allPhases:De})=>De.map(({phase:Qe})=>Qe.id)));return}const me=new Set(At.map(({feature:De})=>De.id)),Ae=new Set(At.flatMap(({allPhases:De})=>De.map(({phase:Qe})=>Qe.id)));je(De=>De.filter(Qe=>me.has(Qe))),L(De=>De.filter(Qe=>Ae.has(Qe)))},[At,Se]),x.useEffect(()=>{Y&&(ye("smart"),je(Array.from(U)),L(Array.from(k)))},[Y,U,k]);const $t=me=>{ye("smart"),je(Ae=>Ae.includes(me)?Ae.filter(De=>De!==me):[...Ae,me])},Wt=me=>{ye("smart"),L(Ae=>Ae.includes(me)?Ae.filter(De=>De!==me):[...Ae,me])},Fn=()=>{ye("smart"),je(At.map(({feature:me})=>me.id)),L(At.flatMap(({allPhases:me})=>me.map(({phase:Ae})=>Ae.id)))},Vn=()=>{ye("smart"),je([]),L([])},rn=x.useMemo(()=>{const me=new Set(At.map(({feature:Pe})=>Pe.id)),Ae=new Set(At.flatMap(({allPhases:Pe})=>Pe.map(({phase:ee})=>ee.id)));if(me.size===0)return!1;const De=Array.from(me).every(Pe=>he.includes(Pe)),Qe=Array.from(Ae).every(Pe=>W.includes(Pe));return De&&Qe},[At,he,W]);return x.useEffect(()=>{const me=(De,Qe)=>{const Pe=Qe.filter(ee=>!!ee);for(const ee of Pe){const Dt=`${De}:${ee}`,Jt=De==="feature"?Ze:De==="phase"?It:ce;Jt(Qn=>Qn.includes(ee)?Qn:[...Qn,ee]),qe.current[Dt]!==void 0&&window.clearTimeout(qe.current[Dt]),qe.current[Dt]=window.setTimeout(()=>{Jt(Qn=>Qn.filter(bn=>bn!==ee)),delete qe.current[Dt]},X2)}},Ae=De=>{var ee,Dt,Jt,Qn,bn,qa;const Pe=De.detail;if(Pe!=null&&Pe.type){if(Pe.type==="features-updated"){const _e=((ee=Pe.data)==null?void 0:ee.featureId)??((Dt=Pe.data)==null?void 0:Dt.id);me("feature",[_e]),_e&&(ye("smart"),je(bt=>bt.includes(_e)?bt:[...bt,_e]));return}if(Pe.type==="phases-updated"){const _e=(Jt=Pe.data)==null?void 0:Jt.featureId,bt=((Qn=Pe.data)==null?void 0:Qn.phaseId)??((bn=Pe.data)==null?void 0:bn.id);me("phase",[bt]),me("feature",[_e]),me("task",[(qa=Pe.data)==null?void 0:qa.taskId]),ye("smart"),_e&&je(wt=>wt.includes(_e)?wt:[...wt,_e]),bt&&L(wt=>wt.includes(bt)?wt:[...wt,bt])}}};return window.addEventListener("agent-plan:ws-event",Ae),()=>{window.removeEventListener("agent-plan:ws-event",Ae)}},[]),{workTree:$,displayedWorkTree:At,treeOpenMode:Se,setTreeOpenMode:ye,expandAll:Fn,collapseAll:Vn,isAllExpanded:rn,expandedFeatureIds:he,expandedPhaseIds:W,setExpandedFeatureIds:je,setExpandedPhaseIds:L,toggleExpandedFeature:$t,toggleExpandedPhase:Wt,recentFeatureIds:Ue,recentPhaseIds:dn,recentTaskIds:pt,setRecentTaskIds:ce,showAllFeatures:re,setShowAllFeatures:pe,featureStatusFilters:F,phaseStatusFilters:P,taskStatusFilters:A,hideDone:K,setHideDone:ue,hidePlanned:ge,setHidePlanned:xe,onlyActiveBranches:ke,setOnlyActiveBranches:Ie,resetFilters:()=>{j(""),pe(!0),ue(!1),xe(!1),fe(jo),se(Ro),I(ko),Ie(!1),M(Mo),ye("all")},toggleFeatureStatusFilter:me=>fe(Ae=>Kh(Ae,me,jo)),togglePhaseStatusFilter:me=>se(Ae=>Kh(Ae,me,Ro)),toggleTaskStatusFilter:me=>I(Ae=>Kh(Ae,me,ko)),searchQuery:w,setSearchQuery:j,searchActive:Y,matchedTaskIds:ae,matchedFeatureIds:U,matchedPhaseIds:k,sort:R,setSort:M}}function Ai({id:e,status:a,variant:r="header",className:s,children:u,ariaLabel:c}){const d=r==="surface"?s2(a):i2(a),h=Jm(a),p=["status-item",r==="surface"?"status-item--surface":"status-item--header",h,s??""].filter(Boolean).join(" ");return i.jsx("div",{id:e,className:p,style:d,"aria-label":c,"data-status":a,children:u})}function cl(e){if(!e)return"";try{return new Intl.DateTimeFormat(void 0,{dateStyle:"medium",timeStyle:"short"}).format(new Date(e))}catch{return e}}function fl({value:e,className:a=""}){if(!e)return null;const r=`Last updated ${cl(e)}`;return i.jsx("time",{dateTime:e,title:r,"aria-label":r,className:`text-[11px] text-[var(--text-subtle)] ${a}`.trim(),children:r})}const jw=x.createContext(null);function pp({id:e,children:a}){const r=fA({id:e}),s={transform:Yl.Transform.toString(r.transform),transition:r.transition};return i.jsx(jw.Provider,{value:r,children:i.jsx("div",{ref:r.setNodeRef,style:s,className:r.isDragging?"ap-sortable--dragging":"",children:a})})}function gp(){const e=x.useContext(jw);return e?i.jsx("button",{type:"button",className:"drag-handle","aria-label":"Drag to reorder",title:"Drag to reorder",...e.listeners,...e.attributes,children:i.jsx(Xj,{className:"h-4 w-4"})}):null}function Rw({phaseId:e,phaseTitle:a,count:r,className:s=""}){if(r<1)return null;const u=`${r} linked requirement${r===1?"":"s"} for phase ${a}`;return i.jsxs(Ve,{to:`/requirements#phase-${e}`,"aria-label":u,title:u,className:`inline-flex min-h-7 items-center gap-1 rounded-md border border-[var(--border)] bg-[var(--surface-elevated)] px-1.5 text-xs font-semibold text-[var(--text-muted)] transition hover:border-[var(--accent)] hover:text-[var(--accent)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--accent)] ${s}`,children:[i.jsx(nc,{"aria-hidden":"true",className:"h-3.5 w-3.5 shrink-0"}),i.jsx("span",{"aria-hidden":"true",children:r})]})}const xp="mt-1 block min-w-0 break-words font-mono text-sm font-semibold leading-snug [overflow-wrap:anywhere]";function NA(){return i.jsx("span",{className:"rounded-full bg-[color:color-mix(in_srgb,var(--accent)_16%,transparent)] px-2 py-0.5 text-[10px] font-semibold uppercase tracking-[0.12em] text-[var(--accent)]",children:"Updated"})}function vp({priority:e}){if(e==null)return null;const a=`P${e}`;return i.jsx("span",{className:"inline-flex shrink-0 items-center rounded-full border border-[var(--border)] bg-[var(--surface-elevated)] px-2 py-0.5 text-[10px] font-semibold uppercase tracking-[0.08em] text-[var(--text-muted)]","aria-label":`Priority ${e}`,title:`Priority ${e}`,children:a})}function ib({status:e,doneTasks:a,totalTasks:r,recentlyChanged:s,className:u}){const c=a!=null&&r!=null;return i.jsxs("div",{className:u,children:[s?i.jsx(NA,{}):null,c?i.jsxs("span",{className:"text-xs text-[var(--text-muted)]",children:["(",a,"/",r||0,")"]}):null,i.jsx("span",{className:"shrink-0",children:i.jsx(hr,{status:e})})]})}function EA({entry:e,expanded:a,recentlyChanged:r,onToggle:s,isPhaseExpanded:u,onTogglePhase:c,isPhaseRecentlyChanged:d,isTaskRecentlyChanged:h,highlightedTaskIds:p,resumeRequiredIds:g=new Set}){const{feature:v,totalTasks:y,doneTasks:S,allPhases:N,hasActiveTask:w}=e;return i.jsxs("div",{className:`surface-card min-w-0 rounded-[10px] px-3 py-3 transition-colors sm:px-4 ${r?"ring-1 ring-[color:color-mix(in_srgb,var(--accent)_55%,transparent)] bg-[color:color-mix(in_srgb,var(--accent)_12%,transparent)]":""}`,children:[i.jsxs(Ai,{status:e.display.displayStatus,variant:"header",className:`flex min-w-0 flex-col gap-1.5 rounded-[10px] px-1 py-1 transition-colors hover:bg-[var(--accent-soft)] sm:flex-row sm:items-start sm:justify-between sm:gap-3 ${r?"bg-[color:color-mix(in_srgb,var(--accent)_10%,transparent)]":""}`,children:[i.jsxs("div",{className:"flex min-w-0 items-start gap-2 sm:flex-1",children:[i.jsx("button",{type:"button",onClick:j=>{j.stopPropagation(),s()},onPointerDown:j=>j.stopPropagation(),className:"mt-0.5 inline-flex h-5 w-5 shrink-0 items-center justify-center rounded text-[var(--text-subtle)] hover:bg-[var(--surface-elevated)] hover:text-[var(--text)]","aria-label":a?`Collapse feature ${v.name}`:`Expand feature ${v.name}`,"aria-expanded":a,children:i.jsx(y0,{className:`h-4 w-4 transition ${a?"rotate-90":"rotate-0"}`})}),i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[i.jsx(gp,{}),i.jsx(ar,{featureNum:v.number,featureId:v.id}),i.jsx(lr,{id:ul({featureNum:v.number}),children:i.jsx("span",{className:"sr-only",children:"Copy feature path"})}),v.shortId?i.jsx(dl,{shortId:v.shortId}):null,i.jsx(vp,{priority:v.priority}),w?i.jsx("span",{"aria-hidden":"true",className:"ap-progress-dot"}):null]}),i.jsx(Qu,{status:e.display.displayStatus,breakdown:e.display.breakdown,doneTasks:S,totalTasks:y,recentlyChanged:r,className:"mt-1 flex flex-wrap items-center gap-2 sm:hidden"}),i.jsx(Ve,{to:`/features/${v.id}`,className:`entity-link--feature ${xp} underline-offset-4 hover:underline`,children:v.name}),i.jsx(fl,{value:v.updatedAt,className:"mt-1 block"})]})]}),i.jsx(Qu,{status:e.display.displayStatus,breakdown:e.display.breakdown,doneTasks:S,totalTasks:y,recentlyChanged:r,className:"hidden shrink-0 items-center gap-2 sm:flex"})]}),a&&N.length>0?i.jsx("div",{className:"mt-2 ml-1.5 grid grid-cols-1 gap-2 border-l pl-3 sm:ml-4 sm:pl-4",style:{borderLeftColor:M0(e.display.displayStatus)},children:i.jsx(fp,{items:N.map(j=>j.phase.id),strategy:dp,children:N.map(j=>i.jsx(pp,{id:j.phase.id,children:i.jsx(jA,{feature:v,phaseEntry:j,expanded:u(j.phase.id),recentlyChanged:d(j.phase.id),onToggle:()=>c(j.phase.id),isTaskRecentlyChanged:h,highlightedTaskIds:p,resumeRequiredIds:g})},j.phase.id))})}):null]})}function jA({feature:e,phaseEntry:a,expanded:r,recentlyChanged:s,onToggle:u,isTaskRecentlyChanged:c,highlightedTaskIds:d,resumeRequiredIds:h=new Set}){var N;const{phase:p,totalTasks:g,doneTasks:v,allTasks:y,hasActiveTask:S}=a;return i.jsxs("div",{className:`work-tree-row grid min-w-0 grid-cols-1 gap-2 rounded-[10px] p-3 transition-colors ${s?"ring-1 ring-[color:color-mix(in_srgb,var(--accent)_55%,transparent)] bg-[color:color-mix(in_srgb,var(--accent)_12%,transparent)]":""}`,children:[i.jsxs(Ai,{status:a.display.displayStatus,variant:"header",className:`flex min-w-0 flex-col gap-1.5 rounded-[10px] px-1 py-1 transition-colors hover:bg-[var(--accent-soft)] sm:flex-row sm:items-start sm:justify-between sm:gap-3 ${s?"bg-[color:color-mix(in_srgb,var(--accent)_8%,transparent)]":""}`,children:[i.jsxs("div",{className:"flex min-w-0 items-start gap-2 sm:flex-1",children:[i.jsx("button",{type:"button",onClick:w=>{w.stopPropagation(),u()},onPointerDown:w=>w.stopPropagation(),className:"mt-0.5 inline-flex h-5 w-5 shrink-0 items-center justify-center rounded text-[var(--text-subtle)] hover:bg-[var(--surface-elevated)] hover:text-[var(--text)]","aria-label":r?`Collapse phase ${p.title}`:`Expand phase ${p.title}`,"aria-expanded":r,children:i.jsx(y0,{className:`h-4 w-4 transition ${r?"rotate-90":"rotate-0"}`})}),i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[i.jsx(gp,{}),i.jsx(ar,{featureNum:e==null?void 0:e.number,phaseNum:p.number,featureId:e.id,phaseId:p.id}),i.jsx(lr,{id:ul({featureNum:e==null?void 0:e.number,phaseNum:p.number}),children:i.jsx("span",{className:"sr-only",children:"Copy phase path"})}),p.shortId?i.jsx(dl,{shortId:p.shortId}):null,i.jsx(vp,{priority:p.priority}),p.handoff?i.jsx(Wm,{phaseId:p.id,updatedAt:p.handoffUpdatedAt}):null,i.jsx(Rw,{phaseId:p.id,phaseTitle:p.title,count:((N=p.linkedRequirements)==null?void 0:N.length)??0}),S?i.jsx("span",{"aria-hidden":"true",className:"ap-progress-dot"}):null]}),i.jsx(Qu,{status:a.display.displayStatus,breakdown:a.display.breakdown,doneTasks:v,totalTasks:g,recentlyChanged:s,className:"mt-1 flex flex-wrap items-center gap-2 sm:hidden"}),i.jsx(Ve,{to:`/features/${e.id}/phases/${p.id}`,className:`entity-link--phase ${xp} underline-offset-4 hover:underline`,children:p.title}),i.jsx(fl,{value:p.updatedAt,className:"mt-1 block"})]})]}),i.jsx(Qu,{status:a.display.displayStatus,breakdown:a.display.breakdown,doneTasks:v,totalTasks:g,recentlyChanged:s,className:"hidden shrink-0 items-center gap-2 sm:flex"})]}),r?y.length>0?i.jsx("div",{className:"ml-1.5 grid grid-cols-1 gap-1 border-l pl-3 sm:ml-4 sm:pl-4",style:{borderLeftColor:M0(a.display.displayStatus)},children:i.jsx(fp,{items:y.map(w=>w.id),strategy:dp,children:y.map(w=>i.jsx(pp,{id:w.id,children:i.jsx(RA,{feature:e,phase:p,task:w,recentlyChanged:c(w.id),highlighted:d==null?void 0:d.has(w.id),resumeRequiredIds:h})},w.id))})}):i.jsx("p",{className:"ml-1.5 text-xs italic text-[var(--text-subtle)] sm:ml-4",children:"No tasks"}):null]})}function RA({feature:e,phase:a,task:r,recentlyChanged:s,highlighted:u,resumeRequiredIds:c=new Set}){return i.jsxs(Ai,{id:`task-row-${r.number}`,status:r.status,variant:"surface",className:`flex min-w-0 flex-col gap-1.5 rounded-[10px] px-2 py-2 transition-colors hover:bg-[var(--accent-soft)] sm:flex-row sm:items-start sm:justify-between sm:gap-3 ${s?"ring-1 ring-[color:color-mix(in_srgb,var(--accent)_55%,transparent)] bg-[color:color-mix(in_srgb,var(--accent)_12%,transparent)]":""} ${u?"ap-search-hit":""}`,children:[i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[i.jsx(gp,{}),i.jsx(ar,{featureNum:e==null?void 0:e.number,phaseNum:a.number,taskNum:r.number,featureId:e.id,phaseId:a.id,taskId:r.id}),i.jsx(lr,{id:ul({featureNum:e==null?void 0:e.number,phaseNum:a.number,taskNum:r.number}),children:i.jsx("span",{className:"sr-only",children:"Copy task path"})}),r.shortId?i.jsx(dl,{shortId:r.shortId}):null,i.jsx(vp,{priority:r.priority}),r.status==="in-progress"?i.jsx("span",{"aria-hidden":"true",className:"ap-progress-dot"}):null,c!=null&&c.has(r.id)?i.jsx("span",{title:"Paused and ready for resume — resume this task before starting new work.","aria-label":"Resume required",className:"inline-flex items-center text-[var(--accent)]",children:i.jsx(N0,{className:"h-3.5 w-3.5"})}):null]}),i.jsx(ib,{status:r.status,recentlyChanged:s,className:"mt-1 flex flex-wrap items-center gap-2 sm:hidden"}),i.jsx(Ve,{to:`/features/${e.id}/phases/${a.id}/tasks/${r.id}`,className:`entity-link--task ${xp} underline-offset-4 hover:underline`,children:r.title}),i.jsx(fl,{value:r.updatedAt,className:"mt-1 block"})]}),i.jsx(ib,{status:r.status,recentlyChanged:s,className:"hidden shrink-0 items-center gap-2 sm:flex"})]})}var O=(function(e){return e.FIELD_NAME="FIELD_NAME",e.COLON="COLON",e.VALUE="VALUE",e.QUOTED_VALUE="QUOTED_VALUE",e.AND="AND",e.OR="OR",e.NOT="NOT",e.COMPARISON_OP="COMPARISON_OP",e.LPAREN="LPAREN",e.RPAREN="RPAREN",e.SAVED_SEARCH="SAVED_SEARCH",e.HISTORY_REF="HISTORY_REF",e.PREFIX_OP="PREFIX_OP",e.WILDCARD="WILDCARD",e.REGEX="REGEX",e.RANGE="RANGE",e.TILDE="TILDE",e.BOOST="BOOST",e.WHITESPACE="WHITESPACE",e.UNKNOWN="UNKNOWN",e})({}),da=(function(e){return e[e.EXPECT_TERM=0]="EXPECT_TERM",e[e.EXPECT_VALUE=1]="EXPECT_VALUE",e})(da||{}),vi=class{constructor(e,a){vn(this,"input");vn(this,"pos");vn(this,"state");vn(this,"tokens");vn(this,"options");this.input=e,this.pos=0,this.state=da.EXPECT_TERM,this.tokens=[],this.options=a||{}}tokenize(){for(this.tokens=[],this.pos=0,this.state=da.EXPECT_TERM;this.pos<this.input.length;)this.state===da.EXPECT_VALUE?this.readValue():this.readTerm();return this.tokens}peek(){return this.input[this.pos]}peekAt(e){return this.input[this.pos+e]}advance(){return this.input[this.pos++]}isWhitespace(e){return e===" "||e===" "||e===`
313
- `||e==="\r"}isAlpha(e){return/[a-zA-Z_]/.test(e)}isAlphaNumeric(e){return/[a-zA-Z0-9_.\-]/.test(e)}readWhitespace(){const e=this.pos;for(;this.pos<this.input.length&&this.isWhitespace(this.peek());)this.advance();this.tokens.push({type:O.WHITESPACE,value:this.input.slice(e,this.pos),start:e,end:this.pos})}readQuotedString(){const e=this.pos,a=this.advance();for(;this.pos<this.input.length;){const r=this.advance();if(r==="\\"&&this.pos<this.input.length)this.advance();else if(r===a)break}this.tokens.push({type:O.QUOTED_VALUE,value:this.input.slice(e,this.pos),start:e,end:this.pos}),this.tryReadModifier(),this.state=da.EXPECT_TERM}readTerm(){const e=this.peek();if(this.isWhitespace(e)){this.readWhitespace();return}if(e==='"'){this.readQuotedString();return}if(e==="("){this.tokens.push({type:O.LPAREN,value:"(",start:this.pos,end:this.pos+1}),this.advance();return}if(e===")"){this.tokens.push({type:O.RPAREN,value:")",start:this.pos,end:this.pos+1}),this.advance();return}if(e==="~"||e==="^"){const r=this.pos,s=e==="~"?O.TILDE:O.BOOST;for(this.advance();this.pos<this.input.length&&/[0-9.]/.test(this.peek());)this.advance();this.tokens.push({type:s,value:this.input.slice(r,this.pos),start:r,end:this.pos});return}if(e==="["||e==="{"){this.readRangeValue();return}if(e==="#"&&this.options.savedSearches){this.readSavedSearch();return}if(e==="!"&&this.options.historySearch){this.readHistoryRef();return}if(e==="-"||e==="+"){const r=this.peekAt(1);if(r&&(this.isAlpha(r)||r==='"'||r==="("||r==="#"||r==="!"||r==="["||r==="{")||!r||r===")"||r===" "||r===" "||r===`
314
- `||r==="\r"){this.tokens.push({type:O.PREFIX_OP,value:e,start:this.pos,end:this.pos+1}),this.advance();return}}if(e==="&"&&this.peekAt(1)==="&"){this.tokens.push({type:O.AND,value:"&&",start:this.pos,end:this.pos+2}),this.advance(),this.advance();return}if(e==="|"&&this.peekAt(1)==="|"){this.tokens.push({type:O.OR,value:"||",start:this.pos,end:this.pos+2}),this.advance(),this.advance();return}if((e===">"||e==="<")&&this.state===da.EXPECT_TERM){const r=this.pos;this.advance(),this.pos<this.input.length&&this.peek()==="="&&this.advance(),this.tokens.push({type:O.COMPARISON_OP,value:this.input.slice(r,this.pos),start:r,end:this.pos}),this.state=da.EXPECT_VALUE;return}if(e==="/"){this.readRegex();return}const a=this.pos;for(;this.pos<this.input.length&&!this.isWhitespace(this.peek())&&this.peek()!=="("&&this.peek()!==")"&&this.peek()!=='"'&&this.peek()!=="~"&&this.peek()!=="^"&&!(this.peek()==="&"&&this.peekAt(1)==="&")&&!(this.peek()==="|"&&this.peekAt(1)==="|");){if(this.peek()==="\\"&&this.pos+1<this.input.length){this.advance(),this.advance();continue}if(this.peek()===":"){this.pos>a&&this.tokens.push({type:O.FIELD_NAME,value:this.input.slice(a,this.pos),start:a,end:this.pos}),this.tokens.push({type:O.COLON,value:":",start:this.pos,end:this.pos+1}),this.advance(),this.state=da.EXPECT_VALUE;return}this.advance()}if(this.pos>a){const r=this.input.slice(a,this.pos),s=r.toUpperCase();s==="AND"?this.tokens.push({type:O.AND,value:r,start:a,end:this.pos}):s==="OR"?this.tokens.push({type:O.OR,value:r,start:a,end:this.pos}):s==="NOT"?this.tokens.push({type:O.NOT,value:r,start:a,end:this.pos}):r.includes("*")||r.includes("?")?this.tokens.push({type:O.WILDCARD,value:r,start:a,end:this.pos}):this.tokens.push({type:O.VALUE,value:r,start:a,end:this.pos}),this.tryReadModifier()}}readValue(){const e=this.peek();if(this.isWhitespace(e)){this.readWhitespace(),this.state=da.EXPECT_TERM;return}if(e==='"'){this.readQuotedString(),this.state=da.EXPECT_TERM;return}if(e==="("||e===")"){this.state=da.EXPECT_TERM,this.readTerm();return}if(e===">"||e==="<"){const r=this.pos;this.advance(),this.pos<this.input.length&&this.peek()==="="&&this.advance(),this.tokens.push({type:O.COMPARISON_OP,value:this.input.slice(r,this.pos),start:r,end:this.pos});return}if(e==="["||e==="{"){this.readRangeValue();return}if(e==="/"){this.readRegex(),this.state=da.EXPECT_TERM;return}const a=this.pos;for(;this.pos<this.input.length&&!this.isWhitespace(this.peek())&&this.peek()!==")"&&this.peek()!=="("&&this.peek()!=='"'&&this.peek()!=="~"&&this.peek()!=="^";){if(this.peek()==="\\"&&this.pos+1<this.input.length){this.advance(),this.advance();continue}this.advance()}if(this.pos>a){const r=this.input.slice(a,this.pos);r.includes("*")||r.includes("?")?this.tokens.push({type:O.WILDCARD,value:r,start:a,end:this.pos}):this.tokens.push({type:O.VALUE,value:r,start:a,end:this.pos}),this.tryReadModifier()}this.state=da.EXPECT_TERM}readRangeValue(){const e=this.pos;for(this.advance();this.pos<this.input.length&&this.peek()!=="]"&&this.peek()!=="}";)this.advance();this.pos<this.input.length&&(this.peek()==="]"||this.peek()==="}")&&this.advance(),this.tokens.push({type:O.RANGE,value:this.input.slice(e,this.pos),start:e,end:this.pos}),this.state=da.EXPECT_TERM}tryReadModifier(){for(;this.pos<this.input.length&&(this.peek()==="~"||this.peek()==="^");){const e=this.pos,a=this.advance()==="~"?O.TILDE:O.BOOST;for(;this.pos<this.input.length&&/[0-9.]/.test(this.peek());)this.advance();this.tokens.push({type:a,value:this.input.slice(e,this.pos),start:e,end:this.pos})}}readRegex(){const e=this.pos;for(this.advance();this.pos<this.input.length;){const a=this.peek();if(a==="\\"&&this.pos+1<this.input.length){this.advance(),this.advance();continue}if(a==="/"){this.advance(),this.tokens.push({type:O.REGEX,value:this.input.slice(e,this.pos),start:e,end:this.pos}),this.tryReadModifier(),this.state=da.EXPECT_TERM;return}this.advance()}this.tokens.push({type:O.VALUE,value:this.input.slice(e,this.pos),start:e,end:this.pos}),this.state=da.EXPECT_TERM}readSavedSearch(){const e=this.pos;for(this.advance();this.pos<this.input.length&&this.isAlphaNumeric(this.peek());)this.advance();this.tokens.push({type:O.SAVED_SEARCH,value:this.input.slice(e,this.pos),start:e,end:this.pos})}readHistoryRef(){const e=this.pos;for(this.advance();this.pos<this.input.length&&this.isAlphaNumeric(this.peek());)this.advance();this.tokens.push({type:O.HISTORY_REF,value:this.input.slice(e,this.pos),start:e,end:this.pos})}},Ns=class{constructor(e){vn(this,"tokens");vn(this,"pos");vn(this,"nonWsTokens");vn(this,"errors",[]);this.tokens=e,this.nonWsTokens=e.filter(a=>a.type!==O.WHITESPACE),this.pos=0}getErrors(){return this.errors}isUnclosedQuote(e){if(e.type!==O.QUOTED_VALUE)return!1;const a=e.value;if(a.length<2)return!0;const r=a[0];return a[a.length-1]!==r}stripQuotes(e){const a=e.value;return this.isUnclosedQuote(e)?a.slice(1):a.slice(1,-1)}checkUnclosedQuote(e){this.isUnclosedQuote(e)&&this.errors.push({type:"Error",value:e.value[0],message:"Missing closing quote",start:e.start,end:e.start+1})}parse(){if(this.nonWsTokens.length===0)return null;let e=this.parseOr();for(;this.peek();){const a=this.peek();if(a.type===O.RPAREN)this.advance(),this.errors.push({type:"Error",value:a.value,message:"Unexpected closing parenthesis",start:a.start,end:a.end});else{const r=this.parseOr();e={type:"BooleanExpr",operator:"AND",left:e,right:r,implicit:!0,start:e.start,end:r.end}}}return e}peek(){return this.nonWsTokens[this.pos]}advance(){return this.nonWsTokens[this.pos++]}match(e){var a;if(((a=this.peek())==null?void 0:a.type)===e)return this.advance()}parseOr(){var a;let e=this.parseAnd();for(;((a=this.peek())==null?void 0:a.type)===O.OR;){const r=this.advance(),s=this.parseAnd();if(s.type==="Error"&&s.value===""){this.errors.push({type:"Error",value:r.value,message:"Missing search term after OR",start:r.start,end:r.end});break}e={type:"BooleanExpr",operator:"OR",left:e,right:s,sourceOperator:r.value,start:e.start,end:s.end}}return e}parseAnd(){let e=this.parseNot();for(;;){const a=this.peek();if(!a)break;if(a.type===O.AND){const r=this.advance(),s=this.parseNot();if(s.type==="Error"&&s.value===""){this.errors.push({type:"Error",value:r.value,message:"Missing search term after AND",start:r.start,end:r.end});break}e={type:"BooleanExpr",operator:"AND",left:e,right:s,sourceOperator:r.value,start:e.start,end:s.end}}else{if(a.type===O.OR||a.type===O.RPAREN)break;{const r=this.parseNot();e={type:"BooleanExpr",operator:"AND",left:e,right:r,implicit:!0,start:e.start,end:r.end}}}}return e}parseNot(){var e;if(((e=this.peek())==null?void 0:e.type)===O.NOT){const a=this.advance(),r=this.parsePrimary();return r.type==="Error"&&r.value===""?(this.errors.push({type:"Error",value:a.value,message:"Missing search term after NOT",start:a.start,end:a.end}),r):{type:"Not",expression:r,sourceOperator:a.value,start:a.start,end:r.end}}return this.parsePrimary()}applyGroupBoost(e){var a;if(((a=this.peek())==null?void 0:a.type)===O.BOOST){const r=this.advance(),s=r.value.slice(1),u=parseFloat(s);e.boost=isNaN(u)?1:u,e.end=r.end}return e}applyModifiers(e){var a,r;if(e.type!=="BareTerm"&&e.type!=="FieldValue")return e;if(((a=this.peek())==null?void 0:a.type)===O.TILDE){const s=this.advance(),u=s.value.slice(1),c=parseInt(u,10);e.quoted?e.proximity=isNaN(c)?0:c:e.fuzzy=isNaN(c)?0:c,e.end=s.end}if(((r=this.peek())==null?void 0:r.type)===O.BOOST){const s=this.advance(),u=s.value.slice(1),c=parseFloat(u);e.boost=isNaN(c)?1:c,e.end=s.end}return e}parseRangeBound(e,a){const r=e.length-e.trimStart().length,s=e.trim();return s.startsWith('"')&&s.endsWith('"')&&s.length>=2?{value:s.slice(1,-1),quoted:!0,valueStart:a+r,valueEnd:a+r+s.length}:s.startsWith('"')?{value:s.slice(1),quoted:!0,valueStart:a+r,valueEnd:a+r+s.length}:{value:s,quoted:!1,valueStart:a+r,valueEnd:a+r+s.length}}parseRange(e){const a=e.value,r=a[0],s=r==="[",u=a[a.length-1],c=u==="]"||u==="}",d=u==="]";c||this.errors.push({type:"Error",value:r,message:"Unclosed range expression",start:e.start,end:e.start+1});const h=c?a.slice(1,-1):a.slice(1),p=h.match(/^(.*?)\s+[Tt][Oo]\s+(.*)$/),g=e.start+1;if(!p){this.errors.push({type:"Error",value:a,message:"Range expression missing TO keyword",start:e.start,end:e.end});const N=this.parseRangeBound(h,g);return{type:"Range",lower:N.value,upper:"",lowerInclusive:s,upperInclusive:c?d:!0,lowerQuoted:N.quoted,upperQuoted:!1,lowerStart:N.valueStart,lowerEnd:N.valueEnd,upperStart:e.end,upperEnd:e.end,start:e.start,end:e.end}}const v=this.parseRangeBound(p[1],g),y=g+p[1].length+(h.length-p[1].length-p[2].length),S=this.parseRangeBound(p[2],y);return{type:"Range",lower:v.value,upper:S.value,lowerInclusive:s,upperInclusive:c?d:!0,lowerQuoted:v.quoted,upperQuoted:S.quoted,lowerStart:v.valueStart,lowerEnd:v.valueEnd,upperStart:S.valueStart,upperEnd:S.valueEnd,start:e.start,end:e.end}}parsePrimary(){var r,s,u;const e=this.peek();if(!e)return{type:"Error",value:"",message:"Unexpected end of input",start:this.nonWsTokens.length>0?this.nonWsTokens[this.nonWsTokens.length-1].end:0,end:this.nonWsTokens.length>0?this.nonWsTokens[this.nonWsTokens.length-1].end:0};if(e.type===O.AND){const c=this.advance();return this.errors.push({type:"Error",value:c.value,message:"Unexpected AND",start:c.start,end:c.end}),this.parsePrimary()}if(e.type===O.OR){const c=this.advance();return this.errors.push({type:"Error",value:c.value,message:"Unexpected OR",start:c.start,end:c.end}),this.parsePrimary()}if(e.type===O.PREFIX_OP){const c=this.advance(),d=this.parsePrimary();return c.value==="-"?{type:"Not",expression:d,sourceOperator:c.value,start:c.start,end:d.end}:{...d,start:c.start}}if(e.type===O.LPAREN){const c=this.advance();if(!this.peek()||this.peek().type===O.RPAREN){const g=this.match(O.RPAREN);g||this.errors.push({type:"Error",value:c.value,message:"Unclosed parenthesis",start:c.start,end:c.end});const v={type:"Group",expression:{type:"BareTerm",value:"",quoted:!1,start:c.end,end:c.end},start:c.start,end:g?g.end:c.end};return this.applyGroupBoost(v)}const d=this.parseOr(),h=this.match(O.RPAREN);h||this.errors.push({type:"Error",value:c.value,message:"Missing closing parenthesis",start:c.start,end:c.end});const p={type:"Group",expression:d,start:c.start,end:h?h.end:d.end};return this.applyGroupBoost(p)}if(e.type===O.SAVED_SEARCH){const c=this.advance();return{type:"SavedSearch",name:c.value.slice(1),start:c.start,end:c.end}}if(e.type===O.HISTORY_REF){const c=this.advance();return{type:"HistoryRef",ref:c.value.slice(1),start:c.start,end:c.end}}if(e.type===O.FIELD_NAME){const c=this.advance(),d=this.match(O.COLON);if(d){let h=":";const p=this.match(O.COMPARISON_OP);if(p&&(h=p.value),((r=this.peek())==null?void 0:r.type)===O.LPAREN){const v=this.advance();if(!this.peek()||this.peek().type===O.RPAREN){const w=this.match(O.RPAREN);w||this.errors.push({type:"Error",value:v.value,message:"Unclosed parenthesis",start:v.start,end:v.end});const j={type:"FieldGroup",field:c.value,expression:{type:"BareTerm",value:"",quoted:!1,start:v.end,end:v.end},start:c.start,end:w?w.end:v.end};return this.applyGroupBoost(j)}const y=this.parseOr(),S=this.match(O.RPAREN);S||this.errors.push({type:"Error",value:v.value,message:"Missing closing parenthesis",start:v.start,end:v.end});const N={type:"FieldGroup",field:c.value,expression:y,start:c.start,end:S?S.end:y.end};return this.applyGroupBoost(N)}if(((s=this.peek())==null?void 0:s.type)===O.RANGE){const v=this.advance(),y=this.parseRange(v);return y.field=c.value,y.start=c.start,y}if(((u=this.peek())==null?void 0:u.type)===O.REGEX){const v=this.advance();return{type:"Regex",pattern:v.value.slice(1,-1),start:c.start,end:v.end}}const g=this.peek();if(g&&(g.type===O.VALUE||g.type===O.QUOTED_VALUE||g.type===O.WILDCARD)){const v=this.advance(),y=v.type===O.QUOTED_VALUE;y&&this.checkUnclosedQuote(v);const S=y?this.stripQuotes(v):v.value;return this.applyModifiers({type:"FieldValue",field:c.value,operator:h,value:S,quoted:y,start:c.start,end:v.end})}return{type:"FieldValue",field:c.value,operator:h,value:"",quoted:!1,start:c.start,end:p?p.end:d.end}}return{type:"BareTerm",value:c.value,quoted:!1,start:c.start,end:c.end}}if(e.type===O.COMPARISON_OP){const c=this.advance(),d=this.peek();if(d&&(d.type===O.VALUE||d.type===O.QUOTED_VALUE)){const h=this.advance();return{type:"BareTerm",value:c.value+h.value,quoted:!1,start:c.start,end:h.end}}return{type:"Error",value:c.value,message:"Comparison operator without value",start:c.start,end:c.end}}if(e.type===O.QUOTED_VALUE){const c=this.advance();return this.checkUnclosedQuote(c),this.applyModifiers({type:"BareTerm",value:this.stripQuotes(c),quoted:!0,start:c.start,end:c.end})}if(e.type===O.WILDCARD){const c=this.advance();return this.applyModifiers({type:"BareTerm",value:c.value,quoted:!1,start:c.start,end:c.end})}if(e.type===O.RANGE){const c=this.advance();return this.parseRange(c)}if(e.type===O.REGEX){const c=this.advance();return{type:"Regex",pattern:c.value.slice(1,-1),start:c.start,end:c.end}}if(e.type===O.VALUE){const c=this.advance();return this.applyModifiers({type:"BareTerm",value:c.value,quoted:!1,start:c.start,end:c.end})}if(e.type===O.RPAREN){const c=this.advance();return this.errors.push({type:"Error",value:c.value,message:"Unexpected closing parenthesis",start:c.start,end:c.end}),{type:"Error",value:c.value,message:"Unexpected closing parenthesis",start:c.start,end:c.end}}const a=this.advance();return{type:"Error",value:a.value,message:`Unexpected token: ${a.value}`,start:a.start,end:a.end}}static getCursorContext(e,a){let r,s;for(const c of e)if(c.type!==O.WHITESPACE){if(a>=c.start&&a<=c.end){r=c;break}c.end<=a&&(s=c)}const u=c=>{let d=0;for(let h=c;h>=0;h--){const p=e[h];if(p.type!==O.WHITESPACE){if(p.type===O.RPAREN){d++;continue}if(p.type===O.LPAREN){if(d>0){d--;continue}for(let g=h-1;g>=0;g--)if(e[g].type!==O.WHITESPACE){if(e[g].type===O.COLON){for(let v=g-1;v>=0;v--)if(e[v].type!==O.WHITESPACE){if(e[v].type===O.FIELD_NAME)return e[v].value;break}}break}}}}return""};if((r==null?void 0:r.type)===O.COLON){let c="";const d=e.indexOf(r);for(let h=d-1;h>=0;h--){if(e[h].type===O.FIELD_NAME){c=e[h].value;break}if(e[h].type!==O.WHITESPACE)break}if(!c&&a===r.start)return{type:"FIELD_NAME",partial:"",token:r};if(a===r.end){for(let h=d+1;h<e.length;h++)if(e[h].type!==O.WHITESPACE){if(e[h].type===O.VALUE||e[h].type===O.QUOTED_VALUE||e[h].type===O.WILDCARD||e[h].type===O.RANGE)return{type:"FIELD_VALUE",partial:e[h].type===O.QUOTED_VALUE?e[h].value.slice(1,e[h].value.endsWith('"')||e[h].value.endsWith("'")?-1:void 0):e[h].value,fieldName:c,token:e[h]};break}}return{type:"FIELD_VALUE",partial:"",fieldName:c,token:void 0}}if((r==null?void 0:r.type)===O.SAVED_SEARCH)return{type:"SAVED_SEARCH",partial:r.value.slice(1),token:r};if((r==null?void 0:r.type)===O.HISTORY_REF)return{type:"HISTORY_REF",partial:r.value.slice(1),token:r};if((r==null?void 0:r.type)===O.RANGE){const c=e.indexOf(r);let d="";for(let h=c-1;h>=0;h--){if(e[h].type===O.FIELD_NAME){d=e[h].value;break}if(!(e[h].type===O.WHITESPACE||e[h].type===O.COLON))break}return{type:"RANGE",partial:"",fieldName:d,token:r}}if((s==null?void 0:s.type)===O.COLON||(s==null?void 0:s.type)===O.COMPARISON_OP){const c=e.indexOf(s);let d="";for(let h=c-1;h>=0;h--){if(e[h].type===O.FIELD_NAME){d=e[h].value;break}if(!(e[h].type===O.WHITESPACE||e[h].type===O.COLON||e[h].type===O.COMPARISON_OP))break}return r&&(r.type===O.VALUE||r.type===O.QUOTED_VALUE||r.type===O.WILDCARD)?{type:"FIELD_VALUE",partial:r.type===O.QUOTED_VALUE?r.value.slice(1,r.value.endsWith('"')||r.value.endsWith("'")?-1:void 0):r.value,fieldName:d,token:r}:{type:"FIELD_VALUE",partial:"",fieldName:d,token:s}}if((r==null?void 0:r.type)===O.VALUE||(r==null?void 0:r.type)===O.QUOTED_VALUE||(r==null?void 0:r.type)===O.WILDCARD){const c=e.indexOf(r);for(let d=c-1;d>=0;d--)if(e[d].type!==O.WHITESPACE){if(e[d].type===O.COLON||e[d].type===O.COMPARISON_OP){let h="";for(let p=d-1;p>=0;p--){if(e[p].type===O.FIELD_NAME){h=e[p].value;break}if(!(e[p].type===O.WHITESPACE||e[p].type===O.COLON||e[p].type===O.COMPARISON_OP))break}return{type:"FIELD_VALUE",partial:r.type===O.QUOTED_VALUE?r.value.slice(1,r.value.endsWith('"')||r.value.endsWith("'")?-1:void 0):r.value,fieldName:h,token:r}}break}}if((r==null?void 0:r.type)===O.QUOTED_VALUE)return{type:"FIELD_NAME",partial:r.value,token:r};if((r==null?void 0:r.type)===O.FIELD_NAME||(r==null?void 0:r.type)===O.VALUE){const c=u(e.indexOf(r));return c?{type:"FIELD_VALUE",partial:r.value,fieldName:c,token:r}:{type:"FIELD_NAME",partial:r.value,token:r}}if((s==null?void 0:s.type)===O.PREFIX_OP){const c=u(e.indexOf(s));return c?{type:"FIELD_VALUE",partial:"",fieldName:c,token:void 0}:{type:"FIELD_NAME",partial:"",token:void 0}}if(s&&(s.type===O.AND||s.type===O.OR||s.type===O.NOT)){const c=u(e.indexOf(s));return c?{type:"FIELD_VALUE",partial:"",fieldName:c,token:void 0}:{type:"FIELD_NAME",partial:"",token:void 0}}if(e.length===0||e.every(c=>c.type===O.WHITESPACE))return{type:"EMPTY",partial:""};if((r==null?void 0:r.type)===O.LPAREN||(s==null?void 0:s.type)===O.LPAREN){const c=(r==null?void 0:r.type)===O.LPAREN?r:s,d=u(e.indexOf(c));return d?{type:"FIELD_VALUE",partial:"",fieldName:d,token:void 0}:{type:"FIELD_NAME",partial:"",token:void 0}}if((r==null?void 0:r.type)===O.TILDE||(r==null?void 0:r.type)===O.BOOST)return{type:"OPERATOR",partial:""};if(s&&(s.type===O.VALUE||s.type===O.QUOTED_VALUE||s.type===O.RPAREN||s.type===O.RANGE||s.type===O.TILDE||s.type===O.BOOST)){const c=u(e.indexOf(s));return c?{type:"FIELD_VALUE",partial:"",fieldName:c,token:void 0}:{type:"OPERATOR",partial:""}}return{type:"FIELD_NAME",partial:"",token:void 0}}};function Rm(e,a){if(a<e.start||a>e.end)return null;if(e.type==="BooleanExpr"){const r=Rm(e.left,a);if(r)return r;const s=Rm(e.right,a);return s||null}return e}function kA(e,a,r){if(!e)return null;const s=Rm(e,r);if(!s)return null;let u=s.start,c=s.end;const d=a.slice(c).match(/^(\s+(?:AND|OR|&&|\|\|)\s+|\s+)(?=\S)/i);if(d)return c+=d[0].length,{start:u,end:c};const h=a.slice(0,u).match(/(\s+(?:AND|OR|&&|\|\|)\s+|\s+)$/i);return h&&h.index!==void 0&&h.index>0&&(u-=h[0].length),{start:u,end:c}}var TA={fieldName:"#0550ae",fieldValue:"#1a7f37",operator:"#cf222e",booleanOp:"#8250df",quoted:"#0a3069",paren:"#656d76",savedSearch:"#bf8700",historyRef:"#6639ba",wildcard:"#953800",error:"#cf222e",background:"#ffffff",text:"#1f2328",placeholder:"#656d76",cursor:"#1f2328",dropdownSelected:"#0969da",dropdownHover:"#f6f8fa",regexDelimiter:"#cf222e",regexCharClass:"#0550ae",regexGroup:"#656d76",regexEscape:"#953800",regexQuantifier:"#8250df",regexAnchor:"#cf222e",regexAlternation:"#8250df",regexText:"#0a3069",matchedParenBg:"#fff3cd",warning:"#d4a72c",valueTypes:{}},AA={fontFamily:"'SF Mono', 'Fira Code', 'Fira Mono', Menlo, Consolas, monospace",fontSize:"14px",lineHeight:"1.5",inputMinHeight:"40px",inputPadding:"8px 12px",inputBorderWidth:"2px",inputBorderColor:"#d0d7de",inputBorderRadius:"8px",inputFocusBorderColor:"#0969da",inputFocusShadow:"0 0 0 3px rgba(9, 105, 218, 0.3)",dropdownBorderColor:"#d0d7de",dropdownBorderRadius:"8px",dropdownShadow:"0 8px 24px rgba(0, 0, 0, 0.12)",dropdownMaxHeight:"300px",dropdownMinWidth:"200px",dropdownMaxWidth:"400px",dropdownZIndex:99999,dropdownItemPadding:"6px 12px",dropdownItemFontSize:"13px",dropdownItemContentGap:"8px",typeBadgeBg:"#eef1f5",typeBadgeSelectedBg:"rgba(255,255,255,0.2)",typeBadgeColor:"#656d76",typeBadgeSelectedColor:"#ffffff"},DA=["AND","OR","NOT"];function ob(e){return e.replace(/\r\n/g,`
315
- `).replace(/\r/g,`
316
- `).replace(/[\u201C\u201D\u201E\u201F\u2033\u2036\u00AB\u00BB]/g,'"').replace(/[\u2018\u2019\u201A\u201B\u2032\u2035]/g,"'").replace(/[\u2013\u2014]/g,"-").replace(/\u2026/g,"...").replace(/[\u00A0\u202F\u2007]/g," ").replace(/[\uFF01-\uFF5E]/g,a=>String.fromCharCode(a.charCodeAt(0)-65248))}var cb={"(":")","[":"]",'"':'"',"'":"'"};function CA(e,a,r,s,u){const c=e.slice(0,a),d=e.slice(a,r),h=e.slice(r);return{newValue:c+s+d+u+h,newCursorPos:r+2,newSelStart:a+1,newSelEnd:r+1}}function OA(e){if(!e.textContent)return"";const a=[];function r(s){var u;if(s.nodeType===Node.TEXT_NODE)a.push(s.textContent||"");else if(s.nodeName==="BR")(u=s.hasAttribute)!=null&&u.call(s,"data-sentinel")||a.push(`
317
- `);else for(let c=0;c<s.childNodes.length;c++)r(s.childNodes[c])}return r(e),a.join("")}function ub(e,a,r){let s=-1,u=-1;for(let c=0;c<e.length;c++){const d=e[c];a>=d.start&&a<=d.end&&(s=c),u===-1&&r>=d.start&&r<=d.end&&(u=c)}return[s,u]}function MA(e,a,r){if(e){let s=e.end;if(e.type===O.FIELD_NAME&&r){const u=r.indexOf(e);if(u>=0){for(let c=u+1;c<r.length;c++)if(r[c].type!==O.WHITESPACE){r[c].type===O.COLON&&(s=r[c].end);break}}}return{start:e.start,end:s}}return{start:a,end:a}}var em=class kw{constructor(a,r=[],s=[],u=10,c={}){vn(this,"fields");vn(this,"fieldMap");vn(this,"savedSearches");vn(this,"searchHistory");vn(this,"maxSuggestions");vn(this,"options");vn(this,"defaultFieldName");vn(this,"defaultFieldShowFieldSuggs",!1);this.fields=a,this.fieldMap=new Map(a.map(d=>[d.name,d]));for(const d of a)if(d.aliases)for(const h of d.aliases)this.fieldMap.set(h,d);this.savedSearches=r,this.searchHistory=s,this.maxSuggestions=u,this.options={showSavedSearchHint:c.showSavedSearchHint??!1,showHistoryHint:c.showHistoryHint??!1}}resolveField(a){return this.fieldMap.get(a)}updateSavedSearches(a){this.savedSearches=a}updateSearchHistory(a){this.searchHistory=a}setDefaultField(a){this.defaultFieldName=a==null?void 0:a.name,this.defaultFieldShowFieldSuggs=(a==null?void 0:a.showFieldSuggestions)??!1}getSuggestions(a,r){let s=Ns.getCursorContext(a,r);const u=MA(s.token,r,a);if(this.defaultFieldName&&(s.type==="FIELD_NAME"||s.type==="EMPTY")){s={...s,type:"FIELD_VALUE",fieldName:this.defaultFieldName};const c=this.resolveField(this.defaultFieldName);if((c==null?void 0:c.type)==="date")return{suggestions:[],showDatePicker:!0,dateFieldName:c.name,context:s};const d=this.getValueSuggestions(c,s.partial,u.start,u.end);if(this.defaultFieldShowFieldSuggs){const h=this.getFieldSuggestions(s.partial,u.start,u.end);return{suggestions:[...d,...h],showDatePicker:!1,context:s}}return{suggestions:d,showDatePicker:!1,context:s}}switch(s.type){case"FIELD_NAME":case"EMPTY":{const c=this.getFieldSuggestions(s.partial,u.start,u.end),d=!s.partial&&c.length>0?this.getSpecialHints(u.start,u.end):[];return{suggestions:this.sortByPriority([...c,...d]),showDatePicker:!1,context:s}}case"FIELD_VALUE":{const c=s.fieldName?this.resolveField(s.fieldName):void 0;return(c==null?void 0:c.type)==="date"?{suggestions:[],showDatePicker:!0,dateFieldName:c.name,context:s}:{suggestions:this.getValueSuggestions(c,s.partial,u.start,u.end),showDatePicker:!1,context:s}}case"OPERATOR":{const c=this.getOperatorSuggestions(s.partial,u.start,u.end),d=this.getFieldSuggestions("",u.start,u.end),h=this.getSpecialHints(u.start,u.end);return{suggestions:this.sortByPriority([...c,...d,...h]),showDatePicker:!1,context:s}}case"SAVED_SEARCH":return{suggestions:this.getSavedSearchSuggestions(s.partial,u.start,u.end),showDatePicker:!1,context:s};case"HISTORY_REF":return{suggestions:this.getHistorySuggestions(s.partial,u.start,u.end),showDatePicker:!1,context:s};case"RANGE":{const c=s.fieldName?this.resolveField(s.fieldName):void 0;return(c==null?void 0:c.type)==="date"?{suggestions:[],showDatePicker:!0,dateFieldName:c.name,context:s}:{suggestions:[],showDatePicker:!1,context:s}}default:return{suggestions:[],showDatePicker:!1,context:s}}}getFieldSuggestions(a,r,s){const u=a.toLowerCase();return this.fields.filter(c=>!c.hide).map(c=>{const d=c.name.toLowerCase(),h=(c.label||"").toLowerCase(),p=(c.aliases||[]).map(v=>v.toLowerCase());let g=0;return d.startsWith(u)?g=4:h.startsWith(u)||p.some(v=>v.startsWith(u))?g=3:d.includes(u)?g=2:(h.includes(u)||p.some(v=>v.includes(u)))&&(g=1),{field:c,score:g}}).filter(c=>c.score>0).sort((c,d)=>d.score-c.score).slice(0,this.maxSuggestions).map(c=>({text:c.field.name+":",label:c.field.label||c.field.name,description:c.field.description,type:c.field.type,replaceStart:r,replaceEnd:s,matchPartial:a,priority:10}))}getValueSuggestions(a,r,s,u){if(!a)return[];if(a.type==="boolean")return["true","false"].filter(c=>c.startsWith(r.toLowerCase())).map(c=>({text:c,label:c,type:"boolean",replaceStart:s,replaceEnd:u,matchPartial:r}));if(a.placeholder!==!1){const c=a.placeholder||{number:"Enter a number",ip:"Enter an IP address"}[a.type];if(c)return[{text:"",label:c,type:"hint",replaceStart:s,replaceEnd:u}]}return[]}getOperatorSuggestions(a,r,s){const u=a.toLowerCase();return DA.filter(c=>c.toLowerCase().startsWith(u)).map(c=>({text:c+" ",label:c,description:c==="AND"?"Both conditions must match":c==="OR"?"Either condition must match":"Negate the following condition",type:"operator",replaceStart:r,replaceEnd:s,matchPartial:a,priority:30}))}sortByPriority(a){return a.sort((r,s)=>(s.priority??0)-(r.priority??0))}getSpecialHints(a,r){const s=[],u=this.savedSearches.length>0||this.options.hasSavedSearchProvider,c=this.searchHistory.length>0||this.options.hasHistoryProvider;return this.options.showSavedSearchHint&&u&&s.push({text:"#",label:"#saved-search",description:"Type # to use a saved search",type:"hint",replaceStart:a,replaceEnd:r,priority:20}),this.options.showHistoryHint&&c&&s.push({text:"!",label:"!history",description:"Type ! to search history",type:"hint",replaceStart:a,replaceEnd:r,priority:20}),s}getSavedSearchSuggestions(a,r,s){return this.savedSearches.slice(0,this.maxSuggestions).map(u=>({text:u.query,label:u.label||u.query,description:u.description,type:"savedSearch",replaceStart:r,replaceEnd:s,matchPartial:a,sourceData:u}))}getHistorySuggestions(a,r,s){return this.searchHistory.slice(0,this.maxSuggestions).map(u=>({text:kw.wrapHistoryQuery(u.query),label:u.label||u.query,description:u.description,type:"history",replaceStart:r,replaceEnd:s,matchPartial:a,sourceData:u}))}static wrapHistoryQuery(a){try{const r=new Ns(new vi(a).tokenize()).parse();if(r&&r.type==="BooleanExpr")return"("+a+")"}catch{}return a}};function Du(e){if(e==="")return null;const a=Number(e);return isNaN(a)?`"${e}" is not a valid number`:null}var _A=[/^\d{4}-\d{2}-\d{2}$/,/^\d{4}\/\d{2}\/\d{2}$/,/^\d{2}\/\d{2}\/\d{4}$/,/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}/,/^now$/i,/^now[+-]\d+[dhms]$/i];function LA(e){for(const a of _A)if(a.test(e))return!0;return!isNaN(Date.parse(e))}function tm(e){return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`}function zA(e){if(/^now$/i.test(e))return new Date;const a=e.match(/^now([+-])(\d+)([dhms])$/i);if(a){const u=new Date,c=a[1]==="+"?1:-1,d=parseInt(a[2],10);switch(a[3].toLowerCase()){case"d":u.setDate(u.getDate()+c*d);break;case"h":u.setHours(u.getHours()+c*d);break;case"m":u.setMinutes(u.getMinutes()+c*d);break;case"s":u.setSeconds(u.getSeconds()+c*d);break}return u}const r=e.match(/^(\d{4})[-/](\d{2})[-/](\d{2})$/);if(r)return new Date(parseInt(r[1],10),parseInt(r[2],10)-1,parseInt(r[3],10));const s=new Date(e);return isNaN(s.getTime())?null:s}function db(e,a){return new Date(e,a+1,0).getDate()}function $A(e,a){return new Date(e,a,1).getDay()}function To(e,a){return e.getFullYear()===a.getFullYear()&&e.getMonth()===a.getMonth()&&e.getDate()===a.getDate()}function fb(e,a,r){if(!a||!r)return!1;const s=e.getTime(),u=a.getTime(),c=r.getTime();return s>=Math.min(u,c)&&s<=Math.max(u,c)}var UA=["January","February","March","April","May","June","July","August","September","October","November","December"];function BA(e){return UA[e]}function Cu(e,a){if(e==="")return null;const r=e.match(/^[\[{](.+)\s+TO\s+(.+)[\]}]$/i);if(r){const s=nm(r[1].trim(),a);if(s)return`Range start: ${s}`;const u=nm(r[2].trim(),a);return u?`Range end: ${u}`:null}return nm(e,a)}function nm(e,a){return/^now(\/[dhms])?$/i.test(e)||/^now[+-]\d+[dhms](\/[dhms])?$/i.test(e)||a&&a(e)!==null||LA(e)?null:`"${e}" is not a valid date. Use YYYY-MM-DD, relative (now-7d), or ISO 8601.`}function Ou(e){return e==null?null:typeof e=="string"?{message:e,severity:"error"}:e}var Mu={SYNTAX_ERROR:0,INVALID_VALUE:1,UNKNOWN_FIELD:2,AMBIGUOUS_PRECEDENCE:3,CUSTOM:4};function _u(e){if(e.length<=1)return e;const a=[...e].sort((s,u)=>{const c=Mu[s.type??"SYNTAX_ERROR"],d=Mu[u.type??"SYNTAX_ERROR"];return c!==d?c-d:s.start-u.start}),r=[];for(const s of a)r.some(u=>Mu[u.type??"SYNTAX_ERROR"]<Mu[s.type??"SYNTAX_ERROR"]&&u.start<=s.start&&u.end>=s.end)||r.push(s);return r}var hb=class{constructor(e){vn(this,"fields");this.fields=new Map(e.map(a=>[a.name,a]));for(const a of e)if(a.aliases)for(const r of a.aliases)this.fields.set(r,a)}validate(e,a,r,s){if(!e)return[];const u=[],c=s?this.fields.get(s):void 0;return this.walkNode(e,u,a,r,c),this.checkAmbiguousPrecedence(e,u),u}walkNode(e,a,r,s,u){switch(e.type){case"BareTerm":if(e.fuzzy!==void 0&&e.fuzzy>2&&a.push({message:`Fuzzy edit distance must be 0, 1, or 2 (got ${e.fuzzy})`,start:e.start,end:e.end,type:"SYNTAX_ERROR"}),e.proximity!==void 0&&e.proximity<0&&a.push({message:`Proximity value must be non-negative (got ${e.proximity})`,start:e.start,end:e.end,type:"SYNTAX_ERROR"}),e.boost!==void 0&&e.boost<=0&&a.push({message:`Boost value must be positive (got ${e.boost})`,start:e.start,end:e.end,type:"SYNTAX_ERROR"}),u&&e.value!==""){let c=null;switch(u.type){case"number":c=Du(e.value);break;case"date":c=Cu(e.value,s);break;case"boolean":e.value!=="true"&&e.value!=="false"&&(c=`Expected "true" or "false", got "${e.value}"`);break;case"ip":!/^\d{1,3}(\.\d{1,3}){3}(\/\d{1,2})?$/.test(e.value)&&!e.value.includes("*")&&(c=`"${e.value}" is not a valid IP address`);break}c&&a.push({message:c,start:e.start,end:e.end,field:u.name,type:"INVALID_VALUE"})}if(r&&e.value!==""){const c=Ou(r({value:e.value,position:"bare_term",quoted:e.quoted,fieldName:u==null?void 0:u.name,fieldConfig:u}));c&&a.push({message:c.message,start:e.start,end:e.end,severity:c.severity,type:"CUSTOM"})}break;case"Regex":break;case"Range":if(this.validateEmptyRangeBounds(e,a),e.field&&e.field!=="*"){const c=this.fields.get(e.field);c?this.validateRangeBounds(c,e,a,r,s):a.push({message:`Unknown field: "${e.field}"`,start:e.start,end:e.start+e.field.length,field:e.field,type:"UNKNOWN_FIELD"})}break;case"FieldValue":{if(e.field==="*")return;if(e.value===""){const h=e.operator===":"?":":e.operator;a.push({message:`Missing value after "${e.field}${h}"`,start:e.start,end:e.end,field:e.field,type:"SYNTAX_ERROR"});return}const c=this.fields.get(e.field);if(!c){a.push({message:`Unknown field: "${e.field}"`,start:e.start,end:e.start+e.field.length,field:e.field,type:"UNKNOWN_FIELD"});return}e.fuzzy!==void 0&&e.fuzzy>2&&a.push({message:`Fuzzy edit distance must be 0, 1, or 2 (got ${e.fuzzy})`,start:e.start,end:e.end,field:e.field,type:"SYNTAX_ERROR"}),e.boost!==void 0&&e.boost<=0&&a.push({message:`Boost value must be positive (got ${e.boost})`,start:e.start,end:e.end,field:e.field,type:"SYNTAX_ERROR"});let d=null;switch(c.type){case"number":d=Du(e.value);break;case"date":d=Cu(e.value,s);break;case"boolean":e.value!=="true"&&e.value!=="false"&&(d=`Expected "true" or "false", got "${e.value}"`);break;case"ip":!/^\d{1,3}(\.\d{1,3}){3}(\/\d{1,2})?$/.test(e.value)&&!e.value.includes("*")&&(d=`"${e.value}" is not a valid IP address`);break}if(e.operator!==":"&&c.type!=="number"&&c.type!=="date"&&(d=`Comparison operator "${e.operator}" is not valid for ${c.type} fields`),!d&&r){const h=Ou(r({value:e.value,position:"field_value",fieldName:c.name,fieldConfig:c,quoted:e.quoted,operator:e.operator!==":"?e.operator:void 0}));if(h){const p=e.end-e.value.length;a.push({message:h.message,start:p,end:e.end,field:e.field,severity:h.severity,type:"CUSTOM"})}}if(d){const h=e.end-e.value.length,p=e.operator!==":"&&c.type!=="number"&&c.type!=="date"?"SYNTAX_ERROR":"INVALID_VALUE";a.push({message:d,start:h,end:e.end,field:e.field,type:p})}break}case"FieldGroup":if(e.field==="*")this.walkNode(e.expression,a,r,s,u);else{const c=this.fields.get(e.field);c?this.walkFieldGroup(e.expression,c,a,r,s):a.push({message:`Unknown field: "${e.field}"`,start:e.start,end:e.start+e.field.length,field:e.field,type:"UNKNOWN_FIELD"})}e.boost!==void 0&&e.boost<=0&&a.push({message:`Boost value must be positive (got ${e.boost})`,start:e.start,end:e.end,type:"SYNTAX_ERROR"});break;case"BooleanExpr":this.walkNode(e.left,a,r,s,u),this.walkNode(e.right,a,r,s,u);break;case"Group":this.walkNode(e.expression,a,r,s,u),e.boost!==void 0&&e.boost<=0&&a.push({message:`Boost value must be positive (got ${e.boost})`,start:e.start,end:e.end,type:"SYNTAX_ERROR"});break;case"Not":this.walkNode(e.expression,a,r,s,u);break;case"Error":a.push({message:e.message,start:e.start,end:e.end,type:"SYNTAX_ERROR"});break}}walkFieldGroup(e,a,r,s,u){switch(e.type){case"BareTerm":if(e.value==="")return;this.validateFieldValue(a,e.value,e.quoted,":",e.start,e.end,r,s,u);break;case"FieldValue":this.walkNode(e,r,s,u);break;case"Range":this.validateRangeBounds(a,e,r,s,u);break;case"BooleanExpr":this.walkFieldGroup(e.left,a,r,s,u),this.walkFieldGroup(e.right,a,r,s,u);break;case"Group":this.walkFieldGroup(e.expression,a,r,s,u);break;case"Not":this.walkFieldGroup(e.expression,a,r,s,u);break;default:this.walkNode(e,r,s,u);break}}validateFieldValue(e,a,r,s,u,c,d,h,p){let g=null;switch(e.type){case"number":g=Du(a);break;case"date":g=Cu(a,p);break;case"boolean":a!=="true"&&a!=="false"&&(g=`Expected "true" or "false", got "${a}"`);break;case"ip":!/^\d{1,3}(\.\d{1,3}){3}(\/\d{1,2})?$/.test(a)&&!a.includes("*")&&(g=`"${a}" is not a valid IP address`);break}if(s!==":"&&e.type!=="number"&&e.type!=="date"&&(g=`Comparison operator "${s}" is not valid for ${e.type} fields`),!g&&h){const v=Ou(h({value:a,position:"field_group_term",fieldName:e.name,fieldConfig:e,quoted:r,operator:s!==":"?s:void 0}));v&&d.push({message:v.message,start:u,end:c,field:e.name,severity:v.severity,type:"CUSTOM"})}if(g){const v=s!==":"&&e.type!=="number"&&e.type!=="date"?"SYNTAX_ERROR":"INVALID_VALUE";d.push({message:g,start:u,end:c,field:e.name,type:v})}}validateEmptyRangeBounds(e,a){e.lower!=="*"&&e.lower.trim()===""&&a.push({message:"Missing lower bound in range",start:e.start,end:e.start+1,field:e.field,type:"SYNTAX_ERROR"}),e.upper!=="*"&&e.upper.trim()===""&&a.push({message:"Missing upper bound in range",start:e.end-1,end:e.end,field:e.field,type:"SYNTAX_ERROR"})}validateRangeBounds(e,a,r,s,u){const c=[];a.lower!=="*"&&a.lower.trim()!==""&&c.push({value:a.lower,label:"Range start",start:a.lowerStart,end:a.lowerEnd,position:"range_start",inclusive:a.lowerInclusive}),a.upper!=="*"&&a.upper.trim()!==""&&c.push({value:a.upper,label:"Range end",start:a.upperStart,end:a.upperEnd,position:"range_end",inclusive:a.upperInclusive});for(const d of c){let h=null;switch(e.type){case"number":h=Du(d.value),h&&(h=`${d.label}: ${h}`);break;case"date":h=Cu(d.value,u),h&&(h=`${d.label}: ${h}`);break;case"boolean":h="Range queries are not supported for boolean fields";break}if(!h&&s){const p=Ou(s({value:d.value,position:d.position,fieldName:e.name,fieldConfig:e,quoted:!1,inclusive:d.inclusive}));p&&r.push({message:p.message,start:d.start,end:d.end,field:e.name,severity:p.severity,type:"CUSTOM"})}if(h){const p=e.type==="boolean"?"SYNTAX_ERROR":"INVALID_VALUE";r.push({message:h,start:d.start,end:d.end,field:e.name,type:p})}}}checkAmbiguousPrecedence(e,a){const r=new Set;this.findAndFlagAmbiguity(e,a,r)}findAndFlagAmbiguity(e,a,r){if(e.type==="BooleanExpr"&&!r.has(e)){const s=new Set,u=[];this.collectBoolOps(e,s,u),s.size>1&&(a.push({message:"Ambiguous precedence: mix of AND and OR without parentheses. Add parentheses to clarify.",start:e.start,end:e.end,severity:"warning",type:"AMBIGUOUS_PRECEDENCE"}),u.forEach(c=>r.add(c))),this.collectLeaves(e).forEach(c=>this.findAndFlagAmbiguity(c,a,r))}else e.type==="Group"||e.type==="FieldGroup"?this.findAndFlagAmbiguity(e.expression,a,r):e.type==="Not"?this.findAndFlagAmbiguity(e.expression,a,r):e.type==="BooleanExpr"&&this.collectLeaves(e).forEach(s=>this.findAndFlagAmbiguity(s,a,r))}collectBoolOps(e,a,r){e.type==="BooleanExpr"&&(a.add(e.operator),r.push(e),this.collectBoolOps(e.left,a,r),this.collectBoolOps(e.right,a,r))}collectLeaves(e){return e.type!=="BooleanExpr"?[e]:[...this.collectLeaves(e.left),...this.collectLeaves(e.right)]}};function Ia(...e){return e.filter(Boolean).join(" ")}function cc(e){return{...TA,...e}}function uc(e){return{...AA,...e}}function IA(e,a){return{position:"relative",display:"flex",flexDirection:"column",width:"100%",...a}}function HA(e,a){return{flex:1,minHeight:a.inputMinHeight,padding:a.inputPadding,borderWidth:a.inputBorderWidth,borderStyle:"solid",borderColor:a.inputBorderColor,borderRadius:a.inputBorderRadius,outline:"none",fontSize:a.fontSize,fontFamily:a.fontFamily,lineHeight:a.lineHeight,backgroundColor:e.background,color:e.text,caretColor:e.cursor,whiteSpace:"pre-wrap",wordWrap:"break-word",overflowWrap:"break-word",overflow:"auto",cursor:"text"}}function qA(e){return{borderColor:e.inputFocusBorderColor,boxShadow:e.inputFocusShadow}}function PA(e,a){const r=a.inputPadding.split(/\s+/),s=r[0]||"8px";return{position:"absolute",top:s,left:r.length>=4?r[3]:r.length>=2?r[1]:s,right:r.length>=4||r.length>=2?r[1]:s,color:e.placeholder,pointerEvents:"none",fontSize:a.fontSize,fontFamily:a.fontFamily,lineHeight:a.lineHeight,userSelect:"none",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}}function Tw(e,a){return{position:"absolute",zIndex:a.dropdownZIndex,backgroundColor:e.background,border:`1px solid ${a.dropdownBorderColor}`,borderRadius:a.dropdownBorderRadius,boxShadow:a.dropdownShadow,maxHeight:a.dropdownMaxHeight,overflowY:"auto",width:"max-content",minWidth:a.dropdownMinWidth,maxWidth:a.dropdownMaxWidth,padding:"4px 0"}}function mb(e,a,r){return{padding:r.dropdownItemPadding,cursor:"pointer",fontSize:r.dropdownItemFontSize,fontFamily:r.fontFamily,backgroundColor:e?a.dropdownSelected:"transparent",color:e?"#ffffff":a.text,display:"flex",alignItems:"center",gap:r.dropdownItemContentGap,lineHeight:"1.4"}}function ui(e){return{flex:1,fontWeight:500}}function am(e){return{fontSize:"11px",opacity:.7,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",flexShrink:1,minWidth:0}}function FA(e,a){return{fontSize:"10px",padding:"1px 4px",borderRadius:"3px",backgroundColor:e?a.typeBadgeSelectedBg:a.typeBadgeBg,color:e?a.typeBadgeSelectedColor:a.typeBadgeColor,flexShrink:0}}function VA(e,a){return{container:{padding:"12px",backgroundColor:e.background,minWidth:"280px",fontFamily:a.fontFamily},header:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"8px"},navButton:{backgroundColor:"transparent",border:"none",cursor:"pointer",fontSize:"16px",padding:"4px 8px",color:e.text,borderRadius:"4px"},monthLabel:{fontWeight:600,fontSize:a.fontSize,color:e.text},weekDays:{display:"grid",gridTemplateColumns:"repeat(7, 1fr)",gap:"2px",marginBottom:"4px"},weekDay:{textAlign:"center",fontSize:"11px",color:e.placeholder,padding:"4px",fontWeight:600},days:{display:"grid",gridTemplateColumns:"repeat(7, 1fr)",gap:"2px"},day:{textAlign:"center",padding:"6px",cursor:"pointer",fontSize:a.dropdownItemFontSize,borderRadius:"4px",color:e.text,border:"none",backgroundColor:"transparent"},dayHover:{backgroundColor:e.dropdownHover},daySelected:{backgroundColor:e.dropdownSelected,color:"#ffffff"},dayInRange:{backgroundColor:"rgba(9, 105, 218, 0.1)"},dayOtherMonth:{opacity:.45},dayToday:{fontWeight:700,textDecoration:"underline"},rangeToggle:{display:"flex",gap:"4px",marginBottom:"8px",padding:"2px",backgroundColor:a.typeBadgeBg,borderRadius:"6px"},rangeToggleButton:{flex:1,padding:"4px 8px",border:"none",borderRadius:"4px",cursor:"pointer",fontSize:"12px",fontWeight:500,backgroundColor:"transparent",color:e.text},rangeToggleButtonActive:{backgroundColor:e.background,boxShadow:"0 1px 2px rgba(0,0,0,0.1)"},quickOptions:{borderTop:`1px solid ${a.dropdownBorderColor}`,marginTop:"8px",paddingTop:"8px"},quickOption:{display:"block",width:"100%",textAlign:"left",padding:"4px 8px",border:"none",backgroundColor:"transparent",cursor:"pointer",fontSize:"12px",color:e.dropdownSelected,borderRadius:"4px"}}}var YA={delimiter:"regexDelimiter",charClass:"regexCharClass",groupOpen:"regexGroup",groupClose:"regexGroup",escape:"regexEscape",quantifier:"regexQuantifier",anchor:"regexAnchor",alternation:"regexAlternation",text:"regexText"};function GA(e){const a=[];let r=0,s="";function u(){s&&(a.push({type:"text",text:s}),s="")}e.startsWith("/")&&(a.push({type:"delimiter",text:"/"}),r=1);const c=e.lastIndexOf("/"),d=c>0?c:e.length;for(;r<d;){const h=e[r];if(h==="\\"&&r+1<d){u(),a.push({type:"escape",text:e.slice(r,r+2)}),r+=2;continue}if(h==="["){u();let p=r+1;for(p<d&&e[p]==="^"&&p++,p<d&&e[p]==="]"&&p++;p<d&&e[p]!=="]";)e[p]==="\\"&&p+1<d&&p++,p++;p<d&&p++,a.push({type:"charClass",text:e.slice(r,p)}),r=p;continue}if(h==="("){u();let p="(";if(r+1<d&&e[r+1]==="?"){let g=r+2;for(;g<d&&g<r+4&&/[:<>=!]/.test(e[g]);)g++;p=e.slice(r,g)}a.push({type:"groupOpen",text:p}),r+=p.length;continue}if(h===")"){u(),a.push({type:"groupClose",text:")"}),r++;continue}if(h==="+"||h==="*"||h==="?"){u();let p=h;r+1<d&&e[r+1]==="?"&&(p+="?"),a.push({type:"quantifier",text:p}),r+=p.length;continue}if(h==="{"){u();let p=r+1;for(;p<d&&e[p]!=="}";)p++;p<d&&p++,a.push({type:"quantifier",text:e.slice(r,p)}),r=p;continue}if(h==="^"||h==="$"){u(),a.push({type:"anchor",text:h}),r++;continue}if(h==="|"){u(),a.push({type:"alternation",text:"|"}),r++;continue}s+=h,r++}return u(),c>0&&c<e.length&&a.push({type:"delimiter",text:"/"}),a}function XA(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function QA(e,a,r){const s=GA(e.value).map(u=>{const c=a[YA[u.type]]||a.regexText,d=u.type==="delimiter"?"600":"normal";return`<span class="ei-regex-part ei-regex-part--${u.type}" style="color:${c};font-weight:${d}">${XA(u.text)}</span>`}).join("");return`<span class="${`ei-token ei-token--regex${r?" "+r:""}`}" data-token-start="${e.start}" data-token-end="${e.end}">${s}</span>`}var KA={bracket:"paren",toKeyword:"booleanOp",bareValue:"fieldValue",quotedValue:"quoted",wildcard:"wildcard",whitespace:"text"};function ZA(e){const a=[];let r=0;r<e.length&&(e[r]==="["||e[r]==="{")&&(a.push({type:"bracket",text:e[r]}),r++);const s=e.length-1,u=s>=0&&(e[s]==="]"||e[s]==="}"),c=u?s:e.length;for(;r<c;){const d=e[r];if(d===" "||d===" "){let p=r;for(;p<c&&(e[p]===" "||e[p]===" ");)p++;a.push({type:"whitespace",text:e.slice(r,p)}),r=p;continue}if((d==="T"||d==="t")&&r+1<c&&(e[r+1]==="O"||e[r+1]==="o")){const p=r===0||e[r-1]===" "||e[r-1]===" "||e[r-1]==="["||e[r-1]==="{",g=r+2>=c||e[r+2]===" "||e[r+2]===" ";if(p&&g){a.push({type:"toKeyword",text:e.slice(r,r+2)}),r+=2;continue}}if(d==='"'){let p=r+1;for(;p<c&&e[p]!=='"';)e[p]==="\\"&&p+1<c&&p++,p++;p<c&&p++,a.push({type:"quotedValue",text:e.slice(r,p)}),r=p;continue}if(d==="*"){a.push({type:"wildcard",text:"*"}),r++;continue}let h=r;for(;h<c&&e[h]!==" "&&e[h]!==" "&&e[h]!=='"';)h++;if(h>r){const p=e.slice(r,h);a.push({type:"bareValue",text:p}),r=h}else a.push({type:"bareValue",text:d}),r++}return u&&a.push({type:"bracket",text:e[s]}),a}function pb(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function WA(e,a,r){const s=ZA(e.value).map(u=>{if(u.type==="whitespace")return pb(u.text);const c=a[KA[u.type]]||a.fieldValue,d=u.type==="toKeyword"||u.type==="bracket"?"600":"normal";return`<span class="ei-range-part ei-range-part--${u.type}" style="color:${c};font-weight:${d}">${pb(u.text)}</span>`}).join("");return`<span class="${`ei-token ei-token--range${r?" "+r:""}`}" data-token-start="${e.start}" data-token-end="${e.end}">${s}</span>`}function Aw(e,a){if(a<0)return null;const r=e.filter(c=>c.type===O.LPAREN||c.type===O.RPAREN);if(r.length===0)return null;const s=r.find(c=>c.end===a);if(s){const c=gb(r,s);if(c)return c}const u=r.find(c=>c.start===a);if(u){const c=gb(r,u);if(c)return c}return null}function gb(e,a){if(a.type===O.LPAREN){const r=e.indexOf(a);let s=0;for(let u=r;u<e.length;u++)if(e[u].type===O.LPAREN?s++:e[u].type===O.RPAREN&&s--,s===0)return{openStart:a.start,closeStart:e[u].start}}else{const r=e.indexOf(a);let s=0;for(let u=r;u>=0;u--)if(e[u].type===O.RPAREN?s++:e[u].type===O.LPAREN&&s--,s===0)return{openStart:e[u].start,closeStart:a.start}}return null}var JA={[O.FIELD_NAME]:"field-name",[O.COLON]:"colon",[O.VALUE]:"value",[O.QUOTED_VALUE]:"quoted-value",[O.AND]:"and",[O.OR]:"or",[O.NOT]:"not",[O.COMPARISON_OP]:"comparison-op",[O.LPAREN]:"lparen",[O.RPAREN]:"rparen",[O.SAVED_SEARCH]:"saved-search",[O.HISTORY_REF]:"history-ref",[O.PREFIX_OP]:"prefix-op",[O.WILDCARD]:"wildcard",[O.REGEX]:"regex",[O.RANGE]:"range",[O.TILDE]:"tilde",[O.BOOST]:"boost",[O.WHITESPACE]:"whitespace",[O.UNKNOWN]:"unknown"},eD={[O.FIELD_NAME]:"fieldName",[O.COLON]:"operator",[O.VALUE]:"fieldValue",[O.QUOTED_VALUE]:"quoted",[O.AND]:"booleanOp",[O.OR]:"booleanOp",[O.NOT]:"booleanOp",[O.COMPARISON_OP]:"operator",[O.LPAREN]:"paren",[O.RPAREN]:"paren",[O.SAVED_SEARCH]:"savedSearch",[O.HISTORY_REF]:"historyRef",[O.PREFIX_OP]:"operator",[O.WILDCARD]:"wildcard",[O.REGEX]:"quoted",[O.RANGE]:"fieldValue",[O.TILDE]:"operator",[O.BOOST]:"operator",[O.WHITESPACE]:"text",[O.UNKNOWN]:"error"};function di(e,a,r){const s=cc(a);if(e.length===0)return"";const u=(r==null?void 0:r.cursorOffset)!==void 0?Aw(e,r.cursorOffset):null,c=a==null?void 0:a.valueTypes,d=r==null?void 0:r.fieldTypeMap;let h;if(c&&d){h=new Array(e.length);let g,v=!1;const y=[];for(let S=0;S<e.length;S++){const N=e[S];N.type===O.FIELD_NAME?(g=N.value,v=!1):N.type===O.COLON&&g?v=!0:N.type===O.WHITESPACE||(N.type===O.LPAREN?(v&&g?y.push(d.get(g.toLowerCase())):y.push(void 0),g=void 0,v=!1):N.type===O.RPAREN?(y.pop(),g=void 0,v=!1):N.type===O.VALUE||N.type===O.QUOTED_VALUE||N.type===O.RANGE||N.type===O.REGEX||N.type===O.WILDCARD?(v&&g?h[S]=d.get(g.toLowerCase()):y.length>0&&(h[S]=y[y.length-1]),g=void 0,v=!1):(N.type===O.AND||N.type===O.OR||(N.type,O.NOT),g=void 0,v=!1))}}let p=e.map((g,v)=>{let y=s[eD[g.type]||"text"]||s.text;if(c&&h){const j=h[v];j&&c[j]&&(y=c[j])}const S=tD(g.value);if(g.type===O.WHITESPACE)return S.replace(/\n/g,"<br>");if(g.type===O.REGEX)return QA(g,s,r==null?void 0:r.tokenClassName);if(g.type===O.RANGE)return WA(g,s,r==null?void 0:r.tokenClassName);let N="normal";(g.type===O.AND||g.type===O.OR||g.type===O.NOT)&&(N="600"),g.type===O.FIELD_NAME&&(N="500");let w="";return u&&(g.type===O.LPAREN||g.type===O.RPAREN)&&(g.start===u.openStart||g.start===u.closeStart)&&(N="700",w=`background-color:${s.matchedParenBg};border-radius:2px;`),`<span class="${`ei-token ei-token--${JA[g.type]}${r!=null&&r.tokenClassName?" "+r.tokenClassName:""}`}" style="color:${y};font-weight:${N};${w}" data-token-start="${g.start}" data-token-end="${g.end}">${S}</span>`}).join("");return p.endsWith("<br>")&&(p+="<br data-sentinel>"),p}function tD(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}if(typeof document<"u"){const e="elastic-input-keyframes";if(!document.getElementById(e)){const a=document.createElement("style");a.id=e,a.textContent="@keyframes elastic-input-spin { to { transform: rotate(360deg); } }",document.head.appendChild(a)}}function xb(e,a,r){if(!a||a.length===0)return e;const s=e.toLowerCase(),u=a.toLowerCase(),c=s.indexOf(u);if(c===-1)return e;const d=e.slice(0,c),h=e.slice(c,c+a.length),p=e.slice(c+a.length),g={fontWeight:700,textDecoration:"underline",textDecorationColor:r?"rgba(255,255,255,0.6)":"#0969da",textUnderlineOffset:"2px"};return x.createElement(x.Fragment,null,d,x.createElement("span",{className:"ei-highlight-match",style:g},h),p)}function nD({suggestions:e,selectedIndex:a,onSelect:r,position:s,colors:u,styles:c,visible:d,fixedWidth:h,renderHistoryItem:p,renderSavedSearchItem:g,renderDropdownHeader:v,cursorContext:y,listRefCallback:S,renderType:N,classNames:w}){const j=x.useRef(null),R=x.useRef(null);x.useEffect(()=>{const U=document.createElement("div");return document.body.appendChild(U),j.current=U,()=>{document.body.removeChild(U),j.current=null}},[]);const M=v&&y?v(y):null,$=M!=null;if(x.useEffect(()=>{if(R.current){const U=$?a+1:a,k=R.current.children[U];k&&k.scrollIntoView({block:"nearest"})}},[a,$]),!j.current||!d||e.length===0||!s)return null;const B=cc(u),Y=uc(c),ne={...Tw(B,Y),top:`${s.top}px`,left:`${s.left}px`,...h!=null?{width:`${h}px`,minWidth:"unset",maxWidth:"unset"}:{}},ae=x.createElement("div",{className:Ia("ei-dropdown",w==null?void 0:w.dropdown),style:ne,ref:U=>{R.current=U,S==null||S(U)},onMouseDown:U=>U.preventDefault()},$&&x.createElement("div",{className:Ia("ei-dropdown-header",w==null?void 0:w.dropdownHeader),style:{padding:Y.dropdownItemPadding||"4px 10px",fontSize:"11px",color:B.placeholder,borderBottom:`1px solid ${B.dropdownHover}`,userSelect:"none"}},M),e.map((U,k)=>{const re=k===a,pe=mb(re,B,Y),Se=(L,F,fe)=>({key:k,className:Ia("ei-dropdown-item",L,re&&"ei-dropdown-item--selected",w==null?void 0:w.dropdownItem),style:{...pe,...F},title:fe,onClick:()=>r(U),onMouseEnter:P=>{P.currentTarget.style.backgroundColor=re?B.dropdownSelected:B.dropdownHover},onMouseLeave:P=>{P.currentTarget.style.backgroundColor=re?B.dropdownSelected:"transparent"}}),ye=L=>{if(N===!1||!U.type||U.type==="hint")return null;const F=typeof N=="function"?N(U.type,{text:U.text,label:U.label,description:U.description,type:U.type}):U.type;return F!=null?x.createElement("span",{className:"ei-dropdown-item-type",style:{...FA(re,Y),...L}},F):null},he={flexDirection:"column",alignItems:"flex-start"},je={display:"flex",alignItems:"center",gap:Y.dropdownItemContentGap,width:"100%"};if(U.type==="hint"&&(U.text==="#"||U.text==="!"))return x.createElement("div",{...Se("ei-dropdown-item--hint",{opacity:re?1:.7}),onMouseEnter:L=>{L.currentTarget.style.backgroundColor=re?B.dropdownSelected:B.dropdownHover,L.currentTarget.style.opacity="1"},onMouseLeave:L=>{L.currentTarget.style.backgroundColor=re?B.dropdownSelected:"transparent",L.currentTarget.style.opacity=re?"1":"0.7"}},x.createElement("span",{className:"ei-dropdown-item-label",style:ui()},U.label),U.description&&x.createElement("span",{className:"ei-dropdown-item-desc",style:am()},U.description));if(U.type==="error")return x.createElement("div",{key:k,className:Ia("ei-dropdown-item","ei-dropdown-item--error",w==null?void 0:w.dropdownItem),style:{...pe,cursor:"default",opacity:.8}},x.createElement("span",{className:"ei-dropdown-item-label",style:{...ui(),color:B.error}},U.label||"Error loading suggestions"));if(U.type==="noResults")return x.createElement("div",{key:k,className:Ia("ei-dropdown-item","ei-dropdown-item--no-results",w==null?void 0:w.dropdownItem),style:{...pe,cursor:"default",opacity:.7}},U.customContent);if(U.type==="loading")return x.createElement("div",{key:k,className:Ia("ei-dropdown-item","ei-dropdown-item--loading",w==null?void 0:w.dropdownItem),style:{...pe,cursor:"default",opacity:.6,justifyContent:"center"}},x.createElement("span",{className:"ei-dropdown-item-label",style:{...ui(),fontStyle:"italic"}},U.label||"Searching..."),x.createElement("span",{className:"ei-dropdown-spinner",style:{marginLeft:"6px",display:"inline-block",animation:"elastic-input-spin 1s linear infinite",width:"14px",height:"14px",border:"2px solid",borderColor:`${B.placeholder} transparent ${B.placeholder} transparent`,borderRadius:"50%"}}));if(U.type==="hint"){const L=mb(!1,B,Y);return x.createElement("div",{key:k,className:Ia("ei-dropdown-item","ei-dropdown-item--hint",w==null?void 0:w.dropdownItem),style:{...L,cursor:"default",opacity:U.customContent?1:.6}},U.customContent?U.customContent:x.createElement("span",{className:"ei-dropdown-item-label",style:ui()},U.label))}if(U.type==="history"&&p&&U.sourceData){const L=p(U.sourceData,re);if(L!=null)return x.createElement("div",Se("ei-dropdown-item--history",he),L)}if(U.type==="savedSearch"&&g&&U.sourceData){const L=g(U.sourceData,re);if(L!=null)return x.createElement("div",Se("ei-dropdown-item--saved-search"),L)}if((U.type==="history"||U.type==="savedSearch")&&U.description!=null){const L=U.type==="history"?"ei-dropdown-item--history":"ei-dropdown-item--saved-search";let F;const fe=U.text.startsWith("(")&&U.text.endsWith(")")?U.text.slice(1,-1):U.text;return U.label!==fe&&(F=U.text),x.createElement("div",Se(L,he,F),x.createElement("span",{className:"ei-dropdown-item-label",style:{...ui(),width:"100%",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden",whiteSpace:"normal",wordBreak:"break-all"}},xb(U.label,U.matchPartial,re)),x.createElement("span",{style:je},x.createElement("span",{className:"ei-dropdown-item-desc",style:{...am(),flex:1}},U.description),ye({marginLeft:"auto"})))}const W=U.type==="savedSearch"?"ei-dropdown-item--saved-search":void 0;return x.createElement("div",Se(W),x.createElement("span",{className:"ei-dropdown-item-label",style:ui()},xb(U.label,U.matchPartial,re)),U.description&&x.createElement("span",{className:"ei-dropdown-item-desc",style:am()},U.description),ye())}));return il.createPortal(ae,j.current)}var aD=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function rm(e){return Math.floor(e/10)*10}function rD({onSelect:e,colors:a,styles:r,initialMode:s,initialStart:u,initialEnd:c,presets:d,className:h}){const p=s==="range"&&c?c:u??new Date,[g,v]=x.useState(s??"single"),[y,S]=x.useState("days"),[N,w]=x.useState(p.getFullYear()),[j,R]=x.useState(p.getMonth()),[M,$]=x.useState(u??null),[B,Y]=x.useState(c??null),[ne,ae]=x.useState(null),U=cc(a),k=VA(U,uc(r)),re=()=>{y==="days"?j===0?(R(11),w(ce=>ce-1)):R(ce=>ce-1):w(y==="months"?ce=>ce-1:ce=>ce-10)},pe=()=>{y==="days"?j===11?(R(0),w(ce=>ce+1)):R(ce=>ce+1):w(y==="months"?ce=>ce+1:ce=>ce+10)},Se=()=>{w(y==="days"?ce=>ce-1:y==="months"?ce=>ce-10:ce=>ce-100)},ye=()=>{w(y==="days"?ce=>ce+1:y==="months"?ce=>ce+10:ce=>ce+100)},he=()=>{y==="days"?S("months"):y==="months"&&S("years")},je=ce=>{R(ce),S("days")},W=ce=>{w(ce),S("months")},L=ce=>{if(g==="single"){e(tm(ce));return}if(!M||B)$(ce),Y(null),ae(null);else{const[qe,st]=M<=ce?[M,ce]:[ce,M];$(qe),Y(st),ae(null),e(`[${tm(qe)} TO ${tm(st)}]`)}},F=M&&!B?ne:B,fe=ce=>{v(ce),$(null),Y(null),ae(null)},P=y==="days"?`${BA(j)} ${N}`:y==="months"?`${N}`:`${rm(N)}–${rm(N)+9}`,se=y!=="years",A=new Date,I=db(N,j),K=$A(N,j),ue=["Su","Mo","Tu","We","Th","Fr","Sa"],ge=[],xe=(ce,qe,st)=>{const Ht=To(ce,A),yn=M&&To(ce,M),At=F&&To(ce,F),$t=fb(ce,M,F),Wt=yn||At,Fn={...k.day,...st?k.dayOtherMonth:{},...Ht?k.dayToday:{},...$t?k.dayInRange:{},...Wt?k.daySelected:{}},Vn=g==="range"&&M&&!B;return x.createElement("button",{key:qe,className:"ei-datepicker-day",style:Fn,onClick:()=>L(ce),onMouseEnter:rn=>{Vn?ae(ce):Wt||(rn.currentTarget.style.backgroundColor=U.dropdownHover)},onMouseLeave:rn=>{!Vn&&!Wt&&(rn.currentTarget.style.backgroundColor=$t?"rgba(9, 105, 218, 0.1)":"transparent")}},ce.getDate())};if(K>0){const ce=db(N,j-1);for(let qe=K-1;qe>=0;qe--){const st=ce-qe,Ht=new Date(N,j-1,st);ge.push(xe(Ht,`prev${st}`,!0))}}for(let ce=1;ce<=I;ce++){const qe=new Date(N,j,ce);ge.push(xe(qe,String(ce),!1))}const ke=ge.length%7;if(ke>0){const ce=7-ke;for(let qe=1;qe<=ce;qe++){const st=new Date(N,j+1,qe);ge.push(xe(st,`next${qe}`,!0))}}const Ie={...k.day,padding:"10px 4px",fontSize:"13px"},Ue={...Ie,...k.dayToday},Ze=d??[{label:"Today",value:"[now/d TO now]",type:"range"},{label:"Yesterday",value:"[now-1d/d TO now/d]",type:"range"},{label:"Last 7 days",value:"[now-7d TO now]",type:"range"},{label:"Last 30 days",value:"[now-30d TO now]",type:"range"},{label:"Last 90 days",value:"[now-90d TO now]",type:"range"},{label:"Last 1 year",value:"[now-365d TO now]",type:"range"}],dn={display:"grid",gridTemplateColumns:"1fr 1fr",gap:"2px"},It=ce=>{ce.currentTarget.style.backgroundColor="#eef1f5"},pt=ce=>{ce.currentTarget.style.backgroundColor="transparent"};return x.createElement("div",{className:Ia("ei-datepicker",h),style:k.container,onMouseDown:ce=>ce.preventDefault(),onMouseLeave:()=>ae(null)},x.createElement("div",{className:"ei-datepicker-toggle",style:k.rangeToggle},["single","range"].map(ce=>x.createElement("button",{key:ce,style:{...k.rangeToggleButton,...g===ce?k.rangeToggleButtonActive:{}},onClick:()=>fe(ce)},ce.charAt(0).toUpperCase()+ce.slice(1)))),x.createElement("div",{className:"ei-datepicker-header",style:k.header},x.createElement("div",{style:{display:"flex",alignItems:"center",gap:"2px"}},x.createElement("button",{style:k.navButton,onClick:Se,onMouseEnter:It,onMouseLeave:pt},"«"),x.createElement("button",{style:k.navButton,onClick:re,onMouseEnter:It,onMouseLeave:pt},"‹")),x.createElement("button",{style:{...k.monthLabel,backgroundColor:"transparent",border:"none",cursor:se?"pointer":"default",padding:"2px 8px",borderRadius:"4px"},onClick:se?he:void 0,onMouseEnter:ce=>{se&&(ce.currentTarget.style.backgroundColor="#eef1f5")},onMouseLeave:ce=>{ce.currentTarget.style.backgroundColor="transparent"}},P),x.createElement("div",{style:{display:"flex",alignItems:"center",gap:"2px"}},x.createElement("button",{style:k.navButton,onClick:pe,onMouseEnter:It,onMouseLeave:pt},"›"),x.createElement("button",{style:k.navButton,onClick:ye,onMouseEnter:It,onMouseLeave:pt},"»"))),y==="days"&&x.createElement(x.Fragment,null,x.createElement("div",{style:k.weekDays},ue.map(ce=>x.createElement("div",{key:ce,style:k.weekDay},ce))),x.createElement("div",{className:"ei-datepicker-days",style:k.days},ge)),y==="months"&&x.createElement("div",{style:{display:"grid",gridTemplateColumns:"repeat(3, 1fr)",gap:"2px"}},aD.map((ce,qe)=>{const st=new Date(N,qe,1),Ht=fb(st,M,F),yn=M&&To(new Date(M.getFullYear(),M.getMonth(),1),st)||F&&To(new Date(F.getFullYear(),F.getMonth(),1),st),At=qe===A.getMonth()&&N===A.getFullYear(),$t=g==="range"&&M&&!B;return x.createElement("button",{key:ce,style:{...At?Ue:Ie,...Ht?k.dayInRange:{},...yn?k.daySelected:{}},onClick:()=>je(qe),onMouseEnter:Wt=>{$t?ae(st):yn||(Wt.currentTarget.style.backgroundColor=U.dropdownHover)},onMouseLeave:Wt=>{!$t&&!yn&&(Wt.currentTarget.style.backgroundColor=Ht?"rgba(9, 105, 218, 0.1)":"transparent")}},ce)})),y==="years"&&x.createElement("div",{style:{display:"grid",gridTemplateColumns:"repeat(3, 1fr)",gap:"2px"}},Array.from({length:12},(ce,qe)=>{const st=rm(N)-1+qe,Ht=qe===0||qe===11,yn=st===A.getFullYear(),At=new Date(st,0,1),$t=M&&F&&st>=Math.min(M.getFullYear(),F.getFullYear())&&st<=Math.max(M.getFullYear(),F.getFullYear()),Wt=M&&M.getFullYear()===st||F&&F.getFullYear()===st,Fn=g==="range"&&M&&!B;return x.createElement("button",{key:st,style:{...yn?Ue:Ie,...Ht?k.dayOtherMonth:{},...$t?k.dayInRange:{},...Wt?k.daySelected:{}},onClick:()=>W(st),onMouseEnter:Vn=>{Fn?ae(At):Wt||(Vn.currentTarget.style.backgroundColor=U.dropdownHover)},onMouseLeave:Vn=>{!Fn&&!Wt&&(Vn.currentTarget.style.backgroundColor=$t?"rgba(9, 105, 218, 0.1)":"transparent")}},st)})),(()=>{const ce=Ze.filter(qe=>!qe.type||qe.type===g);return ce.length>0&&x.createElement("div",{className:"ei-datepicker-presets",style:{...k.quickOptions,...dn}},ce.map(qe=>x.createElement("button",{key:`${qe.type??"both"}-${qe.value}`,style:k.quickOption,onClick:()=>e(qe.value)},qe.label)))})())}var lD=30,sD=150;function vb(e,a){let r=0;const s=u=>{if(u.nodeType===Node.TEXT_NODE){const c=(u.textContent||"").length;return r+c>=a?{node:u,offset:a-r}:(r+=c,null)}if(u.nodeName==="BR"){if(r+1>=a){const c=u.parentNode;if(c)return{node:c,offset:Array.from(c.childNodes).indexOf(u)+1}}return r+=1,null}for(let c=0;c<u.childNodes.length;c++){const d=s(u.childNodes[c]);if(d)return d}return null};return s(e)}function iD(e,a,r){const s=vb(e,a),u=vb(e,r);if(!s||!u)return[];const c=document.createRange();c.setStart(s.node,s.offset),c.setEnd(u.node,u.offset);const d=e.getBoundingClientRect(),h=c.getClientRects();if(h.length===0)return[];const p=[];for(let g=0;g<h.length;g++){const v=h[g];v.width<1||p.push({left:v.left-d.left,top:v.top-d.top,width:Math.max(v.width,6),height:v.height})}return p}function oD(e,a,r){if(!a||e.length===0)return[];const s=[];let u=0;for(const c of e){if(u>=lD)break;if(r>=c.start&&r<=c.end)continue;const d=iD(a,c.start,c.end);for(const h of d)s.push({left:h.left,top:h.top,width:h.width,height:h.height,error:c});u++}return s}var yb=28,bb=4;function cD(e){return`url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='4' viewBox='0 0 8 4'%3E%3Cpath d='M0 2 Q2 0 4 2 Q6 4 8 2' stroke='${e.replace("#","%23")}' fill='none' stroke-width='0.8'/%3E%3C/svg%3E")`}function uD({errors:e,editorRef:a,cursorOffset:r,colors:s,styles:u,containerRef:c,classNames:d}){const[h,p]=x.useState(null),[g,v]=x.useState({x:0,clientY:0}),[y,S]=x.useState([]),N=x.useRef([]),w=x.useRef(null),j=x.useRef(null);if(x.useEffect(()=>{if(j.current&&clearTimeout(j.current),e.length===0){S([]),N.current=[],p(null);return}return j.current=setTimeout(()=>{const B=oD(e,a,r);S(B),N.current=B},sD),()=>{j.current&&clearTimeout(j.current)}},[e,a,r]),x.useEffect(()=>{const B=c;if(!B||!a)return;const Y=U=>{const k=a.getBoundingClientRect(),re=U.clientX-k.left,pe=U.clientY-k.top;let Se=-1;for(let ye=0;ye<N.current.length;ye++){const he=N.current[ye];if(re>=he.left&&re<=he.left+he.width&&pe>=he.top&&pe<=he.top+he.height+6){Se=ye;break}}Se>=0?(p(Se),v({x:re,clientY:U.clientY})):p(null)},ne=()=>{p(null)},ae=new AbortController;return B.addEventListener("mousemove",Y,{signal:ae.signal}),B.addEventListener("mouseleave",ne,{signal:ae.signal}),()=>ae.abort()},[c,a]),x.useEffect(()=>{const B=w.current;if(!B||h==null)return;const Y=B.getBoundingClientRect();if(Y.right>window.innerWidth-8){const ne=Y.right-window.innerWidth+8;B.style.transform=`translateX(-${ne}px)`}else B.style.transform=""}),y.length===0)return null;const R=cc(s),M=uc(u),$=h!=null?y[h]:null;return x.createElement(x.Fragment,null,y.map((B,Y)=>{const ne=B.error.severity==="warning",ae=cD(ne?R.warning:R.error),U=B.top+B.height-2;return x.createElement("div",{key:`wave-${Y}`,className:Ia("ei-squiggly",ne?"ei-squiggly--warning":"ei-squiggly--error",d==null?void 0:d.squiggly),style:{position:"absolute",left:`${B.left}px`,top:`${U}px`,width:`${B.width}px`,height:"4px",zIndex:1,backgroundImage:ae,backgroundRepeat:"repeat-x",backgroundPosition:"left top",backgroundSize:"auto 4px",pointerEvents:"none"}})}),$!=null&&(()=>{const B=$.error.severity==="warning"?R.warning:R.error,Y=a==null?void 0:a.getBoundingClientRect(),ne=((Y==null?void 0:Y.left)??0)+g.x,ae=((Y==null?void 0:Y.top)??0)+$.top+$.height+2,U=((Y==null?void 0:Y.top)??0)+$.top,k=window.innerHeight-g.clientY<yb+20?U-yb-bb:ae+bb;return il.createPortal(x.createElement("div",{ref:w,className:Ia("ei-tooltip",d==null?void 0:d.tooltip),style:{position:"fixed",top:`${k}px`,left:`${ne}px`,zIndex:M.dropdownZIndex,backgroundColor:R.background,color:B,border:`1px solid ${B}`,borderRadius:"4px",padding:"4px 8px",fontSize:"12px",fontFamily:M.fontFamily,lineHeight:"1.4",whiteSpace:"nowrap",pointerEvents:"none",userSelect:"none",boxShadow:"0 2px 8px rgba(0, 0, 0, 0.15)",maxWidth:"90vw"}},$.error.message),document.body)})())}function Xo(e,a,r){let s=0,u=!1;function c(d){var h;if(u)return!0;if(d===a){if(d.nodeType===Node.TEXT_NODE)s+=r;else for(let p=0;p<r&&p<d.childNodes.length;p++)if(c(d.childNodes[p]))return!0;return u=!0,!0}if(d.nodeType===Node.TEXT_NODE)return s+=(d.textContent||"").length,!1;if(d.nodeName==="BR")return(h=d.hasAttribute)!=null&&h.call(d,"data-sentinel")||(s+=1),!1;for(let p=0;p<d.childNodes.length;p++)if(c(d.childNodes[p]))return!0;return!1}return c(e),s}function Ul(e){const a=window.getSelection();if(!a||a.rangeCount===0)return 0;const r=a.getRangeAt(0);return Xo(e,r.startContainer,r.startOffset)}function Tr(e){const a=window.getSelection();if(!a||a.rangeCount===0)return{start:0,end:0};const r=a.getRangeAt(0);return{start:Xo(e,r.startContainer,r.startOffset),end:Xo(e,r.endContainer,r.endOffset)}}function sl(e,a){const r=window.getSelection();if(!r)return;const s=km(e,a);if(!s)return;const u=document.createRange();u.setStart(s.node,s.offset),u.collapse(!0),r.removeAllRanges(),r.addRange(u)}function ll(e,a,r){if(a===r){sl(e,a);return}const s=window.getSelection();if(!s)return;const u=km(e,a),c=km(e,r);if(!u||!c)return;const d=document.createRange();d.setStart(u.node,u.offset),d.setEnd(c.node,c.offset),s.removeAllRanges(),s.addRange(d)}function km(e,a){let r=0;function s(d){var h;if(d.nodeType===Node.TEXT_NODE){const p=(d.textContent||"").length;return r+p>=a?{node:d,offset:a-r}:(r+=p,null)}if(d.nodeName==="BR"){if((h=d.hasAttribute)!=null&&h.call(d,"data-sentinel"))return null;if(r+1>=a){const p=d.parentNode;if(p)return{node:p,offset:Array.from(p.childNodes).indexOf(d)+1}}return r+=1,null}for(let p=0;p<d.childNodes.length;p++){const g=s(d.childNodes[p]);if(g)return g}return null}const u=s(e);if(u)return u;const c=Dw(e);return c?{node:c,offset:(c.textContent||"").length}:{node:e,offset:0}}function Dw(e){if(e.nodeType===Node.TEXT_NODE)return e;for(let a=e.childNodes.length-1;a>=0;a--){const r=Dw(e.childNodes[a]);if(r)return r}return null}function dD(e){const a=window.getSelection();if(!a||a.rangeCount===0)return;const r=a.getRangeAt(0);r.deleteContents();const s=document.createTextNode(e);r.insertNode(s),r.setStartAfter(s),r.collapse(!0),a.removeAllRanges(),a.addRange(r)}function fD(){const e=window.getSelection();if(!e||e.rangeCount===0)return;const a=e.getRangeAt(0);a.deleteContents();const r=document.createElement("br");a.insertNode(r),a.setStartAfter(r),a.collapse(!0),e.removeAllRanges(),e.addRange(a)}function Lu(e){var h;const a=window.getSelection();if(!a||a.rangeCount===0)return;const r=a.getRangeAt(0);let s=r.getBoundingClientRect();if(s.width===0&&s.height===0){const p=document.createElement("span");p.textContent="​",r.insertNode(p),s=p.getBoundingClientRect(),(h=p.parentNode)==null||h.removeChild(p),a.removeAllRanges(),a.addRange(r)}const u=e.getBoundingClientRect(),c=s.top-u.top+e.scrollTop,d=s.bottom-u.top+e.scrollTop;d>e.scrollTop+e.clientHeight?e.scrollTop=d-e.clientHeight:c<e.scrollTop&&(e.scrollTop=c)}function lm(){var s,u;const e=window.getSelection();if(!e||e.rangeCount===0)return null;const a=e.getRangeAt(0),r=a.getBoundingClientRect();if(r.width===0&&r.height===0||a.collapsed&&a.startContainer.nodeType===Node.ELEMENT_NODE&&a.startOffset>0&&((s=a.startContainer.childNodes[a.startOffset-1])==null?void 0:s.nodeName)==="BR"){const c=document.createElement("span");c.textContent="​",a.insertNode(c);const d=c.getBoundingClientRect();return(u=c.parentNode)==null||u.removeChild(c),e.removeAllRanges(),e.addRange(a),d}return r}function wb(e,a){return Math.min(e,a)}function sm(e,a,r){const s=window.innerHeight,u=window.innerWidth;let c=e.bottom+window.scrollY+4,d=e.left+window.scrollX;return e.bottom+a+4>s&&(c=e.top+window.scrollY-a-4),d+r>u&&(d=u-r-8),d<8&&(d=8),{top:c,left:d}}var hD=new Set([O.VALUE,O.QUOTED_VALUE,O.WILDCARD]);function mD(e,a,r){for(const s of e)if(a>=s.start&&a<=s.end&&hD.has(s.type))return a===s.start&&r===s.end?null:{start:s.start,end:s.end};return null}var pD=new Set([O.VALUE,O.QUOTED_VALUE,O.WILDCARD,O.FIELD_NAME,O.RANGE,O.SAVED_SEARCH,O.HISTORY_REF,O.REGEX]);function gD(e,a,r){const s=[];for(const u of a)if(r>=u.start&&r<=u.end&&pD.has(u.type)){s.push({start:u.start,end:u.end});break}return e&&qu(e,r,s),xD(s)}function qu(e,a,r){if(a<e.start||a>e.end)return!1;let s=!1;switch(e.type){case"BooleanExpr":s=qu(e.left,a,r)||s,s=qu(e.right,a,r)||s;break;case"Group":case"Not":case"FieldGroup":s=qu(e.expression,a,r)||s;break}return r.push({start:e.start,end:e.end}),!0}function xD(e){e.sort((r,s)=>r.end-r.start-(s.end-s.start)||r.start-s.start);const a=[];for(const r of e){const s=a[a.length-1];s&&s.start===r.start&&s.end===r.end||a.push(r)}return a}var vD=60,yD=" ";function bD(e,a){const r=(a==null?void 0:a.maxLineLength)??vD,s=(a==null?void 0:a.indent)??yD,u={whitespace:a==null?void 0:a.whitespaceOperator,and:a==null?void 0:a.andOperator,or:a==null?void 0:a.orOperator,not:a==null?void 0:a.notOperator};let c;return typeof e=="string"?c=new Ns(new vi(e,{savedSearches:!0,historySearch:!0}).tokenize()).parse():c=e,c?Fu(c,0,r,s,u):""}function wD(e,a){return e.implicit?a.whitespace??"":e.operator==="AND"?a.and??e.sourceOperator??"AND":a.or??e.sourceOperator??"OR"}function Cw(e,a){const r=a.not??e.sourceOperator??"NOT";return{op:r,sep:/^[a-zA-Z]/.test(r)?" ":""}}function Cr(e,a){switch(e.type){case"FieldValue":{const r=e.quoted?`"${e.value}"`:e.value,s=e.operator===":"?":":`:${e.operator}`;let u=`${e.field}${s}${r}`;return e.fuzzy!=null&&(u+=`~${e.fuzzy}`),e.proximity!=null&&(u+=`~${e.proximity}`),e.boost!=null&&(u+=`^${e.boost}`),u}case"BareTerm":{let r=e.quoted?`"${e.value}"`:e.value;return e.fuzzy!=null&&(r+=`~${e.fuzzy}`),e.proximity!=null&&(r+=`~${e.proximity}`),e.boost!=null&&(r+=`^${e.boost}`),r}case"Range":{const r=e.lowerInclusive?"[":"{",s=e.upperInclusive?"]":"}",u=`${r}${e.lowerQuoted?`"${e.lower}"`:e.lower} TO ${e.upperQuoted?`"${e.upper}"`:e.upper}${s}`;return e.field?`${e.field}:${u}`:u}case"Regex":return`/${e.pattern}/`;case"SavedSearch":return`#${e.name}`;case"HistoryRef":return`!${e.ref}`;case"Not":{const{op:r,sep:s}=Cw(e,a);return`${r}${s}${Cr(e.expression,a)}`}case"Group":{let r=`(${Cr(e.expression,a)})`;return e.boost!=null&&(r+=`^${e.boost}`),r}case"FieldGroup":{let r=`${e.field}:(${Cr(e.expression,a)})`;return e.boost!=null&&(r+=`^${e.boost}`),r}case"BooleanExpr":{const r=wD(e,a),s=r?` ${r} `:" ";return`${Cr(e.left,a)}${s}${Cr(e.right,a)}`}case"Error":return e.value}}function SD(e){const a=e.operator,r=!!e.implicit,s=[],u=c=>{c.type==="BooleanExpr"&&c.operator===a&&!!c.implicit===r?(u(c.left),u(c.right)):s.push(c)};return u(e),{operator:a,implicit:r,sourceOperator:e.sourceOperator,operands:s}}function Pu(e){return e.type==="Group"||e.type==="FieldGroup"?!0:e.type==="BooleanExpr"?Pu(e.left)||Pu(e.right):e.type==="Not"?Pu(e.expression):!1}var ND={and:"AND",or:"OR",not:"NOT"};function ED(e,a){return!!(Cr(e,ND).length>a||Pu(e))}function Fu(e,a,r,s,u){const c=s.repeat(a);switch(e.type){case"BooleanExpr":{const{operator:d,implicit:h,sourceOperator:p,operands:g}=SD(e),v=h?u.whitespace??"":d==="AND"?u.and??p??"AND":u.or??p??"OR",y=v?` ${v} `:" ",S=g.map(N=>Cr(N,u)).join(y);return S.length<=r?S:g.map((N,w)=>{const j=Fu(N,a,r,s,u);return w===0?j:v?`${c}${v} ${j}`:`${c}${j}`}).join(`
318
- `)}case"Group":{if(!ED(e.expression,r)){let h=`(${Cr(e.expression,u)})`;return e.boost!=null&&(h+=`^${e.boost}`),h}let d=`(
319
- ${jD(Fu(e.expression,a+1,r,s,u),a+1,s)}
320
- ${c})`;return e.boost!=null&&(d+=`^${e.boost}`),d}case"FieldGroup":{let d=`${e.field}:(${Cr(e.expression,u)})`;return e.boost!=null&&(d+=`^${e.boost}`),d}case"Not":{const{op:d,sep:h}=Cw(e,u);return`${d}${h}${Fu(e.expression,a,r,s,u)}`}default:return Cr(e,u)}}function jD(e,a,r){const s=r.repeat(a);return e.split(`
321
- `).map(u=>u.startsWith(s)?u:s+u).join(`
322
- `)}function RD(e){return e?Ho(e):[]}function Sb(e){return e.type==="BooleanExpr"}function Ho(e){switch(e.type){case"BooleanExpr":return Tm(e);case"Group":{const a=[],r=e.expression;return Sb(r)?(a.push({start:e.start,end:e.end}),a.push(...Ho(r)),a.push({start:e.start,end:e.end})):a.push({start:e.start,end:e.end}),a}case"FieldGroup":{const a=[];a.push({start:e.start,end:e.end});const r=e.expression;return Sb(r)&&a.push(...Ho(r)),a}case"Not":{const a=[];return a.push({start:e.start,end:e.end}),a.push(...Ho(e.expression)),a}case"FieldValue":case"BareTerm":case"SavedSearch":case"HistoryRef":case"Regex":case"Range":case"Error":return[{start:e.start,end:e.end}]}}function Tm(e){return e.type==="BooleanExpr"?[...Tm(e.left),...Tm(e.right)]:Ho(e)}function kD(e,a,r,s){if(e.length===0)return null;if(a>=0&&a<e.length){const u=s==="forward"?a+1:a-1;return u>=0&&u<e.length?{stop:e[u],index:u}:null}if(s==="forward"){for(let u=0;u<e.length;u++)if(e[u].start>=r)return{stop:e[u],index:u};return{stop:e[e.length-1],index:e.length-1}}else{for(let u=e.length-1;u>=0;u--)if(e[u].end<=r)return{stop:e[u],index:u};return{stop:e[0],index:0}}}var TD=class{constructor(e=100){vn(this,"stack",[]);vn(this,"index",-1);vn(this,"maxSize");this.maxSize=e}push(e){if(this.index>=0&&this.stack[this.index].value===e.value){this.stack[this.index].cursorPos=e.cursorPos;return}this.stack=this.stack.slice(0,this.index+1),this.stack.push(e),this.stack.length>this.maxSize&&this.stack.shift(),this.index=this.stack.length-1}replaceCurrent(e){this.index>=0?this.stack[this.index]=e:this.push(e)}undo(){return this.index<=0?null:(this.index--,this.stack[this.index])}redo(){return this.index>=this.stack.length-1?null:(this.index++,this.stack[this.index])}canUndo(){return this.index>0}canRedo(){return this.index<this.stack.length-1}current(){return this.index>=0?this.stack[this.index]:null}clear(){this.stack=[],this.index=-1}get length(){return this.stack.length}};function AD(e,a){const r=s=>(a==null?void 0:a(s))??zA(s);if(e.type==="RANGE"&&e.token){const s=e.token.value,u=(s.endsWith("]")||s.endsWith("}")?s.slice(1,-1):s.slice(1)).match(/^(.*?)\s+[Tt][Oo]\s+(.*)$/);if(u)return{mode:"range",start:r(u[1].trim()),end:r(u[2].trim())}}if(e.type==="FIELD_VALUE"&&e.partial){const s=r(e.partial);if(s)return{mode:"single",start:s,end:null}}return null}function DD(e,a){var r,s,u,c;return((e==null?void 0:e.mode)??"single")!==((a==null?void 0:a.mode)??"single")||(((r=e==null?void 0:e.start)==null?void 0:r.getTime())??0)!==(((s=a==null?void 0:a.start)==null?void 0:s.getTime())??0)?!0:(((u=e==null?void 0:e.end)==null?void 0:u.getTime())??0)!==(((c=a==null?void 0:a.end)==null?void 0:c.getTime())??0)}function CD({position:e,colors:a,onSelect:r,colorConfig:s,styleConfig:u,datePickerInit:c,fixedWidth:d,datePresets:h,datePickerClassName:p}){const g=x.useRef(null),[v,y]=x.useState(!1);if(x.useEffect(()=>{const w=document.createElement("div");return document.body.appendChild(w),g.current=w,y(!0),()=>{document.body.removeChild(w),g.current=null}},[]),!v||!g.current)return null;const S=uc(u),N={position:"absolute",zIndex:S.dropdownZIndex,...Tw(a,S),top:`${e.top}px`,left:`${e.left}px`,maxHeight:"none",overflowY:"visible",...d!=null?{width:`${d}px`,minWidth:"unset",maxWidth:"unset"}:{}};return il.createPortal(x.createElement("div",{className:"ei-datepicker-portal",style:N,onMouseDown:w=>w.preventDefault()},x.createElement(rD,{onSelect:r,colors:s,styles:u,initialMode:c==null?void 0:c.mode,initialStart:c==null?void 0:c.start,initialEnd:c==null?void 0:c.end,presets:h,className:p})),g.current)}function OD(e){const{fields:a,onSearch:r,onChange:s,onValidationChange:u,value:c,defaultValue:d,savedSearches:h,searchHistory:p,fetchSuggestions:g,colors:v,styles:y,placeholder:S,className:N,classNames:w,style:j,dropdown:R,features:M,inputRef:$,datePresets:B,onKeyDown:Y,onFocus:ne,onBlur:ae,onTab:U,validateValue:k,parseDate:re,plainModeLength:pe,interceptPaste:Se,defaultField:ye,trailingSpaceOnAccept:he=!0,collapseOnBlur:je=!1}=e,W=typeof ye=="string"?{name:ye,showFieldSuggestions:!1}:ye?{showFieldSuggestions:!1,...ye}:void 0,L=W==null?void 0:W.name,F=(R==null?void 0:R.open)??(R==null?void 0:R.mode)??"always",fe=typeof F=="function",P=fe?null:F,se=(R==null?void 0:R.alignToInput)??!1,A=R==null?void 0:R.maxSuggestions,I=A||10,K=R==null?void 0:R.suggestDebounceMs,ue=parseInt((y==null?void 0:y.dropdownMaxHeight)||"300",10)||300,ge=(M==null?void 0:M.savedSearches)??!!h,xe=(M==null?void 0:M.historySearch)??!!p,ke=(R==null?void 0:R.showSavedSearchHint)??ge,Ie=(R==null?void 0:R.showHistoryHint)??xe,Ue=(R==null?void 0:R.showOperators)!==!1,Ze=(fe||P!=="input")&&(R==null?void 0:R.onNavigation)!==!1,dn=(R==null?void 0:R.navigationDelay)??0,It=(R==null?void 0:R.loadingDelay)??0,pt=R==null?void 0:R.renderFieldHint,ce=R==null?void 0:R.renderHistoryItem,qe=R==null?void 0:R.renderSavedSearchItem,st=R==null?void 0:R.renderHeader,Ht=R==null?void 0:R.renderNoResults,yn=R==null?void 0:R.renderType,At=(R==null?void 0:R.autoSelect)??!1,$t=(R==null?void 0:R.homeEndKeys)??!1,Wt=(M==null?void 0:M.multiline)!==!1,Fn=(M==null?void 0:M.smartSelectAll)??!1,Vn=(M==null?void 0:M.expandSelection)??!1,rn=(M==null?void 0:M.wildcardWrap)??!1,ha=(M==null?void 0:M.clauseNavigation)??!1,ma=M==null?void 0:M.formatQuery,aa=!!ma,Yn=typeof ma=="object"?ma:void 0,me=x.useMemo(()=>({savedSearches:ge,historySearch:xe}),[ge,xe]),Ae=Array.isArray(a)?a:[],[De,Qe]=x.useState(Ae);x.useEffect(()=>{if(Array.isArray(a)){Qe(a);return}let T=!1;return a().then(X=>{T||Qe(X)}),()=>{T=!0}},[a]);const Pe=x.useMemo(()=>{const T=new Map;for(const X of De)if(T.set(X.name.toLowerCase(),X.type),X.aliases)for(const Ee of X.aliases)T.set(Ee.toLowerCase(),X.type);return T},[De]),ee=x.useRef(null),[Dt,Jt]=x.useState(null),Qn=x.useCallback(T=>{ee.current=T,Jt(T)},[]),bn=x.useRef(null),qa=x.useRef(null),_e=x.useRef(c||d||""),bt=x.useRef(null),wt=x.useRef(!1),Et=x.useRef(!1),qt=x.useRef(new TD),Ct=x.useRef(null),ln=x.useRef(new Set),en=x.useRef(null),Pt=x.useRef(null),gt=x.useRef(null),nt=x.useRef(null),jn=x.useRef(!1),Ln=x.useRef(null),D=x.useRef(null),_=x.useRef(null),q=x.useRef("input"),J=x.useRef(null),ie=x.useRef(-1),Te=x.useRef(()=>{}),be=x.useRef(new em(Ae,[],[],A||10,{showSavedSearchHint:ke,showHistoryHint:Ie,hasSavedSearchProvider:typeof h=="function",hasHistoryProvider:typeof p=="function"}));be.current.setDefaultField(W);const Ce=x.useRef(new hb(Ae)),Re=x.useRef(k);Re.current=k;const[Le,$e]=x.useState([]),[We,Oe]=x.useState(null),[tt,Fe]=x.useState([]),[Ft,at]=x.useState(-1),[ht,dt]=x.useState(!1),[mt,tn]=x.useState(!1),[Kn,Rn]=x.useState(null),[zn,$n]=x.useState([]),[Zn,va]=x.useState(!1),[hl,ra]=x.useState(!_e.current),[vr,Je]=x.useState(pe!=null&&_e.current.length>=pe),[Rt,nn]=x.useState(0),[la,Un]=x.useState(0),[Lr,kt]=x.useState(""),[Da,Wn]=x.useState(null),[Wl,Di]=x.useState(null),Ot=x.useRef({tokens:Le,ast:We,suggestions:tt,selectedSuggestionIndex:Ft,showDropdown:ht,showDatePicker:mt,cursorOffset:Rt,selectionEnd:la,autocompleteContext:Lr,validationErrors:zn,cursorContext:Da});Ot.current={tokens:Le,ast:We,suggestions:tt,selectedSuggestionIndex:Ft,showDropdown:ht,showDatePicker:mt,cursorOffset:Rt,selectionEnd:la,autocompleteContext:Lr,validationErrors:zn,cursorContext:Da};const yr=x.useCallback((T,X)=>{if(se&&bn.current){const we=bn.current.getBoundingClientRect();return{top:we.bottom+window.scrollY+4,left:we.left+window.scrollX}}const Ee=lm();return Ee?sm(Ee,T,X):null},[se]),dc=x.useCallback(()=>{if(!(!se||!bn.current))return bn.current.getBoundingClientRect().width},[se]),sr=x.useCallback((T,X,Ee="dropdown")=>{const we=Ee==="datePicker"?T:wb(T,ue);if(se&&Ee!=="datePicker"){dt(!0),Rn(yr(we,X));return}const Ge=requestAnimationFrame(()=>{ln.current.delete(Ge),Ee==="datePicker"?tn(!0):dt(!0);const de=lm();Rn(de?sm(de,we,X):null)});ln.current.add(Ge)},[se,yr,ue]),ml=80,Cd=60,Ds=x.useCallback((T,X)=>{if(!ee.current)return;const Ee=di(T,v,{cursorOffset:X,tokenClassName:w==null?void 0:w.token,fieldTypeMap:Pe});ee.current.innerHTML=Ee,document.activeElement===ee.current&&sl(ee.current,X)},[v]),ya=x.useCallback((T,X)=>{const Ee=pe!=null&&T.length>=pe;if(Je(Ee),Ee){if($e([]),Oe(null),$n([]),ra(T.length===0),Fe([]),Ot.current.tokens=[],dt(!1),tn(!1),ee.current){const Ne=Ul(ee.current);ee.current.querySelector("span")&&(ee.current.textContent=T,sl(ee.current,Ne)),nn(Ne),Un(Ne)}s&&s(T,null),u&&u([]);return}const we=new vi(T,me).tokenize(),Ge=new Ns(we),de=Ge.parse(),ve=_u([...Ge.getErrors().map(Ne=>({message:Ne.message,start:Ne.start,end:Ne.end,type:"SYNTAX_ERROR"})),...Ce.current.validate(de,Re.current,re,L)]);if(ee.current){const Ne=Ul(ee.current);X&&we.length>ml?(Pt.current&&clearTimeout(Pt.current),Pt.current=setTimeout(()=>{Pt.current=null,ee.current&&Ds(we,Ul(ee.current))},Cd)):(Pt.current&&(clearTimeout(Pt.current),Pt.current=null),Ds(we,Ne)),$e(we),Oe(de),$n(ve),ra(T.length===0),nn(Ne),Un(Ne),Ot.current.tokens=we,X&&Te.current(we,Ne)}else $e(we),Oe(de),$n(ve),ra(T.length===0),Ot.current.tokens=we;s&&s(T,de),u&&u(ve)},[v,s,u,Ds,pe]),Jl=x.useCallback((T,X)=>{if(!pt||X.type!=="FIELD_VALUE"||!X.fieldName)return T;const Ee=be.current.resolveField(X.fieldName);if(!Ee)return T;const we=pt(Ee,X.partial);return we==null?T:T.some(Ge=>Ge.type==="hint")?T.map(Ge=>Ge.type==="hint"?{...Ge,customContent:we}:Ge):[{text:"",label:"",type:"hint",customContent:we,replaceStart:X.start??0,replaceEnd:X.end??0},...T]},[pt]),Cs=x.useCallback(T=>{if(!Ht)return!1;const X=Ht({cursorContext:T,partial:T.partial});return X==null?!1:(Fe([{text:"",label:"",type:"noResults",customContent:X,replaceStart:0,replaceEnd:0}]),at(-1),tn(!1),sr(32,300),!0)},[Ht]),ba=x.useCallback((T,X,Ee)=>{var Ne,et,it;const we=be.current.getSuggestions(T,X);Ue||(we.suggestions=we.suggestions.filter(Be=>Be.type!=="operator"));const Ge=we.context.type;if(Wn(we.context),fe){if(F({trigger:q.current,context:we.context,suggestions:we.suggestions,isOpen:Ot.current.showDropdown||Ot.current.showDatePicker,value:_e.current,selectionStart:X,selectionEnd:Ee??X})===!1){dt(!1),tn(!1),Fe([]);return}}else{if(P==="never"){dt(!1),tn(!1),Fe([]);return}if(P==="manual"){if(_.current&&_.current!==Ge){_.current=null,dt(!1),tn(!1),Fe([]);return}if(!_.current){dt(!1),tn(!1),Fe([]);return}}if(P==="input"&&q.current!=="input"&&q.current!=="ctrlSpace"){dt(!1),tn(!1),Fe([]);return}if(P==="always"&&T.some(Be=>(Be.type===O.AND||Be.type===O.OR||Be.type===O.NOT||Be.type===O.TILDE||Be.type===O.BOOST)&&X>=Be.start&&X<=Be.end)){dt(!1),tn(!1),Fe([]);return}}const de=we.context.fieldName?be.current.resolveField(we.context.fieldName):void 0,ve=!!(g&&we.context.type==="FIELD_VALUE"&&we.context.fieldName&&(de==null?void 0:de.type)!=="boolean"&&(de==null?void 0:de.suggestions)!==!1)||typeof h=="function"&&we.context.type==="SAVED_SEARCH"||typeof p=="function"&&we.context.type==="HISTORY_REF";if(we.showDatePicker){jn.current=!1,(Ne=en.current)==null||Ne.abort(),bt.current&&clearTimeout(bt.current),nt.current&&(clearTimeout(nt.current),nt.current=null);const Be=AD(we.context,re),kn=Ln.current;Ln.current=Be,Di(Be);const Ut=we.context.token;Ut&&(Ut.type==="COLON"||Ut.type==="COMPARISON_OP")?D.current={start:Ut.end,end:Ut.end}:Ut?D.current={start:Ut.start,end:Ut.end}:D.current={start:X,end:X},Ot.current.showDatePicker&&DD(kn,Be)&&tn(!1),Fe([]),se||dt(!1),kt(Ge),sr(350,300,"datePicker");return}if(ve){const Be=we.context.token,kn=Be?Be.start:X,Ut=Be?Be.end:X,oa=()=>{nt.current=null,Fe([{text:"",label:"Searching...",type:"loading",replaceStart:kn,replaceEnd:Ut}]),se||dt(!1),tn(!1),at(-1),sr(32,300)};nt.current&&clearTimeout(nt.current),It>0?nt.current=setTimeout(oa,It):oa(),kt(Ge)}else{jn.current=!1,(et=en.current)==null||et.abort(),bt.current&&clearTimeout(bt.current),nt.current&&(clearTimeout(nt.current),nt.current=null);const Be=Jl(we.suggestions,we.context);Be.length>0?(Fe(Be),se||dt(!1),tn(!1),at(we.context.partial||At?0:-1),kt(Ge),sr(Be.length*32,300)):(kt(Ge),Cs(we.context)||(dt(!1),tn(!1),Fe([])))}if(ve){const Be=we.context.partial,kn=K||200;jn.current=!0,bt.current&&clearTimeout(bt.current),(it=en.current)==null||it.abort();const Ut=new AbortController;en.current=Ut,bt.current=setTimeout(async()=>{const oa=we.context.token,ca=oa?oa.start:X,wa=oa?oa.end:X;try{let Tn;if(we.context.type==="SAVED_SEARCH"&&typeof h=="function"){const mn=await h(Be);if(Ut.signal.aborted)return;Tn=mn.map(Bt=>({text:Bt.query,label:Bt.label||Bt.query,description:Bt.description,type:"savedSearch",replaceStart:ca,replaceEnd:wa,matchPartial:Be,sourceData:Bt}))}else if(we.context.type==="HISTORY_REF"&&typeof p=="function"){const mn=await p(Be);if(Ut.signal.aborted)return;Tn=mn.map(Bt=>({text:em.wrapHistoryQuery(Bt.query),label:Bt.label||Bt.query,description:Bt.description,type:"history",replaceStart:ca,replaceEnd:wa,matchPartial:Be,sourceData:Bt}))}else{const mn=we.context.fieldName,Bt=be.current.resolveField(mn),as=await g(Bt?Bt.name:mn,Be);if(Ut.signal.aborted)return;Tn=as.map(Sr=>({text:Sr.text,label:Sr.label||Sr.text,description:Sr.description,type:Sr.type,replaceStart:ca,replaceEnd:wa,matchPartial:Be}))}if(nt.current&&(clearTimeout(nt.current),nt.current=null),Tn=Tn.slice(0,I),Tn.length>0){if(W!=null&&W.showFieldSuggestions){const mn=be.current.getFieldSuggestions(Be,ca,wa);Tn=[...Tn,...mn].slice(0,I)}Fe(Tn),at(Be||At?0:-1),sr(Tn.length*32,300)}else{const mn=be.current.getSuggestions(Ot.current.tokens,Ot.current.cursorOffset);if(!(Be&&Cs(mn.context))){const Bt=Jl(mn.suggestions.filter(as=>as.type==="hint"),mn.context);Bt.length>0?(Fe(Bt),at(mn.context.partial||At?0:-1),sr(Bt.length*32,300)):Cs(mn.context)||(dt(!1),Fe([]))}}}catch(Tn){nt.current&&(clearTimeout(nt.current),nt.current=null),Ut.signal.aborted||(Fe([{text:"",label:Tn instanceof Error?Tn.message:"Error loading suggestions",type:"error",replaceStart:ca,replaceEnd:wa}]),at(-1),sr(32,300),jn.current=!1)}},kn)}},[g,h,p,K,Jl,yr,sr,se,F,fe,P,Ue,I,It,At,Cs]);Te.current=ba;const sn=x.useCallback(()=>{var T;dt(!1),tn(!1),Di(null),Ln.current=null,D.current=null,Fe([]),at(-1),jn.current=!1,(T=en.current)==null||T.abort(),bt.current&&(clearTimeout(bt.current),bt.current=null),gt.current&&(clearTimeout(gt.current),gt.current=null),_.current=null},[]),sa=x.useCallback((T,X,Ee)=>{if(gt.current&&(clearTimeout(gt.current),gt.current=null),!Ze){(Ot.current.showDropdown||Ot.current.showDatePicker)&&sn();return}q.current="navigation",dn>0?gt.current=setTimeout(()=>{gt.current=null,ba(T,X,Ee)},dn):ba(T,X,Ee)},[Ze,dn,ba,sn]),Ca=x.useCallback((T,X,Ee)=>{_e.current=T,Ct.current&&(clearTimeout(Ct.current),Ct.current=null),qt.current.push({value:T,cursorPos:X});const we=new vi(T,me).tokenize(),Ge=new Ns(we),de=Ge.parse(),ve=_u([...Ge.getErrors().map(Ne=>({message:Ne.message,start:Ne.start,end:Ne.end,type:"SYNTAX_ERROR"})),...Ce.current.validate(de,Re.current,re,L)]);if(ee.current){const Ne=di(we,v,{cursorOffset:X,tokenClassName:w==null?void 0:w.token,fieldTypeMap:Pe});ee.current.innerHTML=Ne,sl(ee.current,X)}if($e(we),Oe(de),$n(ve),ra(T.length===0),nn(X),Un(X),dt(!1),tn(!1),s&&s(T,de),u&&u(ve),Ee){const Ne=requestAnimationFrame(()=>{ln.current.delete(Ne),Ee(we,de)});ln.current.add(Ne)}},[v,s,u]),zr=x.useCallback((T,X="Enter",Ee,we)=>{if(!T)return;const Ge=Ot.current,de=Ge.autocompleteContext,ve=de==="FIELD_VALUE"||de==="SAVED_SEARCH"||de==="HISTORY_REF";if(ve&&(q.current="navigation"),T.type==="hint"&&(T.text==="#"||T.text==="!")){const mn=T.text,Bt=T.replaceStart,as=Math.max(T.replaceEnd,Ge.selectionEnd),Sr=_e.current.slice(0,Bt),Md=_e.current.slice(as),pc=Sr+mn+Md,gc=Sr.length+mn.length;Ca(pc,gc,(_d,Ld)=>{Ee?Ee(pc,Ld):ba(_d,gc)});return}if(T.type==="hint")return;const Ne=Ge.autocompleteContext==="FIELD_VALUE",et=Math.min(T.replaceStart,Ge.cursorOffset),it=Math.max(T.replaceEnd,Ge.selectionEnd),Be=_e.current.slice(0,et),kn=_e.current.slice(it);let Ut="",oa=kn;ve&&he&&(kn.length===0?Ut=" ":/^[ \t\r\n]+$/.test(kn)&&!kn.startsWith("\\ ")&&(Ut=" ",oa=""));const ca=Be+T.text+Ut+oa,wa=Be.length+T.text.length+Ut.length,Tn=X==="Enter"&&Ne;Ca(ca,wa,(mn,Bt)=>{Ee?Ee(ca,Bt):Tn?r&&r(ca,Bt,we):ba(mn,wa)})},[Ca,ba,r,he]);x.useEffect(()=>{Array.isArray(h)&&be.current.updateSavedSearches(h),Array.isArray(p)&&be.current.updateSearchHistory(p)},[h,p]),x.useEffect(()=>{be.current=new em(De,[],[],A||10,{showSavedSearchHint:ke,showHistoryHint:Ie,hasSavedSearchProvider:typeof h=="function",hasHistoryProvider:typeof p=="function"}),be.current.setDefaultField(W),Ce.current=new hb(De),Array.isArray(h)&&be.current.updateSavedSearches(h),Array.isArray(p)&&be.current.updateSearchHistory(p),_e.current&&ya(_e.current,!1)},[De,A,ke,Ie]),x.useEffect(()=>{$&&$({getValue:()=>_e.current,setValue:T=>{_e.current=T,ya(T,!1)},focus:()=>{var T;return(T=ee.current)==null?void 0:T.focus()},blur:()=>{var T;return(T=ee.current)==null?void 0:T.blur()},getAST:()=>Ot.current.ast,getValidationErrors:()=>Ot.current.validationErrors,setSelection:(T,X)=>{ee.current&&(ee.current.focus(),ll(ee.current,T,X),nn(T),Un(X))}})},[$,ya]),x.useEffect(()=>{const T=_e.current;qt.current.push({value:T,cursorPos:T.length}),T&&ya(T,!1)},[]),x.useEffect(()=>{c!==void 0&&c!==_e.current&&(_e.current=c,ya(c,!1))},[c,ya]),x.useEffect(()=>()=>{var T;bt.current&&clearTimeout(bt.current),Pt.current&&clearTimeout(Pt.current),gt.current&&clearTimeout(gt.current),nt.current&&clearTimeout(nt.current),ln.current.forEach(X=>cancelAnimationFrame(X)),ln.current.clear(),(T=en.current)==null||T.abort()},[]),x.useEffect(()=>{if(fe){const T=Ot.current;T.cursorContext&&F({trigger:"modeChange",context:T.cursorContext,suggestions:T.suggestions,isOpen:T.showDropdown||T.showDatePicker,value:_e.current,selectionStart:T.cursorOffset,selectionEnd:T.selectionEnd})===!1&&(dt(!1),tn(!1),Fe([]))}else P==="never"&&(dt(!1),tn(!1),Fe([]));_.current=null},[F]);const br=x.useRef(!1);x.useLayoutEffect(()=>{if(br.current){br.current=!1;return}const T=qa.current;if(!T||!Kn)return;const X=T.getBoundingClientRect(),Ee=window.innerWidth;if(X.right>Ee-8){const we=X.right-Ee+8;br.current=!0,Rn(Ge=>Ge&&{...Ge,left:Math.max(8,Ge.left-we)})}},[Kn,ht,mt,tt]),x.useEffect(()=>{const T=()=>{const X=Ot.current;if(!(!X.showDropdown&&!X.showDatePicker))if(X.showDropdown&&se&&bn.current){const Ee=bn.current.getBoundingClientRect();Rn({top:Ee.bottom+window.scrollY+4,left:Ee.left+window.scrollX})}else{const Ee=lm();Ee&&Rn(sm(Ee,X.showDatePicker?350:wb(X.suggestions.length*32,ue),300))}};return window.addEventListener("resize",T),window.addEventListener("scroll",T,!0),()=>{window.removeEventListener("resize",T),window.removeEventListener("scroll",T,!0)}},[se,ue]),x.useEffect(()=>{const T=ee.current;if(!T)return;const X=()=>{(Ot.current.showDropdown||Ot.current.showDatePicker)&&sn()};return T.addEventListener("scroll",X),()=>T.removeEventListener("scroll",X)},[sn]);const $r=x.useRef(null),Ci=x.useRef(v);x.useEffect(()=>{if(!ee.current)return;const T=Ot.current.tokens;if(T.length===0||Zn&&la!==Rt)return;const X=Zn?Rt:-1,Ee=v!==Ci.current;Ci.current=v;const we=Aw(T,X),Ge=we?`${we.openStart},${we.closeStart}`:null;if(Ge===$r.current&&!Ee)return;$r.current=Ge;const de=Zn?Ul(ee.current):-1,ve=di(T,v,{cursorOffset:X,tokenClassName:w==null?void 0:w.token,fieldTypeMap:Pe});ee.current.innerHTML=ve,Zn&&de>=0&&sl(ee.current,de)},[Rt,la,Zn,v]);const wr=je&&!Zn,Oi=x.useRef(wr);x.useEffect(()=>{if(!ee.current)return;const T=Oi.current;if(Oi.current=wr,T!==wr)if(wr)ee.current.innerHTML=ee.current.innerHTML.replace(/<br\s*\/?>/gi," ");else{const X=Ot.current.tokens;if(X.length>0){const Ee=Zn?Ul(ee.current):-1,we=di(X,v,{cursorOffset:Ee,tokenClassName:w==null?void 0:w.token,fieldTypeMap:Pe});ee.current.innerHTML=we,Zn&&Ee>=0&&sl(ee.current,Ee)}}},[wr,v]);const Pa=x.useCallback(()=>{if(wt.current||!ee.current)return;J.current=null,ie.current=-1,gt.current&&(clearTimeout(gt.current),gt.current=null);let T=OA(ee.current);if(T===_e.current)return;let X=Ul(ee.current);const Ee=ob(T);Ee!==T&&(T=Ee,X=Math.min(X,T.length)),_e.current=T;const we=qt.current,Ge=we.current();if(Ge&&Math.abs(T.length-Ge.value.length)<=2&&Ct.current?we.replaceCurrent({value:T,cursorPos:X}):we.push({value:T,cursorPos:X}),Ct.current&&clearTimeout(Ct.current),Ct.current=setTimeout(()=>{Ct.current=null},300),q.current="input",!fe&&P==="input"){const de=X>0?T[X-1]:"";if(!de||de.trim()===""){ya(T,!1),sn(),ee.current&&Lu(ee.current);return}}ya(T,!0),ee.current&&Lu(ee.current)},[ya,fe,P,sn]),ir=x.useCallback(()=>{wt.current=!0},[]),Mi=x.useCallback(()=>{wt.current=!1,Pa()},[Pa]),Ur=x.useCallback(T=>{if(!T)return;_e.current=T.value;const X=new vi(T.value,me).tokenize(),Ee=new Ns(X),we=Ee.parse(),Ge=_u([...Ee.getErrors().map(ve=>({message:ve.message,start:ve.start,end:ve.end,type:"SYNTAX_ERROR"})),...Ce.current.validate(we,Re.current,re,L)]),de=T.selStart!=null&&T.selStart!==T.cursorPos;if(ee.current){const ve=di(X,v,{cursorOffset:T.cursorPos,tokenClassName:w==null?void 0:w.token,fieldTypeMap:Pe});ee.current.innerHTML=ve,de?ll(ee.current,T.selStart,T.cursorPos):sl(ee.current,T.cursorPos)}$e(X),Oe(we),$n(Ge),ra(T.value.length===0),nn(de?T.selStart:T.cursorPos),Un(T.cursorPos),sn(),s&&s(T.value,we),u&&u(Ge)},[v,s,u,sn]),Fa=x.useCallback(()=>{const T=qa.current;if(!T)return 10;const X=T.clientHeight,Ee=T.querySelectorAll(".ei-dropdown-item")[0];if(!Ee)return 10;const we=Ee.offsetHeight;return we<=0?10:Math.max(1,Math.floor(X/we))},[]),_i=x.useCallback(T=>{var we,Ge;if(Y&&Y(T),T.defaultPrevented)return;const X=Ot.current,Ee=T.nativeEvent.code;if(aa&&Ee==="KeyF"&&T.altKey&&T.shiftKey&&!T.ctrlKey&&!T.metaKey){T.preventDefault();const de=bD(_e.current,Yn);de!==_e.current&&Ca(de,de.length);return}if(ee.current&&ee.current.childNodes.length>40){const de=window.getSelection();if(de!=null&&!de.isCollapsed){const ve=Tr(ee.current);if(ve.end-ve.start>20){const Ne=T.key==="Backspace"||T.key==="Delete"||T.key==="x"&&(T.ctrlKey||T.metaKey),et=!T.ctrlKey&&!T.metaKey&&!T.altKey&&T.key.length===1;(Ne||et)&&(ee.current.textContent=_e.current,ll(ee.current,ve.start,ve.end))}}}{let de=null,ve=null;if(cb[T.key])de=T.key,ve=cb[T.key];else if(rn&&T.key==="*"&&ee.current){const Ne=Tr(ee.current);if(Ne.start!==Ne.end){const[et,it]=ub(X.tokens,Ne.start,Ne.end);if(et>=0&&et===it){const Be=X.tokens[et];(Be.type===O.VALUE||Be.type===O.WILDCARD)&&(de="*",ve="*")}}}if(de&&ve&&ee.current){const Ne=Tr(ee.current);if(Ne.start!==Ne.end){T.preventDefault();const{newValue:et,newSelStart:it,newSelEnd:Be}=CA(_e.current,Ne.start,Ne.end,de,ve),kn=qt.current,Ut=kn.current();Ut&&Ut.value===_e.current&&(Ut.selStart=Ne.start,Ut.cursorPos=Ne.end),_e.current=et,Ct.current&&(clearTimeout(Ct.current),Ct.current=null),kn.push({value:et,cursorPos:Be,selStart:it});const oa=new vi(et,me).tokenize(),ca=new Ns(oa),wa=ca.parse(),Tn=_u([...ca.getErrors().map(Bt=>({message:Bt.message,start:Bt.start,end:Bt.end,type:"SYNTAX_ERROR"})),...Ce.current.validate(wa,Re.current,re,L)]),mn=di(oa,v,{cursorOffset:Be,tokenClassName:w==null?void 0:w.token,fieldTypeMap:Pe});ee.current.innerHTML=mn,ll(ee.current,it,Be),$e(oa),Oe(wa),$n(Tn),ra(!1),nn(it),Un(Be),sn(),s&&s(et,wa),u&&u(Tn);return}}}if(T.key==="z"&&(T.ctrlKey||T.metaKey)&&!T.shiftKey){T.preventDefault(),Ur(qt.current.undo());return}if(T.key==="y"&&(T.ctrlKey||T.metaKey)||T.key==="z"&&(T.ctrlKey||T.metaKey)&&T.shiftKey){T.preventDefault(),Ur(qt.current.redo());return}if(T.key==="a"&&(T.ctrlKey||T.metaKey)&&Fn&&ee.current){const de=Tr(ee.current),ve=mD(X.tokens,de.start,de.end);if(ve){T.preventDefault(),ll(ee.current,ve.start,ve.end),nn(ve.start),Un(ve.end);return}}if(Vn&&T.altKey&&T.shiftKey&&(Ee==="ArrowRight"||Ee==="ArrowLeft")&&ee.current){const de=Ee==="ArrowRight";let ve=J.current;if(!ve){const et=Tr(ee.current),it=gD(X.ast,X.tokens,et.start);if(it.length===0)return;ve={ranges:it,level:-1},J.current=ve}const Ne=de?Math.min(ve.level+1,ve.ranges.length-1):Math.max(ve.level-1,-1);if(Ne===ve.level)return;if(ve.level=Ne,Ne<0){const et=Tr(ee.current);sl(ee.current,et.start),J.current=null}else{T.preventDefault();const et=ve.ranges[Ne];ll(ee.current,et.start,et.end),nn(et.start),Un(et.end)}return}if(J.current=null,ha&&T.ctrlKey&&T.altKey&&(Ee==="ArrowRight"||Ee==="ArrowLeft")&&ee.current){T.preventDefault();const de=Ee==="ArrowRight"?"forward":"backward",ve=RD(X.ast),Ne=Tr(ee.current),et=de==="forward"?Ne.end:Ne.start,it=kD(ve,ie.current,et,de);it&&(ie.current=it.index,ll(ee.current,it.stop.start,it.stop.end),nn(it.stop.start),Un(it.stop.end));return}if(ie.current=-1,T.key===" "&&(T.ctrlKey||T.metaKey)){T.preventDefault(),q.current="ctrlSpace",!fe&&P==="manual"&&(_.current=be.current.getSuggestions(X.tokens,X.cursorOffset).context.type),ba(X.tokens,X.cursorOffset);return}if(T.key==="Enter"&&(T.ctrlKey||T.metaKey)){T.preventDefault(),sn(),r&&r(_e.current,X.ast,T);return}if(T.key==="Enter"&&T.shiftKey&&Wt){T.preventDefault(),fD();const de=ee.current?Ul(ee.current):_e.current.length+1,ve=_e.current,Ne=ve.slice(0,de-1)+`
323
- `+ve.slice(de-1);_e.current=Ne,J.current=null,gt.current&&(clearTimeout(gt.current),gt.current=null),q.current="input",qt.current.push({value:Ne,cursorPos:de}),ya(Ne,!0),ee.current&&Lu(ee.current);return}if((T.key==="Backspace"||T.key==="Delete")&&ee.current&&!ee.current.textContent){const de=_e.current;if(!de)return;const{start:ve,end:Ne}=Tr(ee.current);let et,it;if(ve!==Ne)et=de.slice(0,ve)+de.slice(Ne),it=ve;else if(T.key==="Backspace"&&ve>0)et=de.slice(0,ve-1)+de.slice(ve),it=ve-1;else if(T.key==="Delete"&&ve<de.length)et=de.slice(0,ve)+de.slice(ve+1),it=ve;else return;T.preventDefault(),_e.current=et,J.current=null,gt.current&&(clearTimeout(gt.current),gt.current=null),q.current="input",qt.current.push({value:et,cursorPos:it}),sl(ee.current,it),ya(et,!0),ee.current&&Lu(ee.current);return}if(Et.current=!1,X.showDropdown&&X.suggestions.length>0)switch(T.key){case"ArrowDown":T.preventDefault(),Et.current=!0,at(de=>de>=X.suggestions.length-1?0:de+1);return;case"ArrowUp":T.preventDefault(),Et.current=!0,at(de=>de<=0?X.suggestions.length-1:de-1);return;case"PageDown":{T.preventDefault(),Et.current=!0;const de=Fa();at(ve=>Math.min(ve+de,X.suggestions.length-1));return}case"PageUp":{T.preventDefault(),Et.current=!0;const de=Fa();at(ve=>Math.max(ve-de,0));return}case"Home":if($t&&X.selectedSuggestionIndex>=0){T.preventDefault(),Et.current=!0,at(0);return}break;case"End":if($t&&X.selectedSuggestionIndex>=0){T.preventDefault(),Et.current=!0,at(X.suggestions.length-1);return}break;case"Enter":if(X.selectedSuggestionIndex>=0){const de=X.suggestions[X.selectedSuggestionIndex];if(de.type==="loading"||de.type==="error"){T.preventDefault(),sn(),r&&r(_e.current,X.ast,T);return}if(de.type==="hint"&&de.text!=="#"&&de.text!=="!"){T.preventDefault(),sn();const ve=_e.current,Ne=X.cursorOffset;if(Ne<=ve.length&&ve[Ne]!==" "){const et=ve.slice(0,Ne),it=ve.slice(Ne),Be=et+" "+it;Ca(Be,Ne+1,()=>{r&&r(Be,X.ast,T)})}else r&&r(ve,X.ast,T);return}T.preventDefault(),zr(de,"Enter",void 0,T);return}T.preventDefault(),sn(),r&&r(_e.current,X.ast,T);return;case"Tab":if(U){T.preventDefault();const de=X.selectedSuggestionIndex>=0?X.suggestions[X.selectedSuggestionIndex]:null,ve=de&&de.type!=="loading"&&de.type!=="error"&&!(de.type==="hint"&&de.text!=="#"&&de.text!=="!")?de:null,Ne=U({suggestion:ve,cursorContext:X.cursorContext||{type:"EMPTY",partial:""},query:_e.current});Ne.accept&&ve?zr(ve,"Tab",(et,it)=>{var Be;Ne.submit&&r&&r(et,it,T),Ne.blur&&((Be=ee.current)==null||Be.blur())},T):(sn(),Ne.submit&&r&&r(_e.current,X.ast,T),Ne.blur&&((we=ee.current)==null||we.blur()));return}if(X.selectedSuggestionIndex>=0){const de=X.suggestions[X.selectedSuggestionIndex];if(de.type==="hint"&&de.text!=="#"&&de.text!=="!"){T.preventDefault(),sn();const ve=_e.current,Ne=X.cursorOffset;if(Ne<=ve.length&&ve[Ne]!==" "){const et=ve.slice(0,Ne),it=ve.slice(Ne),Be=et+" "+it,kn=Ne+1;Ca(Be,kn,Ut=>{ba(Ut,kn)})}return}T.preventDefault(),zr(de,"Tab",void 0,T);return}break;case"Escape":T.preventDefault(),sn();return}if(T.key==="Tab"&&U){T.preventDefault();const de=U({suggestion:null,cursorContext:X.cursorContext||{type:"EMPTY",partial:""},query:_e.current});de.submit&&r&&r(_e.current,X.ast,T),de.blur&&((Ge=ee.current)==null||Ge.blur());return}if(X.showDatePicker&&T.key==="Escape"){T.preventDefault(),sn();return}if(T.key==="Enter"&&!X.showDropdown&&!X.showDatePicker){T.preventDefault(),r&&r(_e.current,X.ast,T);return}},[r,sn,zr,Ca,Ur,Wt,fe,P,ba,Y,U,Fn,Vn,ha,$t,Fa,aa]),Os=x.useCallback(T=>{if(Et.current){Et.current=!1;return}if(["ArrowLeft","ArrowRight","Home","End","PageUp","PageDown"].includes(T.key)){if(!ee.current)return;const X=Tr(ee.current);nn(X.start),Un(X.end),sa(Ot.current.tokens,X.start,X.end)}},[sa]),fc=x.useCallback(()=>{va(!0),ne==null||ne();const T=requestAnimationFrame(()=>{if(ln.current.delete(T),ee.current){const X=Ot.current.tokens,Ee=X.length>0?Ul(ee.current):0;nn(Ee),Un(Ee),sa(X,Ee)}});ln.current.add(T)},[Pa,sa,ne]),Ms=x.useCallback(()=>{var T;va(!1),dt(!1),tn(!1),Fe([]),jn.current=!1,(T=en.current)==null||T.abort(),bt.current&&(clearTimeout(bt.current),bt.current=null),nt.current&&(clearTimeout(nt.current),nt.current=null),nn(-1),ae==null||ae()},[ae]),Br=x.useRef(!1),hc=x.useCallback(T=>{if(!ee.current||T.detail!==2&&T.detail!==3)return;if(T.detail===3){if(!Ot.current.ast)return;const Ne=document.caretRangeFromPoint(T.clientX,T.clientY);if(!Ne)return;const et=Xo(ee.current,Ne.startContainer,Ne.startOffset),it=kA(Ot.current.ast,_e.current,et);if(!it||it.start>=it.end)return;T.preventDefault(),Br.current=!0,ll(ee.current,it.start,it.end);return}T.preventDefault(),Br.current=!0;const X=document.caretRangeFromPoint(T.clientX,T.clientY);if(!X)return;const Ee=Xo(ee.current,X.startContainer,X.startOffset),we=_e.current,Ge=Ne=>!/[\s:()[\]{}"<>!,;|&=~^+\-*/\\]/.test(Ne);let de=Ee;for(;de>0&&Ge(we[de-1]);)de--;let ve=Ee;for(;ve<we.length&&Ge(we[ve]);)ve++;de<ve&&ll(ee.current,de,ve)},[]),ia=x.useCallback(T=>{Br.current&&(T.preventDefault(),Br.current=!1)},[]),Ir=x.useCallback(()=>{if(!ee.current)return;const T=Tr(ee.current);if(nn(T.start),Un(T.end),T.start!==T.end){const[X,Ee]=ub(Ot.current.tokens,T.start,T.end);if(X!==Ee){sn();return}}sa(Ot.current.tokens,T.start,T.end)},[sa,sn]),Hr=x.useCallback(T=>{Ct.current&&(clearTimeout(Ct.current),Ct.current=null),dD(T),Pa()},[Pa]),es=x.useCallback(T=>{T.preventDefault();const X=ob(T.clipboardData.getData("text/plain"));if(Se){const Ee=Se(X,T);Ee!=null&&typeof(Ee==null?void 0:Ee.then)=="function"?Ee.then(we=>{we!=null&&Hr(we)}).catch(()=>{}):Ee!=null&&Hr(Ee)}else Hr(X)},[Se,Hr]),Od=x.useCallback(T=>{q.current="navigation";const X=Ot.current,Ee=D.current,we=Ee?Ee.start:X.cursorOffset,Ge=Ee?Ee.end:X.cursorOffset,de=_e.current.slice(0,we),ve=_e.current.slice(Ge);let Ne="",et=ve;he&&T.length>0&&(ve.length===0?Ne=" ":/^[ \t\r\n]+$/.test(ve)&&!ve.startsWith("\\ ")&&(Ne=" ",et=""));const it=de+T+Ne+et,Be=de.length+T.length+Ne.length;Ca(it,Be,kn=>{ee.current&&ee.current.focus(),ba(kn,Be)})},[Ca,ba,he]),pl=cc(v),ts=uc(y),ns=IA(pl,j),qr={...HA(pl,ts),...Zn?qA(ts):{}};wr&&(qr.whiteSpace="nowrap",qr.overflow="hidden",qr.textOverflow="ellipsis");const mc=PA(pl,ts);return x.createElement("div",{ref:bn,style:ns,className:Ia("ei-container",N,w==null?void 0:w.container)},x.createElement("div",{ref:Qn,contentEditable:!0,suppressContentEditableWarning:!0,className:Ia("ei-editor",w==null?void 0:w.editor),style:qr,onInput:Pa,onKeyDown:_i,onKeyUp:Os,onMouseDown:hc,onMouseUp:ia,onFocus:fc,onBlur:Ms,onClick:Ir,onPaste:es,onCompositionStart:ir,onCompositionEnd:Mi,spellCheck:!1}),hl&&!Zn?x.createElement("div",{className:Ia("ei-placeholder",w==null?void 0:w.placeholder),style:mc},S):null,x.createElement(uD,{errors:zn,editorRef:Dt,cursorOffset:Rt,colors:v,styles:y,containerRef:bn.current,classNames:w?{squiggly:w.squiggly,tooltip:w.tooltip}:void 0}),x.createElement(nD,{suggestions:tt,selectedIndex:Ft,onSelect:T=>zr(T,"Tab"),position:Kn,colors:v,styles:y,visible:ht,fixedWidth:dc(),renderHistoryItem:ce,renderSavedSearchItem:qe,renderDropdownHeader:st,cursorContext:Da,listRefCallback:T=>{qa.current=T},renderType:yn,classNames:w?{dropdown:w.dropdown,dropdownHeader:w.dropdownHeader,dropdownItem:w.dropdownItem}:void 0}),mt&&Kn?x.createElement(CD,{position:Kn,colors:pl,onSelect:Od,colorConfig:v,styleConfig:y,datePickerInit:Wl,fixedWidth:void 0,datePresets:B,datePickerClassName:w==null?void 0:w.datePicker}):null)}const MD=["planned","in-progress","done","blocked","canceled","rejected","deferred","waiting"];function Nb(e){var u;const a=window.getSelection();if(!a||a.rangeCount===0)return((u=e.textContent)==null?void 0:u.length)??0;const r=a.getRangeAt(0),s=r.cloneRange();return s.selectNodeContents(e),s.setEnd(r.endContainer,r.endOffset),s.toString().length}function _D(e){return a=>{if(!(a.ctrlKey&&!a.metaKey&&!a.altKey))return;const r=a.key.toLowerCase(),s=a.currentTarget,u=s.isContentEditable?s:s.querySelector("[contenteditable='true'], [contenteditable]")??s,c=e.current;if(r==="h"&&c){a.preventDefault();const h=c.getValue();let p=Nb(u);(p<0||p>h.length)&&(p=h.length),p>0&&(c.setValue(h.slice(0,p-1)+h.slice(p)),c.setSelection(p-1,p-1));return}if(r==="u"&&c){a.preventDefault();const h=c.getValue();let p=Nb(u);if((p<0||p>h.length)&&(p=h.length),p===0)return;let g=p;for(;g>0&&/\s/.test(h[g-1]??"");)g--;if(g===p)for(;g>0&&!/\s/.test(h[g-1]??"");)g--;g<p&&(c.setValue(h.slice(0,g)+h.slice(p)),c.setSelection(g,g));return}const d=r==="j"?"ArrowDown":r==="k"?"ArrowUp":null;d&&(a.preventDefault(),u.dispatchEvent(new KeyboardEvent("keydown",{key:d,bubbles:!0,cancelable:!0})))}}function im(e){return String(e>0?e:0).padStart(3,"0")}function LD({features:e,phases:a,query:r,onQuery:s}){const u=x.useRef(null),c=_D(u),d=x.useMemo(()=>[{name:"feature",label:"Feature",type:"number",description:"Feature number, e.g. 1 (F001)"},{name:"phase",label:"Phase",type:"number",description:"Phase number, e.g. 2 (P002)"},{name:"task",label:"Task",type:"number",description:"Task number, e.g. 10 (T010). Comma-list supported."},{name:"id",label:"Short ID",type:"string",description:"Global 5-char short id, e.g. UUXD1"},{name:"status",label:"Status",type:"string",description:"Task status"},{name:"feature-status",label:"Feature status",type:"string",description:"Status of the feature"},{name:"phase-status",label:"Phase status",type:"string",description:"Status of the phase"},{name:"title",label:"Title",type:"string",description:"Substring match on title"}],[]),h=x.useMemo(()=>{const y=[...new Set(e.map(R=>R.number))].sort((R,M)=>R-M),S=[...new Set(a.map(R=>R.number))].sort((R,M)=>R-M),N=[...new Set(a.flatMap(R=>R.tasks.map(M=>M.number)))].sort((R,M)=>R-M),w=[...new Set([...e.map(R=>R.shortId),...a.flatMap(R=>[R.shortId,...R.tasks.map(M=>M.shortId)])].filter(Boolean))],j=[...new Set(a.flatMap(R=>R.tasks.map(M=>M.title)))];return{featureNums:y,phaseNums:S,taskNums:N,shortIds:w,titles:j}},[e,a]),p=x.useCallback(async(y,S)=>{const N=S.toLowerCase();return y==="feature"?h.featureNums.filter(w=>String(w).startsWith(S)).slice(0,20).map(w=>({text:String(w),label:`F${im(w)}`})):y==="phase"?h.phaseNums.filter(w=>String(w).startsWith(S)).slice(0,20).map(w=>({text:String(w),label:`P${im(w)}`})):y==="task"?h.taskNums.filter(w=>String(w).startsWith(S)).slice(0,20).map(w=>({text:String(w),label:`T${im(w)}`})):y==="id"?h.shortIds.filter(w=>w.toLowerCase().startsWith(N)).slice(0,20).map(w=>({text:w,label:w})):y==="status"||y==="feature-status"||y==="phase-status"?MD.filter(w=>w.startsWith(N)).map(w=>({text:w,label:w})):y==="title"?h.titles.filter(w=>w.toLowerCase().includes(N)).slice(0,20).map(w=>({text:w,label:w.length>44?w.slice(0,44)+"…":w})):[]},[h]),g=x.useCallback(y=>s(y),[s]),v=x.useCallback(y=>{u.current=y},[]);return i.jsx("div",{className:"search-bar",children:i.jsx(OD,{fields:d,value:r,onChange:g,onSearch:g,fetchSuggestions:p,onKeyDown:c,inputRef:v,placeholder:"Search Work Tree… e.g. feature:1 id:UUXD1 title:auth status:in-progress"})})}function Eb(){const e=new URL(window.location.href);e.searchParams.has("locate")&&(e.searchParams.delete("locate"),window.history.replaceState(window.history.state,"",`${e.pathname}${e.search}${e.hash}`))}function zD(e,a){if(Object.keys(a).length===0)return e;const r=c=>{const d=a[c];return d?new Map(d.map((h,p)=>[h,p])):null},s=r("__features__");return(s?[...e].sort((c,d)=>(s.get(c.feature.id)??1/0)-(s.get(d.feature.id)??1/0)):e).map(c=>{const d=r(`phase-scope:${c.feature.id}`),h=d?[...c.allPhases].sort((p,g)=>(d.get(p.phase.id)??1/0)-(d.get(g.phase.id)??1/0)):c.allPhases;return{...c,allPhases:h.map(p=>{const g=r(`task-scope:${p.phase.id}`),v=g?[...p.allTasks].sort((y,S)=>(g.get(y.id)??1/0)-(g.get(S.id)??1/0)):p.allTasks;return{...p,allTasks:v}})}})}function fi({active:e=!1,disabled:a=!1,onClick:r,children:s}){return i.jsx("button",{type:"button",disabled:a,onClick:r,className:`inline-flex h-7 min-h-7 shrink-0 items-center justify-center whitespace-nowrap rounded-[9px] border px-2 py-1 text-xs font-semibold transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--accent)] sm:h-8 sm:min-h-8 sm:rounded-[10px] sm:px-2.5 ${e?"border-transparent bg-[var(--accent)] text-white":"border-[var(--border)] bg-[var(--surface-card)] text-[var(--text-muted)] hover:bg-[var(--accent-soft)] hover:text-[var(--text)]"} ${a?"cursor-not-allowed opacity-60":""}`,children:s})}function $D({features:e,phases:a,activeTasks:r,projectStorageScope:s,resumeRequiredIds:u=new Set,analyticsFilter:c=null,onClearAnalyticsFilter:d}){const h=SA({features:e,phases:a,projectStorageScope:s}),p=x.useMemo(()=>c?h.displayedWorkTree.map(P=>({...P,allPhases:P.allPhases.map(se=>({...se,allTasks:se.allTasks.filter(A=>c.taskIds.has(A.id))})).filter(se=>se.allTasks.length>0)})).filter(P=>P.allPhases.length>0):h.displayedWorkTree,[c,h.displayedWorkTree]),g=x.useMemo(()=>new Set(p.map(P=>P.feature.id)),[p]),v=x.useMemo(()=>new Set(p.flatMap(P=>P.allPhases.map(se=>se.phase.id))),[p]),y=x.useMemo(()=>p.reduce((P,se)=>P+se.allPhases.reduce((A,I)=>A+I.allTasks.length,0),0),[p]),[S,N]=x.useState({});x.useEffect(()=>{N({})},[p]);const w=x.useMemo(()=>zD(p,S),[p,S]),[j,R]=x.useState(!1),[M,$]=x.useState(null),[B,Y]=x.useState(null),ne=P=>Y(String(P.active.id)),[ae,U]=x.useState(0);x.useEffect(()=>{const P=document.querySelector("header");if(!P)return;const se=()=>U(P.offsetHeight);se();const A=new ResizeObserver(se);return A.observe(P),window.addEventListener("resize",se),()=>{A.disconnect(),window.removeEventListener("resize",se)}},[]),x.useEffect(()=>{const P=window.setTimeout(()=>{const se=document.querySelector(".ap-search-sticky"),A=document.querySelector("header");if(!se||!A)return;const I=se.getBoundingClientRect();if(I.top<0){const K=I.top+window.scrollY-A.offsetHeight;window.scrollTo({top:Math.max(0,K),behavior:"smooth"})}},60);return()=>window.clearTimeout(P)},[h.searchQuery,h.hideDone,h.hidePlanned,h.onlyActiveBranches]);const k=zk(Lk(cp,{activationConstraint:{distance:5}})),re=async P=>{const{active:se,over:A}=P;if(Y(null),!A||se.id===A.id)return;const I=String(se.id),K=String(A.id),ue=w.map(ge=>ge.feature.id);if(ue.includes(I)&&ue.includes(K)){const ge=Io(ue,ue.indexOf(I),ue.indexOf(K)),xe=ge.indexOf(I),ke=xe>0?ge[xe-1]??null:null,Ie=xe<ge.length-1?ge[xe+1]??null:null;N(Ue=>({...Ue,__features__:ge})),await Fh("feature",I,ke,Ie).catch(()=>{});return}for(const ge of w){const xe=ge.allPhases.map(ke=>ke.phase.id);if(xe.includes(I)&&xe.includes(K)){const ke=Io(xe,xe.indexOf(I),xe.indexOf(K)),Ie=ke.indexOf(I),Ue=Ie>0?ke[Ie-1]??null:null,Ze=Ie<ke.length-1?ke[Ie+1]??null:null;N(dn=>({...dn,[`phase-scope:${ge.feature.id}`]:ke})),await Fh("phase",I,Ue,Ze).catch(()=>{});return}}for(const ge of w)for(const xe of ge.allPhases){const ke=xe.allTasks.map(Ie=>Ie.id);if(ke.includes(I)&&ke.includes(K)){const Ie=Io(ke,ke.indexOf(I),ke.indexOf(K)),Ue=Ie.indexOf(I),Ze=Ue>0?Ie[Ue-1]??null:null,dn=Ue<Ie.length-1?Ie[Ue+1]??null:null;N(It=>({...It,[`task-scope:${xe.phase.id}`]:Ie})),await Fh("task",I,Ze,dn).catch(()=>{});return}}},pe=P=>c?v.has(P):h.expandedPhaseIds.includes(P),Se=P=>h.recentPhaseIds.includes(P),ye=P=>h.recentTaskIds.includes(P),[he]=tc(),[je,W]=x.useState(null),L=he.get("locate"),F=L?parseInt(L.replace(/^T/i,""),10):null;x.useEffect(()=>{if(F==null||Number.isNaN(F))return;const P=a.flatMap(K=>K.tasks.map(ue=>({t:ue,p:K}))).find(({t:K})=>K.number===F);if(!P){if(a.length===0)return;Eb();return}const{t:se,p:A}=P;if(h.onlyActiveBranches&&h.setOnlyActiveBranches(!1),h.hideDone&&h.setHideDone(!1),h.searchQuery&&h.setSearchQuery(""),h.setTreeOpenMode("smart"),A.featureId){const K=A.featureId;h.expandedFeatureIds.includes(K)||h.setExpandedFeatureIds(ue=>ue.includes(K)?ue:[...ue,K])}h.expandedPhaseIds.includes(A.id)||h.setExpandedPhaseIds(K=>K.includes(A.id)?K:[...K,A.id]);const I=document.getElementById(`task-row-${F}`);if(I){const K=document.querySelector("header"),ue=document.querySelector(".ap-search-sticky"),ge=((K==null?void 0:K.offsetHeight)??0)+((ue==null?void 0:ue.offsetHeight)??0)+12,xe=I.getBoundingClientRect().top+window.scrollY-ge;window.scrollTo({top:Math.max(0,xe),behavior:"smooth"}),W(se.id);const ke=window.setTimeout(()=>W(null),2500);return Eb(),()=>window.clearTimeout(ke)}},[F,a,h.expandedFeatureIds,h.expandedPhaseIds,h.onlyActiveBranches,h.hideDone,h.searchQuery,h.treeOpenMode]);const fe=()=>{if(!B)return null;for(const P of w){if(P.feature.id===B)return i.jsxs("div",{className:"ap-drag-overlay surface-card min-w-0 max-w-md px-3 py-2",children:[i.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[i.jsx(ar,{featureNum:P.feature.number}),i.jsx(hr,{status:P.feature.status})]}),i.jsx("div",{className:"mt-1 break-words font-mono text-sm font-semibold [overflow-wrap:anywhere]",children:P.feature.name})]});for(const se of P.allPhases){if(se.phase.id===B)return i.jsxs("div",{className:"ap-drag-overlay surface-card min-w-0 max-w-md px-3 py-2",children:[i.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[i.jsx(ar,{featureNum:P.feature.number,phaseNum:se.phase.number}),i.jsx(hr,{status:se.phase.status})]}),i.jsx("div",{className:"mt-1 break-words font-mono text-sm font-semibold [overflow-wrap:anywhere]",children:se.phase.title})]});for(const A of se.allTasks)if(A.id===B)return i.jsxs("div",{className:"ap-drag-overlay surface-card min-w-0 max-w-md px-3 py-2",children:[i.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[i.jsx(ar,{featureNum:P.feature.number,phaseNum:se.phase.number,taskNum:A.number}),i.jsx(hr,{status:A.status})]}),i.jsx("div",{className:"mt-1 break-words font-mono text-sm font-semibold [overflow-wrap:anywhere]",children:A.title})]})}}return null};return i.jsxs(Gt,{className:"grid gap-4",children:[i.jsx("div",{className:"flex flex-col gap-3 md:flex-row md:items-start md:justify-between",children:i.jsxs("div",{children:[i.jsx("h2",{className:"text-lg font-bold text-[var(--text)]",children:"Work Tree"}),i.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:"Collapsible feature → phase → task tree. Click a feature or phase row to collapse/expand."})]})}),c?i.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2 rounded-xl border border-[var(--accent)] bg-[var(--accent-soft)] px-3 py-2","data-analytics-work-tree-filter":!0,role:"status",children:[i.jsxs("p",{className:"text-sm text-[var(--text)]",children:[i.jsx("span",{className:"font-bold",children:"Analytics filter:"})," ",c.label,". Showing ",y," of ",c.taskIds.size," selected ",c.taskIds.size===1?"task":"tasks"," after current Work Tree filters."]}),d?i.jsx("button",{type:"button",onClick:d,className:"rounded-lg px-2 py-1 text-xs font-bold text-[var(--accent)] underline decoration-dotted underline-offset-2 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--accent)]",children:"Clear analytics filter"}):null]}):null,i.jsxs("div",{className:"ap-search-sticky z-20 grid gap-2",style:{top:ae},children:[i.jsx(LD,{features:e,phases:a,query:h.searchQuery,onQuery:h.setSearchQuery}),i.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[i.jsx(hp,{sort:h.sort,onChange:h.setSort}),i.jsxs("div",{className:"flex-1 min-w-0 flex items-center gap-1.5 overflow-x-auto rounded-[12px] border border-[var(--border)] bg-[var(--surface-card)] px-2 py-1.5 [scrollbar-width:thin] [&::-webkit-scrollbar]:h-1.5 sm:gap-2 sm:rounded-[14px] sm:px-3 sm:py-2",children:[i.jsx(fi,{active:h.isAllExpanded,onClick:()=>h.isAllExpanded?h.collapseAll():h.expandAll(),children:h.isAllExpanded?"Collapse all":"Expand all"}),i.jsx(fi,{active:h.hideDone,onClick:()=>h.setHideDone(P=>!P),children:"Hide done"}),i.jsx(fi,{active:h.hidePlanned,onClick:()=>h.setHidePlanned(P=>!P),children:"Hide planned"}),i.jsx(fi,{active:h.onlyActiveBranches,onClick:()=>h.setOnlyActiveBranches(P=>!P),children:"Only active"}),i.jsx(fi,{onClick:h.resetFilters,children:"Reset"}),i.jsx(fi,{disabled:j,onClick:async()=>{R(!0),$(null);try{const P=await JR(),se=P.migrated,A=P.integrity.duplicatePhaseIds.length,I=P.integrity.danglingPhaseIds.length;$(`Repair done: renamed ${se.renamed}, repaired ${se.repaired} refs, inferred ${se.inferred}, archived ${P.handoffs.archived} stale handoff(s). Integrity: ${A} duplicate, ${I} dangling.`)}catch(P){$(`Repair failed: ${P instanceof Error?P.message:String(P)}`)}finally{R(!1)}},children:j?"Repairing…":"Repair"})]})]}),h.searchActive?i.jsxs("p",{className:"text-xs text-[var(--text-muted)]",children:[h.matchedTaskIds.size," match",h.matchedTaskIds.size===1?"":"es"," — clear the box to reset."]}):null,M?i.jsx("span",{className:"text-xs text-[var(--text-muted)] sm:truncate",children:M}):null]}),i.jsx("div",{className:"grid gap-3",children:w.length>0?i.jsxs(zT,{sensors:k,collisionDetection:qk,onDragStart:ne,onDragEnd:re,children:[i.jsx(fp,{items:w.map(P=>P.feature.id),strategy:dp,children:w.map(P=>i.jsx(pp,{id:P.feature.id,children:i.jsx(EA,{entry:P,expanded:c?g.has(P.feature.id):h.expandedFeatureIds.includes(P.feature.id),recentlyChanged:h.recentFeatureIds.includes(P.feature.id),onToggle:()=>h.toggleExpandedFeature(P.feature.id),isPhaseExpanded:pe,onTogglePhase:h.toggleExpandedPhase,isPhaseRecentlyChanged:Se,isTaskRecentlyChanged:ye,highlightedTaskIds:(()=>{const se=h.searchActive?h.matchedTaskIds:void 0;if(!je)return se;const A=new Set(se??[]);return A.add(je),A})(),resumeRequiredIds:u})},P.feature.id))}),i.jsx(tA,{dropAnimation:{duration:150,easing:"ease"},children:fe()})]}):c?i.jsx("p",{className:"py-4 text-center text-sm text-[var(--text-muted)]",children:"No selected analytics tasks match the current Work Tree filters."}):r.length>0?r.map(P=>{const se=P.featureId?`/features/${P.featureId}/phases/${P.phaseId}/tasks/${P.id}`:"/features";return i.jsxs(Ve,{to:se,className:"surface-card grid gap-1 px-4 py-3 transition hover:border-[var(--accent)] hover:bg-[var(--accent-soft)]",children:[i.jsxs("div",{className:"flex items-center justify-between gap-2",children:[i.jsxs("span",{className:"inline-flex min-w-0 items-center gap-2 truncate text-sm font-semibold text-[var(--text)]",children:[P.status==="in-progress"?i.jsx("span",{"aria-hidden":"true",className:"ap-progress-dot"}):null,i.jsxs("span",{className:"truncate",children:["T",Z2(P.number)," — ",P.title]})]}),i.jsx(hr,{status:P.status})]}),i.jsx("div",{className:"text-[10px] uppercase tracking-wider text-[var(--text-muted)]",children:P.phaseId})]},P.id)}):i.jsx("p",{className:"py-4 text-center text-sm text-[var(--text-muted)]",children:"No work items match the current filters."})})]})}function UD({tasks:e}){return e.length?i.jsxs("section",{"aria-labelledby":"resume-required-heading",className:"grid grid-cols-1 gap-3",children:[i.jsxs("h2",{id:"resume-required-heading",className:"text-[10px] font-semibold uppercase tracking-[0.22em] text-[var(--accent)]",children:["Resume required (",e.length,")"]}),i.jsx("div",{className:"grid gap-2",children:e.map(a=>i.jsx(bm,{task:a},a.id))})]}):null}function BD(){const{features:e,phases:a,activeTasks:r}=xr(),{project:s,taskFocus:u}=Ts("root"),c=x.useMemo(()=>new Set((u.pendingResume??[]).map(S=>S.id)),[u.pendingResume]),[d,h]=x.useState(null),p=x.useMemo(()=>new Set((d==null?void 0:d.taskIds)??[]),[d]),g=_r(),v=()=>g("/project/edit");_n("edit",v);const y=s.projectRoot||s.planRoot||s.name||"default";return i.jsxs("div",{className:"grid grid-cols-1 gap-8",children:[i.jsxs(Gt,{className:"grid grid-cols-1 gap-4",children:[i.jsxs("div",{className:"flex items-center justify-between gap-4",children:[i.jsx("h2",{className:"min-w-0 text-lg font-bold text-[var(--text)]",children:"Project Goal"}),i.jsxs(Ke,{type:"button",shortcut:"edit",onClick:v,className:"shrink-0",children:[i.jsx(Vl,{className:"h-4 w-4"}),"Edit project"]})]}),s.goal?i.jsx(Nn,{text:s.goal,className:"max-w-4xl"}):i.jsx("p",{className:"max-w-4xl text-sm text-[var(--text-muted)]",children:"Add a project goal to define the main objective."})]}),i.jsx($2,{project:s}),i.jsx(ek,{features:e,phases:a}),i.jsx(bk,{phases:a,activeDrilldown:d,onDrilldown:h,onClearDrilldown:()=>h(null)}),i.jsx(UD,{tasks:u.pendingResume}),i.jsx($D,{features:e,phases:a,activeTasks:r,projectStorageScope:y,resumeRequiredIds:c,analyticsFilter:d?{label:d.label,taskIds:p}:null,onClearAnalyticsFilter:()=>h(null)}),i.jsx(I2,{features:e,phases:a}),i.jsx(q2,{features:e,phases:a})]})}async function ID(){const[e,a]=await Promise.all([Qm(),xd()]);return{features:e,phases:a}}function Qo(){return{active:0,planned:0,done:0,blocked:0,canceled:0}}function ld(e){const a=[];return e.active&&a.push(`${e.active} active`),e.planned&&a.push(`${e.planned} planned`),e.done&&a.push(`${e.done} done`),e.blocked&&a.push(`${e.blocked} blocked`),e.canceled&&a.push(`${e.canceled} canceled`),a.join(" · ")}function HD(e){const a=Qo();for(const r of e){if(r.status==="in-progress"||r.status==="discovery"){a.active+=1;continue}if(r.status==="planned"||r.status==="draft"){a.planned+=1;continue}if(r.status==="done"){a.done+=1;continue}if(r.status==="blocked"){a.blocked+=1;continue}r.status==="canceled"&&(a.canceled+=1)}return a}function Ow(e){const a=Qo();for(const r of e){if(r.status==="in-progress"){a.active+=1;continue}if(r.status==="planned"){a.planned+=1;continue}if(r.status==="done"){a.done+=1;continue}if(r.status==="blocked"){a.blocked+=1;continue}r.status==="canceled"&&(a.canceled+=1)}return a}function qD(e){const a=Qo();for(const r of e){if(r.status==="in-progress"){a.active+=1;continue}if(r.status==="planned"){a.planned+=1;continue}if(r.status==="done"){a.done+=1;continue}if(r.status==="blocked"){a.blocked+=1;continue}r.status==="canceled"&&(a.canceled+=1)}return a}function PD({feature:e,phases:a,phasesCount:r,tasksCount:s,phaseSummary:u,taskSummary:c,activity:d}){var M;const h=Fl(),p=Fl(),v=((M=h.formData)==null?void 0:M.get("status"))??e.status,y=h.state!=="idle",S=p.state!=="idle",N=ld(u),w=ld(c),j=F0(a??[]),R=e.description||(d?`${d.doneTasks}/${s} done · ${d.remainingTasks} left${d.blockedTasks?` · ${d.blockedTasks} blocked`:""}`:"");return i.jsxs(Ai,{variant:"surface",status:j.displayStatus,className:"px-4 py-2",children:[i.jsxs("div",{className:"grid gap-2 xl:grid-cols-[minmax(0,1fr)_minmax(0,132px)_minmax(0,152px)_124px_44px_44px] xl:items-center",children:[i.jsxs("div",{className:"flex min-w-0 flex-col items-start gap-1 xl:contents",children:[i.jsxs("div",{className:"flex min-w-0 flex-col items-start gap-1",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(ar,{featureNum:e.number,featureId:e.id}),i.jsx(lr,{id:ul({featureNum:e.number}),children:i.jsx("span",{className:"sr-only",children:"Copy feature path"})}),e.shortId?i.jsx(dl,{shortId:e.shortId}):null,i.jsx(Sd,{priority:e.priority}),i.jsx("span",{className:"shrink-0",children:i.jsx(rc,{status:j.displayStatus,breakdown:j.breakdown})})]}),i.jsx(Ve,{to:`/features/${e.id}`,className:"entity-link--feature min-w-0 w-full break-words text-sm font-semibold underline-offset-4 hover:underline [overflow-wrap:anywhere]",children:e.name})]}),i.jsxs("div",{className:"flex items-center gap-2 self-end xl:hidden",children:[i.jsx(Ve,{to:`/features/${e.id}/edit`,"aria-label":`Edit feature ${e.name}`,children:i.jsx(Ke,{type:"button",variant:"secondary",className:"min-h-8 w-8 rounded-[10px] px-0 text-[var(--text-muted)] hover:text-[var(--text)]",children:i.jsx(Vl,{className:"h-3.5 w-3.5"})})}),i.jsx(p.Form,{method:"post",action:`/features/${e.id}/delete`,onSubmit:$=>{window.confirm(`Delete feature “${e.name}”? This cannot be undone.`)||$.preventDefault()},children:i.jsx(Ke,{type:"submit",variant:"danger",disabled:S||y,className:"min-h-8 w-8 rounded-[10px] px-0","aria-label":`Delete feature ${e.name}`,children:i.jsx(js,{className:"h-4 w-4"})})})]})]}),i.jsxs("div",{className:"text-[11px] text-[var(--text-muted)]",children:[i.jsxs("div",{className:"font-semibold text-[var(--text)]",children:[r," phases"]}),N?i.jsx("div",{className:"mt-0.5 break-words",children:N}):null]}),i.jsxs("div",{className:"text-[11px] text-[var(--text-muted)]",children:[i.jsxs("div",{className:"font-semibold text-[var(--text)]",children:[s," tasks"]}),w?i.jsx("div",{className:"mt-0.5 break-words",children:w}):null]}),i.jsx(h.Form,{method:"post",action:`/features/${e.id}/status`,className:"w-full xl:w-auto",children:i.jsxs("div",{className:"relative",children:[i.jsx("select",{name:"status",value:v,disabled:!0,"aria-disabled":"true",title:"Feature status is derived from child phases and tasks.",className:"field-control min-h-8 appearance-none py-1 pr-8 text-[11px]",children:Td.map($=>i.jsx("option",{value:$.value,children:$.label},$.value))}),i.jsx(As,{className:"pointer-events-none absolute right-2.5 top-1/2 h-3 w-3 -translate-y-1/2 text-[var(--text-muted)]"})]})}),i.jsx(Ve,{to:`/features/${e.id}/edit`,"aria-label":`Edit feature ${e.name}`,className:"hidden xl:block",children:i.jsx(Ke,{type:"button",variant:"secondary",className:"min-h-8 w-8 rounded-[10px] px-0 text-[var(--text-muted)] hover:text-[var(--text)]",children:i.jsx(Vl,{className:"h-3.5 w-3.5"})})}),i.jsx(p.Form,{method:"post",action:`/features/${e.id}/delete`,className:"hidden xl:block",onSubmit:$=>{window.confirm(`Delete feature “${e.name}”? This cannot be undone.`)||$.preventDefault()},children:i.jsx(Ke,{type:"submit",variant:"danger",disabled:S||y,className:"min-h-8 w-8 rounded-[10px] px-0","aria-label":`Delete feature ${e.name}`,children:i.jsx(js,{className:"h-4 w-4"})})})]}),i.jsx("div",{className:"mt-1 flex flex-wrap items-center gap-x-3 gap-y-1",children:i.jsx(fl,{value:e.updatedAt})}),R?i.jsx("div",{className:"mt-1 min-w-0 break-words line-clamp-2 text-[11px] text-[var(--text-muted)]",children:R}):null]})}const FD={feature:{label:"Feature",Icon:Gu},phase:{label:"Phase",Icon:Yj},task:{label:"Task",Icon:nc},requirement:{label:"Requirement",Icon:E0}};function Mw({kind:e,label:a}){const{Icon:r,label:s}=FD[e];return i.jsxs("span",{className:`entity-badge entity-badge--${e}`,children:[i.jsx(r,{className:"h-3.5 w-3.5"}),i.jsx("span",{children:a??s})]})}function Mn({className:e="",...a}){return i.jsx("input",{className:`field-control ${e}`,...a})}function Gl({className:e="",...a}){return i.jsx("select",{className:`field-control ${e}`,...a})}function _w({query:e,status:a,statusOptions:r,placeholder:s,clearTo:u,resultsLabel:c}){const d=Pm(),h=((r==null?void 0:r.length)??0)>0;return i.jsxs(un,{method:"get",className:`surface-card grid gap-3 p-3 md:items-end sm:p-4 ${h?"md:grid-cols-[minmax(0,1fr)_200px_auto_auto]":"md:grid-cols-[minmax(0,1fr)_auto_auto]"}`,children:[i.jsxs("div",{children:[i.jsx("label",{htmlFor:"list-filter-query",className:"mb-1 block text-xs font-semibold uppercase tracking-[0.18em] text-[var(--text-subtle)]",children:"Name"}),i.jsx(Mn,{id:"list-filter-query",name:"q",defaultValue:e,placeholder:s,className:"min-h-9 py-2 sm:min-h-11 sm:py-2.5",onChange:p=>d(p.currentTarget.form)})]}),h?i.jsxs("div",{children:[i.jsx("label",{htmlFor:"list-filter-status",className:"mb-1 block text-xs font-semibold uppercase tracking-[0.18em] text-[var(--text-subtle)]",children:"Status"}),i.jsxs("div",{className:"relative",children:[i.jsxs(Gl,{id:"list-filter-status",name:"status",defaultValue:a,className:"min-h-9 appearance-none py-2 sm:min-h-11 sm:py-2.5 pr-8",children:[i.jsx("option",{value:"",children:"All statuses"}),r==null?void 0:r.map(p=>i.jsx("option",{value:p.value,children:p.label},p.value))]}),i.jsx(As,{className:"pointer-events-none absolute right-3 top-1/2 h-4 w-4 -translate-y-1/2 text-[var(--text-muted)]"})]})]}):null,i.jsx(Ke,{type:"submit",variant:"secondary",children:"Apply filters"}),i.jsx(Ve,{to:u,className:"inline-flex min-h-9 items-center justify-center rounded-[12px] px-3 text-sm font-semibold text-[var(--text-muted)] transition hover:bg-[var(--accent-soft)] hover:text-[var(--text)] sm:min-h-11 sm:rounded-[14px]",children:"Clear"}),i.jsx("div",{className:`text-sm text-[var(--text-muted)] ${h?"md:col-span-4":"md:col-span-3"}`,children:c})]})}function Lw(e,a,r){return a.status&&e.status!==a.status?!1:a.onlyActive?r.includes(e.status):!(a.hideDone&&e.status==="done"||a.hidePlanned&&e.status==="planned")}function Dd(e,a){const r=e.trim().toLowerCase();return r?a.some(s=>s==null?void 0:s.toLowerCase().includes(r)):!0}function VD(e){const a=new Map;for(const d of e)d.featureId&&a.set(d.featureId,[...a.get(d.featureId)??[],d]);const r=new Map,s=new Map,u=new Map,c=new Map;for(const[d,h]of a)r.set(d,h.length),s.set(d,h.reduce((p,g)=>p+g.tasks.length,0)),u.set(d,HD(h)),c.set(d,Ow(h.flatMap(p=>p.tasks)));return{phasesByFeature:a,phasesCountByFeature:r,tasksCountByFeature:s,phaseSummaryByFeature:u,taskSummaryByFeature:c}}function YD(){var N,w;const{features:e,phases:a}=xr(),{phasesByFeature:r,phasesCountByFeature:s,tasksCountByFeature:u,phaseSummaryByFeature:c,taskSummaryByFeature:d}=VD(a),h=_r(),[p]=tc(),g=((N=p.get("q"))==null?void 0:N.trim())??"",v=((w=p.get("status"))==null?void 0:w.trim())??"",y=x.useCallback(()=>h("new"),[h]);_n("create",y);const S=x.useMemo(()=>e.filter(j=>(!v||j.status===v)&&Dd(g,[j.name,j.id,j.description])),[e,g,v]);return i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"grid gap-8",children:[i.jsxs(Gt,{className:"flex flex-col gap-4 md:flex-row md:items-center md:justify-between",children:[i.jsxs("div",{children:[i.jsx(Mw,{kind:"feature",label:"Features"}),i.jsx("p",{className:"mt-2 text-sm text-[var(--text-muted)]",children:"Filter by name or status, then inspect child phases and tasks directly from the rows."})]}),i.jsx(Ve,{to:"new",children:i.jsx(Ke,{type:"button",variant:"primary",shortcut:"create",children:"Create feature"})})]}),i.jsx(_w,{query:g,status:v,statusOptions:Td,placeholder:"Search feature name, id, or description",clearTo:"/features",resultsLabel:S.length===e.length?`${e.length} features`:`${S.length} of ${e.length} features`}),i.jsx("div",{className:"grid gap-3",children:e.length===0?i.jsxs(Gt,{className:"p-4 text-sm text-[var(--text-muted)]",children:["No features yet. ",i.jsx(Ve,{to:"/features/new",className:"font-semibold text-[var(--accent)] hover:underline",children:"Create your first feature"})]}):S.length>0?S.map(j=>i.jsx(PD,{feature:j,phases:r.get(j.id),phasesCount:s.get(j.id)??0,tasksCount:u.get(j.id)??0,phaseSummary:c.get(j.id)??Qo(),taskSummary:d.get(j.id)??Qo()},j.id)):i.jsx(Gt,{className:"p-4 text-sm text-[var(--text-muted)]",children:"No features match the current filters."})})]}),i.jsx(ji,{})]})}async function GD(){const[e,a]=await Promise.all([Km(),xd()]);return{requirements:e,phases:a}}function Ao(...e){return e.filter(Boolean).join(" ")}function XD(){return i.jsx("span",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-full border border-[var(--border-strong)] bg-[var(--surface-elevated)] text-[var(--text)] shadow-sm transition group-open:rotate-180 group-hover:border-[var(--accent)] group-hover:text-[var(--accent)]",children:i.jsx(As,{className:"h-5 w-5"})})}function qn({title:e,subtitle:a,leading:r,actions:s,defaultOpen:u=!1,count:c,className:d,summaryClassName:h,contentClassName:p,titleClassName:g,subtitleClassName:v,children:y}){return i.jsxs("details",{className:Ao("group mt-4 overflow-hidden rounded-[10px] border border-[var(--border)]",d),open:u,children:[i.jsxs("summary",{className:Ao("flex min-w-0 list-none cursor-pointer items-start justify-between gap-3 bg-[var(--surface-elevated)] p-4 text-left text-[var(--text)] transition-colors select-none hover:bg-[var(--surface-strong)] [&::-webkit-details-marker]:hidden",h),children:[i.jsxs("div",{className:"flex min-w-0 flex-1 items-start gap-3",children:[r?i.jsx("div",{className:"shrink-0 pt-0.5",children:r}):null,i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsxs("div",{className:Ao("flex flex-wrap items-center gap-2 text-sm font-semibold",g),children:[e,c!==void 0?i.jsxs("span",{className:"text-[var(--text-subtle)]",children:["(",c,")"]}):null]}),a?i.jsx("div",{className:Ao("mt-2 text-sm text-[var(--text-muted)] [overflow-wrap:anywhere]",v),children:a}):null]})]}),i.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[s,i.jsx(XD,{})]})]}),i.jsx("div",{className:Ao("border-t border-[var(--border)] bg-[var(--surface)] p-4",p),children:y})]})}function QD(e,a){const r=new Set(a.map(c=>c.id)),s=a.map(c=>({phase:c,requirements:e.filter(d=>d.linkedPhaseIds.includes(c.id))})).filter(c=>c.requirements.length>0).sort((c,d)=>c.phase.priority-d.phase.priority||c.phase.number-d.phase.number),u=e.filter(c=>!c.linkedPhaseIds.some(d=>r.has(d)));return{phaseGroups:s,unlinkedRequirements:u}}function jb(e){return`P${String(e.number??0).padStart(3,"0")}`}function Rb({requirement:e}){return i.jsx(Gt,{className:"overflow-hidden p-0",children:i.jsx(qn,{defaultOpen:!1,title:i.jsx("h2",{className:"min-w-0 text-lg font-black tracking-tight text-[var(--text)] [overflow-wrap:anywhere]",children:e.title}),count:e.linkedPhaseIds.length,subtitle:i.jsxs(i.Fragment,{children:[i.jsxs("span",{className:"text-xs font-semibold uppercase tracking-[0.16em] text-[var(--text-subtle)]",children:[e.linkedPhaseIds.length," linked phase",e.linkedPhaseIds.length===1?"":"s"]}),e.linkedPhaseIds.length>0&&e.macroTasks.length>0?i.jsx("span",{className:"mx-2 text-[var(--text-subtle)]",children:"•"}):null,e.macroTasks.length>0?i.jsxs("span",{className:"text-xs font-semibold uppercase tracking-[0.16em] text-[var(--text-subtle)]",children:[e.macroTasks.length," macro task",e.macroTasks.length===1?"":"s"]}):null]}),contentClassName:"grid gap-4",summaryClassName:"hover:bg-[var(--surface-elevated)]/65",children:i.jsxs("div",{className:"flex min-w-0 flex-col gap-3 md:flex-row md:items-start md:justify-between",children:[i.jsx("div",{className:"min-w-0",children:e.description?i.jsx("p",{className:"min-w-0 text-sm text-[var(--text-muted)] [overflow-wrap:anywhere]",children:e.description}):null}),i.jsxs("div",{className:"flex flex-wrap items-center gap-2 md:justify-end",children:[i.jsx(Ve,{to:`${e.id}/edit`,children:i.jsx(Ke,{type:"button",variant:"secondary",children:"Edit"})}),i.jsx(un,{method:"post",action:`/requirements/${e.id}/delete`,onSubmit:a=>{window.confirm(`Delete requirement "${e.title}"?`)||a.preventDefault()},children:i.jsx(Ke,{type:"submit",variant:"danger",children:"Delete"})})]})]})})})}function KD(){var v;const{requirements:e,phases:a}=xr(),r=_r(),[s]=tc(),u=((v=s.get("q"))==null?void 0:v.trim())??"",c=x.useCallback(()=>r("new"),[r]);_n("create",c);const d=x.useMemo(()=>new Map(a.map(y=>[y.id,y])),[a]),h=x.useMemo(()=>e.filter(y=>{const S=y.linkedPhaseIds.map(N=>{const w=d.get(N);return w?`${jb(w)} ${w.title} ${w.summary}`:N});return Dd(u,[y.title,y.description,y.id,...S])}),[e,d,u]),{phaseGroups:p,unlinkedRequirements:g}=x.useMemo(()=>QD(h,a),[h,a]);return x.useEffect(()=>{const y=window.location.hash.slice(1);y&&requestAnimationFrame(()=>{var S;return(S=document.getElementById(y))==null?void 0:S.scrollIntoView({block:"start"})})},[p]),i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"grid gap-8",children:[i.jsxs(Gt,{className:"flex flex-col gap-4 md:flex-row md:items-center md:justify-between",children:[i.jsxs("div",{children:[i.jsx(Mw,{kind:"requirement",label:"Requirements"}),i.jsx("p",{className:"mt-2 text-sm text-[var(--text-muted)]",children:"Track top-level outcomes independently from features, grouped below by the phases that deliver them."})]}),i.jsx(Ve,{to:"new",children:i.jsx(Ke,{type:"button",variant:"primary",shortcut:"create",children:"Create requirement"})})]}),i.jsx(_w,{query:u,placeholder:"Search requirement title, description, id, or linked phase",clearTo:"/requirements",resultsLabel:h.length===e.length?`${e.length} requirements`:`${h.length} of ${e.length} requirements`}),i.jsx("div",{className:"grid gap-6",children:e.length===0?i.jsxs(Gt,{className:"p-4 text-sm text-[var(--text-muted)]",children:["No requirements yet. ",i.jsx(Ve,{to:"/requirements/new",className:"font-semibold text-[var(--accent)] hover:underline",children:"Create your first requirement"})]}):h.length>0?i.jsxs(i.Fragment,{children:[p.map(({phase:y,requirements:S})=>{const N=y.featureId?`/features/${y.featureId}/phases/${y.id}`:"/features";return i.jsxs("section",{id:`phase-${y.id}`,className:"scroll-mt-28","aria-labelledby":`phase-${y.id}-heading`,children:[i.jsxs("div",{className:"mb-3 flex min-w-0 flex-wrap items-center justify-between gap-2",children:[i.jsxs("div",{className:"min-w-0",children:[i.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.16em] text-[var(--text-subtle)]",children:"Linked phase"}),i.jsxs(Ve,{id:`phase-${y.id}-heading`,to:N,className:"min-w-0 break-words text-base font-black text-[var(--text)] underline-offset-4 hover:text-[var(--accent)] hover:underline [overflow-wrap:anywhere]",children:[jb(y)," — ",y.title]})]}),i.jsxs("span",{className:"shrink-0 rounded-full bg-[var(--surface-elevated)] px-2.5 py-1 text-xs font-semibold text-[var(--text-muted)]",children:[S.length," requirement",S.length===1?"":"s"]})]}),i.jsx("div",{className:"grid gap-3",children:S.map(w=>i.jsx(Rb,{requirement:w},w.id))})]},y.id)}),g.length>0?i.jsxs("section",{id:"unlinked-requirements",className:"scroll-mt-28","aria-labelledby":"unlinked-requirements-heading",children:[i.jsxs("div",{className:"mb-3 flex min-w-0 flex-wrap items-center justify-between gap-2",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.16em] text-[var(--text-subtle)]",children:"Unlinked"}),i.jsx("h2",{id:"unlinked-requirements-heading",className:"text-base font-black text-[var(--text)]",children:"Requirements without a valid phase"})]}),i.jsx("span",{className:"shrink-0 rounded-full bg-[var(--surface-elevated)] px-2.5 py-1 text-xs font-semibold text-[var(--text-muted)]",children:g.length})]}),i.jsx("div",{className:"grid gap-3",children:g.map(y=>i.jsx(Rb,{requirement:y},y.id))})]}):null]}):i.jsx(Gt,{className:"p-4 text-sm text-[var(--text-muted)]",children:"No requirements match the current filters."})})]}),i.jsx(ji,{})]})}async function ZD(){return{ideas:await _R()}}async function WD({request:e}){const a=await e.formData(),r=String(a.get("intent")??""),s=String(a.get("id")??""),u=String(a.get("title")??"").trim(),c=String(a.get("description")??"").trim();if(r==="create"){if(!u)throw new Response("Idea title is required.",{status:400});await LR({title:u,description:c})}else if(r==="update"){if(!s||!u)throw new Response("Idea id and title are required.",{status:400});await zR({id:s,title:u,description:c})}else if(r==="delete"){if(!s)throw new Response("Idea id is required.",{status:400});await $R(s)}else throw new Response("Unknown Ideas action.",{status:400});return{ok:!0}}function JD({idea:e,onClose:a}){return i.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4",role:"presentation",onMouseDown:r=>{r.target===r.currentTarget&&a()},children:i.jsxs("div",{role:"dialog","aria-modal":"true","aria-labelledby":"idea-editor-title",className:"surface-card w-full max-w-xl rounded-2xl border border-[var(--border)] p-5 shadow-2xl",children:[i.jsx("h2",{id:"idea-editor-title",className:"text-lg font-bold",children:e?"Edit idea":"Add idea"}),i.jsxs(un,{method:"post",className:"mt-4 space-y-4",onSubmit:a,children:[i.jsx("input",{type:"hidden",name:"intent",value:e?"update":"create"}),e?i.jsx("input",{type:"hidden",name:"id",value:e.id}):null,i.jsxs("label",{className:"block text-sm font-semibold",children:["Title",i.jsx("input",{autoFocus:!0,required:!0,name:"title",defaultValue:(e==null?void 0:e.title)??"",className:"mt-1 h-10 w-full rounded-xl border border-[var(--border-strong)] bg-[var(--surface)] px-3 text-[var(--text)]"})]}),i.jsxs("label",{className:"block text-sm font-semibold",children:["Description",i.jsx("textarea",{name:"description",defaultValue:(e==null?void 0:e.description)??"",rows:6,className:"mt-1 w-full resize-y rounded-xl border border-[var(--border-strong)] bg-[var(--surface)] p-3 text-[var(--text)]"})]}),i.jsxs("div",{className:"flex justify-end gap-2",children:[i.jsx("button",{type:"button",onClick:a,className:"rounded-xl border border-[var(--border-strong)] px-4 py-2 text-sm font-semibold",children:"Cancel"}),i.jsx("button",{type:"submit",className:"rounded-xl bg-[var(--accent)] px-4 py-2 text-sm font-semibold text-white",children:e?"Save idea":"Add idea"})]})]})]})})}function eC({idea:e}){const a=Fl();return i.jsxs(a.Form,{method:"post",onSubmit:r=>{window.confirm(`Delete ${`I${String(e.number).padStart(3,"0")}`} — ${e.title}?`)||r.preventDefault()},children:[i.jsx("input",{type:"hidden",name:"intent",value:"delete"}),i.jsx("input",{type:"hidden",name:"id",value:e.id}),i.jsx("button",{type:"submit","aria-label":`Delete ${e.title}`,className:"inline-flex h-9 w-9 items-center justify-center rounded-xl border border-rose-500/30 text-rose-600 hover:bg-rose-500/10",children:i.jsx(js,{className:"h-4 w-4"})})]})}function tC(){const{ideas:e}=xr(),[a,r]=x.useState(null);return i.jsxs("main",{className:"page-container py-6 sm:py-8",children:[i.jsxs("header",{className:"flex items-center justify-between gap-3",children:[i.jsxs("div",{children:[i.jsxs("h1",{className:"flex items-center gap-2 text-2xl font-black",children:[i.jsx(w0,{className:"h-6 w-6 text-[var(--accent)]"})," Ideas Inbox"]}),i.jsx("p",{className:"mt-1 text-sm text-[var(--text-muted)]",children:"Capture ideas without changing planner work status. Agents handle guided promotion separately."})]}),i.jsxs("button",{type:"button",onClick:()=>r("new"),className:"inline-flex shrink-0 items-center gap-2 rounded-xl bg-[var(--accent)] px-3 py-2 text-sm font-semibold text-white",children:[i.jsx(dR,{className:"h-4 w-4"})," Add idea"]})]}),e.length===0?i.jsx("section",{className:"surface-card mt-6 rounded-2xl border border-dashed border-[var(--border-strong)] p-8 text-center text-[var(--text-muted)]",children:"No ideas yet. Add one without affecting feature, phase, or task rollups."}):i.jsx("section",{"aria-label":"Ideas",className:"mt-6 grid gap-3",children:e.map(s=>i.jsx("article",{className:"min-w-0",children:i.jsx(qn,{defaultOpen:!1,className:"surface-card mt-0 rounded-2xl",summaryClassName:"hover:bg-[var(--surface-hover)]/60 focus-visible:bg-[var(--surface-hover)]/60",title:i.jsxs(i.Fragment,{children:[i.jsxs("span",{className:"rounded-lg bg-[var(--accent-soft)] px-2 py-1 font-mono text-xs font-bold text-[var(--accent)]",children:["I",String(s.number).padStart(3,"0")]}),i.jsx("span",{className:"font-mono text-xs font-normal text-[var(--text-muted)]",children:s.shortId}),s.promotion?s.targetHref?i.jsxs(Ve,{to:s.targetHref,className:"rounded-lg border border-emerald-500/30 bg-emerald-500/10 px-2 py-1 text-xs font-semibold text-emerald-700 hover:underline dark:text-emerald-400",children:["Promoted to ",s.promotion.targetRef]}):i.jsxs("span",{className:"rounded-lg border border-emerald-500/30 bg-emerald-500/10 px-2 py-1 text-xs font-semibold text-emerald-700 dark:text-emerald-400",children:["Promoted to ",s.promotion.targetRef]}):null,i.jsx("h2",{className:"break-words text-base font-bold",children:s.title})]}),actions:i.jsxs("div",{className:"flex gap-2",onClick:u=>u.stopPropagation(),children:[i.jsx("button",{type:"button",onClick:()=>r(s),"aria-label":`Edit ${s.title}`,className:"inline-flex h-9 w-9 items-center justify-center rounded-xl border border-[var(--border-strong)] text-[var(--text-muted)] hover:text-[var(--text)]",children:i.jsx(Vl,{className:"h-4 w-4"})}),i.jsx(eC,{idea:s})]}),children:s.description?i.jsx("p",{className:"whitespace-pre-wrap break-words text-sm text-[var(--text-muted)]",children:s.description}):i.jsx("p",{className:"text-sm italic text-[var(--text-muted)]",children:"No description provided."})})},s.id))}),a?i.jsx(JD,{...a==="new"?{}:{idea:a},onClose:()=>r(null)}):null]})}async function nC({params:e}){const a=e.featureId;if(!a)throw new Response("featureId required",{status:400});const[r,s,u]=await Promise.all([ac(a),xd(a),Xm()]);return{feature:r,phases:s,descriptionFreshness:u}}function aC({featureId:e,feature:a,phase:r}){var y,S;const s=Fl(),u=Fl(),d=((y=s.formData)==null?void 0:y.get("status"))??r.status,h=s.state!=="idle",p=u.state!=="idle",g=ld(Ow(r.tasks)),v=V0(r.tasks);return i.jsxs(Ai,{variant:"surface",status:v.displayStatus,className:"px-4 py-2",children:[i.jsxs("div",{className:"grid gap-2 lg:grid-cols-[minmax(0,1fr)_minmax(0,150px)_124px_44px_44px] lg:items-center",children:[i.jsxs("div",{className:"flex min-w-0 flex-col items-start gap-1 lg:contents",children:[i.jsxs("div",{className:"flex min-w-0 flex-col items-start gap-1",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(ar,{featureNum:a.number,phaseNum:r.number,featureId:a.id,phaseId:r.id}),i.jsx(lr,{id:ul({featureNum:a.number,phaseNum:r.number}),children:i.jsx("span",{className:"sr-only",children:"Copy phase path"})}),r.shortId?i.jsx(dl,{shortId:r.shortId}):null,i.jsx(Sd,{priority:r.priority}),r.handoff?i.jsx(Wm,{phaseId:r.id,updatedAt:r.handoffUpdatedAt}):null,i.jsx(Rw,{phaseId:r.id,phaseTitle:r.title,count:((S=r.linkedRequirements)==null?void 0:S.length)??0}),i.jsx("span",{className:"shrink-0",children:i.jsx(rc,{status:v.displayStatus,breakdown:v.breakdown})})]}),i.jsx(Ve,{to:`/features/${e}/phases/${r.id}`,className:"entity-link--phase min-w-0 w-full break-words text-sm font-semibold underline-offset-4 hover:underline [overflow-wrap:anywhere]",children:r.title})]}),i.jsxs("div",{className:"flex items-center gap-2 self-end lg:hidden",children:[i.jsx(Ve,{to:`/features/${e}/phases/${r.id}/edit`,"aria-label":`Edit phase ${r.title}`,children:i.jsx(Ke,{type:"button",variant:"secondary",className:"min-h-8 w-8 rounded-[10px] px-0 text-[var(--text-muted)] hover:text-[var(--text)]",children:i.jsx(Vl,{className:"h-3.5 w-3.5"})})}),i.jsx(u.Form,{method:"post",action:`/features/${e}/phases/${r.id}/delete`,onSubmit:N=>{window.confirm(`Delete phase “${r.title}”? This cannot be undone.`)||N.preventDefault()},children:i.jsx(Ke,{type:"submit",variant:"danger",disabled:p||h,className:"min-h-8 w-8 rounded-[10px] px-0","aria-label":`Delete phase ${r.title}`,children:i.jsx(js,{className:"h-4 w-4"})})})]})]}),i.jsxs("div",{className:"text-[11px] text-[var(--text-muted)]",children:[i.jsxs("div",{className:"font-semibold text-[var(--text)]",children:[r.tasks.length," tasks"]}),g?i.jsx("div",{className:"mt-0.5 break-words",children:g}):null]}),i.jsx(s.Form,{method:"post",action:`/features/${e}/phases/${r.id}/status`,className:"w-full lg:w-auto",children:i.jsxs("div",{className:"relative",children:[i.jsx("select",{name:"status",value:d,disabled:!0,"aria-disabled":"true",title:"Phase status is derived from child tasks.",className:"field-control min-h-8 appearance-none py-1 pr-8 text-[11px]",children:Ad.map(N=>i.jsx("option",{value:N.value,children:N.label},N.value))}),i.jsx(As,{className:"pointer-events-none absolute right-2.5 top-1/2 h-3 w-3 -translate-y-1/2 text-[var(--text-muted)]"})]})}),i.jsx(Ve,{to:`/features/${e}/phases/${r.id}/edit`,"aria-label":`Edit phase ${r.title}`,className:"hidden lg:block",children:i.jsx(Ke,{type:"button",variant:"secondary",className:"min-h-8 w-8 rounded-[10px] px-0 text-[var(--text-muted)] hover:text-[var(--text)]",children:i.jsx(Vl,{className:"h-3.5 w-3.5"})})}),i.jsx(u.Form,{method:"post",action:`/features/${e}/phases/${r.id}/delete`,className:"hidden lg:block",onSubmit:N=>{window.confirm(`Delete phase “${r.title}”? This cannot be undone.`)||N.preventDefault()},children:i.jsx(Ke,{type:"submit",variant:"danger",disabled:p||h,className:"min-h-8 w-8 rounded-[10px] px-0","aria-label":`Delete phase ${r.title}`,children:i.jsx(js,{className:"h-4 w-4"})})})]}),i.jsx("div",{className:"mt-1 flex flex-wrap items-center gap-x-3 gap-y-1",children:i.jsx(fl,{value:r.updatedAt})}),r.summary?i.jsx("div",{className:"mt-1 min-w-0 break-words line-clamp-2 text-[11px] text-[var(--text-muted)]",children:r.summary}):null]})}function yp({items:e,className:a="",stacked:r=!1}){return r?i.jsx("nav",{"aria-label":"Breadcrumb",className:`grid gap-1 text-sm ${a}`,children:e.map((s,u)=>{const c=u===e.length-1,d=s.to&&!c?i.jsx(Ve,{to:s.to,className:"font-semibold text-[var(--accent)] hover:underline break-words min-w-0",children:s.label}):i.jsx("span",{className:`break-words min-w-0 ${c?"text-[var(--text)] font-semibold":"text-[var(--text-muted)]"}`,children:s.label});return i.jsxs("div",{className:"flex items-baseline gap-2 min-w-0",children:[s.kind?i.jsxs("span",{className:"shrink-0 text-[var(--text-subtle)] font-medium",children:[s.kind,":"]}):null,i.jsx("span",{className:"min-w-0",children:d})]},`${s.label}-${u}`)})}):i.jsx("nav",{"aria-label":"Breadcrumb",className:`flex flex-wrap items-center gap-2 text-sm ${a}`,children:e.map((s,u)=>{const c=u===e.length-1,d=s.to&&!c?i.jsx(Ve,{to:s.to,className:"font-semibold text-[var(--accent)] hover:underline",children:s.label}):i.jsx("span",{className:c?"text-[var(--text)]":"text-[var(--text-muted)]",children:s.label});return i.jsxs("span",{className:"inline-flex min-w-0 items-center gap-2",children:[u>0?i.jsx("span",{className:"text-[var(--text-subtle)]",children:"/"}):null,i.jsx("span",{className:"min-w-0 break-words",children:d})]},`${s.label}-${u}`)})})}function bp({featureNum:e,phaseNum:a,taskNum:r,featureId:s,phaseId:u,taskId:c,shortId:d,children:h}){return i.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[i.jsx(ar,{featureNum:e,phaseNum:a,taskNum:r,featureId:s,phaseId:u,taskId:c}),i.jsx(lr,{id:ul({featureNum:e,phaseNum:a,taskNum:r}),children:i.jsx("span",{className:"sr-only",children:"Copy path"})}),d?i.jsx(dl,{shortId:d}):null,h]})}const rC=250;function zu(e){return`inline-flex h-9 min-h-9 shrink-0 items-center justify-center whitespace-nowrap rounded-[9px] border px-2 py-1 text-xs font-semibold transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--accent)] sm:h-9 sm:min-h-9 sm:rounded-[10px] sm:px-2.5 ${e?"border-transparent bg-[var(--accent)] text-white":"border-[var(--border)] bg-[var(--surface-card)] text-[var(--text-muted)] hover:bg-[var(--accent-soft)] hover:text-[var(--text)]"}`}function zw({entityKind:e,statusOptions:a,value:r,onChange:s,sortSlot:u}){const[c,d]=x.useState(r.query),h=x.useRef(null),p=x.useRef(r);p.current=r,x.useEffect(()=>{d(r.query)},[r.query]),x.useEffect(()=>()=>{h.current!==null&&window.clearTimeout(h.current)},[]);const g=j=>{h.current!==null&&window.clearTimeout(h.current),h.current=window.setTimeout(()=>{s({...p.current,query:j})},rC)},v=j=>{d(j),g(j)},y=j=>{s({...p.current,[j]:!p.current[j]})},S=j=>{s({...p.current,status:j})},N=()=>{h.current!==null&&window.clearTimeout(h.current),d(""),s({query:"",status:"",hideDone:!1,hidePlanned:!1,onlyActive:!1})},w=((a==null?void 0:a.length)??0)>0;return i.jsxs("div",{className:"surface-card flex flex-col gap-3 p-3 sm:p-4",children:[i.jsxs("div",{className:"flex flex-wrap items-end gap-3",children:[i.jsxs("div",{className:"min-w-[180px] flex-1",children:[i.jsx("label",{htmlFor:"detail-filter-query",className:"mb-1 block text-xs font-semibold uppercase tracking-[0.18em] text-[var(--text-subtle)]",children:"Search"}),i.jsx(Mn,{id:"detail-filter-query",value:c,onChange:j=>v(j.target.value),placeholder:e==="task"?"Search task title, number, or shortId":"Search phase title, number, or shortId",className:"h-9 py-2"})]}),u]}),i.jsxs("div",{className:"flex flex-wrap items-end gap-3",children:[w?i.jsxs("div",{children:[i.jsx("label",{htmlFor:"detail-filter-status",className:"mb-1 block text-xs font-semibold uppercase tracking-[0.18em] text-[var(--text-subtle)]",children:"Status"}),i.jsx("div",{className:"flex items-center rounded-[12px] border border-[var(--border)] bg-[var(--surface-card)] px-2 py-1.5 sm:rounded-[14px] sm:px-3 sm:py-2",children:i.jsxs(Gl,{id:"detail-filter-status",value:r.status,onChange:j=>S(j.target.value),className:"h-9 appearance-none border-0 bg-transparent py-0 pr-8",children:[i.jsx("option",{value:"",children:"All statuses"}),a==null?void 0:a.map(j=>i.jsx("option",{value:j.value,children:j.label},j.value))]})})]}):null,i.jsxs("div",{className:"flex-1 min-w-0 flex items-center gap-1.5 overflow-x-auto rounded-[12px] border border-[var(--border)] bg-[var(--surface-card)] px-2 py-1.5 [scrollbar-width:thin] [&::-webkit-scrollbar]:h-1.5 sm:gap-2 sm:rounded-[14px] sm:px-3 sm:py-2",children:[i.jsx("button",{type:"button",onClick:()=>y("hideDone"),className:zu(r.hideDone),children:"Hide Done"}),i.jsx("button",{type:"button",onClick:()=>y("hidePlanned"),className:zu(r.hidePlanned),children:"Hide Planned"}),i.jsx("button",{type:"button",onClick:()=>y("onlyActive"),className:zu(r.onlyActive),children:"Only active"}),i.jsx("button",{type:"button",onClick:N,className:zu(!1),children:"Clear"})]})]})]})}function wp({freshness:e,ownerIds:a}){const r=e==null?void 0:e.reconciliationPreview.filter(s=>a.includes(s.ownerId));return!r||r.length===0?null:i.jsx(qn,{title:"Description freshness",defaultOpen:!1,children:i.jsxs("div",{className:"space-y-2 text-sm",children:[i.jsx("div",{className:"font-medium",children:"Parent description review required"}),i.jsx("p",{className:"text-muted-foreground",children:"Child context changed after its parent description. Review this preview and explicitly edit the parent only when its prose is stale; authored descriptions remain unchanged."}),i.jsx("ul",{className:"space-y-2",children:r.map(s=>i.jsxs("li",{children:[i.jsx("span",{className:"font-mono text-xs",children:s.ownerRef}),i.jsx("span",{className:"text-muted-foreground",children:" after "}),i.jsx("span",{className:"font-mono text-xs",children:s.causedByRef}),i.jsx("div",{className:"text-muted-foreground",children:s.action})]},`${s.ownerKind}:${s.ownerId}`))})]})})}const lC={draft:Cj,discovery:pR,planned:nc,"in-progress":b0,done:Fm,blocked:S0,waiting:Vm,deferred:yR,canceled:v0,rejected:Mj};function om(e){return e.split(/[-\s]+/).filter(Boolean).map(a=>a==="and"?"and":a.charAt(0).toUpperCase()+a.slice(1)).join(" ")}function kb(e){if(!e)return"";try{return new Intl.DateTimeFormat(void 0,{dateStyle:"short",timeStyle:"short"}).format(new Date(e))}catch{return e}}const sC=new Set(["canceled","rejected"]);function Sp({statusLog:e,currentStatus:a,backbone:r,createdAt:s,updatedAt:u,startedAt:c,completedAt:d}){const h=[];if(e.length===0){const w=r.indexOf(a);if(w>=0)for(let j=0;j<=w;j++)h.push(r[j]);else h.push(a)}else{const w=e[0];w&&h.push(w.fromStatus);for(const j of e)h[h.length-1]!==j.toStatus&&h.push(j.toStatus)}h[h.length-1]!==a&&h.push(a);const p=new Set(h),g=a==="done"||sC.has(a),v=w=>{var R,M;if(e.length>0){if(w===((R=e[0])==null?void 0:R.fromStatus))return((M=e[0])==null?void 0:M.date)??"";for(const $ of e)if($.toStatus===w)return $.date;return""}const j=r[0];return w===j?s??"":w==="in-progress"?c??u??"":w==="done"?d??u??"":""},y=[...h];if(!g){const w=r.indexOf(a);if(w>=0&&w+1<r.length){const j=r[w+1];p.has(j)||y.push(j)}}const S=e.length===0?y.filter((w,j)=>j===0||w===a||!!v(w)):y,N=w=>p.has(w)?w===a&&!g?"current":"completed":"pending";return i.jsx("ol",{className:"status-stepper",role:"list","aria-label":"Status progress",children:S.map((w,j)=>{const R=N(w),M=lC[w]??md,$=p.has(w),B=v(w),Y=B?`${om(w)} — ${kb(B)}`:om(w),ne=j===0?null:$?"traveled":"pending";return i.jsxs("li",{className:`status-step status-step--${R}`,role:"listitem","aria-current":R==="current"?"step":void 0,style:{"--step-color":`var(--color-status-${w})`},children:[ne?i.jsx("span",{className:`status-connector status-connector--${ne}`,"aria-hidden":"true"}):null,i.jsx("span",{className:"status-node",title:Y,children:i.jsx(M,{className:"status-node-icon"})}),i.jsx("span",{className:"status-step-label",children:om(w)}),B?i.jsx("span",{className:"status-step-date",children:kb(B)}):null]},`${w}-${j}`)})})}function Tb(e){return e.split(/[-\s]+/).filter(Boolean).map(a=>a==="and"?"and":a.charAt(0).toUpperCase()+a.slice(1)).join(" ")}function iC(e){if(!e)return"";try{return new Intl.DateTimeFormat(void 0,{dateStyle:"short",timeStyle:"short"}).format(new Date(e))}catch{return e}}function oC(e,a,r,s,u){if(e.length>0)return e.map(h=>({date:h.date,fromStatus:h.fromStatus,toStatus:h.toStatus,motivation:h.description.trim(),inferred:!1}));const c=r.indexOf(a);if(c<0)return[];const d=[];for(let h=1;h<=c;h++){const p=r[h-1],g=r[h],v=g==="in-progress"?s??"":g==="done"?u??"":"";d.push({date:v,fromStatus:p,toStatus:g,motivation:"",inferred:!0})}return d}function Np({statusLog:e,currentStatus:a,backbone:r,startedAt:s,completedAt:u}){const c=oC(e??[],a??"",r??[],s,u);return i.jsx(qn,{title:"Status history",count:c.length,contentClassName:"grid gap-2.5",children:c.length===0?i.jsx("p",{className:"text-sm text-[var(--text-muted)] italic",children:"No status changes recorded."}):i.jsx("div",{className:"overflow-x-auto",children:i.jsxs("table",{className:"w-full min-w-[40rem] border-collapse text-left text-sm",children:[i.jsx("thead",{children:i.jsxs("tr",{className:"border-b border-[var(--border)] text-xs text-[var(--text-subtle)]",children:[i.jsx("th",{scope:"col",className:"px-2 pb-2 font-medium",children:"Date"}),i.jsx("th",{scope:"col",className:"px-2 pb-2 font-medium",children:"From"}),i.jsx("th",{scope:"col",className:"px-2 pb-2 font-medium",children:"To"}),i.jsx("th",{scope:"col",className:"px-2 pb-2 font-medium",children:"Motivation"})]})}),i.jsx("tbody",{children:c.map((d,h)=>i.jsxs("tr",{className:"border-b border-[var(--border)] last:border-b-0",children:[i.jsx("td",{className:"px-2 py-2 align-top text-xs font-mono text-[var(--text-subtle)] whitespace-nowrap",children:iC(d.date)}),i.jsx("td",{className:"px-2 py-2 align-top font-semibold text-[var(--text-muted)] whitespace-nowrap",children:Tb(d.fromStatus)}),i.jsx("td",{className:"px-2 py-2 align-top font-semibold text-[var(--text)] whitespace-nowrap",children:Tb(d.toStatus)}),i.jsx("td",{className:"px-2 py-2 align-top text-[var(--text-muted)] whitespace-pre-wrap [overflow-wrap:anywhere]",children:d.motivation||"—"})]},h))})]})})})}function cC(e){return e.reduce((a,r)=>a+r.tasks.length,0)}function uC(e){let a=0,r=0,s=0,u=0;for(const c of e)for(const d of c.tasks)d.status==="in-progress"&&(a+=1),d.status==="done"&&(r+=1),d.status==="blocked"&&(s+=1),["done","canceled"].includes(d.status)||(u+=1);return{inProgress:a,done:r,blocked:s,remaining:u}}function dC(e){return e.find(a=>["in-progress","discovery","planned","draft"].includes(a.status))}function fC(){var ae,U;const{feature:e,phases:a,descriptionFreshness:r}=xr(),s=e.acceptedDecisions??[],u=cC(a),c=uC(a),d=dC(a),h=F0(a),[p,g]=tc(),v=((ae=p.get("sort"))==null?void 0:ae.trim())??"priority",y=((U=p.get("dir"))==null?void 0:U.trim())??"asc",[S,N]=x.useState(()=>{var k,re;return{query:((k=p.get("q"))==null?void 0:k.trim())??"",status:((re=p.get("status"))==null?void 0:re.trim())??"",hideDone:p.get("hideDone")==="1",hidePlanned:p.get("hidePlanned")==="1",onlyActive:p.get("onlyActive")==="1"}});x.useEffect(()=>{const k=new URL(window.location.href),re=(pe,Se,ye="1")=>{Se?k.searchParams.set(pe,ye):k.searchParams.delete(pe)};re("q",S.query.trim()!=="",S.query.trim()),re("status",S.status!=="",S.status),re("hideDone",S.hideDone),re("hidePlanned",S.hidePlanned),re("onlyActive",S.onlyActive),window.history.replaceState(window.history.state,"",`${k.pathname}${k.search}${k.hash}`)},[S]);const w={key:v==="priority"||v==="number"||v==="createdAt"||v==="updatedAt"||v==="title"||v==="shortId"||v==="status"||v==="startedAt"||v==="completedAt"?v:"priority",direction:y==="desc"?"desc":"asc"},j=x.useMemo(()=>[...a].sort((k,re)=>Lo(k,re,w.key,w.direction)),[a,w]),R=x.useMemo(()=>j.filter(k=>Lw(k,S,["in-progress","discovery"])&&Dd(S.query,[k.title,String(k.number),k.shortId])),[j,S]),M=_r(),$=x.useRef(null),B=x.useCallback(()=>M("edit"),[M]),Y=x.useCallback(()=>M("phases/new"),[M]),ne=x.useCallback(()=>{var k;(k=$.current)==null||k.requestSubmit()},[]);return _n("edit",B),_n("create",Y),_n("delete",ne),i.jsxs("div",{className:"grid gap-8",children:[i.jsxs(Ve,{to:"/features",className:"inline-flex items-center gap-2 text-sm font-semibold text-[var(--accent)] hover:underline",children:[i.jsx(hd,{className:"h-4 w-4"})," Back to features"]}),i.jsxs("div",{className:"min-w-0",children:[i.jsx(yp,{stacked:!0,items:[{label:e.name,kind:"Feature"}]}),i.jsx("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:i.jsx(bp,{featureNum:e.number,featureId:e.id,shortId:e.shortId,children:i.jsx(rc,{status:h.displayStatus,breakdown:h.breakdown})})}),i.jsx("h2",{className:"mt-2 text-2xl font-black tracking-tight text-[var(--text)] min-w-0 break-words [overflow-wrap:anywhere] sm:text-3xl",children:e.name}),e.description?i.jsx(qn,{title:i.jsxs(i.Fragment,{children:[i.jsx("span",{children:"Description"}),i.jsx(fl,{value:e.descriptionUpdatedAt})]}),children:i.jsx(Nn,{text:e.description,className:"plan-description max-w-4xl"})}):null,i.jsx("div",{className:"mt-4",children:i.jsx(Sp,{statusLog:e.statusLog??[],currentStatus:e.status,backbone:["planned","in-progress","done"],createdAt:e.createdAt,updatedAt:e.updatedAt})}),i.jsxs("div",{className:"mt-4 flex flex-wrap items-center gap-2",children:[i.jsx(Ve,{to:"edit",children:i.jsx(Ke,{type:"button",shortcut:"edit",children:"Edit feature"})}),i.jsx(un,{ref:$,method:"post",action:`/features/${e.id}/delete`,className:"inline-flex",onSubmit:k=>{window.confirm(`Delete feature "${e.name}"?`)||k.preventDefault()},children:i.jsx(Ke,{type:"submit",variant:"danger",shortcut:"delete",children:"Delete feature"})})]})]}),i.jsx(wp,{freshness:r,ownerIds:[e.id]}),i.jsxs(Gt,{className:"grid gap-4",children:[i.jsxs("div",{className:"grid gap-4 md:grid-cols-2 xl:grid-cols-4",children:[i.jsxs(In,{children:[i.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.22em] text-[var(--text-subtle)]",children:"Current phase"}),i.jsx("p",{className:"mt-2 text-sm font-semibold text-[var(--text)] break-words",children:(d==null?void 0:d.title)||"No active phase"})]}),i.jsxs(In,{children:[i.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.22em] text-[var(--text-subtle)]",children:"Phases"}),i.jsx("p",{className:"mt-2 text-3xl font-black text-[var(--text)]",children:a.length})]}),i.jsxs(In,{children:[i.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.22em] text-[var(--text-subtle)]",children:"Tasks"}),i.jsx("p",{className:"mt-2 text-3xl font-black text-[var(--text)]",children:u})]}),i.jsxs(In,{children:[i.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.22em] text-[var(--text-subtle)]",children:"Current phase"}),i.jsx("p",{className:"mt-2 text-sm font-semibold text-[var(--text)] break-words",children:(d==null?void 0:d.title)||"No active phase"})]})]}),i.jsxs("div",{className:"grid gap-4 md:grid-cols-2 xl:grid-cols-4",children:[i.jsxs(In,{children:[i.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.22em] text-[var(--text-subtle)]",children:"In progress"}),i.jsx("p",{className:"mt-2 text-2xl font-black text-[var(--text)]",children:c.inProgress})]}),i.jsxs(In,{children:[i.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.22em] text-[var(--text-subtle)]",children:"Remaining"}),i.jsx("p",{className:"mt-2 text-2xl font-black text-[var(--text)]",children:c.remaining})]}),i.jsxs(In,{children:[i.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.22em] text-[var(--text-subtle)]",children:"Done"}),i.jsx("p",{className:"mt-2 text-2xl font-black text-[var(--text)]",children:c.done})]}),i.jsxs(In,{children:[i.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.22em] text-[var(--text-subtle)]",children:"Blocked"}),i.jsx("p",{className:"mt-2 text-2xl font-black text-[var(--text)]",children:c.blocked})]})]}),i.jsx(ep,{items:[{label:"Entity last updated",value:cl(e.updatedAt),visible:!!e.updatedAt},{label:"Priority",value:wd(e.priority),visible:e.priority>0},{label:"Timeline",value:U2(e.startDate,e.endDate),visible:!!(e.startDate||e.endDate)}]}),e.workDone||e.workRemaining?i.jsx(qn,{title:"Planning notes",defaultOpen:!1,children:i.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.workDone?i.jsxs("div",{children:[i.jsx("span",{className:"font-semibold text-[var(--text)]",children:"Work done"}),i.jsx(Nn,{text:e.workDone,className:"mt-2"})]}):null,e.workRemaining?i.jsxs("div",{children:[i.jsx("span",{className:"font-semibold text-[var(--text)]",children:"Work remaining"}),i.jsx(Nn,{text:e.workRemaining,className:"mt-2"})]}):null]})}):null,i.jsx(bd,{decisions:s,targetType:"feature",targetRef:e.id}),i.jsx(Np,{statusLog:e.statusLog??[],currentStatus:e.status,backbone:["planned","in-progress","done"]})]}),i.jsxs(Gt,{className:"grid gap-5",children:[i.jsxs("div",{className:"flex flex-col gap-4 md:flex-row md:items-start md:justify-between",children:[i.jsxs("div",{children:[i.jsxs("p",{className:"text-sm font-semibold uppercase tracking-[0.22em] text-[var(--text-subtle)]",children:["Phases (",a.length,")"]}),i.jsx("p",{className:"mt-2 text-sm text-[var(--text-muted)]",children:"Filter and sort this feature's phases."})]}),i.jsx(Ve,{to:"phases/new",children:i.jsx(Ke,{type:"button",variant:"primary",shortcut:"create",children:"Create phase"})})]}),i.jsx(zw,{entityKind:"phase",statusOptions:Ad,value:S,onChange:N,sortSlot:i.jsx(hp,{sort:w,onChange:k=>g(re=>(re.set("sort",k.key),re.set("dir",k.direction),re))})}),i.jsx("div",{className:"grid gap-3",children:a.length===0?i.jsxs(Gt,{className:"p-4 text-sm text-[var(--text-muted)]",children:["No phases yet. ",i.jsx(Ve,{to:`/features/${e.id}/phases/new`,className:"font-semibold text-[var(--accent)] hover:underline",children:"Add a phase"})]}):R.length>0?R.map(k=>i.jsx(aC,{featureId:e.id,feature:e,phase:k},k.id)):i.jsx(Gt,{className:"p-4 text-sm text-[var(--text-muted)]",children:"No phases match the current filters."})})]}),i.jsx(ji,{})]})}async function hC({params:e}){const{featureId:a,phaseId:r}=e;if(!a||!r)throw new Response("featureId and phaseId required",{status:400});const[s,u,c,d,h]=await Promise.all([ac(a),Qm(),vd(r),Km(),Xm()]),p=d.filter(g=>g.linkedPhaseIds.includes(r));return{feature:s,features:u,phase:{...c,linkedRequirements:p},descriptionFreshness:h}}function mC({featureId:e,featureNum:a,phaseId:r,phaseNum:s,task:u}){var N;const c=Fl(),d=Fl(),p=((N=c.formData)==null?void 0:N.get("status"))??u.status,g=c.state!=="idle",v=d.state!=="idle",y=ld(qD(u.subtasks)),S=_0(p);return i.jsxs(Ai,{variant:"surface",status:S,className:"px-4 py-2",children:[i.jsxs("div",{className:"grid gap-2 lg:grid-cols-[minmax(0,1fr)_minmax(0,168px)_124px_44px_44px] lg:items-center",children:[i.jsxs("div",{className:"flex min-w-0 flex-col items-start gap-1 lg:contents",children:[i.jsxs("div",{className:"flex min-w-0 flex-col items-start gap-1",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(ar,{featureNum:a,phaseNum:s,taskNum:u.number,featureId:e,phaseId:r,taskId:u.id}),i.jsx(lr,{id:ul({featureNum:a,phaseNum:s,taskNum:u.number}),children:i.jsx("span",{className:"sr-only",children:"Copy task path"})}),u.shortId?i.jsx(dl,{shortId:u.shortId}):null,i.jsx("span",{className:"shrink-0",children:i.jsx(hr,{status:p})})]}),i.jsx(Ve,{to:`/features/${e}/phases/${r}/tasks/${u.id}`,className:"entity-link--task min-w-0 w-full break-words text-sm font-semibold underline-offset-4 hover:underline [overflow-wrap:anywhere]",children:u.title})]}),i.jsxs("div",{className:"flex items-center gap-2 self-end lg:hidden",children:[i.jsx(Ve,{to:`/features/${e}/phases/${r}/tasks/${u.id}/edit`,"aria-label":`Edit task ${u.title}`,children:i.jsx(Ke,{type:"button",variant:"secondary",className:"min-h-8 w-8 rounded-[10px] px-0 text-[var(--text-muted)] hover:text-[var(--text)]",children:i.jsx(Vl,{className:"h-3.5 w-3.5"})})}),i.jsx(d.Form,{method:"post",action:`/features/${e}/phases/${r}/tasks/${u.id}/delete`,onSubmit:w=>{window.confirm(`Delete task “${u.title}”? This cannot be undone.`)||w.preventDefault()},children:i.jsx(Ke,{type:"submit",variant:"danger",disabled:v||g,className:"min-h-8 w-8 rounded-[10px] px-0","aria-label":`Delete task ${u.title}`,children:i.jsx(js,{className:"h-4 w-4"})})})]})]}),i.jsxs("div",{className:"text-[11px] text-[var(--text-muted)]",children:[i.jsxs("div",{className:"font-semibold text-[var(--text)]",children:[u.subtasks.length," subtasks · ",u.checklist.length," checklist"]}),y?i.jsx("div",{className:"mt-0.5 break-words",children:y}):i.jsx("div",{className:"mt-0.5 break-words",children:"No subtask statuses yet"})]}),i.jsx(c.Form,{method:"post",action:`/features/${e}/phases/${r}/tasks/${u.id}/status`,className:"w-full lg:w-auto",children:i.jsxs("div",{className:"relative",children:[i.jsx("select",{name:"status",value:p,disabled:g||v||!!u.pauseSnapshot,"aria-busy":g,title:u.pauseSnapshot?"Resume checkpointed work through task_start so its checkpoint is preserved.":void 0,className:"field-control min-h-8 appearance-none py-1 pr-8 text-[11px]",onChange:w=>c.submit(w.currentTarget.form),children:rd.map(w=>i.jsx("option",{value:w.value,children:w.label},w.value))}),i.jsx(As,{className:"pointer-events-none absolute right-2.5 top-1/2 h-3 w-3 -translate-y-1/2 text-[var(--text-muted)]"})]})}),i.jsx(Ve,{to:`/features/${e}/phases/${r}/tasks/${u.id}/edit`,"aria-label":`Edit task ${u.title}`,className:"hidden lg:block",children:i.jsx(Ke,{type:"button",variant:"secondary",className:"min-h-8 w-8 rounded-[10px] px-0 text-[var(--text-muted)] hover:text-[var(--text)]",children:i.jsx(Vl,{className:"h-3.5 w-3.5"})})}),i.jsx(d.Form,{method:"post",action:`/features/${e}/phases/${r}/tasks/${u.id}/delete`,className:"hidden lg:block",onSubmit:w=>{window.confirm(`Delete task “${u.title}”? This cannot be undone.`)||w.preventDefault()},children:i.jsx(Ke,{type:"submit",variant:"danger",disabled:v||g,className:"min-h-8 w-8 rounded-[10px] px-0","aria-label":`Delete task ${u.title}`,children:i.jsx(js,{className:"h-4 w-4"})})})]}),i.jsxs("div",{className:"mt-1 flex flex-wrap gap-x-3 gap-y-1 text-[11px] text-[var(--text-subtle)]",children:[i.jsx(fl,{value:u.updatedAt}),u.startedAt?i.jsxs("span",{children:["Started ",cl(u.startedAt)]}):null,u.completedAt?i.jsxs("span",{children:["Completed ",cl(u.completedAt)]}):null]}),u.description?i.jsx("div",{className:"mt-1 min-w-0 break-words line-clamp-2 text-[11px] text-[var(--text-muted)]",children:u.description}):null]})}function pC(e){let a=0,r=0,s=0,u=0;for(const c of e.tasks)c.status==="in-progress"&&(a+=1),c.status==="done"&&(r+=1),c.status==="blocked"&&(s+=1),["done","canceled"].includes(c.status)||(u+=1);return{inProgress:a,done:r,blocked:s,remaining:u}}function gC(){var Se,ye;const{feature:e,phase:a,descriptionFreshness:r}=xr(),s=a.decisions??[],u=a.acceptedDecisions??[],c=a.linkedRequirements??[],d=pC(a),h=V0(a.tasks),[p,g]=tc(),v=((Se=p.get("sort"))==null?void 0:Se.trim())??"priority",y=((ye=p.get("dir"))==null?void 0:ye.trim())??"asc",[S,N]=x.useState(()=>{var he,je;return{query:((he=p.get("q"))==null?void 0:he.trim())??"",status:((je=p.get("status"))==null?void 0:je.trim())??"",hideDone:p.get("hideDone")==="1",hidePlanned:p.get("hidePlanned")==="1",onlyActive:p.get("onlyActive")==="1"}});x.useEffect(()=>{const he=new URL(window.location.href),je=(W,L,F="1")=>{L?he.searchParams.set(W,F):he.searchParams.delete(W)};je("q",S.query.trim()!=="",S.query.trim()),je("status",S.status!=="",S.status),je("hideDone",S.hideDone),je("hidePlanned",S.hidePlanned),je("onlyActive",S.onlyActive),window.history.replaceState(window.history.state,"",`${he.pathname}${he.search}${he.hash}`)},[S]);const w={key:v==="priority"||v==="number"||v==="createdAt"||v==="updatedAt"||v==="title"||v==="shortId"||v==="status"||v==="startedAt"||v==="completedAt"?v:"priority",direction:y==="desc"?"desc":"asc"},j=x.useMemo(()=>[...a.tasks].sort((he,je)=>Lo(he,je,w.key,w.direction)),[a.tasks,w]),R=x.useMemo(()=>j.filter(he=>Lw(he,S,["in-progress"])&&Dd(S.query,[he.title,String(he.number),he.shortId])),[j,S]),M=_r(),$=x.useRef(null),[B,Y]=x.useState(a.handoff??""),[ne,ae]=x.useState(!1),U=x.useCallback(()=>M("edit"),[M]),k=x.useCallback(()=>M("tasks/new"),[M]),re=x.useCallback(()=>{var he;(he=$.current)==null||he.requestSubmit()},[]),pe=x.useCallback(async()=>{if(window.confirm("Clear this phase's handoff?")){ae(!0);try{await A0(a.id),Y("")}catch{}finally{ae(!1)}}},[a.id]);return _n("edit",U),_n("create",k),_n("delete",re),i.jsxs("div",{className:"grid gap-8",children:[i.jsxs(Ve,{to:`/features/${e.id}`,className:"inline-flex items-center gap-2 text-sm font-semibold text-[var(--accent)] hover:underline",children:[i.jsx(hd,{className:"h-4 w-4"})," Back to feature"]}),i.jsxs("div",{className:"min-w-0",children:[i.jsx(yp,{stacked:!0,items:[{label:e.name,to:`/features/${e.id}`,kind:"Feature"},{label:a.title,kind:"Phase"}]}),i.jsx("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:i.jsxs(bp,{featureNum:e.number,phaseNum:a.number,featureId:e.id,phaseId:a.id,shortId:a.shortId,children:[B?i.jsx(Wm,{phaseId:a.id,updatedAt:a.handoffUpdatedAt}):null,i.jsx(rc,{status:h.displayStatus,breakdown:h.breakdown})]})}),i.jsx("h2",{className:"mt-2 text-2xl font-black tracking-tight text-[var(--text)] min-w-0 break-words [overflow-wrap:anywhere] sm:text-3xl",children:a.title}),a.summary?i.jsx(Nn,{text:a.summary,className:"mt-3 max-w-4xl"}):null,i.jsx(Sp,{statusLog:a.statusLog??[],currentStatus:a.status,backbone:["draft","discovery","planned","in-progress","done"],createdAt:a.createdAt,updatedAt:a.updatedAt}),i.jsxs("div",{className:"mt-4 flex flex-wrap items-center gap-2",children:[i.jsx(Ve,{to:"edit",children:i.jsx(Ke,{type:"button",shortcut:"edit",children:"Edit phase"})}),i.jsx(un,{ref:$,method:"post",action:`/features/${e.id}/phases/${a.id}/delete`,className:"inline-flex",onSubmit:he=>{window.confirm(`Delete phase "${a.title}"?`)||he.preventDefault()},children:i.jsx(Ke,{type:"submit",variant:"danger",shortcut:"delete",children:"Delete phase"})})]})]}),i.jsx(wp,{freshness:r,ownerIds:[a.id,e.id]}),i.jsxs(Gt,{className:"grid gap-4",children:[i.jsxs("div",{className:"grid gap-4 md:grid-cols-2 xl:grid-cols-4",children:[i.jsxs(In,{children:[i.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.22em] text-[var(--text-subtle)]",children:"Tasks"}),i.jsx("p",{className:"mt-2 text-3xl font-black text-[var(--text)]",children:a.tasks.length})]}),i.jsxs(In,{children:[i.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.22em] text-[var(--text-subtle)]",children:"In progress"}),i.jsx("p",{className:"mt-2 text-2xl font-black text-[var(--text)]",children:d.inProgress})]}),i.jsxs(In,{children:[i.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.22em] text-[var(--text-subtle)]",children:"Remaining"}),i.jsx("p",{className:"mt-2 text-2xl font-black text-[var(--text)]",children:d.remaining})]}),i.jsxs(In,{children:[i.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.22em] text-[var(--text-subtle)]",children:"Done"}),i.jsx("p",{className:"mt-2 text-2xl font-black text-[var(--text)]",children:d.done})]})]}),i.jsxs("div",{className:"grid gap-4 md:grid-cols-2 xl:grid-cols-4",children:[i.jsxs(In,{children:[i.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.22em] text-[var(--text-subtle)]",children:"Blocked"}),i.jsx("p",{className:"mt-2 text-2xl font-black text-[var(--text)]",children:d.blocked})]}),i.jsxs(In,{children:[i.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.22em] text-[var(--text-subtle)]",children:"Goals"}),i.jsx("p",{className:"mt-2 text-2xl font-black text-[var(--text)]",children:a.goals.length})]}),i.jsxs(In,{children:[i.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.22em] text-[var(--text-subtle)]",children:"Dependencies"}),i.jsx("p",{className:"mt-2 text-2xl font-black text-[var(--text)]",children:a.dependencies.length})]}),i.jsxs(In,{children:[i.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.22em] text-[var(--text-subtle)]",children:"Completion criteria"}),i.jsx("p",{className:"mt-2 text-2xl font-black text-[var(--text)]",children:a.completionCriteria.length})]})]}),i.jsx(ep,{items:[{label:"Entity last updated",value:cl(a.updatedAt),visible:!!a.updatedAt},{label:"Priority",value:wd(a.priority),visible:a.priority>0},{label:"Linked requirements",value:c.length,visible:c.length>0,valueClassName:"text-2xl font-black"},{label:"Risks",value:a.risks.length,visible:a.risks.length>0,valueClassName:"text-2xl font-black"},{label:"Open questions",value:a.openQuestions.length,visible:a.openQuestions.length>0,valueClassName:"text-2xl font-black"}]}),a.notes?i.jsx(qn,{title:"Notes",defaultOpen:!1,children:i.jsx(Nn,{text:a.notes,className:"plan-description"})}):null,i.jsx(qn,{title:"Linked requirements",count:c.length,defaultOpen:!1,children:c.length>0?i.jsx("div",{className:"grid gap-3",children:c.map(he=>i.jsx("div",{className:"min-w-0 rounded-[18px] border border-[var(--border)] bg-[var(--surface-card)] px-4 py-4",children:i.jsxs("div",{className:"flex min-w-0 flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",children:[i.jsxs("div",{className:"min-w-0",children:[he.macroTasks.length>0?i.jsx("div",{className:"flex flex-wrap items-center gap-2",children:i.jsxs("span",{className:"text-xs font-semibold uppercase tracking-[0.16em] text-[var(--text-subtle)]",children:[he.macroTasks.length," macro task",he.macroTasks.length===1?"":"s"]})}):null,i.jsx("h3",{className:"mt-2 text-lg font-black tracking-tight text-[var(--text)] [overflow-wrap:anywhere]",children:he.title}),he.description?i.jsx("p",{className:"mt-2 text-sm text-[var(--text-muted)] [overflow-wrap:anywhere]",children:he.description}):null]}),i.jsx(Ve,{to:`/requirements#phase-${a.id}`,className:"text-sm font-semibold text-[var(--accent)] hover:underline sm:shrink-0",children:"Open phase requirements →"})]})},he.id))}):i.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:"No linked requirements yet."})}),a.description?i.jsx(qn,{title:i.jsxs(i.Fragment,{children:[i.jsx("span",{children:"Description"}),i.jsx(fl,{value:a.descriptionUpdatedAt})]}),children:i.jsx(Nn,{text:a.description,className:"plan-description"})}):null,s.length>0?i.jsx(qn,{title:"Decisions",count:s.length,defaultOpen:!1,children:i.jsx("div",{className:"grid gap-2 border-l-2 border-[var(--border)] pl-4 ml-1",children:s.map((he,je)=>i.jsx("div",{className:"text-sm text-[var(--text-muted)]",children:i.jsx(Nn,{text:he})},je))})}):null,i.jsx(bd,{decisions:u,targetType:"phase",targetRef:a.id}),i.jsx(Np,{statusLog:a.statusLog??[],currentStatus:a.status,backbone:["draft","discovery","planned","in-progress","done"]})]}),B?i.jsx(Gt,{className:"grid gap-4",children:i.jsx(qn,{title:"Handoff",actions:i.jsx("button",{type:"button",onClick:pe,disabled:ne,className:"rounded-lg border border-[var(--border)] px-3 py-1.5 text-sm text-[var(--text-muted)] hover:bg-[var(--surface-card)] disabled:opacity-60",children:ne?"Clearing…":"Clear handoff"}),children:i.jsx("div",{className:"rounded-[18px] border border-[var(--border)] bg-[var(--surface-card)] px-5 py-5",children:i.jsx(Nn,{text:B,className:"formatted-text max-w-none"})})})}):null,i.jsxs(Gt,{className:"grid gap-5",children:[i.jsxs("div",{className:"flex flex-col gap-4 md:flex-row md:items-start md:justify-between",children:[i.jsxs("div",{children:[i.jsxs("p",{className:"text-sm font-semibold uppercase tracking-[0.22em] text-[var(--text-subtle)]",children:["Tasks (",a.tasks.length,")"]}),i.jsx("p",{className:"mt-2 text-sm text-[var(--text-muted)]",children:"Filter and sort this phase's tasks."})]}),i.jsx(Ve,{to:"tasks/new",children:i.jsx(Ke,{type:"button",variant:"primary",shortcut:"create",children:"Create task"})})]}),i.jsx(zw,{entityKind:"task",statusOptions:mp,value:S,onChange:N,sortSlot:i.jsx(hp,{sort:w,onChange:he=>g(je=>(je.set("sort",he.key),je.set("dir",he.direction),je))})}),i.jsx("div",{className:"grid gap-3",children:a.tasks.length===0?i.jsxs(Gt,{className:"p-4 text-sm text-[var(--text-muted)]",children:["No tasks yet. ",i.jsx(Ve,{to:"tasks/new",className:"font-semibold text-[var(--accent)] hover:underline",children:"Add a task"})]}):R.length>0?R.map(he=>i.jsx(mC,{featureId:e.id,featureNum:e.number,phaseId:a.id,phaseNum:a.number,task:he},he.id)):i.jsx(Gt,{className:"p-4 text-sm text-[var(--text-muted)]",children:"No tasks match the current filters."})})]}),i.jsx(ji,{})]})}async function xC({params:e}){const{featureId:a,phaseId:r,taskId:s}=e;if(!a||!r||!s)throw new Response("featureId, phaseId and taskId required",{status:400});const[u,c,d,h,p]=await Promise.all([ac(a),vd(r),yd(s),Gm(),Xm()]),g=d.status!=="done"&&d.status!=="canceled"&&d.status!=="rejected"&&(!!d.pauseSnapshot||h.workDeviations.some(v=>v.resumeTaskId===d.id&&(v.state==="resume-required"||v.state==="resolved")));return{feature:u,phase:c,task:d,pendingResume:g,descriptionFreshness:p}}function vC({snapshot:e,pendingResume:a=!1}){const r=x.useId(),s=a?N0:Vm;return i.jsxs("section",{"aria-labelledby":r,"aria-live":a?"polite":void 0,className:`rounded-[14px] border px-4 py-3 ${a?"border-[var(--accent)] bg-[var(--accent-soft)]":"border-[var(--border)] bg-[var(--surface-elevated)]"}`,children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(s,{className:"h-4 w-4 shrink-0 text-[var(--accent)]","aria-hidden":"true"}),i.jsx("h3",{id:r,className:"text-sm font-bold text-[var(--text)]",children:"Resume checkpoint"}),i.jsx("span",{className:"ml-auto text-[10px] font-semibold uppercase tracking-[0.14em] text-[var(--text-subtle)]",children:cl(e.pausedAt)})]}),i.jsxs("dl",{className:"mt-3 grid gap-3 sm:grid-cols-2",children:[i.jsxs("div",{children:[i.jsx("dt",{className:"text-[10px] font-semibold uppercase tracking-[0.16em] text-[var(--text-subtle)]",children:"Checkpoint reason"}),i.jsx("dd",{className:"mt-1 text-sm text-[var(--text-muted)] [overflow-wrap:anywhere]",children:e.reason})]}),i.jsxs("div",{children:[i.jsx("dt",{className:"text-[10px] font-semibold uppercase tracking-[0.16em] text-[var(--text-subtle)]",children:"Work checkpoint"}),i.jsx("dd",{className:"mt-1 text-sm text-[var(--text-muted)] [overflow-wrap:anywhere]",children:e.whatWasBeingDone})]}),i.jsxs("div",{children:[i.jsx("dt",{className:"text-[10px] font-semibold uppercase tracking-[0.16em] text-[var(--text-subtle)]",children:"Resume from"}),i.jsx("dd",{className:"mt-1 font-mono text-xs text-[var(--text)] [overflow-wrap:anywhere]",children:e.resumeLocation})]}),i.jsxs("div",{children:[i.jsx("dt",{className:"text-[10px] font-semibold uppercase tracking-[0.16em] text-[var(--text-subtle)]",children:"How to resume"}),i.jsx("dd",{className:"mt-1 text-sm text-[var(--text-muted)] [overflow-wrap:anywhere]",children:e.howToResume})]})]})]})}function yC({featureId:e,phaseId:a,taskId:r,item:s}){const u=Fl(),c=u.formData?u.formData.get("checked")==="true":s.checked,d=u.state!=="idle";return i.jsxs("div",{className:"surface-card flex items-start gap-3 px-4 py-3",children:[i.jsx("input",{type:"checkbox",checked:c,onChange:()=>u.submit({checked:s.checked?"false":"true"},{method:"post",action:`/features/${e}/phases/${a}/tasks/${r}/checklist/${s.id}/toggle`}),disabled:d,className:"mt-0.5 h-4 w-4 shrink-0 accent-[var(--accent)]","aria-label":`Toggle checklist item ${s.title}`}),i.jsxs("div",{className:"min-w-0",children:[i.jsx("span",{className:"checklist-num",children:s.number})," ",i.jsx("span",{className:`text-sm ${c?"text-[var(--text-muted)] line-through":"font-medium text-[var(--text)]"}`,children:s.title})]})]})}function bC(){var N,w,j,R,M;const{feature:e,phase:a,task:r,pendingResume:s,descriptionFreshness:u}=xr(),c=r.status==="planned"||r.status==="waiting",d=r.decisions??[],h=r.acceptedDecisions??[],p=r.checklist??[],g=_r(),v=x.useRef(null),y=x.useCallback(()=>g("edit"),[g]),S=x.useCallback(()=>{var $;($=v.current)==null||$.requestSubmit()},[]);return _n("edit",y),_n("delete",S),i.jsxs("div",{className:"grid gap-8",children:[i.jsxs(Ve,{to:`/features/${e.id}/phases/${a.id}`,className:"inline-flex items-center gap-2 text-sm font-semibold text-[var(--accent)] hover:underline",children:[i.jsx(hd,{className:"h-4 w-4"})," Back to phase"]}),i.jsxs("div",{className:"min-w-0",children:[i.jsx(yp,{stacked:!0,items:[{label:e.name,to:`/features/${e.id}`,kind:"Feature"},{label:a.title,to:`/features/${e.id}/phases/${a.id}`,kind:"Phase"},{label:r.title,kind:"Task"}]}),i.jsx("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:i.jsx(bp,{featureNum:e.number,phaseNum:a.number,taskNum:r.number,featureId:e.id,phaseId:a.id,taskId:r.id,shortId:r.shortId,children:i.jsx(hr,{status:r.status})})}),i.jsx("h2",{className:"mt-2 text-2xl font-black tracking-tight text-[var(--text)] min-w-0 break-words [overflow-wrap:anywhere] sm:text-3xl",children:r.title}),i.jsxs("div",{className:"mt-4 flex flex-wrap items-center gap-2",children:[c?i.jsx(un,{method:"post",action:`/features/${e.id}/phases/${a.id}/tasks/${r.id}/start`,className:"inline-flex",children:i.jsx(Ke,{type:"submit",variant:"primary",children:r.pauseSnapshot||s?"Resume task":"Start task"})}):null,r.status==="done"?i.jsx(un,{method:"post",action:`/features/${e.id}/phases/${a.id}/tasks/${r.id}/reopen`,className:"inline-flex",onSubmit:$=>{window.confirm(`Reopen task “${r.title}”? Its completion history will be retained.`)||$.preventDefault()},children:i.jsx(Ke,{type:"submit",variant:"primary",children:"Reopen task"})}):null,i.jsx(Ve,{to:"edit",children:i.jsx(Ke,{type:"button",shortcut:"edit",children:"Edit task"})}),i.jsx(un,{ref:v,method:"post",action:`/features/${e.id}/phases/${a.id}/tasks/${r.id}/delete`,className:"inline-flex",onSubmit:$=>{window.confirm(`Delete task "${r.title}"?`)||$.preventDefault()},children:i.jsx(Ke,{type:"submit",variant:"danger",shortcut:"delete",children:"Delete task"})})]})]}),i.jsx(wp,{freshness:u,ownerIds:[a.id,e.id]}),i.jsx(Sp,{statusLog:r.statusLog??[],currentStatus:r.status,backbone:["planned","in-progress","done"],createdAt:r.createdAt,updatedAt:r.updatedAt,startedAt:r.startedAt,completedAt:r.completedAt}),r.pauseSnapshot?i.jsx(vC,{snapshot:r.pauseSnapshot,pendingResume:s}):null,i.jsxs(Gt,{className:"grid gap-4",children:[r.description?i.jsx(qn,{title:i.jsxs(i.Fragment,{children:[i.jsx("span",{children:"Description"}),i.jsx(fl,{value:r.descriptionUpdatedAt})]}),children:i.jsx(Nn,{text:r.description,className:"plan-description"})}):null,r.notes?i.jsx(qn,{title:"Notes",defaultOpen:!1,children:i.jsx(Nn,{text:r.notes})}):null,i.jsx(Np,{statusLog:r.statusLog??[],currentStatus:r.status,backbone:["planned","in-progress","done"],startedAt:r.startedAt,completedAt:r.completedAt}),d.length>0?i.jsx(qn,{title:"Decisions",count:d.length,defaultOpen:!1,children:i.jsx("div",{className:"grid gap-2 border-l-2 border-[var(--border)] pl-4 ml-1",children:d.map(($,B)=>i.jsx("div",{className:"text-sm text-[var(--text-muted)]",children:i.jsx(Nn,{text:$})},B))})}):null,i.jsx(bd,{decisions:h,targetType:"task",targetRef:r.id}),i.jsxs("div",{className:"grid gap-4 md:grid-cols-2 xl:grid-cols-5",children:[i.jsxs(In,{children:[i.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.22em] text-[var(--text-subtle)]",children:"Checklist items"}),i.jsx("p",{className:"mt-2 text-3xl font-black text-[var(--text)]",children:p.length})]}),i.jsxs(In,{children:[i.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.22em] text-[var(--text-subtle)]",children:"Subtasks"}),i.jsx("p",{className:"mt-2 text-3xl font-black text-[var(--text)]",children:((N=r.subtasks)==null?void 0:N.length)??0})]})]}),i.jsx(ep,{items:[{label:"Entity last updated",value:cl(r.updatedAt),visible:!!r.updatedAt},{label:"Priority",value:wd(r.priority),visible:r.priority>0},{label:"Short name",value:r.shortName,visible:!!r.shortName},{label:"Started",value:cl(r.startedAt),visible:!!r.startedAt},{label:"Completed",value:cl(r.completedAt),visible:!!r.completedAt},{label:"Phase",value:a.title}]}),i.jsxs("div",{className:"grid gap-3",children:[i.jsx("div",{children:i.jsxs("h3",{className:"text-sm font-bold text-[var(--text)]",children:["Steps (",p.length,")"]})}),p.length?i.jsx("div",{className:"grid gap-2",children:p.map($=>i.jsx(yC,{featureId:e.id,phaseId:a.id,taskId:r.id,item:$},$.id))}):i.jsx("p",{className:"text-sm text-[var(--text-muted)] italic",children:"No steps defined."})]}),i.jsxs(qn,{title:"Dependencies",count:((w=r.dependsOn)==null?void 0:w.length)??0,defaultOpen:!1,contentClassName:"grid gap-2",children:[(j=r.dependsOn)==null?void 0:j.map($=>i.jsx("p",{className:"surface-card px-4 py-3 text-sm font-mono text-[var(--text)]",children:$},$)),i.jsxs(un,{method:"post",action:"dependencies/add",className:"flex gap-2 rounded-xl border border-dashed border-[var(--border-strong)] p-3",children:[i.jsx("input",{name:"dependsOn",required:!0,placeholder:"Task ref or ID","aria-label":"Dependency task",className:"h-9 min-w-0 flex-1 rounded-lg border border-[var(--border-strong)] bg-[var(--surface)] px-3 text-sm text-[var(--text)]"}),i.jsx(Ke,{type:"submit",className:"h-9",children:"Add dependency"})]})]}),i.jsxs(qn,{title:"Subtasks",count:((R=r.subtasks)==null?void 0:R.length)??0,defaultOpen:!1,contentClassName:"grid gap-2",children:[(M=r.subtasks)==null?void 0:M.map($=>i.jsxs("div",{className:"surface-card flex items-center justify-between gap-4 px-4 py-3",children:[i.jsxs("div",{className:"min-w-0",children:[i.jsx("p",{className:"text-sm font-semibold text-[var(--text)]",children:$.title}),i.jsx("p",{className:"mt-1 text-xs text-[var(--text-muted)]",children:$.description||$.id})]}),i.jsx(hr,{status:$.status})]},$.id)),i.jsxs(un,{method:"post",action:"subtasks/new",className:"grid gap-2 rounded-xl border border-dashed border-[var(--border-strong)] p-3 sm:grid-cols-[1fr_1fr_auto]",children:[i.jsx("input",{name:"title",required:!0,placeholder:"New subtask title","aria-label":"New subtask title",className:"h-9 rounded-lg border border-[var(--border-strong)] bg-[var(--surface)] px-3 text-sm text-[var(--text)]"}),i.jsx("input",{name:"description",placeholder:"Description (optional)","aria-label":"New subtask description",className:"h-9 rounded-lg border border-[var(--border-strong)] bg-[var(--surface)] px-3 text-sm text-[var(--text)]"}),i.jsx(Ke,{type:"submit",className:"h-9",children:"Add subtask"})]})]})]}),i.jsx(ji,{})]})}const wC=["a[href]","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])","[tabindex]:not([tabindex='-1'])"].join(",");function Kl({title:e,description:a,children:r}){const s=_r(),u=x.useRef(null),c=x.useRef(null);return x.useEffect(()=>{var g;const d=u.current;if(!d)return;const h=document.activeElement;(g=c.current)==null||g.focus();const p=v=>{if(v.key==="Escape"){v.preventDefault(),s(-1);return}if(v.key!=="Tab")return;const y=Array.from(d.querySelectorAll(wC)).filter(j=>j.offsetParent!==null);if(y.length===0){v.preventDefault(),d.focus();return}const S=y[0],N=y[y.length-1],w=document.activeElement;v.shiftKey?(w===S||!d.contains(w))&&(v.preventDefault(),N.focus()):w===N&&(v.preventDefault(),S.focus())};return window.addEventListener("keydown",p),()=>{var v;window.removeEventListener("keydown",p),(v=h==null?void 0:h.focus)==null||v.call(h)}},[s]),i.jsxs("div",{className:"fixed inset-0 z-50 overflow-y-auto p-4 md:p-6",children:[i.jsx("button",{type:"button",className:"absolute inset-0 bg-black/50 backdrop-blur-sm",onClick:()=>s(-1),"aria-hidden":"true",tabIndex:-1}),i.jsx("div",{className:"relative z-10 flex min-h-full items-start justify-center",children:i.jsxs("div",{ref:u,role:"dialog","aria-modal":"true","aria-label":e,tabIndex:-1,className:"surface-panel flex max-h-[calc(100vh-2rem)] w-full max-w-2xl flex-col overflow-hidden p-6 outline-none md:max-h-[calc(100vh-3rem)] md:p-8",children:[i.jsxs("div",{className:"mb-6 flex shrink-0 items-start justify-between gap-4",children:[i.jsxs("div",{children:[i.jsx("h3",{className:"text-xl font-black tracking-tight text-[var(--text)]",children:e}),a?i.jsx("p",{className:"mt-2 text-sm text-[var(--text-muted)]",children:a}):null]}),i.jsx("button",{ref:c,type:"button",onClick:()=>s(-1),className:"inline-flex h-10 w-10 shrink-0 items-center justify-center rounded-[14px] border border-[var(--border-strong)] text-[var(--text-muted)] transition hover:text-[var(--text)]","aria-label":"Close modal",children:i.jsx(j0,{className:"h-4 w-4"})})]}),i.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto pr-1",children:r})]})})]})}function Zl({className:e="",children:a,...r}){return i.jsx("div",{className:`sticky bottom-0 mt-2 flex justify-end gap-3 border-t border-[var(--border)] bg-[var(--surface)] px-1 pt-4 pb-1 backdrop-blur-xl ${e}`,...r,children:a})}function Xe({label:e,children:a}){return i.jsxs("label",{className:"grid gap-2",children:[i.jsx("span",{className:"text-sm font-semibold text-[var(--text-muted)]",children:e}),a]})}function Zt(e){return i.jsx("textarea",{className:"field-control field-textarea",...e})}function SC(){const a=gr().state!=="idle",r=x.useRef(null),s=x.useCallback(()=>{var u;return(u=r.current)==null?void 0:u.requestSubmit()},[]);return _n("submit",s,{allowInEditable:!0}),i.jsx(Kl,{title:"Create feature",description:"Top-level container for phases and tasks.",children:i.jsxs(un,{ref:r,method:"post",className:"grid gap-4",children:[i.jsx(Xe,{label:"Feature name",children:i.jsx(Mn,{name:"name",placeholder:"Products page implementation",required:!0})}),i.jsx(Xe,{label:"Description",children:i.jsx(Zt,{name:"description",placeholder:"Short context for the feature"})}),i.jsx(Zl,{children:i.jsx(Ke,{type:"submit",variant:"primary",disabled:a,shortcut:"submit",children:a?"Creating…":"Create feature"})})]})})}function NC(){const a=gr().state!=="idle",r=x.useRef(null),s=x.useCallback(()=>{var d;return(d=r.current)==null?void 0:d.requestSubmit()},[]);_n("submit",s,{allowInEditable:!0});const c=Ts("feature-detail").feature;return i.jsx(Kl,{title:"Edit feature",description:"Update metadata, planning notes and timeline.",children:i.jsxs(un,{ref:r,method:"post",className:"grid gap-4",children:[i.jsx(Xe,{label:"Name",children:i.jsx(Mn,{name:"name",defaultValue:c.name,required:!0})}),i.jsx(Xe,{label:"Description",children:i.jsx(Zt,{name:"description",defaultValue:c.description})}),i.jsx(Xe,{label:"Description reference",children:i.jsx(Mn,{name:"descriptionRef",defaultValue:c.descriptionRef??"",placeholder:".planner/docs/features/feature-details.md"})}),i.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[i.jsx(Xe,{label:"Start date",children:i.jsx(Mn,{type:"date",name:"startDate",defaultValue:c.startDate})}),i.jsx(Xe,{label:"End date",children:i.jsx(Mn,{type:"date",name:"endDate",defaultValue:c.endDate})})]}),i.jsx(Xe,{label:"Status",children:i.jsx(Gl,{name:"status",defaultValue:c.status,disabled:!0,title:"Feature status is derived from child phases and tasks.",children:Td.map(d=>i.jsx("option",{value:d.value,children:d.label},d.value))})}),i.jsx(Xe,{label:"Priority",children:i.jsx(Mn,{type:"number",name:"priority",defaultValue:c.priority??0,min:0})}),i.jsx(qn,{title:"Planning notes",subtitle:"Optional agent-maintained notes for progress tracking.",defaultOpen:!1,className:"mt-0",children:i.jsxs("div",{className:"grid gap-4",children:[i.jsx(Xe,{label:"Work done",children:i.jsx(Zt,{name:"workDone",defaultValue:c.workDone})}),i.jsx(Xe,{label:"Work remaining",children:i.jsx(Zt,{name:"workRemaining",defaultValue:c.workRemaining})})]})}),i.jsx(Zl,{children:i.jsx(Ke,{type:"submit",variant:"primary",disabled:a,shortcut:"submit",children:a?"Saving…":"Save feature"})})]})})}function EC(){const a=gr().state!=="idle",r=x.useRef(null),s=x.useCallback(()=>{var u;return(u=r.current)==null?void 0:u.requestSubmit()},[]);return _n("submit",s,{allowInEditable:!0}),i.jsx(Kl,{title:"Create phase",description:"A phase belongs to the current feature.",children:i.jsxs(un,{ref:r,method:"post",className:"grid gap-4",children:[i.jsx(Xe,{label:"Phase title",children:i.jsx(Mn,{name:"title",placeholder:"API creation",required:!0})}),i.jsx(Xe,{label:"Summary",children:i.jsx(Zt,{name:"summary",placeholder:"Brief phase summary"})}),i.jsx(Xe,{label:"Description",children:i.jsx(Zt,{name:"description",placeholder:"Initial implementation notes"})}),i.jsx(Zl,{children:i.jsx(Ke,{type:"submit",variant:"primary",disabled:a,shortcut:"submit",children:a?"Creating…":"Create phase"})})]})})}function bs(e){return e.join(`
324
- `)}function jC(){const a=gr().state!=="idle",r=x.useRef(null),s=x.useCallback(()=>{var d;return(d=r.current)==null?void 0:d.requestSubmit()},[]);_n("submit",s,{allowInEditable:!0});const u=Ts("phase-detail"),c=u.phase;return i.jsx(Kl,{title:"Edit phase",description:"Update scope, constraints and delivery criteria.",children:i.jsxs(un,{ref:r,method:"post",className:"grid gap-4",children:[i.jsx(Xe,{label:"Title",children:i.jsx(Mn,{name:"title",defaultValue:c.title,required:!0})}),i.jsx(Xe,{label:"Status",children:i.jsx(Gl,{name:"status",defaultValue:c.status,disabled:!0,title:"Phase status is derived from child tasks.",children:Ad.map(d=>i.jsx("option",{value:d.value,children:d.label},d.value))})}),i.jsx(Xe,{label:"Feature",children:i.jsx(Gl,{name:"featureId",defaultValue:c.featureId??u.feature.id,required:!0,children:u.features.map(d=>i.jsxs("option",{value:d.id,children:["F",String(d.number).padStart(3,"0")," — ",d.name]},d.id))})}),i.jsx(Xe,{label:"Priority",children:i.jsx(Mn,{type:"number",name:"priority",defaultValue:c.priority??0,min:0})}),i.jsx(Xe,{label:"Summary",children:i.jsx(Zt,{name:"summary",defaultValue:c.summary})}),i.jsx(Xe,{label:"Description",children:i.jsx(Zt,{name:"description",defaultValue:c.description})}),i.jsx(Xe,{label:"Description reference",children:i.jsx(Mn,{name:"descriptionRef",defaultValue:c.descriptionRef??"",placeholder:".planner/docs/phases/phase-details.md"})}),i.jsx(Xe,{label:"Goals (one per line)",children:i.jsx(Zt,{name:"goals",defaultValue:bs(c.goals)})}),i.jsx(Xe,{label:"Non-goals (one per line)",children:i.jsx(Zt,{name:"nonGoals",defaultValue:bs(c.nonGoals)})}),i.jsx(Xe,{label:"Dependencies (one per line)",children:i.jsx(Zt,{name:"dependencies",defaultValue:bs(c.dependencies)})}),i.jsx(Xe,{label:"Risks (one per line)",children:i.jsx(Zt,{name:"risks",defaultValue:bs(c.risks)})}),i.jsx(Xe,{label:"Open questions (one per line)",children:i.jsx(Zt,{name:"openQuestions",defaultValue:bs(c.openQuestions)})}),i.jsx(Xe,{label:"Decisions (one per line)",children:i.jsx(Zt,{name:"decisions",defaultValue:bs(c.decisions)})}),i.jsx(Xe,{label:"Completion criteria (one per line)",children:i.jsx(Zt,{name:"completionCriteria",defaultValue:bs(c.completionCriteria)})}),i.jsx(Zl,{children:i.jsx(Ke,{type:"submit",variant:"primary",disabled:a,shortcut:"submit",children:a?"Saving…":"Save phase"})})]})})}function RC(){const a=gr().state!=="idle",r=x.useRef(null),s=x.useCallback(()=>{var u;return(u=r.current)==null?void 0:u.requestSubmit()},[]);return _n("submit",s,{allowInEditable:!0}),i.jsx(Kl,{title:"Create task",description:"A task belongs to the current phase.",children:i.jsxs(un,{ref:r,method:"post",className:"grid gap-4",children:[i.jsx(Xe,{label:"Task title",children:i.jsx(Mn,{name:"title",placeholder:"Custom fetcher integration",required:!0})}),i.jsx(Xe,{label:"Description",children:i.jsx(Zt,{name:"description",placeholder:"Initial task context"})}),i.jsx(Xe,{label:"Checklist (one per line)",children:i.jsx(Zt,{name:"checklist",placeholder:`Step one
325
- Step two
326
- Step three`})}),i.jsx(Xe,{label:"Status",children:i.jsx(Gl,{name:"status",defaultValue:"planned",children:rd.map(u=>i.jsx("option",{value:u.value,children:u.label},u.value))})}),i.jsx(Zl,{children:i.jsx(Ke,{type:"submit",variant:"primary",disabled:a,shortcut:"submit",children:a?"Creating…":"Create task"})})]})})}function kC(e){return e.map(a=>a.title).join(`
327
- `)}function TC(e){return e.join(`
328
- `)}function AC(){const a=gr().state!=="idle",r=x.useRef(null),s=x.useCallback(()=>{var h;return(h=r.current)==null?void 0:h.requestSubmit()},[]);_n("submit",s,{allowInEditable:!0});const c=Ts("task-detail").task,d=c.status==="in-progress"?rd:rd.filter(h=>h.value!=="in-progress");return i.jsx(Kl,{title:"Edit task",description:"Update execution details and checklist items.",children:i.jsxs(un,{ref:r,method:"post",className:"grid gap-4",children:[i.jsx(Xe,{label:"Title",children:i.jsx(Mn,{name:"title",defaultValue:c.title,required:!0})}),i.jsx(Xe,{label:"Status",children:i.jsx(Gl,{name:"status",defaultValue:c.status,disabled:!!c.pauseSnapshot,title:c.pauseSnapshot?"Resume checkpointed work through task_start so its checkpoint is preserved.":void 0,children:d.map(h=>i.jsx("option",{value:h.value,children:h.label},h.value))})}),i.jsx(Xe,{label:"Priority",children:i.jsx(Mn,{type:"number",name:"priority",defaultValue:c.priority??0,min:0})}),i.jsx(Xe,{label:"Description",children:i.jsx(Zt,{name:"description",defaultValue:c.description})}),i.jsx(Xe,{label:"Description reference",children:i.jsx(Mn,{name:"descriptionRef",defaultValue:c.descriptionRef??"",placeholder:".planner/docs/tasks/task-details.md"})}),i.jsx(Xe,{label:"Implementation notes",children:i.jsx(Zt,{name:"notes",defaultValue:c.notes})}),i.jsx(Xe,{label:"Decisions (one per line)",children:i.jsx(Zt,{name:"decisions",defaultValue:TC(c.decisions)})}),i.jsx(Xe,{label:"Status change motivation",children:i.jsx(Zt,{name:"motivation",placeholder:"Required for blocked, canceled, rejected, deferred, waiting, or reopening to planned."})}),i.jsx(Xe,{label:"Checklist (one per line)",children:i.jsx(Zt,{name:"checklist",defaultValue:kC(c.checklist)})}),i.jsx(Zl,{children:i.jsx(Ke,{type:"submit",variant:"primary",disabled:a,shortcut:"submit",children:a?"Saving…":"Save task"})})]})})}function DC(){const a=gr().state!=="idle",r=x.useRef(null),s=x.useCallback(()=>{var c;return(c=r.current)==null?void 0:c.requestSubmit()},[]);_n("submit",s,{allowInEditable:!0});const{project:u}=Ts("root");return i.jsxs("div",{className:"grid gap-8",children:[i.jsxs(Ve,{to:"/",className:"inline-flex items-center gap-2 text-sm font-semibold text-[var(--accent)] hover:underline",children:[i.jsx(hd,{className:"h-4 w-4"})," Back to dashboard"]}),i.jsxs(Gt,{className:"grid gap-5",children:[i.jsxs("div",{children:[i.jsx("h2",{className:"text-xl font-black tracking-tight text-[var(--text)]",children:"Edit project context"}),i.jsx("p",{className:"mt-2 text-sm text-[var(--text-muted)]",children:"Update human-authored overview and Project Guidelines content. Freshness and agent read attestations remain planner-managed."})]}),i.jsxs(un,{ref:r,method:"post",className:"grid gap-4",children:[i.jsx(Xe,{label:"Project name",children:i.jsx(Mn,{name:"name",defaultValue:u.name,placeholder:"Project name",required:!0})}),i.jsx(Xe,{label:"Short description",children:i.jsx(Zt,{name:"description",defaultValue:u.description,placeholder:"Summarize the project in a few lines for the dashboard overview"})}),i.jsx(Xe,{label:"Project goal",children:i.jsx(Zt,{name:"goal",defaultValue:u.goal,placeholder:"Define the main objective, success criteria, and overall direction of the project"})}),i.jsx(Xe,{label:"Project Guidelines",children:i.jsx(Zt,{name:"projectGuidelines",defaultValue:u.projectGuidelines.content,placeholder:"Coding standards, formatting, styling, and verification rules agents must follow"})}),i.jsxs("div",{className:"flex justify-end gap-3",children:[i.jsx(Ve,{to:"/",children:i.jsx(Ke,{type:"button",variant:"ghost",children:"Cancel"})}),i.jsx(Ke,{type:"submit",variant:"primary",disabled:a,shortcut:"submit",children:a?"Saving…":"Save project context"})]})]})]})]})}function CC(e){return`P${String(e.number??0).padStart(3,"0")}`}function $w({phases:e,selectedIds:a=[]}){const r=new Set(a);return i.jsx(Xe,{label:"Linked phases",children:e.length===0?i.jsx("div",{className:"rounded-[14px] border border-dashed border-[var(--border)] bg-[var(--surface-elevated)] px-4 py-3 text-sm text-[var(--text-muted)]",children:"No phases available yet. Create phases first if you want to link this requirement to delivery work."}):i.jsxs("div",{className:"grid gap-2 rounded-[16px] border border-[var(--border)] bg-[var(--surface-elevated)] p-3",children:[i.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"Select the phases that directly implement or track this requirement."}),i.jsx("div",{className:"grid gap-2 max-h-[32dvh] overflow-y-auto pr-1",children:e.map(s=>i.jsxs("label",{className:"flex items-start gap-3 rounded-[12px] border border-[var(--border)] bg-[var(--surface-card)] px-3 py-2 text-sm text-[var(--text)] transition hover:border-[var(--accent)] hover:bg-[var(--accent-soft)]",children:[i.jsx("input",{type:"checkbox",name:"linkedPhaseIds",value:s.id,defaultChecked:r.has(s.id),className:"mt-0.5 h-4 w-4 shrink-0 accent-[var(--accent)]"}),i.jsxs("span",{className:"min-w-0",children:[i.jsxs("span",{className:"block font-semibold",children:[CC(s)," — ",s.title]}),s.summary?i.jsx("span",{className:"mt-0.5 block text-xs text-[var(--text-muted)]",children:s.summary}):null]})]},s.id))})]})})}function OC(e,a){return{...e,key:e.id??`new-${a}`}}function MC(e){return{key:`new-${e}`,title:"",description:"",status:"planned"}}function Uw({initialTasks:e}){const[a,r]=x.useState(()=>e.map(OC)),s=a.map(({key:p,...g})=>g);function u(p,g){r(v=>v.map((y,S)=>S===p?{...y,...g}:y))}function c(p,g){r(v=>{const y=p+g;if(y<0||y>=v.length)return v;const S=[...v];return[S[p],S[y]]=[S[y],S[p]],S})}function d(p){r(g=>g.filter((v,y)=>y!==p))}function h(){r(p=>[...p,MC(p.length)])}return i.jsxs("fieldset",{className:"grid gap-3 rounded-[14px] border border-[var(--border)] bg-[var(--surface-elevated)] p-4",children:[i.jsx("legend",{className:"px-1 text-sm font-semibold text-[var(--text-muted)]",children:"Macro tasks"}),i.jsx("input",{type:"hidden",name:"macroTasks",value:JSON.stringify(s)}),i.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:"Define the nested outcomes this requirement owns. Their identifiers and timestamps are assigned by the planner."}),a.length===0?i.jsx("p",{className:"text-sm text-[var(--text-subtle)]",children:"No macro tasks yet."}):null,i.jsx("div",{className:"grid gap-4",children:a.map((p,g)=>i.jsxs("fieldset",{className:"grid gap-3 rounded-[12px] border border-[var(--border)] bg-[var(--surface-card)] p-3",children:[i.jsxs("legend",{className:"px-1 text-sm font-semibold text-[var(--text)]",children:["Macro task ",g+1]}),i.jsxs("label",{className:"grid gap-2 text-sm font-semibold text-[var(--text-muted)]",children:[i.jsx("span",{children:"Title"}),i.jsx(Mn,{"aria-label":`Macro task ${g+1} title`,value:p.title,onChange:v=>u(g,{title:v.target.value}),required:!0})]}),i.jsxs("label",{className:"grid gap-2 text-sm font-semibold text-[var(--text-muted)]",children:[i.jsx("span",{children:"Description"}),i.jsx(Zt,{"aria-label":`Macro task ${g+1} description`,value:p.description,onChange:v=>u(g,{description:v.target.value})})]}),i.jsxs("label",{className:"grid gap-2 text-sm font-semibold text-[var(--text-muted)]",children:[i.jsx("span",{children:"Status"}),i.jsx(Gl,{"aria-label":`Macro task ${g+1} status`,value:p.status,onChange:v=>u(g,{status:v.target.value}),children:pA.map(v=>i.jsx("option",{value:v.value,children:v.label},v.value))})]}),i.jsxs("div",{className:"flex flex-wrap justify-end gap-2",children:[i.jsx(Ke,{type:"button",variant:"ghost",onClick:()=>c(g,-1),disabled:g===0,"aria-label":`Move macro task ${g+1} up`,children:"Move up"}),i.jsx(Ke,{type:"button",variant:"ghost",onClick:()=>c(g,1),disabled:g===a.length-1,"aria-label":`Move macro task ${g+1} down`,children:"Move down"}),i.jsx(Ke,{type:"button",variant:"danger",onClick:()=>d(g),"aria-label":`Remove macro task ${g+1}`,children:"Remove"})]})]},p.key))}),i.jsx("div",{children:i.jsx(Ke,{type:"button",onClick:h,children:"Add macro task"})})]})}function _C(){const a=gr().state!=="idle",r=x.useRef(null),s=x.useCallback(()=>{var c;return(c=r.current)==null?void 0:c.requestSubmit()},[]);_n("submit",s,{allowInEditable:!0});const{phases:u}=Ts("requirements");return i.jsx(Kl,{title:"Create requirement",description:"Capture a user, business, or system outcome. Coding standards and process rules belong in Project Guidelines.",children:i.jsxs(un,{ref:r,method:"post",className:"grid gap-4",children:[i.jsx(Xe,{label:"Requirement title",children:i.jsx(Mn,{name:"title",placeholder:"Self-hosted Claude Code plugin marketplace distribution",required:!0})}),i.jsx(Xe,{label:"Description",children:i.jsx(Zt,{name:"description",placeholder:"Describe the user/business outcome this requirement represents"})}),i.jsx(Uw,{initialTasks:[]}),i.jsx($w,{phases:u}),i.jsx(Zl,{children:i.jsx(Ke,{type:"submit",variant:"primary",disabled:a,shortcut:"submit",children:a?"Creating…":"Create requirement"})})]})})}function LC(){const a=gr().state!=="idle",r=x.useRef(null),s=x.useCallback(()=>{var p;return(p=r.current)==null?void 0:p.requestSubmit()},[]);_n("submit",s,{allowInEditable:!0});const{requirementId:u}=WN(),{phases:c,requirements:d}=Ts("requirements"),h=d.find(p=>p.id===u);return h?i.jsx(Kl,{title:"Edit requirement",description:"Update the product outcome and linked delivery phases. Coding standards and process rules belong in Project Guidelines.",children:i.jsxs(un,{ref:r,method:"post",className:"grid gap-4",children:[i.jsx(Xe,{label:"Requirement title",children:i.jsx(Mn,{name:"title",defaultValue:h.title,required:!0})}),i.jsx(Xe,{label:"Description",children:i.jsx(Zt,{name:"description",defaultValue:h.description})}),i.jsx(Uw,{initialTasks:h.macroTasks}),i.jsx($w,{phases:c,selectedIds:h.linkedPhaseIds}),i.jsx(Zl,{children:i.jsx(Ke,{type:"submit",variant:"primary",disabled:a,shortcut:"submit",children:a?"Saving…":"Save requirement"})})]})}):null}function Pn(e,a){const r=e.get(a);if(typeof r!="string"||r.trim()==="")throw new Response(`Missing field: ${a}`,{status:400});return r.trim()}function Tt(e,a){const r=e.get(a);return typeof r=="string"?r.trim():""}function Ep(e,a){const r=e.get(a);if(typeof r!="string")return 0;const s=r.trim();if(s==="")return 0;const u=Number(s);return Number.isFinite(u)?u:0}function Dr(e,a){return Tt(e,a).split(`
329
- `).map(r=>r.trim()).filter(Boolean)}function Bw(e){const a=Tt(e,"macroTasks");if(!a)return[];let r;try{r=JSON.parse(a)}catch{throw new Response("Macro tasks must be valid form data.",{status:400})}if(!Array.isArray(r))throw new Response("Macro tasks must be a list.",{status:400});return r.map((s,u)=>{if(!s||typeof s!="object")throw new Response(`Macro task ${u+1} is invalid.`,{status:400});const c=s,d=typeof c.title=="string"?c.title.trim():"",h=typeof c.status=="string"?c.status.trim():"";if(!d)throw new Response(`Macro task ${u+1} requires a title.`,{status:400});if(!h)throw new Response(`Macro task ${u+1} requires a status.`,{status:400});const p=typeof c.id=="string"&&c.id.trim()?c.id.trim():void 0;return{...p?{id:p}:{},title:d,description:typeof c.description=="string"?c.description.trim():"",status:h}})}function yt(e,a){const r=e[a];if(!r)throw new Response(`Missing route param: ${a}`,{status:400});return r}async function zC({request:e}){const a=await e.formData();return await OR({name:Pn(a,"name"),description:Tt(a,"description")}),En("/features")}async function $C({request:e,params:a}){const r=yt(a,"featureId"),s=await ac(r),u=await e.formData();return await k0({id:s.id,updatedAt:s.updatedAt,name:Pn(u,"name"),description:Tt(u,"description"),descriptionRef:Tt(u,"descriptionRef"),startDate:Tt(u,"startDate"),endDate:Tt(u,"endDate"),priority:Ep(u,"priority"),workDone:Tt(u,"workDone"),workRemaining:Tt(u,"workRemaining")}),En(`/features/${r}`)}async function UC({params:e}){return await MR(yt(e,"featureId")),En("/features")}async function BC({request:e,params:a}){const r=yt(a,"featureId"),s=await ac(r),u=await e.formData();return await k0({id:s.id,updatedAt:s.updatedAt,status:Pn(u,"status")}),null}async function IC({request:e,params:a}){const r=yt(a,"featureId"),s=await e.formData();return await HR({featureId:r,title:Pn(s,"title"),summary:Tt(s,"summary"),description:Tt(s,"description")}),En(`/features/${r}`)}async function HC({request:e,params:a}){const r=yt(a,"featureId"),s=yt(a,"phaseId"),u=await vd(s),c=await e.formData(),d=await T0({id:u.id,updatedAt:u.updatedAt,title:Pn(c,"title"),priority:Ep(c,"priority"),summary:Tt(c,"summary"),description:Tt(c,"description"),descriptionRef:Tt(c,"descriptionRef"),featureId:Pn(c,"featureId"),goals:Dr(c,"goals"),nonGoals:Dr(c,"nonGoals"),dependencies:Dr(c,"dependencies"),risks:Dr(c,"risks"),openQuestions:Dr(c,"openQuestions"),decisions:Dr(c,"decisions"),completionCriteria:Dr(c,"completionCriteria")});return En(`/features/${d.featureId??r}/phases/${s}`)}async function qC({params:e}){const a=yt(e,"featureId"),r=yt(e,"phaseId");return await qR(r),En(`/features/${a}`)}async function PC({request:e,params:a}){const r=yt(a,"phaseId"),s=await vd(r),u=await e.formData();return await T0({...s,status:Pn(u,"status")}),null}async function FC({request:e,params:a}){const r=yt(a,"featureId"),s=yt(a,"phaseId"),u=await e.formData(),c=Dr(u,"checklist");return await PR(s,{title:Pn(u,"title"),description:Tt(u,"description"),status:Tt(u,"status")||"planned",...c.length?{checklist:c}:{}}),En(`/features/${r}/phases/${s}`)}function VC(e,a){const r=new Map(e.map(u=>[u.id,u])),s=new Map(e.map(u=>[u.title.trim().toLowerCase(),u]));return a.map((u,c)=>{var p;const d=u.trim().toLowerCase(),h=r.get(((p=e[c])==null?void 0:p.id)??"")??s.get(d);return h?{...h,number:c+1,title:u.trim()}:{id:`check-${c+1}-${d.replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")||"item"}`,number:c+1,title:u.trim(),checked:!1}})}async function YC({request:e,params:a}){const r=yt(a,"featureId"),s=yt(a,"phaseId"),u=yt(a,"taskId"),c=await yd(u),d=await e.formData(),h=Pn(d,"status");if(h==="in-progress"&&c.status!=="in-progress")throw new Response("Use Start task or Resume task to enter in-progress.",{status:400});return await Zm({id:c.id,updatedAt:c.updatedAt,phaseId:s,title:Pn(d,"title"),status:h,priority:Ep(d,"priority"),description:Tt(d,"description"),descriptionRef:Tt(d,"descriptionRef"),notes:Tt(d,"notes"),decisions:Dr(d,"decisions"),motivation:Tt(d,"motivation"),checklist:VC(c.checklist,Dr(d,"checklist"))}),En(`/features/${r}/phases/${s}/tasks/${u}`)}async function GC({params:e}){const a=yt(e,"featureId"),r=yt(e,"phaseId"),s=yt(e,"taskId");return await XR(s),En(`/features/${a}/phases/${r}`)}async function XC({request:e,params:a}){const r=yt(a,"phaseId"),s=yt(a,"taskId"),u=await yd(s),c=await e.formData();return await Zm({id:u.id,phaseId:r,updatedAt:u.updatedAt,status:Pn(c,"status")}),null}async function QC({params:e}){const a=yt(e,"featureId"),r=yt(e,"phaseId"),s=yt(e,"taskId");return await FR(s),En(`/features/${a}/phases/${r}/tasks/${s}`)}async function KC({params:e}){const a=yt(e,"featureId"),r=yt(e,"phaseId"),s=yt(e,"taskId");return await VR(s),En(`/features/${a}/phases/${r}/tasks/${s}`)}async function ZC({request:e,params:a}){const r=yt(a,"featureId"),s=yt(a,"phaseId"),u=yt(a,"taskId"),c=await e.formData();return await YR(u,s,{title:String(c.get("title")??""),description:String(c.get("description")??"")}),En(`/features/${r}/phases/${s}/tasks/${u}`)}async function WC({request:e,params:a}){const r=yt(a,"featureId"),s=yt(a,"phaseId"),u=yt(a,"taskId"),c=await e.formData();return await GR(u,s,String(c.get("dependsOn")??"")),En(`/features/${r}/phases/${s}/tasks/${u}`)}async function JC({request:e}){const a=await Gm(),r=await e.formData();return await jR({name:Tt(r,"name")||a.name,description:Tt(r,"description"),goal:Tt(r,"goal"),projectGuidelines:{content:Tt(r,"projectGuidelines")},expectedGuidelinesUpdatedAt:a.projectGuidelines.updatedAt}),En("/")}async function eO({request:e}){const a=await e.formData();return await UR({title:Pn(a,"title"),description:Tt(a,"description"),macroTasks:Bw(a),linkedPhaseIds:a.getAll("linkedPhaseIds").filter(r=>typeof r=="string").map(r=>r.trim()).filter(Boolean)}),En("/requirements")}async function tO({request:e,params:a}){const r=yt(a,"requirementId"),s=(await Km()).find(c=>c.id===r);if(!s)throw new Response(`Requirement not found: ${r}`,{status:404});const u=await e.formData();return await BR({id:s.id,updatedAt:s.updatedAt,title:Pn(u,"title"),description:Tt(u,"description"),macroTasks:u.has("macroTasks")?Bw(u):s.macroTasks,linkedPhaseIds:u.getAll("linkedPhaseIds").filter(c=>typeof c=="string").map(c=>c.trim()).filter(Boolean)}),En("/requirements")}async function nO({params:e}){return await IR(yt(e,"requirementId")),En("/requirements")}function aO(e){const a=Pn(e,"targetType");if(a==="project"||a==="feature"||a==="phase"||a==="task")return a;throw new Response(`Unsupported accepted decision target: ${a}`,{status:400})}function cm(e){const a=Tt(e,"returnTo");return a!=null&&a.startsWith("/")?a:"/"}async function rO({request:e}){const a=await e.formData(),r=Pn(a,"intent"),s={targetType:aO(a),targetRef:Tt(a,"targetRef")};if(r==="create")return await RR({...s,title:Pn(a,"title"),decision:Tt(a,"decision")??"",rationale:Tt(a,"rationale")??"",implementationNotes:Tt(a,"implementationNotes")??""}),En(cm(a));const u=Pn(a,"decisionId");if(r==="update")return await kR({...s,id:u,title:Pn(a,"title"),decision:Tt(a,"decision")??"",rationale:Tt(a,"rationale")??"",implementationNotes:Tt(a,"implementationNotes")??""}),En(cm(a));if(r==="delete")return await TR({...s,id:u}),En(cm(a));throw new Response(`Unsupported accepted decision action: ${r}`,{status:400})}function lO(e){if(!e)return"—";try{return new Intl.DateTimeFormat(void 0,{dateStyle:"medium",timeStyle:"short"}).format(new Date(e))}catch{return e}}async function sO(){return{handoffs:await vm()}}function iO(){const{handoffs:e}=xr(),[a,r]=x.useState(e),[s,u]=x.useState(null),[c,d]=x.useState(""),h=Aa();async function p(g){if(!(s||!window.confirm(`Clear handoff for ${g.compositeRef}?`))){u(g.phaseId),d("");try{await A0(g.phaseId),r(y=>y.filter(S=>S.phaseId!==g.phaseId)),vm().then(r).catch(()=>{})}catch(y){const S=y instanceof Response?await y.text().catch(()=>""):y instanceof Error?y.message:String(y);d(S||`Failed to clear handoff for ${g.compositeRef}.`)}finally{u(null)}}}return x.useEffect(()=>{const g=v=>{const y=v.detail;((y==null?void 0:y.type)==="handoffUpdated"||(y==null?void 0:y.type)==="handoffCleared")&&vm().then(r).catch(()=>{})};return window.addEventListener("agent-plan:ws-event",g),()=>window.removeEventListener("agent-plan:ws-event",g)},[]),x.useEffect(()=>{if(!h.hash)return;const g=h.hash.slice(1),v=document.getElementById(g);v&&v.scrollIntoView({behavior:"smooth",block:"start"})},[h.hash,a]),a.length===0?i.jsxs(Gt,{className:"grid gap-4",children:[i.jsxs("div",{children:[i.jsxs("div",{className:"flex flex-wrap items-baseline justify-between gap-2",children:[i.jsx("h1",{className:"text-lg font-bold text-[var(--text)]",children:"Phase handoffs"}),i.jsx(Ve,{to:"/handoff/archive",className:"text-sm text-[var(--accent)] underline-offset-2 hover:underline",children:"View archive →"})]}),i.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:"Pending entity-scoped handoffs on non-completed phases."}),i.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"Handoff preflight supplies the required title and reason before drafting; timestamps and metadata are generated by the planner."})]}),c?i.jsx("p",{className:"rounded-[12px] border border-[var(--danger-soft)] bg-[var(--danger-soft)]/50 px-3 py-2 text-sm text-[var(--color-status-blocked)]",children:c}):null,i.jsx("p",{className:"py-8 text-center text-sm text-[var(--text-muted)]",children:"No pending phase handoffs."})]}):i.jsxs("div",{className:"grid gap-4",children:[i.jsxs("div",{children:[i.jsxs("div",{className:"flex flex-wrap items-baseline justify-between gap-2",children:[i.jsx("h1",{className:"text-lg font-bold text-[var(--text)]",children:"Phase handoffs"}),i.jsx(Ve,{to:"/handoff/archive",className:"text-sm text-[var(--accent)] underline-offset-2 hover:underline",children:"View archive →"})]}),i.jsxs("p",{className:"text-sm text-[var(--text-muted)]",children:["Pending entity-scoped handoffs on non-completed phases. ",a.length," pending."]}),i.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"Handoff preflight supplies the required title and reason before drafting; timestamps and metadata are generated by the planner."})]}),c?i.jsx("p",{className:"rounded-[12px] border border-[var(--danger-soft)] bg-[var(--danger-soft)]/50 px-3 py-2 text-sm text-[var(--color-status-blocked)]",children:c}):null,a.map(g=>i.jsx("section",{id:g.phaseId,className:"scroll-mt-20",children:i.jsx(Gt,{className:"overflow-hidden p-0",children:i.jsx(qn,{defaultOpen:!1,title:i.jsxs(i.Fragment,{children:[i.jsx(lr,{id:g.compositeRef,children:g.compositeRef}),i.jsx("span",{className:"text-xs font-normal text-[var(--text-muted)]",children:g.resumeReady?"Resume-ready":"Verification required"}),i.jsxs("span",{className:"text-xs font-normal text-[var(--text-muted)]",children:["Updated ",lO(g.updatedAt)]})]}),subtitle:g.firstLine||"Empty handoff content.",summaryClassName:"hover:bg-[var(--surface-hover)]/60 focus-visible:bg-[var(--surface-hover)]/60",actions:i.jsxs(i.Fragment,{children:[i.jsx(Ke,{type:"button",variant:"danger",className:"min-h-8 px-2.5 py-1 text-xs sm:min-h-9",disabled:s===g.phaseId,onClick:v=>{v.preventDefault(),v.stopPropagation(),p(g)},children:s===g.phaseId?"Clearing…":"Clear"}),i.jsx(Ve,{to:g.featureId?`/features/${g.featureId}/phases/${g.phaseId}`:"/features",className:"text-xs text-[var(--text-muted)] underline-offset-2 hover:text-[var(--text)] hover:underline",onClick:v=>v.stopPropagation(),children:g.featureId?"Open phase →":"Browse features →"})]}),contentClassName:"px-5 py-5",children:g.firstLine?i.jsx(Nn,{text:g.content,className:"formatted-text max-w-none"}):i.jsx("p",{className:"text-sm italic text-[var(--text-muted)]",children:"Empty handoff content."})})})},g.phaseId))]})}function oO(e){if(!e)return"—";try{return new Intl.DateTimeFormat(void 0,{dateStyle:"medium",timeStyle:"short"}).format(new Date(e))}catch{return e}}async function cO(){return{archived:await ZR()}}function uO(){const{archived:e}=xr();return e.length===0?i.jsxs(Gt,{className:"grid gap-4",children:[i.jsxs("div",{className:"flex flex-wrap items-baseline justify-between gap-2",children:[i.jsxs("div",{children:[i.jsx("h1",{className:"text-lg font-bold text-[var(--text)]",children:"Archived handoffs"}),i.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:"Completed, superseded, and manually cleared handoffs."})]}),i.jsx(Ve,{to:"/handoff",className:"text-sm text-[var(--accent)] underline-offset-2 hover:underline",children:"← Pending handoffs"})]}),i.jsx("p",{className:"py-8 text-center text-sm text-[var(--text-muted)]",children:"No archived handoffs."})]}):i.jsxs("div",{className:"grid gap-4",children:[i.jsxs("div",{className:"flex flex-wrap items-baseline justify-between gap-2",children:[i.jsxs("div",{children:[i.jsx("h1",{className:"text-lg font-bold text-[var(--text)]",children:"Archived handoffs"}),i.jsxs("p",{className:"text-sm text-[var(--text-muted)]",children:[e.length," archived entries. These are history, not pending resume context."]})]}),i.jsx(Ve,{to:"/handoff",className:"text-sm text-[var(--accent)] underline-offset-2 hover:underline",children:"← Pending handoffs"})]}),e.map(a=>i.jsx(Gt,{className:"overflow-hidden p-0",children:i.jsxs(qn,{defaultOpen:!1,title:i.jsxs(i.Fragment,{children:[i.jsx(lr,{id:a.compositeRef,children:a.compositeRef}),i.jsxs("span",{className:"text-xs font-normal text-[var(--text-muted)]",children:["Archived ",oO(a.archivedAt)]})]}),subtitle:a.firstLine||"Empty archived handoff.",contentClassName:"px-5 py-5",children:[i.jsxs("div",{className:"mb-3 flex flex-wrap gap-2 text-xs text-[var(--text-muted)]",children:[i.jsxs("span",{children:["Reason: ",a.reason||"unknown"]}),i.jsxs("span",{className:"break-all",children:["File: ",a.file]})]}),i.jsx(Nn,{text:a.content||"(archive file unavailable)",className:"formatted-text max-w-none"})]})},`${a.phaseId}:${a.file}`))]})}async function dO({request:e}){const r=new URL(e.url).searchParams.get("path")??"";if(!/^\.planner\/docs\/.+\.md$/i.test(r)||r.includes("/../"))throw new Response("Document path must be a Markdown file under .planner/docs/",{status:400});return{doc:await DR(r)}}async function fO({request:e}){const a=await e.formData(),r=String(a.get("path")??""),s=String(a.get("content")??"");if(!(a.get("confirmed")==="true"))return{error:"Saving requires explicit confirmation.",path:r};if(!s.trim())return{error:"Document content must be non-empty Markdown.",path:r};try{await CR(r,s)}catch(c){return{error:c instanceof Error?c.message:String(c),path:r}}return En(`/docs/view?path=${encodeURIComponent(r)}`)}function hO(){const{doc:e}=xr(),a=oE(),[r,s]=x.useState(!1),[u,c]=x.useState(e.content);return i.jsxs("div",{className:"grid gap-4",children:[i.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[i.jsx(Ve,{to:"/handoff",className:"text-sm text-[var(--accent)] underline-offset-2 hover:underline",children:"← Handoffs"}),i.jsx("h1",{className:"text-base font-bold text-[var(--text)]",children:"Planner document"}),i.jsx("code",{className:"rounded border border-[var(--border)] px-2 py-0.5 font-mono text-xs",children:e.path}),i.jsx("button",{type:"button",className:"rounded border border-[var(--border)] px-2 py-1 text-sm",onClick:()=>{c(e.content),s(d=>!d)},children:r?"Preview":"Edit"})]}),a!=null&&a.error?i.jsx("p",{role:"alert",className:"text-sm text-red-600",children:a.error}):null,r?i.jsxs(un,{method:"put",className:"grid gap-3",children:[i.jsx("input",{type:"hidden",name:"path",value:e.path}),i.jsxs("label",{className:"grid gap-2 text-sm",children:[i.jsx("span",{className:"font-semibold",children:"Markdown source (dependency-free textarea baseline)"}),i.jsx("textarea",{name:"content",value:u,onChange:d=>c(d.target.value),rows:24,className:"rounded-lg border border-[var(--border)] p-3 font-mono text-sm"})]}),i.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[i.jsx("input",{type:"checkbox",name:"confirmed",value:"true",required:!0}),i.jsx("span",{children:"I confirm overwriting this planner-owned document."})]}),i.jsx("div",{children:i.jsx("button",{type:"submit",className:"rounded bg-[var(--accent)] px-3 py-1.5 text-sm font-semibold text-white",children:"Save document"})}),i.jsxs("div",{className:"rounded-lg border border-[var(--border)] p-4",children:[i.jsx("h2",{className:"mb-2 text-sm font-bold",children:"Live preview"}),i.jsx(Nn,{text:u})]})]}):i.jsx("div",{className:"rounded-lg border border-[var(--border)] p-4",children:i.jsx(Nn,{text:e.content})})]})}async function mO({request:e,params:a}){yt(a,"featureId");const r=yt(a,"phaseId"),s=yt(a,"taskId"),u=yt(a,"itemId"),c=await e.formData(),d=Pn(c,"checked")==="true",h=await yd(s);return await Zm({...h,phaseId:r,checklist:h.checklist.map(p=>p.id===u?{...p,checked:d}:p)}),Response.json({ok:!0,taskId:s,itemId:u,checked:d})}const pO=YE([{id:"root",path:"/",loader:T2,element:i.jsx(A2,{}),errorElement:i.jsx(C2,{}),children:[{index:!0,loader:O2,element:i.jsx(BD,{})},{path:"features",id:"features",loader:ID,element:i.jsx(YD,{}),children:[{path:"new",element:i.jsx(SC,{}),action:zC}]},{path:"features/:featureId",id:"feature-detail",loader:nC,element:i.jsx(fC,{}),children:[{path:"edit",element:i.jsx(NC,{}),action:$C},{path:"phases/new",element:i.jsx(EC,{}),action:IC}]},{path:"requirements",id:"requirements",loader:GD,element:i.jsx(KD,{}),children:[{path:"new",element:i.jsx(_C,{}),action:eO},{path:":requirementId/edit",element:i.jsx(LC,{}),action:tO}]},{path:"ideas",id:"ideas",loader:ZD,action:WD,element:i.jsx(tC,{})},{path:"project/edit",element:i.jsx(DC,{}),action:JC},{path:"accepted-decisions",action:rO},{path:"handoff",loader:sO,element:i.jsx(iO,{})},{path:"handoff/archive",loader:cO,element:i.jsx(uO,{})},{path:"docs/view",loader:dO,action:fO,element:i.jsx(hO,{})},{path:"features/:featureId/delete",action:UC},{path:"requirements/:requirementId/delete",action:nO},{path:"features/:featureId/status",action:BC},{path:"features/:featureId/phases/:phaseId",id:"phase-detail",loader:hC,element:i.jsx(gC,{}),children:[{path:"edit",element:i.jsx(jC,{}),action:HC},{path:"tasks/new",element:i.jsx(RC,{}),action:FC}]},{path:"features/:featureId/phases/:phaseId/delete",action:qC},{path:"features/:featureId/phases/:phaseId/status",action:PC},{path:"features/:featureId/phases/:phaseId/tasks/:taskId",id:"task-detail",loader:xC,element:i.jsx(bC,{}),children:[{path:"edit",element:i.jsx(AC,{}),action:YC},{path:"subtasks/new",action:ZC},{path:"dependencies/add",action:WC}]},{path:"features/:featureId/phases/:phaseId/tasks/:taskId/delete",action:GC},{path:"features/:featureId/phases/:phaseId/tasks/:taskId/start",action:QC},{path:"features/:featureId/phases/:phaseId/tasks/:taskId/reopen",action:KC},{path:"features/:featureId/phases/:phaseId/tasks/:taskId/status",action:XC},{path:"features/:featureId/phases/:phaseId/tasks/:taskId/checklist/:itemId/toggle",action:mO}]}]),Iw=document.getElementById("root");if(!Iw)throw new Error("#root not found");MS.createRoot(Iw).render(i.jsx(x.StrictMode,{children:i.jsx(nj,{router:pO})}));