diff --git a/console/embedded/admin_ecma.cpp b/console/embedded/admin_ecma.cpp index 2c114453..c2c7fda3 100644 --- a/console/embedded/admin_ecma.cpp +++ b/console/embedded/admin_ecma.cpp @@ -174,51 +174,51 @@ R"DELIM(/*! * SOFTWARE. */ (function(){const i=document.createElement("link").relList;if(i&&i.supports&&i.supports("modulepreload"))return;for(const u of document.querySelectorAll('link[rel="modulepreload"]'))l(u);new MutationObserver(u=>{for(const f of u)if(f.type==="childList")for(const d of f.addedNodes)d.tagName==="LINK"&&d.rel==="modulepreload"&&l(d)}).observe(document,{childList:!0,subtree:!0});function a(u){const f={};return u.integrity&&(f.integrity=u.integrity),u.referrerPolicy&&(f.referrerPolicy=u.referrerPolicy),u.crossOrigin==="use-credentials"?f.credentials="include":u.crossOrigin==="anonymous"?f.credentials="omit":f.credentia)DELIM" -R"DELIM(ls="same-origin",f}function l(u){if(u.ep)return;u.ep=!0;const f=a(u);fetch(u.href,f)}})();function r1(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var Am={exports:{}},pu={};var W0;function zz(){if(W0)return pu;W0=1;var n=Symbol.for("react.transitional.element"),i=Symbol.for("react.fragment");function a(l,u,f){var d=null;if(f!==void 0&&(d=""+f),u.key!==void 0&&(d=""+u.key),"key"in u){f={};for(var m in u)m!=="key"&&(f[m]=u[m])}else f=u;return u=f.ref,{$$typeof:n,type:l,key:d,ref:u!==void 0?u:null,props:f}}return pu.Fragment=i,pu.jsx=a,pu.jsxs=a,pu}var eb;function Tz(){return eb||(eb=1,Am.exports=zz()),Am.exports}var x=Tz(),Mm={exports:{}},Ze={};var tb;function Ez(){if(tb)return Ze;tb=1;var n=Symbol.for("react.transitional.element"),i=Symbol.for("react.portal"),a=Symbol.for("react.fragment"),l=Symbol.for("react.strict_mode"),u=Symbol.for("react.profiler"),f=Symbol.for("react.consumer"),d=Symbol.for("react.context"),m=Symbol.for("react.forward_ref"),p=Symbol.for("react.suspense"),g=Symbol.for("react.memo"),b=Symbol.for("react.lazy"),y=Symbol.for("react.activity"),w=Symbol.for("react.view_transition"),O=Symbol.iterator;function T(M){return M===null||typeof M!="object"?null:(M=O&&M[O]||M["@@iterator"],typeof M=="function"?M:null)}var A={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},k=Object.assign,L={};function D(M,F,le){this.props=M,this.context=F,this.refs=L,this.updater=le||A}D.prototype.isReactComponent={},D.prototype.setState=function(M,F){if(typeof M!="object"&&typeof M!="function"&&M!=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,M,F,"setState")},D.prototype.forceUpdate=function(M){this.updater.enqueueForceUpdate(this,M,"forceUpdate")};function X(){}X.prototype=D.prototype;function G(M,F,le){this.props=M,this.context=F,this.refs=L,this.updater=le||A}var ee=G.prototype=new X;ee.constructor=G,k(ee,D.prototype),ee.isPureReactComponent=!0;var V=Array.isArray;function ne(){}var ae={H:null,A:null,T:null,S:null},ye=Object.prototype.hasOwnProperty;function ue(M,F,le){var re=le.ref;return{$$typeof:n,type:M,key:F,ref:re!==void 0?re:null,props:le}}function J(M,F){return ue(M.type,F,M.props)}function we(M){return typeof M=="object"&&M!==null&&M.$$typeof===n}function he(M){var F={"=":"=0",":":"=2"};return"$"+M.replace(/[=:]/g,function(le){return F[le]})}var Oe=/\/+/g;function fe(M,F){return typeof M=="object"&&M!==null&&M.key!=null?he(""+M.key):F.toString(36)}function Q(M){switch(M.status){case"fulfilled":return M.value;case"rejected":throw M.reason;default:switch(typeof M.status=="string"?M.then(ne,ne):(M.status="pending",M.then(function(F){M.status==="pending"&&(M.status="fulfilled",M.value=F)},function(F){M.status==="pending"&&(M.status="rejected",M.reason=F)})),M.status){case"fulfilled":return M.value;case"rejected":throw M.reason}}throw M}function W(M,F,le,re,$e){var Ue=typeof M;(Ue==="undefined"||Ue==="boolean")&&(M=null);var Ae=!1;if(M===null)Ae=!0;else switch(Ue){case"bigint":case"string":case"number":Ae=!0;break;case"object":switch(M.$$typeof){case n:case i:Ae=!0;break;case b:return Ae=M._init,W(Ae(M._payload),F,le,re,$e)}}if(Ae)return $e=$e(M),Ae=re===""?"."+fe(M,0):re,V($e)?(le="",Ae!=null&&(le=Ae.replace(Oe,"$&/")+"/"),W($e,F,le,"",function(Bt){return Bt})):$e!=null&&(we($e)&&($e=J($e,le+($e.key==null||M&&M.key===$e.key?"":(""+$e.key).replace(Oe,"$&/")+"/")+Ae)),F.push($e)),1;Ae=0;var pe=re===""?".":re+":";if(V(M))for(var Ne=0;Ne>>1,Se=Q[Me];if(0>>1;Meu(be,xe))Mu(F,be)?(Q[Me]=F,Q[M]=xe,Me=M):(Q[Me]=be,Q[Re]=xe,Me=Re);else if(Mu(F,xe))Q[Me]=F,Q[M]=xe,Me=M;else break e}}return W}function u(Q,W){var xe=Q.sortIndex-W.sortIndex;return xe!==0?xe:Q.id-W.id}if(n.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var f=performance;n.unstable_now=function(){return f.now()}}else{var d=Date,m=d.now();n.unstable_now=function(){return d.now()-m}}var p=[],g=[],b=1,y=null,w=3,O=!1,T=!1,A=!1,k=!1,L=typeof setTimeout=="function"?setTimeout:null,D=typeof clearTimeout=="function"?clearTimeout:null,X=typeof setImmediate<"u"?setImmediate:null;function G(Q){for(var W=a(g);W!==null;){if(W.callback===null)l(g);else if(W.startTime<=Q)l(g),W.sortIndex=W.expirationTime,i(p,W);else break;W=a(g)}}function ee(Q){if(A=!1,G(Q),!T)if(a(p)!==null)T=!0,V||(V=!0,we());else{var W=a(g);W!==null&&fe(ee,W.startTime-Q)}}var V=!1,ne=-1,ae=5,ye=-1;function ue(){return k?!0:!(n.unstable_now()-yeQ&&ue());){var Me=y.callback;if(typeof Me=="function"){y.callback=null,w=y.priorityLevel;var Se=Me(y.expirationTime<=Q);if(Q=n.unstable_now(),typeof Se=="function"){y.callback=Se,G(Q),W=!0;break t}y===a(p)&&l(p),G(Q)}else l(p);y=a(p)}if(y!==null)W=!0;else{var Be=a(g);Be!==null&&fe(ee,Be.startTime-Q),W=!1}}break e}finally{y=null,w=xe,O=!1}W=void 0}}finally{W?we():V=!1}}}var we;if(typeof X=="function")we=function(){X(J)};else if(typeof MessageChannel<"u"){var he=new MessageChannel,Oe=he.port2;he.port1.onmessage=J,we=function(){Oe.postMessage(null)}}else we=function(){L(J,0)};function fe(Q,W){ne=L(function(){Q(n.unstable_now())},W)}n.unstable_IdlePriority=5,n.unstable_ImmediatePriority=1,n.unstable_LowPriority=4,n.unstable_NormalPriority=3,n.unstable_Profiling=null,n.unstable_UserBlockingPriority=2,n.unstable_cancelCallback=function(Q){Q.callback=null},n.unstable_forceFrameRate=function(Q){0>Q||125Me?(Q.sortIndex=xe,i(g,Q),a(p)===null&&Q===a(g)&&(A?(D(ne),ne=-1):A=!0,fe(ee,xe-Me))):(Q.sortIndex=Se,i(p,Q),T||O||(T=!0,V||(V=!0,we()))),Q},n.unstable_shouldYield=ue,n.unstable_wrapCallback=function(Q){var W=w;return function(){var xe=w;w=W;try{return Q.apply(this,arguments)}finally{w=xe}}}})(Rm)),Rm}var rb;function Az(){return rb||(rb=1,km.exports=Nz()),km.exports}var Cm={exports:{}},Cn={};var sb;function Mz(){if(sb)return Cn;sb=1;var n=Ap();function i(b){var y="https://react.dev/errors/"+b;if(1"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(i){console.error(i)}}return n(),Cm.exports=Mz(),Cm.exports}var lb;function kz(){if(lb)return gu;lb=1;var n=Az(),i=Ap(),a=jz();function l(e){var t="https://react.dev/errors/"+e;if(1bi||(e.current=Li[bi],Li[bi]=null,bi--)}function tt(e,t){bi++,Li[bi]=e.current,e.current=t}var gn=En(null),Gt=En(null),In=En(null),ai=En(null);function Hi(e,t){switch(tt(In,t),tt(Gt,e),tt(gn,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?o0(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=o0(t),e=u0(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}Ut(gn),tt(gn,e)}function Ce(){Ut(gn),Ut(Gt),Ut(In)}function me(e){var t=e.memoizedState;t!==null&&(Fl._currentValue=t.memoizedState,tt(ai,e)),t=gn.current;var r=u0(t,e.type);t!==r&&(tt(Gt,e),tt(gn,r))}function nt(e){Gt.current===e&&(Ut(gn),Ut(Gt)),ai.current===e&&(Ut(ai),Fl._currentValue=Bt)}var Zt,qr;function Zn(e){if(Zt===void 0)try{throw Error()}catch(r){var t=r.stack.trim().match(/\n( *(at )?)/);Zt=t&&t[1]||"",qr=-1>>1,Se=Q[Me];if(0>>1;Meu(be,xe))Mu(F,be)?(Q[Me]=F,Q[M]=xe,Me=M):(Q[Me]=be,Q[Re]=xe,Me=Re);else if(Mu(F,xe))Q[Me]=F,Q[M]=xe,Me=M;else break e}}return W}function u(Q,W){var xe=Q.sortIndex-W.sortIndex;return xe!==0?xe:Q.id-W.id}if(n.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var f=performance;n.unstable_now=function(){return f.now()}}else{var d=Date,m=d.now();n.unstable_now=function(){return d.now()-m}}var p=[],g=[],b=1,y=null,w=3,O=!1,T=!1,A=!1,k=!1,L=typeof setTimeout=="function"?setTimeout:null,D=typeof clearTimeout=="function"?clearTimeout:null,X=typeof setImmediate<"u"?setImmediate:null;function G(Q){for(var W=a(g);W!==null;){if(W.callback===null)l(g);else if(W.startTime<=Q)l(g),W.sortIndex=W.expirationTime,i(p,W);else break;W=a(g)}}function ee(Q){if(A=!1,G(Q),!T)if(a(p)!==null)T=!0,V||(V=!0,we());else{var W=a(g);W!==null&&fe(ee,W.startTime-Q)}}var V=!1,ne=-1,ae=5,ye=-1;function ue(){return k?!0:!(n.unstable_now()-yeQ&&ue());){var Me=y.callback;if(typeof Me=="function"){y.callback=null,w=y.priorityLevel;var Se=Me(y.expirationTime<=Q);if(Q=n.unstable_now(),typeof Se=="function"){y.callback=Se,G(Q),W=!0;break t}y===a(p)&&l(p),G(Q)}else l(p);y=a(p)}if(y!==null)W=!0;else{var Be=a(g);Be!==null&&fe(ee,Be.startTime-Q),W=!1}}break e}finally{y=null,w=xe,O=!1}W=void 0}}finally{W?we():V=!1}}}var we;if(typeof X=="function")we=function(){X(J)};else if(typeof MessageChannel<"u"){var he=new MessageChannel,Oe=he.port2;he.port1.onmessage=J,we=function(){Oe.postMessage(null)}}else we=function(){L(J,0)};function fe(Q,W){ne=L(function(){Q(n.unstable_now())},W)}n.unstable_IdlePriority=5,n.unstable_ImmediatePriority=1,n.unstable_LowPriority=4,n.unstable_NormalPriority=3,n.unstable_Profiling=null,n.unstable_UserBlockingPriority=2,n.unstable_cancelCallback=function(Q){Q.callback=null},n.unstable_forceFrameRate=function(Q){0>Q||125Me?(Q.sortIndex=xe,i(g,Q),a(p)===null&&Q===a(g)&&(A?(D(ne),ne=-1):A=!0,fe(ee,xe-Me))):(Q.sortIndex=Se,i(p,Q),T||O||(T=!0,V||(V=!0,we()))),Q},n.unstable_shouldYield=ue,n.unstable_wrapCallback=function(Q){var W=w;return function(){var xe=w;w=W;try{return Q.apply(this,arguments)}finally{w=xe}}}})(Rm)),Rm}var rb;function jz(){return rb||(rb=1,km.exports=Mz()),km.exports}var Cm={exports:{}},Cn={};var sb;function kz(){if(sb)return Cn;sb=1;var n=Ap();function i(b){var y="https://react.dev/errors/"+b;if(1"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(i){console.error(i)}}return n(),Cm.exports=kz(),Cm.exports}var lb;function Cz(){if(lb)return gu;lb=1;var n=jz(),i=Ap(),a=Rz();function l(e){var t="https://react.dev/errors/"+e;if(1bi||(e.current=Li[bi],Li[bi]=null,bi--)}function tt(e,t){bi++,Li[bi]=e.current,e.current=t}var vn=En(null),Gt=En(null),Kn=En(null),li=En(null);function Hi(e,t){switch(tt(Kn,t),tt(Gt,e),tt(vn,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?o0(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=o0(t),e=u0(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}Ut(vn),tt(vn,e)}function Ce(){Ut(vn),Ut(Gt),Ut(Kn)}function me(e){var t=e.memoizedState;t!==null&&(Fl._currentValue=t.memoizedState,tt(li,e)),t=vn.current;var r=u0(t,e.type);t!==r&&(tt(Gt,e),tt(vn,r))}function nt(e){Gt.current===e&&(Ut(vn),Ut(Gt)),li.current===e&&(Ut(li),Fl._currentValue=Bt)}var Zt,qr;function Zn(e){if(Zt===void 0)try{throw Error()}catch(r){var t=r.stack.trim().match(/\n( *(at )?)/);Zt=t&&t[1]||"",qr=-1)":-1o||N[s]!==Z[o]){var q=` -`+N[s].replace(" at new "," at ");return e.displayName&&q.includes("")&&(q=q.replace("",e.displayName)),q}while(1<=s&&0<=o);break}}}finally{li=!1,Error.prepareStackTrace=r}return(r=e?e.displayName||e.name:"")?Zn(r):""}function Pn(e,t){switch(e.tag){case 26:case 27:case 5:return Zn(e.type);case 16:return Zn("Lazy");case 13:return e.child!==t&&t!==null?Zn("Suspense Fallback"):Zn("Suspense");case 19:return Zn("SuspenseList");case 0:case 15:return nr(e.type,!1);case 11:return nr(e.type.render,!1);case 1:return nr(e.type,!0);case 31:return Zn("Activity");case 30:return Zn("ViewTransition");default:return""}}function Kn(e){try{var t="",r=null;do t+=Pn(e,r),r=e,e=e.return;while(e);return t}catch(s){return` +`+N[s].replace(" at new "," at ");return e.displayName&&q.includes("")&&(q=q.replace("",e.displayName)),q}while(1<=s&&0<=o);break}}}finally{oi=!1,Error.prepareStackTrace=r}return(r=e?e.displayName||e.name:"")?Zn(r):""}function Gn(e,t){switch(e.tag){case 26:case 27:case 5:return Zn(e.type);case 16:return Zn("Lazy");case 13:return e.child!==t&&t!==null?Zn("Suspense Fallback"):Zn("Suspense");case 19:return Zn("SuspenseList");case 0:case 15:return nr(e.type,!1);case 11:return nr(e.type.render,!1);case 1:return nr(e.type,!0);case 31:return Zn("Activity");case 30:return Zn("ViewTransition");default:return""}}function Yn(e){try{var t="",r=null;do t+=Gn(e,r),r=e,e=e.return;while(e);return t}catch(s){return` Error generating stack: `+s.message+` -`+s.stack}}var vn=Object.prototype.hasOwnProperty,Gn=n.unstable_scheduleCallback,ia=n.unstable_cancelCallback,il=n.unstable_shouldYield,ms=n.unstable_requestPaint,Yt=n.unstable_now,rl=n.unstable_getCurrentPriorityLevel,Yn=n.unstable_ImmediatePriority,sl=n.unstable_UserBlockingPriority,ra=n.unstable_NormalPriority,dd=n.unstable_LowPriority,Vu=n.unstable_IdlePriority,hd=n.log,md=n.unstable_setDisableYieldValue,sa=null,Ft=null;function Tt(e){if(typeof hd=="function"&&md(e),Ft&&typeof Ft.setStrictMode=="function")try{Ft.setStrictMode(sa,e)}catch{}}var Nt=Math.clz32?Math.clz32:oi,ps=Math.log,gs=Math.LN2;function oi(e){return e>>>=0,e===0?32:31-(ps(e)/gs|0)|0}var ir=256,rr=262144,aa=4194304;function Sr(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&-e;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function al(e,t,r){var s=e.pendingLanes;if(s===0)return 0;var o=0,c=e.suspendedLanes,h=e.pingedLanes;e=e.warmLanes;var _=s&134217727;return _!==0?(s=_&~c,s!==0?o=Sr(s):(h&=_,h!==0?o=Sr(h):r||(r=_&~e,r!==0&&(o=Sr(r))))):(_=s&~c,_!==0?o=Sr(_):h!==0?o=Sr(h):r||(r=s&~e,r!==0&&(o=Sr(r)))),o===0?0:t!==0&&t!==o&&(t&c)===0&&(c=o&-o,r=t&-t,c>=r||c===32&&(r&4194048)!==0)?t:o}function la(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function xr(e,t){(t&8)!==0&&(t|=t&32);var r=e.entangledLanes;if(r!==0)for(e=e.entanglements,r&=t;0r;r++)t.push(e);return t}function ui(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function un(e,t,r,s,o,c){var h=e.pendingLanes;e.pendingLanes=r,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=r,e.entangledLanes&=r,e.errorRecoveryDisabledLanes&=r,e.shellSuspendCounter=0;var _=e.entanglements,N=e.expirationTimes,Z=e.hiddenUpdates;for(r=h&~r;0"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),No=!1;if(ar)try{var ga={};Object.defineProperty(ga,"passive",{get:function(){No=!0}}),window.addEventListener("test",ga,ga),window.removeEventListener("test",ga,ga)}catch{No=!1}var Er=null,wi=null,zi=null;function Or(){if(zi)return zi;var e,t=wi,r=t.length,s,o="value"in Er?Er.value:Er.textContent,c=o.length;for(e=0;e=P),ce=" ",de=!1;function ge(e,t){switch(e){case"keyup":return R.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function De(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Ie=!1;function Je(e,t){switch(e){case"compositionend":return De(t);case"keypress":return t.which!==32?null:(de=!0,ce);case"textInput":return e=t.data,e===ce&&de?null:e;default:return null}}function qe(e,t){if(Ie)return e==="compositionend"||!H&&ge(e,t)?(e=Or(),zi=wi=Er=null,Ie=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function Sg(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function xg(e,t){var r=Sg(e);e=0;for(var s;r;){if(r.nodeType===3){if(s=e+r.textContent.length,e<=t&&s>=t)return{node:r,offset:t-e};e=s}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=Sg(r)}}function wg(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?wg(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function zg(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Sd(e.document);t instanceof e.HTMLIFrameElement;){try{var r=typeof t.contentWindow.location.href=="string"}catch{r=!1}if(r)e=t.contentWindow;else break;t=Sd(e.document)}return t}function xd(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}var kx=ar&&"documentMode"in document&&11>=document.documentMode,yl=null,wd=null,Do=null,zd=!1;function Tg(e,t,r){var s=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;zd||yl==null||yl!==Sd(s)||(s=yl,"selectionStart"in s&&xd(s)?s={start:s.selectionStart,end:s.selectionEnd}:(s=(s.ownerDocument&&s.ownerDocument.defaultView||window).getSelection(),s={anchorNode:s.anchorNode,anchorOffset:s.anchorOffset,focusNode:s.focusNode,focusOffset:s.focusOffset}),Do&&Ss(Do,s)||(Do=s,s=tf(wd,"onSelect"),0>=h,o-=h,Ar=1<<32-Nt(t)+o|r<ke?(sn=Ee,Ee=null):sn=Ee.sibling;var Xe=C(U,Ee,$[ke],I);if(Xe===null){Ee===null&&(Ee=sn);break}e&&Ee&&Xe.alternate===null&&t(U,Ee),j=c(Xe,j,ke),Fe===null?ve=Xe:Fe.sibling=Xe,Fe=Xe,Ee=sn}if(ke===$.length)return r(U,Ee),Ve&&ts(U,ke),ve;if(Ee===null){for(;ke<$.length;ke++)Ee=K(U,$[ke],I),Ee!==null&&(j=c(Ee,j,ke),Fe===null?ve=Ee:Fe.sibling=Ee,Fe=Ee);return Ve&&ts(U,ke),ve}for(Ee=s(Ee);ke<$.length;ke++)sn=B(Ee,U,ke,$[ke],I),sn!==null&&(e&&(Xe=sn.alternate,Xe!==null&&Ee.delete(Xe.key===null?ke:Xe.key)),j=c(sn,j,ke),Fe===null?ve=sn:Fe.sibling=sn,Fe=sn);return e&&Ee.forEach(function(Ps){return t(U,Ps)}),Ve&&ts(U,ke),ve}function _e(U,j,$,I){if($==null)throw Error(l(151));for(var ve=null,Fe=null,Ee=j,ke=j=0,sn=null,Xe=$.next();Ee!==null&&!Xe.done;ke++,Xe=$.next()){Ee.index>ke?(sn=Ee,Ee=null):sn=Ee.sibling;var Ps=C(U,Ee,Xe.value,I);if(Ps===null){Ee===null&&(Ee=sn);break}e&&Ee&&Ps.alternate===null&&t(U,Ee),j=c(Ps,j,ke),Fe===null?ve=Ps:Fe.sibling=Ps,Fe=Ps,Ee=sn}if(Xe.done)return r(U,Ee),Ve&&ts(U,ke),ve;if(Ee===null){for(;!Xe.done;ke++,Xe=$.next())Xe=K(U,Xe.value,I),Xe!==null&&(j=c(Xe,j,ke),Fe===null?ve=Xe:Fe.sibling=Xe,Fe=Xe);return Ve&&ts(U,ke),ve}for(Ee=s(Ee);!Xe.done;ke++,Xe=$.next())Xe=B(Ee,U,ke,Xe.value,I),Xe!==null&&(e&&(sn=Xe.alternate,sn!==null&&Ee.delete(sn.key===null?ke:sn.key)),j=c(Xe,j,ke),Fe===null?ve=Xe:Fe.sibling=Xe,Fe=Xe);return e&&Ee.forEach(function(wz){return t(U,wz)}),Ve&&ts(U,ke),ve}function He(U,j,$,I){if(typeof $=="object"&&$!==null&&$.type===J&&$.key===null&&$.props.ref===void 0&&($=$.props.children),typeof $=="object"&&$!==null){switch($.$$typeof){case ye:e:{for(var ve=$.key;j!==null;){if(j.key===ve){if(ve=$.type,ve===J){if(j.tag===7){r(U,j.sibling),I=o(j,$.props.children),Es(I,$),I.return=U,U=I;break e}}else if(j.elementType===ve||typeof ve=="object"&&ve!==null&&ve.$$typeof===Se&&Ca(ve)===j.type){r(U,j.sibling),I=o(j,$.props),Es(I,$),I.return=U,U=I;break e}r(U,j);break}else t(U,j);j=j.sibling}$.type===J?(I=Oa($.props.children,U.mode,I,$.key),Es(I,$),I.return=U,U=I):(I=ac($.type,$.key,$.props,null,U.mode,I),Es(I,$),I.return=U,U=I)}return h(U);case ue:e:{for(ve=$.key;j!==null;){if(j.key===ve)if(j.tag===4&&j.stateNode.containerInfo===$.containerInfo&&j.stateNode.implementation===$.implementation){r(U,j.sibling),I=o(j,$.children||[]),I.return=U,U=I;break e}else{r(U,j);break}else t(U,j);j=j.sibling}I=jd($,U.mode,I),I.return=U,U=I}return h(U);case Se:return $=Ca($),He(U,j,$,I)}if(Ae($))return oe(U,j,$,I);if(re($)){if(ve=re($),typeof ve!="function")throw Error(l(150));return $=ve.call($),_e(U,j,$,I)}if(typeof $.then=="function")return He(U,j,gc($),I);if($.$$typeof===fe)return He(U,j,dc(U,$),I);vc(U,$)}return typeof $=="string"&&$!==""||typeof $=="number"||typeof $=="bigint"?($=""+$,j!==null&&j.tag===6?(r(U,j.sibling),I=o(j,$),I.return=U,U=I):(r(U,j),I=Md($,U.mode,I),I.return=U,U=I),h(U)):r(U,j)}return function(U,j,$,I){try{Bo=0;var ve=He(U,j,$,I);return Ol=null,ve}catch(Ee){if(Ee===El||Ee===mc)throw Ee;var Fe=fi(29,Ee,null,U.mode);return Fe.lanes=I,Fe.return=U,Fe}}}var Ua=Fg(!0),Qg=Fg(!1),Os=!1;function Bd(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function qd(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Ns(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function As(e,t,r){var s=e.updateQueue;if(s===null)return null;if(s=s.shared,(it&2)!==0){var o=s.pending;return o===null?t.next=t:(t.next=o.next,o.next=t),s.pending=t,t=sc(e),Rg(e,null,r),t}return rc(e,s,t,r),sc(e)}function qo(e,t,r){if(t=t.updateQueue,t!==null&&(t=t.shared,(r&4194048)!==0)){var s=t.lanes;s&=e.pendingLanes,r|=s,t.lanes=r,Jt(e,r)}}function Vd(e,t){var r=e.updateQueue,s=e.alternate;if(s!==null&&(s=s.updateQueue,r===s)){var o=null,c=null;if(r=r.firstBaseUpdate,r!==null){do{var h={lane:r.lane,tag:r.tag,payload:r.payload,callback:null,next:null};c===null?o=c=h:c=c.next=h,r=r.next}while(r!==null);c===null?o=c=t:c=c.next=t}else o=c=t;r={baseState:s.baseState,firstBaseUpdate:o,lastBaseUpdate:c,shared:s.shared,callbacks:s.callbacks},e.updateQueue=r;return}e=r.lastBaseUpdate,e===null?r.firstBaseUpdate=t:e.next=t,r.lastBaseUpdate=t}var Id=!1;function Vo(){if(Id){var e=Tl;if(e!==null)throw e}}function Io(e,t,r,s){Id=!1;var o=e.updateQueue;Os=!1;var c=o.firstBaseUpdate,h=o.lastBaseUpdate,_=o.share)DELIM" -R"DELIM(d.pending;if(_!==null){o.shared.pending=null;var N=_,Z=N.next;N.next=null,h===null?c=Z:h.next=Z,h=N;var q=e.alternate;q!==null&&(q=q.updateQueue,_=q.lastBaseUpdate,_!==h&&(_===null?q.firstBaseUpdate=Z:_.next=Z,q.lastBaseUpdate=N))}if(c!==null){var K=o.baseState;h=0,q=Z=N=null,_=c;do{var C=_.lane&-536870913,B=C!==_.lane;if(B?(Ye&C)===C:(s&C)===C){C!==0&&C===ka&&(Id=!0),q!==null&&(q=q.next={lane:0,tag:_.tag,payload:_.payload,callback:null,next:null});e:{var oe=e,_e=_;C=t;var He=r;switch(_e.tag){case 1:if(oe=_e.payload,typeof oe=="function"){K=oe.call(He,K,C);break e}K=oe;break e;case 3:oe.flags=oe.flags&-65537|128;case 0:if(oe=_e.payload,C=typeof oe=="function"?oe.call(He,K,C):oe,C==null)break e;K=ne({},K,C);break e;case 2:Os=!0}}C=_.callback,C!==null&&(e.flags|=64,B&&(e.flags|=8192),B=o.callbacks,B===null?o.callbacks=[C]:B.push(C))}else B={lane:C,tag:_.tag,payload:_.payload,callback:_.callback,next:null},q===null?(Z=q=B,N=K):q=q.next=B,h|=C;if(_=_.next,_===null){if(_=o.shared.pending,_===null)break;B=_,_=B.next,B.next=null,o.lastBaseUpdate=B,o.shared.pending=null}}while(!0);q===null&&(N=K),o.baseState=N,o.firstBaseUpdate=Z,o.lastBaseUpdate=q,c===null&&(o.shared.lanes=0),Us|=h,e.lanes=h,e.memoizedState=K}}function Jg(e,t){if(typeof e!="function")throw Error(l(191,e));e.call(t)}function Xg(e,t){var r=e.callbacks;if(r!==null)for(e.callbacks=null,e=0;ec?c:8;var h=pe.T,_={};_.types=h!==null?h.types:null,pe.T=_,ch(e,!1,t,r);try{var N=o(),Z=pe.S;if(Z!==null&&Z(_,N),N!==null&&typeof N=="object"&&typeof N.then=="function"){var q=Vx(N,s);Yo(e,t,q,ki(e))}else Yo(e,t,s,ki(e))}catch(K){Yo(e,t,{then:function(){},status:"rejected",reason:K},ki())}finally{Ne.p=c,h!==null&&_.types!==null&&(h.types=_.types),pe.T=h}}function Fx(){}function oh(e,t,r,s){if(e.tag!==5)throw Error(l(476));var o=Mv(e).queue;Av(e,o,t,Bt,r===null?Fx:function(){return jv(e),r(s)})}function Mv(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:Bt,baseState:Bt,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ss,lastRenderedState:Bt},next:null};var r={};return t.next={memoizedState:r,baseState:r,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ss,lastRenderedState:r},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function jv(e){var t=Mv(e);t.next===null&&(t=e.alternate.memoizedState),Yo(e,t.next.queue,{},ki())}function uh(){return An(Fl)}function kv(){return Xt().memoizedState}function Rv(){return Xt().memoizedState}function Qx(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var r=ki();e=Ns(r);var s=As(t,e,r);s!==null&&(pi(s,t,r),qo(s,t,r)),t={cache:Zd()},e.payload=t;return}t=t.return}}function Jx(e,t,r){var s=ki();r={lane:s,revertLane:0,gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},Oc(e)?Dv(t,r):(r=Nd(e,t,r,s),r!==null&&(pi(r,e,s),Uv(r,t,s)))}function Cv(e,t,r){var s=ki();Yo(e,t,r,s)}function Yo(e,t,r,s){var o={lane:s,revertLane:0,gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null};if(Oc(e))Dv(t,o);else{var c=e.alternate;if(e.lanes===0&&(c===null||c.lanes===0)&&(c=t.lastRenderedReducer,c!==null))try{var h=t.lastRenderedState,_=c(h,r);if(o.hasEagerState=!0,o.eagerState=_,ut(_,h))return rc(e,t,o,0),bt===null&&ic(),!1}catch{}if(r=Nd(e,t,o,s),r!==null)return pi(r,e,s),Uv(r,t,s),!0}return!1}function ch(e,t,r,s){if(s={lane:2,revertLane:em(),gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null},Oc(e)){if(t)throw Error(l(479))}else t=Nd(e,r,s,2),t!==null&&pi(t,e,2)}function Oc(e){var t=e.alternate;return e===Le||t!==null&&t===Le}function Dv(e,t){Nl=_c=!0;var r=e.pending;r===null?t.next=t:(t.next=r.next,r.next=t),e.pending=t}function Uv(e,t,r){if((r&4194048)!==0){var s=t.lanes;s&=e.pendingLanes,r|=s,t.lanes=r,Jt(e,r)}}var Nc={readContext:An,use:wc,useCallback:It,useContext:It,useEffect:It,useImperativeHandle:It,useLayoutEffect:It,useInsertionEffect:It,useMemo:It,useReducer:It,useRef:It,useState:It,useDebugValue:It,useDeferredValue:It,useTransition:It,useSyncExternalStore:It,useId:It,useHostTransitionStatus:It,useFormState:It,useActionState:It,useOptimistic:It,useMemoCache:It,useCacheRefresh:It,useEffectEvent:It},Zv={readContext:An,use:wc,useCallback:function(e,t){return ei().memoizedState=[e,t===void 0?null:t],e},useContext:An,useEffect:_v,useImperativeHandle:function(e,t,r){r=r!=null?r.concat([e]):null,Tc(4194308,4,zv.bind(null,t,e),r)},useLayoutEffect:function(e,t){return Tc(4194308,4,e,t)},useInsertionEffect:function(e,t){Tc(4,2,e,t)},useMemo:function(e,t){var r=ei();t=t===void 0?null:t;var s=e();if(Za){Tt(!0);try{e()}finally{Tt(!1)}}return r.memoizedState=[s,t],s},useReducer:function(e,t,r){var s=ei();if(r!==void 0){var o=r(t);if(Za){Tt(!0);try{r(t)}finally{Tt(!1)}}}else o=t;return s.memoizedState=s.baseState=o,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:o},s.queue=e,e=e.dispatch=Jx.bind(null,Le,e),[s.memoizedState,e]},useRef:function(e){var t=ei();return e={current:e},t.memoizedState=e},useState:function(e){e=ih(e);var t=e.queue,r=Cv.)DELIM" -R"DELIM(bind(null,Le,t);return t.dispatch=r,[e.memoizedState,r]},useDebugValue:ah,useDeferredValue:function(e,t){var r=ei();return lh(r,e,t)},useTransition:function(){var e=ih(!1);return e=Av.bind(null,Le,e.queue,!0,!1),ei().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,r){var s=Le,o=ei();if(Ve){if(r===void 0)throw Error(l(407));r=r()}else{if(r=t(),bt===null)throw Error(l(349));(Ye&127)!==0||rv(s,t,r)}o.memoizedState=r;var c={value:r,getSnapshot:t};return o.queue=c,_v(av.bind(null,s,c,e),[e]),s.flags|=2048,Ml(9,{destroy:void 0},sv.bind(null,s,c,r,t),null),r},useId:function(){var e=ei(),t=bt.identifierPrefix;if(Ve){var r=Mr,s=Ar;r=(s&~(1<<32-Nt(s)-1)).toString(32)+r,t="_"+t+"R_"+r,r=Sc++,0<\/script>",c=c.removeChild(c.firstChild);break;case"select":c=typeof s.is=="string"?h.createElement("select",{is:s.is}):h.createElement("select"),s.multiple?c.multiple=!0:s.size&&(c.size=s.size);break;default:c=typeof s.is=="string"?h.createElement(o,{is:s.is}):h.createElement(o)}}c[At]=t,c[yn]=s;e:for(h=t.child;h!==null;){if(h.tag===5||h.tag===6)c.appendChild(h.stateNode);else if(h.tag!==4&&h.tag!==27&&h.child!==null){h.child.return=h,h=h.child;continue}if(h===t)break e;for(;h.sibling===null;){if(h.return===null||h.return===t)break e;h=h.return}h.sibling.return=h.return,h=h.sibling}t.stateNode=c;e:switch(Rn(c,o,s),o){case"button":case"input":case"select":case"textarea":s=!!s.autoFocus;break e;case"img":s=!0;break e;default:s=!1}s&&ls(t)}}return zt(t),t.subtreeFlags&=-33554433,wh(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,r),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==s&&ls(t);else{if(typeof s!="string"&&t.stateNode===null)throw Error(l(166));if(e=In.current,zl(t)){if(e=t.stateNode,r=t.memoizedProps,s=null,o=Sn,o!==null)switch(o.tag){case 27:case 5:s=o.memoizedProps}e[At]=t,e=!!(e.nodeValue===r||s!==null&&s.suppressHydrationWarning===!0||a0(e.nodeValue,r)),e||zs(t,!0)}else e=lu(e).createTextNode(s),e[At]=t,t.stateNode=e}return zt(t),null;case 31:if(r=t.memoizedState,e===null||e.memoizedState!==null){if(s=zl(t),r!==null){if(e===null){if(!s)throw Error(l(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(l(557));e[At]=t}else Na(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;zt(t),e=!1}else r=Cd(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=r),e=!0;if(!e)return t.flags&256?(Ni(t),t):(Ni(t),null);if((t.flags&128)!==0)throw Error(l(558))}return zt(t),null;case 13:if(s=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(o=zl(t),s!==null&&s.dehydrated!==null){if(e===null){if(!o)throw Error(l(318));if(o=t.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(l(317));o[At]=t}else Na(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;zt(t),o=!1}else o=Cd(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=o),o=!0;if(!o)return t.flags&256?(Ni(t),t):(Ni(t),null)}return Ni(t),(t.flags&128)!==0?(t.lanes=r,t):(r=s!==null,e=e!==null&&e.memoizedState!==null,r&&(s=t.child,o=null,s.alternate!==null&&s.alternate.memoizedState!==null&&s.alternate.memoizedState.cachePool!==null&&(o=s.alternate.memoizedState.cachePool.pool),c=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(c=s.memoizedState.cachePool.pool),c!==o&&(s.flags|=2048)),r!==e&&r&&(t.child.flags|=8192),Cc(t,t.updateQueue),zt(t),null);case 4:return Ce(),e===null&&rm(t.stateNode.containerInfo),t.flags|=67108864,zt(t),null;case 10:return is(t.type),zt(t),null;case 19:if(Yd(t),s=t.memoizedState,s===null)return zt(t),null;if(o=(t.flags&128)!==0,c=s.rendering,c===null)if(o)Qo(s,!1);else{if(Pt!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(c=bc(e),c!==null){for(t.flags|=128,Qo(s,!1),e=c.updateQueue,t.updateQueue=e,Cc(t,e),t.subtreeFlags=0,e=r,r=t.child;r!==null;)Cg(r,e),r=r.sibling;return Po(t,jn.current&1|2),Ve&&ts(t,s.treeForkCount),t.child}e=e.sibling}s.tail!==null&&Yt()>Kc&&(t.flags|=128,o=!0,Qo(s,!1),t.lanes=4194304)}else{if(!o)if(e=bc(c),e!==null){if(t.flags|=128,o=!0,e=e.updateQueue,t.updateQueue=e,Cc(t,e),Qo(s,!0),s.tail===null&&s.tailMode!=="collapsed"&&s.tailMode!=="visible"&&!c.alternate&&!Ve)return zt(t),null}else 2*Yt()-s.renderingStartTime>Kc&&r!==536870912&&(t.flags|=128,o=!0,Qo(s,!1),t.lanes=4194304);s.isBackwards?(c.sibling=t.child,t.child=c):(e=s.last,e!==null?e.sibling=c:t.child=c,s.last=c)}if(s.tail!==null){e=s.tail;e:{for(r=e;r!==null;){if(r.alternate!==null){r=!1;break e}r=r.sibling}r=!0}return s.rendering=e,s.tail=e.sibling,s.renderingStartTime=Yt(),e.sibling=null,c=jn.current,c=o?c&1|2:c&1,s.tailMode==="visible"||s.tailMode==="collapsed"||!r||Ve?Po(t,c):(r=c,tt(Mn,t),tt(jn,r),Vn===null&&(Vn=t)),Ve&&ts(t,s.treeForkCount),e}return zt(t),null;case 22:case 23:return Ni(t),Kd(),s=t.memoizedState!==null,e!==null?e.memoizedState!==null!==s&&(t.flags|=8192):s&&(t.flags|=8192),s?(r&536870912)!==0&&(t.flags&128)===0&&(zt(t),t.subtreeFlags&6&&(t.flags|=8192)):zt(t),r=t.updateQueue,r!==null&&Cc(t,r.retryQueue),r=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(r=e.memoizedState.cachePool.pool),s=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(s=t.memoizedState.cachePool.pool),s!==r&&(t.flags|=2048),e!==null&&Ut(Ra),null;case 24:return r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),is(tn),zt(t),null;case 25:return null;case 30:return t.flags|=33554432,zt(t),null}throw Error(l(156,t.tag))}function rw(e,t){switch(kd(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return is(tn),Ce(),e=t.flags,(e&65536)!==0&)DELIM" -R"DELIM(&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return nt(t),null;case 31:if(t.memoizedState!==null){if(Ni(t),t.alternate===null)throw Error(l(340));Na()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(Ni(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(l(340));Na()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Yd(t),e=t.flags,e&65536?(t.flags=e&-65537|128,e=t.memoizedState,e!==null&&(e.rendering=null,e.tail=null),t.flags|=4,t):null;case 4:return Ce(),null;case 10:return is(t.type),null;case 22:case 23:return Ni(t),Kd(),e!==null&&Ut(Ra),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return is(tn),null;case 25:return null;default:return null}}function oy(e,t){switch(kd(t),t.tag){case 3:is(tn),Ce();break;case 26:case 27:case 5:nt(t);break;case 4:Ce();break;case 31:t.memoizedState!==null&&Ni(t);break;case 13:Ni(t);break;case 19:Yd(t);break;case 10:is(t.type);break;case 22:case 23:Ni(t),Kd(),e!==null&&Ut(Ra);break;case 24:is(tn)}}function Jo(e,t){try{var r=t.updateQueue,s=r!==null?r.lastEffect:null;if(s!==null){var o=s.next;r=o;do{if((r.tag&e)===e){s=void 0;var c=r.create,h=r.inst;s=c(),h.destroy=s}r=r.next}while(r!==o)}}catch(_){ft(t,t.return,_)}}function Rs(e,t,r){try{var s=t.updateQueue,o=s!==null?s.lastEffect:null;if(o!==null){var c=o.next;s=c;do{if((s.tag&e)===e){var h=s.inst,_=h.destroy;if(_!==void 0){h.destroy=void 0,o=t;var N=r,Z=_;try{Z()}catch(q){ft(o,N,q)}}}s=s.next}while(s!==c)}}catch(q){ft(t,t.return,q)}}function uy(e){var t=e.updateQueue;if(t!==null){var r=e.stateNode;try{Xg(t,r)}catch(s){ft(e,e.return,s)}}}function cy(e,t,r){r.props=$a(e.type,e.memoizedProps),r.state=e.memoizedState;try{r.componentWillUnmount()}catch(s){ft(e,t,s)}}function jr(e,t){try{var r=e.ref;if(r!==null){switch(e.tag){case 26:case 27:case 5:var s=e.stateNode;break;case 30:var o=e.stateNode,c=Xr(e.memoizedProps,o);(o.ref===null||o.ref.name!==c)&&(o.ref=v0(c)),s=o.ref;break;case 7:if(e.stateNode===null){var h=new Ri(e);y(e.child,!1,Yw,h,void 0,void 0),e.stateNode=h}s=e.stateNode;break;default:s=e.stateNode}typeof r=="function"?e.refCleanup=r(s):r.current=s}}catch(_){ft(e,t,_)}}function kn(e,t){var r=e.ref,s=e.refCleanup;if(r!==null)if(typeof s=="function")try{s()}catch(o){ft(e,t,o)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof r=="function")try{r(null)}catch(o){ft(e,t,o)}else r.current=null}function Dc(e,t){if((e.tag===5||e.tag===27||e.tag===6)&&e.alternate===null&&t!==null)for(var r=0;r title"))),Rn(s,t,r),s[At]=e,Wt(s),t=s;break e;case"link":if(c=C0("link","href",o).get(t+(r.href||""))){for(h=0;hHe&&(h=He,He=_e,_e=h);var U=xg(_,_e),j=xg(_,He);if(U&&j&&(B.rangeCount!==1||B.anchorNode!==U.node||B.anchorOffset!==U.offset||B.focusNode!==j.node||B.focusOffset!==j.offset)){var $=K.createRange();$.setStart(U.node,U.offset),B.removeAllRanges(),_e>He?(B.addRange($),B.extend(j.node,j.offset)):($.setEnd(j.node,j.offset),B.addRange($))}}}}for(K=[],B=_;B=B.parentNode;)B.nodeType===1&&K.push({element:B,left:B.scrollLeft,top:B.scrollTop});for(typeof _.focus=="function"&&_.focus(),_=0;_r?32:r,pe.T=null,r=Ih,Ih=null;var c=pr,h=Zr;if(Lt=0,qa=pr=null,Zr=0,(it&6)!==0)throw Error(l(331));var _=it;if(it|=4,Ry(c.current),My(c,c.current,h,r),it=_,ru(0,!1),Ft&&typeof Ft.onPostCommitFiberRoot=="function")try{Ft.onPostCommitFiberRoot(sa,c)}catch{}return!0}finally{Ne.p=o,pe.T=s,Yy(e,t)}}function Fy(e,t,r){t=Ii(r,t),t=hh(e.stateNode,t,2),e=As(e,t,2),e!==null&&(ui(e,2),$r(e))}function ft(e,t,r){if(e.tag===3)Fy(e,e,r);else for(;t!==null;){if(t.tag===3){Fy(t,e,r);break}else if(t.tag===1){var s=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof s.componentDidCatch=="function"&&(Zs===null||!Zs.has(s))){e=Ii(r,e),r=Pv(2),s=As(t,r,2),s!==null&&(Kv(r,)DELIM" -R"DELIM(s,t,e),ui(s,2),$r(s));break}}t=t.return}}function Jh(e,t,r){var s=e.pingCache;if(s===null){s=e.pingCache=new ow;var o=new Set;s.set(t,o)}else o=s.get(t),o===void 0&&(o=new Set,s.set(t,o));o.has(r)||(Bh=!0,o.add(r),e=gw.bind(null,e,t,r),t.then(e,e))}function gw(e,t,r){var s=e.pingCache;s!==null&&s.delete(t),e.pingedLanes|=e.suspendedLanes&r,e.warmLanes&=~r,bt===e&&(Ye&r)===r&&((Pt===4||Pt===3&&(Ye&62914560)===Ye&&300>Yt()-Pc)&&(it&2)===0?Bl(e,0):Ic|=r,Ul===Ye&&(Ul=0)),$r(e)}function Qy(e,t){t===0&&(t=vs()),e=Ea(e,t),e!==null&&(ui(e,t),$r(e))}function vw(e){var t=e.memoizedState,r=0;t!==null&&(r=t.retryLane),Qy(e,r)}function yw(e,t){var r=0;switch(e.tag){case 31:case 13:var s=e.stateNode,o=e.memoizedState;o!==null&&(r=o.retryLane);break;case 19:s=e.stateNode;break;case 22:s=e.stateNode._retryCache;break;default:throw Error(l(314))}s!==null&&s.delete(t),Qy(e,r)}function bw(e,t){return Gn(e,t)}var Vl=null,Il=null,Xh=!1,Wc=!1,Wh=!1,Ls=0;function $r(e){e!==Il&&e.next===null&&(Il===null?Vl=Il=e:Il=Il.next=e),Wc=!0,Xh||(Xh=!0,Sw())}function ru(e,t){if(!Wh&&Wc){Wh=!0;do for(var r=!1,s=Vl;s!==null;){if(e!==0){var o=s.pendingLanes;if(o===0)var c=0;else{var h=s.suspendedLanes,_=s.pingedLanes;c=(1<<31-Nt(42|e)+1)-1,c&=o&~(h&~_),c=c&201326741?c&201326741|1:c?c|2:0}c!==0&&(r=!0,e0(s,c))}else c=Ye,c=al(s,s===bt?c:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),(c&3)===0||la(s,c)||(r=!0,e0(s,c));s=s.next}while(r);Wh=!1}}function _w(){Jy()}function Jy(){Wc=Xh=!1;var e=0;Ls!==0&&kw()&&(e=Ls);for(var t=Yt(),r=null,s=Vl;s!==null;){var o=s.next,c=Xy(s,t);c===0?(s.next=null,r===null?Vl=o:r.next=o,o===null&&(Il=r)):(r=s,(e!==0||(c&3)!==0)&&(Wc=!0)),s=o}Lt!==0&&Lt!==5||ru(e),Ls!==0&&(Ls=0)}function Xy(e,t){for(var r=e.suspendedLanes,s=e.pingedLanes,o=e.expirationTimes,c=e.pendingLanes&-62914561;0_)break;var q=N.transferSize,K=N.initiatorType;q&&l0(K)&&(N=N.responseEnd,h+=q*(N<_?1:(_-Z)/(N-Z)))}if(--s,t+=8*(c+h)/(o.duration/1e3),e++,10sf){_e.length=oe;break}$=new Promise($w.bind($)),_e.push($)}}}if(0<_e.length)return C=Promise.race([Promise.all(_e),new Promise(function(ve){return setTimeout(ve,500)})]).then(o,o),(B?Promise.allSettled([B.finished,C]):C).then(c,c);if(o(),B)return B.finished.then(c,c);c()},types:r});Z.__reactViewTransition=q;var K=[];return q.ready.then(function(){for(var C=Z.documentElement.getAnimations({subtree:!0}),B=0;B"u"?null:document;function M0(e,t,r){var s=Kl;if(s&&typeof t=="string"&&t){var o=Qn(t);o='link[rel="'+e+'"][href="'+o+'"]',typeof r=="string"&&(o+='[crossorigin="'+r+'"]'),A0.has(o)||(A0.add(o),e={rel:e,crossOrigin:r,href:t},s.querySelector(o)===null&&(t=s.createElement("link"),Rn(t,"link",e),Wt(t),s.head.appendChild(t)))}}function iz(e){us.D(e),M0("dns-prefetch",e,null)}function rz(e,t){us.C(e,t),M0("preconnect",e,t)}function sz(e,t,r){us.L(e,t,r);var s=Kl;if(s&&e&&t){var o='link[rel="preload"][as="'+Qn(t)+'"]';t==="image"&&r&&r.imageSrcSet?(o+='[imagesrcset="'+Qn(r.imageSrcSet)+'"]',typeof r.imageSizes=="string"&&(o+='[imagesizes="'+Qn(r.imageSizes)+'"]')):o+='[href="'+Qn(e)+'"]';var c=o;switch(t){case"style":c=Gl(e);break;case"script":c=Yl(e)}if(!(Qi.has(c)||(e=ne({rel:"preload",href:t==="image"&&r&&r.imageSrcSet?void 0:e,as:t},r),Qi.set(c,e),s.querySelector(o)!==null||t==="style"&&s.querySelector(uu(c))||t==="script"&&s.querySelector(cu(c))))){var h=s.createElement("link");Rn(h,"link",e),t==="style"&&(h[cn]=!0,h.onload=h.onerror=function(){Iu(h)}),Wt(h),s.head.appendChild(h)}}}function az(e,t){us.m(e,t);var r=Kl;if(r&&e){var s=t&&typeof t.as=="string"?t.as:"script",o='link[rel="modulepreload"][as="'+Qn(s)+'"][href="'+Qn(e)+'"]',c=o;switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":c=Yl(e)}if(!Qi.has(c)&&(e=ne({rel:"modulepreload",href:e},t),Qi.set(c,e),r.querySelector(o)===null)){switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(r.querySelector(cu(c)))return}s=r.createElement("link"),Rn(s,"link",e),Wt(s),r.head.appendChild(s)}}}function lz(e,t,r){us.S(e,t,r);var s=Kl;if(s&&e){var o=bs(s).hoistableStyles,c=Gl(e);t=t||"default";var h=o.get(c);if(!h){var _={loading:0,preload:null};if(h=s.querySelector(uu(c)))_.loading=5;else{e=ne({rel:"stylesheet",href:e,"data-precedence":t},r),(r=Qi.get(c))&&_m(e,r);var N=h=s.createElement("link");Wt(N),Rn(N,"link",e),N._p=new Promise(function(Z,q){N.onload=Z,N.onerror=q}),N.addEventListener("load",function(){_.loading|=1}),N.addEventListener("error",function(){_.loading|=2}),_.loading|=4,nf(h,t,s)}h={type:"stylesheet",instance:h,count:1,state:_},o.set(c,h)}}}function oz(e,t){us.X(e,t);var r=Kl;if(r&&e){var s=bs(r).hoistableScripts,o=Yl(e),c=s.get(o);c||(c=r.querySelector(cu(o)),c||(e=ne({src:e,async:!0},t),(t=Qi.get(o))&&Sm(e,t),c=r.createElement("script"),Wt(c),Rn(c,"link",e),r.head.appendChild(c)),c={type:"script",instance:c,count:1,state:null},s.set(o,c))}}function uz(e,t){us.M(e,t);var r=Kl;if(r&&e){var s=bs(r).hoistableScripts,o=Yl(e),c=s.get(o);c||(c=r.querySelector(cu(o)),c||(e=ne({src:e,async:!0,type:"module"},t),(t=Qi.get(o))&&Sm(e,t),c=r.createElement("script"),Wt(c),Rn(c,"link",e),r.head.appendChild(c)),c={type:"script",instance:c,count:1,state:null},s.set(o,c))}}function j0(e,t,r,s){var o=(o=In.current)?ou(o):null;if(!o)throw Error(l(446));switch(e){case"meta":case"title":return null;case"style":return typeof r.precedence=="string"&&typeof r.href=="string"?(r=Gl(r.href),t=bs(o).hoistableStyles,s=t.get(r),s||(s={type:"style",instance:null,count:0,state:null},t.set(r,s)),s):{type:"void",instance:null,count:0,state:null};case"link":if(r.rel==="stylesheet"&&typeof r.href=="string"&&typeof r.precedence=="string"){e=Gl(r.href);var c=bs(o).hoistableStyles,h=c.get(e);if(h||(o=o.ownerDocument||o,h={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},c.set(e,h),(c=o.querySelector(uu(e)))?c._p||(h.instance=c,h.state.loading=5):(c=Qi.get(e),c||(c={rel:"preload",as:"style",href:r.href,crossOrigin:r.crossOrigin,integrity:r.integrity,media:r.media,hrefLang:r.hrefLang,referrerPolicy:r.referrerPolicy},Qi.set(e,c)),cz(o,e,c,h.state))),t&&s===null)throw Error(l(528,""));return h}if(t&&s!==null)throw Error(l(529,""));return null;case"script":return t=r.async,r=r.src,typeof r=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(r=Yl(r),t=bs(o).hoistableScripts,s=t.get(r),s||(s={type:"script",instance:null,count:0,state:null},t.set(r,s)),s):{type:"void",instance:null,count:0,state:null};default:throw Error(l(444,e))}}function Gl(e){return'href="'+Qn(e)+'"'}function uu(e){return'link[rel="stylesheet"]['+e+"]"}function k0(e){return ne({},e,{"data-precedence":e.precedence,precedence:null})}function cz(e,t,r,s){if(t=e.querySelector('link[rel="preload"][as="style"]['+t+"]")){if(t[cn]!==!0){s.loading=1;return}}else t=e.createElement("link"),t[cn]=!0,t.onload=t.onerror=Iu.bind(null,t),Rn(t,"link",r),Wt(t),e.head.appendChild(t);s.preload=t,t.addEventListener("load",function(){return s.loading|=1}),t.addEventListener("error",function(){return s.loading|=2})}function Yl(e){return'[src="'+Qn(e)+'"]'}function cu(e){return"script[async]"+e}function R0(e,t,r){if(t.count++,t.instance===null)switch(t.type){case"style":var s=e.querySelector('style[data-href~="'+Qn(r.href)+'"]');if(s)return t.instance=s,Wt(s),s;var o=ne({},r,{"data-href":r.href,"data-precedence":r.precedence,href:null,precedence:null});return s=(e.ownerDocument||e).createElement("style"),Wt(s),Rn(s,"style",o),nf(s,r.precedence,e),t.instance=s;case"stylesheet":o=Gl(r.href);var c=e.querySelector(uu(o));if(c)return t.state.loading|=4,t.instance=c,Wt(c),c;s=k0(r),(o=Qi.get(o))&&_m(s,o),c=(e.ownerDocument||e).createElement("link"),Wt(c);var h=c;return h._p=new Promise(function(_,N){h.onload=_,h.onerror=N}),Rn(c,"link",s),t.state.loading|=4,nf(c,r.precedence,e),t.instance=c;case"script":return c=Yl(r.src),(o=e.querySelector(cu(c)))?(t.instance=o,Wt(o),o):(s=r,(o=Qi.get(c))&&(s=ne({},r),Sm(s,o)),e=e.ownerDocument||e,o=e.createElement("script"),Wt(o),Rn(o,"link",s),e.head.appendChild(o),t.instance=o);case"void":return null;default:throw Error(l(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(s=t.instance,t.state.loading|=4,nf(s,r.precedence,e));return t.instance}function nf(e,t,r){for(var s=r.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),o=s.length?s[s.length-1]:null,c=o,h=0;h title"):null)}function fz(e,t,r){if(r===1||t.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;return t.rel==="stylesheet"?(e=t.disabled,typeof t.precedence=="string"&&e==null):!0;case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function D0(e,t){return e==="img"&&t.src!=null&&t.src!==""&&t.onLoad==null&&t.loading!=="lazy"}function U0(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function Z0(e){return(e.width||100)*(e.height||100)*(typeof devicePixelRatio=="number"?devicePixelRatio:1)*.25}function $0(e,t){typeof t.decode=="function"&&(e.imgCount++,t.complete||(e.imgBytes+=Z0(t),e.suspenseyImages.push(t)),e=mz.bind(e),t.decode().then(e,e))}function dz(e,t,r,s){if(r.type==="stylesheet"&&(typeof s.media!="string"||matchMedia(s.media).matches!==!1)&&(r.state.loading&4)===0){if(r.instance===null){var o=Gl(s.href),c=t.querySelector(uu(o));if(c){t=c._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=fu.bind(e),t.then(e,e)),r.state.loading|=4,r.instance=c,Wt(c);return}c=t.ownerDocument||t,s=k0(s),(o=Qi.get(o))&&_m(s,o),c=c.createElement("link"),Wt(c);var h=c;h._p=new Promise(function(_,N){h.onload=_,h.onerror=N}),Rn(c,"link",s),r.instance=c}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(r,t),(t=r.state.preload)&&(r.state.loading&3)===0&&(e.count++,r=fu.bind(e),t.addEventListener("load",r),t.addEventListener("error",r))}}var sf=0;function hz(e,t){return e.stylesheets&&e.count===0&&lf(e,e.stylesheets),0sf?50:800)+t);return e.unsuspend=r,function(){e.unsuspend=null,clearTimeout(s),clearTimeout(o)}}:null}function L0(e){if(e.count===0&&(e.imgCount===0||!e.waitingForImages)){if(e.stylesheets)lf(e,e.stylesheets);else if(e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}}}function fu(){this.count--,L0(this)}function mz(){this.imgCount--,L0(this)}var af=null;function lf(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,af=new Map,t.forEach(pz,e),af=null,fu.call(e))}function pz(e,t){if(!(t.state.loading&4)){var r=af.get(e);if(r)var s=r.get(null);else{r=new Map,af.set(e,r);for(var o=e.querySelectorAll("link[data-precedence],style[data-precedence]"),c=0;c"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(i){console.error(i)}}return n(),jm.exports=kz(),jm.exports}var Cz=Rz();const Dz=r1(Cz),Uz=[{id:"current",label:"Classic"},{id:"light",label:"Light"},{id:"midnight",label:"Midnight"}],Mp="libbitcoinTheme",Rf="libbitcoin-theme-change";function jp(n){return n==="light"||n==="midnight"?n:"current"}function s1(){try{return jp(localStorage.getItem(Mp))}catch{return"current"}}function kp(n){document.documentElement.dataset.theme=n;const i=getComputedStyle(document.documentElement).getPropertyValue("--theme-background").trim();i&&document.querySelector('meta[name="theme-color"]')?.setAttribute("content",i)}function Zz(){kp(s1()),globalThis.addEventListener("storage",Hz)}function $z(n){const i=jp(n);kp(i);try{localStorage.setItem(Mp,i)}catch{}globalThis.dispatchEvent(new Event(Rf))}function Lz(){return jp(document.documentElement.dataset.theme)}function Hz(n){n.key!==null&&n.key!==Mp||(kp(s1()),globalThis.dispatchEvent(new Event(Rf)))}function Bz(n){return globalThis.addEventListener(Rf,n),()=>{globalThis.removeEventListener(Rf,n)}}function Rp(){return se.useSyncExternalStore(Bz,Lz,()=>"current")}function qz(){const n=Rp();return x.jsx("select",{"aria-label":"Theme",value:n,onChange:i=>{$z(i.target.value)},className:"border-accent/40 bg-surface text-textPrimary focus:border-accent focus:ring-)DELIM" -R"DELIM(accent rounded-md border py-1.5 pr-8 pl-3 text-sm",children:Uz.map(i=>x.jsx("option",{value:i.id,children:i.label},i.id))})}const a1="libbitcoinAdminDashboardBrowserNotifications";function l1(){try{return globalThis.window?.localStorage??null}catch{return null}}function Cp(){const n=globalThis.Notification;return typeof n=="function"?n:null}function o1(){return Cp()?.permission??"unsupported"}async function Vz(){const n=Cp();return n?n.permission!=="default"?n.permission:n.requestPermission():"unsupported"}function Iz(n=l1()){try{return o1()==="granted"&&n?.getItem(a1)==="true"}catch{return!1}}function Pz(n,i=l1()){try{i?.setItem(a1,String(n))}catch{}}function Kz(n,i){const a=Cp();if(!a||a.permission!=="granted")return!1;try{return new a(n,i),!0}catch{return!1}}function Gz({browserNotificationsEnabled:n,onClose:i,onBrowserNotificationsEnabledChange:a}){const[l,u]=se.useState(o1),[f,d]=se.useState(!1),[m,p]=se.useState(null),g=n&&l==="granted";async function b(){if(g){a(!1);return}d(!0),p(null);try{const y=await Vz();u(y),y==="granted"?a(!0):y==="denied"&&p("Permission was denied. It can be changed in your browser settings.")}catch{p("The browser could not enable notifications.")}finally{d(!1)}}return x.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 p-4 backdrop-blur-sm",role:"presentation",onMouseDown:y=>{y.target===y.currentTarget&&i()},children:x.jsxs("section",{role:"dialog","aria-modal":"true","aria-labelledby":"settings-title",className:"border-accent/30 bg-surface/95 max-h-[calc(100vh-2rem)] w-full max-w-xl overflow-y-auto rounded-2xl border shadow-2xl shadow-black/50",children:[x.jsxs("header",{className:"border-accent/20 flex items-start justify-between border-b p-5",children:[x.jsx("h2",{id:"settings-title",className:"text-accent text-xl font-semibold",children:"Settings"}),x.jsx("button",{type:"button",onClick:i,className:"text-textMuted hover:text-accent rounded p-1 text-xl","aria-label":"Close settings",children:"×"})]}),x.jsxs("div",{className:"space-y-5 p-5",children:[x.jsx(qz,{}),x.jsxs("div",{className:"border-accentSecondary/20 bg-accent/5 space-y-3 rounded-xl border p-4",children:[x.jsxs("div",{children:[x.jsx("h3",{className:"text-textPrimary text-sm font-medium",children:"Browser notifications"}),x.jsx("p",{id:"browser-notifications-help",className:"text-textMuted mt-1 text-xs",children:Fz(l,g,f)})]}),x.jsx("button",{type:"button","aria-describedby":"browser-notifications-help",disabled:f||l==="unsupported"||l==="denied",onClick:()=>{b()},className:"border-accent/40 text-accent hover:border-accent hover:text-accentSecondary rounded-md border px-3 py-2 text-sm disabled:cursor-not-allowed disabled:opacity-50",children:Yz(l,g,f)}),m&&x.jsx("p",{className:"text-sm text-red-300",role:"alert",children:m})]}),x.jsx("div",{className:"flex justify-end pt-2",children:x.jsx("button",{type:"button",onClick:i,className:"border-accent/40 text-accent hover:border-accent hover:text-accentSecondary rounded-md border px-4 py-2 text-sm",children:"Done"})})]})]})})}function Yz(n,i,a){return a?"Requesting permission…":n==="unsupported"?"Notifications unavailable":n==="denied"?"Blocked by browser":i?"Disable notifications":"Enable notifications"}function Fz(n,i,a){return a?"Waiting for your browser permission choice.":n==="unsupported"?"This browser does not support system notifications.":n==="denied"?"Notifications are blocked. Allow them in your browser settings to enable this feature.":i?"System notifications will appear when the node enters or leaves the near-current range.":"Get a system notification when the node enters or leaves the near-current range."}function Xm(n){const i=Object.values(n).filter(l=>typeof l=="number");return Object.entries(n).filter(([l,u])=>i.indexOf(+l)===-1).map(([l,u])=>u)}function ub(n,i="|"){return n.map(a=>m1(a)).join(i)}function Wm(n,i){return typeof i=="bigint"?i.toString():i}class Qz{constructor(i){this._getter=i,this._value=void 0}get value(){const i=this._getter;return i!==void 0&&(this._value=i(),this._getter=void 0),this._value}}function Dp(n){return new Qz(n)}function Jz(n){return n==null}function Up(n){const i=n.startsWith("^")?1:0,a=n.endsWith("$")?n.length-1:n.length;return n.slice(i,a)}function Xz(n,i){const a=n/i,l=Math.round(a),u=4*Number.EPSILON*Math.max(Math.abs(a),1);return Math.abs(a-l){const m=i._zod.def.shape[f];return l?l(m,f):m}):f1(n,f,l?l(d.value,f):d.value))}}function Wz(n,i){for(const a of Reflect.ownKeys(i)){const l=Object.getOwnPropertyDescriptor(i,a);l.enumerable&&(l.get?c1(n,a,()=>i[a]):f1(n,a,l.value))}}function Di(...n){const i={};for(const a of n){const l=Object.getOwnPropertyDescriptors(a);Object.assign(i,l)}return Object.defineProperties({},i)}function eT(n){return JSON.stringify(n)}function tT(n){return n.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const d1="captureStackTrace"in Error?Error.captureStackTrace:(...n)=>{};function Cf(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}const nT=Dp(()=>{if(er.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const n=Function;return new n(""),!0}catch{return!1}});function io(n){if(Cf(n)===!1)return!1;const i=n.constructor;if(i===void 0||typeof i!="function")return!0;const a=i.prototype;return!(Cf(a)===!1||Object.prototype.hasOwnProperty.call(a,"isPrototypeOf")===!1)}function h1(n){return io(n)?{...n}:Array.isArray(n)?[...n]:n instanceof Map?new Map(n):n instanceof Set?new Set(n):n}const iT=new Set(["string","number","symbol"]);function ro(n){return n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function na(n,i,a){const l=new n._zod.constr(i??n._zod.def);return(!i||a?.parent)&&(l._zod.parent=n),l}function Te(n){const i=n;if(!i)return{};if(typeof i=="string")return{error:()=>i};if(i?.message!==void 0){if(i?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");i.error=i.message}return delete i.message,typeof i.error=="string"?{...i,error:()=>i.error}:i}function m1(n){return typeof n=="bigint"?n.toString()+"n":typeof n=="string"?`"${n}"`:`${n}`}function rT(n){return Object.keys(n).filter(i=>n[i]._zod.optin!==void 0&&n[i]._zod.optout==="optional")}const p1={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]},sT={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function aT(n,i){const a=n._zod.def,l=a.checks;if(l&&l.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const f={};return Wa(f,n,Qf(n,i)),na(n,Di(a,{shape:f,checks:[]}))}function Qf(n,i){const a=hs(n),l=[];for(const u of Reflect.ownKeys(i)){if(!Object.getOwnPropertyDescriptor(a,u)?.enumerable)throw new Error(`Unrecognized key: "${String(u)}"`);i[u]&&l.push(u)}return l}function lT(n,i){const a=n._zod.def,l=a.checks;if(l&&l.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const f=new Set(Qf(n,i)),d={};return Wa(d,n,Reflect.ownKeys(hs(n)).filter(m=>!f.has(m))),na(n,Di(a,{shape:d,checks:[]}))}function oT(n,i){if(!io(i))throw new Error("Invalid input to extend: expected a plain object");const a=n._zod.def.checks;if(a&&a.length>0){const u=hs(n);for(const f of Reflect.ownKeys(i))if(Obje)DELIM" -R"DELIM(ct.getOwnPropertyDescriptor(u,f)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return na(n,Di(n._zod.def,{shape:g1(n,i)}))}function g1(n,i){const a={};return Wa(a,n,Reflect.ownKeys(hs(n))),Wz(a,i),a}function uT(n,i){if(!io(i))throw new Error("Invalid input to safeExtend: expected a plain object");return na(n,Di(n._zod.def,{shape:g1(n,i)}))}function cT(n,i){if(!i?._zod?.def)throw new Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(n._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");const a={};Wa(a,n,Reflect.ownKeys(hs(n))),Wa(a,i,Reflect.ownKeys(hs(i)));const l=Di(n._zod.def,{shape:a,get catchall(){return i._zod.def.catchall},checks:i._zod.def.checks??[]});return na(n,l)}function cb(n,i,a,l="partial"){const f=i._zod.def.checks;if(f&&f.length>0)throw new Error(`.${l}() cannot be used on object schemas containing refinements`);const m=a?new Set(Qf(i,a)):void 0,p={};return Wa(p,i,Reflect.ownKeys(hs(i)),n&&((g,b)=>m&&!m.has(b)?g:new n({type:"optional",innerType:g}))),na(i,Di(i._zod.def,{shape:p,checks:[]}))}function fT(n,i,a){const l=a?new Set(Qf(i,a)):void 0,u={};return Wa(u,i,Reflect.ownKeys(hs(i)),(f,d)=>l&&!l.has(d)?f:new n({type:"nonoptional",innerType:f})),na(i,Di(i._zod.def,{shape:u}))}function _r(n,i=0){if(n.aborted===!0)return!0;for(let a=i;a{var l;return(l=a).path??(l.path=[]),a.path.unshift(n),a})}function vu(n){return typeof n=="string"?n:n?.message}function fb(n){const i=[];for(const a of n??[]){const l=a._zod.def;if(!/_(length|size)$|_equals$/.test(l.check))break;const u=l.maximum??l.length??l.size;u>=0&&i.push([u,a])}return i}function ep(n,i,a){var l;for(let u=i;un;return i[_T]=!0,i}var db;const Um={value:void 0,enumerable:!1};let hb="captureStackTrace"in Error?Error:null;function xT(n){const i=hb;if(i){const a=i.stackTraceLimit;if(typeof a=="number"){try{i.stackTraceLimit=0}catch{return hb=null,new n}try{return new n}finally{i.stackTraceLimit=a}}}return new n}function Y(n,i,a,l){const u={};function f(w){this.def=w,this.constr=y,this.traits=new Set}f.prototype=u;const d=a,m=d&&new WeakSet;function p(w,O){if(w._zod){if(w._zod.traits.has(n))return}else{Um.value=new f(O);try{Object.defineProperty(w,"_zod",Um)}finally{Um.value=void 0}}if(w._zod.traits.add(n),i(w,O),m){const A=Object.getPrototypeOf(w),k=w._zod.constr.prototype;let L=A;for(;L&&L!==k;)L=Object.getPrototypeOf(L);const D=L??A;m.has(D)||(m.add(D),pT(D,d))}const T=y.prototype;for(const A in T)Object.prototype.hasOwnProperty.call(T,A)&&(A in w||(w[A]=T[A].bind(w)))}const g=l?.Parent??Object;class b extends g{}Object.defineProperty(b,"name",{value:n});function y(w){const O=l?.Parent?xT(b):this;p(O,w);const T=O._zod.deferred;if(T){for(const k of T)k();O._zod.deferred=void 0}const A=globalThis.__zod_globalConfig?.postProcessor;return A&&A(O),O}return Object.defineProperty(y,"init",{value:p}),Object.defineProperty(y,Symbol.hasInstance,{value:w=>l?.Parent&&w instanceof l.Parent?!0:w?._zod?.traits?.has(n)}),Object.defineProperty(y,"name",{value:n}),y}class Ja extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class b1 extends Error{constructor(i){super(`Encountered unidirectional transform during encode: ${i}`),this.name="ZodEncodeError"}}(db=globalThis).__zod_globalConfig??(db.__zod_globalConfig={});const er=globalThis.__zod_globalConfig;function Br(n){return n&&Object.assign(er,n),er}function wT(){const n=this._zod;return n.message??(n.message=JSON.stringify(n.def,Wm,2)),n.message}function zT(n){this._zod.message=n}const TT={get:wT,set:zT,enumerable:!0,configurable:!0},Zm={value:void 0,enumerable:!1},mb=new WeakSet([Object.prototype,Error.prototype]),ET=(n,i)=>{n.name="$ZodError",Zm.value=i,Object.defineProperty(n,"issues",Zm),Zm.value=void 0,Object.defineProperty(n,"message",TT);const a=Object.getPrototypeOf(n);mb.has(a)||(mb.add(a),Object.defineProperty(a,"toString",{configurable:!0,enumerable:!1,get(){const l=()=>this.message;return Object.defineProperty(this,"toString",{value:l,configurable:!0,writable:!0}),l},set(l){Object.defineProperty(this,"toString",{value:l,configurable:!0,writable:!0})}}))},OT=Y("$ZodError",ET);function NT(n,i,a){return Object.prototype.hasOwnProperty.call(n,i)||(i==="__proto__"?Object.defineProperty(n,i,{value:a(),writable:!0,enumerable:!0,configurable:!0}):n[i]=a()),n[i]}function AT(n,i=a=>a.message){const a={},l=[];for(const u of n.issues)u.path.length>0?NT(a,u.path[0],()=>[]).push(i(u)):l.push(i(u));return{formErrors:l,fieldErrors:a}}function MT(n,i=a=>a.message){const a={_errors:[]},l=(u,f=[])=>{for(const d of u.issues)if(d.code==="invalid_union"&&d.errors.length)d.errors.map(m=>l({issues:m},[...f,...d.path]));else if(d.code==="invalid_key")l({issues:d.issu)DELIM" -R"DELIM(es},[...f,...d.path]);else if(d.code==="invalid_element")l({issues:d.issues},[...f,...d.path]);else{const m=[...f,...d.path];if(m.length===0)a._errors.push(i(d));else{let p=a,g=0;for(;g{const i=(a,l,u,f)=>{const d=u?{...u,async:!1}:{async:!1},m=a._zod.run({value:l,issues:[]},d);if(m instanceof Promise)throw new Ja;if(m.issues.length){const p=new(f?.Err??n)(m.issues.map(g=>Js(g,d,Br())));throw d1(p,f?.callee??i),p}return m.value};return i},Hp=n=>{const i=async(a,l,u,f)=>{const d=u?{...u,async:!0}:{async:!0};let m=a._zod.run({value:l,issues:[]},d);if(m instanceof Promise&&(m=await m),m.issues.length){const p=new(f?.Err??n)(m.issues.map(g=>Js(g,d,Br())));throw d1(p,f?.callee??i),p}return m.value};return i},Bp=n=>(i,a,l)=>{const u=l?{...l,async:!1}:{async:!1},f=i._zod.run({value:a,issues:[]},u);if(f instanceof Promise)throw new Ja;return f.issues.length?_1(n,f.issues,u):{success:!0,data:f.value}};function _1(n,i,a){let l;return{success:!1,get error(){return l||(l=new n(i.map(u=>Js(u,a,Br()))),i=void 0,a=void 0),l},set error(u){l=u,i=void 0,a=void 0}}}const qp=n=>async(i,a,l)=>{const u=l?{...l,async:!0}:{async:!0};let f=i._zod.run({value:a,issues:[]},u);return f instanceof Promise&&(f=await f),f.issues.length?_1(n,f.issues,u):{success:!0,data:f.value}},jT=Symbol.for("zod.compile.invalid"),kT=Symbol.for("zod.compile.fallback"),RT=((n,i,a)=>{const l=n._zod.bag.validator;if(l!==void 0){if(l(i)!==jT)return!0;if(l.definite===!0&&a===void 0)return!1}return CT(n,i,a)});function CT(n,i,a){const l=a?{...a,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},u=n._zod.bag.fallbackRun;let f;if(u?(l[kT]=!0,f=u({value:i,issues:[]},l)):f=n._zod.run({value:i,issues:[]},l),f instanceof Promise)throw new Ja;return f.issues.length===0}const DT=async(n,i,a)=>{const l=a?{...a,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0};let u=n._zod.run({value:i,issues:[]},l);return u instanceof Promise&&(u=await u),u.issues.length===0},UT=n=>{const i=Lp(n),a=(l,u,f,d)=>{const m=f?{...f,direction:"backward"}:{direction:"backward"};return i(l,u,m,Jf(a,d))};return a},ZT=n=>{const i=Lp(n),a=(l,u,f,d)=>i(l,u,f,Jf(a,d));return a},$T=n=>{const i=Hp(n),a=async(l,u,f,d)=>{const m=f?{...f,direction:"backward"}:{direction:"backward"};return await i(l,u,m,Jf(a,d))};return a},LT=n=>{const i=Hp(n),a=async(l,u,f,d)=>await i(l,u,f,Jf(a,d));return a},HT=n=>(i,a,l)=>{const u=l?{...l,direction:"backward"}:{direction:"backward"};return Bp(n)(i,a,u)},BT=n=>(i,a,l)=>Bp(n)(i,a,l),qT=n=>async(i,a,l)=>{const u=l?{...l,direction:"backward"}:{direction:"backward"};return qp(n)(i,a,u)},VT=n=>async(i,a,l)=>qp(n)(i,a,l),IT=/^[cC][0-9a-z]{6,}$/,PT=/^[0-9a-z]+$/,KT=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,GT=/^[0-9a-vA-V]{20}$/,YT=/^[A-Za-z0-9]{27}$/,FT=/^[a-zA-Z0-9_-]{21}$/;function QT(n){return new RegExp(`^[a-zA-Z0-9_-]{${n}}$`)}const JT=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,XT=/^([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})$/,pb=n=>n?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${n}[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)$/,WT=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,eE="^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$";function tE(){return new RegExp(eE,"u")}const nE=/^(?:(?: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])$/,iE=/^(([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}|:))$/,rE=/^((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])$/,sE=/^(([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}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,aE=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,lE=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/,oE=/^https?$/,uE=/^\+[1-9]\d{6,14}$/,S1="(?:(?:\\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])))";function cE(n){return new RegExp(`^${n}$`)}const fE=cE(S1);function tp(n){const i="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof n.precision=="number"?n.precision===-1?`${i}`:n.precision===0?`${i}:[0-5]\\d`:`${i}:[0-5]\\d\\.\\d{${n.precision}}`:n.seconds?`${i}:[0-5]\\d(?:\\.\\d+)?`:`${i}(?::[0-5]\\d(?:\\.\\d+)?)?`}function dE(n){return new RegExp(`^${tp(n)}$`)}function hE(n){const i=["Z"];n.offset&&i.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const a=`${tp({precision:n.precision,seconds:!0})}(?:${i.join("|")})`,l=n.local?`${a}|${tp({precision:n.precision})}`:a;return new RegExp(`^${S1}T(?:${l})$`)}const mE=/^[\s\S]{0,}$/,pE=/^-?\d+$/,Vp=/^-?\d+(?:\.\d+)?$/,gE=/^(?:true|false)$/i,vE=/^[^A-Z]*$/,yE=/^[^a-z]*$/,yi=Y("$ZodCheck",(n,i)=>{var a;n._zod??(n._zod={}),n._zod.def=i,(a=n._zod).onattach??(a.onattach=[])}),Ip=n=>{const i=n.value;return!Jz(i)&&i.length!==void 0},Df={number:"number",bigint:"bigint",object:"date"},x1=Y("$ZodCheckLessThan",(n,i)=>{yi.init(n,i);const a=Df[typeof i.value];n._zod.check=l=>{(i.inclusive?l.value<=i.value:l.value{yi.init(n,i);const a=Df[typeof i.value];n._zod.check=l=>{(i.inclusive?l.value>=i.value:l.value>i.value)||l.issues.push({origin:Df[typeof l.value]??a,code:"too_small",minimum:typeof i.value=="object"?i.value.getTime():i.value,input:l.value,inclusive:i.inclusive,inst:n,continue:!i.abort})}}),bE=Y("$ZodCheckMultipleOf",(n,i)=>{yi.init(n,i),n._zod.check=a=>{if(typeof a.value!=typeof i.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof a.value=="bigint"?i.value!==BigInt(0)&&a.value%i.value===BigInt(0):Xz(a.value,i.value)===0)||a.issues.push({origin:typeof a.value,code:"not_multiple_of",divisor:i.value,input:a.value,inst:n,continue:!i.abort})}}),_E=Y("$ZodCheckNumberFormat",(n,i)=>{yi.init(n,i),i.format=i.format||"float64";const a=i.format?.includes("int"),l=a?"int":"number",[u,f]=p1[i.format];n._zod.check=d=>{const m=d.value;if(a){if(!Number.isInteger(m)){d.issues.push({expected:l,format:i.format,code:"invalid_type",continue:!1,input:m,inst:n});return}if(!Number.isSafeInteger(m)){m>0?d.issues.push({input:m,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:n,origin:l,inclusive:!0,continue:!i.abort}):d.issues.push({input:m,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst)DELIM" -R"DELIM(:n,origin:l,inclusive:!0,continue:!i.abort});return}}mf&&d.issues.push({origin:"number",input:m,code:"too_big",maximum:f,inclusive:!0,inst:n,continue:!i.abort})}}),SE=Y("$ZodCheckMaxLength",(n,i)=>{var a;yi.init(n,i),(a=n._zod.def).when??(a.when=Ip),n._zod.check=l=>{const u=l.value,f=u.length;if((typeof u=="string"&&f>i.maximum?Zp(u):f)<=i.maximum)return;const m=$p(u);l.issues.push({origin:m,code:"too_big",maximum:i.maximum,inclusive:!0,input:u,inst:n,continue:!i.abort})}}),xE=Y("$ZodCheckMinLength",(n,i)=>{var a;yi.init(n,i),(a=n._zod.def).when??(a.when=Ip),n._zod.check=l=>{const u=l.value,f=u.length;if((typeof u=="string"&&f>=i.minimum&&f=i.minimum)return;const m=$p(u);l.issues.push({origin:m,code:"too_small",minimum:i.minimum,inclusive:!0,input:u,inst:n,continue:!i.abort})}}),wE=Y("$ZodCheckLengthEquals",(n,i)=>{var a;yi.init(n,i),(a=n._zod.def).when??(a.when=Ip),n._zod.check=l=>{const u=l.value,f=u.length,d=typeof u=="string"&&f>=i.length&&f<=i.length*2?Zp(u):f;if(d===i.length)return;const m=$p(u),p=d>i.length;l.issues.push({origin:m,...p?{code:"too_big",maximum:i.length}:{code:"too_small",minimum:i.length},inclusive:!0,exact:!0,input:l.value,inst:n,continue:!i.abort})}}),Xf=Y("$ZodCheckStringFormat",(n,i)=>{var a,l;yi.init(n,i),i.pattern?(a=n._zod).check??(a.check=u=>{i.pattern.lastIndex=0,!i.pattern.test(u.value)&&u.issues.push({origin:"string",code:"invalid_format",format:i.format,input:u.value,...i.pattern?{pattern:i.pattern.toString()}:{},inst:n,continue:!i.abort})}):(l=n._zod).check??(l.check=()=>{})}),zE=Y("$ZodCheckRegex",(n,i)=>{Xf.init(n,i),n._zod.check=a=>{i.pattern.lastIndex=0,!i.pattern.test(a.value)&&a.issues.push({origin:"string",code:"invalid_format",format:"regex",input:a.value,pattern:i.pattern.toString(),inst:n,continue:!i.abort})}}),TE=Y("$ZodCheckLowerCase",(n,i)=>{i.pattern??(i.pattern=vE),Xf.init(n,i)}),EE=Y("$ZodCheckUpperCase",(n,i)=>{i.pattern??(i.pattern=yE),Xf.init(n,i)}),OE=Y("$ZodCheckIncludes",(n,i)=>{yi.init(n,i);const a=ro(i.includes),l=new RegExp(typeof i.position=="number"?`^.{${i.position},}${a}`:a);i.pattern=l,n._zod.check=u=>{u.value.includes(i.includes,i.position)||u.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:i.includes,input:u.value,inst:n,continue:!i.abort})}}),NE=Y("$ZodCheckStartsWith",(n,i)=>{yi.init(n,i);const a=new RegExp(`^${ro(i.prefix)}.*`);i.pattern??(i.pattern=a),n._zod.check=l=>{l.value.startsWith(i.prefix)||l.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:i.prefix,input:l.value,inst:n,continue:!i.abort})}}),AE=Y("$ZodCheckEndsWith",(n,i)=>{yi.init(n,i);const a=new RegExp(`.*${ro(i.suffix)}$`);i.pattern??(i.pattern=a),n._zod.check=l=>{l.value.endsWith(i.suffix)||l.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:i.suffix,input:l.value,inst:n,continue:!i.abort})}}),ME=Y("$ZodCheckOverwrite",(n,i)=>{yi.init(n,i),n._zod.check=a=>{a.value=i.tx(a.value)}});class jE{constructor(i=[],a={}){this.content=[],this.indent=0,this.args=i,this.closed=a}indented(i){this.indent+=1;try{i(this)}finally{this.indent-=1}}write(i){if(typeof i=="function"){i(this,{execution:"sync"}),i(this,{execution:"async"});return}const l=i.split(` +`+s.stack}}var yn=Object.prototype.hasOwnProperty,Fn=n.unstable_scheduleCallback,ia=n.unstable_cancelCallback,il=n.unstable_shouldYield,ms=n.unstable_requestPaint,Yt=n.unstable_now,rl=n.unstable_getCurrentPriorityLevel,Qn=n.unstable_ImmediatePriority,sl=n.unstable_UserBlockingPriority,ra=n.unstable_NormalPriority,dd=n.unstable_LowPriority,Vu=n.unstable_IdlePriority,hd=n.log,md=n.unstable_setDisableYieldValue,sa=null,Ft=null;function Tt(e){if(typeof hd=="function"&&md(e),Ft&&typeof Ft.setStrictMode=="function")try{Ft.setStrictMode(sa,e)}catch{}}var Nt=Math.clz32?Math.clz32:ui,ps=Math.log,gs=Math.LN2;function ui(e){return e>>>=0,e===0?32:31-(ps(e)/gs|0)|0}var ir=256,rr=262144,aa=4194304;function Sr(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&-e;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function al(e,t,r){var s=e.pendingLanes;if(s===0)return 0;var o=0,c=e.suspendedLanes,h=e.pingedLanes;e=e.warmLanes;var _=s&134217727;return _!==0?(s=_&~c,s!==0?o=Sr(s):(h&=_,h!==0?o=Sr(h):r||(r=_&~e,r!==0&&(o=Sr(r))))):(_=s&~c,_!==0?o=Sr(_):h!==0?o=Sr(h):r||(r=s&~e,r!==0&&(o=Sr(r)))),o===0?0:t!==0&&t!==o&&(t&c)===0&&(c=o&-o,r=t&-t,c>=r||c===32&&(r&4194048)!==0)?t:o}function la(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function xr(e,t){(t&8)!==0&&(t|=t&32);var r=e.entangledLanes;if(r!==0)for(e=e.entanglements,r&=t;0r;r++)t.push(e);return t}function ci(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function un(e,t,r,s,o,c){var h=e.pendingLanes;e.pendingLanes=r,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=r,e.entangledLanes&=r,e.errorRecoveryDisabledLanes&=r,e.shellSuspendCounter=0;var _=e.entanglements,N=e.expirationTimes,Z=e.hiddenUpdates;for(r=h&~r;0"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),No=!1;if(ar)try{var ga={};Object.defineProperty(ga,"passive",{get:function(){No=!0}}),window.addEventListener("test",ga,ga),window.removeEventListener("test",ga,ga)}catch{No=!1}var Er=null,wi=null,zi=null;function Or(){if(zi)return zi;var e,t=wi,r=t.length,s,o="value"in Er?Er.value:Er.textContent,c=o.length;for(e=0;e=P),ce=" ",de=!1;function ge(e,t){switch(e){case"keyup":return R.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function De(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Ie=!1;function Je(e,t){switch(e){case"compositionend":return De(t);case"keypress":return t.which!==32?null:(de=!0,ce);case"textInput":return e=t.data,e===ce&&de?null:e;default:return null}}function qe(e,t){if(Ie)return e==="compositionend"||!H&&ge(e,t)?(e=Or(),zi=wi=Er=null,Ie=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function Sg(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function xg(e,t){var r=Sg(e);e=0;for(var s;r;){if(r.nodeType===3){if(s=e+r.textContent.length,e<=t&&s>=t)return{node:r,offset:t-e};e=s}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=Sg(r)}}function wg(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?wg(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function zg(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Sd(e.document);t instanceof e.HTMLIFrameElement;){try{var r=typeof t.contentWindow.location.href=="string"}catch{r=!1}if(r)e=t.contentWindow;else break;t=Sd(e.document)}return t}function xd(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}var Cx=ar&&"documentMode"in document&&11>=document.documentMode,yl=null,wd=null,Do=null,zd=!1;function Tg(e,t,r){var s=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;zd||yl==null||yl!==Sd(s)||(s=yl,"selectionStart"in s&&xd(s)?s={start:s.selectionStart,end:s.selectionEnd}:(s=(s.ownerDocument&&s.ownerDocument.defaultView||window).getSelection(),s={anchorNode:s.anchorNode,anchorOffset:s.anchorOffset,focusNode:s.focusNode,focusOffset:s.focusOffset}),Do&&Ss(Do,s)||(Do=s,s=tf(wd,"onSelect"),0>=h,o-=h,Ar=1<<32-Nt(t)+o|r<ke?(sn=Ee,Ee=null):sn=Ee.sibling;var Xe=C(U,Ee,$[ke],I);if(Xe===null){Ee===null&&(Ee=sn);break}e&&Ee&&Xe.alternate===null&&t(U,Ee),j=c(Xe,j,ke),Fe===null?ve=Xe:Fe.sibling=Xe,Fe=Xe,Ee=sn}if(ke===$.length)return r(U,Ee),Ve&&ts(U,ke),ve;if(Ee===null){for(;ke<$.length;ke++)Ee=K(U,$[ke],I),Ee!==null&&(j=c(Ee,j,ke),Fe===null?ve=Ee:Fe.sibling=Ee,Fe=Ee);return Ve&&ts(U,ke),ve}for(Ee=s(Ee);ke<$.length;ke++)sn=B(Ee,U,ke,$[ke],I),sn!==null&&(e&&(Xe=sn.alternate,Xe!==null&&Ee.delete(Xe.key===null?ke:Xe.key)),j=c(sn,j,ke),Fe===null?ve=sn:Fe.sibling=sn,Fe=sn);return e&&Ee.forEach(function(Ps){return t(U,Ps)}),Ve&&ts(U,ke),ve}function _e(U,j,$,I){if($==null)throw Error(l(151));for(var ve=null,Fe=null,Ee=j,ke=j=0,sn=null,Xe=$.next();Ee!==null&&!Xe.done;ke++,Xe=$.next()){Ee.index>ke?(sn=Ee,Ee=null):sn=Ee.sibling;var Ps=C(U,Ee,Xe.value,I);if(Ps===null){Ee===null&&(Ee=sn);break}e&&Ee&&Ps.alternate===null&&t(U,Ee),j=c(Ps,j,ke),Fe===null?ve=Ps:Fe.sibling=Ps,Fe=Ps,Ee=sn}if(Xe.done)return r(U,Ee),Ve&&ts(U,ke),ve;if(Ee===null){for(;!Xe.done;ke++,Xe=$.next())Xe=K(U,Xe.value,I),Xe!==null&&(j=c(Xe,j,ke),Fe===null?ve=Xe:Fe.sibling=Xe,Fe=Xe);return Ve&&ts(U,ke),ve}for(Ee=s(Ee);!Xe.done;ke++,Xe=$.next())Xe=B(Ee,U,ke,Xe.value,I),Xe!==null&&(e&&(sn=Xe.alternate,sn!==null&&Ee.delete(sn.key===null?ke:sn.key)),j=c(Xe,j,ke),Fe===null?ve=Xe:Fe.sibling=Xe,Fe=Xe);return e&&Ee.forEach(function(Tz){return t(U,Tz)}),Ve&&ts(U,ke),ve}function He(U,j,$,I){if(typeof $=="object"&&$!==null&&$.type===J&&$.key===null&&$.props.ref===void 0&&($=$.props.children),typeof $=="object"&&$!==null){switch($.$$typeof){case ye:e:{for(var ve=$.key;j!==null;){if(j.key===ve){if(ve=$.type,ve===J){if(j.tag===7){r(U,j.sibling),I=o(j,$.props.children),Es(I,$),I.return=U,U=I;break e}}else if(j.elementType===ve||typeof ve=="object"&&ve!==null&&ve.$$typeof===Se&&Ca(ve)===j.type){r(U,j.sibling),I=o(j,$.props),Es(I,$),I.return=U,U=I;break e}r(U,j);break}else t(U,j);j=j.sibling}$.type===J?(I=Oa($.props.children,U.mode,I,$.key),Es(I,$),I.return=U,U=I):(I=ac($.type,$.key,$.props,null,U.mode,I),Es(I,$),I.return=U,U=I)}return h(U);case ue:e:{for(ve=$.key;j!==null;){if(j.key===ve)if(j.tag===4&&j.stateNode.containerInfo===$.containerInfo&&j.stateNode.implementation===$.implementation){r(U,j.sibling),I=o(j,$.children||[]),I.return=U,U=I;break e}else{r(U,j);break}else t(U,j);j=j.sibling}I=jd($,U.mode,I),I.return=U,U=I}return h(U);case Se:return $=Ca($),He(U,j,$,I)}if(Ae($))return oe(U,j,$,I);if(re($)){if(ve=re($),typeof ve!="function")throw Error(l(150));return $=ve.call($),_e(U,j,$,I)}if(typeof $.then=="function")return He(U,j,gc($),I);if($.$$typeof===fe)return He(U,j,dc(U,$),I);vc(U,$)}return typeof $=="string"&&$!==""||typeof $=="number"||typeof $=="bigint"?($=""+$,j!==null&&j.tag===6?(r(U,j.sibling),I=o(j,$),I.return=U,U=I):(r(U,j),I=Md($,U.mode,I),I.return=U,U=I),h(U)):r(U,j)}return function(U,j,$,I){try{Bo=0;var ve=He(U,j,$,I);return Ol=null,ve}catch(Ee){if(Ee===El||Ee===mc)throw Ee;var Fe=di(29,Ee,null,U.mode);return Fe.lanes=I,Fe.return=U,Fe}}}var Ua=Fg(!0),Qg=Fg(!1),Os=!1;function Bd(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function qd(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Ns(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function As(e,t,r){var s=e.updateQueue;if(s===null)return null;if(s=s.shared,(it&2)!==0){var o=s.pending;return o===null?t.next=t:(t.next=o.next,o.next=t),s.pending=t,t=sc(e),Rg(e,null,r),t}return rc(e,s,t,r),sc(e)}function qo(e,t,r){if(t=t.updateQueue,t!==null&&(t=t.shared,(r&4194048)!==0)){var s=t.lanes;s&=e.pendingLanes,r|=s,t.lanes=r,Jt(e,r)}}function Vd(e,t){var r=e.updateQueue,s=e.alternate;if(s!==null&&(s=s.updateQueue,r===s)){var o=null,c=null;if(r=r.firstBaseUpdate,r!==null){do{var h={lane:r.lane,tag:r.tag,payload:r.payload,callback:null,next:null};c===null?o=c=h:c=c.next=h,r=r.next}while(r!==null);c===null?o=c=t:c=c.next=t}else o=c=t;r={baseState:s.baseState,firstBaseUpdate:o,lastBaseUpdate:c,shared:s.shared,callbacks:s.callbacks},e.updateQueue=r;return}e=r.lastBaseUpdate,e===null?r.firstBaseUpdate=t:e.next=t,r.lastBaseUpdate=t}var Id=!1;function Vo(){if(Id){var e=Tl;if(e!==null)throw e}}function Io(e,t,r,s){Id=!1;var o=e.updateQueue;Os=!1;var c=o.firstBaseUpdate,h=o.lastBaseUpdate,_=o.share)DELIM" +R"DELIM(d.pending;if(_!==null){o.shared.pending=null;var N=_,Z=N.next;N.next=null,h===null?c=Z:h.next=Z,h=N;var q=e.alternate;q!==null&&(q=q.updateQueue,_=q.lastBaseUpdate,_!==h&&(_===null?q.firstBaseUpdate=Z:_.next=Z,q.lastBaseUpdate=N))}if(c!==null){var K=o.baseState;h=0,q=Z=N=null,_=c;do{var C=_.lane&-536870913,B=C!==_.lane;if(B?(Ye&C)===C:(s&C)===C){C!==0&&C===ka&&(Id=!0),q!==null&&(q=q.next={lane:0,tag:_.tag,payload:_.payload,callback:null,next:null});e:{var oe=e,_e=_;C=t;var He=r;switch(_e.tag){case 1:if(oe=_e.payload,typeof oe=="function"){K=oe.call(He,K,C);break e}K=oe;break e;case 3:oe.flags=oe.flags&-65537|128;case 0:if(oe=_e.payload,C=typeof oe=="function"?oe.call(He,K,C):oe,C==null)break e;K=ne({},K,C);break e;case 2:Os=!0}}C=_.callback,C!==null&&(e.flags|=64,B&&(e.flags|=8192),B=o.callbacks,B===null?o.callbacks=[C]:B.push(C))}else B={lane:C,tag:_.tag,payload:_.payload,callback:_.callback,next:null},q===null?(Z=q=B,N=K):q=q.next=B,h|=C;if(_=_.next,_===null){if(_=o.shared.pending,_===null)break;B=_,_=B.next,B.next=null,o.lastBaseUpdate=B,o.shared.pending=null}}while(!0);q===null&&(N=K),o.baseState=N,o.firstBaseUpdate=Z,o.lastBaseUpdate=q,c===null&&(o.shared.lanes=0),Us|=h,e.lanes=h,e.memoizedState=K}}function Jg(e,t){if(typeof e!="function")throw Error(l(191,e));e.call(t)}function Xg(e,t){var r=e.callbacks;if(r!==null)for(e.callbacks=null,e=0;ec?c:8;var h=pe.T,_={};_.types=h!==null?h.types:null,pe.T=_,ch(e,!1,t,r);try{var N=o(),Z=pe.S;if(Z!==null&&Z(_,N),N!==null&&typeof N=="object"&&typeof N.then=="function"){var q=Px(N,s);Yo(e,t,q,ki(e))}else Yo(e,t,s,ki(e))}catch(K){Yo(e,t,{then:function(){},status:"rejected",reason:K},ki())}finally{Ne.p=c,h!==null&&_.types!==null&&(h.types=_.types),pe.T=h}}function Jx(){}function oh(e,t,r,s){if(e.tag!==5)throw Error(l(476));var o=Mv(e).queue;Av(e,o,t,Bt,r===null?Jx:function(){return jv(e),r(s)})}function Mv(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:Bt,baseState:Bt,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ss,lastRenderedState:Bt},next:null};var r={};return t.next={memoizedState:r,baseState:r,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ss,lastRenderedState:r},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function jv(e){var t=Mv(e);t.next===null&&(t=e.alternate.memoizedState),Yo(e,t.next.queue,{},ki())}function uh(){return An(Fl)}function kv(){return Xt().memoizedState}function Rv(){return Xt().memoizedState}function Xx(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var r=ki();e=Ns(r);var s=As(t,e,r);s!==null&&(gi(s,t,r),qo(s,t,r)),t={cache:Zd()},e.payload=t;return}t=t.return}}function Wx(e,t,r){var s=ki();r={lane:s,revertLane:0,gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},Oc(e)?Dv(t,r):(r=Nd(e,t,r,s),r!==null&&(gi(r,e,s),Uv(r,t,s)))}function Cv(e,t,r){var s=ki();Yo(e,t,r,s)}function Yo(e,t,r,s){var o={lane:s,revertLane:0,gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null};if(Oc(e))Dv(t,o);else{var c=e.alternate;if(e.lanes===0&&(c===null||c.lanes===0)&&(c=t.lastRenderedReducer,c!==null))try{var h=t.lastRenderedState,_=c(h,r);if(o.hasEagerState=!0,o.eagerState=_,ut(_,h))return rc(e,t,o,0),bt===null&&ic(),!1}catch{}if(r=Nd(e,t,o,s),r!==null)return gi(r,e,s),Uv(r,t,s),!0}return!1}function ch(e,t,r,s){if(s={lane:2,revertLane:em(),gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null},Oc(e)){if(t)throw Error(l(479))}else t=Nd(e,r,s,2),t!==null&&gi(t,e,2)}function Oc(e){var t=e.alternate;return e===Le||t!==null&&t===Le}function Dv(e,t){Nl=_c=!0;var r=e.pending;r===null?t.next=t:(t.next=r.next,r.next=t),e.pending=t}function Uv(e,t,r){if((r&4194048)!==0){var s=t.lanes;s&=e.pendingLanes,r|=s,t.lanes=r,Jt(e,r)}}var Nc={readContext:An,use:wc,useCallback:It,useContext:It,useEffect:It,useImperativeHandle:It,useLayoutEffect:It,useInsertionEffect:It,useMemo:It,useReducer:It,useRef:It,useState:It,useDebugValue:It,useDeferredValue:It,useTransition:It,useSyncExternalStore:It,useId:It,useHostTransitionStatus:It,useFormState:It,useActionState:It,useOptimistic:It,useMemoCache:It,useCacheRefresh:It,useEffectEvent:It},Zv={readContext:An,use:wc,useCallback:function(e,t){return ni().memoizedState=[e,t===void 0?null:t],e},useContext:An,useEffect:_v,useImperativeHandle:function(e,t,r){r=r!=null?r.concat([e]):null,Tc(4194308,4,zv.bind(null,t,e),r)},useLayoutEffect:function(e,t){return Tc(4194308,4,e,t)},useInsertionEffect:function(e,t){Tc(4,2,e,t)},useMemo:function(e,t){var r=ni();t=t===void 0?null:t;var s=e();if(Za){Tt(!0);try{e()}finally{Tt(!1)}}return r.memoizedState=[s,t],s},useReducer:function(e,t,r){var s=ni();if(r!==void 0){var o=r(t);if(Za){Tt(!0);try{r(t)}finally{Tt(!1)}}}else o=t;return s.memoizedState=s.baseState=o,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:o},s.queue=e,e=e.dispatch=Wx.bind(null,Le,e),[s.memoizedState,e]},useRef:function(e){var t=ni();return e={current:e},t.memoizedState=e},useState:function(e){e=ih(e);var t=e.queue,r=Cv.)DELIM" +R"DELIM(bind(null,Le,t);return t.dispatch=r,[e.memoizedState,r]},useDebugValue:ah,useDeferredValue:function(e,t){var r=ni();return lh(r,e,t)},useTransition:function(){var e=ih(!1);return e=Av.bind(null,Le,e.queue,!0,!1),ni().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,r){var s=Le,o=ni();if(Ve){if(r===void 0)throw Error(l(407));r=r()}else{if(r=t(),bt===null)throw Error(l(349));(Ye&127)!==0||rv(s,t,r)}o.memoizedState=r;var c={value:r,getSnapshot:t};return o.queue=c,_v(av.bind(null,s,c,e),[e]),s.flags|=2048,Ml(9,{destroy:void 0},sv.bind(null,s,c,r,t),null),r},useId:function(){var e=ni(),t=bt.identifierPrefix;if(Ve){var r=Mr,s=Ar;r=(s&~(1<<32-Nt(s)-1)).toString(32)+r,t="_"+t+"R_"+r,r=Sc++,0<\/script>",c=c.removeChild(c.firstChild);break;case"select":c=typeof s.is=="string"?h.createElement("select",{is:s.is}):h.createElement("select"),s.multiple?c.multiple=!0:s.size&&(c.size=s.size);break;default:c=typeof s.is=="string"?h.createElement(o,{is:s.is}):h.createElement(o)}}c[At]=t,c[bn]=s;e:for(h=t.child;h!==null;){if(h.tag===5||h.tag===6)c.appendChild(h.stateNode);else if(h.tag!==4&&h.tag!==27&&h.child!==null){h.child.return=h,h=h.child;continue}if(h===t)break e;for(;h.sibling===null;){if(h.return===null||h.return===t)break e;h=h.return}h.sibling.return=h.return,h=h.sibling}t.stateNode=c;e:switch(Rn(c,o,s),o){case"button":case"input":case"select":case"textarea":s=!!s.autoFocus;break e;case"img":s=!0;break e;default:s=!1}s&&ls(t)}}return zt(t),t.subtreeFlags&=-33554433,wh(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,r),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==s&&ls(t);else{if(typeof s!="string"&&t.stateNode===null)throw Error(l(166));if(e=Kn.current,zl(t)){if(e=t.stateNode,r=t.memoizedProps,s=null,o=xn,o!==null)switch(o.tag){case 27:case 5:s=o.memoizedProps}e[At]=t,e=!!(e.nodeValue===r||s!==null&&s.suppressHydrationWarning===!0||a0(e.nodeValue,r)),e||zs(t,!0)}else e=lu(e).createTextNode(s),e[At]=t,t.stateNode=e}return zt(t),null;case 31:if(r=t.memoizedState,e===null||e.memoizedState!==null){if(s=zl(t),r!==null){if(e===null){if(!s)throw Error(l(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(l(557));e[At]=t}else Na(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;zt(t),e=!1}else r=Cd(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=r),e=!0;if(!e)return t.flags&256?(Ni(t),t):(Ni(t),null);if((t.flags&128)!==0)throw Error(l(558))}return zt(t),null;case 13:if(s=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(o=zl(t),s!==null&&s.dehydrated!==null){if(e===null){if(!o)throw Error(l(318));if(o=t.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(l(317));o[At]=t}else Na(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;zt(t),o=!1}else o=Cd(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=o),o=!0;if(!o)return t.flags&256?(Ni(t),t):(Ni(t),null)}return Ni(t),(t.flags&128)!==0?(t.lanes=r,t):(r=s!==null,e=e!==null&&e.memoizedState!==null,r&&(s=t.child,o=null,s.alternate!==null&&s.alternate.memoizedState!==null&&s.alternate.memoizedState.cachePool!==null&&(o=s.alternate.memoizedState.cachePool.pool),c=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(c=s.memoizedState.cachePool.pool),c!==o&&(s.flags|=2048)),r!==e&&r&&(t.child.flags|=8192),Cc(t,t.updateQueue),zt(t),null);case 4:return Ce(),e===null&&rm(t.stateNode.containerInfo),t.flags|=67108864,zt(t),null;case 10:return is(t.type),zt(t),null;case 19:if(Yd(t),s=t.memoizedState,s===null)return zt(t),null;if(o=(t.flags&128)!==0,c=s.rendering,c===null)if(o)Qo(s,!1);else{if(Pt!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(c=bc(e),c!==null){for(t.flags|=128,Qo(s,!1),e=c.updateQueue,t.updateQueue=e,Cc(t,e),t.subtreeFlags=0,e=r,r=t.child;r!==null;)Cg(r,e),r=r.sibling;return Po(t,jn.current&1|2),Ve&&ts(t,s.treeForkCount),t.child}e=e.sibling}s.tail!==null&&Yt()>Kc&&(t.flags|=128,o=!0,Qo(s,!1),t.lanes=4194304)}else{if(!o)if(e=bc(c),e!==null){if(t.flags|=128,o=!0,e=e.updateQueue,t.updateQueue=e,Cc(t,e),Qo(s,!0),s.tail===null&&s.tailMode!=="collapsed"&&s.tailMode!=="visible"&&!c.alternate&&!Ve)return zt(t),null}else 2*Yt()-s.renderingStartTime>Kc&&r!==536870912&&(t.flags|=128,o=!0,Qo(s,!1),t.lanes=4194304);s.isBackwards?(c.sibling=t.child,t.child=c):(e=s.last,e!==null?e.sibling=c:t.child=c,s.last=c)}if(s.tail!==null){e=s.tail;e:{for(r=e;r!==null;){if(r.alternate!==null){r=!1;break e}r=r.sibling}r=!0}return s.rendering=e,s.tail=e.sibling,s.renderingStartTime=Yt(),e.sibling=null,c=jn.current,c=o?c&1|2:c&1,s.tailMode==="visible"||s.tailMode==="collapsed"||!r||Ve?Po(t,c):(r=c,tt(Mn,t),tt(jn,r),Vn===null&&(Vn=t)),Ve&&ts(t,s.treeForkCount),e}return zt(t),null;case 22:case 23:return Ni(t),Kd(),s=t.memoizedState!==null,e!==null?e.memoizedState!==null!==s&&(t.flags|=8192):s&&(t.flags|=8192),s?(r&536870912)!==0&&(t.flags&128)===0&&(zt(t),t.subtreeFlags&6&&(t.flags|=8192)):zt(t),r=t.updateQueue,r!==null&&Cc(t,r.retryQueue),r=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(r=e.memoizedState.cachePool.pool),s=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(s=t.memoizedState.cachePool.pool),s!==r&&(t.flags|=2048),e!==null&&Ut(Ra),null;case 24:return r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),is(tn),zt(t),null;case 25:return null;case 30:return t.flags|=33554432,zt(t),null}throw Error(l(156,t.tag))}function aw(e,t){switch(kd(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return is(tn),Ce(),e=t.flags,(e&65536)!==0&)DELIM" +R"DELIM(&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return nt(t),null;case 31:if(t.memoizedState!==null){if(Ni(t),t.alternate===null)throw Error(l(340));Na()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(Ni(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(l(340));Na()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Yd(t),e=t.flags,e&65536?(t.flags=e&-65537|128,e=t.memoizedState,e!==null&&(e.rendering=null,e.tail=null),t.flags|=4,t):null;case 4:return Ce(),null;case 10:return is(t.type),null;case 22:case 23:return Ni(t),Kd(),e!==null&&Ut(Ra),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return is(tn),null;case 25:return null;default:return null}}function oy(e,t){switch(kd(t),t.tag){case 3:is(tn),Ce();break;case 26:case 27:case 5:nt(t);break;case 4:Ce();break;case 31:t.memoizedState!==null&&Ni(t);break;case 13:Ni(t);break;case 19:Yd(t);break;case 10:is(t.type);break;case 22:case 23:Ni(t),Kd(),e!==null&&Ut(Ra);break;case 24:is(tn)}}function Jo(e,t){try{var r=t.updateQueue,s=r!==null?r.lastEffect:null;if(s!==null){var o=s.next;r=o;do{if((r.tag&e)===e){s=void 0;var c=r.create,h=r.inst;s=c(),h.destroy=s}r=r.next}while(r!==o)}}catch(_){ft(t,t.return,_)}}function Rs(e,t,r){try{var s=t.updateQueue,o=s!==null?s.lastEffect:null;if(o!==null){var c=o.next;s=c;do{if((s.tag&e)===e){var h=s.inst,_=h.destroy;if(_!==void 0){h.destroy=void 0,o=t;var N=r,Z=_;try{Z()}catch(q){ft(o,N,q)}}}s=s.next}while(s!==c)}}catch(q){ft(t,t.return,q)}}function uy(e){var t=e.updateQueue;if(t!==null){var r=e.stateNode;try{Xg(t,r)}catch(s){ft(e,e.return,s)}}}function cy(e,t,r){r.props=$a(e.type,e.memoizedProps),r.state=e.memoizedState;try{r.componentWillUnmount()}catch(s){ft(e,t,s)}}function jr(e,t){try{var r=e.ref;if(r!==null){switch(e.tag){case 26:case 27:case 5:var s=e.stateNode;break;case 30:var o=e.stateNode,c=Xr(e.memoizedProps,o);(o.ref===null||o.ref.name!==c)&&(o.ref=v0(c)),s=o.ref;break;case 7:if(e.stateNode===null){var h=new Ri(e);y(e.child,!1,Qw,h,void 0,void 0),e.stateNode=h}s=e.stateNode;break;default:s=e.stateNode}typeof r=="function"?e.refCleanup=r(s):r.current=s}}catch(_){ft(e,t,_)}}function kn(e,t){var r=e.ref,s=e.refCleanup;if(r!==null)if(typeof s=="function")try{s()}catch(o){ft(e,t,o)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof r=="function")try{r(null)}catch(o){ft(e,t,o)}else r.current=null}function Dc(e,t){if((e.tag===5||e.tag===27||e.tag===6)&&e.alternate===null&&t!==null)for(var r=0;r title"))),Rn(s,t,r),s[At]=e,Wt(s),t=s;break e;case"link":if(c=C0("link","href",o).get(t+(r.href||""))){for(h=0;hHe&&(h=He,He=_e,_e=h);var U=xg(_,_e),j=xg(_,He);if(U&&j&&(B.rangeCount!==1||B.anchorNode!==U.node||B.anchorOffset!==U.offset||B.focusNode!==j.node||B.focusOffset!==j.offset)){var $=K.createRange();$.setStart(U.node,U.offset),B.removeAllRanges(),_e>He?(B.addRange($),B.extend(j.node,j.offset)):($.setEnd(j.node,j.offset),B.addRange($))}}}}for(K=[],B=_;B=B.parentNode;)B.nodeType===1&&K.push({element:B,left:B.scrollLeft,top:B.scrollTop});for(typeof _.focus=="function"&&_.focus(),_=0;_r?32:r,pe.T=null,r=Ih,Ih=null;var c=pr,h=Zr;if(Lt=0,qa=pr=null,Zr=0,(it&6)!==0)throw Error(l(331));var _=it;if(it|=4,Ry(c.current),My(c,c.current,h,r),it=_,ru(0,!1),Ft&&typeof Ft.onPostCommitFiberRoot=="function")try{Ft.onPostCommitFiberRoot(sa,c)}catch{}return!0}finally{Ne.p=o,pe.T=s,Yy(e,t)}}function Fy(e,t,r){t=Ii(r,t),t=hh(e.stateNode,t,2),e=As(e,t,2),e!==null&&(ci(e,2),$r(e))}function ft(e,t,r){if(e.tag===3)Fy(e,e,r);else for(;t!==null;){if(t.tag===3){Fy(t,e,r);break}else if(t.tag===1){var s=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof s.componentDidCatch=="function"&&(Zs===null||!Zs.has(s))){e=Ii(r,e),r=Pv(2),s=As(t,r,2),s!==null&&(Kv(r,)DELIM" +R"DELIM(s,t,e),ci(s,2),$r(s));break}}t=t.return}}function Jh(e,t,r){var s=e.pingCache;if(s===null){s=e.pingCache=new cw;var o=new Set;s.set(t,o)}else o=s.get(t),o===void 0&&(o=new Set,s.set(t,o));o.has(r)||(Bh=!0,o.add(r),e=yw.bind(null,e,t,r),t.then(e,e))}function yw(e,t,r){var s=e.pingCache;s!==null&&s.delete(t),e.pingedLanes|=e.suspendedLanes&r,e.warmLanes&=~r,bt===e&&(Ye&r)===r&&((Pt===4||Pt===3&&(Ye&62914560)===Ye&&300>Yt()-Pc)&&(it&2)===0?Bl(e,0):Ic|=r,Ul===Ye&&(Ul=0)),$r(e)}function Qy(e,t){t===0&&(t=vs()),e=Ea(e,t),e!==null&&(ci(e,t),$r(e))}function bw(e){var t=e.memoizedState,r=0;t!==null&&(r=t.retryLane),Qy(e,r)}function _w(e,t){var r=0;switch(e.tag){case 31:case 13:var s=e.stateNode,o=e.memoizedState;o!==null&&(r=o.retryLane);break;case 19:s=e.stateNode;break;case 22:s=e.stateNode._retryCache;break;default:throw Error(l(314))}s!==null&&s.delete(t),Qy(e,r)}function Sw(e,t){return Fn(e,t)}var Vl=null,Il=null,Xh=!1,Wc=!1,Wh=!1,Ls=0;function $r(e){e!==Il&&e.next===null&&(Il===null?Vl=Il=e:Il=Il.next=e),Wc=!0,Xh||(Xh=!0,ww())}function ru(e,t){if(!Wh&&Wc){Wh=!0;do for(var r=!1,s=Vl;s!==null;){if(e!==0){var o=s.pendingLanes;if(o===0)var c=0;else{var h=s.suspendedLanes,_=s.pingedLanes;c=(1<<31-Nt(42|e)+1)-1,c&=o&~(h&~_),c=c&201326741?c&201326741|1:c?c|2:0}c!==0&&(r=!0,e0(s,c))}else c=Ye,c=al(s,s===bt?c:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),(c&3)===0||la(s,c)||(r=!0,e0(s,c));s=s.next}while(r);Wh=!1}}function xw(){Jy()}function Jy(){Wc=Xh=!1;var e=0;Ls!==0&&Cw()&&(e=Ls);for(var t=Yt(),r=null,s=Vl;s!==null;){var o=s.next,c=Xy(s,t);c===0?(s.next=null,r===null?Vl=o:r.next=o,o===null&&(Il=r)):(r=s,(e!==0||(c&3)!==0)&&(Wc=!0)),s=o}Lt!==0&&Lt!==5||ru(e),Ls!==0&&(Ls=0)}function Xy(e,t){for(var r=e.suspendedLanes,s=e.pingedLanes,o=e.expirationTimes,c=e.pendingLanes&-62914561;0_)break;var q=N.transferSize,K=N.initiatorType;q&&l0(K)&&(N=N.responseEnd,h+=q*(N<_?1:(_-Z)/(N-Z)))}if(--s,t+=8*(c+h)/(o.duration/1e3),e++,10sf){_e.length=oe;break}$=new Promise(Hw.bind($)),_e.push($)}}}if(0<_e.length)return C=Promise.race([Promise.all(_e),new Promise(function(ve){return setTimeout(ve,500)})]).then(o,o),(B?Promise.allSettled([B.finished,C]):C).then(c,c);if(o(),B)return B.finished.then(c,c);c()},types:r});Z.__reactViewTransition=q;var K=[];return q.ready.then(function(){for(var C=Z.documentElement.getAnimations({subtree:!0}),B=0;B"u"?null:document;function M0(e,t,r){var s=Kl;if(s&&typeof t=="string"&&t){var o=Xn(t);o='link[rel="'+e+'"][href="'+o+'"]',typeof r=="string"&&(o+='[crossorigin="'+r+'"]'),A0.has(o)||(A0.add(o),e={rel:e,crossOrigin:r,href:t},s.querySelector(o)===null&&(t=s.createElement("link"),Rn(t,"link",e),Wt(t),s.head.appendChild(t)))}}function sz(e){us.D(e),M0("dns-prefetch",e,null)}function az(e,t){us.C(e,t),M0("preconnect",e,t)}function lz(e,t,r){us.L(e,t,r);var s=Kl;if(s&&e&&t){var o='link[rel="preload"][as="'+Xn(t)+'"]';t==="image"&&r&&r.imageSrcSet?(o+='[imagesrcset="'+Xn(r.imageSrcSet)+'"]',typeof r.imageSizes=="string"&&(o+='[imagesizes="'+Xn(r.imageSizes)+'"]')):o+='[href="'+Xn(e)+'"]';var c=o;switch(t){case"style":c=Gl(e);break;case"script":c=Yl(e)}if(!(Qi.has(c)||(e=ne({rel:"preload",href:t==="image"&&r&&r.imageSrcSet?void 0:e,as:t},r),Qi.set(c,e),s.querySelector(o)!==null||t==="style"&&s.querySelector(uu(c))||t==="script"&&s.querySelector(cu(c))))){var h=s.createElement("link");Rn(h,"link",e),t==="style"&&(h[cn]=!0,h.onload=h.onerror=function(){Iu(h)}),Wt(h),s.head.appendChild(h)}}}function oz(e,t){us.m(e,t);var r=Kl;if(r&&e){var s=t&&typeof t.as=="string"?t.as:"script",o='link[rel="modulepreload"][as="'+Xn(s)+'"][href="'+Xn(e)+'"]',c=o;switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":c=Yl(e)}if(!Qi.has(c)&&(e=ne({rel:"modulepreload",href:e},t),Qi.set(c,e),r.querySelector(o)===null)){switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(r.querySelector(cu(c)))return}s=r.createElement("link"),Rn(s,"link",e),Wt(s),r.head.appendChild(s)}}}function uz(e,t,r){us.S(e,t,r);var s=Kl;if(s&&e){var o=bs(s).hoistableStyles,c=Gl(e);t=t||"default";var h=o.get(c);if(!h){var _={loading:0,preload:null};if(h=s.querySelector(uu(c)))_.loading=5;else{e=ne({rel:"stylesheet",href:e,"data-precedence":t},r),(r=Qi.get(c))&&_m(e,r);var N=h=s.createElement("link");Wt(N),Rn(N,"link",e),N._p=new Promise(function(Z,q){N.onload=Z,N.onerror=q}),N.addEventListener("load",function(){_.loading|=1}),N.addEventListener("error",function(){_.loading|=2}),_.loading|=4,nf(h,t,s)}h={type:"stylesheet",instance:h,count:1,state:_},o.set(c,h)}}}function cz(e,t){us.X(e,t);var r=Kl;if(r&&e){var s=bs(r).hoistableScripts,o=Yl(e),c=s.get(o);c||(c=r.querySelector(cu(o)),c||(e=ne({src:e,async:!0},t),(t=Qi.get(o))&&Sm(e,t),c=r.createElement("script"),Wt(c),Rn(c,"link",e),r.head.appendChild(c)),c={type:"script",instance:c,count:1,state:null},s.set(o,c))}}function fz(e,t){us.M(e,t);var r=Kl;if(r&&e){var s=bs(r).hoistableScripts,o=Yl(e),c=s.get(o);c||(c=r.querySelector(cu(o)),c||(e=ne({src:e,async:!0,type:"module"},t),(t=Qi.get(o))&&Sm(e,t),c=r.createElement("script"),Wt(c),Rn(c,"link",e),r.head.appendChild(c)),c={type:"script",instance:c,count:1,state:null},s.set(o,c))}}function j0(e,t,r,s){var o=(o=Kn.current)?ou(o):null;if(!o)throw Error(l(446));switch(e){case"meta":case"title":return null;case"style":return typeof r.precedence=="string"&&typeof r.href=="string"?(r=Gl(r.href),t=bs(o).hoistableStyles,s=t.get(r),s||(s={type:"style",instance:null,count:0,state:null},t.set(r,s)),s):{type:"void",instance:null,count:0,state:null};case"link":if(r.rel==="stylesheet"&&typeof r.href=="string"&&typeof r.precedence=="string"){e=Gl(r.href);var c=bs(o).hoistableStyles,h=c.get(e);if(h||(o=o.ownerDocument||o,h={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},c.set(e,h),(c=o.querySelector(uu(e)))?c._p||(h.instance=c,h.state.loading=5):(c=Qi.get(e),c||(c={rel:"preload",as:"style",href:r.href,crossOrigin:r.crossOrigin,integrity:r.integrity,media:r.media,hrefLang:r.hrefLang,referrerPolicy:r.referrerPolicy},Qi.set(e,c)),dz(o,e,c,h.state))),t&&s===null)throw Error(l(528,""));return h}if(t&&s!==null)throw Error(l(529,""));return null;case"script":return t=r.async,r=r.src,typeof r=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(r=Yl(r),t=bs(o).hoistableScripts,s=t.get(r),s||(s={type:"script",instance:null,count:0,state:null},t.set(r,s)),s):{type:"void",instance:null,count:0,state:null};default:throw Error(l(444,e))}}function Gl(e){return'href="'+Xn(e)+'"'}function uu(e){return'link[rel="stylesheet"]['+e+"]"}function k0(e){return ne({},e,{"data-precedence":e.precedence,precedence:null})}function dz(e,t,r,s){if(t=e.querySelector('link[rel="preload"][as="style"]['+t+"]")){if(t[cn]!==!0){s.loading=1;return}}else t=e.createElement("link"),t[cn]=!0,t.onload=t.onerror=Iu.bind(null,t),Rn(t,"link",r),Wt(t),e.head.appendChild(t);s.preload=t,t.addEventListener("load",function(){return s.loading|=1}),t.addEventListener("error",function(){return s.loading|=2})}function Yl(e){return'[src="'+Xn(e)+'"]'}function cu(e){return"script[async]"+e}function R0(e,t,r){if(t.count++,t.instance===null)switch(t.type){case"style":var s=e.querySelector('style[data-href~="'+Xn(r.href)+'"]');if(s)return t.instance=s,Wt(s),s;var o=ne({},r,{"data-href":r.href,"data-precedence":r.precedence,href:null,precedence:null});return s=(e.ownerDocument||e).createElement("style"),Wt(s),Rn(s,"style",o),nf(s,r.precedence,e),t.instance=s;case"stylesheet":o=Gl(r.href);var c=e.querySelector(uu(o));if(c)return t.state.loading|=4,t.instance=c,Wt(c),c;s=k0(r),(o=Qi.get(o))&&_m(s,o),c=(e.ownerDocument||e).createElement("link"),Wt(c);var h=c;return h._p=new Promise(function(_,N){h.onload=_,h.onerror=N}),Rn(c,"link",s),t.state.loading|=4,nf(c,r.precedence,e),t.instance=c;case"script":return c=Yl(r.src),(o=e.querySelector(cu(c)))?(t.instance=o,Wt(o),o):(s=r,(o=Qi.get(c))&&(s=ne({},r),Sm(s,o)),e=e.ownerDocument||e,o=e.createElement("script"),Wt(o),Rn(o,"link",s),e.head.appendChild(o),t.instance=o);case"void":return null;default:throw Error(l(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(s=t.instance,t.state.loading|=4,nf(s,r.precedence,e));return t.instance}function nf(e,t,r){for(var s=r.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),o=s.length?s[s.length-1]:null,c=o,h=0;h title"):null)}function hz(e,t,r){if(r===1||t.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;return t.rel==="stylesheet"?(e=t.disabled,typeof t.precedence=="string"&&e==null):!0;case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function D0(e,t){return e==="img"&&t.src!=null&&t.src!==""&&t.onLoad==null&&t.loading!=="lazy"}function U0(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function Z0(e){return(e.width||100)*(e.height||100)*(typeof devicePixelRatio=="number"?devicePixelRatio:1)*.25}function $0(e,t){typeof t.decode=="function"&&(e.imgCount++,t.complete||(e.imgBytes+=Z0(t),e.suspenseyImages.push(t)),e=gz.bind(e),t.decode().then(e,e))}function mz(e,t,r,s){if(r.type==="stylesheet"&&(typeof s.media!="string"||matchMedia(s.media).matches!==!1)&&(r.state.loading&4)===0){if(r.instance===null){var o=Gl(s.href),c=t.querySelector(uu(o));if(c){t=c._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=fu.bind(e),t.then(e,e)),r.state.loading|=4,r.instance=c,Wt(c);return}c=t.ownerDocument||t,s=k0(s),(o=Qi.get(o))&&_m(s,o),c=c.createElement("link"),Wt(c);var h=c;h._p=new Promise(function(_,N){h.onload=_,h.onerror=N}),Rn(c,"link",s),r.instance=c}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(r,t),(t=r.state.preload)&&(r.state.loading&3)===0&&(e.count++,r=fu.bind(e),t.addEventListener("load",r),t.addEventListener("error",r))}}var sf=0;function pz(e,t){return e.stylesheets&&e.count===0&&lf(e,e.stylesheets),0sf?50:800)+t);return e.unsuspend=r,function(){e.unsuspend=null,clearTimeout(s),clearTimeout(o)}}:null}function L0(e){if(e.count===0&&(e.imgCount===0||!e.waitingForImages)){if(e.stylesheets)lf(e,e.stylesheets);else if(e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}}}function fu(){this.count--,L0(this)}function gz(){this.imgCount--,L0(this)}var af=null;function lf(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,af=new Map,t.forEach(vz,e),af=null,fu.call(e))}function vz(e,t){if(!(t.state.loading&4)){var r=af.get(e);if(r)var s=r.get(null);else{r=new Map,af.set(e,r);for(var o=e.querySelectorAll("link[data-precedence],style[data-precedence]"),c=0;c"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(i){console.error(i)}}return n(),jm.exports=Cz(),jm.exports}var Uz=Dz();const Zz=s1(Uz),$z=[{id:"current",label:"Classic"},{id:"light",label:"Light"},{id:"midnight",label:"Midnight"}],Mp="libbitcoinTheme",Rf="libbitcoin-theme-change";function jp(n){return n==="light"||n==="midnight"?n:"current"}function a1(){try{return jp(localStorage.getItem(Mp))}catch{return"current"}}function kp(n){document.documentElement.dataset.theme=n;const i=getComputedStyle(document.documentElement).getPropertyValue("--theme-background").trim();i&&document.querySelector('meta[name="theme-color"]')?.setAttribute("content",i)}function Lz(){kp(a1()),globalThis.addEventListener("storage",qz)}function Hz(n){const i=jp(n);kp(i);try{localStorage.setItem(Mp,i)}catch{}globalThis.dispatchEvent(new Event(Rf))}function Bz(){return jp(document.documentElement.dataset.theme)}function qz(n){n.key!==null&&n.key!==Mp||(kp(a1()),globalThis.dispatchEvent(new Event(Rf)))}function Vz(n){return globalThis.addEventListener(Rf,n),()=>{globalThis.removeEventListener(Rf,n)}}function Rp(){return se.useSyncExternalStore(Vz,Bz,()=>"current")}function Iz(){const n=Rp();return x.jsx("select",{"aria-label":"Theme",value:n,onChange:i=>{Hz(i.target.value)},className:"border-accent/40 bg-surface text-textPrimary focus:border-accent focus:ring-)DELIM" +R"DELIM(accent rounded-md border py-1.5 pr-8 pl-3 text-sm",children:$z.map(i=>x.jsx("option",{value:i.id,children:i.label},i.id))})}const l1="libbitcoinAdminDashboardBrowserNotifications";function o1(){try{return globalThis.window?.localStorage??null}catch{return null}}function Cp(){const n=globalThis.Notification;return typeof n=="function"?n:null}function u1(){return Cp()?.permission??"unsupported"}async function Pz(){const n=Cp();return n?n.permission!=="default"?n.permission:n.requestPermission():"unsupported"}function Kz(n=o1()){try{return u1()==="granted"&&n?.getItem(l1)==="true"}catch{return!1}}function Gz(n,i=o1()){try{i?.setItem(l1,String(n))}catch{}}function Yz(n,i){const a=Cp();if(!a||a.permission!=="granted")return!1;try{return new a(n,i),!0}catch{return!1}}function Fz({browserNotificationsEnabled:n,onClose:i,onBrowserNotificationsEnabledChange:a}){const[l,u]=se.useState(u1),[f,d]=se.useState(!1),[m,p]=se.useState(null),g=n&&l==="granted";async function b(){if(g){a(!1);return}d(!0),p(null);try{const y=await Pz();u(y),y==="granted"?a(!0):y==="denied"&&p("Permission was denied. It can be changed in your browser settings.")}catch{p("The browser could not enable notifications.")}finally{d(!1)}}return x.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 p-4 backdrop-blur-sm",role:"presentation",onMouseDown:y=>{y.target===y.currentTarget&&i()},children:x.jsxs("section",{role:"dialog","aria-modal":"true","aria-labelledby":"settings-title",className:"border-accent/30 bg-surface/95 max-h-[calc(100vh-2rem)] w-full max-w-xl overflow-y-auto rounded-2xl border shadow-2xl shadow-black/50",children:[x.jsxs("header",{className:"border-accent/20 flex items-start justify-between border-b p-5",children:[x.jsx("h2",{id:"settings-title",className:"text-accent text-xl font-semibold",children:"Settings"}),x.jsx("button",{type:"button",onClick:i,className:"text-textMuted hover:text-accent rounded p-1 text-xl","aria-label":"Close settings",children:"×"})]}),x.jsxs("div",{className:"space-y-5 p-5",children:[x.jsx(Iz,{}),x.jsxs("div",{className:"border-accentSecondary/20 bg-accent/5 space-y-3 rounded-xl border p-4",children:[x.jsxs("div",{children:[x.jsx("h3",{className:"text-textPrimary text-sm font-medium",children:"Browser notifications"}),x.jsx("p",{id:"browser-notifications-help",className:"text-textMuted mt-1 text-xs",children:Jz(l,g,f)})]}),x.jsx("button",{type:"button","aria-describedby":"browser-notifications-help",disabled:f||l==="unsupported"||l==="denied",onClick:()=>{b()},className:"border-accent/40 text-accent hover:border-accent hover:text-accentSecondary rounded-md border px-3 py-2 text-sm disabled:cursor-not-allowed disabled:opacity-50",children:Qz(l,g,f)}),m&&x.jsx("p",{className:"text-sm text-red-300",role:"alert",children:m})]}),x.jsx("div",{className:"flex justify-end pt-2",children:x.jsx("button",{type:"button",onClick:i,className:"border-accent/40 text-accent hover:border-accent hover:text-accentSecondary rounded-md border px-4 py-2 text-sm",children:"Done"})})]})]})})}function Qz(n,i,a){return a?"Requesting permission…":n==="unsupported"?"Notifications unavailable":n==="denied"?"Blocked by browser":i?"Disable notifications":"Enable notifications"}function Jz(n,i,a){return a?"Waiting for your browser permission choice.":n==="unsupported"?"This browser does not support system notifications.":n==="denied"?"Notifications are blocked. Allow them in your browser settings to enable this feature.":i?"System notifications will appear when the node enters or leaves the near-current range.":"Get a system notification when the node enters or leaves the near-current range."}function Xm(n){const i=Object.values(n).filter(l=>typeof l=="number");return Object.entries(n).filter(([l,u])=>i.indexOf(+l)===-1).map(([l,u])=>u)}function ub(n,i="|"){return n.map(a=>p1(a)).join(i)}function Wm(n,i){return typeof i=="bigint"?i.toString():i}class Xz{constructor(i){this._getter=i,this._value=void 0}get value(){const i=this._getter;return i!==void 0&&(this._value=i(),this._getter=void 0),this._value}}function Dp(n){return new Xz(n)}function Wz(n){return n==null}function Up(n){const i=n.startsWith("^")?1:0,a=n.endsWith("$")?n.length-1:n.length;return n.slice(i,a)}function eT(n,i){const a=n/i,l=Math.round(a),u=4*Number.EPSILON*Math.max(Math.abs(a),1);return Math.abs(a-l){const m=i._zod.def.shape[f];return l?l(m,f):m}):d1(n,f,l?l(d.value,f):d.value))}}function tT(n,i){for(const a of Reflect.ownKeys(i)){const l=Object.getOwnPropertyDescriptor(i,a);l.enumerable&&(l.get?f1(n,a,()=>i[a]):d1(n,a,l.value))}}function Di(...n){const i={};for(const a of n){const l=Object.getOwnPropertyDescriptors(a);Object.assign(i,l)}return Object.defineProperties({},i)}function nT(n){return JSON.stringify(n)}function iT(n){return n.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const h1="captureStackTrace"in Error?Error.captureStackTrace:(...n)=>{};function Cf(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}const rT=Dp(()=>{if(er.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const n=Function;return new n(""),!0}catch{return!1}});function io(n){if(Cf(n)===!1)return!1;const i=n.constructor;if(i===void 0||typeof i!="function")return!0;const a=i.prototype;return!(Cf(a)===!1||Object.prototype.hasOwnProperty.call(a,"isPrototypeOf")===!1)}function m1(n){return io(n)?{...n}:Array.isArray(n)?[...n]:n instanceof Map?new Map(n):n instanceof Set?new Set(n):n}const sT=new Set(["string","number","symbol"]);function ro(n){return n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function na(n,i,a){const l=new n._zod.constr(i??n._zod.def);return(!i||a?.parent)&&(l._zod.parent=n),l}function Te(n){const i=n;if(!i)return{};if(typeof i=="string")return{error:()=>i};if(i?.message!==void 0){if(i?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");i.error=i.message}return delete i.message,typeof i.error=="string"?{...i,error:()=>i.error}:i}function p1(n){return typeof n=="bigint"?n.toString()+"n":typeof n=="string"?`"${n}"`:`${n}`}function aT(n){return Object.keys(n).filter(i=>n[i]._zod.optin!==void 0&&n[i]._zod.optout==="optional")}const g1={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]},lT={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function oT(n,i){const a=n._zod.def,l=a.checks;if(l&&l.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const f={};return Wa(f,n,Qf(n,i)),na(n,Di(a,{shape:f,checks:[]}))}function Qf(n,i){const a=hs(n),l=[];for(const u of Reflect.ownKeys(i)){if(!Object.getOwnPropertyDescriptor(a,u)?.enumerable)throw new Error(`Unrecognized key: "${String(u)}"`);i[u]&&l.push(u)}return l}function uT(n,i){const a=n._zod.def,l=a.checks;if(l&&l.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const f=new Set(Qf(n,i)),d={};return Wa(d,n,Reflect.ownKeys(hs(n)).filter(m=>!f.has(m))),na(n,Di(a,{shape:d,checks:[]}))}function cT(n,i){if(!io(i))throw new Error("Invalid input to extend: expected a plain object");const a=n._zod.def.checks;if(a&&a.length>0){const u=hs(n);for(const f of Reflect.ownKeys(i))if(Obje)DELIM" +R"DELIM(ct.getOwnPropertyDescriptor(u,f)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return na(n,Di(n._zod.def,{shape:v1(n,i)}))}function v1(n,i){const a={};return Wa(a,n,Reflect.ownKeys(hs(n))),tT(a,i),a}function fT(n,i){if(!io(i))throw new Error("Invalid input to safeExtend: expected a plain object");return na(n,Di(n._zod.def,{shape:v1(n,i)}))}function dT(n,i){if(!i?._zod?.def)throw new Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(n._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");const a={};Wa(a,n,Reflect.ownKeys(hs(n))),Wa(a,i,Reflect.ownKeys(hs(i)));const l=Di(n._zod.def,{shape:a,get catchall(){return i._zod.def.catchall},checks:i._zod.def.checks??[]});return na(n,l)}function cb(n,i,a,l="partial"){const f=i._zod.def.checks;if(f&&f.length>0)throw new Error(`.${l}() cannot be used on object schemas containing refinements`);const m=a?new Set(Qf(i,a)):void 0,p={};return Wa(p,i,Reflect.ownKeys(hs(i)),n&&((g,b)=>m&&!m.has(b)?g:new n({type:"optional",innerType:g}))),na(i,Di(i._zod.def,{shape:p,checks:[]}))}function hT(n,i,a){const l=a?new Set(Qf(i,a)):void 0,u={};return Wa(u,i,Reflect.ownKeys(hs(i)),(f,d)=>l&&!l.has(d)?f:new n({type:"nonoptional",innerType:f})),na(i,Di(i._zod.def,{shape:u}))}function _r(n,i=0){if(n.aborted===!0)return!0;for(let a=i;a{var l;return(l=a).path??(l.path=[]),a.path.unshift(n),a})}function vu(n){return typeof n=="string"?n:n?.message}function fb(n){const i=[];for(const a of n??[]){const l=a._zod.def;if(!/_(length|size)$|_equals$/.test(l.check))break;const u=l.maximum??l.length??l.size;u>=0&&i.push([u,a])}return i}function ep(n,i,a){var l;for(let u=i;un;return i[xT]=!0,i}var db;const Um={value:void 0,enumerable:!1};let hb="captureStackTrace"in Error?Error:null;function zT(n){const i=hb;if(i){const a=i.stackTraceLimit;if(typeof a=="number"){try{i.stackTraceLimit=0}catch{return hb=null,new n}try{return new n}finally{i.stackTraceLimit=a}}}return new n}function Y(n,i,a,l){const u={};function f(w){this.def=w,this.constr=y,this.traits=new Set}f.prototype=u;const d=a,m=d&&new WeakSet;function p(w,O){if(w._zod){if(w._zod.traits.has(n))return}else{Um.value=new f(O);try{Object.defineProperty(w,"_zod",Um)}finally{Um.value=void 0}}if(w._zod.traits.add(n),i(w,O),m){const A=Object.getPrototypeOf(w),k=w._zod.constr.prototype;let L=A;for(;L&&L!==k;)L=Object.getPrototypeOf(L);const D=L??A;m.has(D)||(m.add(D),vT(D,d))}const T=y.prototype;for(const A in T)Object.prototype.hasOwnProperty.call(T,A)&&(A in w||(w[A]=T[A].bind(w)))}const g=l?.Parent??Object;class b extends g{}Object.defineProperty(b,"name",{value:n});function y(w){const O=l?.Parent?zT(b):this;p(O,w);const T=O._zod.deferred;if(T){for(const k of T)k();O._zod.deferred=void 0}const A=globalThis.__zod_globalConfig?.postProcessor;return A&&A(O),O}return Object.defineProperty(y,"init",{value:p}),Object.defineProperty(y,Symbol.hasInstance,{value:w=>l?.Parent&&w instanceof l.Parent?!0:w?._zod?.traits?.has(n)}),Object.defineProperty(y,"name",{value:n}),y}class Ja extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class _1 extends Error{constructor(i){super(`Encountered unidirectional transform during encode: ${i}`),this.name="ZodEncodeError"}}(db=globalThis).__zod_globalConfig??(db.__zod_globalConfig={});const er=globalThis.__zod_globalConfig;function Br(n){return n&&Object.assign(er,n),er}function TT(){const n=this._zod;return n.message??(n.message=JSON.stringify(n.def,Wm,2)),n.message}function ET(n){this._zod.message=n}const OT={get:TT,set:ET,enumerable:!0,configurable:!0},Zm={value:void 0,enumerable:!1},mb=new WeakSet([Object.prototype,Error.prototype]),NT=(n,i)=>{n.name="$ZodError",Zm.value=i,Object.defineProperty(n,"issues",Zm),Zm.value=void 0,Object.defineProperty(n,"message",OT);const a=Object.getPrototypeOf(n);mb.has(a)||(mb.add(a),Object.defineProperty(a,"toString",{configurable:!0,enumerable:!1,get(){const l=()=>this.message;return Object.defineProperty(this,"toString",{value:l,configurable:!0,writable:!0}),l},set(l){Object.defineProperty(this,"toString",{value:l,configurable:!0,writable:!0})}}))},AT=Y("$ZodError",NT);function MT(n,i,a){return Object.prototype.hasOwnProperty.call(n,i)||(i==="__proto__"?Object.defineProperty(n,i,{value:a(),writable:!0,enumerable:!0,configurable:!0}):n[i]=a()),n[i]}function jT(n,i=a=>a.message){const a={},l=[];for(const u of n.issues)u.path.length>0?MT(a,u.path[0],()=>[]).push(i(u)):l.push(i(u));return{formErrors:l,fieldErrors:a}}function kT(n,i=a=>a.message){const a={_errors:[]},l=(u,f=[])=>{for(const d of u.issues)if(d.code==="invalid_union"&&d.errors.length)d.errors.map(m=>l({issues:m},[...f,...d.path]));else if(d.code==="invalid_key")l({issues:d.issu)DELIM" +R"DELIM(es},[...f,...d.path]);else if(d.code==="invalid_element")l({issues:d.issues},[...f,...d.path]);else{const m=[...f,...d.path];if(m.length===0)a._errors.push(i(d));else{let p=a,g=0;for(;g{const i=(a,l,u,f)=>{const d=u?{...u,async:!1}:{async:!1},m=a._zod.run({value:l,issues:[]},d);if(m instanceof Promise)throw new Ja;if(m.issues.length){const p=new(f?.Err??n)(m.issues.map(g=>Js(g,d,Br())));throw h1(p,f?.callee??i),p}return m.value};return i},Hp=n=>{const i=async(a,l,u,f)=>{const d=u?{...u,async:!0}:{async:!0};let m=a._zod.run({value:l,issues:[]},d);if(m instanceof Promise&&(m=await m),m.issues.length){const p=new(f?.Err??n)(m.issues.map(g=>Js(g,d,Br())));throw h1(p,f?.callee??i),p}return m.value};return i},Bp=n=>(i,a,l)=>{const u=l?{...l,async:!1}:{async:!1},f=i._zod.run({value:a,issues:[]},u);if(f instanceof Promise)throw new Ja;return f.issues.length?S1(n,f.issues,u):{success:!0,data:f.value}};function S1(n,i,a){let l;return{success:!1,get error(){return l||(l=new n(i.map(u=>Js(u,a,Br()))),i=void 0,a=void 0),l},set error(u){l=u,i=void 0,a=void 0}}}const qp=n=>async(i,a,l)=>{const u=l?{...l,async:!0}:{async:!0};let f=i._zod.run({value:a,issues:[]},u);return f instanceof Promise&&(f=await f),f.issues.length?S1(n,f.issues,u):{success:!0,data:f.value}},RT=Symbol.for("zod.compile.invalid"),CT=Symbol.for("zod.compile.fallback"),DT=((n,i,a)=>{const l=n._zod.bag.validator;if(l!==void 0){if(l(i)!==RT)return!0;if(l.definite===!0&&a===void 0)return!1}return UT(n,i,a)});function UT(n,i,a){const l=a?{...a,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},u=n._zod.bag.fallbackRun;let f;if(u?(l[CT]=!0,f=u({value:i,issues:[]},l)):f=n._zod.run({value:i,issues:[]},l),f instanceof Promise)throw new Ja;return f.issues.length===0}const ZT=async(n,i,a)=>{const l=a?{...a,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0};let u=n._zod.run({value:i,issues:[]},l);return u instanceof Promise&&(u=await u),u.issues.length===0},$T=n=>{const i=Lp(n),a=(l,u,f,d)=>{const m=f?{...f,direction:"backward"}:{direction:"backward"};return i(l,u,m,Jf(a,d))};return a},LT=n=>{const i=Lp(n),a=(l,u,f,d)=>i(l,u,f,Jf(a,d));return a},HT=n=>{const i=Hp(n),a=async(l,u,f,d)=>{const m=f?{...f,direction:"backward"}:{direction:"backward"};return await i(l,u,m,Jf(a,d))};return a},BT=n=>{const i=Hp(n),a=async(l,u,f,d)=>await i(l,u,f,Jf(a,d));return a},qT=n=>(i,a,l)=>{const u=l?{...l,direction:"backward"}:{direction:"backward"};return Bp(n)(i,a,u)},VT=n=>(i,a,l)=>Bp(n)(i,a,l),IT=n=>async(i,a,l)=>{const u=l?{...l,direction:"backward"}:{direction:"backward"};return qp(n)(i,a,u)},PT=n=>async(i,a,l)=>qp(n)(i,a,l),KT=/^[cC][0-9a-z]{6,}$/,GT=/^[0-9a-z]+$/,YT=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,FT=/^[0-9a-vA-V]{20}$/,QT=/^[A-Za-z0-9]{27}$/,JT=/^[a-zA-Z0-9_-]{21}$/;function XT(n){return new RegExp(`^[a-zA-Z0-9_-]{${n}}$`)}const WT=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,eE=/^([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})$/,pb=n=>n?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${n}[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)$/,tE=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,nE="^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$";function iE(){return new RegExp(nE,"u")}const rE=/^(?:(?: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])$/,sE=/^(([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}|:))$/,aE=/^((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])$/,lE=/^(([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}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,oE=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,uE=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/,cE=/^https?$/,fE=/^\+[1-9]\d{6,14}$/,x1="(?:(?:\\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])))";function dE(n){return new RegExp(`^${n}$`)}const hE=dE(x1);function tp(n){const i="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof n.precision=="number"?n.precision===-1?`${i}`:n.precision===0?`${i}:[0-5]\\d`:`${i}:[0-5]\\d\\.\\d{${n.precision}}`:n.seconds?`${i}:[0-5]\\d(?:\\.\\d+)?`:`${i}(?::[0-5]\\d(?:\\.\\d+)?)?`}function mE(n){return new RegExp(`^${tp(n)}$`)}function pE(n){const i=["Z"];n.offset&&i.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const a=`${tp({precision:n.precision,seconds:!0})}(?:${i.join("|")})`,l=n.local?`${a}|${tp({precision:n.precision})}`:a;return new RegExp(`^${x1}T(?:${l})$`)}const gE=/^[\s\S]{0,}$/,vE=/^-?\d+$/,Vp=/^-?\d+(?:\.\d+)?$/,yE=/^(?:true|false)$/i,bE=/^[^A-Z]*$/,_E=/^[^a-z]*$/,yi=Y("$ZodCheck",(n,i)=>{var a;n._zod??(n._zod={}),n._zod.def=i,(a=n._zod).onattach??(a.onattach=[])}),Ip=n=>{const i=n.value;return!Wz(i)&&i.length!==void 0},Df={number:"number",bigint:"bigint",object:"date"},w1=Y("$ZodCheckLessThan",(n,i)=>{yi.init(n,i);const a=Df[typeof i.value];n._zod.check=l=>{(i.inclusive?l.value<=i.value:l.value{yi.init(n,i);const a=Df[typeof i.value];n._zod.check=l=>{(i.inclusive?l.value>=i.value:l.value>i.value)||l.issues.push({origin:Df[typeof l.value]??a,code:"too_small",minimum:typeof i.value=="object"?i.value.getTime():i.value,input:l.value,inclusive:i.inclusive,inst:n,continue:!i.abort})}}),SE=Y("$ZodCheckMultipleOf",(n,i)=>{yi.init(n,i),n._zod.check=a=>{if(typeof a.value!=typeof i.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof a.value=="bigint"?i.value!==BigInt(0)&&a.value%i.value===BigInt(0):eT(a.value,i.value)===0)||a.issues.push({origin:typeof a.value,code:"not_multiple_of",divisor:i.value,input:a.value,inst:n,continue:!i.abort})}}),xE=Y("$ZodCheckNumberFormat",(n,i)=>{yi.init(n,i),i.format=i.format||"float64";const a=i.format?.includes("int"),l=a?"int":"number",[u,f]=g1[i.format];n._zod.check=d=>{const m=d.value;if(a){if(!Number.isInteger(m)){d.issues.push({expected:l,format:i.format,code:"invalid_type",continue:!1,input:m,inst:n});return}if(!Number.isSafeInteger(m)){m>0?d.issues.push({input:m,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:n,origin:l,inclusive:!0,continue:!i.abort}):d.issues.push({input:m,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst)DELIM" +R"DELIM(:n,origin:l,inclusive:!0,continue:!i.abort});return}}mf&&d.issues.push({origin:"number",input:m,code:"too_big",maximum:f,inclusive:!0,inst:n,continue:!i.abort})}}),wE=Y("$ZodCheckMaxLength",(n,i)=>{var a;yi.init(n,i),(a=n._zod.def).when??(a.when=Ip),n._zod.check=l=>{const u=l.value,f=u.length;if((typeof u=="string"&&f>i.maximum?Zp(u):f)<=i.maximum)return;const m=$p(u);l.issues.push({origin:m,code:"too_big",maximum:i.maximum,inclusive:!0,input:u,inst:n,continue:!i.abort})}}),zE=Y("$ZodCheckMinLength",(n,i)=>{var a;yi.init(n,i),(a=n._zod.def).when??(a.when=Ip),n._zod.check=l=>{const u=l.value,f=u.length;if((typeof u=="string"&&f>=i.minimum&&f=i.minimum)return;const m=$p(u);l.issues.push({origin:m,code:"too_small",minimum:i.minimum,inclusive:!0,input:u,inst:n,continue:!i.abort})}}),TE=Y("$ZodCheckLengthEquals",(n,i)=>{var a;yi.init(n,i),(a=n._zod.def).when??(a.when=Ip),n._zod.check=l=>{const u=l.value,f=u.length,d=typeof u=="string"&&f>=i.length&&f<=i.length*2?Zp(u):f;if(d===i.length)return;const m=$p(u),p=d>i.length;l.issues.push({origin:m,...p?{code:"too_big",maximum:i.length}:{code:"too_small",minimum:i.length},inclusive:!0,exact:!0,input:l.value,inst:n,continue:!i.abort})}}),Xf=Y("$ZodCheckStringFormat",(n,i)=>{var a,l;yi.init(n,i),i.pattern?(a=n._zod).check??(a.check=u=>{i.pattern.lastIndex=0,!i.pattern.test(u.value)&&u.issues.push({origin:"string",code:"invalid_format",format:i.format,input:u.value,...i.pattern?{pattern:i.pattern.toString()}:{},inst:n,continue:!i.abort})}):(l=n._zod).check??(l.check=()=>{})}),EE=Y("$ZodCheckRegex",(n,i)=>{Xf.init(n,i),n._zod.check=a=>{i.pattern.lastIndex=0,!i.pattern.test(a.value)&&a.issues.push({origin:"string",code:"invalid_format",format:"regex",input:a.value,pattern:i.pattern.toString(),inst:n,continue:!i.abort})}}),OE=Y("$ZodCheckLowerCase",(n,i)=>{i.pattern??(i.pattern=bE),Xf.init(n,i)}),NE=Y("$ZodCheckUpperCase",(n,i)=>{i.pattern??(i.pattern=_E),Xf.init(n,i)}),AE=Y("$ZodCheckIncludes",(n,i)=>{yi.init(n,i);const a=ro(i.includes),l=new RegExp(typeof i.position=="number"?`^.{${i.position},}${a}`:a);i.pattern=l,n._zod.check=u=>{u.value.includes(i.includes,i.position)||u.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:i.includes,input:u.value,inst:n,continue:!i.abort})}}),ME=Y("$ZodCheckStartsWith",(n,i)=>{yi.init(n,i);const a=new RegExp(`^${ro(i.prefix)}.*`);i.pattern??(i.pattern=a),n._zod.check=l=>{l.value.startsWith(i.prefix)||l.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:i.prefix,input:l.value,inst:n,continue:!i.abort})}}),jE=Y("$ZodCheckEndsWith",(n,i)=>{yi.init(n,i);const a=new RegExp(`.*${ro(i.suffix)}$`);i.pattern??(i.pattern=a),n._zod.check=l=>{l.value.endsWith(i.suffix)||l.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:i.suffix,input:l.value,inst:n,continue:!i.abort})}}),kE=Y("$ZodCheckOverwrite",(n,i)=>{yi.init(n,i),n._zod.check=a=>{a.value=i.tx(a.value)}});class RE{constructor(i=[],a={}){this.content=[],this.indent=0,this.args=i,this.closed=a}indented(i){this.indent+=1;try{i(this)}finally{this.indent-=1}}write(i){if(typeof i=="function"){i(this,{execution:"sync"}),i(this,{execution:"async"});return}const l=i.split(` `).filter(d=>d),u=Math.min(...l.map(d=>d.length-d.trimStart().length)),f=l.map(d=>d.slice(u)).map(d=>" ".repeat(this.indent*2)+d);for(const d of f)this.content.push(d)}compile(){const i=Function,a=this?.content??[""];return new i(...Object.keys(this.closed),`return function (${this.args.join(", ")}) { ${a.join(` `)} -};`)(...Object.values(this.closed))}}const kE={major:4,minor:6,patch:7},Ot=Y("$ZodType",(n,i)=>{var a;n??(n={}),n._zod.def=i,n._zod.bag=n._zod.bag||{},n._zod.version=kE;const l=n._zod.def.checks,u=n._zod.traits.has("$ZodCheck")?[n,...l??[]]:l?.length?[...l]:[];for(const f of u)for(const d of f._zod.onattach)d(n);if(u.length===0)(a=n._zod).deferred??(a.deferred=[]),n._zod.deferred?.push(()=>{n._zod.run=n._zod.parse});else{const f=(m,p,g)=>{if(m.memo)return m;let b=_r(m),y;for(const w of p){if(w._zod.def.when){if(dT(m)||!w._zod.def.when(m))continue}else if(b)continue;const O=m.issues.length,T=w._zod.check(m);if(T instanceof Promise&&g?.async===!1)throw new Ja;if(y||T instanceof Promise)y=(y??Promise.resolve()).then(async()=>{await T,m.issues.length!==O&&(ep(m.issues,O,n),b||(b=_r(m,O)))});else{if(m.issues.length===O)continue;ep(m.issues,O,n),b||(b=_r(m,O))}}return y?y.then(()=>m):m},d=(m,p,g)=>{if(_r(m))return m.aborted=!0,m;const b=f(p,u,g);if(b instanceof Promise){if(g.async===!1)throw new Ja;return b.then(y=>n._zod.parse(y,g))}return n._zod.parse(b,g)};n._zod.run=(m,p)=>{if(p.skipChecks)return n._zod.parse(m,p);if(p.direction==="backward"){const b=n._zod.parse({value:m.value,issues:[]},{...p,skipChecks:!0});return b instanceof Promise?b.then(y=>d(y,m,p)):d(b,m,p)}const g=n._zod.parse(m,p);if(g instanceof Promise){if(p.async===!1)throw new Ja;return g.then(b=>f(b,u,p))}return f(g,u,p)}}},{get"~standard"(){return v1(this,"~standard",T1(this))},set"~standard"(n){Xs(this,"~standard",n)}}),z1=(n,i)=>n.issues.length?{issues:n.issues.map(a=>Js(a,i,Br()))}:{value:n.value};async function RE(n,i){const a={async:!0};return z1(await n._zod.run({value:i,issues:[]},a),a)}function T1(n){return{validate:i=>{const a={async:!1};try{const l=n._zod.run({value:i,issues:[]},a);if(!(l instanceof Promise))return z1(l,a)}catch{}return RE(n,i)},vendor:"zod",version:1}}const Pp=Y("$ZodString",(n,i)=>{Ot.init(n,i),n._zod.pattern=i.pattern??mE,n._zod.parse=(a,l)=>{if(i.coerce)try{a.value=String(a.value)}catch{}return typeof a.value=="string"||a.issues.push({expected:"string",code:"invalid_type",input:a.value,inst:n}),a}}),Ct=Y("$ZodStringFormat",(n,i)=>{Xf.init(n,i),Pp.init(n,i)}),CE=Y("$ZodGUID",(n,i)=>{i.pattern??(i.pattern=XT),Ct.init(n,i)}),DE=Y("$ZodUUID",(n,i)=>{if(i.version){const l={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[i.version];if(l===void 0)throw new Error(`Invalid UUID version: "${i.version}"`);i.pattern??(i.pattern=pb(l))}else i.pattern??(i.pattern=pb());Ct.init(n,i)}),UE=Y("$ZodEmail",(n,i)=>{i.pattern??(i.pattern=WT),Ct.init(n,i)}),E1=1,Uf=2;function O1(n){try{return typeof URL<"u"&&typeof URL.canParse=="function"?URL.canParse(n):(new URL(n),!0)}catch{return!1}}function ZE(n,i){return!("normalize"in i)&&!("hostname"in i)&&!("protocol"in i)?O1(n)||Uf:$E(n,i)}function $E(n,i){if(!i.normalize&&i.protocol?.source===oE.source&&!/^https?:\/\//i.test(n))return E1;try{if(typeof URL<"u"){const a=URL;if(typeof a.parse=="function")return a.parse(n)??Uf}return new URL(n)}catch{return Uf}}const LE=/[\t\n\r]/g;function gb(n){return n.replace(LE,"")}function HE(n,i){return i.lastIndex=0,i.test(n.hostname)}function BE(n,i){return i.lastIndex=0,i.test(n.protocol.endsWith(":")?n.protocol.slice(0,-1):n.protocol)}const qE=Y("$ZodURL",(n,i)=>{Ct.init(n,i),n._zod.check=a=>{try{const l=a.value.trim(),u=ZE(l,i);if(u===E1){a.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:a.value,inst:n,continue:!i.abort});return}if(u===Uf){a.issues.push({code:"invalid_format",format:"url",input:a.value,inst:n,continue:!i.abort});return}if(u===!0){a.value=gb(l);return}i.hostname&&!HE(u,i.hostname)&&a.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:i.hostname.source,input:a.value,inst:n,continue:!i.abort}),i.protocol&&!BE(u,i.protocol)&&a.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:i.protocol.source,input:a.value,inst:n,continue:!i.abort}),a.value=i.normalize?u.href:gb(l);return}catch{a.issues.push({code:"invalid_format",format:"url",input:a.value,inst:n,continue:!i.abort})}}}),VE=Y("$ZodEmoji",(n,i)=>{i.pattern??(i.pattern=tE()),Ct.init(n,i)}),IE=Y("$ZodNanoID",(n,i)=>{if(i.length!==void 0&&(!Number.isInteger(i.length)||i.length<1))throw new Error(`Invalid nanoid length: ${i.length}`);i.pattern??(i.pat)DELIM" -R"DELIM(tern=i.length===void 0?FT:QT(i.length)),Ct.init(n,i)}),PE=Y("$ZodCUID",(n,i)=>{i.pattern??(i.pattern=IT),Ct.init(n,i)}),KE=Y("$ZodCUID2",(n,i)=>{i.pattern??(i.pattern=PT),Ct.init(n,i)}),GE=Y("$ZodULID",(n,i)=>{i.pattern??(i.pattern=KT),Ct.init(n,i)}),YE=Y("$ZodXID",(n,i)=>{i.pattern??(i.pattern=GT),Ct.init(n,i)}),FE=Y("$ZodKSUID",(n,i)=>{i.pattern??(i.pattern=YT),Ct.init(n,i)}),QE=Y("$ZodISODateTime",(n,i)=>{i.pattern??(i.pattern=hE(i)),Ct.init(n,i)}),JE=Y("$ZodISODate",(n,i)=>{i.pattern??(i.pattern=fE),Ct.init(n,i)}),XE=Y("$ZodISOTime",(n,i)=>{i.pattern??(i.pattern=dE(i)),Ct.init(n,i)}),WE=Y("$ZodISODuration",(n,i)=>{i.pattern??(i.pattern=JT),Ct.init(n,i)}),eO=Y("$ZodIPv4",(n,i)=>{i.pattern??(i.pattern=nE),Ct.init(n,i)}),tO=/^[0-9a-fA-F:.]+$/;function N1(n){return tO.test(n)?O1(`http://[${n}]`):!1}const nO=Y("$ZodIPv6",(n,i)=>{i.pattern??(i.pattern=iE),Ct.init(n,i),n._zod.check=a=>{N1(a.value)||a.issues.push({code:"invalid_format",format:"ipv6",input:a.value,inst:n,continue:!i.abort})}}),iO=Y("$ZodCIDRv4",(n,i)=>{i.pattern??(i.pattern=rE),Ct.init(n,i)});function rO(n){const i=n.split("/");if(i.length!==2)return!1;const[a,l]=i;if(!l)return!1;const u=Number(l);return`${u}`!==l||u<0||u>128?!1:N1(a)}const sO=Y("$ZodCIDRv6",(n,i)=>{i.pattern??(i.pattern=sE),Ct.init(n,i),n._zod.check=a=>{rO(a.value)||a.issues.push({code:"invalid_format",format:"cidrv6",input:a.value,inst:n,continue:!i.abort})}});function A1(n){if(n==="")return!0;if(/\s/.test(n)||n.length%4!==0)return!1;try{return atob(n),!0}catch{return!1}}const M1=/^[0-9a-zA-Z+/]*={0,2}$/,aO=Y("$ZodBase64",(n,i)=>{i.pattern??(i.pattern=M1),Ct.init(n,i),n._zod.check=a=>{A1(a.value)||a.issues.push({code:"invalid_format",format:"base64",input:a.value,inst:n,continue:!i.abort})}}),Kp=/^[A-Za-z0-9_-]*$/;function lO(n){if(!Kp.test(n))return!1;const i=n.replace(/[-_]/g,l=>l==="-"?"+":"/"),a=i.padEnd(Math.ceil(i.length/4)*4,"=");return A1(a)}const oO=Y("$ZodBase64URL",(n,i)=>{i.pattern??(i.pattern=Kp),Ct.init(n,i),n._zod.check=a=>{lO(a.value)||a.issues.push({code:"invalid_format",format:"base64url",input:a.value,inst:n,continue:!i.abort})}}),uO=Y("$ZodE164",(n,i)=>{i.pattern??(i.pattern=uE),Ct.init(n,i)});function cO(n,i=null){try{const a=n.split(".");if(a.length!==3)return!1;const[l]=a;if(!l)return!1;const u=JSON.parse(atob(l));return!("typ"in u&&u?.typ!=="JWT"||!u.alg||i&&(!("alg"in u)||u.alg!==i))}catch{return!1}}const fO=Y("$ZodJWT",(n,i)=>{Ct.init(n,i),n._zod.check=a=>{cO(a.value,i.alg)||a.issues.push({code:"invalid_format",format:"jwt",input:a.value,inst:n,continue:!i.abort})}}),j1=Y("$ZodNumber",(n,i)=>{Ot.init(n,i),n._zod.pattern=Vp,n._zod.parse=(a,l)=>{if(i.coerce)try{a.value=Number(a.value)}catch{}const u=a.value;if(typeof u=="number"&&!Number.isNaN(u)&&Number.isFinite(u))return a;const f=typeof u=="number"?Number.isNaN(u)?"NaN":Number.isFinite(u)?void 0:String(u):void 0;return a.issues.push({expected:"number",code:"invalid_type",input:u,inst:n,...f?{received:f}:{}}),a}}),dO=Y("$ZodNumberFormat",(n,i)=>{_E.init(n,i),j1.init(n,i)}),hO=Y("$ZodBoolean",(n,i)=>{Ot.init(n,i),n._zod.pattern=gE,n._zod.parse=(a,l)=>{if(i.coerce)try{a.value=!!a.value}catch{}const u=a.value;return typeof u=="boolean"||a.issues.push({expected:"boolean",code:"invalid_type",input:u,inst:n}),a}}),mO=Y("$ZodUnknown",(n,i)=>{Ot.init(n,i),n._zod.parse=a=>a}),pO=Y("$ZodNever",(n,i)=>{Ot.init(n,i),n._zod.parse=(a,l)=>(a.issues.push({expected:"never",code:"invalid_type",input:a.value,inst:n}),a)});function gO(n,i){const a=fb(n._zod.def.checks);if(!a.length)return;const l=Math.min(...a.map(f=>f[0])),u=n._zod.parse;n._zod.parse=(f,d)=>{const m=i(f.value);if(m>l&&!d?.skipChecks&&d?.direction!=="backward"){for(const[p,g]of fb(n._zod.def.checks))if(m>p&&g._zod.def.when(f)){const b=f.issues.length;return g._zod.check(f),f.issues[b].continue=!1,ep(f.issues,b,n),f}}return u(f,d)}}const vO=n=>Array.isArray(n)?n.length:-1;function vb(n,i,a){n.issues.length&&i.issues.push(...Qs(a,n.issues)),i.value[a]=n.value}const yO=Y("$ZodArray",(n,i)=>{Ot.init(n,i);const a=er.memoizer;a?.attach(n),n._zod.parse=(l,u)=>{const f=l.value;if(!Array.isArray(f))return l.issues.push({expected:"array",code:"invalid_type",input:f,inst:n}),l;l.value=a?a.alloc(n,l,Array(f.length),u):Array(f.length);const d=[],m=u?.abortEarly;for(let p=0;pvb(y,l,p)));else if(vb(b,l,p),m&&b.issues.length!==0&&_r(b))break}return d.length?Promise.all(d).then(()=>l):l},gO(n,vO)});function Zf(n,i,a,l,u,f){const d=a in l,m=f==="optional";if(!(!d&&m&&u==="optional")){if(n.issues.length){if(u!==void 0&&m&&!d)return;i.issues.push(...Qs(a,n.issues))}if(!d&&u===void 0){n.issues.length||i.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[a]});return}n.value===void 0?(d||u==="defaulted"&&!m)&&(i.value[a]=void 0):i.value[a]=n.value}}const bO=[];function k1(n){const i=Object.keys(n.shape),a=Object.getOwnPropertySymbols(n.shape),l=a.length?a:bO,u=l.length?[...i,...l]:i;for(const d of u)if(!n.shape?.[d]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${String(d)}": expected a Zod schema`);const f=rT(n.shape);return{...n,allKeys:u,symbolKeys:l,keySet:new Set(i),numKeys:i.length,optionalKeys:new Set(f)}}function R1(n,i,a,l,u,f,d){const m=[],p=u.keySet,g=u.catchall._zod,b=g.def.type,y=g.optin,w=g.optout;let O=0;for(const T in i){if(d&&a.issues.length!==O){if(_r(a,O))break;O=a.issues.length}if(p.has(T))continue;if(T==="__proto__"){b==="never"&&m.push(T);continue}if(b==="never"){m.push(T);continue}const A=g.run({value:i[T],issues:[]},l);A instanceof Promise?n.push(A.then(k=>Zf(k,a,T,i,y,w))):Zf(A,a,T,i,y,w)}return m.length&&a.issues.push({code:"unrecognized_keys",keys:m,input:i,inst:f,continue:!0}),n.length?Promise.all(n).then(()=>a):a}const _O=Y("$ZodObject",(n,i)=>{Ot.init(n,i);const a=Object.getOwnPropertyDescriptor(i,"shape"),l=a?.get?a.get.raw:i.shape??{};if(l){const g=()=>{const b={...l};return Object.defineProperty(i,"shape",{value:b}),g.raw=b,b};g.raw=l,Object.defineProperty(i,"shape",{get:g})}const u=Dp(()=>k1(i));ot(n,"propValues",g=>{const b=g.def.shape,y={};for(const w in b){const O=b[w]._zod;if(O.values){Object.prototype.hasOwnProperty.call(y,w)||ta(y,w,new Set);for(const T of O.values)y[w].add(T);O.optin!==void 0&&y[w].add(void 0)}}return y});const f=Cf,d=i.catchall;let m;const p=er.memoizer;p?.attach(n),n._zod.parse=(g,b)=>{m??(m=u.value);const y=g.value;if(!f(y))return g.issues.push({expected:"object",code:"invalid_type",input:y,inst:n}),g;g.value=p?p.alloc(n,g,{},b):{};const w=[],O=m.shape,T=b?.abortEarly;let A=g.issues.length;for(const k of m.allKeys){if(T&&g.issues.length!==A){if(_r(g,A))break;A=g.issues.length}if(k==="__proto__")continue;const L=O[k],D=L._zod.optin,X=L._zod.optout,G=L._zod.run({value:y[k],issues:[]},b);G instanceof Promise?w.push(G.then(ee=>Zf(ee,g,k,y,D,X))):Zf(G,g,k,y,D,X)}return d?R1(w,y,g,b,u.value,n,T===!0):w.length?Promise.all(w).then(()=>g):g}}),SO=Y("$ZodObjectJIT",(n,i)=>{_O.init(n,i);const a=n._zod.parse,l=Dp(()=>k1(i)),u=er.memoizer,f=O=>{const T=l.value,A=T.symbolKeys,k=new jE(["payload","ctx"],{shape:O,inst:n,memo:u,syms:A}),L=ee=>`shape[${ee}]._zod.run({ value: input[${ee}], issues: [] }, ctx)`,D=(ee,V)=>` +};`)(...Object.values(this.closed))}}const CE={major:4,minor:6,patch:7},Ot=Y("$ZodType",(n,i)=>{var a;n??(n={}),n._zod.def=i,n._zod.bag=n._zod.bag||{},n._zod.version=CE;const l=n._zod.def.checks,u=n._zod.traits.has("$ZodCheck")?[n,...l??[]]:l?.length?[...l]:[];for(const f of u)for(const d of f._zod.onattach)d(n);if(u.length===0)(a=n._zod).deferred??(a.deferred=[]),n._zod.deferred?.push(()=>{n._zod.run=n._zod.parse});else{const f=(m,p,g)=>{if(m.memo)return m;let b=_r(m),y;for(const w of p){if(w._zod.def.when){if(mT(m)||!w._zod.def.when(m))continue}else if(b)continue;const O=m.issues.length,T=w._zod.check(m);if(T instanceof Promise&&g?.async===!1)throw new Ja;if(y||T instanceof Promise)y=(y??Promise.resolve()).then(async()=>{await T,m.issues.length!==O&&(ep(m.issues,O,n),b||(b=_r(m,O)))});else{if(m.issues.length===O)continue;ep(m.issues,O,n),b||(b=_r(m,O))}}return y?y.then(()=>m):m},d=(m,p,g)=>{if(_r(m))return m.aborted=!0,m;const b=f(p,u,g);if(b instanceof Promise){if(g.async===!1)throw new Ja;return b.then(y=>n._zod.parse(y,g))}return n._zod.parse(b,g)};n._zod.run=(m,p)=>{if(p.skipChecks)return n._zod.parse(m,p);if(p.direction==="backward"){const b=n._zod.parse({value:m.value,issues:[]},{...p,skipChecks:!0});return b instanceof Promise?b.then(y=>d(y,m,p)):d(b,m,p)}const g=n._zod.parse(m,p);if(g instanceof Promise){if(p.async===!1)throw new Ja;return g.then(b=>f(b,u,p))}return f(g,u,p)}}},{get"~standard"(){return y1(this,"~standard",E1(this))},set"~standard"(n){Xs(this,"~standard",n)}}),T1=(n,i)=>n.issues.length?{issues:n.issues.map(a=>Js(a,i,Br()))}:{value:n.value};async function DE(n,i){const a={async:!0};return T1(await n._zod.run({value:i,issues:[]},a),a)}function E1(n){return{validate:i=>{const a={async:!1};try{const l=n._zod.run({value:i,issues:[]},a);if(!(l instanceof Promise))return T1(l,a)}catch{}return DE(n,i)},vendor:"zod",version:1}}const Pp=Y("$ZodString",(n,i)=>{Ot.init(n,i),n._zod.pattern=i.pattern??gE,n._zod.parse=(a,l)=>{if(i.coerce)try{a.value=String(a.value)}catch{}return typeof a.value=="string"||a.issues.push({expected:"string",code:"invalid_type",input:a.value,inst:n}),a}}),Ct=Y("$ZodStringFormat",(n,i)=>{Xf.init(n,i),Pp.init(n,i)}),UE=Y("$ZodGUID",(n,i)=>{i.pattern??(i.pattern=eE),Ct.init(n,i)}),ZE=Y("$ZodUUID",(n,i)=>{if(i.version){const l={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[i.version];if(l===void 0)throw new Error(`Invalid UUID version: "${i.version}"`);i.pattern??(i.pattern=pb(l))}else i.pattern??(i.pattern=pb());Ct.init(n,i)}),$E=Y("$ZodEmail",(n,i)=>{i.pattern??(i.pattern=tE),Ct.init(n,i)}),O1=1,Uf=2;function N1(n){try{return typeof URL<"u"&&typeof URL.canParse=="function"?URL.canParse(n):(new URL(n),!0)}catch{return!1}}function LE(n,i){return!("normalize"in i)&&!("hostname"in i)&&!("protocol"in i)?N1(n)||Uf:HE(n,i)}function HE(n,i){if(!i.normalize&&i.protocol?.source===cE.source&&!/^https?:\/\//i.test(n))return O1;try{if(typeof URL<"u"){const a=URL;if(typeof a.parse=="function")return a.parse(n)??Uf}return new URL(n)}catch{return Uf}}const BE=/[\t\n\r]/g;function gb(n){return n.replace(BE,"")}function qE(n,i){return i.lastIndex=0,i.test(n.hostname)}function VE(n,i){return i.lastIndex=0,i.test(n.protocol.endsWith(":")?n.protocol.slice(0,-1):n.protocol)}const IE=Y("$ZodURL",(n,i)=>{Ct.init(n,i),n._zod.check=a=>{try{const l=a.value.trim(),u=LE(l,i);if(u===O1){a.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:a.value,inst:n,continue:!i.abort});return}if(u===Uf){a.issues.push({code:"invalid_format",format:"url",input:a.value,inst:n,continue:!i.abort});return}if(u===!0){a.value=gb(l);return}i.hostname&&!qE(u,i.hostname)&&a.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:i.hostname.source,input:a.value,inst:n,continue:!i.abort}),i.protocol&&!VE(u,i.protocol)&&a.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:i.protocol.source,input:a.value,inst:n,continue:!i.abort}),a.value=i.normalize?u.href:gb(l);return}catch{a.issues.push({code:"invalid_format",format:"url",input:a.value,inst:n,continue:!i.abort})}}}),PE=Y("$ZodEmoji",(n,i)=>{i.pattern??(i.pattern=iE()),Ct.init(n,i)}),KE=Y("$ZodNanoID",(n,i)=>{if(i.length!==void 0&&(!Number.isInteger(i.length)||i.length<1))throw new Error(`Invalid nanoid length: ${i.length}`);i.pattern??(i.pat)DELIM" +R"DELIM(tern=i.length===void 0?JT:XT(i.length)),Ct.init(n,i)}),GE=Y("$ZodCUID",(n,i)=>{i.pattern??(i.pattern=KT),Ct.init(n,i)}),YE=Y("$ZodCUID2",(n,i)=>{i.pattern??(i.pattern=GT),Ct.init(n,i)}),FE=Y("$ZodULID",(n,i)=>{i.pattern??(i.pattern=YT),Ct.init(n,i)}),QE=Y("$ZodXID",(n,i)=>{i.pattern??(i.pattern=FT),Ct.init(n,i)}),JE=Y("$ZodKSUID",(n,i)=>{i.pattern??(i.pattern=QT),Ct.init(n,i)}),XE=Y("$ZodISODateTime",(n,i)=>{i.pattern??(i.pattern=pE(i)),Ct.init(n,i)}),WE=Y("$ZodISODate",(n,i)=>{i.pattern??(i.pattern=hE),Ct.init(n,i)}),eO=Y("$ZodISOTime",(n,i)=>{i.pattern??(i.pattern=mE(i)),Ct.init(n,i)}),tO=Y("$ZodISODuration",(n,i)=>{i.pattern??(i.pattern=WT),Ct.init(n,i)}),nO=Y("$ZodIPv4",(n,i)=>{i.pattern??(i.pattern=rE),Ct.init(n,i)}),iO=/^[0-9a-fA-F:.]+$/;function A1(n){return iO.test(n)?N1(`http://[${n}]`):!1}const rO=Y("$ZodIPv6",(n,i)=>{i.pattern??(i.pattern=sE),Ct.init(n,i),n._zod.check=a=>{A1(a.value)||a.issues.push({code:"invalid_format",format:"ipv6",input:a.value,inst:n,continue:!i.abort})}}),sO=Y("$ZodCIDRv4",(n,i)=>{i.pattern??(i.pattern=aE),Ct.init(n,i)});function aO(n){const i=n.split("/");if(i.length!==2)return!1;const[a,l]=i;if(!l)return!1;const u=Number(l);return`${u}`!==l||u<0||u>128?!1:A1(a)}const lO=Y("$ZodCIDRv6",(n,i)=>{i.pattern??(i.pattern=lE),Ct.init(n,i),n._zod.check=a=>{aO(a.value)||a.issues.push({code:"invalid_format",format:"cidrv6",input:a.value,inst:n,continue:!i.abort})}});function M1(n){if(n==="")return!0;if(/\s/.test(n)||n.length%4!==0)return!1;try{return atob(n),!0}catch{return!1}}const j1=/^[0-9a-zA-Z+/]*={0,2}$/,oO=Y("$ZodBase64",(n,i)=>{i.pattern??(i.pattern=j1),Ct.init(n,i),n._zod.check=a=>{M1(a.value)||a.issues.push({code:"invalid_format",format:"base64",input:a.value,inst:n,continue:!i.abort})}}),Kp=/^[A-Za-z0-9_-]*$/;function uO(n){if(!Kp.test(n))return!1;const i=n.replace(/[-_]/g,l=>l==="-"?"+":"/"),a=i.padEnd(Math.ceil(i.length/4)*4,"=");return M1(a)}const cO=Y("$ZodBase64URL",(n,i)=>{i.pattern??(i.pattern=Kp),Ct.init(n,i),n._zod.check=a=>{uO(a.value)||a.issues.push({code:"invalid_format",format:"base64url",input:a.value,inst:n,continue:!i.abort})}}),fO=Y("$ZodE164",(n,i)=>{i.pattern??(i.pattern=fE),Ct.init(n,i)});function dO(n,i=null){try{const a=n.split(".");if(a.length!==3)return!1;const[l]=a;if(!l)return!1;const u=JSON.parse(atob(l));return!("typ"in u&&u?.typ!=="JWT"||!u.alg||i&&(!("alg"in u)||u.alg!==i))}catch{return!1}}const hO=Y("$ZodJWT",(n,i)=>{Ct.init(n,i),n._zod.check=a=>{dO(a.value,i.alg)||a.issues.push({code:"invalid_format",format:"jwt",input:a.value,inst:n,continue:!i.abort})}}),k1=Y("$ZodNumber",(n,i)=>{Ot.init(n,i),n._zod.pattern=Vp,n._zod.parse=(a,l)=>{if(i.coerce)try{a.value=Number(a.value)}catch{}const u=a.value;if(typeof u=="number"&&!Number.isNaN(u)&&Number.isFinite(u))return a;const f=typeof u=="number"?Number.isNaN(u)?"NaN":Number.isFinite(u)?void 0:String(u):void 0;return a.issues.push({expected:"number",code:"invalid_type",input:u,inst:n,...f?{received:f}:{}}),a}}),mO=Y("$ZodNumberFormat",(n,i)=>{xE.init(n,i),k1.init(n,i)}),pO=Y("$ZodBoolean",(n,i)=>{Ot.init(n,i),n._zod.pattern=yE,n._zod.parse=(a,l)=>{if(i.coerce)try{a.value=!!a.value}catch{}const u=a.value;return typeof u=="boolean"||a.issues.push({expected:"boolean",code:"invalid_type",input:u,inst:n}),a}}),gO=Y("$ZodUnknown",(n,i)=>{Ot.init(n,i),n._zod.parse=a=>a}),vO=Y("$ZodNever",(n,i)=>{Ot.init(n,i),n._zod.parse=(a,l)=>(a.issues.push({expected:"never",code:"invalid_type",input:a.value,inst:n}),a)});function yO(n,i){const a=fb(n._zod.def.checks);if(!a.length)return;const l=Math.min(...a.map(f=>f[0])),u=n._zod.parse;n._zod.parse=(f,d)=>{const m=i(f.value);if(m>l&&!d?.skipChecks&&d?.direction!=="backward"){for(const[p,g]of fb(n._zod.def.checks))if(m>p&&g._zod.def.when(f)){const b=f.issues.length;return g._zod.check(f),f.issues[b].continue=!1,ep(f.issues,b,n),f}}return u(f,d)}}const bO=n=>Array.isArray(n)?n.length:-1;function vb(n,i,a){n.issues.length&&i.issues.push(...Qs(a,n.issues)),i.value[a]=n.value}const _O=Y("$ZodArray",(n,i)=>{Ot.init(n,i);const a=er.memoizer;a?.attach(n),n._zod.parse=(l,u)=>{const f=l.value;if(!Array.isArray(f))return l.issues.push({expected:"array",code:"invalid_type",input:f,inst:n}),l;l.value=a?a.alloc(n,l,Array(f.length),u):Array(f.length);const d=[],m=u?.abortEarly;for(let p=0;pvb(y,l,p)));else if(vb(b,l,p),m&&b.issues.length!==0&&_r(b))break}return d.length?Promise.all(d).then(()=>l):l},yO(n,bO)});function Zf(n,i,a,l,u,f){const d=a in l,m=f==="optional";if(!(!d&&m&&u==="optional")){if(n.issues.length){if(u!==void 0&&m&&!d)return;i.issues.push(...Qs(a,n.issues))}if(!d&&u===void 0){n.issues.length||i.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[a]});return}n.value===void 0?(d||u==="defaulted"&&!m)&&(i.value[a]=void 0):i.value[a]=n.value}}const SO=[];function R1(n){const i=Object.keys(n.shape),a=Object.getOwnPropertySymbols(n.shape),l=a.length?a:SO,u=l.length?[...i,...l]:i;for(const d of u)if(!n.shape?.[d]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${String(d)}": expected a Zod schema`);const f=aT(n.shape);return{...n,allKeys:u,symbolKeys:l,keySet:new Set(i),numKeys:i.length,optionalKeys:new Set(f)}}function C1(n,i,a,l,u,f,d){const m=[],p=u.keySet,g=u.catchall._zod,b=g.def.type,y=g.optin,w=g.optout;let O=0;for(const T in i){if(d&&a.issues.length!==O){if(_r(a,O))break;O=a.issues.length}if(p.has(T))continue;if(T==="__proto__"){b==="never"&&m.push(T);continue}if(b==="never"){m.push(T);continue}const A=g.run({value:i[T],issues:[]},l);A instanceof Promise?n.push(A.then(k=>Zf(k,a,T,i,y,w))):Zf(A,a,T,i,y,w)}return m.length&&a.issues.push({code:"unrecognized_keys",keys:m,input:i,inst:f,continue:!0}),n.length?Promise.all(n).then(()=>a):a}const xO=Y("$ZodObject",(n,i)=>{Ot.init(n,i);const a=Object.getOwnPropertyDescriptor(i,"shape"),l=a?.get?a.get.raw:i.shape??{};if(l){const g=()=>{const b={...l};return Object.defineProperty(i,"shape",{value:b}),g.raw=b,b};g.raw=l,Object.defineProperty(i,"shape",{get:g})}const u=Dp(()=>R1(i));ot(n,"propValues",g=>{const b=g.def.shape,y={};for(const w in b){const O=b[w]._zod;if(O.values){Object.prototype.hasOwnProperty.call(y,w)||ta(y,w,new Set);for(const T of O.values)y[w].add(T);O.optin!==void 0&&y[w].add(void 0)}}return y});const f=Cf,d=i.catchall;let m;const p=er.memoizer;p?.attach(n),n._zod.parse=(g,b)=>{m??(m=u.value);const y=g.value;if(!f(y))return g.issues.push({expected:"object",code:"invalid_type",input:y,inst:n}),g;g.value=p?p.alloc(n,g,{},b):{};const w=[],O=m.shape,T=b?.abortEarly;let A=g.issues.length;for(const k of m.allKeys){if(T&&g.issues.length!==A){if(_r(g,A))break;A=g.issues.length}if(k==="__proto__")continue;const L=O[k],D=L._zod.optin,X=L._zod.optout,G=L._zod.run({value:y[k],issues:[]},b);G instanceof Promise?w.push(G.then(ee=>Zf(ee,g,k,y,D,X))):Zf(G,g,k,y,D,X)}return d?C1(w,y,g,b,u.value,n,T===!0):w.length?Promise.all(w).then(()=>g):g}}),wO=Y("$ZodObjectJIT",(n,i)=>{xO.init(n,i);const a=n._zod.parse,l=Dp(()=>R1(i)),u=er.memoizer,f=O=>{const T=l.value,A=T.symbolKeys,k=new RE(["payload","ctx"],{shape:O,inst:n,memo:u,syms:A}),L=ee=>`shape[${ee}]._zod.run({ value: input[${ee}], issues: [] }, ctx)`,D=(ee,V)=>` let ${ee}_ab = false; for (let i = 0; i < ${ee}.issues.length; i++) { const iss = ${ee}.issues[i]; @@ -230,7 +230,7 @@ R"DELIM(tern=i.length===void 0?FT:QT(i.length)),Ct.init(n,i)}),PE=Y("$ZodCUID",( payload.value = newResult; return payload; }`;k.write("const input = payload.value;");const X=Object.create(null);let G=0;for(const ee of T.allKeys)X[ee]=`key_${G++}`;k.write(u?"const newResult = memo.alloc(inst, payload, {}, ctx);":"const newResult = {};");for(const ee of T.allKeys){if(ee==="__proto__")continue;const V=X)DELIM" -R"DELIM([ee],ne=typeof ee=="symbol"?`syms[${A.indexOf(ee)}]`:eT(ee),ae=`${ne} in input`,ye=O[ee],ue=ye?._zod?.optin,J=ue!==void 0,we=ye?._zod?.optout==="optional";if(k.write(`const ${V} = ${L(ne)};`),J&&we){const he=ue==="optional"?`${V}_present`:`${V}.value !== undefined || ${V}_present`;k.write(` +R"DELIM([ee],ne=typeof ee=="symbol"?`syms[${A.indexOf(ee)}]`:nT(ee),ae=`${ne} in input`,ye=O[ee],ue=ye?._zod?.optin,J=ue!==void 0,we=ye?._zod?.optout==="optional";if(k.write(`const ${V} = ${L(ne)};`),J&&we){const he=ue==="optional"?`${V}_present`:`${V}.value !== undefined || ${V}_present`;k.write(` const ${V}_present = ${ae}; if (!${V}.issues.length || ${V}_present) { if (${V}.issues.length) {${D(V,ne)} @@ -269,56 +269,56 @@ R"DELIM([ee],ne=typeof ee=="symbol"?`syms[${A.indexOf(ee)}]`:eT(ee),ae=`${ne} in newResult[${ne}] = ${V}.value; } - `)}return k.write("payload.value = newResult;"),k.write("return payload;"),k.compile()};let d;const m=Cf,p=!er.jitless,b=p&&nT.value,y=i.catchall;let w;n._zod.parse=(O,T)=>{w??(w=l.value);const A=O.value;return m(A)?p&&b&&T?.async===!1&&T.jitless!==!0?(d||(d=f(i.shape)),O=d(O,T),y?R1([],A,O,T,w,n,T?.abortEarly===!0):O):a(O,T):(O.issues.push({expected:"object",code:"invalid_type",input:A,inst:n}),O)}});function yb(n,i,a,l){for(const f of n)if(f.issues.length===0)return i.value=f.value,i;const u=n.filter(f=>!_r(f));return u.length===1?(i.value=u[0].value,u[0]):(i.issues.push({code:"invalid_union",input:i.value,inst:a,errors:n.map(f=>f.issues.map(d=>Js(d,l,Br())))}),i)}const xO=Y("$ZodUnion",(n,i)=>{Ot.init(n,i),ot(n,"optin",l=>l.def.options.some(u=>u._zod.optin==="defaulted")?"defaulted":l.def.options.some(u=>u._zod.optin!==void 0)?"optional":void 0),ot(n,"optout",l=>l.def.options.some(u=>u._zod.optout==="optional")?"optional":void 0),ot(n,"values",l=>{if(l.def.options.every(u=>u._zod.values))return new Set(l.def.options.flatMap(u=>Array.from(u._zod.values)))}),ot(n,"pattern",l=>{if(l.def.options.every(u=>u._zod.pattern)){const u=l.def.options.map(f=>f._zod.pattern);return new RegExp(`^(${u.map(f=>Up(f.source)).join("|")})$`)}});const a=i.options.length===1?i.options[0]._zod.run:null;n._zod.parse=(l,u)=>{if(a)return a(l,u);let f=!1;const d=[];for(const m of i.options){const p=m._zod.run({value:l.value,issues:[]},u);if(p instanceof Promise)d.push(p),f=!0;else{if(p.issues.length===0)return p;d.push(p)}}return f?Promise.all(d).then(m=>yb(m,l,n,u)):yb(d,l,n,u)}}),wO=Y("$ZodIntersection",(n,i)=>{Ot.init(n,i),n._zod.parse=(a,l)=>{const u=a.value,f=i.left._zod.run({value:u,issues:[]},l),d=i.right._zod.run({value:u,issues:[]},l);return f instanceof Promise||d instanceof Promise?Promise.all([f,d]).then(([p,g])=>bb(a,p,g)):bb(a,f,d)}});function np(n,i){if(n===i)return{valid:!0,data:n};if(n instanceof Date&&i instanceof Date&&+n==+i)return{valid:!0,data:n};if(io(n)&&io(i)){const a=Object.keys(i),l=Object.keys(n).filter(f=>a.indexOf(f)!==-1),u={...n,...i};Object.prototype.hasOwnProperty.call(u,"__proto__")&&delete u.__proto__;for(const f of l){if(f==="__proto__")continue;const d=np(n[f],i[f]);if(!d.valid)return{valid:!1,mergeErrorPath:[f,...d.mergeErrorPath]};u[f]=d.data}return{valid:!0,data:u}}if(Array.isArray(n)&&Array.isArray(i)){if(n.length!==i.length)return{valid:!1,mergeErrorPath:[]};const a=[];for(let l=0;l{let y;if(g.code==="unrecognized_keys"&&!g.path?.length)u??(u=g),y=g.keys;else if(g.code==="invalid_key"&&g.origin==="record"&&g.path?.length===1){const w=String(g.path[0]);f.has(w)||f.set(w,g),y=[w]}else return!1;for(const w of y)l.has(w)||l.set(w,{}),l.get(w)[b]=!0;return!0};for(const g of i.issues)d(g,"l")||n.issues.push(g);for(const g of a.issues)d(g,"r")||n.issues.push(g);const m=[...l].filter(([,g])=>g.l&&g.r).map(([g])=>g);if(m.length){const g=u?m.filter(b=>u.keys.includes(b)):[];g.length&&n.issues.push({...u,keys:g});for(const b of m)!g.includes(b)&&f.has(b)&&n.issues.push(f.get(b))}const p=np(i.value,a.value);if(!p.valid){if(_r(n))return n;throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(p.mergeErrorPath)}`)}return n.value=p.data,n}const zO=Y("$ZodTuple",(n,i)=>{Ot.init(n,i);const a=i.items,l=er.memoizer;l?.attach(n),n._zod.parse=(u,f)=>{const d=u.value;if(!Array.isArray(d))return u.issues.push({input:d,inst:n,expected:"tuple",code:"invalid_type"}),u;u.value=l?l.alloc(n,u,[],f):[];const m=[],p=_b(a,"optin"),g=_b(a,"optout");if(!i.rest){if(d.lengtha.length&&u.issues.push({code:"too_big",maximum:a.length,inclusive:!0,input:d,inst:n,origin:"array"})}const b=new Array(a.length),y=i.rest?f?.abortEarly:void 0;let w=!1;for(let O=0;O{b[O]=A})):(b[O]=T,y&&!w&&T.issues.length&&(w=_r(T)))}if(i.rest&&!w){let O=a.length-1;const T=d.slice(a.length);let A=u.issues.length;for(const k of T){if(y&&u.issues.length!==A){if(_r(u,A))break;A=u.issues.length}O++;const L=i.rest._zod.run({value:k,issues:[]},f);L instanceof Promise?m.push(L.then(D=>Sb(D,u,O))):Sb(L,u,O)}}return m.length?Promise.all(m).then(()=>xb(b,u,a,d,g)):xb(b,u,a,d,g)}});function _b(n,i){for(let a=n.length-1;a>=0;a--)if(!(i==="optin"?n[a]._zod.optin!==void 0:n[a]._zod.optout==="optional"))return a+1;return 0}function Sb(n,i,a){n.issues.length&&i.issues.push(...Qs(a,n.issues)),i.value[a]=n.value}function xb(n,i,a,l,u){for(let f=0;f=u&&a[f]._zod.optin==="optional"){i.value.length=f;break}if(d.issues.length){if(!m&&f>=u){i.value.length=f;break}i.issues.push(...Qs(f,d.issues))}i.value[f]=d.value}for(let f=i.value.length-1;f>=l.length&&(a[f]._zod.optout==="optional"&&i.value[f]===void 0);f--)i.value.length=f;return i}const TO=Y("$ZodRecord",(n,i)=>{Ot.init(n,i);const a=er.memoizer;a?.attach(n),n._zod.parse=(l,u)=>{const f=l.value;if(!io(f))return l.issues.push({expected:"record",code:"invalid_type",input:f,inst:n}),l;const d=[],m=i.keyType._zod.values;if(m&&!i.partial){l.value=a?a.alloc(n,l,{},u):{};const p=new Set;for(const b of m)if(typeof b=="string"||typeof b=="number"||typeof b=="symbol"){if(p.add(typeof b=="number"?b.toString():b),b==="__proto__")continue;const y=i.keyType._zod.run({value:b,issues:[]},u);if(y instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(y.issues.length){l.issues.push({code:"invalid_key",origin:"record",issues:y.issues.map(T=>Js(T,u,Br())),input:b,path:[b],inst:n});continue}const w=y.value;if(w==="__proto__")continue;const O=i.valueType._zod.run({value:f[b],issues:[]},u);O instanceof Promise?d.push(O.then(T=>{T.issues.length&&l.issues.push(...Qs(b,T.issues)),l.value[w]=T.value})):(O.issues.length&&l.issues.push(...Qs(b,O.issues)),l.value[w]=O.value)}let g;for(const b in f)if(!p.has(b))if(i.mode==="loose"){if(b==="__proto__")continue;l.value[b]=f[b]}else g=g??[],g.push(b);g&&g.length>0&&l.issues.push({code:"unrecognized_keys",input:f,inst:n,keys:g,continue:!0})}else{l.value=a?a.alloc(n,l,{},u):{};let p;for(const g of Reflect.ownKeys(f)){if(g==="__proto__"||!Object.prototype.propertyIsEnumerable.call(f,g))continue;let b=i.keyType._zod.run({value:g,issues:[]},u);if(b instanceof Promise)throw new Error("As)DELIM" -R"DELIM(ync schemas not supported in object keys currently");if(typeof g=="string"&&Vp.test(g)&&b.issues.length){const T=i.keyType._zod.run({value:Number(g),issues:[]},u);if(T instanceof Promise)throw new Error("Async schemas not supported in object keys currently");T.issues.length===0&&(b=T)}if(b.issues.length){i.mode==="loose"?l.value[g]=f[g]:m?(p=p??[],p.push(g)):l.issues.push({code:"invalid_key",origin:"record",issues:b.issues.map(T=>Js(T,u,Br())),input:g,path:[g],inst:n});continue}const w=b.value;if(w==="__proto__")continue;const O=i.valueType._zod.run({value:f[g],issues:[]},u);O instanceof Promise?d.push(O.then(T=>{T.issues.length&&l.issues.push(...Qs(g,T.issues)),l.value[w]=T.value})):(O.issues.length&&l.issues.push(...Qs(g,O.issues)),l.value[w]=O.value)}p&&p.length>0&&l.issues.push({code:"unrecognized_keys",input:f,inst:n,keys:p,continue:!0})}return d.length?Promise.all(d).then(()=>l):l}}),EO=Y("$ZodEnum",(n,i)=>{Ot.init(n,i);const a=Xm(i.entries),l=new Set(a);n._zod.values=l,ot(n,"pattern",u=>{const f=Xm(u.def.entries).filter(d=>iT.has(typeof d));return new RegExp(f.length?`^(${f.map(d=>ro(d.toString())).join("|")})$`:"^[^\\s\\S]$")}),n._zod.parse=(u,f)=>{const d=u.value;return l.has(d)||u.issues.push({code:"invalid_value",values:a,input:d,inst:n}),u}}),OO=Y("$ZodLiteral",(n,i)=>{Ot.init(n,i);const a=new Set(i.values);n._zod.values=a,ot(n,"pattern",l=>{const u=l.def.values;return new RegExp(u.length?`^(${u.map(f=>typeof f=="string"?ro(f):f?ro(f.toString()):String(f)).join("|")})$`:"^[^\\s\\S]$")}),n._zod.parse=(l,u)=>{const f=l.value;return a.has(f)||l.issues.push({code:"invalid_value",values:i.values,input:f,inst:n}),l}}),NO=Y("$ZodTransform",(n,i)=>{Ot.init(n,i),n._zod.optin="optional",er.memoizer?.guard(n),n._zod.parse=(a,l)=>{if(l.direction==="backward")throw new b1(n.constructor.name);const u=i.transform(a.value,a);if(l.async)return(u instanceof Promise?u:Promise.resolve(u)).then(d=>(a.value=d,a));if(u instanceof Promise)throw new Ja;return a.value=u,a}});function wb(n,i){return n.value=i.issues.length?void 0:i.value,n}const C1=Y("$ZodOptional",(n,i)=>{Ot.init(n,i),ot(n,"optin",a=>a.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),n._zod.optout="optional",ot(n,"values",a=>{const l=a.def.innerType._zod.values;return l?new Set([...l,void 0]):void 0}),ot(n,"pattern",a=>{const l=a.def.innerType._zod.pattern;return l?new RegExp(`^(${Up(l.source)})?$`):void 0}),n._zod.parse=(a,l)=>{if(a.value===void 0){if(i.innerType._zod.optin!=="defaulted")return a;const u=i.innerType._zod.run({value:a.value,issues:[]},l);return u instanceof Promise?u.then(f=>wb(a,f)):wb(a,u)}return i.innerType._zod.run(a,l)}}),AO=Y("$ZodExactOptional",(n,i)=>{C1.init(n,i),ot(n,"values",a=>a.def.innerType._zod.values),ot(n,"pattern",a=>a.def.innerType._zod.pattern),n._zod.parse=(a,l)=>i.innerType._zod.run(a,l)}),MO=Y("$ZodNullable",(n,i)=>{Ot.init(n,i),ot(n,"optin",a=>a.def.innerType._zod.optin),ot(n,"optout",a=>a.def.innerType._zod.optout),ot(n,"pattern",a=>{const l=a.def.innerType._zod.pattern;return l?new RegExp(`^(${Up(l.source)}|null)$`):void 0}),ot(n,"values",a=>a.def.innerType._zod.values?new Set([...a.def.innerType._zod.values,null]):void 0),n._zod.parse=(a,l)=>a.value===null?a:i.innerType._zod.run(a,l)}),jO=Y("$ZodDefault",(n,i)=>{Ot.init(n,i),n._zod.optin="defaulted",ot(n,"values",a=>a.def.innerType._zod.values),n._zod.parse=(a,l)=>{if(l.direction==="backward")return i.innerType._zod.run(a,l);if(a.value===void 0)return a.value=i.defaultValue,a;const u=i.innerType._zod.run(a,l);return u instanceof Promise?u.then(f=>zb(f,i)):zb(u,i)}});function zb(n,i){return n.value===void 0&&(n.value=i.defaultValue),n}const kO=Y("$ZodPrefault",(n,i)=>{Ot.init(n,i),n._zod.optin="defaulted",ot(n,"values",a=>a.def.innerType._zod.values),n._zod.parse=(a,l)=>(l.direction==="backward"||a.value===void 0&&(a.value=i.defaultValue),i.innerType._zod.run(a,l))}),RO=Y("$ZodNonOptional",(n,i)=>{Ot.init(n,i),ot(n,"values",a=>{const l=a.def.innerType._zod.values;return l?new Set([...l].filter(u=>u!==void 0)):void 0}),n._zod.parse=(a,l)=>{const u=i.innerType._zod.run(a,l);return u instanceof Promise?u.then(f=>Tb(f,n)):Tb(u,n)}});function Tb(n,i){return!n.issues.length&&n.value===void 0&&n.issues.push({code:"invalid_type",expected:"nonoptional",input:n.value,inst:i}),n}function Eb(n,i,a,l){return i.issues.length?(n.value=a.catchValue({...i,value:n.value,error:{issues:i.issues.map(u=>Js(u,l,Br()))},input:n.value}),n):(n.value=i.value,i.memo&&(n.memo=!0),n)}const CO=Y("$ZodCatch",(n,i)=>{Ot.init(n,i),ot(n,"optin",a=>a.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),ot(n,"optout",a=>a.def.innerType._zod.optout),ot(n,"values",a=>a.def.innerType._zod.values),n._zod.parse=(a,l)=>{if(l.direction==="backward")return i.innerType._zod.run(a,l);const u=i.innerType._zod.run({value:a.value,issues:[]},l);return u instanceof Promise?u.then(f=>Eb(a,f,i,l)):Eb(a,u,i,l)}}),DO=Y("$ZodPipe",(n,i)=>{Ot.init(n,i),ot(n,"values",a=>a.def.in._zod.values),ot(n,"optin",a=>a.def.in._zod.optin),ot(n,"optout",a=>a.def.out._zod.optout),ot(n,"propValues",a=>a.def.in._zod.propValues),n._zod.parse=(a,l)=>{if(l.direction==="backward"){const f=i.out._zod.run(a,l);return f instanceof Promise?f.then(d=>mf(d,i.in,l)):mf(f,i.in,l)}const u=i.in._zod.run(a,l);return u instanceof Promise?u.then(f=>mf(f,i.out,l)):mf(u,i.out,l)}});function mf(n,i,a){return n.issues.some(l=>l.code!=="unrecognized_keys")?(n.aborted=!0,n):i._zod.run({value:n.value,issues:n.issues},a)}const UO=Y("$ZodReadonly",(n,i)=>{Ot.init(n,i),ot(n,"propValues",a=>a.def.innerType._zod.propValues),ot(n,"values",a=>a.def.innerType._zod.values),ot(n,"optin",a=>a.def.innerType?._zod?.optin),ot(n,"optout",a=>a.def.innerType?._zod?.optout),n._zod.parse=(a,l)=>{if(l.direction==="backward")return i.innerType._zod.run(a,l);const u=i.innerType._zod.run(a,l);return u instanceof Promise?u.then(Ob):Ob(u)}});function Ob(n){return n.memo||(n.value=Object.freeze(n.value)),n}const ZO=Y("$ZodCustom",(n,i)=>{yi.init(n,i),Ot.init(n,i),n._zod.parse=(a,l)=>a,n._zod.check=a=>{const l=a.value,u=i.fn(l);if(u instanceof Promise)return u.then(f=>Nb(f,a,l,n));Nb(u,a,l,n)}});function Nb(n,i,a,l){if(!n){const u={code:"custom",input:a,inst:l,path:[...l._zod.def.path??[]],continue:!l._zod.def.abort};l._zod.def.params&&(u.params=l._zod.def.params),i.issues.push(Ru(u))}}class $O extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform"),this.name="ZodCyclicError"}}const ip="~memo",Ab=[];function D1(n){return n!==null&&typeof n=="object"}function $m(n){return n.map(i=>i.path?{...i,path:i.path.slice()}:{...i})}const U1=new WeakMap,xu=0,Of=1,Ou=2;function Nf(n,i,a){const l=U1.get(n);if(l!==void 0)return l?Ou:xu;if(i.has(n))return Ou;i.add(n);let u=xu;const f=b=>{if(u!==Ou&&b?._zod){const y=Nf(b,i);y>u&&(u=y)}},d=(b,y)=>{let w=xu;for(const O of Reflect.ownKeys(b)){const T=Object.getOwnPropertyDescriptor(b,O);if(!T.enumerable)continue;const A=T.get?Of:T.value?._zod?Nf(T.value,i):xu;A>w&&(w=A)}return w},m=b=>{b>u&&(u=b)},p=n._zod.def;switch(p.type){case"object":{const b=u1(p);m(b?d(b):Of),f(p.catchall);break}case"array":f(p.element);break;case"tuple":for(const b of p.items)f(b);f(p.rest);break;case"record":case"map":f(p.keyType),f(p.valueType);break;case"set":f(p.valueType);break;case"union":for(const b of p.options)f(b);break;case"intersection":f(p.left),f(p.right);break;case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":f(p.innerType);break;case"pipe":f(p.in),f(p.out);break;case"function":f(p.input),f(p.output);break;case"lazy":{const b=p._cachedInner??void 0;m(b?Nf(b,i):Of);break}case"template_literal":case"string":case"number":case"int":case"boolean":case"bigint":case"symbol":case"undefined":case"null":case"void":case"never":case"any":case"unknown":case"date":case"nan":case"enum":case"literal":case"file":case"transform":case"custom":break;default:for(const b in p){cons)DELIM" -R"DELIM(t y=Object.getOwnPropertyDescriptor(p,b);if(!y||y.get)continue;const w=y.value;if(!(!w||typeof w!="object")){if(w._zod)f(w);else if(Array.isArray(w))for(const O of w)f(O)}}}return i.delete(n),LO(n,u)}function LO(n,i){return i!==Of&&U1.set(n,i===Ou),i}function HO(n,i){let a=n.buckets.get(i);return a||(a=new WeakMap,n.buckets.set(i,a)),a}let pf;const gf=[],BO={alloc(n,i,a){const l=pf;if(!l)return a;pf=void 0;const u={value:a,issues:null};return l.set(i.value,u),gf.push(u),a},guard(n){var i;(i=n._zod).deferred??(i.deferred=[]),n._zod.deferred.push(()=>{const a=n._zod.parse,l=(u,f)=>{if(f.direction!=="backward"&&VO(f,u.value))throw new $O;return a(u,f)};n._zod.parse=l,n._zod.run===a&&(n._zod.run=l)})},attach(n){var i;let a,l=!1,u,f;(i=n._zod).deferred??(i.deferred=[]),n._zod.deferred.push(()=>{const d=n._zod.parse,m=(p,g)=>{if(a===void 0){const L=Nf(n,new Set);if(L===xu)return n._zod.parse=d,n._zod.run===m&&(n._zod.run=d),d(p,g);L===Ou||l?a=!0:l=!0}const b=p.value;if(!D1(b))return d(p,g);let y=g[ip];y||(y={buckets:new WeakMap,backEdges:void 0},g[ip]=y);let w;u===g?w=f:(w=HO(y,n),u=g,f=w);const O=w.get(b);if(O)return p.value=O.value,O.issues?O.issues.length&&p.issues.push(...$m(O.issues)):(p.memo=!0,y.backEdges??(y.backEdges=new WeakSet),y.backEdges.add(O.value)),p;pf=w;const T=gf.length,A=d(p,g);pf=void 0;const k=gf.length>T?gf.pop():void 0;return A instanceof Promise?A.then(L=>(k&&(k.issues=L.issues.length?$m(L.issues):Ab),L)):(k&&(k.issues=A.issues.length?$m(A.issues):Ab),A)};n._zod.parse=m,n._zod.run===d&&(n._zod.run=m)})}};function qO(){return BO}function VO(n,i){const a=n[ip]?.backEdges;return a!==void 0&&D1(i)&&a.has(i)}const IO=()=>{const n={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function i(f){return n[f]??null}const a={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",currency_code:"currency code",credit_card:"credit card number",iban:"IBAN",jwt:"JWT",template_literal:"input"},l={nan:"NaN"};function u(f,d){return f==="number"&&typeof d=="number"&&!Number.isFinite(d)?String(d):l[f]??f}return f=>{switch(f.code){case"invalid_type":{const d=u(f.expected),m=mT(f.input),p=u(m,f.input);return`Invalid input: expected ${d}, received ${p}`}case"invalid_value":return f.values.length===1?`Invalid input: expected ${m1(f.values[0])}`:`Invalid option: expected one of ${ub(f.values,"|")}`;case"too_big":{const d=f.exact?"exactly ":f.inclusive?"<=":"<",m=i(f.origin);return m?`Too big: expected ${f.origin??"value"} to have ${d}${f.maximum.toString()} ${m.unit??"elements"}`:`Too big: expected ${f.origin??"value"} to be ${d}${f.maximum.toString()}`}case"too_small":{const d=f.exact?"exactly ":f.inclusive?">=":">",m=i(f.origin);return m?`Too small: expected ${f.origin} to have ${d}${f.minimum.toString()} ${m.unit}`:`Too small: expected ${f.origin} to be ${d}${f.minimum.toString()}`}case"invalid_format":{const d=f;return d.format==="starts_with"?`Invalid string: must start with "${d.prefix}"`:d.format==="ends_with"?`Invalid string: must end with "${d.suffix}"`:d.format==="includes"?`Invalid string: must include "${d.includes}"`:d.format==="regex"?`Invalid string: must match pattern ${d.pattern}`:`Invalid ${a[d.format]??f.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${f.divisor}`;case"unrecognized_keys":return`Unrecognized key${f.keys.length>1?"s":""}: ${ub(f.keys,", ")}`;case"invalid_key":return`Invalid key in ${f.origin}`;case"invalid_union":return f.options&&Array.isArray(f.options)&&f.options.length>0?`Invalid discriminator value. Expected ${f.options.map(m=>`'${m}'`).join(" | ")}`:f.inclusive===!1?"Invalid input: more than one option matched":"Invalid input";case"invalid_element":return`Invalid value in ${f.origin}`;default:return"Invalid input"}}};function PO(){return{localeError:IO()}}var Mb;class KO{constructor(){this._map=new WeakMap,this._idmap=new Map}add(i,...a){const l=a[0];return this._map.set(i,l),l&&typeof l=="object"&&"id"in l&&this._idmap.set(l.id,i),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(i){const a=this._map.get(i);return a&&typeof a=="object"&&"id"in a&&this._idmap.delete(a.id),this._map.delete(i),this}get(i){const a=i._zod.parent;if(a){const l={...this.get(a)??{}};delete l.id;const u={...l,...this._map.get(i)};return Object.keys(u).length?u:void 0}return this._map.get(i)}has(i){return this._map.has(i)}}function GO(){return new KO}(Mb=globalThis).__zod_globalRegistry??(Mb.__zod_globalRegistry=GO());const wu=globalThis.__zod_globalRegistry;function Z1(n){return n.checks&&(n.checks=[...n.checks]),n}function YO(n,i){return new n(Z1({type:"string",...Te(i)}))}function FO(n,i){return new n({type:"string",format:"email",check:"string_format",abort:!1,...Te(i)})}function QO(n,i){return new n({type:"string",format:"guid",check:"string_format",abort:!1,...Te(i)})}function JO(n,i){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,...Te(i)})}function XO(n,i){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...Te(i)})}function WO(n,i){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...Te(i)})}function e2(n,i){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...Te(i)})}function t2(n,i){return new n({type:"string",format:"url",check:"string_format",abort:!1,...Te(i)})}function n2(n,i){return new n({type:"string",format:"emoji",check:"string_format",abort:!1,...Te(i)})}function i2(n,i){return new n({type:"string",format:"nanoid",check:"string_format",abort:!1,...Te(i)})}function r2(n,i){return new n({type:"string",format:"cuid",check:"string_format",abort:!1,...Te(i)})}function s2(n,i){return new n({type:"string",format:"cuid2",check:"string_format",abort:!1,...Te(i)})}function a2(n,i){return new n({type:"string",format:"ulid",check:"string_format",abort:!1,...Te(i)})}function l2(n,i){return new n({type:"string",format:"xid",check:"string_format",abort:!1,...Te(i)})}function o2(n,i){return new n({type:"string",format:"ksuid",check:"string_format",abort:!1,...Te(i)})}function u2(n,i){return new n({type:"string",format:"ipv4",check:"string_format",abort:!1,...Te(i)})}function c2(n,i){return new n({type:"string",format:"ipv6",check:"string_format",abort:!1,...Te(i)})}function f2(n,i){return new n({type:"string",format:"cidrv4",check:"string_format",abort:!1,...Te(i)})}function d2(n,i){return new n({type:"string",format:"cidrv6",check:"string_format",abort:!1,...Te(i)})}function h2(n,i){return new n({type:"string",format:"base64",check:"string_format",abort:!1,...Te(i)})}function m2(n,i){return new n({type:"string",format:"base64url",check:"string_format",abort:!1,...Te(i)})}function p2(n,i){return new n({type:"string",format:"e164",check:"string_format",abort:!1,...Te(i)})}function g2(n,i){return new n({type:"string",format:"jwt",check:"string_format",abort:!1,...Te(i)})}function v2(n,i){return new n({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...Te(i)})}function y2(n,i){return new n({type:"string",format:"date",check:"string_format",...Te(i)})}function b2(n,i){return new n({type:"string",format:"time",check:"string_format",precision:null,...Te(i)})}function _2(n,i){return new n({type:"string",format:"duration",check:"string_format",...Te(i)})}function S2(n,i){return new n(Z1({type:"number",checks:[],...Te(i)}))}function x2(n,i){return new n({type:"number")DELIM" -R"DELIM(,check:"number_format",abort:!1,format:"safeint",...Te(i)})}function w2(n,i){return new n({type:"boolean",...Te(i)})}function z2(n){return new n({type:"unknown"})}function T2(n,i){return new n({type:"never",...Te(i)})}function jb(n,i){return new x1({check:"less_than",...Te(i),value:n,inclusive:!1})}function Lm(n,i){return new x1({check:"less_than",...Te(i),value:n,inclusive:!0})}function kb(n,i){return new w1({check:"greater_than",...Te(i),value:n,inclusive:!1})}function Hm(n,i){return new w1({check:"greater_than",...Te(i),value:n,inclusive:!0})}function Rb(n,i){return new bE({check:"multiple_of",...Te(i),value:n})}function $1(n,i){return new SE({check:"max_length",...Te(i),maximum:n})}function $f(n,i){return new xE({check:"min_length",...Te(i),minimum:n})}function L1(n,i){return new wE({check:"length_equals",...Te(i),length:n})}function E2(n,i){return new zE({check:"string_format",format:"regex",...Te(i),pattern:n})}function O2(n){return new TE({check:"string_format",format:"lowercase",...Te(n)})}function N2(n){return new EE({check:"string_format",format:"uppercase",...Te(n)})}function A2(n,i){return new OE({check:"string_format",format:"includes",...Te(i),includes:n})}function M2(n,i){return new NE({check:"string_format",format:"starts_with",...Te(i),prefix:n})}function j2(n,i){return new AE({check:"string_format",format:"ends_with",...Te(i),suffix:n})}function ho(n){return new ME({check:"overwrite",tx:n})}function k2(n){return ho(i=>i.normalize(n))}function R2(){return ho(n=>n.trim())}function C2(){return ho(n=>n.toLowerCase())}function D2(){return ho(n=>n.toUpperCase())}function U2(){return ho(n=>tT(n))}function Z2(n,i,a){return new n({type:"array",element:i,...Te(a)})}function $2(n,i,a){return new n({type:"custom",check:"custom",fn:i,...Te(a)})}function L2(n,i){const a=H2(l=>(l.addIssue=u=>{if(typeof u=="string")l.issues.push(Ru(u,l.value,a._zod.def));else{const f=u;f.fatal&&(f.continue=!1),f.code??(f.code="custom"),"input"in f||(f.input=l.value),f.inst??(f.inst=a),f.continue??(f.continue=!a._zod.def.abort),l.issues.push(Ru(f))}},n(l.value,l)),i);return a}function H2(n,i){const a=new yi({check:"custom",...Te(i)});return a._zod.check=n,a}function Nu(n,...i){for(const a of i)for(const l of Reflect.ownKeys(a))Object.prototype.propertyIsEnumerable.call(a,l)&&ta(n,l,a[l]);return n}function H1(n){let i=n?.target??"draft-2020-12";return i==="draft-4"&&(i="draft-04"),i==="draft-7"&&(i="draft-07"),{processors:n.processors??{},metadataRegistry:n?.metadata??wu,target:i,unrepresentable:n?.unrepresentable??"throw",override:n?.override??(()=>{}),io:n?.io??"output",counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:n?.cycles??"ref",reused:n?.reused??"inline",intersections:[],deferred:[],external:n?.external??void 0}}function Ws(n,i,a,l,u){const f=typeof i.unrepresentable=="function"?i.unrepresentable({zodSchema:n,path:l.path,message:u}):i.unrepresentable;if(f==="any")return!1;if(f===void 0||f==="throw")throw new Error(u);return Object.assign(a,f),!0}function Kt(n,i,a={path:[],schemaPath:[]}){var l;const u=n._zod.def,f=i.seen.get(n);if(f)return f.count++,a.schemaPath.includes(n)&&(f.cycle=a.path),f.schema;const d={schema:{},count:1,cycle:void 0,path:a.path};i.seen.set(n,d),i.sharedDefsExtractedFor=void 0,i.sharedEmitDoneFor=void 0;const m=n._zod.toJSONSchema?.();if(m)d.schema=m;else{const b={...a,schemaPath:[...a.schemaPath,n],path:a.path};if(n._zod.processJSONSchema)n._zod.processJSONSchema(i,d.schema,b);else{const w=d.schema,O=i.processors[u.type];if(!O)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${u.type}`);O(n,i,w,b)}const y=n._zod.parent;y&&(d.ref||(d.ref=y),Kt(y,i,b),i.seen.get(y).isParent=!0)}const p=i.metadataRegistry.get(n);return p&&Nu(d.schema,p),i.io==="input"&&ii(n)&&(delete d.schema.examples,delete d.schema.default),i.io==="input"&&"_prefault"in d.schema&&((l=d.schema).default??(l.default=d.schema._prefault)),delete d.schema._prefault,i.seen.get(n).schema}function Cb(n){return n.replace(/~/g,"~0").replace(/\//g,"~1")}function B1(n,i){const a=n.seen.get(i);if(!a)throw new Error("Unprocessed schema. This is a bug in Zod.");if(n.external&&n.sharedDefsExtractedFor===n.external)return;const l=new Map;for(const d of n.seen.entries()){const m=n.metadataRegistry.get(d[0])?.id;if(m){const p=l.get(m);if(p&&p!==d[0])throw new Error(`Duplicate schema id "${m}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);l.set(m,d[0])}}const u=d=>{const m=n.target==="draft-2020-12"?"$defs":"definitions";if(n.external){const y=n.external.registry.get(d[0])?.id,w=n.external.uri??(T=>T);if(y)return{ref:w(y)};const O=d[1].defId??d[1].schema.id??`schema${n.counter++}`;return d[1].defId=O,{defId:O,ref:`${w("__shared")}#/${m}/${Cb(O)}`}}const p="#",g=`${p}/${m}/`;if(d[1]===a&&!d[1].schema.id)return{ref:p};const b=d[1].schema.id??`__schema${n.counter++}`;return{defId:b,ref:g+Cb(b)}},f=d=>{if(d[1].schema.$ref)return;const m=d[1],{ref:p,defId:g}=u(d);m.def={...m.schema},g&&(m.defId=g);const b=m.schema;for(const y in b)delete b[y];b.$ref=p};if(n.cycles==="throw")for(const d of n.seen.entries()){const m=d[1];if(m.cycle)throw new Error(`Cycle detected: #/${m.cycle?.join("/")}/ + `)}return k.write("payload.value = newResult;"),k.write("return payload;"),k.compile()};let d;const m=Cf,p=!er.jitless,b=p&&rT.value,y=i.catchall;let w;n._zod.parse=(O,T)=>{w??(w=l.value);const A=O.value;return m(A)?p&&b&&T?.async===!1&&T.jitless!==!0?(d||(d=f(i.shape)),O=d(O,T),y?C1([],A,O,T,w,n,T?.abortEarly===!0):O):a(O,T):(O.issues.push({expected:"object",code:"invalid_type",input:A,inst:n}),O)}});function yb(n,i,a,l){for(const f of n)if(f.issues.length===0)return i.value=f.value,i;const u=n.filter(f=>!_r(f));return u.length===1?(i.value=u[0].value,u[0]):(i.issues.push({code:"invalid_union",input:i.value,inst:a,errors:n.map(f=>f.issues.map(d=>Js(d,l,Br())))}),i)}const zO=Y("$ZodUnion",(n,i)=>{Ot.init(n,i),ot(n,"optin",l=>l.def.options.some(u=>u._zod.optin==="defaulted")?"defaulted":l.def.options.some(u=>u._zod.optin!==void 0)?"optional":void 0),ot(n,"optout",l=>l.def.options.some(u=>u._zod.optout==="optional")?"optional":void 0),ot(n,"values",l=>{if(l.def.options.every(u=>u._zod.values))return new Set(l.def.options.flatMap(u=>Array.from(u._zod.values)))}),ot(n,"pattern",l=>{if(l.def.options.every(u=>u._zod.pattern)){const u=l.def.options.map(f=>f._zod.pattern);return new RegExp(`^(${u.map(f=>Up(f.source)).join("|")})$`)}});const a=i.options.length===1?i.options[0]._zod.run:null;n._zod.parse=(l,u)=>{if(a)return a(l,u);let f=!1;const d=[];for(const m of i.options){const p=m._zod.run({value:l.value,issues:[]},u);if(p instanceof Promise)d.push(p),f=!0;else{if(p.issues.length===0)return p;d.push(p)}}return f?Promise.all(d).then(m=>yb(m,l,n,u)):yb(d,l,n,u)}}),TO=Y("$ZodIntersection",(n,i)=>{Ot.init(n,i),n._zod.parse=(a,l)=>{const u=a.value,f=i.left._zod.run({value:u,issues:[]},l),d=i.right._zod.run({value:u,issues:[]},l);return f instanceof Promise||d instanceof Promise?Promise.all([f,d]).then(([p,g])=>bb(a,p,g)):bb(a,f,d)}});function np(n,i){if(n===i)return{valid:!0,data:n};if(n instanceof Date&&i instanceof Date&&+n==+i)return{valid:!0,data:n};if(io(n)&&io(i)){const a=Object.keys(i),l=Object.keys(n).filter(f=>a.indexOf(f)!==-1),u={...n,...i};Object.prototype.hasOwnProperty.call(u,"__proto__")&&delete u.__proto__;for(const f of l){if(f==="__proto__")continue;const d=np(n[f],i[f]);if(!d.valid)return{valid:!1,mergeErrorPath:[f,...d.mergeErrorPath]};u[f]=d.data}return{valid:!0,data:u}}if(Array.isArray(n)&&Array.isArray(i)){if(n.length!==i.length)return{valid:!1,mergeErrorPath:[]};const a=[];for(let l=0;l{let y;if(g.code==="unrecognized_keys"&&!g.path?.length)u??(u=g),y=g.keys;else if(g.code==="invalid_key"&&g.origin==="record"&&g.path?.length===1){const w=String(g.path[0]);f.has(w)||f.set(w,g),y=[w]}else return!1;for(const w of y)l.has(w)||l.set(w,{}),l.get(w)[b]=!0;return!0};for(const g of i.issues)d(g,"l")||n.issues.push(g);for(const g of a.issues)d(g,"r")||n.issues.push(g);const m=[...l].filter(([,g])=>g.l&&g.r).map(([g])=>g);if(m.length){const g=u?m.filter(b=>u.keys.includes(b)):[];g.length&&n.issues.push({...u,keys:g});for(const b of m)!g.includes(b)&&f.has(b)&&n.issues.push(f.get(b))}const p=np(i.value,a.value);if(!p.valid){if(_r(n))return n;throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(p.mergeErrorPath)}`)}return n.value=p.data,n}const EO=Y("$ZodTuple",(n,i)=>{Ot.init(n,i);const a=i.items,l=er.memoizer;l?.attach(n),n._zod.parse=(u,f)=>{const d=u.value;if(!Array.isArray(d))return u.issues.push({input:d,inst:n,expected:"tuple",code:"invalid_type"}),u;u.value=l?l.alloc(n,u,[],f):[];const m=[],p=_b(a,"optin"),g=_b(a,"optout");if(!i.rest){if(d.lengtha.length&&u.issues.push({code:"too_big",maximum:a.length,inclusive:!0,input:d,inst:n,origin:"array"})}const b=new Array(a.length),y=i.rest?f?.abortEarly:void 0;let w=!1;for(let O=0;O{b[O]=A})):(b[O]=T,y&&!w&&T.issues.length&&(w=_r(T)))}if(i.rest&&!w){let O=a.length-1;const T=d.slice(a.length);let A=u.issues.length;for(const k of T){if(y&&u.issues.length!==A){if(_r(u,A))break;A=u.issues.length}O++;const L=i.rest._zod.run({value:k,issues:[]},f);L instanceof Promise?m.push(L.then(D=>Sb(D,u,O))):Sb(L,u,O)}}return m.length?Promise.all(m).then(()=>xb(b,u,a,d,g)):xb(b,u,a,d,g)}});function _b(n,i){for(let a=n.length-1;a>=0;a--)if(!(i==="optin"?n[a]._zod.optin!==void 0:n[a]._zod.optout==="optional"))return a+1;return 0}function Sb(n,i,a){n.issues.length&&i.issues.push(...Qs(a,n.issues)),i.value[a]=n.value}function xb(n,i,a,l,u){for(let f=0;f=u&&a[f]._zod.optin==="optional"){i.value.length=f;break}if(d.issues.length){if(!m&&f>=u){i.value.length=f;break}i.issues.push(...Qs(f,d.issues))}i.value[f]=d.value}for(let f=i.value.length-1;f>=l.length&&(a[f]._zod.optout==="optional"&&i.value[f]===void 0);f--)i.value.length=f;return i}const OO=Y("$ZodRecord",(n,i)=>{Ot.init(n,i);const a=er.memoizer;a?.attach(n),n._zod.parse=(l,u)=>{const f=l.value;if(!io(f))return l.issues.push({expected:"record",code:"invalid_type",input:f,inst:n}),l;const d=[],m=i.keyType._zod.values;if(m&&!i.partial){l.value=a?a.alloc(n,l,{},u):{};const p=new Set;for(const b of m)if(typeof b=="string"||typeof b=="number"||typeof b=="symbol"){if(p.add(typeof b=="number"?b.toString():b),b==="__proto__")continue;const y=i.keyType._zod.run({value:b,issues:[]},u);if(y instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(y.issues.length){l.issues.push({code:"invalid_key",origin:"record",issues:y.issues.map(T=>Js(T,u,Br())),input:b,path:[b],inst:n});continue}const w=y.value;if(w==="__proto__")continue;const O=i.valueType._zod.run({value:f[b],issues:[]},u);O instanceof Promise?d.push(O.then(T=>{T.issues.length&&l.issues.push(...Qs(b,T.issues)),l.value[w]=T.value})):(O.issues.length&&l.issues.push(...Qs(b,O.issues)),l.value[w]=O.value)}let g;for(const b in f)if(!p.has(b))if(i.mode==="loose"){if(b==="__proto__")continue;l.value[b]=f[b]}else g=g??[],g.push(b);g&&g.length>0&&l.issues.push({code:"unrecognized_keys",input:f,inst:n,keys:g,continue:!0})}else{l.value=a?a.alloc(n,l,{},u):{};let p;for(const g of Reflect.ownKeys(f)){if(g==="__proto__"||!Object.prototype.propertyIsEnumerable.call(f,g))continue;let b=i.keyType._zod.run({value:g,issues:[]},u);if(b instanceof Promise)throw new Error("As)DELIM" +R"DELIM(ync schemas not supported in object keys currently");if(typeof g=="string"&&Vp.test(g)&&b.issues.length){const T=i.keyType._zod.run({value:Number(g),issues:[]},u);if(T instanceof Promise)throw new Error("Async schemas not supported in object keys currently");T.issues.length===0&&(b=T)}if(b.issues.length){i.mode==="loose"?l.value[g]=f[g]:m?(p=p??[],p.push(g)):l.issues.push({code:"invalid_key",origin:"record",issues:b.issues.map(T=>Js(T,u,Br())),input:g,path:[g],inst:n});continue}const w=b.value;if(w==="__proto__")continue;const O=i.valueType._zod.run({value:f[g],issues:[]},u);O instanceof Promise?d.push(O.then(T=>{T.issues.length&&l.issues.push(...Qs(g,T.issues)),l.value[w]=T.value})):(O.issues.length&&l.issues.push(...Qs(g,O.issues)),l.value[w]=O.value)}p&&p.length>0&&l.issues.push({code:"unrecognized_keys",input:f,inst:n,keys:p,continue:!0})}return d.length?Promise.all(d).then(()=>l):l}}),NO=Y("$ZodEnum",(n,i)=>{Ot.init(n,i);const a=Xm(i.entries),l=new Set(a);n._zod.values=l,ot(n,"pattern",u=>{const f=Xm(u.def.entries).filter(d=>sT.has(typeof d));return new RegExp(f.length?`^(${f.map(d=>ro(d.toString())).join("|")})$`:"^[^\\s\\S]$")}),n._zod.parse=(u,f)=>{const d=u.value;return l.has(d)||u.issues.push({code:"invalid_value",values:a,input:d,inst:n}),u}}),AO=Y("$ZodLiteral",(n,i)=>{Ot.init(n,i);const a=new Set(i.values);n._zod.values=a,ot(n,"pattern",l=>{const u=l.def.values;return new RegExp(u.length?`^(${u.map(f=>typeof f=="string"?ro(f):f?ro(f.toString()):String(f)).join("|")})$`:"^[^\\s\\S]$")}),n._zod.parse=(l,u)=>{const f=l.value;return a.has(f)||l.issues.push({code:"invalid_value",values:i.values,input:f,inst:n}),l}}),MO=Y("$ZodTransform",(n,i)=>{Ot.init(n,i),n._zod.optin="optional",er.memoizer?.guard(n),n._zod.parse=(a,l)=>{if(l.direction==="backward")throw new _1(n.constructor.name);const u=i.transform(a.value,a);if(l.async)return(u instanceof Promise?u:Promise.resolve(u)).then(d=>(a.value=d,a));if(u instanceof Promise)throw new Ja;return a.value=u,a}});function wb(n,i){return n.value=i.issues.length?void 0:i.value,n}const D1=Y("$ZodOptional",(n,i)=>{Ot.init(n,i),ot(n,"optin",a=>a.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),n._zod.optout="optional",ot(n,"values",a=>{const l=a.def.innerType._zod.values;return l?new Set([...l,void 0]):void 0}),ot(n,"pattern",a=>{const l=a.def.innerType._zod.pattern;return l?new RegExp(`^(${Up(l.source)})?$`):void 0}),n._zod.parse=(a,l)=>{if(a.value===void 0){if(i.innerType._zod.optin!=="defaulted")return a;const u=i.innerType._zod.run({value:a.value,issues:[]},l);return u instanceof Promise?u.then(f=>wb(a,f)):wb(a,u)}return i.innerType._zod.run(a,l)}}),jO=Y("$ZodExactOptional",(n,i)=>{D1.init(n,i),ot(n,"values",a=>a.def.innerType._zod.values),ot(n,"pattern",a=>a.def.innerType._zod.pattern),n._zod.parse=(a,l)=>i.innerType._zod.run(a,l)}),kO=Y("$ZodNullable",(n,i)=>{Ot.init(n,i),ot(n,"optin",a=>a.def.innerType._zod.optin),ot(n,"optout",a=>a.def.innerType._zod.optout),ot(n,"pattern",a=>{const l=a.def.innerType._zod.pattern;return l?new RegExp(`^(${Up(l.source)}|null)$`):void 0}),ot(n,"values",a=>a.def.innerType._zod.values?new Set([...a.def.innerType._zod.values,null]):void 0),n._zod.parse=(a,l)=>a.value===null?a:i.innerType._zod.run(a,l)}),RO=Y("$ZodDefault",(n,i)=>{Ot.init(n,i),n._zod.optin="defaulted",ot(n,"values",a=>a.def.innerType._zod.values),n._zod.parse=(a,l)=>{if(l.direction==="backward")return i.innerType._zod.run(a,l);if(a.value===void 0)return a.value=i.defaultValue,a;const u=i.innerType._zod.run(a,l);return u instanceof Promise?u.then(f=>zb(f,i)):zb(u,i)}});function zb(n,i){return n.value===void 0&&(n.value=i.defaultValue),n}const CO=Y("$ZodPrefault",(n,i)=>{Ot.init(n,i),n._zod.optin="defaulted",ot(n,"values",a=>a.def.innerType._zod.values),n._zod.parse=(a,l)=>(l.direction==="backward"||a.value===void 0&&(a.value=i.defaultValue),i.innerType._zod.run(a,l))}),DO=Y("$ZodNonOptional",(n,i)=>{Ot.init(n,i),ot(n,"values",a=>{const l=a.def.innerType._zod.values;return l?new Set([...l].filter(u=>u!==void 0)):void 0}),n._zod.parse=(a,l)=>{const u=i.innerType._zod.run(a,l);return u instanceof Promise?u.then(f=>Tb(f,n)):Tb(u,n)}});function Tb(n,i){return!n.issues.length&&n.value===void 0&&n.issues.push({code:"invalid_type",expected:"nonoptional",input:n.value,inst:i}),n}function Eb(n,i,a,l){return i.issues.length?(n.value=a.catchValue({...i,value:n.value,error:{issues:i.issues.map(u=>Js(u,l,Br()))},input:n.value}),n):(n.value=i.value,i.memo&&(n.memo=!0),n)}const UO=Y("$ZodCatch",(n,i)=>{Ot.init(n,i),ot(n,"optin",a=>a.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),ot(n,"optout",a=>a.def.innerType._zod.optout),ot(n,"values",a=>a.def.innerType._zod.values),n._zod.parse=(a,l)=>{if(l.direction==="backward")return i.innerType._zod.run(a,l);const u=i.innerType._zod.run({value:a.value,issues:[]},l);return u instanceof Promise?u.then(f=>Eb(a,f,i,l)):Eb(a,u,i,l)}}),ZO=Y("$ZodPipe",(n,i)=>{Ot.init(n,i),ot(n,"values",a=>a.def.in._zod.values),ot(n,"optin",a=>a.def.in._zod.optin),ot(n,"optout",a=>a.def.out._zod.optout),ot(n,"propValues",a=>a.def.in._zod.propValues),n._zod.parse=(a,l)=>{if(l.direction==="backward"){const f=i.out._zod.run(a,l);return f instanceof Promise?f.then(d=>mf(d,i.in,l)):mf(f,i.in,l)}const u=i.in._zod.run(a,l);return u instanceof Promise?u.then(f=>mf(f,i.out,l)):mf(u,i.out,l)}});function mf(n,i,a){return n.issues.some(l=>l.code!=="unrecognized_keys")?(n.aborted=!0,n):i._zod.run({value:n.value,issues:n.issues},a)}const $O=Y("$ZodReadonly",(n,i)=>{Ot.init(n,i),ot(n,"propValues",a=>a.def.innerType._zod.propValues),ot(n,"values",a=>a.def.innerType._zod.values),ot(n,"optin",a=>a.def.innerType?._zod?.optin),ot(n,"optout",a=>a.def.innerType?._zod?.optout),n._zod.parse=(a,l)=>{if(l.direction==="backward")return i.innerType._zod.run(a,l);const u=i.innerType._zod.run(a,l);return u instanceof Promise?u.then(Ob):Ob(u)}});function Ob(n){return n.memo||(n.value=Object.freeze(n.value)),n}const LO=Y("$ZodCustom",(n,i)=>{yi.init(n,i),Ot.init(n,i),n._zod.parse=(a,l)=>a,n._zod.check=a=>{const l=a.value,u=i.fn(l);if(u instanceof Promise)return u.then(f=>Nb(f,a,l,n));Nb(u,a,l,n)}});function Nb(n,i,a,l){if(!n){const u={code:"custom",input:a,inst:l,path:[...l._zod.def.path??[]],continue:!l._zod.def.abort};l._zod.def.params&&(u.params=l._zod.def.params),i.issues.push(Ru(u))}}class HO extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform"),this.name="ZodCyclicError"}}const ip="~memo",Ab=[];function U1(n){return n!==null&&typeof n=="object"}function $m(n){return n.map(i=>i.path?{...i,path:i.path.slice()}:{...i})}const Z1=new WeakMap,xu=0,Of=1,Ou=2;function Nf(n,i,a){const l=Z1.get(n);if(l!==void 0)return l?Ou:xu;if(i.has(n))return Ou;i.add(n);let u=xu;const f=b=>{if(u!==Ou&&b?._zod){const y=Nf(b,i);y>u&&(u=y)}},d=(b,y)=>{let w=xu;for(const O of Reflect.ownKeys(b)){const T=Object.getOwnPropertyDescriptor(b,O);if(!T.enumerable)continue;const A=T.get?Of:T.value?._zod?Nf(T.value,i):xu;A>w&&(w=A)}return w},m=b=>{b>u&&(u=b)},p=n._zod.def;switch(p.type){case"object":{const b=c1(p);m(b?d(b):Of),f(p.catchall);break}case"array":f(p.element);break;case"tuple":for(const b of p.items)f(b);f(p.rest);break;case"record":case"map":f(p.keyType),f(p.valueType);break;case"set":f(p.valueType);break;case"union":for(const b of p.options)f(b);break;case"intersection":f(p.left),f(p.right);break;case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":f(p.innerType);break;case"pipe":f(p.in),f(p.out);break;case"function":f(p.input),f(p.output);break;case"lazy":{const b=p._cachedInner??void 0;m(b?Nf(b,i):Of);break}case"template_literal":case"string":case"number":case"int":case"boolean":case"bigint":case"symbol":case"undefined":case"null":case"void":case"never":case"any":case"unknown":case"date":case"nan":case"enum":case"literal":case"file":case"transform":case"custom":break;default:for(const b in p){cons)DELIM" +R"DELIM(t y=Object.getOwnPropertyDescriptor(p,b);if(!y||y.get)continue;const w=y.value;if(!(!w||typeof w!="object")){if(w._zod)f(w);else if(Array.isArray(w))for(const O of w)f(O)}}}return i.delete(n),BO(n,u)}function BO(n,i){return i!==Of&&Z1.set(n,i===Ou),i}function qO(n,i){let a=n.buckets.get(i);return a||(a=new WeakMap,n.buckets.set(i,a)),a}let pf;const gf=[],VO={alloc(n,i,a){const l=pf;if(!l)return a;pf=void 0;const u={value:a,issues:null};return l.set(i.value,u),gf.push(u),a},guard(n){var i;(i=n._zod).deferred??(i.deferred=[]),n._zod.deferred.push(()=>{const a=n._zod.parse,l=(u,f)=>{if(f.direction!=="backward"&&PO(f,u.value))throw new HO;return a(u,f)};n._zod.parse=l,n._zod.run===a&&(n._zod.run=l)})},attach(n){var i;let a,l=!1,u,f;(i=n._zod).deferred??(i.deferred=[]),n._zod.deferred.push(()=>{const d=n._zod.parse,m=(p,g)=>{if(a===void 0){const L=Nf(n,new Set);if(L===xu)return n._zod.parse=d,n._zod.run===m&&(n._zod.run=d),d(p,g);L===Ou||l?a=!0:l=!0}const b=p.value;if(!U1(b))return d(p,g);let y=g[ip];y||(y={buckets:new WeakMap,backEdges:void 0},g[ip]=y);let w;u===g?w=f:(w=qO(y,n),u=g,f=w);const O=w.get(b);if(O)return p.value=O.value,O.issues?O.issues.length&&p.issues.push(...$m(O.issues)):(p.memo=!0,y.backEdges??(y.backEdges=new WeakSet),y.backEdges.add(O.value)),p;pf=w;const T=gf.length,A=d(p,g);pf=void 0;const k=gf.length>T?gf.pop():void 0;return A instanceof Promise?A.then(L=>(k&&(k.issues=L.issues.length?$m(L.issues):Ab),L)):(k&&(k.issues=A.issues.length?$m(A.issues):Ab),A)};n._zod.parse=m,n._zod.run===d&&(n._zod.run=m)})}};function IO(){return VO}function PO(n,i){const a=n[ip]?.backEdges;return a!==void 0&&U1(i)&&a.has(i)}const KO=()=>{const n={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function i(f){return n[f]??null}const a={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",currency_code:"currency code",credit_card:"credit card number",iban:"IBAN",jwt:"JWT",template_literal:"input"},l={nan:"NaN"};function u(f,d){return f==="number"&&typeof d=="number"&&!Number.isFinite(d)?String(d):l[f]??f}return f=>{switch(f.code){case"invalid_type":{const d=u(f.expected),m=gT(f.input),p=u(m,f.input);return`Invalid input: expected ${d}, received ${p}`}case"invalid_value":return f.values.length===1?`Invalid input: expected ${p1(f.values[0])}`:`Invalid option: expected one of ${ub(f.values,"|")}`;case"too_big":{const d=f.exact?"exactly ":f.inclusive?"<=":"<",m=i(f.origin);return m?`Too big: expected ${f.origin??"value"} to have ${d}${f.maximum.toString()} ${m.unit??"elements"}`:`Too big: expected ${f.origin??"value"} to be ${d}${f.maximum.toString()}`}case"too_small":{const d=f.exact?"exactly ":f.inclusive?">=":">",m=i(f.origin);return m?`Too small: expected ${f.origin} to have ${d}${f.minimum.toString()} ${m.unit}`:`Too small: expected ${f.origin} to be ${d}${f.minimum.toString()}`}case"invalid_format":{const d=f;return d.format==="starts_with"?`Invalid string: must start with "${d.prefix}"`:d.format==="ends_with"?`Invalid string: must end with "${d.suffix}"`:d.format==="includes"?`Invalid string: must include "${d.includes}"`:d.format==="regex"?`Invalid string: must match pattern ${d.pattern}`:`Invalid ${a[d.format]??f.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${f.divisor}`;case"unrecognized_keys":return`Unrecognized key${f.keys.length>1?"s":""}: ${ub(f.keys,", ")}`;case"invalid_key":return`Invalid key in ${f.origin}`;case"invalid_union":return f.options&&Array.isArray(f.options)&&f.options.length>0?`Invalid discriminator value. Expected ${f.options.map(m=>`'${m}'`).join(" | ")}`:f.inclusive===!1?"Invalid input: more than one option matched":"Invalid input";case"invalid_element":return`Invalid value in ${f.origin}`;default:return"Invalid input"}}};function GO(){return{localeError:KO()}}var Mb;class YO{constructor(){this._map=new WeakMap,this._idmap=new Map}add(i,...a){const l=a[0];return this._map.set(i,l),l&&typeof l=="object"&&"id"in l&&this._idmap.set(l.id,i),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(i){const a=this._map.get(i);return a&&typeof a=="object"&&"id"in a&&this._idmap.delete(a.id),this._map.delete(i),this}get(i){const a=i._zod.parent;if(a){const l={...this.get(a)??{}};delete l.id;const u={...l,...this._map.get(i)};return Object.keys(u).length?u:void 0}return this._map.get(i)}has(i){return this._map.has(i)}}function FO(){return new YO}(Mb=globalThis).__zod_globalRegistry??(Mb.__zod_globalRegistry=FO());const wu=globalThis.__zod_globalRegistry;function $1(n){return n.checks&&(n.checks=[...n.checks]),n}function QO(n,i){return new n($1({type:"string",...Te(i)}))}function JO(n,i){return new n({type:"string",format:"email",check:"string_format",abort:!1,...Te(i)})}function XO(n,i){return new n({type:"string",format:"guid",check:"string_format",abort:!1,...Te(i)})}function WO(n,i){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,...Te(i)})}function e2(n,i){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...Te(i)})}function t2(n,i){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...Te(i)})}function n2(n,i){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...Te(i)})}function i2(n,i){return new n({type:"string",format:"url",check:"string_format",abort:!1,...Te(i)})}function r2(n,i){return new n({type:"string",format:"emoji",check:"string_format",abort:!1,...Te(i)})}function s2(n,i){return new n({type:"string",format:"nanoid",check:"string_format",abort:!1,...Te(i)})}function a2(n,i){return new n({type:"string",format:"cuid",check:"string_format",abort:!1,...Te(i)})}function l2(n,i){return new n({type:"string",format:"cuid2",check:"string_format",abort:!1,...Te(i)})}function o2(n,i){return new n({type:"string",format:"ulid",check:"string_format",abort:!1,...Te(i)})}function u2(n,i){return new n({type:"string",format:"xid",check:"string_format",abort:!1,...Te(i)})}function c2(n,i){return new n({type:"string",format:"ksuid",check:"string_format",abort:!1,...Te(i)})}function f2(n,i){return new n({type:"string",format:"ipv4",check:"string_format",abort:!1,...Te(i)})}function d2(n,i){return new n({type:"string",format:"ipv6",check:"string_format",abort:!1,...Te(i)})}function h2(n,i){return new n({type:"string",format:"cidrv4",check:"string_format",abort:!1,...Te(i)})}function m2(n,i){return new n({type:"string",format:"cidrv6",check:"string_format",abort:!1,...Te(i)})}function p2(n,i){return new n({type:"string",format:"base64",check:"string_format",abort:!1,...Te(i)})}function g2(n,i){return new n({type:"string",format:"base64url",check:"string_format",abort:!1,...Te(i)})}function v2(n,i){return new n({type:"string",format:"e164",check:"string_format",abort:!1,...Te(i)})}function y2(n,i){return new n({type:"string",format:"jwt",check:"string_format",abort:!1,...Te(i)})}function b2(n,i){return new n({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...Te(i)})}function _2(n,i){return new n({type:"string",format:"date",check:"string_format",...Te(i)})}function S2(n,i){return new n({type:"string",format:"time",check:"string_format",precision:null,...Te(i)})}function x2(n,i){return new n({type:"string",format:"duration",check:"string_format",...Te(i)})}function w2(n,i){return new n($1({type:"number",checks:[],...Te(i)}))}function z2(n,i){return new n({type:"number")DELIM" +R"DELIM(,check:"number_format",abort:!1,format:"safeint",...Te(i)})}function T2(n,i){return new n({type:"boolean",...Te(i)})}function E2(n){return new n({type:"unknown"})}function O2(n,i){return new n({type:"never",...Te(i)})}function jb(n,i){return new w1({check:"less_than",...Te(i),value:n,inclusive:!1})}function Lm(n,i){return new w1({check:"less_than",...Te(i),value:n,inclusive:!0})}function kb(n,i){return new z1({check:"greater_than",...Te(i),value:n,inclusive:!1})}function Hm(n,i){return new z1({check:"greater_than",...Te(i),value:n,inclusive:!0})}function Rb(n,i){return new SE({check:"multiple_of",...Te(i),value:n})}function L1(n,i){return new wE({check:"max_length",...Te(i),maximum:n})}function $f(n,i){return new zE({check:"min_length",...Te(i),minimum:n})}function H1(n,i){return new TE({check:"length_equals",...Te(i),length:n})}function N2(n,i){return new EE({check:"string_format",format:"regex",...Te(i),pattern:n})}function A2(n){return new OE({check:"string_format",format:"lowercase",...Te(n)})}function M2(n){return new NE({check:"string_format",format:"uppercase",...Te(n)})}function j2(n,i){return new AE({check:"string_format",format:"includes",...Te(i),includes:n})}function k2(n,i){return new ME({check:"string_format",format:"starts_with",...Te(i),prefix:n})}function R2(n,i){return new jE({check:"string_format",format:"ends_with",...Te(i),suffix:n})}function ho(n){return new kE({check:"overwrite",tx:n})}function C2(n){return ho(i=>i.normalize(n))}function D2(){return ho(n=>n.trim())}function U2(){return ho(n=>n.toLowerCase())}function Z2(){return ho(n=>n.toUpperCase())}function $2(){return ho(n=>iT(n))}function L2(n,i,a){return new n({type:"array",element:i,...Te(a)})}function H2(n,i,a){return new n({type:"custom",check:"custom",fn:i,...Te(a)})}function B2(n,i){const a=q2(l=>(l.addIssue=u=>{if(typeof u=="string")l.issues.push(Ru(u,l.value,a._zod.def));else{const f=u;f.fatal&&(f.continue=!1),f.code??(f.code="custom"),"input"in f||(f.input=l.value),f.inst??(f.inst=a),f.continue??(f.continue=!a._zod.def.abort),l.issues.push(Ru(f))}},n(l.value,l)),i);return a}function q2(n,i){const a=new yi({check:"custom",...Te(i)});return a._zod.check=n,a}function Nu(n,...i){for(const a of i)for(const l of Reflect.ownKeys(a))Object.prototype.propertyIsEnumerable.call(a,l)&&ta(n,l,a[l]);return n}function B1(n){let i=n?.target??"draft-2020-12";return i==="draft-4"&&(i="draft-04"),i==="draft-7"&&(i="draft-07"),{processors:n.processors??{},metadataRegistry:n?.metadata??wu,target:i,unrepresentable:n?.unrepresentable??"throw",override:n?.override??(()=>{}),io:n?.io??"output",counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:n?.cycles??"ref",reused:n?.reused??"inline",intersections:[],deferred:[],external:n?.external??void 0}}function Ws(n,i,a,l,u){const f=typeof i.unrepresentable=="function"?i.unrepresentable({zodSchema:n,path:l.path,message:u}):i.unrepresentable;if(f==="any")return!1;if(f===void 0||f==="throw")throw new Error(u);return Object.assign(a,f),!0}function Kt(n,i,a={path:[],schemaPath:[]}){var l;const u=n._zod.def,f=i.seen.get(n);if(f)return f.count++,a.schemaPath.includes(n)&&(f.cycle=a.path),f.schema;const d={schema:{},count:1,cycle:void 0,path:a.path};i.seen.set(n,d),i.sharedDefsExtractedFor=void 0,i.sharedEmitDoneFor=void 0;const m=n._zod.toJSONSchema?.();if(m)d.schema=m;else{const b={...a,schemaPath:[...a.schemaPath,n],path:a.path};if(n._zod.processJSONSchema)n._zod.processJSONSchema(i,d.schema,b);else{const w=d.schema,O=i.processors[u.type];if(!O)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${u.type}`);O(n,i,w,b)}const y=n._zod.parent;y&&(d.ref||(d.ref=y),Kt(y,i,b),i.seen.get(y).isParent=!0)}const p=i.metadataRegistry.get(n);return p&&Nu(d.schema,p),i.io==="input"&&si(n)&&(delete d.schema.examples,delete d.schema.default),i.io==="input"&&"_prefault"in d.schema&&((l=d.schema).default??(l.default=d.schema._prefault)),delete d.schema._prefault,i.seen.get(n).schema}function Cb(n){return n.replace(/~/g,"~0").replace(/\//g,"~1")}function q1(n,i){const a=n.seen.get(i);if(!a)throw new Error("Unprocessed schema. This is a bug in Zod.");if(n.external&&n.sharedDefsExtractedFor===n.external)return;const l=new Map;for(const d of n.seen.entries()){const m=n.metadataRegistry.get(d[0])?.id;if(m){const p=l.get(m);if(p&&p!==d[0])throw new Error(`Duplicate schema id "${m}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);l.set(m,d[0])}}const u=d=>{const m=n.target==="draft-2020-12"?"$defs":"definitions";if(n.external){const y=n.external.registry.get(d[0])?.id,w=n.external.uri??(T=>T);if(y)return{ref:w(y)};const O=d[1].defId??d[1].schema.id??`schema${n.counter++}`;return d[1].defId=O,{defId:O,ref:`${w("__shared")}#/${m}/${Cb(O)}`}}const p="#",g=`${p}/${m}/`;if(d[1]===a&&!d[1].schema.id)return{ref:p};const b=d[1].schema.id??`__schema${n.counter++}`;return{defId:b,ref:g+Cb(b)}},f=d=>{if(d[1].schema.$ref)return;const m=d[1],{ref:p,defId:g}=u(d);m.def={...m.schema},g&&(m.defId=g);const b=m.schema;for(const y in b)delete b[y];b.$ref=p};if(n.cycles==="throw")for(const d of n.seen.entries()){const m=d[1];if(m.cycle)throw new Error(`Cycle detected: #/${m.cycle?.join("/")}/ -Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const d of n.seen.entries()){const m=d[1];if(i===d[0]){f(d);continue}if(n.external){const g=n.external.registry.get(d[0])?.id;if(i!==d[0]&&g){f(d);continue}}if(n.metadataRegistry.get(d[0])?.id){f(d);continue}if(m.cycle){f(d);continue}m.count>1&&n.reused==="ref"&&f(d)}n.external&&(n.sharedDefsExtractedFor=n.external)}function q1(n){const i=n.anyOf;if(!Array.isArray(i)||i.length===0||n.type!==void 0)return;const a=[];for(const l of i){if(!l||typeof l!="object")return;q1(l);const u=Object.keys(l);if(u.length!==1||u[0]!=="type")return;const f=l.type;for(const d of Array.isArray(f)?f:[f]){if(typeof d!="string")return;a.includes(d)||a.push(d)}}delete n.anyOf,n.type=a.length===1?a[0]:a}const V1=new Set(["type","properties","required","additionalProperties"]),Db=["oneOf","anyOf"];function Ub(n){const i=n.additionalProperties;return i===void 0||i===!1||typeof i!="object"||i===null?null:Object.keys(i).length?i:null}function rp(n){const i=[];for(const f of n){if(typeof f!="object"||f.type!=="object")return null;for(const d in f)if(!V1.has(d))return null;i.push(f)}const a={},l=new Set;for(const f of i){for(const d in f.properties){if(Object.prototype.hasOwnProperty.call(a,d))continue;const m=[];for(const g of i){const b=g.properties?.[d]??Ub(g);b!=null&&(m.some(y=>JSON.stringify(y)===JSON.stringify(b))||m.push(b))}const p=m.length===1?m[0]:rp(m)??{allOf:m};ta(a,d,p)}for(const d of f.required??[])l.add(d)}const u={type:"object",properties:a};if(l.size&&(u.required=[...l]),i.every(f=>f.additionalProperties===!1))u.additionalProperties=!1;else{const f=[];for(const d of i){const m=Ub(d);m&&!f.some(p=>JSON.stringify(p)===JSON.stringify(m))&&f.push(m)}f.length===1?u.additionalProperties=f[0]:f.length>1&&(u.additionalProperties={allOf:f})}return u}function B2(n){const i=n.allOf;if(!Array.isArray(i)||i.length<2)return;for(const u of V1)if(u in n)return;const a=i.filter(u=>Db.some(f=>Array.isArray(u[f])));let l=null;if(!a.length)l=rp(i);else{const u=a[0],f=Db.find(p=>Array.isArray(u[p]));if(Object.keys(u).length!==1)return;const d=i.filter(p=>p!==u),m=u[f].map(p=>rp([...d,p]));if(m.some(p=>!p))return;l={[f]:m}}l&&(delete n.allOf,Nu(n,l))}function I1(n,i){const a=n.seen.get(i);if(!a)throw new Error("Unprocessed schema. This is a bug in Zod.");const l=m=>{const p=n.seen.get(m);if(p.ref===null)return;const g=p.def??p.schema,b={...g},y=p.ref;if(p.ref=null,y){l(y);const O=n.seen.get(y),T=O.schema;if(T.$ref&&(n.target==="draft-07"||n.target==="draft-04"||n.target==="openapi-3.0")?(g.allOf=g.allOf??[],g.allOf.push(T)):Nu(g,T),Nu(g,b),m._zod.parent===y)for(const k in g)k==="$ref"||k==="allOf"||k in b||delete g[k];if(T.$ref&&)DELIM" -R"DELIM(O.def)for(const k in g)k==="$ref"||k==="allOf"||k in O.def&&JSON.stringify(g[k])===JSON.stringify(O.def[k])&&delete g[k]}const w=m._zod.parent;if(w&&w!==y){l(w);const O=n.seen.get(w);if(O?.schema.$ref&&(g.$ref=O.schema.$ref,O.def))for(const T in g)T==="$ref"||T==="allOf"||T in O.def&&JSON.stringify(g[T])===JSON.stringify(O.def[T])&&delete g[T]}n.override({zodSchema:m,jsonSchema:g,path:p.path??[]})};if(!n.external||n.sharedEmitDoneFor!==n.external){for(const m of[...n.seen.entries()].reverse())l(m[0]);if(n.target!=="openapi-3.0")for(const m of n.seen.entries())q1(m[1].def??m[1].schema);for(const m of n.deferred)m();if(n.intersections.length){const m=new Map;for(const p of n.seen.values())for(const g of[p.schema,p.def]){const b=g?.allOf;if(!Array.isArray(b))continue;const y=m.get(b);y?y.push(g):m.set(b,[g])}for(const p of n.intersections)for(const g of m.get(p)??[])B2(g)}}const u={};if(n.target==="draft-2020-12"?u.$schema="https://json-schema.org/draft/2020-12/schema":n.target==="draft-07"?u.$schema="http://json-schema.org/draft-07/schema#":n.target==="draft-04"?u.$schema="http://json-schema.org/draft-04/schema#":n.target,n.external?.uri){const m=n.external.registry.get(i)?.id;if(!m)throw new Error("Schema is missing an `id` property");u.$id=n.external.uri(m)}Nu(u,a.defId?a.schema:a.def??a.schema);const f=n.metadataRegistry.get(i)?.id;f!==void 0&&u.id===f&&delete u.id;const d=n.external?.defs??{};if(!n.external||n.sharedEmitDoneFor!==n.external)for(const m of n.seen.entries()){const p=m[1];p.def&&p.defId&&(p.def.id===p.defId&&delete p.def.id,ta(d,p.defId,p.def))}n.external&&(n.sharedEmitDoneFor=n.external),n.external||Object.keys(d).length>0&&(n.target==="draft-2020-12"?u.$defs=d:u.definitions=d);try{const m=JSON.parse(JSON.stringify(u));return Object.defineProperty(m,"~standard",{value:{...i["~standard"],jsonSchema:{input:Lf(i,"input",n.processors),output:Lf(i,"output",n.processors)}},enumerable:!1,writable:!1}),m}catch{throw new Error("Error converting schema to JSON.")}}function ii(n,i){const a=i??{seen:new Set};if(a.seen.has(n))return!1;a.seen.add(n);const l=n._zod.def;if(l.type==="transform")return!0;if(l.type==="array")return ii(l.element,a);if(l.type==="set")return ii(l.valueType,a);if(l.type==="lazy")return ii(l.getter(),a);if(l.type==="promise"||l.type==="optional"||l.type==="nonoptional"||l.type==="nullable"||l.type==="readonly"||l.type==="default"||l.type==="prefault"||l.type==="catch")return ii(l.innerType,a);if(l.type==="intersection")return ii(l.left,a)||ii(l.right,a);if(l.type==="record"||l.type==="map")return ii(l.keyType,a)||ii(l.valueType,a);if(l.type==="pipe")return n._zod.traits.has("$ZodCodec")?!0:ii(l.in,a)||ii(l.out,a);if(l.type==="object"){for(const u in l.shape)if(ii(l.shape[u],a))return!0;return!1}if(l.type==="union"){for(const u of l.options)if(ii(u,a))return!0;return!1}if(l.type==="tuple"){for(const u of l.items)if(ii(u,a))return!0;return!!(l.rest&&ii(l.rest,a))}return!1}const q2=(n,i={})=>a=>{const l=H1({...a,processors:i});return Kt(n,l),B1(l,n),I1(l,n)},Lf=(n,i,a={})=>l=>{const{libraryOptions:u,target:f}=l??{},d=H1({...u??{},target:f,io:i,processors:a});return Kt(n,d),B1(d,n),I1(d,n)},so=(n,i,a)=>{(n[i]===void 0||a>n[i])&&(n[i]=a)},ao=(n,i,a)=>{(n[i]===void 0||a{so(n,"minimum",i),ao(n,"maximum",i)},P1=(n,i)=>{n.multipleOf??(n.multipleOf=[]),n.multipleOf.includes(i)||n.multipleOf.push(i)},K1=(n,i)=>{n.patterns??(n.patterns=new Set),n.patterns.add(i)},G1=(n,i)=>{n.mime=n.mime?n.mime.filter(a=>i.includes(a)):[...i]},Y1=(n,i)=>{n.format=i,i.includes("int")&&(n.isInt=!0)},$b=(n,i)=>so(n,"minimum",i.minimum),Lb=(n,i)=>ao(n,"maximum",i.maximum),Hb=n=>(i,a)=>{Y1(i,a.format);const[l,u]=n[a.format];so(i,"minimum",l),ao(i,"maximum",u)},V2={greater_than:(n,i)=>so(n,i.inclusive?"minimum":"exclusiveMinimum",i.value),less_than:(n,i)=>ao(n,i.inclusive?"maximum":"exclusiveMaximum",i.value),multiple_of:(n,i)=>P1(n,i.value),number_format:Hb(p1),bigint_format:Hb(sT),min_length:$b,max_length:Lb,length_equals:(n,i)=>Zb(n,i.length),min_size:$b,max_size:Lb,size_equals:(n,i)=>Zb(n,i.size),string_format:(n,i)=>{Y1(n,i.format),i.pattern&&K1(n,i.pattern),(i.format==="base64"||i.format==="base64url")&&(n.contentEncoding=i.format),(i.local||i.precision===-1)&&(n.laxFormat=!0)},mime_type:(n,i)=>G1(n,i.mime)};function Wi(n){const i={},a=n._zod.def,l=n._zod.traits.has("$ZodCheck")?[n,...a.checks??[]]:a.checks??[];for(const f of l)V2[f._zod.def.check]?.(i,f._zod.def);const u=n._zod.bag;u.minimum!==void 0&&so(i,"minimum",u.minimum),u.exclusiveMinimum!==void 0&&so(i,"exclusiveMinimum",u.exclusiveMinimum),u.maximum!==void 0&&ao(i,"maximum",u.maximum),u.exclusiveMaximum!==void 0&&ao(i,"exclusiveMaximum",u.exclusiveMaximum),u.multipleOf!==void 0&&P1(i,u.multipleOf),u.format!==void 0&&(i.format??(i.format=u.format),u.format.includes("int")&&(i.isInt=!0)),u.mime&&G1(i,u.mime);for(const f of u.patterns??[])K1(i,f);return i}const I2={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},P2=new Map([[M1,aE],[Kp,lE]]),F1=n=>P2.get(n)??n,K2=(n,i,a,l)=>{const u=a;u.type="string";const{minimum:f,maximum:d,format:m,patterns:p,contentEncoding:g,laxFormat:b}=Wi(n);if(typeof f=="number"&&(u.minLength=f),typeof d=="number"&&(u.maxLength=d),m&&(u.format=I2[m]??m,u.format===""&&delete u.format,(m==="time"||b)&&delete u.format),g&&(u.contentEncoding=g),p&&p.size>0){const y=[...p].map(F1);y.length===1?u.pattern=y[0].source:y.length>1&&(u.allOf=[...y.map(w=>({...i.target==="draft-07"||i.target==="draft-04"||i.target==="openapi-3.0"?{type:"string"}:{},pattern:w.source}))])}},G2=(n,i,a,l)=>{const u=a,{minimum:f,maximum:d,multipleOf:m,exclusiveMaximum:p,exclusiveMinimum:g,isInt:b}=Wi(n);u.type=b?"integer":"number";const y=typeof g=="number"&&g>=(f??Number.NEGATIVE_INFINITY),w=typeof p=="number"&&p<=(d??Number.POSITIVE_INFINITY),O=i.target==="draft-04"||i.target==="openapi-3.0";if(y?O?(u.minimum=g,u.exclusiveMinimum=!0):u.exclusiveMinimum=g:typeof f=="number"&&(u.minimum=f),w?O?(u.maximum=p,u.exclusiveMaximum=!0):u.exclusiveMaximum=p:typeof d=="number"&&(u.maximum=d),m){const T=new Set;for(const L of m)Number.isFinite(L)&&L!==0?T.add(Math.abs(L)):Ws(n,i,u,l,`A multipleOf divisor of ${L} cannot be represented in JSON Schema`);const[A,...k]=T;A!==void 0&&(u.multipleOf=A),k.length&&(u.allOf=[...u.allOf??[],...k.map(L=>({multipleOf:L}))])}},Y2=(n,i,a,l)=>{a.type="boolean"},F2=(n,i,a,l)=>{a.not={}},Q2=(n,i,a,l)=>{},J2=(n,i,a,l)=>{const u=n._zod.def,f=Xm(u.entries);if(f.length===0){a.not={};return}f.every(d=>typeof d=="number")&&(a.type="number"),f.every(d=>typeof d=="string")&&(a.type="string"),a.enum=f},X2=(n,i,a,l)=>{const u=n._zod.def;if(u.values.length===0){a.not={};return}const f=[];for(const d of u.values)if(d===void 0){if(Ws(n,i,a,l,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof d=="bigint"){if(Ws(n,i,a,l,"BigInt literals cannot be represented in JSON Schema"))return;f.push(Number(d))}else f.push(d);if(f.length!==0)if(f.length===1){const d=f[0];a.type=d===null?"null":typeof d,i.target==="draft-04"||i.target==="openapi-3.0"?a.enum=[d]:a.const=d}else f.every(d=>typeof d=="number")&&(a.type="number"),f.every(d=>typeof d=="string")&&(a.type="string"),f.every(d=>typeof d=="boolean")&&(a.type="boolean"),f.every(d=>d===null)&&(a.type="null"),a.enum=f},W2=(n,i,a,l)=>{Ws(n,i,a,l,"Custom types cannot be represented in JSON Schema")},eN=(n,i,a,l)=>{Ws(n,i,a,l,"Transforms cannot be represented in JSON Schema")},tN=(n,i,a,l)=>{const u=a,f=n._zod.def,{minimum:d,maximum:m}=Wi(n);typeof d=="number"&&(u.minItems=d),typeof m=="number"&&(u.maxItems=m),u.type="array",u.items=Kt(f.element,i,{...l,path:[...l.path,"items"]})};function Cu(n){const i=n._zod.def;return i.type==="pipe"&&i.in._zod.traits.has("$ZodTransform")?Cu(i.out):i.type==="catch"?Cu(i.innerType):n._zod.optin}const nN=(n,i,a,l)=>{const u=a,f=n._zod.def,d=f.shape;if(Object.getOwnPropertySymbols(d).length&&Ws(n,i,u,l,"Symbol keys cannot be represented)DELIM" -R"DELIM( in JSON Schema"))return;u.type="object",u.properties={};for(const g in d)ta(u.properties,g,Kt(d[g],i,{...l,path:[...l.path,"properties",g]}));const p=[];for(const g of Object.keys(d)){const b=f.shape[g];(i.io==="input"?Cu(b)===void 0:b._zod.optout===void 0)&&p.push(g)}p.length>0&&(u.required=p),f.catchall?._zod.def.type==="never"?u.additionalProperties=!1:f.catchall?f.catchall&&(u.additionalProperties=Kt(f.catchall,i,{...l,path:[...l.path,"additionalProperties"]})):i.io==="output"&&(u.additionalProperties=!1)},iN=(n,i,a,l)=>{const u=n._zod.def,f=u.inclusive===!1,d=u.options.map((m,p)=>Kt(m,i,{...l,path:[...l.path,f?"oneOf":"anyOf",p]}));f?a.oneOf=d:a.anyOf=d},rN=(n,i,a,l)=>{const u=n._zod.def,f=Kt(u.left,i,{...l,path:[...l.path,"allOf",0]}),d=Kt(u.right,i,{...l,path:[...l.path,"allOf",1]}),m=g=>"allOf"in g&&Object.keys(g).length===1,p=[...m(f)?f.allOf:[f],...m(d)?d.allOf:[d]];a.allOf=p,i.intersections.push(p)},sN=(n,i,a,l)=>{const u=a,f=n._zod.def;u.type="array";const d=i.target==="draft-2020-12"?"prefixItems":"items",m=i.target==="draft-2020-12"||i.target==="openapi-3.0"?"items":"additionalItems",p=f.items.map((A,k)=>Kt(A,i,{...l,path:[...l.path,d,k]})),g=f.rest?Kt(f.rest,i,{...l,path:[...l.path,m,...i.target==="openapi-3.0"?[f.items.length]:[]]}):null;let b=f.items.length;for(;b>0;){const A=f.items[b-1];if(!(i.io==="input"?Cu(A)!==void 0:A._zod.optout==="optional"))break;b--}const y=f.items.length,w=!f.rest;i.target==="draft-2020-12"?(u.prefixItems=p,w?u.items=!1:g&&(u.items=g),b>0&&(u.minItems=b),w&&(u.maxItems=y)):i.target==="openapi-3.0"?(u.items={anyOf:p},g&&u.items.anyOf.push(g),b>0&&(u.minItems=b),w&&(u.maxItems=y)):(u.items=p,w?u.additionalItems=!1:g&&(u.additionalItems=g),b>0&&(u.minItems=b),w&&(u.maxItems=y));const{minimum:O,maximum:T}=Wi(n);typeof O=="number"&&(u.minItems=O),typeof T=="number"&&(u.maxItems=T)};function sp(n,i,a){if(i.$ref){if(a.has(i))return i;a.add(i);const T=n.get(i)?.def;if(!T)return i;const A=sp(n,T,a);return A===T?i:A}for(const T of["anyOf","oneOf"]){const A=i[T];if(!Array.isArray(A))continue;const k=A.map(L=>sp(n,L,a));k.some((L,D)=>L!==A[D])&&(i={...i,[T]:k})}const l=Array.isArray(i.type)?i.type:[i.type],u=!l.includes("string")&&l.some(T=>T==="number"||T==="integer"),f=i.enum??(i.const!==void 0?[i.const]:void 0);if(!u&&!f?.some(T=>typeof T=="number"))return i;const{minimum:d,maximum:m,exclusiveMinimum:p,exclusiveMaximum:g,multipleOf:b,format:y,id:w,...O}=i;return O.enum?O.enum=O.enum.map(T=>typeof T=="number"?String(T):T):typeof O.const=="number"&&(O.const=String(O.const)),u&&(O.type="string",f||(O.pattern=(l.includes("number")?Vp:pE).source)),O}const ap=new WeakMap;function aN(n){const i=new Map;for(const l of n.seen.values())l.def&&!i.has(l.schema)&&i.set(l.schema,l);const a=new Map;for(const l of ap.get(n)??[]){const u=n.seen.get(l),f=(u?.def??u?.schema)?.propertyNames;if(!f||f===!0||a.has(f))continue;const d=sp(i,f,new Set);d!==f&&a.set(f,d)}if(a.size)for(const l of n.seen.values())for(const u of[l.schema,l.def]){const f=u&&a.get(u.propertyNames);f&&(u.propertyNames=f)}}const lN=(n,i,a,l)=>{const u=a,f=n._zod.def;u.type="object";const d=f.keyType,m=Wi(d).patterns;if(f.mode==="loose"&&m&&m.size>0){const b=Kt(f.valueType,i,{...l,path:[...l.path,"patternProperties","*"]});u.patternProperties={};for(const y of m)ta(u.patternProperties,F1(y).source,b)}else{if(i.target==="draft-07"||i.target==="draft-2020-12"){u.propertyNames=Kt(f.keyType,i,{...l,path:[...l.path,"propertyNames"]});let b=ap.get(i);b||(b=[],ap.set(i,b),i.deferred.push(()=>aN(i))),b.push(n)}u.additionalProperties=Kt(f.valueType,i,{...l,path:[...l.path,"additionalProperties"]})}const p=d._zod.values,g=i.io==="input"&&Cu(f.valueType)!==void 0;if(p&&!f.partial&&!g){const b=[...p].filter(y=>typeof y=="string"||typeof y=="number");b.length>0&&(u.required=b.map(String))}},oN=(n,i,a,l)=>{const u=n._zod.def,f=Kt(u.innerType,i,l),d=i.seen.get(n);i.target==="openapi-3.0"?(d.ref=u.innerType,a.nullable=!0):a.anyOf=[f,{type:"null"}]},uN=(n,i,a,l)=>{const u=n._zod.def;Kt(u.innerType,i,l);const f=i.seen.get(n);f.ref=u.innerType},Gp=Symbol();function Q1(n,i,a,l,u){let f=!1;const d=JSON.stringify(n,(m,p)=>typeof p!="bigint"?p:(f=!0,null));return f?(Ws(i,a,l,u,"BigInt defaults cannot be represented in JSON Schema"),Gp):JSON.parse(d)}const cN=(n,i,a,l)=>{const u=n._zod.def;Kt(u.innerType,i,l);const f=i.seen.get(n);f.ref=u.innerType;const d=Q1(u.defaultValue,n,i,a,l);d!==Gp&&(a.default=d)},fN=(n,i,a,l)=>{const u=n._zod.def;Kt(u.innerType,i,l);const f=i.seen.get(n);if(f.ref=u.innerType,i.io!=="input")return;const d=Q1(u.defaultValue,n,i,a,l);d!==Gp&&(a._prefault=d)},dN=(n,i,a,l)=>{const u=n._zod.def;Kt(u.innerType,i,l);const f=i.seen.get(n);f.ref=u.innerType;let d;try{d=u.catchValue(void 0)}catch{Ws(n,i,a,l,"Dynamic catch values are not supported in JSON Schema");return}a.default=d},hN=(n,i,a,l)=>{const u=n._zod.def,f=u.in._zod.traits.has("$ZodTransform"),d=i.io==="input"?f?u.out:u.in:u.out;Kt(d,i,l);const m=i.seen.get(n);m.ref=d},mN=(n,i,a,l)=>{const u=n._zod.def;Kt(u.innerType,i,l);const f=i.seen.get(n);f.ref=u.innerType,a.readOnly=!0},J1=(n,i,a,l)=>{const u=n._zod.def;Kt(u.innerType,i,l);const f=i.seen.get(n);f.ref=u.innerType},Bb=new WeakSet([Object.prototype,Error.prototype]);function vf(n,i,a){Object.defineProperty(n,i,{configurable:!0,enumerable:!1,get(){const l=a(this);return Object.defineProperty(this,i,{value:l,configurable:!0,writable:!0}),l},set(l){Object.defineProperty(this,i,{value:l,configurable:!0,writable:!0})}})}const pN=(n,i)=>{OT.init(n,i),n.name="ZodError";const a=Object.getPrototypeOf(n);Bb.has(a)||(Bb.add(a),vf(a,"format",l=>u=>MT(l,u)),vf(a,"flatten",l=>u=>AT(l,u)),vf(a,"addIssue",l=>u=>{l.issues.push(u),l.message=JSON.stringify(l.issues,Wm,2)}),vf(a,"addIssues",l=>u=>{l.issues.push(...u),l.message=JSON.stringify(l.issues,Wm,2)}),Object.defineProperty(a,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},tr=Y("ZodError",pN,void 0,{Parent:Error}),gN=Lp(tr),vN=Hp(tr),yN=Bp(tr),bN=qp(tr),_N=UT(tr),SN=ZT(tr),xN=$T(tr),wN=LT(tr),zN=HT(tr),TN=BT(tr),EN=qT(tr),ON=VT(tr);function NN(){er.localeError||Br(PO())}function Hu(){er.memoizer||Br({memoizer:qO()})}const Dt=Y("ZodType",(n,i)=>(NN(),Ot.init(n,i),n.def=i,n.type=i.type,n),{check(...n){const i=this.def;return this.clone(Di(i,{checks:[...i.checks??[],...n.map(a=>typeof a=="function"?{_zod:{check:a,def:{check:"custom"},onattach:[]}}:a)]}),{parent:!0})},with(...n){return this.check(...n)},clone(n,i){return na(this,n,i)},brand(){return this},register(n,i){return n.add(this,i),this},refine(n,i){return this.check(OA(n,i))},superRefine(n,i){return this.check(NA(n,i))},overwrite(n){return this.check(ho(n))},optional(){return Pb(this)},exactOptional(){return mA(this)},nullable(){return Kb(this)},nullish(){return Pb(Kb(this))},nonoptional(n){return _A(this,n)},array(){return Wf(this)},or(n){return ed([this,n])},and(n){return lA(this,n)},transform(n){return Gb(this,hA(n))},default(n){return vA(this,n)},prefault(n){return bA(this,n)},catch(n){return xA(this,n)},pipe(n){return Gb(this,n)},readonly(){return TA(this)},describe(n){const i=this.clone();return wu.add(i,{description:n}),i},meta(...n){if(n.length===0)return wu.get(this);const i=this.clone();return wu.add(i,n[0]),i},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(n,...i){return i.length===0?n(this):n(this,...i)},get"~standard"(){return v1(this,"~standard",{...T1(this),jsonSchema:{input:Lf(this,"input"),output:Lf(this,"output")}})},set"~standard"(n){Xs(this,"~standard",n)},parse:function n(i,a){return gN(this,i,a,{callee:n})},parseAsync:async function n(i,a){return await vN(this,i,a,{callee:n})},safeParse(n,i){return yN(this,n,i)},async safeParseAsync(n,i){return bN(this,n,i)},get spa(){return this?.safeParseAsync},set spa(n){Xs(this,"spa",n)},validate(n,i){return RT(this,n,i)},validateAsync(n,i){return DT(this,n,i)},encode:function n(i,a){return _N(this,i,a,{callee:n})DELIM" -R"DELIM()},decode:function n(i,a){return SN(this,i,a,{callee:n})},encodeAsync:async function n(i,a){return await xN(this,i,a,{callee:n})},decodeAsync:async function n(i,a){return await wN(this,i,a,{callee:n})},safeEncode(n,i){return zN(this,n,i)},safeDecode(n,i){return TN(this,n,i)},async safeEncodeAsync(n,i){return EN(this,n,i)},async safeDecodeAsync(n,i){return ON(this,n,i)},toJSONSchema(n){return q2(this,{})(n)},get description(){return wu.get(this)?.description},get _def(){return this._zod.def}}),X1=Y("_ZodString",(n,i)=>{Pp.init(n,i),Dt.init(n,i),n._zod.processJSONSchema=(a,l,u)=>K2(n,a,l)},y1({format:n=>Wi(n).format??null,minLength:n=>Wi(n).minimum??null,maxLength:n=>Wi(n).maximum??null},{regex(...n){return this.check(E2(...n))},includes(...n){return this.check(A2(...n))},startsWith(...n){return this.check(M2(...n))},endsWith(...n){return this.check(j2(...n))},min(...n){return this.check($f(...n))},max(...n){return this.check($1(...n))},length(...n){return this.check(L1(...n))},nonempty(...n){return this.check($f(1,...n))},lowercase(n){return this.check(O2(n))},uppercase(n){return this.check(N2(n))},trim(){return this.check(R2())},normalize(...n){return this.check(k2(...n))},toLowerCase(){return this.check(C2())},toUpperCase(){return this.check(D2())},slugify(){return this.check(U2())}})),AN=Y("ZodString",(n,i)=>{Pp.init(n,i),X1.init(n,i)},{email(n){return this.check(FO(CN,n))},url(n){return this.check(t2(UN,n))},jwt(n){return this.check(g2(JN,n))},emoji(n){return this.check(n2(ZN,n))},guid(n){return this.check(QO(DN,n))},uuid(n){return this.check(JO(yf,n))},uuidv4(n){return this.check(XO(yf,n))},uuidv6(n){return this.check(WO(yf,n))},uuidv7(n){return this.check(e2(yf,n))},nanoid(n){return this.check(i2($N,n))},cuid(n){return this.check(r2(LN,n))},cuid2(n){return this.check(s2(HN,n))},ulid(n){return this.check(a2(BN,n))},base64(n){return this.check(h2(YN,n))},base64url(n){return this.check(m2(FN,n))},xid(n){return this.check(l2(qN,n))},ksuid(n){return this.check(o2(VN,n))},ipv4(n){return this.check(u2(IN,n))},ipv6(n){return this.check(c2(PN,n))},cidrv4(n){return this.check(f2(KN,n))},cidrv6(n){return this.check(d2(GN,n))},e164(n){return this.check(p2(QN,n))},datetime(n){return this.check(v2(MN,n))},date(n){return this.check(y2(jN,n))},time(n){return this.check(b2(kN,n))},duration(n){return this.check(_2(RN,n))}});function ri(n){return YO(AN,n)}const Ht=Y("ZodStringFormat",(n,i)=>{Ct.init(n,i),X1.init(n,i)}),MN=Y("ZodISODateTime",(n,i)=>{QE.init(n,i),Ht.init(n,i)}),jN=Y("ZodISODate",(n,i)=>{JE.init(n,i),Ht.init(n,i)}),kN=Y("ZodISOTime",(n,i)=>{XE.init(n,i),Ht.init(n,i)}),RN=Y("ZodISODuration",(n,i)=>{WE.init(n,i),Ht.init(n,i)}),CN=Y("ZodEmail",(n,i)=>{UE.init(n,i),Ht.init(n,i)}),DN=Y("ZodGUID",(n,i)=>{CE.init(n,i),Ht.init(n,i)}),yf=Y("ZodUUID",(n,i)=>{DE.init(n,i),Ht.init(n,i)}),UN=Y("ZodURL",(n,i)=>{qE.init(n,i),Ht.init(n,i)}),ZN=Y("ZodEmoji",(n,i)=>{VE.init(n,i),Ht.init(n,i)}),$N=Y("ZodNanoID",(n,i)=>{IE.init(n,i),Ht.init(n,i)}),LN=Y("ZodCUID",(n,i)=>{PE.init(n,i),Ht.init(n,i)}),HN=Y("ZodCUID2",(n,i)=>{KE.init(n,i),Ht.init(n,i)}),BN=Y("ZodULID",(n,i)=>{GE.init(n,i),Ht.init(n,i)}),qN=Y("ZodXID",(n,i)=>{YE.init(n,i),Ht.init(n,i)}),VN=Y("ZodKSUID",(n,i)=>{FE.init(n,i),Ht.init(n,i)}),IN=Y("ZodIPv4",(n,i)=>{eO.init(n,i),Ht.init(n,i)}),PN=Y("ZodIPv6",(n,i)=>{nO.init(n,i),Ht.init(n,i)}),KN=Y("ZodCIDRv4",(n,i)=>{iO.init(n,i),Ht.init(n,i)}),GN=Y("ZodCIDRv6",(n,i)=>{sO.init(n,i),Ht.init(n,i)}),YN=Y("ZodBase64",(n,i)=>{aO.init(n,i),Ht.init(n,i)}),FN=Y("ZodBase64URL",(n,i)=>{oO.init(n,i),Ht.init(n,i)}),QN=Y("ZodE164",(n,i)=>{uO.init(n,i),Ht.init(n,i)}),JN=Y("ZodJWT",(n,i)=>{fO.init(n,i),Ht.init(n,i)}),W1=Y("ZodNumber",(n,i)=>{j1.init(n,i),Dt.init(n,i),n._zod.processJSONSchema=(a,l,u)=>G2(n,a,l,u),n.isFinite=!0},y1({minValue:n=>{const{minimum:i,exclusiveMinimum:a}=Wi(n);return Math.max(i??Number.NEGATIVE_INFINITY,a??Number.NEGATIVE_INFINITY)},maxValue:n=>{const{maximum:i,exclusiveMaximum:a}=Wi(n);return Math.min(i??Number.POSITIVE_INFINITY,a??Number.POSITIVE_INFINITY)},isInt:n=>{const{isInt:i,multipleOf:a}=Wi(n);return!!i||!!a?.some(Number.isSafeInteger)},format:n=>Wi(n).format??null},{gt(n,i){return this.check(kb(n,i))},gte(n,i){return this.check(Hm(n,i))},min(n,i){return this.check(Hm(n,i))},lt(n,i){return this.check(jb(n,i))},lte(n,i){return this.check(Lm(n,i))},max(n,i){return this.check(Lm(n,i))},int(n){return this.check(qb(n))},safe(n){return this.check(qb(n))},positive(n){return this.check(kb(0,n))},nonnegative(n){return this.check(Hm(0,n))},negative(n){return this.check(jb(0,n))},nonpositive(n){return this.check(Lm(0,n))},multipleOf(n,i){return this.check(Rb(n,i))},step(n,i){return this.check(Rb(n,i))},finite(){return this}}));function hn(n){return S2(W1,n)}const XN=Y("ZodNumberFormat",(n,i)=>{dO.init(n,i),W1.init(n,i)});function qb(n){return x2(XN,n)}const WN=Y("ZodBoolean",(n,i)=>{hO.init(n,i),Dt.init(n,i),n._zod.processJSONSchema=(a,l,u)=>Y2(n,a,l)});function Dn(n){return w2(WN,n)}const eA=Y("ZodUnknown",(n,i)=>{mO.init(n,i),Dt.init(n,i),n._zod.processJSONSchema=(a,l,u)=>Q2()});function Vb(){return z2(eA)}const tA=Y("ZodNever",(n,i)=>{pO.init(n,i),Dt.init(n,i),n._zod.processJSONSchema=(a,l,u)=>F2(n,a,l)});function nA(n){return T2(tA,n)}const iA=Y("ZodArray",(n,i)=>{Hu(),yO.init(n,i),Dt.init(n,i),n._zod.processJSONSchema=(a,l,u)=>tN(n,a,l,u),n.element=i.element},{min(n,i){return this.check($f(n,i))},nonempty(n){return this.check($f(1,n))},max(n,i){return this.check($1(n,i))},length(n,i){return this.check(L1(n,i))},unwrap(){return this.element}});function Wf(n,i){return Z2(iA,n,i)}const rA=Y("ZodObject",(n,i)=>{Hu(),SO.init(n,i),Dt.init(n,i),n._zod.processJSONSchema=(a,l,u)=>nN(n,a,l,u),bT(n,"shape",a=>a._zod.def.shape,!1)},{keyof(){return Du(Object.keys(this._zod.def.shape))},catchall(n){return this.clone(Di(this._zod.def,{catchall:n}))},passthrough(){return this.clone(Di(this._zod.def,{catchall:Vb()}))},loose(){return this.clone(Di(this._zod.def,{catchall:Vb()}))},strict(){return this.clone(Di(this._zod.def,{catchall:nA()}))},strip(){return this.clone(Di(this._zod.def,{catchall:void 0}))},extend(n){return oT(this,n)},safeExtend(n){return uT(this,n)},merge(n){return cT(this,n)},pick(n){return aT(this,n)},omit(n){return lT(this,n)},partial(...n){return cb(Yp,this,n[0])},exactPartial(...n){return cb(eS,this,n[0],"exactPartial")},required(...n){return fT(tS,this,n[0])}});function vi(n,i){const a={type:"object",shape:n??{},...Te(i)};return new rA(a)}const sA=Y("ZodUnion",(n,i)=>{xO.init(n,i),Dt.init(n,i),n._zod.processJSONSchema=(a,l,u)=>iN(n,a,l,u),n.options=i.options});function ed(n,i){return new sA({type:"union",options:n,...Te(i)})}const aA=Y("ZodIntersection",(n,i)=>{wO.init(n,i),Dt.init(n,i),n._zod.processJSONSchema=(a,l,u)=>rN(n,a,l,u)});function lA(n,i){return new aA({type:"intersection",left:n,right:i})}const oA=Y("ZodTuple",(n,i)=>{Hu(),zO.init(n,i),Dt.init(n,i),n._zod.processJSONSchema=(a,l,u)=>sN(n,a,l,u)},{rest(n){return this.clone({...this._zod.def,rest:n})},partial(){const n=this._zod.def;if(n.checks?.length)throw new Error(".partial() cannot be used on tuple schemas containing refinements");return this.clone({...n,items:n.items.map(i=>new Yp({type:"optional",innerType:i}))})}});function uA(n,i,a){const l=i instanceof Ot,u=l?a:i,f=l?i:null;return new oA({type:"tuple",items:n,rest:f,...Te(u)})}const Ib=Y("ZodRecord",(n,i)=>{Hu(),TO.init(n,i),Dt.init(n,i),n._zod.processJSONSchema=(a,l,u)=>lN(n,a,l,u),n.keyType=i.keyType,n.valueType=i.valueType});function cA(n,i,a){return!i||!i._zod?new Ib({type:"record",keyType:ri(),valueType:n,...Te(i)}):new Ib({type:"record",keyType:n,valueType:i,...Te(a)})}const lp=Y("ZodEnum",(n,i)=>{EO.init(n,i),Dt.init(n,i),n._zod.processJSONSchema=(l,u,f)=>J2(n,l,u),n.enum=i.entries,n.options=[...n._zod.values];const a=new Set(Object.keys(i.entries));n.extract=(l,u)=>{const f={};for(const d of l)if(a.has(d))f[d]=i.entries[d];else throw new Error(`Key ${d} not found in enum`);return new lp({...i,checks:[],...Te(u),entrie)DELIM" -R"DELIM(s:f})},n.exclude=(l,u)=>{const f={...i.entries};for(const d of l)if(a.has(d))delete f[d];else throw new Error(`Key ${d} not found in enum`);return new lp({...i,checks:[],...Te(u),entries:f})}});function Du(n,i){const a=Array.isArray(n)?Object.fromEntries(n.map(l=>[l,l])):n;return new lp({type:"enum",entries:a,...Te(i)})}const fA=Y("ZodLiteral",(n,i)=>{OO.init(n,i),Dt.init(n,i),n._zod.processJSONSchema=(a,l,u)=>X2(n,a,l,u),n.values=new Set(i.values),Object.defineProperty(n,"value",{get(){if(i.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return i.values[0]}})});function Au(n,i){return new fA({type:"literal",values:Array.isArray(n)?n:[n],...Te(i)})}const dA=Y("ZodTransform",(n,i)=>{Hu(),NO.init(n,i),Dt.init(n,i),n._zod.processJSONSchema=(a,l,u)=>eN(n,a,l,u),n._zod.parse=(a,l)=>{if(l.direction==="backward")throw new b1(n.constructor.name);a.addIssue=f=>{if(typeof f=="string")a.issues.push(Ru(f,a.value,i));else{const d=f;d.fatal&&(d.continue=!1),d.code??(d.code="custom"),"input"in d||(d.input=a.value),d.inst??(d.inst=n),a.issues.push(Ru(d))}};const u=i.transform(a.value,a);return u instanceof Promise?u.then(f=>(a.value=f,a)):(a.value=u,a)}});function hA(n){return new dA({type:"transform",transform:n})}const Yp=Y("ZodOptional",(n,i)=>{C1.init(n,i),Dt.init(n,i),n._zod.processJSONSchema=(a,l,u)=>J1(n,a,l,u),n.unwrap=()=>n._zod.def.innerType});function Pb(n){return new Yp({type:"optional",innerType:n})}const eS=Y("ZodExactOptional",(n,i)=>{AO.init(n,i),Dt.init(n,i),n._zod.processJSONSchema=(a,l,u)=>J1(n,a,l,u),n.unwrap=()=>n._zod.def.innerType});function mA(n){return new eS({type:"optional",innerType:n})}const pA=Y("ZodNullable",(n,i)=>{MO.init(n,i),Dt.init(n,i),n._zod.processJSONSchema=(a,l,u)=>oN(n,a,l,u),n.unwrap=()=>n._zod.def.innerType});function Kb(n){return new pA({type:"nullable",innerType:n})}const gA=Y("ZodDefault",(n,i)=>{jO.init(n,i),Dt.init(n,i),n._zod.processJSONSchema=(a,l,u)=>cN(n,a,l,u),n.unwrap=()=>n._zod.def.innerType,n.removeDefault=n.unwrap});function vA(n,i){return new gA({type:"default",innerType:n,get defaultValue(){return typeof i=="function"?i():h1(i)}})}const yA=Y("ZodPrefault",(n,i)=>{kO.init(n,i),Dt.init(n,i),n._zod.processJSONSchema=(a,l,u)=>fN(n,a,l,u),n.unwrap=()=>n._zod.def.innerType});function bA(n,i){return new yA({type:"prefault",innerType:n,get defaultValue(){return typeof i=="function"?i():h1(i)}})}const tS=Y("ZodNonOptional",(n,i)=>{RO.init(n,i),Dt.init(n,i),n._zod.processJSONSchema=(a,l,u)=>uN(n,a,l,u),n.unwrap=()=>n._zod.def.innerType});function _A(n,i){return new tS({type:"nonoptional",innerType:n,...Te(i)})}const SA=Y("ZodCatch",(n,i)=>{CO.init(n,i),Dt.init(n,i),n._zod.processJSONSchema=(a,l,u)=>dN(n,a,l,u),n.unwrap=()=>n._zod.def.innerType,n.removeCatch=n.unwrap});function xA(n,i){return new SA({type:"catch",innerType:n,catchValue:typeof i=="function"?i:ST(i)})}const wA=Y("ZodPipe",(n,i)=>{DO.init(n,i),Dt.init(n,i),n._zod.processJSONSchema=(a,l,u)=>hN(n,a,l,u),n.in=i.in,n.out=i.out});function Gb(n,i){return new wA({type:"pipe",in:n,out:i})}const zA=Y("ZodReadonly",(n,i)=>{UO.init(n,i),Dt.init(n,i),n._zod.processJSONSchema=(a,l,u)=>mN(n,a,l,u),n.unwrap=()=>n._zod.def.innerType});function TA(n){return new zA({type:"readonly",innerType:n})}const EA=Y("ZodCustom",(n,i)=>{ZO.init(n,i),Dt.init(n,i),n._zod.processJSONSchema=(a,l,u)=>W2(n,a,l,u)});function OA(n,i={}){return $2(EA,n,i)}function NA(n,i){return L2(n,i)}const Bu=[{id:0,name:"application",label:"Application"},{id:1,name:"news",label:"News"},{id:2,name:"session",label:"Session"},{id:3,name:"protocol",label:"Protocol"},{id:4,name:"proxy",label:"Proxy"},{id:5,name:"remote",label:"Remote"},{id:6,name:"fault",label:"Fault"},{id:7,name:"quitting",label:"Quitting"},{id:8,name:"objects",label:"Objects"},{id:9,name:"verbose",label:"Verbose"}],Hf=[{id:0,name:"header_archived",label:"Header archived",category:"headers",valueKind:"height"},{id:1,name:"header_organized",label:"Header organized",category:"headers",valueKind:"height"},{id:2,name:"header_reorganized",label:"Header reorganized",category:"headers",valueKind:"height"},{id:3,name:"block_archived",label:"Block archived",category:"blocks",valueKind:"height"},{id:4,name:"block_buffered",label:"Block buffered",category:"blocks",valueKind:"height"},{id:5,name:"block_validated",label:"Block validated",category:"blocks",valueKind:"height"},{id:6,name:"block_confirmed",label:"Block confirmed",category:"blocks",valueKind:"height"},{id:7,name:"block_unconfirmable",label:"Block unconfirmable",category:"blocks",valueKind:"height"},{id:8,name:"validate_bypassed",label:"Validation bypassed",category:"blocks",valueKind:"height"},{id:9,name:"confirm_bypassed",label:"Confirmation bypassed",category:"blocks",valueKind:"height"},{id:10,name:"tx_archived",label:"Transaction archived",category:"transactions",valueKind:"fee-rate"},{id:11,name:"tx_validated",label:"Transaction validated",category:"transactions",valueKind:"count"},{id:12,name:"tx_invalidated",label:"Transaction invalidated",category:"transactions",valueKind:"count"},{id:13,name:"block_organized",label:"Block organized",category:"chain",valueKind:"height"},{id:14,name:"block_reorganized",label:"Block reorganized",category:"chain",valueKind:"height"},{id:15,name:"template_issued",label:"Mining template issued",category:"mining",valueKind:"count"},{id:16,name:"snapshot_secs",label:"Snapshot",category:"timing",valueKind:"seconds"},{id:17,name:"prune_msecs",label:"Prune",category:"timing",valueKind:"milliseconds"},{id:18,name:"reload_msecs",label:"Store reload",category:"timing",valueKind:"milliseconds"},{id:19,name:"block_usecs",label:"Serve block",category:"timing",valueKind:"microseconds"},{id:20,name:"ancestry_msecs",label:"Serve ancestry",category:"timing",valueKind:"milliseconds"},{id:21,name:"filter_msecs",label:"Serve filter",category:"timing",valueKind:"milliseconds"},{id:22,name:"filterhashes_msecs",label:"Serve filter hashes",category:"timing",valueKind:"milliseconds"},{id:23,name:"filterchecks_msecs",label:"Serve filter checkpoints",category:"timing",valueKind:"milliseconds"},{id:24,name:"ecdsa_secs",label:"ECDSA batch verification",category:"timing",valueKind:"seconds"},{id:25,name:"schnorr_secs",label:"Schnorr batch verification",category:"timing",valueKind:"seconds"},{id:26,name:"silent_secs",label:"Silent payment scan",category:"timing",valueKind:"seconds"},{id:27,name:"validate_usecs",label:"Block validation",category:"timing",valueKind:"microseconds"},{id:28,name:"unknown",label:"Unknown",category:"chain",valueKind:"unknown"}],nS=hn().int().nonnegative().max(864e13),AA=vi({level:hn().int().nonnegative(),time:nS,message:ri()}),MA=vi({event:hn().int().nonnegative(),value:hn().nonnegative(),time:nS}),jA=vi({previous:hn().nonnegative()});ed([AA,MA,jA]);const Fp=2**Bu.length-1,to=Fp,kA=2**0+2**1+2**2+2**6+2**7;function RA(n,i){return Number.isInteger(i)&&i>=0&&i0?`${String(a)}d ${String(l)}h`:l>0?`${String(l)}h ${String(u)}m`:u>0?`${String(u)}m ${String(f)}s`:`${String(f)}s`}function rS(n,i){switch(mo(n).valueKind){case"height":return`height ${zn(i)}`;case"seconds":return`${Fa(i)} s`;case"milliseconds":return`${Fa(i)} ms`;case"microseconds":return`${Fa(i)} µs`;case"count":return zn(i);case"fee-rate":return`${Fa(i/1e3,3)} sat/vB`;default:return String(i)}}function HA(n){return n>=100?`${Fa(n,0)}/s`:n>=10?`${Fa(n,1)}/s`:`${Fa(n,2)}/s`}const Bf=32,BA=[{value:"all",label:"All categories"},{value:"headers",label:"Headers"},{value:"blocks",label:"Blocks"},{value:"transactions",label:"Transactions"},{value:"chain",label:"Confirmed chain"},{value:"mining",label:"Mining"},{value:"timing",label:"Timing"}],qA={headers:"bg-violet-500/15 text-violet-300",blocks:"bg-accent/15 text-accent",transactions:"bg-sky-500/15 text-sky-300",chain:"bg-emerald-500/15 text-emerald-300",mining:"bg-amber-500/15 text-amber-300",timing:"bg-cyan-500/15 text-cyan-300"};function VA({metrics:n,paused:i,onPausedChange:a,onClear:l}){const[u,f]=se.useState(""),[d,m]=se.useState("all"),[p,g]=se.useState({offset:0,search:u,category:d}),b=p.search===u&&p.category===d?p.offset:0,y=se.useRef(null),w=se.useSyncExternalStore(n.subscribeEvents,n.getEventWindow,n.getEventWindow);return se.useEffect(()=>{n.setEventQuery({search:u,category:d,offset:b})},[n,u,d,b]),se.useEffect(()=>{y.current&&(y.current.scrollTop=0)},[u,d]),x.jsxs("section",{className:"space-y-4",children:[x.jsxs("header",{className:"flex flex-wrap items-end justify-between gap-4",children:[x.jsxs("div",{children:[x.jsx("p",{className:"text-accentSecondary text-xs tracking-wide uppercase",children:"Node lifecycle"}),x.jsx("h2",{className:"text-accent mt-1 text-2xl font-semibold",children:"Live events"}),x.jsx("p",{className:"text-textMuted mt-1 text-sm",children:"Heights are event payloads; timing values retain their source units."}),x.jsx("p",{className:"text-textMuted mt-1 text-xs",children:"Pause freezes this view; collection and charts continue."})]}),x.jsxs("div",{className:"flex gap-2",children:[x.jsx("button",{type:"button",onClick:()=>{i&&(y.current&&(y.current.scrollTop=0),g({offset:0,search:u,category:d})),a(!i)},className:"border-accent/40 text-accent hover:border-accent hover:text-accentSecondary rounded-md border px-3 py-2 text-sm font-medium",children:i?"Resume display":"Pause display"}),x.jsx("button",{type:"button",onClick:l,className:"border-accent/40 text-accent hover:border-accent hover:text-accentSecondary rounded-md border px-3 py-2 text-sm font-medium",children:"Clear"})]})]}),x.jsxs("div",{className:"border-accent/30 bg-surface/80 flex flex-wrap gap-3 rounded-2xl border p-4",children:[x.jsxs("label",{className:"min-w-56 flex-1",children:[x.jsx("span",{className:"sr-only",children:"Search events"}),x.jsx("input",{type:"search",value:u,onChange:O=>{f(O.target.value)},placeholder:"Search event names or values…",className:"border-accent/40 bg-background text-textPrimary placeholder:text-textMuted/60 focus:border-accent w-full rounded-md border px-3 py-2 text-sm focus:ring-0"})]}),x.jsxs("label",{children:[x.jsx("span",{className:"sr-only",children:"Filter event category"}),x.jsx("select",{value:d,onChange:O=>{m(O.target.value)},className:"border-accent/40 bg-background text-textPrimary focus:border-accent rounded-md border px-3 py-2 text-sm focus:ring-0",children:BA.map(O=>x.jsx("option",{value:O.value,children:O.label},O.value))})]})]}),x.jsxs("div",{className:"border-accent/30 bg-surface/80 overflow-hidden rounded-xl border",children:[x.jsxs("div",{className:"border-accentSecondary/30 bg-accentSecondary/20 text-textMuted flex justify-between border-b px-4 py-3 text-xs",children:[x.jsx("span",{children:i?"Display paused · collection continues":b>0?"Viewing older rows · collection continues":"Live stream · newest first"}),x.jsxs("span",{children:[String(w.matched)," matching · ",String(w.retained)," retained"]})]}),x.jsx("div",{ref:y,role:"region","aria-label":"Scrollable event history",tabIndex:0,className:"h-[min(60vh,32rem)] min-h-32 overflow-auto",style:{overflowAnchor:"none"},onScroll:O=>{g({offset:Math.max(0,Math.floor(O.currentTarget.scrollTop/Bf)-8),search:u,category:d})},children:w.matched===0?x.jsx("p",{className:"text-textMuted px-4 py-12 text-center text-sm",children:"No matching events."}):x.jsx("ol",{"aria-label":"Received events",className:"relative min-w-[32rem]",style:{height:w.matched*Bf},children:w.events.map((O,T)=>x.jsx(IA,{event:O,index:w.offset+T,total:w.matched},O.id))})})]}),!i&&x.jsx("div",{className:"flex justify-end text-xs",children:x.jsx("button",{type:"button",className:"text-accent hover:underline",onClick:()=>{y.current&&(y.current.scrollTop=0),g({offset:0,search:u,category:d})},children:"Jump to latest"})}),x.jsxs("details",{className:"border-accent/30 bg-surface/80 rounded-2xl border",children:[x.jsxs("summary",{className:"text-textMuted hover:text-accent cursor-pointer px-4 py-3 text-sm",children:["Event contract (",String(Hf.length)," identifiers)"]}),x.jsx("div",{className:"border-accentSecondary/20 grid gap-2 border-t p-4 sm:grid-cols-2 lg:grid-cols-3",children:Hf.map(O=>x.jsxs("div",{className:"text-xs",children:[x.jsx("span",{className:"text-textMuted font-mono",children:String(O.id).padStart(2,"0")}),x.jsx("span",{className:"text-textPrimary ml-2",children:O.name})]},O.id))})]})]})}const IA=se.memo(function({event:i,index:a,total:l}){const u=mo(i.event);return x.jsxs("li",{"aria-setsize":l,"aria-posinset":a+1,className:"border-accentSecondary/20 absolute inset-x-0 grid grid-cols-[8.5rem_10rem_minmax(0,1fr)] items-center gap-2 border-b px-4 text-xs",style:{top:a*Bf,height:Bf},children:[x.jsx("time",{dateTime:Qp(i.time),className:"text-textMuted font-mono tabular-nums",children:Uu(i.time)}),x.jsx("span",{className:`w-fit rounded px-2 py-0.5 font-medium ${qA[u.category]}`,children:u.name}),x.jsx("span",{className:"text-textPrimary font-mono tabular-nums",children:rS(i.event,i.value)})]})}),qf=32,Yb={0:"bg-sky-500/15 text-sky-300",1:"bg-emerald-500/15 text-emerald-300",2:"bg-violet-500/15 text-violet-300",3:"bg-cyan-500/15 text-cyan-300",4:"bg-indigo-500/15 text-indigo-300",5:"bg-blue-500/15 text-blue-300",6:"bg-red-500/20 text-red-300",7:"bg-orange-500/20 text-orange-300",8:"bg-slate-500/20 text-slate-300",9:"bg-zinc-500/20 text-zinc-300"};function PA({metrics:n,delivery:i,status:a,logFilter:l,paused:u,onLogFilterChange:f,onPausedChange:d,onClear:m}){const[p,g]=se.useState(""),[b,y]=se.useState({offset:0,search:p,filter:l}),w=b.search===p&&b.filter===l?b.offset:0,[O,T]=se.useState(null),A=se.useRef(null),k=se.useSyncExternalStore(n.subscribeLogs,n.getLogWindow,n.getLogWindow);return se.useEffect(()=>{n.setLogQuery({search:p,filter:l,offset:w})},[n,p,l,w]),se.useEffect(()=>{A.current&&(A.current.scrollTop=0)},[p,l]),x.jsxs("section",{className:"space-y-4",children:[x.jsxs("header",{className:"flex flex-wrap items-end justify-between gap-4",children:[x.jsxs("div",{children:[x.jsx("p",{className:"text-accentSecondary text-xs tracking-wide uppercase",children:"Diagnostic stream"}),x.jsx("h2",{className:"text-accent mt-1 text-2xl font-semibold",children:"Node logs"}),x.jsx("p",{className:"text-textMuted mt-1 text-sm",children:"The newest 1,000 messages are retained in this browser session."})]}),x.jsxs("div",{className:"flex gap-2",children:[x.jsx("button",{type:"button",onClick:()=>{u&&(A.current&&(A.current.scrollTop=0),y({offset:0,search:p,filter:l})),d(!u)},className:"border-accent/40 text-accent hover:border-accent hover:text-accentSecondary rounded-md border px-3 py-2 text-sm font-medium",children:u?"Resume display":"Pause display"}),x.jsx("button",{type:"button",onClick:m,className:"border-accent/40 text-accent hover:border-accent hover:text-accentSecondary r)DELIM" -R"DELIM(ounded-md border px-3 py-2 text-sm font-medium",children:"Clear"})]})]}),x.jsxs("fieldset",{className:"border-accent/30 bg-surface/80 space-y-3 rounded-2xl border p-4",children:[x.jsx("legend",{className:"text-textPrimary px-1 text-sm font-medium",children:"Requested log levels"}),x.jsx("p",{className:"text-textMuted text-xs",children:"Only checked levels are sent by the server. Pause freezes this view; collection and charts continue. Skipped log levels are not replayed."}),x.jsx("div",{className:"flex flex-wrap gap-x-5 gap-y-3",children:Bu.map(L=>x.jsxs("label",{className:"text-textPrimary flex items-center gap-2 text-sm",children:[x.jsx("input",{type:"checkbox",checked:RA(l,L.id),onChange:()=>{f(l^1<{f(kA)},className:"text-accent hover:underline",children:"Operational levels"}),x.jsx("button",{type:"button",onClick:()=>{f(Fp)},className:"text-accent hover:underline",children:"All levels"}),x.jsx("button",{type:"button",onClick:()=>{f(0)},className:"text-accent hover:underline",children:"No levels"}),x.jsx("span",{className:"text-textMuted",children:"Selection is saved in this browser."})]})]}),x.jsxs("div",{className:"border-accent/30 bg-surface/80 space-y-2 rounded-2xl border p-4 text-xs",children:[x.jsx("dl",{"aria-label":"Log delivery statistics",className:"flex flex-wrap gap-x-6 gap-y-2",children:[["Received logs",i.totalLogs],["Rolled out of history",i.evictedLogs],["Cleared from history",i.clearedLogs],["Invalid admin frames",i.invalidFrames],["Reconnects",a.reconnects]].map(([L,D])=>x.jsxs("div",{children:[x.jsx("dt",{className:"text-textMuted",children:L}),x.jsx("dd",{className:"text-textPrimary mt-1 font-mono tabular-nums",children:D.toLocaleString()})]},L))}),x.jsx("p",{className:"text-textMuted",children:"Live rows refresh every 100 ms and can skip intermediate messages on screen. Every valid log at a requested level is counted; older messages leave the 1,000-message history as new ones arrive. These counters continue while display is paused. Reconnects can leave gaps that the server does not replay."}),x.jsxs("p",{className:"text-textMuted",role:"status",children:["Admin connection: ",a.phase,a.error?` · ${a.error}`:""]})]}),x.jsxs("div",{className:"border-accent/30 bg-surface/80 flex flex-wrap gap-3 rounded-2xl border p-4",children:[x.jsxs("label",{className:"min-w-56 flex-1",children:[x.jsx("span",{className:"sr-only",children:"Search logs"}),x.jsx("input",{type:"search",value:p,onChange:L=>{g(L.target.value)},placeholder:"Search received messages…",className:"border-accent/40 bg-background text-textPrimary placeholder:text-textMuted/60 focus:border-accent w-full rounded-md border px-3 py-2 text-sm focus:ring-0"})]}),x.jsx("p",{className:"text-textMuted self-center text-xs",children:"Search filters received messages only."})]}),x.jsxs("div",{className:"border-accent/30 bg-surface/80 overflow-hidden rounded-xl border",children:[x.jsxs("div",{className:"border-accentSecondary/30 bg-accentSecondary/20 text-textMuted flex justify-between border-b px-4 py-3 text-xs",children:[x.jsx("span",{children:u?"Display paused · collection continues":l===0?"Log delivery disabled":w>0?"Viewing older rows · collection continues":"Live stream · newest first"}),x.jsxs("span",{children:[String(k.matched)," matching · ",String(k.retained)," retained"]})]}),x.jsx("div",{ref:A,role:"region","aria-label":"Scrollable log history",tabIndex:0,className:"h-[min(60vh,32rem)] min-h-32 overflow-auto",style:{overflowAnchor:"none"},onScroll:L=>{y({offset:Math.max(0,Math.floor(L.currentTarget.scrollTop/qf)-8),search:p,filter:l})},children:k.matched===0?x.jsx("p",{className:"text-textMuted px-4 py-12 text-center text-sm",children:"No matching log messages."}):x.jsx("ol",{"aria-label":"Received logs",className:"relative",style:{height:k.matched*qf},children:k.logs.map((L,D)=>x.jsx(KA,{log:L,index:k.offset+D,total:k.matched,onSelect:T},L.id))})})]}),x.jsxs("div",{className:"flex items-center justify-between gap-3 text-xs",children:[x.jsx("p",{className:"text-textMuted",children:"Select a row to read its full message."}),!u&&x.jsx("button",{type:"button",className:"text-accent hover:underline",onClick:()=>{A.current&&(A.current.scrollTop=0),y({offset:0,search:p,filter:l})},children:"Jump to latest"})]}),O&&x.jsx(GA,{log:O,onClose:()=>{T(null)}})]})}const KA=se.memo(function({log:i,index:a,total:l,onSelect:u}){return x.jsx("li",{"aria-setsize":l,"aria-posinset":a+1,className:"border-accentSecondary/20 absolute inset-x-0 border-b",style:{top:a*qf,height:qf},children:x.jsxs("button",{type:"button",onClick:()=>{u(i)},className:"hover:bg-accentSecondary/10 focus-visible:bg-accentSecondary/20 grid h-full w-full grid-cols-[5.5rem_4.5rem_minmax(0,1fr)] items-center gap-2 px-4 text-left text-xs sm:grid-cols-[7.5rem_7.5rem_minmax(0,1fr)]",children:[x.jsx("time",{dateTime:Qp(i.time),className:"text-textMuted font-mono tabular-nums",children:Uu(i.time,!1)}),x.jsx("span",{className:`w-fit rounded px-2 py-0.5 font-medium ${Yb[i.level]??Yb[8]}`,children:iS(i.level).name}),x.jsx("span",{className:"text-textPrimary min-w-0 truncate font-mono",children:i.message.replaceAll(` -`," ↵ ")})]})})});function GA({log:n,onClose:i}){const a=se.useRef(null);return se.useEffect(()=>{const l=a.current;return l?.showModal(),()=>{l?.close()}},[]),x.jsxs("dialog",{ref:a,onClose:i,"aria-labelledby":"log-detail-title",className:"border-accent/30 bg-surface/95 text-textPrimary fixed inset-0 m-auto max-h-[80vh] w-[min(60rem,90vw)] rounded-2xl border p-5 shadow-xl backdrop:bg-black/60",children:[x.jsxs("header",{className:"mb-4 flex items-center justify-between gap-4",children:[x.jsxs("h3",{id:"log-detail-title",className:"text-accent text-lg font-semibold",children:[iS(n.level).label," · ",Qp(n.time)??"Invalid time"]}),x.jsx("button",{type:"button",onClick:i,className:"text-accent rounded px-3 py-2",children:"Close"})]}),x.jsx("pre",{className:"text-sm break-words whitespace-pre-wrap",children:n.message})]})}const YA="Unknown",FA={bitcoin:{p2kh:{0:"mainnet (1)",111:"test networks (m, n)"},p2sh:{5:"mainnet (3)",196:"test networks (2)"},wif:{128:"mainnet (5, K, L)",239:"test networks (9, c)"},witness:{bc:"mainnet",tb:"testnet and signet",bcrt:"regtest"},silent:{sp:"mainnet",tsp:"testnet and signet",sprt:"regtest"},hdPrivate:{76066276:"mainnet (xprv)",77428856:"mainnet BIP49 (yprv)",78791436:"mainnet BIP84 (zprv)",70615956:"test networks (tprv)",71978536:"test networks BIP49 (uprv)",73341116:"test networks BIP84 (vprv)"},hdPublic:{76067358:"mainnet (xpub)",77429938:"mainnet BIP49 (ypub)",78792518:"mainnet BIP84 (zpub)",70617039:"test networks (tpub)",71979618:"test networks BIP49 (upub)",73342198:"test networks BIP84 (vpub)"}},litecoin:{p2kh:{48:"mainnet (L)",111:"test networks (m, n)"},p2sh:{5:"mainnet deprecated (3)",50:"mainnet (M)",58:"test networks (Q)",196:"test networks deprecated (2)"},wif:{176:"mainnet (6, T)",239:"test networks (9, c)"},witness:{ltc:"mainnet",tltc:"testnet",rltc:"regtest"},silent:{},hdPrivate:{76066276:"mainnet (xprv)",27106558:"mainnet (Ltpv)",28469138:"mainnet BIP49 (Mtpv)",70615956:"test networks (tprv)",70709117:"test networks (ttpv)"},hdPublic:{76067358:"mainnet (xpub)",27108450:"mainnet (Ltub)",28471030:"mainnet BIP49 (Mtub)",70617039:"test networks (tpub)",70711009:"test networks (ttub)"}}};function sS(n){return n.includes("ltc_scrypt_proof_of_work")?"litecoin":"bitcoin"}function Ia(n,i,a){return FA[n][i][String(a)]??YA}function op(){return globalThis.window?.location.origin??"http://localhost"}function Vf(n){const i=n.trim();if(!i)throw new Error("Endpoint URL is required");const a=/^[a-z][a-z\d+\-.]*:\/\//iu.test(i)?i:`http://${i}`,l=new URL(a);if(l.protocol!=="http:"&&l.protocol!=="https:")throw new Error("Endpoint must use HTTP or HTTPS"))DELIM" -R"DELIM(;return l.pathname=l.pathname.replace(/\/+$/u,"")||"/",l.search="",l.hash="",l.toString().replace(/\/$/u,"")}function QA(n){const i=new URL(Vf(n));return i.protocol=i.protocol==="https:"?"wss:":"ws:",i.pathname="/",i.search="",i.hash="",i.toString()}function JA(n,i=op()){return new URL(Vf(n)).origin===new URL(i).origin}function XA(){try{globalThis.localStorage.removeItem("libbitcoinAdminDashboardEndpoints")}catch{}return{adminUrl:Vf(op()),nativeUrl:Vf(op())}}const WA=vi({store:vi({address:Dn(),filter:Dn(),silent:hn().int().nonnegative().nullable(),turbo:Dn(),pruned:hn().int().nonnegative()}),node:vi({network:ri(),limited:Dn().optional(),blocks:Dn().optional(),witness:Dn().optional(),filters:Dn().optional(),privacy:Dn().optional()}),wallet:vi({p2kh:hn().int(),p2sh:hn().int(),wif:hn().int(),witness:ri(),silent:ri(),hd_private:hn().int(),hd_public:hn().int()}).optional(),network:vi({relay:Dn(),alert:Dn(),reject:Dn(),compact:Dn(),address:Dn(),witness_tx:Dn(),memory_pool:Dn(),not_found:Dn(),protocol_maximum:hn().int(),protocol_minimum:hn().int()}).optional(),forks:cA(ri(),Dn()).transform(n=>Object.keys(n).filter(i=>n[i]))}),e3=vi({height:hn().int().nonnegative(),timestamp:hn().int().positive().max(4294967295)}),bf=hn().int().nonnegative().max(Number.MAX_SAFE_INTEGER),t3=vi({count:bf,virtual:bf,fee:bf,histogram:Wf(uA([hn().nonnegative(),bf]))}),n3="/v1/fees?format=json",i3=5e3,Zu=15e3,r3=hn().int().nonnegative();function Af(n,i){return new URL(i,`${n.replace(/\/+$/u,"")}/`).toString()}async function Mf(n,i){const a=await fetch(n,{headers:{Accept:"application/json"},signal:i});if(!a.ok)throw new Error(`Native API request failed with status ${String(a.status)}`);return await a.json()}async function s3(n,i){const[a,l]=await Promise.all([Mf(Af(n,"/v1/configuration?format=json"),i),Mf(Af(n,"/v1/top?format=json"),i)]),u=WA.parse(a),f=r3.parse(l),d=Date.now();let m=null;try{const p=e3.parse(await Mf(Af(n,a3(f)),i));p.height===f&&(m=p)}catch{i?.throwIfAborted()}return{configuration:u,top:f,topHeader:m,receivedAt:d}}function a3(n){return`/v1/block/height/${String(n)}/header?format=json`}async function l3(n,i){return{data:t3.parse(await Mf(Af(n,n3),i)),receivedAt:Date.now()}}const Bm=["line","area","bar"],Fb=["line","step","area"],o3=["line","step","area"],aS={"occurrence-count":{id:"occurrence-count",label:"Occurrences per bucket",description:"Number of frames observed in each one-second bucket.",unit:"occurrences",chartTypes:Bm},"occurrence-rate":{id:"occurrence-rate",label:"Occurrence rate",description:"Frames observed per second.",unit:"occurrences-per-second",chartTypes:Bm},"cumulative-occurrences":{id:"cumulative-occurrences",label:"Cumulative occurrences",description:"Running number of frames observed during this browser session.",unit:"occurrences",chartTypes:Fb},"payload-latest":{id:"payload-latest",label:"Latest value",description:"Most recently observed payload value.",unit:"count",chartTypes:o3},"payload-average":{id:"payload-average",label:"Average value",description:"Average payload value within each one-second bucket.",unit:"count",chartTypes:["line","area","bar"]},"payload-minimum":{id:"payload-minimum",label:"Minimum value",description:"Minimum payload value within each one-second bucket.",unit:"count",chartTypes:["line","step"]},"payload-maximum":{id:"payload-maximum",label:"Maximum value",description:"Maximum payload value within each one-second bucket.",unit:"count",chartTypes:["line","step"]},"payload-sum":{id:"payload-sum",label:"Value per bucket",description:"Sum of count payloads within each one-second bucket.",unit:"count",chartTypes:["line","area","bar"]},"payload-cumulative":{id:"payload-cumulative",label:"Cumulative value",description:"Running sum of count payloads during this browser session.",unit:"count",chartTypes:Fb},"payload-change-rate":{id:"payload-change-rate",label:"Height change rate",description:"Change in the latest observed height per second.",unit:"height-per-second",chartTypes:Bm}},el=["occurrence-rate","occurrence-count","cumulative-occurrences"],u3=["payload-latest","payload-maximum","payload-change-rate",...el],c3=["payload-average","payload-latest","payload-minimum","payload-maximum",...el],f3=["payload-sum","payload-cumulative","payload-latest","payload-average",...el],lS=["payload-latest","payload-average","payload-minimum","payload-maximum"],oS=[{field:"count",id:"pool:count",label:"Pool transactions",payloadKind:"transactions",description:"Current confirmable transaction count in the pool."},{field:"virtual",id:"pool:vsize",label:"Pool virtual size",payloadKind:"vbytes",description:"Total virtual size of the current pool, in vbytes."},{field:"fee",id:"pool:total_fee",label:"Pool total fees",payloadKind:"satoshis",description:"Total fees of the current pool, in satoshis."}];function Ui(n){return`event:${String(n)}`}function Gs(n){return`log:${String(n)}`}const If="native:top";function d3(n){switch(n){case"height":return"height";case"seconds":case"milliseconds":case"microseconds":return"duration";case"count":return"count";case"fee-rate":return"fee-rate";default:return"unknown"}}function h3(n){switch(n){case"height":return u3;case"duration":return c3;case"count":return f3;case"fee-rate":return[...lS,...el];default:return el}}function m3(n){switch(n){case"height":return"payload-latest";case"duration":return"payload-average";case"count":return"payload-sum";default:return"occurrence-rate"}}function uS(n){const i=mo(n),a=d3(i.valueKind);return{id:Ui(n),source:"event",sourceId:n,name:i.name,label:i.label,category:i.category,payloadKind:a,allowedMeasures:h3(a),defaultMeasure:m3(a),description:n===10?"Newly archived transactions, including compact-block recovery. Occurrences measure archival, not all received transactions. Fee rate is normalized to sat/vB.":a==="unknown"?"Payload semantics are unknown; occurrence measurements are safe.":`${i.label} event with a ${a} payload.`}}const p3=[...oS.map(n=>({id:n.id,source:"pool",sourceId:n.field,name:n.field,label:n.label,category:"pool",payloadKind:n.payloadKind,allowedMeasures:lS,defaultMeasure:"payload-latest",description:n.description})),...Hf.map(n=>uS(n.id)),...Bu.map(n=>({id:Gs(n.id),source:"log",sourceId:n.id,name:n.name,label:`${n.label} logs`,category:"logs",payloadKind:"text",allowedMeasures:el,defaultMeasure:"occurrence-rate",description:`${n.label} log message volume. Message text is not interpreted as numeric data.`})),{id:If,source:"native",sourceId:"top",name:"canonical_top",label:"Current top",category:"native",payloadKind:"height",allowedMeasures:["payload-latest","payload-maximum","payload-change-rate"],defaultMeasure:"payload-latest",description:"Canonical chain height reported by the native interface."}],Jp=p3,g3=new Map(Jp.map(n=>[n.id,n]));function cs(n){const i=g3.get(n);if(i)return i;const a=/^event:(\d+)$/u.exec(n);return a?uS(Number(a[1])):{id:n,source:"event",sourceId:-1,name:n,label:n,category:"unknown",payloadKind:"unknown",allowedMeasures:el,defaultMeasure:"occurrence-rate",description:"Unknown signal; only occurrence measurements are available."}}function Fs(n,i){const a=aS[i];if(i.startsWith("occurrence")||i==="cumulative-occurrences")return a;const l=i==="payload-change-rate"?"height-per-second":n.payloadKind==="height"?"height":n.payloadKind==="duration"?"milliseconds":n.payloadKind==="fee-rate"?"sat-per-vbyte":n.payloadKind==="transactions"||n.payloadKind==="vbytes"||n.payloadKind==="satoshis"?n.payloadKind:"count";return{...a,unit:l}}function v3(n,i){return n.allowedMeasures.includes(i)}function y3(n,i){return mo(n).valueKind==="fee-rate"?i/1e3:ZA(n,i)??i}const b3=3600*1e3,_3=1e3,S3=1e3,x3=1e3;class Qb{constructor(i){this.capacity=i,this.#e=Array.from({length:i})}capacity;#e;#t=0;#n=0;#i=null;get size(){return this.#n}push(i){const a=this.#n===this.capacity;return this.#i=null,this.#e[this.#t]=i,this.#t=(this.#t+1)%this.capacity,this.#n=Math.min(this.#n+1,this.capacity),a}clear(){this.#i=null,this.#e.fill(void 0),this.#t=0,this.#n=0}newestFir)DELIM" -R"DELIM(st(){if(this.#i)return this.#i;const i=[];for(let a=0;athis.#k;getRecentLogs=()=>this.#i.newestFirst();getRecentEvents=()=>this.#s.newestFirst();subscribe=i=>(this.#n.add(i),()=>{this.#n.delete(i)});start(){this.#O||(this.tick(),this.#O=setInterval(()=>{this.tick()},1e3))}stop(){this.#O&&(clearInterval(this.#O),this.#O=null),this.#d&&(clearTimeout(this.#d),this.#d=null)}ingest(i,a=this.#e()){const l=this.#N(a);this.#_+=1,CA(i)?this.#U(i,l):DA(i)?this.#j(i,l):UA(i)&&(this.#v+=1),this.#C()}recordInvalidFrame(){this.#w+=1,this.#C()}recordNativeTop(i,a=this.#e()){const l=this.#N(a),u=this.#a[If];u?.value===i&&l-u.time<15e3||(this.#R(If,l,i),this.#D(l),this.#C())}recordNativeFees(i,a=this.#e()){if(!Number.isFinite(a)||a=Zu||this.#M!==null&&a<=this.#M.receivedAt)return;const l=this.#N(a);this.#M={data:i,receivedAt:a};for(const u of oS)this.#R(u.id,l,i[u.field]);this.#D(l),this.#C()}clearLogs(){this.#E+=this.#i.size,this.#i.clear(),this.flush()}clearEvents(){this.#s.clear(),this.flush()}reset(){this.#i.clear(),this.#s.clear(),this.#r.clear(),this.#l={},this.#f={},this.#u={},this.#o={},this.#b={},this.#a={},this.#g={},this.#c=this.#N(this.#e()),this.#_=0,this.#m=0,this.#S=0,this.#E=0,this.#x=0,this.#v=0,this.#w=0,this.#p=null,this.#A=null,this.#M=null,this.#T=0,this.#z(this.#c),this.flush()}tick(){const i=this.#N(this.#e());this.#z(i),this.#D(i),this.#C()}flush(){this.#d&&(clearTimeout(this.#d),this.#d=null),this.#k=this.#Z();for(const i of this.#n)i()}#U(i,a){this.#m+=1,this.#p=a,this.#T+=1,this.#i.push({...i,id:this.#T,receivedAt:a})&&(this.#S+=1),this.#R(Gs(i.level),a,null)}#j(i,a){this.#x+=1,this.#A=a,this.#T+=1,this.#s.push({...i,id:this.#T,receivedAt:a}),this.#R(Ui(i.event),a,y3(i.event,i.value))}#N(i){return Number.isFinite(i)?(this.#h=Math.max(this.#h,i),this.#h):this.#h}#R(i,a,l){const u=this.#z(a);u.snapshot=null;const f=u.signals.get(i)??w3();if(f.count+=1,_f(this.#o,i,1),l!==null){f.samples+=1,f.sum+=l,f.minimum=f.minimum===null?l:Math.min(f.minimum,l),f.maximum=f.maximum===null?l:Math.max(f.maximum,l),(f.firstAt===null||a=f.lastAt)&&(f.last=l,f.lastAt=a),_f(this.#b,i,l);const d=this.#a[i];(!d||a>=d.time)&&(this.#a[i]={value:l,time:a}),this.#g[i]=Math.max(this.#g[i]??l,l)}u.signals.set(i,f)}#z(i){const a=Math.floor(i/1e3)*1e3,l=this.#r.get(a);if(l)return l;const u={time:a,signals:new Map,snapshot:null};return this.#r.set(a,u),u}#D(i){const a=i-b3;for(const[l,u]of this.#r){if(l>=a)break;for(const[f,d]of u.signals)if(_f(this.#l,f,d.count),_f(this.#f,f,d.sum),d.last!==null&&d.lastAt!==null){const m=this.#u[f];(!m||d.lastAt>=m.time)&&(this.#u[f]={value:d.last,time:d.lastAt})}this.#r.delete(l)}}#C(){!this.#t||this.#d||(this.#d=setTimeout(()=>{this.#d=null,this.flush()},_3))}#Z(){const i=[...this.#r.values()].map(a=>(a.snapshot??={time:a.time,signals:Object.fromEntries([...a.signals].map(([l,u])=>[l,{...u}]))},a.snapshot));return{now:this.#N(this.#e()),sessionStartedAt:this.#c,totalFrames:this.#_,totalLogs:this.#m,evictedLogs:this.#S,clearedLogs:this.#E,totalEvents:this.#x,totalAcks:this.#v,invalidFrames:this.#w,buckets:i,priorSignalCounts:{...this.#l},priorSignalSums:{...this.#f},priorSignalLatest:Jb(this.#u),signalTotals:{...this.#o},signalSums:{...this.#b},signalLatest:Jb(this.#a),signalMaximums:{...this.#g},recentLogs:this.#i.newestFirst(),recentEvents:this.#s.newestFirst(),lastLogAt:this.#p,lastEventAt:this.#A,poolSnapshot:this.#M}}}function z3(n,i,a,l,u=n[0]?.time??a){const f=a-l*1e3,d=f<=u,m=d?Math.floor(u/1e3)*1e3:Math.ceil(f/1e3)*1e3,p=d?u:m,g=Math.floor(a/1e3)*1e3,y=n.filter(O=>O.time>=m&&O.time<=g).reduce((O,T)=>O+(T.signals[i]?.count??0),0),w=Math.max(0,(a-p)/1e3);return w>0?y/w:0}function T3(n,i){const a=d=>z3(n.buckets,Ui(d),n.now,i,n.sessionStartedAt),l=a(2)+a(14);if(l>0)return{label:"Reorganizing",rate:l};const f=[{label:"Confirming blocks",rate:a(6)},{label:"Validating blocks",rate:a(5)},{label:"Archiving blocks",rate:a(3)},{label:"Synchronizing headers",rate:Math.max(a(0),a(1))}].reduce((d,m)=>m.rate>d.rate?m:d);return f.rate>0?f:{label:"Idle",rate:0}}const td=18,E3=600*1e3;function O3(n,i,a){if(n===null||!Number.isSafeInteger(n)||n<0||i===null||!Number.isSafeInteger(i.height)||i.height<0||i.height>n||!Number.isFinite(i.timestamp)||i.timestamp<=0||!Number.isFinite(a)||a<0)return null;const l=Math.max(0,a-i.timestamp*1e3),u=Math.max(n,i.height+Math.ceil(l/E3));return{blocksRemaining:u-n,estimatedTop:u,progress:u===0?100:n/u*100}}function Sf({label:n,value:i,detail:a,numeric:l=!0,emphasized:u=!1}){return x.jsxs("div",{className:"border-accent/30 bg-surface/80 min-w-0 space-y-2 rounded-2xl border p-5",children:[x.jsx("dt",{className:"text-accentSecondary text-xs tracking-wide uppercase",children:n}),x.jsx("dd",{className:`text-2xl font-semibold break-words ${l?"tabular-nums":""} ${u?"text-accent":"text-textPrimary"}`,children:i}),x.jsx("dd",{className:"text-textMuted text-sm break-words",children:a})]})}function N3({confirmed:n,estimate:i}){if(n===null||i===null||i.blocksRemaining<=td)return null;const a=Math.min(99.99,Math.max(0,i.progress)),l=`${a.toFixed(2)}%`;return x.jsxs("section",{className:"border-accent/30 bg-surface/80 overflow-hidden rounded-2xl border","aria-labelledby":"node-sync-progress-title",children:[x.jsxs("header",{className:"flex flex-wrap items-end justify-between gap-3 px-5 pt-5",children:[x.jsxs("div",{children:[x.jsx("p",{className:"text-accentSecondary text-xs tracking-wide uppercase",children:"Node synchronization"}),x.jsx("h2",{id:"node-sync-progress-title",className:"text-accent mt-1 text-lg font-semibold",children:"Catching up to top candidate header"})]}),x.jsx("p",{className:"text-accent text-2xl font-semibold tabular-nums",children:l})]}),x.jsx("div",{className:"px-5 pt-4",children:x.jsx("div",{role:"progressbar","aria-label":"Node synchronization progress","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Number(a.toFixed(2)),"aria-valuetext":`Approximately ${zn(i.blocksRemaining)} blocks remaining`,className:"bg-background border-accentSecondary/20 h-3 overflow-hidden rounded-full border",children:x.jsx("div",{className:"bg-accent h-full rounded-full transition-[width] duration-700",style:{width:`${String(a)}%`}})})}),x.jsxs("dl",{className:"bg-accentSecondary/10 mt-5 grid gap-px text-sm sm:grid-cols-3",children:[x.jsx(qm,{label:"Top confirmed block",value:zn(n)}),x.jsx(qm,{label:"Top candidate header",value:zn(i.estimatedTop)}),x.jsx(qm,{label:"Estimated blocks remaining",value:zn(i.blocksRemaining)})]}),x.jsx("p",{className:"bg-surface text-textMuted border-accentSecondary/20 border-t px-5 py-2 text-[11px]",children:"Estimated from the confirmed block timestamp and your browser clock, assuming one block every 10 minutes. Actual block counts may differ."})]})}function qm({label:n,value:i}){return x.jsxs("div",{className:"bg-surface px-5 py-3",children:[x.jsx("dt",{className:"text-accentSecondary text-xs tracking-wide uppercase",children:n}),x.jsx("dd",{className:"text-textPrimary mt-1 text-lg font-semibold tabular-nums",children:i})]})}const Wl=16,up=8,nd=80,A3=[300,900,3600],cp=["line","step","area","bar"],cS=["linear","compressed"],Rt=["#ffa022","#38bdf8","#34d399","#c084fc","#fb7185","#e879f9","#facc15","#60a5fa"],M3=Du(["occurrence-count","occ)DELIM" -R"DELIM(urrence-rate","cumulative-occurrences","payload-latest","payload-average","payload-minimum","payload-maximum","payload-sum","payload-cumulative","payload-change-rate"]),j3=vi({id:ri().min(1).max(100),signalId:ri().min(1).max(100),measure:M3,color:ri().regex(/^#[\da-f]{6}$/iu),label:ri().max(80).optional()}).strict(),k3=vi({id:ri().min(1).max(100),title:ri().trim().min(1).max(nd),visualization:Du(cp),scale:Du(cS).default("linear"),range:ed([Au(300),Au(900),Au(3600)]),series:Wf(j3).min(1).max(up)}).strict(),R3=vi({id:ri().min(1).max(100),title:ri().trim().min(1).max(nd),visualization:Au("histogram"),scale:Du(cS).default("linear"),color:ri().regex(/^#[\da-f]{6}$/iu)}).strict(),fS=ed([k3,R3]),C3=vi({version:Au(1),charts:Wf(fS).max(Wl)}).strict();function ln(n){return n.visualization!=="histogram"}const Xp={id:"default-sync-pipeline",title:"Sync pipeline",visualization:"line",scale:"linear",range:900,series:[Tn("sync-header",Ui(0),"occurrence-rate",Rt[3]),Tn("sync-archive",Ui(3),"occurrence-rate",Rt[0]),Tn("sync-validate",Ui(5),"occurrence-rate",Rt[1]),Tn("sync-confirm",Ui(6),"occurrence-rate",Rt[2])]},dS={id:"default-chain-progress",title:"Chain progress",visualization:"step",scale:"linear",range:900,series:[Tn("progress-top",If,"payload-latest",Rt[0]),Tn("progress-organized",Ui(13),"payload-latest",Rt[2]),Tn("progress-confirmed",Ui(6),"payload-latest",Rt[1])]},hS={id:"default-log-volume",title:"Log volume",visualization:"bar",scale:"linear",range:900,series:[Tn("logs-news",Gs(1),"occurrence-rate",Rt[2]),Tn("logs-session",Gs(2),"occurrence-rate",Rt[3]),Tn("logs-protocol",Gs(3),"occurrence-rate",Rt[1]),Tn("logs-remote",Gs(5),"occurrence-rate",Rt[7]),Tn("logs-fault",Gs(6),"occurrence-rate",Rt[4]),Tn("logs-quitting",Gs(7),"occurrence-rate",Rt[0])]},id={id:"default-pool-transactions",title:"Pool transactions",visualization:"step",scale:"linear",range:900,series:[Tn("pool-count","pool:count","payload-latest",Rt[0])]},mS={...id,id:"default-pool-fees",title:"Pool total fees",series:[Tn("pool-fees","pool:total_fee","payload-latest",Rt[3])]},pS={...id,id:"default-pool-virtual-size",title:"Pool virtual size",series:[Tn("pool-size","pool:vsize","payload-latest",Rt[1])]},Wb={id:"default-transaction-archive-rate",title:"Transactions archived / second",visualization:"line",scale:"linear",range:900,series:[Tn("tx-archived",Ui(10),"occurrence-rate",Rt[2])]},gS={id:"default-pool-fee-histogram",title:"Pool fee distribution",visualization:"histogram",scale:"linear",color:Rt[0]},vS=[{id:"pool-fee-histogram",label:"Pool fee distribution",description:"Current pool virtual size grouped by fee rate.",chart:gS},{id:"sync-pipeline",label:"Sync pipeline",description:"Header and block lifecycle throughput.",chart:Xp},{id:"chain-progress",label:"Chain progress",description:"Canonical, organized, and confirmed heights.",chart:dS},{id:"log-volume",label:"Log volume",description:"Message rates grouped by log level.",chart:hS},{id:"pool-transactions",label:"Pool transactions",description:"Current pool transaction count, sampled every five seconds.",chart:id},{id:"transaction-archive-rate",label:"Transaction archive rate",description:"Newly archived transactions per second, including compact-block recovery.",chart:Wb},{id:"pool-virtual-size",label:"Pool virtual size",description:"Current pool virtual size in vbytes.",chart:pS},{id:"pool-fees",label:"Pool total fees",description:"Total fees currently in the pool, in satoshis.",chart:mS},{id:"transaction-fee-rate",label:"Archived transaction fee rate",description:"Average fee rate of newly archived transactions, in sat/vB.",chart:{...Wb,id:"template-tx-fees",title:"Archived transaction fee rate",series:[Tn("tx-fee-rate",Ui(10),"payload-average",Rt[0])]}}],yS="libbitcoinAdminDashboardCharts";let e_=0;function Tn(n,i,a,l){return{id:n,signalId:i,measure:a,color:l}}function Mu(n){return e_+=1,`${n}-${Date.now().toString(36)}-${String(e_)}`}function Wp(n,i=!1){return ln(n)?{...n,id:i?Mu("chart"):n.id,series:n.series.map(a=>({...a,id:i?Mu("series"):a.id}))}:{...n,id:i?Mu("chart"):n.id}}function jf(){return[Xp,dS,hS,id,mS,pS,gS].map(n=>Wp(n))}function D3(n){const i=vS.find(a=>a.id===n);return Wp(i?.chart??Xp,!0)}function bS(){return{id:Mu("chart"),title:"Custom chart",visualization:"line",scale:"linear",range:900,series:[{id:Mu("series"),signalId:Ui(3),measure:"occurrence-rate",color:Rt[0]}]}}function U3(n){const i=" copy",a=`${n.title.slice(0,nd-i.length).trimEnd()}${i}`;return{...Wp(n,!0),title:a}}function fp(n){if(!ln(n))return"vbytes";const i=new Set(n.series.map(a=>Fs(cs(a.signalId),a.measure).unit));return i.size===1?[...i][0]??null:null}function _S(n){const i=fS.safeParse(n);if(!i.success)return i.error.issues[0]?.message??"Invalid chart configuration";if(!ln(n))return null;for(const a of n.series){const l=cs(a.signalId);if(!v3(l,a.measure))return`${aS[a.measure].label} is not valid for ${l.label}.`;const u=Fs(l,a.measure);if(!u.chartTypes.includes(n.visualization))return`${u.label} cannot be displayed as a ${n.visualization} chart.`}return fp(n)===null?"All series on a chart must use compatible units.":null}function SS(n){const i=C3.safeParse(n);return!i.success||new Set(i.data.charts.map(a=>a.id)).size!==i.data.charts.length||i.data.charts.some(a=>ln(a)&&new Set(a.series.map(l=>l.id)).size!==a.series.length)?null:i.data.charts.every(a=>_S(a)===null)?i.data.charts:null}function xS(){try{return globalThis.window?.localStorage??null}catch{return null}}function Z3(n=xS()){try{const i=n?.getItem(yS);return i?SS(JSON.parse(i))??jf():jf()}catch{return jf()}}function $3(n,i=xS()){try{const a={version:1,charts:n};if(!SS(a))return;i?.setItem(yS,JSON.stringify(a))}catch{}}function eg(n,i){return n.signals[i]}function t_(n,i,a,l){let u=l==="count"?n.priorSignalCounts[i]??0:n.priorSignalSums[i]??0;for(const f of n.buckets){if(f.time>=a)break;const d=eg(f,i);u+=l==="count"?d?.count??0:d?.sum??0}return u}function L3(n,i,a){let l=n.priorSignalLatest[i]??null;for(const u of n.buckets){if(u.time>=a)break;const f=eg(u,i);f?.last!==null&&f?.last!==void 0&&f.lastAt!==null&&(l={value:f.last,time:f.lastAt})}return l}function H3(n,i){const a=i<=n.sessionStartedAt?Math.floor(n.sessionStartedAt/1e3)*1e3:Math.ceil(i/1e3)*1e3,l=Math.floor(n.now/1e3)*1e3,u=new Map(n.buckets.map(d=>[d.time,d])),f=[];for(let d=a;d<=l;d+=1e3)f.push(u.get(d)??{time:d,signals:{}});return f}function B3(n,i,a){const l=Math.max(n.time,a),u=Math.min(i,n.time+1e3);return Math.max(0,(u-l)/1e3)}function q3(n,i,a,l){const u=cs(l.signalId);let f=l.measure==="cumulative-occurrences"?t_(n,l.signalId,a,"count"):l.measure==="payload-cumulative"?t_(n,l.signalId,a,"sum"):0,d=L3(n,l.signalId,a);return i.map(m=>{const p=eg(m,l.signalId);switch(l.measure){case"occurrence-count":return p?.count??0;case"occurrence-rate":{const g=B3(m,n.now,n.sessionStartedAt);return g>0?(p?.count??0)/g:0}case"cumulative-occurrences":return f+=p?.count??0,f;case"payload-sum":return p&&p.samples>0?p.sum:null;case"payload-cumulative":return f+=p?.sum??0,f;case"payload-average":return p&&p.samples>0?p.sum/p.samples:null;case"payload-minimum":return p?.minimum??null;case"payload-maximum":return p?.maximum??null;case"payload-latest":{if(p?.last!==null&&p?.last!==void 0&&p.lastAt!==null)return d={value:p.last,time:p.lastAt},p.last;if(u.source==="pool"){const g=Math.min(m.time+1e3,n.now);return d&&g-d.time0?(p.last-g.value)/b:null}}})}function V3(n,i){const a=n.now-i.range*1e3,l=H3(n,a),u=l[0]?.time??Math.floor(n.now/1e3)*1e3,f=i.series[0],d=Fs(cs(f.signalId),f.measure).unit,m=i.series.filter(p=>(n.signalTotals[p.signalId]??0)===0).map(p=>p.label??cs(p.signalId).label);return{data:[l.map(p=>p.time/1e3),..)DELIM" -R"DELIM(.i.series.map(p=>q3(n,l,u,p))],unit:d,hasObservedData:m.length{const a=()=>{i(Date.now())},l=setInterval(a,1e3);return window.addEventListener("focus",a),document.addEventListener("visibilitychange",a),()=>{clearInterval(l),window.removeEventListener("focus",a),document.removeEventListener("visibilitychange",a)}},[]),n}const K3={300:"5 minutes",900:"15 minutes",3600:"1 hour"},G3={line:"Line",step:"Step",area:"Area",bar:"Bar"};function Y3(n){return ln(n)?{...n,series:n.series.map(i=>({...i}))}:{...n}}function F3(){const n=new Map;for(const i of Jp){const a=n.get(i.category)??[];a.push(i),n.set(i.category,a)}return[...n]}const Q3=F3();function J3({chart:n,mode:i,onCancel:a,onSave:l}){const[u,f]=se.useState(()=>Y3(n)),d=_S(u),m=fp(u);se.useEffect(()=>{function T(A){A.key==="Escape"&&a()}return globalThis.addEventListener("keydown",T),()=>{globalThis.removeEventListener("keydown",T)}},[a]);const p=se.useMemo(()=>new Set(cp.filter(T=>ln(u)&&u.series.every(A=>Fs(cs(A.signalId),A.measure).chartTypes.includes(T)))),[u]);function g(T){f(A=>ln(A)?T(A):A)}function b(T,A){g(k=>({...k,series:k.series.map((L,D)=>D===T?A:L)}))}function y(T,A){if(!ln(u))return;const k=u.series[T],L=cs(A);b(T,{...k,signalId:A,measure:L.defaultMeasure})}function w(){if(!ln(u)||u.series.length>=up)return;const T=fp(u),A=Jp.find(D=>D.allowedMeasures.some(X=>T===null||Fs(D,X).unit===T));if(!A)return;const k=A.allowedMeasures.find(D=>T===null||Fs(A,D).unit===T)??A.defaultMeasure,L={id:`series-${Date.now().toString(36)}-${String(u.series.length+1)}`,signalId:A.id,measure:k,color:Rt[u.series.length%Rt.length]??Rt[0]};g(D=>({...D,series:[...D.series,L]}))}function O(T){T.preventDefault(),!d&&l({...u,title:u.title.trim()})}return x.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 p-4 backdrop-blur-sm",role:"presentation",onMouseDown:T=>{T.target===T.currentTarget&&a()},children:x.jsxs("section",{role:"dialog","aria-modal":"true","aria-labelledby":"chart-editor-title",className:"border-accent/30 bg-surface/95 max-h-[92vh] w-full max-w-4xl overflow-y-auto rounded-2xl border shadow-2xl shadow-black/60",children:[x.jsxs("header",{className:"border-accent/20 flex items-start justify-between border-b p-5",children:[x.jsxs("div",{children:[x.jsx("p",{className:"text-accentSecondary text-xs tracking-wide uppercase",children:"Dashboard builder"}),x.jsx("h2",{id:"chart-editor-title",className:"text-accent mt-1 text-xl font-semibold",children:i==="add"?"Add chart":"Edit chart"})]}),x.jsx("button",{type:"button",onClick:a,className:"text-textMuted hover:text-accent rounded p-1 text-xl","aria-label":"Close chart editor",children:"×"})]}),i==="add"&&x.jsxs("div",{className:"border-accentSecondary/20 border-b p-5",children:[x.jsx("p",{className:"text-accentSecondary mb-3 text-xs tracking-wide uppercase",children:"Start from a template"}),x.jsxs("div",{className:"grid gap-2 sm:grid-cols-2 lg:grid-cols-5",children:[vS.map(T=>x.jsxs("button",{type:"button",onClick:()=>{f(D3(T.id))},className:"border-accent/30 bg-background hover:border-accent rounded-md border p-3 text-left",children:[x.jsx("span",{className:"text-textPrimary block text-sm font-medium",children:T.label}),x.jsx("span",{className:"text-textMuted mt-1 block text-xs leading-4",children:T.description})]},T.id)),x.jsxs("button",{type:"button",onClick:()=>{f(bS())},className:"border-accent/30 bg-background hover:border-accent rounded-md border p-3 text-left",children:[x.jsx("span",{className:"text-textPrimary block text-sm font-medium",children:"Custom"}),x.jsx("span",{className:"text-textMuted mt-1 block text-xs leading-4",children:"Begin with one editable series."})]})]})]}),x.jsxs("form",{onSubmit:O,className:"space-y-6 p-5",children:[x.jsxs("div",{className:"grid gap-4 md:grid-cols-[minmax(0,1fr)_11rem_11rem]",children:[x.jsxs("label",{className:"space-y-2",children:[x.jsx("span",{className:"text-sm font-medium",children:"Chart title"}),x.jsx("input",{value:u.title,maxLength:nd,onChange:T=>{f(A=>({...A,title:T.target.value}))},className:"border-accent/40 bg-background text-textPrimary focus:border-accent w-full rounded-md border px-3 py-2 text-sm focus:ring-0"})]}),ln(u)?x.jsxs(x.Fragment,{children:[x.jsxs("label",{className:"space-y-2",children:[x.jsx("span",{className:"text-sm font-medium",children:"Chart type"}),x.jsx("select",{value:u.visualization,onChange:T=>{g(A=>({...A,visualization:T.target.value}))},className:"border-accent/40 bg-background text-textPrimary focus:border-accent w-full rounded-md border px-3 py-2 text-sm focus:ring-0",children:cp.map(T=>x.jsx("option",{value:T,disabled:!p.has(T),children:G3[T]},T))})]}),x.jsxs("label",{className:"space-y-2",children:[x.jsx("span",{className:"text-sm font-medium",children:"Time range"}),x.jsx("select",{value:u.range,onChange:T=>{g(A=>({...A,range:Number(T.target.value)}))},className:"border-accent/40 bg-background text-textPrimary focus:border-accent w-full rounded-md border px-3 py-2 text-sm focus:ring-0",children:A3.map(T=>x.jsx("option",{value:T,children:K3[T]},T))})]})]}):x.jsxs("label",{className:"space-y-2",children:[x.jsx("span",{className:"text-sm font-medium",children:"Bar color"}),x.jsx("input",{type:"color",value:u.color,onChange:T=>{const A=T.target.value;f(k=>ln(k)?k:{...k,color:A})},className:"border-accent/40 bg-background h-10 w-full rounded-md border p-1"})]})]}),ln(u)?x.jsxs("section",{className:"space-y-3",children:[x.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[x.jsxs("div",{children:[x.jsx("h3",{className:"text-accent text-lg font-semibold",children:"Series"}),x.jsxs("p",{className:"text-textMuted mt-1 text-xs",children:["One chart uses one axis unit",m===null?".":`: ${wS(m)}.`]})]}),x.jsx("button",{type:"button",onClick:w,disabled:u.series.length>=up,className:"border-accent/40 text-accent hover:border-accent hover:text-accentSecondary disabled:text-textMuted rounded-md border px-3 py-2 text-sm font-medium disabled:cursor-not-allowed disabled:opacity-50",children:"Add series"})]}),x.jsx("div",{className:"space-y-3",children:u.series.map((T,A)=>{const k=cs(T.signalId),L=Fs(k,T.measure);return x.jsxs("article",{className:"border-accentSecondary/20 bg-accent/5 grid gap-3 rounded-xl border p-4 lg:grid-cols-[minmax(12rem,1.2fr)_minmax(11rem,1fr)_minmax(9rem,0.8fr)_3.5rem_auto]",children:[x.jsxs("label",{className:"space-y-1.5",children:[x.jsxs("span",{className:"text-textMuted text-xs",children:["Signal ",String(A+1)]}),x.jsx("select",{"aria-label":`Signal ${String(A+1)}`,value:T.signalId,onChange:D=>{y(A,D.target.value)},className:"border-accent/40 bg-background text-textPrimary focus:border-accent w-full rounded-md border px-2 py-2 text-sm focus:ring-0",children:Q3.map(([D,X])=>x.jsx("optgroup",{label:D,children:X.map(G=>x.jsx("option",{value:G.id,children:G.label},G.id))},D))})]}),x.jsxs("label",{className:"space-y-1.5",children:[x.jsx("span",{className:"text-textMuted text-xs",children:"Measurement"}),x.jsx("select",{"aria-label":`Measurement ${String(A+1)}`,value:T.measure,onChange:D=>{b(A,{...T,measure:D.target.value})},className:"border-accent/40 bg-background text-textPrimary focus:border-acce)DELIM" -R"DELIM(nt w-full rounded-md border px-2 py-2 text-sm focus:ring-0",title:L.description,children:k.allowedMeasures.map(D=>x.jsx("option",{value:D,children:Fs(k,D).label},D))})]}),x.jsxs("label",{className:"space-y-1.5",children:[x.jsx("span",{className:"text-textMuted text-xs",children:"Display label"}),x.jsx("input",{"aria-label":`Display label ${String(A+1)}`,value:T.label??"",onChange:D=>{b(A,{...T,label:D.target.value||void 0})},placeholder:k.label,className:"border-accent/40 bg-background text-textPrimary placeholder:text-textMuted/50 focus:border-accent w-full rounded-md border px-2 py-2 text-sm focus:ring-0"})]}),x.jsxs("label",{className:"space-y-1.5",children:[x.jsx("span",{className:"text-textMuted text-xs",children:"Color"}),x.jsx("input",{"aria-label":`Series color ${String(A+1)}`,type:"color",value:T.color,onChange:D=>{b(A,{...T,color:D.target.value})},className:"border-accent/40 bg-background h-10 w-full rounded-md border p-1"})]}),x.jsx("button",{type:"button",onClick:()=>{g(D=>({...D,series:D.series.filter((X,G)=>G!==A)}))},disabled:u.series.length===1,"aria-label":`Remove series ${String(A+1)}`,className:"text-textMuted self-end rounded-md px-3 py-2 text-sm hover:text-red-300 disabled:cursor-not-allowed disabled:opacity-30",children:"Remove"})]},T.id)})})]}):x.jsx("p",{className:"text-textMuted text-sm",children:"Shows the latest transaction-pool fee distribution, refreshed every five seconds. Each bar shows the virtual size of one fee-rate group, labeled by its minimum fee rate in sat/vB."}),d&&x.jsx("p",{className:"rounded-md border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-sm text-amber-200",children:d}),x.jsxs("div",{className:"border-accentSecondary/20 flex justify-end gap-2 border-t pt-4",children:[x.jsx("button",{type:"button",onClick:a,className:"text-textMuted hover:text-accent rounded-md px-4 py-2 text-sm",children:"Cancel"}),x.jsx("button",{type:"submit",disabled:d!==null,className:"border-accent/40 text-accent hover:border-accent hover:text-accentSecondary rounded-md border px-3 py-2 text-sm font-medium disabled:cursor-not-allowed disabled:opacity-40",children:i==="add"?"Add chart":"Save changes"})]})]})]})})}const X3=!0,pn="u-",W3="uplot",eM=pn+"hz",tM=pn+"vt",nM=pn+"title",iM=pn+"wrap",rM=pn+"under",sM=pn+"over",aM=pn+"axis",Ya=pn+"off",lM=pn+"select",oM=pn+"cursor-x",uM=pn+"cursor-y",cM=pn+"cursor-pt",fM=pn+"legend",dM=pn+"live",hM=pn+"inline",mM=pn+"series",pM=pn+"marker",n_=pn+"label",gM=pn+"value",zu="width",Tu="height",yu="top",i_="bottom",Xl="left",Vm="right",tg="#000",r_=tg+"0",Im="mousemove",s_="mousedown",Pm="mouseup",a_="mouseenter",l_="mouseleave",o_="dblclick",vM="resize",yM="scroll",u_="change",Pf="dppxchange",ng="--",po=typeof window<"u",dp=po?document:null,no=po?window:null,bM=po?navigator:null;let rt,xf;function hp(){let n=devicePixelRatio;rt!=n&&(rt=n,xf&&pp(u_,xf,hp),xf=matchMedia(`(min-resolution: ${rt-.001}dppx) and (max-resolution: ${rt+.001}dppx)`),Xa(u_,xf,hp),no.dispatchEvent(new CustomEvent(Pf)))}function Ci(n,i){if(i!=null){let a=n.classList;!a.contains(i)&&a.add(i)}}function mp(n,i){let a=n.classList;a.contains(i)&&a.remove(i)}function Et(n,i,a){n.style[i]=a+"px"}function vr(n,i,a,l){let u=dp.createElement(n);return i!=null&&Ci(u,i),a?.insertBefore(u,l),u}function Ji(n,i){return vr("div",n,i)}const c_=new WeakMap;function Lr(n,i,a,l,u){let f="translate("+i+"px,"+a+"px)",d=c_.get(n);f!=d&&(n.style.transform=f,c_.set(n,f),i<0||a<0||i>l||a>u?Ci(n,Ya):mp(n,Ya))}const f_=new WeakMap;function d_(n,i,a){let l=i+a,u=f_.get(n);l!=u&&(f_.set(n,l),n.style.background=i,n.style.borderColor=a)}const h_=new WeakMap;function m_(n,i,a,l){let u=i+""+a,f=h_.get(n);u!=f&&(h_.set(n,u),n.style.height=a+"px",n.style.width=i+"px",n.style.marginLeft=l?-i/2+"px":0,n.style.marginTop=l?-a/2+"px":0)}const ig={passive:!0},_M={...ig,capture:!0};function Xa(n,i,a,l){i.addEventListener(n,a,l?_M:ig)}function pp(n,i,a,l){i.removeEventListener(n,a,ig)}po&&hp();function yr(n,i,a,l){let u;a=a||0,l=l||i.length-1;let f=l<=2147483647;for(;l-a>1;)u=f?a+l>>1:Zi((a+l)/2),i[u]{let f=-1,d=-1;for(let m=l;m<=u;m++)if(n(a[m])){f=m;break}for(let m=u;m>=l;m--)if(n(a[m])){d=m;break}return[f,d]}}const ES=n=>n!=null,OS=n=>n!=null&&n>0,rd=TS(ES),SM=TS(OS);function xM(n,i,a,l=0,u=!1){let f=u?SM:rd,d=u?OS:ES;[i,a]=f(n,i,a);let m=n[i],p=n[i];if(i>-1)if(l==1)m=n[i],p=n[a];else if(l==-1)m=n[a],p=n[i];else for(let g=i;g<=a;g++){let b=n[g];d(b)&&(bp&&(p=b))}return[m??_t,p??-_t]}function sd(n,i,a,l){let u=v_(n),f=v_(i);n==i&&(u==-1?(n*=a,i/=a):(n/=a,i*=a));let d=a==10?fs:NS,m=u==1?Zi:Xi,p=f==1?Xi:Zi,g=m(d(mn(n))),b=p(d(mn(i))),y=lo(a,g),w=lo(a,b);return a==10&&(g<0&&(y=St(y,-g)),b<0&&(w=St(w,-b))),l||a==2?(n=y*u,i=w*f):(n=kS(n,y),i=ad(i,w)),[n,i]}function rg(n,i,a,l){let u=sd(n,i,a,l);return n==0&&(u[0]=0),i==0&&(u[1]=0),u}const sg=.1,p_={mode:3,pad:sg},ju={pad:0,soft:null,mode:0},wM={min:ju,max:ju};function Kf(n,i,a,l){return ld(a)?g_(n,i,a):(ju.pad=a,ju.soft=l?0:null,ju.mode=l?3:0,g_(n,i,wM))}function et(n,i){return n??i}function zM(n,i,a){for(i=et(i,0),a=et(a,n.length-1);i<=a;){if(n[i]!=null)return!0;i++}return!1}function g_(n,i,a){let l=a.min,u=a.max,f=et(l.pad,0),d=et(u.pad,0),m=et(l.hard,-_t),p=et(u.hard,_t),g=et(l.soft,_t),b=et(u.soft,-_t),y=et(l.mode,0),w=et(u.mode,0),O=i-n,T=fs(O),A=si(mn(n),mn(i)),k=fs(A),L=mn(k-T);(O<1e-24||L>10)&&(O=0,(n==0||i==0)&&(O=1e-24,y==2&&g!=_t&&(f=0),w==2&&b!=-_t&&(d=0)));let D=O||A||1e3,X=fs(D),G=lo(10,Zi(X)),ee=D*(O==0?n==0?.1:1:f),V=St(kS(n-ee,G/10),24),ne=n>=g&&(y==1||y==3&&V<=g||y==2&&V>=g)?g:_t,ae=si(m,V=ne?ne:br(ne,V)),ye=D*(O==0?i==0?.1:1:d),ue=St(ad(i+ye,G/10),24),J=i<=b&&(w==1||w==3&&ue>=b||w==2&&ue<=b)?b:-_t,we=br(p,ue>J&&i<=J?J:si(J,ue));return ae==we&&ae==0&&(we=100),[ae,we]}const TM=new Intl.NumberFormat(po?bM.language:"en-US"),ag=n=>TM.format(n),$i=Math,kf=$i.PI,mn=$i.abs,Zi=$i.floor,dn=$i.round,Xi=$i.ceil,br=$i.min,si=$i.max,lo=$i.pow,v_=$i.sign,fs=$i.log10,NS=$i.log2,EM=(n,i=1)=>$i.sinh(n)*i,Km=(n,i=1)=>$i.asinh(n/i),_t=1/0;function y_(n){return(fs((n^n>>31)-(n>>31))|0)+1}function gp(n,i,a){return br(si(n,i),a)}function AS(n){return typeof n=="function"}function Qe(n){return AS(n)?n:()=>n}const OM=()=>{},MS=n=>n,jS=(n,i)=>i,NM=n=>null,b_=n=>!0,__=(n,i)=>n==i,AM=/\.\d*?(?=9{6,}|0{6,})/gm,tl=n=>{if(CS(n)||ea.has(n))return n;const i=`${n}`,a=i.match(AM);if(a==null)return n;let l=a[0].length-1;if(i.indexOf("e-")!=-1){let[u,f]=i.split("e");return+`${tl(u)}e${f}`}return St(n,l)};function Ka(n,i){return tl(St(tl(n/i))*i)}function ad(n,i){return tl(Xi(tl(n/i))*i)}function kS(n,i){return tl(Zi(tl(n/i))*i)}function St(n,i=0){if(CS(n))return n;let a=10**i,l=n*a*(1+Number.EPSILON);return dn(l)/a}const ea=new Map;function RS(n){return((""+n).split(".")[1]||"").length}function $u(n,i,a,l){let u=[],f=l.map(RS);for(let d=i;d=0?0:m)+(d>=f[g]?0:f[g]),w=n==10?b:St(b,y);u.push(w),ea.set(w,y)}}return u}const ku={},lg=[],oo=[null,null],Ys=Array.isArray,CS=Number.isInteger,MM=n=>n===void 0;function S_(n){return typeof n=="string"}function ld(n){let i=!1;if(n!=null){let a=n.constructor;i=a==null||a==Object}return i}function jM(n){return n!=null&&typeof n=="object"}const kM=Object.getPrototypeOf(Uint8Array),DS="__proto__";function uo(n,i=ld){let a;if(Ys(n)){let l=n.find(u=>u!=null);if(Ys(l)||i(l)){a=Array(n.length);for(let u=0;uf){for(u=d-1;u>=0&&n[u]==null;)n[u--]=null;for(u=d+1;ud-m)],u=l[0].length,f=new Map;for(let d=0;d"u"?n=>Promise.resolve().then(n):queueMicrotask;function LM(n){let i=n[0],a=i.length,l=Array(a);for(let f=0;fi[f]-i[d]);let u=[];for(let f=0;f=l&&n[u]==null;)u--;if(u<=l)return!0;const f=si(1,Zi((u-l+1)/i));for(let d=n[l],m=l+f;m<=u;m+=f){const p=n[m];if(p!=null){if(p<=d)return!1;d=p}}return!0}const US=["January","February","March","April","May","June","July","August","September","October","November","December"],ZS=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];function $S(n){return n.slice(0,3)}const qM=ZS.map($S),VM=US.map($S),IM={MMMM:US,MMM:VM,WWWW:ZS,WWW:qM};function bu(n){return(n<10?"0":"")+n}function PM(n){return(n<10?"00":n<100?"0":"")+n}const KM={YYYY:n=>n.getFullYear(),YY:n=>(n.getFullYear()+"").slice(2),MMMM:(n,i)=>i.MMMM[n.getMonth()],MMM:(n,i)=>i.MMM[n.getMonth()],MM:n=>bu(n.getMonth()+1),M:n=>n.getMonth()+1,DD:n=>bu(n.getDate()),D:n=>n.getDate(),WWWW:(n,i)=>i.WWWW[n.getDay()],WWW:(n,i)=>i.WWW[n.getDay()],HH:n=>bu(n.getHours()),H:n=>n.getHours(),h:n=>{let i=n.getHours();return i==0?12:i>12?i-12:i},AA:n=>n.getHours()>=12?"PM":"AM",aa:n=>n.getHours()>=12?"pm":"am",a:n=>n.getHours()>=12?"p":"a",mm:n=>bu(n.getMinutes()),m:n=>n.getMinutes(),ss:n=>bu(n.getSeconds()),s:n=>n.getSeconds(),fff:n=>PM(n.getMilliseconds())};function og(n,i){i=i||IM;let a=[],l=/\{([a-z]+)\}|[^{]+/gi,u;for(;u=l.exec(n);)a.push(u[0][0]=="{"?KM[u[1]]:u[0]);return f=>{let d="";for(let m=0;mn%1==0,Gf=[1,2,2.5,5],FM=$u(10,-32,0,Gf),HS=$u(10,0,32,Gf),QM=HS.filter(LS),Ga=FM.concat(HS),ug=` -`,BS="{YYYY}",x_=ug+BS,qS="{M}/{D}",Eu=ug+qS,wf=Eu+"/{YY}",VS="{aa}",JM="{h}:{mm}",eo=JM+VS,w_=ug+eo,z_=":{ss}",lt=null;function IS(n){let i=n*1e3,a=i*60,l=a*60,u=l*24,f=u*30,d=u*365,p=(n==1?$u(10,0,3,Gf).filter(LS):$u(10,-3,0,Gf)).concat([i,i*5,i*10,i*15,i*30,a,a*5,a*10,a*15,a*30,l,l*2,l*3,l*4,l*6,l*8,l*12,u,u*2,u*3,u*4,u*5,u*6,u*7,u*8,u*9,u*10,u*15,f,f*2,f*3,f*4,f*6,d,d*2,d*5,d*10,d*25,d*50,d*100]);const g=[[d,BS,lt,lt,lt,lt,lt,lt,1],[u*28,"{MMM}",x_,lt,lt,lt,lt,lt,1],[u,qS,x_,lt,lt,lt,lt,lt,1],[l,"{h}"+VS,wf,lt,Eu,lt,lt,lt,1],[a,eo,wf,lt,Eu,lt,lt,lt,1],[i,z_,wf+" "+eo,lt,Eu+" "+eo,lt,w_,lt,1],[n,z_+".{fff}",wf+" "+eo,lt,Eu+" "+eo,lt,w_,lt,1]];function b(y){return(w,O,T,A,k,L)=>{let D=[],X=k>=d,G=k>=f&&k=u?u:k,ue=Zi(T)-Zi(V),J=ae+ue+ad(V-ae,ye);D.push(J);let we=y(J),he=we.getHours()+we.getMinutes()/a+we.getSeconds()/l,Oe=k/l,fe=w.axes[O]._space,Q=L/fe;for(;J=St(J+k,n==1?0:3),!(J>A);)if(Oe>1){let W=Zi(St(he+Oe,6))%24,Se=y(J).getHours()-W;Se>1&&(Se=-1),J-=Se*l,he=(he+Oe)%24;let Be=D[D.length-1];St((J-Be)/k,3)*Q>=.7&&D.push(J)}else D.push(J)}return D}}return[p,g,b]}const[XM,WM,e4]=IS(1),[t4,n4,i4]=IS(.001);$u(2,-53,53,[1]);function T_(n,i){return n.map(a=>a.map((l,u)=>u==0||u==8||l==null?l:i(u==1||a[8]==0?l:a[1]+l)))}function E_(n,i){return(a,l,u,f,d)=>{let m=i.find(T=>d>=T[0])||i[i.length-1],p,g,b,y,w,O;return l.map(T=>{let A=n(T),k=A.getFullYear(),L=A.getMonth(),D=A.getDate(),X=A.getHours(),G=A.getMinutes(),ee=A.getSeconds(),V=k!=p&&m[2]||L!=g&&m[3]||D!=b&&m[4]||X!=y&&m[5]||G!=w&&m[6]||ee!=O&&m[7]||m[1];return p=k,g=L,b=D,y=X,w=G,O=ee,V(A)})}}function r4(n,i){let a=og(i);return(l,u,f,d,m)=>u.map(p=>a(n(p)))}function Gm(n,i,a){return new Date(n,i,a)}function O_(n,i){return i(n)}const s4="{YYYY}-{MM}-{DD} {h}:{mm}{aa}";function N_(n,i){return(a,l,u,f)=>f==null?ng:i(n(l))}function a4(n,i){let a=n.series[i];return a.width?a.stroke(n,i):a.points.width?a.points.stroke(n,i):null}function l4(n,i){return n.series[i].fill(n,i)}const o4={show:!0,live:!0,isolate:!1,mount:OM,markers:{show:!0,width:2,stroke:a4,fill:l4,dash:"solid"},idx:null,idxs:null,values:[]};function u4(n,i){let a=n.cursor.points,l=Ji(),u=a.size(n,i);Et(l,zu,u),Et(l,Tu,u);let f=u/-2;Et(l,"marginLeft",f),Et(l,"marginTop",f);let d=a.width(n,i,u);return d&&Et(l,"borderWidth",d),l}function c4(n,i){let a=n.series[i].points;return a._fill||a._stroke}function f4(n,i){let a=n.series[i].points;return a._stroke||a._fill}function d4(n,i){return n.series[i].points.size}const Ym=[0,0];function h4(n,i,a){return Ym[0]=i,Ym[1]=a,Ym}function zf(n,i,a,l=!0){return u=>{u.button==0&&(!l||u.target==i)&&a(u)}}function Fm(n,i,a,l=!0){return u=>{(!l||u.target==i)&&a(u)}}const m4={show:!0,x:!0,y:!0,lock:!1,move:h4,points:{one:!1,show:u4,size:d4,width:0,stroke:f4,fill:c4},bind:{mousedown:zf,mouseup:zf,click:zf,dblclick:zf,mousemove:Fm,mouseleave:Fm,mouseenter:Fm},drag:{setScale:!0,x:!0,y:!1,dist:0,uni:null,click:(n,i)=>{i.stopPropagation(),i.stopImmediatePropagation()},_x:!1,_y:!1},focus:{dist:(n,i,a,l,u)=>l-u,prox:-1,bias:0},hover:{skip:[void 0],prox:null,bias:0},left:-10,top:-10,idx:null,dataIdx:null,idxs:null,event:null},PS={show:!0,stroke:"rgba(0,0,0,0.07)",width:2},cg=an({},PS,{filter:jS}),KS=an({},cg,{size:10}),GS=an({},PS,{show:!1}),fg='12px system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"',YS="bold "+fg,FS=1.5,A_={show:!0,scale:"x",stroke:tg,space:50,gap:5,alignTo:1,size:50,labelGap:0,labelSize:30,labelFont:YS,side:2,grid:cg,ticks:KS,border:GS,font:fg,lineGap:FS,rotate:0},p4="Value",g4="Time",M_={show:!0,scale:"x",auto:!1,sorted:1,min:_t,max:-_t,idxs:[]};function v4(n,i,a,l,u){return i.map(f=>f==null?"":ag(f))}function y4(n,i,a,l,u,f,d){let m=[],p=ea.get(u)||0;a=d?a:St(ad(a,u),p);for(let g=a;g<=l;g=St(g+u,p))m.push(Object.is(g,-0)?0:g);return m}function vp(n,i,a,l,u,f,d){const m=[],p=n.scales[n.axes[i].scale].log,g=p==10?fs:NS,b=Zi(g(a));u=lo(p,b),p==10&&(u=Ga[yr(u,Ga)]);let y=a,w=u*p;p==10&&(w=Ga[yr(w,Ga)]);do m.push(y),y=y+u,p==10&&!ea.has(y)&&(y=St(y,ea.get(u))),y>=w&&(u=y,w=u*p,p==10&&(w=Ga[yr(w,Ga)]));while(y<=l);return m}function b4(n,i,a,l,u,f,d){let p=n.scales[n.axes[i].scale].asinh,g=l>p?vp(n,i,si(p,a),l,u):[p],b=l>=0&&a<=0?[0]:[];return(a<-p?vp(n,i,si(p,-l),-a,u):[p]).reverse().map(w=>-w).concat(b,g)}const QS=/./,_4=/[12357]/,S4=/[125]/,j_=/1/,yp=(n,i,a,l)=>n.map((u,f)=>i==4&&u==0||f%l==0&&a.test(u.toExponential()[u<0?1:0])?u:null);function x4(n,i,a,l,u){let f=n.axes[a],d=f.scale,m=n.scales[d],p=n.valToPos,g=f._space,b=p(10,d),y=p(9,d)-b>=g?QS:p(7,d)-b>=g?_4:p(5,d)-b>=g?S4:j_;if(y==j_){let w=mn(p(1,d)-b);if(wu,C_={show:!0,auto:!0,sorted:0,gaps:JS,alpha:1,facets:[an({},R_,{scale:"x"}),an({},R_,{scale:"y"})]},D_={scale:"y",auto:!0,sorted:0,show:!0,spanGaps:!1,gaps:JS,alpha:1,points:{show:E4,filter:null},values:null,min:_t,max:-_t,idxs:[],path:null,clip:null};function O4(n,i,a,l,u){return a/10}const XS={time:X3,auto:!0,distr:1,log:10,asinh:1,min:null,max:null,dir:1,ori:0},N4=an({},XS,{time:!1,ori:1}),U_={};function WS(n,i){let a=U_[n];return a||(a={key:n,plots:[],sub(l){a.plots.push(l)},unsub(l){a.plots=a.plots.filter(u=>u!=l)},pub(l,u,f,d,m,p,g){for(let b=0;b{let L=d.pxRound;const D=g.dir*(g.ori==0?1:-1),X=g.ori==0?go:vo;let G,ee;D==1?(G=a,ee=l):(G=l,ee=a);let V=L(y(m[G],g,A,O)),ne=L(w(p[G],b,k,T)),ae=L(y(m[ee],g,A,O)),ye=L(w(f==1?b.max:b.min,b,k,T)),ue=new Path2D(u);return X(ue,ae,ye),X(ue,V,ye),X(ue,V,ne),ue})}function od(n,i,a,l,u,f){let d=null;if(n.length>0){d=new Path2D;const m=i==0?fd:mg;let p=a;for(let y=0;yw[0]){let O=w[0]-p;O>0&&m(d,p,l,O,l+f),p=w[1]}}let g=a+u-p,b=10;g>0&&m(d,p,l-b/2,g,l+f+b)}return d}function M4(n,i,a){let l=n[n.length-1];l&&l[0]==i?l[1]=a:n.push([i,a])}function hg(n,i,a,l,u,f,d){let m=[],p=n.length;for(let g=u==1?a:l;g>=a&&g<=l;g+=u)if(i[g]===null){let y=g,w=g;if(u==1)for(;++g<=l&&i[g]===null;)w=g;else for(;--g>=a&&i[g]===null;)w=g;let O=f(n[y]),T=w==y?O:f(n[w]),A=y-u;O=d<=0&&A>=0&&A=0&&L>=0&&L=O&&m.push([O,T])}return m}function Z_(n){return n==0?MS:n==1?dn:i=>Ka(i,n)}function ex(n){let i=n==0?ud:cd,a=n==0?(u,f,d,m,p,g)=>{u.arcTo(f,d,m,p,g)}:(u,f,d,m,p,g)=>{u.arcTo(d,f,p,m,g)},l=n==0?(u,f,d,m,p)=>{u.rect(f,d,m,p)}:(u,f,d,m,p)=>{u.rect(d,f,p,m)};return(u,f,d,m,p,g=0,b=0)=>{g==0&&b==0?l(u,f,d,m,p):(g=br(g,m/2,p/2),b=br(b,m/2,p/2),i(u,f+g,d),a(u,f+m,d,f+m,d+p,g),a(u,f+m,d+p,f,d+p,b),a(u,f,d+p,f,d,b),a(u,f,d,f+m,d,g),u.closePath())}}const ud=(n,i,a)=>{n.moveTo(i,a)},cd=(n,i,a)=>{n.moveTo(a,i)},go=(n,i,a)=>{n.lineTo(i,a)},vo=(n,i,a)=>{n.lineTo(a,i)},fd=ex(0),mg=ex(1),tx=(n,i,a,l,u,f)=>{n.arc(i,a,l,u,f)},nx=(n,i,a,l,u,f)=>{n.arc(a,i,l,u,f)},ix=(n,i,a,l,u,f,d)=>{n.bezierCurveTo(i,a,l,u,f,d)},rx=(n,i,a,l,u,f,d)=>{n.bezierCurveTo(a,i,u,l,d,f)};function sx(n){return(i,a,l,u,f)=>nl(i,a,(d,m,p,g,b,y,w,O,T,A,k)=>{let{pxRound:L,points:D}=d,X,G;g.ori==0?(X=ud,G=tx):(X=cd,G=nx);const ee=St(D.width*rt,3);let V=(D.size-D.width)/2*rt,ne=St(V*2,3),ae=new Path2D,ye=new Path2D,{left:ue,top:J,width:we,height:he}=i.bbox;fd(ye,ue-ne,J-ne,we+ne*2,he+ne*2);const Oe=fe=>{if(p[fe]!=null){let Q=L(y(m[fe],g,A,O)),W=L(w(p[fe],b,k,T));X(ae,Q+V,W),G(ae,Q,W,V,0,kf*2)}};if(f)f.forEach(Oe);else for(let fe=l;fe<=u;fe++)Oe(fe);return{stroke:ee>0?ae:null,fill:ae,clip:ye,flags:co|bp}})}function ax(n){return(i,a,l,u,f,d)=>{l!=u&&(f!=l&&d!=l&&n(i,a,l),f!=u&&d!=u&&n(i,a,u),n(i,a,d))}}const j4=ax(go),k4=ax(vo);function lx(n){const i=et(n?.alignGaps,0);return(a,l,u,f)=>nl(a,l,(d,m,p,g,b,y,w,O,T,A,k)=>{[u,f]=rd(p,u,f);let L=d.pxRound,D=he=>L(y(he,g,A,O)),X=he=>L(w(he,b,k,T)),G,ee;g.ori==0?(G=go,ee=j4):(G=vo,ee=k4);const V=g.dir*(g.ori==0?1:-1),ne={stroke:new Path2D,fill:null,clip:null,band:null,gaps:null,flags:co},ae=ne.stroke;let ye=!1;if(f-u>=A*4){let he=be=>a.posToVal(be,g.key,!0),Oe=null,fe=null,Q,W,xe,Me=D(m[V==1?u:f]),Se=D(m[u]),Be=D(m[f]),Re=he(V==1?Se+1:Be-1);for(let be=V==1?u:f;be>=u&&be<=f;be+=V){let M=m[be],le=(V==1?MRe)?Me:D(M),re=p[be];le==Me?re!=null?(W=re,Oe==null?(G(ae,le,X(W)),Q=Oe=fe=W):Wfe&&(fe=W)):re===null&&(ye=!0):(Oe!=null&&ee(ae,Me,X(Oe),X(fe),X(Q),X(W)),re!=null?(W=re,G(ae,le,X(W)),Oe=fe=Q=W):(Oe=fe=null,re===null&&(ye=!0)),Me=le,Re=he(Me+V))}Oe!=null&&Oe!=fe&&xe!=Me&&ee(ae,Me,X(Oe),X(fe),X(Q),X(W))}else for(let he=V==1?u:f;he>=u&&he<=f;he+=V){let Oe=p[he];Oe===null?ye=!0:Oe!=null&&G(ae,D(m[he]),X(Oe))}let[J,we]=dg(a,l);if(d.fill!=null||J!=0){let he=ne.fill=new Path2D(ae),Oe=d.fillTo(a,l,d.min,d.max,J),fe=X(Oe),Q=D(m[u]),W=D(m[f]);V==-1&&([W,Q]=[Q,W]),G(he,W,fe),G(he,Q,fe)}if(!d.spanGaps){let he=[];ye&&he.push(...hg(m,p,u,f,V,D,i)),ne.gaps=he=d.gaps(a,l,u,f,he),ne.clip=od(he,g.ori,O,T,A,k)}return we!=0&&(ne.band=we==2?[ds(a,l,u,f,ae,-1),ds(a,l,u,f,ae,1)]:ds(a,l,u,f,ae,we)),ne})}function R4(n){const i=et(n.align,1),a=et(n.ascDesc,!1),l=et(n.alignGaps,0),u=et(n.extend,!1);return(f,d,m,p)=>nl(f,d,(g,b,y,w,O,T,A,k,L,D,X)=>{[m,p]=rd(y,m,p);let G=g.pxRound,{left:ee,width:V}=f.bbox,ne=Se=>G(T(Se,w,D,k)),ae=Se=>G(A(Se,O,X,L)),ye=w.ori==0?go:vo;const ue={stroke:new Path2D,fill:null,clip:null,band:null,gaps:null,flags:co},J=ue.stroke,we=w.dir*(w.ori==0?1:-1);let he=ae(y[we==1?m:p]),Oe=ne(b[we==1?m:p]),fe=Oe,Q=Oe;u&&i==-1&&(Q=ee,ye(J,Q,he)),ye(J,Oe,he);for(let Se=we==1?m:p;Se>=m&&Se<=p;Se+=we){let Be=y[Se];if(Be==null)continue;let Re=ne(b[Se]),be=ae(Be);i==1?ye(J,Re,he):ye(J,fe,be),ye(J,Re,be),he=be,fe=Re}let W=fe;u&&i==1&&(W=ee+V,ye(J,W,he));let[xe,Me]=dg(f,d);if(g.fill!=null||xe!=0){let Se=ue.fill=new Path2D(J),Be=g.fillTo(f,d,g.min,g.max,xe),Re=ae(Be);ye(Se,W,Re),ye(Se,Q,Re)}if(!g.spanGaps){let Se=[];Se.push(...hg(b,y,m,p,we,ne,l));let Be=g.width*rt/2,Re=a||i==1?Be:-Be,be=a||i==-1?-Be:Be;Se.forEach(M=>{M[0]+=Re,M[1]+=be}),ue.gaps=Se=g.gaps(f,d,m,p,Se),ue.clip=od(Se,w.ori,k,L,D,X)}return Me!=0&&(ue.band=Me==2?[ds(f,d,m,p,J,-1),ds(f,d,m,p,J,1)]:ds(f,d,m,p,J,Me)),ue})}function $_(n,i,a,l,u,f,d=_t){if(n.length>1){let m=null;for(let p=0,g=1/0;p{}),{fill:y,stroke:w}=g;return(O,T,A,k)=>nl(O,T,(L,D,X,G,ee,V,ne,ae,ye,ue,J)=>{let we=L.pxRound,he=a,Oe=l*rt,fe=m*rt,Q=p*rt,W,xe;G.ori==0?[W,xe]=f(O,T):[xe,W]=f(O,T);const Me=G.dir*(G.ori==0?1:-1);let Se=G.ori==0?fd:mg,Be=G.ori==0?b:(me,nt,Zt,qr,Zn,li,nr)=>{b(me,nt,Zt,Zn,qr,nr,li)},Re=et(O.bands,lg).find(me=>me.series[0]==T),be=Re!=null?Re.dir:0,M=L.fillTo(O,T,L.min,L.max,be),F=we(ne(M,ee,J,ye)),le,re,$e,Ue=ue,Ae=we(L.width*rt),pe=!1,Ne=null,Bt=null,Li=null,bi=null;y!=null&&(Ae==0||w!=null)&&(pe=!0,Ne=y.values(O,T,A,k),Bt=new Map,new Set(Ne).forEach(me=>{me!=null&&Bt.set(me,new Path2D)}),Ae>0&&(Li=w.values(O,T,A,k),bi=new Map,new Set(Li).forEach(me=>{me!=null&&bi.set(me,new Path2D)})));let{x0:En,size:Ut}=g;if(En!=null&&Ut!=null){he=1,D=En.values(O,T,A,k),En.unit==2&&(D=D.map(Zt=>O.posToVal(ae+Zt*ue,G.key,!0)));)DELIM" -R"DELIM(let me=Ut.values(O,T,A,k);Ut.unit==2?re=me[0]*ue:re=V(me[0],G,ue,ae)-V(0,G,ue,ae),Ue=$_(D,X,V,G,ue,ae,Ue),$e=Ue-re+Oe}else Ue=$_(D,X,V,G,ue,ae,Ue),$e=Ue*d+Oe,re=Ue-$e;$e<1&&($e=0),Ae>=re/2&&(Ae=0),$e<5&&(we=MS);let tt=$e>0,gn=Ue-$e-(tt?Ae:0);re=we(gp(gn,Q,fe)),le=(he==0?re/2:he==Me?0:re)-he*Me*((he==0?Oe/2:0)+(tt?Ae/2:0));const Gt={stroke:null,fill:null,clip:null,band:null,gaps:null,flags:0},In=pe?null:new Path2D;let ai=null;if(Re!=null)ai=O.data[Re.series[1]];else{let{y0:me,y1:nt}=g;me!=null&&nt!=null&&(X=nt.values(O,T,A,k),ai=me.values(O,T,A,k))}let Hi=W*re,Ce=xe*re;for(let me=Me==1?A:k;me>=A&&me<=k;me+=Me){let nt=X[me];if(nt==null)continue;if(ai!=null){let vn=ai[me]??0;if(nt-vn==0)continue;F=ne(vn,ee,J,ye)}let Zt=G.distr!=2||g!=null?D[me]:me,qr=V(Zt,G,ue,ae),Zn=ne(et(nt,M),ee,J,ye),li=we(qr-le),nr=we(si(Zn,F)),Pn=we(br(Zn,F)),Kn=nr-Pn;if(nt!=null){let vn=nt<0?Ce:Hi,Gn=nt<0?Hi:Ce;pe?(Ae>0&&Li[me]!=null&&Se(bi.get(Li[me]),li,Pn+Zi(Ae/2),re,si(0,Kn-Ae),vn,Gn),Ne[me]!=null&&Se(Bt.get(Ne[me]),li,Pn+Zi(Ae/2),re,si(0,Kn-Ae),vn,Gn)):Se(In,li,Pn+Zi(Ae/2),re,si(0,Kn-Ae),vn,Gn),Be(O,T,me,li-Ae/2,Pn,re+Ae,Kn)}}return Ae>0?Gt.stroke=pe?bi:In:pe||(Gt._fill=L.width==0?L._fill:L._stroke??L._fill,Gt.width=0),Gt.fill=pe?Bt:In,Gt})}function D4(n,i){const a=et(i?.alignGaps,0);return(l,u,f,d)=>nl(l,u,(m,p,g,b,y,w,O,T,A,k,L)=>{[f,d]=rd(g,f,d);let D=m.pxRound,X=W=>D(w(W,b,k,T)),G=W=>D(O(W,y,L,A)),ee,V,ne;b.ori==0?(ee=ud,ne=go,V=ix):(ee=cd,ne=vo,V=rx);const ae=b.dir*(b.ori==0?1:-1);let ye=X(p[ae==1?f:d]),ue=ye,J=[],we=[];for(let W=ae==1?f:d;W>=f&&W<=d;W+=ae)if(g[W]!=null){let Me=p[W],Se=X(Me);J.push(ue=Se),we.push(G(g[W]))}const he={stroke:n(J,we,ee,ne,V,D),fill:null,clip:null,band:null,gaps:null,flags:co},Oe=he.stroke;let[fe,Q]=dg(l,u);if(m.fill!=null||fe!=0){let W=he.fill=new Path2D(Oe),xe=m.fillTo(l,u,m.min,m.max,fe),Me=G(xe);ne(W,ue,Me),ne(W,ye,Me)}if(!m.spanGaps){let W=[];W.push(...hg(p,g,f,d,ae,X,a)),he.gaps=W=m.gaps(l,u,f,d,W),he.clip=od(W,b.ori,T,A,k,L)}return Q!=0&&(he.band=Q==2?[ds(l,u,f,d,Oe,-1),ds(l,u,f,d,Oe,1)]:ds(l,u,f,d,Oe,Q)),he})}function U4(n){return D4(Z4,n)}function Z4(n,i,a,l,u,f){const d=n.length;if(d<2)return null;const m=new Path2D;if(a(m,n[0],i[0]),d==2)l(m,n[1],i[1]);else{let p=Array(d),g=Array(d-1),b=Array(d-1),y=Array(d-1);for(let w=0;w0!=g[w]>0?p[w]=0:(p[w]=3*(y[w-1]+y[w])/((2*y[w]+y[w-1])/g[w-1]+(y[w]+2*y[w-1])/g[w]),isFinite(p[w])||(p[w]=0));p[d-1]=g[d-2];for(let w=0;w{on.pxRatio=rt}));const $4=lx(),L4=sx();function H_(n,i,a,l){return(l?[n[0],n[1]].concat(n.slice(2)):[n[0]].concat(n.slice(1))).map((f,d)=>Sp(f,d,i,a))}function H4(n,i){return n.map((a,l)=>l==0?{}:an({},i,a))}function Sp(n,i,a,l){return an({},i==0?a:l,n)}function ox(n,i,a){return i==null?oo:[i,a]}const B4=ox;function q4(n,i,a){return i==null?oo:Kf(i,a,sg,!0)}function ux(n,i,a,l){return i==null?oo:sd(i,a,n.scales[l].log,!1)}const V4=ux;function cx(n,i,a,l){return i==null?oo:rg(i,a,n.scales[l].log,!1)}const I4=cx;function P4(n,i,a,l,u){let f=si(y_(n),y_(i)),d=i-n,m=yr(u/l*d,a);do{let p=a[m],g=l*p/d;if(g>=u&&f+(p<5?ea.get(p):0)<=17)return[p,g]}while(++m(i=dn((a=+u)*rt))+"px"),[n,i,a]}function K4(n){n.show&&[n.font,n.labelFont].forEach(i=>{let a=St(i[2]*rt,1);i[0]=i[0].replace(/[0-9.]+px/,a+"px"),i[1]=a})}function on(n,i,a){const l={mode:et(n.mode,1)},u=l.mode;function f(v,S,z,E){let R=S.valToPct(v);return E+z*(S.dir==-1?1-R:R)}function d(v,S,z,E){let R=S.valToPct(v);return E+z*(S.dir==-1?R:1-R)}function m(v,S,z,E){return S.ori==0?f(v,S,z,E):d(v,S,z,E)}l.valToPosH=f,l.valToPosV=d;let p=!1;l.status=0;const g=l.root=Ji(W3);if(n.id!=null&&(g.id=n.id),Ci(g,n.class),n.title){let v=Ji(nM,g);v.textContent=n.title}const b=vr("canvas"),y=l.ctx=b.getContext("2d"),w=Ji(iM,g);Xa("click",w,v=>{v.target===T&&(vt!=_s||xt!=Qr)&&ht.click(l,v)},!0);const O=l.under=Ji(rM,w);w.appendChild(b);const T=l.over=Ji(sM,w);n=uo(n);const A=+et(n.pxAlign,1),k=Z_(A);(n.plugins||[]).forEach(v=>{v.opts&&(n=v.opts(l,n)||n)});const L=n.ms||.001,D=l.series=u==1?H_(n.series||[],M_,D_,!1):H4(n.series||[null],C_),X=l.axes=H_(n.axes||[],A_,k_,!0),G=l.scales={},ee=l.bands=n.bands||[];ee.forEach(v=>{v.fill=Qe(v.fill||null),v.dir=et(v.dir,-1)});const V=u==2?D[1].facets[0].scale:D[0].scale,ne={axes:dl,series:Iu},ae=(n.drawOrder||["axes","series"]).map(v=>ne[v]);function ye(v){const S=v.distr==3?z=>fs(z>0?z:v.clamp(l,z,v.min,v.max,v.key)):v.distr==4?z=>Km(z,v.asinh):v.distr==100?z=>v.fwd(z):z=>z;return z=>{let E=S(z),{_min:R,_max:H}=v,P=H-R;return(E-R)/P}}function ue(v){let S=G[v];if(S==null){let z=(n.scales||ku)[v]||ku;if(z.from!=null){ue(z.from);let E=an({},G[z.from],z,{key:v});E.valToPct=ye(E),G[v]=E}else{S=G[v]=an({},v==V?XS:N4,z),S.key=v;let E=S.time,R=S.range,H=Ys(R);if((v!=V||u==2&&!E)&&(H&&(R[0]==null||R[1]==null)&&(R={min:R[0]==null?p_:{mode:1,hard:R[0],soft:R[0]},max:R[1]==null?p_:{mode:1,hard:R[1],soft:R[1]}},H=!1),!H&&ld(R))){let P=R;R=(te,ie,ce)=>ie==null?oo:Kf(ie,ce,P)}S.range=Qe(R||(E?B4:v==V?S.distr==3?V4:S.distr==4?I4:ox:S.distr==3?ux:S.distr==4?cx:q4)),S.auto=Qe(H?!1:S.auto),S.clamp=Qe(S.clamp||O4),S._min=S._max=null,S.valToPct=ye(S)}}}ue("x"),ue("y"),u==1&&D.forEach(v=>{ue(v.scale)}),X.forEach(v=>{ue(v.scale)});for(let v in n.scales)ue(v);const J=G[V],we=J.distr;let he,Oe;J.ori==0?(Ci(g,eM),he=f,Oe=d):(Ci(g,tM),he=d,Oe=f);const fe={};for(let v in G){let S=G[v];(S.min!=null||S.max!=null)&&(fe[v]={min:S.min,max:S.max},S.min=S.max=null)}const Q=n.tzDate||(v=>new Date(dn(v/L))),W=n.fmtDate||og,xe=L==1?e4(Q):i4(Q),Me=E_(Q,T_(L==1?WM:n4,W)),Se=N_(Q,O_(s4,W)),Be=[],Re=l.legend=an({},o4,n.legend),be=l.cursor=an({},m4,{drag:{y:u==2}},n.cursor),M=Re.show,F=be.show,le=Re.markers;Re.idxs=Be,le.width=Qe(le.width),le.dash=Qe(le.dash),le.stroke=Qe(le.stroke),le.fill=Qe(le.fill);let re,$e,Ue,Ae=[],pe=[],Ne,Bt=!1,Li={};if(Re.live){const v=D[1]?D[1].values:null;Bt=v!=null,Ne=Bt?v(l,1,0):{_:0};for(let S in Ne)Li[S]=ng}if(M)if(re=vr("table",fM,g),Ue=vr("tbody",null,re),Re.mount(l,re),Bt){$e=vr("thead",null,re,Ue);let v=vr("tr",null,$e);vr("th",null,v);for(var bi in Ne)vr("th",n_,v).textContent=bi}else Ci(re,hM),Re.live&&Ci(re,dM);const En={show:!0},Ut={show:!1};function tt(v,S){if(S==0&&(Bt||!Re.live||u==2))return oo;let z=[],E=vr("tr",mM,Ue,Ue.childNodes[S]);Ci(E,v.class),v.show||Ci(E,Ya);let R=vr("th",null,E);if(le.show){let te=Ji(pM,R);if(S>0){let ie=le.width(l,S);ie&&(te.style.border=ie+"px "+le.dash(l,S)+" "+le.stroke(l,S)),te.style.background=le.fill(l,S)}}let H=Ji(n_,R);v.label instanceof HTMLElement?H.appendChild(v.label):H.textContent=v.label,S>0&&(le.show||(H.style.color=v.width>0?le.stroke(l,S):le.fill(l,S)),Gt("click",R,te=>{if(be._lock)return;Ft(te);let ie=D.indexOf(v);if((te.ctrlKey||te.metaKey)!=Re.isolate){let ce=D.some((de,ge)=>ge>0&&ge!=ie&&de.show);D.forEach((de,ge)=>{ge>0&&Ln(ge,ce?ge==ie?En:Ut:En,!0,$t.setSeries)})}else Ln(ie,{show:!v.show},!0,$t.setSeries)},!1),ps&&Gt(a_,R,te=>{be._lock||(Ft(te),Ln(D.indexOf(v),lr,!0,$t.setSeries))},!1));for(var P in Ne){let te=vr("td",gM,E);te.textContent="--",z.push(te)}return[E,z]}const gn=new Map;function Gt(v,S,z,E=!0){const R=gn.get(S)||{},H=be.bind[v](l,S,z,E);H&&(Xa(v,S,R[v]=H),gn.set(S,R))}function In(v,S,z){const E=gn.get(S)||{};for(let R in E)(v==null||R==v)&&(pp(R,S,E[R]),delete E[R]);v==null&&gn.delete(S)}let ai=0,Hi=0,Ce=0,me=0,nt=0,Zt=0,qr=nt,Zn=Zt,li=Ce,nr=me,Pn=0,Kn=0,vn=0,Gn=0;l.bbox={};let ia=!1,il=!1,ms=!1,Yt=!1,rl=!1,Yn=!1;function sl(v,S,z){(z||v!=l.width||S!=l.height)&&ra(v,S),$n(!1),ms=!0,il=!0,Gr()}function ra(v,S){l.width=ai=Ce=v,l.height=Hi=me=S,nt=Zt=0,md(),sa();let z=l.bbox;Pn=z.left=Ka(nt*rt,.5),Kn=z.top=Ka(Zt*rt,.5),vn=z.width=Ka(Ce*rt)DELIM" -R"DELIM(,.5),Gn=z.height=Ka(me*rt,.5)}const dd=3;function Vu(){let v=!1,S=0;for(;!v;){S++;let z=Pu(S),E=fl(S);v=S==dd||z&&E,v||(ra(l.width,l.height),il=!0)}}function hd({width:v,height:S}){sl(v,S)}l.setSize=hd;function md(){let v=!1,S=!1,z=!1,E=!1;X.forEach((R,H)=>{if(R.show&&R._show){let{side:P,_size:te}=R,ie=P%2,ce=R.label!=null?R.labelSize:0,de=te+ce;de>0&&(ie?(Ce-=de,P==3?(nt+=de,E=!0):z=!0):(me-=de,P==0?(Zt+=de,v=!0):S=!0))}}),xr[0]=v,xr[1]=z,xr[2]=S,xr[3]=E,Ce-=ui[1]+ui[3],nt+=ui[3],me-=ui[2]+ui[0],Zt+=ui[0]}function sa(){let v=nt+Ce,S=Zt+me,z=nt,E=Zt;function R(H,P){switch(H){case 1:return v+=P,v-P;case 2:return S+=P,S-P;case 3:return z-=P,z+P;case 0:return E-=P,E+P}}X.forEach((H,P)=>{if(H.show&&H._show){let te=H.side;H._pos=R(te,H._size),H.label!=null&&(H._lpos=R(te,H.labelSize))}})}if(be.dataIdx==null){let v=be.hover,S=v.skip=new Set(v.skip??[]);S.add(void 0);let z=v.prox=Qe(v.prox),E=v.bias??=0;be.dataIdx=(R,H,P,te)=>{if(H==0)return P;let ie=P,ce=z(R,H,P,te)??_t,de=ce>=0&&ce<_t,ge=J.ori==0?Ce:me,De=be.left,Ie=i[0],Je=i[H];if(S.has(Je[P])){ie=null;let qe=null,je=null,ze;if(E==0||E==-1)for(ze=P;qe==null&&ze-- >0;)S.has(Je[ze])||(qe=ze);if(E==0||E==1)for(ze=P;je==null&&ze++ce&&(ie=null);return ie}}const Ft=v=>{be.event=v};be.idxs=Be,be._lock=!1;let Tt=be.points;Tt.show=Qe(Tt.show),Tt.size=Qe(Tt.size),Tt.stroke=Qe(Tt.stroke),Tt.width=Qe(Tt.width),Tt.fill=Qe(Tt.fill);const Nt=l.focus=an({},n.focus||{alpha:.3},be.focus),ps=Nt.prox>=0,gs=ps&&Tt.one;let oi=[],ir=[],rr=[];function aa(v,S){let z=Tt.show(l,S);if(z instanceof HTMLElement)return Ci(z,cM),Ci(z,v.class),Lr(z,-10,-10,Ce,me),T.insertBefore(z,oi[S]),z}function Sr(v,S){if(u==1||S>0){let z=u==1&&G[v.scale].time,E=v.value;v.value=z?S_(E)?N_(Q,O_(E,W)):E||Se:E||z4,v.label=v.label||(z?g4:p4)}if(gs||S>0){v.width=v.width==null?1:v.width,v.paths=v.paths||$4||NM,v.fillTo=Qe(v.fillTo||A4),v.pxAlign=+et(v.pxAlign,A),v.pxRound=Z_(v.pxAlign),v.stroke=Qe(v.stroke||null),v.fill=Qe(v.fill||null),v._stroke=v._fill=v._paths=v._focus=null;let z=T4(si(1,v.width),1),E=v.points=an({},{size:z,width:si(1,z*.2),stroke:v.stroke,space:z*2,paths:L4,_stroke:null,_fill:null},v.points);E.show=Qe(E.show),E.filter=Qe(E.filter),E.fill=Qe(E.fill),E.stroke=Qe(E.stroke),E.paths=Qe(E.paths),E.pxAlign=v.pxAlign}if(M){let z=tt(v,S);Ae.splice(S,0,z[0]),pe.splice(S,0,z[1]),Re.values.push(null)}if(F){Be.splice(S,0,null);let z=null;gs?S==0&&(z=aa(v,S)):S>0&&(z=aa(v,S)),oi.splice(S,0,z),ir.splice(S,0,0),rr.splice(S,0,0)}en("addSeries",S)}function al(v,S){S=S??D.length,v=u==1?Sp(v,S,M_,D_):Sp(v,S,{},C_),D.splice(S,0,v),Sr(D[S],S)}l.addSeries=al;function la(v){if(D.splice(v,1),M){Re.values.splice(v,1),pe.splice(v,1);let S=Ae.splice(v,1)[0];In(null,S.firstChild),S.remove()}F&&(Be.splice(v,1),oi.splice(v,1)[0].remove(),ir.splice(v,1),rr.splice(v,1)),en("delSeries",v)}l.delSeries=la;const xr=[!1,!1,!1,!1];function pd(v,S){if(v._show=v.show,v.show){let z=v.side%2,E=G[v.scale];E==null&&(v.scale=z?D[1].scale:V,E=G[v.scale]);let R=E.time;v.size=Qe(v.size),v.space=Qe(v.space),v.rotate=Qe(v.rotate),Ys(v.incrs)&&v.incrs.forEach(P=>{!ea.has(P)&&ea.set(P,RS(P))}),v.incrs=Qe(v.incrs||(E.distr==2?QM:R?L==1?XM:t4:Ga)),v.splits=Qe(v.splits||(R&&E.distr==1?xe:E.distr==3?vp:E.distr==4?b4:y4)),v.stroke=Qe(v.stroke),v.grid.stroke=Qe(v.grid.stroke),v.ticks.stroke=Qe(v.ticks.stroke),v.border.stroke=Qe(v.border.stroke);let H=v.values;v.values=Ys(H)&&!Ys(H[0])?Qe(H):R?Ys(H)?E_(Q,T_(H,W)):S_(H)?r4(Q,H):H||Me:H||v4,v.filter=Qe(v.filter||(E.distr>=3&&E.log==10?x4:E.distr==3&&E.log==2?w4:jS)),v.font=B_(v.font),v.labelFont=B_(v.labelFont),v._size=v.size(l,null,S,0),v._space=v._rotate=v._incrs=v._found=v._splits=v._values=null,v._size>0&&(xr[S]=!0,v._el=Ji(aM,w))}}function vs(v,S,z,E){let[R,H,P,te]=z,ie=S%2,ce=0;return ie==0&&(te||H)&&(ce=S==0&&!R||S==2&&!P?dn(A_.size/3):0),ie==1&&(R||P)&&(ce=S==1&&!H||S==3&&!te?dn(k_.size/2):0),ce}const ll=l.padding=(n.padding||[vs,vs,vs,vs]).map(v=>Qe(et(v,vs))),ui=l._padding=ll.map((v,S)=>v(l,S,xr,0));let un,Qt=null,Jt=null;const oa=u==1?D[0].idxs:null;let Fn=null,Vr=!1;function yo(v,S){if(i=v??[],l.data=l._data=i,u==2){un=0;for(let z=1;z=0,Yn=!0,Gr()}}l.setData=yo;function ol(){Vr=!0;let v,S;u==1&&(un>0?(Qt=oa[0]=0,Jt=oa[1]=un-1,v=i[0][Qt],S=i[0][Jt],we==2?(v=Qt,S=Jt):v==S&&(we==3?[v,S]=sd(v,v,J.log,!1):we==4?[v,S]=rg(v,v,J.log,!1):J.time?S=v+dn(86400/L):[v,S]=Kf(v,S,sg,!0))):(Qt=oa[0]=v=null,Jt=oa[1]=S=null)),sr(V,v,S)}let ci,At,yn,wr,ul,bo,_o,cl,Ir,cn;function ua(v,S,z,E,R,H){v??=r_,z??=lg,E??="butt",R??=r_,H??="round",v!=ci&&(y.strokeStyle=ci=v),R!=At&&(y.fillStyle=At=R),S!=yn&&(y.lineWidth=yn=S),H!=ul&&(y.lineJoin=ul=H),E!=bo&&(y.lineCap=bo=E),z!=wr&&y.setLineDash(wr=z)}function zr(v,S,z,E){S!=At&&(y.fillStyle=At=S),v!=_o&&(y.font=_o=v),z!=cl&&(y.textAlign=cl=z),E!=Ir&&(y.textBaseline=Ir=E)}function Tr(v,S,z,E,R=0){if(E.length>0&&v.auto(l,Vr)&&(S==null||S.min==null)){let H=et(Qt,0),P=et(Jt,E.length-1),te=z.min==null?xM(E,H,P,R,v.distr==3):[z.min,z.max];v.min=br(v.min,z.min=te[0]),v.max=si(v.max,z.max=te[1])}}const ys={min:null,max:null};function bs(){for(let E in G){let R=G[E];fe[E]==null&&(R.min==null||fe[V]!=null&&R.auto(l,Vr))&&(fe[E]=ys)}for(let E in G){let R=G[E];fe[E]==null&&R.from!=null&&fe[R.from]!=null&&(fe[E]=ys)}fe[V]!=null&&$n(!0);let v={};for(let E in fe){let R=fe[E];if(R!=null){let H=v[E]=uo(G[E],jM);if(R.min!=null)an(H,R);else if(E!=V||u==2)if(un==0&&H.from==null){let P=H.range(l,null,null,E);H.min=P[0],H.max=P[1]}else H.min=_t,H.max=-_t}}if(un>0){D.forEach((E,R)=>{if(u==1){let H=E.scale,P=fe[H];if(P==null)return;let te=v[H];if(R==0){let ie=te.range(l,te.min,te.max,H);te.min=ie[0],te.max=ie[1],Qt=yr(te.min,i[0]),Jt=yr(te.max,i[0]),Jt-Qt>1&&(i[0][Qt]te.max&&Jt--),E.min=Fn[Qt],E.max=Fn[Jt]}else E.show&&E.auto&&Tr(te,P,E,i[R],E.sorted);E.idxs[0]=Qt,E.idxs[1]=Jt}else if(R>0&&E.show&&E.auto){let[H,P]=E.facets,te=H.scale,ie=P.scale,[ce,de]=i[R],ge=v[te],De=v[ie];ge!=null&&Tr(ge,fe[te],H,ce,H.sorted),De!=null&&Tr(De,fe[ie],P,de,P.sorted),E.min=P.min,E.max=P.max}});for(let E in v){let R=v[E],H=fe[E];if(R.from==null&&(H==null||H.min==null)){let P=R.range(l,R.min==_t?null:R.min,R.max==-_t?null:R.max,E);R.min=P[0],R.max=P[1]}}}for(let E in v){let R=v[E];if(R.from!=null){let H=v[R.from];if(H.min==null)R.min=R.max=null;else{let P=R.range(l,H.min,H.max,E);R.min=P[0],R.max=P[1]}}}let S={},z=!1;for(let E in v){let R=v[E],H=G[E];if(H.min!=R.min||H.max!=R.max){H.min=R.min,H.max=R.max;let P=H.distr;H._min=P==3?fs(H.min):P==4?Km(H.min,H.asinh):P==100?H.fwd(H.min):H.min,H._max=P==3?fs(H.max):P==4?Km(H.max,H.asinh):P==100?H.fwd(H.max):H.max,S[E]=z=!0}}if(z){D.forEach((E,R)=>{u==2?R>0&&S.y&&(E._paths=null):S[E.scale]&&(E._paths=null)});for(let E in S)ms=!0,en("setScale",E);F&&be.left>=0&&(Yt=Yn=!0)}for(let E in fe)fe[E]=null}function Wt(v){let S=gp(Qt-1,0,un-1),z=gp(Jt+1,0,un-1);for(;v[S]==null&&S>0;)S--;for(;v[z]==null&&z0){let v=D.some(S=>S._focus)&&cn!=Nt.alpha;v&&(y.globalAlpha=cn=Nt.alpha),D.forEach((S,z)=>{if(z>0&&S.show&&(So(z,!1),So(z,!0),S._paths==null)){let E=cn;cn!=S.alpha&&(y.globalAlpha=cn=S.alpha);let R=u==2?[0,i[z][0].length-1]:Wt(i[z]);S._paths=S.paths(l,z,R[0],R[1]),cn!=E&&(y.globalAlpha=cn=E)}}),D.forEach((S,z)=>{if(z>0&&S.show){let E=cn;cn!=S.alpha&&(y.globalAlpha=cn=S.alpha),S._paths!=null&&xo(z,!1);{let R=S._paths!=null?S._paths.gaps:null,H=S.points.show(l,z,Qt,Jt,R),P=S.points.filter(l,z,H,R);(H)DELIM" -R"DELIM(||P)&&(S.points._paths=S.points.paths(l,z,Qt,Jt,P),xo(z,!0))}cn!=E&&(y.globalAlpha=cn=E),en("drawSeries",z)}}),v&&(y.globalAlpha=cn=1)}}function So(v,S){let z=S?D[v].points:D[v];z._stroke=z.stroke(l,v),z._fill=z.fill(l,v)}function xo(v,S){let z=S?D[v].points:D[v],{stroke:E,fill:R,clip:H,flags:P,_stroke:te=z._stroke,_fill:ie=z._fill,_width:ce=z.width}=z._paths;ce=St(ce*rt,3);let de=null,ge=ce%2/2;S&&ie==null&&(ie=ce>0?"#fff":te);let De=z.pxAlign==1&&ge>0;if(De&&y.translate(ge,ge),!S){let Ie=Pn-ce/2,Je=Kn-ce/2,qe=vn+ce,je=Gn+ce;de=new Path2D,de.rect(Ie,Je,qe,je)}S?wo(te,ce,z.dash,z.cap,ie,E,R,P,H):Pr(v,te,ce,z.dash,z.cap,ie,E,R,P,de,H),De&&y.translate(-ge,-ge)}function Pr(v,S,z,E,R,H,P,te,ie,ce,de){let ge=!1;ie!=0&&ee.forEach((De,Ie)=>{if(De.series[0]==v){let Je=D[De.series[1]],qe=i[De.series[1]],je=(Je._paths||ku).band;Ys(je)&&(je=De.dir==1?je[0]:je[1]);let ze,mt=null;Je.show&&je&&zM(qe,Qt,Jt)?(mt=De.fill(l,Ie)||H,ze=Je._paths.clip):je=null,wo(S,z,E,R,mt,P,te,ie,ce,de,ze,je),ge=!0}}),ge||wo(S,z,E,R,H,P,te,ie,ce,de)}const Kr=co|bp;function wo(v,S,z,E,R,H,P,te,ie,ce,de,ge){ua(v,S,z,E,R),(ie||ce||ge)&&(y.save(),ie&&y.clip(ie),ce&&y.clip(ce)),ge?(te&Kr)==Kr?(y.clip(ge),de&&y.clip(de),fa(R,P),ca(v,H,S)):te&bp?(fa(R,P),y.clip(ge),ca(v,H,S)):te&co&&(y.save(),y.clip(ge),de&&y.clip(de),fa(R,P),y.restore(),ca(v,H,S)):(fa(R,P),ca(v,H,S)),(ie||ce||ge)&&y.restore()}function ca(v,S,z){z>0&&(S instanceof Map?S.forEach((E,R)=>{y.strokeStyle=ci=R,y.stroke(E)}):S!=null&&v&&y.stroke(S))}function fa(v,S){S instanceof Map?S.forEach((z,E)=>{y.fillStyle=At=E,y.fill(z)}):S!=null&&v&&y.fill(S)}function gd(v,S,z,E){let R=X[v],H;if(E<=0)H=[0,0];else{let P=R._space=R.space(l,v,S,z,E),te=R._incrs=R.incrs(l,v,S,z,E,P);H=P4(S,z,te,E,P)}return R._found=H}function Ge(v,S,z,E,R,H,P,te,ie,ce){let de=P%2/2;A==1&&y.translate(de,de),ua(te,P,ie,ce,te),y.beginPath();let ge,De,Ie,Je,qe=R+(E==0||E==3?-H:H);z==0?(De=R,Je=qe):(ge=R,Ie=qe);for(let je=0;je{if(!z.show)return;let R=G[z.scale];if(R.min==null){z._show&&(S=!1,z._show=!1,$n(!1));return}else z._show||(S=!1,z._show=!0,$n(!1));let H=z.side,P=H%2,{min:te,max:ie}=R,[ce,de]=gd(E,te,ie,P==0?Ce:me);if(de==0)return;let ge=R.distr==2,De=z._splits=z.splits(l,E,te,ie,ce,de,ge),Ie=R.distr==2?De.map(ze=>Fn[ze]):De,Je=R.distr==2?Fn[De[1]]-Fn[De[0]]:ce,qe=z._values=z.values(l,z.filter(l,Ie,E,de,Je),E,de,Je);z._rotate=H==2?z.rotate(l,qe,E,de):0;let je=z._size;z._size=Xi(z.size(l,qe,E,v)),je!=null&&z._size!=je&&(S=!1)}),S}function fl(v){let S=!0;return ll.forEach((z,E)=>{let R=z(l,E,xr,v);R!=ui[E]&&(S=!1),ui[E]=R}),S}function dl(){for(let v=0;vFn[Nn]):Ie,qe=de.distr==2?Fn[Ie[1]]-Fn[Ie[0]]:ie,je=S.ticks,ze=S.border,mt=je.show?je.size:0,pt=dn(mt*rt),Mt=dn((S.alignTo==2?S._size-mt-S.gap:S.gap)*rt),st=S._rotate*-kf/180,yt=k(S._pos*rt),Hn=(pt+Mt)*te,_n=yt+Hn;H=E==0?_n:0,R=E==1?_n:0;let Bn=S.font[0],Jn=S.align==1?Xl:S.align==2?Vm:st>0?Xl:st<0?Vm:E==0?"center":z==3?Vm:Xl,Ei=st||E==1?"middle":z==2?yu:i_;zr(Bn,P,Jn,Ei);let qn=S.font[1]*S.lineGap,Xn=Ie.map(Nn=>k(m(Nn,de,ge,De))),Oi=S._values;for(let Nn=0;Nn{z>0&&(S._paths=null,v&&(u==1?(S.min=null,S.max=null):S.facets.forEach(E=>{E.min=null,E.max=null})))})}let bn=!1,hl=!1,da=[];function zo(){hl=!1;for(let v=0;v0&&queueMicrotask(zo)}l.batch=vd;function Qn(){if(ia&&(bs(),ia=!1),ms&&(Vu(),ms=!1),il){if(Et(O,Xl,nt),Et(O,yu,Zt),Et(O,zu,Ce),Et(O,Tu,me),Et(T,Xl,nt),Et(T,yu,Zt),Et(T,zu,Ce),Et(T,Tu,me),Et(w,zu,ai),Et(w,Tu,Hi),b.width=dn(ai*rt),b.height=dn(Hi*rt),X.forEach(({_el:v,_show:S,_size:z,_pos:E,side:R})=>{if(v!=null)if(S){let H=R===3||R===0?z:0,P=R%2==1;Et(v,P?"left":"top",E-H),Et(v,P?"width":"height",z),Et(v,P?"top":"left",P?Zt:nt),Et(v,P?"height":"width",P?me:Ce),mp(v,Ya)}else Ci(v,Ya)}),ci=At=yn=ul=bo=_o=cl=Ir=wr=null,cn=1,Sa(!0),nt!=qr||Zt!=Zn||Ce!=li||me!=nr){$n(!1);let v=Ce/li,S=me/nr;if(F&&!Yt&&be.left>=0){be.left*=v,be.top*=S,_i&&Lr(_i,dn(be.left),0,Ce,me),Yr&&Lr(Yr,0,dn(be.top),Ce,me);for(let z=0;z=0&&We.width>0){We.left*=v,We.width*=v,We.top*=S,We.height*=S;for(let z in xa)Et(xi,z,We[z])}qr=nt,Zn=Zt,li=Ce,nr=me}en("setSize"),il=!1}ai>0&&Hi>0&&(y.clearRect(0,0,b.width,b.height),en("drawClear"),ae.forEach(v=>v()),en("draw")),We.show&&rl&&(pa(We),rl=!1),F&&Yt&&(Bi(null,!0,!1),Yt=!1),Re.show&&Re.live&&Yn&&(ba(),Yn=!1),p||(p=!0,l.status=1,en("ready")),Vr=!1,bn=!1}l.redraw=(v,S)=>{ms=S||!1,v!==!1?sr(V,J.min,J.max):Gr()};function ha(v,S){let z=G[v];if(z.from==null){if(un==0){let E=z.range(l,S.min,S.max,v);S.min=E[0],S.max=E[1]}if(S.min>S.max){let E=S.min;S.min=S.max,S.max=E}if(un>1&&S.min!=null&&S.max!=null&&S.max-S.min<1e-16)return;v==V&&z.distr==2&&un>0&&(S.min=yr(S.min,i[0]),S.max=yr(S.max,i[0]),S.min==S.max&&S.max++),fe[v]=S,ia=!0,Gr()}}l.setScale=ha;let ml,ma,_i,Yr,To,Fr,_s,Qr,Eo,pl,vt,xt,Si=!1;const ht=be.drag;let qt=ht.x,Vt=ht.y;F&&(be.x&&(ml=Ji(oM,T)),be.y&&(ma=Ji(uM,T)),J.ori==0?(_i=ml,Yr=ma):(_i=ma,Yr=ml),vt=be.left,xt=be.top);const We=l.select=an({show:!0,over:!0,left:0,width:0,top:0,height:0},n.select),xi=We.show?Ji(lM,We.over?T:O):null;function pa(v,S){if(We.show){for(let z in v)We[z]=v[z],z in xa&&Et(xi,z,v[z]);S!==!1&&en("setSelect")}}l.setSelect=pa;function Oo(v){if(D[v].show)M&&mp(Ae[v],Ya);else if(M&&Ci(Ae[v],Ya),F){let z=gs?oi[0]:oi[v];z!=null&&Lr(z,-10,-10,Ce,me)}}function sr(v,S,z){ha(v,{min:S,max:z})}function Ln(v,S,z,E){S.focus!=null&&gl(v),S.show!=null&&D.forEach((R,H)=>{H>0&&(v==H||v==null)&&(R.show=S.show,Oo(H),u==2?(sr(R.facets[0].scale,null,null),sr(R.facets[1].scale,null,null)):sr(R.scale,null,null),Gr())}),z!==!1&&en("setSeries",v,S),E&&wa("setSeries",l,v,S)}l.setSeries=Ln;function ar(v,S){an(ee[v],S)}function No(v,S){v.fill=Qe(v.fill||null),v.dir=et(v.dir,-1),S=S??ee.length,ee.splice(S,0,v)}function ga(v){v==null?ee.length=0:ee.splice(v,1)}l.addBand=No,l.setBand=ar,l.delBand=ga;function Er(v,S){D[v].alpha=S,F&&oi[v]!=null&&(oi[v].style.opacity=S),M&&Ae[v]&&(Ae[v].style.opacity=S)}let wi,zi,Or;const lr={focus:!0};function gl(v){if(v!=Or){let S=v==null,z=Nt.alpha!=1;D.forEach((E,R)=>{if(u==1||R>0){let H=S||R==0||R==v;E._focus=S?null:H,z&&Er(R,H?1:Nt.alpha)}}),Or=v,z&&Gr()}}M&&ps&&Gt(l_,re,v=>{be._lock||(Ft(v),Or!=null&&Ln(null,lr,!0,$t.setSeries))});function Ti(v,S,z){let E=G[S];z&&(v=v/rt-(E.ori==1?Zt:nt));let R=Ce;E.ori==1&&(R=me,v=R-v),E.dir==-1&&(v=R-v);let H=E._min,P=E._max,te=v/R,ie=H+(P-H)*te,ce=E.distr;return ce==3?lo(10,ie):ce==4?EM(ie,E.asinh):ce==100?E.bwd(ie):ie}function On(v,S){let z=Ti(v,V,S);retur)DELIM" -R"DELIM(n yr(z,i[0],Qt,Jt)}l.valToIdx=v=>yr(v,i[0]),l.posToIdx=On,l.posToVal=Ti,l.valToPos=(v,S,z)=>G[S].ori==0?f(v,G[S],z?vn:Ce,z?Pn:0):d(v,G[S],z?Gn:me,z?Kn:0),l.setCursor=(v,S,z)=>{vt=v.left,xt=v.top,Bi(null,S,z)};function or(v,S){Et(xi,Xl,We.left=v),Et(xi,zu,We.width=S)}function va(v,S){Et(xi,yu,We.top=v),Et(xi,Tu,We.height=S)}let ur=J.ori==0?or:va,ya=J.ori==1?or:va;function Ao(){if(M&&Re.live)for(let v=u==2?1:0;v{Be[E]=z}):MM(v.idx)||Be.fill(v.idx),Re.idx=Be[0]),M&&Re.live){for(let z=0;z0||u==1&&!Bt)&&_a(z,Be[z]);Ao()}Yn=!1,S!==!1&&en("setLegend")}l.setLegend=ba;function _a(v,S){let z=D[v],E=v==0&&we==2?Fn:i[v],R;Bt?R=z.values(l,v,S)??Li:(R=z.value(l,S==null?null:E[S],v,S),R=R==null?Li:{_:R}),Re.values[v]=R}function Bi(v,S,z){Eo=vt,pl=xt,[vt,xt]=be.move(l,vt,xt),be.left=vt,be.top=xt,F&&(_i&&Lr(_i,dn(vt),0,Ce,me),Yr&&Lr(Yr,0,dn(xt),Ce,me));let E,R=Qt>Jt;wi=_t,zi=null;let H=J.ori==0?Ce:me,P=J.ori==1?Ce:me;if(vt<0||un==0||R){E=be.idx=null;for(let te=0;te0&&mt.show){let Hn=st==null?-10:st==E?ce:he(u==1?i[0][st]:i[ze][0][st],J,H,0),_n=yt==null?-10:Oe(yt,u==1?G[mt.scale]:G[mt.facets[1].scale],P,0);if(ps&&yt!=null){let Bn=J.ori==1?vt:xt,Jn=mn(Nt.dist(l,ze,st,_n,Bn));if(Jn=0?1:-1,Oi=qn>=0?1:-1;Oi==Xn&&(Oi==1?Ei==1?yt>=qn:yt<=qn:Ei==1?yt<=qn:yt>=qn)&&(wi=Jn,zi=ze)}else wi=Jn,zi=ze}}if(Yn||gs){let Bn,Jn;J.ori==0?(Bn=Hn,Jn=_n):(Bn=_n,Jn=Hn);let Ei,qn,Xn,Oi,qi,Nn,Wn=!0,Jr=Tt.bbox;if(Jr!=null){Wn=!1;let ut=Jr(l,ze);Xn=ut.left,Oi=ut.top,Ei=ut.width,qn=ut.height}else Xn=Bn,Oi=Jn,Ei=qn=Tt.size(l,ze);if(Nn=Tt.fill(l,ze),qi=Tt.stroke(l,ze),gs)ze==zi&&wi<=Nt.prox&&(de=Xn,ge=Oi,De=Ei,Ie=qn,Je=Wn,qe=Nn,je=qi);else{let ut=oi[ze];ut!=null&&(ir[ze]=Xn,rr[ze]=Oi,m_(ut,Ei,qn,Wn),d_(ut,Nn,qi),Lr(ut,Xi(Xn),Xi(Oi),Ce,me))}}}}if(gs){let ze=Nt.prox,mt=Or==null?wi<=ze:wi>ze||zi!=Or;if(Yn||mt){let pt=oi[0];pt!=null&&(ir[0]=de,rr[0]=ge,m_(pt,De,Ie,Je),d_(pt,qe,je),Lr(pt,Xi(de),Xi(ge),Ce,me))}}}if(We.show&&Si)if(v!=null){let[te,ie]=$t.scales,[ce,de]=$t.match,[ge,De]=v.cursor.sync.scales,Ie=v.cursor.drag;if(qt=Ie._x,Vt=Ie._y,qt||Vt){let{left:Je,top:qe,width:je,height:ze}=v.select,mt=v.scales[ge].ori,pt=v.posToVal,Mt,st,yt,Hn,_n,Bn=te!=null&&ce(te,ge),Jn=ie!=null&&de(ie,De);Bn&&qt?(mt==0?(Mt=Je,st=je):(Mt=qe,st=ze),yt=G[te],Hn=he(pt(Mt,ge),yt,H,0),_n=he(pt(Mt+st,ge),yt,H,0),ur(br(Hn,_n),mn(_n-Hn))):ur(0,H),Jn&&Vt?(mt==1?(Mt=Je,st=je):(Mt=qe,st=ze),yt=G[ie],Hn=Oe(pt(Mt,De),yt,P,0),_n=Oe(pt(Mt+st,De),yt,P,0),ya(br(Hn,_n),mn(_n-Hn))):ya(0,P)}else jo()}else{let te=mn(Eo-To),ie=mn(pl-Fr);if(J.ori==1){let De=te;te=ie,ie=De}qt=ht.x&&te>=ht.dist,Vt=ht.y&&ie>=ht.dist;let ce=ht.uni;ce!=null?qt&&Vt&&(qt=te>=ce,Vt=ie>=ce,!qt&&!Vt&&(ie>te?Vt=!0:qt=!0)):ht.x&&ht.y&&(qt||Vt)&&(qt=Vt=!0);let de,ge;qt&&(J.ori==0?(de=_s,ge=vt):(de=Qr,ge=xt),ur(br(de,ge),mn(ge-de)),Vt||ya(0,P)),Vt&&(J.ori==1?(de=_s,ge=vt):(de=Qr,ge=xt),ya(br(de,ge),mn(ge-de)),qt||ur(0,H)),!qt&&!Vt&&(ur(0,0),ya(0,0))}if(ht._x=qt,ht._y=Vt,v==null){if(z){if(tc!=null){let[te,ie]=$t.scales;$t.values[0]=te!=null?Ti(J.ori==0?vt:xt,te):null,$t.values[1]=ie!=null?Ti(J.ori==1?vt:xt,ie):null}wa(Im,l,vt,xt,Ce,me,E)}if(ps){let te=z&&$t.setSeries,ie=Nt.prox;Or==null?wi<=ie&&Ln(zi,lr,!0,te):wi>ie?Ln(null,lr,!0,te):zi!=Or&&Ln(zi,lr,!0,te)}}Yn&&(Re.idx=E,ba()),S!==!1&&en("setCursor")}let cr=null;Object.defineProperty(l,"rect",{get(){return cr==null&&Sa(!1),cr}});function Sa(v=!1){v?cr=null:(cr=T.getBoundingClientRect(),en("syncRect",cr))}function Ku(v,S,z,E,R,H,P){be._lock||Si&&v!=null&&v.movementX==0&&v.movementY==0||(Mo(v,S,z,E,R,H,P,!1,v!=null),v!=null?Bi(null,!0,!0):Bi(S,!0,!1))}function Mo(v,S,z,E,R,H,P,te,ie){if(cr==null&&Sa(!1),Ft(v),v!=null)z=v.clientX-cr.left,E=v.clientY-cr.top;else{if(z<0||E<0){vt=-10,xt=-10;return}let[ce,de]=$t.scales,ge=S.cursor.sync,[De,Ie]=ge.values,[Je,qe]=ge.scales,[je,ze]=$t.match,mt=S.axes[0].side%2==1,pt=J.ori==0?Ce:me,Mt=J.ori==1?Ce:me,st=mt?H:R,yt=mt?R:H,Hn=mt?E:z,_n=mt?z:E;if(Je!=null?z=je(ce,Je)?m(De,G[ce],pt,0):-10:z=pt*(Hn/st),qe!=null?E=ze(de,qe)?m(Ie,G[de],Mt,0):-10:E=Mt*(_n/yt),J.ori==1){let Bn=z;z=E,E=Bn}}ie&&(S==null||S.cursor.event.type==Im)&&((z<=1||z>=Ce-1)&&(z=Ka(z,Ce)),(E<=1||E>=me-1)&&(E=Ka(E,me))),te?(To=z,Fr=E,[_s,Qr]=be.move(l,z,E)):(vt=z,xt=E)}const xa={width:0,height:0,left:0,top:0};function jo(){pa(xa,!1)}let Gu,Yu,Fu,Qu;function ko(v,S,z,E,R,H,P){Si=!0,qt=Vt=ht._x=ht._y=!1,Mo(v,S,z,E,R,H,P,!0,!1),v!=null&&(Gt(Pm,dp,Ju,!1),wa(s_,l,_s,Qr,Ce,me,null));let{left:te,top:ie,width:ce,height:de}=We;Gu=te,Yu=ie,Fu=ce,Qu=de}function Ju(v,S,z,E,R,H,P){Si=ht._x=ht._y=!1,Mo(v,S,z,E,R,H,P,!1,!0);let{left:te,top:ie,width:ce,height:de}=We,ge=ce>0||de>0,De=Gu!=te||Yu!=ie||Fu!=ce||Qu!=de;if(ge&&De&&pa(We),ht.setScale&&ge&&De){let Ie=te,Je=ce,qe=ie,je=de;if(J.ori==1&&(Ie=ie,Je=de,qe=te,je=ce),qt&&sr(V,Ti(Ie,V),Ti(Ie+Je,V)),Vt)for(let ze in G){let mt=G[ze];ze!=V&&mt.from==null&&mt.min!=_t&&sr(ze,Ti(qe+je,ze),Ti(qe,ze))}jo()}else be.lock&&(be._lock=!be._lock,Bi(S,!0,v!=null));v!=null&&(In(Pm,dp),wa(Pm,l,vt,xt,Ce,me,null))}function yd(v,S,z,E,R,H,P){if(be._lock)return;Ft(v);let te=Si;if(Si){let ie=!0,ce=!0,de=10,ge,De;J.ori==0?(ge=qt,De=Vt):(ge=Vt,De=qt),ge&&De&&(ie=vt<=de||vt>=Ce-de,ce=xt<=de||xt>=me-de),ge&&ie&&(vt=vt<_s?0:Ce),De&&ce&&(xt=xt{let R=$t.match[2];z=R(l,S,z),z!=-1&&Ln(z,E,!0,!1)},F&&(Gt(s_,T,ko),Gt(Im,T,Ku),Gt(a_,T,v=>{Ft(v),Sa(!1)}),Gt(l_,T,yd),Gt(o_,T,Xu),_p.add(l),l.syncRect=Sa);const vl=l.hooks=n.hooks||{};function en(v,S,z){hl?da.push([v,S,z]):v in vl&&vl[v].forEach(E=>{E.call(null,l,S,z)})}(n.plugins||[]).forEach(v=>{for(let S in v.hooks)vl[S]=(vl[S]||[]).concat(v.hooks[S])});const ec=(v,S,z)=>z,$t=an({key:null,setSeries:!1,filters:{pub:b_,sub:b_},scales:[V,D[1]?D[1].scale:null],match:[__,__,ec],values:[null,null]},be.sync);$t.match.length==2&&$t.match.push(ec),be.sync=$t;const tc=$t.key,Ro=WS(tc);function wa(v,S,z,E,R,H,P){$t.filters.pub(v,S,z,E,R,H,P)&&Ro.pub(v,S,z,E,R,H,P)}Ro.sub(l);function bd(v,S,z,E,R,H,P){$t.filters.sub(v,S,z,E,R,H,P)&&Nr[v](null,S,z,E,R,H,P)}l.pub=bd;function _d(){Ro.unsub(l),_p.delete(l),gn.clear(),pp(Pf,no,Wu),g.remove(),re?.remove(),en("destroy")}l.destroy=_d;function Co(){en("init",n,i),yo(i||n.data,!1),fe[V]?ha(V,fe[V]):ol(),rl=We.show&&(We.width>0||We.height>0),Yt=Yn=!0,sl(n.width,n.height)}return D.forEach(Sr),X.forEach(pd),a?a instanceof HTMLElement?(a.appendChild(g),Co()):a(l,Co):Co(),l}on.assign=an;on.fmtNum=ag;on.rangeNum=Kf;on.rangeLog=sd;on.rangeAsinh=rg;on.orient=nl;on.pxRatio=rt;on.join=ZM;on.fmtDate=og,on.tzDate=YM;on.sync=WS;{on.addGap=M4,on.clipGaps=od;let n=on.paths={points:sx};n.linear=lx,n.stepped=R4,n.bars=C4,n.spline=U4}const fx=(n,i,a,l,u)=>{if(!Number.isFinite(a)||!Number.isFinite(l)||l<=a)return[];const f=[];if(Math.asinh(l)-Math.asinh(a)<1.5){const p=Number.isFinite(u)&&u>0?u:(l-a)/4,g=Math.ceil(a/p)*p;for(let b=0;b<100;b++){const y=Number((g+b*p).toPrecision(14));if(y>l)break;f.push({value:y,priority:y===0?0:1})}}else{const p=Math.ceil(Math.log10(Math.max(Math.abs(a),Math.abs(l))));for(let )DELIM" -R"DELIM(g=Math.min(-1,p-1);g<=p;g++)for(const b of[1,2,5]){const y=b*10**g;for(const w of[-y,y])Number.isFinite(w)&&w>=a&&w<=l&&f.push({value:w,priority:b===1?1:2})}a<=0&&l>=0&&f.push({value:0,priority:0})}f.sort((p,g)=>p.priority-g.priority||p.value-g.value);const d=[],m=[];for(const{value:p}of f){const g=n.valToPos(p,"y");Number.isFinite(g)&&m.every(b=>Math.abs(g-b)>=36)&&(d.push(p),m.push(g))}return d.sort((p,g)=>p-g),d};function dx(n,i){const a=Rt.indexOf(n.toLowerCase());return a===-1?n:i.getPropertyValue(`--chart-color-${String(a)}`).trim()||n}function G4(n){const i=n.filter(([,a])=>a>0).map(([a,l])=>({minimumRate:a,virtualSize:l}));return i.sort((a,l)=>a.minimumRate-l.minimumRate),i}const Y4=new Intl.NumberFormat(void 0,{maximumSignificantDigits:8}),F4=new Intl.NumberFormat(void 0,{maximumFractionDigits:0});function xp(n){return Y4.format(n)}function hx(n){return`${F4.format(n)} vB`}function Q4({snapshot:n,now:i,color:a,scale:l}){const u=se.useMemo(()=>G4(n?.data.histogram??[]),[n]),f=n!==null&&i-n.receivedAt>=Zu,d=n===null?"Waiting for transaction-pool fee data…":f?"Fee distribution is stale. Waiting for a fresh pool snapshot…":n.data.count===0?"The transaction pool is empty.":u.length===0?"No fee distribution is available for this pool snapshot.":null;return x.jsxs("div",{className:"space-y-3",children:[d?x.jsx("p",{role:"status",className:"text-textMuted flex min-h-72 items-center justify-center px-4 text-center text-sm",children:d}):x.jsxs(x.Fragment,{children:[x.jsx(J4,{bins:u,color:a,scale:l}),x.jsx("p",{className:"text-textMuted text-xs",children:"Each bar is a fee-rate group, labeled by its minimum rate. Bar height is virtual size, not transaction count. Groups are spaced evenly."}),x.jsxs("details",{className:"border-accentSecondary/20 rounded-md border text-xs",children:[x.jsxs("summary",{className:"text-textMuted hover:text-accent cursor-pointer px-3 py-2",children:["View ",zn(u.length)," fee-rate ",u.length===1?"group":"groups"]}),x.jsx("div",{className:"border-accentSecondary/20 max-h-56 overflow-auto border-t",children:x.jsxs("table",{className:"w-full text-left tabular-nums",children:[x.jsx("caption",{className:"sr-only",children:"Transaction-pool fee-rate groups"}),x.jsx("thead",{className:"bg-surface text-textMuted sticky top-0",children:x.jsxs("tr",{children:[x.jsx("th",{scope:"col",className:"px-3 py-2",children:"Minimum rate (sat/vB)"}),x.jsx("th",{scope:"col",className:"px-3 py-2 text-right",children:"Virtual size (vB)"})]})}),x.jsx("tbody",{className:"divide-accentSecondary/20 divide-y",children:u.map((m,p)=>x.jsxs("tr",{children:[x.jsx("td",{className:"px-3 py-2",children:xp(m.minimumRate)}),x.jsx("td",{className:"px-3 py-2 text-right",children:zn(m.virtualSize)})]},p))})]})})]})]}),n&&x.jsxs("p",{className:"text-textMuted text-xs",children:[f?"Last snapshot":"Snapshot"," ",Uu(n.receivedAt),!f&&` · ${zn(n.data.count)} transactions · ${hx(n.data.virtual)}`]})]})}function J4({bins:n,color:i,scale:a}){const l=Rp(),u=se.useRef(null),f=se.useRef(null),d=se.useRef(n);return se.useLayoutEffect(()=>{d.current=n;const m=f.current;m&&(m.setData([n.map((p,g)=>g),n.map(p=>p.virtualSize)]),m.redraw(!1,!0))},[n]),se.useLayoutEffect(()=>{const m=u.current;if(!m)return;const p=getComputedStyle(m),g=dx(i,p),b=`12px ${p.fontFamily}`,y=[d.current.map((A,k)=>k),d.current.map(A=>A.virtualSize)],w={width:Math.max(240,m.clientWidth),height:280,padding:[12,12,0,0],cursor:{drag:{x:!1,y:!1}},legend:{show:!0,live:!0},scales:{x:{time:!1,range:()=>[-.5,d.current.length-.5]},y:{distr:a==="compressed"?4:1,asinh:1,range:(A,k,L)=>[0,Math.max(1,L*1.08)]}},axes:[{stroke:p.color,font:b,grid:{show:!1},ticks:{stroke:p.getPropertyValue("--chart-ticks").trim(),width:1},splits:A=>{const k=d.current,L=Math.max(1,Math.ceil(k.length/Math.max(1,Math.floor(A.width/80))));return k.map((D,X)=>X).filter(D=>D%L===0)},values:(A,k)=>k.map(L=>xp(d.current[L].minimumRate))},{size:76,stroke:p.color,font:b,grid:{stroke:p.getPropertyValue("--chart-grid").trim(),width:1},ticks:{stroke:p.getPropertyValue("--chart-ticks").trim(),width:1},values:(A,k)=>k.map(L=>zn(L)),...a==="compressed"?{splits:fx,filter:(A,k)=>k}:{}}],series:[{label:"Min rate",value:(A,k)=>{const L=k===null?void 0:d.current[k];return L?`${xp(L.minimumRate)} sat/vB`:"—"}},{label:"Virtual size",stroke:g,fill:`${g}90`,width:1,points:{show:!1},paths:on.paths.bars?.({size:[.85,48]}),value:(A,k)=>k===null?"—":hx(k)}]},O=new on(w,y,m);f.current=O;const T=new ResizeObserver(A=>{const k=A[0]?.contentRect.width;k&&k>0&&O.setSize({width:Math.round(k),height:280})});return T.observe(m),()=>{T.disconnect(),O.destroy(),f.current=null}},[i,a,l]),x.jsxs("div",{role:"img","aria-label":"Transaction-pool fee distribution: virtual size in vbytes by minimum fee rate in satoshis per vbyte",children:[x.jsx("p",{className:"text-textMuted mb-2 text-xs",children:"Virtual size (vB)"}),x.jsx("div",{ref:u,className:"text-textMuted min-w-0 overflow-hidden"}),x.jsx("p",{className:"text-textMuted text-center text-xs",children:"Minimum fee rate per group (sat/vB)"})]})}function X4({data:n,series:i,height:a=280,emptyMessage:l="Waiting for live data…",valueSuffix:u="",zeroBased:f=!0,valueFormatter:d=nj,visualization:m="line",scale:p="linear",forceEmpty:g=!1}){const b=Rp(),y=se.useRef(null),w=se.useRef(null),O=se.useRef(!1),T=se.useRef(null),A=se.useMemo(()=>tj(n),[n]),k=se.useRef(A),L=!g&&n[0]?.length>0;return se.useLayoutEffect(()=>{k.current=A},[A]),se.useLayoutEffect(()=>{const D=y.current;if(!D)return;const X=getComputedStyle(D),G=`12px ${X.fontFamily}`,ee={width:Math.max(240,D.clientWidth),height:a,padding:[12,8,0,0],cursor:{drag:{x:!0,y:!1,setScale:!0},focus:{prox:24}},hooks:{setSelect:[ye=>{ye.select.width>0&&(O.current=!0)}]},legend:{show:!0,live:!0},scales:{x:{time:!0},y:{auto:!0,distr:p==="compressed"?4:1,asinh:1,...f?{range:(ye,ue,J)=>[Math.min(0,ue),J===0?1:J*1.08]}:{range:(ye,ue,J)=>{const we=J-ue,he=we===0?Math.max(1,Math.abs(J)*5e-4):we*.08;return[ue-he,J+he]}}}},axes:[{stroke:X.color,grid:{stroke:X.getPropertyValue("--chart-grid").trim(),width:1},ticks:{stroke:X.getPropertyValue("--chart-ticks").trim(),width:1},font:G},{size:72,stroke:X.color,grid:{stroke:X.getPropertyValue("--chart-grid").trim(),width:1},ticks:{stroke:X.getPropertyValue("--chart-ticks").trim(),width:1},font:G,values:(ye,ue)=>ue.map(J=>J===null?null:`${d(J)}${u}`),...p==="compressed"?{splits:fx,filter:(ye,ue)=>ue}:{}}],series:[{},...i.map((ye,ue)=>{const J=dx(ye.color,X),we=m==="step"?on.paths.stepped?.({align:1}):m==="bar"?W4(ue,i.length):void 0;return{label:ye.label,stroke:J,fill:m==="area"||m==="bar"?ye.fill??`${J}24`:ye.fill,width:ye.width??2,paths:we,points:{show:m==="line"?ye.points??!1:!1},value:(he,Oe)=>Oe===null?"—":`${d(Oe)}${u}`}})]},V=new on(ee,k.current,D),ne=T.current;ne&&V.setScale("x",ne),w.current=V;const ae=new ResizeObserver(ye=>{const ue=ye[0]?.contentRect.width;ue&&ue>0&&V.setSize({width:Math.round(ue),height:a})});return ae.observe(D),()=>{T.current=O.current&&V.scales.x.min!=null&&V.scales.x.max!=null?{min:V.scales.x.min,max:V.scales.x.max}:null,ae.disconnect(),V.destroy(),w.current=null}},[a,i,d,u,m,f,p,b]),se.useEffect(()=>{const D=w.current;if(!D)return;const X=!O.current;D.setData(A,X),X||D.redraw()},[A]),x.jsxs("div",{className:"relative min-w-0",children:[x.jsx("div",{ref:y,className:"text-textMuted min-w-0 overflow-hidden"}),!L&&x.jsx("div",{className:"bg-surface text-textMuted pointer-events-none absolute inset-0 z-10 flex items-center justify-center text-sm",children:l})]})}function W4(n,i){const a=Math.max(1,i);return on.paths.bars?.({size:[1,48/a,0],disp:{x0:{unit:1,values:l=>{const u=q_(l,a),f=-u.groupWidth/2+u.barWidth*n;return Array.from(l.data[0],d=>d+f)}},size:{unit:1,values:l=>[q_(l,a).barWidth]}}})}function q_(n,i){const a=ej(n.data[0]),l=Math.abs(n.posToVal(48,"x")-n.posToVal(0,"x")),u=Math.min(a*.72,l);return{groupWidth:u,barWidth:u/i}}function ej(n){let i=Number.POSITIVE_INFINITY,a;for(const l of n)if(Number.isFi)DELIM" -R"DELIM(nite(l)){if(a!==void 0){const u=Math.abs(l-a);u>0&&u=2)return n;const a=Date.now()/1e3,l=i[0]??a,u=[l-1,l],f=n.slice(1).map(d=>{const m=d[0]??null;return[m,m]});return[u,...f]}function nj(n){return Math.abs(n)>=1e6?`${(n/1e6).toFixed(1)}m`:Math.abs(n)>=1e3?`${(n/1e3).toFixed(1)}k`:Math.abs(n)>=10?n.toFixed(0):Math.abs(n)>=1?n.toFixed(1):n.toFixed(2)}const ij={300:"5m",900:"15m",3600:"1h"},rj=new Intl.NumberFormat(void 0,{maximumFractionDigits:0}),sj=new Intl.NumberFormat(void 0,{maximumFractionDigits:2});function aj(n){return rj.format(n)}function lj(n){return sj.format(n)}function oj(n){return n==="height"||n==="occurrences"?aj:lj}function uj({metrics:n}){const i=zS(),[a,l]=se.useState(Z3),[u,f]=se.useState(null),[d,m]=se.useState(!1);se.useEffect(()=>{$3(a)},[a]);function p(y){l(w=>u?.mode==="add"?w.length>=Wl?w:[...w,y]:w.map(O=>O.id===y.id?y:O)),f(null)}function g(y,w){l(O=>{const T=y+w;if(T<0||T>=O.length)return O;const A=[...O],k=A[y],L=A[T];return A[y]=L,A[T]=k,A})}function b(){if(!d){m(!0);return}l(jf()),m(!1)}return x.jsxs("section",{className:"space-y-4",children:[x.jsxs("div",{className:"flex flex-wrap items-end justify-between gap-4",children:[x.jsxs("div",{children:[x.jsx("p",{className:"text-accentSecondary text-xs tracking-wide uppercase",children:"Live telemetry"}),x.jsx("h2",{className:"text-accent mt-1 text-2xl font-semibold",children:"Custom charts"}),x.jsxs("p",{className:"text-textMuted mt-1 text-sm",children:["Session data only · ",String(a.length)," of ",String(Wl)," charts"]})]}),x.jsxs("div",{className:"flex flex-wrap gap-2",children:[x.jsx("button",{type:"button",onClick:()=>{m(!1),f({mode:"add",chart:bS()})},disabled:a.length>=Wl,className:"border-accent/40 text-accent hover:border-accent hover:text-accentSecondary rounded-md border px-3 py-2 text-sm font-medium disabled:cursor-not-allowed disabled:opacity-40",children:"Add chart"}),x.jsx("button",{type:"button",onClick:b,onBlur:()=>{m(!1)},className:`rounded-md border px-3 py-2 text-sm font-medium ${d?"border-amber-400/60 text-amber-200":"border-accent/40 text-accent hover:border-accent hover:text-accentSecondary"}`,children:d?"Confirm reset":"Reset defaults"})]})]}),a.length===0?x.jsxs("div",{className:"border-accent/30 bg-surface/80 rounded-2xl border border-dashed px-6 py-16 text-center",children:[x.jsx("p",{className:"text-textPrimary font-medium",children:"No charts in this dashboard."}),x.jsx("p",{className:"text-textMuted mt-2 text-sm",children:"Add a custom chart or start from a template."})]}):x.jsx("div",{className:"grid gap-6 xl:grid-cols-2",children:a.map((y,w)=>x.jsx(cj,{chart:y,metrics:n,now:i,canMoveEarlier:w>0,canMoveLater:w{l(O=>O.map(T=>T.id===y.id?{...T,scale:T.scale==="compressed"?"linear":"compressed"}:T))},onDelete:()=>{l(O=>O.filter(T=>T.id!==y.id))},onDuplicate:()=>{l(O=>O.length>=Wl?O:[...O,U3(y)])},onEdit:()=>{f({mode:"edit",chart:y})},onMoveEarlier:()=>{g(w,-1)},onMoveLater:()=>{g(w,1)}},y.id))}),u&&x.jsx(J3,{chart:u.chart,mode:u.mode,onCancel:()=>{f(null)},onSave:p},`${u.mode}-${u.chart.id}`)]})}function cj({chart:n,metrics:i,now:a,canMoveEarlier:l,canMoveLater:u,canDuplicate:f,onDelete:d,onDuplicate:m,onEdit:p,onMoveEarlier:g,onMoveLater:b,onToggleScale:y}){const[w,O]=se.useState(null),[T,A]=se.useState(0),k=w??i,L=se.useMemo(()=>ln(n)?V3(k,n):null,[n,k]),D=se.useMemo(()=>ln(n)?n.series.map(ee=>({label:ee.label??cs(ee.signalId).label,color:ee.color})):[],[n]),X=oj(L?.unit??"vbytes"),G=`Waiting for ${D.length===1?D[0]?.label?.toLowerCase():"the selected signals"}…`;return x.jsxs("article",{className:"border-accent/30 bg-surface/80 min-w-0 overflow-hidden rounded-2xl border",children:[x.jsx("header",{className:"border-accentSecondary/20 space-y-3 border-b px-4 py-4 sm:px-5",children:x.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[x.jsxs("div",{className:"min-w-0",children:[x.jsx("h3",{className:"text-accent truncate text-lg font-semibold",title:n.title,children:n.title}),x.jsxs("p",{className:"text-textMuted mt-1 text-xs",children:[ln(n)&&L?`${wS(L.unit)} · ${ij[n.range]} · ${n.visualization}`:"Virtual size by fee-rate group · latest snapshot",n.scale==="compressed"?" · compressed scale":"",w?" · paused":""]})]}),x.jsxs("div",{className:"flex flex-wrap justify-end gap-1 text-xs",children:[x.jsx("button",{type:"button","aria-label":`Compress peaks for ${n.title}`,"aria-pressed":n.scale==="compressed",title:"Use a log-like Y axis to compress large peaks. Zero, negative values, and original measurements are preserved.",onClick:y,className:`rounded-md border px-2 py-1.5 ${n.scale==="compressed"?"border-accent/40 bg-accentSecondary/20 text-accent":"border-accent/30 text-textMuted hover:text-accent hover:bg-accentSecondary/10"}`,children:"Compress peaks"}),x.jsx(Pa,{label:w?"Resume chart":"Pause chart",onClick:()=>{O(ee=>ee?null:ln(n)?i:{...i,now:a})},children:w?"Resume":"Pause"}),ln(n)&&x.jsx(Pa,{label:"Reset chart zoom",onClick:()=>{A(ee=>ee+1)},children:"Reset zoom"}),x.jsx(Pa,{label:"Edit chart",onClick:p,children:"Edit"}),x.jsx(Pa,{label:"Duplicate chart",onClick:m,disabled:!f,children:"Duplicate"}),x.jsx(Pa,{label:`Move ${n.title} earlier`,onClick:g,disabled:!l,children:"←"}),x.jsx(Pa,{label:`Move ${n.title} later`,onClick:b,disabled:!u,children:"→"}),x.jsx(Pa,{label:"Delete chart",onClick:d,danger:!0,children:"Delete"})]})]})}),x.jsx("div",{className:"min-w-0 p-3 sm:p-5",children:ln(n)&&L?x.jsx(X4,{data:L.data,series:D,visualization:n.visualization,scale:n.scale,zeroBased:P3(L.unit),valueFormatter:X,valueSuffix:I3(L.unit),forceEmpty:!L.hasObservedData,emptyMessage:G},T):!ln(n)&&x.jsx(Q4,{snapshot:k.poolSnapshot,now:w?.now??a,color:n.color,scale:n.scale})}),n.scale==="compressed"&&x.jsx("p",{className:"text-textMuted px-5 pb-3 text-[11px]",children:"Log-like Y axis · peaks compressed · labels and hover values show original measurements."}),ln(n)&&n.series.some(ee=>ee.signalId==="event:10")&&x.jsx("p",{className:"text-textMuted px-5 pb-3 text-[11px]",children:"Archival includes compact-block recovery; rejected and duplicate submissions are excluded."}),L&&L.unobservedLabels.length>0&&L.hasObservedData&&x.jsxs("footer",{className:"border-accent/10 text-textMuted border-t px-5 py-2 text-[11px]",children:["Not observed this session: ",L.unobservedLabels.join(", ")]})]})}function Pa({label:n,children:i,onClick:a,disabled:l=!1,danger:u=!1}){return x.jsx("button",{type:"button","aria-label":n,onClick:a,disabled:l,className:`rounded-md px-2 py-1.5 disabled:cursor-not-allowed disabled:opacity-30 ${u?"text-textMuted hover:bg-red-500/10 hover:text-red-300":"text-textMuted hover:text-accent hover:bg-accentSecondary/10"}`,children:i})}const fj=[{event:0,label:"Header archived"},{event:3,label:"Block archived"},{event:5,label:"Block validated"},{event:6,label:"Block confirmed"},{event:13,label:"Block organized"},{event:14,label:"Block reorganized"}];function dj({adminStatus:n,endpoints:i,metrics:a,native:l,syncEstimate:u}){const f=T3(a,10),d=l.configuration,m=sS(d?.forks??[]),p=hj(n,l.status),g=[n.error?`Admin: ${n.error}`:null,l.status.error?`Native: ${l.status.error}`:null,l.transport==="none"&&l.restError?`Native REST: ${l.restError}`:null,a.invalidFrames>0?`${String(a.invalidFrames)} malformed admin frame${a.invalidFrames===1?"":"s"} ignored`:null,l.live.invalidFrames>0?`${String(l.live.invalidFrames)} malformed native frame${l.live.invalidFrames===1?"":"s"} ignored`:null,l.status.phase==="connected"&&l.transport==="none"?"Native: Connected, but no fresh valid state has been received":null].filter(b=>b!==null);return x.jsxs("div",{className:"space-y-6",children:[g.length>0&&x.jsxs("section",{className:"rounded-xl border border-amber-500/30 bg-amber-500/10 px-4 py-3",children:[x.jsx("p",{className:"text-sm font-medium text-amber-300",children:"Transport notice"}),x.jsx)DELIM" -R"DELIM(("ul",{className:"text-textMuted mt-1 space-y-1 text-xs",children:g.map(b=>x.jsx("li",{children:b},b))})]}),x.jsx(N3,{confirmed:l.top,estimate:u}),x.jsxs("dl",{"aria-label":"Node summary",className:"grid gap-4 sm:grid-cols-2 xl:grid-cols-4",children:[x.jsx(Sf,{label:"Current top",value:l.top===null?"—":zn(l.top),detail:l.transport==="none"?"Waiting for native API":`${pj(u)} · via ${l.transport==="websocket"?"native WebSocket":"REST fallback"}`,emphasized:!0}),x.jsx(Sf,{label:"Current activity",value:f.label,detail:f.rate>0?`${HA(f.rate)} over the last 10 seconds`:"No lifecycle events in the last 10 seconds",numeric:!1}),x.jsx(Sf,{label:"Collection uptime",value:LA(a.now-a.sessionStartedAt),detail:`${zn(a.totalEvents)} events · ${zn(a.totalLogs)} logs`}),x.jsx(Sf,{label:"Connection",value:p.phase==="connected"?QA(i.adminUrl).replace(/\/$/u,""):"[disconnected]",detail:`${p.lastMessageAt?`Last frame ${Uu(p.lastMessageAt)}`:"Waiting for the first frame"} · ${String(p.reconnects)} reconnect${p.reconnects===1?"":"s"}`,numeric:!1})]}),x.jsx(uj,{metrics:a}),x.jsxs("section",{className:"grid gap-4 xl:grid-cols-[1.1fr_0.9fr]",children:[x.jsxs("div",{className:"border-accent/30 bg-surface/80 overflow-hidden rounded-2xl border",children:[x.jsxs("header",{className:"border-accentSecondary/20 border-b px-5 py-4",children:[x.jsx("p",{className:"text-accentSecondary text-xs tracking-wide uppercase",children:"Lifecycle heights"}),x.jsx("h2",{className:"text-accent mt-1 text-lg font-semibold",children:"Highest observed event values"})]}),x.jsx("div",{className:"bg-accentSecondary/10 grid gap-px sm:grid-cols-2 lg:grid-cols-3",children:fj.map(({event:b,label:y})=>{const w=a.signalMaximums[Ui(b)];return x.jsxs("div",{className:"bg-surface px-5 py-4",children:[x.jsx("p",{className:"text-accentSecondary text-xs tracking-wide uppercase",children:y}),x.jsx("p",{className:"text-textPrimary mt-2 text-xl font-semibold tabular-nums",children:w===void 0?"—":zn(w)})]},b)})})]}),x.jsxs("div",{className:"border-accent/30 bg-surface/80 rounded-2xl border",children:[x.jsxs("header",{className:"border-accentSecondary/20 border-b px-5 py-4",children:[x.jsx("p",{className:"text-accentSecondary text-xs tracking-wide uppercase",children:"Capabilities"}),x.jsx("h2",{className:"text-accent mt-1 text-lg font-semibold",children:"Native configuration"})]}),d?x.jsxs("div",{className:"space-y-4 p-5 text-sm",children:[x.jsxs(_u,{title:"Store configuration",children:[x.jsx(Qm,{items:[["Address index",d.store.address],["Client filters index",d.store.filter],["Silent payments index",d.store.silent!==null],["Turbo",d.store.turbo]]}),x.jsx(Tf,{items:[["Silent payments from",d.store.silent===null?"Not indexed":zn(d.store.silent)]]})]}),x.jsxs(_u,{title:"Node services",children:[x.jsx(Qm,{items:[["Blocks",d.node.blocks],["Limited",d.node.limited],["Witness",d.node.witness],["Filters",d.node.filters],["Privacy",d.node.privacy]]}),x.jsx(Tf,{items:[["Inputs pruned below",d.store.pruned>0?zn(d.store.pruned):"Not pruned"]]})]}),d.network&&x.jsxs(_u,{title:"Peer protocol",children:[x.jsx(Qm,{items:[["Relay",d.network.relay],["Compact",d.network.compact],["Address",d.network.address],["Witness tx",d.network.witness_tx],["Memory pool",d.network.memory_pool],["Not found",d.network.not_found],["Reject",d.network.reject],["Alert",d.network.alert]]}),x.jsx(Tf,{items:[["Protocol minimum",String(d.network.protocol_minimum)],["Protocol maximum",String(d.network.protocol_maximum)]]})]}),d.wallet&&x.jsx(_u,{title:"Wallet",children:x.jsx(Tf,{items:[["P2PKH version",String(d.wallet.p2kh),Ia(m,"p2kh",d.wallet.p2kh)],["P2SH version",String(d.wallet.p2sh),Ia(m,"p2sh",d.wallet.p2sh)],["WIF version",String(d.wallet.wif),Ia(m,"wif",d.wallet.wif)],["Witness prefix",d.wallet.witness,Ia(m,"witness",d.wallet.witness)],["Silent prefix",d.wallet.silent,Ia(m,"silent",d.wallet.silent)],["HD private",I_(d.wallet.hd_private),Ia(m,"hdPrivate",d.wallet.hd_private)],["HD public",I_(d.wallet.hd_public),Ia(m,"hdPublic",d.wallet.hd_public)]]})}),x.jsx(_u,{title:"Configured forks",children:x.jsx("div",{className:"flex flex-wrap gap-1.5",children:d.forks.map(b=>x.jsx("span",{className:"text-textPrimary bg-accentSecondary/15 rounded-full px-2 py-0.5 font-mono text-xs",children:b},b))})})]}):x.jsx("p",{className:"text-textMuted px-5 py-10 text-center text-sm",children:"Waiting for native configuration."})]})]}),x.jsx("section",{children:x.jsxs("div",{className:"border-accent/30 bg-surface/80 rounded-2xl border",children:[x.jsx("header",{className:"border-accentSecondary/20 border-b px-5 py-4",children:x.jsx("p",{className:"text-accentSecondary text-xs tracking-wide uppercase",children:"Recent events"})}),a.recentEvents.length===0?x.jsx(mj,{text:"No events observed yet."}):x.jsx("ul",{className:"divide-accentSecondary/20 divide-y",children:a.recentEvents.slice(0,6).map(b=>x.jsxs("li",{className:"flex items-center gap-3 px-5 py-3 text-xs",children:[x.jsx("time",{className:"text-textMuted w-24 shrink-0 font-mono",children:Uu(b.time)}),x.jsx("span",{className:"text-textPrimary min-w-0 flex-1 truncate font-mono",children:mo(b.event).name}),x.jsx("span",{className:"text-accent tabular-nums",children:rS(b.event,b.value)})]},b.id))})]})})]})}const V_={connected:0,connecting:1,reconnecting:2,idle:3};function hj(n,i){const a=V_[i.phase]>V_[n.phase]?i:n,l=Math.max(n.lastMessageAt??0,i.lastMessageAt??0);return{...a,reconnects:n.reconnects+i.reconnects,lastMessageAt:l>0?l:null}}function _u({title:n,children:i}){return x.jsxs("section",{className:"border-accentSecondary/20 space-y-2 border-t pt-3 first:border-t-0 first:pt-0",children:[x.jsx("h3",{className:"text-accentSecondary text-xs tracking-wide uppercase",children:n}),i]})}function Qm({items:n}){const i=n.filter(([,a])=>a!==void 0);return x.jsx("div",{className:"flex flex-wrap gap-1.5",children:i.map(([a,l])=>x.jsx("span",{className:`rounded-full border px-2 py-0.5 text-xs ${l?"border-emerald-500/50 bg-emerald-500/15 text-emerald-300":"text-textMuted border-slate-500/40"}`,children:a},a))})}function Tf({items:n}){const i=n.some(l=>l.length>2),a=i?"grid-cols-[10rem_max-content_auto]":"grid-cols-[10rem_max-content]";return x.jsx("dl",{className:`grid ${a} items-baseline gap-x-4 gap-y-1`,children:n.map(([l,u,f])=>x.jsxs(se.Fragment,{children:[x.jsx("dt",{className:"text-textMuted",children:l}),x.jsx("dd",{className:"text-textPrimary font-mono",children:u}),i&&x.jsx("dd",{className:"text-textMuted",children:f})]},l))})}function I_(n){return`0x${n.toString(16).padStart(8,"0")}`}function mj({text:n}){return x.jsx("p",{className:"text-textMuted px-5 py-10 text-center text-sm",children:n})}function pj(n){return n?n.blocksRemaining<=td?"Near current (estimated)":`${zn(n.blocksRemaining)} blocks remaining (estimated)`:"Waiting for confirmed block timestamp"}const gj=8e3;function vj({estimate:n,browserNotificationsEnabled:i}){const a=se.useRef(null),[l,u]=se.useState(null),f=n?.blocksRemaining??null;if(se.useEffect(()=>{const m=bj(f);if(!m)return;const p=a.current;if(a.current=m.state,!(p===null||p===m.state)&&(u(m),i)){const g=yj(m);Kz(g.title,{body:g.body,tag:"libbitcoin-sync-status"})}},[i,f]),se.useEffect(()=>{if(!l)return;const m=setTimeout(()=>{u(p=>p===l?null:p)},gj);return()=>{clearTimeout(m)}},[l]),!l)return null;const d=l.state==="near-current";return x.jsx("aside",{role:"status","aria-live":"polite","aria-atomic":"true",className:`fixed right-4 bottom-4 left-4 z-[60] rounded-xl border p-4 shadow-2xl shadow-black/50 sm:left-auto sm:w-96 ${d?"bg-noticeSuccess/95 border-emerald-400/35":"bg-noticeWarning/95 border-amber-400/35"}`,children:x.jsxs("div",{className:"flex items-start gap-4",children:[x.jsxs("div",{className:"min-w-0 flex-1",children:[x.jsx("p",{className:d?"font-semibold text-emerald-200":"font-semibold text-amber-200",children:d?"Node near current (estimated)":"Node fell behind (estimated)"}),x.jsx("p",{className:"text-noticeText/75 mt-1 text-sm",children:wp(l)})]}),x.jsx("button",{type:")DELIM" -R"DELIM(button","aria-label":"Dismiss synchronization notification",onClick:()=>{u(null)},className:"text-noticeText/60 hover:text-noticeText text-lg leading-none",children:"×"})]})})}function yj(n){return n.state==="near-current"?{title:"Libbitcoin node near current (estimated)",body:wp(n)}:{title:"Libbitcoin node fell behind (estimated)",body:wp(n)}}function bj(n){return n===null?null:{state:n<=td?"near-current":"behind",blocksBehind:n}}function wp(n){return n.state==="near-current"?`Confirmed top is approximately ${String(td)} blocks from the top candidate header, based on block time.`:`Confirmed top is approximately ${zn(n.blocksBehind)} blocks from the top candidate header, based on block time.`}const mx='(function(){"use strict";function je(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 gt(e,t="|"){return e.map(n=>kt(n)).join(t)}function Me(e,t){return typeof t=="bigint"?t.toString():t}class gr{constructor(t){this._getter=t,this._value=void 0}get value(){const t=this._getter;return t!==void 0&&(this._value=t(),this._getter=void 0),this._value}}function Le(e){return new gr(e)}function _r(e){return e==null}function Fe(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function vr(e,t){const n=e/t,r=Math.round(n),i=4*Number.EPSILON*Math.max(Math.abs(n),1);return Math.abs(n-r){const c=t._zod.def.shape[s];return r?r(c,s):c}):bt(e,s,r?r(o.value,s):o.value))}}function br(e,t){for(const n of Reflect.ownKeys(t)){const r=Object.getOwnPropertyDescriptor(t,n);r.enumerable&&(r.get?vt(e,n,()=>t[n]):bt(e,n,r.value))}}function N(...e){const t={};for(const n of e){const r=Object.getOwnPropertyDescriptors(n);Object.assign(t,r)}return Object.defineProperties({},t)}function yr(e){return JSON.stringify(e)}function wr(e){return e.toLowerCase().trim().replace(/[^\\w\\s-]/g,"").replace(/[\\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const yt="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function de(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const kr=Le(()=>{if(R.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function G(e){if(de(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const n=t.prototype;return!(de(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function wt(e){return G(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}const zr=new Set(["string","number","symbol"]);function pe(e){return e.replace(/[.*+?^${}()|[\\]\\\\]/g,"\\\\$&")}function K(e,t,n){const r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function _(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 kt(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function Sr(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout==="optional")}const zt={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]},$r={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function Or(e,t){const n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const s={};return q(s,e,me(e,t)),K(e,N(n,{shape:s,checks:[]}))}function me(e,t){const n=x(e),r=[];for(const i of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(n,i)?.enumerable)throw new Error(`Unrecognized key: "${String(i)}"`);t[i]&&r.push(i)}return r}function Er(e,t){const n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const s=new Set(me(e,t)),o={};return q(o,e,Reflect.ownKeys(x(e)).filter(c=>!s.has(c))),K(e,N(n,{shape:o,checks:[]}))}function Ir(e,t){if(!G(t))throw new Error("Invalid input to extend: expected a plain object");const n=e._zod.def.checks;if(n&&n.length>0){const i=x(e);for(const s of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(i,s)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return K(e,N(e._zod.def,{shape:St(e,t)}))}function St(e,t){const n={};return q(n,e,Reflect.ownKeys(x(e))),br(n,t),n}function Tr(e,t){if(!G(t))throw new Error("Invalid input to safeExtend: expected a plain object");return K(e,N(e._zod.def,{shape:St(e,t)}))}function Pr(e,t){if(!t?._zod?.def)throw new Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");const n={};q(n,e,Reflect.ownKeys(x(e))),q(n,t,Reflect.ownKeys(x(t)));const r=N(e._zod.def,{shape:n,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return K(e,r)}function $t(e,t,n,r="partial"){const s=t._zod.def.checks;if(s&&s.length>0)throw new Error(`.${r}() cannot be used on object schemas containing refinements`);const c=n?new Set(me(t,n)):void 0,a={};return q(a,t,Reflect.ownKeys(x(t)),e&&((u,l)=>c&&!c.has(l)?u:new e({type:"optional",innerType:u}))),K(t,N(t._zod.def,{shape:a,checks:[]}))}function Zr(e,t,n){const r=n?new Set(me(t,n)):void 0,i={};return q(i,t,Reflect.ownKeys(x(t)),(s,o)=>r&&!r.has(o)?s:new e({type:"nonoptional",innerType:s})),K(t,N(t._zod.def,{shape:i}))}function L(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n{var r;return(r=n).path??(r.path=[]),n.path.unshift(e),n})}function re(e){return typeof e=="string"?e:e?.message}function Ot(e){const t=[];for(const n of e??[]){const r=n._zod.def;if(!/_(length|size)$|_equals$/.test(r.check))break;const i=r.maximum??r.length??r.size;i>=0&&t.push([i,n])}return t}function Ce(e,t,n){var r;for(let i=t;ie;return t[Dr]=!0,t}var Tt;const Ke={value:void 0,enumerable:!1};let Pt="captureStackTrace"in Error?Error:null;function Ur(e){const t=Pt;if(t){const n=t.stackTraceLimit;if(typeof n=="number"){try{t.stackTraceLimit=0}catch{return Pt=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}function f(e,t,n,r){const i={};function s(p){this.def=p,this.constr=h,this.traits=new Set}s.prototype=i;const o=n,c=o&&new WeakSet;function a(p,d){if(p._zod){if(p._zod.traits.has(e))return}else{Ke.value=new s(d);try{Object.defineProperty(p,"_zod",Ke)}finally{Ke.value=void 0}}if(p._zod.traits.add(e),t(p,d),c){const g=Object.getPrototypeOf(p),v=p._zod.constr.prototype;let b=g;for(;b&&b!==v;)b=Object.getPrototypeOf(b);const A=b??g;c.has(A)||(c.add(A),jr(A,o))}const m=h.prototype;for(const g in m)Object.prototype.hasOwnProperty.call(m,g)&&(g in p||(p[g]=m[g].bind(p)))}const u=r?.Parent??Object;class l extends u{}Object.defineProperty(l,"name",{value:e});function h(p){const d=r?.Parent?Ur(l):this;a(d,p);const m=d._zod.deferred;if(m){for(const v of m)v();d._zod.deferred=void 0}const g=globalThis.__zod_globalConfig?.postProcessor;return g&&g(d),d}return Object.defineProperty(h,"init",{value:a}),Object.defineProperty(h,Symbol.hasInstance,{value:p=>r?.Parent&&p instanceof r.Parent?!0:p?._zod?.traits?.has(e)}),Object.defineProperty(h,"name",{value:e}),h}class H extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Zt extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}(Tt=globalThis).__zod_globalConfig??(Tt.__zod_globalConfig={});const R=globalThis.__zod_globalConfig;function F(e){return e&&Object.assign(R,e),R}function Kr(){const e=this._zod;return e.message??(e.message=JSON.stringify(e.def,Me,2)),e.message}function Jr(e){this._zod.message=e}const Br={get:Kr,set:Jr,enumerable:!0,configurable:!0},Je={value:void 0,enumerable:!1},At=new WeakSet([Object.prototype,Error.prototype]),Vr=f("$ZodError",(e,t)=>{e.name="$ZodError",Je.value=t,Object.defineProperty(e,"issues",Je),Je.value=void 0,Object.defineProperty(e,"message",Br);const n=Object.getPrototypeOf(e);At.has(n)||(At.add(n),Object.defineProperty(n,"toString",{configurable:!0,enumerable:!1,get(){const r=()=>this.message;return Object.defineProperty(this,"toString",{value:r,configurable:!0,writable:!0}),r},set(r){Object.defineProperty(this,"toString",{value:r,configurable:!0,writable:!0})}}))});function Wr(e,t,n){return Object.prototype.hasOwnProperty.call(e,t)||(t==="__proto__"?Object.defineProperty(e,t,{value:n(),writable:!0,enumerable:!0,configurable:!0}):e[t]=n()),e[t]}function qr(e,t=n=>n.message){const n={},r=[];for(const i of e.issues)i.path.length>0?Wr(n,i.path[0],()=>[]).push(t(i)):r.push(t(i));return{formErrors:r,fieldErrors:n}}function Hr(e,t=n=>n.message){const n={_errors:[]},r=(i,s=[])=>{for(const o of i.issues)if(o.code==="invalid_union"&&o.errors.length)o.errors.map(c=>r({issues:c},[...s,...o.path]));else if(o.code==="invalid_key")r({issues:o.issues},[...s,...o.path]);else if(o.code==="invalid_element")r({issues:o.issues},[...s,...o.path]);else{const c=[...s,...o.path];if(c.length===0)n._errors.push(t(o));else{let a=n,u=0;for(;u{const t=(n,r,i,s)=>{const o=i?{...i,async:!1}:{async:!1},c=n._zod.run({value:r,issues:[]},o);if(c instanceof Promise)throw new H;if(c.issues.length){const a=new(s?.Err??e)(c.issues.map(u=>B(u,o,F())));throw yt(a,s?.callee??t),a}return c.value};return t},Ve=e=>{const t=async(n,r,i,s)=>{const o=i?{...i,async:!0}:{async:!0};let c=n._zod.run({value:r,issues:[]},o);if(c instanceof Promise&&(c=await c),c.issues.length){const a=new(s?.Err??e)(c.issues.map(u=>B(u,o,F())));throw yt(a,s?.callee??t),a}return c.value};return t},We=e=>(t,n,r)=>{const i=r?{...r,async:!1}:{async:!1},s=t._zod.run({value:n,issues:[]},i);if(s instanceof Promise)throw new H;return s.issues.length?Nt(e,s.issues,i):{success:!0,data:s.value}};function Nt(e,t,n){let r;return{success:!1,get error(){return r||(r=new e(t.map(i=>B(i,n,F()))),t=void 0,n=void 0),r},set error(i){r=i,t=void 0,n=void 0}}}const qe=e=>async(t,n,r)=>{const i=r?{...r,async:!0}:{async:!0};let s=t._zod.run({value:n,issues:[]},i);return s instanceof Promise&&(s=await s),s.issues.length?Nt(e,s.issues,i):{success:!0,data:s.value}},Gr=Symbol.for("zod.compile.invalid"),Yr=Symbol.for("zod.compile.fallback"),Xr=((e,t,n)=>{const r=e._zod.bag.validator;if(r!==void 0){if(r(t)!==Gr)return!0;if(r.definite===!0&&n===void 0)return!1}return Qr(e,t,n)});function Qr(e,t,n){const r=n?{...n,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},i=e._zod.bag.fallbackRun;let s;if(i?(r[Yr]=!0,s=i({value:t,issues:[]},r)):s=e._zod.run({value:t,issues:[]},r),s instanceof Promise)throw new H;return s.issues.length===0}const ei=async(e,t,n)=>{const r=n?{...n,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0};let i=e._zod.run({value:t,issues:[]},r);return i instanceof Promise&&(i=await i),i.issues.length===0},ti=e=>{const t=Be(e),n=(r,i,s,o)=>{const c=s?{...s,direction:"backward"}:{direction:"backward"};return t(r,i,c,ge(n,o))};return n},ni=e=>{const t=Be(e),n=(r,i,s,o)=>t(r,i,s,ge(n,o));return n},ri=e=>{const t=Ve(e),n=async(r,i,s,o)=>{const c=s?{...s,direction:"backward"}:{direction:"backward"};return await t(r,i,c,ge(n,o))};return n},ii=e=>{const t=Ve(e),n=async(r,i,s,o)=>await t(r,i,s,ge(n,o));return n},si=e=>(t,n,r)=>{const i=r?{...r,direction:"backward"}:{direction:"backward"};return We(e)(t,n,i)},oi=e=>(t,n,r)=>We(e)(t,n,r),ci=e=>async(t,n,r)=>{const i=r?{...r,direction:"backward"}:{direction:"backward"};return qe(e)(t,n,i)},ai=e=>async(t,n,r)=>qe(e)(t,n,r),ui=/^[cC][0-9a-z]{6,}$/,li=/^[0-9a-z]+$/,fi=)DELIM" -R"DELIM(/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,hi=/^[0-9a-vA-V]{20}$/,di=/^[A-Za-z0-9]{27}$/,pi=/^[a-zA-Z0-9_-]{21}$/;function mi(e){return new RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}const gi=/^P(?:(\\d+W)|(?!.*W)(?=\\d|T\\d)(\\d+Y)?(\\d+M)?(\\d+D)?(T(?=\\d)(\\d+H)?(\\d+M)?(\\d+([.,]\\d+)?S)?)?)$/,_i=/^([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})$/,Rt=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)$/,vi=/^(?:[A-Za-z0-9_\'+\\-]+\\.)*[A-Za-z0-9_\'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$/,bi="^(?=[\\\\s\\\\S]*[\\\\p{Extended_Pictographic}\\\\p{Regional_Indicator}\\\\u20E3])[\\\\p{Extended_Pictographic}\\\\p{Emoji_Component}]+$";function yi(){return new RegExp(bi,"u")}const wi=/^(?:(?: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])$/,ki=/^(([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}|:))$/,zi=/^((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])$/,Si=/^(([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}|:))\\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,$i=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Oi=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/,Ei=/^https?$/,Ii=/^\\+[1-9]\\d{6,14}$/,jt="(?:(?:\\\\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])))";function Ti(e){return new RegExp(`^${e}$`)}const Pi=Ti(jt);function He(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}}`:e.seconds?`${t}:[0-5]\\\\d(?:\\\\.\\\\d+)?`:`${t}(?::[0-5]\\\\d(?:\\\\.\\\\d+)?)?`}function Zi(e){return new RegExp(`^${He(e)}$`)}function Ai(e){const t=["Z"];e.offset&&t.push("([+-](?:[01]\\\\d|2[0-3]):[0-5]\\\\d)");const n=`${He({precision:e.precision,seconds:!0})}(?:${t.join("|")})`,r=e.local?`${n}|${He({precision:e.precision})}`:n;return new RegExp(`^${jt}T(?:${r})$`)}const Ni=/^[\\s\\S]{0,}$/,Ri=/^-?\\d+$/,Ge=/^-?\\d+(?:\\.\\d+)?$/,ji=/^(?:true|false)$/i,Mi=/^[^A-Z]*$/,Li=/^[^a-z]*$/,Z=f("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Ye=e=>{const t=e.value;return!_r(t)&&t.length!==void 0},_e={number:"number",bigint:"bigint",object:"date"},Mt=f("$ZodCheckLessThan",(e,t)=>{Z.init(e,t);const n=_e[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value{Z.init(e,t);const n=_e[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:_e[typeof r.value]??n,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Fi=f("$ZodCheckMultipleOf",(e,t)=>{Z.init(e,t),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof n.value=="bigint"?t.value!==BigInt(0)&&n.value%t.value===BigInt(0):vr(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),Ci=f("$ZodCheckNumberFormat",(e,t)=>{Z.init(e,t),t.format=t.format||"float64";const n=t.format?.includes("int"),r=n?"int":"number",[i,s]=zt[t.format];e._zod.check=o=>{const c=o.value;if(n){if(!Number.isInteger(c)){o.issues.push({expected:r,format:t.format,code:"invalid_type",continue:!1,input:c,inst:e});return}if(!Number.isSafeInteger(c)){c>0?o.issues.push({input:c,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}):o.issues.push({input:c,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}}cs&&o.issues.push({origin:"number",input:c,code:"too_big",maximum:s,inclusive:!0,inst:e,continue:!t.abort})}}),Di=f("$ZodCheckMaxLength",(e,t)=>{var n;Z.init(e,t),(n=e._zod.def).when??(n.when=Ye),e._zod.check=r=>{const i=r.value,s=i.length;if((typeof i=="string"&&s>t.maximum?De(i):s)<=t.maximum)return;const c=xe(i);r.issues.push({origin:c,code:"too_big",maximum:t.maximum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),xi=f("$ZodCheckMinLength",(e,t)=>{var n;Z.init(e,t),(n=e._zod.def).when??(n.when=Ye),e._zod.check=r=>{const i=r.value,s=i.length;if((typeof i=="string"&&s>=t.minimum&&s=t.minimum)return;const c=xe(i);r.issues.push({origin:c,code:"too_small",minimum:t.minimum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),Ui=f("$ZodCheckLengthEquals",(e,t)=>{var n;Z.init(e,t),(n=e._zod.def).when??(n.when=Ye),e._zod.check=r=>{const i=r.value,s=i.length,o=typeof i=="string"&&s>=t.length&&s<=t.length*2?De(i):s;if(o===t.length)return;const c=xe(i),a=o>t.length;r.issues.push({origin:c,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),ve=f("$ZodCheckStringFormat",(e,t)=>{var n,r;Z.init(e,t),t.pattern?(n=e._zod).check??(n.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=()=>{})}),Ki=f("$ZodCheckRegex",(e,t)=>{ve.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Ji=f("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Mi),ve.init(e,t)}),Bi=f("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Li),ve.init(e,t)}),Vi=f("$ZodCheckIncludes",(e,t)=>{Z.init(e,t);const n=pe(t.includes),r=new RegExp(typeof t.position=="number"?`^.{${t.position},}${n}`:n);t.pattern=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})}}),Wi=f("$ZodCheckStartsWith",(e,t)=>{Z.init(e,t);const n=new RegExp(`^${pe(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.check=r=>{r.value.startsWith(t.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:r.value,inst:e,continue:!t.abort})}}),qi=f("$ZodCheckEndsWith",(e,t)=>{Z.init(e,t);const n=new RegExp(`.*${pe(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.check=r=>{r.value.endsWith(t.suffix)||r.issues.push({origin:"string",code:"invalid_format",fo)DELIM" -R"DELIM(rmat:"ends_with",suffix:t.suffix,input:r.value,inst:e,continue:!t.abort})}}),Hi=f("$ZodCheckOverwrite",(e,t)=>{Z.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class Gi{constructor(t=[],n={}){this.content=[],this.indent=0,this.args=t,this.closed=n}indented(t){this.indent+=1;try{t(this)}finally{this.indent-=1}}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const r=t.split(`\n`).filter(o=>o),i=Math.min(...r.map(o=>o.length-o.trimStart().length)),s=r.map(o=>o.slice(i)).map(o=>" ".repeat(this.indent*2)+o);for(const o of s)this.content.push(o)}compile(){const t=Function,n=this?.content??[""];return new t(...Object.keys(this.closed),`return function (${this.args.join(", ")}) {\n${n.join(`\n`)}\n};`)(...Object.values(this.closed))}}const Yi={major:4,minor:6,patch:7},k=f("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Yi;const r=e._zod.def.checks,i=e._zod.traits.has("$ZodCheck")?[e,...r??[]]:r?.length?[...r]:[];for(const s of i)for(const o of s._zod.onattach)o(e);if(i.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const s=(c,a,u)=>{if(c.memo)return c;let l=L(c),h;for(const p of a){if(p._zod.def.when){if(Ar(c)||!p._zod.def.when(c))continue}else if(l)continue;const d=c.issues.length,m=p._zod.check(c);if(m instanceof Promise&&u?.async===!1)throw new H;if(h||m instanceof Promise)h=(h??Promise.resolve()).then(async()=>{await m,c.issues.length!==d&&(Ce(c.issues,d,e),l||(l=L(c,d)))});else{if(c.issues.length===d)continue;Ce(c.issues,d,e),l||(l=L(c,d))}}return h?h.then(()=>c):c},o=(c,a,u)=>{if(L(c))return c.aborted=!0,c;const l=s(a,i,u);if(l instanceof Promise){if(u.async===!1)throw new H;return l.then(h=>e._zod.parse(h,u))}return e._zod.parse(l,u)};e._zod.run=(c,a)=>{if(a.skipChecks)return e._zod.parse(c,a);if(a.direction==="backward"){const l=e._zod.parse({value:c.value,issues:[]},{...a,skipChecks:!0});return l instanceof Promise?l.then(h=>o(h,c,a)):o(l,c,a)}const u=e._zod.parse(c,a);if(u instanceof Promise){if(a.async===!1)throw new H;return u.then(l=>s(l,i,a))}return s(u,i,a)}}},{get"~standard"(){return Et(this,"~standard",Ct(this))},set"~standard"(e){V(this,"~standard",e)}}),Ft=(e,t)=>e.issues.length?{issues:e.issues.map(n=>B(n,t,F()))}:{value:e.value};async function Xi(e,t){const n={async:!0};return Ft(await e._zod.run({value:t,issues:[]},n),n)}function Ct(e){return{validate:t=>{const n={async:!1};try{const r=e._zod.run({value:t,issues:[]},n);if(!(r instanceof Promise))return Ft(r,n)}catch{}return Xi(e,t)},vendor:"zod",version:1}}const Xe=f("$ZodString",(e,t)=>{k.init(e,t),e._zod.pattern=t.pattern??Ni,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value=="string"||n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}}),z=f("$ZodStringFormat",(e,t)=>{ve.init(e,t),Xe.init(e,t)}),Qi=f("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=_i),z.init(e,t)}),es=f("$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=Rt(r))}else t.pattern??(t.pattern=Rt());z.init(e,t)}),ts=f("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=vi),z.init(e,t)}),Dt=1,be=2;function xt(e){try{return typeof URL<"u"&&typeof URL.canParse=="function"?URL.canParse(e):(new URL(e),!0)}catch{return!1}}function ns(e,t){return!("normalize"in t)&&!("hostname"in t)&&!("protocol"in t)?xt(e)||be:rs(e,t)}function rs(e,t){if(!t.normalize&&t.protocol?.source===Ei.source&&!/^https?:\\/\\//i.test(e))return Dt;try{if(typeof URL<"u"){const n=URL;if(typeof n.parse=="function")return n.parse(e)??be}return new URL(e)}catch{return be}}const is=/[\\t\\n\\r]/g;function Ut(e){return e.replace(is,"")}function ss(e,t){return t.lastIndex=0,t.test(e.hostname)}function os(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(":")?e.protocol.slice(0,-1):e.protocol)}const cs=f("$ZodURL",(e,t)=>{z.init(e,t),e._zod.check=n=>{try{const r=n.value.trim(),i=ns(r,t);if(i===Dt){n.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:n.value,inst:e,continue:!t.abort});return}if(i===be){n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort});return}if(i===!0){n.value=Ut(r);return}t.hostname&&!ss(i,t.hostname)&&n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort}),t.protocol&&!os(i,t.protocol)&&n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort}),n.value=t.normalize?i.href:Ut(r);return}catch{n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),as=f("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=yi()),z.init(e,t)}),us=f("$ZodNanoID",(e,t)=>{if(t.length!==void 0&&(!Number.isInteger(t.length)||t.length<1))throw new Error(`Invalid nanoid length: ${t.length}`);t.pattern??(t.pattern=t.length===void 0?pi:mi(t.length)),z.init(e,t)}),ls=f("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=ui),z.init(e,t)}),fs=f("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=li),z.init(e,t)}),hs=f("$ZodULID",(e,t)=>{t.pattern??(t.pattern=fi),z.init(e,t)}),ds=f("$ZodXID",(e,t)=>{t.pattern??(t.pattern=hi),z.init(e,t)}),ps=f("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=di),z.init(e,t)}),ms=f("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=Ai(t)),z.init(e,t)}),gs=f("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Pi),z.init(e,t)}),_s=f("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Zi(t)),z.init(e,t)}),vs=f("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=gi),z.init(e,t)}),bs=f("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=wi),z.init(e,t)}),ys=/^[0-9a-fA-F:.]+$/;function Kt(e){return ys.test(e)?xt(`http://[${e}]`):!1}const ws=f("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=ki),z.init(e,t),e._zod.check=n=>{Kt(n.value)||n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}),ks=f("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=zi),z.init(e,t)});function zs(e){const t=e.split("/");if(t.length!==2)return!1;const[n,r]=t;if(!r)return!1;const i=Number(r);return`${i}`!==r||i<0||i>128?!1:Kt(n)}const Ss=f("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Si),z.init(e,t),e._zod.check=n=>{zs(n.value)||n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}});function Jt(e){if(e==="")return!0;if(/\\s/.test(e)||e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const Bt=/^[0-9a-zA-Z+/]*={0,2}$/,$s=f("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Bt),z.init(e,t),e._zod.check=n=>{Jt(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}}),Qe=/^[A-Za-z0-9_-]*$/;function Os(e){if(!Qe.test(e))return!1;const t=e.replace(/[-_]/g,r=>r==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return Jt(n)}const Es=f("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Qe),z.init(e,t),e._zod.check=n=>{Os(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),Is=f("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Ii),z.init(e,t)});function Ts(e,t=null){try{const n=e.split(".");if(n.length!==3)return!1;const[r]=n;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 Ps=f("$ZodJWT",(e,t)=>{z.init(e,t),e._zod.check=n=>{Ts(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),Vt=f("$ZodNumber",(e,t)=>{k.init(e,t),e._zod.pattern=Ge,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}const i=n.value;if(typeof i=="number"&&!Number.isNaN(i)&&Number.isFinite(i))return n;const s=typeof i=="number"?Number.isNaN(i)?"NaN":Number.isFinite(i)?void 0:String(i):void 0;return n.issues.push({expected:"number",code:"invalid_type",input:i,inst:e,...)DELIM" -R"DELIM(s?{received:s}:{}}),n}}),Zs=f("$ZodNumberFormat",(e,t)=>{Ci.init(e,t),Vt.init(e,t)}),As=f("$ZodBoolean",(e,t)=>{k.init(e,t),e._zod.pattern=ji,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}const i=n.value;return typeof i=="boolean"||n.issues.push({expected:"boolean",code:"invalid_type",input:i,inst:e}),n}}),Ns=f("$ZodUnknown",(e,t)=>{k.init(e,t),e._zod.parse=n=>n}),Rs=f("$ZodNever",(e,t)=>{k.init(e,t),e._zod.parse=(n,r)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)});function js(e,t){const n=Ot(e._zod.def.checks);if(!n.length)return;const r=Math.min(...n.map(s=>s[0])),i=e._zod.parse;e._zod.parse=(s,o)=>{const c=t(s.value);if(c>r&&!o?.skipChecks&&o?.direction!=="backward"){for(const[a,u]of Ot(e._zod.def.checks))if(c>a&&u._zod.def.when(s)){const l=s.issues.length;return u._zod.check(s),s.issues[l].continue=!1,Ce(s.issues,l,e),s}}return i(s,o)}}const Ms=e=>Array.isArray(e)?e.length:-1;function Wt(e,t,n){e.issues.length&&t.issues.push(...J(n,e.issues)),t.value[n]=e.value}const Ls=f("$ZodArray",(e,t)=>{k.init(e,t);const n=R.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{const s=r.value;if(!Array.isArray(s))return r.issues.push({expected:"array",code:"invalid_type",input:s,inst:e}),r;r.value=n?n.alloc(e,r,Array(s.length),i):Array(s.length);const o=[],c=i?.abortEarly;for(let a=0;aWt(h,r,a)));else if(Wt(l,r,a),c&&l.issues.length!==0&&L(l))break}return o.length?Promise.all(o).then(()=>r):r},js(e,Ms)});function ye(e,t,n,r,i,s){const o=n in r,c=s==="optional";if(!(!o&&c&&i==="optional")){if(e.issues.length){if(i!==void 0&&c&&!o)return;t.issues.push(...J(n,e.issues))}if(!o&&i===void 0){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[n]});return}e.value===void 0?(o||i==="defaulted"&&!c)&&(t.value[n]=void 0):t.value[n]=e.value}}const Fs=[];function qt(e){const t=Object.keys(e.shape),n=Object.getOwnPropertySymbols(e.shape),r=n.length?n:Fs,i=r.length?[...t,...r]:t;for(const o of i)if(!e.shape?.[o]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${String(o)}": expected a Zod schema`);const s=Sr(e.shape);return{...e,allKeys:i,symbolKeys:r,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(s)}}function Ht(e,t,n,r,i,s,o){const c=[],a=i.keySet,u=i.catchall._zod,l=u.def.type,h=u.optin,p=u.optout;let d=0;for(const m in t){if(o&&n.issues.length!==d){if(L(n,d))break;d=n.issues.length}if(a.has(m))continue;if(m==="__proto__"){l==="never"&&c.push(m);continue}if(l==="never"){c.push(m);continue}const g=u.run({value:t[m],issues:[]},r);g instanceof Promise?e.push(g.then(v=>ye(v,n,m,t,h,p))):ye(g,n,m,t,h,p)}return c.length&&n.issues.push({code:"unrecognized_keys",keys:c,input:t,inst:s,continue:!0}),e.length?Promise.all(e).then(()=>n):n}const Cs=f("$ZodObject",(e,t)=>{k.init(e,t);const n=Object.getOwnPropertyDescriptor(t,"shape"),r=n?.get?n.get.raw:t.shape??{};if(r){const u=()=>{const l={...r};return Object.defineProperty(t,"shape",{value:l}),u.raw=l,l};u.raw=r,Object.defineProperty(t,"shape",{get:u})}const i=Le(()=>qt(t));y(e,"propValues",u=>{const l=u.def.shape,h={};for(const p in l){const d=l[p]._zod;if(d.values){Object.prototype.hasOwnProperty.call(h,p)||U(h,p,new Set);for(const m of d.values)h[p].add(m);d.optin!==void 0&&h[p].add(void 0)}}return h});const s=de,o=t.catchall;let c;const a=R.memoizer;a?.attach(e),e._zod.parse=(u,l)=>{c??(c=i.value);const h=u.value;if(!s(h))return u.issues.push({expected:"object",code:"invalid_type",input:h,inst:e}),u;u.value=a?a.alloc(e,u,{},l):{};const p=[],d=c.shape,m=l?.abortEarly;let g=u.issues.length;for(const v of c.allKeys){if(m&&u.issues.length!==g){if(L(u,g))break;g=u.issues.length}if(v==="__proto__")continue;const b=d[v],A=b._zod.optin,fe=b._zod.optout,he=b._zod.run({value:h[v],issues:[]},l);he instanceof Promise?p.push(he.then(I=>ye(I,u,v,h,A,fe))):ye(he,u,v,h,A,fe)}return o?Ht(p,h,u,l,i.value,e,m===!0):p.length?Promise.all(p).then(()=>u):u}}),Ds=f("$ZodObjectJIT",(e,t)=>{Cs.init(e,t);const n=e._zod.parse,r=Le(()=>qt(t)),i=R.memoizer,s=d=>{const m=r.value,g=m.symbolKeys,v=new Gi(["payload","ctx"],{shape:d,inst:e,memo:i,syms:g}),b=I=>`shape[${I}]._zod.run({ value: input[${I}], issues: [] }, ctx)`,A=(I,w)=>`\n let ${I}_ab = false;\n for (let i = 0; i < ${I}.issues.length; i++) {\n const iss = ${I}.issues[i];\n iss.path = iss.path ? [${w}, ...iss.path] : [${w}];\n payload.issues.push(iss);\n if (iss.continue !== true) ${I}_ab = true;\n }\n if (${I}_ab && ctx && ctx.abortEarly) {\n payload.value = newResult;\n return payload;\n }`;v.write("const input = payload.value;");const fe=Object.create(null);let he=0;for(const I of m.allKeys)fe[I]=`key_${he++}`;v.write(i?"const newResult = memo.alloc(inst, payload, {}, ctx);":"const newResult = {};");for(const I of m.allKeys){if(I==="__proto__")continue;const w=fe[I],D=typeof I=="symbol"?`syms[${g.indexOf(I)}]`:yr(I),pt=`${D} in input`,pr=d[I],mt=pr?._zod?.optin,mr=mt!==void 0,Ru=pr?._zod?.optout==="optional";if(v.write(`const ${w} = ${b(D)};`),mr&&Ru){const ju=mt==="optional"?`${w}_present`:`${w}.value !== undefined || ${w}_present`;v.write(`\n const ${w}_present = ${pt};\n if (!${w}.issues.length || ${w}_present) {\n if (${w}.issues.length) {${A(w,D)}\n }\n\n if (${ju}) {\n newResult[${D}] = ${w}.value;\n }\n }\n\n `)}else mr?(v.write(`\n if (${w}.issues.length) {${A(w,D)}\n }\n `),mt==="defaulted"?v.write(`newResult[${D}] = ${w}.value;`):v.write(`\n if (${w}.value !== undefined || ${pt}) {\n newResult[${D}] = ${w}.value;\n }\n `)):v.write(`\n const ${w}_present = ${pt};\n if (${w}.issues.length) {${A(w,D)}\n }\n if (!${w}_present && !${w}.issues.length) {\n payload.issues.push({\n code: "invalid_type",\n expected: "nonoptional",\n input: undefined,\n path: [${D}]\n });\n if (ctx && ctx.abortEarly) {\n payload.value = newResult;\n return payload;\n }\n }\n\n if (${w}_present) {\n newResult[${D}] = ${w}.value;\n }\n\n `)}return v.write("payload.value = newResult;"),v.write("return payload;"),v.compile()};let o;const c=de,a=!R.jitless,l=a&&kr.value,h=t.catchall;let p;e._zod.parse=(d,m)=>{p??(p=r.value);const g=d.value;return c(g)?a&&l&&m?.async===!1&&m.jitless!==!0?(o||(o=s(t.shape)),d=o(d,m),h?Ht([],g,d,m,p,e,m?.abortEarly===!0):d):n(d,m):(d.issues.push({expected:"object",code:"invalid_type",input:g,inst:e}),d)}});function Gt(e,t,n,r){for(const s of e)if(s.issues.length===0)return t.value=s.value,t;const i=e.filter(s=>!L(s));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(s=>s.issues.map(o=>B(o,r,F())))}),t)}const xs=f("$ZodUnion",(e,t)=>{k.init(e,t),y(e,"optin",r=>r.def.options.some(i=>i._zod.optin==="defaulted")?"defaulted":r.def.options.some(i=>i._zod.optin!==void 0)?"optional":void 0),y(e,"optout",r=>r.def.options.some(i=>i._zod.optout==="optional")?"optional":void 0),y(e,"values",r=>{if(r.def.options.every(i=>i._zod.values))return new Set(r.def.options.flatMap(i=>Array.from(i._zod.values)))}),y(e,"pattern",r=>{if(r.def.options.every(i=>i._zod.pattern)){const i=r.def.options.map(s=>s._zod.pattern);return new RegExp(`^(${i.map(s=>Fe(s.source)).join("|")})$`)}});const n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let s=!1;const o=[];for(const c of t.options){const a=c._zod.run({value:r.value,issues:[]},i);if(a instanceof Promise)o.push(a),s=!0;else{if(a.issues.length===0)return a;o.push(a)}}return s?Promise.all(o).then(c=>Gt(c,r,e,i)):Gt(o,r,e,i)}}),Us=f("$ZodIntersect)DELIM" -R"DELIM(ion",(e,t)=>{k.init(e,t),e._zod.parse=(n,r)=>{const i=n.value,s=t.left._zod.run({value:i,issues:[]},r),o=t.right._zod.run({value:i,issues:[]},r);return s instanceof Promise||o instanceof Promise?Promise.all([s,o]).then(([a,u])=>Yt(n,a,u)):Yt(n,s,o)}});function et(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(G(e)&&G(t)){const n=Object.keys(t),r=Object.keys(e).filter(s=>n.indexOf(s)!==-1),i={...e,...t};Object.prototype.hasOwnProperty.call(i,"__proto__")&&delete i.__proto__;for(const s of r){if(s==="__proto__")continue;const o=et(e[s],t[s]);if(!o.valid)return{valid:!1,mergeErrorPath:[s,...o.mergeErrorPath]};i[s]=o.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let r=0;r{let h;if(u.code==="unrecognized_keys"&&!u.path?.length)i??(i=u),h=u.keys;else if(u.code==="invalid_key"&&u.origin==="record"&&u.path?.length===1){const p=String(u.path[0]);s.has(p)||s.set(p,u),h=[p]}else return!1;for(const p of h)r.has(p)||r.set(p,{}),r.get(p)[l]=!0;return!0};for(const u of t.issues)o(u,"l")||e.issues.push(u);for(const u of n.issues)o(u,"r")||e.issues.push(u);const c=[...r].filter(([,u])=>u.l&&u.r).map(([u])=>u);if(c.length){const u=i?c.filter(l=>i.keys.includes(l)):[];u.length&&e.issues.push({...i,keys:u});for(const l of c)!u.includes(l)&&s.has(l)&&e.issues.push(s.get(l))}const a=et(t.value,n.value);if(!a.valid){if(L(e))return e;throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(a.mergeErrorPath)}`)}return e.value=a.data,e}const Ks=f("$ZodTuple",(e,t)=>{k.init(e,t);const n=t.items,r=R.memoizer;r?.attach(e),e._zod.parse=(i,s)=>{const o=i.value;if(!Array.isArray(o))return i.issues.push({input:o,inst:e,expected:"tuple",code:"invalid_type"}),i;i.value=r?r.alloc(e,i,[],s):[];const c=[],a=Xt(n,"optin"),u=Xt(n,"optout");if(!t.rest){if(o.lengthn.length&&i.issues.push({code:"too_big",maximum:n.length,inclusive:!0,input:o,inst:e,origin:"array"})}const l=new Array(n.length),h=t.rest?s?.abortEarly:void 0;let p=!1;for(let d=0;d{l[d]=g})):(l[d]=m,h&&!p&&m.issues.length&&(p=L(m)))}if(t.rest&&!p){let d=n.length-1;const m=o.slice(n.length);let g=i.issues.length;for(const v of m){if(h&&i.issues.length!==g){if(L(i,g))break;g=i.issues.length}d++;const b=t.rest._zod.run({value:v,issues:[]},s);b instanceof Promise?c.push(b.then(A=>Qt(A,i,d))):Qt(b,i,d)}}return c.length?Promise.all(c).then(()=>en(l,i,n,o,u)):en(l,i,n,o,u)}});function Xt(e,t){for(let n=e.length-1;n>=0;n--)if(!(t==="optin"?e[n]._zod.optin!==void 0:e[n]._zod.optout==="optional"))return n+1;return 0}function Qt(e,t,n){e.issues.length&&t.issues.push(...J(n,e.issues)),t.value[n]=e.value}function en(e,t,n,r,i){for(let s=0;s=i&&n[s]._zod.optin==="optional"){t.value.length=s;break}if(o.issues.length){if(!c&&s>=i){t.value.length=s;break}t.issues.push(...J(s,o.issues))}t.value[s]=o.value}for(let s=t.value.length-1;s>=r.length&&(n[s]._zod.optout==="optional"&&t.value[s]===void 0);s--)t.value.length=s;return t}const Js=f("$ZodRecord",(e,t)=>{k.init(e,t);const n=R.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{const s=r.value;if(!G(s))return r.issues.push({expected:"record",code:"invalid_type",input:s,inst:e}),r;const o=[],c=t.keyType._zod.values;if(c&&!t.partial){r.value=n?n.alloc(e,r,{},i):{};const a=new Set;for(const l of c)if(typeof l=="string"||typeof l=="number"||typeof l=="symbol"){if(a.add(typeof l=="number"?l.toString():l),l==="__proto__")continue;const h=t.keyType._zod.run({value:l,issues:[]},i);if(h instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(h.issues.length){r.issues.push({code:"invalid_key",origin:"record",issues:h.issues.map(m=>B(m,i,F())),input:l,path:[l],inst:e});continue}const p=h.value;if(p==="__proto__")continue;const d=t.valueType._zod.run({value:s[l],issues:[]},i);d instanceof Promise?o.push(d.then(m=>{m.issues.length&&r.issues.push(...J(l,m.issues)),r.value[p]=m.value})):(d.issues.length&&r.issues.push(...J(l,d.issues)),r.value[p]=d.value)}let u;for(const l in s)if(!a.has(l))if(t.mode==="loose"){if(l==="__proto__")continue;r.value[l]=s[l]}else u=u??[],u.push(l);u&&u.length>0&&r.issues.push({code:"unrecognized_keys",input:s,inst:e,keys:u,continue:!0})}else{r.value=n?n.alloc(e,r,{},i):{};let a;for(const u of Reflect.ownKeys(s)){if(u==="__proto__"||!Object.prototype.propertyIsEnumerable.call(s,u))continue;let l=t.keyType._zod.run({value:u,issues:[]},i);if(l instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof u=="string"&&Ge.test(u)&&l.issues.length){const m=t.keyType._zod.run({value:Number(u),issues:[]},i);if(m instanceof Promise)throw new Error("Async schemas not supported in object keys currently");m.issues.length===0&&(l=m)}if(l.issues.length){t.mode==="loose"?r.value[u]=s[u]:c?(a=a??[],a.push(u)):r.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map(m=>B(m,i,F())),input:u,path:[u],inst:e});continue}const p=l.value;if(p==="__proto__")continue;const d=t.valueType._zod.run({value:s[u],issues:[]},i);d instanceof Promise?o.push(d.then(m=>{m.issues.length&&r.issues.push(...J(u,m.issues)),r.value[p]=m.value})):(d.issues.length&&r.issues.push(...J(u,d.issues)),r.value[p]=d.value)}a&&a.length>0&&r.issues.push({code:"unrecognized_keys",input:s,inst:e,keys:a,continue:!0})}return o.length?Promise.all(o).then(()=>r):r}}),Bs=f("$ZodEnum",(e,t)=>{k.init(e,t);const n=je(t.entries),r=new Set(n);e._zod.values=r,y(e,"pattern",i=>{const s=je(i.def.entries).filter(o=>zr.has(typeof o));return new RegExp(s.length?`^(${s.map(o=>pe(o.toString())).join("|")})$`:"^[^\\\\s\\\\S]$")}),e._zod.parse=(i,s)=>{const o=i.value;return r.has(o)||i.issues.push({code:"invalid_value",values:n,input:o,inst:e}),i}}),Vs=f("$ZodTransform",(e,t)=>{k.init(e,t),e._zod.optin="optional",R.memoizer?.guard(e),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new Zt(e.constructor.name);const i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(o=>(n.value=o,n));if(i instanceof Promise)throw new H;return n.value=i,n}});function tn(e,t){return e.value=t.issues.length?void 0:t.value,e}const nn=f("$ZodOptional",(e,t)=>{k.init(e,t),y(e,"optin",n=>n.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),e._zod.optout="optional",y(e,"values",n=>{const r=n.def.innerType._zod.values;return r?new Set([...r,void 0]):void 0}),y(e,"pattern",n=>{const r=n.def.innerType._zod.pattern;return r?new RegExp(`^(${Fe(r.source)})?$`):void 0}),e._zod.parse=(n,r)=>{if(n.value===void 0){if(t.innerType._zod.optin!=="defaulted")return n;const i=t.innerType._zod.run({value:n.value,issues:[]},r);return i instanceof Promise?i.then(s=>tn(n,s)):tn(n,i)}return t.innerType._zod.run(n,r)}}),Ws=f("$ZodExactOptional",(e,t)=>{nn.init(e,t),y(e,"values",n=>n.def.innerType._zod.values),y(e,"pattern",n=>n.def.innerType._zod.pattern),e._zod.parse=(n,r)=>t.innerType._zod.run(n,r)}),qs=f("$ZodNullable",(e,t)=>{k.init(e,t),y(e,"optin",n=>n.def.innerType._zod.optin),y(e,"optout",n=>n.def.innerType._zod.optout),y(e,"pattern",n=>{const r=n.def.innerType._zod.pattern;return r?new RegExp(`^(${Fe(r.source)}|null)$`):void 0}),y(e,"values",n=>n.def.innerType._zod.values?new Set([...n.def.innerType._zod.values,null]):void 0),e._zod.parse=(n,r)=>n.value===null?n:t.innerType._zod.run(n,r)}),Hs=f("$ZodDefault",(e,t)=>{k.init(e,t),e._zod.optin="defaulted",y(e,"values",n=>n.def.innerTyp)DELIM" -R"DELIM(e._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);if(n.value===void 0)return n.value=t.defaultValue,n;const i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(s=>rn(s,t)):rn(i,t)}});function rn(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const Gs=f("$ZodPrefault",(e,t)=>{k.init(e,t),e._zod.optin="defaulted",y(e,"values",n=>n.def.innerType._zod.values),e._zod.parse=(n,r)=>(r.direction==="backward"||n.value===void 0&&(n.value=t.defaultValue),t.innerType._zod.run(n,r))}),Ys=f("$ZodNonOptional",(e,t)=>{k.init(e,t),y(e,"values",n=>{const r=n.def.innerType._zod.values;return r?new Set([...r].filter(i=>i!==void 0)):void 0}),e._zod.parse=(n,r)=>{const i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(s=>sn(s,e)):sn(i,e)}});function sn(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}function on(e,t,n,r){return t.issues.length?(e.value=n.catchValue({...t,value:e.value,error:{issues:t.issues.map(i=>B(i,r,F()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}const Xs=f("$ZodCatch",(e,t)=>{k.init(e,t),y(e,"optin",n=>n.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),y(e,"optout",n=>n.def.innerType._zod.optout),y(e,"values",n=>n.def.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);const i=t.innerType._zod.run({value:n.value,issues:[]},r);return i instanceof Promise?i.then(s=>on(n,s,t,r)):on(n,i,t,r)}}),Qs=f("$ZodPipe",(e,t)=>{k.init(e,t),y(e,"values",n=>n.def.in._zod.values),y(e,"optin",n=>n.def.in._zod.optin),y(e,"optout",n=>n.def.out._zod.optout),y(e,"propValues",n=>n.def.in._zod.propValues),e._zod.parse=(n,r)=>{if(r.direction==="backward"){const s=t.out._zod.run(n,r);return s instanceof Promise?s.then(o=>we(o,t.in,r)):we(s,t.in,r)}const i=t.in._zod.run(n,r);return i instanceof Promise?i.then(s=>we(s,t.out,r)):we(i,t.out,r)}});function we(e,t,n){return e.issues.some(r=>r.code!=="unrecognized_keys")?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}const eo=f("$ZodReadonly",(e,t)=>{k.init(e,t),y(e,"propValues",n=>n.def.innerType._zod.propValues),y(e,"values",n=>n.def.innerType._zod.values),y(e,"optin",n=>n.def.innerType?._zod?.optin),y(e,"optout",n=>n.def.innerType?._zod?.optout),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);const i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(cn):cn(i)}});function cn(e){return e.memo||(e.value=Object.freeze(e.value)),e}const to=f("$ZodCustom",(e,t)=>{Z.init(e,t),k.init(e,t),e._zod.parse=(n,r)=>n,e._zod.check=n=>{const r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(s=>an(s,n,r,e));an(i,n,r,e)}});function an(e,t,n,r){if(!e){const i={code:"custom",input:n,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(ie(i))}}class no extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform"),this.name="ZodCyclicError"}}const tt="~memo",un=[];function ln(e){return e!==null&&typeof e=="object"}function nt(e){return e.map(t=>t.path?{...t,path:t.path.slice()}:{...t})}const fn=new WeakMap,se=0,ke=1,oe=2;function ze(e,t,n){const r=fn.get(e);if(r!==void 0)return r?oe:se;if(t.has(e))return oe;t.add(e);let i=se;const s=l=>{if(i!==oe&&l?._zod){const h=ze(l,t);h>i&&(i=h)}},o=(l,h)=>{let p=se;for(const d of Reflect.ownKeys(l)){const m=Object.getOwnPropertyDescriptor(l,d);if(!m.enumerable)continue;const g=m.get?ke:m.value?._zod?ze(m.value,t):se;g>p&&(p=g)}return p},c=l=>{l>i&&(i=l)},a=e._zod.def;switch(a.type){case"object":{const l=_t(a);c(l?o(l):ke),s(a.catchall);break}case"array":s(a.element);break;case"tuple":for(const l of a.items)s(l);s(a.rest);break;case"record":case"map":s(a.keyType),s(a.valueType);break;case"set":s(a.valueType);break;case"union":for(const l of a.options)s(l);break;case"intersection":s(a.left),s(a.right);break;case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":s(a.innerType);break;case"pipe":s(a.in),s(a.out);break;case"function":s(a.input),s(a.output);break;case"lazy":{const l=a._cachedInner??void 0;c(l?ze(l,t):ke);break}case"template_literal":case"string":case"number":case"int":case"boolean":case"bigint":case"symbol":case"undefined":case"null":case"void":case"never":case"any":case"unknown":case"date":case"nan":case"enum":case"literal":case"file":case"transform":case"custom":break;default:for(const l in a){const h=Object.getOwnPropertyDescriptor(a,l);if(!h||h.get)continue;const p=h.value;if(!(!p||typeof p!="object")){if(p._zod)s(p);else if(Array.isArray(p))for(const d of p)s(d)}}}return t.delete(e),ro(e,i)}function ro(e,t){return t!==ke&&fn.set(e,t===oe),t}function io(e,t){let n=e.buckets.get(t);return n||(n=new WeakMap,e.buckets.set(t,n)),n}let Se;const $e=[],so={alloc(e,t,n){const r=Se;if(!r)return n;Se=void 0;const i={value:n,issues:null};return r.set(t.value,i),$e.push(i),n},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{const n=e._zod.parse,r=(i,s)=>{if(s.direction!=="backward"&&co(s,i.value))throw new no;return n(i,s)};e._zod.parse=r,e._zod.run===n&&(e._zod.run=r)})},attach(e){var t;let n,r=!1,i,s;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{const o=e._zod.parse,c=(a,u)=>{if(n===void 0){const b=ze(e,new Set);if(b===se)return e._zod.parse=o,e._zod.run===c&&(e._zod.run=o),o(a,u);b===oe||r?n=!0:r=!0}const l=a.value;if(!ln(l))return o(a,u);let h=u[tt];h||(h={buckets:new WeakMap,backEdges:void 0},u[tt]=h);let p;i===u?p=s:(p=io(h,e),i=u,s=p);const d=p.get(l);if(d)return a.value=d.value,d.issues?d.issues.length&&a.issues.push(...nt(d.issues)):(a.memo=!0,h.backEdges??(h.backEdges=new WeakSet),h.backEdges.add(d.value)),a;Se=p;const m=$e.length,g=o(a,u);Se=void 0;const v=$e.length>m?$e.pop():void 0;return g instanceof Promise?g.then(b=>(v&&(v.issues=b.issues.length?nt(b.issues):un),b)):(v&&(v.issues=g.issues.length?nt(g.issues):un),g)};e._zod.parse=c,e._zod.run===o&&(e._zod.run=c)})}};function oo(){return so}function co(e,t){const n=e[tt]?.backEdges;return n!==void 0&&ln(t)&&n.has(t)}const ao=()=>{const e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function t(s){return e[s]??null}const n={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",currency_code:"currency code",credit_card:"credit card number",iban:"IBAN",jwt:"JWT",template_literal:"input"},r={nan:"NaN"};function i(s,o){return s==="number"&&typeof o=="number"&&!Number.isFinite(o)?String(o):r[s]??s}return s=>{switch(s.code){case"invalid_type":{const o=i(s.expected),c=Rr(s.input),a=i(c,s.input);return`Invalid input: expected ${o}, received ${a}`}case"invalid_value":return s.values.length===1?`Invalid input: expected ${kt(s.values[0])}`:`Invalid option: expected one of ${gt(s.values,"|")}`;case"too_big":{const o=s.exact?"exactly ":s.inclusive?"<=":"<",c=t(s.origin);return c?`Too big: expected ${s.origin??"value"} to have ${o}${s.maximum.toString()} ${c.unit??"elements"}`:`Too big: expected ${s.origin??"value"} to be ${o}${s.maximum.toString()}`}case"too_small":{const o=s.exact?"exactly ":s.inclusive?">=":">",c=t(s.origin);return c?`Too small: expected ${s.origin} to have ${o}${s.minimum.toString()} ${c.unit}`:`Too small: expected ${s.origin} to be ${o}${s)DELIM" -R"DELIM(.minimum.toString()}`}case"invalid_format":{const o=s;return o.format==="starts_with"?`Invalid string: must start with "${o.prefix}"`:o.format==="ends_with"?`Invalid string: must end with "${o.suffix}"`:o.format==="includes"?`Invalid string: must include "${o.includes}"`:o.format==="regex"?`Invalid string: must match pattern ${o.pattern}`:`Invalid ${n[o.format]??s.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${s.divisor}`;case"unrecognized_keys":return`Unrecognized key${s.keys.length>1?"s":""}: ${gt(s.keys,", ")}`;case"invalid_key":return`Invalid key in ${s.origin}`;case"invalid_union":return s.options&&Array.isArray(s.options)&&s.options.length>0?`Invalid discriminator value. Expected ${s.options.map(c=>`\'${c}\'`).join(" | ")}`:s.inclusive===!1?"Invalid input: more than one option matched":"Invalid input";case"invalid_element":return`Invalid value in ${s.origin}`;default:return"Invalid input"}}};function uo(){return{localeError:ao()}}var hn;class lo{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...n){const r=n[0];return this._map.set(t,r),r&&typeof r=="object"&&"id"in r&&this._idmap.set(r.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){const n=this._map.get(t);return n&&typeof n=="object"&&"id"in n&&this._idmap.delete(n.id),this._map.delete(t),this}get(t){const n=t._zod.parent;if(n){const r={...this.get(n)??{}};delete r.id;const 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 fo(){return new lo}(hn=globalThis).__zod_globalRegistry??(hn.__zod_globalRegistry=fo());const ce=globalThis.__zod_globalRegistry;function dn(e){return e.checks&&(e.checks=[...e.checks]),e}function ho(e,t){return new e(dn({type:"string",..._(t)}))}function po(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,..._(t)})}function mo(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,..._(t)})}function go(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,..._(t)})}function _o(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",..._(t)})}function vo(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",..._(t)})}function bo(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",..._(t)})}function yo(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,..._(t)})}function wo(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,..._(t)})}function ko(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,..._(t)})}function zo(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,..._(t)})}function So(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,..._(t)})}function $o(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,..._(t)})}function Oo(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,..._(t)})}function Eo(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,..._(t)})}function Io(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,..._(t)})}function To(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,..._(t)})}function Po(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,..._(t)})}function Zo(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,..._(t)})}function Ao(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,..._(t)})}function No(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,..._(t)})}function Ro(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,..._(t)})}function jo(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,..._(t)})}function Mo(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,..._(t)})}function Lo(e,t){return new e({type:"string",format:"date",check:"string_format",..._(t)})}function Fo(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,..._(t)})}function Co(e,t){return new e({type:"string",format:"duration",check:"string_format",..._(t)})}function Do(e,t){return new e(dn({type:"number",checks:[],..._(t)}))}function xo(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",..._(t)})}function Uo(e,t){return new e({type:"boolean",..._(t)})}function Ko(e){return new e({type:"unknown"})}function Jo(e,t){return new e({type:"never",..._(t)})}function pn(e,t){return new Mt({check:"less_than",..._(t),value:e,inclusive:!1})}function rt(e,t){return new Mt({check:"less_than",..._(t),value:e,inclusive:!0})}function mn(e,t){return new Lt({check:"greater_than",..._(t),value:e,inclusive:!1})}function it(e,t){return new Lt({check:"greater_than",..._(t),value:e,inclusive:!0})}function gn(e,t){return new Fi({check:"multiple_of",..._(t),value:e})}function _n(e,t){return new Di({check:"max_length",..._(t),maximum:e})}function Oe(e,t){return new xi({check:"min_length",..._(t),minimum:e})}function vn(e,t){return new Ui({check:"length_equals",..._(t),length:e})}function Bo(e,t){return new Ki({check:"string_format",format:"regex",..._(t),pattern:e})}function Vo(e){return new Ji({check:"string_format",format:"lowercase",..._(e)})}function Wo(e){return new Bi({check:"string_format",format:"uppercase",..._(e)})}function qo(e,t){return new Vi({check:"string_format",format:"includes",..._(t),includes:e})}function Ho(e,t){return new Wi({check:"string_format",format:"starts_with",..._(t),prefix:e})}function Go(e,t){return new qi({check:"string_format",format:"ends_with",..._(t),suffix:e})}function Y(e){return new Hi({check:"overwrite",tx:e})}function Yo(e){return Y(t=>t.normalize(e))}function Xo(){return Y(e=>e.trim())}function Qo(){return Y(e=>e.toLowerCase())}function ec(){return Y(e=>e.toUpperCase())}function tc(){return Y(e=>wr(e))}function nc(e,t,n){return new e({type:"array",element:t,..._(n)})}function rc(e,t,n){return new e({type:"custom",check:"custom",fn:t,..._(n)})}function ic(e,t){const n=sc(r=>(r.addIssue=i=>{if(typeof i=="string")r.issues.push(ie(i,r.value,n._zod.def));else{const s=i;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),"input"in s||(s.input=r.value),s.inst??(s.inst=n),s.continue??(s.continue=!n._zod.def.abort),r.issues.push(ie(s))}},e(r.value,r)),t);return n}function sc(e,t){const n=new Z({check:"custom",..._(t)});return n._zod.check=e,n}function ae(e,...t){for(const n of t)for(const r of Reflect.ownKeys(n))Object.prototype.propertyIsEnumerable.call(n,r)&&U(e,r,n[r]);return e}function bn(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??ce,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??"ref",reused:e?.reused??"inline",intersections:[],deferred:[],external:e?.external??void 0}}function X(e,t,n,r,i){const s=typeof t.unrepresentable=="function"?t.unrepresentable({zodSchema:e,path:r.path,message:i}):t.unrepresentable;if(s==="any")return!1;if(s===void 0||s==="throw")throw new Error(i);return Object.assign(n,s),!0}function O(e,t,n={path:[],schemaPath:[]}){var r;const i=e._zod.def,s=t.seen.get(e);if(s)return s.count++,n.schemaPath.includes(e)&&(s.cycle=n.path),s.schema;const o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;const c=e._zod.toJSONSchema?.();if(c)o.schema=c;else{const l={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e)DELIM" -R"DELIM(._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,l);else{const p=o.schema,d=t.processors[i.type];if(!d)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);d(e,t,p,l)}const h=e._zod.parent;h&&(o.ref||(o.ref=h),O(h,t,l),t.seen.get(h).isParent=!0)}const a=t.metadataRegistry.get(e);return a&&ae(o.schema,a),t.io==="input"&&P(e)&&(delete o.schema.examples,delete o.schema.default),t.io==="input"&&"_prefault"in o.schema&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function yn(e){return e.replace(/~/g,"~0").replace(/\\//g,"~1")}function wn(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");if(e.external&&e.sharedDefsExtractedFor===e.external)return;const r=new Map;for(const o of e.seen.entries()){const c=e.metadataRegistry.get(o[0])?.id;if(c){const a=r.get(c);if(a&&a!==o[0])throw new Error(`Duplicate schema id "${c}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(c,o[0])}}const i=o=>{const c=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const h=e.external.registry.get(o[0])?.id,p=e.external.uri??(m=>m);if(h)return{ref:p(h)};const d=o[1].defId??o[1].schema.id??`schema${e.counter++}`;return o[1].defId=d,{defId:d,ref:`${p("__shared")}#/${c}/${yn(d)}`}}const a="#",u=`${a}/${c}/`;if(o[1]===n&&!o[1].schema.id)return{ref:a};const l=o[1].schema.id??`__schema${e.counter++}`;return{defId:l,ref:u+yn(l)}},s=o=>{if(o[1].schema.$ref)return;const c=o[1],{ref:a,defId:u}=i(o);c.def={...c.schema},u&&(c.defId=u);const l=c.schema;for(const h in l)delete l[h];l.$ref=a};if(e.cycles==="throw")for(const o of e.seen.entries()){const c=o[1];if(c.cycle)throw new Error(`Cycle detected: #/${c.cycle?.join("/")}/\n\nSet the \\`cycles\\` parameter to \\`"ref"\\` to resolve cyclical schemas with defs.`)}for(const o of e.seen.entries()){const c=o[1];if(t===o[0]){s(o);continue}if(e.external){const u=e.external.registry.get(o[0])?.id;if(t!==o[0]&&u){s(o);continue}}if(e.metadataRegistry.get(o[0])?.id){s(o);continue}if(c.cycle){s(o);continue}c.count>1&&e.reused==="ref"&&s(o)}e.external&&(e.sharedDefsExtractedFor=e.external)}function kn(e){const t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;const n=[];for(const r of t){if(!r||typeof r!="object")return;kn(r);const i=Object.keys(r);if(i.length!==1||i[0]!=="type")return;const s=r.type;for(const o of Array.isArray(s)?s:[s]){if(typeof o!="string")return;n.includes(o)||n.push(o)}}delete e.anyOf,e.type=n.length===1?n[0]:n}const zn=new Set(["type","properties","required","additionalProperties"]),Sn=["oneOf","anyOf"];function $n(e){const t=e.additionalProperties;return t===void 0||t===!1||typeof t!="object"||t===null?null:Object.keys(t).length?t:null}function st(e){const t=[];for(const s of e){if(typeof s!="object"||s.type!=="object")return null;for(const o in s)if(!zn.has(o))return null;t.push(s)}const n={},r=new Set;for(const s of t){for(const o in s.properties){if(Object.prototype.hasOwnProperty.call(n,o))continue;const c=[];for(const u of t){const l=u.properties?.[o]??$n(u);l!=null&&(c.some(h=>JSON.stringify(h)===JSON.stringify(l))||c.push(l))}const a=c.length===1?c[0]:st(c)??{allOf:c};U(n,o,a)}for(const o of s.required??[])r.add(o)}const i={type:"object",properties:n};if(r.size&&(i.required=[...r]),t.every(s=>s.additionalProperties===!1))i.additionalProperties=!1;else{const s=[];for(const o of t){const c=$n(o);c&&!s.some(a=>JSON.stringify(a)===JSON.stringify(c))&&s.push(c)}s.length===1?i.additionalProperties=s[0]:s.length>1&&(i.additionalProperties={allOf:s})}return i}function oc(e){const t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(const i of zn)if(i in e)return;const n=t.filter(i=>Sn.some(s=>Array.isArray(i[s])));let r=null;if(!n.length)r=st(t);else{const i=n[0],s=Sn.find(a=>Array.isArray(i[a]));if(Object.keys(i).length!==1)return;const o=t.filter(a=>a!==i),c=i[s].map(a=>st([...o,a]));if(c.some(a=>!a))return;r={[s]:c}}r&&(delete e.allOf,ae(e,r))}function On(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=c=>{const a=e.seen.get(c);if(a.ref===null)return;const u=a.def??a.schema,l={...u},h=a.ref;if(a.ref=null,h){r(h);const d=e.seen.get(h),m=d.schema;if(m.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(u.allOf=u.allOf??[],u.allOf.push(m)):ae(u,m),ae(u,l),c._zod.parent===h)for(const v in u)v==="$ref"||v==="allOf"||v in l||delete u[v];if(m.$ref&&d.def)for(const v in u)v==="$ref"||v==="allOf"||v in d.def&&JSON.stringify(u[v])===JSON.stringify(d.def[v])&&delete u[v]}const p=c._zod.parent;if(p&&p!==h){r(p);const d=e.seen.get(p);if(d?.schema.$ref&&(u.$ref=d.schema.$ref,d.def))for(const m in u)m==="$ref"||m==="allOf"||m in d.def&&JSON.stringify(u[m])===JSON.stringify(d.def[m])&&delete u[m]}e.override({zodSchema:c,jsonSchema:u,path:a.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(const c of[...e.seen.entries()].reverse())r(c[0]);if(e.target!=="openapi-3.0")for(const c of e.seen.entries())kn(c[1].def??c[1].schema);for(const c of e.deferred)c();if(e.intersections.length){const c=new Map;for(const a of e.seen.values())for(const u of[a.schema,a.def]){const l=u?.allOf;if(!Array.isArray(l))continue;const h=c.get(l);h?h.push(u):c.set(l,[u])}for(const a of e.intersections)for(const u of c.get(a)??[])oc(u)}}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)}ae(i,n.defId?n.schema:n.def??n.schema);const s=e.metadataRegistry.get(t)?.id;s!==void 0&&i.id===s&&delete i.id;const o=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(const c of e.seen.entries()){const a=c[1];a.def&&a.defId&&(a.def.id===a.defId&&delete a.def.id,U(o,a.defId,a.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(o).length>0&&(e.target==="draft-2020-12"?i.$defs=o:i.definitions=o);try{const c=JSON.parse(JSON.stringify(i));return Object.defineProperty(c,"~standard",{value:{...t["~standard"],jsonSchema:{input:Ee(t,"input",e.processors),output:Ee(t,"output",e.processors)}},enumerable:!1,writable:!1}),c}catch{throw new Error("Error converting schema to JSON.")}}function P(e,t){const n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);const r=e._zod.def;if(r.type==="transform")return!0;if(r.type==="array")return P(r.element,n);if(r.type==="set")return P(r.valueType,n);if(r.type==="lazy")return P(r.getter(),n);if(r.type==="promise"||r.type==="optional"||r.type==="nonoptional"||r.type==="nullable"||r.type==="readonly"||r.type==="default"||r.type==="prefault"||r.type==="catch")return P(r.innerType,n);if(r.type==="intersection")return P(r.left,n)||P(r.right,n);if(r.type==="record"||r.type==="map")return P(r.keyType,n)||P(r.valueType,n);if(r.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:P(r.in,n)||P(r.out,n);if(r.type==="object"){for(const i in r.shape)if(P(r.shape[i],n))return!0;return!1}if(r.type==="union"){for(const i of r.options)if(P(i,n))return!0;return!1}if(r.type==="tuple"){for(const i of r.items)if(P(i,n))return!0;return!!(r.rest&&P(r.rest,n))}return!1}const cc=(e,t={})=>n=>{const r=bn({...n,processors:t});return O(e,r),wn(r,e),On(r,e)},Ee=(e,t,n={})=>r=>{const{libraryOptions:i,target:s}=r??{},o=bn({...i??{},target:s,io:t,processors:n});return O(e,o),wn(o,e),On(o,e)},Q=(e,t,n)=>{(e[t]===void 0||n>e[t])&&(e[t]=n)},ee=(e,t,n)=>{(e[t]===void 0||n{Q(e,"minimum",t),ee(e,"maximum",t)},In=(e,t)=>{e.multipleOf??(e.multipleOf=[]),e.multipleOf.includes(t)||e.multipleOf.push(t)},Tn=(e,t)=>{e.patterns??(e.patterns=new )DELIM" -R"DELIM(Set),e.patterns.add(t)},Pn=(e,t)=>{e.mime=e.mime?e.mime.filter(n=>t.includes(n)):[...t]},Zn=(e,t)=>{e.format=t,t.includes("int")&&(e.isInt=!0)},An=(e,t)=>Q(e,"minimum",t.minimum),Nn=(e,t)=>ee(e,"maximum",t.maximum),Rn=e=>(t,n)=>{Zn(t,n.format);const[r,i]=e[n.format];Q(t,"minimum",r),ee(t,"maximum",i)},ac={greater_than:(e,t)=>Q(e,t.inclusive?"minimum":"exclusiveMinimum",t.value),less_than:(e,t)=>ee(e,t.inclusive?"maximum":"exclusiveMaximum",t.value),multiple_of:(e,t)=>In(e,t.value),number_format:Rn(zt),bigint_format:Rn($r),min_length:An,max_length:Nn,length_equals:(e,t)=>En(e,t.length),min_size:An,max_size:Nn,size_equals:(e,t)=>En(e,t.size),string_format:(e,t)=>{Zn(e,t.format),t.pattern&&Tn(e,t.pattern),(t.format==="base64"||t.format==="base64url")&&(e.contentEncoding=t.format),(t.local||t.precision===-1)&&(e.laxFormat=!0)},mime_type:(e,t)=>Pn(e,t.mime)};function j(e){const t={},n=e._zod.def,r=e._zod.traits.has("$ZodCheck")?[e,...n.checks??[]]:n.checks??[];for(const s of r)ac[s._zod.def.check]?.(t,s._zod.def);const i=e._zod.bag;i.minimum!==void 0&&Q(t,"minimum",i.minimum),i.exclusiveMinimum!==void 0&&Q(t,"exclusiveMinimum",i.exclusiveMinimum),i.maximum!==void 0&&ee(t,"maximum",i.maximum),i.exclusiveMaximum!==void 0&&ee(t,"exclusiveMaximum",i.exclusiveMaximum),i.multipleOf!==void 0&&In(t,i.multipleOf),i.format!==void 0&&(t.format??(t.format=i.format),i.format.includes("int")&&(t.isInt=!0)),i.mime&&Pn(t,i.mime);for(const s of i.patterns??[])Tn(t,s);return t}const uc={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},lc=new Map([[Bt,$i],[Qe,Oi]]),jn=e=>lc.get(e)??e,fc=(e,t,n,r)=>{const i=n;i.type="string";const{minimum:s,maximum:o,format:c,patterns:a,contentEncoding:u,laxFormat:l}=j(e);if(typeof s=="number"&&(i.minLength=s),typeof o=="number"&&(i.maxLength=o),c&&(i.format=uc[c]??c,i.format===""&&delete i.format,(c==="time"||l)&&delete i.format),u&&(i.contentEncoding=u),a&&a.size>0){const h=[...a].map(jn);h.length===1?i.pattern=h[0].source:h.length>1&&(i.allOf=[...h.map(p=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:p.source}))])}},hc=(e,t,n,r)=>{const i=n,{minimum:s,maximum:o,multipleOf:c,exclusiveMaximum:a,exclusiveMinimum:u,isInt:l}=j(e);i.type=l?"integer":"number";const h=typeof u=="number"&&u>=(s??Number.NEGATIVE_INFINITY),p=typeof a=="number"&&a<=(o??Number.POSITIVE_INFINITY),d=t.target==="draft-04"||t.target==="openapi-3.0";if(h?d?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u:typeof s=="number"&&(i.minimum=s),p?d?(i.maximum=a,i.exclusiveMaximum=!0):i.exclusiveMaximum=a:typeof o=="number"&&(i.maximum=o),c){const m=new Set;for(const b of c)Number.isFinite(b)&&b!==0?m.add(Math.abs(b)):X(e,t,i,r,`A multipleOf divisor of ${b} cannot be represented in JSON Schema`);const[g,...v]=m;g!==void 0&&(i.multipleOf=g),v.length&&(i.allOf=[...i.allOf??[],...v.map(b=>({multipleOf:b}))])}},dc=(e,t,n,r)=>{n.type="boolean"},pc=(e,t,n,r)=>{n.not={}},mc=(e,t,n,r)=>{},gc=(e,t,n,r)=>{const i=e._zod.def,s=je(i.entries);if(s.length===0){n.not={};return}s.every(o=>typeof o=="number")&&(n.type="number"),s.every(o=>typeof o=="string")&&(n.type="string"),n.enum=s},_c=(e,t,n,r)=>{X(e,t,n,r,"Custom types cannot be represented in JSON Schema")},vc=(e,t,n,r)=>{X(e,t,n,r,"Transforms cannot be represented in JSON Schema")},bc=(e,t,n,r)=>{const i=n,s=e._zod.def,{minimum:o,maximum:c}=j(e);typeof o=="number"&&(i.minItems=o),typeof c=="number"&&(i.maxItems=c),i.type="array",i.items=O(s.element,t,{...r,path:[...r.path,"items"]})};function ue(e){const t=e._zod.def;return t.type==="pipe"&&t.in._zod.traits.has("$ZodTransform")?ue(t.out):t.type==="catch"?ue(t.innerType):e._zod.optin}const yc=(e,t,n,r)=>{const i=n,s=e._zod.def,o=s.shape;if(Object.getOwnPropertySymbols(o).length&&X(e,t,i,r,"Symbol keys cannot be represented in JSON Schema"))return;i.type="object",i.properties={};for(const u in o)U(i.properties,u,O(o[u],t,{...r,path:[...r.path,"properties",u]}));const a=[];for(const u of Object.keys(o)){const l=s.shape[u];(t.io==="input"?ue(l)===void 0:l._zod.optout===void 0)&&a.push(u)}a.length>0&&(i.required=a),s.catchall?._zod.def.type==="never"?i.additionalProperties=!1:s.catchall?s.catchall&&(i.additionalProperties=O(s.catchall,t,{...r,path:[...r.path,"additionalProperties"]})):t.io==="output"&&(i.additionalProperties=!1)},wc=(e,t,n,r)=>{const i=e._zod.def,s=i.inclusive===!1,o=i.options.map((c,a)=>O(c,t,{...r,path:[...r.path,s?"oneOf":"anyOf",a]}));s?n.oneOf=o:n.anyOf=o},kc=(e,t,n,r)=>{const i=e._zod.def,s=O(i.left,t,{...r,path:[...r.path,"allOf",0]}),o=O(i.right,t,{...r,path:[...r.path,"allOf",1]}),c=u=>"allOf"in u&&Object.keys(u).length===1,a=[...c(s)?s.allOf:[s],...c(o)?o.allOf:[o]];n.allOf=a,t.intersections.push(a)},zc=(e,t,n,r)=>{const i=n,s=e._zod.def;i.type="array";const o=t.target==="draft-2020-12"?"prefixItems":"items",c=t.target==="draft-2020-12"||t.target==="openapi-3.0"?"items":"additionalItems",a=s.items.map((g,v)=>O(g,t,{...r,path:[...r.path,o,v]})),u=s.rest?O(s.rest,t,{...r,path:[...r.path,c,...t.target==="openapi-3.0"?[s.items.length]:[]]}):null;let l=s.items.length;for(;l>0;){const g=s.items[l-1];if(!(t.io==="input"?ue(g)!==void 0:g._zod.optout==="optional"))break;l--}const h=s.items.length,p=!s.rest;t.target==="draft-2020-12"?(i.prefixItems=a,p?i.items=!1:u&&(i.items=u),l>0&&(i.minItems=l),p&&(i.maxItems=h)):t.target==="openapi-3.0"?(i.items={anyOf:a},u&&i.items.anyOf.push(u),l>0&&(i.minItems=l),p&&(i.maxItems=h)):(i.items=a,p?i.additionalItems=!1:u&&(i.additionalItems=u),l>0&&(i.minItems=l),p&&(i.maxItems=h));const{minimum:d,maximum:m}=j(e);typeof d=="number"&&(i.minItems=d),typeof m=="number"&&(i.maxItems=m)};function ot(e,t,n){if(t.$ref){if(n.has(t))return t;n.add(t);const m=e.get(t)?.def;if(!m)return t;const g=ot(e,m,n);return g===m?t:g}for(const m of["anyOf","oneOf"]){const g=t[m];if(!Array.isArray(g))continue;const v=g.map(b=>ot(e,b,n));v.some((b,A)=>b!==g[A])&&(t={...t,[m]:v})}const r=Array.isArray(t.type)?t.type:[t.type],i=!r.includes("string")&&r.some(m=>m==="number"||m==="integer"),s=t.enum??(t.const!==void 0?[t.const]:void 0);if(!i&&!s?.some(m=>typeof m=="number"))return t;const{minimum:o,maximum:c,exclusiveMinimum:a,exclusiveMaximum:u,multipleOf:l,format:h,id:p,...d}=t;return d.enum?d.enum=d.enum.map(m=>typeof m=="number"?String(m):m):typeof d.const=="number"&&(d.const=String(d.const)),i&&(d.type="string",s||(d.pattern=(r.includes("number")?Ge:Ri).source)),d}const ct=new WeakMap;function Sc(e){const t=new Map;for(const r of e.seen.values())r.def&&!t.has(r.schema)&&t.set(r.schema,r);const n=new Map;for(const r of ct.get(e)??[]){const i=e.seen.get(r),s=(i?.def??i?.schema)?.propertyNames;if(!s||s===!0||n.has(s))continue;const o=ot(t,s,new Set);o!==s&&n.set(s,o)}if(n.size)for(const r of e.seen.values())for(const i of[r.schema,r.def]){const s=i&&n.get(i.propertyNames);s&&(i.propertyNames=s)}}const $c=(e,t,n,r)=>{const i=n,s=e._zod.def;i.type="object";const o=s.keyType,c=j(o).patterns;if(s.mode==="loose"&&c&&c.size>0){const l=O(s.valueType,t,{...r,path:[...r.path,"patternProperties","*"]});i.patternProperties={};for(const h of c)U(i.patternProperties,jn(h).source,l)}else{if(t.target==="draft-07"||t.target==="draft-2020-12"){i.propertyNames=O(s.keyType,t,{...r,path:[...r.path,"propertyNames"]});let l=ct.get(t);l||(l=[],ct.set(t,l),t.deferred.push(()=>Sc(t))),l.push(e)}i.additionalProperties=O(s.valueType,t,{...r,path:[...r.path,"additionalProperties"]})}const a=o._zod.values,u=t.io==="input"&&ue(s.valueType)!==void 0;if(a&&!s.partial&&!u){const l=[...a].filter(h=>typeof h=="string"||typeof h=="number");l.length>0&&(i.required=l.map(String))}},Oc=(e,t,n,r)=>{const i=e._zod.def,s=O(i.innerType,t,r),o=t.seen.get(e);t.target==="openapi-3.0"?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[s,{type:"null"}]},Ec=(e,t,n,r)=>{const i=e._zod.def;O(i.innerType,t,r);const s=t.seen.get(e);s.ref=i.innerType},at=Symbol();function Mn(e,t,n,r,i){let s=!1;const o=JSON.stringify(e,(c,a)=>typeof)DELIM" -R"DELIM( a!="bigint"?a:(s=!0,null));return s?(X(t,n,r,i,"BigInt defaults cannot be represented in JSON Schema"),at):JSON.parse(o)}const Ic=(e,t,n,r)=>{const i=e._zod.def;O(i.innerType,t,r);const s=t.seen.get(e);s.ref=i.innerType;const o=Mn(i.defaultValue,e,t,n,r);o!==at&&(n.default=o)},Tc=(e,t,n,r)=>{const i=e._zod.def;O(i.innerType,t,r);const s=t.seen.get(e);if(s.ref=i.innerType,t.io!=="input")return;const o=Mn(i.defaultValue,e,t,n,r);o!==at&&(n._prefault=o)},Pc=(e,t,n,r)=>{const i=e._zod.def;O(i.innerType,t,r);const s=t.seen.get(e);s.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{X(e,t,n,r,"Dynamic catch values are not supported in JSON Schema");return}n.default=o},Zc=(e,t,n,r)=>{const i=e._zod.def,s=i.in._zod.traits.has("$ZodTransform"),o=t.io==="input"?s?i.out:i.in:i.out;O(o,t,r);const c=t.seen.get(e);c.ref=o},Ac=(e,t,n,r)=>{const i=e._zod.def;O(i.innerType,t,r);const s=t.seen.get(e);s.ref=i.innerType,n.readOnly=!0},Ln=(e,t,n,r)=>{const i=e._zod.def;O(i.innerType,t,r);const s=t.seen.get(e);s.ref=i.innerType},Fn=new WeakSet([Object.prototype,Error.prototype]);function Ie(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){const r=n(this);return Object.defineProperty(this,t,{value:r,configurable:!0,writable:!0}),r},set(r){Object.defineProperty(this,t,{value:r,configurable:!0,writable:!0})}})}const M=f("ZodError",(e,t)=>{Vr.init(e,t),e.name="ZodError";const n=Object.getPrototypeOf(e);Fn.has(n)||(Fn.add(n),Ie(n,"format",r=>i=>Hr(r,i)),Ie(n,"flatten",r=>i=>qr(r,i)),Ie(n,"addIssue",r=>i=>{r.issues.push(i),r.message=JSON.stringify(r.issues,Me,2)}),Ie(n,"addIssues",r=>i=>{r.issues.push(...i),r.message=JSON.stringify(r.issues,Me,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},void 0,{Parent:Error}),Nc=Be(M),Rc=Ve(M),jc=We(M),Mc=qe(M),Lc=ti(M),Fc=ni(M),Cc=ri(M),Dc=ii(M),xc=si(M),Uc=oi(M),Kc=ci(M),Jc=ai(M);function Bc(){R.localeError||F(uo())}function le(){R.memoizer||F({memoizer:oo()})}const S=f("ZodType",(e,t)=>(Bc(),k.init(e,t),e.def=t,e.type=t.type,e),{check(...e){const t=this.def;return this.clone(N(t,{checks:[...t.checks??[],...e.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return K(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(Ja(e,t))},superRefine(e,t){return this.check(Ba(e,t))},overwrite(e){return this.check(Y(e))},optional(){return Vn(this)},exactOptional(){return Za(this)},nullable(){return qn(this)},nullish(){return Vn(qn(this))},nonoptional(e){return La(this,e)},array(){return Kn(this)},or(e){return Jn([this,e])},and(e){return Sa(this,e)},transform(e){return Gn(this,Pa(e))},default(e){return Ra(this,e)},prefault(e){return Ma(this,e)},catch(e){return Ca(this,e)},pipe(e){return Gn(this,e)},readonly(){return Ua(this)},describe(e){const t=this.clone();return ce.add(t,{description:e}),t},meta(...e){if(e.length===0)return ce.get(this);const t=this.clone();return ce.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get"~standard"(){return Et(this,"~standard",{...Ct(this),jsonSchema:{input:Ee(this,"input"),output:Ee(this,"output")}})},set"~standard"(e){V(this,"~standard",e)},parse:function e(t,n){return Nc(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await Rc(this,t,n,{callee:e})},safeParse(e,t){return jc(this,e,t)},async safeParseAsync(e,t){return Mc(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){V(this,"spa",e)},validate(e,t){return Xr(this,e,t)},validateAsync(e,t){return ei(this,e,t)},encode:function e(t,n){return Lc(this,t,n,{callee:e})},decode:function e(t,n){return Fc(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await Cc(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await Dc(this,t,n,{callee:e})},safeEncode(e,t){return xc(this,e,t)},safeDecode(e,t){return Uc(this,e,t)},async safeEncodeAsync(e,t){return Kc(this,e,t)},async safeDecodeAsync(e,t){return Jc(this,e,t)},toJSONSchema(e){return cc(this,{})(e)},get description(){return ce.get(this)?.description},get _def(){return this._zod.def}}),Cn=f("_ZodString",(e,t)=>{Xe.init(e,t),S.init(e,t),e._zod.processJSONSchema=(n,r,i)=>fc(e,n,r)},It({format:e=>j(e).format??null,minLength:e=>j(e).minimum??null,maxLength:e=>j(e).maximum??null},{regex(...e){return this.check(Bo(...e))},includes(...e){return this.check(qo(...e))},startsWith(...e){return this.check(Ho(...e))},endsWith(...e){return this.check(Go(...e))},min(...e){return this.check(Oe(...e))},max(...e){return this.check(_n(...e))},length(...e){return this.check(vn(...e))},nonempty(...e){return this.check(Oe(1,...e))},lowercase(e){return this.check(Vo(e))},uppercase(e){return this.check(Wo(e))},trim(){return this.check(Xo())},normalize(...e){return this.check(Yo(...e))},toLowerCase(){return this.check(Qo())},toUpperCase(){return this.check(ec())},slugify(){return this.check(tc())}})),Vc=f("ZodString",(e,t)=>{Xe.init(e,t),Cn.init(e,t)},{email(e){return this.check(po(Yc,e))},url(e){return this.check(yo(Qc,e))},jwt(e){return this.check(jo(pa,e))},emoji(e){return this.check(wo(ea,e))},guid(e){return this.check(mo(Xc,e))},uuid(e){return this.check(go(Te,e))},uuidv4(e){return this.check(_o(Te,e))},uuidv6(e){return this.check(vo(Te,e))},uuidv7(e){return this.check(bo(Te,e))},nanoid(e){return this.check(ko(ta,e))},cuid(e){return this.check(zo(na,e))},cuid2(e){return this.check(So(ra,e))},ulid(e){return this.check($o(ia,e))},base64(e){return this.check(Ao(fa,e))},base64url(e){return this.check(No(ha,e))},xid(e){return this.check(Oo(sa,e))},ksuid(e){return this.check(Eo(oa,e))},ipv4(e){return this.check(Io(ca,e))},ipv6(e){return this.check(To(aa,e))},cidrv4(e){return this.check(Po(ua,e))},cidrv6(e){return this.check(Zo(la,e))},e164(e){return this.check(Ro(da,e))},datetime(e){return this.check(Mo(Wc,e))},date(e){return this.check(Lo(qc,e))},time(e){return this.check(Fo(Hc,e))},duration(e){return this.check(Co(Gc,e))}});function te(e){return ho(Vc,e)}const $=f("ZodStringFormat",(e,t)=>{z.init(e,t),Cn.init(e,t)}),Wc=f("ZodISODateTime",(e,t)=>{ms.init(e,t),$.init(e,t)}),qc=f("ZodISODate",(e,t)=>{gs.init(e,t),$.init(e,t)}),Hc=f("ZodISOTime",(e,t)=>{_s.init(e,t),$.init(e,t)}),Gc=f("ZodISODuration",(e,t)=>{vs.init(e,t),$.init(e,t)}),Yc=f("ZodEmail",(e,t)=>{ts.init(e,t),$.init(e,t)}),Xc=f("ZodGUID",(e,t)=>{Qi.init(e,t),$.init(e,t)}),Te=f("ZodUUID",(e,t)=>{es.init(e,t),$.init(e,t)}),Qc=f("ZodURL",(e,t)=>{cs.init(e,t),$.init(e,t)}),ea=f("ZodEmoji",(e,t)=>{as.init(e,t),$.init(e,t)}),ta=f("ZodNanoID",(e,t)=>{us.init(e,t),$.init(e,t)}),na=f("ZodCUID",(e,t)=>{ls.init(e,t),$.init(e,t)}),ra=f("ZodCUID2",(e,t)=>{fs.init(e,t),$.init(e,t)}),ia=f("ZodULID",(e,t)=>{hs.init(e,t),$.init(e,t)}),sa=f("ZodXID",(e,t)=>{ds.init(e,t),$.init(e,t)}),oa=f("ZodKSUID",(e,t)=>{ps.init(e,t),$.init(e,t)}),ca=f("ZodIPv4",(e,t)=>{bs.init(e,t),$.init(e,t)}),aa=f("ZodIPv6",(e,t)=>{ws.init(e,t),$.init(e,t)}),ua=f("ZodCIDRv4",(e,t)=>{ks.init(e,t),$.init(e,t)}),la=f("ZodCIDRv6",(e,t)=>{Ss.init(e,t),$.init(e,t)}),fa=f("ZodBase64",(e,t)=>{$s.init(e,t),$.init(e,t)}),ha=f("ZodBase64URL",(e,t)=>{Es.init(e,t),$.init(e,t)}),da=f("ZodE164",(e,t)=>{Is.init(e,t),$.init(e,t)}),pa=f("ZodJWT",(e,t)=>{Ps.init(e,t),$.init(e,t)}),Dn=f("ZodNumber",(e,t)=>{Vt.init(e,t),S.init(e,t),e._zod.processJSONSchema=(n,r,i)=>hc(e,n,r,i),e.isFinite=!0},It({minValue:e=>{const{minimum:t,exclusiveMinimum:n}=j(e);return Math.max(t??Number.NEGATIVE_INFINITY,n??Number.NEGATIVE_INFINITY)},maxValue:e=>{const{maximum:t,exclusiveMaximum:n}=j(e);return Math.min(t??Number.POSITIVE_INFINITY,n??Number.POSITIVE_INFINITY)},isInt:e=>{const{isInt:t,multipleOf:n}=j(e);return!!t||!!n?.some(Number.isSafeInteger)},format:e=>j(e).format??null},{gt(e,t){return this.check(mn(e,t))},gte(e,t){return this.check(it(e,t))},min(e,t){return this)DELIM" -R"DELIM(.check(it(e,t))},lt(e,t){return this.check(pn(e,t))},lte(e,t){return this.check(rt(e,t))},max(e,t){return this.check(rt(e,t))},int(e){return this.check(xn(e))},safe(e){return this.check(xn(e))},positive(e){return this.check(mn(0,e))},nonnegative(e){return this.check(it(0,e))},negative(e){return this.check(pn(0,e))},nonpositive(e){return this.check(rt(0,e))},multipleOf(e,t){return this.check(gn(e,t))},step(e,t){return this.check(gn(e,t))},finite(){return this}}));function E(e){return Do(Dn,e)}const ma=f("ZodNumberFormat",(e,t)=>{Zs.init(e,t),Dn.init(e,t)});function xn(e){return xo(ma,e)}const ga=f("ZodBoolean",(e,t)=>{As.init(e,t),S.init(e,t),e._zod.processJSONSchema=(n,r,i)=>dc(e,n,r)});function T(e){return Uo(ga,e)}const _a=f("ZodUnknown",(e,t)=>{Ns.init(e,t),S.init(e,t),e._zod.processJSONSchema=(n,r,i)=>mc()});function Un(){return Ko(_a)}const va=f("ZodNever",(e,t)=>{Rs.init(e,t),S.init(e,t),e._zod.processJSONSchema=(n,r,i)=>pc(e,n,r)});function ba(e){return Jo(va,e)}const ya=f("ZodArray",(e,t)=>{le(),Ls.init(e,t),S.init(e,t),e._zod.processJSONSchema=(n,r,i)=>bc(e,n,r,i),e.element=t.element},{min(e,t){return this.check(Oe(e,t))},nonempty(e){return this.check(Oe(1,e))},max(e,t){return this.check(_n(e,t))},length(e,t){return this.check(vn(e,t))},unwrap(){return this.element}});function Kn(e,t){return nc(ya,e,t)}const wa=f("ZodObject",(e,t)=>{le(),Ds.init(e,t),S.init(e,t),e._zod.processJSONSchema=(n,r,i)=>yc(e,n,r,i),Cr(e,"shape",n=>n._zod.def.shape,!1)},{keyof(){return Ia(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(N(this._zod.def,{catchall:e}))},passthrough(){return this.clone(N(this._zod.def,{catchall:Un()}))},loose(){return this.clone(N(this._zod.def,{catchall:Un()}))},strict(){return this.clone(N(this._zod.def,{catchall:ba()}))},strip(){return this.clone(N(this._zod.def,{catchall:void 0}))},extend(e){return Ir(this,e)},safeExtend(e){return Tr(this,e)},merge(e){return Pr(this,e)},pick(e){return Or(this,e)},omit(e){return Er(this,e)},partial(...e){return $t(lt,this,e[0])},exactPartial(...e){return $t(Wn,this,e[0],"exactPartial")},required(...e){return Zr(Hn,this,e[0])}});function C(e,t){const n={type:"object",shape:e??{},..._(t)};return new wa(n)}const ka=f("ZodUnion",(e,t)=>{xs.init(e,t),S.init(e,t),e._zod.processJSONSchema=(n,r,i)=>wc(e,n,r,i),e.options=t.options});function Jn(e,t){return new ka({type:"union",options:e,..._(t)})}const za=f("ZodIntersection",(e,t)=>{Us.init(e,t),S.init(e,t),e._zod.processJSONSchema=(n,r,i)=>kc(e,n,r,i)});function Sa(e,t){return new za({type:"intersection",left:e,right:t})}const $a=f("ZodTuple",(e,t)=>{le(),Ks.init(e,t),S.init(e,t),e._zod.processJSONSchema=(n,r,i)=>zc(e,n,r,i)},{rest(e){return this.clone({...this._zod.def,rest:e})},partial(){const e=this._zod.def;if(e.checks?.length)throw new Error(".partial() cannot be used on tuple schemas containing refinements");return this.clone({...e,items:e.items.map(t=>new lt({type:"optional",innerType:t}))})}});function Oa(e,t,n){const r=t instanceof k,i=r?n:t,s=r?t:null;return new $a({type:"tuple",items:e,rest:s,..._(i)})}const Bn=f("ZodRecord",(e,t)=>{le(),Js.init(e,t),S.init(e,t),e._zod.processJSONSchema=(n,r,i)=>$c(e,n,r,i),e.keyType=t.keyType,e.valueType=t.valueType});function Ea(e,t,n){return!t||!t._zod?new Bn({type:"record",keyType:te(),valueType:e,..._(t)}):new Bn({type:"record",keyType:e,valueType:t,..._(n)})}const ut=f("ZodEnum",(e,t)=>{Bs.init(e,t),S.init(e,t),e._zod.processJSONSchema=(r,i,s)=>gc(e,r,i),e.enum=t.entries,e.options=[...e._zod.values];const n=new Set(Object.keys(t.entries));e.extract=(r,i)=>{const s={};for(const o of r)if(n.has(o))s[o]=t.entries[o];else throw new Error(`Key ${o} not found in enum`);return new ut({...t,checks:[],..._(i),entries:s})},e.exclude=(r,i)=>{const s={...t.entries};for(const o of r)if(n.has(o))delete s[o];else throw new Error(`Key ${o} not found in enum`);return new ut({...t,checks:[],..._(i),entries:s})}});function Ia(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new ut({type:"enum",entries:n,..._(t)})}const Ta=f("ZodTransform",(e,t)=>{le(),Vs.init(e,t),S.init(e,t),e._zod.processJSONSchema=(n,r,i)=>vc(e,n,r,i),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new Zt(e.constructor.name);n.addIssue=s=>{if(typeof s=="string")n.issues.push(ie(s,n.value,t));else{const o=s;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),"input"in o||(o.input=n.value),o.inst??(o.inst=e),n.issues.push(ie(o))}};const i=t.transform(n.value,n);return i instanceof Promise?i.then(s=>(n.value=s,n)):(n.value=i,n)}});function Pa(e){return new Ta({type:"transform",transform:e})}const lt=f("ZodOptional",(e,t)=>{nn.init(e,t),S.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Ln(e,n,r,i),e.unwrap=()=>e._zod.def.innerType});function Vn(e){return new lt({type:"optional",innerType:e})}const Wn=f("ZodExactOptional",(e,t)=>{Ws.init(e,t),S.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Ln(e,n,r,i),e.unwrap=()=>e._zod.def.innerType});function Za(e){return new Wn({type:"optional",innerType:e})}const Aa=f("ZodNullable",(e,t)=>{qs.init(e,t),S.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Oc(e,n,r,i),e.unwrap=()=>e._zod.def.innerType});function qn(e){return new Aa({type:"nullable",innerType:e})}const Na=f("ZodDefault",(e,t)=>{Hs.init(e,t),S.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Ic(e,n,r,i),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Ra(e,t){return new Na({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():wt(t)}})}const ja=f("ZodPrefault",(e,t)=>{Gs.init(e,t),S.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Tc(e,n,r,i),e.unwrap=()=>e._zod.def.innerType});function Ma(e,t){return new ja({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():wt(t)}})}const Hn=f("ZodNonOptional",(e,t)=>{Ys.init(e,t),S.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Ec(e,n,r,i),e.unwrap=()=>e._zod.def.innerType});function La(e,t){return new Hn({type:"nonoptional",innerType:e,..._(t)})}const Fa=f("ZodCatch",(e,t)=>{Xs.init(e,t),S.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Pc(e,n,r,i),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Ca(e,t){return new Fa({type:"catch",innerType:e,catchValue:typeof t=="function"?t:xr(t)})}const Da=f("ZodPipe",(e,t)=>{Qs.init(e,t),S.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Zc(e,n,r,i),e.in=t.in,e.out=t.out});function Gn(e,t){return new Da({type:"pipe",in:e,out:t})}const xa=f("ZodReadonly",(e,t)=>{eo.init(e,t),S.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Ac(e,n,r,i),e.unwrap=()=>e._zod.def.innerType});function Ua(e){return new xa({type:"readonly",innerType:e})}const Ka=f("ZodCustom",(e,t)=>{to.init(e,t),S.init(e,t),e._zod.processJSONSchema=(n,r,i)=>_c(e,n,r,i)});function Ja(e,t={}){return rc(Ka,e,t)}function Ba(e,t){return ic(e,t)}const Pe=[{id:0,name:"application",label:"Application"},{id:1,name:"news",label:"News"},{id:2,name:"session",label:"Session"},{id:3,name:"protocol",label:"Protocol"},{id:4,name:"proxy",label:"Proxy"},{id:5,name:"remote",label:"Remote"},{id:6,name:"fault",label:"Fault"},{id:7,name:"quitting",label:"Quitting"},{id:8,name:"objects",label:"Objects"},{id:9,name:"verbose",label:"Verbose"}],ft=[{id:0,name:"header_archived",label:"Header archived",category:"headers",valueKind:"height"},{id:1,name:"header_organized",label:"Header organized",category:"headers",valueKind:"height"},{id:2,name:"header_reorganized",label:"Header reorganized",category:"headers",valueKind:"height"},{id:3,name:"block_archived",label:"Block archived",category:"blocks",valueKind:"height"},{id:4,name:"block_buffered",label:"Block buffered",category:"blocks",valueKind:"height"},{id:5,name:"block_validated",label:"Block validated",category:"blocks",valueKind:"height"},{id:6,name:"block_confirmed",label:"Block confirmed",category:"blocks",valueKind:"height"},{id:7,name:"block_unconfirmable",label:"Block unconfirmable",category:"blocks",valueKind:"height"},{id:8,name:"validate_bypassed",label:"Validation bypassed",category:"block)DELIM" -R"DELIM(s",valueKind:"height"},{id:9,name:"confirm_bypassed",label:"Confirmation bypassed",category:"blocks",valueKind:"height"},{id:10,name:"tx_archived",label:"Transaction archived",category:"transactions",valueKind:"fee-rate"},{id:11,name:"tx_validated",label:"Transaction validated",category:"transactions",valueKind:"count"},{id:12,name:"tx_invalidated",label:"Transaction invalidated",category:"transactions",valueKind:"count"},{id:13,name:"block_organized",label:"Block organized",category:"chain",valueKind:"height"},{id:14,name:"block_reorganized",label:"Block reorganized",category:"chain",valueKind:"height"},{id:15,name:"template_issued",label:"Mining template issued",category:"mining",valueKind:"count"},{id:16,name:"snapshot_secs",label:"Snapshot",category:"timing",valueKind:"seconds"},{id:17,name:"prune_msecs",label:"Prune",category:"timing",valueKind:"milliseconds"},{id:18,name:"reload_msecs",label:"Store reload",category:"timing",valueKind:"milliseconds"},{id:19,name:"block_usecs",label:"Serve block",category:"timing",valueKind:"microseconds"},{id:20,name:"ancestry_msecs",label:"Serve ancestry",category:"timing",valueKind:"milliseconds"},{id:21,name:"filter_msecs",label:"Serve filter",category:"timing",valueKind:"milliseconds"},{id:22,name:"filterhashes_msecs",label:"Serve filter hashes",category:"timing",valueKind:"milliseconds"},{id:23,name:"filterchecks_msecs",label:"Serve filter checkpoints",category:"timing",valueKind:"milliseconds"},{id:24,name:"ecdsa_secs",label:"ECDSA batch verification",category:"timing",valueKind:"seconds"},{id:25,name:"schnorr_secs",label:"Schnorr batch verification",category:"timing",valueKind:"seconds"},{id:26,name:"silent_secs",label:"Silent payment scan",category:"timing",valueKind:"seconds"},{id:27,name:"validate_usecs",label:"Block validation",category:"timing",valueKind:"microseconds"},{id:28,name:"unknown",label:"Unknown",category:"chain",valueKind:"unknown"}],Yn=E().int().nonnegative().max(864e13),Xn=C({level:E().int().nonnegative(),time:Yn,message:te()}),Qn=C({event:E().int().nonnegative(),value:E().nonnegative(),time:Yn}),er=C({previous:E().nonnegative()});Jn([Xn,Qn,er]);const Va=2**Pe.length-1,tr=2**ft.length-1;function nr(e,t){return Number.isInteger(t)&&t>=0&&t{this.#u(r)},onHeartbeat:r=>{this.#u(r)},onBeforeStop:r=>{r.send("/v1/log/subscribe?filter=0"),r.send("/v1/event/subscribe?filter=0")},onMessage:r=>{const i=Ha(r);if(!i)return!1;if(rr(i)&&!nr(this.#e,i.level))return!0;for(const s of this.#t)s(i);return!0},onUnclaimed:r=>{for(const i of this.#i)i(r)}}}getStatus=()=>this.#c.getStatus();subscribeStatus=t=>this.#c.subscribeStatus(t);start(){this.#r??=this.#c.attach(this.#a)}stop(){this.#r?.(),this.#r=null}subscribeFrames(t){return this.#t.add(t),()=>{this.#t.delete(t)}}subscribeInvalidFrames(t){return this.#i.add(t),()=>{this.#i.delete(t)}}setFilters(t,n){this.#e!==t&&(this.#e=t,this.#c.send(`/v1/log/subscribe?filter=${String(t)}`)),this.#n!==n&&(this.#n=n,this.#c.send(`/v1/event/subscribe?filter=${String(n)}`))}#u(t){t.send(`/v1/log/subscribe?filter=${String(this.#e)}`),t.send(`/v1/event/subscribe?filter=${String(this.#n)}`)}}function Qa(e){const t=e.trim();if(!t)throw new Error("Endpoint URL is required");const n=/^[a-z][a-z\\d+\\-.]*:\\/\\//iu.test(t)?t:`http://${t}`,r=new URL(n);if(r.protocol!=="http:"&&r.protocol!=="https:")throw new Error("Endpoint must use HTTP or HTTPS");return r.pathname=r.pathname.replace(/\\/+$/u,"")||"/",r.search="",r.hash="",r.toString().replace(/\\/$/u,"")}function eu(e){const t=new URL(Qa(e));return t.protocol=t.protocol==="https:"?"wss:":"ws:",t.pathname="/",t.search="",t.hash="",t.toString()}const tu=C({store:C({address:T(),filter:T(),silent:E().int().nonnegative().nullable(),turbo:T(),pruned:E().int().nonnegative()}),node:C({network:te(),limited:T().optional(),blocks:T().optional(),witness:T().optional(),filters:T().optional(),privacy:T().optional()}),wallet:C({p2kh:E().int(),p2sh:E().int(),wif:E().int(),witness:te(),silent:te(),hd_private:E().int(),hd_public:E().int()}).optional(),network:C({relay:T(),alert:T(),reject:T(),compact:T(),address:T(),witness_tx:T(),memory_pool:T(),not_found:T(),protocol_maximum:E().int(),protocol_minimum:E().int()}).optional(),forks:Ea(te(),T()).transform(e=>Object.keys(e).filter(t=>e[t]))}),nu=C({height:E().int().nonnegative(),timestamp:E().int().positive().max(4294967295)}),Ae=E().int().nonnegative().max(Number.MAX_SAFE_INTEGER),ru=C({count:Ae,virtual:Ae,fee:Ae,histogram:Kn(Oa([E().nonnegative(),Ae]))}),iu="/v1/fees?format=json",su=5e3,ou=15e3,cu=E().int().nonnegative();function au(e){try{const t=JSON.parse(e),n=tu.safeParse(t);if(n.success)return{type:"configuration",payload:n.data};const r=nu.safeParse(t);if(r.success)return{type:"header",payload:r.data};const i=ru.safeParse(t);if(i.success)return{type:"fees",payload:i.data};const s=cu.safeParse(t);return s.success?{type:"top",payload:s.data}:null}catch{return null}}function uu(e){return`/v1/block/height/${String(e)}/header?format=json`}const ir=15e3,sr=3*ir,or={configuration:null,configurationReceivedAt:null,top:null,topReceivedAt:null,topHeader:null,headerReceivedAt:null,fees:null,invalidFrames:0};class lu{#e=or;#n=new Set;#t;#i;#c=null;#a=null;#r;#u=null;#s=null;#o=null;#p;#f=null;#h=null;constructor(t,n={}){this.#r=n.now??Date.now,this.#p=n.pollIntervalMs??ir,this.#t=t,this.#i={heartbeatMs:this.#p,onOpen:r=>{this.#u=this.#r(),r.send("/v1/configuration?format=json"),r.send("/v1/top/subscribe?format=json"),this.#h=null,this.#g()},onHeartbeat:r=>{const i=this.#e.topReceivedAt??this.#u;if(i!==null&&this.#r()-i>=sr){try{r.close(4e3,"Native top response timed out")}catch{}return}r.send("/v1/top?format=json")},onBeforeStop:r=>{r.send("/v1/top/subscribe?format=json&stop=true")},onMessage:r=>{const i=au(r);return i?(this.#d(i),!0):!1},onUnclaimed:()=>{this.#l({...this.#e,invalidFrames:this.#e.invalidFrames+1})}}}getStatus=()=>this.#t.getStatus();subscribeStatus=t=>this.#t.subscribeStatus(t);getState=()=>this.#e;subscribeState=t=>(this.#n.add(t),()=>{this.#n.delete(t)});start(){this.#f??=setInterval(()=>{this.#g()},su),this.#a??=this.#t.subscribeStatus(()=>{this.#t.getStatus().phase!=="connected"&&(this.#u=null,this.#h=null,this.#s=null,this.#o=null,this.#v())}),this.#c??=this.#t.attach(this.#i)}stop(){this.#f!==null&&clearInterval(this.#f),this.#f=null,this.#h=null,this.#a?.(),this.#a=null,this.#c?.(),this.#c=null}#d(t){const n=this.#r();if(t.type==="fees"){this.#h=null,this.#l({...this.#e,fees:{data:t.payload,receivedAt:n}});return}if(t.type==="top"){const r=this.#e.top!==null&&t.payloadnew WebSocket(n))},this.#s=this.#e.retryMinimumMs}getStatus=()=>this.#n;subscribeStatus=t=>(this.#i.add(t),()=>{this.#i.delete(t)});attach(t){this.#r.push(t);const n=this.#t;return n?.readyState===1&&this.#n.phase==="connected"&&(t.onOpen?.(n),this.#h(n,t)),()=>{const r=this.#r.indexOf(t);if(r<0)return;this.#r.splice(r,1),this.#m(t);const i=this.#t;if(i?.readyState===1)try{t.onBeforeStop?.(i)}catch{}}}start(){this.#o||(this.#o=!0,this.#s=this.#e.retryMinimumMs,this.#p())}stop(){this.#o=!1,this.#v();const t=this.#t;if(this.#t=null,t)try{if(t.readyState===1)for(const n of[...this.#r])n.onBeforeStop?.(t);t.close()}catch{}this.#l(cr)}send(t){if(this.#t?.readyState!==1)return!1;try{return this.#t.send(t),!0}catch{return!1}}#p(){if(!this.#o||this.#t)return;const t=this.#n.reconnects>0;this.#l({...this.#n,phase:t?"reconnecting":"connecting",attempt:this.#n.attempt+1,error:null});let n;try{n=this.#e.webSocketFactory(this.#e.url),this.#t=n}catch(r){this.#l({...this.#n,error:du(r)}),this.#f();return}this.#c=setTimeout(()=>{if(this.#t===n){this.#l({...this.#n,error:"Connection timed out"});try{n.close()}catch{this.#t=null,this.#f()}}},this.#e.connectTimeoutMs),n.addEventListener("open",()=>{if(!(this.#t!==n||!this.#o)){this.#d(),this.#s=this.#e.retryMinimumMs,this.#l({...this.#n,phase:"connected",connectedAt:this.#e.now(),error:null});for(const r of[...this.#r]){if(this.#t!==n)return;r.onOpen?.(n),this.#h(n,r)}}}),n.addEventListener("message",r=>{if(this.#t!==n||!this.#o)return;const i=hu(r.data);if(i===null)return;const s=this.#e.now();(this.#n.lastMessageAt===null||s-this.#n.lastMessageAt>=1e3)&&this.#l({...this.#n,lastMessageAt:s});const o=[...this.#r];if(!o.some(c=>c.onMessage(i)))for(const c of o)c.onUnclaimed?.(i)}),n.addEventListener("error",()=>{if(!(this.#t!==n||!this.#o)){this.#l({...this.#n,error:"WebSocket connection failed"});try{n.close()}catch{this.#t=null,this.#f()}}}),n.addEventListener("close",()=>{this.#t===n&&(this.#t=null,this.#d(),this.#g(),this.#o&&this.#f())})}#f(){if(!this.#o||this.#a)return;const t=1+(this.#e.random()*2-1)*this.#e.jitterRatio,n=Math.max(0,Math.round(this.#s*t));this.#s=Math.min(this.#s*2,this.#e.retryMaximumMs),this.#l({...this.#n,phase:"reconnecting",reconnects:this.#n.reconnects+1,connectedAt:null}),this.#a=setTimeout(()=>{this.#a=null,this.#p()},n)}#h(t,n){this.#m(n);const r=n.heartbeatMs??24e4;if(!n.onHeartbeat||r<=0)return;const i=setInterval(()=>{this.#t===t&&t.readyState===1&&n.onHeartbeat?.(t)},r);this.#u.set(n,i)}#d(){this.#c&&(clearTimeout(this.#c),this.#c=null)}#m(t){const n=this.#u.get(t);n!==void 0&&(clearInterval(n),this.#u.delete(t))}#g(){for(const t of this.#u.values())clearInterval(t);this.#u.clear()}#v(){this.#d(),this.#g(),this.#a&&(clearTimeout(this.#a),this.#a=null)}#l(t){this.#n=t;for(const n of this.#i)n()}}function hu(e){return typeof e=="string"?e:e instanceof ArrayBuffer?new TextDecoder().decode(e):null}function du(e){return e instanceof Error?e.message:"Unable to create WebSocket"}const ne=["occurrence-rate","occurrence-count","cumulative-occurrences"],pu=["payload-latest","payload-maximum","payload-change-rate",...ne],mu=["payload-average","payload-latest","payload-minimum","payload-maximum",...ne],gu=["payload-sum","payload-cumulative","payload-latest","payload-average",...ne],ar=["payload-latest","payload-average","payload-minimum","payload-maximum"],ur=[{field:"count",id:"pool:count",label:"Pool transactions",payloadKind:"transactions",description:"Current confirmable transaction count in the pool."},{field:"virtual",id:"pool:vsize",label:"Pool virtual size",payloadKind:"vbytes",description:"Total virtual size of the current pool, in vbytes."},{field:"fee",id:"pool:total_fee",label:"Pool total fees",payloadKind:"satoshis",description:"Total fees of the current pool, in satoshis."}];function lr(e){return`event:${String(e)}`}function fr(e){return`log:${String(e)}`}const ht="native:top";function _u(e){switch(e){case"height":return"height";case"seconds":case"milliseconds":case"microseconds":return"duration";case"count":return"count";case"fee-rate":return"fee-rate";default:return"unknown"}}function vu(e){switch(e){case"height":return pu;case"duration":return mu;case"count":return gu;case"fee-rate":return[...ar,...ne];default:return ne}}function bu(e){switch(e){case"height":return"payload-latest";case"duration":return"payload-average";case"count":return"payload-sum";default:return"occurrence-rate"}}function yu(e){const t=Ze(e),n=_u(t.valueKind);return{id:lr(e),source:"event",sourceId:e,name:t.name,label:t.label,category:t.category,payloadKind:n,allowedMeasures:vu(n),defaultMeasure:bu(n),description:e===10?"Newly archived transactions, including compact-block recovery. Occurrences measure archival, not all received transactions. Fee rate is normalized to sat/vB.":n==="unknown"?"Payload semantics are unknown; occurrence measurements are safe.":`${t.label} event with a ${n} payload.`}}const wu=[...ur.map(e=>({id:e.id,source:"pool",sourceId:e.field,name:e.field,label:e.label,category:"pool",payloadKind:e.payloadKind,allowedMeasures:ar,defaultMeasure:"payload-latest",description:e.description})),...ft.map(e=>yu(e.id)),...Pe.map(e=>({id:fr(e.id),source:"log",sourceId:e.id,name:e.name,label:`${e.label} logs`,category:"logs",payloadKind:"text",allowedMeasures:ne,defaultMeasure:"occurrence-rate",description:`${e.label} log message volume. Message text is not interpreted as numeric data.`})),{id:ht,source:"native",sourceId:"top",name:"canonical_top",label:"Current top",category:"native",payloadKind:"height",allowedMeasures:["payload-latest","payload-maximum","payload-change-rate"],defaultMeasure:"payload-latest",description:"Canonical chain height reported by the native interface."}];new Map(wu.map(e=>[e.id,e]));function ku(e,t){return Ze(e).valueKind==="fee-rate"?t/1e3:Ya(e,t)??t}const zu=3600*1e3,Su=1e3,$u=1e3,Ou=1e3;class hr{constructor(t){this.capacity=t,this.#e=Array.from({length:t})}capacity;#e;#n=0;#t=0;#i=null;get size(){return this.#t}push(t){const n=this.#t===this.capacity;return this.#i=null,this.#e[this.#n]=t,this.#n=(this.#n+1)%this.capacity,this.#t=Math.min(this.#t+1,this.capacity),n}clear(){this.#i=null,this.#e.fill(void 0),this.#n=0,this.#t=0}newestFirst(){if(this.#i)return this.#i;const t=[];for(let n=0;nthis.#A;getRecentLogs=()=>this.#i.newestFirst();getRecentEvents=()=>this.#c.newestFirst();subscribe=t=>(this.#t.add(t),()=>{this.#t.delete(t)});start(){thi)DELIM" -R"DELIM(s.#k||(this.tick(),this.#k=setInterval(()=>{this.tick()},1e3))}stop(){this.#k&&(clearInterval(this.#k),this.#k=null),this.#_&&(clearTimeout(this.#_),this.#_=null)}ingest(t,n=this.#e()){const r=this.#b(n);this.#g+=1,rr(t)?this.#j(t,r):Wa(t)?this.#M(t,r):qa(t)&&(this.#I+=1),this.#z()}recordInvalidFrame(){this.#T+=1,this.#z()}recordNativeTop(t,n=this.#e()){const r=this.#b(n),i=this.#f[ht];i?.value===t&&r-i.time<15e3||(this.#S(ht,r,t),this.#N(r),this.#z())}recordNativeFees(t,n=this.#e()){if(!Number.isFinite(n)||n=ou||this.#y!==null&&n<=this.#y.receivedAt)return;const r=this.#b(n);this.#y={data:t,receivedAt:n};for(const i of ur)this.#S(i.id,r,t[i.field]);this.#N(r),this.#z()}clearLogs(){this.#O+=this.#i.size,this.#i.clear(),this.flush()}clearEvents(){this.#c.clear(),this.flush()}reset(){this.#i.clear(),this.#c.clear(),this.#a.clear(),this.#r={},this.#u={},this.#s={},this.#o={},this.#p={},this.#f={},this.#h={},this.#d=this.#b(this.#e()),this.#g=0,this.#v=0,this.#l=0,this.#O=0,this.#E=0,this.#I=0,this.#T=0,this.#P=null,this.#Z=null,this.#y=null,this.#w=0,this.#$(this.#d),this.flush()}tick(){const t=this.#b(this.#e());this.#$(t),this.#N(t),this.#z()}flush(){this.#_&&(clearTimeout(this.#_),this.#_=null),this.#A=this.#R();for(const t of this.#t)t()}#j(t,n){this.#v+=1,this.#P=n,this.#w+=1,this.#i.push({...t,id:this.#w,receivedAt:n})&&(this.#l+=1),this.#S(fr(t.level),n,null)}#M(t,n){this.#E+=1,this.#Z=n,this.#w+=1,this.#c.push({...t,id:this.#w,receivedAt:n}),this.#S(lr(t.event),n,ku(t.event,t.value))}#b(t){return Number.isFinite(t)?(this.#m=Math.max(this.#m,t),this.#m):this.#m}#S(t,n,r){const i=this.#$(n);i.snapshot=null;const s=i.signals.get(t)??Eu();if(s.count+=1,Ne(this.#o,t,1),r!==null){s.samples+=1,s.sum+=r,s.minimum=s.minimum===null?r:Math.min(s.minimum,r),s.maximum=s.maximum===null?r:Math.max(s.maximum,r),(s.firstAt===null||n=s.lastAt)&&(s.last=r,s.lastAt=n),Ne(this.#p,t,r);const o=this.#f[t];(!o||n>=o.time)&&(this.#f[t]={value:r,time:n}),this.#h[t]=Math.max(this.#h[t]??r,r)}i.signals.set(t,s)}#$(t){const n=Math.floor(t/1e3)*1e3,r=this.#a.get(n);if(r)return r;const i={time:n,signals:new Map,snapshot:null};return this.#a.set(n,i),i}#N(t){const n=t-zu;for(const[r,i]of this.#a){if(r>=n)break;for(const[s,o]of i.signals)if(Ne(this.#r,s,o.count),Ne(this.#u,s,o.sum),o.last!==null&&o.lastAt!==null){const c=this.#s[s];(!c||o.lastAt>=c.time)&&(this.#s[s]={value:o.last,time:o.lastAt})}this.#a.delete(r)}}#z(){!this.#n||this.#_||(this.#_=setTimeout(()=>{this.#_=null,this.flush()},Su))}#R(){const t=[...this.#a.values()].map(n=>(n.snapshot??={time:n.time,signals:Object.fromEntries([...n.signals].map(([r,i])=>[r,{...i}]))},n.snapshot));return{now:this.#b(this.#e()),sessionStartedAt:this.#d,totalFrames:this.#g,totalLogs:this.#v,evictedLogs:this.#l,clearedLogs:this.#O,totalEvents:this.#E,totalAcks:this.#I,invalidFrames:this.#T,buckets:t,priorSignalCounts:{...this.#r},priorSignalSums:{...this.#u},priorSignalLatest:dr(this.#s),signalTotals:{...this.#o},signalSums:{...this.#p},signalLatest:dr(this.#f),signalMaximums:{...this.#h},recentLogs:this.#i.newestFirst(),recentEvents:this.#c.newestFirst(),lastLogAt:this.#P,lastEventAt:this.#Z,poolSnapshot:this.#y}}}const Re=40;function Tu(e,t){const n=t.search.trim().toLowerCase(),r=e.filter(o=>nr(t.filter,o.level)&&(!n||o.message.toLowerCase().includes(n)||Ga(o.level).name.includes(n))),i=Number.isFinite(t.offset)?Math.max(0,Math.floor(t.offset)):0,s=Math.min(i,Math.max(0,r.length-Re));return{logs:r.slice(s,s+Re),retained:e.length,matched:r.length,offset:s}}function Pu(e,t){const n=t.search.trim().toLowerCase(),r=e.filter(o=>{const c=Ze(o.event);return(t.category==="all"||c.category===t.category)&&(!n||c.name.includes(n)||c.label.toLowerCase().includes(n)||String(o.value).includes(n))}),i=Number.isFinite(t.offset)?Math.max(0,Math.floor(t.offset)):0,s=Math.min(i,Math.max(0,r.length-Re));return{events:r.slice(s,s+Re),retained:e.length,matched:r.length,offset:s}}function Zu(e,t){const{buckets:n,recentLogs:r,recentEvents:i,...s}=e,o=new Map(t?.buckets.map(c=>[c.time,c]));return{summary:s,reset:t===null,firstBucketTime:n[0]?.time??e.now,buckets:n.filter(c=>o.get(c.time)!==c),recentLogs:r===t?.recentLogs?null:r,recentEvents:i===t?.recentEvents?null:i}}class Au{constructor(t,n=i=>new fu({url:eu(i)}),r=Date.now){this.send=t,this.createSocket=n,this.#e=new Iu(r,!1)}send;createSocket;#e;#n=null;#t=null;#i=[];#c=null;#a=null;#r=0;#u=null;#s=null;#o=null;#p=[];handle(t){if(t.type==="stop"){this.#d(),this.#e.stop(),this.send({type:"stopped"});return}if(t.type==="configure"){if(t.generation=this.#r&&this.#f(t.generation);return}if(t.generation===this.#r)switch(t.type){case"pause-display":{t.stream==="logs"?this.#s=t.paused?this.#s??this.#e.getRecentLogs():null:this.#o=t.paused?this.#o??this.#e.getRecentEvents():null;break}case"poll-events":{this.send({type:"events",generation:this.#r,requestId:t.requestId,queryVersion:t.queryVersion,window:Pu(this.#o??this.#e.getRecentEvents(),t.query)});break}case"poll-logs":{this.send({type:"logs",generation:this.#r,requestId:t.requestId,queryVersion:t.queryVersion,window:Tu(this.#s??this.#e.getRecentLogs(),t.query)});break}case"native-top":{this.#e.recordNativeTop(t.height,t.receivedAt);break}case"native-fees":{this.#e.recordNativeFees(t.fees,t.receivedAt);break}case"clear-logs":{this.#e.clearLogs(),this.#s!==null&&(this.#s=[]);break}case"clear-events":{this.#e.clearEvents(),this.#o!==null&&(this.#o=[]);break}case"poll":{if(!this.#n)return;this.#e.flush();const n=this.#e.getSnapshot();this.send({type:"snapshot",generation:this.#r,requestId:t.requestId,status:this.#n.getStatus(),update:Zu(n,this.#u)}),this.#u=n;break}}}#f(t){this.#r=t,this.#u=null,this.#s!==null&&(this.#s=[]),this.#o!==null&&(this.#o=[]),this.#e.reset()}#h(t,n,r){this.#d(),this.#c=t,this.#a=n;const i=this.createSocket(t),s=n===t?i:this.createSocket(n);this.#i=i===s?[i]:[i,s];const o=new Xa(i,{logFilter:r}),c=new lu(s),a=()=>{this.send({type:"native",status:c.getStatus(),live:c.getState()})};this.#n=o,this.#t=c,this.#p=[o.subscribeFrames(u=>{this.#e.ingest(u)}),o.subscribeInvalidFrames(()=>{this.#e.recordInvalidFrame()}),c.subscribeStatus(a),c.subscribeState(a)],o.start(),c.start();for(const u of this.#i)u.start()}#d(){for(const t of this.#p)t();this.#p=[];for(const t of this.#i)t.stop();this.#n?.stop(),this.#t?.stop(),this.#i=[],this.#n=null,this.#t=null}}const dt=globalThis,Nu=new Au(e=>{dt.postMessage(e)});dt.addEventListener("message",e=>{Nu.handle(e.data),e.data.type==="stop"&&dt.close()})})();\n',P_=typeof self<"u"&&self.Blob&&new Blob(["(self.URL || self.webkitURL).revokeObjectURL(self.location.href);",mx],{type:"text/javascript;charset=utf-8"});function _j(n){let i;try{if(i=P_&&(self.URL||self.webkitURL).createObjectURL(P_),!i)throw"";const a=new Worker(i,{name:n?.name});return a.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(i)}),a}catch{return new Worker("data:text/javascript;charset=utf-8,"+encodeURIComponent(mx),{name:n?.name})}}const K_=100,px=15e3,Sj=3*px,Su={configuration:null,configurationReceivedAt:null,top:null,topReceivedAt:null,topHeader:null,headerReceivedAt:null,fees:null,invalidFrames:0};function xj(n,i){const a=new Map((i.reset?[]:n.buckets).filter(l=>l.time>=i.firstBucketTime).map(l=>[l.time,l]));for(const l of i.buckets)a.set(l.time,l);return{...i.summary,buckets:[...a.values()],recentLogs:Yf(i.reset?[]:n.recentLogs,i.recentLogs),recentEvents:Yf(i.reset?[]:n.recentEvents,i.recentEvents)}}function Yf(n,i){if(i===null)return n;const a=new Map(n.map(l=>[l.id,l]));return i.map(l=>a.get(l.id)??l)}const Hr={phase:"idle",attempt:0,reco)DELIM" -R"DELIM(nnects:0,connectedAt:null,lastMessageAt:null,error:null};class wj{constructor(i=()=>new _j){this.createWorker=i}createWorker;#e=null;#t=new Xb().getSnapshot();#n=Hr;#i=new Set;#s=new Set;#r=Hr;#l=Su;#f=new Set;#u=null;#o=null;#b=to;#a=0;#g=0;#c=null;#h=null;#_=null;#m=new Set;#S={logs:[],retained:0,matched:0,offset:0};#E={search:"",filter:to,offset:0};#x=0;#v=null;#w=null;#p=new Set;#A={events:[],retained:0,matched:0,offset:0};#M={search:"",category:"all",offset:0};#T=0;#d=null;#O=!1;#k=!1;getSnapshot=()=>this.#t;getStatus=()=>this.#n;getNativeStatus=()=>this.#r;getNativeLive=()=>this.#l;subscribeNative=i=>(this.#f.add(i),()=>{this.#f.delete(i)});getLogWindow=()=>this.#S;getEventWindow=()=>this.#A;subscribeEvents=i=>(this.#p.add(i),this.#j(),this.#U(),()=>{this.#p.delete(i),this.#p.size===0&&this.#N()});subscribeLogs=i=>(this.#m.add(i),this.#z(),this.#R(),()=>{this.#m.delete(i),this.#m.size===0&&this.#D()});subscribe=i=>(this.#i.add(i),()=>{this.#i.delete(i)});subscribeStatus=i=>(this.#s.add(i),()=>{this.#s.delete(i)});configure(i,a,l){i===this.#u&&a===this.#o&&l===this.#b||(this.#u!==null&&i!==this.#u&&(this.reset(),this.#L({...Hr,phase:"connecting"})),this.#o!==null&&a!==this.#o&&this.#$({...Hr,phase:"connecting"},Su),this.#u=i,this.#o=a,this.#b=l,this.#C())}start(){if(!(this.#e||this.#u===null||this.#o===null))try{const i=this.createWorker();this.#e=i,this.#S={logs:[],retained:0,matched:0,offset:0},this.#A={events:[],retained:0,matched:0,offset:0};for(const a of this.#m)a();for(const a of this.#p)a();this.#L({...Hr,phase:"connecting"}),this.#$({...Hr,phase:"connecting"},Su),i.onmessage=a=>{if(this.#e!==i)return;const l=a.data;if(l.type==="events"){if(l.requestId!==this.#d||(this.#d=null,l.generation!==this.#a))return;if(l.queryVersion!==this.#T){this.#j();return}this.#A={...l.window,events:Yf(this.#A.events,l.window.events)};for(const u of this.#p)u();return}if(l.type==="logs"){if(l.requestId!==this.#v||(this.#v=null,l.generation!==this.#a))return;if(l.queryVersion!==this.#x){this.#z();return}this.#S={...l.window,logs:Yf(this.#S.logs,l.window.logs)};for(const u of this.#m)u();return}if(l.type==="native"){this.#$(l.status,l.live);return}if(l.type==="snapshot"&&l.requestId===this.#c&&(this.#c=null,l.generation===this.#a)){this.#t=xj(this.#t,l.update),this.#L(l.status);for(const u of this.#i)u()}},i.onerror=()=>{this.#H("Telemetry worker failed. Reload the dashboard to reconnect.")},i.onmessageerror=()=>{this.#H("Unable to read telemetry worker data. Reload the dashboard to reconnect.")},this.#C(),this.#O&&this.#y({type:"pause-display",generation:this.#a,stream:"logs",paused:!0}),this.#k&&this.#y({type:"pause-display",generation:this.#a,stream:"events",paused:!0}),this.#Z(),this.getStatus().error===null&&(this.#h=setInterval(()=>{this.#Z()},1e3)),this.#R(),this.#U()}catch(i){this.#H(`Unable to start telemetry worker: ${i instanceof Error?i.message:String(i)}`)}}stop(){this.#B();const i=this.#e;if(this.#e=null,i){const a=setTimeout(()=>{i.terminate()},500),l=()=>{clearTimeout(a),i.terminate()};i.onmessage=u=>{u.data.type==="stopped"&&l()},i.onerror=l,i.onmessageerror=l;try{i.postMessage({type:"stop"})}catch{l()}}this.#L(Hr),this.#$(Hr,Su)}recordNativeTop(i,a=Date.now()){this.#y({type:"native-top",generation:this.#a,height:i,receivedAt:a})}recordNativeFees(i,a=Date.now()){this.#y({type:"native-fees",generation:this.#a,fees:i,receivedAt:a})}clearLogs(){this.#y({type:"clear-logs",generation:this.#a}),this.#x+=1,this.#z()}clearEvents(){this.#y({type:"clear-events",generation:this.#a}),this.#T+=1,this.#j()}setLogsPaused(i){i!==this.#O&&(this.#O=i,this.#D(),this.#y({type:"pause-display",generation:this.#a,stream:"logs",paused:i}),this.#x+=1,this.#z(),this.#R())}setEventsPaused(i){i!==this.#k&&(this.#k=i,this.#N(),this.#y({type:"pause-display",generation:this.#a,stream:"events",paused:i}),this.#T+=1,this.#j(),this.#U())}reset(){this.#a+=1,this.#c=null,this.#v=null,this.#d=null,this.#S={logs:[],retained:0,matched:0,offset:0},this.#A={events:[],retained:0,matched:0,offset:0},this.#t=new Xb().getSnapshot(),this.#y({type:"reset",generation:this.#a});for(const i of this.#i)i();for(const i of this.#m)i();for(const i of this.#p)i()}setLogQuery(i){JSON.stringify(i)!==JSON.stringify(this.#E)&&(this.#E=i,this.#x+=1,this.#z())}setEventQuery(i){JSON.stringify(i)!==JSON.stringify(this.#M)&&(this.#M=i,this.#T+=1,this.#j())}#U(){!this.#e||this.#p.size===0||this.#w||this.#k||(this.#w=setInterval(()=>{this.#j()},K_),this.#j())}#j(){this.#d!==null||!this.#e||this.#p.size===0||(this.#d=++this.#g,this.#y({type:"poll-events",generation:this.#a,requestId:this.#d,queryVersion:this.#T,query:this.#M}))}#N(){this.#w&&clearInterval(this.#w),this.#w=null,this.#d=null}#R(){!this.#e||this.#m.size===0||this.#_||this.#O||(this.#_=setInterval(()=>{this.#z()},K_),this.#z())}#z(){this.#v!==null||!this.#e||this.#m.size===0||(this.#v=++this.#g,this.#y({type:"poll-logs",generation:this.#a,requestId:this.#v,queryVersion:this.#x,query:this.#E}))}#D(){this.#_&&clearInterval(this.#_),this.#_=null,this.#v=null}#C(){this.#u!==null&&this.#o!==null&&this.#y({type:"configure",generation:this.#a,endpoint:this.#u,nativeEndpoint:this.#o,logFilter:this.#b})}#Z(){this.#c!==null||!this.#e||(this.#c=++this.#g,this.#y({type:"poll",generation:this.#a,requestId:this.#c}))}#y(i){try{this.#e?.postMessage(i)}catch{this.#H("Unable to communicate with telemetry worker. Reload the dashboard to reconnect.")}}#B(){this.#D(),this.#N(),this.#h&&clearInterval(this.#h),this.#h=null,this.#c=null}#H(i){this.#B(),this.#e?.terminate(),this.#e=null,this.#L({...Hr,error:i}),this.#$({...Hr,error:i},Su)}#$(i,a){this.#r=i,this.#l=a;for(const l of this.#f)l()}#L(i){if(JSON.stringify(i)!==JSON.stringify(this.#n)){this.#n=i;for(const a of this.#s)a()}}}const gx="libbitcoinAdminDashboardLogFilter";function vx(){try{return globalThis.localStorage}catch{return null}}function zj(n=vx()){try{const i=n?.getItem(gx);if(!i)return to;const a=JSON.parse(i);return typeof a=="number"&&Number.isInteger(a)&&a>=0&&a<=Fp?a:to}catch{return to}}function Tj(n,i=vx()){try{i?.setItem(gx,String(n))}catch{}}const yx=se.createContext(void 0),Ej=n=>{const i=se.useContext(yx);if(!i)throw new Error("No QueryClient set, use QueryClientProvider to set one");return i},Oj=({client:n,children:i})=>(se.useEffect(()=>(n.mount(),()=>{n.unmount()}),[n]),x.jsx(yx.Provider,{value:n,children:i})),Nj={setTimeout:(n,i)=>setTimeout(n,i),clearTimeout:n=>clearTimeout(n),setInterval:(n,i)=>setInterval(n,i),clearInterval:n=>clearInterval(n)};var Aj=class{#e=Nj;#t=!1;setTimeoutProvider(n){this.#e=n}setTimeout(n,i){return this.#e.setTimeout(n,i)}clearTimeout(n){this.#e.clearTimeout(n)}setInterval(n,i){return this.#e.setInterval(n,i)}clearInterval(n){this.#e.clearInterval(n)}};const Qa=new Aj;function Mj(n){setTimeout(n,0)}const jj=typeof window>"u"||"Deno"in globalThis;function gi(){}function kj(n,i){return typeof n=="function"?n(i):n}function bx(n){return typeof n=="number"&&n>=0&&n!==1/0}function _x(n,i){return Math.max(n+(i||0)-Date.now(),0)}function kt(n,i){return typeof n=="function"?n(i):n}function G_(n,i){const{type:a="all",exact:l,fetchStatus:u,predicate:f,queryKey:d,stale:m}=n;if(d){if(l){if(i.queryHash!==pg(d,i.options))return!1}else if(!fo(i.queryKey,d))return!1}if(a!=="all"){const p=i.isActive();if(a==="active"&&!p||a==="inactive"&&p)return!1}return!(typeof m=="boolean"&&i.isStale()!==m||u&&u!==i.state.fetchStatus||f&&!f(i))}function Y_(n,i){const{exact:a,status:l,predicate:u,mutationKey:f}=n;if(f){if(!i.options.mutationKey)return!1;if(a){if(Lu(i.options.mutationKey)!==Lu(f))return!1}else if(!fo(i.options.mutationKey,f))return!1}return!(l&&i.state.status!==l||u&&!u(i))}function pg(n,i){return(i?.queryKeyHashFn||Lu)(n)}function Lu(n){return JSON.stringify(n,(i,a)=>zp(a)?Object.keys(a).sort().reduce((l,u)=>(l[u]=a[u],l),{}):a)}function fo(n,i){if(n===i)return!0;if(typeof n!=typeof i)return!1;if(n&&i&&typeof n=="object"&&typeof i=="object"){if(Array.isArray(n)&&Array.isArra)DELIM" -R"DELIM(y(i)){if(i.length>n.length)return!1;for(let l=0;l500)return i;const l=F_(n)&&F_(i);if(!l&&!(zp(n)&&zp(i)))return i;const u=(l?n:Object.keys(n)).length,f=l?i:Object.keys(i),d=f.length,m=l?new Array(d):{};let p=0;for(let g=0;g{Qa.setTimeout(i,n)})}function Tp(n,i,a){return typeof a.structuralSharing=="function"?a.structuralSharing(n,i):a.structuralSharing!==!1?xx(n,i):i}function Cj(n,i,a=0){const l=[...n,i];return a&&l.length>a?l.slice(-a):l}function Dj(n,i,a=0){const l=[i,...n];return a&&l.length>a?l.slice(0,a):l}const gg=Symbol();function wx(n,i){return!n.queryFn&&i?.initialPromise?()=>i.initialPromise:!n.queryFn||n.queryFn===gg?()=>Promise.reject(new Error(`Missing queryFn: '${n.queryHash}'`)):n.queryFn}function zx(n,i){return typeof n=="function"?n(...i):!!n}const vg=Symbol();function Uj(n,i,a,l){let u=!1,f;return Object.defineProperties(n,{[vg]:{value:l},signal:{enumerable:!0,get:()=>(f??=i(),u||(u=!0,f.aborted?a():f.addEventListener("abort",a,{once:!0})),f)}}),n}let Zj=()=>jj;const yg=()=>Zj();var qu=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(n){return this.listeners.add(n),this.onSubscribe(),()=>{this.listeners.delete(n),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},$j=class extends qu{#e;#t;#n;constructor(){super(),this.#n=n=>{if(typeof window<"u"&&window.addEventListener){const i=()=>n();return window.addEventListener("visibilitychange",i,!1),()=>{window.removeEventListener("visibilitychange",i)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(n){this.#n=n,this.#t?.(),this.#t=n(i=>{typeof i=="boolean"?this.setFocused(i):this.onFocus()})}setFocused(n){this.#e!==n&&(this.#e=n,this.onFocus())}onFocus(){const n=this.isFocused();this.listeners.forEach(i=>{i(n)})}isFocused(){return typeof this.#e=="boolean"?this.#e:globalThis.document?.visibilityState!=="hidden"}};const bg=new $j,Lj=Mj;function Hj(){let n=[],i=0,a=m=>{m()},l=m=>{m()},u=Lj;const f=m=>{i?n.push(m):u(()=>{a(m)})},d=()=>{const m=n;n=[],m.length&&u(()=>{l(()=>{m.forEach(p=>{a(p)})})})};return{batch:m=>{let p;i++;try{p=m()}finally{i--,i||d()}return p},batchCalls:m=>(...p)=>{f(()=>{m(...p)})},schedule:f,setNotifyFunction:m=>{a=m},setBatchNotifyFunction:m=>{l=m},setScheduler:m=>{u=m}}}const Un=Hj();var Bj=class extends qu{#e=!0;#t;#n;constructor(){super(),this.#n=n=>{if(typeof window<"u"&&window.addEventListener){const i=()=>n(!0),a=()=>n(!1);return window.addEventListener("online",i,!1),window.addEventListener("offline",a,!1),()=>{window.removeEventListener("online",i),window.removeEventListener("offline",a)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(n){this.#n=n,this.#t?.(),this.#t=n(this.setOnline.bind(this))}setOnline(n){this.#e!==n&&(this.#e=n,this.listeners.forEach(i=>{i(n)}))}isOnline(){return this.#e}};const Ff=new Bj;function qj(n){return Math.min(1e3*2**n,3e4)}function Tx(n){return(n??"online")==="online"?Ff.isOnline():!0}var Ep=class extends Error{constructor(n){super("CancelledError"),this.revert=n?.revert,this.silent=n?.silent}};function Ex(n){let i=!1,a=0,l,u="pending",f,d;const m=new Promise((D,X)=>{f=D,d=X});m.catch(gi);const p=()=>u!=="pending",g=D=>{if(!p()){const X=new Ep(D);A(X),n.onCancel?.(X)}},b=()=>{i=!0},y=()=>{i=!1},w=()=>bg.isFocused()&&(n.networkMode==="always"||Ff.isOnline())&&n.canRun(),O=()=>Tx(n.networkMode)&&n.canRun(),T=D=>{p()||(l?.(),u="resolved",f(D))},A=D=>{p()||(l?.(),u="rejected",d(D))},k=D=>new Promise(X=>{l=G=>{(p()||D())&&X(G)},n.onPause?.()}).then(()=>{l=void 0,p()||n.onContinue?.()}),L=()=>{if(p())return;let D;const X=a===0?n.initialPromise:void 0;try{D=X??n.fn()}catch(G){D=Promise.reject(G)}Promise.resolve(D).then(T).catch(G=>{if(p())return;const ee=n.retry??(yg()?0:3),V=n.retryDelay??qj,ne=typeof V=="function"?V(a,G):V,ae=ee===!0||typeof ee=="number"&&ap()||w()?void 0:k(w)).then(()=>{i?A(G):L()})})};return{promise:m,status:()=>u,cancel:g,continue:()=>(l?.(),m),cancelRetry:b,continueRetry:y,canStart:O,start:()=>(O()?L():k(O).then(L),m)}}var Ox=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),bx(this.gcTime)&&(this.#e=Qa.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(n){this.gcTime=Math.max(this.gcTime||0,n??(yg()?1/0:3e5))}clearGcTimeout(){this.#e!==void 0&&(Qa.clearTimeout(this.#e),this.#e=void 0)}};function Vj(n){return{onFetch:(i,a)=>{const l=i.options,u=i.fetchOptions?.meta?.fetchMore?.direction,f=i.state.data?.pages||[],d=i.state.data?.pageParams||[];let m={pages:[],pageParams:[]},p=0;const g=async()=>{let b=!1;const y=i,w=A=>{Uj(A,()=>i.signal,()=>b=!0,y[vg])},O=wx(i.options,i.fetchOptions),T=async(A,k,L)=>{if(b)return Promise.reject(i.signal.reason);if(k==null&&A.pages.length)return Promise.resolve(A);const X=(()=>{const ne={client:i.client,queryKey:i.queryKey,pageParam:k,direction:L?"backward":"forward",meta:i.options.meta};return w(ne),ne})(),G=await O(X),{maxPages:ee}=i.options,V=L?Dj:Cj;return{pages:V(A.pages,G,ee),pageParams:V(A.pageParams,k,ee)}};if(u&&f.length){const A=u==="backward",k=A?Ij:J_,L={pages:f,pageParams:d};m=await T(L,k(l,L),A)}else{const A=n??f.length;do{const k=p===0?d[0]===void 0?l.initialPageParam:d[0]:J_(l,m);if(p>0&&k==null)break;m=await T(m,k),p++}while(pi.options.persister?.(g,{client:i.client,queryKey:i.queryKey,meta:i.options.meta,signal:i.signal},a):i.fetchFn=g}}}function J_(n,{pages:i,pageParams:a}){const l=i.length-1;return i.length>0?n.getNextPageParam(i[l],i,a[l],a):void 0}function Ij(n,{pages:i,pageParams:a}){return i.length>0?n.getPreviousPageParam?.(i[0],i,a[0],a):void 0}var Pj=class extends Ox{#e;#t;#n;#i;#s;#r;#l;#f;#u;constructor(n){super(),this.#u=!1,this.#f=n.defaultOptions,this.setOptions(n.options),this.observers=[],this.#s=n.client,this.#i=this.#s.getQueryCache(),this.queryKey=n.queryKey,this.queryHash=n.queryHash,this.#t=W_(this.options),this.state=n.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#r?.promise}setOptions(n){if(this.options={...this.#f,...n},n?._type&&(this.#e=n._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const i=W_(this.options);i.data!==void 0&&(this.setState(X_(i.data,i.dataUpdatedAt)),this.#t=i)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&this.#i.remove(this)}setData(n,i){const a=Tp(this.state.data,n,this.options);return this.#o({data:a,type:"success",dataUpdatedAt:i?.updatedAt,manual:i?.manual}),a}setState(n){this.#o({type:"setState",state:n})}cancel(n){const i=this.#r?.promise;return this.#r?.cancel(n),i?i.then(gi).catch(gi):Promise.resolve()})DELIM" -R"DELIM(destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(n=>kt(n.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===gg||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.state.data===void 0?!1:this.getObserversCount()>0?this.observers.some(n=>kt(n.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(n=>n.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(n=0){return this.state.data===void 0?!0:n==="static"?!1:this.state.isInvalidated?!0:!_x(this.state.dataUpdatedAt,n)}onFocus(){this.observers.find(n=>n.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#r?.continue()}onOnline(){this.observers.find(n=>n.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#r?.continue()}addObserver(n){this.observers.includes(n)||(this.observers.push(n),this.clearGcTimeout(),this.#i.notify({type:"observerAdded",query:this,observer:n}))}removeObserver(n){const i=this.observers.indexOf(n);i!==-1&&(this.observers.splice(i,1),this.observers.length||(this.#r&&(this.#u||this.state.fetchStatus==="paused"&&this.state.status==="pending"?this.#r.cancel({revert:!0}):this.#r.cancelRetry()),this.scheduleGc()),this.#i.notify({type:"observerRemoved",query:this,observer:n}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#o({type:"invalidate"})}async fetch(n,i){if(this.state.fetchStatus!=="idle"&&this.#r?.status()!=="rejected"){if(this.state.data!==void 0&&i?.cancelRefetch)this.cancel({silent:!0});else if(this.#r&&this.#l)return this.#r.continueRetry(),this.#l}if(n&&this.setOptions(n),!this.options.queryFn){const g=this.observers.find(b=>b.options.queryFn);g&&this.setOptions(g.options)}const a=new AbortController,l=g=>{Object.defineProperties(g,{[vg]:{value:a.signal,enumerable:!0},signal:{enumerable:!0,get:()=>(this.#u=!0,a.signal)}})},u=()=>{const g=wx(this.options,i),y=(()=>{const w={client:this.#s,queryKey:this.queryKey,meta:this.meta};return l(w),w})();return this.#u=!1,this.options.persister?this.options.persister(g,y,this):g(y)},d=(()=>{const g={fetchOptions:i,options:this.options,queryKey:this.queryKey,client:this.#s,state:this.state,fetchFn:u};return l(g),g})();(this.#e==="infinite"?Vj(this.options.pages):this.options.behavior)?.onFetch(d,this),this.#n=this.state,(this.state.fetchStatus==="idle"||this.state.fetchMeta!==d.fetchOptions?.meta)&&this.#o({type:"fetch",meta:d.fetchOptions?.meta});const m=this.#r=Ex({initialPromise:i?.initialPromise,fn:d.fetchFn,onCancel:g=>{g instanceof Ep&&g.revert&&this.setState({...this.#n,fetchStatus:"idle"}),a.abort()},onFail:(g,b)=>{this.#o({type:"failed",failureCount:g,error:b})},onPause:()=>{this.#o({type:"pause"})},onContinue:()=>{this.#o({type:"continue"})},retry:d.options.retry,retryDelay:d.options.retryDelay,networkMode:d.options.networkMode,canRun:()=>!0}),p=(async()=>{try{const g=await m.promise;if(g===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(g),this.#i.config.onSuccess?.(g,this),this.#i.config.onSettled?.(g,this.state.error,this),g}catch(g){if(g instanceof Ep){if(g.silent){if(this.#r!==m&&this.#l)return this.#l;throw g}else if(g.revert){if(this.state.data===void 0)throw g;return this.state.data}}throw this.#o({type:"error",error:g}),this.#i.config.onError?.(g,this),this.#i.config.onSettled?.(this.state.data,g,this),g}finally{this.#r===m&&(this.#r=void 0,this.#l=void 0),this.scheduleGc()}})();return this.#l=p,m.start(),p}#o(n){const i=a=>{switch(n.type){case"failed":return{...a,fetchFailureCount:n.failureCount,fetchFailureReason:n.error};case"pause":return{...a,fetchStatus:"paused"};case"continue":return{...a,fetchStatus:"fetching"};case"fetch":return{...a,...Nx(a.data,this.options),fetchMeta:n.meta??null};case"success":const l={...a,...X_(n.data,n.dataUpdatedAt),dataUpdateCount:a.dataUpdateCount+1,...!n.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return this.#n=n.manual?l:void 0,l;case"error":const u=n.error;return{...a,error:u,errorUpdateCount:a.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:a.fetchFailureCount+1,fetchFailureReason:u,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...a,isInvalidated:!0};case"setState":return{...a,...n.state}}};this.state=i(this.state),Un.batch(()=>{this.observers.slice().forEach(a=>{a.onQueryUpdate()}),this.#i.notify({query:this,type:"updated",action:n})})}};function Nx(n,i){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Tx(i.networkMode)?"fetching":"paused",...n===void 0&&{error:null,status:"pending"}}}function X_(n,i){return{data:n,dataUpdatedAt:i??Date.now(),error:null,isInvalidated:!1,status:"success"}}function W_(n){const i=typeof n.initialData=="function"?n.initialData():n.initialData,a=i!==void 0,l=a?typeof n.initialDataUpdatedAt=="function"?n.initialDataUpdatedAt():n.initialDataUpdatedAt:0;return{data:i,dataUpdateCount:0,dataUpdatedAt:a?l??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:a?"success":"pending",fetchStatus:"idle"}}var Kj=class extends qu{#e;#t=void 0;#n=void 0;#i=void 0;#s;#r;#l;#f;#u;#o;#b;#a;#g;#c=new Set;constructor(n,i){super(),this.options=i,this.#e=n,this.#l=null,this.bindMethods(),this.setOptions(i)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),e1(this.#t,this.options)?this.#h():this.updateResult(),this.#x())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Op(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Op(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#v(),this.#w(),this.#t.removeObserver(this)}setOptions(n){const i=this.options,a=this.#t;if(this.options=this.#e.defaultQueryOptions(n),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof kt(this.options.enabled,this.#t)!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#p(),this.#t.setOptions(this.options),i._defaulted&&!Jm(this.options,i)&&this.#e.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#t,observer:this});const l=this.hasListeners();l&&t1(this.#t,a,this.options,i)&&this.#h(),this.updateResult(),l&&(this.#t!==a||kt(this.options.enabled,this.#t)!==kt(i.enabled,this.#t)||kt(this.options.staleTime,this.#t)!==kt(i.staleTime,this.#t))&&this.#m();const u=this.#S();l&&(this.#t!==a||kt(this.options.enabled,this.#t)!==kt(i.enabled,this.#t)||u!==this.#g)&&this.#E(u)}getOptimisticResult(n){const i=this.#e.getQueryCache().build(this.#e,n),a=this.createResult(i,n);return Jm(this.getCurrentResult(),a)||(this.#i=a,this.#r=this.options,this.#s=this.#t.state),a}getCurrentResult(){return this.#i}trackResult(n,i){return new Proxy(n,{get:(a,l)=>(this.trackProp(l),i?.(l),Reflect.get(a,l))})}trackProp(n){this.#c.add(n)}getCurrentQuery(){return this.#t}refetch({...n}={}){return this.fetch({...n})}fetchOptimistic(n){const i=this.#e.defaultQueryOptions(n),a=this.#e.getQueryCache().build(this.#e,i);let l=()=>{},u;const f=new Promise(d=>{u=d,l=this.#e.getQueryCache().subscribe(m=>{m.type==="updated"&&m.query.queryHash===a.queryHash&&a.state.data!==void 0&&(l(),d(this.createResult(a,i)))})});return Promise.race([a.fetch(i).then(()=>{const d=this.createResult(a,i);return u?.(d),d}).finally(()=>{l()}),f])}fetch(n){return this.#h({...n,cancelRefetch:n.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#i))}#h(n){this.#p();let i=this.#t.fetch(this.options,n);return n?.throwOnError||(i=i.catch)DELIM" -R"DELIM((gi)),i}#_(n){return!yg()&&kt(this.options.enabled,this.#t)!==!1&&bx(n)}#m(){this.#v();const n=kt(this.options.staleTime,this.#t);if(this.#i.isStale||!this.#_(n))return;const i=_x(this.#i.dataUpdatedAt,n)+1;this.#b=Qa.setTimeout(()=>{this.#i.isStale||this.updateResult()},i)}#S(){return kt(this.options.refetchInterval,this.#t)??!1}#E(n){this.#w(),this.#g=n,!(this.#g===0||!this.#_(this.#g))&&(this.#a=Qa.setInterval(()=>{(this.options.refetchIntervalInBackground||bg.isFocused())&&this.#h()},this.#g))}#x(){this.#m(),this.#E(this.#S())}#v(){this.#b!==void 0&&(Qa.clearTimeout(this.#b),this.#b=void 0)}#w(){this.#a!==void 0&&(Qa.clearInterval(this.#a),this.#a=void 0)}createResult(n,i){const a=this.#t,l=this.options,u=this.#i,f=this.#s,d=this.#r,m=n!==a?n.state:this.#n,{state:p}=n;let g={...p},b=!1,y;if(i._optimisticResults){const ee=this.hasListeners(),V=!ee&&e1(n,i),ne=ee&&t1(n,a,i,l);(V||ne)&&(g={...g,...Nx(p.data,n.options)}),i._optimisticResults==="isRestoring"&&(g.fetchStatus="idle")}let{error:w,errorUpdatedAt:O,status:T}=g;y=g.data;let A=!1;if(i.placeholderData!==void 0&&y===void 0&&T==="pending"){let ee;u?.isPlaceholderData&&i.placeholderData===d?.placeholderData?(ee=u.data,A=!0):ee=typeof i.placeholderData=="function"?i.placeholderData(this.#o?.state.data,this.#o):i.placeholderData,ee!==void 0&&(T="success",y=Tp(u?.data,ee,i),b=!0)}if(i.select&&y!==void 0&&!A)if(u&&y===f?.data&&i.select===this.#f)y=this.#u;else try{this.#f=i.select,y=i.select(y),y=Tp(u?.data,y,i),this.#u=y,this.#l=null}catch(ee){this.#l=ee}else y===void 0&&(this.#l=null);this.#l&&(w=this.#l,y=this.#u,O=u?.error===w?u.errorUpdatedAt:Date.now(),T="error",b=!1);const k=g.fetchStatus==="fetching",L=T==="pending",D=T==="error",X=L&&k,G=y!==void 0;return{status:T,fetchStatus:g.fetchStatus,isPending:L,isSuccess:T==="success",isError:D,isInitialLoading:X,isLoading:X,data:y,dataUpdatedAt:g.dataUpdatedAt,error:w,errorUpdatedAt:O,failureCount:g.fetchFailureCount,failureReason:g.fetchFailureReason,errorUpdateCount:g.errorUpdateCount,isFetched:n.isFetched(),isFetchedAfterMount:g.dataUpdateCount>m.dataUpdateCount||g.errorUpdateCount>m.errorUpdateCount,isFetching:k,isRefetching:k&&!L,isLoadingError:D&&!G,isPaused:g.fetchStatus==="paused",isPlaceholderData:b,isRefetchError:D&&G,isStale:_g(n,i),refetch:this.refetch,isEnabled:kt(i.enabled,n)!==!1}}updateResult(){const n=this.#i,i=this.createResult(this.#t,this.options);if(this.#s=this.#t.state,this.#r=this.options,this.#s.data!==void 0&&(this.#o=this.#t),Jm(i,n))return;this.#i=i;const l=(()=>{if(!n)return!0;const{notifyOnChangeProps:u}=this.options,f=typeof u=="function"?u():u;if(f==="all"||!f&&!this.#c.size||this.options.throwOnError&&this.#i.error!==n.error)return!0;for(const d of f??this.#c)if(this.#i[d]!==n[d])return!0;return!1})();Un.batch(()=>{l&&this.listeners.forEach(u=>{u(this.#i)}),this.#e.getQueryCache().notify({query:this.#t,type:"observerResultsUpdated"})})}#p(){const n=this.#e.getQueryCache().build(this.#e,this.options);if(n===this.#t)return;const i=this.#t;this.#t=n,this.#n=n.state,this.hasListeners()&&(i?.removeObserver(this),n.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#x()}};function Gj(n,i){return kt(i.enabled,n)!==!1&&n.state.data===void 0&&!(n.state.status==="error"&&kt(i.retryOnMount,n)===!1)}function e1(n,i){return Gj(n,i)||n.state.data!==void 0&&Op(n,i,i.refetchOnMount)}function Op(n,i,a){if(kt(i.enabled,n)!==!1&&kt(i.staleTime,n)!=="static"){const l=kt(a,n);return l==="always"||l!==!1&&_g(n,i)}return!1}function t1(n,i,a,l){return(n!==i||kt(l.enabled,n)===!1)&&(!a.suspense||n.state.status!=="error")&&_g(n,a)}function _g(n,i){return kt(i.enabled,n)!==!1&&n.isStaleByTime(kt(i.staleTime,n))}var Yj=class extends Ox{#e;#t;#n;#i;constructor(n){super(),this.#e=n.client,this.mutationId=n.mutationId,this.#n=n.mutationCache,this.#t=[],this.state=n.state||Fj(),this.setOptions(n.options),this.scheduleGc()}setOptions(n){this.options=n,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(n){this.#t.includes(n)||(this.#t.push(n),this.clearGcTimeout(),this.#n.notify({type:"observerAdded",mutation:this,observer:n}))}removeObserver(n){this.#t=this.#t.filter(i=>i!==n),this.scheduleGc(),this.#n.notify({type:"observerRemoved",mutation:this,observer:n})}optionalRemove(){this.#t.length||(this.state.status==="pending"?this.scheduleGc():this.#n.remove(this))}continue(){return this.#i?.continue()??(this.state.status==="pending"?this.execute(this.state.variables):Promise.resolve())}async execute(n){const i=()=>{this.#s({type:"continue"})},a={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey},l=this.#i=Ex({fn:()=>this.options.mutationFn?this.options.mutationFn(n,a):Promise.reject(new Error("No mutationFn found")),onFail:(d,m)=>{this.#s({type:"failed",failureCount:d,error:m})},onPause:()=>{this.#s({type:"pause"})},onContinue:i,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)}),u=this.state.status==="pending",f=!l.canStart();try{if(u)i();else{this.#s({type:"pending",variables:n,isPaused:f}),this.#n.config.onMutate&&await this.#n.config.onMutate(n,this,a);const m=await this.options.onMutate?.(n,a);m!==this.state.context&&this.#s({type:"pending",context:m,variables:n,isPaused:f})}this.state.isPaused&&l.canStart()&&i();const d=await l.start();return await this.#n.config.onSuccess?.(d,n,this.state.context,this,a),await this.options.onSuccess?.(d,n,this.state.context,a),await this.#n.config.onSettled?.(d,null,this.state.variables,this.state.context,this,a),await this.options.onSettled?.(d,null,n,this.state.context,a),this.#s({type:"success",data:d}),d}catch(d){try{await this.#n.config.onError?.(d,n,this.state.context,this,a)}catch(m){Promise.reject(m)}try{await this.options.onError?.(d,n,this.state.context,a)}catch(m){Promise.reject(m)}try{await this.#n.config.onSettled?.(void 0,d,this.state.variables,this.state.context,this,a)}catch(m){Promise.reject(m)}try{await this.options.onSettled?.(void 0,d,n,this.state.context,a)}catch(m){Promise.reject(m)}throw this.#s({type:"error",error:d}),d}finally{this.#i===l&&(this.#i=void 0),this.#n.runNext(this)}}#s(n){const i=a=>{switch(n.type){case"failed":return{...a,failureCount:n.failureCount,failureReason:n.error};case"pause":return{...a,isPaused:!0};case"continue":return{...a,isPaused:!1};case"pending":return{...a,context:n.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:n.isPaused,status:"pending",variables:n.variables,submittedAt:Date.now()};case"success":return{...a,data:n.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...a,data:void 0,error:n.error,failureCount:a.failureCount+1,failureReason:n.error,isPaused:!1,status:"error"}}};this.state=i(this.state),Un.batch(()=>{this.#t.forEach(a=>{a.onMutationUpdate(n)}),this.#n.notify({mutation:this,type:"updated",action:n})})}};function Fj(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Qj=class extends qu{#e;#t;#n;constructor(n={}){super(),this.config=n,this.#e=new Set,this.#t=new Map,this.#n=0}build(n,i,a){const l=new Yj({client:n,mutationCache:this,mutationId:++this.#n,options:n.defaultMutationOptions(i),state:a});return this.add(l),l}add(n){this.#e.add(n);const i=Ef(n);if(typeof i=="string"){const a=this.#t.get(i);a?a.push(n):this.#t.set(i,[n])}this.notify({type:"added",mutation:n})}remove(n){if(this.#e.delete(n)){const i=Ef(n);if(typeof i=="string"){const a=this.#t.get(i);if(a)if(a.length>1){const l=a.indexOf(n);l!==-1&&a.splice(l,1)}else a[0]===n&&this.#t.delete(i)}}this.notify({type:"removed",mutation:n})}canRun(n){const i=Ef(n);if(typeof i=="string"){const a=this.#t.get(i)?.find(l=>l.state.status==="pending");return!a||a===n}else return!0}runNext(n){const i=Ef(n);return typeof i=="string"?this.#t.get(i)?.find(a=>a!==n&&a)DELIM" -R"DELIM(.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){Un.batch(()=>{const n=this.getAll();this.#e.clear(),this.#t.clear(),n.forEach(i=>{this.notify({type:"removed",mutation:i})})})}getAll(){return Array.from(this.#e)}find(n){const i={exact:!0,...n};return this.getAll().find(a=>Y_(i,a))}findAll(n={}){return this.getAll().filter(i=>Y_(n,i))}notify(n){Un.batch(()=>{this.listeners.forEach(i=>{i(n)})})}resumePausedMutations(){const n=this.getAll().filter(i=>i.state.isPaused);return Un.batch(()=>Promise.all(n.map(i=>i.continue().catch(gi))))}};function Ef(n){return n.options.scope?.id}var Jj=class extends qu{#e;constructor(n={}){super(),this.config=n,this.#e=new Map}build(n,i,a){const l=i.queryKey,u=i.queryHash??pg(l,i);let f=this.get(u);return f||(f=new Pj({client:n,queryKey:l,queryHash:u,options:n.defaultQueryOptions(i),state:a,defaultOptions:n.getQueryDefaults(l)}),this.add(f)),f}add(n){this.#e.has(n.queryHash)||(this.#e.set(n.queryHash,n),this.notify({type:"added",query:n}))}remove(n){this.#e.get(n.queryHash)===n&&(n.destroy(),this.#e.delete(n.queryHash),this.notify({type:"removed",query:n}))}clear(){Un.batch(()=>{this.getAll().forEach(n=>{this.remove(n)})})}get(n){return this.#e.get(n)}getAll(){return[...this.#e.values()]}find(n){const i={exact:!0,...n};return this.getAll().find(a=>G_(i,a))}findAll(n={}){const i=this.getAll();return Object.keys(n).length>0?i.filter(a=>G_(n,a)):i}notify(n){Un.batch(()=>{this.listeners.forEach(i=>{i(n)})})}onFocus(){Un.batch(()=>{this.getAll().forEach(n=>{n.onFocus()})})}onOnline(){Un.batch(()=>{this.getAll().forEach(n=>{n.onOnline()})})}},Xj=class{#e;#t;#n;#i;#s;#r;#l;#f;constructor(n={}){this.#e=n.queryCache||new Jj,this.#t=n.mutationCache||new Qj,this.#n=n.defaultOptions||{},this.#i=new Map,this.#s=new Map,this.#r=0}mount(){this.#r++,this.#r===1&&(this.#l=bg.subscribe(async n=>{n&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#f=Ff.subscribe(async n=>{n&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#r--,this.#r===0&&(this.#l?.(),this.#l=void 0,this.#f?.(),this.#f=void 0)}isFetching(n){return this.#e.findAll({...n,fetchStatus:"fetching"}).length}isMutating(n){return this.#t.findAll({...n,status:"pending"}).length}getQueryData(n){const i=this.defaultQueryOptions({queryKey:n});return this.#e.get(i.queryHash)?.state.data}ensureQueryData(n){const i=this.defaultQueryOptions(n),a=this.#e.build(this,i),l=a.state.data;return l===void 0?this.fetchQuery(n):(n.revalidateIfStale&&a.isStaleByTime(kt(i.staleTime,a))&&this.prefetchQuery(i),Promise.resolve(l))}getQueriesData(n){return this.#e.findAll(n).map(({queryKey:i,state:a})=>[i,a.data])}setQueryData(n,i,a){const l=this.defaultQueryOptions({queryKey:n}),u=this.#e.get(l.queryHash)?.state.data,f=kj(i,u);if(f!==void 0)return this.#e.build(this,l).setData(f,{...a,manual:!0})}setQueriesData(n,i,a){return Un.batch(()=>this.#e.findAll(n).map(({queryKey:l})=>[l,this.setQueryData(l,i,a)]))}getQueryState(n){const i=this.defaultQueryOptions({queryKey:n});return this.#e.get(i.queryHash)?.state}removeQueries(n){const i=this.#e;Un.batch(()=>{i.findAll(n).forEach(a=>{i.remove(a)})})}resetQueries(n,i){const a=this.#e;return Un.batch(()=>{const l=a.findAll(n),u=new Set(l);return l.forEach(f=>{f.reset()}),this.refetchQueries({type:"active",predicate:f=>u.has(f)},i)})}cancelQueries(n,i={}){const a={revert:!0,...i},l=Un.batch(()=>this.#e.findAll(n).map(u=>u.cancel(a)));return Promise.all(l).then(gi).catch(gi)}invalidateQueries(n,i={}){return Un.batch(()=>(this.#e.findAll(n).forEach(a=>{a.invalidate()}),n?.refetchType==="none"?Promise.resolve():this.refetchQueries({...n,type:n?.refetchType??n?.type??"active"},i)))}refetchQueries(n,i={}){const a={...i,cancelRefetch:i.cancelRefetch??!0},l=Un.batch(()=>this.#e.findAll(n).filter(u=>!u.isDisabled()&&!u.isStatic()).map(u=>{let f=u.fetch(void 0,a);const d=u.state.fetchStatus==="paused";return(!a.throwOnError||d)&&(f=f.catch(gi)),d?Promise.resolve():f}));return Promise.all(l).then(gi)}async query(n){const i=this.defaultQueryOptions(n);i.retry===void 0&&(i.retry=!1);const a=this.#e.build(this,i),l=a.isStaleByTime(kt(i.staleTime,a))?await a.fetch(i):a.state.data,u=i.select;return u?u(l):l}fetchQuery(n){const i=this.defaultQueryOptions(n);i.retry===void 0&&(i.retry=!1);const a=this.#e.build(this,i);return a.isStaleByTime(kt(i.staleTime,a))?a.fetch(i):Promise.resolve(a.state.data)}prefetchQuery(n){return this.fetchQuery(n).then(gi).catch(gi)}infiniteQuery(n){return n._type="infinite",this.query(n)}fetchInfiniteQuery(n){return n._type="infinite",this.fetchQuery(n)}prefetchInfiniteQuery(n){return this.fetchInfiniteQuery(n).then(gi).catch(gi)}ensureInfiniteQueryData(n){return n._type="infinite",this.ensureQueryData(n)}resumePausedMutations(){return Ff.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(n){this.#n=n}setQueryDefaults(n,i){this.#i.set(Lu(n),{queryKey:n,defaultOptions:i})}getQueryDefaults(n){const i=[...this.#i.values()],a={};return i.forEach(l=>{fo(n,l.queryKey)&&Object.assign(a,l.defaultOptions)}),a}setMutationDefaults(n,i){this.#s.set(Lu(n),{mutationKey:n,defaultOptions:i})}getMutationDefaults(n){const i=[...this.#s.values()],a={};return i.forEach(l=>{fo(n,l.mutationKey)&&Object.assign(a,l.defaultOptions)}),a}defaultQueryOptions(n){if(n._defaulted)return n;const i={...this.#n.queries,...this.getQueryDefaults(n.queryKey),...n,_defaulted:!0};return i.queryHash||(i.queryHash=pg(i.queryKey,i)),i.refetchOnReconnect===void 0&&(i.refetchOnReconnect=i.networkMode!=="always"),i.throwOnError===void 0&&(i.throwOnError=!!i.suspense),!i.networkMode&&i.persister&&(i.networkMode="offlineFirst"),i.queryFn===gg&&(i.enabled=!1),i}defaultMutationOptions(n){return n?._defaulted?n:{...this.#n.mutations,...n?.mutationKey&&this.getMutationDefaults(n.mutationKey),...n,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}};const Ax=se.createContext(!1),Wj=()=>se.useContext(Ax);Ax.Provider;function ek(){let n=!1;return{clearReset:()=>{n=!1},reset:()=>{n=!0},isReset:()=>n}}const tk=se.createContext(ek()),nk=()=>se.useContext(tk),ik=(n,i,a)=>{const l=a?.state.status==="error"&&typeof n.throwOnError=="function"?zx(n.throwOnError,[a.state.error,a]):n.throwOnError;(n.suspense||l)&&(i.isReset()||(n.retryOnMount=!1))},rk=n=>{se.useEffect(()=>{n.clearReset()},[n])},sk=({result:n,errorResetBoundary:i,throwOnError:a,query:l,suspense:u})=>n.isError&&!i.isReset()&&!n.isFetching&&l&&(u&&n.data===void 0||zx(a,[n.error,l])),ak=n=>{if(n.suspense){const a=u=>u==="static"?u:Math.max(u??1e3,1e3),l=n.staleTime;n.staleTime=typeof l=="function"?(...u)=>a(l(...u)):a(l),typeof n.gcTime=="number"&&(n.gcTime=Math.max(n.gcTime,1e3))}},lk=(n,i)=>n?.suspense&&i.isPending,ok=(n,i,a)=>i.fetchOptimistic(n).catch(()=>{a.clearReset()});function uk(n,i,a){const l=Wj(),u=nk(),f=Ej(),d=f.defaultQueryOptions(n),m=f.getQueryCache().get(d.queryHash),p=n.subscribed!==!1;d._optimisticResults=l?"isRestoring":p?"optimistic":void 0,ak(d),ik(d,u,m),rk(u);const[g]=se.useState(()=>new i(f,d)),b=g.getOptimisticResult(d);se.useEffect(()=>{g.setOptions(d)},[d,g]);const y=!l&&p;if(se.useSyncExternalStore(se.useCallback(w=>{const O=y?g.subscribe(Un.batchCalls(w)):gi;return g.updateResult(),O},[g,y]),()=>g.getCurrentResult(),()=>g.getCurrentResult()),lk(d,b))throw ok(d,g,u);if(sk({result:b,errorResetBoundary:u,throwOnError:d.throwOnError,query:m,suspense:d.suspense}))throw b.error;return d.notifyOnChangeProps?b:g.trackResult(b)}function n1(n,i){return uk(n,Kj)}function ck(n,i,a,l=to){const u=se.useSyncExternalStore(a.subscribeStatus,a.getStatus,a.getStatus);return se.useEffect(()=>{a.configure(n,i,l)},[n,i,a,l]),se.useEffect(()=>(a.start(),()=>{a.stop()}),[a]),u}function fk(n,i,a){const l=se.useMemo(()=>JA(n),[n]),u=se.useSyncExternalStore(i.subscribeNative,i.getNativeStatus,i.getNativeStatus),f=se.useSyncExternalStore(i.subscribeNati)DELIM" -R"DELIM(ve,i.getNativeLive,i.getNativeLive),d=Mx(u,f,a),m=n1({queryKey:["native-snapshot",n],queryFn:({signal:w})=>s3(n,w),enabled:l&&!d,refetchInterval:px,retry:!1}),p=dk(u,f,m.data??null,a),g=i1(u,f,null,a),b=n1({queryKey:["native-fees",n],queryFn:({signal:w})=>l3(n,w),enabled:l&&g===null,refetchInterval:i3,retry:!1}),y=i1(u,f,b.data??null,a);return se.useEffect(()=>{y!==null&&i.recordNativeFees(y.data,y.receivedAt)},[y,i]),se.useEffect(()=>{p.top!==null&&i.recordNativeTop(p.top,p.receivedAt??Date.now())},[i,p.receivedAt,p.top]),{status:u,live:f,...p,restError:m.error instanceof Error?m.error.message:null}}function Mx(n,i,a){return n.phase==="connected"&&i.top!==null&&i.topReceivedAt!==null&&i.configuration!==null&&i.configurationReceivedAt!==null&&Np(i.topReceivedAt,a)}function dk(n,i,a,l){return Mx(n,i,l)?{top:i.top,topHeader:i.headerReceivedAt!==null&&Np(i.headerReceivedAt,l)?i.topHeader:null,configuration:i.configuration,receivedAt:i.topReceivedAt,transport:"websocket"}:a&&Np(a.receivedAt,l)?{top:a.top,topHeader:a.topHeader,configuration:a.configuration,receivedAt:a.receivedAt,transport:"rest"}:{top:null,topHeader:null,configuration:null,receivedAt:null,transport:"none"}}function i1(n,i,a,l){return n.phase==="connected"&&i.fees!==null&&l-i.fees.receivedAtnew wj,[]),i=zS(),[a]=se.useState(XA),[l,u]=se.useState("overview"),[f,d]=se.useState(!1),[m,p]=se.useState(zj),[g,b]=se.useState(!1),[y,w]=se.useState(!1),[O,T]=se.useState(Iz),A=se.useSyncExternalStore(n.subscribe,n.getSnapshot,n.getSnapshot),k=ck(a.adminUrl,a.nativeUrl,n,m),L=fk(a.nativeUrl,n,i),D=L.configuration?`${sS(L.configuration.forks)} ${L.configuration.node.network}`:" ",X=O3(L.top,L.topHeader,i);function G(V){Pz(V),T(V)}function ee(V){Tj(V),p(V)}return x.jsxs("div",{className:"bg-background text-textPrimary min-h-screen",children:[x.jsx("header",{className:"border-accent/30 bg-surface/90 border-b backdrop-blur",children:x.jsx("div",{className:"mx-auto max-w-7xl px-4 py-4",children:x.jsxs("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-4",children:[x.jsxs("div",{className:"order-1 flex flex-col",children:[x.jsx("button",{type:"button",onClick:()=>{u("overview")},className:"text-accent text-left text-lg font-semibold tracking-tight",children:"Libbitcoin Server"}),x.jsx("span",{className:"text-textMuted text-sm",children:D})]}),x.jsx("nav",{className:"text-textMuted order-3 flex w-full items-center gap-3 text-sm md:order-2 md:w-auto",children:hk.map(V=>x.jsxs("button",{type:"button",onClick:()=>{u(V.id)},className:`text-textMuted hover:text-accent rounded-md px-3 py-1 text-sm transition ${l===V.id?"bg-accentSecondary/20 text-accent":""}`,children:[V.label,V.id==="logs"&&A.totalLogs>0&&x.jsx("span",{className:"bg-background/60 ml-2 rounded px-1.5 py-0.5 text-[10px] tabular-nums",children:A.totalLogs>999?"999+":String(A.totalLogs)}),V.id==="events"&&A.totalEvents>0&&x.jsx("span",{className:"bg-background/60 ml-2 rounded px-1.5 py-0.5 text-[10px] tabular-nums",children:A.totalEvents>999?"999+":String(A.totalEvents)})]},V.id))}),x.jsx("div",{className:"order-2 ml-auto flex items-center gap-3 md:order-3",children:x.jsx("button",{type:"button",onClick:()=>{d(!0)},className:"border-accent/40 text-accent hover:border-accent hover:text-accentSecondary rounded-md border px-3 py-2 text-sm font-medium",children:"Settings"})})]})})}),x.jsxs("main",{className:"mx-auto min-h-[calc(100vh-4rem)] max-w-7xl min-w-0 space-y-6 px-4 py-8",children:[x.jsxs("header",{children:[x.jsx("p",{className:"text-accentSecondary text-sm tracking-wide uppercase",children:"Administration"}),x.jsx("h1",{className:"text-accent text-3xl font-semibold",children:"Admin Dashboard"})]}),l==="overview"&&x.jsx(dj,{adminStatus:k,endpoints:a,metrics:A,native:L,syncEstimate:X}),l==="logs"&&x.jsx(PA,{metrics:n,delivery:A,status:k,logFilter:m,paused:g,onLogFilterChange:ee,onPausedChange:V=>{n.setLogsPaused(V),b(V)},onClear:()=>{n.clearLogs()}}),l==="events"&&x.jsx(VA,{metrics:n,paused:y,onPausedChange:V=>{n.setEventsPaused(V),w(V)},onClear:()=>{n.clearEvents()}})]}),x.jsx(vj,{estimate:X,browserNotificationsEnabled:O}),f&&x.jsx(Gz,{browserNotificationsEnabled:O,onClose:()=>{d(!1)},onBrowserNotificationsEnabledChange:G})]})}function pk({children:n}){const[i]=se.useState(()=>new Xj({defaultOptions:{queries:{staleTime:1e4,refetchOnWindowFocus:!1,retry:1}}}));return x.jsx(Oj,{client:i,children:n})}Zz();const jx=document.querySelector("#root");if(!jx)throw new Error("Root element not found");Dz.createRoot(jx).render(x.jsx(Oz.StrictMode,{children:x.jsx(pk,{children:x.jsx(mk,{})})})); +Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const d of n.seen.entries()){const m=d[1];if(i===d[0]){f(d);continue}if(n.external){const g=n.external.registry.get(d[0])?.id;if(i!==d[0]&&g){f(d);continue}}if(n.metadataRegistry.get(d[0])?.id){f(d);continue}if(m.cycle){f(d);continue}m.count>1&&n.reused==="ref"&&f(d)}n.external&&(n.sharedDefsExtractedFor=n.external)}function V1(n){const i=n.anyOf;if(!Array.isArray(i)||i.length===0||n.type!==void 0)return;const a=[];for(const l of i){if(!l||typeof l!="object")return;V1(l);const u=Object.keys(l);if(u.length!==1||u[0]!=="type")return;const f=l.type;for(const d of Array.isArray(f)?f:[f]){if(typeof d!="string")return;a.includes(d)||a.push(d)}}delete n.anyOf,n.type=a.length===1?a[0]:a}const I1=new Set(["type","properties","required","additionalProperties"]),Db=["oneOf","anyOf"];function Ub(n){const i=n.additionalProperties;return i===void 0||i===!1||typeof i!="object"||i===null?null:Object.keys(i).length?i:null}function rp(n){const i=[];for(const f of n){if(typeof f!="object"||f.type!=="object")return null;for(const d in f)if(!I1.has(d))return null;i.push(f)}const a={},l=new Set;for(const f of i){for(const d in f.properties){if(Object.prototype.hasOwnProperty.call(a,d))continue;const m=[];for(const g of i){const b=g.properties?.[d]??Ub(g);b!=null&&(m.some(y=>JSON.stringify(y)===JSON.stringify(b))||m.push(b))}const p=m.length===1?m[0]:rp(m)??{allOf:m};ta(a,d,p)}for(const d of f.required??[])l.add(d)}const u={type:"object",properties:a};if(l.size&&(u.required=[...l]),i.every(f=>f.additionalProperties===!1))u.additionalProperties=!1;else{const f=[];for(const d of i){const m=Ub(d);m&&!f.some(p=>JSON.stringify(p)===JSON.stringify(m))&&f.push(m)}f.length===1?u.additionalProperties=f[0]:f.length>1&&(u.additionalProperties={allOf:f})}return u}function V2(n){const i=n.allOf;if(!Array.isArray(i)||i.length<2)return;for(const u of I1)if(u in n)return;const a=i.filter(u=>Db.some(f=>Array.isArray(u[f])));let l=null;if(!a.length)l=rp(i);else{const u=a[0],f=Db.find(p=>Array.isArray(u[p]));if(Object.keys(u).length!==1)return;const d=i.filter(p=>p!==u),m=u[f].map(p=>rp([...d,p]));if(m.some(p=>!p))return;l={[f]:m}}l&&(delete n.allOf,Nu(n,l))}function P1(n,i){const a=n.seen.get(i);if(!a)throw new Error("Unprocessed schema. This is a bug in Zod.");const l=m=>{const p=n.seen.get(m);if(p.ref===null)return;const g=p.def??p.schema,b={...g},y=p.ref;if(p.ref=null,y){l(y);const O=n.seen.get(y),T=O.schema;if(T.$ref&&(n.target==="draft-07"||n.target==="draft-04"||n.target==="openapi-3.0")?(g.allOf=g.allOf??[],g.allOf.push(T)):Nu(g,T),Nu(g,b),m._zod.parent===y)for(const k in g)k==="$ref"||k==="allOf"||k in b||delete g[k];if(T.$ref&&)DELIM" +R"DELIM(O.def)for(const k in g)k==="$ref"||k==="allOf"||k in O.def&&JSON.stringify(g[k])===JSON.stringify(O.def[k])&&delete g[k]}const w=m._zod.parent;if(w&&w!==y){l(w);const O=n.seen.get(w);if(O?.schema.$ref&&(g.$ref=O.schema.$ref,O.def))for(const T in g)T==="$ref"||T==="allOf"||T in O.def&&JSON.stringify(g[T])===JSON.stringify(O.def[T])&&delete g[T]}n.override({zodSchema:m,jsonSchema:g,path:p.path??[]})};if(!n.external||n.sharedEmitDoneFor!==n.external){for(const m of[...n.seen.entries()].reverse())l(m[0]);if(n.target!=="openapi-3.0")for(const m of n.seen.entries())V1(m[1].def??m[1].schema);for(const m of n.deferred)m();if(n.intersections.length){const m=new Map;for(const p of n.seen.values())for(const g of[p.schema,p.def]){const b=g?.allOf;if(!Array.isArray(b))continue;const y=m.get(b);y?y.push(g):m.set(b,[g])}for(const p of n.intersections)for(const g of m.get(p)??[])V2(g)}}const u={};if(n.target==="draft-2020-12"?u.$schema="https://json-schema.org/draft/2020-12/schema":n.target==="draft-07"?u.$schema="http://json-schema.org/draft-07/schema#":n.target==="draft-04"?u.$schema="http://json-schema.org/draft-04/schema#":n.target,n.external?.uri){const m=n.external.registry.get(i)?.id;if(!m)throw new Error("Schema is missing an `id` property");u.$id=n.external.uri(m)}Nu(u,a.defId?a.schema:a.def??a.schema);const f=n.metadataRegistry.get(i)?.id;f!==void 0&&u.id===f&&delete u.id;const d=n.external?.defs??{};if(!n.external||n.sharedEmitDoneFor!==n.external)for(const m of n.seen.entries()){const p=m[1];p.def&&p.defId&&(p.def.id===p.defId&&delete p.def.id,ta(d,p.defId,p.def))}n.external&&(n.sharedEmitDoneFor=n.external),n.external||Object.keys(d).length>0&&(n.target==="draft-2020-12"?u.$defs=d:u.definitions=d);try{const m=JSON.parse(JSON.stringify(u));return Object.defineProperty(m,"~standard",{value:{...i["~standard"],jsonSchema:{input:Lf(i,"input",n.processors),output:Lf(i,"output",n.processors)}},enumerable:!1,writable:!1}),m}catch{throw new Error("Error converting schema to JSON.")}}function si(n,i){const a=i??{seen:new Set};if(a.seen.has(n))return!1;a.seen.add(n);const l=n._zod.def;if(l.type==="transform")return!0;if(l.type==="array")return si(l.element,a);if(l.type==="set")return si(l.valueType,a);if(l.type==="lazy")return si(l.getter(),a);if(l.type==="promise"||l.type==="optional"||l.type==="nonoptional"||l.type==="nullable"||l.type==="readonly"||l.type==="default"||l.type==="prefault"||l.type==="catch")return si(l.innerType,a);if(l.type==="intersection")return si(l.left,a)||si(l.right,a);if(l.type==="record"||l.type==="map")return si(l.keyType,a)||si(l.valueType,a);if(l.type==="pipe")return n._zod.traits.has("$ZodCodec")?!0:si(l.in,a)||si(l.out,a);if(l.type==="object"){for(const u in l.shape)if(si(l.shape[u],a))return!0;return!1}if(l.type==="union"){for(const u of l.options)if(si(u,a))return!0;return!1}if(l.type==="tuple"){for(const u of l.items)if(si(u,a))return!0;return!!(l.rest&&si(l.rest,a))}return!1}const I2=(n,i={})=>a=>{const l=B1({...a,processors:i});return Kt(n,l),q1(l,n),P1(l,n)},Lf=(n,i,a={})=>l=>{const{libraryOptions:u,target:f}=l??{},d=B1({...u??{},target:f,io:i,processors:a});return Kt(n,d),q1(d,n),P1(d,n)},so=(n,i,a)=>{(n[i]===void 0||a>n[i])&&(n[i]=a)},ao=(n,i,a)=>{(n[i]===void 0||a{so(n,"minimum",i),ao(n,"maximum",i)},K1=(n,i)=>{n.multipleOf??(n.multipleOf=[]),n.multipleOf.includes(i)||n.multipleOf.push(i)},G1=(n,i)=>{n.patterns??(n.patterns=new Set),n.patterns.add(i)},Y1=(n,i)=>{n.mime=n.mime?n.mime.filter(a=>i.includes(a)):[...i]},F1=(n,i)=>{n.format=i,i.includes("int")&&(n.isInt=!0)},$b=(n,i)=>so(n,"minimum",i.minimum),Lb=(n,i)=>ao(n,"maximum",i.maximum),Hb=n=>(i,a)=>{F1(i,a.format);const[l,u]=n[a.format];so(i,"minimum",l),ao(i,"maximum",u)},P2={greater_than:(n,i)=>so(n,i.inclusive?"minimum":"exclusiveMinimum",i.value),less_than:(n,i)=>ao(n,i.inclusive?"maximum":"exclusiveMaximum",i.value),multiple_of:(n,i)=>K1(n,i.value),number_format:Hb(g1),bigint_format:Hb(lT),min_length:$b,max_length:Lb,length_equals:(n,i)=>Zb(n,i.length),min_size:$b,max_size:Lb,size_equals:(n,i)=>Zb(n,i.size),string_format:(n,i)=>{F1(n,i.format),i.pattern&&G1(n,i.pattern),(i.format==="base64"||i.format==="base64url")&&(n.contentEncoding=i.format),(i.local||i.precision===-1)&&(n.laxFormat=!0)},mime_type:(n,i)=>Y1(n,i.mime)};function Wi(n){const i={},a=n._zod.def,l=n._zod.traits.has("$ZodCheck")?[n,...a.checks??[]]:a.checks??[];for(const f of l)P2[f._zod.def.check]?.(i,f._zod.def);const u=n._zod.bag;u.minimum!==void 0&&so(i,"minimum",u.minimum),u.exclusiveMinimum!==void 0&&so(i,"exclusiveMinimum",u.exclusiveMinimum),u.maximum!==void 0&&ao(i,"maximum",u.maximum),u.exclusiveMaximum!==void 0&&ao(i,"exclusiveMaximum",u.exclusiveMaximum),u.multipleOf!==void 0&&K1(i,u.multipleOf),u.format!==void 0&&(i.format??(i.format=u.format),u.format.includes("int")&&(i.isInt=!0)),u.mime&&Y1(i,u.mime);for(const f of u.patterns??[])G1(i,f);return i}const K2={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},G2=new Map([[j1,oE],[Kp,uE]]),Q1=n=>G2.get(n)??n,Y2=(n,i,a,l)=>{const u=a;u.type="string";const{minimum:f,maximum:d,format:m,patterns:p,contentEncoding:g,laxFormat:b}=Wi(n);if(typeof f=="number"&&(u.minLength=f),typeof d=="number"&&(u.maxLength=d),m&&(u.format=K2[m]??m,u.format===""&&delete u.format,(m==="time"||b)&&delete u.format),g&&(u.contentEncoding=g),p&&p.size>0){const y=[...p].map(Q1);y.length===1?u.pattern=y[0].source:y.length>1&&(u.allOf=[...y.map(w=>({...i.target==="draft-07"||i.target==="draft-04"||i.target==="openapi-3.0"?{type:"string"}:{},pattern:w.source}))])}},F2=(n,i,a,l)=>{const u=a,{minimum:f,maximum:d,multipleOf:m,exclusiveMaximum:p,exclusiveMinimum:g,isInt:b}=Wi(n);u.type=b?"integer":"number";const y=typeof g=="number"&&g>=(f??Number.NEGATIVE_INFINITY),w=typeof p=="number"&&p<=(d??Number.POSITIVE_INFINITY),O=i.target==="draft-04"||i.target==="openapi-3.0";if(y?O?(u.minimum=g,u.exclusiveMinimum=!0):u.exclusiveMinimum=g:typeof f=="number"&&(u.minimum=f),w?O?(u.maximum=p,u.exclusiveMaximum=!0):u.exclusiveMaximum=p:typeof d=="number"&&(u.maximum=d),m){const T=new Set;for(const L of m)Number.isFinite(L)&&L!==0?T.add(Math.abs(L)):Ws(n,i,u,l,`A multipleOf divisor of ${L} cannot be represented in JSON Schema`);const[A,...k]=T;A!==void 0&&(u.multipleOf=A),k.length&&(u.allOf=[...u.allOf??[],...k.map(L=>({multipleOf:L}))])}},Q2=(n,i,a,l)=>{a.type="boolean"},J2=(n,i,a,l)=>{a.not={}},X2=(n,i,a,l)=>{},W2=(n,i,a,l)=>{const u=n._zod.def,f=Xm(u.entries);if(f.length===0){a.not={};return}f.every(d=>typeof d=="number")&&(a.type="number"),f.every(d=>typeof d=="string")&&(a.type="string"),a.enum=f},eN=(n,i,a,l)=>{const u=n._zod.def;if(u.values.length===0){a.not={};return}const f=[];for(const d of u.values)if(d===void 0){if(Ws(n,i,a,l,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof d=="bigint"){if(Ws(n,i,a,l,"BigInt literals cannot be represented in JSON Schema"))return;f.push(Number(d))}else f.push(d);if(f.length!==0)if(f.length===1){const d=f[0];a.type=d===null?"null":typeof d,i.target==="draft-04"||i.target==="openapi-3.0"?a.enum=[d]:a.const=d}else f.every(d=>typeof d=="number")&&(a.type="number"),f.every(d=>typeof d=="string")&&(a.type="string"),f.every(d=>typeof d=="boolean")&&(a.type="boolean"),f.every(d=>d===null)&&(a.type="null"),a.enum=f},tN=(n,i,a,l)=>{Ws(n,i,a,l,"Custom types cannot be represented in JSON Schema")},nN=(n,i,a,l)=>{Ws(n,i,a,l,"Transforms cannot be represented in JSON Schema")},iN=(n,i,a,l)=>{const u=a,f=n._zod.def,{minimum:d,maximum:m}=Wi(n);typeof d=="number"&&(u.minItems=d),typeof m=="number"&&(u.maxItems=m),u.type="array",u.items=Kt(f.element,i,{...l,path:[...l.path,"items"]})};function Cu(n){const i=n._zod.def;return i.type==="pipe"&&i.in._zod.traits.has("$ZodTransform")?Cu(i.out):i.type==="catch"?Cu(i.innerType):n._zod.optin}const rN=(n,i,a,l)=>{const u=a,f=n._zod.def,d=f.shape;if(Object.getOwnPropertySymbols(d).length&&Ws(n,i,u,l,"Symbol keys cannot be represented)DELIM" +R"DELIM( in JSON Schema"))return;u.type="object",u.properties={};for(const g in d)ta(u.properties,g,Kt(d[g],i,{...l,path:[...l.path,"properties",g]}));const p=[];for(const g of Object.keys(d)){const b=f.shape[g];(i.io==="input"?Cu(b)===void 0:b._zod.optout===void 0)&&p.push(g)}p.length>0&&(u.required=p),f.catchall?._zod.def.type==="never"?u.additionalProperties=!1:f.catchall?f.catchall&&(u.additionalProperties=Kt(f.catchall,i,{...l,path:[...l.path,"additionalProperties"]})):i.io==="output"&&(u.additionalProperties=!1)},sN=(n,i,a,l)=>{const u=n._zod.def,f=u.inclusive===!1,d=u.options.map((m,p)=>Kt(m,i,{...l,path:[...l.path,f?"oneOf":"anyOf",p]}));f?a.oneOf=d:a.anyOf=d},aN=(n,i,a,l)=>{const u=n._zod.def,f=Kt(u.left,i,{...l,path:[...l.path,"allOf",0]}),d=Kt(u.right,i,{...l,path:[...l.path,"allOf",1]}),m=g=>"allOf"in g&&Object.keys(g).length===1,p=[...m(f)?f.allOf:[f],...m(d)?d.allOf:[d]];a.allOf=p,i.intersections.push(p)},lN=(n,i,a,l)=>{const u=a,f=n._zod.def;u.type="array";const d=i.target==="draft-2020-12"?"prefixItems":"items",m=i.target==="draft-2020-12"||i.target==="openapi-3.0"?"items":"additionalItems",p=f.items.map((A,k)=>Kt(A,i,{...l,path:[...l.path,d,k]})),g=f.rest?Kt(f.rest,i,{...l,path:[...l.path,m,...i.target==="openapi-3.0"?[f.items.length]:[]]}):null;let b=f.items.length;for(;b>0;){const A=f.items[b-1];if(!(i.io==="input"?Cu(A)!==void 0:A._zod.optout==="optional"))break;b--}const y=f.items.length,w=!f.rest;i.target==="draft-2020-12"?(u.prefixItems=p,w?u.items=!1:g&&(u.items=g),b>0&&(u.minItems=b),w&&(u.maxItems=y)):i.target==="openapi-3.0"?(u.items={anyOf:p},g&&u.items.anyOf.push(g),b>0&&(u.minItems=b),w&&(u.maxItems=y)):(u.items=p,w?u.additionalItems=!1:g&&(u.additionalItems=g),b>0&&(u.minItems=b),w&&(u.maxItems=y));const{minimum:O,maximum:T}=Wi(n);typeof O=="number"&&(u.minItems=O),typeof T=="number"&&(u.maxItems=T)};function sp(n,i,a){if(i.$ref){if(a.has(i))return i;a.add(i);const T=n.get(i)?.def;if(!T)return i;const A=sp(n,T,a);return A===T?i:A}for(const T of["anyOf","oneOf"]){const A=i[T];if(!Array.isArray(A))continue;const k=A.map(L=>sp(n,L,a));k.some((L,D)=>L!==A[D])&&(i={...i,[T]:k})}const l=Array.isArray(i.type)?i.type:[i.type],u=!l.includes("string")&&l.some(T=>T==="number"||T==="integer"),f=i.enum??(i.const!==void 0?[i.const]:void 0);if(!u&&!f?.some(T=>typeof T=="number"))return i;const{minimum:d,maximum:m,exclusiveMinimum:p,exclusiveMaximum:g,multipleOf:b,format:y,id:w,...O}=i;return O.enum?O.enum=O.enum.map(T=>typeof T=="number"?String(T):T):typeof O.const=="number"&&(O.const=String(O.const)),u&&(O.type="string",f||(O.pattern=(l.includes("number")?Vp:vE).source)),O}const ap=new WeakMap;function oN(n){const i=new Map;for(const l of n.seen.values())l.def&&!i.has(l.schema)&&i.set(l.schema,l);const a=new Map;for(const l of ap.get(n)??[]){const u=n.seen.get(l),f=(u?.def??u?.schema)?.propertyNames;if(!f||f===!0||a.has(f))continue;const d=sp(i,f,new Set);d!==f&&a.set(f,d)}if(a.size)for(const l of n.seen.values())for(const u of[l.schema,l.def]){const f=u&&a.get(u.propertyNames);f&&(u.propertyNames=f)}}const uN=(n,i,a,l)=>{const u=a,f=n._zod.def;u.type="object";const d=f.keyType,m=Wi(d).patterns;if(f.mode==="loose"&&m&&m.size>0){const b=Kt(f.valueType,i,{...l,path:[...l.path,"patternProperties","*"]});u.patternProperties={};for(const y of m)ta(u.patternProperties,Q1(y).source,b)}else{if(i.target==="draft-07"||i.target==="draft-2020-12"){u.propertyNames=Kt(f.keyType,i,{...l,path:[...l.path,"propertyNames"]});let b=ap.get(i);b||(b=[],ap.set(i,b),i.deferred.push(()=>oN(i))),b.push(n)}u.additionalProperties=Kt(f.valueType,i,{...l,path:[...l.path,"additionalProperties"]})}const p=d._zod.values,g=i.io==="input"&&Cu(f.valueType)!==void 0;if(p&&!f.partial&&!g){const b=[...p].filter(y=>typeof y=="string"||typeof y=="number");b.length>0&&(u.required=b.map(String))}},cN=(n,i,a,l)=>{const u=n._zod.def,f=Kt(u.innerType,i,l),d=i.seen.get(n);i.target==="openapi-3.0"?(d.ref=u.innerType,a.nullable=!0):a.anyOf=[f,{type:"null"}]},fN=(n,i,a,l)=>{const u=n._zod.def;Kt(u.innerType,i,l);const f=i.seen.get(n);f.ref=u.innerType},Gp=Symbol();function J1(n,i,a,l,u){let f=!1;const d=JSON.stringify(n,(m,p)=>typeof p!="bigint"?p:(f=!0,null));return f?(Ws(i,a,l,u,"BigInt defaults cannot be represented in JSON Schema"),Gp):JSON.parse(d)}const dN=(n,i,a,l)=>{const u=n._zod.def;Kt(u.innerType,i,l);const f=i.seen.get(n);f.ref=u.innerType;const d=J1(u.defaultValue,n,i,a,l);d!==Gp&&(a.default=d)},hN=(n,i,a,l)=>{const u=n._zod.def;Kt(u.innerType,i,l);const f=i.seen.get(n);if(f.ref=u.innerType,i.io!=="input")return;const d=J1(u.defaultValue,n,i,a,l);d!==Gp&&(a._prefault=d)},mN=(n,i,a,l)=>{const u=n._zod.def;Kt(u.innerType,i,l);const f=i.seen.get(n);f.ref=u.innerType;let d;try{d=u.catchValue(void 0)}catch{Ws(n,i,a,l,"Dynamic catch values are not supported in JSON Schema");return}a.default=d},pN=(n,i,a,l)=>{const u=n._zod.def,f=u.in._zod.traits.has("$ZodTransform"),d=i.io==="input"?f?u.out:u.in:u.out;Kt(d,i,l);const m=i.seen.get(n);m.ref=d},gN=(n,i,a,l)=>{const u=n._zod.def;Kt(u.innerType,i,l);const f=i.seen.get(n);f.ref=u.innerType,a.readOnly=!0},X1=(n,i,a,l)=>{const u=n._zod.def;Kt(u.innerType,i,l);const f=i.seen.get(n);f.ref=u.innerType},Bb=new WeakSet([Object.prototype,Error.prototype]);function vf(n,i,a){Object.defineProperty(n,i,{configurable:!0,enumerable:!1,get(){const l=a(this);return Object.defineProperty(this,i,{value:l,configurable:!0,writable:!0}),l},set(l){Object.defineProperty(this,i,{value:l,configurable:!0,writable:!0})}})}const vN=(n,i)=>{AT.init(n,i),n.name="ZodError";const a=Object.getPrototypeOf(n);Bb.has(a)||(Bb.add(a),vf(a,"format",l=>u=>kT(l,u)),vf(a,"flatten",l=>u=>jT(l,u)),vf(a,"addIssue",l=>u=>{l.issues.push(u),l.message=JSON.stringify(l.issues,Wm,2)}),vf(a,"addIssues",l=>u=>{l.issues.push(...u),l.message=JSON.stringify(l.issues,Wm,2)}),Object.defineProperty(a,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},tr=Y("ZodError",vN,void 0,{Parent:Error}),yN=Lp(tr),bN=Hp(tr),_N=Bp(tr),SN=qp(tr),xN=$T(tr),wN=LT(tr),zN=HT(tr),TN=BT(tr),EN=qT(tr),ON=VT(tr),NN=IT(tr),AN=PT(tr);function MN(){er.localeError||Br(GO())}function Hu(){er.memoizer||Br({memoizer:IO()})}const Dt=Y("ZodType",(n,i)=>(MN(),Ot.init(n,i),n.def=i,n.type=i.type,n),{check(...n){const i=this.def;return this.clone(Di(i,{checks:[...i.checks??[],...n.map(a=>typeof a=="function"?{_zod:{check:a,def:{check:"custom"},onattach:[]}}:a)]}),{parent:!0})},with(...n){return this.check(...n)},clone(n,i){return na(this,n,i)},brand(){return this},register(n,i){return n.add(this,i),this},refine(n,i){return this.check(AA(n,i))},superRefine(n,i){return this.check(MA(n,i))},overwrite(n){return this.check(ho(n))},optional(){return Pb(this)},exactOptional(){return gA(this)},nullable(){return Kb(this)},nullish(){return Pb(Kb(this))},nonoptional(n){return xA(this,n)},array(){return Wf(this)},or(n){return ed([this,n])},and(n){return uA(this,n)},transform(n){return Gb(this,pA(n))},default(n){return bA(this,n)},prefault(n){return SA(this,n)},catch(n){return zA(this,n)},pipe(n){return Gb(this,n)},readonly(){return OA(this)},describe(n){const i=this.clone();return wu.add(i,{description:n}),i},meta(...n){if(n.length===0)return wu.get(this);const i=this.clone();return wu.add(i,n[0]),i},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(n,...i){return i.length===0?n(this):n(this,...i)},get"~standard"(){return y1(this,"~standard",{...E1(this),jsonSchema:{input:Lf(this,"input"),output:Lf(this,"output")}})},set"~standard"(n){Xs(this,"~standard",n)},parse:function n(i,a){return yN(this,i,a,{callee:n})},parseAsync:async function n(i,a){return await bN(this,i,a,{callee:n})},safeParse(n,i){return _N(this,n,i)},async safeParseAsync(n,i){return SN(this,n,i)},get spa(){return this?.safeParseAsync},set spa(n){Xs(this,"spa",n)},validate(n,i){return DT(this,n,i)},validateAsync(n,i){return ZT(this,n,i)},encode:function n(i,a){return xN(this,i,a,{callee:n})DELIM" +R"DELIM()},decode:function n(i,a){return wN(this,i,a,{callee:n})},encodeAsync:async function n(i,a){return await zN(this,i,a,{callee:n})},decodeAsync:async function n(i,a){return await TN(this,i,a,{callee:n})},safeEncode(n,i){return EN(this,n,i)},safeDecode(n,i){return ON(this,n,i)},async safeEncodeAsync(n,i){return NN(this,n,i)},async safeDecodeAsync(n,i){return AN(this,n,i)},toJSONSchema(n){return I2(this,{})(n)},get description(){return wu.get(this)?.description},get _def(){return this._zod.def}}),W1=Y("_ZodString",(n,i)=>{Pp.init(n,i),Dt.init(n,i),n._zod.processJSONSchema=(a,l,u)=>Y2(n,a,l)},b1({format:n=>Wi(n).format??null,minLength:n=>Wi(n).minimum??null,maxLength:n=>Wi(n).maximum??null},{regex(...n){return this.check(N2(...n))},includes(...n){return this.check(j2(...n))},startsWith(...n){return this.check(k2(...n))},endsWith(...n){return this.check(R2(...n))},min(...n){return this.check($f(...n))},max(...n){return this.check(L1(...n))},length(...n){return this.check(H1(...n))},nonempty(...n){return this.check($f(1,...n))},lowercase(n){return this.check(A2(n))},uppercase(n){return this.check(M2(n))},trim(){return this.check(D2())},normalize(...n){return this.check(C2(...n))},toLowerCase(){return this.check(U2())},toUpperCase(){return this.check(Z2())},slugify(){return this.check($2())}})),jN=Y("ZodString",(n,i)=>{Pp.init(n,i),W1.init(n,i)},{email(n){return this.check(JO(UN,n))},url(n){return this.check(i2($N,n))},jwt(n){return this.check(y2(WN,n))},emoji(n){return this.check(r2(LN,n))},guid(n){return this.check(XO(ZN,n))},uuid(n){return this.check(WO(yf,n))},uuidv4(n){return this.check(e2(yf,n))},uuidv6(n){return this.check(t2(yf,n))},uuidv7(n){return this.check(n2(yf,n))},nanoid(n){return this.check(s2(HN,n))},cuid(n){return this.check(a2(BN,n))},cuid2(n){return this.check(l2(qN,n))},ulid(n){return this.check(o2(VN,n))},base64(n){return this.check(p2(QN,n))},base64url(n){return this.check(g2(JN,n))},xid(n){return this.check(u2(IN,n))},ksuid(n){return this.check(c2(PN,n))},ipv4(n){return this.check(f2(KN,n))},ipv6(n){return this.check(d2(GN,n))},cidrv4(n){return this.check(h2(YN,n))},cidrv6(n){return this.check(m2(FN,n))},e164(n){return this.check(v2(XN,n))},datetime(n){return this.check(b2(kN,n))},date(n){return this.check(_2(RN,n))},time(n){return this.check(S2(CN,n))},duration(n){return this.check(x2(DN,n))}});function Pn(n){return QO(jN,n)}const Ht=Y("ZodStringFormat",(n,i)=>{Ct.init(n,i),W1.init(n,i)}),kN=Y("ZodISODateTime",(n,i)=>{XE.init(n,i),Ht.init(n,i)}),RN=Y("ZodISODate",(n,i)=>{WE.init(n,i),Ht.init(n,i)}),CN=Y("ZodISOTime",(n,i)=>{eO.init(n,i),Ht.init(n,i)}),DN=Y("ZodISODuration",(n,i)=>{tO.init(n,i),Ht.init(n,i)}),UN=Y("ZodEmail",(n,i)=>{$E.init(n,i),Ht.init(n,i)}),ZN=Y("ZodGUID",(n,i)=>{UE.init(n,i),Ht.init(n,i)}),yf=Y("ZodUUID",(n,i)=>{ZE.init(n,i),Ht.init(n,i)}),$N=Y("ZodURL",(n,i)=>{IE.init(n,i),Ht.init(n,i)}),LN=Y("ZodEmoji",(n,i)=>{PE.init(n,i),Ht.init(n,i)}),HN=Y("ZodNanoID",(n,i)=>{KE.init(n,i),Ht.init(n,i)}),BN=Y("ZodCUID",(n,i)=>{GE.init(n,i),Ht.init(n,i)}),qN=Y("ZodCUID2",(n,i)=>{YE.init(n,i),Ht.init(n,i)}),VN=Y("ZodULID",(n,i)=>{FE.init(n,i),Ht.init(n,i)}),IN=Y("ZodXID",(n,i)=>{QE.init(n,i),Ht.init(n,i)}),PN=Y("ZodKSUID",(n,i)=>{JE.init(n,i),Ht.init(n,i)}),KN=Y("ZodIPv4",(n,i)=>{nO.init(n,i),Ht.init(n,i)}),GN=Y("ZodIPv6",(n,i)=>{rO.init(n,i),Ht.init(n,i)}),YN=Y("ZodCIDRv4",(n,i)=>{sO.init(n,i),Ht.init(n,i)}),FN=Y("ZodCIDRv6",(n,i)=>{lO.init(n,i),Ht.init(n,i)}),QN=Y("ZodBase64",(n,i)=>{oO.init(n,i),Ht.init(n,i)}),JN=Y("ZodBase64URL",(n,i)=>{cO.init(n,i),Ht.init(n,i)}),XN=Y("ZodE164",(n,i)=>{fO.init(n,i),Ht.init(n,i)}),WN=Y("ZodJWT",(n,i)=>{hO.init(n,i),Ht.init(n,i)}),eS=Y("ZodNumber",(n,i)=>{k1.init(n,i),Dt.init(n,i),n._zod.processJSONSchema=(a,l,u)=>F2(n,a,l,u),n.isFinite=!0},b1({minValue:n=>{const{minimum:i,exclusiveMinimum:a}=Wi(n);return Math.max(i??Number.NEGATIVE_INFINITY,a??Number.NEGATIVE_INFINITY)},maxValue:n=>{const{maximum:i,exclusiveMaximum:a}=Wi(n);return Math.min(i??Number.POSITIVE_INFINITY,a??Number.POSITIVE_INFINITY)},isInt:n=>{const{isInt:i,multipleOf:a}=Wi(n);return!!i||!!a?.some(Number.isSafeInteger)},format:n=>Wi(n).format??null},{gt(n,i){return this.check(kb(n,i))},gte(n,i){return this.check(Hm(n,i))},min(n,i){return this.check(Hm(n,i))},lt(n,i){return this.check(jb(n,i))},lte(n,i){return this.check(Lm(n,i))},max(n,i){return this.check(Lm(n,i))},int(n){return this.check(qb(n))},safe(n){return this.check(qb(n))},positive(n){return this.check(kb(0,n))},nonnegative(n){return this.check(Hm(0,n))},negative(n){return this.check(jb(0,n))},nonpositive(n){return this.check(Lm(0,n))},multipleOf(n,i){return this.check(Rb(n,i))},step(n,i){return this.check(Rb(n,i))},finite(){return this}}));function hn(n){return w2(eS,n)}const eA=Y("ZodNumberFormat",(n,i)=>{mO.init(n,i),eS.init(n,i)});function qb(n){return z2(eA,n)}const tA=Y("ZodBoolean",(n,i)=>{pO.init(n,i),Dt.init(n,i),n._zod.processJSONSchema=(a,l,u)=>Q2(n,a,l)});function Dn(n){return T2(tA,n)}const nA=Y("ZodUnknown",(n,i)=>{gO.init(n,i),Dt.init(n,i),n._zod.processJSONSchema=(a,l,u)=>X2()});function Vb(){return E2(nA)}const iA=Y("ZodNever",(n,i)=>{vO.init(n,i),Dt.init(n,i),n._zod.processJSONSchema=(a,l,u)=>J2(n,a,l)});function rA(n){return O2(iA,n)}const sA=Y("ZodArray",(n,i)=>{Hu(),_O.init(n,i),Dt.init(n,i),n._zod.processJSONSchema=(a,l,u)=>iN(n,a,l,u),n.element=i.element},{min(n,i){return this.check($f(n,i))},nonempty(n){return this.check($f(1,n))},max(n,i){return this.check(L1(n,i))},length(n,i){return this.check(H1(n,i))},unwrap(){return this.element}});function Wf(n,i){return L2(sA,n,i)}const aA=Y("ZodObject",(n,i)=>{Hu(),wO.init(n,i),Dt.init(n,i),n._zod.processJSONSchema=(a,l,u)=>rN(n,a,l,u),ST(n,"shape",a=>a._zod.def.shape,!1)},{keyof(){return Du(Object.keys(this._zod.def.shape))},catchall(n){return this.clone(Di(this._zod.def,{catchall:n}))},passthrough(){return this.clone(Di(this._zod.def,{catchall:Vb()}))},loose(){return this.clone(Di(this._zod.def,{catchall:Vb()}))},strict(){return this.clone(Di(this._zod.def,{catchall:rA()}))},strip(){return this.clone(Di(this._zod.def,{catchall:void 0}))},extend(n){return cT(this,n)},safeExtend(n){return fT(this,n)},merge(n){return dT(this,n)},pick(n){return oT(this,n)},omit(n){return uT(this,n)},partial(...n){return cb(Yp,this,n[0])},exactPartial(...n){return cb(tS,this,n[0],"exactPartial")},required(...n){return hT(nS,this,n[0])}});function In(n,i){const a={type:"object",shape:n??{},...Te(i)};return new aA(a)}const lA=Y("ZodUnion",(n,i)=>{zO.init(n,i),Dt.init(n,i),n._zod.processJSONSchema=(a,l,u)=>sN(n,a,l,u),n.options=i.options});function ed(n,i){return new lA({type:"union",options:n,...Te(i)})}const oA=Y("ZodIntersection",(n,i)=>{TO.init(n,i),Dt.init(n,i),n._zod.processJSONSchema=(a,l,u)=>aN(n,a,l,u)});function uA(n,i){return new oA({type:"intersection",left:n,right:i})}const cA=Y("ZodTuple",(n,i)=>{Hu(),EO.init(n,i),Dt.init(n,i),n._zod.processJSONSchema=(a,l,u)=>lN(n,a,l,u)},{rest(n){return this.clone({...this._zod.def,rest:n})},partial(){const n=this._zod.def;if(n.checks?.length)throw new Error(".partial() cannot be used on tuple schemas containing refinements");return this.clone({...n,items:n.items.map(i=>new Yp({type:"optional",innerType:i}))})}});function fA(n,i,a){const l=i instanceof Ot,u=l?a:i,f=l?i:null;return new cA({type:"tuple",items:n,rest:f,...Te(u)})}const Ib=Y("ZodRecord",(n,i)=>{Hu(),OO.init(n,i),Dt.init(n,i),n._zod.processJSONSchema=(a,l,u)=>uN(n,a,l,u),n.keyType=i.keyType,n.valueType=i.valueType});function dA(n,i,a){return!i||!i._zod?new Ib({type:"record",keyType:Pn(),valueType:n,...Te(i)}):new Ib({type:"record",keyType:n,valueType:i,...Te(a)})}const lp=Y("ZodEnum",(n,i)=>{NO.init(n,i),Dt.init(n,i),n._zod.processJSONSchema=(l,u,f)=>W2(n,l,u),n.enum=i.entries,n.options=[...n._zod.values];const a=new Set(Object.keys(i.entries));n.extract=(l,u)=>{const f={};for(const d of l)if(a.has(d))f[d]=i.entries[d];else throw new Error(`Key ${d} not found in enum`);return new lp({...i,checks:[],...Te(u),entrie)DELIM" +R"DELIM(s:f})},n.exclude=(l,u)=>{const f={...i.entries};for(const d of l)if(a.has(d))delete f[d];else throw new Error(`Key ${d} not found in enum`);return new lp({...i,checks:[],...Te(u),entries:f})}});function Du(n,i){const a=Array.isArray(n)?Object.fromEntries(n.map(l=>[l,l])):n;return new lp({type:"enum",entries:a,...Te(i)})}const hA=Y("ZodLiteral",(n,i)=>{AO.init(n,i),Dt.init(n,i),n._zod.processJSONSchema=(a,l,u)=>eN(n,a,l,u),n.values=new Set(i.values),Object.defineProperty(n,"value",{get(){if(i.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return i.values[0]}})});function Au(n,i){return new hA({type:"literal",values:Array.isArray(n)?n:[n],...Te(i)})}const mA=Y("ZodTransform",(n,i)=>{Hu(),MO.init(n,i),Dt.init(n,i),n._zod.processJSONSchema=(a,l,u)=>nN(n,a,l,u),n._zod.parse=(a,l)=>{if(l.direction==="backward")throw new _1(n.constructor.name);a.addIssue=f=>{if(typeof f=="string")a.issues.push(Ru(f,a.value,i));else{const d=f;d.fatal&&(d.continue=!1),d.code??(d.code="custom"),"input"in d||(d.input=a.value),d.inst??(d.inst=n),a.issues.push(Ru(d))}};const u=i.transform(a.value,a);return u instanceof Promise?u.then(f=>(a.value=f,a)):(a.value=u,a)}});function pA(n){return new mA({type:"transform",transform:n})}const Yp=Y("ZodOptional",(n,i)=>{D1.init(n,i),Dt.init(n,i),n._zod.processJSONSchema=(a,l,u)=>X1(n,a,l,u),n.unwrap=()=>n._zod.def.innerType});function Pb(n){return new Yp({type:"optional",innerType:n})}const tS=Y("ZodExactOptional",(n,i)=>{jO.init(n,i),Dt.init(n,i),n._zod.processJSONSchema=(a,l,u)=>X1(n,a,l,u),n.unwrap=()=>n._zod.def.innerType});function gA(n){return new tS({type:"optional",innerType:n})}const vA=Y("ZodNullable",(n,i)=>{kO.init(n,i),Dt.init(n,i),n._zod.processJSONSchema=(a,l,u)=>cN(n,a,l,u),n.unwrap=()=>n._zod.def.innerType});function Kb(n){return new vA({type:"nullable",innerType:n})}const yA=Y("ZodDefault",(n,i)=>{RO.init(n,i),Dt.init(n,i),n._zod.processJSONSchema=(a,l,u)=>dN(n,a,l,u),n.unwrap=()=>n._zod.def.innerType,n.removeDefault=n.unwrap});function bA(n,i){return new yA({type:"default",innerType:n,get defaultValue(){return typeof i=="function"?i():m1(i)}})}const _A=Y("ZodPrefault",(n,i)=>{CO.init(n,i),Dt.init(n,i),n._zod.processJSONSchema=(a,l,u)=>hN(n,a,l,u),n.unwrap=()=>n._zod.def.innerType});function SA(n,i){return new _A({type:"prefault",innerType:n,get defaultValue(){return typeof i=="function"?i():m1(i)}})}const nS=Y("ZodNonOptional",(n,i)=>{DO.init(n,i),Dt.init(n,i),n._zod.processJSONSchema=(a,l,u)=>fN(n,a,l,u),n.unwrap=()=>n._zod.def.innerType});function xA(n,i){return new nS({type:"nonoptional",innerType:n,...Te(i)})}const wA=Y("ZodCatch",(n,i)=>{UO.init(n,i),Dt.init(n,i),n._zod.processJSONSchema=(a,l,u)=>mN(n,a,l,u),n.unwrap=()=>n._zod.def.innerType,n.removeCatch=n.unwrap});function zA(n,i){return new wA({type:"catch",innerType:n,catchValue:typeof i=="function"?i:wT(i)})}const TA=Y("ZodPipe",(n,i)=>{ZO.init(n,i),Dt.init(n,i),n._zod.processJSONSchema=(a,l,u)=>pN(n,a,l,u),n.in=i.in,n.out=i.out});function Gb(n,i){return new TA({type:"pipe",in:n,out:i})}const EA=Y("ZodReadonly",(n,i)=>{$O.init(n,i),Dt.init(n,i),n._zod.processJSONSchema=(a,l,u)=>gN(n,a,l,u),n.unwrap=()=>n._zod.def.innerType});function OA(n){return new EA({type:"readonly",innerType:n})}const NA=Y("ZodCustom",(n,i)=>{LO.init(n,i),Dt.init(n,i),n._zod.processJSONSchema=(a,l,u)=>tN(n,a,l,u)});function AA(n,i={}){return H2(NA,n,i)}function MA(n,i){return B2(n,i)}const Bu=[{id:0,name:"application",label:"Application"},{id:1,name:"news",label:"News"},{id:2,name:"session",label:"Session"},{id:3,name:"protocol",label:"Protocol"},{id:4,name:"proxy",label:"Proxy"},{id:5,name:"remote",label:"Remote"},{id:6,name:"fault",label:"Fault"},{id:7,name:"quitting",label:"Quitting"},{id:8,name:"objects",label:"Objects"},{id:9,name:"verbose",label:"Verbose"}],Hf=[{id:0,name:"header_archived",label:"Header archived",category:"headers",valueKind:"height"},{id:1,name:"header_organized",label:"Header organized",category:"headers",valueKind:"height"},{id:2,name:"header_reorganized",label:"Header reorganized",category:"headers",valueKind:"height"},{id:3,name:"block_archived",label:"Block archived",category:"blocks",valueKind:"height"},{id:4,name:"block_buffered",label:"Block buffered",category:"blocks",valueKind:"height"},{id:5,name:"block_validated",label:"Block validated",category:"blocks",valueKind:"height"},{id:6,name:"block_confirmed",label:"Block confirmed",category:"blocks",valueKind:"height"},{id:7,name:"block_unconfirmable",label:"Block unconfirmable",category:"blocks",valueKind:"height"},{id:8,name:"validate_bypassed",label:"Validation bypassed",category:"blocks",valueKind:"height"},{id:9,name:"confirm_bypassed",label:"Confirmation bypassed",category:"blocks",valueKind:"height"},{id:10,name:"tx_archived",label:"Transaction archived",category:"transactions",valueKind:"fee-rate"},{id:11,name:"tx_validated",label:"Transaction validated",category:"transactions",valueKind:"count"},{id:12,name:"tx_invalidated",label:"Transaction invalidated",category:"transactions",valueKind:"count"},{id:13,name:"block_organized",label:"Block organized",category:"chain",valueKind:"height"},{id:14,name:"block_reorganized",label:"Block reorganized",category:"chain",valueKind:"height"},{id:15,name:"template_issued",label:"Mining template issued",category:"mining",valueKind:"count"},{id:16,name:"snapshot_secs",label:"Snapshot",category:"timing",valueKind:"seconds"},{id:17,name:"prune_msecs",label:"Prune",category:"timing",valueKind:"milliseconds"},{id:18,name:"reload_msecs",label:"Store reload",category:"timing",valueKind:"milliseconds"},{id:19,name:"block_usecs",label:"Serve block",category:"timing",valueKind:"microseconds"},{id:20,name:"ancestry_msecs",label:"Serve ancestry",category:"timing",valueKind:"milliseconds"},{id:21,name:"filter_msecs",label:"Serve filter",category:"timing",valueKind:"milliseconds"},{id:22,name:"filterhashes_msecs",label:"Serve filter hashes",category:"timing",valueKind:"milliseconds"},{id:23,name:"filterchecks_msecs",label:"Serve filter checkpoints",category:"timing",valueKind:"milliseconds"},{id:24,name:"ecdsa_secs",label:"ECDSA batch verification",category:"timing",valueKind:"seconds"},{id:25,name:"schnorr_secs",label:"Schnorr batch verification",category:"timing",valueKind:"seconds"},{id:26,name:"silent_secs",label:"Silent payment scan",category:"timing",valueKind:"seconds"},{id:27,name:"validate_usecs",label:"Block validation",category:"timing",valueKind:"microseconds"},{id:28,name:"unknown",label:"Unknown",category:"chain",valueKind:"unknown"}],iS=hn().int().nonnegative().max(864e13),jA=In({level:hn().int().nonnegative(),time:iS,message:Pn()}),kA=In({event:hn().int().nonnegative(),value:hn().nonnegative(),time:iS}),RA=In({previous:hn().nonnegative()});ed([jA,kA,RA]);const Fp=2**Bu.length-1,to=Fp,CA=2**0+2**1+2**2+2**6+2**7;function DA(n,i){return Number.isInteger(i)&&i>=0&&i0?`${String(a)}d ${String(l)}h`:l>0?`${String(l)}h ${String(u)}m`:u>0?`${String(u)}m ${String(f)}s`:`${String(f)}s`}function sS(n,i){switch(mo(n).valueKind){case"height":return`height ${pn(i)}`;case"seconds":return`${Fa(i)} s`;case"milliseconds":return`${Fa(i)} ms`;case"microseconds":return`${Fa(i)} µs`;case"count":return pn(i);case"fee-rate":return`${Fa(i/1e3,3)} sat/vB`;default:return String(i)}}function qA(n){return n>=100?`${Fa(n,0)}/s`:n>=10?`${Fa(n,1)}/s`:`${Fa(n,2)}/s`}const Bf=32,VA=[{value:"all",label:"All categories"},{value:"headers",label:"Headers"},{value:"blocks",label:"Blocks"},{value:"transactions",label:"Transactions"},{value:"chain",label:"Confirmed chain"},{value:"mining",label:"Mining"},{value:"timing",label:"Timing"}],IA={headers:"bg-violet-500/15 text-violet-300",blocks:"bg-accent/15 text-accent",transactions:"bg-sky-500/15 text-sky-300",chain:"bg-emerald-500/15 text-emerald-300",mining:"bg-amber-500/15 text-amber-300",timing:"bg-cyan-500/15 text-cyan-300"};function PA({metrics:n,paused:i,onPausedChange:a,onClear:l}){const[u,f]=se.useState(""),[d,m]=se.useState("all"),[p,g]=se.useState({offset:0,search:u,category:d}),b=p.search===u&&p.category===d?p.offset:0,y=se.useRef(null),w=se.useSyncExternalStore(n.subscribeEvents,n.getEventWindow,n.getEventWindow);return se.useEffect(()=>{n.setEventQuery({search:u,category:d,offset:b})},[n,u,d,b]),se.useEffect(()=>{y.current&&(y.current.scrollTop=0)},[u,d]),x.jsxs("section",{className:"space-y-4",children:[x.jsxs("header",{className:"flex flex-wrap items-end justify-between gap-4",children:[x.jsxs("div",{children:[x.jsx("p",{className:"text-accentSecondary text-xs tracking-wide uppercase",children:"Node lifecycle"}),x.jsx("h2",{className:"text-accent mt-1 text-2xl font-semibold",children:"Live events"}),x.jsx("p",{className:"text-textMuted mt-1 text-sm",children:"Heights are event payloads; timing values retain their source units."}),x.jsx("p",{className:"text-textMuted mt-1 text-xs",children:"Pause freezes this view; collection and charts continue."})]}),x.jsxs("div",{className:"flex gap-2",children:[x.jsx("button",{type:"button",onClick:()=>{i&&(y.current&&(y.current.scrollTop=0),g({offset:0,search:u,category:d})),a(!i)},className:"border-accent/40 text-accent hover:border-accent hover:text-accentSecondary rounded-md border px-3 py-2 text-sm font-medium",children:i?"Resume display":"Pause display"}),x.jsx("button",{type:"button",onClick:l,className:"border-accent/40 text-accent hover:border-accent hover:text-accentSecondary rounded-md border px-3 py-2 text-sm font-medium",children:"Clear"})]})]}),x.jsxs("div",{className:"border-accent/30 bg-surface/80 flex flex-wrap gap-3 rounded-2xl border p-4",children:[x.jsxs("label",{className:"min-w-56 flex-1",children:[x.jsx("span",{className:"sr-only",children:"Search events"}),x.jsx("input",{type:"search",value:u,onChange:O=>{f(O.target.value)},placeholder:"Search event names or values…",className:"border-accent/40 bg-background text-textPrimary placeholder:text-textMuted/60 focus:border-accent w-full rounded-md border px-3 py-2 text-sm focus:ring-0"})]}),x.jsxs("label",{children:[x.jsx("span",{className:"sr-only",children:"Filter event category"}),x.jsx("select",{value:d,onChange:O=>{m(O.target.value)},className:"border-accent/40 bg-background text-textPrimary focus:border-accent rounded-md border px-3 py-2 text-sm focus:ring-0",children:VA.map(O=>x.jsx("option",{value:O.value,children:O.label},O.value))})]})]}),x.jsxs("div",{className:"border-accent/30 bg-surface/80 overflow-hidden rounded-xl border",children:[x.jsxs("div",{className:"border-accentSecondary/30 bg-accentSecondary/20 text-textMuted flex justify-between border-b px-4 py-3 text-xs",children:[x.jsx("span",{children:i?"Display paused · collection continues":b>0?"Viewing older rows · collection continues":"Live stream · newest first"}),x.jsxs("span",{children:[String(w.matched)," matching · ",String(w.retained)," retained"]})]}),x.jsx("div",{ref:y,role:"region","aria-label":"Scrollable event history",tabIndex:0,className:"h-[min(60vh,32rem)] min-h-32 overflow-auto",style:{overflowAnchor:"none"},onScroll:O=>{g({offset:Math.max(0,Math.floor(O.currentTarget.scrollTop/Bf)-8),search:u,category:d})},children:w.matched===0?x.jsx("p",{className:"text-textMuted px-4 py-12 text-center text-sm",children:"No matching events."}):x.jsx("ol",{"aria-label":"Received events",className:"relative min-w-[32rem]",style:{height:w.matched*Bf},children:w.events.map((O,T)=>x.jsx(KA,{event:O,index:w.offset+T,total:w.matched},O.id))})})]}),!i&&x.jsx("div",{className:"flex justify-end text-xs",children:x.jsx("button",{type:"button",className:"text-accent hover:underline",onClick:()=>{y.current&&(y.current.scrollTop=0),g({offset:0,search:u,category:d})},children:"Jump to latest"})}),x.jsxs("details",{className:"border-accent/30 bg-surface/80 rounded-2xl border",children:[x.jsxs("summary",{className:"text-textMuted hover:text-accent cursor-pointer px-4 py-3 text-sm",children:["Event contract (",String(Hf.length)," identifiers)"]}),x.jsx("div",{className:"border-accentSecondary/20 grid gap-2 border-t p-4 sm:grid-cols-2 lg:grid-cols-3",children:Hf.map(O=>x.jsxs("div",{className:"text-xs",children:[x.jsx("span",{className:"text-textMuted font-mono",children:String(O.id).padStart(2,"0")}),x.jsx("span",{className:"text-textPrimary ml-2",children:O.name})]},O.id))})]})]})}const KA=se.memo(function({event:i,index:a,total:l}){const u=mo(i.event);return x.jsxs("li",{"aria-setsize":l,"aria-posinset":a+1,className:"border-accentSecondary/20 absolute inset-x-0 grid grid-cols-[8.5rem_10rem_minmax(0,1fr)] items-center gap-2 border-b px-4 text-xs",style:{top:a*Bf,height:Bf},children:[x.jsx("time",{dateTime:Qp(i.time),className:"text-textMuted font-mono tabular-nums",children:Uu(i.time)}),x.jsx("span",{className:`w-fit rounded px-2 py-0.5 font-medium ${IA[u.category]}`,children:u.name}),x.jsx("span",{className:"text-textPrimary font-mono tabular-nums",children:sS(i.event,i.value)})]})}),qf=32,Yb={0:"bg-sky-500/15 text-sky-300",1:"bg-emerald-500/15 text-emerald-300",2:"bg-violet-500/15 text-violet-300",3:"bg-cyan-500/15 text-cyan-300",4:"bg-indigo-500/15 text-indigo-300",5:"bg-blue-500/15 text-blue-300",6:"bg-red-500/20 text-red-300",7:"bg-orange-500/20 text-orange-300",8:"bg-slate-500/20 text-slate-300",9:"bg-zinc-500/20 text-zinc-300"};function GA({metrics:n,delivery:i,status:a,logFilter:l,paused:u,onLogFilterChange:f,onPausedChange:d,onClear:m}){const[p,g]=se.useState(""),[b,y]=se.useState({offset:0,search:p,filter:l}),w=b.search===p&&b.filter===l?b.offset:0,[O,T]=se.useState(null),A=se.useRef(null),k=se.useSyncExternalStore(n.subscribeLogs,n.getLogWindow,n.getLogWindow);return se.useEffect(()=>{n.setLogQuery({search:p,filter:l,offset:w})},[n,p,l,w]),se.useEffect(()=>{A.current&&(A.current.scrollTop=0)},[p,l]),x.jsxs("section",{className:"space-y-4",children:[x.jsxs("header",{className:"flex flex-wrap items-end justify-between gap-4",children:[x.jsxs("div",{children:[x.jsx("p",{className:"text-accentSecondary text-xs tracking-wide uppercase",children:"Diagnostic stream"}),x.jsx("h2",{className:"text-accent mt-1 text-2xl font-semibold",children:"Node logs"}),x.jsx("p",{className:"text-textMuted mt-1 text-sm",children:"The newest 1,000 messages are retained in this browser session."})]}),x.jsxs("div",{className:"flex gap-2",children:[x.jsx("button",{type:"button",onClick:()=>{u&&(A.current&&(A.current.scrollTop=0),y({offset:0,search:p,filter:l})),d(!u)},className:"border-accent/40 text-accent hover:border-accent hover:text-accentSecondary rounded-md border px-3 py-2 text-sm font-medium",children:u?"Resume display":"Pause display"}),x.jsx("button",{type:"button",onClick:m,className:"border-accent/40 text-accent hover:border-accent hover:text-accentSecondary r)DELIM" +R"DELIM(ounded-md border px-3 py-2 text-sm font-medium",children:"Clear"})]})]}),x.jsxs("fieldset",{className:"border-accent/30 bg-surface/80 space-y-3 rounded-2xl border p-4",children:[x.jsx("legend",{className:"text-textPrimary px-1 text-sm font-medium",children:"Requested log levels"}),x.jsx("p",{className:"text-textMuted text-xs",children:"Only checked levels are sent by the server. Pause freezes this view; collection and charts continue. Skipped log levels are not replayed."}),x.jsx("div",{className:"flex flex-wrap gap-x-5 gap-y-3",children:Bu.map(L=>x.jsxs("label",{className:"text-textPrimary flex items-center gap-2 text-sm",children:[x.jsx("input",{type:"checkbox",checked:DA(l,L.id),onChange:()=>{f(l^1<{f(CA)},className:"text-accent hover:underline",children:"Operational levels"}),x.jsx("button",{type:"button",onClick:()=>{f(Fp)},className:"text-accent hover:underline",children:"All levels"}),x.jsx("button",{type:"button",onClick:()=>{f(0)},className:"text-accent hover:underline",children:"No levels"}),x.jsx("span",{className:"text-textMuted",children:"Selection is saved in this browser."})]})]}),x.jsxs("div",{className:"border-accent/30 bg-surface/80 space-y-2 rounded-2xl border p-4 text-xs",children:[x.jsx("dl",{"aria-label":"Log delivery statistics",className:"flex flex-wrap gap-x-6 gap-y-2",children:[["Received logs",i.totalLogs],["Rolled out of history",i.evictedLogs],["Cleared from history",i.clearedLogs],["Invalid admin frames",i.invalidFrames],["Reconnects",a.reconnects]].map(([L,D])=>x.jsxs("div",{children:[x.jsx("dt",{className:"text-textMuted",children:L}),x.jsx("dd",{className:"text-textPrimary mt-1 font-mono tabular-nums",children:D.toLocaleString()})]},L))}),x.jsx("p",{className:"text-textMuted",children:"Live rows refresh every 100 ms and can skip intermediate messages on screen. Every valid log at a requested level is counted; older messages leave the 1,000-message history as new ones arrive. These counters continue while display is paused. Reconnects can leave gaps that the server does not replay."}),x.jsxs("p",{className:"text-textMuted",role:"status",children:["Admin connection: ",a.phase,a.error?` · ${a.error}`:""]})]}),x.jsxs("div",{className:"border-accent/30 bg-surface/80 flex flex-wrap gap-3 rounded-2xl border p-4",children:[x.jsxs("label",{className:"min-w-56 flex-1",children:[x.jsx("span",{className:"sr-only",children:"Search logs"}),x.jsx("input",{type:"search",value:p,onChange:L=>{g(L.target.value)},placeholder:"Search received messages…",className:"border-accent/40 bg-background text-textPrimary placeholder:text-textMuted/60 focus:border-accent w-full rounded-md border px-3 py-2 text-sm focus:ring-0"})]}),x.jsx("p",{className:"text-textMuted self-center text-xs",children:"Search filters received messages only."})]}),x.jsxs("div",{className:"border-accent/30 bg-surface/80 overflow-hidden rounded-xl border",children:[x.jsxs("div",{className:"border-accentSecondary/30 bg-accentSecondary/20 text-textMuted flex justify-between border-b px-4 py-3 text-xs",children:[x.jsx("span",{children:u?"Display paused · collection continues":l===0?"Log delivery disabled":w>0?"Viewing older rows · collection continues":"Live stream · newest first"}),x.jsxs("span",{children:[String(k.matched)," matching · ",String(k.retained)," retained"]})]}),x.jsx("div",{ref:A,role:"region","aria-label":"Scrollable log history",tabIndex:0,className:"h-[min(60vh,32rem)] min-h-32 overflow-auto",style:{overflowAnchor:"none"},onScroll:L=>{y({offset:Math.max(0,Math.floor(L.currentTarget.scrollTop/qf)-8),search:p,filter:l})},children:k.matched===0?x.jsx("p",{className:"text-textMuted px-4 py-12 text-center text-sm",children:"No matching log messages."}):x.jsx("ol",{"aria-label":"Received logs",className:"relative",style:{height:k.matched*qf},children:k.logs.map((L,D)=>x.jsx(YA,{log:L,index:k.offset+D,total:k.matched,onSelect:T},L.id))})})]}),x.jsxs("div",{className:"flex items-center justify-between gap-3 text-xs",children:[x.jsx("p",{className:"text-textMuted",children:"Select a row to read its full message."}),!u&&x.jsx("button",{type:"button",className:"text-accent hover:underline",onClick:()=>{A.current&&(A.current.scrollTop=0),y({offset:0,search:p,filter:l})},children:"Jump to latest"})]}),O&&x.jsx(FA,{log:O,onClose:()=>{T(null)}})]})}const YA=se.memo(function({log:i,index:a,total:l,onSelect:u}){return x.jsx("li",{"aria-setsize":l,"aria-posinset":a+1,className:"border-accentSecondary/20 absolute inset-x-0 border-b",style:{top:a*qf,height:qf},children:x.jsxs("button",{type:"button",onClick:()=>{u(i)},className:"hover:bg-accentSecondary/10 focus-visible:bg-accentSecondary/20 grid h-full w-full grid-cols-[5.5rem_4.5rem_minmax(0,1fr)] items-center gap-2 px-4 text-left text-xs sm:grid-cols-[7.5rem_7.5rem_minmax(0,1fr)]",children:[x.jsx("time",{dateTime:Qp(i.time),className:"text-textMuted font-mono tabular-nums",children:Uu(i.time,!1)}),x.jsx("span",{className:`w-fit rounded px-2 py-0.5 font-medium ${Yb[i.level]??Yb[8]}`,children:rS(i.level).name}),x.jsx("span",{className:"text-textPrimary min-w-0 truncate font-mono",children:i.message.replaceAll(` +`," ↵ ")})]})})});function FA({log:n,onClose:i}){const a=se.useRef(null);return se.useEffect(()=>{const l=a.current;return l?.showModal(),()=>{l?.close()}},[]),x.jsxs("dialog",{ref:a,onClose:i,"aria-labelledby":"log-detail-title",className:"border-accent/30 bg-surface/95 text-textPrimary fixed inset-0 m-auto max-h-[80vh] w-[min(60rem,90vw)] rounded-2xl border p-5 shadow-xl backdrop:bg-black/60",children:[x.jsxs("header",{className:"mb-4 flex items-center justify-between gap-4",children:[x.jsxs("h3",{id:"log-detail-title",className:"text-accent text-lg font-semibold",children:[rS(n.level).label," · ",Qp(n.time)??"Invalid time"]}),x.jsx("button",{type:"button",onClick:i,className:"text-accent rounded px-3 py-2",children:"Close"})]}),x.jsx("pre",{className:"text-sm break-words whitespace-pre-wrap",children:n.message})]})}const QA="Unknown",JA={bitcoin:{p2kh:{0:"mainnet (1)",111:"test networks (m, n)"},p2sh:{5:"mainnet (3)",196:"test networks (2)"},wif:{128:"mainnet (5, K, L)",239:"test networks (9, c)"},witness:{bc:"mainnet",tb:"testnet and signet",bcrt:"regtest"},silent:{sp:"mainnet",tsp:"testnet and signet",sprt:"regtest"},hdPrivate:{76066276:"mainnet (xprv)",77428856:"mainnet BIP49 (yprv)",78791436:"mainnet BIP84 (zprv)",70615956:"test networks (tprv)",71978536:"test networks BIP49 (uprv)",73341116:"test networks BIP84 (vprv)"},hdPublic:{76067358:"mainnet (xpub)",77429938:"mainnet BIP49 (ypub)",78792518:"mainnet BIP84 (zpub)",70617039:"test networks (tpub)",71979618:"test networks BIP49 (upub)",73342198:"test networks BIP84 (vpub)"}},litecoin:{p2kh:{48:"mainnet (L)",111:"test networks (m, n)"},p2sh:{5:"mainnet deprecated (3)",50:"mainnet (M)",58:"test networks (Q)",196:"test networks deprecated (2)"},wif:{176:"mainnet (6, T)",239:"test networks (9, c)"},witness:{ltc:"mainnet",tltc:"testnet",rltc:"regtest"},silent:{},hdPrivate:{76066276:"mainnet (xprv)",27106558:"mainnet (Ltpv)",28469138:"mainnet BIP49 (Mtpv)",70615956:"test networks (tprv)",70709117:"test networks (ttpv)"},hdPublic:{76067358:"mainnet (xpub)",27108450:"mainnet (Ltub)",28471030:"mainnet BIP49 (Mtub)",70617039:"test networks (tpub)",70711009:"test networks (ttub)"}}};function aS(n){return n.includes("ltc_scrypt_proof_of_work")?"litecoin":"bitcoin"}function Ia(n,i,a){return JA[n][i][String(a)]??QA}function op(){return globalThis.window?.location.origin??"http://localhost"}function Vf(n){const i=n.trim();if(!i)throw new Error("Endpoint URL is required");const a=/^[a-z][a-z\d+\-.]*:\/\//iu.test(i)?i:`http://${i}`,l=new URL(a);if(l.protocol!=="http:"&&l.protocol!=="https:")throw new Error("Endpoint must use HTTP or HTTPS"))DELIM" +R"DELIM(;return l.pathname=l.pathname.replace(/\/+$/u,"")||"/",l.search="",l.hash="",l.toString().replace(/\/$/u,"")}function XA(n){const i=new URL(Vf(n));return i.protocol=i.protocol==="https:"?"wss:":"ws:",i.pathname="/",i.search="",i.hash="",i.toString()}function WA(n,i=op()){return new URL(Vf(n)).origin===new URL(i).origin}function e3(){try{globalThis.localStorage.removeItem("libbitcoinAdminDashboardEndpoints")}catch{}return{adminUrl:Vf(op()),nativeUrl:Vf(op())}}const t3=In({store:In({address:Dn(),filter:Dn(),silent:hn().int().nonnegative().nullable(),turbo:Dn(),pruned:hn().int().nonnegative()}),node:In({network:Pn(),limited:Dn().optional(),blocks:Dn().optional(),witness:Dn().optional(),filters:Dn().optional(),privacy:Dn().optional()}),wallet:In({p2kh:hn().int(),p2sh:hn().int(),wif:hn().int(),witness:Pn(),silent:Pn(),hd_private:hn().int(),hd_public:hn().int()}).optional(),network:In({relay:Dn(),alert:Dn(),reject:Dn(),compact:Dn(),address:Dn(),witness_tx:Dn(),memory_pool:Dn(),not_found:Dn(),protocol_maximum:hn().int(),protocol_minimum:hn().int()}).optional(),forks:dA(Pn(),Dn()).transform(n=>Object.keys(n).filter(i=>n[i]))}),lS=Pn().regex(/^[0-9a-f]{64}$/u),n3=In({hash:lS,height:hn().int().nonnegative(),timestamp:hn().int().positive().max(4294967295)}),Fb=In({hash:lS,height:hn().int().nonnegative()}),i3=In({confirmed:Fb,candidate:Fb}),bf=hn().int().nonnegative().max(Number.MAX_SAFE_INTEGER),r3=In({count:bf,virtual:bf,fee:bf,histogram:Wf(fA([hn().nonnegative(),bf]))}),s3="/v1/fees?format=json",a3=5e3,Zu=15e3;function Af(n,i){return new URL(i,`${n.replace(/\/+$/u,"")}/`).toString()}async function Mf(n,i){const a=await fetch(n,{headers:{Accept:"application/json"},signal:i});if(!a.ok)throw new Error(`Native API request failed with status ${String(a.status)}`);return await a.json()}async function l3(n,i){const[a,l]=await Promise.all([Mf(Af(n,"/v1/configuration?format=json"),i),Mf(Af(n,"/v1/top?format=json"),i)]),u=t3.parse(a),f=i3.parse(l),d=Date.now();let m=null;if(f.candidate.height>f.confirmed.height)try{const p=o3(f.confirmed.height),g=n3.parse(await Mf(Af(n,p),i));g.height===f.confirmed.height&&(m=g)}catch{i?.throwIfAborted()}return{configuration:u,tops:f,branch:m,receivedAt:d}}function o3(n){return`/v1/block/height/${String(n)}/header?format=json&candidate=true`}async function u3(n,i){return{data:r3.parse(await Mf(Af(n,s3),i)),receivedAt:Date.now()}}const Bm=["line","area","bar"],Qb=["line","step","area"],c3=["line","step","area"],oS={"occurrence-count":{id:"occurrence-count",label:"Occurrences per bucket",description:"Number of frames observed in each one-second bucket.",unit:"occurrences",chartTypes:Bm},"occurrence-rate":{id:"occurrence-rate",label:"Occurrence rate",description:"Frames observed per second.",unit:"occurrences-per-second",chartTypes:Bm},"cumulative-occurrences":{id:"cumulative-occurrences",label:"Cumulative occurrences",description:"Running number of frames observed during this browser session.",unit:"occurrences",chartTypes:Qb},"payload-latest":{id:"payload-latest",label:"Latest value",description:"Most recently observed payload value.",unit:"count",chartTypes:c3},"payload-average":{id:"payload-average",label:"Average value",description:"Average payload value within each one-second bucket.",unit:"count",chartTypes:["line","area","bar"]},"payload-minimum":{id:"payload-minimum",label:"Minimum value",description:"Minimum payload value within each one-second bucket.",unit:"count",chartTypes:["line","step"]},"payload-maximum":{id:"payload-maximum",label:"Maximum value",description:"Maximum payload value within each one-second bucket.",unit:"count",chartTypes:["line","step"]},"payload-sum":{id:"payload-sum",label:"Value per bucket",description:"Sum of count payloads within each one-second bucket.",unit:"count",chartTypes:["line","area","bar"]},"payload-cumulative":{id:"payload-cumulative",label:"Cumulative value",description:"Running sum of count payloads during this browser session.",unit:"count",chartTypes:Qb},"payload-change-rate":{id:"payload-change-rate",label:"Height change rate",description:"Change in the latest observed height per second.",unit:"height-per-second",chartTypes:Bm}},el=["occurrence-rate","occurrence-count","cumulative-occurrences"],f3=["payload-latest","payload-maximum","payload-change-rate",...el],d3=["payload-average","payload-latest","payload-minimum","payload-maximum",...el],h3=["payload-sum","payload-cumulative","payload-latest","payload-average",...el],uS=["payload-latest","payload-average","payload-minimum","payload-maximum"],cS=[{field:"count",id:"pool:count",label:"Pool transactions",payloadKind:"transactions",description:"Current confirmable transaction count in the pool."},{field:"virtual",id:"pool:vsize",label:"Pool virtual size",payloadKind:"vbytes",description:"Total virtual size of the current pool, in vbytes."},{field:"fee",id:"pool:total_fee",label:"Pool total fees",payloadKind:"satoshis",description:"Total fees of the current pool, in satoshis."}];function Ui(n){return`event:${String(n)}`}function Gs(n){return`log:${String(n)}`}const If="native:top";function m3(n){switch(n){case"height":return"height";case"seconds":case"milliseconds":case"microseconds":return"duration";case"count":return"count";case"fee-rate":return"fee-rate";default:return"unknown"}}function p3(n){switch(n){case"height":return f3;case"duration":return d3;case"count":return h3;case"fee-rate":return[...uS,...el];default:return el}}function g3(n){switch(n){case"height":return"payload-latest";case"duration":return"payload-average";case"count":return"payload-sum";default:return"occurrence-rate"}}function fS(n){const i=mo(n),a=m3(i.valueKind);return{id:Ui(n),source:"event",sourceId:n,name:i.name,label:i.label,category:i.category,payloadKind:a,allowedMeasures:p3(a),defaultMeasure:g3(a),description:n===10?"Newly archived transactions, including compact-block recovery. Occurrences measure archival, not all received transactions. Fee rate is normalized to sat/vB.":a==="unknown"?"Payload semantics are unknown; occurrence measurements are safe.":`${i.label} event with a ${a} payload.`}}const v3=[...cS.map(n=>({id:n.id,source:"pool",sourceId:n.field,name:n.field,label:n.label,category:"pool",payloadKind:n.payloadKind,allowedMeasures:uS,defaultMeasure:"payload-latest",description:n.description})),...Hf.map(n=>fS(n.id)),...Bu.map(n=>({id:Gs(n.id),source:"log",sourceId:n.id,name:n.name,label:`${n.label} logs`,category:"logs",payloadKind:"text",allowedMeasures:el,defaultMeasure:"occurrence-rate",description:`${n.label} log message volume. Message text is not interpreted as numeric data.`})),{id:If,source:"native",sourceId:"top",name:"canonical_top",label:"Current top",category:"native",payloadKind:"height",allowedMeasures:["payload-latest","payload-maximum","payload-change-rate"],defaultMeasure:"payload-latest",description:"Canonical chain height reported by the native interface."}],Jp=v3,y3=new Map(Jp.map(n=>[n.id,n]));function cs(n){const i=y3.get(n);if(i)return i;const a=/^event:(\d+)$/u.exec(n);return a?fS(Number(a[1])):{id:n,source:"event",sourceId:-1,name:n,label:n,category:"unknown",payloadKind:"unknown",allowedMeasures:el,defaultMeasure:"occurrence-rate",description:"Unknown signal; only occurrence measurements are available."}}function Fs(n,i){const a=oS[i];if(i.startsWith("occurrence")||i==="cumulative-occurrences")return a;const l=i==="payload-change-rate"?"height-per-second":n.payloadKind==="height"?"height":n.payloadKind==="duration"?"milliseconds":n.payloadKind==="fee-rate"?"sat-per-vbyte":n.payloadKind==="transactions"||n.payloadKind==="vbytes"||n.payloadKind==="satoshis"?n.payloadKind:"count";return{...a,unit:l}}function b3(n,i){return n.allowedMeasures.includes(i)}function _3(n,i){return mo(n).valueKind==="fee-rate"?i/1e3:LA(n,i)??i}const S3=3600*1e3,x3=1e3,w3=1e3,z3=1e3;class Jb{constructor(i){this.capacity=i,this.#e=Array.from({length:i})}capacity;#e;#t=0;#n=0;#i=null;get size(){return this.#n}push(i){const a=this.#n===this.capacity)DELIM" +R"DELIM(;return this.#i=null,this.#e[this.#t]=i,this.#t=(this.#t+1)%this.capacity,this.#n=Math.min(this.#n+1,this.capacity),a}clear(){this.#i=null,this.#e.fill(void 0),this.#t=0,this.#n=0}newestFirst(){if(this.#i)return this.#i;const i=[];for(let a=0;athis.#k;getRecentLogs=()=>this.#i.newestFirst();getRecentEvents=()=>this.#s.newestFirst();subscribe=i=>(this.#n.add(i),()=>{this.#n.delete(i)});start(){this.#O||(this.tick(),this.#O=setInterval(()=>{this.tick()},1e3))}stop(){this.#O&&(clearInterval(this.#O),this.#O=null),this.#d&&(clearTimeout(this.#d),this.#d=null)}ingest(i,a=this.#e()){const l=this.#N(a);this.#_+=1,UA(i)?this.#U(i,l):ZA(i)?this.#j(i,l):$A(i)&&(this.#v+=1),this.#C()}recordInvalidFrame(){this.#w+=1,this.#C()}recordNativeTop(i,a=this.#e()){const l=this.#N(a),u=this.#a[If];u?.value===i&&l-u.time<15e3||(this.#R(If,l,i),this.#D(l),this.#C())}recordNativeFees(i,a=this.#e()){if(!Number.isFinite(a)||a=Zu||this.#M!==null&&a<=this.#M.receivedAt)return;const l=this.#N(a);this.#M={data:i,receivedAt:a};for(const u of cS)this.#R(u.id,l,i[u.field]);this.#D(l),this.#C()}clearLogs(){this.#E+=this.#i.size,this.#i.clear(),this.flush()}clearEvents(){this.#s.clear(),this.flush()}reset(){this.#i.clear(),this.#s.clear(),this.#r.clear(),this.#l={},this.#f={},this.#u={},this.#o={},this.#b={},this.#a={},this.#g={},this.#c=this.#N(this.#e()),this.#_=0,this.#m=0,this.#S=0,this.#E=0,this.#x=0,this.#v=0,this.#w=0,this.#p=null,this.#A=null,this.#M=null,this.#T=0,this.#z(this.#c),this.flush()}tick(){const i=this.#N(this.#e());this.#z(i),this.#D(i),this.#C()}flush(){this.#d&&(clearTimeout(this.#d),this.#d=null),this.#k=this.#Z();for(const i of this.#n)i()}#U(i,a){this.#m+=1,this.#p=a,this.#T+=1,this.#i.push({...i,id:this.#T,receivedAt:a})&&(this.#S+=1),this.#R(Gs(i.level),a,null)}#j(i,a){this.#x+=1,this.#A=a,this.#T+=1,this.#s.push({...i,id:this.#T,receivedAt:a}),this.#R(Ui(i.event),a,_3(i.event,i.value))}#N(i){return Number.isFinite(i)?(this.#h=Math.max(this.#h,i),this.#h):this.#h}#R(i,a,l){const u=this.#z(a);u.snapshot=null;const f=u.signals.get(i)??T3();if(f.count+=1,_f(this.#o,i,1),l!==null){f.samples+=1,f.sum+=l,f.minimum=f.minimum===null?l:Math.min(f.minimum,l),f.maximum=f.maximum===null?l:Math.max(f.maximum,l),(f.firstAt===null||a=f.lastAt)&&(f.last=l,f.lastAt=a),_f(this.#b,i,l);const d=this.#a[i];(!d||a>=d.time)&&(this.#a[i]={value:l,time:a}),this.#g[i]=Math.max(this.#g[i]??l,l)}u.signals.set(i,f)}#z(i){const a=Math.floor(i/1e3)*1e3,l=this.#r.get(a);if(l)return l;const u={time:a,signals:new Map,snapshot:null};return this.#r.set(a,u),u}#D(i){const a=i-S3;for(const[l,u]of this.#r){if(l>=a)break;for(const[f,d]of u.signals)if(_f(this.#l,f,d.count),_f(this.#f,f,d.sum),d.last!==null&&d.lastAt!==null){const m=this.#u[f];(!m||d.lastAt>=m.time)&&(this.#u[f]={value:d.last,time:d.lastAt})}this.#r.delete(l)}}#C(){!this.#t||this.#d||(this.#d=setTimeout(()=>{this.#d=null,this.flush()},x3))}#Z(){const i=[...this.#r.values()].map(a=>(a.snapshot??={time:a.time,signals:Object.fromEntries([...a.signals].map(([l,u])=>[l,{...u}]))},a.snapshot));return{now:this.#N(this.#e()),sessionStartedAt:this.#c,totalFrames:this.#_,totalLogs:this.#m,evictedLogs:this.#S,clearedLogs:this.#E,totalEvents:this.#x,totalAcks:this.#v,invalidFrames:this.#w,buckets:i,priorSignalCounts:{...this.#l},priorSignalSums:{...this.#f},priorSignalLatest:Xb(this.#u),signalTotals:{...this.#o},signalSums:{...this.#b},signalLatest:Xb(this.#a),signalMaximums:{...this.#g},recentLogs:this.#i.newestFirst(),recentEvents:this.#s.newestFirst(),lastLogAt:this.#p,lastEventAt:this.#A,poolSnapshot:this.#M}}}function E3(n,i,a,l,u=n[0]?.time??a){const f=a-l*1e3,d=f<=u,m=d?Math.floor(u/1e3)*1e3:Math.ceil(f/1e3)*1e3,p=d?u:m,g=Math.floor(a/1e3)*1e3,y=n.filter(O=>O.time>=m&&O.time<=g).reduce((O,T)=>O+(T.signals[i]?.count??0),0),w=Math.max(0,(a-p)/1e3);return w>0?y/w:0}function O3(n,i){const a=d=>E3(n.buckets,Ui(d),n.now,i,n.sessionStartedAt),l=a(2)+a(14);if(l>0)return{label:"Reorganizing",rate:l};const f=[{label:"Confirming blocks",rate:a(6)},{label:"Validating blocks",rate:a(5)},{label:"Archiving blocks",rate:a(3)},{label:"Synchronizing headers",rate:Math.max(a(0),a(1))}].reduce((d,m)=>m.rate>d.rate?m:d);return f.rate>0?f:{label:"Idle",rate:0}}const td=18;function N3(n,i){if(n===null)return null;const{confirmed:a,candidate:l}=n;return{confirmed:a,candidate:l,blocksRemaining:Math.max(0,l.height-a.height),progress:l.height===0?100:Math.min(100,a.height/l.height*100),diverged:A3(a,l,i)}}function A3(n,i,a){return i.height({...a,id:i?Mu("series"):a.id}))}:{...n,id:i?Mu("chart"):n.id}}function jf(){return[Xp,mS,pS,id,gS,vS,yS].map(n=>Wp(n))}function Z3(n){const i=bS.find(a=>a.id===n);return Wp(i?.chart??Xp,!0)}function SS(){return{id:Mu("chart"),title:"Custom chart",visualization:"line",scale:"linear",range:900,series:[{id:Mu("series"),signalId:Ui(3),measure:"occurrence-rate",color:Rt[0]}]}}function $3(n){const i=" copy",a=`${n.title.slice(0,nd-i.length).trimEnd()}${i}`;return{...Wp(n,!0),title:a}}function fp(n){if(!ln(n))return"vbytes";const i=new Set(n.series.map(a=>Fs(cs(a.signalId),a.measure).unit));return i.size===1?[...i][0]??null:null}function xS(n){const i=hS.safeParse(n);if(!i.success)return i.error.issues[0]?.message??"Invalid chart configuration";if(!ln(n))return null;for(const a of n.series){const l=cs(a.signalId);if(!b3(l,a.measure))return`${oS[a.measure].label} is not valid for ${l.label}.`;const u=Fs(l,a.measure);if(!u.chartTypes.includes(n.visualization))return`${u.label} cannot be displayed as a ${n.visualization} chart.`}return fp(n)===null?"All series on a chart must use compatible units.":null}function wS(n){const i=U3.safeParse(n);return!i.success||new Set(i.data.charts.map(a=>a.id)).size!==i.data.charts.length||i.data.charts.some(a=>ln(a)&&new Set(a.series.map(l=>l.id)).size!==a.series.length)?null:i.data.charts.every(a=>xS(a)===null)?i.data.charts:null}function zS(){try{return globalThis.window?.localStorage??null}catch{return null}}function L3(n=zS()){try{const i=n?.getItem(_S);return i?wS(JSON.parse(i))??jf():jf()}catch{return jf()}}function H3(n,i=zS()){try{const a={version:1,charts:n};if(!wS(a))return;i?.setItem(_S,JSON.stringify(a))}catch{}}function eg(n,i){return n.signals[i]}function n_(n,i,a,l){let u=l==="count"?n.priorSignalCounts[i]??0:n.priorSignalSums[i]??0;for(const f of n.buckets){if(f.time>=a)break;const d=eg(f,i);u+=l==="count"?d?.count??0:d?.sum??0}return u}function B3(n,i,a){let l=n.priorSignalLatest[i]??null;for(const u of n.buckets){if(u.time>=a)break;const f=eg(u,i);f?.last!==null&&f?.last!==void 0&&f.lastAt!==null&&(l={value:f.last,time:f.lastAt})}return l}function q3(n,i){const a=i<=n.sessionStartedAt?Math.floor(n.sessionStartedAt/1e3)*1e3:Math.ceil(i/1e3)*1e3,l=Math.floor(n.now/1e3)*1e3,u=new Map(n.buckets.map(d=>[d.time,d])),f=[];for(let d=a;d<=l;d+=1e3)f.push(u.get(d)??{time:d,signals:{}});return f}function V3(n,i,a){const l=Math.max(n.time,a),u=Math.min(i,n.time+1e3);return Math.max(0,(u-l)/1e3)}function I3(n,i,a,l){const u=cs(l.signalId);let f=l.measure==="cumulative-occurrences"?n_(n,l.signalId,a,"count"):l.measure==="payload-cumulative"?n_(n,l.signalId,a,"sum"):0,d=B3(n,l.signalId,a);return i.map(m=>{const p=eg(m,l.signalId);switch(l.measure){case"occurrence-count":return p?.count??0;case"occurrence-rate":{const g=V3(m,n.now,n.sessionStartedAt);return g>0?(p?.count??0)/g:0}case"cumulative-occurrences":return f+=p?.count??0,f;case"payload-sum":return p&&p.samples>0?p.sum:null;case"payload-cumulative":return f+=p?.sum??0,f;case"payload-average":return p&&p.samples>0?p.sum/p.samples:null;case"payload-minimum":return p?.minimum??null;case"payload-maximum":return p?.maximum??null;case"payload-latest":{if(p?.last!==null&&p?.last!==void 0&&p.lastAt!==null)return d={value:p.last,time:p.lastAt},p.last;if(u.source==="pool"){const g=Math.min(m.time+1e3,n.now);return d&&g-d.time0?(p.last-g.value)/b:null}}})}function P3(n,i){const a=n.now-i.range*1e3,l=q3(n,a),u=l[0]?.time??Math.floor(n.now/1e3)*1e3,f=i.series[0],d=Fs(cs(f.signalId),f.measure).unit,m=i.series.filter(p=>(n.signalTotals[p.signalId]??0)===0).map(p=>p.label??cs(p.signalId).label);return{data:[l.map(p=>p.time/1e3),...i.series.map(p=>I3(n,l,u,p))],unit:d,hasObservedData:m.length{const a=()=>{i(Date.now())},l=setInterval(a,1e3);return window.addEventListener("focus",a),document.addEventListener("visibilitychange",a),()=>{clearInterval(l),window.removeEventListener("focus",a),document.removeEventListener("visibilitychange",a)}},[]),n}const Y3={300:"5 minutes",900:"15 minutes",3600:"1 hour"},F3={line:"Line",step:"Step",area:"Area",bar:"Bar"};function Q3(n){return ln(n)?{...n,series:n.series.map(i=>({...i}))}:{...n}}function J3(){const n=new Map;for(const i of Jp){const a=n.get(i.category)??[];a.push(i),n.set(i.category,a)}return[...n]}const X3=J3();function W3({chart:n,mode:i,onCancel:a,onSave:l}){const[u,f]=se.useState(()=>Q3(n)),d=xS(u),m=fp(u);se.useEffect(()=>{function T(A){A.key==="Escape"&&a()}return globalThis.addEventListener("keydown",T),()=>{globalThis.removeEventListener("keydown",T)}},[a]);const p=se.useMemo(()=>new Set(cp.filter(T=>ln(u)&&u.series.every(A=>Fs(cs(A.signalId),A.measure).chartTypes.includes(T)))),[u]);function g(T){f(A=>ln(A)?T(A):A)}function b(T,A){g(k=>({...k,series:k.series.map((L,D)=>D===T?A:L)}))}function y(T,A){if(!ln(u))return;const k=u.series[T],L=cs(A);b(T,{...k,signalId:A,measure:L.defaultMeasure})}function w(){if(!ln(u)||u.series.length>=up)return;const T=fp(u),A=Jp.find(D=>D.allowedMeasures.some(X=>T===null||Fs(D,X).unit===T));if(!A)return;const k=A.allowedMeasures.find(D=>T===null||Fs(A,D).unit===T)??A.defaultMeasure,L={id:`series-${Date.now().toString(36)}-${String(u.series.length+1)}`,signalId:A.id,measure:k,color:Rt[u.series.length%Rt.length]??Rt[0]};g(D=>({...D,series:[...D.series,L]}))}function O(T){T.preventDefault(),!d&&l({...u,title:u.title.trim()})}return x.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 p-4 backdrop-blur-sm",role:"presentation",onMouseDown:T=>{T.target===T.currentTarget&&a()},children:x.jsxs("section",{role:"dialog","aria-modal":"true","aria-labelledby":"chart-editor-title",className:"border-accent/30 bg-surface/95 max-h-[92vh] w-full max-w-4xl overflow-y-auto rounded-2xl border shadow-2xl shadow-black/60",children:[x.jsxs("header",{className:"border-accent/20 flex items-start justify-between border-b p-5",children:[x.jsxs("div",{children:[x.jsx("p",{className:"text-accentSecondary text-xs tracking-wide uppercase",children:"Dashboard builder"}),x.jsx("h2",{id:"chart-editor-title",className:"text-accent mt-1 text-xl font-semibold",children:i==="add"?"Add chart":"Edit chart"})]}),x.jsx("button",{type:"button",onClick:a,className:"text-textMuted hover:text-accent rounded p-1 text-xl","aria-label":"Close chart editor",children:"×"})]}),i==="add"&&x.jsxs("div",{className:"border-accentSecondary/20 border-b p-5",children:[x.jsx("p",{className:"text-accentSecondary mb-3 text-xs tracking-wide uppercase",children:"Start from a template"}),x.jsxs("div",{className:"grid gap-2 sm:grid-cols-2 lg:grid-cols-5",children:[bS.map(T=>x.jsxs("button",{type:"button",onClick:()=>{f(Z3(T.id))},className:"border-accent/30 bg-background hover:border-accent rounded-md border p-3 text-left",children:[x.jsx("span",{className:"text-textPrimary block text-sm font-medium",children:T.label}),x.jsx("span",{className:"text-textMuted mt-1 block text-xs leading-4",children:T.description})]},T.id)),x.jsxs("button",{type:"button",onClick:()=>{f(SS())},className:"border-accent/30 bg-background hover:border-accent rounded-md border p-3 text-left",children:[x.jsx("span",{className:"text-textPrimary block text-sm font-medium",children:"Custom"}),x.jsx("span",{className:"text-textMuted mt-1 block text-xs leading-4",children:"Begin with one editable series."})]})]})]}),x.jsxs("form",{onSubmit:O,className:"space-y-6 p-5",children:[x.jsxs("div",{className:"grid gap-4 md:grid-cols-[minmax(0,1fr)_11rem_11rem]",children:[x.jsxs("label",{className:"space-y-2",children:[x.jsx("span",{className:"text-sm font-medium",children:"Chart title"}),x.jsx("input",{value:u.title,maxLength:nd,onChange:T=>{f(A=>({...A,title:T.target.value}))},className:"border-accent/40 bg-background text-textPrimary focus:border-accent w-full rounded-md border px-3 py-2 text-sm focus:ring-0"})]}),ln(u)?x.jsxs(x.Fragment,{children:[x.jsxs("label",{className:"space-y-2",children:[x.jsx("span",{className:"text-sm font-medium",children:"Chart type"}),x.jsx("select",{value:u.visualization,onChange:T=>{g(A=>({...A,visualization:T.target.value}))},className:"border-accent/40 bg-background text-textPrimary focus:border-accent w-full rounded-md border px-3 py-2 text-sm focus:ring-0",children:cp.map(T=>x.jsx("option",{value:T,disabled:!p.has(T),children:F3[T]},T))})]}),x.jsxs("label",{className:"space-y-2",children:[x.jsx("span",{className:"text-sm font-medium",children:"Time range"}),x.jsx("select",{value:u.range,onChange:T=>{g(A=>({...A,range:Number(T.target.value)}))},className:"border-accent/40 bg-background text-textPrimary focus:border-accent w-full rounded-md border px-3 py-2 text-sm focus:ring-0",children:j3.map(T=>x.jsx("option",{value:T,children:Y3[T]},T))})]})]}):x.jsxs("label",{className:"space-y-2",children:[x.jsx("span",{className:"text-sm font-medium",children:"Bar color"}),x.jsx("input",{type:"color",value:u.color,onChange:T=>{const A=T.target.value;f(k=>ln(k)?k:{...k,color:A})},className:"border-accent/40 bg-background h-10 w-full rounded-md border p-1"})]})]}),ln(u)?x.jsxs("section",{className:"space-y-3",children:[x.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[x.jsxs("div",{children:[x.jsx("h3",{className:"text-accent text-lg font-semibold",children:"Series"}),x.jsxs("p",{className:"text-textMuted mt-1 text-xs",children:["One chart uses one axis unit",m===null?".":`: ${TS(m)}.`]})]}),x.jsx("button",{type:"button",onClick:w,disabled:u.series.length>=up,className:"border-accent/40 text-accent hover:border-accent hover:text-accentSecondary disabled:text-textMuted rounded-md border px-3 py-2 text-sm font-medium disabled:cursor-not-allowed disabled:opacity-50",children:"Add series"})]}),x.jsx("div",{className:"space-y-3",children:u.series.map((T,A)=>{const k=cs(T.signalId),L=Fs(k,T.measure);return x.jsxs("article",{className:"border-accentSecondary/20 bg-accent/5 grid gap-3 rounded-xl border p-4 lg:grid-cols-[minmax(12rem,1.2fr)_minmax(11rem,1fr)_minmax(9rem,0.8fr)_3.5rem_auto]",children:[x.jsxs("label",{className:"space-y-1.5",children:[x.jsxs("span",{className:"text-textMuted text-xs",children:["Signal ",String(A+1)]}),x.jsx("select",{"aria-label":`Signal ${String(A+1)}`,value:T.signalId,onChange:D=>{y(A,D.target.value)},className:"border-accent/40 bg-background text-textPrimary focus:border-accent w-full rounded-md border px-2 py-2 text-sm focus:ring-0",children:X3.map(([D,X])=>x.jsx("optgroup",{label:D,children:X.map(G=>x.jsx("option",{value:G.id,children:G.lab)DELIM" +R"DELIM(el},G.id))},D))})]}),x.jsxs("label",{className:"space-y-1.5",children:[x.jsx("span",{className:"text-textMuted text-xs",children:"Measurement"}),x.jsx("select",{"aria-label":`Measurement ${String(A+1)}`,value:T.measure,onChange:D=>{b(A,{...T,measure:D.target.value})},className:"border-accent/40 bg-background text-textPrimary focus:border-accent w-full rounded-md border px-2 py-2 text-sm focus:ring-0",title:L.description,children:k.allowedMeasures.map(D=>x.jsx("option",{value:D,children:Fs(k,D).label},D))})]}),x.jsxs("label",{className:"space-y-1.5",children:[x.jsx("span",{className:"text-textMuted text-xs",children:"Display label"}),x.jsx("input",{"aria-label":`Display label ${String(A+1)}`,value:T.label??"",onChange:D=>{b(A,{...T,label:D.target.value||void 0})},placeholder:k.label,className:"border-accent/40 bg-background text-textPrimary placeholder:text-textMuted/50 focus:border-accent w-full rounded-md border px-2 py-2 text-sm focus:ring-0"})]}),x.jsxs("label",{className:"space-y-1.5",children:[x.jsx("span",{className:"text-textMuted text-xs",children:"Color"}),x.jsx("input",{"aria-label":`Series color ${String(A+1)}`,type:"color",value:T.color,onChange:D=>{b(A,{...T,color:D.target.value})},className:"border-accent/40 bg-background h-10 w-full rounded-md border p-1"})]}),x.jsx("button",{type:"button",onClick:()=>{g(D=>({...D,series:D.series.filter((X,G)=>G!==A)}))},disabled:u.series.length===1,"aria-label":`Remove series ${String(A+1)}`,className:"text-textMuted self-end rounded-md px-3 py-2 text-sm hover:text-red-300 disabled:cursor-not-allowed disabled:opacity-30",children:"Remove"})]},T.id)})})]}):x.jsx("p",{className:"text-textMuted text-sm",children:"Shows the latest transaction-pool fee distribution, refreshed every five seconds. Each bar shows the virtual size of one fee-rate group, labeled by its minimum fee rate in sat/vB."}),d&&x.jsx("p",{className:"rounded-md border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-sm text-amber-200",children:d}),x.jsxs("div",{className:"border-accentSecondary/20 flex justify-end gap-2 border-t pt-4",children:[x.jsx("button",{type:"button",onClick:a,className:"text-textMuted hover:text-accent rounded-md px-4 py-2 text-sm",children:"Cancel"}),x.jsx("button",{type:"submit",disabled:d!==null,className:"border-accent/40 text-accent hover:border-accent hover:text-accentSecondary rounded-md border px-3 py-2 text-sm font-medium disabled:cursor-not-allowed disabled:opacity-40",children:i==="add"?"Add chart":"Save changes"})]})]})]})})}const eM=!0,gn="u-",tM="uplot",nM=gn+"hz",iM=gn+"vt",rM=gn+"title",sM=gn+"wrap",aM=gn+"under",lM=gn+"over",oM=gn+"axis",Ya=gn+"off",uM=gn+"select",cM=gn+"cursor-x",fM=gn+"cursor-y",dM=gn+"cursor-pt",hM=gn+"legend",mM=gn+"live",pM=gn+"inline",gM=gn+"series",vM=gn+"marker",i_=gn+"label",yM=gn+"value",zu="width",Tu="height",yu="top",r_="bottom",Xl="left",Vm="right",tg="#000",s_=tg+"0",Im="mousemove",a_="mousedown",Pm="mouseup",l_="mouseenter",o_="mouseleave",u_="dblclick",bM="resize",_M="scroll",c_="change",Pf="dppxchange",ng="--",po=typeof window<"u",dp=po?document:null,no=po?window:null,SM=po?navigator:null;let rt,xf;function hp(){let n=devicePixelRatio;rt!=n&&(rt=n,xf&&pp(c_,xf,hp),xf=matchMedia(`(min-resolution: ${rt-.001}dppx) and (max-resolution: ${rt+.001}dppx)`),Xa(c_,xf,hp),no.dispatchEvent(new CustomEvent(Pf)))}function Ci(n,i){if(i!=null){let a=n.classList;!a.contains(i)&&a.add(i)}}function mp(n,i){let a=n.classList;a.contains(i)&&a.remove(i)}function Et(n,i,a){n.style[i]=a+"px"}function vr(n,i,a,l){let u=dp.createElement(n);return i!=null&&Ci(u,i),a?.insertBefore(u,l),u}function Ji(n,i){return vr("div",n,i)}const f_=new WeakMap;function Lr(n,i,a,l,u){let f="translate("+i+"px,"+a+"px)",d=f_.get(n);f!=d&&(n.style.transform=f,f_.set(n,f),i<0||a<0||i>l||a>u?Ci(n,Ya):mp(n,Ya))}const d_=new WeakMap;function h_(n,i,a){let l=i+a,u=d_.get(n);l!=u&&(d_.set(n,l),n.style.background=i,n.style.borderColor=a)}const m_=new WeakMap;function p_(n,i,a,l){let u=i+""+a,f=m_.get(n);u!=f&&(m_.set(n,u),n.style.height=a+"px",n.style.width=i+"px",n.style.marginLeft=l?-i/2+"px":0,n.style.marginTop=l?-a/2+"px":0)}const ig={passive:!0},xM={...ig,capture:!0};function Xa(n,i,a,l){i.addEventListener(n,a,l?xM:ig)}function pp(n,i,a,l){i.removeEventListener(n,a,ig)}po&&hp();function yr(n,i,a,l){let u;a=a||0,l=l||i.length-1;let f=l<=2147483647;for(;l-a>1;)u=f?a+l>>1:Zi((a+l)/2),i[u]{let f=-1,d=-1;for(let m=l;m<=u;m++)if(n(a[m])){f=m;break}for(let m=u;m>=l;m--)if(n(a[m])){d=m;break}return[f,d]}}const NS=n=>n!=null,AS=n=>n!=null&&n>0,rd=OS(NS),wM=OS(AS);function zM(n,i,a,l=0,u=!1){let f=u?wM:rd,d=u?AS:NS;[i,a]=f(n,i,a);let m=n[i],p=n[i];if(i>-1)if(l==1)m=n[i],p=n[a];else if(l==-1)m=n[a],p=n[i];else for(let g=i;g<=a;g++){let b=n[g];d(b)&&(bp&&(p=b))}return[m??_t,p??-_t]}function sd(n,i,a,l){let u=y_(n),f=y_(i);n==i&&(u==-1?(n*=a,i/=a):(n/=a,i*=a));let d=a==10?fs:MS,m=u==1?Zi:Xi,p=f==1?Xi:Zi,g=m(d(mn(n))),b=p(d(mn(i))),y=lo(a,g),w=lo(a,b);return a==10&&(g<0&&(y=St(y,-g)),b<0&&(w=St(w,-b))),l||a==2?(n=y*u,i=w*f):(n=CS(n,y),i=ad(i,w)),[n,i]}function rg(n,i,a,l){let u=sd(n,i,a,l);return n==0&&(u[0]=0),i==0&&(u[1]=0),u}const sg=.1,g_={mode:3,pad:sg},ju={pad:0,soft:null,mode:0},TM={min:ju,max:ju};function Kf(n,i,a,l){return ld(a)?v_(n,i,a):(ju.pad=a,ju.soft=l?0:null,ju.mode=l?3:0,v_(n,i,TM))}function et(n,i){return n??i}function EM(n,i,a){for(i=et(i,0),a=et(a,n.length-1);i<=a;){if(n[i]!=null)return!0;i++}return!1}function v_(n,i,a){let l=a.min,u=a.max,f=et(l.pad,0),d=et(u.pad,0),m=et(l.hard,-_t),p=et(u.hard,_t),g=et(l.soft,_t),b=et(u.soft,-_t),y=et(l.mode,0),w=et(u.mode,0),O=i-n,T=fs(O),A=ai(mn(n),mn(i)),k=fs(A),L=mn(k-T);(O<1e-24||L>10)&&(O=0,(n==0||i==0)&&(O=1e-24,y==2&&g!=_t&&(f=0),w==2&&b!=-_t&&(d=0)));let D=O||A||1e3,X=fs(D),G=lo(10,Zi(X)),ee=D*(O==0?n==0?.1:1:f),V=St(CS(n-ee,G/10),24),ne=n>=g&&(y==1||y==3&&V<=g||y==2&&V>=g)?g:_t,ae=ai(m,V=ne?ne:br(ne,V)),ye=D*(O==0?i==0?.1:1:d),ue=St(ad(i+ye,G/10),24),J=i<=b&&(w==1||w==3&&ue>=b||w==2&&ue<=b)?b:-_t,we=br(p,ue>J&&i<=J?J:ai(J,ue));return ae==we&&ae==0&&(we=100),[ae,we]}const OM=new Intl.NumberFormat(po?SM.language:"en-US"),ag=n=>OM.format(n),$i=Math,kf=$i.PI,mn=$i.abs,Zi=$i.floor,dn=$i.round,Xi=$i.ceil,br=$i.min,ai=$i.max,lo=$i.pow,y_=$i.sign,fs=$i.log10,MS=$i.log2,NM=(n,i=1)=>$i.sinh(n)*i,Km=(n,i=1)=>$i.asinh(n/i),_t=1/0;function b_(n){return(fs((n^n>>31)-(n>>31))|0)+1}function gp(n,i,a){return br(ai(n,i),a)}function jS(n){return typeof n=="function"}function Qe(n){return jS(n)?n:()=>n}const AM=()=>{},kS=n=>n,RS=(n,i)=>i,MM=n=>null,__=n=>!0,S_=(n,i)=>n==i,jM=/\.\d*?(?=9{6,}|0{6,})/gm,tl=n=>{if(US(n)||ea.has(n))return n;const i=`${n}`,a=i.match(jM);if(a==null)return n;let l=a[0].length-1;if(i.indexOf("e-")!=-1){let[u,f]=i.split("e");return+`${tl(u)}e${f}`}return St(n,l)};function Ka(n,i){return tl(St(tl(n/i))*i)}function ad(n,i){return tl(Xi(tl(n/i))*i)}function CS(n,i){return tl(Zi(tl(n/i))*i)}function St(n,i=0){if(US(n))return n;let a=10**i,l=n*a*(1+Number.EPSILON);return dn(l)/a}const ea=new Map;function DS(n){return((""+n).split(".")[1]||"").length}function $u(n,i,a,l){let u=[],f=l.map(DS);for(let d=i;d=0?0:m)+(d>=f[g]?0:f[g]),w=n==10?b:St(b,y);u.push(w),ea.set(w,y)}}return u}const ku={},lg=[],oo=[null,null],Ys=Array.isArray,US=Number.isInteger,kM=n=>n===void 0;function x_(n){return typeof n=="string"}function ld(n){let i=!1;if(n!=null){let a=n.constructor;i=a==null||a==Object}return i}function RM(n){return n!=null&&typeof n=="object"}const CM=Object.getPrototypeOf(Uint8Array),ZS="__proto__";function uo(n,i=ld){let a;if(Ys(n)){let l=n.find(u=>u!=null);if(Ys(l)||i(l)){a=Array(n.length);for(let u=0;uf){for(u=d-1;u>=0&&n[u]==null;)n[u--]=null;for(u=d+1;ud-m)],u=l[0].length,f=new Map;for(let d=0;d"u"?n=>Promise.resolve().then(n):queueMicrotask;function BM(n){let i=n[0],a=i.length,l=Array(a);for(let f=0;fi[f]-i[d]);let u=[];for(let f=0;f=l&&n[u]==null;)u--;if(u<=l)return!0;const f=ai(1,Zi((u-l+1)/i));for(let d=n[l],m=l+f;m<=u;m+=f){const p=n[m];if(p!=null){if(p<=d)return!1;d=p}}return!0}const $S=["January","February","March","April","May","June","July","August","September","October","November","December"],LS=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];function HS(n){return n.slice(0,3)}const IM=LS.map(HS),PM=$S.map(HS),KM={MMMM:$S,MMM:PM,WWWW:LS,WWW:IM};function bu(n){return(n<10?"0":"")+n}function GM(n){return(n<10?"00":n<100?"0":"")+n}const YM={YYYY:n=>n.getFullYear(),YY:n=>(n.getFullYear()+"").slice(2),MMMM:(n,i)=>i.MMMM[n.getMonth()],MMM:(n,i)=>i.MMM[n.getMonth()],MM:n=>bu(n.getMonth()+1),M:n=>n.getMonth()+1,DD:n=>bu(n.getDate()),D:n=>n.getDate(),WWWW:(n,i)=>i.WWWW[n.getDay()],WWW:(n,i)=>i.WWW[n.getDay()],HH:n=>bu(n.getHours()),H:n=>n.getHours(),h:n=>{let i=n.getHours();return i==0?12:i>12?i-12:i},AA:n=>n.getHours()>=12?"PM":"AM",aa:n=>n.getHours()>=12?"pm":"am",a:n=>n.getHours()>=12?"p":"a",mm:n=>bu(n.getMinutes()),m:n=>n.getMinutes(),ss:n=>bu(n.getSeconds()),s:n=>n.getSeconds(),fff:n=>GM(n.getMilliseconds())};function og(n,i){i=i||KM;let a=[],l=/\{([a-z]+)\}|[^{]+/gi,u;for(;u=l.exec(n);)a.push(u[0][0]=="{"?YM[u[1]]:u[0]);return f=>{let d="";for(let m=0;mn%1==0,Gf=[1,2,2.5,5],JM=$u(10,-32,0,Gf),qS=$u(10,0,32,Gf),XM=qS.filter(BS),Ga=JM.concat(qS),ug=` +`,VS="{YYYY}",w_=ug+VS,IS="{M}/{D}",Eu=ug+IS,wf=Eu+"/{YY}",PS="{aa}",WM="{h}:{mm}",eo=WM+PS,z_=ug+eo,T_=":{ss}",lt=null;function KS(n){let i=n*1e3,a=i*60,l=a*60,u=l*24,f=u*30,d=u*365,p=(n==1?$u(10,0,3,Gf).filter(BS):$u(10,-3,0,Gf)).concat([i,i*5,i*10,i*15,i*30,a,a*5,a*10,a*15,a*30,l,l*2,l*3,l*4,l*6,l*8,l*12,u,u*2,u*3,u*4,u*5,u*6,u*7,u*8,u*9,u*10,u*15,f,f*2,f*3,f*4,f*6,d,d*2,d*5,d*10,d*25,d*50,d*100]);const g=[[d,VS,lt,lt,lt,lt,lt,lt,1],[u*28,"{MMM}",w_,lt,lt,lt,lt,lt,1],[u,IS,w_,lt,lt,lt,lt,lt,1],[l,"{h}"+PS,wf,lt,Eu,lt,lt,lt,1],[a,eo,wf,lt,Eu,lt,lt,lt,1],[i,T_,wf+" "+eo,lt,Eu+" "+eo,lt,z_,lt,1],[n,T_+".{fff}",wf+" "+eo,lt,Eu+" "+eo,lt,z_,lt,1]];function b(y){return(w,O,T,A,k,L)=>{let D=[],X=k>=d,G=k>=f&&k=u?u:k,ue=Zi(T)-Zi(V),J=ae+ue+ad(V-ae,ye);D.push(J);let we=y(J),he=we.getHours()+we.getMinutes()/a+we.getSeconds()/l,Oe=k/l,fe=w.axes[O]._space,Q=L/fe;for(;J=St(J+k,n==1?0:3),!(J>A);)if(Oe>1){let W=Zi(St(he+Oe,6))%24,Se=y(J).getHours()-W;Se>1&&(Se=-1),J-=Se*l,he=(he+Oe)%24;let Be=D[D.length-1];St((J-Be)/k,3)*Q>=.7&&D.push(J)}else D.push(J)}return D}}return[p,g,b]}const[e4,t4,n4]=KS(1),[i4,r4,s4]=KS(.001);$u(2,-53,53,[1]);function E_(n,i){return n.map(a=>a.map((l,u)=>u==0||u==8||l==null?l:i(u==1||a[8]==0?l:a[1]+l)))}function O_(n,i){return(a,l,u,f,d)=>{let m=i.find(T=>d>=T[0])||i[i.length-1],p,g,b,y,w,O;return l.map(T=>{let A=n(T),k=A.getFullYear(),L=A.getMonth(),D=A.getDate(),X=A.getHours(),G=A.getMinutes(),ee=A.getSeconds(),V=k!=p&&m[2]||L!=g&&m[3]||D!=b&&m[4]||X!=y&&m[5]||G!=w&&m[6]||ee!=O&&m[7]||m[1];return p=k,g=L,b=D,y=X,w=G,O=ee,V(A)})}}function a4(n,i){let a=og(i);return(l,u,f,d,m)=>u.map(p=>a(n(p)))}function Gm(n,i,a){return new Date(n,i,a)}function N_(n,i){return i(n)}const l4="{YYYY}-{MM}-{DD} {h}:{mm}{aa}";function A_(n,i){return(a,l,u,f)=>f==null?ng:i(n(l))}function o4(n,i){let a=n.series[i];return a.width?a.stroke(n,i):a.points.width?a.points.stroke(n,i):null}function u4(n,i){return n.series[i].fill(n,i)}const c4={show:!0,live:!0,isolate:!1,mount:AM,markers:{show:!0,width:2,stroke:o4,fill:u4,dash:"solid"},idx:null,idxs:null,values:[]};function f4(n,i){let a=n.cursor.points,l=Ji(),u=a.size(n,i);Et(l,zu,u),Et(l,Tu,u);let f=u/-2;Et(l,"marginLeft",f),Et(l,"marginTop",f);let d=a.width(n,i,u);return d&&Et(l,"borderWidth",d),l}function d4(n,i){let a=n.series[i].points;return a._fill||a._stroke}function h4(n,i){let a=n.series[i].points;return a._stroke||a._fill}function m4(n,i){return n.series[i].points.size}const Ym=[0,0];function p4(n,i,a){return Ym[0]=i,Ym[1]=a,Ym}function zf(n,i,a,l=!0){return u=>{u.button==0&&(!l||u.target==i)&&a(u)}}function Fm(n,i,a,l=!0){return u=>{(!l||u.target==i)&&a(u)}}const g4={show:!0,x:!0,y:!0,lock:!1,move:p4,points:{one:!1,show:f4,size:m4,width:0,stroke:h4,fill:d4},bind:{mousedown:zf,mouseup:zf,click:zf,dblclick:zf,mousemove:Fm,mouseleave:Fm,mouseenter:Fm},drag:{setScale:!0,x:!0,y:!1,dist:0,uni:null,click:(n,i)=>{i.stopPropagation(),i.stopImmediatePropagation()},_x:!1,_y:!1},focus:{dist:(n,i,a,l,u)=>l-u,prox:-1,bias:0},hover:{skip:[void 0],prox:null,bias:0},left:-10,top:-10,idx:null,dataIdx:null,idxs:null,event:null},GS={show:!0,stroke:"rgba(0,0,0,0.07)",width:2},cg=an({},GS,{filter:RS}),YS=an({},cg,{size:10}),FS=an({},GS,{show:!1}),fg='12px system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"',QS="bold "+fg,JS=1.5,M_={show:!0,scale:"x",stroke:tg,space:50,gap:5,alignTo:1,size:50,labelGap:0,labelSize:30,labelFont:QS,side:2,grid:cg,ticks:YS,border:FS,font:fg,lineGap:JS,rotate:0},v4="Value",y4="Time",j_={show:!0,scale:"x",auto:!1,sorted:1,min:_t,max:-_t,idxs:[]};function b4(n,i,a,l,u){return i.map(f=>f==null?"":ag(f))}function _4(n,i,a,l,u,f,d){let m=[],p=ea.get(u)||0;a=d?a:St(ad(a,u),p);for(let g=a;g<=l;g=St(g+u,p))m.push(Object.is(g,-0)?0:g);return m}function vp(n,i,a,l,u,f,d){const m=[],p=n.scales[n.axes[i].scale].log,g=p==10?fs:MS,b=Zi(g(a));u=lo(p,b),p==10&&(u=Ga[yr(u,Ga)]);let y=a,w=u*p;p==10&&(w=Ga[yr(w,Ga)]);do m.push(y),y=y+u,p==10&&!ea.has(y)&&(y=St(y,ea.get(u))),y>=w&&(u=y,w=u*p,p==10&&(w=Ga[yr(w,Ga)]));while(y<=l);return m}function S4(n,i,a,l,u,f,d){let p=n.scales[n.axes[i].scale].asinh,g=l>p?vp(n,i,ai(p,a),l,u):[p],b=l>=0&&a<=0?[0]:[];return(a<-p?vp(n,i,ai(p,-l),-a,u):[p]).reverse().map(w=>-w).concat(b,g)}const XS=/./,x4=/[12357]/,w4=/[125]/,k_=/1/,yp=(n,i,a,l)=>n.map((u,f)=>i==4&&u==0||f%l==0&&a.test(u.toExpo)DELIM" +R"DELIM(nential()[u<0?1:0])?u:null);function z4(n,i,a,l,u){let f=n.axes[a],d=f.scale,m=n.scales[d],p=n.valToPos,g=f._space,b=p(10,d),y=p(9,d)-b>=g?XS:p(7,d)-b>=g?x4:p(5,d)-b>=g?w4:k_;if(y==k_){let w=mn(p(1,d)-b);if(wu,D_={show:!0,auto:!0,sorted:0,gaps:WS,alpha:1,facets:[an({},C_,{scale:"x"}),an({},C_,{scale:"y"})]},U_={scale:"y",auto:!0,sorted:0,show:!0,spanGaps:!1,gaps:WS,alpha:1,points:{show:N4,filter:null},values:null,min:_t,max:-_t,idxs:[],path:null,clip:null};function A4(n,i,a,l,u){return a/10}const ex={time:eM,auto:!0,distr:1,log:10,asinh:1,min:null,max:null,dir:1,ori:0},M4=an({},ex,{time:!1,ori:1}),Z_={};function tx(n,i){let a=Z_[n];return a||(a={key:n,plots:[],sub(l){a.plots.push(l)},unsub(l){a.plots=a.plots.filter(u=>u!=l)},pub(l,u,f,d,m,p,g){for(let b=0;b{let L=d.pxRound;const D=g.dir*(g.ori==0?1:-1),X=g.ori==0?go:vo;let G,ee;D==1?(G=a,ee=l):(G=l,ee=a);let V=L(y(m[G],g,A,O)),ne=L(w(p[G],b,k,T)),ae=L(y(m[ee],g,A,O)),ye=L(w(f==1?b.max:b.min,b,k,T)),ue=new Path2D(u);return X(ue,ae,ye),X(ue,V,ye),X(ue,V,ne),ue})}function od(n,i,a,l,u,f){let d=null;if(n.length>0){d=new Path2D;const m=i==0?fd:mg;let p=a;for(let y=0;yw[0]){let O=w[0]-p;O>0&&m(d,p,l,O,l+f),p=w[1]}}let g=a+u-p,b=10;g>0&&m(d,p,l-b/2,g,l+f+b)}return d}function k4(n,i,a){let l=n[n.length-1];l&&l[0]==i?l[1]=a:n.push([i,a])}function hg(n,i,a,l,u,f,d){let m=[],p=n.length;for(let g=u==1?a:l;g>=a&&g<=l;g+=u)if(i[g]===null){let y=g,w=g;if(u==1)for(;++g<=l&&i[g]===null;)w=g;else for(;--g>=a&&i[g]===null;)w=g;let O=f(n[y]),T=w==y?O:f(n[w]),A=y-u;O=d<=0&&A>=0&&A=0&&L>=0&&L=O&&m.push([O,T])}return m}function $_(n){return n==0?kS:n==1?dn:i=>Ka(i,n)}function nx(n){let i=n==0?ud:cd,a=n==0?(u,f,d,m,p,g)=>{u.arcTo(f,d,m,p,g)}:(u,f,d,m,p,g)=>{u.arcTo(d,f,p,m,g)},l=n==0?(u,f,d,m,p)=>{u.rect(f,d,m,p)}:(u,f,d,m,p)=>{u.rect(d,f,p,m)};return(u,f,d,m,p,g=0,b=0)=>{g==0&&b==0?l(u,f,d,m,p):(g=br(g,m/2,p/2),b=br(b,m/2,p/2),i(u,f+g,d),a(u,f+m,d,f+m,d+p,g),a(u,f+m,d+p,f,d+p,b),a(u,f,d+p,f,d,b),a(u,f,d,f+m,d,g),u.closePath())}}const ud=(n,i,a)=>{n.moveTo(i,a)},cd=(n,i,a)=>{n.moveTo(a,i)},go=(n,i,a)=>{n.lineTo(i,a)},vo=(n,i,a)=>{n.lineTo(a,i)},fd=nx(0),mg=nx(1),ix=(n,i,a,l,u,f)=>{n.arc(i,a,l,u,f)},rx=(n,i,a,l,u,f)=>{n.arc(a,i,l,u,f)},sx=(n,i,a,l,u,f,d)=>{n.bezierCurveTo(i,a,l,u,f,d)},ax=(n,i,a,l,u,f,d)=>{n.bezierCurveTo(a,i,u,l,d,f)};function lx(n){return(i,a,l,u,f)=>nl(i,a,(d,m,p,g,b,y,w,O,T,A,k)=>{let{pxRound:L,points:D}=d,X,G;g.ori==0?(X=ud,G=ix):(X=cd,G=rx);const ee=St(D.width*rt,3);let V=(D.size-D.width)/2*rt,ne=St(V*2,3),ae=new Path2D,ye=new Path2D,{left:ue,top:J,width:we,height:he}=i.bbox;fd(ye,ue-ne,J-ne,we+ne*2,he+ne*2);const Oe=fe=>{if(p[fe]!=null){let Q=L(y(m[fe],g,A,O)),W=L(w(p[fe],b,k,T));X(ae,Q+V,W),G(ae,Q,W,V,0,kf*2)}};if(f)f.forEach(Oe);else for(let fe=l;fe<=u;fe++)Oe(fe);return{stroke:ee>0?ae:null,fill:ae,clip:ye,flags:co|bp}})}function ox(n){return(i,a,l,u,f,d)=>{l!=u&&(f!=l&&d!=l&&n(i,a,l),f!=u&&d!=u&&n(i,a,u),n(i,a,d))}}const R4=ox(go),C4=ox(vo);function ux(n){const i=et(n?.alignGaps,0);return(a,l,u,f)=>nl(a,l,(d,m,p,g,b,y,w,O,T,A,k)=>{[u,f]=rd(p,u,f);let L=d.pxRound,D=he=>L(y(he,g,A,O)),X=he=>L(w(he,b,k,T)),G,ee;g.ori==0?(G=go,ee=R4):(G=vo,ee=C4);const V=g.dir*(g.ori==0?1:-1),ne={stroke:new Path2D,fill:null,clip:null,band:null,gaps:null,flags:co},ae=ne.stroke;let ye=!1;if(f-u>=A*4){let he=be=>a.posToVal(be,g.key,!0),Oe=null,fe=null,Q,W,xe,Me=D(m[V==1?u:f]),Se=D(m[u]),Be=D(m[f]),Re=he(V==1?Se+1:Be-1);for(let be=V==1?u:f;be>=u&&be<=f;be+=V){let M=m[be],le=(V==1?MRe)?Me:D(M),re=p[be];le==Me?re!=null?(W=re,Oe==null?(G(ae,le,X(W)),Q=Oe=fe=W):Wfe&&(fe=W)):re===null&&(ye=!0):(Oe!=null&&ee(ae,Me,X(Oe),X(fe),X(Q),X(W)),re!=null?(W=re,G(ae,le,X(W)),Oe=fe=Q=W):(Oe=fe=null,re===null&&(ye=!0)),Me=le,Re=he(Me+V))}Oe!=null&&Oe!=fe&&xe!=Me&&ee(ae,Me,X(Oe),X(fe),X(Q),X(W))}else for(let he=V==1?u:f;he>=u&&he<=f;he+=V){let Oe=p[he];Oe===null?ye=!0:Oe!=null&&G(ae,D(m[he]),X(Oe))}let[J,we]=dg(a,l);if(d.fill!=null||J!=0){let he=ne.fill=new Path2D(ae),Oe=d.fillTo(a,l,d.min,d.max,J),fe=X(Oe),Q=D(m[u]),W=D(m[f]);V==-1&&([W,Q]=[Q,W]),G(he,W,fe),G(he,Q,fe)}if(!d.spanGaps){let he=[];ye&&he.push(...hg(m,p,u,f,V,D,i)),ne.gaps=he=d.gaps(a,l,u,f,he),ne.clip=od(he,g.ori,O,T,A,k)}return we!=0&&(ne.band=we==2?[ds(a,l,u,f,ae,-1),ds(a,l,u,f,ae,1)]:ds(a,l,u,f,ae,we)),ne})}function D4(n){const i=et(n.align,1),a=et(n.ascDesc,!1),l=et(n.alignGaps,0),u=et(n.extend,!1);return(f,d,m,p)=>nl(f,d,(g,b,y,w,O,T,A,k,L,D,X)=>{[m,p]=rd(y,m,p);let G=g.pxRound,{left:ee,width:V}=f.bbox,ne=Se=>G(T(Se,w,D,k)),ae=Se=>G(A(Se,O,X,L)),ye=w.ori==0?go:vo;const ue={stroke:new Path2D,fill:null,clip:null,band:null,gaps:null,flags:co},J=ue.stroke,we=w.dir*(w.ori==0?1:-1);let he=ae(y[we==1?m:p]),Oe=ne(b[we==1?m:p]),fe=Oe,Q=Oe;u&&i==-1&&(Q=ee,ye(J,Q,he)),ye(J,Oe,he);for(let Se=we==1?m:p;Se>=m&&Se<=p;Se+=we){let Be=y[Se];if(Be==null)continue;let Re=ne(b[Se]),be=ae(Be);i==1?ye(J,Re,he):ye(J,fe,be),ye(J,Re,be),he=be,fe=Re}let W=fe;u&&i==1&&(W=ee+V,ye(J,W,he));let[xe,Me]=dg(f,d);if(g.fill!=null||xe!=0){let Se=ue.fill=new Path2D(J),Be=g.fillTo(f,d,g.min,g.max,xe),Re=ae(Be);ye(Se,W,Re),ye(Se,Q,Re)}if(!g.spanGaps){let Se=[];Se.push(...hg(b,y,m,p,we,ne,l));let Be=g.width*rt/2,Re=a||i==1?Be:-Be,be=a||i==-1?-Be:Be;Se.forEach(M=>{M[0]+=Re,M[1]+=be}),ue.gaps=Se=g.gaps(f,d,m,p,Se),ue.clip=od(Se,w.ori,k,L,D,X)}return Me!=0&&(ue.band=Me==2?[ds(f,d,m,p,J,-1),ds(f,d,m,p,J,1)]:ds(f,d,m,p,J,Me)),ue})}function L_(n,i,a,l,u,f,d=_t){if(n.length>1){let m=null;for(let p=0,g=1/0;p{}),{fill:y,stroke:w}=g;return(O,T,A,k)=>nl(O,T,(L,D,X,G,ee,V,ne,ae,ye,ue,J)=>{let we=L.pxRound,he=a,Oe=l*rt,fe=m*rt,Q=p*rt,W,xe;G.ori==0?[W,xe]=f(O,T):[xe,W]=f(O,T);const Me=G.dir*(G.ori==0?1:-1);let Se=G.ori==0?fd:mg,Be=G.ori==0?b:(me,nt,Zt,qr,Zn,oi,nr)=>{b(me,nt,Zt,Zn,qr,nr,oi)},Re=et(O.bands,lg).find(me=>me.series[0]==T),be=Re!=null?Re.dir:0,M=L.fillTo(O,T,L.min,L.max,be),F=we(ne(M,ee,J,ye)),le,re,$e,Ue=ue,Ae=we(L.width*rt),pe=!1,Ne=null,Bt=null,Li=null,bi=null;y!=null&)DELIM" +R"DELIM(&(Ae==0||w!=null)&&(pe=!0,Ne=y.values(O,T,A,k),Bt=new Map,new Set(Ne).forEach(me=>{me!=null&&Bt.set(me,new Path2D)}),Ae>0&&(Li=w.values(O,T,A,k),bi=new Map,new Set(Li).forEach(me=>{me!=null&&bi.set(me,new Path2D)})));let{x0:En,size:Ut}=g;if(En!=null&&Ut!=null){he=1,D=En.values(O,T,A,k),En.unit==2&&(D=D.map(Zt=>O.posToVal(ae+Zt*ue,G.key,!0)));let me=Ut.values(O,T,A,k);Ut.unit==2?re=me[0]*ue:re=V(me[0],G,ue,ae)-V(0,G,ue,ae),Ue=L_(D,X,V,G,ue,ae,Ue),$e=Ue-re+Oe}else Ue=L_(D,X,V,G,ue,ae,Ue),$e=Ue*d+Oe,re=Ue-$e;$e<1&&($e=0),Ae>=re/2&&(Ae=0),$e<5&&(we=kS);let tt=$e>0,vn=Ue-$e-(tt?Ae:0);re=we(gp(vn,Q,fe)),le=(he==0?re/2:he==Me?0:re)-he*Me*((he==0?Oe/2:0)+(tt?Ae/2:0));const Gt={stroke:null,fill:null,clip:null,band:null,gaps:null,flags:0},Kn=pe?null:new Path2D;let li=null;if(Re!=null)li=O.data[Re.series[1]];else{let{y0:me,y1:nt}=g;me!=null&&nt!=null&&(X=nt.values(O,T,A,k),li=me.values(O,T,A,k))}let Hi=W*re,Ce=xe*re;for(let me=Me==1?A:k;me>=A&&me<=k;me+=Me){let nt=X[me];if(nt==null)continue;if(li!=null){let yn=li[me]??0;if(nt-yn==0)continue;F=ne(yn,ee,J,ye)}let Zt=G.distr!=2||g!=null?D[me]:me,qr=V(Zt,G,ue,ae),Zn=ne(et(nt,M),ee,J,ye),oi=we(qr-le),nr=we(ai(Zn,F)),Gn=we(br(Zn,F)),Yn=nr-Gn;if(nt!=null){let yn=nt<0?Ce:Hi,Fn=nt<0?Hi:Ce;pe?(Ae>0&&Li[me]!=null&&Se(bi.get(Li[me]),oi,Gn+Zi(Ae/2),re,ai(0,Yn-Ae),yn,Fn),Ne[me]!=null&&Se(Bt.get(Ne[me]),oi,Gn+Zi(Ae/2),re,ai(0,Yn-Ae),yn,Fn)):Se(Kn,oi,Gn+Zi(Ae/2),re,ai(0,Yn-Ae),yn,Fn),Be(O,T,me,oi-Ae/2,Gn,re+Ae,Yn)}}return Ae>0?Gt.stroke=pe?bi:Kn:pe||(Gt._fill=L.width==0?L._fill:L._stroke??L._fill,Gt.width=0),Gt.fill=pe?Bt:Kn,Gt})}function Z4(n,i){const a=et(i?.alignGaps,0);return(l,u,f,d)=>nl(l,u,(m,p,g,b,y,w,O,T,A,k,L)=>{[f,d]=rd(g,f,d);let D=m.pxRound,X=W=>D(w(W,b,k,T)),G=W=>D(O(W,y,L,A)),ee,V,ne;b.ori==0?(ee=ud,ne=go,V=sx):(ee=cd,ne=vo,V=ax);const ae=b.dir*(b.ori==0?1:-1);let ye=X(p[ae==1?f:d]),ue=ye,J=[],we=[];for(let W=ae==1?f:d;W>=f&&W<=d;W+=ae)if(g[W]!=null){let Me=p[W],Se=X(Me);J.push(ue=Se),we.push(G(g[W]))}const he={stroke:n(J,we,ee,ne,V,D),fill:null,clip:null,band:null,gaps:null,flags:co},Oe=he.stroke;let[fe,Q]=dg(l,u);if(m.fill!=null||fe!=0){let W=he.fill=new Path2D(Oe),xe=m.fillTo(l,u,m.min,m.max,fe),Me=G(xe);ne(W,ue,Me),ne(W,ye,Me)}if(!m.spanGaps){let W=[];W.push(...hg(p,g,f,d,ae,X,a)),he.gaps=W=m.gaps(l,u,f,d,W),he.clip=od(W,b.ori,T,A,k,L)}return Q!=0&&(he.band=Q==2?[ds(l,u,f,d,Oe,-1),ds(l,u,f,d,Oe,1)]:ds(l,u,f,d,Oe,Q)),he})}function $4(n){return Z4(L4,n)}function L4(n,i,a,l,u,f){const d=n.length;if(d<2)return null;const m=new Path2D;if(a(m,n[0],i[0]),d==2)l(m,n[1],i[1]);else{let p=Array(d),g=Array(d-1),b=Array(d-1),y=Array(d-1);for(let w=0;w0!=g[w]>0?p[w]=0:(p[w]=3*(y[w-1]+y[w])/((2*y[w]+y[w-1])/g[w-1]+(y[w]+2*y[w-1])/g[w]),isFinite(p[w])||(p[w]=0));p[d-1]=g[d-2];for(let w=0;w{on.pxRatio=rt}));const H4=ux(),B4=lx();function B_(n,i,a,l){return(l?[n[0],n[1]].concat(n.slice(2)):[n[0]].concat(n.slice(1))).map((f,d)=>Sp(f,d,i,a))}function q4(n,i){return n.map((a,l)=>l==0?{}:an({},i,a))}function Sp(n,i,a,l){return an({},i==0?a:l,n)}function cx(n,i,a){return i==null?oo:[i,a]}const V4=cx;function I4(n,i,a){return i==null?oo:Kf(i,a,sg,!0)}function fx(n,i,a,l){return i==null?oo:sd(i,a,n.scales[l].log,!1)}const P4=fx;function dx(n,i,a,l){return i==null?oo:rg(i,a,n.scales[l].log,!1)}const K4=dx;function G4(n,i,a,l,u){let f=ai(b_(n),b_(i)),d=i-n,m=yr(u/l*d,a);do{let p=a[m],g=l*p/d;if(g>=u&&f+(p<5?ea.get(p):0)<=17)return[p,g]}while(++m(i=dn((a=+u)*rt))+"px"),[n,i,a]}function Y4(n){n.show&&[n.font,n.labelFont].forEach(i=>{let a=St(i[2]*rt,1);i[0]=i[0].replace(/[0-9.]+px/,a+"px"),i[1]=a})}function on(n,i,a){const l={mode:et(n.mode,1)},u=l.mode;function f(v,S,z,E){let R=S.valToPct(v);return E+z*(S.dir==-1?1-R:R)}function d(v,S,z,E){let R=S.valToPct(v);return E+z*(S.dir==-1?R:1-R)}function m(v,S,z,E){return S.ori==0?f(v,S,z,E):d(v,S,z,E)}l.valToPosH=f,l.valToPosV=d;let p=!1;l.status=0;const g=l.root=Ji(tM);if(n.id!=null&&(g.id=n.id),Ci(g,n.class),n.title){let v=Ji(rM,g);v.textContent=n.title}const b=vr("canvas"),y=l.ctx=b.getContext("2d"),w=Ji(sM,g);Xa("click",w,v=>{v.target===T&&(vt!=_s||xt!=Qr)&&ht.click(l,v)},!0);const O=l.under=Ji(aM,w);w.appendChild(b);const T=l.over=Ji(lM,w);n=uo(n);const A=+et(n.pxAlign,1),k=$_(A);(n.plugins||[]).forEach(v=>{v.opts&&(n=v.opts(l,n)||n)});const L=n.ms||.001,D=l.series=u==1?B_(n.series||[],j_,U_,!1):q4(n.series||[null],D_),X=l.axes=B_(n.axes||[],M_,R_,!0),G=l.scales={},ee=l.bands=n.bands||[];ee.forEach(v=>{v.fill=Qe(v.fill||null),v.dir=et(v.dir,-1)});const V=u==2?D[1].facets[0].scale:D[0].scale,ne={axes:dl,series:Iu},ae=(n.drawOrder||["axes","series"]).map(v=>ne[v]);function ye(v){const S=v.distr==3?z=>fs(z>0?z:v.clamp(l,z,v.min,v.max,v.key)):v.distr==4?z=>Km(z,v.asinh):v.distr==100?z=>v.fwd(z):z=>z;return z=>{let E=S(z),{_min:R,_max:H}=v,P=H-R;return(E-R)/P}}function ue(v){let S=G[v];if(S==null){let z=(n.scales||ku)[v]||ku;if(z.from!=null){ue(z.from);let E=an({},G[z.from],z,{key:v});E.valToPct=ye(E),G[v]=E}else{S=G[v]=an({},v==V?ex:M4,z),S.key=v;let E=S.time,R=S.range,H=Ys(R);if((v!=V||u==2&&!E)&&(H&&(R[0]==null||R[1]==null)&&(R={min:R[0]==null?g_:{mode:1,hard:R[0],soft:R[0]},max:R[1]==null?g_:{mode:1,hard:R[1],soft:R[1]}},H=!1),!H&&ld(R))){let P=R;R=(te,ie,ce)=>ie==null?oo:Kf(ie,ce,P)}S.range=Qe(R||(E?V4:v==V?S.distr==3?P4:S.distr==4?K4:cx:S.distr==3?fx:S.distr==4?dx:I4)),S.auto=Qe(H?!1:S.auto),S.clamp=Qe(S.clamp||A4),S._min=S._max=null,S.valToPct=ye(S)}}}ue("x"),ue("y"),u==1&&D.forEach(v=>{ue(v.scale)}),X.forEach(v=>{ue(v.scale)});for(let v in n.scales)ue(v);const J=G[V],we=J.distr;let he,Oe;J.ori==0?(Ci(g,nM),he=f,Oe=d):(Ci(g,iM),he=d,Oe=f);const fe={};for(let v in G){let S=G[v];(S.min!=null||S.max!=null)&&(fe[v]={min:S.min,max:S.max},S.min=S.max=null)}const Q=n.tzDate||(v=>new Date(dn(v/L))),W=n.fmtDate||og,xe=L==1?n4(Q):s4(Q),Me=O_(Q,E_(L==1?t4:r4,W)),Se=A_(Q,N_(l4,W)),Be=[],Re=l.legend=an({},c4,n.legend),be=l.cursor=an({},g4,{drag:{y:u==2}},n.cursor),M=Re.show,F=be.show,le=Re.markers;Re.idxs=Be,le.width=Qe(le.width),le.dash=Qe(le.dash),le.stroke=Qe(le.stroke),le.fill=Qe(le.fill);let re,$e,Ue,Ae=[],pe=[],Ne,Bt=!1,Li={};if(Re.live){const v=D[1]?D[1].values:null;Bt=v!=null,Ne=Bt?v(l,1,0):{_:0};for(let S in Ne)Li[S]=ng}if(M)if(re=vr("table",hM,g),Ue=vr("tbody",null,re),Re.mount(l,re),Bt){$e=vr("thead",null,re,Ue);let v=vr("tr",null,$e);vr("th",null,v);for(var bi in Ne)vr("th",i_,v).textContent=bi}else Ci(re,pM),Re.live&&Ci(re,mM);const En={show:!0},Ut={show:!1};function tt(v,S){if(S==0&&(Bt||!Re.live||u==2))return oo;let z=[],E=vr("tr",gM,Ue,Ue.childNodes[S]);Ci(E,v.class),v.show||Ci(E,Ya);let R=vr("th",null,E);if(le.show){let te=Ji(vM,R);if(S>0){let ie=le.width(l,S);ie&&(te.style.border=ie+"px "+le.dash(l,S)+" "+le.stroke(l,S)),te.style.background=le.fill(l,S)}}let H=Ji(i_,R);v.label instanceof HTMLElement?H.appendChild(v.label):H.textContent=v.label,S>0&&(le.show||(H.style.color=v.width>0?le.stroke(l,S):le.fill(l,S)),Gt("click",R,te=>{if(be._lock)return;Ft(te);let ie=D.indexOf(v);if((te.ctrlKey||te.metaKey)!=Re.isolate){let ce=D.some((de,ge)=>ge>0&&ge!=ie&&de.show);D.forEach((de,ge)=>{ge>0&&Ln(ge,ce?ge==ie?En:Ut:En,!0,$t.setSeries)})}else Ln(ie,{show:!v.show},!0,$t.setSeries)},!1),ps&&Gt(l_,R,te=>{be._lock||(Ft(te),Ln(D.indexOf(v),lr,!0,$t.setSeries))},!1));for(var P in Ne){let te=vr("td",yM,E);te.textContent="--",z.push(te)}return[E,z]}const vn=new Map;function Gt(v,S,z,E=!0){const R=vn.get(S)||{},H=be.bind[v](l,S,z,E);H&&(Xa(v,S,R[v]=H),vn.set(S,R))}function Kn(v,S,z){const E=vn.get(S)||{};for(let R in E)(v==null||R==v)&&(pp(R,S,E[R]),delete E[R]);v==null&&vn.delete(S)}let li=0,H)DELIM" +R"DELIM(i=0,Ce=0,me=0,nt=0,Zt=0,qr=nt,Zn=Zt,oi=Ce,nr=me,Gn=0,Yn=0,yn=0,Fn=0;l.bbox={};let ia=!1,il=!1,ms=!1,Yt=!1,rl=!1,Qn=!1;function sl(v,S,z){(z||v!=l.width||S!=l.height)&&ra(v,S),$n(!1),ms=!0,il=!0,Gr()}function ra(v,S){l.width=li=Ce=v,l.height=Hi=me=S,nt=Zt=0,md(),sa();let z=l.bbox;Gn=z.left=Ka(nt*rt,.5),Yn=z.top=Ka(Zt*rt,.5),yn=z.width=Ka(Ce*rt,.5),Fn=z.height=Ka(me*rt,.5)}const dd=3;function Vu(){let v=!1,S=0;for(;!v;){S++;let z=Pu(S),E=fl(S);v=S==dd||z&&E,v||(ra(l.width,l.height),il=!0)}}function hd({width:v,height:S}){sl(v,S)}l.setSize=hd;function md(){let v=!1,S=!1,z=!1,E=!1;X.forEach((R,H)=>{if(R.show&&R._show){let{side:P,_size:te}=R,ie=P%2,ce=R.label!=null?R.labelSize:0,de=te+ce;de>0&&(ie?(Ce-=de,P==3?(nt+=de,E=!0):z=!0):(me-=de,P==0?(Zt+=de,v=!0):S=!0))}}),xr[0]=v,xr[1]=z,xr[2]=S,xr[3]=E,Ce-=ci[1]+ci[3],nt+=ci[3],me-=ci[2]+ci[0],Zt+=ci[0]}function sa(){let v=nt+Ce,S=Zt+me,z=nt,E=Zt;function R(H,P){switch(H){case 1:return v+=P,v-P;case 2:return S+=P,S-P;case 3:return z-=P,z+P;case 0:return E-=P,E+P}}X.forEach((H,P)=>{if(H.show&&H._show){let te=H.side;H._pos=R(te,H._size),H.label!=null&&(H._lpos=R(te,H.labelSize))}})}if(be.dataIdx==null){let v=be.hover,S=v.skip=new Set(v.skip??[]);S.add(void 0);let z=v.prox=Qe(v.prox),E=v.bias??=0;be.dataIdx=(R,H,P,te)=>{if(H==0)return P;let ie=P,ce=z(R,H,P,te)??_t,de=ce>=0&&ce<_t,ge=J.ori==0?Ce:me,De=be.left,Ie=i[0],Je=i[H];if(S.has(Je[P])){ie=null;let qe=null,je=null,ze;if(E==0||E==-1)for(ze=P;qe==null&&ze-- >0;)S.has(Je[ze])||(qe=ze);if(E==0||E==1)for(ze=P;je==null&&ze++ce&&(ie=null);return ie}}const Ft=v=>{be.event=v};be.idxs=Be,be._lock=!1;let Tt=be.points;Tt.show=Qe(Tt.show),Tt.size=Qe(Tt.size),Tt.stroke=Qe(Tt.stroke),Tt.width=Qe(Tt.width),Tt.fill=Qe(Tt.fill);const Nt=l.focus=an({},n.focus||{alpha:.3},be.focus),ps=Nt.prox>=0,gs=ps&&Tt.one;let ui=[],ir=[],rr=[];function aa(v,S){let z=Tt.show(l,S);if(z instanceof HTMLElement)return Ci(z,dM),Ci(z,v.class),Lr(z,-10,-10,Ce,me),T.insertBefore(z,ui[S]),z}function Sr(v,S){if(u==1||S>0){let z=u==1&&G[v.scale].time,E=v.value;v.value=z?x_(E)?A_(Q,N_(E,W)):E||Se:E||E4,v.label=v.label||(z?y4:v4)}if(gs||S>0){v.width=v.width==null?1:v.width,v.paths=v.paths||H4||MM,v.fillTo=Qe(v.fillTo||j4),v.pxAlign=+et(v.pxAlign,A),v.pxRound=$_(v.pxAlign),v.stroke=Qe(v.stroke||null),v.fill=Qe(v.fill||null),v._stroke=v._fill=v._paths=v._focus=null;let z=O4(ai(1,v.width),1),E=v.points=an({},{size:z,width:ai(1,z*.2),stroke:v.stroke,space:z*2,paths:B4,_stroke:null,_fill:null},v.points);E.show=Qe(E.show),E.filter=Qe(E.filter),E.fill=Qe(E.fill),E.stroke=Qe(E.stroke),E.paths=Qe(E.paths),E.pxAlign=v.pxAlign}if(M){let z=tt(v,S);Ae.splice(S,0,z[0]),pe.splice(S,0,z[1]),Re.values.push(null)}if(F){Be.splice(S,0,null);let z=null;gs?S==0&&(z=aa(v,S)):S>0&&(z=aa(v,S)),ui.splice(S,0,z),ir.splice(S,0,0),rr.splice(S,0,0)}en("addSeries",S)}function al(v,S){S=S??D.length,v=u==1?Sp(v,S,j_,U_):Sp(v,S,{},D_),D.splice(S,0,v),Sr(D[S],S)}l.addSeries=al;function la(v){if(D.splice(v,1),M){Re.values.splice(v,1),pe.splice(v,1);let S=Ae.splice(v,1)[0];Kn(null,S.firstChild),S.remove()}F&&(Be.splice(v,1),ui.splice(v,1)[0].remove(),ir.splice(v,1),rr.splice(v,1)),en("delSeries",v)}l.delSeries=la;const xr=[!1,!1,!1,!1];function pd(v,S){if(v._show=v.show,v.show){let z=v.side%2,E=G[v.scale];E==null&&(v.scale=z?D[1].scale:V,E=G[v.scale]);let R=E.time;v.size=Qe(v.size),v.space=Qe(v.space),v.rotate=Qe(v.rotate),Ys(v.incrs)&&v.incrs.forEach(P=>{!ea.has(P)&&ea.set(P,DS(P))}),v.incrs=Qe(v.incrs||(E.distr==2?XM:R?L==1?e4:i4:Ga)),v.splits=Qe(v.splits||(R&&E.distr==1?xe:E.distr==3?vp:E.distr==4?S4:_4)),v.stroke=Qe(v.stroke),v.grid.stroke=Qe(v.grid.stroke),v.ticks.stroke=Qe(v.ticks.stroke),v.border.stroke=Qe(v.border.stroke);let H=v.values;v.values=Ys(H)&&!Ys(H[0])?Qe(H):R?Ys(H)?O_(Q,E_(H,W)):x_(H)?a4(Q,H):H||Me:H||b4,v.filter=Qe(v.filter||(E.distr>=3&&E.log==10?z4:E.distr==3&&E.log==2?T4:RS)),v.font=q_(v.font),v.labelFont=q_(v.labelFont),v._size=v.size(l,null,S,0),v._space=v._rotate=v._incrs=v._found=v._splits=v._values=null,v._size>0&&(xr[S]=!0,v._el=Ji(oM,w))}}function vs(v,S,z,E){let[R,H,P,te]=z,ie=S%2,ce=0;return ie==0&&(te||H)&&(ce=S==0&&!R||S==2&&!P?dn(M_.size/3):0),ie==1&&(R||P)&&(ce=S==1&&!H||S==3&&!te?dn(R_.size/2):0),ce}const ll=l.padding=(n.padding||[vs,vs,vs,vs]).map(v=>Qe(et(v,vs))),ci=l._padding=ll.map((v,S)=>v(l,S,xr,0));let un,Qt=null,Jt=null;const oa=u==1?D[0].idxs:null;let Jn=null,Vr=!1;function yo(v,S){if(i=v??[],l.data=l._data=i,u==2){un=0;for(let z=1;z=0,Qn=!0,Gr()}}l.setData=yo;function ol(){Vr=!0;let v,S;u==1&&(un>0?(Qt=oa[0]=0,Jt=oa[1]=un-1,v=i[0][Qt],S=i[0][Jt],we==2?(v=Qt,S=Jt):v==S&&(we==3?[v,S]=sd(v,v,J.log,!1):we==4?[v,S]=rg(v,v,J.log,!1):J.time?S=v+dn(86400/L):[v,S]=Kf(v,S,sg,!0))):(Qt=oa[0]=v=null,Jt=oa[1]=S=null)),sr(V,v,S)}let fi,At,bn,wr,ul,bo,_o,cl,Ir,cn;function ua(v,S,z,E,R,H){v??=s_,z??=lg,E??="butt",R??=s_,H??="round",v!=fi&&(y.strokeStyle=fi=v),R!=At&&(y.fillStyle=At=R),S!=bn&&(y.lineWidth=bn=S),H!=ul&&(y.lineJoin=ul=H),E!=bo&&(y.lineCap=bo=E),z!=wr&&y.setLineDash(wr=z)}function zr(v,S,z,E){S!=At&&(y.fillStyle=At=S),v!=_o&&(y.font=_o=v),z!=cl&&(y.textAlign=cl=z),E!=Ir&&(y.textBaseline=Ir=E)}function Tr(v,S,z,E,R=0){if(E.length>0&&v.auto(l,Vr)&&(S==null||S.min==null)){let H=et(Qt,0),P=et(Jt,E.length-1),te=z.min==null?zM(E,H,P,R,v.distr==3):[z.min,z.max];v.min=br(v.min,z.min=te[0]),v.max=ai(v.max,z.max=te[1])}}const ys={min:null,max:null};function bs(){for(let E in G){let R=G[E];fe[E]==null&&(R.min==null||fe[V]!=null&&R.auto(l,Vr))&&(fe[E]=ys)}for(let E in G){let R=G[E];fe[E]==null&&R.from!=null&&fe[R.from]!=null&&(fe[E]=ys)}fe[V]!=null&&$n(!0);let v={};for(let E in fe){let R=fe[E];if(R!=null){let H=v[E]=uo(G[E],RM);if(R.min!=null)an(H,R);else if(E!=V||u==2)if(un==0&&H.from==null){let P=H.range(l,null,null,E);H.min=P[0],H.max=P[1]}else H.min=_t,H.max=-_t}}if(un>0){D.forEach((E,R)=>{if(u==1){let H=E.scale,P=fe[H];if(P==null)return;let te=v[H];if(R==0){let ie=te.range(l,te.min,te.max,H);te.min=ie[0],te.max=ie[1],Qt=yr(te.min,i[0]),Jt=yr(te.max,i[0]),Jt-Qt>1&&(i[0][Qt]te.max&&Jt--),E.min=Jn[Qt],E.max=Jn[Jt]}else E.show&&E.auto&&Tr(te,P,E,i[R],E.sorted);E.idxs[0]=Qt,E.idxs[1]=Jt}else if(R>0&&E.show&&E.auto){let[H,P]=E.facets,te=H.scale,ie=P.scale,[ce,de]=i[R],ge=v[te],De=v[ie];ge!=null&&Tr(ge,fe[te],H,ce,H.sorted),De!=null&&Tr(De,fe[ie],P,de,P.sorted),E.min=P.min,E.max=P.max}});for(let E in v){let R=v[E],H=fe[E];if(R.from==null&&(H==null||H.min==null)){let P=R.range(l,R.min==_t?null:R.min,R.max==-_t?null:R.max,E);R.min=P[0],R.max=P[1]}}}for(let E in v){let R=v[E];if(R.from!=null){let H=v[R.from];if(H.min==null)R.min=R.max=null;else{let P=R.range(l,H.min,H.max,E);R.min=P[0],R.max=P[1]}}}let S={},z=!1;for(let E in v){let R=v[E],H=G[E];if(H.min!=R.min||H.max!=R.max){H.min=R.min,H.max=R.max;let P=H.distr;H._min=P==3?fs(H.min):P==4?Km(H.min,H.asinh):P==100?H.fwd(H.min):H.min,H._max=P==3?fs(H.max):P==4?Km(H.max,H.asinh):P==100?H.fwd(H.max):H.max,S[E]=z=!0}}if(z){D.forEach((E,R)=>{u==2?R>0&&S.y&&(E._paths=null):S[E.scale]&&(E._paths=null)});for(let E in S)ms=!0,en("setScale",E);F&&be.left>=0&&(Yt=Qn=!0)}for(let E in fe)fe[E]=null}function Wt(v){let S=gp(Qt-1,0,un-1),z=gp(Jt+1,0,un-1);for(;v[S]==null&&S>0;)S--;for(;v[z]==null&&z0){let v=D.some(S=>S._focus)&&cn!=Nt.alpha;v&&(y.globalAlpha=cn=Nt.alpha),D.forEach((S,z)=>{if(z>0&&S.show&&(So(z,!1),So(z,!0),S._paths==null)){let E=cn;cn!=S.a)DELIM" +R"DELIM(lpha&&(y.globalAlpha=cn=S.alpha);let R=u==2?[0,i[z][0].length-1]:Wt(i[z]);S._paths=S.paths(l,z,R[0],R[1]),cn!=E&&(y.globalAlpha=cn=E)}}),D.forEach((S,z)=>{if(z>0&&S.show){let E=cn;cn!=S.alpha&&(y.globalAlpha=cn=S.alpha),S._paths!=null&&xo(z,!1);{let R=S._paths!=null?S._paths.gaps:null,H=S.points.show(l,z,Qt,Jt,R),P=S.points.filter(l,z,H,R);(H||P)&&(S.points._paths=S.points.paths(l,z,Qt,Jt,P),xo(z,!0))}cn!=E&&(y.globalAlpha=cn=E),en("drawSeries",z)}}),v&&(y.globalAlpha=cn=1)}}function So(v,S){let z=S?D[v].points:D[v];z._stroke=z.stroke(l,v),z._fill=z.fill(l,v)}function xo(v,S){let z=S?D[v].points:D[v],{stroke:E,fill:R,clip:H,flags:P,_stroke:te=z._stroke,_fill:ie=z._fill,_width:ce=z.width}=z._paths;ce=St(ce*rt,3);let de=null,ge=ce%2/2;S&&ie==null&&(ie=ce>0?"#fff":te);let De=z.pxAlign==1&&ge>0;if(De&&y.translate(ge,ge),!S){let Ie=Gn-ce/2,Je=Yn-ce/2,qe=yn+ce,je=Fn+ce;de=new Path2D,de.rect(Ie,Je,qe,je)}S?wo(te,ce,z.dash,z.cap,ie,E,R,P,H):Pr(v,te,ce,z.dash,z.cap,ie,E,R,P,de,H),De&&y.translate(-ge,-ge)}function Pr(v,S,z,E,R,H,P,te,ie,ce,de){let ge=!1;ie!=0&&ee.forEach((De,Ie)=>{if(De.series[0]==v){let Je=D[De.series[1]],qe=i[De.series[1]],je=(Je._paths||ku).band;Ys(je)&&(je=De.dir==1?je[0]:je[1]);let ze,mt=null;Je.show&&je&&EM(qe,Qt,Jt)?(mt=De.fill(l,Ie)||H,ze=Je._paths.clip):je=null,wo(S,z,E,R,mt,P,te,ie,ce,de,ze,je),ge=!0}}),ge||wo(S,z,E,R,H,P,te,ie,ce,de)}const Kr=co|bp;function wo(v,S,z,E,R,H,P,te,ie,ce,de,ge){ua(v,S,z,E,R),(ie||ce||ge)&&(y.save(),ie&&y.clip(ie),ce&&y.clip(ce)),ge?(te&Kr)==Kr?(y.clip(ge),de&&y.clip(de),fa(R,P),ca(v,H,S)):te&bp?(fa(R,P),y.clip(ge),ca(v,H,S)):te&co&&(y.save(),y.clip(ge),de&&y.clip(de),fa(R,P),y.restore(),ca(v,H,S)):(fa(R,P),ca(v,H,S)),(ie||ce||ge)&&y.restore()}function ca(v,S,z){z>0&&(S instanceof Map?S.forEach((E,R)=>{y.strokeStyle=fi=R,y.stroke(E)}):S!=null&&v&&y.stroke(S))}function fa(v,S){S instanceof Map?S.forEach((z,E)=>{y.fillStyle=At=E,y.fill(z)}):S!=null&&v&&y.fill(S)}function gd(v,S,z,E){let R=X[v],H;if(E<=0)H=[0,0];else{let P=R._space=R.space(l,v,S,z,E),te=R._incrs=R.incrs(l,v,S,z,E,P);H=G4(S,z,te,E,P)}return R._found=H}function Ge(v,S,z,E,R,H,P,te,ie,ce){let de=P%2/2;A==1&&y.translate(de,de),ua(te,P,ie,ce,te),y.beginPath();let ge,De,Ie,Je,qe=R+(E==0||E==3?-H:H);z==0?(De=R,Je=qe):(ge=R,Ie=qe);for(let je=0;je{if(!z.show)return;let R=G[z.scale];if(R.min==null){z._show&&(S=!1,z._show=!1,$n(!1));return}else z._show||(S=!1,z._show=!0,$n(!1));let H=z.side,P=H%2,{min:te,max:ie}=R,[ce,de]=gd(E,te,ie,P==0?Ce:me);if(de==0)return;let ge=R.distr==2,De=z._splits=z.splits(l,E,te,ie,ce,de,ge),Ie=R.distr==2?De.map(ze=>Jn[ze]):De,Je=R.distr==2?Jn[De[1]]-Jn[De[0]]:ce,qe=z._values=z.values(l,z.filter(l,Ie,E,de,Je),E,de,Je);z._rotate=H==2?z.rotate(l,qe,E,de):0;let je=z._size;z._size=Xi(z.size(l,qe,E,v)),je!=null&&z._size!=je&&(S=!1)}),S}function fl(v){let S=!0;return ll.forEach((z,E)=>{let R=z(l,E,xr,v);R!=ci[E]&&(S=!1),ci[E]=R}),S}function dl(){for(let v=0;vJn[Nn]):Ie,qe=de.distr==2?Jn[Ie[1]]-Jn[Ie[0]]:ie,je=S.ticks,ze=S.border,mt=je.show?je.size:0,pt=dn(mt*rt),Mt=dn((S.alignTo==2?S._size-mt-S.gap:S.gap)*rt),st=S._rotate*-kf/180,yt=k(S._pos*rt),Hn=(pt+Mt)*te,Sn=yt+Hn;H=E==0?Sn:0,R=E==1?Sn:0;let Bn=S.font[0],Wn=S.align==1?Xl:S.align==2?Vm:st>0?Xl:st<0?Vm:E==0?"center":z==3?Vm:Xl,Ei=st||E==1?"middle":z==2?yu:r_;zr(Bn,P,Wn,Ei);let qn=S.font[1]*S.lineGap,ei=Ie.map(Nn=>k(m(Nn,de,ge,De))),Oi=S._values;for(let Nn=0;Nn{z>0&&(S._paths=null,v&&(u==1?(S.min=null,S.max=null):S.facets.forEach(E=>{E.min=null,E.max=null})))})}let _n=!1,hl=!1,da=[];function zo(){hl=!1;for(let v=0;v0&&queueMicrotask(zo)}l.batch=vd;function Xn(){if(ia&&(bs(),ia=!1),ms&&(Vu(),ms=!1),il){if(Et(O,Xl,nt),Et(O,yu,Zt),Et(O,zu,Ce),Et(O,Tu,me),Et(T,Xl,nt),Et(T,yu,Zt),Et(T,zu,Ce),Et(T,Tu,me),Et(w,zu,li),Et(w,Tu,Hi),b.width=dn(li*rt),b.height=dn(Hi*rt),X.forEach(({_el:v,_show:S,_size:z,_pos:E,side:R})=>{if(v!=null)if(S){let H=R===3||R===0?z:0,P=R%2==1;Et(v,P?"left":"top",E-H),Et(v,P?"width":"height",z),Et(v,P?"top":"left",P?Zt:nt),Et(v,P?"height":"width",P?me:Ce),mp(v,Ya)}else Ci(v,Ya)}),fi=At=bn=ul=bo=_o=cl=Ir=wr=null,cn=1,Sa(!0),nt!=qr||Zt!=Zn||Ce!=oi||me!=nr){$n(!1);let v=Ce/oi,S=me/nr;if(F&&!Yt&&be.left>=0){be.left*=v,be.top*=S,_i&&Lr(_i,dn(be.left),0,Ce,me),Yr&&Lr(Yr,0,dn(be.top),Ce,me);for(let z=0;z=0&&We.width>0){We.left*=v,We.width*=v,We.top*=S,We.height*=S;for(let z in xa)Et(xi,z,We[z])}qr=nt,Zn=Zt,oi=Ce,nr=me}en("setSize"),il=!1}li>0&&Hi>0&&(y.clearRect(0,0,b.width,b.height),en("drawClear"),ae.forEach(v=>v()),en("draw")),We.show&&rl&&(pa(We),rl=!1),F&&Yt&&(Bi(null,!0,!1),Yt=!1),Re.show&&Re.live&&Qn&&(ba(),Qn=!1),p||(p=!0,l.status=1,en("ready")),Vr=!1,_n=!1}l.redraw=(v,S)=>{ms=S||!1,v!==!1?sr(V,J.min,J.max):Gr()};function ha(v,S){let z=G[v];if(z.from==null){if(un==0){let E=z.range(l,S.min,S.max,v);S.min=E[0],S.max=E[1]}if(S.min>S.max){let E=S.min;S.min=S.max,S.max=E}if(un>1&&S.min!=null&&S.max!=null&&S.max-S.min<1e-16)return;v==V&&z.distr==2&&un>0&&(S.min=yr(S.min,i[0]),S.max=yr(S.max,i[0]),S.min==S.max&&S.max++),fe[v]=S,ia=!0,Gr()}}l.setScale=ha;let ml,ma,_i,Yr,To,Fr,_s,Qr,Eo,pl,vt,xt,Si=!1;const ht=be.drag;let qt=ht.x,Vt=ht.y;F&&(be.x&&(ml=Ji(cM,T)),be.y&&(ma=Ji(fM,T)),J.ori==0?(_i=ml,Yr=ma):(_i=ma,Yr=ml),vt=be.left,xt=be.top);const We=l.select=an({show:!0,over:!0,left:0,width:0,top:0,height:0},n.select),xi=We.show?Ji(uM,We.over?T:O):null;function pa(v,S){if(We.show){for(let z in v)We[z]=v[z],z in xa&&Et(xi,z,v[z]);S!==!1&&en("setSelect")}}l.setSelect=pa;function Oo(v){if(D[v].show)M&&mp(Ae[v],Ya);else if(M&&Ci(Ae[v],Ya),F){let z=gs?ui[0]:ui[v];z!=null&&Lr(z,-10,-10,Ce,me)}}function sr(v,S,z){ha(v,{min:S,max:z})}function Ln(v,S,z,E){S.focus!=null&&gl(v),S.show!=null&&D.forEach((R,H)=>{H>0&&(v==H||v==null)&&(R.show=S.show,Oo(H),u==2?(sr(R.facets[0].scale,null,null),sr(R.facets[1].scale,null,null)):sr(R.scale,null,null),Gr())}),z!==!1&&en("setSeries",v,S),E&&wa("setSeries",l,v,S)}l.setSeries=Ln;function ar(v,S){an(ee[v],S)}function No(v,S){v.fill=Qe(v.fill||null),v.dir=et(v.dir,-1),S=S??ee.length,ee.splice(S,0,v)}function ga(v){v==null?ee.length=0:ee.splice(v,1)}l.addBand=No,l.setBand=ar,l.delBand=ga;function Er(v,S){D[v].alpha=S,F&&ui[v]!=null&&(ui[v].style.opacity=S),M&&Ae[v]&&(Ae[v].style.opacity=S)}let wi,zi,Or;const lr={focus:!0};function gl(v){if(v!=Or){let S=v==null,z=Nt.alpha!=1;D.forEach((E,R)=>{if(u==1||R>0){let H=S||R==0||R==v;E._focus=S?null:H,z&&Er(R,H?1:Nt.alpha)}}),Or=v,z&&Gr()}}M)DELIM" +R"DELIM(&&ps&&Gt(o_,re,v=>{be._lock||(Ft(v),Or!=null&&Ln(null,lr,!0,$t.setSeries))});function Ti(v,S,z){let E=G[S];z&&(v=v/rt-(E.ori==1?Zt:nt));let R=Ce;E.ori==1&&(R=me,v=R-v),E.dir==-1&&(v=R-v);let H=E._min,P=E._max,te=v/R,ie=H+(P-H)*te,ce=E.distr;return ce==3?lo(10,ie):ce==4?NM(ie,E.asinh):ce==100?E.bwd(ie):ie}function On(v,S){let z=Ti(v,V,S);return yr(z,i[0],Qt,Jt)}l.valToIdx=v=>yr(v,i[0]),l.posToIdx=On,l.posToVal=Ti,l.valToPos=(v,S,z)=>G[S].ori==0?f(v,G[S],z?yn:Ce,z?Gn:0):d(v,G[S],z?Fn:me,z?Yn:0),l.setCursor=(v,S,z)=>{vt=v.left,xt=v.top,Bi(null,S,z)};function or(v,S){Et(xi,Xl,We.left=v),Et(xi,zu,We.width=S)}function va(v,S){Et(xi,yu,We.top=v),Et(xi,Tu,We.height=S)}let ur=J.ori==0?or:va,ya=J.ori==1?or:va;function Ao(){if(M&&Re.live)for(let v=u==2?1:0;v{Be[E]=z}):kM(v.idx)||Be.fill(v.idx),Re.idx=Be[0]),M&&Re.live){for(let z=0;z0||u==1&&!Bt)&&_a(z,Be[z]);Ao()}Qn=!1,S!==!1&&en("setLegend")}l.setLegend=ba;function _a(v,S){let z=D[v],E=v==0&&we==2?Jn:i[v],R;Bt?R=z.values(l,v,S)??Li:(R=z.value(l,S==null?null:E[S],v,S),R=R==null?Li:{_:R}),Re.values[v]=R}function Bi(v,S,z){Eo=vt,pl=xt,[vt,xt]=be.move(l,vt,xt),be.left=vt,be.top=xt,F&&(_i&&Lr(_i,dn(vt),0,Ce,me),Yr&&Lr(Yr,0,dn(xt),Ce,me));let E,R=Qt>Jt;wi=_t,zi=null;let H=J.ori==0?Ce:me,P=J.ori==1?Ce:me;if(vt<0||un==0||R){E=be.idx=null;for(let te=0;te0&&mt.show){let Hn=st==null?-10:st==E?ce:he(u==1?i[0][st]:i[ze][0][st],J,H,0),Sn=yt==null?-10:Oe(yt,u==1?G[mt.scale]:G[mt.facets[1].scale],P,0);if(ps&&yt!=null){let Bn=J.ori==1?vt:xt,Wn=mn(Nt.dist(l,ze,st,Sn,Bn));if(Wn=0?1:-1,Oi=qn>=0?1:-1;Oi==ei&&(Oi==1?Ei==1?yt>=qn:yt<=qn:Ei==1?yt<=qn:yt>=qn)&&(wi=Wn,zi=ze)}else wi=Wn,zi=ze}}if(Qn||gs){let Bn,Wn;J.ori==0?(Bn=Hn,Wn=Sn):(Bn=Sn,Wn=Hn);let Ei,qn,ei,Oi,qi,Nn,ti=!0,Jr=Tt.bbox;if(Jr!=null){ti=!1;let ut=Jr(l,ze);ei=ut.left,Oi=ut.top,Ei=ut.width,qn=ut.height}else ei=Bn,Oi=Wn,Ei=qn=Tt.size(l,ze);if(Nn=Tt.fill(l,ze),qi=Tt.stroke(l,ze),gs)ze==zi&&wi<=Nt.prox&&(de=ei,ge=Oi,De=Ei,Ie=qn,Je=ti,qe=Nn,je=qi);else{let ut=ui[ze];ut!=null&&(ir[ze]=ei,rr[ze]=Oi,p_(ut,Ei,qn,ti),h_(ut,Nn,qi),Lr(ut,Xi(ei),Xi(Oi),Ce,me))}}}}if(gs){let ze=Nt.prox,mt=Or==null?wi<=ze:wi>ze||zi!=Or;if(Qn||mt){let pt=ui[0];pt!=null&&(ir[0]=de,rr[0]=ge,p_(pt,De,Ie,Je),h_(pt,qe,je),Lr(pt,Xi(de),Xi(ge),Ce,me))}}}if(We.show&&Si)if(v!=null){let[te,ie]=$t.scales,[ce,de]=$t.match,[ge,De]=v.cursor.sync.scales,Ie=v.cursor.drag;if(qt=Ie._x,Vt=Ie._y,qt||Vt){let{left:Je,top:qe,width:je,height:ze}=v.select,mt=v.scales[ge].ori,pt=v.posToVal,Mt,st,yt,Hn,Sn,Bn=te!=null&&ce(te,ge),Wn=ie!=null&&de(ie,De);Bn&&qt?(mt==0?(Mt=Je,st=je):(Mt=qe,st=ze),yt=G[te],Hn=he(pt(Mt,ge),yt,H,0),Sn=he(pt(Mt+st,ge),yt,H,0),ur(br(Hn,Sn),mn(Sn-Hn))):ur(0,H),Wn&&Vt?(mt==1?(Mt=Je,st=je):(Mt=qe,st=ze),yt=G[ie],Hn=Oe(pt(Mt,De),yt,P,0),Sn=Oe(pt(Mt+st,De),yt,P,0),ya(br(Hn,Sn),mn(Sn-Hn))):ya(0,P)}else jo()}else{let te=mn(Eo-To),ie=mn(pl-Fr);if(J.ori==1){let De=te;te=ie,ie=De}qt=ht.x&&te>=ht.dist,Vt=ht.y&&ie>=ht.dist;let ce=ht.uni;ce!=null?qt&&Vt&&(qt=te>=ce,Vt=ie>=ce,!qt&&!Vt&&(ie>te?Vt=!0:qt=!0)):ht.x&&ht.y&&(qt||Vt)&&(qt=Vt=!0);let de,ge;qt&&(J.ori==0?(de=_s,ge=vt):(de=Qr,ge=xt),ur(br(de,ge),mn(ge-de)),Vt||ya(0,P)),Vt&&(J.ori==1?(de=_s,ge=vt):(de=Qr,ge=xt),ya(br(de,ge),mn(ge-de)),qt||ur(0,H)),!qt&&!Vt&&(ur(0,0),ya(0,0))}if(ht._x=qt,ht._y=Vt,v==null){if(z){if(tc!=null){let[te,ie]=$t.scales;$t.values[0]=te!=null?Ti(J.ori==0?vt:xt,te):null,$t.values[1]=ie!=null?Ti(J.ori==1?vt:xt,ie):null}wa(Im,l,vt,xt,Ce,me,E)}if(ps){let te=z&&$t.setSeries,ie=Nt.prox;Or==null?wi<=ie&&Ln(zi,lr,!0,te):wi>ie?Ln(null,lr,!0,te):zi!=Or&&Ln(zi,lr,!0,te)}}Qn&&(Re.idx=E,ba()),S!==!1&&en("setCursor")}let cr=null;Object.defineProperty(l,"rect",{get(){return cr==null&&Sa(!1),cr}});function Sa(v=!1){v?cr=null:(cr=T.getBoundingClientRect(),en("syncRect",cr))}function Ku(v,S,z,E,R,H,P){be._lock||Si&&v!=null&&v.movementX==0&&v.movementY==0||(Mo(v,S,z,E,R,H,P,!1,v!=null),v!=null?Bi(null,!0,!0):Bi(S,!0,!1))}function Mo(v,S,z,E,R,H,P,te,ie){if(cr==null&&Sa(!1),Ft(v),v!=null)z=v.clientX-cr.left,E=v.clientY-cr.top;else{if(z<0||E<0){vt=-10,xt=-10;return}let[ce,de]=$t.scales,ge=S.cursor.sync,[De,Ie]=ge.values,[Je,qe]=ge.scales,[je,ze]=$t.match,mt=S.axes[0].side%2==1,pt=J.ori==0?Ce:me,Mt=J.ori==1?Ce:me,st=mt?H:R,yt=mt?R:H,Hn=mt?E:z,Sn=mt?z:E;if(Je!=null?z=je(ce,Je)?m(De,G[ce],pt,0):-10:z=pt*(Hn/st),qe!=null?E=ze(de,qe)?m(Ie,G[de],Mt,0):-10:E=Mt*(Sn/yt),J.ori==1){let Bn=z;z=E,E=Bn}}ie&&(S==null||S.cursor.event.type==Im)&&((z<=1||z>=Ce-1)&&(z=Ka(z,Ce)),(E<=1||E>=me-1)&&(E=Ka(E,me))),te?(To=z,Fr=E,[_s,Qr]=be.move(l,z,E)):(vt=z,xt=E)}const xa={width:0,height:0,left:0,top:0};function jo(){pa(xa,!1)}let Gu,Yu,Fu,Qu;function ko(v,S,z,E,R,H,P){Si=!0,qt=Vt=ht._x=ht._y=!1,Mo(v,S,z,E,R,H,P,!0,!1),v!=null&&(Gt(Pm,dp,Ju,!1),wa(a_,l,_s,Qr,Ce,me,null));let{left:te,top:ie,width:ce,height:de}=We;Gu=te,Yu=ie,Fu=ce,Qu=de}function Ju(v,S,z,E,R,H,P){Si=ht._x=ht._y=!1,Mo(v,S,z,E,R,H,P,!1,!0);let{left:te,top:ie,width:ce,height:de}=We,ge=ce>0||de>0,De=Gu!=te||Yu!=ie||Fu!=ce||Qu!=de;if(ge&&De&&pa(We),ht.setScale&&ge&&De){let Ie=te,Je=ce,qe=ie,je=de;if(J.ori==1&&(Ie=ie,Je=de,qe=te,je=ce),qt&&sr(V,Ti(Ie,V),Ti(Ie+Je,V)),Vt)for(let ze in G){let mt=G[ze];ze!=V&&mt.from==null&&mt.min!=_t&&sr(ze,Ti(qe+je,ze),Ti(qe,ze))}jo()}else be.lock&&(be._lock=!be._lock,Bi(S,!0,v!=null));v!=null&&(Kn(Pm,dp),wa(Pm,l,vt,xt,Ce,me,null))}function yd(v,S,z,E,R,H,P){if(be._lock)return;Ft(v);let te=Si;if(Si){let ie=!0,ce=!0,de=10,ge,De;J.ori==0?(ge=qt,De=Vt):(ge=Vt,De=qt),ge&&De&&(ie=vt<=de||vt>=Ce-de,ce=xt<=de||xt>=me-de),ge&&ie&&(vt=vt<_s?0:Ce),De&&ce&&(xt=xt{let R=$t.match[2];z=R(l,S,z),z!=-1&&Ln(z,E,!0,!1)},F&&(Gt(a_,T,ko),Gt(Im,T,Ku),Gt(l_,T,v=>{Ft(v),Sa(!1)}),Gt(o_,T,yd),Gt(u_,T,Xu),_p.add(l),l.syncRect=Sa);const vl=l.hooks=n.hooks||{};function en(v,S,z){hl?da.push([v,S,z]):v in vl&&vl[v].forEach(E=>{E.call(null,l,S,z)})}(n.plugins||[]).forEach(v=>{for(let S in v.hooks)vl[S]=(vl[S]||[]).concat(v.hooks[S])});const ec=(v,S,z)=>z,$t=an({key:null,setSeries:!1,filters:{pub:__,sub:__},scales:[V,D[1]?D[1].scale:null],match:[S_,S_,ec],values:[null,null]},be.sync);$t.match.length==2&&$t.match.push(ec),be.sync=$t;const tc=$t.key,Ro=tx(tc);function wa(v,S,z,E,R,H,P){$t.filters.pub(v,S,z,E,R,H,P)&&Ro.pub(v,S,z,E,R,H,P)}Ro.sub(l);function bd(v,S,z,E,R,H,P){$t.filters.sub(v,S,z,E,R,H,P)&&Nr[v](null,S,z,E,R,H,P)}l.pub=bd;function _d(){Ro.unsub(l),_p.delete(l),vn.clear(),pp(Pf,no,Wu),g.remove(),re?.remove(),en("destroy")}l.destroy=_d;function Co(){en("init",n,i),yo(i||n.data,!1),fe[V]?ha(V,fe[V]):ol(),rl=We.show&&(We.width>0||We.height>0),Yt=Qn=!0,sl(n.width,n.height)}return D.forEach(Sr),X.forEach(pd),a?a instanceof HTMLElement?(a.appendChild(g),Co()):a(l,Co):Co(),l}on.assign=an;on.fmtNum=ag;on.rangeNum=Kf;on.rangeLog=sd;on.rangeAsinh=rg;on.orient=nl;on.pxRatio=rt;on.join=LM;on.fmtDate=og,on.tzDate=QM;on.sync=tx;{on.addGap=k4,on.clipGaps=od;let n=on.paths={points:lx};n.linear=ux,n.stepped=D4,n.bars=U4,n.spline=$4}const hx=(n,i,a,l,u)=>{if(!Number.isFi)DELIM" +R"DELIM(nite(a)||!Number.isFinite(l)||l<=a)return[];const f=[];if(Math.asinh(l)-Math.asinh(a)<1.5){const p=Number.isFinite(u)&&u>0?u:(l-a)/4,g=Math.ceil(a/p)*p;for(let b=0;b<100;b++){const y=Number((g+b*p).toPrecision(14));if(y>l)break;f.push({value:y,priority:y===0?0:1})}}else{const p=Math.ceil(Math.log10(Math.max(Math.abs(a),Math.abs(l))));for(let g=Math.min(-1,p-1);g<=p;g++)for(const b of[1,2,5]){const y=b*10**g;for(const w of[-y,y])Number.isFinite(w)&&w>=a&&w<=l&&f.push({value:w,priority:b===1?1:2})}a<=0&&l>=0&&f.push({value:0,priority:0})}f.sort((p,g)=>p.priority-g.priority||p.value-g.value);const d=[],m=[];for(const{value:p}of f){const g=n.valToPos(p,"y");Number.isFinite(g)&&m.every(b=>Math.abs(g-b)>=36)&&(d.push(p),m.push(g))}return d.sort((p,g)=>p-g),d};function mx(n,i){const a=Rt.indexOf(n.toLowerCase());return a===-1?n:i.getPropertyValue(`--chart-color-${String(a)}`).trim()||n}function F4(n){const i=n.filter(([,a])=>a>0).map(([a,l])=>({minimumRate:a,virtualSize:l}));return i.sort((a,l)=>a.minimumRate-l.minimumRate),i}const Q4=new Intl.NumberFormat(void 0,{maximumSignificantDigits:8}),J4=new Intl.NumberFormat(void 0,{maximumFractionDigits:0});function xp(n){return Q4.format(n)}function px(n){return`${J4.format(n)} vB`}function X4({snapshot:n,now:i,color:a,scale:l}){const u=se.useMemo(()=>F4(n?.data.histogram??[]),[n]),f=n!==null&&i-n.receivedAt>=Zu,d=n===null?"Waiting for transaction-pool fee data…":f?"Fee distribution is stale. Waiting for a fresh pool snapshot…":n.data.count===0?"The transaction pool is empty.":u.length===0?"No fee distribution is available for this pool snapshot.":null;return x.jsxs("div",{className:"space-y-3",children:[d?x.jsx("p",{role:"status",className:"text-textMuted flex min-h-72 items-center justify-center px-4 text-center text-sm",children:d}):x.jsxs(x.Fragment,{children:[x.jsx(W4,{bins:u,color:a,scale:l}),x.jsx("p",{className:"text-textMuted text-xs",children:"Each bar is a fee-rate group, labeled by its minimum rate. Bar height is virtual size, not transaction count. Groups are spaced evenly."}),x.jsxs("details",{className:"border-accentSecondary/20 rounded-md border text-xs",children:[x.jsxs("summary",{className:"text-textMuted hover:text-accent cursor-pointer px-3 py-2",children:["View ",pn(u.length)," fee-rate ",u.length===1?"group":"groups"]}),x.jsx("div",{className:"border-accentSecondary/20 max-h-56 overflow-auto border-t",children:x.jsxs("table",{className:"w-full text-left tabular-nums",children:[x.jsx("caption",{className:"sr-only",children:"Transaction-pool fee-rate groups"}),x.jsx("thead",{className:"bg-surface text-textMuted sticky top-0",children:x.jsxs("tr",{children:[x.jsx("th",{scope:"col",className:"px-3 py-2",children:"Minimum rate (sat/vB)"}),x.jsx("th",{scope:"col",className:"px-3 py-2 text-right",children:"Virtual size (vB)"})]})}),x.jsx("tbody",{className:"divide-accentSecondary/20 divide-y",children:u.map((m,p)=>x.jsxs("tr",{children:[x.jsx("td",{className:"px-3 py-2",children:xp(m.minimumRate)}),x.jsx("td",{className:"px-3 py-2 text-right",children:pn(m.virtualSize)})]},p))})]})})]})]}),n&&x.jsxs("p",{className:"text-textMuted text-xs",children:[f?"Last snapshot":"Snapshot"," ",Uu(n.receivedAt),!f&&` · ${pn(n.data.count)} transactions · ${px(n.data.virtual)}`]})]})}function W4({bins:n,color:i,scale:a}){const l=Rp(),u=se.useRef(null),f=se.useRef(null),d=se.useRef(n);return se.useLayoutEffect(()=>{d.current=n;const m=f.current;m&&(m.setData([n.map((p,g)=>g),n.map(p=>p.virtualSize)]),m.redraw(!1,!0))},[n]),se.useLayoutEffect(()=>{const m=u.current;if(!m)return;const p=getComputedStyle(m),g=mx(i,p),b=`12px ${p.fontFamily}`,y=[d.current.map((A,k)=>k),d.current.map(A=>A.virtualSize)],w={width:Math.max(240,m.clientWidth),height:280,padding:[12,12,0,0],cursor:{drag:{x:!1,y:!1}},legend:{show:!0,live:!0},scales:{x:{time:!1,range:()=>[-.5,d.current.length-.5]},y:{distr:a==="compressed"?4:1,asinh:1,range:(A,k,L)=>[0,Math.max(1,L*1.08)]}},axes:[{stroke:p.color,font:b,grid:{show:!1},ticks:{stroke:p.getPropertyValue("--chart-ticks").trim(),width:1},splits:A=>{const k=d.current,L=Math.max(1,Math.ceil(k.length/Math.max(1,Math.floor(A.width/80))));return k.map((D,X)=>X).filter(D=>D%L===0)},values:(A,k)=>k.map(L=>xp(d.current[L].minimumRate))},{size:76,stroke:p.color,font:b,grid:{stroke:p.getPropertyValue("--chart-grid").trim(),width:1},ticks:{stroke:p.getPropertyValue("--chart-ticks").trim(),width:1},values:(A,k)=>k.map(L=>pn(L)),...a==="compressed"?{splits:hx,filter:(A,k)=>k}:{}}],series:[{label:"Min rate",value:(A,k)=>{const L=k===null?void 0:d.current[k];return L?`${xp(L.minimumRate)} sat/vB`:"—"}},{label:"Virtual size",stroke:g,fill:`${g}90`,width:1,points:{show:!1},paths:on.paths.bars?.({size:[.85,48]}),value:(A,k)=>k===null?"—":px(k)}]},O=new on(w,y,m);f.current=O;const T=new ResizeObserver(A=>{const k=A[0]?.contentRect.width;k&&k>0&&O.setSize({width:Math.round(k),height:280})});return T.observe(m),()=>{T.disconnect(),O.destroy(),f.current=null}},[i,a,l]),x.jsxs("div",{role:"img","aria-label":"Transaction-pool fee distribution: virtual size in vbytes by minimum fee rate in satoshis per vbyte",children:[x.jsx("p",{className:"text-textMuted mb-2 text-xs",children:"Virtual size (vB)"}),x.jsx("div",{ref:u,className:"text-textMuted min-w-0 overflow-hidden"}),x.jsx("p",{className:"text-textMuted text-center text-xs",children:"Minimum fee rate per group (sat/vB)"})]})}function ej({data:n,series:i,height:a=280,emptyMessage:l="Waiting for live data…",valueSuffix:u="",zeroBased:f=!0,valueFormatter:d=rj,visualization:m="line",scale:p="linear",forceEmpty:g=!1}){const b=Rp(),y=se.useRef(null),w=se.useRef(null),O=se.useRef(!1),T=se.useRef(null),A=se.useMemo(()=>ij(n),[n]),k=se.useRef(A),L=!g&&n[0]?.length>0;return se.useLayoutEffect(()=>{k.current=A},[A]),se.useLayoutEffect(()=>{const D=y.current;if(!D)return;const X=getComputedStyle(D),G=`12px ${X.fontFamily}`,ee={width:Math.max(240,D.clientWidth),height:a,padding:[12,8,0,0],cursor:{drag:{x:!0,y:!1,setScale:!0},focus:{prox:24}},hooks:{setSelect:[ye=>{ye.select.width>0&&(O.current=!0)}]},legend:{show:!0,live:!0},scales:{x:{time:!0},y:{auto:!0,distr:p==="compressed"?4:1,asinh:1,...f?{range:(ye,ue,J)=>[Math.min(0,ue),J===0?1:J*1.08]}:{range:(ye,ue,J)=>{const we=J-ue,he=we===0?Math.max(1,Math.abs(J)*5e-4):we*.08;return[ue-he,J+he]}}}},axes:[{stroke:X.color,grid:{stroke:X.getPropertyValue("--chart-grid").trim(),width:1},ticks:{stroke:X.getPropertyValue("--chart-ticks").trim(),width:1},font:G},{size:72,stroke:X.color,grid:{stroke:X.getPropertyValue("--chart-grid").trim(),width:1},ticks:{stroke:X.getPropertyValue("--chart-ticks").trim(),width:1},font:G,values:(ye,ue)=>ue.map(J=>J===null?null:`${d(J)}${u}`),...p==="compressed"?{splits:hx,filter:(ye,ue)=>ue}:{}}],series:[{},...i.map((ye,ue)=>{const J=mx(ye.color,X),we=m==="step"?on.paths.stepped?.({align:1}):m==="bar"?tj(ue,i.length):void 0;return{label:ye.label,stroke:J,fill:m==="area"||m==="bar"?ye.fill??`${J}24`:ye.fill,width:ye.width??2,paths:we,points:{show:m==="line"?ye.points??!1:!1},value:(he,Oe)=>Oe===null?"—":`${d(Oe)}${u}`}})]},V=new on(ee,k.current,D),ne=T.current;ne&&V.setScale("x",ne),w.current=V;const ae=new ResizeObserver(ye=>{const ue=ye[0]?.contentRect.width;ue&&ue>0&&V.setSize({width:Math.round(ue),height:a})});return ae.observe(D),()=>{T.current=O.current&&V.scales.x.min!=null&&V.scales.x.max!=null?{min:V.scales.x.min,max:V.scales.x.max}:null,ae.disconnect(),V.destroy(),w.current=null}},[a,i,d,u,m,f,p,b]),se.useEffect(()=>{const D=w.current;if(!D)return;const X=!O.current;D.setData(A,X),X||D.redraw()},[A]),x.jsxs("div",{className:"relative min-w-0",children:[x.jsx("div",{ref:y,className:"text-textMuted min-w-0 overflow-hidden"}),!L&&x.jsx("div",{className:"bg-surface text-textMuted pointer-events-none absolute inset-0 z-10 flex items-center justify-center text-sm",children:l})]})}function tj(n,i){const a=Math.max(1,i);return on.paths.bars?.({size:[1,48/a,0],disp:{x0:{unit:1,values:l=>{const u=)DELIM" +R"DELIM(V_(l,a),f=-u.groupWidth/2+u.barWidth*n;return Array.from(l.data[0],d=>d+f)}},size:{unit:1,values:l=>[V_(l,a).barWidth]}}})}function V_(n,i){const a=nj(n.data[0]),l=Math.abs(n.posToVal(48,"x")-n.posToVal(0,"x")),u=Math.min(a*.72,l);return{groupWidth:u,barWidth:u/i}}function nj(n){let i=Number.POSITIVE_INFINITY,a;for(const l of n)if(Number.isFinite(l)){if(a!==void 0){const u=Math.abs(l-a);u>0&&u=2)return n;const a=Date.now()/1e3,l=i[0]??a,u=[l-1,l],f=n.slice(1).map(d=>{const m=d[0]??null;return[m,m]});return[u,...f]}function rj(n){return Math.abs(n)>=1e6?`${(n/1e6).toFixed(1)}m`:Math.abs(n)>=1e3?`${(n/1e3).toFixed(1)}k`:Math.abs(n)>=10?n.toFixed(0):Math.abs(n)>=1?n.toFixed(1):n.toFixed(2)}const sj={300:"5m",900:"15m",3600:"1h"},aj=new Intl.NumberFormat(void 0,{maximumFractionDigits:0}),lj=new Intl.NumberFormat(void 0,{maximumFractionDigits:2});function oj(n){return aj.format(n)}function uj(n){return lj.format(n)}function cj(n){return n==="height"||n==="occurrences"?oj:uj}function fj({metrics:n}){const i=ES(),[a,l]=se.useState(L3),[u,f]=se.useState(null),[d,m]=se.useState(!1);se.useEffect(()=>{H3(a)},[a]);function p(y){l(w=>u?.mode==="add"?w.length>=Wl?w:[...w,y]:w.map(O=>O.id===y.id?y:O)),f(null)}function g(y,w){l(O=>{const T=y+w;if(T<0||T>=O.length)return O;const A=[...O],k=A[y],L=A[T];return A[y]=L,A[T]=k,A})}function b(){if(!d){m(!0);return}l(jf()),m(!1)}return x.jsxs("section",{className:"space-y-4",children:[x.jsxs("div",{className:"flex flex-wrap items-end justify-between gap-4",children:[x.jsxs("div",{children:[x.jsx("p",{className:"text-accentSecondary text-xs tracking-wide uppercase",children:"Live telemetry"}),x.jsx("h2",{className:"text-accent mt-1 text-2xl font-semibold",children:"Custom charts"}),x.jsxs("p",{className:"text-textMuted mt-1 text-sm",children:["Session data only · ",String(a.length)," of ",String(Wl)," charts"]})]}),x.jsxs("div",{className:"flex flex-wrap gap-2",children:[x.jsx("button",{type:"button",onClick:()=>{m(!1),f({mode:"add",chart:SS()})},disabled:a.length>=Wl,className:"border-accent/40 text-accent hover:border-accent hover:text-accentSecondary rounded-md border px-3 py-2 text-sm font-medium disabled:cursor-not-allowed disabled:opacity-40",children:"Add chart"}),x.jsx("button",{type:"button",onClick:b,onBlur:()=>{m(!1)},className:`rounded-md border px-3 py-2 text-sm font-medium ${d?"border-amber-400/60 text-amber-200":"border-accent/40 text-accent hover:border-accent hover:text-accentSecondary"}`,children:d?"Confirm reset":"Reset defaults"})]})]}),a.length===0?x.jsxs("div",{className:"border-accent/30 bg-surface/80 rounded-2xl border border-dashed px-6 py-16 text-center",children:[x.jsx("p",{className:"text-textPrimary font-medium",children:"No charts in this dashboard."}),x.jsx("p",{className:"text-textMuted mt-2 text-sm",children:"Add a custom chart or start from a template."})]}):x.jsx("div",{className:"grid gap-6 xl:grid-cols-2",children:a.map((y,w)=>x.jsx(dj,{chart:y,metrics:n,now:i,canMoveEarlier:w>0,canMoveLater:w{l(O=>O.map(T=>T.id===y.id?{...T,scale:T.scale==="compressed"?"linear":"compressed"}:T))},onDelete:()=>{l(O=>O.filter(T=>T.id!==y.id))},onDuplicate:()=>{l(O=>O.length>=Wl?O:[...O,$3(y)])},onEdit:()=>{f({mode:"edit",chart:y})},onMoveEarlier:()=>{g(w,-1)},onMoveLater:()=>{g(w,1)}},y.id))}),u&&x.jsx(W3,{chart:u.chart,mode:u.mode,onCancel:()=>{f(null)},onSave:p},`${u.mode}-${u.chart.id}`)]})}function dj({chart:n,metrics:i,now:a,canMoveEarlier:l,canMoveLater:u,canDuplicate:f,onDelete:d,onDuplicate:m,onEdit:p,onMoveEarlier:g,onMoveLater:b,onToggleScale:y}){const[w,O]=se.useState(null),[T,A]=se.useState(0),k=w??i,L=se.useMemo(()=>ln(n)?P3(k,n):null,[n,k]),D=se.useMemo(()=>ln(n)?n.series.map(ee=>({label:ee.label??cs(ee.signalId).label,color:ee.color})):[],[n]),X=cj(L?.unit??"vbytes"),G=`Waiting for ${D.length===1?D[0]?.label?.toLowerCase():"the selected signals"}…`;return x.jsxs("article",{className:"border-accent/30 bg-surface/80 min-w-0 overflow-hidden rounded-2xl border",children:[x.jsx("header",{className:"border-accentSecondary/20 space-y-3 border-b px-4 py-4 sm:px-5",children:x.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[x.jsxs("div",{className:"min-w-0",children:[x.jsx("h3",{className:"text-accent truncate text-lg font-semibold",title:n.title,children:n.title}),x.jsxs("p",{className:"text-textMuted mt-1 text-xs",children:[ln(n)&&L?`${TS(L.unit)} · ${sj[n.range]} · ${n.visualization}`:"Virtual size by fee-rate group · latest snapshot",n.scale==="compressed"?" · compressed scale":"",w?" · paused":""]})]}),x.jsxs("div",{className:"flex flex-wrap justify-end gap-1 text-xs",children:[x.jsx("button",{type:"button","aria-label":`Compress peaks for ${n.title}`,"aria-pressed":n.scale==="compressed",title:"Use a log-like Y axis to compress large peaks. Zero, negative values, and original measurements are preserved.",onClick:y,className:`rounded-md border px-2 py-1.5 ${n.scale==="compressed"?"border-accent/40 bg-accentSecondary/20 text-accent":"border-accent/30 text-textMuted hover:text-accent hover:bg-accentSecondary/10"}`,children:"Compress peaks"}),x.jsx(Pa,{label:w?"Resume chart":"Pause chart",onClick:()=>{O(ee=>ee?null:ln(n)?i:{...i,now:a})},children:w?"Resume":"Pause"}),ln(n)&&x.jsx(Pa,{label:"Reset chart zoom",onClick:()=>{A(ee=>ee+1)},children:"Reset zoom"}),x.jsx(Pa,{label:"Edit chart",onClick:p,children:"Edit"}),x.jsx(Pa,{label:"Duplicate chart",onClick:m,disabled:!f,children:"Duplicate"}),x.jsx(Pa,{label:`Move ${n.title} earlier`,onClick:g,disabled:!l,children:"←"}),x.jsx(Pa,{label:`Move ${n.title} later`,onClick:b,disabled:!u,children:"→"}),x.jsx(Pa,{label:"Delete chart",onClick:d,danger:!0,children:"Delete"})]})]})}),x.jsx("div",{className:"min-w-0 p-3 sm:p-5",children:ln(n)&&L?x.jsx(ej,{data:L.data,series:D,visualization:n.visualization,scale:n.scale,zeroBased:G3(L.unit),valueFormatter:X,valueSuffix:K3(L.unit),forceEmpty:!L.hasObservedData,emptyMessage:G},T):!ln(n)&&x.jsx(X4,{snapshot:k.poolSnapshot,now:w?.now??a,color:n.color,scale:n.scale})}),n.scale==="compressed"&&x.jsx("p",{className:"text-textMuted px-5 pb-3 text-[11px]",children:"Log-like Y axis · peaks compressed · labels and hover values show original measurements."}),ln(n)&&n.series.some(ee=>ee.signalId==="event:10")&&x.jsx("p",{className:"text-textMuted px-5 pb-3 text-[11px]",children:"Archival includes compact-block recovery; rejected and duplicate submissions are excluded."}),L&&L.unobservedLabels.length>0&&L.hasObservedData&&x.jsxs("footer",{className:"border-accent/10 text-textMuted border-t px-5 py-2 text-[11px]",children:["Not observed this session: ",L.unobservedLabels.join(", ")]})]})}function Pa({label:n,children:i,onClick:a,disabled:l=!1,danger:u=!1}){return x.jsx("button",{type:"button","aria-label":n,onClick:a,disabled:l,className:`rounded-md px-2 py-1.5 disabled:cursor-not-allowed disabled:opacity-30 ${u?"text-textMuted hover:bg-red-500/10 hover:text-red-300":"text-textMuted hover:text-accent hover:bg-accentSecondary/10"}`,children:i})}const hj=[{event:0,label:"Header archived"},{event:3,label:"Block archived"},{event:5,label:"Block validated"},{event:6,label:"Block confirmed"},{event:13,label:"Block organized"},{event:14,label:"Block reorganized"}];function mj({adminStatus:n,endpoints:i,metrics:a,native:l,sync:u}){const f=O3(a,10),d=l.configuration,m=aS(d?.forks??[]),p=pj(n,l.status),g=[n.error?`Admin: ${n.error}`:null,l.status.error?`Native: ${l.status.error}`:null,l.transport==="none"&&l.restError?`Native REST: ${l.restError}`:null,a.invalidFrames>0?`${String(a.invalidFrames)} malformed admin frame${a.invalidFrames===1?"":"s"} ignored`:null,l.live.invalidFrames>0?`${String(l.live.invalidFrames)} malformed native frame${l.live.invalidFrames===1?"":"s"} ignored`:null,l.status.phase==="connected"&&l.transport==="none"?"Native: Connect)DELIM" +R"DELIM(ed, but no fresh valid state has been received":null].filter(b=>b!==null);return x.jsxs("div",{className:"space-y-6",children:[g.length>0&&x.jsxs("section",{className:"rounded-xl border border-amber-500/30 bg-amber-500/10 px-4 py-3",children:[x.jsx("p",{className:"text-sm font-medium text-amber-300",children:"Transport notice"}),x.jsx("ul",{className:"text-textMuted mt-1 space-y-1 text-xs",children:g.map(b=>x.jsx("li",{children:b},b))})]}),x.jsx(M3,{sync:u}),x.jsxs("dl",{"aria-label":"Node summary",className:"grid gap-4 sm:grid-cols-2 xl:grid-cols-4",children:[x.jsx(Sf,{label:"Current top",value:l.top===null?"—":pn(l.top),detail:l.transport==="none"?"Waiting for native API":`${vj(u)} · via ${l.transport==="websocket"?"native WebSocket":"REST fallback"}`,emphasized:!0}),x.jsx(Sf,{label:"Current activity",value:f.label,detail:f.rate>0?`${qA(f.rate)} over the last 10 seconds`:"No lifecycle events in the last 10 seconds",numeric:!1}),x.jsx(Sf,{label:"Collection uptime",value:BA(a.now-a.sessionStartedAt),detail:`${pn(a.totalEvents)} events · ${pn(a.totalLogs)} logs`}),x.jsx(Sf,{label:"Connection",value:p.phase==="connected"?XA(i.adminUrl).replace(/\/$/u,""):"[disconnected]",detail:`${p.lastMessageAt?`Last frame ${Uu(p.lastMessageAt)}`:"Waiting for the first frame"} · ${String(p.reconnects)} reconnect${p.reconnects===1?"":"s"}`,numeric:!1})]}),x.jsx(fj,{metrics:a}),x.jsxs("section",{className:"grid gap-4 xl:grid-cols-[1.1fr_0.9fr]",children:[x.jsxs("div",{className:"border-accent/30 bg-surface/80 overflow-hidden rounded-2xl border",children:[x.jsxs("header",{className:"border-accentSecondary/20 border-b px-5 py-4",children:[x.jsx("p",{className:"text-accentSecondary text-xs tracking-wide uppercase",children:"Lifecycle heights"}),x.jsx("h2",{className:"text-accent mt-1 text-lg font-semibold",children:"Highest observed event values"})]}),x.jsx("div",{className:"bg-accentSecondary/10 grid gap-px sm:grid-cols-2 lg:grid-cols-3",children:hj.map(({event:b,label:y})=>{const w=a.signalMaximums[Ui(b)];return x.jsxs("div",{className:"bg-surface px-5 py-4",children:[x.jsx("p",{className:"text-accentSecondary text-xs tracking-wide uppercase",children:y}),x.jsx("p",{className:"text-textPrimary mt-2 text-xl font-semibold tabular-nums",children:w===void 0?"—":pn(w)})]},b)})})]}),x.jsxs("div",{className:"border-accent/30 bg-surface/80 rounded-2xl border",children:[x.jsxs("header",{className:"border-accentSecondary/20 border-b px-5 py-4",children:[x.jsx("p",{className:"text-accentSecondary text-xs tracking-wide uppercase",children:"Capabilities"}),x.jsx("h2",{className:"text-accent mt-1 text-lg font-semibold",children:"Native configuration"})]}),d?x.jsxs("div",{className:"space-y-4 p-5 text-sm",children:[x.jsxs(_u,{title:"Store configuration",children:[x.jsx(Qm,{items:[["Address index",d.store.address],["Client filters index",d.store.filter],["Silent payments index",d.store.silent!==null],["Turbo",d.store.turbo]]}),x.jsx(Tf,{items:[["Silent payments from",d.store.silent===null?"Not indexed":pn(d.store.silent)]]})]}),x.jsxs(_u,{title:"Node services",children:[x.jsx(Qm,{items:[["Blocks",d.node.blocks],["Limited",d.node.limited],["Witness",d.node.witness],["Filters",d.node.filters],["Privacy",d.node.privacy]]}),x.jsx(Tf,{items:[["Inputs pruned below",d.store.pruned>0?pn(d.store.pruned):"Not pruned"]]})]}),d.network&&x.jsxs(_u,{title:"Peer protocol",children:[x.jsx(Qm,{items:[["Relay",d.network.relay],["Compact",d.network.compact],["Address",d.network.address],["Witness tx",d.network.witness_tx],["Memory pool",d.network.memory_pool],["Not found",d.network.not_found],["Reject",d.network.reject],["Alert",d.network.alert]]}),x.jsx(Tf,{items:[["Protocol minimum",String(d.network.protocol_minimum)],["Protocol maximum",String(d.network.protocol_maximum)]]})]}),d.wallet&&x.jsx(_u,{title:"Wallet",children:x.jsx(Tf,{items:[["P2PKH version",String(d.wallet.p2kh),Ia(m,"p2kh",d.wallet.p2kh)],["P2SH version",String(d.wallet.p2sh),Ia(m,"p2sh",d.wallet.p2sh)],["WIF version",String(d.wallet.wif),Ia(m,"wif",d.wallet.wif)],["Witness prefix",d.wallet.witness,Ia(m,"witness",d.wallet.witness)],["Silent prefix",d.wallet.silent,Ia(m,"silent",d.wallet.silent)],["HD private",P_(d.wallet.hd_private),Ia(m,"hdPrivate",d.wallet.hd_private)],["HD public",P_(d.wallet.hd_public),Ia(m,"hdPublic",d.wallet.hd_public)]]})}),x.jsx(_u,{title:"Configured forks",children:x.jsx("div",{className:"flex flex-wrap gap-1.5",children:d.forks.map(b=>x.jsx("span",{className:"text-textPrimary bg-accentSecondary/15 rounded-full px-2 py-0.5 font-mono text-xs",children:b},b))})})]}):x.jsx("p",{className:"text-textMuted px-5 py-10 text-center text-sm",children:"Waiting for native configuration."})]})]}),x.jsx("section",{children:x.jsxs("div",{className:"border-accent/30 bg-surface/80 rounded-2xl border",children:[x.jsx("header",{className:"border-accentSecondary/20 border-b px-5 py-4",children:x.jsx("p",{className:"text-accentSecondary text-xs tracking-wide uppercase",children:"Recent events"})}),a.recentEvents.length===0?x.jsx(gj,{text:"No events observed yet."}):x.jsx("ul",{className:"divide-accentSecondary/20 divide-y",children:a.recentEvents.slice(0,6).map(b=>x.jsxs("li",{className:"flex items-center gap-3 px-5 py-3 text-xs",children:[x.jsx("time",{className:"text-textMuted w-24 shrink-0 font-mono",children:Uu(b.time)}),x.jsx("span",{className:"text-textPrimary min-w-0 flex-1 truncate font-mono",children:mo(b.event).name}),x.jsx("span",{className:"text-accent tabular-nums",children:sS(b.event,b.value)})]},b.id))})]})})]})}const I_={connected:0,connecting:1,reconnecting:2,idle:3};function pj(n,i){const a=I_[i.phase]>I_[n.phase]?i:n,l=Math.max(n.lastMessageAt??0,i.lastMessageAt??0);return{...a,reconnects:n.reconnects+i.reconnects,lastMessageAt:l>0?l:null}}function _u({title:n,children:i}){return x.jsxs("section",{className:"border-accentSecondary/20 space-y-2 border-t pt-3 first:border-t-0 first:pt-0",children:[x.jsx("h3",{className:"text-accentSecondary text-xs tracking-wide uppercase",children:n}),i]})}function Qm({items:n}){const i=n.filter(([,a])=>a!==void 0);return x.jsx("div",{className:"flex flex-wrap gap-1.5",children:i.map(([a,l])=>x.jsx("span",{className:`rounded-full border px-2 py-0.5 text-xs ${l?"border-emerald-500/50 bg-emerald-500/15 text-emerald-300":"text-textMuted border-slate-500/40"}`,children:a},a))})}function Tf({items:n}){const i=n.some(l=>l.length>2),a=i?"grid-cols-[10rem_max-content_auto]":"grid-cols-[10rem_max-content]";return x.jsx("dl",{className:`grid ${a} items-baseline gap-x-4 gap-y-1`,children:n.map(([l,u,f])=>x.jsxs(se.Fragment,{children:[x.jsx("dt",{className:"text-textMuted",children:l}),x.jsx("dd",{className:"text-textPrimary font-mono",children:u}),i&&x.jsx("dd",{className:"text-textMuted",children:f})]},l))})}function P_(n){return`0x${n.toString(16).padStart(8,"0")}`}function gj({text:n}){return x.jsx("p",{className:"text-textMuted px-5 py-10 text-center text-sm",children:n})}function vj(n){return n?n.diverged?"Candidate branch diverges":n.blocksRemaining===0?"At top candidate header":n.blocksRemaining<=td?`Near current, ${pn(n.blocksRemaining)} blocks remaining`:`${pn(n.blocksRemaining)} blocks remaining`:"Waiting for chain tops"}const yj=8e3;function bj({sync:n,browserNotificationsEnabled:i}){const a=se.useRef(null),[l,u]=se.useState(null),f=n?.blocksRemaining??null;if(se.useEffect(()=>{const m=Sj(f);if(!m)return;const p=a.current;if(a.current=m.state,!(p===null||p===m.state)&&(u(m),i)){const g=_j(m);Yz(g.title,{body:g.body,tag:"libbitcoin-sync-status"})}},[i,f]),se.useEffect(()=>{if(!l)return;const m=setTimeout(()=>{u(p=>p===l?null:p)},yj);return()=>{clearTimeout(m)}},[l]),!l)return null;const d=l.state==="near-current";return x.jsx("aside",{role:"status","aria-live":"polite","aria-atomic":"true",className:`fixed right-4 bottom-4 left-4 z-[60] rounded-xl border p-4 shadow-2xl shadow-black/50 sm:left-auto sm:w-96 ${d?"bg-noticeSuccess/95 border-emerald-400/35":"bg-noticeWarning/95)DELIM" +R"DELIM( border-amber-400/35"}`,children:x.jsxs("div",{className:"flex items-start gap-4",children:[x.jsxs("div",{className:"min-w-0 flex-1",children:[x.jsx("p",{className:d?"font-semibold text-emerald-200":"font-semibold text-amber-200",children:d?"Node near current":"Node fell behind"}),x.jsx("p",{className:"text-noticeText/75 mt-1 text-sm",children:wp(l)})]}),x.jsx("button",{type:"button","aria-label":"Dismiss synchronization notification",onClick:()=>{u(null)},className:"text-noticeText/60 hover:text-noticeText text-lg leading-none",children:"×"})]})})}function _j(n){return n.state==="near-current"?{title:"Libbitcoin node near current",body:wp(n)}:{title:"Libbitcoin node fell behind",body:wp(n)}}function Sj(n){return n===null?null:{state:n<=td?"near-current":"behind",blocksBehind:n}}function wp(n){return n.state==="near-current"?`Confirmed top is within ${String(td)} blocks of the top candidate header.`:`Confirmed top is ${pn(n.blocksBehind)} blocks below the top candidate header.`}const gx='(function(){"use strict";function je(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 gt(e,t="|"){return e.map(n=>kt(n)).join(t)}function Me(e,t){return typeof t=="bigint"?t.toString():t}class vr{constructor(t){this._getter=t,this._value=void 0}get value(){const t=this._getter;return t!==void 0&&(this._value=t(),this._getter=void 0),this._value}}function Le(e){return new vr(e)}function br(e){return e==null}function Fe(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function yr(e,t){const n=e/t,r=Math.round(n),i=4*Number.EPSILON*Math.max(Math.abs(n),1);return Math.abs(n-r){const c=t._zod.def.shape[s];return r?r(c,s):c}):bt(e,s,r?r(o.value,s):o.value))}}function wr(e,t){for(const n of Reflect.ownKeys(t)){const r=Object.getOwnPropertyDescriptor(t,n);r.enumerable&&(r.get?vt(e,n,()=>t[n]):bt(e,n,r.value))}}function N(...e){const t={};for(const n of e){const r=Object.getOwnPropertyDescriptors(n);Object.assign(t,r)}return Object.defineProperties({},t)}function kr(e){return JSON.stringify(e)}function zr(e){return e.toLowerCase().trim().replace(/[^\\w\\s-]/g,"").replace(/[\\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const yt="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function de(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const Sr=Le(()=>{if(R.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function Y(e){if(de(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const n=t.prototype;return!(de(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function wt(e){return Y(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}const $r=new Set(["string","number","symbol"]);function pe(e){return e.replace(/[.*+?^${}()|[\\]\\\\]/g,"\\\\$&")}function K(e,t,n){const r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function _(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 kt(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function Or(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout==="optional")}const zt={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]},Er={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function Ir(e,t){const n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const s={};return q(s,e,me(e,t)),K(e,N(n,{shape:s,checks:[]}))}function me(e,t){const n=x(e),r=[];for(const i of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(n,i)?.enumerable)throw new Error(`Unrecognized key: "${String(i)}"`);t[i]&&r.push(i)}return r}function Tr(e,t){const n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const s=new Set(me(e,t)),o={};return q(o,e,Reflect.ownKeys(x(e)).filter(c=>!s.has(c))),K(e,N(n,{shape:o,checks:[]}))}function Pr(e,t){if(!Y(t))throw new Error("Invalid input to extend: expected a plain object");const n=e._zod.def.checks;if(n&&n.length>0){const i=x(e);for(const s of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(i,s)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return K(e,N(e._zod.def,{shape:St(e,t)}))}function St(e,t){const n={};return q(n,e,Reflect.ownKeys(x(e))),wr(n,t),n}function Zr(e,t){if(!Y(t))throw new Error("Invalid input to safeExtend: expected a plain object");return K(e,N(e._zod.def,{shape:St(e,t)}))}function Ar(e,t){if(!t?._zod?.def)throw new Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");const n={};q(n,e,Reflect.ownKeys(x(e))),q(n,t,Reflect.ownKeys(x(t)));const r=N(e._zod.def,{shape:n,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return K(e,r)}function $t(e,t,n,r="partial"){const s=t._zod.def.checks;if(s&&s.length>0)throw new Error(`.${r}() cannot be used on object schemas containing refinements`);const c=n?new Set(me(t,n)):void 0,a={};return q(a,t,Reflect.ownKeys(x(t)),e&&((u,l)=>c&&!c.has(l)?u:new e({type:"optional",innerType:u}))),K(t,N(t._zod.def,{shape:a,checks:[]}))}function Nr(e,t,n){const r=n?new Set(me(t,n)):void 0,i={};return q(i,t,Reflect.ownKeys(x(t)),(s,o)=>r&&!r.has(o)?s:new e({type:"nonoptional",innerType:s})),K(t,N(t._zod.def,{shape:i}))}function F(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n{var r;return(r=n).path??(r.path=[]),n.path.unshift(e),n})}function re(e){return typeof e=="string"?e:e?.message}function Ot(e){const t=[];for(const n of e??[]){const r=n._zod.def;if(!/_(length|size)$|_equals$/.test(r.check))break;const i=r.maximum??r.length??r.size;i>=0&&t.push([i,n])}return t}function Ce(e,t,n){var r;for(let i=t;ie;return t[Ur]=!0,t}var Tt;const Ke={value:void 0,enumerable:!1};let Pt="captureStackTrace"in Error?Error:null;function Jr(e){const t=Pt;if(t){const n=t.stackTraceLimit;if(typeof n=="number"){try{t.stackTraceLimit=0}catch{return Pt=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}function f(e,t,n,r){const i={};function s(p){this.def=p,this.constr=h,this.traits=new Set}s.prototype=i;const o=n,c=o&&new WeakSet;function a(p,d){if(p._zod){if(p._zod.traits.has(e))return}else{Ke.value=new s(d);try{Object.defineProperty(p,"_zod",Ke)}finally{Ke.value=void 0}}if(p._zod.traits.add(e),t(p,d),c){const g=Object.getPrototypeOf(p),v=p._zod.constr.prototype;let b=g;for(;b&&b!==v;)b=Object.getPrototypeOf(b);const A=b??g;c.has(A)||(c.add(A),Lr(A,o))}const m=h.prototype;for(const g in m)Object.prototype.hasOwnProperty.call(m,g)&&(g in p||(p[g]=m[g].bind(p)))}const u=r?.Parent??Object;class l extends u{}Object.defineProperty(l,"name",{value:e});function h(p){const d=r?.Parent?Jr(l):this;a(d,p);const m=d._zod.deferred;if(m){for(const v of m)v();d._zod.deferred=void 0}const g=globalThis.__zod_globalConfig?.postProcessor;return g&&g(d),d}return Object.defineProperty(h,"init",{value:a}),Object.defineProperty(h,Symbol.hasInstance,{value:p=>r?.Parent&&p instanceof r.Parent?!0:p?._zod?.traits?.has(e)}),Object.defineProperty(h,"name",{value:e}),h}class G extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Zt extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}(Tt=globalThis).__zod_globalConfig??(Tt.__zod_globalConfig={});const R=globalThis.__zod_globalConfig;function C(e){return e&&Object.assign(R,e),R}function Br(){const e=this._zod;return e.message??(e.message=JSON.stringify(e.def,Me,2)),e.message}function Vr(e){this._zod.message=e}const Wr={get:Br,set:Vr,enumerable:!0,configurable:!0},Je={value:void 0,enumerable:!1},At=new WeakSet([Object.prototype,Error.prototype]),qr=f("$ZodError",(e,t)=>{e.name="$ZodError",Je.value=t,Object.defineProperty(e,"issues",Je),Je.value=void 0,Object.defineProperty(e,"message",Wr);const n=Object.getPrototypeOf(e);At.has(n)||(At.add(n),Object.defineProperty(n,"toString",{configurable:!0,enumerable:!1,get(){const r=()=>this.message;return Object.defineProperty(this,"toString",{value:r,configurable:!0,writable:!0}),r},set(r){Object.defineProperty(this,"toString",{value:r,configurable:!0,writable:!0})}}))});function Gr(e,t,n){return Object.prototype.hasOwnProperty.call(e,t)||(t==="__proto__"?Object.defineProperty(e,t,{value:n(),writable:!0,enumerable:!0,configurable:!0}):e[t]=n()),e[t]}function Hr(e,t=n=>n.message){const n={},r=[];for(const i of e.issues)i.path.length>0?Gr(n,i.path[0],()=>[]).push(t(i)):r.push(t(i));return{formErrors:r,fieldErrors:n}}function Yr(e,t=n=>n.message){const n={_errors:[]},r=(i,s=[])=>{for(const o of i.issues)if(o.code==="invalid_union"&&o.errors.length)o.errors.map(c=>r({issues:c},[...s,...o.path]));else if(o.code==="invalid_key")r({issues:o.issues},[...s,...o.path]);else if(o.code==="invalid_element")r({issues:o.issues},[...s,...o.path]);else{const c=[...s,...o.path];if(c.length===0)n._errors.push(t(o));else{let a=n,u=0;for(;u{const t=(n,r,i,s)=>{const o=i?{...i,async:!1}:{async:!1},c=n._zod.run({value:r,issues:[]},o);if(c instanceof Promise)throw new G;if(c.issues.length){const a=new(s?.Err??e)(c.issues.map(u=>B(u,o,C())));throw yt(a,s?.callee??t),a}return c.value};return t},Ve=e=>{const t=async(n,r,i,s)=>{const o=i?{...i,async:!0}:{async:!0};let c=n._zod.run({value:r,issues:[]},o);if(c instanceof Promise&&(c=await c),c.issues.length){const a=new(s?.Err??e)(c.issues.map(u=>B(u,o,C())));throw yt(a,s?.callee??t),a}return c.value};return t},We=e=>(t,n,r)=>{const i=r?{...r,async:!1}:{async:!1},s=t._zod.run({value:n,issues:[]},i);if(s instanceof Promise)throw new G;return s.issues.length?Nt(e,s.issues,i):{success:!0,data:s.value}};function Nt(e,t,n){let r;return{success:!1,get error(){return r||(r=new e(t.map(i=>B(i,n,C()))),t=void 0,n=void 0),r},set error(i){r=i,t=void 0,n=void 0}}}const qe=e=>async(t,n,r)=>{const i=r?{...r,async:!0}:{async:!0};let s=t._zod.run({value:n,issues:[]},i);return s instanceof Promise&&(s=await s),s.issues.length?Nt(e,s.issues,i):{success:!0,data:s.value}},Xr=Symbol.for("zod.compile.invalid"),Qr=Symbol.for("zod.compile.fallback"),ei=((e,t,n)=>{const r=e._zod.bag.validator;if(r!==void 0){if(r(t)!==Xr)return!0;if(r.definite===!0&&n===void 0)return!1}return ti(e,t,n)});function ti(e,t,n){const r=n?{...n,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},i=e._zod.bag.fallbackRun;let s;if(i?(r[Qr]=!0,s=i({value:t,issues:[]},r)):s=e._zod.run({value:t,issues:[]},r),s instanceof Promise)throw new G;return s.issues.length===0}const ni=async(e,t,n)=>{const r=n?{...n,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0};let i=e._zod.run({value:t,issues:[]},r);return i instanceof Promise&&(i=await i),i.issues.length===0},ri=e=>{const t=Be(e),n=(r,i,s,o)=>{const c=s?{...s,direction:"backward"}:{direction:"backward"};return t(r,i,c,ge(n,o))};return n},ii=e=>{const t=Be(e),n=(r,i,s,o)=>t(r,i,s,ge(n,o));return n},si=e=>{const t=Ve(e),n=async(r,i,s,o)=>{const c=s?{...s,direction:"backward"}:{direction:"backward"};return await t(r,i,c,ge(n,o))};return n},oi=e=>{const t=Ve(e),n=async(r,i,s,o)=>await t(r,i,s,ge(n,o));return n},ci=e=>(t,n,r)=>)DELIM" +R"DELIM({const i=r?{...r,direction:"backward"}:{direction:"backward"};return We(e)(t,n,i)},ai=e=>(t,n,r)=>We(e)(t,n,r),ui=e=>async(t,n,r)=>{const i=r?{...r,direction:"backward"}:{direction:"backward"};return qe(e)(t,n,i)},li=e=>async(t,n,r)=>qe(e)(t,n,r),fi=/^[cC][0-9a-z]{6,}$/,hi=/^[0-9a-z]+$/,di=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,pi=/^[0-9a-vA-V]{20}$/,mi=/^[A-Za-z0-9]{27}$/,gi=/^[a-zA-Z0-9_-]{21}$/;function _i(e){return new RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}const vi=/^P(?:(\\d+W)|(?!.*W)(?=\\d|T\\d)(\\d+Y)?(\\d+M)?(\\d+D)?(T(?=\\d)(\\d+H)?(\\d+M)?(\\d+([.,]\\d+)?S)?)?)$/,bi=/^([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})$/,Rt=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)$/,yi=/^(?:[A-Za-z0-9_\'+\\-]+\\.)*[A-Za-z0-9_\'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$/,wi="^(?=[\\\\s\\\\S]*[\\\\p{Extended_Pictographic}\\\\p{Regional_Indicator}\\\\u20E3])[\\\\p{Extended_Pictographic}\\\\p{Emoji_Component}]+$";function ki(){return new RegExp(wi,"u")}const zi=/^(?:(?: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])$/,Si=/^(([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}|:))$/,$i=/^((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])$/,Oi=/^(([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}|:))\\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Ei=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Ii=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/,Ti=/^https?$/,Pi=/^\\+[1-9]\\d{6,14}$/,jt="(?:(?:\\\\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])))";function Zi(e){return new RegExp(`^${e}$`)}const Ai=Zi(jt);function Ge(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}}`:e.seconds?`${t}:[0-5]\\\\d(?:\\\\.\\\\d+)?`:`${t}(?::[0-5]\\\\d(?:\\\\.\\\\d+)?)?`}function Ni(e){return new RegExp(`^${Ge(e)}$`)}function Ri(e){const t=["Z"];e.offset&&t.push("([+-](?:[01]\\\\d|2[0-3]):[0-5]\\\\d)");const n=`${Ge({precision:e.precision,seconds:!0})}(?:${t.join("|")})`,r=e.local?`${n}|${Ge({precision:e.precision})}`:n;return new RegExp(`^${jt}T(?:${r})$`)}const ji=/^[\\s\\S]{0,}$/,Mi=/^-?\\d+$/,He=/^-?\\d+(?:\\.\\d+)?$/,Li=/^(?:true|false)$/i,Fi=/^[^A-Z]*$/,Ci=/^[^a-z]*$/,Z=f("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Ye=e=>{const t=e.value;return!br(t)&&t.length!==void 0},_e={number:"number",bigint:"bigint",object:"date"},Mt=f("$ZodCheckLessThan",(e,t)=>{Z.init(e,t);const n=_e[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value{Z.init(e,t);const n=_e[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:_e[typeof r.value]??n,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Di=f("$ZodCheckMultipleOf",(e,t)=>{Z.init(e,t),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof n.value=="bigint"?t.value!==BigInt(0)&&n.value%t.value===BigInt(0):yr(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),xi=f("$ZodCheckNumberFormat",(e,t)=>{Z.init(e,t),t.format=t.format||"float64";const n=t.format?.includes("int"),r=n?"int":"number",[i,s]=zt[t.format];e._zod.check=o=>{const c=o.value;if(n){if(!Number.isInteger(c)){o.issues.push({expected:r,format:t.format,code:"invalid_type",continue:!1,input:c,inst:e});return}if(!Number.isSafeInteger(c)){c>0?o.issues.push({input:c,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}):o.issues.push({input:c,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}}cs&&o.issues.push({origin:"number",input:c,code:"too_big",maximum:s,inclusive:!0,inst:e,continue:!t.abort})}}),Ui=f("$ZodCheckMaxLength",(e,t)=>{var n;Z.init(e,t),(n=e._zod.def).when??(n.when=Ye),e._zod.check=r=>{const i=r.value,s=i.length;if((typeof i=="string"&&s>t.maximum?De(i):s)<=t.maximum)return;const c=xe(i);r.issues.push({origin:c,code:"too_big",maximum:t.maximum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),Ki=f("$ZodCheckMinLength",(e,t)=>{var n;Z.init(e,t),(n=e._zod.def).when??(n.when=Ye),e._zod.check=r=>{const i=r.value,s=i.length;if((typeof i=="string"&&s>=t.minimum&&s=t.minimum)return;const c=xe(i);r.issues.push({origin:c,code:"too_small",minimum:t.minimum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),Ji=f("$ZodCheckLengthEquals",(e,t)=>{var n;Z.init(e,t),(n=e._zod.def).when??(n.when=Ye),e._zod.check=r=>{const i=r.value,s=i.length,o=typeof i=="string"&&s>=t.length&&s<=t.length*2?De(i):s;if(o===t.length)return;const c=xe(i),a=o>t.length;r.issues.push({origin:c,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),ve=f("$ZodCheckStringFormat",(e,t)=>{var n,r;Z.init(e,t),t.pattern?(n=e._zod).check??(n.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=()=>{})}),Bi=f("$ZodCheckRegex",(e,t)=>{ve.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Vi=f("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Fi),ve.init(e,t)}),Wi=f("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Ci),ve.init(e,t)}),qi=f("$ZodCheckIncludes",(e,t)=>{Z.init(e,t);const n=pe(t.includes),r=new RegExp(typeof t.position=="number"?`^.{${t.position},}${n}`:n);t.pattern=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})}}),Gi=f("$ZodCheckStartsWith",(e,t)=>{Z.init(e,t);const n=new RegExp(`^${pe(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.check=r=>{r.value.startsWith(t.prefix)||r.issues.push({origin:"string",code:"invalid_format",f)DELIM" +R"DELIM(ormat:"starts_with",prefix:t.prefix,input:r.value,inst:e,continue:!t.abort})}}),Hi=f("$ZodCheckEndsWith",(e,t)=>{Z.init(e,t);const n=new RegExp(`.*${pe(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.check=r=>{r.value.endsWith(t.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:r.value,inst:e,continue:!t.abort})}}),Yi=f("$ZodCheckOverwrite",(e,t)=>{Z.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class Xi{constructor(t=[],n={}){this.content=[],this.indent=0,this.args=t,this.closed=n}indented(t){this.indent+=1;try{t(this)}finally{this.indent-=1}}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const r=t.split(`\n`).filter(o=>o),i=Math.min(...r.map(o=>o.length-o.trimStart().length)),s=r.map(o=>o.slice(i)).map(o=>" ".repeat(this.indent*2)+o);for(const o of s)this.content.push(o)}compile(){const t=Function,n=this?.content??[""];return new t(...Object.keys(this.closed),`return function (${this.args.join(", ")}) {\n${n.join(`\n`)}\n};`)(...Object.values(this.closed))}}const Qi={major:4,minor:6,patch:7},k=f("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Qi;const r=e._zod.def.checks,i=e._zod.traits.has("$ZodCheck")?[e,...r??[]]:r?.length?[...r]:[];for(const s of i)for(const o of s._zod.onattach)o(e);if(i.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const s=(c,a,u)=>{if(c.memo)return c;let l=F(c),h;for(const p of a){if(p._zod.def.when){if(Rr(c)||!p._zod.def.when(c))continue}else if(l)continue;const d=c.issues.length,m=p._zod.check(c);if(m instanceof Promise&&u?.async===!1)throw new G;if(h||m instanceof Promise)h=(h??Promise.resolve()).then(async()=>{await m,c.issues.length!==d&&(Ce(c.issues,d,e),l||(l=F(c,d)))});else{if(c.issues.length===d)continue;Ce(c.issues,d,e),l||(l=F(c,d))}}return h?h.then(()=>c):c},o=(c,a,u)=>{if(F(c))return c.aborted=!0,c;const l=s(a,i,u);if(l instanceof Promise){if(u.async===!1)throw new G;return l.then(h=>e._zod.parse(h,u))}return e._zod.parse(l,u)};e._zod.run=(c,a)=>{if(a.skipChecks)return e._zod.parse(c,a);if(a.direction==="backward"){const l=e._zod.parse({value:c.value,issues:[]},{...a,skipChecks:!0});return l instanceof Promise?l.then(h=>o(h,c,a)):o(l,c,a)}const u=e._zod.parse(c,a);if(u instanceof Promise){if(a.async===!1)throw new G;return u.then(l=>s(l,i,a))}return s(u,i,a)}}},{get"~standard"(){return Et(this,"~standard",Ct(this))},set"~standard"(e){V(this,"~standard",e)}}),Ft=(e,t)=>e.issues.length?{issues:e.issues.map(n=>B(n,t,C()))}:{value:e.value};async function es(e,t){const n={async:!0};return Ft(await e._zod.run({value:t,issues:[]},n),n)}function Ct(e){return{validate:t=>{const n={async:!1};try{const r=e._zod.run({value:t,issues:[]},n);if(!(r instanceof Promise))return Ft(r,n)}catch{}return es(e,t)},vendor:"zod",version:1}}const Xe=f("$ZodString",(e,t)=>{k.init(e,t),e._zod.pattern=t.pattern??ji,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value=="string"||n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}}),z=f("$ZodStringFormat",(e,t)=>{ve.init(e,t),Xe.init(e,t)}),ts=f("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=bi),z.init(e,t)}),ns=f("$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=Rt(r))}else t.pattern??(t.pattern=Rt());z.init(e,t)}),rs=f("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=yi),z.init(e,t)}),Dt=1,be=2;function xt(e){try{return typeof URL<"u"&&typeof URL.canParse=="function"?URL.canParse(e):(new URL(e),!0)}catch{return!1}}function is(e,t){return!("normalize"in t)&&!("hostname"in t)&&!("protocol"in t)?xt(e)||be:ss(e,t)}function ss(e,t){if(!t.normalize&&t.protocol?.source===Ti.source&&!/^https?:\\/\\//i.test(e))return Dt;try{if(typeof URL<"u"){const n=URL;if(typeof n.parse=="function")return n.parse(e)??be}return new URL(e)}catch{return be}}const os=/[\\t\\n\\r]/g;function Ut(e){return e.replace(os,"")}function cs(e,t){return t.lastIndex=0,t.test(e.hostname)}function as(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(":")?e.protocol.slice(0,-1):e.protocol)}const us=f("$ZodURL",(e,t)=>{z.init(e,t),e._zod.check=n=>{try{const r=n.value.trim(),i=is(r,t);if(i===Dt){n.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:n.value,inst:e,continue:!t.abort});return}if(i===be){n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort});return}if(i===!0){n.value=Ut(r);return}t.hostname&&!cs(i,t.hostname)&&n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort}),t.protocol&&!as(i,t.protocol)&&n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort}),n.value=t.normalize?i.href:Ut(r);return}catch{n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),ls=f("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=ki()),z.init(e,t)}),fs=f("$ZodNanoID",(e,t)=>{if(t.length!==void 0&&(!Number.isInteger(t.length)||t.length<1))throw new Error(`Invalid nanoid length: ${t.length}`);t.pattern??(t.pattern=t.length===void 0?gi:_i(t.length)),z.init(e,t)}),hs=f("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=fi),z.init(e,t)}),ds=f("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=hi),z.init(e,t)}),ps=f("$ZodULID",(e,t)=>{t.pattern??(t.pattern=di),z.init(e,t)}),ms=f("$ZodXID",(e,t)=>{t.pattern??(t.pattern=pi),z.init(e,t)}),gs=f("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=mi),z.init(e,t)}),_s=f("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=Ri(t)),z.init(e,t)}),vs=f("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Ai),z.init(e,t)}),bs=f("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Ni(t)),z.init(e,t)}),ys=f("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=vi),z.init(e,t)}),ws=f("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=zi),z.init(e,t)}),ks=/^[0-9a-fA-F:.]+$/;function Kt(e){return ks.test(e)?xt(`http://[${e}]`):!1}const zs=f("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Si),z.init(e,t),e._zod.check=n=>{Kt(n.value)||n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}),Ss=f("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=$i),z.init(e,t)});function $s(e){const t=e.split("/");if(t.length!==2)return!1;const[n,r]=t;if(!r)return!1;const i=Number(r);return`${i}`!==r||i<0||i>128?!1:Kt(n)}const Os=f("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Oi),z.init(e,t),e._zod.check=n=>{$s(n.value)||n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}});function Jt(e){if(e==="")return!0;if(/\\s/.test(e)||e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const Bt=/^[0-9a-zA-Z+/]*={0,2}$/,Es=f("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Bt),z.init(e,t),e._zod.check=n=>{Jt(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}}),Qe=/^[A-Za-z0-9_-]*$/;function Is(e){if(!Qe.test(e))return!1;const t=e.replace(/[-_]/g,r=>r==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return Jt(n)}const Ts=f("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Qe),z.init(e,t),e._zod.check=n=>{Is(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),Ps=f("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Pi),z.init(e,t)});function Zs(e,t=null){try{const n=e.split(".");if(n.length!==3)return!1;const[r]=n;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 As=f("$ZodJWT",(e,t)=>{z.init(e,t),e._zod.check=n=>{Zs(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),Vt=f("$ZodNumber",(e,t)=>{k.init(e,t),e._zod.pattern=He,e._zod.parse=(n,r)=>{if(t.coerce)DELIM" +R"DELIM()try{n.value=Number(n.value)}catch{}const i=n.value;if(typeof i=="number"&&!Number.isNaN(i)&&Number.isFinite(i))return n;const s=typeof i=="number"?Number.isNaN(i)?"NaN":Number.isFinite(i)?void 0:String(i):void 0;return n.issues.push({expected:"number",code:"invalid_type",input:i,inst:e,...s?{received:s}:{}}),n}}),Ns=f("$ZodNumberFormat",(e,t)=>{xi.init(e,t),Vt.init(e,t)}),Rs=f("$ZodBoolean",(e,t)=>{k.init(e,t),e._zod.pattern=Li,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}const i=n.value;return typeof i=="boolean"||n.issues.push({expected:"boolean",code:"invalid_type",input:i,inst:e}),n}}),js=f("$ZodUnknown",(e,t)=>{k.init(e,t),e._zod.parse=n=>n}),Ms=f("$ZodNever",(e,t)=>{k.init(e,t),e._zod.parse=(n,r)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)});function Ls(e,t){const n=Ot(e._zod.def.checks);if(!n.length)return;const r=Math.min(...n.map(s=>s[0])),i=e._zod.parse;e._zod.parse=(s,o)=>{const c=t(s.value);if(c>r&&!o?.skipChecks&&o?.direction!=="backward"){for(const[a,u]of Ot(e._zod.def.checks))if(c>a&&u._zod.def.when(s)){const l=s.issues.length;return u._zod.check(s),s.issues[l].continue=!1,Ce(s.issues,l,e),s}}return i(s,o)}}const Fs=e=>Array.isArray(e)?e.length:-1;function Wt(e,t,n){e.issues.length&&t.issues.push(...J(n,e.issues)),t.value[n]=e.value}const Cs=f("$ZodArray",(e,t)=>{k.init(e,t);const n=R.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{const s=r.value;if(!Array.isArray(s))return r.issues.push({expected:"array",code:"invalid_type",input:s,inst:e}),r;r.value=n?n.alloc(e,r,Array(s.length),i):Array(s.length);const o=[],c=i?.abortEarly;for(let a=0;aWt(h,r,a)));else if(Wt(l,r,a),c&&l.issues.length!==0&&F(l))break}return o.length?Promise.all(o).then(()=>r):r},Ls(e,Fs)});function ye(e,t,n,r,i,s){const o=n in r,c=s==="optional";if(!(!o&&c&&i==="optional")){if(e.issues.length){if(i!==void 0&&c&&!o)return;t.issues.push(...J(n,e.issues))}if(!o&&i===void 0){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[n]});return}e.value===void 0?(o||i==="defaulted"&&!c)&&(t.value[n]=void 0):t.value[n]=e.value}}const Ds=[];function qt(e){const t=Object.keys(e.shape),n=Object.getOwnPropertySymbols(e.shape),r=n.length?n:Ds,i=r.length?[...t,...r]:t;for(const o of i)if(!e.shape?.[o]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${String(o)}": expected a Zod schema`);const s=Or(e.shape);return{...e,allKeys:i,symbolKeys:r,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(s)}}function Gt(e,t,n,r,i,s,o){const c=[],a=i.keySet,u=i.catchall._zod,l=u.def.type,h=u.optin,p=u.optout;let d=0;for(const m in t){if(o&&n.issues.length!==d){if(F(n,d))break;d=n.issues.length}if(a.has(m))continue;if(m==="__proto__"){l==="never"&&c.push(m);continue}if(l==="never"){c.push(m);continue}const g=u.run({value:t[m],issues:[]},r);g instanceof Promise?e.push(g.then(v=>ye(v,n,m,t,h,p))):ye(g,n,m,t,h,p)}return c.length&&n.issues.push({code:"unrecognized_keys",keys:c,input:t,inst:s,continue:!0}),e.length?Promise.all(e).then(()=>n):n}const xs=f("$ZodObject",(e,t)=>{k.init(e,t);const n=Object.getOwnPropertyDescriptor(t,"shape"),r=n?.get?n.get.raw:t.shape??{};if(r){const u=()=>{const l={...r};return Object.defineProperty(t,"shape",{value:l}),u.raw=l,l};u.raw=r,Object.defineProperty(t,"shape",{get:u})}const i=Le(()=>qt(t));y(e,"propValues",u=>{const l=u.def.shape,h={};for(const p in l){const d=l[p]._zod;if(d.values){Object.prototype.hasOwnProperty.call(h,p)||U(h,p,new Set);for(const m of d.values)h[p].add(m);d.optin!==void 0&&h[p].add(void 0)}}return h});const s=de,o=t.catchall;let c;const a=R.memoizer;a?.attach(e),e._zod.parse=(u,l)=>{c??(c=i.value);const h=u.value;if(!s(h))return u.issues.push({expected:"object",code:"invalid_type",input:h,inst:e}),u;u.value=a?a.alloc(e,u,{},l):{};const p=[],d=c.shape,m=l?.abortEarly;let g=u.issues.length;for(const v of c.allKeys){if(m&&u.issues.length!==g){if(F(u,g))break;g=u.issues.length}if(v==="__proto__")continue;const b=d[v],A=b._zod.optin,fe=b._zod.optout,he=b._zod.run({value:h[v],issues:[]},l);he instanceof Promise?p.push(he.then(I=>ye(I,u,v,h,A,fe))):ye(he,u,v,h,A,fe)}return o?Gt(p,h,u,l,i.value,e,m===!0):p.length?Promise.all(p).then(()=>u):u}}),Us=f("$ZodObjectJIT",(e,t)=>{xs.init(e,t);const n=e._zod.parse,r=Le(()=>qt(t)),i=R.memoizer,s=d=>{const m=r.value,g=m.symbolKeys,v=new Xi(["payload","ctx"],{shape:d,inst:e,memo:i,syms:g}),b=I=>`shape[${I}]._zod.run({ value: input[${I}], issues: [] }, ctx)`,A=(I,w)=>`\n let ${I}_ab = false;\n for (let i = 0; i < ${I}.issues.length; i++) {\n const iss = ${I}.issues[i];\n iss.path = iss.path ? [${w}, ...iss.path] : [${w}];\n payload.issues.push(iss);\n if (iss.continue !== true) ${I}_ab = true;\n }\n if (${I}_ab && ctx && ctx.abortEarly) {\n payload.value = newResult;\n return payload;\n }`;v.write("const input = payload.value;");const fe=Object.create(null);let he=0;for(const I of m.allKeys)fe[I]=`key_${he++}`;v.write(i?"const newResult = memo.alloc(inst, payload, {}, ctx);":"const newResult = {};");for(const I of m.allKeys){if(I==="__proto__")continue;const w=fe[I],D=typeof I=="symbol"?`syms[${g.indexOf(I)}]`:kr(I),pt=`${D} in input`,gr=d[I],mt=gr?._zod?.optin,_r=mt!==void 0,Mu=gr?._zod?.optout==="optional";if(v.write(`const ${w} = ${b(D)};`),_r&&Mu){const Lu=mt==="optional"?`${w}_present`:`${w}.value !== undefined || ${w}_present`;v.write(`\n const ${w}_present = ${pt};\n if (!${w}.issues.length || ${w}_present) {\n if (${w}.issues.length) {${A(w,D)}\n }\n\n if (${Lu}) {\n newResult[${D}] = ${w}.value;\n }\n }\n\n `)}else _r?(v.write(`\n if (${w}.issues.length) {${A(w,D)}\n }\n `),mt==="defaulted"?v.write(`newResult[${D}] = ${w}.value;`):v.write(`\n if (${w}.value !== undefined || ${pt}) {\n newResult[${D}] = ${w}.value;\n }\n `)):v.write(`\n const ${w}_present = ${pt};\n if (${w}.issues.length) {${A(w,D)}\n }\n if (!${w}_present && !${w}.issues.length) {\n payload.issues.push({\n code: "invalid_type",\n expected: "nonoptional",\n input: undefined,\n path: [${D}]\n });\n if (ctx && ctx.abortEarly) {\n payload.value = newResult;\n return payload;\n }\n }\n\n if (${w}_present) {\n newResult[${D}] = ${w}.value;\n }\n\n `)}return v.write("payload.value = newResult;"),v.write("return payload;"),v.compile()};let o;const c=de,a=!R.jitless,l=a&&Sr.value,h=t.catchall;let p;e._zod.parse=(d,m)=>{p??(p=r.value);const g=d.value;return c(g)?a&&l&&m?.async===!1&&m.jitless!==!0?(o||(o=s(t.shape)),d=o(d,m),h?Gt([],g,d,m,p,e,m?.abortEarly===!0):d):n(d,m):(d.issues.push({expected:"object",code:"invalid_type",input:g,inst:e}),d)}});function Ht(e,t,n,r){for(const s of e)if(s.issues.length===0)return t.value=s.value,t;const i=e.filter(s=>!F(s));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(s=>s.issues.map(o=>B(o,r,C())))}),t)}const Ks=f("$ZodUnion",(e,t)=>{k.init(e,t),y(e,"optin",r=>r.def.options.some(i=>i._zod.optin==="defaulted")?"defaulted":r.def.options.some(i=>i._zod.optin!==void 0)?"optional":void 0),y(e,"optout",r=>r.def.options.some(i=>i._zod.optout==="optional")?"optional":void 0),y(e,"values",r=>{if(r.def.options.every(i=>i._zod.values))return new Set(r.def.options.flatMap(i=>Array.from(i._zod.values)))}),y(e,"pattern",r=>{if(r.def.options.every(i=>i._zod.pattern)){const i=r.def.options.map(s=>s._zod.pattern);return new RegExp(`^(${i.map(s=>Fe(s.source)).join("|")})$`)}});const n=t.options.length===1?t.options[0]._zod.run:null;e._zod.pa)DELIM" +R"DELIM(rse=(r,i)=>{if(n)return n(r,i);let s=!1;const o=[];for(const c of t.options){const a=c._zod.run({value:r.value,issues:[]},i);if(a instanceof Promise)o.push(a),s=!0;else{if(a.issues.length===0)return a;o.push(a)}}return s?Promise.all(o).then(c=>Ht(c,r,e,i)):Ht(o,r,e,i)}}),Js=f("$ZodIntersection",(e,t)=>{k.init(e,t),e._zod.parse=(n,r)=>{const i=n.value,s=t.left._zod.run({value:i,issues:[]},r),o=t.right._zod.run({value:i,issues:[]},r);return s instanceof Promise||o instanceof Promise?Promise.all([s,o]).then(([a,u])=>Yt(n,a,u)):Yt(n,s,o)}});function et(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(Y(e)&&Y(t)){const n=Object.keys(t),r=Object.keys(e).filter(s=>n.indexOf(s)!==-1),i={...e,...t};Object.prototype.hasOwnProperty.call(i,"__proto__")&&delete i.__proto__;for(const s of r){if(s==="__proto__")continue;const o=et(e[s],t[s]);if(!o.valid)return{valid:!1,mergeErrorPath:[s,...o.mergeErrorPath]};i[s]=o.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let r=0;r{let h;if(u.code==="unrecognized_keys"&&!u.path?.length)i??(i=u),h=u.keys;else if(u.code==="invalid_key"&&u.origin==="record"&&u.path?.length===1){const p=String(u.path[0]);s.has(p)||s.set(p,u),h=[p]}else return!1;for(const p of h)r.has(p)||r.set(p,{}),r.get(p)[l]=!0;return!0};for(const u of t.issues)o(u,"l")||e.issues.push(u);for(const u of n.issues)o(u,"r")||e.issues.push(u);const c=[...r].filter(([,u])=>u.l&&u.r).map(([u])=>u);if(c.length){const u=i?c.filter(l=>i.keys.includes(l)):[];u.length&&e.issues.push({...i,keys:u});for(const l of c)!u.includes(l)&&s.has(l)&&e.issues.push(s.get(l))}const a=et(t.value,n.value);if(!a.valid){if(F(e))return e;throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(a.mergeErrorPath)}`)}return e.value=a.data,e}const Bs=f("$ZodTuple",(e,t)=>{k.init(e,t);const n=t.items,r=R.memoizer;r?.attach(e),e._zod.parse=(i,s)=>{const o=i.value;if(!Array.isArray(o))return i.issues.push({input:o,inst:e,expected:"tuple",code:"invalid_type"}),i;i.value=r?r.alloc(e,i,[],s):[];const c=[],a=Xt(n,"optin"),u=Xt(n,"optout");if(!t.rest){if(o.lengthn.length&&i.issues.push({code:"too_big",maximum:n.length,inclusive:!0,input:o,inst:e,origin:"array"})}const l=new Array(n.length),h=t.rest?s?.abortEarly:void 0;let p=!1;for(let d=0;d{l[d]=g})):(l[d]=m,h&&!p&&m.issues.length&&(p=F(m)))}if(t.rest&&!p){let d=n.length-1;const m=o.slice(n.length);let g=i.issues.length;for(const v of m){if(h&&i.issues.length!==g){if(F(i,g))break;g=i.issues.length}d++;const b=t.rest._zod.run({value:v,issues:[]},s);b instanceof Promise?c.push(b.then(A=>Qt(A,i,d))):Qt(b,i,d)}}return c.length?Promise.all(c).then(()=>en(l,i,n,o,u)):en(l,i,n,o,u)}});function Xt(e,t){for(let n=e.length-1;n>=0;n--)if(!(t==="optin"?e[n]._zod.optin!==void 0:e[n]._zod.optout==="optional"))return n+1;return 0}function Qt(e,t,n){e.issues.length&&t.issues.push(...J(n,e.issues)),t.value[n]=e.value}function en(e,t,n,r,i){for(let s=0;s=i&&n[s]._zod.optin==="optional"){t.value.length=s;break}if(o.issues.length){if(!c&&s>=i){t.value.length=s;break}t.issues.push(...J(s,o.issues))}t.value[s]=o.value}for(let s=t.value.length-1;s>=r.length&&(n[s]._zod.optout==="optional"&&t.value[s]===void 0);s--)t.value.length=s;return t}const Vs=f("$ZodRecord",(e,t)=>{k.init(e,t);const n=R.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{const s=r.value;if(!Y(s))return r.issues.push({expected:"record",code:"invalid_type",input:s,inst:e}),r;const o=[],c=t.keyType._zod.values;if(c&&!t.partial){r.value=n?n.alloc(e,r,{},i):{};const a=new Set;for(const l of c)if(typeof l=="string"||typeof l=="number"||typeof l=="symbol"){if(a.add(typeof l=="number"?l.toString():l),l==="__proto__")continue;const h=t.keyType._zod.run({value:l,issues:[]},i);if(h instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(h.issues.length){r.issues.push({code:"invalid_key",origin:"record",issues:h.issues.map(m=>B(m,i,C())),input:l,path:[l],inst:e});continue}const p=h.value;if(p==="__proto__")continue;const d=t.valueType._zod.run({value:s[l],issues:[]},i);d instanceof Promise?o.push(d.then(m=>{m.issues.length&&r.issues.push(...J(l,m.issues)),r.value[p]=m.value})):(d.issues.length&&r.issues.push(...J(l,d.issues)),r.value[p]=d.value)}let u;for(const l in s)if(!a.has(l))if(t.mode==="loose"){if(l==="__proto__")continue;r.value[l]=s[l]}else u=u??[],u.push(l);u&&u.length>0&&r.issues.push({code:"unrecognized_keys",input:s,inst:e,keys:u,continue:!0})}else{r.value=n?n.alloc(e,r,{},i):{};let a;for(const u of Reflect.ownKeys(s)){if(u==="__proto__"||!Object.prototype.propertyIsEnumerable.call(s,u))continue;let l=t.keyType._zod.run({value:u,issues:[]},i);if(l instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof u=="string"&&He.test(u)&&l.issues.length){const m=t.keyType._zod.run({value:Number(u),issues:[]},i);if(m instanceof Promise)throw new Error("Async schemas not supported in object keys currently");m.issues.length===0&&(l=m)}if(l.issues.length){t.mode==="loose"?r.value[u]=s[u]:c?(a=a??[],a.push(u)):r.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map(m=>B(m,i,C())),input:u,path:[u],inst:e});continue}const p=l.value;if(p==="__proto__")continue;const d=t.valueType._zod.run({value:s[u],issues:[]},i);d instanceof Promise?o.push(d.then(m=>{m.issues.length&&r.issues.push(...J(u,m.issues)),r.value[p]=m.value})):(d.issues.length&&r.issues.push(...J(u,d.issues)),r.value[p]=d.value)}a&&a.length>0&&r.issues.push({code:"unrecognized_keys",input:s,inst:e,keys:a,continue:!0})}return o.length?Promise.all(o).then(()=>r):r}}),Ws=f("$ZodEnum",(e,t)=>{k.init(e,t);const n=je(t.entries),r=new Set(n);e._zod.values=r,y(e,"pattern",i=>{const s=je(i.def.entries).filter(o=>$r.has(typeof o));return new RegExp(s.length?`^(${s.map(o=>pe(o.toString())).join("|")})$`:"^[^\\\\s\\\\S]$")}),e._zod.parse=(i,s)=>{const o=i.value;return r.has(o)||i.issues.push({code:"invalid_value",values:n,input:o,inst:e}),i}}),qs=f("$ZodTransform",(e,t)=>{k.init(e,t),e._zod.optin="optional",R.memoizer?.guard(e),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new Zt(e.constructor.name);const i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(o=>(n.value=o,n));if(i instanceof Promise)throw new G;return n.value=i,n}});function tn(e,t){return e.value=t.issues.length?void 0:t.value,e}const nn=f("$ZodOptional",(e,t)=>{k.init(e,t),y(e,"optin",n=>n.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),e._zod.optout="optional",y(e,"values",n=>{const r=n.def.innerType._zod.values;return r?new Set([...r,void 0]):void 0}),y(e,"pattern",n=>{const r=n.def.innerType._zod.pattern;return r?new RegExp(`^(${Fe(r.source)})?$`):void 0}),e._zod.parse=(n,r)=>{if(n.value===void 0){if(t.innerType._zod.optin!=="defaulted")return n;const i=t.innerType._zod.run({value:n.value,issues:[]},r);return i instanceof Promise?i.then(s=>tn(n,s)):tn(n,i)}return t.innerType._zod.run(n,r)}}),Gs=f("$ZodExactOptional",(e,t)=>{nn.init(e,t),y(e,"values",n=>n.def.innerType._zod.values),y(e,"pattern",n=>n.def.innerType._zod.pattern),e._zod.parse=(n,r)=>t.innerType._zod.run(n,r)}),Hs=f("$ZodNullable",(e,t)=>{k.init(e,t),y(e,"optin",n=>n.def.innerType._zod.optin),y(e,"optout",n=>n.def.innerType._zod.optout),y(e,"pattern",n=>{const r=n.def.innerType._zod.pattern;return r?new RegExp(`^($)DELIM" +R"DELIM({Fe(r.source)}|null)$`):void 0}),y(e,"values",n=>n.def.innerType._zod.values?new Set([...n.def.innerType._zod.values,null]):void 0),e._zod.parse=(n,r)=>n.value===null?n:t.innerType._zod.run(n,r)}),Ys=f("$ZodDefault",(e,t)=>{k.init(e,t),e._zod.optin="defaulted",y(e,"values",n=>n.def.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);if(n.value===void 0)return n.value=t.defaultValue,n;const i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(s=>rn(s,t)):rn(i,t)}});function rn(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const Xs=f("$ZodPrefault",(e,t)=>{k.init(e,t),e._zod.optin="defaulted",y(e,"values",n=>n.def.innerType._zod.values),e._zod.parse=(n,r)=>(r.direction==="backward"||n.value===void 0&&(n.value=t.defaultValue),t.innerType._zod.run(n,r))}),Qs=f("$ZodNonOptional",(e,t)=>{k.init(e,t),y(e,"values",n=>{const r=n.def.innerType._zod.values;return r?new Set([...r].filter(i=>i!==void 0)):void 0}),e._zod.parse=(n,r)=>{const i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(s=>sn(s,e)):sn(i,e)}});function sn(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}function on(e,t,n,r){return t.issues.length?(e.value=n.catchValue({...t,value:e.value,error:{issues:t.issues.map(i=>B(i,r,C()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}const eo=f("$ZodCatch",(e,t)=>{k.init(e,t),y(e,"optin",n=>n.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),y(e,"optout",n=>n.def.innerType._zod.optout),y(e,"values",n=>n.def.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);const i=t.innerType._zod.run({value:n.value,issues:[]},r);return i instanceof Promise?i.then(s=>on(n,s,t,r)):on(n,i,t,r)}}),to=f("$ZodPipe",(e,t)=>{k.init(e,t),y(e,"values",n=>n.def.in._zod.values),y(e,"optin",n=>n.def.in._zod.optin),y(e,"optout",n=>n.def.out._zod.optout),y(e,"propValues",n=>n.def.in._zod.propValues),e._zod.parse=(n,r)=>{if(r.direction==="backward"){const s=t.out._zod.run(n,r);return s instanceof Promise?s.then(o=>we(o,t.in,r)):we(s,t.in,r)}const i=t.in._zod.run(n,r);return i instanceof Promise?i.then(s=>we(s,t.out,r)):we(i,t.out,r)}});function we(e,t,n){return e.issues.some(r=>r.code!=="unrecognized_keys")?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}const no=f("$ZodReadonly",(e,t)=>{k.init(e,t),y(e,"propValues",n=>n.def.innerType._zod.propValues),y(e,"values",n=>n.def.innerType._zod.values),y(e,"optin",n=>n.def.innerType?._zod?.optin),y(e,"optout",n=>n.def.innerType?._zod?.optout),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);const i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(cn):cn(i)}});function cn(e){return e.memo||(e.value=Object.freeze(e.value)),e}const ro=f("$ZodCustom",(e,t)=>{Z.init(e,t),k.init(e,t),e._zod.parse=(n,r)=>n,e._zod.check=n=>{const r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(s=>an(s,n,r,e));an(i,n,r,e)}});function an(e,t,n,r){if(!e){const i={code:"custom",input:n,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(ie(i))}}class io extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform"),this.name="ZodCyclicError"}}const tt="~memo",un=[];function ln(e){return e!==null&&typeof e=="object"}function nt(e){return e.map(t=>t.path?{...t,path:t.path.slice()}:{...t})}const fn=new WeakMap,se=0,ke=1,oe=2;function ze(e,t,n){const r=fn.get(e);if(r!==void 0)return r?oe:se;if(t.has(e))return oe;t.add(e);let i=se;const s=l=>{if(i!==oe&&l?._zod){const h=ze(l,t);h>i&&(i=h)}},o=(l,h)=>{let p=se;for(const d of Reflect.ownKeys(l)){const m=Object.getOwnPropertyDescriptor(l,d);if(!m.enumerable)continue;const g=m.get?ke:m.value?._zod?ze(m.value,t):se;g>p&&(p=g)}return p},c=l=>{l>i&&(i=l)},a=e._zod.def;switch(a.type){case"object":{const l=_t(a);c(l?o(l):ke),s(a.catchall);break}case"array":s(a.element);break;case"tuple":for(const l of a.items)s(l);s(a.rest);break;case"record":case"map":s(a.keyType),s(a.valueType);break;case"set":s(a.valueType);break;case"union":for(const l of a.options)s(l);break;case"intersection":s(a.left),s(a.right);break;case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":s(a.innerType);break;case"pipe":s(a.in),s(a.out);break;case"function":s(a.input),s(a.output);break;case"lazy":{const l=a._cachedInner??void 0;c(l?ze(l,t):ke);break}case"template_literal":case"string":case"number":case"int":case"boolean":case"bigint":case"symbol":case"undefined":case"null":case"void":case"never":case"any":case"unknown":case"date":case"nan":case"enum":case"literal":case"file":case"transform":case"custom":break;default:for(const l in a){const h=Object.getOwnPropertyDescriptor(a,l);if(!h||h.get)continue;const p=h.value;if(!(!p||typeof p!="object")){if(p._zod)s(p);else if(Array.isArray(p))for(const d of p)s(d)}}}return t.delete(e),so(e,i)}function so(e,t){return t!==ke&&fn.set(e,t===oe),t}function oo(e,t){let n=e.buckets.get(t);return n||(n=new WeakMap,e.buckets.set(t,n)),n}let Se;const $e=[],co={alloc(e,t,n){const r=Se;if(!r)return n;Se=void 0;const i={value:n,issues:null};return r.set(t.value,i),$e.push(i),n},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{const n=e._zod.parse,r=(i,s)=>{if(s.direction!=="backward"&&uo(s,i.value))throw new io;return n(i,s)};e._zod.parse=r,e._zod.run===n&&(e._zod.run=r)})},attach(e){var t;let n,r=!1,i,s;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{const o=e._zod.parse,c=(a,u)=>{if(n===void 0){const b=ze(e,new Set);if(b===se)return e._zod.parse=o,e._zod.run===c&&(e._zod.run=o),o(a,u);b===oe||r?n=!0:r=!0}const l=a.value;if(!ln(l))return o(a,u);let h=u[tt];h||(h={buckets:new WeakMap,backEdges:void 0},u[tt]=h);let p;i===u?p=s:(p=oo(h,e),i=u,s=p);const d=p.get(l);if(d)return a.value=d.value,d.issues?d.issues.length&&a.issues.push(...nt(d.issues)):(a.memo=!0,h.backEdges??(h.backEdges=new WeakSet),h.backEdges.add(d.value)),a;Se=p;const m=$e.length,g=o(a,u);Se=void 0;const v=$e.length>m?$e.pop():void 0;return g instanceof Promise?g.then(b=>(v&&(v.issues=b.issues.length?nt(b.issues):un),b)):(v&&(v.issues=g.issues.length?nt(g.issues):un),g)};e._zod.parse=c,e._zod.run===o&&(e._zod.run=c)})}};function ao(){return co}function uo(e,t){const n=e[tt]?.backEdges;return n!==void 0&&ln(t)&&n.has(t)}const lo=()=>{const e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function t(s){return e[s]??null}const n={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",currency_code:"currency code",credit_card:"credit card number",iban:"IBAN",jwt:"JWT",template_literal:"input"},r={nan:"NaN"};function i(s,o){return s==="number"&&typeof o=="number"&&!Number.isFinite(o)?String(o):r[s]??s}return s=>{switch(s.code){case"invalid_type":{const o=i(s.expected),c=Mr(s.input),a=i(c,s.input);return`Invalid input: expected ${o}, received ${a}`}case"invalid_value":return s.values.length===1?`Invalid input: expected ${kt(s.values[0])}`:`Invalid option: expected one of ${gt(s.values,"|")}`;case"too_big":{const o=s.exact?"exactly ":s.inclusive?"<=":"<",c=t(s.origin);return c?`Too big: expected ${s.origin??"value"} to have ${o}${s.maximum.toString()} ${c.unit??"elements"})DELIM" +R"DELIM(`:`Too big: expected ${s.origin??"value"} to be ${o}${s.maximum.toString()}`}case"too_small":{const o=s.exact?"exactly ":s.inclusive?">=":">",c=t(s.origin);return c?`Too small: expected ${s.origin} to have ${o}${s.minimum.toString()} ${c.unit}`:`Too small: expected ${s.origin} to be ${o}${s.minimum.toString()}`}case"invalid_format":{const o=s;return o.format==="starts_with"?`Invalid string: must start with "${o.prefix}"`:o.format==="ends_with"?`Invalid string: must end with "${o.suffix}"`:o.format==="includes"?`Invalid string: must include "${o.includes}"`:o.format==="regex"?`Invalid string: must match pattern ${o.pattern}`:`Invalid ${n[o.format]??s.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${s.divisor}`;case"unrecognized_keys":return`Unrecognized key${s.keys.length>1?"s":""}: ${gt(s.keys,", ")}`;case"invalid_key":return`Invalid key in ${s.origin}`;case"invalid_union":return s.options&&Array.isArray(s.options)&&s.options.length>0?`Invalid discriminator value. Expected ${s.options.map(c=>`\'${c}\'`).join(" | ")}`:s.inclusive===!1?"Invalid input: more than one option matched":"Invalid input";case"invalid_element":return`Invalid value in ${s.origin}`;default:return"Invalid input"}}};function fo(){return{localeError:lo()}}var hn;class ho{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...n){const r=n[0];return this._map.set(t,r),r&&typeof r=="object"&&"id"in r&&this._idmap.set(r.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){const n=this._map.get(t);return n&&typeof n=="object"&&"id"in n&&this._idmap.delete(n.id),this._map.delete(t),this}get(t){const n=t._zod.parent;if(n){const r={...this.get(n)??{}};delete r.id;const 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 po(){return new ho}(hn=globalThis).__zod_globalRegistry??(hn.__zod_globalRegistry=po());const ce=globalThis.__zod_globalRegistry;function dn(e){return e.checks&&(e.checks=[...e.checks]),e}function mo(e,t){return new e(dn({type:"string",..._(t)}))}function go(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,..._(t)})}function _o(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,..._(t)})}function vo(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,..._(t)})}function bo(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",..._(t)})}function yo(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",..._(t)})}function wo(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",..._(t)})}function ko(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,..._(t)})}function zo(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,..._(t)})}function So(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,..._(t)})}function $o(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,..._(t)})}function Oo(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,..._(t)})}function Eo(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,..._(t)})}function Io(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,..._(t)})}function To(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,..._(t)})}function Po(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,..._(t)})}function Zo(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,..._(t)})}function Ao(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,..._(t)})}function No(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,..._(t)})}function Ro(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,..._(t)})}function jo(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,..._(t)})}function Mo(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,..._(t)})}function Lo(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,..._(t)})}function Fo(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,..._(t)})}function Co(e,t){return new e({type:"string",format:"date",check:"string_format",..._(t)})}function Do(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,..._(t)})}function xo(e,t){return new e({type:"string",format:"duration",check:"string_format",..._(t)})}function Uo(e,t){return new e(dn({type:"number",checks:[],..._(t)}))}function Ko(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",..._(t)})}function Jo(e,t){return new e({type:"boolean",..._(t)})}function Bo(e){return new e({type:"unknown"})}function Vo(e,t){return new e({type:"never",..._(t)})}function pn(e,t){return new Mt({check:"less_than",..._(t),value:e,inclusive:!1})}function rt(e,t){return new Mt({check:"less_than",..._(t),value:e,inclusive:!0})}function mn(e,t){return new Lt({check:"greater_than",..._(t),value:e,inclusive:!1})}function it(e,t){return new Lt({check:"greater_than",..._(t),value:e,inclusive:!0})}function gn(e,t){return new Di({check:"multiple_of",..._(t),value:e})}function _n(e,t){return new Ui({check:"max_length",..._(t),maximum:e})}function Oe(e,t){return new Ki({check:"min_length",..._(t),minimum:e})}function vn(e,t){return new Ji({check:"length_equals",..._(t),length:e})}function Wo(e,t){return new Bi({check:"string_format",format:"regex",..._(t),pattern:e})}function qo(e){return new Vi({check:"string_format",format:"lowercase",..._(e)})}function Go(e){return new Wi({check:"string_format",format:"uppercase",..._(e)})}function Ho(e,t){return new qi({check:"string_format",format:"includes",..._(t),includes:e})}function Yo(e,t){return new Gi({check:"string_format",format:"starts_with",..._(t),prefix:e})}function Xo(e,t){return new Hi({check:"string_format",format:"ends_with",..._(t),suffix:e})}function X(e){return new Yi({check:"overwrite",tx:e})}function Qo(e){return X(t=>t.normalize(e))}function ec(){return X(e=>e.trim())}function tc(){return X(e=>e.toLowerCase())}function nc(){return X(e=>e.toUpperCase())}function rc(){return X(e=>zr(e))}function ic(e,t,n){return new e({type:"array",element:t,..._(n)})}function sc(e,t,n){return new e({type:"custom",check:"custom",fn:t,..._(n)})}function oc(e,t){const n=cc(r=>(r.addIssue=i=>{if(typeof i=="string")r.issues.push(ie(i,r.value,n._zod.def));else{const s=i;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),"input"in s||(s.input=r.value),s.inst??(s.inst=n),s.continue??(s.continue=!n._zod.def.abort),r.issues.push(ie(s))}},e(r.value,r)),t);return n}function cc(e,t){const n=new Z({check:"custom",..._(t)});return n._zod.check=e,n}function ae(e,...t){for(const n of t)for(const r of Reflect.ownKeys(n))Object.prototype.propertyIsEnumerable.call(n,r)&&U(e,r,n[r]);return e}function bn(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??ce,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??"ref",reused:e?.reused??"inline",intersections:[],deferred:[],external:e?.external??void 0}}function Q(e,t,n,r,i){const s=typeof t.unrepresentable=="function"?t.unrepresentable({zodSchema:e,path:r.path,message:i}):t.unrepresentable;if(s==="any")return!1;if(s===void 0||s==="throw")throw new Error(i);return Object.assign(n,s),!0}function O(e,t,n={path:[],schemaPath:[]}){var r;const i=e._zod.def,s=t.seen.get(e);if(s)return s.count++,n.sc)DELIM" +R"DELIM(hemaPath.includes(e)&&(s.cycle=n.path),s.schema;const o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;const c=e._zod.toJSONSchema?.();if(c)o.schema=c;else{const l={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,l);else{const p=o.schema,d=t.processors[i.type];if(!d)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);d(e,t,p,l)}const h=e._zod.parent;h&&(o.ref||(o.ref=h),O(h,t,l),t.seen.get(h).isParent=!0)}const a=t.metadataRegistry.get(e);return a&&ae(o.schema,a),t.io==="input"&&P(e)&&(delete o.schema.examples,delete o.schema.default),t.io==="input"&&"_prefault"in o.schema&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function yn(e){return e.replace(/~/g,"~0").replace(/\\//g,"~1")}function wn(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");if(e.external&&e.sharedDefsExtractedFor===e.external)return;const r=new Map;for(const o of e.seen.entries()){const c=e.metadataRegistry.get(o[0])?.id;if(c){const a=r.get(c);if(a&&a!==o[0])throw new Error(`Duplicate schema id "${c}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(c,o[0])}}const i=o=>{const c=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const h=e.external.registry.get(o[0])?.id,p=e.external.uri??(m=>m);if(h)return{ref:p(h)};const d=o[1].defId??o[1].schema.id??`schema${e.counter++}`;return o[1].defId=d,{defId:d,ref:`${p("__shared")}#/${c}/${yn(d)}`}}const a="#",u=`${a}/${c}/`;if(o[1]===n&&!o[1].schema.id)return{ref:a};const l=o[1].schema.id??`__schema${e.counter++}`;return{defId:l,ref:u+yn(l)}},s=o=>{if(o[1].schema.$ref)return;const c=o[1],{ref:a,defId:u}=i(o);c.def={...c.schema},u&&(c.defId=u);const l=c.schema;for(const h in l)delete l[h];l.$ref=a};if(e.cycles==="throw")for(const o of e.seen.entries()){const c=o[1];if(c.cycle)throw new Error(`Cycle detected: #/${c.cycle?.join("/")}/\n\nSet the \\`cycles\\` parameter to \\`"ref"\\` to resolve cyclical schemas with defs.`)}for(const o of e.seen.entries()){const c=o[1];if(t===o[0]){s(o);continue}if(e.external){const u=e.external.registry.get(o[0])?.id;if(t!==o[0]&&u){s(o);continue}}if(e.metadataRegistry.get(o[0])?.id){s(o);continue}if(c.cycle){s(o);continue}c.count>1&&e.reused==="ref"&&s(o)}e.external&&(e.sharedDefsExtractedFor=e.external)}function kn(e){const t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;const n=[];for(const r of t){if(!r||typeof r!="object")return;kn(r);const i=Object.keys(r);if(i.length!==1||i[0]!=="type")return;const s=r.type;for(const o of Array.isArray(s)?s:[s]){if(typeof o!="string")return;n.includes(o)||n.push(o)}}delete e.anyOf,e.type=n.length===1?n[0]:n}const zn=new Set(["type","properties","required","additionalProperties"]),Sn=["oneOf","anyOf"];function $n(e){const t=e.additionalProperties;return t===void 0||t===!1||typeof t!="object"||t===null?null:Object.keys(t).length?t:null}function st(e){const t=[];for(const s of e){if(typeof s!="object"||s.type!=="object")return null;for(const o in s)if(!zn.has(o))return null;t.push(s)}const n={},r=new Set;for(const s of t){for(const o in s.properties){if(Object.prototype.hasOwnProperty.call(n,o))continue;const c=[];for(const u of t){const l=u.properties?.[o]??$n(u);l!=null&&(c.some(h=>JSON.stringify(h)===JSON.stringify(l))||c.push(l))}const a=c.length===1?c[0]:st(c)??{allOf:c};U(n,o,a)}for(const o of s.required??[])r.add(o)}const i={type:"object",properties:n};if(r.size&&(i.required=[...r]),t.every(s=>s.additionalProperties===!1))i.additionalProperties=!1;else{const s=[];for(const o of t){const c=$n(o);c&&!s.some(a=>JSON.stringify(a)===JSON.stringify(c))&&s.push(c)}s.length===1?i.additionalProperties=s[0]:s.length>1&&(i.additionalProperties={allOf:s})}return i}function ac(e){const t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(const i of zn)if(i in e)return;const n=t.filter(i=>Sn.some(s=>Array.isArray(i[s])));let r=null;if(!n.length)r=st(t);else{const i=n[0],s=Sn.find(a=>Array.isArray(i[a]));if(Object.keys(i).length!==1)return;const o=t.filter(a=>a!==i),c=i[s].map(a=>st([...o,a]));if(c.some(a=>!a))return;r={[s]:c}}r&&(delete e.allOf,ae(e,r))}function On(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=c=>{const a=e.seen.get(c);if(a.ref===null)return;const u=a.def??a.schema,l={...u},h=a.ref;if(a.ref=null,h){r(h);const d=e.seen.get(h),m=d.schema;if(m.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(u.allOf=u.allOf??[],u.allOf.push(m)):ae(u,m),ae(u,l),c._zod.parent===h)for(const v in u)v==="$ref"||v==="allOf"||v in l||delete u[v];if(m.$ref&&d.def)for(const v in u)v==="$ref"||v==="allOf"||v in d.def&&JSON.stringify(u[v])===JSON.stringify(d.def[v])&&delete u[v]}const p=c._zod.parent;if(p&&p!==h){r(p);const d=e.seen.get(p);if(d?.schema.$ref&&(u.$ref=d.schema.$ref,d.def))for(const m in u)m==="$ref"||m==="allOf"||m in d.def&&JSON.stringify(u[m])===JSON.stringify(d.def[m])&&delete u[m]}e.override({zodSchema:c,jsonSchema:u,path:a.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(const c of[...e.seen.entries()].reverse())r(c[0]);if(e.target!=="openapi-3.0")for(const c of e.seen.entries())kn(c[1].def??c[1].schema);for(const c of e.deferred)c();if(e.intersections.length){const c=new Map;for(const a of e.seen.values())for(const u of[a.schema,a.def]){const l=u?.allOf;if(!Array.isArray(l))continue;const h=c.get(l);h?h.push(u):c.set(l,[u])}for(const a of e.intersections)for(const u of c.get(a)??[])ac(u)}}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)}ae(i,n.defId?n.schema:n.def??n.schema);const s=e.metadataRegistry.get(t)?.id;s!==void 0&&i.id===s&&delete i.id;const o=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(const c of e.seen.entries()){const a=c[1];a.def&&a.defId&&(a.def.id===a.defId&&delete a.def.id,U(o,a.defId,a.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(o).length>0&&(e.target==="draft-2020-12"?i.$defs=o:i.definitions=o);try{const c=JSON.parse(JSON.stringify(i));return Object.defineProperty(c,"~standard",{value:{...t["~standard"],jsonSchema:{input:Ee(t,"input",e.processors),output:Ee(t,"output",e.processors)}},enumerable:!1,writable:!1}),c}catch{throw new Error("Error converting schema to JSON.")}}function P(e,t){const n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);const r=e._zod.def;if(r.type==="transform")return!0;if(r.type==="array")return P(r.element,n);if(r.type==="set")return P(r.valueType,n);if(r.type==="lazy")return P(r.getter(),n);if(r.type==="promise"||r.type==="optional"||r.type==="nonoptional"||r.type==="nullable"||r.type==="readonly"||r.type==="default"||r.type==="prefault"||r.type==="catch")return P(r.innerType,n);if(r.type==="intersection")return P(r.left,n)||P(r.right,n);if(r.type==="record"||r.type==="map")return P(r.keyType,n)||P(r.valueType,n);if(r.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:P(r.in,n)||P(r.out,n);if(r.type==="object"){for(const i in r.shape)if(P(r.shape[i],n))return!0;return!1}if(r.type==="union"){for(const i of r.options)if(P(i,n))return!0;return!1}if(r.type==="tuple"){for(const i of r.items)if(P(i,n))return!0;return!!(r.rest&&P(r.rest,n))}return!1}const uc=(e,t={})=>n=>{const r=bn({...n,processors:t});return O(e,r),wn(r,e),On(r,e)},Ee=(e,t,n={})=>r=>{const{libraryOptions:i,target:s}=r??{},o=bn({...i??{},target:s,io:t,processors:n});return O(e,o)DELIM" +R"DELIM(),wn(o,e),On(o,e)},ee=(e,t,n)=>{(e[t]===void 0||n>e[t])&&(e[t]=n)},te=(e,t,n)=>{(e[t]===void 0||n{ee(e,"minimum",t),te(e,"maximum",t)},In=(e,t)=>{e.multipleOf??(e.multipleOf=[]),e.multipleOf.includes(t)||e.multipleOf.push(t)},Tn=(e,t)=>{e.patterns??(e.patterns=new Set),e.patterns.add(t)},Pn=(e,t)=>{e.mime=e.mime?e.mime.filter(n=>t.includes(n)):[...t]},Zn=(e,t)=>{e.format=t,t.includes("int")&&(e.isInt=!0)},An=(e,t)=>ee(e,"minimum",t.minimum),Nn=(e,t)=>te(e,"maximum",t.maximum),Rn=e=>(t,n)=>{Zn(t,n.format);const[r,i]=e[n.format];ee(t,"minimum",r),te(t,"maximum",i)},lc={greater_than:(e,t)=>ee(e,t.inclusive?"minimum":"exclusiveMinimum",t.value),less_than:(e,t)=>te(e,t.inclusive?"maximum":"exclusiveMaximum",t.value),multiple_of:(e,t)=>In(e,t.value),number_format:Rn(zt),bigint_format:Rn(Er),min_length:An,max_length:Nn,length_equals:(e,t)=>En(e,t.length),min_size:An,max_size:Nn,size_equals:(e,t)=>En(e,t.size),string_format:(e,t)=>{Zn(e,t.format),t.pattern&&Tn(e,t.pattern),(t.format==="base64"||t.format==="base64url")&&(e.contentEncoding=t.format),(t.local||t.precision===-1)&&(e.laxFormat=!0)},mime_type:(e,t)=>Pn(e,t.mime)};function j(e){const t={},n=e._zod.def,r=e._zod.traits.has("$ZodCheck")?[e,...n.checks??[]]:n.checks??[];for(const s of r)lc[s._zod.def.check]?.(t,s._zod.def);const i=e._zod.bag;i.minimum!==void 0&&ee(t,"minimum",i.minimum),i.exclusiveMinimum!==void 0&&ee(t,"exclusiveMinimum",i.exclusiveMinimum),i.maximum!==void 0&&te(t,"maximum",i.maximum),i.exclusiveMaximum!==void 0&&te(t,"exclusiveMaximum",i.exclusiveMaximum),i.multipleOf!==void 0&&In(t,i.multipleOf),i.format!==void 0&&(t.format??(t.format=i.format),i.format.includes("int")&&(t.isInt=!0)),i.mime&&Pn(t,i.mime);for(const s of i.patterns??[])Tn(t,s);return t}const fc={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},hc=new Map([[Bt,Ei],[Qe,Ii]]),jn=e=>hc.get(e)??e,dc=(e,t,n,r)=>{const i=n;i.type="string";const{minimum:s,maximum:o,format:c,patterns:a,contentEncoding:u,laxFormat:l}=j(e);if(typeof s=="number"&&(i.minLength=s),typeof o=="number"&&(i.maxLength=o),c&&(i.format=fc[c]??c,i.format===""&&delete i.format,(c==="time"||l)&&delete i.format),u&&(i.contentEncoding=u),a&&a.size>0){const h=[...a].map(jn);h.length===1?i.pattern=h[0].source:h.length>1&&(i.allOf=[...h.map(p=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:p.source}))])}},pc=(e,t,n,r)=>{const i=n,{minimum:s,maximum:o,multipleOf:c,exclusiveMaximum:a,exclusiveMinimum:u,isInt:l}=j(e);i.type=l?"integer":"number";const h=typeof u=="number"&&u>=(s??Number.NEGATIVE_INFINITY),p=typeof a=="number"&&a<=(o??Number.POSITIVE_INFINITY),d=t.target==="draft-04"||t.target==="openapi-3.0";if(h?d?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u:typeof s=="number"&&(i.minimum=s),p?d?(i.maximum=a,i.exclusiveMaximum=!0):i.exclusiveMaximum=a:typeof o=="number"&&(i.maximum=o),c){const m=new Set;for(const b of c)Number.isFinite(b)&&b!==0?m.add(Math.abs(b)):Q(e,t,i,r,`A multipleOf divisor of ${b} cannot be represented in JSON Schema`);const[g,...v]=m;g!==void 0&&(i.multipleOf=g),v.length&&(i.allOf=[...i.allOf??[],...v.map(b=>({multipleOf:b}))])}},mc=(e,t,n,r)=>{n.type="boolean"},gc=(e,t,n,r)=>{n.not={}},_c=(e,t,n,r)=>{},vc=(e,t,n,r)=>{const i=e._zod.def,s=je(i.entries);if(s.length===0){n.not={};return}s.every(o=>typeof o=="number")&&(n.type="number"),s.every(o=>typeof o=="string")&&(n.type="string"),n.enum=s},bc=(e,t,n,r)=>{Q(e,t,n,r,"Custom types cannot be represented in JSON Schema")},yc=(e,t,n,r)=>{Q(e,t,n,r,"Transforms cannot be represented in JSON Schema")},wc=(e,t,n,r)=>{const i=n,s=e._zod.def,{minimum:o,maximum:c}=j(e);typeof o=="number"&&(i.minItems=o),typeof c=="number"&&(i.maxItems=c),i.type="array",i.items=O(s.element,t,{...r,path:[...r.path,"items"]})};function ue(e){const t=e._zod.def;return t.type==="pipe"&&t.in._zod.traits.has("$ZodTransform")?ue(t.out):t.type==="catch"?ue(t.innerType):e._zod.optin}const kc=(e,t,n,r)=>{const i=n,s=e._zod.def,o=s.shape;if(Object.getOwnPropertySymbols(o).length&&Q(e,t,i,r,"Symbol keys cannot be represented in JSON Schema"))return;i.type="object",i.properties={};for(const u in o)U(i.properties,u,O(o[u],t,{...r,path:[...r.path,"properties",u]}));const a=[];for(const u of Object.keys(o)){const l=s.shape[u];(t.io==="input"?ue(l)===void 0:l._zod.optout===void 0)&&a.push(u)}a.length>0&&(i.required=a),s.catchall?._zod.def.type==="never"?i.additionalProperties=!1:s.catchall?s.catchall&&(i.additionalProperties=O(s.catchall,t,{...r,path:[...r.path,"additionalProperties"]})):t.io==="output"&&(i.additionalProperties=!1)},zc=(e,t,n,r)=>{const i=e._zod.def,s=i.inclusive===!1,o=i.options.map((c,a)=>O(c,t,{...r,path:[...r.path,s?"oneOf":"anyOf",a]}));s?n.oneOf=o:n.anyOf=o},Sc=(e,t,n,r)=>{const i=e._zod.def,s=O(i.left,t,{...r,path:[...r.path,"allOf",0]}),o=O(i.right,t,{...r,path:[...r.path,"allOf",1]}),c=u=>"allOf"in u&&Object.keys(u).length===1,a=[...c(s)?s.allOf:[s],...c(o)?o.allOf:[o]];n.allOf=a,t.intersections.push(a)},$c=(e,t,n,r)=>{const i=n,s=e._zod.def;i.type="array";const o=t.target==="draft-2020-12"?"prefixItems":"items",c=t.target==="draft-2020-12"||t.target==="openapi-3.0"?"items":"additionalItems",a=s.items.map((g,v)=>O(g,t,{...r,path:[...r.path,o,v]})),u=s.rest?O(s.rest,t,{...r,path:[...r.path,c,...t.target==="openapi-3.0"?[s.items.length]:[]]}):null;let l=s.items.length;for(;l>0;){const g=s.items[l-1];if(!(t.io==="input"?ue(g)!==void 0:g._zod.optout==="optional"))break;l--}const h=s.items.length,p=!s.rest;t.target==="draft-2020-12"?(i.prefixItems=a,p?i.items=!1:u&&(i.items=u),l>0&&(i.minItems=l),p&&(i.maxItems=h)):t.target==="openapi-3.0"?(i.items={anyOf:a},u&&i.items.anyOf.push(u),l>0&&(i.minItems=l),p&&(i.maxItems=h)):(i.items=a,p?i.additionalItems=!1:u&&(i.additionalItems=u),l>0&&(i.minItems=l),p&&(i.maxItems=h));const{minimum:d,maximum:m}=j(e);typeof d=="number"&&(i.minItems=d),typeof m=="number"&&(i.maxItems=m)};function ot(e,t,n){if(t.$ref){if(n.has(t))return t;n.add(t);const m=e.get(t)?.def;if(!m)return t;const g=ot(e,m,n);return g===m?t:g}for(const m of["anyOf","oneOf"]){const g=t[m];if(!Array.isArray(g))continue;const v=g.map(b=>ot(e,b,n));v.some((b,A)=>b!==g[A])&&(t={...t,[m]:v})}const r=Array.isArray(t.type)?t.type:[t.type],i=!r.includes("string")&&r.some(m=>m==="number"||m==="integer"),s=t.enum??(t.const!==void 0?[t.const]:void 0);if(!i&&!s?.some(m=>typeof m=="number"))return t;const{minimum:o,maximum:c,exclusiveMinimum:a,exclusiveMaximum:u,multipleOf:l,format:h,id:p,...d}=t;return d.enum?d.enum=d.enum.map(m=>typeof m=="number"?String(m):m):typeof d.const=="number"&&(d.const=String(d.const)),i&&(d.type="string",s||(d.pattern=(r.includes("number")?He:Mi).source)),d}const ct=new WeakMap;function Oc(e){const t=new Map;for(const r of e.seen.values())r.def&&!t.has(r.schema)&&t.set(r.schema,r);const n=new Map;for(const r of ct.get(e)??[]){const i=e.seen.get(r),s=(i?.def??i?.schema)?.propertyNames;if(!s||s===!0||n.has(s))continue;const o=ot(t,s,new Set);o!==s&&n.set(s,o)}if(n.size)for(const r of e.seen.values())for(const i of[r.schema,r.def]){const s=i&&n.get(i.propertyNames);s&&(i.propertyNames=s)}}const Ec=(e,t,n,r)=>{const i=n,s=e._zod.def;i.type="object";const o=s.keyType,c=j(o).patterns;if(s.mode==="loose"&&c&&c.size>0){const l=O(s.valueType,t,{...r,path:[...r.path,"patternProperties","*"]});i.patternProperties={};for(const h of c)U(i.patternProperties,jn(h).source,l)}else{if(t.target==="draft-07"||t.target==="draft-2020-12"){i.propertyNames=O(s.keyType,t,{...r,path:[...r.path,"propertyNames"]});let l=ct.get(t);l||(l=[],ct.set(t,l),t.deferred.push(()=>Oc(t))),l.push(e)}i.additionalProperties=O(s.valueType,t,{...r,path:[...r.path,"additionalProperties"]})}const a=o._zod.values,u=t.io==="input"&&ue(s.valueType)!==void 0;if(a&&!s.partial&&!u){const l=[...a].filter(h=>typeof h=="string"||typeof h=="number");l.length>0&&(i.required=l.map(String))}},Ic=(e,t,n,r)=>{const i=e._zod.def,s)DELIM" +R"DELIM(=O(i.innerType,t,r),o=t.seen.get(e);t.target==="openapi-3.0"?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[s,{type:"null"}]},Tc=(e,t,n,r)=>{const i=e._zod.def;O(i.innerType,t,r);const s=t.seen.get(e);s.ref=i.innerType},at=Symbol();function Mn(e,t,n,r,i){let s=!1;const o=JSON.stringify(e,(c,a)=>typeof a!="bigint"?a:(s=!0,null));return s?(Q(t,n,r,i,"BigInt defaults cannot be represented in JSON Schema"),at):JSON.parse(o)}const Pc=(e,t,n,r)=>{const i=e._zod.def;O(i.innerType,t,r);const s=t.seen.get(e);s.ref=i.innerType;const o=Mn(i.defaultValue,e,t,n,r);o!==at&&(n.default=o)},Zc=(e,t,n,r)=>{const i=e._zod.def;O(i.innerType,t,r);const s=t.seen.get(e);if(s.ref=i.innerType,t.io!=="input")return;const o=Mn(i.defaultValue,e,t,n,r);o!==at&&(n._prefault=o)},Ac=(e,t,n,r)=>{const i=e._zod.def;O(i.innerType,t,r);const s=t.seen.get(e);s.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{Q(e,t,n,r,"Dynamic catch values are not supported in JSON Schema");return}n.default=o},Nc=(e,t,n,r)=>{const i=e._zod.def,s=i.in._zod.traits.has("$ZodTransform"),o=t.io==="input"?s?i.out:i.in:i.out;O(o,t,r);const c=t.seen.get(e);c.ref=o},Rc=(e,t,n,r)=>{const i=e._zod.def;O(i.innerType,t,r);const s=t.seen.get(e);s.ref=i.innerType,n.readOnly=!0},Ln=(e,t,n,r)=>{const i=e._zod.def;O(i.innerType,t,r);const s=t.seen.get(e);s.ref=i.innerType},Fn=new WeakSet([Object.prototype,Error.prototype]);function Ie(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){const r=n(this);return Object.defineProperty(this,t,{value:r,configurable:!0,writable:!0}),r},set(r){Object.defineProperty(this,t,{value:r,configurable:!0,writable:!0})}})}const M=f("ZodError",(e,t)=>{qr.init(e,t),e.name="ZodError";const n=Object.getPrototypeOf(e);Fn.has(n)||(Fn.add(n),Ie(n,"format",r=>i=>Yr(r,i)),Ie(n,"flatten",r=>i=>Hr(r,i)),Ie(n,"addIssue",r=>i=>{r.issues.push(i),r.message=JSON.stringify(r.issues,Me,2)}),Ie(n,"addIssues",r=>i=>{r.issues.push(...i),r.message=JSON.stringify(r.issues,Me,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},void 0,{Parent:Error}),jc=Be(M),Mc=Ve(M),Lc=We(M),Fc=qe(M),Cc=ri(M),Dc=ii(M),xc=si(M),Uc=oi(M),Kc=ci(M),Jc=ai(M),Bc=ui(M),Vc=li(M);function Wc(){R.localeError||C(fo())}function le(){R.memoizer||C({memoizer:ao()})}const S=f("ZodType",(e,t)=>(Wc(),k.init(e,t),e.def=t,e.type=t.type,e),{check(...e){const t=this.def;return this.clone(N(t,{checks:[...t.checks??[],...e.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return K(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(Va(e,t))},superRefine(e,t){return this.check(Wa(e,t))},overwrite(e){return this.check(X(e))},optional(){return Vn(this)},exactOptional(){return Na(this)},nullable(){return qn(this)},nullish(){return Vn(qn(this))},nonoptional(e){return Ca(this,e)},array(){return Kn(this)},or(e){return Jn([this,e])},and(e){return Oa(this,e)},transform(e){return Hn(this,Aa(e))},default(e){return Ma(this,e)},prefault(e){return Fa(this,e)},catch(e){return xa(this,e)},pipe(e){return Hn(this,e)},readonly(){return Ja(this)},describe(e){const t=this.clone();return ce.add(t,{description:e}),t},meta(...e){if(e.length===0)return ce.get(this);const t=this.clone();return ce.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get"~standard"(){return Et(this,"~standard",{...Ct(this),jsonSchema:{input:Ee(this,"input"),output:Ee(this,"output")}})},set"~standard"(e){V(this,"~standard",e)},parse:function e(t,n){return jc(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await Mc(this,t,n,{callee:e})},safeParse(e,t){return Lc(this,e,t)},async safeParseAsync(e,t){return Fc(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){V(this,"spa",e)},validate(e,t){return ei(this,e,t)},validateAsync(e,t){return ni(this,e,t)},encode:function e(t,n){return Cc(this,t,n,{callee:e})},decode:function e(t,n){return Dc(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await xc(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await Uc(this,t,n,{callee:e})},safeEncode(e,t){return Kc(this,e,t)},safeDecode(e,t){return Jc(this,e,t)},async safeEncodeAsync(e,t){return Bc(this,e,t)},async safeDecodeAsync(e,t){return Vc(this,e,t)},toJSONSchema(e){return uc(this,{})(e)},get description(){return ce.get(this)?.description},get _def(){return this._zod.def}}),Cn=f("_ZodString",(e,t)=>{Xe.init(e,t),S.init(e,t),e._zod.processJSONSchema=(n,r,i)=>dc(e,n,r)},It({format:e=>j(e).format??null,minLength:e=>j(e).minimum??null,maxLength:e=>j(e).maximum??null},{regex(...e){return this.check(Wo(...e))},includes(...e){return this.check(Ho(...e))},startsWith(...e){return this.check(Yo(...e))},endsWith(...e){return this.check(Xo(...e))},min(...e){return this.check(Oe(...e))},max(...e){return this.check(_n(...e))},length(...e){return this.check(vn(...e))},nonempty(...e){return this.check(Oe(1,...e))},lowercase(e){return this.check(qo(e))},uppercase(e){return this.check(Go(e))},trim(){return this.check(ec())},normalize(...e){return this.check(Qo(...e))},toLowerCase(){return this.check(tc())},toUpperCase(){return this.check(nc())},slugify(){return this.check(rc())}})),qc=f("ZodString",(e,t)=>{Xe.init(e,t),Cn.init(e,t)},{email(e){return this.check(go(Qc,e))},url(e){return this.check(ko(ta,e))},jwt(e){return this.check(Lo(ga,e))},emoji(e){return this.check(zo(na,e))},guid(e){return this.check(_o(ea,e))},uuid(e){return this.check(vo(Te,e))},uuidv4(e){return this.check(bo(Te,e))},uuidv6(e){return this.check(yo(Te,e))},uuidv7(e){return this.check(wo(Te,e))},nanoid(e){return this.check(So(ra,e))},cuid(e){return this.check($o(ia,e))},cuid2(e){return this.check(Oo(sa,e))},ulid(e){return this.check(Eo(oa,e))},base64(e){return this.check(Ro(da,e))},base64url(e){return this.check(jo(pa,e))},xid(e){return this.check(Io(ca,e))},ksuid(e){return this.check(To(aa,e))},ipv4(e){return this.check(Po(ua,e))},ipv6(e){return this.check(Zo(la,e))},cidrv4(e){return this.check(Ao(fa,e))},cidrv6(e){return this.check(No(ha,e))},e164(e){return this.check(Mo(ma,e))},datetime(e){return this.check(Fo(Gc,e))},date(e){return this.check(Co(Hc,e))},time(e){return this.check(Do(Yc,e))},duration(e){return this.check(xo(Xc,e))}});function H(e){return mo(qc,e)}const $=f("ZodStringFormat",(e,t)=>{z.init(e,t),Cn.init(e,t)}),Gc=f("ZodISODateTime",(e,t)=>{_s.init(e,t),$.init(e,t)}),Hc=f("ZodISODate",(e,t)=>{vs.init(e,t),$.init(e,t)}),Yc=f("ZodISOTime",(e,t)=>{bs.init(e,t),$.init(e,t)}),Xc=f("ZodISODuration",(e,t)=>{ys.init(e,t),$.init(e,t)}),Qc=f("ZodEmail",(e,t)=>{rs.init(e,t),$.init(e,t)}),ea=f("ZodGUID",(e,t)=>{ts.init(e,t),$.init(e,t)}),Te=f("ZodUUID",(e,t)=>{ns.init(e,t),$.init(e,t)}),ta=f("ZodURL",(e,t)=>{us.init(e,t),$.init(e,t)}),na=f("ZodEmoji",(e,t)=>{ls.init(e,t),$.init(e,t)}),ra=f("ZodNanoID",(e,t)=>{fs.init(e,t),$.init(e,t)}),ia=f("ZodCUID",(e,t)=>{hs.init(e,t),$.init(e,t)}),sa=f("ZodCUID2",(e,t)=>{ds.init(e,t),$.init(e,t)}),oa=f("ZodULID",(e,t)=>{ps.init(e,t),$.init(e,t)}),ca=f("ZodXID",(e,t)=>{ms.init(e,t),$.init(e,t)}),aa=f("ZodKSUID",(e,t)=>{gs.init(e,t),$.init(e,t)}),ua=f("ZodIPv4",(e,t)=>{ws.init(e,t),$.init(e,t)}),la=f("ZodIPv6",(e,t)=>{zs.init(e,t),$.init(e,t)}),fa=f("ZodCIDRv4",(e,t)=>{Ss.init(e,t),$.init(e,t)}),ha=f("ZodCIDRv6",(e,t)=>{Os.init(e,t),$.init(e,t)}),da=f("ZodBase64",(e,t)=>{Es.init(e,t),$.init(e,t)}),pa=f("ZodBase64URL",(e,t)=>{Ts.init(e,t),$.init(e,t)}),ma=f("ZodE164",(e,t)=>{Ps.init(e,t),$.init(e,t)}),ga=f("ZodJWT",(e,t)=>{As.init(e,t),$.init(e,t)}),Dn=f("ZodNumber",(e,t)=>{Vt.init(e,t),S.init(e,t),e._zod.processJSONSchema=(n,r,i)=>pc(e,n,r,i),e.isFinite=!0},It({minValue:e=>{const{minimum:t,exclusiveMinimum:n}=j(e);return Math.max(t??Number.NEGATIVE_INFINITY,n??Number.NEGATIVE_INFINITY)},maxValue:e=>{const{maximum:t,exclusiveMax)DELIM" +R"DELIM(imum:n}=j(e);return Math.min(t??Number.POSITIVE_INFINITY,n??Number.POSITIVE_INFINITY)},isInt:e=>{const{isInt:t,multipleOf:n}=j(e);return!!t||!!n?.some(Number.isSafeInteger)},format:e=>j(e).format??null},{gt(e,t){return this.check(mn(e,t))},gte(e,t){return this.check(it(e,t))},min(e,t){return this.check(it(e,t))},lt(e,t){return this.check(pn(e,t))},lte(e,t){return this.check(rt(e,t))},max(e,t){return this.check(rt(e,t))},int(e){return this.check(xn(e))},safe(e){return this.check(xn(e))},positive(e){return this.check(mn(0,e))},nonnegative(e){return this.check(it(0,e))},negative(e){return this.check(pn(0,e))},nonpositive(e){return this.check(rt(0,e))},multipleOf(e,t){return this.check(gn(e,t))},step(e,t){return this.check(gn(e,t))},finite(){return this}}));function E(e){return Uo(Dn,e)}const _a=f("ZodNumberFormat",(e,t)=>{Ns.init(e,t),Dn.init(e,t)});function xn(e){return Ko(_a,e)}const va=f("ZodBoolean",(e,t)=>{Rs.init(e,t),S.init(e,t),e._zod.processJSONSchema=(n,r,i)=>mc(e,n,r)});function T(e){return Jo(va,e)}const ba=f("ZodUnknown",(e,t)=>{js.init(e,t),S.init(e,t),e._zod.processJSONSchema=(n,r,i)=>_c()});function Un(){return Bo(ba)}const ya=f("ZodNever",(e,t)=>{Ms.init(e,t),S.init(e,t),e._zod.processJSONSchema=(n,r,i)=>gc(e,n,r)});function wa(e){return Vo(ya,e)}const ka=f("ZodArray",(e,t)=>{le(),Cs.init(e,t),S.init(e,t),e._zod.processJSONSchema=(n,r,i)=>wc(e,n,r,i),e.element=t.element},{min(e,t){return this.check(Oe(e,t))},nonempty(e){return this.check(Oe(1,e))},max(e,t){return this.check(_n(e,t))},length(e,t){return this.check(vn(e,t))},unwrap(){return this.element}});function Kn(e,t){return ic(ka,e,t)}const za=f("ZodObject",(e,t)=>{le(),Us.init(e,t),S.init(e,t),e._zod.processJSONSchema=(n,r,i)=>kc(e,n,r,i),xr(e,"shape",n=>n._zod.def.shape,!1)},{keyof(){return Pa(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(N(this._zod.def,{catchall:e}))},passthrough(){return this.clone(N(this._zod.def,{catchall:Un()}))},loose(){return this.clone(N(this._zod.def,{catchall:Un()}))},strict(){return this.clone(N(this._zod.def,{catchall:wa()}))},strip(){return this.clone(N(this._zod.def,{catchall:void 0}))},extend(e){return Pr(this,e)},safeExtend(e){return Zr(this,e)},merge(e){return Ar(this,e)},pick(e){return Ir(this,e)},omit(e){return Tr(this,e)},partial(...e){return $t(lt,this,e[0])},exactPartial(...e){return $t(Wn,this,e[0],"exactPartial")},required(...e){return Nr(Gn,this,e[0])}});function L(e,t){const n={type:"object",shape:e??{},..._(t)};return new za(n)}const Sa=f("ZodUnion",(e,t)=>{Ks.init(e,t),S.init(e,t),e._zod.processJSONSchema=(n,r,i)=>zc(e,n,r,i),e.options=t.options});function Jn(e,t){return new Sa({type:"union",options:e,..._(t)})}const $a=f("ZodIntersection",(e,t)=>{Js.init(e,t),S.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Sc(e,n,r,i)});function Oa(e,t){return new $a({type:"intersection",left:e,right:t})}const Ea=f("ZodTuple",(e,t)=>{le(),Bs.init(e,t),S.init(e,t),e._zod.processJSONSchema=(n,r,i)=>$c(e,n,r,i)},{rest(e){return this.clone({...this._zod.def,rest:e})},partial(){const e=this._zod.def;if(e.checks?.length)throw new Error(".partial() cannot be used on tuple schemas containing refinements");return this.clone({...e,items:e.items.map(t=>new lt({type:"optional",innerType:t}))})}});function Ia(e,t,n){const r=t instanceof k,i=r?n:t,s=r?t:null;return new Ea({type:"tuple",items:e,rest:s,..._(i)})}const Bn=f("ZodRecord",(e,t)=>{le(),Vs.init(e,t),S.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Ec(e,n,r,i),e.keyType=t.keyType,e.valueType=t.valueType});function Ta(e,t,n){return!t||!t._zod?new Bn({type:"record",keyType:H(),valueType:e,..._(t)}):new Bn({type:"record",keyType:e,valueType:t,..._(n)})}const ut=f("ZodEnum",(e,t)=>{Ws.init(e,t),S.init(e,t),e._zod.processJSONSchema=(r,i,s)=>vc(e,r,i),e.enum=t.entries,e.options=[...e._zod.values];const n=new Set(Object.keys(t.entries));e.extract=(r,i)=>{const s={};for(const o of r)if(n.has(o))s[o]=t.entries[o];else throw new Error(`Key ${o} not found in enum`);return new ut({...t,checks:[],..._(i),entries:s})},e.exclude=(r,i)=>{const s={...t.entries};for(const o of r)if(n.has(o))delete s[o];else throw new Error(`Key ${o} not found in enum`);return new ut({...t,checks:[],..._(i),entries:s})}});function Pa(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new ut({type:"enum",entries:n,..._(t)})}const Za=f("ZodTransform",(e,t)=>{le(),qs.init(e,t),S.init(e,t),e._zod.processJSONSchema=(n,r,i)=>yc(e,n,r,i),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new Zt(e.constructor.name);n.addIssue=s=>{if(typeof s=="string")n.issues.push(ie(s,n.value,t));else{const o=s;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),"input"in o||(o.input=n.value),o.inst??(o.inst=e),n.issues.push(ie(o))}};const i=t.transform(n.value,n);return i instanceof Promise?i.then(s=>(n.value=s,n)):(n.value=i,n)}});function Aa(e){return new Za({type:"transform",transform:e})}const lt=f("ZodOptional",(e,t)=>{nn.init(e,t),S.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Ln(e,n,r,i),e.unwrap=()=>e._zod.def.innerType});function Vn(e){return new lt({type:"optional",innerType:e})}const Wn=f("ZodExactOptional",(e,t)=>{Gs.init(e,t),S.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Ln(e,n,r,i),e.unwrap=()=>e._zod.def.innerType});function Na(e){return new Wn({type:"optional",innerType:e})}const Ra=f("ZodNullable",(e,t)=>{Hs.init(e,t),S.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Ic(e,n,r,i),e.unwrap=()=>e._zod.def.innerType});function qn(e){return new Ra({type:"nullable",innerType:e})}const ja=f("ZodDefault",(e,t)=>{Ys.init(e,t),S.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Pc(e,n,r,i),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Ma(e,t){return new ja({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():wt(t)}})}const La=f("ZodPrefault",(e,t)=>{Xs.init(e,t),S.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Zc(e,n,r,i),e.unwrap=()=>e._zod.def.innerType});function Fa(e,t){return new La({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():wt(t)}})}const Gn=f("ZodNonOptional",(e,t)=>{Qs.init(e,t),S.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Tc(e,n,r,i),e.unwrap=()=>e._zod.def.innerType});function Ca(e,t){return new Gn({type:"nonoptional",innerType:e,..._(t)})}const Da=f("ZodCatch",(e,t)=>{eo.init(e,t),S.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Ac(e,n,r,i),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function xa(e,t){return new Da({type:"catch",innerType:e,catchValue:typeof t=="function"?t:Kr(t)})}const Ua=f("ZodPipe",(e,t)=>{to.init(e,t),S.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Nc(e,n,r,i),e.in=t.in,e.out=t.out});function Hn(e,t){return new Ua({type:"pipe",in:e,out:t})}const Ka=f("ZodReadonly",(e,t)=>{no.init(e,t),S.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Rc(e,n,r,i),e.unwrap=()=>e._zod.def.innerType});function Ja(e){return new Ka({type:"readonly",innerType:e})}const Ba=f("ZodCustom",(e,t)=>{ro.init(e,t),S.init(e,t),e._zod.processJSONSchema=(n,r,i)=>bc(e,n,r,i)});function Va(e,t={}){return sc(Ba,e,t)}function Wa(e,t){return oc(e,t)}const Pe=[{id:0,name:"application",label:"Application"},{id:1,name:"news",label:"News"},{id:2,name:"session",label:"Session"},{id:3,name:"protocol",label:"Protocol"},{id:4,name:"proxy",label:"Proxy"},{id:5,name:"remote",label:"Remote"},{id:6,name:"fault",label:"Fault"},{id:7,name:"quitting",label:"Quitting"},{id:8,name:"objects",label:"Objects"},{id:9,name:"verbose",label:"Verbose"}],ft=[{id:0,name:"header_archived",label:"Header archived",category:"headers",valueKind:"height"},{id:1,name:"header_organized",label:"Header organized",category:"headers",valueKind:"height"},{id:2,name:"header_reorganized",label:"Header reorganized",category:"headers",valueKind:"height"},{id:3,name:"block_archived",label:"Block archived",category:"blocks",valueKind:"height"},{id:4,name:"block_buffered",label:"Block buffered",category:"blocks",valueKind:"height"},{id:5,name:"block_validated",label:"Block validated",catego)DELIM" +R"DELIM(ry:"blocks",valueKind:"height"},{id:6,name:"block_confirmed",label:"Block confirmed",category:"blocks",valueKind:"height"},{id:7,name:"block_unconfirmable",label:"Block unconfirmable",category:"blocks",valueKind:"height"},{id:8,name:"validate_bypassed",label:"Validation bypassed",category:"blocks",valueKind:"height"},{id:9,name:"confirm_bypassed",label:"Confirmation bypassed",category:"blocks",valueKind:"height"},{id:10,name:"tx_archived",label:"Transaction archived",category:"transactions",valueKind:"fee-rate"},{id:11,name:"tx_validated",label:"Transaction validated",category:"transactions",valueKind:"count"},{id:12,name:"tx_invalidated",label:"Transaction invalidated",category:"transactions",valueKind:"count"},{id:13,name:"block_organized",label:"Block organized",category:"chain",valueKind:"height"},{id:14,name:"block_reorganized",label:"Block reorganized",category:"chain",valueKind:"height"},{id:15,name:"template_issued",label:"Mining template issued",category:"mining",valueKind:"count"},{id:16,name:"snapshot_secs",label:"Snapshot",category:"timing",valueKind:"seconds"},{id:17,name:"prune_msecs",label:"Prune",category:"timing",valueKind:"milliseconds"},{id:18,name:"reload_msecs",label:"Store reload",category:"timing",valueKind:"milliseconds"},{id:19,name:"block_usecs",label:"Serve block",category:"timing",valueKind:"microseconds"},{id:20,name:"ancestry_msecs",label:"Serve ancestry",category:"timing",valueKind:"milliseconds"},{id:21,name:"filter_msecs",label:"Serve filter",category:"timing",valueKind:"milliseconds"},{id:22,name:"filterhashes_msecs",label:"Serve filter hashes",category:"timing",valueKind:"milliseconds"},{id:23,name:"filterchecks_msecs",label:"Serve filter checkpoints",category:"timing",valueKind:"milliseconds"},{id:24,name:"ecdsa_secs",label:"ECDSA batch verification",category:"timing",valueKind:"seconds"},{id:25,name:"schnorr_secs",label:"Schnorr batch verification",category:"timing",valueKind:"seconds"},{id:26,name:"silent_secs",label:"Silent payment scan",category:"timing",valueKind:"seconds"},{id:27,name:"validate_usecs",label:"Block validation",category:"timing",valueKind:"microseconds"},{id:28,name:"unknown",label:"Unknown",category:"chain",valueKind:"unknown"}],Yn=E().int().nonnegative().max(864e13),Xn=L({level:E().int().nonnegative(),time:Yn,message:H()}),Qn=L({event:E().int().nonnegative(),value:E().nonnegative(),time:Yn}),er=L({previous:E().nonnegative()});Jn([Xn,Qn,er]);const qa=2**Pe.length-1,tr=2**ft.length-1;function nr(e,t){return Number.isInteger(t)&&t>=0&&t{this.#u(r)},onHeartbeat:r=>{this.#u(r)},onBeforeStop:r=>{r.send("/v1/log/subscribe?filter=0"),r.send("/v1/event/subscribe?filter=0")},onMessage:r=>{const i=Ya(r);if(!i)return!1;if(rr(i)&&!nr(this.#e,i.level))return!0;for(const s of this.#t)s(i);return!0},onUnclaimed:r=>{for(const i of this.#i)i(r)}}}getStatus=()=>this.#c.getStatus();subscribeStatus=t=>this.#c.subscribeStatus(t);start(){this.#r??=this.#c.attach(this.#a)}stop(){this.#r?.(),this.#r=null}subscribeFrames(t){return this.#t.add(t),()=>{this.#t.delete(t)}}subscribeInvalidFrames(t){return this.#i.add(t),()=>{this.#i.delete(t)}}setFilters(t,n){this.#e!==t&&(this.#e=t,this.#c.send(`/v1/log/subscribe?filter=${String(t)}`)),this.#n!==n&&(this.#n=n,this.#c.send(`/v1/event/subscribe?filter=${String(n)}`))}#u(t){t.send(`/v1/log/subscribe?filter=${String(this.#e)}`),t.send(`/v1/event/subscribe?filter=${String(this.#n)}`)}}function tu(e){const t=e.trim();if(!t)throw new Error("Endpoint URL is required");const n=/^[a-z][a-z\\d+\\-.]*:\\/\\//iu.test(t)?t:`http://${t}`,r=new URL(n);if(r.protocol!=="http:"&&r.protocol!=="https:")throw new Error("Endpoint must use HTTP or HTTPS");return r.pathname=r.pathname.replace(/\\/+$/u,"")||"/",r.search="",r.hash="",r.toString().replace(/\\/$/u,"")}function nu(e){const t=new URL(tu(e));return t.protocol=t.protocol==="https:"?"wss:":"ws:",t.pathname="/",t.search="",t.hash="",t.toString()}const ru=L({store:L({address:T(),filter:T(),silent:E().int().nonnegative().nullable(),turbo:T(),pruned:E().int().nonnegative()}),node:L({network:H(),limited:T().optional(),blocks:T().optional(),witness:T().optional(),filters:T().optional(),privacy:T().optional()}),wallet:L({p2kh:E().int(),p2sh:E().int(),wif:E().int(),witness:H(),silent:H(),hd_private:E().int(),hd_public:E().int()}).optional(),network:L({relay:T(),alert:T(),reject:T(),compact:T(),address:T(),witness_tx:T(),memory_pool:T(),not_found:T(),protocol_maximum:E().int(),protocol_minimum:E().int()}).optional(),forks:Ta(H(),T()).transform(e=>Object.keys(e).filter(t=>e[t]))}),ir=H().regex(/^[0-9a-f]{64}$/u),iu=L({hash:ir,height:E().int().nonnegative(),timestamp:E().int().positive().max(4294967295)}),sr=L({hash:ir,height:E().int().nonnegative()}),su=L({confirmed:sr,candidate:sr}),Ae=E().int().nonnegative().max(Number.MAX_SAFE_INTEGER),ou=L({count:Ae,virtual:Ae,fee:Ae,histogram:Kn(Ia([E().nonnegative(),Ae]))}),cu="/v1/fees?format=json",au=5e3,uu=15e3;function lu(e){try{const t=JSON.parse(e),n=ru.safeParse(t);if(n.success)return{type:"configuration",payload:n.data};const r=iu.safeParse(t);if(r.success)return{type:"header",payload:r.data};const i=ou.safeParse(t);if(i.success)return{type:"fees",payload:i.data};const s=su.safeParse(t);return s.success?{type:"top",payload:s.data}:null}catch{return null}}function fu(e){return`/v1/block/height/${String(e)}/header?format=json&candidate=true`}const or=15e3,cr=3*or,ar={configuration:null,configurationReceivedAt:null,tops:null,topReceivedAt:null,branch:null,branchReceivedAt:null,fees:null,invalidFrames:0};class hu{#e=ar;#n=new Set;#t;#i;#c=null;#a=null;#r;#u=null;#s=null;#o=null;#p;#f=null;#h=null;constructor(t,n={}){this.#r=n.now??Date.now,this.#p=n.pollIntervalMs??or,this.#t=t,this.#i={heartbeatMs:this.#p,onOpen:r=>{this.#u=this.#r(),r.send("/v1/configuration?format=json"),r.send("/v1/top/subscribe?format=json"),this.#h=null,this.#g()},onHeartbeat:r=>{const i=this.#e.topReceivedAt??this.#u;if(i!==null&&this.#r()-i>=cr){try{r.close(4e3,"Native top response timed out")}catch{}return}r.send("/v1/top?format=json")},onBeforeStop:r=>{r.send("/v1/top/subscribe?format=json&stop=true")},onMessage:r=>{const i=lu(r);return i?(this.#d(i),!0):!1},onUnclaimed:()=>{this.#l({...this.#e,invalidFrames:this.#e.invalidFrames+1})}}}getStatus=()=>this.#t.getStatus();subscribeStatus=t=>this.#t.subscribeStatus(t);getState=()=>this.#e;subscribeState=t=>(this.#n.add(t),()=>{this.#n.delete(t)});start(){this.#f??=setInterval(()=>{this.#g()},au),this.#a??=this.#t.subscribeStatus(()=>{this.#t.getStatus().phase!=="connected"&&(this.#u=null,this.#h=null,this.#s=null,this.#o=null,this.#v())}),this.#c??=this.#t.attach(this.#i)}stop(){this.#f!==null&&clearInterval(this.#f),this.#f=null,this.#h=null,this.#a?.(),this.#a=null,this.#c?.(),this.#c=null}#d(t){const n=this.#r();if(t.type==="fees"){this.#h=null,this.#l({...this.#e,fees:{data:t.payload,receivedAt:n}});return}if(t.type==="top"){const{confirmed:r,candidate:i}=t.payload,s=i.height>r.height,o=s&&this.#e.branch?.height===r.height;s||(this.#s=null,this.#o=null),this.#l({...this.#e,tops:t.payload,topReceivedAt:n,)DELIM" +R"DELIM(branch:o?this.#e.branch:null,branchReceivedAt:o?this.#e.branchReceivedAt:null}),s&&this.#m(r.height,n);return}if(t.type==="header"){if(t.payload.height!==this.#s?.height)return;this.#s=null,this.#l({...this.#e,branch:t.payload,branchReceivedAt:n});return}this.#l({...this.#e,configuration:t.payload,configurationReceivedAt:n})}#m(t,n){this.#s!==null&&n-this.#s.requestedAtnew WebSocket(n))},this.#s=this.#e.retryMinimumMs}getStatus=()=>this.#n;subscribeStatus=t=>(this.#i.add(t),()=>{this.#i.delete(t)});attach(t){this.#r.push(t);const n=this.#t;return n?.readyState===1&&this.#n.phase==="connected"&&(t.onOpen?.(n),this.#h(n,t)),()=>{const r=this.#r.indexOf(t);if(r<0)return;this.#r.splice(r,1),this.#m(t);const i=this.#t;if(i?.readyState===1)try{t.onBeforeStop?.(i)}catch{}}}start(){this.#o||(this.#o=!0,this.#s=this.#e.retryMinimumMs,this.#p())}stop(){this.#o=!1,this.#v();const t=this.#t;if(this.#t=null,t)try{if(t.readyState===1)for(const n of[...this.#r])n.onBeforeStop?.(t);t.close()}catch{}this.#l(ur)}send(t){if(this.#t?.readyState!==1)return!1;try{return this.#t.send(t),!0}catch{return!1}}#p(){if(!this.#o||this.#t)return;const t=this.#n.reconnects>0;this.#l({...this.#n,phase:t?"reconnecting":"connecting",attempt:this.#n.attempt+1,error:null});let n;try{n=this.#e.webSocketFactory(this.#e.url),this.#t=n}catch(r){this.#l({...this.#n,error:mu(r)}),this.#f();return}this.#c=setTimeout(()=>{if(this.#t===n){this.#l({...this.#n,error:"Connection timed out"});try{n.close()}catch{this.#t=null,this.#f()}}},this.#e.connectTimeoutMs),n.addEventListener("open",()=>{if(!(this.#t!==n||!this.#o)){this.#d(),this.#s=this.#e.retryMinimumMs,this.#l({...this.#n,phase:"connected",connectedAt:this.#e.now(),error:null});for(const r of[...this.#r]){if(this.#t!==n)return;r.onOpen?.(n),this.#h(n,r)}}}),n.addEventListener("message",r=>{if(this.#t!==n||!this.#o)return;const i=pu(r.data);if(i===null)return;const s=this.#e.now();(this.#n.lastMessageAt===null||s-this.#n.lastMessageAt>=1e3)&&this.#l({...this.#n,lastMessageAt:s});const o=[...this.#r];if(!o.some(c=>c.onMessage(i)))for(const c of o)c.onUnclaimed?.(i)}),n.addEventListener("error",()=>{if(!(this.#t!==n||!this.#o)){this.#l({...this.#n,error:"WebSocket connection failed"});try{n.close()}catch{this.#t=null,this.#f()}}}),n.addEventListener("close",()=>{this.#t===n&&(this.#t=null,this.#d(),this.#g(),this.#o&&this.#f())})}#f(){if(!this.#o||this.#a)return;const t=1+(this.#e.random()*2-1)*this.#e.jitterRatio,n=Math.max(0,Math.round(this.#s*t));this.#s=Math.min(this.#s*2,this.#e.retryMaximumMs),this.#l({...this.#n,phase:"reconnecting",reconnects:this.#n.reconnects+1,connectedAt:null}),this.#a=setTimeout(()=>{this.#a=null,this.#p()},n)}#h(t,n){this.#m(n);const r=n.heartbeatMs??24e4;if(!n.onHeartbeat||r<=0)return;const i=setInterval(()=>{this.#t===t&&t.readyState===1&&n.onHeartbeat?.(t)},r);this.#u.set(n,i)}#d(){this.#c&&(clearTimeout(this.#c),this.#c=null)}#m(t){const n=this.#u.get(t);n!==void 0&&(clearInterval(n),this.#u.delete(t))}#g(){for(const t of this.#u.values())clearInterval(t);this.#u.clear()}#v(){this.#d(),this.#g(),this.#a&&(clearTimeout(this.#a),this.#a=null)}#l(t){this.#n=t;for(const n of this.#i)n()}}function pu(e){return typeof e=="string"?e:e instanceof ArrayBuffer?new TextDecoder().decode(e):null}function mu(e){return e instanceof Error?e.message:"Unable to create WebSocket"}const ne=["occurrence-rate","occurrence-count","cumulative-occurrences"],gu=["payload-latest","payload-maximum","payload-change-rate",...ne],_u=["payload-average","payload-latest","payload-minimum","payload-maximum",...ne],vu=["payload-sum","payload-cumulative","payload-latest","payload-average",...ne],lr=["payload-latest","payload-average","payload-minimum","payload-maximum"],fr=[{field:"count",id:"pool:count",label:"Pool transactions",payloadKind:"transactions",description:"Current confirmable transaction count in the pool."},{field:"virtual",id:"pool:vsize",label:"Pool virtual size",payloadKind:"vbytes",description:"Total virtual size of the current pool, in vbytes."},{field:"fee",id:"pool:total_fee",label:"Pool total fees",payloadKind:"satoshis",description:"Total fees of the current pool, in satoshis."}];function hr(e){return`event:${String(e)}`}function dr(e){return`log:${String(e)}`}const ht="native:top";function bu(e){switch(e){case"height":return"height";case"seconds":case"milliseconds":case"microseconds":return"duration";case"count":return"count";case"fee-rate":return"fee-rate";default:return"unknown"}}function yu(e){switch(e){case"height":return gu;case"duration":return _u;case"count":return vu;case"fee-rate":return[...lr,...ne];default:return ne}}function wu(e){switch(e){case"height":return"payload-latest";case"duration":return"payload-average";case"count":return"payload-sum";default:return"occurrence-rate"}}function ku(e){const t=Ze(e),n=bu(t.valueKind);return{id:hr(e),source:"event",sourceId:e,name:t.name,label:t.label,category:t.category,payloadKind:n,allowedMeasures:yu(n),defaultMeasure:wu(n),description:e===10?"Newly archived transactions, including compact-block recovery. Occurrences measure archival, not all received transactions. Fee rate is normalized to sat/vB.":n==="unknown"?"Payload semantics are unknown; occurrence measurements are safe.":`${t.label} event with a ${n} payload.`}}const zu=[...fr.map(e=>({id:e.id,source:"pool",sourceId:e.field,name:e.field,label:e.label,category:"pool",payloadKind:e.payloadKind,allowedMeasures:lr,defaultMeasure:"payload-latest",description:e.description})),...ft.map(e=>ku(e.id)),...Pe.map(e=>({id:dr(e.id),source:"log",sourceId:e.id,name:e.name,label:`${e.label} logs`,category:"logs",payloadKind:"text",allowedMeasures:ne,defaultMeasure:"occurrence-rate",description:`${e.label} log message volume. Message text is not interpreted as numeric data.`})),{id:ht,source:"native",sourceId:"top",name:"canonical_top",label:"Current top",category:"native",payloadKind:"height",allowedMeasures:["payload-latest","payload-maximum","payload-change-rate"],defaultMeasure:"payload-latest",description:"Canonical chain height reported by the native interface."}];new Map(zu.map(e=>[e.id,e]));function Su(e,t){return Ze(e).valueKind==="fee-rate"?t/1e3:Qa(e,t)??t}const $u=3600*1e3,Ou=1e3,Eu=1e3,Iu=1e3;class pr{constructor(t){this.capacity=t,this.#e=Array.from({length:t})}capacity;#e;#n=0;#t=0;#i=null;get size(){return this.#t}push(t){const n=this.#t===this.capacity;return this.#i=null,this.#e[this.#n]=t,this.#n=(this.#n+1)%this.capacity,this.#t=Math.min(this.#t+1,this.capacity),n}clear(){this.#i=null,this.#e.fill(void 0),this.#n=0,this.#t=0}newestFirst(){if(this.#i)return this.#i;const t=[];for(let n=0;nthis.#A;getRecentLogs=()=>this.#i.newestFirst();getRecentEvents=()=>this.#c.newestFirst();subscribe=t=>(this.#t.add(t),()=>{this.#t.delete(t)});start(){this.#k||(this.tick(),this.#k=setInterval(()=>{this.tick()},1e3))}stop(){this.#k&&(clearInterval(this.#k),this.#k=null),this.#_&&(clearTimeout(this.#_),this.#_=null)}ingest(t,n=this.#e()){const r=this.#b(n);this.#g+=1,rr(t)?this.#j(t,r):Ga(t)?this.#M(t,r):Ha(t)&&(this.#I+=1),this.#z()}recordInvalidFrame(){this.#T+=1,this.#z()}recordNativeTop(t,n=this.#e()){const r=this.#b(n),i=this.#f[ht];i?.value===t&&r-i.time<15e3||(this.#S(ht,r,t),this.#N(r),this.#z())}recordNativeFees(t,n=this.#e()){if(!Number.isFinite(n)||n=uu||this.#y!==null&&n<=this.#y.receivedAt)return;const r=this.#b(n);this.#y={data:t,receivedAt:n};for(const i of fr)this.#S(i.id,r,t[i.field]);this.#N(r),this.#z()}clearLogs(){this.#O+=this.#i.size,this.#i.clear(),this.flush()}clearEvents(){this.#c.clear(),this.flush()}reset(){this.#i.clear(),this.#c.clear(),this.#a.clear(),this.#r={},this.#u={},this.#s={},this.#o={},this.#p={},this.#f={},this.#h={},this.#d=this.#b(this.#e()),this.#g=0,this.#v=0,this.#l=0,this.#O=0,this.#E=0,this.#I=0,this.#T=0,this.#P=null,this.#Z=null,this.#y=null,this.#w=0,this.#$(this.#d),this.flush()}tick(){const t=this.#b(this.#e());this.#$(t),this.#N(t),this.#z()}flush(){this.#_&&(clearTimeout(this.#_),this.#_=null),this.#A=this.#R();for(const t of this.#t)t()}#j(t,n){this.#v+=1,this.#P=n,this.#w+=1,this.#i.push({...t,id:this.#w,receivedAt:n})&&(this.#l+=1),this.#S(dr(t.level),n,null)}#M(t,n){this.#E+=1,this.#Z=n,this.#w+=1,this.#c.push({...t,id:this.#w,receivedAt:n}),this.#S(hr(t.event),n,Su(t.event,t.value))}#b(t){return Number.isFinite(t)?(this.#m=Math.max(this.#m,t),this.#m):this.#m}#S(t,n,r){const i=this.#$(n);i.snapshot=null;const s=i.signals.get(t)??Tu();if(s.count+=1,Ne(this.#o,t,1),r!==null){s.samples+=1,s.sum+=r,s.minimum=s.minimum===null?r:Math.min(s.minimum,r),s.maximum=s.maximum===null?r:Math.max(s.maximum,r),(s.firstAt===null||n=s.lastAt)&&(s.last=r,s.lastAt=n),Ne(this.#p,t,r);const o=this.#f[t];(!o||n>=o.time)&&(this.#f[t]={value:r,time:n}),this.#h[t]=Math.max(this.#h[t]??r,r)}i.signals.set(t,s)}#$(t){const n=Math.floor(t/1e3)*1e3,r=this.#a.get(n);if(r)return r;const i={time:n,signals:new Map,snapshot:null};return this.#a.set(n,i),i}#N(t){const n=t-$u;for(const[r,i]of this.#a){if(r>=n)break;for(const[s,o]of i.signals)if(Ne(this.#r,s,o.count),Ne(this.#u,s,o.sum),o.last!==null&&o.lastAt!==null){const c=this.#s[s];(!c||o.lastAt>=c.time)&&(this.#s[s]={value:o.last,time:o.lastAt})}this.#a.delete(r)}}#z(){!this.#n||this.#_||(this.#_=setTimeout(()=>{this.#_=null,this.flush()},Ou))}#R(){const t=[...this.#a.values()].map(n=>(n.snapshot??={time:n.time,signals:Object.fromEntries([...n.signals].map(([r,i])=>[r,{...i}]))},n.snapshot));return{now:this.#b(this.#e()),sessionStartedAt:this.#d,totalFrames:this.#g,totalLogs:this.#v,evictedLogs:this.#l,clearedLogs:this.#O,totalEvents:this.#E,totalAcks:this.#I,invalidFrames:this.#T,buckets:t,priorSignalCounts:{...this.#r},priorSignalSums:{...this.#u},priorSignalLatest:mr(this.#s),signalTotals:{...this.#o},signalSums:{...this.#p},signalLatest:mr(this.#f),signalMaximums:{...this.#h},recentLogs:this.#i.newestFirst(),recentEvents:this.#c.newestFirst(),lastLogAt:this.#P,lastEventAt:this.#Z,poolSnapshot:this.#y}}}const Re=40;function Zu(e,t){const n=t.search.trim().toLowerCase(),r=e.filter(o=>nr(t.filter,o.level)&&(!n||o.message.toLowerCase().includes(n)||Xa(o.level).name.includes(n))),i=Number.isFinite(t.offset)?Math.max(0,Math.floor(t.offset)):0,s=Math.min(i,Math.max(0,r.length-Re));return{logs:r.slice(s,s+Re),retained:e.length,matched:r.length,offset:s}}function Au(e,t){const n=t.search.trim().toLowerCase(),r=e.filter(o=>{const c=Ze(o.event);return(t.category==="all"||c.category===t.category)&&(!n||c.name.includes(n)||c.label.toLowerCase().includes(n)||String(o.value).includes(n))}),i=Number.isFinite(t.offset)?Math.max(0,Math.floor(t.offset)):0,s=Math.min(i,Math.max(0,r.length-Re));return{events:r.slice(s,s+Re),retained:e.length,matched:r.length,offset:s}}function Nu(e,t){const{buckets:n,recentLogs:r,recentEvents:i,...s}=e,o=new Map(t?.buckets.map(c=>[c.time,c]));return{summary:s,reset:t===null,firstBucketTime:n[0]?.time??e.now,buckets:n.filter(c=>o.get(c.time)!==c),recentLogs:r===t?.recentLogs?null:r,recentEvents:i===t?.recentEvents?null:i}}class Ru{constructor(t,n=i=>new du({url:nu(i)}),r=Date.now){this.send=t,this.createSocket=n,this.#e=new Pu(r,!1)}send;createSocket;#e;#n=null;#t=null;#i=[];#c=null;#a=null;#r=0;#u=null;#s=null;#o=null;#p=[];handle(t){if(t.type==="stop"){this.#d(),this.#e.stop(),this.send({type:"stopped"});return}if(t.type==="configure"){if(t.generation=this.#r&&this.#f(t.generation);return}if(t.generation===this.#r)switch(t.type){case"pause-display":{t.stream==="logs"?this.#s=t.paused?this.#s??this.#e.getRecentLogs():null:this.#o=t.paused?this.#o??this.#e.getRecentEvents():null;break}case"poll-events":{this.send({type:"events",generation:this.#r,requestId:t.requestId,queryVersion:t.queryVersion,window:Au(this.#o??this.#e.getRecentEvents(),t.query)});break}case"poll-logs":{this.send({type:"logs",generation:this.#r,requestId:t.requestId,queryVersion:t.queryVersion,window:Zu(this.#s??this.#e.getRecentLogs(),t.query)});break}case"native-top":{this.#e.recordNativeTop(t.height,t.receivedAt);break}case"native-fees":{this.#e.recordNativeFees(t.fees,t.receivedAt);break}case"clear-logs":{this.#e.clearLogs(),this.#s!==null&&(this.#s=[]);break}case"clear-events":{this.#e.clearEvents(),this.#o!==null&&(this.#o=[]);break}case"poll":{if(!this.#n)return;this.#e.flush();const n=this.#e.getSnapshot();this.send({type:"snapshot",generation:this.#r,requestId:t.requestId,status:this.#n.getStatus(),update:Nu(n,this.#u)}),this.#u=n;break}}}#f(t){this.#r=t,this.#u=null,this.#s!==null&&(this.#s=[]),this.#o!==null&&(this.#o=[]),this.#e.reset()}#h(t,n,r){this.#d(),this.#c=t,this.#a=n;const i=this.createSocket(t),s=n===t?i:this.createSocket(n);this.#i=i===s?[i]:[i,s];const o=new eu(i,{logFilter:r}),c=new hu(s),a=()=>{this.send({type:"native",status:c.getStatus(),live:c.getState()})};this.#n=o,this.#t=c,this.#p=[o.subscribeFrames(u=>{this.#e.ingest(u)}),o.subscribeInvalidFrames(()=>{this.#e.recordInvalidFrame()}),c.subscribeStatus(a),c.subscribeState(a)],o.start(),c.start();for(const u of this.#i)u.start()}#d(){for(const t of this.#p)t();this.#p=[];for(const t of this.#i)t.stop();this.#n?.stop(),this.#t?.stop(),this.#i=[],this.#n=null,this.#t=null}}const dt=globalThis,ju=new Ru(e=>{dt.postMessage(e)});dt.addEventListener("message",e=>{ju.handle(e.data),e.data.type==="stop"&&dt.close()})})();\n',K_=typeof self<"u"&&self.Blob&&new Blob(["(self.URL || self.webkitURL).revokeObjectURL(self.location.href);",gx],{type:"text/javascript;charset=utf-8"});function xj(n){let i;try{if(i=K_&&(self.URL||self.webkitURL).createObjectURL(K_),!i)throw"";const a=new Worker(i,{name:n?.name});return a.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(i)}),a}catch{return new Worker("data:text/javascript;charset=utf-8,"+encodeURIComponent(gx),{name:n?.name})}}const G_=100,vx=15e3,wj=3*vx,Su={configuration:null,configurationReceivedAt:null,tops:null,topReceivedAt:null,branch:null,branchReceivedAt:null,fees:null,invalidFrames:0};function zj(n,)DELIM" +R"DELIM(i){const a=new Map((i.reset?[]:n.buckets).filter(l=>l.time>=i.firstBucketTime).map(l=>[l.time,l]));for(const l of i.buckets)a.set(l.time,l);return{...i.summary,buckets:[...a.values()],recentLogs:Yf(i.reset?[]:n.recentLogs,i.recentLogs),recentEvents:Yf(i.reset?[]:n.recentEvents,i.recentEvents)}}function Yf(n,i){if(i===null)return n;const a=new Map(n.map(l=>[l.id,l]));return i.map(l=>a.get(l.id)??l)}const Hr={phase:"idle",attempt:0,reconnects:0,connectedAt:null,lastMessageAt:null,error:null};class Tj{constructor(i=()=>new xj){this.createWorker=i}createWorker;#e=null;#t=new Wb().getSnapshot();#n=Hr;#i=new Set;#s=new Set;#r=Hr;#l=Su;#f=new Set;#u=null;#o=null;#b=to;#a=0;#g=0;#c=null;#h=null;#_=null;#m=new Set;#S={logs:[],retained:0,matched:0,offset:0};#E={search:"",filter:to,offset:0};#x=0;#v=null;#w=null;#p=new Set;#A={events:[],retained:0,matched:0,offset:0};#M={search:"",category:"all",offset:0};#T=0;#d=null;#O=!1;#k=!1;getSnapshot=()=>this.#t;getStatus=()=>this.#n;getNativeStatus=()=>this.#r;getNativeLive=()=>this.#l;subscribeNative=i=>(this.#f.add(i),()=>{this.#f.delete(i)});getLogWindow=()=>this.#S;getEventWindow=()=>this.#A;subscribeEvents=i=>(this.#p.add(i),this.#j(),this.#U(),()=>{this.#p.delete(i),this.#p.size===0&&this.#N()});subscribeLogs=i=>(this.#m.add(i),this.#z(),this.#R(),()=>{this.#m.delete(i),this.#m.size===0&&this.#D()});subscribe=i=>(this.#i.add(i),()=>{this.#i.delete(i)});subscribeStatus=i=>(this.#s.add(i),()=>{this.#s.delete(i)});configure(i,a,l){i===this.#u&&a===this.#o&&l===this.#b||(this.#u!==null&&i!==this.#u&&(this.reset(),this.#L({...Hr,phase:"connecting"})),this.#o!==null&&a!==this.#o&&this.#$({...Hr,phase:"connecting"},Su),this.#u=i,this.#o=a,this.#b=l,this.#C())}start(){if(!(this.#e||this.#u===null||this.#o===null))try{const i=this.createWorker();this.#e=i,this.#S={logs:[],retained:0,matched:0,offset:0},this.#A={events:[],retained:0,matched:0,offset:0};for(const a of this.#m)a();for(const a of this.#p)a();this.#L({...Hr,phase:"connecting"}),this.#$({...Hr,phase:"connecting"},Su),i.onmessage=a=>{if(this.#e!==i)return;const l=a.data;if(l.type==="events"){if(l.requestId!==this.#d||(this.#d=null,l.generation!==this.#a))return;if(l.queryVersion!==this.#T){this.#j();return}this.#A={...l.window,events:Yf(this.#A.events,l.window.events)};for(const u of this.#p)u();return}if(l.type==="logs"){if(l.requestId!==this.#v||(this.#v=null,l.generation!==this.#a))return;if(l.queryVersion!==this.#x){this.#z();return}this.#S={...l.window,logs:Yf(this.#S.logs,l.window.logs)};for(const u of this.#m)u();return}if(l.type==="native"){this.#$(l.status,l.live);return}if(l.type==="snapshot"&&l.requestId===this.#c&&(this.#c=null,l.generation===this.#a)){this.#t=zj(this.#t,l.update),this.#L(l.status);for(const u of this.#i)u()}},i.onerror=()=>{this.#H("Telemetry worker failed. Reload the dashboard to reconnect.")},i.onmessageerror=()=>{this.#H("Unable to read telemetry worker data. Reload the dashboard to reconnect.")},this.#C(),this.#O&&this.#y({type:"pause-display",generation:this.#a,stream:"logs",paused:!0}),this.#k&&this.#y({type:"pause-display",generation:this.#a,stream:"events",paused:!0}),this.#Z(),this.getStatus().error===null&&(this.#h=setInterval(()=>{this.#Z()},1e3)),this.#R(),this.#U()}catch(i){this.#H(`Unable to start telemetry worker: ${i instanceof Error?i.message:String(i)}`)}}stop(){this.#B();const i=this.#e;if(this.#e=null,i){const a=setTimeout(()=>{i.terminate()},500),l=()=>{clearTimeout(a),i.terminate()};i.onmessage=u=>{u.data.type==="stopped"&&l()},i.onerror=l,i.onmessageerror=l;try{i.postMessage({type:"stop"})}catch{l()}}this.#L(Hr),this.#$(Hr,Su)}recordNativeTop(i,a=Date.now()){this.#y({type:"native-top",generation:this.#a,height:i,receivedAt:a})}recordNativeFees(i,a=Date.now()){this.#y({type:"native-fees",generation:this.#a,fees:i,receivedAt:a})}clearLogs(){this.#y({type:"clear-logs",generation:this.#a}),this.#x+=1,this.#z()}clearEvents(){this.#y({type:"clear-events",generation:this.#a}),this.#T+=1,this.#j()}setLogsPaused(i){i!==this.#O&&(this.#O=i,this.#D(),this.#y({type:"pause-display",generation:this.#a,stream:"logs",paused:i}),this.#x+=1,this.#z(),this.#R())}setEventsPaused(i){i!==this.#k&&(this.#k=i,this.#N(),this.#y({type:"pause-display",generation:this.#a,stream:"events",paused:i}),this.#T+=1,this.#j(),this.#U())}reset(){this.#a+=1,this.#c=null,this.#v=null,this.#d=null,this.#S={logs:[],retained:0,matched:0,offset:0},this.#A={events:[],retained:0,matched:0,offset:0},this.#t=new Wb().getSnapshot(),this.#y({type:"reset",generation:this.#a});for(const i of this.#i)i();for(const i of this.#m)i();for(const i of this.#p)i()}setLogQuery(i){JSON.stringify(i)!==JSON.stringify(this.#E)&&(this.#E=i,this.#x+=1,this.#z())}setEventQuery(i){JSON.stringify(i)!==JSON.stringify(this.#M)&&(this.#M=i,this.#T+=1,this.#j())}#U(){!this.#e||this.#p.size===0||this.#w||this.#k||(this.#w=setInterval(()=>{this.#j()},G_),this.#j())}#j(){this.#d!==null||!this.#e||this.#p.size===0||(this.#d=++this.#g,this.#y({type:"poll-events",generation:this.#a,requestId:this.#d,queryVersion:this.#T,query:this.#M}))}#N(){this.#w&&clearInterval(this.#w),this.#w=null,this.#d=null}#R(){!this.#e||this.#m.size===0||this.#_||this.#O||(this.#_=setInterval(()=>{this.#z()},G_),this.#z())}#z(){this.#v!==null||!this.#e||this.#m.size===0||(this.#v=++this.#g,this.#y({type:"poll-logs",generation:this.#a,requestId:this.#v,queryVersion:this.#x,query:this.#E}))}#D(){this.#_&&clearInterval(this.#_),this.#_=null,this.#v=null}#C(){this.#u!==null&&this.#o!==null&&this.#y({type:"configure",generation:this.#a,endpoint:this.#u,nativeEndpoint:this.#o,logFilter:this.#b})}#Z(){this.#c!==null||!this.#e||(this.#c=++this.#g,this.#y({type:"poll",generation:this.#a,requestId:this.#c}))}#y(i){try{this.#e?.postMessage(i)}catch{this.#H("Unable to communicate with telemetry worker. Reload the dashboard to reconnect.")}}#B(){this.#D(),this.#N(),this.#h&&clearInterval(this.#h),this.#h=null,this.#c=null}#H(i){this.#B(),this.#e?.terminate(),this.#e=null,this.#L({...Hr,error:i}),this.#$({...Hr,error:i},Su)}#$(i,a){this.#r=i,this.#l=a;for(const l of this.#f)l()}#L(i){if(JSON.stringify(i)!==JSON.stringify(this.#n)){this.#n=i;for(const a of this.#s)a()}}}const yx="libbitcoinAdminDashboardLogFilter";function bx(){try{return globalThis.localStorage}catch{return null}}function Ej(n=bx()){try{const i=n?.getItem(yx);if(!i)return to;const a=JSON.parse(i);return typeof a=="number"&&Number.isInteger(a)&&a>=0&&a<=Fp?a:to}catch{return to}}function Oj(n,i=bx()){try{i?.setItem(yx,String(n))}catch{}}const _x=se.createContext(void 0),Nj=n=>{const i=se.useContext(_x);if(!i)throw new Error("No QueryClient set, use QueryClientProvider to set one");return i},Aj=({client:n,children:i})=>(se.useEffect(()=>(n.mount(),()=>{n.unmount()}),[n]),x.jsx(_x.Provider,{value:n,children:i})),Mj={setTimeout:(n,i)=>setTimeout(n,i),clearTimeout:n=>clearTimeout(n),setInterval:(n,i)=>setInterval(n,i),clearInterval:n=>clearInterval(n)};var jj=class{#e=Mj;#t=!1;setTimeoutProvider(n){this.#e=n}setTimeout(n,i){return this.#e.setTimeout(n,i)}clearTimeout(n){this.#e.clearTimeout(n)}setInterval(n,i){return this.#e.setInterval(n,i)}clearInterval(n){this.#e.clearInterval(n)}};const Qa=new jj;function kj(n){setTimeout(n,0)}const Rj=typeof window>"u"||"Deno"in globalThis;function vi(){}function Cj(n,i){return typeof n=="function"?n(i):n}function Sx(n){return typeof n=="number"&&n>=0&&n!==1/0}function xx(n,i){return Math.max(n+(i||0)-Date.now(),0)}function kt(n,i){return typeof n=="function"?n(i):n}function Y_(n,i){const{type:a="all",exact:l,fetchStatus:u,predicate:f,queryKey:d,stale:m}=n;if(d){if(l){if(i.queryHash!==pg(d,i.options))return!1}else if(!fo(i.queryKey,d))return!1}if(a!=="all"){const p=i.isActive();if(a==="active"&&!p||a==="inactive"&&p)return!1}return!(typeof m=="boolean"&&i.isStale()!==m||u&&u!==i.state.fetchStatus||f&&!f(i))}function F_(n,i){const{exact:a,status:l,predicate:u,mutationKey:f}=n;if(f){if(!i.options.mutationKey)return!1;if(a){if)DELIM" +R"DELIM((Lu(i.options.mutationKey)!==Lu(f))return!1}else if(!fo(i.options.mutationKey,f))return!1}return!(l&&i.state.status!==l||u&&!u(i))}function pg(n,i){return(i?.queryKeyHashFn||Lu)(n)}function Lu(n){return JSON.stringify(n,(i,a)=>zp(a)?Object.keys(a).sort().reduce((l,u)=>(l[u]=a[u],l),{}):a)}function fo(n,i){if(n===i)return!0;if(typeof n!=typeof i)return!1;if(n&&i&&typeof n=="object"&&typeof i=="object"){if(Array.isArray(n)&&Array.isArray(i)){if(i.length>n.length)return!1;for(let l=0;l500)return i;const l=Q_(n)&&Q_(i);if(!l&&!(zp(n)&&zp(i)))return i;const u=(l?n:Object.keys(n)).length,f=l?i:Object.keys(i),d=f.length,m=l?new Array(d):{};let p=0;for(let g=0;g{Qa.setTimeout(i,n)})}function Tp(n,i,a){return typeof a.structuralSharing=="function"?a.structuralSharing(n,i):a.structuralSharing!==!1?zx(n,i):i}function Uj(n,i,a=0){const l=[...n,i];return a&&l.length>a?l.slice(-a):l}function Zj(n,i,a=0){const l=[i,...n];return a&&l.length>a?l.slice(0,a):l}const gg=Symbol();function Tx(n,i){return!n.queryFn&&i?.initialPromise?()=>i.initialPromise:!n.queryFn||n.queryFn===gg?()=>Promise.reject(new Error(`Missing queryFn: '${n.queryHash}'`)):n.queryFn}function Ex(n,i){return typeof n=="function"?n(...i):!!n}const vg=Symbol();function $j(n,i,a,l){let u=!1,f;return Object.defineProperties(n,{[vg]:{value:l},signal:{enumerable:!0,get:()=>(f??=i(),u||(u=!0,f.aborted?a():f.addEventListener("abort",a,{once:!0})),f)}}),n}let Lj=()=>Rj;const yg=()=>Lj();var qu=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(n){return this.listeners.add(n),this.onSubscribe(),()=>{this.listeners.delete(n),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Hj=class extends qu{#e;#t;#n;constructor(){super(),this.#n=n=>{if(typeof window<"u"&&window.addEventListener){const i=()=>n();return window.addEventListener("visibilitychange",i,!1),()=>{window.removeEventListener("visibilitychange",i)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(n){this.#n=n,this.#t?.(),this.#t=n(i=>{typeof i=="boolean"?this.setFocused(i):this.onFocus()})}setFocused(n){this.#e!==n&&(this.#e=n,this.onFocus())}onFocus(){const n=this.isFocused();this.listeners.forEach(i=>{i(n)})}isFocused(){return typeof this.#e=="boolean"?this.#e:globalThis.document?.visibilityState!=="hidden"}};const bg=new Hj,Bj=kj;function qj(){let n=[],i=0,a=m=>{m()},l=m=>{m()},u=Bj;const f=m=>{i?n.push(m):u(()=>{a(m)})},d=()=>{const m=n;n=[],m.length&&u(()=>{l(()=>{m.forEach(p=>{a(p)})})})};return{batch:m=>{let p;i++;try{p=m()}finally{i--,i||d()}return p},batchCalls:m=>(...p)=>{f(()=>{m(...p)})},schedule:f,setNotifyFunction:m=>{a=m},setBatchNotifyFunction:m=>{l=m},setScheduler:m=>{u=m}}}const Un=qj();var Vj=class extends qu{#e=!0;#t;#n;constructor(){super(),this.#n=n=>{if(typeof window<"u"&&window.addEventListener){const i=()=>n(!0),a=()=>n(!1);return window.addEventListener("online",i,!1),window.addEventListener("offline",a,!1),()=>{window.removeEventListener("online",i),window.removeEventListener("offline",a)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(n){this.#n=n,this.#t?.(),this.#t=n(this.setOnline.bind(this))}setOnline(n){this.#e!==n&&(this.#e=n,this.listeners.forEach(i=>{i(n)}))}isOnline(){return this.#e}};const Ff=new Vj;function Ij(n){return Math.min(1e3*2**n,3e4)}function Ox(n){return(n??"online")==="online"?Ff.isOnline():!0}var Ep=class extends Error{constructor(n){super("CancelledError"),this.revert=n?.revert,this.silent=n?.silent}};function Nx(n){let i=!1,a=0,l,u="pending",f,d;const m=new Promise((D,X)=>{f=D,d=X});m.catch(vi);const p=()=>u!=="pending",g=D=>{if(!p()){const X=new Ep(D);A(X),n.onCancel?.(X)}},b=()=>{i=!0},y=()=>{i=!1},w=()=>bg.isFocused()&&(n.networkMode==="always"||Ff.isOnline())&&n.canRun(),O=()=>Ox(n.networkMode)&&n.canRun(),T=D=>{p()||(l?.(),u="resolved",f(D))},A=D=>{p()||(l?.(),u="rejected",d(D))},k=D=>new Promise(X=>{l=G=>{(p()||D())&&X(G)},n.onPause?.()}).then(()=>{l=void 0,p()||n.onContinue?.()}),L=()=>{if(p())return;let D;const X=a===0?n.initialPromise:void 0;try{D=X??n.fn()}catch(G){D=Promise.reject(G)}Promise.resolve(D).then(T).catch(G=>{if(p())return;const ee=n.retry??(yg()?0:3),V=n.retryDelay??Ij,ne=typeof V=="function"?V(a,G):V,ae=ee===!0||typeof ee=="number"&&ap()||w()?void 0:k(w)).then(()=>{i?A(G):L()})})};return{promise:m,status:()=>u,cancel:g,continue:()=>(l?.(),m),cancelRetry:b,continueRetry:y,canStart:O,start:()=>(O()?L():k(O).then(L),m)}}var Ax=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Sx(this.gcTime)&&(this.#e=Qa.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(n){this.gcTime=Math.max(this.gcTime||0,n??(yg()?1/0:3e5))}clearGcTimeout(){this.#e!==void 0&&(Qa.clearTimeout(this.#e),this.#e=void 0)}};function Pj(n){return{onFetch:(i,a)=>{const l=i.options,u=i.fetchOptions?.meta?.fetchMore?.direction,f=i.state.data?.pages||[],d=i.state.data?.pageParams||[];let m={pages:[],pageParams:[]},p=0;const g=async()=>{let b=!1;const y=i,w=A=>{$j(A,()=>i.signal,()=>b=!0,y[vg])},O=Tx(i.options,i.fetchOptions),T=async(A,k,L)=>{if(b)return Promise.reject(i.signal.reason);if(k==null&&A.pages.length)return Promise.resolve(A);const X=(()=>{const ne={client:i.client,queryKey:i.queryKey,pageParam:k,direction:L?"backward":"forward",meta:i.options.meta};return w(ne),ne})(),G=await O(X),{maxPages:ee}=i.options,V=L?Zj:Uj;return{pages:V(A.pages,G,ee),pageParams:V(A.pageParams,k,ee)}};if(u&&f.length){const A=u==="backward",k=A?Kj:X_,L={pages:f,pageParams:d};m=await T(L,k(l,L),A)}else{const A=n??f.length;do{const k=p===0?d[0]===void 0?l.initialPageParam:d[0]:X_(l,m);if(p>0&&k==null)break;m=await T(m,k),p++}while(pi.options.persister?.(g,{client:i.client,queryKey:i.queryKey,meta:i.options.meta,signal:i.signal},a):i.fetchFn=g}}}function X_(n,{pages:i,pageParams:a}){const l=i.length-1;return i.length>0?n.getNextPageParam(i[l],i,a[l],a):void 0}function Kj(n,{pages:i,pageParams:a}){return i.length>0?n.getPreviousPageParam?.(i[0],i,a[0],a):void 0}var Gj=class extends Ax{#e;#t;#n;#i;#s;#r;#l;#f;#u;constructor(n){super(),this.#u=!1,this.#f=n.defaultOptions,this.setOptions(n.options),this.observers=[],this.#s=n.client,this.#i=this.#s.getQueryCache(),this.queryKey=n.queryKey,this.queryHash=n.queryHash,this.#t=e1(this.options),this.state=n.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#r?.promise}setOptions(n){if(this.options={...this.#f,...n},n?._type&&(this.#e=n._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const i=e1(this.options);i.data!==void 0&&(th)DELIM" +R"DELIM(is.setState(W_(i.data,i.dataUpdatedAt)),this.#t=i)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&this.#i.remove(this)}setData(n,i){const a=Tp(this.state.data,n,this.options);return this.#o({data:a,type:"success",dataUpdatedAt:i?.updatedAt,manual:i?.manual}),a}setState(n){this.#o({type:"setState",state:n})}cancel(n){const i=this.#r?.promise;return this.#r?.cancel(n),i?i.then(vi).catch(vi):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(n=>kt(n.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===gg||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.state.data===void 0?!1:this.getObserversCount()>0?this.observers.some(n=>kt(n.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(n=>n.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(n=0){return this.state.data===void 0?!0:n==="static"?!1:this.state.isInvalidated?!0:!xx(this.state.dataUpdatedAt,n)}onFocus(){this.observers.find(n=>n.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#r?.continue()}onOnline(){this.observers.find(n=>n.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#r?.continue()}addObserver(n){this.observers.includes(n)||(this.observers.push(n),this.clearGcTimeout(),this.#i.notify({type:"observerAdded",query:this,observer:n}))}removeObserver(n){const i=this.observers.indexOf(n);i!==-1&&(this.observers.splice(i,1),this.observers.length||(this.#r&&(this.#u||this.state.fetchStatus==="paused"&&this.state.status==="pending"?this.#r.cancel({revert:!0}):this.#r.cancelRetry()),this.scheduleGc()),this.#i.notify({type:"observerRemoved",query:this,observer:n}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#o({type:"invalidate"})}async fetch(n,i){if(this.state.fetchStatus!=="idle"&&this.#r?.status()!=="rejected"){if(this.state.data!==void 0&&i?.cancelRefetch)this.cancel({silent:!0});else if(this.#r&&this.#l)return this.#r.continueRetry(),this.#l}if(n&&this.setOptions(n),!this.options.queryFn){const g=this.observers.find(b=>b.options.queryFn);g&&this.setOptions(g.options)}const a=new AbortController,l=g=>{Object.defineProperties(g,{[vg]:{value:a.signal,enumerable:!0},signal:{enumerable:!0,get:()=>(this.#u=!0,a.signal)}})},u=()=>{const g=Tx(this.options,i),y=(()=>{const w={client:this.#s,queryKey:this.queryKey,meta:this.meta};return l(w),w})();return this.#u=!1,this.options.persister?this.options.persister(g,y,this):g(y)},d=(()=>{const g={fetchOptions:i,options:this.options,queryKey:this.queryKey,client:this.#s,state:this.state,fetchFn:u};return l(g),g})();(this.#e==="infinite"?Pj(this.options.pages):this.options.behavior)?.onFetch(d,this),this.#n=this.state,(this.state.fetchStatus==="idle"||this.state.fetchMeta!==d.fetchOptions?.meta)&&this.#o({type:"fetch",meta:d.fetchOptions?.meta});const m=this.#r=Nx({initialPromise:i?.initialPromise,fn:d.fetchFn,onCancel:g=>{g instanceof Ep&&g.revert&&this.setState({...this.#n,fetchStatus:"idle"}),a.abort()},onFail:(g,b)=>{this.#o({type:"failed",failureCount:g,error:b})},onPause:()=>{this.#o({type:"pause"})},onContinue:()=>{this.#o({type:"continue"})},retry:d.options.retry,retryDelay:d.options.retryDelay,networkMode:d.options.networkMode,canRun:()=>!0}),p=(async()=>{try{const g=await m.promise;if(g===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(g),this.#i.config.onSuccess?.(g,this),this.#i.config.onSettled?.(g,this.state.error,this),g}catch(g){if(g instanceof Ep){if(g.silent){if(this.#r!==m&&this.#l)return this.#l;throw g}else if(g.revert){if(this.state.data===void 0)throw g;return this.state.data}}throw this.#o({type:"error",error:g}),this.#i.config.onError?.(g,this),this.#i.config.onSettled?.(this.state.data,g,this),g}finally{this.#r===m&&(this.#r=void 0,this.#l=void 0),this.scheduleGc()}})();return this.#l=p,m.start(),p}#o(n){const i=a=>{switch(n.type){case"failed":return{...a,fetchFailureCount:n.failureCount,fetchFailureReason:n.error};case"pause":return{...a,fetchStatus:"paused"};case"continue":return{...a,fetchStatus:"fetching"};case"fetch":return{...a,...Mx(a.data,this.options),fetchMeta:n.meta??null};case"success":const l={...a,...W_(n.data,n.dataUpdatedAt),dataUpdateCount:a.dataUpdateCount+1,...!n.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return this.#n=n.manual?l:void 0,l;case"error":const u=n.error;return{...a,error:u,errorUpdateCount:a.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:a.fetchFailureCount+1,fetchFailureReason:u,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...a,isInvalidated:!0};case"setState":return{...a,...n.state}}};this.state=i(this.state),Un.batch(()=>{this.observers.slice().forEach(a=>{a.onQueryUpdate()}),this.#i.notify({query:this,type:"updated",action:n})})}};function Mx(n,i){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Ox(i.networkMode)?"fetching":"paused",...n===void 0&&{error:null,status:"pending"}}}function W_(n,i){return{data:n,dataUpdatedAt:i??Date.now(),error:null,isInvalidated:!1,status:"success"}}function e1(n){const i=typeof n.initialData=="function"?n.initialData():n.initialData,a=i!==void 0,l=a?typeof n.initialDataUpdatedAt=="function"?n.initialDataUpdatedAt():n.initialDataUpdatedAt:0;return{data:i,dataUpdateCount:0,dataUpdatedAt:a?l??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:a?"success":"pending",fetchStatus:"idle"}}var Yj=class extends qu{#e;#t=void 0;#n=void 0;#i=void 0;#s;#r;#l;#f;#u;#o;#b;#a;#g;#c=new Set;constructor(n,i){super(),this.options=i,this.#e=n,this.#l=null,this.bindMethods(),this.setOptions(i)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),t1(this.#t,this.options)?this.#h():this.updateResult(),this.#x())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Op(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Op(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#v(),this.#w(),this.#t.removeObserver(this)}setOptions(n){const i=this.options,a=this.#t;if(this.options=this.#e.defaultQueryOptions(n),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof kt(this.options.enabled,this.#t)!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#p(),this.#t.setOptions(this.options),i._defaulted&&!Jm(this.options,i)&&this.#e.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#t,observer:this});const l=this.hasListeners();l&&n1(this.#t,a,this.options,i)&&this.#h(),this.updateResult(),l&&(this.#t!==a||kt(this.options.enabled,this.#t)!==kt(i.enabled,this.#t)||kt(this.options.staleTime,this.#t)!==kt(i.staleTime,this.#t))&&this.#m();const u=this.#S();l&&(this.#t!==a||kt(this.options.enabled,this.#t)!==kt(i.enabled,this.#t)||u!==this.#g)&&this.#E(u)}getOptimisticResult(n){const i=this.#e.getQueryCache().build(this.#e,n),a=this.createResult(i,n);return Jm(this.getCurrentResult(),a)||(this.#i=a,this.#r=this.options,this.#s=this.#t.state),a}getCurrentResult(){return this.#i}trackResult(n,i){return new Proxy(n,{get:(a,l)=>(this.trackProp(l),i?.(l),Reflect.get(a,l))})}trackProp(n){this.#c.add(n)}getCurrentQuery(){return this.#t}refetch({...n}={}){return this.fetch({...n})}fetchOptimistic(n){const i=this.#e.defaultQueryOptions(n),a=this.#e.getQueryCache().build(this.#e,i);let l=()=>{},u;const f=new Promise(d=>{u=d,l=this.#e.getQueryCa)DELIM" +R"DELIM(che().subscribe(m=>{m.type==="updated"&&m.query.queryHash===a.queryHash&&a.state.data!==void 0&&(l(),d(this.createResult(a,i)))})});return Promise.race([a.fetch(i).then(()=>{const d=this.createResult(a,i);return u?.(d),d}).finally(()=>{l()}),f])}fetch(n){return this.#h({...n,cancelRefetch:n.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#i))}#h(n){this.#p();let i=this.#t.fetch(this.options,n);return n?.throwOnError||(i=i.catch(vi)),i}#_(n){return!yg()&&kt(this.options.enabled,this.#t)!==!1&&Sx(n)}#m(){this.#v();const n=kt(this.options.staleTime,this.#t);if(this.#i.isStale||!this.#_(n))return;const i=xx(this.#i.dataUpdatedAt,n)+1;this.#b=Qa.setTimeout(()=>{this.#i.isStale||this.updateResult()},i)}#S(){return kt(this.options.refetchInterval,this.#t)??!1}#E(n){this.#w(),this.#g=n,!(this.#g===0||!this.#_(this.#g))&&(this.#a=Qa.setInterval(()=>{(this.options.refetchIntervalInBackground||bg.isFocused())&&this.#h()},this.#g))}#x(){this.#m(),this.#E(this.#S())}#v(){this.#b!==void 0&&(Qa.clearTimeout(this.#b),this.#b=void 0)}#w(){this.#a!==void 0&&(Qa.clearInterval(this.#a),this.#a=void 0)}createResult(n,i){const a=this.#t,l=this.options,u=this.#i,f=this.#s,d=this.#r,m=n!==a?n.state:this.#n,{state:p}=n;let g={...p},b=!1,y;if(i._optimisticResults){const ee=this.hasListeners(),V=!ee&&t1(n,i),ne=ee&&n1(n,a,i,l);(V||ne)&&(g={...g,...Mx(p.data,n.options)}),i._optimisticResults==="isRestoring"&&(g.fetchStatus="idle")}let{error:w,errorUpdatedAt:O,status:T}=g;y=g.data;let A=!1;if(i.placeholderData!==void 0&&y===void 0&&T==="pending"){let ee;u?.isPlaceholderData&&i.placeholderData===d?.placeholderData?(ee=u.data,A=!0):ee=typeof i.placeholderData=="function"?i.placeholderData(this.#o?.state.data,this.#o):i.placeholderData,ee!==void 0&&(T="success",y=Tp(u?.data,ee,i),b=!0)}if(i.select&&y!==void 0&&!A)if(u&&y===f?.data&&i.select===this.#f)y=this.#u;else try{this.#f=i.select,y=i.select(y),y=Tp(u?.data,y,i),this.#u=y,this.#l=null}catch(ee){this.#l=ee}else y===void 0&&(this.#l=null);this.#l&&(w=this.#l,y=this.#u,O=u?.error===w?u.errorUpdatedAt:Date.now(),T="error",b=!1);const k=g.fetchStatus==="fetching",L=T==="pending",D=T==="error",X=L&&k,G=y!==void 0;return{status:T,fetchStatus:g.fetchStatus,isPending:L,isSuccess:T==="success",isError:D,isInitialLoading:X,isLoading:X,data:y,dataUpdatedAt:g.dataUpdatedAt,error:w,errorUpdatedAt:O,failureCount:g.fetchFailureCount,failureReason:g.fetchFailureReason,errorUpdateCount:g.errorUpdateCount,isFetched:n.isFetched(),isFetchedAfterMount:g.dataUpdateCount>m.dataUpdateCount||g.errorUpdateCount>m.errorUpdateCount,isFetching:k,isRefetching:k&&!L,isLoadingError:D&&!G,isPaused:g.fetchStatus==="paused",isPlaceholderData:b,isRefetchError:D&&G,isStale:_g(n,i),refetch:this.refetch,isEnabled:kt(i.enabled,n)!==!1}}updateResult(){const n=this.#i,i=this.createResult(this.#t,this.options);if(this.#s=this.#t.state,this.#r=this.options,this.#s.data!==void 0&&(this.#o=this.#t),Jm(i,n))return;this.#i=i;const l=(()=>{if(!n)return!0;const{notifyOnChangeProps:u}=this.options,f=typeof u=="function"?u():u;if(f==="all"||!f&&!this.#c.size||this.options.throwOnError&&this.#i.error!==n.error)return!0;for(const d of f??this.#c)if(this.#i[d]!==n[d])return!0;return!1})();Un.batch(()=>{l&&this.listeners.forEach(u=>{u(this.#i)}),this.#e.getQueryCache().notify({query:this.#t,type:"observerResultsUpdated"})})}#p(){const n=this.#e.getQueryCache().build(this.#e,this.options);if(n===this.#t)return;const i=this.#t;this.#t=n,this.#n=n.state,this.hasListeners()&&(i?.removeObserver(this),n.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#x()}};function Fj(n,i){return kt(i.enabled,n)!==!1&&n.state.data===void 0&&!(n.state.status==="error"&&kt(i.retryOnMount,n)===!1)}function t1(n,i){return Fj(n,i)||n.state.data!==void 0&&Op(n,i,i.refetchOnMount)}function Op(n,i,a){if(kt(i.enabled,n)!==!1&&kt(i.staleTime,n)!=="static"){const l=kt(a,n);return l==="always"||l!==!1&&_g(n,i)}return!1}function n1(n,i,a,l){return(n!==i||kt(l.enabled,n)===!1)&&(!a.suspense||n.state.status!=="error")&&_g(n,a)}function _g(n,i){return kt(i.enabled,n)!==!1&&n.isStaleByTime(kt(i.staleTime,n))}var Qj=class extends Ax{#e;#t;#n;#i;constructor(n){super(),this.#e=n.client,this.mutationId=n.mutationId,this.#n=n.mutationCache,this.#t=[],this.state=n.state||Jj(),this.setOptions(n.options),this.scheduleGc()}setOptions(n){this.options=n,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(n){this.#t.includes(n)||(this.#t.push(n),this.clearGcTimeout(),this.#n.notify({type:"observerAdded",mutation:this,observer:n}))}removeObserver(n){this.#t=this.#t.filter(i=>i!==n),this.scheduleGc(),this.#n.notify({type:"observerRemoved",mutation:this,observer:n})}optionalRemove(){this.#t.length||(this.state.status==="pending"?this.scheduleGc():this.#n.remove(this))}continue(){return this.#i?.continue()??(this.state.status==="pending"?this.execute(this.state.variables):Promise.resolve())}async execute(n){const i=()=>{this.#s({type:"continue"})},a={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey},l=this.#i=Nx({fn:()=>this.options.mutationFn?this.options.mutationFn(n,a):Promise.reject(new Error("No mutationFn found")),onFail:(d,m)=>{this.#s({type:"failed",failureCount:d,error:m})},onPause:()=>{this.#s({type:"pause"})},onContinue:i,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)}),u=this.state.status==="pending",f=!l.canStart();try{if(u)i();else{this.#s({type:"pending",variables:n,isPaused:f}),this.#n.config.onMutate&&await this.#n.config.onMutate(n,this,a);const m=await this.options.onMutate?.(n,a);m!==this.state.context&&this.#s({type:"pending",context:m,variables:n,isPaused:f})}this.state.isPaused&&l.canStart()&&i();const d=await l.start();return await this.#n.config.onSuccess?.(d,n,this.state.context,this,a),await this.options.onSuccess?.(d,n,this.state.context,a),await this.#n.config.onSettled?.(d,null,this.state.variables,this.state.context,this,a),await this.options.onSettled?.(d,null,n,this.state.context,a),this.#s({type:"success",data:d}),d}catch(d){try{await this.#n.config.onError?.(d,n,this.state.context,this,a)}catch(m){Promise.reject(m)}try{await this.options.onError?.(d,n,this.state.context,a)}catch(m){Promise.reject(m)}try{await this.#n.config.onSettled?.(void 0,d,this.state.variables,this.state.context,this,a)}catch(m){Promise.reject(m)}try{await this.options.onSettled?.(void 0,d,n,this.state.context,a)}catch(m){Promise.reject(m)}throw this.#s({type:"error",error:d}),d}finally{this.#i===l&&(this.#i=void 0),this.#n.runNext(this)}}#s(n){const i=a=>{switch(n.type){case"failed":return{...a,failureCount:n.failureCount,failureReason:n.error};case"pause":return{...a,isPaused:!0};case"continue":return{...a,isPaused:!1};case"pending":return{...a,context:n.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:n.isPaused,status:"pending",variables:n.variables,submittedAt:Date.now()};case"success":return{...a,data:n.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...a,data:void 0,error:n.error,failureCount:a.failureCount+1,failureReason:n.error,isPaused:!1,status:"error"}}};this.state=i(this.state),Un.batch(()=>{this.#t.forEach(a=>{a.onMutationUpdate(n)}),this.#n.notify({mutation:this,type:"updated",action:n})})}};function Jj(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Xj=class extends qu{#e;#t;#n;constructor(n={}){super(),this.config=n,this.#e=new Set,this.#t=new Map,this.#n=0}build(n,i,a){const l=new Qj({client:n,mutationCache:this,mutationId:++this.#n,options:n.defaultMutationOptions(i),state:a});return this.add(l),l}add(n){this.#e.add(n);const i=Ef(n);if(typeof i=="string"){const a=this.#t.get(i);a?a.push(n):this.#t.set(i,[n])}this.notify({type:"added",mutation:n})}remove(n){if)DELIM" +R"DELIM((this.#e.delete(n)){const i=Ef(n);if(typeof i=="string"){const a=this.#t.get(i);if(a)if(a.length>1){const l=a.indexOf(n);l!==-1&&a.splice(l,1)}else a[0]===n&&this.#t.delete(i)}}this.notify({type:"removed",mutation:n})}canRun(n){const i=Ef(n);if(typeof i=="string"){const a=this.#t.get(i)?.find(l=>l.state.status==="pending");return!a||a===n}else return!0}runNext(n){const i=Ef(n);return typeof i=="string"?this.#t.get(i)?.find(a=>a!==n&&a.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){Un.batch(()=>{const n=this.getAll();this.#e.clear(),this.#t.clear(),n.forEach(i=>{this.notify({type:"removed",mutation:i})})})}getAll(){return Array.from(this.#e)}find(n){const i={exact:!0,...n};return this.getAll().find(a=>F_(i,a))}findAll(n={}){return this.getAll().filter(i=>F_(n,i))}notify(n){Un.batch(()=>{this.listeners.forEach(i=>{i(n)})})}resumePausedMutations(){const n=this.getAll().filter(i=>i.state.isPaused);return Un.batch(()=>Promise.all(n.map(i=>i.continue().catch(vi))))}};function Ef(n){return n.options.scope?.id}var Wj=class extends qu{#e;constructor(n={}){super(),this.config=n,this.#e=new Map}build(n,i,a){const l=i.queryKey,u=i.queryHash??pg(l,i);let f=this.get(u);return f||(f=new Gj({client:n,queryKey:l,queryHash:u,options:n.defaultQueryOptions(i),state:a,defaultOptions:n.getQueryDefaults(l)}),this.add(f)),f}add(n){this.#e.has(n.queryHash)||(this.#e.set(n.queryHash,n),this.notify({type:"added",query:n}))}remove(n){this.#e.get(n.queryHash)===n&&(n.destroy(),this.#e.delete(n.queryHash),this.notify({type:"removed",query:n}))}clear(){Un.batch(()=>{this.getAll().forEach(n=>{this.remove(n)})})}get(n){return this.#e.get(n)}getAll(){return[...this.#e.values()]}find(n){const i={exact:!0,...n};return this.getAll().find(a=>Y_(i,a))}findAll(n={}){const i=this.getAll();return Object.keys(n).length>0?i.filter(a=>Y_(n,a)):i}notify(n){Un.batch(()=>{this.listeners.forEach(i=>{i(n)})})}onFocus(){Un.batch(()=>{this.getAll().forEach(n=>{n.onFocus()})})}onOnline(){Un.batch(()=>{this.getAll().forEach(n=>{n.onOnline()})})}},ek=class{#e;#t;#n;#i;#s;#r;#l;#f;constructor(n={}){this.#e=n.queryCache||new Wj,this.#t=n.mutationCache||new Xj,this.#n=n.defaultOptions||{},this.#i=new Map,this.#s=new Map,this.#r=0}mount(){this.#r++,this.#r===1&&(this.#l=bg.subscribe(async n=>{n&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#f=Ff.subscribe(async n=>{n&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#r--,this.#r===0&&(this.#l?.(),this.#l=void 0,this.#f?.(),this.#f=void 0)}isFetching(n){return this.#e.findAll({...n,fetchStatus:"fetching"}).length}isMutating(n){return this.#t.findAll({...n,status:"pending"}).length}getQueryData(n){const i=this.defaultQueryOptions({queryKey:n});return this.#e.get(i.queryHash)?.state.data}ensureQueryData(n){const i=this.defaultQueryOptions(n),a=this.#e.build(this,i),l=a.state.data;return l===void 0?this.fetchQuery(n):(n.revalidateIfStale&&a.isStaleByTime(kt(i.staleTime,a))&&this.prefetchQuery(i),Promise.resolve(l))}getQueriesData(n){return this.#e.findAll(n).map(({queryKey:i,state:a})=>[i,a.data])}setQueryData(n,i,a){const l=this.defaultQueryOptions({queryKey:n}),u=this.#e.get(l.queryHash)?.state.data,f=Cj(i,u);if(f!==void 0)return this.#e.build(this,l).setData(f,{...a,manual:!0})}setQueriesData(n,i,a){return Un.batch(()=>this.#e.findAll(n).map(({queryKey:l})=>[l,this.setQueryData(l,i,a)]))}getQueryState(n){const i=this.defaultQueryOptions({queryKey:n});return this.#e.get(i.queryHash)?.state}removeQueries(n){const i=this.#e;Un.batch(()=>{i.findAll(n).forEach(a=>{i.remove(a)})})}resetQueries(n,i){const a=this.#e;return Un.batch(()=>{const l=a.findAll(n),u=new Set(l);return l.forEach(f=>{f.reset()}),this.refetchQueries({type:"active",predicate:f=>u.has(f)},i)})}cancelQueries(n,i={}){const a={revert:!0,...i},l=Un.batch(()=>this.#e.findAll(n).map(u=>u.cancel(a)));return Promise.all(l).then(vi).catch(vi)}invalidateQueries(n,i={}){return Un.batch(()=>(this.#e.findAll(n).forEach(a=>{a.invalidate()}),n?.refetchType==="none"?Promise.resolve():this.refetchQueries({...n,type:n?.refetchType??n?.type??"active"},i)))}refetchQueries(n,i={}){const a={...i,cancelRefetch:i.cancelRefetch??!0},l=Un.batch(()=>this.#e.findAll(n).filter(u=>!u.isDisabled()&&!u.isStatic()).map(u=>{let f=u.fetch(void 0,a);const d=u.state.fetchStatus==="paused";return(!a.throwOnError||d)&&(f=f.catch(vi)),d?Promise.resolve():f}));return Promise.all(l).then(vi)}async query(n){const i=this.defaultQueryOptions(n);i.retry===void 0&&(i.retry=!1);const a=this.#e.build(this,i),l=a.isStaleByTime(kt(i.staleTime,a))?await a.fetch(i):a.state.data,u=i.select;return u?u(l):l}fetchQuery(n){const i=this.defaultQueryOptions(n);i.retry===void 0&&(i.retry=!1);const a=this.#e.build(this,i);return a.isStaleByTime(kt(i.staleTime,a))?a.fetch(i):Promise.resolve(a.state.data)}prefetchQuery(n){return this.fetchQuery(n).then(vi).catch(vi)}infiniteQuery(n){return n._type="infinite",this.query(n)}fetchInfiniteQuery(n){return n._type="infinite",this.fetchQuery(n)}prefetchInfiniteQuery(n){return this.fetchInfiniteQuery(n).then(vi).catch(vi)}ensureInfiniteQueryData(n){return n._type="infinite",this.ensureQueryData(n)}resumePausedMutations(){return Ff.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(n){this.#n=n}setQueryDefaults(n,i){this.#i.set(Lu(n),{queryKey:n,defaultOptions:i})}getQueryDefaults(n){const i=[...this.#i.values()],a={};return i.forEach(l=>{fo(n,l.queryKey)&&Object.assign(a,l.defaultOptions)}),a}setMutationDefaults(n,i){this.#s.set(Lu(n),{mutationKey:n,defaultOptions:i})}getMutationDefaults(n){const i=[...this.#s.values()],a={};return i.forEach(l=>{fo(n,l.mutationKey)&&Object.assign(a,l.defaultOptions)}),a}defaultQueryOptions(n){if(n._defaulted)return n;const i={...this.#n.queries,...this.getQueryDefaults(n.queryKey),...n,_defaulted:!0};return i.queryHash||(i.queryHash=pg(i.queryKey,i)),i.refetchOnReconnect===void 0&&(i.refetchOnReconnect=i.networkMode!=="always"),i.throwOnError===void 0&&(i.throwOnError=!!i.suspense),!i.networkMode&&i.persister&&(i.networkMode="offlineFirst"),i.queryFn===gg&&(i.enabled=!1),i}defaultMutationOptions(n){return n?._defaulted?n:{...this.#n.mutations,...n?.mutationKey&&this.getMutationDefaults(n.mutationKey),...n,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}};const jx=se.createContext(!1),tk=()=>se.useContext(jx);jx.Provider;function nk(){let n=!1;return{clearReset:()=>{n=!1},reset:()=>{n=!0},isReset:()=>n}}const ik=se.createContext(nk()),rk=()=>se.useContext(ik),sk=(n,i,a)=>{const l=a?.state.status==="error"&&typeof n.throwOnError=="function"?Ex(n.throwOnError,[a.state.error,a]):n.throwOnError;(n.suspense||l)&&(i.isReset()||(n.retryOnMount=!1))},ak=n=>{se.useEffect(()=>{n.clearReset()},[n])},lk=({result:n,errorResetBoundary:i,throwOnError:a,query:l,suspense:u})=>n.isError&&!i.isReset()&&!n.isFetching&&l&&(u&&n.data===void 0||Ex(a,[n.error,l])),ok=n=>{if(n.suspense){const a=u=>u==="static"?u:Math.max(u??1e3,1e3),l=n.staleTime;n.staleTime=typeof l=="function"?(...u)=>a(l(...u)):a(l),typeof n.gcTime=="number"&&(n.gcTime=Math.max(n.gcTime,1e3))}},uk=(n,i)=>n?.suspense&&i.isPending,ck=(n,i,a)=>i.fetchOptimistic(n).catch(()=>{a.clearReset()});function fk(n,i,a){const l=tk(),u=rk(),f=Nj(),d=f.defaultQueryOptions(n),m=f.getQueryCache().get(d.queryHash),p=n.subscribed!==!1;d._optimisticResults=l?"isRestoring":p?"optimistic":void 0,ok(d),sk(d,u,m),ak(u);const[g]=se.useState(()=>new i(f,d)),b=g.getOptimisticResult(d);se.useEffect(()=>{g.setOptions(d)},[d,g]);const y=!l&&p;if(se.useSyncExternalStore(se.useCallback(w=>{const O=y?g.subscribe(Un.batchCalls(w)):vi;return g.updateResult(),O},[g,y]),()=>g.getCurrentResult(),()=>g.getCurrentResult()),uk(d,b))throw ck(d,g,u);if(lk({result:b,errorResetBoundary:u,throwOnError:d.throwOnError,query:m,suspense:d.suspense}))throw b.error;return d.notifyOnChangeP)DELIM" +R"DELIM(rops?b:g.trackResult(b)}function i1(n,i){return fk(n,Yj)}function dk(n,i,a,l=to){const u=se.useSyncExternalStore(a.subscribeStatus,a.getStatus,a.getStatus);return se.useEffect(()=>{a.configure(n,i,l)},[n,i,a,l]),se.useEffect(()=>(a.start(),()=>{a.stop()}),[a]),u}function hk(n,i,a){const l=se.useMemo(()=>WA(n),[n]),u=se.useSyncExternalStore(i.subscribeNative,i.getNativeStatus,i.getNativeStatus),f=se.useSyncExternalStore(i.subscribeNative,i.getNativeLive,i.getNativeLive),d=kx(u,f,a),m=i1({queryKey:["native-snapshot",n],queryFn:({signal:w})=>l3(n,w),enabled:l&&!d,refetchInterval:vx,retry:!1}),p=mk(u,f,m.data??null,a),g=r1(u,f,null,a),b=i1({queryKey:["native-fees",n],queryFn:({signal:w})=>u3(n,w),enabled:l&&g===null,refetchInterval:a3,retry:!1}),y=r1(u,f,b.data??null,a);return se.useEffect(()=>{y!==null&&i.recordNativeFees(y.data,y.receivedAt)},[y,i]),se.useEffect(()=>{p.top!==null&&i.recordNativeTop(p.top,p.receivedAt??Date.now())},[i,p.receivedAt,p.top]),{status:u,live:f,...p,restError:m.error instanceof Error?m.error.message:null}}function kx(n,i,a){return n.phase==="connected"&&i.tops!==null&&i.topReceivedAt!==null&&i.configuration!==null&&i.configurationReceivedAt!==null&&Np(i.topReceivedAt,a)}function mk(n,i,a,l){return kx(n,i,l)&&i.tops!==null?{top:i.tops.confirmed.height,tops:i.tops,branch:i.branchReceivedAt!==null&&Np(i.branchReceivedAt,l)?i.branch:null,configuration:i.configuration,receivedAt:i.topReceivedAt,transport:"websocket"}:a&&Np(a.receivedAt,l)?{top:a.tops.confirmed.height,tops:a.tops,branch:a.branch,configuration:a.configuration,receivedAt:a.receivedAt,transport:"rest"}:{top:null,tops:null,branch:null,configuration:null,receivedAt:null,transport:"none"}}function r1(n,i,a,l){return n.phase==="connected"&&i.fees!==null&&l-i.fees.receivedAtnew Tj,[]),i=ES(),[a]=se.useState(e3),[l,u]=se.useState("overview"),[f,d]=se.useState(!1),[m,p]=se.useState(Ej),[g,b]=se.useState(!1),[y,w]=se.useState(!1),[O,T]=se.useState(Kz),A=se.useSyncExternalStore(n.subscribe,n.getSnapshot,n.getSnapshot),k=dk(a.adminUrl,a.nativeUrl,n,m),L=hk(a.nativeUrl,n,i),D=L.configuration?`${aS(L.configuration.forks)} ${L.configuration.node.network}`:" ",X=N3(L.tops,L.branch);function G(V){Gz(V),T(V)}function ee(V){Oj(V),p(V)}return x.jsxs("div",{className:"bg-background text-textPrimary min-h-screen",children:[x.jsx("header",{className:"border-accent/30 bg-surface/90 border-b backdrop-blur",children:x.jsx("div",{className:"mx-auto max-w-7xl px-4 py-4",children:x.jsxs("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-4",children:[x.jsxs("div",{className:"order-1 flex flex-col",children:[x.jsx("button",{type:"button",onClick:()=>{u("overview")},className:"text-accent text-left text-lg font-semibold tracking-tight",children:"Libbitcoin Server"}),x.jsx("span",{className:"text-textMuted text-sm",children:D})]}),x.jsx("nav",{className:"text-textMuted order-3 flex w-full items-center gap-3 text-sm md:order-2 md:w-auto",children:pk.map(V=>x.jsxs("button",{type:"button",onClick:()=>{u(V.id)},className:`text-textMuted hover:text-accent rounded-md px-3 py-1 text-sm transition ${l===V.id?"bg-accentSecondary/20 text-accent":""}`,children:[V.label,V.id==="logs"&&A.totalLogs>0&&x.jsx("span",{className:"bg-background/60 ml-2 rounded px-1.5 py-0.5 text-[10px] tabular-nums",children:A.totalLogs>999?"999+":String(A.totalLogs)}),V.id==="events"&&A.totalEvents>0&&x.jsx("span",{className:"bg-background/60 ml-2 rounded px-1.5 py-0.5 text-[10px] tabular-nums",children:A.totalEvents>999?"999+":String(A.totalEvents)})]},V.id))}),x.jsx("div",{className:"order-2 ml-auto flex items-center gap-3 md:order-3",children:x.jsx("button",{type:"button",onClick:()=>{d(!0)},className:"border-accent/40 text-accent hover:border-accent hover:text-accentSecondary rounded-md border px-3 py-2 text-sm font-medium",children:"Settings"})})]})})}),x.jsxs("main",{className:"mx-auto min-h-[calc(100vh-4rem)] max-w-7xl min-w-0 space-y-6 px-4 py-8",children:[x.jsxs("header",{children:[x.jsx("p",{className:"text-accentSecondary text-sm tracking-wide uppercase",children:"Administration"}),x.jsx("h1",{className:"text-accent text-3xl font-semibold",children:"Admin Dashboard"})]}),l==="overview"&&x.jsx(mj,{adminStatus:k,endpoints:a,metrics:A,native:L,sync:X}),l==="logs"&&x.jsx(GA,{metrics:n,delivery:A,status:k,logFilter:m,paused:g,onLogFilterChange:ee,onPausedChange:V=>{n.setLogsPaused(V),b(V)},onClear:()=>{n.clearLogs()}}),l==="events"&&x.jsx(PA,{metrics:n,paused:y,onPausedChange:V=>{n.setEventsPaused(V),w(V)},onClear:()=>{n.clearEvents()}})]}),x.jsx(bj,{sync:X,browserNotificationsEnabled:O}),f&&x.jsx(Fz,{browserNotificationsEnabled:O,onClose:()=>{d(!1)},onBrowserNotificationsEnabledChange:G})]})}function vk({children:n}){const[i]=se.useState(()=>new ek({defaultOptions:{queries:{staleTime:1e4,refetchOnWindowFocus:!1,retry:1}}}));return x.jsx(Aj,{client:i,children:n})}Lz();const Rx=document.querySelector("#root");if(!Rx)throw new Error("Root element not found");Zz.createRoot(Rx).render(x.jsx(Az.StrictMode,{children:x.jsx(vk,{children:x.jsx(gk,{})})})); )DELIM" ) diff --git a/console/embedded/native_ecma.cpp b/console/embedded/native_ecma.cpp index 63e4cc6b..ffa04703 100644 --- a/console/embedded/native_ecma.cpp +++ b/console/embedded/native_ecma.cpp @@ -311,56 +311,56 @@ R"DELIM(to deal * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -function Xk(e,r){for(var i=0;is[l]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const r=document.createElement("link").relList;if(r&&r.supports&&r.supports("modulepreload"))return;for(const l of document.querySelectorAll('link[rel="modulepreload"]'))s(l);new MutationObserver(l=>{for(const c of l)if(c.type==="childList")for(const d of c.addedNodes)d.tagName==="LINK"&&d.rel==="modulepreload"&&s(d)}).observe(document,{childList:!0,subtree:!0});function i(l){const c={};return l.integrity&&(c.integrity=l.integrity),l.referrerPolicy&&(c.referrerPolicy=l.referrerPolicy),l.crossOrigin==="use-credentials"?c.credentials="include":l.crossOrigin==="anonymous"?c.credentials="omit":c.credentials="same-origin",c}function s(l){if(l.ep)return;l.ep=!0;const c=i(l);fetch(l.href,c)}})();function Bp(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var dm={exports:{}},dl={};var Kb;function Jk(){if(Kb)return dl;Kb=1;var e=Symbol.for("react.transitional.element"),r=Symbol.for("react.fragment");function i(s,l,c){var d=null;if(c!==void 0&&(d=""+c),l.key!==void 0&&(d=""+l.key),"key"in l){c={};for(var f in l)f!=="key"&&(c[f]=l[f])}else c=l;return l=c.ref,{$$typeof:e,type:s,key:d,ref:l!==void 0?l:null,props:c}}return dl.Fragment=r,dl.jsx=i,dl.jsxs=i,dl}var Qb;function Wk(){return Qb||(Qb=1,dm.exports=Jk()),dm.exports}var p=Wk(),fm={exports:{}},$e={};var Xb;function e_(){if(Xb)return $e;Xb=1;var e=Symbol.for("react.transitional.element"),r=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),l=Symbol.for("react.profiler"),c=Symbol.for("react.consumer"),d=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),m=Symbol.for("react.suspense"),g=Symbol.for("react.memo"),v=Symbol.for("react.lazy"),y=Symbol.for("react.activity"),x=Symbol.for("react.view_transition"),w=Symbol.iterator;function E(j){return j===null||typeof j!="object"?null:(j=w&&j[w]||j["@@iterator"],typeo)DELIM" -R"DELIM(f j=="function"?j:null)}var _={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},N=Object.assign,H={};function O(j,G,he){this.props=j,this.context=G,this.refs=H,this.updater=he||_}O.prototype.isReactComponent={},O.prototype.setState=function(j,G){if(typeof j!="object"&&typeof j!="function"&&j!=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,j,G,"setState")},O.prototype.forceUpdate=function(j){this.updater.enqueueForceUpdate(this,j,"forceUpdate")};function se(){}se.prototype=O.prototype;function ce(j,G,he){this.props=j,this.context=G,this.refs=H,this.updater=he||_}var K=ce.prototype=new se;K.constructor=ce,N(K,O.prototype),K.isPureReactComponent=!0;var oe=Array.isArray;function R(){}var k={H:null,A:null,T:null,S:null},z=Object.prototype.hasOwnProperty;function P(j,G,he){var ee=he.ref;return{$$typeof:e,type:j,key:G,ref:ee!==void 0?ee:null,props:he}}function F(j,G){return P(j.type,G,j.props)}function X(j){return typeof j=="object"&&j!==null&&j.$$typeof===e}function fe(j){var G={"=":"=0",":":"=2"};return"$"+j.replace(/[=:]/g,function(he){return G[he]})}var ge=/\/+/g;function re(j,G){return typeof j=="object"&&j!==null&&j.key!=null?fe(""+j.key):G.toString(36)}function Q(j){switch(j.status){case"fulfilled":return j.value;case"rejected":throw j.reason;default:switch(typeof j.status=="string"?j.then(R,R):(j.status="pending",j.then(function(G){j.status==="pending"&&(j.status="fulfilled",j.value=G)},function(G){j.status==="pending"&&(j.status="rejected",j.reason=G)})),j.status){case"fulfilled":return j.value;case"rejected":throw j.reason}}throw j}function Y(j,G,he,ee,je){var J=typeof j;(J==="undefined"||J==="boolean")&&(j=null);var me=!1;if(j===null)me=!0;else switch(J){case"bigint":case"string":case"number":me=!0;break;case"object":switch(j.$$typeof){case e:case r:me=!0;break;case v:return me=j._init,Y(me(j._payload),G,he,ee,je)}}if(me)return je=je(j),me=ee===""?"."+re(j,0):ee,oe(je)?(he="",me!=null&&(he=me.replace(ge,"$&/")+"/"),Y(je,G,he,"",function(be){return be})):je!=null&&(X(je)&&(je=F(je,he+(je.key==null||j&&j.key===je.key?"":(""+je.key).replace(ge,"$&/")+"/")+me)),G.push(je)),1;me=0;var W=ee===""?".":ee+":";if(oe(j))for(var le=0;le>>1,ye=Q[$];if(0>>1;$l(Ce,ie))jl(G,Ce)?(Q[$]=G,Q[j]=ie,$=j):(Q[$]=Ce,Q[xe]=ie,$=xe);else if(jl(G,ie))Q[$]=G,Q[j]=ie,$=j;else break e}}return Y}function l(Q,Y){var ie=Q.sortIndex-Y.sortIndex;return ie!==0?ie:Q.id-Y.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var c=performance;e.unstable_now=function(){return c.now()}}else{var d=Date,f=d.now();e.unstable_now=function(){return d.now()-f}}var m=[],g=[],v=1,y=null,x=3,w=!1,E=!1,_=!1,N=!1,H=typeof setTimeout=="function"?setTimeout:null,O=typeof clearTimeout=="function"?clearTimeout:null,se=typeof setImmediate<"u"?setImmediate:null;function ce(Q){for(var Y=i(g);Y!==null;){if(Y.callback===null)s(g);else if(Y.startTime<=Q)s(g),Y.sortIndex=Y.expirationTime,r(m,Y);else break;Y=i(g)}}function K(Q){if(_=!1,ce(Q),!E)if(i(m)!==null)E=!0,oe||(oe=!0,X());else{var Y=i(g);Y!==null&&re(K,Y.startTime-Q)}}var oe=!1,R=-1,k=5,z=-1;function P(){return N?!0:!(e.unstable_now()-zQ&&P());){var $=y.callback;if(typeof $=="function"){y.callback=null,x=y.priorityLevel;var ye=$(y.expirationTime<=Q);if(Q=e.unstable_now(),typeof ye=="function"){y.callback=ye,ce(Q),Y=!0;break t}y===i(m)&&s(m),ce(Q)}else s(m);y=i(m)}if(y!==null)Y=!0;else{var He=i(g);He!==null&&re(K,He.startTime-Q),Y=!1}}break e}finally{y=null,x=ie,w=!1}Y=void 0}}finally{Y?X():oe=!1}}}var X;if(typeof se=="function")X=function(){se(F)};else if(typeof MessageChannel<"u"){var fe=new MessageChannel,ge=fe.port2;fe.port1.onmessage=F,X=function(){ge.postMessage(null)}}else X=function(){H(F,0)};function re(Q,Y){R=H(function(){Q(e.unstable_now())},Y)}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(Q){Q.callback=null},e.unstable_forceFrameRate=function(Q){0>Q||125$?(Q.sortIndex=ie,r(g,Q),i(m)===null&&Q===i(g)&&(_?(O(R),R=-1):_=!0,re(K,ie-$))):(Q.sortIndex=ye,r(m,Q),E||w||(E=!0,oe||(oe=!0,X()))),Q},e.unstable_shouldYield=P,e.unstable_wrapCallback=function(Q){var Y=x;return function(){var ie=x;x=Y;try{return Q.apply(this,arguments)}finally{x=ie}}}})(pm)),pm}var ex;function r_(){return ex||(ex=1,mm.exports=n_()),mm.exports}var gm={exports:{}},gn={};var tx;function a_(){if(tx)return gn;tx=1;var e=Lp();function r(v){var y="https://react.dev/errors/"+v;if(1"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(r){console.error(r)}}return e(),gm.exports=a_(),gm.exports}var rx;function i_(){if(rx)return fl;rx=1;var e=r_(),r=Lp(),i=vw();function s(t){var n="https://react.dev/errors/"+t;if(1_e||(t.current=pe[_e],pe[_e]=null,_e--)}function Ue(t,n){_e++,pe[_e]=t.current,t.current=n}var dt=Me(null),qt=Me(null),Ye=Me(null),st=Me(null);function ot(t,n){switch(Ue(Ye,n),Ue(qt,t),Ue(dt,null),n.nodeType){case 9:case 11:t=(t=n.documentElement)&&(t=t.namespaceURI)?ab(t):0;break;default:if(t=n.tagName,n=n.namespaceURI)n=ab(n),t=ib(n,t);else switch(t){case"svg":t=1;break;case"math":t=2;break;default:t=0}}Be(dt),Ue(dt,t)}function at(){Be(dt),Be(qt),Be(Ye)}function wt(t){var n=t.memoizedState;n!==null&&($s._currentValue=n.memoizedState,Ue(st,t)),n=dt.current;var a=ib(n,t.type);n!==a&&(Ue(qt,t),Ue(dt,a))}function ln(t){qt.current===t&&(Be(dt),Be(qt)),st.current===t&&(Be(st),$s._currentValue=be)}var xn,Ar;function Dt(t){if(xn===void 0)try{throw Error()}catch(a){var n=a.stack.trim().match(/\n( *(at )?)/);xn=n&&n[1]||"",Ar=-1s[l]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const r=document.createElement("link").relList;if(r&&r.supports&&r.supports("modulepreload"))return;for(const l of document.querySelectorAll('link[rel="modulepreload"]'))s(l);new MutationObserver(l=>{for(const c of l)if(c.type==="childList")for(const d of c.addedNodes)d.tagName==="LINK"&&d.rel==="modulepreload"&&s(d)}).observe(document,{childList:!0,subtree:!0});function i(l){const c={};return l.integrity&&(c.integrity=l.integrity),l.referrerPolicy&&(c.referrerPolicy=l.referrerPolicy),l.crossOrigin==="use-credentials"?c.credentials="include":l.crossOrigin==="anonymous"?c.credentials="omit":c.credentials="same-origin",c}function s(l){if(l.ep)return;l.ep=!0;const c=i(l);fetch(l.href,c)}})();function Dp(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var dm={exports:{}},dl={};var Gb;function Jk(){if(Gb)return dl;Gb=1;var e=Symbol.for("react.transitional.element"),r=Symbol.for("react.fragment");function i(s,l,c){var d=null;if(c!==void 0&&(d=""+c),l.key!==void 0&&(d=""+l.key),"key"in l){c={};for(var f in l)f!=="key"&&(c[f]=l[f])}else c=l;return l=c.ref,{$$typeof:e,type:s,key:d,ref:l!==void 0?l:null,props:c}}return dl.Fragment=r,dl.jsx=i,dl.jsxs=i,dl}var Kb;function Wk(){return Kb||(Kb=1,dm.exports=Jk()),dm.exports}var p=Wk(),fm={exports:{}},$e={};var Qb;function e_(){if(Qb)return $e;Qb=1;var e=Symbol.for("react.transitional.element"),r=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),l=Symbol.for("react.profiler"),c=Symbol.for("react.consumer"),d=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),m=Symbol.for("react.suspense"),g=Symbol.for("react.memo"),v=Symbol.for("react.lazy"),y=Symbol.for("react.activity"),x=Symbol.for("react.view_transition"),w=Symbol.iterator;function E(j){return j===null||typeof j!="object"?null:(j=w&&j[w]||j["@@iterator"],typeo)DELIM" +R"DELIM(f j=="function"?j:null)}var _={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},N=Object.assign,H={};function O(j,G,he){this.props=j,this.context=G,this.refs=H,this.updater=he||_}O.prototype.isReactComponent={},O.prototype.setState=function(j,G){if(typeof j!="object"&&typeof j!="function"&&j!=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,j,G,"setState")},O.prototype.forceUpdate=function(j){this.updater.enqueueForceUpdate(this,j,"forceUpdate")};function se(){}se.prototype=O.prototype;function ce(j,G,he){this.props=j,this.context=G,this.refs=H,this.updater=he||_}var K=ce.prototype=new se;K.constructor=ce,N(K,O.prototype),K.isPureReactComponent=!0;var oe=Array.isArray;function R(){}var k={H:null,A:null,T:null,S:null},z=Object.prototype.hasOwnProperty;function P(j,G,he){var ee=he.ref;return{$$typeof:e,type:j,key:G,ref:ee!==void 0?ee:null,props:he}}function F(j,G){return P(j.type,G,j.props)}function X(j){return typeof j=="object"&&j!==null&&j.$$typeof===e}function fe(j){var G={"=":"=0",":":"=2"};return"$"+j.replace(/[=:]/g,function(he){return G[he]})}var ge=/\/+/g;function re(j,G){return typeof j=="object"&&j!==null&&j.key!=null?fe(""+j.key):G.toString(36)}function Q(j){switch(j.status){case"fulfilled":return j.value;case"rejected":throw j.reason;default:switch(typeof j.status=="string"?j.then(R,R):(j.status="pending",j.then(function(G){j.status==="pending"&&(j.status="fulfilled",j.value=G)},function(G){j.status==="pending"&&(j.status="rejected",j.reason=G)})),j.status){case"fulfilled":return j.value;case"rejected":throw j.reason}}throw j}function Y(j,G,he,ee,je){var J=typeof j;(J==="undefined"||J==="boolean")&&(j=null);var me=!1;if(j===null)me=!0;else switch(J){case"bigint":case"string":case"number":me=!0;break;case"object":switch(j.$$typeof){case e:case r:me=!0;break;case v:return me=j._init,Y(me(j._payload),G,he,ee,je)}}if(me)return je=je(j),me=ee===""?"."+re(j,0):ee,oe(je)?(he="",me!=null&&(he=me.replace(ge,"$&/")+"/"),Y(je,G,he,"",function(be){return be})):je!=null&&(X(je)&&(je=F(je,he+(je.key==null||j&&j.key===je.key?"":(""+je.key).replace(ge,"$&/")+"/")+me)),G.push(je)),1;me=0;var W=ee===""?".":ee+":";if(oe(j))for(var le=0;le>>1,ye=Q[$];if(0>>1;$l(Ce,ie))jl(G,Ce)?(Q[$]=G,Q[j]=ie,$=j):(Q[$]=Ce,Q[xe]=ie,$=xe);else if(jl(G,ie))Q[$]=G,Q[j]=ie,$=j;else break e}}return Y}function l(Q,Y){var ie=Q.sortIndex-Y.sortIndex;return ie!==0?ie:Q.id-Y.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var c=performance;e.unstable_now=function(){return c.now()}}else{var d=Date,f=d.now();e.unstable_now=function(){return d.now()-f}}var m=[],g=[],v=1,y=null,x=3,w=!1,E=!1,_=!1,N=!1,H=typeof setTimeout=="function"?setTimeout:null,O=typeof clearTimeout=="function"?clearTimeout:null,se=typeof setImmediate<"u"?setImmediate:null;function ce(Q){for(var Y=i(g);Y!==null;){if(Y.callback===null)s(g);else if(Y.startTime<=Q)s(g),Y.sortIndex=Y.expirationTime,r(m,Y);else break;Y=i(g)}}function K(Q){if(_=!1,ce(Q),!E)if(i(m)!==null)E=!0,oe||(oe=!0,X());else{var Y=i(g);Y!==null&&re(K,Y.startTime-Q)}}var oe=!1,R=-1,k=5,z=-1;function P(){return N?!0:!(e.unstable_now()-zQ&&P());){var $=y.callback;if(typeof $=="function"){y.callback=null,x=y.priorityLevel;var ye=$(y.expirationTime<=Q);if(Q=e.unstable_now(),typeof ye=="function"){y.callback=ye,ce(Q),Y=!0;break t}y===i(m)&&s(m),ce(Q)}else s(m);y=i(m)}if(y!==null)Y=!0;else{var He=i(g);He!==null&&re(K,He.startTime-Q),Y=!1}}break e}finally{y=null,x=ie,w=!1}Y=void 0}}finally{Y?X():oe=!1}}}var X;if(typeof se=="function")X=function(){se(F)};else if(typeof MessageChannel<"u"){var fe=new MessageChannel,ge=fe.port2;fe.port1.onmessage=F,X=function(){ge.postMessage(null)}}else X=function(){H(F,0)};function re(Q,Y){R=H(function(){Q(e.unstable_now())},Y)}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(Q){Q.callback=null},e.unstable_forceFrameRate=function(Q){0>Q||125$?(Q.sortIndex=ie,r(g,Q),i(m)===null&&Q===i(g)&&(_?(O(R),R=-1):_=!0,re(K,ie-$))):(Q.sortIndex=ye,r(m,Q),E||w||(E=!0,oe||(oe=!0,X()))),Q},e.unstable_shouldYield=P,e.unstable_wrapCallback=function(Q){var Y=x;return function(){var ie=x;x=Y;try{return Q.apply(this,arguments)}finally{x=ie}}}})(pm)),pm}var Wb;function r_(){return Wb||(Wb=1,mm.exports=n_()),mm.exports}var gm={exports:{}},gn={};var ex;function a_(){if(ex)return gn;ex=1;var e=Bp();function r(v){var y="https://react.dev/errors/"+v;if(1"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(r){console.error(r)}}return e(),gm.exports=a_(),gm.exports}var nx;function i_(){if(nx)return fl;nx=1;var e=r_(),r=Bp(),i=yw();function s(t){var n="https://react.dev/errors/"+t;if(1_e||(t.current=pe[_e],pe[_e]=null,_e--)}function Ue(t,n){_e++,pe[_e]=t.current,t.current=n}var dt=Me(null),qt=Me(null),Ye=Me(null),st=Me(null);function ot(t,n){switch(Ue(Ye,n),Ue(qt,t),Ue(dt,null),n.nodeType){case 9:case 11:t=(t=n.documentElement)&&(t=t.namespaceURI)?rb(t):0;break;default:if(t=n.tagName,n=n.namespaceURI)n=rb(n),t=ab(n,t);else switch(t){case"svg":t=1;break;case"math":t=2;break;default:t=0}}Be(dt),Ue(dt,t)}function at(){Be(dt),Be(qt),Be(Ye)}function wt(t){var n=t.memoizedState;n!==null&&($s._currentValue=n.memoizedState,Ue(st,t)),n=dt.current;var a=ab(n,t.type);n!==a&&(Ue(qt,t),Ue(dt,a))}function ln(t){qt.current===t&&(Be(dt),Be(qt)),st.current===t&&(Be(st),$s._currentValue=be)}var xn,Ar;function Dt(t){if(xn===void 0)try{throw Error()}catch(a){var n=a.stack.trim().match(/\n( *(at )?)/);xn=n&&n[1]||"",Ar=-1)":-1u||C[o]!==U[u]){var V=` `+C[o].replace(" at new "," at ");return t.displayName&&V.includes("")&&(V=V.replace("",t.displayName)),V}while(1<=o&&0<=u);break}}}finally{kn=!1,Error.prepareStackTrace=a}return(a=t?t.displayName||t.name:"")?Dt(a):""}function Bd(t,n){switch(t.tag){case 26:case 27:case 5:return Dt(t.type);case 16:return Dt("Lazy");case 13:return t.child!==n&&n!==null?Dt("Suspense Fallback"):Dt("Suspense");case 19:return Dt("SuspenseList");case 0:case 15:return vo(t.type,!1);case 11:return vo(t.type.render,!1);case 1:return vo(t.type,!0);case 31:return Dt("Activity");case 30:return Dt("ViewTransition");default:return""}}function es(t){try{var n="",a=null;do n+=Bd(t,a),a=t,t=t.return;while(t);return n}catch(o){return` Error generating stack: `+o.message+` -`+o.stack}}var bo=Object.prototype.hasOwnProperty,Zn=e.unstable_scheduleCallback,ts=e.unstable_cancelCallback,nc=e.unstable_shouldYield,rc=e.unstable_requestPaint,_n=e.unstable_now,ac=e.unstable_getCurrentPriorityLevel,vi=e.unstable_ImmediatePriority,xo=e.unstable_UserBlockingPriority,ka=e.unstable_NormalPriority,Ld)DELIM" -R"DELIM(=e.unstable_LowPriority,wo=e.unstable_IdlePriority,Ud=e.log,ic=e.unstable_setDisableYieldValue,Or=null,Jt=null;function br(t){if(typeof Ud=="function"&&ic(t),Jt&&typeof Jt.setStrictMode=="function")try{Jt.setStrictMode(Or,t)}catch{}}var Nn=Math.clz32?Math.clz32:D,Hd=Math.log,A=Math.LN2;function D(t){return t>>>=0,t===0?32:31-(Hd(t)/A|0)|0}var I=256,ue=262144,de=4194304;function Te(t){var n=t&42;if(n!==0)return n;switch(t&-t){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return t&-t;case 262144:case 524288:case 1048576:case 2097152:return t&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return t&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return t}}function Se(t,n,a){var o=t.pendingLanes;if(o===0)return 0;var u=0,h=t.suspendedLanes,b=t.pingedLanes;t=t.warmLanes;var S=o&134217727;return S!==0?(o=S&~h,o!==0?u=Te(o):(b&=S,b!==0?u=Te(b):a||(a=S&~t,a!==0&&(u=Te(a))))):(S=o&~h,S!==0?u=Te(S):b!==0?u=Te(b):a||(a=o&~t,a!==0&&(u=Te(a)))),u===0?0:n!==0&&n!==u&&(n&h)===0&&(h=u&-u,a=n&-n,h>=a||h===32&&(a&4194048)!==0)?n:u}function Ne(t,n){return(t.pendingLanes&~(t.suspendedLanes&~t.pingedLanes)&n)===0}function Ee(t,n){(n&8)!==0&&(n|=n&32);var a=t.entangledLanes;if(a!==0)for(t=t.entanglements,a&=n;0a;a++)n.push(t);return n}function ze(t,n){t.pendingLanes|=n,n!==268435456&&(t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0)}function lt(t,n,a,o,u,h){var b=t.pendingLanes;t.pendingLanes=a,t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0,t.expiredLanes&=a,t.entangledLanes&=a,t.errorRecoveryDisabledLanes&=a,t.shellSuspendCounter=0;var S=t.entanglements,C=t.expirationTimes,U=t.hiddenUpdates;for(a=b&~a;0"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Yd=!1;if(aa)try{var To={};Object.defineProperty(To,"passive",{get:function(){Yd=!0}}),window.addEventListener("test",To,To),window.removeEventListener("test",To,To)}catch{Yd=!1}var Ca=null,Gd=null,uc=null;function ey(){if(uc)return uc;var t,n=Gd,a=n.length,o,u="value"in Ca?Ca.value:Ca.textContent,h=u.length;)DELIM" -R"DELIM(for(t=0;t=No),sy=" ",oy=!1;function ly(t,n){switch(t){case"keyup":return G2.indexOf(n.keyCode)!==-1;case"keydown":return n.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function cy(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var cs=!1;function Q2(t,n){switch(t){case"compositionend":return cy(n);case"keypress":return n.which!==32?null:(oy=!0,sy);case"textInput":return t=n.data,t===sy&&oy?null:t;default:return null}}function X2(t,n){if(cs)return t==="compositionend"||!Wd&&ly(t,n)?(t=ey(),uc=Gd=Ca=null,cs=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(n.ctrlKey||n.altKey||n.metaKey)||n.ctrlKey&&n.altKey){if(n.char&&1"u")return null;try{return t.activeElement||t.body}catch{return t.body}}function yy(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function vy(t,n){var a=yy(t);t=0;for(var o;a;){if(a.nodeType===3){if(o=t+a.textContent.length,t<=n&&o>=n)return{node:a,offset:n-t};t=o}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=yy(a)}}function by(t,n){return t&&n?t===n?!0:t&&t.nodeType===3?!1:n&&n.nodeType===3?by(t,n.parentNode):"contains"in t?t.contains(n):t.compareDocumentPosition?!!(t.compareDocumentPosition(n)&16):!1:!1}function xy(t){t=t!=null&&t.ownerDocument!=null&&t.ownerDocument.defaultView!=null?t.ownerDocument.defaultView:window;for(var n=nf(t.document);n instanceof t.HTMLIFrameElement;){try{var a=typeof n.contentWindow.location.href=="string"}catch{a=!1}if(a)t=n.contentWindow;else break;n=nf(t.document)}return n}function rf(t){var n=t&&t.nodeName&&t.nodeName.toLowerCase();return n&&(n==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||n==="textarea"||t.contentEditable==="true")}var iT=aa&&"documentMode"in document&&11>=document.documentMode,us=null,af=nul)DELIM" -R"DELIM(l,Ao=null,sf=!1;function wy(t,n,a){var o=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;sf||us==null||us!==nf(o)||(o=us,"selectionStart"in o&&rf(o)?o={start:o.selectionStart,end:o.selectionEnd}:(o=(o.ownerDocument&&o.ownerDocument.defaultView||window).getSelection(),o={anchorNode:o.anchorNode,anchorOffset:o.anchorOffset,focusNode:o.focusNode,focusOffset:o.focusOffset}),Ao&&Ro(Ao,o)||(Ao=o,o=pu(af,"onSelect"),0>=b,u-=b,Ur=1<<32-Nn(n)+u|a<Le?(Vt=Oe,Oe=null):Vt=Oe.sibling;var nt=B(L,Oe,q[Le],te);if(nt===null){Oe===null&&(Oe=Vt);break}t&&Oe&&nt.alternate===null&&n(L,Oe),M=h(nt,M,Le),We===null?we=nt:We.sibling=nt,We=nt,Oe=Vt}if(Le===q.length)return a(L,Oe),Ke&&la(L,Le),we;if(Oe===null){for(;LeLe?(Vt=Oe,Oe=null):Vt=Oe.sibling;var Wa=B(L,Oe,nt.value,te);if(Wa===null){Oe===null&&(Oe=Vt);break}t&&Oe&&Wa.alternate===null&&n(L,Oe),M=h(Wa,M,Le),We===null?we=Wa:We.sibling=Wa,We=Wa,Oe=Vt}if(nt.done)return a(L,Oe),Ke&&la(L,Le),we;if(Oe===null){for(;!nt.done;Le++,nt=q.next())nt=ne(L,nt.value,te),nt!==null&&(M=h(nt,M,Le),We===null?we=nt:We.sibling=nt,We=nt);return Ke&&la(L,Le),we}for(Oe=o(Oe);!nt.done;Le++,nt=q.next())nt=Z(Oe,L,Le,nt.value,te),nt!==null&&(t&&(Vt=nt.alternate,Vt!==null&&Oe.delete(Vt.key===null?Le:Vt.key)),M=h(nt,M,Le),We===null?we=nt:We.sibling=nt,We=nt);return t&&Oe.forEach(function(Qk){return n(L,Qk)}),Ke&&la(L,Le),we}function Fe(L,M,q,te){if(typeof q=="object"&&q!==null&&q.type===F&&q.key===null&&q.props.ref===void 0&&(q=q.props.children),typeof q=="object"&&q!==null){switch(q.$$typeof){case z:e:{for(var we=q.key;M!==null;){if(M.key===we){if(we=q.type,we===F){if(M.tag===7){a(L,M.sibling),te=u(M,q.props.children),za(te,q),te.return=L,L=te;break e}}else if(M.elementType===we||typeof we=="object"&&we!==null&&we.$$typeof===ye&&Ai(we)===M.type){a(L,M.sibling),te=u(M,q.props),za(te,q),te.return=L,L=te;break e}a(L,M);break}else n(L,M);M=M.sibling}q.type===F?(te=Ti(q.props.children,L.mode,te,q.key),za(te,q),te.return=L,L=te):(te=xc(q.type,q.key,q.props,null,L.mode,te),za(te,q),te.return=L,L=te)}return b(L);case P:e:{for(we=q.key;M!==null;){if(M.key===we)if(M.tag===4&&M.stateNode.containerInfo===q.containerInfo&&M.stateNode.implementation===q.implementation){a(L,M.sibling),te=u(M,q.children||[]),te.return=L,L=te;break e}else{a(L,M);break}else n(L,M);M=M.sibling}te=hf(q,L.mode,te),te.return=L,L=te}return b(L);case ye:return q=Ai(q),Fe(L,M,q,te)}if(me(q))return ve(L,M,q,te);if(ee(q)){if(we=ee(q),typeof we!="function")throw Error(s(150));return q=we.call(q),ke(L,M,q,te)}if(typeof q.then=="function")return Fe(L,M,Rc(q),te);if(q.$$typeof===re)return Fe(L,M,_c(L,q),te);Ac(L,q)}return typeof q=="string"&&q!==""||typeof q=="number"||typeof q=="bigint"?(q=""+q,M!==null&&M.tag===6?(a(L,M.sibling),te=u(M,q),te.return=L,L=te):(a(L,M),te=ff(q,L.mode,te),te.return=L,L=te),b(L)):a(L,M)}return function(L,M,q,te){try{Lo=0;var we=Fe(L,M,q,te);return bs=null,we}catch(Oe){if(Oe===vs||Oe===Cc)throw Oe;var We=Bn(29,Oe,null,L.mode);return We.lanes=te,We.return=L,We}}}var Mi=Fy(!0),Vy=Fy(!1),Da=!1;function Ef(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Tf(t,n){t=t.updateQueue,n.updateQueue===t&&(n.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,callbacks:null})}function Ba(t){return{lane:t,tag:0,payload:null,callback:null,next:null}}function La(t,n,a){var o=t.updateQueue;if(o===null)return null;if(o=o.shared,(ft&2)!==0){var u=o.pending;return u===null?n.next=n:(n.next=u.next,u.next=n),o.pending=n,n=bc(t),jy(t,null,a),n}return vc(t,o,n,a),bc(t)}function Uo(t,n,a){if(n=n.updateQueue,n!==null&&(n=n.shared,(a&4194048)!==0)){var o=n.lanes;o&=t.pendingLanes,a|=o,n.lanes=a,Bt(t,a)}}function kf(t,n){var a=t.updateQueue,o=t.alternate;if(o!==null&&(o=o.updateQueue,a===o)){var u=null,h=null;if(a=a.firstBaseUpdate,a!==null){do{var b={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};h===null?u=h=b:h=h.next=b,a=a.next}while(a!==null);h===null?u=h=n:h=h.next=n}else u=h=n;a={baseState:o.baseState,firstBaseUpdate:u,lastBaseUpdate:h,shared:o.shared,callbacks:o.callbacks},t.updateQueue=a;return}t=a.lastBaseUpdate,t===null?a.firstBaseUpdate=n:t.next=n,a.lastBaseUpdate=n}var _f=!1;function Ho(){if(_f){var t=ys;if(t!==null)throw t}}function Po(t,n,a,o){_f=!1;var u=t.updateQueue;Da=!1;var h=u.firstBaseUpdate,b=u.lastBaseUpdate,S=u.shared.pending;if(S!==null){u.shared.pending=null;var C=S,U=C.next;C.next=null,b===null?h=U:b.next=U,b=C;var V=t.alternate;V!==null&&(V=V.updateQueue,S=V.lastBaseUpdate,S!==b&&(S===null?V.firstBaseUpdate=U:S.next=U,V.lastBaseUpdate=C))}if(h!==null){var ne=u.baseState;b=0,V=U=C=null,S=h;do{var B=S.lane&-536870913,Z=B!==S.lane;if(Z?(Je&B)===B:(o&B)===B){B!==0&&B===ji&&(_f=!0),V!==null&&(V=V.next={lane:0,tag:S.tag,payload:S.payload,callback:null,next:null});e:{var ve=t,ke=S;B=n;var Fe=a;switch(ke.tag){case 1:if(ve=ke.payload,typeof ve=="function"){ne=ve.call(Fe,ne,B);break e}ne=ve;break e;case 3:ve.flags=ve.flags&-65537|128;case 0:if(ve=ke.payload,B=typeof ve=="function"?ve.call(Fe,ne,B):ve,B==null)break e;ne=R({},ne,B);break e;case 2:Da=!0}}B=S.callback,B!==null&&(t.flags|=64,Z&&(t.flags|=8192),Z=u.callbacks,Z===null?u.callbacks=[B]:Z.push(B))}else Z={lane:B,tag:S.tag,payload:S.payload,callback:S.callback,next:null},V===null?(U=V=Z,C=ne):V=V.next=Z,b|=B;if(S=S.next,S===null){if(S=u.shared.pending,S===null)break;Z=S,S=Z.next,Z.next=null,u.lastBaseUpdate=Z,u.shared.pending=null}}while(!0);V===null&&(C=ne),u.baseState=C,u.firstBaseUpdate=U,u.lastBaseUpdate=V,h===null&&(u.shared.lanes=0),Ia|=b,t.lanes=b,t.memoizedState=ne}}function Yy(t,n){if(ty)DELIM" -R"DELIM(peof t!="function")throw Error(s(191,t));t.call(n)}function Gy(t,n){var a=t.callbacks;if(a!==null)for(t.callbacks=null,t=0;th?h:8;var b=W.T,S={};S.types=b!==null?b.types:null,W.T=S,Vf(t,!1,n,a);try{var C=u(),U=W.S;if(U!==null&&U(S,C),C!==null&&typeof C=="object"&&typeof C.then=="function"){var V=gT(C,o);Io(t,n,V,Qn(t))}else Io(t,n,o,Qn(t))}catch(ne){Io(t,n,{then:function(){},status:"rejected",reason:ne},Qn())}finally{le.p=h,b!==null&&S.types!==null&&(b.types=S.types),W.T=b}}function ST(){}function If(t,n,a,o){if(t.tag!==5)throw Error(s(476));var u=_v(t).queue;kv(t,u,n,be,a===null?ST:function(){return Nv(t),a(o)})}function _v(t){var n=t.memoizedState;if(n!==null)return n;n={memoizedState:be,baseState:be,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:fa,lastRenderedState:be},next:null};var a={};return n.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:fa,lastRenderedState:a},next:null},t.memoizedState=n,t=t.alternate,t!==null&&(t.memoizedState=n),n}function Nv(t){var n=_v(t);n.next===null&&(n=t.alternate.memoizedState),Io(t,n.next.queue,{},Qn())}function Ff(){return dn($s)}function Cv(){return Ht().memoizedState}function jv(){return Ht().memoizedState}function ET(t){for(var n=t.return;n!==null;){switch(n.tag){case 24:case 3:var a=Qn();t=Ba(a);var o=La(n,t,a);o!==null&&(Pn(o,n,a),Uo(o,n,a)),n={cache:bf()},t.payload=n;return}n=n.return}}function TT(t,n,a){var o=Qn();a={lane:o,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},$c(t)?Av(n,a):(a=uf(t,n,a,o),a!==null&&(Pn(a,t,o),Ov(a,n,o)))}function Rv(t,n,a){var o=Qn();Io(t,n,a,o)}function Io(t,n,a,o){var u={lane:o,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if($c(t))Av(n,u);else{var h=t.alternate;if(t.lanes===0&&(h===null||h.lanes===0)&&(h=n.lastRenderedReducer,h!==null))try{var b=n.lastRenderedState,S=h(b,a);if(u.hasEagerState=!0,u.eagerState=S,Fn(S,b))return vc(t,n,u,0),xt===null&&yc(),!1}catch{}if(a=uf(t,n,u,o),a!==null)return Pn(a,t,o),Ov(a,n,o),!0}return!1}function Vf(t,n,a,o){if(o={lane:2,revertLane:Bh(),gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null},$c(t)){if(n)throw Error(s(479))}else n=uf(t,a,o,2),n!==null&&Pn(n,t,2)}function $c(t){var n=t.alternate;return t===Ie||n!==null&&n===Ie}function Av(t,n){xs=zc=!0;var a=t.pending;a===null?n.next=n:(n.next=a.next,a.next=n),t.pending=n}function Ov(t,n,a){if((a&4194048)!==0){var o=n.lanes;o&=t.pendingLanes,a|=o,n.lanes=a,Bt(t,a)}}var qc={readContext:dn,use:Lc,useCallback:Lt,useContext:Lt,useEffect:Lt,useImperativeHandle:Lt,useLayoutEffect:Lt,useInsertionEffect:Lt,useMemo:Lt,useReducer:Lt,useRef:Lt,useState:Lt,useDebugValue:Lt,useDeferredValue:Lt,useTransition:Lt,useSyncExternalStore:Lt,useId:Lt,useHostTransitionStatus:Lt,useFormState:Lt,useActionState:Lt,useOptimistic:Lt,useMemoCache:Lt,useCacheRefresh:Lt,useEffectEvent:Lt},Mv={readContext:dn,use:Lc,useCallback:function(t,n){return jn().memoizedState=[t,n===void 0?null:n],t},useContext:dn,useEffect:gv,useImperativeHandle:function(t,n,a){a=a!=null?a.concat([t]):null,Hc(4194308,4,xv.bind(null,n,t),a)},useLayoutEffect:function(t,n){return Hc(4194308,4,t,n)},useInsertionEffect:function(t,n){Hc(4,2,t,n)},useMemo:function(t,n){var a=jn();n=n===void 0?null:n;var o=t();if(zi){br(!0);try{t()}finally{br(!1)}}return a.memoizedState=[o,n],o},useReducer:function(t,n,a){var o=jn();if(a!==void 0){var u=a(n);if(zi){br(!0);try{a(n)}finally{br(!1)}}}else u=n;return o.memoizedState=o.baseState=u,t={pending:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:u},o.queue=t,t=t.dispatch=TT.bind(null,Ie,t),[o.memoizedState,t]},useRef:function(t){var n=jn();return t={current:t},n.memoizedState=t},useState:function(t){t=Hf(t);var n=t.queue,a=Rv.bind(null,Ie,n);return n.dispatch=a,[t.memoizedState,a]},useDebugValue:qf,useDeferredValue:function(t,n){var a=jn();return Zf(a,t,n)},useTransition:function(){var t=Hf(!1);return t=kv.bind(null,Ie,t.queue,!0,!1),jn().memoizedState=t,[!1,t]},useSyncExternalStore:function(t,n,a){var o=Ie,u=jn();if(Ke){if(a===void 0)throw Error(s(407));a=a()}else{if(a=n(),xt===null)throw Error(s(349));(Je&127)!==0||ev(o,n,a)}u.memoizedState=a;var h={value:a,getSnapshot:n};return u.queue=h,gv(nv.bind(null,o,h,t),[t]),o.flags|=2048,Ss(9,{destroy:void 0},tv.bind(null,o,h,a,n),null),a},useId:function(){var t=jn(),n=xt.identifierPrefix;if(Ke){var a=Hr,o=Ur;a=(o&~(1<<32-Nn(o)-1)).toString(32)+a,n="_"+n+"R_"+a,a=Dc++,0<\/script>",h=h.removeChild(h.firstChild);break;case"select":h=typeof o.is=="string"?b.createElement("select",{is:o.is}):b.createElement("select"),o.multiple?h.multiple=!0:o.size&&(h.size=o.size);break;default:h=typeof o.is=="string"?b.createElement(u,{is:o.is}):b.createElement(u)}}h[kt]=n,h[Rt]=o;e:for(b=n.child;b!==null;){if(b.tag===5||b.tag===6)h.appendChild(b.stateNode);else if(b.tag!==4&&b.tag!==27&&b.child!==null){b.child.return=b,b=b.child;continue}if(b===n)break e;for(;b.sibling===null;){if(b.return===null||b.return===n)break e;b=b.return}b.sibling.return=b.return,b=b.sibling}n.stateNode=h;e:switch(pn(h,u,o),u){case"button":case"input":case"select":case"textarea":o=!!o.autoFocus;break e;case"img":o=!0;break e;default:o=!1}o&&ma(n)}}return Et(n),n.subtreeFlags&=-33554433,ih(n,n.type,t===null?null:t.memoizedProps,n.pendingProps,a),null;case 6:if(t&&n.stateNode!=null)t.memoizedProps!==o&&ma(n);else{if(typeof o!="string"&&n.stateNode===null)throw Error(s(166));if(t=Ye.current,gs(n)){if(t=n.stateNode,a=n.memoizedProps,o=null,u=nn,u!==null)switch(u.tag){case 27:case 5:o=u.memoizedProps}t[kt]=n,t=!!(t.nodeValue===a||o!==null&&o.suppressHydrationWarning===!0||nb(t.nodeValue,a)),t||Oa(n,!0)}else t=rl(t).createTextNode(o),t[kt]=n,n.stateNode=t}return Et(n),null;case 31:if(a=n.memoizedState,t===null||t.memoizedState!==null){if(o=gs(n),a!==null){if(t===null){if(!o)throw Error(s(318));if(t=n.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(s(557));t[kt]=n}else ki(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;Et(n),t=!1}else a=gf(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=a),t=!0;if(!t)return n.flags&256?(Vn(n),n):(Vn(n),null);if((n.flags&128)!==0)throw Error(s(558))}return Et(n),null;case 13:if(o=n.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(u=gs(n),o!==null&&o.dehydrated!==null){if(t===null){if(!u)throw Error(s(318));if(u=n.memoizedState,u=u!==null?u.dehydrated:null,!u)throw Error(s(317));u[kt]=n}else ki(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;Et(n),u=!1}else u=gf(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=u),u=!0;if(!u)return n.flags&256?(Vn(n),n):(Vn(n),null)}return Vn(n),(n.flags&128)!==0?(n.lanes=a,n):(a=o!==null,t=t!==null&&t.memoizedState!==null,a&&(o=n.child,u=null,o.alternate!==null&&o.alternate.memoizedState!==null&&o.alternate.memoizedState.cachePool!==null&&(u=o.alternate.memoizedState.cachePool.pool),h=null,o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(h=o.memoizedState.cachePool.pool),h!==u&&(o.flags|=2048)),a!==t&&a&&(n.child.flags|=8192),Gc(n,n.updateQueue),Et(n),null);case 4:return at(),t===null&&Ph(n.stateNode.containerInfo),n.flags|=67108864,Et(n),null;case 10:return ua(n.type),Et(n),null;case 19:if(Rf(n),o=n.memoizedState,o===null)return Et(n),null;if(u=(n.flags&128)!==0,h=o.rendering,h===null)if(u)Vo(o,!1);else{if(Ut!==0||t!==null&&(t.flags&128)!==0)for(t=n.child;t!==null;){if(h=Mc(t),h!==null){for(n.flags|=128,Vo(o,!1),t=h.updateQueue,n.updateQueue=t,Gc(n,t),n.subtreeFlags=0,t=a,a=n.child;a!==null;)Ry(a,t),a=a.sibling;return $o(n,hn.current&1|2),Ke&&la(n,o.treeForkCount),n.child}t=t.sibling}o.tail!==null&&_n()>su&&(n.flags|=128,u=!0,Vo(o,!1),n.lanes=4194304)}else{if(!u)if(t=Mc(h),t!==null){if(n.flags|=128,u=!0,t=t.updateQueue,n.updateQueue=t,Gc(n,t),Vo(o,!0),o.tail===null&&o.tailMode!=="collapsed"&&o.tailMode!=="visible"&&!h.alternate&&!Ke)return Et(n),null}else 2*_n()-o.renderingStartTime>su&&a!==536870912&&(n.flags|=128,u=!0,Vo(o,!1),n.lanes=4194304);o.isBackwards?(h.sibling=n.child,n.child=h):(t=o.last,t!==null?t.sibling=h:n.child=h,o.last=h)}if(o.tail!==null){t=o.tail;e:{for(a=t;a!==null;){if(a.alternate!==null){a=!1;break e}a=a.sibling}a=!0}return o.rendering=t,o.tail=t.sibling,o.renderingStartTime=_n(),t.sibling=null,h=hn.current,h=u?h&1|2:h&1,o.tailMode==="visible"||o.tailMode==="collapsed"||!a||Ke?$o(n,h):(a=h,Ue(fn,n),Ue(hn,a),Sn===null&&(Sn=n)),Ke&&la(n,o.treeForkCount),t}return Et(n),null;case 22:case 23:return Vn(n),Cf(),o=n.memoizedState!==null,t!==null?t.memoizedState!==null!==o&&(n.flags|=8192):o&&(n.flags|=8192),o?(a&536870912)!==0&&(n.flags&128)===0&&(Et(n),n.subtreeFlags&6&&(n.flags|=8192)):Et(n),a=n.updateQueue,a!==null&&Gc(n,a.retryQueue),a=null,t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(a=t.memoizedState.cachePool.pool),o=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(o=n.memoizedState.cachePool.pool),o!==a&&(n.flags|=2048),t!==null&&Be(Ri),null;case 24:return a=null,t!==null&&(a=t.memoizedState.cache),n.memoizedState.cache!==a&&(n.flags|=2048),ua(Zt),Et(n),null;case 25:return null;case 30:return n.flags|=33554432,Et(n),null}throw Error(s(156,n.tag))}function AT(t,n){switch(mf(n),n.tag){case 1:return t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 3:return ua(Zt),at(),t=n.flags,(t&65536)!==0&&(t&128)===0?(n.flags=t&-65537|128,n):null;case 26:case 27:case 5:return ln(n),null;case 31:if(n.memoizedState!==null){if(Vn(n),n.alternate===null)throw Error(s(340));ki()}return t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 13:if(Vn(n),t=n.memoizedState,t!==null&&t.dehydrated!==null){if(n.alternate===null)throw Error(s(340));ki()}return t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 19:return Rf(n),t=n.flags,t&65536?(n.flags=t&-65537|128,t=n.memoizedState,t!==null&&(t.rendering=null,t.tail=null),n.flags|=4,n):null;case 4:return at(),null;case 10:return ua(n.type),null;case 22:case 23:return Vn(n),Cf(),t!==null&&Be(Ri),t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 24:return ua(Zt),null;case 25:return null;default:return null}}function a0(t,n){switch(mf(n),n.tag){case 3:ua(Zt),at();break;case 26:case 27:case 5:ln(n);break;case 4:at();break;case 31:n.memoizedState!==null&&Vn(n);break;case 13:Vn(n);break;case 19:Rf(n);break;case 10:ua(n.type);break;case 22:case 23:Vn(n),Cf(),t!==null&&Be(Ri);break;case 24:ua(Zt)}}function Yo(t,n){try{var a=n.updateQueue,o=a!==null?a.lastEffect:null;if(o!==null){var u=o.next;a=u;do{if((a.tag&t)===t){o=void 0;var h=a.create,b=a.inst;o=h(),b.destroy=o}a=a.next}while(a!==u)DELIM" -R"DELIM()}}catch(S){yt(n,n.return,S)}}function $a(t,n,a){try{var o=n.updateQueue,u=o!==null?o.lastEffect:null;if(u!==null){var h=u.next;o=h;do{if((o.tag&t)===t){var b=o.inst,S=b.destroy;if(S!==void 0){b.destroy=void 0,u=n;var C=a,U=S;try{U()}catch(V){yt(u,C,V)}}}o=o.next}while(o!==h)}}catch(V){yt(n,n.return,V)}}function i0(t){var n=t.updateQueue;if(n!==null){var a=t.stateNode;try{Gy(n,a)}catch(o){yt(t,t.return,o)}}}function s0(t,n,a){a.props=Di(t.type,t.memoizedProps),a.state=t.memoizedState;try{a.componentWillUnmount()}catch(o){yt(t,n,o)}}function Pr(t,n){try{var a=t.ref;if(a!==null){switch(t.tag){case 26:case 27:case 5:var o=t.stateNode;break;case 30:var u=t.stateNode,h=ia(t.memoizedProps,u);(u.ref===null||u.ref.name!==h)&&(u.ref=hb(h)),o=u.ref;break;case 7:if(t.stateNode===null){var b=new Xn(t);y(t.child,!1,wk,b,void 0,void 0),t.stateNode=b}o=t.stateNode;break;default:o=t.stateNode}typeof a=="function"?t.refCleanup=a(o):a.current=o}}catch(S){yt(t,n,S)}}function mn(t,n){var a=t.ref,o=t.refCleanup;if(a!==null)if(typeof o=="function")try{o()}catch(u){yt(t,n,u)}finally{t.refCleanup=null,t=t.alternate,t!=null&&(t.refCleanup=null)}else if(typeof a=="function")try{a(null)}catch(u){yt(t,n,u)}else a.current=null}function Kc(t,n){if((t.tag===5||t.tag===27||t.tag===6)&&t.alternate===null&&n!==null)for(var a=0;a title"))),pn(o,n,a),o[kt]=t,Ze(o),n=o;break e;case"link":if(h=Rb("link","href",u).get(n+(a.href||""))){for(b=0;bFe&&(b=Fe,Fe=ke,ke=b);var L=vy(S,ke),M=vy(S,Fe);if(L&&M&&(Z.rangeCount!==1||Z.anchorNode!==L.node||Z.anchorOffset!==L.offset||Z.focusNode!==M.node||Z.focusOffset!==M.offset)){var q=ne.createRange();q.setStart(L.node,L.offset),Z.removeAllRanges(),ke>Fe?(Z.addRange(q),Z.extend(M.node,M.offset)):(q.setEnd(M.node,M.offset),Z.addRange(q))}}}}for(ne=[],Z=S;Z=Z.parentNode;)Z.nodeType===1&&ne.push({element:Z,left:Z.scrollLeft,top:Z.scrollTop});for(typeof S.focus=="function"&&S.focus(),S=0;Sa?32:a,W.T=null,a=_h,_h=null;var h=Tr,b=Vr;if(At=0,Hi=Tr=null,Vr=0,(ft&6)!==0)throw Error(s(331));var S=ft;if(ft|=4,j0(h.current),_0(h,h.current,b,a),ft=S,el(0,!1),Jt&&typeof Jt.onPostCommitFiberRoot=="function")try{Jt.onPostCommitFiberRoot(Or,h)}catch{}return!0}finally{le.p=u,W.T=o,I0(t,n)}}function F0(t,n,a){n=ar(a,n),n=Kf(t.stateNode,n,2),t=La(t,n,2),t!==null&&(ze(t,2),Yr(t))}function yt(t,n,a){if(t.tag===3)F0(t,t,a);else for(;n!==null;){if(n.tag===3){F0(n,t,a);break}else if(n.tag===1){var o=n.stateNode;if(typeof n.type.getDerivedStateFromError=="function"||typeof o.componentDidCatch=="function"&&(Fa===null||!Fa.has(o))){t=ar(a,t),a=$v(2),o=La(n,a,2),o!==null&&(qv(a,o,n,t),ze(o,2),Yr(o));break}}n=n.return}}function Mh(t,n,a){var o=t.pingCache;if(o===null){o=t.pingCache=new DT;var u=new Set;o.set(n,u)}else u=o.get(n),u===void 0&&(u=new Set,o.set(n,u));u.has(a)||(Eh=!0,u.add(a),t=ZT.bind(null,t,n,a),n.then(t,t))}function ZT(t,n,a){var o=t.pingCache;o!==null&&o.delete(n),t.pingedLanes|=t.suspendedLanes&a,t.warmLanes&=~a,xt===t&&(Je&a)===a&&((Ut===4||Ut===3&&(Je&62914560)===Je&&300>_n()-iu)&&(ft&2)===0?Ms(t,0):au|=a,Cs===Je&&(Cs=0)),Yr(t)}function V0(t,n){n===0&&(n=Ae()),t=Ei(t,n),t!==null&&(ze(t,n),Yr(t))}function IT(t){var n=t.memoizedState,a=0;n!==null&&(a=n.retryLane),V0(t,a)}function FT(t,n){var a=0;switch(t.tag){case 31:case 13:var o=t.stateNode,u=t.memoizedState;u!==null&&(a=u.retryLane);break;case 19:o=t.stateNode;break;case 22:o=t.stateNode._retryCache;break;default:throw Error(s(314))}o!==null&&o.delete(n),V0(t,a)}function VT(t,n){return Zn(t,n)}var Ds=null,Bs=null,zh=!1,hu=!1,Dh=!1,Ya=0;function Yr(t){t!==Bs&&t.next===null&&(Bs===null?Ds=Bs=t:Bs=Bs.next=t),hu=!0,zh||(zh=!0,GT())}function el(t,n){if(!Dh&&hu){Dh=!0;do for(var a=!1,o=Ds;o!==null;){if(t!==0){var u=o.pendingLanes;if(u===0)var h=0;else{var b=o.suspendedLanes,S=o.pingedLanes;h=(1<<31-Nn(42|t)+1)-1,h&=u)DELIM" -R"DELIM(&~(b&~S),h=h&201326741?h&201326741|1:h?h|2:0}h!==0&&(a=!0,Q0(o,h))}else h=Je,h=Se(o,o===xt?h:0,o.cancelPendingCommit!==null||o.timeoutHandle!==-1),(h&3)===0||Ne(o,h)||(a=!0,Q0(o,h));o=o.next}while(a);Dh=!1}}function YT(){Y0()}function Y0(){hu=zh=!1;var t=0;Ya!==0&&ik()&&(t=Ya);for(var n=_n(),a=null,o=Ds;o!==null;){var u=o.next,h=G0(o,n);h===0?(o.next=null,a===null?Ds=u:a.next=u,u===null&&(Bs=a)):(a=o,(t!==0||(h&3)!==0)&&(hu=!0)),o=u}At!==0&&At!==5||el(t),Ya!==0&&(Ya=0)}function G0(t,n){for(var a=t.suspendedLanes,o=t.pingedLanes,u=t.expirationTimes,h=t.pendingLanes&-62914561;0S)break;var V=C.transferSize,ne=C.initiatorType;V&&rb(ne)&&(C=C.responseEnd,b+=V*(Cvu){ke.length=ve;break}q=new Promise(dk.bind(q)),ke.push(q)}}}if(0"u"?null:document;function _b(t,n,a){var o=Us;if(o&&typeof n=="string"&&n){var u=nr(n);u='link[rel="'+t+'"][href="'+u+'"]',typeof a=="string"&&(u+='[crossorigin="'+a+'"]'),kb.has(u)||(kb.add(u),t={rel:t,crossOrigin:a,href:n},o.querySelector(u)===null&&(n=o.createElement("link"),pn(n,"link",t),Ze(n),o.head.appendChild(n)))}}function Rk(t){ga.D(t),_b("dns-prefetch",t,null)}function Ak(t,n){ga.C(t,n),_b("preconnect",t,n)}function Ok(t,n,a){ga.L(t,n,a);var o=Us;if(o&&t&&n){var u='link[rel="preload"][as="'+nr(n)+'"]';n==="image"&&a&&a.imageSrcSet?(u+='[imagesrcset="'+nr(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(u+='[imagesizes="'+nr(a.imageSizes)+'"]')):u+='[href="'+nr(t)+'"]';var h=u;switch(n){case"style":h=Hs(t);break;case"script":h=Ps(t)}if(!(ur.has(h)||(t=R({rel:"preload",href:n==="image"&&a&&a.imageSrcSet?void 0:t,as:n},a),ur.set(h,t),o.querySelector(u)!==null||n==="style"&&o.querySelector(il(h))||n==="script"&&o.querySelector(sl(h))))){var b=o.createElement("link");pn(b,"link",t),n==="style"&&(b[Ge]=!0,b.onload=b.onerror=function(){Br(b)}),Ze(b),o.head.appendChild(b)}}}function Mk(t,n){ga.m(t,n);var a=Us;if(a&&t){var o=n&&typeof n.as=="string"?n.as:"script",u='link[rel="modulepreload"][as="'+nr(o)+'"][href="'+nr(t)+'"]',h=u;switch(o){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":h=Ps(t)}if(!ur.has(h)&&(t=R({rel:"modulepreload",href:t},n),ur.set(h,t),a.querySelector(u)===null)){switch(o){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(sl(h)))return}o=a.createElement("link"),pn(o,"link",t),Ze(o),a.head.appendChild(o)}}}function zk(t,n,a){ga.S(t,n,a);var o=Us;if(o&&t){var u=Dr(o).hoistableStyles,h=Hs(t);n=n||"default";var b=u.get(h);if(!b){var S={loading:0,preload:null};if(b=o.querySelector(il(h)))S.loading=5;else{t=R({rel:"stylesheet",href:t,"data-precedence":n},a),(a=ur.get(h))&&nm(t,a);var C=b=o.createElement("link");Ze(C),pn(C,"link",t),C._p=new Promise(function(U,V){C.onload=U,C.onerror=V}),C.addEventListener("load",function(){S.loading|=1}),C.addEventListener("error",function(){S.loading|=2}),S.loading|=4,gu(b,n,o)}b={type:"stylesheet",instance:b,count:1,state:S},u.set(h,b)}}}function Dk(t,n){ga.X(t,n);var a=Us;if(a&&t){var o=Dr(a).hoistableScripts,u=Ps(t),h=o.get(u);h||(h=a.querySelector(sl(u)),h||(t=R({src:t,async:!0},n),(n=ur.get(u))&&rm(t,n),h=a.createElement("script"),Ze(h),pn(h,"link",t),a.head.appendChild(h)),h={type:"script",instance:h,count:1,state:null},o.set(u,h))}}function Bk(t,n){ga.M(t,n);var a=Us;if(a&&t){var o=Dr(a).hoistableScripts,u=Ps(t),h=o.get(u);h||(h=a.querySelector(sl(u)),h||(t=R({src:t,async:!0,type:"module"},n),(n=ur.get(u))&&rm(t,n),h=a.createElement("script"),Ze(h),pn(h,"link",t),a.head.appendChild(h)),h={type:"script",instance:h,count:1,state:null},o.set(u,h))}}function Nb(t,n,a,o){var u=(u=Ye.current)?al(u):null;if(!u)throw Error(s(446));switch(t){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(a=Hs(a.href),n=Dr(u).hoistableStyles,o=n.get(a),o||(o={type:"style",instance:null,count:0,state:null},n.set(a,o)),o):{type:"void",instance:null,count:0,state:null};case"link":if(a.rel==="stylesheet"&&typeof a.href=="string"&&typeof a.precedence=="string"){t=Hs(a.href);var h=Dr(u).hoistableStyles,b=h.get(t);if(b||(u=u.ownerDocument||u,b={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},h.set(t,b),(h=u.querySelector(il(t)))?h._p||(b.instance=h,b.state.loading=5):(h=ur.get(t),h||(h={rel:"preload",as:"style",href:a.href,crossOrigin:a.crossOrigin,integrity:a.integrity,media:a.media,hrefLang:a.hrefLang,referrerPolicy:a.referrerPolicy},ur.set(t,h)),Lk(u,t,h,b.state))),n&&o===null)throw Error(s(528,""));return b}if(n&&o!==null)throw Error(s(529,""));return null;case"script":return n=a.async,a=a.src,typeof a=="string"&&n&&typeof n!="function"&&typeof n!="symbol"?(a=Ps(a),n=Dr(u).hoistableScripts,o=n.get(a),o||(o={type:"script",instance:null,count:0,state:null},n.set(a,o)),o):{type:"void",instance:null,count:0,state:null};default:throw Error(s(444,t))}}function Hs(t){return'href="'+nr(t)+'"'}function il(t){return'link[rel="stylesheet"]['+t+"]"}function Cb(t){return R({},t,{"data-precedence":t.precedence,precedence:null})}function Lk(t,n,a,o){if(n=t.querySelector('link[rel="preload"][as="style"]['+n+"]")){if(n[Ge]!==!0){o.loading=1;return}}else n=t.createElement("link"),n[Ge]=!0,n.onload=n.onerror=Br.bind(null,n),pn(n,"link",a),Ze(n),t.head.appendChild(n);o.preload=n,n.addEventListener("load",function(){return o.loading|=1}),n.addEventListener("error",function(){return o.loading|=2})}function Ps(t){return'[src="'+nr(t)+'"]'}function sl(t){return"script[async]"+t}function jb(t,n,a){if(n.count++,n.instance===null)switch(n.type){case"style":var o=t.querySelector('style[data-href~="'+nr(a.href)+'"]');if(o)return n.instance=o,Ze(o),o;var u=R({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return o=(t.ownerDocument||t).createElement("style"),Ze(o),pn(o,"style",u),gu(o,a.precedence,t),n.instance=o;case"stylesheet":u=Hs(a.href);var h=t.querySelector(il(u));if(h)return n.state.loading|=4,n.instance=h,Ze(h),h;o=Cb(a),(u=ur.get(u))&&nm(o,u),h=(t.ownerDocument||t).createElement("link"),Ze(h);var b=h;return b._p=new Promise(function(S,C){b.onload=S,b.onerror=C}),pn(h,"link",o),n.state.loading|=4,gu(h,a.precedence,t),n.instance=h;case"script":return h=Ps(a.src),(u=t.querySelector(sl(h)))?(n.instance=u,Ze(u),u):(o=a,(u=ur.get(h))&&(o=R({},a),rm(o,u)),t=t.ownerDocument||t,u=t.createElement("script"),Ze(u),pn(u,"link",o),t.head.appendChild(u),n.instance=u);case"void":return null;default:throw Error(s(443,n.type))}else n.type==="stylesheet"&&(n.state.loading&4)===0&&(o=n.instance,n.state.loading|=4,gu(o,a.precedence,t));return n.instance}function gu(t,n,a){for(var o=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),u=o.length?o[o.length-1]:null,h=u,b=0;b title"):null)}function Uk(t,n,a){if(a===1||n.itemProp!=null)return!1;switch(t){case"meta":case"title":return!0;case"style":if(typeof n.precedence!="string"||typeof n.href!="string"||n.href==="")break;return!0;case"link":if(typeof n.rel!="string"||typeof n.href!="string"||n.href===""||n.onLoad||n.onError)break;return n.rel==="stylesheet"?(t=n.disabled,typeof n.precedence=="string"&&t==null):)DELIM" -R"DELIM(!0;case"script":if(n.async&&typeof n.async!="function"&&typeof n.async!="symbol"&&!n.onLoad&&!n.onError&&n.src&&typeof n.src=="string")return!0}return!1}function Ab(t,n){return t==="img"&&n.src!=null&&n.src!==""&&n.onLoad==null&&n.loading!=="lazy"}function Ob(t){return!(t.type==="stylesheet"&&(t.state.loading&3)===0)}function Mb(t){return(t.width||100)*(t.height||100)*(typeof devicePixelRatio=="number"?devicePixelRatio:1)*.25}function zb(t,n){typeof n.decode=="function"&&(t.imgCount++,n.complete||(t.imgBytes+=Mb(n),t.suspenseyImages.push(n)),t=$k.bind(t),n.decode().then(t,t))}function Hk(t,n,a,o){if(a.type==="stylesheet"&&(typeof o.media!="string"||matchMedia(o.media).matches!==!1)&&(a.state.loading&4)===0){if(a.instance===null){var u=Hs(o.href),h=n.querySelector(il(u));if(h){n=h._p,n!==null&&typeof n=="object"&&typeof n.then=="function"&&(t.count++,t=ol.bind(t),n.then(t,t)),a.state.loading|=4,a.instance=h,Ze(h);return}h=n.ownerDocument||n,o=Cb(o),(u=ur.get(u))&&nm(o,u),h=h.createElement("link"),Ze(h);var b=h;b._p=new Promise(function(S,C){b.onload=S,b.onerror=C}),pn(h,"link",o),a.instance=h}t.stylesheets===null&&(t.stylesheets=new Map),t.stylesheets.set(a,n),(n=a.state.preload)&&(a.state.loading&3)===0&&(t.count++,a=ol.bind(t),n.addEventListener("load",a),n.addEventListener("error",a))}}var vu=0;function Pk(t,n){return t.stylesheets&&t.count===0&&xu(t,t.stylesheets),0vu?50:800)+n);return t.unsuspend=a,function(){t.unsuspend=null,clearTimeout(o),clearTimeout(u)}}:null}function Db(t){if(t.count===0&&(t.imgCount===0||!t.waitingForImages)){if(t.stylesheets)xu(t,t.stylesheets);else if(t.unsuspend){var n=t.unsuspend;t.unsuspend=null,n()}}}function ol(){this.count--,Db(this)}function $k(){this.imgCount--,Db(this)}var bu=null;function xu(t,n){t.stylesheets=null,t.unsuspend!==null&&(t.count++,bu=new Map,n.forEach(qk,t),bu=null,ol.call(t))}function qk(t,n){if(!(n.state.loading&4)){var a=bu.get(t);if(a)var o=a.get(null);else{a=new Map,bu.set(t,a);for(var u=t.querySelectorAll("link[data-precedence],style[data-precedence]"),h=0;h"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(r){console.error(r)}}return e(),hm.exports=i_(),hm.exports}var o_=s_();const l_=Bp(o_),c_=[{id:"current",label:"Classic"},{id:"light",label:"Light"},{id:"midnight",label:"Midnight"}],Up="libbitcoinTheme",ad="libbitcoin-theme-change";function Hp(e){return e==="light"||e==="midnight"?e:"current"}function bw(){try{return Hp(localStorage.getItem(Up))}catch{return"current"}}function Pp(e){document.documentElement.dataset.theme=e;const r=getComputedStyle(document.documentElement).getPropertyValue("--theme-background").trim();r&&document.querySelector('meta[name="theme-color"]')?.setAttribute("content",r)}function u_(){Pp(bw()),globalThis.addEventListener("storage",h_)}function d_(e){const r=Hp(e);Pp(r);try{localStorage.setItem(Up,r)}catch{}globalThis.dispatchEvent(new Event(ad))}function f_(){return Hp(document.documentElement.dataset.theme)}function h_(e){e.key!==null&&e.key!==Up||(Pp(bw()),globalThis.dispatchEvent(new Event(ad)))}function m_(e){return globalThis.addEventListener(ad,e),()=>{globalThis.removeEventListener(ad,e)}}function p_(){return T.useSyncExternalStore(m_,f_,()=>"current")}const xw=T.createContext(void 0),ww=e=>{const r=T.useContext(xw);if(!r)throw new Error("No QueryClient set, use QueryClientProvider to set one");return r},g_=({client:e,children:r})=>(T.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),p.jsx(xw.Provider,{value:e,children:r})),y_={setTimeout:(e,r)=>setTimeout(e,r),clearTimeout:e=>clearTimeout(e),setInterval:(e,r)=>setInterval(e,r),clearInterval:e=>clearInterval(e)};var v_=class{#e=y_;#t=!1;setTimeoutProvider(e){this.#e=e}setTimeout(e,r){return this.#e.setTimeout(e,r)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,r){return this.#e.setInterval(e,r)}clearInterval(e){this.#e.clearInterval(e)}};const Fi=new v_;function b_(e){setTimeout(e,0)}const x_=typeof window>"u"||"Deno"in globalThis;function $n(){}function w_(e,r){return typeof e=="function"?e(r):e}function Sw(e){return typeof e=="number"&&e>=0&&e!==1/0}function Ew(e,r){return Math.max(e+(r||0)-Date.now(),0)}function Nt(e,r){return typeof e=="function"?e(r):e}function ix(e,r){const{type:i="all",exact:s,fetchStatus:l,predicate:c,queryKey:d,stale:f}=e;if(d){if(s){if(r.queryHash!==$p(d,r.options))return!1}else if(!ao(r.queryKey,d))return!1}if(i!=="all"){const m=r.isActive();if(i==="active"&&!m||i==="inactive"&&m)return!1}return!(typeof f=="boolean"&&r.isStale()!==f||l&&l!==r.state.fetchStatus||c&&!c(r))}function sx(e,r){const{exact:i,status:s,predic)DELIM" -R"DELIM(ate:l,mutationKey:c}=e;if(c){if(!r.options.mutationKey)return!1;if(i){if(Ll(r.options.mutationKey)!==Ll(c))return!1}else if(!ao(r.options.mutationKey,c))return!1}return!(s&&r.state.status!==s||l&&!l(r))}function $p(e,r){return(r?.queryKeyHashFn||Ll)(e)}function Ll(e){return JSON.stringify(e,(r,i)=>tp(i)?Object.keys(i).sort().reduce((s,l)=>(s[l]=i[l],s),{}):i)}function ao(e,r){if(e===r)return!0;if(typeof e!=typeof r)return!1;if(e&&r&&typeof e=="object"&&typeof r=="object"){if(Array.isArray(e)&&Array.isArray(r)){if(r.length>e.length)return!1;for(let s=0;s500)return r;const s=ox(e)&&ox(r);if(!s&&!(tp(e)&&tp(r)))return r;const l=(s?e:Object.keys(e)).length,c=s?r:Object.keys(r),d=c.length,f=s?new Array(d):{};let m=0;for(let g=0;g{Fi.setTimeout(r,e)})}function np(e,r,i){return typeof i.structuralSharing=="function"?i.structuralSharing(e,r):i.structuralSharing!==!1?kw(e,r):r}function E_(e,r,i=0){const s=[...e,r];return i&&s.length>i?s.slice(-i):s}function T_(e,r,i=0){const s=[r,...e];return i&&s.length>i?s.slice(0,i):s}const qp=Symbol();function _w(e,r){return!e.queryFn&&r?.initialPromise?()=>r.initialPromise:!e.queryFn||e.queryFn===qp?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Nw(e,r){return typeof e=="function"?e(...r):!!e}const Zp=Symbol();function k_(e,r,i,s){let l=!1,c;return Object.defineProperties(e,{[Zp]:{value:s},signal:{enumerable:!0,get:()=>(c??=r(),l||(l=!0,c.aborted?i():c.addEventListener("abort",i,{once:!0})),c)}}),e}let __=()=>x_;const Ip=()=>__();var Fl=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},N_=class extends Fl{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<"u"&&window.addEventListener){const r=()=>e();return window.addEventListener("visibilitychange",r,!1),()=>{window.removeEventListener("visibilitychange",r)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(r=>{r(e)})}isFocused(){return typeof this.#e=="boolean"?this.#e:globalThis.document?.visibilityState!=="hidden"}};const Fp=new N_,C_=b_;function j_(){let e=[],r=0,i=f=>{f()},s=f=>{f()},l=C_;const c=f=>{r?e.push(f):l(()=>{i(f)})},d=()=>{const f=e;e=[],f.length&&l(()=>{s(()=>{f.forEach(m=>{i(m)})})})};return{batch:f=>{let m;r++;try{m=f()}finally{r--,r||d()}return m},batchCalls:f=>(...m)=>{c(()=>{f(...m)})},schedule:c,setNotifyFunction:f=>{i=f},setBatchNotifyFunction:f=>{s=f},setScheduler:f=>{l=f}}}const bn=j_();var R_=class extends Fl{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<"u"&&window.addEventListener){const r=()=>e(!0),i=()=>e(!1);return window.addEventListener("online",r,!1),window.addEventListener("offline",i,!1),()=>{window.removeEventListener("online",r),window.removeEventListener("offline",i)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(r=>{r(e)}))}isOnline(){return this.#e}};const id=new R_;function A_(e){return Math.min(1e3*2**e,3e4)}function Cw(e){return(e??"online")==="online"?id.isOnline():!0}var rp=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent}};function jw(e){let r=!1,i=0,s,l="pending",c,d;const f=new Promise((O,se)=>{c=O,d=se});f.catch($n);const m=()=>l!=="pending",g=O=>{if(!m()){const se=new rp(O);_(se),e.onCancel?.(se)}},v=()=>{r=!0},y=()=>{r=!1},x=()=>Fp.isFocused()&&(e.networkMode==="always"||id.isOnline())&&e.canRun(),w=()=>Cw(e.networkMode)&&e.canRun(),E=O=>{m()||(s?.(),l="resolved",c(O))},_=O=>{m()||(s?.(),l="rejected",d(O))},N=O=>new Promise(se=>{s=ce=>{(m()||O())&&se(ce)},e.onPause?.()}).then(()=>{s=void 0,m()||e.onContinue?.()}),H=()=>{if(m())return;let O;const se=i===0?e.initialPromise:void 0;try{O=se??e.fn()}catch(ce){O=Promise.reject(ce)}Promise.resolve(O).then(E).catch(ce=>{if(m())return;const K=e.retry??(Ip()?0:3),oe=e.retryDelay??A_,R=typeof oe=="function"?oe(i,ce):oe,k=K===!0||typeof K=="number"&&im()||x()?void 0:N(x)).then(()=>{r?_(ce):H()})})};return{promise:f,status:()=>l,cancel:g,continue:()=>(s?.(),f),cancelRetry:v,continueRetry:y,canStart:w,start:()=>(w()?H():N(w).then(H),f)}}var Rw=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Sw(this.gcTime)&&(this.#e=Fi.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Ip()?1/0:3e5))}clearGcTimeout(){this.#e!==void 0&&(Fi.clearTimeout(this.#e),this.#e=void 0)}};function O_(e){return{onFetch:(r,i)=>{const s=r.options,l=r.fetchOptions?.meta?.fetchMore?.direction,c=r.state.data?.pages||[],d=r.state.data?.pageParams||[];let f={pages:[],pageParams:[]},m=0;const g=async()=>{let v=!1;const y=r,x=_=>{k_(_,()=>r.signal,()=>v=!0,y[Zp])},w=_w(r.options,r.fetchOptions),E=async(_,N,H)=>{if(v)return Promise.reject(r.signal.reason);if(N==null&&_.pages.length)return Promise.resolve(_);const se=(()=>{const R={client:r.client,queryKey:r.queryKey,pageParam:N,direction:H?"backward":"forward",meta:r.options.meta};return x(R),R})(),ce=await w(se),{maxPages:K}=r.options,oe=H?T_:E_;return{pages:oe(_.pages,ce,K),pageParams:oe(_.pageParams,N,K)}};if(l&&c.length){const _=l==="backward",N=_?M_:cx,H={pages:c,pageParams:d};f=await E(H,N(s,H),_)}else{const _=e??c.length;do{const N=m===0?d[0]===void 0?s.initialPageParam:d[0]:cx(s,f);if(m>0&&N==null)break;f=await E(f,N),m++}while(m<_)}return f};r.options.persister?r.fetchFn=()=>r.options.persister?.(g,{client:r.client,queryKey:r.queryKey,meta:r.options.meta,signal:r.signal},i):r.fetchFn=g}}}function cx(e,{pages:r,pageParams:i}){const s=r.length-1;return r.length>0?e.getNextPageParam(r[s],r,i[s],i):void 0}function M_(e,{pages:r,pageParams:i}){return r.length>0?e.getPreviousPageParam?.(r[0],r,i[0],i):void 0}var z_=class extends Rw{#e;#t;#n;#r;#i;#a;#s;#l;#c;constructor(e){super(),this.#c=!1,this.#l=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#r=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=dx(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#a?.promise}setOptions(e){if(this.options={...this.#l,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTim)DELIM" -R"DELIM(e),this.state&&this.state.data===void 0){const r=dx(this.options);r.data!==void 0&&(this.setState(ux(r.data,r.dataUpdatedAt)),this.#t=r)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&this.#r.remove(this)}setData(e,r){const i=np(this.state.data,e,this.options);return this.#o({data:i,type:"success",dataUpdatedAt:r?.updatedAt,manual:r?.manual}),i}setState(e){this.#o({type:"setState",state:e})}cancel(e){const r=this.#a?.promise;return this.#a?.cancel(e),r?r.then($n).catch($n):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>Nt(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===qp||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.state.data===void 0?!1:this.getObserversCount()>0?this.observers.some(e=>Nt(e.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e==="static"?!1:this.state.isInvalidated?!0:!Ew(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#a?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#a?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){const r=this.observers.indexOf(e);r!==-1&&(this.observers.splice(r,1),this.observers.length||(this.#a&&(this.#c||this.state.fetchStatus==="paused"&&this.state.status==="pending"?this.#a.cancel({revert:!0}):this.#a.cancelRetry()),this.scheduleGc()),this.#r.notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#o({type:"invalidate"})}async fetch(e,r){if(this.state.fetchStatus!=="idle"&&this.#a?.status()!=="rejected"){if(this.state.data!==void 0&&r?.cancelRefetch)this.cancel({silent:!0});else if(this.#a&&this.#s)return this.#a.continueRetry(),this.#s}if(e&&this.setOptions(e),!this.options.queryFn){const g=this.observers.find(v=>v.options.queryFn);g&&this.setOptions(g.options)}const i=new AbortController,s=g=>{Object.defineProperties(g,{[Zp]:{value:i.signal,enumerable:!0},signal:{enumerable:!0,get:()=>(this.#c=!0,i.signal)}})},l=()=>{const g=_w(this.options,r),y=(()=>{const x={client:this.#i,queryKey:this.queryKey,meta:this.meta};return s(x),x})();return this.#c=!1,this.options.persister?this.options.persister(g,y,this):g(y)},d=(()=>{const g={fetchOptions:r,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:l};return s(g),g})();(this.#e==="infinite"?O_(this.options.pages):this.options.behavior)?.onFetch(d,this),this.#n=this.state,(this.state.fetchStatus==="idle"||this.state.fetchMeta!==d.fetchOptions?.meta)&&this.#o({type:"fetch",meta:d.fetchOptions?.meta});const f=this.#a=jw({initialPromise:r?.initialPromise,fn:d.fetchFn,onCancel:g=>{g instanceof rp&&g.revert&&this.setState({...this.#n,fetchStatus:"idle"}),i.abort()},onFail:(g,v)=>{this.#o({type:"failed",failureCount:g,error:v})},onPause:()=>{this.#o({type:"pause"})},onContinue:()=>{this.#o({type:"continue"})},retry:d.options.retry,retryDelay:d.options.retryDelay,networkMode:d.options.networkMode,canRun:()=>!0}),m=(async()=>{try{const g=await f.promise;if(g===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(g),this.#r.config.onSuccess?.(g,this),this.#r.config.onSettled?.(g,this.state.error,this),g}catch(g){if(g instanceof rp){if(g.silent){if(this.#a!==f&&this.#s)return this.#s;throw g}else if(g.revert){if(this.state.data===void 0)throw g;return this.state.data}}throw this.#o({type:"error",error:g}),this.#r.config.onError?.(g,this),this.#r.config.onSettled?.(this.state.data,g,this),g}finally{this.#a===f&&(this.#a=void 0,this.#s=void 0),this.scheduleGc()}})();return this.#s=m,f.start(),m}#o(e){const r=i=>{switch(e.type){case"failed":return{...i,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...i,fetchStatus:"paused"};case"continue":return{...i,fetchStatus:"fetching"};case"fetch":return{...i,...Aw(i.data,this.options),fetchMeta:e.meta??null};case"success":const s={...i,...ux(e.data,e.dataUpdatedAt),dataUpdateCount:i.dataUpdateCount+1,...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return this.#n=e.manual?s:void 0,s;case"error":const l=e.error;return{...i,error:l,errorUpdateCount:i.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:i.fetchFailureCount+1,fetchFailureReason:l,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...i,isInvalidated:!0};case"setState":return{...i,...e.state}}};this.state=r(this.state),bn.batch(()=>{this.observers.slice().forEach(i=>{i.onQueryUpdate()}),this.#r.notify({query:this,type:"updated",action:e})})}};function Aw(e,r){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Cw(r.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function ux(e,r){return{data:e,dataUpdatedAt:r??Date.now(),error:null,isInvalidated:!1,status:"success"}}function dx(e){const r=typeof e.initialData=="function"?e.initialData():e.initialData,i=r!==void 0,s=i?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:r,dataUpdateCount:0,dataUpdatedAt:i?s??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:i?"success":"pending",fetchStatus:"idle"}}var D_=class extends Fl{#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#s;#l;#c;#o;#d;#f;#u;#m=new Set;constructor(e,r){super(),this.options=r,this.#e=e,this.#s=null,this.bindMethods(),this.setOptions(r)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),fx(this.#t,this.options)?this.#h():this.updateResult(),this.#b())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return ap(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return ap(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#x(),this.#w(),this.#t.removeObserver(this)}setOptions(e){const r=this.options,i=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Nt(this.options.enabled,this.#t)!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#S(),this.#t.setOptions(this.options),r._defaulted&&!ym(this.options,r)&&this.#e.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#t,observer:this});const s=this.hasListeners();s&&hx(this.#t,i,this.options,r)&&this.#h(),this.updateResult(),s&&(this.#t!==i||Nt(this.options.enabled,this.#t)!==Nt(r.enabled,this.#t)||Nt(this.options.staleTime,this.#t)!==Nt(r.staleTime,this.#t))&&this.#g();const l=this.#y();s&&(this.#t!==i||Nt(this.options.enabled,this.#t)!==Nt(r.enabled,this.#t)||l!==this.#u)&&this.#v(l)}getOptimisticResult(e){const r=this.#e.getQueryCache().build(this.#e,e),i=this.createResult(r,e);return ym(this.getCurrentResult(),i)||(this.#r=i,this.#a=this.options,this.#i=this.#t.state),i}getCurrentResult(){return this.#r}trackResult(e,r){return new Proxy(e,{get:(i,s)=>(this.trackProp(s),r?.(s),Reflect.get(i,s))})}trackProp(e){this.#m.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const r=this.#e.defaultQueryOptions(e),i=this.#e.getQueryCa)DELIM" -R"DELIM(che().build(this.#e,r);let s=()=>{},l;const c=new Promise(d=>{l=d,s=this.#e.getQueryCache().subscribe(f=>{f.type==="updated"&&f.query.queryHash===i.queryHash&&i.state.data!==void 0&&(s(),d(this.createResult(i,r)))})});return Promise.race([i.fetch(r).then(()=>{const d=this.createResult(i,r);return l?.(d),d}).finally(()=>{s()}),c])}fetch(e){return this.#h({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#h(e){this.#S();let r=this.#t.fetch(this.options,e);return e?.throwOnError||(r=r.catch($n)),r}#p(e){return!Ip()&&Nt(this.options.enabled,this.#t)!==!1&&Sw(e)}#g(){this.#x();const e=Nt(this.options.staleTime,this.#t);if(this.#r.isStale||!this.#p(e))return;const r=Ew(this.#r.dataUpdatedAt,e)+1;this.#d=Fi.setTimeout(()=>{this.#r.isStale||this.updateResult()},r)}#y(){return Nt(this.options.refetchInterval,this.#t)??!1}#v(e){this.#w(),this.#u=e,!(this.#u===0||!this.#p(this.#u))&&(this.#f=Fi.setInterval(()=>{(this.options.refetchIntervalInBackground||Fp.isFocused())&&this.#h()},this.#u))}#b(){this.#g(),this.#v(this.#y())}#x(){this.#d!==void 0&&(Fi.clearTimeout(this.#d),this.#d=void 0)}#w(){this.#f!==void 0&&(Fi.clearInterval(this.#f),this.#f=void 0)}createResult(e,r){const i=this.#t,s=this.options,l=this.#r,c=this.#i,d=this.#a,f=e!==i?e.state:this.#n,{state:m}=e;let g={...m},v=!1,y;if(r._optimisticResults){const K=this.hasListeners(),oe=!K&&fx(e,r),R=K&&hx(e,i,r,s);(oe||R)&&(g={...g,...Aw(m.data,e.options)}),r._optimisticResults==="isRestoring"&&(g.fetchStatus="idle")}let{error:x,errorUpdatedAt:w,status:E}=g;y=g.data;let _=!1;if(r.placeholderData!==void 0&&y===void 0&&E==="pending"){let K;l?.isPlaceholderData&&r.placeholderData===d?.placeholderData?(K=l.data,_=!0):K=typeof r.placeholderData=="function"?r.placeholderData(this.#o?.state.data,this.#o):r.placeholderData,K!==void 0&&(E="success",y=np(l?.data,K,r),v=!0)}if(r.select&&y!==void 0&&!_)if(l&&y===c?.data&&r.select===this.#l)y=this.#c;else try{this.#l=r.select,y=r.select(y),y=np(l?.data,y,r),this.#c=y,this.#s=null}catch(K){this.#s=K}else y===void 0&&(this.#s=null);this.#s&&(x=this.#s,y=this.#c,w=l?.error===x?l.errorUpdatedAt:Date.now(),E="error",v=!1);const N=g.fetchStatus==="fetching",H=E==="pending",O=E==="error",se=H&&N,ce=y!==void 0;return{status:E,fetchStatus:g.fetchStatus,isPending:H,isSuccess:E==="success",isError:O,isInitialLoading:se,isLoading:se,data:y,dataUpdatedAt:g.dataUpdatedAt,error:x,errorUpdatedAt:w,failureCount:g.fetchFailureCount,failureReason:g.fetchFailureReason,errorUpdateCount:g.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:g.dataUpdateCount>f.dataUpdateCount||g.errorUpdateCount>f.errorUpdateCount,isFetching:N,isRefetching:N&&!H,isLoadingError:O&&!ce,isPaused:g.fetchStatus==="paused",isPlaceholderData:v,isRefetchError:O&&ce,isStale:Vp(e,r),refetch:this.refetch,isEnabled:Nt(r.enabled,e)!==!1}}updateResult(){const e=this.#r,r=this.createResult(this.#t,this.options);if(this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#o=this.#t),ym(r,e))return;this.#r=r;const s=(()=>{if(!e)return!0;const{notifyOnChangeProps:l}=this.options,c=typeof l=="function"?l():l;if(c==="all"||!c&&!this.#m.size||this.options.throwOnError&&this.#r.error!==e.error)return!0;for(const d of c??this.#m)if(this.#r[d]!==e[d])return!0;return!1})();bn.batch(()=>{s&&this.listeners.forEach(l=>{l(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:"observerResultsUpdated"})})}#S(){const e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;const r=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(r?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#b()}};function B_(e,r){return Nt(r.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&Nt(r.retryOnMount,e)===!1)}function fx(e,r){return B_(e,r)||e.state.data!==void 0&&ap(e,r,r.refetchOnMount)}function ap(e,r,i){if(Nt(r.enabled,e)!==!1&&Nt(r.staleTime,e)!=="static"){const s=Nt(i,e);return s==="always"||s!==!1&&Vp(e,r)}return!1}function hx(e,r,i,s){return(e!==r||Nt(s.enabled,e)===!1)&&(!i.suspense||e.state.status!=="error")&&Vp(e,i)}function Vp(e,r){return Nt(r.enabled,e)!==!1&&e.isStaleByTime(Nt(r.staleTime,e))}var L_=class extends Rw{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||U_(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(r=>r!==e),this.scheduleGc(),this.#n.notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status==="pending"?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??(this.state.status==="pending"?this.execute(this.state.variables):Promise.resolve())}async execute(e){const r=()=>{this.#i({type:"continue"})},i={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey},s=this.#r=jw({fn:()=>this.options.mutationFn?this.options.mutationFn(e,i):Promise.reject(new Error("No mutationFn found")),onFail:(d,f)=>{this.#i({type:"failed",failureCount:d,error:f})},onPause:()=>{this.#i({type:"pause"})},onContinue:r,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)}),l=this.state.status==="pending",c=!s.canStart();try{if(l)r();else{this.#i({type:"pending",variables:e,isPaused:c}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,i);const f=await this.options.onMutate?.(e,i);f!==this.state.context&&this.#i({type:"pending",context:f,variables:e,isPaused:c})}this.state.isPaused&&s.canStart()&&r();const d=await s.start();return await this.#n.config.onSuccess?.(d,e,this.state.context,this,i),await this.options.onSuccess?.(d,e,this.state.context,i),await this.#n.config.onSettled?.(d,null,this.state.variables,this.state.context,this,i),await this.options.onSettled?.(d,null,e,this.state.context,i),this.#i({type:"success",data:d}),d}catch(d){try{await this.#n.config.onError?.(d,e,this.state.context,this,i)}catch(f){Promise.reject(f)}try{await this.options.onError?.(d,e,this.state.context,i)}catch(f){Promise.reject(f)}try{await this.#n.config.onSettled?.(void 0,d,this.state.variables,this.state.context,this,i)}catch(f){Promise.reject(f)}try{await this.options.onSettled?.(void 0,d,e,this.state.context,i)}catch(f){Promise.reject(f)}throw this.#i({type:"error",error:d}),d}finally{this.#r===s&&(this.#r=void 0),this.#n.runNext(this)}}#i(e){const r=i=>{switch(e.type){case"failed":return{...i,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...i,isPaused:!0};case"continue":return{...i,isPaused:!1};case"pending":return{...i,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...i,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...i,data:void 0,error:e.error,failureCount:i.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}};this.state=r(this.state),bn.batch(()=>{this.#t.forEach(i=>{i.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:"updated",action:e})})}};function U_(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var H_=class extends Fl{#e;#t;#n;constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}build(e,r,i){const s=new L_({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(r),state:i});return this.add(s),s}add(e){this.#e.add(e);const r=Nu(e);if(typeof r=="string"){const i=this.#t.get(r);)DELIM" -R"DELIM(i?i.push(e):this.#t.set(r,[e])}this.notify({type:"added",mutation:e})}remove(e){if(this.#e.delete(e)){const r=Nu(e);if(typeof r=="string"){const i=this.#t.get(r);if(i)if(i.length>1){const s=i.indexOf(e);s!==-1&&i.splice(s,1)}else i[0]===e&&this.#t.delete(r)}}this.notify({type:"removed",mutation:e})}canRun(e){const r=Nu(e);if(typeof r=="string"){const i=this.#t.get(r)?.find(s=>s.state.status==="pending");return!i||i===e}else return!0}runNext(e){const r=Nu(e);return typeof r=="string"?this.#t.get(r)?.find(i=>i!==e&&i.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){bn.batch(()=>{const e=this.getAll();this.#e.clear(),this.#t.clear(),e.forEach(r=>{this.notify({type:"removed",mutation:r})})})}getAll(){return Array.from(this.#e)}find(e){const r={exact:!0,...e};return this.getAll().find(i=>sx(r,i))}findAll(e={}){return this.getAll().filter(r=>sx(e,r))}notify(e){bn.batch(()=>{this.listeners.forEach(r=>{r(e)})})}resumePausedMutations(){const e=this.getAll().filter(r=>r.state.isPaused);return bn.batch(()=>Promise.all(e.map(r=>r.continue().catch($n))))}};function Nu(e){return e.options.scope?.id}var P_=class extends Fl{#e;constructor(e={}){super(),this.config=e,this.#e=new Map}build(e,r,i){const s=r.queryKey,l=r.queryHash??$p(s,r);let c=this.get(l);return c||(c=new z_({client:e,queryKey:s,queryHash:l,options:e.defaultQueryOptions(r),state:i,defaultOptions:e.getQueryDefaults(s)}),this.add(c)),c}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){this.#e.get(e.queryHash)===e&&(e.destroy(),this.#e.delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){bn.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){const r={exact:!0,...e};return this.getAll().find(i=>ix(r,i))}findAll(e={}){const r=this.getAll();return Object.keys(e).length>0?r.filter(i=>ix(e,i)):r}notify(e){bn.batch(()=>{this.listeners.forEach(r=>{r(e)})})}onFocus(){bn.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){bn.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},$_=class{#e;#t;#n;#r;#i;#a;#s;#l;constructor(e={}){this.#e=e.queryCache||new P_,this.#t=e.mutationCache||new H_,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#s=Fp.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#l=id.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#s?.(),this.#s=void 0,this.#l?.(),this.#l=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return this.#t.findAll({...e,status:"pending"}).length}getQueryData(e){const r=this.defaultQueryOptions({queryKey:e});return this.#e.get(r.queryHash)?.state.data}ensureQueryData(e){const r=this.defaultQueryOptions(e),i=this.#e.build(this,r),s=i.state.data;return s===void 0?this.fetchQuery(e):(e.revalidateIfStale&&i.isStaleByTime(Nt(r.staleTime,i))&&this.prefetchQuery(r),Promise.resolve(s))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:r,state:i})=>[r,i.data])}setQueryData(e,r,i){const s=this.defaultQueryOptions({queryKey:e}),l=this.#e.get(s.queryHash)?.state.data,c=w_(r,l);if(c!==void 0)return this.#e.build(this,s).setData(c,{...i,manual:!0})}setQueriesData(e,r,i){return bn.batch(()=>this.#e.findAll(e).map(({queryKey:s})=>[s,this.setQueryData(s,r,i)]))}getQueryState(e){const r=this.defaultQueryOptions({queryKey:e});return this.#e.get(r.queryHash)?.state}removeQueries(e){const r=this.#e;bn.batch(()=>{r.findAll(e).forEach(i=>{r.remove(i)})})}resetQueries(e,r){const i=this.#e;return bn.batch(()=>{const s=i.findAll(e),l=new Set(s);return s.forEach(c=>{c.reset()}),this.refetchQueries({type:"active",predicate:c=>l.has(c)},r)})}cancelQueries(e,r={}){const i={revert:!0,...r},s=bn.batch(()=>this.#e.findAll(e).map(l=>l.cancel(i)));return Promise.all(s).then($n).catch($n)}invalidateQueries(e,r={}){return bn.batch(()=>(this.#e.findAll(e).forEach(i=>{i.invalidate()}),e?.refetchType==="none"?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??"active"},r)))}refetchQueries(e,r={}){const i={...r,cancelRefetch:r.cancelRefetch??!0},s=bn.batch(()=>this.#e.findAll(e).filter(l=>!l.isDisabled()&&!l.isStatic()).map(l=>{let c=l.fetch(void 0,i);const d=l.state.fetchStatus==="paused";return(!i.throwOnError||d)&&(c=c.catch($n)),d?Promise.resolve():c}));return Promise.all(s).then($n)}async query(e){const r=this.defaultQueryOptions(e);r.retry===void 0&&(r.retry=!1);const i=this.#e.build(this,r),s=i.isStaleByTime(Nt(r.staleTime,i))?await i.fetch(r):i.state.data,l=r.select;return l?l(s):s}fetchQuery(e){const r=this.defaultQueryOptions(e);r.retry===void 0&&(r.retry=!1);const i=this.#e.build(this,r);return i.isStaleByTime(Nt(r.staleTime,i))?i.fetch(r):Promise.resolve(i.state.data)}prefetchQuery(e){return this.fetchQuery(e).then($n).catch($n)}infiniteQuery(e){return e._type="infinite",this.query(e)}fetchInfiniteQuery(e){return e._type="infinite",this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then($n).catch($n)}ensureInfiniteQueryData(e){return e._type="infinite",this.ensureQueryData(e)}resumePausedMutations(){return id.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,r){this.#r.set(Ll(e),{queryKey:e,defaultOptions:r})}getQueryDefaults(e){const r=[...this.#r.values()],i={};return r.forEach(s=>{ao(e,s.queryKey)&&Object.assign(i,s.defaultOptions)}),i}setMutationDefaults(e,r){this.#i.set(Ll(e),{mutationKey:e,defaultOptions:r})}getMutationDefaults(e){const r=[...this.#i.values()],i={};return r.forEach(s=>{ao(e,s.mutationKey)&&Object.assign(i,s.defaultOptions)}),i}defaultQueryOptions(e){if(e._defaulted)return e;const r={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return r.queryHash||(r.queryHash=$p(r.queryKey,r)),r.refetchOnReconnect===void 0&&(r.refetchOnReconnect=r.networkMode!=="always"),r.throwOnError===void 0&&(r.throwOnError=!!r.suspense),!r.networkMode&&r.persister&&(r.networkMode="offlineFirst"),r.queryFn===qp&&(r.enabled=!1),r}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}};const Ow=T.createContext(!1),q_=()=>T.useContext(Ow);Ow.Provider;function Z_(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}const I_=T.createContext(Z_()),F_=()=>T.useContext(I_),V_=(e,r,i)=>{const s=i?.state.status==="error"&&typeof e.throwOnError=="function"?Nw(e.throwOnError,[i.state.error,i]):e.throwOnError;(e.suspense||s)&&(r.isReset()||(e.retryOnMount=!1))},Y_=e=>{T.useEffect(()=>{e.clearReset()},[e])},G_=({result:e,errorResetBoundary:r,throwOnError:i,query:s,suspense:l})=>e.isError&&!r.isReset()&&!e.isFetching&&s&&(l&&e.data===void 0||Nw(i,[e.error,s])),K_=e=>{if(e.suspense){const i=l=>l==="static"?l:Math.max(l??1e3,1e3),s=e.staleTime;e.staleTime=typeof s=="function"?(...l)=>i(s(...l)):i(s),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},Q_=(e,r)=>e?.suspense&&r.isPending,X_=(e,r,i)=>r.fetchOptimistic(e).catch(()=>{i.clearReset()});function J_(e,r,i){const s=q_(),l=F_(),c=ww(),d=c.defaultQueryOptions(e),f=c.getQueryCache().get(d.queryHash),m=e.subscribed!==!1;d._optimisticResults=s?"isRestoring":m?"optimistic":void 0,K_(d),V_(d,l,f),Y_(l);const[g]=T.useState(()=>new r(c,d)),v=g.getOptimisticResult(d);T.useEffect(()=>{g.setOptions(d)},[d,g]);const y=!s&&m;if(T.useSyncExternalStore(T.useCallback(x=>{const w=y?g.subscribe(bn.batchCalls(x)):$n;return g.updateResult(),w},[g,y]),()=>g.getCurrentResult(),()=>g.getCurrentResult()),Q_(d,v))throw X_(d,g,l);if(G_({result:v,errorResetBoundary:l,throwOnError:d.throwOnE)DELIM" -R"DELIM(rror,query:f,suspense:d.suspense}))throw v.error;return d.notifyOnChangeProps?v:g.trackResult(v)}function W_(e,r){return J_(e,D_)}function ip(e){const r=Object.values(e).filter(s=>typeof s=="number");return Object.entries(e).filter(([s,l])=>r.indexOf(+s)===-1).map(([s,l])=>l)}function mx(e,r="|"){return e.map(i=>Lw(i)).join(r)}function sp(e,r){return typeof r=="bigint"?r.toString():r}class e4{constructor(r){this._getter=r,this._value=void 0}get value(){const r=this._getter;return r!==void 0&&(this._value=r(),this._getter=void 0),this._value}}function Sd(e){return new e4(e)}function t4(e){return e==null}function Yp(e){const r=e.startsWith("^")?1:0,i=e.endsWith("$")?e.length-1:e.length;return e.slice(r,i)}function n4(e,r){const i=e/r,s=Math.round(i),l=4*Number.EPSILON*Math.max(Math.abs(i),1);return Math.abs(i-s){const f=r._zod.def.shape[c];return s?s(f,c):f}):zw(e,c,s?s(d.value,c):d.value))}}function r4(e,r){for(const i of Reflect.ownKeys(r)){const s=Object.getOwnPropertyDescriptor(r,i);s.enumerable&&(s.get?Mw(e,i,()=>r[i]):zw(e,i,s.value))}}function Wn(...e){const r={};for(const i of e){const s=Object.getOwnPropertyDescriptors(i);Object.assign(r,s)}return Object.defineProperties({},r)}function a4(e){return JSON.stringify(e)}function i4(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const Dw="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Ul(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const s4=Sd(()=>{if(Rr.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function io(e){if(Ul(e)===!1)return!1;const r=e.constructor;if(r===void 0||typeof r!="function")return!0;const i=r.prototype;return!(Ul(i)===!1||Object.prototype.hasOwnProperty.call(i,"isPrototypeOf")===!1)}function Bw(e){return io(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}const o4=new Set(["string","number","symbol"]);function so(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function yi(e,r,i){const s=new e._zod.constr(r??e._zod.def);return(!r||i?.parent)&&(s._zod.parent=e),s}function Re(e){const r=e;if(!r)return{};if(typeof r=="string")return{error:()=>r};if(r?.message!==void 0){if(r?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");r.error=r.message}return delete r.message,typeof r.error=="string"?{...r,error:()=>r.error}:r}function Lw(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function l4(e){return Object.keys(e).filter(r=>e[r]._zod.optin!==void 0&&e[r]._zod.optout==="optional")}const Uw={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]},c4={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function u4(e,r){const i=e._zod.def,s=i.checks;if(s&&s.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const c={};return Ki(c,e,Ed(e,r)),yi(e,Wn(i,{shape:c,checks:[]}))}function Ed(e,r){const i=xa(e),s=[];for(const l of Reflect.ownKeys(r)){if(!Object.getOwnPropertyDescriptor(i,l)?.enumerable)throw new Error(`Unrecognized key: "${String(l)}"`);r[l]&&s.push(l)}return s}function d4(e,r){const i=e._zod.def,s=i.checks;if(s&&s.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const c=new Set(Ed(e,r)),d={};return Ki(d,e,Reflect.ownKeys(xa(e)).filter(f=>!c.has(f))),yi(e,Wn(i,{shape:d,checks:[]}))}function f4(e,r){if(!io(r))throw new Error("Invalid input to extend: expected a plain object");const i=e._zod.def.checks;if(i&&i.length>0){const l=xa(e);for(const c of Reflect.ownKeys(r))if(Object.getOwnPropertyDescriptor(l,c)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return yi(e,Wn(e._zod.def,{shape:Hw(e,r)}))}function Hw(e,r){const i={};return Ki(i,e,Reflect.ownKeys(xa(e))),r4(i,r),i}function h4(e,r){if(!io(r))throw new Error("Invalid input to safeExtend: expected a plain object");return yi(e,Wn(e._zod.def,{shape:Hw(e,r)}))}function m4(e,r){if(!r?._zod?.def)throw new Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");const i={};Ki(i,e,Reflect.ownKeys(xa(e))),Ki(i,r,Reflect.ownKeys(xa(r)));const s=Wn(e._zod.def,{shape:i,get catchall(){return r._zod.def.catchall},checks:r._zod.def.checks??[]});return yi(e,s)}function px(e,r,i,s="partial"){const c=r._zod.def.checks;if(c&&c.length>0)throw new Error(`.${s}() cannot be used on object schemas containing refinements`);const f=i?new Set(Ed(r,i)):void 0,m={};return Ki(m,r,Reflect.ownKeys(xa(r)),e&&((g,v)=>f&&!f.has(v)?g:new e({type:"optional",innerType:g}))),yi(r,Wn(r._zod.def,{shape:m,checks:[]}))}function p4(e,r,i){const s=i?new Set(Ed(r,i)):void 0,l={};return Ki(l,r,Reflect.ownKeys(xa(r)),(c,d)=>s&&!s.has(d)?c:new e({type:"nonoptional",innerType:c})),yi(r,Wn(r._zod.def,{shape:l}))}function va(e,r=0){if(e.aborted===!0)return!0;for(let i=r;i{var s;return(s=i).path??(s.path=[]),i.path.unshift(e),i})}function hl(e){return typeof e=="string"?e:e?.message}function gx(e){const r=[];for(const i of e??[]){const s=i._zod.def;if(!/_(length|size)$|_equals$/.test(s.check))break;const l=s.maximum??s.length??s.size;l>=0&&r.push([l,i])}return r}function op(e,r,i){var s;for(let l=r;le;return r[T4]=!0,r}var yx;const bm={value:void 0,enumerable:!1};let vx="captureStackTrace"in Error?Error:null;function _4(e){const r=vx;if(r){const i=r.stackTraceLimit;if(typeof i=="number"){try{r.stackTraceLimit=0}catch{return vx=null,new e}try{return new e}finally{r.stackTraceLimit=i}}}return new e}function ae(e,r,i,s){const l={};function c(x){this.def=x,this.constr=y,this.traits=new Set}c.prototype=l;const d=i,f=d&&new WeakSet;function m(x,w){if(x._zod){if(x._zod.traits.has(e))return}else{bm.value=new c(w);try{Object.defineProperty(x,"_zod",bm)}finally{bm.value=void 0}}if(x._zod.traits.add(e),r(x,w),f){const _=Object.getPrototypeOf(x),N=x._zod.constr.prototype;let H=_;for(;H&&H!==N;)H=Object.getPrototypeOf(H);const O=H??_;f.has(O)||(f.add(O),b4(O,d))}const E=y.prototype;for(const _ in E)Object.prototype.hasOwnProperty.call(E,_)&&(_ in x||(x[_]=E[_].bind(x)))}const g=s?.Parent??Object;class v extends g{}Object.defineProperty(v,"name",{value:e});function y(x){const w=s?.Parent?_4(v):this;m(w,x);const E=w._zod.deferred;if(E){for(const N of E)N();w._zod.deferred=void 0}const _=globalThis.__zod_globalConfig?.postProcessor;return _&&_(w),w}return Object.defineProperty(y,"init",{value:m}),Object.defineProperty(y,Symbol.hasInstance,{value:x=>s?.Parent&&x instanceof s.Parent?!0:x?._zod?.traits?.has(e)}),Object.defineProperty(y,"name",{value:e}),y}class Gi extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class qw extends Error{constructor(r){super(`Encountered unidirectional transform during encode: ${r}`),this.name="ZodEncodeError"}}(yx=globalThis).__zod_globalConfig??(yx.__zod_globalConfig={});const Rr=globalThis.__zod_globalConfig;function Wr(e){return e&&Object.assign(Rr,e),Rr}function N4(){const e=this._zod;return e.message??(e.message=JSON.stringify(e.def,sp,2)),e.message}function C4(e){this._zod.message=e}const j4={get:N4,set:C4,enumerable:!0,configurable:!0},xm={value:void 0,enumerable:!1},bx=new WeakSet([Object.prototype,Error.prototype]),R4=(e,r)=>{e.name="$ZodError",xm.value=r,Object.defineProperty(e,"issues",xm),xm.value=void 0,Object.defineProperty(e,"message",j4);const i=Object.getPrototypeOf(e);bx.has(i)||(bx.add(i),Object.defineProperty(i,"toString",{configurable:!0,enumerable:!1,get(){const s=()=>this.message;return Object.defineProperty(this,"toString",{value:s,configurable:!0,writable:!0}),s},set(s){Object.defineProperty(this,"toString",{value:s,configurable:!0,writable:!0})}}))},A4=ae("$ZodError",R4);function O4(e,r,i){return Object.prototype.hasOwnProperty.call(e,r)||(r==="__proto__"?Object.defineProperty(e,r,{value:i(),writable:!0,enumerable:!0,configurable:!0}):e[r]=i()),e[r]}function M4(e,r=i=>i.message){const i={},s=[];for(const l of e.issues)l.path.length>0?O4(i,l.path[0],()=>[]).push(r(l)):s.push(r(l));return{formErrors:s,fieldErrors:i}}function z4(e,r=i=>i.message){const i={_errors:[]},s=(l,c=[])=>{for(const d of l.issues)if(d.code==="invalid_union"&&d.errors.length)d.errors.map(f=>s({issues:f},[...c,...d.path]));else if(d.code==="invalid_key")s({issues:d.issues},[...c,...d.path]);else if(d.code==="invalid_element")s({issues:d.issues},[...c,...d.path]);else{const f=[...c,...d.path];if(f.length===0)i._errors.push(r(d));else{let m=i,g=0;for(;g{const r=(i,s,l,c)=>{const d=l?{...l,async:!1}:{async:!1},f=i._zod.run({value:s,issues:[]},d);if(f instanceof Promise)throw new Gi;if(f.issues.length){const m=new(c?.Err??e)(f.issues.map(g=>mi(g,d,Wr())));throw Dw(m,c?.callee??r),m}return f.value};return r},Jp=e=>{const r=async(i,s,l,c)=>{const d=l?{...l,async:!0}:{async:!0};let f=i._zod.run({value:s,issues:[]},d);if(f instanceof Promise&&(f=await f),f.issues.length){const m=new(c?.Err??e)(f.issues.map(g=>mi(g,d,Wr())));throw Dw(m,c?.callee??r),m}return f.value};return r},Wp=e=>(r,i,s)=>{const l=s?{...s,async:!1}:{async:!1},c=r._zod.run({value:i,issues:[]},l);if(c instanceof Promise)throw new Gi;return c.issues.length?Zw(e,c.issues,l):{success:!0,data:c.value}};function Zw(e,r,i){let s;return{success:!1,get error(){return s||(s=new e(r.map(l=>mi(l,i,Wr()))),r=void 0,i=void 0),s},set error(l){s=l,r=void 0,i=void 0}}}const eg=e=>async(r,i,s)=>{const l=s?{...s,async:!0}:{async:!0};let c=r._zod.run({value:i,issues:[]},l);return c instanceof Promise&&(c=await c),c.issues.length?Zw(e,c.issues,l):{success:!0,data:c.value}},D4=Symbol.for("zod.compile.invalid"),B4=Symbol.for("zod.compile.fallback"),L4=((e,r,i)=>{const s=e._zod.bag.validator;if(s!==void 0){if(s(r)!==D4)return!0;if(s.definite===!0&&i===void 0)return!1}return U4(e,r,i)});function U4(e,r,i){const s=i?{...i,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},l=e._zod.bag.fallbackRun;let c;if(l?(s[B4]=!0,c=l({value:r,issues:[]},s)):c=e._zod.run({value:r,issues:[]},s),c instanceof Promise)throw new Gi;return c.issues.length===0}const H4=async(e,r,i)=>{const s=i?{...i,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0};let l=e._zod.run({value:r,issues:[]},s);return l instanceof Promise&&(l=await l),l.issues.length===0},P4=e=>{const r=Xp(e),i=(s,l,c,d)=>{const f=c?{...c,direction:"backward"}:{direction:"backward"};return r(s,l,f,Td(i,d))};return i},$4=e=>{const r=Xp(e),i=(s,l,c,d)=>r(s,l,c,Td(i,d));return i},q4=e=>{const r=Jp(e),i=async(s,l,c,d)=>{const f=c?{...c,direction:"backward"}:{direction:"backward"};return await r(s,l,f,Td(i,d))};return i},Z4=e=>{const r=Jp(e),i=async(s,l,c,d)=>await r(s,l,c,Td(i,d));return i},I4=e=>(r,i,s)=>{const l=s?{...s,direction:"backward"}:{direction:"backward"};return Wp(e)(r,i,l)},F4=e=>(r,i,s)=>Wp(e)(r,i,s),V4=e=>async(r,i,s)=>{const l=s?{...s,direction:"backward"}:{direction:"backward"};return eg(e)(r,i,l)},Y4=e=>async(r,i,s)=>eg(e)(r,i,s),G4=/^[cC][0-9a-z]{6,}$/,K4=/^[0-9a-z]+$/,Q4=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,X4=/^[0-9a-vA-V]{20}$/,J4=/^[A-Za-z0-9]{27}$/,W4=/^[a-zA-Z0-9_-]{21}$/;function eN(e){return new RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}const tN=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,nN=/^([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})$/,xx=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}-[89)DELIM" -R"DELIM(abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,rN=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,aN="^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$";function iN(){return new RegExp(aN,"u")}const sN=/^(?:(?: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])$/,oN=/^(([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}|:))$/,lN=/^((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])$/,cN=/^(([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}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,uN=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,dN=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/,fN=/^https?$/,hN=/^\+[1-9]\d{6,14}$/,Iw="(?:(?:\\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])))";function mN(e){return new RegExp(`^${e}$`)}const pN=mN(Iw);function lp(e){const r="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${r}`:e.precision===0?`${r}:[0-5]\\d`:`${r}:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?`${r}:[0-5]\\d(?:\\.\\d+)?`:`${r}(?::[0-5]\\d(?:\\.\\d+)?)?`}function gN(e){return new RegExp(`^${lp(e)}$`)}function yN(e){const r=["Z"];e.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const i=`${lp({precision:e.precision,seconds:!0})}(?:${r.join("|")})`,s=e.local?`${i}|${lp({precision:e.precision})}`:i;return new RegExp(`^${Iw}T(?:${s})$`)}const vN=/^[\s\S]{0,}$/,bN=/^-?\d+$/,tg=/^-?\d+(?:\.\d+)?$/,xN=/^(?:true|false)$/i,wN=/^[^A-Z]*$/,SN=/^[^a-z]*$/,qn=ae("$ZodCheck",(e,r)=>{var i;e._zod??(e._zod={}),e._zod.def=r,(i=e._zod).onattach??(i.onattach=[])}),ng=e=>{const r=e.value;return!t4(r)&&r.length!==void 0},sd={number:"number",bigint:"bigint",object:"date"},Fw=ae("$ZodCheckLessThan",(e,r)=>{qn.init(e,r);const i=sd[typeof r.value];e._zod.check=s=>{(r.inclusive?s.value<=r.value:s.value{qn.init(e,r);const i=sd[typeof r.value];e._zod.check=s=>{(r.inclusive?s.value>=r.value:s.value>r.value)||s.issues.push({origin:sd[typeof s.value]??i,code:"too_small",minimum:typeof r.value=="object"?r.value.getTime():r.value,input:s.value,inclusive:r.inclusive,inst:e,continue:!r.abort})}}),EN=ae("$ZodCheckMultipleOf",(e,r)=>{qn.init(e,r),e._zod.check=i=>{if(typeof i.value!=typeof r.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof i.value=="bigint"?r.value!==BigInt(0)&&i.value%r.value===BigInt(0):n4(i.value,r.value)===0)||i.issues.push({origin:typeof i.value,code:"not_multiple_of",divisor:r.value,input:i.value,inst:e,continue:!r.abort})}}),TN=ae("$ZodCheckNumberFormat",(e,r)=>{qn.init(e,r),r.format=r.format||"float64";const i=r.format?.includes("int"),s=i?"int":"number",[l,c]=Uw[r.format];e._zod.check=d=>{const f=d.value;if(i){if(!Number.isInteger(f)){d.issues.push({expected:s,format:r.format,code:"invalid_type",continue:!1,input:f,inst:e});return}if(!Number.isSafeInteger(f)){f>0?d.issues.push({input:f,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:s,inclusive:!0,continue:!r.abort}):d.issues.push({input:f,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:s,inclusive:!0,continue:!r.abort});return}}fc&&d.issues.push({origin:"number",input:f,code:"too_big",maximum:c,inclusive:!0,inst:e,continue:!r.abort})}}),kN=ae("$ZodCheckMaxLength",(e,r)=>{var i;qn.init(e,r),(i=e._zod.def).when??(i.when=ng),e._zod.check=s=>{const l=s.value,c=l.length;if((typeof l=="string"&&c>r.maximum?Kp(l):c)<=r.maximum)return;const f=Qp(l);s.issues.push({origin:f,code:"too_big",maximum:r.maximum,inclusive:!0,input:l,inst:e,continue:!r.abort})}}),_N=ae("$ZodCheckMinLength",(e,r)=>{var i;qn.init(e,r),(i=e._zod.def).when??(i.when=ng),e._zod.check=s=>{const l=s.value,c=l.length;if((typeof l=="string"&&c>=r.minimum&&c=r.minimum)return;const f=Qp(l);s.issues.push({origin:f,code:"too_small",minimum:r.minimum,inclusive:!0,input:l,inst:e,continue:!r.abort})}}),NN=ae("$ZodCheckLengthEquals",(e,r)=>{var i;qn.init(e,r),(i=e._zod.def).when??(i.when=ng),e._zod.check=s=>{const l=s.value,c=l.length,d=typeof l=="string"&&c>=r.length&&c<=r.length*2?Kp(l):c;if(d===r.length)return;const f=Qp(l),m=d>r.length;s.issues.push({origin:f,...m?{code:"too_big",maximum:r.length}:{code:"too_small",minimum:r.length},inclusive:!0,exact:!0,input:s.value,inst:e,continue:!r.abort})}}),kd=ae("$ZodCheckStringFormat",(e,r)=>{var i,s;qn.init(e,r),r.pattern?(i=e._zod).check??(i.check=l=>{r.pattern.lastIndex=0,!r.pattern.test(l.value)&&l.issues.push({origin:"string",code:"invalid_format",format:r.format,input:l.value,...r.pattern?{pattern:r.pattern.toString()}:{},inst:e,continue:!r.abort})}):(s=e._zod).check??(s.check=()=>{})}),CN=ae("$ZodCheckRegex",(e,r)=>{kd.init(e,r),e._zod.check=i=>{r.pattern.lastIndex=0,!r.pattern.test(i.value)&&i.issues.push({origin:"string",code:"invalid_format",format:"regex",input:i.value,pattern:r.pattern.toString(),inst:e,continue:!r.abort})}}),jN=ae("$ZodCheckLowerCase",(e,r)=>{r.pattern??(r.pattern=wN),kd.init(e,r)}),RN=ae("$ZodCheckUpperCase",(e,r)=>{r.pattern??(r.pattern=SN),kd.init(e,r)}),AN=ae("$ZodCheckIncludes",(e,r)=>{qn.init(e,r);const i=so(r.includes),s=new RegExp(typeof r.position=="number"?`^.{${r.position},}${i}`:i);r.pattern=s,e._zod.check=l=>{l.value.includes(r.includes,r.position)||l.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:r.includes,input:l.value,inst:e,continue:!r.abort})}}),ON=ae("$ZodCheckStartsWith",(e,r)=>{qn.init(e,r);const i=new RegExp(`^${so(r.prefix)}.*`);r.pattern??(r.pattern=i),e._zod.check=s=>{s.value.startsWith(r.prefix)||s.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:r.prefix,input:s.value,inst:e,continue:!r.abort})}}),MN=ae("$ZodCheckEndsWith",(e,r)=>{qn.init(e,r);const i=new RegExp(`.*${so(r.suffix)}$`);r.pattern??(r.pattern=i),e._zod.check=s=>{s.value.endsWith(r.suffix)||s.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:r.suffix,input:s.value,inst:e,continue:!r.abort})}}),zN=ae("$ZodCheckOverwrite",(e,r)=>{qn.init(e,r),e._zod.check=i=>{i.value=r.tx(i.value)}});class DN{constructor(r=[],i={}){this.content=[],this.indent=0,this.args=r,this.closed=i}indented(r){this.indent+=1;try{r(this)}finally{this.indent-=1}}write(r){if(typeof r=="function"){r(this,{execution:"sync"}),r(this,{execution:"async"});return}const s=r.split(` +`+o.stack}}var bo=Object.prototype.hasOwnProperty,Zn=e.unstable_scheduleCallback,ts=e.unstable_cancelCallback,nc=e.unstable_shouldYield,rc=e.unstable_requestPaint,_n=e.unstable_now,ac=e.unstable_getCurrentPriorityLevel,vi=e.unstable_ImmediatePriority,xo=e.unstable_UserBlockingPriority,_a=e.unstable_NormalPriority,Ld)DELIM" +R"DELIM(=e.unstable_LowPriority,wo=e.unstable_IdlePriority,Ud=e.log,ic=e.unstable_setDisableYieldValue,Or=null,Jt=null;function br(t){if(typeof Ud=="function"&&ic(t),Jt&&typeof Jt.setStrictMode=="function")try{Jt.setStrictMode(Or,t)}catch{}}var Nn=Math.clz32?Math.clz32:D,Hd=Math.log,A=Math.LN2;function D(t){return t>>>=0,t===0?32:31-(Hd(t)/A|0)|0}var I=256,ue=262144,de=4194304;function Te(t){var n=t&42;if(n!==0)return n;switch(t&-t){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return t&-t;case 262144:case 524288:case 1048576:case 2097152:return t&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return t&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return t}}function Se(t,n,a){var o=t.pendingLanes;if(o===0)return 0;var u=0,h=t.suspendedLanes,b=t.pingedLanes;t=t.warmLanes;var S=o&134217727;return S!==0?(o=S&~h,o!==0?u=Te(o):(b&=S,b!==0?u=Te(b):a||(a=S&~t,a!==0&&(u=Te(a))))):(S=o&~h,S!==0?u=Te(S):b!==0?u=Te(b):a||(a=o&~t,a!==0&&(u=Te(a)))),u===0?0:n!==0&&n!==u&&(n&h)===0&&(h=u&-u,a=n&-n,h>=a||h===32&&(a&4194048)!==0)?n:u}function Ne(t,n){return(t.pendingLanes&~(t.suspendedLanes&~t.pingedLanes)&n)===0}function Ee(t,n){(n&8)!==0&&(n|=n&32);var a=t.entangledLanes;if(a!==0)for(t=t.entanglements,a&=n;0a;a++)n.push(t);return n}function ze(t,n){t.pendingLanes|=n,n!==268435456&&(t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0)}function lt(t,n,a,o,u,h){var b=t.pendingLanes;t.pendingLanes=a,t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0,t.expiredLanes&=a,t.entangledLanes&=a,t.errorRecoveryDisabledLanes&=a,t.shellSuspendCounter=0;var S=t.entanglements,C=t.expirationTimes,U=t.hiddenUpdates;for(a=b&~a;0"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Yd=!1;if(ia)try{var To={};Object.defineProperty(To,"passive",{get:function(){Yd=!0}}),window.addEventListener("test",To,To),window.removeEventListener("test",To,To)}catch{Yd=!1}var ja=null,Gd=null,uc=null;function Wg(){if(uc)return uc;var t,n=Gd,a=n.length,o,u="value"in ja?ja.value:ja.textContent,h=u.length;)DELIM" +R"DELIM(for(t=0;t=No),iy=" ",sy=!1;function oy(t,n){switch(t){case"keyup":return G2.indexOf(n.keyCode)!==-1;case"keydown":return n.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function ly(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var cs=!1;function Q2(t,n){switch(t){case"compositionend":return ly(n);case"keypress":return n.which!==32?null:(sy=!0,iy);case"textInput":return t=n.data,t===iy&&sy?null:t;default:return null}}function X2(t,n){if(cs)return t==="compositionend"||!Wd&&oy(t,n)?(t=Wg(),uc=Gd=ja=null,cs=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(n.ctrlKey||n.altKey||n.metaKey)||n.ctrlKey&&n.altKey){if(n.char&&1"u")return null;try{return t.activeElement||t.body}catch{return t.body}}function gy(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function yy(t,n){var a=gy(t);t=0;for(var o;a;){if(a.nodeType===3){if(o=t+a.textContent.length,t<=n&&o>=n)return{node:a,offset:n-t};t=o}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=gy(a)}}function vy(t,n){return t&&n?t===n?!0:t&&t.nodeType===3?!1:n&&n.nodeType===3?vy(t,n.parentNode):"contains"in t?t.contains(n):t.compareDocumentPosition?!!(t.compareDocumentPosition(n)&16):!1:!1}function by(t){t=t!=null&&t.ownerDocument!=null&&t.ownerDocument.defaultView!=null?t.ownerDocument.defaultView:window;for(var n=nf(t.document);n instanceof t.HTMLIFrameElement;){try{var a=typeof n.contentWindow.location.href=="string"}catch{a=!1}if(a)t=n.contentWindow;else break;n=nf(t.document)}return n}function rf(t){var n=t&&t.nodeName&&t.nodeName.toLowerCase();return n&&(n==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||n==="textarea"||t.contentEditable==="true")}var iT=ia&&"documentMode"in document&&11>=document.documentMode,us=null,af=nul)DELIM" +R"DELIM(l,Ao=null,sf=!1;function xy(t,n,a){var o=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;sf||us==null||us!==nf(o)||(o=us,"selectionStart"in o&&rf(o)?o={start:o.selectionStart,end:o.selectionEnd}:(o=(o.ownerDocument&&o.ownerDocument.defaultView||window).getSelection(),o={anchorNode:o.anchorNode,anchorOffset:o.anchorOffset,focusNode:o.focusNode,focusOffset:o.focusOffset}),Ao&&Ro(Ao,o)||(Ao=o,o=pu(af,"onSelect"),0>=b,u-=b,Ur=1<<32-Nn(n)+u|a<Le?(Vt=Oe,Oe=null):Vt=Oe.sibling;var nt=B(L,Oe,q[Le],te);if(nt===null){Oe===null&&(Oe=Vt);break}t&&Oe&&nt.alternate===null&&n(L,Oe),M=h(nt,M,Le),We===null?we=nt:We.sibling=nt,We=nt,Oe=Vt}if(Le===q.length)return a(L,Oe),Ke&&ca(L,Le),we;if(Oe===null){for(;LeLe?(Vt=Oe,Oe=null):Vt=Oe.sibling;var ei=B(L,Oe,nt.value,te);if(ei===null){Oe===null&&(Oe=Vt);break}t&&Oe&&ei.alternate===null&&n(L,Oe),M=h(ei,M,Le),We===null?we=ei:We.sibling=ei,We=ei,Oe=Vt}if(nt.done)return a(L,Oe),Ke&&ca(L,Le),we;if(Oe===null){for(;!nt.done;Le++,nt=q.next())nt=ne(L,nt.value,te),nt!==null&&(M=h(nt,M,Le),We===null?we=nt:We.sibling=nt,We=nt);return Ke&&ca(L,Le),we}for(Oe=o(Oe);!nt.done;Le++,nt=q.next())nt=Z(Oe,L,Le,nt.value,te),nt!==null&&(t&&(Vt=nt.alternate,Vt!==null&&Oe.delete(Vt.key===null?Le:Vt.key)),M=h(nt,M,Le),We===null?we=nt:We.sibling=nt,We=nt);return t&&Oe.forEach(function(Qk){return n(L,Qk)}),Ke&&ca(L,Le),we}function Fe(L,M,q,te){if(typeof q=="object"&&q!==null&&q.type===F&&q.key===null&&q.props.ref===void 0&&(q=q.props.children),typeof q=="object"&&q!==null){switch(q.$$typeof){case z:e:{for(var we=q.key;M!==null;){if(M.key===we){if(we=q.type,we===F){if(M.tag===7){a(L,M.sibling),te=u(M,q.props.children),Da(te,q),te.return=L,L=te;break e}}else if(M.elementType===we||typeof we=="object"&&we!==null&&we.$$typeof===ye&&Ai(we)===M.type){a(L,M.sibling),te=u(M,q.props),Da(te,q),te.return=L,L=te;break e}a(L,M);break}else n(L,M);M=M.sibling}q.type===F?(te=Ti(q.props.children,L.mode,te,q.key),Da(te,q),te.return=L,L=te):(te=xc(q.type,q.key,q.props,null,L.mode,te),Da(te,q),te.return=L,L=te)}return b(L);case P:e:{for(we=q.key;M!==null;){if(M.key===we)if(M.tag===4&&M.stateNode.containerInfo===q.containerInfo&&M.stateNode.implementation===q.implementation){a(L,M.sibling),te=u(M,q.children||[]),te.return=L,L=te;break e}else{a(L,M);break}else n(L,M);M=M.sibling}te=hf(q,L.mode,te),te.return=L,L=te}return b(L);case ye:return q=Ai(q),Fe(L,M,q,te)}if(me(q))return ve(L,M,q,te);if(ee(q)){if(we=ee(q),typeof we!="function")throw Error(s(150));return q=we.call(q),ke(L,M,q,te)}if(typeof q.then=="function")return Fe(L,M,Rc(q),te);if(q.$$typeof===re)return Fe(L,M,_c(L,q),te);Ac(L,q)}return typeof q=="string"&&q!==""||typeof q=="number"||typeof q=="bigint"?(q=""+q,M!==null&&M.tag===6?(a(L,M.sibling),te=u(M,q),te.return=L,L=te):(a(L,M),te=ff(q,L.mode,te),te.return=L,L=te),b(L)):a(L,M)}return function(L,M,q,te){try{Lo=0;var we=Fe(L,M,q,te);return bs=null,we}catch(Oe){if(Oe===vs||Oe===Cc)throw Oe;var We=Bn(29,Oe,null,L.mode);return We.lanes=te,We.return=L,We}}}var Mi=Iy(!0),Fy=Iy(!1),Ba=!1;function Ef(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Tf(t,n){t=t.updateQueue,n.updateQueue===t&&(n.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,callbacks:null})}function La(t){return{lane:t,tag:0,payload:null,callback:null,next:null}}function Ua(t,n,a){var o=t.updateQueue;if(o===null)return null;if(o=o.shared,(ft&2)!==0){var u=o.pending;return u===null?n.next=n:(n.next=u.next,u.next=n),o.pending=n,n=bc(t),Cy(t,null,a),n}return vc(t,o,n,a),bc(t)}function Uo(t,n,a){if(n=n.updateQueue,n!==null&&(n=n.shared,(a&4194048)!==0)){var o=n.lanes;o&=t.pendingLanes,a|=o,n.lanes=a,Bt(t,a)}}function kf(t,n){var a=t.updateQueue,o=t.alternate;if(o!==null&&(o=o.updateQueue,a===o)){var u=null,h=null;if(a=a.firstBaseUpdate,a!==null){do{var b={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};h===null?u=h=b:h=h.next=b,a=a.next}while(a!==null);h===null?u=h=n:h=h.next=n}else u=h=n;a={baseState:o.baseState,firstBaseUpdate:u,lastBaseUpdate:h,shared:o.shared,callbacks:o.callbacks},t.updateQueue=a;return}t=a.lastBaseUpdate,t===null?a.firstBaseUpdate=n:t.next=n,a.lastBaseUpdate=n}var _f=!1;function Ho(){if(_f){var t=ys;if(t!==null)throw t}}function Po(t,n,a,o){_f=!1;var u=t.updateQueue;Ba=!1;var h=u.firstBaseUpdate,b=u.lastBaseUpdate,S=u.shared.pending;if(S!==null){u.shared.pending=null;var C=S,U=C.next;C.next=null,b===null?h=U:b.next=U,b=C;var V=t.alternate;V!==null&&(V=V.updateQueue,S=V.lastBaseUpdate,S!==b&&(S===null?V.firstBaseUpdate=U:S.next=U,V.lastBaseUpdate=C))}if(h!==null){var ne=u.baseState;b=0,V=U=C=null,S=h;do{var B=S.lane&-536870913,Z=B!==S.lane;if(Z?(Je&B)===B:(o&B)===B){B!==0&&B===ji&&(_f=!0),V!==null&&(V=V.next={lane:0,tag:S.tag,payload:S.payload,callback:null,next:null});e:{var ve=t,ke=S;B=n;var Fe=a;switch(ke.tag){case 1:if(ve=ke.payload,typeof ve=="function"){ne=ve.call(Fe,ne,B);break e}ne=ve;break e;case 3:ve.flags=ve.flags&-65537|128;case 0:if(ve=ke.payload,B=typeof ve=="function"?ve.call(Fe,ne,B):ve,B==null)break e;ne=R({},ne,B);break e;case 2:Ba=!0}}B=S.callback,B!==null&&(t.flags|=64,Z&&(t.flags|=8192),Z=u.callbacks,Z===null?u.callbacks=[B]:Z.push(B))}else Z={lane:B,tag:S.tag,payload:S.payload,callback:S.callback,next:null},V===null?(U=V=Z,C=ne):V=V.next=Z,b|=B;if(S=S.next,S===null){if(S=u.shared.pending,S===null)break;Z=S,S=Z.next,Z.next=null,u.lastBaseUpdate=Z,u.shared.pending=null}}while(!0);V===null&&(C=ne),u.baseState=C,u.firstBaseUpdate=U,u.lastBaseUpdate=V,h===null&&(u.shared.lanes=0),Fa|=b,t.lanes=b,t.memoizedState=ne}}function Vy(t,n){if(ty)DELIM" +R"DELIM(peof t!="function")throw Error(s(191,t));t.call(n)}function Yy(t,n){var a=t.callbacks;if(a!==null)for(t.callbacks=null,t=0;th?h:8;var b=W.T,S={};S.types=b!==null?b.types:null,W.T=S,Vf(t,!1,n,a);try{var C=u(),U=W.S;if(U!==null&&U(S,C),C!==null&&typeof C=="object"&&typeof C.then=="function"){var V=gT(C,o);Io(t,n,V,Qn(t))}else Io(t,n,o,Qn(t))}catch(ne){Io(t,n,{then:function(){},status:"rejected",reason:ne},Qn())}finally{le.p=h,b!==null&&S.types!==null&&(b.types=S.types),W.T=b}}function ST(){}function If(t,n,a,o){if(t.tag!==5)throw Error(s(476));var u=kv(t).queue;Tv(t,u,n,be,a===null?ST:function(){return _v(t),a(o)})}function kv(t){var n=t.memoizedState;if(n!==null)return n;n={memoizedState:be,baseState:be,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ha,lastRenderedState:be},next:null};var a={};return n.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ha,lastRenderedState:a},next:null},t.memoizedState=n,t=t.alternate,t!==null&&(t.memoizedState=n),n}function _v(t){var n=kv(t);n.next===null&&(n=t.alternate.memoizedState),Io(t,n.next.queue,{},Qn())}function Ff(){return dn($s)}function Nv(){return Ht().memoizedState}function Cv(){return Ht().memoizedState}function ET(t){for(var n=t.return;n!==null;){switch(n.tag){case 24:case 3:var a=Qn();t=La(a);var o=Ua(n,t,a);o!==null&&(Pn(o,n,a),Uo(o,n,a)),n={cache:bf()},t.payload=n;return}n=n.return}}function TT(t,n,a){var o=Qn();a={lane:o,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},$c(t)?Rv(n,a):(a=uf(t,n,a,o),a!==null&&(Pn(a,t,o),Av(a,n,o)))}function jv(t,n,a){var o=Qn();Io(t,n,a,o)}function Io(t,n,a,o){var u={lane:o,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if($c(t))Rv(n,u);else{var h=t.alternate;if(t.lanes===0&&(h===null||h.lanes===0)&&(h=n.lastRenderedReducer,h!==null))try{var b=n.lastRenderedState,S=h(b,a);if(u.hasEagerState=!0,u.eagerState=S,Fn(S,b))return vc(t,n,u,0),xt===null&&yc(),!1}catch{}if(a=uf(t,n,u,o),a!==null)return Pn(a,t,o),Av(a,n,o),!0}return!1}function Vf(t,n,a,o){if(o={lane:2,revertLane:Bh(),gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null},$c(t)){if(n)throw Error(s(479))}else n=uf(t,a,o,2),n!==null&&Pn(n,t,2)}function $c(t){var n=t.alternate;return t===Ie||n!==null&&n===Ie}function Rv(t,n){xs=zc=!0;var a=t.pending;a===null?n.next=n:(n.next=a.next,a.next=n),t.pending=n}function Av(t,n,a){if((a&4194048)!==0){var o=n.lanes;o&=t.pendingLanes,a|=o,n.lanes=a,Bt(t,a)}}var qc={readContext:dn,use:Lc,useCallback:Lt,useContext:Lt,useEffect:Lt,useImperativeHandle:Lt,useLayoutEffect:Lt,useInsertionEffect:Lt,useMemo:Lt,useReducer:Lt,useRef:Lt,useState:Lt,useDebugValue:Lt,useDeferredValue:Lt,useTransition:Lt,useSyncExternalStore:Lt,useId:Lt,useHostTransitionStatus:Lt,useFormState:Lt,useActionState:Lt,useOptimistic:Lt,useMemoCache:Lt,useCacheRefresh:Lt,useEffectEvent:Lt},Ov={readContext:dn,use:Lc,useCallback:function(t,n){return jn().memoizedState=[t,n===void 0?null:n],t},useContext:dn,useEffect:pv,useImperativeHandle:function(t,n,a){a=a!=null?a.concat([t]):null,Hc(4194308,4,bv.bind(null,n,t),a)},useLayoutEffect:function(t,n){return Hc(4194308,4,t,n)},useInsertionEffect:function(t,n){Hc(4,2,t,n)},useMemo:function(t,n){var a=jn();n=n===void 0?null:n;var o=t();if(zi){br(!0);try{t()}finally{br(!1)}}return a.memoizedState=[o,n],o},useReducer:function(t,n,a){var o=jn();if(a!==void 0){var u=a(n);if(zi){br(!0);try{a(n)}finally{br(!1)}}}else u=n;return o.memoizedState=o.baseState=u,t={pending:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:u},o.queue=t,t=t.dispatch=TT.bind(null,Ie,t),[o.memoizedState,t]},useRef:function(t){var n=jn();return t={current:t},n.memoizedState=t},useState:function(t){t=Hf(t);var n=t.queue,a=jv.bind(null,Ie,n);return n.dispatch=a,[t.memoizedState,a]},useDebugValue:qf,useDeferredValue:function(t,n){var a=jn();return Zf(a,t,n)},useTransition:function(){var t=Hf(!1);return t=Tv.bind(null,Ie,t.queue,!0,!1),jn().memoizedState=t,[!1,t]},useSyncExternalStore:function(t,n,a){var o=Ie,u=jn();if(Ke){if(a===void 0)throw Error(s(407));a=a()}else{if(a=n(),xt===null)throw Error(s(349));(Je&127)!==0||Wy(o,n,a)}u.memoizedState=a;var h={value:a,getSnapshot:n};return u.queue=h,pv(tv.bind(null,o,h,t),[t]),o.flags|=2048,Ss(9,{destroy:void 0},ev.bind(null,o,h,a,n),null),a},useId:function(){var t=jn(),n=xt.identifierPrefix;if(Ke){var a=Hr,o=Ur;a=(o&~(1<<32-Nn(o)-1)).toString(32)+a,n="_"+n+"R_"+a,a=Dc++,0<\/script>",h=h.removeChild(h.firstChild);break;case"select":h=typeof o.is=="string"?b.createElement("select",{is:o.is}):b.createElement("select"),o.multiple?h.multiple=!0:o.size&&(h.size=o.size);break;default:h=typeof o.is=="string"?b.createElement(u,{is:o.is}):b.createElement(u)}}h[kt]=n,h[Rt]=o;e:for(b=n.child;b!==null;){if(b.tag===5||b.tag===6)h.appendChild(b.stateNode);else if(b.tag!==4&&b.tag!==27&&b.child!==null){b.child.return=b,b=b.child;continue}if(b===n)break e;for(;b.sibling===null;){if(b.return===null||b.return===n)break e;b=b.return}b.sibling.return=b.return,b=b.sibling}n.stateNode=h;e:switch(pn(h,u,o),u){case"button":case"input":case"select":case"textarea":o=!!o.autoFocus;break e;case"img":o=!0;break e;default:o=!1}o&&pa(n)}}return Et(n),n.subtreeFlags&=-33554433,ih(n,n.type,t===null?null:t.memoizedProps,n.pendingProps,a),null;case 6:if(t&&n.stateNode!=null)t.memoizedProps!==o&&pa(n);else{if(typeof o!="string"&&n.stateNode===null)throw Error(s(166));if(t=Ye.current,gs(n)){if(t=n.stateNode,a=n.memoizedProps,o=null,u=nn,u!==null)switch(u.tag){case 27:case 5:o=u.memoizedProps}t[kt]=n,t=!!(t.nodeValue===a||o!==null&&o.suppressHydrationWarning===!0||tb(t.nodeValue,a)),t||Ma(n,!0)}else t=rl(t).createTextNode(o),t[kt]=n,n.stateNode=t}return Et(n),null;case 31:if(a=n.memoizedState,t===null||t.memoizedState!==null){if(o=gs(n),a!==null){if(t===null){if(!o)throw Error(s(318));if(t=n.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(s(557));t[kt]=n}else ki(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;Et(n),t=!1}else a=gf(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=a),t=!0;if(!t)return n.flags&256?(Vn(n),n):(Vn(n),null);if((n.flags&128)!==0)throw Error(s(558))}return Et(n),null;case 13:if(o=n.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(u=gs(n),o!==null&&o.dehydrated!==null){if(t===null){if(!u)throw Error(s(318));if(u=n.memoizedState,u=u!==null?u.dehydrated:null,!u)throw Error(s(317));u[kt]=n}else ki(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;Et(n),u=!1}else u=gf(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=u),u=!0;if(!u)return n.flags&256?(Vn(n),n):(Vn(n),null)}return Vn(n),(n.flags&128)!==0?(n.lanes=a,n):(a=o!==null,t=t!==null&&t.memoizedState!==null,a&&(o=n.child,u=null,o.alternate!==null&&o.alternate.memoizedState!==null&&o.alternate.memoizedState.cachePool!==null&&(u=o.alternate.memoizedState.cachePool.pool),h=null,o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(h=o.memoizedState.cachePool.pool),h!==u&&(o.flags|=2048)),a!==t&&a&&(n.child.flags|=8192),Gc(n,n.updateQueue),Et(n),null);case 4:return at(),t===null&&Ph(n.stateNode.containerInfo),n.flags|=67108864,Et(n),null;case 10:return da(n.type),Et(n),null;case 19:if(Rf(n),o=n.memoizedState,o===null)return Et(n),null;if(u=(n.flags&128)!==0,h=o.rendering,h===null)if(u)Vo(o,!1);else{if(Ut!==0||t!==null&&(t.flags&128)!==0)for(t=n.child;t!==null;){if(h=Mc(t),h!==null){for(n.flags|=128,Vo(o,!1),t=h.updateQueue,n.updateQueue=t,Gc(n,t),n.subtreeFlags=0,t=a,a=n.child;a!==null;)jy(a,t),a=a.sibling;return $o(n,hn.current&1|2),Ke&&ca(n,o.treeForkCount),n.child}t=t.sibling}o.tail!==null&&_n()>su&&(n.flags|=128,u=!0,Vo(o,!1),n.lanes=4194304)}else{if(!u)if(t=Mc(h),t!==null){if(n.flags|=128,u=!0,t=t.updateQueue,n.updateQueue=t,Gc(n,t),Vo(o,!0),o.tail===null&&o.tailMode!=="collapsed"&&o.tailMode!=="visible"&&!h.alternate&&!Ke)return Et(n),null}else 2*_n()-o.renderingStartTime>su&&a!==536870912&&(n.flags|=128,u=!0,Vo(o,!1),n.lanes=4194304);o.isBackwards?(h.sibling=n.child,n.child=h):(t=o.last,t!==null?t.sibling=h:n.child=h,o.last=h)}if(o.tail!==null){t=o.tail;e:{for(a=t;a!==null;){if(a.alternate!==null){a=!1;break e}a=a.sibling}a=!0}return o.rendering=t,o.tail=t.sibling,o.renderingStartTime=_n(),t.sibling=null,h=hn.current,h=u?h&1|2:h&1,o.tailMode==="visible"||o.tailMode==="collapsed"||!a||Ke?$o(n,h):(a=h,Ue(fn,n),Ue(hn,a),Sn===null&&(Sn=n)),Ke&&ca(n,o.treeForkCount),t}return Et(n),null;case 22:case 23:return Vn(n),Cf(),o=n.memoizedState!==null,t!==null?t.memoizedState!==null!==o&&(n.flags|=8192):o&&(n.flags|=8192),o?(a&536870912)!==0&&(n.flags&128)===0&&(Et(n),n.subtreeFlags&6&&(n.flags|=8192)):Et(n),a=n.updateQueue,a!==null&&Gc(n,a.retryQueue),a=null,t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(a=t.memoizedState.cachePool.pool),o=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(o=n.memoizedState.cachePool.pool),o!==a&&(n.flags|=2048),t!==null&&Be(Ri),null;case 24:return a=null,t!==null&&(a=t.memoizedState.cache),n.memoizedState.cache!==a&&(n.flags|=2048),da(Zt),Et(n),null;case 25:return null;case 30:return n.flags|=33554432,Et(n),null}throw Error(s(156,n.tag))}function AT(t,n){switch(mf(n),n.tag){case 1:return t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 3:return da(Zt),at(),t=n.flags,(t&65536)!==0&&(t&128)===0?(n.flags=t&-65537|128,n):null;case 26:case 27:case 5:return ln(n),null;case 31:if(n.memoizedState!==null){if(Vn(n),n.alternate===null)throw Error(s(340));ki()}return t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 13:if(Vn(n),t=n.memoizedState,t!==null&&t.dehydrated!==null){if(n.alternate===null)throw Error(s(340));ki()}return t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 19:return Rf(n),t=n.flags,t&65536?(n.flags=t&-65537|128,t=n.memoizedState,t!==null&&(t.rendering=null,t.tail=null),n.flags|=4,n):null;case 4:return at(),null;case 10:return da(n.type),null;case 22:case 23:return Vn(n),Cf(),t!==null&&Be(Ri),t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 24:return da(Zt),null;case 25:return null;default:return null}}function r0(t,n){switch(mf(n),n.tag){case 3:da(Zt),at();break;case 26:case 27:case 5:ln(n);break;case 4:at();break;case 31:n.memoizedState!==null&&Vn(n);break;case 13:Vn(n);break;case 19:Rf(n);break;case 10:da(n.type);break;case 22:case 23:Vn(n),Cf(),t!==null&&Be(Ri);break;case 24:da(Zt)}}function Yo(t,n){try{var a=n.updateQueue,o=a!==null?a.lastEffect:null;if(o!==null){var u=o.next;a=u;do{if((a.tag&t)===t){o=void 0;var h=a.create,b=a.inst;o=h(),b.destroy=o}a=a.next}while(a!==u)DELIM" +R"DELIM()}}catch(S){yt(n,n.return,S)}}function qa(t,n,a){try{var o=n.updateQueue,u=o!==null?o.lastEffect:null;if(u!==null){var h=u.next;o=h;do{if((o.tag&t)===t){var b=o.inst,S=b.destroy;if(S!==void 0){b.destroy=void 0,u=n;var C=a,U=S;try{U()}catch(V){yt(u,C,V)}}}o=o.next}while(o!==h)}}catch(V){yt(n,n.return,V)}}function a0(t){var n=t.updateQueue;if(n!==null){var a=t.stateNode;try{Yy(n,a)}catch(o){yt(t,t.return,o)}}}function i0(t,n,a){a.props=Di(t.type,t.memoizedProps),a.state=t.memoizedState;try{a.componentWillUnmount()}catch(o){yt(t,n,o)}}function Pr(t,n){try{var a=t.ref;if(a!==null){switch(t.tag){case 26:case 27:case 5:var o=t.stateNode;break;case 30:var u=t.stateNode,h=sa(t.memoizedProps,u);(u.ref===null||u.ref.name!==h)&&(u.ref=fb(h)),o=u.ref;break;case 7:if(t.stateNode===null){var b=new Xn(t);y(t.child,!1,wk,b,void 0,void 0),t.stateNode=b}o=t.stateNode;break;default:o=t.stateNode}typeof a=="function"?t.refCleanup=a(o):a.current=o}}catch(S){yt(t,n,S)}}function mn(t,n){var a=t.ref,o=t.refCleanup;if(a!==null)if(typeof o=="function")try{o()}catch(u){yt(t,n,u)}finally{t.refCleanup=null,t=t.alternate,t!=null&&(t.refCleanup=null)}else if(typeof a=="function")try{a(null)}catch(u){yt(t,n,u)}else a.current=null}function Kc(t,n){if((t.tag===5||t.tag===27||t.tag===6)&&t.alternate===null&&n!==null)for(var a=0;a title"))),pn(o,n,a),o[kt]=t,Ze(o),n=o;break e;case"link":if(h=jb("link","href",u).get(n+(a.href||""))){for(b=0;bFe&&(b=Fe,Fe=ke,ke=b);var L=yy(S,ke),M=yy(S,Fe);if(L&&M&&(Z.rangeCount!==1||Z.anchorNode!==L.node||Z.anchorOffset!==L.offset||Z.focusNode!==M.node||Z.focusOffset!==M.offset)){var q=ne.createRange();q.setStart(L.node,L.offset),Z.removeAllRanges(),ke>Fe?(Z.addRange(q),Z.extend(M.node,M.offset)):(q.setEnd(M.node,M.offset),Z.addRange(q))}}}}for(ne=[],Z=S;Z=Z.parentNode;)Z.nodeType===1&&ne.push({element:Z,left:Z.scrollLeft,top:Z.scrollTop});for(typeof S.focus=="function"&&S.focus(),S=0;Sa?32:a,W.T=null,a=_h,_h=null;var h=Tr,b=Vr;if(At=0,Hi=Tr=null,Vr=0,(ft&6)!==0)throw Error(s(331));var S=ft;if(ft|=4,C0(h.current),k0(h,h.current,b,a),ft=S,el(0,!1),Jt&&typeof Jt.onPostCommitFiberRoot=="function")try{Jt.onPostCommitFiberRoot(Or,h)}catch{}return!0}finally{le.p=u,W.T=o,Z0(t,n)}}function I0(t,n,a){n=ar(a,n),n=Kf(t.stateNode,n,2),t=Ua(t,n,2),t!==null&&(ze(t,2),Yr(t))}function yt(t,n,a){if(t.tag===3)I0(t,t,a);else for(;n!==null;){if(n.tag===3){I0(n,t,a);break}else if(n.tag===1){var o=n.stateNode;if(typeof n.type.getDerivedStateFromError=="function"||typeof o.componentDidCatch=="function"&&(Va===null||!Va.has(o))){t=ar(a,t),a=Pv(2),o=Ua(n,a,2),o!==null&&($v(a,o,n,t),ze(o,2),Yr(o));break}}n=n.return}}function Mh(t,n,a){var o=t.pingCache;if(o===null){o=t.pingCache=new DT;var u=new Set;o.set(n,u)}else u=o.get(n),u===void 0&&(u=new Set,o.set(n,u));u.has(a)||(Eh=!0,u.add(a),t=ZT.bind(null,t,n,a),n.then(t,t))}function ZT(t,n,a){var o=t.pingCache;o!==null&&o.delete(n),t.pingedLanes|=t.suspendedLanes&a,t.warmLanes&=~a,xt===t&&(Je&a)===a&&((Ut===4||Ut===3&&(Je&62914560)===Je&&300>_n()-iu)&&(ft&2)===0?Ms(t,0):au|=a,Cs===Je&&(Cs=0)),Yr(t)}function F0(t,n){n===0&&(n=Ae()),t=Ei(t,n),t!==null&&(ze(t,n),Yr(t))}function IT(t){var n=t.memoizedState,a=0;n!==null&&(a=n.retryLane),F0(t,a)}function FT(t,n){var a=0;switch(t.tag){case 31:case 13:var o=t.stateNode,u=t.memoizedState;u!==null&&(a=u.retryLane);break;case 19:o=t.stateNode;break;case 22:o=t.stateNode._retryCache;break;default:throw Error(s(314))}o!==null&&o.delete(n),F0(t,a)}function VT(t,n){return Zn(t,n)}var Ds=null,Bs=null,zh=!1,hu=!1,Dh=!1,Ga=0;function Yr(t){t!==Bs&&t.next===null&&(Bs===null?Ds=Bs=t:Bs=Bs.next=t),hu=!0,zh||(zh=!0,GT())}function el(t,n){if(!Dh&&hu){Dh=!0;do for(var a=!1,o=Ds;o!==null;){if(t!==0){var u=o.pendingLanes;if(u===0)var h=0;else{var b=o.suspendedLanes,S=o.pingedLanes;h=(1<<31-Nn(42|t)+1)-1,h&=u)DELIM" +R"DELIM(&~(b&~S),h=h&201326741?h&201326741|1:h?h|2:0}h!==0&&(a=!0,K0(o,h))}else h=Je,h=Se(o,o===xt?h:0,o.cancelPendingCommit!==null||o.timeoutHandle!==-1),(h&3)===0||Ne(o,h)||(a=!0,K0(o,h));o=o.next}while(a);Dh=!1}}function YT(){V0()}function V0(){hu=zh=!1;var t=0;Ga!==0&&ik()&&(t=Ga);for(var n=_n(),a=null,o=Ds;o!==null;){var u=o.next,h=Y0(o,n);h===0?(o.next=null,a===null?Ds=u:a.next=u,u===null&&(Bs=a)):(a=o,(t!==0||(h&3)!==0)&&(hu=!0)),o=u}At!==0&&At!==5||el(t),Ga!==0&&(Ga=0)}function Y0(t,n){for(var a=t.suspendedLanes,o=t.pingedLanes,u=t.expirationTimes,h=t.pendingLanes&-62914561;0S)break;var V=C.transferSize,ne=C.initiatorType;V&&nb(ne)&&(C=C.responseEnd,b+=V*(Cvu){ke.length=ve;break}q=new Promise(dk.bind(q)),ke.push(q)}}}if(0"u"?null:document;function kb(t,n,a){var o=Us;if(o&&typeof n=="string"&&n){var u=nr(n);u='link[rel="'+t+'"][href="'+u+'"]',typeof a=="string"&&(u+='[crossorigin="'+a+'"]'),Tb.has(u)||(Tb.add(u),t={rel:t,crossOrigin:a,href:n},o.querySelector(u)===null&&(n=o.createElement("link"),pn(n,"link",t),Ze(n),o.head.appendChild(n)))}}function Rk(t){ya.D(t),kb("dns-prefetch",t,null)}function Ak(t,n){ya.C(t,n),kb("preconnect",t,n)}function Ok(t,n,a){ya.L(t,n,a);var o=Us;if(o&&t&&n){var u='link[rel="preload"][as="'+nr(n)+'"]';n==="image"&&a&&a.imageSrcSet?(u+='[imagesrcset="'+nr(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(u+='[imagesizes="'+nr(a.imageSizes)+'"]')):u+='[href="'+nr(t)+'"]';var h=u;switch(n){case"style":h=Hs(t);break;case"script":h=Ps(t)}if(!(ur.has(h)||(t=R({rel:"preload",href:n==="image"&&a&&a.imageSrcSet?void 0:t,as:n},a),ur.set(h,t),o.querySelector(u)!==null||n==="style"&&o.querySelector(il(h))||n==="script"&&o.querySelector(sl(h))))){var b=o.createElement("link");pn(b,"link",t),n==="style"&&(b[Ge]=!0,b.onload=b.onerror=function(){Br(b)}),Ze(b),o.head.appendChild(b)}}}function Mk(t,n){ya.m(t,n);var a=Us;if(a&&t){var o=n&&typeof n.as=="string"?n.as:"script",u='link[rel="modulepreload"][as="'+nr(o)+'"][href="'+nr(t)+'"]',h=u;switch(o){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":h=Ps(t)}if(!ur.has(h)&&(t=R({rel:"modulepreload",href:t},n),ur.set(h,t),a.querySelector(u)===null)){switch(o){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(sl(h)))return}o=a.createElement("link"),pn(o,"link",t),Ze(o),a.head.appendChild(o)}}}function zk(t,n,a){ya.S(t,n,a);var o=Us;if(o&&t){var u=Dr(o).hoistableStyles,h=Hs(t);n=n||"default";var b=u.get(h);if(!b){var S={loading:0,preload:null};if(b=o.querySelector(il(h)))S.loading=5;else{t=R({rel:"stylesheet",href:t,"data-precedence":n},a),(a=ur.get(h))&&nm(t,a);var C=b=o.createElement("link");Ze(C),pn(C,"link",t),C._p=new Promise(function(U,V){C.onload=U,C.onerror=V}),C.addEventListener("load",function(){S.loading|=1}),C.addEventListener("error",function(){S.loading|=2}),S.loading|=4,gu(b,n,o)}b={type:"stylesheet",instance:b,count:1,state:S},u.set(h,b)}}}function Dk(t,n){ya.X(t,n);var a=Us;if(a&&t){var o=Dr(a).hoistableScripts,u=Ps(t),h=o.get(u);h||(h=a.querySelector(sl(u)),h||(t=R({src:t,async:!0},n),(n=ur.get(u))&&rm(t,n),h=a.createElement("script"),Ze(h),pn(h,"link",t),a.head.appendChild(h)),h={type:"script",instance:h,count:1,state:null},o.set(u,h))}}function Bk(t,n){ya.M(t,n);var a=Us;if(a&&t){var o=Dr(a).hoistableScripts,u=Ps(t),h=o.get(u);h||(h=a.querySelector(sl(u)),h||(t=R({src:t,async:!0,type:"module"},n),(n=ur.get(u))&&rm(t,n),h=a.createElement("script"),Ze(h),pn(h,"link",t),a.head.appendChild(h)),h={type:"script",instance:h,count:1,state:null},o.set(u,h))}}function _b(t,n,a,o){var u=(u=Ye.current)?al(u):null;if(!u)throw Error(s(446));switch(t){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(a=Hs(a.href),n=Dr(u).hoistableStyles,o=n.get(a),o||(o={type:"style",instance:null,count:0,state:null},n.set(a,o)),o):{type:"void",instance:null,count:0,state:null};case"link":if(a.rel==="stylesheet"&&typeof a.href=="string"&&typeof a.precedence=="string"){t=Hs(a.href);var h=Dr(u).hoistableStyles,b=h.get(t);if(b||(u=u.ownerDocument||u,b={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},h.set(t,b),(h=u.querySelector(il(t)))?h._p||(b.instance=h,b.state.loading=5):(h=ur.get(t),h||(h={rel:"preload",as:"style",href:a.href,crossOrigin:a.crossOrigin,integrity:a.integrity,media:a.media,hrefLang:a.hrefLang,referrerPolicy:a.referrerPolicy},ur.set(t,h)),Lk(u,t,h,b.state))),n&&o===null)throw Error(s(528,""));return b}if(n&&o!==null)throw Error(s(529,""));return null;case"script":return n=a.async,a=a.src,typeof a=="string"&&n&&typeof n!="function"&&typeof n!="symbol"?(a=Ps(a),n=Dr(u).hoistableScripts,o=n.get(a),o||(o={type:"script",instance:null,count:0,state:null},n.set(a,o)),o):{type:"void",instance:null,count:0,state:null};default:throw Error(s(444,t))}}function Hs(t){return'href="'+nr(t)+'"'}function il(t){return'link[rel="stylesheet"]['+t+"]"}function Nb(t){return R({},t,{"data-precedence":t.precedence,precedence:null})}function Lk(t,n,a,o){if(n=t.querySelector('link[rel="preload"][as="style"]['+n+"]")){if(n[Ge]!==!0){o.loading=1;return}}else n=t.createElement("link"),n[Ge]=!0,n.onload=n.onerror=Br.bind(null,n),pn(n,"link",a),Ze(n),t.head.appendChild(n);o.preload=n,n.addEventListener("load",function(){return o.loading|=1}),n.addEventListener("error",function(){return o.loading|=2})}function Ps(t){return'[src="'+nr(t)+'"]'}function sl(t){return"script[async]"+t}function Cb(t,n,a){if(n.count++,n.instance===null)switch(n.type){case"style":var o=t.querySelector('style[data-href~="'+nr(a.href)+'"]');if(o)return n.instance=o,Ze(o),o;var u=R({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return o=(t.ownerDocument||t).createElement("style"),Ze(o),pn(o,"style",u),gu(o,a.precedence,t),n.instance=o;case"stylesheet":u=Hs(a.href);var h=t.querySelector(il(u));if(h)return n.state.loading|=4,n.instance=h,Ze(h),h;o=Nb(a),(u=ur.get(u))&&nm(o,u),h=(t.ownerDocument||t).createElement("link"),Ze(h);var b=h;return b._p=new Promise(function(S,C){b.onload=S,b.onerror=C}),pn(h,"link",o),n.state.loading|=4,gu(h,a.precedence,t),n.instance=h;case"script":return h=Ps(a.src),(u=t.querySelector(sl(h)))?(n.instance=u,Ze(u),u):(o=a,(u=ur.get(h))&&(o=R({},a),rm(o,u)),t=t.ownerDocument||t,u=t.createElement("script"),Ze(u),pn(u,"link",o),t.head.appendChild(u),n.instance=u);case"void":return null;default:throw Error(s(443,n.type))}else n.type==="stylesheet"&&(n.state.loading&4)===0&&(o=n.instance,n.state.loading|=4,gu(o,a.precedence,t));return n.instance}function gu(t,n,a){for(var o=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),u=o.length?o[o.length-1]:null,h=u,b=0;b title"):null)}function Uk(t,n,a){if(a===1||n.itemProp!=null)return!1;switch(t){case"meta":case"title":return!0;case"style":if(typeof n.precedence!="string"||typeof n.href!="string"||n.href==="")break;return!0;case"link":if(typeof n.rel!="string"||typeof n.href!="string"||n.href===""||n.onLoad||n.onError)break;return n.rel==="stylesheet"?(t=n.disabled,typeof n.precedence=="string"&&t==null):)DELIM" +R"DELIM(!0;case"script":if(n.async&&typeof n.async!="function"&&typeof n.async!="symbol"&&!n.onLoad&&!n.onError&&n.src&&typeof n.src=="string")return!0}return!1}function Rb(t,n){return t==="img"&&n.src!=null&&n.src!==""&&n.onLoad==null&&n.loading!=="lazy"}function Ab(t){return!(t.type==="stylesheet"&&(t.state.loading&3)===0)}function Ob(t){return(t.width||100)*(t.height||100)*(typeof devicePixelRatio=="number"?devicePixelRatio:1)*.25}function Mb(t,n){typeof n.decode=="function"&&(t.imgCount++,n.complete||(t.imgBytes+=Ob(n),t.suspenseyImages.push(n)),t=$k.bind(t),n.decode().then(t,t))}function Hk(t,n,a,o){if(a.type==="stylesheet"&&(typeof o.media!="string"||matchMedia(o.media).matches!==!1)&&(a.state.loading&4)===0){if(a.instance===null){var u=Hs(o.href),h=n.querySelector(il(u));if(h){n=h._p,n!==null&&typeof n=="object"&&typeof n.then=="function"&&(t.count++,t=ol.bind(t),n.then(t,t)),a.state.loading|=4,a.instance=h,Ze(h);return}h=n.ownerDocument||n,o=Nb(o),(u=ur.get(u))&&nm(o,u),h=h.createElement("link"),Ze(h);var b=h;b._p=new Promise(function(S,C){b.onload=S,b.onerror=C}),pn(h,"link",o),a.instance=h}t.stylesheets===null&&(t.stylesheets=new Map),t.stylesheets.set(a,n),(n=a.state.preload)&&(a.state.loading&3)===0&&(t.count++,a=ol.bind(t),n.addEventListener("load",a),n.addEventListener("error",a))}}var vu=0;function Pk(t,n){return t.stylesheets&&t.count===0&&xu(t,t.stylesheets),0vu?50:800)+n);return t.unsuspend=a,function(){t.unsuspend=null,clearTimeout(o),clearTimeout(u)}}:null}function zb(t){if(t.count===0&&(t.imgCount===0||!t.waitingForImages)){if(t.stylesheets)xu(t,t.stylesheets);else if(t.unsuspend){var n=t.unsuspend;t.unsuspend=null,n()}}}function ol(){this.count--,zb(this)}function $k(){this.imgCount--,zb(this)}var bu=null;function xu(t,n){t.stylesheets=null,t.unsuspend!==null&&(t.count++,bu=new Map,n.forEach(qk,t),bu=null,ol.call(t))}function qk(t,n){if(!(n.state.loading&4)){var a=bu.get(t);if(a)var o=a.get(null);else{a=new Map,bu.set(t,a);for(var u=t.querySelectorAll("link[data-precedence],style[data-precedence]"),h=0;h"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(r){console.error(r)}}return e(),hm.exports=i_(),hm.exports}var o_=s_();const l_=Dp(o_),c_=[{id:"current",label:"Classic"},{id:"light",label:"Light"},{id:"midnight",label:"Midnight"}],Lp="libbitcoinTheme",ad="libbitcoin-theme-change";function Up(e){return e==="light"||e==="midnight"?e:"current"}function vw(){try{return Up(localStorage.getItem(Lp))}catch{return"current"}}function Hp(e){document.documentElement.dataset.theme=e;const r=getComputedStyle(document.documentElement).getPropertyValue("--theme-background").trim();r&&document.querySelector('meta[name="theme-color"]')?.setAttribute("content",r)}function u_(){Hp(vw()),globalThis.addEventListener("storage",h_)}function d_(e){const r=Up(e);Hp(r);try{localStorage.setItem(Lp,r)}catch{}globalThis.dispatchEvent(new Event(ad))}function f_(){return Up(document.documentElement.dataset.theme)}function h_(e){e.key!==null&&e.key!==Lp||(Hp(vw()),globalThis.dispatchEvent(new Event(ad)))}function m_(e){return globalThis.addEventListener(ad,e),()=>{globalThis.removeEventListener(ad,e)}}function p_(){return T.useSyncExternalStore(m_,f_,()=>"current")}const bw=T.createContext(void 0),xw=e=>{const r=T.useContext(bw);if(!r)throw new Error("No QueryClient set, use QueryClientProvider to set one");return r},g_=({client:e,children:r})=>(T.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),p.jsx(bw.Provider,{value:e,children:r})),y_={setTimeout:(e,r)=>setTimeout(e,r),clearTimeout:e=>clearTimeout(e),setInterval:(e,r)=>setInterval(e,r),clearInterval:e=>clearInterval(e)};var v_=class{#e=y_;#t=!1;setTimeoutProvider(e){this.#e=e}setTimeout(e,r){return this.#e.setTimeout(e,r)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,r){return this.#e.setInterval(e,r)}clearInterval(e){this.#e.clearInterval(e)}};const Fi=new v_;function b_(e){setTimeout(e,0)}const x_=typeof window>"u"||"Deno"in globalThis;function $n(){}function w_(e,r){return typeof e=="function"?e(r):e}function ww(e){return typeof e=="number"&&e>=0&&e!==1/0}function Sw(e,r){return Math.max(e+(r||0)-Date.now(),0)}function Nt(e,r){return typeof e=="function"?e(r):e}function ax(e,r){const{type:i="all",exact:s,fetchStatus:l,predicate:c,queryKey:d,stale:f}=e;if(d){if(s){if(r.queryHash!==Pp(d,r.options))return!1}else if(!ao(r.queryKey,d))return!1}if(i!=="all"){const m=r.isActive();if(i==="active"&&!m||i==="inactive"&&m)return!1}return!(typeof f=="boolean"&&r.isStale()!==f||l&&l!==r.state.fetchStatus||c&&!c(r))}function ix(e,r){const{exact:i,status:s,predic)DELIM" +R"DELIM(ate:l,mutationKey:c}=e;if(c){if(!r.options.mutationKey)return!1;if(i){if(Ll(r.options.mutationKey)!==Ll(c))return!1}else if(!ao(r.options.mutationKey,c))return!1}return!(s&&r.state.status!==s||l&&!l(r))}function Pp(e,r){return(r?.queryKeyHashFn||Ll)(e)}function Ll(e){return JSON.stringify(e,(r,i)=>tp(i)?Object.keys(i).sort().reduce((s,l)=>(s[l]=i[l],s),{}):i)}function ao(e,r){if(e===r)return!0;if(typeof e!=typeof r)return!1;if(e&&r&&typeof e=="object"&&typeof r=="object"){if(Array.isArray(e)&&Array.isArray(r)){if(r.length>e.length)return!1;for(let s=0;s500)return r;const s=sx(e)&&sx(r);if(!s&&!(tp(e)&&tp(r)))return r;const l=(s?e:Object.keys(e)).length,c=s?r:Object.keys(r),d=c.length,f=s?new Array(d):{};let m=0;for(let g=0;g{Fi.setTimeout(r,e)})}function np(e,r,i){return typeof i.structuralSharing=="function"?i.structuralSharing(e,r):i.structuralSharing!==!1?Tw(e,r):r}function E_(e,r,i=0){const s=[...e,r];return i&&s.length>i?s.slice(-i):s}function T_(e,r,i=0){const s=[r,...e];return i&&s.length>i?s.slice(0,i):s}const $p=Symbol();function kw(e,r){return!e.queryFn&&r?.initialPromise?()=>r.initialPromise:!e.queryFn||e.queryFn===$p?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function _w(e,r){return typeof e=="function"?e(...r):!!e}const qp=Symbol();function k_(e,r,i,s){let l=!1,c;return Object.defineProperties(e,{[qp]:{value:s},signal:{enumerable:!0,get:()=>(c??=r(),l||(l=!0,c.aborted?i():c.addEventListener("abort",i,{once:!0})),c)}}),e}let __=()=>x_;const Zp=()=>__();var Fl=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},N_=class extends Fl{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<"u"&&window.addEventListener){const r=()=>e();return window.addEventListener("visibilitychange",r,!1),()=>{window.removeEventListener("visibilitychange",r)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(r=>{r(e)})}isFocused(){return typeof this.#e=="boolean"?this.#e:globalThis.document?.visibilityState!=="hidden"}};const Ip=new N_,C_=b_;function j_(){let e=[],r=0,i=f=>{f()},s=f=>{f()},l=C_;const c=f=>{r?e.push(f):l(()=>{i(f)})},d=()=>{const f=e;e=[],f.length&&l(()=>{s(()=>{f.forEach(m=>{i(m)})})})};return{batch:f=>{let m;r++;try{m=f()}finally{r--,r||d()}return m},batchCalls:f=>(...m)=>{c(()=>{f(...m)})},schedule:c,setNotifyFunction:f=>{i=f},setBatchNotifyFunction:f=>{s=f},setScheduler:f=>{l=f}}}const bn=j_();var R_=class extends Fl{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<"u"&&window.addEventListener){const r=()=>e(!0),i=()=>e(!1);return window.addEventListener("online",r,!1),window.addEventListener("offline",i,!1),()=>{window.removeEventListener("online",r),window.removeEventListener("offline",i)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(r=>{r(e)}))}isOnline(){return this.#e}};const id=new R_;function A_(e){return Math.min(1e3*2**e,3e4)}function Nw(e){return(e??"online")==="online"?id.isOnline():!0}var rp=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent}};function Cw(e){let r=!1,i=0,s,l="pending",c,d;const f=new Promise((O,se)=>{c=O,d=se});f.catch($n);const m=()=>l!=="pending",g=O=>{if(!m()){const se=new rp(O);_(se),e.onCancel?.(se)}},v=()=>{r=!0},y=()=>{r=!1},x=()=>Ip.isFocused()&&(e.networkMode==="always"||id.isOnline())&&e.canRun(),w=()=>Nw(e.networkMode)&&e.canRun(),E=O=>{m()||(s?.(),l="resolved",c(O))},_=O=>{m()||(s?.(),l="rejected",d(O))},N=O=>new Promise(se=>{s=ce=>{(m()||O())&&se(ce)},e.onPause?.()}).then(()=>{s=void 0,m()||e.onContinue?.()}),H=()=>{if(m())return;let O;const se=i===0?e.initialPromise:void 0;try{O=se??e.fn()}catch(ce){O=Promise.reject(ce)}Promise.resolve(O).then(E).catch(ce=>{if(m())return;const K=e.retry??(Zp()?0:3),oe=e.retryDelay??A_,R=typeof oe=="function"?oe(i,ce):oe,k=K===!0||typeof K=="number"&&im()||x()?void 0:N(x)).then(()=>{r?_(ce):H()})})};return{promise:f,status:()=>l,cancel:g,continue:()=>(s?.(),f),cancelRetry:v,continueRetry:y,canStart:w,start:()=>(w()?H():N(w).then(H),f)}}var jw=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),ww(this.gcTime)&&(this.#e=Fi.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Zp()?1/0:3e5))}clearGcTimeout(){this.#e!==void 0&&(Fi.clearTimeout(this.#e),this.#e=void 0)}};function O_(e){return{onFetch:(r,i)=>{const s=r.options,l=r.fetchOptions?.meta?.fetchMore?.direction,c=r.state.data?.pages||[],d=r.state.data?.pageParams||[];let f={pages:[],pageParams:[]},m=0;const g=async()=>{let v=!1;const y=r,x=_=>{k_(_,()=>r.signal,()=>v=!0,y[qp])},w=kw(r.options,r.fetchOptions),E=async(_,N,H)=>{if(v)return Promise.reject(r.signal.reason);if(N==null&&_.pages.length)return Promise.resolve(_);const se=(()=>{const R={client:r.client,queryKey:r.queryKey,pageParam:N,direction:H?"backward":"forward",meta:r.options.meta};return x(R),R})(),ce=await w(se),{maxPages:K}=r.options,oe=H?T_:E_;return{pages:oe(_.pages,ce,K),pageParams:oe(_.pageParams,N,K)}};if(l&&c.length){const _=l==="backward",N=_?M_:lx,H={pages:c,pageParams:d};f=await E(H,N(s,H),_)}else{const _=e??c.length;do{const N=m===0?d[0]===void 0?s.initialPageParam:d[0]:lx(s,f);if(m>0&&N==null)break;f=await E(f,N),m++}while(m<_)}return f};r.options.persister?r.fetchFn=()=>r.options.persister?.(g,{client:r.client,queryKey:r.queryKey,meta:r.options.meta,signal:r.signal},i):r.fetchFn=g}}}function lx(e,{pages:r,pageParams:i}){const s=r.length-1;return r.length>0?e.getNextPageParam(r[s],r,i[s],i):void 0}function M_(e,{pages:r,pageParams:i}){return r.length>0?e.getPreviousPageParam?.(r[0],r,i[0],i):void 0}var z_=class extends jw{#e;#t;#n;#r;#i;#a;#s;#l;#c;constructor(e){super(),this.#c=!1,this.#l=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#r=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=ux(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#a?.promise}setOptions(e){if(this.options={...this.#l,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTim)DELIM" +R"DELIM(e),this.state&&this.state.data===void 0){const r=ux(this.options);r.data!==void 0&&(this.setState(cx(r.data,r.dataUpdatedAt)),this.#t=r)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&this.#r.remove(this)}setData(e,r){const i=np(this.state.data,e,this.options);return this.#o({data:i,type:"success",dataUpdatedAt:r?.updatedAt,manual:r?.manual}),i}setState(e){this.#o({type:"setState",state:e})}cancel(e){const r=this.#a?.promise;return this.#a?.cancel(e),r?r.then($n).catch($n):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>Nt(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===$p||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.state.data===void 0?!1:this.getObserversCount()>0?this.observers.some(e=>Nt(e.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e==="static"?!1:this.state.isInvalidated?!0:!Sw(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#a?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#a?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){const r=this.observers.indexOf(e);r!==-1&&(this.observers.splice(r,1),this.observers.length||(this.#a&&(this.#c||this.state.fetchStatus==="paused"&&this.state.status==="pending"?this.#a.cancel({revert:!0}):this.#a.cancelRetry()),this.scheduleGc()),this.#r.notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#o({type:"invalidate"})}async fetch(e,r){if(this.state.fetchStatus!=="idle"&&this.#a?.status()!=="rejected"){if(this.state.data!==void 0&&r?.cancelRefetch)this.cancel({silent:!0});else if(this.#a&&this.#s)return this.#a.continueRetry(),this.#s}if(e&&this.setOptions(e),!this.options.queryFn){const g=this.observers.find(v=>v.options.queryFn);g&&this.setOptions(g.options)}const i=new AbortController,s=g=>{Object.defineProperties(g,{[qp]:{value:i.signal,enumerable:!0},signal:{enumerable:!0,get:()=>(this.#c=!0,i.signal)}})},l=()=>{const g=kw(this.options,r),y=(()=>{const x={client:this.#i,queryKey:this.queryKey,meta:this.meta};return s(x),x})();return this.#c=!1,this.options.persister?this.options.persister(g,y,this):g(y)},d=(()=>{const g={fetchOptions:r,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:l};return s(g),g})();(this.#e==="infinite"?O_(this.options.pages):this.options.behavior)?.onFetch(d,this),this.#n=this.state,(this.state.fetchStatus==="idle"||this.state.fetchMeta!==d.fetchOptions?.meta)&&this.#o({type:"fetch",meta:d.fetchOptions?.meta});const f=this.#a=Cw({initialPromise:r?.initialPromise,fn:d.fetchFn,onCancel:g=>{g instanceof rp&&g.revert&&this.setState({...this.#n,fetchStatus:"idle"}),i.abort()},onFail:(g,v)=>{this.#o({type:"failed",failureCount:g,error:v})},onPause:()=>{this.#o({type:"pause"})},onContinue:()=>{this.#o({type:"continue"})},retry:d.options.retry,retryDelay:d.options.retryDelay,networkMode:d.options.networkMode,canRun:()=>!0}),m=(async()=>{try{const g=await f.promise;if(g===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(g),this.#r.config.onSuccess?.(g,this),this.#r.config.onSettled?.(g,this.state.error,this),g}catch(g){if(g instanceof rp){if(g.silent){if(this.#a!==f&&this.#s)return this.#s;throw g}else if(g.revert){if(this.state.data===void 0)throw g;return this.state.data}}throw this.#o({type:"error",error:g}),this.#r.config.onError?.(g,this),this.#r.config.onSettled?.(this.state.data,g,this),g}finally{this.#a===f&&(this.#a=void 0,this.#s=void 0),this.scheduleGc()}})();return this.#s=m,f.start(),m}#o(e){const r=i=>{switch(e.type){case"failed":return{...i,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...i,fetchStatus:"paused"};case"continue":return{...i,fetchStatus:"fetching"};case"fetch":return{...i,...Rw(i.data,this.options),fetchMeta:e.meta??null};case"success":const s={...i,...cx(e.data,e.dataUpdatedAt),dataUpdateCount:i.dataUpdateCount+1,...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return this.#n=e.manual?s:void 0,s;case"error":const l=e.error;return{...i,error:l,errorUpdateCount:i.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:i.fetchFailureCount+1,fetchFailureReason:l,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...i,isInvalidated:!0};case"setState":return{...i,...e.state}}};this.state=r(this.state),bn.batch(()=>{this.observers.slice().forEach(i=>{i.onQueryUpdate()}),this.#r.notify({query:this,type:"updated",action:e})})}};function Rw(e,r){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Nw(r.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function cx(e,r){return{data:e,dataUpdatedAt:r??Date.now(),error:null,isInvalidated:!1,status:"success"}}function ux(e){const r=typeof e.initialData=="function"?e.initialData():e.initialData,i=r!==void 0,s=i?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:r,dataUpdateCount:0,dataUpdatedAt:i?s??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:i?"success":"pending",fetchStatus:"idle"}}var D_=class extends Fl{#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#s;#l;#c;#o;#d;#f;#u;#m=new Set;constructor(e,r){super(),this.options=r,this.#e=e,this.#s=null,this.bindMethods(),this.setOptions(r)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),dx(this.#t,this.options)?this.#h():this.updateResult(),this.#b())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return ap(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return ap(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#x(),this.#w(),this.#t.removeObserver(this)}setOptions(e){const r=this.options,i=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Nt(this.options.enabled,this.#t)!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#S(),this.#t.setOptions(this.options),r._defaulted&&!ym(this.options,r)&&this.#e.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#t,observer:this});const s=this.hasListeners();s&&fx(this.#t,i,this.options,r)&&this.#h(),this.updateResult(),s&&(this.#t!==i||Nt(this.options.enabled,this.#t)!==Nt(r.enabled,this.#t)||Nt(this.options.staleTime,this.#t)!==Nt(r.staleTime,this.#t))&&this.#g();const l=this.#y();s&&(this.#t!==i||Nt(this.options.enabled,this.#t)!==Nt(r.enabled,this.#t)||l!==this.#u)&&this.#v(l)}getOptimisticResult(e){const r=this.#e.getQueryCache().build(this.#e,e),i=this.createResult(r,e);return ym(this.getCurrentResult(),i)||(this.#r=i,this.#a=this.options,this.#i=this.#t.state),i}getCurrentResult(){return this.#r}trackResult(e,r){return new Proxy(e,{get:(i,s)=>(this.trackProp(s),r?.(s),Reflect.get(i,s))})}trackProp(e){this.#m.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const r=this.#e.defaultQueryOptions(e),i=this.#e.getQueryCa)DELIM" +R"DELIM(che().build(this.#e,r);let s=()=>{},l;const c=new Promise(d=>{l=d,s=this.#e.getQueryCache().subscribe(f=>{f.type==="updated"&&f.query.queryHash===i.queryHash&&i.state.data!==void 0&&(s(),d(this.createResult(i,r)))})});return Promise.race([i.fetch(r).then(()=>{const d=this.createResult(i,r);return l?.(d),d}).finally(()=>{s()}),c])}fetch(e){return this.#h({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#h(e){this.#S();let r=this.#t.fetch(this.options,e);return e?.throwOnError||(r=r.catch($n)),r}#p(e){return!Zp()&&Nt(this.options.enabled,this.#t)!==!1&&ww(e)}#g(){this.#x();const e=Nt(this.options.staleTime,this.#t);if(this.#r.isStale||!this.#p(e))return;const r=Sw(this.#r.dataUpdatedAt,e)+1;this.#d=Fi.setTimeout(()=>{this.#r.isStale||this.updateResult()},r)}#y(){return Nt(this.options.refetchInterval,this.#t)??!1}#v(e){this.#w(),this.#u=e,!(this.#u===0||!this.#p(this.#u))&&(this.#f=Fi.setInterval(()=>{(this.options.refetchIntervalInBackground||Ip.isFocused())&&this.#h()},this.#u))}#b(){this.#g(),this.#v(this.#y())}#x(){this.#d!==void 0&&(Fi.clearTimeout(this.#d),this.#d=void 0)}#w(){this.#f!==void 0&&(Fi.clearInterval(this.#f),this.#f=void 0)}createResult(e,r){const i=this.#t,s=this.options,l=this.#r,c=this.#i,d=this.#a,f=e!==i?e.state:this.#n,{state:m}=e;let g={...m},v=!1,y;if(r._optimisticResults){const K=this.hasListeners(),oe=!K&&dx(e,r),R=K&&fx(e,i,r,s);(oe||R)&&(g={...g,...Rw(m.data,e.options)}),r._optimisticResults==="isRestoring"&&(g.fetchStatus="idle")}let{error:x,errorUpdatedAt:w,status:E}=g;y=g.data;let _=!1;if(r.placeholderData!==void 0&&y===void 0&&E==="pending"){let K;l?.isPlaceholderData&&r.placeholderData===d?.placeholderData?(K=l.data,_=!0):K=typeof r.placeholderData=="function"?r.placeholderData(this.#o?.state.data,this.#o):r.placeholderData,K!==void 0&&(E="success",y=np(l?.data,K,r),v=!0)}if(r.select&&y!==void 0&&!_)if(l&&y===c?.data&&r.select===this.#l)y=this.#c;else try{this.#l=r.select,y=r.select(y),y=np(l?.data,y,r),this.#c=y,this.#s=null}catch(K){this.#s=K}else y===void 0&&(this.#s=null);this.#s&&(x=this.#s,y=this.#c,w=l?.error===x?l.errorUpdatedAt:Date.now(),E="error",v=!1);const N=g.fetchStatus==="fetching",H=E==="pending",O=E==="error",se=H&&N,ce=y!==void 0;return{status:E,fetchStatus:g.fetchStatus,isPending:H,isSuccess:E==="success",isError:O,isInitialLoading:se,isLoading:se,data:y,dataUpdatedAt:g.dataUpdatedAt,error:x,errorUpdatedAt:w,failureCount:g.fetchFailureCount,failureReason:g.fetchFailureReason,errorUpdateCount:g.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:g.dataUpdateCount>f.dataUpdateCount||g.errorUpdateCount>f.errorUpdateCount,isFetching:N,isRefetching:N&&!H,isLoadingError:O&&!ce,isPaused:g.fetchStatus==="paused",isPlaceholderData:v,isRefetchError:O&&ce,isStale:Fp(e,r),refetch:this.refetch,isEnabled:Nt(r.enabled,e)!==!1}}updateResult(){const e=this.#r,r=this.createResult(this.#t,this.options);if(this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#o=this.#t),ym(r,e))return;this.#r=r;const s=(()=>{if(!e)return!0;const{notifyOnChangeProps:l}=this.options,c=typeof l=="function"?l():l;if(c==="all"||!c&&!this.#m.size||this.options.throwOnError&&this.#r.error!==e.error)return!0;for(const d of c??this.#m)if(this.#r[d]!==e[d])return!0;return!1})();bn.batch(()=>{s&&this.listeners.forEach(l=>{l(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:"observerResultsUpdated"})})}#S(){const e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;const r=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(r?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#b()}};function B_(e,r){return Nt(r.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&Nt(r.retryOnMount,e)===!1)}function dx(e,r){return B_(e,r)||e.state.data!==void 0&&ap(e,r,r.refetchOnMount)}function ap(e,r,i){if(Nt(r.enabled,e)!==!1&&Nt(r.staleTime,e)!=="static"){const s=Nt(i,e);return s==="always"||s!==!1&&Fp(e,r)}return!1}function fx(e,r,i,s){return(e!==r||Nt(s.enabled,e)===!1)&&(!i.suspense||e.state.status!=="error")&&Fp(e,i)}function Fp(e,r){return Nt(r.enabled,e)!==!1&&e.isStaleByTime(Nt(r.staleTime,e))}var L_=class extends jw{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||U_(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(r=>r!==e),this.scheduleGc(),this.#n.notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status==="pending"?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??(this.state.status==="pending"?this.execute(this.state.variables):Promise.resolve())}async execute(e){const r=()=>{this.#i({type:"continue"})},i={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey},s=this.#r=Cw({fn:()=>this.options.mutationFn?this.options.mutationFn(e,i):Promise.reject(new Error("No mutationFn found")),onFail:(d,f)=>{this.#i({type:"failed",failureCount:d,error:f})},onPause:()=>{this.#i({type:"pause"})},onContinue:r,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)}),l=this.state.status==="pending",c=!s.canStart();try{if(l)r();else{this.#i({type:"pending",variables:e,isPaused:c}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,i);const f=await this.options.onMutate?.(e,i);f!==this.state.context&&this.#i({type:"pending",context:f,variables:e,isPaused:c})}this.state.isPaused&&s.canStart()&&r();const d=await s.start();return await this.#n.config.onSuccess?.(d,e,this.state.context,this,i),await this.options.onSuccess?.(d,e,this.state.context,i),await this.#n.config.onSettled?.(d,null,this.state.variables,this.state.context,this,i),await this.options.onSettled?.(d,null,e,this.state.context,i),this.#i({type:"success",data:d}),d}catch(d){try{await this.#n.config.onError?.(d,e,this.state.context,this,i)}catch(f){Promise.reject(f)}try{await this.options.onError?.(d,e,this.state.context,i)}catch(f){Promise.reject(f)}try{await this.#n.config.onSettled?.(void 0,d,this.state.variables,this.state.context,this,i)}catch(f){Promise.reject(f)}try{await this.options.onSettled?.(void 0,d,e,this.state.context,i)}catch(f){Promise.reject(f)}throw this.#i({type:"error",error:d}),d}finally{this.#r===s&&(this.#r=void 0),this.#n.runNext(this)}}#i(e){const r=i=>{switch(e.type){case"failed":return{...i,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...i,isPaused:!0};case"continue":return{...i,isPaused:!1};case"pending":return{...i,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...i,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...i,data:void 0,error:e.error,failureCount:i.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}};this.state=r(this.state),bn.batch(()=>{this.#t.forEach(i=>{i.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:"updated",action:e})})}};function U_(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var H_=class extends Fl{#e;#t;#n;constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}build(e,r,i){const s=new L_({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(r),state:i});return this.add(s),s}add(e){this.#e.add(e);const r=Nu(e);if(typeof r=="string"){const i=this.#t.get(r);)DELIM" +R"DELIM(i?i.push(e):this.#t.set(r,[e])}this.notify({type:"added",mutation:e})}remove(e){if(this.#e.delete(e)){const r=Nu(e);if(typeof r=="string"){const i=this.#t.get(r);if(i)if(i.length>1){const s=i.indexOf(e);s!==-1&&i.splice(s,1)}else i[0]===e&&this.#t.delete(r)}}this.notify({type:"removed",mutation:e})}canRun(e){const r=Nu(e);if(typeof r=="string"){const i=this.#t.get(r)?.find(s=>s.state.status==="pending");return!i||i===e}else return!0}runNext(e){const r=Nu(e);return typeof r=="string"?this.#t.get(r)?.find(i=>i!==e&&i.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){bn.batch(()=>{const e=this.getAll();this.#e.clear(),this.#t.clear(),e.forEach(r=>{this.notify({type:"removed",mutation:r})})})}getAll(){return Array.from(this.#e)}find(e){const r={exact:!0,...e};return this.getAll().find(i=>ix(r,i))}findAll(e={}){return this.getAll().filter(r=>ix(e,r))}notify(e){bn.batch(()=>{this.listeners.forEach(r=>{r(e)})})}resumePausedMutations(){const e=this.getAll().filter(r=>r.state.isPaused);return bn.batch(()=>Promise.all(e.map(r=>r.continue().catch($n))))}};function Nu(e){return e.options.scope?.id}var P_=class extends Fl{#e;constructor(e={}){super(),this.config=e,this.#e=new Map}build(e,r,i){const s=r.queryKey,l=r.queryHash??Pp(s,r);let c=this.get(l);return c||(c=new z_({client:e,queryKey:s,queryHash:l,options:e.defaultQueryOptions(r),state:i,defaultOptions:e.getQueryDefaults(s)}),this.add(c)),c}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){this.#e.get(e.queryHash)===e&&(e.destroy(),this.#e.delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){bn.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){const r={exact:!0,...e};return this.getAll().find(i=>ax(r,i))}findAll(e={}){const r=this.getAll();return Object.keys(e).length>0?r.filter(i=>ax(e,i)):r}notify(e){bn.batch(()=>{this.listeners.forEach(r=>{r(e)})})}onFocus(){bn.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){bn.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},$_=class{#e;#t;#n;#r;#i;#a;#s;#l;constructor(e={}){this.#e=e.queryCache||new P_,this.#t=e.mutationCache||new H_,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#s=Ip.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#l=id.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#s?.(),this.#s=void 0,this.#l?.(),this.#l=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return this.#t.findAll({...e,status:"pending"}).length}getQueryData(e){const r=this.defaultQueryOptions({queryKey:e});return this.#e.get(r.queryHash)?.state.data}ensureQueryData(e){const r=this.defaultQueryOptions(e),i=this.#e.build(this,r),s=i.state.data;return s===void 0?this.fetchQuery(e):(e.revalidateIfStale&&i.isStaleByTime(Nt(r.staleTime,i))&&this.prefetchQuery(r),Promise.resolve(s))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:r,state:i})=>[r,i.data])}setQueryData(e,r,i){const s=this.defaultQueryOptions({queryKey:e}),l=this.#e.get(s.queryHash)?.state.data,c=w_(r,l);if(c!==void 0)return this.#e.build(this,s).setData(c,{...i,manual:!0})}setQueriesData(e,r,i){return bn.batch(()=>this.#e.findAll(e).map(({queryKey:s})=>[s,this.setQueryData(s,r,i)]))}getQueryState(e){const r=this.defaultQueryOptions({queryKey:e});return this.#e.get(r.queryHash)?.state}removeQueries(e){const r=this.#e;bn.batch(()=>{r.findAll(e).forEach(i=>{r.remove(i)})})}resetQueries(e,r){const i=this.#e;return bn.batch(()=>{const s=i.findAll(e),l=new Set(s);return s.forEach(c=>{c.reset()}),this.refetchQueries({type:"active",predicate:c=>l.has(c)},r)})}cancelQueries(e,r={}){const i={revert:!0,...r},s=bn.batch(()=>this.#e.findAll(e).map(l=>l.cancel(i)));return Promise.all(s).then($n).catch($n)}invalidateQueries(e,r={}){return bn.batch(()=>(this.#e.findAll(e).forEach(i=>{i.invalidate()}),e?.refetchType==="none"?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??"active"},r)))}refetchQueries(e,r={}){const i={...r,cancelRefetch:r.cancelRefetch??!0},s=bn.batch(()=>this.#e.findAll(e).filter(l=>!l.isDisabled()&&!l.isStatic()).map(l=>{let c=l.fetch(void 0,i);const d=l.state.fetchStatus==="paused";return(!i.throwOnError||d)&&(c=c.catch($n)),d?Promise.resolve():c}));return Promise.all(s).then($n)}async query(e){const r=this.defaultQueryOptions(e);r.retry===void 0&&(r.retry=!1);const i=this.#e.build(this,r),s=i.isStaleByTime(Nt(r.staleTime,i))?await i.fetch(r):i.state.data,l=r.select;return l?l(s):s}fetchQuery(e){const r=this.defaultQueryOptions(e);r.retry===void 0&&(r.retry=!1);const i=this.#e.build(this,r);return i.isStaleByTime(Nt(r.staleTime,i))?i.fetch(r):Promise.resolve(i.state.data)}prefetchQuery(e){return this.fetchQuery(e).then($n).catch($n)}infiniteQuery(e){return e._type="infinite",this.query(e)}fetchInfiniteQuery(e){return e._type="infinite",this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then($n).catch($n)}ensureInfiniteQueryData(e){return e._type="infinite",this.ensureQueryData(e)}resumePausedMutations(){return id.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,r){this.#r.set(Ll(e),{queryKey:e,defaultOptions:r})}getQueryDefaults(e){const r=[...this.#r.values()],i={};return r.forEach(s=>{ao(e,s.queryKey)&&Object.assign(i,s.defaultOptions)}),i}setMutationDefaults(e,r){this.#i.set(Ll(e),{mutationKey:e,defaultOptions:r})}getMutationDefaults(e){const r=[...this.#i.values()],i={};return r.forEach(s=>{ao(e,s.mutationKey)&&Object.assign(i,s.defaultOptions)}),i}defaultQueryOptions(e){if(e._defaulted)return e;const r={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return r.queryHash||(r.queryHash=Pp(r.queryKey,r)),r.refetchOnReconnect===void 0&&(r.refetchOnReconnect=r.networkMode!=="always"),r.throwOnError===void 0&&(r.throwOnError=!!r.suspense),!r.networkMode&&r.persister&&(r.networkMode="offlineFirst"),r.queryFn===$p&&(r.enabled=!1),r}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}};const Aw=T.createContext(!1),q_=()=>T.useContext(Aw);Aw.Provider;function Z_(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}const I_=T.createContext(Z_()),F_=()=>T.useContext(I_),V_=(e,r,i)=>{const s=i?.state.status==="error"&&typeof e.throwOnError=="function"?_w(e.throwOnError,[i.state.error,i]):e.throwOnError;(e.suspense||s)&&(r.isReset()||(e.retryOnMount=!1))},Y_=e=>{T.useEffect(()=>{e.clearReset()},[e])},G_=({result:e,errorResetBoundary:r,throwOnError:i,query:s,suspense:l})=>e.isError&&!r.isReset()&&!e.isFetching&&s&&(l&&e.data===void 0||_w(i,[e.error,s])),K_=e=>{if(e.suspense){const i=l=>l==="static"?l:Math.max(l??1e3,1e3),s=e.staleTime;e.staleTime=typeof s=="function"?(...l)=>i(s(...l)):i(s),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},Q_=(e,r)=>e?.suspense&&r.isPending,X_=(e,r,i)=>r.fetchOptimistic(e).catch(()=>{i.clearReset()});function J_(e,r,i){const s=q_(),l=F_(),c=xw(),d=c.defaultQueryOptions(e),f=c.getQueryCache().get(d.queryHash),m=e.subscribed!==!1;d._optimisticResults=s?"isRestoring":m?"optimistic":void 0,K_(d),V_(d,l,f),Y_(l);const[g]=T.useState(()=>new r(c,d)),v=g.getOptimisticResult(d);T.useEffect(()=>{g.setOptions(d)},[d,g]);const y=!s&&m;if(T.useSyncExternalStore(T.useCallback(x=>{const w=y?g.subscribe(bn.batchCalls(x)):$n;return g.updateResult(),w},[g,y]),()=>g.getCurrentResult(),()=>g.getCurrentResult()),Q_(d,v))throw X_(d,g,l);if(G_({result:v,errorResetBoundary:l,throwOnError:d.throwOnE)DELIM" +R"DELIM(rror,query:f,suspense:d.suspense}))throw v.error;return d.notifyOnChangeProps?v:g.trackResult(v)}function W_(e,r){return J_(e,D_)}function ip(e){const r=Object.values(e).filter(s=>typeof s=="number");return Object.entries(e).filter(([s,l])=>r.indexOf(+s)===-1).map(([s,l])=>l)}function hx(e,r="|"){return e.map(i=>Bw(i)).join(r)}function sp(e,r){return typeof r=="bigint"?r.toString():r}class e4{constructor(r){this._getter=r,this._value=void 0}get value(){const r=this._getter;return r!==void 0&&(this._value=r(),this._getter=void 0),this._value}}function Sd(e){return new e4(e)}function t4(e){return e==null}function Vp(e){const r=e.startsWith("^")?1:0,i=e.endsWith("$")?e.length-1:e.length;return e.slice(r,i)}function n4(e,r){const i=e/r,s=Math.round(i),l=4*Number.EPSILON*Math.max(Math.abs(i),1);return Math.abs(i-s){const f=r._zod.def.shape[c];return s?s(f,c):f}):Mw(e,c,s?s(d.value,c):d.value))}}function r4(e,r){for(const i of Reflect.ownKeys(r)){const s=Object.getOwnPropertyDescriptor(r,i);s.enumerable&&(s.get?Ow(e,i,()=>r[i]):Mw(e,i,s.value))}}function Wn(...e){const r={};for(const i of e){const s=Object.getOwnPropertyDescriptors(i);Object.assign(r,s)}return Object.defineProperties({},r)}function a4(e){return JSON.stringify(e)}function i4(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const zw="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Ul(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const s4=Sd(()=>{if(Rr.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function io(e){if(Ul(e)===!1)return!1;const r=e.constructor;if(r===void 0||typeof r!="function")return!0;const i=r.prototype;return!(Ul(i)===!1||Object.prototype.hasOwnProperty.call(i,"isPrototypeOf")===!1)}function Dw(e){return io(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}const o4=new Set(["string","number","symbol"]);function so(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function yi(e,r,i){const s=new e._zod.constr(r??e._zod.def);return(!r||i?.parent)&&(s._zod.parent=e),s}function Re(e){const r=e;if(!r)return{};if(typeof r=="string")return{error:()=>r};if(r?.message!==void 0){if(r?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");r.error=r.message}return delete r.message,typeof r.error=="string"?{...r,error:()=>r.error}:r}function Bw(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function l4(e){return Object.keys(e).filter(r=>e[r]._zod.optin!==void 0&&e[r]._zod.optout==="optional")}const Lw={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]},c4={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function u4(e,r){const i=e._zod.def,s=i.checks;if(s&&s.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const c={};return Ki(c,e,Ed(e,r)),yi(e,Wn(i,{shape:c,checks:[]}))}function Ed(e,r){const i=wa(e),s=[];for(const l of Reflect.ownKeys(r)){if(!Object.getOwnPropertyDescriptor(i,l)?.enumerable)throw new Error(`Unrecognized key: "${String(l)}"`);r[l]&&s.push(l)}return s}function d4(e,r){const i=e._zod.def,s=i.checks;if(s&&s.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const c=new Set(Ed(e,r)),d={};return Ki(d,e,Reflect.ownKeys(wa(e)).filter(f=>!c.has(f))),yi(e,Wn(i,{shape:d,checks:[]}))}function f4(e,r){if(!io(r))throw new Error("Invalid input to extend: expected a plain object");const i=e._zod.def.checks;if(i&&i.length>0){const l=wa(e);for(const c of Reflect.ownKeys(r))if(Object.getOwnPropertyDescriptor(l,c)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return yi(e,Wn(e._zod.def,{shape:Uw(e,r)}))}function Uw(e,r){const i={};return Ki(i,e,Reflect.ownKeys(wa(e))),r4(i,r),i}function h4(e,r){if(!io(r))throw new Error("Invalid input to safeExtend: expected a plain object");return yi(e,Wn(e._zod.def,{shape:Uw(e,r)}))}function m4(e,r){if(!r?._zod?.def)throw new Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");const i={};Ki(i,e,Reflect.ownKeys(wa(e))),Ki(i,r,Reflect.ownKeys(wa(r)));const s=Wn(e._zod.def,{shape:i,get catchall(){return r._zod.def.catchall},checks:r._zod.def.checks??[]});return yi(e,s)}function mx(e,r,i,s="partial"){const c=r._zod.def.checks;if(c&&c.length>0)throw new Error(`.${s}() cannot be used on object schemas containing refinements`);const f=i?new Set(Ed(r,i)):void 0,m={};return Ki(m,r,Reflect.ownKeys(wa(r)),e&&((g,v)=>f&&!f.has(v)?g:new e({type:"optional",innerType:g}))),yi(r,Wn(r._zod.def,{shape:m,checks:[]}))}function p4(e,r,i){const s=i?new Set(Ed(r,i)):void 0,l={};return Ki(l,r,Reflect.ownKeys(wa(r)),(c,d)=>s&&!s.has(d)?c:new e({type:"nonoptional",innerType:c})),yi(r,Wn(r._zod.def,{shape:l}))}function ba(e,r=0){if(e.aborted===!0)return!0;for(let i=r;i{var s;return(s=i).path??(s.path=[]),i.path.unshift(e),i})}function hl(e){return typeof e=="string"?e:e?.message}function px(e){const r=[];for(const i of e??[]){const s=i._zod.def;if(!/_(length|size)$|_equals$/.test(s.check))break;const l=s.maximum??s.length??s.size;l>=0&&r.push([l,i])}return r}function op(e,r,i){var s;for(let l=r;le;return r[T4]=!0,r}var gx;const bm={value:void 0,enumerable:!1};let yx="captureStackTrace"in Error?Error:null;function _4(e){const r=yx;if(r){const i=r.stackTraceLimit;if(typeof i=="number"){try{r.stackTraceLimit=0}catch{return yx=null,new e}try{return new e}finally{r.stackTraceLimit=i}}}return new e}function ae(e,r,i,s){const l={};function c(x){this.def=x,this.constr=y,this.traits=new Set}c.prototype=l;const d=i,f=d&&new WeakSet;function m(x,w){if(x._zod){if(x._zod.traits.has(e))return}else{bm.value=new c(w);try{Object.defineProperty(x,"_zod",bm)}finally{bm.value=void 0}}if(x._zod.traits.add(e),r(x,w),f){const _=Object.getPrototypeOf(x),N=x._zod.constr.prototype;let H=_;for(;H&&H!==N;)H=Object.getPrototypeOf(H);const O=H??_;f.has(O)||(f.add(O),b4(O,d))}const E=y.prototype;for(const _ in E)Object.prototype.hasOwnProperty.call(E,_)&&(_ in x||(x[_]=E[_].bind(x)))}const g=s?.Parent??Object;class v extends g{}Object.defineProperty(v,"name",{value:e});function y(x){const w=s?.Parent?_4(v):this;m(w,x);const E=w._zod.deferred;if(E){for(const N of E)N();w._zod.deferred=void 0}const _=globalThis.__zod_globalConfig?.postProcessor;return _&&_(w),w}return Object.defineProperty(y,"init",{value:m}),Object.defineProperty(y,Symbol.hasInstance,{value:x=>s?.Parent&&x instanceof s.Parent?!0:x?._zod?.traits?.has(e)}),Object.defineProperty(y,"name",{value:e}),y}class Gi extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class $w extends Error{constructor(r){super(`Encountered unidirectional transform during encode: ${r}`),this.name="ZodEncodeError"}}(gx=globalThis).__zod_globalConfig??(gx.__zod_globalConfig={});const Rr=globalThis.__zod_globalConfig;function ea(e){return e&&Object.assign(Rr,e),Rr}function N4(){const e=this._zod;return e.message??(e.message=JSON.stringify(e.def,sp,2)),e.message}function C4(e){this._zod.message=e}const j4={get:N4,set:C4,enumerable:!0,configurable:!0},xm={value:void 0,enumerable:!1},vx=new WeakSet([Object.prototype,Error.prototype]),R4=(e,r)=>{e.name="$ZodError",xm.value=r,Object.defineProperty(e,"issues",xm),xm.value=void 0,Object.defineProperty(e,"message",j4);const i=Object.getPrototypeOf(e);vx.has(i)||(vx.add(i),Object.defineProperty(i,"toString",{configurable:!0,enumerable:!1,get(){const s=()=>this.message;return Object.defineProperty(this,"toString",{value:s,configurable:!0,writable:!0}),s},set(s){Object.defineProperty(this,"toString",{value:s,configurable:!0,writable:!0})}}))},A4=ae("$ZodError",R4);function O4(e,r,i){return Object.prototype.hasOwnProperty.call(e,r)||(r==="__proto__"?Object.defineProperty(e,r,{value:i(),writable:!0,enumerable:!0,configurable:!0}):e[r]=i()),e[r]}function M4(e,r=i=>i.message){const i={},s=[];for(const l of e.issues)l.path.length>0?O4(i,l.path[0],()=>[]).push(r(l)):s.push(r(l));return{formErrors:s,fieldErrors:i}}function z4(e,r=i=>i.message){const i={_errors:[]},s=(l,c=[])=>{for(const d of l.issues)if(d.code==="invalid_union"&&d.errors.length)d.errors.map(f=>s({issues:f},[...c,...d.path]));else if(d.code==="invalid_key")s({issues:d.issues},[...c,...d.path]);else if(d.code==="invalid_element")s({issues:d.issues},[...c,...d.path]);else{const f=[...c,...d.path];if(f.length===0)i._errors.push(r(d));else{let m=i,g=0;for(;g{const r=(i,s,l,c)=>{const d=l?{...l,async:!1}:{async:!1},f=i._zod.run({value:s,issues:[]},d);if(f instanceof Promise)throw new Gi;if(f.issues.length){const m=new(c?.Err??e)(f.issues.map(g=>mi(g,d,ea())));throw zw(m,c?.callee??r),m}return f.value};return r},Xp=e=>{const r=async(i,s,l,c)=>{const d=l?{...l,async:!0}:{async:!0};let f=i._zod.run({value:s,issues:[]},d);if(f instanceof Promise&&(f=await f),f.issues.length){const m=new(c?.Err??e)(f.issues.map(g=>mi(g,d,ea())));throw zw(m,c?.callee??r),m}return f.value};return r},Jp=e=>(r,i,s)=>{const l=s?{...s,async:!1}:{async:!1},c=r._zod.run({value:i,issues:[]},l);if(c instanceof Promise)throw new Gi;return c.issues.length?qw(e,c.issues,l):{success:!0,data:c.value}};function qw(e,r,i){let s;return{success:!1,get error(){return s||(s=new e(r.map(l=>mi(l,i,ea()))),r=void 0,i=void 0),s},set error(l){s=l,r=void 0,i=void 0}}}const Wp=e=>async(r,i,s)=>{const l=s?{...s,async:!0}:{async:!0};let c=r._zod.run({value:i,issues:[]},l);return c instanceof Promise&&(c=await c),c.issues.length?qw(e,c.issues,l):{success:!0,data:c.value}},D4=Symbol.for("zod.compile.invalid"),B4=Symbol.for("zod.compile.fallback"),L4=((e,r,i)=>{const s=e._zod.bag.validator;if(s!==void 0){if(s(r)!==D4)return!0;if(s.definite===!0&&i===void 0)return!1}return U4(e,r,i)});function U4(e,r,i){const s=i?{...i,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},l=e._zod.bag.fallbackRun;let c;if(l?(s[B4]=!0,c=l({value:r,issues:[]},s)):c=e._zod.run({value:r,issues:[]},s),c instanceof Promise)throw new Gi;return c.issues.length===0}const H4=async(e,r,i)=>{const s=i?{...i,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0};let l=e._zod.run({value:r,issues:[]},s);return l instanceof Promise&&(l=await l),l.issues.length===0},P4=e=>{const r=Qp(e),i=(s,l,c,d)=>{const f=c?{...c,direction:"backward"}:{direction:"backward"};return r(s,l,f,Td(i,d))};return i},$4=e=>{const r=Qp(e),i=(s,l,c,d)=>r(s,l,c,Td(i,d));return i},q4=e=>{const r=Xp(e),i=async(s,l,c,d)=>{const f=c?{...c,direction:"backward"}:{direction:"backward"};return await r(s,l,f,Td(i,d))};return i},Z4=e=>{const r=Xp(e),i=async(s,l,c,d)=>await r(s,l,c,Td(i,d));return i},I4=e=>(r,i,s)=>{const l=s?{...s,direction:"backward"}:{direction:"backward"};return Jp(e)(r,i,l)},F4=e=>(r,i,s)=>Jp(e)(r,i,s),V4=e=>async(r,i,s)=>{const l=s?{...s,direction:"backward"}:{direction:"backward"};return Wp(e)(r,i,l)},Y4=e=>async(r,i,s)=>Wp(e)(r,i,s),G4=/^[cC][0-9a-z]{6,}$/,K4=/^[0-9a-z]+$/,Q4=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,X4=/^[0-9a-vA-V]{20}$/,J4=/^[A-Za-z0-9]{27}$/,W4=/^[a-zA-Z0-9_-]{21}$/;function eN(e){return new RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}const tN=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,nN=/^([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})$/,bx=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}-[89)DELIM" +R"DELIM(abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,rN=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,aN="^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$";function iN(){return new RegExp(aN,"u")}const sN=/^(?:(?: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])$/,oN=/^(([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}|:))$/,lN=/^((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])$/,cN=/^(([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}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,uN=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,dN=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/,fN=/^https?$/,hN=/^\+[1-9]\d{6,14}$/,Zw="(?:(?:\\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])))";function mN(e){return new RegExp(`^${e}$`)}const pN=mN(Zw);function lp(e){const r="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${r}`:e.precision===0?`${r}:[0-5]\\d`:`${r}:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?`${r}:[0-5]\\d(?:\\.\\d+)?`:`${r}(?::[0-5]\\d(?:\\.\\d+)?)?`}function gN(e){return new RegExp(`^${lp(e)}$`)}function yN(e){const r=["Z"];e.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const i=`${lp({precision:e.precision,seconds:!0})}(?:${r.join("|")})`,s=e.local?`${i}|${lp({precision:e.precision})}`:i;return new RegExp(`^${Zw}T(?:${s})$`)}const vN=/^[\s\S]{0,}$/,bN=/^-?\d+$/,eg=/^-?\d+(?:\.\d+)?$/,xN=/^(?:true|false)$/i,wN=/^[^A-Z]*$/,SN=/^[^a-z]*$/,qn=ae("$ZodCheck",(e,r)=>{var i;e._zod??(e._zod={}),e._zod.def=r,(i=e._zod).onattach??(i.onattach=[])}),tg=e=>{const r=e.value;return!t4(r)&&r.length!==void 0},sd={number:"number",bigint:"bigint",object:"date"},Iw=ae("$ZodCheckLessThan",(e,r)=>{qn.init(e,r);const i=sd[typeof r.value];e._zod.check=s=>{(r.inclusive?s.value<=r.value:s.value{qn.init(e,r);const i=sd[typeof r.value];e._zod.check=s=>{(r.inclusive?s.value>=r.value:s.value>r.value)||s.issues.push({origin:sd[typeof s.value]??i,code:"too_small",minimum:typeof r.value=="object"?r.value.getTime():r.value,input:s.value,inclusive:r.inclusive,inst:e,continue:!r.abort})}}),EN=ae("$ZodCheckMultipleOf",(e,r)=>{qn.init(e,r),e._zod.check=i=>{if(typeof i.value!=typeof r.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof i.value=="bigint"?r.value!==BigInt(0)&&i.value%r.value===BigInt(0):n4(i.value,r.value)===0)||i.issues.push({origin:typeof i.value,code:"not_multiple_of",divisor:r.value,input:i.value,inst:e,continue:!r.abort})}}),TN=ae("$ZodCheckNumberFormat",(e,r)=>{qn.init(e,r),r.format=r.format||"float64";const i=r.format?.includes("int"),s=i?"int":"number",[l,c]=Lw[r.format];e._zod.check=d=>{const f=d.value;if(i){if(!Number.isInteger(f)){d.issues.push({expected:s,format:r.format,code:"invalid_type",continue:!1,input:f,inst:e});return}if(!Number.isSafeInteger(f)){f>0?d.issues.push({input:f,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:s,inclusive:!0,continue:!r.abort}):d.issues.push({input:f,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:s,inclusive:!0,continue:!r.abort});return}}fc&&d.issues.push({origin:"number",input:f,code:"too_big",maximum:c,inclusive:!0,inst:e,continue:!r.abort})}}),kN=ae("$ZodCheckMaxLength",(e,r)=>{var i;qn.init(e,r),(i=e._zod.def).when??(i.when=tg),e._zod.check=s=>{const l=s.value,c=l.length;if((typeof l=="string"&&c>r.maximum?Gp(l):c)<=r.maximum)return;const f=Kp(l);s.issues.push({origin:f,code:"too_big",maximum:r.maximum,inclusive:!0,input:l,inst:e,continue:!r.abort})}}),_N=ae("$ZodCheckMinLength",(e,r)=>{var i;qn.init(e,r),(i=e._zod.def).when??(i.when=tg),e._zod.check=s=>{const l=s.value,c=l.length;if((typeof l=="string"&&c>=r.minimum&&c=r.minimum)return;const f=Kp(l);s.issues.push({origin:f,code:"too_small",minimum:r.minimum,inclusive:!0,input:l,inst:e,continue:!r.abort})}}),NN=ae("$ZodCheckLengthEquals",(e,r)=>{var i;qn.init(e,r),(i=e._zod.def).when??(i.when=tg),e._zod.check=s=>{const l=s.value,c=l.length,d=typeof l=="string"&&c>=r.length&&c<=r.length*2?Gp(l):c;if(d===r.length)return;const f=Kp(l),m=d>r.length;s.issues.push({origin:f,...m?{code:"too_big",maximum:r.length}:{code:"too_small",minimum:r.length},inclusive:!0,exact:!0,input:s.value,inst:e,continue:!r.abort})}}),kd=ae("$ZodCheckStringFormat",(e,r)=>{var i,s;qn.init(e,r),r.pattern?(i=e._zod).check??(i.check=l=>{r.pattern.lastIndex=0,!r.pattern.test(l.value)&&l.issues.push({origin:"string",code:"invalid_format",format:r.format,input:l.value,...r.pattern?{pattern:r.pattern.toString()}:{},inst:e,continue:!r.abort})}):(s=e._zod).check??(s.check=()=>{})}),CN=ae("$ZodCheckRegex",(e,r)=>{kd.init(e,r),e._zod.check=i=>{r.pattern.lastIndex=0,!r.pattern.test(i.value)&&i.issues.push({origin:"string",code:"invalid_format",format:"regex",input:i.value,pattern:r.pattern.toString(),inst:e,continue:!r.abort})}}),jN=ae("$ZodCheckLowerCase",(e,r)=>{r.pattern??(r.pattern=wN),kd.init(e,r)}),RN=ae("$ZodCheckUpperCase",(e,r)=>{r.pattern??(r.pattern=SN),kd.init(e,r)}),AN=ae("$ZodCheckIncludes",(e,r)=>{qn.init(e,r);const i=so(r.includes),s=new RegExp(typeof r.position=="number"?`^.{${r.position},}${i}`:i);r.pattern=s,e._zod.check=l=>{l.value.includes(r.includes,r.position)||l.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:r.includes,input:l.value,inst:e,continue:!r.abort})}}),ON=ae("$ZodCheckStartsWith",(e,r)=>{qn.init(e,r);const i=new RegExp(`^${so(r.prefix)}.*`);r.pattern??(r.pattern=i),e._zod.check=s=>{s.value.startsWith(r.prefix)||s.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:r.prefix,input:s.value,inst:e,continue:!r.abort})}}),MN=ae("$ZodCheckEndsWith",(e,r)=>{qn.init(e,r);const i=new RegExp(`.*${so(r.suffix)}$`);r.pattern??(r.pattern=i),e._zod.check=s=>{s.value.endsWith(r.suffix)||s.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:r.suffix,input:s.value,inst:e,continue:!r.abort})}}),zN=ae("$ZodCheckOverwrite",(e,r)=>{qn.init(e,r),e._zod.check=i=>{i.value=r.tx(i.value)}});class DN{constructor(r=[],i={}){this.content=[],this.indent=0,this.args=r,this.closed=i}indented(r){this.indent+=1;try{r(this)}finally{this.indent-=1}}write(r){if(typeof r=="function"){r(this,{execution:"sync"}),r(this,{execution:"async"});return}const s=r.split(` `).filter(d=>d),l=Math.min(...s.map(d=>d.length-d.trimStart().length)),c=s.map(d=>d.slice(l)).map(d=>" ".repeat(this.indent*2)+d);for(const d of c)this.content.push(d))DELIM" R"DELIM(}compile(){const r=Function,i=this?.content??[""];return new r(...Object.keys(this.closed),`return function (${this.args.join(", ")}) { ${i.join(` `)} -};`)(...Object.values(this.closed))}}const BN={major:4,minor:6,patch:7},Ot=ae("$ZodType",(e,r)=>{var i;e??(e={}),e._zod.def=r,e._zod.bag=e._zod.bag||{},e._zod.version=BN;const s=e._zod.def.checks,l=e._zod.traits.has("$ZodCheck")?[e,...s??[]]:s?.length?[...s]:[];for(const c of l)for(const d of c._zod.onattach)d(e);if(l.length===0)(i=e._zod).deferred??(i.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const c=(f,m,g)=>{if(f.memo)return f;let v=va(f),y;for(const x of m){if(x._zod.def.when){if(g4(f)||!x._zod.def.when(f))continue}else if(v)continue;const w=f.issues.length,E=x._zod.check(f);if(E instanceof Promise&&g?.async===!1)throw new Gi;if(y||E instanceof Promise)y=(y??Promise.resolve()).then(async()=>{await E,f.issues.length!==w&&(op(f.issues,w,e),v||(v=va(f,w)))});else{if(f.issues.length===w)continue;op(f.issues,w,e),v||(v=va(f,w))}}return y?y.then(()=>f):f},d=(f,m,g)=>{if(va(f))return f.aborted=!0,f;const v=c(m,l,g);if(v instanceof Promise){if(g.async===!1)throw new Gi;return v.then(y=>e._zod.parse(y,g))}return e._zod.parse(v,g)};e._zod.run=(f,m)=>{if(m.skipChecks)return e._zod.parse(f,m);if(m.direction==="backward"){const v=e._zod.parse({value:f.value,issues:[]},{...m,skipChecks:!0});return v instanceof Promise?v.then(y=>d(y,f,m)):d(v,f,m)}const g=e._zod.parse(f,m);if(g instanceof Promise){if(m.async===!1)throw new Gi;return g.then(v=>c(v,l,m))}return c(g,l,m)}}},{get"~standard"(){return Pw(this,"~standard",Gw(this))},set"~standard"(e){pi(this,"~standard",e)}}),Yw=(e,r)=>e.issues.length?{issues:e.issues.map(i=>mi(i,r,Wr()))}:{value:e.value};async function LN(e,r){const i={async:!0};return Yw(await e._zod.run({value:r,issues:[]},i),i)}function Gw(e){return{validate:r=>{const i={async:!1};try{const s=e._zod.run({value:r,issues:[]},i);if(!(s instanceof Promise))return Yw(s,i)}catch{}return LN(e,r)},vendor:"zod",version:1}}const rg=ae("$ZodString",(e,r)=>{Ot.init(e,r),e._zod.pattern=r.pattern??vN,e._zod.parse=(i,s)=>{if(r.coerce)try{i.value=String(i.value)}catch{}return typeof i.value=="string"||i.issues.push({expected:"string",code:"invalid_type",input:i.value,inst:e}),i}}),jt=ae("$ZodStringFormat",(e,r)=>{kd.init(e,r),rg.init(e,r)}),UN=ae("$ZodGUID",(e,r)=>{r.pattern??(r.pattern=nN),jt.init(e,r)}),HN=ae("$ZodUUID",(e,r)=>{if(r.version){const s={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[r.version];if(s===void 0)throw new Error(`Invalid UUID version: "${r.version}"`);r.pattern??(r.pattern=xx(s))}else r.pattern??(r.pattern=xx());jt.init(e,r)}),PN=ae("$ZodEmail",(e,r)=>{r.pattern??(r.pattern=rN),jt.init(e,r)}),Kw=1,od=2;function Qw(e){try{return typeof URL<"u"&&typeof URL.canParse=="function"?URL.canParse(e):(new URL(e),!0)}catch{return!1}}function $N(e,r){return!("normalize"in r)&&!("hostname"in r)&&!("protocol"in r)?Qw(e)||od:qN(e,r)}function qN(e,r){if(!r.normalize&&r.protocol?.source===fN.source&&!/^https?:\/\//i.test(e))return Kw;try{if(typeof URL<"u"){const i=URL;if(typeof i.parse=="function")return i.parse(e)??od}return new URL(e)}catch{return od}}const ZN=/[\t\n\r]/g;function wx(e){return e.replace(ZN,"")}function IN(e,r){return r.lastIndex=0,r.test(e.hostname)}function FN(e,r){return r.lastIndex=0,r.test(e.protocol.endsWith(":")?e.protocol.slice(0,-1):e.protocol)}const VN=ae("$ZodURL",(e,r)=>{jt.init(e,r),e._zod.check=i=>{try{const s=i.value.trim(),l=$N(s,r);if(l===Kw){i.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:i.value,inst:e,continue:!r.abort});return}if(l===od){i.issues.push({code:"invalid_format",format:"url",input:i.value,inst:e,continue:!r.abort});return}if(l===!0){i.value=wx(s);return}r.hostname&&!IN(l,r.hostname)&&i.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:r.hostname.source,input:i.value,inst:e,continue:!r.abort}),r.protocol&&!FN(l,r.protocol)&&i.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:r.protocol.source,input:i.value,inst:e,continue:!r.abort}),i.value=r.normalize?l.href:wx(s);return}catch{i.issues.push({code:"invalid_format",format:"url",input:i.value,inst:e,continue:!r.abort})}}}),YN=ae("$ZodEmoji",(e,r)=>{r.pattern??(r.pattern=iN()),jt.init(e,r)}),GN=ae("$ZodNanoID",(e,r)=>{if(r.length!==void 0&&(!Number.isInteger(r.length)||r.length<1))throw new Error(`Invalid nanoid length: ${r.length}`);r.pattern??(r.pattern=r.length===void 0?W4:eN(r.length)),jt.init(e,r)}),KN=ae("$ZodCUID",(e,r)=>{r.pattern??(r.pattern=G4),jt.init(e,r)}),QN=ae("$ZodCUID2",(e,r)=>{r.pattern??(r.pattern=K4),jt.init(e,r)}),XN=ae("$ZodULID",(e,r)=>{r.pattern??(r.pattern=Q4),jt.init(e,r)}),JN=ae("$ZodXID",(e,r)=>{r.pattern??(r.pattern=X4),jt.init(e,r)}),WN=ae("$ZodKSUID",(e,r)=>{r.pattern??(r.pattern=J4),jt.init(e,r)}),eC=ae("$ZodISODateTime",(e,r)=>{r.pattern??(r.pattern=yN(r)),jt.init(e,r)}),tC=ae("$ZodISODate",(e,r)=>{r.pattern??(r.pattern=pN),jt.init(e,r)}),nC=ae("$ZodISOTime",(e,r)=>{r.pattern??(r.pattern=gN(r)),jt.init(e,r)}),rC=ae("$ZodISODuration",(e,r)=>{r.pattern??(r.pattern=tN),jt.init(e,r)}),aC=ae("$ZodIPv4",(e,r)=>{r.pattern??(r.pattern=sN),jt.init(e,r)}),iC=/^[0-9a-fA-F:.]+$/;function Xw(e){return iC.test(e)?Qw(`http://[${e}]`):!1}const sC=ae("$ZodIPv6",(e,r)=>{r.pattern??(r.pattern=oN),jt.init(e,r),e._zod.check=i=>{Xw(i.value)||i.issues.push({code:"invalid_format",format:"ipv6",input:i.value,inst:e,continue:!r.abort})}}),oC=ae("$ZodCIDRv4",(e,r)=>{r.pattern??(r.pattern=lN),jt.init(e,r)});function lC(e){const r=e.split("/");if(r.length!==2)return!1;const[i,s]=r;if(!s)return!1;const l=Number(s);return`${l}`!==s||l<0||l>128?!1:Xw(i)}const cC=ae("$ZodCIDRv6",(e,r)=>{r.pattern??(r.pattern=cN),jt.init(e,r),e._zod.check=i=>{lC(i.value)||i.issues.push({code:"invalid_format",format:"cidrv6",input:i.value,inst:e,continue:!r.abort})}});function Jw(e){if(e==="")return!0;if(/\s/.test(e)||e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const Ww=/^[0-9a-zA-Z+/]*={0,2}$/,uC=ae("$ZodBase64",(e,r)=>{r.pattern??(r.pattern=Ww),jt.init(e,r),e._zod.check=i=>{Jw(i.value)||i.issues.push({code:"invalid_format",format:"base64",input:i.value,inst:e,continue:!r.abort})}}),ag=/^[A-Za-z0-9_-]*$/;function dC(e){if(!ag.test(e))return!1;const r=e.replace(/[-_]/g,s=>s==="-"?"+":"/"),i=r.padEnd(Math.ceil(r.length/4)*4,"=");return Jw(i)}const fC=ae("$ZodBase64URL",(e,r)=>{r.pattern??(r.pattern=ag),jt.init(e,r),e._zod.check=i=>{dC(i.value)||i.issues.push({code:"invalid_format",format:"base64url",input:i.value,inst:e,continue:!r.abort})}}),hC=ae("$ZodE164",(e,r)=>{r.pattern??(r.pattern=hN),jt.init(e,r)});function mC(e,r=null){try{const i=e.split(".");if(i.length!==3)return!1;const[s]=i;if(!s)return!1;const l=JSON.parse(atob(s));return!("typ"in l&&l?.typ!=="JWT"||!l.alg||r&&(!("alg"in l)||l.alg!==r))}catch{return!1}}const pC=ae("$ZodJWT",(e,r)=>{jt.init(e,r),e._zod.check=i=>{mC(i.value,r.alg)||i.issues.push({code:"invalid_format",format:"jwt",input:i.value,inst:e,continue:!r.abort})}}),eS=ae("$ZodNumber",(e,r)=>{Ot.init(e,r),e._zod.pattern=tg,e._zod.parse=(i,s)=>{if(r.coerce)try{i.value=Number(i.value)}catch{}const l=i.value;if(typeof l=="number"&&!Number.isNaN(l)&&Number.isFinite(l))return i;const c=typeof l=="number"?Number.isNaN(l)?"NaN":Number.isFinite(l)?void 0:String(l):void 0;return i.issues.push({expected:"number",code:"invalid_type",input:l,inst:e,...c?{received:c}:{}}),i}}),gC=ae("$ZodNumberFormat",(e,r)=>{TN.init(e,r),eS.init(e,r)}),yC=ae("$ZodBoolean",(e,r)=>{Ot.init(e,r),e._zod.pattern=xN,e._zod.parse=(i,s)=>{if(r.coerce)try{i.value=!!i.value}catch{}const l=i.value;return typeof l=="boolean"||i.issues.push({expected:"boolean",code:"invalid_type",input:l,inst:e}),i}}),vC=ae("$ZodUnknown",(e,r)=>{Ot.init(e,r),e._zod.parse=i=>i}),bC=ae("$ZodNever",(e,r)=>{Ot.init(e,r),e._zod.parse=(i,s)=>(i.issues.push({expected:"never",code:"invalid_type",input:i.value,inst:e}),i)});function xC(e,r)DELIM" -R"DELIM(){const i=gx(e._zod.def.checks);if(!i.length)return;const s=Math.min(...i.map(c=>c[0])),l=e._zod.parse;e._zod.parse=(c,d)=>{const f=r(c.value);if(f>s&&!d?.skipChecks&&d?.direction!=="backward"){for(const[m,g]of gx(e._zod.def.checks))if(f>m&&g._zod.def.when(c)){const v=c.issues.length;return g._zod.check(c),c.issues[v].continue=!1,op(c.issues,v,e),c}}return l(c,d)}}const wC=e=>Array.isArray(e)?e.length:-1;function Sx(e,r,i){e.issues.length&&r.issues.push(...Ks(i,e.issues)),r.value[i]=e.value}const SC=ae("$ZodArray",(e,r)=>{Ot.init(e,r);const i=Rr.memoizer;i?.attach(e),e._zod.parse=(s,l)=>{const c=s.value;if(!Array.isArray(c))return s.issues.push({expected:"array",code:"invalid_type",input:c,inst:e}),s;s.value=i?i.alloc(e,s,Array(c.length),l):Array(c.length);const d=[],f=l?.abortEarly;for(let m=0;mSx(y,s,m)));else if(Sx(v,s,m),f&&v.issues.length!==0&&va(v))break}return d.length?Promise.all(d).then(()=>s):s},xC(e,wC)});function ld(e,r,i,s,l,c){const d=i in s,f=c==="optional";if(!(!d&&f&&l==="optional")){if(e.issues.length){if(l!==void 0&&f&&!d)return;r.issues.push(...Ks(i,e.issues))}if(!d&&l===void 0){e.issues.length||r.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[i]});return}e.value===void 0?(d||l==="defaulted"&&!f)&&(r.value[i]=void 0):r.value[i]=e.value}}const EC=[];function tS(e){const r=Object.keys(e.shape),i=Object.getOwnPropertySymbols(e.shape),s=i.length?i:EC,l=s.length?[...r,...s]:r;for(const d of l)if(!e.shape?.[d]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${String(d)}": expected a Zod schema`);const c=l4(e.shape);return{...e,allKeys:l,symbolKeys:s,keySet:new Set(r),numKeys:r.length,optionalKeys:new Set(c)}}function nS(e,r,i,s,l,c,d){const f=[],m=l.keySet,g=l.catchall._zod,v=g.def.type,y=g.optin,x=g.optout;let w=0;for(const E in r){if(d&&i.issues.length!==w){if(va(i,w))break;w=i.issues.length}if(m.has(E))continue;if(E==="__proto__"){v==="never"&&f.push(E);continue}if(v==="never"){f.push(E);continue}const _=g.run({value:r[E],issues:[]},s);_ instanceof Promise?e.push(_.then(N=>ld(N,i,E,r,y,x))):ld(_,i,E,r,y,x)}return f.length&&i.issues.push({code:"unrecognized_keys",keys:f,input:r,inst:c,continue:!0}),e.length?Promise.all(e).then(()=>i):i}const TC=ae("$ZodObject",(e,r)=>{Ot.init(e,r);const i=Object.getOwnPropertyDescriptor(r,"shape"),s=i?.get?i.get.raw:r.shape??{};if(s){const g=()=>{const v={...s};return Object.defineProperty(r,"shape",{value:v}),g.raw=v,v};g.raw=s,Object.defineProperty(r,"shape",{get:g})}const l=Sd(()=>tS(r));ht(e,"propValues",g=>{const v=g.def.shape,y={};for(const x in v){const w=v[x]._zod;if(w.values){Object.prototype.hasOwnProperty.call(y,x)||wa(y,x,new Set);for(const E of w.values)y[x].add(E);w.optin!==void 0&&y[x].add(void 0)}}return y});const c=Ul,d=r.catchall;let f;const m=Rr.memoizer;m?.attach(e),e._zod.parse=(g,v)=>{f??(f=l.value);const y=g.value;if(!c(y))return g.issues.push({expected:"object",code:"invalid_type",input:y,inst:e}),g;g.value=m?m.alloc(e,g,{},v):{};const x=[],w=f.shape,E=v?.abortEarly;let _=g.issues.length;for(const N of f.allKeys){if(E&&g.issues.length!==_){if(va(g,_))break;_=g.issues.length}if(N==="__proto__")continue;const H=w[N],O=H._zod.optin,se=H._zod.optout,ce=H._zod.run({value:y[N],issues:[]},v);ce instanceof Promise?x.push(ce.then(K=>ld(K,g,N,y,O,se))):ld(ce,g,N,y,O,se)}return d?nS(x,y,g,v,l.value,e,E===!0):x.length?Promise.all(x).then(()=>g):g}}),kC=ae("$ZodObjectJIT",(e,r)=>{TC.init(e,r);const i=e._zod.parse,s=Sd(()=>tS(r)),l=Rr.memoizer,c=w=>{const E=s.value,_=E.symbolKeys,N=new DN(["payload","ctx"],{shape:w,inst:e,memo:l,syms:_}),H=K=>`shape[${K}]._zod.run({ value: input[${K}], issues: [] }, ctx)`,O=(K,oe)=>` +};`)(...Object.values(this.closed))}}const BN={major:4,minor:6,patch:7},Ot=ae("$ZodType",(e,r)=>{var i;e??(e={}),e._zod.def=r,e._zod.bag=e._zod.bag||{},e._zod.version=BN;const s=e._zod.def.checks,l=e._zod.traits.has("$ZodCheck")?[e,...s??[]]:s?.length?[...s]:[];for(const c of l)for(const d of c._zod.onattach)d(e);if(l.length===0)(i=e._zod).deferred??(i.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const c=(f,m,g)=>{if(f.memo)return f;let v=ba(f),y;for(const x of m){if(x._zod.def.when){if(g4(f)||!x._zod.def.when(f))continue}else if(v)continue;const w=f.issues.length,E=x._zod.check(f);if(E instanceof Promise&&g?.async===!1)throw new Gi;if(y||E instanceof Promise)y=(y??Promise.resolve()).then(async()=>{await E,f.issues.length!==w&&(op(f.issues,w,e),v||(v=ba(f,w)))});else{if(f.issues.length===w)continue;op(f.issues,w,e),v||(v=ba(f,w))}}return y?y.then(()=>f):f},d=(f,m,g)=>{if(ba(f))return f.aborted=!0,f;const v=c(m,l,g);if(v instanceof Promise){if(g.async===!1)throw new Gi;return v.then(y=>e._zod.parse(y,g))}return e._zod.parse(v,g)};e._zod.run=(f,m)=>{if(m.skipChecks)return e._zod.parse(f,m);if(m.direction==="backward"){const v=e._zod.parse({value:f.value,issues:[]},{...m,skipChecks:!0});return v instanceof Promise?v.then(y=>d(y,f,m)):d(v,f,m)}const g=e._zod.parse(f,m);if(g instanceof Promise){if(m.async===!1)throw new Gi;return g.then(v=>c(v,l,m))}return c(g,l,m)}}},{get"~standard"(){return Hw(this,"~standard",Yw(this))},set"~standard"(e){pi(this,"~standard",e)}}),Vw=(e,r)=>e.issues.length?{issues:e.issues.map(i=>mi(i,r,ea()))}:{value:e.value};async function LN(e,r){const i={async:!0};return Vw(await e._zod.run({value:r,issues:[]},i),i)}function Yw(e){return{validate:r=>{const i={async:!1};try{const s=e._zod.run({value:r,issues:[]},i);if(!(s instanceof Promise))return Vw(s,i)}catch{}return LN(e,r)},vendor:"zod",version:1}}const ng=ae("$ZodString",(e,r)=>{Ot.init(e,r),e._zod.pattern=r.pattern??vN,e._zod.parse=(i,s)=>{if(r.coerce)try{i.value=String(i.value)}catch{}return typeof i.value=="string"||i.issues.push({expected:"string",code:"invalid_type",input:i.value,inst:e}),i}}),jt=ae("$ZodStringFormat",(e,r)=>{kd.init(e,r),ng.init(e,r)}),UN=ae("$ZodGUID",(e,r)=>{r.pattern??(r.pattern=nN),jt.init(e,r)}),HN=ae("$ZodUUID",(e,r)=>{if(r.version){const s={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[r.version];if(s===void 0)throw new Error(`Invalid UUID version: "${r.version}"`);r.pattern??(r.pattern=bx(s))}else r.pattern??(r.pattern=bx());jt.init(e,r)}),PN=ae("$ZodEmail",(e,r)=>{r.pattern??(r.pattern=rN),jt.init(e,r)}),Gw=1,od=2;function Kw(e){try{return typeof URL<"u"&&typeof URL.canParse=="function"?URL.canParse(e):(new URL(e),!0)}catch{return!1}}function $N(e,r){return!("normalize"in r)&&!("hostname"in r)&&!("protocol"in r)?Kw(e)||od:qN(e,r)}function qN(e,r){if(!r.normalize&&r.protocol?.source===fN.source&&!/^https?:\/\//i.test(e))return Gw;try{if(typeof URL<"u"){const i=URL;if(typeof i.parse=="function")return i.parse(e)??od}return new URL(e)}catch{return od}}const ZN=/[\t\n\r]/g;function xx(e){return e.replace(ZN,"")}function IN(e,r){return r.lastIndex=0,r.test(e.hostname)}function FN(e,r){return r.lastIndex=0,r.test(e.protocol.endsWith(":")?e.protocol.slice(0,-1):e.protocol)}const VN=ae("$ZodURL",(e,r)=>{jt.init(e,r),e._zod.check=i=>{try{const s=i.value.trim(),l=$N(s,r);if(l===Gw){i.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:i.value,inst:e,continue:!r.abort});return}if(l===od){i.issues.push({code:"invalid_format",format:"url",input:i.value,inst:e,continue:!r.abort});return}if(l===!0){i.value=xx(s);return}r.hostname&&!IN(l,r.hostname)&&i.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:r.hostname.source,input:i.value,inst:e,continue:!r.abort}),r.protocol&&!FN(l,r.protocol)&&i.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:r.protocol.source,input:i.value,inst:e,continue:!r.abort}),i.value=r.normalize?l.href:xx(s);return}catch{i.issues.push({code:"invalid_format",format:"url",input:i.value,inst:e,continue:!r.abort})}}}),YN=ae("$ZodEmoji",(e,r)=>{r.pattern??(r.pattern=iN()),jt.init(e,r)}),GN=ae("$ZodNanoID",(e,r)=>{if(r.length!==void 0&&(!Number.isInteger(r.length)||r.length<1))throw new Error(`Invalid nanoid length: ${r.length}`);r.pattern??(r.pattern=r.length===void 0?W4:eN(r.length)),jt.init(e,r)}),KN=ae("$ZodCUID",(e,r)=>{r.pattern??(r.pattern=G4),jt.init(e,r)}),QN=ae("$ZodCUID2",(e,r)=>{r.pattern??(r.pattern=K4),jt.init(e,r)}),XN=ae("$ZodULID",(e,r)=>{r.pattern??(r.pattern=Q4),jt.init(e,r)}),JN=ae("$ZodXID",(e,r)=>{r.pattern??(r.pattern=X4),jt.init(e,r)}),WN=ae("$ZodKSUID",(e,r)=>{r.pattern??(r.pattern=J4),jt.init(e,r)}),eC=ae("$ZodISODateTime",(e,r)=>{r.pattern??(r.pattern=yN(r)),jt.init(e,r)}),tC=ae("$ZodISODate",(e,r)=>{r.pattern??(r.pattern=pN),jt.init(e,r)}),nC=ae("$ZodISOTime",(e,r)=>{r.pattern??(r.pattern=gN(r)),jt.init(e,r)}),rC=ae("$ZodISODuration",(e,r)=>{r.pattern??(r.pattern=tN),jt.init(e,r)}),aC=ae("$ZodIPv4",(e,r)=>{r.pattern??(r.pattern=sN),jt.init(e,r)}),iC=/^[0-9a-fA-F:.]+$/;function Qw(e){return iC.test(e)?Kw(`http://[${e}]`):!1}const sC=ae("$ZodIPv6",(e,r)=>{r.pattern??(r.pattern=oN),jt.init(e,r),e._zod.check=i=>{Qw(i.value)||i.issues.push({code:"invalid_format",format:"ipv6",input:i.value,inst:e,continue:!r.abort})}}),oC=ae("$ZodCIDRv4",(e,r)=>{r.pattern??(r.pattern=lN),jt.init(e,r)});function lC(e){const r=e.split("/");if(r.length!==2)return!1;const[i,s]=r;if(!s)return!1;const l=Number(s);return`${l}`!==s||l<0||l>128?!1:Qw(i)}const cC=ae("$ZodCIDRv6",(e,r)=>{r.pattern??(r.pattern=cN),jt.init(e,r),e._zod.check=i=>{lC(i.value)||i.issues.push({code:"invalid_format",format:"cidrv6",input:i.value,inst:e,continue:!r.abort})}});function Xw(e){if(e==="")return!0;if(/\s/.test(e)||e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const Jw=/^[0-9a-zA-Z+/]*={0,2}$/,uC=ae("$ZodBase64",(e,r)=>{r.pattern??(r.pattern=Jw),jt.init(e,r),e._zod.check=i=>{Xw(i.value)||i.issues.push({code:"invalid_format",format:"base64",input:i.value,inst:e,continue:!r.abort})}}),rg=/^[A-Za-z0-9_-]*$/;function dC(e){if(!rg.test(e))return!1;const r=e.replace(/[-_]/g,s=>s==="-"?"+":"/"),i=r.padEnd(Math.ceil(r.length/4)*4,"=");return Xw(i)}const fC=ae("$ZodBase64URL",(e,r)=>{r.pattern??(r.pattern=rg),jt.init(e,r),e._zod.check=i=>{dC(i.value)||i.issues.push({code:"invalid_format",format:"base64url",input:i.value,inst:e,continue:!r.abort})}}),hC=ae("$ZodE164",(e,r)=>{r.pattern??(r.pattern=hN),jt.init(e,r)});function mC(e,r=null){try{const i=e.split(".");if(i.length!==3)return!1;const[s]=i;if(!s)return!1;const l=JSON.parse(atob(s));return!("typ"in l&&l?.typ!=="JWT"||!l.alg||r&&(!("alg"in l)||l.alg!==r))}catch{return!1}}const pC=ae("$ZodJWT",(e,r)=>{jt.init(e,r),e._zod.check=i=>{mC(i.value,r.alg)||i.issues.push({code:"invalid_format",format:"jwt",input:i.value,inst:e,continue:!r.abort})}}),Ww=ae("$ZodNumber",(e,r)=>{Ot.init(e,r),e._zod.pattern=eg,e._zod.parse=(i,s)=>{if(r.coerce)try{i.value=Number(i.value)}catch{}const l=i.value;if(typeof l=="number"&&!Number.isNaN(l)&&Number.isFinite(l))return i;const c=typeof l=="number"?Number.isNaN(l)?"NaN":Number.isFinite(l)?void 0:String(l):void 0;return i.issues.push({expected:"number",code:"invalid_type",input:l,inst:e,...c?{received:c}:{}}),i}}),gC=ae("$ZodNumberFormat",(e,r)=>{TN.init(e,r),Ww.init(e,r)}),yC=ae("$ZodBoolean",(e,r)=>{Ot.init(e,r),e._zod.pattern=xN,e._zod.parse=(i,s)=>{if(r.coerce)try{i.value=!!i.value}catch{}const l=i.value;return typeof l=="boolean"||i.issues.push({expected:"boolean",code:"invalid_type",input:l,inst:e}),i}}),vC=ae("$ZodUnknown",(e,r)=>{Ot.init(e,r),e._zod.parse=i=>i}),bC=ae("$ZodNever",(e,r)=>{Ot.init(e,r),e._zod.parse=(i,s)=>(i.issues.push({expected:"never",code:"invalid_type",input:i.value,inst:e}),i)});function xC(e,r)DELIM" +R"DELIM(){const i=px(e._zod.def.checks);if(!i.length)return;const s=Math.min(...i.map(c=>c[0])),l=e._zod.parse;e._zod.parse=(c,d)=>{const f=r(c.value);if(f>s&&!d?.skipChecks&&d?.direction!=="backward"){for(const[m,g]of px(e._zod.def.checks))if(f>m&&g._zod.def.when(c)){const v=c.issues.length;return g._zod.check(c),c.issues[v].continue=!1,op(c.issues,v,e),c}}return l(c,d)}}const wC=e=>Array.isArray(e)?e.length:-1;function wx(e,r,i){e.issues.length&&r.issues.push(...Ks(i,e.issues)),r.value[i]=e.value}const SC=ae("$ZodArray",(e,r)=>{Ot.init(e,r);const i=Rr.memoizer;i?.attach(e),e._zod.parse=(s,l)=>{const c=s.value;if(!Array.isArray(c))return s.issues.push({expected:"array",code:"invalid_type",input:c,inst:e}),s;s.value=i?i.alloc(e,s,Array(c.length),l):Array(c.length);const d=[],f=l?.abortEarly;for(let m=0;mwx(y,s,m)));else if(wx(v,s,m),f&&v.issues.length!==0&&ba(v))break}return d.length?Promise.all(d).then(()=>s):s},xC(e,wC)});function ld(e,r,i,s,l,c){const d=i in s,f=c==="optional";if(!(!d&&f&&l==="optional")){if(e.issues.length){if(l!==void 0&&f&&!d)return;r.issues.push(...Ks(i,e.issues))}if(!d&&l===void 0){e.issues.length||r.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[i]});return}e.value===void 0?(d||l==="defaulted"&&!f)&&(r.value[i]=void 0):r.value[i]=e.value}}const EC=[];function eS(e){const r=Object.keys(e.shape),i=Object.getOwnPropertySymbols(e.shape),s=i.length?i:EC,l=s.length?[...r,...s]:r;for(const d of l)if(!e.shape?.[d]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${String(d)}": expected a Zod schema`);const c=l4(e.shape);return{...e,allKeys:l,symbolKeys:s,keySet:new Set(r),numKeys:r.length,optionalKeys:new Set(c)}}function tS(e,r,i,s,l,c,d){const f=[],m=l.keySet,g=l.catchall._zod,v=g.def.type,y=g.optin,x=g.optout;let w=0;for(const E in r){if(d&&i.issues.length!==w){if(ba(i,w))break;w=i.issues.length}if(m.has(E))continue;if(E==="__proto__"){v==="never"&&f.push(E);continue}if(v==="never"){f.push(E);continue}const _=g.run({value:r[E],issues:[]},s);_ instanceof Promise?e.push(_.then(N=>ld(N,i,E,r,y,x))):ld(_,i,E,r,y,x)}return f.length&&i.issues.push({code:"unrecognized_keys",keys:f,input:r,inst:c,continue:!0}),e.length?Promise.all(e).then(()=>i):i}const TC=ae("$ZodObject",(e,r)=>{Ot.init(e,r);const i=Object.getOwnPropertyDescriptor(r,"shape"),s=i?.get?i.get.raw:r.shape??{};if(s){const g=()=>{const v={...s};return Object.defineProperty(r,"shape",{value:v}),g.raw=v,v};g.raw=s,Object.defineProperty(r,"shape",{get:g})}const l=Sd(()=>eS(r));ht(e,"propValues",g=>{const v=g.def.shape,y={};for(const x in v){const w=v[x]._zod;if(w.values){Object.prototype.hasOwnProperty.call(y,x)||Sa(y,x,new Set);for(const E of w.values)y[x].add(E);w.optin!==void 0&&y[x].add(void 0)}}return y});const c=Ul,d=r.catchall;let f;const m=Rr.memoizer;m?.attach(e),e._zod.parse=(g,v)=>{f??(f=l.value);const y=g.value;if(!c(y))return g.issues.push({expected:"object",code:"invalid_type",input:y,inst:e}),g;g.value=m?m.alloc(e,g,{},v):{};const x=[],w=f.shape,E=v?.abortEarly;let _=g.issues.length;for(const N of f.allKeys){if(E&&g.issues.length!==_){if(ba(g,_))break;_=g.issues.length}if(N==="__proto__")continue;const H=w[N],O=H._zod.optin,se=H._zod.optout,ce=H._zod.run({value:y[N],issues:[]},v);ce instanceof Promise?x.push(ce.then(K=>ld(K,g,N,y,O,se))):ld(ce,g,N,y,O,se)}return d?tS(x,y,g,v,l.value,e,E===!0):x.length?Promise.all(x).then(()=>g):g}}),kC=ae("$ZodObjectJIT",(e,r)=>{TC.init(e,r);const i=e._zod.parse,s=Sd(()=>eS(r)),l=Rr.memoizer,c=w=>{const E=s.value,_=E.symbolKeys,N=new DN(["payload","ctx"],{shape:w,inst:e,memo:l,syms:_}),H=K=>`shape[${K}]._zod.run({ value: input[${K}], issues: [] }, ctx)`,O=(K,oe)=>` let ${K}_ab = false; for (let i = 0; i < ${K}.issues.length; i++) { const iss = ${K}.issues[i]; @@ -410,63 +410,63 @@ R"DELIM(){const i=gx(e._zod.def.checks);if(!i.length)return;const s=Math.min(... newResult[${R}] = ${oe}.value; } - `)}return N.write("payload.value = newResult;"),N.write("return payload;"),N.compile()};let d;const f=Ul,m=!Rr.jitless,v=m&&s4.value,y=r.catchall;let x;e._zod.parse=(w,E)=>{x??(x=s.value);const _=w.value;return f(_)?m&&v&&E?.async===!1&&E.jitless!==!0?(d||(d=c(r.shape)),w=d(w,E),y?nS([],_,w,E,x,e,E?.abortEarly===!0):w):i(w,E):(w.issues.push({expected:"object",code:"invalid_type",input:_,inst:e}),w)}});function Ex(e,r,i,s){for(const c of e)if(c.issues.length===0)return r.value=c.value,r;const l=e.filter(c=>!va(c));return l.length===1?(r.value=l[0].value,l[0]):(r.issues.push({code:"invalid_union",input:r.value,inst:i,errors:e.map(c=>c.issues.map(d=>mi(d,s,Wr())))}),r)}const rS=ae("$ZodUnion",(e,r)=>{Ot.init(e,r),ht(e,"optin",s=>s.def.options.some(l=>l._zod.optin==="defaulted")?"defaulted":s.def.options.some(l=>l._zod.optin!==void 0)?"optional":void 0),ht(e,"optout",s=>s.def.options.some(l=>l._zod.optout==="optional")?"optional":void 0),ht(e,"values",s=>{if(s.def.options.every(l=>l._zod.values))return new Set(s.def.options.flatMap(l=>Array.from(l._zod.values)))}),ht(e,"pattern",s=>{if(s.def.options.every(l=>l._zod.pattern)){const l=s.def.options.map(c=>c._zod.pattern);return new RegExp(`^(${l.map(c=>Yp(c.source)).join("|")})$`)}});const i=r.options.length===1?r.options[0]._zod.run:null;e._zod.parse=(s,l)=>{if(i)return i(s,l);let c=!1;const d=[];for(const f of r.options){const m=f._zod.run({value:s.value,issues:[]},l);if(m instanceof Promise)d.push(m),c=!0;else{if(m.issues.length===0)return m;d.push(m)}}return c?Promise.all(d).then(f=>Ex(f,s,e,l)):Ex(d,s,e,l)}});function _C(e){const r=new Map;for(const i of e.options){const s=i._zod.propValues?.[e.discriminator];if(!s||s.size===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(i)}"`);for(const l of s)if(r.has(l)){if(l!==void 0)throw new Error(`Duplicate discriminator value "${String(l)}"`);r.set(l,null)}else r.set(l,i)}return r}const NC=ae("$ZodDiscriminatedUnion",(e,r)=>{r.inclusive=!1,rS.init(e,r);const i=e._zod.parse;ht(e,"propValues",l=>{const c={};let d=0;for(const f of l.def.options){const m=f._zod.propValues;if(!m||Object.keys(m).l)DELIM" -R"DELIM(ength===0)throw new Error(`Invalid discriminated union option at index "${l.def.options.indexOf(f)}"`);m[l.def.discriminator]?.has(void 0)&&d++;for(const[g,v]of Object.entries(m)){Object.prototype.hasOwnProperty.call(c,g)||wa(c,g,new Set);for(const y of v)c[g].add(y)}}return!l.def.unionFallback&&d>1&&c[l.def.discriminator]?.delete(void 0),c}),r.options.forEach((l,c)=>{const d=Gp(l._zod.def);if(d&&!Object.prototype.hasOwnProperty.call(d,r.discriminator))throw new Error(`Invalid discriminated union option at index "${c}"`)});const s=Sd(()=>_C(r));e._zod.parse=(l,c)=>{const d=l.value;if(!Ul(d))return l.issues.push({code:"invalid_type",expected:"object",input:d,inst:e}),l;const f=d?.[r.discriminator],m=s.value.get(f);return m&&(f!==void 0||c.direction!=="backward")?m._zod.run(l,c):r.unionFallback||c.direction==="backward"?i(l,c):(l.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:r.discriminator,options:Array.from(s.value.keys()).filter(g=>s.value.get(g)!==null),input:d,path:[r.discriminator],inst:e}),l)}}),CC=ae("$ZodIntersection",(e,r)=>{Ot.init(e,r),e._zod.parse=(i,s)=>{const l=i.value,c=r.left._zod.run({value:l,issues:[]},s),d=r.right._zod.run({value:l,issues:[]},s);return c instanceof Promise||d instanceof Promise?Promise.all([c,d]).then(([m,g])=>Tx(i,m,g)):Tx(i,c,d)}});function cp(e,r){if(e===r)return{valid:!0,data:e};if(e instanceof Date&&r instanceof Date&&+e==+r)return{valid:!0,data:e};if(io(e)&&io(r)){const i=Object.keys(r),s=Object.keys(e).filter(c=>i.indexOf(c)!==-1),l={...e,...r};Object.prototype.hasOwnProperty.call(l,"__proto__")&&delete l.__proto__;for(const c of s){if(c==="__proto__")continue;const d=cp(e[c],r[c]);if(!d.valid)return{valid:!1,mergeErrorPath:[c,...d.mergeErrorPath]};l[c]=d.data}return{valid:!0,data:l}}if(Array.isArray(e)&&Array.isArray(r)){if(e.length!==r.length)return{valid:!1,mergeErrorPath:[]};const i=[];for(let s=0;s{let y;if(g.code==="unrecognized_keys"&&!g.path?.length)l??(l=g),y=g.keys;else if(g.code==="invalid_key"&&g.origin==="record"&&g.path?.length===1){const x=String(g.path[0]);c.has(x)||c.set(x,g),y=[x]}else return!1;for(const x of y)s.has(x)||s.set(x,{}),s.get(x)[v]=!0;return!0};for(const g of r.issues)d(g,"l")||e.issues.push(g);for(const g of i.issues)d(g,"r")||e.issues.push(g);const f=[...s].filter(([,g])=>g.l&&g.r).map(([g])=>g);if(f.length){const g=l?f.filter(v=>l.keys.includes(v)):[];g.length&&e.issues.push({...l,keys:g});for(const v of f)!g.includes(v)&&c.has(v)&&e.issues.push(c.get(v))}const m=cp(r.value,i.value);if(!m.valid){if(va(e))return e;throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(m.mergeErrorPath)}`)}return e.value=m.data,e}const jC=ae("$ZodRecord",(e,r)=>{Ot.init(e,r);const i=Rr.memoizer;i?.attach(e),e._zod.parse=(s,l)=>{const c=s.value;if(!io(c))return s.issues.push({expected:"record",code:"invalid_type",input:c,inst:e}),s;const d=[],f=r.keyType._zod.values;if(f&&!r.partial){s.value=i?i.alloc(e,s,{},l):{};const m=new Set;for(const v of f)if(typeof v=="string"||typeof v=="number"||typeof v=="symbol"){if(m.add(typeof v=="number"?v.toString():v),v==="__proto__")continue;const y=r.keyType._zod.run({value:v,issues:[]},l);if(y instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(y.issues.length){s.issues.push({code:"invalid_key",origin:"record",issues:y.issues.map(E=>mi(E,l,Wr())),input:v,path:[v],inst:e});continue}const x=y.value;if(x==="__proto__")continue;const w=r.valueType._zod.run({value:c[v],issues:[]},l);w instanceof Promise?d.push(w.then(E=>{E.issues.length&&s.issues.push(...Ks(v,E.issues)),s.value[x]=E.value})):(w.issues.length&&s.issues.push(...Ks(v,w.issues)),s.value[x]=w.value)}let g;for(const v in c)if(!m.has(v))if(r.mode==="loose"){if(v==="__proto__")continue;s.value[v]=c[v]}else g=g??[],g.push(v);g&&g.length>0&&s.issues.push({code:"unrecognized_keys",input:c,inst:e,keys:g,continue:!0})}else{s.value=i?i.alloc(e,s,{},l):{};let m;for(const g of Reflect.ownKeys(c)){if(g==="__proto__"||!Object.prototype.propertyIsEnumerable.call(c,g))continue;let v=r.keyType._zod.run({value:g,issues:[]},l);if(v instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof g=="string"&&tg.test(g)&&v.issues.length){const E=r.keyType._zod.run({value:Number(g),issues:[]},l);if(E instanceof Promise)throw new Error("Async schemas not supported in object keys currently");E.issues.length===0&&(v=E)}if(v.issues.length){r.mode==="loose"?s.value[g]=c[g]:f?(m=m??[],m.push(g)):s.issues.push({code:"invalid_key",origin:"record",issues:v.issues.map(E=>mi(E,l,Wr())),input:g,path:[g],inst:e});continue}const x=v.value;if(x==="__proto__")continue;const w=r.valueType._zod.run({value:c[g],issues:[]},l);w instanceof Promise?d.push(w.then(E=>{E.issues.length&&s.issues.push(...Ks(g,E.issues)),s.value[x]=E.value})):(w.issues.length&&s.issues.push(...Ks(g,w.issues)),s.value[x]=w.value)}m&&m.length>0&&s.issues.push({code:"unrecognized_keys",input:c,inst:e,keys:m,continue:!0})}return d.length?Promise.all(d).then(()=>s):s}}),RC=ae("$ZodEnum",(e,r)=>{Ot.init(e,r);const i=ip(r.entries),s=new Set(i);e._zod.values=s,ht(e,"pattern",l=>{const c=ip(l.def.entries).filter(d=>o4.has(typeof d));return new RegExp(c.length?`^(${c.map(d=>so(d.toString())).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(l,c)=>{const d=l.value;return s.has(d)||l.issues.push({code:"invalid_value",values:i,input:d,inst:e}),l}}),AC=ae("$ZodLiteral",(e,r)=>{Ot.init(e,r);const i=new Set(r.values);e._zod.values=i,ht(e,"pattern",s=>{const l=s.def.values;return new RegExp(l.length?`^(${l.map(c=>typeof c=="string"?so(c):c?so(c.toString()):String(c)).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(s,l)=>{const c=s.value;return i.has(c)||s.issues.push({code:"invalid_value",values:r.values,input:c,inst:e}),s}}),OC=ae("$ZodTransform",(e,r)=>{Ot.init(e,r),e._zod.optin="optional",Rr.memoizer?.guard(e),e._zod.parse=(i,s)=>{if(s.direction==="backward")throw new qw(e.constructor.name);const l=r.transform(i.value,i);if(s.async)return(l instanceof Promise?l:Promise.resolve(l)).then(d=>(i.value=d,i));if(l instanceof Promise)throw new Gi;return i.value=l,i}});function kx(e,r){return e.value=r.issues.length?void 0:r.value,e}const aS=ae("$ZodOptional",(e,r)=>{Ot.init(e,r),ht(e,"optin",i=>i.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),e._zod.optout="optional",ht(e,"values",i=>{const s=i.def.innerType._zod.values;return s?new Set([...s,void 0]):void 0}),ht(e,"pattern",i=>{const s=i.def.innerType._zod.pattern;return s?new RegExp(`^(${Yp(s.source)})?$`):void 0}),e._zod.parse=(i,s)=>{if(i.value===void 0){if(r.innerType._zod.optin!=="defaulted")return i;const l=r.innerType._zod.run({value:i.value,issues:[]},s);return l instanceof Promise?l.then(c=>kx(i,c)):kx(i,l)}return r.innerType._zod.run(i,s)}}),MC=ae("$ZodExactOptional",(e,r)=>{aS.init(e,r),ht(e,"values",i=>i.def.innerType._zod.values),ht(e,"pattern",i=>i.def.innerType._zod.pattern),e._zod.parse=(i,s)=>r.innerType._zod.run(i,s)}),zC=ae("$ZodNullable",(e,r)=>{Ot.init(e,r),ht(e,"optin",i=>i.def.innerType._zod.optin),ht(e,"optout",i=>i.def.innerType._zod.optout),ht(e,"pattern",i=>{const s=i.def.innerType._zod.pattern;return s?new RegExp(`^(${Yp(s.source)}|null)$`):void 0}),ht(e,"values",i=>i.def.innerType._zod.values?new Set([...i.def.innerType._zod.values,null]):void 0),e._zod.parse=(i,s)=>i.value===null?i:r.innerType._zod.run(i,s)}),DC=ae("$ZodDefault",(e,r)=>{Ot.init(e,r),e._zod.optin="defaulted",ht(e,"values",i=>i.def.innerType._zod.values),e._zod.parse=(i,s)=>{if(s.direction==="backward")return r.innerType._zod.run(i,s);if(i.value===void 0)return i.value=r.defaultValue,i;const l=r.innerType._zod.run(i,s);return l instanceof Promise?)DELIM" -R"DELIM(l.then(c=>_x(c,r)):_x(l,r)}});function _x(e,r){return e.value===void 0&&(e.value=r.defaultValue),e}const BC=ae("$ZodPrefault",(e,r)=>{Ot.init(e,r),e._zod.optin="defaulted",ht(e,"values",i=>i.def.innerType._zod.values),e._zod.parse=(i,s)=>(s.direction==="backward"||i.value===void 0&&(i.value=r.defaultValue),r.innerType._zod.run(i,s))}),LC=ae("$ZodNonOptional",(e,r)=>{Ot.init(e,r),ht(e,"values",i=>{const s=i.def.innerType._zod.values;return s?new Set([...s].filter(l=>l!==void 0)):void 0}),e._zod.parse=(i,s)=>{const l=r.innerType._zod.run(i,s);return l instanceof Promise?l.then(c=>Nx(c,e)):Nx(l,e)}});function Nx(e,r){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:r}),e}function Cx(e,r,i,s){return r.issues.length?(e.value=i.catchValue({...r,value:e.value,error:{issues:r.issues.map(l=>mi(l,s,Wr()))},input:e.value}),e):(e.value=r.value,r.memo&&(e.memo=!0),e)}const UC=ae("$ZodCatch",(e,r)=>{Ot.init(e,r),ht(e,"optin",i=>i.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),ht(e,"optout",i=>i.def.innerType._zod.optout),ht(e,"values",i=>i.def.innerType._zod.values),e._zod.parse=(i,s)=>{if(s.direction==="backward")return r.innerType._zod.run(i,s);const l=r.innerType._zod.run({value:i.value,issues:[]},s);return l instanceof Promise?l.then(c=>Cx(i,c,r,s)):Cx(i,l,r,s)}}),HC=ae("$ZodPipe",(e,r)=>{Ot.init(e,r),ht(e,"values",i=>i.def.in._zod.values),ht(e,"optin",i=>i.def.in._zod.optin),ht(e,"optout",i=>i.def.out._zod.optout),ht(e,"propValues",i=>i.def.in._zod.propValues),e._zod.parse=(i,s)=>{if(s.direction==="backward"){const c=r.out._zod.run(i,s);return c instanceof Promise?c.then(d=>Cu(d,r.in,s)):Cu(c,r.in,s)}const l=r.in._zod.run(i,s);return l instanceof Promise?l.then(c=>Cu(c,r.out,s)):Cu(l,r.out,s)}});function Cu(e,r,i){return e.issues.some(s=>s.code!=="unrecognized_keys")?(e.aborted=!0,e):r._zod.run({value:e.value,issues:e.issues},i)}const PC=ae("$ZodReadonly",(e,r)=>{Ot.init(e,r),ht(e,"propValues",i=>i.def.innerType._zod.propValues),ht(e,"values",i=>i.def.innerType._zod.values),ht(e,"optin",i=>i.def.innerType?._zod?.optin),ht(e,"optout",i=>i.def.innerType?._zod?.optout),e._zod.parse=(i,s)=>{if(s.direction==="backward")return r.innerType._zod.run(i,s);const l=r.innerType._zod.run(i,s);return l instanceof Promise?l.then(jx):jx(l)}});function jx(e){return e.memo||(e.value=Object.freeze(e.value)),e}const $C=ae("$ZodCustom",(e,r)=>{qn.init(e,r),Ot.init(e,r),e._zod.parse=(i,s)=>i,e._zod.check=i=>{const s=i.value,l=r.fn(s);if(l instanceof Promise)return l.then(c=>Rx(c,i,s,e));Rx(l,i,s,e)}});function Rx(e,r,i,s){if(!e){const l={code:"custom",input:i,inst:s,path:[...s._zod.def.path??[]],continue:!s._zod.def.abort};s._zod.def.params&&(l.params=s._zod.def.params),r.issues.push(Hl(l))}}class qC extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform"),this.name="ZodCyclicError"}}const up="~memo",Ax=[];function iS(e){return e!==null&&typeof e=="object"}function wm(e){return e.map(r=>r.path?{...r,path:r.path.slice()}:{...r})}const sS=new WeakMap,Sl=0,Vu=1,Rl=2;function Yu(e,r,i){const s=sS.get(e);if(s!==void 0)return s?Rl:Sl;if(r.has(e))return Rl;r.add(e);let l=Sl;const c=v=>{if(l!==Rl&&v?._zod){const y=Yu(v,r);y>l&&(l=y)}},d=(v,y)=>{let x=Sl;for(const w of Reflect.ownKeys(v)){const E=Object.getOwnPropertyDescriptor(v,w);if(!E.enumerable)continue;const _=E.get?Vu:E.value?._zod?Yu(E.value,r):Sl;_>x&&(x=_)}return x},f=v=>{v>l&&(l=v)},m=e._zod.def;switch(m.type){case"object":{const v=Gp(m);f(v?d(v):Vu),c(m.catchall);break}case"array":c(m.element);break;case"tuple":for(const v of m.items)c(v);c(m.rest);break;case"record":case"map":c(m.keyType),c(m.valueType);break;case"set":c(m.valueType);break;case"union":for(const v of m.options)c(v);break;case"intersection":c(m.left),c(m.right);break;case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":c(m.innerType);break;case"pipe":c(m.in),c(m.out);break;case"function":c(m.input),c(m.output);break;case"lazy":{const v=m._cachedInner??void 0;f(v?Yu(v,r):Vu);break}case"template_literal":case"string":case"number":case"int":case"boolean":case"bigint":case"symbol":case"undefined":case"null":case"void":case"never":case"any":case"unknown":case"date":case"nan":case"enum":case"literal":case"file":case"transform":case"custom":break;default:for(const v in m){const y=Object.getOwnPropertyDescriptor(m,v);if(!y||y.get)continue;const x=y.value;if(!(!x||typeof x!="object")){if(x._zod)c(x);else if(Array.isArray(x))for(const w of x)c(w)}}}return r.delete(e),ZC(e,l)}function ZC(e,r){return r!==Vu&&sS.set(e,r===Rl),r}function IC(e,r){let i=e.buckets.get(r);return i||(i=new WeakMap,e.buckets.set(r,i)),i}let ju;const Ru=[],FC={alloc(e,r,i){const s=ju;if(!s)return i;ju=void 0;const l={value:i,issues:null};return s.set(r.value,l),Ru.push(l),i},guard(e){var r;(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred.push(()=>{const i=e._zod.parse,s=(l,c)=>{if(c.direction!=="backward"&&YC(c,l.value))throw new qC;return i(l,c)};e._zod.parse=s,e._zod.run===i&&(e._zod.run=s)})},attach(e){var r;let i,s=!1,l,c;(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred.push(()=>{const d=e._zod.parse,f=(m,g)=>{if(i===void 0){const H=Yu(e,new Set);if(H===Sl)return e._zod.parse=d,e._zod.run===f&&(e._zod.run=d),d(m,g);H===Rl||s?i=!0:s=!0}const v=m.value;if(!iS(v))return d(m,g);let y=g[up];y||(y={buckets:new WeakMap,backEdges:void 0},g[up]=y);let x;l===g?x=c:(x=IC(y,e),l=g,c=x);const w=x.get(v);if(w)return m.value=w.value,w.issues?w.issues.length&&m.issues.push(...wm(w.issues)):(m.memo=!0,y.backEdges??(y.backEdges=new WeakSet),y.backEdges.add(w.value)),m;ju=x;const E=Ru.length,_=d(m,g);ju=void 0;const N=Ru.length>E?Ru.pop():void 0;return _ instanceof Promise?_.then(H=>(N&&(N.issues=H.issues.length?wm(H.issues):Ax),H)):(N&&(N.issues=_.issues.length?wm(_.issues):Ax),_)};e._zod.parse=f,e._zod.run===d&&(e._zod.run=f)})}};function VC(){return FC}function YC(e,r){const i=e[up]?.backEdges;return i!==void 0&&iS(r)&&i.has(r)}const GC=()=>{const e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function r(c){return e[c]??null}const i={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",currency_code:"currency code",credit_card:"credit card number",iban:"IBAN",jwt:"JWT",template_literal:"input"},s={nan:"NaN"};function l(c,d){return c==="number"&&typeof d=="number"&&!Number.isFinite(d)?String(d):s[c]??c}return c=>{switch(c.code){case"invalid_type":{const d=l(c.expected),f=v4(c.input),m=l(f,c.input);return`Invalid input: expected ${d}, received ${m}`}case"invalid_value":return c.values.length===1?`Invalid input: expected ${Lw(c.values[0])}`:`Invalid option: expected one of ${mx(c.values,"|")}`;case"too_big":{const d=c.exact?"exactly ":c.inclusive?"<=":"<",f=r(c.origin);return f?`Too big: expected ${c.origin??"value"} to have ${d}${c.maximum.toString()} ${f.unit??"elements"}`:`Too big: expected ${c.origin??"value"} to be ${d}${c.maximum.toString()}`}case"too_small":{const d=c.exact?"exactly ":c.inclusive?">=":">",f=r(c.origin);return f?`Too small: expected ${c.origin} to have ${d}${c.minimum.toString()} ${f.unit}`:`Too small: expected ${c.origin} to be ${d}${c.minimum.toString()}`}case"invalid_format":{const d=c;return d.format==="starts_with"?`Invalid string: must start with "${d.prefix}"`:d.format==="ends_with"?`Invalid string: must end )DELIM" -R"DELIM(with "${d.suffix}"`:d.format==="includes"?`Invalid string: must include "${d.includes}"`:d.format==="regex"?`Invalid string: must match pattern ${d.pattern}`:`Invalid ${i[d.format]??c.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${c.divisor}`;case"unrecognized_keys":return`Unrecognized key${c.keys.length>1?"s":""}: ${mx(c.keys,", ")}`;case"invalid_key":return`Invalid key in ${c.origin}`;case"invalid_union":return c.options&&Array.isArray(c.options)&&c.options.length>0?`Invalid discriminator value. Expected ${c.options.map(f=>`'${f}'`).join(" | ")}`:c.inclusive===!1?"Invalid input: more than one option matched":"Invalid input";case"invalid_element":return`Invalid value in ${c.origin}`;default:return"Invalid input"}}};function KC(){return{localeError:GC()}}var Ox;class QC{constructor(){this._map=new WeakMap,this._idmap=new Map}add(r,...i){const s=i[0];return this._map.set(r,s),s&&typeof s=="object"&&"id"in s&&this._idmap.set(s.id,r),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(r){const i=this._map.get(r);return i&&typeof i=="object"&&"id"in i&&this._idmap.delete(i.id),this._map.delete(r),this}get(r){const i=r._zod.parent;if(i){const s={...this.get(i)??{}};delete s.id;const l={...s,...this._map.get(r)};return Object.keys(l).length?l:void 0}return this._map.get(r)}has(r){return this._map.has(r)}}function XC(){return new QC}(Ox=globalThis).__zod_globalRegistry??(Ox.__zod_globalRegistry=XC());const El=globalThis.__zod_globalRegistry;function oS(e){return e.checks&&(e.checks=[...e.checks]),e}function JC(e,r){return new e(oS({type:"string",...Re(r)}))}function WC(e,r){return new e({type:"string",format:"email",check:"string_format",abort:!1,...Re(r)})}function e3(e,r){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...Re(r)})}function t3(e,r){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...Re(r)})}function n3(e,r){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...Re(r)})}function r3(e,r){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...Re(r)})}function a3(e,r){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...Re(r)})}function i3(e,r){return new e({type:"string",format:"url",check:"string_format",abort:!1,...Re(r)})}function s3(e,r){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...Re(r)})}function o3(e,r){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...Re(r)})}function l3(e,r){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...Re(r)})}function c3(e,r){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...Re(r)})}function u3(e,r){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...Re(r)})}function d3(e,r){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...Re(r)})}function f3(e,r){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...Re(r)})}function h3(e,r){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...Re(r)})}function m3(e,r){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...Re(r)})}function p3(e,r){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...Re(r)})}function g3(e,r){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...Re(r)})}function y3(e,r){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...Re(r)})}function v3(e,r){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...Re(r)})}function b3(e,r){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...Re(r)})}function x3(e,r){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...Re(r)})}function w3(e,r){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...Re(r)})}function S3(e,r){return new e({type:"string",format:"date",check:"string_format",...Re(r)})}function E3(e,r){return new e({type:"string",format:"time",check:"string_format",precision:null,...Re(r)})}function T3(e,r){return new e({type:"string",format:"duration",check:"string_format",...Re(r)})}function k3(e,r){return new e(oS({type:"number",checks:[],...Re(r)}))}function _3(e,r){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...Re(r)})}function N3(e,r){return new e({type:"boolean",...Re(r)})}function C3(e){return new e({type:"unknown"})}function j3(e,r){return new e({type:"never",...Re(r)})}function Mx(e,r){return new Fw({check:"less_than",...Re(r),value:e,inclusive:!1})}function Sm(e,r){return new Fw({check:"less_than",...Re(r),value:e,inclusive:!0})}function zx(e,r){return new Vw({check:"greater_than",...Re(r),value:e,inclusive:!1})}function Em(e,r){return new Vw({check:"greater_than",...Re(r),value:e,inclusive:!0})}function Dx(e,r){return new EN({check:"multiple_of",...Re(r),value:e})}function lS(e,r){return new kN({check:"max_length",...Re(r),maximum:e})}function cd(e,r){return new _N({check:"min_length",...Re(r),minimum:e})}function cS(e,r){return new NN({check:"length_equals",...Re(r),length:e})}function R3(e,r){return new CN({check:"string_format",format:"regex",...Re(r),pattern:e})}function A3(e){return new jN({check:"string_format",format:"lowercase",...Re(e)})}function O3(e){return new RN({check:"string_format",format:"uppercase",...Re(e)})}function M3(e,r){return new AN({check:"string_format",format:"includes",...Re(r),includes:e})}function z3(e,r){return new ON({check:"string_format",format:"starts_with",...Re(r),prefix:e})}function D3(e,r){return new MN({check:"string_format",format:"ends_with",...Re(r),suffix:e})}function ho(e){return new zN({check:"overwrite",tx:e})}function B3(e){return ho(r=>r.normalize(e))}function L3(){return ho(e=>e.trim())}function U3(){return ho(e=>e.toLowerCase())}function H3(){return ho(e=>e.toUpperCase())}function P3(){return ho(e=>i4(e))}function $3(e,r,i){return new e({type:"array",element:r,...Re(i)})}function q3(e,r,i){return new e({type:"custom",check:"custom",fn:r,...Re(i)})}function Z3(e,r){const i=I3(s=>(s.addIssue=l=>{if(typeof l=="string")s.issues.push(Hl(l,s.value,i._zod.def));else{const c=l;c.fatal&&(c.continue=!1),c.code??(c.code="custom"),"input"in c||(c.input=s.value),c.inst??(c.inst=i),c.continue??(c.continue=!i._zod.def.abort),s.issues.push(Hl(c))}},e(s.value,s)),r);return i}function I3(e,r){const i=new qn({check:"custom",...Re(r)});return i._zod.check=e,i}function Al(e,...r){for(const i of r)for(const s of Reflect.ownKeys(i))Object.prototype.propertyIsEnumerable.call(i,s)&&wa(e,s,i[s]);return e}function uS(e){let r=e?.target??"draft-2020-12";return r==="draft-4"&&(r="draft-04"),r==="draft-7"&&(r="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??El,target:r,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??"ref",reused:e?.reused??"inline",intersections:[],deferred:[],external:e?.external??void 0}}function gi(e,r,i,s,l){const c=typeof r.unrepresentable=="function"?r.unrepresentable({zodSchema:e,path:s.path,message:l}):r.unrepresentable;if(c==="any")return!1;if(c===void 0||c==="throw")throw new Error(l);return Object.assign(i,c),!0}function Gt(e,r,i={path:[],schemaPath:[]}){var s;const l=e._zod.def,c=r.seen.get(e);if(c)return c.count++,i.schemaPath.includes(e)&&(c.cycle=i.path),c.schema;const d={schema:{},count:1,cycle:void 0,path:i.path};r.seen.set(e,d),r.sharedDefsExtractedFor=void 0,r.sharedEmitDoneFor=void 0;const f=e._zod.toJSONSchema?.();if(f)d.schema=f;else{const v={...i,schemaPath:[...i.schemaPath,e],path:i.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(r,d.schema,v);else{const x=d.schema,w=r.processors[l.type];if(!w)throw new Err)DELIM" -R"DELIM(or(`[toJSONSchema]: Non-representable type encountered: ${l.type}`);w(e,r,x,v)}const y=e._zod.parent;y&&(d.ref||(d.ref=y),Gt(y,r,v),r.seen.get(y).isParent=!0)}const m=r.metadataRegistry.get(e);return m&&Al(d.schema,m),r.io==="input"&&On(e)&&(delete d.schema.examples,delete d.schema.default),r.io==="input"&&"_prefault"in d.schema&&((s=d.schema).default??(s.default=d.schema._prefault)),delete d.schema._prefault,r.seen.get(e).schema}function Bx(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function dS(e,r){const i=e.seen.get(r);if(!i)throw new Error("Unprocessed schema. This is a bug in Zod.");if(e.external&&e.sharedDefsExtractedFor===e.external)return;const s=new Map;for(const d of e.seen.entries()){const f=e.metadataRegistry.get(d[0])?.id;if(f){const m=s.get(f);if(m&&m!==d[0])throw new Error(`Duplicate schema id "${f}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);s.set(f,d[0])}}const l=d=>{const f=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const y=e.external.registry.get(d[0])?.id,x=e.external.uri??(E=>E);if(y)return{ref:x(y)};const w=d[1].defId??d[1].schema.id??`schema${e.counter++}`;return d[1].defId=w,{defId:w,ref:`${x("__shared")}#/${f}/${Bx(w)}`}}const m="#",g=`${m}/${f}/`;if(d[1]===i&&!d[1].schema.id)return{ref:m};const v=d[1].schema.id??`__schema${e.counter++}`;return{defId:v,ref:g+Bx(v)}},c=d=>{if(d[1].schema.$ref)return;const f=d[1],{ref:m,defId:g}=l(d);f.def={...f.schema},g&&(f.defId=g);const v=f.schema;for(const y in v)delete v[y];v.$ref=m};if(e.cycles==="throw")for(const d of e.seen.entries()){const f=d[1];if(f.cycle)throw new Error(`Cycle detected: #/${f.cycle?.join("/")}/ + `)}return N.write("payload.value = newResult;"),N.write("return payload;"),N.compile()};let d;const f=Ul,m=!Rr.jitless,v=m&&s4.value,y=r.catchall;let x;e._zod.parse=(w,E)=>{x??(x=s.value);const _=w.value;return f(_)?m&&v&&E?.async===!1&&E.jitless!==!0?(d||(d=c(r.shape)),w=d(w,E),y?tS([],_,w,E,x,e,E?.abortEarly===!0):w):i(w,E):(w.issues.push({expected:"object",code:"invalid_type",input:_,inst:e}),w)}});function Sx(e,r,i,s){for(const c of e)if(c.issues.length===0)return r.value=c.value,r;const l=e.filter(c=>!ba(c));return l.length===1?(r.value=l[0].value,l[0]):(r.issues.push({code:"invalid_union",input:r.value,inst:i,errors:e.map(c=>c.issues.map(d=>mi(d,s,ea())))}),r)}const nS=ae("$ZodUnion",(e,r)=>{Ot.init(e,r),ht(e,"optin",s=>s.def.options.some(l=>l._zod.optin==="defaulted")?"defaulted":s.def.options.some(l=>l._zod.optin!==void 0)?"optional":void 0),ht(e,"optout",s=>s.def.options.some(l=>l._zod.optout==="optional")?"optional":void 0),ht(e,"values",s=>{if(s.def.options.every(l=>l._zod.values))return new Set(s.def.options.flatMap(l=>Array.from(l._zod.values)))}),ht(e,"pattern",s=>{if(s.def.options.every(l=>l._zod.pattern)){const l=s.def.options.map(c=>c._zod.pattern);return new RegExp(`^(${l.map(c=>Vp(c.source)).join("|")})$`)}});const i=r.options.length===1?r.options[0]._zod.run:null;e._zod.parse=(s,l)=>{if(i)return i(s,l);let c=!1;const d=[];for(const f of r.options){const m=f._zod.run({value:s.value,issues:[]},l);if(m instanceof Promise)d.push(m),c=!0;else{if(m.issues.length===0)return m;d.push(m)}}return c?Promise.all(d).then(f=>Sx(f,s,e,l)):Sx(d,s,e,l)}});function _C(e){const r=new Map;for(const i of e.options){const s=i._zod.propValues?.[e.discriminator];if(!s||s.size===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(i)}"`);for(const l of s)if(r.has(l)){if(l!==void 0)throw new Error(`Duplicate discriminator value "${String(l)}"`);r.set(l,null)}else r.set(l,i)}return r}const NC=ae("$ZodDiscriminatedUnion",(e,r)=>{r.inclusive=!1,nS.init(e,r);const i=e._zod.parse;ht(e,"propValues",l=>{const c={};let d=0;for(const f of l.def.options){const m=f._zod.propValues;if(!m||Object.keys(m).l)DELIM" +R"DELIM(ength===0)throw new Error(`Invalid discriminated union option at index "${l.def.options.indexOf(f)}"`);m[l.def.discriminator]?.has(void 0)&&d++;for(const[g,v]of Object.entries(m)){Object.prototype.hasOwnProperty.call(c,g)||Sa(c,g,new Set);for(const y of v)c[g].add(y)}}return!l.def.unionFallback&&d>1&&c[l.def.discriminator]?.delete(void 0),c}),r.options.forEach((l,c)=>{const d=Yp(l._zod.def);if(d&&!Object.prototype.hasOwnProperty.call(d,r.discriminator))throw new Error(`Invalid discriminated union option at index "${c}"`)});const s=Sd(()=>_C(r));e._zod.parse=(l,c)=>{const d=l.value;if(!Ul(d))return l.issues.push({code:"invalid_type",expected:"object",input:d,inst:e}),l;const f=d?.[r.discriminator],m=s.value.get(f);return m&&(f!==void 0||c.direction!=="backward")?m._zod.run(l,c):r.unionFallback||c.direction==="backward"?i(l,c):(l.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:r.discriminator,options:Array.from(s.value.keys()).filter(g=>s.value.get(g)!==null),input:d,path:[r.discriminator],inst:e}),l)}}),CC=ae("$ZodIntersection",(e,r)=>{Ot.init(e,r),e._zod.parse=(i,s)=>{const l=i.value,c=r.left._zod.run({value:l,issues:[]},s),d=r.right._zod.run({value:l,issues:[]},s);return c instanceof Promise||d instanceof Promise?Promise.all([c,d]).then(([m,g])=>Ex(i,m,g)):Ex(i,c,d)}});function cp(e,r){if(e===r)return{valid:!0,data:e};if(e instanceof Date&&r instanceof Date&&+e==+r)return{valid:!0,data:e};if(io(e)&&io(r)){const i=Object.keys(r),s=Object.keys(e).filter(c=>i.indexOf(c)!==-1),l={...e,...r};Object.prototype.hasOwnProperty.call(l,"__proto__")&&delete l.__proto__;for(const c of s){if(c==="__proto__")continue;const d=cp(e[c],r[c]);if(!d.valid)return{valid:!1,mergeErrorPath:[c,...d.mergeErrorPath]};l[c]=d.data}return{valid:!0,data:l}}if(Array.isArray(e)&&Array.isArray(r)){if(e.length!==r.length)return{valid:!1,mergeErrorPath:[]};const i=[];for(let s=0;s{let y;if(g.code==="unrecognized_keys"&&!g.path?.length)l??(l=g),y=g.keys;else if(g.code==="invalid_key"&&g.origin==="record"&&g.path?.length===1){const x=String(g.path[0]);c.has(x)||c.set(x,g),y=[x]}else return!1;for(const x of y)s.has(x)||s.set(x,{}),s.get(x)[v]=!0;return!0};for(const g of r.issues)d(g,"l")||e.issues.push(g);for(const g of i.issues)d(g,"r")||e.issues.push(g);const f=[...s].filter(([,g])=>g.l&&g.r).map(([g])=>g);if(f.length){const g=l?f.filter(v=>l.keys.includes(v)):[];g.length&&e.issues.push({...l,keys:g});for(const v of f)!g.includes(v)&&c.has(v)&&e.issues.push(c.get(v))}const m=cp(r.value,i.value);if(!m.valid){if(ba(e))return e;throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(m.mergeErrorPath)}`)}return e.value=m.data,e}const jC=ae("$ZodRecord",(e,r)=>{Ot.init(e,r);const i=Rr.memoizer;i?.attach(e),e._zod.parse=(s,l)=>{const c=s.value;if(!io(c))return s.issues.push({expected:"record",code:"invalid_type",input:c,inst:e}),s;const d=[],f=r.keyType._zod.values;if(f&&!r.partial){s.value=i?i.alloc(e,s,{},l):{};const m=new Set;for(const v of f)if(typeof v=="string"||typeof v=="number"||typeof v=="symbol"){if(m.add(typeof v=="number"?v.toString():v),v==="__proto__")continue;const y=r.keyType._zod.run({value:v,issues:[]},l);if(y instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(y.issues.length){s.issues.push({code:"invalid_key",origin:"record",issues:y.issues.map(E=>mi(E,l,ea())),input:v,path:[v],inst:e});continue}const x=y.value;if(x==="__proto__")continue;const w=r.valueType._zod.run({value:c[v],issues:[]},l);w instanceof Promise?d.push(w.then(E=>{E.issues.length&&s.issues.push(...Ks(v,E.issues)),s.value[x]=E.value})):(w.issues.length&&s.issues.push(...Ks(v,w.issues)),s.value[x]=w.value)}let g;for(const v in c)if(!m.has(v))if(r.mode==="loose"){if(v==="__proto__")continue;s.value[v]=c[v]}else g=g??[],g.push(v);g&&g.length>0&&s.issues.push({code:"unrecognized_keys",input:c,inst:e,keys:g,continue:!0})}else{s.value=i?i.alloc(e,s,{},l):{};let m;for(const g of Reflect.ownKeys(c)){if(g==="__proto__"||!Object.prototype.propertyIsEnumerable.call(c,g))continue;let v=r.keyType._zod.run({value:g,issues:[]},l);if(v instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof g=="string"&&eg.test(g)&&v.issues.length){const E=r.keyType._zod.run({value:Number(g),issues:[]},l);if(E instanceof Promise)throw new Error("Async schemas not supported in object keys currently");E.issues.length===0&&(v=E)}if(v.issues.length){r.mode==="loose"?s.value[g]=c[g]:f?(m=m??[],m.push(g)):s.issues.push({code:"invalid_key",origin:"record",issues:v.issues.map(E=>mi(E,l,ea())),input:g,path:[g],inst:e});continue}const x=v.value;if(x==="__proto__")continue;const w=r.valueType._zod.run({value:c[g],issues:[]},l);w instanceof Promise?d.push(w.then(E=>{E.issues.length&&s.issues.push(...Ks(g,E.issues)),s.value[x]=E.value})):(w.issues.length&&s.issues.push(...Ks(g,w.issues)),s.value[x]=w.value)}m&&m.length>0&&s.issues.push({code:"unrecognized_keys",input:c,inst:e,keys:m,continue:!0})}return d.length?Promise.all(d).then(()=>s):s}}),RC=ae("$ZodEnum",(e,r)=>{Ot.init(e,r);const i=ip(r.entries),s=new Set(i);e._zod.values=s,ht(e,"pattern",l=>{const c=ip(l.def.entries).filter(d=>o4.has(typeof d));return new RegExp(c.length?`^(${c.map(d=>so(d.toString())).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(l,c)=>{const d=l.value;return s.has(d)||l.issues.push({code:"invalid_value",values:i,input:d,inst:e}),l}}),AC=ae("$ZodLiteral",(e,r)=>{Ot.init(e,r);const i=new Set(r.values);e._zod.values=i,ht(e,"pattern",s=>{const l=s.def.values;return new RegExp(l.length?`^(${l.map(c=>typeof c=="string"?so(c):c?so(c.toString()):String(c)).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(s,l)=>{const c=s.value;return i.has(c)||s.issues.push({code:"invalid_value",values:r.values,input:c,inst:e}),s}}),OC=ae("$ZodTransform",(e,r)=>{Ot.init(e,r),e._zod.optin="optional",Rr.memoizer?.guard(e),e._zod.parse=(i,s)=>{if(s.direction==="backward")throw new $w(e.constructor.name);const l=r.transform(i.value,i);if(s.async)return(l instanceof Promise?l:Promise.resolve(l)).then(d=>(i.value=d,i));if(l instanceof Promise)throw new Gi;return i.value=l,i}});function Tx(e,r){return e.value=r.issues.length?void 0:r.value,e}const rS=ae("$ZodOptional",(e,r)=>{Ot.init(e,r),ht(e,"optin",i=>i.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),e._zod.optout="optional",ht(e,"values",i=>{const s=i.def.innerType._zod.values;return s?new Set([...s,void 0]):void 0}),ht(e,"pattern",i=>{const s=i.def.innerType._zod.pattern;return s?new RegExp(`^(${Vp(s.source)})?$`):void 0}),e._zod.parse=(i,s)=>{if(i.value===void 0){if(r.innerType._zod.optin!=="defaulted")return i;const l=r.innerType._zod.run({value:i.value,issues:[]},s);return l instanceof Promise?l.then(c=>Tx(i,c)):Tx(i,l)}return r.innerType._zod.run(i,s)}}),MC=ae("$ZodExactOptional",(e,r)=>{rS.init(e,r),ht(e,"values",i=>i.def.innerType._zod.values),ht(e,"pattern",i=>i.def.innerType._zod.pattern),e._zod.parse=(i,s)=>r.innerType._zod.run(i,s)}),zC=ae("$ZodNullable",(e,r)=>{Ot.init(e,r),ht(e,"optin",i=>i.def.innerType._zod.optin),ht(e,"optout",i=>i.def.innerType._zod.optout),ht(e,"pattern",i=>{const s=i.def.innerType._zod.pattern;return s?new RegExp(`^(${Vp(s.source)}|null)$`):void 0}),ht(e,"values",i=>i.def.innerType._zod.values?new Set([...i.def.innerType._zod.values,null]):void 0),e._zod.parse=(i,s)=>i.value===null?i:r.innerType._zod.run(i,s)}),DC=ae("$ZodDefault",(e,r)=>{Ot.init(e,r),e._zod.optin="defaulted",ht(e,"values",i=>i.def.innerType._zod.values),e._zod.parse=(i,s)=>{if(s.direction==="backward")return r.innerType._zod.run(i,s);if(i.value===void 0)return i.value=r.defaultValue,i;const l=r.innerType._zod.run(i,s);return l instanceof Promise?)DELIM" +R"DELIM(l.then(c=>kx(c,r)):kx(l,r)}});function kx(e,r){return e.value===void 0&&(e.value=r.defaultValue),e}const BC=ae("$ZodPrefault",(e,r)=>{Ot.init(e,r),e._zod.optin="defaulted",ht(e,"values",i=>i.def.innerType._zod.values),e._zod.parse=(i,s)=>(s.direction==="backward"||i.value===void 0&&(i.value=r.defaultValue),r.innerType._zod.run(i,s))}),LC=ae("$ZodNonOptional",(e,r)=>{Ot.init(e,r),ht(e,"values",i=>{const s=i.def.innerType._zod.values;return s?new Set([...s].filter(l=>l!==void 0)):void 0}),e._zod.parse=(i,s)=>{const l=r.innerType._zod.run(i,s);return l instanceof Promise?l.then(c=>_x(c,e)):_x(l,e)}});function _x(e,r){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:r}),e}function Nx(e,r,i,s){return r.issues.length?(e.value=i.catchValue({...r,value:e.value,error:{issues:r.issues.map(l=>mi(l,s,ea()))},input:e.value}),e):(e.value=r.value,r.memo&&(e.memo=!0),e)}const UC=ae("$ZodCatch",(e,r)=>{Ot.init(e,r),ht(e,"optin",i=>i.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),ht(e,"optout",i=>i.def.innerType._zod.optout),ht(e,"values",i=>i.def.innerType._zod.values),e._zod.parse=(i,s)=>{if(s.direction==="backward")return r.innerType._zod.run(i,s);const l=r.innerType._zod.run({value:i.value,issues:[]},s);return l instanceof Promise?l.then(c=>Nx(i,c,r,s)):Nx(i,l,r,s)}}),HC=ae("$ZodPipe",(e,r)=>{Ot.init(e,r),ht(e,"values",i=>i.def.in._zod.values),ht(e,"optin",i=>i.def.in._zod.optin),ht(e,"optout",i=>i.def.out._zod.optout),ht(e,"propValues",i=>i.def.in._zod.propValues),e._zod.parse=(i,s)=>{if(s.direction==="backward"){const c=r.out._zod.run(i,s);return c instanceof Promise?c.then(d=>Cu(d,r.in,s)):Cu(c,r.in,s)}const l=r.in._zod.run(i,s);return l instanceof Promise?l.then(c=>Cu(c,r.out,s)):Cu(l,r.out,s)}});function Cu(e,r,i){return e.issues.some(s=>s.code!=="unrecognized_keys")?(e.aborted=!0,e):r._zod.run({value:e.value,issues:e.issues},i)}const PC=ae("$ZodReadonly",(e,r)=>{Ot.init(e,r),ht(e,"propValues",i=>i.def.innerType._zod.propValues),ht(e,"values",i=>i.def.innerType._zod.values),ht(e,"optin",i=>i.def.innerType?._zod?.optin),ht(e,"optout",i=>i.def.innerType?._zod?.optout),e._zod.parse=(i,s)=>{if(s.direction==="backward")return r.innerType._zod.run(i,s);const l=r.innerType._zod.run(i,s);return l instanceof Promise?l.then(Cx):Cx(l)}});function Cx(e){return e.memo||(e.value=Object.freeze(e.value)),e}const $C=ae("$ZodCustom",(e,r)=>{qn.init(e,r),Ot.init(e,r),e._zod.parse=(i,s)=>i,e._zod.check=i=>{const s=i.value,l=r.fn(s);if(l instanceof Promise)return l.then(c=>jx(c,i,s,e));jx(l,i,s,e)}});function jx(e,r,i,s){if(!e){const l={code:"custom",input:i,inst:s,path:[...s._zod.def.path??[]],continue:!s._zod.def.abort};s._zod.def.params&&(l.params=s._zod.def.params),r.issues.push(Hl(l))}}class qC extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform"),this.name="ZodCyclicError"}}const up="~memo",Rx=[];function aS(e){return e!==null&&typeof e=="object"}function wm(e){return e.map(r=>r.path?{...r,path:r.path.slice()}:{...r})}const iS=new WeakMap,Sl=0,Vu=1,Rl=2;function Yu(e,r,i){const s=iS.get(e);if(s!==void 0)return s?Rl:Sl;if(r.has(e))return Rl;r.add(e);let l=Sl;const c=v=>{if(l!==Rl&&v?._zod){const y=Yu(v,r);y>l&&(l=y)}},d=(v,y)=>{let x=Sl;for(const w of Reflect.ownKeys(v)){const E=Object.getOwnPropertyDescriptor(v,w);if(!E.enumerable)continue;const _=E.get?Vu:E.value?._zod?Yu(E.value,r):Sl;_>x&&(x=_)}return x},f=v=>{v>l&&(l=v)},m=e._zod.def;switch(m.type){case"object":{const v=Yp(m);f(v?d(v):Vu),c(m.catchall);break}case"array":c(m.element);break;case"tuple":for(const v of m.items)c(v);c(m.rest);break;case"record":case"map":c(m.keyType),c(m.valueType);break;case"set":c(m.valueType);break;case"union":for(const v of m.options)c(v);break;case"intersection":c(m.left),c(m.right);break;case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":c(m.innerType);break;case"pipe":c(m.in),c(m.out);break;case"function":c(m.input),c(m.output);break;case"lazy":{const v=m._cachedInner??void 0;f(v?Yu(v,r):Vu);break}case"template_literal":case"string":case"number":case"int":case"boolean":case"bigint":case"symbol":case"undefined":case"null":case"void":case"never":case"any":case"unknown":case"date":case"nan":case"enum":case"literal":case"file":case"transform":case"custom":break;default:for(const v in m){const y=Object.getOwnPropertyDescriptor(m,v);if(!y||y.get)continue;const x=y.value;if(!(!x||typeof x!="object")){if(x._zod)c(x);else if(Array.isArray(x))for(const w of x)c(w)}}}return r.delete(e),ZC(e,l)}function ZC(e,r){return r!==Vu&&iS.set(e,r===Rl),r}function IC(e,r){let i=e.buckets.get(r);return i||(i=new WeakMap,e.buckets.set(r,i)),i}let ju;const Ru=[],FC={alloc(e,r,i){const s=ju;if(!s)return i;ju=void 0;const l={value:i,issues:null};return s.set(r.value,l),Ru.push(l),i},guard(e){var r;(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred.push(()=>{const i=e._zod.parse,s=(l,c)=>{if(c.direction!=="backward"&&YC(c,l.value))throw new qC;return i(l,c)};e._zod.parse=s,e._zod.run===i&&(e._zod.run=s)})},attach(e){var r;let i,s=!1,l,c;(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred.push(()=>{const d=e._zod.parse,f=(m,g)=>{if(i===void 0){const H=Yu(e,new Set);if(H===Sl)return e._zod.parse=d,e._zod.run===f&&(e._zod.run=d),d(m,g);H===Rl||s?i=!0:s=!0}const v=m.value;if(!aS(v))return d(m,g);let y=g[up];y||(y={buckets:new WeakMap,backEdges:void 0},g[up]=y);let x;l===g?x=c:(x=IC(y,e),l=g,c=x);const w=x.get(v);if(w)return m.value=w.value,w.issues?w.issues.length&&m.issues.push(...wm(w.issues)):(m.memo=!0,y.backEdges??(y.backEdges=new WeakSet),y.backEdges.add(w.value)),m;ju=x;const E=Ru.length,_=d(m,g);ju=void 0;const N=Ru.length>E?Ru.pop():void 0;return _ instanceof Promise?_.then(H=>(N&&(N.issues=H.issues.length?wm(H.issues):Rx),H)):(N&&(N.issues=_.issues.length?wm(_.issues):Rx),_)};e._zod.parse=f,e._zod.run===d&&(e._zod.run=f)})}};function VC(){return FC}function YC(e,r){const i=e[up]?.backEdges;return i!==void 0&&aS(r)&&i.has(r)}const GC=()=>{const e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function r(c){return e[c]??null}const i={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",currency_code:"currency code",credit_card:"credit card number",iban:"IBAN",jwt:"JWT",template_literal:"input"},s={nan:"NaN"};function l(c,d){return c==="number"&&typeof d=="number"&&!Number.isFinite(d)?String(d):s[c]??c}return c=>{switch(c.code){case"invalid_type":{const d=l(c.expected),f=v4(c.input),m=l(f,c.input);return`Invalid input: expected ${d}, received ${m}`}case"invalid_value":return c.values.length===1?`Invalid input: expected ${Bw(c.values[0])}`:`Invalid option: expected one of ${hx(c.values,"|")}`;case"too_big":{const d=c.exact?"exactly ":c.inclusive?"<=":"<",f=r(c.origin);return f?`Too big: expected ${c.origin??"value"} to have ${d}${c.maximum.toString()} ${f.unit??"elements"}`:`Too big: expected ${c.origin??"value"} to be ${d}${c.maximum.toString()}`}case"too_small":{const d=c.exact?"exactly ":c.inclusive?">=":">",f=r(c.origin);return f?`Too small: expected ${c.origin} to have ${d}${c.minimum.toString()} ${f.unit}`:`Too small: expected ${c.origin} to be ${d}${c.minimum.toString()}`}case"invalid_format":{const d=c;return d.format==="starts_with"?`Invalid string: must start with "${d.prefix}"`:d.format==="ends_with"?`Invalid string: must end )DELIM" +R"DELIM(with "${d.suffix}"`:d.format==="includes"?`Invalid string: must include "${d.includes}"`:d.format==="regex"?`Invalid string: must match pattern ${d.pattern}`:`Invalid ${i[d.format]??c.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${c.divisor}`;case"unrecognized_keys":return`Unrecognized key${c.keys.length>1?"s":""}: ${hx(c.keys,", ")}`;case"invalid_key":return`Invalid key in ${c.origin}`;case"invalid_union":return c.options&&Array.isArray(c.options)&&c.options.length>0?`Invalid discriminator value. Expected ${c.options.map(f=>`'${f}'`).join(" | ")}`:c.inclusive===!1?"Invalid input: more than one option matched":"Invalid input";case"invalid_element":return`Invalid value in ${c.origin}`;default:return"Invalid input"}}};function KC(){return{localeError:GC()}}var Ax;class QC{constructor(){this._map=new WeakMap,this._idmap=new Map}add(r,...i){const s=i[0];return this._map.set(r,s),s&&typeof s=="object"&&"id"in s&&this._idmap.set(s.id,r),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(r){const i=this._map.get(r);return i&&typeof i=="object"&&"id"in i&&this._idmap.delete(i.id),this._map.delete(r),this}get(r){const i=r._zod.parent;if(i){const s={...this.get(i)??{}};delete s.id;const l={...s,...this._map.get(r)};return Object.keys(l).length?l:void 0}return this._map.get(r)}has(r){return this._map.has(r)}}function XC(){return new QC}(Ax=globalThis).__zod_globalRegistry??(Ax.__zod_globalRegistry=XC());const El=globalThis.__zod_globalRegistry;function sS(e){return e.checks&&(e.checks=[...e.checks]),e}function JC(e,r){return new e(sS({type:"string",...Re(r)}))}function WC(e,r){return new e({type:"string",format:"email",check:"string_format",abort:!1,...Re(r)})}function e3(e,r){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...Re(r)})}function t3(e,r){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...Re(r)})}function n3(e,r){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...Re(r)})}function r3(e,r){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...Re(r)})}function a3(e,r){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...Re(r)})}function i3(e,r){return new e({type:"string",format:"url",check:"string_format",abort:!1,...Re(r)})}function s3(e,r){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...Re(r)})}function o3(e,r){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...Re(r)})}function l3(e,r){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...Re(r)})}function c3(e,r){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...Re(r)})}function u3(e,r){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...Re(r)})}function d3(e,r){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...Re(r)})}function f3(e,r){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...Re(r)})}function h3(e,r){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...Re(r)})}function m3(e,r){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...Re(r)})}function p3(e,r){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...Re(r)})}function g3(e,r){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...Re(r)})}function y3(e,r){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...Re(r)})}function v3(e,r){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...Re(r)})}function b3(e,r){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...Re(r)})}function x3(e,r){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...Re(r)})}function w3(e,r){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...Re(r)})}function S3(e,r){return new e({type:"string",format:"date",check:"string_format",...Re(r)})}function E3(e,r){return new e({type:"string",format:"time",check:"string_format",precision:null,...Re(r)})}function T3(e,r){return new e({type:"string",format:"duration",check:"string_format",...Re(r)})}function k3(e,r){return new e(sS({type:"number",checks:[],...Re(r)}))}function _3(e,r){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...Re(r)})}function N3(e,r){return new e({type:"boolean",...Re(r)})}function C3(e){return new e({type:"unknown"})}function j3(e,r){return new e({type:"never",...Re(r)})}function Ox(e,r){return new Iw({check:"less_than",...Re(r),value:e,inclusive:!1})}function Sm(e,r){return new Iw({check:"less_than",...Re(r),value:e,inclusive:!0})}function Mx(e,r){return new Fw({check:"greater_than",...Re(r),value:e,inclusive:!1})}function Em(e,r){return new Fw({check:"greater_than",...Re(r),value:e,inclusive:!0})}function zx(e,r){return new EN({check:"multiple_of",...Re(r),value:e})}function oS(e,r){return new kN({check:"max_length",...Re(r),maximum:e})}function cd(e,r){return new _N({check:"min_length",...Re(r),minimum:e})}function lS(e,r){return new NN({check:"length_equals",...Re(r),length:e})}function R3(e,r){return new CN({check:"string_format",format:"regex",...Re(r),pattern:e})}function A3(e){return new jN({check:"string_format",format:"lowercase",...Re(e)})}function O3(e){return new RN({check:"string_format",format:"uppercase",...Re(e)})}function M3(e,r){return new AN({check:"string_format",format:"includes",...Re(r),includes:e})}function z3(e,r){return new ON({check:"string_format",format:"starts_with",...Re(r),prefix:e})}function D3(e,r){return new MN({check:"string_format",format:"ends_with",...Re(r),suffix:e})}function ho(e){return new zN({check:"overwrite",tx:e})}function B3(e){return ho(r=>r.normalize(e))}function L3(){return ho(e=>e.trim())}function U3(){return ho(e=>e.toLowerCase())}function H3(){return ho(e=>e.toUpperCase())}function P3(){return ho(e=>i4(e))}function $3(e,r,i){return new e({type:"array",element:r,...Re(i)})}function q3(e,r,i){return new e({type:"custom",check:"custom",fn:r,...Re(i)})}function Z3(e,r){const i=I3(s=>(s.addIssue=l=>{if(typeof l=="string")s.issues.push(Hl(l,s.value,i._zod.def));else{const c=l;c.fatal&&(c.continue=!1),c.code??(c.code="custom"),"input"in c||(c.input=s.value),c.inst??(c.inst=i),c.continue??(c.continue=!i._zod.def.abort),s.issues.push(Hl(c))}},e(s.value,s)),r);return i}function I3(e,r){const i=new qn({check:"custom",...Re(r)});return i._zod.check=e,i}function Al(e,...r){for(const i of r)for(const s of Reflect.ownKeys(i))Object.prototype.propertyIsEnumerable.call(i,s)&&Sa(e,s,i[s]);return e}function cS(e){let r=e?.target??"draft-2020-12";return r==="draft-4"&&(r="draft-04"),r==="draft-7"&&(r="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??El,target:r,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??"ref",reused:e?.reused??"inline",intersections:[],deferred:[],external:e?.external??void 0}}function gi(e,r,i,s,l){const c=typeof r.unrepresentable=="function"?r.unrepresentable({zodSchema:e,path:s.path,message:l}):r.unrepresentable;if(c==="any")return!1;if(c===void 0||c==="throw")throw new Error(l);return Object.assign(i,c),!0}function Gt(e,r,i={path:[],schemaPath:[]}){var s;const l=e._zod.def,c=r.seen.get(e);if(c)return c.count++,i.schemaPath.includes(e)&&(c.cycle=i.path),c.schema;const d={schema:{},count:1,cycle:void 0,path:i.path};r.seen.set(e,d),r.sharedDefsExtractedFor=void 0,r.sharedEmitDoneFor=void 0;const f=e._zod.toJSONSchema?.();if(f)d.schema=f;else{const v={...i,schemaPath:[...i.schemaPath,e],path:i.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(r,d.schema,v);else{const x=d.schema,w=r.processors[l.type];if(!w)throw new Err)DELIM" +R"DELIM(or(`[toJSONSchema]: Non-representable type encountered: ${l.type}`);w(e,r,x,v)}const y=e._zod.parent;y&&(d.ref||(d.ref=y),Gt(y,r,v),r.seen.get(y).isParent=!0)}const m=r.metadataRegistry.get(e);return m&&Al(d.schema,m),r.io==="input"&&On(e)&&(delete d.schema.examples,delete d.schema.default),r.io==="input"&&"_prefault"in d.schema&&((s=d.schema).default??(s.default=d.schema._prefault)),delete d.schema._prefault,r.seen.get(e).schema}function Dx(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function uS(e,r){const i=e.seen.get(r);if(!i)throw new Error("Unprocessed schema. This is a bug in Zod.");if(e.external&&e.sharedDefsExtractedFor===e.external)return;const s=new Map;for(const d of e.seen.entries()){const f=e.metadataRegistry.get(d[0])?.id;if(f){const m=s.get(f);if(m&&m!==d[0])throw new Error(`Duplicate schema id "${f}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);s.set(f,d[0])}}const l=d=>{const f=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const y=e.external.registry.get(d[0])?.id,x=e.external.uri??(E=>E);if(y)return{ref:x(y)};const w=d[1].defId??d[1].schema.id??`schema${e.counter++}`;return d[1].defId=w,{defId:w,ref:`${x("__shared")}#/${f}/${Dx(w)}`}}const m="#",g=`${m}/${f}/`;if(d[1]===i&&!d[1].schema.id)return{ref:m};const v=d[1].schema.id??`__schema${e.counter++}`;return{defId:v,ref:g+Dx(v)}},c=d=>{if(d[1].schema.$ref)return;const f=d[1],{ref:m,defId:g}=l(d);f.def={...f.schema},g&&(f.defId=g);const v=f.schema;for(const y in v)delete v[y];v.$ref=m};if(e.cycles==="throw")for(const d of e.seen.entries()){const f=d[1];if(f.cycle)throw new Error(`Cycle detected: #/${f.cycle?.join("/")}/ -Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const d of e.seen.entries()){const f=d[1];if(r===d[0]){c(d);continue}if(e.external){const g=e.external.registry.get(d[0])?.id;if(r!==d[0]&&g){c(d);continue}}if(e.metadataRegistry.get(d[0])?.id){c(d);continue}if(f.cycle){c(d);continue}f.count>1&&e.reused==="ref"&&c(d)}e.external&&(e.sharedDefsExtractedFor=e.external)}function fS(e){const r=e.anyOf;if(!Array.isArray(r)||r.length===0||e.type!==void 0)return;const i=[];for(const s of r){if(!s||typeof s!="object")return;fS(s);const l=Object.keys(s);if(l.length!==1||l[0]!=="type")return;const c=s.type;for(const d of Array.isArray(c)?c:[c]){if(typeof d!="string")return;i.includes(d)||i.push(d)}}delete e.anyOf,e.type=i.length===1?i[0]:i}const hS=new Set(["type","properties","required","additionalProperties"]),Lx=["oneOf","anyOf"];function Ux(e){const r=e.additionalProperties;return r===void 0||r===!1||typeof r!="object"||r===null?null:Object.keys(r).length?r:null}function dp(e){const r=[];for(const c of e){if(typeof c!="object"||c.type!=="object")return null;for(const d in c)if(!hS.has(d))return null;r.push(c)}const i={},s=new Set;for(const c of r){for(const d in c.properties){if(Object.prototype.hasOwnProperty.call(i,d))continue;const f=[];for(const g of r){const v=g.properties?.[d]??Ux(g);v!=null&&(f.some(y=>JSON.stringify(y)===JSON.stringify(v))||f.push(v))}const m=f.length===1?f[0]:dp(f)??{allOf:f};wa(i,d,m)}for(const d of c.required??[])s.add(d)}const l={type:"object",properties:i};if(s.size&&(l.required=[...s]),r.every(c=>c.additionalProperties===!1))l.additionalProperties=!1;else{const c=[];for(const d of r){const f=Ux(d);f&&!c.some(m=>JSON.stringify(m)===JSON.stringify(f))&&c.push(f)}c.length===1?l.additionalProperties=c[0]:c.length>1&&(l.additionalProperties={allOf:c})}return l}function F3(e){const r=e.allOf;if(!Array.isArray(r)||r.length<2)return;for(const l of hS)if(l in e)return;const i=r.filter(l=>Lx.some(c=>Array.isArray(l[c])));let s=null;if(!i.length)s=dp(r);else{const l=i[0],c=Lx.find(m=>Array.isArray(l[m]));if(Object.keys(l).length!==1)return;const d=r.filter(m=>m!==l),f=l[c].map(m=>dp([...d,m]));if(f.some(m=>!m))return;s={[c]:f}}s&&(delete e.allOf,Al(e,s))}function mS(e,r){const i=e.seen.get(r);if(!i)throw new Error("Unprocessed schema. This is a bug in Zod.");const s=f=>{const m=e.seen.get(f);if(m.ref===null)return;const g=m.def??m.schema,v={...g},y=m.ref;if(m.ref=null,y){s(y);const w=e.seen.get(y),E=w.schema;if(E.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(g.allOf=g.allOf??[],g.allOf.push(E)):Al(g,E),Al(g,v),f._zod.parent===y)for(const N in g)N==="$ref"||N==="allOf"||N in v||delete g[N];if(E.$ref&&w.def)for(const N in g)N==="$ref"||N==="allOf"||N in w.def&&JSON.stringify(g[N])===JSON.stringify(w.def[N])&&delete g[N]}const x=f._zod.parent;if(x&&x!==y){s(x);const w=e.seen.get(x);if(w?.schema.$ref&&(g.$ref=w.schema.$ref,w.def))for(const E in g)E==="$ref"||E==="allOf"||E in w.def&&JSON.stringify(g[E])===JSON.stringify(w.def[E])&&delete g[E]}e.override({zodSchema:f,jsonSchema:g,path:m.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(const f of[...e.seen.entries()].reverse())s(f[0]);if(e.target!=="openapi-3.0")for(const f of e.seen.entries())fS(f[1].def??f[1].schema);for(const f of e.deferred)f();if(e.intersections.length){const f=new Map;for(const m of e.seen.values())for(const g of[m.schema,m.def]){const v=g?.allOf;if(!Array.isArray(v))continue;const y=f.get(v);y?y.push(g):f.set(v,[g])}for(const m of e.intersections)for(const g of f.get(m)??[])F3(g)}}const l={};if(e.target==="draft-2020-12"?l.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?l.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?l.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){const f=e.external.registry.get(r)?.id;if(!f)throw new Error("Schema is missing an `id` property");l.$id=e.external.uri(f)}Al(l,i.defId?i.schema:i.def??i.schema);const c=e.metadataRegistry.get(r)?.id;c!==void 0&&l.id===c&&delete l.id;const d=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(const f of e.seen.entries()){const m=f[1];m.def&&m.defId&&(m.def.id===m.defId&&delete m.def.id,wa(d,m.defId,m.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(d).length>0&&(e.target==="draft-2020-12"?l.$defs=d:l.definitions=d);try{const f=JSON.parse(JSON.stringify(l));return Object.defineProperty(f,"~standard",{value:{...r["~standard"],jsonSchema:{input:ud(r,"input",e.processors),output:ud(r,"output",e.processors)}},enumerable:!1,writable:!1}),f}catch{throw new Error("Error converting schema to JSON.")}}function On(e,r){const i=r??{seen:new Set};if(i.seen.has(e))return!1;i.seen.add(e);const s=e._zod.def;if(s.type==="transform")return!0;if(s.type==="array")return On(s.element,i);if(s.type==="set")return On(s.valueType,i);if(s.type==="lazy")return On(s.getter(),i);if(s.type==="promise"||s.type==="optional"||s.type==="nonoptional"||s.type==="nullable"||s.type==="readonly"||s.type==="default"||s.type==="prefault"||s.type==="catch")return On(s.innerType,i);if(s.type==="intersection")return On(s.left,i)||On(s.right,i);if(s.type==="record"||s.type==="map")return On(s.keyType,i)||On(s.valueType,i);if(s.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:On(s.in,i)||On(s.out,i);if(s.type==="object"){for(const l in s.shape)if(On(s.shape[l],i))return!0;return!1}if(s.type==="union"){for(const l of s.options)if(On(l,i))return!0;return!1}if(s.type==="tuple"){for(const l of s.items)if(On(l,i))return!0;return!!(s.rest&&On(s.rest,i))}return!1}const V3=(e,r={})=>i=>{const s=uS({...i,processors:r});return Gt(e,s),dS(s,e),mS(s,e)},ud=(e,r,i={})=>s=>{const{libraryOptions:l,target:c}=s??{},d=uS({...l??{},target:c,io:r,processors:i});return Gt(e,d),dS(d,e),mS(d,e)},oo=(e,r,i)=>{(e[r]===void 0||i>e[r])&&(e[r]=i)},lo=(e,r,i)=>{(e[r]===void 0||i{oo(e,"minimum",r),lo(e,"maximum",r)},pS=(e,r)=>{e.multipleOf??(e.multipleOf=[]),e.multipleOf.includes(r)||e.multipleOf.push(r)},gS=(e,r)=>{e.patterns??(e.patterns=new Set),e.patterns.add(r)},yS=(e,r)=>{e.mime=e.mime?e.mime.filter(i=>r.includes(i)):[...r]},vS=(e,r)=>{e.format=r,)DELIM" -R"DELIM(r.includes("int")&&(e.isInt=!0)},Px=(e,r)=>oo(e,"minimum",r.minimum),$x=(e,r)=>lo(e,"maximum",r.maximum),qx=e=>(r,i)=>{vS(r,i.format);const[s,l]=e[i.format];oo(r,"minimum",s),lo(r,"maximum",l)},Y3={greater_than:(e,r)=>oo(e,r.inclusive?"minimum":"exclusiveMinimum",r.value),less_than:(e,r)=>lo(e,r.inclusive?"maximum":"exclusiveMaximum",r.value),multiple_of:(e,r)=>pS(e,r.value),number_format:qx(Uw),bigint_format:qx(c4),min_length:Px,max_length:$x,length_equals:(e,r)=>Hx(e,r.length),min_size:Px,max_size:$x,size_equals:(e,r)=>Hx(e,r.size),string_format:(e,r)=>{vS(e,r.format),r.pattern&&gS(e,r.pattern),(r.format==="base64"||r.format==="base64url")&&(e.contentEncoding=r.format),(r.local||r.precision===-1)&&(e.laxFormat=!0)},mime_type:(e,r)=>yS(e,r.mime)};function Cr(e){const r={},i=e._zod.def,s=e._zod.traits.has("$ZodCheck")?[e,...i.checks??[]]:i.checks??[];for(const c of s)Y3[c._zod.def.check]?.(r,c._zod.def);const l=e._zod.bag;l.minimum!==void 0&&oo(r,"minimum",l.minimum),l.exclusiveMinimum!==void 0&&oo(r,"exclusiveMinimum",l.exclusiveMinimum),l.maximum!==void 0&&lo(r,"maximum",l.maximum),l.exclusiveMaximum!==void 0&&lo(r,"exclusiveMaximum",l.exclusiveMaximum),l.multipleOf!==void 0&&pS(r,l.multipleOf),l.format!==void 0&&(r.format??(r.format=l.format),l.format.includes("int")&&(r.isInt=!0)),l.mime&&yS(r,l.mime);for(const c of l.patterns??[])gS(r,c);return r}const G3={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},K3=new Map([[Ww,uN],[ag,dN]]),bS=e=>K3.get(e)??e,Q3=(e,r,i,s)=>{const l=i;l.type="string";const{minimum:c,maximum:d,format:f,patterns:m,contentEncoding:g,laxFormat:v}=Cr(e);if(typeof c=="number"&&(l.minLength=c),typeof d=="number"&&(l.maxLength=d),f&&(l.format=G3[f]??f,l.format===""&&delete l.format,(f==="time"||v)&&delete l.format),g&&(l.contentEncoding=g),m&&m.size>0){const y=[...m].map(bS);y.length===1?l.pattern=y[0].source:y.length>1&&(l.allOf=[...y.map(x=>({...r.target==="draft-07"||r.target==="draft-04"||r.target==="openapi-3.0"?{type:"string"}:{},pattern:x.source}))])}},X3=(e,r,i,s)=>{const l=i,{minimum:c,maximum:d,multipleOf:f,exclusiveMaximum:m,exclusiveMinimum:g,isInt:v}=Cr(e);l.type=v?"integer":"number";const y=typeof g=="number"&&g>=(c??Number.NEGATIVE_INFINITY),x=typeof m=="number"&&m<=(d??Number.POSITIVE_INFINITY),w=r.target==="draft-04"||r.target==="openapi-3.0";if(y?w?(l.minimum=g,l.exclusiveMinimum=!0):l.exclusiveMinimum=g:typeof c=="number"&&(l.minimum=c),x?w?(l.maximum=m,l.exclusiveMaximum=!0):l.exclusiveMaximum=m:typeof d=="number"&&(l.maximum=d),f){const E=new Set;for(const H of f)Number.isFinite(H)&&H!==0?E.add(Math.abs(H)):gi(e,r,l,s,`A multipleOf divisor of ${H} cannot be represented in JSON Schema`);const[_,...N]=E;_!==void 0&&(l.multipleOf=_),N.length&&(l.allOf=[...l.allOf??[],...N.map(H=>({multipleOf:H}))])}},J3=(e,r,i,s)=>{i.type="boolean"},W3=(e,r,i,s)=>{i.not={}},ej=(e,r,i,s)=>{},tj=(e,r,i,s)=>{const l=e._zod.def,c=ip(l.entries);if(c.length===0){i.not={};return}c.every(d=>typeof d=="number")&&(i.type="number"),c.every(d=>typeof d=="string")&&(i.type="string"),i.enum=c},nj=(e,r,i,s)=>{const l=e._zod.def;if(l.values.length===0){i.not={};return}const c=[];for(const d of l.values)if(d===void 0){if(gi(e,r,i,s,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof d=="bigint"){if(gi(e,r,i,s,"BigInt literals cannot be represented in JSON Schema"))return;c.push(Number(d))}else c.push(d);if(c.length!==0)if(c.length===1){const d=c[0];i.type=d===null?"null":typeof d,r.target==="draft-04"||r.target==="openapi-3.0"?i.enum=[d]:i.const=d}else c.every(d=>typeof d=="number")&&(i.type="number"),c.every(d=>typeof d=="string")&&(i.type="string"),c.every(d=>typeof d=="boolean")&&(i.type="boolean"),c.every(d=>d===null)&&(i.type="null"),i.enum=c},rj=(e,r,i,s)=>{gi(e,r,i,s,"Custom types cannot be represented in JSON Schema")},aj=(e,r,i,s)=>{gi(e,r,i,s,"Transforms cannot be represented in JSON Schema")},ij=(e,r,i,s)=>{const l=i,c=e._zod.def,{minimum:d,maximum:f}=Cr(e);typeof d=="number"&&(l.minItems=d),typeof f=="number"&&(l.maxItems=f),l.type="array",l.items=Gt(c.element,r,{...s,path:[...s.path,"items"]})};function dd(e){const r=e._zod.def;return r.type==="pipe"&&r.in._zod.traits.has("$ZodTransform")?dd(r.out):r.type==="catch"?dd(r.innerType):e._zod.optin}const sj=(e,r,i,s)=>{const l=i,c=e._zod.def,d=c.shape;if(Object.getOwnPropertySymbols(d).length&&gi(e,r,l,s,"Symbol keys cannot be represented in JSON Schema"))return;l.type="object",l.properties={};for(const g in d)wa(l.properties,g,Gt(d[g],r,{...s,path:[...s.path,"properties",g]}));const m=[];for(const g of Object.keys(d)){const v=c.shape[g];(r.io==="input"?dd(v)===void 0:v._zod.optout===void 0)&&m.push(g)}m.length>0&&(l.required=m),c.catchall?._zod.def.type==="never"?l.additionalProperties=!1:c.catchall?c.catchall&&(l.additionalProperties=Gt(c.catchall,r,{...s,path:[...s.path,"additionalProperties"]})):r.io==="output"&&(l.additionalProperties=!1)},oj=(e,r,i,s)=>{const l=e._zod.def,c=l.inclusive===!1,d=l.options.map((f,m)=>Gt(f,r,{...s,path:[...s.path,c?"oneOf":"anyOf",m]}));c?i.oneOf=d:i.anyOf=d},lj=(e,r,i,s)=>{const l=e._zod.def,c=Gt(l.left,r,{...s,path:[...s.path,"allOf",0]}),d=Gt(l.right,r,{...s,path:[...s.path,"allOf",1]}),f=g=>"allOf"in g&&Object.keys(g).length===1,m=[...f(c)?c.allOf:[c],...f(d)?d.allOf:[d]];i.allOf=m,r.intersections.push(m)};function fp(e,r,i){if(r.$ref){if(i.has(r))return r;i.add(r);const E=e.get(r)?.def;if(!E)return r;const _=fp(e,E,i);return _===E?r:_}for(const E of["anyOf","oneOf"]){const _=r[E];if(!Array.isArray(_))continue;const N=_.map(H=>fp(e,H,i));N.some((H,O)=>H!==_[O])&&(r={...r,[E]:N})}const s=Array.isArray(r.type)?r.type:[r.type],l=!s.includes("string")&&s.some(E=>E==="number"||E==="integer"),c=r.enum??(r.const!==void 0?[r.const]:void 0);if(!l&&!c?.some(E=>typeof E=="number"))return r;const{minimum:d,maximum:f,exclusiveMinimum:m,exclusiveMaximum:g,multipleOf:v,format:y,id:x,...w}=r;return w.enum?w.enum=w.enum.map(E=>typeof E=="number"?String(E):E):typeof w.const=="number"&&(w.const=String(w.const)),l&&(w.type="string",c||(w.pattern=(s.includes("number")?tg:bN).source)),w}const hp=new WeakMap;function cj(e){const r=new Map;for(const s of e.seen.values())s.def&&!r.has(s.schema)&&r.set(s.schema,s);const i=new Map;for(const s of hp.get(e)??[]){const l=e.seen.get(s),c=(l?.def??l?.schema)?.propertyNames;if(!c||c===!0||i.has(c))continue;const d=fp(r,c,new Set);d!==c&&i.set(c,d)}if(i.size)for(const s of e.seen.values())for(const l of[s.schema,s.def]){const c=l&&i.get(l.propertyNames);c&&(l.propertyNames=c)}}const uj=(e,r,i,s)=>{const l=i,c=e._zod.def;l.type="object";const d=c.keyType,f=Cr(d).patterns;if(c.mode==="loose"&&f&&f.size>0){const v=Gt(c.valueType,r,{...s,path:[...s.path,"patternProperties","*"]});l.patternProperties={};for(const y of f)wa(l.patternProperties,bS(y).source,v)}else{if(r.target==="draft-07"||r.target==="draft-2020-12"){l.propertyNames=Gt(c.keyType,r,{...s,path:[...s.path,"propertyNames"]});let v=hp.get(r);v||(v=[],hp.set(r,v),r.deferred.push(()=>cj(r))),v.push(e)}l.additionalProperties=Gt(c.valueType,r,{...s,path:[...s.path,"additionalProperties"]})}const m=d._zod.values,g=r.io==="input"&&dd(c.valueType)!==void 0;if(m&&!c.partial&&!g){const v=[...m].filter(y=>typeof y=="string"||typeof y=="number");v.length>0&&(l.required=v.map(String))}},dj=(e,r,i,s)=>{const l=e._zod.def,c=Gt(l.innerType,r,s),d=r.seen.get(e);r.target==="openapi-3.0"?(d.ref=l.innerType,i.nullable=!0):i.anyOf=[c,{type:"null"}]},fj=(e,r,i,s)=>{const l=e._zod.def;Gt(l.innerType,r,s);const c=r.seen.get(e);c.ref=l.innerType},ig=Symbol();function xS(e,r,i,s,l){let c=!1;const d=JSON.stringify(e,(f,m)=>typeof m!="bigint"?m:(c=!0,null));return c?(gi(r,i,s,l,"BigInt defaults cannot be represented in JSON Schema"),ig):JSON.parse(d)}const hj=(e,r,i,s)=>{const l=e._zod.def;Gt(l.innerType,r,s);const c=r.seen.get(e);c.ref=l.innerType;const d=xS(l.defaultValue,e,r,i,s);d!==ig&&(i.default=d)},mj=(e,r,i,s)=>{const l=e._zod.def;G)DELIM" -R"DELIM(t(l.innerType,r,s);const c=r.seen.get(e);if(c.ref=l.innerType,r.io!=="input")return;const d=xS(l.defaultValue,e,r,i,s);d!==ig&&(i._prefault=d)},pj=(e,r,i,s)=>{const l=e._zod.def;Gt(l.innerType,r,s);const c=r.seen.get(e);c.ref=l.innerType;let d;try{d=l.catchValue(void 0)}catch{gi(e,r,i,s,"Dynamic catch values are not supported in JSON Schema");return}i.default=d},gj=(e,r,i,s)=>{const l=e._zod.def,c=l.in._zod.traits.has("$ZodTransform"),d=r.io==="input"?c?l.out:l.in:l.out;Gt(d,r,s);const f=r.seen.get(e);f.ref=d},yj=(e,r,i,s)=>{const l=e._zod.def;Gt(l.innerType,r,s);const c=r.seen.get(e);c.ref=l.innerType,i.readOnly=!0},wS=(e,r,i,s)=>{const l=e._zod.def;Gt(l.innerType,r,s);const c=r.seen.get(e);c.ref=l.innerType},Zx=new WeakSet([Object.prototype,Error.prototype]);function Au(e,r,i){Object.defineProperty(e,r,{configurable:!0,enumerable:!1,get(){const s=i(this);return Object.defineProperty(this,r,{value:s,configurable:!0,writable:!0}),s},set(s){Object.defineProperty(this,r,{value:s,configurable:!0,writable:!0})}})}const vj=(e,r)=>{A4.init(e,r),e.name="ZodError";const i=Object.getPrototypeOf(e);Zx.has(i)||(Zx.add(i),Au(i,"format",s=>l=>z4(s,l)),Au(i,"flatten",s=>l=>M4(s,l)),Au(i,"addIssue",s=>l=>{s.issues.push(l),s.message=JSON.stringify(s.issues,sp,2)}),Au(i,"addIssues",s=>l=>{s.issues.push(...l),s.message=JSON.stringify(s.issues,sp,2)}),Object.defineProperty(i,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},gr=ae("ZodError",vj,void 0,{Parent:Error}),bj=Xp(gr),xj=Jp(gr),wj=Wp(gr),Sj=eg(gr),Ej=P4(gr),Tj=$4(gr),kj=q4(gr),_j=Z4(gr),Nj=I4(gr),Cj=F4(gr),jj=V4(gr),Rj=Y4(gr);function Aj(){Rr.localeError||Wr(KC())}function _d(){Rr.memoizer||Wr({memoizer:VC()})}const Mt=ae("ZodType",(e,r)=>(Aj(),Ot.init(e,r),e.def=r,e.type=r.type,e),{check(...e){const r=this.def;return this.clone(Wn(r,{checks:[...r.checks??[],...e.map(i=>typeof i=="function"?{_zod:{check:i,def:{check:"custom"},onattach:[]}}:i)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,r){return yi(this,e,r)},brand(){return this},register(e,r){return e.add(this,r),this},refine(e,r){return this.check(RR(e,r))},superRefine(e,r){return this.check(AR(e,r))},overwrite(e){return this.check(ho(e))},optional(){return Vx(this)},exactOptional(){return yR(this)},nullable(){return Yx(this)},nullish(){return Vx(Yx(this))},nonoptional(e){return ER(this,e)},array(){return ea(this)},or(e){return lR([this,e])},and(e){return dR(this,e)},transform(e){return Gx(this,gR(e))},default(e){return xR(this,e)},prefault(e){return SR(this,e)},catch(e){return kR(this,e)},pipe(e){return Gx(this,e)},readonly(){return CR(this)},describe(e){const r=this.clone();return El.add(r,{description:e}),r},meta(...e){if(e.length===0)return El.get(this);const r=this.clone();return El.add(r,e[0]),r},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...r){return r.length===0?e(this):e(this,...r)},get"~standard"(){return Pw(this,"~standard",{...Gw(this),jsonSchema:{input:ud(this,"input"),output:ud(this,"output")}})},set"~standard"(e){pi(this,"~standard",e)},parse:function e(r,i){return bj(this,r,i,{callee:e})},parseAsync:async function e(r,i){return await xj(this,r,i,{callee:e})},safeParse(e,r){return wj(this,e,r)},async safeParseAsync(e,r){return Sj(this,e,r)},get spa(){return this?.safeParseAsync},set spa(e){pi(this,"spa",e)},validate(e,r){return L4(this,e,r)},validateAsync(e,r){return H4(this,e,r)},encode:function e(r,i){return Ej(this,r,i,{callee:e})},decode:function e(r,i){return Tj(this,r,i,{callee:e})},encodeAsync:async function e(r,i){return await kj(this,r,i,{callee:e})},decodeAsync:async function e(r,i){return await _j(this,r,i,{callee:e})},safeEncode(e,r){return Nj(this,e,r)},safeDecode(e,r){return Cj(this,e,r)},async safeEncodeAsync(e,r){return jj(this,e,r)},async safeDecodeAsync(e,r){return Rj(this,e,r)},toJSONSchema(e){return V3(this,{})(e)},get description(){return El.get(this)?.description},get _def(){return this._zod.def}}),SS=ae("_ZodString",(e,r)=>{rg.init(e,r),Mt.init(e,r),e._zod.processJSONSchema=(i,s,l)=>Q3(e,i,s)},$w({format:e=>Cr(e).format??null,minLength:e=>Cr(e).minimum??null,maxLength:e=>Cr(e).maximum??null},{regex(...e){return this.check(R3(...e))},includes(...e){return this.check(M3(...e))},startsWith(...e){return this.check(z3(...e))},endsWith(...e){return this.check(D3(...e))},min(...e){return this.check(cd(...e))},max(...e){return this.check(lS(...e))},length(...e){return this.check(cS(...e))},nonempty(...e){return this.check(cd(1,...e))},lowercase(e){return this.check(A3(e))},uppercase(e){return this.check(O3(e))},trim(){return this.check(L3())},normalize(...e){return this.check(B3(...e))},toLowerCase(){return this.check(U3())},toUpperCase(){return this.check(H3())},slugify(){return this.check(P3())}})),Oj=ae("ZodString",(e,r)=>{rg.init(e,r),SS.init(e,r)},{email(e){return this.check(WC(Lj,e))},url(e){return this.check(i3(Hj,e))},jwt(e){return this.check(x3(eR,e))},emoji(e){return this.check(s3(Pj,e))},guid(e){return this.check(e3(Uj,e))},uuid(e){return this.check(t3(Ou,e))},uuidv4(e){return this.check(n3(Ou,e))},uuidv6(e){return this.check(r3(Ou,e))},uuidv7(e){return this.check(a3(Ou,e))},nanoid(e){return this.check(o3($j,e))},cuid(e){return this.check(l3(qj,e))},cuid2(e){return this.check(c3(Zj,e))},ulid(e){return this.check(u3(Ij,e))},base64(e){return this.check(y3(Xj,e))},base64url(e){return this.check(v3(Jj,e))},xid(e){return this.check(d3(Fj,e))},ksuid(e){return this.check(f3(Vj,e))},ipv4(e){return this.check(h3(Yj,e))},ipv6(e){return this.check(m3(Gj,e))},cidrv4(e){return this.check(p3(Kj,e))},cidrv6(e){return this.check(g3(Qj,e))},e164(e){return this.check(b3(Wj,e))},datetime(e){return this.check(w3(Mj,e))},date(e){return this.check(S3(zj,e))},time(e){return this.check(E3(Dj,e))},duration(e){return this.check(T3(Bj,e))}});function et(e){return JC(Oj,e)}const zt=ae("ZodStringFormat",(e,r)=>{jt.init(e,r),SS.init(e,r)}),Mj=ae("ZodISODateTime",(e,r)=>{eC.init(e,r),zt.init(e,r)}),zj=ae("ZodISODate",(e,r)=>{tC.init(e,r),zt.init(e,r)}),Dj=ae("ZodISOTime",(e,r)=>{nC.init(e,r),zt.init(e,r)}),Bj=ae("ZodISODuration",(e,r)=>{rC.init(e,r),zt.init(e,r)}),Lj=ae("ZodEmail",(e,r)=>{PN.init(e,r),zt.init(e,r)}),Uj=ae("ZodGUID",(e,r)=>{UN.init(e,r),zt.init(e,r)}),Ou=ae("ZodUUID",(e,r)=>{HN.init(e,r),zt.init(e,r)}),Hj=ae("ZodURL",(e,r)=>{VN.init(e,r),zt.init(e,r)}),Pj=ae("ZodEmoji",(e,r)=>{YN.init(e,r),zt.init(e,r)}),$j=ae("ZodNanoID",(e,r)=>{GN.init(e,r),zt.init(e,r)}),qj=ae("ZodCUID",(e,r)=>{KN.init(e,r),zt.init(e,r)}),Zj=ae("ZodCUID2",(e,r)=>{QN.init(e,r),zt.init(e,r)}),Ij=ae("ZodULID",(e,r)=>{XN.init(e,r),zt.init(e,r)}),Fj=ae("ZodXID",(e,r)=>{JN.init(e,r),zt.init(e,r)}),Vj=ae("ZodKSUID",(e,r)=>{WN.init(e,r),zt.init(e,r)}),Yj=ae("ZodIPv4",(e,r)=>{aC.init(e,r),zt.init(e,r)}),Gj=ae("ZodIPv6",(e,r)=>{sC.init(e,r),zt.init(e,r)}),Kj=ae("ZodCIDRv4",(e,r)=>{oC.init(e,r),zt.init(e,r)}),Qj=ae("ZodCIDRv6",(e,r)=>{cC.init(e,r),zt.init(e,r)}),Xj=ae("ZodBase64",(e,r)=>{uC.init(e,r),zt.init(e,r)}),Jj=ae("ZodBase64URL",(e,r)=>{fC.init(e,r),zt.init(e,r)}),Wj=ae("ZodE164",(e,r)=>{hC.init(e,r),zt.init(e,r)}),eR=ae("ZodJWT",(e,r)=>{pC.init(e,r),zt.init(e,r)}),ES=ae("ZodNumber",(e,r)=>{eS.init(e,r),Mt.init(e,r),e._zod.processJSONSchema=(i,s,l)=>X3(e,i,s,l),e.isFinite=!0},$w({minValue:e=>{const{minimum:r,exclusiveMinimum:i}=Cr(e);return Math.max(r??Number.NEGATIVE_INFINITY,i??Number.NEGATIVE_INFINITY)},maxValue:e=>{const{maximum:r,exclusiveMaximum:i}=Cr(e);return Math.min(r??Number.POSITIVE_INFINITY,i??Number.POSITIVE_INFINITY)},isInt:e=>{const{isInt:r,multipleOf:i}=Cr(e);return!!r||!!i?.some(Number.isSafeInteger)},format:e=>Cr(e).format??null},{gt(e,r){return this.check(zx(e,r))},gte(e,r){return this.check(Em(e,r))},min(e,r){return this.check(Em(e,r))},lt(e,r){return this.check(Mx(e,r))},lte(e,r){return this.check(Sm(e,r))},max(e,r){return this.check(Sm(e,r))},int(e){return this.check(Ix(e))},safe(e){return this.check(Ix(e))},positive(e){return th)DELIM" -R"DELIM(is.check(zx(0,e))},nonnegative(e){return this.check(Em(0,e))},negative(e){return this.check(Mx(0,e))},nonpositive(e){return this.check(Sm(0,e))},multipleOf(e,r){return this.check(Dx(e,r))},step(e,r){return this.check(Dx(e,r))},finite(){return this}}));function Ve(e){return k3(ES,e)}const tR=ae("ZodNumberFormat",(e,r)=>{gC.init(e,r),ES.init(e,r)});function Ix(e){return _3(tR,e)}const nR=ae("ZodBoolean",(e,r)=>{yC.init(e,r),Mt.init(e,r),e._zod.processJSONSchema=(i,s,l)=>J3(e,i,s)});function li(e){return N3(nR,e)}const rR=ae("ZodUnknown",(e,r)=>{vC.init(e,r),Mt.init(e,r),e._zod.processJSONSchema=(i,s,l)=>ej()});function mp(){return C3(rR)}const aR=ae("ZodNever",(e,r)=>{bC.init(e,r),Mt.init(e,r),e._zod.processJSONSchema=(i,s,l)=>W3(e,i,s)});function iR(e){return j3(aR,e)}const sR=ae("ZodArray",(e,r)=>{_d(),SC.init(e,r),Mt.init(e,r),e._zod.processJSONSchema=(i,s,l)=>ij(e,i,s,l),e.element=r.element},{min(e,r){return this.check(cd(e,r))},nonempty(e){return this.check(cd(1,e))},max(e,r){return this.check(lS(e,r))},length(e,r){return this.check(cS(e,r))},unwrap(){return this.element}});function ea(e,r){return $3(sR,e,r)}const oR=ae("ZodObject",(e,r)=>{_d(),kC.init(e,r),Mt.init(e,r),e._zod.processJSONSchema=(i,s,l)=>sj(e,i,s,l),E4(e,"shape",i=>i._zod.def.shape,!1)},{keyof(){return hR(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(Wn(this._zod.def,{catchall:e}))},passthrough(){return this.clone(Wn(this._zod.def,{catchall:mp()}))},loose(){return this.clone(Wn(this._zod.def,{catchall:mp()}))},strict(){return this.clone(Wn(this._zod.def,{catchall:iR()}))},strip(){return this.clone(Wn(this._zod.def,{catchall:void 0}))},extend(e){return f4(this,e)},safeExtend(e){return h4(this,e)},merge(e){return m4(this,e)},pick(e){return u4(this,e)},omit(e){return d4(this,e)},partial(...e){return px(_S,this,e[0])},exactPartial(...e){return px(NS,this,e[0],"exactPartial")},required(...e){return p4(CS,this,e[0])}});function Tt(e,r){const i={type:"object",shape:e??{},...Re(r)};return new oR(i)}const TS=ae("ZodUnion",(e,r)=>{rS.init(e,r),Mt.init(e,r),e._zod.processJSONSchema=(i,s,l)=>oj(e,i,s,l),e.options=r.options});function lR(e,r){return new TS({type:"union",options:e,...Re(r)})}const cR=ae("ZodDiscriminatedUnion",(e,r)=>{TS.init(e,r),NC.init(e,r)});function kS(e,r,i){return new cR({type:"union",options:r,discriminator:e,...Re(i)})}const uR=ae("ZodIntersection",(e,r)=>{CC.init(e,r),Mt.init(e,r),e._zod.processJSONSchema=(i,s,l)=>lj(e,i,s,l)});function dR(e,r){return new uR({type:"intersection",left:e,right:r})}const Fx=ae("ZodRecord",(e,r)=>{_d(),jC.init(e,r),Mt.init(e,r),e._zod.processJSONSchema=(i,s,l)=>uj(e,i,s,l),e.keyType=r.keyType,e.valueType=r.valueType});function fR(e,r,i){return!r||!r._zod?new Fx({type:"record",keyType:et(),valueType:e,...Re(r)}):new Fx({type:"record",keyType:e,valueType:r,...Re(i)})}const pp=ae("ZodEnum",(e,r)=>{RC.init(e,r),Mt.init(e,r),e._zod.processJSONSchema=(s,l,c)=>tj(e,s,l),e.enum=r.entries,e.options=[...e._zod.values];const i=new Set(Object.keys(r.entries));e.extract=(s,l)=>{const c={};for(const d of s)if(i.has(d))c[d]=r.entries[d];else throw new Error(`Key ${d} not found in enum`);return new pp({...r,checks:[],...Re(l),entries:c})},e.exclude=(s,l)=>{const c={...r.entries};for(const d of s)if(i.has(d))delete c[d];else throw new Error(`Key ${d} not found in enum`);return new pp({...r,checks:[],...Re(l),entries:c})}});function hR(e,r){const i=Array.isArray(e)?Object.fromEntries(e.map(s=>[s,s])):e;return new pp({type:"enum",entries:i,...Re(r)})}const mR=ae("ZodLiteral",(e,r)=>{AC.init(e,r),Mt.init(e,r),e._zod.processJSONSchema=(i,s,l)=>nj(e,i,s,l),e.values=new Set(r.values),Object.defineProperty(e,"value",{get(){if(r.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return r.values[0]}})});function ci(e,r){return new mR({type:"literal",values:Array.isArray(e)?e:[e],...Re(r)})}const pR=ae("ZodTransform",(e,r)=>{_d(),OC.init(e,r),Mt.init(e,r),e._zod.processJSONSchema=(i,s,l)=>aj(e,i,s,l),e._zod.parse=(i,s)=>{if(s.direction==="backward")throw new qw(e.constructor.name);i.addIssue=c=>{if(typeof c=="string")i.issues.push(Hl(c,i.value,r));else{const d=c;d.fatal&&(d.continue=!1),d.code??(d.code="custom"),"input"in d||(d.input=i.value),d.inst??(d.inst=e),i.issues.push(Hl(d))}};const l=r.transform(i.value,i);return l instanceof Promise?l.then(c=>(i.value=c,i)):(i.value=l,i)}});function gR(e){return new pR({type:"transform",transform:e})}const _S=ae("ZodOptional",(e,r)=>{aS.init(e,r),Mt.init(e,r),e._zod.processJSONSchema=(i,s,l)=>wS(e,i,s,l),e.unwrap=()=>e._zod.def.innerType});function Vx(e){return new _S({type:"optional",innerType:e})}const NS=ae("ZodExactOptional",(e,r)=>{MC.init(e,r),Mt.init(e,r),e._zod.processJSONSchema=(i,s,l)=>wS(e,i,s,l),e.unwrap=()=>e._zod.def.innerType});function yR(e){return new NS({type:"optional",innerType:e})}const vR=ae("ZodNullable",(e,r)=>{zC.init(e,r),Mt.init(e,r),e._zod.processJSONSchema=(i,s,l)=>dj(e,i,s,l),e.unwrap=()=>e._zod.def.innerType});function Yx(e){return new vR({type:"nullable",innerType:e})}const bR=ae("ZodDefault",(e,r)=>{DC.init(e,r),Mt.init(e,r),e._zod.processJSONSchema=(i,s,l)=>hj(e,i,s,l),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function xR(e,r){return new bR({type:"default",innerType:e,get defaultValue(){return typeof r=="function"?r():Bw(r)}})}const wR=ae("ZodPrefault",(e,r)=>{BC.init(e,r),Mt.init(e,r),e._zod.processJSONSchema=(i,s,l)=>mj(e,i,s,l),e.unwrap=()=>e._zod.def.innerType});function SR(e,r){return new wR({type:"prefault",innerType:e,get defaultValue(){return typeof r=="function"?r():Bw(r)}})}const CS=ae("ZodNonOptional",(e,r)=>{LC.init(e,r),Mt.init(e,r),e._zod.processJSONSchema=(i,s,l)=>fj(e,i,s,l),e.unwrap=()=>e._zod.def.innerType});function ER(e,r){return new CS({type:"nonoptional",innerType:e,...Re(r)})}const TR=ae("ZodCatch",(e,r)=>{UC.init(e,r),Mt.init(e,r),e._zod.processJSONSchema=(i,s,l)=>pj(e,i,s,l),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function kR(e,r){return new TR({type:"catch",innerType:e,catchValue:typeof r=="function"?r:k4(r)})}const _R=ae("ZodPipe",(e,r)=>{HC.init(e,r),Mt.init(e,r),e._zod.processJSONSchema=(i,s,l)=>gj(e,i,s,l),e.in=r.in,e.out=r.out});function Gx(e,r){return new _R({type:"pipe",in:e,out:r})}const NR=ae("ZodReadonly",(e,r)=>{PC.init(e,r),Mt.init(e,r),e._zod.processJSONSchema=(i,s,l)=>yj(e,i,s,l),e.unwrap=()=>e._zod.def.innerType});function CR(e){return new NR({type:"readonly",innerType:e})}const jR=ae("ZodCustom",(e,r)=>{$C.init(e,r),Mt.init(e,r),e._zod.processJSONSchema=(i,s,l)=>rj(e,i,s,l)});function RR(e,r={}){return q3(jR,e,r)}function AR(e,r){return Z3(e,r)}function ba(e){if(!e)return;const r=e.trim();if(!r)return;const i=r.toLowerCase(),s=i.indexOf("1");if(s>0){const d=i.slice(0,s);if(["bc","tb","bcrt","ltc","sb"].includes(d)){const f=i.slice(s+1);if(!f)return;const m=f.charAt(0);return m==="p"?"p2tr":m==="q"?f.length===39||f.length===40||e.length===42?"p2wpkh":f.length===59||f.length===60||e.length===62?"p2wsh":"segwit":"segwit"}}const l=/^[123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]+$/u.test(r)&&r.length>=26&&r.length<=35;switch(i[0]){case"1":case"m":case"n":return l?"p2pkh":void 0;case"3":case"2":return l?"p2sh":void 0;default:return}}const sg=e=>Object.freeze(e());function jS(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"&&"BYTES_PER_ELEMENT"in e&&e.BYTES_PER_ELEMENT===1}function Qi(e){if(!jS(e))throw new TypeError("Uint8Array expected")}function OR(e,r){return Array.isArray(r)?r.length===0?!0:r.every(i=>Number.isSafeInteger(i)):!1}function og(e){if(typeof e!="function")throw new TypeError("function expected");return!0}function fd(e,r){if(typeof r!="string")throw new TypeError(`${e}: string expected`);return!0}function hd(e,r="number"){if(typeof e!="number")throw new TypeError(`${r}: expected number, got ${typeof e}`);if(!Number.isSafeInteger(e))throw new RangeError(`${r}: expected)DELIM" -R"DELIM( safe integer, got ${e}`)}function Kx(e,r){if(!OR(!1,r))throw new TypeError(`${e}: array of numbers expected`)}function MR(...e){const r=c=>c,i=(c,d)=>f=>c(d(f)),s=e.map(c=>c.encode).reduceRight(i,r),l=e.map(c=>c.decode).reduce(i,r);return{encode:s,decode:l}}const zR=(()=>{let e=[];for(let r=0;r<40;r++)e.push(2**r);return e})();function Qx(e,r=e.length){const i=new Array(r);for(let s=0;s{try{const e=new TextDecoder;return e.decode(Uint8Array.of(65,48,43,127))==="A0+"?e:void 0}catch{return}})(),Tm=8192;function DR(e){const r=e.length;if(Xx!==void 0&&r>=12)return Xx.decode(e);if(r<=Tm)return String.fromCharCode.apply(null,e);let i="";for(let s=0;s8)throw new RangeError("radix2: bits should be in (0..8]");const r=zR[e]-1;return{encode:i=>{Qi(i);const s=i.length,l=new Uint8Array(Math.ceil(s*8/e));let c=0,d=0,f=0;for(let m=0;m>d&r,!(d0&&(l[f]=c<{const s=i.length,l=new Uint8Array(Math.floor(s*e/8));let c=0,d=0,f=0;for(let m=0;m=8;d-=8)l[f++]=c>>d-8&255;if(c=c<<8-d&255,d>=e)throw new Error("Excess padding");if(c>0)throw new Error(`Non-zero padding: ${c}`);return l}}}function RS(e,r){const i=e.length;if(i>128)throw new Error("alphabet: max 128 letters");const s=new Uint8Array(i),l=new Int8Array(128).fill(-1);for(let c=0;c127)throw new Error("alphabet: single-char ASCII letters only");s[c]=d,l[d]=c}if(r!==void 0)for(const c of Object.keys(r)){const d=c.charCodeAt(0),f=l[r[c].charCodeAt(0)];if(c.length!==1||d>127||f===void 0||f===-1)throw new Error(`alphabet: invalid alias ${c}`);l[d]=f}return{encode:c=>{const d=new Uint8Array(c.length);for(let f=0;f{fd("decode",c);const d=c.length,f=new Uint8Array(d);for(let m=0;m({encode:i=>{Qi(i);const s=i.length;if(s===0)return new Uint8Array(0);if(s>=Wx)throw new Error("invalid length");let l=0;for(;l=l;E=Math.floor(E/e))x[w--]=E%e;return x},decode:i=>{Qi(i);const s=i.length;if(s===0)return new Uint8Array(0);if(s>=Wx)throw new Error("invalid length");let l=0;for(;l=e)throw new Error(`invalid integer: ${N}`);x=x*e+N,w*=e}m=5;let E=x;for(let _=0;_0;E=Math.floor(E/65536))c[d++]=E%65536}const g=d===0?1:d*2-(c[d-1]<256?1:0),v=new Uint8Array(l+g);let y=v.length-1;for(let x=0;x=l&&(v[y--]=w>>8)}return v}}),qR=(e,r)=>{const i=RS(r);return{encode(s){if(Qi(s),s.length>HR)throw new Error("invalid length");return i.encode(e.encode(s))},decode(s){if(fd("baseN.decode",s),s.length>PR)throw new Error("invalid length");return e.decode(i.decode(s))}}},ZR=$R(58,UR),IR=e=>qR(ZR,e),FR=sg(()=>IR("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz")),VR=e=>{og(e);const r=e;return MR(LR(4,i=>r(r(i))),FR)},gp=RS("qpzry9x8gf2tvdw0s3jn54khce6mua7l"),YR=/^[\x21-\x60\x7b-\x7e]+$/;function e1(e,r){for(let i=0;i126)throw new Error(`${e}: printable ASCII expected`)}}function GR(e){const r=e.length,i=new Uint8Array(r);for(let s=0;s=32)throw new Error(`alphabet.encode: invalid digit ${l}`);i[s]=l}return i}const t1=[996825010,642813549,513874426,1027748829,705979059];function ml(e){const r=e>>25;let i=(e&33554431)<<5;for(let s=0;s>s&1)===1&&(i^=t1[s]);return i}function n1(e,r,i=1){const s=e.length;let l=1;for(let d=0;d126)throw new Error(`Invalid prefix (${e})`);l=ml(l)^f>>5}l=ml(l);for(let d=0;d>>5*(5-d)&31;return gp.encode(c)}function AS(e){const r=e==="bech32"?1:734539939,i=BR(5),s=y=>{Qi(y);const x=y.length,w=new Array(Math.ceil(x*8/5));let E=0,_=0,N=0;for(let H=0;H=5;_-=5)w[N++]=E>>_-5&31;return _>0&&(w[N]=E<<5-_&31),w},l=y=>{Kx("radix2.decode",y);const x=y.length,w=new Uint8Array(x);for(let E=0;E=32)throw new Error(`convertRadix2: invalid word=${_}`);w[E]=_}return i.decode(w)},c=Jx(l);function d(y,x,w=90){fd("bech32.encode prefix",y),w!==!1&&hd(w,"limit"),jS(x)&&(x=Qx(x)),Kx("bech32.encode",x);const E=y.length;if(E===0)throw new TypeError(`Invalid prefix length ${E}`);const _=E+7+x.length;if(w!==!1&&_>w)throw new TypeError(`Length ${_} exceeds limit ${w}`);e1("bech32.encode prefix",y);const N=y.toLowerCase(),H=n1(N,x,r);return`${N}1${gp.encode(GR(x))}${H}`}function f(y,x=90){fd("bech32.decode input",y),x!==!1&&hd(x,"limit");const w=y.length;if(w<8||x!==!1&&w>x)throw new TypeError(`invalid string length ${w}, expected (8..${x})`);const E=y.toLowerCase();if(y!==E&&!YR.test(y))throw e1("bech32.decode input",y),new Error("mixed-case string not allowed");const _=E.lastIndexOf("1");if(_===0||_===-1)throw new Error('invalid separator "1"');const N=E.slice(0,_),H=E.slice(_+1);if(H.length<6)throw new Error("invalid data length");const O=gp.decode(H),se=Qx(O,O.length-6),ce=n1(N,se,r);if(!H.endsWith(ce))throw new Error(`Invalid checksum in ${y}`);return{prefix:N,words:se}}const m=Jx(f);function g(y,x=90){const{prefix:w,words:E}=f(y,x);return{prefix:w,words:E,bytes:l(E)}}function v(y,x){return d(y,s(x))}return{encode:d,decode:f,encodeFromBytes:v,decodeToBytes:g,decodeUnsafe:m,fromWords:l,fromWordsUnsafe:c,toWords:s}}const md=sg(()=>AS("bech32")),yp=sg(()=>AS("bech32m")),KR=e=>e/2**32|0,QR=e=>e>>>0;function XR(e,r,i,s){const l=KR(i),c=QR(i);e.setUint32(r,s?c:l,s),e.setUint32(r+4,s?l:c,s)}function r1(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"&&"BYTES_PER_ELEMENT"in e&&e.BYTES_PER_ELEMENT===1}const JR=e=>e?`"${e}" `:"";function lg(e,r,i=""){if(r1(e)&&r===void 0)return e;const s=r1(e),l="",c=s?`length=${e.length}`:`type=${typeof e}`,d=JR(i)+"expected Uint8Array"+l+", got "+c;throw s?new RangeError(d):new TypeError(d)}const WR=(e,r)=>{if(e===null||typeof e!="object"||Array.isArray(e))throw new TypeError((r==="object"?"":`"${r}" `)+"expected object, got type="+typeof e)},a1=(e,r)=>{WR(e,r);const i=Object.getPrototypeOf(e);if(i!==Object.prototype&&i!==null)throw new TypeError(`"${r}" expected plain object`);if(Object.hasOwn(e,"__proto__"))throw new TypeError(`"${r}.__proto__" is not allowed`)};fu)DELIM" -R"DELIM(nction i1(e,r=!0){if(e.destroyed)throw new Error("hash was destroyed");if(r&&e.finished)throw new Error("digest() was already called")}function eA(e,r){lg(e,void 0,"output");const i=r.outputLen;if(!(e.length>=i))throw new RangeError('"output" expected length >= '+i)}function s1(...e){for(let r=0;r>>r}const tA=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",nA=Array.from({length:256},(e,r)=>r.toString(16).padStart(2,"0"));function Gu(e){if(lg(e),tA)return e.toHex();let r="";for(let i=0;i{let v={relativePath:g===void 0?d.path||"":g,caseSensitive:d.caseSensitive===!0,childrenIndex:f,route:d};if(v.relativePath.startsWith("/")){if(!v.relativePath.startsWith(s)&&m)return;qe(v.relativePath.startsWith(s),`Absolute route path "${v.relativePath}" nested under path "${s}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),v.relativePath=v.relativePath.slice(s.length)}let y=pr([s,v.relativePath]),x=i.concat(v);d.children&&d.children.length>0&&(qe(d.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${y}".`),yE(d.children,r,x,y,m)),!(d.path==null&&!d.index)&&r.push({path:y,score:FO(y,d.index),routesMeta:x.map((w,E)=>{let[_,N]=xE(w.relativePath,w.caseSensitive,E===x.length-1);return{...w,matcher:_,compiledParams:N}})})};return e.forEach((d,f)=>{if(d.path===""||!d.path?.includes("?"))c(d,f);else for(let m of vE(d.path))c(d,f,!0,m)}),r}function vE(e){let r=e.split("/");if(r.length===0)return[];let[i,...s]=r,l=i.endsWith("?"),c=i.replace(/\?$/,"");if(s.length===0)return l?[c,""]:[c];let d=vE(s.join("/")),f=[];return f.push(...d.map(m=>m===""?c:[c,m].join("/"))),l&&f.push(...d),f.map(m=>e.startsWith("/")&&m===""?"/":m)}function UO(e){e.sort((r,i)=>r.score!==i.score?i.score-r.score:VO(r.routesMeta.map(s=>s.childrenIndex),i.routesMeta.map(s=>s.childrenIndex)))}var HO=/^:[\w-]+$/,PO=3,$O=2,qO=1,ZO=10,IO=-2,j1=e=>e==="*";function FO(e,r){let i=e.split("/"),s=i.length;return i.some(j1)&&(s+=IO),r&&(s+=$O),i.filter(l=>!j1(l)).reduce((l,c)=>l+(HO.test(c)?PO:c===""?qO:ZO),s)}function VO(e,r){return e.length===r.length&&e.slice(0,-1).every((s,l)=>s===r[l])?e[e.length-1]-r[r.length-1]:0}function YO(e,r,i=!1){let{routesMeta:s}=e,l={},c="/",d=[];for(let f=0;f{if(v==="*"){let E=f[x]||"";d=co(c.slice(0,c.length-E.length),1)}const w=f[x];return y&&!w?g[v]=void 0:g[v]=(w||"").replace(/%2F/g,"/"),g},{}),pathname:c,pathnameBase:d,pattern:e}}function xE(e,r=!1,i=!0){Ct(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let s=[],l="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(d,f,m,g,v)=>{if(s.push({paramName:f,isOptional:m!=null}),m){let y=v.charAt(g+d.length);return y&&y!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(s.push({paramName:"*"}),l+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):i?l+="\\/*$":e!==""&&e!=="/"&&(l+="(?:(?=\\/|$))"),[new RegExp(l,r?void 0:"i"),s]}function GO(e){try{return e.split("/").map(r=>decodeURIComponent(r).replace(/\//g,"%2F")).join("/")}catch(r){return Ct(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${r}).`),e}}function tr(e,r){if(r==="/")return e;if(!e.toLowerCase().startsWith(r.toLowerCase()))return null;let i=r.endsWith("/")?r.length-1:r.length,s=e.charAt(i);return s&&s!=="/"?null:e.slice(i)||"/"}function KO({basename:e,pathname:r}){return r==="/"?e:pr([e,r])}var yg=e=>jd.test(e);function QO(e,r="/"){let{pathname:i,search:s="",hash:l=""}=typeof e=="string"?na(e):e,c;return i?(i=vg(i),i.startsWith("/")||i.startsWith("\\")?c=R1(i.substring(1),"/"):c=R1(i,r)):c=r,{pathname:c,search:JO(s),hash:WO(l)}}function R1(e,r){let i=co(r).split("/");return e.split("/").forEach(l=>{l===".."?i.length>1&&i.pop():l!=="."&&i.push(l)}),i.length>1?i.join("/"):"/"}function Lm(e,r,i,s){return`Cannot include a '${e}' character in a manually specified \`to.${r}\` field [${JSON.stringify(s)}]. Please separate it out to the \`to.${i}\` field. Alternatively you may provide the full path as a string in and the router will parse it for you.`}function wE(e){return e.filter((r,i)=>i===0||r.route.path&&r.route.path.length>0)}function Ad(e){let r=wE(e);return r.map((i,s)=>s===r.length-1?i.pathname:i.pathnameBase)}function Kl(e,r,i,s=!1){let l;typeof e=="string"?l=na(e):(l={...e},qe(!l.pathname||!l.pathname.includes("?"),Lm("?","pathname","search",l)),qe(!l.pathname||!l.pathname.includes("#"),Lm("#","pathname","hash",l)),qe(!l.search||!l.search.includes("#"),Lm("#","search","hash",l)));let c=e===""||l.pathname==="",d=c?"/":l.pathname,f;if(d==null)f=i;else{let y=r.length-1;if(!s&&d.startsWith("..")){let x=d.split("/");for(;x[0]==="..";)x.shift(),y-=1;l.pathname=x.join("/")}f=y>=0?r[y]:"/"}let m=QO(l,f),g=d&&d!=="/"&&d.endsWith("/"),v=(c||d===".")&&i.endsWith("/");return!m.pathname.endsWith("/")&&(g||v)&&(m.pathname+="/"),m}var vg=e=>e.replace(/[\\/]{2,}/g,"/"),pr=e=>vg(e.join("/"));function co(e,r=0){let i=e.length;for(;i>r&&e.charCodeAt(i-1)===47;)i--;return i===e.length?e:e.slice(0,i)}var XO=e=>co(e).replace(/^\/*/,"/"),JO=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,WO=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,eM=["EvalError","RangeError","ReferenceError","SyntaxError","TypeEr)DELIM" -R"DELIM(ror","URIError"],Ql=class{constructor(e,r,i,s=!1){this.status=e,this.statusText=r||"",this.internal=s,i instanceof Error?(this.data=i.toString(),this.error=i):this.data=i}};function Zl(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function Xl(e){let r=e.map(i=>i.route.path).filter(Boolean);return pr(r)||"/"}var SE=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function EE(e,r){let i=e;if(typeof i!="string"||!jd.test(i))return{absoluteURL:void 0,isExternal:!1,to:i};let s=i,l=!1;if(SE)try{let c=new URL(window.location.href),d=Rd.test(i)?new URL(fE(i,c.protocol)):new URL(i),f=tr(d.pathname,r);d.origin===c.origin&&f!=null?i=f+d.search+d.hash:l=!0}catch{Ct(!1,` contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:s,isExternal:l,to:i}}var fi=Symbol("Uninstrumented");function tM(e,r){let i={lazy:[],"lazy.loader":[],"lazy.action":[],"lazy.middleware":[],middleware:[],loader:[],action:[]};e.forEach(l=>l({id:r.id,index:r.index,path:r.path,instrument(c){let d=Object.keys(i);for(let f of d)c[f]&&i[f].push(c[f])}}));let s={};if(typeof r.lazy=="function"&&i.lazy.length>0){let l=Xs(i.lazy,r.lazy,()=>{});l&&(s.lazy=l)}if(typeof r.lazy=="object"){let l=r.lazy;["middleware","loader","action"].forEach(c=>{let d=l[c],f=i[`lazy.${c}`];if(typeof d=="function"&&f.length>0){let m=Xs(f,d,()=>{});m&&(s.lazy=Object.assign(s.lazy||{},{[c]:m}))}})}return["loader","action"].forEach(l=>{let c=r[l];if(typeof c=="function"&&i[l].length>0){let d=c[fi]??c,f=Xs(i[l],d,(...m)=>A1(m[0]));f&&(l==="loader"&&d.hydrate===!0&&(f.hydrate=!0),f[fi]=d,s[l]=f)}}),r.middleware&&r.middleware.length>0&&i.middleware.length>0&&(s.middleware=r.middleware.map(l=>{let c=l[fi]??l,d=Xs(i.middleware,c,(...f)=>A1(f[0]));return d?(d[fi]=c,d):l})),s}function nM(e,r){let i={navigate:[],fetch:[]};if(r.forEach(s=>s({instrument(l){let c=Object.keys(l);for(let d of c)l[d]&&i[d].push(l[d])}})),i.navigate.length>0){let s=e.navigate[fi]??e.navigate,l=Xs(i.navigate,s,(...c)=>{let[d,f]=c;return{to:typeof d=="number"||typeof d=="string"?d:d?Mn(d):".",...O1(e,f??{})}});l&&(l[fi]=s,e.navigate=l)}if(i.fetch.length>0){let s=e.fetch[fi]??e.fetch,l=Xs(i.fetch,s,(...c)=>{let[d,,f,m]=c;return{href:f??".",fetcherKey:d,...O1(e,m??{})}});l&&(l[fi]=s,e.fetch=l)}return e}function Xs(e,r,i){return e.length===0?null:async(...s)=>{let l=await TE(e,i(...s),()=>r(...s),e.length-1);if(l.type==="error")throw l.value;return l.value}}async function TE(e,r,i,s){let l=e[s],c;if(l){let d,f=async()=>(d?console.error("You cannot call instrumented handlers more than once"):d=TE(e,r,i,s-1),c=await d,qe(c,"Expected a result"),c.type==="error"&&c.value instanceof Error?{status:"error",error:c.value}:{status:"success",error:void 0});try{await l(f,r)}catch(m){console.error("An instrumentation function threw an error:",m)}d||await f(),await d}else try{c={type:"success",value:await i()}}catch(d){c={type:"error",value:d}}return c||{type:"error",value:new Error("No result assigned in instrumentation chain.")}}function A1(e){let{request:r,context:i,params:s,pattern:l}=e;return{request:rM(r),params:{...s},pattern:l,context:aM(i)}}function O1(e,r){return{currentUrl:Mn(e.state.location),..."formMethod"in r?{formMethod:r.formMethod}:{},..."formEncType"in r?{formEncType:r.formEncType}:{},..."formData"in r?{formData:r.formData}:{},..."body"in r?{body:r.body}:{}}}function rM(e){return{method:e.method,url:e.url,headers:{get:(...r)=>e.headers.get(...r)}}}function aM(e){if(sM(e)){let r={...e};return Object.freeze(r),r}else return{get:r=>e.get(r)}}var iM=Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function sM(e){if(e===null||typeof e!="object")return!1;const r=Object.getPrototypeOf(e);return r===Object.prototype||r===null||Object.getOwnPropertyNames(r).sort().join("\0")===iM}var M1=new URL("http://localhost");function bg(e){if(e.createURL)return e.createURL("/");try{return new URL(e.createHref("/"),M1)}catch{return M1}}function Um(e,r){return e.origin===r.origin&&(e.origin!=="null"||e.protocol===r.protocol&&e.host===r.host)}function oM(e,r){if(e.startsWith("//"))return!0;let i=r.protocol.toLowerCase();return e.toLowerCase().startsWith(i)?r.host===""||e.slice(i.length).startsWith("//"):!1}function Ws(e,r,i,s){let l=null;try{l=e==null?null:new URL(e,i)}catch{}let c=new URL(r,i),d=l!=null&&!Um(l,i),f=!Um(c,i);if(s==="reject"){if(d||f)throw new Error("External navigation is not allowed")}else if(f&&(l==null||!oM(e,l)||!Um(l,c)))throw new Error("External navigation is not allowed")}var kE=["POST","PUT","PATCH","DELETE"],lM=new Set(kE),cM=["GET",...kE],uM=new Set(cM),_E=new Set([301,302,303,307,308]),dM=new Set([307,308]),Hm={state:"idle",location:void 0,matches:void 0,historyAction:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},fM={state:"idle",data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},yl={state:"unblocked",proceed:void 0,reset:void 0,location:void 0},hM=e=>({hasErrorBoundary:!!e.hasErrorBoundary}),NE="remix-router-transitions",CE=Symbol("ResetLoaderData"),Zi,Vs,ii,Ys,mM=class{constructor(e){_l(this,Zi),_l(this,Vs),_l(this,ii),_l(this,Ys),Kr(this,Zi,e),Kr(this,Vs,Ju(e))}get stableRoutes(){return fr(this,Zi)}get activeRoutes(){return fr(this,ii)??fr(this,Zi)}get branches(){return fr(this,Ys)??fr(this,Vs)}get hasHMRRoutes(){return fr(this,ii)!=null}setRoutes(e){Kr(this,Zi,e),Kr(this,Vs,Ju(e))}setHmrRoutes(e){Kr(this,ii,e),Kr(this,Ys,Ju(e))}commitHmrRoutes(){fr(this,ii)&&(Kr(this,Zi,fr(this,ii)),Kr(this,Vs,fr(this,Ys)),Kr(this,ii,void 0),Kr(this,Ys,void 0))}};Zi=new WeakMap;Vs=new WeakMap;ii=new WeakMap;Ys=new WeakMap;function pM(e){const r=e.window?e.window:typeof window<"u"?window:void 0,i=typeof r<"u"&&typeof r.document<"u"&&typeof r.document.createElement<"u";qe(e.routes.length>0,"You must provide a non-empty routes array to createRouter");let s=e.hydrationRouteProperties||[],l=e.mapRouteProperties||hM,c=l;if(e.instrumentations){let A=e.instrumentations;c=D=>({...l(D),...tM(A.map(I=>I.route).filter(Boolean),D)})}let d={},f=new mM(ql(e.routes,c,void 0,d)),m=e.basename||"/";m.startsWith("/")||(m=`/${m}`);let g=e.dataStrategy||xM,v={...e.future},y=null,x=new Set,w=null,E=null,_=null,N=null,H=e.hydrationData!=null,O=Nr(f.activeRoutes,e.history.location,m,!1,f.branches),se=!1,ce=null,K,oe;if(O==null&&!e.patchRoutesOnNavigation){let A=hr(404,{pathname:e.history.location.pathname}),{matches:D,route:I}=Uu(f.activeRoutes);K=!0,oe=!K,O=D,ce={[I.id]:A}}else if(O&&!e.hydrationData&&Or(O,f.activeRoutes,e.history.location.pathname).active&&(O=null),O)if(O.some(A=>A.route.lazy))K=!1,oe=!K;else if(!O.some(A=>xg(A.route)))K=!0,oe=!K;else{let A=e.hydrationData?e.hydrationData.loaderData:null,D=e.hydrationData?e.hydrationData.errors:null,I=O;if(D){let ue=O.findIndex(de=>D[de.route.id]!==void 0);I=I.slice(0,ue+1)}oe=!1,K=!0,I.forEach(ue=>{let de=jE(ue.route,A,D);oe=oe||de.renderFallback,K=K&&!de.shouldLoad})}else{K=!1,oe=!K,O=[];let A=Or(null,f.activeRoutes,e.history.location.pathname);A.active&&A.matches&&(se=!0,O=A.matches)}let R,k={historyAction:e.history.action,location:e.history.location,matches:O,initialized:K,renderFallback:oe,navigation:Hm,restoreScrollPosition:e.hydrationData!=null?!1:null,preventScrollReset:!1,revalidation:"idle",loaderData:e.hydrationData&&e.hydrationData.loaderData||{},actionData:e.hydrationData&&e.hydrationData.actionData||null,errors:e.hydrationData&&e.hydrationData.errors||ce,fetchers:new Map,blockers:new Map},z="POP",P=null,F=!1,X,fe=!1,ge=new Map,re=null,Q=!1,Y=!1,ie=new Set,$=new Map,ye=0,He=-1,xe=new Map,Ce=new Set,j=new Map,G=new Map,he=new Set,ee=new Map,je,J=null;function me(){if(y=e.history.listen(({action:A,location:D,delta:I})=>{if(je){je(),je=void 0;return}Ct(ee.size===0||I!=null,"You are trying to use a blocker on a)DELIM" -R"DELIM( POP navigation to a location that was not created by @remix-run/router. This will fail silently in production. This can happen if you are navigating outside the router via `window.history.pushState`/`window.location.hash` instead of using router navigation APIs. This can also happen if you are using createHashRouter and the user manually changes the URL.");let ue=xo({currentLocation:k.location,nextLocation:D,historyAction:A});if(ue&&I!=null){let de=new Promise(Te=>{je=Te});e.history.go(I*-1),vi(ue,{state:"blocked",location:D,proceed(){vi(ue,{state:"proceeding",proceed:void 0,reset:void 0,location:D}),de.then(()=>e.history.go(I))},reset(){let Te=new Map(k.blockers);Te.set(ue,yl),be({blockers:Te})}}),P?.resolve(),P=null;return}return Be(A,D)}),i){HM(r,ge);let A=()=>PM(r,ge);r.addEventListener("pagehide",A),re=()=>r.removeEventListener("pagehide",A)}return k.initialized||Be("POP",k.location,{initialHydration:!0}),R}function W(){y&&y(),re&&re(),x.clear(),X&&X.abort(),k.fetchers.forEach((A,D)=>es(k.fetchers,D)),k.blockers.forEach((A,D)=>ac(D))}function le(A){if(x.add(A),w){let{newErrors:D}=w;w=null,A(k,{deletedFetchers:[],newErrors:D,viewTransitionOpts:void 0,flushSync:!1})}return()=>x.delete(A)}function be(A,D={}){A.matches&&(A.matches=A.matches.map(de=>{let Te=d[de.route.id],Se=de.route;return Se.element!==Te.element||Se.errorElement!==Te.errorElement||Se.hydrateFallbackElement!==Te.hydrateFallbackElement?{...de,route:Te}:de})),k={...k,...A};let I=[],ue=[];k.fetchers.forEach((de,Te)=>{de.state==="idle"&&(he.has(Te)?I.push(Te):ue.push(Te))}),he.forEach(de=>{!k.fetchers.has(de)&&!$.has(de)&&I.push(de)}),x.size===0&&(w={newErrors:A.errors??null}),[...x].forEach(de=>de(k,{deletedFetchers:I,newErrors:A.errors??null,viewTransitionOpts:D.viewTransitionOpts,flushSync:D.flushSync===!0})),I.forEach(de=>es(k.fetchers,de)),ue.forEach(de=>k.fetchers.delete(de))}function pe(A,D,{flushSync:I}={}){let ue=k.actionData!=null&&k.navigation.formMethod!=null&&Tn(k.navigation.formMethod)&&k.navigation.state==="loading"&&A.state?._isRedirect!==!0,de;D.actionData?Object.keys(D.actionData).length>0?de=D.actionData:de=null:ue?de=k.actionData:de=null;let Te=D.loaderData?Z1(k.loaderData,D.loaderData,D.matches||[],D.errors):k.loaderData,Se=k.blockers;Se.size>0&&(Se=new Map(Se),Se.forEach((Ae,Pe)=>Se.set(Pe,yl)));let Ne=Q?!1:ic(A,D.matches||k.matches),Ee=F===!0||k.navigation.formMethod!=null&&Tn(k.navigation.formMethod)&&A.state?._isRedirect!==!0;f.commitHmrRoutes(),Q||z==="POP"||(z==="PUSH"?e.history.push(A,A.state):z==="REPLACE"&&e.history.replace(A,A.state));let De;if(z==="POP"&&!Q&&A!==k.location){let Ae=ge.get(k.location.pathname);Ae&&Ae.has(A.pathname)?De={currentLocation:k.location,nextLocation:A}:ge.has(A.pathname)&&(De={currentLocation:A,nextLocation:k.location})}else if(fe){let Ae=ge.get(k.location.pathname);Ae?Ae.add(A.pathname):(Ae=new Set([A.pathname]),ge.set(k.location.pathname,Ae)),De={currentLocation:k.location,nextLocation:A}}be({...D,actionData:de,loaderData:Te,historyAction:z,location:A,initialized:!0,renderFallback:!1,navigation:Hm,revalidation:"idle",restoreScrollPosition:Ne,preventScrollReset:Ee,blockers:Se},{viewTransitionOpts:De,flushSync:I===!0}),z="POP",F=!1,fe=!1,Q=!1,Y=!1,P?.resolve(),P=null,J?.resolve(),J=null}async function _e(A,D){if(P?.resolve(),P=null,typeof A=="number"){P||(P=Y1());let mt=P.promise;return e.history.go(A),mt}let I=_p(k.location,k.matches,m,A,D?.fromRouteId,D?.relative),{path:ue,submission:de,error:Te}=z1(!1,I,D),Se;if(D?.mask){let mt=typeof D.mask=="string"?na(D.mask):{...k.location.mask,...D.mask};if(Se={pathname:mt.pathname??"",search:mt.search??"",hash:mt.hash??""},Rd.test(Se.pathname))throw new Error("External navigation is not allowed");Se.pathname.startsWith("\\")&&(Se.pathname=Se.pathname.replace(/^\\+/,"/")),Ws(typeof D.mask=="string"?D.mask:Mn(D.mask),Mn(Se),e.history.createURL("/"),"reject")}let Ne=k.location,Ee=$l(Ne,ue,D&&D.state,void 0,Se);Ee={...Ee,...e.history.encodeLocation(Ee)},Ws(A==null?e.history.createHref(k.location):typeof A=="string"?A:Mn(A),e.history.createHref(Ee.mask||Ee),e.history.createURL("/"),"reject");let De=D&&D.replace!=null?D.replace:void 0,Ae="PUSH";De===!0?Ae="REPLACE":De===!1||de!=null&&Tn(de.formMethod)&&de.formAction===k.location.pathname+k.location.search&&(Ae="REPLACE");let Pe=D&&"preventScrollReset"in D?D.preventScrollReset===!0:void 0,ze=(D&&D.flushSync)===!0,lt=xo({currentLocation:Ne,nextLocation:Ee,historyAction:Ae});if(lt){vi(lt,{state:"blocked",location:Ee,proceed(){vi(lt,{state:"proceeding",proceed:void 0,reset:void 0,location:Ee}),_e(A,D)},reset(){let mt=new Map(k.blockers);mt.set(lt,yl),be({blockers:mt})}});return}await Be(Ae,Ee,{submission:de,pendingError:Te,preventScrollReset:Pe,replace:D&&D.replace,enableViewTransition:D&&D.viewTransition,flushSync:ze,callSiteDefaultShouldRevalidate:D&&D.defaultShouldRevalidate})}function Me(){J||(J=Y1()),Ar(),be({revalidation:"loading"});let A=J.promise;return k.navigation.state==="submitting"?A:k.navigation.state==="idle"?(Be(k.historyAction,k.location,{startUninterruptedRevalidation:!0}),A):(Be(z||k.historyAction,k.navigation.location,{overrideNavigation:k.navigation,enableViewTransition:fe===!0}),A)}async function Be(A,D,I){X&&X.abort(),X=null,z=A,Q=(I&&I.startUninterruptedRevalidation)===!0,Ud(k.location,k.matches),F=(I&&I.preventScrollReset)===!0,fe=(I&&I.enableViewTransition)===!0;let ue=f.activeRoutes,de=I?.initialHydration&&k.matches&&k.matches.length>0&&!se?k.matches:Nr(ue,D,m,!1,f.branches),Te=(I&&I.flushSync)===!0;if(de&&k.initialized&&!Y&&jM(k.location,D)&&!(I&&I.submission&&Tn(I.submission.formMethod))){pe(D,{matches:de},{flushSync:Te});return}let Se=Or(de,ue,D.pathname);if(Se.active&&Se.matches&&(de=Se.matches),!de){let{error:ct,notFoundMatches:tt,route:Wt}=ka(D.pathname);pe(D,{matches:tt,loaderData:{},errors:{[Wt.id]:ct}},{flushSync:Te});return}let Ne=I&&I.overrideNavigation?{...I.overrideNavigation,matches:de,historyAction:A}:void 0;X=new AbortController;let Ee=Gs(e.history,D,X.signal,I&&I.submission),De=e.getContext?await e.getContext():new N1,Ae;if(I&&I.pendingError)Ae=[di(de).route.id,{type:"error",error:I.pendingError}];else if(I&&I.submission&&Tn(I.submission.formMethod)){let ct=await Ue(Ee,D,I.submission,de,A,De,Se.active,I&&I.initialHydration===!0,{replace:I.replace,flushSync:Te});if(ct.shortCircuited)return;if(ct.pendingActionResult){let[tt,Wt]=ct.pendingActionResult;if(Jn(Wt)&&Zl(Wt.error)&&Wt.error.status===404){X=null,pe(D,{matches:ct.matches,loaderData:{},errors:{[tt]:Wt.error}});return}}de=ct.matches||de,Ae=ct.pendingActionResult,Ne=Pm(D,de,A,I.submission),Te=!1,Se.active=!1,Ee=Gs(e.history,Ee.url,Ee.signal)}let{shortCircuited:Pe,matches:ze,loaderData:lt,errors:mt,workingFetchers:Bt}=await dt(Ee,D,de,A,De,Se.active,Ne,I&&I.submission,I&&I.fetcherSubmission,I&&I.replace,I&&I.initialHydration===!0,Te,Ae,I&&I.callSiteDefaultShouldRevalidate);Pe||(X=null,pe(D,{matches:ze||de,...I1(Ae),loaderData:lt,errors:mt,...Bt?{fetchers:Bt}:{}}))}async function Ue(A,D,I,ue,de,Te,Se,Ne,Ee={}){Ar();let De=LM(D,ue,de,I);if(be({navigation:De},{flushSync:Ee.flushSync===!0}),Se){let ze=await Jt(ue,D.pathname,A.signal);if(ze.type==="aborted")return{shortCircuited:!0};if(ze.type==="error"){if(ze.partialMatches.length===0){let{matches:mt,route:Bt}=Uu(f.activeRoutes);return{matches:mt,pendingActionResult:[Bt.id,{type:"error",error:ze.error}]}}let lt=di(ze.partialMatches).route.id;return{matches:ze.partialMatches,pendingActionResult:[lt,{type:"error",error:ze.error}]}}else if(ze.matches)ue=ze.matches;else{let{notFoundMatches:lt,error:mt,route:Bt}=ka(D.pathname);return{matches:lt,pendingActionResult:[Bt.id,{type:"error",error:mt}]}}}let Ae,Pe=Wu(ue,D);if(!Pe.route.action&&!Pe.route.lazy)Ae={type:"error",error:hr(405,{method:A.method,pathname:D.pathname,routeId:Pe.route.id})};else{let ze=eo(c,d,A,D,ue,Pe,Ne?[]:s,Te),lt=await ln(A,D,ze,Te,null);if(Ae=lt[Pe.route.id],!Ae){for(let mt of ue)if(lt[mt.route.id]){Ae=lt[mt.route.id];break}}if(A.signal.)DELIM" -R"DELIM(aborted)return{shortCircuited:!0}}if(Yi(Ae)){let ze;return Ee&&Ee.replace!=null?ze=Ee.replace:ze=P1(Ae.response.headers.get("Location"),new URL(A.url),m,e.history)===k.location.pathname+k.location.search,await wt(A,Ae,!0,{submission:I,replace:ze}),{shortCircuited:!0}}if(Jn(Ae)){let ze=di(ue,Pe.route.id);return(Ee&&Ee.replace)!==!0&&(z="PUSH"),{matches:ue,pendingActionResult:[ze.route.id,Ae,Pe.route.id]}}return{matches:ue,pendingActionResult:[Pe.route.id,Ae]}}async function dt(A,D,I,ue,de,Te,Se,Ne,Ee,De,Ae,Pe,ze,lt){let mt=Se||Pm(D,I,ue,Ne),Bt=Ne||Ee||V1(mt),ct=!Q&&!Ae;if(Te){if(ct){let Kt=qt(ze);be({navigation:mt,...Kt!==void 0?{actionData:Kt}:{}},{flushSync:Pe})}let Ge=await Jt(I,D.pathname,A.signal);if(Ge.type==="aborted")return{shortCircuited:!0};if(Ge.type==="error"){if(Ge.partialMatches.length===0){let{matches:tn,route:wn}=Uu(f.activeRoutes);return{matches:tn,loaderData:{},errors:{[wn.id]:Ge.error}}}let Kt=di(Ge.partialMatches).route.id;return{matches:Ge.partialMatches,loaderData:{},errors:{[Kt]:Ge.error}}}else if(Ge.matches)I=Ge.matches;else{let{error:Kt,notFoundMatches:tn,route:wn}=ka(D.pathname);return{matches:tn,loaderData:{},errors:{[wn.id]:Kt}}}}let tt=f.activeRoutes,{dsMatches:Wt,revalidatingFetchers:cn}=D1(A,de,c,d,e.history,k,I,Bt,D,Ae?[]:s,Ae===!0,Y,ie,he,j,Ce,tt,m,e.patchRoutesOnNavigation!=null,f.branches,ze,lt);if(He=++ye,!e.dataStrategy&&!Wt.some(Ge=>Ge.shouldLoad)&&!Wt.some(Ge=>Ge.route.middleware&&Ge.route.middleware.length>0)&&cn.length===0){let Ge=new Map(k.fetchers),Kt=nc(Ge);return pe(D,{matches:I,loaderData:{},errors:ze&&Jn(ze[1])?{[ze[0]]:ze[1].error}:null,...I1(ze),...Kt?{fetchers:Ge}:{}},{flushSync:Pe}),{shortCircuited:!0}}if(ct){let Ge={};if(!Te){Ge.navigation=mt;let Kt=qt(ze);Kt!==void 0&&(Ge.actionData=Kt)}cn.length>0&&(Ge.fetchers=Ye(cn)),be(Ge,{flushSync:Pe})}cn.forEach(Ge=>{Zn(Ge.key),Ge.controller&&$.set(Ge.key,Ge.controller)});let _a=()=>cn.forEach(Ge=>Zn(Ge.key));X&&X.signal.addEventListener("abort",_a);let{loaderResults:en,fetcherResults:kt}=await xn(Wt,cn,A,D,de);if(A.signal.aborted)return{shortCircuited:!0};X&&X.signal.removeEventListener("abort",_a),cn.forEach(Ge=>$.delete(Ge.key));let Rt=Hu(en);if(Rt)return await wt(A,Rt.result,!0,{replace:De}),{shortCircuited:!0};if(Rt=Hu(kt),Rt)return Ce.add(Rt.key),await wt(A,Rt.result,!0,{replace:De}),{shortCircuited:!0};let un=new Map(k.fetchers),{loaderData:ns,errors:Mr}=q1(k,I,en,ze,cn,kt,un);Ae&&k.errors&&(Mr={...k.errors,...Mr});let rs=nc(un),bi=rc(He,un),zr=rs||bi||cn.length>0;return{matches:I,loaderData:ns,errors:Mr,...zr?{workingFetchers:un}:{}}}function qt(A){if(A&&!Jn(A[1]))return{[A[0]]:A[1].data};if(k.actionData)return Object.keys(k.actionData).length===0?null:k.actionData}function Ye(A){let D=new Map(k.fetchers);return A.forEach(I=>{let ue=D.get(I.key),de=vl(void 0,ue?ue.data:void 0);D.set(I.key,de)}),D}async function st(A,D,I,ue){Zn(A);let de=(ue&&ue.flushSync)===!0,Te=f.activeRoutes,Se=_p(k.location,k.matches,m,I,D,ue?.relative),Ne=Nr(Te,Se,m,!1,f.branches),Ee=Or(Ne,Te,Se);if(Ee.active&&Ee.matches&&(Ne=Ee.matches),!Ne){kn(A,D,hr(404,{pathname:Se}),{flushSync:de});return}let{path:De,submission:Ae,error:Pe}=z1(!0,Se,ue);if(Pe){kn(A,D,Pe,{flushSync:de});return}let ze=e.getContext?await e.getContext():new N1,lt=(ue&&ue.preventScrollReset)===!0;if(Ae&&Tn(Ae.formMethod)){await ot(A,D,De,Ne,ze,Ee.active,de,lt,Ae,ue&&ue.defaultShouldRevalidate);return}j.set(A,{routeId:D,path:De}),await at(A,D,De,Ne,ze,Ee.active,de,lt,Ae)}async function ot(A,D,I,ue,de,Te,Se,Ne,Ee,De){Ar(),j.delete(A);let Ae=k.fetchers.get(A);Dt(A,UM(Ee,Ae),{flushSync:Se});let Pe=new AbortController,ze=Gs(e.history,I,Pe.signal,Ee);if(Te){let Ze=await Jt(ue,new URL(ze.url).pathname,ze.signal,A);if(Ze.type==="aborted")return;if(Ze.type==="error"){kn(A,D,Ze.error,{flushSync:Se});return}else if(Ze.matches)ue=Ze.matches;else{kn(A,D,hr(404,{pathname:I}),{flushSync:Se});return}}let lt=Wu(ue,I);if(!lt.route.action&&!lt.route.lazy){let Ze=hr(405,{method:Ee.formMethod,pathname:I,routeId:D});kn(A,D,Ze,{flushSync:Se});return}$.set(A,Pe);let mt=ye,Bt=eo(c,d,ze,I,ue,lt,s,de),ct=await ln(ze,I,Bt,de,A),tt=ct[lt.route.id];if(!tt){for(let Ze of Bt)if(ct[Ze.route.id]){tt=ct[Ze.route.id];break}}if(ze.signal.aborted){$.get(A)===Pe&&$.delete(A);return}if(he.has(A)){if(Yi(tt)||Jn(tt)){Dt(A,Qr(void 0));return}}else{if(Yi(tt))if($.delete(A),He>mt){Dt(A,Qr(void 0));return}else return Ce.add(A),Dt(A,vl(Ee)),wt(ze,tt,!1,{fetcherSubmission:Ee,preventScrollReset:Ne});if(Jn(tt)){kn(A,D,tt.error);return}}let Wt=k.navigation.location||k.location,cn=Gs(e.history,Wt,Pe.signal),_a=f.activeRoutes,en=k.navigation.state!=="idle"?Nr(_a,k.navigation.location,m,!1,f.branches):k.matches;qe(en,"Didn't find any matches after fetcher action");let kt=++ye;xe.set(A,kt);let{dsMatches:Rt,revalidatingFetchers:un}=D1(cn,de,c,d,e.history,k,en,Ee,Wt,s,!1,Y,ie,he,j,Ce,_a,m,e.patchRoutesOnNavigation!=null,f.branches,[lt.route.id,tt],De),ns=vl(Ee,tt.data),Mr=new Map(k.fetchers);Mr.set(A,ns),un.filter(Ze=>Ze.key!==A).forEach(Ze=>{let Br=Ze.key,So=Mr.get(Br),sc=vl(void 0,So?So.data:void 0);Mr.set(Br,sc),Zn(Br),Ze.controller&&$.set(Br,Ze.controller)}),be({fetchers:Mr});let rs=()=>un.forEach(Ze=>Zn(Ze.key));Pe.signal.addEventListener("abort",rs);let{loaderResults:bi,fetcherResults:zr}=await xn(Rt,un,cn,Wt,de);if(Pe.signal.aborted)return;Pe.signal.removeEventListener("abort",rs),xe.delete(A),$.delete(A),un.forEach(Ze=>$.delete(Ze.key));let Ge=k.fetchers.has(A),Kt=Ze=>{if(!Ge)return Ze;let Br=new Map(Ze.fetchers);return Br.set(A,Qr(tt.data)),{...Ze,fetchers:Br}},tn=Hu(bi);if(tn)return k=Kt(k),wt(cn,tn.result,!1,{preventScrollReset:Ne});if(tn=Hu(zr),tn)return Ce.add(tn.key),k=Kt(k),wt(cn,tn.result,!1,{preventScrollReset:Ne});let wn=new Map(k.fetchers);Ge&&wn.set(A,Qr(tt.data));let{loaderData:Na,errors:Dr}=q1(k,en,bi,void 0,un,zr,wn);rc(kt,wn),k.navigation.state==="loading"&&kt>He?(qe(z,"Expected pending action"),X&&X.abort(),pe(k.navigation.location,{matches:en,loaderData:Na,errors:Dr,fetchers:wn})):(be({errors:Dr,loaderData:Z1(k.loaderData,Na,en,Dr),fetchers:wn}),Y=!1)}async function at(A,D,I,ue,de,Te,Se,Ne,Ee){let De=k.fetchers.get(A);Dt(A,vl(Ee,De?De.data:void 0),{flushSync:Se});let Ae=new AbortController,Pe=Gs(e.history,I,Ae.signal);if(Te){let tt=await Jt(ue,new URL(Pe.url).pathname,Pe.signal,A);if(tt.type==="aborted")return;if(tt.type==="error"){kn(A,D,tt.error,{flushSync:Se});return}else if(tt.matches)ue=tt.matches;else{kn(A,D,hr(404,{pathname:I}),{flushSync:Se});return}}let ze=Wu(ue,I);$.set(A,Ae);let lt=ye,mt=eo(c,d,Pe,I,ue,ze,s,de),Bt=await ln(Pe,I,mt,de,A),ct=Bt[ze.route.id];if(!ct){for(let tt of ue)if(Bt[tt.route.id]){ct=Bt[tt.route.id];break}}if($.get(A)===Ae&&$.delete(A),!Pe.signal.aborted){if(he.has(A)){Dt(A,Qr(void 0));return}if(Yi(ct))if(He>lt){Dt(A,Qr(void 0));return}else{Ce.add(A),await wt(Pe,ct,!1,{preventScrollReset:Ne});return}if(Jn(ct)){kn(A,D,ct.error);return}Dt(A,Qr(ct.data))}}async function wt(A,D,I,{submission:ue,fetcherSubmission:de,preventScrollReset:Te,replace:Se}={}){I||(P?.resolve(),P=null),D.response.headers.has("X-Remix-Revalidate")&&(Y=!0);let Ne=D.response.headers.get("Location");qe(Ne,"Expected a Location header on the redirect Response");let Ee=Ne,De=new URL(A.url);Ne=P1(Ne,De,m,e.history),Ws(Ee,Ne,De,"allow-explicit");let Ae=$l(k.location,Ne,{_isRedirect:!0});if(i){let ct=!1;if(D.response.headers.has("X-Remix-Reload-Document"))ct=!0;else if(yg(Ne)){const tt=mE(r,Ne,!0);ct=tt.origin!==r.location.origin||tr(tt.pathname,m)==null}if(ct){Se?r.location.replace(Ne):r.location.assign(Ne);return}}X=null;let Pe=Se===!0||D.response.headers.has("X-Remix-Replace")?"REPLACE":"PUSH",{formMethod:ze,formAction:lt,formEncType:mt}=k.navigation;!ue&&!de&&ze&<&&mt&&(ue=V1(k.navigation));let Bt=ue||de;if(dM.has(D.response.status)&&Bt&&Tn(Bt.formMethod))await Be(Pe,Ae,{submission:{...Bt,formAction:Ne},preventScrollReset:Te||F,enableViewTransition:I?fe:void 0});else{let ct=Pm(Ae,[],Pe,ue);await Be(Pe,Ae,{overrideNavigation:ct,fetcherSubmission:)DELIM" -R"DELIM(de,preventScrollReset:Te||F,enableViewTransition:I?fe:void 0})}}async function ln(A,D,I,ue,de){let Te,Se={};try{Te=await SM(g,A,D,I,de,ue,!1)}catch(Ne){return I.filter(Ee=>Ee.shouldLoad).forEach(Ee=>{Se[Ee.route.id]={type:"error",error:Ne}}),Se}if(A.signal.aborted)return Se;if(!Tn(A.method))for(let Ne of I){if(Te[Ne.route.id]?.type==="error")break;!Te.hasOwnProperty(Ne.route.id)&&!k.loaderData.hasOwnProperty(Ne.route.id)&&(!k.errors||!k.errors.hasOwnProperty(Ne.route.id))&&Ne.shouldCallHandler()&&(Te[Ne.route.id]={type:"error",result:new Error(`No result returned from dataStrategy for route ${Ne.route.id}`)})}for(let[Ne,Ee]of Object.entries(Te))if(MM(Ee)){let De=Ee.result;Se[Ne]={type:"redirect",response:_M(De,A,Ne,I,m)}}else Se[Ne]=await kM(Ee);return Se}async function xn(A,D,I,ue,de){let Te=ln(I,ue,A,de,null),Se=Promise.all(D.map(async De=>{if(De.matches&&De.match&&De.request&&De.controller){let Pe=(await ln(De.request,De.path,De.matches,de,De.key))[De.match.route.id];return{[De.key]:Pe}}else return Promise.resolve({[De.key]:{type:"error",error:hr(404,{pathname:De.path})}})})),Ne=await Te,Ee=(await Se).reduce((De,Ae)=>Object.assign(De,Ae),{});return{loaderResults:Ne,fetcherResults:Ee}}function Ar(){Y=!0,j.forEach((A,D)=>{$.has(D)&&ie.add(D),Zn(D)})}function Dt(A,D,I={}){let ue=new Map(k.fetchers);ue.set(A,D),be({fetchers:ue},{flushSync:(I&&I.flushSync)===!0})}function kn(A,D,I,ue={}){let de=di(k.matches,D),Te=new Map(k.fetchers);es(Te,A),be({errors:{[de.route.id]:I},fetchers:Te},{flushSync:(ue&&ue.flushSync)===!0})}function vo(A){return G.set(A,(G.get(A)||0)+1),he.has(A)&&he.delete(A),k.fetchers.get(A)||fM}function Bd(A,D){Zn(A,D?.reason),Dt(A,Qr(null))}function es(A,D){let I=k.fetchers.get(D);$.has(D)&&!(I&&I.state==="loading"&&xe.has(D))&&Zn(D),j.delete(D),xe.delete(D),Ce.delete(D),he.delete(D),ie.delete(D),A.delete(D)}function bo(A){let D=(G.get(A)||0)-1;D<=0?(G.delete(A),he.add(A)):G.set(A,D),be({fetchers:new Map(k.fetchers)})}function Zn(A,D){let I=$.get(A);I&&(I.abort(D),$.delete(A))}function ts(A,D){for(let I of A){let ue=D.get(I);qe(ue,`Expected fetcher: ${I}`);let de=Qr(ue.data);D.set(I,de)}}function nc(A){let D=[],I=!1;for(let ue of Ce){let de=A.get(ue);qe(de,`Expected fetcher: ${ue}`),de.state==="loading"&&(Ce.delete(ue),D.push(ue),I=!0)}return ts(D,A),I}function rc(A,D){let I=[];for(let[ue,de]of xe)if(de0}function _n(A,D){let I=k.blockers.get(A)||yl;return ee.get(A)!==D&&ee.set(A,D),I}function ac(A){k.blockers.delete(A),ee.delete(A)}function vi(A,D){let I=k.blockers.get(A)||yl;qe(I.state==="unblocked"&&D.state==="blocked"||I.state==="blocked"&&D.state==="blocked"||I.state==="blocked"&&D.state==="proceeding"||I.state==="blocked"&&D.state==="unblocked"||I.state==="proceeding"&&D.state==="unblocked",`Invalid blocker state transition: ${I.state} -> ${D.state}`);let ue=new Map(k.blockers);ue.set(A,D),be({blockers:ue})}function xo({currentLocation:A,nextLocation:D,historyAction:I}){if(ee.size===0)return;ee.size>1&&Ct(!1,"A router only supports one blocker at a time");let ue=Array.from(ee.entries()),[de,Te]=ue[ue.length-1],Se=k.blockers.get(de);if(!(Se&&Se.state==="proceeding")&&Te({currentLocation:A,nextLocation:D,historyAction:I}))return de}function ka(A){let D=hr(404,{pathname:A}),I=f.activeRoutes,{matches:ue,route:de}=Uu(I);return{notFoundMatches:ue,route:de,error:D}}function Ld(A,D,I){if(E=A,N=D,_=I||null,!H&&k.navigation===Hm){H=!0;let ue=ic(k.location,k.matches);ue!=null&&be({restoreScrollPosition:ue})}return()=>{E=null,N=null,_=null}}function wo(A,D){return _&&_(A,D.map(ue=>gE(ue,k.loaderData)))||A.key}function Ud(A,D){if(E&&N){let I=wo(A,D);E[I]=N()}}function ic(A,D){if(E){let I=wo(A,D),ue=E[I];if(typeof ue=="number")return ue}return null}function Or(A,D,I){if(e.patchRoutesOnNavigation){let ue=f.branches;if(A){if(Object.keys(A[0].params).length>0)return{active:!0,matches:Nr(D,I,m,!0,ue)}}else return{active:!0,matches:Nr(D,I,m,!0,ue)||[]}}return{active:!1,matches:null}}async function Jt(A,D,I,ue){if(!e.patchRoutesOnNavigation)return{type:"success",matches:A};let de=A;for(;;){let Te=d;try{await e.patchRoutesOnNavigation({signal:I,path:D,matches:de,fetcherKey:ue,patch:(De,Ae)=>{I.aborted||B1(De,Ae,f,Te,c,!1)}})}catch(De){return{type:"error",error:De,partialMatches:de}}if(I.aborted)return{type:"aborted"};let Se=f.branches,Ne=Nr(f.activeRoutes,D,m,!1,Se),Ee=null;if(Ne){if(Object.keys(Ne[0].params).length===0)return{type:"success",matches:Ne};if(Ee=Nr(f.activeRoutes,D,m,!0,Se),!(Ee&&de.lengthI.route.id===D[ue].route.id)}function Nn(A){d={},f.setHmrRoutes(ql(A,c,void 0,d))}function Hd(A,D,I=!1){B1(A,D,f,d,c,I),f.hasHMRRoutes||be({})}return R={get basename(){return m},get future(){return v},get state(){return k},get routes(){return f.stableRoutes},get branches(){return f.branches},get manifest(){return d},get window(){return r},initialize:me,subscribe:le,enableScrollRestoration:Ld,navigate:_e,fetch:st,revalidate:Me,createHref:A=>e.history.createHref(A),createURL:A=>e.history.createURL(A),encodeLocation:A=>e.history.encodeLocation(A),getFetcher:vo,resetFetcher:Bd,deleteFetcher:bo,dispose:W,getBlocker:_n,deleteBlocker:ac,patchRoutes:Hd,_internalFetchControllers:$,_internalSetRoutes:Nn,_internalSetStateDoNotUseOrYouWillBreakYourApp(A){be(A)}},e.instrumentations&&(R=nM(R,e.instrumentations.map(A=>A.router).filter(Boolean))),R}function gM(e){return e!=null&&("formData"in e&&e.formData!=null||"body"in e&&e.body!==void 0)}function _p(e,r,i,s,l,c){let d,f;if(l){d=[];for(let g of r)if(d.push(g),g.route.id===l){f=g;break}}else d=r,f=r[r.length-1];let m=Kl(s||".",Ad(d),tr(e.pathname,i)||e.pathname,c==="path");if(s==null&&(m.search=e.search,m.hash=e.hash),(s==null||s===""||s===".")&&f){let g=Sg(m.search);if(f.route.index&&!g)m.search=m.search?m.search.replace(/^\?/,"?index&"):"?index";else if(!f.route.index&&g){let v=new URLSearchParams(m.search),y=v.getAll("index");v.delete("index"),y.filter(w=>w).forEach(w=>v.append("index",w));let x=v.toString();m.search=x?`?${x}`:""}}return i!=="/"&&(m.pathname=KO({basename:i,pathname:m.pathname})),Mn(m)}function z1(e,r,i){if(!i||!gM(i))return{path:r};if(i.formMethod&&!BM(i.formMethod))return{path:r,error:hr(405,{method:i.formMethod})};let s=()=>({path:r,error:hr(400,{type:"invalid-body"})}),c=(i.formMethod||"get").toUpperCase(),d=BE(r);if(i.body!==void 0){if(i.formEncType==="text/plain"){if(!Tn(c))return s();let y=typeof i.body=="string"?i.body:i.body instanceof FormData||i.body instanceof URLSearchParams?Array.from(i.body.entries()).reduce((x,[w,E])=>`${x}${w}=${E} -`,""):String(i.body);return{path:r,submission:{formMethod:c,formAction:d,formEncType:i.formEncType,formData:void 0,json:void 0,text:y}}}else if(i.formEncType==="application/json"){if(!Tn(c))return s();try{let y=typeof i.body=="string"?JSON.parse(i.body):i.body;return{path:r,submission:{formMethod:c,formAction:d,formEncType:i.formEncType,formData:void 0,json:y,text:void 0}}}catch{return s()}}}qe(typeof FormData=="function","FormData is not available in this environment");let f,m;if(i.formData)f=jp(i.formData),m=i.formData;else if(i.body instanceof FormData)f=jp(i.body),m=i.body;else if(i.body instanceof URLSearchParams)f=i.body,m=$1(f);else if(i.body==null)f=new URLSearchParams,m=new FormData;else try{f=new URLSearchParams(i.body),m=$1(f)}catch{return s()}let g={formMethod:c,formAction:d,formEncType:i&&i.formEncType||"application/x-www-form-urlencoded",formData:m,json:void 0,text:void 0};if(Tn(g.formMethod))return{path:r,submission:g};let v=na(r);return e&&v.search&&Sg(v.search)&&f.append("index",""),v.search=`?${f}`,{path:Mn(v),submission:g}}function D1(e,r,i,s,l,c,d,f,m,g,v,y,x,w,E,_,N,H,)DELIM" -R"DELIM(O,se,ce,K){let oe=ce?Jn(ce[1])?ce[1].error:ce[1].data:void 0,R=l.createURL(c.location),k=l.createURL(m),z;if(v&&c.errors){let Q=Object.keys(c.errors)[0];z=d.findIndex(Y=>Y.route.id===Q)}else if(ce&&Jn(ce[1])){let Q=ce[0];z=d.findIndex(Y=>Y.route.id===Q)-1}let P=ce?ce[1].statusCode:void 0,F=P&&P>=400,X={currentUrl:R,currentParams:c.matches[0]?.params||{},nextUrl:k,nextParams:d[0].params,...f,actionResult:oe,actionStatus:P},fe=Xl(d),ge=d.map((Q,Y)=>{let{route:ie}=Q,$=null;if(z!=null&&Y>z)$=!1;else if(ie.lazy)$=!0;else if(!xg(ie))$=!1;else if(v){let{shouldLoad:Ce}=jE(ie,c.loaderData,c.errors);$=Ce}else yM(c.loaderData,c.matches[Y],Q)&&($=!0);if($!==null)return Np(i,s,e,m,fe,Q,g,r,$);let ye=!1;typeof K=="boolean"?ye=K:F?ye=!1:(y||R.pathname+R.search===k.pathname+k.search||R.search!==k.search||vM(c.matches[Y],Q))&&(ye=!0);let He={...X,defaultShouldRevalidate:ye},xe=zl(Q,He);return Np(i,s,e,m,fe,Q,g,r,xe,He,K)}),re=[];return E.forEach((Q,Y)=>{if(v||!d.some(G=>G.route.id===Q.routeId)||w.has(Y))return;let ie=c.fetchers.get(Y),$=ie&&ie.state!=="idle"&&ie.data===void 0,ye=Nr(N,Q.path,H??"/",!1,se);if(!ye){if(O&&$)return;re.push({key:Y,routeId:Q.routeId,path:Q.path,matches:null,match:null,request:null,controller:null});return}if(_.has(Y))return;let He=Wu(ye,Q.path),xe=new AbortController,Ce=Gs(l,Q.path,xe.signal),j=null;if(x.has(Y))x.delete(Y),j=eo(i,s,Ce,Q.path,ye,He,g,r);else if($)y&&(j=eo(i,s,Ce,Q.path,ye,He,g,r));else{let G;typeof K=="boolean"?G=K:F?G=!1:G=y;let he={...X,defaultShouldRevalidate:G};zl(He,he)&&(j=eo(i,s,Ce,Q.path,ye,He,g,r,he))}j&&re.push({key:Y,routeId:Q.routeId,path:Q.path,matches:j,match:He,request:Ce,controller:xe})}),{dsMatches:ge,revalidatingFetchers:re}}function xg(e){return e.loader!=null||e.middleware!=null&&e.middleware.length>0}function jE(e,r,i){if(e.lazy)return{shouldLoad:!0,renderFallback:!0};if(!xg(e))return{shouldLoad:!1,renderFallback:!1};let s=r!=null&&e.id in r,l=i!=null&&i[e.id]!==void 0;if(!s&&l)return{shouldLoad:!1,renderFallback:!1};if(typeof e.loader=="function"&&e.loader.hydrate===!0)return{shouldLoad:!0,renderFallback:!s};let c=!s&&!l;return{shouldLoad:c,renderFallback:c}}function yM(e,r,i){let s=!r||i.route.id!==r.route.id,l=!e.hasOwnProperty(i.route.id);return s||l}function vM(e,r){let i=e.route.path;return e.pathname!==r.pathname||i!=null&&i.endsWith("*")&&e.params["*"]!==r.params["*"]}function zl(e,r){if(e.route.shouldRevalidate){let i=e.route.shouldRevalidate(r);if(typeof i=="boolean")return i}return r.defaultShouldRevalidate}function B1(e,r,i,s,l,c){let d;if(e){let g=s[e];qe(g,`No route found to patch children into: routeId = ${e}`),g.children||(g.children=[]),d=g.children}else d=i.activeRoutes;let f=[],m=[];if(r.forEach(g=>{let v=d.find(y=>RE(g,y));v?m.push({existingRoute:v,newRoute:g}):f.push(g)}),f.length>0){let g=ql(f,l,[e||"_","patch",String(d?.length||"0")],s);d.push(...g)}if(c&&m.length>0)for(let g=0;gr.children?.some(l=>RE(i,l)))??!1:!1}var L1=new WeakMap,AE=({key:e,route:r,manifest:i,mapRouteProperties:s})=>{let l=i[r.id];if(qe(l,"No route found in manifest"),!l.lazy||typeof l.lazy!="object")return;let c=l.lazy[e];if(!c)return;let d=L1.get(l);d||(d={},L1.set(l,d));let f=d[e];if(f)return f;let m=(async()=>{let g=zO(e),y=l[e]!==void 0&&e!=="hasErrorBoundary";if(g)Ct(!g,"Route property "+e+" is not a supported lazy route property. This property will be ignored."),d[e]=Promise.resolve();else if(y)Ct(!1,`Route "${l.id}" has a static property "${e}" defined. The lazy property will be ignored.`);else{let x=await c();x!=null&&(Object.assign(l,{[e]:x}),Object.assign(l,s(l)))}typeof l.lazy=="object"&&(l.lazy[e]=void 0,Object.values(l.lazy).every(x=>x===void 0)&&(l.lazy=void 0))})();return d[e]=m,m},U1=new WeakMap;function bM(e,r,i,s,l){let c=i[e.id];if(qe(c,"No route found in manifest"),!e.lazy)return{lazyRoutePromise:void 0,lazyHandlerPromise:void 0};if(typeof e.lazy=="function"){let v=U1.get(c);if(v)return{lazyRoutePromise:v,lazyHandlerPromise:v};let y=(async()=>{qe(typeof e.lazy=="function","No lazy route function found");let x=await e.lazy(),w={};for(let E in x){let _=x[E];if(_===void 0)continue;let N=BO(E),O=c[E]!==void 0&&E!=="hasErrorBoundary";N?Ct(!N,"Route property "+E+" is not a supported property to be returned from a lazy route function. This property will be ignored."):O?Ct(!O,`Route "${c.id}" has a static property "${E}" defined but its lazy function is also returning a value for this property. The lazy route property "${E}" will be ignored.`):w[E]=_}Object.assign(c,w),Object.assign(c,{...s(c),lazy:void 0})})();return U1.set(c,y),y.catch(()=>{}),{lazyRoutePromise:y,lazyHandlerPromise:y}}let d=Object.keys(e.lazy),f=[],m;for(let v of d){if(l&&l.includes(v))continue;let y=AE({key:v,route:e,manifest:i,mapRouteProperties:s});y&&(f.push(y),v===r&&(m=y))}let g=f.length>0?Promise.all(f).then(()=>{}):void 0;return g?.catch(()=>{}),m?.catch(()=>{}),{lazyRoutePromise:g,lazyHandlerPromise:m}}async function H1(e){let r=e.matches.filter(l=>l.shouldLoad),i={};return(await Promise.all(r.map(l=>l.resolve()))).forEach((l,c)=>{i[r[c].route.id]=l}),i}async function xM(e){return e.matches.some(r=>r.route.middleware)?OE(e,()=>H1(e)):H1(e)}function OE(e,r){return wM(e,r,s=>{if(DM(s))throw s;return s},AM,i);function i(s,l,c){if(c)return Promise.resolve(Object.assign(c.value,{[l]:{type:"error",result:s}}));{let{matches:d}=e,f=Math.min(Math.max(d.findIndex(g=>g.route.id===l),0),Math.max(d.findIndex(g=>g.shouldCallHandler()),0)),m=di(d,d[f].route.id).route.id;return Promise.resolve({[m]:{type:"error",result:s}})}}}async function wM(e,r,i,s,l){let{matches:c,...d}=e,f=c.flatMap(g=>g.route.middleware?g.route.middleware.map(v=>[g.route.id,v]):[]);return await ME(d,f,r,i,s,l)}async function ME(e,r,i,s,l,c,d=0){let{request:f}=e;if(f.signal.aborted)throw f.signal.reason??new Error(`Request aborted: ${f.method} ${f.url}`);let m=r[d];if(!m)return await i();let[g,v]=m,y,x=async()=>{if(y)throw new Error("You may only call `next()` once per middleware");try{return y={value:await ME(e,r,i,s,l,c,d+1)},y.value}catch(w){return y={value:await c(w,g,y)},y.value}};try{let w=await v(e,x),E=w!=null?s(w):void 0;return l(E)?E:y?E??y.value:(y={value:await x()},y.value)}catch(w){return await c(w,g,y)}}function zE(e,r,i,s,l){let c=AE({key:"middleware",route:s.route,manifest:r,mapRouteProperties:e}),d=bM(s.route,Tn(i.method)?"action":"loader",r,e,l);return{middleware:c,route:d.lazyRoutePromise,handler:d.lazyHandlerPromise}}function Np(e,r,i,s,l,c,d,f,m,g=null,v){let y=!1,x=zE(e,r,i,c,d);return{...c,_lazyPromises:x,shouldLoad:m,shouldRevalidateArgs:g,shouldCallHandler(w){return y=!0,g?typeof v=="boolean"?zl(c,{...g,defaultShouldRevalidate:v}):typeof w=="boolean"?zl(c,{...g,defaultShouldRevalidate:w}):zl(c,g):m},resolve(w){let{lazy:E,loader:_,middleware:N}=c.route,H=y||m||w&&!Tn(i.method)&&(E||_),O=N&&N.length>0&&!_&&!E;return H&&(Tn(i.method)||!O)?EM({request:i,path:s,pattern:l,match:c,lazyHandlerPromise:x?.handler,lazyRoutePromise:x?.route,handlerOverride:w,scopedContext:f}):Promise.resolve({type:"data",result:void 0})}}}function eo(e,r,i,s,l,c,d,f,m=null){return l.map(g=>g.route.id!==c.route.id?{...g,shouldLoad:!1,shouldRevalidateArgs:m,shouldCallHandler:()=>!1,_lazyPromises:zE(e,r,i,g,d),resolve:()=>Promise.resolve({type:"data",result:void 0})}:Np(e,r,i,s,Xl(l),g,d,f,!0,m))}async function SM(e,r,i,s,l,c,d){s.some(v=>v._lazyPromises?.middleware)&&await Promise.all(s.map(v=>v._lazyPromise)DELIM" -R"DELIM(s?.middleware));let f={request:r,url:DE(r,i),pattern:Xl(s),params:s[0].params,context:c,matches:s},g=await e({...f,fetcherKey:l,runClientMiddleware:v=>{let y=f;return OE(y,()=>v({...y,fetcherKey:l,runClientMiddleware:()=>{throw new Error("Cannot call `runClientMiddleware()` from within an `runClientMiddleware` handler")}}))}});try{await Promise.all(s.flatMap(v=>[v._lazyPromises?.handler,v._lazyPromises?.route]))}catch{}return g}async function EM({request:e,path:r,pattern:i,match:s,lazyHandlerPromise:l,lazyRoutePromise:c,handlerOverride:d,scopedContext:f}){let m,g,v=Tn(e.method),y=v?"action":"loader",x=w=>{let E,_=new Promise((O,se)=>E=se);g=()=>E(),e.signal.addEventListener("abort",g);let N=O=>typeof w!="function"?Promise.reject(new Error(`You cannot call the handler for a route which defines a boolean "${y}" [routeId: ${s.route.id}]`)):w({request:e,url:DE(e,r),pattern:i,params:s.params,context:f},...O!==void 0?[O]:[]),H=(async()=>{try{return{type:"data",result:await(d?d(se=>N(se)):N())}}catch(O){return{type:"error",result:O}}})();return Promise.race([H,_])};try{let w=v?s.route.action:s.route.loader;if(l||c)if(w){let E,[_]=await Promise.all([x(w).catch(N=>{E=N}),l,c]);if(E!==void 0)throw E;m=_}else{await l;let E=v?s.route.action:s.route.loader;if(E)[m]=await Promise.all([x(E),c]);else if(y==="action"){let _=new URL(e.url),N=_.pathname+_.search;throw hr(405,{method:e.method,pathname:N,routeId:s.route.id})}else return{type:"data",result:void 0}}else if(w)m=await x(w);else{let E=new URL(e.url),_=E.pathname+E.search;throw hr(404,{pathname:_})}}catch(w){return{type:"error",result:w}}finally{g&&e.signal.removeEventListener("abort",g)}return m}async function TM(e){let r=e.headers.get("Content-Type");return r&&/\bapplication\/json\b/.test(r)?e.body==null?null:e.json():e.text()}async function kM(e){let{result:r,type:i}=e;if(wg(r)){let s;try{s=await TM(r)}catch(l){return{type:"error",error:l}}return i==="error"?{type:"error",error:new Ql(r.status,r.statusText,s),statusCode:r.status,headers:r.headers}:{type:"data",data:s,statusCode:r.status,headers:r.headers}}return i==="error"?F1(r)?r.data instanceof Error?{type:"error",error:r.data,statusCode:r.init?.status,headers:r.init?.headers?new Headers(r.init.headers):void 0}:{type:"error",error:RM(r),statusCode:Zl(r)?r.status:void 0,headers:r.init?.headers?new Headers(r.init.headers):void 0}:{type:"error",error:r,statusCode:Zl(r)?r.status:void 0}:F1(r)?{type:"data",data:r.data,statusCode:r.init?.status,headers:r.init?.headers?new Headers(r.init.headers):void 0}:{type:"data",data:r}}function _M(e,r,i,s,l){let c=e.headers.get("Location");if(qe(c,"Redirects returned/thrown from loaders/actions must have a Location header"),!yg(c)){let d=s.slice(0,s.findIndex(f=>f.route.id===i)+1);c=_p(new URL(r.url),d,l,c),e.headers.set("Location",c)}return e}var NM=["about:","blob:","chrome:","chrome-untrusted:","content:","data:","devtools:","file:","filesystem:","javascript:"];function Cp(e){try{return NM.includes(new URL(e).protocol)}catch{return!1}}function P1(e,r,i,s){if(yg(e)){let l=e,c=Rd.test(l)?new URL(fE(l,r.protocol)):new URL(l);if(Cp(c.toString()))throw new Error("Invalid redirect location");let d=tr(c.pathname,i)!=null;if(c.origin===r.origin&&d)return vg(c.pathname)+c.search+c.hash}try{let l=s.createURL(e);if(Cp(l.toString()))throw new Error("Invalid redirect location")}catch{}return e}function Gs(e,r,i,s){let l=e.createURL(BE(r)).toString(),c={signal:i};if(s&&Tn(s.formMethod)){let{formMethod:d,formEncType:f}=s;c.method=d.toUpperCase(),f==="application/json"?(c.headers=new Headers({"Content-Type":f}),c.body=JSON.stringify(s.json)):f==="text/plain"?c.body=s.text:f==="application/x-www-form-urlencoded"&&s.formData?c.body=jp(s.formData):c.body=s.formData}return new Request(l,c)}function DE(e,r){let i=new URL(e.url),s=typeof r=="string"?na(r):r;if(i.pathname=s.pathname||"/",s.search){let l=new URLSearchParams(s.search),c=l.getAll("index");l.delete("index");for(let d of c.filter(Boolean))l.append("index",d);i.search=l.size?`?${l.toString()}`:""}else i.search="";return i.hash=s.hash||"",i}function jp(e){let r=new URLSearchParams;for(let[i,s]of e.entries())r.append(i,typeof s=="string"?s:s.name);return r}function $1(e){let r=new FormData;for(let[i,s]of e.entries())r.append(i,s);return r}function CM(e,r,i,s=!1,l=!1){let c={},d=null,f,m=!1,g={},v=i&&Jn(i[1])?i[1].error:void 0;return e.forEach(y=>{if(!(y.route.id in r))return;let x=y.route.id,w=r[x];if(qe(!Yi(w),"Cannot handle redirect results in processLoaderData"),Jn(w)){let E=w.error;if(v!==void 0&&(E=v,v=void 0),d=d||{},l)d[x]=E;else{let _=di(e,x);d[_.route.id]==null&&(d[_.route.id]=E)}s||(c[x]=CE),m||(m=!0,f=Zl(w.error)?w.error.status:500),w.headers&&(g[x]=w.headers)}else c[x]=w.data,w.statusCode&&w.statusCode!==200&&!m&&(f=w.statusCode),w.headers&&(g[x]=w.headers)}),v!==void 0&&i&&(d={[i[0]]:v},i[2]&&(c[i[2]]=void 0)),{loaderData:c,errors:d,statusCode:f||200,loaderHeaders:g}}function q1(e,r,i,s,l,c,d){let{loaderData:f,errors:m}=CM(r,i,s);return l.filter(g=>!g.matches||g.matches.some(v=>v.shouldLoad)).forEach(g=>{let{key:v,match:y,controller:x}=g;if(x&&x.signal.aborted)return;let w=c[v];if(qe(w,"Did not find corresponding fetcher result"),Jn(w)){let E=di(e.matches,y?.route.id);m&&m[E.route.id]||(m={...m,[E.route.id]:w.error}),d.delete(v)}else if(Yi(w))qe(!1,"Unhandled fetcher revalidation redirect");else{let E=Qr(w.data);d.set(v,E)}}),{loaderData:f,errors:m}}function Z1(e,r,i,s){let l=Object.entries(r).filter(([,c])=>c!==CE).reduce((c,[d,f])=>(c[d]=f,c),{});for(let c of i){let d=c.route.id;if(!r.hasOwnProperty(d)&&e.hasOwnProperty(d)&&c.route.loader&&(l[d]=e[d]),s&&s.hasOwnProperty(d))break}return l}function I1(e){return e?Jn(e[1])?{actionData:{}}:{actionData:{[e[0]]:e[1].data}}:{}}function di(e,r){return(r?e.slice(0,e.findIndex(s=>s.route.id===r)+1):[...e]).reverse().find(s=>s.route.hasErrorBoundary===!0)||e[0]}function Uu(e){let r=e.length===1?e[0]:e.find(i=>i.index||!i.path||i.path==="/")||{id:"__shim-error-route__"};return{matches:[{params:{},pathname:"",pathnameBase:"",route:r}],route:r}}function hr(e,{pathname:r,routeId:i,method:s,type:l,message:c}={}){let d="Unknown Server Error",f="Unknown @remix-run/router error";return e===400?(d="Bad Request",s&&r&&i?f=`You made a ${s} request to "${r}" but did not provide a \`loader\` for route "${i}", so there is no way to handle the request.`:l==="invalid-body"&&(f="Unable to encode submission body")):e===403?(d="Forbidden",f=`Route "${i}" does not match URL "${r}"`):e===404?(d="Not Found",f=`No route matches URL "${r}"`):e===405&&(d="Method Not Allowed",s&&r&&i?f=`You made a ${s.toUpperCase()} request to "${r}" but did not provide an \`action\` for route "${i}", so there is no way to handle the request.`:s&&(f=`Invalid request method "${s.toUpperCase()}"`)),new Ql(e||500,d,new Error(f),!0)}function Hu(e){let r=Object.entries(e);for(let i=r.length-1;i>=0;i--){let[s,l]=r[i];if(Yi(l))return{key:s,result:l}}}function BE(e){let r=typeof e=="string"?na(e):e;return Mn({...r,hash:""})}function jM(e,r){return e.pathname!==r.pathname||e.search!==r.search?!1:e.hash===""?r.hash!=="":e.hash===r.hash?!0:r.hash!==""}function RM(e){return new Ql(e.init?.status??500,e.init?.statusText??"Internal Server Error",e.data)}function AM(e){return e!=null&&typeof e=="object"&&Object.entries(e).every(([r,i])=>typeof r=="string"&&OM(i))}function OM(e){return e!=null&&typeof e=="object"&&"type"in e&&"result"in e&&(e.type==="data"||e.type==="error")}function MM(e){return wg(e.result)&&_E.has(e.result.status)}function Jn(e){return e.type==="error"}function Yi(e){return(e&&e.type)==="redirect"}function F1(e){return typeof e=="object"&&e!=null&&"type"in e&&"data"in e&&"init"in e&&e.type==="DataWithResponseInit"}function wg(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.headers=="object"&&typeof e.body<"u"}function zM(e){return _E.has(e)}function DM(e){return wg(e)&&zM(e.status)&&e.headers.has("Location")}function BM(e){ret)DELIM" -R"DELIM(urn uM.has(e.toUpperCase())}function Tn(e){return lM.has(e.toUpperCase())}function Sg(e){return new URLSearchParams(e).getAll("index").some(r=>r==="")}function Wu(e,r){let i=typeof r=="string"?na(r).search:r.search;if(e[e.length-1].route.index&&Sg(i||""))return e[e.length-1];let s=wE(e);return s[s.length-1]}function V1(e){let{formMethod:r,formAction:i,formEncType:s,text:l,formData:c,json:d}=e;if(!(!r||!i||!s)){if(l!=null)return{formMethod:r,formAction:i,formEncType:s,formData:void 0,json:void 0,text:l};if(c!=null)return{formMethod:r,formAction:i,formEncType:s,formData:c,json:void 0,text:void 0};if(d!==void 0)return{formMethod:r,formAction:i,formEncType:s,formData:void 0,json:d,text:void 0}}}function Pm(e,r,i,s){return s?{state:"loading",location:e,matches:r,historyAction:i,formMethod:s.formMethod,formAction:s.formAction,formEncType:s.formEncType,formData:s.formData,json:s.json,text:s.text}:{state:"loading",location:e,matches:r,historyAction:i,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0}}function LM(e,r,i,s){return{state:"submitting",location:e,matches:r,historyAction:i,formMethod:s.formMethod,formAction:s.formAction,formEncType:s.formEncType,formData:s.formData,json:s.json,text:s.text}}function vl(e,r){return e?{state:"loading",formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:r}:{state:"loading",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:r}}function UM(e,r){return{state:"submitting",formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:r?r.data:void 0}}function Qr(e){return{state:"idle",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:e}}function HM(e,r){try{let i=e.sessionStorage.getItem(NE);if(i){let s=JSON.parse(i);for(let[l,c]of Object.entries(s||{}))c&&Array.isArray(c)&&r.set(l,new Set(c||[]))}}catch{}}function PM(e,r){if(r.size>0){let i={};for(let[s,l]of r)i[s]=[...l];try{e.sessionStorage.setItem(NE,JSON.stringify(i))}catch(s){Ct(!1,`Failed to save applied view transitions in sessionStorage (${s}).`)}}}function Y1(){let e,r,i=new Promise((s,l)=>{e=async c=>{s(c);try{await i}catch{}},r=async c=>{l(c);try{await i}catch{}}});return{promise:i,resolve:e,reject:r}}var Ji=T.createContext(null);Ji.displayName="DataRouter";var go=T.createContext(null);go.displayName="DataRouterState";var LE=T.createContext(!1);function UE(){return T.useContext(LE)}var Eg=T.createContext({isTransitioning:!1});Eg.displayName="ViewTransition";var HE=T.createContext(new Map);HE.displayName="Fetchers";var $M=T.createContext(null);$M.displayName="Await";var Dn=T.createContext(null);Dn.displayName="Navigation";var Jl=T.createContext(null);Jl.displayName="Location";var yr=T.createContext({outlet:null,matches:[],isDataRoute:!1});yr.displayName="Route";var Tg=T.createContext(null);Tg.displayName="RouteError";var PE="REACT_ROUTER_ERROR",qM="REDIRECT",ZM="ROUTE_ERROR_RESPONSE";function IM(e){if(e.startsWith(`${PE}:${qM}:{`))try{let r=JSON.parse(e.slice(28));if(typeof r=="object"&&r&&typeof r.status=="number"&&typeof r.statusText=="string"&&typeof r.location=="string"&&typeof r.reloadDocument=="boolean"&&typeof r.replace=="boolean")return r}catch{}}function FM(e){if(e.startsWith(`${PE}:${ZM}:{`))try{let r=JSON.parse(e.slice(40));if(typeof r=="object"&&r&&typeof r.status=="number"&&typeof r.statusText=="string")return new Ql(r.status,r.statusText,r.data)}catch{}}function VM(e,{relative:r}={}){qe(yo(),"useHref() may be used only in the context of a component.");let{basename:i,navigator:s}=T.useContext(Dn),{hash:l,pathname:c,search:d}=Wl(e,{relative:r}),f=c;return i!=="/"&&(f=c==="/"?i:pr([i,c])),s.createHref({pathname:f,search:d,hash:l})}function yo(){return T.useContext(Jl)!=null}function Xt(){return qe(yo(),"useLocation() may be used only in the context of a component."),T.useContext(Jl).location}function YM(){return T.useContext(Jl).navigationType}var $E="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function qE(e){T.useContext(Dn).static||T.useLayoutEffect(e)}function vr(){let{isDataRoute:e}=T.useContext(yr);return e?oz():GM()}function GM(){qe(yo(),"useNavigate() may be used only in the context of a component.");let e=T.useContext(Ji),{basename:r,navigator:i}=T.useContext(Dn),{matches:s}=T.useContext(yr),{pathname:l}=Xt(),c=JSON.stringify(Ad(s)),d=T.useRef(!1);return qE(()=>{d.current=!0}),T.useCallback((m,g={})=>{if(Ct(d.current,$E),!d.current)return;if(typeof m=="number"){i.go(m);return}let v=Kl(m,JSON.parse(c),l,g.relative==="path");e==null&&r!=="/"&&(v.pathname=v.pathname==="/"?r:pr([r,v.pathname])),Ws(typeof m=="string"?m:Mn(m),i.createHref(v),bg(i),"reject"),(g.replace?i.replace:i.push)(v,g.state,g)},[r,i,c,l,e])}var KM=T.createContext(null);function QM(e){let r=T.useContext(yr).outlet;return T.useMemo(()=>r&&T.createElement(KM.Provider,{value:e},r),[r,e])}function kg(){let{matches:e}=T.useContext(yr);return e[e.length-1]?.params??{}}function Wl(e,{relative:r}={}){let{matches:i}=T.useContext(yr),{pathname:s}=Xt(),l=JSON.stringify(Ad(i));return T.useMemo(()=>Kl(e,JSON.parse(l),s,r==="path"),[e,l,s,r])}function XM(e,r,i){qe(yo(),"useRoutes() may be used only in the context of a component.");let{navigator:s}=T.useContext(Dn),{matches:l}=T.useContext(yr),c=l[l.length-1],d=c?c.params:{},f=c?c.pathname:"/",m=c?c.pathnameBase:"/",g=c&&c.route;{let N=g&&g.path||"";VE(f,!g||N.endsWith("*")||N.endsWith("*?"),`You rendered descendant (or called \`useRoutes()\`) at "${f}" (under ) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render. +Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const d of e.seen.entries()){const f=d[1];if(r===d[0]){c(d);continue}if(e.external){const g=e.external.registry.get(d[0])?.id;if(r!==d[0]&&g){c(d);continue}}if(e.metadataRegistry.get(d[0])?.id){c(d);continue}if(f.cycle){c(d);continue}f.count>1&&e.reused==="ref"&&c(d)}e.external&&(e.sharedDefsExtractedFor=e.external)}function dS(e){const r=e.anyOf;if(!Array.isArray(r)||r.length===0||e.type!==void 0)return;const i=[];for(const s of r){if(!s||typeof s!="object")return;dS(s);const l=Object.keys(s);if(l.length!==1||l[0]!=="type")return;const c=s.type;for(const d of Array.isArray(c)?c:[c]){if(typeof d!="string")return;i.includes(d)||i.push(d)}}delete e.anyOf,e.type=i.length===1?i[0]:i}const fS=new Set(["type","properties","required","additionalProperties"]),Bx=["oneOf","anyOf"];function Lx(e){const r=e.additionalProperties;return r===void 0||r===!1||typeof r!="object"||r===null?null:Object.keys(r).length?r:null}function dp(e){const r=[];for(const c of e){if(typeof c!="object"||c.type!=="object")return null;for(const d in c)if(!fS.has(d))return null;r.push(c)}const i={},s=new Set;for(const c of r){for(const d in c.properties){if(Object.prototype.hasOwnProperty.call(i,d))continue;const f=[];for(const g of r){const v=g.properties?.[d]??Lx(g);v!=null&&(f.some(y=>JSON.stringify(y)===JSON.stringify(v))||f.push(v))}const m=f.length===1?f[0]:dp(f)??{allOf:f};Sa(i,d,m)}for(const d of c.required??[])s.add(d)}const l={type:"object",properties:i};if(s.size&&(l.required=[...s]),r.every(c=>c.additionalProperties===!1))l.additionalProperties=!1;else{const c=[];for(const d of r){const f=Lx(d);f&&!c.some(m=>JSON.stringify(m)===JSON.stringify(f))&&c.push(f)}c.length===1?l.additionalProperties=c[0]:c.length>1&&(l.additionalProperties={allOf:c})}return l}function F3(e){const r=e.allOf;if(!Array.isArray(r)||r.length<2)return;for(const l of fS)if(l in e)return;const i=r.filter(l=>Bx.some(c=>Array.isArray(l[c])));let s=null;if(!i.length)s=dp(r);else{const l=i[0],c=Bx.find(m=>Array.isArray(l[m]));if(Object.keys(l).length!==1)return;const d=r.filter(m=>m!==l),f=l[c].map(m=>dp([...d,m]));if(f.some(m=>!m))return;s={[c]:f}}s&&(delete e.allOf,Al(e,s))}function hS(e,r){const i=e.seen.get(r);if(!i)throw new Error("Unprocessed schema. This is a bug in Zod.");const s=f=>{const m=e.seen.get(f);if(m.ref===null)return;const g=m.def??m.schema,v={...g},y=m.ref;if(m.ref=null,y){s(y);const w=e.seen.get(y),E=w.schema;if(E.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(g.allOf=g.allOf??[],g.allOf.push(E)):Al(g,E),Al(g,v),f._zod.parent===y)for(const N in g)N==="$ref"||N==="allOf"||N in v||delete g[N];if(E.$ref&&w.def)for(const N in g)N==="$ref"||N==="allOf"||N in w.def&&JSON.stringify(g[N])===JSON.stringify(w.def[N])&&delete g[N]}const x=f._zod.parent;if(x&&x!==y){s(x);const w=e.seen.get(x);if(w?.schema.$ref&&(g.$ref=w.schema.$ref,w.def))for(const E in g)E==="$ref"||E==="allOf"||E in w.def&&JSON.stringify(g[E])===JSON.stringify(w.def[E])&&delete g[E]}e.override({zodSchema:f,jsonSchema:g,path:m.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(const f of[...e.seen.entries()].reverse())s(f[0]);if(e.target!=="openapi-3.0")for(const f of e.seen.entries())dS(f[1].def??f[1].schema);for(const f of e.deferred)f();if(e.intersections.length){const f=new Map;for(const m of e.seen.values())for(const g of[m.schema,m.def]){const v=g?.allOf;if(!Array.isArray(v))continue;const y=f.get(v);y?y.push(g):f.set(v,[g])}for(const m of e.intersections)for(const g of f.get(m)??[])F3(g)}}const l={};if(e.target==="draft-2020-12"?l.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?l.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?l.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){const f=e.external.registry.get(r)?.id;if(!f)throw new Error("Schema is missing an `id` property");l.$id=e.external.uri(f)}Al(l,i.defId?i.schema:i.def??i.schema);const c=e.metadataRegistry.get(r)?.id;c!==void 0&&l.id===c&&delete l.id;const d=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(const f of e.seen.entries()){const m=f[1];m.def&&m.defId&&(m.def.id===m.defId&&delete m.def.id,Sa(d,m.defId,m.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(d).length>0&&(e.target==="draft-2020-12"?l.$defs=d:l.definitions=d);try{const f=JSON.parse(JSON.stringify(l));return Object.defineProperty(f,"~standard",{value:{...r["~standard"],jsonSchema:{input:ud(r,"input",e.processors),output:ud(r,"output",e.processors)}},enumerable:!1,writable:!1}),f}catch{throw new Error("Error converting schema to JSON.")}}function On(e,r){const i=r??{seen:new Set};if(i.seen.has(e))return!1;i.seen.add(e);const s=e._zod.def;if(s.type==="transform")return!0;if(s.type==="array")return On(s.element,i);if(s.type==="set")return On(s.valueType,i);if(s.type==="lazy")return On(s.getter(),i);if(s.type==="promise"||s.type==="optional"||s.type==="nonoptional"||s.type==="nullable"||s.type==="readonly"||s.type==="default"||s.type==="prefault"||s.type==="catch")return On(s.innerType,i);if(s.type==="intersection")return On(s.left,i)||On(s.right,i);if(s.type==="record"||s.type==="map")return On(s.keyType,i)||On(s.valueType,i);if(s.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:On(s.in,i)||On(s.out,i);if(s.type==="object"){for(const l in s.shape)if(On(s.shape[l],i))return!0;return!1}if(s.type==="union"){for(const l of s.options)if(On(l,i))return!0;return!1}if(s.type==="tuple"){for(const l of s.items)if(On(l,i))return!0;return!!(s.rest&&On(s.rest,i))}return!1}const V3=(e,r={})=>i=>{const s=cS({...i,processors:r});return Gt(e,s),uS(s,e),hS(s,e)},ud=(e,r,i={})=>s=>{const{libraryOptions:l,target:c}=s??{},d=cS({...l??{},target:c,io:r,processors:i});return Gt(e,d),uS(d,e),hS(d,e)},oo=(e,r,i)=>{(e[r]===void 0||i>e[r])&&(e[r]=i)},lo=(e,r,i)=>{(e[r]===void 0||i{oo(e,"minimum",r),lo(e,"maximum",r)},mS=(e,r)=>{e.multipleOf??(e.multipleOf=[]),e.multipleOf.includes(r)||e.multipleOf.push(r)},pS=(e,r)=>{e.patterns??(e.patterns=new Set),e.patterns.add(r)},gS=(e,r)=>{e.mime=e.mime?e.mime.filter(i=>r.includes(i)):[...r]},yS=(e,r)=>{e.format=r,)DELIM" +R"DELIM(r.includes("int")&&(e.isInt=!0)},Hx=(e,r)=>oo(e,"minimum",r.minimum),Px=(e,r)=>lo(e,"maximum",r.maximum),$x=e=>(r,i)=>{yS(r,i.format);const[s,l]=e[i.format];oo(r,"minimum",s),lo(r,"maximum",l)},Y3={greater_than:(e,r)=>oo(e,r.inclusive?"minimum":"exclusiveMinimum",r.value),less_than:(e,r)=>lo(e,r.inclusive?"maximum":"exclusiveMaximum",r.value),multiple_of:(e,r)=>mS(e,r.value),number_format:$x(Lw),bigint_format:$x(c4),min_length:Hx,max_length:Px,length_equals:(e,r)=>Ux(e,r.length),min_size:Hx,max_size:Px,size_equals:(e,r)=>Ux(e,r.size),string_format:(e,r)=>{yS(e,r.format),r.pattern&&pS(e,r.pattern),(r.format==="base64"||r.format==="base64url")&&(e.contentEncoding=r.format),(r.local||r.precision===-1)&&(e.laxFormat=!0)},mime_type:(e,r)=>gS(e,r.mime)};function Cr(e){const r={},i=e._zod.def,s=e._zod.traits.has("$ZodCheck")?[e,...i.checks??[]]:i.checks??[];for(const c of s)Y3[c._zod.def.check]?.(r,c._zod.def);const l=e._zod.bag;l.minimum!==void 0&&oo(r,"minimum",l.minimum),l.exclusiveMinimum!==void 0&&oo(r,"exclusiveMinimum",l.exclusiveMinimum),l.maximum!==void 0&&lo(r,"maximum",l.maximum),l.exclusiveMaximum!==void 0&&lo(r,"exclusiveMaximum",l.exclusiveMaximum),l.multipleOf!==void 0&&mS(r,l.multipleOf),l.format!==void 0&&(r.format??(r.format=l.format),l.format.includes("int")&&(r.isInt=!0)),l.mime&&gS(r,l.mime);for(const c of l.patterns??[])pS(r,c);return r}const G3={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},K3=new Map([[Jw,uN],[rg,dN]]),vS=e=>K3.get(e)??e,Q3=(e,r,i,s)=>{const l=i;l.type="string";const{minimum:c,maximum:d,format:f,patterns:m,contentEncoding:g,laxFormat:v}=Cr(e);if(typeof c=="number"&&(l.minLength=c),typeof d=="number"&&(l.maxLength=d),f&&(l.format=G3[f]??f,l.format===""&&delete l.format,(f==="time"||v)&&delete l.format),g&&(l.contentEncoding=g),m&&m.size>0){const y=[...m].map(vS);y.length===1?l.pattern=y[0].source:y.length>1&&(l.allOf=[...y.map(x=>({...r.target==="draft-07"||r.target==="draft-04"||r.target==="openapi-3.0"?{type:"string"}:{},pattern:x.source}))])}},X3=(e,r,i,s)=>{const l=i,{minimum:c,maximum:d,multipleOf:f,exclusiveMaximum:m,exclusiveMinimum:g,isInt:v}=Cr(e);l.type=v?"integer":"number";const y=typeof g=="number"&&g>=(c??Number.NEGATIVE_INFINITY),x=typeof m=="number"&&m<=(d??Number.POSITIVE_INFINITY),w=r.target==="draft-04"||r.target==="openapi-3.0";if(y?w?(l.minimum=g,l.exclusiveMinimum=!0):l.exclusiveMinimum=g:typeof c=="number"&&(l.minimum=c),x?w?(l.maximum=m,l.exclusiveMaximum=!0):l.exclusiveMaximum=m:typeof d=="number"&&(l.maximum=d),f){const E=new Set;for(const H of f)Number.isFinite(H)&&H!==0?E.add(Math.abs(H)):gi(e,r,l,s,`A multipleOf divisor of ${H} cannot be represented in JSON Schema`);const[_,...N]=E;_!==void 0&&(l.multipleOf=_),N.length&&(l.allOf=[...l.allOf??[],...N.map(H=>({multipleOf:H}))])}},J3=(e,r,i,s)=>{i.type="boolean"},W3=(e,r,i,s)=>{i.not={}},ej=(e,r,i,s)=>{},tj=(e,r,i,s)=>{const l=e._zod.def,c=ip(l.entries);if(c.length===0){i.not={};return}c.every(d=>typeof d=="number")&&(i.type="number"),c.every(d=>typeof d=="string")&&(i.type="string"),i.enum=c},nj=(e,r,i,s)=>{const l=e._zod.def;if(l.values.length===0){i.not={};return}const c=[];for(const d of l.values)if(d===void 0){if(gi(e,r,i,s,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof d=="bigint"){if(gi(e,r,i,s,"BigInt literals cannot be represented in JSON Schema"))return;c.push(Number(d))}else c.push(d);if(c.length!==0)if(c.length===1){const d=c[0];i.type=d===null?"null":typeof d,r.target==="draft-04"||r.target==="openapi-3.0"?i.enum=[d]:i.const=d}else c.every(d=>typeof d=="number")&&(i.type="number"),c.every(d=>typeof d=="string")&&(i.type="string"),c.every(d=>typeof d=="boolean")&&(i.type="boolean"),c.every(d=>d===null)&&(i.type="null"),i.enum=c},rj=(e,r,i,s)=>{gi(e,r,i,s,"Custom types cannot be represented in JSON Schema")},aj=(e,r,i,s)=>{gi(e,r,i,s,"Transforms cannot be represented in JSON Schema")},ij=(e,r,i,s)=>{const l=i,c=e._zod.def,{minimum:d,maximum:f}=Cr(e);typeof d=="number"&&(l.minItems=d),typeof f=="number"&&(l.maxItems=f),l.type="array",l.items=Gt(c.element,r,{...s,path:[...s.path,"items"]})};function dd(e){const r=e._zod.def;return r.type==="pipe"&&r.in._zod.traits.has("$ZodTransform")?dd(r.out):r.type==="catch"?dd(r.innerType):e._zod.optin}const sj=(e,r,i,s)=>{const l=i,c=e._zod.def,d=c.shape;if(Object.getOwnPropertySymbols(d).length&&gi(e,r,l,s,"Symbol keys cannot be represented in JSON Schema"))return;l.type="object",l.properties={};for(const g in d)Sa(l.properties,g,Gt(d[g],r,{...s,path:[...s.path,"properties",g]}));const m=[];for(const g of Object.keys(d)){const v=c.shape[g];(r.io==="input"?dd(v)===void 0:v._zod.optout===void 0)&&m.push(g)}m.length>0&&(l.required=m),c.catchall?._zod.def.type==="never"?l.additionalProperties=!1:c.catchall?c.catchall&&(l.additionalProperties=Gt(c.catchall,r,{...s,path:[...s.path,"additionalProperties"]})):r.io==="output"&&(l.additionalProperties=!1)},oj=(e,r,i,s)=>{const l=e._zod.def,c=l.inclusive===!1,d=l.options.map((f,m)=>Gt(f,r,{...s,path:[...s.path,c?"oneOf":"anyOf",m]}));c?i.oneOf=d:i.anyOf=d},lj=(e,r,i,s)=>{const l=e._zod.def,c=Gt(l.left,r,{...s,path:[...s.path,"allOf",0]}),d=Gt(l.right,r,{...s,path:[...s.path,"allOf",1]}),f=g=>"allOf"in g&&Object.keys(g).length===1,m=[...f(c)?c.allOf:[c],...f(d)?d.allOf:[d]];i.allOf=m,r.intersections.push(m)};function fp(e,r,i){if(r.$ref){if(i.has(r))return r;i.add(r);const E=e.get(r)?.def;if(!E)return r;const _=fp(e,E,i);return _===E?r:_}for(const E of["anyOf","oneOf"]){const _=r[E];if(!Array.isArray(_))continue;const N=_.map(H=>fp(e,H,i));N.some((H,O)=>H!==_[O])&&(r={...r,[E]:N})}const s=Array.isArray(r.type)?r.type:[r.type],l=!s.includes("string")&&s.some(E=>E==="number"||E==="integer"),c=r.enum??(r.const!==void 0?[r.const]:void 0);if(!l&&!c?.some(E=>typeof E=="number"))return r;const{minimum:d,maximum:f,exclusiveMinimum:m,exclusiveMaximum:g,multipleOf:v,format:y,id:x,...w}=r;return w.enum?w.enum=w.enum.map(E=>typeof E=="number"?String(E):E):typeof w.const=="number"&&(w.const=String(w.const)),l&&(w.type="string",c||(w.pattern=(s.includes("number")?eg:bN).source)),w}const hp=new WeakMap;function cj(e){const r=new Map;for(const s of e.seen.values())s.def&&!r.has(s.schema)&&r.set(s.schema,s);const i=new Map;for(const s of hp.get(e)??[]){const l=e.seen.get(s),c=(l?.def??l?.schema)?.propertyNames;if(!c||c===!0||i.has(c))continue;const d=fp(r,c,new Set);d!==c&&i.set(c,d)}if(i.size)for(const s of e.seen.values())for(const l of[s.schema,s.def]){const c=l&&i.get(l.propertyNames);c&&(l.propertyNames=c)}}const uj=(e,r,i,s)=>{const l=i,c=e._zod.def;l.type="object";const d=c.keyType,f=Cr(d).patterns;if(c.mode==="loose"&&f&&f.size>0){const v=Gt(c.valueType,r,{...s,path:[...s.path,"patternProperties","*"]});l.patternProperties={};for(const y of f)Sa(l.patternProperties,vS(y).source,v)}else{if(r.target==="draft-07"||r.target==="draft-2020-12"){l.propertyNames=Gt(c.keyType,r,{...s,path:[...s.path,"propertyNames"]});let v=hp.get(r);v||(v=[],hp.set(r,v),r.deferred.push(()=>cj(r))),v.push(e)}l.additionalProperties=Gt(c.valueType,r,{...s,path:[...s.path,"additionalProperties"]})}const m=d._zod.values,g=r.io==="input"&&dd(c.valueType)!==void 0;if(m&&!c.partial&&!g){const v=[...m].filter(y=>typeof y=="string"||typeof y=="number");v.length>0&&(l.required=v.map(String))}},dj=(e,r,i,s)=>{const l=e._zod.def,c=Gt(l.innerType,r,s),d=r.seen.get(e);r.target==="openapi-3.0"?(d.ref=l.innerType,i.nullable=!0):i.anyOf=[c,{type:"null"}]},fj=(e,r,i,s)=>{const l=e._zod.def;Gt(l.innerType,r,s);const c=r.seen.get(e);c.ref=l.innerType},ag=Symbol();function bS(e,r,i,s,l){let c=!1;const d=JSON.stringify(e,(f,m)=>typeof m!="bigint"?m:(c=!0,null));return c?(gi(r,i,s,l,"BigInt defaults cannot be represented in JSON Schema"),ag):JSON.parse(d)}const hj=(e,r,i,s)=>{const l=e._zod.def;Gt(l.innerType,r,s);const c=r.seen.get(e);c.ref=l.innerType;const d=bS(l.defaultValue,e,r,i,s);d!==ag&&(i.default=d)},mj=(e,r,i,s)=>{const l=e._zod.def;G)DELIM" +R"DELIM(t(l.innerType,r,s);const c=r.seen.get(e);if(c.ref=l.innerType,r.io!=="input")return;const d=bS(l.defaultValue,e,r,i,s);d!==ag&&(i._prefault=d)},pj=(e,r,i,s)=>{const l=e._zod.def;Gt(l.innerType,r,s);const c=r.seen.get(e);c.ref=l.innerType;let d;try{d=l.catchValue(void 0)}catch{gi(e,r,i,s,"Dynamic catch values are not supported in JSON Schema");return}i.default=d},gj=(e,r,i,s)=>{const l=e._zod.def,c=l.in._zod.traits.has("$ZodTransform"),d=r.io==="input"?c?l.out:l.in:l.out;Gt(d,r,s);const f=r.seen.get(e);f.ref=d},yj=(e,r,i,s)=>{const l=e._zod.def;Gt(l.innerType,r,s);const c=r.seen.get(e);c.ref=l.innerType,i.readOnly=!0},xS=(e,r,i,s)=>{const l=e._zod.def;Gt(l.innerType,r,s);const c=r.seen.get(e);c.ref=l.innerType},qx=new WeakSet([Object.prototype,Error.prototype]);function Au(e,r,i){Object.defineProperty(e,r,{configurable:!0,enumerable:!1,get(){const s=i(this);return Object.defineProperty(this,r,{value:s,configurable:!0,writable:!0}),s},set(s){Object.defineProperty(this,r,{value:s,configurable:!0,writable:!0})}})}const vj=(e,r)=>{A4.init(e,r),e.name="ZodError";const i=Object.getPrototypeOf(e);qx.has(i)||(qx.add(i),Au(i,"format",s=>l=>z4(s,l)),Au(i,"flatten",s=>l=>M4(s,l)),Au(i,"addIssue",s=>l=>{s.issues.push(l),s.message=JSON.stringify(s.issues,sp,2)}),Au(i,"addIssues",s=>l=>{s.issues.push(...l),s.message=JSON.stringify(s.issues,sp,2)}),Object.defineProperty(i,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},gr=ae("ZodError",vj,void 0,{Parent:Error}),bj=Qp(gr),xj=Xp(gr),wj=Jp(gr),Sj=Wp(gr),Ej=P4(gr),Tj=$4(gr),kj=q4(gr),_j=Z4(gr),Nj=I4(gr),Cj=F4(gr),jj=V4(gr),Rj=Y4(gr);function Aj(){Rr.localeError||ea(KC())}function _d(){Rr.memoizer||ea({memoizer:VC()})}const Mt=ae("ZodType",(e,r)=>(Aj(),Ot.init(e,r),e.def=r,e.type=r.type,e),{check(...e){const r=this.def;return this.clone(Wn(r,{checks:[...r.checks??[],...e.map(i=>typeof i=="function"?{_zod:{check:i,def:{check:"custom"},onattach:[]}}:i)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,r){return yi(this,e,r)},brand(){return this},register(e,r){return e.add(this,r),this},refine(e,r){return this.check(RR(e,r))},superRefine(e,r){return this.check(AR(e,r))},overwrite(e){return this.check(ho(e))},optional(){return Fx(this)},exactOptional(){return yR(this)},nullable(){return Vx(this)},nullish(){return Fx(Vx(this))},nonoptional(e){return ER(this,e)},array(){return ta(this)},or(e){return lR([this,e])},and(e){return dR(this,e)},transform(e){return Yx(this,gR(e))},default(e){return xR(this,e)},prefault(e){return SR(this,e)},catch(e){return kR(this,e)},pipe(e){return Yx(this,e)},readonly(){return CR(this)},describe(e){const r=this.clone();return El.add(r,{description:e}),r},meta(...e){if(e.length===0)return El.get(this);const r=this.clone();return El.add(r,e[0]),r},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...r){return r.length===0?e(this):e(this,...r)},get"~standard"(){return Hw(this,"~standard",{...Yw(this),jsonSchema:{input:ud(this,"input"),output:ud(this,"output")}})},set"~standard"(e){pi(this,"~standard",e)},parse:function e(r,i){return bj(this,r,i,{callee:e})},parseAsync:async function e(r,i){return await xj(this,r,i,{callee:e})},safeParse(e,r){return wj(this,e,r)},async safeParseAsync(e,r){return Sj(this,e,r)},get spa(){return this?.safeParseAsync},set spa(e){pi(this,"spa",e)},validate(e,r){return L4(this,e,r)},validateAsync(e,r){return H4(this,e,r)},encode:function e(r,i){return Ej(this,r,i,{callee:e})},decode:function e(r,i){return Tj(this,r,i,{callee:e})},encodeAsync:async function e(r,i){return await kj(this,r,i,{callee:e})},decodeAsync:async function e(r,i){return await _j(this,r,i,{callee:e})},safeEncode(e,r){return Nj(this,e,r)},safeDecode(e,r){return Cj(this,e,r)},async safeEncodeAsync(e,r){return jj(this,e,r)},async safeDecodeAsync(e,r){return Rj(this,e,r)},toJSONSchema(e){return V3(this,{})(e)},get description(){return El.get(this)?.description},get _def(){return this._zod.def}}),wS=ae("_ZodString",(e,r)=>{ng.init(e,r),Mt.init(e,r),e._zod.processJSONSchema=(i,s,l)=>Q3(e,i,s)},Pw({format:e=>Cr(e).format??null,minLength:e=>Cr(e).minimum??null,maxLength:e=>Cr(e).maximum??null},{regex(...e){return this.check(R3(...e))},includes(...e){return this.check(M3(...e))},startsWith(...e){return this.check(z3(...e))},endsWith(...e){return this.check(D3(...e))},min(...e){return this.check(cd(...e))},max(...e){return this.check(oS(...e))},length(...e){return this.check(lS(...e))},nonempty(...e){return this.check(cd(1,...e))},lowercase(e){return this.check(A3(e))},uppercase(e){return this.check(O3(e))},trim(){return this.check(L3())},normalize(...e){return this.check(B3(...e))},toLowerCase(){return this.check(U3())},toUpperCase(){return this.check(H3())},slugify(){return this.check(P3())}})),Oj=ae("ZodString",(e,r)=>{ng.init(e,r),wS.init(e,r)},{email(e){return this.check(WC(Lj,e))},url(e){return this.check(i3(Hj,e))},jwt(e){return this.check(x3(eR,e))},emoji(e){return this.check(s3(Pj,e))},guid(e){return this.check(e3(Uj,e))},uuid(e){return this.check(t3(Ou,e))},uuidv4(e){return this.check(n3(Ou,e))},uuidv6(e){return this.check(r3(Ou,e))},uuidv7(e){return this.check(a3(Ou,e))},nanoid(e){return this.check(o3($j,e))},cuid(e){return this.check(l3(qj,e))},cuid2(e){return this.check(c3(Zj,e))},ulid(e){return this.check(u3(Ij,e))},base64(e){return this.check(y3(Xj,e))},base64url(e){return this.check(v3(Jj,e))},xid(e){return this.check(d3(Fj,e))},ksuid(e){return this.check(f3(Vj,e))},ipv4(e){return this.check(h3(Yj,e))},ipv6(e){return this.check(m3(Gj,e))},cidrv4(e){return this.check(p3(Kj,e))},cidrv6(e){return this.check(g3(Qj,e))},e164(e){return this.check(b3(Wj,e))},datetime(e){return this.check(w3(Mj,e))},date(e){return this.check(S3(zj,e))},time(e){return this.check(E3(Dj,e))},duration(e){return this.check(T3(Bj,e))}});function et(e){return JC(Oj,e)}const zt=ae("ZodStringFormat",(e,r)=>{jt.init(e,r),wS.init(e,r)}),Mj=ae("ZodISODateTime",(e,r)=>{eC.init(e,r),zt.init(e,r)}),zj=ae("ZodISODate",(e,r)=>{tC.init(e,r),zt.init(e,r)}),Dj=ae("ZodISOTime",(e,r)=>{nC.init(e,r),zt.init(e,r)}),Bj=ae("ZodISODuration",(e,r)=>{rC.init(e,r),zt.init(e,r)}),Lj=ae("ZodEmail",(e,r)=>{PN.init(e,r),zt.init(e,r)}),Uj=ae("ZodGUID",(e,r)=>{UN.init(e,r),zt.init(e,r)}),Ou=ae("ZodUUID",(e,r)=>{HN.init(e,r),zt.init(e,r)}),Hj=ae("ZodURL",(e,r)=>{VN.init(e,r),zt.init(e,r)}),Pj=ae("ZodEmoji",(e,r)=>{YN.init(e,r),zt.init(e,r)}),$j=ae("ZodNanoID",(e,r)=>{GN.init(e,r),zt.init(e,r)}),qj=ae("ZodCUID",(e,r)=>{KN.init(e,r),zt.init(e,r)}),Zj=ae("ZodCUID2",(e,r)=>{QN.init(e,r),zt.init(e,r)}),Ij=ae("ZodULID",(e,r)=>{XN.init(e,r),zt.init(e,r)}),Fj=ae("ZodXID",(e,r)=>{JN.init(e,r),zt.init(e,r)}),Vj=ae("ZodKSUID",(e,r)=>{WN.init(e,r),zt.init(e,r)}),Yj=ae("ZodIPv4",(e,r)=>{aC.init(e,r),zt.init(e,r)}),Gj=ae("ZodIPv6",(e,r)=>{sC.init(e,r),zt.init(e,r)}),Kj=ae("ZodCIDRv4",(e,r)=>{oC.init(e,r),zt.init(e,r)}),Qj=ae("ZodCIDRv6",(e,r)=>{cC.init(e,r),zt.init(e,r)}),Xj=ae("ZodBase64",(e,r)=>{uC.init(e,r),zt.init(e,r)}),Jj=ae("ZodBase64URL",(e,r)=>{fC.init(e,r),zt.init(e,r)}),Wj=ae("ZodE164",(e,r)=>{hC.init(e,r),zt.init(e,r)}),eR=ae("ZodJWT",(e,r)=>{pC.init(e,r),zt.init(e,r)}),SS=ae("ZodNumber",(e,r)=>{Ww.init(e,r),Mt.init(e,r),e._zod.processJSONSchema=(i,s,l)=>X3(e,i,s,l),e.isFinite=!0},Pw({minValue:e=>{const{minimum:r,exclusiveMinimum:i}=Cr(e);return Math.max(r??Number.NEGATIVE_INFINITY,i??Number.NEGATIVE_INFINITY)},maxValue:e=>{const{maximum:r,exclusiveMaximum:i}=Cr(e);return Math.min(r??Number.POSITIVE_INFINITY,i??Number.POSITIVE_INFINITY)},isInt:e=>{const{isInt:r,multipleOf:i}=Cr(e);return!!r||!!i?.some(Number.isSafeInteger)},format:e=>Cr(e).format??null},{gt(e,r){return this.check(Mx(e,r))},gte(e,r){return this.check(Em(e,r))},min(e,r){return this.check(Em(e,r))},lt(e,r){return this.check(Ox(e,r))},lte(e,r){return this.check(Sm(e,r))},max(e,r){return this.check(Sm(e,r))},int(e){return this.check(Zx(e))},safe(e){return this.check(Zx(e))},positive(e){return th)DELIM" +R"DELIM(is.check(Mx(0,e))},nonnegative(e){return this.check(Em(0,e))},negative(e){return this.check(Ox(0,e))},nonpositive(e){return this.check(Sm(0,e))},multipleOf(e,r){return this.check(zx(e,r))},step(e,r){return this.check(zx(e,r))},finite(){return this}}));function Ve(e){return k3(SS,e)}const tR=ae("ZodNumberFormat",(e,r)=>{gC.init(e,r),SS.init(e,r)});function Zx(e){return _3(tR,e)}const nR=ae("ZodBoolean",(e,r)=>{yC.init(e,r),Mt.init(e,r),e._zod.processJSONSchema=(i,s,l)=>J3(e,i,s)});function li(e){return N3(nR,e)}const rR=ae("ZodUnknown",(e,r)=>{vC.init(e,r),Mt.init(e,r),e._zod.processJSONSchema=(i,s,l)=>ej()});function mp(){return C3(rR)}const aR=ae("ZodNever",(e,r)=>{bC.init(e,r),Mt.init(e,r),e._zod.processJSONSchema=(i,s,l)=>W3(e,i,s)});function iR(e){return j3(aR,e)}const sR=ae("ZodArray",(e,r)=>{_d(),SC.init(e,r),Mt.init(e,r),e._zod.processJSONSchema=(i,s,l)=>ij(e,i,s,l),e.element=r.element},{min(e,r){return this.check(cd(e,r))},nonempty(e){return this.check(cd(1,e))},max(e,r){return this.check(oS(e,r))},length(e,r){return this.check(lS(e,r))},unwrap(){return this.element}});function ta(e,r){return $3(sR,e,r)}const oR=ae("ZodObject",(e,r)=>{_d(),kC.init(e,r),Mt.init(e,r),e._zod.processJSONSchema=(i,s,l)=>sj(e,i,s,l),E4(e,"shape",i=>i._zod.def.shape,!1)},{keyof(){return hR(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(Wn(this._zod.def,{catchall:e}))},passthrough(){return this.clone(Wn(this._zod.def,{catchall:mp()}))},loose(){return this.clone(Wn(this._zod.def,{catchall:mp()}))},strict(){return this.clone(Wn(this._zod.def,{catchall:iR()}))},strip(){return this.clone(Wn(this._zod.def,{catchall:void 0}))},extend(e){return f4(this,e)},safeExtend(e){return h4(this,e)},merge(e){return m4(this,e)},pick(e){return u4(this,e)},omit(e){return d4(this,e)},partial(...e){return mx(kS,this,e[0])},exactPartial(...e){return mx(_S,this,e[0],"exactPartial")},required(...e){return p4(NS,this,e[0])}});function Tt(e,r){const i={type:"object",shape:e??{},...Re(r)};return new oR(i)}const ES=ae("ZodUnion",(e,r)=>{nS.init(e,r),Mt.init(e,r),e._zod.processJSONSchema=(i,s,l)=>oj(e,i,s,l),e.options=r.options});function lR(e,r){return new ES({type:"union",options:e,...Re(r)})}const cR=ae("ZodDiscriminatedUnion",(e,r)=>{ES.init(e,r),NC.init(e,r)});function TS(e,r,i){return new cR({type:"union",options:r,discriminator:e,...Re(i)})}const uR=ae("ZodIntersection",(e,r)=>{CC.init(e,r),Mt.init(e,r),e._zod.processJSONSchema=(i,s,l)=>lj(e,i,s,l)});function dR(e,r){return new uR({type:"intersection",left:e,right:r})}const Ix=ae("ZodRecord",(e,r)=>{_d(),jC.init(e,r),Mt.init(e,r),e._zod.processJSONSchema=(i,s,l)=>uj(e,i,s,l),e.keyType=r.keyType,e.valueType=r.valueType});function fR(e,r,i){return!r||!r._zod?new Ix({type:"record",keyType:et(),valueType:e,...Re(r)}):new Ix({type:"record",keyType:e,valueType:r,...Re(i)})}const pp=ae("ZodEnum",(e,r)=>{RC.init(e,r),Mt.init(e,r),e._zod.processJSONSchema=(s,l,c)=>tj(e,s,l),e.enum=r.entries,e.options=[...e._zod.values];const i=new Set(Object.keys(r.entries));e.extract=(s,l)=>{const c={};for(const d of s)if(i.has(d))c[d]=r.entries[d];else throw new Error(`Key ${d} not found in enum`);return new pp({...r,checks:[],...Re(l),entries:c})},e.exclude=(s,l)=>{const c={...r.entries};for(const d of s)if(i.has(d))delete c[d];else throw new Error(`Key ${d} not found in enum`);return new pp({...r,checks:[],...Re(l),entries:c})}});function hR(e,r){const i=Array.isArray(e)?Object.fromEntries(e.map(s=>[s,s])):e;return new pp({type:"enum",entries:i,...Re(r)})}const mR=ae("ZodLiteral",(e,r)=>{AC.init(e,r),Mt.init(e,r),e._zod.processJSONSchema=(i,s,l)=>nj(e,i,s,l),e.values=new Set(r.values),Object.defineProperty(e,"value",{get(){if(r.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return r.values[0]}})});function ci(e,r){return new mR({type:"literal",values:Array.isArray(e)?e:[e],...Re(r)})}const pR=ae("ZodTransform",(e,r)=>{_d(),OC.init(e,r),Mt.init(e,r),e._zod.processJSONSchema=(i,s,l)=>aj(e,i,s,l),e._zod.parse=(i,s)=>{if(s.direction==="backward")throw new $w(e.constructor.name);i.addIssue=c=>{if(typeof c=="string")i.issues.push(Hl(c,i.value,r));else{const d=c;d.fatal&&(d.continue=!1),d.code??(d.code="custom"),"input"in d||(d.input=i.value),d.inst??(d.inst=e),i.issues.push(Hl(d))}};const l=r.transform(i.value,i);return l instanceof Promise?l.then(c=>(i.value=c,i)):(i.value=l,i)}});function gR(e){return new pR({type:"transform",transform:e})}const kS=ae("ZodOptional",(e,r)=>{rS.init(e,r),Mt.init(e,r),e._zod.processJSONSchema=(i,s,l)=>xS(e,i,s,l),e.unwrap=()=>e._zod.def.innerType});function Fx(e){return new kS({type:"optional",innerType:e})}const _S=ae("ZodExactOptional",(e,r)=>{MC.init(e,r),Mt.init(e,r),e._zod.processJSONSchema=(i,s,l)=>xS(e,i,s,l),e.unwrap=()=>e._zod.def.innerType});function yR(e){return new _S({type:"optional",innerType:e})}const vR=ae("ZodNullable",(e,r)=>{zC.init(e,r),Mt.init(e,r),e._zod.processJSONSchema=(i,s,l)=>dj(e,i,s,l),e.unwrap=()=>e._zod.def.innerType});function Vx(e){return new vR({type:"nullable",innerType:e})}const bR=ae("ZodDefault",(e,r)=>{DC.init(e,r),Mt.init(e,r),e._zod.processJSONSchema=(i,s,l)=>hj(e,i,s,l),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function xR(e,r){return new bR({type:"default",innerType:e,get defaultValue(){return typeof r=="function"?r():Dw(r)}})}const wR=ae("ZodPrefault",(e,r)=>{BC.init(e,r),Mt.init(e,r),e._zod.processJSONSchema=(i,s,l)=>mj(e,i,s,l),e.unwrap=()=>e._zod.def.innerType});function SR(e,r){return new wR({type:"prefault",innerType:e,get defaultValue(){return typeof r=="function"?r():Dw(r)}})}const NS=ae("ZodNonOptional",(e,r)=>{LC.init(e,r),Mt.init(e,r),e._zod.processJSONSchema=(i,s,l)=>fj(e,i,s,l),e.unwrap=()=>e._zod.def.innerType});function ER(e,r){return new NS({type:"nonoptional",innerType:e,...Re(r)})}const TR=ae("ZodCatch",(e,r)=>{UC.init(e,r),Mt.init(e,r),e._zod.processJSONSchema=(i,s,l)=>pj(e,i,s,l),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function kR(e,r){return new TR({type:"catch",innerType:e,catchValue:typeof r=="function"?r:k4(r)})}const _R=ae("ZodPipe",(e,r)=>{HC.init(e,r),Mt.init(e,r),e._zod.processJSONSchema=(i,s,l)=>gj(e,i,s,l),e.in=r.in,e.out=r.out});function Yx(e,r){return new _R({type:"pipe",in:e,out:r})}const NR=ae("ZodReadonly",(e,r)=>{PC.init(e,r),Mt.init(e,r),e._zod.processJSONSchema=(i,s,l)=>yj(e,i,s,l),e.unwrap=()=>e._zod.def.innerType});function CR(e){return new NR({type:"readonly",innerType:e})}const jR=ae("ZodCustom",(e,r)=>{$C.init(e,r),Mt.init(e,r),e._zod.processJSONSchema=(i,s,l)=>rj(e,i,s,l)});function RR(e,r={}){return q3(jR,e,r)}function AR(e,r){return Z3(e,r)}function xa(e){if(!e)return;const r=e.trim();if(!r)return;const i=r.toLowerCase(),s=i.indexOf("1");if(s>0){const d=i.slice(0,s);if(["bc","tb","bcrt","ltc","sb"].includes(d)){const f=i.slice(s+1);if(!f)return;const m=f.charAt(0);return m==="p"?"p2tr":m==="q"?f.length===39||f.length===40||e.length===42?"p2wpkh":f.length===59||f.length===60||e.length===62?"p2wsh":"segwit":"segwit"}}const l=/^[123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]+$/u.test(r)&&r.length>=26&&r.length<=35;switch(i[0]){case"1":case"m":case"n":return l?"p2pkh":void 0;case"3":case"2":return l?"p2sh":void 0;default:return}}const ig=e=>Object.freeze(e());function CS(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"&&"BYTES_PER_ELEMENT"in e&&e.BYTES_PER_ELEMENT===1}function Qi(e){if(!CS(e))throw new TypeError("Uint8Array expected")}function OR(e,r){return Array.isArray(r)?r.length===0?!0:r.every(i=>Number.isSafeInteger(i)):!1}function sg(e){if(typeof e!="function")throw new TypeError("function expected");return!0}function fd(e,r){if(typeof r!="string")throw new TypeError(`${e}: string expected`);return!0}function hd(e,r="number"){if(typeof e!="number")throw new TypeError(`${r}: expected number, got ${typeof e}`);if(!Number.isSafeInteger(e))throw new RangeError(`${r}: expected)DELIM" +R"DELIM( safe integer, got ${e}`)}function Gx(e,r){if(!OR(!1,r))throw new TypeError(`${e}: array of numbers expected`)}function MR(...e){const r=c=>c,i=(c,d)=>f=>c(d(f)),s=e.map(c=>c.encode).reduceRight(i,r),l=e.map(c=>c.decode).reduce(i,r);return{encode:s,decode:l}}const zR=(()=>{let e=[];for(let r=0;r<40;r++)e.push(2**r);return e})();function Kx(e,r=e.length){const i=new Array(r);for(let s=0;s{try{const e=new TextDecoder;return e.decode(Uint8Array.of(65,48,43,127))==="A0+"?e:void 0}catch{return}})(),Tm=8192;function DR(e){const r=e.length;if(Qx!==void 0&&r>=12)return Qx.decode(e);if(r<=Tm)return String.fromCharCode.apply(null,e);let i="";for(let s=0;s8)throw new RangeError("radix2: bits should be in (0..8]");const r=zR[e]-1;return{encode:i=>{Qi(i);const s=i.length,l=new Uint8Array(Math.ceil(s*8/e));let c=0,d=0,f=0;for(let m=0;m>d&r,!(d0&&(l[f]=c<{const s=i.length,l=new Uint8Array(Math.floor(s*e/8));let c=0,d=0,f=0;for(let m=0;m=8;d-=8)l[f++]=c>>d-8&255;if(c=c<<8-d&255,d>=e)throw new Error("Excess padding");if(c>0)throw new Error(`Non-zero padding: ${c}`);return l}}}function jS(e,r){const i=e.length;if(i>128)throw new Error("alphabet: max 128 letters");const s=new Uint8Array(i),l=new Int8Array(128).fill(-1);for(let c=0;c127)throw new Error("alphabet: single-char ASCII letters only");s[c]=d,l[d]=c}if(r!==void 0)for(const c of Object.keys(r)){const d=c.charCodeAt(0),f=l[r[c].charCodeAt(0)];if(c.length!==1||d>127||f===void 0||f===-1)throw new Error(`alphabet: invalid alias ${c}`);l[d]=f}return{encode:c=>{const d=new Uint8Array(c.length);for(let f=0;f{fd("decode",c);const d=c.length,f=new Uint8Array(d);for(let m=0;m({encode:i=>{Qi(i);const s=i.length;if(s===0)return new Uint8Array(0);if(s>=Jx)throw new Error("invalid length");let l=0;for(;l=l;E=Math.floor(E/e))x[w--]=E%e;return x},decode:i=>{Qi(i);const s=i.length;if(s===0)return new Uint8Array(0);if(s>=Jx)throw new Error("invalid length");let l=0;for(;l=e)throw new Error(`invalid integer: ${N}`);x=x*e+N,w*=e}m=5;let E=x;for(let _=0;_0;E=Math.floor(E/65536))c[d++]=E%65536}const g=d===0?1:d*2-(c[d-1]<256?1:0),v=new Uint8Array(l+g);let y=v.length-1;for(let x=0;x=l&&(v[y--]=w>>8)}return v}}),qR=(e,r)=>{const i=jS(r);return{encode(s){if(Qi(s),s.length>HR)throw new Error("invalid length");return i.encode(e.encode(s))},decode(s){if(fd("baseN.decode",s),s.length>PR)throw new Error("invalid length");return e.decode(i.decode(s))}}},ZR=$R(58,UR),IR=e=>qR(ZR,e),FR=ig(()=>IR("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz")),VR=e=>{sg(e);const r=e;return MR(LR(4,i=>r(r(i))),FR)},gp=jS("qpzry9x8gf2tvdw0s3jn54khce6mua7l"),YR=/^[\x21-\x60\x7b-\x7e]+$/;function Wx(e,r){for(let i=0;i126)throw new Error(`${e}: printable ASCII expected`)}}function GR(e){const r=e.length,i=new Uint8Array(r);for(let s=0;s=32)throw new Error(`alphabet.encode: invalid digit ${l}`);i[s]=l}return i}const e1=[996825010,642813549,513874426,1027748829,705979059];function ml(e){const r=e>>25;let i=(e&33554431)<<5;for(let s=0;s>s&1)===1&&(i^=e1[s]);return i}function t1(e,r,i=1){const s=e.length;let l=1;for(let d=0;d126)throw new Error(`Invalid prefix (${e})`);l=ml(l)^f>>5}l=ml(l);for(let d=0;d>>5*(5-d)&31;return gp.encode(c)}function RS(e){const r=e==="bech32"?1:734539939,i=BR(5),s=y=>{Qi(y);const x=y.length,w=new Array(Math.ceil(x*8/5));let E=0,_=0,N=0;for(let H=0;H=5;_-=5)w[N++]=E>>_-5&31;return _>0&&(w[N]=E<<5-_&31),w},l=y=>{Gx("radix2.decode",y);const x=y.length,w=new Uint8Array(x);for(let E=0;E=32)throw new Error(`convertRadix2: invalid word=${_}`);w[E]=_}return i.decode(w)},c=Xx(l);function d(y,x,w=90){fd("bech32.encode prefix",y),w!==!1&&hd(w,"limit"),CS(x)&&(x=Kx(x)),Gx("bech32.encode",x);const E=y.length;if(E===0)throw new TypeError(`Invalid prefix length ${E}`);const _=E+7+x.length;if(w!==!1&&_>w)throw new TypeError(`Length ${_} exceeds limit ${w}`);Wx("bech32.encode prefix",y);const N=y.toLowerCase(),H=t1(N,x,r);return`${N}1${gp.encode(GR(x))}${H}`}function f(y,x=90){fd("bech32.decode input",y),x!==!1&&hd(x,"limit");const w=y.length;if(w<8||x!==!1&&w>x)throw new TypeError(`invalid string length ${w}, expected (8..${x})`);const E=y.toLowerCase();if(y!==E&&!YR.test(y))throw Wx("bech32.decode input",y),new Error("mixed-case string not allowed");const _=E.lastIndexOf("1");if(_===0||_===-1)throw new Error('invalid separator "1"');const N=E.slice(0,_),H=E.slice(_+1);if(H.length<6)throw new Error("invalid data length");const O=gp.decode(H),se=Kx(O,O.length-6),ce=t1(N,se,r);if(!H.endsWith(ce))throw new Error(`Invalid checksum in ${y}`);return{prefix:N,words:se}}const m=Xx(f);function g(y,x=90){const{prefix:w,words:E}=f(y,x);return{prefix:w,words:E,bytes:l(E)}}function v(y,x){return d(y,s(x))}return{encode:d,decode:f,encodeFromBytes:v,decodeToBytes:g,decodeUnsafe:m,fromWords:l,fromWordsUnsafe:c,toWords:s}}const md=ig(()=>RS("bech32")),yp=ig(()=>RS("bech32m")),KR=e=>e/2**32|0,QR=e=>e>>>0;function XR(e,r,i,s){const l=KR(i),c=QR(i);e.setUint32(r,s?c:l,s),e.setUint32(r+4,s?l:c,s)}function n1(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"&&"BYTES_PER_ELEMENT"in e&&e.BYTES_PER_ELEMENT===1}const JR=e=>e?`"${e}" `:"";function og(e,r,i=""){if(n1(e)&&r===void 0)return e;const s=n1(e),l="",c=s?`length=${e.length}`:`type=${typeof e}`,d=JR(i)+"expected Uint8Array"+l+", got "+c;throw s?new RangeError(d):new TypeError(d)}const WR=(e,r)=>{if(e===null||typeof e!="object"||Array.isArray(e))throw new TypeError((r==="object"?"":`"${r}" `)+"expected object, got type="+typeof e)},r1=(e,r)=>{WR(e,r);const i=Object.getPrototypeOf(e);if(i!==Object.prototype&&i!==null)throw new TypeError(`"${r}" expected plain object`);if(Object.hasOwn(e,"__proto__"))throw new TypeError(`"${r}.__proto__" is not allowed`)};fu)DELIM" +R"DELIM(nction a1(e,r=!0){if(e.destroyed)throw new Error("hash was destroyed");if(r&&e.finished)throw new Error("digest() was already called")}function eA(e,r){og(e,void 0,"output");const i=r.outputLen;if(!(e.length>=i))throw new RangeError('"output" expected length >= '+i)}function i1(...e){for(let r=0;r>>r}const tA=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",nA=Array.from({length:256},(e,r)=>r.toString(16).padStart(2,"0"));function Gu(e){if(og(e),tA)return e.toHex();let r="";for(let i=0;i{let v={relativePath:g===void 0?d.path||"":g,caseSensitive:d.caseSensitive===!0,childrenIndex:f,route:d};if(v.relativePath.startsWith("/")){if(!v.relativePath.startsWith(s)&&m)return;qe(v.relativePath.startsWith(s),`Absolute route path "${v.relativePath}" nested under path "${s}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),v.relativePath=v.relativePath.slice(s.length)}let y=pr([s,v.relativePath]),x=i.concat(v);d.children&&d.children.length>0&&(qe(d.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${y}".`),yE(d.children,r,x,y,m)),!(d.path==null&&!d.index)&&r.push({path:y,score:IO(y,d.index),routesMeta:x.map((w,E)=>{let[_,N]=xE(w.relativePath,w.caseSensitive,E===x.length-1);return{...w,matcher:_,compiledParams:N}})})};return e.forEach((d,f)=>{if(d.path===""||!d.path?.includes("?"))c(d,f);else for(let m of vE(d.path))c(d,f,!0,m)}),r}function vE(e){let r=e.split("/");if(r.length===0)return[];let[i,...s]=r,l=i.endsWith("?"),c=i.replace(/\?$/,"");if(s.length===0)return l?[c,""]:[c];let d=vE(s.join("/")),f=[];return f.push(...d.map(m=>m===""?c:[c,m].join("/"))),l&&f.push(...d),f.map(m=>e.startsWith("/")&&m===""?"/":m)}function LO(e){e.sort((r,i)=>r.score!==i.score?i.score-r.score:FO(r.routesMeta.map(s=>s.childrenIndex),i.routesMeta.map(s=>s.childrenIndex)))}var UO=/^:[\w-]+$/,HO=3,PO=2,$O=1,qO=10,ZO=-2,C1=e=>e==="*";function IO(e,r){let i=e.split("/"),s=i.length;return i.some(C1)&&(s+=ZO),r&&(s+=PO),i.filter(l=>!C1(l)).reduce((l,c)=>l+(UO.test(c)?HO:c===""?$O:qO),s)}function FO(e,r){return e.length===r.length&&e.slice(0,-1).every((s,l)=>s===r[l])?e[e.length-1]-r[r.length-1]:0}function VO(e,r,i=!1){let{routesMeta:s}=e,l={},c="/",d=[];for(let f=0;f{if(v==="*"){let E=f[x]||"";d=co(c.slice(0,c.length-E.length),1)}const w=f[x];return y&&!w?g[v]=void 0:g[v]=(w||"").replace(/%2F/g,"/"),g},{}),pathname:c,pathnameBase:d,pattern:e}}function xE(e,r=!1,i=!0){Ct(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let s=[],l="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(d,f,m,g,v)=>{if(s.push({paramName:f,isOptional:m!=null}),m){let y=v.charAt(g+d.length);return y&&y!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(s.push({paramName:"*"}),l+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):i?l+="\\/*$":e!==""&&e!=="/"&&(l+="(?:(?=\\/|$))"),[new RegExp(l,r?void 0:"i"),s]}function YO(e){try{return e.split("/").map(r=>decodeURIComponent(r).replace(/\//g,"%2F")).join("/")}catch(r){return Ct(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${r}).`),e}}function tr(e,r){if(r==="/")return e;if(!e.toLowerCase().startsWith(r.toLowerCase()))return null;let i=r.endsWith("/")?r.length-1:r.length,s=e.charAt(i);return s&&s!=="/"?null:e.slice(i)||"/"}function GO({basename:e,pathname:r}){return r==="/"?e:pr([e,r])}var gg=e=>jd.test(e);function KO(e,r="/"){let{pathname:i,search:s="",hash:l=""}=typeof e=="string"?ra(e):e,c;return i?(i=yg(i),i.startsWith("/")||i.startsWith("\\")?c=j1(i.substring(1),"/"):c=j1(i,r)):c=r,{pathname:c,search:XO(s),hash:JO(l)}}function j1(e,r){let i=co(r).split("/");return e.split("/").forEach(l=>{l===".."?i.length>1&&i.pop():l!=="."&&i.push(l)}),i.length>1?i.join("/"):"/"}function Lm(e,r,i,s){return`Cannot include a '${e}' character in a manually specified \`to.${r}\` field [${JSON.stringify(s)}]. Please separate it out to the \`to.${i}\` field. Alternatively you may provide the full path as a string in and the router will parse it for you.`}function wE(e){return e.filter((r,i)=>i===0||r.route.path&&r.route.path.length>0)}function Ad(e){let r=wE(e);return r.map((i,s)=>s===r.length-1?i.pathname:i.pathnameBase)}function Kl(e,r,i,s=!1){let l;typeof e=="string"?l=ra(e):(l={...e},qe(!l.pathname||!l.pathname.includes("?"),Lm("?","pathname","search",l)),qe(!l.pathname||!l.pathname.includes("#"),Lm("#","pathname","hash",l)),qe(!l.search||!l.search.includes("#"),Lm("#","search","hash",l)));let c=e===""||l.pathname==="",d=c?"/":l.pathname,f;if(d==null)f=i;else{let y=r.length-1;if(!s&&d.startsWith("..")){let x=d.split("/");for(;x[0]==="..";)x.shift(),y-=1;l.pathname=x.join("/")}f=y>=0?r[y]:"/"}let m=KO(l,f),g=d&&d!=="/"&&d.endsWith("/"),v=(c||d===".")&&i.endsWith("/");return!m.pathname.endsWith("/")&&(g||v)&&(m.pathname+="/"),m}var yg=e=>e.replace(/[\\/]{2,}/g,"/"),pr=e=>yg(e.join("/"));function co(e,r=0){let i=e.length;for(;i>r&&e.charCodeAt(i-1)===47;)i--;return i===e.length?e:e.slice(0,i)}var QO=e=>co(e).replace(/^\/*/,"/"),XO=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,JO=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,WO=["EvalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],Ql=class{constructor(e,r,i,s=!1){this.status=e,this.statusText=r||"",this.internal=s,i instanceof Error?(this.data=i.toString(),this.error=i):this.data=i}};function Zl(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.interna)DELIM" +R"DELIM(l=="boolean"&&"data"in e}function Xl(e){let r=e.map(i=>i.route.path).filter(Boolean);return pr(r)||"/"}var SE=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function EE(e,r){let i=e;if(typeof i!="string"||!jd.test(i))return{absoluteURL:void 0,isExternal:!1,to:i};let s=i,l=!1;if(SE)try{let c=new URL(window.location.href),d=Rd.test(i)?new URL(fE(i,c.protocol)):new URL(i),f=tr(d.pathname,r);d.origin===c.origin&&f!=null?i=f+d.search+d.hash:l=!0}catch{Ct(!1,` contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:s,isExternal:l,to:i}}var fi=Symbol("Uninstrumented");function eM(e,r){let i={lazy:[],"lazy.loader":[],"lazy.action":[],"lazy.middleware":[],middleware:[],loader:[],action:[]};e.forEach(l=>l({id:r.id,index:r.index,path:r.path,instrument(c){let d=Object.keys(i);for(let f of d)c[f]&&i[f].push(c[f])}}));let s={};if(typeof r.lazy=="function"&&i.lazy.length>0){let l=Xs(i.lazy,r.lazy,()=>{});l&&(s.lazy=l)}if(typeof r.lazy=="object"){let l=r.lazy;["middleware","loader","action"].forEach(c=>{let d=l[c],f=i[`lazy.${c}`];if(typeof d=="function"&&f.length>0){let m=Xs(f,d,()=>{});m&&(s.lazy=Object.assign(s.lazy||{},{[c]:m}))}})}return["loader","action"].forEach(l=>{let c=r[l];if(typeof c=="function"&&i[l].length>0){let d=c[fi]??c,f=Xs(i[l],d,(...m)=>R1(m[0]));f&&(l==="loader"&&d.hydrate===!0&&(f.hydrate=!0),f[fi]=d,s[l]=f)}}),r.middleware&&r.middleware.length>0&&i.middleware.length>0&&(s.middleware=r.middleware.map(l=>{let c=l[fi]??l,d=Xs(i.middleware,c,(...f)=>R1(f[0]));return d?(d[fi]=c,d):l})),s}function tM(e,r){let i={navigate:[],fetch:[]};if(r.forEach(s=>s({instrument(l){let c=Object.keys(l);for(let d of c)l[d]&&i[d].push(l[d])}})),i.navigate.length>0){let s=e.navigate[fi]??e.navigate,l=Xs(i.navigate,s,(...c)=>{let[d,f]=c;return{to:typeof d=="number"||typeof d=="string"?d:d?Mn(d):".",...A1(e,f??{})}});l&&(l[fi]=s,e.navigate=l)}if(i.fetch.length>0){let s=e.fetch[fi]??e.fetch,l=Xs(i.fetch,s,(...c)=>{let[d,,f,m]=c;return{href:f??".",fetcherKey:d,...A1(e,m??{})}});l&&(l[fi]=s,e.fetch=l)}return e}function Xs(e,r,i){return e.length===0?null:async(...s)=>{let l=await TE(e,i(...s),()=>r(...s),e.length-1);if(l.type==="error")throw l.value;return l.value}}async function TE(e,r,i,s){let l=e[s],c;if(l){let d,f=async()=>(d?console.error("You cannot call instrumented handlers more than once"):d=TE(e,r,i,s-1),c=await d,qe(c,"Expected a result"),c.type==="error"&&c.value instanceof Error?{status:"error",error:c.value}:{status:"success",error:void 0});try{await l(f,r)}catch(m){console.error("An instrumentation function threw an error:",m)}d||await f(),await d}else try{c={type:"success",value:await i()}}catch(d){c={type:"error",value:d}}return c||{type:"error",value:new Error("No result assigned in instrumentation chain.")}}function R1(e){let{request:r,context:i,params:s,pattern:l}=e;return{request:nM(r),params:{...s},pattern:l,context:rM(i)}}function A1(e,r){return{currentUrl:Mn(e.state.location),..."formMethod"in r?{formMethod:r.formMethod}:{},..."formEncType"in r?{formEncType:r.formEncType}:{},..."formData"in r?{formData:r.formData}:{},..."body"in r?{body:r.body}:{}}}function nM(e){return{method:e.method,url:e.url,headers:{get:(...r)=>e.headers.get(...r)}}}function rM(e){if(iM(e)){let r={...e};return Object.freeze(r),r}else return{get:r=>e.get(r)}}var aM=Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function iM(e){if(e===null||typeof e!="object")return!1;const r=Object.getPrototypeOf(e);return r===Object.prototype||r===null||Object.getOwnPropertyNames(r).sort().join("\0")===aM}var O1=new URL("http://localhost");function vg(e){if(e.createURL)return e.createURL("/");try{return new URL(e.createHref("/"),O1)}catch{return O1}}function Um(e,r){return e.origin===r.origin&&(e.origin!=="null"||e.protocol===r.protocol&&e.host===r.host)}function sM(e,r){if(e.startsWith("//"))return!0;let i=r.protocol.toLowerCase();return e.toLowerCase().startsWith(i)?r.host===""||e.slice(i.length).startsWith("//"):!1}function Ws(e,r,i,s){let l=null;try{l=e==null?null:new URL(e,i)}catch{}let c=new URL(r,i),d=l!=null&&!Um(l,i),f=!Um(c,i);if(s==="reject"){if(d||f)throw new Error("External navigation is not allowed")}else if(f&&(l==null||!sM(e,l)||!Um(l,c)))throw new Error("External navigation is not allowed")}var kE=["POST","PUT","PATCH","DELETE"],oM=new Set(kE),lM=["GET",...kE],cM=new Set(lM),_E=new Set([301,302,303,307,308]),uM=new Set([307,308]),Hm={state:"idle",location:void 0,matches:void 0,historyAction:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},dM={state:"idle",data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},yl={state:"unblocked",proceed:void 0,reset:void 0,location:void 0},fM=e=>({hasErrorBoundary:!!e.hasErrorBoundary}),NE="remix-router-transitions",CE=Symbol("ResetLoaderData"),Zi,Vs,si,Ys,hM=class{constructor(e){_l(this,Zi),_l(this,Vs),_l(this,si),_l(this,Ys),Kr(this,Zi,e),Kr(this,Vs,Ju(e))}get stableRoutes(){return fr(this,Zi)}get activeRoutes(){return fr(this,si)??fr(this,Zi)}get branches(){return fr(this,Ys)??fr(this,Vs)}get hasHMRRoutes(){return fr(this,si)!=null}setRoutes(e){Kr(this,Zi,e),Kr(this,Vs,Ju(e))}setHmrRoutes(e){Kr(this,si,e),Kr(this,Ys,Ju(e))}commitHmrRoutes(){fr(this,si)&&(Kr(this,Zi,fr(this,si)),Kr(this,Vs,fr(this,Ys)),Kr(this,si,void 0),Kr(this,Ys,void 0))}};Zi=new WeakMap;Vs=new WeakMap;si=new WeakMap;Ys=new WeakMap;function mM(e){const r=e.window?e.window:typeof window<"u"?window:void 0,i=typeof r<"u"&&typeof r.document<"u"&&typeof r.document.createElement<"u";qe(e.routes.length>0,"You must provide a non-empty routes array to createRouter");let s=e.hydrationRouteProperties||[],l=e.mapRouteProperties||fM,c=l;if(e.instrumentations){let A=e.instrumentations;c=D=>({...l(D),...eM(A.map(I=>I.route).filter(Boolean),D)})}let d={},f=new hM(ql(e.routes,c,void 0,d)),m=e.basename||"/";m.startsWith("/")||(m=`/${m}`);let g=e.dataStrategy||bM,v={...e.future},y=null,x=new Set,w=null,E=null,_=null,N=null,H=e.hydrationData!=null,O=Nr(f.activeRoutes,e.history.location,m,!1,f.branches),se=!1,ce=null,K,oe;if(O==null&&!e.patchRoutesOnNavigation){let A=hr(404,{pathname:e.history.location.pathname}),{matches:D,route:I}=Uu(f.activeRoutes);K=!0,oe=!K,O=D,ce={[I.id]:A}}else if(O&&!e.hydrationData&&Or(O,f.activeRoutes,e.history.location.pathname).active&&(O=null),O)if(O.some(A=>A.route.lazy))K=!1,oe=!K;else if(!O.some(A=>bg(A.route)))K=!0,oe=!K;else{let A=e.hydrationData?e.hydrationData.loaderData:null,D=e.hydrationData?e.hydrationData.errors:null,I=O;if(D){let ue=O.findIndex(de=>D[de.route.id]!==void 0);I=I.slice(0,ue+1)}oe=!1,K=!0,I.forEach(ue=>{let de=jE(ue.route,A,D);oe=oe||de.renderFallback,K=K&&!de.shouldLoad})}else{K=!1,oe=!K,O=[];let A=Or(null,f.activeRoutes,e.history.location.pathname);A.active&&A.matches&&(se=!0,O=A.matches)}let R,k={historyAction:e.history.action,location:e.history.location,matches:O,initialized:K,renderFallback:oe,navigation:Hm,restoreScrollPosition:e.hydrationData!=null?!1:null,preventScrollReset:!1,revalidation:"idle",loaderData:e.hydrationData&&e.hydrationData.loaderData||{},actionData:e.hydrationData&&e.hydrationData.actionData||null,errors:e.hydrationData&&e.hydrationData.errors||ce,fetchers:new Map,blockers:new Map},z="POP",P=null,F=!1,X,fe=!1,ge=new Map,re=null,Q=!1,Y=!1,ie=new Set,$=new Map,ye=0,He=-1,xe=new Map,Ce=new Set,j=new Map,G=new Map,he=new Set,ee=new Map,je,J=null;function me(){if(y=e.history.listen(({action:A,location:D,delta:I})=>{if(je){je(),je=void 0;return}Ct(ee.size===0||I!=null,"You are trying to use a blocker on a POP navigation to a location that was not created by @remix-run/router. This will fail silently in production. This can happen if you are navigating outside the router via `window.history.pushState`/`window.location.hash` instead of using router navigation APIs. This can also)DELIM" +R"DELIM( happen if you are using createHashRouter and the user manually changes the URL.");let ue=xo({currentLocation:k.location,nextLocation:D,historyAction:A});if(ue&&I!=null){let de=new Promise(Te=>{je=Te});e.history.go(I*-1),vi(ue,{state:"blocked",location:D,proceed(){vi(ue,{state:"proceeding",proceed:void 0,reset:void 0,location:D}),de.then(()=>e.history.go(I))},reset(){let Te=new Map(k.blockers);Te.set(ue,yl),be({blockers:Te})}}),P?.resolve(),P=null;return}return Be(A,D)}),i){UM(r,ge);let A=()=>HM(r,ge);r.addEventListener("pagehide",A),re=()=>r.removeEventListener("pagehide",A)}return k.initialized||Be("POP",k.location,{initialHydration:!0}),R}function W(){y&&y(),re&&re(),x.clear(),X&&X.abort(),k.fetchers.forEach((A,D)=>es(k.fetchers,D)),k.blockers.forEach((A,D)=>ac(D))}function le(A){if(x.add(A),w){let{newErrors:D}=w;w=null,A(k,{deletedFetchers:[],newErrors:D,viewTransitionOpts:void 0,flushSync:!1})}return()=>x.delete(A)}function be(A,D={}){A.matches&&(A.matches=A.matches.map(de=>{let Te=d[de.route.id],Se=de.route;return Se.element!==Te.element||Se.errorElement!==Te.errorElement||Se.hydrateFallbackElement!==Te.hydrateFallbackElement?{...de,route:Te}:de})),k={...k,...A};let I=[],ue=[];k.fetchers.forEach((de,Te)=>{de.state==="idle"&&(he.has(Te)?I.push(Te):ue.push(Te))}),he.forEach(de=>{!k.fetchers.has(de)&&!$.has(de)&&I.push(de)}),x.size===0&&(w={newErrors:A.errors??null}),[...x].forEach(de=>de(k,{deletedFetchers:I,newErrors:A.errors??null,viewTransitionOpts:D.viewTransitionOpts,flushSync:D.flushSync===!0})),I.forEach(de=>es(k.fetchers,de)),ue.forEach(de=>k.fetchers.delete(de))}function pe(A,D,{flushSync:I}={}){let ue=k.actionData!=null&&k.navigation.formMethod!=null&&Tn(k.navigation.formMethod)&&k.navigation.state==="loading"&&A.state?._isRedirect!==!0,de;D.actionData?Object.keys(D.actionData).length>0?de=D.actionData:de=null:ue?de=k.actionData:de=null;let Te=D.loaderData?q1(k.loaderData,D.loaderData,D.matches||[],D.errors):k.loaderData,Se=k.blockers;Se.size>0&&(Se=new Map(Se),Se.forEach((Ae,Pe)=>Se.set(Pe,yl)));let Ne=Q?!1:ic(A,D.matches||k.matches),Ee=F===!0||k.navigation.formMethod!=null&&Tn(k.navigation.formMethod)&&A.state?._isRedirect!==!0;f.commitHmrRoutes(),Q||z==="POP"||(z==="PUSH"?e.history.push(A,A.state):z==="REPLACE"&&e.history.replace(A,A.state));let De;if(z==="POP"&&!Q&&A!==k.location){let Ae=ge.get(k.location.pathname);Ae&&Ae.has(A.pathname)?De={currentLocation:k.location,nextLocation:A}:ge.has(A.pathname)&&(De={currentLocation:A,nextLocation:k.location})}else if(fe){let Ae=ge.get(k.location.pathname);Ae?Ae.add(A.pathname):(Ae=new Set([A.pathname]),ge.set(k.location.pathname,Ae)),De={currentLocation:k.location,nextLocation:A}}be({...D,actionData:de,loaderData:Te,historyAction:z,location:A,initialized:!0,renderFallback:!1,navigation:Hm,revalidation:"idle",restoreScrollPosition:Ne,preventScrollReset:Ee,blockers:Se},{viewTransitionOpts:De,flushSync:I===!0}),z="POP",F=!1,fe=!1,Q=!1,Y=!1,P?.resolve(),P=null,J?.resolve(),J=null}async function _e(A,D){if(P?.resolve(),P=null,typeof A=="number"){P||(P=V1());let mt=P.promise;return e.history.go(A),mt}let I=kp(k.location,k.matches,m,A,D?.fromRouteId,D?.relative),{path:ue,submission:de,error:Te}=M1(!1,I,D),Se;if(D?.mask){let mt=typeof D.mask=="string"?ra(D.mask):{...k.location.mask,...D.mask};if(Se={pathname:mt.pathname??"",search:mt.search??"",hash:mt.hash??""},Rd.test(Se.pathname))throw new Error("External navigation is not allowed");Se.pathname.startsWith("\\")&&(Se.pathname=Se.pathname.replace(/^\\+/,"/")),Ws(typeof D.mask=="string"?D.mask:Mn(D.mask),Mn(Se),e.history.createURL("/"),"reject")}let Ne=k.location,Ee=$l(Ne,ue,D&&D.state,void 0,Se);Ee={...Ee,...e.history.encodeLocation(Ee)},Ws(A==null?e.history.createHref(k.location):typeof A=="string"?A:Mn(A),e.history.createHref(Ee.mask||Ee),e.history.createURL("/"),"reject");let De=D&&D.replace!=null?D.replace:void 0,Ae="PUSH";De===!0?Ae="REPLACE":De===!1||de!=null&&Tn(de.formMethod)&&de.formAction===k.location.pathname+k.location.search&&(Ae="REPLACE");let Pe=D&&"preventScrollReset"in D?D.preventScrollReset===!0:void 0,ze=(D&&D.flushSync)===!0,lt=xo({currentLocation:Ne,nextLocation:Ee,historyAction:Ae});if(lt){vi(lt,{state:"blocked",location:Ee,proceed(){vi(lt,{state:"proceeding",proceed:void 0,reset:void 0,location:Ee}),_e(A,D)},reset(){let mt=new Map(k.blockers);mt.set(lt,yl),be({blockers:mt})}});return}await Be(Ae,Ee,{submission:de,pendingError:Te,preventScrollReset:Pe,replace:D&&D.replace,enableViewTransition:D&&D.viewTransition,flushSync:ze,callSiteDefaultShouldRevalidate:D&&D.defaultShouldRevalidate})}function Me(){J||(J=V1()),Ar(),be({revalidation:"loading"});let A=J.promise;return k.navigation.state==="submitting"?A:k.navigation.state==="idle"?(Be(k.historyAction,k.location,{startUninterruptedRevalidation:!0}),A):(Be(z||k.historyAction,k.navigation.location,{overrideNavigation:k.navigation,enableViewTransition:fe===!0}),A)}async function Be(A,D,I){X&&X.abort(),X=null,z=A,Q=(I&&I.startUninterruptedRevalidation)===!0,Ud(k.location,k.matches),F=(I&&I.preventScrollReset)===!0,fe=(I&&I.enableViewTransition)===!0;let ue=f.activeRoutes,de=I?.initialHydration&&k.matches&&k.matches.length>0&&!se?k.matches:Nr(ue,D,m,!1,f.branches),Te=(I&&I.flushSync)===!0;if(de&&k.initialized&&!Y&&CM(k.location,D)&&!(I&&I.submission&&Tn(I.submission.formMethod))){pe(D,{matches:de},{flushSync:Te});return}let Se=Or(de,ue,D.pathname);if(Se.active&&Se.matches&&(de=Se.matches),!de){let{error:ct,notFoundMatches:tt,route:Wt}=_a(D.pathname);pe(D,{matches:tt,loaderData:{},errors:{[Wt.id]:ct}},{flushSync:Te});return}let Ne=I&&I.overrideNavigation?{...I.overrideNavigation,matches:de,historyAction:A}:void 0;X=new AbortController;let Ee=Gs(e.history,D,X.signal,I&&I.submission),De=e.getContext?await e.getContext():new _1,Ae;if(I&&I.pendingError)Ae=[di(de).route.id,{type:"error",error:I.pendingError}];else if(I&&I.submission&&Tn(I.submission.formMethod)){let ct=await Ue(Ee,D,I.submission,de,A,De,Se.active,I&&I.initialHydration===!0,{replace:I.replace,flushSync:Te});if(ct.shortCircuited)return;if(ct.pendingActionResult){let[tt,Wt]=ct.pendingActionResult;if(Jn(Wt)&&Zl(Wt.error)&&Wt.error.status===404){X=null,pe(D,{matches:ct.matches,loaderData:{},errors:{[tt]:Wt.error}});return}}de=ct.matches||de,Ae=ct.pendingActionResult,Ne=Pm(D,de,A,I.submission),Te=!1,Se.active=!1,Ee=Gs(e.history,Ee.url,Ee.signal)}let{shortCircuited:Pe,matches:ze,loaderData:lt,errors:mt,workingFetchers:Bt}=await dt(Ee,D,de,A,De,Se.active,Ne,I&&I.submission,I&&I.fetcherSubmission,I&&I.replace,I&&I.initialHydration===!0,Te,Ae,I&&I.callSiteDefaultShouldRevalidate);Pe||(X=null,pe(D,{matches:ze||de,...Z1(Ae),loaderData:lt,errors:mt,...Bt?{fetchers:Bt}:{}}))}async function Ue(A,D,I,ue,de,Te,Se,Ne,Ee={}){Ar();let De=BM(D,ue,de,I);if(be({navigation:De},{flushSync:Ee.flushSync===!0}),Se){let ze=await Jt(ue,D.pathname,A.signal);if(ze.type==="aborted")return{shortCircuited:!0};if(ze.type==="error"){if(ze.partialMatches.length===0){let{matches:mt,route:Bt}=Uu(f.activeRoutes);return{matches:mt,pendingActionResult:[Bt.id,{type:"error",error:ze.error}]}}let lt=di(ze.partialMatches).route.id;return{matches:ze.partialMatches,pendingActionResult:[lt,{type:"error",error:ze.error}]}}else if(ze.matches)ue=ze.matches;else{let{notFoundMatches:lt,error:mt,route:Bt}=_a(D.pathname);return{matches:lt,pendingActionResult:[Bt.id,{type:"error",error:mt}]}}}let Ae,Pe=Wu(ue,D);if(!Pe.route.action&&!Pe.route.lazy)Ae={type:"error",error:hr(405,{method:A.method,pathname:D.pathname,routeId:Pe.route.id})};else{let ze=eo(c,d,A,D,ue,Pe,Ne?[]:s,Te),lt=await ln(A,D,ze,Te,null);if(Ae=lt[Pe.route.id],!Ae){for(let mt of ue)if(lt[mt.route.id]){Ae=lt[mt.route.id];break}}if(A.signal.aborted)return{shortCircuited:!0}}if(Yi(Ae)){let ze;return Ee&&Ee.replace!=null?ze=Ee.replace:ze=H1(Ae.response.headers.get("Location"),new URL(A.url),m,e.history)===k.location.pathname+k.location.search,await wt(A,Ae,!0,{submission:I,replace:ze}),{shortCircuited:!0}}if(Jn(Ae)))DELIM" +R"DELIM({let ze=di(ue,Pe.route.id);return(Ee&&Ee.replace)!==!0&&(z="PUSH"),{matches:ue,pendingActionResult:[ze.route.id,Ae,Pe.route.id]}}return{matches:ue,pendingActionResult:[Pe.route.id,Ae]}}async function dt(A,D,I,ue,de,Te,Se,Ne,Ee,De,Ae,Pe,ze,lt){let mt=Se||Pm(D,I,ue,Ne),Bt=Ne||Ee||F1(mt),ct=!Q&&!Ae;if(Te){if(ct){let Kt=qt(ze);be({navigation:mt,...Kt!==void 0?{actionData:Kt}:{}},{flushSync:Pe})}let Ge=await Jt(I,D.pathname,A.signal);if(Ge.type==="aborted")return{shortCircuited:!0};if(Ge.type==="error"){if(Ge.partialMatches.length===0){let{matches:tn,route:wn}=Uu(f.activeRoutes);return{matches:tn,loaderData:{},errors:{[wn.id]:Ge.error}}}let Kt=di(Ge.partialMatches).route.id;return{matches:Ge.partialMatches,loaderData:{},errors:{[Kt]:Ge.error}}}else if(Ge.matches)I=Ge.matches;else{let{error:Kt,notFoundMatches:tn,route:wn}=_a(D.pathname);return{matches:tn,loaderData:{},errors:{[wn.id]:Kt}}}}let tt=f.activeRoutes,{dsMatches:Wt,revalidatingFetchers:cn}=z1(A,de,c,d,e.history,k,I,Bt,D,Ae?[]:s,Ae===!0,Y,ie,he,j,Ce,tt,m,e.patchRoutesOnNavigation!=null,f.branches,ze,lt);if(He=++ye,!e.dataStrategy&&!Wt.some(Ge=>Ge.shouldLoad)&&!Wt.some(Ge=>Ge.route.middleware&&Ge.route.middleware.length>0)&&cn.length===0){let Ge=new Map(k.fetchers),Kt=nc(Ge);return pe(D,{matches:I,loaderData:{},errors:ze&&Jn(ze[1])?{[ze[0]]:ze[1].error}:null,...Z1(ze),...Kt?{fetchers:Ge}:{}},{flushSync:Pe}),{shortCircuited:!0}}if(ct){let Ge={};if(!Te){Ge.navigation=mt;let Kt=qt(ze);Kt!==void 0&&(Ge.actionData=Kt)}cn.length>0&&(Ge.fetchers=Ye(cn)),be(Ge,{flushSync:Pe})}cn.forEach(Ge=>{Zn(Ge.key),Ge.controller&&$.set(Ge.key,Ge.controller)});let Na=()=>cn.forEach(Ge=>Zn(Ge.key));X&&X.signal.addEventListener("abort",Na);let{loaderResults:en,fetcherResults:kt}=await xn(Wt,cn,A,D,de);if(A.signal.aborted)return{shortCircuited:!0};X&&X.signal.removeEventListener("abort",Na),cn.forEach(Ge=>$.delete(Ge.key));let Rt=Hu(en);if(Rt)return await wt(A,Rt.result,!0,{replace:De}),{shortCircuited:!0};if(Rt=Hu(kt),Rt)return Ce.add(Rt.key),await wt(A,Rt.result,!0,{replace:De}),{shortCircuited:!0};let un=new Map(k.fetchers),{loaderData:ns,errors:Mr}=$1(k,I,en,ze,cn,kt,un);Ae&&k.errors&&(Mr={...k.errors,...Mr});let rs=nc(un),bi=rc(He,un),zr=rs||bi||cn.length>0;return{matches:I,loaderData:ns,errors:Mr,...zr?{workingFetchers:un}:{}}}function qt(A){if(A&&!Jn(A[1]))return{[A[0]]:A[1].data};if(k.actionData)return Object.keys(k.actionData).length===0?null:k.actionData}function Ye(A){let D=new Map(k.fetchers);return A.forEach(I=>{let ue=D.get(I.key),de=vl(void 0,ue?ue.data:void 0);D.set(I.key,de)}),D}async function st(A,D,I,ue){Zn(A);let de=(ue&&ue.flushSync)===!0,Te=f.activeRoutes,Se=kp(k.location,k.matches,m,I,D,ue?.relative),Ne=Nr(Te,Se,m,!1,f.branches),Ee=Or(Ne,Te,Se);if(Ee.active&&Ee.matches&&(Ne=Ee.matches),!Ne){kn(A,D,hr(404,{pathname:Se}),{flushSync:de});return}let{path:De,submission:Ae,error:Pe}=M1(!0,Se,ue);if(Pe){kn(A,D,Pe,{flushSync:de});return}let ze=e.getContext?await e.getContext():new _1,lt=(ue&&ue.preventScrollReset)===!0;if(Ae&&Tn(Ae.formMethod)){await ot(A,D,De,Ne,ze,Ee.active,de,lt,Ae,ue&&ue.defaultShouldRevalidate);return}j.set(A,{routeId:D,path:De}),await at(A,D,De,Ne,ze,Ee.active,de,lt,Ae)}async function ot(A,D,I,ue,de,Te,Se,Ne,Ee,De){Ar(),j.delete(A);let Ae=k.fetchers.get(A);Dt(A,LM(Ee,Ae),{flushSync:Se});let Pe=new AbortController,ze=Gs(e.history,I,Pe.signal,Ee);if(Te){let Ze=await Jt(ue,new URL(ze.url).pathname,ze.signal,A);if(Ze.type==="aborted")return;if(Ze.type==="error"){kn(A,D,Ze.error,{flushSync:Se});return}else if(Ze.matches)ue=Ze.matches;else{kn(A,D,hr(404,{pathname:I}),{flushSync:Se});return}}let lt=Wu(ue,I);if(!lt.route.action&&!lt.route.lazy){let Ze=hr(405,{method:Ee.formMethod,pathname:I,routeId:D});kn(A,D,Ze,{flushSync:Se});return}$.set(A,Pe);let mt=ye,Bt=eo(c,d,ze,I,ue,lt,s,de),ct=await ln(ze,I,Bt,de,A),tt=ct[lt.route.id];if(!tt){for(let Ze of Bt)if(ct[Ze.route.id]){tt=ct[Ze.route.id];break}}if(ze.signal.aborted){$.get(A)===Pe&&$.delete(A);return}if(he.has(A)){if(Yi(tt)||Jn(tt)){Dt(A,Qr(void 0));return}}else{if(Yi(tt))if($.delete(A),He>mt){Dt(A,Qr(void 0));return}else return Ce.add(A),Dt(A,vl(Ee)),wt(ze,tt,!1,{fetcherSubmission:Ee,preventScrollReset:Ne});if(Jn(tt)){kn(A,D,tt.error);return}}let Wt=k.navigation.location||k.location,cn=Gs(e.history,Wt,Pe.signal),Na=f.activeRoutes,en=k.navigation.state!=="idle"?Nr(Na,k.navigation.location,m,!1,f.branches):k.matches;qe(en,"Didn't find any matches after fetcher action");let kt=++ye;xe.set(A,kt);let{dsMatches:Rt,revalidatingFetchers:un}=z1(cn,de,c,d,e.history,k,en,Ee,Wt,s,!1,Y,ie,he,j,Ce,Na,m,e.patchRoutesOnNavigation!=null,f.branches,[lt.route.id,tt],De),ns=vl(Ee,tt.data),Mr=new Map(k.fetchers);Mr.set(A,ns),un.filter(Ze=>Ze.key!==A).forEach(Ze=>{let Br=Ze.key,So=Mr.get(Br),sc=vl(void 0,So?So.data:void 0);Mr.set(Br,sc),Zn(Br),Ze.controller&&$.set(Br,Ze.controller)}),be({fetchers:Mr});let rs=()=>un.forEach(Ze=>Zn(Ze.key));Pe.signal.addEventListener("abort",rs);let{loaderResults:bi,fetcherResults:zr}=await xn(Rt,un,cn,Wt,de);if(Pe.signal.aborted)return;Pe.signal.removeEventListener("abort",rs),xe.delete(A),$.delete(A),un.forEach(Ze=>$.delete(Ze.key));let Ge=k.fetchers.has(A),Kt=Ze=>{if(!Ge)return Ze;let Br=new Map(Ze.fetchers);return Br.set(A,Qr(tt.data)),{...Ze,fetchers:Br}},tn=Hu(bi);if(tn)return k=Kt(k),wt(cn,tn.result,!1,{preventScrollReset:Ne});if(tn=Hu(zr),tn)return Ce.add(tn.key),k=Kt(k),wt(cn,tn.result,!1,{preventScrollReset:Ne});let wn=new Map(k.fetchers);Ge&&wn.set(A,Qr(tt.data));let{loaderData:Ca,errors:Dr}=$1(k,en,bi,void 0,un,zr,wn);rc(kt,wn),k.navigation.state==="loading"&&kt>He?(qe(z,"Expected pending action"),X&&X.abort(),pe(k.navigation.location,{matches:en,loaderData:Ca,errors:Dr,fetchers:wn})):(be({errors:Dr,loaderData:q1(k.loaderData,Ca,en,Dr),fetchers:wn}),Y=!1)}async function at(A,D,I,ue,de,Te,Se,Ne,Ee){let De=k.fetchers.get(A);Dt(A,vl(Ee,De?De.data:void 0),{flushSync:Se});let Ae=new AbortController,Pe=Gs(e.history,I,Ae.signal);if(Te){let tt=await Jt(ue,new URL(Pe.url).pathname,Pe.signal,A);if(tt.type==="aborted")return;if(tt.type==="error"){kn(A,D,tt.error,{flushSync:Se});return}else if(tt.matches)ue=tt.matches;else{kn(A,D,hr(404,{pathname:I}),{flushSync:Se});return}}let ze=Wu(ue,I);$.set(A,Ae);let lt=ye,mt=eo(c,d,Pe,I,ue,ze,s,de),Bt=await ln(Pe,I,mt,de,A),ct=Bt[ze.route.id];if(!ct){for(let tt of ue)if(Bt[tt.route.id]){ct=Bt[tt.route.id];break}}if($.get(A)===Ae&&$.delete(A),!Pe.signal.aborted){if(he.has(A)){Dt(A,Qr(void 0));return}if(Yi(ct))if(He>lt){Dt(A,Qr(void 0));return}else{Ce.add(A),await wt(Pe,ct,!1,{preventScrollReset:Ne});return}if(Jn(ct)){kn(A,D,ct.error);return}Dt(A,Qr(ct.data))}}async function wt(A,D,I,{submission:ue,fetcherSubmission:de,preventScrollReset:Te,replace:Se}={}){I||(P?.resolve(),P=null),D.response.headers.has("X-Remix-Revalidate")&&(Y=!0);let Ne=D.response.headers.get("Location");qe(Ne,"Expected a Location header on the redirect Response");let Ee=Ne,De=new URL(A.url);Ne=H1(Ne,De,m,e.history),Ws(Ee,Ne,De,"allow-explicit");let Ae=$l(k.location,Ne,{_isRedirect:!0});if(i){let ct=!1;if(D.response.headers.has("X-Remix-Reload-Document"))ct=!0;else if(gg(Ne)){const tt=mE(r,Ne,!0);ct=tt.origin!==r.location.origin||tr(tt.pathname,m)==null}if(ct){Se?r.location.replace(Ne):r.location.assign(Ne);return}}X=null;let Pe=Se===!0||D.response.headers.has("X-Remix-Replace")?"REPLACE":"PUSH",{formMethod:ze,formAction:lt,formEncType:mt}=k.navigation;!ue&&!de&&ze&<&&mt&&(ue=F1(k.navigation));let Bt=ue||de;if(uM.has(D.response.status)&&Bt&&Tn(Bt.formMethod))await Be(Pe,Ae,{submission:{...Bt,formAction:Ne},preventScrollReset:Te||F,enableViewTransition:I?fe:void 0});else{let ct=Pm(Ae,[],Pe,ue);await Be(Pe,Ae,{overrideNavigation:ct,fetcherSubmission:de,preventScrollReset:Te||F,enableViewTransition:I?fe:void 0})}}async function ln(A,D,I,ue,de){let Te,Se={};try{Te=await wM(g,A,D,I,de,ue,!1)}catch(Ne){return I.filter(Ee=>Ee.shouldLoad).forEach(Ee=>{Se[Ee.route.id]={type:"error",error:Ne}}),Se}if(A.signal.aborted)return Se;if()DELIM" +R"DELIM(!Tn(A.method))for(let Ne of I){if(Te[Ne.route.id]?.type==="error")break;!Te.hasOwnProperty(Ne.route.id)&&!k.loaderData.hasOwnProperty(Ne.route.id)&&(!k.errors||!k.errors.hasOwnProperty(Ne.route.id))&&Ne.shouldCallHandler()&&(Te[Ne.route.id]={type:"error",result:new Error(`No result returned from dataStrategy for route ${Ne.route.id}`)})}for(let[Ne,Ee]of Object.entries(Te))if(OM(Ee)){let De=Ee.result;Se[Ne]={type:"redirect",response:kM(De,A,Ne,I,m)}}else Se[Ne]=await TM(Ee);return Se}async function xn(A,D,I,ue,de){let Te=ln(I,ue,A,de,null),Se=Promise.all(D.map(async De=>{if(De.matches&&De.match&&De.request&&De.controller){let Pe=(await ln(De.request,De.path,De.matches,de,De.key))[De.match.route.id];return{[De.key]:Pe}}else return Promise.resolve({[De.key]:{type:"error",error:hr(404,{pathname:De.path})}})})),Ne=await Te,Ee=(await Se).reduce((De,Ae)=>Object.assign(De,Ae),{});return{loaderResults:Ne,fetcherResults:Ee}}function Ar(){Y=!0,j.forEach((A,D)=>{$.has(D)&&ie.add(D),Zn(D)})}function Dt(A,D,I={}){let ue=new Map(k.fetchers);ue.set(A,D),be({fetchers:ue},{flushSync:(I&&I.flushSync)===!0})}function kn(A,D,I,ue={}){let de=di(k.matches,D),Te=new Map(k.fetchers);es(Te,A),be({errors:{[de.route.id]:I},fetchers:Te},{flushSync:(ue&&ue.flushSync)===!0})}function vo(A){return G.set(A,(G.get(A)||0)+1),he.has(A)&&he.delete(A),k.fetchers.get(A)||dM}function Bd(A,D){Zn(A,D?.reason),Dt(A,Qr(null))}function es(A,D){let I=k.fetchers.get(D);$.has(D)&&!(I&&I.state==="loading"&&xe.has(D))&&Zn(D),j.delete(D),xe.delete(D),Ce.delete(D),he.delete(D),ie.delete(D),A.delete(D)}function bo(A){let D=(G.get(A)||0)-1;D<=0?(G.delete(A),he.add(A)):G.set(A,D),be({fetchers:new Map(k.fetchers)})}function Zn(A,D){let I=$.get(A);I&&(I.abort(D),$.delete(A))}function ts(A,D){for(let I of A){let ue=D.get(I);qe(ue,`Expected fetcher: ${I}`);let de=Qr(ue.data);D.set(I,de)}}function nc(A){let D=[],I=!1;for(let ue of Ce){let de=A.get(ue);qe(de,`Expected fetcher: ${ue}`),de.state==="loading"&&(Ce.delete(ue),D.push(ue),I=!0)}return ts(D,A),I}function rc(A,D){let I=[];for(let[ue,de]of xe)if(de0}function _n(A,D){let I=k.blockers.get(A)||yl;return ee.get(A)!==D&&ee.set(A,D),I}function ac(A){k.blockers.delete(A),ee.delete(A)}function vi(A,D){let I=k.blockers.get(A)||yl;qe(I.state==="unblocked"&&D.state==="blocked"||I.state==="blocked"&&D.state==="blocked"||I.state==="blocked"&&D.state==="proceeding"||I.state==="blocked"&&D.state==="unblocked"||I.state==="proceeding"&&D.state==="unblocked",`Invalid blocker state transition: ${I.state} -> ${D.state}`);let ue=new Map(k.blockers);ue.set(A,D),be({blockers:ue})}function xo({currentLocation:A,nextLocation:D,historyAction:I}){if(ee.size===0)return;ee.size>1&&Ct(!1,"A router only supports one blocker at a time");let ue=Array.from(ee.entries()),[de,Te]=ue[ue.length-1],Se=k.blockers.get(de);if(!(Se&&Se.state==="proceeding")&&Te({currentLocation:A,nextLocation:D,historyAction:I}))return de}function _a(A){let D=hr(404,{pathname:A}),I=f.activeRoutes,{matches:ue,route:de}=Uu(I);return{notFoundMatches:ue,route:de,error:D}}function Ld(A,D,I){if(E=A,N=D,_=I||null,!H&&k.navigation===Hm){H=!0;let ue=ic(k.location,k.matches);ue!=null&&be({restoreScrollPosition:ue})}return()=>{E=null,N=null,_=null}}function wo(A,D){return _&&_(A,D.map(ue=>gE(ue,k.loaderData)))||A.key}function Ud(A,D){if(E&&N){let I=wo(A,D);E[I]=N()}}function ic(A,D){if(E){let I=wo(A,D),ue=E[I];if(typeof ue=="number")return ue}return null}function Or(A,D,I){if(e.patchRoutesOnNavigation){let ue=f.branches;if(A){if(Object.keys(A[0].params).length>0)return{active:!0,matches:Nr(D,I,m,!0,ue)}}else return{active:!0,matches:Nr(D,I,m,!0,ue)||[]}}return{active:!1,matches:null}}async function Jt(A,D,I,ue){if(!e.patchRoutesOnNavigation)return{type:"success",matches:A};let de=A;for(;;){let Te=d;try{await e.patchRoutesOnNavigation({signal:I,path:D,matches:de,fetcherKey:ue,patch:(De,Ae)=>{I.aborted||D1(De,Ae,f,Te,c,!1)}})}catch(De){return{type:"error",error:De,partialMatches:de}}if(I.aborted)return{type:"aborted"};let Se=f.branches,Ne=Nr(f.activeRoutes,D,m,!1,Se),Ee=null;if(Ne){if(Object.keys(Ne[0].params).length===0)return{type:"success",matches:Ne};if(Ee=Nr(f.activeRoutes,D,m,!0,Se),!(Ee&&de.lengthI.route.id===D[ue].route.id)}function Nn(A){d={},f.setHmrRoutes(ql(A,c,void 0,d))}function Hd(A,D,I=!1){D1(A,D,f,d,c,I),f.hasHMRRoutes||be({})}return R={get basename(){return m},get future(){return v},get state(){return k},get routes(){return f.stableRoutes},get branches(){return f.branches},get manifest(){return d},get window(){return r},initialize:me,subscribe:le,enableScrollRestoration:Ld,navigate:_e,fetch:st,revalidate:Me,createHref:A=>e.history.createHref(A),createURL:A=>e.history.createURL(A),encodeLocation:A=>e.history.encodeLocation(A),getFetcher:vo,resetFetcher:Bd,deleteFetcher:bo,dispose:W,getBlocker:_n,deleteBlocker:ac,patchRoutes:Hd,_internalFetchControllers:$,_internalSetRoutes:Nn,_internalSetStateDoNotUseOrYouWillBreakYourApp(A){be(A)}},e.instrumentations&&(R=tM(R,e.instrumentations.map(A=>A.router).filter(Boolean))),R}function pM(e){return e!=null&&("formData"in e&&e.formData!=null||"body"in e&&e.body!==void 0)}function kp(e,r,i,s,l,c){let d,f;if(l){d=[];for(let g of r)if(d.push(g),g.route.id===l){f=g;break}}else d=r,f=r[r.length-1];let m=Kl(s||".",Ad(d),tr(e.pathname,i)||e.pathname,c==="path");if(s==null&&(m.search=e.search,m.hash=e.hash),(s==null||s===""||s===".")&&f){let g=wg(m.search);if(f.route.index&&!g)m.search=m.search?m.search.replace(/^\?/,"?index&"):"?index";else if(!f.route.index&&g){let v=new URLSearchParams(m.search),y=v.getAll("index");v.delete("index"),y.filter(w=>w).forEach(w=>v.append("index",w));let x=v.toString();m.search=x?`?${x}`:""}}return i!=="/"&&(m.pathname=GO({basename:i,pathname:m.pathname})),Mn(m)}function M1(e,r,i){if(!i||!pM(i))return{path:r};if(i.formMethod&&!DM(i.formMethod))return{path:r,error:hr(405,{method:i.formMethod})};let s=()=>({path:r,error:hr(400,{type:"invalid-body"})}),c=(i.formMethod||"get").toUpperCase(),d=BE(r);if(i.body!==void 0){if(i.formEncType==="text/plain"){if(!Tn(c))return s();let y=typeof i.body=="string"?i.body:i.body instanceof FormData||i.body instanceof URLSearchParams?Array.from(i.body.entries()).reduce((x,[w,E])=>`${x}${w}=${E} +`,""):String(i.body);return{path:r,submission:{formMethod:c,formAction:d,formEncType:i.formEncType,formData:void 0,json:void 0,text:y}}}else if(i.formEncType==="application/json"){if(!Tn(c))return s();try{let y=typeof i.body=="string"?JSON.parse(i.body):i.body;return{path:r,submission:{formMethod:c,formAction:d,formEncType:i.formEncType,formData:void 0,json:y,text:void 0}}}catch{return s()}}}qe(typeof FormData=="function","FormData is not available in this environment");let f,m;if(i.formData)f=Cp(i.formData),m=i.formData;else if(i.body instanceof FormData)f=Cp(i.body),m=i.body;else if(i.body instanceof URLSearchParams)f=i.body,m=P1(f);else if(i.body==null)f=new URLSearchParams,m=new FormData;else try{f=new URLSearchParams(i.body),m=P1(f)}catch{return s()}let g={formMethod:c,formAction:d,formEncType:i&&i.formEncType||"application/x-www-form-urlencoded",formData:m,json:void 0,text:void 0};if(Tn(g.formMethod))return{path:r,submission:g};let v=ra(r);return e&&v.search&&wg(v.search)&&f.append("index",""),v.search=`?${f}`,{path:Mn(v),submission:g}}function z1(e,r,i,s,l,c,d,f,m,g,v,y,x,w,E,_,N,H,O,se,ce,K){let oe=ce?Jn(ce[1])?ce[1].error:ce[1].data:void 0,R=l.createURL(c.location),k=l.createURL(m),z;if(v&&c.errors){let Q=Object.keys(c.errors)[0];z=d.findIndex(Y=>Y.route.id===Q)}else if(ce&&Jn(ce[1])){let Q=ce[0];z=d.findIndex(Y=>Y.route.id===Q)-1}let P=ce?ce[1].statusC)DELIM" +R"DELIM(ode:void 0,F=P&&P>=400,X={currentUrl:R,currentParams:c.matches[0]?.params||{},nextUrl:k,nextParams:d[0].params,...f,actionResult:oe,actionStatus:P},fe=Xl(d),ge=d.map((Q,Y)=>{let{route:ie}=Q,$=null;if(z!=null&&Y>z)$=!1;else if(ie.lazy)$=!0;else if(!bg(ie))$=!1;else if(v){let{shouldLoad:Ce}=jE(ie,c.loaderData,c.errors);$=Ce}else gM(c.loaderData,c.matches[Y],Q)&&($=!0);if($!==null)return _p(i,s,e,m,fe,Q,g,r,$);let ye=!1;typeof K=="boolean"?ye=K:F?ye=!1:(y||R.pathname+R.search===k.pathname+k.search||R.search!==k.search||yM(c.matches[Y],Q))&&(ye=!0);let He={...X,defaultShouldRevalidate:ye},xe=zl(Q,He);return _p(i,s,e,m,fe,Q,g,r,xe,He,K)}),re=[];return E.forEach((Q,Y)=>{if(v||!d.some(G=>G.route.id===Q.routeId)||w.has(Y))return;let ie=c.fetchers.get(Y),$=ie&&ie.state!=="idle"&&ie.data===void 0,ye=Nr(N,Q.path,H??"/",!1,se);if(!ye){if(O&&$)return;re.push({key:Y,routeId:Q.routeId,path:Q.path,matches:null,match:null,request:null,controller:null});return}if(_.has(Y))return;let He=Wu(ye,Q.path),xe=new AbortController,Ce=Gs(l,Q.path,xe.signal),j=null;if(x.has(Y))x.delete(Y),j=eo(i,s,Ce,Q.path,ye,He,g,r);else if($)y&&(j=eo(i,s,Ce,Q.path,ye,He,g,r));else{let G;typeof K=="boolean"?G=K:F?G=!1:G=y;let he={...X,defaultShouldRevalidate:G};zl(He,he)&&(j=eo(i,s,Ce,Q.path,ye,He,g,r,he))}j&&re.push({key:Y,routeId:Q.routeId,path:Q.path,matches:j,match:He,request:Ce,controller:xe})}),{dsMatches:ge,revalidatingFetchers:re}}function bg(e){return e.loader!=null||e.middleware!=null&&e.middleware.length>0}function jE(e,r,i){if(e.lazy)return{shouldLoad:!0,renderFallback:!0};if(!bg(e))return{shouldLoad:!1,renderFallback:!1};let s=r!=null&&e.id in r,l=i!=null&&i[e.id]!==void 0;if(!s&&l)return{shouldLoad:!1,renderFallback:!1};if(typeof e.loader=="function"&&e.loader.hydrate===!0)return{shouldLoad:!0,renderFallback:!s};let c=!s&&!l;return{shouldLoad:c,renderFallback:c}}function gM(e,r,i){let s=!r||i.route.id!==r.route.id,l=!e.hasOwnProperty(i.route.id);return s||l}function yM(e,r){let i=e.route.path;return e.pathname!==r.pathname||i!=null&&i.endsWith("*")&&e.params["*"]!==r.params["*"]}function zl(e,r){if(e.route.shouldRevalidate){let i=e.route.shouldRevalidate(r);if(typeof i=="boolean")return i}return r.defaultShouldRevalidate}function D1(e,r,i,s,l,c){let d;if(e){let g=s[e];qe(g,`No route found to patch children into: routeId = ${e}`),g.children||(g.children=[]),d=g.children}else d=i.activeRoutes;let f=[],m=[];if(r.forEach(g=>{let v=d.find(y=>RE(g,y));v?m.push({existingRoute:v,newRoute:g}):f.push(g)}),f.length>0){let g=ql(f,l,[e||"_","patch",String(d?.length||"0")],s);d.push(...g)}if(c&&m.length>0)for(let g=0;gr.children?.some(l=>RE(i,l)))??!1:!1}var B1=new WeakMap,AE=({key:e,route:r,manifest:i,mapRouteProperties:s})=>{let l=i[r.id];if(qe(l,"No route found in manifest"),!l.lazy||typeof l.lazy!="object")return;let c=l.lazy[e];if(!c)return;let d=B1.get(l);d||(d={},B1.set(l,d));let f=d[e];if(f)return f;let m=(async()=>{let g=MO(e),y=l[e]!==void 0&&e!=="hasErrorBoundary";if(g)Ct(!g,"Route property "+e+" is not a supported lazy route property. This property will be ignored."),d[e]=Promise.resolve();else if(y)Ct(!1,`Route "${l.id}" has a static property "${e}" defined. The lazy property will be ignored.`);else{let x=await c();x!=null&&(Object.assign(l,{[e]:x}),Object.assign(l,s(l)))}typeof l.lazy=="object"&&(l.lazy[e]=void 0,Object.values(l.lazy).every(x=>x===void 0)&&(l.lazy=void 0))})();return d[e]=m,m},L1=new WeakMap;function vM(e,r,i,s,l){let c=i[e.id];if(qe(c,"No route found in manifest"),!e.lazy)return{lazyRoutePromise:void 0,lazyHandlerPromise:void 0};if(typeof e.lazy=="function"){let v=L1.get(c);if(v)return{lazyRoutePromise:v,lazyHandlerPromise:v};let y=(async()=>{qe(typeof e.lazy=="function","No lazy route function found");let x=await e.lazy(),w={};for(let E in x){let _=x[E];if(_===void 0)continue;let N=DO(E),O=c[E]!==void 0&&E!=="hasErrorBoundary";N?Ct(!N,"Route property "+E+" is not a supported property to be returned from a lazy route function. This property will be ignored."):O?Ct(!O,`Route "${c.id}" has a static property "${E}" defined but its lazy function is also returning a value for this property. The lazy route property "${E}" will be ignored.`):w[E]=_}Object.assign(c,w),Object.assign(c,{...s(c),lazy:void 0})})();return L1.set(c,y),y.catch(()=>{}),{lazyRoutePromise:y,lazyHandlerPromise:y}}let d=Object.keys(e.lazy),f=[],m;for(let v of d){if(l&&l.includes(v))continue;let y=AE({key:v,route:e,manifest:i,mapRouteProperties:s});y&&(f.push(y),v===r&&(m=y))}let g=f.length>0?Promise.all(f).then(()=>{}):void 0;return g?.catch(()=>{}),m?.catch(()=>{}),{lazyRoutePromise:g,lazyHandlerPromise:m}}async function U1(e){let r=e.matches.filter(l=>l.shouldLoad),i={};return(await Promise.all(r.map(l=>l.resolve()))).forEach((l,c)=>{i[r[c].route.id]=l}),i}async function bM(e){return e.matches.some(r=>r.route.middleware)?OE(e,()=>U1(e)):U1(e)}function OE(e,r){return xM(e,r,s=>{if(zM(s))throw s;return s},RM,i);function i(s,l,c){if(c)return Promise.resolve(Object.assign(c.value,{[l]:{type:"error",result:s}}));{let{matches:d}=e,f=Math.min(Math.max(d.findIndex(g=>g.route.id===l),0),Math.max(d.findIndex(g=>g.shouldCallHandler()),0)),m=di(d,d[f].route.id).route.id;return Promise.resolve({[m]:{type:"error",result:s}})}}}async function xM(e,r,i,s,l){let{matches:c,...d}=e,f=c.flatMap(g=>g.route.middleware?g.route.middleware.map(v=>[g.route.id,v]):[]);return await ME(d,f,r,i,s,l)}async function ME(e,r,i,s,l,c,d=0){let{request:f}=e;if(f.signal.aborted)throw f.signal.reason??new Error(`Request aborted: ${f.method} ${f.url}`);let m=r[d];if(!m)return await i();let[g,v]=m,y,x=async()=>{if(y)throw new Error("You may only call `next()` once per middleware");try{return y={value:await ME(e,r,i,s,l,c,d+1)},y.value}catch(w){return y={value:await c(w,g,y)},y.value}};try{let w=await v(e,x),E=w!=null?s(w):void 0;return l(E)?E:y?E??y.value:(y={value:await x()},y.value)}catch(w){return await c(w,g,y)}}function zE(e,r,i,s,l){let c=AE({key:"middleware",route:s.route,manifest:r,mapRouteProperties:e}),d=vM(s.route,Tn(i.method)?"action":"loader",r,e,l);return{middleware:c,route:d.lazyRoutePromise,handler:d.lazyHandlerPromise}}function _p(e,r,i,s,l,c,d,f,m,g=null,v){let y=!1,x=zE(e,r,i,c,d);return{...c,_lazyPromises:x,shouldLoad:m,shouldRevalidateArgs:g,shouldCallHandler(w){return y=!0,g?typeof v=="boolean"?zl(c,{...g,defaultShouldRevalidate:v}):typeof w=="boolean"?zl(c,{...g,defaultShouldRevalidate:w}):zl(c,g):m},resolve(w){let{lazy:E,loader:_,middleware:N}=c.route,H=y||m||w&&!Tn(i.method)&&(E||_),O=N&&N.length>0&&!_&&!E;return H&&(Tn(i.method)||!O)?SM({request:i,path:s,pattern:l,match:c,lazyHandlerPromise:x?.handler,lazyRoutePromise:x?.route,handlerOverride:w,scopedContext:f}):Promise.resolve({type:"data",result:void 0})}}}function eo(e,r,i,s,l,c,d,f,m=null){return l.map(g=>g.route.id!==c.route.id?{...g,shouldLoad:!1,shouldRevalidateArgs:m,shouldCallHandler:()=>!1,_lazyPromises:zE(e,r,i,g,d),resolve:()=>Promise.resolve({type:"data",result:void 0})}:_p(e,r,i,s,Xl(l),g,d,f,!0,m))}async function wM(e,r,i,s,l,c,d){s.some(v=>v._lazyPromises?.middleware)&&await Promise.all(s.map(v=>v._lazyPromises?.middleware));let f={request:r,url:DE(r,i),pattern:Xl(s),params:s[0].params,context:c,matches:s},g=await e({...f,fetcherKey:l,runClientMiddleware:v=>{let y=f;return OE(y,()=>v({...y,fetcherKey:l,runClientMiddleware:()=>{throw new Error("Cannot call `runClientMiddleware()` fro)DELIM" +R"DELIM(m within an `runClientMiddleware` handler")}}))}});try{await Promise.all(s.flatMap(v=>[v._lazyPromises?.handler,v._lazyPromises?.route]))}catch{}return g}async function SM({request:e,path:r,pattern:i,match:s,lazyHandlerPromise:l,lazyRoutePromise:c,handlerOverride:d,scopedContext:f}){let m,g,v=Tn(e.method),y=v?"action":"loader",x=w=>{let E,_=new Promise((O,se)=>E=se);g=()=>E(),e.signal.addEventListener("abort",g);let N=O=>typeof w!="function"?Promise.reject(new Error(`You cannot call the handler for a route which defines a boolean "${y}" [routeId: ${s.route.id}]`)):w({request:e,url:DE(e,r),pattern:i,params:s.params,context:f},...O!==void 0?[O]:[]),H=(async()=>{try{return{type:"data",result:await(d?d(se=>N(se)):N())}}catch(O){return{type:"error",result:O}}})();return Promise.race([H,_])};try{let w=v?s.route.action:s.route.loader;if(l||c)if(w){let E,[_]=await Promise.all([x(w).catch(N=>{E=N}),l,c]);if(E!==void 0)throw E;m=_}else{await l;let E=v?s.route.action:s.route.loader;if(E)[m]=await Promise.all([x(E),c]);else if(y==="action"){let _=new URL(e.url),N=_.pathname+_.search;throw hr(405,{method:e.method,pathname:N,routeId:s.route.id})}else return{type:"data",result:void 0}}else if(w)m=await x(w);else{let E=new URL(e.url),_=E.pathname+E.search;throw hr(404,{pathname:_})}}catch(w){return{type:"error",result:w}}finally{g&&e.signal.removeEventListener("abort",g)}return m}async function EM(e){let r=e.headers.get("Content-Type");return r&&/\bapplication\/json\b/.test(r)?e.body==null?null:e.json():e.text()}async function TM(e){let{result:r,type:i}=e;if(xg(r)){let s;try{s=await EM(r)}catch(l){return{type:"error",error:l}}return i==="error"?{type:"error",error:new Ql(r.status,r.statusText,s),statusCode:r.status,headers:r.headers}:{type:"data",data:s,statusCode:r.status,headers:r.headers}}return i==="error"?I1(r)?r.data instanceof Error?{type:"error",error:r.data,statusCode:r.init?.status,headers:r.init?.headers?new Headers(r.init.headers):void 0}:{type:"error",error:jM(r),statusCode:Zl(r)?r.status:void 0,headers:r.init?.headers?new Headers(r.init.headers):void 0}:{type:"error",error:r,statusCode:Zl(r)?r.status:void 0}:I1(r)?{type:"data",data:r.data,statusCode:r.init?.status,headers:r.init?.headers?new Headers(r.init.headers):void 0}:{type:"data",data:r}}function kM(e,r,i,s,l){let c=e.headers.get("Location");if(qe(c,"Redirects returned/thrown from loaders/actions must have a Location header"),!gg(c)){let d=s.slice(0,s.findIndex(f=>f.route.id===i)+1);c=kp(new URL(r.url),d,l,c),e.headers.set("Location",c)}return e}var _M=["about:","blob:","chrome:","chrome-untrusted:","content:","data:","devtools:","file:","filesystem:","javascript:"];function Np(e){try{return _M.includes(new URL(e).protocol)}catch{return!1}}function H1(e,r,i,s){if(gg(e)){let l=e,c=Rd.test(l)?new URL(fE(l,r.protocol)):new URL(l);if(Np(c.toString()))throw new Error("Invalid redirect location");let d=tr(c.pathname,i)!=null;if(c.origin===r.origin&&d)return yg(c.pathname)+c.search+c.hash}try{let l=s.createURL(e);if(Np(l.toString()))throw new Error("Invalid redirect location")}catch{}return e}function Gs(e,r,i,s){let l=e.createURL(BE(r)).toString(),c={signal:i};if(s&&Tn(s.formMethod)){let{formMethod:d,formEncType:f}=s;c.method=d.toUpperCase(),f==="application/json"?(c.headers=new Headers({"Content-Type":f}),c.body=JSON.stringify(s.json)):f==="text/plain"?c.body=s.text:f==="application/x-www-form-urlencoded"&&s.formData?c.body=Cp(s.formData):c.body=s.formData}return new Request(l,c)}function DE(e,r){let i=new URL(e.url),s=typeof r=="string"?ra(r):r;if(i.pathname=s.pathname||"/",s.search){let l=new URLSearchParams(s.search),c=l.getAll("index");l.delete("index");for(let d of c.filter(Boolean))l.append("index",d);i.search=l.size?`?${l.toString()}`:""}else i.search="";return i.hash=s.hash||"",i}function Cp(e){let r=new URLSearchParams;for(let[i,s]of e.entries())r.append(i,typeof s=="string"?s:s.name);return r}function P1(e){let r=new FormData;for(let[i,s]of e.entries())r.append(i,s);return r}function NM(e,r,i,s=!1,l=!1){let c={},d=null,f,m=!1,g={},v=i&&Jn(i[1])?i[1].error:void 0;return e.forEach(y=>{if(!(y.route.id in r))return;let x=y.route.id,w=r[x];if(qe(!Yi(w),"Cannot handle redirect results in processLoaderData"),Jn(w)){let E=w.error;if(v!==void 0&&(E=v,v=void 0),d=d||{},l)d[x]=E;else{let _=di(e,x);d[_.route.id]==null&&(d[_.route.id]=E)}s||(c[x]=CE),m||(m=!0,f=Zl(w.error)?w.error.status:500),w.headers&&(g[x]=w.headers)}else c[x]=w.data,w.statusCode&&w.statusCode!==200&&!m&&(f=w.statusCode),w.headers&&(g[x]=w.headers)}),v!==void 0&&i&&(d={[i[0]]:v},i[2]&&(c[i[2]]=void 0)),{loaderData:c,errors:d,statusCode:f||200,loaderHeaders:g}}function $1(e,r,i,s,l,c,d){let{loaderData:f,errors:m}=NM(r,i,s);return l.filter(g=>!g.matches||g.matches.some(v=>v.shouldLoad)).forEach(g=>{let{key:v,match:y,controller:x}=g;if(x&&x.signal.aborted)return;let w=c[v];if(qe(w,"Did not find corresponding fetcher result"),Jn(w)){let E=di(e.matches,y?.route.id);m&&m[E.route.id]||(m={...m,[E.route.id]:w.error}),d.delete(v)}else if(Yi(w))qe(!1,"Unhandled fetcher revalidation redirect");else{let E=Qr(w.data);d.set(v,E)}}),{loaderData:f,errors:m}}function q1(e,r,i,s){let l=Object.entries(r).filter(([,c])=>c!==CE).reduce((c,[d,f])=>(c[d]=f,c),{});for(let c of i){let d=c.route.id;if(!r.hasOwnProperty(d)&&e.hasOwnProperty(d)&&c.route.loader&&(l[d]=e[d]),s&&s.hasOwnProperty(d))break}return l}function Z1(e){return e?Jn(e[1])?{actionData:{}}:{actionData:{[e[0]]:e[1].data}}:{}}function di(e,r){return(r?e.slice(0,e.findIndex(s=>s.route.id===r)+1):[...e]).reverse().find(s=>s.route.hasErrorBoundary===!0)||e[0]}function Uu(e){let r=e.length===1?e[0]:e.find(i=>i.index||!i.path||i.path==="/")||{id:"__shim-error-route__"};return{matches:[{params:{},pathname:"",pathnameBase:"",route:r}],route:r}}function hr(e,{pathname:r,routeId:i,method:s,type:l,message:c}={}){let d="Unknown Server Error",f="Unknown @remix-run/router error";return e===400?(d="Bad Request",s&&r&&i?f=`You made a ${s} request to "${r}" but did not provide a \`loader\` for route "${i}", so there is no way to handle the request.`:l==="invalid-body"&&(f="Unable to encode submission body")):e===403?(d="Forbidden",f=`Route "${i}" does not match URL "${r}"`):e===404?(d="Not Found",f=`No route matches URL "${r}"`):e===405&&(d="Method Not Allowed",s&&r&&i?f=`You made a ${s.toUpperCase()} request to "${r}" but did not provide an \`action\` for route "${i}", so there is no way to handle the request.`:s&&(f=`Invalid request method "${s.toUpperCase()}"`)),new Ql(e||500,d,new Error(f),!0)}function Hu(e){let r=Object.entries(e);for(let i=r.length-1;i>=0;i--){let[s,l]=r[i];if(Yi(l))return{key:s,result:l}}}function BE(e){let r=typeof e=="string"?ra(e):e;return Mn({...r,hash:""})}function CM(e,r){return e.pathname!==r.pathname||e.search!==r.search?!1:e.hash===""?r.hash!=="":e.hash===r.hash?!0:r.hash!==""}function jM(e){return new Ql(e.init?.status??500,e.init?.statusText??"Internal Server Error",e.data)}function RM(e){return e!=null&&typeof e=="object"&&Object.entries(e).every(([r,i])=>typeof r=="string"&&AM(i))}function AM(e){return e!=null&&typeof e=="object"&&"type"in e&&"result"in e&&(e.type==="data"||e.type==="error")}function OM(e){return xg(e.result)&&_E.has(e.result.status)}function Jn(e){return e.type==="error"}function Yi(e){return(e&&e.type)==="redirect"}function I1(e){return typeof e=="object"&&e!=null&&"type"in e&&"data"in e&&"init"in e&&e.type==="DataWithResponseInit"}function xg(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.headers=="object"&&typeof e.body<"u"}function MM(e){return _E.has(e)}function zM(e){return xg(e)&&MM(e.status)&&e.headers.has("Location")}function DM(e){return cM.has(e.toUpperCase())}function Tn(e){return oM.has(e.toUpperCase())}function wg(e){return new URLSearchParams(e).getAll("index").some(r=>r==="")}function Wu(e,r){let i=typeof r=="string"?ra(r).search:r.search;if(e[e.length-1].route.index&&wg(i||""))return e[e.length-1];le)DELIM" +R"DELIM(t s=wE(e);return s[s.length-1]}function F1(e){let{formMethod:r,formAction:i,formEncType:s,text:l,formData:c,json:d}=e;if(!(!r||!i||!s)){if(l!=null)return{formMethod:r,formAction:i,formEncType:s,formData:void 0,json:void 0,text:l};if(c!=null)return{formMethod:r,formAction:i,formEncType:s,formData:c,json:void 0,text:void 0};if(d!==void 0)return{formMethod:r,formAction:i,formEncType:s,formData:void 0,json:d,text:void 0}}}function Pm(e,r,i,s){return s?{state:"loading",location:e,matches:r,historyAction:i,formMethod:s.formMethod,formAction:s.formAction,formEncType:s.formEncType,formData:s.formData,json:s.json,text:s.text}:{state:"loading",location:e,matches:r,historyAction:i,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0}}function BM(e,r,i,s){return{state:"submitting",location:e,matches:r,historyAction:i,formMethod:s.formMethod,formAction:s.formAction,formEncType:s.formEncType,formData:s.formData,json:s.json,text:s.text}}function vl(e,r){return e?{state:"loading",formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:r}:{state:"loading",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:r}}function LM(e,r){return{state:"submitting",formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:r?r.data:void 0}}function Qr(e){return{state:"idle",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:e}}function UM(e,r){try{let i=e.sessionStorage.getItem(NE);if(i){let s=JSON.parse(i);for(let[l,c]of Object.entries(s||{}))c&&Array.isArray(c)&&r.set(l,new Set(c||[]))}}catch{}}function HM(e,r){if(r.size>0){let i={};for(let[s,l]of r)i[s]=[...l];try{e.sessionStorage.setItem(NE,JSON.stringify(i))}catch(s){Ct(!1,`Failed to save applied view transitions in sessionStorage (${s}).`)}}}function V1(){let e,r,i=new Promise((s,l)=>{e=async c=>{s(c);try{await i}catch{}},r=async c=>{l(c);try{await i}catch{}}});return{promise:i,resolve:e,reject:r}}var Ji=T.createContext(null);Ji.displayName="DataRouter";var go=T.createContext(null);go.displayName="DataRouterState";var LE=T.createContext(!1);function UE(){return T.useContext(LE)}var Sg=T.createContext({isTransitioning:!1});Sg.displayName="ViewTransition";var HE=T.createContext(new Map);HE.displayName="Fetchers";var PM=T.createContext(null);PM.displayName="Await";var Dn=T.createContext(null);Dn.displayName="Navigation";var Jl=T.createContext(null);Jl.displayName="Location";var yr=T.createContext({outlet:null,matches:[],isDataRoute:!1});yr.displayName="Route";var Eg=T.createContext(null);Eg.displayName="RouteError";var PE="REACT_ROUTER_ERROR",$M="REDIRECT",qM="ROUTE_ERROR_RESPONSE";function ZM(e){if(e.startsWith(`${PE}:${$M}:{`))try{let r=JSON.parse(e.slice(28));if(typeof r=="object"&&r&&typeof r.status=="number"&&typeof r.statusText=="string"&&typeof r.location=="string"&&typeof r.reloadDocument=="boolean"&&typeof r.replace=="boolean")return r}catch{}}function IM(e){if(e.startsWith(`${PE}:${qM}:{`))try{let r=JSON.parse(e.slice(40));if(typeof r=="object"&&r&&typeof r.status=="number"&&typeof r.statusText=="string")return new Ql(r.status,r.statusText,r.data)}catch{}}function FM(e,{relative:r}={}){qe(yo(),"useHref() may be used only in the context of a component.");let{basename:i,navigator:s}=T.useContext(Dn),{hash:l,pathname:c,search:d}=Wl(e,{relative:r}),f=c;return i!=="/"&&(f=c==="/"?i:pr([i,c])),s.createHref({pathname:f,search:d,hash:l})}function yo(){return T.useContext(Jl)!=null}function Xt(){return qe(yo(),"useLocation() may be used only in the context of a component."),T.useContext(Jl).location}function VM(){return T.useContext(Jl).navigationType}var $E="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function qE(e){T.useContext(Dn).static||T.useLayoutEffect(e)}function vr(){let{isDataRoute:e}=T.useContext(yr);return e?sz():YM()}function YM(){qe(yo(),"useNavigate() may be used only in the context of a component.");let e=T.useContext(Ji),{basename:r,navigator:i}=T.useContext(Dn),{matches:s}=T.useContext(yr),{pathname:l}=Xt(),c=JSON.stringify(Ad(s)),d=T.useRef(!1);return qE(()=>{d.current=!0}),T.useCallback((m,g={})=>{if(Ct(d.current,$E),!d.current)return;if(typeof m=="number"){i.go(m);return}let v=Kl(m,JSON.parse(c),l,g.relative==="path");e==null&&r!=="/"&&(v.pathname=v.pathname==="/"?r:pr([r,v.pathname])),Ws(typeof m=="string"?m:Mn(m),i.createHref(v),vg(i),"reject"),(g.replace?i.replace:i.push)(v,g.state,g)},[r,i,c,l,e])}var GM=T.createContext(null);function KM(e){let r=T.useContext(yr).outlet;return T.useMemo(()=>r&&T.createElement(GM.Provider,{value:e},r),[r,e])}function Tg(){let{matches:e}=T.useContext(yr);return e[e.length-1]?.params??{}}function Wl(e,{relative:r}={}){let{matches:i}=T.useContext(yr),{pathname:s}=Xt(),l=JSON.stringify(Ad(i));return T.useMemo(()=>Kl(e,JSON.parse(l),s,r==="path"),[e,l,s,r])}function QM(e,r,i){qe(yo(),"useRoutes() may be used only in the context of a component.");let{navigator:s}=T.useContext(Dn),{matches:l}=T.useContext(yr),c=l[l.length-1],d=c?c.params:{},f=c?c.pathname:"/",m=c?c.pathnameBase:"/",g=c&&c.route;{let N=g&&g.path||"";VE(f,!g||N.endsWith("*")||N.endsWith("*?"),`You rendered descendant (or called \`useRoutes()\`) at "${f}" (under ) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render. -Please change the parent to .`)}let v=Xt(),y;y=v;let x=y.pathname||"/",w=x;if(m!=="/"){let N=m.replace(/^\//,"").split("/");w="/"+x.replace(/^\//,"").split("/").slice(N.length).join("/")}let E=i&&i.state.matches.length?i.state.matches.map(N=>Object.assign(N,{route:i.manifest[N.route.id]||N.route})):pE(e,{pathname:w});return Ct(g||E!=null,`No routes matched location "${y.pathname}${y.search}${y.hash}" `),Ct(E==null||E[E.length-1].route.element!==void 0||E[E.length-1].route.Component!==void 0||E[E.length-1].route.lazy!==void 0,`Matched leaf route at location "${y.pathname}${y.search}${y.hash}" does not have an element or Component. This means it will render an with a null value by default resulting in an "empty" page.`),nz(E&&E.map(N=>Object.assign({},N,{params:Object.assign({},d,N.params),pathname:pr([m,s.encodeLocation?s.encodeLocation(N.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:N.pathname]),pathnameBase:N.pathnameBase==="/"?m:pr([m,s.encodeLocation?s.encodeLocation(N.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:N.pathnameBase])})),l,i)}function JM(){let e=FE(),r=Zl(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),i=e instanceof Error?e.stack:null,s="rgba(200,200,200, 0.5)",l={padding:"0.5rem",backgroundColor:s},c={padding:"2px 4px",backgroundColor:s},d=null;return console.error("Error handled by React Router default ErrorBoundary:",e),d=T.createElement(T.Fragment,null,T.createElement("p",null,"💿 Hey developer 👋"),T.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",T.createElement("code",{style:c},"ErrorBoundary")," or"," ",T.createElement("code",{style:c},"errorElement")," prop on your route.")),T.createElement(T.Fragment,null,T.createElement("h2",null,"Unexpected Application Error!"),T.createElement("h3",{style:{fontStyle:"italic"}},r),i?T.createElement("pre",{style:l},i):null,d)}var WM=T.cre)DELIM" -R"DELIM(ateElement(JM,null),ZE=class extends T.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,r){return r.location!==e.location||r.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:r.error,location:r.location,revalidation:e.revalidation||r.revalidation}}componentDidCatch(e,r){this.props.onError?this.props.onError(e,r):console.error("React Router caught the following error during render",e)}render(){let e=this.state.error;if(this.context&&typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){const i=FM(e.digest);i&&(e=i)}let r=e!==void 0?T.createElement(yr.Provider,{value:this.props.routeContext},T.createElement(Tg.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?T.createElement(ez,{error:e},r):r}};ZE.contextType=LE;var $m=new WeakMap;function ez({children:e,error:r}){let{basename:i,navigator:s}=T.useContext(Dn);if(typeof r=="object"&&r&&"digest"in r&&typeof r.digest=="string"){let l=IM(r.digest);if(l){let c=$m.get(r);if(c)throw c;let d=EE(l.location,i),f=d.absoluteURL||d.to;if(Ws(l.location,f,bg(s),"allow-explicit"),Cp(f))throw new Error("Invalid redirect location");if(SE&&!$m.get(r))if(d.isExternal||l.reloadDocument)window.location.href=f;else{const m=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(d.to,{replace:l.replace}));throw $m.set(r,m),m}return T.createElement("meta",{httpEquiv:"refresh",content:`0;url=${f}`})}}return e}function tz({routeContext:e,match:r,children:i}){let s=T.useContext(Ji);return s&&s.static&&s.staticContext&&(r.route.errorElement||r.route.ErrorBoundary)&&(s.staticContext._deepestRenderedBoundaryId=r.route.id),T.createElement(yr.Provider,{value:e},i)}function nz(e,r=[],i){let s=i?.state;if(e==null){if(!s)return null;if(s.errors)e=s.matches;else if(r.length===0&&!s.initialized&&s.matches.length>0)e=s.matches;else return null}let l=e,c=s?.errors;if(c!=null){let v=l.findIndex(y=>y.route.id&&c?.[y.route.id]!==void 0);qe(v>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(c).join(",")}`),l=l.slice(0,Math.min(l.length,v+1))}let d=!1,f=-1;if(i&&s){d=s.renderFallback;for(let v=0;v=0?l=l.slice(0,f+1):l=[l[0]];break}}}}let m=i?.onError,g=s&&m?(v,y)=>{m(v,{location:s.location,params:s.matches?.[0]?.params??{},pattern:Xl(s.matches),errorInfo:y})}:void 0;return l.reduceRight((v,y,x)=>{let w,E=!1,_=null,N=null;s&&(w=c&&y.route.id?c[y.route.id]:void 0,_=y.route.errorElement||WM,d&&(f<0&&x===0?(VE("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),E=!0,N=null):f===x&&(E=!0,N=y.route.hydrateFallbackElement||null)));let H=r.concat(l.slice(0,x+1)),O=()=>{let se;return w?se=_:E?se=N:y.route.Component?se=T.createElement(y.route.Component,null):y.route.element?se=y.route.element:se=v,T.createElement(tz,{match:y,routeContext:{outlet:v,matches:H,isDataRoute:s!=null},children:se})};return s&&(y.route.ErrorBoundary||y.route.errorElement||x===0)?T.createElement(ZE,{location:s.location,revalidation:s.revalidation,component:_,error:w,children:O(),routeContext:{outlet:null,matches:H,isDataRoute:!0},onError:g}):O()},null)}function _g(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function rz(e){let r=T.useContext(Ji);return qe(r,_g(e)),r}function Ng(e){let r=T.useContext(go);return qe(r,_g(e)),r}function az(e){let r=T.useContext(yr);return qe(r,_g(e)),r}function Cg(e){let r=az(e),i=r.matches[r.matches.length-1];return qe(i.route.id,`${e} can only be used on routes that contain a unique "id"`),i.route.id}function iz(){return Cg("useRouteId")}function sz(){let e=Ng("useNavigation");return T.useMemo(()=>{let{matches:r,historyAction:i,...s}=e.navigation;return s},[e.navigation])}function IE(){let{matches:e,loaderData:r}=Ng("useMatches");return T.useMemo(()=>e.map(i=>gE(i,r)),[e,r])}function FE(){let e=T.useContext(Tg),r=Ng("useRouteError"),i=Cg("useRouteError");return e!==void 0?e:r.errors?.[i]}function oz(){let{router:e}=rz("useNavigate"),r=Cg("useNavigate"),i=T.useRef(!1);return qE(()=>{i.current=!0}),T.useCallback(async(l,c={})=>{Ct(i.current,$E),i.current&&(typeof l=="number"?await e.navigate(l):await e.navigate(l,{fromRouteId:r,...c}))},[e,r])}var G1={};function VE(e,r,i){!r&&!G1[e]&&(G1[e]=!0,Ct(!1,i))}var K1={};function Q1(e,r){!e&&!K1[r]&&(K1[r]=!0,console.warn(r))}var lz="useOptimistic",X1=t_[lz],cz=()=>{};function uz(e){return X1?X1(e):[e,cz]}function dz(e){let r={hasErrorBoundary:e.hasErrorBoundary||e.ErrorBoundary!=null||e.errorElement!=null};return e.Component&&(e.element&&Ct(!1,"You should not include both `Component` and `element` on your route - `Component` will be used."),Object.assign(r,{element:T.createElement(e.Component),Component:void 0})),e.HydrateFallback&&(e.hydrateFallbackElement&&Ct(!1,"You should not include both `HydrateFallback` and `hydrateFallbackElement` on your route - `HydrateFallback` will be used."),Object.assign(r,{hydrateFallbackElement:T.createElement(e.HydrateFallback),HydrateFallback:void 0})),e.ErrorBoundary&&(e.errorElement&&Ct(!1,"You should not include both `ErrorBoundary` and `errorElement` on your route - `ErrorBoundary` will be used."),Object.assign(r,{errorElement:T.createElement(e.ErrorBoundary),ErrorBoundary:void 0})),r}var fz=["HydrateFallback","hydrateFallbackElement"],hz=class{constructor(){this.status="pending",this.promise=new Promise((e,r)=>{this.resolve=i=>{this.status==="pending"&&(this.status="resolved",e(i))},this.reject=i=>{this.status==="pending"&&(this.status="rejected",r(i))}})}};function mz({router:e,flushSync:r,onError:i,useTransitions:s}){s=UE()||s;let[c,d]=T.useState(e.state),[f,m]=uz(c),[g,v]=T.useState(),[y,x]=T.useState({isTransitioning:!1}),[w,E]=T.useState(),[_,N]=T.useState(),[H,O]=T.useState(),se=T.useRef(new Map),ce=T.useCallback((k,{deletedFetchers:z,newErrors:P,flushSync:F,viewTransitionOpts:X})=>{P&&i&&Object.values(P).forEach(ge=>i(ge,{location:k.location,params:k.matches[0]?.params??{},pattern:Xl(k.matches)})),k.fetchers.forEach((ge,re)=>{ge.data!==void 0&&se.current.set(re,ge.data)}),z.forEach(ge=>se.current.delete(ge)),Q1(F===!1||r!=null,'You provided the `flushSync` option to a router update, but you are not using the `` from `react-router/dom` so `ReactDOM.flushSync()` is unavailable. Please update your app to `import { RouterProvider } from "react-router/dom"` and ensure you have `react-dom` installed as a dependency to use the `flushSync` option.');let fe=e.window!=null&&e.window.document!=null&&typeof e.window.document.startViewTransition=="function";if(Q1(X==null||fe,"You provided the `viewTransition` option to a router update, but you do not appear to be running in a DOM environment as `window.startViewTransition` is not available."),!X||!fe){r&&F?r(()=>d(k)):s===!1?d(k):T.startTransition(()=>{s===!0&&m(ge=>J1(ge,k)),d(k)});return}if(r&&F){r(()=>{_&&(w?.resolve(),_.skipTransition()),x({isTransitioning:!0,flushSync:!0,currentLocation:X.currentLocation,nextLocation:X.nextLocation})});let ge=e.window.document.startViewTransition(()=>{r(()=>d(k))});ge.finished.finally(()=>{r(()=>{E(void 0),N(void 0),v(void 0),x({isTransitioning:!1})})}),r(()=>N(ge));return}_?(w?.resolve(),_.skipTransition(),O({state:k,currentLocation:X.currentLocation,nextLocation:X.nextLocation})):(v(k),x({isTransitioning:!0,flushSync:!1,currentLocation:X.currentLocation,nextLocation:X.nextLocation}))},[e.window,r,_,w,s,m,i]);T.useLayoutEffect(()=>e.subscribe(ce),[e,ce]),T.useEffect(()=>{y.isTransitioning&)DELIM" -R"DELIM(&!y.flushSync&&E(new hz)},[y]),T.useEffect(()=>{if(w&&g&&e.window){let k=g,z=w.promise,P=e.window.document.startViewTransition(async()=>{s===!1?d(k):T.startTransition(()=>{s===!0&&m(F=>J1(F,k)),d(k)}),await z});P.finished.finally(()=>{E(void 0),N(void 0),v(void 0),x({isTransitioning:!1})}),N(P)}},[g,w,e.window,s,m]),T.useEffect(()=>{w&&g&&f.location.key===g.location.key&&w.resolve()},[w,_,f.location,g]),T.useEffect(()=>{!y.isTransitioning&&H&&(v(H.state),x({isTransitioning:!0,flushSync:!1,currentLocation:H.currentLocation,nextLocation:H.nextLocation}),O(void 0))},[y.isTransitioning,H]);let K=T.useMemo(()=>({createHref:e.createHref,createURL:e.createURL,encodeLocation:e.encodeLocation,go:k=>e.navigate(k),push:(k,z,P)=>e.navigate(k,{state:z,preventScrollReset:P?.preventScrollReset}),replace:(k,z,P)=>e.navigate(k,{replace:!0,state:z,preventScrollReset:P?.preventScrollReset})}),[e]),oe=e.basename||"/",R=T.useMemo(()=>({router:e,navigator:K,static:!1,basename:oe,onError:i}),[e,K,oe,i]);return T.createElement(T.Fragment,null,T.createElement(Ji.Provider,{value:R},T.createElement(go.Provider,{value:f},T.createElement(HE.Provider,{value:se.current},T.createElement(Eg.Provider,{value:y},T.createElement(bz,{basename:oe,location:f.location,navigationType:f.historyAction,navigator:K,useTransitions:s},T.createElement(pz,{routes:e.routes,manifest:e.manifest,future:e.future,state:f,isStatic:!1,onError:i})))))),null)}function J1(e,r){return{...e,navigation:r.navigation.state!=="idle"?r.navigation:e.navigation,revalidation:r.revalidation!=="idle"?r.revalidation:e.revalidation,actionData:r.navigation.state!=="submitting"?r.actionData:e.actionData,fetchers:r.fetchers}}var pz=T.memo(gz);function gz({routes:e,manifest:r,future:i,state:s,isStatic:l,onError:c}){return XM(e,void 0,{manifest:r,state:s,isStatic:l,onError:c})}function yz({to:e,replace:r,state:i,relative:s}){qe(yo()," may be used only in the context of a component.");let{static:l,navigator:c}=T.useContext(Dn);Ct(!l," must not be used on the initial render in a . This is a no-op, but you should modify your code so the is only ever rendered in response to some user interaction or state change.");let{matches:d}=T.useContext(yr),{pathname:f}=Xt(),m=vr(),g=Kl(e,Ad(d),f,s==="path");Ws(typeof e=="string"?e:Mn(e),c.createHref(g),bg(c),"reject");let v=JSON.stringify(g);return T.useEffect(()=>{m(JSON.parse(v),{replace:r,state:i,relative:s})},[m,v,s,r,i]),null}function vz(e){return QM(e.context)}function Pt(e){qe(!1,"A is only ever to be used as the child of element, never rendered directly. Please wrap your in a .")}function bz({basename:e="/",children:r=null,location:i,navigationType:s="POP",navigator:l,static:c=!1,useTransitions:d}){qe(!yo(),"You cannot render a inside another . You should never have more than one in your app.");let f=e.replace(/^\/*/,"/"),m=T.useMemo(()=>({basename:f,navigator:l,static:c,useTransitions:d,future:{}}),[f,l,c,d]);typeof i=="string"&&(i=na(i));let{pathname:g="/",search:v="",hash:y="",state:x=null,key:w="default",mask:E}=i,_=T.useMemo(()=>{let N=tr(g,f);return N==null?null:{location:{pathname:N,search:v,hash:y,state:x,key:w,mask:E},navigationType:s}},[f,g,v,y,x,w,s,E]);return Ct(_!=null,` is not able to match the URL "${g}${v}${y}" because it does not start with the basename, so the won't render anything.`),_==null?null:T.createElement(Dn.Provider,{value:m},T.createElement(Jl.Provider,{children:r,value:_}))}function Rp(e,r=[]){let i=[];return T.Children.forEach(e,(s,l)=>{if(!T.isValidElement(s))return;let c=[...r,l];if(s.type===T.Fragment){i.push.apply(i,Rp(s.props.children,c));return}qe(s.type===Pt,`[${typeof s.type=="string"?s.type:s.type.name}] is not a component. All component children of must be a or `),qe(!s.props.index||!s.props.children,"An index route cannot have child routes.");let d={id:s.props.id||c.join("-"),caseSensitive:s.props.caseSensitive,element:s.props.element,Component:s.props.Component,index:s.props.index,path:s.props.path,middleware:s.props.middleware,loader:s.props.loader,action:s.props.action,hydrateFallbackElement:s.props.hydrateFallbackElement,HydrateFallback:s.props.HydrateFallback,errorElement:s.props.errorElement,ErrorBoundary:s.props.ErrorBoundary,hasErrorBoundary:s.props.hasErrorBoundary===!0||s.props.ErrorBoundary!=null||s.props.errorElement!=null,shouldRevalidate:s.props.shouldRevalidate,handle:s.props.handle,lazy:s.props.lazy};s.props.children&&(d.children=Rp(s.props.children,c)),i.push(d)}),i}var xz=Rp,ed="get",td="application/x-www-form-urlencoded";function Od(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function wz(e){return Od(e)&&e.tagName.toLowerCase()==="button"}function Sz(e){return Od(e)&&e.tagName.toLowerCase()==="form"}function Ez(e){return Od(e)&&e.tagName.toLowerCase()==="input"}function Tz(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function kz(e,r){return e.button===0&&(!r||r==="_self")&&!Tz(e)}function Ap(e=""){return new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((r,i)=>{let s=e[i];return r.concat(Array.isArray(s)?s.map(l=>[i,l]):[[i,s]])},[]))}function _z(e,r){let i=Ap(e);return r&&r.forEach((s,l)=>{i.has(l)||r.getAll(l).forEach(c=>{i.append(l,c)})}),i}var Pu=null;function Nz(){if(Pu===null)try{new FormData(document.createElement("form"),0),Pu=!1}catch{Pu=!0}return Pu}var Cz=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function qm(e){return e!=null&&!Cz.has(e)?(Ct(!1,`"${e}" is not a valid \`encType\` for \`
\`/\`\` and will default to "${td}"`),null):e}function jz(e,r){let i,s,l,c,d;if(Sz(e)){let f=e.getAttribute("action");s=f?tr(f,r):null,i=e.getAttribute("method")||ed,l=qm(e.getAttribute("enctype"))||td,c=new FormData(e)}else if(wz(e)||Ez(e)&&(e.type==="submit"||e.type==="image")){let f=e.form;if(f==null)throw new Error('Cannot submit a