@openscout/scout 0.2.63 → 0.2.64

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,140 +0,0 @@
1
- function d2(e,t){for(var s=0;s<t.length;s++){const r=t[s];if(typeof r!="string"&&!Array.isArray(r)){for(const i in r)if(i!=="default"&&!(i in e)){const l=Object.getOwnPropertyDescriptor(r,i);l&&Object.defineProperty(e,i,l.get?l:{enumerable:!0,get:()=>r[i]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const l of i)if(l.type==="childList")for(const c of l.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&r(c)}).observe(document,{childList:!0,subtree:!0});function s(i){const l={};return i.integrity&&(l.integrity=i.integrity),i.referrerPolicy&&(l.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?l.credentials="include":i.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function r(i){if(i.ep)return;i.ep=!0;const l=s(i);fetch(i.href,l)}})();function FS(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var up={exports:{}},cl={};var px;function f2(){if(px)return cl;px=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function s(r,i,l){var c=null;if(l!==void 0&&(c=""+l),i.key!==void 0&&(c=""+i.key),"key"in i){l={};for(var f in i)f!=="key"&&(l[f]=i[f])}else l=i;return i=l.ref,{$$typeof:e,type:r,key:c,ref:i!==void 0?i:null,props:l}}return cl.Fragment=t,cl.jsx=s,cl.jsxs=s,cl}var mx;function h2(){return mx||(mx=1,up.exports=f2()),up.exports}var d=h2(),dp={exports:{}},Pe={};var gx;function p2(){if(gx)return Pe;gx=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),s=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),l=Symbol.for("react.consumer"),c=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),p=Symbol.for("react.suspense"),h=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),v=Symbol.for("react.activity"),x=Symbol.iterator;function w(D){return D===null||typeof D!="object"?null:(D=x&&D[x]||D["@@iterator"],typeof D=="function"?D:null)}var T={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},N=Object.assign,A={};function C(D,U,W){this.props=D,this.context=U,this.refs=A,this.updater=W||T}C.prototype.isReactComponent={},C.prototype.setState=function(D,U){if(typeof D!="object"&&typeof D!="function"&&D!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,D,U,"setState")},C.prototype.forceUpdate=function(D){this.updater.enqueueForceUpdate(this,D,"forceUpdate")};function j(){}j.prototype=C.prototype;function S(D,U,W){this.props=D,this.context=U,this.refs=A,this.updater=W||T}var _=S.prototype=new j;_.constructor=S,N(_,C.prototype),_.isPureReactComponent=!0;var R=Array.isArray;function M(){}var O={H:null,A:null,T:null,S:null},I=Object.prototype.hasOwnProperty;function H(D,U,W){var se=W.ref;return{$$typeof:e,type:D,key:U,ref:se!==void 0?se:null,props:W}}function F(D,U){return H(D.type,U,D.props)}function $(D){return typeof D=="object"&&D!==null&&D.$$typeof===e}function L(D){var U={"=":"=0",":":"=2"};return"$"+D.replace(/[=:]/g,function(W){return U[W]})}var Y=/\/+/g;function ie(D,U){return typeof D=="object"&&D!==null&&D.key!=null?L(""+D.key):U.toString(36)}function ee(D){switch(D.status){case"fulfilled":return D.value;case"rejected":throw D.reason;default:switch(typeof D.status=="string"?D.then(M,M):(D.status="pending",D.then(function(U){D.status==="pending"&&(D.status="fulfilled",D.value=U)},function(U){D.status==="pending"&&(D.status="rejected",D.reason=U)})),D.status){case"fulfilled":return D.value;case"rejected":throw D.reason}}throw D}function z(D,U,W,se,te){var me=typeof D;(me==="undefined"||me==="boolean")&&(D=null);var he=!1;if(D===null)he=!0;else switch(me){case"bigint":case"string":case"number":he=!0;break;case"object":switch(D.$$typeof){case e:case t:he=!0;break;case g:return he=D._init,z(he(D._payload),U,W,se,te)}}if(he)return te=te(D),he=se===""?"."+ie(D,0):se,R(te)?(W="",he!=null&&(W=he.replace(Y,"$&/")+"/"),z(te,U,W,"",function(Re){return Re})):te!=null&&($(te)&&(te=F(te,W+(te.key==null||D&&D.key===te.key?"":(""+te.key).replace(Y,"$&/")+"/")+he)),U.push(te)),1;he=0;var pe=se===""?".":se+":";if(R(D))for(var xe=0;xe<D.length;xe++)se=D[xe],me=pe+ie(se,xe),he+=z(se,U,W,me,te);else if(xe=w(D),typeof xe=="function")for(D=xe.call(D),xe=0;!(se=D.next()).done;)se=se.value,me=pe+ie(se,xe++),he+=z(se,U,W,me,te);else if(me==="object"){if(typeof D.then=="function")return z(ee(D),U,W,se,te);throw U=String(D),Error("Objects are not valid as a React child (found: "+(U==="[object Object]"?"object with keys {"+Object.keys(D).join(", ")+"}":U)+"). If you meant to render a collection of children, use an array instead.")}return he}function Z(D,U,W){if(D==null)return D;var se=[],te=0;return z(D,se,"","",function(me){return U.call(W,me,te++)}),se}function B(D){if(D._status===-1){var U=D._result;U=U(),U.then(function(W){(D._status===0||D._status===-1)&&(D._status=1,D._result=W)},function(W){(D._status===0||D._status===-1)&&(D._status=2,D._result=W)}),D._status===-1&&(D._status=0,D._result=U)}if(D._status===1)return D._result.default;throw D._result}var re=typeof reportError=="function"?reportError:function(D){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var U=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof D=="object"&&D!==null&&typeof D.message=="string"?String(D.message):String(D),error:D});if(!window.dispatchEvent(U))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",D);return}console.error(D)},J={map:Z,forEach:function(D,U,W){Z(D,function(){U.apply(this,arguments)},W)},count:function(D){var U=0;return Z(D,function(){U++}),U},toArray:function(D){return Z(D,function(U){return U})||[]},only:function(D){if(!$(D))throw Error("React.Children.only expected to receive a single React element child.");return D}};return Pe.Activity=v,Pe.Children=J,Pe.Component=C,Pe.Fragment=s,Pe.Profiler=i,Pe.PureComponent=S,Pe.StrictMode=r,Pe.Suspense=p,Pe.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=O,Pe.__COMPILER_RUNTIME={__proto__:null,c:function(D){return O.H.useMemoCache(D)}},Pe.cache=function(D){return function(){return D.apply(null,arguments)}},Pe.cacheSignal=function(){return null},Pe.cloneElement=function(D,U,W){if(D==null)throw Error("The argument must be a React element, but you passed "+D+".");var se=N({},D.props),te=D.key;if(U!=null)for(me in U.key!==void 0&&(te=""+U.key),U)!I.call(U,me)||me==="key"||me==="__self"||me==="__source"||me==="ref"&&U.ref===void 0||(se[me]=U[me]);var me=arguments.length-2;if(me===1)se.children=W;else if(1<me){for(var he=Array(me),pe=0;pe<me;pe++)he[pe]=arguments[pe+2];se.children=he}return H(D.type,te,se)},Pe.createContext=function(D){return D={$$typeof:c,_currentValue:D,_currentValue2:D,_threadCount:0,Provider:null,Consumer:null},D.Provider=D,D.Consumer={$$typeof:l,_context:D},D},Pe.createElement=function(D,U,W){var se,te={},me=null;if(U!=null)for(se in U.key!==void 0&&(me=""+U.key),U)I.call(U,se)&&se!=="key"&&se!=="__self"&&se!=="__source"&&(te[se]=U[se]);var he=arguments.length-2;if(he===1)te.children=W;else if(1<he){for(var pe=Array(he),xe=0;xe<he;xe++)pe[xe]=arguments[xe+2];te.children=pe}if(D&&D.defaultProps)for(se in he=D.defaultProps,he)te[se]===void 0&&(te[se]=he[se]);return H(D,me,te)},Pe.createRef=function(){return{current:null}},Pe.forwardRef=function(D){return{$$typeof:f,render:D}},Pe.isValidElement=$,Pe.lazy=function(D){return{$$typeof:g,_payload:{_status:-1,_result:D},_init:B}},Pe.memo=function(D,U){return{$$typeof:h,type:D,compare:U===void 0?null:U}},Pe.startTransition=function(D){var U=O.T,W={};O.T=W;try{var se=D(),te=O.S;te!==null&&te(W,se),typeof se=="object"&&se!==null&&typeof se.then=="function"&&se.then(M,re)}catch(me){re(me)}finally{U!==null&&W.types!==null&&(U.types=W.types),O.T=U}},Pe.unstable_useCacheRefresh=function(){return O.H.useCacheRefresh()},Pe.use=function(D){return O.H.use(D)},Pe.useActionState=function(D,U,W){return O.H.useActionState(D,U,W)},Pe.useCallback=function(D,U){return O.H.useCallback(D,U)},Pe.useContext=function(D){return O.H.useContext(D)},Pe.useDebugValue=function(){},Pe.useDeferredValue=function(D,U){return O.H.useDeferredValue(D,U)},Pe.useEffect=function(D,U){return O.H.useEffect(D,U)},Pe.useEffectEvent=function(D){return O.H.useEffectEvent(D)},Pe.useId=function(){return O.H.useId()},Pe.useImperativeHandle=function(D,U,W){return O.H.useImperativeHandle(D,U,W)},Pe.useInsertionEffect=function(D,U){return O.H.useInsertionEffect(D,U)},Pe.useLayoutEffect=function(D,U){return O.H.useLayoutEffect(D,U)},Pe.useMemo=function(D,U){return O.H.useMemo(D,U)},Pe.useOptimistic=function(D,U){return O.H.useOptimistic(D,U)},Pe.useReducer=function(D,U,W){return O.H.useReducer(D,U,W)},Pe.useRef=function(D){return O.H.useRef(D)},Pe.useState=function(D){return O.H.useState(D)},Pe.useSyncExternalStore=function(D,U,W){return O.H.useSyncExternalStore(D,U,W)},Pe.useTransition=function(){return O.H.useTransition()},Pe.version="19.2.3",Pe}var yx;function Hl(){return yx||(yx=1,dp.exports=p2()),dp.exports}var b=Hl();const qS=FS(b),YS=d2({__proto__:null,default:qS},[b]);var fp={exports:{}},ul={},hp={exports:{}},pp={};var vx;function m2(){return vx||(vx=1,(function(e){function t(z,Z){var B=z.length;z.push(Z);e:for(;0<B;){var re=B-1>>>1,J=z[re];if(0<i(J,Z))z[re]=Z,z[B]=J,B=re;else break e}}function s(z){return z.length===0?null:z[0]}function r(z){if(z.length===0)return null;var Z=z[0],B=z.pop();if(B!==Z){z[0]=B;e:for(var re=0,J=z.length,D=J>>>1;re<D;){var U=2*(re+1)-1,W=z[U],se=U+1,te=z[se];if(0>i(W,B))se<J&&0>i(te,W)?(z[re]=te,z[se]=B,re=se):(z[re]=W,z[U]=B,re=U);else if(se<J&&0>i(te,B))z[re]=te,z[se]=B,re=se;else break e}}return Z}function i(z,Z){var B=z.sortIndex-Z.sortIndex;return B!==0?B:z.id-Z.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var l=performance;e.unstable_now=function(){return l.now()}}else{var c=Date,f=c.now();e.unstable_now=function(){return c.now()-f}}var p=[],h=[],g=1,v=null,x=3,w=!1,T=!1,N=!1,A=!1,C=typeof setTimeout=="function"?setTimeout:null,j=typeof clearTimeout=="function"?clearTimeout:null,S=typeof setImmediate<"u"?setImmediate:null;function _(z){for(var Z=s(h);Z!==null;){if(Z.callback===null)r(h);else if(Z.startTime<=z)r(h),Z.sortIndex=Z.expirationTime,t(p,Z);else break;Z=s(h)}}function R(z){if(N=!1,_(z),!T)if(s(p)!==null)T=!0,M||(M=!0,L());else{var Z=s(h);Z!==null&&ee(R,Z.startTime-z)}}var M=!1,O=-1,I=5,H=-1;function F(){return A?!0:!(e.unstable_now()-H<I)}function $(){if(A=!1,M){var z=e.unstable_now();H=z;var Z=!0;try{e:{T=!1,N&&(N=!1,j(O),O=-1),w=!0;var B=x;try{t:{for(_(z),v=s(p);v!==null&&!(v.expirationTime>z&&F());){var re=v.callback;if(typeof re=="function"){v.callback=null,x=v.priorityLevel;var J=re(v.expirationTime<=z);if(z=e.unstable_now(),typeof J=="function"){v.callback=J,_(z),Z=!0;break t}v===s(p)&&r(p),_(z)}else r(p);v=s(p)}if(v!==null)Z=!0;else{var D=s(h);D!==null&&ee(R,D.startTime-z),Z=!1}}break e}finally{v=null,x=B,w=!1}Z=void 0}}finally{Z?L():M=!1}}}var L;if(typeof S=="function")L=function(){S($)};else if(typeof MessageChannel<"u"){var Y=new MessageChannel,ie=Y.port2;Y.port1.onmessage=$,L=function(){ie.postMessage(null)}}else L=function(){C($,0)};function ee(z,Z){O=C(function(){z(e.unstable_now())},Z)}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(z){z.callback=null},e.unstable_forceFrameRate=function(z){0>z||125<z?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):I=0<z?Math.floor(1e3/z):5},e.unstable_getCurrentPriorityLevel=function(){return x},e.unstable_next=function(z){switch(x){case 1:case 2:case 3:var Z=3;break;default:Z=x}var B=x;x=Z;try{return z()}finally{x=B}},e.unstable_requestPaint=function(){A=!0},e.unstable_runWithPriority=function(z,Z){switch(z){case 1:case 2:case 3:case 4:case 5:break;default:z=3}var B=x;x=z;try{return Z()}finally{x=B}},e.unstable_scheduleCallback=function(z,Z,B){var re=e.unstable_now();switch(typeof B=="object"&&B!==null?(B=B.delay,B=typeof B=="number"&&0<B?re+B:re):B=re,z){case 1:var J=-1;break;case 2:J=250;break;case 5:J=1073741823;break;case 4:J=1e4;break;default:J=5e3}return J=B+J,z={id:g++,callback:Z,priorityLevel:z,startTime:B,expirationTime:J,sortIndex:-1},B>re?(z.sortIndex=B,t(h,z),s(p)===null&&z===s(h)&&(N?(j(O),O=-1):N=!0,ee(R,B-re))):(z.sortIndex=J,t(p,z),T||w||(T=!0,M||(M=!0,L()))),z},e.unstable_shouldYield=F,e.unstable_wrapCallback=function(z){var Z=x;return function(){var B=x;x=Z;try{return z.apply(this,arguments)}finally{x=B}}}})(pp)),pp}var bx;function g2(){return bx||(bx=1,hp.exports=m2()),hp.exports}var mp={exports:{}},dn={};var xx;function y2(){if(xx)return dn;xx=1;var e=Hl();function t(p){var h="https://react.dev/errors/"+p;if(1<arguments.length){h+="?args[]="+encodeURIComponent(arguments[1]);for(var g=2;g<arguments.length;g++)h+="&args[]="+encodeURIComponent(arguments[g])}return"Minified React error #"+p+"; visit "+h+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function s(){}var r={d:{f:s,r:function(){throw Error(t(522))},D:s,C:s,L:s,m:s,X:s,S:s,M:s},p:0,findDOMNode:null},i=Symbol.for("react.portal");function l(p,h,g){var v=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:i,key:v==null?null:""+v,children:p,containerInfo:h,implementation:g}}var c=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function f(p,h){if(p==="font")return"";if(typeof h=="string")return h==="use-credentials"?h:""}return dn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,dn.createPortal=function(p,h){var g=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!h||h.nodeType!==1&&h.nodeType!==9&&h.nodeType!==11)throw Error(t(299));return l(p,h,null,g)},dn.flushSync=function(p){var h=c.T,g=r.p;try{if(c.T=null,r.p=2,p)return p()}finally{c.T=h,r.p=g,r.d.f()}},dn.preconnect=function(p,h){typeof p=="string"&&(h?(h=h.crossOrigin,h=typeof h=="string"?h==="use-credentials"?h:"":void 0):h=null,r.d.C(p,h))},dn.prefetchDNS=function(p){typeof p=="string"&&r.d.D(p)},dn.preinit=function(p,h){if(typeof p=="string"&&h&&typeof h.as=="string"){var g=h.as,v=f(g,h.crossOrigin),x=typeof h.integrity=="string"?h.integrity:void 0,w=typeof h.fetchPriority=="string"?h.fetchPriority:void 0;g==="style"?r.d.S(p,typeof h.precedence=="string"?h.precedence:void 0,{crossOrigin:v,integrity:x,fetchPriority:w}):g==="script"&&r.d.X(p,{crossOrigin:v,integrity:x,fetchPriority:w,nonce:typeof h.nonce=="string"?h.nonce:void 0})}},dn.preinitModule=function(p,h){if(typeof p=="string")if(typeof h=="object"&&h!==null){if(h.as==null||h.as==="script"){var g=f(h.as,h.crossOrigin);r.d.M(p,{crossOrigin:g,integrity:typeof h.integrity=="string"?h.integrity:void 0,nonce:typeof h.nonce=="string"?h.nonce:void 0})}}else h==null&&r.d.M(p)},dn.preload=function(p,h){if(typeof p=="string"&&typeof h=="object"&&h!==null&&typeof h.as=="string"){var g=h.as,v=f(g,h.crossOrigin);r.d.L(p,g,{crossOrigin:v,integrity:typeof h.integrity=="string"?h.integrity:void 0,nonce:typeof h.nonce=="string"?h.nonce:void 0,type:typeof h.type=="string"?h.type:void 0,fetchPriority:typeof h.fetchPriority=="string"?h.fetchPriority:void 0,referrerPolicy:typeof h.referrerPolicy=="string"?h.referrerPolicy:void 0,imageSrcSet:typeof h.imageSrcSet=="string"?h.imageSrcSet:void 0,imageSizes:typeof h.imageSizes=="string"?h.imageSizes:void 0,media:typeof h.media=="string"?h.media:void 0})}},dn.preloadModule=function(p,h){if(typeof p=="string")if(h){var g=f(h.as,h.crossOrigin);r.d.m(p,{as:typeof h.as=="string"&&h.as!=="script"?h.as:void 0,crossOrigin:g,integrity:typeof h.integrity=="string"?h.integrity:void 0})}else r.d.m(p)},dn.requestFormReset=function(p){r.d.r(p)},dn.unstable_batchedUpdates=function(p,h){return p(h)},dn.useFormState=function(p,h,g){return c.H.useFormState(p,h,g)},dn.useFormStatus=function(){return c.H.useHostTransitionStatus()},dn.version="19.2.3",dn}var wx;function GS(){if(wx)return mp.exports;wx=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),mp.exports=y2(),mp.exports}var Sx;function v2(){if(Sx)return ul;Sx=1;var e=g2(),t=Hl(),s=GS();function r(n){var a="https://react.dev/errors/"+n;if(1<arguments.length){a+="?args[]="+encodeURIComponent(arguments[1]);for(var o=2;o<arguments.length;o++)a+="&args[]="+encodeURIComponent(arguments[o])}return"Minified React error #"+n+"; visit "+a+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function i(n){return!(!n||n.nodeType!==1&&n.nodeType!==9&&n.nodeType!==11)}function l(n){var a=n,o=n;if(n.alternate)for(;a.return;)a=a.return;else{n=a;do a=n,(a.flags&4098)!==0&&(o=a.return),n=a.return;while(n)}return a.tag===3?o:null}function c(n){if(n.tag===13){var a=n.memoizedState;if(a===null&&(n=n.alternate,n!==null&&(a=n.memoizedState)),a!==null)return a.dehydrated}return null}function f(n){if(n.tag===31){var a=n.memoizedState;if(a===null&&(n=n.alternate,n!==null&&(a=n.memoizedState)),a!==null)return a.dehydrated}return null}function p(n){if(l(n)!==n)throw Error(r(188))}function h(n){var a=n.alternate;if(!a){if(a=l(n),a===null)throw Error(r(188));return a!==n?null:n}for(var o=n,u=a;;){var m=o.return;if(m===null)break;var y=m.alternate;if(y===null){if(u=m.return,u!==null){o=u;continue}break}if(m.child===y.child){for(y=m.child;y;){if(y===o)return p(m),n;if(y===u)return p(m),a;y=y.sibling}throw Error(r(188))}if(o.return!==u.return)o=m,u=y;else{for(var E=!1,k=m.child;k;){if(k===o){E=!0,o=m,u=y;break}if(k===u){E=!0,u=m,o=y;break}k=k.sibling}if(!E){for(k=y.child;k;){if(k===o){E=!0,o=y,u=m;break}if(k===u){E=!0,u=y,o=m;break}k=k.sibling}if(!E)throw Error(r(189))}}if(o.alternate!==u)throw Error(r(190))}if(o.tag!==3)throw Error(r(188));return o.stateNode.current===o?n:a}function g(n){var a=n.tag;if(a===5||a===26||a===27||a===6)return n;for(n=n.child;n!==null;){if(a=g(n),a!==null)return a;n=n.sibling}return null}var v=Object.assign,x=Symbol.for("react.element"),w=Symbol.for("react.transitional.element"),T=Symbol.for("react.portal"),N=Symbol.for("react.fragment"),A=Symbol.for("react.strict_mode"),C=Symbol.for("react.profiler"),j=Symbol.for("react.consumer"),S=Symbol.for("react.context"),_=Symbol.for("react.forward_ref"),R=Symbol.for("react.suspense"),M=Symbol.for("react.suspense_list"),O=Symbol.for("react.memo"),I=Symbol.for("react.lazy"),H=Symbol.for("react.activity"),F=Symbol.for("react.memo_cache_sentinel"),$=Symbol.iterator;function L(n){return n===null||typeof n!="object"?null:(n=$&&n[$]||n["@@iterator"],typeof n=="function"?n:null)}var Y=Symbol.for("react.client.reference");function ie(n){if(n==null)return null;if(typeof n=="function")return n.$$typeof===Y?null:n.displayName||n.name||null;if(typeof n=="string")return n;switch(n){case N:return"Fragment";case C:return"Profiler";case A:return"StrictMode";case R:return"Suspense";case M:return"SuspenseList";case H:return"Activity"}if(typeof n=="object")switch(n.$$typeof){case T:return"Portal";case S:return n.displayName||"Context";case j:return(n._context.displayName||"Context")+".Consumer";case _:var a=n.render;return n=n.displayName,n||(n=a.displayName||a.name||"",n=n!==""?"ForwardRef("+n+")":"ForwardRef"),n;case O:return a=n.displayName||null,a!==null?a:ie(n.type)||"Memo";case I:a=n._payload,n=n._init;try{return ie(n(a))}catch{}}return null}var ee=Array.isArray,z=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Z=s.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,B={pending:!1,data:null,method:null,action:null},re=[],J=-1;function D(n){return{current:n}}function U(n){0>J||(n.current=re[J],re[J]=null,J--)}function W(n,a){J++,re[J]=n.current,n.current=a}var se=D(null),te=D(null),me=D(null),he=D(null);function pe(n,a){switch(W(me,a),W(te,n),W(se,null),a.nodeType){case 9:case 11:n=(n=a.documentElement)&&(n=n.namespaceURI)?Lb(n):0;break;default:if(n=a.tagName,a=a.namespaceURI)a=Lb(a),n=Pb(a,n);else switch(n){case"svg":n=1;break;case"math":n=2;break;default:n=0}}U(se),W(se,n)}function xe(){U(se),U(te),U(me)}function Re(n){n.memoizedState!==null&&W(he,n);var a=se.current,o=Pb(a,n.type);a!==o&&(W(te,n),W(se,o))}function fe(n){te.current===n&&(U(se),U(te)),he.current===n&&(U(he),al._currentValue=B)}var ke,Te;function He(n){if(ke===void 0)try{throw Error()}catch(o){var a=o.stack.trim().match(/\n( *(at )?)/);ke=a&&a[1]||"",Te=-1<o.stack.indexOf(`
2
- at`)?" (<anonymous>)":-1<o.stack.indexOf("@")?"@unknown:0:0":""}return`
3
- `+ke+n+Te}var ae=!1;function G(n,a){if(!n||ae)return"";ae=!0;var o=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var u={DetermineComponentFrameRoot:function(){try{if(a){var de=function(){throw Error()};if(Object.defineProperty(de.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(de,[])}catch(ne){var Q=ne}Reflect.construct(n,[],de)}else{try{de.call()}catch(ne){Q=ne}n.call(de.prototype)}}else{try{throw Error()}catch(ne){Q=ne}(de=n())&&typeof de.catch=="function"&&de.catch(function(){})}}catch(ne){if(ne&&Q&&typeof ne.stack=="string")return[ne.stack,Q.stack]}return[null,null]}};u.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var m=Object.getOwnPropertyDescriptor(u.DetermineComponentFrameRoot,"name");m&&m.configurable&&Object.defineProperty(u.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var y=u.DetermineComponentFrameRoot(),E=y[0],k=y[1];if(E&&k){var P=E.split(`
4
- `),K=k.split(`
5
- `);for(m=u=0;u<P.length&&!P[u].includes("DetermineComponentFrameRoot");)u++;for(;m<K.length&&!K[m].includes("DetermineComponentFrameRoot");)m++;if(u===P.length||m===K.length)for(u=P.length-1,m=K.length-1;1<=u&&0<=m&&P[u]!==K[m];)m--;for(;1<=u&&0<=m;u--,m--)if(P[u]!==K[m]){if(u!==1||m!==1)do if(u--,m--,0>m||P[u]!==K[m]){var le=`
6
- `+P[u].replace(" at new "," at ");return n.displayName&&le.includes("<anonymous>")&&(le=le.replace("<anonymous>",n.displayName)),le}while(1<=u&&0<=m);break}}}finally{ae=!1,Error.prepareStackTrace=o}return(o=n?n.displayName||n.name:"")?He(o):""}function oe(n,a){switch(n.tag){case 26:case 27:case 5:return He(n.type);case 16:return He("Lazy");case 13:return n.child!==a&&a!==null?He("Suspense Fallback"):He("Suspense");case 19:return He("SuspenseList");case 0:case 15:return G(n.type,!1);case 11:return G(n.type.render,!1);case 1:return G(n.type,!0);case 31:return He("Activity");default:return""}}function ve(n){try{var a="",o=null;do a+=oe(n,o),o=n,n=n.return;while(n);return a}catch(u){return`
7
- Error generating stack: `+u.message+`
8
- `+u.stack}}var we=Object.prototype.hasOwnProperty,Ce=e.unstable_scheduleCallback,ge=e.unstable_cancelCallback,Oe=e.unstable_shouldYield,ye=e.unstable_requestPaint,Se=e.unstable_now,Ee=e.unstable_getCurrentPriorityLevel,We=e.unstable_ImmediatePriority,ot=e.unstable_UserBlockingPriority,Fe=e.unstable_NormalPriority,qt=e.unstable_LowPriority,Kt=e.unstable_IdlePriority,Nn=e.log,pn=e.unstable_setDisableYieldValue,Qt=null,De=null;function et(n){if(typeof Nn=="function"&&pn(n),De&&typeof De.setStrictMode=="function")try{De.setStrictMode(Qt,n)}catch{}}var nt=Math.clz32?Math.clz32:mn,gt=Math.log,zt=Math.LN2;function mn(n){return n>>>=0,n===0?32:31-(gt(n)/zt|0)|0}var Yt=256,Tn=262144,en=4194304;function gn(n){var a=n&42;if(a!==0)return a;switch(n&-n){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 n&261888;case 262144:case 524288:case 1048576:case 2097152:return n&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return n&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return n}}function pr(n,a,o){var u=n.pendingLanes;if(u===0)return 0;var m=0,y=n.suspendedLanes,E=n.pingedLanes;n=n.warmLanes;var k=u&134217727;return k!==0?(u=k&~y,u!==0?m=gn(u):(E&=k,E!==0?m=gn(E):o||(o=k&~n,o!==0&&(m=gn(o))))):(k=u&~y,k!==0?m=gn(k):E!==0?m=gn(E):o||(o=u&~n,o!==0&&(m=gn(o)))),m===0?0:a!==0&&a!==m&&(a&y)===0&&(y=m&-m,o=a&-a,y>=o||y===32&&(o&4194048)!==0)?a:m}function mr(n,a){return(n.pendingLanes&~(n.suspendedLanes&~n.pingedLanes)&a)===0}function Qd(n,a){switch(n){case 1:case 2:case 4:case 8:case 64:return a+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 a+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 tc(){var n=en;return en<<=1,(en&62914560)===0&&(en=4194304),n}function go(n){for(var a=[],o=0;31>o;o++)a.push(n);return a}function ua(n,a){n.pendingLanes|=a,a!==268435456&&(n.suspendedLanes=0,n.pingedLanes=0,n.warmLanes=0)}function yo(n,a,o,u,m,y){var E=n.pendingLanes;n.pendingLanes=o,n.suspendedLanes=0,n.pingedLanes=0,n.warmLanes=0,n.expiredLanes&=o,n.entangledLanes&=o,n.errorRecoveryDisabledLanes&=o,n.shellSuspendCounter=0;var k=n.entanglements,P=n.expirationTimes,K=n.hiddenUpdates;for(o=E&~o;0<o;){var le=31-nt(o),de=1<<le;k[le]=0,P[le]=-1;var Q=K[le];if(Q!==null)for(K[le]=null,le=0;le<Q.length;le++){var ne=Q[le];ne!==null&&(ne.lane&=-536870913)}o&=~de}u!==0&&vo(n,u,0),y!==0&&m===0&&n.tag!==0&&(n.suspendedLanes|=y&~(E&~a))}function vo(n,a,o){n.pendingLanes|=a,n.suspendedLanes&=~a;var u=31-nt(a);n.entangledLanes|=a,n.entanglements[u]=n.entanglements[u]|1073741824|o&261930}function nc(n,a){var o=n.entangledLanes|=a;for(n=n.entanglements;o;){var u=31-nt(o),m=1<<u;m&a|n[u]&a&&(n[u]|=a),o&=~m}}function sc(n,a){var o=a&-a;return o=(o&42)!==0?1:Hs(o),(o&(n.suspendedLanes|a))!==0?0:o}function Hs(n){switch(n){case 2:n=1;break;case 8:n=4;break;case 32:n=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:n=128;break;case 268435456:n=134217728;break;default:n=0}return n}function bo(n){return n&=-n,2<n?8<n?(n&134217727)!==0?32:268435456:8:2}function rc(){var n=Z.p;return n!==0?n:(n=window.event,n===void 0?32:ox(n.type))}function ac(n,a){var o=Z.p;try{return Z.p=n,a()}finally{Z.p=o}}var gr=Math.random().toString(36).slice(2),tn="__reactFiber$"+gr,jn="__reactProps$"+gr,Xa="__reactContainer$"+gr,ef="__reactEvents$"+gr,eR="__reactListeners$"+gr,tR="__reactHandles$"+gr,Ny="__reactResources$"+gr,xo="__reactMarker$"+gr;function tf(n){delete n[tn],delete n[jn],delete n[ef],delete n[eR],delete n[tR]}function Ka(n){var a=n[tn];if(a)return a;for(var o=n.parentNode;o;){if(a=o[Xa]||o[tn]){if(o=a.alternate,a.child!==null||o!==null&&o.child!==null)for(n=Fb(n);n!==null;){if(o=n[tn])return o;n=Fb(n)}return a}n=o,o=n.parentNode}return null}function Wa(n){if(n=n[tn]||n[Xa]){var a=n.tag;if(a===5||a===6||a===13||a===31||a===26||a===27||a===3)return n}return null}function wo(n){var a=n.tag;if(a===5||a===26||a===27||a===6)return n.stateNode;throw Error(r(33))}function Ja(n){var a=n[Ny];return a||(a=n[Ny]={hoistableStyles:new Map,hoistableScripts:new Map}),a}function Wt(n){n[xo]=!0}var Ty=new Set,jy={};function da(n,a){Qa(n,a),Qa(n+"Capture",a)}function Qa(n,a){for(jy[n]=a,n=0;n<a.length;n++)Ty.add(a[n])}var nR=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]*$"),Cy={},Ry={};function sR(n){return we.call(Ry,n)?!0:we.call(Cy,n)?!1:nR.test(n)?Ry[n]=!0:(Cy[n]=!0,!1)}function ic(n,a,o){if(sR(a))if(o===null)n.removeAttribute(a);else{switch(typeof o){case"undefined":case"function":case"symbol":n.removeAttribute(a);return;case"boolean":var u=a.toLowerCase().slice(0,5);if(u!=="data-"&&u!=="aria-"){n.removeAttribute(a);return}}n.setAttribute(a,""+o)}}function oc(n,a,o){if(o===null)n.removeAttribute(a);else{switch(typeof o){case"undefined":case"function":case"symbol":case"boolean":n.removeAttribute(a);return}n.setAttribute(a,""+o)}}function Fs(n,a,o,u){if(u===null)n.removeAttribute(o);else{switch(typeof u){case"undefined":case"function":case"symbol":case"boolean":n.removeAttribute(o);return}n.setAttributeNS(a,o,""+u)}}function Wn(n){switch(typeof n){case"bigint":case"boolean":case"number":case"string":case"undefined":return n;case"object":return n;default:return""}}function Ay(n){var a=n.type;return(n=n.nodeName)&&n.toLowerCase()==="input"&&(a==="checkbox"||a==="radio")}function rR(n,a,o){var u=Object.getOwnPropertyDescriptor(n.constructor.prototype,a);if(!n.hasOwnProperty(a)&&typeof u<"u"&&typeof u.get=="function"&&typeof u.set=="function"){var m=u.get,y=u.set;return Object.defineProperty(n,a,{configurable:!0,get:function(){return m.call(this)},set:function(E){o=""+E,y.call(this,E)}}),Object.defineProperty(n,a,{enumerable:u.enumerable}),{getValue:function(){return o},setValue:function(E){o=""+E},stopTracking:function(){n._valueTracker=null,delete n[a]}}}}function nf(n){if(!n._valueTracker){var a=Ay(n)?"checked":"value";n._valueTracker=rR(n,a,""+n[a])}}function _y(n){if(!n)return!1;var a=n._valueTracker;if(!a)return!0;var o=a.getValue(),u="";return n&&(u=Ay(n)?n.checked?"true":"false":n.value),n=u,n!==o?(a.setValue(n),!0):!1}function lc(n){if(n=n||(typeof document<"u"?document:void 0),typeof n>"u")return null;try{return n.activeElement||n.body}catch{return n.body}}var aR=/[\n"\\]/g;function Jn(n){return n.replace(aR,function(a){return"\\"+a.charCodeAt(0).toString(16)+" "})}function sf(n,a,o,u,m,y,E,k){n.name="",E!=null&&typeof E!="function"&&typeof E!="symbol"&&typeof E!="boolean"?n.type=E:n.removeAttribute("type"),a!=null?E==="number"?(a===0&&n.value===""||n.value!=a)&&(n.value=""+Wn(a)):n.value!==""+Wn(a)&&(n.value=""+Wn(a)):E!=="submit"&&E!=="reset"||n.removeAttribute("value"),a!=null?rf(n,E,Wn(a)):o!=null?rf(n,E,Wn(o)):u!=null&&n.removeAttribute("value"),m==null&&y!=null&&(n.defaultChecked=!!y),m!=null&&(n.checked=m&&typeof m!="function"&&typeof m!="symbol"),k!=null&&typeof k!="function"&&typeof k!="symbol"&&typeof k!="boolean"?n.name=""+Wn(k):n.removeAttribute("name")}function ky(n,a,o,u,m,y,E,k){if(y!=null&&typeof y!="function"&&typeof y!="symbol"&&typeof y!="boolean"&&(n.type=y),a!=null||o!=null){if(!(y!=="submit"&&y!=="reset"||a!=null)){nf(n);return}o=o!=null?""+Wn(o):"",a=a!=null?""+Wn(a):o,k||a===n.value||(n.value=a),n.defaultValue=a}u=u??m,u=typeof u!="function"&&typeof u!="symbol"&&!!u,n.checked=k?n.checked:!!u,n.defaultChecked=!!u,E!=null&&typeof E!="function"&&typeof E!="symbol"&&typeof E!="boolean"&&(n.name=E),nf(n)}function rf(n,a,o){a==="number"&&lc(n.ownerDocument)===n||n.defaultValue===""+o||(n.defaultValue=""+o)}function ei(n,a,o,u){if(n=n.options,a){a={};for(var m=0;m<o.length;m++)a["$"+o[m]]=!0;for(o=0;o<n.length;o++)m=a.hasOwnProperty("$"+n[o].value),n[o].selected!==m&&(n[o].selected=m),m&&u&&(n[o].defaultSelected=!0)}else{for(o=""+Wn(o),a=null,m=0;m<n.length;m++){if(n[m].value===o){n[m].selected=!0,u&&(n[m].defaultSelected=!0);return}a!==null||n[m].disabled||(a=n[m])}a!==null&&(a.selected=!0)}}function My(n,a,o){if(a!=null&&(a=""+Wn(a),a!==n.value&&(n.value=a),o==null)){n.defaultValue!==a&&(n.defaultValue=a);return}n.defaultValue=o!=null?""+Wn(o):""}function Oy(n,a,o,u){if(a==null){if(u!=null){if(o!=null)throw Error(r(92));if(ee(u)){if(1<u.length)throw Error(r(93));u=u[0]}o=u}o==null&&(o=""),a=o}o=Wn(a),n.defaultValue=o,u=n.textContent,u===o&&u!==""&&u!==null&&(n.value=u),nf(n)}function ti(n,a){if(a){var o=n.firstChild;if(o&&o===n.lastChild&&o.nodeType===3){o.nodeValue=a;return}}n.textContent=a}var iR=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 Dy(n,a,o){var u=a.indexOf("--")===0;o==null||typeof o=="boolean"||o===""?u?n.setProperty(a,""):a==="float"?n.cssFloat="":n[a]="":u?n.setProperty(a,o):typeof o!="number"||o===0||iR.has(a)?a==="float"?n.cssFloat=o:n[a]=(""+o).trim():n[a]=o+"px"}function zy(n,a,o){if(a!=null&&typeof a!="object")throw Error(r(62));if(n=n.style,o!=null){for(var u in o)!o.hasOwnProperty(u)||a!=null&&a.hasOwnProperty(u)||(u.indexOf("--")===0?n.setProperty(u,""):u==="float"?n.cssFloat="":n[u]="");for(var m in a)u=a[m],a.hasOwnProperty(m)&&o[m]!==u&&Dy(n,m,u)}else for(var y in a)a.hasOwnProperty(y)&&Dy(n,y,a[y])}function af(n){if(n.indexOf("-")===-1)return!1;switch(n){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 oR=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"]]),lR=/^[\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 cc(n){return lR.test(""+n)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":n}function qs(){}var of=null;function lf(n){return n=n.target||n.srcElement||window,n.correspondingUseElement&&(n=n.correspondingUseElement),n.nodeType===3?n.parentNode:n}var ni=null,si=null;function Iy(n){var a=Wa(n);if(a&&(n=a.stateNode)){var o=n[jn]||null;e:switch(n=a.stateNode,a.type){case"input":if(sf(n,o.value,o.defaultValue,o.defaultValue,o.checked,o.defaultChecked,o.type,o.name),a=o.name,o.type==="radio"&&a!=null){for(o=n;o.parentNode;)o=o.parentNode;for(o=o.querySelectorAll('input[name="'+Jn(""+a)+'"][type="radio"]'),a=0;a<o.length;a++){var u=o[a];if(u!==n&&u.form===n.form){var m=u[jn]||null;if(!m)throw Error(r(90));sf(u,m.value,m.defaultValue,m.defaultValue,m.checked,m.defaultChecked,m.type,m.name)}}for(a=0;a<o.length;a++)u=o[a],u.form===n.form&&_y(u)}break e;case"textarea":My(n,o.value,o.defaultValue);break e;case"select":a=o.value,a!=null&&ei(n,!!o.multiple,a,!1)}}}var cf=!1;function Ly(n,a,o){if(cf)return n(a,o);cf=!0;try{var u=n(a);return u}finally{if(cf=!1,(ni!==null||si!==null)&&(Kc(),ni&&(a=ni,n=si,si=ni=null,Iy(a),n)))for(a=0;a<n.length;a++)Iy(n[a])}}function So(n,a){var o=n.stateNode;if(o===null)return null;var u=o[jn]||null;if(u===null)return null;o=u[a];e:switch(a){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(u=!u.disabled)||(n=n.type,u=!(n==="button"||n==="input"||n==="select"||n==="textarea")),n=!u;break e;default:n=!1}if(n)return null;if(o&&typeof o!="function")throw Error(r(231,a,typeof o));return o}var Ys=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),uf=!1;if(Ys)try{var Eo={};Object.defineProperty(Eo,"passive",{get:function(){uf=!0}}),window.addEventListener("test",Eo,Eo),window.removeEventListener("test",Eo,Eo)}catch{uf=!1}var yr=null,df=null,uc=null;function Py(){if(uc)return uc;var n,a=df,o=a.length,u,m="value"in yr?yr.value:yr.textContent,y=m.length;for(n=0;n<o&&a[n]===m[n];n++);var E=o-n;for(u=1;u<=E&&a[o-u]===m[y-u];u++);return uc=m.slice(n,1<u?1-u:void 0)}function dc(n){var a=n.keyCode;return"charCode"in n?(n=n.charCode,n===0&&a===13&&(n=13)):n=a,n===10&&(n=13),32<=n||n===13?n:0}function fc(){return!0}function Uy(){return!1}function Cn(n){function a(o,u,m,y,E){this._reactName=o,this._targetInst=m,this.type=u,this.nativeEvent=y,this.target=E,this.currentTarget=null;for(var k in n)n.hasOwnProperty(k)&&(o=n[k],this[k]=o?o(y):y[k]);return this.isDefaultPrevented=(y.defaultPrevented!=null?y.defaultPrevented:y.returnValue===!1)?fc:Uy,this.isPropagationStopped=Uy,this}return v(a.prototype,{preventDefault:function(){this.defaultPrevented=!0;var o=this.nativeEvent;o&&(o.preventDefault?o.preventDefault():typeof o.returnValue!="unknown"&&(o.returnValue=!1),this.isDefaultPrevented=fc)},stopPropagation:function(){var o=this.nativeEvent;o&&(o.stopPropagation?o.stopPropagation():typeof o.cancelBubble!="unknown"&&(o.cancelBubble=!0),this.isPropagationStopped=fc)},persist:function(){},isPersistent:fc}),a}var fa={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(n){return n.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},hc=Cn(fa),No=v({},fa,{view:0,detail:0}),cR=Cn(No),ff,hf,To,pc=v({},No,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:mf,button:0,buttons:0,relatedTarget:function(n){return n.relatedTarget===void 0?n.fromElement===n.srcElement?n.toElement:n.fromElement:n.relatedTarget},movementX:function(n){return"movementX"in n?n.movementX:(n!==To&&(To&&n.type==="mousemove"?(ff=n.screenX-To.screenX,hf=n.screenY-To.screenY):hf=ff=0,To=n),ff)},movementY:function(n){return"movementY"in n?n.movementY:hf}}),$y=Cn(pc),uR=v({},pc,{dataTransfer:0}),dR=Cn(uR),fR=v({},No,{relatedTarget:0}),pf=Cn(fR),hR=v({},fa,{animationName:0,elapsedTime:0,pseudoElement:0}),pR=Cn(hR),mR=v({},fa,{clipboardData:function(n){return"clipboardData"in n?n.clipboardData:window.clipboardData}}),gR=Cn(mR),yR=v({},fa,{data:0}),Vy=Cn(yR),vR={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},bR={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"},xR={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function wR(n){var a=this.nativeEvent;return a.getModifierState?a.getModifierState(n):(n=xR[n])?!!a[n]:!1}function mf(){return wR}var SR=v({},No,{key:function(n){if(n.key){var a=vR[n.key]||n.key;if(a!=="Unidentified")return a}return n.type==="keypress"?(n=dc(n),n===13?"Enter":String.fromCharCode(n)):n.type==="keydown"||n.type==="keyup"?bR[n.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:mf,charCode:function(n){return n.type==="keypress"?dc(n):0},keyCode:function(n){return n.type==="keydown"||n.type==="keyup"?n.keyCode:0},which:function(n){return n.type==="keypress"?dc(n):n.type==="keydown"||n.type==="keyup"?n.keyCode:0}}),ER=Cn(SR),NR=v({},pc,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),By=Cn(NR),TR=v({},No,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:mf}),jR=Cn(TR),CR=v({},fa,{propertyName:0,elapsedTime:0,pseudoElement:0}),RR=Cn(CR),AR=v({},pc,{deltaX:function(n){return"deltaX"in n?n.deltaX:"wheelDeltaX"in n?-n.wheelDeltaX:0},deltaY:function(n){return"deltaY"in n?n.deltaY:"wheelDeltaY"in n?-n.wheelDeltaY:"wheelDelta"in n?-n.wheelDelta:0},deltaZ:0,deltaMode:0}),_R=Cn(AR),kR=v({},fa,{newState:0,oldState:0}),MR=Cn(kR),OR=[9,13,27,32],gf=Ys&&"CompositionEvent"in window,jo=null;Ys&&"documentMode"in document&&(jo=document.documentMode);var DR=Ys&&"TextEvent"in window&&!jo,Zy=Ys&&(!gf||jo&&8<jo&&11>=jo),Hy=" ",Fy=!1;function qy(n,a){switch(n){case"keyup":return OR.indexOf(a.keyCode)!==-1;case"keydown":return a.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Yy(n){return n=n.detail,typeof n=="object"&&"data"in n?n.data:null}var ri=!1;function zR(n,a){switch(n){case"compositionend":return Yy(a);case"keypress":return a.which!==32?null:(Fy=!0,Hy);case"textInput":return n=a.data,n===Hy&&Fy?null:n;default:return null}}function IR(n,a){if(ri)return n==="compositionend"||!gf&&qy(n,a)?(n=Py(),uc=df=yr=null,ri=!1,n):null;switch(n){case"paste":return null;case"keypress":if(!(a.ctrlKey||a.altKey||a.metaKey)||a.ctrlKey&&a.altKey){if(a.char&&1<a.char.length)return a.char;if(a.which)return String.fromCharCode(a.which)}return null;case"compositionend":return Zy&&a.locale!=="ko"?null:a.data;default:return null}}var LR={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 Gy(n){var a=n&&n.nodeName&&n.nodeName.toLowerCase();return a==="input"?!!LR[n.type]:a==="textarea"}function Xy(n,a,o,u){ni?si?si.push(u):si=[u]:ni=u,a=su(a,"onChange"),0<a.length&&(o=new hc("onChange","change",null,o,u),n.push({event:o,listeners:a}))}var Co=null,Ro=null;function PR(n){kb(n,0)}function mc(n){var a=wo(n);if(_y(a))return n}function Ky(n,a){if(n==="change")return a}var Wy=!1;if(Ys){var yf;if(Ys){var vf="oninput"in document;if(!vf){var Jy=document.createElement("div");Jy.setAttribute("oninput","return;"),vf=typeof Jy.oninput=="function"}yf=vf}else yf=!1;Wy=yf&&(!document.documentMode||9<document.documentMode)}function Qy(){Co&&(Co.detachEvent("onpropertychange",ev),Ro=Co=null)}function ev(n){if(n.propertyName==="value"&&mc(Ro)){var a=[];Xy(a,Ro,n,lf(n)),Ly(PR,a)}}function UR(n,a,o){n==="focusin"?(Qy(),Co=a,Ro=o,Co.attachEvent("onpropertychange",ev)):n==="focusout"&&Qy()}function $R(n){if(n==="selectionchange"||n==="keyup"||n==="keydown")return mc(Ro)}function VR(n,a){if(n==="click")return mc(a)}function BR(n,a){if(n==="input"||n==="change")return mc(a)}function ZR(n,a){return n===a&&(n!==0||1/n===1/a)||n!==n&&a!==a}var Pn=typeof Object.is=="function"?Object.is:ZR;function Ao(n,a){if(Pn(n,a))return!0;if(typeof n!="object"||n===null||typeof a!="object"||a===null)return!1;var o=Object.keys(n),u=Object.keys(a);if(o.length!==u.length)return!1;for(u=0;u<o.length;u++){var m=o[u];if(!we.call(a,m)||!Pn(n[m],a[m]))return!1}return!0}function tv(n){for(;n&&n.firstChild;)n=n.firstChild;return n}function nv(n,a){var o=tv(n);n=0;for(var u;o;){if(o.nodeType===3){if(u=n+o.textContent.length,n<=a&&u>=a)return{node:o,offset:a-n};n=u}e:{for(;o;){if(o.nextSibling){o=o.nextSibling;break e}o=o.parentNode}o=void 0}o=tv(o)}}function sv(n,a){return n&&a?n===a?!0:n&&n.nodeType===3?!1:a&&a.nodeType===3?sv(n,a.parentNode):"contains"in n?n.contains(a):n.compareDocumentPosition?!!(n.compareDocumentPosition(a)&16):!1:!1}function rv(n){n=n!=null&&n.ownerDocument!=null&&n.ownerDocument.defaultView!=null?n.ownerDocument.defaultView:window;for(var a=lc(n.document);a instanceof n.HTMLIFrameElement;){try{var o=typeof a.contentWindow.location.href=="string"}catch{o=!1}if(o)n=a.contentWindow;else break;a=lc(n.document)}return a}function bf(n){var a=n&&n.nodeName&&n.nodeName.toLowerCase();return a&&(a==="input"&&(n.type==="text"||n.type==="search"||n.type==="tel"||n.type==="url"||n.type==="password")||a==="textarea"||n.contentEditable==="true")}var HR=Ys&&"documentMode"in document&&11>=document.documentMode,ai=null,xf=null,_o=null,wf=!1;function av(n,a,o){var u=o.window===o?o.document:o.nodeType===9?o:o.ownerDocument;wf||ai==null||ai!==lc(u)||(u=ai,"selectionStart"in u&&bf(u)?u={start:u.selectionStart,end:u.selectionEnd}:(u=(u.ownerDocument&&u.ownerDocument.defaultView||window).getSelection(),u={anchorNode:u.anchorNode,anchorOffset:u.anchorOffset,focusNode:u.focusNode,focusOffset:u.focusOffset}),_o&&Ao(_o,u)||(_o=u,u=su(xf,"onSelect"),0<u.length&&(a=new hc("onSelect","select",null,a,o),n.push({event:a,listeners:u}),a.target=ai)))}function ha(n,a){var o={};return o[n.toLowerCase()]=a.toLowerCase(),o["Webkit"+n]="webkit"+a,o["Moz"+n]="moz"+a,o}var ii={animationend:ha("Animation","AnimationEnd"),animationiteration:ha("Animation","AnimationIteration"),animationstart:ha("Animation","AnimationStart"),transitionrun:ha("Transition","TransitionRun"),transitionstart:ha("Transition","TransitionStart"),transitioncancel:ha("Transition","TransitionCancel"),transitionend:ha("Transition","TransitionEnd")},Sf={},iv={};Ys&&(iv=document.createElement("div").style,"AnimationEvent"in window||(delete ii.animationend.animation,delete ii.animationiteration.animation,delete ii.animationstart.animation),"TransitionEvent"in window||delete ii.transitionend.transition);function pa(n){if(Sf[n])return Sf[n];if(!ii[n])return n;var a=ii[n],o;for(o in a)if(a.hasOwnProperty(o)&&o in iv)return Sf[n]=a[o];return n}var ov=pa("animationend"),lv=pa("animationiteration"),cv=pa("animationstart"),FR=pa("transitionrun"),qR=pa("transitionstart"),YR=pa("transitioncancel"),uv=pa("transitionend"),dv=new Map,Ef="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(" ");Ef.push("scrollEnd");function hs(n,a){dv.set(n,a),da(a,[n])}var gc=typeof reportError=="function"?reportError:function(n){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var a=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof n=="object"&&n!==null&&typeof n.message=="string"?String(n.message):String(n),error:n});if(!window.dispatchEvent(a))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",n);return}console.error(n)},Qn=[],oi=0,Nf=0;function yc(){for(var n=oi,a=Nf=oi=0;a<n;){var o=Qn[a];Qn[a++]=null;var u=Qn[a];Qn[a++]=null;var m=Qn[a];Qn[a++]=null;var y=Qn[a];if(Qn[a++]=null,u!==null&&m!==null){var E=u.pending;E===null?m.next=m:(m.next=E.next,E.next=m),u.pending=m}y!==0&&fv(o,m,y)}}function vc(n,a,o,u){Qn[oi++]=n,Qn[oi++]=a,Qn[oi++]=o,Qn[oi++]=u,Nf|=u,n.lanes|=u,n=n.alternate,n!==null&&(n.lanes|=u)}function Tf(n,a,o,u){return vc(n,a,o,u),bc(n)}function ma(n,a){return vc(n,null,null,a),bc(n)}function fv(n,a,o){n.lanes|=o;var u=n.alternate;u!==null&&(u.lanes|=o);for(var m=!1,y=n.return;y!==null;)y.childLanes|=o,u=y.alternate,u!==null&&(u.childLanes|=o),y.tag===22&&(n=y.stateNode,n===null||n._visibility&1||(m=!0)),n=y,y=y.return;return n.tag===3?(y=n.stateNode,m&&a!==null&&(m=31-nt(o),n=y.hiddenUpdates,u=n[m],u===null?n[m]=[a]:u.push(a),a.lane=o|536870912),y):null}function bc(n){if(50<Jo)throw Jo=0,Dh=null,Error(r(185));for(var a=n.return;a!==null;)n=a,a=n.return;return n.tag===3?n.stateNode:null}var li={};function GR(n,a,o,u){this.tag=n,this.key=o,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=a,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=u,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Un(n,a,o,u){return new GR(n,a,o,u)}function jf(n){return n=n.prototype,!(!n||!n.isReactComponent)}function Gs(n,a){var o=n.alternate;return o===null?(o=Un(n.tag,a,n.key,n.mode),o.elementType=n.elementType,o.type=n.type,o.stateNode=n.stateNode,o.alternate=n,n.alternate=o):(o.pendingProps=a,o.type=n.type,o.flags=0,o.subtreeFlags=0,o.deletions=null),o.flags=n.flags&65011712,o.childLanes=n.childLanes,o.lanes=n.lanes,o.child=n.child,o.memoizedProps=n.memoizedProps,o.memoizedState=n.memoizedState,o.updateQueue=n.updateQueue,a=n.dependencies,o.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext},o.sibling=n.sibling,o.index=n.index,o.ref=n.ref,o.refCleanup=n.refCleanup,o}function hv(n,a){n.flags&=65011714;var o=n.alternate;return o===null?(n.childLanes=0,n.lanes=a,n.child=null,n.subtreeFlags=0,n.memoizedProps=null,n.memoizedState=null,n.updateQueue=null,n.dependencies=null,n.stateNode=null):(n.childLanes=o.childLanes,n.lanes=o.lanes,n.child=o.child,n.subtreeFlags=0,n.deletions=null,n.memoizedProps=o.memoizedProps,n.memoizedState=o.memoizedState,n.updateQueue=o.updateQueue,n.type=o.type,a=o.dependencies,n.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext}),n}function xc(n,a,o,u,m,y){var E=0;if(u=n,typeof n=="function")jf(n)&&(E=1);else if(typeof n=="string")E=QA(n,o,se.current)?26:n==="html"||n==="head"||n==="body"?27:5;else e:switch(n){case H:return n=Un(31,o,a,m),n.elementType=H,n.lanes=y,n;case N:return ga(o.children,m,y,a);case A:E=8,m|=24;break;case C:return n=Un(12,o,a,m|2),n.elementType=C,n.lanes=y,n;case R:return n=Un(13,o,a,m),n.elementType=R,n.lanes=y,n;case M:return n=Un(19,o,a,m),n.elementType=M,n.lanes=y,n;default:if(typeof n=="object"&&n!==null)switch(n.$$typeof){case S:E=10;break e;case j:E=9;break e;case _:E=11;break e;case O:E=14;break e;case I:E=16,u=null;break e}E=29,o=Error(r(130,n===null?"null":typeof n,"")),u=null}return a=Un(E,o,a,m),a.elementType=n,a.type=u,a.lanes=y,a}function ga(n,a,o,u){return n=Un(7,n,u,a),n.lanes=o,n}function Cf(n,a,o){return n=Un(6,n,null,a),n.lanes=o,n}function pv(n){var a=Un(18,null,null,0);return a.stateNode=n,a}function Rf(n,a,o){return a=Un(4,n.children!==null?n.children:[],n.key,a),a.lanes=o,a.stateNode={containerInfo:n.containerInfo,pendingChildren:null,implementation:n.implementation},a}var mv=new WeakMap;function es(n,a){if(typeof n=="object"&&n!==null){var o=mv.get(n);return o!==void 0?o:(a={value:n,source:a,stack:ve(a)},mv.set(n,a),a)}return{value:n,source:a,stack:ve(a)}}var ci=[],ui=0,wc=null,ko=0,ts=[],ns=0,vr=null,js=1,Cs="";function Xs(n,a){ci[ui++]=ko,ci[ui++]=wc,wc=n,ko=a}function gv(n,a,o){ts[ns++]=js,ts[ns++]=Cs,ts[ns++]=vr,vr=n;var u=js;n=Cs;var m=32-nt(u)-1;u&=~(1<<m),o+=1;var y=32-nt(a)+m;if(30<y){var E=m-m%5;y=(u&(1<<E)-1).toString(32),u>>=E,m-=E,js=1<<32-nt(a)+m|o<<m|u,Cs=y+n}else js=1<<y|o<<m|u,Cs=n}function Af(n){n.return!==null&&(Xs(n,1),gv(n,1,0))}function _f(n){for(;n===wc;)wc=ci[--ui],ci[ui]=null,ko=ci[--ui],ci[ui]=null;for(;n===vr;)vr=ts[--ns],ts[ns]=null,Cs=ts[--ns],ts[ns]=null,js=ts[--ns],ts[ns]=null}function yv(n,a){ts[ns++]=js,ts[ns++]=Cs,ts[ns++]=vr,js=a.id,Cs=a.overflow,vr=n}var nn=null,bt=null,Je=!1,br=null,ss=!1,kf=Error(r(519));function xr(n){var a=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Mo(es(a,n)),kf}function vv(n){var a=n.stateNode,o=n.type,u=n.memoizedProps;switch(a[tn]=n,a[jn]=u,o){case"dialog":Ye("cancel",a),Ye("close",a);break;case"iframe":case"object":case"embed":Ye("load",a);break;case"video":case"audio":for(o=0;o<el.length;o++)Ye(el[o],a);break;case"source":Ye("error",a);break;case"img":case"image":case"link":Ye("error",a),Ye("load",a);break;case"details":Ye("toggle",a);break;case"input":Ye("invalid",a),ky(a,u.value,u.defaultValue,u.checked,u.defaultChecked,u.type,u.name,!0);break;case"select":Ye("invalid",a);break;case"textarea":Ye("invalid",a),Oy(a,u.value,u.defaultValue,u.children)}o=u.children,typeof o!="string"&&typeof o!="number"&&typeof o!="bigint"||a.textContent===""+o||u.suppressHydrationWarning===!0||zb(a.textContent,o)?(u.popover!=null&&(Ye("beforetoggle",a),Ye("toggle",a)),u.onScroll!=null&&Ye("scroll",a),u.onScrollEnd!=null&&Ye("scrollend",a),u.onClick!=null&&(a.onclick=qs),a=!0):a=!1,a||xr(n,!0)}function bv(n){for(nn=n.return;nn;)switch(nn.tag){case 5:case 31:case 13:ss=!1;return;case 27:case 3:ss=!0;return;default:nn=nn.return}}function di(n){if(n!==nn)return!1;if(!Je)return bv(n),Je=!0,!1;var a=n.tag,o;if((o=a!==3&&a!==27)&&((o=a===5)&&(o=n.type,o=!(o!=="form"&&o!=="button")||Xh(n.type,n.memoizedProps)),o=!o),o&&bt&&xr(n),bv(n),a===13){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(r(317));bt=Hb(n)}else if(a===31){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(r(317));bt=Hb(n)}else a===27?(a=bt,Dr(n.type)?(n=ep,ep=null,bt=n):bt=a):bt=nn?as(n.stateNode.nextSibling):null;return!0}function ya(){bt=nn=null,Je=!1}function Mf(){var n=br;return n!==null&&(kn===null?kn=n:kn.push.apply(kn,n),br=null),n}function Mo(n){br===null?br=[n]:br.push(n)}var Of=D(null),va=null,Ks=null;function wr(n,a,o){W(Of,a._currentValue),a._currentValue=o}function Ws(n){n._currentValue=Of.current,U(Of)}function Df(n,a,o){for(;n!==null;){var u=n.alternate;if((n.childLanes&a)!==a?(n.childLanes|=a,u!==null&&(u.childLanes|=a)):u!==null&&(u.childLanes&a)!==a&&(u.childLanes|=a),n===o)break;n=n.return}}function zf(n,a,o,u){var m=n.child;for(m!==null&&(m.return=n);m!==null;){var y=m.dependencies;if(y!==null){var E=m.child;y=y.firstContext;e:for(;y!==null;){var k=y;y=m;for(var P=0;P<a.length;P++)if(k.context===a[P]){y.lanes|=o,k=y.alternate,k!==null&&(k.lanes|=o),Df(y.return,o,n),u||(E=null);break e}y=k.next}}else if(m.tag===18){if(E=m.return,E===null)throw Error(r(341));E.lanes|=o,y=E.alternate,y!==null&&(y.lanes|=o),Df(E,o,n),E=null}else E=m.child;if(E!==null)E.return=m;else for(E=m;E!==null;){if(E===n){E=null;break}if(m=E.sibling,m!==null){m.return=E.return,E=m;break}E=E.return}m=E}}function fi(n,a,o,u){n=null;for(var m=a,y=!1;m!==null;){if(!y){if((m.flags&524288)!==0)y=!0;else if((m.flags&262144)!==0)break}if(m.tag===10){var E=m.alternate;if(E===null)throw Error(r(387));if(E=E.memoizedProps,E!==null){var k=m.type;Pn(m.pendingProps.value,E.value)||(n!==null?n.push(k):n=[k])}}else if(m===he.current){if(E=m.alternate,E===null)throw Error(r(387));E.memoizedState.memoizedState!==m.memoizedState.memoizedState&&(n!==null?n.push(al):n=[al])}m=m.return}n!==null&&zf(a,n,o,u),a.flags|=262144}function Sc(n){for(n=n.firstContext;n!==null;){if(!Pn(n.context._currentValue,n.memoizedValue))return!0;n=n.next}return!1}function ba(n){va=n,Ks=null,n=n.dependencies,n!==null&&(n.firstContext=null)}function sn(n){return xv(va,n)}function Ec(n,a){return va===null&&ba(n),xv(n,a)}function xv(n,a){var o=a._currentValue;if(a={context:a,memoizedValue:o,next:null},Ks===null){if(n===null)throw Error(r(308));Ks=a,n.dependencies={lanes:0,firstContext:a},n.flags|=524288}else Ks=Ks.next=a;return o}var XR=typeof AbortController<"u"?AbortController:function(){var n=[],a=this.signal={aborted:!1,addEventListener:function(o,u){n.push(u)}};this.abort=function(){a.aborted=!0,n.forEach(function(o){return o()})}},KR=e.unstable_scheduleCallback,WR=e.unstable_NormalPriority,Ut={$$typeof:S,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function If(){return{controller:new XR,data:new Map,refCount:0}}function Oo(n){n.refCount--,n.refCount===0&&KR(WR,function(){n.controller.abort()})}var Do=null,Lf=0,hi=0,pi=null;function JR(n,a){if(Do===null){var o=Do=[];Lf=0,hi=$h(),pi={status:"pending",value:void 0,then:function(u){o.push(u)}}}return Lf++,a.then(wv,wv),a}function wv(){if(--Lf===0&&Do!==null){pi!==null&&(pi.status="fulfilled");var n=Do;Do=null,hi=0,pi=null;for(var a=0;a<n.length;a++)(0,n[a])()}}function QR(n,a){var o=[],u={status:"pending",value:null,reason:null,then:function(m){o.push(m)}};return n.then(function(){u.status="fulfilled",u.value=a;for(var m=0;m<o.length;m++)(0,o[m])(a)},function(m){for(u.status="rejected",u.reason=m,m=0;m<o.length;m++)(0,o[m])(void 0)}),u}var Sv=z.S;z.S=function(n,a){ab=Se(),typeof a=="object"&&a!==null&&typeof a.then=="function"&&JR(n,a),Sv!==null&&Sv(n,a)};var xa=D(null);function Pf(){var n=xa.current;return n!==null?n:pt.pooledCache}function Nc(n,a){a===null?W(xa,xa.current):W(xa,a.pool)}function Ev(){var n=Pf();return n===null?null:{parent:Ut._currentValue,pool:n}}var mi=Error(r(460)),Uf=Error(r(474)),Tc=Error(r(542)),jc={then:function(){}};function Nv(n){return n=n.status,n==="fulfilled"||n==="rejected"}function Tv(n,a,o){switch(o=n[o],o===void 0?n.push(a):o!==a&&(a.then(qs,qs),a=o),a.status){case"fulfilled":return a.value;case"rejected":throw n=a.reason,Cv(n),n;default:if(typeof a.status=="string")a.then(qs,qs);else{if(n=pt,n!==null&&100<n.shellSuspendCounter)throw Error(r(482));n=a,n.status="pending",n.then(function(u){if(a.status==="pending"){var m=a;m.status="fulfilled",m.value=u}},function(u){if(a.status==="pending"){var m=a;m.status="rejected",m.reason=u}})}switch(a.status){case"fulfilled":return a.value;case"rejected":throw n=a.reason,Cv(n),n}throw Sa=a,mi}}function wa(n){try{var a=n._init;return a(n._payload)}catch(o){throw o!==null&&typeof o=="object"&&typeof o.then=="function"?(Sa=o,mi):o}}var Sa=null;function jv(){if(Sa===null)throw Error(r(459));var n=Sa;return Sa=null,n}function Cv(n){if(n===mi||n===Tc)throw Error(r(483))}var gi=null,zo=0;function Cc(n){var a=zo;return zo+=1,gi===null&&(gi=[]),Tv(gi,n,a)}function Io(n,a){a=a.props.ref,n.ref=a!==void 0?a:null}function Rc(n,a){throw a.$$typeof===x?Error(r(525)):(n=Object.prototype.toString.call(a),Error(r(31,n==="[object Object]"?"object with keys {"+Object.keys(a).join(", ")+"}":n)))}function Rv(n){function a(q,V){if(n){var X=q.deletions;X===null?(q.deletions=[V],q.flags|=16):X.push(V)}}function o(q,V){if(!n)return null;for(;V!==null;)a(q,V),V=V.sibling;return null}function u(q){for(var V=new Map;q!==null;)q.key!==null?V.set(q.key,q):V.set(q.index,q),q=q.sibling;return V}function m(q,V){return q=Gs(q,V),q.index=0,q.sibling=null,q}function y(q,V,X){return q.index=X,n?(X=q.alternate,X!==null?(X=X.index,X<V?(q.flags|=67108866,V):X):(q.flags|=67108866,V)):(q.flags|=1048576,V)}function E(q){return n&&q.alternate===null&&(q.flags|=67108866),q}function k(q,V,X,ue){return V===null||V.tag!==6?(V=Cf(X,q.mode,ue),V.return=q,V):(V=m(V,X),V.return=q,V)}function P(q,V,X,ue){var Me=X.type;return Me===N?le(q,V,X.props.children,ue,X.key):V!==null&&(V.elementType===Me||typeof Me=="object"&&Me!==null&&Me.$$typeof===I&&wa(Me)===V.type)?(V=m(V,X.props),Io(V,X),V.return=q,V):(V=xc(X.type,X.key,X.props,null,q.mode,ue),Io(V,X),V.return=q,V)}function K(q,V,X,ue){return V===null||V.tag!==4||V.stateNode.containerInfo!==X.containerInfo||V.stateNode.implementation!==X.implementation?(V=Rf(X,q.mode,ue),V.return=q,V):(V=m(V,X.children||[]),V.return=q,V)}function le(q,V,X,ue,Me){return V===null||V.tag!==7?(V=ga(X,q.mode,ue,Me),V.return=q,V):(V=m(V,X),V.return=q,V)}function de(q,V,X){if(typeof V=="string"&&V!==""||typeof V=="number"||typeof V=="bigint")return V=Cf(""+V,q.mode,X),V.return=q,V;if(typeof V=="object"&&V!==null){switch(V.$$typeof){case w:return X=xc(V.type,V.key,V.props,null,q.mode,X),Io(X,V),X.return=q,X;case T:return V=Rf(V,q.mode,X),V.return=q,V;case I:return V=wa(V),de(q,V,X)}if(ee(V)||L(V))return V=ga(V,q.mode,X,null),V.return=q,V;if(typeof V.then=="function")return de(q,Cc(V),X);if(V.$$typeof===S)return de(q,Ec(q,V),X);Rc(q,V)}return null}function Q(q,V,X,ue){var Me=V!==null?V.key:null;if(typeof X=="string"&&X!==""||typeof X=="number"||typeof X=="bigint")return Me!==null?null:k(q,V,""+X,ue);if(typeof X=="object"&&X!==null){switch(X.$$typeof){case w:return X.key===Me?P(q,V,X,ue):null;case T:return X.key===Me?K(q,V,X,ue):null;case I:return X=wa(X),Q(q,V,X,ue)}if(ee(X)||L(X))return Me!==null?null:le(q,V,X,ue,null);if(typeof X.then=="function")return Q(q,V,Cc(X),ue);if(X.$$typeof===S)return Q(q,V,Ec(q,X),ue);Rc(q,X)}return null}function ne(q,V,X,ue,Me){if(typeof ue=="string"&&ue!==""||typeof ue=="number"||typeof ue=="bigint")return q=q.get(X)||null,k(V,q,""+ue,Me);if(typeof ue=="object"&&ue!==null){switch(ue.$$typeof){case w:return q=q.get(ue.key===null?X:ue.key)||null,P(V,q,ue,Me);case T:return q=q.get(ue.key===null?X:ue.key)||null,K(V,q,ue,Me);case I:return ue=wa(ue),ne(q,V,X,ue,Me)}if(ee(ue)||L(ue))return q=q.get(X)||null,le(V,q,ue,Me,null);if(typeof ue.then=="function")return ne(q,V,X,Cc(ue),Me);if(ue.$$typeof===S)return ne(q,V,X,Ec(V,ue),Me);Rc(V,ue)}return null}function Ne(q,V,X,ue){for(var Me=null,st=null,Ae=V,Be=V=0,Ke=null;Ae!==null&&Be<X.length;Be++){Ae.index>Be?(Ke=Ae,Ae=null):Ke=Ae.sibling;var rt=Q(q,Ae,X[Be],ue);if(rt===null){Ae===null&&(Ae=Ke);break}n&&Ae&&rt.alternate===null&&a(q,Ae),V=y(rt,V,Be),st===null?Me=rt:st.sibling=rt,st=rt,Ae=Ke}if(Be===X.length)return o(q,Ae),Je&&Xs(q,Be),Me;if(Ae===null){for(;Be<X.length;Be++)Ae=de(q,X[Be],ue),Ae!==null&&(V=y(Ae,V,Be),st===null?Me=Ae:st.sibling=Ae,st=Ae);return Je&&Xs(q,Be),Me}for(Ae=u(Ae);Be<X.length;Be++)Ke=ne(Ae,q,Be,X[Be],ue),Ke!==null&&(n&&Ke.alternate!==null&&Ae.delete(Ke.key===null?Be:Ke.key),V=y(Ke,V,Be),st===null?Me=Ke:st.sibling=Ke,st=Ke);return n&&Ae.forEach(function(Ur){return a(q,Ur)}),Je&&Xs(q,Be),Me}function ze(q,V,X,ue){if(X==null)throw Error(r(151));for(var Me=null,st=null,Ae=V,Be=V=0,Ke=null,rt=X.next();Ae!==null&&!rt.done;Be++,rt=X.next()){Ae.index>Be?(Ke=Ae,Ae=null):Ke=Ae.sibling;var Ur=Q(q,Ae,rt.value,ue);if(Ur===null){Ae===null&&(Ae=Ke);break}n&&Ae&&Ur.alternate===null&&a(q,Ae),V=y(Ur,V,Be),st===null?Me=Ur:st.sibling=Ur,st=Ur,Ae=Ke}if(rt.done)return o(q,Ae),Je&&Xs(q,Be),Me;if(Ae===null){for(;!rt.done;Be++,rt=X.next())rt=de(q,rt.value,ue),rt!==null&&(V=y(rt,V,Be),st===null?Me=rt:st.sibling=rt,st=rt);return Je&&Xs(q,Be),Me}for(Ae=u(Ae);!rt.done;Be++,rt=X.next())rt=ne(Ae,q,Be,rt.value,ue),rt!==null&&(n&&rt.alternate!==null&&Ae.delete(rt.key===null?Be:rt.key),V=y(rt,V,Be),st===null?Me=rt:st.sibling=rt,st=rt);return n&&Ae.forEach(function(u2){return a(q,u2)}),Je&&Xs(q,Be),Me}function ht(q,V,X,ue){if(typeof X=="object"&&X!==null&&X.type===N&&X.key===null&&(X=X.props.children),typeof X=="object"&&X!==null){switch(X.$$typeof){case w:e:{for(var Me=X.key;V!==null;){if(V.key===Me){if(Me=X.type,Me===N){if(V.tag===7){o(q,V.sibling),ue=m(V,X.props.children),ue.return=q,q=ue;break e}}else if(V.elementType===Me||typeof Me=="object"&&Me!==null&&Me.$$typeof===I&&wa(Me)===V.type){o(q,V.sibling),ue=m(V,X.props),Io(ue,X),ue.return=q,q=ue;break e}o(q,V);break}else a(q,V);V=V.sibling}X.type===N?(ue=ga(X.props.children,q.mode,ue,X.key),ue.return=q,q=ue):(ue=xc(X.type,X.key,X.props,null,q.mode,ue),Io(ue,X),ue.return=q,q=ue)}return E(q);case T:e:{for(Me=X.key;V!==null;){if(V.key===Me)if(V.tag===4&&V.stateNode.containerInfo===X.containerInfo&&V.stateNode.implementation===X.implementation){o(q,V.sibling),ue=m(V,X.children||[]),ue.return=q,q=ue;break e}else{o(q,V);break}else a(q,V);V=V.sibling}ue=Rf(X,q.mode,ue),ue.return=q,q=ue}return E(q);case I:return X=wa(X),ht(q,V,X,ue)}if(ee(X))return Ne(q,V,X,ue);if(L(X)){if(Me=L(X),typeof Me!="function")throw Error(r(150));return X=Me.call(X),ze(q,V,X,ue)}if(typeof X.then=="function")return ht(q,V,Cc(X),ue);if(X.$$typeof===S)return ht(q,V,Ec(q,X),ue);Rc(q,X)}return typeof X=="string"&&X!==""||typeof X=="number"||typeof X=="bigint"?(X=""+X,V!==null&&V.tag===6?(o(q,V.sibling),ue=m(V,X),ue.return=q,q=ue):(o(q,V),ue=Cf(X,q.mode,ue),ue.return=q,q=ue),E(q)):o(q,V)}return function(q,V,X,ue){try{zo=0;var Me=ht(q,V,X,ue);return gi=null,Me}catch(Ae){if(Ae===mi||Ae===Tc)throw Ae;var st=Un(29,Ae,null,q.mode);return st.lanes=ue,st.return=q,st}}}var Ea=Rv(!0),Av=Rv(!1),Sr=!1;function $f(n){n.updateQueue={baseState:n.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Vf(n,a){n=n.updateQueue,a.updateQueue===n&&(a.updateQueue={baseState:n.baseState,firstBaseUpdate:n.firstBaseUpdate,lastBaseUpdate:n.lastBaseUpdate,shared:n.shared,callbacks:null})}function Er(n){return{lane:n,tag:0,payload:null,callback:null,next:null}}function Nr(n,a,o){var u=n.updateQueue;if(u===null)return null;if(u=u.shared,(at&2)!==0){var m=u.pending;return m===null?a.next=a:(a.next=m.next,m.next=a),u.pending=a,a=bc(n),fv(n,null,o),a}return vc(n,u,a,o),bc(n)}function Lo(n,a,o){if(a=a.updateQueue,a!==null&&(a=a.shared,(o&4194048)!==0)){var u=a.lanes;u&=n.pendingLanes,o|=u,a.lanes=o,nc(n,o)}}function Bf(n,a){var o=n.updateQueue,u=n.alternate;if(u!==null&&(u=u.updateQueue,o===u)){var m=null,y=null;if(o=o.firstBaseUpdate,o!==null){do{var E={lane:o.lane,tag:o.tag,payload:o.payload,callback:null,next:null};y===null?m=y=E:y=y.next=E,o=o.next}while(o!==null);y===null?m=y=a:y=y.next=a}else m=y=a;o={baseState:u.baseState,firstBaseUpdate:m,lastBaseUpdate:y,shared:u.shared,callbacks:u.callbacks},n.updateQueue=o;return}n=o.lastBaseUpdate,n===null?o.firstBaseUpdate=a:n.next=a,o.lastBaseUpdate=a}var Zf=!1;function Po(){if(Zf){var n=pi;if(n!==null)throw n}}function Uo(n,a,o,u){Zf=!1;var m=n.updateQueue;Sr=!1;var y=m.firstBaseUpdate,E=m.lastBaseUpdate,k=m.shared.pending;if(k!==null){m.shared.pending=null;var P=k,K=P.next;P.next=null,E===null?y=K:E.next=K,E=P;var le=n.alternate;le!==null&&(le=le.updateQueue,k=le.lastBaseUpdate,k!==E&&(k===null?le.firstBaseUpdate=K:k.next=K,le.lastBaseUpdate=P))}if(y!==null){var de=m.baseState;E=0,le=K=P=null,k=y;do{var Q=k.lane&-536870913,ne=Q!==k.lane;if(ne?(Xe&Q)===Q:(u&Q)===Q){Q!==0&&Q===hi&&(Zf=!0),le!==null&&(le=le.next={lane:0,tag:k.tag,payload:k.payload,callback:null,next:null});e:{var Ne=n,ze=k;Q=a;var ht=o;switch(ze.tag){case 1:if(Ne=ze.payload,typeof Ne=="function"){de=Ne.call(ht,de,Q);break e}de=Ne;break e;case 3:Ne.flags=Ne.flags&-65537|128;case 0:if(Ne=ze.payload,Q=typeof Ne=="function"?Ne.call(ht,de,Q):Ne,Q==null)break e;de=v({},de,Q);break e;case 2:Sr=!0}}Q=k.callback,Q!==null&&(n.flags|=64,ne&&(n.flags|=8192),ne=m.callbacks,ne===null?m.callbacks=[Q]:ne.push(Q))}else ne={lane:Q,tag:k.tag,payload:k.payload,callback:k.callback,next:null},le===null?(K=le=ne,P=de):le=le.next=ne,E|=Q;if(k=k.next,k===null){if(k=m.shared.pending,k===null)break;ne=k,k=ne.next,ne.next=null,m.lastBaseUpdate=ne,m.shared.pending=null}}while(!0);le===null&&(P=de),m.baseState=P,m.firstBaseUpdate=K,m.lastBaseUpdate=le,y===null&&(m.shared.lanes=0),Ar|=E,n.lanes=E,n.memoizedState=de}}function _v(n,a){if(typeof n!="function")throw Error(r(191,n));n.call(a)}function kv(n,a){var o=n.callbacks;if(o!==null)for(n.callbacks=null,n=0;n<o.length;n++)_v(o[n],a)}var yi=D(null),Ac=D(0);function Mv(n,a){n=ir,W(Ac,n),W(yi,a),ir=n|a.baseLanes}function Hf(){W(Ac,ir),W(yi,yi.current)}function Ff(){ir=Ac.current,U(yi),U(Ac)}var $n=D(null),rs=null;function Tr(n){var a=n.alternate;W(It,It.current&1),W($n,n),rs===null&&(a===null||yi.current!==null||a.memoizedState!==null)&&(rs=n)}function qf(n){W(It,It.current),W($n,n),rs===null&&(rs=n)}function Ov(n){n.tag===22?(W(It,It.current),W($n,n),rs===null&&(rs=n)):jr()}function jr(){W(It,It.current),W($n,$n.current)}function Vn(n){U($n),rs===n&&(rs=null),U(It)}var It=D(0);function _c(n){for(var a=n;a!==null;){if(a.tag===13){var o=a.memoizedState;if(o!==null&&(o=o.dehydrated,o===null||Jh(o)||Qh(o)))return a}else if(a.tag===19&&(a.memoizedProps.revealOrder==="forwards"||a.memoizedProps.revealOrder==="backwards"||a.memoizedProps.revealOrder==="unstable_legacy-backwards"||a.memoizedProps.revealOrder==="together")){if((a.flags&128)!==0)return a}else if(a.child!==null){a.child.return=a,a=a.child;continue}if(a===n)break;for(;a.sibling===null;){if(a.return===null||a.return===n)return null;a=a.return}a.sibling.return=a.return,a=a.sibling}return null}var Js=0,Ve=null,dt=null,$t=null,kc=!1,vi=!1,Na=!1,Mc=0,$o=0,bi=null,eA=0;function Mt(){throw Error(r(321))}function Yf(n,a){if(a===null)return!1;for(var o=0;o<a.length&&o<n.length;o++)if(!Pn(n[o],a[o]))return!1;return!0}function Gf(n,a,o,u,m,y){return Js=y,Ve=a,a.memoizedState=null,a.updateQueue=null,a.lanes=0,z.H=n===null||n.memoizedState===null?g0:ch,Na=!1,y=o(u,m),Na=!1,vi&&(y=zv(a,o,u,m)),Dv(n),y}function Dv(n){z.H=Zo;var a=dt!==null&&dt.next!==null;if(Js=0,$t=dt=Ve=null,kc=!1,$o=0,bi=null,a)throw Error(r(300));n===null||Vt||(n=n.dependencies,n!==null&&Sc(n)&&(Vt=!0))}function zv(n,a,o,u){Ve=n;var m=0;do{if(vi&&(bi=null),$o=0,vi=!1,25<=m)throw Error(r(301));if(m+=1,$t=dt=null,n.updateQueue!=null){var y=n.updateQueue;y.lastEffect=null,y.events=null,y.stores=null,y.memoCache!=null&&(y.memoCache.index=0)}z.H=y0,y=a(o,u)}while(vi);return y}function tA(){var n=z.H,a=n.useState()[0];return a=typeof a.then=="function"?Vo(a):a,n=n.useState()[0],(dt!==null?dt.memoizedState:null)!==n&&(Ve.flags|=1024),a}function Xf(){var n=Mc!==0;return Mc=0,n}function Kf(n,a,o){a.updateQueue=n.updateQueue,a.flags&=-2053,n.lanes&=~o}function Wf(n){if(kc){for(n=n.memoizedState;n!==null;){var a=n.queue;a!==null&&(a.pending=null),n=n.next}kc=!1}Js=0,$t=dt=Ve=null,vi=!1,$o=Mc=0,bi=null}function yn(){var n={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return $t===null?Ve.memoizedState=$t=n:$t=$t.next=n,$t}function Lt(){if(dt===null){var n=Ve.alternate;n=n!==null?n.memoizedState:null}else n=dt.next;var a=$t===null?Ve.memoizedState:$t.next;if(a!==null)$t=a,dt=n;else{if(n===null)throw Ve.alternate===null?Error(r(467)):Error(r(310));dt=n,n={memoizedState:dt.memoizedState,baseState:dt.baseState,baseQueue:dt.baseQueue,queue:dt.queue,next:null},$t===null?Ve.memoizedState=$t=n:$t=$t.next=n}return $t}function Oc(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Vo(n){var a=$o;return $o+=1,bi===null&&(bi=[]),n=Tv(bi,n,a),a=Ve,($t===null?a.memoizedState:$t.next)===null&&(a=a.alternate,z.H=a===null||a.memoizedState===null?g0:ch),n}function Dc(n){if(n!==null&&typeof n=="object"){if(typeof n.then=="function")return Vo(n);if(n.$$typeof===S)return sn(n)}throw Error(r(438,String(n)))}function Jf(n){var a=null,o=Ve.updateQueue;if(o!==null&&(a=o.memoCache),a==null){var u=Ve.alternate;u!==null&&(u=u.updateQueue,u!==null&&(u=u.memoCache,u!=null&&(a={data:u.data.map(function(m){return m.slice()}),index:0})))}if(a==null&&(a={data:[],index:0}),o===null&&(o=Oc(),Ve.updateQueue=o),o.memoCache=a,o=a.data[a.index],o===void 0)for(o=a.data[a.index]=Array(n),u=0;u<n;u++)o[u]=F;return a.index++,o}function Qs(n,a){return typeof a=="function"?a(n):a}function zc(n){var a=Lt();return Qf(a,dt,n)}function Qf(n,a,o){var u=n.queue;if(u===null)throw Error(r(311));u.lastRenderedReducer=o;var m=n.baseQueue,y=u.pending;if(y!==null){if(m!==null){var E=m.next;m.next=y.next,y.next=E}a.baseQueue=m=y,u.pending=null}if(y=n.baseState,m===null)n.memoizedState=y;else{a=m.next;var k=E=null,P=null,K=a,le=!1;do{var de=K.lane&-536870913;if(de!==K.lane?(Xe&de)===de:(Js&de)===de){var Q=K.revertLane;if(Q===0)P!==null&&(P=P.next={lane:0,revertLane:0,gesture:null,action:K.action,hasEagerState:K.hasEagerState,eagerState:K.eagerState,next:null}),de===hi&&(le=!0);else if((Js&Q)===Q){K=K.next,Q===hi&&(le=!0);continue}else de={lane:0,revertLane:K.revertLane,gesture:null,action:K.action,hasEagerState:K.hasEagerState,eagerState:K.eagerState,next:null},P===null?(k=P=de,E=y):P=P.next=de,Ve.lanes|=Q,Ar|=Q;de=K.action,Na&&o(y,de),y=K.hasEagerState?K.eagerState:o(y,de)}else Q={lane:de,revertLane:K.revertLane,gesture:K.gesture,action:K.action,hasEagerState:K.hasEagerState,eagerState:K.eagerState,next:null},P===null?(k=P=Q,E=y):P=P.next=Q,Ve.lanes|=de,Ar|=de;K=K.next}while(K!==null&&K!==a);if(P===null?E=y:P.next=k,!Pn(y,n.memoizedState)&&(Vt=!0,le&&(o=pi,o!==null)))throw o;n.memoizedState=y,n.baseState=E,n.baseQueue=P,u.lastRenderedState=y}return m===null&&(u.lanes=0),[n.memoizedState,u.dispatch]}function eh(n){var a=Lt(),o=a.queue;if(o===null)throw Error(r(311));o.lastRenderedReducer=n;var u=o.dispatch,m=o.pending,y=a.memoizedState;if(m!==null){o.pending=null;var E=m=m.next;do y=n(y,E.action),E=E.next;while(E!==m);Pn(y,a.memoizedState)||(Vt=!0),a.memoizedState=y,a.baseQueue===null&&(a.baseState=y),o.lastRenderedState=y}return[y,u]}function Iv(n,a,o){var u=Ve,m=Lt(),y=Je;if(y){if(o===void 0)throw Error(r(407));o=o()}else o=a();var E=!Pn((dt||m).memoizedState,o);if(E&&(m.memoizedState=o,Vt=!0),m=m.queue,sh(Uv.bind(null,u,m,n),[n]),m.getSnapshot!==a||E||$t!==null&&$t.memoizedState.tag&1){if(u.flags|=2048,xi(9,{destroy:void 0},Pv.bind(null,u,m,o,a),null),pt===null)throw Error(r(349));y||(Js&127)!==0||Lv(u,a,o)}return o}function Lv(n,a,o){n.flags|=16384,n={getSnapshot:a,value:o},a=Ve.updateQueue,a===null?(a=Oc(),Ve.updateQueue=a,a.stores=[n]):(o=a.stores,o===null?a.stores=[n]:o.push(n))}function Pv(n,a,o,u){a.value=o,a.getSnapshot=u,$v(a)&&Vv(n)}function Uv(n,a,o){return o(function(){$v(a)&&Vv(n)})}function $v(n){var a=n.getSnapshot;n=n.value;try{var o=a();return!Pn(n,o)}catch{return!0}}function Vv(n){var a=ma(n,2);a!==null&&Mn(a,n,2)}function th(n){var a=yn();if(typeof n=="function"){var o=n;if(n=o(),Na){et(!0);try{o()}finally{et(!1)}}}return a.memoizedState=a.baseState=n,a.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Qs,lastRenderedState:n},a}function Bv(n,a,o,u){return n.baseState=o,Qf(n,dt,typeof u=="function"?u:Qs)}function nA(n,a,o,u,m){if(Pc(n))throw Error(r(485));if(n=a.action,n!==null){var y={payload:m,action:n,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(E){y.listeners.push(E)}};z.T!==null?o(!0):y.isTransition=!1,u(y),o=a.pending,o===null?(y.next=a.pending=y,Zv(a,y)):(y.next=o.next,a.pending=o.next=y)}}function Zv(n,a){var o=a.action,u=a.payload,m=n.state;if(a.isTransition){var y=z.T,E={};z.T=E;try{var k=o(m,u),P=z.S;P!==null&&P(E,k),Hv(n,a,k)}catch(K){nh(n,a,K)}finally{y!==null&&E.types!==null&&(y.types=E.types),z.T=y}}else try{y=o(m,u),Hv(n,a,y)}catch(K){nh(n,a,K)}}function Hv(n,a,o){o!==null&&typeof o=="object"&&typeof o.then=="function"?o.then(function(u){Fv(n,a,u)},function(u){return nh(n,a,u)}):Fv(n,a,o)}function Fv(n,a,o){a.status="fulfilled",a.value=o,qv(a),n.state=o,a=n.pending,a!==null&&(o=a.next,o===a?n.pending=null:(o=o.next,a.next=o,Zv(n,o)))}function nh(n,a,o){var u=n.pending;if(n.pending=null,u!==null){u=u.next;do a.status="rejected",a.reason=o,qv(a),a=a.next;while(a!==u)}n.action=null}function qv(n){n=n.listeners;for(var a=0;a<n.length;a++)(0,n[a])()}function Yv(n,a){return a}function Gv(n,a){if(Je){var o=pt.formState;if(o!==null){e:{var u=Ve;if(Je){if(bt){t:{for(var m=bt,y=ss;m.nodeType!==8;){if(!y){m=null;break t}if(m=as(m.nextSibling),m===null){m=null;break t}}y=m.data,m=y==="F!"||y==="F"?m:null}if(m){bt=as(m.nextSibling),u=m.data==="F!";break e}}xr(u)}u=!1}u&&(a=o[0])}}return o=yn(),o.memoizedState=o.baseState=a,u={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Yv,lastRenderedState:a},o.queue=u,o=h0.bind(null,Ve,u),u.dispatch=o,u=th(!1),y=lh.bind(null,Ve,!1,u.queue),u=yn(),m={state:a,dispatch:null,action:n,pending:null},u.queue=m,o=nA.bind(null,Ve,m,y,o),m.dispatch=o,u.memoizedState=n,[a,o,!1]}function Xv(n){var a=Lt();return Kv(a,dt,n)}function Kv(n,a,o){if(a=Qf(n,a,Yv)[0],n=zc(Qs)[0],typeof a=="object"&&a!==null&&typeof a.then=="function")try{var u=Vo(a)}catch(E){throw E===mi?Tc:E}else u=a;a=Lt();var m=a.queue,y=m.dispatch;return o!==a.memoizedState&&(Ve.flags|=2048,xi(9,{destroy:void 0},sA.bind(null,m,o),null)),[u,y,n]}function sA(n,a){n.action=a}function Wv(n){var a=Lt(),o=dt;if(o!==null)return Kv(a,o,n);Lt(),a=a.memoizedState,o=Lt();var u=o.queue.dispatch;return o.memoizedState=n,[a,u,!1]}function xi(n,a,o,u){return n={tag:n,create:o,deps:u,inst:a,next:null},a=Ve.updateQueue,a===null&&(a=Oc(),Ve.updateQueue=a),o=a.lastEffect,o===null?a.lastEffect=n.next=n:(u=o.next,o.next=n,n.next=u,a.lastEffect=n),n}function Jv(){return Lt().memoizedState}function Ic(n,a,o,u){var m=yn();Ve.flags|=n,m.memoizedState=xi(1|a,{destroy:void 0},o,u===void 0?null:u)}function Lc(n,a,o,u){var m=Lt();u=u===void 0?null:u;var y=m.memoizedState.inst;dt!==null&&u!==null&&Yf(u,dt.memoizedState.deps)?m.memoizedState=xi(a,y,o,u):(Ve.flags|=n,m.memoizedState=xi(1|a,y,o,u))}function Qv(n,a){Ic(8390656,8,n,a)}function sh(n,a){Lc(2048,8,n,a)}function rA(n){Ve.flags|=4;var a=Ve.updateQueue;if(a===null)a=Oc(),Ve.updateQueue=a,a.events=[n];else{var o=a.events;o===null?a.events=[n]:o.push(n)}}function e0(n){var a=Lt().memoizedState;return rA({ref:a,nextImpl:n}),function(){if((at&2)!==0)throw Error(r(440));return a.impl.apply(void 0,arguments)}}function t0(n,a){return Lc(4,2,n,a)}function n0(n,a){return Lc(4,4,n,a)}function s0(n,a){if(typeof a=="function"){n=n();var o=a(n);return function(){typeof o=="function"?o():a(null)}}if(a!=null)return n=n(),a.current=n,function(){a.current=null}}function r0(n,a,o){o=o!=null?o.concat([n]):null,Lc(4,4,s0.bind(null,a,n),o)}function rh(){}function a0(n,a){var o=Lt();a=a===void 0?null:a;var u=o.memoizedState;return a!==null&&Yf(a,u[1])?u[0]:(o.memoizedState=[n,a],n)}function i0(n,a){var o=Lt();a=a===void 0?null:a;var u=o.memoizedState;if(a!==null&&Yf(a,u[1]))return u[0];if(u=n(),Na){et(!0);try{n()}finally{et(!1)}}return o.memoizedState=[u,a],u}function ah(n,a,o){return o===void 0||(Js&1073741824)!==0&&(Xe&261930)===0?n.memoizedState=a:(n.memoizedState=o,n=ob(),Ve.lanes|=n,Ar|=n,o)}function o0(n,a,o,u){return Pn(o,a)?o:yi.current!==null?(n=ah(n,o,u),Pn(n,a)||(Vt=!0),n):(Js&42)===0||(Js&1073741824)!==0&&(Xe&261930)===0?(Vt=!0,n.memoizedState=o):(n=ob(),Ve.lanes|=n,Ar|=n,a)}function l0(n,a,o,u,m){var y=Z.p;Z.p=y!==0&&8>y?y:8;var E=z.T,k={};z.T=k,lh(n,!1,a,o);try{var P=m(),K=z.S;if(K!==null&&K(k,P),P!==null&&typeof P=="object"&&typeof P.then=="function"){var le=QR(P,u);Bo(n,a,le,Hn(n))}else Bo(n,a,u,Hn(n))}catch(de){Bo(n,a,{then:function(){},status:"rejected",reason:de},Hn())}finally{Z.p=y,E!==null&&k.types!==null&&(E.types=k.types),z.T=E}}function aA(){}function ih(n,a,o,u){if(n.tag!==5)throw Error(r(476));var m=c0(n).queue;l0(n,m,a,B,o===null?aA:function(){return u0(n),o(u)})}function c0(n){var a=n.memoizedState;if(a!==null)return a;a={memoizedState:B,baseState:B,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Qs,lastRenderedState:B},next:null};var o={};return a.next={memoizedState:o,baseState:o,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Qs,lastRenderedState:o},next:null},n.memoizedState=a,n=n.alternate,n!==null&&(n.memoizedState=a),a}function u0(n){var a=c0(n);a.next===null&&(a=n.alternate.memoizedState),Bo(n,a.next.queue,{},Hn())}function oh(){return sn(al)}function d0(){return Lt().memoizedState}function f0(){return Lt().memoizedState}function iA(n){for(var a=n.return;a!==null;){switch(a.tag){case 24:case 3:var o=Hn();n=Er(o);var u=Nr(a,n,o);u!==null&&(Mn(u,a,o),Lo(u,a,o)),a={cache:If()},n.payload=a;return}a=a.return}}function oA(n,a,o){var u=Hn();o={lane:u,revertLane:0,gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null},Pc(n)?p0(a,o):(o=Tf(n,a,o,u),o!==null&&(Mn(o,n,u),m0(o,a,u)))}function h0(n,a,o){var u=Hn();Bo(n,a,o,u)}function Bo(n,a,o,u){var m={lane:u,revertLane:0,gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null};if(Pc(n))p0(a,m);else{var y=n.alternate;if(n.lanes===0&&(y===null||y.lanes===0)&&(y=a.lastRenderedReducer,y!==null))try{var E=a.lastRenderedState,k=y(E,o);if(m.hasEagerState=!0,m.eagerState=k,Pn(k,E))return vc(n,a,m,0),pt===null&&yc(),!1}catch{}if(o=Tf(n,a,m,u),o!==null)return Mn(o,n,u),m0(o,a,u),!0}return!1}function lh(n,a,o,u){if(u={lane:2,revertLane:$h(),gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null},Pc(n)){if(a)throw Error(r(479))}else a=Tf(n,o,u,2),a!==null&&Mn(a,n,2)}function Pc(n){var a=n.alternate;return n===Ve||a!==null&&a===Ve}function p0(n,a){vi=kc=!0;var o=n.pending;o===null?a.next=a:(a.next=o.next,o.next=a),n.pending=a}function m0(n,a,o){if((o&4194048)!==0){var u=a.lanes;u&=n.pendingLanes,o|=u,a.lanes=o,nc(n,o)}}var Zo={readContext:sn,use:Dc,useCallback:Mt,useContext:Mt,useEffect:Mt,useImperativeHandle:Mt,useLayoutEffect:Mt,useInsertionEffect:Mt,useMemo:Mt,useReducer:Mt,useRef:Mt,useState:Mt,useDebugValue:Mt,useDeferredValue:Mt,useTransition:Mt,useSyncExternalStore:Mt,useId:Mt,useHostTransitionStatus:Mt,useFormState:Mt,useActionState:Mt,useOptimistic:Mt,useMemoCache:Mt,useCacheRefresh:Mt};Zo.useEffectEvent=Mt;var g0={readContext:sn,use:Dc,useCallback:function(n,a){return yn().memoizedState=[n,a===void 0?null:a],n},useContext:sn,useEffect:Qv,useImperativeHandle:function(n,a,o){o=o!=null?o.concat([n]):null,Ic(4194308,4,s0.bind(null,a,n),o)},useLayoutEffect:function(n,a){return Ic(4194308,4,n,a)},useInsertionEffect:function(n,a){Ic(4,2,n,a)},useMemo:function(n,a){var o=yn();a=a===void 0?null:a;var u=n();if(Na){et(!0);try{n()}finally{et(!1)}}return o.memoizedState=[u,a],u},useReducer:function(n,a,o){var u=yn();if(o!==void 0){var m=o(a);if(Na){et(!0);try{o(a)}finally{et(!1)}}}else m=a;return u.memoizedState=u.baseState=m,n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:n,lastRenderedState:m},u.queue=n,n=n.dispatch=oA.bind(null,Ve,n),[u.memoizedState,n]},useRef:function(n){var a=yn();return n={current:n},a.memoizedState=n},useState:function(n){n=th(n);var a=n.queue,o=h0.bind(null,Ve,a);return a.dispatch=o,[n.memoizedState,o]},useDebugValue:rh,useDeferredValue:function(n,a){var o=yn();return ah(o,n,a)},useTransition:function(){var n=th(!1);return n=l0.bind(null,Ve,n.queue,!0,!1),yn().memoizedState=n,[!1,n]},useSyncExternalStore:function(n,a,o){var u=Ve,m=yn();if(Je){if(o===void 0)throw Error(r(407));o=o()}else{if(o=a(),pt===null)throw Error(r(349));(Xe&127)!==0||Lv(u,a,o)}m.memoizedState=o;var y={value:o,getSnapshot:a};return m.queue=y,Qv(Uv.bind(null,u,y,n),[n]),u.flags|=2048,xi(9,{destroy:void 0},Pv.bind(null,u,y,o,a),null),o},useId:function(){var n=yn(),a=pt.identifierPrefix;if(Je){var o=Cs,u=js;o=(u&~(1<<32-nt(u)-1)).toString(32)+o,a="_"+a+"R_"+o,o=Mc++,0<o&&(a+="H"+o.toString(32)),a+="_"}else o=eA++,a="_"+a+"r_"+o.toString(32)+"_";return n.memoizedState=a},useHostTransitionStatus:oh,useFormState:Gv,useActionState:Gv,useOptimistic:function(n){var a=yn();a.memoizedState=a.baseState=n;var o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return a.queue=o,a=lh.bind(null,Ve,!0,o),o.dispatch=a,[n,a]},useMemoCache:Jf,useCacheRefresh:function(){return yn().memoizedState=iA.bind(null,Ve)},useEffectEvent:function(n){var a=yn(),o={impl:n};return a.memoizedState=o,function(){if((at&2)!==0)throw Error(r(440));return o.impl.apply(void 0,arguments)}}},ch={readContext:sn,use:Dc,useCallback:a0,useContext:sn,useEffect:sh,useImperativeHandle:r0,useInsertionEffect:t0,useLayoutEffect:n0,useMemo:i0,useReducer:zc,useRef:Jv,useState:function(){return zc(Qs)},useDebugValue:rh,useDeferredValue:function(n,a){var o=Lt();return o0(o,dt.memoizedState,n,a)},useTransition:function(){var n=zc(Qs)[0],a=Lt().memoizedState;return[typeof n=="boolean"?n:Vo(n),a]},useSyncExternalStore:Iv,useId:d0,useHostTransitionStatus:oh,useFormState:Xv,useActionState:Xv,useOptimistic:function(n,a){var o=Lt();return Bv(o,dt,n,a)},useMemoCache:Jf,useCacheRefresh:f0};ch.useEffectEvent=e0;var y0={readContext:sn,use:Dc,useCallback:a0,useContext:sn,useEffect:sh,useImperativeHandle:r0,useInsertionEffect:t0,useLayoutEffect:n0,useMemo:i0,useReducer:eh,useRef:Jv,useState:function(){return eh(Qs)},useDebugValue:rh,useDeferredValue:function(n,a){var o=Lt();return dt===null?ah(o,n,a):o0(o,dt.memoizedState,n,a)},useTransition:function(){var n=eh(Qs)[0],a=Lt().memoizedState;return[typeof n=="boolean"?n:Vo(n),a]},useSyncExternalStore:Iv,useId:d0,useHostTransitionStatus:oh,useFormState:Wv,useActionState:Wv,useOptimistic:function(n,a){var o=Lt();return dt!==null?Bv(o,dt,n,a):(o.baseState=n,[n,o.queue.dispatch])},useMemoCache:Jf,useCacheRefresh:f0};y0.useEffectEvent=e0;function uh(n,a,o,u){a=n.memoizedState,o=o(u,a),o=o==null?a:v({},a,o),n.memoizedState=o,n.lanes===0&&(n.updateQueue.baseState=o)}var dh={enqueueSetState:function(n,a,o){n=n._reactInternals;var u=Hn(),m=Er(u);m.payload=a,o!=null&&(m.callback=o),a=Nr(n,m,u),a!==null&&(Mn(a,n,u),Lo(a,n,u))},enqueueReplaceState:function(n,a,o){n=n._reactInternals;var u=Hn(),m=Er(u);m.tag=1,m.payload=a,o!=null&&(m.callback=o),a=Nr(n,m,u),a!==null&&(Mn(a,n,u),Lo(a,n,u))},enqueueForceUpdate:function(n,a){n=n._reactInternals;var o=Hn(),u=Er(o);u.tag=2,a!=null&&(u.callback=a),a=Nr(n,u,o),a!==null&&(Mn(a,n,o),Lo(a,n,o))}};function v0(n,a,o,u,m,y,E){return n=n.stateNode,typeof n.shouldComponentUpdate=="function"?n.shouldComponentUpdate(u,y,E):a.prototype&&a.prototype.isPureReactComponent?!Ao(o,u)||!Ao(m,y):!0}function b0(n,a,o,u){n=a.state,typeof a.componentWillReceiveProps=="function"&&a.componentWillReceiveProps(o,u),typeof a.UNSAFE_componentWillReceiveProps=="function"&&a.UNSAFE_componentWillReceiveProps(o,u),a.state!==n&&dh.enqueueReplaceState(a,a.state,null)}function Ta(n,a){var o=a;if("ref"in a){o={};for(var u in a)u!=="ref"&&(o[u]=a[u])}if(n=n.defaultProps){o===a&&(o=v({},o));for(var m in n)o[m]===void 0&&(o[m]=n[m])}return o}function x0(n){gc(n)}function w0(n){console.error(n)}function S0(n){gc(n)}function Uc(n,a){try{var o=n.onUncaughtError;o(a.value,{componentStack:a.stack})}catch(u){setTimeout(function(){throw u})}}function E0(n,a,o){try{var u=n.onCaughtError;u(o.value,{componentStack:o.stack,errorBoundary:a.tag===1?a.stateNode:null})}catch(m){setTimeout(function(){throw m})}}function fh(n,a,o){return o=Er(o),o.tag=3,o.payload={element:null},o.callback=function(){Uc(n,a)},o}function N0(n){return n=Er(n),n.tag=3,n}function T0(n,a,o,u){var m=o.type.getDerivedStateFromError;if(typeof m=="function"){var y=u.value;n.payload=function(){return m(y)},n.callback=function(){E0(a,o,u)}}var E=o.stateNode;E!==null&&typeof E.componentDidCatch=="function"&&(n.callback=function(){E0(a,o,u),typeof m!="function"&&(_r===null?_r=new Set([this]):_r.add(this));var k=u.stack;this.componentDidCatch(u.value,{componentStack:k!==null?k:""})})}function lA(n,a,o,u,m){if(o.flags|=32768,u!==null&&typeof u=="object"&&typeof u.then=="function"){if(a=o.alternate,a!==null&&fi(a,o,m,!0),o=$n.current,o!==null){switch(o.tag){case 31:case 13:return rs===null?Wc():o.alternate===null&&Ot===0&&(Ot=3),o.flags&=-257,o.flags|=65536,o.lanes=m,u===jc?o.flags|=16384:(a=o.updateQueue,a===null?o.updateQueue=new Set([u]):a.add(u),Lh(n,u,m)),!1;case 22:return o.flags|=65536,u===jc?o.flags|=16384:(a=o.updateQueue,a===null?(a={transitions:null,markerInstances:null,retryQueue:new Set([u])},o.updateQueue=a):(o=a.retryQueue,o===null?a.retryQueue=new Set([u]):o.add(u)),Lh(n,u,m)),!1}throw Error(r(435,o.tag))}return Lh(n,u,m),Wc(),!1}if(Je)return a=$n.current,a!==null?((a.flags&65536)===0&&(a.flags|=256),a.flags|=65536,a.lanes=m,u!==kf&&(n=Error(r(422),{cause:u}),Mo(es(n,o)))):(u!==kf&&(a=Error(r(423),{cause:u}),Mo(es(a,o))),n=n.current.alternate,n.flags|=65536,m&=-m,n.lanes|=m,u=es(u,o),m=fh(n.stateNode,u,m),Bf(n,m),Ot!==4&&(Ot=2)),!1;var y=Error(r(520),{cause:u});if(y=es(y,o),Wo===null?Wo=[y]:Wo.push(y),Ot!==4&&(Ot=2),a===null)return!0;u=es(u,o),o=a;do{switch(o.tag){case 3:return o.flags|=65536,n=m&-m,o.lanes|=n,n=fh(o.stateNode,u,n),Bf(o,n),!1;case 1:if(a=o.type,y=o.stateNode,(o.flags&128)===0&&(typeof a.getDerivedStateFromError=="function"||y!==null&&typeof y.componentDidCatch=="function"&&(_r===null||!_r.has(y))))return o.flags|=65536,m&=-m,o.lanes|=m,m=N0(m),T0(m,n,o,u),Bf(o,m),!1}o=o.return}while(o!==null);return!1}var hh=Error(r(461)),Vt=!1;function rn(n,a,o,u){a.child=n===null?Av(a,null,o,u):Ea(a,n.child,o,u)}function j0(n,a,o,u,m){o=o.render;var y=a.ref;if("ref"in u){var E={};for(var k in u)k!=="ref"&&(E[k]=u[k])}else E=u;return ba(a),u=Gf(n,a,o,E,y,m),k=Xf(),n!==null&&!Vt?(Kf(n,a,m),er(n,a,m)):(Je&&k&&Af(a),a.flags|=1,rn(n,a,u,m),a.child)}function C0(n,a,o,u,m){if(n===null){var y=o.type;return typeof y=="function"&&!jf(y)&&y.defaultProps===void 0&&o.compare===null?(a.tag=15,a.type=y,R0(n,a,y,u,m)):(n=xc(o.type,null,u,a,a.mode,m),n.ref=a.ref,n.return=a,a.child=n)}if(y=n.child,!wh(n,m)){var E=y.memoizedProps;if(o=o.compare,o=o!==null?o:Ao,o(E,u)&&n.ref===a.ref)return er(n,a,m)}return a.flags|=1,n=Gs(y,u),n.ref=a.ref,n.return=a,a.child=n}function R0(n,a,o,u,m){if(n!==null){var y=n.memoizedProps;if(Ao(y,u)&&n.ref===a.ref)if(Vt=!1,a.pendingProps=u=y,wh(n,m))(n.flags&131072)!==0&&(Vt=!0);else return a.lanes=n.lanes,er(n,a,m)}return ph(n,a,o,u,m)}function A0(n,a,o,u){var m=u.children,y=n!==null?n.memoizedState:null;if(n===null&&a.stateNode===null&&(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),u.mode==="hidden"){if((a.flags&128)!==0){if(y=y!==null?y.baseLanes|o:o,n!==null){for(u=a.child=n.child,m=0;u!==null;)m=m|u.lanes|u.childLanes,u=u.sibling;u=m&~y}else u=0,a.child=null;return _0(n,a,y,o,u)}if((o&536870912)!==0)a.memoizedState={baseLanes:0,cachePool:null},n!==null&&Nc(a,y!==null?y.cachePool:null),y!==null?Mv(a,y):Hf(),Ov(a);else return u=a.lanes=536870912,_0(n,a,y!==null?y.baseLanes|o:o,o,u)}else y!==null?(Nc(a,y.cachePool),Mv(a,y),jr(),a.memoizedState=null):(n!==null&&Nc(a,null),Hf(),jr());return rn(n,a,m,o),a.child}function Ho(n,a){return n!==null&&n.tag===22||a.stateNode!==null||(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),a.sibling}function _0(n,a,o,u,m){var y=Pf();return y=y===null?null:{parent:Ut._currentValue,pool:y},a.memoizedState={baseLanes:o,cachePool:y},n!==null&&Nc(a,null),Hf(),Ov(a),n!==null&&fi(n,a,u,!0),a.childLanes=m,null}function $c(n,a){return a=Bc({mode:a.mode,children:a.children},n.mode),a.ref=n.ref,n.child=a,a.return=n,a}function k0(n,a,o){return Ea(a,n.child,null,o),n=$c(a,a.pendingProps),n.flags|=2,Vn(a),a.memoizedState=null,n}function cA(n,a,o){var u=a.pendingProps,m=(a.flags&128)!==0;if(a.flags&=-129,n===null){if(Je){if(u.mode==="hidden")return n=$c(a,u),a.lanes=536870912,Ho(null,n);if(qf(a),(n=bt)?(n=Zb(n,ss),n=n!==null&&n.data==="&"?n:null,n!==null&&(a.memoizedState={dehydrated:n,treeContext:vr!==null?{id:js,overflow:Cs}:null,retryLane:536870912,hydrationErrors:null},o=pv(n),o.return=a,a.child=o,nn=a,bt=null)):n=null,n===null)throw xr(a);return a.lanes=536870912,null}return $c(a,u)}var y=n.memoizedState;if(y!==null){var E=y.dehydrated;if(qf(a),m)if(a.flags&256)a.flags&=-257,a=k0(n,a,o);else if(a.memoizedState!==null)a.child=n.child,a.flags|=128,a=null;else throw Error(r(558));else if(Vt||fi(n,a,o,!1),m=(o&n.childLanes)!==0,Vt||m){if(u=pt,u!==null&&(E=sc(u,o),E!==0&&E!==y.retryLane))throw y.retryLane=E,ma(n,E),Mn(u,n,E),hh;Wc(),a=k0(n,a,o)}else n=y.treeContext,bt=as(E.nextSibling),nn=a,Je=!0,br=null,ss=!1,n!==null&&yv(a,n),a=$c(a,u),a.flags|=4096;return a}return n=Gs(n.child,{mode:u.mode,children:u.children}),n.ref=a.ref,a.child=n,n.return=a,n}function Vc(n,a){var o=a.ref;if(o===null)n!==null&&n.ref!==null&&(a.flags|=4194816);else{if(typeof o!="function"&&typeof o!="object")throw Error(r(284));(n===null||n.ref!==o)&&(a.flags|=4194816)}}function ph(n,a,o,u,m){return ba(a),o=Gf(n,a,o,u,void 0,m),u=Xf(),n!==null&&!Vt?(Kf(n,a,m),er(n,a,m)):(Je&&u&&Af(a),a.flags|=1,rn(n,a,o,m),a.child)}function M0(n,a,o,u,m,y){return ba(a),a.updateQueue=null,o=zv(a,u,o,m),Dv(n),u=Xf(),n!==null&&!Vt?(Kf(n,a,y),er(n,a,y)):(Je&&u&&Af(a),a.flags|=1,rn(n,a,o,y),a.child)}function O0(n,a,o,u,m){if(ba(a),a.stateNode===null){var y=li,E=o.contextType;typeof E=="object"&&E!==null&&(y=sn(E)),y=new o(u,y),a.memoizedState=y.state!==null&&y.state!==void 0?y.state:null,y.updater=dh,a.stateNode=y,y._reactInternals=a,y=a.stateNode,y.props=u,y.state=a.memoizedState,y.refs={},$f(a),E=o.contextType,y.context=typeof E=="object"&&E!==null?sn(E):li,y.state=a.memoizedState,E=o.getDerivedStateFromProps,typeof E=="function"&&(uh(a,o,E,u),y.state=a.memoizedState),typeof o.getDerivedStateFromProps=="function"||typeof y.getSnapshotBeforeUpdate=="function"||typeof y.UNSAFE_componentWillMount!="function"&&typeof y.componentWillMount!="function"||(E=y.state,typeof y.componentWillMount=="function"&&y.componentWillMount(),typeof y.UNSAFE_componentWillMount=="function"&&y.UNSAFE_componentWillMount(),E!==y.state&&dh.enqueueReplaceState(y,y.state,null),Uo(a,u,y,m),Po(),y.state=a.memoizedState),typeof y.componentDidMount=="function"&&(a.flags|=4194308),u=!0}else if(n===null){y=a.stateNode;var k=a.memoizedProps,P=Ta(o,k);y.props=P;var K=y.context,le=o.contextType;E=li,typeof le=="object"&&le!==null&&(E=sn(le));var de=o.getDerivedStateFromProps;le=typeof de=="function"||typeof y.getSnapshotBeforeUpdate=="function",k=a.pendingProps!==k,le||typeof y.UNSAFE_componentWillReceiveProps!="function"&&typeof y.componentWillReceiveProps!="function"||(k||K!==E)&&b0(a,y,u,E),Sr=!1;var Q=a.memoizedState;y.state=Q,Uo(a,u,y,m),Po(),K=a.memoizedState,k||Q!==K||Sr?(typeof de=="function"&&(uh(a,o,de,u),K=a.memoizedState),(P=Sr||v0(a,o,P,u,Q,K,E))?(le||typeof y.UNSAFE_componentWillMount!="function"&&typeof y.componentWillMount!="function"||(typeof y.componentWillMount=="function"&&y.componentWillMount(),typeof y.UNSAFE_componentWillMount=="function"&&y.UNSAFE_componentWillMount()),typeof y.componentDidMount=="function"&&(a.flags|=4194308)):(typeof y.componentDidMount=="function"&&(a.flags|=4194308),a.memoizedProps=u,a.memoizedState=K),y.props=u,y.state=K,y.context=E,u=P):(typeof y.componentDidMount=="function"&&(a.flags|=4194308),u=!1)}else{y=a.stateNode,Vf(n,a),E=a.memoizedProps,le=Ta(o,E),y.props=le,de=a.pendingProps,Q=y.context,K=o.contextType,P=li,typeof K=="object"&&K!==null&&(P=sn(K)),k=o.getDerivedStateFromProps,(K=typeof k=="function"||typeof y.getSnapshotBeforeUpdate=="function")||typeof y.UNSAFE_componentWillReceiveProps!="function"&&typeof y.componentWillReceiveProps!="function"||(E!==de||Q!==P)&&b0(a,y,u,P),Sr=!1,Q=a.memoizedState,y.state=Q,Uo(a,u,y,m),Po();var ne=a.memoizedState;E!==de||Q!==ne||Sr||n!==null&&n.dependencies!==null&&Sc(n.dependencies)?(typeof k=="function"&&(uh(a,o,k,u),ne=a.memoizedState),(le=Sr||v0(a,o,le,u,Q,ne,P)||n!==null&&n.dependencies!==null&&Sc(n.dependencies))?(K||typeof y.UNSAFE_componentWillUpdate!="function"&&typeof y.componentWillUpdate!="function"||(typeof y.componentWillUpdate=="function"&&y.componentWillUpdate(u,ne,P),typeof y.UNSAFE_componentWillUpdate=="function"&&y.UNSAFE_componentWillUpdate(u,ne,P)),typeof y.componentDidUpdate=="function"&&(a.flags|=4),typeof y.getSnapshotBeforeUpdate=="function"&&(a.flags|=1024)):(typeof y.componentDidUpdate!="function"||E===n.memoizedProps&&Q===n.memoizedState||(a.flags|=4),typeof y.getSnapshotBeforeUpdate!="function"||E===n.memoizedProps&&Q===n.memoizedState||(a.flags|=1024),a.memoizedProps=u,a.memoizedState=ne),y.props=u,y.state=ne,y.context=P,u=le):(typeof y.componentDidUpdate!="function"||E===n.memoizedProps&&Q===n.memoizedState||(a.flags|=4),typeof y.getSnapshotBeforeUpdate!="function"||E===n.memoizedProps&&Q===n.memoizedState||(a.flags|=1024),u=!1)}return y=u,Vc(n,a),u=(a.flags&128)!==0,y||u?(y=a.stateNode,o=u&&typeof o.getDerivedStateFromError!="function"?null:y.render(),a.flags|=1,n!==null&&u?(a.child=Ea(a,n.child,null,m),a.child=Ea(a,null,o,m)):rn(n,a,o,m),a.memoizedState=y.state,n=a.child):n=er(n,a,m),n}function D0(n,a,o,u){return ya(),a.flags|=256,rn(n,a,o,u),a.child}var mh={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function gh(n){return{baseLanes:n,cachePool:Ev()}}function yh(n,a,o){return n=n!==null?n.childLanes&~o:0,a&&(n|=Zn),n}function z0(n,a,o){var u=a.pendingProps,m=!1,y=(a.flags&128)!==0,E;if((E=y)||(E=n!==null&&n.memoizedState===null?!1:(It.current&2)!==0),E&&(m=!0,a.flags&=-129),E=(a.flags&32)!==0,a.flags&=-33,n===null){if(Je){if(m?Tr(a):jr(),(n=bt)?(n=Zb(n,ss),n=n!==null&&n.data!=="&"?n:null,n!==null&&(a.memoizedState={dehydrated:n,treeContext:vr!==null?{id:js,overflow:Cs}:null,retryLane:536870912,hydrationErrors:null},o=pv(n),o.return=a,a.child=o,nn=a,bt=null)):n=null,n===null)throw xr(a);return Qh(n)?a.lanes=32:a.lanes=536870912,null}var k=u.children;return u=u.fallback,m?(jr(),m=a.mode,k=Bc({mode:"hidden",children:k},m),u=ga(u,m,o,null),k.return=a,u.return=a,k.sibling=u,a.child=k,u=a.child,u.memoizedState=gh(o),u.childLanes=yh(n,E,o),a.memoizedState=mh,Ho(null,u)):(Tr(a),vh(a,k))}var P=n.memoizedState;if(P!==null&&(k=P.dehydrated,k!==null)){if(y)a.flags&256?(Tr(a),a.flags&=-257,a=bh(n,a,o)):a.memoizedState!==null?(jr(),a.child=n.child,a.flags|=128,a=null):(jr(),k=u.fallback,m=a.mode,u=Bc({mode:"visible",children:u.children},m),k=ga(k,m,o,null),k.flags|=2,u.return=a,k.return=a,u.sibling=k,a.child=u,Ea(a,n.child,null,o),u=a.child,u.memoizedState=gh(o),u.childLanes=yh(n,E,o),a.memoizedState=mh,a=Ho(null,u));else if(Tr(a),Qh(k)){if(E=k.nextSibling&&k.nextSibling.dataset,E)var K=E.dgst;E=K,u=Error(r(419)),u.stack="",u.digest=E,Mo({value:u,source:null,stack:null}),a=bh(n,a,o)}else if(Vt||fi(n,a,o,!1),E=(o&n.childLanes)!==0,Vt||E){if(E=pt,E!==null&&(u=sc(E,o),u!==0&&u!==P.retryLane))throw P.retryLane=u,ma(n,u),Mn(E,n,u),hh;Jh(k)||Wc(),a=bh(n,a,o)}else Jh(k)?(a.flags|=192,a.child=n.child,a=null):(n=P.treeContext,bt=as(k.nextSibling),nn=a,Je=!0,br=null,ss=!1,n!==null&&yv(a,n),a=vh(a,u.children),a.flags|=4096);return a}return m?(jr(),k=u.fallback,m=a.mode,P=n.child,K=P.sibling,u=Gs(P,{mode:"hidden",children:u.children}),u.subtreeFlags=P.subtreeFlags&65011712,K!==null?k=Gs(K,k):(k=ga(k,m,o,null),k.flags|=2),k.return=a,u.return=a,u.sibling=k,a.child=u,Ho(null,u),u=a.child,k=n.child.memoizedState,k===null?k=gh(o):(m=k.cachePool,m!==null?(P=Ut._currentValue,m=m.parent!==P?{parent:P,pool:P}:m):m=Ev(),k={baseLanes:k.baseLanes|o,cachePool:m}),u.memoizedState=k,u.childLanes=yh(n,E,o),a.memoizedState=mh,Ho(n.child,u)):(Tr(a),o=n.child,n=o.sibling,o=Gs(o,{mode:"visible",children:u.children}),o.return=a,o.sibling=null,n!==null&&(E=a.deletions,E===null?(a.deletions=[n],a.flags|=16):E.push(n)),a.child=o,a.memoizedState=null,o)}function vh(n,a){return a=Bc({mode:"visible",children:a},n.mode),a.return=n,n.child=a}function Bc(n,a){return n=Un(22,n,null,a),n.lanes=0,n}function bh(n,a,o){return Ea(a,n.child,null,o),n=vh(a,a.pendingProps.children),n.flags|=2,a.memoizedState=null,n}function I0(n,a,o){n.lanes|=a;var u=n.alternate;u!==null&&(u.lanes|=a),Df(n.return,a,o)}function xh(n,a,o,u,m,y){var E=n.memoizedState;E===null?n.memoizedState={isBackwards:a,rendering:null,renderingStartTime:0,last:u,tail:o,tailMode:m,treeForkCount:y}:(E.isBackwards=a,E.rendering=null,E.renderingStartTime=0,E.last=u,E.tail=o,E.tailMode=m,E.treeForkCount=y)}function L0(n,a,o){var u=a.pendingProps,m=u.revealOrder,y=u.tail;u=u.children;var E=It.current,k=(E&2)!==0;if(k?(E=E&1|2,a.flags|=128):E&=1,W(It,E),rn(n,a,u,o),u=Je?ko:0,!k&&n!==null&&(n.flags&128)!==0)e:for(n=a.child;n!==null;){if(n.tag===13)n.memoizedState!==null&&I0(n,o,a);else if(n.tag===19)I0(n,o,a);else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===a)break e;for(;n.sibling===null;){if(n.return===null||n.return===a)break e;n=n.return}n.sibling.return=n.return,n=n.sibling}switch(m){case"forwards":for(o=a.child,m=null;o!==null;)n=o.alternate,n!==null&&_c(n)===null&&(m=o),o=o.sibling;o=m,o===null?(m=a.child,a.child=null):(m=o.sibling,o.sibling=null),xh(a,!1,m,o,y,u);break;case"backwards":case"unstable_legacy-backwards":for(o=null,m=a.child,a.child=null;m!==null;){if(n=m.alternate,n!==null&&_c(n)===null){a.child=m;break}n=m.sibling,m.sibling=o,o=m,m=n}xh(a,!0,o,null,y,u);break;case"together":xh(a,!1,null,null,void 0,u);break;default:a.memoizedState=null}return a.child}function er(n,a,o){if(n!==null&&(a.dependencies=n.dependencies),Ar|=a.lanes,(o&a.childLanes)===0)if(n!==null){if(fi(n,a,o,!1),(o&a.childLanes)===0)return null}else return null;if(n!==null&&a.child!==n.child)throw Error(r(153));if(a.child!==null){for(n=a.child,o=Gs(n,n.pendingProps),a.child=o,o.return=a;n.sibling!==null;)n=n.sibling,o=o.sibling=Gs(n,n.pendingProps),o.return=a;o.sibling=null}return a.child}function wh(n,a){return(n.lanes&a)!==0?!0:(n=n.dependencies,!!(n!==null&&Sc(n)))}function uA(n,a,o){switch(a.tag){case 3:pe(a,a.stateNode.containerInfo),wr(a,Ut,n.memoizedState.cache),ya();break;case 27:case 5:Re(a);break;case 4:pe(a,a.stateNode.containerInfo);break;case 10:wr(a,a.type,a.memoizedProps.value);break;case 31:if(a.memoizedState!==null)return a.flags|=128,qf(a),null;break;case 13:var u=a.memoizedState;if(u!==null)return u.dehydrated!==null?(Tr(a),a.flags|=128,null):(o&a.child.childLanes)!==0?z0(n,a,o):(Tr(a),n=er(n,a,o),n!==null?n.sibling:null);Tr(a);break;case 19:var m=(n.flags&128)!==0;if(u=(o&a.childLanes)!==0,u||(fi(n,a,o,!1),u=(o&a.childLanes)!==0),m){if(u)return L0(n,a,o);a.flags|=128}if(m=a.memoizedState,m!==null&&(m.rendering=null,m.tail=null,m.lastEffect=null),W(It,It.current),u)break;return null;case 22:return a.lanes=0,A0(n,a,o,a.pendingProps);case 24:wr(a,Ut,n.memoizedState.cache)}return er(n,a,o)}function P0(n,a,o){if(n!==null)if(n.memoizedProps!==a.pendingProps)Vt=!0;else{if(!wh(n,o)&&(a.flags&128)===0)return Vt=!1,uA(n,a,o);Vt=(n.flags&131072)!==0}else Vt=!1,Je&&(a.flags&1048576)!==0&&gv(a,ko,a.index);switch(a.lanes=0,a.tag){case 16:e:{var u=a.pendingProps;if(n=wa(a.elementType),a.type=n,typeof n=="function")jf(n)?(u=Ta(n,u),a.tag=1,a=O0(null,a,n,u,o)):(a.tag=0,a=ph(null,a,n,u,o));else{if(n!=null){var m=n.$$typeof;if(m===_){a.tag=11,a=j0(null,a,n,u,o);break e}else if(m===O){a.tag=14,a=C0(null,a,n,u,o);break e}}throw a=ie(n)||n,Error(r(306,a,""))}}return a;case 0:return ph(n,a,a.type,a.pendingProps,o);case 1:return u=a.type,m=Ta(u,a.pendingProps),O0(n,a,u,m,o);case 3:e:{if(pe(a,a.stateNode.containerInfo),n===null)throw Error(r(387));u=a.pendingProps;var y=a.memoizedState;m=y.element,Vf(n,a),Uo(a,u,null,o);var E=a.memoizedState;if(u=E.cache,wr(a,Ut,u),u!==y.cache&&zf(a,[Ut],o,!0),Po(),u=E.element,y.isDehydrated)if(y={element:u,isDehydrated:!1,cache:E.cache},a.updateQueue.baseState=y,a.memoizedState=y,a.flags&256){a=D0(n,a,u,o);break e}else if(u!==m){m=es(Error(r(424)),a),Mo(m),a=D0(n,a,u,o);break e}else for(n=a.stateNode.containerInfo,n.nodeType===9?n=n.body:n=n.nodeName==="HTML"?n.ownerDocument.body:n,bt=as(n.firstChild),nn=a,Je=!0,br=null,ss=!0,o=Av(a,null,u,o),a.child=o;o;)o.flags=o.flags&-3|4096,o=o.sibling;else{if(ya(),u===m){a=er(n,a,o);break e}rn(n,a,u,o)}a=a.child}return a;case 26:return Vc(n,a),n===null?(o=Xb(a.type,null,a.pendingProps,null))?a.memoizedState=o:Je||(o=a.type,n=a.pendingProps,u=ru(me.current).createElement(o),u[tn]=a,u[jn]=n,an(u,o,n),Wt(u),a.stateNode=u):a.memoizedState=Xb(a.type,n.memoizedProps,a.pendingProps,n.memoizedState),null;case 27:return Re(a),n===null&&Je&&(u=a.stateNode=qb(a.type,a.pendingProps,me.current),nn=a,ss=!0,m=bt,Dr(a.type)?(ep=m,bt=as(u.firstChild)):bt=m),rn(n,a,a.pendingProps.children,o),Vc(n,a),n===null&&(a.flags|=4194304),a.child;case 5:return n===null&&Je&&((m=u=bt)&&(u=$A(u,a.type,a.pendingProps,ss),u!==null?(a.stateNode=u,nn=a,bt=as(u.firstChild),ss=!1,m=!0):m=!1),m||xr(a)),Re(a),m=a.type,y=a.pendingProps,E=n!==null?n.memoizedProps:null,u=y.children,Xh(m,y)?u=null:E!==null&&Xh(m,E)&&(a.flags|=32),a.memoizedState!==null&&(m=Gf(n,a,tA,null,null,o),al._currentValue=m),Vc(n,a),rn(n,a,u,o),a.child;case 6:return n===null&&Je&&((n=o=bt)&&(o=VA(o,a.pendingProps,ss),o!==null?(a.stateNode=o,nn=a,bt=null,n=!0):n=!1),n||xr(a)),null;case 13:return z0(n,a,o);case 4:return pe(a,a.stateNode.containerInfo),u=a.pendingProps,n===null?a.child=Ea(a,null,u,o):rn(n,a,u,o),a.child;case 11:return j0(n,a,a.type,a.pendingProps,o);case 7:return rn(n,a,a.pendingProps,o),a.child;case 8:return rn(n,a,a.pendingProps.children,o),a.child;case 12:return rn(n,a,a.pendingProps.children,o),a.child;case 10:return u=a.pendingProps,wr(a,a.type,u.value),rn(n,a,u.children,o),a.child;case 9:return m=a.type._context,u=a.pendingProps.children,ba(a),m=sn(m),u=u(m),a.flags|=1,rn(n,a,u,o),a.child;case 14:return C0(n,a,a.type,a.pendingProps,o);case 15:return R0(n,a,a.type,a.pendingProps,o);case 19:return L0(n,a,o);case 31:return cA(n,a,o);case 22:return A0(n,a,o,a.pendingProps);case 24:return ba(a),u=sn(Ut),n===null?(m=Pf(),m===null&&(m=pt,y=If(),m.pooledCache=y,y.refCount++,y!==null&&(m.pooledCacheLanes|=o),m=y),a.memoizedState={parent:u,cache:m},$f(a),wr(a,Ut,m)):((n.lanes&o)!==0&&(Vf(n,a),Uo(a,null,null,o),Po()),m=n.memoizedState,y=a.memoizedState,m.parent!==u?(m={parent:u,cache:u},a.memoizedState=m,a.lanes===0&&(a.memoizedState=a.updateQueue.baseState=m),wr(a,Ut,u)):(u=y.cache,wr(a,Ut,u),u!==m.cache&&zf(a,[Ut],o,!0))),rn(n,a,a.pendingProps.children,o),a.child;case 29:throw a.pendingProps}throw Error(r(156,a.tag))}function tr(n){n.flags|=4}function Sh(n,a,o,u,m){if((a=(n.mode&32)!==0)&&(a=!1),a){if(n.flags|=16777216,(m&335544128)===m)if(n.stateNode.complete)n.flags|=8192;else if(db())n.flags|=8192;else throw Sa=jc,Uf}else n.flags&=-16777217}function U0(n,a){if(a.type!=="stylesheet"||(a.state.loading&4)!==0)n.flags&=-16777217;else if(n.flags|=16777216,!ex(a))if(db())n.flags|=8192;else throw Sa=jc,Uf}function Zc(n,a){a!==null&&(n.flags|=4),n.flags&16384&&(a=n.tag!==22?tc():536870912,n.lanes|=a,Ni|=a)}function Fo(n,a){if(!Je)switch(n.tailMode){case"hidden":a=n.tail;for(var o=null;a!==null;)a.alternate!==null&&(o=a),a=a.sibling;o===null?n.tail=null:o.sibling=null;break;case"collapsed":o=n.tail;for(var u=null;o!==null;)o.alternate!==null&&(u=o),o=o.sibling;u===null?a||n.tail===null?n.tail=null:n.tail.sibling=null:u.sibling=null}}function xt(n){var a=n.alternate!==null&&n.alternate.child===n.child,o=0,u=0;if(a)for(var m=n.child;m!==null;)o|=m.lanes|m.childLanes,u|=m.subtreeFlags&65011712,u|=m.flags&65011712,m.return=n,m=m.sibling;else for(m=n.child;m!==null;)o|=m.lanes|m.childLanes,u|=m.subtreeFlags,u|=m.flags,m.return=n,m=m.sibling;return n.subtreeFlags|=u,n.childLanes=o,a}function dA(n,a,o){var u=a.pendingProps;switch(_f(a),a.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return xt(a),null;case 1:return xt(a),null;case 3:return o=a.stateNode,u=null,n!==null&&(u=n.memoizedState.cache),a.memoizedState.cache!==u&&(a.flags|=2048),Ws(Ut),xe(),o.pendingContext&&(o.context=o.pendingContext,o.pendingContext=null),(n===null||n.child===null)&&(di(a)?tr(a):n===null||n.memoizedState.isDehydrated&&(a.flags&256)===0||(a.flags|=1024,Mf())),xt(a),null;case 26:var m=a.type,y=a.memoizedState;return n===null?(tr(a),y!==null?(xt(a),U0(a,y)):(xt(a),Sh(a,m,null,u,o))):y?y!==n.memoizedState?(tr(a),xt(a),U0(a,y)):(xt(a),a.flags&=-16777217):(n=n.memoizedProps,n!==u&&tr(a),xt(a),Sh(a,m,n,u,o)),null;case 27:if(fe(a),o=me.current,m=a.type,n!==null&&a.stateNode!=null)n.memoizedProps!==u&&tr(a);else{if(!u){if(a.stateNode===null)throw Error(r(166));return xt(a),null}n=se.current,di(a)?vv(a):(n=qb(m,u,o),a.stateNode=n,tr(a))}return xt(a),null;case 5:if(fe(a),m=a.type,n!==null&&a.stateNode!=null)n.memoizedProps!==u&&tr(a);else{if(!u){if(a.stateNode===null)throw Error(r(166));return xt(a),null}if(y=se.current,di(a))vv(a);else{var E=ru(me.current);switch(y){case 1:y=E.createElementNS("http://www.w3.org/2000/svg",m);break;case 2:y=E.createElementNS("http://www.w3.org/1998/Math/MathML",m);break;default:switch(m){case"svg":y=E.createElementNS("http://www.w3.org/2000/svg",m);break;case"math":y=E.createElementNS("http://www.w3.org/1998/Math/MathML",m);break;case"script":y=E.createElement("div"),y.innerHTML="<script><\/script>",y=y.removeChild(y.firstChild);break;case"select":y=typeof u.is=="string"?E.createElement("select",{is:u.is}):E.createElement("select"),u.multiple?y.multiple=!0:u.size&&(y.size=u.size);break;default:y=typeof u.is=="string"?E.createElement(m,{is:u.is}):E.createElement(m)}}y[tn]=a,y[jn]=u;e:for(E=a.child;E!==null;){if(E.tag===5||E.tag===6)y.appendChild(E.stateNode);else if(E.tag!==4&&E.tag!==27&&E.child!==null){E.child.return=E,E=E.child;continue}if(E===a)break e;for(;E.sibling===null;){if(E.return===null||E.return===a)break e;E=E.return}E.sibling.return=E.return,E=E.sibling}a.stateNode=y;e:switch(an(y,m,u),m){case"button":case"input":case"select":case"textarea":u=!!u.autoFocus;break e;case"img":u=!0;break e;default:u=!1}u&&tr(a)}}return xt(a),Sh(a,a.type,n===null?null:n.memoizedProps,a.pendingProps,o),null;case 6:if(n&&a.stateNode!=null)n.memoizedProps!==u&&tr(a);else{if(typeof u!="string"&&a.stateNode===null)throw Error(r(166));if(n=me.current,di(a)){if(n=a.stateNode,o=a.memoizedProps,u=null,m=nn,m!==null)switch(m.tag){case 27:case 5:u=m.memoizedProps}n[tn]=a,n=!!(n.nodeValue===o||u!==null&&u.suppressHydrationWarning===!0||zb(n.nodeValue,o)),n||xr(a,!0)}else n=ru(n).createTextNode(u),n[tn]=a,a.stateNode=n}return xt(a),null;case 31:if(o=a.memoizedState,n===null||n.memoizedState!==null){if(u=di(a),o!==null){if(n===null){if(!u)throw Error(r(318));if(n=a.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(r(557));n[tn]=a}else ya(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;xt(a),n=!1}else o=Mf(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=o),n=!0;if(!n)return a.flags&256?(Vn(a),a):(Vn(a),null);if((a.flags&128)!==0)throw Error(r(558))}return xt(a),null;case 13:if(u=a.memoizedState,n===null||n.memoizedState!==null&&n.memoizedState.dehydrated!==null){if(m=di(a),u!==null&&u.dehydrated!==null){if(n===null){if(!m)throw Error(r(318));if(m=a.memoizedState,m=m!==null?m.dehydrated:null,!m)throw Error(r(317));m[tn]=a}else ya(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;xt(a),m=!1}else m=Mf(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=m),m=!0;if(!m)return a.flags&256?(Vn(a),a):(Vn(a),null)}return Vn(a),(a.flags&128)!==0?(a.lanes=o,a):(o=u!==null,n=n!==null&&n.memoizedState!==null,o&&(u=a.child,m=null,u.alternate!==null&&u.alternate.memoizedState!==null&&u.alternate.memoizedState.cachePool!==null&&(m=u.alternate.memoizedState.cachePool.pool),y=null,u.memoizedState!==null&&u.memoizedState.cachePool!==null&&(y=u.memoizedState.cachePool.pool),y!==m&&(u.flags|=2048)),o!==n&&o&&(a.child.flags|=8192),Zc(a,a.updateQueue),xt(a),null);case 4:return xe(),n===null&&Hh(a.stateNode.containerInfo),xt(a),null;case 10:return Ws(a.type),xt(a),null;case 19:if(U(It),u=a.memoizedState,u===null)return xt(a),null;if(m=(a.flags&128)!==0,y=u.rendering,y===null)if(m)Fo(u,!1);else{if(Ot!==0||n!==null&&(n.flags&128)!==0)for(n=a.child;n!==null;){if(y=_c(n),y!==null){for(a.flags|=128,Fo(u,!1),n=y.updateQueue,a.updateQueue=n,Zc(a,n),a.subtreeFlags=0,n=o,o=a.child;o!==null;)hv(o,n),o=o.sibling;return W(It,It.current&1|2),Je&&Xs(a,u.treeForkCount),a.child}n=n.sibling}u.tail!==null&&Se()>Gc&&(a.flags|=128,m=!0,Fo(u,!1),a.lanes=4194304)}else{if(!m)if(n=_c(y),n!==null){if(a.flags|=128,m=!0,n=n.updateQueue,a.updateQueue=n,Zc(a,n),Fo(u,!0),u.tail===null&&u.tailMode==="hidden"&&!y.alternate&&!Je)return xt(a),null}else 2*Se()-u.renderingStartTime>Gc&&o!==536870912&&(a.flags|=128,m=!0,Fo(u,!1),a.lanes=4194304);u.isBackwards?(y.sibling=a.child,a.child=y):(n=u.last,n!==null?n.sibling=y:a.child=y,u.last=y)}return u.tail!==null?(n=u.tail,u.rendering=n,u.tail=n.sibling,u.renderingStartTime=Se(),n.sibling=null,o=It.current,W(It,m?o&1|2:o&1),Je&&Xs(a,u.treeForkCount),n):(xt(a),null);case 22:case 23:return Vn(a),Ff(),u=a.memoizedState!==null,n!==null?n.memoizedState!==null!==u&&(a.flags|=8192):u&&(a.flags|=8192),u?(o&536870912)!==0&&(a.flags&128)===0&&(xt(a),a.subtreeFlags&6&&(a.flags|=8192)):xt(a),o=a.updateQueue,o!==null&&Zc(a,o.retryQueue),o=null,n!==null&&n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(o=n.memoizedState.cachePool.pool),u=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(u=a.memoizedState.cachePool.pool),u!==o&&(a.flags|=2048),n!==null&&U(xa),null;case 24:return o=null,n!==null&&(o=n.memoizedState.cache),a.memoizedState.cache!==o&&(a.flags|=2048),Ws(Ut),xt(a),null;case 25:return null;case 30:return null}throw Error(r(156,a.tag))}function fA(n,a){switch(_f(a),a.tag){case 1:return n=a.flags,n&65536?(a.flags=n&-65537|128,a):null;case 3:return Ws(Ut),xe(),n=a.flags,(n&65536)!==0&&(n&128)===0?(a.flags=n&-65537|128,a):null;case 26:case 27:case 5:return fe(a),null;case 31:if(a.memoizedState!==null){if(Vn(a),a.alternate===null)throw Error(r(340));ya()}return n=a.flags,n&65536?(a.flags=n&-65537|128,a):null;case 13:if(Vn(a),n=a.memoizedState,n!==null&&n.dehydrated!==null){if(a.alternate===null)throw Error(r(340));ya()}return n=a.flags,n&65536?(a.flags=n&-65537|128,a):null;case 19:return U(It),null;case 4:return xe(),null;case 10:return Ws(a.type),null;case 22:case 23:return Vn(a),Ff(),n!==null&&U(xa),n=a.flags,n&65536?(a.flags=n&-65537|128,a):null;case 24:return Ws(Ut),null;case 25:return null;default:return null}}function $0(n,a){switch(_f(a),a.tag){case 3:Ws(Ut),xe();break;case 26:case 27:case 5:fe(a);break;case 4:xe();break;case 31:a.memoizedState!==null&&Vn(a);break;case 13:Vn(a);break;case 19:U(It);break;case 10:Ws(a.type);break;case 22:case 23:Vn(a),Ff(),n!==null&&U(xa);break;case 24:Ws(Ut)}}function qo(n,a){try{var o=a.updateQueue,u=o!==null?o.lastEffect:null;if(u!==null){var m=u.next;o=m;do{if((o.tag&n)===n){u=void 0;var y=o.create,E=o.inst;u=y(),E.destroy=u}o=o.next}while(o!==m)}}catch(k){ct(a,a.return,k)}}function Cr(n,a,o){try{var u=a.updateQueue,m=u!==null?u.lastEffect:null;if(m!==null){var y=m.next;u=y;do{if((u.tag&n)===n){var E=u.inst,k=E.destroy;if(k!==void 0){E.destroy=void 0,m=a;var P=o,K=k;try{K()}catch(le){ct(m,P,le)}}}u=u.next}while(u!==y)}}catch(le){ct(a,a.return,le)}}function V0(n){var a=n.updateQueue;if(a!==null){var o=n.stateNode;try{kv(a,o)}catch(u){ct(n,n.return,u)}}}function B0(n,a,o){o.props=Ta(n.type,n.memoizedProps),o.state=n.memoizedState;try{o.componentWillUnmount()}catch(u){ct(n,a,u)}}function Yo(n,a){try{var o=n.ref;if(o!==null){switch(n.tag){case 26:case 27:case 5:var u=n.stateNode;break;case 30:u=n.stateNode;break;default:u=n.stateNode}typeof o=="function"?n.refCleanup=o(u):o.current=u}}catch(m){ct(n,a,m)}}function Rs(n,a){var o=n.ref,u=n.refCleanup;if(o!==null)if(typeof u=="function")try{u()}catch(m){ct(n,a,m)}finally{n.refCleanup=null,n=n.alternate,n!=null&&(n.refCleanup=null)}else if(typeof o=="function")try{o(null)}catch(m){ct(n,a,m)}else o.current=null}function Z0(n){var a=n.type,o=n.memoizedProps,u=n.stateNode;try{e:switch(a){case"button":case"input":case"select":case"textarea":o.autoFocus&&u.focus();break e;case"img":o.src?u.src=o.src:o.srcSet&&(u.srcset=o.srcSet)}}catch(m){ct(n,n.return,m)}}function Eh(n,a,o){try{var u=n.stateNode;DA(u,n.type,o,a),u[jn]=a}catch(m){ct(n,n.return,m)}}function H0(n){return n.tag===5||n.tag===3||n.tag===26||n.tag===27&&Dr(n.type)||n.tag===4}function Nh(n){e:for(;;){for(;n.sibling===null;){if(n.return===null||H0(n.return))return null;n=n.return}for(n.sibling.return=n.return,n=n.sibling;n.tag!==5&&n.tag!==6&&n.tag!==18;){if(n.tag===27&&Dr(n.type)||n.flags&2||n.child===null||n.tag===4)continue e;n.child.return=n,n=n.child}if(!(n.flags&2))return n.stateNode}}function Th(n,a,o){var u=n.tag;if(u===5||u===6)n=n.stateNode,a?(o.nodeType===9?o.body:o.nodeName==="HTML"?o.ownerDocument.body:o).insertBefore(n,a):(a=o.nodeType===9?o.body:o.nodeName==="HTML"?o.ownerDocument.body:o,a.appendChild(n),o=o._reactRootContainer,o!=null||a.onclick!==null||(a.onclick=qs));else if(u!==4&&(u===27&&Dr(n.type)&&(o=n.stateNode,a=null),n=n.child,n!==null))for(Th(n,a,o),n=n.sibling;n!==null;)Th(n,a,o),n=n.sibling}function Hc(n,a,o){var u=n.tag;if(u===5||u===6)n=n.stateNode,a?o.insertBefore(n,a):o.appendChild(n);else if(u!==4&&(u===27&&Dr(n.type)&&(o=n.stateNode),n=n.child,n!==null))for(Hc(n,a,o),n=n.sibling;n!==null;)Hc(n,a,o),n=n.sibling}function F0(n){var a=n.stateNode,o=n.memoizedProps;try{for(var u=n.type,m=a.attributes;m.length;)a.removeAttributeNode(m[0]);an(a,u,o),a[tn]=n,a[jn]=o}catch(y){ct(n,n.return,y)}}var nr=!1,Bt=!1,jh=!1,q0=typeof WeakSet=="function"?WeakSet:Set,Jt=null;function hA(n,a){if(n=n.containerInfo,Yh=du,n=rv(n),bf(n)){if("selectionStart"in n)var o={start:n.selectionStart,end:n.selectionEnd};else e:{o=(o=n.ownerDocument)&&o.defaultView||window;var u=o.getSelection&&o.getSelection();if(u&&u.rangeCount!==0){o=u.anchorNode;var m=u.anchorOffset,y=u.focusNode;u=u.focusOffset;try{o.nodeType,y.nodeType}catch{o=null;break e}var E=0,k=-1,P=-1,K=0,le=0,de=n,Q=null;t:for(;;){for(var ne;de!==o||m!==0&&de.nodeType!==3||(k=E+m),de!==y||u!==0&&de.nodeType!==3||(P=E+u),de.nodeType===3&&(E+=de.nodeValue.length),(ne=de.firstChild)!==null;)Q=de,de=ne;for(;;){if(de===n)break t;if(Q===o&&++K===m&&(k=E),Q===y&&++le===u&&(P=E),(ne=de.nextSibling)!==null)break;de=Q,Q=de.parentNode}de=ne}o=k===-1||P===-1?null:{start:k,end:P}}else o=null}o=o||{start:0,end:0}}else o=null;for(Gh={focusedElem:n,selectionRange:o},du=!1,Jt=a;Jt!==null;)if(a=Jt,n=a.child,(a.subtreeFlags&1028)!==0&&n!==null)n.return=a,Jt=n;else for(;Jt!==null;){switch(a=Jt,y=a.alternate,n=a.flags,a.tag){case 0:if((n&4)!==0&&(n=a.updateQueue,n=n!==null?n.events:null,n!==null))for(o=0;o<n.length;o++)m=n[o],m.ref.impl=m.nextImpl;break;case 11:case 15:break;case 1:if((n&1024)!==0&&y!==null){n=void 0,o=a,m=y.memoizedProps,y=y.memoizedState,u=o.stateNode;try{var Ne=Ta(o.type,m);n=u.getSnapshotBeforeUpdate(Ne,y),u.__reactInternalSnapshotBeforeUpdate=n}catch(ze){ct(o,o.return,ze)}}break;case 3:if((n&1024)!==0){if(n=a.stateNode.containerInfo,o=n.nodeType,o===9)Wh(n);else if(o===1)switch(n.nodeName){case"HEAD":case"HTML":case"BODY":Wh(n);break;default:n.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((n&1024)!==0)throw Error(r(163))}if(n=a.sibling,n!==null){n.return=a.return,Jt=n;break}Jt=a.return}}function Y0(n,a,o){var u=o.flags;switch(o.tag){case 0:case 11:case 15:rr(n,o),u&4&&qo(5,o);break;case 1:if(rr(n,o),u&4)if(n=o.stateNode,a===null)try{n.componentDidMount()}catch(E){ct(o,o.return,E)}else{var m=Ta(o.type,a.memoizedProps);a=a.memoizedState;try{n.componentDidUpdate(m,a,n.__reactInternalSnapshotBeforeUpdate)}catch(E){ct(o,o.return,E)}}u&64&&V0(o),u&512&&Yo(o,o.return);break;case 3:if(rr(n,o),u&64&&(n=o.updateQueue,n!==null)){if(a=null,o.child!==null)switch(o.child.tag){case 27:case 5:a=o.child.stateNode;break;case 1:a=o.child.stateNode}try{kv(n,a)}catch(E){ct(o,o.return,E)}}break;case 27:a===null&&u&4&&F0(o);case 26:case 5:rr(n,o),a===null&&u&4&&Z0(o),u&512&&Yo(o,o.return);break;case 12:rr(n,o);break;case 31:rr(n,o),u&4&&K0(n,o);break;case 13:rr(n,o),u&4&&W0(n,o),u&64&&(n=o.memoizedState,n!==null&&(n=n.dehydrated,n!==null&&(o=SA.bind(null,o),BA(n,o))));break;case 22:if(u=o.memoizedState!==null||nr,!u){a=a!==null&&a.memoizedState!==null||Bt,m=nr;var y=Bt;nr=u,(Bt=a)&&!y?ar(n,o,(o.subtreeFlags&8772)!==0):rr(n,o),nr=m,Bt=y}break;case 30:break;default:rr(n,o)}}function G0(n){var a=n.alternate;a!==null&&(n.alternate=null,G0(a)),n.child=null,n.deletions=null,n.sibling=null,n.tag===5&&(a=n.stateNode,a!==null&&tf(a)),n.stateNode=null,n.return=null,n.dependencies=null,n.memoizedProps=null,n.memoizedState=null,n.pendingProps=null,n.stateNode=null,n.updateQueue=null}var Rt=null,Rn=!1;function sr(n,a,o){for(o=o.child;o!==null;)X0(n,a,o),o=o.sibling}function X0(n,a,o){if(De&&typeof De.onCommitFiberUnmount=="function")try{De.onCommitFiberUnmount(Qt,o)}catch{}switch(o.tag){case 26:Bt||Rs(o,a),sr(n,a,o),o.memoizedState?o.memoizedState.count--:o.stateNode&&(o=o.stateNode,o.parentNode.removeChild(o));break;case 27:Bt||Rs(o,a);var u=Rt,m=Rn;Dr(o.type)&&(Rt=o.stateNode,Rn=!1),sr(n,a,o),nl(o.stateNode),Rt=u,Rn=m;break;case 5:Bt||Rs(o,a);case 6:if(u=Rt,m=Rn,Rt=null,sr(n,a,o),Rt=u,Rn=m,Rt!==null)if(Rn)try{(Rt.nodeType===9?Rt.body:Rt.nodeName==="HTML"?Rt.ownerDocument.body:Rt).removeChild(o.stateNode)}catch(y){ct(o,a,y)}else try{Rt.removeChild(o.stateNode)}catch(y){ct(o,a,y)}break;case 18:Rt!==null&&(Rn?(n=Rt,Vb(n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n,o.stateNode),Mi(n)):Vb(Rt,o.stateNode));break;case 4:u=Rt,m=Rn,Rt=o.stateNode.containerInfo,Rn=!0,sr(n,a,o),Rt=u,Rn=m;break;case 0:case 11:case 14:case 15:Cr(2,o,a),Bt||Cr(4,o,a),sr(n,a,o);break;case 1:Bt||(Rs(o,a),u=o.stateNode,typeof u.componentWillUnmount=="function"&&B0(o,a,u)),sr(n,a,o);break;case 21:sr(n,a,o);break;case 22:Bt=(u=Bt)||o.memoizedState!==null,sr(n,a,o),Bt=u;break;default:sr(n,a,o)}}function K0(n,a){if(a.memoizedState===null&&(n=a.alternate,n!==null&&(n=n.memoizedState,n!==null))){n=n.dehydrated;try{Mi(n)}catch(o){ct(a,a.return,o)}}}function W0(n,a){if(a.memoizedState===null&&(n=a.alternate,n!==null&&(n=n.memoizedState,n!==null&&(n=n.dehydrated,n!==null))))try{Mi(n)}catch(o){ct(a,a.return,o)}}function pA(n){switch(n.tag){case 31:case 13:case 19:var a=n.stateNode;return a===null&&(a=n.stateNode=new q0),a;case 22:return n=n.stateNode,a=n._retryCache,a===null&&(a=n._retryCache=new q0),a;default:throw Error(r(435,n.tag))}}function Fc(n,a){var o=pA(n);a.forEach(function(u){if(!o.has(u)){o.add(u);var m=EA.bind(null,n,u);u.then(m,m)}})}function An(n,a){var o=a.deletions;if(o!==null)for(var u=0;u<o.length;u++){var m=o[u],y=n,E=a,k=E;e:for(;k!==null;){switch(k.tag){case 27:if(Dr(k.type)){Rt=k.stateNode,Rn=!1;break e}break;case 5:Rt=k.stateNode,Rn=!1;break e;case 3:case 4:Rt=k.stateNode.containerInfo,Rn=!0;break e}k=k.return}if(Rt===null)throw Error(r(160));X0(y,E,m),Rt=null,Rn=!1,y=m.alternate,y!==null&&(y.return=null),m.return=null}if(a.subtreeFlags&13886)for(a=a.child;a!==null;)J0(a,n),a=a.sibling}var ps=null;function J0(n,a){var o=n.alternate,u=n.flags;switch(n.tag){case 0:case 11:case 14:case 15:An(a,n),_n(n),u&4&&(Cr(3,n,n.return),qo(3,n),Cr(5,n,n.return));break;case 1:An(a,n),_n(n),u&512&&(Bt||o===null||Rs(o,o.return)),u&64&&nr&&(n=n.updateQueue,n!==null&&(u=n.callbacks,u!==null&&(o=n.shared.hiddenCallbacks,n.shared.hiddenCallbacks=o===null?u:o.concat(u))));break;case 26:var m=ps;if(An(a,n),_n(n),u&512&&(Bt||o===null||Rs(o,o.return)),u&4){var y=o!==null?o.memoizedState:null;if(u=n.memoizedState,o===null)if(u===null)if(n.stateNode===null){e:{u=n.type,o=n.memoizedProps,m=m.ownerDocument||m;t:switch(u){case"title":y=m.getElementsByTagName("title")[0],(!y||y[xo]||y[tn]||y.namespaceURI==="http://www.w3.org/2000/svg"||y.hasAttribute("itemprop"))&&(y=m.createElement(u),m.head.insertBefore(y,m.querySelector("head > title"))),an(y,u,o),y[tn]=n,Wt(y),u=y;break e;case"link":var E=Jb("link","href",m).get(u+(o.href||""));if(E){for(var k=0;k<E.length;k++)if(y=E[k],y.getAttribute("href")===(o.href==null||o.href===""?null:o.href)&&y.getAttribute("rel")===(o.rel==null?null:o.rel)&&y.getAttribute("title")===(o.title==null?null:o.title)&&y.getAttribute("crossorigin")===(o.crossOrigin==null?null:o.crossOrigin)){E.splice(k,1);break t}}y=m.createElement(u),an(y,u,o),m.head.appendChild(y);break;case"meta":if(E=Jb("meta","content",m).get(u+(o.content||""))){for(k=0;k<E.length;k++)if(y=E[k],y.getAttribute("content")===(o.content==null?null:""+o.content)&&y.getAttribute("name")===(o.name==null?null:o.name)&&y.getAttribute("property")===(o.property==null?null:o.property)&&y.getAttribute("http-equiv")===(o.httpEquiv==null?null:o.httpEquiv)&&y.getAttribute("charset")===(o.charSet==null?null:o.charSet)){E.splice(k,1);break t}}y=m.createElement(u),an(y,u,o),m.head.appendChild(y);break;default:throw Error(r(468,u))}y[tn]=n,Wt(y),u=y}n.stateNode=u}else Qb(m,n.type,n.stateNode);else n.stateNode=Wb(m,u,n.memoizedProps);else y!==u?(y===null?o.stateNode!==null&&(o=o.stateNode,o.parentNode.removeChild(o)):y.count--,u===null?Qb(m,n.type,n.stateNode):Wb(m,u,n.memoizedProps)):u===null&&n.stateNode!==null&&Eh(n,n.memoizedProps,o.memoizedProps)}break;case 27:An(a,n),_n(n),u&512&&(Bt||o===null||Rs(o,o.return)),o!==null&&u&4&&Eh(n,n.memoizedProps,o.memoizedProps);break;case 5:if(An(a,n),_n(n),u&512&&(Bt||o===null||Rs(o,o.return)),n.flags&32){m=n.stateNode;try{ti(m,"")}catch(Ne){ct(n,n.return,Ne)}}u&4&&n.stateNode!=null&&(m=n.memoizedProps,Eh(n,m,o!==null?o.memoizedProps:m)),u&1024&&(jh=!0);break;case 6:if(An(a,n),_n(n),u&4){if(n.stateNode===null)throw Error(r(162));u=n.memoizedProps,o=n.stateNode;try{o.nodeValue=u}catch(Ne){ct(n,n.return,Ne)}}break;case 3:if(ou=null,m=ps,ps=au(a.containerInfo),An(a,n),ps=m,_n(n),u&4&&o!==null&&o.memoizedState.isDehydrated)try{Mi(a.containerInfo)}catch(Ne){ct(n,n.return,Ne)}jh&&(jh=!1,Q0(n));break;case 4:u=ps,ps=au(n.stateNode.containerInfo),An(a,n),_n(n),ps=u;break;case 12:An(a,n),_n(n);break;case 31:An(a,n),_n(n),u&4&&(u=n.updateQueue,u!==null&&(n.updateQueue=null,Fc(n,u)));break;case 13:An(a,n),_n(n),n.child.flags&8192&&n.memoizedState!==null!=(o!==null&&o.memoizedState!==null)&&(Yc=Se()),u&4&&(u=n.updateQueue,u!==null&&(n.updateQueue=null,Fc(n,u)));break;case 22:m=n.memoizedState!==null;var P=o!==null&&o.memoizedState!==null,K=nr,le=Bt;if(nr=K||m,Bt=le||P,An(a,n),Bt=le,nr=K,_n(n),u&8192)e:for(a=n.stateNode,a._visibility=m?a._visibility&-2:a._visibility|1,m&&(o===null||P||nr||Bt||ja(n)),o=null,a=n;;){if(a.tag===5||a.tag===26){if(o===null){P=o=a;try{if(y=P.stateNode,m)E=y.style,typeof E.setProperty=="function"?E.setProperty("display","none","important"):E.display="none";else{k=P.stateNode;var de=P.memoizedProps.style,Q=de!=null&&de.hasOwnProperty("display")?de.display:null;k.style.display=Q==null||typeof Q=="boolean"?"":(""+Q).trim()}}catch(Ne){ct(P,P.return,Ne)}}}else if(a.tag===6){if(o===null){P=a;try{P.stateNode.nodeValue=m?"":P.memoizedProps}catch(Ne){ct(P,P.return,Ne)}}}else if(a.tag===18){if(o===null){P=a;try{var ne=P.stateNode;m?Bb(ne,!0):Bb(P.stateNode,!1)}catch(Ne){ct(P,P.return,Ne)}}}else if((a.tag!==22&&a.tag!==23||a.memoizedState===null||a===n)&&a.child!==null){a.child.return=a,a=a.child;continue}if(a===n)break e;for(;a.sibling===null;){if(a.return===null||a.return===n)break e;o===a&&(o=null),a=a.return}o===a&&(o=null),a.sibling.return=a.return,a=a.sibling}u&4&&(u=n.updateQueue,u!==null&&(o=u.retryQueue,o!==null&&(u.retryQueue=null,Fc(n,o))));break;case 19:An(a,n),_n(n),u&4&&(u=n.updateQueue,u!==null&&(n.updateQueue=null,Fc(n,u)));break;case 30:break;case 21:break;default:An(a,n),_n(n)}}function _n(n){var a=n.flags;if(a&2){try{for(var o,u=n.return;u!==null;){if(H0(u)){o=u;break}u=u.return}if(o==null)throw Error(r(160));switch(o.tag){case 27:var m=o.stateNode,y=Nh(n);Hc(n,y,m);break;case 5:var E=o.stateNode;o.flags&32&&(ti(E,""),o.flags&=-33);var k=Nh(n);Hc(n,k,E);break;case 3:case 4:var P=o.stateNode.containerInfo,K=Nh(n);Th(n,K,P);break;default:throw Error(r(161))}}catch(le){ct(n,n.return,le)}n.flags&=-3}a&4096&&(n.flags&=-4097)}function Q0(n){if(n.subtreeFlags&1024)for(n=n.child;n!==null;){var a=n;Q0(a),a.tag===5&&a.flags&1024&&a.stateNode.reset(),n=n.sibling}}function rr(n,a){if(a.subtreeFlags&8772)for(a=a.child;a!==null;)Y0(n,a.alternate,a),a=a.sibling}function ja(n){for(n=n.child;n!==null;){var a=n;switch(a.tag){case 0:case 11:case 14:case 15:Cr(4,a,a.return),ja(a);break;case 1:Rs(a,a.return);var o=a.stateNode;typeof o.componentWillUnmount=="function"&&B0(a,a.return,o),ja(a);break;case 27:nl(a.stateNode);case 26:case 5:Rs(a,a.return),ja(a);break;case 22:a.memoizedState===null&&ja(a);break;case 30:ja(a);break;default:ja(a)}n=n.sibling}}function ar(n,a,o){for(o=o&&(a.subtreeFlags&8772)!==0,a=a.child;a!==null;){var u=a.alternate,m=n,y=a,E=y.flags;switch(y.tag){case 0:case 11:case 15:ar(m,y,o),qo(4,y);break;case 1:if(ar(m,y,o),u=y,m=u.stateNode,typeof m.componentDidMount=="function")try{m.componentDidMount()}catch(K){ct(u,u.return,K)}if(u=y,m=u.updateQueue,m!==null){var k=u.stateNode;try{var P=m.shared.hiddenCallbacks;if(P!==null)for(m.shared.hiddenCallbacks=null,m=0;m<P.length;m++)_v(P[m],k)}catch(K){ct(u,u.return,K)}}o&&E&64&&V0(y),Yo(y,y.return);break;case 27:F0(y);case 26:case 5:ar(m,y,o),o&&u===null&&E&4&&Z0(y),Yo(y,y.return);break;case 12:ar(m,y,o);break;case 31:ar(m,y,o),o&&E&4&&K0(m,y);break;case 13:ar(m,y,o),o&&E&4&&W0(m,y);break;case 22:y.memoizedState===null&&ar(m,y,o),Yo(y,y.return);break;case 30:break;default:ar(m,y,o)}a=a.sibling}}function Ch(n,a){var o=null;n!==null&&n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(o=n.memoizedState.cachePool.pool),n=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(n=a.memoizedState.cachePool.pool),n!==o&&(n!=null&&n.refCount++,o!=null&&Oo(o))}function Rh(n,a){n=null,a.alternate!==null&&(n=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==n&&(a.refCount++,n!=null&&Oo(n))}function ms(n,a,o,u){if(a.subtreeFlags&10256)for(a=a.child;a!==null;)eb(n,a,o,u),a=a.sibling}function eb(n,a,o,u){var m=a.flags;switch(a.tag){case 0:case 11:case 15:ms(n,a,o,u),m&2048&&qo(9,a);break;case 1:ms(n,a,o,u);break;case 3:ms(n,a,o,u),m&2048&&(n=null,a.alternate!==null&&(n=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==n&&(a.refCount++,n!=null&&Oo(n)));break;case 12:if(m&2048){ms(n,a,o,u),n=a.stateNode;try{var y=a.memoizedProps,E=y.id,k=y.onPostCommit;typeof k=="function"&&k(E,a.alternate===null?"mount":"update",n.passiveEffectDuration,-0)}catch(P){ct(a,a.return,P)}}else ms(n,a,o,u);break;case 31:ms(n,a,o,u);break;case 13:ms(n,a,o,u);break;case 23:break;case 22:y=a.stateNode,E=a.alternate,a.memoizedState!==null?y._visibility&2?ms(n,a,o,u):Go(n,a):y._visibility&2?ms(n,a,o,u):(y._visibility|=2,wi(n,a,o,u,(a.subtreeFlags&10256)!==0||!1)),m&2048&&Ch(E,a);break;case 24:ms(n,a,o,u),m&2048&&Rh(a.alternate,a);break;default:ms(n,a,o,u)}}function wi(n,a,o,u,m){for(m=m&&((a.subtreeFlags&10256)!==0||!1),a=a.child;a!==null;){var y=n,E=a,k=o,P=u,K=E.flags;switch(E.tag){case 0:case 11:case 15:wi(y,E,k,P,m),qo(8,E);break;case 23:break;case 22:var le=E.stateNode;E.memoizedState!==null?le._visibility&2?wi(y,E,k,P,m):Go(y,E):(le._visibility|=2,wi(y,E,k,P,m)),m&&K&2048&&Ch(E.alternate,E);break;case 24:wi(y,E,k,P,m),m&&K&2048&&Rh(E.alternate,E);break;default:wi(y,E,k,P,m)}a=a.sibling}}function Go(n,a){if(a.subtreeFlags&10256)for(a=a.child;a!==null;){var o=n,u=a,m=u.flags;switch(u.tag){case 22:Go(o,u),m&2048&&Ch(u.alternate,u);break;case 24:Go(o,u),m&2048&&Rh(u.alternate,u);break;default:Go(o,u)}a=a.sibling}}var Xo=8192;function Si(n,a,o){if(n.subtreeFlags&Xo)for(n=n.child;n!==null;)tb(n,a,o),n=n.sibling}function tb(n,a,o){switch(n.tag){case 26:Si(n,a,o),n.flags&Xo&&n.memoizedState!==null&&e2(o,ps,n.memoizedState,n.memoizedProps);break;case 5:Si(n,a,o);break;case 3:case 4:var u=ps;ps=au(n.stateNode.containerInfo),Si(n,a,o),ps=u;break;case 22:n.memoizedState===null&&(u=n.alternate,u!==null&&u.memoizedState!==null?(u=Xo,Xo=16777216,Si(n,a,o),Xo=u):Si(n,a,o));break;default:Si(n,a,o)}}function nb(n){var a=n.alternate;if(a!==null&&(n=a.child,n!==null)){a.child=null;do a=n.sibling,n.sibling=null,n=a;while(n!==null)}}function Ko(n){var a=n.deletions;if((n.flags&16)!==0){if(a!==null)for(var o=0;o<a.length;o++){var u=a[o];Jt=u,rb(u,n)}nb(n)}if(n.subtreeFlags&10256)for(n=n.child;n!==null;)sb(n),n=n.sibling}function sb(n){switch(n.tag){case 0:case 11:case 15:Ko(n),n.flags&2048&&Cr(9,n,n.return);break;case 3:Ko(n);break;case 12:Ko(n);break;case 22:var a=n.stateNode;n.memoizedState!==null&&a._visibility&2&&(n.return===null||n.return.tag!==13)?(a._visibility&=-3,qc(n)):Ko(n);break;default:Ko(n)}}function qc(n){var a=n.deletions;if((n.flags&16)!==0){if(a!==null)for(var o=0;o<a.length;o++){var u=a[o];Jt=u,rb(u,n)}nb(n)}for(n=n.child;n!==null;){switch(a=n,a.tag){case 0:case 11:case 15:Cr(8,a,a.return),qc(a);break;case 22:o=a.stateNode,o._visibility&2&&(o._visibility&=-3,qc(a));break;default:qc(a)}n=n.sibling}}function rb(n,a){for(;Jt!==null;){var o=Jt;switch(o.tag){case 0:case 11:case 15:Cr(8,o,a);break;case 23:case 22:if(o.memoizedState!==null&&o.memoizedState.cachePool!==null){var u=o.memoizedState.cachePool.pool;u!=null&&u.refCount++}break;case 24:Oo(o.memoizedState.cache)}if(u=o.child,u!==null)u.return=o,Jt=u;else e:for(o=n;Jt!==null;){u=Jt;var m=u.sibling,y=u.return;if(G0(u),u===o){Jt=null;break e}if(m!==null){m.return=y,Jt=m;break e}Jt=y}}}var mA={getCacheForType:function(n){var a=sn(Ut),o=a.data.get(n);return o===void 0&&(o=n(),a.data.set(n,o)),o},cacheSignal:function(){return sn(Ut).controller.signal}},gA=typeof WeakMap=="function"?WeakMap:Map,at=0,pt=null,qe=null,Xe=0,lt=0,Bn=null,Rr=!1,Ei=!1,Ah=!1,ir=0,Ot=0,Ar=0,Ca=0,_h=0,Zn=0,Ni=0,Wo=null,kn=null,kh=!1,Yc=0,ab=0,Gc=1/0,Xc=null,_r=null,Gt=0,kr=null,Ti=null,or=0,Mh=0,Oh=null,ib=null,Jo=0,Dh=null;function Hn(){return(at&2)!==0&&Xe!==0?Xe&-Xe:z.T!==null?$h():rc()}function ob(){if(Zn===0)if((Xe&536870912)===0||Je){var n=Tn;Tn<<=1,(Tn&3932160)===0&&(Tn=262144),Zn=n}else Zn=536870912;return n=$n.current,n!==null&&(n.flags|=32),Zn}function Mn(n,a,o){(n===pt&&(lt===2||lt===9)||n.cancelPendingCommit!==null)&&(ji(n,0),Mr(n,Xe,Zn,!1)),ua(n,o),((at&2)===0||n!==pt)&&(n===pt&&((at&2)===0&&(Ca|=o),Ot===4&&Mr(n,Xe,Zn,!1)),As(n))}function lb(n,a,o){if((at&6)!==0)throw Error(r(327));var u=!o&&(a&127)===0&&(a&n.expiredLanes)===0||mr(n,a),m=u?bA(n,a):Ih(n,a,!0),y=u;do{if(m===0){Ei&&!u&&Mr(n,a,0,!1);break}else{if(o=n.current.alternate,y&&!yA(o)){m=Ih(n,a,!1),y=!1;continue}if(m===2){if(y=a,n.errorRecoveryDisabledLanes&y)var E=0;else E=n.pendingLanes&-536870913,E=E!==0?E:E&536870912?536870912:0;if(E!==0){a=E;e:{var k=n;m=Wo;var P=k.current.memoizedState.isDehydrated;if(P&&(ji(k,E).flags|=256),E=Ih(k,E,!1),E!==2){if(Ah&&!P){k.errorRecoveryDisabledLanes|=y,Ca|=y,m=4;break e}y=kn,kn=m,y!==null&&(kn===null?kn=y:kn.push.apply(kn,y))}m=E}if(y=!1,m!==2)continue}}if(m===1){ji(n,0),Mr(n,a,0,!0);break}e:{switch(u=n,y=m,y){case 0:case 1:throw Error(r(345));case 4:if((a&4194048)!==a)break;case 6:Mr(u,a,Zn,!Rr);break e;case 2:kn=null;break;case 3:case 5:break;default:throw Error(r(329))}if((a&62914560)===a&&(m=Yc+300-Se(),10<m)){if(Mr(u,a,Zn,!Rr),pr(u,0,!0)!==0)break e;or=a,u.timeoutHandle=Ub(cb.bind(null,u,o,kn,Xc,kh,a,Zn,Ca,Ni,Rr,y,"Throttled",-0,0),m);break e}cb(u,o,kn,Xc,kh,a,Zn,Ca,Ni,Rr,y,null,-0,0)}}break}while(!0);As(n)}function cb(n,a,o,u,m,y,E,k,P,K,le,de,Q,ne){if(n.timeoutHandle=-1,de=a.subtreeFlags,de&8192||(de&16785408)===16785408){de={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:qs},tb(a,y,de);var Ne=(y&62914560)===y?Yc-Se():(y&4194048)===y?ab-Se():0;if(Ne=t2(de,Ne),Ne!==null){or=y,n.cancelPendingCommit=Ne(yb.bind(null,n,a,y,o,u,m,E,k,P,le,de,null,Q,ne)),Mr(n,y,E,!K);return}}yb(n,a,y,o,u,m,E,k,P)}function yA(n){for(var a=n;;){var o=a.tag;if((o===0||o===11||o===15)&&a.flags&16384&&(o=a.updateQueue,o!==null&&(o=o.stores,o!==null)))for(var u=0;u<o.length;u++){var m=o[u],y=m.getSnapshot;m=m.value;try{if(!Pn(y(),m))return!1}catch{return!1}}if(o=a.child,a.subtreeFlags&16384&&o!==null)o.return=a,a=o;else{if(a===n)break;for(;a.sibling===null;){if(a.return===null||a.return===n)return!0;a=a.return}a.sibling.return=a.return,a=a.sibling}}return!0}function Mr(n,a,o,u){a&=~_h,a&=~Ca,n.suspendedLanes|=a,n.pingedLanes&=~a,u&&(n.warmLanes|=a),u=n.expirationTimes;for(var m=a;0<m;){var y=31-nt(m),E=1<<y;u[y]=-1,m&=~E}o!==0&&vo(n,o,a)}function Kc(){return(at&6)===0?(Qo(0),!1):!0}function zh(){if(qe!==null){if(lt===0)var n=qe.return;else n=qe,Ks=va=null,Wf(n),gi=null,zo=0,n=qe;for(;n!==null;)$0(n.alternate,n),n=n.return;qe=null}}function ji(n,a){var o=n.timeoutHandle;o!==-1&&(n.timeoutHandle=-1,LA(o)),o=n.cancelPendingCommit,o!==null&&(n.cancelPendingCommit=null,o()),or=0,zh(),pt=n,qe=o=Gs(n.current,null),Xe=a,lt=0,Bn=null,Rr=!1,Ei=mr(n,a),Ah=!1,Ni=Zn=_h=Ca=Ar=Ot=0,kn=Wo=null,kh=!1,(a&8)!==0&&(a|=a&32);var u=n.entangledLanes;if(u!==0)for(n=n.entanglements,u&=a;0<u;){var m=31-nt(u),y=1<<m;a|=n[m],u&=~y}return ir=a,yc(),o}function ub(n,a){Ve=null,z.H=Zo,a===mi||a===Tc?(a=jv(),lt=3):a===Uf?(a=jv(),lt=4):lt=a===hh?8:a!==null&&typeof a=="object"&&typeof a.then=="function"?6:1,Bn=a,qe===null&&(Ot=1,Uc(n,es(a,n.current)))}function db(){var n=$n.current;return n===null?!0:(Xe&4194048)===Xe?rs===null:(Xe&62914560)===Xe||(Xe&536870912)!==0?n===rs:!1}function fb(){var n=z.H;return z.H=Zo,n===null?Zo:n}function hb(){var n=z.A;return z.A=mA,n}function Wc(){Ot=4,Rr||(Xe&4194048)!==Xe&&$n.current!==null||(Ei=!0),(Ar&134217727)===0&&(Ca&134217727)===0||pt===null||Mr(pt,Xe,Zn,!1)}function Ih(n,a,o){var u=at;at|=2;var m=fb(),y=hb();(pt!==n||Xe!==a)&&(Xc=null,ji(n,a)),a=!1;var E=Ot;e:do try{if(lt!==0&&qe!==null){var k=qe,P=Bn;switch(lt){case 8:zh(),E=6;break e;case 3:case 2:case 9:case 6:$n.current===null&&(a=!0);var K=lt;if(lt=0,Bn=null,Ci(n,k,P,K),o&&Ei){E=0;break e}break;default:K=lt,lt=0,Bn=null,Ci(n,k,P,K)}}vA(),E=Ot;break}catch(le){ub(n,le)}while(!0);return a&&n.shellSuspendCounter++,Ks=va=null,at=u,z.H=m,z.A=y,qe===null&&(pt=null,Xe=0,yc()),E}function vA(){for(;qe!==null;)pb(qe)}function bA(n,a){var o=at;at|=2;var u=fb(),m=hb();pt!==n||Xe!==a?(Xc=null,Gc=Se()+500,ji(n,a)):Ei=mr(n,a);e:do try{if(lt!==0&&qe!==null){a=qe;var y=Bn;t:switch(lt){case 1:lt=0,Bn=null,Ci(n,a,y,1);break;case 2:case 9:if(Nv(y)){lt=0,Bn=null,mb(a);break}a=function(){lt!==2&&lt!==9||pt!==n||(lt=7),As(n)},y.then(a,a);break e;case 3:lt=7;break e;case 4:lt=5;break e;case 7:Nv(y)?(lt=0,Bn=null,mb(a)):(lt=0,Bn=null,Ci(n,a,y,7));break;case 5:var E=null;switch(qe.tag){case 26:E=qe.memoizedState;case 5:case 27:var k=qe;if(E?ex(E):k.stateNode.complete){lt=0,Bn=null;var P=k.sibling;if(P!==null)qe=P;else{var K=k.return;K!==null?(qe=K,Jc(K)):qe=null}break t}}lt=0,Bn=null,Ci(n,a,y,5);break;case 6:lt=0,Bn=null,Ci(n,a,y,6);break;case 8:zh(),Ot=6;break e;default:throw Error(r(462))}}xA();break}catch(le){ub(n,le)}while(!0);return Ks=va=null,z.H=u,z.A=m,at=o,qe!==null?0:(pt=null,Xe=0,yc(),Ot)}function xA(){for(;qe!==null&&!Oe();)pb(qe)}function pb(n){var a=P0(n.alternate,n,ir);n.memoizedProps=n.pendingProps,a===null?Jc(n):qe=a}function mb(n){var a=n,o=a.alternate;switch(a.tag){case 15:case 0:a=M0(o,a,a.pendingProps,a.type,void 0,Xe);break;case 11:a=M0(o,a,a.pendingProps,a.type.render,a.ref,Xe);break;case 5:Wf(a);default:$0(o,a),a=qe=hv(a,ir),a=P0(o,a,ir)}n.memoizedProps=n.pendingProps,a===null?Jc(n):qe=a}function Ci(n,a,o,u){Ks=va=null,Wf(a),gi=null,zo=0;var m=a.return;try{if(lA(n,m,a,o,Xe)){Ot=1,Uc(n,es(o,n.current)),qe=null;return}}catch(y){if(m!==null)throw qe=m,y;Ot=1,Uc(n,es(o,n.current)),qe=null;return}a.flags&32768?(Je||u===1?n=!0:Ei||(Xe&536870912)!==0?n=!1:(Rr=n=!0,(u===2||u===9||u===3||u===6)&&(u=$n.current,u!==null&&u.tag===13&&(u.flags|=16384))),gb(a,n)):Jc(a)}function Jc(n){var a=n;do{if((a.flags&32768)!==0){gb(a,Rr);return}n=a.return;var o=dA(a.alternate,a,ir);if(o!==null){qe=o;return}if(a=a.sibling,a!==null){qe=a;return}qe=a=n}while(a!==null);Ot===0&&(Ot=5)}function gb(n,a){do{var o=fA(n.alternate,n);if(o!==null){o.flags&=32767,qe=o;return}if(o=n.return,o!==null&&(o.flags|=32768,o.subtreeFlags=0,o.deletions=null),!a&&(n=n.sibling,n!==null)){qe=n;return}qe=n=o}while(n!==null);Ot=6,qe=null}function yb(n,a,o,u,m,y,E,k,P){n.cancelPendingCommit=null;do Qc();while(Gt!==0);if((at&6)!==0)throw Error(r(327));if(a!==null){if(a===n.current)throw Error(r(177));if(y=a.lanes|a.childLanes,y|=Nf,yo(n,o,y,E,k,P),n===pt&&(qe=pt=null,Xe=0),Ti=a,kr=n,or=o,Mh=y,Oh=m,ib=u,(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?(n.callbackNode=null,n.callbackPriority=0,NA(Fe,function(){return Sb(),null})):(n.callbackNode=null,n.callbackPriority=0),u=(a.flags&13878)!==0,(a.subtreeFlags&13878)!==0||u){u=z.T,z.T=null,m=Z.p,Z.p=2,E=at,at|=4;try{hA(n,a,o)}finally{at=E,Z.p=m,z.T=u}}Gt=1,vb(),bb(),xb()}}function vb(){if(Gt===1){Gt=0;var n=kr,a=Ti,o=(a.flags&13878)!==0;if((a.subtreeFlags&13878)!==0||o){o=z.T,z.T=null;var u=Z.p;Z.p=2;var m=at;at|=4;try{J0(a,n);var y=Gh,E=rv(n.containerInfo),k=y.focusedElem,P=y.selectionRange;if(E!==k&&k&&k.ownerDocument&&sv(k.ownerDocument.documentElement,k)){if(P!==null&&bf(k)){var K=P.start,le=P.end;if(le===void 0&&(le=K),"selectionStart"in k)k.selectionStart=K,k.selectionEnd=Math.min(le,k.value.length);else{var de=k.ownerDocument||document,Q=de&&de.defaultView||window;if(Q.getSelection){var ne=Q.getSelection(),Ne=k.textContent.length,ze=Math.min(P.start,Ne),ht=P.end===void 0?ze:Math.min(P.end,Ne);!ne.extend&&ze>ht&&(E=ht,ht=ze,ze=E);var q=nv(k,ze),V=nv(k,ht);if(q&&V&&(ne.rangeCount!==1||ne.anchorNode!==q.node||ne.anchorOffset!==q.offset||ne.focusNode!==V.node||ne.focusOffset!==V.offset)){var X=de.createRange();X.setStart(q.node,q.offset),ne.removeAllRanges(),ze>ht?(ne.addRange(X),ne.extend(V.node,V.offset)):(X.setEnd(V.node,V.offset),ne.addRange(X))}}}}for(de=[],ne=k;ne=ne.parentNode;)ne.nodeType===1&&de.push({element:ne,left:ne.scrollLeft,top:ne.scrollTop});for(typeof k.focus=="function"&&k.focus(),k=0;k<de.length;k++){var ue=de[k];ue.element.scrollLeft=ue.left,ue.element.scrollTop=ue.top}}du=!!Yh,Gh=Yh=null}finally{at=m,Z.p=u,z.T=o}}n.current=a,Gt=2}}function bb(){if(Gt===2){Gt=0;var n=kr,a=Ti,o=(a.flags&8772)!==0;if((a.subtreeFlags&8772)!==0||o){o=z.T,z.T=null;var u=Z.p;Z.p=2;var m=at;at|=4;try{Y0(n,a.alternate,a)}finally{at=m,Z.p=u,z.T=o}}Gt=3}}function xb(){if(Gt===4||Gt===3){Gt=0,ye();var n=kr,a=Ti,o=or,u=ib;(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?Gt=5:(Gt=0,Ti=kr=null,wb(n,n.pendingLanes));var m=n.pendingLanes;if(m===0&&(_r=null),bo(o),a=a.stateNode,De&&typeof De.onCommitFiberRoot=="function")try{De.onCommitFiberRoot(Qt,a,void 0,(a.current.flags&128)===128)}catch{}if(u!==null){a=z.T,m=Z.p,Z.p=2,z.T=null;try{for(var y=n.onRecoverableError,E=0;E<u.length;E++){var k=u[E];y(k.value,{componentStack:k.stack})}}finally{z.T=a,Z.p=m}}(or&3)!==0&&Qc(),As(n),m=n.pendingLanes,(o&261930)!==0&&(m&42)!==0?n===Dh?Jo++:(Jo=0,Dh=n):Jo=0,Qo(0)}}function wb(n,a){(n.pooledCacheLanes&=a)===0&&(a=n.pooledCache,a!=null&&(n.pooledCache=null,Oo(a)))}function Qc(){return vb(),bb(),xb(),Sb()}function Sb(){if(Gt!==5)return!1;var n=kr,a=Mh;Mh=0;var o=bo(or),u=z.T,m=Z.p;try{Z.p=32>o?32:o,z.T=null,o=Oh,Oh=null;var y=kr,E=or;if(Gt=0,Ti=kr=null,or=0,(at&6)!==0)throw Error(r(331));var k=at;if(at|=4,sb(y.current),eb(y,y.current,E,o),at=k,Qo(0,!1),De&&typeof De.onPostCommitFiberRoot=="function")try{De.onPostCommitFiberRoot(Qt,y)}catch{}return!0}finally{Z.p=m,z.T=u,wb(n,a)}}function Eb(n,a,o){a=es(o,a),a=fh(n.stateNode,a,2),n=Nr(n,a,2),n!==null&&(ua(n,2),As(n))}function ct(n,a,o){if(n.tag===3)Eb(n,n,o);else for(;a!==null;){if(a.tag===3){Eb(a,n,o);break}else if(a.tag===1){var u=a.stateNode;if(typeof a.type.getDerivedStateFromError=="function"||typeof u.componentDidCatch=="function"&&(_r===null||!_r.has(u))){n=es(o,n),o=N0(2),u=Nr(a,o,2),u!==null&&(T0(o,u,a,n),ua(u,2),As(u));break}}a=a.return}}function Lh(n,a,o){var u=n.pingCache;if(u===null){u=n.pingCache=new gA;var m=new Set;u.set(a,m)}else m=u.get(a),m===void 0&&(m=new Set,u.set(a,m));m.has(o)||(Ah=!0,m.add(o),n=wA.bind(null,n,a,o),a.then(n,n))}function wA(n,a,o){var u=n.pingCache;u!==null&&u.delete(a),n.pingedLanes|=n.suspendedLanes&o,n.warmLanes&=~o,pt===n&&(Xe&o)===o&&(Ot===4||Ot===3&&(Xe&62914560)===Xe&&300>Se()-Yc?(at&2)===0&&ji(n,0):_h|=o,Ni===Xe&&(Ni=0)),As(n)}function Nb(n,a){a===0&&(a=tc()),n=ma(n,a),n!==null&&(ua(n,a),As(n))}function SA(n){var a=n.memoizedState,o=0;a!==null&&(o=a.retryLane),Nb(n,o)}function EA(n,a){var o=0;switch(n.tag){case 31:case 13:var u=n.stateNode,m=n.memoizedState;m!==null&&(o=m.retryLane);break;case 19:u=n.stateNode;break;case 22:u=n.stateNode._retryCache;break;default:throw Error(r(314))}u!==null&&u.delete(a),Nb(n,o)}function NA(n,a){return Ce(n,a)}var eu=null,Ri=null,Ph=!1,tu=!1,Uh=!1,Or=0;function As(n){n!==Ri&&n.next===null&&(Ri===null?eu=Ri=n:Ri=Ri.next=n),tu=!0,Ph||(Ph=!0,jA())}function Qo(n,a){if(!Uh&&tu){Uh=!0;do for(var o=!1,u=eu;u!==null;){if(n!==0){var m=u.pendingLanes;if(m===0)var y=0;else{var E=u.suspendedLanes,k=u.pingedLanes;y=(1<<31-nt(42|n)+1)-1,y&=m&~(E&~k),y=y&201326741?y&201326741|1:y?y|2:0}y!==0&&(o=!0,Rb(u,y))}else y=Xe,y=pr(u,u===pt?y:0,u.cancelPendingCommit!==null||u.timeoutHandle!==-1),(y&3)===0||mr(u,y)||(o=!0,Rb(u,y));u=u.next}while(o);Uh=!1}}function TA(){Tb()}function Tb(){tu=Ph=!1;var n=0;Or!==0&&IA()&&(n=Or);for(var a=Se(),o=null,u=eu;u!==null;){var m=u.next,y=jb(u,a);y===0?(u.next=null,o===null?eu=m:o.next=m,m===null&&(Ri=o)):(o=u,(n!==0||(y&3)!==0)&&(tu=!0)),u=m}Gt!==0&&Gt!==5||Qo(n),Or!==0&&(Or=0)}function jb(n,a){for(var o=n.suspendedLanes,u=n.pingedLanes,m=n.expirationTimes,y=n.pendingLanes&-62914561;0<y;){var E=31-nt(y),k=1<<E,P=m[E];P===-1?((k&o)===0||(k&u)!==0)&&(m[E]=Qd(k,a)):P<=a&&(n.expiredLanes|=k),y&=~k}if(a=pt,o=Xe,o=pr(n,n===a?o:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),u=n.callbackNode,o===0||n===a&&(lt===2||lt===9)||n.cancelPendingCommit!==null)return u!==null&&u!==null&&ge(u),n.callbackNode=null,n.callbackPriority=0;if((o&3)===0||mr(n,o)){if(a=o&-o,a===n.callbackPriority)return a;switch(u!==null&&ge(u),bo(o)){case 2:case 8:o=ot;break;case 32:o=Fe;break;case 268435456:o=Kt;break;default:o=Fe}return u=Cb.bind(null,n),o=Ce(o,u),n.callbackPriority=a,n.callbackNode=o,a}return u!==null&&u!==null&&ge(u),n.callbackPriority=2,n.callbackNode=null,2}function Cb(n,a){if(Gt!==0&&Gt!==5)return n.callbackNode=null,n.callbackPriority=0,null;var o=n.callbackNode;if(Qc()&&n.callbackNode!==o)return null;var u=Xe;return u=pr(n,n===pt?u:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),u===0?null:(lb(n,u,a),jb(n,Se()),n.callbackNode!=null&&n.callbackNode===o?Cb.bind(null,n):null)}function Rb(n,a){if(Qc())return null;lb(n,a,!0)}function jA(){PA(function(){(at&6)!==0?Ce(We,TA):Tb()})}function $h(){if(Or===0){var n=hi;n===0&&(n=Yt,Yt<<=1,(Yt&261888)===0&&(Yt=256)),Or=n}return Or}function Ab(n){return n==null||typeof n=="symbol"||typeof n=="boolean"?null:typeof n=="function"?n:cc(""+n)}function _b(n,a){var o=a.ownerDocument.createElement("input");return o.name=a.name,o.value=a.value,n.id&&o.setAttribute("form",n.id),a.parentNode.insertBefore(o,a),n=new FormData(n),o.parentNode.removeChild(o),n}function CA(n,a,o,u,m){if(a==="submit"&&o&&o.stateNode===m){var y=Ab((m[jn]||null).action),E=u.submitter;E&&(a=(a=E[jn]||null)?Ab(a.formAction):E.getAttribute("formAction"),a!==null&&(y=a,E=null));var k=new hc("action","action",null,u,m);n.push({event:k,listeners:[{instance:null,listener:function(){if(u.defaultPrevented){if(Or!==0){var P=E?_b(m,E):new FormData(m);ih(o,{pending:!0,data:P,method:m.method,action:y},null,P)}}else typeof y=="function"&&(k.preventDefault(),P=E?_b(m,E):new FormData(m),ih(o,{pending:!0,data:P,method:m.method,action:y},y,P))},currentTarget:m}]})}}for(var Vh=0;Vh<Ef.length;Vh++){var Bh=Ef[Vh],RA=Bh.toLowerCase(),AA=Bh[0].toUpperCase()+Bh.slice(1);hs(RA,"on"+AA)}hs(ov,"onAnimationEnd"),hs(lv,"onAnimationIteration"),hs(cv,"onAnimationStart"),hs("dblclick","onDoubleClick"),hs("focusin","onFocus"),hs("focusout","onBlur"),hs(FR,"onTransitionRun"),hs(qR,"onTransitionStart"),hs(YR,"onTransitionCancel"),hs(uv,"onTransitionEnd"),Qa("onMouseEnter",["mouseout","mouseover"]),Qa("onMouseLeave",["mouseout","mouseover"]),Qa("onPointerEnter",["pointerout","pointerover"]),Qa("onPointerLeave",["pointerout","pointerover"]),da("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),da("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),da("onBeforeInput",["compositionend","keypress","textInput","paste"]),da("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),da("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),da("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var el="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(" "),_A=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(el));function kb(n,a){a=(a&4)!==0;for(var o=0;o<n.length;o++){var u=n[o],m=u.event;u=u.listeners;e:{var y=void 0;if(a)for(var E=u.length-1;0<=E;E--){var k=u[E],P=k.instance,K=k.currentTarget;if(k=k.listener,P!==y&&m.isPropagationStopped())break e;y=k,m.currentTarget=K;try{y(m)}catch(le){gc(le)}m.currentTarget=null,y=P}else for(E=0;E<u.length;E++){if(k=u[E],P=k.instance,K=k.currentTarget,k=k.listener,P!==y&&m.isPropagationStopped())break e;y=k,m.currentTarget=K;try{y(m)}catch(le){gc(le)}m.currentTarget=null,y=P}}}}function Ye(n,a){var o=a[ef];o===void 0&&(o=a[ef]=new Set);var u=n+"__bubble";o.has(u)||(Mb(a,n,2,!1),o.add(u))}function Zh(n,a,o){var u=0;a&&(u|=4),Mb(o,n,u,a)}var nu="_reactListening"+Math.random().toString(36).slice(2);function Hh(n){if(!n[nu]){n[nu]=!0,Ty.forEach(function(o){o!=="selectionchange"&&(_A.has(o)||Zh(o,!1,n),Zh(o,!0,n))});var a=n.nodeType===9?n:n.ownerDocument;a===null||a[nu]||(a[nu]=!0,Zh("selectionchange",!1,a))}}function Mb(n,a,o,u){switch(ox(a)){case 2:var m=r2;break;case 8:m=a2;break;default:m=ap}o=m.bind(null,a,o,n),m=void 0,!uf||a!=="touchstart"&&a!=="touchmove"&&a!=="wheel"||(m=!0),u?m!==void 0?n.addEventListener(a,o,{capture:!0,passive:m}):n.addEventListener(a,o,!0):m!==void 0?n.addEventListener(a,o,{passive:m}):n.addEventListener(a,o,!1)}function Fh(n,a,o,u,m){var y=u;if((a&1)===0&&(a&2)===0&&u!==null)e:for(;;){if(u===null)return;var E=u.tag;if(E===3||E===4){var k=u.stateNode.containerInfo;if(k===m)break;if(E===4)for(E=u.return;E!==null;){var P=E.tag;if((P===3||P===4)&&E.stateNode.containerInfo===m)return;E=E.return}for(;k!==null;){if(E=Ka(k),E===null)return;if(P=E.tag,P===5||P===6||P===26||P===27){u=y=E;continue e}k=k.parentNode}}u=u.return}Ly(function(){var K=y,le=lf(o),de=[];e:{var Q=dv.get(n);if(Q!==void 0){var ne=hc,Ne=n;switch(n){case"keypress":if(dc(o)===0)break e;case"keydown":case"keyup":ne=ER;break;case"focusin":Ne="focus",ne=pf;break;case"focusout":Ne="blur",ne=pf;break;case"beforeblur":case"afterblur":ne=pf;break;case"click":if(o.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":ne=$y;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ne=dR;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ne=jR;break;case ov:case lv:case cv:ne=pR;break;case uv:ne=RR;break;case"scroll":case"scrollend":ne=cR;break;case"wheel":ne=_R;break;case"copy":case"cut":case"paste":ne=gR;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ne=By;break;case"toggle":case"beforetoggle":ne=MR}var ze=(a&4)!==0,ht=!ze&&(n==="scroll"||n==="scrollend"),q=ze?Q!==null?Q+"Capture":null:Q;ze=[];for(var V=K,X;V!==null;){var ue=V;if(X=ue.stateNode,ue=ue.tag,ue!==5&&ue!==26&&ue!==27||X===null||q===null||(ue=So(V,q),ue!=null&&ze.push(tl(V,ue,X))),ht)break;V=V.return}0<ze.length&&(Q=new ne(Q,Ne,null,o,le),de.push({event:Q,listeners:ze}))}}if((a&7)===0){e:{if(Q=n==="mouseover"||n==="pointerover",ne=n==="mouseout"||n==="pointerout",Q&&o!==of&&(Ne=o.relatedTarget||o.fromElement)&&(Ka(Ne)||Ne[Xa]))break e;if((ne||Q)&&(Q=le.window===le?le:(Q=le.ownerDocument)?Q.defaultView||Q.parentWindow:window,ne?(Ne=o.relatedTarget||o.toElement,ne=K,Ne=Ne?Ka(Ne):null,Ne!==null&&(ht=l(Ne),ze=Ne.tag,Ne!==ht||ze!==5&&ze!==27&&ze!==6)&&(Ne=null)):(ne=null,Ne=K),ne!==Ne)){if(ze=$y,ue="onMouseLeave",q="onMouseEnter",V="mouse",(n==="pointerout"||n==="pointerover")&&(ze=By,ue="onPointerLeave",q="onPointerEnter",V="pointer"),ht=ne==null?Q:wo(ne),X=Ne==null?Q:wo(Ne),Q=new ze(ue,V+"leave",ne,o,le),Q.target=ht,Q.relatedTarget=X,ue=null,Ka(le)===K&&(ze=new ze(q,V+"enter",Ne,o,le),ze.target=X,ze.relatedTarget=ht,ue=ze),ht=ue,ne&&Ne)t:{for(ze=kA,q=ne,V=Ne,X=0,ue=q;ue;ue=ze(ue))X++;ue=0;for(var Me=V;Me;Me=ze(Me))ue++;for(;0<X-ue;)q=ze(q),X--;for(;0<ue-X;)V=ze(V),ue--;for(;X--;){if(q===V||V!==null&&q===V.alternate){ze=q;break t}q=ze(q),V=ze(V)}ze=null}else ze=null;ne!==null&&Ob(de,Q,ne,ze,!1),Ne!==null&&ht!==null&&Ob(de,ht,Ne,ze,!0)}}e:{if(Q=K?wo(K):window,ne=Q.nodeName&&Q.nodeName.toLowerCase(),ne==="select"||ne==="input"&&Q.type==="file")var st=Ky;else if(Gy(Q))if(Wy)st=BR;else{st=$R;var Ae=UR}else ne=Q.nodeName,!ne||ne.toLowerCase()!=="input"||Q.type!=="checkbox"&&Q.type!=="radio"?K&&af(K.elementType)&&(st=Ky):st=VR;if(st&&(st=st(n,K))){Xy(de,st,o,le);break e}Ae&&Ae(n,Q,K),n==="focusout"&&K&&Q.type==="number"&&K.memoizedProps.value!=null&&rf(Q,"number",Q.value)}switch(Ae=K?wo(K):window,n){case"focusin":(Gy(Ae)||Ae.contentEditable==="true")&&(ai=Ae,xf=K,_o=null);break;case"focusout":_o=xf=ai=null;break;case"mousedown":wf=!0;break;case"contextmenu":case"mouseup":case"dragend":wf=!1,av(de,o,le);break;case"selectionchange":if(HR)break;case"keydown":case"keyup":av(de,o,le)}var Be;if(gf)e:{switch(n){case"compositionstart":var Ke="onCompositionStart";break e;case"compositionend":Ke="onCompositionEnd";break e;case"compositionupdate":Ke="onCompositionUpdate";break e}Ke=void 0}else ri?qy(n,o)&&(Ke="onCompositionEnd"):n==="keydown"&&o.keyCode===229&&(Ke="onCompositionStart");Ke&&(Zy&&o.locale!=="ko"&&(ri||Ke!=="onCompositionStart"?Ke==="onCompositionEnd"&&ri&&(Be=Py()):(yr=le,df="value"in yr?yr.value:yr.textContent,ri=!0)),Ae=su(K,Ke),0<Ae.length&&(Ke=new Vy(Ke,n,null,o,le),de.push({event:Ke,listeners:Ae}),Be?Ke.data=Be:(Be=Yy(o),Be!==null&&(Ke.data=Be)))),(Be=DR?zR(n,o):IR(n,o))&&(Ke=su(K,"onBeforeInput"),0<Ke.length&&(Ae=new Vy("onBeforeInput","beforeinput",null,o,le),de.push({event:Ae,listeners:Ke}),Ae.data=Be)),CA(de,n,K,o,le)}kb(de,a)})}function tl(n,a,o){return{instance:n,listener:a,currentTarget:o}}function su(n,a){for(var o=a+"Capture",u=[];n!==null;){var m=n,y=m.stateNode;if(m=m.tag,m!==5&&m!==26&&m!==27||y===null||(m=So(n,o),m!=null&&u.unshift(tl(n,m,y)),m=So(n,a),m!=null&&u.push(tl(n,m,y))),n.tag===3)return u;n=n.return}return[]}function kA(n){if(n===null)return null;do n=n.return;while(n&&n.tag!==5&&n.tag!==27);return n||null}function Ob(n,a,o,u,m){for(var y=a._reactName,E=[];o!==null&&o!==u;){var k=o,P=k.alternate,K=k.stateNode;if(k=k.tag,P!==null&&P===u)break;k!==5&&k!==26&&k!==27||K===null||(P=K,m?(K=So(o,y),K!=null&&E.unshift(tl(o,K,P))):m||(K=So(o,y),K!=null&&E.push(tl(o,K,P)))),o=o.return}E.length!==0&&n.push({event:a,listeners:E})}var MA=/\r\n?/g,OA=/\u0000|\uFFFD/g;function Db(n){return(typeof n=="string"?n:""+n).replace(MA,`
9
- `).replace(OA,"")}function zb(n,a){return a=Db(a),Db(n)===a}function ft(n,a,o,u,m,y){switch(o){case"children":typeof u=="string"?a==="body"||a==="textarea"&&u===""||ti(n,u):(typeof u=="number"||typeof u=="bigint")&&a!=="body"&&ti(n,""+u);break;case"className":oc(n,"class",u);break;case"tabIndex":oc(n,"tabindex",u);break;case"dir":case"role":case"viewBox":case"width":case"height":oc(n,o,u);break;case"style":zy(n,u,y);break;case"data":if(a!=="object"){oc(n,"data",u);break}case"src":case"href":if(u===""&&(a!=="a"||o!=="href")){n.removeAttribute(o);break}if(u==null||typeof u=="function"||typeof u=="symbol"||typeof u=="boolean"){n.removeAttribute(o);break}u=cc(""+u),n.setAttribute(o,u);break;case"action":case"formAction":if(typeof u=="function"){n.setAttribute(o,"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 y=="function"&&(o==="formAction"?(a!=="input"&&ft(n,a,"name",m.name,m,null),ft(n,a,"formEncType",m.formEncType,m,null),ft(n,a,"formMethod",m.formMethod,m,null),ft(n,a,"formTarget",m.formTarget,m,null)):(ft(n,a,"encType",m.encType,m,null),ft(n,a,"method",m.method,m,null),ft(n,a,"target",m.target,m,null)));if(u==null||typeof u=="symbol"||typeof u=="boolean"){n.removeAttribute(o);break}u=cc(""+u),n.setAttribute(o,u);break;case"onClick":u!=null&&(n.onclick=qs);break;case"onScroll":u!=null&&Ye("scroll",n);break;case"onScrollEnd":u!=null&&Ye("scrollend",n);break;case"dangerouslySetInnerHTML":if(u!=null){if(typeof u!="object"||!("__html"in u))throw Error(r(61));if(o=u.__html,o!=null){if(m.children!=null)throw Error(r(60));n.innerHTML=o}}break;case"multiple":n.multiple=u&&typeof u!="function"&&typeof u!="symbol";break;case"muted":n.muted=u&&typeof u!="function"&&typeof u!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(u==null||typeof u=="function"||typeof u=="boolean"||typeof u=="symbol"){n.removeAttribute("xlink:href");break}o=cc(""+u),n.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",o);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":u!=null&&typeof u!="function"&&typeof u!="symbol"?n.setAttribute(o,""+u):n.removeAttribute(o);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":u&&typeof u!="function"&&typeof u!="symbol"?n.setAttribute(o,""):n.removeAttribute(o);break;case"capture":case"download":u===!0?n.setAttribute(o,""):u!==!1&&u!=null&&typeof u!="function"&&typeof u!="symbol"?n.setAttribute(o,u):n.removeAttribute(o);break;case"cols":case"rows":case"size":case"span":u!=null&&typeof u!="function"&&typeof u!="symbol"&&!isNaN(u)&&1<=u?n.setAttribute(o,u):n.removeAttribute(o);break;case"rowSpan":case"start":u==null||typeof u=="function"||typeof u=="symbol"||isNaN(u)?n.removeAttribute(o):n.setAttribute(o,u);break;case"popover":Ye("beforetoggle",n),Ye("toggle",n),ic(n,"popover",u);break;case"xlinkActuate":Fs(n,"http://www.w3.org/1999/xlink","xlink:actuate",u);break;case"xlinkArcrole":Fs(n,"http://www.w3.org/1999/xlink","xlink:arcrole",u);break;case"xlinkRole":Fs(n,"http://www.w3.org/1999/xlink","xlink:role",u);break;case"xlinkShow":Fs(n,"http://www.w3.org/1999/xlink","xlink:show",u);break;case"xlinkTitle":Fs(n,"http://www.w3.org/1999/xlink","xlink:title",u);break;case"xlinkType":Fs(n,"http://www.w3.org/1999/xlink","xlink:type",u);break;case"xmlBase":Fs(n,"http://www.w3.org/XML/1998/namespace","xml:base",u);break;case"xmlLang":Fs(n,"http://www.w3.org/XML/1998/namespace","xml:lang",u);break;case"xmlSpace":Fs(n,"http://www.w3.org/XML/1998/namespace","xml:space",u);break;case"is":ic(n,"is",u);break;case"innerText":case"textContent":break;default:(!(2<o.length)||o[0]!=="o"&&o[0]!=="O"||o[1]!=="n"&&o[1]!=="N")&&(o=oR.get(o)||o,ic(n,o,u))}}function qh(n,a,o,u,m,y){switch(o){case"style":zy(n,u,y);break;case"dangerouslySetInnerHTML":if(u!=null){if(typeof u!="object"||!("__html"in u))throw Error(r(61));if(o=u.__html,o!=null){if(m.children!=null)throw Error(r(60));n.innerHTML=o}}break;case"children":typeof u=="string"?ti(n,u):(typeof u=="number"||typeof u=="bigint")&&ti(n,""+u);break;case"onScroll":u!=null&&Ye("scroll",n);break;case"onScrollEnd":u!=null&&Ye("scrollend",n);break;case"onClick":u!=null&&(n.onclick=qs);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!jy.hasOwnProperty(o))e:{if(o[0]==="o"&&o[1]==="n"&&(m=o.endsWith("Capture"),a=o.slice(2,m?o.length-7:void 0),y=n[jn]||null,y=y!=null?y[o]:null,typeof y=="function"&&n.removeEventListener(a,y,m),typeof u=="function")){typeof y!="function"&&y!==null&&(o in n?n[o]=null:n.hasAttribute(o)&&n.removeAttribute(o)),n.addEventListener(a,u,m);break e}o in n?n[o]=u:u===!0?n.setAttribute(o,""):ic(n,o,u)}}}function an(n,a,o){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Ye("error",n),Ye("load",n);var u=!1,m=!1,y;for(y in o)if(o.hasOwnProperty(y)){var E=o[y];if(E!=null)switch(y){case"src":u=!0;break;case"srcSet":m=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,a));default:ft(n,a,y,E,o,null)}}m&&ft(n,a,"srcSet",o.srcSet,o,null),u&&ft(n,a,"src",o.src,o,null);return;case"input":Ye("invalid",n);var k=y=E=m=null,P=null,K=null;for(u in o)if(o.hasOwnProperty(u)){var le=o[u];if(le!=null)switch(u){case"name":m=le;break;case"type":E=le;break;case"checked":P=le;break;case"defaultChecked":K=le;break;case"value":y=le;break;case"defaultValue":k=le;break;case"children":case"dangerouslySetInnerHTML":if(le!=null)throw Error(r(137,a));break;default:ft(n,a,u,le,o,null)}}ky(n,y,k,P,K,E,m,!1);return;case"select":Ye("invalid",n),u=E=y=null;for(m in o)if(o.hasOwnProperty(m)&&(k=o[m],k!=null))switch(m){case"value":y=k;break;case"defaultValue":E=k;break;case"multiple":u=k;default:ft(n,a,m,k,o,null)}a=y,o=E,n.multiple=!!u,a!=null?ei(n,!!u,a,!1):o!=null&&ei(n,!!u,o,!0);return;case"textarea":Ye("invalid",n),y=m=u=null;for(E in o)if(o.hasOwnProperty(E)&&(k=o[E],k!=null))switch(E){case"value":u=k;break;case"defaultValue":m=k;break;case"children":y=k;break;case"dangerouslySetInnerHTML":if(k!=null)throw Error(r(91));break;default:ft(n,a,E,k,o,null)}Oy(n,u,m,y);return;case"option":for(P in o)o.hasOwnProperty(P)&&(u=o[P],u!=null)&&(P==="selected"?n.selected=u&&typeof u!="function"&&typeof u!="symbol":ft(n,a,P,u,o,null));return;case"dialog":Ye("beforetoggle",n),Ye("toggle",n),Ye("cancel",n),Ye("close",n);break;case"iframe":case"object":Ye("load",n);break;case"video":case"audio":for(u=0;u<el.length;u++)Ye(el[u],n);break;case"image":Ye("error",n),Ye("load",n);break;case"details":Ye("toggle",n);break;case"embed":case"source":case"link":Ye("error",n),Ye("load",n);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(K in o)if(o.hasOwnProperty(K)&&(u=o[K],u!=null))switch(K){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,a));default:ft(n,a,K,u,o,null)}return;default:if(af(a)){for(le in o)o.hasOwnProperty(le)&&(u=o[le],u!==void 0&&qh(n,a,le,u,o,void 0));return}}for(k in o)o.hasOwnProperty(k)&&(u=o[k],u!=null&&ft(n,a,k,u,o,null))}function DA(n,a,o,u){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var m=null,y=null,E=null,k=null,P=null,K=null,le=null;for(ne in o){var de=o[ne];if(o.hasOwnProperty(ne)&&de!=null)switch(ne){case"checked":break;case"value":break;case"defaultValue":P=de;default:u.hasOwnProperty(ne)||ft(n,a,ne,null,u,de)}}for(var Q in u){var ne=u[Q];if(de=o[Q],u.hasOwnProperty(Q)&&(ne!=null||de!=null))switch(Q){case"type":y=ne;break;case"name":m=ne;break;case"checked":K=ne;break;case"defaultChecked":le=ne;break;case"value":E=ne;break;case"defaultValue":k=ne;break;case"children":case"dangerouslySetInnerHTML":if(ne!=null)throw Error(r(137,a));break;default:ne!==de&&ft(n,a,Q,ne,u,de)}}sf(n,E,k,P,K,le,y,m);return;case"select":ne=E=k=Q=null;for(y in o)if(P=o[y],o.hasOwnProperty(y)&&P!=null)switch(y){case"value":break;case"multiple":ne=P;default:u.hasOwnProperty(y)||ft(n,a,y,null,u,P)}for(m in u)if(y=u[m],P=o[m],u.hasOwnProperty(m)&&(y!=null||P!=null))switch(m){case"value":Q=y;break;case"defaultValue":k=y;break;case"multiple":E=y;default:y!==P&&ft(n,a,m,y,u,P)}a=k,o=E,u=ne,Q!=null?ei(n,!!o,Q,!1):!!u!=!!o&&(a!=null?ei(n,!!o,a,!0):ei(n,!!o,o?[]:"",!1));return;case"textarea":ne=Q=null;for(k in o)if(m=o[k],o.hasOwnProperty(k)&&m!=null&&!u.hasOwnProperty(k))switch(k){case"value":break;case"children":break;default:ft(n,a,k,null,u,m)}for(E in u)if(m=u[E],y=o[E],u.hasOwnProperty(E)&&(m!=null||y!=null))switch(E){case"value":Q=m;break;case"defaultValue":ne=m;break;case"children":break;case"dangerouslySetInnerHTML":if(m!=null)throw Error(r(91));break;default:m!==y&&ft(n,a,E,m,u,y)}My(n,Q,ne);return;case"option":for(var Ne in o)Q=o[Ne],o.hasOwnProperty(Ne)&&Q!=null&&!u.hasOwnProperty(Ne)&&(Ne==="selected"?n.selected=!1:ft(n,a,Ne,null,u,Q));for(P in u)Q=u[P],ne=o[P],u.hasOwnProperty(P)&&Q!==ne&&(Q!=null||ne!=null)&&(P==="selected"?n.selected=Q&&typeof Q!="function"&&typeof Q!="symbol":ft(n,a,P,Q,u,ne));return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var ze in o)Q=o[ze],o.hasOwnProperty(ze)&&Q!=null&&!u.hasOwnProperty(ze)&&ft(n,a,ze,null,u,Q);for(K in u)if(Q=u[K],ne=o[K],u.hasOwnProperty(K)&&Q!==ne&&(Q!=null||ne!=null))switch(K){case"children":case"dangerouslySetInnerHTML":if(Q!=null)throw Error(r(137,a));break;default:ft(n,a,K,Q,u,ne)}return;default:if(af(a)){for(var ht in o)Q=o[ht],o.hasOwnProperty(ht)&&Q!==void 0&&!u.hasOwnProperty(ht)&&qh(n,a,ht,void 0,u,Q);for(le in u)Q=u[le],ne=o[le],!u.hasOwnProperty(le)||Q===ne||Q===void 0&&ne===void 0||qh(n,a,le,Q,u,ne);return}}for(var q in o)Q=o[q],o.hasOwnProperty(q)&&Q!=null&&!u.hasOwnProperty(q)&&ft(n,a,q,null,u,Q);for(de in u)Q=u[de],ne=o[de],!u.hasOwnProperty(de)||Q===ne||Q==null&&ne==null||ft(n,a,de,Q,u,ne)}function Ib(n){switch(n){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function zA(){if(typeof performance.getEntriesByType=="function"){for(var n=0,a=0,o=performance.getEntriesByType("resource"),u=0;u<o.length;u++){var m=o[u],y=m.transferSize,E=m.initiatorType,k=m.duration;if(y&&k&&Ib(E)){for(E=0,k=m.responseEnd,u+=1;u<o.length;u++){var P=o[u],K=P.startTime;if(K>k)break;var le=P.transferSize,de=P.initiatorType;le&&Ib(de)&&(P=P.responseEnd,E+=le*(P<k?1:(k-K)/(P-K)))}if(--u,a+=8*(y+E)/(m.duration/1e3),n++,10<n)break}}if(0<n)return a/n/1e6}return navigator.connection&&(n=navigator.connection.downlink,typeof n=="number")?n:5}var Yh=null,Gh=null;function ru(n){return n.nodeType===9?n:n.ownerDocument}function Lb(n){switch(n){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function Pb(n,a){if(n===0)switch(a){case"svg":return 1;case"math":return 2;default:return 0}return n===1&&a==="foreignObject"?0:n}function Xh(n,a){return n==="textarea"||n==="noscript"||typeof a.children=="string"||typeof a.children=="number"||typeof a.children=="bigint"||typeof a.dangerouslySetInnerHTML=="object"&&a.dangerouslySetInnerHTML!==null&&a.dangerouslySetInnerHTML.__html!=null}var Kh=null;function IA(){var n=window.event;return n&&n.type==="popstate"?n===Kh?!1:(Kh=n,!0):(Kh=null,!1)}var Ub=typeof setTimeout=="function"?setTimeout:void 0,LA=typeof clearTimeout=="function"?clearTimeout:void 0,$b=typeof Promise=="function"?Promise:void 0,PA=typeof queueMicrotask=="function"?queueMicrotask:typeof $b<"u"?function(n){return $b.resolve(null).then(n).catch(UA)}:Ub;function UA(n){setTimeout(function(){throw n})}function Dr(n){return n==="head"}function Vb(n,a){var o=a,u=0;do{var m=o.nextSibling;if(n.removeChild(o),m&&m.nodeType===8)if(o=m.data,o==="/$"||o==="/&"){if(u===0){n.removeChild(m),Mi(a);return}u--}else if(o==="$"||o==="$?"||o==="$~"||o==="$!"||o==="&")u++;else if(o==="html")nl(n.ownerDocument.documentElement);else if(o==="head"){o=n.ownerDocument.head,nl(o);for(var y=o.firstChild;y;){var E=y.nextSibling,k=y.nodeName;y[xo]||k==="SCRIPT"||k==="STYLE"||k==="LINK"&&y.rel.toLowerCase()==="stylesheet"||o.removeChild(y),y=E}}else o==="body"&&nl(n.ownerDocument.body);o=m}while(o);Mi(a)}function Bb(n,a){var o=n;n=0;do{var u=o.nextSibling;if(o.nodeType===1?a?(o._stashedDisplay=o.style.display,o.style.display="none"):(o.style.display=o._stashedDisplay||"",o.getAttribute("style")===""&&o.removeAttribute("style")):o.nodeType===3&&(a?(o._stashedText=o.nodeValue,o.nodeValue=""):o.nodeValue=o._stashedText||""),u&&u.nodeType===8)if(o=u.data,o==="/$"){if(n===0)break;n--}else o!=="$"&&o!=="$?"&&o!=="$~"&&o!=="$!"||n++;o=u}while(o)}function Wh(n){var a=n.firstChild;for(a&&a.nodeType===10&&(a=a.nextSibling);a;){var o=a;switch(a=a.nextSibling,o.nodeName){case"HTML":case"HEAD":case"BODY":Wh(o),tf(o);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(o.rel.toLowerCase()==="stylesheet")continue}n.removeChild(o)}}function $A(n,a,o,u){for(;n.nodeType===1;){var m=o;if(n.nodeName.toLowerCase()!==a.toLowerCase()){if(!u&&(n.nodeName!=="INPUT"||n.type!=="hidden"))break}else if(u){if(!n[xo])switch(a){case"meta":if(!n.hasAttribute("itemprop"))break;return n;case"link":if(y=n.getAttribute("rel"),y==="stylesheet"&&n.hasAttribute("data-precedence"))break;if(y!==m.rel||n.getAttribute("href")!==(m.href==null||m.href===""?null:m.href)||n.getAttribute("crossorigin")!==(m.crossOrigin==null?null:m.crossOrigin)||n.getAttribute("title")!==(m.title==null?null:m.title))break;return n;case"style":if(n.hasAttribute("data-precedence"))break;return n;case"script":if(y=n.getAttribute("src"),(y!==(m.src==null?null:m.src)||n.getAttribute("type")!==(m.type==null?null:m.type)||n.getAttribute("crossorigin")!==(m.crossOrigin==null?null:m.crossOrigin))&&y&&n.hasAttribute("async")&&!n.hasAttribute("itemprop"))break;return n;default:return n}}else if(a==="input"&&n.type==="hidden"){var y=m.name==null?null:""+m.name;if(m.type==="hidden"&&n.getAttribute("name")===y)return n}else return n;if(n=as(n.nextSibling),n===null)break}return null}function VA(n,a,o){if(a==="")return null;for(;n.nodeType!==3;)if((n.nodeType!==1||n.nodeName!=="INPUT"||n.type!=="hidden")&&!o||(n=as(n.nextSibling),n===null))return null;return n}function Zb(n,a){for(;n.nodeType!==8;)if((n.nodeType!==1||n.nodeName!=="INPUT"||n.type!=="hidden")&&!a||(n=as(n.nextSibling),n===null))return null;return n}function Jh(n){return n.data==="$?"||n.data==="$~"}function Qh(n){return n.data==="$!"||n.data==="$?"&&n.ownerDocument.readyState!=="loading"}function BA(n,a){var o=n.ownerDocument;if(n.data==="$~")n._reactRetry=a;else if(n.data!=="$?"||o.readyState!=="loading")a();else{var u=function(){a(),o.removeEventListener("DOMContentLoaded",u)};o.addEventListener("DOMContentLoaded",u),n._reactRetry=u}}function as(n){for(;n!=null;n=n.nextSibling){var a=n.nodeType;if(a===1||a===3)break;if(a===8){if(a=n.data,a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"||a==="F!"||a==="F")break;if(a==="/$"||a==="/&")return null}}return n}var ep=null;function Hb(n){n=n.nextSibling;for(var a=0;n;){if(n.nodeType===8){var o=n.data;if(o==="/$"||o==="/&"){if(a===0)return as(n.nextSibling);a--}else o!=="$"&&o!=="$!"&&o!=="$?"&&o!=="$~"&&o!=="&"||a++}n=n.nextSibling}return null}function Fb(n){n=n.previousSibling;for(var a=0;n;){if(n.nodeType===8){var o=n.data;if(o==="$"||o==="$!"||o==="$?"||o==="$~"||o==="&"){if(a===0)return n;a--}else o!=="/$"&&o!=="/&"||a++}n=n.previousSibling}return null}function qb(n,a,o){switch(a=ru(o),n){case"html":if(n=a.documentElement,!n)throw Error(r(452));return n;case"head":if(n=a.head,!n)throw Error(r(453));return n;case"body":if(n=a.body,!n)throw Error(r(454));return n;default:throw Error(r(451))}}function nl(n){for(var a=n.attributes;a.length;)n.removeAttributeNode(a[0]);tf(n)}var is=new Map,Yb=new Set;function au(n){return typeof n.getRootNode=="function"?n.getRootNode():n.nodeType===9?n:n.ownerDocument}var lr=Z.d;Z.d={f:ZA,r:HA,D:FA,C:qA,L:YA,m:GA,X:KA,S:XA,M:WA};function ZA(){var n=lr.f(),a=Kc();return n||a}function HA(n){var a=Wa(n);a!==null&&a.tag===5&&a.type==="form"?u0(a):lr.r(n)}var Ai=typeof document>"u"?null:document;function Gb(n,a,o){var u=Ai;if(u&&typeof a=="string"&&a){var m=Jn(a);m='link[rel="'+n+'"][href="'+m+'"]',typeof o=="string"&&(m+='[crossorigin="'+o+'"]'),Yb.has(m)||(Yb.add(m),n={rel:n,crossOrigin:o,href:a},u.querySelector(m)===null&&(a=u.createElement("link"),an(a,"link",n),Wt(a),u.head.appendChild(a)))}}function FA(n){lr.D(n),Gb("dns-prefetch",n,null)}function qA(n,a){lr.C(n,a),Gb("preconnect",n,a)}function YA(n,a,o){lr.L(n,a,o);var u=Ai;if(u&&n&&a){var m='link[rel="preload"][as="'+Jn(a)+'"]';a==="image"&&o&&o.imageSrcSet?(m+='[imagesrcset="'+Jn(o.imageSrcSet)+'"]',typeof o.imageSizes=="string"&&(m+='[imagesizes="'+Jn(o.imageSizes)+'"]')):m+='[href="'+Jn(n)+'"]';var y=m;switch(a){case"style":y=_i(n);break;case"script":y=ki(n)}is.has(y)||(n=v({rel:"preload",href:a==="image"&&o&&o.imageSrcSet?void 0:n,as:a},o),is.set(y,n),u.querySelector(m)!==null||a==="style"&&u.querySelector(sl(y))||a==="script"&&u.querySelector(rl(y))||(a=u.createElement("link"),an(a,"link",n),Wt(a),u.head.appendChild(a)))}}function GA(n,a){lr.m(n,a);var o=Ai;if(o&&n){var u=a&&typeof a.as=="string"?a.as:"script",m='link[rel="modulepreload"][as="'+Jn(u)+'"][href="'+Jn(n)+'"]',y=m;switch(u){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":y=ki(n)}if(!is.has(y)&&(n=v({rel:"modulepreload",href:n},a),is.set(y,n),o.querySelector(m)===null)){switch(u){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(o.querySelector(rl(y)))return}u=o.createElement("link"),an(u,"link",n),Wt(u),o.head.appendChild(u)}}}function XA(n,a,o){lr.S(n,a,o);var u=Ai;if(u&&n){var m=Ja(u).hoistableStyles,y=_i(n);a=a||"default";var E=m.get(y);if(!E){var k={loading:0,preload:null};if(E=u.querySelector(sl(y)))k.loading=5;else{n=v({rel:"stylesheet",href:n,"data-precedence":a},o),(o=is.get(y))&&tp(n,o);var P=E=u.createElement("link");Wt(P),an(P,"link",n),P._p=new Promise(function(K,le){P.onload=K,P.onerror=le}),P.addEventListener("load",function(){k.loading|=1}),P.addEventListener("error",function(){k.loading|=2}),k.loading|=4,iu(E,a,u)}E={type:"stylesheet",instance:E,count:1,state:k},m.set(y,E)}}}function KA(n,a){lr.X(n,a);var o=Ai;if(o&&n){var u=Ja(o).hoistableScripts,m=ki(n),y=u.get(m);y||(y=o.querySelector(rl(m)),y||(n=v({src:n,async:!0},a),(a=is.get(m))&&np(n,a),y=o.createElement("script"),Wt(y),an(y,"link",n),o.head.appendChild(y)),y={type:"script",instance:y,count:1,state:null},u.set(m,y))}}function WA(n,a){lr.M(n,a);var o=Ai;if(o&&n){var u=Ja(o).hoistableScripts,m=ki(n),y=u.get(m);y||(y=o.querySelector(rl(m)),y||(n=v({src:n,async:!0,type:"module"},a),(a=is.get(m))&&np(n,a),y=o.createElement("script"),Wt(y),an(y,"link",n),o.head.appendChild(y)),y={type:"script",instance:y,count:1,state:null},u.set(m,y))}}function Xb(n,a,o,u){var m=(m=me.current)?au(m):null;if(!m)throw Error(r(446));switch(n){case"meta":case"title":return null;case"style":return typeof o.precedence=="string"&&typeof o.href=="string"?(a=_i(o.href),o=Ja(m).hoistableStyles,u=o.get(a),u||(u={type:"style",instance:null,count:0,state:null},o.set(a,u)),u):{type:"void",instance:null,count:0,state:null};case"link":if(o.rel==="stylesheet"&&typeof o.href=="string"&&typeof o.precedence=="string"){n=_i(o.href);var y=Ja(m).hoistableStyles,E=y.get(n);if(E||(m=m.ownerDocument||m,E={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},y.set(n,E),(y=m.querySelector(sl(n)))&&!y._p&&(E.instance=y,E.state.loading=5),is.has(n)||(o={rel:"preload",as:"style",href:o.href,crossOrigin:o.crossOrigin,integrity:o.integrity,media:o.media,hrefLang:o.hrefLang,referrerPolicy:o.referrerPolicy},is.set(n,o),y||JA(m,n,o,E.state))),a&&u===null)throw Error(r(528,""));return E}if(a&&u!==null)throw Error(r(529,""));return null;case"script":return a=o.async,o=o.src,typeof o=="string"&&a&&typeof a!="function"&&typeof a!="symbol"?(a=ki(o),o=Ja(m).hoistableScripts,u=o.get(a),u||(u={type:"script",instance:null,count:0,state:null},o.set(a,u)),u):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,n))}}function _i(n){return'href="'+Jn(n)+'"'}function sl(n){return'link[rel="stylesheet"]['+n+"]"}function Kb(n){return v({},n,{"data-precedence":n.precedence,precedence:null})}function JA(n,a,o,u){n.querySelector('link[rel="preload"][as="style"]['+a+"]")?u.loading=1:(a=n.createElement("link"),u.preload=a,a.addEventListener("load",function(){return u.loading|=1}),a.addEventListener("error",function(){return u.loading|=2}),an(a,"link",o),Wt(a),n.head.appendChild(a))}function ki(n){return'[src="'+Jn(n)+'"]'}function rl(n){return"script[async]"+n}function Wb(n,a,o){if(a.count++,a.instance===null)switch(a.type){case"style":var u=n.querySelector('style[data-href~="'+Jn(o.href)+'"]');if(u)return a.instance=u,Wt(u),u;var m=v({},o,{"data-href":o.href,"data-precedence":o.precedence,href:null,precedence:null});return u=(n.ownerDocument||n).createElement("style"),Wt(u),an(u,"style",m),iu(u,o.precedence,n),a.instance=u;case"stylesheet":m=_i(o.href);var y=n.querySelector(sl(m));if(y)return a.state.loading|=4,a.instance=y,Wt(y),y;u=Kb(o),(m=is.get(m))&&tp(u,m),y=(n.ownerDocument||n).createElement("link"),Wt(y);var E=y;return E._p=new Promise(function(k,P){E.onload=k,E.onerror=P}),an(y,"link",u),a.state.loading|=4,iu(y,o.precedence,n),a.instance=y;case"script":return y=ki(o.src),(m=n.querySelector(rl(y)))?(a.instance=m,Wt(m),m):(u=o,(m=is.get(y))&&(u=v({},o),np(u,m)),n=n.ownerDocument||n,m=n.createElement("script"),Wt(m),an(m,"link",u),n.head.appendChild(m),a.instance=m);case"void":return null;default:throw Error(r(443,a.type))}else a.type==="stylesheet"&&(a.state.loading&4)===0&&(u=a.instance,a.state.loading|=4,iu(u,o.precedence,n));return a.instance}function iu(n,a,o){for(var u=o.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),m=u.length?u[u.length-1]:null,y=m,E=0;E<u.length;E++){var k=u[E];if(k.dataset.precedence===a)y=k;else if(y!==m)break}y?y.parentNode.insertBefore(n,y.nextSibling):(a=o.nodeType===9?o.head:o,a.insertBefore(n,a.firstChild))}function tp(n,a){n.crossOrigin==null&&(n.crossOrigin=a.crossOrigin),n.referrerPolicy==null&&(n.referrerPolicy=a.referrerPolicy),n.title==null&&(n.title=a.title)}function np(n,a){n.crossOrigin==null&&(n.crossOrigin=a.crossOrigin),n.referrerPolicy==null&&(n.referrerPolicy=a.referrerPolicy),n.integrity==null&&(n.integrity=a.integrity)}var ou=null;function Jb(n,a,o){if(ou===null){var u=new Map,m=ou=new Map;m.set(o,u)}else m=ou,u=m.get(o),u||(u=new Map,m.set(o,u));if(u.has(n))return u;for(u.set(n,null),o=o.getElementsByTagName(n),m=0;m<o.length;m++){var y=o[m];if(!(y[xo]||y[tn]||n==="link"&&y.getAttribute("rel")==="stylesheet")&&y.namespaceURI!=="http://www.w3.org/2000/svg"){var E=y.getAttribute(a)||"";E=n+E;var k=u.get(E);k?k.push(y):u.set(E,[y])}}return u}function Qb(n,a,o){n=n.ownerDocument||n,n.head.insertBefore(o,a==="title"?n.querySelector("head > title"):null)}function QA(n,a,o){if(o===1||a.itemProp!=null)return!1;switch(n){case"meta":case"title":return!0;case"style":if(typeof a.precedence!="string"||typeof a.href!="string"||a.href==="")break;return!0;case"link":if(typeof a.rel!="string"||typeof a.href!="string"||a.href===""||a.onLoad||a.onError)break;return a.rel==="stylesheet"?(n=a.disabled,typeof a.precedence=="string"&&n==null):!0;case"script":if(a.async&&typeof a.async!="function"&&typeof a.async!="symbol"&&!a.onLoad&&!a.onError&&a.src&&typeof a.src=="string")return!0}return!1}function ex(n){return!(n.type==="stylesheet"&&(n.state.loading&3)===0)}function e2(n,a,o,u){if(o.type==="stylesheet"&&(typeof u.media!="string"||matchMedia(u.media).matches!==!1)&&(o.state.loading&4)===0){if(o.instance===null){var m=_i(u.href),y=a.querySelector(sl(m));if(y){a=y._p,a!==null&&typeof a=="object"&&typeof a.then=="function"&&(n.count++,n=lu.bind(n),a.then(n,n)),o.state.loading|=4,o.instance=y,Wt(y);return}y=a.ownerDocument||a,u=Kb(u),(m=is.get(m))&&tp(u,m),y=y.createElement("link"),Wt(y);var E=y;E._p=new Promise(function(k,P){E.onload=k,E.onerror=P}),an(y,"link",u),o.instance=y}n.stylesheets===null&&(n.stylesheets=new Map),n.stylesheets.set(o,a),(a=o.state.preload)&&(o.state.loading&3)===0&&(n.count++,o=lu.bind(n),a.addEventListener("load",o),a.addEventListener("error",o))}}var sp=0;function t2(n,a){return n.stylesheets&&n.count===0&&uu(n,n.stylesheets),0<n.count||0<n.imgCount?function(o){var u=setTimeout(function(){if(n.stylesheets&&uu(n,n.stylesheets),n.unsuspend){var y=n.unsuspend;n.unsuspend=null,y()}},6e4+a);0<n.imgBytes&&sp===0&&(sp=62500*zA());var m=setTimeout(function(){if(n.waitingForImages=!1,n.count===0&&(n.stylesheets&&uu(n,n.stylesheets),n.unsuspend)){var y=n.unsuspend;n.unsuspend=null,y()}},(n.imgBytes>sp?50:800)+a);return n.unsuspend=o,function(){n.unsuspend=null,clearTimeout(u),clearTimeout(m)}}:null}function lu(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)uu(this,this.stylesheets);else if(this.unsuspend){var n=this.unsuspend;this.unsuspend=null,n()}}}var cu=null;function uu(n,a){n.stylesheets=null,n.unsuspend!==null&&(n.count++,cu=new Map,a.forEach(n2,n),cu=null,lu.call(n))}function n2(n,a){if(!(a.state.loading&4)){var o=cu.get(n);if(o)var u=o.get(null);else{o=new Map,cu.set(n,o);for(var m=n.querySelectorAll("link[data-precedence],style[data-precedence]"),y=0;y<m.length;y++){var E=m[y];(E.nodeName==="LINK"||E.getAttribute("media")!=="not all")&&(o.set(E.dataset.precedence,E),u=E)}u&&o.set(null,u)}m=a.instance,E=m.getAttribute("data-precedence"),y=o.get(E)||u,y===u&&o.set(null,m),o.set(E,m),this.count++,u=lu.bind(this),m.addEventListener("load",u),m.addEventListener("error",u),y?y.parentNode.insertBefore(m,y.nextSibling):(n=n.nodeType===9?n.head:n,n.insertBefore(m,n.firstChild)),a.state.loading|=4}}var al={$$typeof:S,Provider:null,Consumer:null,_currentValue:B,_currentValue2:B,_threadCount:0};function s2(n,a,o,u,m,y,E,k,P){this.tag=1,this.containerInfo=n,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=go(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=go(0),this.hiddenUpdates=go(null),this.identifierPrefix=u,this.onUncaughtError=m,this.onCaughtError=y,this.onRecoverableError=E,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=P,this.incompleteTransitions=new Map}function tx(n,a,o,u,m,y,E,k,P,K,le,de){return n=new s2(n,a,o,E,P,K,le,de,k),a=1,y===!0&&(a|=24),y=Un(3,null,null,a),n.current=y,y.stateNode=n,a=If(),a.refCount++,n.pooledCache=a,a.refCount++,y.memoizedState={element:u,isDehydrated:o,cache:a},$f(y),n}function nx(n){return n?(n=li,n):li}function sx(n,a,o,u,m,y){m=nx(m),u.context===null?u.context=m:u.pendingContext=m,u=Er(a),u.payload={element:o},y=y===void 0?null:y,y!==null&&(u.callback=y),o=Nr(n,u,a),o!==null&&(Mn(o,n,a),Lo(o,n,a))}function rx(n,a){if(n=n.memoizedState,n!==null&&n.dehydrated!==null){var o=n.retryLane;n.retryLane=o!==0&&o<a?o:a}}function rp(n,a){rx(n,a),(n=n.alternate)&&rx(n,a)}function ax(n){if(n.tag===13||n.tag===31){var a=ma(n,67108864);a!==null&&Mn(a,n,67108864),rp(n,67108864)}}function ix(n){if(n.tag===13||n.tag===31){var a=Hn();a=Hs(a);var o=ma(n,a);o!==null&&Mn(o,n,a),rp(n,a)}}var du=!0;function r2(n,a,o,u){var m=z.T;z.T=null;var y=Z.p;try{Z.p=2,ap(n,a,o,u)}finally{Z.p=y,z.T=m}}function a2(n,a,o,u){var m=z.T;z.T=null;var y=Z.p;try{Z.p=8,ap(n,a,o,u)}finally{Z.p=y,z.T=m}}function ap(n,a,o,u){if(du){var m=ip(u);if(m===null)Fh(n,a,u,fu,o),lx(n,u);else if(o2(m,n,a,o,u))u.stopPropagation();else if(lx(n,u),a&4&&-1<i2.indexOf(n)){for(;m!==null;){var y=Wa(m);if(y!==null)switch(y.tag){case 3:if(y=y.stateNode,y.current.memoizedState.isDehydrated){var E=gn(y.pendingLanes);if(E!==0){var k=y;for(k.pendingLanes|=2,k.entangledLanes|=2;E;){var P=1<<31-nt(E);k.entanglements[1]|=P,E&=~P}As(y),(at&6)===0&&(Gc=Se()+500,Qo(0))}}break;case 31:case 13:k=ma(y,2),k!==null&&Mn(k,y,2),Kc(),rp(y,2)}if(y=ip(u),y===null&&Fh(n,a,u,fu,o),y===m)break;m=y}m!==null&&u.stopPropagation()}else Fh(n,a,u,null,o)}}function ip(n){return n=lf(n),op(n)}var fu=null;function op(n){if(fu=null,n=Ka(n),n!==null){var a=l(n);if(a===null)n=null;else{var o=a.tag;if(o===13){if(n=c(a),n!==null)return n;n=null}else if(o===31){if(n=f(a),n!==null)return n;n=null}else if(o===3){if(a.stateNode.current.memoizedState.isDehydrated)return a.tag===3?a.stateNode.containerInfo:null;n=null}else a!==n&&(n=null)}}return fu=n,null}function ox(n){switch(n){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(Ee()){case We:return 2;case ot:return 8;case Fe:case qt:return 32;case Kt:return 268435456;default:return 32}default:return 32}}var lp=!1,zr=null,Ir=null,Lr=null,il=new Map,ol=new Map,Pr=[],i2="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 lx(n,a){switch(n){case"focusin":case"focusout":zr=null;break;case"dragenter":case"dragleave":Ir=null;break;case"mouseover":case"mouseout":Lr=null;break;case"pointerover":case"pointerout":il.delete(a.pointerId);break;case"gotpointercapture":case"lostpointercapture":ol.delete(a.pointerId)}}function ll(n,a,o,u,m,y){return n===null||n.nativeEvent!==y?(n={blockedOn:a,domEventName:o,eventSystemFlags:u,nativeEvent:y,targetContainers:[m]},a!==null&&(a=Wa(a),a!==null&&ax(a)),n):(n.eventSystemFlags|=u,a=n.targetContainers,m!==null&&a.indexOf(m)===-1&&a.push(m),n)}function o2(n,a,o,u,m){switch(a){case"focusin":return zr=ll(zr,n,a,o,u,m),!0;case"dragenter":return Ir=ll(Ir,n,a,o,u,m),!0;case"mouseover":return Lr=ll(Lr,n,a,o,u,m),!0;case"pointerover":var y=m.pointerId;return il.set(y,ll(il.get(y)||null,n,a,o,u,m)),!0;case"gotpointercapture":return y=m.pointerId,ol.set(y,ll(ol.get(y)||null,n,a,o,u,m)),!0}return!1}function cx(n){var a=Ka(n.target);if(a!==null){var o=l(a);if(o!==null){if(a=o.tag,a===13){if(a=c(o),a!==null){n.blockedOn=a,ac(n.priority,function(){ix(o)});return}}else if(a===31){if(a=f(o),a!==null){n.blockedOn=a,ac(n.priority,function(){ix(o)});return}}else if(a===3&&o.stateNode.current.memoizedState.isDehydrated){n.blockedOn=o.tag===3?o.stateNode.containerInfo:null;return}}}n.blockedOn=null}function hu(n){if(n.blockedOn!==null)return!1;for(var a=n.targetContainers;0<a.length;){var o=ip(n.nativeEvent);if(o===null){o=n.nativeEvent;var u=new o.constructor(o.type,o);of=u,o.target.dispatchEvent(u),of=null}else return a=Wa(o),a!==null&&ax(a),n.blockedOn=o,!1;a.shift()}return!0}function ux(n,a,o){hu(n)&&o.delete(a)}function l2(){lp=!1,zr!==null&&hu(zr)&&(zr=null),Ir!==null&&hu(Ir)&&(Ir=null),Lr!==null&&hu(Lr)&&(Lr=null),il.forEach(ux),ol.forEach(ux)}function pu(n,a){n.blockedOn===a&&(n.blockedOn=null,lp||(lp=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,l2)))}var mu=null;function dx(n){mu!==n&&(mu=n,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){mu===n&&(mu=null);for(var a=0;a<n.length;a+=3){var o=n[a],u=n[a+1],m=n[a+2];if(typeof u!="function"){if(op(u||o)===null)continue;break}var y=Wa(o);y!==null&&(n.splice(a,3),a-=3,ih(y,{pending:!0,data:m,method:o.method,action:u},u,m))}}))}function Mi(n){function a(P){return pu(P,n)}zr!==null&&pu(zr,n),Ir!==null&&pu(Ir,n),Lr!==null&&pu(Lr,n),il.forEach(a),ol.forEach(a);for(var o=0;o<Pr.length;o++){var u=Pr[o];u.blockedOn===n&&(u.blockedOn=null)}for(;0<Pr.length&&(o=Pr[0],o.blockedOn===null);)cx(o),o.blockedOn===null&&Pr.shift();if(o=(n.ownerDocument||n).$$reactFormReplay,o!=null)for(u=0;u<o.length;u+=3){var m=o[u],y=o[u+1],E=m[jn]||null;if(typeof y=="function")E||dx(o);else if(E){var k=null;if(y&&y.hasAttribute("formAction")){if(m=y,E=y[jn]||null)k=E.formAction;else if(op(m)!==null)continue}else k=E.action;typeof k=="function"?o[u+1]=k:(o.splice(u,3),u-=3),dx(o)}}}function fx(){function n(y){y.canIntercept&&y.info==="react-transition"&&y.intercept({handler:function(){return new Promise(function(E){return m=E})},focusReset:"manual",scroll:"manual"})}function a(){m!==null&&(m(),m=null),u||setTimeout(o,20)}function o(){if(!u&&!navigation.transition){var y=navigation.currentEntry;y&&y.url!=null&&navigation.navigate(y.url,{state:y.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var u=!1,m=null;return navigation.addEventListener("navigate",n),navigation.addEventListener("navigatesuccess",a),navigation.addEventListener("navigateerror",a),setTimeout(o,100),function(){u=!0,navigation.removeEventListener("navigate",n),navigation.removeEventListener("navigatesuccess",a),navigation.removeEventListener("navigateerror",a),m!==null&&(m(),m=null)}}}function cp(n){this._internalRoot=n}gu.prototype.render=cp.prototype.render=function(n){var a=this._internalRoot;if(a===null)throw Error(r(409));var o=a.current,u=Hn();sx(o,u,n,a,null,null)},gu.prototype.unmount=cp.prototype.unmount=function(){var n=this._internalRoot;if(n!==null){this._internalRoot=null;var a=n.containerInfo;sx(n.current,2,null,n,null,null),Kc(),a[Xa]=null}};function gu(n){this._internalRoot=n}gu.prototype.unstable_scheduleHydration=function(n){if(n){var a=rc();n={blockedOn:null,target:n,priority:a};for(var o=0;o<Pr.length&&a!==0&&a<Pr[o].priority;o++);Pr.splice(o,0,n),o===0&&cx(n)}};var hx=t.version;if(hx!=="19.2.3")throw Error(r(527,hx,"19.2.3"));Z.findDOMNode=function(n){var a=n._reactInternals;if(a===void 0)throw typeof n.render=="function"?Error(r(188)):(n=Object.keys(n).join(","),Error(r(268,n)));return n=h(a),n=n!==null?g(n):null,n=n===null?null:n.stateNode,n};var c2={bundleType:0,version:"19.2.3",rendererPackageName:"react-dom",currentDispatcherRef:z,reconcilerVersion:"19.2.3"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var yu=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!yu.isDisabled&&yu.supportsFiber)try{Qt=yu.inject(c2),De=yu}catch{}}return ul.createRoot=function(n,a){if(!i(n))throw Error(r(299));var o=!1,u="",m=x0,y=w0,E=S0;return a!=null&&(a.unstable_strictMode===!0&&(o=!0),a.identifierPrefix!==void 0&&(u=a.identifierPrefix),a.onUncaughtError!==void 0&&(m=a.onUncaughtError),a.onCaughtError!==void 0&&(y=a.onCaughtError),a.onRecoverableError!==void 0&&(E=a.onRecoverableError)),a=tx(n,1,!1,null,null,o,u,null,m,y,E,fx),n[Xa]=a.current,Hh(n),new cp(a)},ul.hydrateRoot=function(n,a,o){if(!i(n))throw Error(r(299));var u=!1,m="",y=x0,E=w0,k=S0,P=null;return o!=null&&(o.unstable_strictMode===!0&&(u=!0),o.identifierPrefix!==void 0&&(m=o.identifierPrefix),o.onUncaughtError!==void 0&&(y=o.onUncaughtError),o.onCaughtError!==void 0&&(E=o.onCaughtError),o.onRecoverableError!==void 0&&(k=o.onRecoverableError),o.formState!==void 0&&(P=o.formState)),a=tx(n,1,!0,a,o??null,u,m,P,y,E,k,fx),a.context=nx(null),o=a.current,u=Hn(),u=Hs(u),m=Er(u),m.callback=null,Nr(o,m,u),o=u,a.current.lanes=o,ua(a,o),As(a),n[Xa]=a.current,Hh(n),new gu(a)},ul.version="19.2.3",ul}var Ex;function b2(){if(Ex)return fp.exports;Ex=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),fp.exports=v2(),fp.exports}var x2=b2();const w2=({panOffset:e,scale:t,onPan:s,onPanStart:r,onPanEnd:i,isPanLocked:l=!1,onClick:c,showGuides:f=!1,onGuidesChange:p,gridOpacity:h=1})=>{const[g,v]=b.useState(f),[x,w]=b.useState(!1),T=b.useRef(!1),N=b.useRef({x:0,y:0}),A=b.useRef({active:!1,startX:0,startY:0}),C=b.useRef(null),j=b.useRef(null),S=b.useRef(null),_=4,R=b.useRef({x:0,y:0}),M=b.useRef(0),O=b.useRef(!1);b.useEffect(()=>{v(f)},[f]);const I=b.useCallback(J=>{const D=J;return D?D.tagName==="INPUT"||D.tagName==="TEXTAREA"||D.isContentEditable:!1},[]),H=b.useCallback(J=>{const D=J;return D?!!D.closest('button, [role="button"], a, input, textarea, select, [data-interactive="true"]'):!1},[]),F=b.useCallback(J=>{T.current=J,w(J)},[]);b.useEffect(()=>{const J=se=>{if(M.current=se.buttons,A.current.active&&(se.buttons&1)!==1&&(A.current.active=!1),T.current&&(se.buttons&1)!==1){F(!1),A.current.active=!1,i?.(),document.body.style.cursor="";return}if(l&&T.current){F(!1),A.current.active=!1,i?.(),document.body.style.cursor="";return}const te=C.current?.getBoundingClientRect(),me=te?se.clientX-te.left:se.clientX,he=te?se.clientY-te.top:se.clientY;if(R.current={x:me,y:he},j.current&&(j.current.style.left=`${me}px`),S.current&&(S.current.style.top=`${he}px`),A.current.active&&!T.current){const pe=se.clientX-A.current.startX,xe=se.clientY-A.current.startY;Math.hypot(pe,xe)>=_&&(A.current.active=!1,F(!0),O.current=!0,r?.(),N.current={x:se.clientX,y:se.clientY},document.body.style.cursor="grabbing")}T.current&&(s({x:(se.clientX-N.current.x)/t,y:(se.clientY-N.current.y)/t}),N.current={x:se.clientX,y:se.clientY})},D=se=>{M.current=se.buttons,A.current.active=!1,T.current&&(F(!1),i?.(),document.body.style.cursor="")},U=se=>{(se.metaKey||se.ctrlKey)&&se.key==="\\"&&(se.preventDefault(),v(te=>{const me=!te;return p?.(me),me}))},W=()=>{A.current.active=!1,D(new MouseEvent("mouseup"))};return window.addEventListener("mousemove",J),window.addEventListener("mouseup",D),window.addEventListener("keydown",U),window.addEventListener("blur",W),document.addEventListener("visibilitychange",W),()=>{window.removeEventListener("mousemove",J),window.removeEventListener("mouseup",D),window.removeEventListener("keydown",U),window.removeEventListener("blur",W),document.removeEventListener("visibilitychange",W)}},[s,i,r,t,I,H,l,F,p]),b.useEffect(()=>{!l||!T.current||(F(!1),i?.(),document.body.style.cursor="")},[l,i,F]);const $=J=>{O.current=!1,!(l||J.button!==0)&&(I(J.target)||H(J.target)||(M.current=J.buttons,A.current={active:!0,startX:J.clientX,startY:J.clientY},J.preventDefault()))},L=J=>{!O.current&&c&&c(J),O.current=!1},[Y,ie]=b.useState({w:0,h:0});b.useEffect(()=>{const J=()=>ie({w:window.innerWidth,h:window.innerHeight});return J(),window.addEventListener("resize",J),()=>window.removeEventListener("resize",J)},[]);const ee=Math.max(.4,Math.min(2,t)),z=100*ee,Z=20*ee,B=(Y.w/2+e.x*t)%z,re=(Y.h/2+e.y*t)%z;return d.jsxs("div",{ref:C,className:`absolute inset-0 z-0 overflow-hidden bg-black ${x?"cursor-grabbing":"cursor-grab"}`,onMouseDown:$,onClick:L,children:[d.jsx("div",{className:"absolute pointer-events-none",style:{inset:"-100px",opacity:.5*h,transition:"opacity 1s ease",backgroundImage:"radial-gradient(circle, #444 1px, transparent 1px)",backgroundSize:`${Z}px ${Z}px`,backgroundPosition:`${B+100}px ${re+100}px`}}),d.jsx("div",{className:"absolute pointer-events-none",style:{inset:"-100px",opacity:.25*h,transition:"opacity 1s ease",backgroundImage:"radial-gradient(circle, #555 1.5px, transparent 1.5px)",backgroundSize:`${z}px ${z}px`,backgroundPosition:`${B+100}px ${re+100}px`}}),g&&d.jsxs(d.Fragment,{children:[d.jsx("div",{ref:j,className:"absolute top-0 bottom-0 w-px pointer-events-none bg-emerald-500/10",style:{left:0}}),d.jsx("div",{ref:S,className:"absolute left-0 right-0 h-px pointer-events-none bg-emerald-500/10",style:{top:0}})]})]})};const XS=(...e)=>e.filter((t,s,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===s).join(" ").trim();const S2=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();const E2=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,s,r)=>r?r.toUpperCase():s.toLowerCase());const Nx=e=>{const t=E2(e);return t.charAt(0).toUpperCase()+t.slice(1)};var N2={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const T2=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1};const j2=b.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:s=2,absoluteStrokeWidth:r,className:i="",children:l,iconNode:c,...f},p)=>b.createElement("svg",{ref:p,...N2,width:t,height:t,stroke:e,strokeWidth:r?Number(s)*24/Number(t):s,className:XS("lucide",i),...!l&&!T2(f)&&{"aria-hidden":"true"},...f},[...c.map(([h,g])=>b.createElement(h,g)),...Array.isArray(l)?l:[l]]));const Tt=(e,t)=>{const s=b.forwardRef(({className:r,...i},l)=>b.createElement(j2,{ref:l,iconNode:t,className:XS(`lucide-${S2(Nx(e))}`,`lucide-${e}`,r),...i}));return s.displayName=Nx(e),s};const C2=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],R2=Tt("chevron-down",C2);const A2=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],_2=Tt("chevron-right",A2);const k2=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],M2=Tt("circle-alert",k2);const O2=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6l4 2",key:"mmk7yg"}]],D2=Tt("clock",O2);const z2=[["path",{d:"M20 4v7a4 4 0 0 1-4 4H4",key:"6o5b7l"}],["path",{d:"m9 10-5 5 5 5",key:"1kshq7"}]],I2=Tt("corner-down-left",z2);const L2=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Tx=Tt("loader-circle",L2);const P2=[["path",{d:"M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z",key:"169xi5"}],["path",{d:"M15 5.764v15",key:"1pn4in"}],["path",{d:"M9 3.236v15",key:"1uimfh"}]],U2=Tt("map",P2);const $2=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]],KS=Tt("maximize-2",$2);const V2=[["path",{d:"M12 19v3",key:"npa21l"}],["path",{d:"M19 10v2a7 7 0 0 1-14 0v-2",key:"1vc78b"}],["rect",{x:"9",y:"2",width:"6",height:"13",rx:"3",key:"s6n7sd"}]],B2=Tt("mic",V2);const Z2=[["path",{d:"m14 10 7-7",key:"oa77jy"}],["path",{d:"M20 10h-6V4",key:"mjg0md"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M4 14h6v6",key:"rmj7iw"}]],H2=Tt("minimize-2",Z2);const F2=[["path",{d:"M5 12h14",key:"1ays0h"}]],q2=Tt("minus",F2);const Y2=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m16 15-3-3 3-3",key:"14y99z"}]],G2=Tt("panel-left-close",Y2);const X2=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m14 9 3 3-3 3",key:"8010ee"}]],K2=Tt("panel-left-open",X2);const W2=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m8 9 3 3-3 3",key:"12hl5m"}]],J2=Tt("panel-right-close",W2);const Q2=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m10 15-3-3 3-3",key:"1pgupc"}]],e_=Tt("panel-right-open",Q2);const t_=[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]],n_=Tt("paperclip",t_);const s_=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],r_=Tt("plus",s_);const a_=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],fg=Tt("search",a_);const i_=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],WS=Tt("sparkles",i_);const o_=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],JS=Tt("square",o_);const l_=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],QS=Tt("terminal",l_);const c_=[["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"}]],u_=Tt("trash-2",c_);const d_=[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728",key:"ijwkga"}]],f_=Tt("volume-2",d_);const h_=[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["line",{x1:"22",x2:"16",y1:"9",y2:"15",key:"1ewh16"}],["line",{x1:"16",x2:"22",y1:"9",y2:"15",key:"5ykzw1"}]],p_=Tt("volume-x",h_);const m_=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],eE=Tt("x",m_),g_=({scale:e,onZoom:t,min:s=.2,max:r=3,step:i=.1})=>{const[l,c]=b.useState(!1),[f,p]=b.useState(""),h=b.useRef(null),g=b.useCallback(A=>Math.min(r,Math.max(s,A)),[s,r]),v=b.useCallback(()=>{t(g(e+i))},[e,i,t,g]),x=b.useCallback(()=>{t(g(e-i))},[e,i,t,g]),w=b.useCallback(()=>{p(Math.round(e*100).toString()),c(!0)},[e]),T=b.useCallback(()=>{c(!1);const A=parseInt(f,10);!isNaN(A)&&A>0&&t(g(A/100))},[f,t,g]),N=b.useCallback(A=>{A.key==="Enter"?T():A.key==="Escape"&&c(!1)},[T]);return b.useEffect(()=>{l&&h.current&&(h.current.focus(),h.current.select())},[l]),d.jsxs("div",{className:"pointer-events-auto flex flex-col items-center bg-neutral-950/95 backdrop-blur-xl border border-neutral-700/80 rounded-md shadow-[0_0_20px_rgba(0,0,0,0.6)] overflow-hidden",children:[d.jsx("button",{onClick:v,className:"w-9 h-8 flex items-center justify-center hover:bg-white/10 text-neutral-300 hover:text-white transition-colors",title:"Zoom in",children:d.jsx(r_,{size:14})}),d.jsx("div",{className:"w-full border-t border-b border-neutral-700/50",children:l?d.jsx("input",{ref:h,type:"text",value:f,onChange:A=>p(A.target.value.replace(/[^0-9]/g,"")),onBlur:T,onKeyDown:N,className:"w-9 py-1.5 text-center text-[11px] font-mono text-white bg-black/60 outline-none tabular-nums"}):d.jsxs("button",{onClick:w,className:"w-9 py-1.5 text-center text-[11px] font-mono text-neutral-200 hover:text-white hover:bg-white/10 transition-colors cursor-text tabular-nums",title:"Click to set zoom",children:[Math.round(e*100),"%"]})}),d.jsx("button",{onClick:x,className:"w-9 h-8 flex items-center justify-center hover:bg-white/10 text-neutral-300 hover:text-white transition-colors",title:"Zoom out",children:d.jsx(q2,{size:14})})]})},y_={...YS};let jx=0;function v_(e,t="mui"){const[s,r]=b.useState(e),i=e||s;return b.useEffect(()=>{s==null&&(jx+=1,r(`${t}-${jx}`))},[s,t]),i}const Cx=y_.useId;function ta(e,t){if(Cx!==void 0){const s=Cx();return e??(t?`${t}-${s}`:s)}return v_(e,t)}function qa(e,...t){const s=new URL(`https://base-ui.com/production-error/${e}`);return t.forEach(r=>s.searchParams.append("args[]",r)),`Base UI error #${e}; visit ${s} for the full message.`}const tE=b.createContext(void 0);function Od(e=!0){const t=b.useContext(tE);if(t===void 0&&!e)throw new Error(qa(25));return t}const nE=b.createContext(void 0);function sE(e){const t=b.useContext(nE);if(t===void 0&&!e)throw new Error(qa(33));return t}const hg=b.createContext(void 0);function io(e){const t=b.useContext(hg);if(t===void 0&&!e)throw new Error(qa(36));return t}const Rx={};function ds(e,t){const s=b.useRef(Rx);return s.current===Rx&&(s.current=e(t)),s}function kl(e,t,s,r){const i=ds(rE).current;return x_(i,e,t,s,r)&&aE(i,[e,t,s,r]),i.callback}function b_(e){const t=ds(rE).current;return w_(t,e)&&aE(t,e),t.callback}function rE(){return{callback:null,cleanup:null,refs:[]}}function x_(e,t,s,r,i){return e.refs[0]!==t||e.refs[1]!==s||e.refs[2]!==r||e.refs[3]!==i}function w_(e,t){return e.refs.length!==t.length||e.refs.some((s,r)=>s!==t[r])}function aE(e,t){if(e.refs=t,t.every(s=>s==null)){e.callback=null;return}e.callback=s=>{if(e.cleanup&&(e.cleanup(),e.cleanup=null),s!=null){const r=Array(t.length).fill(null);for(let i=0;i<t.length;i+=1){const l=t[i];if(l!=null)switch(typeof l){case"function":{const c=l(s);typeof c=="function"&&(r[i]=c);break}case"object":{l.current=s;break}}}e.cleanup=()=>{for(let i=0;i<t.length;i+=1){const l=t[i];if(l!=null)switch(typeof l){case"function":{const c=r[i];typeof c=="function"?c():l(null);break}case"object":{l.current=null;break}}}}}}}const S_=parseInt(b.version,10);function pg(e){return S_>=e}function Ax(e){if(!b.isValidElement(e))return null;const t=e,s=t.props;return(pg(19)?s?.ref:t.ref)??null}function cm(e,t){if(e&&!t)return e;if(!e&&t)return t;if(e||t)return{...e,...t}}function E_(e,t){const s={};for(const r in e){const i=e[r];if(t?.hasOwnProperty(r)){const l=t[r](i);l!=null&&Object.assign(s,l);continue}i===!0?s[`data-${r.toLowerCase()}`]="":i&&(s[`data-${r.toLowerCase()}`]=i.toString())}return s}function N_(e,t){return typeof e=="function"?e(t):e}function T_(e,t){return typeof e=="function"?e(t):e}const wl={};function Dd(e,t,s,r,i){let l={...um(e,wl)};return t&&(l=Zu(l,t)),s&&(l=Zu(l,s)),r&&(l=Zu(l,r)),l}function j_(e){if(e.length===0)return wl;if(e.length===1)return um(e[0],wl);let t={...um(e[0],wl)};for(let s=1;s<e.length;s+=1)t=Zu(t,e[s]);return t}function Zu(e,t){return iE(t)?t(e):C_(e,t)}function C_(e,t){if(!t)return e;for(const s in t){const r=t[s];switch(s){case"style":{e[s]=cm(e.style,r);break}case"className":{e[s]=oE(e.className,r);break}default:R_(s,r)?e[s]=A_(e[s],r):e[s]=r}}return e}function R_(e,t){const s=e.charCodeAt(0),r=e.charCodeAt(1),i=e.charCodeAt(2);return s===111&&r===110&&i>=65&&i<=90&&(typeof t=="function"||typeof t>"u")}function iE(e){return typeof e=="function"}function um(e,t){return iE(e)?e(t):e??wl}function A_(e,t){return t?e?s=>{if(__(s)){const i=s;dm(i);const l=t(i);return i.baseUIHandlerPrevented||e?.(i),l}const r=t(s);return e?.(s),r}:t:e}function dm(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}function oE(e,t){return t?e?t+" "+e:t:e}function __(e){return e!=null&&typeof e=="object"&&"nativeEvent"in e}function lE(){}const cE=Object.freeze([]),zn=Object.freeze({}),k_=500,M_={style:{transition:"none"}},O_="data-base-ui-click-trigger",D_={fallbackAxisSide:"none"},z_={clipPath:"inset(50%)",position:"fixed",top:0,left:0};function na(e,t,s={}){const r=t.render,i=I_(t,s);if(s.enabled===!1)return null;const l=s.state??zn;return L_(e,r,i,l)}function I_(e,t={}){const{className:s,style:r,render:i}=e,{state:l=zn,ref:c,props:f,stateAttributesMapping:p,enabled:h=!0}=t,g=h?N_(s,l):void 0,v=h?T_(r,l):void 0,x=h?E_(l,p):zn,w=h?cm(x,Array.isArray(f)?j_(f):f)??zn:zn;return typeof document<"u"&&(h?Array.isArray(c)?w.ref=b_([w.ref,Ax(i),...c]):w.ref=kl(w.ref,Ax(i),c):kl(null,null)),h?(g!==void 0&&(w.className=oE(w.className,g)),v!==void 0&&(w.style=cm(w.style,v)),w):zn}function L_(e,t,s,r){if(t){if(typeof t=="function")return t(s,r);const i=Dd(s,t.props);return i.ref=s.ref,b.cloneElement(t,i)}return P_(e,s)}function P_(e,t){return b.createElement(e,t)}let rd=(function(e){return e.startingStyle="data-starting-style",e.endingStyle="data-ending-style",e})({});const U_={[rd.startingStyle]:""},$_={[rd.endingStyle]:""},V_={transitionStatus(e){return e==="starting"?U_:e==="ending"?$_:null}};let mg=(function(e){return e.open="data-open",e.closed="data-closed",e[e.startingStyle=rd.startingStyle]="startingStyle",e[e.endingStyle=rd.endingStyle]="endingStyle",e.anchorHidden="data-anchor-hidden",e})({}),_x=(function(e){return e.popupOpen="data-popup-open",e.pressed="data-pressed",e})({});const B_={[_x.popupOpen]:"",[_x.pressed]:""},Z_={[mg.open]:""},H_={[mg.closed]:""},F_={[mg.anchorHidden]:""},q_={open(e){return e?B_:null}},uE={open(e){return e?Z_:H_},anchorHidden(e){return e?F_:null}},Y_="none",ad="trigger-press",La="trigger-hover",kx="trigger-focus",gg="outside-press",dE="item-press",zd="focus-out",fE="escape-key",Hu="list-navigation",G_="cancel-open",ml="sibling-open",X_="imperative-action",gp=YS[`useInsertionEffect${Math.random().toFixed(1)}`.slice(0,-3)],K_=gp&&gp!==b.useLayoutEffect?gp:e=>e();function Ue(e){const t=ds(W_).current;return t.next=e,K_(t.effect),t.trampoline}function W_(){const e={next:void 0,callback:J_,trampoline:(...t)=>e.callback?.(...t),effect:()=>{e.callback=e.next}};return e}function J_(){}function Id(){return typeof window<"u"}function sa(e){return yg(e)?(e.nodeName||"").toLowerCase():"#document"}function un(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Zs(e){var t;return(t=(yg(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function yg(e){return Id()?e instanceof Node||e instanceof un(e).Node:!1}function Nt(e){return Id()?e instanceof Element||e instanceof un(e).Element:!1}function Pt(e){return Id()?e instanceof HTMLElement||e instanceof un(e).HTMLElement:!1}function fm(e){return!Id()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof un(e).ShadowRoot}const Q_=new Set(["inline","contents"]);function Ya(e){const{overflow:t,overflowX:s,overflowY:r,display:i}=Gn(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+s)&&!Q_.has(i)}const ek=new Set(["table","td","th"]);function tk(e){return ek.has(sa(e))}const nk=[":popover-open",":modal"];function Ld(e){return nk.some(t=>{try{return e.matches(t)}catch{return!1}})}const sk=["transform","translate","scale","rotate","perspective"],rk=["transform","translate","scale","rotate","perspective","filter"],ak=["paint","layout","strict","content"];function vg(e){const t=Pd(),s=Nt(e)?Gn(e):e;return sk.some(r=>s[r]?s[r]!=="none":!1)||(s.containerType?s.containerType!=="normal":!1)||!t&&(s.backdropFilter?s.backdropFilter!=="none":!1)||!t&&(s.filter?s.filter!=="none":!1)||rk.some(r=>(s.willChange||"").includes(r))||ak.some(r=>(s.contain||"").includes(r))}function ik(e){let t=$s(e);for(;Pt(t)&&!Ls(t);){if(vg(t))return t;if(Ld(t))return null;t=$s(t)}return null}function Pd(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const ok=new Set(["html","body","#document"]);function Ls(e){return ok.has(sa(e))}function Gn(e){return un(e).getComputedStyle(e)}function Ud(e){return Nt(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function $s(e){if(sa(e)==="html")return e;const t=e.assignedSlot||e.parentNode||fm(e)&&e.host||Zs(e);return fm(t)?t.host:t}function hE(e){const t=$s(e);return Ls(t)?e.ownerDocument?e.ownerDocument.body:e.body:Pt(t)&&Ya(t)?t:hE(t)}function Yr(e,t,s){var r;t===void 0&&(t=[]),s===void 0&&(s=!0);const i=hE(e),l=i===((r=e.ownerDocument)==null?void 0:r.body),c=un(i);if(l){const f=hm(c);return t.concat(c,c.visualViewport||[],Ya(i)?i:[],f&&s?Yr(f):[])}return t.concat(i,Yr(i,[],s))}function hm(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}const lk=()=>{},Le=typeof document<"u"?b.useLayoutEffect:lk,ck=b.createContext(void 0);function uk(e=!1){const t=b.useContext(ck);if(t===void 0&&!e)throw new Error(qa(16));return t}function dk(e){const{focusableWhenDisabled:t,disabled:s,composite:r=!1,tabIndex:i=0,isNativeButton:l}=e,c=r&&t!==!1,f=r&&t===!1;return{props:b.useMemo(()=>{const h={onKeyDown(g){s&&t&&g.key!=="Tab"&&g.preventDefault()}};return r||(h.tabIndex=i,!l&&s&&(h.tabIndex=t?i:-1)),(l&&(t||c)||!l&&s)&&(h["aria-disabled"]=s),l&&(!t||f)&&(h.disabled=s),h},[r,s,t,c,f,l,i])}}function fk(e={}){const{disabled:t=!1,focusableWhenDisabled:s,tabIndex:r=0,native:i=!0}=e,l=b.useRef(null),c=uk(!0)!==void 0,f=Ue(()=>{const x=l.current;return!!(x?.tagName==="A"&&x?.href)}),{props:p}=dk({focusableWhenDisabled:s,disabled:t,composite:c,tabIndex:r,isNativeButton:i}),h=b.useCallback(()=>{const x=l.current;hk(x)&&c&&t&&p.disabled===void 0&&x.disabled&&(x.disabled=!1)},[t,p.disabled,c]);Le(h,[h]);const g=b.useCallback((x={})=>{const{onClick:w,onMouseDown:T,onKeyUp:N,onKeyDown:A,onPointerDown:C,...j}=x;return Dd({type:i?"button":void 0,onClick(_){if(t){_.preventDefault();return}w?.(_)},onMouseDown(_){t||T?.(_)},onKeyDown(_){if(t||(dm(_),A?.(_)),_.baseUIHandlerPrevented)return;const R=_.target===_.currentTarget&&!i&&!f()&&!t,M=_.key==="Enter",O=_.key===" ";R&&((O||M)&&_.preventDefault(),M&&w?.(_))},onKeyUp(_){t||(dm(_),N?.(_)),!_.baseUIHandlerPrevented&&_.target===_.currentTarget&&!i&&!t&&_.key===" "&&w?.(_)},onPointerDown(_){if(t){_.preventDefault();return}C?.(_)}},i?void 0:{role:"button"},p,j)},[t,p,i,f]),v=Ue(x=>{l.current=x,h()});return{getButtonProps:g,buttonRef:v}}function hk(e){return Pt(e)&&e.tagName==="BUTTON"}const pk={type:"regular-item"};function mk(e){const{closeOnClick:t,disabled:s=!1,highlighted:r,id:i,store:l,nativeButton:c,itemMetadata:f,nodeId:p}=e,h=b.useRef(null),g=Od(!0),v=g!==void 0,{events:x}=l.useState("floatingTreeRoot"),{getButtonProps:w,buttonRef:T}=fk({disabled:s,focusableWhenDisabled:!0,native:c}),N=b.useCallback(C=>Dd({id:i,role:"menuitem",tabIndex:r?0:-1,onMouseMove(j){p&&x.emit("itemhover",{nodeId:p,target:j.currentTarget})},onMouseEnter(){f.type==="submenu-trigger"&&f.setActive()},onKeyUp(j){j.key===" "&&l.context.typingRef.current&&j.preventBaseUIHandler()},onClick(j){t&&x.emit("close",{domEvent:j,reason:dE})},onMouseUp(j){if(g){const S=g.initialCursorPointRef.current;if(g.initialCursorPointRef.current=null,v&&S&&Math.abs(j.clientX-S.x)<=1&&Math.abs(j.clientY-S.y)<=1)return}h.current&&l.context.allowMouseUpTriggerRef.current&&(!v||j.button===2)&&f.type==="regular-item"&&h.current.click()}},C,w),[i,r,w,t,x,l,v,g,f,p]),A=kl(h,T);return b.useMemo(()=>({getItemProps:N,itemRef:A}),[N,A])}const pE=b.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},elementsRef:{current:[]},nextIndexRef:{current:0}});function gk(){return b.useContext(pE)}let yk=(function(e){return e[e.None=0]="None",e[e.GuessFromOrder=1]="GuessFromOrder",e})({});function vk(e={}){const{label:t,metadata:s,textRef:r,indexGuessBehavior:i,index:l}=e,{register:c,unregister:f,subscribeMapChange:p,elementsRef:h,labelsRef:g,nextIndexRef:v}=gk(),x=b.useRef(-1),[w,T]=b.useState(l??(i===yk.GuessFromOrder?()=>{if(x.current===-1){const C=v.current;v.current+=1,x.current=C}return x.current}:-1)),N=b.useRef(null),A=b.useCallback(C=>{if(N.current=C,w!==-1&&C!==null&&(h.current[w]=C,g)){const j=t!==void 0;g.current[w]=j?t:r?.current?.textContent??C.textContent}},[w,h,g,t,r]);return Le(()=>{if(l!=null)return;const C=N.current;if(C)return c(C,s),()=>{f(C)}},[l,c,f,s]),Le(()=>{if(l==null)return p(C=>{const j=N.current?C.get(N.current)?.index:null;j!=null&&T(j)})},[l,p,T]),b.useMemo(()=>({ref:A,index:w}),[w,A])}function mE(e){return ta(e,"base-ui")}function Ht(e,t,s,r){let i=!1,l=!1;const c=zn;return{reason:e,event:t??new Event("base-ui"),cancel(){i=!0},allowPropagation(){l=!0},get isCanceled(){return i},get isPropagationAllowed(){return l},trigger:s,...c}}var $a=GS();const bk=[];function gE(e){b.useEffect(e,bk)}const vu=null;class xk{callbacks=[];callbacksCount=0;nextId=1;startId=1;isScheduled=!1;tick=t=>{this.isScheduled=!1;const s=this.callbacks,r=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,r>0)for(let i=0;i<s.length;i+=1)s[i]?.(t)};request(t){const s=this.nextId;return this.nextId+=1,this.callbacks.push(t),this.callbacksCount+=1,!this.isScheduled&&(requestAnimationFrame(this.tick),this.isScheduled=!0),s}cancel(t){const s=t-this.startId;s<0||s>=this.callbacks.length||(this.callbacks[s]=null,this.callbacksCount-=1)}}const bu=new xk;class zs{static create(){return new zs}static request(t){return bu.request(t)}static cancel(t){return bu.cancel(t)}currentId=vu;request(t){this.cancel(),this.currentId=bu.request(()=>{this.currentId=vu,t()})}cancel=()=>{this.currentId!==vu&&(bu.cancel(this.currentId),this.currentId=vu)};disposeEffect=()=>this.cancel}function bg(){const e=ds(zs.create).current;return gE(e.disposeEffect),e}function wk(e,t=!1,s=!1){const[r,i]=b.useState(e&&t?"idle":void 0),[l,c]=b.useState(e);return e&&!l&&(c(!0),i("starting")),!e&&l&&r!=="ending"&&!s&&i("ending"),!e&&!l&&r==="ending"&&i(void 0),Le(()=>{if(!e&&l&&r!=="ending"&&s){const f=zs.request(()=>{i("ending")});return()=>{zs.cancel(f)}}},[e,l,r,s]),Le(()=>{if(!e||t)return;const f=zs.request(()=>{$a.flushSync(()=>{i(void 0)})});return()=>{zs.cancel(f)}},[t,e]),Le(()=>{if(!e||!t)return;e&&l&&r!=="idle"&&i("starting");const f=zs.request(()=>{i("idle")});return()=>{zs.cancel(f)}},[t,e,l,i,r]),b.useMemo(()=>({mounted:l,setMounted:c,transitionStatus:r}),[l,r])}function On(e){const t=ds(Sk,e).current;return t.next=e,Le(t.effect),t}function Sk(e){const t={current:e,next:e,effect:()=>{t.current=t.next}};return t}function ka(e){return e==null?e:"current"in e?e.current:e}function Ek(e,t=!1,s=!0){const r=bg();return Ue((i,l=null)=>{r.cancel();const c=ka(e);c!=null&&(typeof c.getAnimations!="function"||globalThis.BASE_UI_ANIMATIONS_DISABLED?i():r.request(()=>{function f(){c&&Promise.all(c.getAnimations().map(p=>p.finished)).then(()=>{l!=null&&l.aborted||$a.flushSync(i)}).catch(()=>{if(s){if(l!=null&&l.aborted)return;$a.flushSync(i)}else c.getAnimations().length>0&&c.getAnimations().some(p=>p.pending||p.playState!=="finished")&&f()})}t?r.request(f):f()}))})}function yE(e){const{enabled:t=!0,open:s,ref:r,onComplete:i}=e,l=On(s),c=Ue(i),f=Ek(r,s);b.useEffect(()=>{t&&f(()=>{s===l.current&&c()})},[t,s,c,f,l])}const vE=b.createContext(void 0);function Nk(){const e=b.useContext(vE);if(e===void 0)throw new Error(qa(31));return e}const Tk=b.forwardRef(function(t,s){const{render:r,className:i,...l}=t,[c,f]=b.useState(void 0),p=b.useMemo(()=>({setLabelId:f}),[f]),h=na("div",t,{ref:s,props:{role:"group","aria-labelledby":c,...l}});return d.jsx(vE.Provider,{value:p,children:h})}),jk=b.forwardRef(function(t,s){const{className:r,render:i,id:l,...c}=t,f=mE(l),{setLabelId:p}=Nk();return Le(()=>(p(f),()=>{p(void 0)}),[p,f]),na("div",t,{ref:s,props:{id:f,role:"presentation",...c}})}),Ck=b.forwardRef(function(t,s){const{render:r,className:i,id:l,label:c,nativeButton:f=!1,disabled:p=!1,closeOnClick:h=!0,...g}=t,v=vk({label:c}),x=sE(!0),w=mE(l),{store:T}=io(),N=T.useState("isActive",v.index),A=T.useState("itemProps"),{getItemProps:C,itemRef:j}=mk({closeOnClick:h,disabled:p,highlighted:N,id:w,store:T,nativeButton:f,nodeId:x?.nodeId,itemMetadata:pk}),S=b.useMemo(()=>({disabled:p,highlighted:N}),[p,N]);return na("div",t,{state:S,props:[A,g,C],ref:[j,s,v.ref]})}),dl=0;class Ji{static create(){return new Ji}currentId=dl;start(t,s){this.clear(),this.currentId=setTimeout(()=>{this.currentId=dl,s()},t)}isStarted(){return this.currentId!==dl}clear=()=>{this.currentId!==dl&&(clearTimeout(this.currentId),this.currentId=dl)};disposeEffect=()=>this.clear}function Ns(){const e=ds(Ji.create).current;return gE(e.disposeEffect),e}const oo=typeof navigator<"u",yp=Mk(),bE=Dk(),xE=Ok(),Rk=typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter:none"),Ak=yp.platform==="MacIntel"&&yp.maxTouchPoints>1?!0:/iP(hone|ad|od)|iOS/.test(yp.platform),_k=oo&&/apple/i.test(navigator.vendor),pm=oo&&/android/i.test(bE)||/android/i.test(xE);oo&&bE.toLowerCase().startsWith("mac")&&navigator.maxTouchPoints;const kk=xE.includes("jsdom/");function Mk(){if(!oo)return{platform:"",maxTouchPoints:-1};const e=navigator.userAgentData;return e?.platform?{platform:e.platform,maxTouchPoints:navigator.maxTouchPoints}:{platform:navigator.platform??"",maxTouchPoints:navigator.maxTouchPoints??-1}}function Ok(){if(!oo)return"";const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(({brand:t,version:s})=>`${t}/${s}`).join(" "):navigator.userAgent}function Dk(){if(!oo)return"";const e=navigator.userAgentData;return e?.platform?e.platform:navigator.platform??""}const mm="data-base-ui-focusable",wE="active",SE="selected",EE="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])",Gr="ArrowLeft",Xr="ArrowRight",xg="ArrowUp",Fl="ArrowDown";function Hr(e){let t=e.activeElement;for(;t?.shadowRoot?.activeElement!=null;)t=t.shadowRoot.activeElement;return t}function Et(e,t){if(!e||!t)return!1;const s=t.getRootNode?.();if(e.contains(t))return!0;if(s&&fm(s)){let r=t;for(;r;){if(e===r)return!0;r=r.parentNode||r.host}}return!1}function Dn(e){return"composedPath"in e?e.composedPath()[0]:e.target}function gs(e,t){if(t==null)return!1;if("composedPath"in e)return e.composedPath().includes(t);const s=e;return s.target!=null&&t.contains(s.target)}function zk(e){return e.matches("html,body")}function ln(e){return e?.ownerDocument||document}function Ik(e){return Pt(e)&&e.matches(EE)}function gm(e){return e?e.getAttribute("role")==="combobox"&&Ik(e):!1}function id(e){return e?e.hasAttribute(mm)?e:e.querySelector(`[${mm}]`)||e:null}function Yi(e,t,s=!0){return e.filter(i=>i.parentId===t&&(!s||i.context?.open)).flatMap(i=>[i,...Yi(e,i.id,s)])}function Mx(e,t){let s=[],r=e.find(i=>i.id===t)?.parentId;for(;r;){const i=e.find(l=>l.id===r);r=i?.parentId,i&&(s=s.concat(i))}return s}function cn(e){e.preventDefault(),e.stopPropagation()}function Lk(e){return"nativeEvent"in e}function NE(e){return e.mozInputSource===0&&e.isTrusted?!0:pm&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function TE(e){return kk?!1:!pm&&e.width===0&&e.height===0||pm&&e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType==="mouse"||e.width<1&&e.height<1&&e.pressure===0&&e.detail===0&&e.pointerType==="touch"}function Pk(e,t){const s=["mouse","pen"];return s.push("",void 0),s.includes(e)}function Uk(e){const t=e.type;return t==="click"||t==="mousedown"||t==="keydown"||t==="keyup"}const $k=["top","right","bottom","left"],Qi=Math.min,Fn=Math.max,od=Math.round,Ui=Math.floor,Ps=e=>({x:e,y:e}),Vk={left:"right",right:"left",bottom:"top",top:"bottom"},Bk={start:"end",end:"start"};function ym(e,t,s){return Fn(e,Qi(t,s))}function fr(e,t){return typeof e=="function"?e(t):e}function qn(e){return e.split("-")[0]}function ra(e){return e.split("-")[1]}function wg(e){return e==="x"?"y":"x"}function Sg(e){return e==="y"?"height":"width"}const Zk=new Set(["top","bottom"]);function ls(e){return Zk.has(qn(e))?"y":"x"}function Eg(e){return wg(ls(e))}function Hk(e,t,s){s===void 0&&(s=!1);const r=ra(e),i=Eg(e),l=Sg(i);let c=i==="x"?r===(s?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[l]>t.floating[l]&&(c=ld(c)),[c,ld(c)]}function Fk(e){const t=ld(e);return[vm(e),t,vm(t)]}function vm(e){return e.replace(/start|end/g,t=>Bk[t])}const Ox=["left","right"],Dx=["right","left"],qk=["top","bottom"],Yk=["bottom","top"];function Gk(e,t,s){switch(e){case"top":case"bottom":return s?t?Dx:Ox:t?Ox:Dx;case"left":case"right":return t?qk:Yk;default:return[]}}function Xk(e,t,s,r){const i=ra(e);let l=Gk(qn(e),s==="start",r);return i&&(l=l.map(c=>c+"-"+i),t&&(l=l.concat(l.map(vm)))),l}function ld(e){return e.replace(/left|right|bottom|top/g,t=>Vk[t])}function Kk(e){return{top:0,right:0,bottom:0,left:0,...e}}function jE(e){return typeof e!="number"?Kk(e):{top:e,right:e,bottom:e,left:e}}function cd(e){const{x:t,y:s,width:r,height:i}=e;return{width:r,height:i,top:s,left:t,right:t+r,bottom:s+i,x:t,y:s}}function xu(e,t,s){return Math.floor(e/t)!==s}function Sl(e,t){return t<0||t>=e.current.length}function vp(e,t){return fn(e,{disabledIndices:t})}function zx(e,t){return fn(e,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}function fn(e,{startingIndex:t=-1,decrement:s=!1,disabledIndices:r,amount:i=1}={}){let l=t;do l+=s?-i:i;while(l>=0&&l<=e.current.length-1&&El(e,l,r));return l}function Wk(e,{event:t,orientation:s,loopFocus:r,rtl:i,cols:l,disabledIndices:c,minIndex:f,maxIndex:p,prevIndex:h,stopEvent:g=!1}){let v=h;const x=[],w={};let T=!1;{let C=null,j=-1;e.current.forEach((S,_)=>{if(S==null)return;const R=S.closest('[role="row"]');R&&(T=!0),(R!==C||j===-1)&&(C=R,j+=1,x[j]=[]),x[j].push(_),w[_]=j})}const N=T&&x.length>0&&x.some(C=>C.length!==l);function A(C){if(!N||h===-1)return;const j=w[h];if(j==null)return;const S=x[j].indexOf(h);let _=C==="up"?j-1:j+1;r&&(_<0?_=x.length-1:_>=x.length&&(_=0));const R=new Set;for(;_>=0&&_<x.length&&!R.has(_);){R.add(_);const M=x[_];if(M.length===0){_=C==="up"?_-1:_+1;continue}const O=Math.min(S,M.length-1);for(let I=O;I>=0;I-=1){const H=M[I];if(!El(e,H,c))return H}_=C==="up"?_-1:_+1,r&&(_<0?_=x.length-1:_>=x.length&&(_=0))}}if(t.key===xg){const C=A("up");if(C!==void 0)g&&cn(t),v=C;else{if(g&&cn(t),h===-1)v=p;else if(v=fn(e,{startingIndex:v,amount:l,decrement:!0,disabledIndices:c}),r&&(h-l<f||v<0)){const j=h%l,S=p%l,_=p-(S-j);S===j?v=p:v=S>j?_:_-l}Sl(e,v)&&(v=h)}}if(t.key===Fl){const C=A("down");C!==void 0?(g&&cn(t),v=C):(g&&cn(t),h===-1?v=f:(v=fn(e,{startingIndex:h,amount:l,disabledIndices:c}),r&&h+l>p&&(v=fn(e,{startingIndex:h%l-l,amount:l,disabledIndices:c}))),Sl(e,v)&&(v=h))}if(s==="both"){const C=Ui(h/l);t.key===(i?Gr:Xr)&&(g&&cn(t),h%l!==l-1?(v=fn(e,{startingIndex:h,disabledIndices:c}),r&&xu(v,l,C)&&(v=fn(e,{startingIndex:h-h%l-1,disabledIndices:c}))):r&&(v=fn(e,{startingIndex:h-h%l-1,disabledIndices:c})),xu(v,l,C)&&(v=h)),t.key===(i?Xr:Gr)&&(g&&cn(t),h%l!==0?(v=fn(e,{startingIndex:h,decrement:!0,disabledIndices:c}),r&&xu(v,l,C)&&(v=fn(e,{startingIndex:h+(l-h%l),decrement:!0,disabledIndices:c}))):r&&(v=fn(e,{startingIndex:h+(l-h%l),decrement:!0,disabledIndices:c})),xu(v,l,C)&&(v=h));const j=Ui(p/l)===C;Sl(e,v)&&(r&&j?v=t.key===(i?Xr:Gr)?p:fn(e,{startingIndex:h-h%l-1,disabledIndices:c}):v=h)}return v}function Jk(e,t,s){const r=[];let i=0;return e.forEach(({width:l,height:c},f)=>{let p=!1;for(s&&(i=0);!p;){const h=[];for(let g=0;g<l;g+=1)for(let v=0;v<c;v+=1)h.push(i+g+v*t);i%t+l<=t&&h.every(g=>r[g]==null)?(h.forEach(g=>{r[g]=f}),p=!0):i+=1}}),[...r]}function Qk(e,t,s,r,i){if(e===-1)return-1;const l=s.indexOf(e),c=t[e];switch(i){case"tl":return l;case"tr":return c?l+c.width-1:l;case"bl":return c?l+(c.height-1)*r:l;case"br":return s.lastIndexOf(e);default:return-1}}function eM(e,t){return t.flatMap((s,r)=>e.includes(s)?[r]:[])}function El(e,t,s){if(typeof s=="function")return s(t);if(s)return s.includes(t);const r=e.current[t];return r?r.hasAttribute("disabled")||r.getAttribute("aria-disabled")==="true":!1}var tM=["input:not([inert]):not([inert] *)","select:not([inert]):not([inert] *)","textarea:not([inert]):not([inert] *)","a[href]:not([inert]):not([inert] *)","button:not([inert]):not([inert] *)","[tabindex]:not(slot):not([inert]):not([inert] *)","audio[controls]:not([inert]):not([inert] *)","video[controls]:not([inert]):not([inert] *)",'[contenteditable]:not([contenteditable="false"]):not([inert]):not([inert] *)',"details>summary:first-of-type:not([inert]):not([inert] *)","details:not([inert]):not([inert] *)"],ud=tM.join(","),CE=typeof Element>"u",eo=CE?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,dd=!CE&&Element.prototype.getRootNode?function(e){var t;return e==null||(t=e.getRootNode)===null||t===void 0?void 0:t.call(e)}:function(e){return e?.ownerDocument},fd=function(t,s){var r;s===void 0&&(s=!0);var i=t==null||(r=t.getAttribute)===null||r===void 0?void 0:r.call(t,"inert"),l=i===""||i==="true",c=l||s&&t&&(typeof t.closest=="function"?t.closest("[inert]"):fd(t.parentNode));return c},nM=function(t){var s,r=t==null||(s=t.getAttribute)===null||s===void 0?void 0:s.call(t,"contenteditable");return r===""||r==="true"},RE=function(t,s,r){if(fd(t))return[];var i=Array.prototype.slice.apply(t.querySelectorAll(ud));return s&&eo.call(t,ud)&&i.unshift(t),i=i.filter(r),i},hd=function(t,s,r){for(var i=[],l=Array.from(t);l.length;){var c=l.shift();if(!fd(c,!1))if(c.tagName==="SLOT"){var f=c.assignedElements(),p=f.length?f:c.children,h=hd(p,!0,r);r.flatten?i.push.apply(i,h):i.push({scopeParent:c,candidates:h})}else{var g=eo.call(c,ud);g&&r.filter(c)&&(s||!t.includes(c))&&i.push(c);var v=c.shadowRoot||typeof r.getShadowRoot=="function"&&r.getShadowRoot(c),x=!fd(v,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(c));if(v&&x){var w=hd(v===!0?c.children:v.children,!0,r);r.flatten?i.push.apply(i,w):i.push({scopeParent:c,candidates:w})}else l.unshift.apply(l,c.children)}}return i},AE=function(t){return!isNaN(parseInt(t.getAttribute("tabindex"),10))},_E=function(t){if(!t)throw new Error("No node provided");return t.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(t.tagName)||nM(t))&&!AE(t)?0:t.tabIndex},sM=function(t,s){var r=_E(t);return r<0&&s&&!AE(t)?0:r},rM=function(t,s){return t.tabIndex===s.tabIndex?t.documentOrder-s.documentOrder:t.tabIndex-s.tabIndex},kE=function(t){return t.tagName==="INPUT"},aM=function(t){return kE(t)&&t.type==="hidden"},iM=function(t){var s=t.tagName==="DETAILS"&&Array.prototype.slice.apply(t.children).some(function(r){return r.tagName==="SUMMARY"});return s},oM=function(t,s){for(var r=0;r<t.length;r++)if(t[r].checked&&t[r].form===s)return t[r]},lM=function(t){if(!t.name)return!0;var s=t.form||dd(t),r=function(f){return s.querySelectorAll('input[type="radio"][name="'+f+'"]')},i;if(typeof window<"u"&&typeof window.CSS<"u"&&typeof window.CSS.escape=="function")i=r(window.CSS.escape(t.name));else try{i=r(t.name)}catch(c){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",c.message),!1}var l=oM(i,t.form);return!l||l===t},cM=function(t){return kE(t)&&t.type==="radio"},uM=function(t){return cM(t)&&!lM(t)},dM=function(t){var s,r=t&&dd(t),i=(s=r)===null||s===void 0?void 0:s.host,l=!1;if(r&&r!==t){var c,f,p;for(l=!!((c=i)!==null&&c!==void 0&&(f=c.ownerDocument)!==null&&f!==void 0&&f.contains(i)||t!=null&&(p=t.ownerDocument)!==null&&p!==void 0&&p.contains(t));!l&&i;){var h,g,v;r=dd(i),i=(h=r)===null||h===void 0?void 0:h.host,l=!!((g=i)!==null&&g!==void 0&&(v=g.ownerDocument)!==null&&v!==void 0&&v.contains(i))}}return l},Ix=function(t){var s=t.getBoundingClientRect(),r=s.width,i=s.height;return r===0&&i===0},fM=function(t,s){var r=s.displayCheck,i=s.getShadowRoot;if(r==="full-native"&&"checkVisibility"in t){var l=t.checkVisibility({checkOpacity:!1,opacityProperty:!1,contentVisibilityAuto:!0,visibilityProperty:!0,checkVisibilityCSS:!0});return!l}if(getComputedStyle(t).visibility==="hidden")return!0;var c=eo.call(t,"details>summary:first-of-type"),f=c?t.parentElement:t;if(eo.call(f,"details:not([open]) *"))return!0;if(!r||r==="full"||r==="full-native"||r==="legacy-full"){if(typeof i=="function"){for(var p=t;t;){var h=t.parentElement,g=dd(t);if(h&&!h.shadowRoot&&i(h)===!0)return Ix(t);t.assignedSlot?t=t.assignedSlot:!h&&g!==t.ownerDocument?t=g.host:t=h}t=p}if(dM(t))return!t.getClientRects().length;if(r!=="legacy-full")return!0}else if(r==="non-zero-area")return Ix(t);return!1},hM=function(t){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(t.tagName))for(var s=t.parentElement;s;){if(s.tagName==="FIELDSET"&&s.disabled){for(var r=0;r<s.children.length;r++){var i=s.children.item(r);if(i.tagName==="LEGEND")return eo.call(s,"fieldset[disabled] *")?!0:!i.contains(t)}return!0}s=s.parentElement}return!1},bm=function(t,s){return!(s.disabled||aM(s)||fM(s,t)||iM(s)||hM(s))},xm=function(t,s){return!(uM(s)||_E(s)<0||!bm(t,s))},pM=function(t){var s=parseInt(t.getAttribute("tabindex"),10);return!!(isNaN(s)||s>=0)},ME=function(t){var s=[],r=[];return t.forEach(function(i,l){var c=!!i.scopeParent,f=c?i.scopeParent:i,p=sM(f,c),h=c?ME(i.candidates):f;p===0?c?s.push.apply(s,h):s.push(f):r.push({documentOrder:l,tabIndex:p,item:i,isScope:c,content:h})}),r.sort(rM).reduce(function(i,l){return l.isScope?i.push.apply(i,l.content):i.push(l.content),i},[]).concat(s)},$d=function(t,s){s=s||{};var r;return s.getShadowRoot?r=hd([t],s.includeContainer,{filter:xm.bind(null,s),flatten:!1,getShadowRoot:s.getShadowRoot,shadowRootFilter:pM}):r=RE(t,s.includeContainer,xm.bind(null,s)),ME(r)},mM=function(t,s){s=s||{};var r;return s.getShadowRoot?r=hd([t],s.includeContainer,{filter:bm.bind(null,s),flatten:!0,getShadowRoot:s.getShadowRoot}):r=RE(t,s.includeContainer,bm.bind(null,s)),r},OE=function(t,s){if(s=s||{},!t)throw new Error("No node provided");return eo.call(t,ud)===!1?!1:xm(s,t)};const ql=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver=="function"&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function DE(e,t){const s=$d(e,ql()),r=s.length;if(r===0)return;const i=Hr(ln(e)),l=s.indexOf(i),c=l===-1?t===1?0:r-1:l+t;return s[c]}function zE(e){return DE(ln(e).body,1)||e}function IE(e){return DE(ln(e).body,-1)||e}function Nl(e,t){const s=t||e.currentTarget,r=e.relatedTarget;return!r||!Et(s,r)}function gM(e){$d(e,ql()).forEach(s=>{s.dataset.tabindex=s.getAttribute("tabindex")||"",s.setAttribute("tabindex","-1")})}function Lx(e){e.querySelectorAll("[data-tabindex]").forEach(s=>{const r=s.dataset.tabindex;delete s.dataset.tabindex,r?s.setAttribute("tabindex",r):s.removeAttribute("tabindex")})}function LE(){const e=new Map;return{emit(t,s){e.get(t)?.forEach(r=>r(s))},on(t,s){e.has(t)||e.set(t,new Set),e.get(t).add(s)},off(t,s){e.get(t)?.delete(s)}}}class PE{nodesRef={current:[]};events=LE();addNode(t){this.nodesRef.current.push(t)}removeNode(t){const s=this.nodesRef.current.findIndex(r=>r===t);s!==-1&&this.nodesRef.current.splice(s,1)}}const UE=b.createContext(null),$E=b.createContext(null),aa=()=>b.useContext(UE)?.id||null,lo=e=>{const t=b.useContext($E);return e??t};function yM(e){const t=ta(),s=lo(e),r=aa();return Le(()=>{if(!t)return;const i={id:t,parentId:r};return s?.addNode(i),()=>{s?.removeNode(i)}},[s,t,r]),t}function vM(e){const{children:t,id:s}=e,r=aa();return d.jsx(UE.Provider,{value:b.useMemo(()=>({id:s,parentId:r}),[s,r]),children:t})}function bM(e){const{children:t,externalTree:s}=e,r=ds(()=>s??new PE).current;return d.jsx($E.Provider,{value:r,children:t})}function Ml(e){return`data-base-ui-${e}`}const VE={clip:"rect(0 0 0 0)",overflow:"hidden",whiteSpace:"nowrap",position:"fixed",top:0,left:0,border:0,padding:0,width:1,height:1,margin:-1};function Va(e){return e?.ownerDocument||document}const pd=b.forwardRef(function(t,s){const[r,i]=b.useState();Le(()=>{_k&&i("button")},[]);const l={tabIndex:0,role:r};return d.jsx("span",{...t,ref:s,style:VE,"aria-hidden":r?void 0:!0,...l,"data-base-ui-focus-guard":""})});let Px=0;function Fu(e,t={}){const{preventScroll:s=!1,cancelPrevious:r=!0,sync:i=!1}=t;r&&cancelAnimationFrame(Px);const l=()=>e?.focus({preventScroll:s});i?l():Px=requestAnimationFrame(l)}const Gi={inert:new WeakMap,"aria-hidden":new WeakMap,none:new WeakMap};function Ux(e){return e==="inert"?Gi.inert:e==="aria-hidden"?Gi["aria-hidden"]:Gi.none}let wu=new WeakSet,Su={},bp=0;const BE=e=>e&&(e.host||BE(e.parentNode)),xM=(e,t)=>t.map(s=>{if(e.contains(s))return s;const r=BE(s);return e.contains(r)?r:null}).filter(s=>s!=null);function wM(e,t,s,r){const i="data-base-ui-inert",l=r?"inert":s?"aria-hidden":null,c=xM(t,e),f=new Set,p=new Set(c),h=[];Su[i]||(Su[i]=new WeakMap);const g=Su[i];c.forEach(v),x(t),f.clear();function v(w){!w||f.has(w)||(f.add(w),w.parentNode&&v(w.parentNode))}function x(w){!w||p.has(w)||[].forEach.call(w.children,T=>{if(sa(T)!=="script")if(f.has(T))x(T);else{const N=l?T.getAttribute(l):null,A=N!==null&&N!=="false",C=Ux(l),j=(C.get(T)||0)+1,S=(g.get(T)||0)+1;C.set(T,j),g.set(T,S),h.push(T),j===1&&A&&wu.add(T),S===1&&T.setAttribute(i,""),!A&&l&&T.setAttribute(l,l==="inert"?"":"true")}})}return bp+=1,()=>{h.forEach(w=>{const T=Ux(l),A=(T.get(w)||0)-1,C=(g.get(w)||0)-1;T.set(w,A),g.set(w,C),A||(!wu.has(w)&&l&&w.removeAttribute(l),wu.delete(w)),C||w.removeAttribute(i)}),bp-=1,bp||(Gi.inert=new WeakMap,Gi["aria-hidden"]=new WeakMap,Gi.none=new WeakMap,wu=new WeakSet,Su={})}}function SM(e,t=!1,s=!1){const r=ln(e[0]).body;return wM(e.concat(Array.from(r.querySelectorAll("[aria-live]"))),r,t,s)}const ZE=b.createContext(null),HE=()=>b.useContext(ZE),EM=Ml("portal");function NM(e={}){const{ref:t,container:s,componentProps:r=zn,elementProps:i,elementState:l}=e,c=ta(),p=HE()?.portalNode,[h,g]=b.useState(null),[v,x]=b.useState(null),w=b.useRef(null);Le(()=>{if(s===null){w.current&&(w.current=null,x(null),g(null));return}if(c==null)return;const A=(s&&(yg(s)?s:s.current))??p??document.body;if(A==null){w.current&&(w.current=null,x(null),g(null));return}w.current!==A&&(w.current=A,x(null),g(A))},[s,p,c]);const T=na("div",r,{ref:[t,x],state:l,props:[{id:c,[EM]:""},i]});return{portalNode:v,portalSubtree:h&&T?$a.createPortal(T,h):null}}const TM=b.forwardRef(function(t,s){const{children:r,container:i,className:l,render:c,renderGuards:f,...p}=t,{portalNode:h,portalSubtree:g}=NM({container:i,ref:s,componentProps:t,elementProps:p}),v=b.useRef(null),x=b.useRef(null),w=b.useRef(null),T=b.useRef(null),[N,A]=b.useState(null),C=N?.modal,j=N?.open,S=typeof f=="boolean"?f:!!N&&!N.modal&&N.open&&!!h;b.useEffect(()=>{if(!h||C)return;function R(M){h&&Nl(M)&&(M.type==="focusin"?Lx:gM)(h)}return h.addEventListener("focusin",R,!0),h.addEventListener("focusout",R,!0),()=>{h.removeEventListener("focusin",R,!0),h.removeEventListener("focusout",R,!0)}},[h,C]),b.useEffect(()=>{!h||j||Lx(h)},[j,h]);const _=b.useMemo(()=>({beforeOutsideRef:v,afterOutsideRef:x,beforeInsideRef:w,afterInsideRef:T,portalNode:h,setFocusManagerState:A}),[h]);return d.jsxs(b.Fragment,{children:[g,d.jsxs(ZE.Provider,{value:_,children:[S&&h&&d.jsx(pd,{"data-type":"outside",ref:v,onFocus:R=>{if(Nl(R,h))w.current?.focus();else{const M=N?N.domReference:null;IE(M)?.focus()}}}),S&&h&&d.jsx("span",{"aria-owns":h.id,style:z_}),h&&$a.createPortal(r,h),S&&h&&d.jsx(pd,{"data-type":"outside",ref:x,onFocus:R=>{if(Nl(R,h))T.current?.focus();else{const M=N?N.domReference:null;zE(M)?.focus(),N?.closeOnFocusOut&&N?.onOpenChange(!1,Ht(zd,R.nativeEvent))}}})]})]})});function jM(e,t){const s=un(e.target);return e instanceof s.KeyboardEvent?"keyboard":e instanceof s.FocusEvent?t||"keyboard":"pointerType"in e?e.pointerType||"keyboard":"touches"in e?"touch":e instanceof s.MouseEvent?t||(e.detail===0?"keyboard":"mouse"):""}const $x=20;let Fr=[];function Ng(){Fr=Fr.filter(e=>e.isConnected)}function CM(e){Ng(),e&&sa(e)!=="body"&&(Fr.push(e),Fr.length>$x&&(Fr=Fr.slice(-$x)))}function xp(){return Ng(),Fr[Fr.length-1]}function RM(e){if(!e)return null;const t=ql();return OE(e,t)?e:$d(e,t)[0]||e}function AM(e){return!e||!e.isConnected?!1:typeof e.checkVisibility=="function"?e.checkVisibility():Gn(e).display!=="none"}function Vx(e,t){if(!t.current.includes("floating")&&!e.getAttribute("role")?.includes("dialog"))return;const s=ql(),i=mM(e,s).filter(c=>{const f=c.getAttribute("data-tabindex")||"";return OE(c,s)||c.hasAttribute("data-tabindex")&&!f.startsWith("-")}),l=e.getAttribute("tabindex");t.current.includes("floating")||i.length===0?l!=="0"&&e.setAttribute("tabindex","0"):(l!=="-1"||e.hasAttribute("data-tabindex")&&e.getAttribute("data-tabindex")!=="-1")&&(e.setAttribute("tabindex","-1"),e.setAttribute("data-tabindex","-1"))}function _M(e){const{context:t,children:s,disabled:r=!1,order:i=["content"],initialFocus:l=!0,returnFocus:c=!0,restoreFocus:f=!1,modal:p=!0,closeOnFocusOut:h=!0,openInteractionType:g="",getInsideElements:v=()=>[],nextFocusableElement:x,previousFocusableElement:w,beforeContentFocusGuardRef:T,externalTree:N}=e,A="rootStore"in t?t.rootStore:t,C=A.useState("open"),j=A.useState("domReferenceElement"),S=A.useState("floatingElement"),{events:_,dataRef:R}=A.context,M=Ue(()=>R.current.floatingContext?.nodeId),O=Ue(v),I=l===!1,H=gm(j)&&I,F=On(i),$=On(l),L=On(c),Y=On(g),ie=lo(N),ee=HE(),z=b.useRef(null),Z=b.useRef(null),B=b.useRef(!1),re=b.useRef(!1),J=b.useRef(!1),D=b.useRef(-1),U=b.useRef(""),W=b.useRef(""),se=Ns(),te=Ns(),me=bg(),he=ee!=null,pe=id(S),xe=Ue((G=pe)=>G?$d(G,ql()):[]),Re=Ue(G=>{const oe=xe(G);return F.current.map(()=>oe).filter(Boolean).flat()});b.useEffect(()=>{if(r||!p)return;function G(ve){ve.key==="Tab"&&Et(pe,Hr(ln(pe)))&&xe().length===0&&!H&&cn(ve)}const oe=ln(pe);return oe.addEventListener("keydown",G),()=>{oe.removeEventListener("keydown",G)}},[r,j,pe,p,F,H,xe,Re]),b.useEffect(()=>{if(r||!S)return;function G(oe){const ve=Dn(oe),Ce=xe().indexOf(ve);Ce!==-1&&(D.current=Ce)}return S.addEventListener("focusin",G),()=>{S.removeEventListener("focusin",G)}},[r,S,xe]),b.useEffect(()=>{if(r||!C)return;const G=ln(pe);function oe(){J.current=!1}function ve(Ce){const ge=Dn(Ce),Oe=Et(S,ge)||Et(j,ge)||Et(ee?.portalNode,ge);J.current=!Oe,W.current=Ce.pointerType||"keyboard"}function we(){W.current="keyboard"}return G.addEventListener("pointerdown",ve,!0),G.addEventListener("pointerup",oe,!0),G.addEventListener("pointercancel",oe,!0),G.addEventListener("keydown",we,!0),()=>{G.removeEventListener("pointerdown",ve,!0),G.removeEventListener("pointerup",oe,!0),G.removeEventListener("pointercancel",oe,!0),G.removeEventListener("keydown",we,!0)}},[r,S,j,pe,C,ee]),b.useEffect(()=>{if(r||!h)return;function G(){re.current=!0,te.start(0,()=>{re.current=!1})}function oe(ge){const Oe=ge.relatedTarget,ye=ge.currentTarget,Se=Dn(ge);queueMicrotask(()=>{const Ee=M(),We=A.context.triggerElements,ot=!(Et(j,Oe)||Et(S,Oe)||Et(Oe,S)||Et(ee?.portalNode,Oe)||Oe!=null&&We.hasElement(Oe)||We.hasMatchingElement(Fe=>Et(Fe,Oe))||Oe?.hasAttribute(Ml("focus-guard"))||ie&&(Yi(ie.nodesRef.current,Ee).find(Fe=>Et(Fe.context?.elements.floating,Oe)||Et(Fe.context?.elements.domReference,Oe))||Mx(ie.nodesRef.current,Ee).find(Fe=>[Fe.context?.elements.floating,id(Fe.context?.elements.floating)].includes(Oe)||Fe.context?.elements.domReference===Oe)));if(ye===j&&pe&&Vx(pe,F),f&&ye!==j&&!AM(Se)&&Hr(ln(pe))===ln(pe).body){if(Pt(pe)&&(pe.focus(),f==="popup")){me.request(()=>{pe.focus()});return}const Fe=D.current,qt=xe(),Kt=qt[Fe]||qt[qt.length-1]||pe;Pt(Kt)&&Kt.focus()}if(R.current.insideReactTree){R.current.insideReactTree=!1;return}(H||!p)&&Oe&&ot&&!re.current&&(H||Oe!==xp())&&(B.current=!0,A.setOpen(!1,Ht(zd,ge)))})}function ve(){J.current||(R.current.insideReactTree=!0,se.start(0,()=>{R.current.insideReactTree=!1}))}const we=Pt(j)?j:null,Ce=[];if(!(!S&&!we))return we&&(we.addEventListener("focusout",oe),we.addEventListener("pointerdown",G),Ce.push(()=>{we.removeEventListener("focusout",oe),we.removeEventListener("pointerdown",G)})),S&&(S.addEventListener("focusout",oe),ee&&(S.addEventListener("focusout",ve,!0),Ce.push(()=>{S.removeEventListener("focusout",ve,!0)})),Ce.push(()=>{S.removeEventListener("focusout",oe)})),()=>{Ce.forEach(ge=>{ge()})}},[r,j,S,pe,p,ie,ee,A,h,f,xe,H,M,F,R,se,te,me]);const fe=b.useRef(null),ke=b.useRef(null),Te=kl(fe,T,ee?.beforeInsideRef),He=kl(ke,ee?.afterInsideRef);b.useEffect(()=>{if(r||!S||!C)return;const G=Array.from(ee?.portalNode?.querySelectorAll(`[${Ml("portal")}]`)||[]),ve=(ie?Mx(ie.nodesRef.current,M()):[]).find(ge=>gm(ge.context?.elements.domReference||null))?.context?.elements.domReference,we=[S,ve,...G,...O(),z.current,Z.current,fe.current,ke.current,ee?.beforeOutsideRef.current,ee?.afterOutsideRef.current,ka(w),ka(x),H?j:null].filter(ge=>ge!=null),Ce=SM(we,p||H);return()=>{Ce()}},[C,r,j,S,p,F,ee,H,ie,M,O,x,w]),Le(()=>{if(!C||r||!Pt(pe))return;const G=ln(pe),oe=Hr(G);queueMicrotask(()=>{const ve=Re(pe),we=$.current,Ce=typeof we=="function"?we(Y.current||""):we;if(Ce===void 0||Ce===!1)return;let ge;Ce===!0||Ce===null?ge=ve[0]||pe:ge=ka(Ce),ge=ge||ve[0]||pe,!Et(pe,oe)&&Fu(ge,{preventScroll:ge===pe})})},[r,C,pe,I,Re,$,Y]),Le(()=>{if(r||!pe)return;const G=ln(pe),oe=Hr(G);CM(oe);function ve(ge){if(ge.open||(U.current=jM(ge.nativeEvent,W.current)),ge.reason===La&&ge.nativeEvent.type==="mouseleave"&&(B.current=!0),ge.reason===gg)if(ge.nested)B.current=!1;else if(NE(ge.nativeEvent)||TE(ge.nativeEvent))B.current=!1;else{let Oe=!1;document.createElement("div").focus({get preventScroll(){return Oe=!0,!1}}),Oe?B.current=!1:B.current=!0}}_.on("openchange",ve);const we=G.createElement("span");we.setAttribute("tabindex","-1"),we.setAttribute("aria-hidden","true"),Object.assign(we.style,VE),he&&j&&j.insertAdjacentElement("afterend",we);function Ce(){const ge=L.current;let Oe=typeof ge=="function"?ge(U.current):ge;if(Oe===void 0||Oe===!1)return null;if(Oe===null&&(Oe=!0),typeof Oe=="boolean"){const Se=j||xp();return Se&&Se.isConnected?Se:we}const ye=j||xp()||we;return ka(Oe)||ye}return()=>{_.off("openchange",ve);const ge=Hr(G),Oe=Et(S,ge)||ie&&Yi(ie.nodesRef.current,M(),!1).some(Se=>Et(Se.context?.elements.floating,ge)),ye=Ce();queueMicrotask(()=>{const Se=RM(ye),Ee=typeof L.current!="boolean";L.current&&!B.current&&Pt(Se)&&(!(!Ee&&Se!==ge&&ge!==G.body)||Oe)&&Se.focus({preventScroll:!0}),we.remove()})}},[r,S,pe,L,R,_,ie,he,j,M]),b.useEffect(()=>{queueMicrotask(()=>{B.current=!1})},[r]),b.useEffect(()=>{if(r||!C)return;function G(ve){Dn(ve)?.closest(`[${O_}]`)&&(re.current=!0)}const oe=ln(pe);return oe.addEventListener("pointerdown",G,!0),()=>{oe.removeEventListener("pointerdown",G,!0)}},[r,C,pe]),Le(()=>{if(!r&&ee)return ee.setFocusManagerState({modal:p,closeOnFocusOut:h,open:C,onOpenChange:A.setOpen,domReference:j}),()=>{ee.setFocusManagerState(null)}},[r,ee,p,C,A,h,j]),Le(()=>{if(!(r||!pe))return Vx(pe,F),()=>{queueMicrotask(Ng)}},[r,pe,F]);const ae=!r&&(p?!H:!0)&&(he||p);return d.jsxs(b.Fragment,{children:[ae&&d.jsx(pd,{"data-type":"inside",ref:Te,onFocus:G=>{if(p){const oe=Re();Fu(oe[oe.length-1])}else ee?.portalNode&&(B.current=!1,Nl(G,ee.portalNode)?zE(j)?.focus():ka(w??ee.beforeOutsideRef)?.focus())}}),s,ae&&d.jsx(pd,{"data-type":"inside",ref:He,onFocus:G=>{p?Fu(Re()[0]):ee?.portalNode&&(h&&(B.current=!0),Nl(G,ee.portalNode)?IE(j)?.focus():ka(x??ee.afterOutsideRef)?.focus())}})]})}function Bx(e,t,s){let{reference:r,floating:i}=e;const l=ls(t),c=Eg(t),f=Sg(c),p=qn(t),h=l==="y",g=r.x+r.width/2-i.width/2,v=r.y+r.height/2-i.height/2,x=r[f]/2-i[f]/2;let w;switch(p){case"top":w={x:g,y:r.y-i.height};break;case"bottom":w={x:g,y:r.y+r.height};break;case"right":w={x:r.x+r.width,y:v};break;case"left":w={x:r.x-i.width,y:v};break;default:w={x:r.x,y:r.y}}switch(ra(t)){case"start":w[c]-=x*(s&&h?-1:1);break;case"end":w[c]+=x*(s&&h?-1:1);break}return w}async function kM(e,t){var s;t===void 0&&(t={});const{x:r,y:i,platform:l,rects:c,elements:f,strategy:p}=e,{boundary:h="clippingAncestors",rootBoundary:g="viewport",elementContext:v="floating",altBoundary:x=!1,padding:w=0}=fr(t,e),T=jE(w),A=f[x?v==="floating"?"reference":"floating":v],C=cd(await l.getClippingRect({element:(s=await(l.isElement==null?void 0:l.isElement(A)))==null||s?A:A.contextElement||await(l.getDocumentElement==null?void 0:l.getDocumentElement(f.floating)),boundary:h,rootBoundary:g,strategy:p})),j=v==="floating"?{x:r,y:i,width:c.floating.width,height:c.floating.height}:c.reference,S=await(l.getOffsetParent==null?void 0:l.getOffsetParent(f.floating)),_=await(l.isElement==null?void 0:l.isElement(S))?await(l.getScale==null?void 0:l.getScale(S))||{x:1,y:1}:{x:1,y:1},R=cd(l.convertOffsetParentRelativeRectToViewportRelativeRect?await l.convertOffsetParentRelativeRectToViewportRelativeRect({elements:f,rect:j,offsetParent:S,strategy:p}):j);return{top:(C.top-R.top+T.top)/_.y,bottom:(R.bottom-C.bottom+T.bottom)/_.y,left:(C.left-R.left+T.left)/_.x,right:(R.right-C.right+T.right)/_.x}}const MM=async(e,t,s)=>{const{placement:r="bottom",strategy:i="absolute",middleware:l=[],platform:c}=s,f=l.filter(Boolean),p=await(c.isRTL==null?void 0:c.isRTL(t));let h=await c.getElementRects({reference:e,floating:t,strategy:i}),{x:g,y:v}=Bx(h,r,p),x=r,w={},T=0;for(let A=0;A<f.length;A++){var N;const{name:C,fn:j}=f[A],{x:S,y:_,data:R,reset:M}=await j({x:g,y:v,initialPlacement:r,placement:x,strategy:i,middlewareData:w,rects:h,platform:{...c,detectOverflow:(N=c.detectOverflow)!=null?N:kM},elements:{reference:e,floating:t}});g=S??g,v=_??v,w={...w,[C]:{...w[C],...R}},M&&T<=50&&(T++,typeof M=="object"&&(M.placement&&(x=M.placement),M.rects&&(h=M.rects===!0?await c.getElementRects({reference:e,floating:t,strategy:i}):M.rects),{x:g,y:v}=Bx(h,x,p)),A=-1)}return{x:g,y:v,placement:x,strategy:i,middlewareData:w}},OM=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var s,r;const{placement:i,middlewareData:l,rects:c,initialPlacement:f,platform:p,elements:h}=t,{mainAxis:g=!0,crossAxis:v=!0,fallbackPlacements:x,fallbackStrategy:w="bestFit",fallbackAxisSideDirection:T="none",flipAlignment:N=!0,...A}=fr(e,t);if((s=l.arrow)!=null&&s.alignmentOffset)return{};const C=qn(i),j=ls(f),S=qn(f)===f,_=await(p.isRTL==null?void 0:p.isRTL(h.floating)),R=x||(S||!N?[ld(f)]:Fk(f)),M=T!=="none";!x&&M&&R.push(...Xk(f,N,T,_));const O=[f,...R],I=await p.detectOverflow(t,A),H=[];let F=((r=l.flip)==null?void 0:r.overflows)||[];if(g&&H.push(I[C]),v){const ie=Hk(i,c,_);H.push(I[ie[0]],I[ie[1]])}if(F=[...F,{placement:i,overflows:H}],!H.every(ie=>ie<=0)){var $,L;const ie=((($=l.flip)==null?void 0:$.index)||0)+1,ee=O[ie];if(ee&&(!(v==="alignment"?j!==ls(ee):!1)||F.every(B=>ls(B.placement)===j?B.overflows[0]>0:!0)))return{data:{index:ie,overflows:F},reset:{placement:ee}};let z=(L=F.filter(Z=>Z.overflows[0]<=0).sort((Z,B)=>Z.overflows[1]-B.overflows[1])[0])==null?void 0:L.placement;if(!z)switch(w){case"bestFit":{var Y;const Z=(Y=F.filter(B=>{if(M){const re=ls(B.placement);return re===j||re==="y"}return!0}).map(B=>[B.placement,B.overflows.filter(re=>re>0).reduce((re,J)=>re+J,0)]).sort((B,re)=>B[1]-re[1])[0])==null?void 0:Y[0];Z&&(z=Z);break}case"initialPlacement":z=f;break}if(i!==z)return{reset:{placement:z}}}return{}}}};function Zx(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Hx(e){return $k.some(t=>e[t]>=0)}const DM=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:s,platform:r}=t,{strategy:i="referenceHidden",...l}=fr(e,t);switch(i){case"referenceHidden":{const c=await r.detectOverflow(t,{...l,elementContext:"reference"}),f=Zx(c,s.reference);return{data:{referenceHiddenOffsets:f,referenceHidden:Hx(f)}}}case"escaped":{const c=await r.detectOverflow(t,{...l,altBoundary:!0}),f=Zx(c,s.floating);return{data:{escapedOffsets:f,escaped:Hx(f)}}}default:return{}}}}},FE=new Set(["left","top"]);async function zM(e,t){const{placement:s,platform:r,elements:i}=e,l=await(r.isRTL==null?void 0:r.isRTL(i.floating)),c=qn(s),f=ra(s),p=ls(s)==="y",h=FE.has(c)?-1:1,g=l&&p?-1:1,v=fr(t,e);let{mainAxis:x,crossAxis:w,alignmentAxis:T}=typeof v=="number"?{mainAxis:v,crossAxis:0,alignmentAxis:null}:{mainAxis:v.mainAxis||0,crossAxis:v.crossAxis||0,alignmentAxis:v.alignmentAxis};return f&&typeof T=="number"&&(w=f==="end"?T*-1:T),p?{x:w*g,y:x*h}:{x:x*h,y:w*g}}const IM=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var s,r;const{x:i,y:l,placement:c,middlewareData:f}=t,p=await zM(t,e);return c===((s=f.offset)==null?void 0:s.placement)&&(r=f.arrow)!=null&&r.alignmentOffset?{}:{x:i+p.x,y:l+p.y,data:{...p,placement:c}}}}},LM=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:s,y:r,placement:i,platform:l}=t,{mainAxis:c=!0,crossAxis:f=!1,limiter:p={fn:C=>{let{x:j,y:S}=C;return{x:j,y:S}}},...h}=fr(e,t),g={x:s,y:r},v=await l.detectOverflow(t,h),x=ls(qn(i)),w=wg(x);let T=g[w],N=g[x];if(c){const C=w==="y"?"top":"left",j=w==="y"?"bottom":"right",S=T+v[C],_=T-v[j];T=ym(S,T,_)}if(f){const C=x==="y"?"top":"left",j=x==="y"?"bottom":"right",S=N+v[C],_=N-v[j];N=ym(S,N,_)}const A=p.fn({...t,[w]:T,[x]:N});return{...A,data:{x:A.x-s,y:A.y-r,enabled:{[w]:c,[x]:f}}}}}},PM=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:s,y:r,placement:i,rects:l,middlewareData:c}=t,{offset:f=0,mainAxis:p=!0,crossAxis:h=!0}=fr(e,t),g={x:s,y:r},v=ls(i),x=wg(v);let w=g[x],T=g[v];const N=fr(f,t),A=typeof N=="number"?{mainAxis:N,crossAxis:0}:{mainAxis:0,crossAxis:0,...N};if(p){const S=x==="y"?"height":"width",_=l.reference[x]-l.floating[S]+A.mainAxis,R=l.reference[x]+l.reference[S]-A.mainAxis;w<_?w=_:w>R&&(w=R)}if(h){var C,j;const S=x==="y"?"width":"height",_=FE.has(qn(i)),R=l.reference[v]-l.floating[S]+(_&&((C=c.offset)==null?void 0:C[v])||0)+(_?0:A.crossAxis),M=l.reference[v]+l.reference[S]+(_?0:((j=c.offset)==null?void 0:j[v])||0)-(_?A.crossAxis:0);T<R?T=R:T>M&&(T=M)}return{[x]:w,[v]:T}}}},UM=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var s,r;const{placement:i,rects:l,platform:c,elements:f}=t,{apply:p=()=>{},...h}=fr(e,t),g=await c.detectOverflow(t,h),v=qn(i),x=ra(i),w=ls(i)==="y",{width:T,height:N}=l.floating;let A,C;v==="top"||v==="bottom"?(A=v,C=x===(await(c.isRTL==null?void 0:c.isRTL(f.floating))?"start":"end")?"left":"right"):(C=v,A=x==="end"?"top":"bottom");const j=N-g.top-g.bottom,S=T-g.left-g.right,_=Qi(N-g[A],j),R=Qi(T-g[C],S),M=!t.middlewareData.shift;let O=_,I=R;if((s=t.middlewareData.shift)!=null&&s.enabled.x&&(I=S),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(O=j),M&&!x){const F=Fn(g.left,0),$=Fn(g.right,0),L=Fn(g.top,0),Y=Fn(g.bottom,0);w?I=T-2*(F!==0||$!==0?F+$:Fn(g.left,g.right)):O=N-2*(L!==0||Y!==0?L+Y:Fn(g.top,g.bottom))}await p({...t,availableWidth:I,availableHeight:O});const H=await c.getDimensions(f.floating);return T!==H.width||N!==H.height?{reset:{rects:!0}}:{}}}};function qE(e){const t=Gn(e);let s=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const i=Pt(e),l=i?e.offsetWidth:s,c=i?e.offsetHeight:r,f=od(s)!==l||od(r)!==c;return f&&(s=l,r=c),{width:s,height:r,$:f}}function Tg(e){return Nt(e)?e:e.contextElement}function Xi(e){const t=Tg(e);if(!Pt(t))return Ps(1);const s=t.getBoundingClientRect(),{width:r,height:i,$:l}=qE(t);let c=(l?od(s.width):s.width)/r,f=(l?od(s.height):s.height)/i;return(!c||!Number.isFinite(c))&&(c=1),(!f||!Number.isFinite(f))&&(f=1),{x:c,y:f}}const $M=Ps(0);function YE(e){const t=un(e);return!Pd()||!t.visualViewport?$M:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function VM(e,t,s){return t===void 0&&(t=!1),!s||t&&s!==un(e)?!1:t}function Ba(e,t,s,r){t===void 0&&(t=!1),s===void 0&&(s=!1);const i=e.getBoundingClientRect(),l=Tg(e);let c=Ps(1);t&&(r?Nt(r)&&(c=Xi(r)):c=Xi(e));const f=VM(l,s,r)?YE(l):Ps(0);let p=(i.left+f.x)/c.x,h=(i.top+f.y)/c.y,g=i.width/c.x,v=i.height/c.y;if(l){const x=un(l),w=r&&Nt(r)?un(r):r;let T=x,N=hm(T);for(;N&&r&&w!==T;){const A=Xi(N),C=N.getBoundingClientRect(),j=Gn(N),S=C.left+(N.clientLeft+parseFloat(j.paddingLeft))*A.x,_=C.top+(N.clientTop+parseFloat(j.paddingTop))*A.y;p*=A.x,h*=A.y,g*=A.x,v*=A.y,p+=S,h+=_,T=un(N),N=hm(T)}}return cd({width:g,height:v,x:p,y:h})}function Vd(e,t){const s=Ud(e).scrollLeft;return t?t.left+s:Ba(Zs(e)).left+s}function GE(e,t){const s=e.getBoundingClientRect(),r=s.left+t.scrollLeft-Vd(e,s),i=s.top+t.scrollTop;return{x:r,y:i}}function BM(e){let{elements:t,rect:s,offsetParent:r,strategy:i}=e;const l=i==="fixed",c=Zs(r),f=t?Ld(t.floating):!1;if(r===c||f&&l)return s;let p={scrollLeft:0,scrollTop:0},h=Ps(1);const g=Ps(0),v=Pt(r);if((v||!v&&!l)&&((sa(r)!=="body"||Ya(c))&&(p=Ud(r)),Pt(r))){const w=Ba(r);h=Xi(r),g.x=w.x+r.clientLeft,g.y=w.y+r.clientTop}const x=c&&!v&&!l?GE(c,p):Ps(0);return{width:s.width*h.x,height:s.height*h.y,x:s.x*h.x-p.scrollLeft*h.x+g.x+x.x,y:s.y*h.y-p.scrollTop*h.y+g.y+x.y}}function ZM(e){return Array.from(e.getClientRects())}function HM(e){const t=Zs(e),s=Ud(e),r=e.ownerDocument.body,i=Fn(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),l=Fn(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let c=-s.scrollLeft+Vd(e);const f=-s.scrollTop;return Gn(r).direction==="rtl"&&(c+=Fn(t.clientWidth,r.clientWidth)-i),{width:i,height:l,x:c,y:f}}const Fx=25;function FM(e,t){const s=un(e),r=Zs(e),i=s.visualViewport;let l=r.clientWidth,c=r.clientHeight,f=0,p=0;if(i){l=i.width,c=i.height;const g=Pd();(!g||g&&t==="fixed")&&(f=i.offsetLeft,p=i.offsetTop)}const h=Vd(r);if(h<=0){const g=r.ownerDocument,v=g.body,x=getComputedStyle(v),w=g.compatMode==="CSS1Compat"&&parseFloat(x.marginLeft)+parseFloat(x.marginRight)||0,T=Math.abs(r.clientWidth-v.clientWidth-w);T<=Fx&&(l-=T)}else h<=Fx&&(l+=h);return{width:l,height:c,x:f,y:p}}const qM=new Set(["absolute","fixed"]);function YM(e,t){const s=Ba(e,!0,t==="fixed"),r=s.top+e.clientTop,i=s.left+e.clientLeft,l=Pt(e)?Xi(e):Ps(1),c=e.clientWidth*l.x,f=e.clientHeight*l.y,p=i*l.x,h=r*l.y;return{width:c,height:f,x:p,y:h}}function qx(e,t,s){let r;if(t==="viewport")r=FM(e,s);else if(t==="document")r=HM(Zs(e));else if(Nt(t))r=YM(t,s);else{const i=YE(e);r={x:t.x-i.x,y:t.y-i.y,width:t.width,height:t.height}}return cd(r)}function XE(e,t){const s=$s(e);return s===t||!Nt(s)||Ls(s)?!1:Gn(s).position==="fixed"||XE(s,t)}function GM(e,t){const s=t.get(e);if(s)return s;let r=Yr(e,[],!1).filter(f=>Nt(f)&&sa(f)!=="body"),i=null;const l=Gn(e).position==="fixed";let c=l?$s(e):e;for(;Nt(c)&&!Ls(c);){const f=Gn(c),p=vg(c);!p&&f.position==="fixed"&&(i=null),(l?!p&&!i:!p&&f.position==="static"&&!!i&&qM.has(i.position)||Ya(c)&&!p&&XE(e,c))?r=r.filter(g=>g!==c):i=f,c=$s(c)}return t.set(e,r),r}function XM(e){let{element:t,boundary:s,rootBoundary:r,strategy:i}=e;const c=[...s==="clippingAncestors"?Ld(t)?[]:GM(t,this._c):[].concat(s),r],f=c[0],p=c.reduce((h,g)=>{const v=qx(t,g,i);return h.top=Fn(v.top,h.top),h.right=Qi(v.right,h.right),h.bottom=Qi(v.bottom,h.bottom),h.left=Fn(v.left,h.left),h},qx(t,f,i));return{width:p.right-p.left,height:p.bottom-p.top,x:p.left,y:p.top}}function KM(e){const{width:t,height:s}=qE(e);return{width:t,height:s}}function WM(e,t,s){const r=Pt(t),i=Zs(t),l=s==="fixed",c=Ba(e,!0,l,t);let f={scrollLeft:0,scrollTop:0};const p=Ps(0);function h(){p.x=Vd(i)}if(r||!r&&!l)if((sa(t)!=="body"||Ya(i))&&(f=Ud(t)),r){const w=Ba(t,!0,l,t);p.x=w.x+t.clientLeft,p.y=w.y+t.clientTop}else i&&h();l&&!r&&i&&h();const g=i&&!r&&!l?GE(i,f):Ps(0),v=c.left+f.scrollLeft-p.x-g.x,x=c.top+f.scrollTop-p.y-g.y;return{x:v,y:x,width:c.width,height:c.height}}function wp(e){return Gn(e).position==="static"}function Yx(e,t){if(!Pt(e)||Gn(e).position==="fixed")return null;if(t)return t(e);let s=e.offsetParent;return Zs(e)===s&&(s=s.ownerDocument.body),s}function KE(e,t){const s=un(e);if(Ld(e))return s;if(!Pt(e)){let i=$s(e);for(;i&&!Ls(i);){if(Nt(i)&&!wp(i))return i;i=$s(i)}return s}let r=Yx(e,t);for(;r&&tk(r)&&wp(r);)r=Yx(r,t);return r&&Ls(r)&&wp(r)&&!vg(r)?s:r||ik(e)||s}const JM=async function(e){const t=this.getOffsetParent||KE,s=this.getDimensions,r=await s(e.floating);return{reference:WM(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function QM(e){return Gn(e).direction==="rtl"}const eO={convertOffsetParentRelativeRectToViewportRelativeRect:BM,getDocumentElement:Zs,getClippingRect:XM,getOffsetParent:KE,getElementRects:JM,getClientRects:ZM,getDimensions:KM,getScale:Xi,isElement:Nt,isRTL:QM};function WE(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function tO(e,t){let s=null,r;const i=Zs(e);function l(){var f;clearTimeout(r),(f=s)==null||f.disconnect(),s=null}function c(f,p){f===void 0&&(f=!1),p===void 0&&(p=1),l();const h=e.getBoundingClientRect(),{left:g,top:v,width:x,height:w}=h;if(f||t(),!x||!w)return;const T=Ui(v),N=Ui(i.clientWidth-(g+x)),A=Ui(i.clientHeight-(v+w)),C=Ui(g),S={rootMargin:-T+"px "+-N+"px "+-A+"px "+-C+"px",threshold:Fn(0,Qi(1,p))||1};let _=!0;function R(M){const O=M[0].intersectionRatio;if(O!==p){if(!_)return c();O?c(!1,O):r=setTimeout(()=>{c(!1,1e-7)},1e3)}O===1&&!WE(h,e.getBoundingClientRect())&&c(),_=!1}try{s=new IntersectionObserver(R,{...S,root:i.ownerDocument})}catch{s=new IntersectionObserver(R,S)}s.observe(e)}return c(!0),l}function Gx(e,t,s,r){r===void 0&&(r={});const{ancestorScroll:i=!0,ancestorResize:l=!0,elementResize:c=typeof ResizeObserver=="function",layoutShift:f=typeof IntersectionObserver=="function",animationFrame:p=!1}=r,h=Tg(e),g=i||l?[...h?Yr(h):[],...Yr(t)]:[];g.forEach(C=>{i&&C.addEventListener("scroll",s,{passive:!0}),l&&C.addEventListener("resize",s)});const v=h&&f?tO(h,s):null;let x=-1,w=null;c&&(w=new ResizeObserver(C=>{let[j]=C;j&&j.target===h&&w&&(w.unobserve(t),cancelAnimationFrame(x),x=requestAnimationFrame(()=>{var S;(S=w)==null||S.observe(t)})),s()}),h&&!p&&w.observe(h),w.observe(t));let T,N=p?Ba(e):null;p&&A();function A(){const C=Ba(e);N&&!WE(N,C)&&s(),N=C,T=requestAnimationFrame(A)}return s(),()=>{var C;g.forEach(j=>{i&&j.removeEventListener("scroll",s),l&&j.removeEventListener("resize",s)}),v?.(),(C=w)==null||C.disconnect(),w=null,p&&cancelAnimationFrame(T)}}const nO=IM,sO=LM,rO=OM,aO=UM,iO=DM,oO=PM,lO=(e,t,s)=>{const r=new Map,i={platform:eO,...s},l={...i.platform,_c:r};return MM(e,t,{...i,platform:l})};var cO=typeof document<"u",uO=function(){},qu=cO?b.useLayoutEffect:uO;function md(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let s,r,i;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(s=e.length,s!==t.length)return!1;for(r=s;r--!==0;)if(!md(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),s=i.length,s!==Object.keys(t).length)return!1;for(r=s;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=s;r--!==0;){const l=i[r];if(!(l==="_owner"&&e.$$typeof)&&!md(e[l],t[l]))return!1}return!0}return e!==e&&t!==t}function JE(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Xx(e,t){const s=JE(e);return Math.round(t*s)/s}function Sp(e){const t=b.useRef(e);return qu(()=>{t.current=e}),t}function dO(e){e===void 0&&(e={});const{placement:t="bottom",strategy:s="absolute",middleware:r=[],platform:i,elements:{reference:l,floating:c}={},transform:f=!0,whileElementsMounted:p,open:h}=e,[g,v]=b.useState({x:0,y:0,strategy:s,placement:t,middlewareData:{},isPositioned:!1}),[x,w]=b.useState(r);md(x,r)||w(r);const[T,N]=b.useState(null),[A,C]=b.useState(null),j=b.useCallback(B=>{B!==M.current&&(M.current=B,N(B))},[]),S=b.useCallback(B=>{B!==O.current&&(O.current=B,C(B))},[]),_=l||T,R=c||A,M=b.useRef(null),O=b.useRef(null),I=b.useRef(g),H=p!=null,F=Sp(p),$=Sp(i),L=Sp(h),Y=b.useCallback(()=>{if(!M.current||!O.current)return;const B={placement:t,strategy:s,middleware:x};$.current&&(B.platform=$.current),lO(M.current,O.current,B).then(re=>{const J={...re,isPositioned:L.current!==!1};ie.current&&!md(I.current,J)&&(I.current=J,$a.flushSync(()=>{v(J)}))})},[x,t,s,$,L]);qu(()=>{h===!1&&I.current.isPositioned&&(I.current.isPositioned=!1,v(B=>({...B,isPositioned:!1})))},[h]);const ie=b.useRef(!1);qu(()=>(ie.current=!0,()=>{ie.current=!1}),[]),qu(()=>{if(_&&(M.current=_),R&&(O.current=R),_&&R){if(F.current)return F.current(_,R,Y);Y()}},[_,R,Y,F,H]);const ee=b.useMemo(()=>({reference:M,floating:O,setReference:j,setFloating:S}),[j,S]),z=b.useMemo(()=>({reference:_,floating:R}),[_,R]),Z=b.useMemo(()=>{const B={position:s,left:0,top:0};if(!z.floating)return B;const re=Xx(z.floating,g.x),J=Xx(z.floating,g.y);return f?{...B,transform:"translate("+re+"px, "+J+"px)",...JE(z.floating)>=1.5&&{willChange:"transform"}}:{position:s,left:re,top:J}},[s,f,z.floating,g.x,g.y]);return b.useMemo(()=>({...g,update:Y,refs:ee,elements:z,floatingStyles:Z}),[g,Y,ee,z,Z])}const fO=(e,t)=>({...nO(e),options:[e,t]}),hO=(e,t)=>({...sO(e),options:[e,t]}),pO=(e,t)=>({...oO(e),options:[e,t]}),mO=(e,t)=>({...rO(e),options:[e,t]}),gO=(e,t)=>({...aO(e),options:[e,t]}),yO=(e,t)=>({...iO(e),options:[e,t]}),vO={intentional:"onClick",sloppy:"onPointerDown"};function bO(e){return{escapeKey:typeof e=="boolean"?e:e?.escapeKey??!1,outsidePress:typeof e=="boolean"?e:e?.outsidePress??!0}}function xO(e,t={}){const s="rootStore"in e?e.rootStore:e,r=s.useState("open"),i=s.useState("floatingElement"),l=s.useState("referenceElement"),c=s.useState("domReferenceElement"),{onOpenChange:f,dataRef:p}=s.context,{enabled:h=!0,escapeKey:g=!0,outsidePress:v=!0,outsidePressEvent:x="sloppy",referencePress:w=!1,referencePressEvent:T="sloppy",ancestorScroll:N=!1,bubbles:A,externalTree:C}=t,j=lo(C),S=Ue(typeof v=="function"?v:()=>!1),_=typeof v=="function"?S:v,R=b.useRef(!1),{escapeKey:M,outsidePress:O}=bO(A),I=b.useRef(null),H=Ns(),F=Ns(),$=Ue(()=>{F.clear(),p.current.insideReactTree=!1}),L=b.useRef(!1),Y=b.useRef(""),ie=Ue(fe=>{Y.current=fe.pointerType}),ee=Ue(()=>{const fe=Y.current,ke=fe==="pen"||!fe?"mouse":fe,Te=typeof x=="function"?x():x;return typeof Te=="string"?Te:Te[ke]}),z=Ue(fe=>{if(!r||!h||!g||fe.key!=="Escape"||L.current)return;const ke=p.current.floatingContext?.nodeId,Te=j?Yi(j.nodesRef.current,ke):[];if(!M&&Te.length>0){let G=!0;if(Te.forEach(oe=>{oe.context?.open&&!oe.context.dataRef.current.__escapeKeyBubbles&&(G=!1)}),!G)return}const He=Lk(fe)?fe.nativeEvent:fe,ae=Ht(fE,He);s.setOpen(!1,ae),!M&&!ae.isPropagationAllowed&&fe.stopPropagation()}),Z=Ue(fe=>{const ke=ee();return ke==="intentional"&&fe.type!=="click"||ke==="sloppy"&&fe.type==="click"}),B=Ue(()=>{p.current.insideReactTree=!0,F.start(0,$)}),re=Ue((fe,ke=!1)=>{if(Z(fe)){$();return}if(p.current.insideReactTree){$();return}if(ee()==="intentional"&&ke||typeof _=="function"&&!_(fe))return;const Te=Dn(fe),He=`[${Ml("inert")}]`,ae=ln(s.select("floatingElement")).querySelectorAll(He),G=s.context.triggerElements;if(Te&&(G.hasElement(Te)||G.hasMatchingElement(ge=>Et(ge,Te))))return;let oe=Nt(Te)?Te:null;for(;oe&&!Ls(oe);){const ge=$s(oe);if(Ls(ge)||!Nt(ge))break;oe=ge}if(ae.length&&Nt(Te)&&!zk(Te)&&!Et(Te,s.select("floatingElement"))&&Array.from(ae).every(ge=>!Et(oe,ge)))return;if(Pt(Te)&&!("touches"in fe)){const ge=Ls(Te),Oe=Gn(Te),ye=/auto|scroll/,Se=ge||ye.test(Oe.overflowX),Ee=ge||ye.test(Oe.overflowY),We=Se&&Te.clientWidth>0&&Te.scrollWidth>Te.clientWidth,ot=Ee&&Te.clientHeight>0&&Te.scrollHeight>Te.clientHeight,Fe=Oe.direction==="rtl",qt=ot&&(Fe?fe.offsetX<=Te.offsetWidth-Te.clientWidth:fe.offsetX>Te.clientWidth),Kt=We&&fe.offsetY>Te.clientHeight;if(qt||Kt)return}const ve=p.current.floatingContext?.nodeId,we=j&&Yi(j.nodesRef.current,ve).some(ge=>gs(fe,ge.context?.elements.floating));if(gs(fe,s.select("floatingElement"))||gs(fe,s.select("domReferenceElement"))||we)return;const Ce=j?Yi(j.nodesRef.current,ve):[];if(Ce.length>0){let ge=!0;if(Ce.forEach(Oe=>{Oe.context?.open&&!Oe.context.dataRef.current.__outsidePressBubbles&&(ge=!1)}),!ge)return}s.setOpen(!1,Ht(gg,fe)),$()}),J=Ue(fe=>{ee()!=="sloppy"||fe.pointerType==="touch"||!s.select("open")||!h||gs(fe,s.select("floatingElement"))||gs(fe,s.select("domReferenceElement"))||re(fe)}),D=Ue(fe=>{if(ee()!=="sloppy"||!s.select("open")||!h||gs(fe,s.select("floatingElement"))||gs(fe,s.select("domReferenceElement")))return;const ke=fe.touches[0];ke&&(I.current={startTime:Date.now(),startX:ke.clientX,startY:ke.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},H.start(1e3,()=>{I.current&&(I.current.dismissOnTouchEnd=!1,I.current.dismissOnMouseDown=!1)}))}),U=Ue(fe=>{const ke=Dn(fe);function Te(){D(fe),ke?.removeEventListener(fe.type,Te)}ke?.addEventListener(fe.type,Te)}),W=Ue(fe=>{const ke=R.current;if(R.current=!1,H.clear(),fe.type==="mousedown"&&I.current&&!I.current.dismissOnMouseDown)return;const Te=Dn(fe);function He(){fe.type==="pointerdown"?J(fe):re(fe,ke),Te?.removeEventListener(fe.type,He)}Te?.addEventListener(fe.type,He)}),se=Ue(fe=>{if(ee()!=="sloppy"||!I.current||gs(fe,s.select("floatingElement"))||gs(fe,s.select("domReferenceElement")))return;const ke=fe.touches[0];if(!ke)return;const Te=Math.abs(ke.clientX-I.current.startX),He=Math.abs(ke.clientY-I.current.startY),ae=Math.sqrt(Te*Te+He*He);ae>5&&(I.current.dismissOnTouchEnd=!0),ae>10&&(re(fe),H.clear(),I.current=null)}),te=Ue(fe=>{const ke=Dn(fe);function Te(){se(fe),ke?.removeEventListener(fe.type,Te)}ke?.addEventListener(fe.type,Te)}),me=Ue(fe=>{ee()!=="sloppy"||!I.current||gs(fe,s.select("floatingElement"))||gs(fe,s.select("domReferenceElement"))||(I.current.dismissOnTouchEnd&&re(fe),H.clear(),I.current=null)}),he=Ue(fe=>{const ke=Dn(fe);function Te(){me(fe),ke?.removeEventListener(fe.type,Te)}ke?.addEventListener(fe.type,Te)});b.useEffect(()=>{if(!r||!h)return;p.current.__escapeKeyBubbles=M,p.current.__outsidePressBubbles=O;const fe=new Ji;function ke(oe){s.setOpen(!1,Ht(Y_,oe))}function Te(){fe.clear(),L.current=!0}function He(){fe.start(Pd()?5:0,()=>{L.current=!1})}const ae=ln(i);ae.addEventListener("pointerdown",ie,!0),g&&(ae.addEventListener("keydown",z),ae.addEventListener("compositionstart",Te),ae.addEventListener("compositionend",He)),_&&(ae.addEventListener("click",W,!0),ae.addEventListener("pointerdown",W,!0),ae.addEventListener("touchstart",U,!0),ae.addEventListener("touchmove",te,!0),ae.addEventListener("touchend",he,!0),ae.addEventListener("mousedown",W,!0));let G=[];return N&&(Nt(c)&&(G=Yr(c)),Nt(i)&&(G=G.concat(Yr(i))),!Nt(l)&&l&&l.contextElement&&(G=G.concat(Yr(l.contextElement)))),G=G.filter(oe=>oe!==ae.defaultView?.visualViewport),G.forEach(oe=>{oe.addEventListener("scroll",ke,{passive:!0})}),()=>{ae.removeEventListener("pointerdown",ie,!0),g&&(ae.removeEventListener("keydown",z),ae.removeEventListener("compositionstart",Te),ae.removeEventListener("compositionend",He)),_&&(ae.removeEventListener("click",W,!0),ae.removeEventListener("pointerdown",W,!0),ae.removeEventListener("touchstart",U,!0),ae.removeEventListener("touchmove",te,!0),ae.removeEventListener("touchend",he,!0),ae.removeEventListener("mousedown",W,!0)),G.forEach(oe=>{oe.removeEventListener("scroll",ke)}),fe.clear()}},[p,i,l,c,g,_,r,f,N,h,M,O,z,re,W,J,U,te,he,ie,s]),b.useEffect($,[_,$]);const pe=b.useMemo(()=>({onKeyDown:z,...w&&{[vO[T]]:fe=>{s.setOpen(!1,Ht(ad,fe.nativeEvent))},...T!=="intentional"&&{onClick(fe){s.setOpen(!1,Ht(ad,fe.nativeEvent))}}}}),[z,s,w,T]),xe=Ue(fe=>{const ke=Dn(fe.nativeEvent);!Et(s.select("floatingElement"),ke)||fe.button!==0||(R.current=!0)}),Re=b.useMemo(()=>({onKeyDown:z,onPointerDown:xe,onMouseDown:xe,onMouseUp:xe,onClickCapture:B,onMouseDownCapture:B,onPointerDownCapture:B,onMouseUpCapture:B,onTouchEndCapture:B,onTouchMoveCapture:B}),[z,xe,B]);return b.useMemo(()=>h?{reference:pe,floating:Re,trigger:pe}:{},[h,pe,Re])}var gd=Symbol("NOT_FOUND");function wO(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!="function")throw new TypeError(t)}function SO(e,t=`expected an object, instead received ${typeof e}`){if(typeof e!="object")throw new TypeError(t)}function EO(e,t="expected all items to be functions, instead received the following types: "){if(!e.every(s=>typeof s=="function")){const s=e.map(r=>typeof r=="function"?`function ${r.name||"unnamed"}()`:typeof r).join(", ");throw new TypeError(`${t}[${s}]`)}}var Kx=e=>Array.isArray(e)?e:[e];function NO(e){const t=Array.isArray(e[0])?e[0]:e;return EO(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}function TO(e,t){const s=[],{length:r}=e;for(let i=0;i<r;i++)s.push(e[i].apply(null,t));return s}function jO(e){let t;return{get(s){return t&&e(t.key,s)?t.value:gd},put(s,r){t={key:s,value:r}},getEntries(){return t?[t]:[]},clear(){t=void 0}}}function CO(e,t){let s=[];function r(f){const p=s.findIndex(h=>t(f,h.key));if(p>-1){const h=s[p];return p>0&&(s.splice(p,1),s.unshift(h)),h.value}return gd}function i(f,p){r(f)===gd&&(s.unshift({key:f,value:p}),s.length>e&&s.pop())}function l(){return s}function c(){s=[]}return{get:r,put:i,getEntries:l,clear:c}}var RO=(e,t)=>e===t;function AO(e){return function(s,r){if(s===null||r===null||s.length!==r.length)return!1;const{length:i}=s;for(let l=0;l<i;l++)if(!e(s[l],r[l]))return!1;return!0}}function _O(e,t){const s=typeof t=="object"?t:{equalityCheck:t},{equalityCheck:r=RO,maxSize:i=1,resultEqualityCheck:l}=s,c=AO(r);let f=0;const p=i<=1?jO(c):CO(i,c);function h(){let g=p.get(arguments);if(g===gd){if(g=e.apply(null,arguments),f++,l){const x=p.getEntries().find(w=>l(w.value,g));x&&(g=x.value,f!==0&&f--)}p.put(arguments,g)}return g}return h.clearCache=()=>{p.clear(),h.resetResultsCount()},h.resultsCount=()=>f,h.resetResultsCount=()=>{f=0},h}var kO=class{constructor(e){this.value=e}deref(){return this.value}},MO=typeof WeakRef<"u"?WeakRef:kO,OO=0,Wx=1;function Eu(){return{s:OO,v:void 0,o:null,p:null}}function QE(e,t={}){let s=Eu();const{resultEqualityCheck:r}=t;let i,l=0;function c(){let f=s;const{length:p}=arguments;for(let v=0,x=p;v<x;v++){const w=arguments[v];if(typeof w=="function"||typeof w=="object"&&w!==null){let T=f.o;T===null&&(f.o=T=new WeakMap);const N=T.get(w);N===void 0?(f=Eu(),T.set(w,f)):f=N}else{let T=f.p;T===null&&(f.p=T=new Map);const N=T.get(w);N===void 0?(f=Eu(),T.set(w,f)):f=N}}const h=f;let g;if(f.s===Wx)g=f.v;else if(g=e.apply(null,arguments),l++,r){const v=i?.deref?.()??i;v!=null&&r(v,g)&&(g=v,l!==0&&l--),i=typeof g=="object"&&g!==null||typeof g=="function"?new MO(g):g}return h.s=Wx,h.v=g,g}return c.clearCache=()=>{s=Eu(),c.resetResultsCount()},c.resultsCount=()=>l,c.resetResultsCount=()=>{l=0},c}function eN(e,...t){const s=typeof e=="function"?{memoize:e,memoizeOptions:t}:e,r=(...i)=>{let l=0,c=0,f,p={},h=i.pop();typeof h=="object"&&(p=h,h=i.pop()),wO(h,`createSelector expects an output function after the inputs, but received: [${typeof h}]`);const g={...s,...p},{memoize:v,memoizeOptions:x=[],argsMemoize:w=QE,argsMemoizeOptions:T=[]}=g,N=Kx(x),A=Kx(T),C=NO(i),j=v(function(){return l++,h.apply(null,arguments)},...N),S=w(function(){c++;const R=TO(C,arguments);return f=j.apply(null,R),f},...A);return Object.assign(S,{resultFunc:h,memoizedResultFunc:j,dependencies:C,dependencyRecomputations:()=>c,resetDependencyRecomputations:()=>{c=0},lastResult:()=>f,recomputations:()=>l,resetRecomputations:()=>{l=0},memoize:v,argsMemoize:w})};return Object.assign(r,{withTypes:()=>r}),r}var DO=eN(QE),zO=Object.assign((e,t=DO)=>{SO(e,`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof e}`);const s=Object.keys(e),r=s.map(l=>e[l]);return t(r,(...l)=>l.reduce((c,f,p)=>(c[s[p]]=f,c),{}))},{withTypes:()=>zO});eN({memoize:_O,memoizeOptions:{maxSize:1,equalityCheck:Object.is}});const Ze=(e,t,s,r,i,l,...c)=>{if(c.length>0)throw new Error(qa(1));let f;if(e)f=e;else throw new Error("Missing arguments");return f};var Ep={exports:{}},Np={};var Jx;function IO(){if(Jx)return Np;Jx=1;var e=Hl();function t(v,x){return v===x&&(v!==0||1/v===1/x)||v!==v&&x!==x}var s=typeof Object.is=="function"?Object.is:t,r=e.useState,i=e.useEffect,l=e.useLayoutEffect,c=e.useDebugValue;function f(v,x){var w=x(),T=r({inst:{value:w,getSnapshot:x}}),N=T[0].inst,A=T[1];return l(function(){N.value=w,N.getSnapshot=x,p(N)&&A({inst:N})},[v,w,x]),i(function(){return p(N)&&A({inst:N}),v(function(){p(N)&&A({inst:N})})},[v]),c(w),w}function p(v){var x=v.getSnapshot;v=v.value;try{var w=x();return!s(v,w)}catch{return!0}}function h(v,x){return x()}var g=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?h:f;return Np.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:g,Np}var Qx;function tN(){return Qx||(Qx=1,Ep.exports=IO()),Ep.exports}var LO=tN(),Tp={exports:{}},jp={};var ew;function PO(){if(ew)return jp;ew=1;var e=Hl(),t=tN();function s(h,g){return h===g&&(h!==0||1/h===1/g)||h!==h&&g!==g}var r=typeof Object.is=="function"?Object.is:s,i=t.useSyncExternalStore,l=e.useRef,c=e.useEffect,f=e.useMemo,p=e.useDebugValue;return jp.useSyncExternalStoreWithSelector=function(h,g,v,x,w){var T=l(null);if(T.current===null){var N={hasValue:!1,value:null};T.current=N}else N=T.current;T=f(function(){function C(M){if(!j){if(j=!0,S=M,M=x(M),w!==void 0&&N.hasValue){var O=N.value;if(w(O,M))return _=O}return _=M}if(O=_,r(S,M))return O;var I=x(M);return w!==void 0&&w(O,I)?(S=M,O):(S=M,_=I)}var j=!1,S,_,R=v===void 0?null:v;return[function(){return C(g())},R===null?void 0:function(){return C(R())}]},[g,v,x,w]);var A=i(h,T[0],T[1]);return c(function(){N.hasValue=!0,N.value=A},[A]),p(A),A},jp}var tw;function UO(){return tw||(tw=1,Tp.exports=PO()),Tp.exports}var $O=UO();const VO=pg(19),BO=VO?HO:FO;function ZO(e,t,s,r,i){return BO(e,t,s,r,i)}function HO(e,t,s,r,i){const l=b.useCallback(()=>t(e.getSnapshot(),s,r,i),[e,t,s,r,i]);return LO.useSyncExternalStore(e.subscribe,l,l)}function FO(e,t,s,r,i){return $O.useSyncExternalStoreWithSelector(e.subscribe,e.getSnapshot,e.getSnapshot,l=>t(l,s,r,i))}class Tl{constructor(t){this.state=t,this.listeners=new Set,this.updateTick=0}subscribe=t=>(this.listeners.add(t),()=>{this.listeners.delete(t)});getSnapshot=()=>this.state;setState(t){if(this.state===t)return;this.state=t,this.updateTick+=1;const s=this.updateTick;for(const r of this.listeners){if(s!==this.updateTick)return;r(t)}}update(t){for(const s in t)if(!Object.is(this.state[s],t[s])){Tl.prototype.setState.call(this,{...this.state,...t});return}}set(t,s){Object.is(this.state[t],s)||Tl.prototype.setState.call(this,{...this.state,[t]:s})}notifyAll(){const t={...this.state};Tl.prototype.setState.call(this,t)}}class nN extends Tl{constructor(t,s={},r){super(t),this.context=s,this.selectors=r}controlledValues=new Map;useSyncedValue(t,s){b.useDebugValue(t),Le(()=>{this.state[t]!==s&&this.set(t,s)},[t,s])}useSyncedValueWithCleanup(t,s){Le(()=>(this.state[t]!==s&&this.set(t,s),()=>{this.set(t,void 0)}),[t,s])}useSyncedValues(t){const s=Object.values(t);Le(()=>{this.update(t)},s)}useControlledProp(t,s,r){b.useDebugValue(t);const i=s!==void 0;this.controlledValues.has(t)||(this.controlledValues.set(t,i),!i&&!Object.is(this.state[t],r)&&super.setState({...this.state,[t]:r})),Le(()=>{i&&!Object.is(this.state[t],s)&&super.setState({...this.state,[t]:s})},[t,s,r,i])}set(t,s){this.controlledValues.get(t)!==!0&&super.set(t,s)}update(t){const s={...t};for(const r in s)if(Object.hasOwn(s,r)&&this.controlledValues.get(r)===!0){delete s[r];continue}super.update(s)}setState(t){const s={...t};for(const r in s)if(Object.hasOwn(s,r)&&this.controlledValues.get(r)===!0){delete s[r];continue}super.setState({...this.state,...s})}select=(t,s,r,i)=>{const l=this.selectors[t];return l(this.state,s,r,i)};useState=(t,s,r,i)=>{b.useDebugValue(t);const l=this.selectors[t];return ZO(this,l,s,r,i)};useContextCallback(t,s){b.useDebugValue(t);const r=Ue(s??lE);this.context[t]=r}useStateSetter(t){const s=b.useRef(void 0);return s.current===void 0&&(s.current=r=>{this.set(t,r)}),s.current}observe(t,s){let r;typeof t=="function"?r=t:r=this.selectors[t];let i=r(this.state);return s(i,i,this),this.subscribe(l=>{const c=r(l);if(!Object.is(i,c)){const f=i;i=c,s(c,f,this)}})}}const qO={open:Ze(e=>e.open),domReferenceElement:Ze(e=>e.domReferenceElement),referenceElement:Ze(e=>e.positionReference??e.referenceElement),floatingElement:Ze(e=>e.floatingElement),floatingId:Ze(e=>e.floatingId)};class jg extends nN{constructor(t){const{nested:s,noEmit:r,onOpenChange:i,triggerElements:l,...c}=t;super({...c,positionReference:c.referenceElement,domReferenceElement:c.referenceElement},{onOpenChange:i,dataRef:{current:{}},events:LE(),nested:s,noEmit:r,triggerElements:l},qO)}setOpen=(t,s)=>{if((!t||!this.state.open||Uk(s.event))&&(this.context.dataRef.current.openEvent=t?s.event:void 0),!this.context.noEmit){const r={open:t,reason:s.reason,nativeEvent:s.event,nested:this.context.nested,triggerElement:s.trigger};this.context.events.emit("openchange",r)}this.context.onOpenChange?.(t,s)}}function YO(e){const t=e.useState("open");Le(()=>{if(t&&!e.select("activeTriggerId")&&e.context.triggerElements.size===1){const s=e.context.triggerElements.entries().next();if(!s.done){const[r,i]=s.value;e.update({activeTriggerId:r,activeTriggerElement:i})}}},[t,e])}function GO(e,t,s){const{mounted:r,setMounted:i,transitionStatus:l}=wk(e);t.useSyncedValues({mounted:r,transitionStatus:l});const c=Ue(()=>{i(!1),t.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1}),s?.(),t.context.onOpenChangeComplete?.(!1)}),f=t.useState("preventUnmountingOnClose");return yE({enabled:!f,open:e,ref:t.context.popupRef,onComplete(){e||c()}}),{forceUnmount:c,transitionStatus:l}}class Cg{constructor(){this.elements=new Set,this.idMap=new Map}add(t,s){const r=this.idMap.get(t);r!==s&&(r!==void 0&&this.elements.delete(r),this.elements.add(s),this.idMap.set(t,s))}delete(t){const s=this.idMap.get(t);s&&(this.elements.delete(s),this.idMap.delete(t))}hasElement(t){return this.elements.has(t)}hasMatchingElement(t){for(const s of this.elements)if(t(s))return!0;return!1}getById(t){return this.idMap.get(t)}entries(){return this.idMap.entries()}get size(){return this.idMap.size}}function XO(){return new jg({open:!1,floatingElement:null,referenceElement:null,triggerElements:new Cg,floatingId:"",nested:!1,noEmit:!1,onOpenChange:void 0})}function KO(){return{open:!1,mounted:!1,transitionStatus:"idle",floatingRootContext:XO(),preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,popupElement:null,positionerElement:null,activeTriggerProps:zn,inactiveTriggerProps:zn,popupProps:zn}}const WO={open:Ze(e=>e.open),mounted:Ze(e=>e.mounted),transitionStatus:Ze(e=>e.transitionStatus),floatingRootContext:Ze(e=>e.floatingRootContext),preventUnmountingOnClose:Ze(e=>e.preventUnmountingOnClose),payload:Ze(e=>e.payload),activeTriggerId:Ze(e=>e.activeTriggerId),activeTriggerElement:Ze(e=>e.mounted?e.activeTriggerElement:null),isTriggerActive:Ze((e,t)=>t!==void 0&&e.activeTriggerId===t),isOpenedByTrigger:Ze((e,t)=>t!==void 0&&e.activeTriggerId===t&&e.open),isMountedByTrigger:Ze((e,t)=>t!==void 0&&e.activeTriggerId===t&&e.mounted),triggerProps:Ze((e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps),popupProps:Ze(e=>e.popupProps),popupElement:Ze(e=>e.popupElement),positionerElement:Ze(e=>e.positionerElement)};function JO(e){const{open:t=!1,onOpenChange:s,elements:r={}}=e,i=ta(),l=aa()!=null,c=ds(()=>new jg({open:t,onOpenChange:s,referenceElement:r.reference??null,floatingElement:r.floating??null,triggerElements:r.triggers??new Cg,floatingId:i,nested:l,noEmit:e.noEmit||!1})).current;return Le(()=>{const f={open:t,floatingId:i};r.reference!==void 0&&(f.referenceElement=r.reference,f.domReferenceElement=Nt(r.reference)?r.reference:null),r.floating!==void 0&&(f.floatingElement=r.floating),c.update(f)},[t,i,r.reference,r.floating,c]),c.context.onOpenChange=s,c.context.nested=l,c.context.noEmit=e.noEmit||!1,c}function QO(e={}){const{nodeId:t,externalTree:s}=e,r=JO(e),i=e.rootContext||r,l={reference:i.useState("referenceElement"),floating:i.useState("floatingElement"),domReference:i.useState("domReferenceElement")},[c,f]=b.useState(null),p=b.useRef(null),h=lo(s);Le(()=>{l.domReference&&(p.current=l.domReference)},[l.domReference]);const g=dO({...e,elements:{...l,...c&&{reference:c}}}),v=b.useCallback(O=>{const I=Nt(O)?{getBoundingClientRect:()=>O.getBoundingClientRect(),getClientRects:()=>O.getClientRects(),contextElement:O}:O;f(I),g.refs.setReference(I)},[g.refs]),[x,w]=b.useState(null),[T,N]=b.useState(null);i.useSyncedValue("referenceElement",x),i.useSyncedValue("domReferenceElement",Nt(x)?x:null),i.useSyncedValue("floatingElement",T);const A=b.useCallback(O=>{(Nt(O)||O===null)&&(p.current=O,w(O)),(Nt(g.refs.reference.current)||g.refs.reference.current===null||O!==null&&!Nt(O))&&g.refs.setReference(O)},[g.refs,w]),C=b.useCallback(O=>{N(O),g.refs.setFloating(O)},[g.refs]),j=b.useMemo(()=>({...g.refs,setReference:A,setFloating:C,setPositionReference:v,domReference:p}),[g.refs,A,C,v]),S=b.useMemo(()=>({...g.elements,domReference:l.domReference}),[g.elements,l.domReference]),_=i.useState("open"),R=i.useState("floatingId"),M=b.useMemo(()=>({...g,dataRef:i.context.dataRef,open:_,onOpenChange:i.setOpen,events:i.context.events,floatingId:R,refs:j,elements:S,nodeId:t,rootStore:i}),[g,j,S,t,i,_,R]);return Le(()=>{i.context.dataRef.current.floatingContext=M;const O=h?.nodesRef.current.find(I=>I.id===t);O&&(O.context=M)}),b.useMemo(()=>({...g,context:M,refs:j,elements:S,rootStore:i}),[g,j,S,M,i])}function eD(e){const{popupStore:t,noEmit:s=!1,treatPopupAsFloatingElement:r=!1,onOpenChange:i}=e,l=ta(),c=aa()!=null,f=t.useState("open"),p=t.useState("activeTriggerElement"),h=t.useState(r?"popupElement":"positionerElement"),g=t.context.triggerElements,v=ds(()=>new jg({open:f,referenceElement:p,floatingElement:h,triggerElements:g,onOpenChange:i,floatingId:l,nested:c,noEmit:s})).current;return Le(()=>{const x={open:f,floatingId:l,referenceElement:p,floatingElement:h};Nt(p)&&(x.domReferenceElement=p),v.update(x)},[f,l,p,h,v]),v.context.onOpenChange=i,v.context.nested=c,v.context.noEmit=s,v}const nw=Ml("safe-polygon"),tD=`button,a,[role="button"],select,[tabindex]:not([tabindex="-1"]),${EE}`;function nD(e){return e?!!e.closest(tD):!1}function sD(e){const t=b.useRef(void 0),s=b.useRef(!1),r=b.useRef(void 0),i=b.useRef(!0),l=b.useRef(!1),c=b.useRef(()=>{}),f=b.useRef(!1),p=Ns(),h=Ns(),g=b.useRef(void 0);return b.useMemo(()=>{const v=e.context.dataRef.current;return v.hoverInteractionState||(v.hoverInteractionState={pointerTypeRef:t,interactedInsideRef:s,handlerRef:r,blockMouseMoveRef:i,performedPointerEventsMutationRef:l,unbindMouseMoveRef:c,restTimeoutPendingRef:f,openChangeTimeout:p,restTimeout:h,handleCloseOptionsRef:g}),v.hoverInteractionState},[e,t,s,r,i,l,c,f,p,h,g])}const rD=new Set(["click","mousedown"]);function aD(e,t={}){const s="rootStore"in e?e.rootStore:e,r=s.useState("open"),i=s.useState("floatingElement"),l=s.useState("domReferenceElement"),{dataRef:c}=s.context,{enabled:f=!0,closeDelay:p=0,externalTree:h}=t,{pointerTypeRef:g,interactedInsideRef:v,handlerRef:x,performedPointerEventsMutationRef:w,unbindMouseMoveRef:T,restTimeoutPendingRef:N,openChangeTimeout:A,handleCloseOptionsRef:C}=sD(s),j=lo(h),S=aa(),_=Ue(()=>v.current?!0:c.current.openEvent?rD.has(c.current.openEvent.type):!1),R=Ue(()=>{const F=c.current.openEvent?.type;return F?.includes("mouse")&&F!=="mousedown"}),M=b.useCallback((F,$=!0)=>{const L=iD(p,g.current);L&&!x.current?A.start(L,()=>s.setOpen(!1,Ht(La,F))):$&&(A.clear(),s.setOpen(!1,Ht(La,F)))},[p,x,s,g,A]),O=Ue(()=>{T.current(),x.current=void 0}),I=Ue(()=>{if(w.current){const F=ln(i).body;F.style.pointerEvents="",F.removeAttribute(nw),w.current=!1}}),H=Ue(F=>{const $=Dn(F);if(!nD($)){v.current=!1;return}v.current=!0});Le(()=>{r||(g.current=void 0,N.current=!1,v.current=!1,O(),I())},[r,g,N,v,O,I]),b.useEffect(()=>()=>{O()},[O]),b.useEffect(()=>I,[I]),Le(()=>{if(f&&r&&C.current?.blockPointerEvents&&R()&&Nt(l)&&i){w.current=!0;const F=ln(i).body;F.setAttribute(nw,"");const $=l,L=i,Y=j?.nodesRef.current.find(ie=>ie.id===S)?.context?.elements.floating;return Y&&(Y.style.pointerEvents=""),F.style.pointerEvents="none",$.style.pointerEvents="auto",L.style.pointerEvents="auto",()=>{F.style.pointerEvents="",$.style.pointerEvents="",L.style.pointerEvents=""}}},[f,r,l,i,C,R,j,S,w]),b.useEffect(()=>{if(!f)return;function F(ie){if(_()||!c.current.floatingContext)return;const ee=s.context.triggerElements;ie.relatedTarget&&ee.hasElement(ie.relatedTarget)||(I(),O(),_()||M(ie))}function $(ie){A.clear(),I(),x.current?.(ie),O()}function L(ie){_()||M(ie,!1)}const Y=i;return Y&&(Y.addEventListener("mouseleave",F),Y.addEventListener("mouseenter",$),Y.addEventListener("mouseleave",L),Y.addEventListener("pointerdown",H,!0)),()=>{Y&&(Y.removeEventListener("mouseleave",F),Y.removeEventListener("mouseenter",$),Y.removeEventListener("mouseleave",L),Y.removeEventListener("pointerdown",H,!0))}})}function iD(e,t){return t&&!Pk(t)?0:typeof e=="function"?e():e}function oD(e=[]){const t=e.map(h=>h?.reference),s=e.map(h=>h?.floating),r=e.map(h=>h?.item),i=e.map(h=>h?.trigger),l=b.useCallback(h=>Nu(h,e,"reference"),t),c=b.useCallback(h=>Nu(h,e,"floating"),s),f=b.useCallback(h=>Nu(h,e,"item"),r),p=b.useCallback(h=>Nu(h,e,"trigger"),i);return b.useMemo(()=>({getReferenceProps:l,getFloatingProps:c,getItemProps:f,getTriggerProps:p}),[l,c,f,p])}function Nu(e,t,s){const r=new Map,i=s==="item",l={};s==="floating"&&(l.tabIndex=-1,l[mm]="");for(const c in e)i&&e&&(c===wE||c===SE)||(l[c]=e[c]);for(let c=0;c<t.length;c+=1){let f;const p=t[c]?.[s];typeof p=="function"?f=e?p(e):null:f=p,f&&sw(l,f,i,r)}return sw(l,e,i,r),l}function sw(e,t,s,r){for(const i in t){const l=t[i];s&&(i===wE||i===SE)||(i.startsWith("on")?(r.has(i)||r.set(i,[]),typeof l=="function"&&(r.get(i)?.push(l),e[i]=(...c)=>r.get(i)?.map(f=>f(...c)).find(f=>f!==void 0))):e[i]=l)}}const lD="Escape";function Bd(e,t,s){switch(e){case"vertical":return t;case"horizontal":return s;default:return t||s}}function Tu(e,t){return Bd(t,e===xg||e===Fl,e===Gr||e===Xr)}function Cp(e,t,s){return Bd(t,e===Fl,s?e===Gr:e===Xr)||e==="Enter"||e===" "||e===""}function cD(e,t,s){return Bd(t,s?e===Gr:e===Xr,e===Fl)}function uD(e,t,s,r){const i=s?e===Xr:e===Gr,l=e===xg;return t==="both"||t==="horizontal"&&r&&r>1?e===lD:Bd(t,i,l)}function dD(e,t){const s="rootStore"in e?e.rootStore:e,r=s.useState("open"),i=s.useState("floatingElement"),l=s.useState("domReferenceElement"),c=s.context.dataRef,{listRef:f,activeIndex:p,onNavigate:h=()=>{},enabled:g=!0,selectedIndex:v=null,allowEscape:x=!1,loopFocus:w=!1,nested:T=!1,rtl:N=!1,virtual:A=!1,focusItemOnOpen:C="auto",focusItemOnHover:j=!0,openOnArrowKeyDown:S=!0,disabledIndices:_=void 0,orientation:R="vertical",parentOrientation:M,cols:O=1,scrollItemIntoView:I=!0,itemSizes:H,dense:F=!1,id:$,resetOnPointerLeave:L=!0,externalTree:Y}=t,ie=id(i),ee=On(ie),z=aa(),Z=lo(Y);Le(()=>{c.current.orientation=R},[c,R]);const B=gm(l),re=b.useRef(C),J=b.useRef(v??-1),D=b.useRef(null),U=b.useRef(!0),W=Ue(ye=>{h(J.current===-1?null:J.current,ye)}),se=b.useRef(W),te=b.useRef(!!i),me=b.useRef(r),he=b.useRef(!1),pe=b.useRef(!1),xe=On(_),Re=On(r),fe=On(I),ke=On(v),Te=On(L),He=Ue(()=>{function ye(ot){A?Z?.events.emit("virtualfocus",ot):Fu(ot,{sync:he.current,preventScroll:!0})}const Se=f.current[J.current],Ee=pe.current;Se&&ye(Se),(he.current?ot=>ot():requestAnimationFrame)(()=>{const ot=f.current[J.current]||Se;if(!ot)return;Se||ye(ot);const Fe=fe.current;Fe&&G&&(Ee||!U.current)&&ot.scrollIntoView?.(typeof Fe=="boolean"?{block:"nearest",inline:"nearest"}:Fe)})});Le(()=>{g&&(r&&i?(J.current=v??-1,re.current&&v!=null&&(pe.current=!0,W())):te.current&&(J.current=-1,se.current()))},[g,r,i,v,W]),Le(()=>{if(g){if(!r){he.current=!1;return}if(i)if(p==null){if(he.current=!1,ke.current!=null)return;if(te.current&&(J.current=-1,He()),(!me.current||!te.current)&&re.current&&(D.current!=null||re.current===!0&&D.current==null)){let ye=0;const Se=()=>{f.current[0]==null?(ye<2&&(ye?requestAnimationFrame:queueMicrotask)(Se),ye+=1):(J.current=D.current==null||Cp(D.current,R,N)||T?vp(f):zx(f),D.current=null,W())};Se()}}else Sl(f,p)||(J.current=p,He(),pe.current=!1)}},[g,r,i,p,ke,T,f,R,N,W,He,xe]),Le(()=>{if(!g||i||!Z||A||!te.current)return;const ye=Z.nodesRef.current,Se=ye.find(ot=>ot.id===z)?.context?.elements.floating,Ee=Hr(ln(i)),We=ye.some(ot=>ot.context&&Et(ot.context.elements.floating,Ee));Se&&!We&&U.current&&Se.focus({preventScroll:!0})},[g,i,Z,z,A]),Le(()=>{se.current=W,me.current=r,te.current=!!i}),Le(()=>{r||(D.current=null,re.current=C)},[r,C]);const ae=p!=null,G=b.useMemo(()=>{function ye(Ee){if(!Re.current)return;const We=f.current.indexOf(Ee.currentTarget);We!==-1&&J.current!==We&&(J.current=We,W(Ee))}return{onFocus(Ee){he.current=!0,ye(Ee)},onClick:({currentTarget:Ee})=>Ee.focus({preventScroll:!0}),onMouseMove(Ee){he.current=!0,pe.current=!1,j&&ye(Ee)},onPointerLeave(Ee){if(!Re.current||!U.current||Ee.pointerType==="touch")return;he.current=!0;const We=Ee.relatedTarget;!j||f.current.includes(We)||Te.current&&(J.current=-1,W(Ee),A||ee.current?.focus({preventScroll:!0}))}}},[Re,ee,j,f,W,Te,A]),oe=b.useCallback(()=>M??Z?.nodesRef.current.find(ye=>ye.id===z)?.context?.dataRef?.current.orientation,[z,Z,M]),ve=Ue(ye=>{if(U.current=!1,he.current=!0,ye.which===229||!Re.current&&ye.currentTarget===ee.current)return;if(T&&uD(ye.key,R,N,O)){Tu(ye.key,oe())||cn(ye),s.setOpen(!1,Ht(Hu,ye.nativeEvent)),Pt(l)&&(A?Z?.events.emit("virtualfocus",l):l.focus());return}const Se=J.current,Ee=vp(f,_),We=zx(f,_);if(B||(ye.key==="Home"&&(cn(ye),J.current=Ee,W(ye)),ye.key==="End"&&(cn(ye),J.current=We,W(ye))),O>1){const ot=H||Array.from({length:f.current.length},()=>({width:1,height:1})),Fe=Jk(ot,O,F),qt=Fe.findIndex(pn=>pn!=null&&!El(f,pn,_)),Kt=Fe.reduce((pn,Qt,De)=>Qt!=null&&!El(f,Qt,_)?De:pn,-1),Nn=Fe[Wk({current:Fe.map(pn=>pn!=null?f.current[pn]:null)},{event:ye,orientation:R,loopFocus:w,rtl:N,cols:O,disabledIndices:eM([...(typeof _!="function"?_:null)||f.current.map((pn,Qt)=>El(f,Qt,_)?Qt:void 0),void 0],Fe),minIndex:qt,maxIndex:Kt,prevIndex:Qk(J.current>We?Ee:J.current,ot,Fe,O,ye.key===Fl?"bl":ye.key===(N?Gr:Xr)?"tr":"tl"),stopEvent:!0})];if(Nn!=null&&(J.current=Nn,W(ye)),R==="both")return}if(Tu(ye.key,R)){if(cn(ye),r&&!A&&Hr(ye.currentTarget.ownerDocument)===ye.currentTarget){J.current=Cp(ye.key,R,N)?Ee:We,W(ye);return}Cp(ye.key,R,N)?w?Se>=We?x&&Se!==f.current.length?J.current=-1:(he.current=!1,J.current=Ee):J.current=fn(f,{startingIndex:Se,disabledIndices:_}):J.current=Math.min(We,fn(f,{startingIndex:Se,disabledIndices:_})):w?Se<=Ee?x&&Se!==-1?J.current=f.current.length:(he.current=!1,J.current=We):J.current=fn(f,{startingIndex:Se,decrement:!0,disabledIndices:_}):J.current=Math.max(Ee,fn(f,{startingIndex:Se,decrement:!0,disabledIndices:_})),Sl(f,J.current)&&(J.current=-1),W(ye)}}),we=b.useMemo(()=>A&&r&&ae&&{"aria-activedescendant":`${$}-${p}`},[A,r,ae,$,p]),Ce=b.useMemo(()=>({"aria-orientation":R==="both"?void 0:R,...B?{}:we,onKeyDown(ye){if(ye.key==="Tab"&&ye.shiftKey&&r&&!A){const Se=Dn(ye.nativeEvent);if(Se&&!Et(ee.current,Se))return;cn(ye),s.setOpen(!1,Ht(zd,ye.nativeEvent)),Pt(l)&&l.focus();return}ve(ye)},onPointerMove(){U.current=!0}}),[we,ve,ee,R,B,s,r,A,l]),ge=b.useMemo(()=>{function ye(Ee){C==="auto"&&NE(Ee.nativeEvent)&&(re.current=!A)}function Se(Ee){re.current=C,C==="auto"&&TE(Ee.nativeEvent)&&(re.current=!0)}return{onKeyDown(Ee){const We=s.select("open");U.current=!1;const ot=Ee.key.startsWith("Arrow"),Fe=cD(Ee.key,oe(),N),qt=Tu(Ee.key,R),Kt=(T?Fe:qt)||Ee.key==="Enter"||Ee.key.trim()==="";if(A&&We)return ve(Ee);if(!(!We&&!S&&ot)){if(Kt){const Nn=Tu(Ee.key,oe());D.current=T&&Nn?null:Ee.key}if(T){Fe&&(cn(Ee),We?(J.current=vp(f,xe.current),W(Ee)):s.setOpen(!0,Ht(Hu,Ee.nativeEvent,Ee.currentTarget)));return}qt&&(ke.current!=null&&(J.current=ke.current),cn(Ee),!We&&S?s.setOpen(!0,Ht(Hu,Ee.nativeEvent,Ee.currentTarget)):ve(Ee),We&&W(Ee))}},onFocus(Ee){s.select("open")&&!A&&(J.current=-1,W(Ee))},onPointerDown:Se,onPointerEnter:Se,onMouseDown:ye,onClick:ye}},[ve,xe,C,f,T,W,s,S,R,oe,N,ke,A]),Oe=b.useMemo(()=>({...we,...ge}),[we,ge]);return b.useMemo(()=>g?{reference:Oe,floating:Ce,item:G,trigger:ge}:{},[g,Oe,Ce,ge,G])}const fD=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function hD(e,t={}){const s="rootStore"in e?e.rootStore:e,r=s.useState("open"),i=s.useState("floatingId"),l=s.useState("domReferenceElement"),c=s.useState("floatingElement"),{enabled:f=!0,role:p="dialog"}=t,h=ta(),g=l?.id||h,v=b.useMemo(()=>id(c)?.id||i,[c,i]),x=fD.get(p)??p,T=aa()!=null,N=b.useMemo(()=>x==="tooltip"||p==="label"?zn:{"aria-haspopup":x==="alertdialog"?"dialog":x,"aria-expanded":"false",...x==="listbox"&&{role:"combobox"},...x==="menu"&&T&&{role:"menuitem"},...p==="select"&&{"aria-autocomplete":"none"},...p==="combobox"&&{"aria-autocomplete":"list"}},[x,T,p]),A=b.useMemo(()=>x==="tooltip"||p==="label"?{[`aria-${p==="label"?"labelledby":"describedby"}`]:r?v:void 0}:{...N,"aria-expanded":r?"true":"false","aria-controls":r?v:void 0,...x==="menu"&&{id:g}},[x,v,r,g,p,N]),C=b.useMemo(()=>{const S={id:v,...x&&{role:x}};return x==="tooltip"||p==="label"?S:{...S,...x==="menu"&&{"aria-labelledby":g}}},[x,v,g,p]),j=b.useCallback(({active:S,selected:_})=>{const R={role:"option",...S&&{id:`${v}-fui-option`}};switch(p){case"select":case"combobox":return{...R,"aria-selected":_}}return{}},[v,p]);return b.useMemo(()=>f?{reference:A,floating:C,item:j,trigger:N}:{},[f,A,C,N,j])}function pD(e,t){const s="rootStore"in e?e.rootStore:e,r=s.useState("open"),i=s.context.dataRef,{listRef:l,activeIndex:c,onMatch:f,onTypingChange:p,enabled:h=!0,findMatch:g=null,resetMs:v=750,ignoreKeys:x=cE,selectedIndex:w=null}=t,T=Ns(),N=b.useRef(""),A=b.useRef(w??c??-1),C=b.useRef(null);Le(()=>{r&&(T.clear(),C.current=null,N.current="")},[r,T]),Le(()=>{r&&N.current===""&&(A.current=w??c??-1)},[r,w,c]);const j=Ue(M=>{M?i.current.typing||(i.current.typing=M,p?.(M)):i.current.typing&&(i.current.typing=M,p?.(M))}),S=Ue(M=>{function O(L,Y,ie){const ee=g?g(Y,ie):Y.find(z=>z?.toLocaleLowerCase().indexOf(ie.toLocaleLowerCase())===0);return ee?L.indexOf(ee):-1}const I=l.current;if(N.current.length>0&&N.current[0]!==" "&&(O(I,I,N.current)===-1?j(!1):M.key===" "&&cn(M)),I==null||x.includes(M.key)||M.key.length!==1||M.ctrlKey||M.metaKey||M.altKey)return;r&&M.key!==" "&&(cn(M),j(!0)),I.every(L=>L?L[0]?.toLocaleLowerCase()!==L[1]?.toLocaleLowerCase():!0)&&N.current===M.key&&(N.current="",A.current=C.current),N.current+=M.key,T.start(v,()=>{N.current="",A.current=C.current,j(!1)});const F=A.current,$=O(I,[...I.slice((F||0)+1),...I.slice(0,(F||0)+1)],N.current);$!==-1?(f?.($),C.current=$):M.key!==" "&&(N.current="",j(!1))}),_=b.useMemo(()=>({onKeyDown:S}),[S]),R=b.useMemo(()=>({onKeyDown:S,onKeyUp(M){M.key===" "&&j(!1)}}),[S,j]);return b.useMemo(()=>h?{reference:_,floating:R}:{},[h,_,R])}const mD=b.createContext(void 0);function gD(e){return b.useContext(mD)}const sN="ArrowUp",rN="ArrowDown",aN="ArrowLeft",iN="ArrowRight",oN="Home",lN="End",yD=new Set([aN,iN]),vD=new Set([sN,rN]),bD=new Set([...yD,...vD]);[...bD];const xD=new Set([sN,rN,aN,iN,oN,lN]);function wD(e){return e==="starting"?M_:zn}const SD={...uE,...V_},ED=b.forwardRef(function(t,s){const{render:r,className:i,finalFocus:l,...c}=t,{store:f}=io(),{side:p,align:h}=sE(),g=gD()!=null,v=f.useState("open"),x=f.useState("transitionStatus"),w=f.useState("popupProps"),T=f.useState("mounted"),N=f.useState("instantType"),A=f.useState("activeTriggerElement"),C=f.useState("parent"),j=f.useState("lastOpenChangeReason"),S=f.useState("rootId"),_=f.useState("floatingRootContext"),R=f.useState("floatingTreeRoot"),M=f.useState("closeDelay"),O=f.useState("activeTriggerElement");yE({open:v,ref:f.context.popupRef,onComplete(){v&&f.context.onOpenChangeComplete?.(!0)}}),b.useEffect(()=>{function Y(ie){f.setOpen(!1,Ht(ie.reason,ie.domEvent))}return R.events.on("close",Y),()=>{R.events.off("close",Y)}},[R.events,f]);const I=f.useState("hoverEnabled"),H=f.useState("disabled");aD(_,{enabled:I&&!H&&C.type!=="context-menu"&&C.type!=="menubar",closeDelay:M});const F=b.useMemo(()=>({transitionStatus:x,side:p,align:h,open:v,nested:C.type==="menu",instant:N}),[x,p,h,v,C.type,N]),$=na("div",t,{state:F,ref:[s,f.context.popupRef],stateAttributesMapping:SD,props:[w,{onKeyDown(Y){g&&xD.has(Y.key)&&Y.stopPropagation()}},wD(x),c,{"data-rootownerid":S}]});let L=C.type===void 0||C.type==="context-menu";return(A||C.type==="menubar"&&j!==gg)&&(L=!0),d.jsx(_M,{context:_,modal:!1,disabled:!T,returnFocus:l===void 0?L:l,initialFocus:C.type!=="menu",restoreFocus:!0,externalTree:C.type!=="menubar"?R:void 0,previousFocusableElement:O,nextFocusableElement:C.type===void 0?f.context.triggerFocusTargetRef:void 0,beforeContentFocusGuardRef:C.type===void 0?f.context.beforeContentFocusGuardRef:void 0,children:$})}),cN=b.createContext(void 0);function ND(){const e=b.useContext(cN);if(e===void 0)throw new Error(qa(32));return e}const TD=b.forwardRef(function(t,s){const{keepMounted:r=!1,...i}=t,{store:l}=io();return l.useState("mounted")||r?d.jsx(cN.Provider,{value:r,children:d.jsx(TM,{ref:s,...i})}):null});function jD(e){return pg(19)?e:e?"true":void 0}const CD=b.createContext(void 0);function uN(){return b.useContext(CD)?.direction??"ltr"}const RD=e=>({name:"arrow",options:e,async fn(t){const{x:s,y:r,placement:i,rects:l,platform:c,elements:f,middlewareData:p}=t,{element:h,padding:g=0,offsetParent:v="real"}=fr(e,t)||{};if(h==null)return{};const x=jE(g),w={x:s,y:r},T=Eg(i),N=Sg(T),A=await c.getDimensions(h),C=T==="y",j=C?"top":"left",S=C?"bottom":"right",_=C?"clientHeight":"clientWidth",R=l.reference[N]+l.reference[T]-w[T]-l.floating[N],M=w[T]-l.reference[T],O=v==="real"?await c.getOffsetParent?.(h):f.floating;let I=f.floating[_]||l.floating[N];(!I||!await c.isElement?.(O))&&(I=f.floating[_]||l.floating[N]);const H=R/2-M/2,F=I/2-A[N]/2-1,$=Math.min(x[j],F),L=Math.min(x[S],F),Y=$,ie=I-A[N]-L,ee=I/2-A[N]/2+H,z=ym(Y,ee,ie),Z=!p.arrow&&ra(i)!=null&&ee!==z&&l.reference[N]/2-(ee<Y?$:L)-A[N]/2<0,B=Z?ee<Y?ee-Y:ee-ie:0;return{[T]:w[T]+B,data:{[T]:z,centerOffset:ee-z-B,...Z&&{alignmentOffset:B}},reset:Z}}}),AD=(e,t)=>({...RD(e),options:[e,t]}),_D={name:"hide",async fn(e){const{width:t,height:s,x:r,y:i}=e.rects.reference,l=t===0&&s===0&&r===0&&i===0;return{data:{referenceHidden:(await yO().fn(e)).data?.referenceHidden||l}}}},kD={sideX:"left",sideY:"top"};function dN(e,t,s){const r=e==="inline-start"||e==="inline-end";return{top:"top",right:r?s?"inline-start":"inline-end":"right",bottom:"bottom",left:r?s?"inline-end":"inline-start":"left"}[t]}function rw(e,t,s){const{rects:r,placement:i}=e;return{side:dN(t,qn(i),s),align:ra(i)||"center",anchor:{width:r.reference.width,height:r.reference.height},positioner:{width:r.floating.width,height:r.floating.height}}}function MD(e){const{anchor:t,positionMethod:s="absolute",side:r="bottom",sideOffset:i=0,align:l="center",alignOffset:c=0,collisionBoundary:f,collisionPadding:p=5,sticky:h=!1,arrowPadding:g=5,disableAnchorTracking:v=!1,keepMounted:x=!1,floatingRootContext:w,mounted:T,collisionAvoidance:N,shiftCrossAxis:A=!1,nodeId:C,adaptiveOrigin:j,lazyFlip:S=!1,externalTree:_}=e,[R,M]=b.useState(null);!T&&R!==null&&M(null);const O=N.side||"flip",I=N.align||"flip",H=N.fallbackAxisSide||"end",F=typeof t=="function"?t:void 0,$=Ue(F),L=F?$:t,Y=On(t),ee=uN()==="rtl",z=R||{top:"top",right:"right",bottom:"bottom",left:"left","inline-end":ee?"left":"right","inline-start":ee?"right":"left"}[r],Z=l==="center"?z:`${z}-${l}`;let B=p;const re=1,J=r==="bottom"?re:0,D=r==="top"?re:0,U=r==="right"?re:0,W=r==="left"?re:0;typeof B=="number"?B={top:B+J,right:B+W,bottom:B+D,left:B+U}:B&&(B={top:(B.top||0)+J,right:(B.right||0)+W,bottom:(B.bottom||0)+D,left:(B.left||0)+U});const se={boundary:f==="clipping-ancestors"?"clippingAncestors":f,padding:B},te=b.useRef(null),me=On(i),he=On(c),Re=[fO(gt=>{const zt=rw(gt,r,ee),mn=typeof me.current=="function"?me.current(zt):me.current,Yt=typeof he.current=="function"?he.current(zt):he.current;return{mainAxis:mn,crossAxis:Yt,alignmentAxis:Yt}},[typeof i!="function"?i:0,typeof c!="function"?c:0,ee,r])],fe=I==="none"&&O!=="shift",ke=!fe&&(h||A||O==="shift"),Te=O==="none"?null:mO({...se,padding:{top:B.top+re,right:B.right+re,bottom:B.bottom+re,left:B.left+re},mainAxis:!A&&O==="flip",crossAxis:I==="flip"?"alignment":!1,fallbackAxisSideDirection:H}),He=fe?null:hO(gt=>{const zt=Va(gt.elements.floating).documentElement;return{...se,rootBoundary:A?{x:0,y:0,width:zt.clientWidth,height:zt.clientHeight}:void 0,mainAxis:I!=="none",crossAxis:ke,limiter:h||A?void 0:pO(mn=>{if(!te.current)return{};const{width:Yt,height:Tn}=te.current.getBoundingClientRect(),en=ls(qn(mn.placement)),gn=en==="y"?Yt:Tn,pr=en==="y"?B.left+B.right:B.top+B.bottom;return{offset:gn/2+pr/2}})}},[se,h,A,B,I]);O==="shift"||I==="shift"||l==="center"?Re.push(He,Te):Re.push(Te,He),Re.push(gO({...se,apply({elements:{floating:gt},rects:{reference:zt},availableWidth:mn,availableHeight:Yt}){Object.entries({"--available-width":`${mn}px`,"--available-height":`${Yt}px`,"--anchor-width":`${zt.width}px`,"--anchor-height":`${zt.height}px`}).forEach(([Tn,en])=>{gt.style.setProperty(Tn,en)})}}),AD(()=>({element:te.current||document.createElement("div"),padding:g,offsetParent:"floating"}),[g]),{name:"transformOrigin",fn(gt){const{elements:zt,middlewareData:mn,placement:Yt,rects:Tn,y:en}=gt,gn=qn(Yt),pr=ls(gn),mr=te.current,Qd=mn.arrow?.x||0,tc=mn.arrow?.y||0,go=mr?.clientWidth||0,ua=mr?.clientHeight||0,yo=Qd+go/2,vo=tc+ua/2,nc=Math.abs(mn.shift?.y||0),sc=Tn.reference.height/2,Hs=typeof i=="function"?i(rw(gt,r,ee)):i,bo=nc>Hs,rc={top:`${yo}px calc(100% + ${Hs}px)`,bottom:`${yo}px ${-Hs}px`,left:`calc(100% + ${Hs}px) ${vo}px`,right:`${-Hs}px ${vo}px`}[gn],ac=`${yo}px ${Tn.reference.y+sc-en}px`;return zt.floating.style.setProperty("--transform-origin",ke&&pr==="y"&&bo?ac:rc),{}}},_D,j),Le(()=>{!T&&w&&w.update({referenceElement:null,floatingElement:null,domReferenceElement:null})},[T,w]);const ae=b.useMemo(()=>({elementResize:!v&&typeof ResizeObserver<"u",layoutShift:!v&&typeof IntersectionObserver<"u"}),[v]),{refs:G,elements:oe,x:ve,y:we,middlewareData:Ce,update:ge,placement:Oe,context:ye,isPositioned:Se,floatingStyles:Ee}=QO({rootContext:w,placement:Z,middleware:Re,strategy:s,whileElementsMounted:x?void 0:(...gt)=>Gx(...gt,ae),nodeId:C,externalTree:_}),{sideX:We,sideY:ot}=Ce.adaptiveOrigin||kD,Fe=Se?s:"fixed",qt=b.useMemo(()=>j?{position:Fe,[We]:ve,[ot]:we}:{position:Fe,...Ee},[j,Fe,We,ve,ot,we,Ee]),Kt=b.useRef(null);Le(()=>{if(!T)return;const gt=Y.current,zt=typeof gt=="function"?gt():gt,Yt=(aw(zt)?zt.current:zt)||null||null;Yt!==Kt.current&&(G.setPositionReference(Yt),Kt.current=Yt)},[T,G,L,Y]),b.useEffect(()=>{if(!T)return;const gt=Y.current;typeof gt!="function"&&aw(gt)&&gt.current!==Kt.current&&(G.setPositionReference(gt.current),Kt.current=gt.current)},[T,G,L,Y]),b.useEffect(()=>{if(x&&T&&oe.domReference&&oe.floating)return Gx(oe.domReference,oe.floating,ge,ae)},[x,T,oe,ge,ae]);const Nn=qn(Oe),pn=dN(r,Nn,ee),Qt=ra(Oe)||"center",De=!!Ce.hide?.referenceHidden;Le(()=>{S&&T&&Se&&M(Nn)},[S,T,Se,Nn]);const et=b.useMemo(()=>({position:"absolute",top:Ce.arrow?.y,left:Ce.arrow?.x}),[Ce.arrow]),nt=Ce.arrow?.centerOffset!==0;return b.useMemo(()=>({positionerStyles:qt,arrowStyles:et,arrowRef:te,arrowUncentered:nt,side:pn,align:Qt,physicalSide:Nn,anchorHidden:De,refs:G,context:ye,isPositioned:Se,update:ge}),[qt,et,te,nt,pn,Qt,Nn,De,G,ye,Se,ge])}function aw(e){return e!=null&&"current"in e}function OD(e){const{children:t,elementsRef:s,labelsRef:r,onMapChange:i}=e,l=Ue(i),c=b.useRef(0),f=ds(zD).current,p=ds(DD).current,[h,g]=b.useState(0),v=b.useRef(h),x=Ue((C,j)=>{p.set(C,j??null),v.current+=1,g(v.current)}),w=Ue(C=>{p.delete(C),v.current+=1,g(v.current)}),T=b.useMemo(()=>{const C=new Map;return Array.from(p.keys()).filter(S=>S.isConnected).sort(ID).forEach((S,_)=>{const R=p.get(S)??{};C.set(S,{...R,index:_})}),C},[p,h]);Le(()=>{if(typeof MutationObserver!="function"||T.size===0)return;const C=new MutationObserver(j=>{const S=new Set,_=R=>S.has(R)?S.delete(R):S.add(R);j.forEach(R=>{R.removedNodes.forEach(_),R.addedNodes.forEach(_)}),S.size===0&&(v.current+=1,g(v.current))});return T.forEach((j,S)=>{S.parentElement&&C.observe(S.parentElement,{childList:!0})}),()=>{C.disconnect()}},[T]),Le(()=>{v.current===h&&(s.current.length!==T.size&&(s.current.length=T.size),r&&r.current.length!==T.size&&(r.current.length=T.size),c.current=T.size),l(T)},[l,T,s,r,h]),Le(()=>()=>{s.current=[]},[s]),Le(()=>()=>{r&&(r.current=[])},[r]);const N=Ue(C=>(f.add(C),()=>{f.delete(C)}));Le(()=>{f.forEach(C=>C(T))},[f,T]);const A=b.useMemo(()=>({register:x,unregister:w,subscribeMapChange:N,elementsRef:s,labelsRef:r,nextIndexRef:c}),[x,w,N,s,r,c]);return d.jsx(pE.Provider,{value:A,children:t})}function DD(){return new Map}function zD(){return new Set}function ID(e,t){const s=e.compareDocumentPosition(t);return s&Node.DOCUMENT_POSITION_FOLLOWING||s&Node.DOCUMENT_POSITION_CONTAINED_BY?-1:s&Node.DOCUMENT_POSITION_PRECEDING||s&Node.DOCUMENT_POSITION_CONTAINS?1:0}const LD=b.forwardRef(function(t,s){const{cutout:r,...i}=t;let l;if(r){const c=r?.getBoundingClientRect();l=`polygon(
10
- 0% 0%,
11
- 100% 0%,
12
- 100% 100%,
13
- 0% 100%,
14
- 0% 0%,
15
- ${c.left}px ${c.top}px,
16
- ${c.left}px ${c.bottom}px,
17
- ${c.right}px ${c.bottom}px,
18
- ${c.right}px ${c.top}px,
19
- ${c.left}px ${c.top}px
20
- )`}return d.jsx("div",{ref:s,role:"presentation","data-base-ui-inert":"",...i,style:{position:"fixed",inset:0,userSelect:"none",WebkitUserSelect:"none",clipPath:l}})}),PD=b.forwardRef(function(t,s){const{anchor:r,positionMethod:i="absolute",className:l,render:c,side:f,align:p,sideOffset:h=0,alignOffset:g=0,collisionBoundary:v="clipping-ancestors",collisionPadding:x=5,arrowPadding:w=5,sticky:T=!1,disableAnchorTracking:N=!1,collisionAvoidance:A=D_,...C}=t,{store:j}=io(),S=ND(),_=Od(!0),R=j.useState("parent"),M=j.useState("floatingRootContext"),O=j.useState("floatingTreeRoot"),I=j.useState("mounted"),H=j.useState("open"),F=j.useState("modal"),$=j.useState("activeTriggerElement"),L=j.useState("lastOpenChangeReason"),Y=j.useState("floatingNodeId"),ie=j.useState("floatingParentNodeId");let ee=r,z=h,Z=g,B=p;R.type==="context-menu"&&(ee=r??R.context?.anchor,B=B??"start",!f&&B!=="center"&&(Z=t.alignOffset??2,z=t.sideOffset??-5));let re=f,J=B;R.type==="menu"?(re=re??"inline-end",J=J??"start"):R.type==="menubar"&&(re=re??"bottom",J=J??"start");const D=R.type==="context-menu",U=MD({anchor:ee,floatingRootContext:M,positionMethod:_?"fixed":i,mounted:I,side:re,sideOffset:z,align:J,alignOffset:Z,arrowPadding:D?0:w,collisionBoundary:v,collisionPadding:x,sticky:T,nodeId:Y,keepMounted:S,disableAnchorTracking:N,collisionAvoidance:A,shiftCrossAxis:D,externalTree:O}),W=b.useMemo(()=>{const xe={};return H||(xe.pointerEvents="none"),{role:"presentation",hidden:!I,style:{...U.positionerStyles,...xe}}},[H,I,U.positionerStyles]);b.useEffect(()=>{function xe(Re){Re.open?(Re.parentNodeId===Y&&j.set("hoverEnabled",!1),Re.nodeId!==Y&&Re.parentNodeId===j.select("floatingParentNodeId")&&j.setOpen(!1,Ht(ml))):Re.parentNodeId===Y&&Re.reason!==ml&&j.set("hoverEnabled",!0)}return O.events.on("menuopenchange",xe),()=>{O.events.off("menuopenchange",xe)}},[j,O.events,Y]),b.useEffect(()=>{if(j.select("floatingParentNodeId")==null)return;function xe(Re){if(Re.open||Re.nodeId!==j.select("floatingParentNodeId"))return;const fe=Re.reason??ml;j.setOpen(!1,Ht(fe))}return O.events.on("menuopenchange",xe),()=>{O.events.off("menuopenchange",xe)}},[O.events,j]),b.useEffect(()=>{function xe(Re){!H||Re.nodeId!==j.select("floatingParentNodeId")||Re.target&&$&&$!==Re.target&&j.setOpen(!1,Ht(ml))}return O.events.on("itemhover",xe),()=>{O.events.off("itemhover",xe)}},[O.events,H,$,j]),b.useEffect(()=>{const xe={open:H,nodeId:Y,parentNodeId:ie,reason:j.select("lastOpenChangeReason")};O.events.emit("menuopenchange",xe)},[O.events,H,j,Y,ie]);const se=b.useMemo(()=>({open:H,side:U.side,align:U.align,anchorHidden:U.anchorHidden,nested:R.type==="menu"}),[H,U.side,U.align,U.anchorHidden,R.type]),te=b.useMemo(()=>({side:U.side,align:U.align,arrowRef:U.arrowRef,arrowUncentered:U.arrowUncentered,arrowStyles:U.arrowStyles,nodeId:U.context.nodeId}),[U.side,U.align,U.arrowRef,U.arrowUncentered,U.arrowStyles,U.context.nodeId]),me=na("div",t,{state:se,stateAttributesMapping:uE,ref:[s,j.useStateSetter("positionerElement")],props:[W,C]}),he=I&&R.type!=="menu"&&(R.type!=="menubar"&&F&&L!==La||R.type==="menubar"&&R.context.modal);let pe=null;return R.type==="menubar"?pe=R.context.contentElement:R.type===void 0&&(pe=$),d.jsxs(nE.Provider,{value:te,children:[he&&d.jsx(LD,{ref:R.type==="context-menu"||R.type==="nested-context-menu"?R.context.internalBackdropRef:null,inert:jD(!H),cutout:pe}),d.jsx(vM,{id:Y,children:d.jsx(OD,{elementsRef:j.context.itemDomElements,labelsRef:j.context.itemLabels,children:me})})]})});let iw={},ow={},lw="";function UD(e){if(typeof document>"u")return!1;const t=Va(e);return un(t).innerWidth-t.documentElement.clientWidth>0}function $D(e){const t=Va(e),s=t.documentElement,r=t.body,i=Ya(s)?s:r,l=i.style.overflow;return i.style.overflow="hidden",()=>{i.style.overflow=l}}function VD(e){const t=Va(e),s=t.documentElement,r=t.body,i=un(s);let l=0,c=0;const f=zs.create(),p=typeof CSS<"u"&&CSS.supports?.("scrollbar-gutter","stable");if(Rk&&(i.visualViewport?.scale??1)!==1)return()=>{};function h(){const x=i.getComputedStyle(s),w=i.getComputedStyle(r),A=(x.scrollbarGutter||"").includes("both-edges")?"stable both-edges":"stable";l=s.scrollTop,c=s.scrollLeft,iw={scrollbarGutter:s.style.scrollbarGutter,overflowY:s.style.overflowY,overflowX:s.style.overflowX},lw=s.style.scrollBehavior,ow={position:r.style.position,height:r.style.height,width:r.style.width,boxSizing:r.style.boxSizing,overflowY:r.style.overflowY,overflowX:r.style.overflowX,scrollBehavior:r.style.scrollBehavior};const C=s.scrollHeight>s.clientHeight,j=s.scrollWidth>s.clientWidth,S=x.overflowY==="scroll"||w.overflowY==="scroll",_=x.overflowX==="scroll"||w.overflowX==="scroll",R=Math.max(0,i.innerWidth-s.clientWidth),M=Math.max(0,i.innerHeight-s.clientHeight),O=parseFloat(w.marginTop)+parseFloat(w.marginBottom),I=parseFloat(w.marginLeft)+parseFloat(w.marginRight),H=Ya(s)?s:r;if(p){s.style.scrollbarGutter=A,H.style.overflowY="hidden",H.style.overflowX="hidden";return}Object.assign(s.style,{scrollbarGutter:A,overflowY:"hidden",overflowX:"hidden"}),(C||S)&&(s.style.overflowY="scroll"),(j||_)&&(s.style.overflowX="scroll"),Object.assign(r.style,{position:"relative",height:O||M?`calc(100dvh - ${O+M}px)`:"100dvh",width:I||R?`calc(100vw - ${I+R}px)`:"100vw",boxSizing:"border-box",overflow:"hidden",scrollBehavior:"unset"}),r.scrollTop=l,r.scrollLeft=c,s.setAttribute("data-base-ui-scroll-locked",""),s.style.scrollBehavior="unset"}function g(){Object.assign(s.style,iw),Object.assign(r.style,ow),p||(s.scrollTop=l,s.scrollLeft=c,s.removeAttribute("data-base-ui-scroll-locked"),s.style.scrollBehavior=lw)}function v(){g(),f.request(h)}return h(),i.addEventListener("resize",v),()=>{f.cancel(),g(),typeof i.removeEventListener=="function"&&i.removeEventListener("resize",v)}}class BD{lockCount=0;restore=null;timeoutLock=Ji.create();timeoutUnlock=Ji.create();acquire(t){return this.lockCount+=1,this.lockCount===1&&this.restore===null&&this.timeoutLock.start(0,()=>this.lock(t)),this.release}release=()=>{this.lockCount-=1,this.lockCount===0&&this.restore&&this.timeoutUnlock.start(0,this.unlock)};unlock=()=>{this.lockCount===0&&this.restore&&(this.restore?.(),this.restore=null)};lock(t){if(this.lockCount===0||this.restore!==null)return;const r=Va(t).documentElement,i=un(r).getComputedStyle(r).overflowY;if(i==="hidden"||i==="clip"){this.restore=lE;return}const l=Ak||!UD(t);this.restore=l?$D(t):VD(t)}}const ZD=new BD;function HD(e=!0,t=null){Le(()=>{if(e)return ZD.acquire(t)},[e,t])}const FD=b.createContext(null);function qD(e){return b.useContext(FD)}function YD(e){const t=b.useRef(""),s=b.useCallback(i=>{i.defaultPrevented||(t.current=i.pointerType,e(i,i.pointerType))},[e]);return{onClick:b.useCallback(i=>{if(i.detail===0){e(i,"keyboard");return}"pointerType"in i&&e(i,i.pointerType),e(i,t.current),t.current=""},[e]),onPointerDown:s}}function GD(e){const[t,s]=b.useState(null),r=Ue((f,p)=>{e||s(p)}),i=b.useCallback(()=>{s(null)},[]),{onClick:l,onPointerDown:c}=YD(r);return b.useMemo(()=>({openMethod:t,reset:i,triggerProps:{onClick:l,onPointerDown:c}}),[t,i,l,c])}const XD={...WO,disabled:Ze(e=>e.parent.type==="menubar"&&e.parent.context.disabled||e.disabled),modal:Ze(e=>(e.parent.type===void 0||e.parent.type==="context-menu")&&(e.modal??!0)),allowMouseEnter:Ze(e=>e.parent.type==="menu"?e.parent.store.select("allowMouseEnter"):e.allowMouseEnter),stickIfOpen:Ze(e=>e.stickIfOpen),parent:Ze(e=>e.parent),rootId:Ze(e=>e.parent.type==="menu"?e.parent.store.select("rootId"):e.parent.type!==void 0?e.parent.context.rootId:e.rootId),activeIndex:Ze(e=>e.activeIndex),isActive:Ze((e,t)=>e.activeIndex===t),hoverEnabled:Ze(e=>e.hoverEnabled),instantType:Ze(e=>e.instantType),lastOpenChangeReason:Ze(e=>e.openChangeReason),floatingTreeRoot:Ze(e=>e.parent.type==="menu"?e.parent.store.select("floatingTreeRoot"):e.floatingTreeRoot),floatingNodeId:Ze(e=>e.floatingNodeId),floatingParentNodeId:Ze(e=>e.floatingParentNodeId),itemProps:Ze(e=>e.itemProps),closeDelay:Ze(e=>e.closeDelay),keyboardEventRelay:Ze(e=>{if(e.keyboardEventRelay)return e.keyboardEventRelay;if(e.parent.type==="menu")return e.parent.store.select("keyboardEventRelay")})};class Rg extends nN{constructor(t){super({...KD(),...t},{positionerRef:b.createRef(),popupRef:b.createRef(),typingRef:{current:!1},itemDomElements:{current:[]},itemLabels:{current:[]},allowMouseUpTriggerRef:{current:!1},triggerFocusTargetRef:b.createRef(),beforeContentFocusGuardRef:b.createRef(),onOpenChangeComplete:void 0,triggerElements:new Cg},XD),this.observe(Ze(s=>s.allowMouseEnter),(s,r)=>{this.state.parent.type==="menu"&&s!==r&&this.state.parent.store.set("allowMouseEnter",s)}),this.unsubscribeParentListener=this.observe("parent",s=>{if(this.unsubscribeParentListener?.(),s.type==="menu"){this.unsubscribeParentListener=s.store.subscribe(()=>{this.notifyAll()}),this.context.allowMouseUpTriggerRef=s.store.context.allowMouseUpTriggerRef;return}s.type!==void 0&&(this.context.allowMouseUpTriggerRef=s.context.allowMouseUpTriggerRef),this.unsubscribeParentListener=null})}setOpen(t,s){this.state.floatingRootContext.context.events.emit("setOpen",{open:t,eventDetails:s})}static useStore(t,s){return ds(()=>t??new Rg(s)).current}unsubscribeParentListener=null}function KD(){return{...KO(),disabled:!1,modal:!0,allowMouseEnter:!0,stickIfOpen:!0,parent:{type:void 0},rootId:void 0,activeIndex:null,hoverEnabled:!0,instantType:void 0,openChangeReason:null,floatingTreeRoot:new PE,floatingNodeId:void 0,floatingParentNodeId:null,itemProps:zn,keyboardEventRelay:void 0,closeDelay:0}}const WD=b.createContext(void 0);function JD(){return b.useContext(WD)}function QD(e){const{children:t,open:s,onOpenChange:r,onOpenChangeComplete:i,defaultOpen:l=!1,disabled:c=!1,modal:f,loopFocus:p=!0,orientation:h="vertical",actionsRef:g,closeParentOnEsc:v=!0,handle:x,triggerId:w,defaultTriggerId:T=null,highlightItemOnHover:N=!0}=e,A=Od(!0),C=io(!0),j=qD(),S=JD(),_=b.useMemo(()=>S&&C?{type:"menu",store:C.store}:j?{type:"menubar",context:j}:A&&!C?{type:"context-menu",context:A}:{type:void 0},[A,C,j,S]),R=Rg.useStore(x?.store,{parent:_}),M=R.useState("floatingTreeRoot"),O=yM(M),I=aa();Le(()=>{A&&!C?R.update({parent:{type:"context-menu",context:A},floatingNodeId:O,floatingParentNodeId:I}):C&&R.update({floatingNodeId:O,floatingParentNodeId:I})},[A,C,O,I,R]),R.useControlledProp("open",s,l),R.useControlledProp("activeTriggerId",w,T),R.useContextCallback("onOpenChangeComplete",i);const H=R.useState("open"),F=R.useState("activeTriggerElement"),$=R.useState("positionerElement"),L=R.useState("hoverEnabled"),Y=R.useState("modal"),ie=R.useState("disabled"),ee=R.useState("lastOpenChangeReason"),z=R.useState("parent"),Z=R.useState("activeIndex"),B=R.useState("payload"),re=R.useState("floatingParentNodeId"),J=b.useRef(null),D=re!=null;let U;R.useSyncedValues({disabled:c,modal:z.type===void 0?f:void 0,rootId:ta()});const{openMethod:W,triggerProps:se,reset:te}=GD(H);YO(R);const{forceUnmount:me}=GO(H,R,()=>{R.update({allowMouseEnter:!1,stickIfOpen:!0}),te()}),he=b.useRef(z.type!=="context-menu"),pe=Ns();b.useEffect(()=>{if(H||(J.current=null),z.type==="context-menu"){if(!H){pe.clear(),he.current=!1;return}pe.start(500,()=>{he.current=!0})}},[pe,H,z.type]),HD(H&&Y&&ee!==La&&W!=="touch",$),Le(()=>{!H&&!L&&R.set("hoverEnabled",!0)},[H,L,R]);const xe=b.useRef(!0),Re=Ns(),fe=Ue((De,et)=>{const nt=et.reason;if(H===De&&et.trigger===F||(et.preventUnmountOnClose=()=>{R.set("preventUnmountingOnClose",!0)},!De&&et.trigger==null&&(et.trigger=F??void 0),r?.(De,et),et.isCanceled))return;const gt={open:De,nativeEvent:et.event,reason:et.reason,nested:D};U?.emit("openchange",gt);const zt=et.event;if(De===!1&&zt?.type==="click"&&zt.pointerType==="touch"&&!xe.current)return;if(!De&&Z!==null){const en=R.context.itemDomElements.current[Z];queueMicrotask(()=>{en?.setAttribute("tabindex","-1")})}De&&nt===kx?(xe.current=!1,Re.start(300,()=>{xe.current=!0})):(xe.current=!0,Re.clear());const mn=(nt===ad||nt===dE)&&zt.detail===0&&zt?.isTrusted,Yt=!De&&(nt===fE||nt==null);function Tn(){const en={open:De,openChangeReason:nt};J.current=et.event??null;const gn=et.trigger?.id??null;(gn||De)&&(en.activeTriggerId=gn,en.activeTriggerElement=et.trigger??null),R.update(en)}nt===La?$a.flushSync(Tn):Tn(),z.type==="menubar"&&(nt===kx||nt===zd||nt===La||nt===Hu||nt===ml)?R.set("instantType","group"):mn||Yt?R.set("instantType",mn?"click":"dismiss"):R.set("instantType",void 0)}),ke=b.useCallback(De=>{const et=Ht(De);return et.preventUnmountOnClose=()=>{R.set("preventUnmountingOnClose",!0)},et},[R]),Te=b.useCallback(()=>{R.setOpen(!1,ke(X_))},[R,ke]);b.useImperativeHandle(g,()=>({unmount:me,close:Te}),[me,Te]);let He;z.type==="context-menu"&&(He=z.context),b.useImperativeHandle(He?.positionerRef,()=>$,[$]),b.useImperativeHandle(He?.actionsRef,()=>({setOpen:fe}),[fe]);const ae=eD({popupStore:R,onOpenChange:fe});U=ae.context.events,b.useEffect(()=>{const De=({open:et,eventDetails:nt})=>fe(et,nt);return U.on("setOpen",De),()=>{U?.off("setOpen",De)}},[U,fe]);const G=xO(ae,{enabled:!ie,bubbles:v&&z.type==="menu",outsidePress(){return z.type!=="context-menu"||J.current?.type==="contextmenu"?!0:he.current},externalTree:D?M:void 0}),oe=hD(ae,{role:"menu"}),ve=uN(),we=b.useCallback(De=>{R.select("activeIndex")!==De&&R.set("activeIndex",De)},[R]),Ce=dD(ae,{enabled:!ie,listRef:R.context.itemDomElements,activeIndex:Z,nested:z.type!==void 0,loopFocus:p,orientation:h,parentOrientation:z.type==="menubar"?z.context.orientation:void 0,rtl:ve==="rtl",disabledIndices:cE,onNavigate:we,openOnArrowKeyDown:z.type!=="context-menu",externalTree:D?M:void 0,focusItemOnHover:N}),ge=b.useCallback(De=>{R.context.typingRef.current=De},[R]),Oe=pD(ae,{listRef:R.context.itemLabels,activeIndex:Z,resetMs:k_,onMatch:De=>{H&&De!==Z&&R.set("activeIndex",De)},onTypingChange:ge}),{getReferenceProps:ye,getFloatingProps:Se,getItemProps:Ee,getTriggerProps:We}=oD([G,oe,Ce,Oe]),ot=b.useMemo(()=>{const De=Dd(ye(),{onMouseEnter(){R.set("hoverEnabled",!0)},onMouseMove(){R.set("allowMouseEnter",!0)}},se);return delete De.role,De},[ye,R,se]),Fe=b.useMemo(()=>{const De=We();if(!De)return De;const{role:et,["aria-controls"]:nt,...gt}=De;return gt},[We]),qt=bg(),Kt=b.useMemo(()=>Se({onMouseEnter(){z.type==="menu"&&qt.request(()=>R.set("hoverEnabled",!1))},onMouseMove(){R.set("allowMouseEnter",!0)},onClick(){R.select("hoverEnabled")&&R.set("hoverEnabled",!1)},onKeyDown(De){const et=R.select("keyboardEventRelay");et&&!De.isPropagationStopped()&&et(De)}}),[Se,z.type,qt,R]),Nn=b.useMemo(()=>Ee(),[Ee]);R.useSyncedValues({floatingRootContext:ae,activeTriggerProps:ot,inactiveTriggerProps:Fe,popupProps:Kt,itemProps:Nn});const pn=b.useMemo(()=>({store:R,parent:_}),[R,_]),Qt=d.jsx(hg.Provider,{value:pn,children:typeof t=="function"?t({payload:B}):t});return z.type===void 0||z.type==="context-menu"?d.jsx(bM,{externalTree:M,children:Qt}):Qt}function fN(e){if(Pt(e)&&e.hasAttribute("data-rootownerid"))return e.getAttribute("data-rootownerid")??void 0;if(!Ls(e))return fN($s(e))}const ez=b.forwardRef(function(t,s){const{className:r,render:i,orientation:l="horizontal",...c}=t,f=b.useMemo(()=>({orientation:l}),[l]);return na("div",t,{state:f,ref:s,props:[{role:"separator","aria-orientation":l},c]})});function tz(e){const[t,s]=b.useState({getBoundingClientRect(){return DOMRect.fromRect({width:0,height:0,x:0,y:0})}}),r=b.useRef(null),i=b.useRef(null),l=b.useRef(null),c=b.useRef(null),f=b.useRef(!0),p=b.useRef(null),h=ta(),g=b.useMemo(()=>({anchor:t,setAnchor:s,actionsRef:l,backdropRef:r,internalBackdropRef:i,positionerRef:c,allowMouseUpTriggerRef:f,initialCursorPointRef:p,rootId:h}),[t,h]);return d.jsx(tE.Provider,{value:g,children:d.jsx(hg.Provider,{value:void 0,children:d.jsx(QD,{...e})})})}const cw=500,nz=b.forwardRef(function(t,s){const{render:r,className:i,...l}=t,{setAnchor:c,actionsRef:f,internalBackdropRef:p,backdropRef:h,positionerRef:g,allowMouseUpTriggerRef:v,initialCursorPointRef:x,rootId:w}=Od(!1),{store:T}=io(!1),N=T.useState("open"),A=b.useRef(null),C=b.useRef(null),j=Ns(),S=Ns(),_=b.useRef(!1);function R(L,Y,ie){const ee=ie.type.startsWith("touch");x.current={x:L,y:Y},c({getBoundingClientRect(){return DOMRect.fromRect({width:ee?10:0,height:ee?10:0,x:L,y:Y})}}),_.current=!1,f.current?.setOpen(!0,Ht(ad,ie)),S.start(cw,()=>{_.current=!0})}function M(L){v.current=!0,cn(L),R(L.clientX,L.clientY,L.nativeEvent),Va(A.current).addEventListener("mouseup",ie=>{if(v.current=!1,!_.current)return;S.clear(),_.current=!1;const ee=Dn(ie);Et(g.current,ee)||w&&ee&&fN(ee)===w||f.current?.setOpen(!1,Ht(G_,ie))},{once:!0})}function O(L){if(v.current=!1,L.touches.length===1){L.stopPropagation();const Y=L.touches[0];C.current={x:Y.clientX,y:Y.clientY},j.start(cw,()=>{C.current&&R(C.current.x,C.current.y,L.nativeEvent)})}}function I(L){if(j.isStarted()&&C.current&&L.touches.length===1){const Y=L.touches[0],ie=10,ee=Math.abs(Y.clientX-C.current.x),z=Math.abs(Y.clientY-C.current.y);(ee>ie||z>ie)&&j.clear()}}function H(){j.clear(),C.current=null}b.useEffect(()=>{function L(ie){const z=Dn(ie);(Et(A.current,z)||Et(p.current,z)||Et(h.current,z))&&ie.preventDefault()}const Y=Va(A.current);return Y.addEventListener("contextmenu",L),()=>{Y.removeEventListener("contextmenu",L)}},[h,p]);const F=b.useMemo(()=>({open:N}),[N]);return na("div",t,{state:F,ref:[A,s],props:[{onContextMenu:M,onTouchStart:O,onTouchMove:I,onTouchEnd:H,onTouchCancel:H,style:{WebkitTouchCallout:"none"}},l],stateAttributesMapping:q_})}),Ag=b.createContext({});function _g(e){const t=b.useRef(null);return t.current===null&&(t.current=e()),t.current}const hN=typeof window<"u",pN=hN?b.useLayoutEffect:b.useEffect,Zd=b.createContext(null);function kg(e,t){e.indexOf(t)===-1&&e.push(t)}function yd(e,t){const s=e.indexOf(t);s>-1&&e.splice(s,1)}const Vs=(e,t,s)=>s>t?t:s<e?e:s;let Mg=()=>{};const hr={},mN=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e);function gN(e){return typeof e=="object"&&e!==null}const yN=e=>/^0[^.\s]+$/u.test(e);function vN(e){let t;return()=>(t===void 0&&(t=e()),t)}const us=e=>e,sz=(e,t)=>s=>t(e(s)),Yl=(...e)=>e.reduce(sz),Ol=(e,t,s)=>{const r=t-e;return r===0?1:(s-e)/r};class Og{constructor(){this.subscriptions=[]}add(t){return kg(this.subscriptions,t),()=>yd(this.subscriptions,t)}notify(t,s,r){const i=this.subscriptions.length;if(i)if(i===1)this.subscriptions[0](t,s,r);else for(let l=0;l<i;l++){const c=this.subscriptions[l];c&&c(t,s,r)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const Ss=e=>e*1e3,cs=e=>e/1e3;function bN(e,t){return t?e*(1e3/t):0}const xN=(e,t,s)=>(((1-3*s+3*t)*e+(3*s-6*t))*e+3*t)*e,rz=1e-7,az=12;function iz(e,t,s,r,i){let l,c,f=0;do c=t+(s-t)/2,l=xN(c,r,i)-e,l>0?s=c:t=c;while(Math.abs(l)>rz&&++f<az);return c}function Gl(e,t,s,r){if(e===t&&s===r)return us;const i=l=>iz(l,0,1,e,s);return l=>l===0||l===1?l:xN(i(l),t,r)}const wN=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,SN=e=>t=>1-e(1-t),EN=Gl(.33,1.53,.69,.99),Dg=SN(EN),NN=wN(Dg),TN=e=>(e*=2)<1?.5*Dg(e):.5*(2-Math.pow(2,-10*(e-1))),zg=e=>1-Math.sin(Math.acos(e)),jN=SN(zg),CN=wN(zg),oz=Gl(.42,0,1,1),lz=Gl(0,0,.58,1),RN=Gl(.42,0,.58,1),cz=e=>Array.isArray(e)&&typeof e[0]!="number",AN=e=>Array.isArray(e)&&typeof e[0]=="number",uz={linear:us,easeIn:oz,easeInOut:RN,easeOut:lz,circIn:zg,circInOut:CN,circOut:jN,backIn:Dg,backInOut:NN,backOut:EN,anticipate:TN},dz=e=>typeof e=="string",uw=e=>{if(AN(e)){Mg(e.length===4);const[t,s,r,i]=e;return Gl(t,s,r,i)}else if(dz(e))return uz[e];return e},ju=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function fz(e,t){let s=new Set,r=new Set,i=!1,l=!1;const c=new WeakSet;let f={delta:0,timestamp:0,isProcessing:!1};function p(g){c.has(g)&&(h.schedule(g),e()),g(f)}const h={schedule:(g,v=!1,x=!1)=>{const T=x&&i?s:r;return v&&c.add(g),T.has(g)||T.add(g),g},cancel:g=>{r.delete(g),c.delete(g)},process:g=>{if(f=g,i){l=!0;return}i=!0,[s,r]=[r,s],s.forEach(p),s.clear(),i=!1,l&&(l=!1,h.process(g))}};return h}const hz=40;function _N(e,t){let s=!1,r=!0;const i={delta:0,timestamp:0,isProcessing:!1},l=()=>s=!0,c=ju.reduce((S,_)=>(S[_]=fz(l),S),{}),{setup:f,read:p,resolveKeyframes:h,preUpdate:g,update:v,preRender:x,render:w,postRender:T}=c,N=()=>{const S=hr.useManualTiming?i.timestamp:performance.now();s=!1,hr.useManualTiming||(i.delta=r?1e3/60:Math.max(Math.min(S-i.timestamp,hz),1)),i.timestamp=S,i.isProcessing=!0,f.process(i),p.process(i),h.process(i),g.process(i),v.process(i),x.process(i),w.process(i),T.process(i),i.isProcessing=!1,s&&t&&(r=!1,e(N))},A=()=>{s=!0,r=!0,i.isProcessing||e(N)};return{schedule:ju.reduce((S,_)=>{const R=c[_];return S[_]=(M,O=!1,I=!1)=>(s||A(),R.schedule(M,O,I)),S},{}),cancel:S=>{for(let _=0;_<ju.length;_++)c[ju[_]].cancel(S)},state:i,steps:c}}const{schedule:yt,cancel:Jr,state:on,steps:Rp}=_N(typeof requestAnimationFrame<"u"?requestAnimationFrame:us,!0);let Yu;function pz(){Yu=void 0}const wn={now:()=>(Yu===void 0&&wn.set(on.isProcessing||hr.useManualTiming?on.timestamp:performance.now()),Yu),set:e=>{Yu=e,queueMicrotask(pz)}},kN=e=>t=>typeof t=="string"&&t.startsWith(e),MN=kN("--"),mz=kN("var(--"),Ig=e=>mz(e)?gz.test(e.split("/*")[0].trim()):!1,gz=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function dw(e){return typeof e!="string"?!1:e.split("/*")[0].includes("var(--")}const co={test:e=>typeof e=="number",parse:parseFloat,transform:e=>e},Dl={...co,transform:e=>Vs(0,1,e)},Cu={...co,default:1},jl=e=>Math.round(e*1e5)/1e5,Lg=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function yz(e){return e==null}const vz=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Pg=(e,t)=>s=>!!(typeof s=="string"&&vz.test(s)&&s.startsWith(e)||t&&!yz(s)&&Object.prototype.hasOwnProperty.call(s,t)),ON=(e,t,s)=>r=>{if(typeof r!="string")return r;const[i,l,c,f]=r.match(Lg);return{[e]:parseFloat(i),[t]:parseFloat(l),[s]:parseFloat(c),alpha:f!==void 0?parseFloat(f):1}},bz=e=>Vs(0,255,e),Ap={...co,transform:e=>Math.round(bz(e))},Da={test:Pg("rgb","red"),parse:ON("red","green","blue"),transform:({red:e,green:t,blue:s,alpha:r=1})=>"rgba("+Ap.transform(e)+", "+Ap.transform(t)+", "+Ap.transform(s)+", "+jl(Dl.transform(r))+")"};function xz(e){let t="",s="",r="",i="";return e.length>5?(t=e.substring(1,3),s=e.substring(3,5),r=e.substring(5,7),i=e.substring(7,9)):(t=e.substring(1,2),s=e.substring(2,3),r=e.substring(3,4),i=e.substring(4,5),t+=t,s+=s,r+=r,i+=i),{red:parseInt(t,16),green:parseInt(s,16),blue:parseInt(r,16),alpha:i?parseInt(i,16)/255:1}}const wm={test:Pg("#"),parse:xz,transform:Da.transform},Xl=e=>({test:t=>typeof t=="string"&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),$r=Xl("deg"),Us=Xl("%"),je=Xl("px"),wz=Xl("vh"),Sz=Xl("vw"),fw={...Us,parse:e=>Us.parse(e)/100,transform:e=>Us.transform(e*100)},$i={test:Pg("hsl","hue"),parse:ON("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:s,alpha:r=1})=>"hsla("+Math.round(e)+", "+Us.transform(jl(t))+", "+Us.transform(jl(s))+", "+jl(Dl.transform(r))+")"},Zt={test:e=>Da.test(e)||wm.test(e)||$i.test(e),parse:e=>Da.test(e)?Da.parse(e):$i.test(e)?$i.parse(e):wm.parse(e),transform:e=>typeof e=="string"?e:e.hasOwnProperty("red")?Da.transform(e):$i.transform(e),getAnimatableNone:e=>{const t=Zt.parse(e);return t.alpha=0,Zt.transform(t)}},Ez=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function Nz(e){return isNaN(e)&&typeof e=="string"&&(e.match(Lg)?.length||0)+(e.match(Ez)?.length||0)>0}const DN="number",zN="color",Tz="var",jz="var(",hw="${}",Cz=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function zl(e){const t=e.toString(),s=[],r={color:[],number:[],var:[]},i=[];let l=0;const f=t.replace(Cz,p=>(Zt.test(p)?(r.color.push(l),i.push(zN),s.push(Zt.parse(p))):p.startsWith(jz)?(r.var.push(l),i.push(Tz),s.push(p)):(r.number.push(l),i.push(DN),s.push(parseFloat(p))),++l,hw)).split(hw);return{values:s,split:f,indexes:r,types:i}}function IN(e){return zl(e).values}function LN(e){const{split:t,types:s}=zl(e),r=t.length;return i=>{let l="";for(let c=0;c<r;c++)if(l+=t[c],i[c]!==void 0){const f=s[c];f===DN?l+=jl(i[c]):f===zN?l+=Zt.transform(i[c]):l+=i[c]}return l}}const Rz=e=>typeof e=="number"?0:Zt.test(e)?Zt.getAnimatableNone(e):e;function Az(e){const t=IN(e);return LN(e)(t.map(Rz))}const Es={test:Nz,parse:IN,createTransformer:LN,getAnimatableNone:Az};function _p(e,t,s){return s<0&&(s+=1),s>1&&(s-=1),s<1/6?e+(t-e)*6*s:s<1/2?t:s<2/3?e+(t-e)*(2/3-s)*6:e}function _z({hue:e,saturation:t,lightness:s,alpha:r}){e/=360,t/=100,s/=100;let i=0,l=0,c=0;if(!t)i=l=c=s;else{const f=s<.5?s*(1+t):s+t-s*t,p=2*s-f;i=_p(p,f,e+1/3),l=_p(p,f,e),c=_p(p,f,e-1/3)}return{red:Math.round(i*255),green:Math.round(l*255),blue:Math.round(c*255),alpha:r}}function vd(e,t){return s=>s>0?t:e}const _t=(e,t,s)=>e+(t-e)*s,kp=(e,t,s)=>{const r=e*e,i=s*(t*t-r)+r;return i<0?0:Math.sqrt(i)},kz=[wm,Da,$i],Mz=e=>kz.find(t=>t.test(e));function pw(e){const t=Mz(e);if(!t)return!1;let s=t.parse(e);return t===$i&&(s=_z(s)),s}const mw=(e,t)=>{const s=pw(e),r=pw(t);if(!s||!r)return vd(e,t);const i={...s};return l=>(i.red=kp(s.red,r.red,l),i.green=kp(s.green,r.green,l),i.blue=kp(s.blue,r.blue,l),i.alpha=_t(s.alpha,r.alpha,l),Da.transform(i))},Sm=new Set(["none","hidden"]);function Oz(e,t){return Sm.has(e)?s=>s<=0?e:t:s=>s>=1?t:e}function Dz(e,t){return s=>_t(e,t,s)}function Ug(e){return typeof e=="number"?Dz:typeof e=="string"?Ig(e)?vd:Zt.test(e)?mw:Lz:Array.isArray(e)?PN:typeof e=="object"?Zt.test(e)?mw:zz:vd}function PN(e,t){const s=[...e],r=s.length,i=e.map((l,c)=>Ug(l)(l,t[c]));return l=>{for(let c=0;c<r;c++)s[c]=i[c](l);return s}}function zz(e,t){const s={...e,...t},r={};for(const i in s)e[i]!==void 0&&t[i]!==void 0&&(r[i]=Ug(e[i])(e[i],t[i]));return i=>{for(const l in r)s[l]=r[l](i);return s}}function Iz(e,t){const s=[],r={color:0,var:0,number:0};for(let i=0;i<t.values.length;i++){const l=t.types[i],c=e.indexes[l][r[l]],f=e.values[c]??0;s[i]=f,r[l]++}return s}const Lz=(e,t)=>{const s=Es.createTransformer(t),r=zl(e),i=zl(t);return r.indexes.var.length===i.indexes.var.length&&r.indexes.color.length===i.indexes.color.length&&r.indexes.number.length>=i.indexes.number.length?Sm.has(e)&&!i.values.length||Sm.has(t)&&!r.values.length?Oz(e,t):Yl(PN(Iz(r,i),i.values),s):vd(e,t)};function UN(e,t,s){return typeof e=="number"&&typeof t=="number"&&typeof s=="number"?_t(e,t,s):Ug(e)(e,t)}const Pz=e=>{const t=({timestamp:s})=>e(s);return{start:(s=!0)=>yt.update(t,s),stop:()=>Jr(t),now:()=>on.isProcessing?on.timestamp:wn.now()}},$N=(e,t,s=10)=>{let r="";const i=Math.max(Math.round(t/s),2);for(let l=0;l<i;l++)r+=Math.round(e(l/(i-1))*1e4)/1e4+", ";return`linear(${r.substring(0,r.length-2)})`},bd=2e4;function $g(e){let t=0;const s=50;let r=e.next(t);for(;!r.done&&t<bd;)t+=s,r=e.next(t);return t>=bd?1/0:t}function Uz(e,t=100,s){const r=s({...e,keyframes:[0,t]}),i=Math.min($g(r),bd);return{type:"keyframes",ease:l=>r.next(i*l).value/t,duration:cs(i)}}const $z=5;function VN(e,t,s){const r=Math.max(t-$z,0);return bN(s-e(r),t-r)}const Dt={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1},Mp=.001;function Vz({duration:e=Dt.duration,bounce:t=Dt.bounce,velocity:s=Dt.velocity,mass:r=Dt.mass}){let i,l,c=1-t;c=Vs(Dt.minDamping,Dt.maxDamping,c),e=Vs(Dt.minDuration,Dt.maxDuration,cs(e)),c<1?(i=h=>{const g=h*c,v=g*e,x=g-s,w=Em(h,c),T=Math.exp(-v);return Mp-x/w*T},l=h=>{const v=h*c*e,x=v*s+s,w=Math.pow(c,2)*Math.pow(h,2)*e,T=Math.exp(-v),N=Em(Math.pow(h,2),c);return(-i(h)+Mp>0?-1:1)*((x-w)*T)/N}):(i=h=>{const g=Math.exp(-h*e),v=(h-s)*e+1;return-Mp+g*v},l=h=>{const g=Math.exp(-h*e),v=(s-h)*(e*e);return g*v});const f=5/e,p=Zz(i,l,f);if(e=Ss(e),isNaN(p))return{stiffness:Dt.stiffness,damping:Dt.damping,duration:e};{const h=Math.pow(p,2)*r;return{stiffness:h,damping:c*2*Math.sqrt(r*h),duration:e}}}const Bz=12;function Zz(e,t,s){let r=s;for(let i=1;i<Bz;i++)r=r-e(r)/t(r);return r}function Em(e,t){return e*Math.sqrt(1-t*t)}const Hz=["duration","bounce"],Fz=["stiffness","damping","mass"];function gw(e,t){return t.some(s=>e[s]!==void 0)}function qz(e){let t={velocity:Dt.velocity,stiffness:Dt.stiffness,damping:Dt.damping,mass:Dt.mass,isResolvedFromDuration:!1,...e};if(!gw(e,Fz)&&gw(e,Hz))if(t.velocity=0,e.visualDuration){const s=e.visualDuration,r=2*Math.PI/(s*1.2),i=r*r,l=2*Vs(.05,1,1-(e.bounce||0))*Math.sqrt(i);t={...t,mass:Dt.mass,stiffness:i,damping:l}}else{const s=Vz({...e,velocity:0});t={...t,...s,mass:Dt.mass},t.isResolvedFromDuration=!0}return t}function xd(e=Dt.visualDuration,t=Dt.bounce){const s=typeof e!="object"?{visualDuration:e,keyframes:[0,1],bounce:t}:e;let{restSpeed:r,restDelta:i}=s;const l=s.keyframes[0],c=s.keyframes[s.keyframes.length-1],f={done:!1,value:l},{stiffness:p,damping:h,mass:g,duration:v,velocity:x,isResolvedFromDuration:w}=qz({...s,velocity:-cs(s.velocity||0)}),T=x||0,N=h/(2*Math.sqrt(p*g)),A=c-l,C=cs(Math.sqrt(p/g)),j=Math.abs(A)<5;r||(r=j?Dt.restSpeed.granular:Dt.restSpeed.default),i||(i=j?Dt.restDelta.granular:Dt.restDelta.default);let S;if(N<1){const R=Em(C,N);S=M=>{const O=Math.exp(-N*C*M);return c-O*((T+N*C*A)/R*Math.sin(R*M)+A*Math.cos(R*M))}}else if(N===1)S=R=>c-Math.exp(-C*R)*(A+(T+C*A)*R);else{const R=C*Math.sqrt(N*N-1);S=M=>{const O=Math.exp(-N*C*M),I=Math.min(R*M,300);return c-O*((T+N*C*A)*Math.sinh(I)+R*A*Math.cosh(I))/R}}const _={calculatedDuration:w&&v||null,next:R=>{const M=S(R);if(w)f.done=R>=v;else{let O=R===0?T:0;N<1&&(O=R===0?Ss(T):VN(S,R,M));const I=Math.abs(O)<=r,H=Math.abs(c-M)<=i;f.done=I&&H}return f.value=f.done?c:M,f},toString:()=>{const R=Math.min($g(_),bd),M=$N(O=>_.next(R*O).value,R,30);return R+"ms "+M},toTransition:()=>{}};return _}xd.applyToOptions=e=>{const t=Uz(e,100,xd);return e.ease=t.ease,e.duration=Ss(t.duration),e.type="keyframes",e};function Nm({keyframes:e,velocity:t=0,power:s=.8,timeConstant:r=325,bounceDamping:i=10,bounceStiffness:l=500,modifyTarget:c,min:f,max:p,restDelta:h=.5,restSpeed:g}){const v=e[0],x={done:!1,value:v},w=I=>f!==void 0&&I<f||p!==void 0&&I>p,T=I=>f===void 0?p:p===void 0||Math.abs(f-I)<Math.abs(p-I)?f:p;let N=s*t;const A=v+N,C=c===void 0?A:c(A);C!==A&&(N=C-v);const j=I=>-N*Math.exp(-I/r),S=I=>C+j(I),_=I=>{const H=j(I),F=S(I);x.done=Math.abs(H)<=h,x.value=x.done?C:F};let R,M;const O=I=>{w(x.value)&&(R=I,M=xd({keyframes:[x.value,T(x.value)],velocity:VN(S,I,x.value),damping:i,stiffness:l,restDelta:h,restSpeed:g}))};return O(0),{calculatedDuration:null,next:I=>{let H=!1;return!M&&R===void 0&&(H=!0,_(I),O(I)),R!==void 0&&I>=R?M.next(I-R):(!H&&_(I),x)}}}function Yz(e,t,s){const r=[],i=s||hr.mix||UN,l=e.length-1;for(let c=0;c<l;c++){let f=i(e[c],e[c+1]);if(t){const p=Array.isArray(t)?t[c]||us:t;f=Yl(p,f)}r.push(f)}return r}function Gz(e,t,{clamp:s=!0,ease:r,mixer:i}={}){const l=e.length;if(Mg(l===t.length),l===1)return()=>t[0];if(l===2&&t[0]===t[1])return()=>t[1];const c=e[0]===e[1];e[0]>e[l-1]&&(e=[...e].reverse(),t=[...t].reverse());const f=Yz(t,r,i),p=f.length,h=g=>{if(c&&g<e[0])return t[0];let v=0;if(p>1)for(;v<e.length-2&&!(g<e[v+1]);v++);const x=Ol(e[v],e[v+1],g);return f[v](x)};return s?g=>h(Vs(e[0],e[l-1],g)):h}function Xz(e,t){const s=e[e.length-1];for(let r=1;r<=t;r++){const i=Ol(0,t,r);e.push(_t(s,1,i))}}function Kz(e){const t=[0];return Xz(t,e.length-1),t}function Wz(e,t){return e.map(s=>s*t)}function Jz(e,t){return e.map(()=>t||RN).splice(0,e.length-1)}function Cl({duration:e=300,keyframes:t,times:s,ease:r="easeInOut"}){const i=cz(r)?r.map(uw):uw(r),l={done:!1,value:t[0]},c=Wz(s&&s.length===t.length?s:Kz(t),e),f=Gz(c,t,{ease:Array.isArray(i)?i:Jz(t,i)});return{calculatedDuration:e,next:p=>(l.value=f(p),l.done=p>=e,l)}}const Qz=e=>e!==null;function Vg(e,{repeat:t,repeatType:s="loop"},r,i=1){const l=e.filter(Qz),f=i<0||t&&s!=="loop"&&t%2===1?0:l.length-1;return!f||r===void 0?l[f]:r}const e5={decay:Nm,inertia:Nm,tween:Cl,keyframes:Cl,spring:xd};function BN(e){typeof e.type=="string"&&(e.type=e5[e.type])}class Bg{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(t=>{this.resolve=t})}notifyFinished(){this.resolve()}then(t,s){return this.finished.then(t,s)}}const t5=e=>e/100;class Zg extends Bg{constructor(t){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.stop=()=>{const{motionValue:s}=this.options;s&&s.updatedAt!==wn.now()&&this.tick(wn.now()),this.isStopped=!0,this.state!=="idle"&&(this.teardown(),this.options.onStop?.())},this.options=t,this.initAnimation(),this.play(),t.autoplay===!1&&this.pause()}initAnimation(){const{options:t}=this;BN(t);const{type:s=Cl,repeat:r=0,repeatDelay:i=0,repeatType:l,velocity:c=0}=t;let{keyframes:f}=t;const p=s||Cl;p!==Cl&&typeof f[0]!="number"&&(this.mixKeyframes=Yl(t5,UN(f[0],f[1])),f=[0,100]);const h=p({...t,keyframes:f});l==="mirror"&&(this.mirroredGenerator=p({...t,keyframes:[...f].reverse(),velocity:-c})),h.calculatedDuration===null&&(h.calculatedDuration=$g(h));const{calculatedDuration:g}=h;this.calculatedDuration=g,this.resolvedDuration=g+i,this.totalDuration=this.resolvedDuration*(r+1)-i,this.generator=h}updateTime(t){const s=Math.round(t-this.startTime)*this.playbackSpeed;this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=s}tick(t,s=!1){const{generator:r,totalDuration:i,mixKeyframes:l,mirroredGenerator:c,resolvedDuration:f,calculatedDuration:p}=this;if(this.startTime===null)return r.next(0);const{delay:h=0,keyframes:g,repeat:v,repeatType:x,repeatDelay:w,type:T,onUpdate:N,finalKeyframe:A}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-i/this.speed,this.startTime)),s?this.currentTime=t:this.updateTime(t);const C=this.currentTime-h*(this.playbackSpeed>=0?1:-1),j=this.playbackSpeed>=0?C<0:C>i;this.currentTime=Math.max(C,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=i);let S=this.currentTime,_=r;if(v){const I=Math.min(this.currentTime,i)/f;let H=Math.floor(I),F=I%1;!F&&I>=1&&(F=1),F===1&&H--,H=Math.min(H,v+1),H%2&&(x==="reverse"?(F=1-F,w&&(F-=w/f)):x==="mirror"&&(_=c)),S=Vs(0,1,F)*f}const R=j?{done:!1,value:g[0]}:_.next(S);l&&(R.value=l(R.value));let{done:M}=R;!j&&p!==null&&(M=this.playbackSpeed>=0?this.currentTime>=i:this.currentTime<=0);const O=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&M);return O&&T!==Nm&&(R.value=Vg(g,this.options,A,this.speed)),N&&N(R.value),O&&this.finish(),R}then(t,s){return this.finished.then(t,s)}get duration(){return cs(this.calculatedDuration)}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+cs(t)}get time(){return cs(this.currentTime)}set time(t){t=Ss(t),this.currentTime=t,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=t:this.driver&&(this.startTime=this.driver.now()-t/this.playbackSpeed),this.driver?.start(!1)}get speed(){return this.playbackSpeed}set speed(t){this.updateTime(wn.now());const s=this.playbackSpeed!==t;this.playbackSpeed=t,s&&(this.time=cs(this.currentTime))}play(){if(this.isStopped)return;const{driver:t=Pz,startTime:s}=this.options;this.driver||(this.driver=t(i=>this.tick(i))),this.options.onPlay?.();const r=this.driver.now();this.state==="finished"?(this.updateFinished(),this.startTime=r):this.holdTime!==null?this.startTime=r-this.holdTime:this.startTime||(this.startTime=s??r),this.state==="finished"&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(wn.now()),this.holdTime=this.currentTime}complete(){this.state!=="running"&&this.play(),this.state="finished",this.holdTime=null}finish(){this.notifyFinished(),this.teardown(),this.state="finished",this.options.onComplete?.()}cancel(){this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),this.options.onCancel?.()}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(t){return this.startTime=0,this.tick(t,!0)}attachTimeline(t){return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),this.driver?.stop(),t.observe(this)}}function n5(e){for(let t=1;t<e.length;t++)e[t]??(e[t]=e[t-1])}const za=e=>e*180/Math.PI,Tm=e=>{const t=za(Math.atan2(e[1],e[0]));return jm(t)},s5={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:Tm,rotateZ:Tm,skewX:e=>za(Math.atan(e[1])),skewY:e=>za(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},jm=e=>(e=e%360,e<0&&(e+=360),e),yw=Tm,vw=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),bw=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),r5={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:vw,scaleY:bw,scale:e=>(vw(e)+bw(e))/2,rotateX:e=>jm(za(Math.atan2(e[6],e[5]))),rotateY:e=>jm(za(Math.atan2(-e[2],e[0]))),rotateZ:yw,rotate:yw,skewX:e=>za(Math.atan(e[4])),skewY:e=>za(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function Cm(e){return e.includes("scale")?1:0}function Rm(e,t){if(!e||e==="none")return Cm(t);const s=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let r,i;if(s)r=r5,i=s;else{const f=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);r=s5,i=f}if(!i)return Cm(t);const l=r[t],c=i[1].split(",").map(i5);return typeof l=="function"?l(c):c[l]}const a5=(e,t)=>{const{transform:s="none"}=getComputedStyle(e);return Rm(s,t)};function i5(e){return parseFloat(e.trim())}const uo=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],fo=new Set(uo),xw=e=>e===co||e===je,o5=new Set(["x","y","z"]),l5=uo.filter(e=>!o5.has(e));function c5(e){const t=[];return l5.forEach(s=>{const r=e.getValue(s);r!==void 0&&(t.push([s,r.get()]),r.set(s.startsWith("scale")?1:0))}),t}const qr={width:({x:e},{paddingLeft:t="0",paddingRight:s="0"})=>e.max-e.min-parseFloat(t)-parseFloat(s),height:({y:e},{paddingTop:t="0",paddingBottom:s="0"})=>e.max-e.min-parseFloat(t)-parseFloat(s),top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:(e,{transform:t})=>Rm(t,"x"),y:(e,{transform:t})=>Rm(t,"y")};qr.translateX=qr.x;qr.translateY=qr.y;const Pa=new Set;let Am=!1,_m=!1,km=!1;function ZN(){if(_m){const e=Array.from(Pa).filter(r=>r.needsMeasurement),t=new Set(e.map(r=>r.element)),s=new Map;t.forEach(r=>{const i=c5(r);i.length&&(s.set(r,i),r.render())}),e.forEach(r=>r.measureInitialState()),t.forEach(r=>{r.render();const i=s.get(r);i&&i.forEach(([l,c])=>{r.getValue(l)?.set(c)})}),e.forEach(r=>r.measureEndState()),e.forEach(r=>{r.suspendedScrollY!==void 0&&window.scrollTo(0,r.suspendedScrollY)})}_m=!1,Am=!1,Pa.forEach(e=>e.complete(km)),Pa.clear()}function HN(){Pa.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(_m=!0)})}function u5(){km=!0,HN(),ZN(),km=!1}class Hg{constructor(t,s,r,i,l,c=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...t],this.onComplete=s,this.name=r,this.motionValue=i,this.element=l,this.isAsync=c}scheduleResolve(){this.state="scheduled",this.isAsync?(Pa.add(this),Am||(Am=!0,yt.read(HN),yt.resolveKeyframes(ZN))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:s,element:r,motionValue:i}=this;if(t[0]===null){const l=i?.get(),c=t[t.length-1];if(l!==void 0)t[0]=l;else if(r&&s){const f=r.readValue(s,c);f!=null&&(t[0]=f)}t[0]===void 0&&(t[0]=c),i&&l===void 0&&i.set(t[0])}n5(t)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(t=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,t),Pa.delete(this)}cancel(){this.state==="scheduled"&&(Pa.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const d5=e=>e.startsWith("--");function f5(e,t,s){d5(t)?e.style.setProperty(t,s):e.style[t]=s}const h5={};function FN(e,t){const s=vN(e);return()=>h5[t]??s()}const p5=FN(()=>window.ScrollTimeline!==void 0,"scrollTimeline"),qN=FN(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),gl=([e,t,s,r])=>`cubic-bezier(${e}, ${t}, ${s}, ${r})`,ww={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:gl([0,.65,.55,1]),circOut:gl([.55,0,1,.45]),backIn:gl([.31,.01,.66,-.59]),backOut:gl([.33,1.53,.69,.99])};function YN(e,t){if(e)return typeof e=="function"?qN()?$N(e,t):"ease-out":AN(e)?gl(e):Array.isArray(e)?e.map(s=>YN(s,t)||ww.easeOut):ww[e]}function m5(e,t,s,{delay:r=0,duration:i=300,repeat:l=0,repeatType:c="loop",ease:f="easeOut",times:p}={},h=void 0){const g={[t]:s};p&&(g.offset=p);const v=YN(f,i);Array.isArray(v)&&(g.easing=v);const x={delay:r,duration:i,easing:Array.isArray(v)?"linear":v,fill:"both",iterations:l+1,direction:c==="reverse"?"alternate":"normal"};return h&&(x.pseudoElement=h),e.animate(g,x)}function GN(e){return typeof e=="function"&&"applyToOptions"in e}function g5({type:e,...t}){return GN(e)&&qN()?e.applyToOptions(t):(t.duration??(t.duration=300),t.ease??(t.ease="easeOut"),t)}class XN extends Bg{constructor(t){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!t)return;const{element:s,name:r,keyframes:i,pseudoElement:l,allowFlatten:c=!1,finalKeyframe:f,onComplete:p}=t;this.isPseudoElement=!!l,this.allowFlatten=c,this.options=t,Mg(typeof t.type!="string");const h=g5(t);this.animation=m5(s,r,i,h,l),h.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!l){const g=Vg(i,this.options,f,this.speed);this.updateMotionValue?this.updateMotionValue(g):f5(s,r,g),this.animation.cancel()}p?.(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),this.state==="finished"&&this.updateFinished())}pause(){this.animation.pause()}complete(){this.animation.finish?.()}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:t}=this;t==="idle"||t==="finished"||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){const t=this.options?.element;!this.isPseudoElement&&t?.isConnected&&this.animation.commitStyles?.()}get duration(){const t=this.animation.effect?.getComputedTiming?.().duration||0;return cs(Number(t))}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+cs(t)}get time(){return cs(Number(this.animation.currentTime)||0)}set time(t){this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=Ss(t)}get speed(){return this.animation.playbackRate}set speed(t){t<0&&(this.finishedTime=null),this.animation.playbackRate=t}get state(){return this.finishedTime!==null?"finished":this.animation.playState}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(t){this.manualStartTime=this.animation.startTime=t}attachTimeline({timeline:t,observe:s}){return this.allowFlatten&&this.animation.effect?.updateTiming({easing:"linear"}),this.animation.onfinish=null,t&&p5()?(this.animation.timeline=t,us):s(this)}}const KN={anticipate:TN,backInOut:NN,circInOut:CN};function y5(e){return e in KN}function v5(e){typeof e.ease=="string"&&y5(e.ease)&&(e.ease=KN[e.ease])}const Op=10;class b5 extends XN{constructor(t){v5(t),BN(t),super(t),t.startTime!==void 0&&(this.startTime=t.startTime),this.options=t}updateMotionValue(t){const{motionValue:s,onUpdate:r,onComplete:i,element:l,...c}=this.options;if(!s)return;if(t!==void 0){s.set(t);return}const f=new Zg({...c,autoplay:!1}),p=Math.max(Op,wn.now()-this.startTime),h=Vs(0,Op,p-Op);s.setWithVelocity(f.sample(Math.max(0,p-h)).value,f.sample(p).value,h),f.stop()}}const Sw=(e,t)=>t==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&(Es.test(e)||e==="0")&&!e.startsWith("url("));function x5(e){const t=e[0];if(e.length===1)return!0;for(let s=0;s<e.length;s++)if(e[s]!==t)return!0}function w5(e,t,s,r){const i=e[0];if(i===null)return!1;if(t==="display"||t==="visibility")return!0;const l=e[e.length-1],c=Sw(i,t),f=Sw(l,t);return!c||!f?!1:x5(e)||(s==="spring"||GN(s))&&r}function Mm(e){e.duration=0,e.type="keyframes"}const S5=new Set(["opacity","clipPath","filter","transform"]),E5=vN(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function N5(e){const{motionValue:t,name:s,repeatDelay:r,repeatType:i,damping:l,type:c}=e;if(!(t?.owner?.current instanceof HTMLElement))return!1;const{onUpdate:p,transformTemplate:h}=t.owner.getProps();return E5()&&s&&S5.has(s)&&(s!=="transform"||!h)&&!p&&!r&&i!=="mirror"&&l!==0&&c!=="inertia"}const T5=40;class j5 extends Bg{constructor({autoplay:t=!0,delay:s=0,type:r="keyframes",repeat:i=0,repeatDelay:l=0,repeatType:c="loop",keyframes:f,name:p,motionValue:h,element:g,...v}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=wn.now();const x={autoplay:t,delay:s,type:r,repeat:i,repeatDelay:l,repeatType:c,name:p,motionValue:h,element:g,...v},w=g?.KeyframeResolver||Hg;this.keyframeResolver=new w(f,(T,N,A)=>this.onKeyframesResolved(T,N,x,!A),p,h,g),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(t,s,r,i){this.keyframeResolver=void 0;const{name:l,type:c,velocity:f,delay:p,isHandoff:h,onUpdate:g}=r;this.resolvedAt=wn.now(),w5(t,l,c,f)||((hr.instantAnimations||!p)&&g?.(Vg(t,r,s)),t[0]=t[t.length-1],Mm(r),r.repeat=0);const x={startTime:i?this.resolvedAt?this.resolvedAt-this.createdAt>T5?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:s,...r,keyframes:t},w=!h&&N5(x),T=x.motionValue?.owner?.current,N=w?new b5({...x,element:T}):new Zg(x);N.finished.then(()=>{this.notifyFinished()}).catch(us),this.pendingTimeline&&(this.stopTimeline=N.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=N}get finished(){return this._animation?this.animation.finished:this._finished}then(t,s){return this.finished.finally(t).then(()=>{})}get animation(){return this._animation||(this.keyframeResolver?.resume(),u5()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(t){this.animation.time=t}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(t){this.animation.speed=t}get startTime(){return this.animation.startTime}attachTimeline(t){return this._animation?this.stopTimeline=this.animation.attachTimeline(t):this.pendingTimeline=t,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){this._animation&&this.animation.cancel(),this.keyframeResolver?.cancel()}}function WN(e,t,s,r=0,i=1){const l=Array.from(e).sort((h,g)=>h.sortNodePosition(g)).indexOf(t),c=e.size,f=(c-1)*r;return typeof s=="function"?s(l,c):i===1?l*r:f-l*r}const C5=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function R5(e){const t=C5.exec(e);if(!t)return[,];const[,s,r,i]=t;return[`--${s??r}`,i]}function JN(e,t,s=1){const[r,i]=R5(e);if(!r)return;const l=window.getComputedStyle(t).getPropertyValue(r);if(l){const c=l.trim();return mN(c)?parseFloat(c):c}return Ig(i)?JN(i,t,s+1):i}const A5={type:"spring",stiffness:500,damping:25,restSpeed:10},_5=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),k5={type:"keyframes",duration:.8},M5={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},O5=(e,{keyframes:t})=>t.length>2?k5:fo.has(e)?e.startsWith("scale")?_5(t[1]):A5:M5,D5=e=>e!==null;function z5(e,{repeat:t,repeatType:s="loop"},r){const i=e.filter(D5),l=t&&s!=="loop"&&t%2===1?0:i.length-1;return i[l]}function QN(e,t){if(e?.inherit&&t){const{inherit:s,...r}=e;return{...t,...r}}return e}function Fg(e,t){const s=e?.[t]??e?.default??e;return s!==e?QN(s,e):s}function I5({when:e,delay:t,delayChildren:s,staggerChildren:r,staggerDirection:i,repeat:l,repeatType:c,repeatDelay:f,from:p,elapsed:h,...g}){return!!Object.keys(g).length}const qg=(e,t,s,r={},i,l)=>c=>{const f=Fg(r,e)||{},p=f.delay||r.delay||0;let{elapsed:h=0}=r;h=h-Ss(p);const g={keyframes:Array.isArray(s)?s:[null,s],ease:"easeOut",velocity:t.getVelocity(),...f,delay:-h,onUpdate:x=>{t.set(x),f.onUpdate&&f.onUpdate(x)},onComplete:()=>{c(),f.onComplete&&f.onComplete()},name:e,motionValue:t,element:l?void 0:i};I5(f)||Object.assign(g,O5(e,g)),g.duration&&(g.duration=Ss(g.duration)),g.repeatDelay&&(g.repeatDelay=Ss(g.repeatDelay)),g.from!==void 0&&(g.keyframes[0]=g.from);let v=!1;if((g.type===!1||g.duration===0&&!g.repeatDelay)&&(Mm(g),g.delay===0&&(v=!0)),(hr.instantAnimations||hr.skipAnimations||i?.shouldSkipAnimations)&&(v=!0,Mm(g),g.delay=0),g.allowFlatten=!f.type&&!f.ease,v&&!l&&t.get()!==void 0){const x=z5(g.keyframes,f);if(x!==void 0){yt.update(()=>{g.onUpdate(x),g.onComplete()});return}}return f.isSync?new Zg(g):new j5(g)};function Ew(e){const t=[{},{}];return e?.values.forEach((s,r)=>{t[0][r]=s.get(),t[1][r]=s.getVelocity()}),t}function Yg(e,t,s,r){if(typeof t=="function"){const[i,l]=Ew(r);t=t(s!==void 0?s:e.custom,i,l)}if(typeof t=="string"&&(t=e.variants&&e.variants[t]),typeof t=="function"){const[i,l]=Ew(r);t=t(s!==void 0?s:e.custom,i,l)}return t}function Ki(e,t,s){const r=e.getProps();return Yg(r,t,s!==void 0?s:r.custom,e)}const eT=new Set(["width","height","top","left","right","bottom",...uo]),Nw=30,L5=e=>!isNaN(parseFloat(e));class P5{constructor(t,s={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=r=>{const i=wn.now();if(this.updatedAt!==i&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(r),this.current!==this.prev&&(this.events.change?.notify(this.current),this.dependents))for(const l of this.dependents)l.dirty()},this.hasAnimated=!1,this.setCurrent(t),this.owner=s.owner}setCurrent(t){this.current=t,this.updatedAt=wn.now(),this.canTrackVelocity===null&&t!==void 0&&(this.canTrackVelocity=L5(this.current))}setPrevFrameValue(t=this.current){this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt}onChange(t){return this.on("change",t)}on(t,s){this.events[t]||(this.events[t]=new Og);const r=this.events[t].add(s);return t==="change"?()=>{r(),yt.read(()=>{this.events.change.getSize()||this.stop()})}:r}clearListeners(){for(const t in this.events)this.events[t].clear()}attach(t,s){this.passiveEffect=t,this.stopPassiveEffect=s}set(t){this.passiveEffect?this.passiveEffect(t,this.updateAndNotify):this.updateAndNotify(t)}setWithVelocity(t,s,r){this.set(s),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-r}jump(t,s=!0){this.updateAndNotify(t),this.prev=t,this.prevUpdatedAt=this.prevFrameValue=void 0,s&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){this.events.change?.notify(this.current)}addDependent(t){this.dependents||(this.dependents=new Set),this.dependents.add(t)}removeDependent(t){this.dependents&&this.dependents.delete(t)}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const t=wn.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||t-this.updatedAt>Nw)return 0;const s=Math.min(this.updatedAt-this.prevUpdatedAt,Nw);return bN(parseFloat(this.current)-parseFloat(this.prevFrameValue),s)}start(t){return this.stop(),new Promise(s=>{this.hasAnimated=!0,this.animation=t(s),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.dependents?.clear(),this.events.destroy?.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function to(e,t){return new P5(e,t)}const Om=e=>Array.isArray(e);function U5(e,t,s){e.hasValue(t)?e.getValue(t).set(s):e.addValue(t,to(s))}function $5(e){return Om(e)?e[e.length-1]||0:e}function V5(e,t){const s=Ki(e,t);let{transitionEnd:r={},transition:i={},...l}=s||{};l={...l,...r};for(const c in l){const f=$5(l[c]);U5(e,c,f)}}const hn=e=>!!(e&&e.getVelocity);function B5(e){return!!(hn(e)&&e.add)}function Dm(e,t){const s=e.getValue("willChange");if(B5(s))return s.add(t);if(!s&&hr.WillChange){const r=new hr.WillChange("auto");e.addValue("willChange",r),r.add(t)}}function Gg(e){return e.replace(/([A-Z])/g,t=>`-${t.toLowerCase()}`)}const Z5="framerAppearId",tT="data-"+Gg(Z5);function nT(e){return e.props[tT]}function H5({protectedKeys:e,needsAnimating:t},s){const r=e.hasOwnProperty(s)&&t[s]!==!0;return t[s]=!1,r}function sT(e,t,{delay:s=0,transitionOverride:r,type:i}={}){let{transition:l,transitionEnd:c,...f}=t;const p=e.getDefaultTransition();l=l?QN(l,p):p;const h=l?.reduceMotion;r&&(l=r);const g=[],v=i&&e.animationState&&e.animationState.getState()[i];for(const x in f){const w=e.getValue(x,e.latestValues[x]??null),T=f[x];if(T===void 0||v&&H5(v,x))continue;const N={delay:s,...Fg(l||{},x)},A=w.get();if(A!==void 0&&!w.isAnimating&&!Array.isArray(T)&&T===A&&!N.velocity)continue;let C=!1;if(window.MotionHandoffAnimation){const _=nT(e);if(_){const R=window.MotionHandoffAnimation(_,x,yt);R!==null&&(N.startTime=R,C=!0)}}Dm(e,x);const j=h??e.shouldReduceMotion;w.start(qg(x,w,T,j&&eT.has(x)?{type:!1}:N,e,C));const S=w.animation;S&&g.push(S)}if(c){const x=()=>yt.update(()=>{c&&V5(e,c)});g.length?Promise.all(g).then(x):x()}return g}function zm(e,t,s={}){const r=Ki(e,t,s.type==="exit"?e.presenceContext?.custom:void 0);let{transition:i=e.getDefaultTransition()||{}}=r||{};s.transitionOverride&&(i=s.transitionOverride);const l=r?()=>Promise.all(sT(e,r,s)):()=>Promise.resolve(),c=e.variantChildren&&e.variantChildren.size?(p=0)=>{const{delayChildren:h=0,staggerChildren:g,staggerDirection:v}=i;return F5(e,t,p,h,g,v,s)}:()=>Promise.resolve(),{when:f}=i;if(f){const[p,h]=f==="beforeChildren"?[l,c]:[c,l];return p().then(()=>h())}else return Promise.all([l(),c(s.delay)])}function F5(e,t,s=0,r=0,i=0,l=1,c){const f=[];for(const p of e.variantChildren)p.notify("AnimationStart",t),f.push(zm(p,t,{...c,delay:s+(typeof r=="function"?0:r)+WN(e.variantChildren,p,r,i,l)}).then(()=>p.notify("AnimationComplete",t)));return Promise.all(f)}function q5(e,t,s={}){e.notify("AnimationStart",t);let r;if(Array.isArray(t)){const i=t.map(l=>zm(e,l,s));r=Promise.all(i)}else if(typeof t=="string")r=zm(e,t,s);else{const i=typeof t=="function"?Ki(e,t,s.custom):t;r=Promise.all(sT(e,i,s))}return r.then(()=>{e.notify("AnimationComplete",t)})}const Y5={test:e=>e==="auto",parse:e=>e},rT=e=>t=>t.test(e),aT=[co,je,Us,$r,Sz,wz,Y5],Tw=e=>aT.find(rT(e));function G5(e){return typeof e=="number"?e===0:e!==null?e==="none"||e==="0"||yN(e):!0}const X5=new Set(["brightness","contrast","saturate","opacity"]);function K5(e){const[t,s]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[r]=s.match(Lg)||[];if(!r)return e;const i=s.replace(r,"");let l=X5.has(t)?1:0;return r!==s&&(l*=100),t+"("+l+i+")"}const W5=/\b([a-z-]*)\(.*?\)/gu,Im={...Es,getAnimatableNone:e=>{const t=e.match(W5);return t?t.map(K5).join(" "):e}},Lm={...Es,getAnimatableNone:e=>{const t=Es.parse(e);return Es.createTransformer(e)(t.map(r=>typeof r=="number"?0:typeof r=="object"?{...r,alpha:1}:r))}},jw={...co,transform:Math.round},J5={rotate:$r,rotateX:$r,rotateY:$r,rotateZ:$r,scale:Cu,scaleX:Cu,scaleY:Cu,scaleZ:Cu,skew:$r,skewX:$r,skewY:$r,distance:je,translateX:je,translateY:je,translateZ:je,x:je,y:je,z:je,perspective:je,transformPerspective:je,opacity:Dl,originX:fw,originY:fw,originZ:je},Xg={borderWidth:je,borderTopWidth:je,borderRightWidth:je,borderBottomWidth:je,borderLeftWidth:je,borderRadius:je,borderTopLeftRadius:je,borderTopRightRadius:je,borderBottomRightRadius:je,borderBottomLeftRadius:je,width:je,maxWidth:je,height:je,maxHeight:je,top:je,right:je,bottom:je,left:je,inset:je,insetBlock:je,insetBlockStart:je,insetBlockEnd:je,insetInline:je,insetInlineStart:je,insetInlineEnd:je,padding:je,paddingTop:je,paddingRight:je,paddingBottom:je,paddingLeft:je,paddingBlock:je,paddingBlockStart:je,paddingBlockEnd:je,paddingInline:je,paddingInlineStart:je,paddingInlineEnd:je,margin:je,marginTop:je,marginRight:je,marginBottom:je,marginLeft:je,marginBlock:je,marginBlockStart:je,marginBlockEnd:je,marginInline:je,marginInlineStart:je,marginInlineEnd:je,fontSize:je,backgroundPositionX:je,backgroundPositionY:je,...J5,zIndex:jw,fillOpacity:Dl,strokeOpacity:Dl,numOctaves:jw},Q5={...Xg,color:Zt,backgroundColor:Zt,outlineColor:Zt,fill:Zt,stroke:Zt,borderColor:Zt,borderTopColor:Zt,borderRightColor:Zt,borderBottomColor:Zt,borderLeftColor:Zt,filter:Im,WebkitFilter:Im,mask:Lm,WebkitMask:Lm},iT=e=>Q5[e],e3=new Set([Im,Lm]);function oT(e,t){let s=iT(e);return e3.has(s)||(s=Es),s.getAnimatableNone?s.getAnimatableNone(t):void 0}const t3=new Set(["auto","none","0"]);function n3(e,t,s){let r=0,i;for(;r<e.length&&!i;){const l=e[r];typeof l=="string"&&!t3.has(l)&&zl(l).values.length&&(i=e[r]),r++}if(i&&s)for(const l of t)e[l]=oT(s,i)}class s3 extends Hg{constructor(t,s,r,i,l){super(t,s,r,i,l,!0)}readKeyframes(){const{unresolvedKeyframes:t,element:s,name:r}=this;if(!s||!s.current)return;super.readKeyframes();for(let g=0;g<t.length;g++){let v=t[g];if(typeof v=="string"&&(v=v.trim(),Ig(v))){const x=JN(v,s.current);x!==void 0&&(t[g]=x),g===t.length-1&&(this.finalKeyframe=v)}}if(this.resolveNoneKeyframes(),!eT.has(r)||t.length!==2)return;const[i,l]=t,c=Tw(i),f=Tw(l),p=dw(i),h=dw(l);if(p!==h&&qr[r]){this.needsMeasurement=!0;return}if(c!==f)if(xw(c)&&xw(f))for(let g=0;g<t.length;g++){const v=t[g];typeof v=="string"&&(t[g]=parseFloat(v))}else qr[r]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:t,name:s}=this,r=[];for(let i=0;i<t.length;i++)(t[i]===null||G5(t[i]))&&r.push(i);r.length&&n3(t,r,s)}measureInitialState(){const{element:t,unresolvedKeyframes:s,name:r}=this;if(!t||!t.current)return;r==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=qr[r](t.measureViewportBox(),window.getComputedStyle(t.current)),s[0]=this.measuredOrigin;const i=s[s.length-1];i!==void 0&&t.getValue(r,i).jump(i,!1)}measureEndState(){const{element:t,name:s,unresolvedKeyframes:r}=this;if(!t||!t.current)return;const i=t.getValue(s);i&&i.jump(this.measuredOrigin,!1);const l=r.length-1,c=r[l];r[l]=qr[s](t.measureViewportBox(),window.getComputedStyle(t.current)),c!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=c),this.removedTransforms?.length&&this.removedTransforms.forEach(([f,p])=>{t.getValue(f).set(p)}),this.resolveNoneKeyframes()}}const r3=new Set(["opacity","clipPath","filter","transform"]);function lT(e,t,s){if(e==null)return[];if(e instanceof EventTarget)return[e];if(typeof e=="string"){let r=document;const i=s?.[e]??r.querySelectorAll(e);return i?Array.from(i):[]}return Array.from(e).filter(r=>r!=null)}const cT=(e,t)=>t&&typeof e=="number"?t.transform(e):e;function Pm(e){return gN(e)&&"offsetHeight"in e}const{schedule:Kg}=_N(queueMicrotask,!1),xs={x:!1,y:!1};function uT(){return xs.x||xs.y}function a3(e){return e==="x"||e==="y"?xs[e]?null:(xs[e]=!0,()=>{xs[e]=!1}):xs.x||xs.y?null:(xs.x=xs.y=!0,()=>{xs.x=xs.y=!1})}function dT(e,t){const s=lT(e),r=new AbortController,i={passive:!0,...t,signal:r.signal};return[s,i,()=>r.abort()]}function i3(e){return!(e.pointerType==="touch"||uT())}function o3(e,t,s={}){const[r,i,l]=dT(e,s);return r.forEach(c=>{let f=!1,p=!1,h;const g=()=>{c.removeEventListener("pointerleave",T)},v=A=>{h&&(h(A),h=void 0),g()},x=A=>{f=!1,window.removeEventListener("pointerup",x),window.removeEventListener("pointercancel",x),p&&(p=!1,v(A))},w=()=>{f=!0,window.addEventListener("pointerup",x,i),window.addEventListener("pointercancel",x,i)},T=A=>{if(A.pointerType!=="touch"){if(f){p=!0;return}v(A)}},N=A=>{if(!i3(A))return;p=!1;const C=t(c,A);typeof C=="function"&&(h=C,c.addEventListener("pointerleave",T,i))};c.addEventListener("pointerenter",N,i),c.addEventListener("pointerdown",w,i)}),l}const fT=(e,t)=>t?e===t?!0:fT(e,t.parentElement):!1,Wg=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1,l3=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function c3(e){return l3.has(e.tagName)||e.isContentEditable===!0}const u3=new Set(["INPUT","SELECT","TEXTAREA"]);function d3(e){return u3.has(e.tagName)||e.isContentEditable===!0}const Gu=new WeakSet;function Cw(e){return t=>{t.key==="Enter"&&e(t)}}function Dp(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}const f3=(e,t)=>{const s=e.currentTarget;if(!s)return;const r=Cw(()=>{if(Gu.has(s))return;Dp(s,"down");const i=Cw(()=>{Dp(s,"up")}),l=()=>Dp(s,"cancel");s.addEventListener("keyup",i,t),s.addEventListener("blur",l,t)});s.addEventListener("keydown",r,t),s.addEventListener("blur",()=>s.removeEventListener("keydown",r),t)};function Rw(e){return Wg(e)&&!uT()}const Aw=new WeakSet;function h3(e,t,s={}){const[r,i,l]=dT(e,s),c=f=>{const p=f.currentTarget;if(!Rw(f)||Aw.has(f))return;Gu.add(p),s.stopPropagation&&Aw.add(f);const h=t(p,f),g=(w,T)=>{window.removeEventListener("pointerup",v),window.removeEventListener("pointercancel",x),Gu.has(p)&&Gu.delete(p),Rw(w)&&typeof h=="function"&&h(w,{success:T})},v=w=>{g(w,p===window||p===document||s.useGlobalTarget||fT(p,w.target))},x=w=>{g(w,!1)};window.addEventListener("pointerup",v,i),window.addEventListener("pointercancel",x,i)};return r.forEach(f=>{(s.useGlobalTarget?window:f).addEventListener("pointerdown",c,i),Pm(f)&&(f.addEventListener("focus",h=>f3(h,i)),!c3(f)&&!f.hasAttribute("tabindex")&&(f.tabIndex=0))}),l}function Jg(e){return gN(e)&&"ownerSVGElement"in e}const Xu=new WeakMap;let Ku;const hT=(e,t,s)=>(r,i)=>i&&i[0]?i[0][e+"Size"]:Jg(r)&&"getBBox"in r?r.getBBox()[t]:r[s],p3=hT("inline","width","offsetWidth"),m3=hT("block","height","offsetHeight");function g3({target:e,borderBoxSize:t}){Xu.get(e)?.forEach(s=>{s(e,{get width(){return p3(e,t)},get height(){return m3(e,t)}})})}function y3(e){e.forEach(g3)}function v3(){typeof ResizeObserver>"u"||(Ku=new ResizeObserver(y3))}function b3(e,t){Ku||v3();const s=lT(e);return s.forEach(r=>{let i=Xu.get(r);i||(i=new Set,Xu.set(r,i)),i.add(t),Ku?.observe(r)}),()=>{s.forEach(r=>{const i=Xu.get(r);i?.delete(t),i?.size||Ku?.unobserve(r)})}}const Wu=new Set;let Vi;function x3(){Vi=()=>{const e={get width(){return window.innerWidth},get height(){return window.innerHeight}};Wu.forEach(t=>t(e))},window.addEventListener("resize",Vi)}function w3(e){return Wu.add(e),Vi||x3(),()=>{Wu.delete(e),!Wu.size&&typeof Vi=="function"&&(window.removeEventListener("resize",Vi),Vi=void 0)}}function _w(e,t){return typeof e=="function"?w3(e):b3(e,t)}function S3(e){return Jg(e)&&e.tagName==="svg"}const E3=[...aT,Zt,Es],N3=e=>E3.find(rT(e)),kw=()=>({translate:0,scale:1,origin:0,originPoint:0}),Bi=()=>({x:kw(),y:kw()}),Mw=()=>({min:0,max:0}),Xt=()=>({x:Mw(),y:Mw()}),T3=new WeakMap;function Hd(e){return e!==null&&typeof e=="object"&&typeof e.start=="function"}function Il(e){return typeof e=="string"||Array.isArray(e)}const Qg=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],ey=["initial",...Qg];function Fd(e){return Hd(e.animate)||ey.some(t=>Il(e[t]))}function pT(e){return!!(Fd(e)||e.variants)}function j3(e,t,s){for(const r in t){const i=t[r],l=s[r];if(hn(i))e.addValue(r,i);else if(hn(l))e.addValue(r,to(i,{owner:e}));else if(l!==i)if(e.hasValue(r)){const c=e.getValue(r);c.liveStyle===!0?c.jump(i):c.hasAnimated||c.set(i)}else{const c=e.getStaticValue(r);e.addValue(r,to(c!==void 0?c:i,{owner:e}))}}for(const r in s)t[r]===void 0&&e.removeValue(r);return t}const Um={current:null},mT={current:!1},C3=typeof window<"u";function R3(){if(mT.current=!0,!!C3)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>Um.current=e.matches;e.addEventListener("change",t),t()}else Um.current=!1}const Ow=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];let wd={};function gT(e){wd=e}function A3(){return wd}class _3{scrapeMotionValuesFromProps(t,s,r){return{}}constructor({parent:t,props:s,presenceContext:r,reducedMotionConfig:i,skipAnimations:l,blockInitialAnimation:c,visualState:f},p={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.shouldSkipAnimations=!1,this.values=new Map,this.KeyframeResolver=Hg,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.hasBeenMounted=!1,this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const w=wn.now();this.renderScheduledAt<w&&(this.renderScheduledAt=w,yt.render(this.render,!1,!0))};const{latestValues:h,renderState:g}=f;this.latestValues=h,this.baseTarget={...h},this.initialValues=s.initial?{...h}:{},this.renderState=g,this.parent=t,this.props=s,this.presenceContext=r,this.depth=t?t.depth+1:0,this.reducedMotionConfig=i,this.skipAnimationsConfig=l,this.options=p,this.blockInitialAnimation=!!c,this.isControllingVariants=Fd(s),this.isVariantNode=pT(s),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(t&&t.current);const{willChange:v,...x}=this.scrapeMotionValuesFromProps(s,{},this);for(const w in x){const T=x[w];h[w]!==void 0&&hn(T)&&T.set(h[w])}}mount(t){if(this.hasBeenMounted)for(const s in this.initialValues)this.values.get(s)?.jump(this.initialValues[s]),this.latestValues[s]=this.initialValues[s];this.current=t,T3.set(t,this),this.projection&&!this.projection.instance&&this.projection.mount(t),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((s,r)=>this.bindToMotionValue(r,s)),this.reducedMotionConfig==="never"?this.shouldReduceMotion=!1:this.reducedMotionConfig==="always"?this.shouldReduceMotion=!0:(mT.current||R3(),this.shouldReduceMotion=Um.current),this.shouldSkipAnimations=this.skipAnimationsConfig??!1,this.parent?.addChild(this),this.update(this.props,this.presenceContext),this.hasBeenMounted=!0}unmount(){this.projection&&this.projection.unmount(),Jr(this.notifyUpdate),Jr(this.render),this.valueSubscriptions.forEach(t=>t()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent?.removeChild(this);for(const t in this.events)this.events[t].clear();for(const t in this.features){const s=this.features[t];s&&(s.unmount(),s.isMounted=!1)}this.current=null}addChild(t){this.children.add(t),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(t)}removeChild(t){this.children.delete(t),this.enteringChildren&&this.enteringChildren.delete(t)}bindToMotionValue(t,s){if(this.valueSubscriptions.has(t)&&this.valueSubscriptions.get(t)(),s.accelerate&&r3.has(t)&&this.current instanceof HTMLElement){const{factory:c,keyframes:f,times:p,ease:h,duration:g}=s.accelerate,v=new XN({element:this.current,name:t,keyframes:f,times:p,ease:h,duration:Ss(g)}),x=c(v);this.valueSubscriptions.set(t,()=>{x(),v.cancel()});return}const r=fo.has(t);r&&this.onBindTransform&&this.onBindTransform();const i=s.on("change",c=>{this.latestValues[t]=c,this.props.onUpdate&&yt.preRender(this.notifyUpdate),r&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let l;typeof window<"u"&&window.MotionCheckAppearSync&&(l=window.MotionCheckAppearSync(this,t,s)),this.valueSubscriptions.set(t,()=>{i(),l&&l(),s.owner&&s.stop()})}sortNodePosition(t){return!this.current||!this.sortInstanceNodePosition||this.type!==t.type?0:this.sortInstanceNodePosition(this.current,t.current)}updateFeatures(){let t="animation";for(t in wd){const s=wd[t];if(!s)continue;const{isEnabled:r,Feature:i}=s;if(!this.features[t]&&i&&r(this.props)&&(this.features[t]=new i(this)),this.features[t]){const l=this.features[t];l.isMounted?l.update():(l.mount(),l.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):Xt()}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,s){this.latestValues[t]=s}update(t,s){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=s;for(let r=0;r<Ow.length;r++){const i=Ow[r];this.propEventSubscriptions[i]&&(this.propEventSubscriptions[i](),delete this.propEventSubscriptions[i]);const l="on"+i,c=t[l];c&&(this.propEventSubscriptions[i]=this.on(i,c))}this.prevMotionValues=j3(this,this.scrapeMotionValuesFromProps(t,this.prevProps||{},this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(t){return this.props.variants?this.props.variants[t]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(t){const s=this.getClosestVariantNode();if(s)return s.variantChildren&&s.variantChildren.add(t),()=>s.variantChildren.delete(t)}addValue(t,s){const r=this.values.get(t);s!==r&&(r&&this.removeValue(t),this.bindToMotionValue(t,s),this.values.set(t,s),this.latestValues[t]=s.get())}removeValue(t){this.values.delete(t);const s=this.valueSubscriptions.get(t);s&&(s(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,s){if(this.props.values&&this.props.values[t])return this.props.values[t];let r=this.values.get(t);return r===void 0&&s!==void 0&&(r=to(s===null?void 0:s,{owner:this}),this.addValue(t,r)),r}readValue(t,s){let r=this.latestValues[t]!==void 0||!this.current?this.latestValues[t]:this.getBaseTargetFromProps(this.props,t)??this.readValueFromInstance(this.current,t,this.options);return r!=null&&(typeof r=="string"&&(mN(r)||yN(r))?r=parseFloat(r):!N3(r)&&Es.test(s)&&(r=oT(t,s)),this.setBaseTarget(t,hn(r)?r.get():r)),hn(r)?r.get():r}setBaseTarget(t,s){this.baseTarget[t]=s}getBaseTarget(t){const{initial:s}=this.props;let r;if(typeof s=="string"||typeof s=="object"){const l=Yg(this.props,s,this.presenceContext?.custom);l&&(r=l[t])}if(s&&r!==void 0)return r;const i=this.getBaseTargetFromProps(this.props,t);return i!==void 0&&!hn(i)?i:this.initialValues[t]!==void 0&&r===void 0?void 0:this.baseTarget[t]}on(t,s){return this.events[t]||(this.events[t]=new Og),this.events[t].add(s)}notify(t,...s){this.events[t]&&this.events[t].notify(...s)}scheduleRenderMicrotask(){Kg.render(this.render)}}class yT extends _3{constructor(){super(...arguments),this.KeyframeResolver=s3}sortInstanceNodePosition(t,s){return t.compareDocumentPosition(s)&2?1:-1}getBaseTargetFromProps(t,s){const r=t.style;return r?r[s]:void 0}removeValueFromRenderState(t,{vars:s,style:r}){delete s[t],delete r[t]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;hn(t)&&(this.childSubscription=t.on("change",s=>{this.current&&(this.current.textContent=`${s}`)}))}}class ia{constructor(t){this.isMounted=!1,this.node=t}update(){}}function vT({top:e,left:t,right:s,bottom:r}){return{x:{min:t,max:s},y:{min:e,max:r}}}function k3({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function M3(e,t){if(!t)return e;const s=t({x:e.left,y:e.top}),r=t({x:e.right,y:e.bottom});return{top:s.y,left:s.x,bottom:r.y,right:r.x}}function zp(e){return e===void 0||e===1}function $m({scale:e,scaleX:t,scaleY:s}){return!zp(e)||!zp(t)||!zp(s)}function Ma(e){return $m(e)||bT(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function bT(e){return Dw(e.x)||Dw(e.y)}function Dw(e){return e&&e!=="0%"}function Sd(e,t,s){const r=e-s,i=t*r;return s+i}function zw(e,t,s,r,i){return i!==void 0&&(e=Sd(e,i,r)),Sd(e,s,r)+t}function Vm(e,t=0,s=1,r,i){e.min=zw(e.min,t,s,r,i),e.max=zw(e.max,t,s,r,i)}function xT(e,{x:t,y:s}){Vm(e.x,t.translate,t.scale,t.originPoint),Vm(e.y,s.translate,s.scale,s.originPoint)}const Iw=.999999999999,Lw=1.0000000000001;function O3(e,t,s,r=!1){const i=s.length;if(!i)return;t.x=t.y=1;let l,c;for(let f=0;f<i;f++){l=s[f],c=l.projectionDelta;const{visualElement:p}=l.options;p&&p.props.style&&p.props.style.display==="contents"||(r&&l.options.layoutScroll&&l.scroll&&l!==l.root&&Hi(e,{x:-l.scroll.offset.x,y:-l.scroll.offset.y}),c&&(t.x*=c.x.scale,t.y*=c.y.scale,xT(e,c)),r&&Ma(l.latestValues)&&Hi(e,l.latestValues))}t.x<Lw&&t.x>Iw&&(t.x=1),t.y<Lw&&t.y>Iw&&(t.y=1)}function Zi(e,t){e.min=e.min+t,e.max=e.max+t}function Pw(e,t,s,r,i=.5){const l=_t(e.min,e.max,i);Vm(e,t,s,l,r)}function Hi(e,t){Pw(e.x,t.x,t.scaleX,t.scale,t.originX),Pw(e.y,t.y,t.scaleY,t.scale,t.originY)}function wT(e,t){return vT(M3(e.getBoundingClientRect(),t))}function D3(e,t,s){const r=wT(e,s),{scroll:i}=t;return i&&(Zi(r.x,i.offset.x),Zi(r.y,i.offset.y)),r}const z3={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},I3=uo.length;function L3(e,t,s){let r="",i=!0;for(let l=0;l<I3;l++){const c=uo[l],f=e[c];if(f===void 0)continue;let p=!0;if(typeof f=="number")p=f===(c.startsWith("scale")?1:0);else{const h=parseFloat(f);p=c.startsWith("scale")?h===1:h===0}if(!p||s){const h=cT(f,Xg[c]);if(!p){i=!1;const g=z3[c]||c;r+=`${g}(${h}) `}s&&(t[c]=h)}}return r=r.trim(),s?r=s(t,i?"":r):i&&(r="none"),r}function ty(e,t,s){const{style:r,vars:i,transformOrigin:l}=e;let c=!1,f=!1;for(const p in t){const h=t[p];if(fo.has(p)){c=!0;continue}else if(MN(p)){i[p]=h;continue}else{const g=cT(h,Xg[p]);p.startsWith("origin")?(f=!0,l[p]=g):r[p]=g}}if(t.transform||(c||s?r.transform=L3(t,e.transform,s):r.transform&&(r.transform="none")),f){const{originX:p="50%",originY:h="50%",originZ:g=0}=l;r.transformOrigin=`${p} ${h} ${g}`}}function ST(e,{style:t,vars:s},r,i){const l=e.style;let c;for(c in t)l[c]=t[c];i?.applyProjectionStyles(l,r);for(c in s)l.setProperty(c,s[c])}function Uw(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}const fl={correct:(e,t)=>{if(!t.target)return e;if(typeof e=="string")if(je.test(e))e=parseFloat(e);else return e;const s=Uw(e,t.target.x),r=Uw(e,t.target.y);return`${s}% ${r}%`}},P3={correct:(e,{treeScale:t,projectionDelta:s})=>{const r=e,i=Es.parse(e);if(i.length>5)return r;const l=Es.createTransformer(e),c=typeof i[0]!="number"?1:0,f=s.x.scale*t.x,p=s.y.scale*t.y;i[0+c]/=f,i[1+c]/=p;const h=_t(f,p,.5);return typeof i[2+c]=="number"&&(i[2+c]/=h),typeof i[3+c]=="number"&&(i[3+c]/=h),l(i)}},Bm={borderRadius:{...fl,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:fl,borderTopRightRadius:fl,borderBottomLeftRadius:fl,borderBottomRightRadius:fl,boxShadow:P3};function ET(e,{layout:t,layoutId:s}){return fo.has(e)||e.startsWith("origin")||(t||s!==void 0)&&(!!Bm[e]||e==="opacity")}function ny(e,t,s){const r=e.style,i=t?.style,l={};if(!r)return l;for(const c in r)(hn(r[c])||i&&hn(i[c])||ET(c,e)||s?.getValue(c)?.liveStyle!==void 0)&&(l[c]=r[c]);return l}function U3(e){return window.getComputedStyle(e)}class $3 extends yT{constructor(){super(...arguments),this.type="html",this.renderInstance=ST}readValueFromInstance(t,s){if(fo.has(s))return this.projection?.isProjecting?Cm(s):a5(t,s);{const r=U3(t),i=(MN(s)?r.getPropertyValue(s):r[s])||0;return typeof i=="string"?i.trim():i}}measureInstanceViewportBox(t,{transformPagePoint:s}){return wT(t,s)}build(t,s,r){ty(t,s,r.transformTemplate)}scrapeMotionValuesFromProps(t,s,r){return ny(t,s,r)}}const V3={offset:"stroke-dashoffset",array:"stroke-dasharray"},B3={offset:"strokeDashoffset",array:"strokeDasharray"};function Z3(e,t,s=1,r=0,i=!0){e.pathLength=1;const l=i?V3:B3;e[l.offset]=`${-r}`,e[l.array]=`${t} ${s}`}const H3=["offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function NT(e,{attrX:t,attrY:s,attrScale:r,pathLength:i,pathSpacing:l=1,pathOffset:c=0,...f},p,h,g){if(ty(e,f,h),p){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};const{attrs:v,style:x}=e;v.transform&&(x.transform=v.transform,delete v.transform),(x.transform||v.transformOrigin)&&(x.transformOrigin=v.transformOrigin??"50% 50%",delete v.transformOrigin),x.transform&&(x.transformBox=g?.transformBox??"fill-box",delete v.transformBox);for(const w of H3)v[w]!==void 0&&(x[w]=v[w],delete v[w]);t!==void 0&&(v.x=t),s!==void 0&&(v.y=s),r!==void 0&&(v.scale=r),i!==void 0&&Z3(v,i,l,c,!1)}const TT=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]),jT=e=>typeof e=="string"&&e.toLowerCase()==="svg";function F3(e,t,s,r){ST(e,t,void 0,r);for(const i in t.attrs)e.setAttribute(TT.has(i)?i:Gg(i),t.attrs[i])}function CT(e,t,s){const r=ny(e,t,s);for(const i in e)if(hn(e[i])||hn(t[i])){const l=uo.indexOf(i)!==-1?"attr"+i.charAt(0).toUpperCase()+i.substring(1):i;r[l]=e[i]}return r}class q3 extends yT{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=Xt}getBaseTargetFromProps(t,s){return t[s]}readValueFromInstance(t,s){if(fo.has(s)){const r=iT(s);return r&&r.default||0}return s=TT.has(s)?s:Gg(s),t.getAttribute(s)}scrapeMotionValuesFromProps(t,s,r){return CT(t,s,r)}build(t,s,r){NT(t,s,this.isSVGTag,r.transformTemplate,r.style)}renderInstance(t,s,r,i){F3(t,s,r,i)}mount(t){this.isSVGTag=jT(t.tagName),super.mount(t)}}const Y3=ey.length;function RT(e){if(!e)return;if(!e.isControllingVariants){const s=e.parent?RT(e.parent)||{}:{};return e.props.initial!==void 0&&(s.initial=e.props.initial),s}const t={};for(let s=0;s<Y3;s++){const r=ey[s],i=e.props[r];(Il(i)||i===!1)&&(t[r]=i)}return t}function AT(e,t){if(!Array.isArray(t))return!1;const s=t.length;if(s!==e.length)return!1;for(let r=0;r<s;r++)if(t[r]!==e[r])return!1;return!0}const G3=[...Qg].reverse(),X3=Qg.length;function K3(e){return t=>Promise.all(t.map(({animation:s,options:r})=>q5(e,s,r)))}function W3(e){let t=K3(e),s=$w(),r=!0;const i=p=>(h,g)=>{const v=Ki(e,g,p==="exit"?e.presenceContext?.custom:void 0);if(v){const{transition:x,transitionEnd:w,...T}=v;h={...h,...T,...w}}return h};function l(p){t=p(e)}function c(p){const{props:h}=e,g=RT(e.parent)||{},v=[],x=new Set;let w={},T=1/0;for(let A=0;A<X3;A++){const C=G3[A],j=s[C],S=h[C]!==void 0?h[C]:g[C],_=Il(S),R=C===p?j.isActive:null;R===!1&&(T=A);let M=S===g[C]&&S!==h[C]&&_;if(M&&r&&e.manuallyAnimateOnMount&&(M=!1),j.protectedKeys={...w},!j.isActive&&R===null||!S&&!j.prevProp||Hd(S)||typeof S=="boolean")continue;if(C==="exit"&&j.isActive&&R!==!0){j.prevResolvedValues&&(w={...w,...j.prevResolvedValues});continue}const O=J3(j.prevProp,S);let I=O||C===p&&j.isActive&&!M&&_||A>T&&_,H=!1;const F=Array.isArray(S)?S:[S];let $=F.reduce(i(C),{});R===!1&&($={});const{prevResolvedValues:L={}}=j,Y={...L,...$},ie=Z=>{I=!0,x.has(Z)&&(H=!0,x.delete(Z)),j.needsAnimating[Z]=!0;const B=e.getValue(Z);B&&(B.liveStyle=!1)};for(const Z in Y){const B=$[Z],re=L[Z];if(w.hasOwnProperty(Z))continue;let J=!1;Om(B)&&Om(re)?J=!AT(B,re):J=B!==re,J?B!=null?ie(Z):x.add(Z):B!==void 0&&x.has(Z)?ie(Z):j.protectedKeys[Z]=!0}j.prevProp=S,j.prevResolvedValues=$,j.isActive&&(w={...w,...$}),r&&e.blockInitialAnimation&&(I=!1);const ee=M&&O;I&&(!ee||H)&&v.push(...F.map(Z=>{const B={type:C};if(typeof Z=="string"&&r&&!ee&&e.manuallyAnimateOnMount&&e.parent){const{parent:re}=e,J=Ki(re,Z);if(re.enteringChildren&&J){const{delayChildren:D}=J.transition||{};B.delay=WN(re.enteringChildren,e,D)}}return{animation:Z,options:B}}))}if(x.size){const A={};if(typeof h.initial!="boolean"){const C=Ki(e,Array.isArray(h.initial)?h.initial[0]:h.initial);C&&C.transition&&(A.transition=C.transition)}x.forEach(C=>{const j=e.getBaseTarget(C),S=e.getValue(C);S&&(S.liveStyle=!0),A[C]=j??null}),v.push({animation:A})}let N=!!v.length;return r&&(h.initial===!1||h.initial===h.animate)&&!e.manuallyAnimateOnMount&&(N=!1),r=!1,N?t(v):Promise.resolve()}function f(p,h){if(s[p].isActive===h)return Promise.resolve();e.variantChildren?.forEach(v=>v.animationState?.setActive(p,h)),s[p].isActive=h;const g=c(p);for(const v in s)s[v].protectedKeys={};return g}return{animateChanges:c,setActive:f,setAnimateFunction:l,getState:()=>s,reset:()=>{s=$w()}}}function J3(e,t){return typeof t=="string"?t!==e:Array.isArray(t)?!AT(t,e):!1}function Ra(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function $w(){return{animate:Ra(!0),whileInView:Ra(),whileHover:Ra(),whileTap:Ra(),whileDrag:Ra(),whileFocus:Ra(),exit:Ra()}}function Vw(e,t){e.min=t.min,e.max=t.max}function ys(e,t){Vw(e.x,t.x),Vw(e.y,t.y)}function Bw(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}const _T=1e-4,Q3=1-_T,e4=1+_T,kT=.01,t4=0-kT,n4=0+kT;function Sn(e){return e.max-e.min}function s4(e,t,s){return Math.abs(e-t)<=s}function Zw(e,t,s,r=.5){e.origin=r,e.originPoint=_t(t.min,t.max,e.origin),e.scale=Sn(s)/Sn(t),e.translate=_t(s.min,s.max,e.origin)-e.originPoint,(e.scale>=Q3&&e.scale<=e4||isNaN(e.scale))&&(e.scale=1),(e.translate>=t4&&e.translate<=n4||isNaN(e.translate))&&(e.translate=0)}function Rl(e,t,s,r){Zw(e.x,t.x,s.x,r?r.originX:void 0),Zw(e.y,t.y,s.y,r?r.originY:void 0)}function Hw(e,t,s){e.min=s.min+t.min,e.max=e.min+Sn(t)}function r4(e,t,s){Hw(e.x,t.x,s.x),Hw(e.y,t.y,s.y)}function Fw(e,t,s){e.min=t.min-s.min,e.max=e.min+Sn(t)}function Ed(e,t,s){Fw(e.x,t.x,s.x),Fw(e.y,t.y,s.y)}function qw(e,t,s,r,i){return e-=t,e=Sd(e,1/s,r),i!==void 0&&(e=Sd(e,1/i,r)),e}function a4(e,t=0,s=1,r=.5,i,l=e,c=e){if(Us.test(t)&&(t=parseFloat(t),t=_t(c.min,c.max,t/100)-c.min),typeof t!="number")return;let f=_t(l.min,l.max,r);e===l&&(f-=t),e.min=qw(e.min,t,s,f,i),e.max=qw(e.max,t,s,f,i)}function Yw(e,t,[s,r,i],l,c){a4(e,t[s],t[r],t[i],t.scale,l,c)}const i4=["x","scaleX","originX"],o4=["y","scaleY","originY"];function Gw(e,t,s,r){Yw(e.x,t,i4,s?s.x:void 0,r?r.x:void 0),Yw(e.y,t,o4,s?s.y:void 0,r?r.y:void 0)}function Xw(e){return e.translate===0&&e.scale===1}function MT(e){return Xw(e.x)&&Xw(e.y)}function Kw(e,t){return e.min===t.min&&e.max===t.max}function l4(e,t){return Kw(e.x,t.x)&&Kw(e.y,t.y)}function Ww(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function OT(e,t){return Ww(e.x,t.x)&&Ww(e.y,t.y)}function Jw(e){return Sn(e.x)/Sn(e.y)}function Qw(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}function Os(e){return[e("x"),e("y")]}function c4(e,t,s){let r="";const i=e.x.translate/t.x,l=e.y.translate/t.y,c=s?.z||0;if((i||l||c)&&(r=`translate3d(${i}px, ${l}px, ${c}px) `),(t.x!==1||t.y!==1)&&(r+=`scale(${1/t.x}, ${1/t.y}) `),s){const{transformPerspective:h,rotate:g,rotateX:v,rotateY:x,skewX:w,skewY:T}=s;h&&(r=`perspective(${h}px) ${r}`),g&&(r+=`rotate(${g}deg) `),v&&(r+=`rotateX(${v}deg) `),x&&(r+=`rotateY(${x}deg) `),w&&(r+=`skewX(${w}deg) `),T&&(r+=`skewY(${T}deg) `)}const f=e.x.scale*t.x,p=e.y.scale*t.y;return(f!==1||p!==1)&&(r+=`scale(${f}, ${p})`),r||"none"}const DT=["TopLeft","TopRight","BottomLeft","BottomRight"],u4=DT.length,e1=e=>typeof e=="string"?parseFloat(e):e,t1=e=>typeof e=="number"||je.test(e);function d4(e,t,s,r,i,l){i?(e.opacity=_t(0,s.opacity??1,f4(r)),e.opacityExit=_t(t.opacity??1,0,h4(r))):l&&(e.opacity=_t(t.opacity??1,s.opacity??1,r));for(let c=0;c<u4;c++){const f=`border${DT[c]}Radius`;let p=n1(t,f),h=n1(s,f);if(p===void 0&&h===void 0)continue;p||(p=0),h||(h=0),p===0||h===0||t1(p)===t1(h)?(e[f]=Math.max(_t(e1(p),e1(h),r),0),(Us.test(h)||Us.test(p))&&(e[f]+="%")):e[f]=h}(t.rotate||s.rotate)&&(e.rotate=_t(t.rotate||0,s.rotate||0,r))}function n1(e,t){return e[t]!==void 0?e[t]:e.borderRadius}const f4=zT(0,.5,jN),h4=zT(.5,.95,us);function zT(e,t,s){return r=>r<e?0:r>t?1:s(Ol(e,t,r))}function p4(e,t,s){const r=hn(e)?e:to(e);return r.start(qg("",r,t,s)),r.animation}function Ll(e,t,s,r={passive:!0}){return e.addEventListener(t,s,r),()=>e.removeEventListener(t,s)}const m4=(e,t)=>e.depth-t.depth;class g4{constructor(){this.children=[],this.isDirty=!1}add(t){kg(this.children,t),this.isDirty=!0}remove(t){yd(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(m4),this.isDirty=!1,this.children.forEach(t)}}function y4(e,t){const s=wn.now(),r=({timestamp:i})=>{const l=i-s;l>=t&&(Jr(r),e(l-t))};return yt.setup(r,!0),()=>Jr(r)}function Ju(e){return hn(e)?e.get():e}class v4{constructor(){this.members=[]}add(t){kg(this.members,t);for(let s=this.members.length-1;s>=0;s--){const r=this.members[s];if(r===t||r===this.lead||r===this.prevLead)continue;const i=r.instance;i&&i.isConnected===!1&&r.isPresent!==!1&&!r.snapshot&&yd(this.members,r)}t.scheduleRender()}remove(t){if(yd(this.members,t),t===this.prevLead&&(this.prevLead=void 0),t===this.lead){const s=this.members[this.members.length-1];s&&this.promote(s)}}relegate(t){const s=this.members.findIndex(i=>t===i);if(s===0)return!1;let r;for(let i=s;i>=0;i--){const l=this.members[i],c=l.instance;if(l.isPresent!==!1&&(!c||c.isConnected!==!1)){r=l;break}}return r?(this.promote(r),!0):!1}promote(t,s){const r=this.lead;if(t!==r&&(this.prevLead=r,this.lead=t,t.show(),r)){r.instance&&r.scheduleRender(),t.scheduleRender();const i=r.options.layoutDependency,l=t.options.layoutDependency;if(!(i!==void 0&&l!==void 0&&i===l)){const p=r.instance;p&&p.isConnected===!1&&!r.snapshot||(t.resumeFrom=r,s&&(t.resumeFrom.preserveOpacity=!0),r.snapshot&&(t.snapshot=r.snapshot,t.snapshot.latestValues=r.animationValues||r.latestValues),t.root&&t.root.isUpdating&&(t.isLayoutDirty=!0))}const{crossfade:f}=t.options;f===!1&&r.hide()}}exitAnimationComplete(){this.members.forEach(t=>{const{options:s,resumingFrom:r}=t;s.onExitComplete&&s.onExitComplete(),r&&r.options.onExitComplete&&r.options.onExitComplete()})}scheduleRender(){this.members.forEach(t=>{t.instance&&t.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}const Qu={hasAnimatedSinceResize:!0,hasEverUpdated:!1},Ip=["","X","Y","Z"],b4=1e3;let x4=0;function Lp(e,t,s,r){const{latestValues:i}=t;i[e]&&(s[e]=i[e],t.setStaticValue(e,0),r&&(r[e]=0))}function IT(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;const{visualElement:t}=e.options;if(!t)return;const s=nT(t);if(window.MotionHasOptimisedAnimation(s,"transform")){const{layout:i,layoutId:l}=e.options;window.MotionCancelOptimisedAnimation(s,"transform",yt,!(i||l))}const{parent:r}=e;r&&!r.hasCheckedOptimisedAppear&&IT(r)}function LT({attachResizeListener:e,defaultParent:t,measureScroll:s,checkIsScrollRoot:r,resetTransform:i}){return class{constructor(c={},f=t?.()){this.id=x4++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.layoutVersion=0,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,this.nodes.forEach(E4),this.nodes.forEach(C4),this.nodes.forEach(R4),this.nodes.forEach(N4)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=c,this.root=f?f.root||f:this,this.path=f?[...f.path,f]:[],this.parent=f,this.depth=f?f.depth+1:0;for(let p=0;p<this.path.length;p++)this.path[p].shouldResetTransform=!0;this.root===this&&(this.nodes=new g4)}addEventListener(c,f){return this.eventHandlers.has(c)||this.eventHandlers.set(c,new Og),this.eventHandlers.get(c).add(f)}notifyListeners(c,...f){const p=this.eventHandlers.get(c);p&&p.notify(...f)}hasListeners(c){return this.eventHandlers.has(c)}mount(c){if(this.instance)return;this.isSVG=Jg(c)&&!S3(c),this.instance=c;const{layoutId:f,layout:p,visualElement:h}=this.options;if(h&&!h.current&&h.mount(c),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(p||f)&&(this.isLayoutDirty=!0),e){let g,v=0;const x=()=>this.root.updateBlockedByResize=!1;yt.read(()=>{v=window.innerWidth}),e(c,()=>{const w=window.innerWidth;w!==v&&(v=w,this.root.updateBlockedByResize=!0,g&&g(),g=y4(x,250),Qu.hasAnimatedSinceResize&&(Qu.hasAnimatedSinceResize=!1,this.nodes.forEach(a1)))})}f&&this.root.registerSharedNode(f,this),this.options.animate!==!1&&h&&(f||p)&&this.addEventListener("didUpdate",({delta:g,hasLayoutChanged:v,hasRelativeLayoutChanged:x,layout:w})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const T=this.options.transition||h.getDefaultTransition()||O4,{onLayoutAnimationStart:N,onLayoutAnimationComplete:A}=h.getProps(),C=!this.targetLayout||!OT(this.targetLayout,w),j=!v&&x;if(this.options.layoutRoot||this.resumeFrom||j||v&&(C||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const S={...Fg(T,"layout"),onPlay:N,onComplete:A};(h.shouldReduceMotion||this.options.layoutRoot)&&(S.delay=0,S.type=!1),this.startAnimation(S),this.setAnimationOrigin(g,j)}else v||a1(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=w})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const c=this.getStack();c&&c.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),Jr(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(A4),this.animationId++)}getTransformTemplate(){const{visualElement:c}=this.options;return c&&c.getProps().transformTemplate}willUpdate(c=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&IT(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let g=0;g<this.path.length;g++){const v=this.path[g];v.shouldResetTransform=!0,v.updateScroll("snapshot"),v.options.layoutRoot&&v.willUpdate(!1)}const{layoutId:f,layout:p}=this.options;if(f===void 0&&!p)return;const h=this.getTransformTemplate();this.prevTransformTemplateValue=h?h(this.latestValues,""):void 0,this.updateSnapshot(),c&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(s1);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(r1);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(j4),this.nodes.forEach(w4),this.nodes.forEach(S4)):this.nodes.forEach(r1),this.clearAllSnapshots();const f=wn.now();on.delta=Vs(0,1e3/60,f-on.timestamp),on.timestamp=f,on.isProcessing=!0,Rp.update.process(on),Rp.preRender.process(on),Rp.render.process(on),on.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,Kg.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(T4),this.sharedNodes.forEach(_4)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,yt.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){yt.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!Sn(this.snapshot.measuredBox.x)&&!Sn(this.snapshot.measuredBox.y)&&(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let p=0;p<this.path.length;p++)this.path[p].updateScroll();const c=this.layout;this.layout=this.measure(!1),this.layoutVersion++,this.layoutCorrected=Xt(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:f}=this.options;f&&f.notify("LayoutMeasure",this.layout.layoutBox,c?c.layoutBox:void 0)}updateScroll(c="measure"){let f=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===c&&(f=!1),f&&this.instance){const p=r(this.instance);this.scroll={animationId:this.root.animationId,phase:c,isRoot:p,offset:s(this.instance),wasRoot:this.scroll?this.scroll.isRoot:p}}}resetTransform(){if(!i)return;const c=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,f=this.projectionDelta&&!MT(this.projectionDelta),p=this.getTransformTemplate(),h=p?p(this.latestValues,""):void 0,g=h!==this.prevTransformTemplateValue;c&&this.instance&&(f||Ma(this.latestValues)||g)&&(i(this.instance,h),this.shouldResetTransform=!1,this.scheduleRender())}measure(c=!0){const f=this.measurePageBox();let p=this.removeElementScroll(f);return c&&(p=this.removeTransform(p)),D4(p),{animationId:this.root.animationId,measuredBox:f,layoutBox:p,latestValues:{},source:this.id}}measurePageBox(){const{visualElement:c}=this.options;if(!c)return Xt();const f=c.measureViewportBox();if(!(this.scroll?.wasRoot||this.path.some(z4))){const{scroll:h}=this.root;h&&(Zi(f.x,h.offset.x),Zi(f.y,h.offset.y))}return f}removeElementScroll(c){const f=Xt();if(ys(f,c),this.scroll?.wasRoot)return f;for(let p=0;p<this.path.length;p++){const h=this.path[p],{scroll:g,options:v}=h;h!==this.root&&g&&v.layoutScroll&&(g.wasRoot&&ys(f,c),Zi(f.x,g.offset.x),Zi(f.y,g.offset.y))}return f}applyTransform(c,f=!1){const p=Xt();ys(p,c);for(let h=0;h<this.path.length;h++){const g=this.path[h];!f&&g.options.layoutScroll&&g.scroll&&g!==g.root&&Hi(p,{x:-g.scroll.offset.x,y:-g.scroll.offset.y}),Ma(g.latestValues)&&Hi(p,g.latestValues)}return Ma(this.latestValues)&&Hi(p,this.latestValues),p}removeTransform(c){const f=Xt();ys(f,c);for(let p=0;p<this.path.length;p++){const h=this.path[p];if(!h.instance||!Ma(h.latestValues))continue;$m(h.latestValues)&&h.updateSnapshot();const g=Xt(),v=h.measurePageBox();ys(g,v),Gw(f,h.latestValues,h.snapshot?h.snapshot.layoutBox:void 0,g)}return Ma(this.latestValues)&&Gw(f,this.latestValues),f}setTargetDelta(c){this.targetDelta=c,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(c){this.options={...this.options,...c,crossfade:c.crossfade!==void 0?c.crossfade:!0}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==on.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(c=!1){const f=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=f.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=f.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=f.isSharedProjectionDirty);const p=!!this.resumingFrom||this!==f;if(!(c||p&&this.isSharedProjectionDirty||this.isProjectionDirty||this.parent?.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:g,layoutId:v}=this.options;if(!this.layout||!(g||v))return;this.resolvedRelativeTargetAt=on.timestamp;const x=this.getClosestProjectingParent();x&&this.linkedParentVersion!==x.layoutVersion&&!x.options.layoutRoot&&this.removeRelativeTarget(),!this.targetDelta&&!this.relativeTarget&&(x&&x.layout?this.createRelativeTarget(x,this.layout.layoutBox,x.layout.layoutBox):this.removeRelativeTarget()),!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=Xt(),this.targetWithTransforms=Xt()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),r4(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):ys(this.target,this.layout.layoutBox),xT(this.target,this.targetDelta)):ys(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,x&&!!x.resumingFrom==!!this.resumingFrom&&!x.options.layoutScroll&&x.target&&this.animationProgress!==1?this.createRelativeTarget(x,this.target,x.target):this.relativeParent=this.relativeTarget=void 0))}getClosestProjectingParent(){if(!(!this.parent||$m(this.parent.latestValues)||bT(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(c,f,p){this.relativeParent=c,this.linkedParentVersion=c.layoutVersion,this.forceRelativeParentToResolveTarget(),this.relativeTarget=Xt(),this.relativeTargetOrigin=Xt(),Ed(this.relativeTargetOrigin,f,p),ys(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){const c=this.getLead(),f=!!this.resumingFrom||this!==c;let p=!0;if((this.isProjectionDirty||this.parent?.isProjectionDirty)&&(p=!1),f&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(p=!1),this.resolvedRelativeTargetAt===on.timestamp&&(p=!1),p)return;const{layout:h,layoutId:g}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(h||g))return;ys(this.layoutCorrected,this.layout.layoutBox);const v=this.treeScale.x,x=this.treeScale.y;O3(this.layoutCorrected,this.treeScale,this.path,f),c.layout&&!c.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(c.target=c.layout.layoutBox,c.targetWithTransforms=Xt());const{target:w}=c;if(!w){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(Bw(this.prevProjectionDelta.x,this.projectionDelta.x),Bw(this.prevProjectionDelta.y,this.projectionDelta.y)),Rl(this.projectionDelta,this.layoutCorrected,w,this.latestValues),(this.treeScale.x!==v||this.treeScale.y!==x||!Qw(this.projectionDelta.x,this.prevProjectionDelta.x)||!Qw(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",w))}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(c=!0){if(this.options.visualElement?.scheduleRender(),c){const f=this.getStack();f&&f.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=Bi(),this.projectionDelta=Bi(),this.projectionDeltaWithTransform=Bi()}setAnimationOrigin(c,f=!1){const p=this.snapshot,h=p?p.latestValues:{},g={...this.latestValues},v=Bi();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!f;const x=Xt(),w=p?p.source:void 0,T=this.layout?this.layout.source:void 0,N=w!==T,A=this.getStack(),C=!A||A.members.length<=1,j=!!(N&&!C&&this.options.crossfade===!0&&!this.path.some(M4));this.animationProgress=0;let S;this.mixTargetDelta=_=>{const R=_/1e3;i1(v.x,c.x,R),i1(v.y,c.y,R),this.setTargetDelta(v),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Ed(x,this.layout.layoutBox,this.relativeParent.layout.layoutBox),k4(this.relativeTarget,this.relativeTargetOrigin,x,R),S&&l4(this.relativeTarget,S)&&(this.isProjectionDirty=!1),S||(S=Xt()),ys(S,this.relativeTarget)),N&&(this.animationValues=g,d4(g,h,this.latestValues,R,j,C)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=R},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(c){this.notifyListeners("animationStart"),this.currentAnimation?.stop(),this.resumingFrom?.currentAnimation?.stop(),this.pendingAnimation&&(Jr(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=yt.update(()=>{Qu.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=to(0)),this.motionValue.jump(0,!1),this.currentAnimation=p4(this.motionValue,[0,1e3],{...c,velocity:0,isSync:!0,onUpdate:f=>{this.mixTargetDelta(f),c.onUpdate&&c.onUpdate(f)},onStop:()=>{},onComplete:()=>{c.onComplete&&c.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const c=this.getStack();c&&c.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(b4),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const c=this.getLead();let{targetWithTransforms:f,target:p,layout:h,latestValues:g}=c;if(!(!f||!p||!h)){if(this!==c&&this.layout&&h&&PT(this.options.animationType,this.layout.layoutBox,h.layoutBox)){p=this.target||Xt();const v=Sn(this.layout.layoutBox.x);p.x.min=c.target.x.min,p.x.max=p.x.min+v;const x=Sn(this.layout.layoutBox.y);p.y.min=c.target.y.min,p.y.max=p.y.min+x}ys(f,p),Hi(f,g),Rl(this.projectionDeltaWithTransform,this.layoutCorrected,f,g)}}registerSharedNode(c,f){this.sharedNodes.has(c)||this.sharedNodes.set(c,new v4),this.sharedNodes.get(c).add(f);const h=f.options.initialPromotionConfig;f.promote({transition:h?h.transition:void 0,preserveFollowOpacity:h&&h.shouldPreserveFollowOpacity?h.shouldPreserveFollowOpacity(f):void 0})}isLead(){const c=this.getStack();return c?c.lead===this:!0}getLead(){const{layoutId:c}=this.options;return c?this.getStack()?.lead||this:this}getPrevLead(){const{layoutId:c}=this.options;return c?this.getStack()?.prevLead:void 0}getStack(){const{layoutId:c}=this.options;if(c)return this.root.sharedNodes.get(c)}promote({needsReset:c,transition:f,preserveFollowOpacity:p}={}){const h=this.getStack();h&&h.promote(this,p),c&&(this.projectionDelta=void 0,this.needsReset=!0),f&&this.setOptions({transition:f})}relegate(){const c=this.getStack();return c?c.relegate(this):!1}resetSkewAndRotation(){const{visualElement:c}=this.options;if(!c)return;let f=!1;const{latestValues:p}=c;if((p.z||p.rotate||p.rotateX||p.rotateY||p.rotateZ||p.skewX||p.skewY)&&(f=!0),!f)return;const h={};p.z&&Lp("z",c,h,this.animationValues);for(let g=0;g<Ip.length;g++)Lp(`rotate${Ip[g]}`,c,h,this.animationValues),Lp(`skew${Ip[g]}`,c,h,this.animationValues);c.render();for(const g in h)c.setStaticValue(g,h[g]),this.animationValues&&(this.animationValues[g]=h[g]);c.scheduleRender()}applyProjectionStyles(c,f){if(!this.instance||this.isSVG)return;if(!this.isVisible){c.visibility="hidden";return}const p=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,c.visibility="",c.opacity="",c.pointerEvents=Ju(f?.pointerEvents)||"",c.transform=p?p(this.latestValues,""):"none";return}const h=this.getLead();if(!this.projectionDelta||!this.layout||!h.target){this.options.layoutId&&(c.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,c.pointerEvents=Ju(f?.pointerEvents)||""),this.hasProjected&&!Ma(this.latestValues)&&(c.transform=p?p({},""):"none",this.hasProjected=!1);return}c.visibility="";const g=h.animationValues||h.latestValues;this.applyTransformsToTarget();let v=c4(this.projectionDeltaWithTransform,this.treeScale,g);p&&(v=p(g,v)),c.transform=v;const{x,y:w}=this.projectionDelta;c.transformOrigin=`${x.origin*100}% ${w.origin*100}% 0`,h.animationValues?c.opacity=h===this?g.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:g.opacityExit:c.opacity=h===this?g.opacity!==void 0?g.opacity:"":g.opacityExit!==void 0?g.opacityExit:0;for(const T in Bm){if(g[T]===void 0)continue;const{correct:N,applyTo:A,isCSSVariable:C}=Bm[T],j=v==="none"?g[T]:N(g[T],h);if(A){const S=A.length;for(let _=0;_<S;_++)c[A[_]]=j}else C?this.options.visualElement.renderState.vars[T]=j:c[T]=j}this.options.layoutId&&(c.pointerEvents=h===this?Ju(f?.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(c=>c.currentAnimation?.stop()),this.root.nodes.forEach(s1),this.root.sharedNodes.clear()}}}function w4(e){e.updateLayout()}function S4(e){const t=e.resumeFrom?.snapshot||e.snapshot;if(e.isLead()&&e.layout&&t&&e.hasListeners("didUpdate")){const{layoutBox:s,measuredBox:r}=e.layout,{animationType:i}=e.options,l=t.source!==e.layout.source;i==="size"?Os(g=>{const v=l?t.measuredBox[g]:t.layoutBox[g],x=Sn(v);v.min=s[g].min,v.max=v.min+x}):PT(i,t.layoutBox,s)&&Os(g=>{const v=l?t.measuredBox[g]:t.layoutBox[g],x=Sn(s[g]);v.max=v.min+x,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[g].max=e.relativeTarget[g].min+x)});const c=Bi();Rl(c,s,t.layoutBox);const f=Bi();l?Rl(f,e.applyTransform(r,!0),t.measuredBox):Rl(f,s,t.layoutBox);const p=!MT(c);let h=!1;if(!e.resumeFrom){const g=e.getClosestProjectingParent();if(g&&!g.resumeFrom){const{snapshot:v,layout:x}=g;if(v&&x){const w=Xt();Ed(w,t.layoutBox,v.layoutBox);const T=Xt();Ed(T,s,x.layoutBox),OT(w,T)||(h=!0),g.options.layoutRoot&&(e.relativeTarget=T,e.relativeTargetOrigin=w,e.relativeParent=g)}}}e.notifyListeners("didUpdate",{layout:s,snapshot:t,delta:f,layoutDelta:c,hasLayoutChanged:p,hasRelativeLayoutChanged:h})}else if(e.isLead()){const{onExitComplete:s}=e.options;s&&s()}e.options.transition=void 0}function E4(e){e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||(e.isSharedProjectionDirty=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty)),e.isTransformDirty||(e.isTransformDirty=e.parent.isTransformDirty))}function N4(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function T4(e){e.clearSnapshot()}function s1(e){e.clearMeasurements()}function r1(e){e.isLayoutDirty=!1}function j4(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function a1(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function C4(e){e.resolveTargetDelta()}function R4(e){e.calcProjection()}function A4(e){e.resetSkewAndRotation()}function _4(e){e.removeLeadSnapshot()}function i1(e,t,s){e.translate=_t(t.translate,0,s),e.scale=_t(t.scale,1,s),e.origin=t.origin,e.originPoint=t.originPoint}function o1(e,t,s,r){e.min=_t(t.min,s.min,r),e.max=_t(t.max,s.max,r)}function k4(e,t,s,r){o1(e.x,t.x,s.x,r),o1(e.y,t.y,s.y,r)}function M4(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}const O4={duration:.45,ease:[.4,0,.1,1]},l1=e=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),c1=l1("applewebkit/")&&!l1("chrome/")?Math.round:us;function u1(e){e.min=c1(e.min),e.max=c1(e.max)}function D4(e){u1(e.x),u1(e.y)}function PT(e,t,s){return e==="position"||e==="preserve-aspect"&&!s4(Jw(t),Jw(s),.2)}function z4(e){return e!==e.root&&e.scroll?.wasRoot}const I4=LT({attachResizeListener:(e,t)=>Ll(e,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body?.scrollLeft||0,y:document.documentElement.scrollTop||document.body?.scrollTop||0}),checkIsScrollRoot:()=>!0}),Pp={current:void 0},UT=LT({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!Pp.current){const e=new I4({});e.mount(window),e.setOptions({layoutScroll:!0}),Pp.current=e}return Pp.current},resetTransform:(e,t)=>{e.style.transform=t!==void 0?t:"none"},checkIsScrollRoot:e=>window.getComputedStyle(e).position==="fixed"}),sy=b.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});function d1(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function L4(...e){return t=>{let s=!1;const r=e.map(i=>{const l=d1(i,t);return!s&&typeof l=="function"&&(s=!0),l});if(s)return()=>{for(let i=0;i<r.length;i++){const l=r[i];typeof l=="function"?l():d1(e[i],null)}}}}function P4(...e){return b.useCallback(L4(...e),e)}class U4 extends b.Component{getSnapshotBeforeUpdate(t){const s=this.props.childRef.current;if(s&&t.isPresent&&!this.props.isPresent&&this.props.pop!==!1){const r=s.offsetParent,i=Pm(r)&&r.offsetWidth||0,l=Pm(r)&&r.offsetHeight||0,c=this.props.sizeRef.current;c.height=s.offsetHeight||0,c.width=s.offsetWidth||0,c.top=s.offsetTop,c.left=s.offsetLeft,c.right=i-c.width-c.left,c.bottom=l-c.height-c.top}return null}componentDidUpdate(){}render(){return this.props.children}}function $4({children:e,isPresent:t,anchorX:s,anchorY:r,root:i,pop:l}){const c=b.useId(),f=b.useRef(null),p=b.useRef({width:0,height:0,top:0,left:0,right:0,bottom:0}),{nonce:h}=b.useContext(sy),g=e.props?.ref??e?.ref,v=P4(f,g);return b.useInsertionEffect(()=>{const{width:x,height:w,top:T,left:N,right:A,bottom:C}=p.current;if(t||l===!1||!f.current||!x||!w)return;const j=s==="left"?`left: ${N}`:`right: ${A}`,S=r==="bottom"?`bottom: ${C}`:`top: ${T}`;f.current.dataset.motionPopId=c;const _=document.createElement("style");h&&(_.nonce=h);const R=i??document.head;return R.appendChild(_),_.sheet&&_.sheet.insertRule(`
21
- [data-motion-pop-id="${c}"] {
22
- position: absolute !important;
23
- width: ${x}px !important;
24
- height: ${w}px !important;
25
- ${j}px !important;
26
- ${S}px !important;
27
- }
28
- `),()=>{R.contains(_)&&R.removeChild(_)}},[t]),d.jsx(U4,{isPresent:t,childRef:f,sizeRef:p,pop:l,children:l===!1?e:b.cloneElement(e,{ref:v})})}const V4=({children:e,initial:t,isPresent:s,onExitComplete:r,custom:i,presenceAffectsLayout:l,mode:c,anchorX:f,anchorY:p,root:h})=>{const g=_g(B4),v=b.useId();let x=!0,w=b.useMemo(()=>(x=!1,{id:v,initial:t,isPresent:s,custom:i,onExitComplete:T=>{g.set(T,!0);for(const N of g.values())if(!N)return;r&&r()},register:T=>(g.set(T,!1),()=>g.delete(T))}),[s,g,r]);return l&&x&&(w={...w}),b.useMemo(()=>{g.forEach((T,N)=>g.set(N,!1))},[s]),b.useEffect(()=>{!s&&!g.size&&r&&r()},[s]),e=d.jsx($4,{pop:c==="popLayout",isPresent:s,anchorX:f,anchorY:p,root:h,children:e}),d.jsx(Zd.Provider,{value:w,children:e})};function B4(){return new Map}function $T(e=!0){const t=b.useContext(Zd);if(t===null)return[!0,null];const{isPresent:s,onExitComplete:r,register:i}=t,l=b.useId();b.useEffect(()=>{if(e)return i(l)},[e]);const c=b.useCallback(()=>e&&r&&r(l),[l,r,e]);return!s&&r?[!1,c]:[!0]}const Ru=e=>e.key||"";function f1(e){const t=[];return b.Children.forEach(e,s=>{b.isValidElement(s)&&t.push(s)}),t}const Z4=({children:e,custom:t,initial:s=!0,onExitComplete:r,presenceAffectsLayout:i=!0,mode:l="sync",propagate:c=!1,anchorX:f="left",anchorY:p="top",root:h})=>{const[g,v]=$T(c),x=b.useMemo(()=>f1(e),[e]),w=c&&!g?[]:x.map(Ru),T=b.useRef(!0),N=b.useRef(x),A=_g(()=>new Map),C=b.useRef(new Set),[j,S]=b.useState(x),[_,R]=b.useState(x);pN(()=>{T.current=!1,N.current=x;for(let I=0;I<_.length;I++){const H=Ru(_[I]);w.includes(H)?(A.delete(H),C.current.delete(H)):A.get(H)!==!0&&A.set(H,!1)}},[_,w.length,w.join("-")]);const M=[];if(x!==j){let I=[...x];for(let H=0;H<_.length;H++){const F=_[H],$=Ru(F);w.includes($)||(I.splice(H,0,F),M.push(F))}return l==="wait"&&M.length&&(I=M),R(f1(I)),S(x),null}const{forceRender:O}=b.useContext(Ag);return d.jsx(d.Fragment,{children:_.map(I=>{const H=Ru(I),F=c&&!g?!1:x===_||w.includes(H),$=()=>{if(C.current.has(H))return;if(C.current.add(H),A.has(H))A.set(H,!0);else return;let L=!0;A.forEach(Y=>{Y||(L=!1)}),L&&(O?.(),R(N.current),c&&v?.(),r&&r())};return d.jsx(V4,{isPresent:F,initial:!T.current||s?void 0:!1,custom:t,presenceAffectsLayout:i,mode:l,root:h,onExitComplete:F?void 0:$,anchorX:f,anchorY:p,children:I},H)})})},VT=b.createContext({strict:!1}),h1={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]};let p1=!1;function H4(){if(p1)return;const e={};for(const t in h1)e[t]={isEnabled:s=>h1[t].some(r=>!!s[r])};gT(e),p1=!0}function BT(){return H4(),A3()}function F4(e){const t=BT();for(const s in e)t[s]={...t[s],...e[s]};gT(t)}const q4=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","propagate","ignoreStrict","viewport"]);function Nd(e){return e.startsWith("while")||e.startsWith("drag")&&e!=="draggable"||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||q4.has(e)}let ZT=e=>!Nd(e);function Y4(e){typeof e=="function"&&(ZT=t=>t.startsWith("on")?!Nd(t):e(t))}try{Y4(require("@emotion/is-prop-valid").default)}catch{}function G4(e,t,s){const r={};for(const i in e)i==="values"&&typeof e.values=="object"||(ZT(i)||s===!0&&Nd(i)||!t&&!Nd(i)||e.draggable&&i.startsWith("onDrag"))&&(r[i]=e[i]);return r}const qd=b.createContext({});function X4(e,t){if(Fd(e)){const{initial:s,animate:r}=e;return{initial:s===!1||Il(s)?s:void 0,animate:Il(r)?r:void 0}}return e.inherit!==!1?t:{}}function K4(e){const{initial:t,animate:s}=X4(e,b.useContext(qd));return b.useMemo(()=>({initial:t,animate:s}),[m1(t),m1(s)])}function m1(e){return Array.isArray(e)?e.join(" "):e}const ry=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function HT(e,t,s){for(const r in t)!hn(t[r])&&!ET(r,s)&&(e[r]=t[r])}function W4({transformTemplate:e},t){return b.useMemo(()=>{const s=ry();return ty(s,t,e),Object.assign({},s.vars,s.style)},[t])}function J4(e,t){const s=e.style||{},r={};return HT(r,s,e),Object.assign(r,W4(e,t)),r}function Q4(e,t){const s={},r=J4(e,t);return e.drag&&e.dragListener!==!1&&(s.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout="none",r.touchAction=e.drag===!0?"none":`pan-${e.drag==="x"?"y":"x"}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(s.tabIndex=0),s.style=r,s}const FT=()=>({...ry(),attrs:{}});function eI(e,t,s,r){const i=b.useMemo(()=>{const l=FT();return NT(l,t,jT(r),e.transformTemplate,e.style),{...l.attrs,style:{...l.style}}},[t]);if(e.style){const l={};HT(l,e.style,e),i.style={...l,...i.style}}return i}const tI=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function ay(e){return typeof e!="string"||e.includes("-")?!1:!!(tI.indexOf(e)>-1||/[A-Z]/u.test(e))}function nI(e,t,s,{latestValues:r},i,l=!1,c){const p=(c??ay(e)?eI:Q4)(t,r,i,e),h=G4(t,typeof e=="string",l),g=e!==b.Fragment?{...h,...p,ref:s}:{},{children:v}=t,x=b.useMemo(()=>hn(v)?v.get():v,[v]);return b.createElement(e,{...g,children:x})}function sI({scrapeMotionValuesFromProps:e,createRenderState:t},s,r,i){return{latestValues:rI(s,r,i,e),renderState:t()}}function rI(e,t,s,r){const i={},l=r(e,{});for(const x in l)i[x]=Ju(l[x]);let{initial:c,animate:f}=e;const p=Fd(e),h=pT(e);t&&h&&!p&&e.inherit!==!1&&(c===void 0&&(c=t.initial),f===void 0&&(f=t.animate));let g=s?s.initial===!1:!1;g=g||c===!1;const v=g?f:c;if(v&&typeof v!="boolean"&&!Hd(v)){const x=Array.isArray(v)?v:[v];for(let w=0;w<x.length;w++){const T=Yg(e,x[w]);if(T){const{transitionEnd:N,transition:A,...C}=T;for(const j in C){let S=C[j];if(Array.isArray(S)){const _=g?S.length-1:0;S=S[_]}S!==null&&(i[j]=S)}for(const j in N)i[j]=N[j]}}}return i}const qT=e=>(t,s)=>{const r=b.useContext(qd),i=b.useContext(Zd),l=()=>sI(e,t,r,i);return s?l():_g(l)},aI=qT({scrapeMotionValuesFromProps:ny,createRenderState:ry}),iI=qT({scrapeMotionValuesFromProps:CT,createRenderState:FT}),oI=Symbol.for("motionComponentSymbol");function lI(e,t,s){const r=b.useRef(s);b.useInsertionEffect(()=>{r.current=s});const i=b.useRef(null);return b.useCallback(l=>{l&&e.onMount?.(l),t&&(l?t.mount(l):t.unmount());const c=r.current;if(typeof c=="function")if(l){const f=c(l);typeof f=="function"&&(i.current=f)}else i.current?(i.current(),i.current=null):c(l);else c&&(c.current=l)},[t])}const YT=b.createContext({});function Ii(e){return e&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function cI(e,t,s,r,i,l){const{visualElement:c}=b.useContext(qd),f=b.useContext(VT),p=b.useContext(Zd),h=b.useContext(sy),g=h.reducedMotion,v=h.skipAnimations,x=b.useRef(null),w=b.useRef(!1);r=r||f.renderer,!x.current&&r&&(x.current=r(e,{visualState:t,parent:c,props:s,presenceContext:p,blockInitialAnimation:p?p.initial===!1:!1,reducedMotionConfig:g,skipAnimations:v,isSVG:l}),w.current&&x.current&&(x.current.manuallyAnimateOnMount=!0));const T=x.current,N=b.useContext(YT);T&&!T.projection&&i&&(T.type==="html"||T.type==="svg")&&uI(x.current,s,i,N);const A=b.useRef(!1);b.useInsertionEffect(()=>{T&&A.current&&T.update(s,p)});const C=s[tT],j=b.useRef(!!C&&!window.MotionHandoffIsComplete?.(C)&&window.MotionHasOptimisedAnimation?.(C));return pN(()=>{w.current=!0,T&&(A.current=!0,window.MotionIsMounted=!0,T.updateFeatures(),T.scheduleRenderMicrotask(),j.current&&T.animationState&&T.animationState.animateChanges())}),b.useEffect(()=>{T&&(!j.current&&T.animationState&&T.animationState.animateChanges(),j.current&&(queueMicrotask(()=>{window.MotionHandoffMarkAsComplete?.(C)}),j.current=!1),T.enteringChildren=void 0)}),T}function uI(e,t,s,r){const{layoutId:i,layout:l,drag:c,dragConstraints:f,layoutScroll:p,layoutRoot:h,layoutCrossfade:g}=t;e.projection=new s(e.latestValues,t["data-framer-portal-id"]?void 0:GT(e.parent)),e.projection.setOptions({layoutId:i,layout:l,alwaysMeasureLayout:!!c||f&&Ii(f),visualElement:e,animationType:typeof l=="string"?l:"both",initialPromotionConfig:r,crossfade:g,layoutScroll:p,layoutRoot:h})}function GT(e){if(e)return e.options.allowProjection!==!1?e.projection:GT(e.parent)}function Up(e,{forwardMotionProps:t=!1,type:s}={},r,i){r&&F4(r);const l=s?s==="svg":ay(e),c=l?iI:aI;function f(h,g){let v;const x={...b.useContext(sy),...h,layoutId:dI(h)},{isStatic:w}=x,T=K4(h),N=c(h,w);if(!w&&hN){fI();const A=hI(x);v=A.MeasureLayout,T.visualElement=cI(e,N,x,i,A.ProjectionNode,l)}return d.jsxs(qd.Provider,{value:T,children:[v&&T.visualElement?d.jsx(v,{visualElement:T.visualElement,...x}):null,nI(e,h,lI(N,T.visualElement,g),N,w,t,l)]})}f.displayName=`motion.${typeof e=="string"?e:`create(${e.displayName??e.name??""})`}`;const p=b.forwardRef(f);return p[oI]=e,p}function dI({layoutId:e}){const t=b.useContext(Ag).id;return t&&e!==void 0?t+"-"+e:e}function fI(e,t){b.useContext(VT).strict}function hI(e){const t=BT(),{drag:s,layout:r}=t;if(!s&&!r)return{};const i={...s,...r};return{MeasureLayout:s?.isEnabled(e)||r?.isEnabled(e)?i.MeasureLayout:void 0,ProjectionNode:i.ProjectionNode}}function pI(e,t){if(typeof Proxy>"u")return Up;const s=new Map,r=(l,c)=>Up(l,c,e,t),i=(l,c)=>r(l,c);return new Proxy(i,{get:(l,c)=>c==="create"?r:(s.has(c)||s.set(c,Up(c,void 0,e,t)),s.get(c))})}const mI=(e,t)=>t.isSVG??ay(e)?new q3(t):new $3(t,{allowProjection:e!==b.Fragment});class gI extends ia{constructor(t){super(t),t.animationState||(t.animationState=W3(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();Hd(t)&&(this.unmountControls=t.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:t}=this.node.getProps(),{animate:s}=this.node.prevProps||{};t!==s&&this.updateAnimationControlsSubscription()}unmount(){this.node.animationState.reset(),this.unmountControls?.()}}let yI=0;class vI extends ia{constructor(){super(...arguments),this.id=yI++}update(){if(!this.node.presenceContext)return;const{isPresent:t,onExitComplete:s}=this.node.presenceContext,{isPresent:r}=this.node.prevPresenceContext||{};if(!this.node.animationState||t===r)return;const i=this.node.animationState.setActive("exit",!t);s&&!t&&i.then(()=>{s(this.id)})}mount(){const{register:t,onExitComplete:s}=this.node.presenceContext||{};s&&s(this.id),t&&(this.unmount=t(this.id))}unmount(){}}const bI={animation:{Feature:gI},exit:{Feature:vI}};function Kl(e){return{point:{x:e.pageX,y:e.pageY}}}const xI=e=>t=>Wg(t)&&e(t,Kl(t));function Al(e,t,s,r){return Ll(e,t,xI(s),r)}const XT=({current:e})=>e?e.ownerDocument.defaultView:null,g1=(e,t)=>Math.abs(e-t);function wI(e,t){const s=g1(e.x,t.x),r=g1(e.y,t.y);return Math.sqrt(s**2+r**2)}const y1=new Set(["auto","scroll"]);class KT{constructor(t,s,{transformPagePoint:r,contextWindow:i=window,dragSnapToOrigin:l=!1,distanceThreshold:c=3,element:f}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.removeScrollListeners=null,this.onElementScroll=w=>{this.handleScroll(w.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const w=Vp(this.lastMoveEventInfo,this.history),T=this.startEvent!==null,N=wI(w.offset,{x:0,y:0})>=this.distanceThreshold;if(!T&&!N)return;const{point:A}=w,{timestamp:C}=on;this.history.push({...A,timestamp:C});const{onStart:j,onMove:S}=this.handlers;T||(j&&j(this.lastMoveEvent,w),this.startEvent=this.lastMoveEvent),S&&S(this.lastMoveEvent,w)},this.handlePointerMove=(w,T)=>{this.lastMoveEvent=w,this.lastMoveEventInfo=$p(T,this.transformPagePoint),yt.update(this.updatePoint,!0)},this.handlePointerUp=(w,T)=>{this.end();const{onEnd:N,onSessionEnd:A,resumeAnimation:C}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&C&&C(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const j=Vp(w.type==="pointercancel"?this.lastMoveEventInfo:$p(T,this.transformPagePoint),this.history);this.startEvent&&N&&N(w,j),A&&A(w,j)},!Wg(t))return;this.dragSnapToOrigin=l,this.handlers=s,this.transformPagePoint=r,this.distanceThreshold=c,this.contextWindow=i||window;const p=Kl(t),h=$p(p,this.transformPagePoint),{point:g}=h,{timestamp:v}=on;this.history=[{...g,timestamp:v}];const{onSessionStart:x}=s;x&&x(t,Vp(h,this.history)),this.removeListeners=Yl(Al(this.contextWindow,"pointermove",this.handlePointerMove),Al(this.contextWindow,"pointerup",this.handlePointerUp),Al(this.contextWindow,"pointercancel",this.handlePointerUp)),f&&this.startScrollTracking(f)}startScrollTracking(t){let s=t.parentElement;for(;s;){const r=getComputedStyle(s);(y1.has(r.overflowX)||y1.has(r.overflowY))&&this.scrollPositions.set(s,{x:s.scrollLeft,y:s.scrollTop}),s=s.parentElement}this.scrollPositions.set(window,{x:window.scrollX,y:window.scrollY}),window.addEventListener("scroll",this.onElementScroll,{capture:!0}),window.addEventListener("scroll",this.onWindowScroll),this.removeScrollListeners=()=>{window.removeEventListener("scroll",this.onElementScroll,{capture:!0}),window.removeEventListener("scroll",this.onWindowScroll)}}handleScroll(t){const s=this.scrollPositions.get(t);if(!s)return;const r=t===window,i=r?{x:window.scrollX,y:window.scrollY}:{x:t.scrollLeft,y:t.scrollTop},l={x:i.x-s.x,y:i.y-s.y};l.x===0&&l.y===0||(r?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=l.x,this.lastMoveEventInfo.point.y+=l.y):this.history.length>0&&(this.history[0].x-=l.x,this.history[0].y-=l.y),this.scrollPositions.set(t,i),yt.update(this.updatePoint,!0))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),Jr(this.updatePoint)}}function $p(e,t){return t?{point:t(e.point)}:e}function v1(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Vp({point:e},t){return{point:e,delta:v1(e,WT(t)),offset:v1(e,SI(t)),velocity:EI(t,.1)}}function SI(e){return e[0]}function WT(e){return e[e.length-1]}function EI(e,t){if(e.length<2)return{x:0,y:0};let s=e.length-1,r=null;const i=WT(e);for(;s>=0&&(r=e[s],!(i.timestamp-r.timestamp>Ss(t)));)s--;if(!r)return{x:0,y:0};r===e[0]&&e.length>2&&i.timestamp-r.timestamp>Ss(t)*2&&(r=e[1]);const l=cs(i.timestamp-r.timestamp);if(l===0)return{x:0,y:0};const c={x:(i.x-r.x)/l,y:(i.y-r.y)/l};return c.x===1/0&&(c.x=0),c.y===1/0&&(c.y=0),c}function NI(e,{min:t,max:s},r){return t!==void 0&&e<t?e=r?_t(t,e,r.min):Math.max(e,t):s!==void 0&&e>s&&(e=r?_t(s,e,r.max):Math.min(e,s)),e}function b1(e,t,s){return{min:t!==void 0?e.min+t:void 0,max:s!==void 0?e.max+s-(e.max-e.min):void 0}}function TI(e,{top:t,left:s,bottom:r,right:i}){return{x:b1(e.x,s,i),y:b1(e.y,t,r)}}function x1(e,t){let s=t.min-e.min,r=t.max-e.max;return t.max-t.min<e.max-e.min&&([s,r]=[r,s]),{min:s,max:r}}function jI(e,t){return{x:x1(e.x,t.x),y:x1(e.y,t.y)}}function CI(e,t){let s=.5;const r=Sn(e),i=Sn(t);return i>r?s=Ol(t.min,t.max-r,e.min):r>i&&(s=Ol(e.min,e.max-i,t.min)),Vs(0,1,s)}function RI(e,t){const s={};return t.min!==void 0&&(s.min=t.min-e.min),t.max!==void 0&&(s.max=t.max-e.min),s}const Zm=.35;function AI(e=Zm){return e===!1?e=0:e===!0&&(e=Zm),{x:w1(e,"left","right"),y:w1(e,"top","bottom")}}function w1(e,t,s){return{min:S1(e,t),max:S1(e,s)}}function S1(e,t){return typeof e=="number"?e:e[t]||0}const _I=new WeakMap;class kI{constructor(t){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=Xt(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=t}start(t,{snapToCursor:s=!1,distanceThreshold:r}={}){const{presenceContext:i}=this.visualElement;if(i&&i.isPresent===!1)return;const l=v=>{s&&this.snapToCursor(Kl(v).point),this.stopAnimation()},c=(v,x)=>{const{drag:w,dragPropagation:T,onDragStart:N}=this.getProps();if(w&&!T&&(this.openDragLock&&this.openDragLock(),this.openDragLock=a3(w),!this.openDragLock))return;this.latestPointerEvent=v,this.latestPanInfo=x,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),Os(C=>{let j=this.getAxisMotionValue(C).get()||0;if(Us.test(j)){const{projection:S}=this.visualElement;if(S&&S.layout){const _=S.layout.layoutBox[C];_&&(j=Sn(_)*(parseFloat(j)/100))}}this.originPoint[C]=j}),N&&yt.update(()=>N(v,x),!1,!0),Dm(this.visualElement,"transform");const{animationState:A}=this.visualElement;A&&A.setActive("whileDrag",!0)},f=(v,x)=>{this.latestPointerEvent=v,this.latestPanInfo=x;const{dragPropagation:w,dragDirectionLock:T,onDirectionLock:N,onDrag:A}=this.getProps();if(!w&&!this.openDragLock)return;const{offset:C}=x;if(T&&this.currentDirection===null){this.currentDirection=OI(C),this.currentDirection!==null&&N&&N(this.currentDirection);return}this.updateAxis("x",x.point,C),this.updateAxis("y",x.point,C),this.visualElement.render(),A&&yt.update(()=>A(v,x),!1,!0)},p=(v,x)=>{this.latestPointerEvent=v,this.latestPanInfo=x,this.stop(v,x),this.latestPointerEvent=null,this.latestPanInfo=null},h=()=>{const{dragSnapToOrigin:v}=this.getProps();(v||this.constraints)&&this.startAnimation({x:0,y:0})},{dragSnapToOrigin:g}=this.getProps();this.panSession=new KT(t,{onSessionStart:l,onStart:c,onMove:f,onSessionEnd:p,resumeAnimation:h},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:g,distanceThreshold:r,contextWindow:XT(this.visualElement),element:this.visualElement.current})}stop(t,s){const r=t||this.latestPointerEvent,i=s||this.latestPanInfo,l=this.isDragging;if(this.cancel(),!l||!i||!r)return;const{velocity:c}=i;this.startAnimation(c);const{onDragEnd:f}=this.getProps();f&&yt.postRender(()=>f(r,i))}cancel(){this.isDragging=!1;const{projection:t,animationState:s}=this.visualElement;t&&(t.isAnimationBlocked=!1),this.endPanSession();const{dragPropagation:r}=this.getProps();!r&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),s&&s.setActive("whileDrag",!1)}endPanSession(){this.panSession&&this.panSession.end(),this.panSession=void 0}updateAxis(t,s,r){const{drag:i}=this.getProps();if(!r||!Au(t,i,this.currentDirection))return;const l=this.getAxisMotionValue(t);let c=this.originPoint[t]+r[t];this.constraints&&this.constraints[t]&&(c=NI(c,this.constraints[t],this.elastic[t])),l.set(c)}resolveConstraints(){const{dragConstraints:t,dragElastic:s}=this.getProps(),r=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):this.visualElement.projection?.layout,i=this.constraints;t&&Ii(t)?this.constraints||(this.constraints=this.resolveRefConstraints()):t&&r?this.constraints=TI(r.layoutBox,t):this.constraints=!1,this.elastic=AI(s),i!==this.constraints&&!Ii(t)&&r&&this.constraints&&!this.hasMutatedConstraints&&Os(l=>{this.constraints!==!1&&this.getAxisMotionValue(l)&&(this.constraints[l]=RI(r.layoutBox[l],this.constraints[l]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:s}=this.getProps();if(!t||!Ii(t))return!1;const r=t.current,{projection:i}=this.visualElement;if(!i||!i.layout)return!1;const l=D3(r,i.root,this.visualElement.getTransformPagePoint());let c=jI(i.layout.layoutBox,l);if(s){const f=s(k3(c));this.hasMutatedConstraints=!!f,f&&(c=vT(f))}return c}startAnimation(t){const{drag:s,dragMomentum:r,dragElastic:i,dragTransition:l,dragSnapToOrigin:c,onDragTransitionEnd:f}=this.getProps(),p=this.constraints||{},h=Os(g=>{if(!Au(g,s,this.currentDirection))return;let v=p&&p[g]||{};c&&(v={min:0,max:0});const x=i?200:1e6,w=i?40:1e7,T={type:"inertia",velocity:r?t[g]:0,bounceStiffness:x,bounceDamping:w,timeConstant:750,restDelta:1,restSpeed:10,...l,...v};return this.startAxisValueAnimation(g,T)});return Promise.all(h).then(f)}startAxisValueAnimation(t,s){const r=this.getAxisMotionValue(t);return Dm(this.visualElement,t),r.start(qg(t,r,0,s,this.visualElement,!1))}stopAnimation(){Os(t=>this.getAxisMotionValue(t).stop())}getAxisMotionValue(t){const s=`_drag${t.toUpperCase()}`,r=this.visualElement.getProps(),i=r[s];return i||this.visualElement.getValue(t,(r.initial?r.initial[t]:void 0)||0)}snapToCursor(t){Os(s=>{const{drag:r}=this.getProps();if(!Au(s,r,this.currentDirection))return;const{projection:i}=this.visualElement,l=this.getAxisMotionValue(s);if(i&&i.layout){const{min:c,max:f}=i.layout.layoutBox[s],p=l.get()||0;l.set(t[s]-_t(c,f,.5)+p)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:s}=this.getProps(),{projection:r}=this.visualElement;if(!Ii(s)||!r||!this.constraints)return;this.stopAnimation();const i={x:0,y:0};Os(c=>{const f=this.getAxisMotionValue(c);if(f&&this.constraints!==!1){const p=f.get();i[c]=CI({min:p,max:p},this.constraints[c])}});const{transformTemplate:l}=this.visualElement.getProps();this.visualElement.current.style.transform=l?l({},""):"none",r.root&&r.root.updateScroll(),r.updateLayout(),this.constraints=!1,this.resolveConstraints(),Os(c=>{if(!Au(c,t,null))return;const f=this.getAxisMotionValue(c),{min:p,max:h}=this.constraints[c];f.set(_t(p,h,i[c]))}),this.visualElement.render()}addListeners(){if(!this.visualElement.current)return;_I.set(this.visualElement,this);const t=this.visualElement.current,s=Al(t,"pointerdown",h=>{const{drag:g,dragListener:v=!0}=this.getProps(),x=h.target,w=x!==t&&d3(x);g&&v&&!w&&this.start(h)});let r;const i=()=>{const{dragConstraints:h}=this.getProps();Ii(h)&&h.current&&(this.constraints=this.resolveRefConstraints(),r||(r=MI(t,h.current,()=>this.scalePositionWithinConstraints())))},{projection:l}=this.visualElement,c=l.addEventListener("measure",i);l&&!l.layout&&(l.root&&l.root.updateScroll(),l.updateLayout()),yt.read(i);const f=Ll(window,"resize",()=>this.scalePositionWithinConstraints()),p=l.addEventListener("didUpdate",(({delta:h,hasLayoutChanged:g})=>{this.isDragging&&g&&(Os(v=>{const x=this.getAxisMotionValue(v);x&&(this.originPoint[v]+=h[v].translate,x.set(x.get()+h[v].translate))}),this.visualElement.render())}));return()=>{f(),s(),c(),p&&p(),r&&r()}}getProps(){const t=this.visualElement.getProps(),{drag:s=!1,dragDirectionLock:r=!1,dragPropagation:i=!1,dragConstraints:l=!1,dragElastic:c=Zm,dragMomentum:f=!0}=t;return{...t,drag:s,dragDirectionLock:r,dragPropagation:i,dragConstraints:l,dragElastic:c,dragMomentum:f}}}function E1(e){let t=!0;return()=>{if(t){t=!1;return}e()}}function MI(e,t,s){const r=_w(e,E1(s)),i=_w(t,E1(s));return()=>{r(),i()}}function Au(e,t,s){return(t===!0||t===e)&&(s===null||s===e)}function OI(e,t=10){let s=null;return Math.abs(e.y)>t?s="y":Math.abs(e.x)>t&&(s="x"),s}class DI extends ia{constructor(t){super(t),this.removeGroupControls=us,this.removeListeners=us,this.controls=new kI(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||us}update(){const{dragControls:t}=this.node.getProps(),{dragControls:s}=this.node.prevProps||{};t!==s&&(this.removeGroupControls(),t&&(this.removeGroupControls=t.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners(),this.controls.isDragging||this.controls.endPanSession()}}const Bp=e=>(t,s)=>{e&&yt.update(()=>e(t,s),!1,!0)};class zI extends ia{constructor(){super(...arguments),this.removePointerDownListener=us}onPointerDown(t){this.session=new KT(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:XT(this.node)})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:s,onPan:r,onPanEnd:i}=this.node.getProps();return{onSessionStart:Bp(t),onStart:Bp(s),onMove:Bp(r),onEnd:(l,c)=>{delete this.session,i&&yt.postRender(()=>i(l,c))}}}mount(){this.removePointerDownListener=Al(this.node.current,"pointerdown",t=>this.onPointerDown(t))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}let Zp=!1;class II extends b.Component{componentDidMount(){const{visualElement:t,layoutGroup:s,switchLayoutGroup:r,layoutId:i}=this.props,{projection:l}=t;l&&(s.group&&s.group.add(l),r&&r.register&&i&&r.register(l),Zp&&l.root.didUpdate(),l.addEventListener("animationComplete",()=>{this.safeToRemove()}),l.setOptions({...l.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),Qu.hasEverUpdated=!0}getSnapshotBeforeUpdate(t){const{layoutDependency:s,visualElement:r,drag:i,isPresent:l}=this.props,{projection:c}=r;return c&&(c.isPresent=l,t.layoutDependency!==s&&c.setOptions({...c.options,layoutDependency:s}),Zp=!0,i||t.layoutDependency!==s||s===void 0||t.isPresent!==l?c.willUpdate():this.safeToRemove(),t.isPresent!==l&&(l?c.promote():c.relegate()||yt.postRender(()=>{const f=c.getStack();(!f||!f.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:t}=this.props.visualElement;t&&(t.root.didUpdate(),Kg.postRender(()=>{!t.currentAnimation&&t.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:t,layoutGroup:s,switchLayoutGroup:r}=this.props,{projection:i}=t;Zp=!0,i&&(i.scheduleCheckAfterUnmount(),s&&s.group&&s.group.remove(i),r&&r.deregister&&r.deregister(i))}safeToRemove(){const{safeToRemove:t}=this.props;t&&t()}render(){return null}}function JT(e){const[t,s]=$T(),r=b.useContext(Ag);return d.jsx(II,{...e,layoutGroup:r,switchLayoutGroup:b.useContext(YT),isPresent:t,safeToRemove:s})}const LI={pan:{Feature:zI},drag:{Feature:DI,ProjectionNode:UT,MeasureLayout:JT}};function N1(e,t,s){const{props:r}=e;e.animationState&&r.whileHover&&e.animationState.setActive("whileHover",s==="Start");const i="onHover"+s,l=r[i];l&&yt.postRender(()=>l(t,Kl(t)))}class PI extends ia{mount(){const{current:t}=this.node;t&&(this.unmount=o3(t,(s,r)=>(N1(this.node,r,"Start"),i=>N1(this.node,i,"End"))))}unmount(){}}class UI extends ia{constructor(){super(...arguments),this.isActive=!1}onFocus(){let t=!1;try{t=this.node.current.matches(":focus-visible")}catch{t=!0}!t||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=Yl(Ll(this.node.current,"focus",()=>this.onFocus()),Ll(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function T1(e,t,s){const{props:r}=e;if(e.current instanceof HTMLButtonElement&&e.current.disabled)return;e.animationState&&r.whileTap&&e.animationState.setActive("whileTap",s==="Start");const i="onTap"+(s==="End"?"":s),l=r[i];l&&yt.postRender(()=>l(t,Kl(t)))}class $I extends ia{mount(){const{current:t}=this.node;if(!t)return;const{globalTapTarget:s,propagate:r}=this.node.props;this.unmount=h3(t,(i,l)=>(T1(this.node,l,"Start"),(c,{success:f})=>T1(this.node,c,f?"End":"Cancel")),{useGlobalTarget:s,stopPropagation:r?.tap===!1})}unmount(){}}const Hm=new WeakMap,Hp=new WeakMap,VI=e=>{const t=Hm.get(e.target);t&&t(e)},BI=e=>{e.forEach(VI)};function ZI({root:e,...t}){const s=e||document;Hp.has(s)||Hp.set(s,{});const r=Hp.get(s),i=JSON.stringify(t);return r[i]||(r[i]=new IntersectionObserver(BI,{root:e,...t})),r[i]}function HI(e,t,s){const r=ZI(t);return Hm.set(e,s),r.observe(e),()=>{Hm.delete(e),r.unobserve(e)}}const FI={some:0,all:1};class qI extends ia{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:t={}}=this.node.getProps(),{root:s,margin:r,amount:i="some",once:l}=t,c={root:s?s.current:void 0,rootMargin:r,threshold:typeof i=="number"?i:FI[i]},f=p=>{const{isIntersecting:h}=p;if(this.isInView===h||(this.isInView=h,l&&!h&&this.hasEnteredView))return;h&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",h);const{onViewportEnter:g,onViewportLeave:v}=this.node.getProps(),x=h?g:v;x&&x(p)};return HI(this.node.current,c,f)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:t,prevProps:s}=this.node;["amount","margin","root"].some(YI(t,s))&&this.startObserver()}unmount(){}}function YI({viewport:e={}},{viewport:t={}}={}){return s=>e[s]!==t[s]}const GI={inView:{Feature:qI},tap:{Feature:$I},focus:{Feature:UI},hover:{Feature:PI}},XI={layout:{ProjectionNode:UT,MeasureLayout:JT}},KI={...bI,...GI,...LI,...XI},WI=pI(KI,mI);function JI(e){return"type"in e&&e.type==="separator"}function QI(e){return"type"in e&&e.type==="group"}function j1({item:e}){return d.jsxs(Ck,{disabled:e.disabled,onClick:e.action,className:"flex items-center gap-3 px-3 py-1.5 text-[12px] font-mono text-neutral-300 outline-none select-none data-[highlighted]:bg-neutral-700/50 data-[highlighted]:text-white data-[disabled]:opacity-40 data-[disabled]:pointer-events-none cursor-default",children:[e.icon&&d.jsx("span",{className:"w-4 h-4 flex items-center justify-center text-neutral-400",children:e.icon}),d.jsx("span",{className:"flex-1",children:e.label}),e.shortcut&&d.jsx("span",{className:"text-neutral-400 text-[10px] ml-4 tracking-wider",children:e.shortcut})]})}const QT=qS.forwardRef(({items:e},t)=>d.jsx(WI.div,{ref:t,initial:{opacity:0,scale:.96},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.96},transition:{duration:.1,ease:"easeOut"},children:d.jsx(ED,{className:"bg-neutral-900/95 backdrop-blur-xl border border-neutral-700/60 rounded-lg shadow-2xl py-1 min-w-[180px] z-[200] outline-none",children:e.map((s,r)=>JI(s)?d.jsx(ez,{className:"h-px bg-neutral-700/50 my-1"},`sep-${r}`):QI(s)?d.jsxs(Tk,{children:[d.jsx(jk,{className:"px-3 py-1 text-[10px] font-mono uppercase tracking-widest text-neutral-400",children:s.label}),s.items.map(i=>d.jsx(j1,{item:i},i.id))]},`grp-${r}`):d.jsx(j1,{item:s},s.id))})}));QT.displayName="PopupContent";function eL({items:e,children:t}){return e.length===0?d.jsx(d.Fragment,{children:t}):d.jsxs(tz,{children:[d.jsx(nz,{render:d.jsx("div",{style:{display:"contents"}}),children:t}),d.jsx(TD,{children:d.jsx(PD,{className:"z-[200]",sideOffset:4,children:d.jsx(Z4,{children:d.jsx(QT,{items:e})})})})]})}const C1=()=>{},tL={x:0,y:0},nL=({children:e,hud:t,mode:s="canvas",panOffset:r=tL,scale:i=1,onPan:l=C1,onZoom:c=C1,onPanStart:f,onPanEnd:p,isTransitioning:h=!1,onViewportChange:g,onCanvasClick:v,canvasProps:x,zoomSensitivity:w,zoomControlsRightOffset:T,canvasContextMenuItems:N})=>{const A=b.useRef(null),C=b.useRef(i);C.current=i;const j=b.useRef(c);j.current=c;const S=b.useRef(l);S.current=l;const _=b.useRef(f);_.current=f;const R=b.useRef(p);R.current=p;const M=b.useRef(w);M.current=w;const[O,I]=b.useState(!1),H=b.useRef(!1),[F,$]=b.useState(!1),L=b.useRef(!1),Y=b.useRef({x:0,y:0}),ie=b.useRef(z=>{const Z=z.target||document.activeElement;if(!Z)return!1;const B=Z.tagName;return!!(B==="INPUT"||B==="TEXTAREA"||Z.isContentEditable||Z.closest?.(".xterm"))});b.useEffect(()=>{if(s!=="canvas")return;const z=re=>{re.key!==" "||re.repeat||ie.current(re)||h||(re.preventDefault(),H.current=!0,I(!0))},Z=re=>{re.key===" "&&H.current&&(H.current=!1,I(!1),L.current&&(L.current=!1,$(!1),R.current?.()))},B=()=>{H.current&&(H.current=!1,I(!1),L.current&&(L.current=!1,$(!1),R.current?.()))};return window.addEventListener("keydown",z),window.addEventListener("keyup",Z),window.addEventListener("blur",B),()=>{window.removeEventListener("keydown",z),window.removeEventListener("keyup",Z),window.removeEventListener("blur",B)}},[s,h]);const ee=b.useCallback(z=>{z.button===0&&(z.preventDefault(),L.current=!0,$(!0),Y.current={x:z.clientX,y:z.clientY},_.current?.())},[]);return b.useEffect(()=>{if(!O)return;const z=B=>{if(!L.current)return;const re=(B.clientX-Y.current.x)/C.current,J=(B.clientY-Y.current.y)/C.current;Y.current={x:B.clientX,y:B.clientY},S.current({x:re,y:J})},Z=()=>{L.current&&(L.current=!1,$(!1),R.current?.())};return window.addEventListener("mousemove",z),window.addEventListener("mouseup",Z),()=>{window.removeEventListener("mousemove",z),window.removeEventListener("mouseup",Z)}},[O]),b.useEffect(()=>{if(s!=="canvas")return;const z=Z=>{if(Z.ctrlKey||Z.metaKey){Z.preventDefault();const B=C.current,re=-Z.deltaY*.001*(M.current??1),J=Math.min(Math.max(.2,B+re),3);C.current=J,j.current(J)}};return window.addEventListener("wheel",z,{passive:!1}),()=>window.removeEventListener("wheel",z)},[s]),b.useEffect(()=>{if(!g)return;let z=null;const Z=()=>{z&&cancelAnimationFrame(z),z=requestAnimationFrame(()=>{g({width:window.innerWidth,height:window.innerHeight})})};return Z(),window.addEventListener("resize",Z),()=>{window.removeEventListener("resize",Z),z&&cancelAnimationFrame(z)}},[g]),s==="panel"?d.jsxs("div",{ref:A,className:"fixed inset-0 bg-black text-neutral-200 overflow-hidden font-sans z-0",children:[d.jsx("div",{className:"absolute inset-0 z-10 overflow-auto frame-scrollbar select-text",children:e}),d.jsx("div",{className:"fixed inset-0 z-50 pointer-events-none overflow-hidden",children:t})]}):d.jsxs("div",{ref:A,className:"fixed inset-0 bg-black text-neutral-200 overflow-hidden font-sans z-0",children:[d.jsx(eL,{items:N??[],children:d.jsx(w2,{panOffset:r,scale:i,onPan:l,onPanStart:f,onPanEnd:p,isPanLocked:h,onClick:v,showGuides:x?.showGuides,onGuidesChange:x?.onGuidesChange,gridOpacity:x?.gridOpacity})}),d.jsx("div",{className:"absolute z-10 pointer-events-none",style:{left:"50%",top:"50%",zoom:i},children:d.jsx("div",{style:{position:"absolute",left:r.x,top:r.y},children:e})}),O&&d.jsx("div",{className:`fixed inset-0 z-20 ${F?"cursor-grabbing":"cursor-grab"}`,onMouseDown:ee}),d.jsx("div",{className:"fixed bottom-[36px] z-30",style:{right:(T??280)+16},children:d.jsx(g_,{scale:i,onZoom:z=>c(z)})}),d.jsx("div",{className:"fixed inset-0 z-50 pointer-events-none overflow-hidden",children:t})]})},sL={titleBarInset:0,dragRegionProps:{},onInteractiveMouseDown:void 0,isSSR:!0,apiBaseUrl:"",serviceApiUrl:""},rL=b.createContext(sL);function Wl(){return b.useContext(rL)}const Yd={panels:{statusBar:"bg-neutral-950/95 backdrop-blur-xl border-t border-neutral-700 shadow-[0_-5px_30px_rgba(0,0,0,0.6),inset_0_1px_0_rgba(255,255,255,0.06)] fixed bottom-0 left-0 right-0 z-[60]"},zIndex:{drawer:70},layout:{navHeight:48,statusBarHeight:28}},aL=Yd.panels;function iy(){const{titleBarInset:e}=Wl();return b.useMemo(()=>{const t=Yd.layout.navHeight+e;return{navTotalHeight:t,panelTopOffset:t}},[e])}const iL=({title:e,subtitle:t,center:s,actions:r,onTitleClick:i,search:l})=>{const{dragRegionProps:c,onInteractiveMouseDown:f}=Wl(),{navTotalHeight:p}=iy(),h=l&&l.value&&l.value.length>0;return d.jsx("div",{"data-frame-panel":"navigation",className:"fixed top-0 left-0 right-0 z-50 pointer-events-auto",...c,children:d.jsxs("div",{className:"bg-neutral-950/95 backdrop-blur-xl border-b border-neutral-700/80 shadow-[0_4px_30px_rgba(0,0,0,0.5)] flex items-end px-4",style:{height:p},children:[d.jsx("div",{className:"absolute top-0 left-0 right-0 h-px bg-gradient-to-r from-transparent via-white/8 to-transparent"}),d.jsxs("div",{className:"absolute left-4 bottom-0 h-12 z-10 flex items-center gap-3 select-none",onMouseDown:f,children:[d.jsx("button",{onClick:i,className:"text-[22px] font-bold text-white tracking-[0.25em] font-mono leading-none bg-transparent border-none cursor-pointer",children:e}),t&&d.jsx("span",{className:"text-xs font-mono text-neutral-400",children:t})]}),s&&d.jsx("div",{className:"flex-1 flex justify-center h-12 items-center",onMouseDown:f,children:s}),d.jsxs("div",{className:"absolute right-4 bottom-0 h-12 z-10 flex items-center gap-3",onMouseDown:f,children:[r,l&&d.jsxs("div",{className:"relative w-[220px] bg-white/[0.06] border border-neutral-600/50 rounded px-2.5 hover:border-neutral-500/60 focus-within:border-neutral-400/50 focus-within:bg-white/[0.08] transition-all duration-200",children:[d.jsx(fg,{size:11,className:"absolute left-2.5 top-1/2 -translate-y-1/2 text-neutral-400"}),d.jsx("input",{type:"text",value:l.value,onChange:g=>l.onChange(g.target.value),placeholder:l.placeholder??"Search...",className:`
29
- w-full h-7 pl-5 pr-6 bg-transparent text-[12px] font-mono tracking-wider
30
- placeholder:text-neutral-400 text-neutral-200
31
- focus:outline-none transition-all duration-200
32
- ${h?"text-emerald-400":""}
33
- `}),h&&d.jsx("button",{onClick:()=>l.onChange(""),className:"absolute right-2 top-1/2 -translate-y-1/2 text-neutral-400 hover:text-white transition-colors",children:d.jsx(eE,{size:12})})]})]})]})})},R1=({side:e,title:t,icon:s,isCollapsed:r=!1,onToggleCollapse:i,headerActions:l,footer:c,style:f,width:p,onResizeStart:h,children:g})=>{if(r){const C=e==="left"?K2:e_;return d.jsx("button",{onClick:i,className:`fixed top-1/2 -translate-y-1/2 z-40 ${e==="left"?"left-3":"right-3"} p-2.5 rounded bg-neutral-950/95 border border-neutral-700/80 hover:border-emerald-500/60 backdrop-blur-xl shadow-[0_0_20px_rgba(0,0,0,0.5),inset_0_1px_0_rgba(255,255,255,0.08)] hover:shadow-[0_0_30px_rgba(16,185,129,0.2),inset_0_1px_0_rgba(255,255,255,0.1)] transition-all duration-200 group pointer-events-auto`,title:`Expand ${t||"panel"}`,children:d.jsx(C,{size:14,className:"text-neutral-400 group-hover:text-emerald-400 transition-colors",strokeWidth:1.5})})}const v=e==="left"?G2:J2,{panelTopOffset:x}=iy(),N=`bg-neutral-950/95 backdrop-blur-xl border border-neutral-700/80 shadow-[0_0_30px_rgba(0,0,0,0.8),inset_0_1px_0_rgba(255,255,255,0.08)] fixed bottom-[28px] z-40 rounded-none border-t-0 overflow-hidden ${e==="left"?"border-l-0 border-r-0":"border-r-0 border-l-0"}`,A={...f,position:"fixed",top:x,left:e==="left"?0:void 0,right:e==="right"?0:void 0,width:`${p||280}px`};return d.jsxs("div",{"data-frame-panel":e==="left"?"manifest":"inspector",className:`${N} pointer-events-none select-none font-mono text-[11px] flex flex-col`,style:A,children:[h&&d.jsxs("div",{className:`absolute top-0 ${e==="left"?"right-0":"left-0"} bottom-0 w-[7px] cursor-ew-resize z-50 pointer-events-auto group flex items-center justify-center`,onMouseDown:h,children:[d.jsx("div",{className:`absolute top-0 bottom-0 ${e==="left"?"right-0":"left-0"} w-px bg-neutral-700/80 group-hover:bg-emerald-500/50 transition-colors`}),d.jsxs("div",{className:"flex flex-col gap-[3px] opacity-0 group-hover:opacity-100 transition-opacity",children:[d.jsx("div",{className:"w-[3px] h-[3px] rounded-full bg-neutral-500 group-hover:bg-emerald-400/70"}),d.jsx("div",{className:"w-[3px] h-[3px] rounded-full bg-neutral-500 group-hover:bg-emerald-400/70"}),d.jsx("div",{className:"w-[3px] h-[3px] rounded-full bg-neutral-500 group-hover:bg-emerald-400/70"})]})]}),!h&&d.jsx("div",{className:`absolute top-0 ${e==="left"?"right-0":"left-0"} bottom-0 w-px bg-neutral-700/80`}),d.jsx("div",{className:"absolute top-0 left-0 right-0 h-px bg-gradient-to-r from-transparent via-white/12 to-transparent z-10"}),d.jsxs("div",{className:"pointer-events-auto select-text flex-1 flex flex-col overflow-hidden",children:[t&&d.jsx("div",{className:"shrink-0 p-4 border-b border-neutral-700/50",children:d.jsxs("div",{className:"flex items-center justify-between text-neutral-200 text-[12px]",children:[d.jsxs("div",{className:"flex items-center gap-1.5",children:[s&&d.jsx("span",{className:"text-neutral-400",children:s}),d.jsx("span",{className:"tracking-widest font-bold uppercase",children:t})]}),d.jsxs("div",{className:"flex items-center gap-2",children:[l,i&&d.jsx("button",{onClick:i,className:"p-1 hover:bg-white/10 rounded transition-colors text-neutral-400 hover:text-white",title:"Collapse panel",children:d.jsx(v,{size:12})})]})]})}),d.jsx("div",{className:"flex-1 overflow-y-auto frame-scrollbar",children:g}),c&&d.jsx("div",{className:"shrink-0",children:c})]})]})},oL={emerald:{dot:"bg-emerald-500",ping:"bg-emerald-400",text:"text-emerald-500"},amber:{dot:"bg-amber-500",ping:"bg-amber-400",text:"text-amber-500"},red:{dot:"bg-red-500",ping:"bg-red-400",text:"text-red-500"},neutral:{dot:"bg-neutral-500",ping:"bg-neutral-400",text:"text-neutral-400"}},lL=({left:e,viewport:t,right:s,isMinimapCollapsed:r=!1,onExpandMinimap:i,status:l={label:"READY",color:"emerald"},onToggleTerminal:c,isTerminalOpen:f=!1})=>{const[p,h]=b.useState(new Date),[g,v]=b.useState(!1),[x,w]=b.useState(!1);b.useEffect(()=>{w(!0);const A=setInterval(()=>h(new Date),1e3);return()=>clearInterval(A)},[]);const T=oL[l.color],N=async()=>{if(!t)return;const A=`PAN: ${t.pan.x.toFixed(0)},${t.pan.y.toFixed(0)} | SIZE: ${t.canvasSize?.w??1024}x${t.canvasSize?.h??1024} | ZOOM: ${(t.zoom*100).toFixed(0)}%`;try{await navigator.clipboard.writeText(A),v(!0),setTimeout(()=>v(!1),1500)}catch{}};return d.jsxs("div",{"data-frame-panel":"status-bar",className:`${aL.statusBar} h-7 flex items-center justify-between px-3 select-none font-mono text-[12px] text-neutral-200 pointer-events-auto`,children:[d.jsxs("div",{className:"flex items-center gap-4",children:[r&&i&&d.jsxs(d.Fragment,{children:[d.jsxs("button",{onClick:i,className:"flex items-center gap-1.5 px-2 py-0.5 rounded bg-white/5 border border-neutral-800 hover:bg-white/10 transition-colors text-neutral-400 hover:text-white",title:"Expand minimap",children:[d.jsx(U2,{size:10}),d.jsx("span",{className:"text-[11px] font-bold",children:"MAP"}),d.jsx(KS,{size:8,className:"opacity-60"})]}),d.jsx("div",{className:"h-3 w-px bg-neutral-700"})]}),d.jsxs("div",{className:`flex items-center gap-2 ${T.text}`,children:[d.jsxs("div",{className:"relative flex h-2 w-2",children:[d.jsx("span",{className:`animate-ping absolute inline-flex h-full w-full rounded-full ${T.ping} opacity-75`}),d.jsx("span",{className:`relative inline-flex rounded-full h-2 w-2 ${T.dot}`})]}),d.jsx("span",{className:"font-bold tracking-wider",children:l.label})]}),e&&d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"h-3 w-px bg-neutral-700"}),e]})]}),t&&d.jsx("div",{className:"absolute left-1/2 -translate-x-1/2 flex items-center gap-3 opacity-70 hover:opacity-100 transition-opacity",children:d.jsxs("button",{onClick:N,className:"flex items-center gap-3 hover:text-neutral-200 transition-colors cursor-pointer",title:"Copy viewport data",children:[d.jsxs("div",{className:"flex items-center gap-1",children:[d.jsx("span",{className:"text-neutral-400",children:"PAN:"}),d.jsxs("span",{className:`tabular-nums ${g?"text-emerald-500":""}`,children:[t.pan.x.toFixed(0),",",t.pan.y.toFixed(0)]})]}),d.jsx("div",{className:"h-3 w-px bg-neutral-700"}),d.jsxs("div",{className:"flex items-center gap-1",children:[d.jsx("span",{className:"text-neutral-400",children:"SIZE:"}),d.jsxs("span",{className:`tabular-nums ${g?"text-emerald-500":""}`,children:[t.canvasSize?.w??1024,"x",t.canvasSize?.h??1024]})]}),d.jsx("div",{className:"h-3 w-px bg-neutral-700"}),d.jsxs("div",{className:"flex items-center gap-1",children:[d.jsx("span",{className:"text-neutral-400",children:"ZOOM:"}),d.jsxs("span",{className:`tabular-nums ${g?"text-emerald-500":""}`,children:[(t.zoom*100).toFixed(0),"%"]})]})]})}),d.jsxs("div",{className:"flex items-center gap-4",children:[s,s&&d.jsx("div",{className:"h-3 w-px bg-neutral-700"}),c&&d.jsxs(d.Fragment,{children:[d.jsxs("button",{onClick:c,className:`flex items-center gap-1.5 px-2 py-1 rounded transition-all ${f?"bg-emerald-500/10 text-emerald-400 border border-emerald-500/30":"text-neutral-400 hover:text-neutral-100 hover:bg-white/5 border border-transparent"}`,title:"Toggle Terminal (Ctrl+`)",children:[d.jsxs("span",{className:"text-[12px]",children:[">","_"]}),d.jsx("span",{className:"uppercase text-[11px] font-semibold tracking-wider",children:"Console"})]}),d.jsx("div",{className:"h-3 w-px bg-neutral-700"})]}),d.jsxs("div",{className:"flex items-center gap-1.5 text-neutral-200 min-w-[60px] justify-end",children:[d.jsx(D2,{size:11,className:"text-neutral-400"}),d.jsx("span",{children:x?p.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):"--:--"})]})]})]})},cL=({onOpenCommandPalette:e,extraControls:t})=>d.jsx("div",{className:"select-none font-mono text-[12px] border-t border-neutral-700/50",children:d.jsxs("div",{className:"px-3 py-2 flex items-center justify-between",children:[d.jsxs("button",{onClick:e,className:"flex items-center gap-1.5 text-neutral-400 hover:text-white transition-colors",children:[d.jsx(fg,{size:10}),d.jsx("span",{className:"tracking-widest font-bold uppercase",children:"Command Palette"})]}),d.jsxs("div",{className:"flex items-center gap-2",children:[t,d.jsx("kbd",{className:"text-[11px] text-neutral-400 font-mono",children:"⌘K"})]})]})}),uL=({isOpen:e,onClose:t,commands:s})=>{const[r,i]=b.useState(""),[l,c]=b.useState(0),f=b.useRef(null),p=b.useRef(null),h=s.filter(v=>v.label.toLowerCase().includes(r.toLowerCase()));b.useEffect(()=>{e&&(setTimeout(()=>f.current?.focus(),10),i(""),c(0))},[e]),b.useEffect(()=>{c(0)},[r]),b.useEffect(()=>{p.current?.scrollIntoView({behavior:"smooth",block:"nearest"})},[l]);const g=v=>{v.key==="ArrowDown"?(v.preventDefault(),c(x=>(x+1)%h.length)):v.key==="ArrowUp"?(v.preventDefault(),c(x=>(x-1+h.length)%h.length)):v.key==="Enter"?(v.preventDefault(),h[l]&&(h[l].action(),t())):v.key==="Escape"&&t()};return e?d.jsx("div",{className:"fixed inset-0 z-[100] flex items-start justify-center pt-[15vh] bg-black/60 backdrop-blur-[2px] pointer-events-auto",onClick:t,children:d.jsxs("div",{className:"w-[640px] max-w-[90vw] bg-[#161616] border border-neutral-700 shadow-2xl rounded-lg overflow-hidden flex flex-col animate-in fade-in zoom-in-95 duration-100",onClick:v=>v.stopPropagation(),children:[d.jsxs("div",{className:"flex items-center px-4 py-3 border-b border-neutral-700 gap-3",children:[d.jsx(fg,{className:"text-neutral-400",size:18}),d.jsx("input",{ref:f,className:"flex-1 bg-transparent border-none outline-none text-neutral-100 placeholder-neutral-500 font-mono text-sm",placeholder:"Type a command or search...",value:r,onChange:v=>i(v.target.value),onKeyDown:g,autoFocus:!0}),d.jsx("div",{className:"px-1.5 py-0.5 rounded bg-neutral-700 border border-neutral-700 text-[12px] text-neutral-200 font-mono",children:"ESC"})]}),d.jsxs("div",{className:"max-h-[300px] overflow-y-auto py-2 relative",children:[d.jsx("div",{className:"pb-2",children:h.length===0?d.jsx("div",{className:"px-4 py-8 text-center text-neutral-400 text-xs font-mono",children:"No matching commands"}):h.map((v,x)=>d.jsxs("div",{ref:x===l?p:null,className:`px-4 py-2.5 flex items-center gap-3 cursor-pointer transition-colors ${x===l?"bg-emerald-900/20 border-l-2 border-emerald-500":"border-l-2 border-transparent hover:bg-white/5"}`,onClick:()=>{v.action(),t()},onMouseEnter:()=>c(x),children:[v.icon&&d.jsx("div",{className:`text-neutral-300 ${x===l?"text-emerald-400":""}`,children:v.icon}),d.jsx("div",{className:"flex-1",children:d.jsx("div",{className:`text-sm ${x===l?"text-emerald-100":"text-neutral-200"}`,children:v.label})}),v.shortcut&&d.jsx("div",{className:"text-[12px] font-mono text-neutral-300 bg-neutral-800 px-1.5 py-0.5 rounded border border-neutral-700",children:v.shortcut}),x===l&&d.jsx(I2,{size:14,className:"text-emerald-500 ml-2"})]},v.id))}),h.length>6&&d.jsx("div",{className:"absolute bottom-0 left-0 right-0 h-8 bg-gradient-to-t from-[#111] to-transparent pointer-events-none"})]}),d.jsxs("div",{className:"px-4 py-1.5 bg-neutral-800/90 backdrop-blur-sm border-t border-neutral-700 flex justify-between items-center text-[12px] text-neutral-300 font-mono relative z-10",children:[d.jsx("span",{children:"Command Palette"}),d.jsxs("span",{children:[h.length," matches"]})]})]})}):null},{statusBarHeight:_u}=Yd.layout,A1=120,dL=({isOpen:e,onClose:t,onToggleMaximize:s,isMaximized:r=!1,height:i=320,onHeightChange:l,title:c,headerActions:f,children:p})=>{const h=b.useRef(!1),g=b.useRef(null),v=b.useCallback(w=>{if(!l)return;w.preventDefault(),h.current=!0;const T=w.clientY,N=i;g.current&&(g.current.style.transition="none");const A=j=>{const S=T-j.clientY,_=window.innerHeight-_u,R=Math.max(A1,Math.min(_,N+S));g.current&&(g.current.style.height=`${R}px`)},C=j=>{h.current=!1,document.removeEventListener("mousemove",A),document.removeEventListener("mouseup",C),g.current&&(g.current.style.transition="");const S=T-j.clientY,_=window.innerHeight-_u;l(Math.max(A1,Math.min(_,N+S)))};document.addEventListener("mousemove",A),document.addEventListener("mouseup",C)},[i,l]),x=r?`calc(100vh - ${_u}px)`:`${i}px`;return d.jsxs("div",{ref:g,className:`
34
- fixed left-0 right-0 shadow-[0_-10px_40px_rgba(0,0,0,0.8)] flex flex-col border-t border-neutral-700
35
- bg-neutral-950/95 backdrop-blur-xl
36
- ${e?"translate-y-0 opacity-100 pointer-events-auto":"translate-y-full opacity-0 pointer-events-none"}
37
- transition-all duration-300 ease-in-out
38
- `,style:{bottom:_u,height:x,zIndex:Yd.zIndex.drawer},children:[d.jsxs("div",{className:"h-9 bg-neutral-900/70 border-b border-neutral-700 flex items-center justify-between px-3 shrink-0 select-none backdrop-blur-sm",children:[d.jsxs("div",{className:"flex items-center gap-3",children:[c||d.jsxs("div",{className:"flex items-center gap-2 text-emerald-400",children:[d.jsx(QS,{size:14}),d.jsx("span",{className:"text-xs font-bold tracking-widest font-mono",children:"TERMINAL"})]}),f]}),d.jsx("div",{className:"flex-1 flex items-center justify-center h-full cursor-ns-resize text-neutral-500 hover:text-neutral-300 transition-colors group",title:"Drag to Resize",onMouseDown:v,children:d.jsx("div",{className:"w-16 h-1 rounded-full bg-neutral-700 group-hover:bg-neutral-500 transition-colors"})}),d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("button",{onClick:s,className:"p-1.5 rounded hover:bg-neutral-700 text-neutral-400 hover:text-white transition-colors",title:r?"Restore":"Maximize",children:r?d.jsx(H2,{size:14}):d.jsx(KS,{size:14})}),d.jsx("button",{onClick:t,className:"p-1.5 rounded hover:bg-red-900/20 text-neutral-400 hover:text-red-400 transition-colors",title:"Close",children:d.jsx(eE,{size:14})})]})]}),d.jsx("div",{className:"flex-1 relative overflow-hidden flex flex-col bg-transparent",children:p})]})};var ej="vercel.ai.error",fL=Symbol.for(ej),_1,k1,Bs=class tj extends(k1=Error,_1=fL,k1){constructor({name:t,message:s,cause:r}){super(s),this[_1]=!0,this.name=t,this.cause=r}static isInstance(t){return tj.hasMarker(t,ej)}static hasMarker(t,s){const r=Symbol.for(s);return t!=null&&typeof t=="object"&&r in t&&typeof t[r]=="boolean"&&t[r]===!0}};function nj(e){return e==null?"unknown error":typeof e=="string"?e:e instanceof Error?e.message:JSON.stringify(e)}var sj="AI_InvalidArgumentError",rj=`vercel.ai.error.${sj}`,hL=Symbol.for(rj),M1,O1,pL=class extends(O1=Bs,M1=hL,O1){constructor({message:e,cause:t,argument:s}){super({name:sj,message:e,cause:t}),this[M1]=!0,this.argument=s}static isInstance(e){return Bs.hasMarker(e,rj)}},aj="AI_JSONParseError",ij=`vercel.ai.error.${aj}`,mL=Symbol.for(ij),D1,z1,I1=class extends(z1=Bs,D1=mL,z1){constructor({text:e,cause:t}){super({name:aj,message:`JSON parsing failed: Text: ${e}.
39
- Error message: ${nj(t)}`,cause:t}),this[D1]=!0,this.text=e}static isInstance(e){return Bs.hasMarker(e,ij)}},oj="AI_TypeValidationError",lj=`vercel.ai.error.${oj}`,gL=Symbol.for(lj),L1,P1,no=class Fm extends(P1=Bs,L1=gL,P1){constructor({value:t,cause:s,context:r}){let i="Type validation failed";if(r?.field&&(i+=` for ${r.field}`),r?.entityName||r?.entityId){i+=" (";const l=[];r.entityName&&l.push(r.entityName),r.entityId&&l.push(`id: "${r.entityId}"`),i+=l.join(", "),i+=")"}super({name:oj,message:`${i}: Value: ${JSON.stringify(t)}.
40
- Error message: ${nj(s)}`,cause:s}),this[L1]=!0,this.value=t,this.context=r}static isInstance(t){return Bs.hasMarker(t,lj)}static wrap({value:t,cause:s,context:r}){var i,l,c;return Fm.isInstance(s)&&s.value===t&&((i=s.context)==null?void 0:i.field)===r?.field&&((l=s.context)==null?void 0:l.entityName)===r?.entityName&&((c=s.context)==null?void 0:c.entityId)===r?.entityId?s:new Fm({value:t,cause:s,context:r})}};function ce(e,t,s){function r(f,p){if(f._zod||Object.defineProperty(f,"_zod",{value:{def:p,constr:c,traits:new Set},enumerable:!1}),f._zod.traits.has(e))return;f._zod.traits.add(e),t(f,p);const h=c.prototype,g=Object.keys(h);for(let v=0;v<g.length;v++){const x=g[v];x in f||(f[x]=h[x].bind(f))}}const i=s?.Parent??Object;class l extends i{}Object.defineProperty(l,"name",{value:e});function c(f){var p;const h=s?.Parent?new l:this;r(h,f),(p=h._zod).deferred??(p.deferred=[]);for(const g of h._zod.deferred)g();return h}return Object.defineProperty(c,"init",{value:r}),Object.defineProperty(c,Symbol.hasInstance,{value:f=>s?.Parent&&f instanceof s.Parent?!0:f?._zod?.traits?.has(e)}),Object.defineProperty(c,"name",{value:e}),c}class Wi extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class cj extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const uj={};function Qr(e){return uj}function dj(e){const t=Object.values(e).filter(r=>typeof r=="number");return Object.entries(e).filter(([r,i])=>t.indexOf(+r)===-1).map(([r,i])=>i)}function qm(e,t){return typeof t=="bigint"?t.toString():t}function Gd(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function oy(e){return e==null}function ly(e){const t=e.startsWith("^")?1:0,s=e.endsWith("$")?e.length-1:e.length;return e.slice(t,s)}function yL(e,t){const s=(e.toString().split(".")[1]||"").length,r=t.toString();let i=(r.split(".")[1]||"").length;if(i===0&&/\d?e-\d?/.test(r)){const p=r.match(/\d?e-(\d?)/);p?.[1]&&(i=Number.parseInt(p[1]))}const l=s>i?s:i,c=Number.parseInt(e.toFixed(l).replace(".","")),f=Number.parseInt(t.toFixed(l).replace(".",""));return c%f/10**l}const U1=Symbol("evaluating");function Qe(e,t,s){let r;Object.defineProperty(e,t,{get(){if(r!==U1)return r===void 0&&(r=U1,r=s()),r},set(i){Object.defineProperty(e,t,{value:i})},configurable:!0})}function Ga(e,t,s){Object.defineProperty(e,t,{value:s,writable:!0,enumerable:!0,configurable:!0})}function oa(...e){const t={};for(const s of e){const r=Object.getOwnPropertyDescriptors(s);Object.assign(t,r)}return Object.defineProperties({},t)}function $1(e){return JSON.stringify(e)}function vL(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const fj="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Pl(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const bL=Gd(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function so(e){if(Pl(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const s=t.prototype;return!(Pl(s)===!1||Object.prototype.hasOwnProperty.call(s,"isPrototypeOf")===!1)}function hj(e){return so(e)?{...e}:Array.isArray(e)?[...e]:e}const xL=new Set(["string","number","symbol"]);function ro(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function la(e,t,s){const r=new e._zod.constr(t??e._zod.def);return(!t||s?.parent)&&(r._zod.parent=e),r}function _e(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function wL(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const SL={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function EL(e,t){const s=e._zod.def,r=s.checks;if(r&&r.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const l=oa(e._zod.def,{get shape(){const c={};for(const f in t){if(!(f in s.shape))throw new Error(`Unrecognized key: "${f}"`);t[f]&&(c[f]=s.shape[f])}return Ga(this,"shape",c),c},checks:[]});return la(e,l)}function NL(e,t){const s=e._zod.def,r=s.checks;if(r&&r.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const l=oa(e._zod.def,{get shape(){const c={...e._zod.def.shape};for(const f in t){if(!(f in s.shape))throw new Error(`Unrecognized key: "${f}"`);t[f]&&delete c[f]}return Ga(this,"shape",c),c},checks:[]});return la(e,l)}function TL(e,t){if(!so(t))throw new Error("Invalid input to extend: expected a plain object");const s=e._zod.def.checks;if(s&&s.length>0){const l=e._zod.def.shape;for(const c in t)if(Object.getOwnPropertyDescriptor(l,c)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const i=oa(e._zod.def,{get shape(){const l={...e._zod.def.shape,...t};return Ga(this,"shape",l),l}});return la(e,i)}function jL(e,t){if(!so(t))throw new Error("Invalid input to safeExtend: expected a plain object");const s=oa(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t};return Ga(this,"shape",r),r}});return la(e,s)}function CL(e,t){const s=oa(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t._zod.def.shape};return Ga(this,"shape",r),r},get catchall(){return t._zod.def.catchall},checks:[]});return la(e,s)}function RL(e,t,s){const i=t._zod.def.checks;if(i&&i.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const c=oa(t._zod.def,{get shape(){const f=t._zod.def.shape,p={...f};if(s)for(const h in s){if(!(h in f))throw new Error(`Unrecognized key: "${h}"`);s[h]&&(p[h]=e?new e({type:"optional",innerType:f[h]}):f[h])}else for(const h in f)p[h]=e?new e({type:"optional",innerType:f[h]}):f[h];return Ga(this,"shape",p),p},checks:[]});return la(t,c)}function AL(e,t,s){const r=oa(t._zod.def,{get shape(){const i=t._zod.def.shape,l={...i};if(s)for(const c in s){if(!(c in l))throw new Error(`Unrecognized key: "${c}"`);s[c]&&(l[c]=new e({type:"nonoptional",innerType:i[c]}))}else for(const c in i)l[c]=new e({type:"nonoptional",innerType:i[c]});return Ga(this,"shape",l),l}});return la(t,r)}function Fi(e,t=0){if(e.aborted===!0)return!0;for(let s=t;s<e.issues.length;s++)if(e.issues[s]?.continue!==!0)return!0;return!1}function qi(e,t){return t.map(s=>{var r;return(r=s).path??(r.path=[]),s.path.unshift(e),s})}function ku(e){return typeof e=="string"?e:e?.message}function ea(e,t,s){const r={...e,path:e.path??[]};if(!e.message){const i=ku(e.inst?._zod.def?.error?.(e))??ku(t?.error?.(e))??ku(s.customError?.(e))??ku(s.localeError?.(e))??"Invalid input";r.message=i}return delete r.inst,delete r.continue,t?.reportInput||delete r.input,r}function cy(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function Ul(...e){const[t,s,r]=e;return typeof t=="string"?{message:t,code:"custom",input:s,inst:r}:{...t}}const pj=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,qm,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},mj=ce("$ZodError",pj),gj=ce("$ZodError",pj,{Parent:Error});function _L(e,t=s=>s.message){const s={},r=[];for(const i of e.issues)i.path.length>0?(s[i.path[0]]=s[i.path[0]]||[],s[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:s}}function kL(e,t=s=>s.message){const s={_errors:[]},r=i=>{for(const l of i.issues)if(l.code==="invalid_union"&&l.errors.length)l.errors.map(c=>r({issues:c}));else if(l.code==="invalid_key")r({issues:l.issues});else if(l.code==="invalid_element")r({issues:l.issues});else if(l.path.length===0)s._errors.push(t(l));else{let c=s,f=0;for(;f<l.path.length;){const p=l.path[f];f===l.path.length-1?(c[p]=c[p]||{_errors:[]},c[p]._errors.push(t(l))):c[p]=c[p]||{_errors:[]},c=c[p],f++}}};return r(e),s}const uy=e=>(t,s,r,i)=>{const l=r?Object.assign(r,{async:!1}):{async:!1},c=t._zod.run({value:s,issues:[]},l);if(c instanceof Promise)throw new Wi;if(c.issues.length){const f=new(i?.Err??e)(c.issues.map(p=>ea(p,l,Qr())));throw fj(f,i?.callee),f}return c.value},dy=e=>async(t,s,r,i)=>{const l=r?Object.assign(r,{async:!0}):{async:!0};let c=t._zod.run({value:s,issues:[]},l);if(c instanceof Promise&&(c=await c),c.issues.length){const f=new(i?.Err??e)(c.issues.map(p=>ea(p,l,Qr())));throw fj(f,i?.callee),f}return c.value},Xd=e=>(t,s,r)=>{const i=r?{...r,async:!1}:{async:!1},l=t._zod.run({value:s,issues:[]},i);if(l instanceof Promise)throw new Wi;return l.issues.length?{success:!1,error:new(e??mj)(l.issues.map(c=>ea(c,i,Qr())))}:{success:!0,data:l.value}},ML=Xd(gj),Kd=e=>async(t,s,r)=>{const i=r?Object.assign(r,{async:!0}):{async:!0};let l=t._zod.run({value:s,issues:[]},i);return l instanceof Promise&&(l=await l),l.issues.length?{success:!1,error:new e(l.issues.map(c=>ea(c,i,Qr())))}:{success:!0,data:l.value}},OL=Kd(gj),DL=e=>(t,s,r)=>{const i=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return uy(e)(t,s,i)},zL=e=>(t,s,r)=>uy(e)(t,s,r),IL=e=>async(t,s,r)=>{const i=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return dy(e)(t,s,i)},LL=e=>async(t,s,r)=>dy(e)(t,s,r),PL=e=>(t,s,r)=>{const i=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Xd(e)(t,s,i)},UL=e=>(t,s,r)=>Xd(e)(t,s,r),$L=e=>async(t,s,r)=>{const i=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Kd(e)(t,s,i)},VL=e=>async(t,s,r)=>Kd(e)(t,s,r),BL=/^[cC][^\s-]{8,}$/,ZL=/^[0-9a-z]+$/,HL=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,FL=/^[0-9a-vA-V]{20}$/,qL=/^[A-Za-z0-9]{27}$/,YL=/^[a-zA-Z0-9_-]{21}$/,GL=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,XL=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,V1=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,KL=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,WL="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function JL(){return new RegExp(WL,"u")}const QL=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,e6=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,t6=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,n6=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,s6=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,yj=/^[A-Za-z0-9_-]*$/,r6=/^\+[1-9]\d{6,14}$/,vj="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",a6=new RegExp(`^${vj}$`);function bj(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function i6(e){return new RegExp(`^${bj(e)}$`)}function o6(e){const t=bj({precision:e.precision}),s=["Z"];e.local&&s.push(""),e.offset&&s.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const r=`${t}(?:${s.join("|")})`;return new RegExp(`^${vj}T(?:${r})$`)}const l6=e=>{const t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},c6=/^-?\d+$/,xj=/^-?\d+(?:\.\d+)?$/,u6=/^(?:true|false)$/i,d6=/^null$/i,f6=/^[^A-Z]*$/,h6=/^[^a-z]*$/,Ln=ce("$ZodCheck",(e,t)=>{var s;e._zod??(e._zod={}),e._zod.def=t,(s=e._zod).onattach??(s.onattach=[])}),wj={number:"number",bigint:"bigint",object:"date"},Sj=ce("$ZodCheckLessThan",(e,t)=>{Ln.init(e,t);const s=wj[typeof t.value];e._zod.onattach.push(r=>{const i=r._zod.bag,l=(t.inclusive?i.maximum:i.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<l&&(t.inclusive?i.maximum=t.value:i.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:s,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Ej=ce("$ZodCheckGreaterThan",(e,t)=>{Ln.init(e,t);const s=wj[typeof t.value];e._zod.onattach.push(r=>{const i=r._zod.bag,l=(t.inclusive?i.minimum:i.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>l&&(t.inclusive?i.minimum=t.value:i.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:s,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),p6=ce("$ZodCheckMultipleOf",(e,t)=>{Ln.init(e,t),e._zod.onattach.push(s=>{var r;(r=s._zod.bag).multipleOf??(r.multipleOf=t.value)}),e._zod.check=s=>{if(typeof s.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof s.value=="bigint"?s.value%t.value===BigInt(0):yL(s.value,t.value)===0)||s.issues.push({origin:typeof s.value,code:"not_multiple_of",divisor:t.value,input:s.value,inst:e,continue:!t.abort})}}),m6=ce("$ZodCheckNumberFormat",(e,t)=>{Ln.init(e,t),t.format=t.format||"float64";const s=t.format?.includes("int"),r=s?"int":"number",[i,l]=SL[t.format];e._zod.onattach.push(c=>{const f=c._zod.bag;f.format=t.format,f.minimum=i,f.maximum=l,s&&(f.pattern=c6)}),e._zod.check=c=>{const f=c.value;if(s){if(!Number.isInteger(f)){c.issues.push({expected:r,format:t.format,code:"invalid_type",continue:!1,input:f,inst:e});return}if(!Number.isSafeInteger(f)){f>0?c.issues.push({input:f,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort}):c.issues.push({input:f,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}f<i&&c.issues.push({origin:"number",input:f,code:"too_small",minimum:i,inclusive:!0,inst:e,continue:!t.abort}),f>l&&c.issues.push({origin:"number",input:f,code:"too_big",maximum:l,inclusive:!0,inst:e,continue:!t.abort})}}),g6=ce("$ZodCheckMaxLength",(e,t)=>{var s;Ln.init(e,t),(s=e._zod.def).when??(s.when=r=>{const i=r.value;return!oy(i)&&i.length!==void 0}),e._zod.onattach.push(r=>{const i=r._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<i&&(r._zod.bag.maximum=t.maximum)}),e._zod.check=r=>{const i=r.value;if(i.length<=t.maximum)return;const c=cy(i);r.issues.push({origin:c,code:"too_big",maximum:t.maximum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),y6=ce("$ZodCheckMinLength",(e,t)=>{var s;Ln.init(e,t),(s=e._zod.def).when??(s.when=r=>{const i=r.value;return!oy(i)&&i.length!==void 0}),e._zod.onattach.push(r=>{const i=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>i&&(r._zod.bag.minimum=t.minimum)}),e._zod.check=r=>{const i=r.value;if(i.length>=t.minimum)return;const c=cy(i);r.issues.push({origin:c,code:"too_small",minimum:t.minimum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),v6=ce("$ZodCheckLengthEquals",(e,t)=>{var s;Ln.init(e,t),(s=e._zod.def).when??(s.when=r=>{const i=r.value;return!oy(i)&&i.length!==void 0}),e._zod.onattach.push(r=>{const i=r._zod.bag;i.minimum=t.length,i.maximum=t.length,i.length=t.length}),e._zod.check=r=>{const i=r.value,l=i.length;if(l===t.length)return;const c=cy(i),f=l>t.length;r.issues.push({origin:c,...f?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),Wd=ce("$ZodCheckStringFormat",(e,t)=>{var s,r;Ln.init(e,t),e._zod.onattach.push(i=>{const l=i._zod.bag;l.format=t.format,t.pattern&&(l.patterns??(l.patterns=new Set),l.patterns.add(t.pattern))}),t.pattern?(s=e._zod).check??(s.check=i=>{t.pattern.lastIndex=0,!t.pattern.test(i.value)&&i.issues.push({origin:"string",code:"invalid_format",format:t.format,input:i.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),b6=ce("$ZodCheckRegex",(e,t)=>{Wd.init(e,t),e._zod.check=s=>{t.pattern.lastIndex=0,!t.pattern.test(s.value)&&s.issues.push({origin:"string",code:"invalid_format",format:"regex",input:s.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),x6=ce("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=f6),Wd.init(e,t)}),w6=ce("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=h6),Wd.init(e,t)}),S6=ce("$ZodCheckIncludes",(e,t)=>{Ln.init(e,t);const s=ro(t.includes),r=new RegExp(typeof t.position=="number"?`^.{${t.position}}${s}`:s);t.pattern=r,e._zod.onattach.push(i=>{const l=i._zod.bag;l.patterns??(l.patterns=new Set),l.patterns.add(r)}),e._zod.check=i=>{i.value.includes(t.includes,t.position)||i.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:i.value,inst:e,continue:!t.abort})}}),E6=ce("$ZodCheckStartsWith",(e,t)=>{Ln.init(e,t);const s=new RegExp(`^${ro(t.prefix)}.*`);t.pattern??(t.pattern=s),e._zod.onattach.push(r=>{const i=r._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(s)}),e._zod.check=r=>{r.value.startsWith(t.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:r.value,inst:e,continue:!t.abort})}}),N6=ce("$ZodCheckEndsWith",(e,t)=>{Ln.init(e,t);const s=new RegExp(`.*${ro(t.suffix)}$`);t.pattern??(t.pattern=s),e._zod.onattach.push(r=>{const i=r._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(s)}),e._zod.check=r=>{r.value.endsWith(t.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:r.value,inst:e,continue:!t.abort})}}),T6=ce("$ZodCheckOverwrite",(e,t)=>{Ln.init(e,t),e._zod.check=s=>{s.value=t.tx(s.value)}});class j6{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const r=t.split(`
41
- `).filter(c=>c),i=Math.min(...r.map(c=>c.length-c.trimStart().length)),l=r.map(c=>c.slice(i)).map(c=>" ".repeat(this.indent*2)+c);for(const c of l)this.content.push(c)}compile(){const t=Function,s=this?.args,i=[...(this?.content??[""]).map(l=>` ${l}`)];return new t(...s,i.join(`
42
- `))}}const C6={major:4,minor:3,patch:6},jt=ce("$ZodType",(e,t)=>{var s;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=C6;const r=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&r.unshift(e);for(const i of r)for(const l of i._zod.onattach)l(e);if(r.length===0)(s=e._zod).deferred??(s.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const i=(c,f,p)=>{let h=Fi(c),g;for(const v of f){if(v._zod.def.when){if(!v._zod.def.when(c))continue}else if(h)continue;const x=c.issues.length,w=v._zod.check(c);if(w instanceof Promise&&p?.async===!1)throw new Wi;if(g||w instanceof Promise)g=(g??Promise.resolve()).then(async()=>{await w,c.issues.length!==x&&(h||(h=Fi(c,x)))});else{if(c.issues.length===x)continue;h||(h=Fi(c,x))}}return g?g.then(()=>c):c},l=(c,f,p)=>{if(Fi(c))return c.aborted=!0,c;const h=i(f,r,p);if(h instanceof Promise){if(p.async===!1)throw new Wi;return h.then(g=>e._zod.parse(g,p))}return e._zod.parse(h,p)};e._zod.run=(c,f)=>{if(f.skipChecks)return e._zod.parse(c,f);if(f.direction==="backward"){const h=e._zod.parse({value:c.value,issues:[]},{...f,skipChecks:!0});return h instanceof Promise?h.then(g=>l(g,c,f)):l(h,c,f)}const p=e._zod.parse(c,f);if(p instanceof Promise){if(f.async===!1)throw new Wi;return p.then(h=>i(h,r,f))}return i(p,r,f)}}Qe(e,"~standard",()=>({validate:i=>{try{const l=ML(e,i);return l.success?{value:l.data}:{issues:l.error?.issues}}catch{return OL(e,i).then(c=>c.success?{value:c.data}:{issues:c.error?.issues})}},vendor:"zod",version:1}))}),fy=ce("$ZodString",(e,t)=>{jt.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??l6(e._zod.bag),e._zod.parse=(s,r)=>{if(t.coerce)try{s.value=String(s.value)}catch{}return typeof s.value=="string"||s.issues.push({expected:"string",code:"invalid_type",input:s.value,inst:e}),s}}),At=ce("$ZodStringFormat",(e,t)=>{Wd.init(e,t),fy.init(e,t)}),R6=ce("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=XL),At.init(e,t)}),A6=ce("$ZodUUID",(e,t)=>{if(t.version){const r={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(r===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=V1(r))}else t.pattern??(t.pattern=V1());At.init(e,t)}),_6=ce("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=KL),At.init(e,t)}),k6=ce("$ZodURL",(e,t)=>{At.init(e,t),e._zod.check=s=>{try{const r=s.value.trim(),i=new URL(r);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||s.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:s.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(":")?i.protocol.slice(0,-1):i.protocol)||s.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:s.value,inst:e,continue:!t.abort})),t.normalize?s.value=i.href:s.value=r;return}catch{s.issues.push({code:"invalid_format",format:"url",input:s.value,inst:e,continue:!t.abort})}}}),M6=ce("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=JL()),At.init(e,t)}),O6=ce("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=YL),At.init(e,t)}),D6=ce("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=BL),At.init(e,t)}),z6=ce("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=ZL),At.init(e,t)}),I6=ce("$ZodULID",(e,t)=>{t.pattern??(t.pattern=HL),At.init(e,t)}),L6=ce("$ZodXID",(e,t)=>{t.pattern??(t.pattern=FL),At.init(e,t)}),P6=ce("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=qL),At.init(e,t)}),U6=ce("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=o6(t)),At.init(e,t)}),$6=ce("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=a6),At.init(e,t)}),V6=ce("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=i6(t)),At.init(e,t)}),B6=ce("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=GL),At.init(e,t)}),Z6=ce("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=QL),At.init(e,t),e._zod.bag.format="ipv4"}),H6=ce("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=e6),At.init(e,t),e._zod.bag.format="ipv6",e._zod.check=s=>{try{new URL(`http://[${s.value}]`)}catch{s.issues.push({code:"invalid_format",format:"ipv6",input:s.value,inst:e,continue:!t.abort})}}}),F6=ce("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=t6),At.init(e,t)}),q6=ce("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=n6),At.init(e,t),e._zod.check=s=>{const r=s.value.split("/");try{if(r.length!==2)throw new Error;const[i,l]=r;if(!l)throw new Error;const c=Number(l);if(`${c}`!==l)throw new Error;if(c<0||c>128)throw new Error;new URL(`http://[${i}]`)}catch{s.issues.push({code:"invalid_format",format:"cidrv6",input:s.value,inst:e,continue:!t.abort})}}});function Nj(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const Y6=ce("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=s6),At.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=s=>{Nj(s.value)||s.issues.push({code:"invalid_format",format:"base64",input:s.value,inst:e,continue:!t.abort})}});function G6(e){if(!yj.test(e))return!1;const t=e.replace(/[-_]/g,r=>r==="-"?"+":"/"),s=t.padEnd(Math.ceil(t.length/4)*4,"=");return Nj(s)}const X6=ce("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=yj),At.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=s=>{G6(s.value)||s.issues.push({code:"invalid_format",format:"base64url",input:s.value,inst:e,continue:!t.abort})}}),K6=ce("$ZodE164",(e,t)=>{t.pattern??(t.pattern=r6),At.init(e,t)});function W6(e,t=null){try{const s=e.split(".");if(s.length!==3)return!1;const[r]=s;if(!r)return!1;const i=JSON.parse(atob(r));return!("typ"in i&&i?.typ!=="JWT"||!i.alg||t&&(!("alg"in i)||i.alg!==t))}catch{return!1}}const J6=ce("$ZodJWT",(e,t)=>{At.init(e,t),e._zod.check=s=>{W6(s.value,t.alg)||s.issues.push({code:"invalid_format",format:"jwt",input:s.value,inst:e,continue:!t.abort})}}),Tj=ce("$ZodNumber",(e,t)=>{jt.init(e,t),e._zod.pattern=e._zod.bag.pattern??xj,e._zod.parse=(s,r)=>{if(t.coerce)try{s.value=Number(s.value)}catch{}const i=s.value;if(typeof i=="number"&&!Number.isNaN(i)&&Number.isFinite(i))return s;const l=typeof i=="number"?Number.isNaN(i)?"NaN":Number.isFinite(i)?void 0:"Infinity":void 0;return s.issues.push({expected:"number",code:"invalid_type",input:i,inst:e,...l?{received:l}:{}}),s}}),Q6=ce("$ZodNumberFormat",(e,t)=>{m6.init(e,t),Tj.init(e,t)}),eP=ce("$ZodBoolean",(e,t)=>{jt.init(e,t),e._zod.pattern=u6,e._zod.parse=(s,r)=>{if(t.coerce)try{s.value=!!s.value}catch{}const i=s.value;return typeof i=="boolean"||s.issues.push({expected:"boolean",code:"invalid_type",input:i,inst:e}),s}}),tP=ce("$ZodNull",(e,t)=>{jt.init(e,t),e._zod.pattern=d6,e._zod.values=new Set([null]),e._zod.parse=(s,r)=>{const i=s.value;return i===null||s.issues.push({expected:"null",code:"invalid_type",input:i,inst:e}),s}}),nP=ce("$ZodUnknown",(e,t)=>{jt.init(e,t),e._zod.parse=s=>s}),sP=ce("$ZodNever",(e,t)=>{jt.init(e,t),e._zod.parse=(s,r)=>(s.issues.push({expected:"never",code:"invalid_type",input:s.value,inst:e}),s)});function B1(e,t,s){e.issues.length&&t.issues.push(...qi(s,e.issues)),t.value[s]=e.value}const rP=ce("$ZodArray",(e,t)=>{jt.init(e,t),e._zod.parse=(s,r)=>{const i=s.value;if(!Array.isArray(i))return s.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),s;s.value=Array(i.length);const l=[];for(let c=0;c<i.length;c++){const f=i[c],p=t.element._zod.run({value:f,issues:[]},r);p instanceof Promise?l.push(p.then(h=>B1(h,s,c))):B1(p,s,c)}return l.length?Promise.all(l).then(()=>s):s}});function Td(e,t,s,r,i){if(e.issues.length){if(i&&!(s in r))return;t.issues.push(...qi(s,e.issues))}e.value===void 0?s in r&&(t.value[s]=void 0):t.value[s]=e.value}function jj(e){const t=Object.keys(e.shape);for(const r of t)if(!e.shape?.[r]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${r}": expected a Zod schema`);const s=wL(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(s)}}function Cj(e,t,s,r,i,l){const c=[],f=i.keySet,p=i.catchall._zod,h=p.def.type,g=p.optout==="optional";for(const v in t){if(f.has(v))continue;if(h==="never"){c.push(v);continue}const x=p.run({value:t[v],issues:[]},r);x instanceof Promise?e.push(x.then(w=>Td(w,s,v,t,g))):Td(x,s,v,t,g)}return c.length&&s.issues.push({code:"unrecognized_keys",keys:c,input:t,inst:l}),e.length?Promise.all(e).then(()=>s):s}const aP=ce("$ZodObject",(e,t)=>{if(jt.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){const f=t.shape;Object.defineProperty(t,"shape",{get:()=>{const p={...f};return Object.defineProperty(t,"shape",{value:p}),p}})}const r=Gd(()=>jj(t));Qe(e._zod,"propValues",()=>{const f=t.shape,p={};for(const h in f){const g=f[h]._zod;if(g.values){p[h]??(p[h]=new Set);for(const v of g.values)p[h].add(v)}}return p});const i=Pl,l=t.catchall;let c;e._zod.parse=(f,p)=>{c??(c=r.value);const h=f.value;if(!i(h))return f.issues.push({expected:"object",code:"invalid_type",input:h,inst:e}),f;f.value={};const g=[],v=c.shape;for(const x of c.keys){const w=v[x],T=w._zod.optout==="optional",N=w._zod.run({value:h[x],issues:[]},p);N instanceof Promise?g.push(N.then(A=>Td(A,f,x,h,T))):Td(N,f,x,h,T)}return l?Cj(g,h,f,p,r.value,e):g.length?Promise.all(g).then(()=>f):f}}),iP=ce("$ZodObjectJIT",(e,t)=>{aP.init(e,t);const s=e._zod.parse,r=Gd(()=>jj(t)),i=x=>{const w=new j6(["shape","payload","ctx"]),T=r.value,N=S=>{const _=$1(S);return`shape[${_}]._zod.run({ value: input[${_}], issues: [] }, ctx)`};w.write("const input = payload.value;");const A=Object.create(null);let C=0;for(const S of T.keys)A[S]=`key_${C++}`;w.write("const newResult = {};");for(const S of T.keys){const _=A[S],R=$1(S),O=x[S]?._zod?.optout==="optional";w.write(`const ${_} = ${N(S)};`),O?w.write(`
43
- if (${_}.issues.length) {
44
- if (${R} in input) {
45
- payload.issues = payload.issues.concat(${_}.issues.map(iss => ({
46
- ...iss,
47
- path: iss.path ? [${R}, ...iss.path] : [${R}]
48
- })));
49
- }
50
- }
51
-
52
- if (${_}.value === undefined) {
53
- if (${R} in input) {
54
- newResult[${R}] = undefined;
55
- }
56
- } else {
57
- newResult[${R}] = ${_}.value;
58
- }
59
-
60
- `):w.write(`
61
- if (${_}.issues.length) {
62
- payload.issues = payload.issues.concat(${_}.issues.map(iss => ({
63
- ...iss,
64
- path: iss.path ? [${R}, ...iss.path] : [${R}]
65
- })));
66
- }
67
-
68
- if (${_}.value === undefined) {
69
- if (${R} in input) {
70
- newResult[${R}] = undefined;
71
- }
72
- } else {
73
- newResult[${R}] = ${_}.value;
74
- }
75
-
76
- `)}w.write("payload.value = newResult;"),w.write("return payload;");const j=w.compile();return(S,_)=>j(x,S,_)};let l;const c=Pl,f=!uj.jitless,h=f&&bL.value,g=t.catchall;let v;e._zod.parse=(x,w)=>{v??(v=r.value);const T=x.value;return c(T)?f&&h&&w?.async===!1&&w.jitless!==!0?(l||(l=i(t.shape)),x=l(x,w),g?Cj([],T,x,w,v,e):x):s(x,w):(x.issues.push({expected:"object",code:"invalid_type",input:T,inst:e}),x)}});function Z1(e,t,s,r){for(const l of e)if(l.issues.length===0)return t.value=l.value,t;const i=e.filter(l=>!Fi(l));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:s,errors:e.map(l=>l.issues.map(c=>ea(c,r,Qr())))}),t)}const Rj=ce("$ZodUnion",(e,t)=>{jt.init(e,t),Qe(e._zod,"optin",()=>t.options.some(i=>i._zod.optin==="optional")?"optional":void 0),Qe(e._zod,"optout",()=>t.options.some(i=>i._zod.optout==="optional")?"optional":void 0),Qe(e._zod,"values",()=>{if(t.options.every(i=>i._zod.values))return new Set(t.options.flatMap(i=>Array.from(i._zod.values)))}),Qe(e._zod,"pattern",()=>{if(t.options.every(i=>i._zod.pattern)){const i=t.options.map(l=>l._zod.pattern);return new RegExp(`^(${i.map(l=>ly(l.source)).join("|")})$`)}});const s=t.options.length===1,r=t.options[0]._zod.run;e._zod.parse=(i,l)=>{if(s)return r(i,l);let c=!1;const f=[];for(const p of t.options){const h=p._zod.run({value:i.value,issues:[]},l);if(h instanceof Promise)f.push(h),c=!0;else{if(h.issues.length===0)return h;f.push(h)}}return c?Promise.all(f).then(p=>Z1(p,i,e,l)):Z1(f,i,e,l)}}),oP=ce("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,Rj.init(e,t);const s=e._zod.parse;Qe(e._zod,"propValues",()=>{const i={};for(const l of t.options){const c=l._zod.propValues;if(!c||Object.keys(c).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(l)}"`);for(const[f,p]of Object.entries(c)){i[f]||(i[f]=new Set);for(const h of p)i[f].add(h)}}return i});const r=Gd(()=>{const i=t.options,l=new Map;for(const c of i){const f=c._zod.propValues?.[t.discriminator];if(!f||f.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(c)}"`);for(const p of f){if(l.has(p))throw new Error(`Duplicate discriminator value "${String(p)}"`);l.set(p,c)}}return l});e._zod.parse=(i,l)=>{const c=i.value;if(!Pl(c))return i.issues.push({code:"invalid_type",expected:"object",input:c,inst:e}),i;const f=r.value.get(c?.[t.discriminator]);return f?f._zod.run(i,l):t.unionFallback?s(i,l):(i.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,input:c,path:[t.discriminator],inst:e}),i)}}),lP=ce("$ZodIntersection",(e,t)=>{jt.init(e,t),e._zod.parse=(s,r)=>{const i=s.value,l=t.left._zod.run({value:i,issues:[]},r),c=t.right._zod.run({value:i,issues:[]},r);return l instanceof Promise||c instanceof Promise?Promise.all([l,c]).then(([p,h])=>H1(s,p,h)):H1(s,l,c)}});function Ym(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(so(e)&&so(t)){const s=Object.keys(t),r=Object.keys(e).filter(l=>s.indexOf(l)!==-1),i={...e,...t};for(const l of r){const c=Ym(e[l],t[l]);if(!c.valid)return{valid:!1,mergeErrorPath:[l,...c.mergeErrorPath]};i[l]=c.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const s=[];for(let r=0;r<e.length;r++){const i=e[r],l=t[r],c=Ym(i,l);if(!c.valid)return{valid:!1,mergeErrorPath:[r,...c.mergeErrorPath]};s.push(c.data)}return{valid:!0,data:s}}return{valid:!1,mergeErrorPath:[]}}function H1(e,t,s){const r=new Map;let i;for(const f of t.issues)if(f.code==="unrecognized_keys"){i??(i=f);for(const p of f.keys)r.has(p)||r.set(p,{}),r.get(p).l=!0}else e.issues.push(f);for(const f of s.issues)if(f.code==="unrecognized_keys")for(const p of f.keys)r.has(p)||r.set(p,{}),r.get(p).r=!0;else e.issues.push(f);const l=[...r].filter(([,f])=>f.l&&f.r).map(([f])=>f);if(l.length&&i&&e.issues.push({...i,keys:l}),Fi(e))return e;const c=Ym(t.value,s.value);if(!c.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`);return e.value=c.data,e}const cP=ce("$ZodRecord",(e,t)=>{jt.init(e,t),e._zod.parse=(s,r)=>{const i=s.value;if(!so(i))return s.issues.push({expected:"record",code:"invalid_type",input:i,inst:e}),s;const l=[],c=t.keyType._zod.values;if(c){s.value={};const f=new Set;for(const h of c)if(typeof h=="string"||typeof h=="number"||typeof h=="symbol"){f.add(typeof h=="number"?h.toString():h);const g=t.valueType._zod.run({value:i[h],issues:[]},r);g instanceof Promise?l.push(g.then(v=>{v.issues.length&&s.issues.push(...qi(h,v.issues)),s.value[h]=v.value})):(g.issues.length&&s.issues.push(...qi(h,g.issues)),s.value[h]=g.value)}let p;for(const h in i)f.has(h)||(p=p??[],p.push(h));p&&p.length>0&&s.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:p})}else{s.value={};for(const f of Reflect.ownKeys(i)){if(f==="__proto__")continue;let p=t.keyType._zod.run({value:f,issues:[]},r);if(p instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof f=="string"&&xj.test(f)&&p.issues.length){const v=t.keyType._zod.run({value:Number(f),issues:[]},r);if(v instanceof Promise)throw new Error("Async schemas not supported in object keys currently");v.issues.length===0&&(p=v)}if(p.issues.length){t.mode==="loose"?s.value[f]=i[f]:s.issues.push({code:"invalid_key",origin:"record",issues:p.issues.map(v=>ea(v,r,Qr())),input:f,path:[f],inst:e});continue}const g=t.valueType._zod.run({value:i[f],issues:[]},r);g instanceof Promise?l.push(g.then(v=>{v.issues.length&&s.issues.push(...qi(f,v.issues)),s.value[p.value]=v.value})):(g.issues.length&&s.issues.push(...qi(f,g.issues)),s.value[p.value]=g.value)}}return l.length?Promise.all(l).then(()=>s):s}}),uP=ce("$ZodEnum",(e,t)=>{jt.init(e,t);const s=dj(t.entries),r=new Set(s);e._zod.values=r,e._zod.pattern=new RegExp(`^(${s.filter(i=>xL.has(typeof i)).map(i=>typeof i=="string"?ro(i):i.toString()).join("|")})$`),e._zod.parse=(i,l)=>{const c=i.value;return r.has(c)||i.issues.push({code:"invalid_value",values:s,input:c,inst:e}),i}}),dP=ce("$ZodLiteral",(e,t)=>{if(jt.init(e,t),t.values.length===0)throw new Error("Cannot create literal schema with no valid values");const s=new Set(t.values);e._zod.values=s,e._zod.pattern=new RegExp(`^(${t.values.map(r=>typeof r=="string"?ro(r):r?ro(r.toString()):String(r)).join("|")})$`),e._zod.parse=(r,i)=>{const l=r.value;return s.has(l)||r.issues.push({code:"invalid_value",values:t.values,input:l,inst:e}),r}}),fP=ce("$ZodTransform",(e,t)=>{jt.init(e,t),e._zod.parse=(s,r)=>{if(r.direction==="backward")throw new cj(e.constructor.name);const i=t.transform(s.value,s);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(c=>(s.value=c,s));if(i instanceof Promise)throw new Wi;return s.value=i,s}});function F1(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const Aj=ce("$ZodOptional",(e,t)=>{jt.init(e,t),e._zod.optin="optional",e._zod.optout="optional",Qe(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),Qe(e._zod,"pattern",()=>{const s=t.innerType._zod.pattern;return s?new RegExp(`^(${ly(s.source)})?$`):void 0}),e._zod.parse=(s,r)=>{if(t.innerType._zod.optin==="optional"){const i=t.innerType._zod.run(s,r);return i instanceof Promise?i.then(l=>F1(l,s.value)):F1(i,s.value)}return s.value===void 0?s:t.innerType._zod.run(s,r)}}),hP=ce("$ZodExactOptional",(e,t)=>{Aj.init(e,t),Qe(e._zod,"values",()=>t.innerType._zod.values),Qe(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(s,r)=>t.innerType._zod.run(s,r)}),pP=ce("$ZodNullable",(e,t)=>{jt.init(e,t),Qe(e._zod,"optin",()=>t.innerType._zod.optin),Qe(e._zod,"optout",()=>t.innerType._zod.optout),Qe(e._zod,"pattern",()=>{const s=t.innerType._zod.pattern;return s?new RegExp(`^(${ly(s.source)}|null)$`):void 0}),Qe(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(s,r)=>s.value===null?s:t.innerType._zod.run(s,r)}),mP=ce("$ZodDefault",(e,t)=>{jt.init(e,t),e._zod.optin="optional",Qe(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(s,r)=>{if(r.direction==="backward")return t.innerType._zod.run(s,r);if(s.value===void 0)return s.value=t.defaultValue,s;const i=t.innerType._zod.run(s,r);return i instanceof Promise?i.then(l=>q1(l,t)):q1(i,t)}});function q1(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const gP=ce("$ZodPrefault",(e,t)=>{jt.init(e,t),e._zod.optin="optional",Qe(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(s,r)=>(r.direction==="backward"||s.value===void 0&&(s.value=t.defaultValue),t.innerType._zod.run(s,r))}),yP=ce("$ZodNonOptional",(e,t)=>{jt.init(e,t),Qe(e._zod,"values",()=>{const s=t.innerType._zod.values;return s?new Set([...s].filter(r=>r!==void 0)):void 0}),e._zod.parse=(s,r)=>{const i=t.innerType._zod.run(s,r);return i instanceof Promise?i.then(l=>Y1(l,e)):Y1(i,e)}});function Y1(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const vP=ce("$ZodCatch",(e,t)=>{jt.init(e,t),Qe(e._zod,"optin",()=>t.innerType._zod.optin),Qe(e._zod,"optout",()=>t.innerType._zod.optout),Qe(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(s,r)=>{if(r.direction==="backward")return t.innerType._zod.run(s,r);const i=t.innerType._zod.run(s,r);return i instanceof Promise?i.then(l=>(s.value=l.value,l.issues.length&&(s.value=t.catchValue({...s,error:{issues:l.issues.map(c=>ea(c,r,Qr()))},input:s.value}),s.issues=[]),s)):(s.value=i.value,i.issues.length&&(s.value=t.catchValue({...s,error:{issues:i.issues.map(l=>ea(l,r,Qr()))},input:s.value}),s.issues=[]),s)}}),bP=ce("$ZodPipe",(e,t)=>{jt.init(e,t),Qe(e._zod,"values",()=>t.in._zod.values),Qe(e._zod,"optin",()=>t.in._zod.optin),Qe(e._zod,"optout",()=>t.out._zod.optout),Qe(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(s,r)=>{if(r.direction==="backward"){const l=t.out._zod.run(s,r);return l instanceof Promise?l.then(c=>Mu(c,t.in,r)):Mu(l,t.in,r)}const i=t.in._zod.run(s,r);return i instanceof Promise?i.then(l=>Mu(l,t.out,r)):Mu(i,t.out,r)}});function Mu(e,t,s){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},s)}const xP=ce("$ZodReadonly",(e,t)=>{jt.init(e,t),Qe(e._zod,"propValues",()=>t.innerType._zod.propValues),Qe(e._zod,"values",()=>t.innerType._zod.values),Qe(e._zod,"optin",()=>t.innerType?._zod?.optin),Qe(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(s,r)=>{if(r.direction==="backward")return t.innerType._zod.run(s,r);const i=t.innerType._zod.run(s,r);return i instanceof Promise?i.then(G1):G1(i)}});function G1(e){return e.value=Object.freeze(e.value),e}const wP=ce("$ZodLazy",(e,t)=>{jt.init(e,t),Qe(e._zod,"innerType",()=>t.getter()),Qe(e._zod,"pattern",()=>e._zod.innerType?._zod?.pattern),Qe(e._zod,"propValues",()=>e._zod.innerType?._zod?.propValues),Qe(e._zod,"optin",()=>e._zod.innerType?._zod?.optin??void 0),Qe(e._zod,"optout",()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(s,r)=>e._zod.innerType._zod.run(s,r)}),SP=ce("$ZodCustom",(e,t)=>{Ln.init(e,t),jt.init(e,t),e._zod.parse=(s,r)=>s,e._zod.check=s=>{const r=s.value,i=t.fn(r);if(i instanceof Promise)return i.then(l=>X1(l,s,r,e));X1(i,s,r,e)}});function X1(e,t,s,r){if(!e){const i={code:"custom",input:s,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(i.params=r._zod.def.params),t.issues.push(Ul(i))}}var K1;class EP{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...s){const r=s[0];return this._map.set(t,r),r&&typeof r=="object"&&"id"in r&&this._idmap.set(r.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){const s=this._map.get(t);return s&&typeof s=="object"&&"id"in s&&this._idmap.delete(s.id),this._map.delete(t),this}get(t){const s=t._zod.parent;if(s){const r={...this.get(s)??{}};delete r.id;const i={...r,...this._map.get(t)};return Object.keys(i).length?i:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}function NP(){return new EP}(K1=globalThis).__zod_globalRegistry??(K1.__zod_globalRegistry=NP());const yl=globalThis.__zod_globalRegistry;function TP(e,t){return new e({type:"string",..._e(t)})}function jP(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,..._e(t)})}function W1(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,..._e(t)})}function CP(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,..._e(t)})}function RP(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",..._e(t)})}function AP(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",..._e(t)})}function _P(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",..._e(t)})}function kP(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,..._e(t)})}function MP(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,..._e(t)})}function OP(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,..._e(t)})}function DP(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,..._e(t)})}function zP(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,..._e(t)})}function IP(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,..._e(t)})}function LP(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,..._e(t)})}function PP(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,..._e(t)})}function UP(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,..._e(t)})}function $P(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,..._e(t)})}function VP(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,..._e(t)})}function BP(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,..._e(t)})}function ZP(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,..._e(t)})}function HP(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,..._e(t)})}function FP(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,..._e(t)})}function qP(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,..._e(t)})}function YP(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,..._e(t)})}function GP(e,t){return new e({type:"string",format:"date",check:"string_format",..._e(t)})}function XP(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,..._e(t)})}function KP(e,t){return new e({type:"string",format:"duration",check:"string_format",..._e(t)})}function WP(e,t){return new e({type:"number",checks:[],..._e(t)})}function JP(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",..._e(t)})}function QP(e,t){return new e({type:"boolean",..._e(t)})}function e8(e,t){return new e({type:"null",..._e(t)})}function t8(e){return new e({type:"unknown"})}function n8(e,t){return new e({type:"never",..._e(t)})}function J1(e,t){return new Sj({check:"less_than",..._e(t),value:e,inclusive:!1})}function Fp(e,t){return new Sj({check:"less_than",..._e(t),value:e,inclusive:!0})}function Q1(e,t){return new Ej({check:"greater_than",..._e(t),value:e,inclusive:!1})}function qp(e,t){return new Ej({check:"greater_than",..._e(t),value:e,inclusive:!0})}function eS(e,t){return new p6({check:"multiple_of",..._e(t),value:e})}function _j(e,t){return new g6({check:"max_length",..._e(t),maximum:e})}function jd(e,t){return new y6({check:"min_length",..._e(t),minimum:e})}function kj(e,t){return new v6({check:"length_equals",..._e(t),length:e})}function s8(e,t){return new b6({check:"string_format",format:"regex",..._e(t),pattern:e})}function r8(e){return new x6({check:"string_format",format:"lowercase",..._e(e)})}function a8(e){return new w6({check:"string_format",format:"uppercase",..._e(e)})}function i8(e,t){return new S6({check:"string_format",format:"includes",..._e(t),includes:e})}function o8(e,t){return new E6({check:"string_format",format:"starts_with",..._e(t),prefix:e})}function l8(e,t){return new N6({check:"string_format",format:"ends_with",..._e(t),suffix:e})}function ho(e){return new T6({check:"overwrite",tx:e})}function c8(e){return ho(t=>t.normalize(e))}function u8(){return ho(e=>e.trim())}function d8(){return ho(e=>e.toLowerCase())}function f8(){return ho(e=>e.toUpperCase())}function h8(){return ho(e=>vL(e))}function p8(e,t,s){return new e({type:"array",element:t,..._e(s)})}function m8(e,t,s){const r=_e(s);return r.abort??(r.abort=!0),new e({type:"custom",check:"custom",fn:t,...r})}function g8(e,t,s){return new e({type:"custom",check:"custom",fn:t,..._e(s)})}function y8(e){const t=v8(s=>(s.addIssue=r=>{if(typeof r=="string")s.issues.push(Ul(r,s.value,t._zod.def));else{const i=r;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=s.value),i.inst??(i.inst=t),i.continue??(i.continue=!t._zod.def.abort),s.issues.push(Ul(i))}},e(s.value,s)));return t}function v8(e,t){const s=new Ln({check:"custom",..._e(t)});return s._zod.check=e,s}function Cd(e){let t=e?.target??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??yl,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function vt(e,t,s={path:[],schemaPath:[]}){var r;const i=e._zod.def,l=t.seen.get(e);if(l)return l.count++,s.schemaPath.includes(e)&&(l.cycle=s.path),l.schema;const c={schema:{},count:1,cycle:void 0,path:s.path};t.seen.set(e,c);const f=e._zod.toJSONSchema?.();if(f)c.schema=f;else{const g={...s,schemaPath:[...s.schemaPath,e],path:s.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,c.schema,g);else{const x=c.schema,w=t.processors[i.type];if(!w)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);w(e,t,x,g)}const v=e._zod.parent;v&&(c.ref||(c.ref=v),vt(v,t,g),t.seen.get(v).isParent=!0)}const p=t.metadataRegistry.get(e);return p&&Object.assign(c.schema,p),t.io==="input"&&bn(e)&&(delete c.schema.examples,delete c.schema.default),t.io==="input"&&c.schema._prefault&&((r=c.schema).default??(r.default=c.schema._prefault)),delete c.schema._prefault,t.seen.get(e).schema}function Rd(e,t){const s=e.seen.get(t);if(!s)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=new Map;for(const c of e.seen.entries()){const f=e.metadataRegistry.get(c[0])?.id;if(f){const p=r.get(f);if(p&&p!==c[0])throw new Error(`Duplicate schema id "${f}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(f,c[0])}}const i=c=>{const f=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const v=e.external.registry.get(c[0])?.id,x=e.external.uri??(T=>T);if(v)return{ref:x(v)};const w=c[1].defId??c[1].schema.id??`schema${e.counter++}`;return c[1].defId=w,{defId:w,ref:`${x("__shared")}#/${f}/${w}`}}if(c[1]===s)return{ref:"#"};const h=`#/${f}/`,g=c[1].schema.id??`__schema${e.counter++}`;return{defId:g,ref:h+g}},l=c=>{if(c[1].schema.$ref)return;const f=c[1],{ref:p,defId:h}=i(c);f.def={...f.schema},h&&(f.defId=h);const g=f.schema;for(const v in g)delete g[v];g.$ref=p};if(e.cycles==="throw")for(const c of e.seen.entries()){const f=c[1];if(f.cycle)throw new Error(`Cycle detected: #/${f.cycle?.join("/")}/<root>
77
-
78
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const c of e.seen.entries()){const f=c[1];if(t===c[0]){l(c);continue}if(e.external){const h=e.external.registry.get(c[0])?.id;if(t!==c[0]&&h){l(c);continue}}if(e.metadataRegistry.get(c[0])?.id){l(c);continue}if(f.cycle){l(c);continue}if(f.count>1&&e.reused==="ref"){l(c);continue}}}function Ad(e,t){const s=e.seen.get(t);if(!s)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=c=>{const f=e.seen.get(c);if(f.ref===null)return;const p=f.def??f.schema,h={...p},g=f.ref;if(f.ref=null,g){r(g);const x=e.seen.get(g),w=x.schema;if(w.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(p.allOf=p.allOf??[],p.allOf.push(w)):Object.assign(p,w),Object.assign(p,h),c._zod.parent===g)for(const N in p)N==="$ref"||N==="allOf"||N in h||delete p[N];if(w.$ref&&x.def)for(const N in p)N==="$ref"||N==="allOf"||N in x.def&&JSON.stringify(p[N])===JSON.stringify(x.def[N])&&delete p[N]}const v=c._zod.parent;if(v&&v!==g){r(v);const x=e.seen.get(v);if(x?.schema.$ref&&(p.$ref=x.schema.$ref,x.def))for(const w in p)w==="$ref"||w==="allOf"||w in x.def&&JSON.stringify(p[w])===JSON.stringify(x.def[w])&&delete p[w]}e.override({zodSchema:c,jsonSchema:p,path:f.path??[]})};for(const c of[...e.seen.entries()].reverse())r(c[0]);const i={};if(e.target==="draft-2020-12"?i.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?i.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?i.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){const c=e.external.registry.get(t)?.id;if(!c)throw new Error("Schema is missing an `id` property");i.$id=e.external.uri(c)}Object.assign(i,s.def??s.schema);const l=e.external?.defs??{};for(const c of e.seen.entries()){const f=c[1];f.def&&f.defId&&(l[f.defId]=f.def)}e.external||Object.keys(l).length>0&&(e.target==="draft-2020-12"?i.$defs=l:i.definitions=l);try{const c=JSON.parse(JSON.stringify(i));return Object.defineProperty(c,"~standard",{value:{...t["~standard"],jsonSchema:{input:_d(t,"input",e.processors),output:_d(t,"output",e.processors)}},enumerable:!1,writable:!1}),c}catch{throw new Error("Error converting schema to JSON.")}}function bn(e,t){const s=t??{seen:new Set};if(s.seen.has(e))return!1;s.seen.add(e);const r=e._zod.def;if(r.type==="transform")return!0;if(r.type==="array")return bn(r.element,s);if(r.type==="set")return bn(r.valueType,s);if(r.type==="lazy")return bn(r.getter(),s);if(r.type==="promise"||r.type==="optional"||r.type==="nonoptional"||r.type==="nullable"||r.type==="readonly"||r.type==="default"||r.type==="prefault")return bn(r.innerType,s);if(r.type==="intersection")return bn(r.left,s)||bn(r.right,s);if(r.type==="record"||r.type==="map")return bn(r.keyType,s)||bn(r.valueType,s);if(r.type==="pipe")return bn(r.in,s)||bn(r.out,s);if(r.type==="object"){for(const i in r.shape)if(bn(r.shape[i],s))return!0;return!1}if(r.type==="union"){for(const i of r.options)if(bn(i,s))return!0;return!1}if(r.type==="tuple"){for(const i of r.items)if(bn(i,s))return!0;return!!(r.rest&&bn(r.rest,s))}return!1}const b8=(e,t={})=>s=>{const r=Cd({...s,processors:t});return vt(e,r),Rd(r,e),Ad(r,e)},_d=(e,t,s={})=>r=>{const{libraryOptions:i,target:l}=r??{},c=Cd({...i??{},target:l,io:t,processors:s});return vt(e,c),Rd(c,e),Ad(c,e)},x8={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Mj=(e,t,s,r)=>{const i=s;i.type="string";const{minimum:l,maximum:c,format:f,patterns:p,contentEncoding:h}=e._zod.bag;if(typeof l=="number"&&(i.minLength=l),typeof c=="number"&&(i.maxLength=c),f&&(i.format=x8[f]??f,i.format===""&&delete i.format,f==="time"&&delete i.format),h&&(i.contentEncoding=h),p&&p.size>0){const g=[...p];g.length===1?i.pattern=g[0].source:g.length>1&&(i.allOf=[...g.map(v=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:v.source}))])}},Oj=(e,t,s,r)=>{const i=s,{minimum:l,maximum:c,format:f,multipleOf:p,exclusiveMaximum:h,exclusiveMinimum:g}=e._zod.bag;typeof f=="string"&&f.includes("int")?i.type="integer":i.type="number",typeof g=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(i.minimum=g,i.exclusiveMinimum=!0):i.exclusiveMinimum=g),typeof l=="number"&&(i.minimum=l,typeof g=="number"&&t.target!=="draft-04"&&(g>=l?delete i.minimum:delete i.exclusiveMinimum)),typeof h=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(i.maximum=h,i.exclusiveMaximum=!0):i.exclusiveMaximum=h),typeof c=="number"&&(i.maximum=c,typeof h=="number"&&t.target!=="draft-04"&&(h<=c?delete i.maximum:delete i.exclusiveMaximum)),typeof p=="number"&&(i.multipleOf=p)},Dj=(e,t,s,r)=>{s.type="boolean"},w8=(e,t,s,r)=>{if(t.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema")},S8=(e,t,s,r)=>{if(t.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema")},zj=(e,t,s,r)=>{t.target==="openapi-3.0"?(s.type="string",s.nullable=!0,s.enum=[null]):s.type="null"},E8=(e,t,s,r)=>{if(t.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema")},N8=(e,t,s,r)=>{if(t.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema")},Ij=(e,t,s,r)=>{s.not={}},T8=(e,t,s,r)=>{},Lj=(e,t,s,r)=>{},j8=(e,t,s,r)=>{if(t.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema")},Pj=(e,t,s,r)=>{const i=e._zod.def,l=dj(i.entries);l.every(c=>typeof c=="number")&&(s.type="number"),l.every(c=>typeof c=="string")&&(s.type="string"),s.enum=l},Uj=(e,t,s,r)=>{const i=e._zod.def,l=[];for(const c of i.values)if(c===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof c=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");l.push(Number(c))}else l.push(c);if(l.length!==0)if(l.length===1){const c=l[0];s.type=c===null?"null":typeof c,t.target==="draft-04"||t.target==="openapi-3.0"?s.enum=[c]:s.const=c}else l.every(c=>typeof c=="number")&&(s.type="number"),l.every(c=>typeof c=="string")&&(s.type="string"),l.every(c=>typeof c=="boolean")&&(s.type="boolean"),l.every(c=>c===null)&&(s.type="null"),s.enum=l},C8=(e,t,s,r)=>{if(t.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema")},R8=(e,t,s,r)=>{const i=s,l=e._zod.pattern;if(!l)throw new Error("Pattern not found in template literal");i.type="string",i.pattern=l.source},A8=(e,t,s,r)=>{const i=s,l={type:"string",format:"binary",contentEncoding:"binary"},{minimum:c,maximum:f,mime:p}=e._zod.bag;c!==void 0&&(l.minLength=c),f!==void 0&&(l.maxLength=f),p?p.length===1?(l.contentMediaType=p[0],Object.assign(i,l)):(Object.assign(i,l),i.anyOf=p.map(h=>({contentMediaType:h}))):Object.assign(i,l)},_8=(e,t,s,r)=>{s.type="boolean"},$j=(e,t,s,r)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},k8=(e,t,s,r)=>{if(t.unrepresentable==="throw")throw new Error("Function types cannot be represented in JSON Schema")},Vj=(e,t,s,r)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},M8=(e,t,s,r)=>{if(t.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema")},O8=(e,t,s,r)=>{if(t.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema")},Bj=(e,t,s,r)=>{const i=s,l=e._zod.def,{minimum:c,maximum:f}=e._zod.bag;typeof c=="number"&&(i.minItems=c),typeof f=="number"&&(i.maxItems=f),i.type="array",i.items=vt(l.element,t,{...r,path:[...r.path,"items"]})},Zj=(e,t,s,r)=>{const i=s,l=e._zod.def;i.type="object",i.properties={};const c=l.shape;for(const h in c)i.properties[h]=vt(c[h],t,{...r,path:[...r.path,"properties",h]});const f=new Set(Object.keys(c)),p=new Set([...f].filter(h=>{const g=l.shape[h]._zod;return t.io==="input"?g.optin===void 0:g.optout===void 0}));p.size>0&&(i.required=Array.from(p)),l.catchall?._zod.def.type==="never"?i.additionalProperties=!1:l.catchall?l.catchall&&(i.additionalProperties=vt(l.catchall,t,{...r,path:[...r.path,"additionalProperties"]})):t.io==="output"&&(i.additionalProperties=!1)},Hj=(e,t,s,r)=>{const i=e._zod.def,l=i.inclusive===!1,c=i.options.map((f,p)=>vt(f,t,{...r,path:[...r.path,l?"oneOf":"anyOf",p]}));l?s.oneOf=c:s.anyOf=c},Fj=(e,t,s,r)=>{const i=e._zod.def,l=vt(i.left,t,{...r,path:[...r.path,"allOf",0]}),c=vt(i.right,t,{...r,path:[...r.path,"allOf",1]}),f=h=>"allOf"in h&&Object.keys(h).length===1,p=[...f(l)?l.allOf:[l],...f(c)?c.allOf:[c]];s.allOf=p},D8=(e,t,s,r)=>{const i=s,l=e._zod.def;i.type="array";const c=t.target==="draft-2020-12"?"prefixItems":"items",f=t.target==="draft-2020-12"||t.target==="openapi-3.0"?"items":"additionalItems",p=l.items.map((x,w)=>vt(x,t,{...r,path:[...r.path,c,w]})),h=l.rest?vt(l.rest,t,{...r,path:[...r.path,f,...t.target==="openapi-3.0"?[l.items.length]:[]]}):null;t.target==="draft-2020-12"?(i.prefixItems=p,h&&(i.items=h)):t.target==="openapi-3.0"?(i.items={anyOf:p},h&&i.items.anyOf.push(h),i.minItems=p.length,h||(i.maxItems=p.length)):(i.items=p,h&&(i.additionalItems=h));const{minimum:g,maximum:v}=e._zod.bag;typeof g=="number"&&(i.minItems=g),typeof v=="number"&&(i.maxItems=v)},qj=(e,t,s,r)=>{const i=s,l=e._zod.def;i.type="object";const c=l.keyType,p=c._zod.bag?.patterns;if(l.mode==="loose"&&p&&p.size>0){const g=vt(l.valueType,t,{...r,path:[...r.path,"patternProperties","*"]});i.patternProperties={};for(const v of p)i.patternProperties[v.source]=g}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(i.propertyNames=vt(l.keyType,t,{...r,path:[...r.path,"propertyNames"]})),i.additionalProperties=vt(l.valueType,t,{...r,path:[...r.path,"additionalProperties"]});const h=c._zod.values;if(h){const g=[...h].filter(v=>typeof v=="string"||typeof v=="number");g.length>0&&(i.required=g)}},Yj=(e,t,s,r)=>{const i=e._zod.def,l=vt(i.innerType,t,r),c=t.seen.get(e);t.target==="openapi-3.0"?(c.ref=i.innerType,s.nullable=!0):s.anyOf=[l,{type:"null"}]},Gj=(e,t,s,r)=>{const i=e._zod.def;vt(i.innerType,t,r);const l=t.seen.get(e);l.ref=i.innerType},Xj=(e,t,s,r)=>{const i=e._zod.def;vt(i.innerType,t,r);const l=t.seen.get(e);l.ref=i.innerType,s.default=JSON.parse(JSON.stringify(i.defaultValue))},Kj=(e,t,s,r)=>{const i=e._zod.def;vt(i.innerType,t,r);const l=t.seen.get(e);l.ref=i.innerType,t.io==="input"&&(s._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},Wj=(e,t,s,r)=>{const i=e._zod.def;vt(i.innerType,t,r);const l=t.seen.get(e);l.ref=i.innerType;let c;try{c=i.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}s.default=c},Jj=(e,t,s,r)=>{const i=e._zod.def,l=t.io==="input"?i.in._zod.def.type==="transform"?i.out:i.in:i.out;vt(l,t,r);const c=t.seen.get(e);c.ref=l},Qj=(e,t,s,r)=>{const i=e._zod.def;vt(i.innerType,t,r);const l=t.seen.get(e);l.ref=i.innerType,s.readOnly=!0},z8=(e,t,s,r)=>{const i=e._zod.def;vt(i.innerType,t,r);const l=t.seen.get(e);l.ref=i.innerType},hy=(e,t,s,r)=>{const i=e._zod.def;vt(i.innerType,t,r);const l=t.seen.get(e);l.ref=i.innerType},eC=(e,t,s,r)=>{const i=e._zod.innerType;vt(i,t,r);const l=t.seen.get(e);l.ref=i},tS={string:Mj,number:Oj,boolean:Dj,bigint:w8,symbol:S8,null:zj,undefined:E8,void:N8,never:Ij,any:T8,unknown:Lj,date:j8,enum:Pj,literal:Uj,nan:C8,template_literal:R8,file:A8,success:_8,custom:$j,function:k8,transform:Vj,map:M8,set:O8,array:Bj,object:Zj,union:Hj,intersection:Fj,tuple:D8,record:qj,nullable:Yj,nonoptional:Gj,default:Xj,prefault:Kj,catch:Wj,pipe:Jj,readonly:Qj,promise:z8,optional:hy,lazy:eC};function I8(e,t){if("_idmap"in e){const r=e,i=Cd({...t,processors:tS}),l={};for(const p of r._idmap.entries()){const[h,g]=p;vt(g,i)}const c={},f={registry:r,uri:t?.uri,defs:l};i.external=f;for(const p of r._idmap.entries()){const[h,g]=p;Rd(i,g),c[h]=Ad(i,g)}if(Object.keys(l).length>0){const p=i.target==="draft-2020-12"?"$defs":"definitions";c.__shared={[p]:l}}return{schemas:c}}const s=Cd({...t,processors:tS});return vt(e,s),Rd(s,e),Ad(s,e)}const L8=ce("ZodISODateTime",(e,t)=>{U6.init(e,t),kt.init(e,t)});function P8(e){return YP(L8,e)}const U8=ce("ZodISODate",(e,t)=>{$6.init(e,t),kt.init(e,t)});function $8(e){return GP(U8,e)}const V8=ce("ZodISOTime",(e,t)=>{V6.init(e,t),kt.init(e,t)});function B8(e){return XP(V8,e)}const Z8=ce("ZodISODuration",(e,t)=>{B6.init(e,t),kt.init(e,t)});function H8(e){return KP(Z8,e)}const F8=(e,t)=>{mj.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:s=>kL(e,s)},flatten:{value:s=>_L(e,s)},addIssue:{value:s=>{e.issues.push(s),e.message=JSON.stringify(e.issues,qm,2)}},addIssues:{value:s=>{e.issues.push(...s),e.message=JSON.stringify(e.issues,qm,2)}},isEmpty:{get(){return e.issues.length===0}}})},fs=ce("ZodError",F8,{Parent:Error}),q8=uy(fs),Y8=dy(fs),G8=Xd(fs),tC=Kd(fs),X8=DL(fs),K8=zL(fs),W8=IL(fs),J8=LL(fs),Q8=PL(fs),e9=UL(fs),t9=$L(fs),n9=VL(fs),Ct=ce("ZodType",(e,t)=>(jt.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:_d(e,"input"),output:_d(e,"output")}}),e.toJSONSchema=b8(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...s)=>e.clone(oa(t,{checks:[...t.checks??[],...s.map(r=>typeof r=="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]}),{parent:!0}),e.with=e.check,e.clone=(s,r)=>la(e,s,r),e.brand=()=>e,e.register=((s,r)=>(s.add(e,r),e)),e.parse=(s,r)=>q8(e,s,r,{callee:e.parse}),e.safeParse=(s,r)=>G8(e,s,r),e.parseAsync=async(s,r)=>Y8(e,s,r,{callee:e.parseAsync}),e.safeParseAsync=async(s,r)=>tC(e,s,r),e.spa=e.safeParseAsync,e.encode=(s,r)=>X8(e,s,r),e.decode=(s,r)=>K8(e,s,r),e.encodeAsync=async(s,r)=>W8(e,s,r),e.decodeAsync=async(s,r)=>J8(e,s,r),e.safeEncode=(s,r)=>Q8(e,s,r),e.safeDecode=(s,r)=>e9(e,s,r),e.safeEncodeAsync=async(s,r)=>t9(e,s,r),e.safeDecodeAsync=async(s,r)=>n9(e,s,r),e.refine=(s,r)=>e.check(J9(s,r)),e.superRefine=s=>e.check(Q9(s)),e.overwrite=s=>e.check(ho(s)),e.optional=()=>rS(e),e.exactOptional=()=>P9(e),e.nullable=()=>aS(e),e.nullish=()=>rS(aS(e)),e.nonoptional=s=>H9(e,s),e.array=()=>po(e),e.or=s=>En([e,s]),e.and=s=>M9(e,s),e.transform=s=>iS(e,I9(s)),e.default=s=>V9(e,s),e.prefault=s=>Z9(e,s),e.catch=s=>q9(e,s),e.pipe=s=>iS(e,s),e.readonly=()=>X9(e),e.describe=s=>{const r=e.clone();return yl.add(r,{description:s}),r},Object.defineProperty(e,"description",{get(){return yl.get(e)?.description},configurable:!0}),e.meta=(...s)=>{if(s.length===0)return yl.get(e);const r=e.clone();return yl.add(r,s[0]),r},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=s=>s(e),e)),nC=ce("_ZodString",(e,t)=>{fy.init(e,t),Ct.init(e,t),e._zod.processJSONSchema=(r,i,l)=>Mj(e,r,i);const s=e._zod.bag;e.format=s.format??null,e.minLength=s.minimum??null,e.maxLength=s.maximum??null,e.regex=(...r)=>e.check(s8(...r)),e.includes=(...r)=>e.check(i8(...r)),e.startsWith=(...r)=>e.check(o8(...r)),e.endsWith=(...r)=>e.check(l8(...r)),e.min=(...r)=>e.check(jd(...r)),e.max=(...r)=>e.check(_j(...r)),e.length=(...r)=>e.check(kj(...r)),e.nonempty=(...r)=>e.check(jd(1,...r)),e.lowercase=r=>e.check(r8(r)),e.uppercase=r=>e.check(a8(r)),e.trim=()=>e.check(u8()),e.normalize=(...r)=>e.check(c8(...r)),e.toLowerCase=()=>e.check(d8()),e.toUpperCase=()=>e.check(f8()),e.slugify=()=>e.check(h8())}),s9=ce("ZodString",(e,t)=>{fy.init(e,t),nC.init(e,t),e.email=s=>e.check(jP(r9,s)),e.url=s=>e.check(kP(a9,s)),e.jwt=s=>e.check(qP(x9,s)),e.emoji=s=>e.check(MP(i9,s)),e.guid=s=>e.check(W1(nS,s)),e.uuid=s=>e.check(CP(Ou,s)),e.uuidv4=s=>e.check(RP(Ou,s)),e.uuidv6=s=>e.check(AP(Ou,s)),e.uuidv7=s=>e.check(_P(Ou,s)),e.nanoid=s=>e.check(OP(o9,s)),e.guid=s=>e.check(W1(nS,s)),e.cuid=s=>e.check(DP(l9,s)),e.cuid2=s=>e.check(zP(c9,s)),e.ulid=s=>e.check(IP(u9,s)),e.base64=s=>e.check(ZP(y9,s)),e.base64url=s=>e.check(HP(v9,s)),e.xid=s=>e.check(LP(d9,s)),e.ksuid=s=>e.check(PP(f9,s)),e.ipv4=s=>e.check(UP(h9,s)),e.ipv6=s=>e.check($P(p9,s)),e.cidrv4=s=>e.check(VP(m9,s)),e.cidrv6=s=>e.check(BP(g9,s)),e.e164=s=>e.check(FP(b9,s)),e.datetime=s=>e.check(P8(s)),e.date=s=>e.check($8(s)),e.time=s=>e.check(B8(s)),e.duration=s=>e.check(H8(s))});function be(e){return TP(s9,e)}const kt=ce("ZodStringFormat",(e,t)=>{At.init(e,t),nC.init(e,t)}),r9=ce("ZodEmail",(e,t)=>{_6.init(e,t),kt.init(e,t)}),nS=ce("ZodGUID",(e,t)=>{R6.init(e,t),kt.init(e,t)}),Ou=ce("ZodUUID",(e,t)=>{A6.init(e,t),kt.init(e,t)}),a9=ce("ZodURL",(e,t)=>{k6.init(e,t),kt.init(e,t)}),i9=ce("ZodEmoji",(e,t)=>{M6.init(e,t),kt.init(e,t)}),o9=ce("ZodNanoID",(e,t)=>{O6.init(e,t),kt.init(e,t)}),l9=ce("ZodCUID",(e,t)=>{D6.init(e,t),kt.init(e,t)}),c9=ce("ZodCUID2",(e,t)=>{z6.init(e,t),kt.init(e,t)}),u9=ce("ZodULID",(e,t)=>{I6.init(e,t),kt.init(e,t)}),d9=ce("ZodXID",(e,t)=>{L6.init(e,t),kt.init(e,t)}),f9=ce("ZodKSUID",(e,t)=>{P6.init(e,t),kt.init(e,t)}),h9=ce("ZodIPv4",(e,t)=>{Z6.init(e,t),kt.init(e,t)}),p9=ce("ZodIPv6",(e,t)=>{H6.init(e,t),kt.init(e,t)}),m9=ce("ZodCIDRv4",(e,t)=>{F6.init(e,t),kt.init(e,t)}),g9=ce("ZodCIDRv6",(e,t)=>{q6.init(e,t),kt.init(e,t)}),y9=ce("ZodBase64",(e,t)=>{Y6.init(e,t),kt.init(e,t)}),v9=ce("ZodBase64URL",(e,t)=>{X6.init(e,t),kt.init(e,t)}),b9=ce("ZodE164",(e,t)=>{K6.init(e,t),kt.init(e,t)}),x9=ce("ZodJWT",(e,t)=>{J6.init(e,t),kt.init(e,t)}),sC=ce("ZodNumber",(e,t)=>{Tj.init(e,t),Ct.init(e,t),e._zod.processJSONSchema=(r,i,l)=>Oj(e,r,i),e.gt=(r,i)=>e.check(Q1(r,i)),e.gte=(r,i)=>e.check(qp(r,i)),e.min=(r,i)=>e.check(qp(r,i)),e.lt=(r,i)=>e.check(J1(r,i)),e.lte=(r,i)=>e.check(Fp(r,i)),e.max=(r,i)=>e.check(Fp(r,i)),e.int=r=>e.check(sS(r)),e.safe=r=>e.check(sS(r)),e.positive=r=>e.check(Q1(0,r)),e.nonnegative=r=>e.check(qp(0,r)),e.negative=r=>e.check(J1(0,r)),e.nonpositive=r=>e.check(Fp(0,r)),e.multipleOf=(r,i)=>e.check(eS(r,i)),e.step=(r,i)=>e.check(eS(r,i)),e.finite=()=>e;const s=e._zod.bag;e.minValue=Math.max(s.minimum??Number.NEGATIVE_INFINITY,s.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(s.maximum??Number.POSITIVE_INFINITY,s.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(s.format??"").includes("int")||Number.isSafeInteger(s.multipleOf??.5),e.isFinite=!0,e.format=s.format??null});function w9(e){return WP(sC,e)}const S9=ce("ZodNumberFormat",(e,t)=>{Q6.init(e,t),sC.init(e,t)});function sS(e){return JP(S9,e)}const E9=ce("ZodBoolean",(e,t)=>{eP.init(e,t),Ct.init(e,t),e._zod.processJSONSchema=(s,r,i)=>Dj(e,s,r)});function xn(e){return QP(E9,e)}const N9=ce("ZodNull",(e,t)=>{tP.init(e,t),Ct.init(e,t),e._zod.processJSONSchema=(s,r,i)=>zj(e,s,r)});function T9(e){return e8(N9,e)}const j9=ce("ZodUnknown",(e,t)=>{nP.init(e,t),Ct.init(e,t),e._zod.processJSONSchema=(s,r,i)=>Lj()});function Ds(){return t8(j9)}const C9=ce("ZodNever",(e,t)=>{sP.init(e,t),Ct.init(e,t),e._zod.processJSONSchema=(s,r,i)=>Ij(e,s,r)});function rC(e){return n8(C9,e)}const R9=ce("ZodArray",(e,t)=>{rP.init(e,t),Ct.init(e,t),e._zod.processJSONSchema=(s,r,i)=>Bj(e,s,r,i),e.element=t.element,e.min=(s,r)=>e.check(jd(s,r)),e.nonempty=s=>e.check(jd(1,s)),e.max=(s,r)=>e.check(_j(s,r)),e.length=(s,r)=>e.check(kj(s,r)),e.unwrap=()=>e.element});function po(e,t){return p8(R9,e,t)}const aC=ce("ZodObject",(e,t)=>{iP.init(e,t),Ct.init(e,t),e._zod.processJSONSchema=(s,r,i)=>Zj(e,s,r,i),Qe(e,"shape",()=>t.shape),e.keyof=()=>oC(Object.keys(e._zod.def.shape)),e.catchall=s=>e.clone({...e._zod.def,catchall:s}),e.passthrough=()=>e.clone({...e._zod.def,catchall:Ds()}),e.loose=()=>e.clone({...e._zod.def,catchall:Ds()}),e.strict=()=>e.clone({...e._zod.def,catchall:rC()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=s=>TL(e,s),e.safeExtend=s=>jL(e,s),e.merge=s=>CL(e,s),e.pick=s=>EL(e,s),e.omit=s=>NL(e,s),e.partial=(...s)=>RL(lC,e,s[0]),e.required=(...s)=>AL(cC,e,s[0])});function mt(e,t){const s={type:"object",shape:e??{},..._e(t)};return new aC(s)}function wt(e,t){return new aC({type:"object",shape:e,catchall:rC(),..._e(t)})}const iC=ce("ZodUnion",(e,t)=>{Rj.init(e,t),Ct.init(e,t),e._zod.processJSONSchema=(s,r,i)=>Hj(e,s,r,i),e.options=t.options});function En(e,t){return new iC({type:"union",options:e,..._e(t)})}const A9=ce("ZodDiscriminatedUnion",(e,t)=>{iC.init(e,t),oP.init(e,t)});function _9(e,t,s){return new A9({type:"union",options:t,discriminator:e,..._e(s)})}const k9=ce("ZodIntersection",(e,t)=>{lP.init(e,t),Ct.init(e,t),e._zod.processJSONSchema=(s,r,i)=>Fj(e,s,r,i)});function M9(e,t){return new k9({type:"intersection",left:e,right:t})}const O9=ce("ZodRecord",(e,t)=>{cP.init(e,t),Ct.init(e,t),e._zod.processJSONSchema=(s,r,i)=>qj(e,s,r,i),e.keyType=t.keyType,e.valueType=t.valueType});function $l(e,t,s){return new O9({type:"record",keyType:e,valueType:t,..._e(s)})}const Gm=ce("ZodEnum",(e,t)=>{uP.init(e,t),Ct.init(e,t),e._zod.processJSONSchema=(r,i,l)=>Pj(e,r,i),e.enum=t.entries,e.options=Object.values(t.entries);const s=new Set(Object.keys(t.entries));e.extract=(r,i)=>{const l={};for(const c of r)if(s.has(c))l[c]=t.entries[c];else throw new Error(`Key ${c} not found in enum`);return new Gm({...t,checks:[],..._e(i),entries:l})},e.exclude=(r,i)=>{const l={...t.entries};for(const c of r)if(s.has(c))delete l[c];else throw new Error(`Key ${c} not found in enum`);return new Gm({...t,checks:[],..._e(i),entries:l})}});function oC(e,t){const s=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new Gm({type:"enum",entries:s,..._e(t)})}const D9=ce("ZodLiteral",(e,t)=>{dP.init(e,t),Ct.init(e,t),e._zod.processJSONSchema=(s,r,i)=>Uj(e,s,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function Ie(e,t){return new D9({type:"literal",values:Array.isArray(e)?e:[e],..._e(t)})}const z9=ce("ZodTransform",(e,t)=>{fP.init(e,t),Ct.init(e,t),e._zod.processJSONSchema=(s,r,i)=>Vj(e,s),e._zod.parse=(s,r)=>{if(r.direction==="backward")throw new cj(e.constructor.name);s.addIssue=l=>{if(typeof l=="string")s.issues.push(Ul(l,s.value,t));else{const c=l;c.fatal&&(c.continue=!1),c.code??(c.code="custom"),c.input??(c.input=s.value),c.inst??(c.inst=e),s.issues.push(Ul(c))}};const i=t.transform(s.value,s);return i instanceof Promise?i.then(l=>(s.value=l,s)):(s.value=i,s)}});function I9(e){return new z9({type:"transform",transform:e})}const lC=ce("ZodOptional",(e,t)=>{Aj.init(e,t),Ct.init(e,t),e._zod.processJSONSchema=(s,r,i)=>hy(e,s,r,i),e.unwrap=()=>e._zod.def.innerType});function rS(e){return new lC({type:"optional",innerType:e})}const L9=ce("ZodExactOptional",(e,t)=>{hP.init(e,t),Ct.init(e,t),e._zod.processJSONSchema=(s,r,i)=>hy(e,s,r,i),e.unwrap=()=>e._zod.def.innerType});function P9(e){return new L9({type:"optional",innerType:e})}const U9=ce("ZodNullable",(e,t)=>{pP.init(e,t),Ct.init(e,t),e._zod.processJSONSchema=(s,r,i)=>Yj(e,s,r,i),e.unwrap=()=>e._zod.def.innerType});function aS(e){return new U9({type:"nullable",innerType:e})}const $9=ce("ZodDefault",(e,t)=>{mP.init(e,t),Ct.init(e,t),e._zod.processJSONSchema=(s,r,i)=>Xj(e,s,r,i),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function V9(e,t){return new $9({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():hj(t)}})}const B9=ce("ZodPrefault",(e,t)=>{gP.init(e,t),Ct.init(e,t),e._zod.processJSONSchema=(s,r,i)=>Kj(e,s,r,i),e.unwrap=()=>e._zod.def.innerType});function Z9(e,t){return new B9({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():hj(t)}})}const cC=ce("ZodNonOptional",(e,t)=>{yP.init(e,t),Ct.init(e,t),e._zod.processJSONSchema=(s,r,i)=>Gj(e,s,r,i),e.unwrap=()=>e._zod.def.innerType});function H9(e,t){return new cC({type:"nonoptional",innerType:e,..._e(t)})}const F9=ce("ZodCatch",(e,t)=>{vP.init(e,t),Ct.init(e,t),e._zod.processJSONSchema=(s,r,i)=>Wj(e,s,r,i),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function q9(e,t){return new F9({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const Y9=ce("ZodPipe",(e,t)=>{bP.init(e,t),Ct.init(e,t),e._zod.processJSONSchema=(s,r,i)=>Jj(e,s,r,i),e.in=t.in,e.out=t.out});function iS(e,t){return new Y9({type:"pipe",in:e,out:t})}const G9=ce("ZodReadonly",(e,t)=>{xP.init(e,t),Ct.init(e,t),e._zod.processJSONSchema=(s,r,i)=>Qj(e,s,r,i),e.unwrap=()=>e._zod.def.innerType});function X9(e){return new G9({type:"readonly",innerType:e})}const K9=ce("ZodLazy",(e,t)=>{wP.init(e,t),Ct.init(e,t),e._zod.processJSONSchema=(s,r,i)=>eC(e,s,r,i),e.unwrap=()=>e._zod.def.getter()});function W9(e){return new K9({type:"lazy",getter:e})}const py=ce("ZodCustom",(e,t)=>{SP.init(e,t),Ct.init(e,t),e._zod.processJSONSchema=(s,r,i)=>$j(e,s)});function uC(e,t){return m8(py,e??(()=>!0),t)}function J9(e,t={}){return g8(py,e,t)}function Q9(e){return y8(e)}function kd(e,t={}){const s=new py({type:"custom",check:"custom",fn:r=>r instanceof e,abort:!0,..._e(t)});return s._zod.bag.Class=e,s._zod.check=r=>{r.value instanceof e||r.issues.push({code:"invalid_type",expected:e.name,input:r.value,inst:s,path:[...s._zod.def.path??[]]})},s}var Vl;(function(e){e.assertEqual=i=>{};function t(i){}e.assertIs=t;function s(i){throw new Error}e.assertNever=s,e.arrayToEnum=i=>{const l={};for(const c of i)l[c]=c;return l},e.getValidEnumValues=i=>{const l=e.objectKeys(i).filter(f=>typeof i[i[f]]!="number"),c={};for(const f of l)c[f]=i[f];return e.objectValues(c)},e.objectValues=i=>e.objectKeys(i).map(function(l){return i[l]}),e.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{const l=[];for(const c in i)Object.prototype.hasOwnProperty.call(i,c)&&l.push(c);return l},e.find=(i,l)=>{for(const c of i)if(l(c))return c},e.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&Number.isFinite(i)&&Math.floor(i)===i;function r(i,l=" | "){return i.map(c=>typeof c=="string"?`'${c}'`:c).join(l)}e.joinValues=r,e.jsonStringifyReplacer=(i,l)=>typeof l=="bigint"?l.toString():l})(Vl||(Vl={}));var oS;(function(e){e.mergeShapes=(t,s)=>({...t,...s})})(oS||(oS={}));Vl.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]);Vl.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class Md extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const s=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,s):this.__proto__=s,this.name="ZodError",this.issues=t}format(t){const s=t||function(l){return l.message},r={_errors:[]},i=l=>{for(const c of l.issues)if(c.code==="invalid_union")c.unionErrors.map(i);else if(c.code==="invalid_return_type")i(c.returnTypeError);else if(c.code==="invalid_arguments")i(c.argumentsError);else if(c.path.length===0)r._errors.push(s(c));else{let f=r,p=0;for(;p<c.path.length;){const h=c.path[p];p===c.path.length-1?(f[h]=f[h]||{_errors:[]},f[h]._errors.push(s(c))):f[h]=f[h]||{_errors:[]},f=f[h],p++}}};return i(this),r}static assert(t){if(!(t instanceof Md))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Vl.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=s=>s.message){const s=Object.create(null),r=[];for(const i of this.issues)if(i.path.length>0){const l=i.path[0];s[l]=s[l]||[],s[l].push(t(i))}else r.push(t(i));return{formErrors:r,fieldErrors:s}}get formErrors(){return this.flatten()}}Md.create=e=>new Md(e);var lS;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(lS||(lS={}));var $e;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})($e||($e={}));class cS extends Error{constructor(t,s){super(t),this.name="ParseError",this.type=s.type,this.field=s.field,this.value=s.value,this.line=s.line}}const uS=10,eU=13,Aa=32;function Yp(e){}function tU(e){if(typeof e=="function")throw new TypeError("`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?");const{onEvent:t=Yp,onError:s=Yp,onRetry:r=Yp,onComment:i}=e;let l="",c=!0,f,p="",h=0,g;function v(j){if(c){c=!1,x(j);return}const S=l===""?j:l+j;l=w(S)}function x(j){j.charCodeAt(0)===239&&j.charCodeAt(1)===187&&j.charCodeAt(2)===191&&(j=j.slice(3));const S=l===""?j:l+j;l=w(S)}function w(j){let S=0;if(j.indexOf("\r")===-1){let _=j.indexOf(`
79
- `,S);for(;_!==-1;){if(S===_){h>0&&t({id:f,event:g,data:p}),f=void 0,p="",h=0,g=void 0,S=_+1,_=j.indexOf(`
80
- `,S);continue}const R=j.charCodeAt(S);if(dS(j,S,R)){const M=j.charCodeAt(S+5)===Aa?S+6:S+5,O=j.slice(M,_);if(h===0&&j.charCodeAt(_+1)===uS){t({id:f,event:g,data:O}),f=void 0,p="",g=void 0,S=_+2,_=j.indexOf(`
81
- `,S);continue}p=h===0?O:`${p}
82
- ${O}`,h++}else fS(j,S,R)?g=j.slice(j.charCodeAt(S+6)===Aa?S+7:S+6,_)||void 0:T(j,S,_);S=_+1,_=j.indexOf(`
83
- `,S)}return j.slice(S)}for(;S<j.length;){const _=j.indexOf("\r",S),R=j.indexOf(`
84
- `,S);let M=-1;if(_!==-1&&R!==-1?M=_<R?_:R:_!==-1?_===j.length-1?M=-1:M=_:R!==-1&&(M=R),M===-1)break;T(j,S,M),S=M+1,j.charCodeAt(S-1)===eU&&j.charCodeAt(S)===uS&&S++}return j.slice(S)}function T(j,S,_){if(S===_){A();return}const R=j.charCodeAt(S);if(dS(j,S,R)){const $=j.charCodeAt(S+5)===Aa?S+6:S+5,L=j.slice($,_);p=h===0?L:`${p}
85
- ${L}`,h++;return}if(fS(j,S,R)){g=j.slice(j.charCodeAt(S+6)===Aa?S+7:S+6,_)||void 0;return}if(R===105&&j.charCodeAt(S+1)===100&&j.charCodeAt(S+2)===58){const $=j.slice(j.charCodeAt(S+3)===Aa?S+4:S+3,_);f=$.includes("\0")?void 0:$;return}if(R===58){if(i){const $=j.slice(S,_);i($.slice(j.charCodeAt(S+1)===Aa?2:1))}return}const M=j.slice(S,_),O=M.indexOf(":");if(O===-1){N(M,"",M);return}const I=M.slice(0,O),H=M.charCodeAt(O+1)===Aa?2:1,F=M.slice(O+H);N(I,F,M)}function N(j,S,_){switch(j){case"event":g=S||void 0;break;case"data":p=h===0?S:`${p}
86
- ${S}`,h++;break;case"id":f=S.includes("\0")?void 0:S;break;case"retry":/^\d+$/.test(S)?r(parseInt(S,10)):s(new cS(`Invalid \`retry\` value: "${S}"`,{type:"invalid-retry",value:S,line:_}));break;default:s(new cS(`Unknown field "${j.length>20?`${j.slice(0,20)}…`:j}"`,{type:"unknown-field",field:j,value:S,line:_}));break}}function A(){h>0&&t({id:f,event:g,data:p}),f=void 0,p="",h=0,g=void 0}function C(j={}){l&&j.consume&&T(l,0,l.length),c=!0,f=void 0,p="",h=0,g=void 0,l=""}return{feed:v,reset:C}}function dS(e,t,s){return s===100&&e.charCodeAt(t+1)===97&&e.charCodeAt(t+2)===116&&e.charCodeAt(t+3)===97&&e.charCodeAt(t+4)===58}function fS(e,t,s){return s===101&&e.charCodeAt(t+1)===118&&e.charCodeAt(t+2)===101&&e.charCodeAt(t+3)===110&&e.charCodeAt(t+4)===116&&e.charCodeAt(t+5)===58}class nU extends TransformStream{constructor({onError:t,onRetry:s,onComment:r}={}){let i;super({start(l){i=tU({onEvent:c=>{l.enqueue(c)},onError(c){t==="terminate"?l.error(c):typeof t=="function"&&t(c)},onRetry:s,onComment:r})},transform(l){i.feed(l)}})}}var Jl=({prefix:e,size:t=16,alphabet:s="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",separator:r="-"}={})=>{const i=()=>{const l=s.length,c=new Array(t);for(let f=0;f<t;f++)c[f]=s[Math.random()*l|0];return c.join("")};if(e==null)return i;if(s.includes(r))throw new pL({argument:"separator",message:`The separator "${r}" must not be part of the alphabet "${s}".`});return()=>`${e}${r}${i()}`},sU=Jl();function Oi(e){if(e==null)return{};const t={};if(e instanceof Headers)e.forEach((s,r)=>{t[r.toLowerCase()]=s});else{Array.isArray(e)||(e=Object.entries(e));for(const[s,r]of e)r!=null&&(t[s.toLowerCase()]=r)}return t}var rU=/"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*:/,aU=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/;function hS(e){const t=JSON.parse(e);return t===null||typeof t!="object"||rU.test(e)===!1&&aU.test(e)===!1?t:iU(t)}function iU(e){let t=[e];for(;t.length;){const s=t;t=[];for(const r of s){if(Object.prototype.hasOwnProperty.call(r,"__proto__"))throw new SyntaxError("Object contains forbidden prototype property");if(Object.prototype.hasOwnProperty.call(r,"constructor")&&r.constructor!==null&&typeof r.constructor=="object"&&Object.prototype.hasOwnProperty.call(r.constructor,"prototype"))throw new SyntaxError("Object contains forbidden prototype property");for(const i in r){const l=r[i];l&&typeof l=="object"&&t.push(l)}}}return e}function oU(e){const{stackTraceLimit:t}=Error;try{Error.stackTraceLimit=0}catch{return hS(e)}try{return hS(e)}finally{Error.stackTraceLimit=t}}function my(e){if(e.type==="object"||Array.isArray(e.type)&&e.type.includes("object")){e.additionalProperties=!1;const{properties:s}=e;if(s!=null)for(const r of Object.keys(s))s[r]=_a(s[r])}e.items!=null&&(e.items=Array.isArray(e.items)?e.items.map(_a):_a(e.items)),e.anyOf!=null&&(e.anyOf=e.anyOf.map(_a)),e.allOf!=null&&(e.allOf=e.allOf.map(_a)),e.oneOf!=null&&(e.oneOf=e.oneOf.map(_a));const{definitions:t}=e;if(t!=null)for(const s of Object.keys(t))t[s]=_a(t[s]);return e}function _a(e){return typeof e=="boolean"?e:my(e)}var lU=Symbol("Let zodToJsonSchema decide on which parser to use"),pS={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:"definitions",strictUnions:!1,definitions:{},errorMessages:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref"},cU=e=>typeof e=="string"?{...pS,name:e}:{...pS,...e};function Xn(){return{}}function uU(e,t){var s,r,i;const l={type:"array"};return(s=e.type)!=null&&s._def&&((i=(r=e.type)==null?void 0:r._def)==null?void 0:i.typeName)!==$e.ZodAny&&(l.items=ut(e.type._def,{...t,currentPath:[...t.currentPath,"items"]})),e.minLength&&(l.minItems=e.minLength.value),e.maxLength&&(l.maxItems=e.maxLength.value),e.exactLength&&(l.minItems=e.exactLength.value,l.maxItems=e.exactLength.value),l}function dU(e){const t={type:"integer",format:"int64"};if(!e.checks)return t;for(const s of e.checks)switch(s.kind){case"min":s.inclusive?t.minimum=s.value:t.exclusiveMinimum=s.value;break;case"max":s.inclusive?t.maximum=s.value:t.exclusiveMaximum=s.value;break;case"multipleOf":t.multipleOf=s.value;break}return t}function fU(){return{type:"boolean"}}function dC(e,t){return ut(e.type._def,t)}var hU=(e,t)=>ut(e.innerType._def,t);function fC(e,t,s){const r=s??t.dateStrategy;if(Array.isArray(r))return{anyOf:r.map((i,l)=>fC(e,t,i))};switch(r){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return pU(e)}}var pU=e=>{const t={type:"integer",format:"unix-time"};for(const s of e.checks)switch(s.kind){case"min":t.minimum=s.value;break;case"max":t.maximum=s.value;break}return t};function mU(e,t){return{...ut(e.innerType._def,t),default:e.defaultValue()}}function gU(e,t){return t.effectStrategy==="input"?ut(e.schema._def,t):Xn()}function yU(e){return{type:"string",enum:Array.from(e.values)}}var vU=e=>"type"in e&&e.type==="string"?!1:"allOf"in e;function bU(e,t){const s=[ut(e.left._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),ut(e.right._def,{...t,currentPath:[...t.currentPath,"allOf","1"]})].filter(i=>!!i),r=[];return s.forEach(i=>{if(vU(i))r.push(...i.allOf);else{let l=i;if("additionalProperties"in i&&i.additionalProperties===!1){const{additionalProperties:c,...f}=i;l=f}r.push(l)}}),r.length?{allOf:r}:void 0}function xU(e){const t=typeof e.value;return t!=="bigint"&&t!=="number"&&t!=="boolean"&&t!=="string"?{type:Array.isArray(e.value)?"array":"object"}:{type:t==="bigint"?"integer":t,const:e.value}}var Gp=void 0,vs={cuid:/^[cC][^\s-]{8,}$/,cuid2:/^[0-9a-z]+$/,ulid:/^[0-9A-HJKMNP-TV-Z]{26}$/,email:/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,emoji:()=>(Gp===void 0&&(Gp=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Gp),uuid:/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/,ipv4:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ipv4Cidr:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,ipv6:/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,ipv6Cidr:/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,base64:/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64url:/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nanoid:/^[a-zA-Z0-9_-]{21}$/,jwt:/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/};function hC(e,t){const s={type:"string"};if(e.checks)for(const r of e.checks)switch(r.kind){case"min":s.minLength=typeof s.minLength=="number"?Math.max(s.minLength,r.value):r.value;break;case"max":s.maxLength=typeof s.maxLength=="number"?Math.min(s.maxLength,r.value):r.value;break;case"email":switch(t.emailStrategy){case"format:email":bs(s,"email",r.message,t);break;case"format:idn-email":bs(s,"idn-email",r.message,t);break;case"pattern:zod":vn(s,vs.email,r.message,t);break}break;case"url":bs(s,"uri",r.message,t);break;case"uuid":bs(s,"uuid",r.message,t);break;case"regex":vn(s,r.regex,r.message,t);break;case"cuid":vn(s,vs.cuid,r.message,t);break;case"cuid2":vn(s,vs.cuid2,r.message,t);break;case"startsWith":vn(s,RegExp(`^${Xp(r.value,t)}`),r.message,t);break;case"endsWith":vn(s,RegExp(`${Xp(r.value,t)}$`),r.message,t);break;case"datetime":bs(s,"date-time",r.message,t);break;case"date":bs(s,"date",r.message,t);break;case"time":bs(s,"time",r.message,t);break;case"duration":bs(s,"duration",r.message,t);break;case"length":s.minLength=typeof s.minLength=="number"?Math.max(s.minLength,r.value):r.value,s.maxLength=typeof s.maxLength=="number"?Math.min(s.maxLength,r.value):r.value;break;case"includes":{vn(s,RegExp(Xp(r.value,t)),r.message,t);break}case"ip":{r.version!=="v6"&&bs(s,"ipv4",r.message,t),r.version!=="v4"&&bs(s,"ipv6",r.message,t);break}case"base64url":vn(s,vs.base64url,r.message,t);break;case"jwt":vn(s,vs.jwt,r.message,t);break;case"cidr":{r.version!=="v6"&&vn(s,vs.ipv4Cidr,r.message,t),r.version!=="v4"&&vn(s,vs.ipv6Cidr,r.message,t);break}case"emoji":vn(s,vs.emoji(),r.message,t);break;case"ulid":{vn(s,vs.ulid,r.message,t);break}case"base64":{switch(t.base64Strategy){case"format:binary":{bs(s,"binary",r.message,t);break}case"contentEncoding:base64":{s.contentEncoding="base64";break}case"pattern:zod":{vn(s,vs.base64,r.message,t);break}}break}case"nanoid":vn(s,vs.nanoid,r.message,t)}return s}function Xp(e,t){return t.patternStrategy==="escape"?SU(e):e}var wU=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function SU(e){let t="";for(let s=0;s<e.length;s++)wU.has(e[s])||(t+="\\"),t+=e[s];return t}function bs(e,t,s,r){var i;e.format||(i=e.anyOf)!=null&&i.some(l=>l.format)?(e.anyOf||(e.anyOf=[]),e.format&&(e.anyOf.push({format:e.format}),delete e.format),e.anyOf.push({format:t,...s&&r.errorMessages&&{errorMessage:{format:s}}})):e.format=t}function vn(e,t,s,r){var i;e.pattern||(i=e.allOf)!=null&&i.some(l=>l.pattern)?(e.allOf||(e.allOf=[]),e.pattern&&(e.allOf.push({pattern:e.pattern}),delete e.pattern),e.allOf.push({pattern:mS(t,r),...s&&r.errorMessages&&{errorMessage:{pattern:s}}})):e.pattern=mS(t,r)}function mS(e,t){var s;if(!t.applyRegexFlags||!e.flags)return e.source;const r={i:e.flags.includes("i"),m:e.flags.includes("m"),s:e.flags.includes("s")},i=r.i?e.source.toLowerCase():e.source;let l="",c=!1,f=!1,p=!1;for(let h=0;h<i.length;h++){if(c){l+=i[h],c=!1;continue}if(r.i){if(f){if(i[h].match(/[a-z]/)){p?(l+=i[h],l+=`${i[h-2]}-${i[h]}`.toUpperCase(),p=!1):i[h+1]==="-"&&((s=i[h+2])!=null&&s.match(/[a-z]/))?(l+=i[h],p=!0):l+=`${i[h]}${i[h].toUpperCase()}`;continue}}else if(i[h].match(/[a-z]/)){l+=`[${i[h]}${i[h].toUpperCase()}]`;continue}}if(r.m){if(i[h]==="^"){l+=`(^|(?<=[\r
87
- ]))`;continue}else if(i[h]==="$"){l+=`($|(?=[\r
88
- ]))`;continue}}if(r.s&&i[h]==="."){l+=f?`${i[h]}\r
89
- `:`[${i[h]}\r
90
- ]`;continue}l+=i[h],i[h]==="\\"?c=!0:f&&i[h]==="]"?f=!1:!f&&i[h]==="["&&(f=!0)}try{new RegExp(l)}catch{return console.warn(`Could not convert regex pattern at ${t.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),e.source}return l}function pC(e,t){var s,r,i,l,c,f;const p={type:"object",additionalProperties:(s=ut(e.valueType._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]}))!=null?s:t.allowedAdditionalProperties};if(((r=e.keyType)==null?void 0:r._def.typeName)===$e.ZodString&&((i=e.keyType._def.checks)!=null&&i.length)){const{type:h,...g}=hC(e.keyType._def,t);return{...p,propertyNames:g}}else{if(((l=e.keyType)==null?void 0:l._def.typeName)===$e.ZodEnum)return{...p,propertyNames:{enum:e.keyType._def.values}};if(((c=e.keyType)==null?void 0:c._def.typeName)===$e.ZodBranded&&e.keyType._def.type._def.typeName===$e.ZodString&&((f=e.keyType._def.type._def.checks)!=null&&f.length)){const{type:h,...g}=dC(e.keyType._def,t);return{...p,propertyNames:g}}}return p}function EU(e,t){if(t.mapStrategy==="record")return pC(e,t);const s=ut(e.keyType._def,{...t,currentPath:[...t.currentPath,"items","items","0"]})||Xn(),r=ut(e.valueType._def,{...t,currentPath:[...t.currentPath,"items","items","1"]})||Xn();return{type:"array",maxItems:125,items:{type:"array",items:[s,r],minItems:2,maxItems:2}}}function NU(e){const t=e.values,r=Object.keys(e.values).filter(l=>typeof t[t[l]]!="number").map(l=>t[l]),i=Array.from(new Set(r.map(l=>typeof l)));return{type:i.length===1?i[0]==="string"?"string":"number":["string","number"],enum:r}}function TU(){return{not:Xn()}}function jU(){return{type:"null"}}var Xm={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function CU(e,t){const s=e.options instanceof Map?Array.from(e.options.values()):e.options;if(s.every(r=>r._def.typeName in Xm&&(!r._def.checks||!r._def.checks.length))){const r=s.reduce((i,l)=>{const c=Xm[l._def.typeName];return c&&!i.includes(c)?[...i,c]:i},[]);return{type:r.length>1?r:r[0]}}else if(s.every(r=>r._def.typeName==="ZodLiteral"&&!r.description)){const r=s.reduce((i,l)=>{const c=typeof l._def.value;switch(c){case"string":case"number":case"boolean":return[...i,c];case"bigint":return[...i,"integer"];case"object":if(l._def.value===null)return[...i,"null"];default:return i}},[]);if(r.length===s.length){const i=r.filter((l,c,f)=>f.indexOf(l)===c);return{type:i.length>1?i:i[0],enum:s.reduce((l,c)=>l.includes(c._def.value)?l:[...l,c._def.value],[])}}}else if(s.every(r=>r._def.typeName==="ZodEnum"))return{type:"string",enum:s.reduce((r,i)=>[...r,...i._def.values.filter(l=>!r.includes(l))],[])};return RU(e,t)}var RU=(e,t)=>{const s=(e.options instanceof Map?Array.from(e.options.values()):e.options).map((r,i)=>ut(r._def,{...t,currentPath:[...t.currentPath,"anyOf",`${i}`]})).filter(r=>!!r&&(!t.strictUnions||typeof r=="object"&&Object.keys(r).length>0));return s.length?{anyOf:s}:void 0};function AU(e,t){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(e.innerType._def.typeName)&&(!e.innerType._def.checks||!e.innerType._def.checks.length))return{type:[Xm[e.innerType._def.typeName],"null"]};const s=ut(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","0"]});return s&&{anyOf:[s,{type:"null"}]}}function _U(e){const t={type:"number"};if(!e.checks)return t;for(const s of e.checks)switch(s.kind){case"int":t.type="integer";break;case"min":s.inclusive?t.minimum=s.value:t.exclusiveMinimum=s.value;break;case"max":s.inclusive?t.maximum=s.value:t.exclusiveMaximum=s.value;break;case"multipleOf":t.multipleOf=s.value;break}return t}function kU(e,t){const s={type:"object",properties:{}},r=[],i=e.shape();for(const c in i){let f=i[c];if(f===void 0||f._def===void 0)continue;const p=OU(f),h=ut(f._def,{...t,currentPath:[...t.currentPath,"properties",c],propertyPath:[...t.currentPath,"properties",c]});h!==void 0&&(s.properties[c]=h,p||r.push(c))}r.length&&(s.required=r);const l=MU(e,t);return l!==void 0&&(s.additionalProperties=l),s}function MU(e,t){if(e.catchall._def.typeName!=="ZodNever")return ut(e.catchall._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]});switch(e.unknownKeys){case"passthrough":return t.allowedAdditionalProperties;case"strict":return t.rejectedAdditionalProperties;case"strip":return t.removeAdditionalStrategy==="strict"?t.allowedAdditionalProperties:t.rejectedAdditionalProperties}}function OU(e){try{return e.isOptional()}catch{return!0}}var DU=(e,t)=>{var s;if(t.currentPath.toString()===((s=t.propertyPath)==null?void 0:s.toString()))return ut(e.innerType._def,t);const r=ut(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","1"]});return r?{anyOf:[{not:Xn()},r]}:Xn()},zU=(e,t)=>{if(t.pipeStrategy==="input")return ut(e.in._def,t);if(t.pipeStrategy==="output")return ut(e.out._def,t);const s=ut(e.in._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),r=ut(e.out._def,{...t,currentPath:[...t.currentPath,"allOf",s?"1":"0"]});return{allOf:[s,r].filter(i=>i!==void 0)}};function IU(e,t){return ut(e.type._def,t)}function LU(e,t){const r={type:"array",uniqueItems:!0,items:ut(e.valueType._def,{...t,currentPath:[...t.currentPath,"items"]})};return e.minSize&&(r.minItems=e.minSize.value),e.maxSize&&(r.maxItems=e.maxSize.value),r}function PU(e,t){return e.rest?{type:"array",minItems:e.items.length,items:e.items.map((s,r)=>ut(s._def,{...t,currentPath:[...t.currentPath,"items",`${r}`]})).reduce((s,r)=>r===void 0?s:[...s,r],[]),additionalItems:ut(e.rest._def,{...t,currentPath:[...t.currentPath,"additionalItems"]})}:{type:"array",minItems:e.items.length,maxItems:e.items.length,items:e.items.map((s,r)=>ut(s._def,{...t,currentPath:[...t.currentPath,"items",`${r}`]})).reduce((s,r)=>r===void 0?s:[...s,r],[])}}function UU(){return{not:Xn()}}function $U(){return Xn()}var VU=(e,t)=>ut(e.innerType._def,t),BU=(e,t,s)=>{switch(t){case $e.ZodString:return hC(e,s);case $e.ZodNumber:return _U(e);case $e.ZodObject:return kU(e,s);case $e.ZodBigInt:return dU(e);case $e.ZodBoolean:return fU();case $e.ZodDate:return fC(e,s);case $e.ZodUndefined:return UU();case $e.ZodNull:return jU();case $e.ZodArray:return uU(e,s);case $e.ZodUnion:case $e.ZodDiscriminatedUnion:return CU(e,s);case $e.ZodIntersection:return bU(e,s);case $e.ZodTuple:return PU(e,s);case $e.ZodRecord:return pC(e,s);case $e.ZodLiteral:return xU(e);case $e.ZodEnum:return yU(e);case $e.ZodNativeEnum:return NU(e);case $e.ZodNullable:return AU(e,s);case $e.ZodOptional:return DU(e,s);case $e.ZodMap:return EU(e,s);case $e.ZodSet:return LU(e,s);case $e.ZodLazy:return()=>e.getter()._def;case $e.ZodPromise:return IU(e,s);case $e.ZodNaN:case $e.ZodNever:return TU();case $e.ZodEffects:return gU(e,s);case $e.ZodAny:return Xn();case $e.ZodUnknown:return $U();case $e.ZodDefault:return mU(e,s);case $e.ZodBranded:return dC(e,s);case $e.ZodReadonly:return VU(e,s);case $e.ZodCatch:return hU(e,s);case $e.ZodPipeline:return zU(e,s);case $e.ZodFunction:case $e.ZodVoid:case $e.ZodSymbol:return;default:return(r=>{})()}},ZU=(e,t)=>{let s=0;for(;s<e.length&&s<t.length&&e[s]===t[s];s++);return[(e.length-s).toString(),...t.slice(s)].join("/")};function ut(e,t,s=!1){var r;const i=t.seen.get(e);if(t.override){const p=(r=t.override)==null?void 0:r.call(t,e,t,i,s);if(p!==lU)return p}if(i&&!s){const p=HU(i,t);if(p!==void 0)return p}const l={def:e,path:t.currentPath,jsonSchema:void 0};t.seen.set(e,l);const c=BU(e,e.typeName,t),f=typeof c=="function"?ut(c(),t):c;if(f&&FU(e,t,f),t.postProcess){const p=t.postProcess(f,e,t);return l.jsonSchema=f,p}return l.jsonSchema=f,f}var HU=(e,t)=>{switch(t.$refStrategy){case"root":return{$ref:e.path.join("/")};case"relative":return{$ref:ZU(t.currentPath,e.path)};case"none":case"seen":return e.path.length<t.currentPath.length&&e.path.every((s,r)=>t.currentPath[r]===s)?(console.warn(`Recursive reference detected at ${t.currentPath.join("/")}! Defaulting to any`),Xn()):t.$refStrategy==="seen"?Xn():void 0}},FU=(e,t,s)=>(e.description&&(s.description=e.description),s),qU=e=>{const t=cU(e),s=t.name!==void 0?[...t.basePath,t.definitionPath,t.name]:t.basePath;return{...t,currentPath:s,propertyPath:void 0,seen:new Map(Object.entries(t.definitions).map(([r,i])=>[i._def,{def:i._def,path:[...t.basePath,t.definitionPath,r],jsonSchema:void 0}]))}},YU=(e,t)=>{var s;const r=qU(t);let i=typeof t=="object"&&t.definitions?Object.entries(t.definitions).reduce((h,[g,v])=>{var x;return{...h,[g]:(x=ut(v._def,{...r,currentPath:[...r.basePath,r.definitionPath,g]},!0))!=null?x:Xn()}},{}):void 0;const l=typeof t=="string"?t:t?.nameStrategy==="title"?void 0:t?.name,c=(s=ut(e._def,l===void 0?r:{...r,currentPath:[...r.basePath,r.definitionPath,l]},!1))!=null?s:Xn(),f=typeof t=="object"&&t.name!==void 0&&t.nameStrategy==="title"?t.name:void 0;f!==void 0&&(c.title=f);const p=l===void 0?i?{...c,[r.definitionPath]:i}:c:{$ref:[...r.$refStrategy==="relative"?[]:r.basePath,r.definitionPath,l].join("/"),[r.definitionPath]:{...i,[l]:c}};return p.$schema="http://json-schema.org/draft-07/schema#",p},Km=Symbol.for("vercel.ai.schema");function GU(e){let t;return()=>(t==null&&(t=e()),t)}function Jd(e,{validate:t}={}){return{[Km]:!0,_type:void 0,get jsonSchema(){return typeof e=="function"&&(e=e()),e},validate:t}}function XU(e){return typeof e=="object"&&e!==null&&Km in e&&e[Km]===!0&&"jsonSchema"in e&&"validate"in e}function gy(e){return e==null?Jd({properties:{},additionalProperties:!1}):XU(e)?e:"~standard"in e?e["~standard"].vendor==="zod"?mC(e):KU(e):e()}function KU(e){return Jd(()=>my(e["~standard"].jsonSchema.input({target:"draft-07"})),{validate:async t=>{const s=await e["~standard"].validate(t);return"value"in s?{success:!0,value:s.value}:{success:!1,error:new no({value:t,cause:s.issues})}}})}function WU(e,t){var s;const r=(s=void 0)!=null?s:!1;return Jd(()=>YU(e,{$refStrategy:r?"root":"none"}),{validate:async i=>{const l=await e.safeParseAsync(i);return l.success?{success:!0,value:l.data}:{success:!1,error:l.error}}})}function JU(e,t){var s;const r=(s=void 0)!=null?s:!1;return Jd(()=>my(I8(e,{target:"draft-7",io:"input",reused:r?"ref":"inline"})),{validate:async i=>{const l=await tC(e,i);return l.success?{success:!0,value:l.data}:{success:!1,error:l.error}}})}function QU(e){return"_zod"in e}function mC(e,t){return QU(e)?JU(e):WU(e)}async function gS({value:e,schema:t,context:s}){const r=await Bl({value:e,schema:t,context:s});if(!r.success)throw no.wrap({value:e,cause:r.error,context:s});return r.value}async function Bl({value:e,schema:t,context:s}){const r=gy(t);try{if(r.validate==null)return{success:!0,value:e,rawValue:e};const i=await r.validate(e);return i.success?{success:!0,value:i.value,rawValue:e}:{success:!1,error:no.wrap({value:e,cause:i.error,context:s}),rawValue:e}}catch(i){return{success:!1,error:no.wrap({value:e,cause:i,context:s}),rawValue:e}}}async function Za({text:e,schema:t}){try{const s=oU(e);return t==null?{success:!0,value:s,rawValue:s}:await Bl({value:s,schema:t})}catch(s){return{success:!1,error:I1.isInstance(s)?s:new I1({text:e,cause:s}),rawValue:void 0}}}function e$({stream:e,schema:t}){return e.pipeThrough(new TextDecoderStream).pipeThrough(new nU).pipeThrough(new TransformStream({async transform({data:s},r){s!=="[DONE]"&&r.enqueue(await Za({text:s,schema:t}))}}))}async function Br(e){return typeof e=="function"&&(e=e()),Promise.resolve(e)}var t$=Object.defineProperty,n$=(e,t)=>{for(var s in t)t$(e,s,{get:t[s],enumerable:!0})},gC="AI_NoObjectGeneratedError",yC=`vercel.ai.error.${gC}`,s$=Symbol.for(yC),vC,Kr=class extends Bs{constructor({message:e="No object generated.",cause:t,text:s,response:r,usage:i,finishReason:l}){super({name:gC,message:e,cause:t}),this[vC]=!0,this.text=s,this.response=r,this.usage=i,this.finishReason=l}static isInstance(e){return Bs.hasMarker(e,yC)}};vC=s$;var bC="AI_UIMessageStreamError",xC=`vercel.ai.error.${bC}`,r$=Symbol.for(xC),wC,Di=class extends Bs{constructor({chunkType:e,chunkId:t,message:s}){super({name:bC,message:s}),this[wC]=!0,this.chunkType=e,this.chunkId=t}static isInstance(e){return Bs.hasMarker(e,xC)}};wC=r$;var SC=En([be(),kd(Uint8Array),kd(ArrayBuffer),uC(e=>{var t,s;return(s=(t=globalThis.Buffer)==null?void 0:t.isBuffer(e))!=null?s:!1},{message:"Must be a Buffer"})]),Zl=W9(()=>En([T9(),be(),w9(),xn(),$l(be(),Zl.optional()),po(Zl)])),Ge=$l(be(),$l(be(),Zl.optional())),EC=mt({type:Ie("text"),text:be(),providerOptions:Ge.optional()}),a$=mt({type:Ie("image"),image:En([SC,kd(URL)]),mediaType:be().optional(),providerOptions:Ge.optional()}),NC=mt({type:Ie("file"),data:En([SC,kd(URL)]),filename:be().optional(),mediaType:be(),providerOptions:Ge.optional()}),i$=mt({type:Ie("reasoning"),text:be(),providerOptions:Ge.optional()}),o$=mt({type:Ie("tool-call"),toolCallId:be(),toolName:be(),input:Ds(),providerOptions:Ge.optional(),providerExecuted:xn().optional()}),l$=_9("type",[mt({type:Ie("text"),value:be(),providerOptions:Ge.optional()}),mt({type:Ie("json"),value:Zl,providerOptions:Ge.optional()}),mt({type:Ie("execution-denied"),reason:be().optional(),providerOptions:Ge.optional()}),mt({type:Ie("error-text"),value:be(),providerOptions:Ge.optional()}),mt({type:Ie("error-json"),value:Zl,providerOptions:Ge.optional()}),mt({type:Ie("content"),value:po(En([mt({type:Ie("text"),text:be(),providerOptions:Ge.optional()}),mt({type:Ie("media"),data:be(),mediaType:be()}),mt({type:Ie("file-data"),data:be(),mediaType:be(),filename:be().optional(),providerOptions:Ge.optional()}),mt({type:Ie("file-url"),url:be(),providerOptions:Ge.optional()}),mt({type:Ie("file-id"),fileId:En([be(),$l(be(),be())]),providerOptions:Ge.optional()}),mt({type:Ie("image-data"),data:be(),mediaType:be(),providerOptions:Ge.optional()}),mt({type:Ie("image-url"),url:be(),providerOptions:Ge.optional()}),mt({type:Ie("image-file-id"),fileId:En([be(),$l(be(),be())]),providerOptions:Ge.optional()}),mt({type:Ie("custom"),providerOptions:Ge.optional()})]))})]),TC=mt({type:Ie("tool-result"),toolCallId:be(),toolName:be(),output:l$,providerOptions:Ge.optional()}),c$=mt({type:Ie("tool-approval-request"),approvalId:be(),toolCallId:be()}),u$=mt({type:Ie("tool-approval-response"),approvalId:be(),approved:xn(),reason:be().optional()}),d$=mt({role:Ie("system"),content:be(),providerOptions:Ge.optional()}),f$=mt({role:Ie("user"),content:En([be(),po(En([EC,a$,NC]))]),providerOptions:Ge.optional()}),h$=mt({role:Ie("assistant"),content:En([be(),po(En([EC,NC,i$,o$,TC,c$]))]),providerOptions:Ge.optional()}),p$=mt({role:Ie("tool"),content:po(En([TC,u$])),providerOptions:Ge.optional()});En([d$,f$,h$,p$]);function jC(e,t){if(e===void 0&&t===void 0)return;if(e===void 0)return t;if(t===void 0)return e;const s={...e};for(const r in t)if(Object.prototype.hasOwnProperty.call(t,r)){const i=t[r];if(i===void 0)continue;const l=r in e?e[r]:void 0,c=i!==null&&typeof i=="object"&&!Array.isArray(i)&&!(i instanceof Date)&&!(i instanceof RegExp),f=l!=null&&typeof l=="object"&&!Array.isArray(l)&&!(l instanceof Date)&&!(l instanceof RegExp);c&&f?s[r]=jC(l,i):s[r]=i}return s}var m$={};n$(m$,{array:()=>b$,choice:()=>x$,json:()=>w$,object:()=>v$,text:()=>y$});function g$(e){const t=["ROOT"];let s=-1,r=null;function i(p,h,g){switch(p){case'"':{s=h,t.pop(),t.push(g),t.push("INSIDE_STRING");break}case"f":case"t":case"n":{s=h,r=h,t.pop(),t.push(g),t.push("INSIDE_LITERAL");break}case"-":{t.pop(),t.push(g),t.push("INSIDE_NUMBER");break}case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":{s=h,t.pop(),t.push(g),t.push("INSIDE_NUMBER");break}case"{":{s=h,t.pop(),t.push(g),t.push("INSIDE_OBJECT_START");break}case"[":{s=h,t.pop(),t.push(g),t.push("INSIDE_ARRAY_START");break}}}function l(p,h){switch(p){case",":{t.pop(),t.push("INSIDE_OBJECT_AFTER_COMMA");break}case"}":{s=h,t.pop();break}}}function c(p,h){switch(p){case",":{t.pop(),t.push("INSIDE_ARRAY_AFTER_COMMA");break}case"]":{s=h,t.pop();break}}}for(let p=0;p<e.length;p++){const h=e[p];switch(t[t.length-1]){case"ROOT":i(h,p,"FINISH");break;case"INSIDE_OBJECT_START":{switch(h){case'"':{t.pop(),t.push("INSIDE_OBJECT_KEY");break}case"}":{s=p,t.pop();break}}break}case"INSIDE_OBJECT_AFTER_COMMA":{h==='"'&&(t.pop(),t.push("INSIDE_OBJECT_KEY"));break}case"INSIDE_OBJECT_KEY":{h==='"'&&(t.pop(),t.push("INSIDE_OBJECT_AFTER_KEY"));break}case"INSIDE_OBJECT_AFTER_KEY":{h===":"&&(t.pop(),t.push("INSIDE_OBJECT_BEFORE_VALUE"));break}case"INSIDE_OBJECT_BEFORE_VALUE":{i(h,p,"INSIDE_OBJECT_AFTER_VALUE");break}case"INSIDE_OBJECT_AFTER_VALUE":{l(h,p);break}case"INSIDE_STRING":{switch(h){case'"':{t.pop(),s=p;break}case"\\":{t.push("INSIDE_STRING_ESCAPE");break}default:s=p}break}case"INSIDE_ARRAY_START":{h==="]"?(s=p,t.pop()):(s=p,i(h,p,"INSIDE_ARRAY_AFTER_VALUE"));break}case"INSIDE_ARRAY_AFTER_VALUE":{switch(h){case",":{t.pop(),t.push("INSIDE_ARRAY_AFTER_COMMA");break}case"]":{s=p,t.pop();break}default:{s=p;break}}break}case"INSIDE_ARRAY_AFTER_COMMA":{i(h,p,"INSIDE_ARRAY_AFTER_VALUE");break}case"INSIDE_STRING_ESCAPE":{t.pop(),s=p;break}case"INSIDE_NUMBER":{switch(h){case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":{s=p;break}case"e":case"E":case"-":case".":break;case",":{t.pop(),t[t.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&c(h,p),t[t.length-1]==="INSIDE_OBJECT_AFTER_VALUE"&&l(h,p);break}case"}":{t.pop(),t[t.length-1]==="INSIDE_OBJECT_AFTER_VALUE"&&l(h,p);break}case"]":{t.pop(),t[t.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&c(h,p);break}default:{t.pop();break}}break}case"INSIDE_LITERAL":{const v=e.substring(r,p+1);!"false".startsWith(v)&&!"true".startsWith(v)&&!"null".startsWith(v)?(t.pop(),t[t.length-1]==="INSIDE_OBJECT_AFTER_VALUE"?l(h,p):t[t.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&c(h,p)):s=p;break}}}let f=e.slice(0,s+1);for(let p=t.length-1;p>=0;p--)switch(t[p]){case"INSIDE_STRING":{f+='"';break}case"INSIDE_OBJECT_KEY":case"INSIDE_OBJECT_AFTER_KEY":case"INSIDE_OBJECT_AFTER_COMMA":case"INSIDE_OBJECT_START":case"INSIDE_OBJECT_BEFORE_VALUE":case"INSIDE_OBJECT_AFTER_VALUE":{f+="}";break}case"INSIDE_ARRAY_START":case"INSIDE_ARRAY_AFTER_COMMA":case"INSIDE_ARRAY_AFTER_VALUE":{f+="]";break}case"INSIDE_LITERAL":{const g=e.substring(r,e.length);"true".startsWith(g)?f+="true".slice(g.length):"false".startsWith(g)?f+="false".slice(g.length):"null".startsWith(g)&&(f+="null".slice(g.length))}}return f}async function Ql(e){if(e===void 0)return{value:void 0,state:"undefined-input"};let t=await Za({text:e});return t.success?{value:t.value,state:"successful-parse"}:(t=await Za({text:g$(e)}),t.success?{value:t.value,state:"repaired-parse"}:{value:void 0,state:"failed-parse"})}var y$=()=>({name:"text",responseFormat:Promise.resolve({type:"text"}),async parseCompleteOutput({text:e}){return e},async parsePartialOutput({text:e}){return{partial:e}},createElementStreamTransform(){}}),v$=({schema:e,name:t,description:s})=>{const r=gy(e);return{name:"object",responseFormat:Br(r.jsonSchema).then(i=>({type:"json",schema:i,...t!=null&&{name:t},...s!=null&&{description:s}})),async parseCompleteOutput({text:i},l){const c=await Za({text:i});if(!c.success)throw new Kr({message:"No object generated: could not parse the response.",cause:c.error,text:i,response:l.response,usage:l.usage,finishReason:l.finishReason});const f=await Bl({value:c.value,schema:r});if(!f.success)throw new Kr({message:"No object generated: response did not match schema.",cause:f.error,text:i,response:l.response,usage:l.usage,finishReason:l.finishReason});return f.value},async parsePartialOutput({text:i}){const l=await Ql(i);switch(l.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":return{partial:l.value}}},createElementStreamTransform(){}}},b$=({element:e,name:t,description:s})=>{const r=gy(e);return{name:"array",responseFormat:Br(r.jsonSchema).then(i=>{const{$schema:l,...c}=i;return{type:"json",schema:{$schema:"http://json-schema.org/draft-07/schema#",type:"object",properties:{elements:{type:"array",items:c}},required:["elements"],additionalProperties:!1},...t!=null&&{name:t},...s!=null&&{description:s}}}),async parseCompleteOutput({text:i},l){const c=await Za({text:i});if(!c.success)throw new Kr({message:"No object generated: could not parse the response.",cause:c.error,text:i,response:l.response,usage:l.usage,finishReason:l.finishReason});const f=c.value;if(f==null||typeof f!="object"||!("elements"in f)||!Array.isArray(f.elements))throw new Kr({message:"No object generated: response did not match schema.",cause:new no({value:f,cause:"response must be an object with an elements array"}),text:i,response:l.response,usage:l.usage,finishReason:l.finishReason});for(const p of f.elements){const h=await Bl({value:p,schema:r});if(!h.success)throw new Kr({message:"No object generated: response did not match schema.",cause:h.error,text:i,response:l.response,usage:l.usage,finishReason:l.finishReason})}return f.elements},async parsePartialOutput({text:i}){const l=await Ql(i);switch(l.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":{const c=l.value;if(c==null||typeof c!="object"||!("elements"in c)||!Array.isArray(c.elements))return;const f=l.state==="repaired-parse"&&c.elements.length>0?c.elements.slice(0,-1):c.elements,p=[];for(const h of f){const g=await Bl({value:h,schema:r});g.success&&p.push(g.value)}return{partial:p}}}},createElementStreamTransform(){let i=0;return new TransformStream({transform({partialOutput:l},c){if(l!=null)for(;i<l.length;i++)c.enqueue(l[i])}})}}},x$=({options:e,name:t,description:s})=>({name:"choice",responseFormat:Promise.resolve({type:"json",schema:{$schema:"http://json-schema.org/draft-07/schema#",type:"object",properties:{result:{type:"string",enum:e}},required:["result"],additionalProperties:!1},...t!=null&&{name:t},...s!=null&&{description:s}}),async parseCompleteOutput({text:r},i){const l=await Za({text:r});if(!l.success)throw new Kr({message:"No object generated: could not parse the response.",cause:l.error,text:r,response:i.response,usage:i.usage,finishReason:i.finishReason});const c=l.value;if(c==null||typeof c!="object"||!("result"in c)||typeof c.result!="string"||!e.includes(c.result))throw new Kr({message:"No object generated: response did not match schema.",cause:new no({value:c,cause:"response must be an object that contains a choice value."}),text:r,response:i.response,usage:i.usage,finishReason:i.finishReason});return c.result},async parsePartialOutput({text:r}){const i=await Ql(r);switch(i.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":{const l=i.value;if(l==null||typeof l!="object"||!("result"in l)||typeof l.result!="string")return;const c=e.filter(f=>f.startsWith(l.result));return i.state==="successful-parse"?c.includes(l.result)?{partial:l.result}:void 0:c.length===1?{partial:c[0]}:void 0}}},createElementStreamTransform(){}}),w$=({name:e,description:t}={})=>({name:"json",responseFormat:Promise.resolve({type:"json",...e!=null&&{name:e},...t!=null&&{description:t}}),async parseCompleteOutput({text:s},r){const i=await Za({text:s});if(!i.success)throw new Kr({message:"No object generated: could not parse the response.",cause:i.error,text:s,response:r.response,usage:r.usage,finishReason:r.finishReason});return i.value},async parsePartialOutput({text:s}){const r=await Ql(s);switch(r.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":return r.value===void 0?void 0:{partial:r.value}}},createElementStreamTransform(){}});Jl({prefix:"aitxt",size:24});(class extends TransformStream{constructor(){super({transform(e,t){t.enqueue(`data: ${JSON.stringify(e)}
91
-
92
- `)},flush(e){e.enqueue(`data: [DONE]
93
-
94
- `)}})}});var S$=GU(()=>mC(En([wt({type:Ie("text-start"),id:be(),providerMetadata:Ge.optional()}),wt({type:Ie("text-delta"),id:be(),delta:be(),providerMetadata:Ge.optional()}),wt({type:Ie("text-end"),id:be(),providerMetadata:Ge.optional()}),wt({type:Ie("error"),errorText:be()}),wt({type:Ie("tool-input-start"),toolCallId:be(),toolName:be(),providerExecuted:xn().optional(),providerMetadata:Ge.optional(),dynamic:xn().optional(),title:be().optional()}),wt({type:Ie("tool-input-delta"),toolCallId:be(),inputTextDelta:be()}),wt({type:Ie("tool-input-available"),toolCallId:be(),toolName:be(),input:Ds(),providerExecuted:xn().optional(),providerMetadata:Ge.optional(),dynamic:xn().optional(),title:be().optional()}),wt({type:Ie("tool-input-error"),toolCallId:be(),toolName:be(),input:Ds(),providerExecuted:xn().optional(),providerMetadata:Ge.optional(),dynamic:xn().optional(),errorText:be(),title:be().optional()}),wt({type:Ie("tool-approval-request"),approvalId:be(),toolCallId:be()}),wt({type:Ie("tool-output-available"),toolCallId:be(),output:Ds(),providerExecuted:xn().optional(),providerMetadata:Ge.optional(),dynamic:xn().optional(),preliminary:xn().optional()}),wt({type:Ie("tool-output-error"),toolCallId:be(),errorText:be(),providerExecuted:xn().optional(),providerMetadata:Ge.optional(),dynamic:xn().optional()}),wt({type:Ie("tool-output-denied"),toolCallId:be()}),wt({type:Ie("reasoning-start"),id:be(),providerMetadata:Ge.optional()}),wt({type:Ie("reasoning-delta"),id:be(),delta:be(),providerMetadata:Ge.optional()}),wt({type:Ie("reasoning-end"),id:be(),providerMetadata:Ge.optional()}),wt({type:Ie("source-url"),sourceId:be(),url:be(),title:be().optional(),providerMetadata:Ge.optional()}),wt({type:Ie("source-document"),sourceId:be(),mediaType:be(),title:be(),filename:be().optional(),providerMetadata:Ge.optional()}),wt({type:Ie("file"),url:be(),mediaType:be(),providerMetadata:Ge.optional()}),wt({type:uC(e=>typeof e=="string"&&e.startsWith("data-"),{message:'Type must start with "data-"'}),id:be().optional(),data:Ds(),transient:xn().optional()}),wt({type:Ie("start-step")}),wt({type:Ie("finish-step")}),wt({type:Ie("start"),messageId:be().optional(),messageMetadata:Ds().optional()}),wt({type:Ie("finish"),finishReason:oC(["stop","length","content-filter","tool-calls","error","other"]).optional(),messageMetadata:Ds().optional()}),wt({type:Ie("abort"),reason:be().optional()}),wt({type:Ie("message-metadata"),messageMetadata:Ds()})])));function E$(e){return e.type.startsWith("data-")}function Wm(e){return e.type.startsWith("tool-")}function CC(e){return e.type==="dynamic-tool"}function Ha(e){return Wm(e)||CC(e)}function Jm(e){return e.type.split("-").slice(1).join("-")}function RC(e){return CC(e)?e.toolName:Jm(e)}function N$({lastMessage:e,messageId:t}){return{message:e?.role==="assistant"?e:{id:t,metadata:void 0,role:"assistant",parts:[]},activeTextParts:{},activeReasoningParts:{},partialToolCalls:{}}}function T$({stream:e,messageMetadataSchema:t,dataPartSchemas:s,runUpdateMessageJob:r,onError:i,onToolCall:l,onData:c}){return e.pipeThrough(new TransformStream({async transform(f,p){await r(async({state:h,write:g})=>{var v,x,w,T;function N(S){const R=h.message.parts.filter(Ha).find(M=>M.toolCallId===S);if(R==null)throw new Di({chunkType:"tool-invocation",chunkId:S,message:`No tool invocation found for tool call ID "${S}".`});return R}function A(S){var _;const R=h.message.parts.find(I=>Wm(I)&&I.toolCallId===S.toolCallId),M=S,O=R;if(R!=null){R.state=S.state,O.input=M.input,O.output=M.output,O.errorText=M.errorText,O.rawInput=M.rawInput,O.preliminary=M.preliminary,S.title!==void 0&&(O.title=S.title),O.providerExecuted=(_=M.providerExecuted)!=null?_:R.providerExecuted;const I=M.providerMetadata;if(I!=null)if(S.state==="output-available"||S.state==="output-error"){const H=R;H.resultProviderMetadata=I}else R.callProviderMetadata=I}else h.message.parts.push({type:`tool-${S.toolName}`,toolCallId:S.toolCallId,state:S.state,title:S.title,input:M.input,output:M.output,rawInput:M.rawInput,errorText:M.errorText,providerExecuted:M.providerExecuted,preliminary:M.preliminary,...M.providerMetadata!=null&&(S.state==="output-available"||S.state==="output-error")?{resultProviderMetadata:M.providerMetadata}:{},...M.providerMetadata!=null&&!(S.state==="output-available"||S.state==="output-error")?{callProviderMetadata:M.providerMetadata}:{}})}function C(S){var _,R;const M=h.message.parts.find(H=>H.type==="dynamic-tool"&&H.toolCallId===S.toolCallId),O=S,I=M;if(M!=null){M.state=S.state,I.toolName=S.toolName,I.input=O.input,I.output=O.output,I.errorText=O.errorText,I.rawInput=(_=O.rawInput)!=null?_:I.rawInput,I.preliminary=O.preliminary,S.title!==void 0&&(I.title=S.title),I.providerExecuted=(R=O.providerExecuted)!=null?R:M.providerExecuted;const H=O.providerMetadata;if(H!=null)if(S.state==="output-available"||S.state==="output-error"){const F=M;F.resultProviderMetadata=H}else M.callProviderMetadata=H}else h.message.parts.push({type:"dynamic-tool",toolName:S.toolName,toolCallId:S.toolCallId,state:S.state,input:O.input,output:O.output,errorText:O.errorText,preliminary:O.preliminary,providerExecuted:O.providerExecuted,title:S.title,...O.providerMetadata!=null&&(S.state==="output-available"||S.state==="output-error")?{resultProviderMetadata:O.providerMetadata}:{},...O.providerMetadata!=null&&!(S.state==="output-available"||S.state==="output-error")?{callProviderMetadata:O.providerMetadata}:{}})}async function j(S){if(S!=null){const _=h.message.metadata!=null?jC(h.message.metadata,S):S;t!=null&&await gS({value:_,schema:t,context:{field:"message.metadata",entityId:h.message.id}}),h.message.metadata=_}}switch(f.type){case"text-start":{const S={type:"text",text:"",providerMetadata:f.providerMetadata,state:"streaming"};h.activeTextParts[f.id]=S,h.message.parts.push(S),g();break}case"text-delta":{const S=h.activeTextParts[f.id];if(S==null)throw new Di({chunkType:"text-delta",chunkId:f.id,message:`Received text-delta for missing text part with ID "${f.id}". Ensure a "text-start" chunk is sent before any "text-delta" chunks.`});S.text+=f.delta,S.providerMetadata=(v=f.providerMetadata)!=null?v:S.providerMetadata,g();break}case"text-end":{const S=h.activeTextParts[f.id];if(S==null)throw new Di({chunkType:"text-end",chunkId:f.id,message:`Received text-end for missing text part with ID "${f.id}". Ensure a "text-start" chunk is sent before any "text-end" chunks.`});S.state="done",S.providerMetadata=(x=f.providerMetadata)!=null?x:S.providerMetadata,delete h.activeTextParts[f.id],g();break}case"reasoning-start":{const S={type:"reasoning",text:"",providerMetadata:f.providerMetadata,state:"streaming"};h.activeReasoningParts[f.id]=S,h.message.parts.push(S),g();break}case"reasoning-delta":{const S=h.activeReasoningParts[f.id];if(S==null)throw new Di({chunkType:"reasoning-delta",chunkId:f.id,message:`Received reasoning-delta for missing reasoning part with ID "${f.id}". Ensure a "reasoning-start" chunk is sent before any "reasoning-delta" chunks.`});S.text+=f.delta,S.providerMetadata=(w=f.providerMetadata)!=null?w:S.providerMetadata,g();break}case"reasoning-end":{const S=h.activeReasoningParts[f.id];if(S==null)throw new Di({chunkType:"reasoning-end",chunkId:f.id,message:`Received reasoning-end for missing reasoning part with ID "${f.id}". Ensure a "reasoning-start" chunk is sent before any "reasoning-end" chunks.`});S.providerMetadata=(T=f.providerMetadata)!=null?T:S.providerMetadata,S.state="done",delete h.activeReasoningParts[f.id],g();break}case"file":{h.message.parts.push({type:"file",mediaType:f.mediaType,url:f.url,...f.providerMetadata!=null?{providerMetadata:f.providerMetadata}:{}}),g();break}case"source-url":{h.message.parts.push({type:"source-url",sourceId:f.sourceId,url:f.url,title:f.title,providerMetadata:f.providerMetadata}),g();break}case"source-document":{h.message.parts.push({type:"source-document",sourceId:f.sourceId,mediaType:f.mediaType,title:f.title,filename:f.filename,providerMetadata:f.providerMetadata}),g();break}case"tool-input-start":{const S=h.message.parts.filter(Wm);h.partialToolCalls[f.toolCallId]={text:"",toolName:f.toolName,index:S.length,dynamic:f.dynamic,title:f.title},f.dynamic?C({toolCallId:f.toolCallId,toolName:f.toolName,state:"input-streaming",input:void 0,providerExecuted:f.providerExecuted,title:f.title,providerMetadata:f.providerMetadata}):A({toolCallId:f.toolCallId,toolName:f.toolName,state:"input-streaming",input:void 0,providerExecuted:f.providerExecuted,title:f.title,providerMetadata:f.providerMetadata}),g();break}case"tool-input-delta":{const S=h.partialToolCalls[f.toolCallId];if(S==null)throw new Di({chunkType:"tool-input-delta",chunkId:f.toolCallId,message:`Received tool-input-delta for missing tool call with ID "${f.toolCallId}". Ensure a "tool-input-start" chunk is sent before any "tool-input-delta" chunks.`});S.text+=f.inputTextDelta;const{value:_}=await Ql(S.text);S.dynamic?C({toolCallId:f.toolCallId,toolName:S.toolName,state:"input-streaming",input:_,title:S.title}):A({toolCallId:f.toolCallId,toolName:S.toolName,state:"input-streaming",input:_,title:S.title}),g();break}case"tool-input-available":{f.dynamic?C({toolCallId:f.toolCallId,toolName:f.toolName,state:"input-available",input:f.input,providerExecuted:f.providerExecuted,providerMetadata:f.providerMetadata,title:f.title}):A({toolCallId:f.toolCallId,toolName:f.toolName,state:"input-available",input:f.input,providerExecuted:f.providerExecuted,providerMetadata:f.providerMetadata,title:f.title}),g(),l&&!f.providerExecuted&&await l({toolCall:f});break}case"tool-input-error":{const S=h.message.parts.filter(Ha).find(R=>R.toolCallId===f.toolCallId);(S!=null?S.type==="dynamic-tool":!!f.dynamic)?C({toolCallId:f.toolCallId,toolName:f.toolName,state:"output-error",input:f.input,errorText:f.errorText,providerExecuted:f.providerExecuted,providerMetadata:f.providerMetadata}):A({toolCallId:f.toolCallId,toolName:f.toolName,state:"output-error",input:void 0,rawInput:f.input,errorText:f.errorText,providerExecuted:f.providerExecuted,providerMetadata:f.providerMetadata}),g();break}case"tool-approval-request":{const S=N(f.toolCallId);S.state="approval-requested",S.approval={id:f.approvalId},g();break}case"tool-output-denied":{const S=N(f.toolCallId);S.state="output-denied",g();break}case"tool-output-available":{const S=N(f.toolCallId);S.type==="dynamic-tool"?C({toolCallId:f.toolCallId,toolName:S.toolName,state:"output-available",input:S.input,output:f.output,preliminary:f.preliminary,providerExecuted:f.providerExecuted,providerMetadata:f.providerMetadata,title:S.title}):A({toolCallId:f.toolCallId,toolName:Jm(S),state:"output-available",input:S.input,output:f.output,providerExecuted:f.providerExecuted,preliminary:f.preliminary,providerMetadata:f.providerMetadata,title:S.title}),g();break}case"tool-output-error":{const S=N(f.toolCallId);S.type==="dynamic-tool"?C({toolCallId:f.toolCallId,toolName:S.toolName,state:"output-error",input:S.input,errorText:f.errorText,providerExecuted:f.providerExecuted,providerMetadata:f.providerMetadata,title:S.title}):A({toolCallId:f.toolCallId,toolName:Jm(S),state:"output-error",input:S.input,rawInput:S.rawInput,errorText:f.errorText,providerExecuted:f.providerExecuted,providerMetadata:f.providerMetadata,title:S.title}),g();break}case"start-step":{h.message.parts.push({type:"step-start"});break}case"finish-step":{h.activeTextParts={},h.activeReasoningParts={};break}case"start":{f.messageId!=null&&(h.message.id=f.messageId),await j(f.messageMetadata),(f.messageId!=null||f.messageMetadata!=null)&&g();break}case"finish":{f.finishReason!=null&&(h.finishReason=f.finishReason),await j(f.messageMetadata),f.messageMetadata!=null&&g();break}case"message-metadata":{await j(f.messageMetadata),f.messageMetadata!=null&&g();break}case"error":{i?.(new Error(f.errorText));break}default:if(E$(f)){if(s?.[f.type]!=null){const R=h.message.parts.findIndex(O=>"id"in O&&"data"in O&&O.id===f.id&&O.type===f.type),M=R>=0?R:h.message.parts.length;await gS({value:f.data,schema:s[f.type],context:{field:`message.parts[${M}].data`,entityName:f.type,entityId:f.id}})}const S=f;if(S.transient){c?.(S);break}const _=S.id!=null?h.message.parts.find(R=>S.type===R.type&&S.id===R.id):void 0;_!=null?_.data=S.data:h.message.parts.push(S),c?.(S),g()}}p.enqueue(f)})}}))}async function j$({stream:e,onError:t}){const s=e.getReader();try{for(;;){const{done:r}=await s.read();if(r)break}}catch(r){t?.(r)}finally{s.releaseLock()}}Jl({prefix:"aitxt",size:24});Jl({prefix:"aiobj",size:24});var C$=class{constructor(){this.queue=[],this.isProcessing=!1}async processQueue(){if(!this.isProcessing){for(this.isProcessing=!0;this.queue.length>0;)await this.queue[0](),this.queue.shift();this.isProcessing=!1}}async run(e){return new Promise((t,s)=>{this.queue.push(async()=>{try{await e(),t()}catch(r){s(r)}}),this.processQueue()})}};Jl({prefix:"aiobj",size:24});async function R$(e){if(e==null)return[];if(!globalThis.FileList||!(e instanceof globalThis.FileList))throw new Error("FileList is not supported in the current environment");return Promise.all(Array.from(e).map(async t=>{const{name:s,type:r}=t,i=await new Promise((l,c)=>{const f=new FileReader;f.onload=p=>{var h;l((h=p.target)==null?void 0:h.result)},f.onerror=p=>c(p),f.readAsDataURL(t)});return{type:"file",mediaType:r,filename:s,url:i}}))}var A$=class{constructor({api:e="/api/chat",credentials:t,headers:s,body:r,fetch:i,prepareSendMessagesRequest:l,prepareReconnectToStreamRequest:c}){this.api=e,this.credentials=t,this.headers=s,this.body=r,this.fetch=i,this.prepareSendMessagesRequest=l,this.prepareReconnectToStreamRequest=c}async sendMessages({abortSignal:e,...t}){var s,r,i,l,c;const f=await Br(this.body),p=await Br(this.headers),h=await Br(this.credentials),g={...Oi(p),...Oi(t.headers)},v=await((s=this.prepareSendMessagesRequest)==null?void 0:s.call(this,{api:this.api,id:t.chatId,messages:t.messages,body:{...f,...t.body},headers:g,credentials:h,requestMetadata:t.metadata,trigger:t.trigger,messageId:t.messageId})),x=(r=v?.api)!=null?r:this.api,w=v?.headers!==void 0?Oi(v.headers):g,T=v?.body!==void 0?v.body:{...f,...t.body,id:t.chatId,messages:t.messages,trigger:t.trigger,messageId:t.messageId},N=(i=v?.credentials)!=null?i:h,C=await((l=this.fetch)!=null?l:globalThis.fetch)(x,{method:"POST",headers:{"Content-Type":"application/json",...w},body:JSON.stringify(T),credentials:N,signal:e});if(!C.ok)throw new Error((c=await C.text())!=null?c:"Failed to fetch the chat response.");if(!C.body)throw new Error("The response body is empty.");return this.processResponseStream(C.body)}async reconnectToStream(e){var t,s,r,i,l;const c=await Br(this.body),f=await Br(this.headers),p=await Br(this.credentials),h={...Oi(f),...Oi(e.headers)},g=await((t=this.prepareReconnectToStreamRequest)==null?void 0:t.call(this,{api:this.api,id:e.chatId,body:{...c,...e.body},headers:h,credentials:p,requestMetadata:e.metadata})),v=(s=g?.api)!=null?s:`${this.api}/${e.chatId}/stream`,x=g?.headers!==void 0?Oi(g.headers):h,w=(r=g?.credentials)!=null?r:p,N=await((i=this.fetch)!=null?i:globalThis.fetch)(v,{method:"GET",headers:x,credentials:w});if(N.status===204)return null;if(!N.ok)throw new Error((l=await N.text())!=null?l:"Failed to fetch the chat response.");if(!N.body)throw new Error("The response body is empty.");return this.processResponseStream(N.body)}},AC=class extends A${constructor(e={}){super(e)}processResponseStream(e){return e$({stream:e,schema:S$}).pipeThrough(new TransformStream({async transform(t,s){if(!t.success)throw t.error;s.enqueue(t.value)}}))}},_$=class{constructor({generateId:e=sU,id:t=e(),transport:s=new AC,messageMetadataSchema:r,dataPartSchemas:i,state:l,onError:c,onToolCall:f,onFinish:p,onData:h,sendAutomaticallyWhen:g}){this.activeResponse=void 0,this.jobExecutor=new C$,this.sendMessage=async(v,x)=>{var w,T,N,A;if(v==null){await this.makeRequest({trigger:"submit-message",messageId:(w=this.lastMessage)==null?void 0:w.id,...x});return}let C;if("text"in v||"files"in v?C={parts:[...Array.isArray(v.files)?v.files:await R$(v.files),..."text"in v&&v.text!=null?[{type:"text",text:v.text}]:[]]}:C=v,v.messageId!=null){const j=this.state.messages.findIndex(S=>S.id===v.messageId);if(j===-1)throw new Error(`message with id ${v.messageId} not found`);if(this.state.messages[j].role!=="user")throw new Error(`message with id ${v.messageId} is not a user message`);this.state.messages=this.state.messages.slice(0,j+1),this.state.replaceMessage(j,{...C,id:v.messageId,role:(T=C.role)!=null?T:"user",metadata:v.metadata})}else this.state.pushMessage({...C,id:(N=C.id)!=null?N:this.generateId(),role:(A=C.role)!=null?A:"user",metadata:v.metadata});await this.makeRequest({trigger:"submit-message",messageId:v.messageId,...x})},this.regenerate=async({messageId:v,...x}={})=>{const w=v==null?this.state.messages.length-1:this.state.messages.findIndex(T=>T.id===v);if(w===-1)throw new Error(`message ${v} not found`);this.state.messages=this.state.messages.slice(0,this.messages[w].role==="assistant"?w:w+1),await this.makeRequest({trigger:"regenerate-message",messageId:v,...x})},this.resumeStream=async(v={})=>{await this.makeRequest({trigger:"resume-stream",...v})},this.clearError=()=>{this.status==="error"&&(this.state.error=void 0,this.setStatus({status:"ready"}))},this.addToolApprovalResponse=async({id:v,approved:x,reason:w,options:T})=>this.jobExecutor.run(async()=>{const N=this.state.messages,A=N[N.length-1],C=j=>Ha(j)&&j.state==="approval-requested"&&j.approval.id===v?{...j,state:"approval-responded",approval:{id:v,approved:x,reason:w}}:j;this.state.replaceMessage(N.length-1,{...A,parts:A.parts.map(C)}),this.activeResponse&&(this.activeResponse.state.message.parts=this.activeResponse.state.message.parts.map(C)),this.status!=="streaming"&&this.status!=="submitted"&&this.sendAutomaticallyWhen&&this.shouldSendAutomatically().then(j=>{var S;j&&this.makeRequest({trigger:"submit-message",messageId:(S=this.lastMessage)==null?void 0:S.id,...T})})}),this.addToolOutput=async({state:v="output-available",toolCallId:x,output:w,errorText:T,options:N})=>this.jobExecutor.run(async()=>{const A=this.state.messages,C=A[A.length-1],j=S=>Ha(S)&&S.toolCallId===x?{...S,state:v,output:w,errorText:T}:S;this.state.replaceMessage(A.length-1,{...C,parts:C.parts.map(j)}),this.activeResponse&&(this.activeResponse.state.message.parts=this.activeResponse.state.message.parts.map(j)),this.status!=="streaming"&&this.status!=="submitted"&&this.sendAutomaticallyWhen&&this.shouldSendAutomatically().then(S=>{var _;S&&this.makeRequest({trigger:"submit-message",messageId:(_=this.lastMessage)==null?void 0:_.id,...N})})}),this.addToolResult=this.addToolOutput,this.stop=async()=>{var v;this.status!=="streaming"&&this.status!=="submitted"||(v=this.activeResponse)!=null&&v.abortController&&this.activeResponse.abortController.abort()},this.id=t,this.transport=s,this.generateId=e,this.messageMetadataSchema=r,this.dataPartSchemas=i,this.state=l,this.onError=c,this.onToolCall=f,this.onFinish=p,this.onData=h,this.sendAutomaticallyWhen=g}get status(){return this.state.status}setStatus({status:e,error:t}){this.status!==e&&(this.state.status=e,this.state.error=t)}get error(){return this.state.error}get messages(){return this.state.messages}get lastMessage(){return this.state.messages[this.state.messages.length-1]}set messages(e){this.state.messages=e}async shouldSendAutomatically(){if(!this.sendAutomaticallyWhen)return!1;const e=this.sendAutomaticallyWhen({messages:this.state.messages});return e&&typeof e=="object"&&"then"in e?await e:e}async makeRequest({trigger:e,metadata:t,headers:s,body:r,messageId:i}){var l,c,f;let p;if(e==="resume-stream")try{const w=await this.transport.reconnectToStream({chatId:this.id,metadata:t,headers:s,body:r});if(w==null)return;p=w}catch(w){this.onError&&w instanceof Error&&this.onError(w),this.setStatus({status:"error",error:w});return}this.setStatus({status:"submitted",error:void 0});const h=this.lastMessage;let g=!1,v=!1,x=!1;try{const w={state:N$({lastMessage:this.state.snapshot(h),messageId:this.generateId()}),abortController:new AbortController};w.abortController.signal.addEventListener("abort",()=>{g=!0}),this.activeResponse=w;let T;e==="resume-stream"?T=p:T=await this.transport.sendMessages({chatId:this.id,messages:this.state.messages,abortSignal:w.abortController.signal,metadata:t,headers:s,body:r,trigger:e,messageId:i});const N=A=>this.jobExecutor.run(()=>A({state:w.state,write:()=>{var C;this.setStatus({status:"streaming"}),w.state.message.id===((C=this.lastMessage)==null?void 0:C.id)?this.state.replaceMessage(this.state.messages.length-1,w.state.message):this.state.pushMessage(w.state.message)}}));await j$({stream:T$({stream:T,onToolCall:this.onToolCall,onData:this.onData,messageMetadataSchema:this.messageMetadataSchema,dataPartSchemas:this.dataPartSchemas,runUpdateMessageJob:N,onError:A=>{throw A}}),onError:A=>{throw A}}),this.setStatus({status:"ready"})}catch(w){if(g||w.name==="AbortError")return g=!0,this.setStatus({status:"ready"}),null;x=!0,w instanceof TypeError&&(w.message.toLowerCase().includes("fetch")||w.message.toLowerCase().includes("network"))&&(v=!0),this.onError&&w instanceof Error&&this.onError(w),this.setStatus({status:"error",error:w})}finally{try{(c=this.onFinish)==null||c.call(this,{message:this.activeResponse.state.message,messages:this.state.messages,isAbort:g,isDisconnect:v,isError:x,finishReason:(l=this.activeResponse)==null?void 0:l.state.finishReason})}catch(w){console.error(w)}this.activeResponse=void 0}!x&&await this.shouldSendAutomatically()&&await this.makeRequest({trigger:"submit-message",messageId:(f=this.lastMessage)==null?void 0:f.id,metadata:t,headers:s,body:r})}};function k$({chat:e,placeholder:t="Ask AI...",inputExtras:s,inputStatus:r,inputValue:i,onInputChange:l}){const{messages:c,sendMessage:f,stop:p,status:h,clearChat:g,error:v,attachments:x,activeAttachments:w,toggleAttachment:T}=e,[N,A]=b.useState(""),C=i!==void 0,j=C?i:N,S=F=>{C?l?.(F):A(F)},_=b.useRef(null),R=b.useRef(null),M=h==="streaming"||h==="submitted",O=x.length>0;b.useEffect(()=>{const F=_.current;F&&(F.scrollTop=F.scrollHeight)},[c]),b.useEffect(()=>{R.current?.focus()},[]);const I=F=>{F.preventDefault();const $=j.trim();!$||M||(S(""),f({text:$}))},H=F=>{F.stopPropagation(),F.key==="Enter"&&!F.shiftKey&&(F.preventDefault(),I(F))};return d.jsxs("div",{className:"flex flex-col h-full font-mono text-[12px]",children:[d.jsxs("div",{ref:_,className:"flex-1 overflow-y-auto frame-scrollbar p-3 space-y-3",children:[c.length===0&&d.jsx("div",{className:"text-neutral-500 text-center py-8 select-none",children:t}),c.map(F=>d.jsx("div",{className:`flex ${F.role==="user"?"justify-end":"justify-start"}`,children:d.jsx("div",{className:`max-w-[85%] rounded-lg px-3 py-2 whitespace-pre-wrap break-words leading-relaxed ${F.role==="user"?"bg-emerald-500/10 text-emerald-100 border border-emerald-500/20":"bg-neutral-800/50 text-neutral-200 border border-neutral-700/50"}`,children:(F.parts??[]).map(($,L)=>{if(!$)return null;if($.type==="text")return d.jsx("span",{children:$.text},L);if(Ha($)){const Y=RC($),ie=Object.entries($.input??{}).map(([ee,z])=>`${ee}: ${JSON.stringify(z)}`).join(", ");return d.jsxs("div",{className:"text-[11px] text-cyan-400/70 mt-1 font-mono",children:[d.jsx("span",{className:"text-neutral-500",children:"↳ "}),Y,"(",ie,")"]},L)}return null})})},F.id)),M&&c[c.length-1]?.role!=="assistant"&&d.jsx("div",{className:"flex justify-start",children:d.jsx("div",{className:"bg-neutral-800/50 border border-neutral-700/50 rounded-lg px-3 py-2 text-neutral-400",children:d.jsx("span",{className:"animate-pulse",children:"..."})})})]}),v&&d.jsxs("div",{className:"px-3 py-2 bg-red-900/20 border-t border-red-500/30 text-red-400 text-[11px] flex items-center gap-2",children:[d.jsx(M2,{size:12}),d.jsx("span",{className:"truncate",children:v.message||"An error occurred"})]}),d.jsxs("div",{className:"px-3 py-2.5 border-t border-neutral-700/50 bg-neutral-900/50",children:[O&&d.jsxs("div",{className:"flex items-center gap-1.5 mb-2",children:[d.jsx(n_,{size:11,className:"text-neutral-500 shrink-0"}),x.map(F=>{const $=w.has(F.label);return d.jsx("button",{type:"button",onClick:()=>T(F.label),className:`text-[10px] px-2 py-0.5 rounded-full border transition-colors ${$?"bg-cyan-500/15 text-cyan-300 border-cyan-500/40":"text-neutral-500 border-neutral-700 hover:text-neutral-300 hover:border-neutral-600"}`,children:F.label},F.label)}),w.size>0&&d.jsx("span",{className:"text-[10px] text-neutral-600 ml-1",children:"attached"})]}),d.jsxs("form",{onSubmit:I,className:"flex items-center gap-2 rounded-lg border border-neutral-700 bg-neutral-800/60 px-3 py-2 focus-within:border-emerald-500/40 transition-colors",children:[c.length>0&&d.jsx("button",{type:"button",onClick:()=>g(),className:"p-1 rounded text-neutral-500 hover:text-neutral-300 hover:bg-neutral-700 transition-colors",title:"Clear",children:d.jsx(u_,{size:12})}),d.jsx("input",{ref:R,type:"text",value:j,onChange:F=>S(F.target.value),onKeyDown:H,placeholder:t,className:"flex-1 bg-transparent outline-none text-neutral-100 placeholder:text-neutral-500 caret-emerald-400",disabled:M}),M?d.jsx("button",{type:"button",onClick:()=>p(),className:"p-1.5 rounded text-amber-400 hover:bg-amber-900/20 transition-colors",title:"Stop",children:d.jsx(JS,{size:12})}):d.jsx("button",{type:"submit",disabled:!j.trim(),className:"text-[11px] px-2 py-1 rounded bg-emerald-500/10 text-emerald-400 border border-emerald-500/30 hover:bg-emerald-500/20 disabled:opacity-30 disabled:cursor-default transition-colors",children:"Send"})]})]})]})}const M$="modulepreload",O$=function(e){return"/"+e},yS={},_l=function(t,s,r){let i=Promise.resolve();if(s&&s.length>0){let p=function(h){return Promise.all(h.map(g=>Promise.resolve(g).then(v=>({status:"fulfilled",value:v}),v=>({status:"rejected",reason:v}))))};document.getElementsByTagName("link");const c=document.querySelector("meta[property=csp-nonce]"),f=c?.nonce||c?.getAttribute("nonce");i=p(s.map(h=>{if(h=O$(h),h in yS)return;yS[h]=!0;const g=h.endsWith(".css"),v=g?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${h}"]${v}`))return;const x=document.createElement("link");if(x.rel=g?"stylesheet":M$,g||(x.as="script"),x.crossOrigin="",x.href=h,f&&x.setAttribute("nonce",f),document.head.appendChild(x),g)return new Promise((w,T)=>{x.addEventListener("load",w),x.addEventListener("error",()=>T(new Error(`Unable to preload CSS for ${h}`)))})}))}function l(c){const f=new Event("vite:preloadError",{cancelable:!0});if(f.payload=c,window.dispatchEvent(f),!f.defaultPrevented)throw c}return i.then(c=>{for(const f of c||[])f.status==="rejected"&&l(f.reason);return t().catch(l)})},D$={background:"#1a1a1a",foreground:"#abb2bf",cursor:"#528bff",cursorAccent:"#1a1a1a",selectionBackground:"#3e4451",selectionForeground:"#abb2bf",black:"#1a1a1a",red:"#e06c75",green:"#98c379",yellow:"#e5c07b",blue:"#61afef",magenta:"#c678dd",cyan:"#56b6c2",white:"#abb2bf",brightBlack:"#5c6370",brightRed:"#e06c75",brightGreen:"#98c379",brightYellow:"#e5c07b",brightBlue:"#61afef",brightMagenta:"#c678dd",brightCyan:"#56b6c2",brightWhite:"#ffffff"},z$=`
95
- .xterm { cursor: text; position: relative; user-select: none; -ms-user-select: none; -webkit-user-select: none; }
96
- .xterm.focus, .xterm:focus { outline: none; }
97
- .xterm .xterm-helpers { position: absolute; top: 0; z-index: 5; }
98
- .xterm .xterm-helper-textarea { padding: 0; border: 0; margin: 0; position: absolute; opacity: 0; left: -9999em; top: 0; width: 0; height: 0; z-index: -5; white-space: nowrap; overflow: hidden; resize: none; }
99
- .xterm .composition-view { background: #000; color: #FFF; display: none; position: absolute; white-space: nowrap; z-index: 1; }
100
- .xterm .composition-view.active { display: block; }
101
- .xterm .xterm-viewport { background-color: #000; overflow-y: scroll; cursor: default; position: absolute; right: 0; left: 0; top: 0; bottom: 0; }
102
- .xterm .xterm-screen { position: relative; }
103
- .xterm .xterm-screen canvas { position: absolute; left: 0; top: 0; }
104
- .xterm-char-measure-element { display: inline-block; visibility: hidden; position: absolute; top: 0; left: -9999em; line-height: normal; }
105
- .xterm.enable-mouse-events { cursor: default; }
106
- .xterm.xterm-cursor-pointer, .xterm .xterm-cursor-pointer { cursor: pointer; }
107
- .xterm.column-select.focus { cursor: crosshair; }
108
- .xterm .xterm-accessibility:not(.debug), .xterm .xterm-message { position: absolute; left: 0; top: 0; bottom: 0; right: 0; z-index: 10; color: transparent; pointer-events: none; }
109
- .xterm .xterm-accessibility-tree:not(.debug) *::selection { color: transparent; }
110
- .xterm .xterm-accessibility-tree { font-family: monospace; user-select: text; white-space: pre; }
111
- .xterm .xterm-accessibility-tree > div { transform-origin: left; width: fit-content; }
112
- .xterm .live-region { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
113
- .xterm-dim { opacity: 1 !important; }
114
- .xterm-underline-1 { text-decoration: underline; }
115
- .xterm-underline-2 { text-decoration: double underline; }
116
- .xterm-underline-3 { text-decoration: wavy underline; }
117
- .xterm-underline-4 { text-decoration: dotted underline; }
118
- .xterm-underline-5 { text-decoration: dashed underline; }
119
- .xterm-overline { text-decoration: overline; }
120
- .xterm-overline.xterm-underline-1 { text-decoration: overline underline; }
121
- .xterm-overline.xterm-underline-2 { text-decoration: overline double underline; }
122
- .xterm-overline.xterm-underline-3 { text-decoration: overline wavy underline; }
123
- .xterm-overline.xterm-underline-4 { text-decoration: overline dotted underline; }
124
- .xterm-overline.xterm-underline-5 { text-decoration: overline dashed underline; }
125
- .xterm-strikethrough { text-decoration: line-through; }
126
- .xterm-screen .xterm-decoration-container .xterm-decoration { z-index: 6; position: absolute; }
127
- .xterm-screen .xterm-decoration-container .xterm-decoration.xterm-decoration-top-layer { z-index: 7; }
128
- .xterm-decoration-overview-ruler { z-index: 8; position: absolute; top: 0; right: 0; pointer-events: none; }
129
- .xterm-decoration-top { z-index: 2; position: relative; }
130
- .xterm .xterm-scrollable-element > .scrollbar { cursor: default; }
131
- .xterm .xterm-scrollable-element > .scrollbar > .scra { cursor: pointer; font-size: 11px !important; }
132
- .xterm .xterm-scrollable-element > .visible { opacity: 1; background: rgba(0,0,0,0); transition: opacity 100ms linear; z-index: 11; }
133
- .xterm .xterm-scrollable-element > .invisible { opacity: 0; pointer-events: none; }
134
- .xterm .xterm-scrollable-element > .invisible.fade { transition: opacity 800ms linear; }
135
- .xterm .xterm-scrollable-element > .shadow { position: absolute; display: none; }
136
- .xterm .xterm-scrollable-element > .shadow.top { display: block; top: 0; left: 3px; height: 3px; width: 100%; }
137
- .xterm .xterm-scrollable-element > .shadow.left { display: block; top: 3px; left: 0; height: 100%; width: 3px; }
138
- `;function I$(){if(typeof document>"u"||document.querySelector("[data-xterm-css]"))return;const e=document.createElement("style");e.setAttribute("data-xterm-css",""),e.textContent=z$,document.head.appendChild(e)}function L$(e){return new Promise((t,s)=>{const r=new FileReader;r.onload=()=>{const i=r.result;t(i.split(",")[1])},r.onerror=s,r.readAsDataURL(e)})}function P$({relay:e,fontSize:t=12,fontFamily:s="'JetBrains Mono', 'Hack Nerd Font', monospace",configItems:r,onOpenSettings:i,onStartService:l}){const{status:c,error:f,exitCode:p,cwd:h,setCwd:g,sendInput:v,resize:x,onData:w,connect:T,disconnect:N}=e,[A,C]=b.useState(!1),{apiBaseUrl:j}=Wl(),S=b.useRef(null),_=b.useRef(null),R=b.useRef(null),M=b.useRef(null),[O,I]=b.useState(!1),[H,F]=b.useState(!1),$=b.useRef(0);b.useEffect(()=>{const U=S.current;if(!U)return;const W=se=>{se.key===" "&&!se.metaKey&&!se.ctrlKey&&!se.altKey&&se.stopPropagation()};return U.addEventListener("keydown",W),()=>U.removeEventListener("keydown",W)},[]);const L=`${j}/api/relay/upload`,Y=b.useCallback(async U=>{try{const W=await L$(U),se=await fetch(L,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:U.name,data:W})}),{path:te}=await se.json();return te||null}catch(W){return console.error("File upload failed:",W),null}},[L]);b.useEffect(()=>{const U=S.current;if(!U)return;const W=async se=>{if(!se.clipboardData)return;const te=Array.from(se.clipboardData.items).filter(me=>me.type.startsWith("image/"));if(te.length!==0){se.preventDefault(),se.stopPropagation();for(const me of te){const he=me.getAsFile();if(!he)continue;const pe=await Y(he);pe&&v(pe)}}};return U.addEventListener("paste",W),()=>U.removeEventListener("paste",W)},[v,Y]);const ie=b.useCallback(U=>{U.preventDefault(),U.dataTransfer.dropEffect="copy"},[]),ee=b.useCallback(U=>{U.preventDefault(),$.current++,U.dataTransfer.types.includes("Files")&&F(!0)},[]),z=b.useCallback(U=>{U.preventDefault(),$.current--,$.current===0&&F(!1)},[]),Z=b.useCallback(async U=>{U.preventDefault(),$.current=0,F(!1);const W=Array.from(U.dataTransfer.files).filter(se=>se.type.startsWith("image/"));if(W.length!==0)for(const se of W){const te=await Y(se);te&&v(te)}},[v,Y]);b.useEffect(()=>{let U=!1,W=null;async function se(){const[{Terminal:te},{FitAddon:me},he]=await Promise.all([_l(()=>import("./xterm-B-qIQCd3.js"),[]),_l(()=>import("./addon-fit-DX4qG4td.js"),[]),_l(()=>import("./addon-webgl-DCtw1yLn.js"),[]).catch(()=>null)]);if(I$(),U||!_.current)return;W=new te({fontSize:t,fontFamily:s,theme:D$,cursorBlink:!0,cursorStyle:"bar",allowTransparency:!0,scrollback:5e3,convertEol:!1,allowProposedApi:!0});const pe=new me;if(W.loadAddon(pe),W.open(_.current),he)try{const xe=new he.WebglAddon;xe.onContextLoss(()=>{xe.dispose()}),W.loadAddon(xe)}catch{}try{pe.fit()}catch{}R.current=W,M.current=pe,x(W.cols,W.rows),W.onData(xe=>{v(xe)}),I(!0)}return se(),()=>{U=!0,W&&(W.dispose(),R.current=null,M.current=null)}},[]),b.useEffect(()=>{const U=R.current;if(U){U.options.fontSize=t,U.options.fontFamily=s;try{M.current?.fit()}catch{}}},[t,s]),b.useEffect(()=>{if(O)return w(U=>{R.current?.write(U)}),()=>{w(()=>{})}},[O,w]),b.useEffect(()=>{const U=_.current;if(!U||!O)return;const W=new ResizeObserver(()=>{const se=M.current,te=R.current;if(!(!se||!te))try{se.fit(),x(te.cols,te.rows)}catch{}});return W.observe(U),()=>W.disconnect()},[O,x]),b.useEffect(()=>{c==="connected"&&R.current&&R.current.focus()},[c]);const B=b.useCallback(()=>{c==="connected"&&R.current&&R.current.focus()},[c]),re=c==="error"&&f==="Relay service is not running",J=b.useCallback(async()=>{if(l){C(!0);try{await l()&&setTimeout(()=>T(),500)}finally{C(!1)}}},[l,T]);let D=null;return re?D=d.jsxs("div",{className:"flex flex-col items-center gap-4 max-w-xs text-center px-4",children:[d.jsx("div",{className:"w-8 h-8 rounded-full bg-amber-500/10 border border-amber-500/20 flex items-center justify-center",children:d.jsx("span",{className:"text-amber-400 text-[14px]",children:"!"})}),d.jsxs("div",{children:[d.jsx("div",{className:"text-[12px] text-neutral-300 font-medium mb-1",children:"Relay service not running"}),d.jsx("div",{className:"text-[11px] text-neutral-500 leading-relaxed",children:l?"Start the relay service to open a terminal session.":"Start the relay service from the Workspace Manager."})]}),d.jsxs("div",{className:"flex items-center gap-2",children:[l&&d.jsx("button",{type:"button",onClick:J,disabled:A,className:"text-[11px] px-4 py-1.5 rounded-full border border-emerald-500/30 text-emerald-400 hover:bg-emerald-500/10 transition-colors font-medium disabled:opacity-50",children:A?"Starting...":"Start Service"}),d.jsx("button",{type:"button",onClick:()=>T(),className:"text-[11px] px-3 py-1.5 rounded-full border border-neutral-700 text-neutral-400 hover:text-neutral-300 hover:bg-white/5 transition-colors",children:"Retry"}),i&&d.jsx("button",{type:"button",onClick:i,className:"text-[11px] px-3 py-1.5 rounded-full border border-neutral-700 text-neutral-400 hover:text-neutral-300 hover:bg-white/5 transition-colors",children:"Settings"})]})]}):c==="error"&&f?D=d.jsxs("div",{className:"flex flex-col items-center gap-3 max-w-md text-center px-4",children:[d.jsx("div",{className:"w-8 h-8 rounded-full bg-red-500/10 flex items-center justify-center",children:d.jsx("span",{className:"text-red-400 text-sm",children:"!"})}),d.jsx("span",{className:"text-red-400 text-[12px] font-medium",children:"Session failed"}),d.jsx("code",{className:"text-[11px] text-neutral-400 bg-neutral-800/80 px-3 py-2 rounded-md whitespace-pre-wrap leading-relaxed max-h-32 overflow-y-auto w-full text-left",children:f}),p!==null&&p!==0&&d.jsxs("span",{className:"text-[10px] text-neutral-600",children:["Exit code ",p]}),d.jsx("button",{type:"button",onClick:()=>T(),className:"text-[11px] px-3 py-1 rounded-full border border-cyan-500/30 text-cyan-400 hover:bg-cyan-500/10 transition-colors",children:"Retry"})]}):c==="disconnected"?D=d.jsxs("div",{className:"flex flex-col items-center gap-4 max-w-xs text-center px-4",children:[d.jsx("div",{className:"w-8 h-8 rounded-full bg-neutral-800 border border-neutral-700 flex items-center justify-center",children:d.jsx("span",{className:"text-neutral-500 text-[14px]",children:"▷"})}),d.jsxs("div",{children:[d.jsx("div",{className:"text-[12px] text-neutral-300 font-medium mb-1",children:"Terminal relay disconnected"}),d.jsx("div",{className:"text-[11px] text-neutral-500 leading-relaxed",children:"Set working directory and connect."})]}),d.jsxs("form",{className:"w-full",onSubmit:U=>{U.preventDefault(),T()},children:[d.jsx("label",{className:"text-[10px] font-mono text-neutral-500 uppercase tracking-wider mb-1 block text-left",children:"Working Directory"}),d.jsx("input",{type:"text",value:h,onChange:U=>g(U.target.value),placeholder:"~/dev/my-project",className:"w-full bg-neutral-800/80 border border-neutral-700/50 rounded px-3 py-1.5 text-[11px] font-mono text-neutral-200 placeholder:text-neutral-600 outline-none focus:border-cyan-500/40 transition-colors",spellCheck:!1,autoComplete:"off"})]}),r&&r.length>0&&d.jsx("div",{className:"w-full grid grid-cols-[auto_1fr] gap-x-3 gap-y-1 text-[10px] font-mono bg-neutral-800/60 border border-neutral-700/40 rounded-md px-3 py-2",children:r.map(U=>d.jsxs("div",{className:"contents",children:[d.jsx("span",{className:"text-neutral-500",children:U.label}),d.jsx("span",{className:"text-neutral-400 truncate text-left",children:U.value})]},U.label))}),d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("button",{type:"button",onClick:()=>T(),className:"text-[11px] px-4 py-1.5 rounded-full border border-cyan-500/30 text-cyan-400 hover:bg-cyan-500/10 transition-colors font-medium",children:"Connect"}),i&&d.jsx("button",{type:"button",onClick:i,className:"text-[11px] px-3 py-1.5 rounded-full border border-neutral-700 text-neutral-400 hover:text-neutral-300 hover:bg-white/5 transition-colors",children:"Settings"})]})]}):c==="connecting"&&(D=d.jsxs("div",{className:"flex flex-col items-center gap-3 text-center",children:[d.jsx("div",{className:"w-6 h-6 border-2 border-neutral-600 border-t-cyan-400 rounded-full animate-spin"}),d.jsx("span",{className:"text-[12px] text-neutral-400",children:"Connecting to relay..."}),d.jsx("button",{type:"button",onClick:()=>{N()},className:"text-[10px] px-3 py-1 rounded-full border border-neutral-700 text-neutral-500 hover:text-neutral-300 hover:bg-white/5 transition-colors",children:"Cancel"})]})),d.jsxs("div",{ref:S,className:"relative flex flex-col h-full overflow-hidden",onClick:B,onDragOver:ie,onDragEnter:ee,onDragLeave:z,onDrop:Z,children:[D&&d.jsx("div",{className:"flex items-center justify-center h-full font-mono text-[12px] absolute inset-0 z-10 bg-neutral-900/90",children:D}),H&&d.jsx("div",{className:"absolute inset-0 z-20 flex items-center justify-center bg-cyan-500/10 border-2 border-dashed border-cyan-500/50 rounded pointer-events-none",children:d.jsx("span",{className:"text-cyan-400 font-mono text-sm",children:"Drop image to get path"})}),d.jsx("div",{ref:_,className:"flex-1 min-h-0 min-w-0 overflow-hidden",style:{visibility:D?"hidden":"visible",padding:"4px 8px"}})]})}function U$(e={}){const{url:t="ws://localhost:3600",systemPrompt:s,cwd:r,workspaceFiles:i,autoConnect:l=!1,sessionKey:c,orphanTTL:f,backend:p,tmuxSession:h,agent:g,provider:v,model:x}=e,w=c?`hudson.relay.${c}`:null,T=()=>{if(!w)return null;try{return localStorage.getItem(w)}catch{return null}},N=he=>{if(w)try{he?localStorage.setItem(w,he):localStorage.removeItem(w)}catch{}},[A,C]=b.useState("disconnected"),[j,S]=b.useState(null),[_,R]=b.useState(null),[M,O]=b.useState(null),[I,H]=b.useState(r||"~"),F=b.useRef(null),$=b.useRef(null),L=b.useRef({cols:80,rows:24}),Y=b.useRef(!1),ie=b.useRef(I);ie.current=I;const ee=b.useRef(T()),z=b.useRef(null),Z=b.useCallback(he=>{const pe=F.current;pe&&pe.readyState===WebSocket.OPEN&&pe.send(JSON.stringify(he))},[]),B=b.useCallback(()=>{$.current&&(clearTimeout($.current),$.current=null);const he=F.current;he&&(he.close(),F.current=null),Y.current=!1,C("disconnected")},[]),re=b.useCallback(()=>{const he=ie.current;return{type:"session:init",cols:L.current.cols,rows:L.current.rows,...s?{systemPrompt:s}:{},...he?{cwd:he}:{},...i?{workspaceFiles:i}:{},...f?{orphanTTL:f}:{},...p?{backend:p}:{},...h?{tmuxSession:h}:{},...g?{agent:g}:{},...v?{provider:v}:{},...x?{model:x}:{}}},[s,i,f,p,h,g,v,x]),J=b.useCallback(()=>{Y.current||(Y.current=!0,ee.current?Z({type:"session:reconnect",sessionId:ee.current,cols:L.current.cols,rows:L.current.rows}):Z(re()))},[Z,re]),D=b.useCallback(async()=>{F.current&&(F.current.close(),F.current=null),Y.current=!1,C("connecting"),R(null),O(null);const he=t.replace(/^ws(s?):\/\//,"http$1://");try{await fetch(`${he}/health`,{signal:AbortSignal.timeout(2e3)})}catch{C("error"),R("Relay service is not running");return}const pe=new WebSocket(t);F.current=pe,pe.onopen=()=>{J()},pe.onmessage=xe=>{try{const Re=JSON.parse(xe.data);switch(Re.type){case"session:ready":ee.current=Re.sessionId,N(Re.sessionId),S(Re.sessionId),C("connected"),R(null),O(null);break;case"session:expired":{ee.current=null,N(null),Y.current=!1,z.current&&z.current("\x1B[2J\x1B[H"),Z(re()),Y.current=!0;break}case"session:error":C("error"),R(Re.error||"Session failed to start");break;case"terminal:data":z.current&&Re.data&&z.current(Re.data);break;case"session:exit":ee.current=null,N(null),S(null),O(Re.exitCode??null),Re.exitCode!==0?(C("error"),R(Re.reason||`Process exited with code ${Re.exitCode}`)):C("disconnected");break;case"session:detached":ee.current=null,N(null),S(null);break}}catch{}},pe.onclose=()=>{F.current=null,Y.current=!1,C(xe=>xe==="error"?xe:"disconnected")},pe.onerror=()=>{C("error"),R("Could not connect to relay")}},[t,J,Z,s,i]),U=b.useCallback(he=>{Z({type:"terminal:input",data:he})},[Z]),W=b.useCallback(he=>{Z({type:"terminal:input",data:he+"\r"})},[Z]),se=b.useCallback((he,pe)=>{L.current={cols:he,rows:pe},Y.current&&Z({type:"terminal:resize",cols:he,rows:pe})},[Z]),te=b.useCallback(he=>{z.current=he},[]);b.useEffect(()=>(l&&D(),()=>{B()}),[]);const me=b.useCallback(()=>{if(B(),ee.current=null,S(null),c)try{sessionStorage.removeItem(`hudson.relay.${c}`)}catch{}R(null),O(null),setTimeout(()=>D(),200)},[B,D,c]);return{status:A,sessionId:j,error:_,exitCode:M,cwd:I,setCwd:H,onData:te,sendInput:U,sendLine:W,resize:se,connect:D,disconnect:B,restart:me}}var Kp,vS;function $$(){if(vS)return Kp;vS=1;function e(t,s){if(typeof t!="function")throw new TypeError(`Expected the first argument to be a \`function\`, got \`${typeof t}\`.`);let r,i=0;return function(...c){clearTimeout(r);const f=Date.now(),p=f-i,h=s-p;h<=0?(i=f,t.apply(this,c)):r=setTimeout(()=>{i=Date.now(),t.apply(this,c)},h)}}return Kp=e,Kp}var V$=$$();const B$=FS(V$);var _C=(e,t,s)=>{if(!t.has(e))throw TypeError("Cannot "+s)},St=(e,t,s)=>(_C(e,t,"read from private field"),s?s.call(e):t.get(e)),Ms=(e,t,s)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,s)},Vr=(e,t,s,r)=>(_C(e,t,"write to private field"),t.set(e,s),s);function Z$(e,t){return t!=null?B$(e,t):e}var os,ed,td,vl,bl,xl,Li,Qm,eg,H$=class{constructor(e=[]){Ms(this,os,void 0),Ms(this,ed,"ready"),Ms(this,td,void 0),Ms(this,vl,new Set),Ms(this,bl,new Set),Ms(this,xl,new Set),this.pushMessage=t=>{Vr(this,os,St(this,os).concat(t)),St(this,Li).call(this)},this.popMessage=()=>{Vr(this,os,St(this,os).slice(0,-1)),St(this,Li).call(this)},this.replaceMessage=(t,s)=>{Vr(this,os,[...St(this,os).slice(0,t),this.snapshot(s),...St(this,os).slice(t+1)]),St(this,Li).call(this)},this.snapshot=t=>structuredClone(t),this["~registerMessagesCallback"]=(t,s)=>{const r=s?Z$(t,s):t;return St(this,vl).add(r),()=>{St(this,vl).delete(r)}},this["~registerStatusCallback"]=t=>(St(this,bl).add(t),()=>{St(this,bl).delete(t)}),this["~registerErrorCallback"]=t=>(St(this,xl).add(t),()=>{St(this,xl).delete(t)}),Ms(this,Li,()=>{St(this,vl).forEach(t=>t())}),Ms(this,Qm,()=>{St(this,bl).forEach(t=>t())}),Ms(this,eg,()=>{St(this,xl).forEach(t=>t())}),Vr(this,os,e)}get status(){return St(this,ed)}set status(e){Vr(this,ed,e),St(this,Qm).call(this)}get error(){return St(this,td)}set error(e){Vr(this,td,e),St(this,eg).call(this)}get messages(){return St(this,os)}set messages(e){Vr(this,os,[...e]),St(this,Li).call(this)}};os=new WeakMap;ed=new WeakMap;td=new WeakMap;vl=new WeakMap;bl=new WeakMap;xl=new WeakMap;Li=new WeakMap;Qm=new WeakMap;eg=new WeakMap;var Pi,bS=class extends _${constructor({messages:e,...t}){const s=new H$(e);super({...t,state:s}),Ms(this,Pi,void 0),this["~registerMessagesCallback"]=(r,i)=>St(this,Pi)["~registerMessagesCallback"](r,i),this["~registerStatusCallback"]=r=>St(this,Pi)["~registerStatusCallback"](r),this["~registerErrorCallback"]=r=>St(this,Pi)["~registerErrorCallback"](r),Vr(this,Pi,s)}};Pi=new WeakMap;function F$({experimental_throttle:e,resume:t=!1,...s}={}){const r=b.useRef("chat"in s?{}:{onToolCall:s.onToolCall,onData:s.onData,onFinish:s.onFinish,onError:s.onError,sendAutomaticallyWhen:s.sendAutomaticallyWhen});"chat"in s||(r.current={onToolCall:s.onToolCall,onData:s.onData,onFinish:s.onFinish,onError:s.onError,sendAutomaticallyWhen:s.sendAutomaticallyWhen});const i={...s,onToolCall:x=>{var w,T;return(T=(w=r.current).onToolCall)==null?void 0:T.call(w,x)},onData:x=>{var w,T;return(T=(w=r.current).onData)==null?void 0:T.call(w,x)},onFinish:x=>{var w,T;return(T=(w=r.current).onFinish)==null?void 0:T.call(w,x)},onError:x=>{var w,T;return(T=(w=r.current).onError)==null?void 0:T.call(w,x)},sendAutomaticallyWhen:x=>{var w,T,N;return(N=(T=(w=r.current).sendAutomaticallyWhen)==null?void 0:T.call(w,x))!=null?N:!1}},l=b.useRef("chat"in s?s.chat:new bS(i));("chat"in s&&s.chat!==l.current||"id"in s&&l.current.id!==s.id)&&(l.current="chat"in s?s.chat:new bS(i));const f=b.useCallback(x=>l.current["~registerMessagesCallback"](x,e),[e,l.current.id]),p=b.useSyncExternalStore(f,()=>l.current.messages,()=>l.current.messages),h=b.useSyncExternalStore(l.current["~registerStatusCallback"],()=>l.current.status,()=>l.current.status),g=b.useSyncExternalStore(l.current["~registerErrorCallback"],()=>l.current.error,()=>l.current.error),v=b.useCallback(x=>{typeof x=="function"&&(x=x(l.current.messages)),l.current.messages=x},[l]);return b.useEffect(()=>{t&&l.current.resumeStream()},[t,l]),{id:l.current.id,messages:p,setMessages:v,sendMessage:l.current.sendMessage,regenerate:l.current.regenerate,clearError:l.current.clearError,stop:l.current.stop,error:g,resumeStream:l.current.resumeStream,status:h,addToolResult:l.current.addToolOutput,addToolOutput:l.current.addToolOutput,addToolApprovalResponse:l.current.addToolApprovalResponse}}function q$(e){try{const t=localStorage.getItem(e);if(t)return JSON.parse(t)}catch{}}function Y$(e,t){try{localStorage.setItem(e,JSON.stringify(t)),window.dispatchEvent(new CustomEvent("hudson:saved",{detail:{key:e}}))}catch{}}const G$=()=>()=>{},X$=()=>!0,K$=()=>!1;function W$(){return b.useSyncExternalStore(G$,X$,K$)}function ur(e,t){const s=W$(),[r,i]=b.useState(t),l=b.useRef(!1);if(s&&!l.current){l.current=!0;const c=q$(e);c!==void 0&&i(c)}return b.useEffect(()=>{s&&Y$(e,r)},[e,r,s]),[r,i]}function J$(e){const t={};for(const s of e.attachmentsRef.current??[])if(e.activeAttachmentsRef.current.has(s.label)){const r=s.content();r!==null&&(t[s.label.toLowerCase()]=r)}return{toolset:e.toolsetRef.current,context:{...e.contextRef.current,...t},mode:e.modeRef.current,sessionId:e.sessionIdRef.current,provider:e.providerRef.current,model:e.modelRef.current}}function Q$(e,t){e.current?.(t)}function eV(e,t){e.current?.(t)}function tV(e){const t=new Set;for(const s of e??[])if(s.role==="assistant")for(const r of s.parts??[])r&&Ha(r)&&t.add(r.toolCallId);return t}function nV({toolset:e,chatId:t,initialMessages:s,context:r,onToolCall:i,mode:l,attachments:c,provider:f,model:p,sessionId:h,onSessionIdChange:g,onFinish:v,onError:x}){const w=b.useRef(i),T=b.useRef(v),N=b.useRef(x),A=b.useRef(h??crypto.randomUUID()),[C,j]=b.useState(new Set),S=b.useCallback(B=>{j(re=>{const J=new Set(re);return J.has(B)?J.delete(B):J.add(B),J})},[]),[_]=ur("hudson.settings",{}),R=l??_.aiMode??"api",M=b.useRef(C),O=b.useRef(c),I=b.useRef(r),H=b.useRef(e),F=b.useRef(R),$=b.useRef(f),L=b.useRef(p);b.useEffect(()=>{w.current=i},[i]),b.useEffect(()=>{T.current=v},[v]),b.useEffect(()=>{N.current=x},[x]),b.useEffect(()=>{h&&h!==A.current&&(A.current=h)},[h]),b.useEffect(()=>{g?.(A.current)},[g]),b.useEffect(()=>{M.current=C},[C]),b.useEffect(()=>{O.current=c},[c]),b.useEffect(()=>{I.current=r},[r]),b.useEffect(()=>{H.current=e},[e]),b.useEffect(()=>{F.current=R},[R]),b.useEffect(()=>{$.current=f},[f]),b.useEffect(()=>{L.current=p},[p]);const Y=b.useMemo(()=>new AC({api:"/api/ai/chat",body:()=>J$({activeAttachmentsRef:M,attachmentsRef:O,contextRef:I,toolsetRef:H,modeRef:F,sessionIdRef:A,providerRef:$,modelRef:L})}),[]),ie=F$({id:t,messages:s,transport:Y,onFinish:B=>Q$(T,B),onError:B=>eV(N,B)}),ee=b.useRef(tV(s)),z=b.useCallback(()=>{const B=crypto.randomUUID();A.current=B,g?.(B),ee.current.clear(),ie.setMessages([])},[ie,g]),{messages:Z}=ie;return b.useEffect(()=>{if(w.current){for(const B of Z)if(B.role==="assistant"){for(const re of B.parts??[])if(re&&Ha(re)){if("state"in re&&re.state==="input-streaming")continue;const J=re.toolCallId;if(!ee.current.has(J)){ee.current.add(J);const D=RC(re);w.current?.(D,re.input??{})}}}}},[Z]),{messages:Z,sendMessage:ie.sendMessage,stop:ie.stop,status:ie.status,setMessages:ie.setMessages,clearChat:z,error:ie.error,mode:R,attachments:c??[],activeAttachments:C,toggleAttachment:S}}function sV({app:e,commands:t,state:s,provider:r,model:i,onFinish:l}){const c=b.useMemo(()=>(e.intents??[]).map(h=>({commandId:h.commandId,title:h.title,description:h.description,category:h.category,keywords:h.keywords,shortcut:h.shortcut,dangerous:h.dangerous,params:h.params?.map(g=>({name:g.name,description:g.description,type:g.type,optional:g.optional,enum:g.enum}))})),[e.intents]),f=b.useMemo(()=>({appId:e.id,appName:e.name,appDescription:e.description,intents:c,state:s}),[e.id,e.name,e.description,c,s]),p=b.useCallback(h=>{const g=t.find(v=>v.id===h);if(!g){console.warn(`[useAssistant] no command for id "${h}"`);return}g.action()},[t]);return nV({toolset:"intents",context:f,provider:r,model:i,onFinish:l,onToolCall:(h,g)=>{if(h!=="dispatch")return;const v=g.commandId;typeof v=="string"&&p(v)}})}const rV="audio/ogg;codecs=opus";function aV(){return typeof MediaRecorder>"u"?void 0:["audio/ogg;codecs=opus","audio/mp4;codecs=mp4a.40.2","audio/mp4","audio/webm;codecs=opus"].find(t=>MediaRecorder.isTypeSupported(t))}function Wp(e){e?.getTracks().forEach(t=>t.stop())}function iV(e){return e.includes("wav")?"wav":e.includes("aac")||e.includes("mp4")?"aac":"opus"}function xS(e,t){return t||e.find(r=>r.type)?.type||rV}function wS(e){const t=typeof window<"u"?window.location.origin:"this origin";if(e&&typeof e=="object"&&"code"in e&&"message"in e){const s=e;if(s.code==="network_error")return{status:"unavailable",message:"Vox Companion is not reachable on 127.0.0.1:43115. Install Vox.app, or launch it if it is already installed."};if(s.code==="http_error"){const r=s.message??"";return r.includes("Origin not allowed")||r.includes("403")?{status:"error",message:`Vox rejected this origin. Allowlist ${t} in Vox settings and try again.`}:{status:"error",message:"Vox returned an error while transcribing. Check Vox and try again."}}}if(e instanceof DOMException){if(e.name==="NotAllowedError")return{status:"error",message:"Microphone access was denied."};if(e.name==="NotFoundError")return{status:"error",message:"No microphone is available."}}return e instanceof Error?{status:"error",message:e.message}:{status:"error",message:"Voice capture failed."}}async function oV(){const t=(await _l(()=>import("./index-TVkH_WDG.js"),[])).createVoxdClient();return{probe:()=>t.probe(),transcribe:({audio:s,format:r,language:i,metadata:l})=>t.transcribe({audio:s,format:r,language:i,metadata:l})}}function lV(e){const{onTranscript:t,surface:s="hudson-assistant",metadata:r,language:i="en",transcribe:l,probe:c}=e,[f,p]=b.useState("idle"),[h,g]=b.useState(null),[v,x]=b.useState(null),w=b.useRef(null),T=b.useRef(null),N=b.useRef([]),A=b.useRef(t);A.current=t;const C=b.useRef(r);C.current=r;const j=b.useRef(null),S=b.useMemo(()=>typeof MediaRecorder<"u"&&typeof navigator<"u"&&!!navigator.mediaDevices?.getUserMedia,[]),_=b.useCallback(async()=>l?{probe:c??(async()=>!0),transcribe:l}:(j.current||(j.current=await oV()),j.current),[l,c]),R=b.useCallback(async(I,H)=>{if(Wp(T.current),T.current=null,w.current=null,I.length===0){p("error"),g("No audio was captured.");return}p("transcribing"),g(null);try{const F=await _(),$=xS(I,H),Y=(await F.transcribe({audio:new Blob(I,{type:$}),format:iV($),language:i,metadata:{surface:s,...C.current}})).text.trim();if(!Y)throw new Error("Transcription returned empty text.");x(Y),p("ready"),A.current(Y)}catch(F){const $=wS(F);p($.status),g($.message)}},[_,i,s]),M=b.useCallback(async()=>{if(!(f==="recording"||f==="transcribing")){if(!S){p("error"),g("This browser cannot capture microphone audio.");return}g(null),x(null);try{if(!await(await _()).probe()){p("unavailable"),g("Vox Companion is not reachable on 127.0.0.1:43115. Install Vox.app, or launch it if it is already installed.");return}const F=await navigator.mediaDevices.getUserMedia({audio:!0}),$=aV(),L=$?new MediaRecorder(F,{mimeType:$}):new MediaRecorder(F);N.current=[],T.current=F,w.current=L,L.ondataavailable=Y=>{Y.data.size>0&&N.current.push(Y.data)},L.onerror=()=>{Wp(T.current),T.current=null,w.current=null,N.current=[],p("error"),g("Voice capture failed while recording.")},L.onstop=()=>{const Y=[...N.current];N.current=[],R(Y,xS(Y,L.mimeType||$||""))},L.start(),p("recording")}catch(I){const H=wS(I);p(H.status),g(H.message)}}},[R,_,S,f]),O=b.useCallback(()=>{const I=w.current;!I||I.state!=="recording"||(p("transcribing"),I.stop())},[]);return b.useEffect(()=>()=>{const I=w.current;if(I&&I.state==="recording")try{I.stop()}catch{}Wp(T.current),T.current=null,w.current=null,N.current=[]},[]),{status:f,error:h,lastTranscript:v,start:M,stop:O,isSupported:S}}function cV(){return typeof document>"u"?"wav":document.createElement("audio").canPlayType('audio/mp4; codecs="mp4a.40.2"')?"aac":"wav"}function uV(){const{apiBaseUrl:e}=Wl(),[t,s]=b.useState("idle"),[r,i]=b.useState(null),l=b.useRef(null),c=b.useRef(null),f=b.useRef(0),p=b.useCallback(()=>{f.current+=1;const g=l.current;g&&(g.onended=null,g.onerror=null,g.pause(),l.current=null),c.current&&(URL.revokeObjectURL(c.current),c.current=null),s(v=>v==="speaking"||v==="synthesizing"?"idle":v)},[]),h=b.useCallback(async(g,v={})=>{if(!g||!g.trim())return;const x=f.current+1;f.current=x,s("synthesizing"),i(null);try{const w=await fetch(`${e}/v1/audio/speech`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({text:g,provider:v.provider,model:v.model,voice:v.voice||void 0,rate:v.rate,format:cV(),metadata:v.metadata})}),T=await w.json();if(!w.ok)throw new Error(T.error||`Speech synthesis failed (${w.status}).`);const N=T.audio?.base64??T.audioBase64,A=T.audio?.mimeType??T.mimeType??"audio/wav";if(!N)throw new Error("Speech synthesis returned no audio.");if(f.current!==x)return;l.current&&(l.current.pause(),l.current=null),c.current&&(URL.revokeObjectURL(c.current),c.current=null);const C=Uint8Array.from(atob(N),R=>R.charCodeAt(0)),j=new Blob([C],{type:A}),S=URL.createObjectURL(j),_=new Audio(S);l.current=_,c.current=S,s("speaking"),_.onended=()=>{l.current===_&&(l.current=null),c.current===S&&(URL.revokeObjectURL(S),c.current=null),s(R=>R==="speaking"?"idle":R)},_.onerror=()=>{l.current===_&&(l.current=null),c.current===S&&(URL.revokeObjectURL(S),c.current=null),s("error"),i("Reply audio could not be played in this browser.")},await _.play()}catch(w){if(f.current!==x)return;p(),s("error"),i(w instanceof Error?w.message:"Reply speech failed.")}},[e,p]);return b.useEffect(()=>()=>{const g=l.current;g&&(g.onended=null,g.onerror=null,g.pause()),c.current&&URL.revokeObjectURL(c.current),l.current=null,c.current=null},[]),{status:t,error:r,speak:h,stop:p,isPlaying:t==="synthesizing"||t==="speaking"}}const dV=3,fV=6,hV=4,pV=320,mV=760,gV=480,yV={balanced:{spokenReplyStyle:"adaptive",spokenReplyLongResponse:"invite",spokenReplyCodeResponse:"summary",spokenReplyMaxChars:720}},hl=yV.balanced;function Wr(e){return e.replace(/\s+/g," ").trim()}function kC(e){return e.replace(/<think>[\s\S]*?<\/think>/g," ")}function SS(e){return Wr(e.replace(/```[\s\S]*?```/g," ").replace(/`([^`]+)`/g,"$1").replace(/!\[([^\]]*)\]\([^)]+\)/g,"$1").replace(/\[([^\]]+)\]\([^)]+\)/g,"$1").replace(/^#{1,6}\s+/gm,"").replace(/^\s*>\s?/gm,"").replace(/^\s*[-*+]\s+/gm,"").replace(/^\s*\d+\.\s+/gm,"").replace(/\*\*([^*]+)\*\*/g,"$1").replace(/\*([^*]+)\*/g,"$1").replace(/_([^_]+)_/g,"$1").replace(/~~([^~]+)~~/g,"$1").replace(/\|/g," ").replace(/\n{2,}/g,`
139
- `).replace(/\n/g," "))}function vV(e){return Wr(e).split(new RegExp("(?<=[.!?])\\s+")).map(t=>t.trim()).filter(Boolean)}function Jp(e,t){if(e.length<=t)return e;const s=e.slice(0,t).trim(),r=s.lastIndexOf(" ");return(r>Math.floor(t*.6)?s.slice(0,r):s).replace(/[,:; -]+$/,"").trim()}function Du(e){return e&&(/[.!?]$/.test(e)?e:`${e}.`)}function MC(e,t,s){const r=vV(e);if(r.length===0)return Du(Jp(Wr(e),s));const i=[];for(const c of r){const f=Wr([...i,c].join(" "));if(i.length>0&&f.length>s||(i.push(c),i.length>=t))break}if(i.length===0)return Du(Jp(r[0]??e,s));const l=Wr(i.join(" "));return l.length<=s?Du(l):Du(Jp(l,s))}function bV(e){return typeof e=="string"?{...hl,spokenReplyStyle:e}:{spokenReplyStyle:e.spokenReplyStyle??hl.spokenReplyStyle,spokenReplyLongResponse:e.spokenReplyLongResponse??hl.spokenReplyLongResponse,spokenReplyCodeResponse:e.spokenReplyCodeResponse??hl.spokenReplyCodeResponse,spokenReplyMaxChars:e.spokenReplyMaxChars??hl.spokenReplyMaxChars}}function xV(e){switch(e){case"full":return{maxSentences:fV,maxChars:mV};case"adaptive":return{maxSentences:hV,maxChars:gV};default:return{maxSentences:dV,maxChars:pV}}}function wV(e){const t=kC(e),s=[...t.matchAll(/```[\s\S]*?```/g)],r=[...t.matchAll(/`[^`]+`/g)],i=t.replace(/```[\s\S]*?```/g," ").replace(/`([^`]+)`/g," $1 "),l=SS(t),c=SS(i),f=s.reduce((h,g)=>h+g[0].length,0)+r.reduce((h,g)=>h+g[0].length,0),p=s.length>0||r.length>=2||f>120&&f>l.length*.18||/(const|let|function|class|interface|return|import|export)\s+/.test(t)&&/[{}();]/.test(t);return{cleaned:l,proseOnly:c,codeHeavy:p}}function yy(e,t){const{maxSentences:s,maxChars:r}=xV(t);return MC(e,s,r)}function tg(e){return MC(e,3,260)}function SV(e,t){switch(t.spokenReplyLongResponse){case"summary":return tg(e.cleaned);case"invite":{const s=tg(e.cleaned);return Wr(`${s} The full details are in the written reply. We can talk through any part you want.`)}default:return yy(e.cleaned,t.spokenReplyStyle)}}function EV(e,t){switch(t.spokenReplyCodeResponse){case"read":return yy(e.cleaned,t.spokenReplyStyle);case"mention":return"I included code in the written reply. I can walk through the implementation if you want.";default:{const s=e.proseOnly||e.cleaned,r=s?tg(s):"";return r?Wr(`${r} I also included code in the written reply. I can walk through the implementation if you want.`):"I included code in the written reply. I can walk through the implementation or focus on one piece if you want."}}}function NV(e){const t=(e.parts??[]).filter(s=>s.type==="text").map(s=>"text"in s?s.text??"":"").join("");return Wr(kC(t))}function TV(e,t){const s=bV(t),r=wV(e);return r.cleaned?r.codeHeavy&&s.spokenReplyCodeResponse!=="read"?EV(r,s):r.cleaned.length>s.spokenReplyMaxChars&&s.spokenReplyLongResponse!=="verbatim"?SV(r,s):yy(r.cleaned,s.spokenReplyStyle):""}const jV={autoSend:!0,speakReplies:!1,replyProvider:"system",replyModel:"system",replyVoice:"",replyRate:1,spokenReplyStyle:"adaptive",spokenReplyLongResponse:"invite",spokenReplyCodeResponse:"summary",spokenReplyMaxChars:720};function CV({app:e,commands:t,state:s,relayUrl:r="ws://localhost:3600",cwd:i,agent:l="pi",provider:c,model:f,backend:p="pty",tmuxSession:h,workspaceFiles:g,onOpenSettings:v,onStartService:x,voice:w,voiceEnabled:T=!0}){const[N,A]=ur(`assistant.${e.id}.mode`,"relay"),[C,j]=b.useState(""),S=b.useMemo(()=>({...jV,...w}),[w]),[_,R]=ur(`assistant.${e.id}.voice.speakReplies`,S.speakReplies),{serviceApiUrl:M}=Wl(),O=b.useMemo(()=>AV(e),[e]),I=U$({url:r,systemPrompt:O,cwd:i,workspaceFiles:g,sessionKey:`assistant-${e.id}`,backend:p,tmuxSession:h,agent:l,provider:l==="pi"?c:void 0,model:l==="pi"?f:void 0}),H=b.useCallback(async()=>{if(x)return x();try{return(await(await fetch(`${M}/api/services/execute`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({serviceId:"relay",action:"start",triggeredBy:"assistant"})})).json()).success===!0}catch{return!1}},[x,M]),F=b.useMemo(()=>{const D=[{label:"Relay",value:r},{label:"Agent",value:l}];return i&&D.push({label:"CWD",value:i}),l==="pi"&&f&&D.push({label:"Model",value:f}),D},[r,l,i,f]),$=uV(),[L,Y]=b.useState("text"),ie=sV({app:e,commands:t,state:s,provider:c,model:f,onFinish:({message:D,isAbort:U,isDisconnect:W,isError:se})=>{if(!T||!_||U||W||se||D.role!=="assistant")return;const te=NV(D),me=TV(te,S);me&&$.speak(me,{provider:S.replyProvider,model:S.replyModel,voice:S.replyVoice||void 0,rate:S.replyRate,metadata:{surface:"hudson-assistant",appId:e.id,source:L}})}}),ee=lV({surface:"hudson-assistant",metadata:{appId:e.id},onTranscript:D=>{const U=[C.trim(),D].filter(Boolean).join(" ");S.autoSend&&ie.status!=="streaming"&&ie.status!=="submitted"?(j(""),Y("voice"),ie.sendMessage({text:U})):j(U)}}),z=b.useCallback(()=>{ee.status==="recording"?ee.stop():ee.start()},[ee]),Z=e.intents?.length??0,B=T,re=ee.status==="transcribing",J=ee.status==="recording";return d.jsxs("div",{className:"flex flex-col h-full",children:[d.jsxs("div",{className:"flex items-center gap-1.5 px-3 py-1.5 border-b border-neutral-700/50 bg-neutral-900/50",children:[d.jsx(WS,{size:11,className:"text-cyan-400/60"}),d.jsx("span",{className:"text-[10px] font-mono uppercase tracking-wider text-neutral-500",children:"Assistant"}),d.jsxs("span",{className:"text-[10px] font-mono text-neutral-600",children:["· ",e.name]}),d.jsx("div",{className:"flex-1"}),B&&N==="chat"&&d.jsx("button",{type:"button",onClick:()=>{_&&$.stop(),R(!_)},className:`p-1 rounded transition-colors ${_?"text-cyan-300 hover:text-cyan-200":"text-neutral-500 hover:text-neutral-300"}`,title:_?"Speaker on (click to mute)":"Speaker off (click to enable)",children:$.isPlaying?d.jsx(Tx,{size:12,className:"animate-spin"}):_?d.jsx(f_,{size:12}):d.jsx(p_,{size:12})}),d.jsxs("div",{className:"flex items-center gap-1 rounded-full border border-neutral-700 p-0.5",children:[d.jsx(NS,{active:N==="relay",onClick:()=>A("relay"),children:"Relay"}),d.jsx(NS,{active:N==="chat",onClick:()=>A("chat"),children:"Chat"})]}),N==="relay"&&I.status==="connected"&&d.jsx("button",{type:"button",onClick:()=>I.restart(),className:"text-[10px] px-2 py-0.5 rounded-full border text-cyan-400 border-cyan-500/30 hover:bg-cyan-500/10 transition-colors",title:"Kill session and start fresh",children:"Restart"}),N==="relay"&&I.status==="connected"&&d.jsx("button",{type:"button",onClick:()=>I.disconnect(),className:"text-[10px] px-2 py-0.5 rounded-full border text-red-400 border-red-500/30 hover:bg-red-500/10 transition-colors",children:"Disconnect"}),N==="relay"&&I.status!=="connected"&&I.status!=="connecting"&&d.jsx("button",{type:"button",onClick:()=>I.connect(),className:"text-[10px] px-2 py-0.5 rounded-full border text-emerald-400 border-emerald-500/30 hover:bg-emerald-500/10 transition-colors",children:"Connect"})]}),d.jsx("div",{className:"flex-1 min-h-0",children:N==="relay"?d.jsx(P$,{relay:I,configItems:F,onOpenSettings:v,onStartService:H}):d.jsx(k$,{chat:ie,placeholder:Z===0?`Ask about ${e.name} — no intents declared, conversation only.`:`Ask ${e.name} to do something… (${Z} intent${Z===1?"":"s"})`,inputValue:C,onInputChange:D=>{L==="voice"&&D.length===0&&Y("text"),j(D)},inputExtras:B&&ee.isSupported?d.jsx("button",{type:"button",onClick:z,disabled:re,className:`p-1 rounded transition-colors disabled:opacity-30 ${J?"bg-red-500/15 text-red-300 hover:bg-red-500/20":"text-neutral-500 hover:text-cyan-400"}`,title:J?"Stop recording":"Record voice prompt",children:re?d.jsx(Tx,{size:12,className:"animate-spin"}):J?d.jsx(JS,{size:11}):d.jsx(B2,{size:12})}):void 0,inputStatus:B?d.jsx(RV,{inputStatus:ee.status,inputError:ee.error,outputStatus:$.status,outputError:$.error}):void 0})})]})}function RV({inputStatus:e,inputError:t,outputStatus:s,outputError:r}){const i=ES(e)??ES(s),l=t??r;return!i&&!l?null:d.jsxs("div",{className:"flex items-center gap-2",children:[i&&d.jsx("span",{className:`text-[10px] px-2 py-0.5 rounded-full border font-mono ${i.className}`,children:i.label}),l&&d.jsx("span",{className:"text-[10px] text-neutral-500 truncate flex-1",title:l,children:l})]})}function ES(e){switch(e){case"recording":return{label:"listening",className:"border-red-500/20 bg-red-500/10 text-red-300"};case"transcribing":return{label:"transcribing",className:"border-amber-500/20 bg-amber-500/10 text-amber-300"};case"ready":return{label:"draft ready",className:"border-cyan-500/20 bg-cyan-500/10 text-cyan-300"};case"synthesizing":return{label:"voicing",className:"border-cyan-500/20 bg-cyan-500/10 text-cyan-300"};case"speaking":return{label:"speaking",className:"border-emerald-500/20 bg-emerald-500/10 text-emerald-300"};case"unavailable":return{label:"voice offline",className:"border-amber-500/20 bg-amber-500/10 text-amber-300"};case"error":return{label:"voice error",className:"border-red-500/20 bg-red-500/10 text-red-300"};default:return null}}function NS({active:e,onClick:t,children:s}){return d.jsx("button",{type:"button",onClick:t,className:`text-[10px] px-2 py-0.5 rounded-full transition-colors ${e?"bg-cyan-500/15 text-cyan-300":"text-neutral-500 hover:text-neutral-300"}`,children:s})}function AV(e){const t=[`You are working alongside the user inside the **${e.name}** Hudson app.`];e.description&&t.push(e.description);const s=e.intents??[];if(s.length>0){t.push("","## What this app can do (for context)");for(const r of s)t.push(`- ${r.title} — ${r.description}`);t.push("","These actions live inside the running app. You can describe them to the user, but you do not invoke them yourself — the user can trigger any of them via the command palette (Cmd+K).")}return t.push("","## How to behave","- Be terse. The user is in a terminal; respect their attention.","- Use your own tools (file ops, shell, etc.) freely if it helps.","- When asked to change something inside the app itself, prefer guiding the user to the matching command rather than hacking around it."),t.join(`
140
- `)}function _V({app:e,assistant:t=!0}){return d.jsx(e.Provider,{children:d.jsx(kV,{app:e,assistantEnabled:t})})}function kV({app:e,assistantEnabled:t}){const{navTotalHeight:s}=iy(),r=e.hooks.useCommands(),i=e.hooks.useStatus(),l=e.hooks.useSearch?.()??null,c=e.hooks.useNavCenter?.()??null,f=e.hooks.useNavActions?.()??null,p=e.hooks.useLayoutMode?.()??e.mode,h=e.hooks.useActiveToolHint?.()??null,[g,v]=b.useState("ws://localhost:3600");b.useEffect(()=>{v(`ws://${window.location.host}`)},[]);const[x,w]=ur(`appshell.${e.id}.left`,!1),[T,N]=ur(`appshell.${e.id}.right`,!1),[A,C]=ur(`appshell.${e.id}.leftW`,260),[j,S]=ur(`appshell.${e.id}.rightW`,280),[_,R]=b.useState({x:0,y:0}),[M,O]=b.useState(1),I=b.useCallback(G=>{R(oe=>({x:oe.x+G.x,y:oe.y+G.y}))},[]),H=b.useCallback(G=>{O(G)},[]),[F,$]=b.useState(!1),[L,Y]=b.useState(!1),[ie,ee]=ur(`appshell.${e.id}.termH`,320),z=!!e.slots.Terminal,Z=b.useMemo(()=>{const G=[];return z&&G.push("terminal"),t&&G.push("assistant"),G},[z,t]),B=Z[0]??"terminal",[re,J]=ur(`appshell.${e.id}.drawerTab`,B),D=Z.includes(re)?re:B,[U,W]=b.useState(!1),[se,te]=b.useState(new Set),me=b.useCallback(G=>{te(oe=>{const ve=new Set(oe);return ve.has(G)?ve.delete(G):ve.add(G),ve})},[]),he=b.useCallback(G=>oe=>{oe.preventDefault();const ve=oe.clientX,we=G==="left"?A:j,Ce=G==="left"?C:S,ge=G==="left"?1:-1,Oe=Se=>{const Ee=(Se.clientX-ve)*ge;Ce(Math.max(200,Math.min(500,we+Ee)))},ye=()=>{document.removeEventListener("mousemove",Oe),document.removeEventListener("mouseup",ye)};document.addEventListener("mousemove",Oe),document.addEventListener("mouseup",ye)},[A,j,C,S]),pe=b.useMemo(()=>{const G=[{id:"shell:toggle-left",label:"Toggle Left Panel",shortcut:"Cmd+[",action:()=>w(oe=>!oe)},{id:"shell:toggle-right",label:"Toggle Right Panel",shortcut:"Cmd+]",action:()=>N(oe=>!oe)},{id:"shell:toggle-terminal",label:"Toggle Terminal",shortcut:"Ctrl+`",action:()=>$(oe=>!oe)}];return t&&G.push({id:"shell:toggle-assistant",label:"Toggle Assistant",shortcut:"Cmd+J",action:()=>{J("assistant"),$(oe=>!oe||re!=="assistant")}}),G},[w,N,t,re,J]),xe=b.useMemo(()=>[...r,...pe],[r,pe]);b.useEffect(()=>{const G=oe=>{(oe.metaKey||oe.ctrlKey)&&oe.key==="k"&&(oe.preventDefault(),W(!0)),(oe.metaKey||oe.ctrlKey)&&oe.key==="["&&(oe.preventDefault(),w(ve=>!ve)),(oe.metaKey||oe.ctrlKey)&&oe.key==="]"&&(oe.preventDefault(),N(ve=>!ve)),oe.ctrlKey&&oe.key==="`"&&(oe.preventDefault(),$(ve=>!ve)),t&&(oe.metaKey||oe.ctrlKey)&&oe.key==="j"&&(oe.preventDefault(),J("assistant"),$(ve=>!(ve&&D==="assistant")))};return window.addEventListener("keydown",G),()=>window.removeEventListener("keydown",G)},[w,N,t,D,J]);const Re=e.slots.Inspector,fe=e.slots.RightPanel,ke=e.tools&&e.tools.length>0,Te=d.jsxs(d.Fragment,{children:[Re&&d.jsx(Re,{}),!Re&&fe&&d.jsx(fe,{}),ke&&d.jsx("div",{className:"border-t border-neutral-700/50",children:e.tools.map(G=>{const oe=se.has(G.id);return d.jsxs("div",{children:[d.jsxs("button",{onClick:()=>me(G.id),className:`w-full flex items-center gap-2 px-4 py-2.5 text-[11px] font-mono tracking-wider uppercase transition-colors hover:bg-white/5 ${h===G.id?"text-emerald-400":"text-neutral-300"}`,children:[oe?d.jsx(R2,{size:10}):d.jsx(_2,{size:10}),d.jsx("span",{className:"text-neutral-400",children:G.icon}),d.jsx("span",{className:"font-bold",children:G.name})]}),oe&&d.jsx("div",{className:"px-4 pb-3",children:d.jsx(G.Component,{})})]},G.id)})})]}),He=d.jsxs(d.Fragment,{children:[e.slots.LeftFooter&&d.jsx(e.slots.LeftFooter,{}),d.jsx(cL,{onOpenCommandPalette:()=>W(!0)})]}),ae=p==="panel"?{position:"absolute",top:s,bottom:28,left:x?0:A,right:T?0:j,overflow:"auto",transition:"left 200ms ease, right 200ms ease"}:{};return d.jsx(nL,{mode:p,panOffset:_,scale:M,onPan:I,onZoom:H,hud:d.jsxs(d.Fragment,{children:[d.jsx(iL,{title:e.name.toUpperCase(),search:l??void 0,center:c,actions:f}),d.jsx(R1,{side:"left",title:e.leftPanel?.title??"Navigation",icon:e.leftPanel?.icon,isCollapsed:x,onToggleCollapse:()=>w(!x),width:A,onResizeStart:he("left"),footer:He,headerActions:e.leftPanel?.headerActions&&d.jsx(e.leftPanel.headerActions,{}),children:e.slots.LeftPanel&&d.jsx(e.slots.LeftPanel,{})}),d.jsx(R1,{side:"right",title:e.rightPanel?.title??"Inspector",icon:e.rightPanel?.icon,isCollapsed:T,onToggleCollapse:()=>N(!T),width:j,onResizeStart:he("right"),headerActions:e.rightPanel?.headerActions&&d.jsx(e.rightPanel.headerActions,{}),children:Te}),d.jsx(lL,{status:i,onToggleTerminal:()=>$(G=>!G),isTerminalOpen:F}),d.jsx("div",{className:"pointer-events-none",style:{position:"fixed",left:x?0:A,right:T?0:j,bottom:0,top:0,zIndex:45,transition:"left 200ms ease, right 200ms ease",transform:"translateZ(0)"},children:d.jsxs(dL,{isOpen:F,onClose:()=>$(!1),onToggleMaximize:()=>Y(G=>!G),isMaximized:L,height:ie,onHeightChange:ee,title:d.jsx(MV,{tabs:Z,active:D,onSelect:J}),children:[D==="terminal"&&(e.slots.Terminal?d.jsx(e.slots.Terminal,{}):d.jsx("div",{className:"p-4 font-mono text-[12px] text-neutral-400",children:"No terminal content"})),D==="assistant"&&d.jsx(CV,{app:e,commands:r,relayUrl:g})]})}),d.jsx(uL,{isOpen:U,onClose:()=>W(!1),commands:xe})]}),children:d.jsx("div",{style:ae,className:"frame-scrollbar",children:d.jsx(e.slots.Content,{})})})}function MV({tabs:e,active:t,onSelect:s}){return e.length===0?null:d.jsx("div",{className:"flex items-center gap-0.5",children:e.map(r=>{const i=r===t,l=r==="terminal"?QS:WS,c=r==="terminal"?"TERMINAL":"ASSISTANT",f=r==="terminal"?"text-emerald-400":"text-cyan-400";return d.jsxs("button",{type:"button",onClick:()=>s(r),className:`flex items-center gap-1.5 px-2.5 py-1 rounded text-xs font-bold tracking-widest font-mono transition-colors ${i?`${f} bg-white/[0.04]`:"text-neutral-500 hover:text-neutral-300"}`,children:[d.jsx(l,{size:13}),d.jsx("span",{children:c})]},r)})})}const OC=(...e)=>e.filter((t,s,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===s).join(" ").trim();const OV=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();const DV=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,s,r)=>r?r.toUpperCase():s.toLowerCase());const TS=e=>{const t=DV(e);return t.charAt(0).toUpperCase()+t.slice(1)};var zV={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const IV=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1};const LV=b.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:s=2,absoluteStrokeWidth:r,className:i="",children:l,iconNode:c,...f},p)=>b.createElement("svg",{ref:p,...zV,width:t,height:t,stroke:e,strokeWidth:r?Number(s)*24/Number(t):s,className:OC("lucide",i),...!l&&!IV(f)&&{"aria-hidden":"true"},...f},[...c.map(([h,g])=>b.createElement(h,g)),...Array.isArray(l)?l:[l]]));const ca=(e,t)=>{const s=b.forwardRef(({className:r,...i},l)=>b.createElement(LV,{ref:l,iconNode:t,className:OC(`lucide-${OV(TS(e))}`,`lucide-${e}`,r),...i}));return s.displayName=TS(e),s};const PV=[["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"}]],UV=ca("activity",PV);const $V=[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"r6nss1"}]],VV=ca("house",$V);const BV=[["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"}]],ZV=ca("layers",BV);const HV=[["path",{d:"M16 10a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 14.286V4a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z",key:"1n2ejm"}],["path",{d:"M20 9a2 2 0 0 1 2 2v10.286a.71.71 0 0 1-1.212.502l-2.202-2.202A2 2 0 0 0 17.172 19H10a2 2 0 0 1-2-2v-1",key:"1qfcsi"}]],FV=ca("messages-square",HV);const qV=[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]],YV=ca("network",qV);const GV=[["path",{d:"M16.247 7.761a6 6 0 0 1 0 8.478",key:"1fwjs5"}],["path",{d:"M19.075 4.933a10 10 0 0 1 0 14.134",key:"ehdyv1"}],["path",{d:"M4.925 19.067a10 10 0 0 1 0-14.134",key:"1q22gi"}],["path",{d:"M7.753 16.239a6 6 0 0 1 0-8.478",key:"r2q7qm"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]],XV=ca("radio",GV);const KV=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],WV=ca("settings",KV);const JV=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],QV=ca("users",JV);function Qp(){const e=window.location.pathname.replace(/^\/+/,"").split("/").filter(Boolean);return e[0]==="agent"&&e[1]?{view:"agent-info",conversationId:decodeURIComponent(e[1])}:e[0]==="agents"&&e[1]&&e[2]==="c"&&e[3]?{view:"agents",agentId:decodeURIComponent(e[1]),conversationId:decodeURIComponent(e[3])}:e[0]==="agents"&&e[1]?{view:"agents",agentId:decodeURIComponent(e[1])}:e[0]==="agents"?{view:"agents"}:e[0]==="fleet"?{view:"fleet"}:e[0]==="c"&&e[1]?{view:"conversation",conversationId:decodeURIComponent(e[1])}:e[0]==="sessions"&&e[1]?{view:"sessions",sessionId:decodeURIComponent(e[1])}:e[0]==="sessions"?{view:"sessions"}:e[0]==="mesh"?{view:"mesh"}:e[0]==="activity"?{view:"activity"}:e[0]==="work"&&e[1]?{view:"work",workId:decodeURIComponent(e[1])}:e[0]==="settings"?{view:"settings"}:{view:"inbox"}}function eB(e){switch(e.view){case"inbox":return"/";case"conversation":return`/c/${encodeURIComponent(e.conversationId)}`;case"agent-info":return`/agent/${encodeURIComponent(e.conversationId)}`;case"agents":return e.agentId?e.conversationId?`/agents/${encodeURIComponent(e.agentId)}/c/${encodeURIComponent(e.conversationId)}`:`/agents/${encodeURIComponent(e.agentId)}`:"/agents";case"fleet":return"/fleet";case"sessions":return e.sessionId?`/sessions/${encodeURIComponent(e.sessionId)}`:"/sessions";case"mesh":return"/mesh";case"activity":return"/activity";case"work":return`/work/${encodeURIComponent(e.workId)}`;case"settings":return"/settings"}}function em(e){switch(e.view){case"conversation":return`conv:${e.conversationId}`;case"agent-info":return`agent-info:${e.conversationId}`;case"agents":return e.conversationId?`agent-conv:${e.conversationId}`:e.agentId?`agent:${e.agentId}`:"agents";case"sessions":return e.sessionId?`session:${e.sessionId}`:"sessions";case"work":return`work:${e.workId}`;default:return e.view}}function tB(){const[e,t]=b.useState(Qp),s=b.useRef({});b.useEffect(()=>{const i=()=>{const l=Qp();t(l),requestAnimationFrame(()=>{window.scrollTo(0,s.current[em(l)]??0)})};return window.addEventListener("popstate",i),()=>window.removeEventListener("popstate",i)},[]);const r=b.useCallback(i=>{s.current[em(Qp())]=window.scrollY,window.history.pushState(null,"",eB(i)),t(i),requestAnimationFrame(()=>{window.scrollTo(0,s.current[em(i)]??0)})},[]);return{route:e,navigate:r}}function DC(e){const t=e.match(/^dm\.operator\.(.+)$/);return t?t[1]:null}function ng(e){return`dm.operator.${e}`}async function it(e,t){const s=await fetch(e,{...t,headers:{...t?.headers??{},...t?.body?{"content-type":"application/json"}:{}}});if(!s.ok){const i=await s.text();throw new Error(i||`HTTP ${s.status}`)}const r=await s.text();if(r)return JSON.parse(r)}const nB=["hello","node.upserted","actor.registered","agent.registered","agent.endpoint.upserted","conversation.upserted","binding.upserted","message.posted","invocation.requested","flight.updated","delivery.planned","delivery.attempted","delivery.state.changed","collaboration.upserted","collaboration.event.appended","scout.dispatched"];function sB(e){try{return JSON.parse(e)}catch{return{kind:"unknown"}}}function Kn(e){const t=b.useRef(e);t.current=e,b.useEffect(()=>{let s=null,r=null;function i(){s=new EventSource("/api/events");const l=c=>{t.current(sB(c.data))};s.onmessage=l;for(const c of nB)s.addEventListener(c,l);s.onerror=()=>{s?.close(),r=setTimeout(i,3e3)}}return i(),()=>{s?.close(),r&&clearTimeout(r)}},[])}function ws(e){return e==="working"?"working":!e||e==="offline"?"offline":"available"}function Fa(e){return ws(e)!=="offline"}function ao(e){switch(ws(e)){case"working":return"Working";case"available":return"Available";default:return"Offline"}}const zC={current:null,setMenu:null};function mo(){return b.useCallback((e,t)=>{e.preventDefault(),e.stopPropagation(),zC.setMenu?.({position:{x:e.clientX,y:e.clientY},items:t})},[])}function rB({children:e}){const[t,s]=b.useState(null),r=b.useRef(null);zC.setMenu=s;const i=b.useCallback(()=>s(null),[]);return b.useEffect(()=>{if(!t)return;const l=()=>i(),c=p=>{p.key==="Escape"&&i()},f=()=>i();return window.addEventListener("mousedown",l,!0),window.addEventListener("keydown",c),window.addEventListener("scroll",f,!0),window.addEventListener("contextmenu",i,!0),()=>{window.removeEventListener("mousedown",l,!0),window.removeEventListener("keydown",c),window.removeEventListener("scroll",f,!0),window.removeEventListener("contextmenu",i,!0)}},[t,i]),b.useEffect(()=>{if(!t||!r.current)return;const l=r.current,c=l.getBoundingClientRect(),f=window.innerWidth,p=window.innerHeight;let h=t.position.x,g=t.position.y;h+c.width>f-8&&(h=f-c.width-8),g+c.height>p-8&&(g=p-c.height-8),h<8&&(h=8),g<8&&(g=8),l.style.left=`${h}px`,l.style.top=`${g}px`},[t]),t?d.jsxs(d.Fragment,{children:[e,d.jsx("div",{ref:r,className:"s-context-menu",style:{left:t.position.x,top:t.position.y},role:"menu",onMouseDown:l=>l.stopPropagation(),children:t.items.map((l,c)=>l.kind==="separator"?d.jsx("div",{className:"s-context-menu-sep",role:"separator"},c):d.jsxs("button",{type:"button",className:"s-context-menu-item",role:"menuitem",onClick:()=>{l.onSelect(),i()},children:[d.jsx("span",{className:"s-context-menu-label",children:l.label}),l.shortcut&&d.jsx("span",{className:"s-context-menu-shortcut",children:l.shortcut})]},c))})]}):d.jsx(d.Fragment,{children:e})}const IC=b.createContext(null);function Ft(){const e=b.useContext(IC);if(!e)throw new Error("useScout must be used inside ScoutProvider");return e}function aB({children:e}){const{route:t,navigate:s}=tB(),[r,i]=b.useState([]),[l,c]=b.useState([]),[f,p]=b.useState(null),[h,g]=b.useState(!1),v=b.useCallback(()=>g(!0),[]),x=b.useCallback(async()=>{const[A,C]=await Promise.allSettled([it("/api/agents"),it("/api/messages")]);A.status==="fulfilled"&&i(A.value),C.status==="fulfilled"&&c(C.value)},[]),w=b.useCallback(async()=>{try{const A=await it("/api/onboarding/state");p(A)}catch{p({hasLocalConfig:!0,hasProjectConfig:!0,hasOperatorName:!0,localConfigPath:null,projectRoot:null,currentDirectory:null,operatorName:null,operatorNameSuggestion:null})}},[]);b.useEffect(()=>{x(),w()},[x,w]),Kn(x);const T=b.useMemo(()=>r.filter(A=>Fa(A.state)).length,[r]),N=b.useMemo(()=>({route:t,navigate:s,agents:r,messages:l,onlineCount:T,reload:x,onboarding:f,refreshOnboarding:w,onboardingSkipped:h,skipOnboarding:v}),[t,s,r,l,T,x,f,w,h,v]);return d.jsx(IC.Provider,{value:N,children:d.jsx("div",{"data-scout-theme":!0,style:{"--hud-font-sans":"'Inter', ui-sans-serif, system-ui, sans-serif","--hud-font-mono":"'JetBrains Mono', ui-monospace, Menlo, monospace","--hud-font-serif":"'Spectral', Georgia, serif"},children:d.jsx(rB,{children:e})})})}const iB={ask_sent:"asked",ask_replied:"replied",ask_failed:"failed",ask_working:"working",flight_created:"task started",flight_updated:"task updated",message_sent:"sent",message_received:"received",agent_online:"online",agent_offline:"offline"};function oB(e){return iB[e]??e.replace(/_/g," ")}const jS=["#6366f1","#8b5cf6","#0ea5e9","#14b8a6","#f59e0b","#ef4444","#ec4899","#10b981"];function Ts(e){let t=0;for(let s=0;s<e.length;s++)t=(t<<5)-t+e.charCodeAt(s)|0;return jS[Math.abs(t)%jS.length]}function ec(e){switch(ws(e)){case"working":return"var(--green)";case"available":return"var(--accent)";default:return"var(--dim)"}}const lB={workspace:"workspace",worktree:"workspace",branch:"workspace",profile:"profile",persona:"profile",harness:"harness",runtime:"harness",node:"node",host:"node"};function cB(e){return e.trim().replace(/^@+/,"").replace(/[.,!?;)\]]+$/,"")}function Is(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/-+/g,"-").replace(/^-+|-+$/g,"")}const uB="scout";function dB(e){return lB[Is(e)]??null}function LC(e){const t=Is(e.definitionId),s=e.workspaceQualifier?Is(e.workspaceQualifier):void 0,r=e.profile?Is(e.profile):void 0,i=e.harness?Is(e.harness):void 0,l=e.nodeQualifier?Is(e.nodeQualifier):void 0;return t?{definitionId:t,...s?{workspaceQualifier:s}:{},...r?{profile:r}:{},...i?{harness:i}:{},...l?{nodeQualifier:l}:{}}:null}function fB(e){const t=e.split(".").filter(Boolean),s=t.shift();if(!s)return null;const r={definitionId:s},i=[];for(const l of t){if(l.includes(":")){const[c,f=""]=l.split(":",2),p=dB(c),h=Is(f);if(!p||!h)return null;p==="workspace"?r.workspaceQualifier=h:p==="profile"?r.profile=h:p==="harness"?r.harness=h:p==="node"&&(r.nodeQualifier=h);continue}i.push(l)}if(i.length===1){const l=Is(i[0]);if(!l)return null;r.workspaceQualifier=l}else if(i.length===2){const l=Is(i[0]),c=Is(i[1]);if(!l||!c)return null;r.workspaceQualifier||(r.workspaceQualifier=l),r.nodeQualifier||(r.nodeQualifier=c)}else if(i.length>2)return null;return pB(r,{raw:e})}function hB(e){const t=cB(e);return!t||t.includes("@")||t.includes("#")?null:fB(t)}function CS(e,t={}){const s=LC(e);if(!s)return t.includeSigil===!1?"":"@";const i=[`${t.includeSigil===!1?"":"@"}${s.definitionId}`];return s.workspaceQualifier&&i.push(s.workspaceQualifier),s.profile&&i.push(`profile:${s.profile}`),s.harness&&i.push(`harness:${s.harness}`),s.nodeQualifier&&i.push(`node:${s.nodeQualifier}`),i.join(".")}function pB(e,t={}){const s=LC(e);return s?{raw:t.raw??CS(s,{includeSigil:!1}),label:CS(s),definitionId:s.definitionId,...s.nodeQualifier?{nodeQualifier:s.nodeQualifier}:{},...s.workspaceQualifier?{workspaceQualifier:s.workspaceQualifier}:{},...s.profile?{profile:s.profile}:{},...s.harness?{harness:s.harness}:{}}:null}function mB(e){return gB(e).parsed}function gB(e){const t=Array.from(e.matchAll(/(^|\s)@([a-z0-9][a-z0-9._/:-]*)/gi)),s=new Map,r=[];for(const i of t){const l=i[2]??"",c=hB(l);if(!c){l&&r.push(`@${l}`);continue}s.set(c.label,c)}return{parsed:Array.from(s.values()),unparsed:Array.from(new Set(r))}}function yB(e,t){if(t.length===0)return[{kind:"text",value:e}];const s=new Map;for(const c of t)s.set(c.label.toLowerCase(),c);const r=[];let i=e;const l=/@([a-z0-9][a-z0-9._/:-]*)/i;for(;i.length>0;){const c=l.exec(i);if(!c||c.index===void 0){r.push({kind:"text",value:i});break}c.index>0&&r.push({kind:"text",value:i.slice(0,c.index)});const f=c[0],p=f.toLowerCase(),h=s.get(p);h?r.push({kind:"mention",identity:h}):r.push({kind:"text",value:f}),i=i.slice(c.index+f.length)}return r}function vB(e,t){const s=[],r=/\*\*(.+?)\*\*/g;let i=0,l,c=0;for(;(l=r.exec(e))!==null;)l.index>i&&s.push(d.jsx("span",{children:e.slice(i,l.index)},`${t}-${c++}`)),s.push(d.jsx("strong",{children:l[1]},`${t}-${c++}`)),i=l.index+l[0].length;return i<e.length&&s.push(d.jsx("span",{children:e.slice(i)},`${t}-${c++}`)),s.length>0?s:[d.jsx("span",{children:e},t)]}function Yn(e){if(!e)return e??"";const t=mB(e);return yB(e,t).flatMap((r,i)=>{if(r.kind==="text")return vB(r.value,i*100);const{identity:l}=r,f=l.definitionId===uB?"var(--accent)":Ts(l.definitionId);return d.jsx("span",{className:"s-mention",style:{"--mention-color":f},children:l.label},i)})}function tt(e){const t=e<1e12?e*1e3:e,s=Math.floor((Date.now()-t)/1e3);return s<5?"now":s<60?`${s}s`:s<3600?`${Math.floor(s/60)}m`:s<86400?`${Math.floor(s/3600)}h`:`${Math.floor(s/86400)}d`}function Ia(e){return new Date(e<1e12?e*1e3:e).toLocaleString(void 0,{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit",second:"2-digit"})}const bB={"agent.registered":"registered","agent.online":"came online","agent.offline":"went offline","flight.started":"started task","flight.completed":"completed task","flight.updated":"updated task","message.sent":"sent message","message.received":"received message","collaboration.ask":"asked a question","collaboration.answer":"answered",ask_sent:"asked",ask_replied:"replied",ask_working:"working",flight_created:"started task",flight_updated:"updated task",message_sent:"sent",message_received:"received"},xB={presence:{label:"Presence",tone:"notice"},work:{label:"Execution",tone:"working"},message:{label:"Delivery",tone:"completed"},collaboration:{label:"Coordination",tone:"working"},system:{label:"System",tone:"notice"}};function PC(e){return bB[e]??e.replace(/[._]/g," ")}function wB(e){return e.startsWith("agent.")||e.includes("registered")||e.includes("online")||e.includes("offline")?"presence":e.startsWith("flight")||e.startsWith("ask_")?"work":e.startsWith("message")?"message":e.startsWith("collaboration")?"collaboration":"system"}function SB(e){return(e??"system").charAt(0).toUpperCase()}function UC(e){return e.length<=14?e:`${e.slice(0,8)}...${e.slice(-4)}`}function EB(e){if(!e)return null;const t=e.split("/").filter(Boolean);return t[t.length-1]??e}function NB(e){return`${e.actorName??"system"} ${PC(e.kind)}`}function TB(e){return e.workspaceRoot?`Recorded from ${e.workspaceRoot}.`:e.conversationId?`Linked to thread ${UC(e.conversationId)}.`:"No additional detail was captured for this event."}function jB({navigate:e}){const[t,s]=b.useState([]),[r,i]=b.useState(null),[l,c]=b.useState(!0),[f,p]=b.useState(!1),[h,g]=b.useState(null),[v,x]=b.useState(null),w=b.useRef([]),T=b.useRef(0),N=b.useRef(null),A=mo();b.useEffect(()=>{w.current=t},[t]);const C=b.useCallback(async(M="initial")=>{const O=++T.current;!(w.current.length>0)&&M!=="background"?(c(!0),g(null)):p(!0);try{const H=await it("/api/activity");if(O!==T.current)return;s(H),g(null),x(Date.now()),i(F=>H.some($=>$.id===F)?F:null)}catch(H){if(O!==T.current)return;g(H instanceof Error?H.message:String(H))}finally{O===T.current&&(c(!1),p(!1))}},[]),j=b.useCallback(()=>{N.current||(N.current=setTimeout(()=>{N.current=null,C("background")},250))},[C]);b.useEffect(()=>(C("initial"),()=>{N.current&&clearTimeout(N.current)}),[C]),Kn(j);const S=b.useMemo(()=>{const M=new Set(t.map(I=>I.actorName??"system")),O=new Set(t.map(I=>I.conversationId).filter(I=>!!I));return[{label:"Events",value:`${t.length}`,detail:t.length>0?`Latest ${tt(t[0].ts)}`:"Waiting for records"},{label:"Actors",value:`${M.size}`,detail:M.size>0?"Distinct event owners":"No actors yet"},{label:"Threads",value:`${O.size}`,detail:O.size>0?"Conversation-linked records":"No linked threads"}]},[t]),_=!l&&t.length===0&&!!h,R=!l&&t.length===0&&!h;return d.jsxs("div",{className:"sys-surface-page",children:[d.jsxs("div",{className:"sys-page-head",children:[d.jsxs("div",{className:"sys-page-title-group",children:[d.jsx("h2",{className:"sys-page-title",children:"Activity"}),d.jsx("p",{className:"sys-page-subtitle",children:"Broker events, task execution, and collaboration handoffs."})]}),d.jsxs("div",{className:"sys-page-actions",children:[d.jsx("div",{className:"sys-sync-note",children:l?"Loading audit ledger...":h&&t.length>0?`Showing last confirmed snapshot from ${v?tt(v):"earlier"}`:v?`Updated ${tt(v)}`:"Waiting for first snapshot"}),d.jsx("button",{type:"button",className:"s-btn",disabled:l||f,onClick:()=>{C("manual")},children:f?"Refreshing...":"Refresh"})]})]}),d.jsx("div",{className:"sys-stat-grid",children:S.map(M=>d.jsxs("div",{className:"sys-stat-card",children:[d.jsx("span",{className:"sys-stat-label",children:M.label}),d.jsx("strong",{className:"sys-stat-value",children:M.value}),d.jsx("span",{className:"sys-stat-detail",children:M.detail})]},M.label))}),h&&t.length>0&&d.jsxs("div",{className:"sys-banner sys-banner-warning",children:[d.jsx("strong",{children:"Refresh failed."}),d.jsx("span",{children:h})]}),l&&t.length===0&&d.jsxs("div",{className:"sys-panel sys-state-card",children:[d.jsx("h3",{className:"sys-state-title",children:"Loading activity"}),d.jsx("p",{className:"sys-state-body",children:"Pulling the latest records from the broker database."})]}),_&&d.jsxs("div",{className:"sys-panel sys-state-card sys-state-card-error",children:[d.jsx("h3",{className:"sys-state-title",children:"Activity is unavailable"}),d.jsx("p",{className:"sys-state-body",children:h}),d.jsx("div",{className:"sys-inline-actions",children:d.jsx("button",{type:"button",className:"s-btn",onClick:()=>{C("manual")},children:"Try again"})})]}),R&&d.jsxs("div",{className:"sys-panel sys-state-card",children:[d.jsx("h3",{className:"sys-state-title",children:"No activity yet"}),d.jsx("p",{className:"sys-state-body",children:"Events appear here after agents register, send messages, or advance work."})]}),t.length>0&&d.jsx("div",{className:"sys-audit-list",children:t.map(M=>{const O=r===M.id,I=wB(M.kind),H=xB[I],F=EB(M.workspaceRoot),$=M.summary&&M.summary!==M.title?M.summary:TB(M);return d.jsxs("article",{className:`sys-audit-entry${O?" sys-audit-entry-expanded":""}`,onContextMenu:L=>{const Y=window.getSelection()?.toString().trim(),ie=[];Y&&(ie.push({kind:"action",label:"Copy Selection",shortcut:"⌘C",onSelect:()=>navigator.clipboard.writeText(Y)}),ie.push({kind:"separator"}));const ee=M.title??M.summary??"";ee&&ie.push({kind:"action",label:"Copy Details",onSelect:()=>navigator.clipboard.writeText(ee)}),M.actorName&&ie.push({kind:"action",label:"Copy Actor",onSelect:()=>navigator.clipboard.writeText(M.actorName)}),ie.push({kind:"action",label:"Copy Event ID",onSelect:()=>navigator.clipboard.writeText(M.id)}),M.conversationId&&(ie.push({kind:"separator"}),ie.push({kind:"action",label:"Open Thread",onSelect:()=>e({view:"conversation",conversationId:M.conversationId})})),A(L,ie)},children:[d.jsxs("button",{type:"button",className:"sys-audit-toggle","aria-expanded":O,onClick:()=>i(O?null:M.id),children:[d.jsxs("div",{className:"sys-audit-stamp",children:[d.jsx("span",{className:"sys-audit-time",children:tt(M.ts)}),d.jsx("span",{className:"sys-audit-date",children:Ia(M.ts)})]}),d.jsx("div",{className:`sys-audit-marker sys-audit-marker-${H.tone}`,children:d.jsx("span",{})}),d.jsxs("div",{className:"sys-audit-body",children:[d.jsxs("div",{className:"sys-audit-topline",children:[d.jsx("span",{className:"sys-audit-category",children:H.label}),d.jsx("span",{className:"sys-audit-kind",children:PC(M.kind)})]}),d.jsx("h3",{className:"sys-audit-title",children:Yn(M.title??NB(M))}),d.jsx("p",{className:"sys-audit-summary",children:Yn($)}),d.jsxs("div",{className:"sys-audit-meta",children:[d.jsxs("span",{className:"sys-audit-meta-item",children:[d.jsx("span",{className:"sys-audit-avatar",style:{background:Ts(M.actorName??"system")},children:SB(M.actorName)}),M.actorName??"system"]}),F&&d.jsxs("span",{className:"sys-audit-meta-item",children:["Workspace ",F]}),M.conversationId&&d.jsxs("span",{className:"sys-audit-meta-item",children:["Thread ",UC(M.conversationId)]})]})]}),d.jsx("div",{className:"sys-audit-expand",children:O?"Close":"Details"})]}),O&&d.jsxs("div",{className:"sys-audit-details",children:[d.jsxs("div",{className:"sys-detail-grid",children:[d.jsxs("div",{className:"sys-detail-card",children:[d.jsx("span",{className:"sys-detail-label",children:"Event"}),d.jsx("code",{className:"sys-detail-value",children:M.kind})]}),d.jsxs("div",{className:"sys-detail-card",children:[d.jsx("span",{className:"sys-detail-label",children:"Recorded"}),d.jsx("span",{className:"sys-detail-value",children:Ia(M.ts)})]}),d.jsxs("div",{className:"sys-detail-card",children:[d.jsx("span",{className:"sys-detail-label",children:"Actor"}),d.jsx("span",{className:"sys-detail-value",children:M.actorName??"system"})]}),d.jsxs("div",{className:"sys-detail-card",children:[d.jsx("span",{className:"sys-detail-label",children:"Workspace"}),d.jsx("span",{className:"sys-detail-value",children:M.workspaceRoot??"Not attached"})]}),d.jsxs("div",{className:"sys-detail-card",children:[d.jsx("span",{className:"sys-detail-label",children:"Thread"}),d.jsx("span",{className:"sys-detail-value",children:M.conversationId??"Not attached"})]}),d.jsxs("div",{className:"sys-detail-card",children:[d.jsx("span",{className:"sys-detail-label",children:"Record id"}),d.jsx("code",{className:"sys-detail-value",children:M.id})]})]}),M.conversationId&&d.jsx("div",{className:"sys-inline-actions",children:d.jsx("button",{type:"button",className:"s-btn s-btn-sm",onClick:()=>e({view:"conversation",conversationId:M.conversationId}),children:"Open thread"})})]})]},M.id)})})]})}function CB(e){const t=e.split(".");return t[t.length-1]||e}function pl(e){return e?e.replace(/_/g," "):null}function RB({values:e}){return d.jsx("span",{className:"s-agent-token-list",children:e.map(t=>d.jsx("span",{className:"s-agent-token",children:t},t))})}function zu({title:e,items:t}){return t.length===0?null:d.jsxs("section",{className:"s-agent-profile-card",children:[d.jsx("div",{className:"s-agent-profile-card-header",children:d.jsx("div",{className:"s-agent-profile-card-title",children:e})}),d.jsx("div",{className:"s-agent-meta-card-body",children:t.map(s=>d.jsxs("div",{className:"s-agent-meta-row",children:[d.jsx("span",{className:"s-agent-meta-label",children:s.label}),d.jsx("span",{className:"s-agent-meta-value",children:s.value})]},s.label))})]})}function AB({conversationId:e,navigate:t}){const{agents:s}=Ft(),[r,i]=b.useState(null),[l,c]=b.useState(null),f=DC(e),p=b.useCallback(async()=>{c(null);try{const N=await it(`/api/session/${encodeURIComponent(e)}`).catch(()=>null);i(N)}catch(N){c(N instanceof Error?N.message:String(N)),i(null)}},[e]);b.useEffect(()=>{p()},[p]),Kn(p);const h=r?.agentId??f,g=b.useMemo(()=>h?s.find(N=>N.id===h)??null:null,[s,h]);if(!g)return d.jsxs("div",{children:[d.jsx("button",{type:"button",className:"s-back",onClick:()=>t({view:"conversation",conversationId:e}),children:"← Back"}),l&&d.jsx("p",{className:"s-error",children:l}),d.jsx("div",{className:"s-empty",children:d.jsx("p",{children:"Agent not found"})})]});const v=[{label:"Agent ID",value:g.id},...g.handle?[{label:"Handle",value:`@${g.handle}`}]:[],{label:"Class",value:pl(g.agentClass)??"—"},...g.role?[{label:"Role",value:g.role}]:[],...g.selector?[{label:"Selector",value:g.selector}]:[]],x=[...g.project?[{label:"Project",value:g.project}]:[],...g.branch?[{label:"Branch",value:g.branch}]:[],...g.projectRoot?[{label:"Path",value:g.projectRoot}]:[],...g.cwd?[{label:"Working dir",value:g.cwd}]:[]],w=[{label:"State",value:ao(g.state)},...g.harness?[{label:"Harness",value:g.harness}]:[],...g.transport?[{label:"Transport",value:pl(g.transport)??g.transport}]:[],...g.wakePolicy?[{label:"Wake policy",value:pl(g.wakePolicy)??g.wakePolicy}]:[],...g.capabilities.length>0?[{label:"Capabilities",value:d.jsx(RB,{values:g.capabilities})}]:[]],T=[{label:"Conversation ID",value:e},...r?.title?[{label:"Title",value:r.title}]:[],...r?.workspaceRoot?[{label:"Workspace",value:r.workspaceRoot}]:[],...r?.currentBranch?[{label:"Session branch",value:r.currentBranch}]:[],...r?.messageCount!=null?[{label:"Messages",value:String(r.messageCount)}]:[],...r?.lastMessageAt?[{label:"Last message",value:Ia(r.lastMessageAt)}]:[],...g.harnessSessionId?[{label:"Harness session",value:g.harnessSessionId}]:[],...g.harnessLogPath?[{label:"Harness log",value:g.harnessLogPath}]:[]];return d.jsxs("div",{className:"s-agent-profile-page",children:[d.jsxs("div",{className:"s-agent-profile-page-topbar",children:[d.jsx("button",{type:"button",className:"s-back",onClick:()=>t({view:"conversation",conversationId:e}),children:"← Conversation"}),d.jsx("button",{type:"button",className:"s-btn",onClick:()=>t({view:"agents",agentId:g.id}),children:"Open in Agents"})]}),l&&d.jsx("p",{className:"s-error",children:l}),d.jsxs("section",{className:"s-agent-profile-hero",children:[d.jsx("div",{className:"s-agent-profile-hero-main",children:d.jsxs("div",{className:"s-agent-profile-hero-title-row",children:[d.jsx("div",{className:"s-avatar s-agent-profile-hero-avatar",style:{background:Ts(g.name)},children:g.name[0].toUpperCase()}),d.jsxs("div",{className:"s-agent-profile-hero-copy",children:[d.jsxs("div",{className:"s-agent-casefile-title-meta",children:[d.jsx("span",{className:"s-agent-casefile-record",children:CB(g.id)}),d.jsxs("span",{className:`s-agent-state-chip s-agent-state-chip-${ws(g.state)}`,children:[d.jsx("span",{className:"s-dot",style:{background:ec(g.state)}}),ao(g.state)]})]}),d.jsx("h1",{className:"s-agent-profile-hero-title",children:g.name}),d.jsx("p",{className:"s-agent-profile-hero-copyline",children:[g.handle?`@${g.handle}`:null,g.project,g.branch,pl(g.role)??pl(g.agentClass)].filter(Boolean).join(" • ")}),d.jsxs("p",{className:"s-agent-profile-hero-context",children:[r?.title?`Conversation: ${r.title}.`:"Attached to the current conversation.",g.updatedAt?` Updated ${tt(g.updatedAt)}.`:""]})]})]})}),d.jsx("div",{className:"s-agent-profile-hero-actions",children:d.jsx("button",{type:"button",className:"s-btn s-btn-primary",onClick:()=>t({view:"conversation",conversationId:e}),children:"Open conversation"})})]}),d.jsxs("div",{className:"s-agent-profile-grid",children:[d.jsx(zu,{title:"Identity",items:v}),d.jsx(zu,{title:"Workspace",items:x}),d.jsx(zu,{title:"Runtime",items:w}),d.jsx(zu,{title:"Conversation context",items:T})]})]})}function _B(e){return e.attention==="interrupt"?"failed":e.state==="done"?"completed":e.attention==="badge"||e.state==="waiting"||e.state==="review"?"updated":"working"}function kB(e){switch(e){case"review":return"In review";case"waiting":return"Waiting";case"working":return"Working";case"done":return"Done";default:return e.replace(/_/g," ")}}function MB(e){switch(e){case"badge":return"Needs attention";case"interrupt":return"Blocked";default:return null}}function OB({items:e,navigate:t,emptyTitle:s,emptyDetail:r}){if(e.length===0){const i=[{titleWidth:"56%",metaWidths:["18%","14%","16%"],summaryWidth:"74%"},{titleWidth:"48%",metaWidths:["16%","20%","12%"],summaryWidth:"62%"}];return d.jsxs("div",{className:"s-work-empty-state",children:[d.jsxs("div",{className:"s-work-empty-copy",children:[d.jsx("p",{className:"s-work-empty-kicker",children:"Quiet for now"}),d.jsx("p",{className:"s-work-empty-title",children:s}),r&&d.jsx("p",{className:"s-work-empty-detail",children:r})]}),d.jsx("div",{className:"s-work-empty-skeleton","aria-hidden":"true",children:i.map((l,c)=>d.jsxs("div",{className:"s-work-empty-row",children:[d.jsxs("div",{className:"s-work-empty-row-header",children:[d.jsx("span",{className:"s-work-empty-line s-work-empty-line-title",style:{width:l.titleWidth}}),d.jsx("span",{className:"s-work-empty-pill"})]}),d.jsx("div",{className:"s-work-empty-row-meta",children:l.metaWidths.map(f=>d.jsx("span",{className:"s-work-empty-line s-work-empty-line-meta",style:{width:f}},f))}),d.jsx("span",{className:"s-work-empty-line s-work-empty-line-summary",style:{width:l.summaryWidth}})]},c))})]})}return d.jsx("div",{className:"s-work-list",children:e.map(i=>{const l=!!i.id||!!i.conversationId,c=MB(i.attention),f=i.ownerName??i.ownerId??"Unassigned",p=i.id?()=>t({view:"work",workId:i.id}):i.conversationId?()=>t({view:"conversation",conversationId:i.conversationId}):void 0;return d.jsxs("div",{className:`s-work-row${l?" s-work-row-clickable":""}`,onClick:p,children:[d.jsxs("div",{className:"s-work-row-header",children:[d.jsxs("div",{className:"s-work-row-title-wrap",children:[d.jsx("span",{className:"s-work-row-title",children:i.title}),i.priority&&d.jsx("span",{className:"s-badge",children:i.priority})]}),d.jsx("span",{className:`s-pill s-pill-${_B(i)}`,children:i.currentPhase})]}),d.jsxs("div",{className:"s-work-row-meta",children:[d.jsx("span",{children:f}),d.jsx("span",{children:kB(i.state)}),i.activeChildWorkCount>0&&d.jsxs("span",{children:[i.activeChildWorkCount," child",i.activeChildWorkCount===1?"":"ren"]}),i.activeFlightCount>0&&d.jsxs("span",{children:[i.activeFlightCount," flight",i.activeFlightCount===1?"":"s"]}),c&&d.jsx("span",{children:c}),d.jsx("span",{children:tt(i.lastMeaningfulAt)})]}),i.lastMeaningfulSummary&&d.jsx("p",{className:"s-work-row-summary",children:Yn(i.lastMeaningfulSummary)})]},i.id)})})}const sg=new Set(["completed","failed","cancelled"]),DB={direct:"Direct message",channel:"Channel",group_direct:"Group",thread:"Thread"};function In(e){return typeof e!="number"||!Number.isFinite(e)||e<=0?null:e<1e12?e*1e3:e}function zB(e){if(!e)return null;const t=e.replace(/[\\/]+$/,"");return t?t.split(/[\\/]/).filter(Boolean).at(-1)??t:null}function IB(e){return e.kind==="direct"&&e.agentName?e.agentName:e.title.replace(/\s*<>\s*/g," · ")}function tm(e){const t=In(e);return t===null?"":new Intl.DateTimeFormat(void 0,{dateStyle:"medium",timeStyle:"short"}).format(t)}function LB(e,t){const s=In(e),r=In(t);if(s===null||r===null)return!1;const i=new Date(s),l=new Date(r);return i.getFullYear()===l.getFullYear()&&i.getMonth()===l.getMonth()&&i.getDate()===l.getDate()}function RS(e){const t=In(e);if(t===null)return"";const s=new Date(t),r=new Date,i=new Date(r.getFullYear(),r.getMonth(),r.getDate()).getTime(),l=new Date(s.getFullYear(),s.getMonth(),s.getDate()).getTime(),c=1440*60*1e3;return l===i?"Today":l===i-c?"Yesterday":new Intl.DateTimeFormat(void 0,{weekday:"short",month:"short",day:"numeric"}).format(t)}function PB(e){switch(e){case"status":return"Status";case"system":return"System";case"scout.dispatch":return"Dispatch";default:return null}}function Iu(e){return[...e].sort((t,s)=>(In(t.createdAt)??0)-(In(s.createdAt)??0))}function UB(e){return e.filter(t=>!sg.has(t.state)).sort((t,s)=>(In(s.startedAt)??0)-(In(t.startedAt)??0))[0]??null}function AS(e,t,s){return{id:e.id,invocationId:e.invocationId,agentId:e.targetAgentId||s,agentName:null,conversationId:t,collaborationRecordId:null,state:e.state,summary:e.summary??null,startedAt:e.startedAt??null,completedAt:e.completedAt??null}}function $B(e){const t=e.metadata?.scoutDispatch;if(!t||typeof t!="object")return null;const s=t;return!s.id||!s.kind||!Array.isArray(s.candidates)?null:s}function rg(e,t){if(e.class==="operator")return!0;const s=e.actorName?.toLowerCase()??"";return s===t.toLowerCase()||s==="operator"||s==="you"}function VB(e,t){return e.reduce((s,r)=>{if(rg(r,t))return s;const i=In(r.createdAt);return i===null?s:s===null||i>s?i:s},null)}function BB(e,t){switch(t){case"queued":return`${e} has your message and is waiting to start.`;case"waking":return`${e} is waking up now.`;case"waiting":return`${e} is thinking through the request.`;case"running":return`${e} is working on your request.`;default:return`${e} is working on it.`}}function ZB(e){const{agentName:t,agentState:s,sending:r,currentFlight:i,showWorkingTurn:l}=e;if(r&&!i)return{label:"Sending",detail:`Handing your message to ${t}.`,tone:"pending",showStrip:!0,showTyping:!1};if(i&&l){const c=i.summary?.trim()||BB(t,i.state);switch(i.state){case"queued":return{label:"Queued",detail:c,tone:"pending",showStrip:!0,showTyping:!0};case"waking":return{label:"Coming online",detail:c,tone:"working",showStrip:!0,showTyping:!0};case"waiting":return{label:"Thinking",detail:c,tone:"working",showStrip:!0,showTyping:!0};default:return{label:"Working",detail:c,tone:"working",showStrip:!0,showTyping:!0}}}return Fa(s)?{label:"Available",detail:`${t} is connected.`,tone:"idle",showStrip:!1,showTyping:!1}:{label:"Offline",detail:`${t} is offline right now. Sending a message will wake it up.`,tone:"offline",showStrip:!0,showTyping:!1}}function HB(e,t){switch(e.tone){case"pending":return"var(--accent)";case"working":return"var(--green)";case"offline":return"var(--dim)";default:return ec(t)}}function FB(){return d.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[d.jsx("path",{d:"m3 11 18-8-8 18-2.8-7.2L3 11Z"}),d.jsx("path",{d:"M10.2 13.8 21 3"})]})}function qB(){return d.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:d.jsx("rect",{x:"4",y:"4",width:"16",height:"16",rx:"2"})})}function _S({label:e,value:t}){return d.jsxs("div",{className:"s-conv-meta-row",children:[d.jsx("span",{className:"s-conv-meta-label",children:e}),d.jsx("span",{className:"s-conv-meta-value",children:t})]})}function YB(e){if(!e)return null;const t=e.participantIds.filter(s=>s!=="operator");return t.length===0?null:t.join(", ")}function ag({conversationId:e,navigate:t}){const{agents:s}=Ft(),[r,i]=b.useState(null),[l,c]=b.useState([]),[f,p]=b.useState(null),[h,g]=b.useState(null),v=b.useRef(null),x=b.useRef(null),w=b.useRef(new Set),T=b.useRef(null),N=b.useRef(0),A=DC(e),C=r?.agentId??A,j=r?.kind==="direct"||A!==null,S=b.useMemo(()=>C?s.find(ae=>ae.id===C)??null:null,[s,C]),_=b.useCallback(async()=>{g(null);try{const ae=await it(`/api/session/${encodeURIComponent(e)}`).catch(()=>null);i(ae);const G=ae?.agentId??A,oe=ae?.kind==="direct"&&G&&G.startsWith("local-session-agent-")?ng(G):e;if(oe!==e){t({view:"conversation",conversationId:oe});return}const[ve,we]=await Promise.all([it(`/api/messages?conversationId=${encodeURIComponent(oe)}&limit=300`),it(`/api/flights?conversationId=${encodeURIComponent(oe)}`)]);c(Iu(ve)),w.current=new Set(we.map(Ce=>Ce.invocationId)),p(UB(we))}catch(ae){g(ae instanceof Error?ae.message:String(ae))}},[e,A,t]);b.useEffect(()=>{_()},[_]),b.useEffect(()=>{T.current=f},[f]);const[R,M]=b.useState(""),[O,I]=b.useState(!1),[H,F]=b.useState("operator"),[$,L]=b.useState(null);b.useEffect(()=>{const ae=x.current;if(!ae)return;ae.style.height="0px";const G=Math.min(Math.max(ae.scrollHeight,40),160);ae.style.height=`${G}px`,ae.style.overflowY=ae.scrollHeight>G?"auto":"hidden"},[R]),b.useEffect(()=>{it("/api/user").then(ae=>F(ae.name)).catch(()=>{})},[]);const Y=b.useMemo(()=>VB(l,H),[l,H]);b.useEffect(()=>{$===null||Y===null||Y>=$&&L(null)},[$,Y]);const ie=b.useMemo(()=>!f||sg.has(f.state)?!1:(In(f.startedAt)??$??Date.now())>=(Y??0),[$,f,Y]),ee=O||$!==null||ie,z=S?.name??r?.agentName??r?.title??C??"Conversation",Z=b.useMemo(()=>ZB({agentName:z,agentState:S?.state??null,sending:O,currentFlight:f,showWorkingTurn:ie}),[S?.state,z,f,O,ie]),B=r?IB(r):z,re=r?.kind?DB[r.kind]??r.kind:"Conversation",J=YB(r)??e,D=zB(r?.workspaceRoot),U=r?.lastMessageAt??l[l.length-1]?.createdAt??null,W=[D?{label:D,title:r?.workspaceRoot??void 0}:null,r?.currentBranch?{label:r.currentBranch,title:r.currentBranch}:null,S?.harness??r?.harness?{label:S?.harness??r?.harness??"",title:void 0}:null].filter(ae=>!!ae);Kn(b.useCallback(ae=>{if(ae.kind==="message.posted"){const G=ae.payload?.message;if(!G||G.conversationId!==e)return;const oe=G.actorId===C,ve={id:G.id,conversationId:G.conversationId,actorName:oe?z:H,body:G.body,createdAt:G.createdAt,class:oe?G.class:"operator"};if(c(we=>{if(we.some(Ce=>Ce.id===G.id))return we;if(!oe){const Ce=we.findIndex(ge=>ge.id.startsWith("optimistic-")&&ge.body===G.body&&Math.abs((In(ge.createdAt)??0)-(In(G.createdAt)??0))<=6e4);if(Ce!==-1){const ge=[...we];return ge[Ce]=ve,Iu(ge)}}return Iu([...we,ve])}),oe){const we=In(G.createdAt)??Date.now();L(Ce=>Ce===null||we<Ce?Ce:null),p(Ce=>{if(!Ce)return Ce;const ge=In(Ce.startedAt)??0;return we>=ge?null:Ce})}return}if(ae.kind==="invocation.requested"){const G=ae.payload?.invocation;if(!G||G.targetAgentId!==C||G.conversationId!==e)return;w.current.add(G.id),L(oe=>oe??Date.now());return}if(ae.kind==="flight.updated"){const G=ae.payload?.flight;if(!G||G.targetAgentId!==C||!(w.current.has(G.invocationId)||T.current?.id===G.id))return;if(sg.has(G.state)){p(ve=>ve?.id===G.id?null:ve),_();return}w.current.add(G.invocationId),p(AS(G,e,C??""));return}ae.kind!=="agent.endpoint.upserted"&&ae.kind==="unknown"&&_()},[C,z,e,_,H])),b.useEffect(()=>{if(!ee)return;const ae=setInterval(()=>{_()},5e3);return()=>clearInterval(ae)},[ee,_]),b.useEffect(()=>{const ae=()=>{if(document.visibilityState!=="visible")return;const G=Date.now();G-N.current<1e3||(N.current=G,_())};return window.addEventListener("focus",ae),document.addEventListener("visibilitychange",ae),()=>{window.removeEventListener("focus",ae),document.removeEventListener("visibilitychange",ae)}},[_]);const se=l.length+(Z.showTyping?1:0),te=b.useRef(0);b.useEffect(()=>{se>te.current&&v.current?.scrollIntoView({behavior:"smooth"}),te.current=se},[se]);const[,me]=b.useState(0);b.useEffect(()=>{const ae=setInterval(()=>me(G=>G+1),15e3);return()=>clearInterval(ae)},[]);const he=async ae=>{const G=ae.trim();if(!G||O)return;const oe=Date.now(),ve={id:`optimistic-${oe}`,conversationId:e,actorName:H,body:G,createdAt:oe,class:"operator"};I(!0),L(oe),g(null),c(we=>Iu([...we,ve]));try{const we=await it("/api/send",{method:"POST",body:JSON.stringify({body:G,conversationId:e})});we.flight&&(w.current.add(we.flight.invocationId),p(AS(we.flight,e,C??"")))}catch(we){c(Ce=>Ce.filter(ge=>ge.id!==ve.id)),L(null),g(we instanceof Error?we.message:String(we))}finally{I(!1)}},pe=async()=>{const ae=R.trim();ae&&(M(""),await he(ae))},xe=async()=>{if(C)try{await it("/api/agents/"+encodeURIComponent(C)+"/interrupt",{method:"POST",body:JSON.stringify({})})}catch{}},Re=Z.tone==="working"||Z.tone==="pending",fe=!R.trim()&&Re,ke=mo(),Te=b.useCallback((ae,G)=>{const oe=window.getSelection()?.toString().trim(),ve=[];oe&&(ve.push({kind:"action",label:"Copy Selection",shortcut:"⌘C",onSelect:()=>navigator.clipboard.writeText(oe)}),ve.push({kind:"separator"})),ve.push({kind:"action",label:"Copy Message",onSelect:()=>navigator.clipboard.writeText(G.body)}),G.actorName&&!rg(G,H)&&ve.push({kind:"action",label:"Copy Agent ID",onSelect:()=>navigator.clipboard.writeText(G.actorName??"")}),ve.push({kind:"separator"}),ve.push({kind:"action",label:"Copy Message ID",onSelect:()=>navigator.clipboard.writeText(G.id)}),ke(ae,ve)},[H,ke]),He=async(ae,G)=>{const oe=`@${G.agentId} `,ve=R.trim();if(ve){M(""),await he(`${oe}${ve}`);return}M(oe),x.current?.focus()};return d.jsxs("div",{className:"s-conversation s-inbox-thread-redesign",children:[d.jsxs("div",{className:"s-conv-header",onClick:()=>j?t({view:"agent-info",conversationId:e}):void 0,style:j?void 0:{cursor:"default"},onContextMenu:ae=>{const G=[{kind:"action",label:"Copy Title",onSelect:()=>navigator.clipboard.writeText(B)}];C&&G.push({kind:"action",label:"Copy Agent ID",onSelect:()=>navigator.clipboard.writeText(C)}),G.push({kind:"action",label:"Copy Conversation ID",onSelect:()=>navigator.clipboard.writeText(e)}),ke(ae,G)},children:[d.jsx("button",{type:"button",className:"s-back",onClick:ae=>{ae.stopPropagation(),t(j?{view:"inbox"}:{view:"sessions"})},children:"←"}),d.jsxs("div",{className:"s-thread-header-copy",children:[d.jsxs("div",{className:"s-thread-header-main",children:[d.jsx("div",{className:"s-avatar s-avatar-sm",style:{background:Ts(z)},children:z[0]?.toUpperCase()??"?"}),d.jsxs("div",{className:"s-conv-header-info",children:[d.jsx("span",{className:"s-conv-header-name",children:B}),d.jsxs("span",{className:"s-conv-header-state",title:j?Z.detail:J,children:[d.jsx("span",{className:"s-dot s-dot-sm",style:{background:HB(Z,S?.state??null)}}),j?Z.label:J]})]})]}),d.jsxs("div",{className:"s-thread-header-meta",children:[d.jsx("span",{className:"s-thread-kicker",children:re}),U&&d.jsx("span",{className:"s-thread-header-updated s-tabular",title:tm(U),children:tt(U)})]})]}),W.length>0&&d.jsx("div",{className:"s-thread-header-chips","aria-label":"Thread details",children:W.map((ae,G)=>d.jsx("span",{className:"s-thread-chip",title:ae.title,children:ae.label},`${ae.label}-${G}`))}),j&&C&&d.jsx("span",{className:"s-chevron"})]}),Z.showStrip&&d.jsxs("div",{className:`s-conv-status s-conv-status-${Z.tone}`,"aria-live":"polite",children:[d.jsx("span",{className:"s-conv-status-dot"}),d.jsxs("div",{className:"s-conv-status-copy",children:[d.jsx("span",{className:"s-conv-status-label",children:Z.label}),d.jsx("span",{className:"s-conv-status-detail",children:Z.detail})]})]}),j&&S&&(S.harnessSessionId||S.harnessLogPath)&&d.jsxs("details",{className:"s-conv-meta-disclosure",children:[d.jsx("summary",{className:"s-conv-meta-toggle",children:"Session details"}),d.jsxs("div",{className:"s-conv-meta","aria-label":"Agent session metadata",children:[S.harnessSessionId&&d.jsx(_S,{label:"Harness Session",value:S.harnessSessionId}),S.harnessLogPath&&d.jsx(_S,{label:"Harness Log",value:S.harnessLogPath})]})]}),h&&d.jsx("p",{className:"s-error",children:h}),d.jsxs("div",{className:"s-messages",children:[l.length===0?d.jsxs("div",{className:"s-empty s-thread-empty",children:[d.jsx("p",{children:"No messages yet"}),d.jsx("p",{children:j?`Start a conversation with ${z}.`:"Start the thread below."})]}):l.map((ae,G)=>{const oe=rg(ae,H),ve=$B(ae),we=ve?"scout.dispatch":ae.class,Ce=PB(we),ge=G===0||!LB(l[G-1]?.createdAt,ae.createdAt),Oe=tm(ae.createdAt);return d.jsxs("div",{className:"s-thread-message-block",children:[ge&&d.jsxs("div",{className:"s-thread-day-divider","aria-label":RS(ae.createdAt),children:[d.jsx("span",{className:"s-thread-day-line","aria-hidden":"true"}),d.jsx("span",{className:"s-thread-day-label",children:RS(ae.createdAt)}),d.jsx("span",{className:"s-thread-day-line","aria-hidden":"true"})]}),d.jsx("article",{className:`s-msg s-row-message${oe?" s-msg-you":""}`,"data-class":we,onContextMenu:ye=>Te(ye,ae),children:d.jsxs("div",{className:"s-msg-card",children:[d.jsxs("div",{className:"s-msg-header",children:[d.jsxs("div",{className:"s-msg-meta",children:[d.jsx("span",{className:"s-msg-actor",children:oe?"You":ae.actorName}),Ce&&d.jsx("span",{className:"s-msg-kind",children:Ce})]}),d.jsx("span",{className:"s-msg-time",title:Oe,children:tt(ae.createdAt)})]}),d.jsx("div",{className:"s-msg-body",title:Oe,children:Yn(ae.body)}),ve&&ve.candidates.length>0&&d.jsx("div",{className:"s-scout-dispatch",children:ve.candidates.map(ye=>d.jsxs("button",{type:"button",className:"s-scout-tile",onClick:()=>{He(ve,ye)},children:[d.jsxs("span",{className:"s-scout-tile-id",children:["@",ye.agentId]}),d.jsx("span",{className:"s-scout-tile-state",children:ye.endpointState}),d.jsx("span",{className:"s-scout-tile-meta",children:[ye.workspace,ye.node,ye.projectRoot].filter(Boolean).join(" · ")||ye.displayName})]},ye.agentId))})]})})]},ae.id)}),Z.showTyping&&d.jsx("div",{className:"s-thread-message-block",children:d.jsx("div",{className:"s-msg s-msg-working","aria-live":"polite",children:d.jsxs("div",{className:"s-msg-card s-msg-working-card",children:[d.jsxs("div",{className:"s-msg-header",children:[d.jsxs("div",{className:"s-msg-meta",children:[d.jsx("span",{className:"s-msg-actor",children:z}),d.jsx("span",{className:"s-msg-kind",children:"Live"})]}),d.jsx("span",{className:"s-msg-time",title:f?.startedAt?tm(f.startedAt):"now",children:f?.startedAt?tt(f.startedAt):"now"})]}),d.jsxs("div",{className:"s-msg-working-body",children:[d.jsxs("span",{className:"s-typing-indicator","aria-hidden":"true",children:[d.jsx("span",{className:"s-typing-dot"}),d.jsx("span",{className:"s-typing-dot"}),d.jsx("span",{className:"s-typing-dot"})]}),d.jsx("span",{className:"s-msg-working-copy",children:Z.detail})]})]})})}),d.jsx("div",{ref:v})]}),d.jsx("form",{className:"s-compose",onSubmit:ae=>{ae.preventDefault(),pe()},children:d.jsxs("div",{className:"s-thread-compose-shell",children:[d.jsx("textarea",{ref:x,className:"s-compose-input",placeholder:`Message ${z}...`,value:R,onChange:ae=>M(ae.target.value),onKeyDown:ae=>{ae.key!=="Enter"||ae.shiftKey||ae.nativeEvent.isComposing||(ae.preventDefault(),!O&&R.trim()&&pe())},rows:1}),d.jsxs("div",{className:"s-thread-compose-footer",children:[d.jsx("span",{className:"s-thread-compose-hint",children:O?"Sending…":fe?"Stop":Re?d.jsxs(d.Fragment,{children:[d.jsx("kbd",{className:"s-kbd",children:"↵"})," steer"]}):d.jsxs(d.Fragment,{children:[d.jsx("kbd",{className:"s-kbd",children:"↵"})," send",d.jsx("kbd",{className:"s-kbd",children:"⇧↵"})," newline"]})}),fe?d.jsx("button",{type:"button",className:"s-compose-send s-compose-stop",onClick:()=>{xe()},"aria-label":"Stop agent",children:d.jsx(qB,{})}):d.jsx("button",{type:"submit",className:"s-compose-send",disabled:O||!R.trim(),"aria-label":"Send message",children:d.jsx(FB,{})})]})]})})]})}function $C(e,t){if(t.filter(i=>i.name===e.name).length<=1)return{name:e.name,qualifier:null};const r=e.project??e.branch??e.id.replace(/^.*\./,"");return{name:e.name,qualifier:r}}function nm(e){return e?e.replace(/_/g," "):null}function GB(e){return e?tt(e):"—"}function XB(e){const t=[...e].filter(i=>i.kind==="direct"&&!!i.agentId).sort((i,l)=>(l.lastMessageAt??0)-(i.lastMessageAt??0)),s=new Map,r=new Map;for(const i of t){const l=i.agentId;s.has(l)||(s.set(l,i.id),r.set(l,i))}return{conversationByAgentId:s,sessionByAgentId:r}}function KB({label:e,value:t}){return d.jsxs("div",{className:"s-agent-meta-row",children:[d.jsx("span",{className:"s-agent-meta-label",children:e}),d.jsx("span",{className:"s-agent-meta-value",children:t})]})}function WB({values:e}){return d.jsx("span",{className:"s-agent-token-list",children:e.map(t=>d.jsx("span",{className:"s-agent-token",children:t},t))})}function JB({title:e,count:t,children:s}){return d.jsxs("section",{className:"s-agent-roster-section",children:[d.jsxs("div",{className:"s-agent-roster-section-header",children:[d.jsx("div",{className:"s-agent-roster-section-title",children:e}),d.jsx("span",{className:"s-agent-roster-section-count",children:t})]}),d.jsx("div",{className:"s-agent-roster-stack",children:s})]})}function QB({agents:e}){return e.length===0?null:d.jsxs("div",{className:"s-agent-overview-empty",children:[d.jsx("h2",{className:"s-agent-overview-empty-title",children:"Select an agent"}),d.jsx("p",{className:"s-agent-overview-empty-copy",children:"Pick an agent from the roster to view its profile, current work, and session context."})]})}function e7({agent:e,allAgents:t,session:s,conversationId:r,navigate:i}){const{name:l,qualifier:c}=$C(e,t),[f,p]=b.useState([]),h=ws(e.state),g=mo(),v=b.useCallback(async()=>{try{p(await it(`/api/work?agentId=${encodeURIComponent(e.id)}`))}catch{p([])}},[e.id]);b.useEffect(()=>{v()},[v]),Kn(v);const x=[...e.project?[{label:"Project",value:e.project}]:[],...e.branch?[{label:"Branch",value:e.branch}]:[],...e.harness?[{label:"Harness",value:e.harness}]:[],...e.transport?[{label:"Transport",value:nm(e.transport)??e.transport}]:[],...e.projectRoot?[{label:"Path",value:e.projectRoot}]:[],...s?.workspaceRoot?[{label:"Workspace",value:s.workspaceRoot}]:[],...s?.currentBranch?[{label:"Session branch",value:s.currentBranch}]:[]];return d.jsxs("div",{className:"s-agent-casefile",children:[d.jsx("button",{type:"button",className:"s-back s-agent-mobile-back",onClick:()=>i({view:"agents"}),children:"← All agents"}),d.jsxs("section",{className:"s-agent-detail-identity",onContextMenu:w=>{const T=window.getSelection()?.toString().trim(),N=[];T&&(N.push({kind:"action",label:"Copy Selection",shortcut:"⌘C",onSelect:()=>navigator.clipboard.writeText(T)}),N.push({kind:"separator"})),N.push({kind:"action",label:"Copy Agent Name",onSelect:()=>navigator.clipboard.writeText(l)}),N.push({kind:"action",label:"Copy Agent ID",onSelect:()=>navigator.clipboard.writeText(e.id)}),e.handle&&N.push({kind:"action",label:`Copy @${e.handle}`,onSelect:()=>navigator.clipboard.writeText(`@${e.handle}`)}),g(w,N)},children:[d.jsx("div",{className:"s-avatar s-agent-casefile-avatar",style:{background:Ts(e.name)},children:e.name[0].toUpperCase()}),d.jsxs("div",{className:"s-agent-detail-identity-copy",children:[d.jsxs("h2",{className:"s-agent-detail-identity-name",children:[l,c&&d.jsx("span",{className:"s-agent-casefile-title-qualifier",children:c})]}),d.jsxs("div",{className:"s-agent-detail-identity-meta",children:[e.handle&&d.jsxs("span",{className:"s-agent-detail-handle",children:["@",e.handle]}),d.jsxs("span",{className:`s-agent-state-chip s-agent-state-chip-${h}`,children:[d.jsx("span",{className:"s-dot",style:{background:ec(e.state)}}),ao(e.state)]}),e.updatedAt&&d.jsx("span",{className:"s-agent-detail-updated",children:tt(e.updatedAt)})]}),d.jsx("p",{className:"s-agent-detail-identity-desc",children:[nm(e.role)??nm(e.agentClass),e.project].filter(Boolean).join(" · ")}),d.jsxs("div",{className:"s-agent-detail-actions",children:[d.jsx("button",{type:"button",className:"s-btn s-btn-primary",onClick:()=>r&&i({view:"agents",agentId:e.id,conversationId:r}),disabled:!r,children:r?"Open conversation":"No conversation"}),e.capabilities.length>0&&d.jsx("div",{className:"s-agent-detail-capabilities",children:d.jsx(WB,{values:e.capabilities})})]})]})]}),x.length>0&&d.jsxs("section",{className:"s-agent-detail-context",children:[d.jsx("h3",{className:"s-agent-detail-section-title",children:"Context"}),d.jsx("div",{className:"s-agent-meta-card-body",children:x.map(w=>d.jsx(KB,{label:w.label,value:w.value},w.label))})]}),d.jsxs("section",{className:"s-agent-detail-work",children:[d.jsx("h3",{className:"s-agent-detail-section-title",children:"Active work"}),d.jsx(OB,{items:f,navigate:i,emptyTitle:"Nothing in flight",emptyDetail:"New asks, handoffs, and follow-ups will stack here once this agent picks up work."})]})]})}function t7({navigate:e,selectedAgentId:t,conversationId:s}){const{agents:r}=Ft(),[i,l]=b.useState([]),c=b.useCallback(async()=>{const R=await it("/api/sessions").catch(()=>null);R&&l(R)},[]);b.useEffect(()=>{c()},[c]),Kn(c);const f=[...r].sort((R,M)=>{const O={working:0,available:1,offline:2},I=O[ws(R.state)]-O[ws(M.state)];if(I!==0)return I;const H=(M.updatedAt??0)-(R.updatedAt??0);return H!==0?H:R.name.localeCompare(M.name)}),p=[{key:"working",title:"Working",agents:f.filter(R=>ws(R.state)==="working")},{key:"available",title:"Available",agents:f.filter(R=>ws(R.state)==="available")},{key:"offline",title:"Offline",agents:f.filter(R=>ws(R.state)==="offline")}],h=t?r.find(R=>R.id===t)??null:null,{conversationByAgentId:g,sessionByAgentId:v}=XB(i),x=r.length>0,w=200,T=440,N="scout-agents-roster-w",[A,C]=b.useState(()=>{try{const R=localStorage.getItem(N);if(R){const M=Number(R);if(M>=w&&M<=T)return M}}catch{}return 280}),j=b.useRef(!1),S=b.useRef(null);b.useEffect(()=>{try{localStorage.setItem(N,String(A))}catch{}},[A]);const _=b.useCallback(R=>{R.preventDefault(),j.current=!0,document.body.style.cursor="col-resize",document.body.style.userSelect="none";const M=S.current?.getBoundingClientRect().left??0,O=H=>{j.current&&C(Math.min(T,Math.max(w,H.clientX-M)))},I=()=>{j.current=!1,document.body.style.cursor="",document.body.style.userSelect="",document.removeEventListener("mousemove",O),document.removeEventListener("mouseup",I)};document.addEventListener("mousemove",O),document.addEventListener("mouseup",I)},[]);return d.jsxs("div",{className:["s-agents-layout","s-agents-browser",x?"s-agents-layout-split":"",h?"s-agents-browser-selected":""].filter(Boolean).join(" "),style:{"--agents-roster-w":`${A}px`},children:[d.jsx("div",{ref:S,className:"s-agents-list-panel s-agents-browser-list",children:d.jsxs("div",{className:"s-agent-roster",children:[d.jsx("div",{className:"s-agent-roster-header",children:d.jsxs("div",{children:[d.jsx("h2",{className:"s-section-title s-agent-roster-title",children:"Agents"}),d.jsxs("p",{className:"s-agent-roster-copy",children:[r.length," total · ",p[0].agents.length," working · ",p[1].agents.length," available"]})]})}),r.length===0?d.jsxs("div",{className:"s-empty s-agent-roster-empty",children:[d.jsx("p",{children:"No agents"}),d.jsx("p",{children:"Agents appear here when they connect to the broker."})]}):p.filter(R=>R.agents.length>0).map(R=>d.jsx(JB,{title:R.title,count:R.agents.length,children:R.agents.map(M=>d.jsx(n7,{agent:M,allAgents:r,selected:M.id===t,onClick:()=>e({view:"agents",agentId:M.id})},M.id))},R.key))]})}),x&&d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"s-agents-roster-resize",onMouseDown:_,role:"separator","aria-orientation":"vertical"}),d.jsx("div",{className:"s-agents-detail-panel s-agents-browser-detail",children:s&&h?d.jsx(ag,{conversationId:s,navigate:e}):h?d.jsx(e7,{agent:h,allAgents:r,session:v.get(h.id)??null,conversationId:g.get(h.id)??h.conversationId??null,navigate:e}):d.jsx(QB,{agents:r})})]})]})}function n7({agent:e,allAgents:t,selected:s,onClick:r}){const{name:i,qualifier:l}=$C(e,t),c=ws(e.state),f=mo();return d.jsxs("div",{className:`s-agent-list-row s-agent-roster-row${s?" s-agent-list-row-active":""}`,onClick:r,onContextMenu:p=>{const h=[{kind:"action",label:"Copy Agent Name",onSelect:()=>navigator.clipboard.writeText(i)},{kind:"action",label:"Copy Agent ID",onSelect:()=>navigator.clipboard.writeText(e.id)}];e.handle&&h.push({kind:"action",label:`Copy @${e.handle}`,onSelect:()=>navigator.clipboard.writeText(`@${e.handle}`)}),f(p,h)},children:[d.jsxs("div",{className:"s-agent-roster-avatar-wrap",children:[d.jsx("div",{className:"s-avatar s-avatar-sm",style:{background:Ts(e.name)},children:e.name[0].toUpperCase()}),d.jsx("span",{className:`s-agent-roster-avatar-status s-agent-roster-avatar-status-${c}`,style:{background:ec(e.state)}})]}),d.jsx("div",{className:"s-agent-list-body s-agent-roster-row-body",children:d.jsxs("div",{className:"s-agent-roster-row-top",children:[d.jsxs("div",{className:"s-agent-list-header",children:[d.jsx("span",{className:"s-agent-list-name",children:i}),l&&d.jsx("span",{className:"s-agent-list-qualifier",children:l})]}),d.jsx("span",{className:"s-agent-roster-row-time",children:GB(e.updatedAt)})]})})]})}function s7(e){switch(e){case"queued":case"working":return"working";case"needs_attention":return"updated";case"failed":return"failed";default:return"completed"}}function r7(e){return e.conversationId?{view:"conversation",conversationId:e.conversationId}:{view:"agents",agentId:e.agentId}}function a7(e){return e.kind==="work_item"&&e.recordId?{view:"work",workId:e.recordId}:e.conversationId?{view:"conversation",conversationId:e.conversationId}:e.agentId?{view:"agents",agentId:e.agentId}:null}function i7(e){return e.recordId?{view:"work",workId:e.recordId}:e.conversationId?{view:"conversation",conversationId:e.conversationId}:e.agentId?{view:"agents",agentId:e.agentId}:null}function Lu({title:e,detail:t,count:s}){return d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"s-dashboard-panel-header",children:[d.jsx("div",{children:d.jsx("h3",{children:e})}),d.jsx("span",{className:"s-dashboard-count",style:s===0?{opacity:.4}:void 0,children:s})]}),d.jsx("p",{className:"s-dashboard-panel-copy",children:t})]})}function kS({ask:e,navigate:t,section:s}){const r=r7(e),i=e.completedAt?`finished ${tt(e.completedAt)}`:e.startedAt?`started ${tt(e.startedAt)}`:`updated ${tt(e.updatedAt)}`;return d.jsxs("div",{className:`s-work-row s-work-row-clickable s-dashboard-fleet-row s-dashboard-fleet-row-${s}`,"data-status":e.status,onClick:()=>t(r),children:[d.jsxs("div",{className:"s-work-row-header",children:[d.jsxs("div",{className:"s-fleet-row-title-wrap",children:[d.jsx("div",{className:"s-avatar s-avatar-sm",style:{background:Ts(e.agentName??e.agentId)},children:(e.agentName??e.agentId)[0]?.toUpperCase()??"?"}),d.jsxs("div",{className:"s-fleet-row-title-copy",children:[d.jsxs("div",{className:"s-work-row-title-wrap",children:[d.jsx("span",{className:"s-work-row-title",children:e.agentName??e.agentId}),e.harness&&d.jsx("span",{className:"s-badge",children:e.harness})]}),d.jsxs("div",{className:"s-work-row-meta",style:{marginTop:2},children:[d.jsx("span",{className:"s-dot",style:{background:ec(e.agentState)}}),d.jsx("span",{children:ao(e.agentState)}),d.jsx("span",{children:i})]})]})]}),d.jsx("span",{className:`s-pill s-pill-${s7(e.status)}`,children:e.statusLabel})]}),d.jsx("p",{className:"s-work-row-summary",children:Yn(e.task)}),e.summary&&d.jsx("p",{className:"s-work-row-summary",style:{marginTop:8},children:Yn(e.summary)})]})}function o7({item:e,navigate:t}){const s=a7(e),r=e.kind==="question"?"question":e.state.replace(/_/g," "),i=e.acceptanceState!=="none"?e.acceptanceState.replace(/_/g," "):e.kind==="question"?"awaiting answer":"your move";return d.jsxs("div",{className:`s-work-row s-dashboard-fleet-row s-dashboard-fleet-attention-row${s?" s-work-row-clickable":""}`,onClick:s?()=>t(s):void 0,children:[d.jsxs("div",{className:"s-work-row-header",children:[d.jsx("div",{className:"s-work-row-title-wrap",children:d.jsx("span",{className:"s-work-row-title",children:e.title})}),d.jsx("span",{className:"s-pill s-pill-updated",children:"Needs your input"})]}),d.jsxs("div",{className:"s-work-row-meta",children:[d.jsx("span",{children:e.kind==="question"?"question":"work item"}),e.agentName&&d.jsx("span",{children:e.agentName}),d.jsx("span",{children:r}),d.jsx("span",{children:i}),d.jsx("span",{children:tt(e.updatedAt)})]}),e.summary&&d.jsx("p",{className:"s-work-row-summary",children:Yn(e.summary)})]})}function l7({item:e,navigate:t}){const s=i7(e);return d.jsxs("div",{className:`s-dashboard-activity-row${s?" s-dashboard-activity-row-clickable":""}`,onClick:s?()=>t(s):void 0,children:[d.jsx("div",{className:"s-avatar s-avatar-sm",style:{background:Ts(e.actorName??e.agentId??"system")},children:(e.actorName??e.agentId??"S")[0]?.toUpperCase()??"S"}),d.jsxs("div",{className:"s-dashboard-activity-body",children:[d.jsxs("div",{className:"s-dashboard-activity-header",children:[d.jsx("span",{className:"s-dashboard-activity-actor",children:e.actorName??"system"}),d.jsx("span",{className:"s-dashboard-activity-kind",children:oB(e.kind)}),d.jsx("span",{className:"s-time",children:tt(e.ts)})]}),(e.title||e.summary)&&d.jsx("p",{className:"s-dashboard-activity-summary",children:Yn(e.title??e.summary??"")}),e.title&&e.summary&&d.jsx("p",{className:"s-dashboard-activity-note",children:Yn(e.summary)})]})]})}function c7({navigate:e}){const[t,s]=b.useState(null),r=b.useCallback(async()=>{try{s(await it("/api/fleet"))}catch{s(null)}},[]);b.useEffect(()=>{r()},[r]),Kn(r);const i=t?.activeAsks??[],l=t?.recentCompleted??[],c=t?.needsAttention??[],f=t?.activity??[],p=c.length>0?`${c.length} item${c.length===1?" is":"s are"} waiting on you. Clear ${c.length===1?"it":"those"} first, then monitor the rest of the queue.`:i.length>0?`${i.length} ask${i.length===1?" is":"s are"} currently in flight. The queue is clear of interruptions.`:l.length>0?"Nothing is actively running right now. Recent finishes are ready for review.":"No asks have moved through the fleet yet. Start work and this becomes the operations board.";return d.jsxs("div",{className:"s-home s-dashboard-screen s-dashboard-fleet",children:[d.jsx("div",{className:"s-dashboard-hero s-dashboard-hero-fleet",children:d.jsxs("div",{className:"s-dashboard-hero-copy",children:[d.jsxs("div",{className:"s-dashboard-hero-head",children:[d.jsx("h2",{children:"Fleet"}),t&&d.jsxs("span",{className:"s-time",children:["Updated ",tt(t.generatedAt)]})]}),d.jsx("p",{children:p}),d.jsxs("div",{className:"s-dashboard-summary-grid",children:[d.jsxs("div",{className:`s-dashboard-summary-card${(t?.totals.needsAttention??0)>0?" s-dashboard-summary-card-attention":""}`,children:[d.jsx("div",{className:"s-dashboard-summary-label",children:"Needs input"}),d.jsx("div",{className:"s-dashboard-summary-value",children:t?.totals.needsAttention??0}),d.jsx("div",{className:"s-dashboard-summary-meta",children:"Questions, reviews, or decisions waiting on you"})]}),d.jsxs("div",{className:"s-dashboard-summary-card",children:[d.jsx("div",{className:"s-dashboard-summary-label",children:"Active asks"}),d.jsx("div",{className:"s-dashboard-summary-value",children:t?.totals.active??0}),d.jsx("div",{className:"s-dashboard-summary-meta",children:"Currently in flight across the fleet"})]}),d.jsxs("div",{className:`s-dashboard-summary-card${(t?.totals.recentCompleted??0)>0?" s-dashboard-summary-card-finished":""}`,children:[d.jsx("div",{className:"s-dashboard-summary-label",children:"Finished"}),d.jsx("div",{className:"s-dashboard-summary-value",children:t?.totals.recentCompleted??0}),d.jsx("div",{className:"s-dashboard-summary-meta",children:"Recent completions and failures to review"})]}),d.jsxs("div",{className:"s-dashboard-summary-card",children:[d.jsx("div",{className:"s-dashboard-summary-label",children:"Activity"}),d.jsx("div",{className:"s-dashboard-summary-value",children:t?.totals.activity??0}),d.jsx("div",{className:"s-dashboard-summary-meta",children:"Recent events across the fleet"})]})]})]})}),d.jsxs("div",{className:"s-dashboard-fleet-stack",children:[d.jsxs("section",{className:`s-dashboard-panel${c.length>0?" s-dashboard-panel-attention":""}`,children:[d.jsx(Lu,{title:"Needs your input",detail:"Handle interruptions, pending answers, and review requests first.",count:c.length}),c.length===0?d.jsxs("div",{className:"s-empty",children:[d.jsx("p",{children:"Nothing is waiting on you"}),d.jsx("p",{children:"When agents ask a question or a work item needs review, it will land here first."})]}):d.jsx("div",{className:"s-work-list",children:c.map(h=>d.jsx(o7,{item:h,navigate:e},h.recordId))})]}),d.jsxs("div",{className:"s-dashboard-fleet-columns",children:[d.jsxs("section",{className:"s-dashboard-panel s-dashboard-panel-active",children:[d.jsx(Lu,{title:"Active asks",detail:"The asks still in flight across the fleet.",count:i.length}),i.length===0?d.jsxs("div",{className:"s-empty",children:[d.jsx("p",{children:"No active asks"}),d.jsx("p",{children:"New agent work will appear here while it is still in progress."})]}):d.jsx("div",{className:"s-work-list",children:i.map(h=>d.jsx(kS,{ask:h,navigate:e,section:"active"},h.invocationId))})]}),d.jsxs("section",{className:"s-dashboard-panel s-dashboard-panel-finished",children:[d.jsx(Lu,{title:"Recent finishes",detail:"Review completions and failures once the active queue is stable.",count:l.length}),l.length===0?d.jsxs("div",{className:"s-empty",children:[d.jsx("p",{children:"No recent finishes"}),d.jsx("p",{children:"Completed asks and failures will show up here once they settle."})]}):d.jsx("div",{className:"s-work-list",children:l.map(h=>d.jsx(kS,{ask:h,navigate:e,section:"finished"},h.invocationId))})]})]}),d.jsxs("section",{className:"s-dashboard-panel s-dashboard-panel-activity",children:[d.jsx(Lu,{title:"Recent activity",detail:"The broader event stream behind the queue.",count:f.length}),f.length===0?d.jsxs("div",{className:"s-empty",children:[d.jsx("p",{children:"No recent fleet activity"}),d.jsx("p",{children:"Messages, asks, and other agent activity will stream here."})]}):d.jsx("div",{className:"s-dashboard-activity-feed",children:f.slice(0,20).map(h=>d.jsx(l7,{item:h,navigate:e},h.id))})]})]})]})}function u7(){const e=window.getSelection();return e!==null&&e.toString().trim().length>0}function VC(e){u7()||e()}const d7={"agent.registered":"registered","agent.online":"came online","agent.offline":"went offline","flight.started":"started task","flight.completed":"completed task","message.sent":"sent message","message.received":"received message","collaboration.ask":"asked a question","collaboration.answer":"answered"};function f7(e){return d7[e]??e.replace(/[._]/g," ")}function h7({item:e,navigate:t}){const s=e.conversationId?{view:"conversation",conversationId:e.conversationId}:null,r=mo(),i=b.useCallback(l=>{const c=e.title??e.summary??"",f=window.getSelection()?.toString().trim(),p=[];f&&(p.push({kind:"action",label:"Copy Selection",shortcut:"⌘C",onSelect:()=>navigator.clipboard.writeText(f)}),p.push({kind:"separator"})),c&&p.push({kind:"action",label:"Copy Details",onSelect:()=>navigator.clipboard.writeText(c)}),e.actorName&&p.push({kind:"action",label:"Copy Actor Name",onSelect:()=>navigator.clipboard.writeText(e.actorName)}),s&&(p.push({kind:"separator"}),p.push({kind:"action",label:"Open Conversation",onSelect:()=>t(s)})),p.length>0&&r(l,p)},[e,s,t,r]);return d.jsxs("div",{className:`s-dashboard-activity-row${s?" s-dashboard-activity-row-clickable":""}`,onClick:s?()=>VC(()=>t(s)):void 0,onContextMenu:i,children:[d.jsx("div",{className:"s-dashboard-activity-time",children:tt(e.ts)}),d.jsxs("div",{className:"s-dashboard-activity-body",children:[d.jsxs("div",{className:"s-dashboard-activity-header",children:[d.jsx("span",{className:"s-dashboard-activity-actor",children:e.actorName??"system"}),d.jsx("span",{className:"s-dashboard-activity-kind",children:f7(e.kind)})]}),(e.title||e.summary)&&d.jsx("p",{className:"s-dashboard-activity-summary",children:Yn(e.title??e.summary??"")})]})]})}function p7({navigate:e}){const[t,s]=b.useState([]),r=b.useCallback(async()=>{try{const l=await it("/api/activity");s(l)}catch{}},[]);b.useEffect(()=>{r()},[r]),Kn(r);const i=t.slice(0,20);return d.jsx("div",{className:"s-home s-dashboard-screen",children:d.jsx("div",{className:"s-dashboard-body s-dashboard-body-solo",children:d.jsxs("main",{className:"s-dashboard-main",children:[d.jsxs("div",{className:"s-dashboard-section-head",children:[d.jsx("h3",{children:"Activity"}),t.length>0&&d.jsx("span",{className:"s-dashboard-count",children:t.length})]}),i.length===0?d.jsxs("div",{className:"s-empty",children:[d.jsx("p",{children:"No activity yet"}),d.jsx("p",{children:"Events appear here as agents connect and work."})]}):d.jsx("div",{className:"s-dashboard-activity-feed",children:i.map(l=>d.jsx(h7,{item:l,navigate:e},l.id))}),t.length>20&&d.jsx("button",{type:"button",className:"s-dashboard-see-all",onClick:()=>e({view:"activity"}),children:"See all activity"})]})})})}const m7=b.lazy(()=>_l(()=>import("./arc.es-CcKhIPRw.js"),[]).then(e=>({default:e.ArcDiagram})));function Ua(e){if(!e)return"";const t=e.replace(/^https?:\/\//,"").split("/")[0],[s]=t.split(":");return s.split(".")[0]}function g7(e){const t=e.hostName?.trim();if(t&&t.toLowerCase()!=="localhost")return Ua(t)||t;const s=e.dnsName?.trim().replace(/\.$/,"");return s?Ua(s)||s:Ua(e.name)||e.name}function ig(e){if(!e)return"";const t=e.replace(/^https?:\/\//,"").split("/")[0],[s]=t.split(":");return s.replace(/\.$/,"").toLowerCase()}function Zr(e){const t=ig(e);return t?t.split(".")[0]??t:""}function y7(e){return e.brokerUrl?Ua(e.brokerUrl):e.hostName?Ua(e.hostName):e.id.slice(0,10)}function v7(e,t){return Math.abs(e)>=Math.abs(t)?e>=0?["right","left"]:["left","right"]:t>=0?["bottom","top"]:["top","bottom"]}function b7(e,t){const s=Zr(t.hostName||t.name),r=Zr(e.localNode?.hostName||e.localNode?.name);return!!r&&s===r}function x7(e,t){const s=new Set([Zr(e.hostName),Zr(e.name),...e.addresses.map(i=>ig(i)),...e.addresses.map(i=>Zr(i))].filter(Boolean)),r=new Set([Zr(t.hostName),Zr(t.name),ig(t.brokerUrl),Zr(t.brokerUrl)].filter(Boolean));for(const i of s)if(r.has(i))return!0;return!1}function w7(e){if(!e.localNode)return null;const t=e.localNode.id,s=Object.values(e.nodes).filter(x=>x.id!==t),r=e.tailscale.peers.filter(x=>!b7(e,x)).filter(x=>!s.some(w=>x7(x,w))),i=[...s.map(x=>({kind:"mesh",peer:x})),...r.map(x=>({kind:"tailnet",peer:x}))],l=800,c=300,f=l/2,p=c/2,h={[t]:{x:f,y:p,size:"m"}},g={[t]:{icon:"Database",name:Ua(e.localNode.hostName)||e.localNode.name||"broker",subtitle:"this node",color:"violet"}},v=[];if(i.length===0)h.__placeholder={x:f+220,y:p,size:"m"},g.__placeholder={icon:"CircleDashed",name:"No peers yet",subtitle:"awaiting discovery",color:"zinc"},v.push({from:t,to:"__placeholder",fromAnchor:"right",toAnchor:"left",style:"pending"});else{const x=i.length,w=Math.min(170,100+x*10);i.forEach(({kind:T,peer:N},A)=>{const C=A/x*Math.PI*2-Math.PI/2,j=Math.round(f+w*Math.cos(C)),S=Math.round(p+w*Math.sin(C)),_=T==="mesh"?N.id:`tailnet:${N.id}`,R=T==="mesh"?Ua(N.hostName)||N.name||"peer":g7(N)||"tailnet",M=T==="mesh"?y7(N):N.online?N.addresses[0]??"tailnet only":"tailnet offline";h[_]={x:j,y:S,size:T==="mesh"?"m":"s"},g[_]={icon:T==="mesh"?"Database":"CircleDashed",name:R,subtitle:M,color:T==="mesh"?N.advertiseScope==="mesh"?"emerald":"zinc":N.online?"sky":"zinc"};const[O,I]=v7(j-f,S-p);v.push({from:t,to:_,fromAnchor:O,toAnchor:I,style:T==="mesh"?N.advertiseScope==="mesh"?"mesh":"local":N.online?"tailnet":"tailnet-offline"})})}return{layout:{width:l,height:c},nodes:h,nodeData:g,connectors:v,connectorStyles:{mesh:{color:"emerald",strokeWidth:2,label:"mesh"},local:{color:"zinc",strokeWidth:1.5},tailnet:{color:"sky",strokeWidth:1.5,dashed:!0,label:"tailnet"},"tailnet-offline":{color:"zinc",strokeWidth:1.25,dashed:!0,label:"tailnet"},pending:{color:"zinc",strokeWidth:1.5,dashed:!0}}}}function S7({mesh:e}){const t=b.useMemo(()=>w7(e),[e]);return t?d.jsx("div",{className:"s-mesh-topology",children:d.jsx(b.Suspense,{fallback:d.jsx("div",{className:"s-mesh-topology-fallback"}),children:d.jsx(m7,{data:t,className:"s-mesh-topology-canvas",mode:"light",theme:"cool",interactive:!0,showArcToggle:!1,defaultZoom:"fit",maxFitZoom:.95,hoverEffects:{dim:!0,lift:!0,glow:!0,highlightEdges:!0}})})}):null}function E7(e){return e.code==="local_only"?"notice":e.severity==="error"?"error":"warning"}function N7(e){switch(e.code){case"local_only":return"Not discoverable";case"mesh_loopback":return"Wrong address";case"discovery_unconfigured":return"No path";default:return"Offline"}}function T7(e){return e?e.replace(/^https?:\/\//,"").split("/")[0]??e:"Unavailable"}function j7(e){const t=e.hostName?.trim();if(t&&t.toLowerCase()!=="localhost")return t;const s=e.dnsName?.trim().replace(/\.$/,"");return s?s.split(".")[0]??s:e.name}function C7(e){return e==="mesh"?"Announced to mesh":e==="local"?"Local only":e||"Not advertised"}function R7(e){return e.identity.discoverable?"success":e.health.reachable?"warning":"danger"}function A7(e){return e.identity.discoverable?"Discoverable":e.health.reachable?"Not discoverable":"Broker offline"}function _7(e){return!e.health.reachable||e.issues.some(t=>t.severity==="error")?"danger":e.issues.length>0?"warning":"success"}function k7(e){return e.health.reachable?e.issues.some(t=>t.severity==="error")?"Degraded":e.issues.length>0?"Needs attention":"Healthy":"Broker unreachable"}function M7({issue:e}){const t=E7(e);return d.jsxs("article",{className:`sys-issue-card sys-issue-card-${t}`,children:[d.jsxs("div",{className:"sys-issue-head",children:[d.jsx("h3",{className:"sys-issue-title",children:e.title}),d.jsx("span",{className:`sys-chip sys-chip-${t==="error"?"failed":t}`,children:N7(e)})]}),d.jsx("p",{className:"sys-issue-body",children:e.summary}),(e.action||e.actionCommand)&&d.jsxs("div",{className:"sys-issue-action",children:[e.actionCommand&&d.jsx("code",{className:"sys-code-inline",children:e.actionCommand}),e.action&&d.jsx("span",{children:e.action})]})]})}function O7({navigate:e}){const[t,s]=b.useState(null),[r,i]=b.useState(!0),[l,c]=b.useState(!1),[f,p]=b.useState(!1),[h,g]=b.useState(null),[v,x]=b.useState(null),[w,T]=b.useState(null),N=b.useRef(null),A=b.useRef(0);b.useEffect(()=>{N.current=t},[t]);const C=b.useCallback(async(L="initial")=>{const Y=++A.current;!(N.current!==null)&&L!=="background"?(i(!0),x(null)):c(!0);try{const ee=await it("/api/mesh");if(Y!==A.current)return;s(ee),x(null),T(Date.now())}catch(ee){if(Y!==A.current)return;x(ee instanceof Error?ee.message:String(ee))}finally{Y===A.current&&(i(!1),c(!1))}},[]);b.useEffect(()=>{C("initial")},[C]),b.useEffect(()=>{const L=setInterval(()=>{C("background")},1e4);return()=>clearInterval(L)},[C]);const j=b.useCallback(async()=>{p(!0),g(null);try{const L=await it("/api/mesh/announce",{method:"POST",body:"{}"});s(L),N.current=L,x(null),T(Date.now()),g({tone:L.identity.discoverable?"success":"warning",title:L.identity.discoverable?"Mesh updated.":"Mesh updated, but still needs attention.",message:L.identity.discoverable?"This broker is now announced to the mesh.":"Mesh visibility was updated, but this broker still is not peer-reachable."})}catch(L){g({tone:"warning",title:"Could not announce broker.",message:L instanceof Error?L.message:String(L)})}finally{p(!1)}},[]),S=t?_7(t):"warning",_=t?k7(t):"Loading",R=t?Object.values(t.nodes):[],M=t?.localNode?.id,O=t?.localNode?.hostName?.toLowerCase(),I=R.filter(L=>L.id!==M),H=(t?.tailscale.peers??[]).filter(L=>{const Y=L.hostName?.toLowerCase();return!Y||Y==="localhost"?!0:!(O&&(Y===O||Y.startsWith(`${O.split(".")[0]}.`)))}),F=t?t.issues.length>0?t.issues:t.warnings.map((L,Y)=>({code:`fallback-${Y}`,severity:"warning",title:"Mesh notice",summary:L,action:null,actionCommand:null})):[],$=b.useMemo(()=>t?[{label:"Broker",value:t.health.reachable?"Reachable":"Unavailable",detail:t.health.error??T7(t.brokerUrl)},{label:"Discoverable",value:t.identity.discoverable?"Yes":"No",detail:t.identity.modeLabel},{label:"Mesh peers",value:`${I.length}`,detail:I.length>0?"Remote brokers in this mesh":"No remote brokers discovered"},{label:"Tailnet",value:t.tailscale.available?`${H.filter(L=>L.online).length}/${H.length}`:"Unavailable",detail:t.tailscale.available?"Online peers / visible peers":"Tailscale peers not detected"}]:[],[H,t,I.length]);return d.jsxs("div",{className:"sys-surface-page",children:[d.jsxs("div",{className:"sys-page-head",children:[d.jsxs("div",{className:"sys-page-title-group",children:[d.jsx("h2",{className:"sys-page-title",children:"Mesh"}),d.jsx("p",{className:"sys-page-subtitle",children:"Who this broker is, whether peers can discover it, and what the current mesh can see."})]}),d.jsxs("div",{className:"sys-page-actions",children:[d.jsx("span",{className:`sys-chip sys-chip-${S}`,children:_}),d.jsx("div",{className:"sys-sync-note",children:r?"Loading system snapshot...":v&&t?`Showing last confirmed snapshot from ${w?tt(w):"earlier"}`:w?`Confirmed ${tt(w)}`:"Waiting for first snapshot"}),d.jsx("button",{type:"button",className:"s-btn",disabled:r||l,onClick:()=>{C("manual")},children:l?"Refreshing...":"Refresh"})]})]}),v&&t&&d.jsxs("div",{className:"sys-banner sys-banner-warning",children:[d.jsx("strong",{children:"Mesh refresh failed."}),d.jsx("span",{children:v})]}),r&&!t&&d.jsxs("div",{className:"sys-panel sys-state-card",children:[d.jsx("h3",{className:"sys-state-title",children:"Loading mesh status"}),d.jsx("p",{className:"sys-state-body",children:"Inspecting broker reachability and peer discovery inputs."})]}),!r&&!t&&v&&d.jsxs("div",{className:"sys-panel sys-state-card sys-state-card-error",children:[d.jsx("h3",{className:"sys-state-title",children:"Mesh status is unavailable"}),d.jsx("p",{className:"sys-state-body",children:v}),d.jsx("div",{className:"sys-inline-actions",children:d.jsx("button",{type:"button",className:"s-btn",onClick:()=>{C("manual")},children:"Try again"})})]}),t&&d.jsxs(d.Fragment,{children:[d.jsxs("section",{className:"sys-panel sys-mesh-identity",children:[d.jsxs("div",{className:"sys-section-head",children:[d.jsxs("div",{children:[d.jsx("h3",{className:"sys-section-title",children:"This broker"}),d.jsx("p",{className:"sys-section-subtitle",children:"The identity peers will learn if they discover this machine."})]}),d.jsx("span",{className:`sys-chip sys-chip-${R7(t)}`,children:A7(t)})]}),d.jsxs("div",{className:"sys-detail-grid",children:[d.jsxs("div",{className:"sys-detail-card",children:[d.jsx("span",{className:"sys-detail-label",children:"Who Am I"}),d.jsx("span",{className:"sys-detail-value",children:t.identity.name??t.localNode?.name??"Unavailable"})]}),d.jsxs("div",{className:"sys-detail-card",children:[d.jsx("span",{className:"sys-detail-label",children:"Node ID"}),d.jsx("code",{className:"sys-detail-value",children:t.identity.nodeId??"Unavailable"})]}),d.jsxs("div",{className:"sys-detail-card",children:[d.jsx("span",{className:"sys-detail-label",children:"Mesh"}),d.jsx("code",{className:"sys-detail-value",children:t.identity.meshId??"Unassigned"})]}),d.jsxs("div",{className:"sys-detail-card",children:[d.jsx("span",{className:"sys-detail-label",children:"Mode"}),d.jsx("span",{className:"sys-detail-value",children:t.identity.modeLabel})]}),d.jsxs("div",{className:"sys-detail-card",children:[d.jsx("span",{className:"sys-detail-label",children:"Discoverable"}),d.jsx("span",{className:"sys-detail-value",children:t.identity.discoverable?"Yes":"No"})]}),d.jsxs("div",{className:"sys-detail-card",children:[d.jsx("span",{className:"sys-detail-label",children:"Announced As"}),d.jsx("code",{className:"sys-detail-value",children:t.identity.announceUrl??"Not announced"})]})]}),d.jsxs("div",{className:`sys-banner ${t.identity.discoverable?"sys-banner-success":"sys-banner-muted"}`,children:[d.jsx("strong",{children:"How peers find you."}),d.jsx("span",{children:t.identity.discoveryDetail})]}),!t.identity.discoverable&&t.health.reachable&&d.jsx("div",{className:"sys-inline-actions",children:d.jsx("button",{type:"button",className:"s-btn",disabled:f,onClick:()=>{j()},children:f?"Announcing...":"Announce on mesh"})}),h&&d.jsxs("div",{className:`sys-banner ${h.tone==="success"?"sys-banner-success":"sys-banner-warning"}`,children:[d.jsx("strong",{children:h.title}),d.jsx("span",{children:h.message})]})]}),d.jsx("div",{className:"sys-stat-grid",children:$.map(L=>d.jsxs("div",{className:"sys-stat-card",children:[d.jsx("span",{className:"sys-stat-label",children:L.label}),d.jsx("strong",{className:"sys-stat-value",children:L.value}),d.jsx("span",{className:"sys-stat-detail",children:L.detail})]},L.label))}),d.jsxs("section",{className:"sys-panel",children:[d.jsx("div",{className:"sys-section-head",children:d.jsxs("div",{children:[d.jsx("h3",{className:"sys-section-title",children:"Health notices"}),d.jsx("p",{className:"sys-section-subtitle",children:"Warnings and errors from the current broker and discovery snapshot."})]})}),F.length>0?d.jsx("div",{className:"sys-issue-grid",children:F.map((L,Y)=>d.jsx(M7,{issue:L},`${L.code}-${Y}`))}):d.jsxs("div",{className:"sys-list-empty",children:[d.jsx("h3",{children:"No active mesh warnings"}),d.jsx("p",{children:"The broker is reachable and discovery inputs look healthy from this page."})]})]}),d.jsxs("section",{className:"sys-panel",children:[d.jsx("div",{className:"sys-section-head",children:d.jsxs("div",{children:[d.jsx("h3",{className:"sys-section-title",children:"Topology"}),d.jsx("p",{className:"sys-section-subtitle",children:"Current broker relationships plus visible tailnet peers from this machine."})]})}),t.localNode?d.jsx(S7,{mesh:t}):d.jsxs("div",{className:"sys-list-empty",children:[d.jsx("h3",{children:"Topology unavailable"}),d.jsx("p",{children:"A local node record is required before the topology view can render."})]})]}),d.jsxs("section",{className:"sys-panel",children:[d.jsx("div",{className:"sys-section-head",children:d.jsxs("div",{children:[d.jsx("h3",{className:"sys-section-title",children:"Discovered peers"}),d.jsxs("p",{className:"sys-section-subtitle",children:["Remote brokers registered in ",t.meshId??"this mesh","."]})]})}),I.length===0?d.jsxs("div",{className:"sys-list-empty",children:[d.jsx("h3",{children:"No remote brokers discovered"}),d.jsx("p",{children:"This can be normal on a single-node setup. If you expect peers, check the health notices above."})]}):d.jsx("div",{className:"sys-list-grid",children:I.map(L=>d.jsxs("article",{className:"sys-list-card",children:[d.jsxs("div",{className:"sys-list-card-head",children:[d.jsx("h3",{className:"sys-list-card-title",children:L.name}),d.jsx("span",{className:`sys-chip sys-chip-${L.advertiseScope==="mesh"?"success":"neutral"}`,children:C7(L.advertiseScope)})]}),d.jsxs("div",{className:"sys-list-card-detail",children:[d.jsx("span",{className:"sys-detail-label",children:"Node id"}),d.jsx("code",{className:"sys-detail-value",children:L.id})]}),L.brokerUrl&&d.jsxs("div",{className:"sys-list-card-detail",children:[d.jsx("span",{className:"sys-detail-label",children:"Broker"}),d.jsx("code",{className:"sys-detail-value",children:L.brokerUrl})]}),d.jsxs("div",{className:"sys-list-card-detail",children:[d.jsx("span",{className:"sys-detail-label",children:"Last seen"}),d.jsx("span",{className:"sys-detail-value",children:L.lastSeenAt?tt(L.lastSeenAt):"Recently registered"})]})]},L.id))})]}),d.jsxs("section",{className:"sys-panel",children:[d.jsx("div",{className:"sys-section-head",children:d.jsxs("div",{children:[d.jsx("h3",{className:"sys-section-title",children:"Tailnet"}),d.jsx("p",{className:"sys-section-subtitle",children:"External Tailscale peers visible from this machine."})]})}),H.length===0?d.jsxs("div",{className:"sys-list-empty",children:[d.jsx("h3",{children:"No external tailnet peers"}),d.jsx("p",{children:t.tailscale.available?"Only this host is visible in the current tailnet snapshot.":"Tailscale peers were not detected on this machine."})]}):d.jsx("div",{className:"sys-list-grid",children:H.map(L=>d.jsxs("article",{className:"sys-list-card",children:[d.jsxs("div",{className:"sys-list-card-head",children:[d.jsx("h3",{className:"sys-list-card-title",children:j7(L)}),d.jsx("span",{className:`sys-chip sys-chip-${L.online?"success":"failed"}`,children:L.online?"Online":"Offline"})]}),d.jsxs("div",{className:"sys-list-card-detail",children:[d.jsx("span",{className:"sys-detail-label",children:"Address"}),d.jsx("code",{className:"sys-detail-value",children:L.addresses?.[0]??"Unavailable"})]}),d.jsxs("div",{className:"sys-list-card-detail",children:[d.jsx("span",{className:"sys-detail-label",children:"Platform"}),d.jsx("span",{className:"sys-detail-value",children:L.os??"Unknown"})]})]},L.id))})]})]})]})}const D7=[[/```[\s\S]*?```/g," "],[/`([^`]+)`/g,"$1"],[/!\[([^\]]*)\]\([^)]+\)/g,"$1"],[/\[([^\]]+)\]\([^)]+\)/g,"$1"],[/\*\*(.+?)\*\*/g,"$1"],[/__(.+?)__/g,"$1"],[new RegExp("(?<!\\*)\\*(?!\\*)([^*\\n]+)\\*(?!\\*)","g"),"$1"],[new RegExp("(?<!_)_(?!_)([^_\\n]+)_(?!_)","g"),"$1"],[/~~(.+?)~~/g,"$1"],[/^#{1,6}\s+/gm,""],[/^>\s?/gm,""],[/^[-*+]\s+/gm,""],[/^\d+\.\s+/gm,""],[/^---+\s*$/gm,""],[/^\s*\|.*\|\s*$/gm,""]];function z7(e,t=140){if(!e)return"";let s=e;for(const[r,i]of D7)s=s.replace(r,i);return s=s.replace(/\s+/g," ").trim(),s.length>t&&(s=`${s.slice(0,t-1)}…`),s}const BC="scout:sessions:lastViewed";function ZC(){if(typeof localStorage>"u")return{};try{const e=localStorage.getItem(BC);if(!e)return{};const t=JSON.parse(e);return t&&typeof t=="object"?t:{}}catch{return{}}}function I7(e,t=Date.now()){const s=ZC();s[e]=t;try{localStorage.setItem(BC,JSON.stringify(s))}catch{}return s}function sm(e,t,s){return e?e>(s[t]??0):!1}const MS={direct:"DM",channel:"Channel",group_direct:"Group",thread:"Thread"},L7=new Set(["all","direct","channel","group_direct","thread"]);function og(e){return typeof window>"u"?"":new URLSearchParams(window.location.search).get(e)??""}function P7(e){if(typeof window>"u")return;const t=new URLSearchParams(window.location.search);for(const[r,i]of Object.entries(e))i===null||i===""?t.delete(r):t.set(r,i);const s=t.toString();window.history.replaceState(null,"",window.location.pathname+(s?`?${s}`:""))}function U7(){const e=og("view");return L7.has(e)?e:"all"}function $7(e){return e.kind==="direct"&&e.agentName?e.agentName:e.title.replace(/\s*<>\s*/g," · ")}function V7(e){if(!e)return null;const t=e.replace(/[\\/]+$/,"");return t?t.split(/[\\/]/).filter(Boolean).at(-1)??t:null}function B7(e){if(typeof e!="number"||!Number.isFinite(e)||e<=0)return"";const t=e<1e12?e*1e3:e;return new Intl.DateTimeFormat(void 0,{dateStyle:"medium",timeStyle:"short"}).format(t)}function Z7({navigate:e}){const[t,s]=b.useState([]),[r,i]=b.useState(()=>U7()),[l,c]=b.useState(()=>og("q")),[f,p]=b.useState(()=>og("unread")==="1"),[h,g]=b.useState(()=>ZC()),[v,x]=b.useState(0),[w,T]=b.useState(null),N=b.useRef(null),A=b.useRef(null),C=mo(),j=b.useCallback(async()=>{T(null);try{const $=await it("/api/sessions");s($.sort((L,Y)=>(Y.lastMessageAt??0)-(L.lastMessageAt??0)))}catch($){T($ instanceof Error?$.message:String($))}},[]);b.useEffect(()=>{j()},[j]),Kn(j);const[,S]=b.useState(0);b.useEffect(()=>{const $=setInterval(()=>S(L=>L+1),15e3);return()=>clearInterval($)},[]),b.useEffect(()=>{P7({view:r==="all"?null:r,q:l.trim()||null,unread:f?"1":null})},[r,l,f]);const _=b.useMemo(()=>Array.from(new Set(t.map($=>$.kind))),[t]),R=b.useMemo(()=>{const $={all:t.length};for(const L of t)$[L.kind]=($[L.kind]??0)+1;return $},[t]),M=b.useMemo(()=>t.filter($=>sm($.lastMessageAt,$.id,h)).length,[t,h]),O=b.useMemo(()=>{const $=l.trim().toLowerCase();return t.filter(L=>!(r!=="all"&&L.kind!==r||f&&!sm(L.lastMessageAt,L.id,h)||$&&![L.title,L.preview,L.agentName??"",L.harness??"",...L.participantIds].join(" ").toLowerCase().includes($)))},[t,r,f,h,l]);b.useEffect(()=>{v>=O.length&&x(Math.max(0,O.length-1))},[O.length,v]);const I=b.useCallback($=>{g(I7($.id)),e({view:"conversation",conversationId:$.id})},[e]);b.useEffect(()=>{function $(L){const Y=L.target,ie=Y instanceof HTMLInputElement||Y instanceof HTMLTextAreaElement||Y instanceof HTMLElement&&Y.isContentEditable;if((L.metaKey||L.ctrlKey)&&L.key.toLowerCase()==="k"){L.preventDefault(),N.current?.focus(),N.current?.select();return}if(ie){L.key==="Escape"&&Y===N.current&&N.current?.blur();return}if(L.key==="/"){L.preventDefault(),N.current?.focus();return}if(L.key==="j"||L.key==="ArrowDown"){L.preventDefault(),x(ee=>Math.min(O.length-1,ee+1));return}if(L.key==="k"||L.key==="ArrowUp"){L.preventDefault(),x(ee=>Math.max(0,ee-1));return}if(L.key==="Enter"||L.key==="o"){const ee=O[v];ee&&(L.preventDefault(),I(ee))}}return window.addEventListener("keydown",$),()=>window.removeEventListener("keydown",$)},[O,v,I]),b.useEffect(()=>{A.current?.querySelector(`[data-idx="${v}"]`)?.scrollIntoView({block:"nearest"})},[v]);const H=_.length>1,F=f?M>0?`${M} unread threads need attention.`:"No unread threads right now.":O.length===t.length?"Recent activity across every conversation.":`${O.length} conversations match the current filters.`;return d.jsxs("div",{className:"s-sessions-screen s-inbox-thread-redesign",children:[d.jsx("section",{className:"s-thread-overview",children:d.jsxs("div",{className:"s-thread-overview-copy",children:[d.jsxs("div",{className:"s-sessions-header s-thread-overview-heading",children:[d.jsx("h2",{className:"s-page-title",children:"Sessions"}),d.jsxs("span",{className:"s-meta s-tabular",children:[O.length," of ",t.length]})]}),d.jsx("p",{className:"s-thread-overview-summary",children:F})]})}),d.jsxs("section",{className:"s-thread-panel s-thread-panel-list",children:[d.jsxs("div",{className:"s-sessions-toolbar",children:[H&&d.jsxs("div",{className:"s-seg",role:"tablist","aria-label":"Session kind",children:[d.jsx(OS,{label:"All",count:R.all,pressed:r==="all",onClick:()=>i("all")}),_.map($=>d.jsx(OS,{label:MS[$]??$,count:R[$]??0,pressed:r===$,onClick:()=>i($)},$))]}),d.jsxs("button",{type:"button",className:`s-seg-standalone${f?" is-on":""}`,onClick:()=>p($=>!$),"aria-pressed":f,title:"Show unread only",children:[d.jsx("span",{className:"s-dot s-dot-sm","aria-hidden":"true"}),d.jsx("span",{children:"Unread"}),M>0&&d.jsx("span",{className:"s-seg-count",children:M})]}),d.jsxs("div",{className:"s-search",children:[d.jsx("input",{ref:N,type:"text",className:"s-search-input",placeholder:"Search conversations…",value:l,onChange:$=>c($.target.value),onKeyDown:$=>{$.key==="Escape"&&(l?c(""):$.target.blur())}}),d.jsx("kbd",{className:"s-search-kbd",children:"⌘K"})]})]}),w&&d.jsx("p",{className:"s-error",children:w}),O.length===0?d.jsxs("div",{className:"s-empty s-thread-empty-state",children:[d.jsx("p",{children:l||f?"No matches":"No conversations"}),d.jsx("p",{children:l?"Try a different search term.":f?"You're all caught up.":"Conversations appear here when agents communicate."})]}):d.jsx("div",{className:"s-inbox",ref:A,role:"listbox","aria-label":"Sessions",children:O.map(($,L)=>{const Y=$7($),ie=($.agentName??Y)[0]?.toUpperCase()??"?",ee=sm($.lastMessageAt,$.id,h),z=L===v,Z=z7($.preview,160),B=MS[$.kind]??$.kind,re=V7($.workspaceRoot);return d.jsxs("div",{"data-idx":L,"data-unread":ee?"true":"false","data-selected":z?"true":"false",className:"s-inbox-row",role:"option","aria-selected":z,tabIndex:z?0:-1,onClick:()=>{VC(()=>{x(L),I($)})},onMouseEnter:()=>x(L),onContextMenu:J=>{const D=window.getSelection()?.toString().trim(),U=[];D&&(U.push({kind:"action",label:"Copy Selection",shortcut:"⌘C",onSelect:()=>navigator.clipboard.writeText(D)}),U.push({kind:"separator"})),U.push({kind:"action",label:"Open Conversation",onSelect:()=>I($)}),U.push({kind:"action",label:"Copy Title",onSelect:()=>navigator.clipboard.writeText(Y)}),$.id&&U.push({kind:"action",label:"Copy Conversation ID",onSelect:()=>navigator.clipboard.writeText($.id)}),C(J,U)},children:[d.jsxs("div",{className:"s-session-avatar-wrap",children:[d.jsx("div",{className:"s-avatar",style:{background:Ts($.agentName??Y)},"aria-hidden":"true",children:ie}),ee&&d.jsx("span",{className:"s-session-unread-dot","aria-hidden":"true"})]}),d.jsxs("div",{className:"s-inbox-body",children:[d.jsxs("div",{className:"s-inbox-header",children:[d.jsx("div",{className:"s-session-heading",children:d.jsx("span",{className:"s-inbox-name",title:Y,children:Y})}),d.jsx("div",{className:"s-session-trailing",children:$.lastMessageAt&&d.jsx("span",{className:"s-inbox-time s-tabular",title:B7($.lastMessageAt),children:tt($.lastMessageAt)})})]}),Z?d.jsx("p",{className:"s-inbox-preview",children:Z}):d.jsx("p",{className:"s-inbox-preview s-inbox-preview-empty",children:"No messages yet"}),d.jsxs("div",{className:"s-session-meta-row","aria-label":"Conversation details",children:[d.jsx("span",{className:"s-session-pill",children:B}),re&&d.jsx("span",{className:"s-session-pill",title:$.workspaceRoot??void 0,children:re}),$.currentBranch&&d.jsx("span",{className:"s-session-pill",title:$.currentBranch,children:$.currentBranch})]})]})]},$.id)})})]})]})}function OS({label:e,count:t,pressed:s,onClick:r}){return d.jsxs("button",{type:"button",className:"s-seg-btn","aria-pressed":s,onClick:r,children:[d.jsx("span",{children:e}),d.jsx("span",{className:"s-seg-count",children:t})]})}var Oa=(e=>(e[e.Border=-1]="Border",e[e.Data=0]="Data",e[e.Function=1]="Function",e[e.Position=2]="Position",e[e.Timing=3]="Timing",e[e.Alignment=4]="Alignment",e))(Oa||{});const H7=[0,1],HC=[1,0],FC=[2,3],qC=[3,2],F7={L:H7,M:HC,Q:FC,H:qC},q7=/^\d*$/,Y7=/^[A-Z0-9 $%*+./:-]*$/,rm="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:",vy=1,by=40,DS=3,G7=3,Pu=40,X7=10,YC=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],GC=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]];class K7{constructor(t,s,r,i){if(this.version=t,this.ecc=s,t<vy||t>by)throw new RangeError("Version value out of range");if(i<-1||i>7)throw new RangeError("Mask value out of range");this.size=t*4+17;const l=Array.from({length:this.size}).fill(!1);for(let f=0;f<this.size;f++)this.modules.push(l.slice()),this.types.push(l.map(()=>0));this.drawFunctionPatterns();const c=this.addEccAndInterleave(r);if(this.drawCodewords(c),i===-1){let f=1e9;for(let p=0;p<8;p++){this.applyMask(p),this.drawFormatBits(p);const h=this.getPenaltyScore();h<f&&(i=p,f=h),this.applyMask(p)}}this.mask=i,this.applyMask(i),this.drawFormatBits(i)}size;mask;modules=[];types=[];getModule(t,s){return t>=0&&t<this.size&&s>=0&&s<this.size&&this.modules[s][t]}drawFunctionPatterns(){for(let r=0;r<this.size;r++)this.setFunctionModule(6,r,r%2===0,Oa.Timing),this.setFunctionModule(r,6,r%2===0,Oa.Timing);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);const t=this.getAlignmentPatternPositions(),s=t.length;for(let r=0;r<s;r++)for(let i=0;i<s;i++)r===0&&i===0||r===0&&i===s-1||r===s-1&&i===0||this.drawAlignmentPattern(t[r],t[i]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(t){const s=this.ecc[1]<<3|t;let r=s;for(let l=0;l<10;l++)r=r<<1^(r>>>9)*1335;const i=(s<<10|r)^21522;for(let l=0;l<=5;l++)this.setFunctionModule(8,l,cr(i,l));this.setFunctionModule(8,7,cr(i,6)),this.setFunctionModule(8,8,cr(i,7)),this.setFunctionModule(7,8,cr(i,8));for(let l=9;l<15;l++)this.setFunctionModule(14-l,8,cr(i,l));for(let l=0;l<8;l++)this.setFunctionModule(this.size-1-l,8,cr(i,l));for(let l=8;l<15;l++)this.setFunctionModule(8,this.size-15+l,cr(i,l));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let t=this.version;for(let r=0;r<12;r++)t=t<<1^(t>>>11)*7973;const s=this.version<<12|t;for(let r=0;r<18;r++){const i=cr(s,r),l=this.size-11+r%3,c=Math.floor(r/3);this.setFunctionModule(l,c,i),this.setFunctionModule(c,l,i)}}drawFinderPattern(t,s){for(let r=-4;r<=4;r++)for(let i=-4;i<=4;i++){const l=Math.max(Math.abs(i),Math.abs(r)),c=t+i,f=s+r;c>=0&&c<this.size&&f>=0&&f<this.size&&this.setFunctionModule(c,f,l!==2&&l!==4,Oa.Position)}}drawAlignmentPattern(t,s){for(let r=-2;r<=2;r++)for(let i=-2;i<=2;i++)this.setFunctionModule(t+i,s+r,Math.max(Math.abs(i),Math.abs(r))!==1,Oa.Alignment)}setFunctionModule(t,s,r,i=Oa.Function){this.modules[s][t]=r,this.types[s][t]=i}addEccAndInterleave(t){const s=this.version,r=this.ecc;if(t.length!==nd(s,r))throw new RangeError("Invalid argument");const i=GC[r[0]][s],l=YC[r[0]][s],c=Math.floor(lg(s)/8),f=i-c%i,p=Math.floor(c/i),h=[],g=aZ(l);for(let x=0,w=0;x<i;x++){const T=t.slice(w,w+p-l+(x<f?0:1));w+=T.length;const N=iZ(T,g);x<f&&T.push(0),h.push(T.concat(N))}const v=[];for(let x=0;x<h[0].length;x++)h.forEach((w,T)=>{(x!==p-l||T>=f)&&v.push(w[x])});return v}drawCodewords(t){if(t.length!==Math.floor(lg(this.version)/8))throw new RangeError("Invalid argument");let s=0;for(let r=this.size-1;r>=1;r-=2){r===6&&(r=5);for(let i=0;i<this.size;i++)for(let l=0;l<2;l++){const c=r-l,p=(r+1&2)===0?this.size-1-i:i;!this.types[p][c]&&s<t.length*8&&(this.modules[p][c]=cr(t[s>>>3],7-(s&7)),s++)}}}applyMask(t){if(t<0||t>7)throw new RangeError("Mask value out of range");for(let s=0;s<this.size;s++)for(let r=0;r<this.size;r++){let i;switch(t){case 0:i=(r+s)%2===0;break;case 1:i=s%2===0;break;case 2:i=r%3===0;break;case 3:i=(r+s)%3===0;break;case 4:i=(Math.floor(r/3)+Math.floor(s/2))%2===0;break;case 5:i=r*s%2+r*s%3===0;break;case 6:i=(r*s%2+r*s%3)%2===0;break;case 7:i=((r+s)%2+r*s%3)%2===0;break;default:throw new Error("Unreachable")}!this.types[s][r]&&i&&(this.modules[s][r]=!this.modules[s][r])}}getPenaltyScore(){let t=0;for(let l=0;l<this.size;l++){let c=!1,f=0;const p=[0,0,0,0,0,0,0];for(let h=0;h<this.size;h++)this.modules[l][h]===c?(f++,f===5?t+=DS:f>5&&t++):(this.finderPenaltyAddHistory(f,p),c||(t+=this.finderPenaltyCountPatterns(p)*Pu),c=this.modules[l][h],f=1);t+=this.finderPenaltyTerminateAndCount(c,f,p)*Pu}for(let l=0;l<this.size;l++){let c=!1,f=0;const p=[0,0,0,0,0,0,0];for(let h=0;h<this.size;h++)this.modules[h][l]===c?(f++,f===5?t+=DS:f>5&&t++):(this.finderPenaltyAddHistory(f,p),c||(t+=this.finderPenaltyCountPatterns(p)*Pu),c=this.modules[h][l],f=1);t+=this.finderPenaltyTerminateAndCount(c,f,p)*Pu}for(let l=0;l<this.size-1;l++)for(let c=0;c<this.size-1;c++){const f=this.modules[l][c];f===this.modules[l][c+1]&&f===this.modules[l+1][c]&&f===this.modules[l+1][c+1]&&(t+=G7)}let s=0;for(const l of this.modules)s=l.reduce((c,f)=>c+(f?1:0),s);const r=this.size*this.size,i=Math.ceil(Math.abs(s*20-r*10)/r)-1;return t+=i*X7,t}getAlignmentPatternPositions(){if(this.version===1)return[];{const t=Math.floor(this.version/7)+2,s=this.version===32?26:Math.ceil((this.version*4+4)/(t*2-2))*2,r=[6];for(let i=this.size-7;r.length<t;i-=s)r.splice(1,0,i);return r}}finderPenaltyCountPatterns(t){const s=t[1],r=s>0&&t[2]===s&&t[3]===s*3&&t[4]===s&&t[5]===s;return(r&&t[0]>=s*4&&t[6]>=s?1:0)+(r&&t[6]>=s*4&&t[0]>=s?1:0)}finderPenaltyTerminateAndCount(t,s,r){return t&&(this.finderPenaltyAddHistory(s,r),s=0),s+=this.size,this.finderPenaltyAddHistory(s,r),this.finderPenaltyCountPatterns(r)}finderPenaltyAddHistory(t,s){s[0]===0&&(t+=this.size),s.pop(),s.unshift(t)}}function dr(e,t,s){if(t<0||t>31||e>>>t)throw new RangeError("Value out of range");for(let r=t-1;r>=0;r--)s.push(e>>>r&1)}function cr(e,t){return(e>>>t&1)!==0}class xy{constructor(t,s,r){if(this.mode=t,this.numChars=s,this.bitData=r,s<0)throw new RangeError("Invalid argument");this.bitData=r.slice()}getData(){return this.bitData.slice()}}const W7=[1,10,12,14],J7=[2,9,11,13],Q7=[4,8,16,16];function XC(e,t){return e[Math.floor((t+7)/17)+1]}function KC(e){const t=[];for(const s of e)dr(s,8,t);return new xy(Q7,e.length,t)}function eZ(e){if(!WC(e))throw new RangeError("String contains non-numeric characters");const t=[];for(let s=0;s<e.length;){const r=Math.min(e.length-s,3);dr(Number.parseInt(e.substring(s,s+r),10),r*3+1,t),s+=r}return new xy(W7,e.length,t)}function tZ(e){if(!JC(e))throw new RangeError("String contains unencodable characters in alphanumeric mode");const t=[];let s;for(s=0;s+2<=e.length;s+=2){let r=rm.indexOf(e.charAt(s))*45;r+=rm.indexOf(e.charAt(s+1)),dr(r,11,t)}return s<e.length&&dr(rm.indexOf(e.charAt(s)),6,t),new xy(J7,e.length,t)}function nZ(e){return e===""?[]:WC(e)?[eZ(e)]:JC(e)?[tZ(e)]:[KC(rZ(e))]}function WC(e){return q7.test(e)}function JC(e){return Y7.test(e)}function sZ(e,t){let s=0;for(const r of e){const i=XC(r.mode,t);if(r.numChars>=1<<i)return Number.POSITIVE_INFINITY;s+=4+i+r.bitData.length}return s}function rZ(e){e=encodeURI(e);const t=[];for(let s=0;s<e.length;s++)e.charAt(s)!=="%"?t.push(e.charCodeAt(s)):(t.push(Number.parseInt(e.substring(s+1,s+3),16)),s+=2);return t}function lg(e){if(e<vy||e>by)throw new RangeError("Version number out of range");let t=(16*e+128)*e+64;if(e>=2){const s=Math.floor(e/7)+2;t-=(25*s-10)*s-55,e>=7&&(t-=36)}return t}function nd(e,t){return Math.floor(lg(e)/8)-YC[t[0]][e]*GC[t[0]][e]}function aZ(e){if(e<1||e>255)throw new RangeError("Degree out of range");const t=[];for(let r=0;r<e-1;r++)t.push(0);t.push(1);let s=1;for(let r=0;r<e;r++){for(let i=0;i<t.length;i++)t[i]=cg(t[i],s),i+1<t.length&&(t[i]^=t[i+1]);s=cg(s,2)}return t}function iZ(e,t){const s=t.map(r=>0);for(const r of e){const i=r^s.shift();s.push(0),t.forEach((l,c)=>s[c]^=cg(l,i))}return s}function cg(e,t){if(e>>>8||t>>>8)throw new RangeError("Byte out of range");let s=0;for(let r=7;r>=0;r--)s=s<<1^(s>>>7)*285,s^=(t>>>r&1)*e;return s}function oZ(e,t,s=1,r=40,i=-1,l=!0){if(!(vy<=s&&s<=r&&r<=by)||i<-1||i>7)throw new RangeError("Invalid value");let c,f;for(c=s;;c++){const v=nd(c,t)*8,x=sZ(e,c);if(x<=v){f=x;break}if(c>=r)throw new RangeError("Data too long")}for(const v of[HC,FC,qC])l&&f<=nd(c,v)*8&&(t=v);const p=[];for(const v of e){dr(v.mode[0],4,p),dr(v.numChars,XC(v.mode,c),p);for(const x of v.getData())p.push(x)}const h=nd(c,t)*8;dr(0,Math.min(4,h-p.length),p),dr(0,(8-p.length%8)%8,p);for(let v=236;p.length<h;v^=253)dr(v,8,p);const g=Array.from({length:Math.ceil(p.length/8)},()=>0);return p.forEach((v,x)=>g[x>>>3]|=v<<7-(x&7)),new K7(c,t,g,i)}function lZ(e,t){const{ecc:s="L",boostEcc:r=!1,minVersion:i=1,maxVersion:l=40,maskPattern:c=-1,border:f=1}=t||{},p=typeof e=="string"?nZ(e):Array.isArray(e)?[KC(e)]:void 0;if(!p)throw new Error(`uqr only supports encoding string and binary data, but got: ${typeof e}`);const h=oZ(p,F7[s],i,l,c,r),g=cZ({version:h.version,maskPattern:h.mask,size:h.size,data:h.modules,types:h.types},f);return t?.invert&&(g.data=g.data.map(v=>v.map(x=>!x))),t?.onEncoded?.(g),g}function cZ(e,t=1){if(!t)return e;const{size:s}=e,r=s+t*2;e.size=r,e.data.forEach(l=>{for(let c=0;c<t;c++)l.unshift(!1),l.push(!1)});for(let l=0;l<t;l++)e.data.unshift(Array.from({length:r},c=>!1)),e.data.push(Array.from({length:r},c=>!1));const i=Oa.Border;e.types.forEach(l=>{for(let c=0;c<t;c++)l.unshift(i),l.push(i)});for(let l=0;l<t;l++)e.types.unshift(Array.from({length:r},c=>i)),e.types.push(Array.from({length:r},c=>i));return e}function zS(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function uZ(e,t={}){const s=lZ(e,t),{pixelSize:r=10,whiteColor:i="white",blackColor:l="black"}=t,c=s.size*r,f=s.size*r;let p=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${f} ${c}">`;const h=[];for(let g=0;g<s.size;g++)for(let v=0;v<s.size;v++){const x=v*r,w=g*r;s.data[g][v]&&h.push(`M${x},${w}h${r}v${r}h-${r}z`)}return p+=`<rect fill="${zS(i)}" width="${f}" height="${c}"/>`,p+=`<path fill="${zS(l)}" d="${h.join("")}"/>`,p+="</svg>",p}function dZ(e){return e?e.replace(/^wss?:\/\//,"").replace(/:\d+$/,""):null}function IS(e){return e?e.length<=18?e:`${e.slice(0,10)}...${e.slice(-6)}`:null}function fZ(e){return e?e.status==="paired"||e.status==="connected"?"success":e.status==="error"||e.status==="closed"?"danger":"warning":"warning"}function hZ(e,t){if(!e)return null;const s=Math.max(0,Math.floor((e-t)/1e3));if(s===0)return null;if(s<60)return`${s}s`;const r=Math.floor(s/60),i=s%60;return i>0?`${r}m ${i}s`:`${r}m`}function LS({value:e}){const[t,s]=b.useState(!1),r=b.useCallback(()=>{navigator.clipboard.writeText(e).then(()=>{s(!0),setTimeout(()=>s(!1),1500)})},[e]);return d.jsx("button",{type:"button",className:"sys-copy-btn",onClick:r,title:"Copy",children:t?d.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:d.jsx("polyline",{points:"20 6 9 17 4 12"})}):d.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[d.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),d.jsx("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]})})}function pZ({navigate:e}){const[t,s]=b.useState(null),[r,i]=b.useState(""),[l,c]=b.useState(""),[f,p]=b.useState(!0),[h,g]=b.useState(!1),[v,x]=b.useState(!1),[w,T]=b.useState(null),[N,A]=b.useState(null),[C,j]=b.useState(null),[S,_]=b.useState(null),[R,M]=b.useState(()=>Date.now()),[O,I]=b.useState(null),H=b.useRef(null),F=b.useRef(0),$=b.useRef(null);b.useEffect(()=>{H.current=t},[t]),b.useEffect(()=>{$.current=w},[w]);const L=b.useCallback(async(te="initial")=>{if(te==="background"&&$.current)return;const me=++F.current;!(H.current!==null)&&te!=="background"?(p(!0),A(null)):g(!0);try{const pe=await it(te==="manual"?"/api/pairing-state/refresh":"/api/pairing-state");if(me!==F.current)return;s(pe),A(null),_(Date.now())}catch(pe){if(me!==F.current)return;A(pe instanceof Error?pe.message:String(pe))}finally{me===F.current&&(p(!1),g(!1))}},[]),Y=b.useCallback(async()=>{try{const te=await it("/api/user");c(te.name),i(te.name),j(null)}catch(te){j(te instanceof Error?te.message:String(te))}},[]);b.useEffect(()=>{L("initial"),Y()},[L,Y]),b.useEffect(()=>{const te=setInterval(()=>{L("background")},1e4);return()=>clearInterval(te)},[L]),b.useEffect(()=>{if(!t?.pairing?.expiresAt)return;M(Date.now());const te=setInterval(()=>{M(Date.now())},1e3);return()=>clearInterval(te)},[t?.pairing?.expiresAt]);const ie=b.useCallback(async()=>{x(!0),j(null);try{const te=await it("/api/user",{method:"POST",body:JSON.stringify({name:r})});c(te.name),i(te.name)}catch(te){j(te instanceof Error?te.message:String(te))}finally{x(!1)}},[r]),ee=b.useCallback(async te=>{const me=++F.current;T(te),A(null);try{const he=await it("/api/pairing/control",{method:"POST",body:JSON.stringify({action:te})});if(me!==F.current)return;s(he),_(Date.now())}catch(he){if(me!==F.current)return;A(he instanceof Error?he.message:String(he))}finally{me===F.current&&T(null)}},[]),z=b.useCallback(async te=>{I(te);try{await it(`/api/pairing/peers/${encodeURIComponent(te)}`,{method:"DELETE"}),L("manual")}catch{}finally{I(null)}},[L]),Z=b.useMemo(()=>{const te=t?.pairing?.qrValue?.trim();return te?uZ(te,{border:2,ecc:"M",pixelSize:8}):null},[t?.pairing?.qrValue]),B=dZ(t?.pairing?.relay??t?.relay??null),re=hZ(t?.pairing?.expiresAt,R),D=(t?.trustedPeers.find(te=>te.fingerprint===t.connectedPeerFingerprint)??null)?.name??IS(t?.connectedPeerFingerprint??null),U=fZ(t),W=r.trim()!==l,se=!f&&!t&&!!N;return d.jsxs("div",{className:"sys-surface-page sys-settings-page",children:[d.jsxs("div",{className:"sys-page-head",children:[d.jsxs("div",{className:"sys-page-title-group",children:[d.jsx("h2",{className:"sys-page-title",children:"Settings"}),d.jsx("p",{className:"sys-page-subtitle",children:"Identity, pairing, and trusted devices."})]}),d.jsxs("div",{className:"sys-page-actions",children:[t&&d.jsx("span",{className:`sys-chip sys-chip-${U}`,children:t.statusLabel}),d.jsx("div",{className:"sys-sync-note",children:f?"Loading...":N&&t?`Snapshot from ${S?tt(S):"earlier"}`:S?`Updated ${tt(S)}`:""}),d.jsx("button",{type:"button",className:"s-btn",disabled:f||h||!!w,onClick:()=>{L("manual")},children:h?"Refreshing...":"Refresh"})]})]}),N&&t&&d.jsxs("div",{className:"sys-banner sys-banner-warning",children:[d.jsx("strong",{children:"Refresh failed."}),d.jsx("span",{children:N})]}),C&&d.jsxs("div",{className:"sys-banner sys-banner-warning",children:[d.jsx("strong",{children:"Identity error."}),d.jsx("span",{children:C})]}),f&&!t&&d.jsxs("div",{className:"sys-panel sys-state-card",children:[d.jsx("h3",{className:"sys-state-title",children:"Loading settings"}),d.jsx("p",{className:"sys-state-body",children:"Checking relay status and trusted peers."})]}),se&&d.jsxs("div",{className:"sys-panel sys-state-card sys-state-card-error",children:[d.jsx("h3",{className:"sys-state-title",children:"Pairing unavailable"}),d.jsx("p",{className:"sys-state-body",children:N}),d.jsx("div",{className:"sys-inline-actions",children:d.jsx("button",{type:"button",className:"s-btn",onClick:()=>{L("manual")},children:"Try again"})})]}),d.jsxs("div",{className:"sys-settings-hero",children:[d.jsx("div",{className:"sys-settings-qr-col",children:Z?d.jsxs("div",{className:"sys-settings-qr-frame",children:[d.jsx("div",{className:"s-qr",dangerouslySetInnerHTML:{__html:Z}}),re&&d.jsxs("span",{className:"sys-settings-qr-expires",children:["Expires in ",re]})]}):d.jsx("div",{className:"sys-settings-qr-empty",children:d.jsx("span",{className:"sys-settings-qr-empty-label",children:t?.isRunning?"Waiting for QR...":"Start pairing to generate QR"})})}),d.jsxs("div",{className:"sys-settings-info-col",children:[d.jsxs("div",{className:"sys-input-row",children:[d.jsx("input",{className:"sys-input",type:"text",placeholder:"Your name",value:r,onChange:te=>i(te.target.value),onKeyDown:te=>{te.key==="Enter"&&W&&!v&&ie()}}),d.jsx("button",{type:"button",className:"s-btn s-btn-primary",disabled:!W||v,onClick:()=>{ie()},children:v?"Saving...":"Save"})]}),d.jsxs("div",{className:"sys-settings-kv-list",children:[t?.identityFingerprint&&d.jsxs("div",{className:"sys-settings-kv",children:[d.jsx("span",{className:"sys-settings-kv-label",children:"Fingerprint"}),d.jsxs("span",{className:"sys-settings-kv-value",children:[d.jsx("code",{children:t.identityFingerprint}),d.jsx(LS,{value:t.identityFingerprint})]})]}),B&&d.jsxs("div",{className:"sys-settings-kv",children:[d.jsx("span",{className:"sys-settings-kv-label",children:"Relay"}),d.jsxs("span",{className:"sys-settings-kv-value",children:[d.jsx("code",{children:B}),d.jsx(LS,{value:B})]})]}),t?.statusDetail&&d.jsxs("div",{className:"sys-settings-kv",children:[d.jsx("span",{className:"sys-settings-kv-label",children:"Status"}),d.jsx("span",{className:"sys-settings-kv-value sys-settings-kv-nowrap",children:t.statusDetail})]}),D&&d.jsxs("div",{className:"sys-settings-kv",children:[d.jsx("span",{className:"sys-settings-kv-label",children:"Connected"}),d.jsx("span",{className:"sys-settings-kv-value",children:D})]}),t?.secure&&d.jsxs("div",{className:"sys-settings-kv",children:[d.jsx("span",{className:"sys-settings-kv-label",children:"Security"}),d.jsx("span",{className:"sys-settings-kv-value",children:d.jsx("span",{className:"sys-chip sys-chip-success",style:{margin:0},children:"Noise XX"})})]})]}),t&&d.jsx("div",{className:"sys-inline-actions sys-settings-controls",children:t.isRunning?d.jsxs(d.Fragment,{children:[d.jsx("button",{type:"button",className:"s-btn",disabled:!!w,onClick:()=>{ee("restart")},children:w==="restart"?"Restarting...":"Restart"}),d.jsx("button",{type:"button",className:"s-btn",disabled:!!w,onClick:()=>{ee("stop")},children:w==="stop"?"Stopping...":"Stop"})]}):d.jsx("button",{type:"button",className:"s-btn s-btn-primary",disabled:!!w,onClick:()=>{ee("start")},children:w==="start"?"Starting...":"Start pairing"})})]})]}),t&&d.jsxs("section",{className:"sys-settings-peers",children:[d.jsx("div",{className:"sys-section-head",children:d.jsxs("div",{children:[d.jsx("h3",{className:"sys-section-title",children:"Trusted peers"}),d.jsxs("p",{className:"sys-section-subtitle",children:[t.trustedPeers.length," device",t.trustedPeers.length!==1?"s":""," paired with this broker."]})]})}),t.trustedPeers.length===0?d.jsxs("div",{className:"sys-list-empty",children:[d.jsx("h3",{children:"No trusted peers"}),d.jsx("p",{children:"Devices appear here after completing pairing."})]}):d.jsxs("table",{className:"sys-peers-table",children:[d.jsx("thead",{children:d.jsxs("tr",{children:[d.jsx("th",{children:"Device"}),d.jsx("th",{children:"Fingerprint"}),d.jsx("th",{children:"Paired"}),d.jsx("th",{children:"Last seen"}),d.jsx("th",{})]})}),d.jsx("tbody",{children:t.trustedPeers.map(te=>{const me=te.fingerprint===t.connectedPeerFingerprint;return d.jsxs("tr",{className:me?"sys-peers-row-connected":"",children:[d.jsx("td",{children:d.jsxs("span",{className:"sys-peers-name",children:[te.name??IS(te.fingerprint)??"Peer",me&&d.jsx("span",{className:"sys-chip sys-chip-success sys-peers-badge",children:"Connected"})]})}),d.jsx("td",{children:d.jsx("code",{className:"sys-peers-fp",children:te.fingerprint})}),d.jsx("td",{children:te.pairedAtLabel??"—"}),d.jsx("td",{children:te.lastSeenLabel??"—"}),d.jsx("td",{children:d.jsx("button",{type:"button",className:"sys-peers-remove",disabled:O===te.fingerprint,onClick:()=>{z(te.fingerprint)},title:"Remove peer",children:O===te.fingerprint?"...":"Remove"})})]},te.fingerprint)})})]})]})]})}function mZ(e){return e.attention==="interrupt"?"failed":e.state==="done"?"completed":e.attention==="badge"||e.state==="waiting"||e.state==="review"?"updated":"working"}function am(e){switch(e){case"review":return"In review";case"waiting":return"Waiting";case"working":return"Working";case"done":return"Done";default:return e.replace(/_/g," ")}}function gZ(e){switch(e){case"badge":return"Needs attention";case"interrupt":return"Blocked";default:return null}}function yZ(e){switch(e.kind){case"flight_started":return"flight started";case"flight_completed":return e.detailKind?`flight ${e.detailKind}`:"flight ended";case"message":return"message";default:return e.title??e.detailKind??"event"}}function PS(e){return e.kind==="message"?"message":e.kind==="flight_started"?"flight":e.kind==="flight_completed"?e.detailKind?.includes("fail")?"alert":"done":e.detailKind?.includes("interrupt")||e.detailKind?.includes("block")?"alert":"system"}function im({title:e,items:t}){return t.length===0?null:d.jsxs("section",{className:"s-work-fact-card",children:[d.jsx("div",{className:"s-work-fact-card-header",children:d.jsx("div",{className:"s-work-fact-card-title",children:e})}),d.jsx("div",{className:"s-work-fact-card-body",children:t.map(s=>d.jsxs("div",{className:"s-work-fact-row",children:[d.jsx("span",{className:"s-work-fact-label",children:s.label}),d.jsx("span",{className:"s-work-fact-value",children:s.value})]},s.label))})]})}function US({label:e,value:t,onClick:s}){return d.jsxs("button",{type:"button",className:"s-work-action-row",onClick:s,children:[d.jsx("span",{className:"s-work-action-row-label",children:e}),d.jsx("span",{className:"s-work-action-row-value",children:t})]})}function vZ(e){const t=e.split(".");return t[t.length-1]||e}function bZ({workId:e,navigate:t}){const[s,r]=b.useState(null),[i,l]=b.useState(null),[c,f]=b.useState(!1),p=b.useCallback(async()=>{l(null);try{const N=await it(`/api/work/${encodeURIComponent(e)}`);r(N)}catch(N){l(N instanceof Error?N.message:String(N)),r(null)}finally{f(!0)}},[e]);if(b.useEffect(()=>{f(!1),p()},[p]),Kn(p),!c)return d.jsxs("div",{children:[d.jsx("button",{type:"button",className:"s-back",onClick:()=>t({view:"inbox"}),children:"← Back"}),d.jsx("div",{className:"s-empty",children:d.jsx("p",{children:"Loading…"})})]});if(!s)return d.jsxs("div",{children:[d.jsx("button",{type:"button",className:"s-back",onClick:()=>t({view:"inbox"}),children:"← Back"}),i&&d.jsx("p",{className:"s-error",children:i}),d.jsx("div",{className:"s-empty",children:d.jsx("p",{children:"Work item not found"})})]});const h=gZ(s.attention),g=s.ownerName??s.ownerId??"Unassigned",v=s.nextMoveOwnerName??s.nextMoveOwnerId??"—",x=[{label:"State",value:am(s.state)},{label:"Acceptance",value:s.acceptanceState.replace(/_/g," ")},{label:"Phase",value:s.currentPhase},...h?[{label:"Attention",value:h}]:[]],w=[{label:"Owner",value:g},{label:"Next move",value:v},...s.priority?[{label:"Priority",value:s.priority}]:[],{label:"Conversation",value:s.conversationId?"Attached":"None"}],T=[{label:"Case ID",value:s.id},{label:"Created",value:Ia(s.createdAt)},{label:"Updated",value:Ia(s.updatedAt)},{label:"Last activity",value:Ia(s.lastMeaningfulAt)}];return d.jsxs("div",{className:"s-work-detail s-work-casefile",children:[d.jsxs("div",{className:"s-work-casefile-topbar",children:[d.jsx("button",{type:"button",className:"s-back",onClick:()=>t({view:"inbox"}),children:"← Back"}),d.jsxs("span",{className:"s-work-casefile-record",children:["Case ",vZ(s.id)]})]}),i&&d.jsx("p",{className:"s-error",children:i}),d.jsx("section",{className:"s-work-casefile-hero",children:d.jsxs("div",{className:"s-work-casefile-hero-main",children:[d.jsxs("div",{className:"s-work-casefile-title-row",children:[d.jsx("h1",{className:"s-work-casefile-title",children:s.title}),d.jsx("span",{className:`s-pill s-pill-${mZ(s)}`,children:s.currentPhase})]}),s.lastMeaningfulSummary&&d.jsx("div",{className:"s-work-casefile-summary",children:Yn(s.lastMeaningfulSummary)}),d.jsxs("div",{className:"s-work-casefile-meta",children:[d.jsxs("span",{children:["Updated ",tt(s.updatedAt)]}),d.jsx("span",{children:g}),d.jsx("span",{children:am(s.state)}),h&&d.jsx("span",{children:h}),s.priority&&d.jsxs("span",{children:["Priority ",s.priority]})]})]})}),d.jsxs("div",{className:"s-work-casefile-layout",children:[d.jsxs("div",{className:"s-work-casefile-main",children:[d.jsxs("section",{className:"s-work-casefile-section",children:[d.jsx("div",{className:"s-agent-section-heading",children:d.jsx("h2",{className:"s-agent-section-title",children:"Case facts"})}),d.jsxs("div",{className:"s-work-fact-grid",children:[d.jsx(im,{title:"Status",items:x}),d.jsx(im,{title:"Assignment",items:w})]})]}),s.activeFlights.length>0&&d.jsxs("section",{className:"s-work-casefile-section",children:[d.jsx("div",{className:"s-agent-section-heading",children:d.jsx("h2",{className:"s-agent-section-title",children:"Flights"})}),d.jsx("div",{className:"s-work-flight-list",children:s.activeFlights.map(N=>d.jsxs("button",{type:"button",className:"s-work-flight-card",onClick:N.conversationId?()=>t({view:"conversation",conversationId:N.conversationId}):void 0,disabled:!N.conversationId,children:[d.jsxs("div",{className:"s-work-flight-card-header",children:[d.jsx("span",{className:"s-work-flight-card-title",children:N.agentName??N.agentId}),d.jsx("span",{className:"s-pill s-pill-working",children:N.state})]}),d.jsxs("div",{className:"s-work-flight-card-meta",children:[d.jsx("span",{children:N.startedAt?`Started ${tt(N.startedAt)}`:"Start time unavailable"}),N.completedAt&&d.jsxs("span",{children:["Completed ",tt(N.completedAt)]})]}),N.summary&&d.jsx("div",{className:"s-work-flight-card-copy",children:N.summary})]},N.id))})]}),s.childWork.length>0&&d.jsxs("section",{className:"s-work-casefile-section",children:[d.jsx("div",{className:"s-agent-section-heading",children:d.jsx("h2",{className:"s-agent-section-title",children:"Child work"})}),d.jsx("div",{className:"s-work-related-list",children:s.childWork.map(N=>d.jsxs("button",{type:"button",className:"s-work-related-card",onClick:()=>t({view:"work",workId:N.id}),children:[d.jsxs("div",{className:"s-work-related-card-header",children:[d.jsx("span",{className:"s-work-related-card-title",children:N.title}),d.jsx("span",{className:`s-pill s-pill-${N.attention==="interrupt"?"failed":"updated"}`,children:N.currentPhase})]}),d.jsxs("div",{className:"s-work-related-card-meta",children:[d.jsx("span",{children:N.ownerName??N.ownerId??"Unassigned"}),d.jsx("span",{children:am(N.state)}),d.jsx("span",{children:tt(N.lastMeaningfulAt)})]}),N.lastMeaningfulSummary&&d.jsx("div",{className:"s-work-related-card-copy",children:Yn(N.lastMeaningfulSummary)})]},N.id))})]}),d.jsxs("section",{className:"s-work-casefile-section",children:[d.jsx("div",{className:"s-agent-section-heading",children:d.jsx("h2",{className:"s-agent-section-title",children:"Timeline"})}),s.timeline.length===0?d.jsxs("div",{className:"s-empty",children:[d.jsx("p",{children:"No activity yet."}),d.jsx("p",{children:"Timeline events will appear once the case receives messages or coordination updates."})]}):d.jsx("div",{className:"s-work-timeline",children:s.timeline.map(N=>d.jsxs("button",{type:"button",className:`s-work-timeline-entry${N.conversationId?" s-work-timeline-entry-clickable":""}`,onClick:N.conversationId?()=>t({view:"conversation",conversationId:N.conversationId}):void 0,disabled:!N.conversationId,children:[d.jsx("span",{className:`s-work-timeline-marker s-work-timeline-marker-${PS(N)}`}),d.jsxs("div",{className:"s-work-timeline-content",children:[d.jsxs("div",{className:"s-work-timeline-header",children:[d.jsx("span",{className:"s-work-timeline-time",children:tt(N.at)}),d.jsx("span",{className:`s-work-timeline-kind s-work-timeline-kind-${PS(N)}`,children:yZ(N)})]}),d.jsx("div",{className:"s-work-timeline-actor",children:N.actorName??"system"}),N.title&&d.jsx("div",{className:"s-work-timeline-title",children:N.title}),N.summary&&d.jsx("div",{className:"s-work-timeline-summary",children:Yn(N.summary)}),d.jsx("div",{className:"s-work-timeline-stamp",children:Ia(N.at)})]})]},N.id))})]})]}),d.jsxs("aside",{className:"s-work-casefile-side",children:[d.jsx(im,{title:"Record",items:T}),d.jsxs("section",{className:"s-work-fact-card",children:[d.jsx("div",{className:"s-work-fact-card-header",children:d.jsx("div",{className:"s-work-fact-card-title",children:"Links"})}),d.jsxs("div",{className:"s-work-action-list",children:[s.conversationId?d.jsx(US,{label:"Conversation",value:"Open thread",onClick:()=>t({view:"conversation",conversationId:s.conversationId})}):d.jsx("div",{className:"s-work-action-list-empty",children:"No conversation attached."}),s.parentId&&s.parentTitle?d.jsx(US,{label:"Parent",value:s.parentTitle,onClick:()=>t({view:"work",workId:s.parentId})}):d.jsx("div",{className:"s-work-action-list-empty",children:"No parent work item."})]})]})]})]})]})}function xZ(){const{route:e,navigate:t}=Ft();return d.jsx(wZ,{children:SZ(e,t)})}function wZ({children:e}){return d.jsx("div",{style:{background:"var(--bg)",color:"var(--ink)",minHeight:"100%",height:"100%",display:"flex",flexDirection:"column"},children:e})}function SZ(e,t){switch(e.view){case"conversation":return d.jsx(ag,{conversationId:e.conversationId,navigate:t});case"agent-info":return d.jsx(AB,{conversationId:e.conversationId,navigate:t});case"settings":return d.jsx(pZ,{navigate:t});case"agents":return d.jsx(t7,{navigate:t,selectedAgentId:e.agentId,conversationId:e.conversationId});case"fleet":return d.jsx(c7,{navigate:t});case"sessions":return e.sessionId?d.jsx(ag,{conversationId:e.sessionId,navigate:t}):d.jsx(Z7,{navigate:t});case"mesh":return d.jsx(O7,{navigate:t});case"activity":return d.jsx(jB,{navigate:t});case"work":return d.jsx(bZ,{workId:e.workId,navigate:t});default:return d.jsx(p7,{navigate:t})}}function EZ(){const{route:e,agents:t}=Ft();if(e.view!=="agents")return null;const s=e.agentId?t.find(i=>i.id===e.agentId)??null:null;if(!s){const i=t.filter(l=>Fa(l.state)).length;return d.jsxs("div",{className:"flex flex-col h-full overflow-y-auto frame-scrollbar p-4 gap-4 text-[11px]",children:[d.jsx(_s,{label:"Total",value:`${t.length}`}),d.jsx(_s,{label:"Working",value:`${i}`}),d.jsx(_s,{label:"Available",value:`${t.length-i}`}),d.jsx("div",{className:"mt-2 text-[10px] font-mono uppercase tracking-[0.15em] text-white/25 leading-relaxed",children:"Select an agent from the roster to see its identity + session context here."})]})}const r=Fa(s.state);return d.jsxs("div",{className:"flex flex-col h-full overflow-y-auto frame-scrollbar p-4 gap-4 text-[11px]",children:[d.jsxs("div",{className:"flex items-center gap-3 pb-3 border-b border-white/[0.04]",children:[d.jsxs("div",{className:"relative w-10 h-10 rounded-full flex items-center justify-center text-[13px] font-mono text-black/80 shrink-0",style:{background:Ts(s.name)},children:[s.name[0]?.toUpperCase()??"?",r&&d.jsx("span",{className:"absolute -right-0.5 -bottom-0.5 w-2.5 h-2.5 rounded-full bg-emerald-400 ring-2 ring-neutral-950"})]}),d.jsxs("div",{className:"flex flex-col min-w-0 flex-1",children:[d.jsx("span",{className:"text-[13px] text-white/90 truncate",children:s.name}),s.handle&&d.jsxs("span",{className:"text-[10px] font-mono text-cyan-400/70",children:["@",s.handle]})]})]}),d.jsxs(Uu,{label:"State",children:[d.jsxs("div",{className:"flex items-baseline gap-2",children:[d.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${r?"bg-emerald-400":"bg-white/20"}`}),d.jsx("span",{className:"text-[12px] text-white/80 capitalize",children:ao(s.state)})]}),s.updatedAt&&d.jsxs("div",{className:"text-[10px] font-mono text-white/30 mt-1",children:["Updated ",tt(s.updatedAt)]})]}),d.jsxs(Uu,{label:"Identity",children:[d.jsx(_s,{label:"Class",value:s.agentClass}),s.role&&d.jsx(_s,{label:"Role",value:s.role}),s.harness&&d.jsx(_s,{label:"Harness",value:s.harness}),s.transport&&d.jsx(_s,{label:"Transport",value:s.transport})]}),(s.project||s.branch||s.cwd)&&d.jsxs(Uu,{label:"Project",children:[s.project&&d.jsx(_s,{label:"Name",value:s.project}),s.branch&&d.jsx(_s,{label:"Branch",value:s.branch}),s.cwd&&d.jsx(_s,{label:"Cwd",value:s.cwd})]}),s.capabilities.length>0&&d.jsx(Uu,{label:`Capabilities · ${s.capabilities.length}`,children:d.jsx("div",{className:"flex flex-wrap gap-1",children:s.capabilities.map(i=>d.jsx("span",{className:"text-[10px] font-mono text-white/50 px-1.5 py-0.5 rounded-sm bg-white/[0.04]",children:i},i))})})]})}function Uu({label:e,children:t}){return d.jsxs("div",{className:"flex flex-col",children:[d.jsx("div",{className:"text-[9px] font-mono uppercase tracking-[0.15em] text-white/30 mb-1.5",children:e}),t]})}function _s({label:e,value:t}){return d.jsxs("div",{className:"flex items-baseline justify-between py-0.5 gap-2",children:[d.jsx("span",{className:"text-[10px] font-mono uppercase tracking-wider text-white/30 shrink-0",children:e}),d.jsx("span",{className:"text-[11px] text-white/70 font-mono truncate",children:t})]})}function NZ(){const[e,t]=b.useState(null),s=b.useCallback(async()=>{try{t(await it("/api/fleet"))}catch{}},[]);if(b.useEffect(()=>{s()},[s]),Kn(s),!e)return d.jsx("div",{className:"flex items-center justify-center h-full text-[11px] font-mono uppercase tracking-[0.15em] text-white/25",children:"Loading fleet…"});const r=e.totals;return d.jsxs("div",{className:"flex flex-col h-full overflow-y-auto frame-scrollbar p-4 gap-4 text-[11px]",children:[d.jsxs("div",{className:"text-[9px] font-mono uppercase tracking-[0.15em] text-white/30",children:["Updated ",tt(e.generatedAt)]}),d.jsx($u,{label:"Needs Input",value:r.needsAttention,emphasis:r.needsAttention>0?"warn":"muted"}),d.jsx($u,{label:"Active Asks",value:r.active}),d.jsx($u,{label:"Recent Finished",value:r.recentCompleted,emphasis:r.recentCompleted>0?"good":"muted"}),d.jsx($u,{label:"Activity",value:r.activity})]})}function $u({label:e,value:t,emphasis:s}){const r=s==="good"?"text-emerald-300/90":s==="warn"?"text-amber-300/90":s==="muted"?"text-white/40":"text-white/80";return d.jsxs("div",{className:"flex flex-col pb-3 border-b border-white/[0.04] last:border-b-0",children:[d.jsx("span",{className:`text-[24px] font-mono tabular-nums leading-none ${r}`,children:t}),d.jsx("span",{className:"text-[9px] font-mono uppercase tracking-[0.15em] text-white/30 mt-1",children:e})]})}function TZ(){const{agents:e,navigate:t}=Ft();if(e.length===0)return d.jsxs("div",{className:"flex flex-col h-full items-center justify-center px-4 text-center text-[11px] text-white/30 font-mono leading-relaxed",children:[d.jsx("div",{className:"mb-1 uppercase tracking-[0.15em]",children:"No agents"}),d.jsx("div",{children:"Connect an agent to see your roster here."})]});const s=e.filter(i=>Fa(i.state)),r=e.filter(i=>!Fa(i.state));return d.jsxs("div",{className:"flex flex-col h-full overflow-y-auto frame-scrollbar p-4 gap-4 text-[11px]",children:[s.length>0&&d.jsx($S,{label:"Online",count:s.length,children:s.map(i=>d.jsx(VS,{agent:i,navigate:t},i.id))}),r.length>0&&d.jsx($S,{label:"Standby",count:r.length,children:r.map(i=>d.jsx(VS,{agent:i,navigate:t,dim:!0},i.id))})]})}function $S({label:e,count:t,children:s}){return d.jsxs("div",{className:"flex flex-col",children:[d.jsxs("div",{className:"flex items-baseline justify-between mb-1.5",children:[d.jsx("span",{className:"text-[9px] font-mono uppercase tracking-[0.15em] text-white/30",children:e}),d.jsx("span",{className:"text-[9px] font-mono tabular-nums text-white/25",children:t})]}),d.jsx("div",{className:"flex flex-col gap-0.5",children:s})]})}function VS({agent:e,navigate:t,dim:s}){const r=Fa(e.state);return d.jsxs("button",{onClick:()=>t({view:"agents",agentId:e.id}),className:`group flex items-center gap-2.5 px-2 py-1.5 rounded-sm text-left transition-colors ${s?"opacity-60 hover:opacity-100 hover:bg-white/[0.03]":"hover:bg-white/[0.03]"}`,children:[d.jsxs("div",{className:"relative w-6 h-6 rounded-full flex items-center justify-center text-[10px] font-mono text-black/80 shrink-0",style:{background:Ts(e.name)},children:[e.name[0]?.toUpperCase()??"?",r&&d.jsx("span",{className:"absolute -right-0.5 -bottom-0.5 w-2 h-2 rounded-full bg-emerald-400 ring-2 ring-neutral-950"})]}),d.jsxs("div",{className:"flex flex-col min-w-0 flex-1",children:[d.jsx("span",{className:"text-[12px] text-white/80 truncate group-hover:text-white transition-colors",children:e.name}),d.jsx("span",{className:"text-[10px] font-mono text-white/30 truncate",children:ao(e.state)})]}),e.updatedAt&&d.jsx("span",{className:"text-[9px] font-mono tabular-nums text-white/25 shrink-0",children:tt(e.updatedAt)})]})}function jZ(){const{route:e}=Ft(),[t,s]=b.useState([]),r=b.useCallback(async()=>{try{s(await it("/api/sessions"))}catch{}},[]);if(b.useEffect(()=>{r()},[r]),Kn(r),e.view!=="sessions")return null;const i=e.sessionId?t.find(l=>l.id===e.sessionId)??null:null;if(!i){const l=new Set(t.map(f=>f.kind)),c=t.filter(f=>f.currentBranch).length;return d.jsxs("div",{className:"flex flex-col h-full overflow-y-auto frame-scrollbar p-4 gap-4 text-[11px]",children:[d.jsx(ks,{label:"Total",value:`${t.length}`}),d.jsx(ks,{label:"Kinds",value:`${l.size}`}),d.jsx(ks,{label:"Branched",value:`${c}`}),d.jsx("div",{className:"mt-2 text-[10px] font-mono uppercase tracking-[0.15em] text-white/25 leading-relaxed",children:"Select a session from the list to see its context here."})]})}return d.jsxs("div",{className:"flex flex-col h-full overflow-y-auto frame-scrollbar p-4 gap-4 text-[11px]",children:[d.jsxs("div",{className:"pb-3 border-b border-white/[0.04]",children:[d.jsx("div",{className:"text-[13px] text-white/90 leading-snug",children:i.title}),d.jsx("div",{className:"text-[10px] font-mono uppercase tracking-wider text-cyan-400/70 mt-1",children:i.kind})]}),i.agentName&&d.jsxs(Vu,{label:"Agent",children:[d.jsx(ks,{label:"Name",value:i.agentName}),i.harness&&d.jsx(ks,{label:"Harness",value:i.harness})]}),(i.currentBranch||i.workspaceRoot)&&d.jsxs(Vu,{label:"Workspace",children:[i.currentBranch&&d.jsx(ks,{label:"Branch",value:i.currentBranch}),i.workspaceRoot&&d.jsx(ks,{label:"Root",value:i.workspaceRoot})]}),d.jsxs(Vu,{label:"Activity",children:[d.jsx(ks,{label:"Messages",value:`${i.messageCount}`}),i.lastMessageAt&&d.jsx(ks,{label:"Last",value:tt(i.lastMessageAt)}),i.participantIds.length>0&&d.jsx(ks,{label:"Participants",value:`${i.participantIds.length}`})]}),i.preview&&d.jsx(Vu,{label:"Preview",children:d.jsxs("div",{className:"text-[11px] text-white/60 leading-relaxed italic",children:['"',i.preview,'"']})})]})}function Vu({label:e,children:t}){return d.jsxs("div",{className:"flex flex-col",children:[d.jsx("div",{className:"text-[9px] font-mono uppercase tracking-[0.15em] text-white/30 mb-1.5",children:e}),t]})}function ks({label:e,value:t}){return d.jsxs("div",{className:"flex items-baseline justify-between py-0.5 gap-2",children:[d.jsx("span",{className:"text-[10px] font-mono uppercase tracking-wider text-white/30 shrink-0",children:e}),d.jsx("span",{className:"text-[11px] text-white/70 font-mono truncate",children:t})]})}function CZ(){const{route:e}=Ft(),t=e.view==="work"?e.workId:null,[s,r]=b.useState(null),i=b.useCallback(async()=>{if(!t){r(null);return}try{r(await it(`/api/work/${encodeURIComponent(t)}`))}catch{r(null)}},[t]);if(b.useEffect(()=>{i()},[i]),Kn(i),e.view!=="work")return null;if(!s)return d.jsx("div",{className:"flex items-center justify-center h-full text-[11px] font-mono uppercase tracking-[0.15em] text-white/25 text-center px-4",children:"Loading work item…"});const l=AZ(s.state);return d.jsxs("div",{className:"flex flex-col h-full overflow-y-auto frame-scrollbar p-4 gap-4 text-[11px]",children:[d.jsxs("div",{className:"pb-3 border-b border-white/[0.04]",children:[d.jsxs("div",{className:"text-[9px] font-mono uppercase tracking-[0.15em] text-cyan-400/70 mb-1",children:["Case ",RZ(s.id)]}),d.jsx("div",{className:"text-[13px] text-white/90 leading-snug",children:s.title})]}),d.jsxs(Bu,{label:"State",children:[d.jsxs("div",{className:"flex items-baseline gap-2",children:[d.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${l.dot}`}),d.jsx("span",{className:`text-[12px] capitalize ${l.text}`,children:s.state.replace(/_/g," ")})]}),d.jsxs("div",{className:"text-[10px] font-mono text-white/30 mt-1",children:["Phase · ",s.currentPhase]})]}),d.jsxs(Bu,{label:"Ownership",children:[s.ownerName&&d.jsx(zi,{label:"Owner",value:s.ownerName}),s.nextMoveOwnerName&&d.jsx(zi,{label:"Next move",value:s.nextMoveOwnerName}),s.priority&&d.jsx(zi,{label:"Priority",value:s.priority})]}),d.jsxs(Bu,{label:"Activity",children:[d.jsx(zi,{label:"Children",value:`${s.activeChildWorkCount}`}),d.jsx(zi,{label:"Flights",value:`${s.activeFlightCount}`}),s.lastMeaningfulAt&&d.jsx(zi,{label:"Last update",value:tt(s.lastMeaningfulAt)})]}),s.attention!=="silent"&&d.jsx("div",{className:`text-[10px] font-mono uppercase tracking-wider px-2 py-1 rounded-sm ${s.attention==="interrupt"?"text-red-300/90 bg-red-500/10 border border-red-500/20":"text-amber-300/90 bg-amber-500/10 border border-amber-500/20"}`,children:s.attention==="interrupt"?"Interrupt":"Needs attention"}),s.lastMeaningfulSummary&&d.jsx(Bu,{label:"Latest",children:d.jsx("div",{className:"text-[11px] text-white/60 leading-relaxed italic",children:s.lastMeaningfulSummary})})]})}function RZ(e){return e.length>10?`${e.slice(0,8)}…`:e}function AZ(e){return/complete|done|finished/i.test(e)?{dot:"bg-emerald-400",text:"text-emerald-300/90"}:/fail|error/i.test(e)?{dot:"bg-red-400",text:"text-red-300/90"}:/block|wait|pause/i.test(e)?{dot:"bg-amber-400",text:"text-amber-300/90"}:/active|working|in[_-]?progress/i.test(e)?{dot:"bg-cyan-400",text:"text-cyan-300/90"}:{dot:"bg-white/30",text:"text-white/70"}}function Bu({label:e,children:t}){return d.jsxs("div",{className:"flex flex-col",children:[d.jsx("div",{className:"text-[9px] font-mono uppercase tracking-[0.15em] text-white/30 mb-1.5",children:e}),t]})}function zi({label:e,value:t}){return d.jsxs("div",{className:"flex items-baseline justify-between py-0.5 gap-2",children:[d.jsx("span",{className:"text-[10px] font-mono uppercase tracking-wider text-white/30 shrink-0",children:e}),d.jsx("span",{className:"text-[11px] text-white/70 font-mono truncate",children:t})]})}function _Z(){const{route:e}=Ft();switch(e.view){case"inbox":return d.jsx(TZ,{});case"agents":case"agent-info":return d.jsx(EZ,{});case"fleet":return d.jsx(NZ,{});case"sessions":case"conversation":return d.jsx(jZ,{});case"work":return d.jsx(CZ,{});default:return null}}const kZ=[{view:"inbox",label:"Home",icon:VV,target:{view:"inbox"}},{view:"agents",label:"Agents",icon:QV,target:{view:"agents"}},{view:"fleet",label:"Fleet",icon:ZV,target:{view:"fleet"}},{view:"sessions",label:"Sessions",icon:FV,target:{view:"sessions"}},{view:"activity",label:"Activity",icon:UV,target:{view:"activity"}},{view:"mesh",label:"Mesh",icon:YV,target:{view:"mesh"}}],MZ=[{view:"settings",label:"Settings",icon:WV,target:{view:"settings"}}];function OZ(){const{route:e,navigate:t}=Ft();return d.jsxs("div",{className:"flex flex-col h-full py-2",children:[d.jsx("nav",{className:"flex flex-col",children:kZ.map(s=>d.jsx(BS,{item:s,activeView:e.view,navigate:t},s.view))}),d.jsx("div",{className:"flex-1"}),d.jsx("nav",{className:"flex flex-col",children:MZ.map(s=>d.jsx(BS,{item:s,activeView:e.view,navigate:t},s.view))})]})}function BS({item:e,activeView:t,navigate:s}){const r=t===e.view,i=e.icon;return d.jsxs("button",{onClick:()=>s(e.target),className:`group w-full flex items-center gap-2.5 px-3 py-1.5 text-left transition-colors border-l-2 ${r?"bg-cyan-500/5 border-l-cyan-400/40 text-white/80":"border-l-transparent text-white/40 hover:bg-white/[0.02] hover:text-white/60"}`,children:[d.jsx(i,{size:13,strokeWidth:1.5,className:r?"text-cyan-400/70":"text-white/30 group-hover:text-white/50"}),d.jsx("span",{className:"text-[12px]",children:e.label})]})}function DZ(){const{onboarding:e}=Ft();return e?e.hasLocalConfig?e.hasOperatorName?e.hasProjectConfig?null:d.jsx(om,{children:d.jsx(LZ,{})}):d.jsx(om,{children:d.jsx(IZ,{})}):d.jsx(om,{children:d.jsx(zZ,{})}):null}function om({children:e}){return d.jsx("div",{style:{width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",overflow:"auto",background:"var(--bg)",color:"var(--ink)"},children:d.jsx("div",{style:{width:"100%",maxWidth:720,padding:"80px 72px",display:"flex",flexDirection:"column",gap:40},children:e})})}function wy({eyebrow:e,title:t,description:s}){return d.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16},children:[d.jsx("div",{style:PZ,children:e}),d.jsx("div",{style:UZ,children:t}),d.jsx("div",{style:$Z,children:s})]})}function Sy({primary:e,onPrimary:t,primaryDisabled:s,busy:r}){const{skipOnboarding:i}=Ft();return d.jsxs("div",{style:{display:"flex",alignItems:"center",gap:24,paddingTop:8},children:[d.jsx("button",{type:"button",onClick:t,disabled:s||r,style:{...BZ,opacity:s||r?.5:1,cursor:s||r?"default":"pointer"},children:r?"Working…":e}),d.jsx("button",{type:"button",onClick:i,style:ZZ,onMouseEnter:l=>{l.currentTarget.style.color="rgba(255,255,255,0.8)"},onMouseLeave:l=>{l.currentTarget.style.color="rgba(255,255,255,0.45)"},children:"Skip for now"})]})}function Ey({message:e}){return e?d.jsx("div",{style:{borderRadius:8,border:"1px solid rgba(239,68,68,0.35)",backgroundColor:"rgba(239,68,68,0.08)",color:"rgba(252,165,165,0.95)",padding:"12px 16px",fontSize:12,lineHeight:1.5},children:e}):null}function zZ(){const{onboarding:e,refreshOnboarding:t}=Ft(),[s,r]=b.useState(!1),[i,l]=b.useState(null),c=async()=>{r(!0),l(null);try{await it("/api/onboarding/init",{method:"POST",body:"{}"}),await t()}catch(f){l(f instanceof Error?f.message:String(f))}finally{r(!1)}};return d.jsxs(d.Fragment,{children:[d.jsx(wy,{eyebrow:"First-run setup",title:"Welcome to Scout",description:d.jsxs(d.Fragment,{children:["Scout needs a local config before it can talk to the broker, the web app, and paired devices. This writes"," ",d.jsx("code",{style:dg,children:"~/.openscout/config.json"})," with sensible defaults — you can edit it any time."]})}),d.jsxs("ul",{style:HZ,children:[d.jsx(ZS,{label:"Local config (~/.openscout/config.json)",done:!1,hint:"missing"}),d.jsx(ZS,{label:".openscout/project.json in a repo",done:!!e?.hasProjectConfig,hint:e?.hasProjectConfig?e.projectRoot??void 0:"checked after setup"})]}),d.jsx(Ey,{message:i}),d.jsx(Sy,{primary:"Initialize Scout",onPrimary:()=>{c()},busy:s})]})}function IZ(){const{onboarding:e,refreshOnboarding:t}=Ft(),s=e?.operatorNameSuggestion??"",[r,i]=b.useState(s),[l,c]=b.useState(!1),[f,p]=b.useState(null);b.useEffect(()=>{!r&&s&&i(s)},[s,r]);const h=async()=>{const g=r.trim();if(!g){p("Name is required.");return}c(!0),p(null);try{await it("/api/user",{method:"POST",body:JSON.stringify({name:g})}),await t()}catch(v){p(v instanceof Error?v.message:String(v))}finally{c(!1)}};return d.jsxs(d.Fragment,{children:[d.jsx(wy,{eyebrow:"Step 1 of 2",title:"What should we call you?",description:"Your name shows up on messages you send and in any agent that speaks for you. You can change it later in Settings."}),d.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[d.jsx("label",{style:sd,children:"Your name"}),d.jsx("input",{autoFocus:!0,value:r,onChange:g=>{i(g.target.value),p(null)},onKeyDown:g=>{g.key==="Enter"&&h()},placeholder:s||"Operator",style:ug}),s?d.jsx("div",{style:{fontSize:11,color:"rgba(255,255,255,0.4)",fontFamily:"var(--hud-font-mono)"},children:"Prefilled from your machine."}):null]}),d.jsx(Ey,{message:f}),d.jsx(Sy,{primary:"Continue",onPrimary:()=>{h()},busy:l,primaryDisabled:!r.trim()})]})}function LZ(){const{onboarding:e,refreshOnboarding:t}=Ft(),s=e?.currentDirectory??"",[r,i]=b.useState([s||"~/dev"]),[l,c]=b.useState(s),[f,p]=b.useState("claude"),[h,g]=b.useState(!1),[v,x]=b.useState(null),w=(C,j)=>{i(S=>S.map((_,R)=>R===C?j:_))},T=()=>i(C=>[...C,""]),N=C=>i(j=>j.filter((S,_)=>_!==C)),A=async()=>{const C=r.map(S=>S.trim()).filter(Boolean),j=l.trim();if(!j){x("Pick where Scout should anchor this context.");return}g(!0),x(null);try{await it("/api/onboarding/project",{method:"POST",body:JSON.stringify({contextRoot:j,sourceRoots:C,defaultHarness:f})}),await t()}catch(S){x(S instanceof Error?S.message:String(S))}finally{g(!1)}};return d.jsxs(d.Fragment,{children:[d.jsx(wy,{eyebrow:"Step 2 of 2",title:"Where do your repos live?",description:d.jsxs(d.Fragment,{children:["Scout scans these folders for projects and anchors this context at"," ",d.jsx("code",{style:dg,children:"<context>/.openscout/project.json"}),"."]})}),d.jsxs("div",{style:lm,children:[d.jsx("label",{style:sd,children:"Scan folders"}),d.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[r.map((C,j)=>d.jsxs("div",{style:{display:"flex",gap:8},children:[d.jsx("input",{value:C,onChange:S=>w(j,S.target.value),placeholder:j===0?"~/dev":"Add another folder",style:{...ug,flex:1}}),d.jsx("button",{type:"button",onClick:()=>N(j),disabled:r.length<=1,style:{...HS,opacity:r.length<=1?.4:1,cursor:r.length<=1?"default":"pointer"},"aria-label":`Remove folder ${j+1}`,children:"−"})]},j)),d.jsx("button",{type:"button",onClick:T,style:{...HS,alignSelf:"flex-start"},children:"+ Add folder"})]})]}),d.jsxs("div",{style:lm,children:[d.jsx("label",{style:sd,children:"Context root"}),d.jsx("input",{value:l,onChange:C=>c(C.target.value),placeholder:"~/dev",style:ug}),d.jsxs("div",{style:VZ,children:["Scout writes ",d.jsx("code",{style:dg,children:".openscout/project.json"})," ","inside this folder."]})]}),d.jsxs("div",{style:lm,children:[d.jsx("label",{style:sd,children:"Default harness"}),d.jsx("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:12},children:["claude","codex"].map(C=>{const j=f===C;return d.jsxs("button",{type:"button",onClick:()=>p(C),style:{...FZ,borderColor:j?"var(--accent, #2dd4bf)":"rgba(255,255,255,0.12)",backgroundColor:j?"rgba(45,212,191,0.08)":"rgba(255,255,255,0.02)"},children:[d.jsx("div",{style:{fontSize:15,fontWeight:600,textTransform:"capitalize"},children:C}),d.jsx("div",{style:{fontSize:12,color:"rgba(255,255,255,0.55)",marginTop:6,lineHeight:1.5},children:C==="claude"?"Anthropic Claude Code — local CLI agent.":"OpenAI Codex — cloud agentic sandbox."})]},C)})})]}),d.jsx(Ey,{message:v}),d.jsx(Sy,{primary:"Create project",onPrimary:()=>{A()},busy:h,primaryDisabled:!l.trim()})]})}function ZS({label:e,done:t,hint:s}){return d.jsxs("li",{style:{display:"flex",alignItems:"flex-start",gap:16},children:[d.jsx("span",{style:{marginTop:2,width:20,height:20,borderRadius:999,display:"flex",alignItems:"center",justifyContent:"center",fontSize:11,fontWeight:700,flexShrink:0,backgroundColor:t?"rgba(34,197,94,0.15)":"rgba(239,68,68,0.12)",color:t?"#4ade80":"#f87171"},children:t?"✓":"•"}),d.jsxs("div",{style:{minWidth:0},children:[d.jsx("div",{style:{fontSize:13,lineHeight:1.5,color:t?"rgba(255,255,255,0.75)":"rgba(255,255,255,0.9)"},children:e}),s?d.jsx("div",{style:{fontSize:11,fontFamily:"var(--hud-font-mono)",color:"rgba(255,255,255,0.35)",marginTop:4,wordBreak:"break-all"},children:s}):null]})]})}const PZ={fontSize:11,fontFamily:"var(--hud-font-mono)",textTransform:"uppercase",letterSpacing:"0.18em",color:"rgba(255,255,255,0.4)"},UZ={fontSize:36,fontWeight:600,letterSpacing:"-0.01em",lineHeight:1.15},$Z={fontSize:15,lineHeight:1.75,color:"rgba(255,255,255,0.6)",maxWidth:580},lm={display:"flex",flexDirection:"column",gap:10},sd={fontSize:11,fontFamily:"var(--hud-font-mono)",textTransform:"uppercase",letterSpacing:"0.15em",color:"rgba(255,255,255,0.5)"},ug={width:"100%",padding:"10px 14px",fontSize:14,fontFamily:"var(--hud-font-mono)",color:"rgba(255,255,255,0.92)",backgroundColor:"rgba(255,255,255,0.04)",border:"1px solid rgba(255,255,255,0.12)",borderRadius:8,outline:"none",boxSizing:"border-box"},VZ={fontSize:12,color:"rgba(255,255,255,0.45)",lineHeight:1.6},dg={fontFamily:"var(--hud-font-mono)",fontSize:12,padding:"2px 6px",borderRadius:4,backgroundColor:"rgba(255,255,255,0.06)"},BZ={fontSize:13,fontWeight:600,padding:"12px 24px",borderRadius:10,backgroundColor:"var(--accent, #2dd4bf)",color:"#0b0d12",border:"none",transition:"opacity 0.15s ease"},HS={fontSize:13,fontWeight:500,padding:"10px 14px",borderRadius:8,backgroundColor:"rgba(255,255,255,0.04)",border:"1px solid rgba(255,255,255,0.12)",color:"rgba(255,255,255,0.85)",transition:"all 0.15s ease"},ZZ={fontSize:12,color:"rgba(255,255,255,0.45)",textDecoration:"underline dotted rgba(255,255,255,0.25)",textUnderlineOffset:4,background:"none",border:"none",cursor:"pointer",padding:"4px 2px",transition:"color 0.15s ease"},HZ={display:"flex",flexDirection:"column",gap:20,margin:0,padding:0,listStyle:"none"},FZ={textAlign:"left",padding:"16px 18px",borderRadius:12,border:"1px solid rgba(255,255,255,0.12)",color:"rgba(255,255,255,0.9)",cursor:"pointer",transition:"all 0.15s ease"};function qZ(){const{navigate:e,agents:t,reload:s}=Ft(),r=b.useCallback(async i=>{await it(`/api/agents/${encodeURIComponent(i)}/interrupt`,{method:"POST",body:JSON.stringify({})})},[]);return b.useMemo(()=>{const i=[{id:"nav:home",label:"Go to Home",action:()=>e({view:"inbox"}),shortcut:"Cmd+1"},{id:"nav:agents",label:"Go to Agents",action:()=>e({view:"agents"}),shortcut:"Cmd+2"},{id:"nav:fleet",label:"Go to Fleet",action:()=>e({view:"fleet"}),shortcut:"Cmd+3"},{id:"nav:sessions",label:"Go to Sessions",action:()=>e({view:"sessions"}),shortcut:"Cmd+4"},{id:"nav:activity",label:"Go to Activity",action:()=>e({view:"activity"}),shortcut:"Cmd+5"},{id:"nav:mesh",label:"Go to Mesh",action:()=>e({view:"mesh"}),shortcut:"Cmd+6"},{id:"nav:settings",label:"Open Settings",action:()=>e({view:"settings"}),shortcut:"Cmd+,"},{id:"nav:pair",label:"Pair Device",action:()=>e({view:"settings"})},{id:"scout:reload",label:"Reload Agents",action:()=>{s()}}];for(const l of t)i.push({id:`scout:open:${l.id}`,label:`Open ${l.name}`,action:()=>e({view:"conversation",conversationId:ng(l.id)})}),i.push({id:`scout:send:${l.id}`,label:`Send message to ${l.name}`,action:()=>e({view:"conversation",conversationId:ng(l.id)})}),i.push({id:`scout:interrupt:${l.id}`,label:`Interrupt ${l.name}`,action:()=>{r(l.id)}});return i},[t,r,e,s])}function YZ(){const{agents:e,onlineCount:t}=Ft();return e.length===0?{label:"offline",color:"neutral"}:t===0?{label:`0/${e.length} agents`,color:"amber"}:{label:`${t}/${e.length} agents`,color:"emerald"}}const GZ={inbox:"Home",conversation:"Conversation","agent-info":"Agent",agents:"Agents",fleet:"Fleet",sessions:"Sessions",activity:"Activity",mesh:"Mesh",settings:"Settings",work:"Work"};function XZ(){const{route:e}=Ft(),t=GZ[e.view]??e.view;return b.createElement("span",{className:"text-[10px] font-mono uppercase tracking-wider text-white/40"},t)}function KZ(){const{navigate:e}=Ft();return b.createElement("button",{onClick:()=>e({view:"settings"}),className:"px-2 py-1 rounded-sm text-[11px] font-mono uppercase tracking-wider text-white/60 hover:text-white/90 hover:bg-white/[0.04] border border-white/[0.06] transition-colors"},"Pair device")}function WZ(){return"panel"}function JZ(){const{onboarding:e,onboardingSkipped:t,skipOnboarding:s}=Ft();if(!e)return null;if(t)return{active:!1,dismissible:!0};const r=!e.hasLocalConfig,i=!e.hasProjectConfig,l=!e.hasOperatorName;return{active:r||l||i,dismissible:!0,onDismiss:s}}const QZ=[{commandId:"nav:home",title:"Go to Home",description:"Navigate to the home screen showing the agent inbox",category:"navigation",keywords:["home","inbox","dashboard"],shortcut:"Cmd+1"},{commandId:"nav:agents",title:"Go to Agents",description:"Navigate to the agents roster showing all registered agents",category:"navigation",keywords:["agents","roster","list"],shortcut:"Cmd+2"},{commandId:"nav:fleet",title:"Go to Fleet",description:"Navigate to the fleet overview with agent status summary",category:"navigation",keywords:["fleet","overview","status"],shortcut:"Cmd+3"},{commandId:"nav:sessions",title:"Go to Sessions",description:"Navigate to the sessions list showing all active conversations",category:"navigation",keywords:["sessions","conversations","threads"],shortcut:"Cmd+4"},{commandId:"nav:activity",title:"Go to Activity",description:"Navigate to the activity feed showing recent events",category:"navigation",keywords:["activity","feed","events","log"],shortcut:"Cmd+5"},{commandId:"nav:mesh",title:"Go to Mesh",description:"Navigate to the mesh network view showing nodes and topology",category:"navigation",keywords:["mesh","network","nodes","peers","topology"],shortcut:"Cmd+6"},{commandId:"nav:settings",title:"Open Settings",description:"Open the settings screen for pairing, identity, and relay config",category:"settings",keywords:["settings","preferences","config","pair"],shortcut:"Cmd+,"},{commandId:"nav:pair",title:"Pair Device",description:"Open the device pairing flow to connect a mobile device",category:"settings",keywords:["pair","qr","device","phone","mobile"]},{commandId:"scout:reload",title:"Reload Agents",description:"Refresh the agent list and message state from the broker",category:"workspace",keywords:["reload","refresh","sync"]},{commandId:"scout:open:*",title:"Open Agent Conversation",description:"Open a direct message conversation with a specific agent. The commandId is scout:open:{agentId} where agentId comes from the current agent roster.",category:"navigation",keywords:["open","chat","conversation","dm","message"],params:[{name:"agentId",description:"The agent identifier to open",type:"string"}]},{commandId:"scout:send:*",title:"Send Message to Agent",description:"Send a text message to a specific agent. The commandId is scout:send:{agentId}. Requires a message parameter.",category:"workspace",keywords:["send","message","tell","ask","request"],params:[{name:"agentId",description:"The agent identifier to message",type:"string"},{name:"message",description:"The message body to send",type:"string"}]},{commandId:"scout:interrupt:*",title:"Interrupt Agent",description:"Send Ctrl-C to interrupt a working agent. The commandId is scout:interrupt:{agentId}.",category:"workspace",keywords:["stop","interrupt","cancel","halt","kill"],dangerous:!0,params:[{name:"agentId",description:"The agent identifier to interrupt",type:"string"}]}],eH={id:"openscout",name:"Scout",description:"All your agents, one message away. Scout is a control plane for managing coding agents — it shows their status, routes messages between them, and lets you steer, interrupt, or dispatch work to any agent in the fleet.",mode:"panel",Provider:aB,leftPanel:{title:"Scout",icon:b.createElement(XV,{size:12})},slots:{Content:xZ,LeftPanel:OZ,Inspector:_Z,Takeover:DZ},intents:QZ,hooks:{useCommands:qZ,useStatus:YZ,useNavCenter:XZ,useNavActions:KZ,useLayoutMode:WZ,useTakeover:JZ}},QC=document.getElementById("root");if(!QC)throw new Error("missing #root");x2.createRoot(QC).render(d.jsx(b.StrictMode,{children:d.jsx(_V,{app:eH})}));export{YS as F,qS as f,d as j,b as r};