bsv-mcp 0.6.1 → 0.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,117 +0,0 @@
1
- var e=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),t=(e=>typeof require<`u`?require:typeof Proxy<`u`?new Proxy(e,{get:(e,t)=>(typeof require<`u`?require:e)[t]}):e)(function(e){if(typeof require<`u`)return require.apply(this,arguments);throw Error('Calling `require` for "'+e+"\" in an environment that doesn't expose the `require` function. See https://rolldown.rs/in-depth/bundling-cjs#require-external-modules for more details.")});(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var n=e((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function ee(e){if(h=!1,b(e),!m){if(n(c)!==null)m=!0,te||(te=!0,ie());else{var t=n(l);t!==null&&se(ee,t.startTime-e)}}}var te=!1,x=-1,ne=5,S=-1;function re(){return g?!0:!(e.unstable_now()-S<ne)}function C(){if(g=!1,te){var t=e.unstable_now();S=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(x),x=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&re());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&se(ee,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?ie():te=!1}}}var ie;if(typeof y==`function`)ie=function(){y(C)};else if(typeof MessageChannel<`u`){var ae=new MessageChannel,oe=ae.port2;ae.port1.onmessage=C,ie=function(){oe.postMessage(null)}}else ie=function(){_(C,0)};function se(t,n){x=_(function(){t(e.unstable_now())},n)}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(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):ne=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(x),x=-1):h=!0,se(ee,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,te||(te=!0,ie()))),r},e.unstable_shouldYield=re,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),r=e(((e,t)=>{t.exports=n()})),i=e((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.for(`react.activity`),p=Symbol.for(`react.view_transition`),m=Symbol.iterator;function h(e){return typeof e!=`object`||!e?null:(e=m&&e[m]||e[`@@iterator`],typeof e==`function`?e:null)}var g={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},_=Object.assign,v={};function y(e,t,n){this.props=e,this.context=t,this.refs=v,this.updater=n||g}y.prototype.isReactComponent={},y.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=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,e,t,`setState`)},y.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function b(){}b.prototype=y.prototype;function ee(e,t,n){this.props=e,this.context=t,this.refs=v,this.updater=n||g}var te=ee.prototype=new b;te.constructor=ee,_(te,y.prototype),te.isPureReactComponent=!0;var x=Array.isArray;function ne(){}var S={H:null,A:null,T:null,S:null},re=Object.prototype.hasOwnProperty;function C(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function ie(e,t){return C(e.type,t,e.props)}function ae(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function oe(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var se=/\/+/g;function ce(e,t){return typeof e==`object`&&e&&e.key!=null?oe(``+e.key):t.toString(36)}function le(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(ne,ne):(e.status=`pending`,e.then(function(t){e.status===`pending`&&(e.status=`fulfilled`,e.value=t)},function(t){e.status===`pending`&&(e.status=`rejected`,e.reason=t)})),e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason}}throw e}function ue(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`bigint`:case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0;break;case d:return c=e._init,ue(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+ce(e,0):a,x(o)?(i=``,c!=null&&(i=c.replace(se,`$&/`)+`/`),ue(o,r,i,``,function(e){return e})):o!=null&&(ae(o)&&(o=ie(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(se,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(x(e))for(var u=0;u<e.length;u++)a=e[u],s=l+ce(a,u),c+=ue(a,r,i,s,o);else if(u=h(e),typeof u==`function`)for(e=u.call(e),u=0;!(a=e.next()).done;)a=a.value,s=l+ce(a,u++),c+=ue(a,r,i,s,o);else if(s===`object`){if(typeof e.then==`function`)return ue(le(e),r,i,a,o);throw r=String(e),Error(`Objects are not valid as a React child (found: `+(r===`[object Object]`?`object with keys {`+Object.keys(e).join(`, `)+`}`:r)+`). If you meant to render a collection of children, use an array instead.`)}return c}function de(e,t,n){if(e==null)return e;var r=[],i=0;return ue(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function fe(e){if(e._status===-1){var t=e._result,n=t();n.then(function(t){(e._status===0||e._status===-1)&&(e._status=1,e._result=t,n.status===void 0&&(n.status=`fulfilled`,n.value=t))},function(t){(e._status===0||e._status===-1)&&(e._status=2,e._result=t,n.status===void 0&&(n.status=`rejected`,n.reason=t))}),e._status===-1&&(e._status=0,e._result=n)}if(e._status===1)return e._result.default;throw e._result}var pe=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)};function me(e){var t=S.T,n={};n.types=t===null?null:t.types,S.T=n;try{var r=e(),i=S.S;i!==null&&i(n,r),typeof r==`object`&&r&&typeof r.then==`function`&&r.then(ne,pe)}catch(e){pe(e)}finally{t!==null&&n.types!==null&&(t.types=n.types),S.T=t}}function he(e){var t=S.T;if(t!==null){var n=t.types;n===null?t.types=[e]:n.indexOf(e)===-1&&n.push(e)}else me(he.bind(null,e))}var ge={map:de,forEach:function(e,t,n){de(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return de(e,function(){t++}),t},toArray:function(e){return de(e,function(e){return e})||[]},only:function(e){if(!ae(e))throw Error(`React.Children.only expected to receive a single React element child.`);return e}};e.Activity=f,e.Children=ge,e.Component=y,e.Fragment=r,e.Profiler=a,e.PureComponent=ee,e.StrictMode=i,e.Suspense=l,e.ViewTransition=p,e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=S,e.__COMPILER_RUNTIME={__proto__:null,c:function(e){return S.H.useMemoCache(e)}},e.addTransitionType=he,e.cache=function(e){return function(){return e.apply(null,arguments)}},e.cacheSignal=function(){return null},e.cloneElement=function(e,t,n){if(e==null)throw Error(`The argument must be a React element, but you passed `+e+`.`);var r=_({},e.props),i=e.key;if(t!=null)for(a in t.key!==void 0&&(i=``+t.key),t)!re.call(t,a)||a===`key`||a===`__self`||a===`__source`||a===`ref`&&t.ref===void 0||(r[a]=t[a]);var a=arguments.length-2;if(a===1)r.children=n;else if(1<a){for(var o=Array(a),s=0;s<a;s++)o[s]=arguments[s+2];r.children=o}return C(e.type,i,r)},e.createContext=function(e){return e={$$typeof:s,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:o,_context:e},e},e.createElement=function(e,t,n){var r,i={},a=null;if(t!=null)for(r in t.key!==void 0&&(a=``+t.key),t)re.call(t,r)&&r!==`key`&&r!==`__self`&&r!==`__source`&&(i[r]=t[r]);var o=arguments.length-2;if(o===1)i.children=n;else if(1<o){for(var s=Array(o),c=0;c<o;c++)s[c]=arguments[c+2];i.children=s}if(e&&e.defaultProps)for(r in o=e.defaultProps,o)i[r]===void 0&&(i[r]=o[r]);return C(e,a,i)},e.createRef=function(){return{current:null}},e.forwardRef=function(e){return{$$typeof:c,render:e}},e.isValidElement=ae,e.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:fe}},e.memo=function(e,t){return{$$typeof:u,type:e,compare:t===void 0?null:t}},e.startTransition=me,e.unstable_useCacheRefresh=function(){return S.H.useCacheRefresh()},e.use=function(e){return S.H.use(e)},e.useActionState=function(e,t,n){return S.H.useActionState(e,t,n)},e.useCallback=function(e,t){return S.H.useCallback(e,t)},e.useContext=function(e){return S.H.useContext(e)},e.useDebugValue=function(){},e.useDeferredValue=function(e,t){return S.H.useDeferredValue(e,t)},e.useEffect=function(e,t){return S.H.useEffect(e,t)},e.useEffectEvent=function(e){return S.H.useEffectEvent(e)},e.useId=function(){return S.H.useId()},e.useImperativeHandle=function(e,t,n){return S.H.useImperativeHandle(e,t,n)},e.useInsertionEffect=function(e,t){return S.H.useInsertionEffect(e,t)},e.useLayoutEffect=function(e,t){return S.H.useLayoutEffect(e,t)},e.useMemo=function(e,t){return S.H.useMemo(e,t)},e.useOptimistic=function(e,t){return S.H.useOptimistic(e,t)},e.useReducer=function(e,t,n){return S.H.useReducer(e,t,n)},e.useRef=function(e){return S.H.useRef(e)},e.useState=function(e){return S.H.useState(e)},e.useSyncExternalStore=function(e,t,n){return S.H.useSyncExternalStore(e,t,n)},e.useTransition=function(){return S.H.useTransition()},e.version=`19.3.0`})),a=e(((e,t)=>{t.exports=i()})),o=e((e=>{var t=a();function n(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function r(){}var i={d:{f:r,r:function(){throw Error(n(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},o=Symbol.for(`react.portal`),s=Symbol.for(`react.recoverable`),c=Symbol.for(`react.optimistic_key`);function l(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:o,key:r==null?null:r===c?c:``+r,children:e,containerInfo:t,implementation:n}}var u=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function d(e,t){if(e===`font`)return``;if(typeof t==`string`)return t===`use-credentials`?t:``}e.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,e.browser=function(e){return{$$typeof:s,_reason:e}},e.createPortal=function(e,t){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(n(299));return l(e,t,null,r)},e.flushSync=function(e){var t=u.T,n=i.p;try{if(u.T=null,i.p=2,e)return e()}finally{u.T=t,i.p=n,i.d.f()}},e.preconnect=function(e,t){typeof e==`string`&&(t?(t=t.crossOrigin,t=typeof t==`string`?t===`use-credentials`?t:``:void 0):t=null,i.d.C(e,t))},e.prefetchDNS=function(e){typeof e==`string`&&i.d.D(e)},e.preinit=function(e,t){if(typeof e==`string`&&t&&typeof t.as==`string`){var n=t.as,r=d(n,t.crossOrigin),a=typeof t.integrity==`string`?t.integrity:void 0,o=typeof t.fetchPriority==`string`?t.fetchPriority:void 0;n===`style`?i.d.S(e,typeof t.precedence==`string`?t.precedence:void 0,{crossOrigin:r,integrity:a,fetchPriority:o}):n===`script`&&i.d.X(e,{crossOrigin:r,integrity:a,fetchPriority:o,nonce:typeof t.nonce==`string`?t.nonce:void 0})}},e.preinitModule=function(e,t){if(typeof e==`string`){if(typeof t==`object`&&t){if(t.as==null||t.as===`script`){var n=d(t.as,t.crossOrigin);i.d.M(e,{crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0})}}else t??i.d.M(e)}},e.preload=function(e,t){if(typeof e==`string`&&typeof t==`object`&&t&&typeof t.as==`string`){var n=t.as,r=d(n,t.crossOrigin);i.d.L(e,n,{crossOrigin:r,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,type:typeof t.type==`string`?t.type:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy==`string`?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet==`string`?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes==`string`?t.imageSizes:void 0,media:typeof t.media==`string`?t.media:void 0})}},e.preloadModule=function(e,t){if(typeof e==`string`){if(t){var n=d(t.as,t.crossOrigin);i.d.m(e,{as:typeof t.as==`string`&&t.as!==`script`?t.as:void 0,crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0})}else i.d.m(e)}},e.requestFormReset=function(e){i.d.r(e)},e.unstable_batchedUpdates=function(e,t){return e(t)},e.useFormState=function(e,t,n){return u.H.useFormState(e,t,n)},e.useFormStatus=function(){return u.H.useHostTransitionStatus()},e.version=`19.3.0`})),s=e(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=o()})),c=e((e=>{var t=r(),n=a(),i=s();function o(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function c(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function l(e){for(var t=e,n=t;n&&!n.alternate;)t=n,t.flags&4098&&(e=t.return),n=t.return;for(;t.return;)t=t.return;return t.tag===3?e:null}function u(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function d(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function f(e){if(l(e)!==e)throw Error(o(188))}function p(e){var t=e.alternate;if(!t){if(t=l(e),t===null)throw Error(o(188));return t===e?e:null}for(var n=e,r=t;;){var i=n.return;if(i===null)break;var a=i.alternate;if(a===null){if(r=i.return,r!==null){n=r;continue}break}if(i.child===a.child){for(a=i.child;a;){if(a===n)return f(i),e;if(a===r)return f(i),t;a=a.sibling}throw Error(o(188))}if(n.return!==r.return)n=i,r=a;else{for(var s=!1,c=i.child;c;){if(c===n){s=!0,n=i,r=a;break}if(c===r){s=!0,r=i,n=a;break}c=c.sibling}if(!s){for(c=a.child;c;){if(c===n){s=!0,n=a,r=i;break}if(c===r){s=!0,r=a,n=i;break}c=c.sibling}if(!s)throw Error(o(189))}}if(n.alternate!==r)throw Error(o(190))}if(n.tag!==3)throw Error(o(188));return n.stateNode.current===n?e:t}function m(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=m(e),t!==null)return t;e=e.sibling}return null}function h(e,t,n,r,i,a){for(;e!==null;){if((e.tag===5||e.tag===27||e.tag===6)&&n(e,r,i,a)||(e.tag!==22||e.memoizedState===null)&&(t||e.tag!==5&&e.tag!==27)&&h(e.child,t,n,r,i,a))return!0;e=e.sibling}return!1}function g(e){for(e=e.return;e!==null;){if(e.tag===3||e.tag===5||e.tag===27)return e;e=e.return}return null}function _(e){var t=!1;for(e=e.return;e!==null&&(e.tag===4&&(t=!0),e.tag!==3&&e.tag!==5&&e.tag!==27);)e=e.return;return t}function v(e){var t=[null,null],n=g(e);return n===null||y(t,e,n.child,{foundSelf:!1}),t}function y(e,t,n,r){for(;n!==null;){if(n===t)r.foundSelf=!0;else if(n.tag===5||n.tag===27||n.tag===6){if(r.foundSelf)return e[1]=n,!0;e[0]=n}else if((n.tag!==22||n.memoizedState===null)&&y(e,t,n.child,r))return!0;n=n.sibling}return!1}function b(e){switch(e.tag){case 5:case 27:case 6:return e.stateNode;case 3:return e.stateNode.containerInfo;default:throw Error(o(559))}}var ee=null,te=null;function x(e,t,n){return e===n||e===t&&(ee=e,!0)}function ne(e,t,n){return e===n?(te=e,!1):e===t&&(te!==null&&(ee=e),!0)}function S(e){if(e===null)return null;do e=e===null?null:e.return;while(e&&e.tag!==5&&e.tag!==27&&e.tag!==3);return e||null}function re(e,t,n){for(var r=0,i=e;i;i=n(i))r++;i=0;for(var a=t;a;a=n(a))i++;for(;0<r-i;)e=n(e),r--;for(;0<i-r;)t=n(t),i--;for(;r--;){if(e===t||t!==null&&e===t.alternate)return e;e=n(e),t=n(t)}return null}var C=Object.assign,ie=Symbol.for(`react.element`),ae=Symbol.for(`react.transitional.element`),oe=Symbol.for(`react.portal`),se=Symbol.for(`react.fragment`),ce=Symbol.for(`react.strict_mode`),le=Symbol.for(`react.profiler`),ue=Symbol.for(`react.consumer`),de=Symbol.for(`react.context`),fe=Symbol.for(`react.forward_ref`),pe=Symbol.for(`react.suspense`),me=Symbol.for(`react.suspense_list`),he=Symbol.for(`react.memo`),ge=Symbol.for(`react.lazy`),_e=Symbol.for(`react.activity`),ve=Symbol.for(`react.legacy_hidden`),ye=Symbol.for(`react.memo_cache_sentinel`),be=Symbol.for(`react.view_transition`),xe=Symbol.for(`react.recoverable`),Se=Symbol.iterator;function Ce(e){return typeof e!=`object`||!e?null:(e=Se&&e[Se]||e[`@@iterator`],typeof e==`function`?e:null)}var we=Symbol.for(`react.client.reference`);function Te(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===we?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case se:return`Fragment`;case le:return`Profiler`;case ce:return`StrictMode`;case pe:return`Suspense`;case me:return`SuspenseList`;case _e:return`Activity`;case be:return`ViewTransition`}if(typeof e==`object`)switch(e.$$typeof){case oe:return`Portal`;case de:return e.displayName||`Context`;case ue:return(e._context.displayName||`Context`)+`.Consumer`;case fe:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case he:return t=e.displayName||null,t===null?Te(e.type)||`Memo`:t;case ge:t=e._payload,e=e._init;try{return Te(e(t))}catch{}}return null}var Ee=Array.isArray,w=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,T=i.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,De={pending:!1,data:null,method:null,action:null},Oe=[],ke=-1;function Ae(e){return{current:e}}function je(e){0>ke||(e.current=Oe[ke],Oe[ke]=null,ke--)}function Me(e,t){ke++,Oe[ke]=e.current,e.current=t}var Ne=Ae(null),Pe=Ae(null),Fe=Ae(null),Ie=Ae(null);function Le(e,t){switch(Me(Fe,t),Me(Pe,e),Me(Ne,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Cp(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Cp(t),e=wp(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}je(Ne),Me(Ne,e)}function Re(){je(Ne),je(Pe),je(Fe)}function ze(e){var t=e.memoizedState;t!==null&&(lh._currentValue=t.memoizedState,Me(Ie,e)),t=Ne.current;var n=wp(t,e.type);t!==n&&(Me(Pe,e),Me(Ne,n))}function Be(e){Pe.current===e&&(je(Ne),je(Pe)),Ie.current===e&&(je(Ie),lh._currentValue=De)}var Ve,He;function Ue(e){if(Ve===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);Ve=t&&t[1]||``,He=-1<e.stack.indexOf(`
2
- at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
3
- `+Ve+e+He}var We=!1;function Ge(e,t){if(!e||We)return``;We=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,"props",{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}n=!1;try{var i=Object.getOwnPropertyDescriptor(e.prototype,`props`);Object.defineProperty(e.prototype,"props",{configurable:!0,set:function(){throw Error()}}),n=!0,new e}finally{n&&(i===void 0?delete e.prototype.props:Object.defineProperty(e.prototype,"props",i))}}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(`
4
- `),l=s.split(`
5
- `);for(i=r=0;r<c.length&&!c[r].includes(`DetermineComponentFrameRoot`);)r++;for(;i<l.length&&!l[i].includes(`DetermineComponentFrameRoot`);)i++;if(r===c.length||i===l.length)for(r=c.length-1,i=l.length-1;1<=r&&0<=i&&c[r]!==l[i];)i--;for(;1<=r&&0<=i;r--,i--)if(c[r]!==l[i]){if(r!==1||i!==1)do if(r--,i--,0>i||c[r]!==l[i]){var u=`
6
- `+c[r].replace(` at new `,` at `);return e.displayName&&u.includes(`<anonymous>`)&&(u=u.replace(`<anonymous>`,e.displayName)),u}while(1<=r&&0<=i);break}}}finally{We=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:``)?Ue(n):``}function Ke(e,t){switch(e.tag){case 26:case 27:case 5:return Ue(e.type);case 16:return Ue(`Lazy`);case 13:return e.child!==t&&t!==null?Ue(`Suspense Fallback`):Ue(`Suspense`);case 19:return Ue(`SuspenseList`);case 0:case 15:return Ge(e.type,!1);case 11:return Ge(e.type.render,!1);case 1:return Ge(e.type,!0);case 31:return Ue(`Activity`);case 30:return Ue(`ViewTransition`);default:return``}}function qe(e){try{var t=``,n=null;do t+=Ke(e,n),n=e,e=e.return;while(e);return t}catch(e){return`
7
- Error generating stack: `+e.message+`
8
- `+e.stack}}var Je=Object.prototype.hasOwnProperty,Ye=t.unstable_scheduleCallback,Xe=t.unstable_cancelCallback,Ze=t.unstable_shouldYield,Qe=t.unstable_requestPaint,$e=t.unstable_now,et=t.unstable_getCurrentPriorityLevel,tt=t.unstable_ImmediatePriority,nt=t.unstable_UserBlockingPriority,rt=t.unstable_NormalPriority,it=t.unstable_LowPriority,at=t.unstable_IdlePriority,ot=t.log,st=t.unstable_setDisableYieldValue,ct=null,lt=null;function ut(e){if(typeof ot==`function`&&st(e),lt&&typeof lt.setStrictMode==`function`)try{lt.setStrictMode(ct,e)}catch{}}var dt=Math.clz32?Math.clz32:mt,ft=Math.log,pt=Math.LN2;function mt(e){return e>>>=0,e===0?32:31-(ft(e)/pt|0)|0}var ht=256,gt=262144,_t=4194304;function vt(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 yt(e,t,n){var r=e.pendingLanes;if(r===0)return 0;var i=0,a=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var s=r&134217727;return s===0?(s=r&~a,s===0?o===0?n||(n=r&~e,n!==0&&(i=vt(n))):i=vt(o):i=vt(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=vt(n))):i=vt(o)):i=vt(r)),i===0?0:t!==0&&t!==i&&(t&a)===0&&(a=i&-i,n=t&-t,a>=n||a===32&&n&4194048)?t:i}function bt(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function xt(e,t){t&8&&(t|=t&32);var n=e.entangledLanes;if(n!==0)for(e=e.entanglements,n&=t;0<n;){var r=31-dt(n),i=1<<r;t|=e[r],n&=~i}return t}function St(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Ct(){var e=_t;return _t<<=1,!(_t&62914560)&&(_t=4194304),e}function wt(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Tt(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Et(e,t,n,r,i,a){var o=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var s=e.entanglements,c=e.expirationTimes,l=e.hiddenUpdates;for(n=o&~n;0<n;){var u=31-dt(n),d=1<<u;s[u]=0,c[u]=-1;var f=l[u];if(f!==null)for(l[u]=null,u=0;u<f.length;u++){var p=f[u];p!==null&&(p.lane&=-536870913)}n&=~d}r!==0&&Dt(e,r,0),a!==0&&i===0&&e.tag!==0&&(e.suspendedLanes|=a&~(o&~t))}function Dt(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-dt(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|n&261930}function Ot(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-dt(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}function kt(e,t){var n=t&-t;return n=n&42?1:At(n),(n&(e.suspendedLanes|t))===0?n:0}function At(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function jt(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function Mt(){var e=T.p;return e===0?(e=window.event,e===void 0?32:Th(e.type)):e}function Nt(e,t){var n=T.p;try{return T.p=e,t()}finally{T.p=n}}var Pt=Math.random().toString(36).slice(2),Ft=`__reactFiber$`+Pt,It=`__reactProps$`+Pt,Lt=`__reactContainer$`+Pt,Rt=`__reactEvents$`+Pt,zt=`__reactListeners$`+Pt,Bt=`__reactHandles$`+Pt,Vt=`__reactResources$`+Pt,Ht=`__reactMarker$`+Pt,Ut=`__reactLoad$`+Pt;function Wt(e){delete e[Ft],delete e[It],delete e[zt],delete e[Bt]}function Gt(e){var t;if(t=e[Ft])return t;for(var n=e.parentNode;n;){if(t=n[Lt]||n[Ft]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=mm(e);e!==null;){if(n=e[Ft])return n;e=mm(e)}return t}e=n,n=e.parentNode}return null}function Kt(e){if(e=e[Ft]||e[Lt]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function qt(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(o(33))}function Jt(e){var t=e[Vt];return t||=e[Vt]={hoistableStyles:new Map,hoistableScripts:new Map},t}function Yt(e){e[Ht]=!0}function Xt(e){e[Ut]=void 0}var Zt=new Set,Qt={};function $t(e,t){E(e,t),E(e+`Capture`,t)}function E(e,t){for(Qt[e]=t,e=0;e<t.length;e++)Zt.add(t[e])}var en=RegExp(`^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$`),tn={},nn={};function rn(e){return Je.call(nn,e)?!0:Je.call(tn,e)?!1:en.test(e)?nn[e]=!0:(tn[e]=!0,!1)}var D=!1;function an(){var e=D;return D=!1,e}function on(e,t,n){if(rn(t)){if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:e.removeAttribute(t);return;case`boolean`:var r=t.toLowerCase().slice(0,5);if(r!==`data-`&&r!==`aria-`){e.removeAttribute(t);return}}e.setAttribute(t,n)}}}function sn(e,t,n){if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(t);return}e.setAttribute(t,n)}}function cn(e,t,n,r){if(r===null)e.removeAttribute(n);else{switch(typeof r){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(n);return}e.setAttributeNS(t,n,r)}}function ln(e){switch(typeof e){case`bigint`:case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function un(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function dn(e,t,n){var r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&r!==void 0&&typeof r.get==`function`&&typeof r.set==`function`){var i=r.get,a=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(e){n=``+e,a.call(this,e)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(e){n=``+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function fn(e){if(!e._valueTracker){var t=un(e)?`checked`:`value`;e._valueTracker=dn(e,t,``+e[t])}}function pn(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=un(e)?e.checked?`true`:`false`:e.value),e=r,e!==n&&(t.setValue(e),!0)}var mn=/[\n"\\]/g;function hn(e){return e.replace(mn,function(e){return`\\`+e.charCodeAt(0).toString(16)+` `})}function gn(e,t,n,r,i,a,o,s){e.name=``,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`?e.type=o:e.removeAttribute(`type`),t==null?o!==`submit`&&o!==`reset`||e.removeAttribute(`value`):o===`number`?(t===0&&e.value===``||e.value!=t)&&(e.value=``+ln(t)):e.value!==``+ln(t)&&(e.value=``+ln(t)),t==null?n==null?r!=null&&e.removeAttribute(`value`):vn(e,ln(n)):o===`number`&&e.value==t?vn(e,ln(e.value)):vn(e,ln(t)),i==null&&a!=null&&(e.defaultChecked=!!a),i!=null&&(e.checked=i&&typeof i!=`function`&&typeof i!=`symbol`),s!=null&&typeof s!=`function`&&typeof s!=`symbol`&&typeof s!=`boolean`?e.name=``+ln(s):e.removeAttribute(`name`)}function _n(e,t,n,r,i,a,o,s){if(a!=null&&typeof a!=`function`&&typeof a!=`symbol`&&typeof a!=`boolean`&&(e.type=a),t!=null||n!=null){if(!(a!==`submit`&&a!==`reset`||t!=null)){fn(e);return}n=n==null?``:``+ln(n),t=t==null?n:``+ln(t),s||t===e.value||(e.value=t),e.defaultValue=t}r??=i,r=typeof r!=`function`&&typeof r!=`symbol`&&!!r,e.checked=s?e.checked:!!r,e.defaultChecked=!!r,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`&&(e.name=o),fn(e)}function vn(e,t){e.defaultValue!==``+t&&(e.defaultValue=``+t)}function yn(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i<n.length;i++)t[`$`+n[i]]=!0;for(n=0;n<e.length;n++)i=t.hasOwnProperty(`$`+e[n].value),e[n].selected!==i&&(e[n].selected=i),i&&r&&(e[n].defaultSelected=!0)}else{for(n=``+ln(n),t=null,i=0;i<e.length;i++){if(e[i].value===n){e[i].selected=!0,r&&(e[i].defaultSelected=!0);return}t!==null||e[i].disabled||(t=e[i])}t!==null&&(t.selected=!0)}}function bn(e,t,n){if(t!=null&&(t=``+ln(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n==null?``:``+ln(n)}function xn(e,t,n,r){if(t==null){if(r!=null){if(n!=null)throw Error(o(92));if(Ee(r)){if(1<r.length)throw Error(o(93));r=r[0]}n=r}n??=``,t=n}n=ln(t),e.defaultValue=n,r=e.textContent,r===n&&r!==``&&r!==null&&(e.value=r),fn(e)}function Sn(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Cn=new Set(`animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp`.split(` `));function wn(e,t,n){var r=t.indexOf(`--`)===0;n==null||typeof n==`boolean`||n===``?r?e.setProperty(t,``):t===`float`?e.cssFloat=``:e[t]=``:r?e.setProperty(t,n):typeof n!=`number`||n===0||Cn.has(t)?t===`float`?e.cssFloat=n:e[t]=(``+n).trim():e[t]=n+`px`}function Tn(e,t,n){if(t!=null&&typeof t!=`object`)throw Error(o(62));if(e=e.style,n!=null){for(var r in n)!n.hasOwnProperty(r)||t!=null&&t.hasOwnProperty(r)||(r.indexOf(`--`)===0?e.setProperty(r,``):r===`float`?e.cssFloat=``:e[r]=``,D=!0);for(var i in t)r=t[i],t.hasOwnProperty(i)&&n[i]!==r&&(wn(e,i,r),D=!0)}else for(var a in t)t.hasOwnProperty(a)&&wn(e,a,t[a])}function En(e){if(e.indexOf(`-`)===-1)return!1;switch(e){case`annotation-xml`:case`color-profile`:case`font-face`:case`font-face-src`:case`font-face-uri`:case`font-face-format`:case`font-face-name`:case`missing-glyph`:return!1;default:return!0}}var Dn=new Map([[`acceptCharset`,`accept-charset`],[`htmlFor`,`for`],[`httpEquiv`,`http-equiv`],[`crossOrigin`,`crossorigin`],[`accentHeight`,`accent-height`],[`alignmentBaseline`,`alignment-baseline`],[`arabicForm`,`arabic-form`],[`baselineShift`,`baseline-shift`],[`capHeight`,`cap-height`],[`clipPath`,`clip-path`],[`clipRule`,`clip-rule`],[`colorInterpolation`,`color-interpolation`],[`colorInterpolationFilters`,`color-interpolation-filters`],[`colorProfile`,`color-profile`],[`colorRendering`,`color-rendering`],[`dominantBaseline`,`dominant-baseline`],[`enableBackground`,`enable-background`],[`fillOpacity`,`fill-opacity`],[`fillRule`,`fill-rule`],[`floodColor`,`flood-color`],[`floodOpacity`,`flood-opacity`],[`fontFamily`,`font-family`],[`fontSize`,`font-size`],[`fontSizeAdjust`,`font-size-adjust`],[`fontStretch`,`font-stretch`],[`fontStyle`,`font-style`],[`fontVariant`,`font-variant`],[`fontWeight`,`font-weight`],[`glyphName`,`glyph-name`],[`glyphOrientationHorizontal`,`glyph-orientation-horizontal`],[`glyphOrientationVertical`,`glyph-orientation-vertical`],[`horizAdvX`,`horiz-adv-x`],[`horizOriginX`,`horiz-origin-x`],[`imageRendering`,`image-rendering`],[`letterSpacing`,`letter-spacing`],[`lightingColor`,`lighting-color`],[`markerEnd`,`marker-end`],[`markerMid`,`marker-mid`],[`markerStart`,`marker-start`],[`maskType`,`mask-type`],[`overlinePosition`,`overline-position`],[`overlineThickness`,`overline-thickness`],[`paintOrder`,`paint-order`],[`panose-1`,`panose-1`],[`pointerEvents`,`pointer-events`],[`renderingIntent`,`rendering-intent`],[`shapeRendering`,`shape-rendering`],[`stopColor`,`stop-color`],[`stopOpacity`,`stop-opacity`],[`strikethroughPosition`,`strikethrough-position`],[`strikethroughThickness`,`strikethrough-thickness`],[`strokeDasharray`,`stroke-dasharray`],[`strokeDashoffset`,`stroke-dashoffset`],[`strokeLinecap`,`stroke-linecap`],[`strokeLinejoin`,`stroke-linejoin`],[`strokeMiterlimit`,`stroke-miterlimit`],[`strokeOpacity`,`stroke-opacity`],[`strokeWidth`,`stroke-width`],[`textAnchor`,`text-anchor`],[`textDecoration`,`text-decoration`],[`textRendering`,`text-rendering`],[`transformOrigin`,`transform-origin`],[`underlinePosition`,`underline-position`],[`underlineThickness`,`underline-thickness`],[`unicodeBidi`,`unicode-bidi`],[`unicodeRange`,`unicode-range`],[`unitsPerEm`,`units-per-em`],[`vAlphabetic`,`v-alphabetic`],[`vHanging`,`v-hanging`],[`vIdeographic`,`v-ideographic`],[`vMathematical`,`v-mathematical`],[`vectorEffect`,`vector-effect`],[`vertAdvY`,`vert-adv-y`],[`vertOriginX`,`vert-origin-x`],[`vertOriginY`,`vert-origin-y`],[`wordSpacing`,`word-spacing`],[`writingMode`,`writing-mode`],[`xmlnsXlink`,`xmlns:xlink`],[`xHeight`,`x-height`]]),On=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function kn(e){return On.test(``+e)?`javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')`:e}function An(){}var jn=null;function Mn(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Nn=null,Pn=null;function Fn(e){var t=Kt(e);if(t&&(e=t.stateNode)){var n=e[It]||null;a:switch(e=t.stateNode,t.type){case`input`:if(gn(e,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name),t=n.name,n.type===`radio`&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll(`input[name="`+hn(``+t)+`"][type="radio"]`),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var i=r[It]||null;if(!i)throw Error(o(90));gn(r,i.value,i.defaultValue,i.defaultValue,i.checked,i.defaultChecked,i.type,i.name)}}for(t=0;t<n.length;t++)r=n[t],r.form===e.form&&pn(r)}break a;case`textarea`:bn(e,n.value,n.defaultValue);break a;case`select`:t=n.value,t!=null&&yn(e,!!n.multiple,t,!1)}}}var In=!1;function Ln(e,t,n){if(In)return e(t,n);In=!0;try{return e(t)}finally{if(In=!1,(Nn!==null||Pn!==null)&&(Zd(),Nn&&(t=Nn,e=Pn,Pn=Nn=null,Fn(t),e)))for(t=0;t<e.length;t++)Fn(e[t])}}function Rn(e,t){var n=e.stateNode;if(n===null)return null;var r=n[It]||null;if(r===null)return null;n=r[t];a:switch(t){case`onClick`:case`onClickCapture`:case`onDoubleClick`:case`onDoubleClickCapture`:case`onMouseDown`:case`onMouseDownCapture`:case`onMouseMove`:case`onMouseMoveCapture`:case`onMouseUp`:case`onMouseUpCapture`:case`onMouseEnter`:(r=!r.disabled)||(e=e.type,r=e!==`button`&&e!==`input`&&e!==`select`&&e!==`textarea`),e=!r;break a;default:e=!1}if(e)return null;if(n&&typeof n!=`function`)throw Error(o(231,t,typeof n));return n}var zn=!(typeof window>`u`||window.document===void 0||window.document.createElement===void 0),Bn=!1;if(zn)try{var Vn={};Object.defineProperty(Vn,"passive",{get:function(){Bn=!0}}),window.addEventListener(`test`,Vn,Vn),window.removeEventListener(`test`,Vn,Vn)}catch{Bn=!1}var Hn=null,O=null,Un=null;function Wn(){if(Un)return Un;var e,t=O,n=t.length,r,i=`value`in Hn?Hn.value:Hn.textContent,a=i.length;for(e=0;e<n&&t[e]===i[e];e++);var o=n-e;for(r=1;r<=o&&t[n-r]===i[a-r];r++);return Un=i.slice(e,1<r?1-r:void 0)}function Gn(e){var t=e.keyCode;return`charCode`in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function Kn(){return!0}function qn(){return!1}function Jn(e){function t(t,n,r,i,a){for(var o in this._reactName=t,this._targetInst=r,this.type=n,this.nativeEvent=i,this.target=a,this.currentTarget=null,e)e.hasOwnProperty(o)&&(t=e[o],this[o]=t?t(i):i[o]);return this.isDefaultPrevented=(i.defaultPrevented==null?!1===i.returnValue:i.defaultPrevented)?Kn:qn,this.isPropagationStopped=qn,this}return C(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():typeof e.returnValue!=`unknown`&&(e.returnValue=!1),this.isDefaultPrevented=Kn)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():typeof e.cancelBubble!=`unknown`&&(e.cancelBubble=!0),this.isPropagationStopped=Kn)},persist:function(){},isPersistent:Kn}),t}var Yn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Xn=Jn(Yn),Zn=C({},Yn,{view:0,detail:0}),Qn=Jn(Zn),$n,er,tr,nr=C({},Zn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:pr,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return`movementX`in e?e.movementX:(e!==tr&&(tr&&e.type===`mousemove`?($n=e.screenX-tr.screenX,er=e.screenY-tr.screenY):er=$n=0,tr=e),$n)},movementY:function(e){return`movementY`in e?e.movementY:er}}),rr=Jn(nr),ir=Jn(C({},nr,{dataTransfer:0})),ar=Jn(C({},Zn,{relatedTarget:0})),or=Jn(C({},Yn,{animationName:0,elapsedTime:0,pseudoElement:0})),sr=Jn(C({},Yn,{clipboardData:function(e){return`clipboardData`in e?e.clipboardData:window.clipboardData}})),cr=Jn(C({},Yn,{data:0})),lr={Esc:`Escape`,Spacebar:` `,Left:`ArrowLeft`,Up:`ArrowUp`,Right:`ArrowRight`,Down:`ArrowDown`,Del:`Delete`,Win:`OS`,Menu:`ContextMenu`,Apps:`ContextMenu`,Scroll:`ScrollLock`,MozPrintableKey:`Unidentified`},ur={8:`Backspace`,9:`Tab`,12:`Clear`,13:`Enter`,16:`Shift`,17:`Control`,18:`Alt`,19:`Pause`,20:`CapsLock`,27:`Escape`,32:` `,33:`PageUp`,34:`PageDown`,35:`End`,36:`Home`,37:`ArrowLeft`,38:`ArrowUp`,39:`ArrowRight`,40:`ArrowDown`,45:`Insert`,46:`Delete`,112:`F1`,113:`F2`,114:`F3`,115:`F4`,116:`F5`,117:`F6`,118:`F7`,119:`F8`,120:`F9`,121:`F10`,122:`F11`,123:`F12`,144:`NumLock`,145:`ScrollLock`,224:`Meta`},dr={Alt:`altKey`,Control:`ctrlKey`,Meta:`metaKey`,Shift:`shiftKey`};function fr(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=dr[e])?!!t[e]:!1}function pr(){return fr}var mr=Jn(C({},Zn,{key:function(e){if(e.key){var t=lr[e.key]||e.key;if(t!==`Unidentified`)return t}return e.type===`keypress`?(e=Gn(e),e===13?`Enter`:String.fromCharCode(e)):e.type===`keydown`||e.type===`keyup`?ur[e.keyCode]||`Unidentified`:``},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:pr,charCode:function(e){return e.type===`keypress`?Gn(e):0},keyCode:function(e){return e.type===`keydown`||e.type===`keyup`?e.keyCode:0},which:function(e){return e.type===`keypress`?Gn(e):e.type===`keydown`||e.type===`keyup`?e.keyCode:0}})),hr=Jn(C({},nr,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),gr=Jn(C({},Yn,{submitter:0})),_r=Jn(C({},Zn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:pr})),vr=Jn(C({},Yn,{propertyName:0,elapsedTime:0,pseudoElement:0})),yr=Jn(C({},nr,{deltaX:function(e){return`deltaX`in e?e.deltaX:`wheelDeltaX`in e?-e.wheelDeltaX:0},deltaY:function(e){return`deltaY`in e?e.deltaY:`wheelDeltaY`in e?-e.wheelDeltaY:`wheelDelta`in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0})),br=Jn(C({},Yn,{newState:0,oldState:0,source:0})),xr=[9,13,27,32],Sr=zn&&`CompositionEvent`in window,Cr=null;zn&&`documentMode`in document&&(Cr=document.documentMode);var wr=zn&&`TextEvent`in window&&!Cr,Tr=zn&&(!Sr||Cr&&8<Cr&&11>=Cr),Er=` `,Dr=!1;function Or(e,t){switch(e){case`keyup`:return xr.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function kr(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var Ar=!1;function k(e,t){switch(e){case`compositionend`:return kr(t);case`keypress`:return t.which===32?(Dr=!0,Er):null;case`textInput`:return e=t.data,e===Er&&Dr?null:e;default:return null}}function jr(e,t){if(Ar)return e===`compositionend`||!Sr&&Or(e,t)?(e=Wn(),Un=O=Hn=null,Ar=!1,e):null;switch(e){case`paste`:return null;case`keypress`:if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case`compositionend`:return Tr&&t.locale!==`ko`?null:t.data;default:return null}}var Mr={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Nr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t===`input`?!!Mr[e.type]:t===`textarea`}function Pr(e,t,n,r){Nn?Pn?Pn.push(r):Pn=[r]:Nn=r,t=sp(t,`onChange`),0<t.length&&(n=new Xn(`onChange`,`change`,null,n,r),e.push({event:n,listeners:t}))}var Fr=null,Ir=null;function Lr(e){ep(e,0)}function Rr(e){if(pn(qt(e)))return e}function zr(e,t){if(e===`change`)return t}var Br=!1;if(zn){var Vr;if(zn){var Hr=`oninput`in document;if(!Hr){var Ur=document.createElement(`div`);Ur.setAttribute(`oninput`,`return;`),Hr=typeof Ur.oninput==`function`}Vr=Hr}else Vr=!1;Br=Vr&&(!document.documentMode||9<document.documentMode)}function Wr(){Fr&&(Fr.detachEvent(`onpropertychange`,Gr),Ir=Fr=null)}function Gr(e){if(e.propertyName===`value`&&Rr(Ir)){var t=[];Pr(t,Ir,e,Mn(e)),Ln(Lr,t)}}function Kr(e,t,n){e===`focusin`?(Wr(),Fr=t,Ir=n,Fr.attachEvent(`onpropertychange`,Gr)):e===`focusout`&&Wr()}function qr(e){if(e===`selectionchange`||e===`keyup`||e===`keydown`)return Rr(Ir)}function Jr(e,t){if(e===`click`)return Rr(t)}function Yr(e,t){if(e===`input`||e===`change`)return Rr(t)}function Xr(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var Zr=typeof Object.is==`function`?Object.is:Xr;function Qr(e,t){if(Zr(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var i=n[r];if(!Je.call(t,i)||!Zr(e[i],t[i]))return!1}return!0}function $r(e){if(e||=typeof document<`u`?document:void 0,e===void 0)return null;try{return e.activeElement||e.body}catch{return e.body}}function ei(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function ti(e,t){var n=ei(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}a:{for(;n;){if(n.nextSibling){n=n.nextSibling;break a}n=n.parentNode}n=void 0}n=ei(n)}}function ni(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?ni(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function ri(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=$r(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=$r(e.document)}return t}function ii(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 ai=zn&&`documentMode`in document&&11>=document.documentMode,oi=null,si=null,ci=null,li=!1;function ui(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;li||oi==null||oi!==$r(r)||(r=oi,`selectionStart`in r&&ii(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),ci&&Qr(ci,r)||(ci=r,r=sp(si,`onSelect`),0<r.length&&(t=new Xn(`onSelect`,`select`,null,t,n),e.push({event:t,listeners:r}),t.target=oi)))}function di(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n[`Webkit`+e]=`webkit`+t,n[`Moz`+e]=`moz`+t,n}var fi={animationend:di(`Animation`,`AnimationEnd`),animationiteration:di(`Animation`,`AnimationIteration`),animationstart:di(`Animation`,`AnimationStart`),transitionrun:di(`Transition`,`TransitionRun`),transitionstart:di(`Transition`,`TransitionStart`),transitioncancel:di(`Transition`,`TransitionCancel`),transitionend:di(`Transition`,`TransitionEnd`)},pi={},mi={};zn&&(mi=document.createElement(`div`).style,`AnimationEvent`in window||(delete fi.animationend.animation,delete fi.animationiteration.animation,delete fi.animationstart.animation),`TransitionEvent`in window||delete fi.transitionend.transition);function hi(e){if(pi[e])return pi[e];if(!fi[e])return e;var t=fi[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in mi)return pi[e]=t[n];return e}var gi=hi(`animationend`),_i=hi(`animationiteration`),vi=hi(`animationstart`),yi=hi(`transitionrun`),bi=hi(`transitionstart`),xi=hi(`transitioncancel`),Si=hi(`transitionend`),Ci=new Map,wi=`abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error fullscreenChange fullscreenError gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel`.split(` `);wi.push(`scrollEnd`);function Ti(e,t){Ci.set(e,t),$t(t,[e])}var Ei=0;function Di(e,t){if(e.name!=null&&e.name!==`auto`)return e.name;if(t.autoName!==null)return t.autoName;e=Md.identifierPrefix;var n=Ei++;return e=`_`+e+`t_`+n.toString(32)+`_`,t.autoName=e}function Oi(e){if(e==null||typeof e==`string`)return e;var t=null,n=Bd;if(n!==null)for(var r=0;r<n.length;r++){var i=e[n[r]];if(i!=null){if(i===`none`)return`none`;t=t==null?i:t+(` `+i)}}return t??e.default}function ki(e,t){return e=Oi(e),t=Oi(t),t==null?e===`auto`?null:e:t===`auto`?null:t}var Ai=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)},ji=[],Mi=0,Ni=0;function Pi(){for(var e=Mi,t=Ni=Mi=0;t<e;){var n=ji[t];ji[t++]=null;var r=ji[t];ji[t++]=null;var i=ji[t];ji[t++]=null;var a=ji[t];if(ji[t++]=null,r!==null&&i!==null){var o=r.pending;o===null?i.next=i:(i.next=o.next,o.next=i),r.pending=i}a!==0&&Ri(n,i,a)}}function Fi(e,t,n,r){ji[Mi++]=e,ji[Mi++]=t,ji[Mi++]=n,ji[Mi++]=r,Ni|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function Ii(e,t,n,r){return Fi(e,t,n,r),zi(e)}function Li(e,t){return Fi(e,null,null,t),zi(e)}function Ri(e,t,n){e.lanes|=n;var r=e.alternate;r!==null&&(r.lanes|=n);for(var i=!1,a=e.return;a!==null;)a.childLanes|=n,r=a.alternate,r!==null&&(r.childLanes|=n),a.tag===22&&(e=a.stateNode,e===null||e._visibility&1||(i=!0)),e=a,a=a.return;return e.tag===3?(a=e.stateNode,i&&t!==null&&(i=31-dt(n),e=a.hiddenUpdates,r=e[i],r===null?e[i]=[t]:r.push(t),t.lane=n|536870912),a):null}function zi(e){if(50<Vd)throw Vd=0,Hd=null,Error(o(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Bi={};function Vi(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Hi(e,t,n,r){return new Vi(e,t,n,r)}function Ui(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Wi(e,t){var n=e.alternate;return n===null?(n=Hi(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&1206910976,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n.refCleanup=e.refCleanup,n}function Gi(e,t){e.flags&=1206910978;var n=e.alternate;return n===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=n.childLanes,e.lanes=n.lanes,e.child=n.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=n.memoizedProps,e.memoizedState=n.memoizedState,e.updateQueue=n.updateQueue,e.type=n.type,t=n.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function Ki(e,t,n,r,i,a){var s=0;if(r=e,typeof r==`function`)Ui(r)&&(s=1);else if(typeof r==`string`)s=Ym(e,n,Ne.current)?26:e===`html`||e===`head`||e===`body`?27:5;else a:switch(r){case _e:return e=Hi(31,n,t,i),e.elementType=_e,e.lanes=a,e;case se:return qi(n.children,i,a,t);case ce:s=8,i|=24;break;case le:return e=Hi(12,n,t,i|2),e.elementType=le,e.lanes=a,e;case pe:return e=Hi(13,n,t,i),e.elementType=pe,e.lanes=a,e;case me:return e=Hi(19,n,t,i),e.elementType=me,e.lanes=a,e;case ve:case be:return e=i|32,e=Hi(30,n,t,e),e.elementType=be,e.lanes=a,e.stateNode={autoName:null,paired:null,clones:null,ref:null},e;default:if(typeof r==`object`&&r)switch(r.$$typeof){case de:s=10;break a;case ue:s=9;break a;case fe:s=11;break a;case he:s=14;break a;case ge:s=16,r=null;break a}s=29,n=Error(o(130,e===null?`null`:typeof e,``)),r=null}return t=Hi(s,n,t,i),t.elementType=e,t.type=r,t.lanes=a,t}function qi(e,t,n,r){return e=Hi(7,e,r,t),e.lanes=n,e}function Ji(e,t,n){return e=Hi(6,e,null,t),e.lanes=n,e}function Yi(e){var t=Hi(18,null,null,0);return t.stateNode=e,t}function Xi(e,t,n){return t=Hi(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var Zi=new WeakMap;function Qi(e,t){if(typeof e==`object`&&e){var n=Zi.get(e);return n===void 0?(t={value:e,source:t,stack:qe(t)},Zi.set(e,t),t):n}return{value:e,source:t,stack:qe(t)}}var $i=[],ea=0,ta=null,na=0,ra=[],ia=0,aa=null,oa=1,sa=``;function ca(e,t){$i[ea++]=na,$i[ea++]=ta,ta=e,na=t}function la(e,t,n){ra[ia++]=oa,ra[ia++]=sa,ra[ia++]=aa,aa=e;var r=oa;e=sa;var i=32-dt(r)-1;r&=~(1<<i),n+=1;var a=32-dt(t)+i;if(30<a){var o=i-i%5;a=(r&(1<<o)-1).toString(32),r>>=o,i-=o,oa=1<<32-dt(t)+i|n<<i|r,sa=a+e}else oa=1<<a|n<<i|r,sa=e}function ua(e){e.return!==null&&(ca(e,1),la(e,1,0))}function A(e){for(;e===ta;)ta=$i[--ea],$i[ea]=null,na=$i[--ea],$i[ea]=null;for(;e===aa;)aa=ra[--ia],ra[ia]=null,sa=ra[--ia],ra[ia]=null,oa=ra[--ia],ra[ia]=null}function da(e,t){ra[ia++]=oa,ra[ia++]=sa,ra[ia++]=aa,oa=t.id,sa=t.overflow,aa=e}var fa=null,pa=null,j=!1,ma=null,ha=!1,ga=Error(o(519));function _a(e){throw Ca(Qi(Error(o(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?`text`:`HTML`,``)),e)),ga}function va(e){var t=e.stateNode,n=e.type,r=e.memoizedProps;switch(t[Ft]=e,t[It]=r,n){case`dialog`:z(`cancel`,t),z(`close`,t);break;case`iframe`:case`object`:case`embed`:z(`load`,t);break;case`video`:case`audio`:for(n=0;n<Qf.length;n++)z(Qf[n],t);break;case`source`:z(`error`,t);break;case`img`:case`image`:case`link`:z(`error`,t),z(`load`,t);break;case`details`:z(`toggle`,t);break;case`input`:z(`invalid`,t),_n(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case`select`:z(`invalid`,t);break;case`textarea`:z(`invalid`,t),xn(t,r.value,r.defaultValue,r.children)}n=r.children,typeof n!=`string`&&typeof n!=`number`&&typeof n!=`bigint`||t.textContent===``+n||!0===r.suppressHydrationWarning||fp(t.textContent,n)?(r.popover!=null&&(z(`beforetoggle`,t),z(`toggle`,t)),r.onScroll!=null&&z(`scroll`,t),r.onScrollEnd!=null&&z(`scrollend`,t),r.onClick!=null&&(t.onclick=An),t=!0):t=!1,t||_a(e,!0)}function ya(e){for(fa=e.return;fa;)switch(fa.tag){case 5:case 31:case 13:ha=!1;return;case 27:case 3:ha=!0;return;default:fa=fa.return}}function ba(e){if(e!==fa)return!1;if(!j)return ya(e),j=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=n===`form`||n===`button`||Ep(e.type,e.memoizedProps)),n=!n),n&&pa&&_a(e),ya(e),t===13){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(o(317));pa=pm(e)}else if(t===31){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(o(317));pa=pm(e)}else t===27?(t=pa,V(e.type)?(e=fm,fm=null,pa=e):pa=t):pa=fa?dm(e.stateNode.nextSibling):null;return!0}function xa(){pa=fa=null,j=!1}function Sa(){var e=ma;return e!==null&&(wd===null?wd=e:wd.push.apply(wd,e),ma=null),e}function Ca(e){ma===null?ma=[e]:ma.push(e)}var wa=Ae(null),Ta=null,Ea=null;function Da(e,t,n){Me(wa,t._currentValue),t._currentValue=n}function Oa(e){e._currentValue=wa.current,je(wa)}function ka(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)===t?r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t):(e.childLanes|=t,r!==null&&(r.childLanes|=t)),e===n)break;e=e.return}}function Aa(e,t,n,r){var i=e.child;for(i!==null&&(i.return=e);i!==null;){var a=i.dependencies;if(a!==null){var s=i.child;a=a.firstContext;a:for(;a!==null;){var c=a;a=i;for(var l=0;l<t.length;l++)if(c.context===t[l]){a.lanes|=n,c=a.alternate,c!==null&&(c.lanes|=n),ka(a.return,n,e),r||(s=null);break a}a=c.next}}else if(i.tag===18){if(s=i.return,s===null)throw Error(o(341));s.lanes|=n,a=s.alternate,a!==null&&(a.lanes|=n),ka(s,n,e),s=null}else i.tag===13&&i.memoizedState!==null&&i.memoizedState.dehydrated===null?(i.lanes|=n,s=i.alternate,s!==null&&(s.lanes|=n),ka(i.return,n,e),s=i.child,s=s===null?null:s.sibling):s=i.child;if(s!==null)s.return=i;else for(s=i;s!==null;){if(s===e){s=null;break}if(i=s.sibling,i!==null){i.return=s.return,s=i;break}s=s.return}i=s}}function ja(e,t,n,r){e=null;for(var i=t,a=!1;i!==null;){if(!a){if(i.flags&524288)a=!0;else if(i.flags&262144)break}if(i.tag===10){var s=i.alternate;if(s===null)throw Error(o(387));if(s=s.memoizedProps,s!==null){var c=i.type;Zr(i.pendingProps.value,s.value)||(e===null?e=[c]:e.push(c))}}else if(i===Ie.current){if(s=i.alternate,s===null)throw Error(o(387));s.memoizedState.memoizedState!==i.memoizedState.memoizedState&&(e===null?e=[lh]:e.push(lh))}i=i.return}return e!==null&&Aa(t,e,n,r),t.flags|=262144,e!==null}function Ma(e){for(e=e.firstContext;e!==null;){if(!Zr(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Na(e){Ta=e,Ea=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Pa(e){return Ia(Ta,e)}function Fa(e,t){return Ta===null&&Na(e),Ia(e,t)}function Ia(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},Ea===null){if(e===null)throw Error(o(308));Ea=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Ea=Ea.next=t;return n}var La=typeof AbortController<`u`?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(t,n){e.push(n)}};this.abort=function(){t.aborted=!0,e.forEach(function(e){return e()})}},Ra=t.unstable_scheduleCallback,za=t.unstable_NormalPriority,Ba={$$typeof:de,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Va(){return{controller:new La,data:new Map,refCount:0}}function Ha(e){e.refCount--,e.refCount===0&&Ra(za,function(){e.controller.abort()})}function Ua(e,t){if(e.pendingLanes&4194048){var n=e.transitionTypes;for(n===null&&(n=e.transitionTypes=[]),e=0;e<t.length;e++){var r=t[e];n.indexOf(r)===-1&&n.push(r)}}}var M=null;function Wa(e){var t=e.transitionTypes;return e.transitionTypes=null,t}var Ga=null,Ka=0,qa=0,Ja=null;function Ya(e,t){if(Ga===null){var n=Ga=[];Ka=0,qa=qf(),Ja={status:`pending`,value:void 0,then:function(e){n.push(e)}}}return Ka++,t.then(Xa,Xa),t}function Xa(){if(--Ka===0&&(M=null,Ga!==null)){Ja!==null&&(Ja.status=`fulfilled`);var e=Ga;Ga=null,qa=0,Ja=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function Za(e,t){var n=[],r={status:`pending`,value:null,reason:null,then:function(e){n.push(e)}};return e.then(function(){r.status=`fulfilled`,r.value=t;for(var e=0;e<n.length;e++)(0,n[e])(t)},function(e){for(r.status=`rejected`,r.reason=e,e=0;e<n.length;e++)(0,n[e])(void 0)}),r}var Qa=w.S;w.S=function(e,t){if(Dd=$e(),typeof t==`object`&&t&&typeof t.then==`function`&&Ya(e,t),M!==null)for(var n=Nf;n!==null;)Ua(n,M),n=n.next;if(n=e.types,n!==null){for(var r=Nf;r!==null;)Ua(r,n),r=r.next;if(qa!==0){r=M,r===null&&(r=M=[]);for(var i=0;i<n.length;i++){var a=n[i];r.indexOf(a)===-1&&r.push(a)}}}Qa!==null&&Qa(e,t)};var $a=Ae(null);function eo(){var e=$a.current;return e===null?ud.pooledCache:e}function to(e,t){t===null?Me($a,$a.current):Me($a,t.pool)}function no(){var e=eo();return e===null?null:{parent:Ba._currentValue,pool:e}}var ro=Error(o(460)),io=Error(o(474)),ao=Error(o(542)),oo={then:function(){}};function so(e){return e=e.status,e===`fulfilled`||e===`rejected`}function co(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(An,An),t=n),t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,po(e),e===void 0&&!(`reason`in t)?Error(o(600)):e;default:if(typeof t.status==`string`)t.then(An,An);else{if(e=ud,e!==null&&100<e.shellSuspendCounter)throw Error(o(482));e=t,e.status=`pending`,e.then(function(e){if(t.status===`pending`){var n=t;n.status=`fulfilled`,n.value=e}},function(e){if(t.status===`pending`){var n=t;n.status=`rejected`,n.reason=e}})}switch(t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,po(e),e}throw uo=t,ro}}function lo(e){try{var t=e._init;return t(e._payload)}catch(e){throw typeof e==`object`&&e&&typeof e.then==`function`?(uo=e,ro):e}}var uo=null;function fo(){if(uo===null)throw Error(o(459));var e=uo;return uo=null,e}function po(e){if(e===ro||e===ao)throw Error(o(483))}var mo=null,ho=0;function go(e){var t=ho;return ho+=1,mo===null&&(mo=[]),co(mo,e,t)}function _o(e,t){t=t.props.ref,e.ref=t===void 0?null:t}function vo(e,t){throw t.$$typeof===ie?Error(o(525)):(e=Object.prototype.toString.call(t),Error(o(31,e===`[object Object]`?`object with keys {`+Object.keys(t).join(`, `)+`}`:e)))}function yo(e){function t(t,n){if(e){var r=t.deletions;r===null?(t.deletions=[n],t.flags|=16):r.push(n)}}function n(n,r){if(!e)return null;for(;r!==null;)t(n,r),r=r.sibling;return null}function r(e){for(var t=new Map;e!==null;)e.key===null?t.set(e.index,e):t.set(e.key,e),e=e.sibling;return t}function i(e,t){return e=Wi(e,t),e.index=0,e.sibling=null,e}function a(t,n,r){return t.index=r,e?(r=t.alternate,r===null?(t.flags|=134217730,n):(r=r.index,r<n?(t.flags|=2,n):r)):(t.flags|=1048576,n)}function s(t){return e&&t.alternate===null&&(t.flags|=134217730),t}function c(e,t,n,r){return t===null||t.tag!==6?(t=Ji(n,e.mode,r),t.return=e,t):(t=i(t,n),t.return=e,t)}function l(e,t,n,r){var a=n.type;return a===se?(e=d(e,t,n.props.children,r,n.key),_o(e,n),e):t!==null&&(t.elementType===a||typeof a==`object`&&a&&a.$$typeof===ge&&lo(a)===t.type)?(t=i(t,n.props),_o(t,n),t.return=e,t):(t=Ki(n.type,n.key,n.props,null,e.mode,r),_o(t,n),t.return=e,t)}function u(e,t,n,r){return t===null||t.tag!==4||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?(t=Xi(n,e.mode,r),t.return=e,t):(t=i(t,n.children||[]),t.return=e,t)}function d(e,t,n,r,a){return t===null||t.tag!==7?(t=qi(n,e.mode,r,a),t.return=e,t):(t=i(t,n),t.return=e,t)}function f(e,t,n){if(typeof t==`string`&&t!==``||typeof t==`number`||typeof t==`bigint`)return t=Ji(``+t,e.mode,n),t.return=e,t;if(typeof t==`object`&&t){switch(t.$$typeof){case ae:return n=Ki(t.type,t.key,t.props,null,e.mode,n),_o(n,t),n.return=e,n;case oe:return t=Xi(t,e.mode,n),t.return=e,t;case ge:return t=lo(t),f(e,t,n)}if(Ee(t)||Ce(t))return t=qi(t,e.mode,n,null),t.return=e,t;if(typeof t.then==`function`)return f(e,go(t),n);if(t.$$typeof===de)return f(e,Fa(e,t),n);vo(e,t)}return null}function p(e,t,n,r){var i=t===null?null:t.key;if(typeof n==`string`&&n!==``||typeof n==`number`||typeof n==`bigint`)return i===null?c(e,t,``+n,r):null;if(typeof n==`object`&&n){switch(n.$$typeof){case ae:return n.key===i?l(e,t,n,r):null;case oe:return n.key===i?u(e,t,n,r):null;case ge:return n=lo(n),p(e,t,n,r)}if(Ee(n)||Ce(n))return i===null?d(e,t,n,r,null):null;if(typeof n.then==`function`)return p(e,t,go(n),r);if(n.$$typeof===de)return p(e,t,Fa(e,n),r);vo(e,n)}return null}function m(e,t,n,r,i){if(typeof r==`string`&&r!==``||typeof r==`number`||typeof r==`bigint`)return e=e.get(n)||null,c(t,e,``+r,i);if(typeof r==`object`&&r){switch(r.$$typeof){case ae:return e=e.get(r.key===null?n:r.key)||null,l(t,e,r,i);case oe:return e=e.get(r.key===null?n:r.key)||null,u(t,e,r,i);case ge:return r=lo(r),m(e,t,n,r,i)}if(Ee(r)||Ce(r))return e=e.get(n)||null,d(t,e,r,i,null);if(typeof r.then==`function`)return m(e,t,n,go(r),i);if(r.$$typeof===de)return m(e,t,n,Fa(t,r),i);vo(t,r)}return null}function h(i,o,s,c){for(var l=null,u=null,d=o,h=o=0,g=null;d!==null&&h<s.length;h++){d.index>h?(g=d,d=null):g=d.sibling;var _=p(i,d,s[h],c);if(_===null){d===null&&(d=g);break}e&&d&&_.alternate===null&&t(i,d),o=a(_,o,h),u===null?l=_:u.sibling=_,u=_,d=g}if(h===s.length)return n(i,d),j&&ca(i,h),l;if(d===null){for(;h<s.length;h++)d=f(i,s[h],c),d!==null&&(o=a(d,o,h),u===null?l=d:u.sibling=d,u=d);return j&&ca(i,h),l}for(d=r(d);h<s.length;h++)g=m(d,i,h,s[h],c),g!==null&&(e&&(_=g.alternate,_!==null&&d.delete(_.key===null?h:_.key)),o=a(g,o,h),u===null?l=g:u.sibling=g,u=g);return e&&d.forEach(function(e){return t(i,e)}),j&&ca(i,h),l}function g(i,s,c,l){if(c==null)throw Error(o(151));for(var u=null,d=null,h=s,g=s=0,_=null,v=c.next();h!==null&&!v.done;g++,v=c.next()){h.index>g?(_=h,h=null):_=h.sibling;var y=p(i,h,v.value,l);if(y===null){h===null&&(h=_);break}e&&h&&y.alternate===null&&t(i,h),s=a(y,s,g),d===null?u=y:d.sibling=y,d=y,h=_}if(v.done)return n(i,h),j&&ca(i,g),u;if(h===null){for(;!v.done;g++,v=c.next())v=f(i,v.value,l),v!==null&&(s=a(v,s,g),d===null?u=v:d.sibling=v,d=v);return j&&ca(i,g),u}for(h=r(h);!v.done;g++,v=c.next())v=m(h,i,g,v.value,l),v!==null&&(e&&(_=v.alternate,_!==null&&h.delete(_.key===null?g:_.key)),s=a(v,s,g),d===null?u=v:d.sibling=v,d=v);return e&&h.forEach(function(e){return t(i,e)}),j&&ca(i,g),u}function _(e,r,a,c){if(typeof a==`object`&&a&&a.type===se&&a.key===null&&a.props.ref===void 0&&(a=a.props.children),typeof a==`object`&&a){switch(a.$$typeof){case ae:a:{for(var l=a.key;r!==null;){if(r.key===l){if(l=a.type,l===se){if(r.tag===7){n(e,r.sibling),c=i(r,a.props.children),_o(c,a),c.return=e,e=c;break a}}else if(r.elementType===l||typeof l==`object`&&l&&l.$$typeof===ge&&lo(l)===r.type){n(e,r.sibling),c=i(r,a.props),_o(c,a),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}a.type===se?(c=qi(a.props.children,e.mode,c,a.key),_o(c,a),c.return=e,e=c):(c=Ki(a.type,a.key,a.props,null,e.mode,c),_o(c,a),c.return=e,e=c)}return s(e);case oe:a:{for(l=a.key;r!==null;){if(r.key===l){if(r.tag===4&&r.stateNode.containerInfo===a.containerInfo&&r.stateNode.implementation===a.implementation){n(e,r.sibling),c=i(r,a.children||[]),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}c=Xi(a,e.mode,c),c.return=e,e=c}return s(e);case ge:return a=lo(a),_(e,r,a,c)}if(Ee(a))return h(e,r,a,c);if(Ce(a)){if(l=Ce(a),typeof l!=`function`)throw Error(o(150));return a=l.call(a),g(e,r,a,c)}if(typeof a.then==`function`)return _(e,r,go(a),c);if(a.$$typeof===de)return _(e,r,Fa(e,a),c);vo(e,a)}return typeof a==`string`&&a!==``||typeof a==`number`||typeof a==`bigint`?(a=``+a,r!==null&&r.tag===6?(n(e,r.sibling),c=i(r,a),c.return=e,e=c):(n(e,r),c=Ji(a,e.mode,c),c.return=e,e=c),s(e)):n(e,r)}return function(e,t,n,r){try{ho=0;var i=_(e,t,n,r);return mo=null,i}catch(t){if(t===ro||t===ao)throw t;var a=Hi(29,t,null,e.mode);return a.lanes=r,a.return=e,a}}}var bo=yo(!0),xo=yo(!1),So=!1;function Co(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function N(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 wo(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function To(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,I&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=zi(e),Ri(e,null,n),t}return Fi(e,r,t,n),zi(e)}function Eo(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194048)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Ot(e,n)}}function Do(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,callbacks:r.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var Oo=!1;function ko(){if(Oo){var e=Ja;if(e!==null)throw e}}function Ao(e,t,n,r){Oo=!1;var i=e.updateQueue;So=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var f=s.lane&-536870913,p=f!==s.lane;if(p?(R&f)===f:(r&f)===f){f!==0&&f===qa&&(Oo=!0),u!==null&&(u=u.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});a:{var m=e,h=s;f=t;var g=n;switch(h.tag){case 1:if(m=h.payload,typeof m==`function`){d=m.call(g,d,f);break a}d=m;break a;case 3:m.flags=m.flags&-65537|128;case 0:if(m=h.payload,f=typeof m==`function`?m.call(g,d,f):m,f==null)break a;d=C({},d,f);break a;case 2:So=!0}}f=s.callback,f!==null&&(e.flags|=64,p&&(e.flags|=8192),p=i.callbacks,p===null?i.callbacks=[f]:p.push(f))}else p={lane:f,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=p,c=d):u=u.next=p,o|=f;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;p=s,s=p.next,p.next=null,i.lastBaseUpdate=p,i.shared.pending=null}}while(1);u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,a===null&&(i.shared.lanes=0),vd|=o,e.lanes=o,e.memoizedState=d}}function jo(e,t){if(typeof e!=`function`)throw Error(o(191,e));e.call(t)}function P(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)jo(n[e],t)}var Mo=Ae(null),No=Ae(0);function Po(e,t){e=gd,Me(No,e),Me(Mo,t),gd=e|t.baseLanes}function Fo(){Me(No,gd),Me(Mo,Mo.current)}function Io(){gd=No.current,je(Mo),je(No)}var Lo=Ae(null),Ro=null;function zo(e){var t=e.alternate;Me(Wo,Wo.current&1),Me(Lo,e),Ro===null&&(t===null||Mo.current!==null||t.memoizedState!==null)&&(Ro=e)}function Bo(e){Me(Wo,Wo.current),Me(Lo,e),Ro===null&&(Ro=e)}function Vo(e){e.tag===22?(Me(Wo,Wo.current),Me(Lo,e),Ro===null&&(Ro=e)):Ho()}function Ho(){Me(Wo,Wo.current),Me(Lo,Lo.current)}function Uo(e){je(Lo),Ro===e&&(Ro=null),je(Wo)}var Wo=Ae(0);function Go(e,t){Me(Lo,Lo.current),Me(Wo,t)}function Ko(e){je(Wo),je(Lo),Ro===e&&(Ro=null)}function qo(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||cm(n)||lm(n)))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==`independent`){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var Jo=0,F=null,Yo=null,Xo=null,Zo=!1,Qo=!1,$o=!1,es=0,ts=0,ns=null,rs=0;function is(){throw Error(o(321))}function as(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Zr(e[n],t[n]))return!1;return!0}function os(e,t,n,r,i,a){return Jo=a,F=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,w.H=e===null||e.memoizedState===null?Cc:wc,$o=!1,a=n(r,i),$o=!1,Qo&&(a=cs(t,n,r,i)),ss(e),a}function ss(e){w.H=Sc;var t=Yo!==null&&Yo.next!==null;if(Jo=0,Xo=Yo=F=null,Zo=!1,ts=0,ns=null,t)throw Error(o(300));e===null||Vc||(e=e.dependencies,e!==null&&Ma(e)&&(Vc=!0))}function cs(e,t,n,r){F=e;var i=0;do{if(Qo&&(ns=null),ts=0,Qo=!1,25<=i)throw Error(o(301));if(i+=1,Xo=Yo=null,e.updateQueue!=null){var a=e.updateQueue;a.lastEffect=null,a.events=null,a.stores=null,a.memoCache!=null&&(a.memoCache.index=0)}w.H=Tc,a=t(n,r)}while(Qo);return a}function ls(){var e=w.H,t=e.useState()[0];return t=typeof t.then==`function`?gs(t):t,e=e.useState()[0],(Yo===null?null:Yo.memoizedState)!==e&&(F.flags|=1024),t}function us(){var e=es!==0;return es=0,e}function ds(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function fs(e){if(Zo){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}Zo=!1}Jo=0,Xo=Yo=F=null,Qo=!1,ts=es=0,ns=null}function ps(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Xo===null?F.memoizedState=Xo=e:Xo=Xo.next=e,Xo}function ms(){if(Yo===null){var e=F.alternate;e=e===null?null:e.memoizedState}else e=Yo.next;var t=Xo===null?F.memoizedState:Xo.next;if(t!==null)Xo=t,Yo=e;else{if(e===null)throw F.alternate===null?Error(o(467)):Error(o(310));Yo=e,e={memoizedState:Yo.memoizedState,baseState:Yo.baseState,baseQueue:Yo.baseQueue,queue:Yo.queue,next:null},Xo===null?F.memoizedState=Xo=e:Xo=Xo.next=e}return Xo}function hs(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function gs(e){var t=ts;return ts+=1,ns===null&&(ns=[]),e=co(ns,e,t),t=F,(Xo===null?t.memoizedState:Xo.next)===null&&(t=t.alternate,w.H=t===null||t.memoizedState===null?Cc:wc),e}function _s(e){if(typeof e==`object`&&e){if(typeof e.then==`function`)return gs(e);if(e.$$typeof===xe)return;if(e.$$typeof===de)return Pa(e)}throw Error(o(438,String(e)))}function vs(e){var t=null,n=F.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var r=F.alternate;r!==null&&(r=r.updateQueue,r!==null&&(r=r.memoCache,r!=null&&(t={data:r.data.map(function(e){return e.slice()}),index:0})))}if(t??={data:[],index:0},n===null&&(n=hs(),F.updateQueue=n),n.memoCache=t,n=t.data[t.index],n===void 0)for(n=t.data[t.index]=Array(e),r=0;r<e;r++)n[r]=ye;return t.index++,n}function ys(e,t){return typeof t==`function`?t(e):t}function bs(e){return xs(ms(),Yo,e)}function xs(e,t,n){var r=e.queue;if(r===null)throw Error(o(311));r.lastRenderedReducer=n;var i=e.baseQueue,a=r.pending;if(a!==null){if(i!==null){var s=i.next;i.next=a.next,a.next=s}t.baseQueue=i=a,r.pending=null}if(a=e.baseState,i===null)e.memoizedState=a;else{t=i.next;var c=s=null,l=null,u=t,d=!1;do{var f=u.lane&-536870913;if(f===u.lane?(Jo&f)===f:(R&f)===f){var p=u.revertLane;if(p===0)l!==null&&(l=l.next={lane:0,revertLane:0,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),f===qa&&(d=!0);else if((Jo&p)===p){u=u.next,p===qa&&(d=!0);continue}else f={lane:0,revertLane:u.revertLane,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=f,s=a):l=l.next=f,F.lanes|=p,vd|=p;f=u.action,$o&&n(a,f),a=u.hasEagerState?u.eagerState:n(a,f)}else p={lane:f,revertLane:u.revertLane,gesture:u.gesture,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=p,s=a):l=l.next=p,F.lanes|=f,vd|=f;u=u.next}while(u!==null&&u!==t);if(l===null?s=a:l.next=c,!Zr(a,e.memoizedState)&&(Vc=!0,d&&(n=Ja,n!==null)))throw n;e.memoizedState=a,e.baseState=s,e.baseQueue=l,r.lastRenderedState=a}return i===null&&(r.lanes=0),[e.memoizedState,r.dispatch]}function Ss(e){var t=ms(),n=t.queue;if(n===null)throw Error(o(311));n.lastRenderedReducer=e;var r=n.dispatch,i=n.pending,a=t.memoizedState;if(i!==null){n.pending=null;var s=i=i.next;do a=e(a,s.action),s=s.next;while(s!==i);Zr(a,t.memoizedState)||(Vc=!0),t.memoizedState=a,t.baseQueue===null&&(t.baseState=a),n.lastRenderedState=a}return[a,r]}function Cs(e,t,n){var r=F,i=ms(),a=j;if(a){if(n===void 0)throw Error(o(407));n=n()}else n=t();var s=!Zr((Yo||i).memoizedState,n);if(s&&(i.memoizedState=n,Vc=!0),i=i.queue,Js(Es.bind(null,r,i,e),[e]),e=i.getSnapshot!==t||s||Xo!==null&&!!(Xo.memoizedState.tag&1),Us(e?9:8,{destroy:void 0},Ts.bind(null,r,i,n,t),null),e){if(r.flags|=2048,ud===null)throw Error(o(349));a||Jo&127||ws(r,t,n)}return n}function ws(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=F.updateQueue,t===null?(t=hs(),F.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function Ts(e,t,n,r){t.value=n,t.getSnapshot=r,Ds(t)&&Os(e)}function Es(e,t,n){return n(function(){Ds(t)&&Os(e)})}function Ds(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Zr(e,n)}catch{return!0}}function Os(e){var t=Li(e,2);t!==null&&Kd(t,e,2)}function ks(e){var t=ps();if(typeof e==`function`){var n=e;if(e=n(),$o){ut(!0);try{n()}finally{ut(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ys,lastRenderedState:e},t}function As(e,t,n,r){return e.baseState=n,xs(e,Yo,typeof r==`function`?r:ys)}function js(e,t,n,r,i){if(yc(e))throw Error(o(485));if(e=t.action,e!==null){var a={payload:i,action:e,next:null,isTransition:!0,status:`pending`,value:null,reason:null,listeners:[],then:function(e){a.listeners.push(e)}};w.T===null?a.isTransition=!1:n(!0),r(a),n=t.pending,n===null?(a.next=t.pending=a,Ms(t,a)):(a.next=n.next,t.pending=n.next=a)}}function Ms(e,t){var n=t.action,r=t.payload,i=e.state;if(t.isTransition){var a=w.T,o={};o.types=a===null?null:a.types,w.T=o;try{var s=n(i,r),c=w.S;c!==null&&c(o,s),Ns(e,t,s)}catch(n){Fs(e,t,n)}finally{a!==null&&o.types!==null&&(a.types=o.types),w.T=a}}else try{a=n(i,r),Ns(e,t,a)}catch(n){Fs(e,t,n)}}function Ns(e,t,n){typeof n==`object`&&n&&typeof n.then==`function`?n.then(function(n){Ps(e,t,n)},function(n){return Fs(e,t,n)}):Ps(e,t,n)}function Ps(e,t,n){t.status=`fulfilled`,t.value=n,Is(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,Ms(e,n)))}function Fs(e,t,n){var r=e.pending;if(e.pending=null,r!==null){r=r.next;do t.status=`rejected`,t.reason=n,Is(t),t=t.next;while(t!==r)}e.action=null}function Is(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Ls(e,t){return t}function Rs(e,t){if(j){var n=ud.formState;if(n!==null){a:{var r=F;if(j){if(pa){b:{for(var i=pa,a=ha;i.nodeType!==8;){if(!a){i=null;break b}if(i=dm(i.nextSibling),i===null){i=null;break b}}a=i.data,i=a===`F!`||a===`F`?i:null}if(i){pa=dm(i.nextSibling),r=i.data===`F!`;break a}}_a(r)}r=!1}r&&(t=n[0])}}return n=ps(),n.memoizedState=n.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ls,lastRenderedState:t},n.queue=r,n=gc.bind(null,F,r),r.dispatch=n,r=ks(!1),a=vc.bind(null,F,!1,r.queue),r=ps(),i={state:t,dispatch:null,action:e,pending:null},r.queue=i,n=js.bind(null,F,i,a,n),i.dispatch=n,r.memoizedState=e,[t,n,!1]}function zs(e){return Bs(ms(),Yo,e)}function Bs(e,t,n){if(t=xs(e,t,Ls)[0],e=bs(ys)[0],typeof t==`object`&&t&&typeof t.then==`function`)try{var r=gs(t)}catch(e){throw e===ro?ao:e}else r=t;t=ms();var i=t.queue,a=i.dispatch;return n!==t.memoizedState&&(F.flags|=2048,Us(9,{destroy:void 0},Vs.bind(null,i,n),null)),[r,a,e]}function Vs(e,t){e.action=t}function Hs(e){var t=ms(),n=Yo;if(n!==null)return Bs(t,n,e);ms(),t=t.memoizedState,n=ms();var r=n.queue.dispatch;return n.memoizedState=e,[t,r,!1]}function Us(e,t,n,r){return e={tag:e,create:n,deps:r,inst:t,next:null},t=F.updateQueue,t===null&&(t=hs(),F.updateQueue=t),n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e),e}function Ws(){return ms().memoizedState}function Gs(e,t,n,r){var i=ps();F.flags|=e,i.memoizedState=Us(1|t,{destroy:void 0},n,r===void 0?null:r)}function Ks(e,t,n,r){var i=ms();r=r===void 0?null:r;var a=i.memoizedState.inst;Yo!==null&&r!==null&&as(r,Yo.memoizedState.deps)?i.memoizedState=Us(t,a,n,r):(F.flags|=e,i.memoizedState=Us(1|t,a,n,r))}function qs(e,t){Gs(8390656,8,e,t)}function Js(e,t){Ks(2048,8,e,t)}function Ys(e){F.flags|=4;var t=F.updateQueue;if(t===null)t=hs(),F.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function Xs(e){var t=ms().memoizedState;return Ys({ref:t,nextImpl:e}),function(){if(I&2)throw Error(o(440));return t.impl.apply(void 0,arguments)}}function Zs(e,t){return Ks(4,2,e,t)}function Qs(e,t){return Ks(4,4,e,t)}function $s(e,t){if(typeof t==`function`){e=e();var n=t(e);return function(){typeof n==`function`?n():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function ec(e,t,n){n=n==null?null:n.concat([e]),Ks(4,4,$s.bind(null,t,e),n)}function tc(){}function nc(e,t){var n=ms();t=t===void 0?null:t;var r=n.memoizedState;return t!==null&&as(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function rc(e,t){var n=ms();t=t===void 0?null:t;var r=n.memoizedState;if(t!==null&&as(t,r[1]))return r[0];if(r=e(),$o){ut(!0);try{e()}finally{ut(!1)}}return n.memoizedState=[r,t],r}function ic(e,t,n){return n===void 0||Jo&1073741824&&!(R&261930)?e.memoizedState=t:(e.memoizedState=n,e=Wd(),F.lanes|=e,vd|=e,n)}function ac(e,t,n,r){return Zr(n,t)?n:Mo.current===null?!(Jo&106)||Jo&1073741824&&!(R&261930)?(Vc=!0,e.memoizedState=n):(e=Wd(),F.lanes|=e,vd|=e,t):(e=ic(e,n,r),Zr(e,t)||(Vc=!0),e)}function oc(e,t,n,r,i){var a=T.p;T.p=a!==0&&8>a?a:8;var o=w.T,s={};s.types=o===null?null:o.types,w.T=s,vc(e,!1,t,n);try{var c=i(),l=w.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?_c(e,t,Za(c,r),Ud(e)):_c(e,t,r,Ud(e))}catch(n){_c(e,t,{then:function(){},status:`rejected`,reason:n},Ud())}finally{T.p=a,o!==null&&s.types!==null&&(o.types=s.types),w.T=o}}function sc(){}function cc(e,t,n,r){if(e.tag!==5)throw Error(o(476));var i=lc(e).queue;oc(e,i,t,De,n===null?sc:function(){return uc(e),n(r)})}function lc(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:De,baseState:De,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ys,lastRenderedState:De},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ys,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function uc(e){var t=lc(e);t.next===null&&(t=e.alternate.memoizedState),_c(e,t.next.queue,{},Ud())}function dc(){return Pa(lh)}function fc(){return ms().memoizedState}function pc(){return ms().memoizedState}function mc(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=Ud();e=wo(n);var r=To(t,e,n);r!==null&&(Kd(r,t,n),Eo(r,t,n)),t={cache:Va()},e.payload=t;return}t=t.return}}function hc(e,t,n){var r=Ud();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},yc(e)?bc(t,n):(n=Ii(e,t,n,r),n!==null&&(Kd(n,e,r),xc(n,t,r)))}function gc(e,t,n){_c(e,t,n,Ud())}function _c(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(yc(e))bc(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,Zr(s,o))return Fi(e,t,i,0),ud===null&&Pi(),!1}catch{}if(n=Ii(e,t,i,r),n!==null)return Kd(n,e,r),xc(n,t,r),!0}return!1}function vc(e,t,n,r){if(r={lane:2,revertLane:qf(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},yc(e)){if(t)throw Error(o(479))}else t=Ii(e,n,r,2),t!==null&&Kd(t,e,2)}function yc(e){var t=e.alternate;return e===F||t!==null&&t===F}function bc(e,t){Qo=Zo=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function xc(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Ot(e,n)}}var Sc={readContext:Pa,use:_s,useCallback:is,useContext:is,useEffect:is,useImperativeHandle:is,useLayoutEffect:is,useInsertionEffect:is,useMemo:is,useReducer:is,useRef:is,useState:is,useDebugValue:is,useDeferredValue:is,useTransition:is,useSyncExternalStore:is,useId:is,useHostTransitionStatus:is,useFormState:is,useActionState:is,useOptimistic:is,useMemoCache:is,useCacheRefresh:is,useEffectEvent:is},Cc={readContext:Pa,use:_s,useCallback:function(e,t){return ps().memoizedState=[e,t===void 0?null:t],e},useContext:Pa,useEffect:qs,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),Gs(4194308,4,$s.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Gs(4194308,4,e,t)},useInsertionEffect:function(e,t){Gs(4,2,e,t)},useMemo:function(e,t){var n=ps();t=t===void 0?null:t;var r=e();if($o){ut(!0);try{e()}finally{ut(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=ps();if(n!==void 0){var i=n(t);if($o){ut(!0);try{n(t)}finally{ut(!1)}}}else i=t;return r.memoizedState=r.baseState=i,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:i},r.queue=e,e=e.dispatch=hc.bind(null,F,e),[r.memoizedState,e]},useRef:function(e){var t=ps();return e={current:e},t.memoizedState=e},useState:function(e){e=ks(e);var t=e.queue,n=gc.bind(null,F,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:tc,useDeferredValue:function(e,t){return ic(ps(),e,t)},useTransition:function(){var e=ks(!1);return e=oc.bind(null,F,e.queue,!0,!1),ps().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=F,i=ps();if(j){if(n===void 0)throw Error(o(407));n=n()}else{if(n=t(),ud===null)throw Error(o(349));R&127||ws(r,t,n)}i.memoizedState=n;var a={value:n,getSnapshot:t};return i.queue=a,qs(Es.bind(null,r,a,e),[e]),r.flags|=2048,Us(9,{destroy:void 0},Ts.bind(null,r,a,n,t),null),n},useId:function(){var e=ps(),t=ud.identifierPrefix;if(j){var n=sa,r=oa;n=(r&~(1<<32-dt(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=es++,0<n&&(t+=`H`+n.toString(32)),t+=`_`}else n=rs++,t=`_`+t+`r_`+n.toString(32)+`_`;return e.memoizedState=t},useHostTransitionStatus:dc,useFormState:Rs,useActionState:Rs,useOptimistic:function(e){var t=ps();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=vc.bind(null,F,!0,n),n.dispatch=t,[e,t]},useMemoCache:vs,useCacheRefresh:function(){return ps().memoizedState=mc.bind(null,F)},useEffectEvent:function(e){var t=ps(),n={impl:e};return t.memoizedState=n,function(){if(I&2)throw Error(o(440));return n.impl.apply(void 0,arguments)}}},wc={readContext:Pa,use:_s,useCallback:nc,useContext:Pa,useEffect:Js,useImperativeHandle:ec,useInsertionEffect:Zs,useLayoutEffect:Qs,useMemo:rc,useReducer:bs,useRef:Ws,useState:function(){return bs(ys)},useDebugValue:tc,useDeferredValue:function(e,t){return ac(ms(),Yo.memoizedState,e,t)},useTransition:function(){var e=bs(ys)[0],t=ms().memoizedState;return[typeof e==`boolean`?e:gs(e),t]},useSyncExternalStore:Cs,useId:fc,useHostTransitionStatus:dc,useFormState:zs,useActionState:zs,useOptimistic:function(e,t){return As(ms(),Yo,e,t)},useMemoCache:vs,useCacheRefresh:pc,useEffectEvent:Xs},Tc={readContext:Pa,use:_s,useCallback:nc,useContext:Pa,useEffect:Js,useImperativeHandle:ec,useInsertionEffect:Zs,useLayoutEffect:Qs,useMemo:rc,useReducer:Ss,useRef:Ws,useState:function(){return Ss(ys)},useDebugValue:tc,useDeferredValue:function(e,t){var n=ms();return Yo===null?ic(n,e,t):ac(n,Yo.memoizedState,e,t)},useTransition:function(){var e=Ss(ys)[0],t=ms().memoizedState;return[typeof e==`boolean`?e:gs(e),t]},useSyncExternalStore:Cs,useId:fc,useHostTransitionStatus:dc,useFormState:Hs,useActionState:Hs,useOptimistic:function(e,t){var n=ms();return Yo===null?(n.baseState=e,[e,n.queue.dispatch]):As(n,Yo,e,t)},useMemoCache:vs,useCacheRefresh:pc,useEffectEvent:Xs};function Ec(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:C({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Dc={enqueueSetState:function(e,t,n){e=e._reactInternals;var r=Ud(),i=wo(r);i.payload=t,n!=null&&(i.callback=n),t=To(e,i,r),t!==null&&(Kd(t,e,r),Eo(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=Ud(),i=wo(r);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=To(e,i,r),t!==null&&(Kd(t,e,r),Eo(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Ud(),r=wo(n);r.tag=2,t!=null&&(r.callback=t),t=To(e,r,n),t!==null&&(Kd(t,e,n),Eo(t,e,n))}};function Oc(e,t,n,r,i,a,o){return e=e.stateNode,typeof e.shouldComponentUpdate==`function`?e.shouldComponentUpdate(r,a,o):t.prototype&&t.prototype.isPureReactComponent?!Qr(n,r)||!Qr(i,a):!0}function kc(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps==`function`&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps==`function`&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&Dc.enqueueReplaceState(t,t.state,null)}function Ac(e,t){var n=t;if(`ref`in t)for(var r in n={},t)r!==`ref`&&(n[r]=t[r]);if(e=e.defaultProps)for(var i in n===t&&(n=C({},n)),e)n[i]===void 0&&(n[i]=e[i]);return n}function jc(e){Ai(e)}function Mc(e){console.error(e)}function Nc(e){Ai(e)}function Pc(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(e){setTimeout(function(){throw e})}}function Fc(e,t,n){try{var r=e.onCaughtError;r(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(e){setTimeout(function(){throw e})}}function Ic(e,t,n){return n=wo(n),n.tag=3,n.payload={element:null},n.callback=function(){Pc(e,t)},n}function Lc(e){return e=wo(e),e.tag=3,e}function Rc(e,t,n,r){var i=n.type.getDerivedStateFromError;if(typeof i==`function`){var a=r.value;e.payload=function(){return i(a)},e.callback=function(){Fc(t,n,r)}}var o=n.stateNode;o!==null&&typeof o.componentDidCatch==`function`&&(e.callback=function(){Fc(t,n,r),typeof i!=`function`&&(Ad===null?Ad=new Set([this]):Ad.add(this));var e=r.stack;this.componentDidCatch(r.value,{componentStack:e===null?``:e})})}function zc(e,t,n,r,i){if(n.flags|=32768,typeof r==`object`&&r&&typeof r.then==`function`){if(t=n.alternate,t!==null&&ja(t,n,i,!0),n=Lo.current,n!==null){switch(n.tag){case 31:case 13:case 19:return Ro===null?af():n.alternate===null&&_d===0&&(_d=3),n.flags&=-257,n.flags|=65536,n.lanes=i,r===oo?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([r]):t.add(r),Df(e,r,i)),!1;case 22:return n.flags|=65536,r===oo?n.flags|=16384:(t=n.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([r])},n.updateQueue=t):(n=t.retryQueue,n===null?t.retryQueue=new Set([r]):n.add(r)),Df(e,r,i)),!1}throw Error(o(435,n.tag))}return Df(e,r,i),af(),!1}if(j)return t=Lo.current,t===null?(r!==ga&&(t=Error(o(423),{cause:r}),Ca(Qi(t,n))),e=e.current.alternate,e.flags|=65536,i&=-i,e.lanes|=i,r=Qi(r,n),i=Ic(e.stateNode,r,i),Do(e,i),_d!==4&&(_d=2)):(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=i,r!==ga&&(e=Error(o(422),{cause:r}),Ca(Qi(e,n)))),!1;var a=Error(o(520),{cause:r});if(a=Qi(a,n),Cd===null?Cd=[a]:Cd.push(a),_d!==4&&(_d=2),t===null)return!0;r=Qi(r,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=i&-i,n.lanes|=e,e=Ic(n.stateNode,r,e),Do(n,e),!1;case 1:if(t=n.type,a=n.stateNode,!(n.flags&128)&&(typeof t.getDerivedStateFromError==`function`||a!==null&&typeof a.componentDidCatch==`function`&&(Ad===null||!Ad.has(a))))return n.flags|=65536,i&=-i,n.lanes|=i,i=Lc(i),Rc(i,e,n,r),Do(n,i),!1;break;case 22:if(n.memoizedState!==null)return n.flags|=65536,!1}n=n.return}while(n!==null);return!1}var Bc=Error(o(461)),Vc=!1;function Hc(e,t,n,r){t.child=e===null?xo(t,null,n,r):bo(t,e.child,n,r)}function Uc(e,t,n,r,i){n=n.render;var a=t.ref;if(`ref`in r){var o={};for(var s in r)s!==`ref`&&(o[s]=r[s])}else o=r;return Na(t),r=os(e,t,n,o,a,i),s=us(),e!==null&&!Vc?(ds(e,t,i),_l(e,t,i)):(j&&s&&ua(t),t.flags|=1,Hc(e,t,r,i),t.child)}function Wc(e,t,n,r,i){if(e===null){var a=n.type;return typeof a==`function`&&!Ui(a)&&a.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=a,Gc(e,t,a,r,i)):(e=Ki(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,!vl(e,i)){var o=a.memoizedProps;if(n=n.compare,n=n===null?Qr:n,n(o,r)&&e.ref===t.ref)return _l(e,t,i)}return t.flags|=1,e=Wi(a,r),e.ref=t.ref,e.return=t,t.child=e}function Gc(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(Qr(a,r)&&e.ref===t.ref){if(Vc=!1,t.pendingProps=r=a,vl(e,i))e.flags&131072&&(Vc=!0);else return t.lanes=e.lanes,_l(e,t,i)}}return $c(e,t,n,r,i)}function Kc(e,t,n,r){var i=r.children,a=e===null?null:e.memoizedState;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.mode===`hidden`){if(t.flags&128){if(a=a===null?n:a.baseLanes|n,e!==null){for(r=t.child=e.child,i=0;r!==null;)i=i|r.lanes|r.childLanes,r=r.sibling;r=i&~a}else r=0,t.child=null;return Jc(e,t,a,n,r)}if(n&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&to(t,a===null?null:a.cachePool),a===null?Fo():Po(t,a),Vo(t);else return r=t.lanes=536870912,Jc(e,t,a===null?n:a.baseLanes|n,n,r)}else a===null?(e!==null&&to(t,null),Fo(),Ho()):(to(t,a.cachePool),Po(t,a),Ho(),t.memoizedState=null);return Hc(e,t,i,n),t.child}function qc(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function Jc(e,t,n,r,i){var a=eo();return a=a===null?null:{parent:Ba._currentValue,pool:a},t.memoizedState={baseLanes:n,cachePool:a},e!==null&&to(t,null),Fo(),Vo(t),e!==null&&ja(e,t,r,!0),t.childLanes=i,null}function Yc(e,t){return t=cl({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function Xc(e,t,n){return bo(t,e.child,null,n),e=Yc(t,t.pendingProps),e.flags|=2,Uo(t),t.memoizedState=null,e}function Zc(e,t,n){var r=t.pendingProps,i=!!(t.flags&128);if(t.flags&=-129,e===null){if(j){if(r.mode===`hidden`)return e=Yc(t,r),t.lanes=536870912,e.memoizedState={baseLanes:0,cachePool:null},qc(null,e);if(Bo(t),(e=pa)?(e=sm(e,ha),e=e!==null&&e.data===`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:aa===null?null:{id:oa,overflow:sa},retryLane:536870912,hydrationErrors:null},n=Yi(e),n.return=t,t.child=n,fa=t,pa=null)):e=null,e===null)throw _a(t);return t.lanes=536870912,null}return Yc(t,r)}var a=e.memoizedState;if(a!==null){var s=a.dehydrated;if(Bo(t),i){if(t.flags&256)t.flags&=-257,t=Xc(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(o(558))}else if(Vc||ja(e,t,n,!1),i=(n&e.childLanes)!==0,Vc||i){if(Mo.current===null){if(r=ud,r!==null&&(s=kt(r,n),s!==0&&s!==a.retryLane))throw a.retryLane=s,Li(e,s),Kd(r,e,s),Bc;af()}t=Xc(e,t,n)}else e=a.treeContext,pa=dm(s.nextSibling),fa=t,j=!0,ma=null,ha=!1,e!==null&&da(t,e),t=Yc(t,r),t.flags|=134221824;return t}return e=Wi(e.child,{mode:r.mode,children:r.children}),e.ref=t.ref,t.child=e,e.return=t,e}function Qc(e,t){var n=t.ref;if(n===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof n!=`function`&&typeof n!=`object`)throw Error(o(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function $c(e,t,n,r,i){return Na(t),n=os(e,t,n,r,void 0,i),r=us(),e!==null&&!Vc?(ds(e,t,i),_l(e,t,i)):(j&&r&&ua(t),t.flags|=1,Hc(e,t,n,i),t.child)}function el(e,t,n,r,i,a){return Na(t),t.updateQueue=null,n=cs(t,r,n,i),ss(e),r=us(),e!==null&&!Vc?(ds(e,t,a),_l(e,t,a)):(j&&r&&ua(t),t.flags|=1,Hc(e,t,n,a),t.child)}function tl(e,t,n,r,i){if(Na(t),t.stateNode===null){var a=Bi,o=n.contextType;typeof o==`object`&&o&&(a=Pa(o)),a=new n(r,a),t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,a.updater=Dc,t.stateNode=a,a._reactInternals=t,a=t.stateNode,a.props=r,a.state=t.memoizedState,a.refs={},Co(t),o=n.contextType,a.context=typeof o==`object`&&o?Pa(o):Bi,a.state=t.memoizedState,o=n.getDerivedStateFromProps,typeof o==`function`&&(Ec(t,n,o,r),a.state=t.memoizedState),typeof n.getDerivedStateFromProps==`function`||typeof a.getSnapshotBeforeUpdate==`function`||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(o=a.state,typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount(),o!==a.state&&Dc.enqueueReplaceState(a,a.state,null),Ao(t,r,a,i),ko(),a.state=t.memoizedState),typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!0}else if(e===null){a=t.stateNode;var s=t.memoizedProps,c=Ac(n,s);a.props=c;var l=a.context,u=n.contextType;o=Bi,typeof u==`object`&&u&&(o=Pa(u));var d=n.getDerivedStateFromProps;u=typeof d==`function`||typeof a.getSnapshotBeforeUpdate==`function`,s=t.pendingProps!==s,u||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(s||l!==o)&&kc(t,a,r,o),So=!1;var f=t.memoizedState;a.state=f,Ao(t,r,a,i),ko(),l=t.memoizedState,s||f!==l||So?(typeof d==`function`&&(Ec(t,n,d,r),l=t.memoizedState),(c=So||Oc(t,n,c,r,f,l,o))?(u||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount()),typeof a.componentDidMount==`function`&&(t.flags|=4194308)):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=l),a.props=r,a.state=l,a.context=o,r=c):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!1)}else{a=t.stateNode,N(e,t),o=t.memoizedProps,u=Ac(n,o),a.props=u,d=t.pendingProps,f=a.context,l=n.contextType,c=Bi,typeof l==`object`&&l&&(c=Pa(l)),s=n.getDerivedStateFromProps,(l=typeof s==`function`||typeof a.getSnapshotBeforeUpdate==`function`)||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(o!==d||f!==c)&&kc(t,a,r,c),So=!1,f=t.memoizedState,a.state=f,Ao(t,r,a,i),ko();var p=t.memoizedState;o!==d||f!==p||So||e!==null&&e.dependencies!==null&&Ma(e.dependencies)?(typeof s==`function`&&(Ec(t,n,s,r),p=t.memoizedState),(u=So||Oc(t,n,u,r,f,p,c)||e!==null&&e.dependencies!==null&&Ma(e.dependencies))?(l||typeof a.UNSAFE_componentWillUpdate!=`function`&&typeof a.componentWillUpdate!=`function`||(typeof a.componentWillUpdate==`function`&&a.componentWillUpdate(r,p,c),typeof a.UNSAFE_componentWillUpdate==`function`&&a.UNSAFE_componentWillUpdate(r,p,c)),typeof a.componentDidUpdate==`function`&&(t.flags|=4),typeof a.getSnapshotBeforeUpdate==`function`&&(t.flags|=1024)):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=p),a.props=r,a.state=p,a.context=c,r=u):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return a=r,Qc(e,t),r=!!(t.flags&128),a||r?(a=t.stateNode,n=r&&typeof n.getDerivedStateFromError!=`function`?null:a.render(),t.flags|=1,e!==null&&r?(t.child=bo(t,e.child,null,i),t.child=bo(t,null,n,i)):Hc(e,t,n,i),t.memoizedState=a.state,e=t.child):e=_l(e,t,i),e}function nl(e,t,n,r){return xa(),t.flags|=256,Hc(e,t,n,r),t.child}var rl={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function il(e){return{baseLanes:e,cachePool:no()}}function al(e,t,n){return e=e===null?0:e.childLanes&~n,t&&(e|=xd),e}function ol(e,t,n){var r=t.pendingProps,i=!1,a=!!(t.flags&128),o;if((o=a)||(o=e!==null&&e.memoizedState===null?!1:!!(Wo.current&2)),o&&(i=!0,t.flags&=-129),o=!!(t.flags&32),t.flags&=-33,e===null){if(j){if(i?zo(t):Ho(),(e=pa)?(e=sm(e,ha),e=e!==null&&e.data!==`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:aa===null?null:{id:oa,overflow:sa},retryLane:536870912,hydrationErrors:null},n=Yi(e),n.return=t,t.child=n,fa=t,pa=null)):e=null,e===null)throw _a(t);return t.lanes=lm(e)?32:536870912,null}return a=r.children,r=r.fallback,i?(Ho(),i=t.mode,a=cl({mode:`hidden`,children:a},i),r=qi(r,i,n,null),a.return=t,r.return=t,a.sibling=r,t.child=a,r=t.child,r.memoizedState=il(n),r.childLanes=al(e,o,n),t.memoizedState=rl,qc(null,r)):(zo(t),sl(t,a))}var s=e.memoizedState;if(s!==null){var c=s.dehydrated;if(c!==null)return ul(e,t,a,o,r,c,s,n)}return i?(Ho(),i=r.fallback,a=t.mode,s=e.child,c=s.sibling,r=Wi(s,{mode:`hidden`,children:r.children}),r.subtreeFlags=s.subtreeFlags&1206910976,c===null?(i=qi(i,a,n,null),i.flags|=2):i=Wi(c,i),i.return=t,r.return=t,r.sibling=i,t.child=r,qc(null,r),r=t.child,i=e.child.memoizedState,i===null?i=il(n):(a=i.cachePool,a===null?a=no():(s=Ba._currentValue,a=a.parent===s?a:{parent:s,pool:s}),i={baseLanes:i.baseLanes|n,cachePool:a}),r.memoizedState=i,r.childLanes=al(e,o,n),t.memoizedState=rl,qc(e.child,r)):(zo(t),n=e.child,e=n.sibling,n=Wi(n,{mode:`visible`,children:r.children}),n.return=t,n.sibling=null,e!==null&&(o=t.deletions,o===null?(t.deletions=[e],t.flags|=16):o.push(e)),t.child=n,t.memoizedState=null,n)}function sl(e,t){return t=cl({mode:`visible`,children:t},e.mode),t.return=e,e.child=t}function cl(e,t){return e=Hi(22,e,null,t),e.lanes=0,e}function ll(e,t,n){return bo(t,e.child,null,n),e=sl(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function ul(e,t,n,r,i,a,s,c){if(n)return t.flags&256?(zo(t),t.flags&=-257,ll(e,t,c)):t.memoizedState===null?(Ho(),a=i.fallback,s=t.mode,i=cl({mode:`visible`,children:i.children},s),a=qi(a,s,c,null),a.flags|=2,i.return=t,a.return=t,i.sibling=a,t.child=i,bo(t,e.child,null,c),i=t.child,i.memoizedState=il(c),i.childLanes=al(e,r,c),t.memoizedState=rl,qc(null,i)):(Ho(),t.child=e.child,t.flags|=128,null);if(zo(t),lm(a)){if(r=a.nextSibling&&a.nextSibling.dataset,r)var l=r.dgst;return r=l,r!==``&&(i=Error(o(419)),i.stack=``,i.digest=r,Ca({value:i,source:null,stack:null})),ll(e,t,c)}if(Vc||ja(e,t,c,!1),r=(c&e.childLanes)!==0,Vc||r){if(Mo.current!==null)return ll(e,t,c);if(r=ud,r!==null&&(i=kt(r,c),i!==0&&i!==s.retryLane))throw s.retryLane=i,Li(e,i),Kd(r,e,i),Bc;return cm(a)||af(),ll(e,t,c)}return cm(a)?(t.flags|=192,t.child=e.child,null):(e=s.treeContext,pa=dm(a.nextSibling),fa=t,j=!0,ma=null,ha=!1,e!==null&&da(t,e),t=sl(t,i.children),t.flags|=134221824,t)}function dl(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),ka(e.return,t,n)}function fl(e){for(var t=null;e!==null;){var n=e.alternate;n!==null&&qo(n)===null&&(t=e),e=e.sibling}return t}function pl(e,t,n,r,i,a){var o=e.memoizedState;o===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i,treeForkCount:a}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=r,o.tail=n,o.tailMode=i,o.treeForkCount=a)}function ml(e){var t=e.child;for(e.child=null;t!==null;){var n=t.sibling;t.sibling=e.child,e.child=t,t=n}}function hl(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;r=r.children;var o=Wo.current;if(t.flags&128)return Go(t,o),null;var s=!!(o&2);if(s?(o=o&1|2,t.flags|=128):o&=1,Go(t,o),i===`backwards`&&e!==null?(ml(e),Hc(e,t,r,n),ml(e)):Hc(e,t,r,n),r=j?na:0,!s&&e!==null&&e.flags&128)a:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&dl(e,n,t);else if(e.tag===19)dl(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break a;for(;e.sibling===null;){if(e.return===null||e.return===t)break a;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(i){case`backwards`:n=fl(t.child),n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null,ml(t)),pl(t,!0,i,null,a,r);break;case`unstable_legacy-backwards`:for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&qo(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}pl(t,!0,n,null,a,r);break;case`together`:pl(t,!1,null,null,void 0,r);break;case`independent`:t.memoizedState=null;break;default:n=fl(t.child),n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),pl(t,!1,i,n,a,r)}return t.child}function gl(e,t,n){var r=t.pendingProps;return Da(t,t.type,r.value),Hc(e,t,r.children,n),t.child}function _l(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),vd|=t.lanes,(n&t.childLanes)===0){if(e!==null){if(ja(e,t,n,!1),(n&t.childLanes)===0)return null}else return null}if(e!==null&&t.child!==e.child)throw Error(o(153));if(t.child!==null){for(e=t.child,n=Wi(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Wi(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function vl(e,t){return(e.lanes&t)!==0||(e=e.dependencies,!!(e!==null&&Ma(e)))}function yl(e,t,n){switch(t.tag){case 3:Le(t,t.stateNode.containerInfo),Da(t,Ba,e.memoizedState.cache),xa();break;case 27:case 5:ze(t);break;case 4:Le(t,t.stateNode.containerInfo);break;case 10:Da(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,Bo(t),null;break;case 13:var r=t.memoizedState;if(r!==null){if(r.dehydrated!==null)return zo(t),t.flags|=128,null;r=ja(e,t,n,!1);var i=t.child.childLanes;return r||(n&i)!==0?ol(e,t,n):(zo(t),e=_l(e,t,n),e===null?null:e.sibling)}zo(t);break;case 19:if(t.flags&128)return hl(e,t,n);if(i=!!(e.flags&128),r=(n&t.childLanes)!==0,r||=(ja(e,t,n,!1),(n&t.childLanes)!==0),i){if(r)return hl(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),Go(t,Wo.current),r)break;return null;case 22:return t.lanes=0,Kc(e,t,n,t.pendingProps);case 24:Da(t,Ba,e.memoizedState.cache)}return _l(e,t,n)}function bl(e,t,n){if(e!==null){if(e.memoizedProps!==t.pendingProps)Vc=!0;else{if(!vl(e,n)&&!(t.flags&128))return Vc=!1,yl(e,t,n);Vc=!!(e.flags&131072)}}else Vc=!1,j&&t.flags&1048576&&la(t,na,t.index);switch(t.lanes=0,t.tag){case 16:a:{var r=t.pendingProps;if(e=lo(t.elementType),t.type=e,typeof e==`function`)Ui(e)?(r=Ac(e,r),t.tag=1,t=tl(null,t,e,r,n)):(t.tag=0,t=$c(null,t,e,r,n));else{if(e!=null){var i=e.$$typeof;if(i===fe){t.tag=11,t=Uc(null,t,e,r,n);break a}if(i===he){t.tag=14,t=Wc(null,t,e,r,n);break a}if(i===de){t.tag=10,t.type=e,t=gl(null,t,n);break a}}throw t=Te(e)||e,Error(o(306,t,``))}}return t;case 0:return $c(e,t,t.type,t.pendingProps,n);case 1:return r=t.type,i=Ac(r,t.pendingProps),tl(e,t,r,i,n);case 3:a:{if(Le(t,t.stateNode.containerInfo),e===null)throw Error(o(387));r=t.pendingProps;var a=t.memoizedState;i=a.element,N(e,t),Ao(t,r,null,n);var s=t.memoizedState;if(r=s.cache,Da(t,Ba,r),r!==a.cache&&Aa(t,[Ba],n,!0),ko(),r=s.element,a.isDehydrated){if(a={element:r,isDehydrated:!1,cache:s.cache},t.updateQueue.baseState=a,t.memoizedState=a,t.flags&256){t=nl(e,t,r,n);break a}if(r!==i){i=Qi(Error(o(424)),t),Ca(i),t=nl(e,t,r,n);break a}switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName===`HTML`?e.ownerDocument.body:e}for(pa=dm(e.firstChild),fa=t,j=!0,ma=null,ha=!0,n=xo(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|134221824,n=n.sibling}else{if(xa(),r===i){t=_l(e,t,n);break a}Hc(e,t,r,n)}t=t.child}return t;case 26:return Qc(e,t),e===null?(n=Fm(t.type,null,t.pendingProps,null))?t.memoizedState=n:j||(t.stateNode=Tp(t.type,t.pendingProps,Fe.current,t)):t.memoizedState=Fm(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return ze(t),e===null&&j&&(r=t.stateNode=_m(t.type,t.pendingProps,Fe.current),fa=t,ha=!0,i=pa,V(t.type)?(fm=i,pa=dm(r.firstChild)):pa=i),Hc(e,t,t.pendingProps.children,n),Qc(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&j&&((i=r=pa)&&(r=Z(r,t.type,t.pendingProps,ha),r===null?i=!1:(t.stateNode=r,fa=t,pa=dm(r.firstChild),ha=!1,i=!0)),i||_a(t)),ze(t),i=t.type,a=t.pendingProps,s=e===null?null:e.memoizedProps,r=a.children,Ep(i,a)?r=null:s!==null&&Ep(i,s)&&(t.flags|=32),t.memoizedState!==null&&(i=os(e,t,ls,null,null,n),lh._currentValue=i),Qc(e,t),Hc(e,t,r,n),t.child;case 6:return e===null&&j&&((e=n=pa)&&(n=om(n,t.pendingProps,ha),n===null?e=!1:(t.stateNode=n,fa=t,pa=null,e=!0)),e||_a(t)),null;case 13:return ol(e,t,n);case 4:return Le(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=bo(t,null,r,n):Hc(e,t,r,n),t.child;case 11:return Uc(e,t,t.type,t.pendingProps,n);case 7:return r=t.pendingProps,Qc(e,t),Hc(e,t,r,n),t.child;case 8:return Hc(e,t,t.pendingProps.children,n),t.child;case 12:return Hc(e,t,t.pendingProps.children,n),t.child;case 10:return gl(e,t,n);case 9:return i=t.type._context,r=t.pendingProps.children,Na(t),i=Pa(i),r=r(i),t.flags|=1,Hc(e,t,r,n),t.child;case 14:return Wc(e,t,t.type,t.pendingProps,n);case 15:return Gc(e,t,t.type,t.pendingProps,n);case 19:return hl(e,t,n);case 31:return Zc(e,t,n);case 22:return Kc(e,t,n,t.pendingProps);case 24:return Na(t),r=Pa(Ba),e===null?(i=eo(),i===null&&(i=ud,a=Va(),i.pooledCache=a,a.refCount++,a!==null&&(i.pooledCacheLanes|=n),i=a),t.memoizedState={parent:r,cache:i},Co(t),Da(t,Ba,i)):((e.lanes&n)!==0&&(N(e,t),Ao(t,null,null,n),ko()),i=e.memoizedState,a=t.memoizedState,i.parent===r?(r=a.cache,Da(t,Ba,r),r!==i.cache&&Aa(t,[Ba],n,!0)):(i={parent:r,cache:r},t.memoizedState=i,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=i),Da(t,Ba,r))),Hc(e,t,t.pendingProps.children,n),t.child;case 30:return t.stateNode===null&&(t.stateNode={autoName:null,paired:null,clones:null,ref:null}),r=t.pendingProps,r.name!=null&&r.name!==`auto`?t.flags|=e===null?18882560:18874368:j&&ua(t),e!==null&&e.memoizedProps.name!==r.name?t.flags|=4194816:Qc(e,t),Hc(e,t,r.children,n),t.child;case 29:throw t.pendingProps}throw Error(o(156,t.tag))}function xl(e){e.flags|=4}function Sl(e,t,n,r,i){var a;if((a=!!(e.mode&32))&&(a=n===null?Xm(t,r):Xm(t,r)&&(r.src!==n.src||r.srcSet!==n.srcSet)),a){if(e.flags|=16777216,(i&335544128)===i){if(e.stateNode.complete)e.flags|=8192;else if(tf())e.flags|=8192;else throw uo=oo,io}}else e.flags&=-16777217}function Cl(e,t){if(t.type!==`stylesheet`||t.state.loading&4)e.flags&=-16777217;else if(e.flags|=16777216,!Zm(t)){if(tf())e.flags|=8192;else throw uo=oo,io}}function wl(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag===22?536870912:Ct(),e.lanes|=t,Sd|=t)}function Tl(e,t){if(!j)switch(e.tailMode){case`visible`:break;case`collapsed`:for(var n=e.tail,r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null;break;default:for(t=e.tail,n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null}}function El(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags&1206910976,r|=i.flags&1206910976,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function Dl(e,t,n){var r=t.pendingProps;switch(A(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return El(t),null;case 1:return El(t),null;case 3:return n=t.stateNode,r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),Oa(Ba),Re(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(ba(t)?xl(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Sa())),El(t),null;case 26:var i=t.type,a=t.memoizedState;return e===null?(xl(t),a===null?(El(t),Sl(t,i,null,r,n)):(El(t),Cl(t,a))):a?a===e.memoizedState?(El(t),t.flags&=-16777217):(xl(t),El(t),Cl(t,a)):(e=e.memoizedProps,e!==r&&xl(t),El(t),Sl(t,i,e,r,n)),null;case 27:if(Be(t),n=Fe.current,i=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&xl(t);else{if(!r){if(t.stateNode===null)throw Error(o(166));return El(t),t.subtreeFlags&=-33554433,null}e=Ne.current,ba(t)?va(t,e):(e=_m(i,r,n),t.stateNode=e,xl(t))}return El(t),t.subtreeFlags&=-33554433,null;case 5:if(Be(t),i=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&xl(t);else{if(!r){if(t.stateNode===null)throw Error(o(166));return El(t),t.subtreeFlags&=-33554433,null}if(a=Ne.current,ba(t))va(t,a);else{var s=Sp(Fe.current);switch(a){case 1:a=s.createElementNS(`http://www.w3.org/2000/svg`,i);break;case 2:a=s.createElementNS(`http://www.w3.org/1998/Math/MathML`,i);break;default:switch(i){case`svg`:a=s.createElementNS(`http://www.w3.org/2000/svg`,i);break;case`math`:a=s.createElementNS(`http://www.w3.org/1998/Math/MathML`,i);break;case`script`:a=s.createElement(`div`),a.innerHTML=`<script><\/script>`,a=a.removeChild(a.firstChild);break;case`select`:a=typeof r.is==`string`?s.createElement(`select`,{is:r.is}):s.createElement(`select`),r.multiple?a.multiple=!0:r.size&&(a.size=r.size);break;default:a=typeof r.is==`string`?s.createElement(i,{is:r.is}):s.createElement(i)}}a[Ft]=t,a[It]=r;a:for(s=t.child;s!==null;){if(s.tag===5||s.tag===6)a.appendChild(s.stateNode);else if(s.tag!==4&&s.tag!==27&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===t)break a;for(;s.sibling===null;){if(s.return===null||s.return===t)break a;s=s.return}s.sibling.return=s.return,s=s.sibling}t.stateNode=a;a:switch(hp(a,i,r),i){case`button`:case`input`:case`select`:case`textarea`:r=!!r.autoFocus;break a;case`img`:r=!0;break a;default:r=!1}r&&xl(t)}}return El(t),t.subtreeFlags&=-33554433,Sl(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&xl(t);else{if(typeof r!=`string`&&t.stateNode===null)throw Error(o(166));if(e=Fe.current,ba(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,i=fa,i!==null)switch(i.tag){case 27:case 5:r=i.memoizedProps}e[Ft]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||fp(e.nodeValue,n)),e||_a(t,!0)}else e=Sp(e).createTextNode(r),e[Ft]=t,t.stateNode=e}return El(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=ba(t),n!==null){if(e===null){if(!r)throw Error(o(318));if(e=t.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(o(557));e[Ft]=t}else xa(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;El(t),e=!1}else n=Sa(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(Uo(t),t):(Uo(t),null);if(t.flags&128)throw Error(o(558))}return El(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(i=ba(t),r!==null&&r.dehydrated!==null){if(e===null){if(!i)throw Error(o(318));if(i=t.memoizedState,i=i===null?null:i.dehydrated,!i)throw Error(o(317));i[Ft]=t}else xa(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;El(t),i=!1}else i=Sa(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=i),i=!0;if(!i)return t.flags&256?(Uo(t),t):(Uo(t),null)}return Uo(t),t.flags&128?(t.lanes=n,t):(n=r!==null,e=e!==null&&e.memoizedState!==null,n&&(r=t.child,i=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(i=r.alternate.memoizedState.cachePool.pool),a=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(a=r.memoizedState.cachePool.pool),a!==i&&(r.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),wl(t,t.updateQueue),El(t),null);case 4:return Re(),e===null&&rp(t.stateNode.containerInfo),t.flags|=67108864,El(t),null;case 10:return Oa(t.type),El(t),null;case 19:if(Ko(t),r=t.memoizedState,r===null)return El(t),null;if(i=!!(t.flags&128),a=r.rendering,a===null){if(i)Tl(r,!1);else{if(_d!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(a=qo(e),a!==null){for(t.flags|=128,Tl(r,!1),e=a.updateQueue,t.updateQueue=e,wl(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)Gi(n,e),n=n.sibling;return Go(t,Wo.current&1|2),j&&ca(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&$e()>Od&&(t.flags|=128,i=!0,Tl(r,!1),t.lanes=4194304)}}else{if(!i){if(e=qo(a),e!==null){if(t.flags|=128,i=!0,e=e.updateQueue,t.updateQueue=e,wl(t,e),Tl(r,!0),r.tail===null&&r.tailMode!==`collapsed`&&r.tailMode!==`visible`&&!a.alternate&&!j)return El(t),null}else 2*$e()-r.renderingStartTime>Od&&n!==536870912&&(t.flags|=128,i=!0,Tl(r,!1),t.lanes=4194304)}r.isBackwards?(a.sibling=t.child,t.child=a):(e=r.last,e===null?t.child=a:e.sibling=a,r.last=a)}if(r.tail!==null){e=r.tail;a:{for(n=e;n!==null;){if(n.alternate!==null){n=!1;break a}n=n.sibling}n=!0}return r.rendering=e,r.tail=e.sibling,r.renderingStartTime=$e(),e.sibling=null,a=Wo.current,a=i?a&1|2:a&1,r.tailMode===`visible`||r.tailMode===`collapsed`||!n||j?Go(t,a):(n=a,Me(Lo,t),Me(Wo,n),Ro===null&&(Ro=t)),j&&ca(t,r.treeForkCount),e}return El(t),null;case 22:case 23:return Uo(t),Io(),r=t.memoizedState!==null,e===null?r&&(t.flags|=8192):e.memoizedState!==null!==r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(El(t),t.subtreeFlags&6&&(t.flags|=8192)):El(t),n=t.updateQueue,n!==null&&wl(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),r=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),r!==n&&(t.flags|=2048),e!==null&&je($a),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Oa(Ba),El(t),null;case 25:return null;case 30:return t.flags|=33554432,El(t),null}throw Error(o(156,t.tag))}function Ol(e,t){switch(A(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Oa(Ba),Re(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return Be(t),null;case 31:if(t.memoizedState!==null){if(Uo(t),t.alternate===null)throw Error(o(340));xa()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(Uo(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(o(340));xa()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Ko(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 Re(),null;case 10:return Oa(t.type),null;case 22:case 23:return Uo(t),Io(),e!==null&&je($a),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Oa(Ba),null;case 25:return null;default:return null}}function kl(e,t){switch(A(t),t.tag){case 3:Oa(Ba),Re();break;case 26:case 27:case 5:Be(t);break;case 4:Re();break;case 31:t.memoizedState!==null&&Uo(t);break;case 13:Uo(t);break;case 19:Ko(t);break;case 10:Oa(t.type);break;case 22:case 23:Uo(t),Io(),e!==null&&je($a);break;case 24:Oa(Ba)}}function Al(e,t){try{var n=t.updateQueue,r=n===null?null:n.lastEffect;if(r!==null){var i=r.next;n=i;do{if((n.tag&e)===e){r=void 0;var a=n.create,o=n.inst;r=a(),o.destroy=r}n=n.next}while(n!==i)}}catch(e){Ef(t,t.return,e)}}function jl(e,t,n){try{var r=t.updateQueue,i=r===null?null:r.lastEffect;if(i!==null){var a=i.next;r=a;do{if((r.tag&e)===e){var o=r.inst,s=o.destroy;if(s!==void 0){o.destroy=void 0,i=t;var c=n,l=s;try{l()}catch(e){Ef(i,c,e)}}}r=r.next}while(r!==a)}}catch(e){Ef(t,t.return,e)}}function Ml(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{P(t,n)}catch(t){Ef(e,e.return,t)}}}function Nl(e,t,n){n.props=Ac(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){Ef(e,t,n)}}function Pl(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;case 30:var i=e.stateNode,a=Di(e.memoizedProps,i);(i.ref===null||i.ref.name!==a)&&(i.ref=U(a)),r=i.ref;break;case 7:if(e.stateNode===null){var o=new Gp(e);h(e.child,!1,nm,o,void 0,void 0),e.stateNode=o}r=e.stateNode;break;default:r=e.stateNode}typeof n==`function`?e.refCleanup=n(r):n.current=r}}catch(n){Ef(e,t,n)}}function Fl(e,t){var n=e.ref,r=e.refCleanup;if(n!==null){if(typeof r==`function`)try{r()}catch(n){Ef(e,t,n)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n==`function`)try{n(null)}catch(n){Ef(e,t,n)}else n.current=null}}function Il(e,t){if((e.tag===5||e.tag===27||e.tag===6)&&e.alternate===null&&t!==null)for(var n=0;n<t.length;n++)rm(e.stateNode,t[n])}function Ll(e){for(var t=e.return;t!==null&&(Bl(t)&&rm(e.stateNode,t.stateNode),!zl(t));)t=t.return}function Rl(e){for(var t=e.return;t!==null&&(Bl(t)&&im(e.stateNode,t.stateNode),!zl(t));)t=t.return}function zl(e){return e.tag===5||e.tag===3||e.tag===27}function Bl(e){return e&&e.tag===7&&e.stateNode!==null}function Vl(e){var t=e.type,n=e.memoizedProps,r=e.stateNode;try{a:switch(t){case`button`:case`input`:case`select`:case`textarea`:n.autoFocus&&r.focus();break a;case`img`:n.src?r.src=n.src:n.srcSet&&(r.srcset=n.srcSet)}}catch(t){Ef(e,e.return,t)}}function Hl(e,t,n){try{var r=e.stateNode;_p(r,e.type,n,t),r[It]=t}catch(t){Ef(e,e.return,t)}}function Ul(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&V(e.type)||e.tag===4}function Wl(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Ul(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&V(e.type)||e.flags&2||e.child===null||e.tag===4)continue a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Gl(e,t,n,r){var i=e.tag;if(i===5||i===6)i=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n).insertBefore(i,t):(t=n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n,t.appendChild(i),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=An)),Il(e,r),D=!0;else if(i!==4&&(i===27&&(Il(e,r),r=null,V(e.type)&&(n=e.stateNode,t=null)),e=e.child,e!==null))for(Gl(e,t,n,r),e=e.sibling;e!==null;)Gl(e,t,n,r),e=e.sibling}function Kl(e,t,n,r){var i=e.tag;if(i===5||i===6)i=e.stateNode,t?n.insertBefore(i,t):n.appendChild(i),Il(e,r),D=!0;else if(i!==4&&(i===27&&(Il(e,r),r=null,V(e.type)&&(n=e.stateNode)),e=e.child,e!==null))for(Kl(e,t,n,r),e=e.sibling;e!==null;)Kl(e,t,n,r),e=e.sibling}function ql(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);hp(t,r,n),t[Ft]=e,t[It]=n}catch(t){Ef(e,e.return,t)}}var Jl=!1,Yl=null;function Xl(e){(e.tag===30||e.subtreeFlags&33554432)&&(Jl=!0)}var Zl=null;function Ql(){var e=Zl;return Zl=null,e}var $l=0;function eu(e,t,n,r,i){return $l=0,tu(e.child,t,n,r,i)}function tu(e,t,n,r,i){for(var a=!1;e!==null;){if(e.tag===5){var o=e.stateNode;if(r!==null){var s=zp(o);r.push(s),s.view&&(a=!0)}else a||zp(o).view&&(a=!0);Jl=!0,Lp(o,$l===0?t:t+`_`+$l,n),$l++}else(e.tag!==22||e.memoizedState===null)&&(e.tag===30&&i||tu(e.child,t,n,r,i)&&(a=!0));e=e.sibling}return a}function nu(e,t){for(;e!==null;)e.tag===5?H(e.stateNode,e.memoizedProps):(e.tag!==22||e.memoizedState===null)&&(e.tag===30&&t||nu(e.child,t)),e=e.sibling}function ru(e){if(e.subtreeFlags&18874368)for(e=e.child;e!==null;){if((e.tag!==22||e.memoizedState===null)&&(ru(e),e.tag===30&&e.flags&18874368&&e.stateNode.paired)){var t=e.memoizedProps;if(t.name==null||t.name===`auto`)throw Error(o(544));var n=t.name;t=ki(t.default,t.share),t!==`none`&&(eu(e,n,t,null,!1)||nu(e.child,!1))}e=e.sibling}}function iu(e,t){if(e.tag===30){var n=e.stateNode,r=e.memoizedProps,i=Di(r,n),a=ki(r.default,n.paired?r.share:r.enter);a===`none`?ru(e):eu(e,i,a,null,!1)?(ru(e),n.paired||t||Gd(e,r.onEnter)):nu(e.child,!1)}else if(e.subtreeFlags&33554432)for(e=e.child;e!==null;)iu(e,t),e=e.sibling;else ru(e)}function au(e){if(Yl!==null&&Yl.size!==0){var t=Yl;if(e.subtreeFlags&18874368)for(e=e.child;e!==null;){if(e.tag!==22||e.memoizedState===null){if(e.tag===30&&e.flags&18874368){var n=e.memoizedProps,r=n.name;if(r!=null&&r!==`auto`){var i=t.get(r);if(i!==void 0){var a=ki(n.default,n.share);if(a!==`none`&&(eu(e,r,a,null,!1)?(a=e.stateNode,i.paired=a,a.paired=i,Gd(e,n.onShare)):nu(e.child,!1)),t.delete(r),t.size===0)break}}}au(e)}e=e.sibling}}}function ou(e){if(e.tag===30){var t=e.memoizedProps,n=Di(t,e.stateNode),r=Yl===null?void 0:Yl.get(n),i=ki(t.default,r===void 0?t.exit:t.share);i!==`none`&&(eu(e,n,i,null,!1)?r===void 0?Gd(e,t.onExit):(i=e.stateNode,r.paired=i,i.paired=r,Yl.delete(n),Gd(e,t.onShare)):nu(e.child,!1)),Yl!==null&&au(e)}else if(e.subtreeFlags&33554432)for(e=e.child;e!==null;)ou(e),e=e.sibling;else Yl!==null&&au(e)}function su(e){for(e=e.child;e!==null;){if(e.tag===30){var t=e.memoizedProps,n=Di(t,e.stateNode);t=ki(t.default,t.update),e.flags&=-5,t!==`none`&&eu(e,n,t,e.memoizedState=[],!1)}else e.subtreeFlags&33554432&&su(e);e=e.sibling}}function cu(e){if(e.subtreeFlags&18874368)for(e=e.child;e!==null;){if(e.tag!==22||e.memoizedState===null){if(e.tag===30&&e.flags&18874368){var t=e.stateNode;t.paired!==null&&(t.paired=null,nu(e.child,!1))}cu(e)}e=e.sibling}}function lu(e){if(e.tag===30)e.stateNode.paired=null,nu(e.child,!1),cu(e);else if(e.subtreeFlags&33554432)for(e=e.child;e!==null;)lu(e),e=e.sibling;else cu(e)}function uu(e){for(e=e.child;e!==null;)e.tag===30?nu(e.child,!1):e.subtreeFlags&33554432&&uu(e),e=e.sibling}function du(e,t,n,r,i,a,o){for(var s=!1;t!==null;){if(t.tag===5){var c=t.stateNode;if(a!==null&&$l<a.length){var l=a[$l],u=zp(c);(l.view||u.view)&&(s=!0);var d;if(d=!(e.flags&4)){if(u.clip)d=!0;else{d=l.rect;var f=u.rect;d=d.y!==f.y||d.x!==f.x||d.height!==f.height||d.width!==f.width}}d&&(e.flags|=4),u.abs?u=!l.abs:(l=l.rect,u=u.rect,u=l.height!==u.height||l.width!==u.width),u&&(e.flags|=32)}else e.flags|=32;e.flags&4&&Lp(c,$l===0?n:n+`_`+$l,i),s&&e.flags&4||(Zl===null&&(Zl=[]),Zl.push(c,$l===0?r:r+`_`+$l,t.memoizedProps)),$l++}else(t.tag!==22||t.memoizedState===null)&&(t.tag===30&&o?e.flags|=t.flags&32:du(e,t.child,n,r,i,a,o)&&(s=!0));t=t.sibling}return s}function fu(e,t){for(e=e.child;e!==null;){if(e.tag===30){var n=e.memoizedProps,r=e.stateNode,i=Di(n,r),a=ki(n.default,n.update);if(t){r=r.clones;var o=r===null?null:r.map(Bp)}else o=e.memoizedState,e.memoizedState=null;r=e;var s=e.child;$l=0,i=du(r,s,i,i,a,o,!1),e.flags&4&&i&&(t||Gd(e,n.onUpdate))}else e.subtreeFlags&33554432&&fu(e,t);e=e.sibling}}var pu=!1,mu=!1,hu=!1,gu=!1,_u=typeof WeakSet==`function`?WeakSet:Set,vu=null,yu=!1,bu=!1,xu=!1,Su=!1;function Cu(e,t,n){if(e=e.containerInfo,bp=vh,e=ri(e),ii(e)){if(`selectionStart`in e)var r={start:e.selectionStart,end:e.selectionEnd};else a:{r=(r=e.ownerDocument)&&r.defaultView||window;var i=r.getSelection&&r.getSelection();if(i&&i.rangeCount!==0){r=i.anchorNode;var a=i.anchorOffset,o=i.focusNode;i=i.focusOffset;try{r.nodeType,o.nodeType}catch{r=null;break a}var s=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==r||a!==0&&f.nodeType!==3||(c=s+a),f!==o||i!==0&&f.nodeType!==3||(l=s+i),f.nodeType===3&&(s+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===r&&++u===a&&(c=s),p===o&&++d===i&&(l=s),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}r=c===-1||l===-1?null:{start:c,end:l}}else r=null}r||={start:0,end:0}}else r=null;for(xp={focusedElem:e,selectionRange:r},vh=!1,n=(n&335544064)===n,vu=t,t=n?9270:1024;vu!==null;){if(e=vu,n&&(r=e.deletions,r!==null))for(a=0;a<r.length;a++)n&&ou(r[a]);if(e.alternate===null&&e.flags&2)n&&Xl(e),wu(n);else{if(e.tag===22){if(r=e.alternate,e.memoizedState!==null){r!==null&&r.memoizedState===null&&n&&ou(r),wu(n);continue}if(r!==null&&r.memoizedState!==null){n&&Xl(e),wu(n);continue}}r=e.child,(e.subtreeFlags&t)!==0&&r!==null?(r.return=e,vu=r):(n&&su(e),wu(n))}}Yl=null}function wu(e){for(;vu!==null;){var t=vu,n=e,r=t.alternate,i=t.flags;switch(t.tag){case 0:case 11:case 15:break;case 1:if(i&1024&&r!==null){n=void 0,i=r.memoizedProps,r=r.memoizedState;var a=t.stateNode;try{var s=Ac(t.type,i);n=a.getSnapshotBeforeUpdate(s,r),a.__reactInternalSnapshotBeforeUpdate=n}catch(e){Ef(t,t.return,e)}}break;case 3:if(i&1024){if(r=t.stateNode.containerInfo,n=r.nodeType,n===9)am(r);else if(n===1)switch(r.nodeName){case`HEAD`:case`HTML`:case`BODY`:am(r);break;default:r.textContent=``}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;case 30:n&&r!==null&&(n=Di(r.memoizedProps,r.stateNode),i=t.memoizedProps,i=ki(i.default,i.update),i!==`none`&&eu(r,n,i,r.memoizedState=[],!0));break;default:if(i&1024)throw Error(o(163))}if(r=t.sibling,r!==null){r.return=t.return,vu=r;break}vu=t.return}}function Tu(e,t,n){var r=n.flags;switch(n.tag){case 0:case 11:case 15:Gu(e,n),r&4&&Al(5,n);break;case 1:if(Gu(e,n),r&4){if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(e){Ef(n,n.return,e)}else{var i=Ac(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(i,t,e.__reactInternalSnapshotBeforeUpdate)}catch(e){Ef(n,n.return,e)}}}r&64&&Ml(n),r&512&&Pl(n,n.return);break;case 3:if(Gu(e,n),r&64&&(e=n.updateQueue,e!==null)){if(t=null,n.child!==null)switch(n.child.tag){case 27:case 5:t=n.child.stateNode;break;case 1:t=n.child.stateNode}try{P(e,t)}catch(e){Ef(n,n.return,e)}}break;case 27:t===null&&r&4&&ql(n);case 26:case 5:Gu(e,n),t===null&&r&4&&Vl(n),r&512&&Pl(n,n.return);break;case 12:Gu(e,n);break;case 31:Gu(e,n),r&4&&Pu(e,n);break;case 13:Gu(e,n),r&4&&Fu(e,n),r&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=Af.bind(null,n),um(e,n))));break;case 22:if(r=n.memoizedState!==null||pu,!r){var a=t!==null&&t.memoizedState!==null||mu;t=pu,i=mu,pu=r,(mu=a)&&!i?(r=2,n.subtreeFlags&8772&&(r|=1),qu(e,n,r)):Gu(e,n),pu=t,mu=i}break;case 30:Gu(e,n),r&512&&Pl(n,n.return);break;case 7:r&512&&Pl(n,n.return);default:Gu(e,n)}}function Eu(e,t){for(e=e.child;e!==null;)Du(e,t),e=e.sibling}function Du(e,t){switch(e.tag){case 5:case 26:try{var n=e.stateNode;if(t){var r=n.style;typeof r.setProperty==`function`?r.setProperty(`display`,`none`,`important`):r.display=`none`}else{var i=e.stateNode,a=e.memoizedProps.style,o=a!=null&&a.hasOwnProperty(`display`)?a.display:null;i.style.display=o==null||typeof o==`boolean`?``:(``+o).trim()}}catch(t){Ef(e,e.return,t)}Ou(e,t);break;case 6:try{e.stateNode.nodeValue=t?``:e.memoizedProps,D=!0}catch(t){Ef(e,e.return,t)}break;case 18:try{var s=e.stateNode;t?Ip(s,!0):Ip(e.stateNode,!1)}catch(t){Ef(e,e.return,t)}break;case 22:case 23:e.memoizedState===null&&Eu(e,t);break;default:Eu(e,t)}}function Ou(e,t){if(e.subtreeFlags&67108864)for(e=e.child;e!==null;){a:{var n=e,r=t;switch(n.tag){case 4:Du(n,r);break a;case 22:n.memoizedState===null&&Ou(n,r);break a;default:Ou(n,r)}}e=e.sibling}}function ku(e){var t=e.alternate;t!==null&&(e.alternate=null,ku(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&Wt(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var Au=null,ju=!1;function Mu(e,t,n){for(n=n.child;n!==null;)Nu(e,t,n),n=n.sibling}function Nu(e,t,n){if(lt&&typeof lt.onCommitFiberUnmount==`function`)try{lt.onCommitFiberUnmount(ct,n)}catch{}switch(n.tag){case 26:mu||Fl(n,t),Mu(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&!mu&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:mu||Fl(n,t),Rl(n);var r=Au,i=ju;V(n.type)&&(Au=n.stateNode,ju=!1),Mu(e,t,n),vm(n.stateNode,n.type,n.memoizedProps),Au=r,ju=i;break;case 5:mu||Fl(n,t),Rl(n);case 6:if(n.tag===6&&Rl(n),r=Au,i=ju,Au=null,Mu(e,t,n),Au=r,ju=i,Au!==null){if(ju)try{(Au.nodeType===9?Au.body:Au.nodeName===`HTML`?Au.ownerDocument.body:Au).removeChild(n.stateNode),D=!0}catch(e){Ef(n,t,e)}else try{Au.removeChild(n.stateNode),D=!0}catch(e){Ef(n,t,e)}}break;case 18:Au!==null&&(ju?(e=Au,Fp(e.nodeType===9?e.body:e.nodeName===`HTML`?e.ownerDocument.body:e,n.stateNode),Wh(e)):Fp(Au,n.stateNode));break;case 4:r=Au,i=ju,Au=n.stateNode.containerInfo,ju=!0,Mu(e,t,n),Au=r,ju=i;break;case 0:case 11:case 14:case 15:jl(2,n,t),mu||jl(4,n,t),Mu(e,t,n);break;case 1:mu||(Fl(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`&&Nl(n,t,r)),Mu(e,t,n);break;case 21:Mu(e,t,n);break;case 22:mu=(r=mu)||n.memoizedState!==null,Mu(e,t,n),mu=r;break;case 30:Fl(n,t),Mu(e,t,n);break;case 7:mu||Fl(n,t),Mu(e,t,n);break;default:Mu(e,t,n)}}function Pu(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Wh(e)}catch(e){Ef(t,t.return,e)}}}function Fu(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Wh(e)}catch(e){Ef(t,t.return,e)}}function Iu(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new _u),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new _u),t;default:throw Error(o(435,e.tag))}}function Lu(e,t){var n=Iu(e);t.forEach(function(t){if(!n.has(t)){n.add(t);var r=jf.bind(null,e,t);t.then(r,r)}})}function Ru(e,t,n){var r=t.deletions;if(r!==null)for(var i=0;i<r.length;i++){var a=r[i],s=e,c=t,l=c;a:for(;l!==null;){switch(l.tag){case 27:if(V(l.type)){Au=l.stateNode,ju=!1;break a}break;case 5:Au=l.stateNode,ju=!1;break a;case 3:case 4:Au=l.stateNode.containerInfo,ju=!0;break a}l=l.return}if(Au===null)throw Error(o(160));Nu(s,c,a),Au=null,ju=!1,s=a.alternate,s!==null&&(s.return=null),a.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)Bu(t,e,n),t=t.sibling}var zu=null;function Bu(e,t,n){var r=e.alternate,i=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(i&4&&(r=e.updateQueue,r=r===null?null:r.events,r!==null))for(var a=0;a<r.length;a++){var s=r[a];s.ref.impl=s.nextImpl}Ru(t,e,n),Vu(e),i&4&&(jl(3,e,e.return),Al(3,e),jl(5,e,e.return));break;case 1:Ru(t,e,n),Vu(e),i&512&&(mu||r===null||Fl(r,r.return)),i&64&&pu&&(e=e.updateQueue,e!==null&&(t=e.callbacks,t!==null&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=n===null?t:n.concat(t))));break;case 26:if(a=zu,Ru(t,e,n),Vu(e),i&512&&(mu||r===null||Fl(r,r.return)),i&4){if(i=r===null?null:r.memoizedState,n=e.memoizedState,r===null){if(n===null){if(e.stateNode===null){if(pu)e.stateNode=Tp(e.type,e.memoizedProps,t.containerInfo,e);else{a:{t=e.type,n=e.memoizedProps,i=a.ownerDocument||a;b:switch(t){case`title`:r=i.getElementsByTagName(`title`)[0],(!r||r[Ht]||r[Ft]||r.namespaceURI===`http://www.w3.org/2000/svg`||r.hasAttribute(`itemprop`))&&(r=i.createElement(t),i.head.insertBefore(r,i.querySelector(`head > title`))),hp(r,t,n),r[Ft]=e,Yt(r),t=r;break a;case`link`:if(a=qm(`link`,`href`,i).get(t+(n.href||``))){for(s=0;s<a.length;s++)if(r=a[s],r.getAttribute(`href`)===(n.href==null||n.href===``?null:n.href)&&r.getAttribute(`rel`)===(n.rel==null?null:n.rel)&&r.getAttribute(`title`)===(n.title==null?null:n.title)&&r.getAttribute(`crossorigin`)===(n.crossOrigin==null?null:n.crossOrigin)){a.splice(s,1);break b}}r=i.createElement(t),hp(r,t,n),i.head.appendChild(r);break;case`meta`:if(a=qm(`meta`,`content`,i).get(t+(n.content||``))){for(s=0;s<a.length;s++)if(r=a[s],r.getAttribute(`content`)===(n.content==null?null:``+n.content)&&r.getAttribute(`name`)===(n.name==null?null:n.name)&&r.getAttribute(`property`)===(n.property==null?null:n.property)&&r.getAttribute(`http-equiv`)===(n.httpEquiv==null?null:n.httpEquiv)&&r.getAttribute(`charset`)===(n.charSet==null?null:n.charSet)){a.splice(s,1);break b}}r=i.createElement(t),hp(r,t,n),i.head.appendChild(r);break;default:throw Error(o(468,t))}r[Ft]=e,Yt(r),t=r}e.stateNode=t}}else pu||Jm(a,e.type,e.stateNode)}else e.stateNode=Hm(a,n,e.memoizedProps)}else i===n?n===null&&e.stateNode!==null&&Hl(e,e.memoizedProps,r.memoizedProps):(i===null?(t=r.stateNode,t===null||mu||t.parentNode.removeChild(t)):i.count--,n===null?pu||Jm(a,e.type,e.stateNode):Hm(a,n,e.memoizedProps))}break;case 27:Ru(t,e,n),Vu(e),i&512&&(mu||r===null||Fl(r,r.return)),r!==null&&i&4&&Hl(e,e.memoizedProps,r.memoizedProps);break;case 5:if(a=hu,hu=!1,Ru(t,e,n),hu=a,Vu(e),i&512&&(mu||r===null||Fl(r,r.return)),e.flags&32){t=e.stateNode;try{Sn(t,``),D=!0}catch(t){Ef(e,e.return,t)}}i&4&&e.stateNode!=null&&(t=e.memoizedProps,Hl(e,t,r===null?t:r.memoizedProps)),i&1024&&(gu=!0);break;case 6:if(Ru(t,e,n),Vu(e),i&4){if(e.stateNode===null)throw Error(o(162));t=e.memoizedProps,n=e.stateNode;try{n.nodeValue=t,D=!0}catch(t){Ef(e,e.return,t)}}break;case 3:if(D=!1,Km=null,a=zu,zu=Sm(t.containerInfo),Ru(t,e,n),zu=a,Vu(e),i&4&&r!==null&&r.memoizedState.isDehydrated)try{Wh(t.containerInfo)}catch(t){Ef(e,e.return,t)}gu&&(gu=!1,Hu(e)),D=!1;break;case 4:i=hu,hu=pu,r=an(),a=zu,zu=Sm(e.stateNode.containerInfo),Ru(t,e,n),Vu(e),zu=a,D&&bu&&(xu=!0),D=r,hu=i;break;case 12:Ru(t,e,n),Vu(e);break;case 31:Ru(t,e,n),Vu(e),i&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,Lu(e,t)));break;case 13:Ru(t,e,n),Vu(e),e.child.flags&8192&&e.memoizedState!==null!=(r!==null&&r.memoizedState!==null)&&(Ed=$e()),i&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,Lu(e,t)));break;case 22:a=e.memoizedState!==null,s=r!==null&&r.memoizedState!==null;var c=pu,l=mu,u=hu;pu=c||a,hu=u||a,mu=l||s,Ru(t,e,n),mu=l,hu=u,pu=c,Vu(e),i&8192&&(t=e.stateNode,t._visibility=a?t._visibility&-2:t._visibility|1,!a||r===null||s||pu||mu||(t=s||mu,n=pu,r=mu,pu=a||pu,mu=t,Ku(e,2),pu=n,mu=r),!a&&hu||Eu(e,a)),i&4&&(t=e.updateQueue,t!==null&&(n=t.retryQueue,n!==null&&(t.retryQueue=null,Lu(e,n))));break;case 19:Ru(t,e,n),Vu(e),i&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,Lu(e,t)));break;case 30:i&512&&(mu||r===null||Fl(r,r.return)),i=an(),a=bu,s=(n&335544064)===n,c=e.memoizedProps,bu=s&&ki(c.default,c.update)!==`none`,Ru(t,e,n),Vu(e),s&&r!==null&&D&&(e.flags|=4),bu=a,D=i;break;case 21:break;case 7:i&512&&(mu||r===null||Fl(r,r.return)),r&&r.stateNode!==null&&(r.stateNode._fragmentFiber=e);default:Ru(t,e,n),Vu(e)}}function Vu(e){var t=e.flags;if(t&2){try{for(var n,r=e.return;r!==null;){if(Ul(r)){n=r;break}r=r.return}r=null;for(var i=e.return;i!==null;){if(Bl(i)){var a=i.stateNode;r===null?r=[a]:r.push(a)}if(zl(i))break;i=i.return}var s=r;if(n==null)throw Error(o(160));switch(n.tag){case 27:var c=n.stateNode;Kl(e,Wl(e),c,s);break;case 5:var l=n.stateNode;n.flags&32&&(Sn(l,``),n.flags&=-33),Kl(e,Wl(e),l,s);break;case 3:case 4:var u=n.stateNode.containerInfo;Gl(e,Wl(e),u,s);break;default:throw Error(o(161))}}catch(t){Ef(e,e.return,t)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Hu(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;Hu(t),t.tag===5&&t.flags&1024&&(t=t.stateNode,vh=!0,t.reset(),vh=!1),e=e.sibling}}function Uu(e,t){if(t.subtreeFlags&9270)for(t=t.child;t!==null;)Wu(t,e),t=t.sibling;else fu(t,!1)}function Wu(e,t){var n=e.alternate;if(n===null)iu(e,!1);else switch(e.tag){case 3:if(Su=yu=!1,Ql(),Uu(t,e),!yu&&!xu){if(e=Zl,e!==null)for(var r=0;r<e.length;r+=3){n=e[r];var i=e[r+1];H(n,e[r+2]),n=n.ownerDocument.documentElement,n!==null&&n.animate({opacity:[0,0],pointerEvents:[`none`,`none`]},{duration:0,fill:`forwards`,pseudoElement:`::view-transition-group(`+i+`)`})}e=t.containerInfo,e=e.nodeType===9?e.documentElement:e.ownerDocument.documentElement,e!==null&&e.style.viewTransitionName===``&&(e.style.viewTransitionName=`none`,e.animate({opacity:[0,0],pointerEvents:[`none`,`none`]},{duration:0,fill:`forwards`,pseudoElement:`::view-transition-group(root)`}),e.animate({width:[0,0],height:[0,0]},{duration:0,fill:`forwards`,pseudoElement:`::view-transition`})),Su=!0}Zl=null;break;case 5:Uu(t,e);break;case 4:r=yu,yu=!1,Uu(t,e),yu&&(xu=!0),yu=r;break;case 22:e.memoizedState===null&&(n.memoizedState===null?Uu(t,e):iu(e,!1));break;case 30:r=yu,i=Ql(),yu=!1,Uu(t,e),yu&&(e.flags|=4);var a=e.memoizedProps,o=e.stateNode;t=Di(a,o),o=Di(n.memoizedProps,o);var s=ki(a.default,a.update);s===`none`?t=!1:(a=n.memoizedState,n.memoizedState=null,n=e.child,$l=0,t=du(e,n,t,o,s,a,!0),$l!==(a===null?0:a.length)&&(e.flags|=32)),e.flags&4&&t?(Gd(e,e.memoizedProps.onUpdate),Zl=i):i!==null&&(i.push.apply(i,Zl),Zl=i),yu=e.flags&32?!0:r;break;default:Uu(t,e)}}function Gu(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)Tu(e,t.alternate,t),t=t.sibling}function Ku(e,t){for(e=e.child;e!==null;){var n=e,r=t;switch(n.tag){case 0:case 11:case 14:case 15:jl(4,n,n.return),Ku(n,r);break;case 1:Fl(n,n.return);var i=n.stateNode;typeof i.componentWillUnmount==`function`&&Nl(n,n.return,i),Ku(n,r);break;case 27:r&2&&vm(n.stateNode,n.type,n.memoizedProps);case 5:Fl(n,n.return),n.tag!==5&&n.tag!==27||Rl(n),Ku(n,r);break;case 6:Rl(n);break;case 26:Fl(n,n.return),i=n.stateNode,n.memoizedState!==null||i===null||mu||i.parentNode.removeChild(i),Ku(n,r);break;case 22:n.memoizedState===null&&Ku(n,r);break;case 30:Fl(n,n.return),Ku(n,r);break;case 7:Fl(n,n.return);default:Ku(n,r)}e=e.sibling}}function qu(e,t,n){for(n=t.subtreeFlags&8772?n:n&-2,t=t.child;t!==null;){var r=t.alternate,i=e,a=t,o=a.flags,s=!!(n&1);switch(a.tag){case 0:case 11:case 15:qu(i,a,n),Al(4,a);break;case 1:if(qu(i,a,n),r=a,i=r.stateNode,typeof i.componentDidMount==`function`)try{i.componentDidMount()}catch(e){Ef(r,r.return,e)}if(r=a,i=r.updateQueue,i!==null){var c=r.stateNode;try{var l=i.shared.hiddenCallbacks;if(l!==null)for(i.shared.hiddenCallbacks=null,i=0;i<l.length;i++)jo(l[i],c)}catch(e){Ef(r,r.return,e)}}s&&o&64&&Ml(a),Pl(a,a.return);break;case 27:n&2&&ql(a);case 5:a.tag!==5&&a.tag!==27||Ll(a),qu(i,a,n),s&&r===null&&o&4&&Vl(a),Pl(a,a.return);break;case 6:Ll(a);break;case 26:c=a.stateNode,a.memoizedState!==null||c===null||pu||Jm(Sm(c.ownerDocument),a.type,c),qu(i,a,n),s&&r===null&&o&4&&Vl(a),Pl(a,a.return);break;case 12:qu(i,a,n);break;case 31:qu(i,a,n),s&&o&4&&Pu(i,a);break;case 13:qu(i,a,n),s&&o&4&&Fu(i,a);break;case 22:a.memoizedState===null&&qu(i,a,n),Pl(a,a.return);break;case 30:qu(i,a,n),Pl(a,a.return);break;case 7:Pl(a,a.return);default:qu(i,a,n)}t=t.sibling}}function Ju(e,t){var n=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==n&&(e!=null&&e.refCount++,n!=null&&Ha(n))}function Yu(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Ha(e))}function Xu(e,t,n,r){var i=(n&335544064)===n;if(t.subtreeFlags&(i?10262:10256))for(t=t.child;t!==null;)Zu(e,t,n,r),t=t.sibling;else i&&uu(t)}function Zu(e,t,n,r){var i=(n&335544064)===n;i&&t.alternate===null&&t.return!==null&&t.return.alternate!==null&&lu(t);var a=t.flags;switch(t.tag){case 0:case 11:case 15:Xu(e,t,n,r),a&2048&&Al(9,t);break;case 1:Xu(e,t,n,r);break;case 3:Xu(e,t,n,r),i&&Su&&(e=e.containerInfo,e=e.nodeType===9?e.body:e.nodeName===`HTML`?e.ownerDocument.body:e,e.style.viewTransitionName===`root`&&(e.style.viewTransitionName=``),e=e.ownerDocument.documentElement,e!==null&&e.style.viewTransitionName===`none`&&(e.style.viewTransitionName=``)),a&2048&&(a=null,t.alternate!==null&&(a=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==a&&(t.refCount++,a!=null&&Ha(a)));break;case 12:if(a&2048){Xu(e,t,n,r),a=t.stateNode;try{var o=t.memoizedProps,s=o.id,c=o.onPostCommit;typeof c==`function`&&c(s,t.alternate===null?`mount`:`update`,a.passiveEffectDuration,-0)}catch(e){Ef(t,t.return,e)}}else Xu(e,t,n,r);break;case 31:Xu(e,t,n,r);break;case 13:Xu(e,t,n,r);break;case 23:break;case 22:o=t.stateNode,s=t.alternate,t.memoizedState===null?(i&&s!==null&&s.memoizedState!==null&&lu(t),o._visibility&2?Xu(e,t,n,r):(o._visibility|=2,Qu(e,t,n,r,!!(t.subtreeFlags&10256)||!1))):(i&&s!==null&&s.memoizedState===null&&lu(s),o._visibility&2?Xu(e,t,n,r):$u(e,t)),a&2048&&Ju(s,t);break;case 24:Xu(e,t,n,r),a&2048&&Yu(t.alternate,t);break;case 30:i&&(a=t.alternate,a!==null&&(nu(a.child,!0),nu(t.child,!0))),Xu(e,t,n,r);break;default:Xu(e,t,n,r)}}function Qu(e,t,n,r,i){for(i&&=!!(t.subtreeFlags&10256)||!1,t=t.child;t!==null;){var a=e,o=t,s=n,c=r,l=o.flags;switch(o.tag){case 0:case 11:case 15:Qu(a,o,s,c,i),Al(8,o);break;case 23:break;case 22:var u=o.stateNode;o.memoizedState===null?(u._visibility|=2,Qu(a,o,s,c,i)):u._visibility&2?Qu(a,o,s,c,i):$u(a,o),i&&l&2048&&Ju(o.alternate,o);break;case 24:Qu(a,o,s,c,i),i&&l&2048&&Yu(o.alternate,o);break;default:Qu(a,o,s,c,i)}t=t.sibling}}function $u(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var n=e,r=t,i=r.flags;switch(r.tag){case 22:$u(n,r),i&2048&&Ju(r.alternate,r);break;case 24:$u(n,r),i&2048&&Yu(r.alternate,r);break;default:$u(n,r)}t=t.sibling}}var ed=8192;function td(e,t,n){if(e.subtreeFlags&ed)for(e=e.child;e!==null;)nd(e,t,n),e=e.sibling}function nd(e,t,n){switch(e.tag){case 26:td(e,t,n),e.flags&ed&&(e.memoizedState===null?(e=e.stateNode,(t&335544128)===t&&$m(n,e)):eh(n,zu,e.memoizedState,e.memoizedProps));break;case 5:td(e,t,n),e.flags&ed&&(e=e.stateNode,(t&335544128)===t&&$m(n,e));break;case 3:case 4:var r=zu;zu=Sm(e.stateNode.containerInfo),td(e,t,n),zu=r;break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=ed,ed=16777216,td(e,t,n),ed=r):td(e,t,n));break;case 30:if((e.flags&ed)!==0&&(r=e.memoizedProps.name,r!=null&&r!==`auto`)){var i=e.stateNode;i.paired=null,Yl===null&&(Yl=new Map),Yl.set(r,i)}td(e,t,n);break;default:td(e,t,n)}}function rd(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function id(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];vu=r,sd(r,e)}rd(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)ad(e),e=e.sibling}function ad(e){switch(e.tag){case 0:case 11:case 15:id(e),e.flags&2048&&jl(9,e,e.return);break;case 3:id(e);break;case 12:id(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,od(e)):id(e);break;default:id(e)}}function od(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];vu=r,sd(r,e)}rd(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:jl(8,t,t.return),od(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,od(t));break;default:od(t)}e=e.sibling}}function sd(e,t){for(;vu!==null;){var n=vu;switch(n.tag){case 0:case 11:case 15:jl(8,n,t);break;case 23:case 22:if(n.memoizedState!==null&&n.memoizedState.cachePool!==null){var r=n.memoizedState.cachePool.pool;r!=null&&r.refCount++}break;case 24:Ha(n.memoizedState.cache)}if(r=n.child,r!==null)r.return=n,vu=r;else a:for(n=e;vu!==null;){r=vu;var i=r.sibling,a=r.return;if(ku(r),r===n){vu=null;break a}if(i!==null){i.return=a,vu=i;break a}vu=a}}}var cd={getCacheForType:function(e){var t=Pa(Ba),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return Pa(Ba).controller.signal}},ld=typeof WeakMap==`function`?WeakMap:Map,I=0,ud=null,L=null,R=0,dd=0,fd=null,pd=!1,md=!1,hd=!1,gd=0,_d=0,vd=0,yd=0,bd=0,xd=0,Sd=0,Cd=null,wd=null,Td=!1,Ed=0,Dd=0,Od=1/0,kd=null,Ad=null,jd=0,Md=null,Nd=null,Pd=0,Fd=0,Id=null,Ld=null,Rd=null,zd=null,Bd=null,Vd=0,Hd=null;function Ud(){return I&2&&R!==0?R&-R:w.T===null?Mt():qf()}function Wd(){if(xd===0){if(!(R&536870912)||j){var e=gt;gt<<=1,!(gt&3932160)&&(gt=262144),xd=e}else xd=536870912}return e=Lo.current,e!==null&&(e.flags|=32),xd}function Gd(e,t){if(t!=null){var n=e.stateNode,r=n.ref;r===null&&(r=n.ref=U(Di(e.memoizedProps,n))),zd===null&&(zd=[]),zd.push(t.bind(null,r))}}function Kd(e,t,n){(e===ud&&(dd===2||dd===9)||e.cancelPendingCommit!==null)&&($d(e,0),Xd(e,R,xd,!1)),Tt(e,n),(!(I&2)||e!==ud)&&(e===ud&&(!(I&2)&&(yd|=n),_d===4&&Xd(e,R,xd,!1)),zf(e))}function qd(e,t,n){if(I&6)throw Error(o(327));var r=!n&&!(t&127)&&(t&e.expiredLanes)===0||bt(e,t),i=r?cf(e,t):of(e,t,!0),a=r;do{if(i===0){md&&!r&&Xd(e,t,0,!1);break}if(n=e.current.alternate,a&&!Yd(n)){i=of(e,t,!1),a=!1;continue}if(i===2){if(a=t,e.errorRecoveryDisabledLanes&a)var s=0;else s=e.pendingLanes&-536870913,s=s===0?s&536870912?536870912:0:s;if(s!==0){t=s;a:{var c=e;i=Cd;var l=c.current.memoizedState.isDehydrated;if(l&&($d(c,s).flags|=256),s=of(c,s,!1),s!==2&&s!==6){if(hd&&!l){c.errorRecoveryDisabledLanes|=a,yd|=a,i=4;break a}a=wd,wd=i,a!==null&&(wd===null?wd=a:wd.push.apply(wd,a))}i=s}if(a=!1,i!==2)continue}}if(i===1){$d(e,0),Xd(e,t,0,!0);break}a:{switch(r=e,a=i,a){case 0:case 1:throw Error(o(345));case 4:if((t&4194048)!==t&&(t&62914560)!==t)break;case 6:Xd(r,t,xd,!pd);break a;case 2:wd=null;break;case 3:case 5:break;default:throw Error(o(329))}if((t&62914560)===t&&(i=Ed+300-$e(),10<i)){if(Xd(r,t,xd,!pd),yt(r,0,!0)!==0)break a;Pd=t,r.timeoutHandle=kp(Jd.bind(null,r,n,wd,kd,Td,t,xd,yd,Sd,pd,a,`Throttled`,-0,0),i);break a}Jd(r,n,wd,kd,Td,t,xd,yd,Sd,pd,a,null,-0,0)}break}while(1);zf(e)}function Jd(e,t,n,r,i,a,o,s,c,l,u,d,f,p){e.timeoutHandle=-1;var m=t.subtreeFlags,h=(a&335544064)===a;if(d=null,(h||m&8192||(m&16785408)==16785408)&&(d={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:An},Yl=null,nd(t,a,d),h&&(m=d,h=e.containerInfo,h=(h.nodeType===9?h:h.ownerDocument).__reactViewTransition,h!=null&&(m.count++,m.waitingForViewTransition=!0,m=ih.bind(m),h.finished.then(m,m))),m=(a&62914560)===a?Ed-$e():(a&4194048)===a?Dd-$e():0,m=nh(d,m),m!==null)){Pd=a,e.cancelPendingCommit=m(hf.bind(null,e,t,a,n,r,i,o,s,c,l,u,d,null,f,p)),Xd(e,a,o,!l);return}hf(e,t,a,n,r,i,o,s,c,l,u,d)}function Yd(e){for(var t=e;;){var n=t.tag;if((n===0||n===11||n===15)&&t.flags&16384&&(n=t.updateQueue,n!==null&&(n=n.stores,n!==null)))for(var r=0;r<n.length;r++){var i=n[r],a=i.getSnapshot;i=i.value;try{if(!Zr(a(),i))return!1}catch{return!1}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function Xd(e,t,n,r){t=xt(e,t),t&=~bd,t&=~yd,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var i=t;0<i;){var a=31-dt(i),o=1<<a;r[a]=-1,i&=~o}n!==0&&Dt(e,n,t)}function Zd(){return I&6?!0:(Bf(0,!1),!1)}function Qd(){if(L!==null){if(dd===0)var e=L.return;else e=L,Ea=Ta=null,fs(e),mo=null,ho=0,e=L;for(;e!==null;)kl(e.alternate,e),e=e.return;L=null}}function $d(e,t){var n=e.timeoutHandle;return n!==-1&&(e.timeoutHandle=-1,Ap(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),Pd=0,Qd(),ud=e,L=n=Wi(e.current,null),R=t,dd=0,fd=null,pd=!1,md=bt(e,t),hd=!1,Sd=xd=bd=yd=vd=_d=0,wd=Cd=null,Td=!1,gd=xt(e,t),Pi(),n}function ef(e,t){F=null,w.H=Sc,t===ro||t===ao?(t=fo(),dd=3):t===io?(t=fo(),dd=4):dd=t===Bc?8:typeof t==`object`&&t&&typeof t.then==`function`?6:1,fd=t,L===null&&(_d=1,Pc(e,Qi(t,e.current)))}function tf(){var e=Lo.current;return e===null?!0:(R&4194048)===R?Ro===null:(R&62914560)===R||R&536870912?e===Ro:!1}function nf(){var e=w.H;return w.H=Sc,e===null?Sc:e}function rf(){var e=w.A;return w.A=cd,e}function af(){_d=4,pd||(R&4194048)!==R&&Lo.current!==null||(md=!0),!(vd&134217727)&&!(yd&134217727)||ud===null||Xd(ud,R,xd,!1)}function of(e,t,n){var r=I;I|=2;var i=nf(),a=rf();(ud!==e||R!==t)&&(kd=null,$d(e,t)),t=!1;var o=_d;a:do try{if(dd!==0&&L!==null){var s=L,c=fd;switch(dd){case 8:Qd(),o=6;break a;case 3:case 2:case 9:case 6:Lo.current===null&&(t=!0);var l=dd;if(dd=0,fd=null,ff(e,s,c,l),n&&md){o=0;break a}break;default:l=dd,dd=0,fd=null,ff(e,s,c,l)}}sf(),o=_d;break}catch(t){ef(e,t)}while(1);return t&&e.shellSuspendCounter++,Ea=Ta=null,I=r,w.H=i,w.A=a,L===null&&(ud=null,R=0,Pi()),o}function sf(){for(;L!==null;)uf(L)}function cf(e,t){var n=I;I|=2;var r=nf(),i=rf();ud!==e||R!==t?(kd=null,Od=$e()+500,$d(e,t)):md=bt(e,t);a:do try{if(dd!==0&&L!==null){t=L;var a=fd;b:switch(dd){case 1:dd=0,fd=null,ff(e,t,a,1);break;case 2:case 9:if(so(a)){dd=0,fd=null,df(t);break}t=function(){dd!==2&&dd!==9||ud!==e||(dd=7),zf(e)},a.then(t,t);break a;case 3:dd=7;break a;case 4:dd=5;break a;case 7:so(a)?(dd=0,fd=null,df(t)):(dd=0,fd=null,ff(e,t,a,7));break;case 5:var s=null;switch(L.tag){case 26:s=L.memoizedState;case 5:case 27:var c=L;if(s?Zm(s):c.stateNode.complete){dd=0,fd=null;var l=c.sibling;if(l!==null)L=l;else{var u=c.return;u===null?L=null:(L=u,pf(u))}break b}}dd=0,fd=null,ff(e,t,a,5);break;case 6:dd=0,fd=null,ff(e,t,a,6);break;case 8:Qd(),_d=6;break a;default:throw Error(o(462))}}lf();break}catch(t){ef(e,t)}while(1);return Ea=Ta=null,w.H=r,w.A=i,I=n,L===null?(ud=null,R=0,Pi(),_d):0}function lf(){for(;L!==null&&!Ze();)uf(L)}function uf(e){var t=bl(e.alternate,e,gd);e.memoizedProps=e.pendingProps,t===null?pf(e):L=t}function df(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=el(n,t,t.pendingProps,t.type,void 0,R);break;case 11:t=el(n,t,t.pendingProps,t.type.render,t.ref,R);break;case 5:fs(t);var r=t;r===fa&&(j?(ya(r),r.tag===5&&r.stateNode!=null&&(pa=r.stateNode)):(ya(r),j=!0));default:kl(n,t),t=L=Gi(t,gd),t=bl(n,t,gd)}e.memoizedProps=e.pendingProps,t===null?pf(e):L=t}function ff(e,t,n,r){Ea=Ta=null,fs(t),mo=null,ho=0;var i=t.return;try{if(zc(e,i,t,n,R)){_d=1,Pc(e,Qi(n,e.current)),L=null;return}}catch(t){if(i!==null)throw L=i,t;_d=1,Pc(e,Qi(n,e.current)),L=null;return}t.flags&32768?(j||r===1?e=!0:md||R&536870912?e=!1:(pd=e=!0,(r===2||r===9||r===3||r===6)&&(r=Lo.current,r!==null&&r.tag===13&&(r.flags|=16384))),mf(t,e)):pf(t)}function pf(e){var t=e;do{if(t.flags&32768){mf(t,pd);return}e=t.return;var n=Dl(t.alternate,t,gd);if(n!==null){L=n;return}if(t=t.sibling,t!==null){L=t;return}L=t=e}while(t!==null);_d===0&&(_d=5)}function mf(e,t){do{var n=Ol(e.alternate,e);if(n!==null){n.flags&=32767,L=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){L=e;return}L=e=n}while(e!==null);_d=6,L=null}function hf(e,t,n,r,i,a,s,c,l,u,d,f){e.cancelPendingCommit=null;do Cf();while(jd!==0);if(I&6)throw Error(o(327));if(t!==null){if(t===e.current)throw Error(o(177));e===ud&&(L=ud=null,R=0),Nd=t,Md=e,Pd=n,Id=i,Ld=r,gf(e,t,n,s,c,l,f)}}function gf(e,t,n,r,i,a,o){var s=t.lanes|t.childLanes;if(Fd=s,s|=Ni,Et(e,n,s,r,i,a),zd=null,(n&335544064)===n?(Bd=Wa(e),r=10262):(Bd=null,r=10256),(t.subtreeFlags&r)!==0||(t.flags&r)!==0?(e.callbackNode=null,e.callbackPriority=0,Mf(rt,function(){return wf(),null})):(e.callbackNode=null,e.callbackPriority=0),Jl=!1,r=!!(t.flags&13878),t.subtreeFlags&13878||r){r=w.T,w.T=null,i=T.p,T.p=2,a=I,I|=4;try{Cu(e,t,n)}finally{I=a,T.p=i,w.T=r}}jd=1,Jl?Rd=Up(o,e.containerInfo,Bd,yf,bf,vf,xf,wf,_f,null,null):(yf(),bf(),xf())}function _f(e){if(jd!==0){var t=Md.onRecoverableError;t(e,{componentStack:null})}}function vf(){jd===3&&(jd=0,Wu(Nd,Md),jd=4)}function yf(){if(jd===1){jd=0;var e=Md,t=Nd,n=Pd,r=!!(t.flags&13878);if(t.subtreeFlags&13878||r){r=w.T,w.T=null;var i=T.p;T.p=2;var a=I;I|=4;try{bu=xu=!1,Bu(t,e,n),n=xp;var o=ri(e.containerInfo),s=n.focusedElem,c=n.selectionRange;if(o!==s&&s&&s.ownerDocument&&ni(s.ownerDocument.documentElement,s)){if(c!==null&&ii(s)){var l=c.start,u=c.end;if(u===void 0&&(u=l),`selectionStart`in s)s.selectionStart=l,s.selectionEnd=Math.min(u,s.value.length);else{var d=s.ownerDocument||document,f=d&&d.defaultView||window;if(f.getSelection){var p=f.getSelection(),m=s.textContent.length,h=Math.min(c.start,m),g=c.end===void 0?h:Math.min(c.end,m);!p.extend&&h>g&&(o=g,g=h,h=o);var _=ti(s,h),v=ti(s,g);if(_&&v&&(p.rangeCount!==1||p.anchorNode!==_.node||p.anchorOffset!==_.offset||p.focusNode!==v.node||p.focusOffset!==v.offset)){var y=d.createRange();y.setStart(_.node,_.offset),p.removeAllRanges(),h>g?(p.addRange(y),p.extend(v.node,v.offset)):(y.setEnd(v.node,v.offset),p.addRange(y))}}}}for(d=[],p=s;p=p.parentNode;)p.nodeType===1&&d.push({element:p,left:p.scrollLeft,top:p.scrollTop});for(typeof s.focus==`function`&&s.focus(),s=0;s<d.length;s++){var b=d[s];b.element.scrollLeft=b.left,b.element.scrollTop=b.top}}vh=!!bp,xp=bp=null}finally{I=a,T.p=i,w.T=r}}e.current=t,jd=2}}function bf(){if(jd===2){jd=0;var e=Md,t=Nd,n=!!(t.flags&8772);if(t.subtreeFlags&8772||n){n=w.T,w.T=null;var r=T.p;T.p=2;var i=I;I|=4;try{Tu(e,t.alternate,t)}finally{I=i,T.p=r,w.T=n}}jd=3}}function xf(){if(jd===4||jd===3){jd=0;var e=Rd;Rd=null,Qe();var t=Md,n=Nd,r=Pd,i=Ld,a=(r&335544064)===r?10262:10256;if((n.subtreeFlags&a)!==0||(n.flags&a)!==0?jd=5:(jd=0,Nd=Md=null,Sf(t,t.pendingLanes)),a=t.pendingLanes,a===0&&(Ad=null),jt(r),n=n.stateNode,lt&&typeof lt.onCommitFiberRoot==`function`)try{lt.onCommitFiberRoot(ct,n,void 0,(n.current.flags&128)==128)}catch{}if(i!==null){n=w.T,a=T.p,T.p=2,w.T=null;try{for(var o=t.onRecoverableError,s=0;s<i.length;s++){var c=i[s];o(c.value,{componentStack:c.stack})}}finally{w.T=n,T.p=a}}if(i=zd,o=Bd,Bd=null,i!==null&&(zd=null,o===null&&(o=[]),e!==null))for(c=0;c<i.length;c++)n=(0,i[c])(o),n!==void 0&&e.finished.finally(n);Pd&3&&Cf(),zf(t),a=t.pendingLanes,r&261930&&a&42?t===Hd?Vd++:(Vd=0,Hd=t):(Vd=0,Hd=null),Bf(0,!1)}}function Sf(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Ha(t)))}function Cf(){return Rd!==null&&(Rd.skipTransition(),Rd=null),yf(),bf(),xf(),wf()}function wf(){if(jd!==5)return!1;var e=Md,t=Fd;Fd=0;var n=jt(Pd),r=w.T,i=T.p;try{T.p=32>n?32:n,w.T=null,n=Id,Id=null;var a=Md,s=Pd;if(jd=0,Nd=Md=null,Pd=0,I&6)throw Error(o(331));var c=I;if(I|=4,ad(a.current),Zu(a,a.current,s,n),I=c,Bf(0,!1),lt&&typeof lt.onPostCommitFiberRoot==`function`)try{lt.onPostCommitFiberRoot(ct,a)}catch{}return!0}finally{T.p=i,w.T=r,Sf(e,t)}}function Tf(e,t,n){t=Qi(n,t),t=Ic(e.stateNode,t,2),e=To(e,t,2),e!==null&&(Tt(e,2),zf(e))}function Ef(e,t,n){if(e.tag===3)Tf(e,e,n);else for(;t!==null;){if(t.tag===3){Tf(t,e,n);break}if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(Ad===null||!Ad.has(r))){e=Qi(n,e),n=Lc(2),r=To(t,n,2),r!==null&&(Rc(n,r,t,e),Tt(r,2),zf(r));break}}t=t.return}}function Df(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new ld;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(hd=!0,i.add(n),e=Of.bind(null,e,t,n),t.then(e,e))}function Of(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,ud===e&&(R&n)===n&&(_d===4||_d===3&&(R&62914560)===R&&300>$e()-Ed?I&2?bd|=n:$d(e,0):bd|=n,Sd===R&&(Sd=0)),zf(e)}function kf(e,t){t===0&&(t=Ct()),e=Li(e,t),e!==null&&(Tt(e,t),zf(e))}function Af(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),kf(e,n)}function jf(e,t){var n=0;switch(e.tag){case 31:case 13:var r=e.stateNode,i=e.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(o(314))}r!==null&&r.delete(t),kf(e,n)}function Mf(e,t){return Ye(e,t)}var Nf=null,Pf=null,Ff=!1,If=!1,Lf=!1,Rf=0;function zf(e){e!==Pf&&e.next===null&&(Pf===null?Nf=Pf=e:Pf=Pf.next=e),If=!0,Ff||(Ff=!0,Kf())}function Bf(e,t){if(!Lf&&If){Lf=!0;do for(var n=!1,r=Nf;r!==null;){if(!t){if(e!==0){var i=r.pendingLanes;if(i===0)var a=0;else{var o=r.suspendedLanes,s=r.pingedLanes;a=(1<<31-dt(42|e)+1)-1,a&=i&~(o&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,Gf(r,a))}else a=R,a=yt(r,r===ud?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||bt(r,a)||(n=!0,Gf(r,a))}r=r.next}while(n);Lf=!1}}function Vf(){Hf()}function Hf(){If=Ff=!1;var e=0;Rf!==0&&Op()&&(e=Rf);for(var t=$e(),n=null,r=Nf;r!==null;){var i=r.next,a=Uf(r,t);a===0?(r.next=null,n===null?Nf=i:n.next=i,i===null&&(Pf=n)):(n=r,(e!==0||a&3)&&(If=!0)),r=i}jd!==0&&jd!==5||Bf(e,!1),Rf!==0&&(Rf=0)}function Uf(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes&-62914561;0<a;){var o=31-dt(a),s=1<<o,c=i[o];c===-1?((s&n)===0||(s&r)!==0)&&(i[o]=St(s,t)):c<=t&&(e.expiredLanes|=s),a&=~s}if(t=ud,n=R,n=yt(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r=e.callbackNode,n===0||e===t&&(dd===2||dd===9)||e.cancelPendingCommit!==null)return r!==null&&r!==null&&Xe(r),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||bt(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(r!==null&&Xe(r),jt(n)){case 2:case 8:n=nt;break;case 32:n=rt;break;case 268435456:n=at;break;default:n=rt}return r=Wf.bind(null,e),n=Ye(n,r),e.callbackPriority=t,e.callbackNode=n,t}return r!==null&&r!==null&&Xe(r),e.callbackPriority=2,e.callbackNode=null,2}function Wf(e,t){if(jd!==0&&jd!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(Cf()&&e.callbackNode!==n)return null;var r=R;return r=yt(e,e===ud?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r===0?null:(qd(e,r,t),Uf(e,$e()),e.callbackNode!=null&&e.callbackNode===n?Wf.bind(null,e):null)}function Gf(e,t){if(Cf())return null;qd(e,t,!0)}function Kf(){Np(function(){I&6?Ye(tt,Vf):Hf()})}function qf(){if(Rf===0){var e=qa;e===0&&(e=ht,ht<<=1,!(ht&261888)&&(ht=256)),Rf=e}return Rf}function Jf(e){return e==null||typeof e==`symbol`||typeof e==`boolean`?null:typeof e==`function`?e:kn(e)}function Yf(e,t,n,r,i){if(t===`submit`&&n&&n.stateNode===i){var a=Jf((i[It]||null).action),o=r.submitter;o&&(t=(t=o[It]||null)?Jf(t.formAction):o.getAttribute(`formAction`),t!==null&&(a=t,o=null));var s=new Xn(`action`,`action`,null,r,i);e.push({event:s,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(Rf!==0){var e=new FormData(i,o);cc(n,{pending:!0,data:e,method:i.method,action:a},null,e)}}else typeof a==`function`&&(s.preventDefault(),e=new FormData(i,o),cc(n,{pending:!0,data:e,method:i.method,action:a},a,e))},currentTarget:i}]})}}for(var Xf=0;Xf<wi.length;Xf++){var Zf=wi[Xf];Ti(Zf.toLowerCase(),`on`+(Zf[0].toUpperCase()+Zf.slice(1)))}Ti(gi,`onAnimationEnd`),Ti(_i,`onAnimationIteration`),Ti(vi,`onAnimationStart`),Ti(`dblclick`,`onDoubleClick`),Ti(`focusin`,`onFocus`),Ti(`focusout`,`onBlur`),Ti(yi,`onTransitionRun`),Ti(bi,`onTransitionStart`),Ti(xi,`onTransitionCancel`),Ti(Si,`onTransitionEnd`),E(`onMouseEnter`,[`mouseout`,`mouseover`]),E(`onMouseLeave`,[`mouseout`,`mouseover`]),E(`onPointerEnter`,[`pointerout`,`pointerover`]),E(`onPointerLeave`,[`pointerout`,`pointerover`]),$t(`onChange`,`change click focusin focusout input keydown keyup selectionchange`.split(` `)),$t(`onSelect`,`focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange`.split(` `)),$t(`onBeforeInput`,[`compositionend`,`keypress`,`textInput`,`paste`]),$t(`onCompositionEnd`,`compositionend focusout keydown keypress keyup mousedown`.split(` `)),$t(`onCompositionStart`,`compositionstart focusout keydown keypress keyup mousedown`.split(` `)),$t(`onCompositionUpdate`,`compositionupdate focusout keydown keypress keyup mousedown`.split(` `));var Qf=`abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting`.split(` `),$f=new Set(`beforetoggle cancel close invalid load scroll scrollend toggle`.split(` `).concat(Qf));function ep(e,t){t=!!(t&4);for(var n=0;n<e.length;n++){var r=e[n],i=r.event;r=r.listeners;a:{var a=void 0;if(t)for(var o=r.length-1;0<=o;o--){var s=r[o],c=s.instance,l=s.currentTarget;if(s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){Ai(e)}i.currentTarget=null,a=c}else for(o=0;o<r.length;o++){if(s=r[o],c=s.instance,l=s.currentTarget,s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){Ai(e)}i.currentTarget=null,a=c}}}}function z(e,t){var n=t[Rt];n===void 0&&(n=t[Rt]=new Set);var r=e+`__bubble`;n.has(r)||(ip(t,e,2,!1),n.add(r))}function tp(e,t,n){var r=0;t&&(r|=4),ip(n,e,r,t)}var np=`_reactListening`+Math.random().toString(36).slice(2);function rp(e){if(!e[np]){e[np]=!0,Zt.forEach(function(t){t!==`selectionchange`&&($f.has(t)||tp(t,!1,e),tp(t,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[np]||(t[np]=!0,tp(`selectionchange`,!1,t))}}function ip(e,t,n,r){switch(Th(t)){case 2:var i=yh;break;case 8:i=bh;break;default:i=xh}n=i.bind(null,t,n,e),i=void 0,!Bn||t!==`touchstart`&&t!==`touchmove`&&t!==`wheel`||(i=!0),r?i===void 0?e.addEventListener(t,n,!0):e.addEventListener(t,n,{capture:!0,passive:i}):i===void 0?e.addEventListener(t,n,!1):e.addEventListener(t,n,{passive:i})}function ap(e,t,n,r,i){var a=r;if(!(t&1)&&!(t&2)&&r!==null)a:for(;;){if(r===null)return;var o=r.tag;if(o===3||o===4){var s=r.stateNode.containerInfo;if(s===i)break;if(o===4)for(o=r.return;o!==null;){var c=o.tag;if((c===3||c===4)&&o.stateNode.containerInfo===i)return;o=o.return}for(;s!==null;){if(o=Gt(s),o===null)return;if(c=o.tag,c===5||c===6||c===26||c===27){r=a=o;continue a}s=s.parentNode}}r=r.return}Ln(function(){var r=a,i=Mn(n),o=[];a:{var s=Ci.get(e);if(s!==void 0){var c=Xn,u=e;switch(e){case`keypress`:if(Gn(n)===0)break a;case`keydown`:case`keyup`:c=mr;break;case`focusin`:u=`focus`,c=ar;break;case`focusout`:u=`blur`,c=ar;break;case`beforeblur`:case`afterblur`:c=ar;break;case`click`:if(n.button===2)break a;case`auxclick`:case`dblclick`:case`mousedown`:case`mousemove`:case`mouseup`:case`mouseout`:case`mouseover`:case`contextmenu`:c=rr;break;case`drag`:case`dragend`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`dragstart`:case`drop`:c=ir;break;case`touchcancel`:case`touchend`:case`touchmove`:case`touchstart`:c=_r;break;case gi:case _i:case vi:c=or;break;case Si:c=vr;break;case`scroll`:case`scrollend`:c=Qn;break;case`wheel`:c=yr;break;case`copy`:case`cut`:case`paste`:c=sr;break;case`gotpointercapture`:case`lostpointercapture`:case`pointercancel`:case`pointerdown`:case`pointermove`:case`pointerout`:case`pointerover`:case`pointerup`:c=hr;break;case`submit`:c=gr;break;case`toggle`:case`beforetoggle`:c=br}var d=!!(t&4),f=!d&&(e===`scroll`||e===`scrollend`),p=d?s===null?null:s+`Capture`:s;d=[];for(var m=r,h;m!==null;){var g=m;if(h=g.stateNode,g=g.tag,g!==5&&g!==26&&g!==27||h===null||p===null||(g=Rn(m,p),g!=null&&d.push(op(m,g,h))),f)break;m=m.return}0<d.length&&(s=new c(s,u,null,n,i),o.push({event:s,listeners:d}))}}if(!(t&7)){a:{if(c=e===`mouseover`||e===`pointerover`,s=e===`mouseout`||e===`pointerout`,c&&n!==jn&&(u=n.relatedTarget||n.fromElement)&&(Gt(u)||u[Lt]))break a;(s||c)&&(u=i.window===i?i:(c=i.ownerDocument)?c.defaultView||c.parentWindow:window,s?(c=n.relatedTarget||n.toElement,s=r,c=c?Gt(c):null,c!==null&&(f=l(c),d=c.tag,c!==f||d!==5&&d!==27&&d!==6)&&(c=null)):(s=null,c=r),s!==c&&(d=rr,g=`onMouseLeave`,p=`onMouseEnter`,m=`mouse`,(e===`pointerout`||e===`pointerover`)&&(d=hr,g=`onPointerLeave`,p=`onPointerEnter`,m=`pointer`),f=s==null?u:qt(s),h=c==null?u:qt(c),u=new d(g,m+`leave`,s,n,i),u.target=f,u.relatedTarget=h,g=null,Gt(i)===r&&(d=new d(p,m+`enter`,c,n,i),d.target=h,d.relatedTarget=f,g=d),f=g,d=s&&c?re(s,c,B):null,s!==null&&cp(o,u,s,d,!1),c!==null&&f!==null&&cp(o,f,c,d,!0)))}a:{if(s=r?qt(r):window,c=s.nodeName&&s.nodeName.toLowerCase(),c===`select`||c===`input`&&s.type===`file`)var _=zr;else if(Nr(s)){if(Br)_=Yr;else{_=qr;var v=Kr}}else c=s.nodeName,!c||c.toLowerCase()!==`input`||s.type!==`checkbox`&&s.type!==`radio`?r&&En(r.elementType)&&(_=zr):_=Jr;if(_&&=_(e,r)){Pr(o,_,n,i);break a}v&&v(e,s,r)}switch(v=r?qt(r):window,e){case`focusin`:(Nr(v)||v.contentEditable===`true`)&&(oi=v,si=r,ci=null);break;case`focusout`:ci=si=oi=null;break;case`mousedown`:li=!0;break;case`contextmenu`:case`mouseup`:case`dragend`:li=!1,ui(o,n,i);break;case`selectionchange`:if(ai)break;case`keydown`:case`keyup`:ui(o,n,i)}var y;if(Sr)b:{switch(e){case`compositionstart`:var b=`onCompositionStart`;break b;case`compositionend`:b=`onCompositionEnd`;break b;case`compositionupdate`:b=`onCompositionUpdate`;break b}b=void 0}else Ar?Or(e,n)&&(b=`onCompositionEnd`):e===`keydown`&&n.keyCode===229&&(b=`onCompositionStart`);b&&(Tr&&n.locale!==`ko`&&(Ar||b!==`onCompositionStart`?b===`onCompositionEnd`&&Ar&&(y=Wn()):(Hn=i,O=`value`in Hn?Hn.value:Hn.textContent,Ar=!0)),v=sp(r,b),0<v.length&&(b=new cr(b,e,null,n,i),o.push({event:b,listeners:v}),y?b.data=y:(y=kr(n),y!==null&&(b.data=y)))),(y=wr?k(e,n):jr(e,n))&&(b=sp(r,`onBeforeInput`),0<b.length&&(v=new cr(`onBeforeInput`,`beforeinput`,null,n,i),o.push({event:v,listeners:b}),v.data=y)),Yf(o,e,r,n,i)}ep(o,t)})}function op(e,t,n){return{instance:e,listener:t,currentTarget:n}}function sp(e,t){for(var n=t+`Capture`,r=[];e!==null;){var i=e,a=i.stateNode;if(i=i.tag,i!==5&&i!==26&&i!==27||a===null||(i=Rn(e,n),i!=null&&r.unshift(op(e,i,a)),i=Rn(e,t),i!=null&&r.push(op(e,i,a))),e.tag===3)return r;e=e.return}return[]}function B(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function cp(e,t,n,r,i){for(var a=t._reactName,o=[];n!==null&&n!==r;){var s=n,c=s.alternate,l=s.stateNode;if(s=s.tag,c!==null&&c===r)break;s!==5&&s!==26&&s!==27||l===null||(c=l,i?(l=Rn(n,a),l!=null&&o.unshift(op(n,l,c))):i||(l=Rn(n,a),l!=null&&o.push(op(n,l,c)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var lp=/\r\n?/g,up=/\u0000|\uFFFD/g;function dp(e){return(typeof e==`string`?e:``+e).replace(lp,`
9
- `).replace(up,``)}function fp(e,t){return t=dp(t),dp(e)===t}function pp(e,t,n,r,i,a){switch(n){case`children`:if(typeof r==`string`)t===`body`||t===`textarea`&&r===``||Sn(e,r);else if(typeof r==`number`||typeof r==`bigint`)t!==`body`&&Sn(e,``+r);else return;break;case`className`:sn(e,`class`,r);break;case`tabIndex`:sn(e,`tabindex`,r);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:sn(e,n,r);break;case`style`:Tn(e,r,a);return;case`data`:if(t!==`object`){sn(e,`data`,r);break}case`src`:case`href`:if(r===``&&(t!==`a`||n!==`href`)){e.removeAttribute(n);break}if(r==null||typeof r==`function`||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=kn(r),e.setAttribute(n,r);break;case`action`:case`formAction`:if(typeof r==`function`){e.setAttribute(n,`javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')`);break}if(typeof a==`function`&&(n===`formAction`?(t!==`input`&&pp(e,t,`name`,i.name,i,null),pp(e,t,`formEncType`,i.formEncType,i,null),pp(e,t,`formMethod`,i.formMethod,i,null),pp(e,t,`formTarget`,i.formTarget,i,null)):(pp(e,t,`encType`,i.encType,i,null),pp(e,t,`method`,i.method,i,null),pp(e,t,`target`,i.target,i,null))),r==null||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=kn(r),e.setAttribute(n,r);break;case`onClick`:r!=null&&(e.onclick=An);return;case`onScroll`:r!=null&&z(`scroll`,e);return;case`onScrollEnd`:r!=null&&z(`scrollend`,e);return;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(o(61));if(n=r.__html,n!=null){if(i.children!=null)throw Error(o(60));a?.__html!==n&&(e.innerHTML=n)}}break;case`multiple`:e.multiple=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`muted`:e.muted=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`defaultValue`:case`defaultChecked`:case`innerHTML`:case`ref`:break;case`autoFocus`:break;case`xlinkHref`:if(r==null||typeof r==`function`||typeof r==`boolean`||typeof r==`symbol`){e.removeAttribute(`xlink:href`);break}n=kn(r),e.setAttributeNS(`http://www.w3.org/1999/xlink`,`xlink:href`,n);break;case`contentEditable`:case`spellCheck`:case`draggable`:case`value`:case`autoReverse`:case`externalResourcesRequired`:case`focusable`:case`preserveAlpha`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,r):e.removeAttribute(n);break;case`inert`:case`allowFullScreen`:case`async`:case`autoPlay`:case`controls`:case`credentialless`:case`default`:case`defer`:case`disabled`:case`disablePictureInPicture`:case`disableRemotePlayback`:case`formNoValidate`:case`hidden`:case`loop`:case`noModule`:case`noValidate`:case`open`:case`playsInline`:case`readOnly`:case`required`:case`reversed`:case`scoped`:case`seamless`:case`itemScope`:r&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``):e.removeAttribute(n);break;case`capture`:case`download`:!0===r?e.setAttribute(n,``):!1!==r&&r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,r):e.removeAttribute(n);break;case`cols`:case`rows`:case`size`:case`span`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`&&!isNaN(r)&&1<=r?e.setAttribute(n,r):e.removeAttribute(n);break;case`rowSpan`:case`start`:r==null||typeof r==`function`||typeof r==`symbol`||isNaN(r)?e.removeAttribute(n):e.setAttribute(n,r);break;case`popover`:z(`beforetoggle`,e),z(`toggle`,e),on(e,`popover`,r);break;case`xlinkActuate`:cn(e,`http://www.w3.org/1999/xlink`,`xlink:actuate`,r);break;case`xlinkArcrole`:cn(e,`http://www.w3.org/1999/xlink`,`xlink:arcrole`,r);break;case`xlinkRole`:cn(e,`http://www.w3.org/1999/xlink`,`xlink:role`,r);break;case`xlinkShow`:cn(e,`http://www.w3.org/1999/xlink`,`xlink:show`,r);break;case`xlinkTitle`:cn(e,`http://www.w3.org/1999/xlink`,`xlink:title`,r);break;case`xlinkType`:cn(e,`http://www.w3.org/1999/xlink`,`xlink:type`,r);break;case`xmlBase`:cn(e,`http://www.w3.org/XML/1998/namespace`,`xml:base`,r);break;case`xmlLang`:cn(e,`http://www.w3.org/XML/1998/namespace`,`xml:lang`,r);break;case`xmlSpace`:cn(e,`http://www.w3.org/XML/1998/namespace`,`xml:space`,r);break;case`is`:on(e,`is`,r);break;case`innerText`:case`textContent`:return;default:if(!(2<n.length)||n[0]!==`o`&&n[0]!==`O`||n[1]!==`n`&&n[1]!==`N`)n=Dn.get(n)||n,on(e,n,r);else return}D=!0}function mp(e,t,n,r,i,a){switch(n){case`style`:Tn(e,r,a);return;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(o(61));if(n=r.__html,n!=null){if(i.children!=null)throw Error(o(60));a?.__html!==n&&(e.innerHTML=n)}}break;case`children`:if(typeof r==`string`)Sn(e,r);else if(typeof r==`number`||typeof r==`bigint`)Sn(e,``+r);else return;break;case`onScroll`:r!=null&&z(`scroll`,e);return;case`onScrollEnd`:r!=null&&z(`scrollend`,e);return;case`onClick`:r!=null&&(e.onclick=An);return;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`innerHTML`:case`ref`:return;case`innerText`:case`textContent`:return;default:if(!Qt.hasOwnProperty(n))a:{if(n[0]===`o`&&n[1]===`n`&&(i=n.endsWith(`Capture`),a=n.slice(2,i?n.length-7:void 0),t=e[It]||null,t=t==null?null:t[n],typeof t==`function`&&e.removeEventListener(a,t,i),typeof r==`function`)){typeof t!=`function`&&t!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(a,r,i);break a}D=!0,n in e?e[n]=r:!0===r?e.setAttribute(n,``):on(e,n,r)}return}D=!0}function hp(e,t,n){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`img`:z(`error`,e),z(`load`,e);var r=!1,i=!1,a;for(a in n)if(n.hasOwnProperty(a)){var s=n[a];if(s!=null)switch(a){case`src`:r=!0;break;case`srcSet`:i=!0;break;case`children`:case`dangerouslySetInnerHTML`:throw Error(o(137,t));default:pp(e,t,a,s,n,null)}}i&&pp(e,t,`srcSet`,n.srcSet,n,null),r&&pp(e,t,`src`,n.src,n,null);return;case`input`:z(`invalid`,e);var c=a=s=i=null,l=null,u=null;for(r in n)if(n.hasOwnProperty(r)){var d=n[r];if(d!=null)switch(r){case`name`:i=d;break;case`type`:s=d;break;case`checked`:l=d;break;case`defaultChecked`:u=d;break;case`value`:a=d;break;case`defaultValue`:c=d;break;case`children`:case`dangerouslySetInnerHTML`:if(d!=null)throw Error(o(137,t));break;default:pp(e,t,r,d,n,null)}}_n(e,a,c,l,u,s,i,!1);return;case`select`:for(i in z(`invalid`,e),r=s=a=null,n)if(n.hasOwnProperty(i)&&(c=n[i],c!=null))switch(i){case`value`:a=c;break;case`defaultValue`:s=c;break;case`multiple`:r=c;default:pp(e,t,i,c,n,null)}t=a,n=s,e.multiple=!!r,t==null?n!=null&&yn(e,!!r,n,!0):yn(e,!!r,t,!1);return;case`textarea`:for(s in z(`invalid`,e),a=i=r=null,n)if(n.hasOwnProperty(s)&&(c=n[s],c!=null))switch(s){case`value`:r=c;break;case`defaultValue`:i=c;break;case`children`:a=c;break;case`dangerouslySetInnerHTML`:if(c!=null)throw Error(o(91));break;default:pp(e,t,s,c,n,null)}xn(e,r,i,a);return;case`option`:for(l in n)if(n.hasOwnProperty(l)&&(r=n[l],r!=null))switch(l){case`selected`:e.selected=r&&typeof r!=`function`&&typeof r!=`symbol`;break;default:pp(e,t,l,r,n,null)}return;case`dialog`:z(`beforetoggle`,e),z(`toggle`,e),z(`cancel`,e),z(`close`,e);break;case`iframe`:case`object`:z(`load`,e);break;case`video`:case`audio`:for(r=0;r<Qf.length;r++)z(Qf[r],e);break;case`image`:z(`error`,e),z(`load`,e);break;case`details`:z(`toggle`,e);break;case`embed`:case`source`:case`link`:z(`error`,e),z(`load`,e);case`area`:case`base`:case`br`:case`col`:case`hr`:case`keygen`:case`meta`:case`param`:case`track`:case`wbr`:case`menuitem`:for(u in n)if(n.hasOwnProperty(u)&&(r=n[u],r!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:throw Error(o(137,t));default:pp(e,t,u,r,n,null)}return;default:if(En(t)){for(d in n)n.hasOwnProperty(d)&&(r=n[d],r!==void 0&&mp(e,t,d,r,n,void 0));return}}for(c in n)n.hasOwnProperty(c)&&(r=n[c],r!=null&&pp(e,t,c,r,n,null))}var gp={};function _p(e,t,n,r){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`input`:var i=null,a=null,s=null,c=null,l=null,u=null,d=null;for(m in n){var f=n[m];if(n.hasOwnProperty(m)&&f!=null)switch(m){case`checked`:break;case`value`:break;case`defaultValue`:l=f;default:r.hasOwnProperty(m)||pp(e,t,m,null,r,f)}}for(var p in r){var m=r[p];if(f=n[p],r.hasOwnProperty(p)&&(m!=null||f!=null))switch(p){case`type`:m!==f&&(D=!0),a=m;break;case`name`:m!==f&&(D=!0),i=m;break;case`checked`:m!==f&&(D=!0),u=m;break;case`defaultChecked`:m!==f&&(D=!0),d=m;break;case`value`:m!==f&&(D=!0),s=m;break;case`defaultValue`:m!==f&&(D=!0),c=m;break;case`children`:case`dangerouslySetInnerHTML`:if(m!=null)throw Error(o(137,t));break;default:m!==f&&pp(e,t,p,m,r,f)}}gn(e,s,c,l,u,d,a,i);return;case`select`:for(a in m=s=c=p=null,n)if(l=n[a],n.hasOwnProperty(a)&&l!=null)switch(a){case`value`:break;case`multiple`:m=l;default:r.hasOwnProperty(a)||pp(e,t,a,null,r,l)}for(i in r)if(a=r[i],l=n[i],r.hasOwnProperty(i)&&(a!=null||l!=null))switch(i){case`value`:a!==l&&(D=!0),p=a;break;case`defaultValue`:a!==l&&(D=!0),c=a;break;case`multiple`:a!==l&&(D=!0),s=a;default:a!==l&&pp(e,t,i,a,r,l)}t=c,n=s,r=m,p==null?!!r!=!!n&&(t==null?yn(e,!!n,n?[]:``,!1):yn(e,!!n,t,!0)):yn(e,!!n,p,!1);return;case`textarea`:for(c in m=p=null,n)if(i=n[c],n.hasOwnProperty(c)&&i!=null&&!r.hasOwnProperty(c))switch(c){case`value`:break;case`children`:break;default:pp(e,t,c,null,r,i)}for(s in r)if(i=r[s],a=n[s],r.hasOwnProperty(s)&&(i!=null||a!=null))switch(s){case`value`:i!==a&&(D=!0),p=i;break;case`defaultValue`:i!==a&&(D=!0),m=i;break;case`children`:break;case`dangerouslySetInnerHTML`:if(i!=null)throw Error(o(91));break;default:i!==a&&pp(e,t,s,i,r,a)}bn(e,p,m);return;case`option`:for(var h in n)if(p=n[h],n.hasOwnProperty(h)&&p!=null&&!r.hasOwnProperty(h))switch(h){case`selected`:e.selected=!1;break;default:pp(e,t,h,null,r,p)}for(l in r)if(p=r[l],m=n[l],r.hasOwnProperty(l)&&p!==m&&(p!=null||m!=null))switch(l){case`selected`:p!==m&&(D=!0),e.selected=p&&typeof p!=`function`&&typeof p!=`symbol`;break;default:pp(e,t,l,p,r,m)}return;case`img`:case`link`:case`area`:case`base`:case`br`:case`col`:case`embed`:case`hr`:case`keygen`:case`meta`:case`param`:case`source`:case`track`:case`wbr`:case`menuitem`:for(var g in n)p=n[g],n.hasOwnProperty(g)&&p!=null&&!r.hasOwnProperty(g)&&pp(e,t,g,null,r,p);for(u in r)if(p=r[u],m=n[u],r.hasOwnProperty(u)&&p!==m&&(p!=null||m!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:if(p!=null)throw Error(o(137,t));break;default:pp(e,t,u,p,r,m)}return;default:if(En(t)){for(var _ in n)p=n[_],n.hasOwnProperty(_)&&p!==void 0&&!r.hasOwnProperty(_)&&mp(e,t,_,void 0,r,p);for(d in r)p=r[d],m=n[d],!r.hasOwnProperty(d)||p===m||p===void 0&&m===void 0||mp(e,t,d,p,r,m);return}}for(var v in n)p=n[v],n.hasOwnProperty(v)&&p!=null&&!r.hasOwnProperty(v)&&pp(e,t,v,null,r,p);for(f in r)p=r[f],m=n[f],!r.hasOwnProperty(f)||p===m||p==null&&m==null||pp(e,t,f,p,r,m)}function vp(e){switch(e){case`css`:case`script`:case`font`:case`img`:case`image`:case`input`:case`link`:return!0;default:return!1}}function yp(){if(typeof performance.getEntriesByType==`function`){for(var e=0,t=0,n=performance.getEntriesByType(`resource`),r=0;r<n.length;r++){var i=n[r],a=i.transferSize,o=i.initiatorType,s=i.duration;if(a&&s&&vp(o)){for(o=0,s=i.responseEnd,r+=1;r<n.length;r++){var c=n[r],l=c.startTime;if(l>s)break;var u=c.transferSize,d=c.initiatorType;u&&vp(d)&&(c=c.responseEnd,o+=u*(c<s?1:(s-l)/(c-l)))}if(--r,t+=8*(a+o)/(i.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e==`number`)?e:5}var bp=null,xp=null;function Sp(e){return e.nodeType===9?e:e.ownerDocument}function Cp(e){switch(e){case`http://www.w3.org/2000/svg`:return 1;case`http://www.w3.org/1998/Math/MathML`:return 2;default:return 0}}function wp(e,t){if(e===0)switch(t){case`svg`:return 1;case`math`:return 2;default:return 0}return e===1&&t===`foreignObject`?0:e}function Tp(e,t,n,r){return n=Sp(n).createElement(e),n[Ft]=r,n[It]=t,hp(n,e,t),Yt(n),n}function Ep(e,t){return e===`textarea`||e===`noscript`||typeof t.children==`string`||typeof t.children==`number`||typeof t.children==`bigint`||typeof t.dangerouslySetInnerHTML==`object`&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Dp=null;function Op(){var e=window.event;return e&&e.type===`popstate`?e!==Dp&&(Dp=e,!0):(Dp=null,!1)}var kp=typeof setTimeout==`function`?setTimeout:void 0,Ap=typeof clearTimeout==`function`?clearTimeout:void 0,jp=typeof Promise==`function`?Promise:void 0,Mp=typeof requestAnimationFrame==`function`?requestAnimationFrame:kp,Np=typeof queueMicrotask==`function`?queueMicrotask:jp===void 0?kp:function(e){return jp.resolve(null).then(e).catch(Pp)};function Pp(e){setTimeout(function(){throw e})}function V(e){return e===`head`}function Fp(e,t){var n=t,r=0;do{var i=n.nextSibling;if(e.removeChild(n),i&&i.nodeType===8){if(n=i.data,n===`/$`||n===`/&`){if(r===0){e.removeChild(i),Wh(t);return}r--}else if(n===`$`||n===`$?`||n===`$~`||n===`$!`||n===`&`)r++;else if(n===`html`)ym(e.ownerDocument.documentElement);else if(n===`head`){n=e.ownerDocument.head,ym(n);for(var a=n.firstChild;a;){var o=a.nextSibling,s=a.nodeName;a[Ht]||s===`SCRIPT`||s===`STYLE`||s===`LINK`&&a.rel.toLowerCase()===`stylesheet`||n.removeChild(a),a=o}}else n===`body`&&ym(e.ownerDocument.body)}n=i}while(n);Wh(t)}function Ip(e,t){var n=e;e=0;do{var r=n.nextSibling;if(n.nodeType===1?t?(n._stashedDisplay=n.style.display,n.style.display=`none`):(n.style.display=n._stashedDisplay||``,n.getAttribute(`style`)===``&&n.removeAttribute(`style`)):n.nodeType===3&&(t?(n._stashedText=n.nodeValue,n.nodeValue=``):n.nodeValue=n._stashedText||``),r&&r.nodeType===8){if(n=r.data,n===`/$`){if(e===0)break;e--}else n!==`$`&&n!==`$?`&&n!==`$~`&&n!==`$!`||e++}n=r}while(n)}function Lp(e,t,n){if(t=CSS.escape(t)===t?t:`r-`+btoa(t).replace(/=/g,``),e.style.viewTransitionName=t,n!=null&&(e.style.viewTransitionClass=n),n=getComputedStyle(e),n.display===`inline`){if(t=e.getClientRects(),t.length===1)var r=1;else for(var i=r=0;i<t.length;i++){var a=t[i];0<a.width&&0<a.height&&r++}r===1&&(e=e.style,e.display=t.length===1?`inline-block`:`block`,e.marginTop=`-`+n.paddingTop,e.marginBottom=`-`+n.paddingBottom)}}function H(e,t){e=e.style,t=t.style;var n=t==null?null:t.hasOwnProperty(`viewTransitionName`)?t.viewTransitionName:t.hasOwnProperty(`view-transition-name`)?t[`view-transition-name`]:null;e.viewTransitionName=n==null||typeof n==`boolean`?``:(``+n).trim(),n=t==null?null:t.hasOwnProperty(`viewTransitionClass`)?t.viewTransitionClass:t.hasOwnProperty(`view-transition-class`)?t[`view-transition-class`]:null,e.viewTransitionClass=n==null||typeof n==`boolean`?``:(``+n).trim(),e.display===`inline-block`&&(t==null?e.display=e.margin=``:(n=t.display,e.display=n==null||typeof n==`boolean`?``:n,n=t.margin,n==null?(n=t.hasOwnProperty(`marginTop`)?t.marginTop:t[`margin-top`],e.marginTop=n==null||typeof n==`boolean`?``:n,t=t.hasOwnProperty(`marginBottom`)?t.marginBottom:t[`margin-bottom`],e.marginBottom=t==null||typeof t==`boolean`?``:t):e.margin=n))}function Rp(e,t,n){return n=n.ownerDocument.defaultView,{rect:e,abs:t.position===`absolute`||t.position===`fixed`,clip:t.clipPath!==`none`||t.overflow!==`visible`||t.filter!==`none`||t.mask!==`none`||t.mask!==`none`||t.borderRadius!==`0px`,view:0<=e.bottom&&0<=e.right&&e.top<=n.innerHeight&&e.left<=n.innerWidth}}function zp(e){return Rp(e.getBoundingClientRect(),getComputedStyle(e),e)}function Bp(e){var t=e.getBoundingClientRect();t=new DOMRect(t.x+2e4,t.y+2e4,t.width,t.height);var n=getComputedStyle(e);return Rp(t,n,e)}function Vp(e){return e.documentElement.clientHeight}function Hp(e){this.addEventListener(`load`,e),this.addEventListener(`error`,e)}function Up(e,t,n,r,i,a,o,s,c){var l=t.nodeType===9?t:t.ownerDocument;try{var u=l.startViewTransition({update:function(){var t=l.defaultView,n=t.navigation&&t.navigation.transition,o=l.fonts.status;r();var s=[];if(o===`loaded`&&(Vp(l),l.fonts.status===`loading`&&s.push(l.fonts.ready)),o=s.length,e!==null)for(var c=e.suspenseyImages,u=0,d=0;d<c.length;d++){var f=c[d];if(!f.complete){var p=f.getBoundingClientRect();if(0<p.bottom&&0<p.right&&p.top<t.innerHeight&&p.left<t.innerWidth){if(u+=Qm(f),u>th){s.length=o;break}f=new Promise(Hp.bind(f)),s.push(f)}}}if(0<s.length)return t=Promise.race([Promise.all(s),new Promise(function(e){return setTimeout(e,500)})]).then(i,i),(n?Promise.allSettled([n.finished,t]):t).then(a,a);if(i(),n)return n.finished.then(a,a);a()},types:n});l.__reactViewTransition=u;var d=[];return u.ready.then(function(){for(var e=l.documentElement.getAnimations({subtree:!0}),t=0;t<e.length;t++){var n=e[t],r=n.effect,i=r.pseudoElement;if(i!=null&&i.startsWith(`::view-transition`)){d.push(n),n=r.getKeyframes();for(var a=i=void 0,s=!0,c=0;c<n.length;c++){var u=n[c],f=u.width;if(i===void 0)i=f;else if(i!==f){s=!1;break}if(f=u.height,a===void 0)a=f;else if(a!==f){s=!1;break}delete u.width,delete u.height,u.transform===`none`&&delete u.transform}s&&i!==void 0&&a!==void 0&&(r.setKeyframes(n),s=getComputedStyle(r.target,r.pseudoElement),s.width!==i||s.height!==a)&&(s=n[0],s.width=i,s.height=a,s=n[n.length-1],s.width=i,s.height=a,r.setKeyframes(n))}}o()},function(e){l.__reactViewTransition===u&&(l.__reactViewTransition=null);try{if(typeof e==`object`&&e)switch(e.name){case`InvalidStateError`:(e.message===`View transition was skipped because document visibility state is hidden.`||e.message===`Skipping view transition because document visibility state has become hidden.`||e.message===`Skipping view transition because viewport size changed.`||e.message===`Transition was aborted because of invalid state`)&&(e=null)}e!==null&&c(e)}finally{r(),i(),o()}}),u.finished.finally(function(){for(var e=0;e<d.length;e++)d[e].cancel();l.__reactViewTransition===u&&(l.__reactViewTransition=null),s()}),u}catch{return r(),i(),o(),null}}function Wp(e,t){this._scope=document.documentElement,this._selector=`::view-transition-`+e+`(`+t+`)`}Wp.prototype.animate=function(e,t){return t=typeof t==`number`?{duration:t}:C({},t),t.pseudoElement=this._selector,this._scope.animate(e,t)},Wp.prototype.getAnimations=function(){for(var e=this._scope,t=this._selector,n=e.getAnimations({subtree:!0}),r=[],i=0;i<n.length;i++){var a=n[i].effect;a!==null&&a.target===e&&a.pseudoElement===t&&r.push(n[i])}return r},Wp.prototype.getComputedStyle=function(){return getComputedStyle(this._scope,this._selector)};function U(e){return{name:e,group:new Wp(`group`,e),imagePair:new Wp(`image-pair`,e),old:new Wp(`old`,e),new:new Wp(`new`,e)}}function Gp(e){this._fragmentFiber=e,this._observers=this._eventListeners=null}Gp.prototype.addEventListener=function(e,t,n){var r=null,i=null;if(!(n!=null&&typeof n!=`boolean`&&(r=n.signal||null,r!==null&&r.aborted))){this._eventListeners===null&&(this._eventListeners=[]);var a=this._eventListeners;if(G(a,e,t,n)===-1){var o=this,s=t;n!=null&&typeof n!=`boolean`&&!0===n.once&&(s=function(r){o.removeEventListener(e,t,n),typeof t==`function`?t.call(this,r):t.handleEvent(r)}),r!==null&&(i=o.removeEventListener.bind(o,e,t,n),r.addEventListener(`abort`,i,{once:!0}),i=r.removeEventListener.bind(r,`abort`,i)),r=W(n),a.push({type:e,listener:t,optionsOrUseCapture:n,attachedListener:s,cleanup:i}),h(this._fragmentFiber.child,!1,Kp,e,s,r)}this._eventListeners=a}};function Kp(e,t,n,r){return b(e).addEventListener(t,n,r),!1}Gp.prototype.removeEventListener=function(e,t,n){var r=this._eventListeners;if(r!==null&&(t=G(r,e,t,n),t!==-1)){var i=r[t];n=i.attachedListener;var a=i.cleanup;i=W(i.optionsOrUseCapture),h(this._fragmentFiber.child,!1,qp,e,n,i),r.splice(t,1),a!==null&&a()}};function qp(e,t,n,r){return b(e).removeEventListener(t,n,r),!1}function W(e){return e!=null&&typeof e!=`boolean`&&(!0===e.once||e.signal instanceof AbortSignal)?{capture:e.capture,passive:e.passive}:e}function Jp(e){return e==null?`c=0`:typeof e==`boolean`?`c=`+(e?`1`:`0`):`c=`+(e.capture?`1`:`0`)}function G(e,t,n,r){if(e.length===0)return-1;r=Jp(r);for(var i=0;i<e.length;i++){var a=e[i];if(a.type===t&&a.listener===n&&Jp(a.optionsOrUseCapture)===r)return i}return-1}Gp.prototype.dispatchEvent=function(e){var t=g(this._fragmentFiber);if(t===null)return!0;t=b(t);var n=this._eventListeners;if(n!==null&&0<n.length||!e.bubbles){var r=t.nodeType===9?t.createComment(``):document.createTextNode(``);if(n)for(var i=0;i<n.length;i++){var a=n[i];r.addEventListener(a.type,a.attachedListener,W(a.optionsOrUseCapture))}if(t.appendChild(r),e=r.dispatchEvent(e),n)for(i=0;i<n.length;i++)a=n[i],r.removeEventListener(a.type,a.attachedListener,W(a.optionsOrUseCapture));return t.removeChild(r),e}return t.dispatchEvent(e)},Gp.prototype.focus=function(e){h(this._fragmentFiber.child,!0,K,e,void 0,void 0)};function K(e,t){return e.tag!==6&&(e=b(e),hm(e,t))}Gp.prototype.focusLast=function(e){var t=[];h(this._fragmentFiber.child,!0,Yp,t,void 0,void 0);for(var n=t.length-1;0<=n&&!K(t[n],e);n--);};function Yp(e,t){return t.push(e),!1}Gp.prototype.blur=function(){var e=g(this._fragmentFiber);e!==null&&(e=b(e),e=Sp(e).activeElement,e!==null&&h(this._fragmentFiber.child,!1,q,e,void 0,void 0))};function q(e,t){return e.tag!==6&&(e=b(e),e===t||e.contains(t)?(t.blur(),!0):!1)}Gp.prototype.observeUsing=function(e){this._observers===null&&(this._observers=new Set),this._observers.add(e),h(this._fragmentFiber.child,!1,Xp,e,void 0,void 0)};function Xp(e,t){return e.tag!==6&&(e=b(e),t.observe(e),!1)}Gp.prototype.unobserveUsing=function(e){var t=this._observers;if(t!==null&&t.has(e)){t.delete(e),h(this._fragmentFiber.child,!1,Zp,e,void 0,void 0);for(var n=t=0;n<Qp.length;n++){var r=Qp[n];r.fragmentInstance===this&&r.observer===e?e.unobserve(r.instance):Qp[t++]=r}Qp.length=t}};function Zp(e,t){return e.tag!==6&&(e=b(e),t.unobserve(e),!1)}var Qp=[],$p=!1;function em(e,t,n){Qp.push({fragmentInstance:e,observer:t,instance:n}),$p||($p=!0,gm(function(){$p=!1;var e=Qp;Qp=[];for(var t=0;t<e.length;t++){var n=e[t];n.observer.unobserve(n.instance)}}))}Gp.prototype.getClientRects=function(){var e=[];return h(this._fragmentFiber.child,!1,J,e,void 0,void 0),e};function J(e,t){if(e.tag===6){e=e.stateNode;var n=e.ownerDocument.createRange();n.selectNodeContents(e),t.push.apply(t,n.getClientRects())}else e=b(e),t.push.apply(t,e.getClientRects());return!1}Gp.prototype.getRootNode=function(e){var t=g(this._fragmentFiber);return t===null?this:b(t).getRootNode(e)},Gp.prototype.compareDocumentPosition=function(e){var t=g(this._fragmentFiber);if(t===null)return Node.DOCUMENT_POSITION_DISCONNECTED;var n=[];h(this._fragmentFiber.child,!1,Yp,n,void 0,void 0);var r=b(t);if(n.length===0){if(n=r,_(this._fragmentFiber)){a:{for(t=this._fragmentFiber.return;t!==null;){if(t.tag===4){t=t.stateNode.containerInfo;break a}if(t.tag===3||t.tag===5||t.tag===27)break;t=t.return}t=null}t!=null&&(n=t)}t=this._fragmentFiber;var i=r=n.compareDocumentPosition(e);return n===e?i=Node.DOCUMENT_POSITION_CONTAINS:r&Node.DOCUMENT_POSITION_CONTAINED_BY&&(n=v(t)[1],n===null?i=Node.DOCUMENT_POSITION_PRECEDING:(e=b(n).compareDocumentPosition(e),i=e===0||e&Node.DOCUMENT_POSITION_FOLLOWING?Node.DOCUMENT_POSITION_FOLLOWING:Node.DOCUMENT_POSITION_PRECEDING)),i|=Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC}t=b(n[0]),i=b(n[n.length-1]);var a=_(this._fragmentFiber)?t.parentElement:r;if(a==null)return Node.DOCUMENT_POSITION_DISCONNECTED;r=a.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_CONTAINED_BY,a=a.compareDocumentPosition(i)&Node.DOCUMENT_POSITION_CONTAINED_BY;var o=t.compareDocumentPosition(e),s=i.compareDocumentPosition(e),c=o&Node.DOCUMENT_POSITION_CONTAINED_BY||s&Node.DOCUMENT_POSITION_CONTAINED_BY;return s=r&&a&&o&Node.DOCUMENT_POSITION_FOLLOWING&&s&Node.DOCUMENT_POSITION_PRECEDING,t=r&&t===e||a&&i===e||c||s?Node.DOCUMENT_POSITION_CONTAINED_BY:!r&&t===e||!a&&i===e?Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC:o,t&Node.DOCUMENT_POSITION_DISCONNECTED||t&Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC||tm(t,this._fragmentFiber,n[0],n[n.length-1],e)?t:Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC};function tm(e,t,n,r,i){var a=Gt(i);if(e&Node.DOCUMENT_POSITION_CONTAINED_BY){if(n=!!a)a:{for(;a!==null;){if(a.tag===7&&(a===t||a.alternate===t)){n=!0;break a}a=a.return}n=!1}return n}if(e&Node.DOCUMENT_POSITION_CONTAINS){if(a===null)return a=i.ownerDocument,i===a||i===a.documentElement||i===a.body;a:{for(a=t,t=g(t);a!==null;){if(!(a.tag!==5&&a.tag!==3&&a.tag!==27||a!==t&&a.alternate!==t)){a=!0;break a}a=a.return}a=!1}return a}return e&Node.DOCUMENT_POSITION_PRECEDING?((t=!!a)&&!(t=a===n)&&(t=re(n,a,S),t===null?t=!1:(h(t,!0,x,a,n),a=ee,ee=null,t=a!==null)),t):e&Node.DOCUMENT_POSITION_FOLLOWING?((t=!!a)&&!(t=a===r)&&(t=re(r,a,S),t===null?t=!1:(h(t,!0,ne,a,r),a=ee,te=ee=null,t=a!==null)),t):!1}function Y(e,t){var n=e.ownerDocument.createRange();n.selectNodeContents(e),e=n.getBoundingClientRect(),window.scrollTo(window.scrollX+e.left,t?window.scrollY+e.top:window.scrollY+e.bottom-window.innerHeight)}Gp.prototype.scrollIntoView=function(e){if(typeof e==`object`)throw Error(o(566));var t=[];h(this._fragmentFiber.child,!1,Yp,t,void 0,void 0);var n=!1!==e;if(t.length===0){var r=v(this._fragmentFiber);if(r=n?r[1]||r[0]||g(this._fragmentFiber):r[0]||r[1],r===null)return;if(r.tag===6){e=b(r),Y(e,n);return}if(r=b(r),r.nodeType!==9){if(r.nodeType===11){n=`host`in r?r.host:null,n!==null&&n.scrollIntoView(e);return}r.scrollIntoView(e)}}for(r=n?t.length-1:0;r!==(n?-1:t.length);){var i=t[r];i.tag===6?(i=b(i),Y(i,n)):b(i).scrollIntoView(e),r+=n?-1:1}};function nm(e,t){return e=b(e),X(e,t),!1}function X(e,t){e.reactFragments??=new Set,e.reactFragments.add(t)}function rm(e,t){var n=t._eventListeners;if(n!==null)for(var r=0;r<n.length;r++){var i=n[r];e.addEventListener(i.type,i.attachedListener,W(i.optionsOrUseCapture))}e.nodeType!==3&&(n=t._observers,n!==null&&n.forEach(function(n){for(var r=0,i=0;i<Qp.length;i++){var a=Qp[i];(a.fragmentInstance!==t||a.observer!==n||a.instance!==e)&&(Qp[r++]=a)}Qp.length=r,n.observe(e)}),X(e,t))}function im(e,t){var n=t._eventListeners;if(n!==null)for(var r=0;r<n.length;r++){var i=n[r];e.removeEventListener(i.type,i.attachedListener,W(i.optionsOrUseCapture))}e.nodeType!==3&&(n=t._observers,n!==null&&n.forEach(function(n){typeof n.rootMargin==`string`?em(t,n,e):n.unobserve(e)}),e.reactFragments!=null&&e.reactFragments.delete(t))}function am(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var n=t;switch(t=t.nextSibling,n.nodeName){case`HTML`:case`HEAD`:case`BODY`:am(n),Wt(n);continue;case`SCRIPT`:case`STYLE`:continue;case`LINK`:if(n.rel.toLowerCase()===`stylesheet`)continue}e.removeChild(n)}}function Z(e,t,n,r){for(;e.nodeType===1;){var i=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!r&&(e.nodeName!==`INPUT`||e.type!==`hidden`))break}else if(!r){if(t===`input`&&e.type===`hidden`){var a=i.name==null?null:``+i.name;if(i.type===`hidden`&&e.getAttribute(`name`)===a)return e}else return e}else if(!e[Ht])switch(t){case`meta`:if(!e.hasAttribute(`itemprop`))break;return e;case`link`:if(a=e.getAttribute(`rel`),a===`stylesheet`&&e.hasAttribute(`data-precedence`)||a!==i.rel||e.getAttribute(`href`)!==(i.href==null||i.href===``?null:i.href)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin)||e.getAttribute(`title`)!==(i.title==null?null:i.title))break;return e;case`style`:if(e.hasAttribute(`data-precedence`))break;return e;case`script`:if(a=e.getAttribute(`src`),(a!==(i.src==null?null:i.src)||e.getAttribute(`type`)!==(i.type==null?null:i.type)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin))&&a&&e.hasAttribute(`async`)&&!e.hasAttribute(`itemprop`))break;return e;default:return e}if(e=dm(e.nextSibling),e===null)break}return null}function om(e,t,n){if(t===``)return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!n||(e=dm(e.nextSibling),e===null))return null;return e}function sm(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!t||(e=dm(e.nextSibling),e===null))return null;return e}function cm(e){return e.data===`$?`||e.data===`$~`}function lm(e){return e.data===`$!`||e.data===`$?`&&e.ownerDocument.readyState!==`loading`}function um(e,t){var n=e.ownerDocument;if(e.data===`$~`)e._reactRetry=t;else if(e.data!==`$?`||n.readyState!==`loading`)t();else{var r=function(){t(),n.removeEventListener(`DOMContentLoaded`,r)};n.addEventListener(`DOMContentLoaded`,r),e._reactRetry=r}}function dm(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t===`$`||t===`$!`||t===`$?`||t===`$~`||t===`&`||t===`F!`||t===`F`)break;if(t===`/$`||t===`/&`)return null}}return e}var fm=null;function pm(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`/$`||n===`/&`){if(t===0)return dm(e.nextSibling);t--}else n!==`$`&&n!==`$!`&&n!==`$?`&&n!==`$~`&&n!==`&`||t++}e=e.nextSibling}return null}function mm(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`$`||n===`$!`||n===`$?`||n===`$~`||n===`&`){if(t===0)return e;t--}else n!==`/$`&&n!==`/&`||t++}e=e.previousSibling}return null}function hm(e,t){function n(){r=!0}if(e.ownerDocument.activeElement===e)return!0;var r=!1;try{e.ownerDocument.addEventListener(`focus`,n,!0),(e.focus||HTMLElement.prototype.focus).call(e,t)}finally{e.ownerDocument.removeEventListener(`focus`,n,!0)}return r}function gm(e){Mp(function(){Mp(function(t){return e(t)})})}function _m(e,t,n){switch(t=Sp(n),e){case`html`:if(e=t.documentElement,!e)throw Error(o(452));return e;case`head`:if(e=t.head,!e)throw Error(o(453));return e;case`body`:if(e=t.body,!e)throw Error(o(454));return e;default:throw Error(o(451))}}function vm(e,t,n){for(var r in n){var i=n[r];n.hasOwnProperty(r)&&i!=null&&pp(e,t,r,null,gp,i)}n.dangerouslySetInnerHTML!=null&&(e.textContent=``),e.onclick===An&&(e.onclick=null),Wt(e)}function ym(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);Wt(e)}var bm=new Map,xm=new Set;function Sm(e){if(typeof e.getRootNode==`function`){var t=e.getRootNode();if(t.nodeType===9||t.nodeType===11)return t}return e.nodeType===9?e:e.ownerDocument}var Cm=T.d;T.d={f:wm,r:Tm,D:Om,C:km,L:Am,m:jm,X:Nm,S:Mm,M:Pm};function wm(){var e=Cm.f(),t=Zd();return e||t}function Tm(e){var t=Kt(e);t!==null&&t.tag===5&&t.type===`form`?uc(t):Cm.r(e)}var Em=typeof document>`u`?null:document;function Dm(e,t,n){var r=Em;if(r&&typeof t==`string`&&t){var i=hn(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),xm.has(i)||(xm.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),hp(t,`link`,e),Yt(t),r.head.appendChild(t)))}}function Om(e){Cm.D(e),Dm(`dns-prefetch`,e,null)}function km(e,t){Cm.C(e,t),Dm(`preconnect`,e,t)}function Am(e,t,n){Cm.L(e,t,n);var r=Em;if(r&&e&&t){var i=`link[rel="preload"][as="`+hn(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+hn(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+hn(n.imageSizes)+`"]`)):i+=`[href="`+hn(e)+`"]`;var a=i;switch(t){case`style`:a=Im(e);break;case`script`:a=Bm(e)}if(!(bm.has(a)||(e=C({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),bm.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(Lm(a))||t===`script`&&r.querySelector(Vm(a))))){var o=r.createElement(`link`);hp(o,`link`,e),t===`style`&&(o[Ut]=!0,o.onload=o.onerror=function(){Xt(o)}),Yt(o),r.head.appendChild(o)}}}function jm(e,t){Cm.m(e,t);var n=Em;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+hn(r)+`"][href="`+hn(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=Bm(e)}if(!bm.has(a)&&(e=C({rel:`modulepreload`,href:e},t),bm.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(Vm(a)))return}r=n.createElement(`link`),hp(r,`link`,e),Yt(r),n.head.appendChild(r)}}}function Mm(e,t,n){Cm.S(e,t,n);var r=Em;if(r&&e){var i=Jt(r).hoistableStyles,a=Im(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(Lm(a)))s.loading=5;else{e=C({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=bm.get(a))&&Wm(e,n);var c=o=r.createElement(`link`);Yt(c),hp(c,`link`,e),c._p=new Promise(function(e,t){c.onload=e,c.onerror=t}),c.addEventListener(`load`,function(){s.loading|=1}),c.addEventListener(`error`,function(){s.loading|=2}),s.loading|=4,Um(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function Nm(e,t){Cm.X(e,t);var n=Em;if(n&&e){var r=Jt(n).hoistableScripts,i=Bm(e),a=r.get(i);a||(a=n.querySelector(Vm(i)),a||(e=C({src:e,async:!0},t),(t=bm.get(i))&&Gm(e,t),a=n.createElement(`script`),Yt(a),hp(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Pm(e,t){Cm.M(e,t);var n=Em;if(n&&e){var r=Jt(n).hoistableScripts,i=Bm(e),a=r.get(i);a||(a=n.querySelector(Vm(i)),a||(e=C({src:e,async:!0,type:`module`},t),(t=bm.get(i))&&Gm(e,t),a=n.createElement(`script`),Yt(a),hp(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Fm(e,t,n,r){var i=(i=Fe.current)?Sm(i):null;if(!i)throw Error(o(446));switch(e){case`meta`:case`title`:return null;case`style`:return typeof n.precedence==`string`&&typeof n.href==`string`?(n=Im(n.href),t=Jt(i).hoistableStyles,r=t.get(n),r||(r={type:`style`,instance:null,count:0,state:null},t.set(n,r)),r):{type:`void`,instance:null,count:0,state:null};case`link`:if(n.rel===`stylesheet`&&typeof n.href==`string`&&typeof n.precedence==`string`){e=Im(n.href);var a=Jt(i).hoistableStyles,s=a.get(e);if(s||(i=i.ownerDocument||i,s={type:`stylesheet`,instance:null,count:0,state:{loading:0,preload:null}},a.set(e,s),(a=i.querySelector(Lm(e)))?a._p||(s.instance=a,s.state.loading=5):(a=bm.get(e),a||(a={rel:`preload`,as:`style`,href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},bm.set(e,a)),zm(i,e,a,s.state))),t&&r===null)throw Error(o(528,``));return s}if(t&&r!==null)throw Error(o(529,``));return null;case`script`:return t=n.async,n=n.src,typeof n==`string`&&t&&typeof t!=`function`&&typeof t!=`symbol`?(n=Bm(n),t=Jt(i).hoistableScripts,r=t.get(n),r||(r={type:`script`,instance:null,count:0,state:null},t.set(n,r)),r):{type:`void`,instance:null,count:0,state:null};default:throw Error(o(444,e))}}function Im(e){return`href="`+hn(e)+`"`}function Lm(e){return`link[rel="stylesheet"][`+e+`]`}function Rm(e){return C({},e,{"data-precedence":e.precedence,precedence:null})}function zm(e,t,n,r){if(t=e.querySelector(`link[rel="preload"][as="style"][`+t+`]`)){if(!0!==t[Ut]){r.loading=1;return}}else t=e.createElement(`link`),t[Ut]=!0,t.onload=t.onerror=Xt.bind(null,t),hp(t,`link`,n),Yt(t),e.head.appendChild(t);r.preload=t,t.addEventListener(`load`,function(){return r.loading|=1}),t.addEventListener(`error`,function(){return r.loading|=2})}function Bm(e){return`[src="`+hn(e)+`"]`}function Vm(e){return`script[async]`+e}function Hm(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+hn(n.href)+`"]`);if(r)return t.instance=r,Yt(r),r;var i=C({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),Yt(r),hp(r,`style`,i),Um(r,n.precedence,e),t.instance=r;case`stylesheet`:i=Im(n.href);var a=e.querySelector(Lm(i));if(a)return t.state.loading|=4,t.instance=a,Yt(a),a;r=Rm(n),(i=bm.get(i))&&Wm(r,i),a=(e.ownerDocument||e).createElement(`link`),Yt(a);var s=a;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),hp(a,`link`,r),t.state.loading|=4,Um(a,n.precedence,e),t.instance=a;case`script`:return a=Bm(n.src),(i=e.querySelector(Vm(a)))?(t.instance=i,Yt(i),i):(r=n,(i=bm.get(a))&&(r=C({},n),Gm(r,i)),e=e.ownerDocument||e,i=e.createElement(`script`),Yt(i),hp(i,`link`,r),e.head.appendChild(i),t.instance=i);case`void`:return null;default:throw Error(o(443,t.type))}else t.type===`stylesheet`&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,Um(r,n.precedence,e));return t.instance}function Um(e,t,n){for(var r=n.querySelectorAll(`link[rel="stylesheet"][data-precedence],style[data-precedence]`),i=r.length?r[r.length-1]:null,a=i,o=0;o<r.length;o++){var s=r[o];if(s.dataset.precedence===t)a=s;else if(a!==i)break}a?a.parentNode.insertBefore(e,a.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function Wm(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.title??=t.title}function Gm(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.integrity??=t.integrity}var Km=null;function qm(e,t,n){if(Km===null){var r=new Map,i=Km=new Map;i.set(n,r)}else i=Km,r=i.get(n),r||(r=new Map,i.set(n,r));if(r.has(e))return r;for(r.set(e,null),n=n.getElementsByTagName(e),i=0;i<n.length;i++){var a=n[i];if(!(a[Ht]||a[Ft]||e===`link`&&a.getAttribute(`rel`)===`stylesheet`)&&a.namespaceURI!==`http://www.w3.org/2000/svg`){var o=a.getAttribute(t)||``;o=e+o;var s=r.get(o);s?s.push(a):r.set(o,[a])}}return r}function Jm(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t===`title`?e.querySelector(`head > title`):null)}function Ym(e,t,n){if(n===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;switch(t.rel){case`stylesheet`:return e=t.disabled,typeof t.precedence==`string`&&e==null;default:return!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 Xm(e,t){return e===`img`&&t.src!=null&&t.src!==``&&t.onLoad==null&&t.loading!==`lazy`}function Zm(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function Qm(e){return(e.width||100)*(e.height||100)*(typeof devicePixelRatio==`number`?devicePixelRatio:1)*.25}function $m(e,t){typeof t.decode==`function`&&(e.imgCount++,t.complete||(e.imgBytes+=Qm(t),e.suspenseyImages.push(t)),e=ah.bind(e),t.decode().then(e,e))}function eh(e,t,n,r){if(n.type===`stylesheet`&&(typeof r.media!=`string`||!1!==matchMedia(r.media).matches)&&!(n.state.loading&4)){if(n.instance===null){var i=Im(r.href),a=t.querySelector(Lm(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=ih.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,Yt(a);return}a=t.ownerDocument||t,r=Rm(r),(i=bm.get(i))&&Wm(r,i),a=a.createElement(`link`),Yt(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),hp(a,`link`,r),n.instance=a}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=ih.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var th=0;function nh(e,t){return e.stylesheets&&e.count===0&&sh(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var r=setTimeout(function(){if(e.stylesheets&&sh(e,e.stylesheets),e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}},6e4+t);0<e.imgBytes&&th===0&&(th=62500*yp());var i=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&sh(e,e.stylesheets),e.unsuspend)){var t=e.unsuspend;e.unsuspend=null,t()}},(e.imgBytes>th?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function rh(e){if(e.count===0&&(e.imgCount===0||!e.waitingForImages)){if(e.stylesheets)sh(e,e.stylesheets);else if(e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}}}function ih(){this.count--,rh(this)}function ah(){this.imgCount--,rh(this)}var oh=null;function sh(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,oh=new Map,t.forEach(ch,e),oh=null,ih.call(e))}function ch(e,t){if(!(t.state.loading&4)){var n=oh.get(e);if(n)var r=n.get(null);else{n=new Map,oh.set(e,n);for(var i=e.querySelectorAll(`link[data-precedence],style[data-precedence]`),a=0;a<i.length;a++){var o=i[a];(o.nodeName===`LINK`||o.getAttribute(`media`)!==`not all`)&&(n.set(o.dataset.precedence,o),r=o)}r&&n.set(null,r)}i=t.instance,o=i.getAttribute(`data-precedence`),a=n.get(o)||r,a===r&&n.set(null,i),n.set(o,i),this.count++,r=ih.bind(this),i.addEventListener(`load`,r),i.addEventListener(`error`,r),a?a.parentNode.insertBefore(i,a.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(i,e.firstChild)),t.state.loading|=4}}var lh={$$typeof:de,Provider:null,Consumer:null,_currentValue:De,_currentValue2:De,_threadCount:0};function uh(e,t,n,r,i,a,o,s,c){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=wt(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=wt(0),this.hiddenUpdates=wt(null),this.identifierPrefix=r,this.onUncaughtError=i,this.onCaughtError=a,this.onRecoverableError=o,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=c,this.transitionTypes=null,this.incompleteTransitions=new Map}function dh(e,t,n,r,i,a,o,s,c,l,u,d){return e=new uh(e,t,n,o,c,l,u,d,s),t=1,!0===a&&(t|=24),a=Hi(3,null,null,t),e.current=a,a.stateNode=e,t=Va(),t.refCount++,e.pooledCache=t,t.refCount++,a.memoizedState={element:r,isDehydrated:n,cache:t},Co(a),e}function fh(e){return e?(e=Bi,e):Bi}function ph(e,t,n,r,i,a){i=fh(i),r.context===null?r.context=i:r.pendingContext=i,r=wo(t),r.payload={element:n},a=a===void 0?null:a,a!==null&&(r.callback=a),n=To(e,r,t),n!==null&&(Kd(n,e,t),Eo(n,e,t))}function mh(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function hh(e,t){mh(e,t),(e=e.alternate)&&mh(e,t)}function gh(e){if(e.tag===13||e.tag===31){var t=Li(e,67108864);t!==null&&Kd(t,e,67108864),hh(e,67108864)}}function _h(e){if(e.tag===13||e.tag===31){var t=Ud();t=At(t);var n=Li(e,t);n!==null&&Kd(n,e,t),hh(e,t)}}var vh=!0;function yh(e,t,n,r){var i=w.T;w.T=null;var a=T.p;try{T.p=2,xh(e,t,n,r)}finally{T.p=a,w.T=i}}function bh(e,t,n,r){var i=w.T;w.T=null;var a=T.p;try{T.p=8,xh(e,t,n,r)}finally{T.p=a,w.T=i}}function xh(e,t,n,r){if(vh){var i=Sh(r);if(i===null)ap(e,t,r,Ch,n),Ph(e,r);else if(Ih(i,e,t,n,r))r.stopPropagation();else if(Ph(e,r),t&4&&-1<Nh.indexOf(e)){for(;i!==null;){var a=Kt(i);if(a!==null)switch(a.tag){case 3:if(a=a.stateNode,a.current.memoizedState.isDehydrated){var o=vt(a.pendingLanes);if(o!==0){var s=a;for(s.pendingLanes|=2,s.entangledLanes|=2;o;){var c=1<<31-dt(o);s.entanglements[1]|=c,o&=~c}zf(a),!(I&6)&&(Od=$e()+500,Bf(0,!1))}}break;case 31:case 13:s=Li(a,2),s!==null&&Kd(s,a,2),Zd(),hh(a,2)}if(a=Sh(r),a===null&&ap(e,t,r,Ch,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else ap(e,t,r,null,n)}}function Sh(e){return e=Mn(e),wh(e)}var Ch=null;function wh(e){if(Ch=null,e=Gt(e),e!==null){var t=l(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=u(t),e!==null)return e;e=null}else if(n===31){if(e=d(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return Ch=e,null}function Th(e){switch(e){case`beforetoggle`:case`cancel`:case`click`:case`close`:case`contextmenu`:case`copy`:case`cut`:case`auxclick`:case`dblclick`:case`dragend`:case`dragstart`:case`drop`:case`focusin`:case`focusout`:case`input`:case`invalid`:case`keydown`:case`keypress`:case`keyup`:case`mousedown`:case`mouseup`:case`paste`:case`pause`:case`play`:case`pointercancel`:case`pointerdown`:case`pointerup`:case`ratechange`:case`reset`:case`seeked`:case`submit`:case`toggle`:case`touchcancel`:case`touchend`:case`touchstart`:case`volumechange`:case`change`:case`selectionchange`:case`textInput`:case`compositionstart`:case`compositionend`:case`compositionupdate`:case`beforeblur`:case`afterblur`:case`beforeinput`:case`blur`:case`fullscreenchange`:case`fullscreenerror`:case`focus`:case`hashchange`:case`popstate`:case`select`:case`selectstart`:return 2;case`drag`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`mousemove`:case`mouseout`:case`mouseover`:case`pointermove`:case`pointerout`:case`pointerover`:case`resize`:case`scroll`:case`touchmove`:case`wheel`:case`mouseenter`:case`mouseleave`:case`pointerenter`:case`pointerleave`:return 8;case`message`:switch(et()){case tt:return 2;case nt:return 8;case rt:case it:return 32;case at:return 268435456;default:return 32}default:return 32}}var Eh=!1,Dh=null,Oh=null,kh=null,Ah=new Map,jh=new Map,Mh=[],Nh=`mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset`.split(` `);function Ph(e,t){switch(e){case`focusin`:case`focusout`:Dh=null;break;case`dragenter`:case`dragleave`:Oh=null;break;case`mouseover`:case`mouseout`:kh=null;break;case`pointerover`:case`pointerout`:Ah.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:jh.delete(t.pointerId)}}function Fh(e,t,n,r,i,a){return e===null||e.nativeEvent!==a?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:a,targetContainers:[i]},t!==null&&(t=Kt(t),t!==null&&gh(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function Ih(e,t,n,r,i){switch(t){case`focusin`:return Dh=Fh(Dh,e,t,n,r,i),!0;case`dragenter`:return Oh=Fh(Oh,e,t,n,r,i),!0;case`mouseover`:return kh=Fh(kh,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return Ah.set(a,Fh(Ah.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,jh.set(a,Fh(jh.get(a)||null,e,t,n,r,i)),!0}return!1}function Lh(e){var t=Gt(e.target);if(t!==null){var n=l(t);if(n!==null){if(t=n.tag,t===13){if(t=u(n),t!==null){e.blockedOn=t,Nt(e.priority,function(){_h(n)});return}}else if(t===31){if(t=d(n),t!==null){e.blockedOn=t,Nt(e.priority,function(){_h(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Rh(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=Sh(e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);jn=r,n.target.dispatchEvent(r),jn=null}else return t=Kt(n),t!==null&&gh(t),e.blockedOn=n,!1;t.shift()}return!0}function zh(e,t,n){Rh(e)&&n.delete(t)}function Bh(){Eh=!1,Dh!==null&&Rh(Dh)&&(Dh=null),Oh!==null&&Rh(Oh)&&(Oh=null),kh!==null&&Rh(kh)&&(kh=null),Ah.forEach(zh),jh.forEach(zh)}function Vh(e,n){e.blockedOn===n&&(e.blockedOn=null,Eh||(Eh=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,Bh)))}var Hh=null;function Uh(e){Hh!==e&&(Hh=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Hh===e&&(Hh=null);for(var t=0;t<e.length;t+=3){var n=e[t],r=e[t+1],i=e[t+2];if(typeof r!=`function`){if(wh(r||n)===null)continue;break}var a=Kt(n);a!==null&&(e.splice(t,3),t-=3,cc(a,{pending:!0,data:i,method:n.method,action:r},r,i))}}))}function Wh(e){function t(t){return Vh(t,e)}Dh!==null&&Vh(Dh,e),Oh!==null&&Vh(Oh,e),kh!==null&&Vh(kh,e),Ah.forEach(t),jh.forEach(t);for(var n=0;n<Mh.length;n++){var r=Mh[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<Mh.length&&(n=Mh[0],n.blockedOn===null);)Lh(n),n.blockedOn===null&&Mh.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(r=0;r<n.length;r+=3){var i=n[r],a=n[r+1],o=i[It]||null;if(typeof a==`function`)o||Uh(n);else if(o){var s=null;if(a&&a.hasAttribute(`formAction`)){if(i=a,o=a[It]||null)s=o.formAction;else if(wh(i)!==null)continue}else s=o.action;typeof s==`function`?n[r+1]=s:(n.splice(r,3),r-=3),Uh(n)}}}function Gh(){function e(e){e.canIntercept&&e.info===`react-transition`&&e.intercept({handler:function(){return new Promise(function(e){return i=e})},focusReset:`manual`,scroll:`manual`})}function t(){i!==null&&(i(),i=null),r||setTimeout(n,20)}function n(){if(!r&&!navigation.transition){var e=navigation.currentEntry;e&&e.url!=null&&navigation.navigate(e.url,{state:e.getState(),info:`react-transition`,history:`replace`})}}if(typeof navigation==`object`){var r=!1,i=null;return navigation.addEventListener(`navigate`,e),navigation.addEventListener(`navigatesuccess`,t),navigation.addEventListener(`navigateerror`,t),setTimeout(n,100),function(){r=!0,navigation.removeEventListener(`navigate`,e),navigation.removeEventListener(`navigatesuccess`,t),navigation.removeEventListener(`navigateerror`,t),i!==null&&(i(),i=null)}}}function Kh(e){this._internalRoot=e}qh.prototype.render=Kh.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(o(409));var n=t.current;ph(n,Ud(),e,t,null,null)},qh.prototype.unmount=Kh.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;ph(e.current,2,null,e,null,null),Zd(),t[Lt]=null}};function qh(e){this._internalRoot=e}qh.prototype.unstable_scheduleHydration=function(e){if(e){var t=Mt();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Mh.length&&t!==0&&t<Mh[n].priority;n++);Mh.splice(n,0,e),n===0&&Lh(e)}};var Jh=n.version;if(Jh!==`19.3.0`)throw Error(o(527,Jh,`19.3.0`));T.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render==`function`?Error(o(188)):(e=Object.keys(e).join(`,`),Error(o(268,e)));return e=p(t),e=e===null?null:m(e),e=e===null?null:e.stateNode,e};var Yh={bundleType:0,version:`19.3.0`,rendererPackageName:`react-dom`,currentDispatcherRef:w,reconcilerVersion:`19.3.0`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var Xh=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Xh.isDisabled&&Xh.supportsFiber)try{ct=Xh.inject(Yh),lt=Xh}catch{}}e.createRoot=function(e,t){if(!c(e))throw Error(o(299));var n=!1,r=``,i=jc,a=Mc,s=Nc;return t!=null&&(!0===t.unstable_strictMode&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onUncaughtError!==void 0&&(i=t.onUncaughtError),t.onCaughtError!==void 0&&(a=t.onCaughtError),t.onRecoverableError!==void 0&&(s=t.onRecoverableError)),t=dh(e,1,!1,null,null,n,r,null,i,a,s,Gh),e[Lt]=t.current,rp(e),new Kh(t)}})),l=e(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=c()})),u=globalThis.Buffer,d=u!=null&&typeof u.from==`function`,f=new Int8Array(256).fill(-1);for(let e=0;e<10;e++)f[48+e]=e;for(let e=0;e<6;e++)f[65+e]=10+e,f[97+e]=10+e;var p=class e{static zeros=`.0.00.000.0000.00000.000000.0000000.00000000.000000000.0000000000.00000000000.000000000000.0000000000000.00000000000000.000000000000000.0000000000000000.00000000000000000.000000000000000000.0000000000000000000.00000000000000000000.000000000000000000000.0000000000000000000000.00000000000000000000000.000000000000000000000000.0000000000000000000000000`.split(`.`);static groupSizes=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5];static groupBases=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];static wordSize=26;static WORD_SIZE_BIGINT=BigInt(e.wordSize);static WORD_MASK=(1n<<e.WORD_SIZE_BIGINT)-1n;static MAX_SAFE_INTEGER_BIGINT=BigInt(2**53-1);static MIN_SAFE_INTEGER_BIGINT=BigInt(-(2**53-1));static MAX_IMULN_ARG=67108863;static MAX_NUMBER_CONSTRUCTOR_MAG_BIGINT=(1n<<53n)-1n;static MAX_NOMINAL_WORD_LENGTH=1048576;_magnitude=0n;_sign=0;_nominalWordLength=1;red=null;get negative(){return this._sign}set negative(e){this.assert(e===0||e===1,`Negative property must be 0 or 1`);let t=+(e===1);this._sign=this._magnitude===0n?0:t}get _computedWordsArray(){if(this._magnitude===0n)return[0];let t=[],n=this._magnitude;for(;n>0n;)t.push(Number(n&e.WORD_MASK)),n>>=e.WORD_SIZE_BIGINT;return t.length>0?t:[0]}get words(){if(!Number.isSafeInteger(this._nominalWordLength)||this._nominalWordLength<1||this._nominalWordLength>e.MAX_NOMINAL_WORD_LENGTH)throw Error(`BigNumber word length exceeds the supported limit`);let t=this._computedWordsArray;if(this._nominalWordLength<=t.length)return t;let n=Array.from({length:this._nominalWordLength}).fill(0);for(let e=0;e<t.length;e++)n[e]=t[e];return n}set words(t){let n=this._sign,r=0n,i=t.length>0?t.length:1;for(let n=i-1;n>=0;n--){let i=t[n]??0;r=r<<e.WORD_SIZE_BIGINT|BigInt(i&Number(e.WORD_MASK))}this._magnitude=r,this._sign=n,this._nominalWordLength=i,this.normSign()}get length(){return Math.max(1,this._nominalWordLength)}static isBN(t){return t instanceof e||typeof t==`object`&&!!t&&t.constructor?.wordSize===e.wordSize&&Array.isArray(t.words)}static max(e,t){return e.cmp(t)>0?e:t}static min(e,t){return e.cmp(t)<0?e:t}constructor(e=0,t=10,n=`be`){if(e??=0,typeof e==`bigint`){this._initializeState(e<0n?-e:e,+(e<0n)),this.normSign();return}let r=t===`le`||t===`be`,i=r?10:t,a=r?t:n;if(typeof e==`number`){this.initNumber(e,a);return}if(Array.isArray(e)){this.initArray(e,a);return}if(typeof e==`string`){this._initFromString(e,i,a);return}e===0?this._initializeState(0n,0):this.assert(!1,`Unsupported input type for BigNumber constructor`)}_initFromString(e,t,n){t===`hex`&&(t=16),this.assert(typeof t==`number`&&t===Math.trunc(t)&&t>=2&&t<=36,`Base must be an integer between 2 and 36`);let r=e.toString().replace(/\s+/g,``),i=0,a=0;r.startsWith(`-`)?(i++,a=1):r.startsWith(`+`)&&i++;let o=r.substring(i);if(o.length===0){this._initializeState(0n,a===1&&r.startsWith(`-`)?1:0),this.normSign();return}t===16?this._initFromHexString(o,a,n):this._initFromNonHexString(o,t,a,n)}_initFromHexString(e,t,n){if(n===`le`){let n=[],r=e;r.length%2!=0&&(r=`0`+r);for(let e=0;e<r.length;e+=2){let t=r.substring(e,e+2),i=Number.parseInt(t,16);if(Number.isNaN(i))throw Error(`Invalid character in `+r);n.push(i)}this.initArray(n,`le`),this._sign=t,this.normSign()}else{let n;try{n=BigInt(`0x`+e)}catch{throw Error(`Invalid character in `+e)}this._initializeState(n,t),this.normSign()}}_initFromNonHexString(e,t,n,r){try{if(this._parseBaseString(e,t),this._sign=n,this.normSign(),r===`le`){let e=this._sign;this.initArray(this.toArray(`be`),`le`),this._sign=e,this.normSign()}}catch(e){let t=e;throw t.message.includes(`Invalid character in string`)||t.message.includes(`Invalid digit for base`)||t.message.startsWith(`Invalid character:`)?Error(`Invalid character`):t}}_bigIntToStringInBase(e,t){if(e===0n)return`0`;if(t<2||t>36)throw Error(`Base must be between 2 and 36`);let n=``,r=e>0n?e:-e,i=BigInt(t);for(;r>0n;)n=`0123456789abcdefghijklmnopqrstuvwxyz`[Number(r%i)]+n,r/=i;return n}_parseBaseString(t,n){this._magnitude=0n;let r=BigInt(n),i=e.groupSizes[n],a=BigInt(e.groupBases[n]);(i===0||a===0n)&&(i=Math.floor(Math.log(67108863)/Math.log(n)),i===0&&(i=1),a=r**BigInt(i));let o=0,s=t.length,c=s%i;if(c===0&&s>0&&(c=i),c>0){let e=t.substring(o,o+c);this._magnitude=BigInt(this._parseBaseWord(e,n)),o+=c}for(;o<s;){let e=t.substring(o,o+i),r=BigInt(this._parseBaseWord(e,n));this._magnitude=this._magnitude*a+r,o+=i}this._finishInitialization()}_parseBaseWord(e,t){let n=0;for(let r=0;r<e.length;r++){let i=e.codePointAt(r),a;if(i>=48&&i<=57)a=i-48;else if(i>=65&&i<=90)a=i-65+10;else if(i>=97&&i<=122)a=i-97+10;else throw Error(`Invalid character: `+e[r]);if(a>=t)throw Error(`Invalid character`);n=n*t+a}return n}_initializeState(e,t){this._magnitude=e,this._sign=e===0n?0:t,this._finishInitialization()}_finishInitialization(){if(this._magnitude===0n)this._nominalWordLength=1,this._sign=0;else{let t=this._magnitude.toString(2).length;this._nominalWordLength=Math.max(1,Math.ceil(t/e.wordSize))}}assert(e,t=`Assertion failed`){if(!e)throw Error(t)}initNumber(t,n=`be`){if(this.assert(BigInt(Math.abs(t))<=e.MAX_NUMBER_CONSTRUCTOR_MAG_BIGINT,`The number is larger than 2 ^ 53 (unsafe)`),this.assert(t%1==0,`Number must be an integer for BigNumber conversion`),this._initializeState(BigInt(Math.abs(t)),+(t<0)),n===`le`){let e=this._sign,t=this.toArray(`be`);this.initArray(t,`le`),this._sign=e,this.normSign()}return this}initArray(e,t){if(e.length===0)return this._initializeState(0n,0),this;let n=0n;if(t===`be`)for(let t of e)n=n<<8n|BigInt(t&255);else for(let t=e.length-1;t>=0;t--)n=n<<8n|BigInt(e[t]&255);return this._initializeState(n,0),this}copy(e){e._magnitude=this._magnitude,e._sign=this._sign,e._nominalWordLength=this._nominalWordLength,e.red=this.red}static move(e,t){e._magnitude=t._magnitude,e._sign=t._sign,e._nominalWordLength=t._nominalWordLength,e.red=t.red}clone(){let t=new e(0n);return this.copy(t),t}expand(t){return this.assert(Number.isSafeInteger(t)&&t>=0&&t<=e.MAX_NOMINAL_WORD_LENGTH,`Expand size must be a non-negative safe integer within the supported word limit`),this._nominalWordLength=Math.max(this._nominalWordLength,t,1),this}strip(){return this._finishInitialization(),this.normSign()}normSign(){return this._magnitude===0n&&(this._sign=0),this}inspect(){return(this.red===null?`<BN: `:`<BN-R: `)+this.toString(16)+`>`}_getMinimalHex(){return this._magnitude===0n?`0`:this._magnitude.toString(16)}_toHexString(e){let t=this._getMinimalHex();if(e>1)for(t!==`0`&&t.length%2!=0&&(t=`0`+t);t.length%e!==0;)t=`0`+t;return(this.isNeg()?`-`:``)+t}toString(e=10,t=1){if(e===16||e===`hex`)return this._toHexString(t);if(typeof e!=`number`||e<2||e>36||e%1!=0)throw Error(`Base should be an integer between 2 and 36`);return this.toBaseString(e,t)}toBaseString(t,n){if(this._magnitude===0n)return e._paddedZero(n);let r=e.groupSizes[t],i=BigInt(e.groupBases[t]);(r===0||i===0n)&&(r=Math.floor(Math.log(2**53-1)/Math.log(t)),r===0&&(r=1),i=BigInt(t)**BigInt(r));let a=``,o=this._magnitude;for(;o>0n;){let e=o%i;o/=i;let n=this._bigIntToStringInBase(e,t);a=(o>0n?this._zeroPaddedChunk(n,r):n)+a}if(n>0)for(;a.length<n;)a=`0`+a;return(this._sign===1?`-`:``)+a}static _paddedZero(e){let t=`0`;if(e>1)for(;t.length<e;)t=`0`+t;return t}_zeroPaddedChunk(t,n){let r=n-t.length;return r<=0?t:r<e.zeros.length?e.zeros[r]+t:`0`.repeat(r)+t}toNumber(){let t=this._getSignedValue();if(t>e.MAX_SAFE_INTEGER_BIGINT||t<e.MIN_SAFE_INTEGER_BIGINT)throw Error(`Number can only safely store up to 53 bits`);return Number(t)}toBigInt(){return this._getSignedValue()}toJSON(){let e=this._getMinimalHex();return(this.isNeg()?`-`:``)+e}toArrayLikeGeneric(e,t){let n=this._magnitude,r=t?0:e.length-1,i=t?1:-1;for(let t of e){if(n===0n&&r>=0&&r<e.length)e[r]=0;else if(r>=0&&r<e.length)e[r]=Number(n&255n);else break;n>>=8n,r+=i}}toArray(e=`be`,t){this.strip();let n=this.byteLength(),r=t??Math.max(1,n);this.assert(n<=r,`byte array longer than desired length`),this.assert(r>0,`Requested array length <= 0`);let i=Array.from({length:r}).fill(0);return this._magnitude===0n&&r>0?i:this._magnitude===0n&&r===0?[]:(this.toArrayLikeGeneric(i,e===`le`),i)}bitLength(){return this._magnitude===0n?0:this._magnitude.toString(2).length}static toBitArray(e){let t=e.bitLength();if(t===0)return[];let n=Array.from({length:t}),r=e._magnitude;for(let e=0;e<t;e++)n[e]=(r>>BigInt(e)&1n)==0n?0:1;return n}toBitArray(){return e.toBitArray(this)}zeroBits(){if(this._magnitude===0n)return 0;let e=0,t=this._magnitude;for(;(t&1n)==0n&&t!==0n;)e++,t>>=1n;return e}byteLength(){return this._magnitude===0n?0:Math.ceil(this.bitLength()/8)}_getSignedValue(){return this._sign===1?-this._magnitude:this._magnitude}_setValueFromSigned(e){e<0n?(this._magnitude=-e,this._sign=1):(this._magnitude=e,this._sign=0),this._finishInitialization(),this.normSign()}toTwos(t){this.assert(t>=0);let n=BigInt(t),r=this._getSignedValue();this._sign===1&&this._magnitude!==0n&&(r=(1n<<n)+r);let i=(1n<<n)-1n;r&=i;let a=new e(0n);return a._initializeState(r,0),a}fromTwos(t){this.assert(t>=0);let n=BigInt(t),r=this._magnitude;if(t>0&&(r>>n-1n&1n)!=0n&&this._sign===0){let t=r-(1n<<n),i=new e(0n);return i._setValueFromSigned(t),i}return this.clone()}isNeg(){return this._sign===1&&this._magnitude!==0n}neg(){return this.clone().ineg()}ineg(){return this._magnitude!==0n&&(this._sign=this._sign===1?0:1),this}_iuop(e,t,n=!1){let r=t(this._magnitude,e._magnitude),i=this._nominalWordLength;return n&&(i=Math.max(this.length,e.length)),this._magnitude=r,this._finishInitialization(),n&&(this._nominalWordLength=Math.max(this._nominalWordLength,i)),this.strip()}iuor(e){return this._iuop(e,(e,t)=>e|t)}iuand(e){return this._iuop(e,(e,t)=>e&t)}iuxor(e){return this._iuop(e,(e,t)=>e^t,!0)}_iop(e,t,n=!1){return this.assert(this._sign===0&&e._sign===0),this._iuop(e,t,n)}ior(e){return this._iop(e,(e,t)=>e|t)}iand(e){return this._iop(e,(e,t)=>e&t)}ixor(e){return this._iop(e,(e,t)=>e^t,!0)}_uop_new(e,t){return this.length>=e.length?this.clone()[t](e):e.clone()[t](this)}or(e){return this.assert(this._sign===0&&e._sign===0),this._uop_new(e,`iuor`)}uor(e){return this._uop_new(e,`iuor`)}and(e){return this.assert(this._sign===0&&e._sign===0),this._uop_new(e,`iuand`)}uand(e){return this._uop_new(e,`iuand`)}xor(e){return this.assert(this._sign===0&&e._sign===0),this._uop_new(e,`iuxor`)}uxor(e){return this._uop_new(e,`iuxor`)}inotn(t){this.assert(typeof t==`number`&&t>=0);let n=(1n<<BigInt(t))-1n;this._magnitude=~this._magnitude&n;let r=t===0?1:Math.ceil(t/e.wordSize);return this._nominalWordLength=Math.max(1,r),this.strip(),this._nominalWordLength=Math.max(this._nominalWordLength,Math.max(1,r)),this}notn(e){return this.clone().inotn(e)}setn(t,n){this.assert(typeof t==`number`&&t>=0);let r=BigInt(t);n===1||n===!0?this._magnitude|=1n<<r:this._magnitude&=~(1n<<r);let i=Math.floor(t/e.wordSize)+1;return this._nominalWordLength=Math.max(this._nominalWordLength,i),this._finishInitialization(),this.strip()}iadd(e){return this._setValueFromSigned(this._getSignedValue()+e._getSignedValue()),this}add(t){let n=new e(0n);return n._setValueFromSigned(this._getSignedValue()+t._getSignedValue()),n}isub(e){return this._setValueFromSigned(this._getSignedValue()-e._getSignedValue()),this}sub(t){let n=new e(0n);return n._setValueFromSigned(this._getSignedValue()-t._getSignedValue()),n}mul(t){let n=new e(0n);return n._magnitude=this._magnitude*t._magnitude,n._sign=n._magnitude===0n?0:this._sign^t._sign,n._nominalWordLength=this.length+t.length,n.red=null,n.normSign()}imul(e){return this._magnitude*=e._magnitude,this._sign=this._magnitude===0n?0:this._sign^e._sign,this._nominalWordLength=this.length+e.length,this.red=null,this.normSign()}imuln(t){return this.assert(typeof t==`number`,`Assertion failed`),this.assert(Math.abs(t)<=e.MAX_IMULN_ARG,`Assertion failed`),this._setValueFromSigned(this._getSignedValue()*BigInt(t)),this}muln(e){return this.clone().imuln(e)}sqr(){let t=new e(0n);return t._magnitude=this._magnitude*this._magnitude,t._sign=0,t._nominalWordLength=this.length*2,t.red=null,t}isqr(){return this._magnitude*=this._magnitude,this._sign=0,this._nominalWordLength=this.length*2,this.red=null,this}pow(t){if(this.assert(t._sign===0,`Exponent for pow must be non-negative`),t.isZero())return new e(1n);let n=new e(1n),r=this.clone(),i=t.clone(),a=r.isNeg(),o=i.isOdd();for(a&&r.ineg();!i.isZero();)i.isOdd()&&n.imul(r),r.isqr(),i.iushrn(1);return a&&o&&n.ineg(),n}static normalizeNonNegativeBigInt(e,t){if(typeof e==`number`){if(!Number.isFinite(e)||!Number.isInteger(e)||e<0)throw Error(`${t} must be a non-negative integer`);return BigInt(e)}if(e<0n)throw Error(`${t} must be a non-negative integer`);return e}iushln(t){let n=e.normalizeNonNegativeBigInt(t,`Shift bits`);return n===0n?this:(this._magnitude<<=n,this._finishInitialization(),this.strip())}ishln(e){return this.assert(this._sign===0,`ishln requires positive number`),this.iushln(e)}iushrn(t,n,r){let i=e.normalizeNonNegativeBigInt(t,`Shift bits`);if(i===0n)return r?._initializeState(0n,0),this;if(r!=null){let e=(1n<<i)-1n,t=this._magnitude&e;r._initializeState(t,0)}return this._magnitude>>=i,this._finishInitialization(),this.strip()}ishrn(e,t,n){return this.assert(this._sign===0,`ishrn requires positive number`),this.iushrn(e,t,n)}shln(e){return this.clone().ishln(e)}ushln(e){return this.clone().iushln(e)}shrn(e){return this.clone().ishrn(e)}ushrn(e){return this.clone().iushrn(e)}testn(e){return this.assert(typeof e==`number`&&e>=0),(this._magnitude>>BigInt(e)&1n)!=0n}imaskn(t){this.assert(typeof t==`number`&&t>=0),this.assert(this._sign===0,`imaskn works only with positive numbers`);let n=BigInt(t),r=n===0n?0n:(1n<<n)-1n;this._magnitude&=r;let i=t===0?1:Math.max(1,Math.ceil(t/e.wordSize));return this._nominalWordLength=i,this._finishInitialization(),this._nominalWordLength=Math.max(this._nominalWordLength,i),this.strip()}maskn(e){return this.clone().imaskn(e)}iaddn(t){return this.assert(typeof t==`number`),this.assert(Math.abs(t)<=e.MAX_IMULN_ARG,`num is too large`),this._setValueFromSigned(this._getSignedValue()+BigInt(t)),this}_iaddn(e){return this.iaddn(e)}isubn(t){return this.assert(typeof t==`number`),this.assert(Math.abs(t)<=e.MAX_IMULN_ARG,`Assertion failed`),this._setValueFromSigned(this._getSignedValue()-BigInt(t)),this}addn(e){return this.clone().iaddn(e)}subn(e){return this.clone().isubn(e)}iabs(){return this._sign=0,this}abs(){return this.clone().iabs()}divmod(t,n,r){if(this.assert(!t.isZero(),`Division by zero`),this.isZero()){let t=new e(0n);return{div:n===`mod`?null:t,mod:n===`div`?null:t}}let i=this._getSignedValue(),a=t._getSignedValue(),o=n===`mod`?null:i/a,s=this._computeMod(i,a,n,r);return{div:this._bigNumberFromSigned(o),mod:this._bigNumberFromSigned(s)}}_computeMod(e,t,n,r){if(n===`div`)return null;let i=e%t;return r===!0&&i<0n&&(i+=t<0n?-t:t),i}_bigNumberFromSigned(t){if(t===null)return null;let n=new e(0n);return n._setValueFromSigned(t),n}div(e){return this.divmod(e,`div`,!1).div}mod(e){return this.divmod(e,`mod`,!1).mod}umod(e){return this.divmod(e,`mod`,!0).mod}divRound(t){this.assert(!t.isZero());let n=this._getSignedValue(),r=t._getSignedValue(),i=n/r,a=n%r;if(a===0n){let t=new e(0n);return t._setValueFromSigned(i),t}let o=a<0n?-a:a,s=r<0n?-r:r;o*2n>=s&&(n>0n&&r>0n||n<0n&&r<0n?i+=1n:i-=1n);let c=new e(0n);return c._setValueFromSigned(i),c}modrn(e){this.assert(e!==0,`Division by zero in modrn`);let t=BigInt(Math.abs(e));if(t===0n)throw Error(`Division by zero in modrn`);let n=this._magnitude%t;return Number(e<0?-n:n)}idivn(t){return this.assert(t!==0),this.assert(Math.abs(t)<=e.MAX_IMULN_ARG,`num is too large`),this._setValueFromSigned(this._getSignedValue()/BigInt(t)),this}divn(e){return this.clone().idivn(e)}egcd(t){this.assert(t._sign===0,`p must not be negative`),this.assert(!t.isZero(),`p must not be zero`);let n=this._getSignedValue(),r=t._magnitude,i=1n,a=0n,o=0n,s=1n;for(;r!==0n;){let e=n/r,t=r;r=n%r,n=t,t=a,a=i-e*a,i=t,t=s,s=o-e*s,o=t}let c=new e(0n);c._setValueFromSigned(i);let l=new e(0n);l._setValueFromSigned(o);let u=new e(0n);return u._initializeState(n<0n?-n:n,0),{a:c,b:l,gcd:u}}gcd(t){let n=this._magnitude,r=t._magnitude;if(n===0n){let t=new e(0n);return t._setValueFromSigned(r),t.iabs()}if(r===0n){let t=new e(0n);return t._setValueFromSigned(n),t.iabs()}for(;r!==0n;){let e=n%r;n=r,r=e}let i=new e(0n);return i._initializeState(n,0),i}invm(e){this.assert(!e.isZero()&&e._sign===0,`Modulus for invm must be positive and non-zero`);let t=this.egcd(e);if(!t.gcd.eqn(1))throw Error(`Inverse does not exist (numbers are not coprime).`);return t.a.umod(e)}isEven(){return this._magnitude%2n==0n}isOdd(){return this._magnitude%2n==1n}andln(e){return this.assert(e>=0),Number(this._magnitude&BigInt(e))}bincn(e){this.assert(typeof e==`number`&&e>=0);let t=1n<<BigInt(e);return this._setValueFromSigned(this._getSignedValue()+t),this}isZero(){return this._magnitude===0n}cmpn(t){this.assert(Math.abs(t)<=e.MAX_IMULN_ARG,`Number is too big`);let n=this._getSignedValue(),r=BigInt(t);return n<r?-1:+(n>r)}cmp(e){let t=this._getSignedValue(),n=e._getSignedValue();return t<n?-1:+(t>n)}ucmp(e){return this._magnitude<e._magnitude?-1:+(this._magnitude>e._magnitude)}gtn(e){return this.cmpn(e)===1}gt(e){return this.cmp(e)===1}gten(e){return this.cmpn(e)>=0}gte(e){return this.cmp(e)>=0}ltn(e){return this.cmpn(e)===-1}lt(e){return this.cmp(e)===-1}lten(e){return this.cmpn(e)<=0}lte(e){return this.cmp(e)<=0}eqn(e){return this.cmpn(e)===0}eq(e){return this.cmp(e)===0}toRed(e){return this.assert(this.red==null,`Already a number in reduction context`),this.assert(this._sign===0,`toRed works only with positives`),e.convertTo(this).forceRed(e)}fromRed(){return this.assert(this.red,`fromRed works only with numbers in reduction context`),this.red.convertFrom(this)}forceRed(e){return this.red=e,this}redAdd(e){return this.assert(this.red,`redAdd works only with red numbers`),this.red.add(this,e)}redIAdd(e){return this.assert(this.red,`redIAdd works only with red numbers`),this.red.iadd(this,e)}redSub(e){return this.assert(this.red,`redSub works only with red numbers`),this.red.sub(this,e)}redISub(e){return this.assert(this.red,`redISub works only with red numbers`),this.red.isub(this,e)}redShl(e){return this.assert(this.red,`redShl works only with red numbers`),this.red.shl(this,e)}redMul(e){return this.assert(this.red,`redMul works only with red numbers`),this.red.verify2(this,e),this.red.mul(this,e)}redIMul(e){return this.assert(this.red,`redIMul works only with red numbers`),this.red.verify2(this,e),this.red.imul(this,e)}redSqr(){return this.assert(this.red,`redSqr works only with red numbers`),this.red.verify1(this),this.red.sqr(this)}redISqr(){return this.assert(this.red,`redISqr works only with red numbers`),this.red.verify1(this),this.red.isqr(this)}redSqrt(){return this.assert(this.red,`redSqrt works only with red numbers`),this.red.verify1(this),this.red.sqrt(this)}redInvm(){return this.assert(this.red,`redInvm works only with red numbers`),this.red.verify1(this),this.red.invm(this)}redNeg(){return this.assert(this.red,`redNeg works only with red numbers`),this.red.verify1(this),this.red.neg(this)}redPow(e){return this.assert(this.red!=null&&e.red==null,`redPow(normalNum)`),this.red.verify1(this),this.red.pow(this,e)}static fromHex(t,n){let r=`be`;return(n===`little`||n===`le`)&&(r=`le`),new e(t,16,r)}toHex(e=0){if(this.isZero()&&e===0)return``;let t=this._getMinimalHex();t!==`0`&&t.length%2!=0&&(t=`0`+t);let n=e*2;for(;t.length<n;)t=`0`+t;return(this.isNeg()?`-`:``)+t}static fromJSON(t){return new e(t,16)}static fromNumber(t){return new e(t)}static fromString(t,n){return new e(t,n)}static fromSm(t,n=`big`){if(t.length===0)return new e(0n);let r=t.slice();n===`little`&&r.reverse();let i=0;r.length>0&&r[0]&128&&(i=1,r[0]&=127);let a;if(d)a=u.from(r).toString(`hex`);else{a=``;for(let e of r)a+=e<16?`0`+e.toString(16):e.toString(16)}let o=a.length===0?0n:BigInt(`0x`+a),s=new e(0n);return s._initializeState(o,i),s}toSm(e=`big`){if(this._magnitude===0n)return this._sign===1?[128]:[];let t=this._getMinimalHex();t.length%2!=0&&(t=`0`+t);let n=t.length/2,r=Array.from({length:n});for(let e=0,n=0;e<t.length;e+=2){let i=f[t.codePointAt(e)],a=f[t.codePointAt(e+1)];r[n++]=(i&15)<<4|a&15}let i;return this._sign===1?r[0]&128?i=[128,...r]:(i=r.slice(),i[0]|=128):i=r[0]&128?[0,...r]:r.slice(),e===`little`?i.reverse():i}static fromBits(t,n=!1){let r=t>>>24,i=t&8388607,a=!!(t&8388608);if(n&&a)throw Error(`negative bit set`);if(r===0&&i===0){if(a&&n)throw Error(`negative bit set for zero value`);return new e(0n)}let o=new e(i);return r<=3?o.iushrn((3-r)*8):o.iushln((r-3)*8),a&&o.ineg(),o}toBits(){if(this.strip(),this.isZero()&&!this.isNeg())return 0;let e=this.isNeg(),t=this.abs().toArray(`be`),n=0;for(;n<t.length-1&&t[n]===0;)n++;t=t.slice(n);let r=t.length,i;if(r===0)i=0;else if(r<=3){i=0;for(let e=0;e<r;e++)i=i<<8|t[e]}else i=t[0]<<16|t[1]<<8|t[2];i&8388608&&r<=255&&(i>>>=8,r++);let a=r<<24|i;return e&&(a|=8388608),a>>>0}static fromScriptNum(t,n=!1,r){if(r!==void 0&&t.length>r)throw Error(`script number overflow`);if(t.length===0)return new e(0n);if(n&&!(t.at(-1)&127)&&(t.length<=1||!(t.at(-2)&128)))throw Error(`non-minimally encoded script number`);return e.fromSm(t,`little`)}toScriptNum(){return this.toSm(`little`)}_invmp(t){this.assert(t._sign===0,`p must not be negative for _invmp`),this.assert(!t.isZero(),`p must not be zero for _invmp`);let n=this.umod(t),r=t.subn(2);if(n.red!==null)return n.redPow(r);let i=new e(1n),a=n.clone(),o=r.clone();for(;!o.isZero();)o.isOdd()&&(i=i.mul(a).umod(t)),a=a.sqr().umod(t),o.iushrn(1);return i}mulTo(e,t){return t._magnitude=this._magnitude*e._magnitude,t._sign=t._magnitude===0n?0:this._sign^e._sign,t._nominalWordLength=this.length+e.length,t.red=null,t.normSign(),t}},m=class{name;p;k;n;tmp;constructor(e,t){this.name=e,this.p=new p(t,16),this.n=this.p.bitLength(),this.k=new p(BigInt(1)).iushln(this.n).isub(this.p),this.tmp=this._tmp()}_tmp(){let e=new p(BigInt(0)),t=Math.ceil(this.n/p.wordSize);return e.expand(Math.max(1,t)),e}ireduce(e){let t=e,n;do this.split(t,this.tmp),this.imulK(t),t.iadd(this.tmp),n=t.bitLength();while(n>this.n);let r=n<this.n?-1:t.ucmp(this.p);return r===0?t.words=[0]:r>0&&t.isub(this.p),t.strip(),t}split(e,t){e.iushrn(this.n,0,t)}imulK(e){return e.imul(this.k)}},h=class extends m{constructor(){super(`k256`,`ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f`)}split(e,t){let n=4194303,r=e.words,i=e.length,a=Math.min(i,9),o=Array.from({length:a+ +(i>9)},()=>0);for(let e=0;e<a;e++)o[e]=r[e];let s=a;if(i<=9){let n=Array.from({length:s},()=>0);for(let e=0;e<s;++e)n[e]=o[e];t.words=n,e.words=[0];return}let c=r[9];o[s++]=c&n;let l=Array.from({length:s},()=>0);for(let e=0;e<s;++e)l[e]=o[e];t.words=l;let u=Array.from({length:Math.max(1,i-9)},()=>0),d=0;for(let e=10;e<i;e++){let t=Math.trunc(r[e]);d<u.length&&(u[d++]=(t&n)<<4|c>>>22),c=t}c>>>=22,d<u.length?u[d++]=c:c!==0&&u.length;let f=Array.from({length:d},()=>0);for(let e=0;e<d;++e)f[e]=u[e];e.words=f}imulK(e){let t=e.words,n=e.length,r=n+2,i=Array.from({length:r},()=>0);for(let e=0;e<n;e++)i[e]=t[e];let a=0;for(let e=0;e<r;e++){let t=Math.trunc(i[e]);a+=t*977,i[e]=a&67108863,a=t*64+Math.trunc(a/67108864)}return e.words=i,e}},g=class{prime;m;constructor(e){if(e===`k256`){let e=new h;this.m=e.p,this.prime=e}else this.assert(e.gtn(1),`modulus must be greater than 1`),this.m=e,this.prime=null}assert(e,t=`Assertion failed`){if(!e)throw Error(t)}verify1(e){this.assert(e.negative===0,`red works only with positives`),this.assert(e.red,`red works only with red numbers`)}verify2(e,t){this.assert((e.negative|t.negative)===0,`red works only with positives`),this.assert(e.red!=null&&e.red===t.red,`red works only with red numbers`)}imod(e){return this.prime==null?(p.move(e,e.umod(this.m).forceRed(this)),e):this.prime.ireduce(e).forceRed(this)}neg(e){return e.isZero()?e.clone():this.m.sub(e).forceRed(this)}add(e,t){this.verify2(e,t);let n=e.clone();return n.iadd(t),n.isub(this.m),n.isNeg()&&n.iadd(this.m),n}iadd(e,t){return this.verify2(e,t),e.iadd(t),e.isub(this.m),e.isNeg()&&e.iadd(this.m),e}sub(e,t){this.verify2(e,t);let n=e.sub(t);return n.cmpn(0)<0&&n.iadd(this.m),n.forceRed(this)}isub(e,t){this.verify2(e,t);let n=e.isub(t);return n.cmpn(0)<0&&n.iadd(this.m),n}shl(e,t){return this.verify1(e),this.imod(e.ushln(t))}imul(e,t){return this.verify2(e,t),this.imod(e.imul(t))}mul(e,t){return this.verify2(e,t),this.imod(e.mul(t))}isqr(e){return this.imul(e,e.clone())}sqr(e){return this.mul(e,e)}sqrt(e){if(e.isZero())return e.clone();let t=this.m.andln(3);if(this.assert(t%2==1),t===3){let t=this.m.add(new p(1)).iushrn(2);return this.pow(e,t)}let n=this.m.subn(1),r=0;for(;!n.isZero()&&n.andln(1)===0;)r++,n.iushrn(1);this.assert(!n.isZero());let i=new p(1).toRed(this),a=i.redNeg(),o=this.m.subn(1).iushrn(1),s=this.m.bitLength(),c=new p(2*s*s).toRed(this);for(;this.pow(c,o).cmp(a)!==0;)c.redIAdd(a);let l=this.pow(c,n),u=this.pow(e,n.addn(1).iushrn(1)),d=this.pow(e,n),f=r;for(;d.cmp(i)!==0;){let e=d,t=0;for(;e.cmp(i)!==0;)e=e.redSqr(),t++;this.assert(t<f);let n=this.pow(l,new p(1).iushln(f-t-1));u=u.redMul(n),l=n.redSqr(),d=d.redMul(l),f=t}return u}invm(e){let t=e._invmp(this.m);return t.negative===0?this.imod(t):(t.negative=0,this.imod(t).redNeg())}pow(e,t){if(this.verify1(e),t.isZero())return new p(1).toRed(this);let n=new p(1).toRed(this),r=e.clone(),i=t.bitLength();for(let e=i-1;e>=0;e--)n=this.sqr(n),t.testn(e)&&(n=this.mul(n,r));return n}convertTo(e){let t=e.umod(this.m);return t===e?t.clone():t}convertFrom(e){let t=e.clone();return t.red=null,t}},_=class extends g{shift;r;r2;rinv;minv;constructor(e){super(e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new p(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}convertTo(e){return this.imod(e.ushln(this.shift))}convertFrom(e){let t=this.imod(e.mul(this.rinv));return t.red=null,t}imul(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;let n=e.imul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),a=i;return i.cmp(this.m)>=0?a=i.isub(this.m):i.cmpn(0)<0&&(a=i.iadd(this.m)),a.forceRed(this)}mul(e,t){if(e.isZero()||t.isZero())return new p(0).forceRed(this);let n=e.mul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),a=i;return i.cmp(this.m)>=0?a=i.isub(this.m):i.cmpn(0)<0&&(a=i.iadd(this.m)),a.forceRed(this)}invm(e){return this.imod(e._invmp(this.m).mul(this.r2)).forceRed(this)}},v=/^[0-9a-fA-F]*$/;function y(e){if(typeof e!=`string`)throw TypeError(`Invalid hex string`);if(e.length!==0&&!v.test(e))throw Error(`Invalid hex string`)}function b(e){if(y(e),e.length===0)return``;let t=e.toLowerCase();return t.length%2!=0&&(t=`0`+t),t}var ee=(e,t=`Hash assertion failed`)=>{if(!e)throw Error(t)},te=class{pending=null;pendingTotal=0;blockSize;outSize;endian;_delta8;_delta32;padLength;hmacStrength;constructor(e,t,n,r){this.blockSize=e,this.outSize=t,this.hmacStrength=n,this.padLength=r/8,this.endian=`big`,this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}_update(e,t){throw Error(`Not implemented`)}_digest(){throw Error(`Not implemented`)}_digestHex(){throw Error(`Not implemented`)}update(e,t){if(e=C(e,t),this.pending=this.pending==null?e:this.pending.concat(e),this.pendingTotal+=e.length,this.pending.length>=this._delta8){e=this.pending;let t=e.length%this._delta8;this.pending=e.slice(e.length-t,e.length),this.pending.length===0&&(this.pending=null),e=Se(e,0,e.length-t,this.endian);for(let t=0;t<e.length;t+=this._delta32)this._update(e,t)}return this}digest(){return this.update(this._pad()),ee(this.pending===null),this._digest()}digestHex(){return this.update(this._pad()),ee(this.pending===null),this._digestHex()}_pad(){let e=this.pendingTotal;if(!Number.isSafeInteger(e)||e<0)throw Error(`Message too long for this hash function`);let t=this._delta8,n=t-(e+this.padLength)%t,r=Array.from({length:n+this.padLength});r[0]=128;let i=1;for(;i<n;i++)r[i]=0;let a=this.padLength,o=1n<<BigInt(a*8),s=BigInt(e)*8n;if(s>=o)throw Error(`Message too long for this hash function`);if(this.endian===`big`){let e=Array.from({length:a});for(let t=a-1;t>=0;t--)e[t]=Number(s&255n),s>>=8n;for(let t=0;t<a;t++)r[i++]=e[t]}else for(let e=0;e<a;e++)r[i++]=Number(s&255n),s>>=8n;return r}};function x(e,t,n){let r=e.codePointAt(t);return r<128?(n.push(r),t):r<2048?(n.push(r>>6|192,r&63|128),t):r>65535?(n.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128),t+1):(n.push(r>>12|224,r>>6&63|128,r&63|128),t)}function ne(e){let t=[],n=0;for(;n<e.length;)n=x(e,n,t)+1;return t}function S(e){y(e);let t=b(e),n=[];for(let e=0;e<t.length;e+=2)n.push(Number.parseInt(t[e]+t[e+1],16));return n}function re(e){let t=[];for(let n=0;n<e.length;n++)t[n]=Math.trunc(e[n]);return t}function C(e,t){return Array.isArray(e)?e.slice():e?typeof e==`string`?t===`hex`?S(e):ne(e):re(e):[]}function ie(e){return qt(e)}function ae(e,t){let n=``;for(let r of e)t===`little`&&(r=ie(r)),n+=oe(r.toString(16));return n}function oe(e){return e.length===7?`0`+e:e.length===6?`00`+e:e.length===5?`000`+e:e.length===4?`0000`+e:e.length===3?`00000`+e:e.length===2?`000000`+e:e.length===1?`0000000`+e:e}var se=typeof globalThis>`u`?void 0:globalThis.Buffer,ce=se!=null&&typeof se.from==`function`,le=`0123456789abcdef`,ue=Array.from({length:256});for(let e=0;e<ue.length;e++)ue[e]=le[e>>4&15]+le[e&15];function de(e){if(ce)return se.from(e).toString(`hex`);let t=Array.from({length:e.length});for(let n=0;n<e.length;n++)t[n]=ue[e[n]];return t.join(``)}var fe=(()=>{let e=typeof globalThis>`u`?void 0:globalThis.process,t=e?.getBuiltinModule;if(typeof t==`function`)try{let n=t.call(e,`node:crypto`);if(n!=null)return n}catch{}})();function pe(e,t){return e instanceof Uint8Array?e:Array.isArray(e)?new Uint8Array(e):Uint8Array.from(C(e,t))}function me(e){return typeof e==`string`?pe(e,`hex`):pe(e)}function he(e,t,n){e==null?t?.update(n):e.update(n)}function ge(e,t){return e==null?t==null?[]:Array.from(t.digest()):Array.from(e.digest())}function _e(e,t){return e==null?t==null?``:de(t.digest()):e.digest(`hex`)}function ve(e){let t=fe?.createHash;if(typeof t==`function`)try{return t(e)}catch{return}}function ye(e,t){let n=fe?.createHmac;if(typeof n==`function`)try{return n(e,t)}catch{return}}function be(e,t,n){let r=ve(e);if(r!=null)return r.update(pe(t,n)),r.digest()}function xe(e,t,n,r){let i=ye(e,me(t));if(i!=null)return i.update(pe(n,r)),i.digest()}function Se(e,t,n,r){let i=n-t;ee(i%4==0);let a=Array.from({length:i/4});for(let n=0,i=t;n<a.length;n++,i+=4){let t;t=r===`big`?e[i]<<24|e[i+1]<<16|e[i+2]<<8|e[i+3]:e[i+3]<<24|e[i+2]<<16|e[i+1]<<8|e[i],a[n]=t>>>0}return a}function Ce(e,t){let n=Array.from({length:e.length*4});for(let r=0,i=0;r<e.length;r++,i+=4){let a=e[r];t===`big`?(n[i]=a>>>24,n[i+1]=a>>>16&255,n[i+2]=a>>>8&255,n[i+3]=a&255):(n[i+3]=a>>>24,n[i+2]=a>>>16&255,n[i+1]=a>>>8&255,n[i]=a&255)}return n}function we(e,t){return e>>>t|e<<32-t}function Te(e,t){return e<<t|e>>>32-t}function Ee(e,t){return e+t>>>0}function w(e,t,n){return e+t+n>>>0}function T(e,t,n,r){return e+t+n+r>>>0}function De(e,t,n,r,i){return e+t+n+r+i>>>0}function Oe(e,t,n,r){return e===0?ke(t,n,r):e===1||e===3?je(t,n,r):e===2?Ae(t,n,r):0}function ke(e,t,n){return e&t^~e&n}function Ae(e,t,n){return e&t^e&n^t&n}function je(e,t,n){return e^t^n}function Me(e){return we(e,2)^we(e,13)^we(e,22)}function Ne(e){return we(e,6)^we(e,11)^we(e,25)}function Pe(e){return we(e,7)^we(e,18)^e>>>3}function Fe(e){return we(e,17)^we(e,19)^e>>>10}var Ie=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],Le=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],Re=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],ze=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11];function Be(e,t,n,r){return e<=15?t^n^r:e<=31?t&n|~t&r:e<=47?(t|~n)^r:e<=63?t&r|n&~r:t^(n|~r)}function Ve(e){return e<=15?0:e<=31?1518500249:e<=47?1859775393:e<=63?2400959708:2840853838}function He(e){return e<=15?1352829926:e<=31?1548603684:e<=47?1836072691:e<=63?2053994217:0}var Ue=class extends te{h;constructor(){super(512,160,192,64),this.endian=`little`,this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian=`little`}_update(e,t){let n=this.h[0],r=this.h[1],i=this.h[2],a=this.h[3],o=this.h[4],s=n,c=r,l=i,u=a,d=o,f;for(let p=0;p<80;p++)f=Ee(Te(T(n,Be(p,r,i,a),e[Ie[p]+t],Ve(p)),Re[p]),o),n=o,o=a,a=Te(i,10),i=r,r=f,f=Ee(Te(T(s,Be(79-p,c,l,u),e[Le[p]+t],He(p)),ze[p]),d),s=d,d=u,u=Te(l,10),l=c,c=f;f=w(this.h[1],i,u),this.h[1]=w(this.h[2],a,d),this.h[2]=w(this.h[3],o,s),this.h[3]=w(this.h[4],n,c),this.h[4]=w(this.h[0],r,l),this.h[0]=f}_digest(){return Ce(this.h,`little`)}_digestHex(){return ae(this.h,`little`)}},We=class extends te{h;W;k;constructor(){super(512,160,80,64),this.k=[1518500249,1859775393,2400959708,3395469782],this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=Array.from({length:80})}_update(e,t){let n=this.W;t??=0;let r=0;for(;r<16;r++)n[r]=e[t+r];for(;r<n.length;r++)n[r]=Te(n[r-3]^n[r-8]^n[r-14]^n[r-16],1);let i=this.h[0],a=this.h[1],o=this.h[2],s=this.h[3],c=this.h[4];for(r=0;r<n.length;r++){let e=Math.trunc(r/20),t=De(Te(i,5),Oe(e,a,o,s),c,n[r],this.k[e]);c=s,s=o,o=Te(a,30),a=i,i=t}this.h[0]=Ee(this.h[0],i),this.h[1]=Ee(this.h[1],a),this.h[2]=Ee(this.h[2],o),this.h[3]=Ee(this.h[3],s),this.h[4]=Ee(this.h[4],c)}_digest(){return Ce(this.h,`big`)}_digestHex(){return ae(this.h,`big`)}},Ge=class{h;native;blockSize=64;outSize=32;constructor(e){let t=me(e);this.native=ye(`sha256`,t),this.native??(this.h=new Kt(Lt,t))}update(e,t){return he(this.native,this.h,pe(e,t)),this}digest(){return ge(this.native,this.h)}digestHex(){return _e(this.native,this.h)}},Ke=class{h;native;blockSize=128;outSize=32;constructor(e){let t=me(e);this.native=ye(`sha512`,t),this.native??(this.h=new Kt(Gt,t))}update(e,t){return he(this.native,this.h,pe(e,t)),this}digest(){return ge(this.native,this.h)}digestHex(){return _e(this.native,this.h)}};function qe(e,t){return be(`sha256`,e,t)??new It().update(pe(e,t)).digest()}function Je(e,t){return be(`ripemd160`,e,t)}var Ye=(e,t)=>{let n=Je(e,t);return n==null?new Ue().update(e,t).digest():Array.from(n)},Xe=(e,t)=>new We().update(e,t).digest(),Ze=(e,t)=>Array.from(qe(e,t)),Qe=(e,t)=>Array.from(qe(qe(e,t))),$e=(e,t)=>{let n=qe(e,t),r=Je(n);return r==null?new Ue().update(n).digest():Array.from(r)},et=(e,t,n)=>{let r=xe(`sha256`,e,t,n);return r==null?new Ge(e).update(t,n).digest():Array.from(r)},tt=(e,t,n)=>{let r=xe(`sha512`,e,t,n);return r==null?new Ke(e).update(t,n).digest():Array.from(r)};function nt(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name===`Uint8Array`}function rt(e){if(!Number.isSafeInteger(e)||e<0)throw Error(`positive integer expected, got ${e}`)}function it(e,...t){if(!nt(e))throw Error(`Uint8Array expected`);if(t.length>0&&!t.includes(e.length)){let n=t.join(`,`);throw Error(`Uint8Array expected of length ${n}, got length=${e.length}`)}}function at(e){if(typeof e!=`function`||typeof e.create!=`function`)throw TypeError(`Hash should be wrapped by utils.createHasher`);rt(e.outputLen),rt(e.blockLen)}function ot(e,t=!0){if(e.destroyed===!0)throw Error(`Hash instance has been destroyed`);if(t&&e.finished===!0)throw Error(`Hash#digest() has already been called`)}function st(e,t){it(e);let n=t.outputLen;if(e.length<n)throw Error(`digestInto() expects output buffer of length at least ${n}`)}function ct(...e){for(let t of e)t.fill(0)}function lt(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function ut(e){return typeof e==`string`&&(e=dt(e)),it(e),e}function dt(e){if(typeof e!=`string`)throw Error(`string expected`);return new Uint8Array(new TextEncoder().encode(e))}var ft=class{};function pt(e){let t=t=>e().update(ut(t)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}var mt=BigInt(2**32-1),ht=BigInt(32);function gt(e,t=!1){return t?{h:Number(e&mt),l:Number(e>>ht&mt)}:{h:Number(e>>ht&mt)|0,l:Number(e&mt)|0}}function _t(e,t=!1){let n=e.length,r=new Uint32Array(n),i=new Uint32Array(n);for(let a=0;a<n;a++){let{h:n,l:o}=gt(e[a],t);r[a]=n,i[a]=o}return[r,i]}var vt=(e,t,n)=>e>>>n,yt=(e,t,n)=>e<<32-n|t>>>n,bt=(e,t,n)=>e>>>n|t<<32-n,xt=(e,t,n)=>e<<32-n|t>>>n,St=(e,t,n)=>e<<64-n|t>>>n-32,Ct=(e,t,n)=>e>>>n-32|t<<64-n;function wt(e,t,n,r){let i=(t>>>0)+(r>>>0);return{h:e+n+(i/2**32|0)|0,l:i|0}}var Tt=(e,t,n)=>(e>>>0)+(t>>>0)+(n>>>0),Et=(e,t,n,r)=>Math.trunc(t+n+r+Math.trunc(e/2**32)),Dt=(e,t,n,r)=>(e>>>0)+(t>>>0)+(n>>>0)+(r>>>0),Ot=(e,t,n,r,i)=>Math.trunc(t+n+r+i+Math.trunc(e/2**32)),kt=(e,t,n,r,i)=>(e>>>0)+(t>>>0)+(n>>>0)+(r>>>0)+(i>>>0),At=(e,t,n,r,i,a)=>t+n+r+i+a+(e/2**32|0)|0,jt=class extends ft{blockLen;outputLen;padOffset;isLE;buffer;view;finished=!1;length=0;pos=0;destroyed=!1;constructor(e,t,n,r){super(),this.blockLen=e,this.outputLen=t,this.padOffset=n,this.isLE=r,this.buffer=new Uint8Array(e),this.view=lt(this.buffer)}update(e){ot(this),e=ut(e),it(e);let{view:t,buffer:n,blockLen:r}=this,i=e.length;for(let a=0;a<i;){let o=Math.min(r-this.pos,i-a);if(o===r){let t=lt(e);for(;r<=i-a;a+=r)this.process(t,a);continue}n.set(e.subarray(a,a+o),this.pos),this.pos+=o,a+=o,this.pos===r&&(this.process(t,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){ot(this),st(e,this),this.finished=!0;let{buffer:t,view:n,blockLen:r,isLE:i}=this,{pos:a}=this;t[a++]=128,ct(this.buffer.subarray(a)),this.padOffset>r-a&&(this.process(n,0),a=0);for(let e=a;e<r;e++)t[e]=0;Mt(n,r-8,BigInt(this.length*8),i),this.process(n,0);let o=lt(e),s=this.outputLen;if(s%4!=0)throw Error(`_sha2: outputLen should be aligned to 32bit`);let c=s/4,l=this.get();if(c>l.length)throw Error(`_sha2: outputLen bigger than state`);for(let e=0;e<c;e++)o.setUint32(4*e,l[e],i)}digest(){let{buffer:e,outputLen:t}=this;this.digestInto(e);let n=e.slice(0,t);return this.destroy(),n}_cloneInto(e){e??=new this.constructor,e.set(...this.get());let{blockLen:t,buffer:n,length:r,finished:i,destroyed:a,pos:o}=this;return e.destroyed=a,e.finished=i,e.length=r,e.pos=o,r%t!==0&&e.buffer.set(n),e}clone(){return this._cloneInto()}};function Mt(e,t,n,r){if(typeof e.setBigUint64==`function`)return e.setBigUint64(t,n,r);let i=BigInt(32),a=BigInt(4294967295),o=Number(n>>i&a),s=Number(n&a),c=r?4:0,l=r?0:4;e.setUint32(t+c,o,r),e.setUint32(t+l,s,r)}var Nt=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Pt=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),Ft=new Uint32Array(64),It=class extends jt{A=Nt[0]|0;B=Nt[1]|0;C=Nt[2]|0;D=Nt[3]|0;E=Nt[4]|0;F=Nt[5]|0;G=Nt[6]|0;H=Nt[7]|0;constructor(e=32){super(64,e,8,!1)}get(){let{A:e,B:t,C:n,D:r,E:i,F:a,G:o,H:s}=this;return[e,t,n,r,i,a,o,s]}set(...[e,t,n,r,i,a,o,s]){this.A=e|0,this.B=t|0,this.C=n|0,this.D=r|0,this.E=i|0,this.F=a|0,this.G=o|0,this.H=s|0}process(e,t){for(let n=0;n<16;n++,t+=4)Ft[n]=e.getUint32(t);for(let e=16;e<64;e++){let t=Ft[e-15],n=Ft[e-2],r=Pe(t),i=Fe(n);Ft[e]=Ee(Ee(r,Ft[e-7]),Ee(i,Ft[e-16]))}let{A:n,B:r,C:i,D:a,E:o,F:s,G:c,H:l}=this;for(let e=0;e<64;e++){let t=De(l,Ne(o),ke(o,s,c),Pt[e],Ft[e]),u=Ee(Me(n),Ae(n,r,i));l=c,c=s,s=o,o=Ee(a,t),a=i,i=r,r=n,n=Ee(t,u)}this.A=Ee(this.A,n),this.B=Ee(this.B,r),this.C=Ee(this.C,i),this.D=Ee(this.D,a),this.E=Ee(this.E,o),this.F=Ee(this.F,s),this.G=Ee(this.G,c),this.H=Ee(this.H,l)}roundClean(){ct(Ft)}destroy(){ct(this.buffer),this.set(0,0,0,0,0,0,0,0)}},Lt=pt(()=>new It),Rt=Uint32Array.from([1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209]),zt=_t(`0x428a2f98d728ae22.0x7137449123ef65cd.0xb5c0fbcfec4d3b2f.0xe9b5dba58189dbbc.0x3956c25bf348b538.0x59f111f1b605d019.0x923f82a4af194f9b.0xab1c5ed5da6d8118.0xd807aa98a3030242.0x12835b0145706fbe.0x243185be4ee4b28c.0x550c7dc3d5ffb4e2.0x72be5d74f27b896f.0x80deb1fe3b1696b1.0x9bdc06a725c71235.0xc19bf174cf692694.0xe49b69c19ef14ad2.0xefbe4786384f25e3.0x0fc19dc68b8cd5b5.0x240ca1cc77ac9c65.0x2de92c6f592b0275.0x4a7484aa6ea6e483.0x5cb0a9dcbd41fbd4.0x76f988da831153b5.0x983e5152ee66dfab.0xa831c66d2db43210.0xb00327c898fb213f.0xbf597fc7beef0ee4.0xc6e00bf33da88fc2.0xd5a79147930aa725.0x06ca6351e003826f.0x142929670a0e6e70.0x27b70a8546d22ffc.0x2e1b21385c26c926.0x4d2c6dfc5ac42aed.0x53380d139d95b3df.0x650a73548baf63de.0x766a0abb3c77b2a8.0x81c2c92e47edaee6.0x92722c851482353b.0xa2bfe8a14cf10364.0xa81a664bbc423001.0xc24b8b70d0f89791.0xc76c51a30654be30.0xd192e819d6ef5218.0xd69906245565a910.0xf40e35855771202a.0x106aa07032bbd1b8.0x19a4c116b8d2d0c8.0x1e376c085141ab53.0x2748774cdf8eeb99.0x34b0bcb5e19b48a8.0x391c0cb3c5c95a63.0x4ed8aa4ae3418acb.0x5b9cca4f7763e373.0x682e6ff3d6b2b8a3.0x748f82ee5defb2fc.0x78a5636f43172f60.0x84c87814a1f0ab72.0x8cc702081a6439ec.0x90befffa23631e28.0xa4506cebde82bde9.0xbef9a3f7b2c67915.0xc67178f2e372532b.0xca273eceea26619c.0xd186b8c721c0c207.0xeada7dd6cde0eb1e.0xf57d4f7fee6ed178.0x06f067aa72176fba.0x0a637dc5a2c898a6.0x113f9804bef90dae.0x1b710b35131c471b.0x28db77f523047d84.0x32caab7b40c72493.0x3c9ebe0a15c9bebc.0x431d67c49c100d4c.0x4cc5d4becb3e42b6.0x597f299cfc657e2a.0x5fcb6fab3ad6faec.0x6c44198c4a475817`.split(`.`).map(BigInt)),Bt=zt[0],Vt=zt[1],Ht=new Uint32Array(80),Ut=new Uint32Array(80),Wt=class extends jt{Ah=Rt[0]|0;Al=Rt[1]|0;Bh=Rt[2]|0;Bl=Rt[3]|0;Ch=Rt[4]|0;Cl=Rt[5]|0;Dh=Rt[6]|0;Dl=Rt[7]|0;Eh=Rt[8]|0;El=Rt[9]|0;Fh=Rt[10]|0;Fl=Rt[11]|0;Gh=Rt[12]|0;Gl=Rt[13]|0;Hh=Rt[14]|0;Hl=Rt[15]|0;constructor(e=64){super(128,e,16,!1)}get(){let{Ah:e,Al:t,Bh:n,Bl:r,Ch:i,Cl:a,Dh:o,Dl:s,Eh:c,El:l,Fh:u,Fl:d,Gh:f,Gl:p,Hh:m,Hl:h}=this;return[e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h]}set(...[e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h]){this.Ah=e|0,this.Al=t|0,this.Bh=n|0,this.Bl=r|0,this.Ch=i|0,this.Cl=a|0,this.Dh=o|0,this.Dl=s|0,this.Eh=c|0,this.El=l|0,this.Fh=u|0,this.Fl=d|0,this.Gh=f|0,this.Gl=p|0,this.Hh=m|0,this.Hl=h|0}process(e,t){for(let n=0;n<16;n++,t+=8)Ht[n]=e.getUint32(t),Ut[n]=e.getUint32(t+4);for(let e=16;e<80;e++){let t=Ht[e-15]|0,n=Ut[e-15]|0,r=bt(t,n,1)^bt(t,n,8)^vt(t,n,7),i=xt(t,n,1)^xt(t,n,8)^yt(t,n,7),a=Ht[e-2]|0,o=Ut[e-2]|0,s=bt(a,o,19)^St(a,o,61)^vt(a,o,6),c=Dt(i,xt(a,o,19)^Ct(a,o,61)^yt(a,o,6),Ut[e-7],Ut[e-16]),l=Ot(c,r,s,Ht[e-7],Ht[e-16]);Ht[e]=l|0,Ut[e]=c|0}let{Ah:n,Al:r,Bh:i,Bl:a,Ch:o,Cl:s,Dh:c,Dl:l,Eh:u,El:d,Fh:f,Fl:p,Gh:m,Gl:h,Hh:g,Hl:_}=this;for(let e=0;e<80;e++){let t=bt(u,d,14)^bt(u,d,18)^St(u,d,41),v=xt(u,d,14)^xt(u,d,18)^Ct(u,d,41),y=u&f^~u&m,b=d&p^~d&h,ee=kt(_,v,b,Vt[e],Ut[e]),te=At(ee,g,t,y,Bt[e],Ht[e]),x=ee|0,ne=bt(n,r,28)^St(n,r,34)^St(n,r,39),S=xt(n,r,28)^Ct(n,r,34)^Ct(n,r,39),re=n&i^n&o^i&o,C=r&a^r&s^a&s;g=m|0,_=h|0,m=f|0,h=p|0,f=u|0,p=d|0,{h:u,l:d}=wt(c|0,l|0,te|0,x|0),c=o|0,l=s|0,o=i|0,s=a|0,i=n|0,a=r|0;let ie=Tt(S,C,x);n=Et(ie,ne,re,te),r=ie|0}({h:n,l:r}=wt(n,r,this.Ah,this.Al)),{h:i,l:a}=wt(i,a,this.Bh,this.Bl),{h:o,l:s}=wt(o,s,this.Ch,this.Cl),{h:c,l}=wt(c,l,this.Dh,this.Dl),{h:u,l:d}=wt(u,d,this.Eh,this.El),{h:f,l:p}=wt(f,p,this.Fh,this.Fl),{h:m,l:h}=wt(m,h,this.Gh,this.Gl),{h:g,l:_}=wt(g,_,this.Hh,this.Hl),this.set(n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_)}roundClean(){ct(Ht,Ut)}destroy(){ct(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}},Gt=pt(()=>new Wt),Kt=class extends ft{oHash;iHash;blockLen;outputLen;finished=!1;destroyed=!1;constructor(e,t){super(),at(e);let n=ut(t);if(this.iHash=e.create(),typeof this.iHash.update!=`function`)throw TypeError(`Expected instance of class which extends utils.Hash`);this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;let r=this.blockLen,i=new Uint8Array(r);i.set(n.length>r?e.create().update(n).digest():n);for(let e=0;e<i.length;e++)i[e]^=54;this.iHash.update(i),this.oHash=e.create();for(let e=0;e<i.length;e++)i[e]^=106;this.oHash.update(i),ct(i)}update(e){return ot(this),this.iHash.update(e),this}digestInto(e){ot(this),it(e,this.outputLen),this.finished=!0,this.iHash.digestInto(e),this.oHash.update(e),this.oHash.digestInto(e),this.destroy()}digest(){let e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e??=Object.create(Object.getPrototypeOf(this),{});let{oHash:t,iHash:n,finished:r,destroyed:i,blockLen:a,outputLen:o}=this;return e=e,e.finished=r,e.destroyed=i,e.blockLen=a,e.outputLen=o,e.oHash=t._cloneInto(e.oHash??void 0),e.iHash=n._cloneInto(e.iHash??void 0),e}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}};function qt(e){return(e>>>24|e>>>8&65280|e<<8&16711680|(e&255)<<24)>>>0}(()=>{let e=new ArrayBuffer(4),t=new Uint32Array(e),n=new Uint8Array(e);return t[0]=16909060,n[0]===4})();var Jt=class{buffer;pos;capacity;constructor(e,t=256){if(e!=null&&e.length>0){let n=e.reduce((e,t)=>e+t.length,0);t=Math.max(t,n)}if(this.buffer=new Uint8Array(t),this.pos=0,this.capacity=t,e!=null)for(let t of e)this.write(t)}getLength(){return this.pos}toUint8Array(){return this.buffer.slice(0,this.pos)}toArray(){return Array.from(this.toUint8Array())}toUint8ArrayZeroCopy(){return this.buffer.subarray(0,this.pos)}reserve(e){if(!Number.isSafeInteger(e)||e<0)throw RangeError(`WriterUint8Array reserve requires a non-negative safe integer`);this.ensureCapacity(e)}ensureCapacity(e){if(this.pos+e>this.capacity){let t=this.capacity*2;for(;this.pos+e>t;)t*=2;let n=new Uint8Array(t);n.set(this.buffer),this.buffer=n,this.capacity=t}}write(e){let t=e instanceof Uint8Array?e:new Uint8Array(e);return this.ensureCapacity(t.length),this.buffer.set(t,this.pos),this.pos+=t.length,this}writeReverse(e){let t=e instanceof Uint8Array?e:new Uint8Array(e);this.ensureCapacity(t.length);for(let e=t.length-1;e>=0;e--)this.buffer[this.pos]=t[e],this.pos+=1;return this}writeUInt8(e){return this.ensureCapacity(1),this.buffer[this.pos]=e&255,this.pos+=1,this}writeInt8(e){return this.writeUInt8(e),this}writeUInt16LE(e){return this.ensureCapacity(2),this.buffer[this.pos]=e&255,this.buffer[this.pos+1]=e>>8&255,this.pos+=2,this}writeUInt16BE(e){return this.ensureCapacity(2),this.buffer[this.pos]=e>>8&255,this.buffer[this.pos+1]=e&255,this.pos+=2,this}writeInt16LE(e){return this.writeUInt16LE(e&65535),this}writeInt16BE(e){return this.writeUInt16BE(e&65535),this}writeUInt32LE(e){return this.ensureCapacity(4),this.buffer[this.pos]=e&255,this.buffer[this.pos+1]=e>>8&255,this.buffer[this.pos+2]=e>>16&255,this.buffer[this.pos+3]=e>>24&255,this.pos+=4,this}writeUInt32BE(e){return this.ensureCapacity(4),this.buffer[this.pos]=e>>24&255,this.buffer[this.pos+1]=e>>16&255,this.buffer[this.pos+2]=e>>8&255,this.buffer[this.pos+3]=e&255,this.pos+=4,this}writeInt32LE(e){return this.writeUInt32LE(e>>>0),this}writeInt32BE(e){return this.writeUInt32BE(e>>>0),this}writeUInt64BEBn(e){let t=e.toArray(`be`,8);return this.write(t),this}writeUInt64LEBn(e){let t=e.toArray(`be`,8);return this.writeReverse(t),this}writeUInt64LE(e){let t=new p(e).toArray(`be`,8);return this.writeReverse(t),this}writeVarIntNum(e){let t=_n.varIntNum(e);return this.write(t),this}writeVarIntBn(e){let t=_n.varIntBn(e);return this.write(t),this}reset(){this.pos=0}},Yt=class e{bin;pos;length;static makeReader(t,n=0){if(t instanceof Uint8Array)return new e(t,n);if(Array.isArray(t))return new vn(t,n);throw Error(`ReaderUint8Array.makeReader: bin must be Uint8Array or number[]`)}constructor(e=new Uint8Array,t=0){if(e instanceof Uint8Array)this.bin=e;else if(Array.isArray(e))this.bin=new Uint8Array(e);else throw TypeError(`ReaderUint8Array constructor: bin must be Uint8Array or number[]`);this.pos=t,this.length=this.bin.length}eof(){return this.pos>=this.length}read(e=this.length){let t=this.pos,n=this.pos+e;return this.pos=n,this.bin.slice(t,n)}readView(e=this.length-this.pos){if(!Number.isSafeInteger(e)||e<0||this.pos+e>this.length)throw RangeError(`ReaderUint8Array read exceeds available data`);let t=this.pos;return this.pos+=e,this.bin.subarray(t,this.pos)}skip(e){if(!Number.isSafeInteger(e)||e<0||this.pos+e>this.length)throw RangeError(`ReaderUint8Array skip exceeds available data`);this.pos+=e}remaining(){return this.length-this.pos}readReverse(e=this.length){let t=new Uint8Array(e);for(let n=0;n<e;n++)t[n]=this.bin[this.pos+e-1-n];return this.pos+=e,t}readUInt8(){let e=this.bin[this.pos];return this.pos+=1,e}readInt8(){let e=this.bin[this.pos];return this.pos+=1,e&128?e-256:e}readUInt16BE(){let e=this.bin[this.pos]<<8|this.bin[this.pos+1];return this.pos+=2,e}readInt16BE(){let e=this.readUInt16BE();return e&32768?e-65536:e}readUInt16LE(){let e=this.bin[this.pos]|this.bin[this.pos+1]<<8;return this.pos+=2,e}readInt16LE(){let e=this.readUInt16LE();return e&32768?e-65536:e}readUInt32BE(){let e=this.bin[this.pos]*16777216+(this.bin[this.pos+1]<<16|this.bin[this.pos+2]<<8|this.bin[this.pos+3]);return this.pos+=4,e}readInt32BE(){let e=this.readUInt32BE();return e&2147483648?e-4294967296:e}readUInt32LE(){let e=(this.bin[this.pos]|this.bin[this.pos+1]<<8|this.bin[this.pos+2]<<16|this.bin[this.pos+3]<<24)>>>0;return this.pos+=4,e}readInt32LE(){let e=this.readUInt32LE();return e&2147483648?e-4294967296:e}readUInt64BEBn(){let e=new p(Array.from(this.bin.slice(this.pos,this.pos+8)));return this.pos+=8,e}readUInt64LEBn(){return new p(Array.from(this.readReverse(8)))}readInt64LEBn(){let e=new p(2).pow(new p(63)),t=new p(2).pow(new p(64)),n=new p(Array.from(this.readReverse(8)));return n.gte(e)&&(n=n.sub(t)),n}readVarIntNum(e=!0){let t=this.readUInt8(),n;switch(t){case 253:return this.readUInt16LE();case 254:return this.readUInt32LE();case 255:if(n=e?this.readInt64LEBn():this.readUInt64LEBn(),n.lte(new p(2).pow(new p(53))))return n.toNumber();throw Error(`number too large to retain precision - use readVarIntBn`);default:return t}}readVarInt(){switch(this.bin[this.pos]){case 253:return this.read(3);case 254:return this.read(5);case 255:return this.read(9);default:return this.read(1)}}readVarIntBn(){let e=this.readUInt8();switch(e){case 253:return new p(this.readUInt16LE());case 254:return new p(this.readUInt32LE());case 255:return this.readUInt64LEBn();default:return new p(e)}}},Xt=globalThis.Buffer,Zt=Xt!=null&&typeof Xt.from==`function`,Qt=`0123456789abcdef`,$t=Array.from({length:256},()=>``);for(let e=0;e<256;e++)$t[e]=Qt[e>>4&15]+Qt[e&15];var E=e=>Zt?Xt.from(e).toString(`hex`):e.length===0?``:Array.from(e,e=>$t[e&255]).join(``),en=(e,t)=>e instanceof Uint8Array?e:typeof e==`string`&&t===`hex`?D(e):new Uint8Array(tn(e,t)),tn=(e,t)=>{if(Array.isArray(e))return e.slice();if(e===void 0)return[];if(typeof e!=`string`)return Array.from(e,e=>Math.trunc(e));switch(t){case`hex`:return rn(e);case`base64`:return sn(e);default:return cn(e)}},nn=new Int8Array(256).fill(-1);for(let e=0;e<10;e++)nn[48+e]=e;for(let e=0;e<6;e++)nn[65+e]=10+e,nn[97+e]=10+e;var rn=e=>Array.from(D(e)),D=e=>{y(e);let t=e.length%2==0?e:`0`+e;if(Zt){let e=Xt.from(t,`hex`);return new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}let n=new Uint8Array(t.length/2),r=0;for(let e=0;e<t.length;e+=2){let i=nn[t.codePointAt(e)],a=nn[t.codePointAt(e+1)];n[r++]=i<<4|a}return n},an=e=>{if(typeof e!=`string`)throw TypeError(`msg must be a string`);let t=e.trim().replaceAll(/[\r\n\t\f\v ]+/g,``).replaceAll(`-`,`+`).replaceAll(`_`,`/`),n=t.indexOf(`=`);if(n===-1)return t;let r=t.slice(n);if(!/^={1,2}$/.test(r)||t.slice(0,n).includes(`=`))throw Error(`Invalid base64 padding`);return t.slice(0,n)},on=(e,t)=>{if(e>=65&&e<=90)return e-65;if(e>=97&&e<=122)return e-97+26;if(e>=48&&e<=57)return e-48+52;if(e===43)return 62;if(e===47)return 63;throw Error(`Invalid base64 character at index ${t}`)};function sn(e){let t=an(e),n=[],r=0,i=0;for(let e=0;e<t.length;e++){let a=on(t.codePointAt(e),e);for(r=r<<6|a,i+=6;i>=8;)i-=8,n.push(r>>i&255),r&=(1<<i)-1}return n}function cn(e){return Array.from(new TextEncoder().encode(e))}var ln=e=>new TextDecoder().decode(e instanceof Uint8Array?e:new Uint8Array(e)),un=(e,t)=>{switch(t){case`hex`:return E(e);case`utf8`:return ln(e);default:return e}};function dn(e){let t=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,n=``,r=0;for(;r<e.length;r+=3){let i=e[r],a=r+1<e.length?e[r+1]:0,o=r+2<e.length?e[r+2]:0,s=i>>2,c=(i&3)<<4|a>>4,l=(a&15)<<2|o>>6,u=o&63;n+=t.charAt(s)+t.charAt(c),n+=r+1<e.length?t.charAt(l):`=`,n+=r+2<e.length?t.charAt(u):`=`}return n}var fn=`123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz`,pn=e=>{if(e===``||typeof e!=`string`)throw Error(`Expected base58 string but got “${e}”`);let t=e.match(/[^1-9A-HJ-NP-Za-km-z]/gmu);if(t!==null)throw Error(`Invalid base58 character “${t.join(``)}”`);let n=e.match(/^1+/gmu),r=n===null?0:n[0].length,i=(e.length-r)*(Math.log(58)/Math.log(256))+1>>>0;return[...new Uint8Array([...new Uint8Array(r),...Array.from(e).map(e=>fn.indexOf(e)).reduce((e,t)=>(e=e.map(e=>{let n=e*58+t;return t=n>>8,n}),e),new Uint8Array(i)).reverse().filter((e=>t=>e||=t)(!1))])]},mn=e=>{let t=Array.from({length:256},()=>-1);for(let e=0;e<58;++e)t[fn.codePointAt(e)]=e;let n=[];for(let r of e){let e=r;for(let r=0;r<n.length;++r){let i=(t[n[r]]<<8)+e,a=Math.trunc(i/58),o=i-a*58;n[r]=fn.codePointAt(o),e=a}for(;e!==0;){let t=Math.trunc(e/58),r=e-t*58;n.push(fn.codePointAt(r)),e=t}}for(let t of e)if(t===0)n.push(`1`.codePointAt(0));else break;return n.reverse(),String.fromCodePoint(...n)},hn=(e,t=[0])=>{let n=Qe([...t,...e]);return n=[...t,...e,...n.slice(0,4)],mn(n)},gn=(e,t,n=1)=>{let r=pn(e),i=r.slice(0,n),a=r.slice(n,-4),o=[...i,...a];return o=Qe(o),r.slice(-4).forEach((e,t)=>{if(e!==o[t])throw Error(`Invalid checksum`)}),t===`hex`&&(i=E(i),a=E(a)),{prefix:i,data:a}},_n=class e{bufs;length;constructor(e){this.bufs=e??[],this.length=0;for(let e of this.bufs)this.length+=e.length}getLength(){return this.length}toUint8Array(){let e=new Uint8Array(this.length),t=0;for(let n of this.bufs)e.set(n,t),t+=n.length;return e}toArray(){let e=this.length,t=Array.from({length:e},()=>0),n=0;for(let e of this.bufs)if(e instanceof Uint8Array)for(let r of e)t[n++]=r;else{let r=e;for(let e of r)t[n++]=e}return t}toHex(){return this.toArray().map(e=>e.toString(16).padStart(2,`0`)).join(``)}write(e){return this.bufs.push(e),this.length+=e.length,this}writeReverse(e){let t=Array.from({length:e.length},()=>0);for(let n=0;n<t.length;n++)t[n]=e[e.length-1-n];return this.write(t)}writeUInt8(e){let t=Array.from({length:1},()=>0);return t[0]=e&255,this.write(t),this}writeInt8(e){return this.writeUInt8(e)}writeUInt16BE(e){let t=[e>>8&255,e&255];return this.write(t)}writeInt16BE(e){return this.writeUInt16BE(e&65535)}writeUInt16LE(e){let t=[e&255,e>>8&255];return this.write(t)}writeInt16LE(e){return this.writeUInt16LE(e&65535)}writeUInt32BE(e){let t=[e>>24&255,e>>16&255,e>>8&255,e&255];return this.write(t)}writeInt32BE(e){return this.writeUInt32BE(e>>>0)}writeUInt32LE(e){let t=[e&255,e>>8&255,e>>16&255,e>>24&255];return this.write(t)}writeInt32LE(e){return this.writeUInt32LE(e>>>0)}writeUInt64BEBn(e){let t=e.toArray(`be`,8);return this.write(t),this}writeUInt64LEBn(e){let t=e.toArray(`be`,8);return this.writeReverse(t),this}writeUInt64LE(e){if(e===-1)this.write(Array.from({length:8},()=>255));else{let t=new p(e).toArray(`be`,8);this.writeReverse(t)}return this}writeVarIntNum(t){let n=e.varIntNum(t);return this.write(n),this}writeVarIntBn(t){let n=e.varIntBn(t);return this.write(n),this}static varIntNum(e){let t;if(e<0)return this.varIntBn(new p(e));if(e<253)t=[e];else if(e<65536)t=[253,e&255,e>>8&255];else if(e<4294967296)t=[254,e&255,e>>8&255,e>>16&255,e>>24&255];else{let n=e&4294967295,r=Math.floor(e/4294967296)&4294967295;t=[255,n&255,n>>8&255,n>>16&255,n>>24&255,r&255,r>>8&255,r>>16&255,r>>24&255]}return t}static varIntBn(t){let n;if(t.isNeg()&&(t=t.add(xn)),t.ltn(253))n=[t.toNumber()];else if(t.ltn(65536)){let e=t.toNumber();n=[253,e&255,e>>8&255]}else if(t.lt(new p(4294967296))){let e=t.toNumber();n=[254,e&255,e>>8&255,e>>16&255,e>>24&255]}else{let r=new e;r.writeUInt8(255),r.writeUInt64LEBn(t),n=r.toArray()}return n}},vn=class{bin;pos;length;constructor(e=[],t=0){this.bin=e,this.pos=t,this.length=e.length}eof(){return this.pos>=this.length}read(e=this.length){let t=this.pos,n=this.pos+e;return this.pos=n,this.bin.slice(t,n)}readReverse(e=this.length){let t=Array.from({length:e},()=>0);for(let n=0;n<e;n++)t[n]=this.bin[this.pos+e-1-n];return this.pos+=e,t}readUInt8(){let e=this.bin[this.pos];return this.pos+=1,e}readInt8(){let e=this.bin[this.pos];return this.pos+=1,e&128?e-256:e}readUInt16BE(){let e=this.bin[this.pos]<<8|this.bin[this.pos+1];return this.pos+=2,e}readInt16BE(){let e=this.readUInt16BE();return e&32768?e-65536:e}readUInt16LE(){let e=this.bin[this.pos]|this.bin[this.pos+1]<<8;return this.pos+=2,e}readInt16LE(){let e=this.readUInt16LE();return e&32768?e-65536:e}readUInt32BE(){let e=this.bin[this.pos]*16777216+(this.bin[this.pos+1]<<16|this.bin[this.pos+2]<<8|this.bin[this.pos+3]);return this.pos+=4,e}readInt32BE(){let e=this.readUInt32BE();return e&2147483648?e-4294967296:e}readUInt32LE(){let e=(this.bin[this.pos]|this.bin[this.pos+1]<<8|this.bin[this.pos+2]<<16|this.bin[this.pos+3]<<24)>>>0;return this.pos+=4,e}readInt32LE(){let e=this.readUInt32LE();return e&2147483648?e-4294967296:e}readUInt64BEBn(){let e=new p(this.bin.slice(this.pos,this.pos+8));return this.pos+=8,e}readUInt64LEBn(){return new p(this.readReverse(8))}readInt64LEBn(){let e=new p(this.readReverse(8));return e.gte(bn)&&(e=e.sub(xn)),e}readVarIntNum(e=!0){let t=this.readUInt8(),n;switch(t){case 253:return this.readUInt16LE();case 254:return this.readUInt32LE();case 255:if(n=e?this.readInt64LEBn():this.readUInt64LEBn(),n.lte(new p(2).pow(new p(53))))return n.toNumber();throw Error(`number too large to retain precision - use readVarIntBn`);default:return t}}readVarInt(){switch(this.bin[this.pos]){case 253:return this.read(3);case 254:return this.read(5);case 255:return this.read(9);default:return this.read(1)}}readVarIntBn(){let e=this.readUInt8();switch(e){case 253:return new p(this.readUInt16LE());case 254:return new p(this.readUInt32LE());case 255:return this.readUInt64LEBn();default:return new p(e)}}},yn=e=>{if(e.length===0)return e;let t=e.at(-1);if(t&127)return e;if(e.length===1)return[];if(e.at(-2)&128)return e;for(let n=e.length-1;n>0;n--)if(e[n-1]!==0)return e[n-1]&128?(e[n]=t,e.slice(0,n+1)):(e[n-1]|=t,e.slice(0,n));return[]},bn=new p(2).pow(new p(63)),xn=new p(2).pow(new p(64));function Sn(e,t=`Expected a valid value, but got undefined or null.`){if(e==null)throw Error(t);return e}var Cn;function wn(e,t){let n=e.andln(3)+t&3;return n===3?-1:n}function Tn(e,t,n,r){if(!(n&1))return 0;let i=e.andln(7)+t&7;return(i===3||i===5)&&r===2?-n:n}function En(e,t){return 2*e===t+1?1-e:e}var Dn=class e{p;red;redN;zero;one;two;g;n;a;b;tinv;zeroA;threeA;endo;_endoWnafT1;_endoWnafT2;_wnafT1;_wnafT2;_wnafT3;_wnafT4;_bitLength;static assert(e,t=`Elliptic curve assertion failed`){if(!e)throw Error(t)}getNAF(e,t,n){let r=Array.from({length:Math.max(e.bitLength(),n)+1},()=>0);r.fill(0);let i=1<<t+1,a=e.clone();for(let e=0;e<r.length;e++){let t,n=a.andln(i-1);a.isOdd()?(t=n>(i>>1)-1?(i>>1)-n:n,a.isubn(t)):t=0,r[e]=t,a.iushrn(1)}return r}getJSF(e,t){let n=[[],[]];e=e.clone(),t=t.clone();let r=0,i=0;for(;e.cmpn(-r)>0||t.cmpn(-i)>0;){let a=wn(e,r),o=wn(t,i),s=Tn(e,r,a,o);n[0].push(s);let c=Tn(t,i,o,a);n[1].push(c),r=En(r,s),i=En(i,c),e.iushrn(1),t.iushrn(1)}return n}static cachedProperty(e,t,n){let r=`_`+t;e.prototype[t]=function(){return this[r]===void 0&&(this[r]=n.call(this)),this[r]}}static parseBytes(e){return typeof e==`string`?tn(e,`hex`):e}static intFromLE(e){return new p(e,`hex`,`le`)}constructor(){if(Cn===void 0)Cn=this;else return Cn;let e={prime:`k256`,p:`ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f`,a:`0`,b:`7`,n:`ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141`,h:`1`,beta:`7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee`,lambda:`5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72`,basis:[{a:`3086d221a7d46bcde86c90e49284eb15`,b:`-e4437ed6010e88286f547fa90abfe4c3`},{a:`114ca50f7a8e2f3f657c1108d9d44cfd8`,b:`3086d221a7d46bcde86c90e49284eb15`}],gRed:!1,g:[`79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798`,`483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8`,{doubles:{step:4,points:[[`e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a`,`f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821`],[`8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508`,`11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf`],[`175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739`,`d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695`],[`363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640`,`4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9`],[`8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c`,`4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36`],[`723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda`,`96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f`],[`eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa`,`5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999`],[`100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0`,`cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09`],[`e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d`,`9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d`],[`feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d`,`e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088`],[`da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1`,`9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d`],[`53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0`,`5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8`],[`8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047`,`10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a`],[`385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862`,`283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453`],[`6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7`,`7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160`],[`3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd`,`56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0`],[`85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83`,`7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6`],[`948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a`,`53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589`],[`6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8`,`bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17`],[`e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d`,`4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda`],[`e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725`,`7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd`],[`213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754`,`4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2`],[`4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c`,`17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6`],[`fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6`,`6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f`],[`76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39`,`c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01`],[`c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891`,`893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3`],[`d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b`,`febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f`],[`b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03`,`2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7`],[`e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d`,`eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78`],[`a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070`,`7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1`],[`90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4`,`e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150`],[`8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da`,`662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82`],[`e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11`,`1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc`],[`8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e`,`efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b`],[`e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41`,`2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51`],[`b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef`,`67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45`],[`d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8`,`db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120`],[`324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d`,`648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84`],[`4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96`,`35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d`],[`9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd`,`ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d`],[`6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5`,`9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8`],[`a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266`,`40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8`],[`7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71`,`34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac`],[`928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac`,`c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f`],[`85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751`,`1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962`],[`ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e`,`493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907`],[`827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241`,`c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec`],[`eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3`,`be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d`],[`e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f`,`4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414`],[`1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19`,`aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd`],[`146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be`,`b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0`],[`fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9`,`6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811`],[`da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2`,`8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1`],[`a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13`,`7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c`],[`174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c`,`ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73`],[`959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba`,`2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd`],[`d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151`,`e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405`],[`64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073`,`d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589`],[`8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458`,`38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e`],[`13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b`,`69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27`],[`bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366`,`d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1`],[`8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa`,`40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482`],[`8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0`,`620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945`],[`dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787`,`7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573`],[`f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e`,`ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82`]]},naf:{wnd:7,points:[[`f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9`,`388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672`],[`2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4`,`d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6`],[`5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc`,`6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da`],[`acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe`,`cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37`],[`774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb`,`d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b`],[`f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8`,`ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81`],[`d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e`,`581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58`],[`defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34`,`4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77`],[`2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c`,`85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a`],[`352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5`,`321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c`],[`2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f`,`2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67`],[`9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714`,`73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402`],[`daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729`,`a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55`],[`c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db`,`2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482`],[`6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4`,`e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82`],[`1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5`,`b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396`],[`605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479`,`2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49`],[`62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d`,`80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf`],[`80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f`,`1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a`],[`7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb`,`d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7`],[`d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9`,`eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933`],[`49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963`,`758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a`],[`77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74`,`958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6`],[`f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530`,`e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37`],[`463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b`,`5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e`],[`f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247`,`cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6`],[`caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1`,`cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476`],[`2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120`,`4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40`],[`7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435`,`91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61`],[`754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18`,`673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683`],[`e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8`,`59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5`],[`186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb`,`3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b`],[`df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f`,`55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417`],[`5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143`,`efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868`],[`290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba`,`e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a`],[`af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45`,`f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6`],[`766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a`,`744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996`],[`59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e`,`c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e`],[`f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8`,`e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d`],[`7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c`,`30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2`],[`948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519`,`e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e`],[`7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab`,`100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437`],[`3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca`,`ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311`],[`d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf`,`8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4`],[`1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610`,`68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575`],[`733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4`,`f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d`],[`15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c`,`d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d`],[`a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940`,`edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629`],[`e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980`,`a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06`],[`311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3`,`66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374`],[`34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf`,`9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee`],[`f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63`,`4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1`],[`d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448`,`fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b`],[`32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf`,`5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661`],[`7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5`,`8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6`],[`ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6`,`8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e`],[`16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5`,`5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d`],[`eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99`,`f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc`],[`78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51`,`f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4`],[`494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5`,`42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c`],[`a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5`,`204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b`],[`c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997`,`4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913`],[`841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881`,`73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154`],[`5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5`,`39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865`],[`36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66`,`d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc`],[`336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726`,`ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224`],[`8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede`,`6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e`],[`1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94`,`60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6`],[`85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31`,`3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511`],[`29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51`,`b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b`],[`a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252`,`ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2`],[`4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5`,`cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c`],[`d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b`,`6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3`],[`ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4`,`322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d`],[`af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f`,`6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700`],[`e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889`,`2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4`],[`591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246`,`b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196`],[`11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984`,`998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4`],[`3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a`,`b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257`],[`cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030`,`bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13`],[`c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197`,`6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096`],[`c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593`,`c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38`],[`a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef`,`21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f`],[`347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38`,`60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448`],[`da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a`,`49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a`],[`c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111`,`5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4`],[`4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502`,`7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437`],[`3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea`,`be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7`],[`cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26`,`8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d`],[`b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986`,`39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a`],[`d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e`,`62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54`],[`48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4`,`25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77`],[`dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda`,`ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517`],[`6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859`,`cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10`],[`e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f`,`f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125`],[`eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c`,`6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e`],[`13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942`,`fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1`],[`ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a`,`1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2`],[`b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80`,`5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423`],[`ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d`,`438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8`],[`8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1`,`cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758`],[`52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63`,`c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375`],[`e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352`,`6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d`],[`7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193`,`ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec`],[`5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00`,`9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0`],[`32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58`,`ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c`],[`e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7`,`d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4`],[`8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8`,`c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f`],[`4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e`,`67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649`],[`3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d`,`cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826`],[`674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b`,`299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5`],[`d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f`,`f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87`],[`30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6`,`462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b`],[`be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297`,`62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc`],[`93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a`,`7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c`],[`b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c`,`ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f`],[`d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52`,`4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a`],[`d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb`,`bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46`],[`463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065`,`bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f`],[`7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917`,`603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03`],[`74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9`,`cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08`],[`30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3`,`553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8`],[`9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57`,`712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373`],[`176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66`,`ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3`],[`75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8`,`9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8`],[`809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721`,`9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1`],[`1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180`,`4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9`]]}}]};this.p=new p(e.p,16),this.red=new g(e.prime),this.zero=new p(0).toRed(this.red),this.one=new p(1).toRed(this.red),this.two=new p(2).toRed(this.red),this.n=new p(e.n,16),this.g=cr.fromJSON(e.g,e.gRed),this._wnafT1=Array.from({length:4},()=>void 0),this._wnafT2=Array.from({length:4},()=>void 0),this._wnafT3=Array.from({length:4},()=>void 0),this._wnafT4=Array.from({length:4},()=>void 0),this._bitLength=this.n.bitLength(),this.redN=this.n.toRed(this.red),this.a=new p(e.a,16).toRed(this.red),this.b=new p(e.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=this.a.fromRed().cmpn(0)===0,this.threeA=this.a.fromRed().sub(this.p).cmpn(-3)===0,this.endo=this._getEndomorphism(e),this._endoWnafT1=Array.from({length:4},()=>void 0),this._endoWnafT2=Array.from({length:4},()=>void 0)}_getEndomorphism(e){if(!this.zeroA||this.p.modrn(3)!==1)return;let t=this._resolveEndomorphismBeta(e),n=this._resolveEndomorphismLambda(e,t);return{beta:t,lambda:n,basis:this._resolveEndomorphismBasis(e,n)}}_resolveEndomorphismBeta(e){if(e.beta!==void 0)return new p(e.beta,16).toRed(this.red);let t=this._getEndoRoots(this.p);if(t==null)throw Error(`Failed to get endomorphism roots for beta.`);return(t[0].cmp(t[1])<0?t[0]:t[1]).toRed(this.red)}_endomorphismLambdaMatches(e,t,n=!1){if(this.g==null)throw Error(`Curve generator point (g) is not defined.`);let r=this.g.mul(e)?.x,i=this.g.x==null?void 0:this.g.x.redMul(t);if(r==null||i==null){if(n)throw Error(`Lambda computation failed: g.mul(lambda).x or g.x.redMul(beta) is undefined.`);return!1}return r.cmp(i)===0}_resolveEndomorphismLambda(t,n){if(t.lambda!==void 0)return new p(t.lambda,16);let r=this._getEndoRoots(this.n);if(r==null)throw Error(`Failed to get endomorphism roots for lambda.`);return this._endomorphismLambdaMatches(r[0],n)?r[0]:(e.assert(this._endomorphismLambdaMatches(r[1],n,!0),`Lambda selection does not match computed beta.`),r[1])}_resolveEndomorphismBasis(e,t){return typeof e.basis!=`object`||e.basis===null?this._getEndoBasis(t):e.basis.map(e=>({a:new p(e.a,16),b:new p(e.b,16)}))}_getEndoRoots(e){let t=e===this.p?this.red:new _(e),n=new p(2).toRed(t).redInvm(),r=n.redNeg(),i=new p(3).toRed(t).redNeg().redSqrt().redMul(n);return[r.redAdd(i).fromRed(),r.redSub(i).fromRed()]}_getEndoBasis(e){let t=this.n.ushrn(Math.floor(this.n.bitLength()/2)),n=e,r=this.n.clone(),i=new p(1),a=new p(0),o=new p(0),s=new p(1),c,l,u,d,f,m,h=new p(0),g=0,_=new p(0),v=new p(0);for(;n.cmpn(0)!==0;){let e=r.div(n);_=r.sub(e.mul(n)),v=o.sub(e.mul(i));let f=s.sub(e.mul(a));if(u===void 0&&_.cmp(t)<0)c=h.neg(),l=i,u=_.neg(),d=v;else if(u!==void 0&&++g===2)break;h=_,r=n,n=_,o=i,i=v,s=a,a=f}if(c===void 0||l===void 0||u===void 0||d===void 0)throw Error(`Failed to compute Endo Basis values`);f=_.neg(),m=v;let y=u.sqr().add(d.sqr());return f.sqr().add(m.sqr()).cmp(y)>=0&&(f=c,m=l),u.negative!==0&&(u=u.neg(),d=d.neg()),f.negative!==0&&(f=f.neg(),m=m.neg()),[{a:u,b:d},{a:f,b:m}]}_endoSplit(e){if(this.endo==null)throw Error(`Endomorphism is not defined.`);let t=this.endo.basis,n=t[0],r=t[1],i=r.b.mul(e).divRound(this.n),a=n.b.neg().mul(e).divRound(this.n),o=i.mul(n.a),s=a.mul(r.a),c=i.mul(n.b),l=a.mul(r.b);return{k1:e.sub(o).sub(s),k2:c.add(l).neg()}}validate(e){if(e.inf)return!0;let t=e.x,n=e.y;if(t===null||n===null)throw Error(`Point coordinates cannot be null`);let r=this.a.redMul(t),i=t.redSqr().redMul(t).redIAdd(r).redIAdd(this.b);return n.redSqr().redISub(i).cmpn(0)===0}},On=class{curve;type;precomputed;constructor(e){this.curve=new Dn,this.type=e,this.precomputed=null}},kn=class e extends On{x;y;z;zOne;constructor(e,t,n){super(`jacobian`),e===null&&t===null&&n===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new p(0)):(p.isBN(e)||(e=new p(e,16)),this.x=e,p.isBN(t)||(t=new p(t,16)),this.y=t,p.isBN(n)||(n=new p(n,16)),this.z=n),this.x.red??(this.x=this.x.toRed(this.curve.red)),this.y.red??(this.y=this.y.toRed(this.curve.red)),this.z.red??(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.isInfinity()&&(this.x=this.curve.one,this.y=this.curve.one,this.z=new p(0).toRed(this.curve.red),this.zOne=!1)}toP(){if(this.isInfinity())return new cr(null,null);let e=this.z.redInvm(),t=e.redSqr();return new cr(this.x.redMul(t),this.y.redMul(t).redMul(e))}neg(){return new e(this.x,this.y.redNeg(),this.z)}add(t){if(this.isInfinity())return t;if(t.isInfinity())return this;let n=t.z.redSqr(),r=this.z.redSqr(),i=this.x.redMul(n),a=t.x.redMul(r),o=this.y.redMul(n.redMul(t.z)),s=t.y.redMul(r.redMul(this.z)),c=i.redSub(a),l=o.redSub(s);if(c.cmpn(0)===0)return l.cmpn(0)===0?this.dbl():new e(null,null,null);let u=c.redSqr(),d=u.redMul(c),f=i.redMul(u),p=l.redSqr().redIAdd(d).redISub(f).redISub(f),m=l.redMul(f.redISub(p)).redISub(o.redMul(d)),h=this.z.redMul(t.z).redMul(c);return new e(p,m,h)}mixedAdd(t){if(this.isInfinity())return t.toJ();if(t.isInfinity())return this;if(t.x===null||t.y===null)throw Error(`Point coordinates cannot be null`);let n=this.z.redSqr(),r=this.x,i=t.x.redMul(n),a=this.y,o=t.y.redMul(n).redMul(this.z),s=r.redSub(i),c=a.redSub(o);if(s.cmpn(0)===0)return c.cmpn(0)===0?this.dbl():new e(null,null,null);let l=s.redSqr(),u=l.redMul(s),d=r.redMul(l),f=c.redSqr().redIAdd(u).redISub(d).redISub(d),p=c.redMul(d.redISub(f)).redISub(a.redMul(u)),m=this.z.redMul(s);return new e(f,p,m)}dblp(e){if(e===0||this.isInfinity())return this;if(e===void 0)return this.dbl();let t=this;for(let n=0;n<e;n++)t=t.dbl();return t}dbl(){if(this.isInfinity())return this;let t,n,r;if(this.zOne){let e=this.x.redSqr(),i=this.y.redSqr(),a=i.redSqr(),o=this.x.redAdd(i).redSqr().redISub(e).redISub(a);o=o.redIAdd(o);let s=e.redAdd(e).redIAdd(e),c=s.redSqr().redISub(o).redISub(o),l=a.redIAdd(a);l=l.redIAdd(l),l=l.redIAdd(l),t=c,n=s.redMul(o.redISub(c)).redISub(l),r=this.y.redAdd(this.y)}else{let e=this.x.redSqr(),i=this.y.redSqr(),a=i.redSqr(),o=this.x.redAdd(i).redSqr().redISub(e).redISub(a);o=o.redIAdd(o);let s=e.redAdd(e).redIAdd(e),c=s.redSqr(),l=a.redIAdd(a);l=l.redIAdd(l),l=l.redIAdd(l),t=c.redISub(o).redISub(o),n=s.redMul(o.redISub(t)).redISub(l),r=this.y.redMul(this.z),r=r.redIAdd(r)}return new e(t,n,r)}eq(e){if(e.type===`affine`)return this.eq(e.toJ());if(this===e||(e=e,this.isInfinity()&&e.isInfinity()))return!0;if(this.isInfinity()!==e.isInfinity())return!1;let t=this.z.redSqr(),n=e.z.redSqr();if(this.x.redMul(n).redISub(e.x.redMul(t)).cmpn(0)!==0)return!1;let r=t.redMul(this.z),i=n.redMul(e.z);return this.y.redMul(i).redISub(e.y.redMul(r)).cmpn(0)===0}eqXToP(e){let t=this.z.redSqr(),n=e.toRed(this.curve?.red).redMul(t);if(this.x.cmp(n)===0)return!0;let r=e.clone();if(this.curve?.redN==null)throw Error(`Curve or redN is not initialized.`);let i=this.curve.redN.redMul(t);for(;r.cmp(this.curve.p)<0;){if(r.iadd(this.curve.n),r.cmp(this.curve.p)>=0)return!1;if(n.redIAdd(i),this.x.cmp(n)===0)return!0}return!1}inspect(){return this.isInfinity()?`<EC JPoint Infinity>`:`<EC JPoint x: `+this.x.toString(16,2)+` y: `+this.y.toString(16,2)+` z: `+this.z.toString(16,2)+`>`}isInfinity(){return this.z.cmpn(0)===0}};function An(e,t,n){let r=-e,i=(t.X^n.X)&r,a=(t.Y^n.Y)&r,o=(t.Z^n.Z)&r;t.X^=i,n.X^=i,t.Y^=a,n.Y^=a,t.Z^=o,n.Z^=o}var jn=0n,Mn=1n,Nn=2n,Pn=3n,Fn=4n,In=8n,Ln=115792089237316195423570985008687907853269984665640564039457584007908834671663n,Rn=115792089237316195423570985008687907852837564279074904382605163141518161494337n,zn=(1n<<256n)-1n;function Bn(e){let t=e>>256n;return e=(e&zn)+(t<<32n)+t*977n,t=e>>256n,e=(e&zn)+(t<<32n)+t*977n,e>=115792089237316195423570985008687907853269984665640564039457584007908834671663n&&(e-=Ln),e}var Vn=e=>Bn((e%Ln+Ln)%Ln),Hn=(e,t)=>e>=t?e-t:Ln-(t-e),O=(e,t)=>Bn(e*t),Un=(e,t)=>Bn(e+t),Wn=e=>{let t=Mn,n=jn,r=Vn(e),i=Ln;for(;r>Mn;){let e=i/r;[t,n]=[n-t*e,t],[r,i]=[i-r*e,r]}return Vn(t)},Gn=e=>O(e,e),Kn=(e,t)=>{let n=1n;for(e=Vn(e);t>0n;)(t&1n)!=0n&&(n=O(n,e)),e=O(e,e),t>>=1n;return n},qn=115792089237316195423570985008687907853269984665640564039457584007908834671664n>>2n,Jn=e=>{let t=Kn(e,qn);return O(t,t)===Vn(e)?t:null},Yn=e=>p.isBN(e)?BigInt(`0x`+e.toString(16)):BigInt(typeof e==`string`?`0x`+e:Array.isArray(e)?`0x`+E(e):e),Xn=BigInt(`0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798`),Zn=BigInt(`0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8`),Qn=new Map,$n=e=>{let{X:t,Y:n,Z:r}=e;if(n===0n)return{X:jn,Y:Mn,Z:jn};let i=O(n,n),a=O(Fn,O(t,i)),o=O(Pn,O(t,t)),s=Hn(O(o,o),O(Nn,a));return{X:s,Y:Hn(O(o,Hn(a,s)),O(In,O(i,i))),Z:O(Nn,O(n,r))}},er=(e,t)=>{if(e.Z===0n)return t;if(t.Z===0n)return e;let n=O(e.Z,e.Z),r=O(t.Z,t.Z),i=O(e.X,r),a=O(t.X,n),o=O(e.Y,O(r,t.Z)),s=O(t.Y,O(n,e.Z)),c=Hn(a,i),l=Hn(s,o);if(c===0n)return l===0n?$n(e):{X:jn,Y:Mn,Z:jn};let u=O(c,c),d=O(c,u),f=O(i,u),p=Hn(Hn(O(l,l),d),O(Nn,f));return{X:p,Y:Hn(O(l,Hn(f,p)),O(o,d)),Z:O(c,O(e.Z,t.Z))}},tr=e=>e.Z===0n?e:{X:e.X,Y:Ln-e.Y,Z:e.Z},nr=(e,t)=>{let n=`${e}:${t.x.toString(16)}:${t.y.toString(16)}`,r=Qn.get(n);if(r!==void 0)return r;let i=Array.from({length:1<<e-1},()=>({X:jn,Y:Mn,Z:jn})),a={X:t.x,Y:t.y,Z:Mn};i[0]=a;let o=$n(a);for(let e=1;e<i.length;e++)i[e]=er(i[e-1],o);return Qn.set(n,i),i},rr=(e,t)=>{let n=[],r=1n<<BigInt(t),i=r>>1n,a=e;for(;a>0n;){if((a&1n)==0n)n.push(0);else{let e=a&r-1n;e>i&&(e-=r),n.push(Number(e)),a-=e}a>>=Mn}return n},ir=(e,t,n=5)=>{let r=nr(n,t),i=rr(e,n),a={X:jn,Y:Mn,Z:jn};for(let e=i.length-1;e>=0;e--){a=$n(a);let t=i[e];if(t!==0){let e=Math.abs(t)>>1,n=t>0?r[e]:tr(r[e]);a=er(a,n)}}return a},ar=e=>{let t=e%Rn;return t<0n&&(t+=Rn),t},or=(e,t)=>ar(e*t),sr=e=>{let t=1n,n=0n,r=ar(e),i=Rn;for(;r>1n;){let e=i/r;[t,n]=[n-t*e,t],[r,i]=[i-r*e,r]}return ar(t)},cr=class e extends On{x;y;inf;static _assertOnCurve(e){if(!e.validate())throw Error(`Invalid point`);return e}static fromDER(t){if((t[0]===4||t[0]===6||t[0]===7)&&t.length-1==64){if(t[0]===6){if(t.at(-1)%2!=0)throw Error(`Point string value is wrong length`)}else if(t[0]===7&&t.at(-1)%2!=1)throw Error(`Point string value is wrong length`);let n=new e(t.slice(1,33),t.slice(33,65));return e._assertOnCurve(n)}if((t[0]===2||t[0]===3)&&t.length-1==32)return e._assertOnCurve(e.fromX(t.slice(1,33),t[0]===3));throw Error(`Unknown point format`)}static fromString(t){let n=tn(t,`hex`);return e._assertOnCurve(e.fromDER(n))}static fromX(t,n){let r=Yn(t);r=Vn(r);let i=Jn(Un(O(Gn(r),r),7n));if(i===null)throw Error(`Invalid point`);let a=i;(a&1n)!=(n?1n:0n)&&(a=Hn(Ln,a));let o=new p(r.toString(16),16),s=new p(a.toString(16),16);return e._assertOnCurve(new e(o,s))}static fromJSON(t,n){typeof t==`string`&&(t=JSON.parse(t));let r=new e(t[0],t[1],n);if(r=e._assertOnCurve(r),typeof t[2]!=`object`||t[2]===null)return r;let i=t[2],a=t=>{let r=new e(t[0],t[1],n);return e._assertOnCurve(r)};return r.precomputed={beta:null,doubles:typeof i.doubles==`object`&&i.doubles!==null?{step:i.doubles.step,points:[r].concat(i.doubles.points.map(a))}:void 0,naf:typeof i.naf==`object`&&i.naf!==null?{wnd:i.naf.wnd,points:[r].concat(i.naf.points.map(a))}:void 0},r}constructor(e,t,n=!0){super(`affine`),this.precomputed=null,e===null&&t===null?(this.x=null,this.y=null,this.inf=!0):(p.isBN(e)||(e=new p(e,16)),this.x=e,p.isBN(t)||(t=new p(t,16)),this.y=t,n&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red===null&&(this.x=this.x.toRed(this.curve.red)),this.y.red===null&&(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}validate(){if(this.inf||this.x==null||this.y==null)return!1;try{let e=BigInt(`0x`+this.x.fromRed().toString(16)),t=BigInt(`0x`+this.y.fromRed().toString(16));return O(t,t)===Un(O(O(e,e),e),7n)}catch{return!1}}encode(e=!0,t){if(this.inf)return t===`hex`?`00`:[0];let n=this.curve.p.byteLength(),r=this.getX().toArray(`be`,n),i;return i=e?[this.getY().isEven()?2:3].concat(r):[4].concat(r,this.getY().toArray(`be`,n)),t===`hex`?E(i):i}toString(){return this.encode(!0,`hex`)}toJSON(){return this.precomputed==null?[this.x,this.y]:[this.x,this.y,typeof this.precomputed==`object`&&this.precomputed!==null?{doubles:this.precomputed.doubles==null?void 0:{step:this.precomputed.doubles.step,points:this.precomputed.doubles.points.slice(1)},naf:this.precomputed.naf==null?void 0:{wnd:this.precomputed.naf.wnd,points:this.precomputed.naf.points.slice(1)}}:void 0]}inspect(){return this.isInfinity()?`<EC Point Infinity>`:`<EC Point x: `+(this.x?.fromRed()?.toString(16,2)??`undefined`)+` y: `+(this.y?.fromRed()?.toString(16,2)??`undefined`)+`>`}isInfinity(){return this.inf}add(t){if(this.inf)return t;if(t.inf)return this;if(this.eq(t))return this.dbl();if(this.neg().eq(t)||this.x?.cmp(t.x??new p(0))===0)return new e(null,null);let n=er({X:BigInt(`0x`+this.x.fromRed().toString(16)),Y:BigInt(`0x`+this.y.fromRed().toString(16)),Z:Mn},{X:BigInt(`0x`+t.x.fromRed().toString(16)),Y:BigInt(`0x`+t.y.fromRed().toString(16)),Z:Mn});if(n.Z===0n)return new e(null,null);let r=Wn(n.Z),i=O(r,r),a=O(n.X,i),o=O(n.Y,O(i,r));return new e(a.toString(16),o.toString(16))}dbl(){if(this.inf)return this;if(this.x===null||this.y===null)throw Error(`Point coordinates cannot be null`);let t=BigInt(`0x`+this.x.fromRed().toString(16)),n=BigInt(`0x`+this.y.fromRed().toString(16));if(n===0n)return new e(null,null);let r=$n({X:t,Y:n,Z:Mn}),i=Wn(r.Z),a=O(i,i),o=O(r.X,a),s=O(r.Y,O(a,i));return new e(o.toString(16),s.toString(16))}getX(){return(this.x??new p(0)).fromRed()}getY(){return(this.y??new p(0)).fromRed()}mul(t){if(p.isBN(t)||(t=new p(t,16)),t=t,this.inf)return this;let n=t.isNeg(),r=n?t.neg():t,i=BigInt(`0x`+r.toString(16));if(i=Vn(i),i===0n||i===0n)return new e(null,null);if(this.x===null||this.y===null)throw Error(`Point coordinates cannot be null`);let a,o;this===this.curve.g?(a=Xn,o=Zn):(a=BigInt(`0x`+this.x.fromRed().toString(16)),o=BigInt(`0x`+this.y.fromRed().toString(16)));let s=ir(i,{x:a,y:o});if(s.Z===0n)return new e(null,null);let c=Wn(s.Z),l=O(c,c),u=O(s.X,l),d=O(s.Y,O(l,c)),f=new p(u.toString(16),16),m=new p(d.toString(16),16),h=new e(f,m);return n?h.neg():h}mulCT(t){if(p.isBN(t)||(t=new p(t,16)),t=t,this.inf)return new e(null,null);let n=t.isNeg(),r=n?t.neg():t,i=BigInt(`0x`+r.toString(16));if(i=Vn(i),i===0n)return new e(null,null);let a=this===this.curve.g?Xn:BigInt(`0x`+this.getX().toString(16)),o=this===this.curve.g?Zn:BigInt(`0x`+this.getY().toString(16)),s={X:0n,Y:1n,Z:0n},c={X:a,Y:o,Z:1n},l=i.toString(2);for(let e of l){let t=e===`1`?1n:0n;An(t,s,c),c=er(s,c),s=$n(s),An(t,s,c)}if(s.Z===0n)return new e(null,null);let u=Wn(s.Z),d=O(u,u),f=O(s.X,d),m=O(s.Y,O(d,u)),h=new e(f.toString(16),m.toString(16));return n?h.neg():h}mulAdd(e,t,n){let r=[this,t],i=[e,n];return this._endoWnafMulAdd(r,i)}jmulAdd(e,t,n){let r=[this,t],i=[e,n];return this._endoWnafMulAdd(r,i,!0)}eq(e){return this===e||this.inf===e.inf&&(this.inf||(this.x??new p(0)).cmp(e.x??new p(0))===0&&(this.y??new p(0)).cmp(e.y??new p(0))===0)}neg(t){if(this.inf)return this;let n=new e(this.x,(this.y??new p(0)).redNeg());if(t===!0&&this.precomputed!=null){let e=this.precomputed;n.precomputed={naf:e.naf==null?void 0:{wnd:e.naf.wnd,points:e.naf.points.map(e=>e.neg())},doubles:e.doubles==null?void 0:{step:e.doubles.step,points:e.doubles.points.map(e=>e.neg())},beta:void 0}}return n}dblp(e){let t;for(let n=0;n<e;n++)t=(t??this).dbl();return t??this}toJ(){return this.inf?new kn(null,null,null):new kn(this.x,this.y,this.curve.one)}_getBeta(){if(typeof this.curve.endo!=`object`)return;let t=this.precomputed;if(typeof t==`object`&&t&&typeof t.beta==`object`&&t.beta!==null)return t.beta;let n=new e((this.x??new p(0)).redMul(this.curve.endo.beta),this.y);if(t!=null){let r=this.curve,i=t=>{let n=t;if(n.x===null)throw Error(`p.x is null`);if(r.endo===void 0||r.endo===null)throw Error(`curve.endo is undefined`);return new e(n.x.redMul(r.endo.beta),n.y)};t.beta=n,n.precomputed={beta:null,naf:t.naf==null?void 0:{wnd:t.naf.wnd,points:t.naf.points.map(i)},doubles:t.doubles==null?void 0:{step:t.doubles.step,points:t.doubles.points.map(i)}}}return n}_fixedNafMul(e){if(typeof this.precomputed!=`object`||this.precomputed===null)throw Error(`_fixedNafMul requires precomputed values for the point`);let t=this._getDoubles(),n=this.curve.getNAF(e,1,this.curve._bitLength),r=(1<<t.step+1)-(t.step%2==0?2:1);r/=3;let i=[];for(let e=0;e<n.length;e+=t.step){let r=0;for(let i=e+t.step-1;i>=e;i--)r=(r<<1)+n[i];i.push(r)}let a=new kn(null,null,null),o=new kn(null,null,null);for(let e=r;e>0;e--){for(let n=0;n<i.length;n++){let r=i[n];r===e?o=o.mixedAdd(t.points[n]):r===-e&&(o=o.mixedAdd(t.points[n].neg()))}a=a.add(o)}return a.toP()}_prepareWnafWindows(e,t,n,r,i){for(let a=0;a<n;a++){let n=t[a]._getNAFPoints(e);r[a]=n.wnd,i[a]=n.points}}_combineWnafPair(e,t,n){let{points:r,coeffs:i,wndWidth:a,wnd:o,naf:s,currentMax:c}=n;if(a[e]!==1||a[t]!==1)return s[e]=this.curve.getNAF(i[e],a[e],this.curve._bitLength),s[t]=this.curve.getNAF(i[t],a[t],this.curve._bitLength),Math.max(c,s[e].length,s[t].length);let l=[r[e],null,null,r[t]],u=r[e].y??new p(0),d=r[t].y??new p(0);u.cmp(d)===0?(l[1]=r[e].add(r[t]),l[2]=r[e].toJ().mixedAdd(r[t].neg())):u.cmp(d.redNeg())===0?(l[1]=r[e].toJ().mixedAdd(r[t]),l[2]=r[e].add(r[t].neg())):(l[1]=r[e].toJ().mixedAdd(r[t]),l[2]=r[e].toJ().mixedAdd(r[t].neg()));let f=[-3,-1,-5,-7,0,7,5,1,3],m=this.curve.getJSF(i[e],i[t]),h=Math.max(c,m[0].length);s[e]=Array.from({length:h}),s[t]=Array.from({length:h});for(let n=0;n<h;n++){let r=Math.trunc(m[0][n]),i=Math.trunc(m[1][n]);s[e][n]=f[(r+1)*3+(i+1)],s[t][n]=0,o[e]=l}return h}_prepareWnafRepresentations(e,t,n,r,i,a){let o=0;for(let s=n-1;s>=1;s-=2)o=this._combineWnafPair(s-1,s,{points:e,coeffs:t,wndWidth:r,wnd:i,naf:a,currentMax:o});return o}_collectWnafStep(e,t,n,r){let i=e,a=0;for(;i>=0;){let e=!0;for(let a=0;a<t;a++)r[a]=new p(typeof n[a][i]==`number`?n[a][i]:0),r[a].isZero()||(e=!1);if(!e)break;a++,i--}return i>=0&&a++,{index:i,doubles:a}}_addWnafStep(e,t,n,r){let i=new p(1),a=new p(2),o=e;for(let e=0;e<t;e++){let t=n[e];if(t.cmpn(0)===0)continue;let s=t.isNeg()?r[e][t.neg().sub(i).div(a).toNumber()].neg():r[e][t.sub(i).div(a).toNumber()];o=s.type===`affine`?o.mixedAdd(s):o.add(s)}return o}_wnafMulAdd(e,t,n,r,i){let a=this.curve._wnafT1.length,o=Array.from({length:a}),s=Array.from({length:a},()=>[]),c=Array.from({length:a},()=>[]);this._prepareWnafWindows(e,t,r,o,s);let l=this._prepareWnafRepresentations(t,n,r,o,s,c),u=new kn(null,null,null),d=this.curve._wnafT4,f=l;for(;f>=0;){let e=this._collectWnafStep(f,r,c,d);if(f=e.index,u=u.dblp(e.doubles),f<0)break;u=this._addWnafStep(u,r,d,s),f--}for(let e=0;e<r;e++)s[e]=[];return i===!0?u:u.toP()}_endoWnafMulAdd(t,n,r){let i=Array.from({length:t.length*2}),a=Array.from({length:t.length*2}),o=0;for(;o<t.length;o++){let r=this.curve._endoSplit(n[o]),s=t[o],c=s._getBeta()??new e(null,null);r.k1.negative!==0&&(r.k1.ineg(),s=s.neg(!0)),r.k2.negative!==0&&(r.k2.ineg(),c=c.neg(!0)),i[o*2]=s,i[o*2+1]=c,a[o*2]=r.k1,a[o*2+1]=r.k2}let s=this._wnafMulAdd(1,i,a,o*2,r);for(let e=0;e<o*2;e++)i[e]=null,a[e]=null;return s}_hasDoubles(e){if(this.precomputed==null)return!1;let t=this.precomputed.doubles;return typeof t==`object`&&t.points.length>=Math.ceil((e.bitLength()+1)/t.step)}_getDoubles(e,t){if(typeof this.precomputed==`object`&&this.precomputed!==null&&typeof this.precomputed.doubles==`object`&&this.precomputed.doubles!==null)return this.precomputed.doubles;let n=[this],r;for(let i=0;i<(t??0);i+=e??1){for(let t=0;t<(e??1);t++)r=(r??this).dbl();n.push(r)}return{step:e??1,points:n}}_getNAFPoints(e){if(typeof this.precomputed==`object`&&this.precomputed!==null&&typeof this.precomputed.naf==`object`&&this.precomputed.naf!==null)return this.precomputed.naf;let t=[this],n=(1<<e)-1,r=n===1?null:this.dbl();for(let e=1;e<n;e++)r!==null&&(t[e]=t[e-1].add(r));return{wnd:e,points:t}}},lr=class e extends cr{static fromPrivateKey(t){let n=new Dn().g.mul(t);return new e(n.x,n.y)}static fromString(t){let n=cr.fromString(t);return new e(n.x,n.y)}static fromDER(t){let n=cr.fromDER(t);return new e(n.x,n.y)}constructor(e,t=null,n=!0){if(e instanceof cr)super(e.getX(),e.getY());else{if(t===null&&n&&typeof e==`string`&&(e.length===66||e.length===130))throw Error(`You are using the "new PublicKey()" constructor with a DER hex string. You need to use "PublicKey.fromString()" instead.`);super(e,t,n)}}deriveSharedSecret(e){if(!this.validate())throw Error(`Public key not valid for ECDH secret derivation`);return this.mulCT(e)}verify(e,t,n){return Sr(new p(Ze(e,n),16),t,this)}toDER(e){return e===`hex`?this.encode(!0,e):this.encode(!0)}toHash(e){let t=$e(this.encode(!0));return e===`hex`?E(t):t}toAddress(e=[0]){if(typeof e==`string`){if(e===`testnet`||e===`test`)e=[111];else if(e===`mainnet`||e===`main`)e=[0];else throw Error(`Invalid prefix ${e}`)}return hn(this.toHash(),e)}deriveChild(t,n,r,i){let a;if(typeof i==`function`){let e=i(t,this);e===void 0?(a=this.deriveSharedSecret(t),typeof r==`function`&&r(t,this,a)):a=e}else a=this.deriveSharedSecret(t);let o=tn(n,`utf8`),s=et(a.encode(!0),o),c=new Dn().g.mul(new p(s)),l=this.add(c);return new e(l.x,l.y)}static fromMsgHashAndCompactSignature(e,t,n){let r=tn(t,n);if(r.length!==65)throw Error(`Invalid Compact Signature`);let i=r[0];if(i<27||i>=35)throw Error(`Invalid Compact Byte`);let a=r[0]-27;return a>3&&(a-=4),new ur(new p(r.slice(1,33)),new p(r.slice(33,65))).RecoverPublicKey(a,e)}},ur=class e{r;s;static fromDER(t,n){let r=(e,t)=>{let n=e[t.place++];if(n&128)throw Error(`Invalid DER entity length`);return n};class i{place=0}t=tn(t,n);let a=new i;if(t[a.place++]!==48)throw Error(`Signature DER must start with 0x30`);if(r(t,a)+a.place!==t.length||t[a.place++]!==2)throw Error(`Signature DER invalid`);let o=r(t,a),s=t.slice(a.place,o+a.place);if(a.place+=o,t[a.place++]!==2)throw Error(`Signature DER invalid`);let c=r(t,a);if(t.length!==c+a.place)throw Error(`Invalid R-length in signature DER`);let l=t.slice(a.place,c+a.place);if(s[0]===0){if(s[1]&128)s=s.slice(1);else throw Error(`Invalid R-value in signature DER`)}if(l[0]===0){if(l[1]&128)l=l.slice(1);else throw Error(`Invalid S-value in signature DER`)}return new e(new p(s),new p(l))}static fromCompact(t,n){if(t=tn(t,n),t.length!==65)throw Error(`Invalid Compact Signature`);let r=t[0];if(r<27||r>=35)throw Error(`Invalid Compact Byte`);return new e(new p(t.slice(1,33)),new p(t.slice(33,65)))}constructor(e,t){this.r=e,this.s=t}verify(e,t,n){return Sr(new p(Ze(e,n),16),this,t)}toString(e){return this.toDER(e)}toDER(e){let t=(e,t)=>{if(t<128)e.push(t);else throw Error(`len must be < 0x80`)},n=e=>{let t=0,n=e.length-1;for(;e[t]===0&&!(e[t+1]&128)&&t<n;)t++;return t===0?e:e.slice(t)},r=this.r.toArray(),i=this.s.toArray();for(r[0]&128&&(r=[0].concat(r)),i[0]&128&&(i=[0].concat(i)),r=n(r),i=n(i);i[0]===0&&!(i[1]&128);)i=i.slice(1);let a=[2];t(a,r.length),a=a.concat(r),a.push(2),t(a,i.length);let o=a.concat(i),s=[48];return t(s,o.length),s=s.concat(o),e===`hex`?E(s):e===`base64`?dn(s):s}toCompact(e,t,n){if(e<0||e>3)throw Error(`Invalid recovery param`);if(typeof t!=`boolean`)throw TypeError(`Invalid compressed param`);let r=27+e;t&&(r+=4);let i=[r];return i=i.concat(this.r.toArray(`be`,32)),i=i.concat(this.s.toArray(`be`,32)),n===`hex`?E(i):n===`base64`?dn(i):i}RecoverPublicKey(e,t){let n=this.r,r=this.s,i=!!(e&1),a=e>>1,o=new Dn,s=o.n,c=o.g,l=a===0?n:n.add(s),u=cr.fromX(l,i);if(!u.mul(s).isInfinity())throw Error(`nR is not at infinity`);let d=t.neg().umod(s),f=n.invm(s),p=f.mul(r).umod(s),m=f.mul(d).umod(s),h=new lr(c.mul(m).add(u.mul(p)));return h.validate(),h}CalculateRecoveryFactor(e,t){for(let n=0;n<4;n++){let r;try{r=this.RecoverPublicKey(n,t)}catch{continue}if(e.eq(r))return n}throw Error(`Unable to find valid recovery factor`)}},dr=class{K;V;constructor(e,t){let n=tn(e,`hex`),r=tn(t,`hex`);if(n.length!==32)throw Error(`Entropy must be exactly 32 bytes (256 bits)`);if(r.length!==32)throw Error(`Nonce must be exactly 32 bytes (256 bits)`);let i=n.concat(r);this.K=Array.from({length:32}),this.V=Array.from({length:32});for(let e=0;e<32;e++)this.K[e]=0,this.V[e]=1;this.update(i)}hmac(){return new Ge(this.K)}update(e){let t=this.hmac().update(this.V).update([0]);e!==void 0&&(t=t.update(e)),this.K=t.digest(),this.V=this.hmac().update(this.V).digest(),e!==void 0&&(this.K=this.hmac().update(this.V).update([1]).update(e).digest(),this.V=this.hmac().update(this.V).digest())}generate(e){let t=[];for(;t.length<e;)this.V=this.hmac().update(this.V).digest(),t=t.concat(this.V);let n=t.slice(0,e);return this.update(),E(n)}};function fr(e,t,n=new Dn){let r=e.byteLength()*8-n.n.bitLength();return r>0&&e.iushrn(r),t!==!0&&e.cmp(n.n)>=0?e.sub(n.n):e}function pr(e){let t=e.toArray(`be`),n=0n;for(let e of t)n=n<<8n|BigInt(e);return n}var mr=new Dn,hr=mr.n.byteLength(),gr=mr.n.subn(1),_r=Rn>>1n;function vr(e,t,n){let r;if(r=typeof e==`function`?e(t):e!==void 0&&p.isBN(e)?e:new p(n.generate(hr),16),r==null)throw Error(`k is undefined`);return fr(r,!0)}function yr(e,t){if(e)throw Error(t)}function br(e,t,n,r,i){if(e.cmpn(1)<0||e.cmp(gr)>0)return yr(i,`Invalid fixed custom K value (must be >1 and <N-1)`);let a=mr.g.mulCT(e);if(a.isInfinity())return yr(i,`Invalid fixed custom K value (k·G at infinity)`);let o=ar(BigInt(`0x`+a.getX().toString(16)));if(o===0n)return yr(i,`Invalid fixed custom K value (r == 0)`);let s=or(sr(BigInt(`0x`+e.toString(16))),ar(t+or(o,n)));return s===0n?yr(i,`Invalid fixed custom K value (s == 0)`):(r&&s>_r&&(s=Rn-s),new ur(new p(o.toString(16),16),new p(s.toString(16),16)))}var xr=(e,t,n=!1,r)=>{let i=mr.n.bitLength();if(e.bitLength()>i)throw Error(`ECDSA message is too large: expected <= ${i} bits. Callers must hash messages before signing.`);e=fr(e);let a=pr(e),o=pr(t),s=new dr(t.toArray(`be`,hr),e.toArray(`be`,hr)),c=p.isBN(r);for(let e=0;;e++){let t=br(vr(r,e,s),a,o,n,c);if(t!=null)return t}},Sr=(e,t,n)=>{let r=mr.n.bitLength();if(e.bitLength()>r)return!1;let i=pr(e);if(n.x==null||n.y==null)throw Error(`Invalid public key: missing coordinates.`);let a={x:pr(n.x),y:pr(n.y)},{r:o,s}={r:pr(t.r),s:pr(t.s)},c=i;if(o<=0n||o>=115792089237316195423570985008687907852837564279074904382605163141518161494337n||s<=0n||s>=115792089237316195423570985008687907852837564279074904382605163141518161494337n)return!1;let l=sr(s);if(l===0n)return!1;let u=or(c,l),d=or(o,l),f=er(ir(u,{x:Xn,y:Zn}),ir(d,a));if(f.Z===0n)return!1;let p=Wn(f.Z),m=O(p,p);return ar(O(f.X,m))===o},Cr=class{_rand;getRandomValues(e,t){let n=new Uint8Array(t);return e.crypto.getRandomValues(n),Array.from(n)}constructor(){let e=()=>{throw Error(`No secure random number generator is available in this environment.`)};if(this._rand=e,typeof globalThis<`u`&&typeof globalThis.crypto?.getRandomValues==`function`){this._rand=e=>this.getRandomValues(globalThis,e);return}if(globalThis.self!==void 0&&typeof globalThis.self.crypto?.getRandomValues==`function`){this._rand=e=>this.getRandomValues(globalThis.self,e);return}if(globalThis.window!==void 0&&typeof globalThis.window.crypto?.getRandomValues==`function`){this._rand=e=>this.getRandomValues(globalThis.window,e);return}if(typeof process<`u`&&typeof process.getBuiltinModule==`function`){let e=process.getBuiltinModule(`node:crypto`);if(typeof e?.randomBytes==`function`){this._rand=t=>Array.from(e.randomBytes(t));return}}this._rand=e}generate(e){return this._rand(e)}},wr=null,Tr=e=>(wr??=new Cr,wr.generate(e)),Er=class e{x;y;constructor(e,t){let n=new Dn().p;this.x=e.umod(n),this.y=t.umod(n)}toString(){return mn(this.x.toArray())+`.`+mn(this.y.toArray())}static fromString(t){let[n,r]=t.split(`.`);return new e(new p(pn(n)),new p(pn(r)))}},Dr=class e{points;threshold;constructor(e,t){this.points=e,this.threshold=t??e.length}static fromPrivateKey(t,n){let r=new Dn().p,i=[new Er(new p(0),new p(t.toArray()))];for(let e=1;e<n;e++){let e=new p(Tr(32)).umod(r),t=new p(Tr(32)).umod(r);i.push(new Er(e,t))}return new e(i)}valueAt(e){let t=new Dn().p,n=new p(0);for(let r=0;r<this.threshold;r++){let i=this.points[r].y;for(let n=0;n<this.threshold;n++)if(r!==n){let a=this.points[n].x,o=this.points[r].x,s=e.sub(a).umod(t),c=o.sub(a).umod(t).invm(t),l=s.mul(c).umod(t);i=i.mul(l).umod(t)}n=n.add(i).umod(t)}return n}},Or=class e{points;threshold;integrity;constructor(e,t,n){this.points=e,this.threshold=t,this.integrity=n}static fromBackupFormat(t){let n=0,r=``,i=t.map((e,t)=>{let i=e.split(`.`);if(i.length!==4)throw Error(`Invalid share format in share `+t.toString()+`. Expected format: "x.y.t.i" - received `+e);let[a,o,s,c]=i;if(s===void 0)throw Error(`Threshold not found in share `+t.toString());if(c===void 0)throw Error(`Integrity not found in share `+t.toString());let l=Number.parseInt(s,10);if(t!==0&&n!==l)throw Error(`Threshold mismatch in share `+t.toString());if(t!==0&&r!==c)throw Error(`Integrity mismatch in share `+t.toString());return n=l,r=c,Er.fromString([a,o].join(`.`))});return new e(i,n,r)}toBackupFormat(){return this.points.map(e=>e.toString()+`.`+this.threshold.toString()+`.`+this.integrity)}},kr=class e extends p{static fromRandom(){return new e(Tr(32))}static fromString(t,n=`hex`){return new e(super.fromString(t,n).toArray())}static fromHex(t){return new e(super.fromHex(t,`big`))}static fromWif(t,n=1){let r=gn(t,void 0,n);if(r.data.length!==33)throw Error(`Invalid WIF length`);if(r.data[32]!==1)throw Error(`Invalid WIF padding`);return new e(r.data.slice(0,32))}constructor(e=0,t=10,n=`be`,r=`apply`){if(e instanceof p?(super(),e.copy(this)):super(e,t,n),r!==`nocheck`){let e=this.checkInField();if(!e.inField){if(r===`error`)throw Error(`Input is out of field`);p.move(this,e.modN)}}}checkInField(){let e=new Dn,t=this.mod(e.n);return{inField:this.cmp(t)===0,modN:t}}isValid(){return this.checkInField().inField}sign(e,t,n=!0,r){return xr(new p(Ze(e,t),16),this,n,r)}verify(e,t,n){return Sr(new p(Ze(e,n),16),t,this.toPublicKey())}toPublicKey(){let e=new Dn().g.mulCT(this);return new lr(e.x,e.y)}toWif(e=[128]){if(!this.isValid())throw Error(`Value is out of field`);return hn([...this.toArray(`be`,32),1],e)}toAddress(e=[0]){return this.toPublicKey().toAddress(e)}toHex(){return super.toHex(32)}toString(e=`hex`,t=64){return super.toString(e,t)}deriveSharedSecret(e){if(!e.validate())throw Error(`Public key not valid for ECDH secret derivation`);return e.mulCT(this)}deriveChild(t,n,r,i){let a;if(typeof i==`function`){let e=i(this,t);e===void 0?(a=this.deriveSharedSecret(t),typeof r==`function`&&r(this,t,a)):a=e}else a=this.deriveSharedSecret(t);let o=tn(n,`utf8`),s=et(a.encode(!0),o),c=new Dn;return new e(this.add(new p(s)).mod(c.n).toArray())}toKeyShares(e,t){if(typeof e!=`number`||typeof t!=`number`)throw TypeError(`threshold and totalShares must be numbers`);if(e<2)throw Error(`threshold must be at least 2`);if(t<2)throw Error(`totalShares must be at least 2`);if(e>t)throw Error(`threshold should be less than or equal to totalShares`);let n=Dr.fromPrivateKey(this,e),r=[],i=new Set,a=new Dn,o=Tr(64);for(let e=0;e<t;e++){let t,s=0;do if(t=new p(tt(o,[e,s,...Tr(32)])).umod(a.p),s++,s>5)throw Error(`Failed to generate unique x coordinate after 5 attempts`);while(t.isZero()||i.has(t.toString()));i.add(t.toString());let c=n.valueAt(t);r.push(new Er(t,c))}return new Or(r,e,this.toPublicKey().toHash(`hex`).slice(0,8))}toBackupShares(e,t){return this.toKeyShares(e,t).toBackupFormat()}static fromBackupShares(t){return e.fromKeyShares(Or.fromBackupFormat(t))}static fromKeyShares(t){let{points:n,threshold:r,integrity:i}=t;if(r<2)throw Error(`threshold must be at least 2`);if(n.length<r)throw Error(`At least ${r} shares are required to reconstruct the private key`);for(let e=0;e<r;e++)for(let t=e+1;t<r;t++)if(n[e].x.eq(n[t].x))throw Error(`Duplicate share detected, each must be unique.`);let a=new Dr(n,r),o=new e(a.valueAt(new p(0)).toArray());if(o.toPublicKey().toHash(`hex`).slice(0,8)!==i)throw Error(`Integrity hash mismatch`);return o}},Ar={OP_0:0,OP_FALSE:0,OP_PUSHDATA1:76,OP_PUSHDATA2:77,OP_PUSHDATA4:78,OP_1NEGATE:79,OP_RESERVED:80,OP_1:81,OP_TRUE:81,OP_2:82,OP_3:83,OP_4:84,OP_5:85,OP_6:86,OP_7:87,OP_8:88,OP_9:89,OP_10:90,OP_11:91,OP_12:92,OP_13:93,OP_14:94,OP_15:95,OP_16:96,OP_NOP:97,OP_VER:98,OP_IF:99,OP_NOTIF:100,OP_VERIF:101,OP_VERNOTIF:102,OP_ELSE:103,OP_ENDIF:104,OP_VERIFY:105,OP_RETURN:106,OP_TOALTSTACK:107,OP_FROMALTSTACK:108,OP_2DROP:109,OP_2DUP:110,OP_3DUP:111,OP_2OVER:112,OP_2ROT:113,OP_2SWAP:114,OP_IFDUP:115,OP_DEPTH:116,OP_DROP:117,OP_DUP:118,OP_NIP:119,OP_OVER:120,OP_PICK:121,OP_ROLL:122,OP_ROT:123,OP_SWAP:124,OP_TUCK:125,OP_CAT:126,OP_SPLIT:127,OP_NUM2BIN:128,OP_BIN2NUM:129,OP_SIZE:130,OP_INVERT:131,OP_AND:132,OP_OR:133,OP_XOR:134,OP_EQUAL:135,OP_EQUALVERIFY:136,OP_RESERVED1:137,OP_RESERVED2:138,OP_1ADD:139,OP_1SUB:140,OP_2MUL:141,OP_2DIV:142,OP_NEGATE:143,OP_ABS:144,OP_NOT:145,OP_0NOTEQUAL:146,OP_ADD:147,OP_SUB:148,OP_MUL:149,OP_DIV:150,OP_MOD:151,OP_LSHIFT:152,OP_RSHIFT:153,OP_BOOLAND:154,OP_BOOLOR:155,OP_NUMEQUAL:156,OP_NUMEQUALVERIFY:157,OP_NUMNOTEQUAL:158,OP_LESSTHAN:159,OP_GREATERTHAN:160,OP_LESSTHANOREQUAL:161,OP_GREATERTHANOREQUAL:162,OP_MIN:163,OP_MAX:164,OP_WITHIN:165,OP_RIPEMD160:166,OP_SHA1:167,OP_SHA256:168,OP_HASH160:169,OP_HASH256:170,OP_CODESEPARATOR:171,OP_CHECKSIG:172,OP_CHECKSIGVERIFY:173,OP_CHECKMULTISIG:174,OP_CHECKMULTISIGVERIFY:175,OP_NOP1:176,OP_CHECKLOCKTIMEVERIFY:177,OP_NOP2:177,OP_CHECKSEQUENCEVERIFY:178,OP_NOP3:178,OP_SUBSTR:179,OP_NOP4:179,OP_LEFT:180,OP_NOP5:180,OP_RIGHT:181,OP_NOP6:181,OP_LSHIFTNUM:182,OP_NOP7:182,OP_RSHIFTNUM:183,OP_NOP8:183,OP_NOP9:184,OP_NOP10:185,OP_NOP11:186,OP_NOP12:187,OP_NOP13:188,OP_NOP14:189,OP_NOP15:190,OP_NOP16:191,OP_NOP17:192,OP_NOP18:193,OP_NOP19:194,OP_NOP20:195,OP_NOP21:196,OP_NOP22:197,OP_NOP23:198,OP_NOP24:199,OP_NOP25:200,OP_NOP26:201,OP_NOP27:202,OP_NOP28:203,OP_NOP29:204,OP_NOP30:205,OP_NOP31:206,OP_NOP32:207,OP_NOP33:208,OP_NOP34:209,OP_NOP35:210,OP_NOP36:211,OP_NOP37:212,OP_NOP38:213,OP_NOP39:214,OP_NOP40:215,OP_NOP41:216,OP_NOP42:217,OP_NOP43:218,OP_NOP44:219,OP_NOP45:220,OP_NOP46:221,OP_NOP47:222,OP_NOP48:223,OP_NOP49:224,OP_NOP50:225,OP_NOP51:226,OP_NOP52:227,OP_NOP53:228,OP_NOP54:229,OP_NOP55:230,OP_NOP56:231,OP_NOP57:232,OP_NOP58:233,OP_NOP59:234,OP_NOP60:235,OP_NOP61:236,OP_NOP62:237,OP_NOP63:238,OP_NOP64:239,OP_NOP65:240,OP_NOP66:241,OP_NOP67:242,OP_NOP68:243,OP_NOP69:244,OP_NOP70:245,OP_NOP71:246,OP_NOP72:247,OP_NOP73:248,OP_NOP77:252,OP_SMALLDATA:249,OP_SMALLINTEGER:250,OP_PUBKEYS:251,OP_PUBKEYHASH:253,OP_PUBKEY:254,OP_INVALIDOPCODE:255},k=Ar;for(let e of Object.keys(Ar)){let t=Ar[e];k[t]??=e}var jr=typeof globalThis>`u`?void 0:globalThis.Buffer;function Mr(e){let t=e.data?.length??0;if(t===0||e.op===k.OP_RETURN||e.op<k.OP_PUSHDATA1)return[e.op];if(e.op===k.OP_PUSHDATA1)return[e.op,t&255];if(e.op===k.OP_PUSHDATA2)return[e.op,t&255,t>>8&255];if(e.op===k.OP_PUSHDATA4){let n=t>>>0;return[e.op,n&255,n>>8&255,n>>16&255,n>>24&255]}}function Nr(e,t){let n=Mr(e),r=e.data??[];if(n==null||t.length!==n.length+r.length)return!1;for(let e=0;e<n.length;e++)if(t[e]!==n[e])return!1;for(let e=0;e<r.length;e++)if(t[n.length+e]!==r[e])return!1;return!0}var Pr=class e{_chunks;parsed;rawBytesCache;hexCache;static fromASM(t){let n=[],r=t.split(` `),i=0;for(;i<r.length;){let{chunk:t,advance:a}=e.parseASMToken(r,i);n.push(t),i+=a}return new e(n)}static pushdataOpCodeNum(e){return e>=0&&e<k.OP_PUSHDATA1?e:e<256?k.OP_PUSHDATA1:e<2**16?k.OP_PUSHDATA2:k.OP_PUSHDATA4}static parseASMToken(t,n){let r=t[n];if(r===`0`)return{chunk:{op:0},advance:1};if(r===`-1`)return{chunk:{op:k.OP_1NEGATE},advance:1};let i=r.startsWith(`OP_`)&&k[r]!==void 0,a=i?k[r]:0;if(a===k.OP_PUSHDATA1||a===k.OP_PUSHDATA2||a===k.OP_PUSHDATA4)return{chunk:{data:tn(t[n+2],`hex`),op:a},advance:3};if(!i){let t=r;t.length%2!=0&&(t=`0`+t);let n=tn(t,`hex`);if(un(n,`hex`)!==t)throw Error(`invalid hex string in script`);return{chunk:{data:n,op:e.pushdataOpCodeNum(n.length)},advance:1}}return{chunk:{op:a},advance:1}}static fromHex(t){if(t.length===0)return e.fromBinary([]);if(t.length%2!=0)throw Error(`There is an uneven number of characters in the string which suggests it is not hex encoded.`);if(!/^[0-9a-fA-F]+$/.test(t))throw Error(`Some elements in this string are not hex encoded.`);let n=D(t);return new e([],n,t.toLowerCase(),!1)}static fromBinary(t){let n=Uint8Array.from(t);return new e([],n,void 0,!1)}static fromBinaryView(t){return new e([],t,void 0,!1)}constructor(e=[],t,n,r=!0){this._chunks=e,this.parsed=r,this.rawBytesCache=t,this.hexCache=n}get chunks(){return this.ensureParsed(),this._chunks}set chunks(e){this._chunks=e,this.parsed=!0,this.invalidateSerializationCaches()}ensureParsed(){this.parsed||=(this._chunks=this.rawBytesCache==null?[]:e.parseChunks(this.rawBytesCache),!0)}toASM(){let e=``;for(let t of this.chunks)e+=this._chunkToString(t);return e.slice(1)}toHex(){if(this.hexCache!=null)return this.hexCache;this.rawBytesCache??=this.serializeChunksToBytes();let e=jr==null?un(Array.from(this.rawBytesCache),`hex`):jr.from(this.rawBytesCache).toString(`hex`);return this.hexCache=e,e}toBinary(){return Array.from(this.toUint8Array())}toUint8Array(){return this.rawBytesCache??=this.serializeChunksToBytes(),this.rawBytesCache}writeScript(e){return this.invalidateSerializationCaches(),this.chunks=this.chunks.concat(e.chunks),this}writeOpCode(e){return this.invalidateSerializationCaches(),this.chunks.push({op:e}),this}setChunkOpCode(e,t){return this.invalidateSerializationCaches(),this.chunks[e]={op:t},this}writeBn(e){if(this.invalidateSerializationCaches(),e.cmpn(0)===k.OP_0)this.chunks.push({op:k.OP_0});else if(e.cmpn(-1)===0)this.chunks.push({op:k.OP_1NEGATE});else if(e.cmpn(1)>=0&&e.cmpn(16)<=0)this.chunks.push({op:e.toNumber()+k.OP_1-1});else{let t=e.toSm(`little`);this.writeBin(t)}return this}writeBin(e){this.invalidateSerializationCaches();let t,n=e.length>0?e:void 0;if(e.length>0&&e.length<k.OP_PUSHDATA1)t=e.length;else if(e.length===0)t=k.OP_0;else if(e.length<256)t=k.OP_PUSHDATA1;else if(e.length<2**16)t=k.OP_PUSHDATA2;else if(e.length<2**32)t=k.OP_PUSHDATA4;else throw Error(`You can't push that much data`);return this.chunks.push({data:n,op:t}),this}writeNumber(e){return this.invalidateSerializationCaches(),this.writeBn(new p(e)),this}removeCodeseparators(){let t=this.toUint8Array();return this.rawBytesCache=Uint8Array.from(e.removeOpcodeBytes(t,k.OP_CODESEPARATOR)),this.hexCache=void 0,this._chunks=[],this.parsed=!1,this}findAndDelete(e){this.invalidateSerializationCaches();let t=e.toUint8Array();if(t.length===0)return this;for(let e=0;e<this.chunks.length;)Nr(this.chunks[e],t)?this.chunks.splice(e,1):e++;return this}isPushOnly(){for(let e of this.chunks)if(e.op>k.OP_16)return!1;return!0}isLockingScript(){throw Error(`Not implemented`)}isUnlockingScript(){throw Error(`Not implemented`)}static computeSerializedLength(e){let t=0;for(let n of e){if(t+=1,n.data==null)continue;let e=n.data.length;if(n.op===k.OP_RETURN){t+=e;break}n.op<k.OP_PUSHDATA1?t+=e:n.op===k.OP_PUSHDATA1?t+=1+e:n.op===k.OP_PUSHDATA2?t+=2+e:n.op===k.OP_PUSHDATA4&&(t+=4+e)}return t}serializeChunksToBytes(){let t=this.chunks,n=e.computeSerializedLength(t),r=new Uint8Array(n),i=0;for(let n of t)if(r[i++]=n.op,n.data!=null){if(n.op===k.OP_RETURN){r.set(n.data,i);break}i=e.writeChunkData(r,i,n.op,n.data)}return r}invalidateSerializationCaches(){this.rawBytesCache=void 0,this.hexCache=void 0}static writeChunkData(e,t,n,r){let i=r.length;if(n<k.OP_PUSHDATA1)return e.set(r,t),t+i;if(n===k.OP_PUSHDATA1)return e[t++]=i&255,e.set(r,t),t+i;if(n===k.OP_PUSHDATA2)return e[t++]=i&255,e[t++]=i>>8&255,e.set(r,t),t+i;if(n===k.OP_PUSHDATA4){let n=i>>>0;return e[t++]=n&255,e[t++]=n>>8&255,e[t++]=n>>16&255,e[t++]=n>>24&255,e.set(r,t),t+i}return t}static readPushdataLength(e,t,n,r){if(e>0&&e<k.OP_PUSHDATA1)return{len:e,newPos:n,hasLength:!0};if(e===k.OP_PUSHDATA1){let e=n<r;return{len:e?t[n++]??0:0,newPos:n,hasLength:e}}if(e===k.OP_PUSHDATA2){let e=n+1<r;return{len:(t[n]??0)|(t[n+1]??0)<<8,newPos:Math.min(n+2,r),hasLength:e}}let i=n+3<r;return{len:((t[n]??0)|(t[n+1]??0)<<8|(t[n+2]??0)<<16|(t[n+3]??0)<<24)>>>0,newPos:Math.min(n+4,r),hasLength:i}}static parseChunks(t){let n=[],r=t.length,i=0,a=0;for(;i<r;){let o=t[i++]??0;if(o===k.OP_RETURN&&a===0){n.push({op:o,data:e.copyRange(t,i,r)});break}if(o===k.OP_IF||o===k.OP_NOTIF||o===k.OP_VERIF||o===k.OP_VERNOTIF?a++:o===k.OP_ENDIF&&a--,o>0&&o<=k.OP_PUSHDATA4){let{len:a,newPos:s,hasLength:c}=e.readPushdataLength(o,t,i,r);i=s;let l=Math.min(i+a,r),u=!c||l-i!==a;n.push({data:e.copyRange(t,i,l),op:o,invalidLength:u}),i=l}else n.push({op:o})}return n}static removeOpcodeBytes(t,n){let r=[],i=t.length,a=0;for(;a<i;){let o=a,s=t[a++]??0;if(s>0&&s<=k.OP_PUSHDATA4){let{len:c,newPos:l}=e.readPushdataLength(s,t,a,i);a=l;let u=Math.min(a+c,i);if(s!==n)for(let e=o;e<u;e++)r.push(t[e]??0);a=u}else s!==n&&r.push(s)}return r}static copyRange(e,t,n){let r=Math.max(n-t,0),i=Array.from({length:r},()=>0);for(let n=0;n<r;n++)i[n]=e[t+n]??0;return i}_chunkToString(e){let t=e.op,n=``;if(e.data===void 0){let e=k[t];n=`${n} ${e}`}else n=`${n} ${E(e.data)}`;return n}},Fr=new Uint8Array,Ir=Object.freeze(Array.from({length:32},()=>0));function Lr(e,t){if(e.allInputs!=null)return e.allInputs;let n=[...e.otherInputs];return n.splice(e.inputIndex,0,t),n}function Rr(e,t,n,r){return r===t?n:e[r]}function zr(e,t,n){let r=new _n;for(let i=0;i<e.length;i++){let a=Rr(e,t,n,i);if(a.sourceTXID==null){if(a.sourceTransaction==null)throw Error(`Missing sourceTransaction for input`);r.write(a.sourceTransaction.hash())}else r.writeReverse(tn(a.sourceTXID,`hex`));r.writeUInt32LE(a.sourceOutputIndex)}return Qe(r.toUint8Array())}function Br(e,t,n){let r=new _n;for(let i=0;i<e.length;i++){let a=Rr(e,t,n,i);r.writeUInt32LE(a.sequence??4294967295)}return Qe(r.toUint8Array())}function Vr(e,t){e.writeUInt64LE(t.satoshis??0);let n=t.lockingScript?.toUint8Array()??Fr;e.writeVarIntNum(n.length),e.write(n)}function Hr(e,t){let n=new _n;if(t==null)for(let t of e)Vr(n,t);else{let r=e[t];if(r==null)throw Error(`Output at index ${t} does not exist`);Vr(n,r)}return Qe(n.toUint8Array())}function Ur(e,t,n){if((e.scope&Kr.SIGHASH_ANYONECANPAY)!==0)return[...Ir];if(e.cache?.hashPrevouts!=null)return e.cache.hashPrevouts;let r=zr(t,e.inputIndex,n);return e.cache!=null&&(e.cache.hashPrevouts=r),r}function Wr(e,t,n){let r=e.scope&31;if((e.scope&Kr.SIGHASH_ANYONECANPAY)!==0||r===Kr.SIGHASH_SINGLE||r===Kr.SIGHASH_NONE)return[...Ir];if(e.cache?.hashSequence!=null)return e.cache.hashSequence;let i=Br(t,e.inputIndex,n);return e.cache!=null&&(e.cache.hashSequence=i),i}function Gr(e){let t=e.scope&31;if(t!==Kr.SIGHASH_SINGLE&&t!==Kr.SIGHASH_NONE){if(e.cache?.hashOutputsAll!=null)return e.cache.hashOutputsAll;let t=Hr(e.outputs);return e.cache!=null&&(e.cache.hashOutputsAll=t),t}if(t!==Kr.SIGHASH_SINGLE||e.inputIndex>=e.outputs.length)return[...Ir];let n=e.cache?.hashOutputsSingle?.get(e.inputIndex);if(n!=null)return n;let r=Hr(e.outputs,e.inputIndex);return e.cache!=null&&(e.cache.hashOutputsSingle??=new Map,e.cache.hashOutputsSingle.set(e.inputIndex,r)),r}var Kr=class e extends ur{static SIGHASH_ALL=1;static SIGHASH_NONE=2;static SIGHASH_SINGLE=3;static SIGHASH_CHRONICLE=32;static SIGHASH_FORKID=64;static SIGHASH_ANYONECANPAY=128;scope;static formatOTDA(t){let n=(t.scope&e.SIGHASH_ANYONECANPAY)===e.SIGHASH_ANYONECANPAY,r=(t.scope&31)===e.SIGHASH_SINGLE,i=(t.scope&31)===e.SIGHASH_NONE,a=(t.scope&31)===e.SIGHASH_ALL||!r&&!i,o=Pr.fromBinary(t.subscript.toBinary());o.removeCodeseparators();let s={sourceTXID:t.sourceTXID,sourceOutputIndex:t.sourceOutputIndex,sequence:t.inputSequence,script:o.toBinary()},c=new _n;function l(e){c.writeVarIntNum(e.length);for(let t of e)c.writeReverse(tn(t.sourceTXID,`hex`)),c.writeUInt32LE(t.sourceOutputIndex),c.writeVarIntNum(t.script.length),c.write(t.script),c.writeUInt32LE(t.sequence)}function u(e){c.writeVarIntNum(e.length);for(let t of e)c.writeUInt64LE(t.satoshis),c.writeVarIntNum(t.script.length),c.write(t.script)}c.writeInt32LE(t.transactionVersion);let d=new Pr().toBinary();if(n)n&&l([s]);else{let e=t.allInputs==null?t.otherInputs.map(e=>({sourceTXID:e.sourceTXID??e.sourceTransaction?.id(`hex`)??``,sourceOutputIndex:e.sourceOutputIndex,sequence:r||i?0:e.sequence??4294967295,script:d})):t.allInputs.map((e,n)=>n===t.inputIndex?s:{sourceTXID:e.sourceTXID??e.sourceTransaction?.id(`hex`)??``,sourceOutputIndex:e.sourceOutputIndex,sequence:r||i?0:e.sequence??4294967295,script:d});t.allInputs??e.splice(t.inputIndex,0,s),l(e)}if(a)u(t.outputs.map(e=>({satoshis:e.satoshis??0,script:e.lockingScript.toBinary()})));else if(r){let e=[];for(let n=0;n<t.inputIndex;n++)e.push({satoshis:-1,script:d});let n=t.outputs[t.inputIndex];n!==void 0&&e.push({satoshis:n.satoshis??0,script:n.lockingScript.toBinary()}),u(e)}else i&&u([]);return c.writeUInt32LE(t.lockTime),c.writeUInt32LE(t.scope>>>0),c.toUint8Array()}static formatBip143(e){let t={sourceTXID:e.sourceTXID,sourceOutputIndex:e.sourceOutputIndex,sequence:e.inputSequence},n=Lr(e,t),r=Ur(e,n,t),i=Wr(e,n,t),a=Gr(e),o=new _n;o.writeInt32LE(e.transactionVersion),o.write(r),o.write(i),o.writeReverse(tn(e.sourceTXID,`hex`)),o.writeUInt32LE(e.sourceOutputIndex);let s=e.subscript.toUint8Array();o.writeVarIntNum(s.length),o.write(s),o.writeUInt64LE(e.sourceSatoshis);let c=t.sequence??4294967295;return o.writeUInt32LE(c),o.write(a),o.writeUInt32LE(e.lockTime),o.writeUInt32LE(e.scope>>>0),o.toUint8Array()}static format(e){return Array.from(this.formatBytes(e))}static formatBytes(t){let n=(t.scope&e.SIGHASH_FORKID)!==0,r=t.ignoreChronicle!==!0&&(t.scope&e.SIGHASH_CHRONICLE)!==0;return n&&!r?e.formatBip143(t):!n||n&&r?e.formatOTDA(t):new Uint8Array}static usesOtdaSingleBug(t){let n=(t.scope&e.SIGHASH_FORKID)!==0,r=t.ignoreChronicle!==!0&&(t.scope&e.SIGHASH_CHRONICLE)!==0;return(!n||n&&r)&&(t.scope&31)===e.SIGHASH_SINGLE&&t.inputIndex>=t.outputs.length}static fromChecksigFormat(t){if(t.length===0){let t=new p(1),n=new p(1);return new e(t,n,1)}let n=t.at(-1),r=t.slice(0,-1),i=ur.fromDER(r);return new e(i.r,i.s,n)}constructor(e,t,n){super(e,t),this.scope=n}hasLowS(){return!(this.s.ltn(1)||this.s.gt(new p(`7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0`,`hex`)))}toChecksigFormat(){return[...this.toDER(),this.scope]}};function qr(e,t,n){if(!(t instanceof Uint8Array))throw TypeError(`${e} returned a non-byte result`);if(n!==void 0&&t.length!==n)throw Error(`${e} returned ${t.length} bytes; expected ${n}`);return t}function Jr(){return globalThis}function Yr(e){let t=Jr().__bsvSdkAsyncCryptoBackendV1;if(t!==void 0){if(!t.isReady()){t.preload().catch(()=>{});return}return t.supportsCrypto(e)?t:void 0}}var Xr=class extends Pr{isLockingScript(){return!0}isUnlockingScript(){return!1}},Zr=class extends Pr{isLockingScript(){return!1}isUnlockingScript(){return!0}};function Qr(e){return e==null?`null/undef`:e.length===void 0?`INVALID_STACK_ITEM`:E(e)}var $r=class extends Error{txid;outputIndex;context;programCounter;stackState;altStackState;ifStackState;stackMem;altStackMem;constructor(e){let t=e.stackState.map(Qr).join(`, `),n=e.altStackState.map(Qr).join(`, `),r=`Context: ${e.context}, PC: ${e.programCounter}`,i=`Stack: [${t}] (len: ${e.stackState.length}, mem: ${e.stackMem})`,a=`AltStack: [${n}] (len: ${e.altStackState.length}, mem: ${e.altStackMem})`,o=`IfStack: [${e.ifStackState.join(`, `)}]`,s=`Script evaluation error: ${e.message}\nTXID: ${e.txid}, OutputIdx: ${e.outputIndex}\n${r}\n${i}\n${a}\n${o}`;super(s),this.name=this.constructor.name,this.txid=e.txid,this.outputIndex=e.outputIndex,this.context=e.context,this.programCounter=e.programCounter,this.stackState=e.stackState.map(e=>e.slice()),this.altStackState=e.altStackState.map(e=>e.slice()),this.ifStackState=e.ifStackState.slice(),this.stackMem=e.stackMem,this.altStackMem=e.altStackMem}},ei=class extends Error{resource;limit;attempted;constructor(e,t,n){let r={stack:`Stack memory usage`,"alt-stack":`Alt stack memory usage`,"element-size":`Script element allocation`}[e];super(`${r} has exceeded ${t} bytes`),this.resource=e,this.limit=t,this.attempted=n,this.name=`ScriptResourceLimitError`}};function ti(){return globalThis}function ni(){return ti().__bsvSdkScriptVerificationBackendV1}var ri=520,ii=1e4,ai=500,oi=4294967295n,si=1e3,ci=BigInt(2**31-1),li=20,ui=2147483648,di=Object.freeze(new p(-1).toScriptNum()),fi=Object.freeze(Array.from({length:17},(e,t)=>Object.freeze(new p(t).toScriptNum())));function pi(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function mi(e){return new p(+!!e)}function hi(e,t){return mi(e&&t)}function gi(e,t){return mi(e||t)}function _i(e,t){return e.cmp(t)<0?e:t}function vi(e,t){return e.cmp(t)>0?e:t}function yi(e,t=2**53-1){return!(e.length>t||e.length>0&&!(e.at(-1)&127)&&(e.length<=1||!(e.at(-2)&128)))}function bi(e){if(e.length<9||e.length>73||e[0]!==48||e[1]!==e.length-3)return!1;let t=e[2],n=e[3];if(t!==2||n===0||5+n>=e.length)return!1;let r=4+n,i=e[r],a=e[r+1];if(i!==2||a===0||e[4]&128||n>1&&e[4]===0&&!(e[5]&128))return!1;let o=r+2;return!(e[o]&128||a>1&&e[o]===0&&!(e[o+1]&128)||n+a+7!==e.length)}function xi(e){let t=e.data,n=e.op;return Array.isArray(t)?t.length===0?n===k.OP_0:t.length===1&&t[0]>=1&&t[0]<=16?n===k.OP_1+(t[0]-1):t.length===1&&t[0]===129?n===k.OP_1NEGATE:t.length<=75?n===t.length:t.length<=255?n===k.OP_PUSHDATA1:t.length<=65535?n===k.OP_PUSHDATA2:!0:!0}var Si=class{sourceTXID;sourceOutputIndex;sourceSatoshis;lockingScript;transactionVersion;otherInputs;allInputs;outputs;inputIndex;unlockingScript;inputSequence;lockTime;context;programCounter;lastCodeSeparator;stack;altStack;ifStack;elseStack;memoryLimit;hasExplicitMemoryLimit;stackMem;altStackMem;isRelaxedOverride;verifyFlags;executedOpCount;returningFromConditional;sigHashCache;ownsSigHashCache;constructor(e){if(this.sourceTXID=e.sourceTXID,this.sourceOutputIndex=e.sourceOutputIndex,this.sourceSatoshis=e.sourceSatoshis,this.lockingScript=e.lockingScript,this.transactionVersion=e.transactionVersion,this.otherInputs=e.otherInputs,this.allInputs=e.allInputs,this.outputs=e.outputs,this.inputIndex=e.inputIndex,this.unlockingScript=e.unlockingScript,this.inputSequence=e.inputSequence,this.lockTime=e.lockTime,this.hasExplicitMemoryLimit=e.memoryLimit!==void 0,this.memoryLimit=e.memoryLimit??1/0,this.isRelaxedOverride=e.isRelaxed===!0,e.verifyFlags===void 0)this.verifyFlags=void 0;else{let t=Array.isArray(e.verifyFlags)?e.verifyFlags:e.verifyFlags.split(`,`);this.verifyFlags=new Set(t.map(e=>e.trim()).filter(e=>e.length>0))}this.stack=[],this.altStack=[],this.ifStack=[],this.elseStack=[],this.stackMem=0,this.altStackMem=0,this.executedOpCount=0,this.returningFromConditional=!1,this.ownsSigHashCache=e.sigHashCache==null,this.sigHashCache=e.sigHashCache??{hashOutputsSingle:new Map},this.reset()}isRelaxed(){return this.isRelaxedOverride||this.transactionVersion>1}hasExplicitFlags(){return this.verifyFlags!==void 0}hasFlag(e){return this.verifyFlags?.has(e)===!0}isAfterGenesis(){return this.hasExplicitFlags()?this.hasFlag(`GENESIS`)||this.hasFlag(`UTXO_AFTER_GENESIS`)||this.hasFlag(`UTXO_AFTER_CHRONICLE`):this.isRelaxed()}isAfterChronicle(){return this.hasExplicitFlags()?this.hasFlag(`UTXO_AFTER_CHRONICLE`):this.isRelaxed()}shouldEnforceMinimalData(){return this.hasExplicitFlags()?this.hasFlag(`MINIMALDATA`):!this.isRelaxed()}shouldEnforceLowS(){return this.hasExplicitFlags()?this.hasFlag(`LOW_S`):!this.isRelaxed()}shouldEnforceNullDummy(){return this.hasExplicitFlags()?this.hasFlag(`NULLDUMMY`):!this.isRelaxed()}shouldEnforceSigPushOnly(){return this.hasExplicitFlags()?this.hasFlag(`SIGPUSHONLY`):!this.isRelaxed()}shouldEnforceCleanStack(){return this.hasExplicitFlags()?this.hasFlag(`CLEANSTACK`):!this.isRelaxed()}shouldEnforceDerSignatures(){return!this.hasExplicitFlags()||this.hasFlag(`DERSIG`)||this.hasFlag(`STRICTENC`)||this.hasFlag(`LOW_S`)||this.hasFlag(`SIGHASH_FORKID`)}shouldEnforceStrictEncoding(){return!this.hasExplicitFlags()||this.hasFlag(`STRICTENC`)||this.hasFlag(`SIGHASH_FORKID`)}scriptNumMaxSize(){if(this.hasExplicitFlags()&&!this.isAfterGenesis())return 4}maxPushSize(){return this.hasExplicitFlags()&&!this.isAfterGenesis()?ri:1/0}reset(){this.ownsSigHashCache&&(delete this.sigHashCache.hashPrevouts,delete this.sigHashCache.hashSequence,delete this.sigHashCache.hashOutputsAll,this.sigHashCache.hashOutputsSingle?.clear()),this.context=`UnlockingScript`,this.programCounter=0,this.lastCodeSeparator=null,this.stack=[],this.altStack=[],this.ifStack=[],this.elseStack=[],this.stackMem=0,this.altStackMem=0,this.executedOpCount=0,this.returningFromConditional=!1}ensureStackMem(e){if(this.stackMem+e>this.memoryLimit)throw new ei(`stack`,this.memoryLimit,this.stackMem+e)}ensureAltStackMem(e){if(this.altStackMem+e>this.memoryLimit)throw new ei(`alt-stack`,this.memoryLimit,this.altStackMem+e)}pushStack(e){this.ensureStackMem(e.length),this.stack.push(e),this.stackMem+=e.length}pushStackCopy(e){this.ensureStackMem(e.length);let t=e.slice();this.stack.push(t),this.stackMem+=t.length}popStack(){this.stack.length===0&&this.scriptEvaluationError(`Attempted to pop from an empty stack.`);let e=this.stack.pop();return e===void 0?(this.scriptEvaluationError(`Attempted to pop from an empty stack.`),[]):(this.stackMem-=e.length,e)}stackTop(e=-1){return(this.stack.length===0||this.stack.length<Math.abs(e)||e>=0&&e>=this.stack.length)&&this.scriptEvaluationError(`Stack underflow accessing element at index ${e}. Stack length is ${this.stack.length}.`),this.stack[this.stack.length+e]}requireStackItems(e,t){this.stack.length<e&&this.scriptEvaluationError(t)}requireAltStackItems(e,t){this.altStack.length<e&&this.scriptEvaluationError(t)}setStack(e){this.stack=e.map(e=>e.slice()),this.stackMem=this.stack.reduce((e,t)=>e+t.length,0)}clearAltStack(){this.altStack=[],this.altStackMem=0}pushAltStack(e){this.ensureAltStackMem(e.length),this.altStack.push(e),this.altStackMem+=e.length}popAltStack(){this.altStack.length===0&&this.scriptEvaluationError(`Attempted to pop from an empty alt stack.`);let e=this.altStack.pop();return e===void 0?(this.scriptEvaluationError(`Attempted to pop from an empty alt stack.`),[]):(this.altStackMem-=e.length,e)}readScriptNumber(e){try{return p.fromScriptNum(e,this.shouldEnforceMinimalData(),this.scriptNumMaxSize())}catch(e){let t=e instanceof Error?e.message:String(e);this.scriptEvaluationError(t)}return new p(0)}isDefinedHashType(e){let t=e&31;return t>=Kr.SIGHASH_ALL&&t<=Kr.SIGHASH_SINGLE}enforceSignatureHashType(e){this.shouldEnforceStrictEncoding()&&(this.isDefinedHashType(e.scope)||this.scriptEvaluationError(`The signature hash type is invalid.`),(e.scope&Kr.SIGHASH_CHRONICLE)!==0&&!this.isAfterChronicle()&&this.scriptEvaluationError(`The signature hash type is invalid before Chronicle.`))}enforceSignatureForkId(e){if(!this.hasExplicitFlags())return;let t=(e.scope&Kr.SIGHASH_FORKID)!==0;this.hasFlag(`SIGHASH_FORKID`)&&!t&&this.scriptEvaluationError(`The signature must use SIGHASH_FORKID.`),!this.hasFlag(`SIGHASH_FORKID`)&&!this.isAfterGenesis()&&t&&this.scriptEvaluationError(`The signature must not use SIGHASH_FORKID.`)}checkSignatureEncoding(e){if(e.length===0)return!0;let t=this.shouldEnforceDerSignatures();if(t&&!bi(e))return this.scriptEvaluationError(`The signature format is invalid.`),!1;try{let t=Kr.fromChecksigFormat(e);if(this.enforceSignatureHashType(t),this.enforceSignatureForkId(t),this.shouldEnforceLowS()&&!t.hasLowS())return this.scriptEvaluationError(`The signature must have a low S value.`),!1}catch{if(t)return this.scriptEvaluationError(`The signature format is invalid.`),!1}return!0}parseChecksigSignature(e){try{return Kr.fromChecksigFormat(e)}catch(t){if(this.shouldEnforceDerSignatures())throw t;return this.parseLaxChecksigSignature(e)}}readLaxDERLength(e,t){let n=e[t.value++];if(n===void 0)throw Error(`Invalid DER length`);if(!(n&128))return n;let r=n&127;if(r===0||t.value+r>e.length)throw Error(`Invalid DER length`);let i=0;for(let n=0;n<r;n++)i=i<<8|(e[t.value++]??0);return i}parseLaxDERInteger(e,t,n){if(t.value>=n||e[t.value++]!==2)throw Error(`Invalid DER integer`);let r=this.readLaxDERLength(e,t);if(t.value+r>n)throw Error(`Invalid DER integer length`);let i=e.slice(t.value,t.value+r);for(t.value+=r;i.length>1&&i[0]===0;)i=i.slice(1);return i.length===0&&(i=[0]),new p(i)}parseLaxChecksigSignature(e){if(e.length===0)return Kr.fromChecksigFormat(e);let t=e.at(-1),n=e.slice(0,-1),r={value:0};if(n[r.value++]!==48)throw Error(`Signature DER must start with 0x30`);let i=this.readLaxDERLength(n,r),a=Math.min(r.value+i,n.length);return new Kr(this.parseLaxDERInteger(n,r,a),this.parseLaxDERInteger(n,r,a),t)}checkPublicKeyEncoding(e){if(!this.shouldEnforceStrictEncoding())return!0;if(e.length===0)return this.scriptEvaluationError(`Public key is empty.`),!1;if(e.length<33)return this.scriptEvaluationError(`The public key is too short, it must be at least 33 bytes.`),!1;if(e[0]===4){if(e.length!==65)return this.scriptEvaluationError(`The non-compressed public key must be 65 bytes.`),!1}else if(e[0]===2||e[0]===3){if(e.length!==33)return this.scriptEvaluationError(`The compressed public key must be 33 bytes.`),!1}else return this.scriptEvaluationError(`The public key is in an unknown format.`),!1;try{lr.fromDER(e)}catch{return this.scriptEvaluationError(`The public key is in an unknown format.`),!1}return!0}verifySignature(e,t,n){let r={sourceTXID:this.sourceTXID,sourceOutputIndex:this.sourceOutputIndex,sourceSatoshis:this.sourceSatoshis,transactionVersion:this.transactionVersion,otherInputs:this.otherInputs,allInputs:this.allInputs,outputs:this.outputs,inputIndex:this.inputIndex,subscript:n,inputSequence:this.inputSequence,lockTime:this.lockTime,scope:e.scope,cache:this.sigHashCache};return Sr(Kr.usesOtdaSingleBug(r)?new p([1,...Array.from({length:31},()=>0)]):new p(Qe(Kr.formatBytes(r))),e,t)}enforceStepResourceLimits(){if(this.stackMem>this.memoryLimit)throw new ei(`stack`,this.memoryLimit,this.stackMem);if(this.altStackMem>this.memoryLimit)throw new ei(`alt-stack`,this.memoryLimit,this.altStackMem)}currentScriptForStep(){return this.context===`UnlockingScript`&&this.programCounter>=this.unlockingScript.chunks.length&&(this.ifStack.length>0&&this.scriptEvaluationError(`Every OP_IF, OP_NOTIF, or OP_ELSE must be terminated with OP_ENDIF prior to the end of the unlocking script.`),this.clearAltStack(),this.ifStack=[],this.elseStack=[],this.returningFromConditional=!1,this.lastCodeSeparator=null,this.context=`LockingScript`,this.programCounter=0),this.context===`UnlockingScript`?this.unlockingScript:this.lockingScript}opcodeForOperation(e){let t=e.op;return t===void 0?(this.scriptEvaluationError(`Missing opcode in ${this.context} at pc=${this.programCounter}.`),0):(e.invalidLength===!0&&this.scriptEvaluationError(`Malformed push data in ${this.context} at pc=${this.programCounter}.`),Array.isArray(e.data)&&e.data.length>this.maxPushSize()&&this.scriptEvaluationError(`Data push > ${this.maxPushSize()} bytes (pc=${this.programCounter}).`),t)}enforceChronicleOnlyOpcode(e){this.hasExplicitFlags()&&!this.isAfterGenesis()&&!this.isAfterChronicle()&&(e===k.OP_2MUL||e===k.OP_2DIV||e===k.OP_VERIF||e===k.OP_VERNOTIF)&&this.scriptEvaluationError(`${k[e]} is disabled until Chronicle.`)}executeDataPush(e){this.shouldEnforceMinimalData()&&!xi(e)&&this.scriptEvaluationError(`This data is not minimally-encoded. (PC: ${this.programCounter})`),this.pushStack(Array.isArray(e.data)?e.data:[])}countExecutedOpcode(e,t){!t||e<=k.OP_16||(this.executedOpCount++,this.hasExplicitFlags()&&!this.isAfterGenesis()&&this.executedOpCount>ai&&this.scriptEvaluationError(`Script executed more than ${ai} opcodes.`))}skipUnavailablePreChronicleOpcode(e,t){return!this.hasExplicitFlags()||this.isAfterChronicle()?!1:t&&(e===k.OP_SUBSTR||e===k.OP_LEFT||e===k.OP_RIGHT||e===k.OP_LSHIFTNUM||e===k.OP_RSHIFTNUM)?(this.hasFlag(`DISCOURAGE_UPGRADABLE_NOPS`)&&this.scriptEvaluationError(`${k[e]} is discouraged by verification flags.`),this.programCounter++,!0):((t||!this.isAfterGenesis())&&(e===k.OP_2MUL||e===k.OP_2DIV)&&this.scriptEvaluationError(`${k[e]} is disabled until Chronicle.`),(t||!this.isAfterGenesis())&&(e===k.OP_VER||e===k.OP_VERIF||e===k.OP_VERNOTIF)&&this.scriptEvaluationError(`${k[e]} is disabled until Chronicle.`),!t&&this.isAfterGenesis()&&(e===k.OP_VERIF||e===k.OP_VERNOTIF)?(this.programCounter++,!0):!1)}enforceDiscouragedNop(e,t){t&&this.hasFlag(`DISCOURAGE_UPGRADABLE_NOPS`)&&(e===k.OP_NOP1||e===k.OP_CHECKLOCKTIMEVERIFY||e===k.OP_CHECKSEQUENCEVERIFY||e===k.OP_NOP9||e===k.OP_NOP10)&&this.scriptEvaluationError(`${k[e]} is discouraged by verification flags.`)}advanceAfterStep(e){this.returningFromConditional&&this.ifStack.length===0?this.programCounter=e.chunks.length:this.programCounter++,this.hasExplicitFlags()&&!this.isAfterGenesis()&&this.stack.length+this.altStack.length>si&&this.scriptEvaluationError(`Stack item count has exceeded ${si}.`)}step(){this.enforceStepResourceLimits();let e=this.currentScriptForStep();if(this.programCounter>=e.chunks.length)return!1;let t=e.chunks[this.programCounter],n=this.opcodeForOperation(t),r=!this.returningFromConditional&&!this.ifStack.includes(!1);if(this.enforceChronicleOnlyOpcode(n),r&&n>=0&&n<=k.OP_PUSHDATA4)this.executeDataPush(t);else if(r||n>=k.OP_IF&&n<=k.OP_ENDIF){let e,t,i,a,o,s,c,l,u,d,f,m,h,g,_,v,y,b,ee,te,x,ne,S,re,C,ie;if(this.countExecutedOpcode(n,r),this.skipUnavailablePreChronicleOpcode(n,r))return!0;switch(this.enforceDiscouragedNop(n,r),n){case k.OP_VER:{let e=this.transactionVersion;this.pushStack([e&255,e>>>8&255,e>>>16&255,e>>>24&255]);break}case k.OP_SUBSTR:(()=>{this.stack.length<3&&this.scriptEvaluationError(`OP_SUBSTR requires at least three items to be on the stack.`);let t=this.readScriptNumber(this.popStack()).toNumber(),n=this.readScriptNumber(this.popStack()).toNumber();e=this.popStack();let r=e.length;(n<0||n>=r||t<0||t>r-n)&&this.scriptEvaluationError(`OP_SUBSTR offset (${n}) must be in range [0, ${r}) and length (${t}) must be in range [0, ${r-n}]`),this.pushStack(e.slice(n,n+t))})();break;case k.OP_LEFT:(()=>{this.stack.length<2&&this.scriptEvaluationError(`OP_LEFT requires at least two items to be on the stack.`);let t=this.readScriptNumber(this.popStack()).toNumber();e=this.popStack();let n=e.length;(t<0||t>n)&&this.scriptEvaluationError(`OP_LEFT length (${t}) must be in range [0, ${n}]`),this.pushStack(e.slice(0,t))})();break;case k.OP_RIGHT:(()=>{this.stack.length<2&&this.scriptEvaluationError(`OP_RIGHT requires at least two items to be on the stack.`);let t=this.readScriptNumber(this.popStack()).toNumber();e=this.popStack();let n=e.length;(t<0||t>n)&&this.scriptEvaluationError(`OP_RIGHT length (${t}) must be in range [0, ${n}]`),this.pushStack(e.slice(n-t))})();break;case k.OP_LSHIFTNUM:(()=>{this.stack.length<2&&this.scriptEvaluationError(`OP_LSHIFTNUM requires at least two items to be on the stack.`);let e=this.readScriptNumber(this.popStack()).toBigInt();e<0&&this.scriptEvaluationError(`OP_LSHIFTNUM bits to shift must not be negative.`);let t=new p(this.readScriptNumber(this.popStack()).toBigInt()<<e);this.pushStack(t.toScriptNum())})();break;case k.OP_RSHIFTNUM:(()=>{this.stack.length<2&&this.scriptEvaluationError(`OP_RSHIFTNUM requires at least two items to be on the stack.`);let e=this.readScriptNumber(this.popStack()).toBigInt();e<0&&this.scriptEvaluationError(`OP_RSHIFTNUM bits to shift must not be negative.`);let t=this.readScriptNumber(this.popStack()).toBigInt(),n;n=t<0?new p(-(-t>>e)):new p(t>>e),this.pushStack(n.toScriptNum())})();break;case k.OP_1NEGATE:this.pushStackCopy(di);break;case k.OP_0:this.pushStackCopy(fi[0]);break;case k.OP_1:case k.OP_2:case k.OP_3:case k.OP_4:case k.OP_5:case k.OP_6:case k.OP_7:case k.OP_8:case k.OP_9:case k.OP_10:case k.OP_11:case k.OP_12:case k.OP_13:case k.OP_14:case k.OP_15:case k.OP_16:m=n-(k.OP_1-1),this.pushStackCopy(fi[m]);break;case k.OP_NOP:case k.OP_NOP1:case k.OP_CHECKLOCKTIMEVERIFY:break;case k.OP_CHECKSEQUENCEVERIFY:(()=>{if(this.hasFlag(`CHECKSEQUENCEVERIFY`)){this.stack.length<1&&this.scriptEvaluationError(`OP_CHECKSEQUENCEVERIFY requires at least one item to be on the stack.`);let e=0n;try{e=p.fromScriptNum(this.stackTop(),this.shouldEnforceMinimalData(),5).toBigInt()}catch{this.scriptEvaluationError(`OP_CHECKSEQUENCEVERIFY requires a minimally-encoded numeric lock time.`)}e<0n&&this.scriptEvaluationError(`OP_CHECKSEQUENCEVERIFY requires a non-negative lock time.`),Number(e&BigInt(ui))===0&&this.transactionVersion<2&&this.scriptEvaluationError(`OP_CHECKSEQUENCEVERIFY lock time is unsatisfied.`)}})();break;case k.OP_NOP9:case k.OP_NOP10:break;case k.OP_VERIF:case k.OP_VERNOTIF:(()=>{if(g=!1,r){if(this.stack.length<1&&this.scriptEvaluationError(`OP_VERIF and OP_VERNOTIF require at least one item on the stack when they are used!`),t=this.popStack(),t.length===4){let e=this.transactionVersion;i=[e&255,e>>>8&255,e>>>16&255,e>>>24&255],g=pi(t,i)}n===k.OP_VERNOTIF&&(g=!g)}this.ifStack.push(g),this.elseStack.push(!1)})();break;case k.OP_IF:case k.OP_NOTIF:g=!1,r&&(this.stack.length<1&&this.scriptEvaluationError(`OP_IF and OP_NOTIF require at least one item on the stack when they are used!`),e=this.popStack(),this.hasFlag(`MINIMALIF`)&&e.length>0&&(e.length!==1||e[0]!==1)&&this.scriptEvaluationError(`OP_IF and OP_NOTIF require minimal truth values.`),g=this.castToBool(e),n===k.OP_NOTIF&&(g=!g)),this.ifStack.push(g),this.elseStack.push(!1);break;case k.OP_ELSE:this.ifStack.length===0&&this.scriptEvaluationError(`OP_ELSE requires a preceeding OP_IF.`),this.hasExplicitFlags()&&this.isAfterGenesis()&&this.elseStack.at(-1)===!0&&this.scriptEvaluationError(`OP_ELSE may only be used once for each OP_IF or OP_NOTIF after Genesis.`),this.elseStack[this.elseStack.length-1]=!0,this.ifStack[this.ifStack.length-1]=this.ifStack.at(-1)!==!0;break;case k.OP_ENDIF:this.ifStack.length===0&&this.scriptEvaluationError(`OP_ENDIF requires a preceeding OP_IF.`),this.ifStack.pop(),this.elseStack.pop();break;case k.OP_VERIFY:this.stack.length<1&&this.scriptEvaluationError(`OP_VERIFY requires at least one item to be on the stack.`),t=this.stackTop(),g=this.castToBool(t),g||this.scriptEvaluationError(`OP_VERIFY requires the top stack value to be truthy.`),this.popStack();break;case k.OP_RETURN:this.hasExplicitFlags()&&!this.isAfterGenesis()&&this.scriptEvaluationError(`OP_RETURN is invalid before Genesis.`),this.ifStack.length>0?this.returningFromConditional=!0:(this.programCounter=this.context===`UnlockingScript`?this.unlockingScript.chunks.length:this.lockingScript.chunks.length,this.programCounter--);break;case k.OP_TOALTSTACK:this.requireStackItems(1,`OP_TOALTSTACK requires at oeast one item to be on the stack.`),this.pushAltStack(this.popStack());break;case k.OP_FROMALTSTACK:this.requireAltStackItems(1,`OP_FROMALTSTACK requires at least one item to be on the stack.`),this.pushStack(this.popAltStack());break;case k.OP_2DROP:this.requireStackItems(2,`OP_2DROP requires at least two items to be on the stack.`),this.popStack(),this.popStack();break;case k.OP_2DUP:this.requireStackItems(2,`OP_2DUP requires at least two items to be on the stack.`),t=this.stackTop(-2),i=this.stackTop(-1),this.pushStackCopy(t),this.pushStackCopy(i);break;case k.OP_3DUP:this.requireStackItems(3,`OP_3DUP requires at least three items to be on the stack.`),t=this.stackTop(-3),i=this.stackTop(-2),a=this.stackTop(-1),this.pushStackCopy(t),this.pushStackCopy(i),this.pushStackCopy(a);break;case k.OP_2OVER:this.requireStackItems(4,`OP_2OVER requires at least four items to be on the stack.`),t=this.stackTop(-4),i=this.stackTop(-3),this.pushStackCopy(t),this.pushStackCopy(i);break;case k.OP_2ROT:{this.requireStackItems(6,`OP_2ROT requires at least six items to be on the stack.`);let e=this.popStack(),t=this.popStack(),n=this.popStack(),r=this.popStack(),i=this.popStack(),a=this.popStack();this.pushStack(r),this.pushStack(n),this.pushStack(t),this.pushStack(e),this.pushStack(a),this.pushStack(i);break}case k.OP_2SWAP:{this.requireStackItems(4,`OP_2SWAP requires at least four items to be on the stack.`);let e=this.popStack(),t=this.popStack(),n=this.popStack(),r=this.popStack();this.pushStack(t),this.pushStack(e),this.pushStack(r),this.pushStack(n);break}case k.OP_IFDUP:this.requireStackItems(1,`OP_IFDUP requires at least one item to be on the stack.`),t=this.stackTop(),this.castToBool(t)&&this.pushStackCopy(t);break;case k.OP_DEPTH:this.pushStack(new p(this.stack.length).toScriptNum());break;case k.OP_DROP:this.requireStackItems(1,`OP_DROP requires at least one item to be on the stack.`),this.popStack();break;case k.OP_DUP:this.requireStackItems(1,`OP_DUP requires at least one item to be on the stack.`),this.pushStackCopy(this.stackTop());break;case k.OP_NIP:this.requireStackItems(2,`OP_NIP requires at least two items to be on the stack.`),i=this.popStack(),this.popStack(),this.pushStack(i);break;case k.OP_OVER:this.requireStackItems(2,`OP_OVER requires at least two items to be on the stack.`),this.pushStackCopy(this.stackTop(-2));break;case k.OP_PICK:case k.OP_ROLL:(()=>{this.requireStackItems(2,`${k[n]} requires at least two items to be on the stack.`),l=this.readScriptNumber(this.popStack());let e=l.toBigInt();(e<0n||e>=BigInt(this.stack.length))&&this.scriptEvaluationError(`${k[n]} requires the top stack element to be 0 or a positive number less than the current size of the stack.`);let t=Number(e),r=this.stack[this.stack.length-1-t];n===k.OP_ROLL?(this.stack.splice(this.stack.length-1-t,1),this.stackMem-=r.length,this.pushStack(r)):this.pushStackCopy(r)})();break;case k.OP_ROT:this.requireStackItems(3,`OP_ROT requires at least three items to be on the stack.`),c=this.popStack(),s=this.popStack(),o=this.popStack(),this.pushStack(s),this.pushStack(c),this.pushStack(o);break;case k.OP_SWAP:this.requireStackItems(2,`OP_SWAP requires at least two items to be on the stack.`),s=this.popStack(),o=this.popStack(),this.pushStack(s),this.pushStack(o);break;case k.OP_TUCK:this.requireStackItems(2,`OP_TUCK requires at least two items to be on the stack.`),t=this.stackTop(-1),this.ensureStackMem(t.length),this.stack.splice(-2,0,t.slice()),this.stackMem+=t.length;break;case k.OP_SIZE:this.requireStackItems(1,`OP_SIZE requires at least one item to be on the stack.`),this.pushStack(new p(this.stackTop().length).toScriptNum());break;case k.OP_AND:case k.OP_OR:case k.OP_XOR:(()=>{this.requireStackItems(2,`${k[n]} requires at least two items on the stack.`),i=this.popStack(),t=this.popStack(),t.length!==i.length&&this.scriptEvaluationError(`${k[n]} requires the top two stack items to be the same size.`);let e=Array.from({length:t.length},()=>0);for(let r=0;r<t.length;r++)n===k.OP_AND?e[r]=t[r]&i[r]:n===k.OP_OR?e[r]=t[r]|i[r]:e[r]=t[r]^i[r];this.pushStack(e)})();break;case k.OP_INVERT:(()=>{this.requireStackItems(1,`OP_INVERT requires at least one item to be on the stack.`),e=this.popStack();let t=Array.from({length:e.length},()=>0);for(let n=0;n<e.length;n++)t[n]=~e[n]&255;this.pushStack(t)})();break;case k.OP_LSHIFT:case k.OP_RSHIFT:(()=>{this.requireStackItems(2,`${k[n]} requires at least two items to be on the stack.`),d=this.readScriptNumber(this.popStack()),t=this.popStack();let e=d.toBigInt();if(e<0n&&this.scriptEvaluationError(`${k[n]} requires the top item on the stack not to be negative.`),t.length===0){this.pushStack([]);return}u=new p(t);let r;if(n===k.OP_LSHIFT){r=u.ushln(e);let n=new p(1).ushln(t.length*8).isubn(1);r=r.iand(n)}else r=u.ushrn(e);let i=r.toArray(`be`,t.length);this.pushStack(i)})();break;case k.OP_EQUAL:case k.OP_EQUALVERIFY:this.requireStackItems(2,`${k[n]} requires at least two items to be on the stack.`),i=this.popStack(),t=this.popStack(),g=pi(t,i),this.pushStack(g?[1]:[]),n===k.OP_EQUALVERIFY&&(g||this.scriptEvaluationError(`OP_EQUALVERIFY requires the top two stack items to be equal.`),this.popStack());break;case k.OP_1ADD:case k.OP_1SUB:case k.OP_2MUL:case k.OP_2DIV:case k.OP_NEGATE:case k.OP_ABS:case k.OP_NOT:case k.OP_0NOTEQUAL:(()=>{switch(this.requireStackItems(1,`${k[n]} requires at least one item to be on the stack.`),l=this.readScriptNumber(this.popStack()),n){case k.OP_1ADD:l=l.add(new p(1));break;case k.OP_1SUB:l=l.sub(new p(1));break;case k.OP_2MUL:l=l.mul(new p(2));break;case k.OP_2DIV:l=l.div(new p(2));break;case k.OP_NEGATE:l=l.neg();break;case k.OP_ABS:l.isNeg()&&(l=l.neg());break;case k.OP_NOT:l=new p(+(l.cmpn(0)===0));break;case k.OP_0NOTEQUAL:l=new p(l.cmpn(0)===0?0:1)}this.pushStack(l.toScriptNum())})();break;case k.OP_ADD:case k.OP_SUB:case k.OP_MUL:case k.OP_DIV:case k.OP_MOD:case k.OP_BOOLAND:case k.OP_BOOLOR:case k.OP_NUMEQUAL:case k.OP_NUMEQUALVERIFY:case k.OP_NUMNOTEQUAL:case k.OP_LESSTHAN:case k.OP_GREATERTHAN:case k.OP_LESSTHANOREQUAL:case k.OP_GREATERTHANOREQUAL:case k.OP_MIN:case k.OP_MAX:(()=>{this.requireStackItems(2,`${k[n]} requires at least two items to be on the stack.`),i=this.popStack(),t=this.popStack(),d=this.readScriptNumber(i),u=this.readScriptNumber(t);let e=(()=>{switch(n){case k.OP_MUL:return u.byteLength()+d.byteLength();case k.OP_ADD:case k.OP_SUB:return Math.max(u.byteLength(),d.byteLength())+1;default:return Math.max(u.byteLength(),d.byteLength())}})();this.ensureStackMem(e);let r=(()=>{switch(n){case k.OP_ADD:return u.add(d);case k.OP_SUB:return u.sub(d);case k.OP_MUL:return u.mul(d);case k.OP_DIV:return d.cmpn(0)===0&&this.scriptEvaluationError(`OP_DIV cannot divide by zero!`),u.div(d);case k.OP_MOD:return d.cmpn(0)===0&&this.scriptEvaluationError(`OP_MOD cannot divide by zero!`),u.mod(d);case k.OP_BOOLAND:return hi(u.cmpn(0)!==0,d.cmpn(0)!==0);case k.OP_BOOLOR:return gi(u.cmpn(0)!==0,d.cmpn(0)!==0);case k.OP_NUMEQUAL:case k.OP_NUMEQUALVERIFY:return mi(u.cmp(d)===0);case k.OP_NUMNOTEQUAL:return mi(u.cmp(d)!==0);case k.OP_LESSTHAN:return mi(u.cmp(d)<0);case k.OP_GREATERTHAN:return mi(u.cmp(d)>0);case k.OP_LESSTHANOREQUAL:return mi(u.cmp(d)<=0);case k.OP_GREATERTHANOREQUAL:return mi(u.cmp(d)>=0);case k.OP_MIN:return _i(u,d);case k.OP_MAX:return vi(u,d);default:return new p(0)}})();this.pushStack(r.toScriptNum()),n===k.OP_NUMEQUALVERIFY&&(this.castToBool(this.stackTop())||this.scriptEvaluationError(`OP_NUMEQUALVERIFY requires the top stack item to be truthy.`),this.popStack())})();break;case k.OP_WITHIN:this.requireStackItems(3,`OP_WITHIN requires at least three items to be on the stack.`),f=this.readScriptNumber(this.popStack()),d=this.readScriptNumber(this.popStack()),u=this.readScriptNumber(this.popStack()),g=u.cmp(d)>=0&&u.cmp(f)<0,this.pushStack(g?[1]:[]);break;case k.OP_RIPEMD160:case k.OP_SHA1:case k.OP_SHA256:case k.OP_HASH160:case k.OP_HASH256:(()=>{this.requireStackItems(1,`${k[n]} requires at least one item to be on the stack.`),e=this.popStack();let t=[];n===k.OP_RIPEMD160?t=Ye(e):n===k.OP_SHA1?t=Xe(e):n===k.OP_SHA256?t=Ze(e):n===k.OP_HASH160?t=$e(e):n===k.OP_HASH256&&(t=Qe(e)),this.pushStack(t)})();break;case k.OP_CODESEPARATOR:this.lastCodeSeparator=this.programCounter;break;case k.OP_CHECKSIG:case k.OP_CHECKSIGVERIFY:this.requireStackItems(2,`${k[n]} requires at least two items to be on the stack.`),b=this.popStack(),y=this.popStack(),(!this.checkSignatureEncoding(y)||!this.checkPublicKeyEncoding(b))&&this.scriptEvaluationError(`${k[n]} requires correct encoding for the public key and signature.`),_=(()=>{if(y.length===0)return!1;try{ee=this.parseChecksigSignature(y);let e=(this.context===`UnlockingScript`?this.unlockingScript:this.lockingScript).chunks.slice(this.lastCodeSeparator===null?0:this.lastCodeSeparator+1);return this.context===`UnlockingScript`&&(e=e.concat(this.lockingScript.chunks)),v=new Pr(e),v.findAndDelete(new Pr().writeBin(y)),te=lr.fromDER(b),this.verifySignature(ee,te,v)}catch{return!1}})(),!_&&this.hasFlag(`NULLFAIL`)&&y.length>0&&this.scriptEvaluationError(`${k[n]} requires failing signatures to be empty.`),this.pushStack(_?[1]:[]),n===k.OP_CHECKSIGVERIFY&&(_||this.scriptEvaluationError(`OP_CHECKSIGVERIFY requires that a valid signature is provided.`),this.popStack());break;case k.OP_CHECKMULTISIG:case k.OP_CHECKMULTISIGVERIFY:(()=>{x=1,this.stack.length<x&&this.scriptEvaluationError(`${k[n]} requires at least 1 item for nKeys.`);let e=this.readScriptNumber(this.stackTop(-x)).toBigInt(),t=this.hasExplicitFlags()&&!this.isAfterGenesis()?BigInt(li):ci;(e<0n||e>t)&&this.scriptEvaluationError(`${k[n]} requires a key count between 0 and ${t.toString()}.`),re=Number(e);let r=re;ne=++x,x+=re,this.stack.length<x&&this.scriptEvaluationError(`${k[n]} stack too small for nKeys and keys. Need ${x}, have ${this.stack.length}.`);let i=this.readScriptNumber(this.stackTop(-x)).toBigInt();(i<0n||i>BigInt(re))&&this.scriptEvaluationError(`${k[n]} requires the number of signatures to be no greater than the number of keys.`),C=Number(i);let a=C;S=++x,x+=C,this.stack.length<x&&this.scriptEvaluationError(`${k[n]} stack too small for N, keys, M, sigs, and dummy. Need ${x}, have ${this.stack.length}.`),v=new Pr((this.context===`UnlockingScript`?this.unlockingScript:this.lockingScript).chunks.slice(this.lastCodeSeparator===null?0:this.lastCodeSeparator+1));let o=!1;for(let e=0;e<C;e++)y=this.stackTop(-S-e),y.length>0&&(o=!0),v.findAndDelete(new Pr().writeBin(y));(()=>{for(_=!0;_&&C>0;){if(re===0){_=!1;break}if(y=this.stackTop(-S),b=this.stackTop(-ne),(!this.checkSignatureEncoding(y)||!this.checkPublicKeyEncoding(b))&&this.scriptEvaluationError(`${k[n]} requires correct encoding for the public key and signature.`),ie=!1,y.length>0)try{ee=this.parseChecksigSignature(y),te=lr.fromDER(b),ie=this.verifySignature(ee,te,v)}catch{ie=!1}ie&&(S++,C--),ne++,re--,C>re&&(_=!1)}})(),(()=>{!_&&this.hasFlag(`NULLFAIL`)&&o&&this.scriptEvaluationError(`${k[n]} requires failing signatures to be empty.`);let e=1+r+1+a+1-1;for(;e>0;)this.popStack(),e--;this.requireStackItems(1,`${k[n]} requires an extra item (dummy) to be on the stack.`);let t=this.popStack();this.shouldEnforceNullDummy()&&t.length>0&&this.scriptEvaluationError(`${k[n]} requires the extra stack item (dummy) to be empty.`),this.pushStack(_?[1]:[]),n===k.OP_CHECKMULTISIGVERIFY&&(_||this.scriptEvaluationError(`OP_CHECKMULTISIGVERIFY requires that a sufficient number of valid signatures are provided.`),this.popStack())})()})();break;case k.OP_CAT:(()=>{this.requireStackItems(2,`OP_CAT requires at least two items to be on the stack.`),i=this.popStack(),t=this.popStack();let e=t.concat(i);e.length>this.maxPushSize()&&this.scriptEvaluationError(`It's not currently possible to push data larger than ${this.maxPushSize()} bytes.`),this.pushStack(e)})();break;case k.OP_SPLIT:(()=>{this.requireStackItems(2,`OP_SPLIT requires at least two items to be on the stack.`);let e=this.popStack(),t=this.popStack(),n=this.readScriptNumber(e).toBigInt();(n<0n||n>BigInt(t.length))&&this.scriptEvaluationError(`OP_SPLIT requires the first stack item to be a non-negative number less than or equal to the size of the second-from-top stack item.`);let r=Number(n);this.pushStack(t.slice(0,r)),this.pushStack(t.slice(r))})();break;case k.OP_NUM2BIN:(()=>{this.requireStackItems(2,`OP_NUM2BIN requires at least two items to be on the stack.`);let e=this.readScriptNumber(this.popStack()).toBigInt(),t=this.maxPushSize();if((Number.isFinite(t)&&e>BigInt(t)||e<0n)&&this.scriptEvaluationError(`It's not currently possible to push data larger than ${t} bytes or negative size.`),e>oi)throw new ei(`element-size`,oi,e);h=Number(e);let n=this.popStack();if(n=yn(n),n.length>h&&this.scriptEvaluationError(`OP_NUM2BIN requires that the size expressed in the top stack item is large enough to hold the value expressed in the second-from-top stack item.`),n.length===h){this.pushStack(n);return}let r=Array.from({length:h},()=>0),i=0;n.length>0&&(i=n.at(-1)&128,n[n.length-1]&=127);for(let e=0;e<n.length;e++)r[e]=n[e];i!==0&&(r[h-1]|=128),this.pushStack(r)})();break;case k.OP_BIN2NUM:(()=>{this.requireStackItems(1,`OP_BIN2NUM requires at least one item to be on the stack.`),t=this.popStack();let e=yn(t);yi(e)||this.scriptEvaluationError(`OP_BIN2NUM requires that the resulting number is valid.`),this.pushStack(e)})();break;default:this.scriptEvaluationError(`Invalid opcode ${n} (pc=${this.programCounter}).`)}}return this.advanceAfterStep(e),!0}validate(e){let t=ni();return t?.verifySpendSync!==void 0&&(t.isReady?.()??!0)&&(e===void 0?t.shouldVerifySpend?.(this):t.shouldVerifySpend?.(this,e))!==!1?((e===void 0?t.verifySpendSync(this):t.verifySpendSync(this,e))||this.scriptEvaluationError(`The selected script-verification backend rejected the spend.`),!0):this.validateJavaScript()}validateJavaScript(){this.reset(),this.shouldEnforceSigPushOnly()&&!this.unlockingScript.isPushOnly()&&this.scriptEvaluationError(`Unlocking scripts can only contain push operations, and no other opcodes.`);let e=this.lockingScript,t=this.hasFlag(`P2SH`)&&!this.isAfterGenesis()&&this.isP2SHLockingScript(this.lockingScript);t&&!this.unlockingScript.isPushOnly()&&this.scriptEvaluationError(`P2SH unlocking scripts can only contain push operations.`),this.runScript(`UnlockingScript`);let n=this.stack.map(e=>e.slice());this.runScript(`LockingScript`),this.requireTruthyTopStack();try{if(t){n.length===0&&this.scriptEvaluationError(`P2SH evaluation requires a redeem script on the stack.`);let e=n.pop();if(e===void 0)return this.scriptEvaluationError(`P2SH evaluation requires a redeem script on the stack.`),!1;this.setStack(n);let t=Pr.fromBinary(e);this.lockingScript=new Xr(t.chunks),this.runScript(`LockingScript`)}}finally{this.lockingScript=e}return this.shouldEnforceCleanStack()&&this.stack.length!==1&&this.scriptEvaluationError(`The clean stack rule requires exactly one item to be on the stack after script execution, found ${this.stack.length}.`),this.requireTruthyTopStack(),!0}async validateWith(e,t){return(t===void 0?e.shouldVerifySpend?.(this):e.shouldVerifySpend?.(this,t))===!1?this.validateJavaScript():t===void 0?await e.verifySpend(this):await e.verifySpend(this,t)}toTransactionUint8Array(){let e={sourceTXID:this.sourceTXID,sourceOutputIndex:this.sourceOutputIndex,unlockingScript:this.unlockingScript,sequence:this.inputSequence},t=this.allInputs??[...this.otherInputs.slice(0,this.inputIndex),e,...this.otherInputs.slice(this.inputIndex)];if(this.inputIndex<0||this.inputIndex>=t.length)throw RangeError(`Spend input index is out of range`);let n=new Jt;n.writeUInt32LE(this.transactionVersion),n.writeVarIntNum(t.length);for(let r=0;r<t.length;r++){let i=r===this.inputIndex?e:t[r],a=i.sourceTXID??i.sourceTransaction?.id(`hex`);if(a===void 0)throw Error(`Input ${r} is missing its source transaction ID`);if(i.unlockingScript===void 0)throw Error(`Input ${r} is missing its unlocking script`);n.writeReverse(tn(a,`hex`)),n.writeUInt32LE(i.sourceOutputIndex);let o=i.unlockingScript.toUint8Array();n.writeVarIntNum(o.length),n.write(o),n.writeUInt32LE(i.sequence??4294967295)}n.writeVarIntNum(this.outputs.length);for(let e of this.outputs){n.writeUInt64LE(e.satoshis??0);let t=e.lockingScript.toUint8Array();n.writeVarIntNum(t.length),n.write(t)}return n.writeUInt32LE(this.lockTime),n.toUint8Array()}runScript(e){this.context=e,this.programCounter=0,this.ifStack=[],this.elseStack=[],this.returningFromConditional=!1,this.clearAltStack(),this.lastCodeSeparator=null;let t=e===`UnlockingScript`?this.unlockingScript:this.lockingScript;for(this.hasExplicitFlags()&&!this.isAfterGenesis()&&t.toUint8Array().length>ii&&this.scriptEvaluationError(`Script size exceeds ${ii} bytes.`);this.programCounter<t.chunks.length;)this.step();this.ifStack.length>0&&this.scriptEvaluationError(`Every OP_IF, OP_NOTIF, or OP_ELSE must be terminated with OP_ENDIF prior to the end of the script.`),this.ifStack=[],this.elseStack=[],this.clearAltStack(),this.lastCodeSeparator=null}isP2SHLockingScript(e){let t=e.chunks;return t.length===3&&t[0].op===k.OP_HASH160&&t[1].op===20&&Array.isArray(t[1].data)&&t[1].data.length===20&&t[2].op===k.OP_EQUAL}requireTruthyTopStack(){this.stack.length===0?this.scriptEvaluationError(`The top stack element must be truthy after script evaluation (stack is empty).`):this.castToBool(this.stackTop())||this.scriptEvaluationError(`The top stack element must be truthy after script evaluation.`)}castToBool(e){if(e.length===0)return!1;for(let t=0;t<e.length;t++)if(e[t]!==0)return t!==e.length-1||e[t]!==128;return!1}scriptEvaluationError(e){throw new $r({message:e,txid:this.sourceTXID,outputIndex:this.sourceOutputIndex,context:this.context,programCounter:this.programCounter,stackState:this.stack,altStackState:this.altStack,ifStackState:this.ifStack,stackMem:this.stackMem,altStackMem:this.altStackMem})}};function Ci(e,t){let n=Kr.SIGHASH_FORKID;return e===`all`&&(n|=Kr.SIGHASH_ALL),e===`none`&&(n|=Kr.SIGHASH_NONE),e===`single`&&(n|=Kr.SIGHASH_SINGLE),t&&(n|=Kr.SIGHASH_ANYONECANPAY),n}function wi(e,t,n,r){let i=e.inputs[t],a=i.sourceTXID??i.sourceTransaction?.id(`hex`);if(a==null||a===void 0||a===``)throw Error(`The input sourceTXID or sourceTransaction is required for transaction signing.`);let o=n??i.sourceTransaction?.outputs[i.sourceOutputIndex].satoshis;if(o==null||o===void 0)throw Error(`The sourceSatoshis or input sourceTransaction is required for transaction signing.`);let s=r??i.sourceTransaction?.outputs[i.sourceOutputIndex].lockingScript;if(s==null)throw Error(`The lockingScript or input sourceTransaction is required for transaction signing.`);return{sourceTXID:a,sourceSatoshis:o,lockingScript:s,allInputs:e.inputs,get otherInputs(){return e.inputs.filter((e,n)=>n!==t)}}}function Ti(e){let{tx:t,inputIndex:n,signatureScope:r,sourceTXID:i,sourceSatoshis:a,lockingScript:o,otherInputs:s,allInputs:c,inputSequence:l}=e,u=t.inputs[n];return Kr.format({sourceTXID:i,sourceOutputIndex:Sn(u.sourceOutputIndex,`input.sourceOutputIndex must have value`),sourceSatoshis:a,transactionVersion:t.version,otherInputs:s??[],allInputs:c,inputIndex:n,outputs:t.outputs,inputSequence:l??Sn(u.sequence,`input.sequence must have value`),subscript:o,lockTime:t.lockTime,scope:r,cache:t.getSignatureHashCache()})}var Ei=class{lock(e){let t;if(typeof e==`string`){let n=gn(e);if(n.prefix[0]!==0&&n.prefix[0]!==111)throw Error(`only P2PKH is supported`);t=n.data}else t=e;if(t.length!==20)throw Error(`P2PKH hash length must be 20 bytes`);return new Xr([{op:k.OP_DUP},{op:k.OP_HASH160},{op:t.length,data:t},{op:k.OP_EQUALVERIFY},{op:k.OP_CHECKSIG}])}unlock(e,t=`all`,n=!1,r,i){return{sign:async(a,o)=>{let s=Ci(t,n),c=wi(a,o,r,i);r=c.sourceSatoshis,i=c.lockingScript;let l=Ze(Ti({tx:a,inputIndex:o,signatureScope:s,sourceTXID:c.sourceTXID,sourceSatoshis:c.sourceSatoshis,lockingScript:c.lockingScript,allInputs:c.allInputs})),u=Yr(`signDigest`),d=Yr(`publicKeyFromPrivate`),f=u===void 0&&d===void 0?void 0:Uint8Array.from(e.toArray(`be`,32)),p=u===void 0?e.sign(l):ur.fromDER(Array.from(qr(`signDigest`,await u.signDigest(f,Uint8Array.from(Ze(l)))))),m=new Kr(p.r,p.s,s).toChecksigFormat(),h=d===void 0?e.toPublicKey().encode(!0):Array.from(Di(await d.publicKeyFromPrivate(f)));return new Zr([{op:m.length,data:m},{op:h.length,data:h}])},estimateLength:async()=>108}}};function Di(e){let t=qr(`publicKeyFromPrivate`,e,33);if(t[0]!==2&&t[0]!==3)throw Error(`publicKeyFromPrivate returned an invalid compressed public key`);return t}var Oi=class{value;constructor(e){this.value=e}async computeFee(e){let t=e=>e>2**32?9:e>2**16?5:e>253?3:1,n=4;n+=t(e.inputs.length);for(let r=0;r<e.inputs.length;r++){let i=e.inputs[r];n+=40;let a;if(typeof i.unlockingScript==`object`)a=i.unlockingScript.toBinary().length;else if(typeof i.unlockingScriptTemplate==`object`)a=await i.unlockingScriptTemplate.estimateLength(e,r);else throw TypeError(`All inputs must have an unlocking script or an unlocking script template for sat/kb fee computation.`);n+=t(a),n+=a}n+=t(e.outputs.length);for(let r of e.outputs){n+=8;let e=r.lockingScript.toBinary().length;n+=t(e),n+=e}return n+=4,Math.ceil(n/1e3*this.value)}},ki=class e extends Oi{static ARC_POLICY_URL=`https://arc.gorillapool.io/v1/policy`;static instance=null;cachedRate=null;cacheTimestamp=0;cacheValidityMs;constructor(e=3e5){super(100),this.cacheValidityMs=e}static getInstance(t=3e5){return e.instance??=new e(t),e.instance}async fetchFeeRate(){let t=Date.now();if(this.cachedRate!==null&&t-this.cacheTimestamp<this.cacheValidityMs)return this.cachedRate;try{let n=await fetch(e.ARC_POLICY_URL);if(!n.ok)throw Error(`HTTP ${n.status}: ${n.statusText}`);let r=await n.json();if(!r.policy?.miningFee||typeof r.policy.miningFee.satoshis!=`number`||typeof r.policy.miningFee.bytes!=`number`)throw Error(`Invalid policy response format`);let i=r.policy.miningFee.satoshis/r.policy.miningFee.bytes*1e3;return this.cachedRate=i,this.cacheTimestamp=t,i}catch(e){return this.cachedRate===null?(console.warn(`Failed to fetch live fee rate, using default 100 sat/kb:`,e),100):(console.warn(`Failed to fetch live fee rate, using cached value:`,e),this.cachedRate)}}async computeFee(e){let t=await this.fetchFeeRate();return this.value=t,super.computeFee(e)}};function Ai(e,t,n,r){return new Promise((i,a)=>{let o=e.request(t,n,e=>{let t=``;e.on(`data`,e=>{t+=e}),e.on(`end`,()=>{let n=e.statusCode>=200&&e.statusCode<=299,r=e.headers[`content-type`],a=t!==``&&typeof r==`string`&&r.startsWith(`application/json`)?JSON.parse(t):t;i({status:e.statusCode,statusText:e.statusMessage,ok:n,data:a})})});o.on(`error`,e=>{a(e)}),n.data!==null&&n.data!==void 0&&o.write(r(n.data)),o.end()})}var ji=class{https;constructor(e){this.https=e}async request(e,t){return await Ai(this.https,e,t,e=>JSON.stringify(e))}},Mi=class{fetch;constructor(e){this.fetch=e}async request(e,t){let n={method:t.method,headers:t.headers,body:JSON.stringify(t.data)},r=await this.fetch(e,n),i=r.headers.get(`Content-Type`)?.startsWith(`application/json`)??!1?await r.json():await r.text();return{ok:r.ok,status:r.status,statusText:r.statusText,data:i}}};function Ni(){let e={async request(...e){throw Error(`No method available to perform HTTP request`)}};if(globalThis.window!==void 0&&typeof globalThis.window.fetch==`function`)return new Mi(globalThis.window.fetch.bind(globalThis.window));if(typeof globalThis.fetch==`function`)return new Mi(globalThis.fetch.bind(globalThis));let n=typeof t==`function`?t:void 0;if(n===void 0)return e;try{return new ji(n([`node`,`https`].join(`:`)))}catch{return e}}function Pi(){return`ts-sdk-${E(Tr(16))}`}var Fi=new Set([`DOUBLE_SPEND_ATTEMPTED`,`REJECTED`,`INVALID`,`MALFORMED`,`MINED_IN_STALE_BLOCK`]);function Ii(e){try{return e.toHexEF()}catch(t){if(t.message===`All inputs must have source transactions when serializing to EF format`)return e.toHex();throw t}}function Li(e){let{txid:t,extraInfo:n,txStatus:r,competingTxs:i}=e,a=r?.toUpperCase(),o=n?.toUpperCase().includes(`ORPHAN`)||a?.includes(`ORPHAN`);if(Fi.has(a)||o){let e={status:`error`,code:r??`UNKNOWN`,txid:t,description:`${r??``} ${n??``}`.trim()};return i!=null&&(e.more={competingTxs:i}),e}let s={status:`success`,txid:t,message:`${r} ${n}`};return i!=null&&(s.competingTxs=i),s}function Ri(e){if(typeof e!=`string`)return e;try{return JSON.parse(e)}catch{return e}}function zi(e,t){let n={status:`error`,code:typeof e==`number`||typeof e==`string`?e.toString():`ERR_UNKNOWN`,description:`Unknown error`},r=Ri(t);return typeof r!=`object`||!r?n:(n.more=r,`txid`in r&&typeof r.txid==`string`&&(n.txid=r.txid),`detail`in r&&typeof r.detail==`string`&&(n.description=r.detail),n)}function Bi(e){return{status:`error`,code:`500`,description:typeof e==`object`&&e&&`message`in e&&typeof e.message==`string`?e.message:`Internal Server Error`}}var Vi=class{URL;apiKey;deploymentId;callbackUrl;callbackToken;headers;httpClient;constructor(e,t){if(this.URL=e,typeof t==`string`)this.apiKey=t,this.httpClient=Ni(),this.deploymentId=Pi(),this.callbackToken=void 0,this.callbackUrl=void 0;else{let{apiKey:e,deploymentId:n,httpClient:r,callbackToken:i,callbackUrl:a,headers:o}=t??{};this.apiKey=e,this.httpClient=r??Ni(),this.deploymentId=n??Pi(),this.callbackToken=i,this.callbackUrl=a,this.headers=o}}requestHeaders(){let e={"Content-Type":`application/json`,"XDeployment-ID":this.deploymentId};if(this.apiKey!=null&&this.apiKey!==``&&(e.Authorization=`Bearer ${this.apiKey}`),this.callbackUrl!=null&&this.callbackUrl!==``&&(e[`X-CallbackUrl`]=this.callbackUrl),this.callbackToken!=null&&this.callbackToken!==``&&(e[`X-CallbackToken`]=this.callbackToken),this.headers!=null)for(let t in this.headers)e[t]=this.headers[t];return e}async broadcast(e){let t={method:`POST`,headers:this.requestHeaders(),data:{rawTx:Ii(e)}};try{let e=await this.httpClient.request(`${this.URL}/v1/tx`,t);return e.ok?Li(e.data):zi(e.status,e.data)}catch(e){return Bi(e)}}async broadcastMany(e){let t=e.map(e=>({rawTx:Ii(e)})),n={method:`POST`,headers:this.requestHeaders(),data:t};try{return(await this.httpClient.request(`${this.URL}/v1/txs`,n)).data}catch(t){let n=Bi(t);return e.map(()=>n)}}};function Hi(e=!1,t={}){return new Vi(e?`https://testnet.arc.gorillapool.io`:`https://arc.gorillapool.io`,t)}var Ui=class{network;apiKey;URL;httpClient;constructor(e=`main`,t={}){let{apiKey:n,httpClient:r}=t;this.network=e,this.URL=`https://api.whatsonchain.com/v1/bsv/${e}`,this.httpClient=r??Ni(),this.apiKey=n??``}async isValidRootForHeight(e,t){let n={method:`GET`,headers:this.getHttpHeaders()},r=await this.httpClient.request(`${this.URL}/block/${t}/header`,n);if(r.ok){let{merkleroot:t}=r.data;return t===e}if(r.status===404)return!1;throw Error(`Failed to verify merkleroot for height ${t} because of an error: ${JSON.stringify(r.data)} `)}async currentHeight(){try{let e={method:`GET`,headers:this.getHttpHeaders()},t=await this.httpClient.request(`${this.URL}/block/headers`,e);if(t.ok)return t.data[0].height;throw Error(`Failed to get current height because of an error: ${JSON.stringify(t.data)} `)}catch(e){throw Error(`Failed to get current height because of an error: ${e instanceof Error?e.message:String(e)}`)}}getHttpHeaders(){let e={Accept:`application/json`};return typeof this.apiKey==`string`&&this.apiKey.trim()!==``&&(e.Authorization=this.apiKey),e}};function Wi(){return new Ui}function Gi(e,t){return E(Qe(tn((e??``)+(t??``),`hex`).reverse()).reverse())}function Ki(e,t,n,r){let i=r.get(e);if(i==null)return;if(i!==t)throw Error(`Mismatched roots`);let a=r.get(`${n}:0`);if(a==null)throw Error(`Mismatched roots`);return a}function qi(e,t,n,r,i,a){if(t==null){if(a)return Gi(e,e);throw Error(`Missing hash for index ${r} at height ${i}`)}return t.duplicate===!0?Gi(e,e):n%2==1?Gi(t.hash,e):Gi(e,t.hash)}var Ji=class e{blockHeight;path;static fromHex(t){return e.fromBinary(tn(t,`hex`))}static fromReader(t,n=!0,r=!0){let i=t.readVarIntNum(),a=t.readUInt8(),o=Array.from({length:a}).fill(null).map(()=>[]),s,c,l;for(let e=0;e<a;e++){for(l=t.readVarIntNum();l>0;){c=t.readVarIntNum(),s=t.readUInt8();let n={offset:c};(s&1)==1?n.duplicate=!0:(s&2&&(n.txid=!0),n.hash=E(t.read(32).reverse())),(!Array.isArray(o[e])||o[e].length===0)&&(o[e]=[]),o[e].push(n),l--}o[e].sort((e,t)=>e.offset-t.offset)}return new e(i,o,n,r)}static fromBinary(t,n=!0,r=!0){let i=new Yt(t);return e.fromReader(i,n,r)}static fromCoinbaseTxidAndHeight(t,n){return new e(n,[[{offset:0,hash:t,txid:!0}]])}constructor(e,t,n=!0,r=!0){this.blockHeight=e,this.path=t;let i=Array.from({length:this.path.length}).fill(0).map(()=>new Set);if(this.path.forEach((e,t)=>{if(e.length===0&&t===0)throw Error(`Empty level at height: ${t}`);let r=new Set;e.forEach(e=>{if(r.has(e.offset))throw Error(`Duplicate offset: ${e.offset}, at height: ${t}`);if(r.add(e.offset),t===0){if(e.duplicate!==!0)for(let t=1;t<this.path.length;t++)i[t].add(e.offset>>t^1)}else if(n&&!i[t].has(e.offset))throw Error(`Invalid offset: ${e.offset}, at height: ${t}, with legal offsets: ${Array.from(i[t],e=>e.toString()).join(`, `)}`)})}),!r)return;let a=this.path.map(e=>new Map(e.map(e=>[e.offset,e]))),o=new Map,s=new Map,c=this.path[0].reduce((e,t)=>Math.max(e,t.offset),0),l;this.path[0].forEach((e,t)=>{let n=this.computeRootCached(e.hash,a,o,s,c);if(t===0&&(l=n),l!==n)throw Error(`Mismatched roots`)})}toWriter(e){e.writeVarIntNum(this.blockHeight);let t=this.path.length;e.writeUInt8(t);for(let n=0;n<t;n++){let t=Object.keys(this.path[n]).length;e.writeVarIntNum(t);for(let t of this.path[n]){e.writeVarIntNum(t.offset);let n=0;t?.duplicate===!0&&(n|=1),t?.txid!==void 0&&t.txid!==null&&(n|=2),e.writeUInt8(n),n&1||e.write(tn(t.hash,`hex`).reverse())}}}toBinary(){let e=new _n;return this.toWriter(e),e.toArray()}toBinaryUint8Array(){let e=new Jt;return this.toWriter(e),e.toUint8Array()}toHex(){return E(this.toBinaryUint8Array())}indexOf(e){let t=this.path[0].find(t=>t.hash===e);if(t==null)throw Error(`Transaction ID ${e} not found in the Merkle Path`);return t.offset}computeRootCached(e,t,n,r,i){if(typeof e!=`string`&&(e=this.path[0].find(e=>!!e.hash)?.hash),typeof e!=`string`)throw TypeError(`Transaction ID is undefined`);let a=this.indexOf(e);if(this.path.length===1&&this.path[0].length===1)return e;let o=Math.max(this.path.length,32-Math.clz32(i)),s=e;for(let e=0;e<o;e++){let c=`${e}:${a>>e}`,l=Ki(c,s,o,r);if(l!=null)return l;r.set(c,s);let u=a>>e^1,d=this.cachedFindLeaf(e,u,t,n,i);s=qi(s,d,u,a,e,this.path.length===1&&a>>e===i>>e)}return r.set(`${o}:0`,s),s}nextRootHash(e,t,n,r){let i=t>>n^1,a=this.findOrComputeLeaf(n,i);if(a==null){if(this.path.length===1&&t>>n===r>>n)return Gi(e,e);throw Error(`Missing hash for index ${t} at height ${n}`)}return a.duplicate===!0?Gi(e,e):i%2==1?Gi(a.hash,e):Gi(e,a.hash)}computeRoot(e){if(typeof e!=`string`){let t=this.path[0].find(e=>!!e?.hash);if(t==null)throw Error(`No valid leaf found in the Merkle Path`);e=t.hash}if(typeof e!=`string`)throw TypeError(`Transaction ID is undefined`);let t=this.indexOf(e),n=e;if(this.path.length===1&&this.path[0].length===1)return n;let r=this.path[0].reduce((e,t)=>Math.max(e,t.offset),0),i=Math.max(this.path.length,32-Math.clz32(r));for(let e=0;e<i;e++)n=this.nextRootHash(n,t,e,r);return n}findOrComputeLeaf(e,t){let n=e=>E(Qe(tn(e,`hex`).reverse()).reverse()),r=e<this.path.length?this.path[e].find(e=>e.offset===t):void 0;if(r!=null)return r;if(e===0)return;let i=e-1,a=t<<1,o=this.findOrComputeLeaf(i,a);if(o?.hash==null||o.hash===``)return;let s=this.findOrComputeLeaf(i,a+1);if(s?.hash==null)return s?.duplicate===!0||this.path.length===1&&a===this.path[0].reduce((e,t)=>Math.max(e,t.offset),0)>>i?{offset:t,hash:n(o.hash+o.hash)}:void 0;let c;return c=s.duplicate===!0?n(o.hash+o.hash):n((s.hash??``)+(o.hash??``)),r={offset:t,hash:c},r}async verify(e,t){let n=this.computeRoot(e);if(this.indexOf(e)===0){let e=await t.currentHeight();if(this.blockHeight+100>e)return!1}return await t.isValidRootForHeight(n,this.blockHeight)}combine(e){if(this.blockHeight!==e.blockHeight)throw Error(`You cannot combine paths which do not have the same block height.`);if(this.computeRoot()!==e.computeRoot())throw Error(`You cannot combine paths which do not have the same root.`);let t=[];for(let n=0;n<this.path.length;n++){t.push([]);for(let e of this.path[n])t[n].push(e);for(let r of e.path[n]){let e=t[n].find(e=>e.offset===r.offset);e===void 0?t[n].push(r):r?.txid!==void 0&&r?.txid!==null&&(e.txid=!0)}}this.path=t,this.trim()}trim(){let e=(e,t)=>{(t.length===0||t.at(-1)!==e)&&t.push(e)},t=(e,t)=>{for(let n=e.length;n>=0;n--){let r=this.path[t].findIndex(t=>t.offset===e[n]);r>=0&&this.path[t].splice(r,1)}},n=t=>{let n=[];for(let r of t)e(r>>1,n);return n},r=[],i=[];for(let e of this.path)e.sort((e,t)=>e.offset-t.offset);for(let t=0;t<this.path[0].length;t++){let n=this.path[0][t];if(n.txid===!0)e(n.offset>>1,r);else{let r=n.offset%2==1,a=this.path[0][t+(r?-1:1)];(a.txid===void 0||a.txid===null||!a.txid)&&e(a.offset,i)}}t(i,0);for(let e=1;e<this.path.length;e++)i=r,r=n(r),t(i,e)}cachedFindLeaf(e,t,n,r,i){let a=`${e}:${t}`;if(r.has(a))return r.get(a);let o=e=>E(Qe(tn(e,`hex`).reverse()).reverse()),s=e<n.length?n[e].get(t):void 0;if(s!=null)return r.set(a,s),s;if(e===0){r.set(a,void 0);return}let c=e-1,l=t<<1,u=this.cachedFindLeaf(c,l,n,r,i);if(u?.hash==null||u.hash===``){r.set(a,void 0);return}let d=this.cachedFindLeaf(c,l+1,n,r,i);if(d?.hash==null){if(d?.duplicate===!0||this.path.length===1&&l===i>>c)return s={offset:t,hash:o(u.hash+u.hash)},r.set(a,s),s;r.set(a,void 0);return}return s={offset:t,hash:d.duplicate===!0?o(u.hash+u.hash):o((d.hash??``)+(u.hash??``))},r.set(a,s),s}extract(t){if(t.length===0)throw Error(`At least one txid must be provided to extract`);let n=this.computeRoot(),r=this.path[0].reduce((e,t)=>Math.max(e,t.offset),0),i=Math.max(this.path.length,32-Math.clz32(r)),a=this.createSourceLeafIndex(),o=new Map,s=this.createTxidToOffsetIndex(),c=this.createNeededLeafLevels(i);for(let e of t)this.collectExtractedLeaves(e,s,c,a,o,r,i);let l=new e(this.blockHeight,this.buildExtractedPath(c));l.trim();let u=l.computeRoot();if(u!==n)throw Error(`Extracted path root ${u} does not match original root ${n}`);return l}createSourceLeafIndex(){let e=Array.from({length:this.path.length});for(let t=0;t<this.path.length;t++){let n=new Map;for(let e of this.path[t])n.set(e.offset,e);e[t]=n}return e}createTxidToOffsetIndex(){let e=new Map;for(let t of this.path[0])t.hash!=null&&e.set(t.hash,t.offset);return e}createNeededLeafLevels(e){let t=Array.from({length:e});for(let n=0;n<e;n++)t[n]=new Map;return t}collectExtractedLeaves(e,t,n,r,i,a,o){let s=t.get(e);if(s===void 0)throw Error(`Transaction ID ${e} not found in the Merkle Path`);n[0].set(s,{offset:s,txid:!0,hash:e});let c=s^1;if(!n[0].has(c)){let e=this.cachedFindLeaf(0,c,r,i,a);e!=null&&n[0].set(c,e)}for(let e=1;e<o;e++){let t=s>>e^1;if(n[e].has(t))continue;let o=this.cachedFindLeaf(e,t,r,i,a);o==null?s>>e===a>>e&&n[e].set(t,{offset:t,duplicate:!0}):n[e].set(t,o)}}buildExtractedPath(e){return e.map(e=>Array.from(e.values()).sort((e,t)=>e.offset-t.offset))}},Yi=4022206465,Xi=4022206466,Zi=16843009,Qi;(function(e){e[e.RAWTX=0]=`RAWTX`,e[e.RAWTX_AND_BUMP_INDEX=1]=`RAWTX_AND_BUMP_INDEX`,e[e.TXID_ONLY=2]=`TXID_ONLY`})(Qi||={});function $i(e,t){if(!Number.isSafeInteger(t)||t<0||e.pos+t>e.bin.length)throw RangeError(`Serialized transaction exceeds available BEEF data`);e instanceof Yt?e.skip(t):e.pos+=t}function ea(e){let t=e.pos;$i(e,4);let n=e.readVarIntNum(!1),r=new Set;for(let t=0;t<n;t++)r.add(E(e.readReverse(32))),$i(e,4),$i(e,e.readVarIntNum(!1)+4);let i=e.readVarIntNum(!1);for(let t=0;t<i;t++)$i(e,8),$i(e,e.readVarIntNum(!1));return $i(e,4),{rawTx:e instanceof Yt?e.bin.subarray(t,e.pos):Uint8Array.from(e.bin.slice(t,e.pos)),inputTxids:Array.from(r)}}function ta(e){return ea(new Yt(e)).inputTxids}function na(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}var ra=class e{_bumpIndex;_tx;_rawTx;_txid;inputTxids=[];isValid=void 0;get bumpIndex(){return this._bumpIndex}set bumpIndex(e){this._bumpIndex=e,this.updateInputTxids()}get hasProof(){return this._bumpIndex!==void 0}get isTxidOnly(){return this._txid!==void 0&&this._txid!==null&&this._rawTx==null&&this._tx==null}get txid(){if(this._txid!==void 0&&this._txid!==null&&this._txid!==``)return this._txid;if(this._tx!=null)return this._txid=this._tx.id(`hex`),this._txid;if(this._rawTx!=null)return this._txid=E(Qe(this._rawTx).reverse()),this._txid;throw Error(`Internal`)}get tx(){if(this._tx!=null)return this._tx;if(this._rawTx!=null)return this._tx=ua.fromBinaryView(this._rawTx),this._tx}get rawTx(){let e=this.rawTxUint8Array;return e==null?void 0:Array.from(e)}get rawTxUint8Array(){return this._tx==null||(this._rawTx==null?this._rawTx=this._tx.toUint8Array():this.syncRawTxFromTransaction()),this._rawTx}syncRawTxFromTransaction(){if(this._tx==null)return!1;let e=this._tx.toUint8Array();if(this._rawTx!=null)return e!==this._rawTx&&(this._rawTx=e,this._txid=this._tx.id(`hex`),this.updateInputTxids(),!0);let t=this._tx.id(`hex`),n=this._txid!=null&&this._txid!==t,r=this.inputTxids;return this._txid=t,this.updateInputTxids(),n||!na(r,this.inputTxids)}constructor(e,t,n){if(typeof e==`string`)this._txid=e;else if(e instanceof Uint8Array)this._rawTx=e;else if(Array.isArray(e))this._rawTx=new Uint8Array(e);else if(e instanceof ua)this._tx=e;else throw TypeError(`Invalid transaction data type`);this._bumpIndex=t,this.hasProof?this.inputTxids=[]:n==null?this.updateInputTxids():this.inputTxids=n}static fromTx(t,n){return new e(t,n)}static fromRawTx(t,n){return new e(t,n)}static fromTxid(t,n){return new e(t,n)}updateInputTxids(){if(this.hasProof)this.inputTxids=[];else if(this._tx!=null){let e=new Set;for(let t of this._tx.inputs)t.sourceTXID!==void 0&&t.sourceTXID!==null&&t.sourceTXID!==``&&e.add(t.sourceTXID);this.inputTxids=Array.from(e)}else this.inputTxids=this._rawTx==null?[]:ta(this._rawTx)}toWriter(e,t){let n=t=>{e.writeUInt8(t)},r=()=>{if(this._txid==null)throw Error(`Transaction ID (_txid) is undefined`);e.writeReverse(tn(this._txid,`hex`))},i=()=>{let t=this.rawTxUint8Array;if(t==null)throw Error(`a valid serialized Transaction is expected`);e.write(t)};t===4022206466?this.isTxidOnly?(n(Qi.TXID_ONLY),r()):this.bumpIndex===void 0?(n(Qi.RAWTX),i()):(n(Qi.RAWTX_AND_BUMP_INDEX),e.writeVarIntNum(this.bumpIndex),i()):(i(),this.bumpIndex===void 0?n(Qi.RAWTX):(n(Qi.RAWTX_AND_BUMP_INDEX),e.writeVarIntNum(this.bumpIndex)))}static fromReader(t,n){let r,i;if(n===4022206466){let n=t.readUInt8();if(n===Qi.TXID_ONLY)i=e.fromTxid(E(t.readReverse(32)));else{n===Qi.RAWTX_AND_BUMP_INDEX&&(r=t.readVarIntNum());let{rawTx:a,inputTxids:o}=ea(t);i=new e(a,r,o)}}else{let{rawTx:n,inputTxids:a}=ea(t);r=t.readUInt8()===0?void 0:t.readVarIntNum(),i=new e(n,r,a)}return i}};function ia(e,t,n,r){if(t.path.length!==n)throw Error(`Mismatched roots`);for(let i=0;i<n;i++)aa(e[i],t.path[i],r)}function aa(e,t,n){for(let r of t){let t=e.get(r.offset);if(t==null){e.set(r.offset,r);continue}oa(t,r,n)}}function oa(e,t,n){if(n&&(e.hash!==t.hash||e.duplicate!==t.duplicate))throw Error(`Mismatched roots`);t.txid!=null&&(e.txid=!0)}function sa(e,t,n){for(let r of e.path[0])typeof r.hash==`string`&&n.set(r.hash,t)}var ca=class e{bumps=[];txs=[];version=Xi;atomicTxid=void 0;txidIndex=void 0;txPositionIndex=void 0;bumpIndexesByHeight=void 0;bumpIndexByTxid=void 0;rawBytesCache;hexCache;atomicBytesCache=new Map;atomicCacheTxs;atomicCacheBumps;atomicCacheVersion;rawCacheVersion;rawCacheTxs;rawCacheBumps;bumpState;needsSort=!0;sortResultCache;sortTxState;constructor(e=Xi){this.version=e}invalidateSerializationCaches(){this.rawBytesCache=void 0,this.hexCache=void 0,this.atomicBytesCache.clear(),this.atomicCacheTxs=void 0,this.atomicCacheBumps=void 0,this.atomicCacheVersion=void 0,this.rawCacheVersion=void 0,this.rawCacheTxs=void 0,this.rawCacheBumps=void 0}captureSerializationState(){this.rawCacheVersion=this.version,this.rawCacheTxs=this.captureTransactionState(),this.rawCacheBumps=Array.from(this.bumps),this.captureBumpState()}captureTransactionState(){return this.txs.map(e=>({ref:e,bumpIndex:e._bumpIndex,rawTx:e._rawTx,tx:e._rawTx==null?e._tx:void 0,txid:e._rawTx==null&&e._tx==null?e._txid:void 0}))}transactionStateMatches(e){if(e?.length!==this.txs.length)return!1;for(let t=0;t<this.txs.length;t++){let n=this.txs[t],r=e[t];if(r.ref!==n||r.bumpIndex!==n._bumpIndex||r.rawTx!==n._rawTx||r.tx!==(n._rawTx==null?n._tx:void 0)||r.txid!==(n._rawTx==null&&n._tx==null?n._txid:void 0))return!1}return!0}captureBumpState(){this.bumpState=this.bumps.map(e=>({ref:e,blockHeight:e.blockHeight,levels:e.path.map(e=>({ref:e,leaves:e.map(e=>({ref:e,offset:e.offset,hash:e.hash,txid:e.txid,duplicate:e.duplicate}))}))}))}bumpLeafStateMatches(e,t){return t.ref===e&&t.offset===e.offset&&t.hash===e.hash&&t.txid===e.txid&&t.duplicate===e.duplicate}bumpLevelStateMatches(e,t){return t.ref===e&&t.leaves.length===e.length&&e.every((e,n)=>this.bumpLeafStateMatches(e,t.leaves[n]))}singleBumpStateMatches(e,t){return t.ref===e&&t.blockHeight===e.blockHeight&&t.levels.length===e.path.length&&e.path.every((e,n)=>this.bumpLevelStateMatches(e,t.levels[n]))}bumpStateMatches(){return this.bumpState?.length===this.bumps.length&&this.bumps.every((e,t)=>this.singleBumpStateMatches(e,this.bumpState[t]))}synchronizeNestedBumpMutations(){if(this.bumpState==null){this.captureBumpState();return}this.bumpStateMatches()||(this.invalidateSerializationCaches(),this.sortResultCache=void 0,this.sortTxState=void 0,this.needsSort=!0,this.invalidateBumpIndexes(),this.captureBumpState())}serializationCacheMatchesState(){if(this.rawBytesCache==null||this.rawCacheVersion!==this.version||!this.transactionStateMatches(this.rawCacheTxs)||this.rawCacheBumps?.length!==this.bumps.length)return!1;for(let e=0;e<this.bumps.length;e++)if(this.rawCacheBumps[e]!==this.bumps[e])return!1;return!0}markMutated(e=!0){this.invalidateSerializationCaches(),this.sortResultCache=void 0,this.sortTxState=void 0,e&&(this.needsSort=!0)}ensureSerializableState(){for(let e of this.txs)e.txid}synchronizeNestedTransactionMutations(){let e=!1;for(let t of this.txs)e=t.syncRawTxFromTransaction()||e;e&&(this.invalidateSerializationCaches(),this.sortResultCache=void 0,this.sortTxState=void 0,this.needsSort=!0,this.rebuildTxIndexes())}ensureSortedForSerialization(){this.needsSort&&this.sortTxs()}getSerializedBytes(){if(this.synchronizeNestedTransactionMutations(),this.synchronizeNestedBumpMutations(),this.serializationCacheMatchesState()&&this.rawBytesCache!=null)return this.rawBytesCache;this.invalidateSerializationCaches(),this.ensureSerializableState(),this.ensureSortedForSerialization();let e=new Jt;return this.toWriter(e),this.rawBytesCache=e.toUint8Array(),this.captureSerializationState(),this.rawBytesCache}getBeefForAtomic(e){this.synchronizeNestedTransactionMutations(),this.synchronizeNestedBumpMutations();let t=this.ensureTxidIndex(),n=t.get(e);if(n==null)throw Error(`${e} does not exist in this Beef`);let r=this.collectAtomicTransactions(n,t),i=this.copySelectedTransactions(r);return i.sortTxs(),i}getAtomicSerializedBytes(e){this.synchronizeNestedTransactionMutations(),this.synchronizeNestedBumpMutations(),this.atomicCacheVersion===this.version&&this.transactionStateMatches(this.atomicCacheTxs)&&this.atomicCacheBumps?.length===this.bumps.length&&this.bumps.every((e,t)=>this.atomicCacheBumps?.[t]===e)||this.atomicBytesCache.clear();let t=this.atomicBytesCache.get(e);if(t!=null)return t;let n=this.getBeefForAtomic(e).getSerializedBytes(),r=en(e,`hex`),i=new Uint8Array(4+r.length+n.length);new DataView(i.buffer).setUint32(0,Zi,!0);for(let e=0;e<r.length;e++)i[4+e]=r[r.length-1-e];return i.set(n,4+r.length),this.atomicBytesCache.set(e,i),this.atomicCacheTxs=this.captureTransactionState(),this.atomicCacheBumps=Array.from(this.bumps),this.atomicCacheVersion=this.version,i}collectAtomicTransactions(e,t){let n=new Set,r=[e];for(;r.length>0;){let e=r.pop();if(!(e==null||n.has(e))&&(n.add(e),!(this.hasMatchingBump(e)||e.isTxidOnly)))for(let n of e.inputTxids){let e=t.get(n);e!=null&&r.push(e)}}return n}hasMatchingBump(e){let t=e.bumpIndex;return t==null||!Number.isSafeInteger(t)||t<0||t>=this.bumps.length?!1:this.bumps[t]?.path[0]?.some(t=>t.hash===e.txid)??!1}copySelectedTransactions(t){let n=new e(this.version),r=new Map;for(let e of this.txs)t.has(e)&&this.hasMatchingBump(e)&&e.bumpIndex!=null&&(r.has(e.bumpIndex)||(r.set(e.bumpIndex,n.bumps.length),n.bumps.push(this.bumps[e.bumpIndex])));for(let e of this.txs){if(!t.has(e))continue;let i=e.bumpIndex==null?void 0:r.get(e.bumpIndex),a;a=e._rawTx==null?e._tx==null?ra.fromTxid(e.txid,i):ra.fromTx(e._tx,i):new ra(e._rawTx,i,Array.from(e.inputTxids)),n.txs.push(a)}return n}isAtomic(e=this.atomicTxid??``){if(this.synchronizeNestedTransactionMutations(),this.synchronizeNestedBumpMutations(),e.length===0)return!1;let t=this.ensureTxidIndex();if(t.size!==this.txs.length)return!1;let n=t.get(e);return n!=null&&this.collectAtomicTransactions(n,t).size===this.txs.length}findTxid(e){return this.synchronizeNestedTransactionMutations(),this.findTxidIndexed(e)}findTxidIndexed(e){return this.ensureTxidIndex().get(e)}ensureTxidIndex(){return(this.txidIndex==null||this.txPositionIndex==null)&&this.rebuildTxIndexes(),this.txidIndex}ensureTxPositionIndex(){return(this.txPositionIndex==null||this.txidIndex==null)&&this.rebuildTxIndexes(),this.txPositionIndex}rebuildTxIndexes(){this.txidIndex=new Map,this.txPositionIndex=new Map;for(let e=0;e<this.txs.length;e++){let t=this.txs[e];this.txidIndex.set(t.txid,t),this.txPositionIndex.set(t.txid,e)}}deleteFromIndex(e){this.txidIndex?.delete(e),this.txPositionIndex?.delete(e)}addToIndex(e,t=this.txs.length-1){this.txidIndex?.set(e.txid,e),this.txPositionIndex?.set(e.txid,t)}replaceOrAppendTx(e){let t=this.ensureTxPositionIndex().get(e.txid);t===void 0?(this.txs.push(e),this.addToIndex(e)):(this.txs[t]=e,this.addToIndex(e,t))}makeTxidOnly(e){let t=this.ensureTxPositionIndex().get(e);if(t===void 0)return;let n=this.txs[t];return n.isTxidOnly?n:(n=ra.fromTxid(e),this.txs[t]=n,this.addToIndex(n,t),this.tryToValidateBumpIndex(n),this.markMutated(!0),n)}findBump(e){this.synchronizeNestedBumpMutations();let t=this.ensureBumpTxidIndex().get(e);return t===void 0?void 0:this.bumps[t]}ensureBumpTxidIndex(){if(this.bumpIndexByTxid==null){this.bumpIndexByTxid=new Map;for(let e=0;e<this.bumps.length;e++)for(let t of this.bumps[e].path[0])typeof t.hash==`string`&&this.bumpIndexByTxid.set(t.hash,e)}return this.bumpIndexByTxid}ensureBumpHeightIndex(){if(this.bumpIndexesByHeight==null){this.bumpIndexesByHeight=new Map;for(let e=0;e<this.bumps.length;e++){let t=this.bumps[e],n=this.bumpIndexesByHeight.get(t.blockHeight)??[];n.push(e),this.bumpIndexesByHeight.set(t.blockHeight,n)}}return this.bumpIndexesByHeight}invalidateBumpIndexes(){this.bumpIndexesByHeight=void 0,this.bumpIndexByTxid=void 0}findTransactionForSigning(e){let t=this.findTxid(e);if(t?.tx!=null){for(let e of t.tx.inputs)if(e.sourceTransaction==null){let t=this.findTxidIndexed(Sn(e.sourceTXID,`sourceTXID must be valid`));t!=null&&(e.sourceTransaction=t.tx)}return t.tx}}findAtomicTransaction(e){let t=this.findTxid(e);if(t?.tx!=null)return this.addInputProof(t.tx),t.tx}addInputProof(e){let t=new Set,n=[e];for(;n.length>0;){let e=n.pop();if(e==null)continue;let r=e.id(`hex`);if(t.has(r))continue;t.add(r);let i=this.findBump(r);if(i!=null){e.merklePath=i;continue}for(let t of e.inputs)this.resolveInputSource(t),t.sourceTransaction!=null&&n.push(t.sourceTransaction)}}resolveInputSource(e){if(e.sourceTransaction==null){let t=this.findTxidIndexed(Sn(e.sourceTXID,`sourceTXID must be valid`));t!=null&&(e.sourceTransaction=t.tx)}}mergeBump(e){return this.synchronizeNestedTransactionMutations(),this.synchronizeNestedBumpMutations(),this.markMutated(!1),this.mergeBumpEntry(e)}mergeProvenTxs(e){if(e.length===0)return[];this.synchronizeNestedTransactionMutations(),this.synchronizeNestedBumpMutations(),this.markMutated(!0);let t=[];for(let n of e)t.push(this.mergeRawTxEntry(n.rawTx));let n=new Map;for(let t of e){let e=t.merklePath.blockHeight;n.set(e,(n.get(e)??0)+1)}let r=new Map;for(let t=0;t<e.length;t++){let i=e[t].merklePath,a=e[t].merkleRoot,o=n.get(i.blockHeight)===1?`${i.blockHeight}:single:${t}`:`${i.blockHeight}:${a??i.computeRoot()}`,s=r.get(o);s==null?r.set(o,{first:t,paths:[i],validateCombined:a!=null}):(s.paths.push(i),s.validateCombined=s.validateCombined||a!=null)}for(let e of[...r.values()].sort((e,t)=>e.first-t.first))this.mergeBumpEntry(this.combineCompatibleBumps(e.paths,e.validateCombined));return t}combineCompatibleBumps(e,t=!1){let n=e[0];if(e.length===1&&!t)return n;let r=n.path.map(e=>new Map(e.map(e=>[e.offset,e])));for(let i=1;i<e.length;i++)ia(r,e[i],n.path.length,t);let i=r.map(e=>[...e.values()]);if(t){let e=new Ji(n.blockHeight,i);return e.trim(),e}return n.path=i,n.trim(),n}mergeBumpEntry(e){let t=this.findOrInsertBump(e),n=this.bumps[t],r=this.ensureTxidIndex();for(let e of n.path[0]){if(typeof e.hash!=`string`)continue;let i=r.get(e.hash);i!=null&&i.bumpIndex==null&&this.tryMarkTxProvenByBump(i,n,t)}return t}findOrInsertBump(e){let t=this.ensureBumpHeightIndex(),n=this.ensureBumpTxidIndex(),r=t.get(e.blockHeight)??[];if(r.length>0){let t=e.computeRoot();for(let i of r)if(this.bumps[i].computeRoot()===t)return this.bumps[i].combine(e),sa(this.bumps[i],i,n),i}this.bumps.push(e);let i=this.bumps.length-1;return r.push(i),t.set(e.blockHeight,r),sa(e,i,n),i}tryMarkTxProvenByBump(e,t,n){let r=e.txid;for(let i of t.path[0])if(i.hash===r){e.bumpIndex=n,i.txid=!0;break}}mergeRawTx(e,t){return this.synchronizeNestedTransactionMutations(),this.markMutated(!0),this.mergeRawTxEntry(e,t)}mergeRawTxEntry(e,t){let n=new ra(e,t);return this.replaceOrAppendTx(n),this.tryToValidateBumpIndex(n),n}mergeTransactionEntry(e){let t=new ra(e,e.merklePath==null?void 0:this.mergeBumpEntry(e.merklePath));return this.replaceOrAppendTx(t),this.tryToValidateBumpIndex(t),t}queueSourceTransactions(e,t){for(let n=e.inputs.length-1;n>=0;n--){let r=e.inputs[n].sourceTransaction;r!=null&&t.push(r)}}mergeTransaction(e){return this.synchronizeNestedTransactionMutations(),this.markMutated(!0),this.mergeTransactionGraph(e)}mergeTransactionGraph(e){e.materializeSourceTXIDs();let t=e.id(`hex`),n=new Set,r=[e],i;for(;r.length>0;){let e=r.pop();if(e==null)continue;let a=e.id(`hex`);if(n.has(a))continue;n.add(a);let o=this.mergeTransactionEntry(e);a===t&&(i=o),o.bumpIndex===void 0&&this.queueSourceTransactions(e,r)}if(i==null)throw Error(`Failed to merge root transaction`);return i}removeExistingTxid(e){let t=this.ensureTxPositionIndex().get(e);t!==void 0&&(this.txs.splice(t,1),this.rebuildTxIndexes(),this.markMutated(!0))}mergeTxidOnly(e){let t=this.findTxid(e);return t??(t=new ra(e),this.txs.push(t),this.addToIndex(t),this.tryToValidateBumpIndex(t),this.markMutated(!0)),t}mergeBeefTx(e){let t=this.findTxid(e.txid);if(e.isTxidOnly&&t==null?t=this.mergeTxidOnly(e.txid):e._tx!=null&&(t==null||t.isTxidOnly)?t=this.mergeTransaction(e._tx):e._rawTx!=null&&(t==null||t.isTxidOnly)&&(t=this.mergeRawTx(e._rawTx)),t==null)throw Error(`Failed to merge BeefTx for txid: ${e.txid}`);return t}mergeBeefTxEntry(e){let t=this.findTxidIndexed(e.txid);if(e.isTxidOnly&&t==null?(t=ra.fromTxid(e.txid),this.txs.push(t),this.addToIndex(t),this.tryToValidateBumpIndex(t)):e._tx!=null&&(t==null||t.isTxidOnly)?t=this.mergeTransactionGraph(e._tx):e._rawTx!=null&&(t==null||t.isTxidOnly)&&(t=this.mergeRawTxEntry(e._rawTx)),t==null)throw Error(`Failed to merge BeefTx for txid: ${e.txid}`);return t}mergeBeef(t){let n=t instanceof e?t:e.fromBinary(t);this.synchronizeNestedTransactionMutations(),this.synchronizeNestedBumpMutations(),this.markMutated(!0);for(let e of n.bumps)this.mergeBumpEntry(e);for(let e of n.txs)this.mergeBeefTxEntry(e)}isValid(e){return this.verifyValid(e).valid}async verify(e,t){let n=this.verifyValid(t);if(!n.valid)return!1;for(let t of Object.keys(n.roots))if(!await e.isValidRootForHeight(n.roots[t],Number(t)))return!1;return!0}verifyValid(e){this.synchronizeNestedBumpMutations();let t={valid:!1,roots:{}};if(this.atomicTxid!=null&&!this.isAtomic(this.atomicTxid))return t;let n=this.sortTxs();if(this.hasDuplicateTxids()||n.missingInputs.length>0||n.notValid.length>0||n.txidOnly.length>0&&e!==!0||n.withMissingInputs.length>0)return t;let r={};return!this.collectTxidOnlyTxids(r,e)||!this.collectBumpTxids(r,t)||!this.verifyBumpIndexLeaves()||!this.verifyInputDependencies(r)||(t.valid=!0),t}hasDuplicateTxids(){let e=new Set;for(let t of this.txs){if(e.has(t.txid))return!0;e.add(t.txid)}return!1}collectTxidOnlyTxids(e,t){for(let n of this.txs)if(n.isTxidOnly){if(t!==!0)return!1;e[n.txid]=!0}return!0}collectBumpTxids(e,t){for(let n of this.bumps)for(let r of n.path[0])if(r.txid===!0&&typeof r.hash==`string`&&r.hash.length!==0&&(e[r.hash]=!0,!this.confirmComputedRoot(n,r.hash,t)))return!1;return!0}verifyBumpIndexLeaves(){for(let e of this.txs)if(e.bumpIndex!==void 0&&(!Number.isSafeInteger(e.bumpIndex)||e.bumpIndex<0||e.bumpIndex>=this.bumps.length||this.bumps[e.bumpIndex]?.path[0]?.find(t=>t.hash===e.txid)==null))return!1;return!0}verifyInputDependencies(e){for(let t of this.txs){for(let n of t.inputTxids)if(!e[n])return!1;e[t.txid]=!0}return!0}confirmComputedRoot(e,t,n){let r=e.computeRoot(t);return(n.roots[e.blockHeight]===void 0||n.roots[e.blockHeight]===``)&&(n.roots[e.blockHeight]=r),n.roots[e.blockHeight]===r}toWriter(e){e.writeUInt32LE(this.version),e.writeVarIntNum(this.bumps.length);for(let t of this.bumps)e.write(e instanceof Jt?t.toBinaryUint8Array():t.toBinary());e.writeVarIntNum(this.txs.length);for(let t of this.txs)t.toWriter(e,this.version)}toBinary(){return Array.from(this.getSerializedBytes())}toUint8Array(){return this.getSerializedBytes()}toBinaryAtomic(e){return Array.from(this.getAtomicSerializedBytes(e))}toUint8ArrayAtomic(e){return this.getAtomicSerializedBytes(e)}toHex(){let e=this.getSerializedBytes();if(this.hexCache!=null)return this.hexCache;let t=E(e);return this.hexCache=t,t}static fromReader(t){let n=t.pos,r=t.readUInt32LE(),i,a=n;if(r===16843009&&(i=E(t.readReverse(32)),a=t.pos,r=t.readUInt32LE()),r!==4022206465&&r!==4022206466)throw Error(`Serialized BEEF must start with ${Yi} or ${Xi} but starts with ${r}`);let o=new e(r),s=t.readVarIntNum();for(let e=0;e<s;e++){let e=Ji.fromReader(t,!1);o.bumps.push(e)}let c=t.readVarIntNum();for(let e=0;e<c;e++){let e=ra.fromReader(t,r);o.txs.push(e)}return o.atomicTxid=i,t instanceof Yt&&(o.rawBytesCache=t.bin.subarray(a,t.pos),o.captureSerializationState()),o}static fromBinary(t){return e.fromReader(new Yt(Uint8Array.from(t)))}static fromBinaryView(t){let n=new Yt(t),r=e.fromReader(n);if(!n.eof())throw Error(`Serialized BEEF contains trailing data`);return r}static fromString(t,n=`hex`){let r=new Yt(en(t,n));return e.fromReader(r)}tryToValidateBumpIndex(e){if(e.bumpIndex!==void 0)return!0;let t=e.txid,n=this.ensureBumpTxidIndex().get(t);if(n===void 0)return!1;e.bumpIndex=n;let r=this.bumps[n].path[0].find(e=>e.hash===t);return r!=null&&(r.txid=!0),!0}sortTxs(){if(this.synchronizeNestedTransactionMutations(),this.synchronizeNestedBumpMutations(),this.sortResultCache!=null&&this.sortTxStateMatches())return this.cloneSortResult(this.sortResultCache);this.sortResultCache=void 0,this.sortTxState=void 0;let e={},t={},n=[],r=[],i=this.partitionTxs(t,e,n,r),{txsMissingInputs:a,missingInputs:o,remaining:s}=this.separateMissingInputs(i,t);i=s;let c=this.topoSort(i,e,n);this.txs=a.concat(c).concat(r).concat(n),this.needsSort=!1,this.invalidateSerializationCaches(),this.rebuildTxIndexes();let l={missingInputs:Object.keys(o),notValid:c.map(e=>e.txid),valid:Object.keys(e),withMissingInputs:a.map(e=>e.txid),txidOnly:r.map(e=>e.txid)};return this.sortResultCache=l,this.captureSortTxState(),this.cloneSortResult(l)}captureSortTxState(){this.sortTxState=this.txs.map(e=>({ref:e,txid:e.txid,bumpIndex:e.bumpIndex,isTxidOnly:e.isTxidOnly,inputTxids:[...e.inputTxids]}))}sortTxStateMatches(){if(this.sortTxState?.length!==this.txs.length)return!1;for(let e=0;e<this.txs.length;e++){let t=this.txs[e],n=this.sortTxState[e];if(n.ref!==t||n.txid!==t.txid||n.bumpIndex!==t.bumpIndex||n.isTxidOnly!==t.isTxidOnly||n.inputTxids.length!==t.inputTxids.length)return!1;for(let e=0;e<t.inputTxids.length;e++)if(n.inputTxids[e]!==t.inputTxids[e])return!1}return!0}cloneSortResult(e){return{missingInputs:[...e.missingInputs],notValid:[...e.notValid],valid:[...e.valid],withMissingInputs:[...e.withMissingInputs],txidOnly:[...e.txidOnly]}}partitionTxs(e,t,n,r){let i=[];for(let a of this.txs)e[a.txid]=a,a.isValid=a.hasProof,a.isValid?(t[a.txid]=!0,n.push(a)):a.isTxidOnly&&a.inputTxids.length===0?(t[a.txid]=!0,r.push(a)):i.push(a);return i}separateMissingInputs(e,t){let n={},r=[],i=[];for(let a of e){let e=!1;for(let r of a.inputTxids)t[r]===void 0&&(n[r]=!0,e=!0);e?r.push(a):i.push(a)}return{txsMissingInputs:r,missingInputs:n,remaining:i}}topoSort(e,t,n){let{indegree:r,dependents:i,originalIndex:a,round:o}=this.buildTopoSortGraph(e,t),s=this.processTopoSortQueue(e,r,i,a,o);return this.appendTopoSortResult(e,s,o,t,n),e.filter(e=>!s.has(e.txid))}buildTopoSortGraph(e,t){let n=new Set(e.map(e=>e.txid)),r=new Map,i=new Map,a=new Map(e.map((e,t)=>[e.txid,t])),o=new Map;for(let a of e){let e=0;for(let r of a.inputTxids)if(!t[r]&&(e++,n.has(r))){let e=i.get(r)??[];e.push(a),i.set(r,e)}r.set(a.txid,e),o.set(a.txid,0)}return{indegree:r,dependents:i,originalIndex:a,round:o}}processTopoSortQueue(e,t,n,r,i){let a=e.filter(e=>t.get(e.txid)===0),o=new Set;for(let e of a)if(!o.has(e.txid)){o.add(e.txid);for(let o of n.get(e.txid)??[]){let n=(i.get(e.txid)??0)+ +((r.get(e.txid)??0)>(r.get(o.txid)??0));i.set(o.txid,Math.max(i.get(o.txid)??0,n));let s=(t.get(o.txid)??0)-1;t.set(o.txid,s),s===0&&a.push(o)}}return o}appendTopoSortResult(e,t,n,r,i){let a=[];for(let r of e){if(!t.has(r.txid))continue;let e=n.get(r.txid)??0,i=a[e]??[];i.push(r),a[e]=i}for(let e of a)for(let t of e??[])r[t.txid]=!0,i.push(t)}clone(){let t=new e;return t.version=this.version,t.bumps=Array.from(this.bumps),t.txs=Array.from(this.txs),t.txidIndex=void 0,t.txPositionIndex=void 0,t.bumpIndexesByHeight=void 0,t.bumpIndexByTxid=void 0,t.needsSort=this.needsSort,t.sortResultCache=this.sortResultCache==null?void 0:this.cloneSortResult(this.sortResultCache),t.sortResultCache!=null&&t.captureSortTxState(),t.hexCache=this.hexCache,t.rawBytesCache=this.rawBytesCache,t.rawBytesCache!=null&&t.captureSerializationState(),t}trimKnownTxids(e){let t=this.removeKnownTxidOnlyTxs(new Set(e));t=this.reindexBumps()||t,t&&this.markMutated(!0)}removeKnownTxidOnlyTxs(e){let t=this.txs.length;this.txs=this.txs.filter(t=>!(t.isTxidOnly&&e.has(t.txid)));let n=this.txs.length!==t;return n&&this.rebuildTxIndexes(),n}reindexBumps(){let e=new Set;for(let t of this.txs)t.bumpIndex!==void 0&&e.add(t.bumpIndex);if(e.size>=this.bumps.length)return!1;let t=new Map,n=0;for(let r=0;r<this.bumps.length;r++)e.has(r)&&(t.set(r,n),n++);this.bumps=this.bumps.filter((t,n)=>e.has(n));for(let e of this.txs){if(e.bumpIndex===void 0)continue;let n=t.get(e.bumpIndex);if(n===void 0)throw Error(`Internal error: bumpIndex ${e.bumpIndex} not found in indexMap`);e.bumpIndex=n}return this.invalidateBumpIndexes(),!0}getValidTxids(){return this.sortTxs().valid}toLogString(){let e=``;e+=`BEEF with ${this.bumps.length} BUMPS and ${this.txs.length} Transactions, isValid ${this.isValid().toString()}\n`;let t=-1;for(let n of this.bumps)t++,e+=` BUMP ${t}\n block: ${n.blockHeight}\n txids: [\n${n.path[0].filter(e=>e.txid===!0).map(e=>` '${e.hash??``}'`).join(`,
10
- `)}\n ]\n`;t=-1;for(let n of this.txs)if(t++,e+=` TX ${t}\n txid: ${n.txid}\n`,n.bumpIndex!==void 0&&(e+=` bumpIndex: ${n.bumpIndex}\n`),n.isTxidOnly?e+=` txidOnly
11
- `:e+=` rawTx length=${n.rawTx?.length??0}\n`,n.inputTxids.length>0){let t=n.inputTxids.map(e=>` '${e}'`).join(`,
12
- `);e+=` inputs: [\n${t}\n ]\n`}return e}addComputedLeaves(){for(let e of this.bumps)for(let t=1;t<e.path.length;t++)this.addComputedLeavesForRow(e,t)}addComputedLeavesForRow(e,t){let n=e=>E(Qe(tn(e,`hex`).reverse()).reverse());for(let r of e.path[t-1]){if(typeof r.hash!=`string`||r.offset&1)continue;let i=e.path[t-1].find(e=>e.offset===r.offset+1);if(i===void 0||typeof i.hash!=`string`)continue;let a=r.offset>>1;e.path[t].every(e=>e.offset!==a)&&e.path[t].push({offset:a,hash:n(i.hash+r.hash)})}}},la=943816,ua=class e{version;inputs;outputs;lockTime;metadata;merklePath;cachedHash;cachedIdHex;rawBytesCache;efBytesCache;hexCache;activeSignatureHashCache;rawCacheState;getSignatureHashCache(){return this.activeSignatureHashCache??{hashOutputsSingle:new Map}}completeSourceTransaction(e,t,n){for(let t of e.inputs)t.sourceTXID==null&&t.sourceTransaction!=null&&(t.sourceTXID=t.sourceTransaction.id(`hex`));t.delete(e),n.add(e)}scheduleSourceTransactions(e,t,n,r){if(t.has(e))throw Error(`Cyclic source transaction graph`);t.add(e),r.push({tx:e,expanded:!0});for(let t=e.inputs.length-1;t>=0;t--){let i=e.inputs[t].sourceTransaction;e.inputs[t].sourceTXID==null&&i!=null&&!n.has(i)&&r.push({tx:i,expanded:!1})}}materializeSourceTXIDs(){let e=new Set,t=new Set,n=[{tx:this,expanded:!1}];for(;n.length>0;){let r=n.pop();if(r!=null&&!e.has(r.tx)){if(r.expanded){this.completeSourceTransaction(r.tx,t,e);continue}this.scheduleSourceTransactions(r.tx,t,e,n)}}}static fromBEEF(t,n){let{tx:r}=e.fromAnyBeef(t,n);return r}static fromBEEFView(t,n){let{tx:r}=e.fromAnyBeef(t,n,!0);return r}static fromAtomicBEEF(t){let{tx:n,txid:r,beef:i}=e.fromAnyBeef(t);if(r!==i.atomicTxid)throw i.atomicTxid==null?Error(`beef must conform to BRC-95 and must contain the subject txid.`):Error(`Transaction with TXID ${i.atomicTxid} not found in BEEF data.`);if(!i.isAtomic(r))throw Error(`Atomic BEEF contains unrelated transaction data.`);return n}static fromAtomicBEEFView(t){let{tx:n,txid:r,beef:i}=e.fromAnyBeef(t,void 0,!0);if(r!==i.atomicTxid)throw i.atomicTxid==null?Error(`beef must conform to BRC-95 and must contain the subject txid.`):Error(`Transaction with TXID ${i.atomicTxid} not found in BEEF data.`);if(!i.isAtomic(r))throw Error(`Atomic BEEF contains unrelated transaction data.`);return n}static fromAnyBeef(e,t,n=!1){let r=n&&e instanceof Uint8Array?ca.fromBinaryView(e):ca.fromBinary(e);if(r.txs.length<1)throw Error(`beef must include at least one transaction.`);let i=r.txs.at(-1);if(i==null)throw Error(`beef must include at least one transaction.`);let a=t??r.atomicTxid??i.txid,o=r.findAtomicTransaction(a);if(o==null)throw Error(t==null?`beef does not contain transaction for atomic txid.`:`Transaction with TXID ${String(a)} not found in BEEF data.`);return{tx:o,beef:r,txid:a}}static fromEF(t){let n=Yt.makeReader(t),r=n.readUInt32LE();if(E(n.read(6))!==`0000000000ef`)throw Error(`Invalid EF marker`);let i=n.readVarIntNum(),a=[];for(let t=0;t<i;t++){let t=E(n.readReverse(32)),r=n.readUInt32LE(),i=n.readVarIntNum(),o=n.read(i),s=Zr.fromBinary(o),c=n.readUInt32LE(),l=n.readUInt64LEBn().toNumber(),u=n.readVarIntNum(),d=n.read(u),f=Xr.fromBinary(d),p=new e(void 0,[],[],void 0);p.outputs=Array.from({length:r+1}).fill(null),p.outputs[r]={satoshis:l,lockingScript:f},a.push({sourceTransaction:p,sourceTXID:t,sourceOutputIndex:r,unlockingScript:s,sequence:c})}let o=n.readVarIntNum(),s=[];for(let e=0;e<o;e++){let e=n.readUInt64LEBn().toNumber(),t=n.readVarIntNum(),r=n.read(t),i=Xr.fromBinary(r);s.push({satoshis:e,lockingScript:i})}let c=n.readUInt32LE();return new e(r,a,s,c)}static parseScriptOffsets(e){let t=Yt.makeReader(e),n=[],r=[];t.pos+=4;let i=t.readVarIntNum();for(let e=0;e<i;e++){t.pos+=36;let r=t.readVarIntNum();n.push({vin:e,offset:t.pos,length:r}),t.pos+=r+4}let a=t.readVarIntNum();for(let e=0;e<a;e++){t.pos+=8;let n=t.readVarIntNum();r.push({vout:e,offset:t.pos,length:n}),t.pos+=n}return{inputs:n,outputs:r}}static fromReader(t){return e.fromReaderInternal(t,!1)}static fromReaderInternal(t,n){let r=t.readUInt32LE(),i=t.readVarIntNum(),a=[];for(let e=0;e<i;e++){let e=E(t.readReverse(32)),r=t.readUInt32LE(),i=t.readVarIntNum(),o=n&&t instanceof Yt?t.readView(i):t.read(i),s=n&&o instanceof Uint8Array?Zr.fromBinaryView(o):Zr.fromBinary(o),c=t.readUInt32LE();a.push({sourceTXID:e,sourceOutputIndex:r,unlockingScript:s,sequence:c})}let o=t.readVarIntNum(),s=[];for(let e=0;e<o;e++){let e=t.readUInt64LEBn().toNumber(),r=t.readVarIntNum(),i=n&&t instanceof Yt?t.readView(r):t.read(r),a=n&&i instanceof Uint8Array?Xr.fromBinaryView(i):Xr.fromBinary(i);s.push({satoshis:e,lockingScript:a})}let c=t.readUInt32LE();return new e(r,a,s,c)}static fromBinary(t){let n=Uint8Array.from(t),r=new Yt(n),i=e.fromReaderInternal(r,!0);return i.rawBytesCache=n,i.captureSerializationState(),i}static fromBinaryView(t){let n=new Yt(t),r=e.fromReaderInternal(n,!0);if(!n.eof())throw Error(`Serialized transaction contains trailing data`);return r.rawBytesCache=t,r.captureSerializationState(),r}static fromHex(t){let n=en(t,`hex`),r=new Yt(n),i=e.fromReaderInternal(r,!0);return i.rawBytesCache=n,i.hexCache=E(n),i.captureSerializationState(),i}static fromHexEF(t){return e.fromEF(en(t,`hex`))}static fromHexBEEF(t,n){return e.fromBEEF(tn(t,`hex`),n)}constructor(e=1,t=[],n=[],r=0,i=new Map,a){this.version=e,this.inputs=t,this.outputs=n,this.lockTime=r,this.metadata=i,this.merklePath=a}invalidateSerializationCaches(){this.cachedHash=void 0,this.cachedIdHex=void 0,this.rawBytesCache=void 0,this.efBytesCache=void 0,this.hexCache=void 0,this.rawCacheState=void 0}sourceTransactionId(e){return e.sourceTXID==null?e.sourceTransaction?.id(`hex`):void 0}captureSerializationState(){this.rawCacheState={version:this.version,lockTime:this.lockTime,inputs:this.inputs.map(e=>{let t=e.sourceTransaction?.outputs[e.sourceOutputIndex];return{ref:e,sourceTXID:e.sourceTXID,sourceTransactionId:this.sourceTransactionId(e),sourceOutputIndex:e.sourceOutputIndex,sequence:e.sequence,unlockingScript:e.unlockingScript,unlockingScriptBytes:e.unlockingScript?.toUint8Array(),sourceOutput:t,sourceSatoshis:t?.satoshis,sourceLockingScript:t?.lockingScript,sourceLockingScriptBytes:t?.lockingScript.toUint8Array()}}),outputs:this.outputs.map(e=>({ref:e,satoshis:e.satoshis,lockingScript:e.lockingScript,lockingScriptBytes:e.lockingScript.toUint8Array()}))}}serializationCacheMatchesState(){let e=this.rawCacheState;if(e?.version!==this.version||e.lockTime!==this.lockTime||e.inputs.length!==this.inputs.length||e.outputs.length!==this.outputs.length)return!1;for(let t=0;t<this.inputs.length;t++){let n=this.inputs[t],r=e.inputs[t],i=n.sourceTransaction?.outputs[n.sourceOutputIndex];if(r.ref!==n||r.sourceTXID!==n.sourceTXID||r.sourceTransactionId!==this.sourceTransactionId(n)||r.sourceOutputIndex!==n.sourceOutputIndex||r.sequence!==n.sequence||r.unlockingScript!==n.unlockingScript||r.unlockingScriptBytes!==n.unlockingScript?.toUint8Array()||r.sourceOutput!==i||r.sourceSatoshis!==i?.satoshis||r.sourceLockingScript!==i?.lockingScript||r.sourceLockingScriptBytes!==i?.lockingScript.toUint8Array())return!1}for(let t=0;t<this.outputs.length;t++){let n=this.outputs[t],r=e.outputs[t];if(r.ref!==n||r.satoshis!==n.satoshis||r.lockingScript!==n.lockingScript||r.lockingScriptBytes!==n.lockingScript.toUint8Array())return!1}return!0}addInput(e){if(e.sourceTXID===void 0&&e.sourceTransaction===void 0)throw TypeError(`A reference to an an input transaction is required. If the input transaction itself cannot be referenced, its TXID must still be provided.`);e.sequence??=4294967295,this.invalidateSerializationCaches(),this.inputs.push(e)}addOutput(e){if(this.invalidateSerializationCaches(),e.change!==!0){if(e.satoshis===void 0)throw TypeError(`either satoshis must be defined or change must be set to true`);if(e.satoshis<0)throw Error(`satoshis must be a positive integer or zero`)}if(e.lockingScript==null)throw Error(`lockingScript must be defined`);this.outputs.push(e)}addP2PKHOutput(e,t){let n=new Ei().lock(e);if(t===void 0)return this.addOutput({lockingScript:n,change:!0});this.addOutput({lockingScript:n,satoshis:t})}updateMetadata(e){this.metadata={...this.metadata,...e}}async fee(e=ki.getInstance(),t=`equal`){if(this.invalidateSerializationCaches(),typeof e==`number`){let t=e;e={computeFee:async()=>t}}let n=await e.computeFee(this),r=this.calculateChange(n);if(r<=0){this.outputs=this.outputs.filter(e=>e.change!==!0);return}this.distributeChange(r,t)}calculateChange(e){let t=0;for(let e of this.inputs){if(typeof e.sourceTransaction!=`object`)throw TypeError(`Source transactions are required for all inputs during fee computation`);t+=e.sourceTransaction.outputs[e.sourceOutputIndex].satoshis??0}t-=e;for(let e of this.outputs)e.change!==!0&&e.satoshis!==void 0&&(t-=e.satoshis);return t}distributeChange(e,t){let n=0,r=this.outputs.filter(e=>e.change);if(t===`random`?n=this.distributeRandomChange(e,r):t===`equal`&&(n=this.distributeEqualChange(e,r)),n<e){let t=this.outputs.at(-1);t.satoshis===void 0?t.satoshis=e-n:t.satoshis+=e-n}}distributeRandomChange(e,t){let n=0,r=e,i=Array.from({length:t.length}).fill(1);r-=t.length,n+=t.length;for(let e=0;e<t.length-1;e++){let t=this.benfordNumber(0,r);i[e]=i[e]+t,n+=t,r-=t}for(let e of this.outputs)e.change===!0&&(e.satoshis=i.shift());return n}distributeEqualChange(e,t){let n=0,r=Math.floor(e/t.length);for(let e of t)n+=r,e.satoshis=r;return n}benfordNumber(e,t){let n=Tr(1)[0]%9+1;return Math.floor(e+(t-e)*Math.log10(1+1/n)/Math.log10(10))}getFee(){let e=0;for(let t of this.inputs){if(typeof t.sourceTransaction!=`object`)throw TypeError(`Source transactions or sourceSatoshis are required for all inputs to calculate fee`);e+=t.sourceTransaction.outputs[t.sourceOutputIndex].satoshis??0}let t=0;for(let e of this.outputs)t+=e.satoshis??0;return e-t}async sign(e={}){this.invalidateSerializationCaches();for(let e of this.outputs)if(e.satoshis===void 0)throw e.change===!0?Error(`There are still change outputs with uncomputed amounts. Use the fee() method to compute the change amounts and transaction fees prior to signing.`):Error(`One or more transaction outputs is missing an amount. Ensure all output amounts are provided before signing.`);this.materializeSourceTXIDs();let t=this.activeSignatureHashCache;this.activeSignatureHashCache={hashOutputsSingle:new Map};let n;try{n=await Promise.all(this.inputs.map(async(t,n)=>e.skipExistingSignatures===!0&&this.inputs[n].unlockingScript!=null?this.inputs[n].unlockingScript:typeof this.inputs[n].unlockingScriptTemplate==`object`?await this.inputs[n]?.unlockingScriptTemplate?.sign(this,n):await Promise.resolve(void 0)))}finally{this.activeSignatureHashCache=t}for(let e=0,t=this.inputs.length;e<t;e++)typeof this.inputs[e].unlockingScriptTemplate==`object`&&(this.inputs[e].unlockingScript=n[e]);this.invalidateSerializationCaches()}async broadcast(e=Hi()){return await e.broadcast(this)}writeTransactionBody(e){e.writeUInt32LE(this.version),e.writeVarIntNum(this.inputs.length);for(let t of this.inputs){if(t.sourceTXID===void 0){if(t.sourceTransaction==null)throw Error(`sourceTransaction is undefined`);e.write(t.sourceTransaction.hash())}else e.writeReverse(tn(t.sourceTXID,`hex`));if(e.writeUInt32LE(t.sourceOutputIndex),t.unlockingScript==null)throw Error(`unlockingScript is undefined`);let n=t.unlockingScript.toUint8Array();e.writeVarIntNum(n.length),e.write(n),e.writeUInt32LE(t.sequence??4294967295)}e.writeVarIntNum(this.outputs.length);for(let t of this.outputs){e.writeUInt64LE(t.satoshis??0);let n=t.lockingScript.toUint8Array();e.writeVarIntNum(n.length),e.write(n)}e.writeUInt32LE(this.lockTime)}buildSerializedBytes(){let e=new Jt;return this.writeTransactionBody(e),e.toUint8Array()}getSerializedBytes(){return(this.rawBytesCache==null||!this.serializationCacheMatchesState())&&(this.invalidateSerializationCaches(),this.rawBytesCache=this.buildSerializedBytes(),this.captureSerializationState()),this.rawBytesCache}toBinary(){return Array.from(this.getSerializedBytes())}toUint8Array(){return this.getSerializedBytes()}writeEF(e){e.writeUInt32LE(this.version),e.write([0,0,0,0,0,239]),e.writeVarIntNum(this.inputs.length);for(let t of this.inputs){if(t.sourceTransaction===void 0)throw TypeError(`All inputs must have source transactions when serializing to EF format`);if(t.sourceTXID===void 0?e.write(t.sourceTransaction.hash()):e.write(tn(t.sourceTXID,`hex`).reverse()),e.writeUInt32LE(t.sourceOutputIndex),t.unlockingScript==null)throw Error(`unlockingScript is undefined`);let n=t.unlockingScript.toUint8Array();e.writeVarIntNum(n.length),e.write(n),e.writeUInt32LE(t.sequence??4294967295),e.writeUInt64LE(t.sourceTransaction.outputs[t.sourceOutputIndex].satoshis??0);let r=t.sourceTransaction.outputs[t.sourceOutputIndex].lockingScript.toUint8Array();e.writeVarIntNum(r.length),e.write(r)}e.writeVarIntNum(this.outputs.length);for(let t of this.outputs){e.writeUInt64LE(t.satoshis??0);let n=t.lockingScript.toUint8Array();e.writeVarIntNum(n.length),e.write(n)}e.writeUInt32LE(this.lockTime)}toEF(){return Array.from(this.getEFBytes())}toEFUint8Array(){return this.toEFBinary()}getEFBytes(){if(this.efBytesCache==null||!this.serializationCacheMatchesState()){this.invalidateSerializationCaches();let e=new Jt;this.writeEF(e),this.efBytesCache=e.toUint8Array(),this.captureSerializationState()}return this.efBytesCache}toEFBinary(){return this.getEFBytes()}toHexEF(){return E(this.toEFBinary())}toHex(){let e=this.getSerializedBytes();if(this.hexCache!=null)return this.hexCache;let t=E(e);return this.hexCache=t,t}toHexBEEF(){return E(this.toBEEF())}toHexAtomicBEEF(){return E(this.toAtomicBEEF())}hash(e){let t=this.getSerializedBytes();return this.cachedHash??=Qe(t),e===`hex`?E(this.cachedHash):Array.from(this.cachedHash)}id(e){if(this.getSerializedBytes(),e===`hex`&&this.cachedIdHex!=null)return this.cachedIdHex;let t=[...this.hash()];return t.reverse(),e===`hex`?(this.cachedIdHex=E(t),this.cachedIdHex):t}async completeVerificationFromMerklePath(e,t,n,r,i,a){if(typeof e.merklePath!=`object`)return!1;if(t)return i.add(e),!0;if(await e.merklePath.verify(r(),n))return a.add(r()),!0;throw Error(`Invalid merkle path for transaction ${r()}`)}async verifyTransactionFee(t,n,r){if(n===void 0)return;if(t===void 0)throw Error(`Transaction is undefined`);let i=e.fromEF(t.toEF());if(delete i.outputs[0].satoshis,i.outputs[0].change=!0,await i.fee(n),t.getFee()<i.getFee())throw Error(`Verification failed because the transaction ${r()} has an insufficient fee and has not been mined.`)}queueSourceTransactionForVerification(e,t,n){if(n.scriptsOnly){!n.verifiedTransactions.has(e)&&!n.queuedTransactions.has(e)&&(n.txQueue.push(e),n.queuedTransactions.add(e));return}!n.verifiedTxids.has(t)&&!n.queuedTxids.has(t)&&(n.txQueue.push(e),n.queuedTxids.add(t))}verifyTransactionInputs(e,t,n,r){let i=0,a={hashOutputsSingle:new Map};for(let o=0;o<e.inputs.length;o++){let s=e.inputs[o];if(typeof s.sourceTransaction!=`object`)throw TypeError(`Verification failed because the input at index ${o} of transaction ${n()} is missing an associated source transaction. This source transaction is required for transaction verification because there is no merkle proof for the transaction spending a UTXO it contains.`);if(typeof s.unlockingScript!=`object`)throw TypeError(`Verification failed because the input at index ${o} of transaction ${n()} is missing an associated unlocking script. This script is required for transaction verification because there is no merkle proof for the transaction spending the UTXO.`);let c=s.sourceTransaction,l=c.outputs[s.sourceOutputIndex];i+=l.satoshis??0;let u=r.scriptsOnly&&s.sourceTXID!==void 0?s.sourceTXID:c.id(`hex`);if(this.queueSourceTransactionForVerification(c,u,r),s.sourceTXID??=u,!t&&!new Si({sourceTXID:s.sourceTXID,sourceOutputIndex:s.sourceOutputIndex,lockingScript:l.lockingScript,sourceSatoshis:l.satoshis??0,transactionVersion:e.version,otherInputs:[],allInputs:e.inputs,unlockingScript:s.unlockingScript,inputSequence:s.sequence??4294967295,inputIndex:o,outputs:e.outputs,lockTime:e.lockTime,memoryLimit:r.memoryLimit,sigHashCache:a}).validateJavaScript())return{valid:!1,inputTotal:i}}return{valid:!0,inputTotal:i}}totalVerifiedOutputs(e){let t=0;for(let n of e.outputs){if(typeof n.satoshis!=`number`)throw TypeError(`Every output must have a defined amount during transaction verification.`);t+=n.satoshis}return t}async verifyQueuedScripts(e,t){if(e.length===0||t===void 0)return;let n=t.verifyScriptsBatch===void 0?await Promise.all(e.map(async e=>await t.verifyScripts(e))):await t.verifyScriptsBatch(e);if(n.length!==e.length)throw Error(`Script verifier returned an invalid batch result count`);let r=n.findIndex(e=>!e);if(r>=0)throw Error(`Script verification failed for transaction ${e[r].tx.id(`hex`)}`)}isTransactionAlreadyVerified(e,t,n){return n.scriptsOnly?n.verifiedTransactions.has(e):n.verifiedTxids.has(t())}async verifyUnminedTransaction(e,t,n){let{feeModel:r,memoryLimit:i,selectedVerifier:a,verifierQueue:o}=n;await this.verifyTransactionFee(e,r,t);let s={tx:e,blockHeight:la,consensus:!0,...i===void 0?{}:{memoryLimit:i}},c=a!==void 0&&(i===void 0||a.supportsMemoryLimit===!0)&&(a.shouldVerifyScripts?.(s)??!0),l=this.verifyTransactionInputs(e,c,t,n);return!l.valid||(c&&o.push(s),this.totalVerifiedOutputs(e)>l.inputTotal)?!1:(n.scriptsOnly?n.verifiedTransactions.add(e):n.verifiedTxids.add(t()),!0)}async verify(e=Wi(),t,n,r){let i=e===`scripts only`,a=r??ni();i||this.materializeSourceTXIDs();let o=new Set,s=new Set,c=[this],l=new Set;i||l.add(this.id(`hex`));let u=new Set(c),d=[],f={scriptsOnly:i,memoryLimit:n,txQueue:c,queuedTransactions:u,queuedTxids:l,verifiedTransactions:s,verifiedTxids:o,feeModel:t,selectedVerifier:a,verifierQueue:d},p=0;for(;p<c.length;){let t=c[p++],n,r=()=>(n??=t.id(`hex`),n);if(!this.isTransactionAlreadyVerified(t,r,f)&&!await this.completeVerificationFromMerklePath(t,i,e,r,s,o)&&!await this.verifyUnminedTransaction(t,r,f))return!1}return await this.verifyQueuedScripts(d,a),!0}writeSerializedBEEF(e,t){this.materializeSourceTXIDs(),e.writeUInt32LE(Yi);let{bumps:n,txs:r}=this.collectBEEFTransactions(t);e.writeVarIntNum(n.length);let i=this.reserveBEEFWriter(e,n,r);for(let t=0;t<n.length;t++)e.write(i?.[t]??n[t].toBinary());e.writeVarIntNum(r.length);for(let t of r)e.write(t.tx.toUint8Array()),typeof t.pathIndex==`number`?(e.writeUInt8(1),e.writeVarIntNum(t.pathIndex)):e.writeUInt8(0)}collectBEEFTransactions(e){let t=[],n=new Map,r=new Map,i=[],a=new Set,o=new Set,s=[{tx:this,expanded:!1}];for(;s.length>0;){let c=s.pop();if(c!=null){if(c.expanded){this.appendBEEFTransaction(c.tx,a,i,t,n,r);continue}this.scheduleBEEFTransaction(c.tx,e,o,s)}}return{bumps:t,txs:i}}appendBEEFTransaction(e,t,n,r,i,a){let o=e.id(`hex`);if(t.has(o))return;let s={tx:e};e.merklePath!=null&&(s.pathIndex=this.getBEEFPathIndex(e.merklePath,r,i,a)),t.add(o),n.push(s)}scheduleBEEFTransaction(e,t,n,r){let i=e.id(`hex`);if(!n.has(i)&&(n.add(i),r.push({tx:e,expanded:!0}),e.merklePath==null))for(let n of e.inputs){let e=n.sourceTransaction;if(e!=null)r.push({tx:e,expanded:!1});else if(t===!1)throw Error(`A required source transaction is missing!`)}}getBEEFPathIndex(e,t,n,r){let i=n.get(e);if(i!==void 0)return i;let a=`${e.blockHeight}:${e.computeRoot()}`,o=r.get(a);if(o!==void 0)return t[o].combine(e),n.set(e,o),o;let s=t.length;return t.push(e),n.set(e,s),r.set(a,s),s}reserveBEEFWriter(e,t,n){let r;if(e instanceof Jt){r=t.map(e=>e.toBinaryUint8Array());let i=16;for(let e of r)i+=e.length;for(let e of n)i+=e.tx.toUint8Array().length+10;e.reserve(i)}return r}toBEEF(e){let t=new _n;return this.writeSerializedBEEF(t,e),t.toArray()}toBEEFUint8Array(e){let t=new Jt;return this.writeSerializedBEEF(t,e),t.toArray()}toBEEFBytes(e){let t=new Jt;return this.writeSerializedBEEF(t,e),t.toUint8Array()}toAtomicBEEF(e){this.materializeSourceTXIDs();let t=[1,1,1,1],n=this.hash(),r=this.toBEEF(e);return t.concat(n,r)}toAtomicBEEFUint8Array(e){this.materializeSourceTXIDs();let t=new Jt;t.write([1,1,1,1]);let n=this.hash();return t.write(n),this.writeSerializedBEEF(t,e),t.toUint8Array()}async completeWithWallet(t,n,r,i){let a=this.inputs.length,o=this.outputs.length,s=n??`Transaction with ${a} input(s) and ${o} output(s)`,c=this.inputs.some(e=>e.unlockingScriptTemplate!=null),l=await this.buildWalletActionArgs(s,c),u=c?await this.completeWalletTemplateAction(t,l,r,i):await this.completeWalletScriptAction(t,l,r,i),d=e.fromAtomicBEEF(u);this.version=d.version,this.inputs=d.inputs,this.outputs=d.outputs,this.lockTime=d.lockTime,this.merklePath=d.merklePath,this.invalidateSerializationCaches(),this.metadata={...this.metadata,...d.metadata}}async buildWalletActionArgs(e,t){let n={description:e,inputs:[],outputs:[],lockTime:this.lockTime,version:this.version};this.materializeSourceTXIDs();let r=new ca;for(let e=0;e<this.inputs.length;e++){let i=this.inputs[e];if(i.sourceTransaction==null)throw Error(`All inputs must have a sourceTransaction when using completeWithWallet`);r.mergeTransaction(i.sourceTransaction),n.inputs.push(await this.buildWalletInputArg(i,e,t))}return this.inputs.length>0&&(n.inputBEEF=r.toUint8Array()),n.outputs=this.outputs.map(e=>({satoshis:e.satoshis,lockingScript:e.lockingScript.toHex(),outputDescription:`Output from source transaction`})),Array.isArray(this.metadata?.labels)&&(n.labels=this.metadata.labels),n}async buildWalletInputArg(e,t,n){let r={outpoint:`${e.sourceTransaction.id(`hex`)}.${e.sourceOutputIndex}`,inputDescription:`Input from source transaction`,sequenceNumber:e.sequence};if(!n){if(e.unlockingScript==null)throw Error(`All inputs must have an unlockingScript when using completeWithWallet`);return r.unlockingScript=e.unlockingScript.toHex(),r}if(e.unlockingScriptTemplate!=null)r.unlockingScriptLength=await e.unlockingScriptTemplate.estimateLength(this,t);else if(e.unlockingScript!=null)r.unlockingScript=e.unlockingScript.toHex();else throw Error(`Input ${t} must have either an unlockingScript or unlockingScriptTemplate`);return r}async completeWalletTemplateAction(t,n,r,i){n.options={...i,signAndProcess:!1};let{signableTransaction:a}=await t.createAction(n,r);if(a==null)throw Error(`Wallet createAction did not return signableTransaction`);let o=e.fromBEEF(a.tx),s=await this.buildWalletSpends(o),c=i==null?void 0:{acceptDelayedBroadcast:i.acceptDelayedBroadcast,returnTXIDOnly:i.returnTXIDOnly,noSend:i.noSend,sendWith:i.sendWith},l=await t.signAction({reference:a.reference,spends:s,options:c},r);if(l.tx==null)throw Error(`Wallet signAction did not return transaction data`);return l.tx}async buildWalletSpends(e){let t={};for(let n=0;n<this.inputs.length;n++){let r=this.inputs[n];if(r.unlockingScriptTemplate!=null){let i=await r.unlockingScriptTemplate.sign(e,n);t[n]={unlockingScript:i.toHex()}}else r.unlockingScript!=null&&(t[n]={unlockingScript:r.unlockingScript.toHex()})}return t}async completeWalletScriptAction(e,t,n,r){r!=null&&(t.options=r);let{tx:i}=await e.createAction(t,n);if(i==null)throw Error(`Wallet createAction did not return transaction data`);return i}preimage(e,t,n){if(e??=0,t??=Kr.SIGHASH_FORKID|Kr.SIGHASH_ALL,e<0||e>=this.inputs.length)throw Error(`Invalid input index`);let r=t&240;if(r!==224&&r!==192&&r!==64)throw Error(`FORKID must be set`);let i=t&15;if(i<1||i>3)throw Error(`Invalid signature coverage, must be all, none or single`);let a=this.inputs[e];if(a.sourceTransaction==null)throw Error(`Source transaction is required`);let o=a.sourceTransaction.outputs[a.sourceOutputIndex];if(o==null)throw Error(`Source transaction's output at index ${a.sourceOutputIndex} is required`);return Kr.format({sourceTXID:a.sourceTXID??a.sourceTransaction.id(`hex`),sourceOutputIndex:a.sourceOutputIndex,sourceSatoshis:o.satoshis,transactionVersion:this.version,otherInputs:[],allInputs:this.inputs,inputIndex:e,outputs:this.outputs,inputSequence:a.sequence??4294967295,subscript:n??o.lockingScript,lockTime:this.lockTime,scope:t})}},A=a(),da=l(),fa=Object.defineProperty,pa=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),j=(e,t)=>{let n={};for(var r in e)fa(n,r,{get:e[r],enumerable:!0});return t&&fa(n,Symbol.toStringTag,{value:`Module`}),n},ma=new Set([`https://json-schema.org/draft/2019-09/schema`,`http://json-schema.org/draft/2019-09/schema`]);function ha(e){return typeof e==`string`&&ma.has(e.replace(/#$/,``))}function ga(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function _a(e,t=`|`){return e.map(e=>Wa(e)).join(t)}function va(e,t){return typeof t==`bigint`?t.toString():t}var ya=class{constructor(e){this._getter=e,this._value=void 0}get value(){let e=this._getter;return e!==void 0&&(this._value=e(),this._getter=void 0),this._value}};function ba(e){return new ya(e)}function xa(e){return e==null}function Sa(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function Ca(e,t){let n=e/t,r=Math.round(n),i=4*2**-52*Math.max(Math.abs(n),1);return Math.abs(n-r)<i?0:n-r}var wa=Symbol(`evaluating`);function Ta(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==wa)return r===void 0&&(r=wa,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function Ea(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Da(e){let t=Object.getOwnPropertyDescriptor(e,`shape`);return t?.get?t.get.raw:t?.value}function Oa(e){return Da(e._zod.def)??e._zod.def.shape}function ka(e,t,n){Object.defineProperty(e,t,{get(){let e=n();return Ea(this,t,e),e},enumerable:!0,configurable:!0})}function Aa(e,t,n){t in e?Ea(e,t,n):e[t]=n}function ja(e,t,n,r){let i=Oa(t);for(let a of n){let n=Object.getOwnPropertyDescriptor(i,a);n.enumerable&&(n.get?ka(e,a,()=>{let e=t._zod.def.shape[a];return r?r(e,a):e}):Aa(e,a,r?r(n.value,a):n.value))}}function Ma(e,t){for(let n of Reflect.ownKeys(t)){let r=Object.getOwnPropertyDescriptor(t,n);r.enumerable&&(r.get?ka(e,n,()=>t[n]):Aa(e,n,r.value))}}function Na(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function Pa(e){return JSON.stringify(e)}function Fa(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var Ia=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function La(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var Ra=ba(()=>{if(Po.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function za(e){if(La(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return La(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}function Ba(e){return za(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}var Va=new Set([`string`,`number`,`symbol`]);function Ha(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function Ua(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function M(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw 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 Wa(e){return typeof e==`bigint`?e.toString()+`n`:typeof e==`string`?`"${e}"`:`${e}`}function Ga(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout===`optional`)}var Ka={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},qa={int64:[BigInt(`-9223372036854775808`),BigInt(`9223372036854775807`)],uint64:[BigInt(0),BigInt(`18446744073709551615`)]};function Ja(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);let i={};return ja(i,e,Ya(e,t)),Ua(e,Na(n,{shape:i,checks:[]}))}function Ya(e,t){let n=Oa(e),r=[];for(let e of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(n,e)?.enumerable)throw Error(`Unrecognized key: "${String(e)}"`);t[e]&&r.push(e)}return r}function Xa(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);let i=new Set(Ya(e,t)),a={};return ja(a,e,Reflect.ownKeys(Oa(e)).filter(e=>!i.has(e))),Ua(e,Na(n,{shape:a,checks:[]}))}function Za(e,t){if(!za(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=Oa(e);for(let e of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return Ua(e,Na(e._zod.def,{shape:Qa(e,t)}))}function Qa(e,t){let n={};return ja(n,e,Reflect.ownKeys(Oa(e))),Ma(n,t),n}function $a(e,t){if(!za(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return Ua(e,Na(e._zod.def,{shape:Qa(e,t)}))}function eo(e,t){if(!t?._zod?.def)throw Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);let n={};return ja(n,e,Reflect.ownKeys(Oa(e))),ja(n,t,Reflect.ownKeys(Oa(t))),Ua(e,Na(e._zod.def,{shape:n,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function to(e,t,n,r=`partial`){let i=t._zod.def.checks;if(i&&i.length>0)throw Error(`.${r}() cannot be used on object schemas containing refinements`);let a=n?new Set(Ya(t,n)):void 0,o={};return ja(o,t,Reflect.ownKeys(Oa(t)),e&&((t,n)=>a&&!a.has(n)?t:new e({type:`optional`,innerType:t}))),Ua(t,Na(t._zod.def,{shape:o,checks:[]}))}function no(e,t,n){let r=n?new Set(Ya(t,n)):void 0,i={};return ja(i,t,Reflect.ownKeys(Oa(t)),(t,n)=>r&&!r.has(n)?t:new e({type:`nonoptional`,innerType:t})),Ua(t,Na(t._zod.def,{shape:i}))}function ro(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function io(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function ao(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function oo(e){return typeof e==`string`?e:e?.message}function so(e,t,n){var r;for(let i=t;i<e.length;i++)(r=e[i]).schema??(r.schema=n)}function co(e,t,n){var r;let i=e.inst?._zod?.traits;i?.has(`$ZodType`)&&(i.has(`$ZodCheck`)?(r=e).schema??(r.schema=e.inst):e.schema=e.inst);let a=e.schema===e.inst?void 0:e.schema?._zod.def?.error,o=e.message?e.message:oo(e.inst?._zod.def?.error?.(e))??oo(a?.(e))??oo(t?.error?.(e))??oo(n.customError?.(e))??oo(n.localeError?.(e))??`Invalid input`,s={};for(let t of Object.keys(e))t!==`inst`&&t!==`schema`&&t!==`continue`&&t!==`input`&&t!==`__proto__`&&(s[t]=e[t]);return s.path??=[],s.message=o,t?.reportInput&&(s.input=e.input),s}var lo=/[\uD800-\uDBFF]/;function uo(e){let t=e.length;if(!lo.test(e))return t;let n=t;for(let r=0;r<t-1;r++)(e.charCodeAt(r)&64512)==55296&&(e.charCodeAt(r+1)&64512)==56320&&(n--,r++);return n}function fo(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function po(e){let t=typeof e;switch(t){case`number`:return Number.isNaN(e)?`nan`:`number`;case`object`:{if(e===null)return`null`;if(Array.isArray(e))return`array`;let t=e;if(t&&Object.getPrototypeOf(t)!==Object.prototype&&`constructor`in t&&t.constructor)return t.constructor.name}}return t}function mo(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}function ho(e,t){for(let n in t){let r=Object.getOwnPropertyDescriptor(t,n);r.get?Object.defineProperty(e,n,{...r,enumerable:!1}):yo(e,n,r.value)}for(let n of Object.getOwnPropertySymbols(t))yo(e,n,t[n])}function go(e,t,n,r=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:r,value:n}),n}function _o(e,t,n){return go(e,t,n,!1)}function vo(e,t){for(let n in e){let r=e[n];Object.defineProperty(t,n,{configurable:!0,enumerable:!0,get(){return go(this,n,r(this))},set(e){go(this,n,e)}})}return t}function yo(e,t,n){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?n:go(this,t,n.bind(this))},set(e){go(this,t,e)}})}function bo(e,t){let n=Object.getPrototypeOf(e);return t in n?void 0:n}var xo,So=!1,Co={configurable:!0,get(){So=!0}};function N(e,t,n){let r=Object.getPrototypeOf(e._zod);if(t in r&&xo!==e._zod){xo=void 0;return}xo=e._zod,Object.defineProperty(r,t,{configurable:!0,get(){Object.defineProperty(this,t,Co);let e=So;So=!1;try{let r=n(this);return So?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:r}),So||=e,r}catch(n){throw delete this[t],So||=e,n}},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:e})}})}function wo(e,t,n,r){let i=bo(e,t);i&&Object.defineProperty(i,t,{configurable:!0,get(){let e={configurable:!0,writable:!0,enumerable:r,value:void 0};return Object.defineProperty(this,t,e),e.value=n(this),Object.defineProperty(this,t,e),e.value},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:r,value:e})}})}var To=`~constantCatch`;function Eo(e){let t=()=>e;return t[To]=!0,t}var Do,Oo=Object.freeze({status:`aborted`}),ko={value:void 0,enumerable:!1},Ao=`captureStackTrace`in Error?Error:null;function jo(e){let t=Ao;if(t){let n=t.stackTraceLimit;if(typeof n==`number`){try{t.stackTraceLimit=0}catch{return Ao=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}function P(e,t,n,r){let i={};function a(e){this.def=e,this.constr=d,this.traits=new Set}a.prototype=i;let o=n,s=o&&new WeakSet;function c(n,r){if(!n._zod){ko.value=new a(r);try{Object.defineProperty(n,"_zod",ko)}finally{ko.value=void 0}}if(n._zod.traits.has(e))return;if(n._zod.traits.add(e),t(n,r),s){let e=Object.getPrototypeOf(n),t=n._zod.constr.prototype,r=e;for(;r&&r!==t;)r=Object.getPrototypeOf(r);let i=r??e;s.has(i)||(s.add(i),ho(i,o))}let i=d.prototype;for(let e in i)Object.prototype.hasOwnProperty.call(i,e)&&(e in n||(n[e]=i[e].bind(n)))}let l=r?.Parent??Object;class u extends l{}Object.defineProperty(u,"name",{value:e});function d(e){let t=r?.Parent?jo(u):this;c(t,e);let n=t._zod.deferred;if(n){for(let e of n)e();t._zod.deferred=void 0}let i=globalThis.__zod_globalConfig?.postProcessor;return i&&i(t),t}return Object.defineProperty(d,"init",{value:c}),Object.defineProperty(d,Symbol.hasInstance,{value:t=>r?.Parent&&t instanceof r.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(d,"name",{value:e}),d}var Mo=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},No=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(Do=globalThis).__zod_globalConfig??(Do.__zod_globalConfig={});var Po=globalThis.__zod_globalConfig;function Fo(e){return e&&Object.assign(Po,e),Po}function Io(){let e=this._zod;return e.message??=JSON.stringify(e.def,va,2),e.message}function Lo(e){this._zod.message=e}var Ro={get:Io,set:Lo,enumerable:!0,configurable:!0},zo={value:void 0,enumerable:!1},Bo=new WeakSet([Object.prototype,Error.prototype]),Vo=(e,t)=>{e.name=`$ZodError`,zo.value=t,Object.defineProperty(e,"issues",zo),zo.value=void 0,Object.defineProperty(e,"message",Ro);let n=Object.getPrototypeOf(e);Bo.has(n)||(Bo.add(n),Object.defineProperty(n,"toString",{configurable:!0,enumerable:!1,get(){let e=()=>this.message;return Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0})}}))},Ho=P(`$ZodError`,Vo);P(`$ZodError`,Vo,void 0,{Parent:Error});function Uo(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 Wo(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?Uo(n,i.path[0],()=>[]).push(t(i)):r.push(t(i));return{formErrors:r,fieldErrors:n}}function Go(e,t=e=>e.message){let n={_errors:[]},r=(e,i=[])=>{for(let a of e.issues)if(a.code===`invalid_union`&&a.errors.length)a.errors.map(e=>r({issues:e},[...i,...a.path]));else if(a.code===`invalid_key`)r({issues:a.issues},[...i,...a.path]);else if(a.code===`invalid_element`)r({issues:a.issues},[...i,...a.path]);else{let e=[...i,...a.path];if(e.length===0)n._errors.push(t(a));else{let r=n,i=0;for(;i<e.length;){let n=e[i],o=i===e.length-1;if(n===`_errors`){o&&r._errors.push(t(a)),i++;continue}Object.prototype.hasOwnProperty.call(r,n)||Object.defineProperty(r,n,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let s=r[n];o&&s._errors.push(t(a)),r=s,i++}}}};return r(e),n}function Ko(e,t){return{callee:t?.callee??e,Err:t?.Err}}var qo=e=>{let t=(n,r,i,a)=>{let o=i?{...i,async:!1}:{async:!1},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new Mo;if(s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>co(e,o,Fo())));throw Ia(n,a?.callee??t),n}return s.value};return t},Jo=e=>{let t=async(n,r,i,a)=>{let o=i?{...i,async:!0}:{async:!0},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise&&(s=await s),s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>co(e,o,Fo())));throw Ia(n,a?.callee??t),n}return s.value};return t},F=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new Mo;return a.issues.length?Yo(e,a.issues,i):{success:!0,data:a.value}};function Yo(e,t,n){let r;return{success:!1,get error(){return r||(r=new e(t.map(e=>co(e,n,Fo()))),t=void 0,n=void 0),r},set error(e){r=e,t=void 0,n=void 0}}}var Xo=e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?Yo(e,a.issues,i):{success:!0,data:a.value}},Zo=Symbol.for(`zod.compile.invalid`),Qo=Symbol.for(`zod.compile.fallback`),$o=((e,t,n)=>{let r=e._zod.bag.validator;if(r!==void 0){if(r(t)!==Zo)return!0;if(r.definite===!0&&n===void 0)return!1}return es(e,t,n)});function es(e,t,n){let r=n?{...n,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},i=e._zod.bag.fallbackRun,a;if(i?(r[Qo]=!0,a=i({value:t,issues:[]},r)):a=e._zod.run({value:t,issues:[]},r),a instanceof Promise)throw new Mo;return a.issues.length===0}var ts=async(e,t,n)=>{let r=n?{...n,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},i=e._zod.run({value:t,issues:[]},r);return i instanceof Promise&&(i=await i),i.issues.length===0},ns=e=>{let t=qo(e),n=(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return t(e,r,o,Ko(n,a))};return n},rs=e=>{let t=qo(e),n=(e,r,i,a)=>t(e,r,i,Ko(n,a));return n},is=e=>{let t=Jo(e),n=async(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return await t(e,r,o,Ko(n,a))};return n},as=e=>{let t=Jo(e),n=async(e,r,i,a)=>await t(e,r,i,Ko(n,a));return n},os=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return F(e)(t,n,i)},ss=e=>(t,n,r)=>F(e)(t,n,r),cs=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Xo(e)(t,n,i)},ls=e=>async(t,n,r)=>Xo(e)(t,n,r),us=/^[cC][0-9a-z]{6,}$/,ds=/^[0-9a-z]+$/,fs=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,ps=/^[0-9a-vA-V]{20}$/,ms=/^[A-Za-z0-9]{27}$/,hs=/^[a-zA-Z0-9_-]{21}$/;function gs(e){return RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var _s=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,vs=/^([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})$/,ys=e=>e?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)$/,bs=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,xs=`^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`;function Ss(){return new RegExp(xs,`u`)}var Cs=/^(?:(?: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])$/,ws=/^(([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}|:))$/,Ts=/^((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])$/,Es=/^(([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])$/,Ds=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Os=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/,ks=/^https?$/,As=/^\+[1-9]\d{6,14}$/,js=`(?:(?:\\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 Ms(e){return RegExp(`^${e}$`)}var Ns=Ms(js);function Ps(e){let 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 Fs(e){return RegExp(`^${Ps(e)}$`)}function Is(e){let t=[`Z`];e.offset&&t.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let n=`${Ps({precision:e.precision,seconds:!0})}(?:${t.join(`|`)})`,r=e.local?`${n}|${Ps({precision:e.precision})}`:n;return RegExp(`^${js}T(?:${r})$`)}var Ls=/^[\s\S]{0,}$/,Rs=/^-?\d+$/,zs=/^-?\d+(?:\.\d+)?$/,Bs=/^(?:true|false)$/i,Vs=/^null$/i,Hs=/^undefined$/i,Us=/^[^A-Z]*$/,Ws=/^[^a-z]*$/,Gs=P(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Ks=e=>{let t=e.value;return!xa(t)&&t.length!==void 0},qs={number:`number`,bigint:`bigint`,object:`date`},Js=P(`$ZodCheckLessThan`,(e,t)=>{Gs.init(e,t);let n=qs[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:qs[typeof r.value]??n,code:`too_big`,maximum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Ys=P(`$ZodCheckGreaterThan`,(e,t)=>{Gs.init(e,t);let n=qs[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:qs[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})}}),Xs=P(`$ZodCheckMultipleOf`,(e,t)=>{Gs.init(e,t),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?t.value!==BigInt(0)&&n.value%t.value===BigInt(0):Ca(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})}}),Zs=P(`$ZodCheckNumberFormat`,(e,t)=>{Gs.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=Ka[t.format];e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),Qs=P(`$ZodCheckMaxLength`,(e,t)=>{var n;Gs.init(e,t),(n=e._zod.def).when??(n.when=Ks),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>t.maximum?uo(r):i)<=t.maximum)return;let a=fo(r);n.issues.push({origin:a,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),$s=P(`$ZodCheckMinLength`,(e,t)=>{var n;Gs.init(e,t),(n=e._zod.def).when??(n.when=Ks),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>=t.minimum&&i<t.minimum*2?uo(r):i)>=t.minimum)return;let a=fo(r);n.issues.push({origin:a,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),ec=P(`$ZodCheckLengthEquals`,(e,t)=>{var n;Gs.init(e,t),(n=e._zod.def).when??(n.when=Ks),e._zod.check=n=>{let r=n.value,i=r.length,a=typeof r==`string`&&i>=t.length&&i<=t.length*2?uo(r):i;if(a===t.length)return;let o=fo(r),s=a>t.length;n.issues.push({origin:o,...s?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),tc=P(`$ZodCheckStringFormat`,(e,t)=>{var n,r;Gs.init(e,t),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),nc=P(`$ZodCheckRegex`,(e,t)=>{tc.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})}}),rc=P(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=Us,tc.init(e,t)}),ic=P(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=Ws,tc.init(e,t)}),ac=P(`$ZodCheckIncludes`,(e,t)=>{Gs.init(e,t);let n=Ha(t.includes);t.pattern=new RegExp(typeof t.position==`number`?`^.{${t.position},}${n}`:n),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),oc=P(`$ZodCheckStartsWith`,(e,t)=>{Gs.init(e,t);let n=RegExp(`^${Ha(t.prefix)}.*`);t.pattern??=n,e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),sc=P(`$ZodCheckEndsWith`,(e,t)=>{Gs.init(e,t);let n=RegExp(`.*${Ha(t.suffix)}$`);t.pattern??=n,e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),cc=P(`$ZodCheckOverwrite`,(e,t)=>{Gs.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),lc=class{constructor(e=[],t={}){this.content=[],this.indent=0,this.args=e,this.closed=t}indented(e){this.indent+=1;try{e(this)}finally{--this.indent}}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
13
- `).filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>` `.repeat(this.indent*2)+e);for(let e of r)this.content.push(e)}compile(){let e=Function,t=this?.content??[``];return new e(...Object.keys(this.closed),`return function (${this.args.join(`, `)}) {\n${t.join(`
14
- `)}\n};`)(...Object.values(this.closed))}},uc={major:4,minor:6,patch:1},dc=P(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=uc;let r=e._zod.def.checks,i=e._zod.traits.has(`$ZodCheck`)?[e,...r??[]]:r?.length?[...r]:[];for(let t of i)for(let n of t._zod.onattach)n(e);if(i.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(t,n,r)=>{if(t.memo)return t;let i=ro(t),a;for(let o of n){if(o._zod.def.when){if(io(t)||!o._zod.def.when(t))continue}else if(i)continue;let n=t.issues.length,s=o._zod.check(t);if(s instanceof Promise&&r?.async===!1)throw new Mo;if(a||s instanceof Promise)a=(a??Promise.resolve()).then(async()=>{await s,t.issues.length!==n&&(so(t.issues,n,e),i||=ro(t,n))});else{if(t.issues.length===n)continue;so(t.issues,n,e),i||=ro(t,n)}}return a?a.then(()=>t):t},n=(n,r,a)=>{if(ro(n))return n.aborted=!0,n;let o=t(r,i,a);if(o instanceof Promise){if(a.async===!1)throw new Mo;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(r,a)=>{if(a.skipChecks)return e._zod.parse(r,a);if(a.direction===`backward`){let t=e._zod.parse({value:r.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,r,a)):n(t,r,a)}let o=e._zod.parse(r,a);if(o instanceof Promise){if(a.async===!1)throw new Mo;return o.then(e=>t(e,i,a))}return t(o,i,a)}}},{get"~standard"(){return _o(this,`~standard`,mc(this))},set"~standard"(e){go(this,`~standard`,e)}}),fc=(e,t)=>e.issues.length?{issues:e.issues.map(e=>co(e,t,Fo()))}:{value:e.value};async function pc(e,t){let n={async:!0};return fc(await e._zod.run({value:t,issues:[]},n),n)}function mc(e){return{validate:t=>{let n={async:!1};try{let r=e._zod.run({value:t,issues:[]},n);if(!(r instanceof Promise))return fc(r,n)}catch{}return pc(e,t)},vendor:`zod`,version:1}}var hc=P(`$ZodString`,(e,t)=>{dc.init(e,t),e._zod.pattern=t.pattern??Ls,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}}),gc=P(`$ZodStringFormat`,(e,t)=>{tc.init(e,t),hc.init(e,t)}),_c=P(`$ZodGUID`,(e,t)=>{t.pattern??=vs,gc.init(e,t)}),vc=P(`$ZodUUID`,(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(e===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??=ys(e)}else t.pattern??=ys();gc.init(e,t)}),yc=P(`$ZodEmail`,(e,t)=>{t.pattern??=bs,gc.init(e,t)});function bc(e,t){if(!t.normalize&&t.protocol?.source===ks.source&&!/^https?:\/\//i.test(e))return 1;try{return new URL(e)}catch{return 2}}var xc=/[\t\n\r]/g;function Sc(e){return e.replace(xc,``)}function Cc(e,t){return t.lastIndex=0,t.test(e.hostname)}function wc(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(`:`)?e.protocol.slice(0,-1):e.protocol)}var Tc=P(`$ZodURL`,(e,t)=>{gc.init(e,t),e._zod.check=n=>{try{let r=n.value.trim(),i=bc(r,t);if(i===1){n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid URL format`,input:n.value,inst:e,continue:!t.abort});return}if(i===2){n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort});return}t.hostname&&!Cc(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&&!wc(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:Sc(r);return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),Ec=P(`$ZodEmoji`,(e,t)=>{t.pattern??=Ss(),gc.init(e,t)}),Dc=P(`$ZodNanoID`,(e,t)=>{if(t.length!==void 0&&(!Number.isInteger(t.length)||t.length<1))throw Error(`Invalid nanoid length: ${t.length}`);t.pattern??=t.length===void 0?hs:gs(t.length),gc.init(e,t)}),Oc=P(`$ZodCUID`,(e,t)=>{t.pattern??=us,gc.init(e,t)}),kc=P(`$ZodCUID2`,(e,t)=>{t.pattern??=ds,gc.init(e,t)}),Ac=P(`$ZodULID`,(e,t)=>{t.pattern??=fs,gc.init(e,t)}),jc=P(`$ZodXID`,(e,t)=>{t.pattern??=ps,gc.init(e,t)}),Mc=P(`$ZodKSUID`,(e,t)=>{t.pattern??=ms,gc.init(e,t)}),Nc=P(`$ZodISODateTime`,(e,t)=>{t.pattern??=Is(t),gc.init(e,t)}),Pc=P(`$ZodISODate`,(e,t)=>{t.pattern??=Ns,gc.init(e,t)}),Fc=P(`$ZodISOTime`,(e,t)=>{t.pattern??=Fs(t),gc.init(e,t)}),Ic=P(`$ZodISODuration`,(e,t)=>{t.pattern??=_s,gc.init(e,t)}),Lc=P(`$ZodIPv4`,(e,t)=>{t.pattern??=Cs,gc.init(e,t)}),Rc=/^[0-9a-fA-F:.]+$/;function zc(e){if(!Rc.test(e))return!1;try{return new URL(`http://[${e}]`),!0}catch{return!1}}var Bc=P(`$ZodIPv6`,(e,t)=>{t.pattern??=ws,gc.init(e,t),e._zod.check=n=>{zc(n.value)||n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}),Vc=P(`$ZodCIDRv4`,(e,t)=>{t.pattern??=Ts,gc.init(e,t)});function Hc(e){let t=e.split(`/`);if(t.length!==2)return!1;let[n,r]=t;if(!r)return!1;let i=Number(r);return`${i}`!==r||i<0||i>128?!1:zc(n)}var Uc=P(`$ZodCIDRv6`,(e,t)=>{t.pattern??=Es,gc.init(e,t),e._zod.check=n=>{Hc(n.value)||n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}});function Wc(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var Gc=/^[0-9a-zA-Z+/]*={0,2}$/,Kc=P(`$ZodBase64`,(e,t)=>{t.pattern??=Gc,gc.init(e,t),e._zod.check=n=>{Wc(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}}),qc=/^[A-Za-z0-9_-]*$/;function Jc(e){if(!qc.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return Wc(t.padEnd(Math.ceil(t.length/4)*4,`=`))}var Yc=P(`$ZodBase64URL`,(e,t)=>{t.pattern??=qc,gc.init(e,t),e._zod.check=n=>{Jc(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),Xc=P(`$ZodE164`,(e,t)=>{t.pattern??=As,gc.init(e,t)});function Zc(e,t=null){try{let n=e.split(`.`);if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));return!(`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&(!(`alg`in i)||i.alg!==t))}catch{return!1}}var Qc=P(`$ZodJWT`,(e,t)=>{gc.init(e,t),e._zod.check=n=>{Zc(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),$c=P(`$ZodNumber`,(e,t)=>{dc.init(e,t),e._zod.pattern=zs,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let i=n.value;if(typeof i==`number`&&!Number.isNaN(i)&&Number.isFinite(i))return n;let a=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,...a?{received:a}:{}}),n}}),el=P(`$ZodNumberFormat`,(e,t)=>{Zs.init(e,t),$c.init(e,t)}),tl=P(`$ZodBoolean`,(e,t)=>{dc.init(e,t),e._zod.pattern=Bs,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}let i=n.value;return typeof i==`boolean`||n.issues.push({expected:`boolean`,code:`invalid_type`,input:i,inst:e}),n}}),nl=P(`$ZodUndefined`,(e,t)=>{dc.init(e,t),e._zod.pattern=Hs,e._zod.values=new Set([void 0]),e._zod.parse=(t,n)=>{let r=t.value;return r===void 0||t.issues.push({expected:`undefined`,code:`invalid_type`,input:r,inst:e}),t}}),rl=P(`$ZodNull`,(e,t)=>{dc.init(e,t),e._zod.pattern=Vs,e._zod.values=new Set([null]),e._zod.parse=(t,n)=>{let r=t.value;return r===null||t.issues.push({expected:`null`,code:`invalid_type`,input:r,inst:e}),t}}),il=P(`$ZodAny`,(e,t)=>{dc.init(e,t),e._zod.parse=e=>e}),al=P(`$ZodUnknown`,(e,t)=>{dc.init(e,t),e._zod.parse=e=>e}),ol=P(`$ZodNever`,(e,t)=>{dc.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function sl(e,t,n){e.issues.length&&t.issues.push(...ao(n,e.issues)),t.value[n]=e.value}var cl=P(`$ZodArray`,(e,t)=>{dc.init(e,t);let n=Po.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!Array.isArray(a))return r.issues.push({expected:`array`,code:`invalid_type`,input:a,inst:e}),r;r.value=n?n.alloc(e,r,Array(a.length),i):Array(a.length);let o=[],s=i?.abortEarly;for(let e=0;e<a.length;e++){let n=a[e],c=t.element._zod.run({value:n,issues:[]},i);if(c instanceof Promise)o.push(c.then(t=>sl(t,r,e)));else if(sl(c,r,e),s&&c.issues.length!==0&&ro(c))break}return o.length?Promise.all(o).then(()=>r):r}});function ll(e,t,n,r,i,a){let o=n in r,s=a===`optional`;if(o||!s||i!==`optional`){if(e.issues.length){if(i!==void 0&&s&&!o)return;t.issues.push(...ao(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&&(t.value[n]=void 0):t.value[n]=e.value}}var ul=[];function dl(e){let t=Object.keys(e.shape),n=Object.getOwnPropertySymbols(e.shape),r=n.length?n:ul,i=r.length?[...t,...r]:t;for(let t of i)if(!e.shape?.[t]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${String(t)}": expected a Zod schema`);let a=Ga(e.shape);return{...e,allKeys:i,symbolKeys:r,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(a)}}function fl(e,t,n,r,i,a,o){let s=[],c=i.keySet,l=i.catchall._zod,u=l.def.type,d=l.optin,f=l.optout,p=0;for(let i in t){if(o&&n.issues.length!==p){if(ro(n,p))break;p=n.issues.length}if(c.has(i))continue;if(i===`__proto__`){u===`never`&&s.push(i);continue}if(u===`never`){s.push(i);continue}let a=l.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>ll(e,n,i,t,d,f))):ll(a,n,i,t,d,f)}return s.length&&n.issues.push({code:`unrecognized_keys`,keys:s,input:t,inst:a,continue:!0}),e.length?Promise.all(e).then(()=>n):n}var pl=P(`$ZodObject`,(e,t)=>{dc.init(e,t);let n=Object.getOwnPropertyDescriptor(t,`shape`),r=n?.get?n.get.raw:t.shape??{};if(r){let e=()=>{let n={...r};return Object.defineProperty(t,"shape",{value:n}),e.raw=n,n};e.raw=r,Object.defineProperty(t,"shape",{get:e})}let i=ba(()=>dl(t));N(e,`propValues`,e=>{let t=e.def.shape,n={};for(let e in t){let r=t[e]._zod;if(r.values){Object.prototype.hasOwnProperty.call(n,e)||Ea(n,e,new Set);for(let t of r.values)n[e].add(t);r.optin!==void 0&&n[e].add(void 0)}}return n});let a=La,o=t.catchall,s,c=Po.memoizer;c?.attach(e),e._zod.parse=(t,n)=>{s??=i.value;let r=t.value;if(!a(r))return t.issues.push({expected:`object`,code:`invalid_type`,input:r,inst:e}),t;t.value=c?c.alloc(e,t,{},n):{};let l=[],u=s.shape,d=n?.abortEarly,f=t.issues.length;for(let e of s.allKeys){if(d&&t.issues.length!==f){if(ro(t,f))break;f=t.issues.length}if(e===`__proto__`)continue;let i=u[e],a=i._zod.optin,o=i._zod.optout,s=i._zod.run({value:r[e],issues:[]},n);s instanceof Promise?l.push(s.then(n=>ll(n,t,e,r,a,o))):ll(s,t,e,r,a,o)}return o?fl(l,r,t,n,i.value,e,d===!0):l.length?Promise.all(l).then(()=>t):t}}),ml=P(`$ZodObjectJIT`,(e,t)=>{pl.init(e,t);let n=e._zod.parse,r=ba(()=>dl(t)),i=Po.memoizer,a=t=>{let n=r.value,a=n.symbolKeys,o=new lc([`payload`,`ctx`],{shape:t,inst:e,memo:i,syms:a}),s=e=>`shape[${e}]._zod.run({ value: input[${e}], issues: [] }, ctx)`,c=(e,t)=>`
15
- let ${e}_ab = false;
16
- for (let i = 0; i < ${e}.issues.length; i++) {
17
- const iss = ${e}.issues[i];
18
- iss.path = iss.path ? [${t}, ...iss.path] : [${t}];
19
- payload.issues.push(iss);
20
- if (iss.continue !== true) ${e}_ab = true;
21
- }
22
- if (${e}_ab && ctx && ctx.abortEarly) {
23
- payload.value = newResult;
24
- return payload;
25
- }`;o.write(`const input = payload.value;`);let l=Object.create(null),u=0;for(let e of n.allKeys)l[e]=`key_${u++}`;o.write(i?`const newResult = memo.alloc(inst, payload, {}, ctx);`:`const newResult = {};`);for(let e of n.allKeys){if(e===`__proto__`)continue;let n=l[e],r=typeof e==`symbol`?`syms[${a.indexOf(e)}]`:Pa(e),i=`${r} in input`,u=t[e],d=u?._zod?.optin,f=d!==void 0,p=u?._zod?.optout===`optional`;if(o.write(`const ${n} = ${s(r)};`),f&&p){let e=d===`optional`?`${n}_present`:`${n}.value !== undefined || ${n}_present`;o.write(`
26
- const ${n}_present = ${i};
27
- if (!${n}.issues.length || ${n}_present) {
28
- if (${n}.issues.length) {${c(n,r)}
29
- }
30
-
31
- if (${e}) {
32
- newResult[${r}] = ${n}.value;
33
- }
34
- }
35
-
36
- `)}else f?o.write(`
37
- if (${n}.issues.length) {${c(n,r)}
38
- }
39
-
40
- if (${n}.value === undefined) {
41
- if (${i}) {
42
- newResult[${r}] = undefined;
43
- }
44
- } else {
45
- newResult[${r}] = ${n}.value;
46
- }
47
-
48
- `):o.write(`
49
- const ${n}_present = ${i};
50
- if (${n}.issues.length) {${c(n,r)}
51
- }
52
- if (!${n}_present && !${n}.issues.length) {
53
- payload.issues.push({
54
- code: "invalid_type",
55
- expected: "nonoptional",
56
- input: undefined,
57
- path: [${r}]
58
- });
59
- if (ctx && ctx.abortEarly) {
60
- payload.value = newResult;
61
- return payload;
62
- }
63
- }
64
-
65
- if (${n}_present) {
66
- newResult[${r}] = ${n}.value;
67
- }
68
-
69
- `)}return o.write(`payload.value = newResult;`),o.write(`return payload;`),o.compile()},o,s=La,c=!Po.jitless,l=c&&Ra.value,u=t.catchall,d;e._zod.parse=(i,f)=>{d??=r.value;let p=i.value;return s(p)?c&&l&&f?.async===!1&&f.jitless!==!0?(o||=a(t.shape),i=o(i,f),u?fl([],p,i,f,d,e,f?.abortEarly===!0):i):n(i,f):(i.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),i)}});function hl(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!ro(e));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(e=>e.issues.map(e=>co(e,r,Fo())))}),t)}var gl=P(`$ZodUnion`,(e,t)=>{dc.init(e,t),N(e,`optin`,e=>e.def.options.some(e=>e._zod.optin===`defaulted`)?`defaulted`:e.def.options.some(e=>e._zod.optin!==void 0)?`optional`:void 0),N(e,`optout`,e=>e.def.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),N(e,`values`,e=>{if(e.def.options.every(e=>e._zod.values))return new Set(e.def.options.flatMap(e=>Array.from(e._zod.values)))}),N(e,`pattern`,e=>{if(e.def.options.every(e=>e._zod.pattern)){let t=e.def.options.map(e=>e._zod.pattern);return RegExp(`^(${t.map(e=>Sa(e.source)).join(`|`)})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let a=!1,o=[];for(let e of t.options){let t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)o.push(t),a=!0;else{if(t.issues.length===0)return t;o.push(t)}}return a?Promise.all(o).then(t=>hl(t,r,e,i)):hl(o,r,e,i)}});function _l(e){let t=new Map;for(let n of e.options){let r=n._zod.propValues?.[e.discriminator];if(!r||r.size===0)throw Error(`Invalid discriminated union option at index "${e.options.indexOf(n)}"`);for(let e of r)if(t.has(e)){if(e!==void 0)throw Error(`Duplicate discriminator value "${String(e)}"`);t.set(e,null)}else t.set(e,n)}return t}var vl=P(`$ZodDiscriminatedUnion`,(e,t)=>{t.inclusive=!1,gl.init(e,t);let n=e._zod.parse;N(e,`propValues`,e=>{let t={},n=0;for(let r of e.def.options){let i=r._zod.propValues;if(!i||Object.keys(i).length===0)throw Error(`Invalid discriminated union option at index "${e.def.options.indexOf(r)}"`);i[e.def.discriminator]?.has(void 0)&&n++;for(let[e,n]of Object.entries(i)){Object.prototype.hasOwnProperty.call(t,e)||Ea(t,e,new Set);for(let r of n)t[e].add(r)}}return!e.def.unionFallback&&n>1&&t[e.def.discriminator]?.delete(void 0),t}),t.options.forEach((e,n)=>{let r=Da(e._zod.def);if(r&&!Object.prototype.hasOwnProperty.call(r,t.discriminator))throw Error(`Invalid discriminated union option at index "${n}"`)});let r=ba(()=>_l(t));e._zod.parse=(i,a)=>{let o=i.value;if(!La(o))return i.issues.push({code:`invalid_type`,expected:`object`,input:o,inst:e}),i;let s=o?.[t.discriminator],c=r.value.get(s);return c&&(s!==void 0||a.direction!==`backward`)?c._zod.run(i,a):t.unionFallback||a.direction===`backward`?n(i,a):(i.issues.push({code:`invalid_union`,errors:[],note:`No matching discriminator`,discriminator:t.discriminator,options:Array.from(r.value.keys()).filter(e=>r.value.get(e)!==null),input:o,path:[t.discriminator],inst:e}),i)}}),yl=P(`$ZodIntersection`,(e,t)=>{dc.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>xl(e,t,n)):xl(e,i,a)}});function bl(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(za(e)&&za(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};Object.prototype.hasOwnProperty.call(i,`__proto__`)&&delete i.__proto__;for(let n of r){if(n===`__proto__`)continue;let r=bl(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=bl(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function xl(e,t,n){let r=new Map,i,a=new Map,o=(e,t)=>{let n;if(e.code===`unrecognized_keys`&&!e.path?.length)i??=e,n=e.keys;else if(e.code===`invalid_key`&&e.origin===`record`&&e.path?.length===1){let t=String(e.path[0]);a.has(t)||a.set(t,e),n=[t]}else return!1;for(let e of n)r.has(e)||r.set(e,{}),r.get(e)[t]=!0;return!0};for(let n of t.issues)o(n,`l`)||e.issues.push(n);for(let t of n.issues)o(t,`r`)||e.issues.push(t);let s=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(s.length){let t=i?s.filter(e=>i.keys.includes(e)):[];t.length&&e.issues.push({...i,keys:t});for(let n of s)!t.includes(n)&&a.has(n)&&e.issues.push(a.get(n))}let c=bl(t.value,n.value);if(!c.valid){if(ro(e))return e;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return e.value=c.data,e}var Sl=P(`$ZodRecord`,(e,t)=>{dc.init(e,t);let n=Po.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!za(a))return r.issues.push({expected:`record`,code:`invalid_type`,input:a,inst:e}),r;let o=[],s=t.keyType._zod.values;if(s&&!t.partial){r.value=n?n.alloc(e,r,{},i):{};let c=new Set;for(let n of s)if(typeof n==`string`||typeof n==`number`||typeof n==`symbol`){if(c.add(typeof n==`number`?n.toString():n),n===`__proto__`)continue;let s=t.keyType._zod.run({value:n,issues:[]},i);if(s instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(s.issues.length){r.issues.push({code:`invalid_key`,origin:`record`,issues:s.issues.map(e=>co(e,i,Fo())),input:n,path:[n],inst:e});continue}let l=s.value;if(l===`__proto__`)continue;let u=t.valueType._zod.run({value:a[n],issues:[]},i);u instanceof Promise?o.push(u.then(e=>{e.issues.length&&r.issues.push(...ao(n,e.issues)),r.value[l]=e.value})):(u.issues.length&&r.issues.push(...ao(n,u.issues)),r.value[l]=u.value)}let l;for(let e in a)if(!c.has(e)){if(t.mode===`loose`){if(e===`__proto__`)continue;r.value[e]=a[e]}else l??=[],l.push(e)}l&&l.length>0&&r.issues.push({code:`unrecognized_keys`,input:a,inst:e,keys:l,continue:!0})}else{r.value=n?n.alloc(e,r,{},i):{};let c;for(let n of Reflect.ownKeys(a)){if(n===`__proto__`||!Object.prototype.propertyIsEnumerable.call(a,n))continue;let l=t.keyType._zod.run({value:n,issues:[]},i);if(l instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(typeof n==`string`&&zs.test(n)&&l.issues.length){let e=t.keyType._zod.run({value:Number(n),issues:[]},i);if(e instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);e.issues.length===0&&(l=e)}if(l.issues.length){t.mode===`loose`?r.value[n]=a[n]:s?(c??=[],c.push(n)):r.issues.push({code:`invalid_key`,origin:`record`,issues:l.issues.map(e=>co(e,i,Fo())),input:n,path:[n],inst:e});continue}let u=l.value;if(u===`__proto__`)continue;let d=t.valueType._zod.run({value:a[n],issues:[]},i);d instanceof Promise?o.push(d.then(e=>{e.issues.length&&r.issues.push(...ao(n,e.issues)),r.value[u]=e.value})):(d.issues.length&&r.issues.push(...ao(n,d.issues)),r.value[u]=d.value)}c&&c.length>0&&r.issues.push({code:`unrecognized_keys`,input:a,inst:e,keys:c,continue:!0})}return o.length?Promise.all(o).then(()=>r):r}}),Cl=P(`$ZodEnum`,(e,t)=>{dc.init(e,t);let n=ga(t.entries),r=new Set(n);e._zod.values=r,N(e,`pattern`,e=>{let t=ga(e.def.entries).filter(e=>Va.has(typeof e));return RegExp(t.length?`^(${t.map(e=>Ha(e.toString())).join(`|`)})$`:`^[^\\s\\S]$`)}),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),wl=P(`$ZodLiteral`,(e,t)=>{dc.init(e,t);let n=new Set(t.values);e._zod.values=n,N(e,`pattern`,e=>{let t=e.def.values;return RegExp(t.length?`^(${t.map(e=>typeof e==`string`?Ha(e):e?Ha(e.toString()):String(e)).join(`|`)})$`:`^[^\\s\\S]$`)}),e._zod.parse=(r,i)=>{let a=r.value;return n.has(a)||r.issues.push({code:`invalid_value`,values:t.values,input:a,inst:e}),r}}),Tl=P(`$ZodTransform`,(e,t)=>{dc.init(e,t),e._zod.optin=`optional`,Po.memoizer?.guard(e),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new No(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n));if(i instanceof Promise)throw new Mo;return n.value=i,n}});function El(e,t){return e.value=t.issues.length?void 0:t.value,e}var Dl=P(`$ZodOptional`,(e,t)=>{dc.init(e,t),N(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),e._zod.optout=`optional`,N(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?new Set([...t,void 0]):void 0}),N(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${Sa(t.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(e.value===void 0){if(t.innerType._zod.optin!==`defaulted`)return e;let r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(t=>El(e,t)):El(e,r)}return t.innerType._zod.run(e,n)}}),Ol=P(`$ZodExactOptional`,(e,t)=>{Dl.init(e,t),N(e,`values`,e=>e.def.innerType._zod.values),N(e,`pattern`,e=>e.def.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),kl=P(`$ZodNullable`,(e,t)=>{dc.init(e,t),N(e,`optin`,e=>e.def.innerType._zod.optin),N(e,`optout`,e=>e.def.innerType._zod.optout),N(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${Sa(t.source)}|null)$`):void 0}),N(e,`values`,e=>e.def.innerType._zod.values?new Set([...e.def.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),Al=P(`$ZodDefault`,(e,t)=>{dc.init(e,t),e._zod.optin=`defaulted`,N(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>jl(e,t)):jl(r,t)}});function jl(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var Ml=P(`$ZodPrefault`,(e,t)=>{dc.init(e,t),e._zod.optin=`defaulted`,N(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),Nl=P(`$ZodNonOptional`,(e,t)=>{dc.init(e,t),N(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?new Set([...t].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>Pl(t,e)):Pl(i,e)}});function Pl(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 Fl(e,t,n,r){return t.issues.length?(e.value=n.catchValue({...t,value:e.value,error:{issues:t.issues.map(e=>co(e,r,Fo()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}var Il=P(`$ZodCatch`,(e,t)=>{dc.init(e,t),N(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),N(e,`optout`,e=>e.def.innerType._zod.optout),N(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(r=>Fl(e,r,t,n)):Fl(e,r,t,n)}}),Ll=P(`$ZodPipe`,(e,t)=>{dc.init(e,t),N(e,`values`,e=>e.def.in._zod.values),N(e,`optin`,e=>e.def.in._zod.optin),N(e,`optout`,e=>e.def.out._zod.optout),N(e,`propValues`,e=>e.def.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>Rl(e,t.in,n)):Rl(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>Rl(e,t.out,n)):Rl(r,t.out,n)}});function Rl(e,t,n){return e.issues.some(e=>e.code!==`unrecognized_keys`)?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}var zl=P(`$ZodPreprocess`,(e,t)=>{Ll.init(e,t)}),Bl=P(`$ZodReadonly`,(e,t)=>{dc.init(e,t),N(e,`propValues`,e=>e.def.innerType._zod.propValues),N(e,`values`,e=>e.def.innerType._zod.values),N(e,`optin`,e=>e.def.innerType?._zod?.optin),N(e,`optout`,e=>e.def.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(Vl):Vl(r)}});function Vl(e){return e.memo||(e.value=Object.freeze(e.value)),e}var Hl=P(`$ZodLazy`,(e,t)=>{dc.init(e,t),Ta(e._zod,`innerType`,()=>{let e=t;return e._cachedInner||=t.getter(),e._cachedInner}),N(e,`pattern`,e=>e.innerType?._zod?.pattern),N(e,`propValues`,e=>e.innerType?._zod?.propValues),N(e,`optin`,e=>e.innerType?._zod?.optin??void 0),N(e,`optout`,e=>e.innerType?._zod?.optout??void 0),e._zod.parse=(t,n)=>e._zod.innerType._zod.run(t,n)}),Ul=P(`$ZodCustom`,(e,t)=>{Gs.init(e,t),dc.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>Wl(t,n,r,e));Wl(i,n,r,e)}});function Wl(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(mo(e))}}var Gl=class extends Error{constructor(){super(`Cannot parse a reference cycle that closes through a transform`),this.name=`ZodCyclicError`}},Kl=`~memo`,ql=[];function Jl(e){return e!==null&&(typeof e==`object`||typeof e==`function`)}function Yl(e){return e.map(e=>e.path?{...e,path:e.path.slice()}:{...e})}var Xl=new WeakMap,Zl=0,Ql=1,$l=2;function eu(e,t,n){let r=Xl.get(e);if(r!==void 0)return r?$l:Zl;if(t.has(e))return $l;t.add(e);let i=Zl,a=e=>{if(i!==$l&&e?._zod){let r=eu(e,t,n);r>i&&(i=r)}},o=(e,r)=>{let i=Zl;for(let a of Reflect.ownKeys(e)){let o=Object.getOwnPropertyDescriptor(e,a);if(r&&!o.enumerable)continue;let s=o.get?Ql:o.value?._zod?eu(o.value,t,n):Zl;s>i&&(i=s)}return i},s=e=>{e>i&&(i=e)},c=e._zod.def;switch(c.type){case`object`:{let e=Da(c);s(e?o(e,!0):Ql),a(c.catchall);break}case`properties`:s(o(c.shape,!1));break;case`array`:a(c.element);break;case`tuple`:for(let e of c.items)a(e);a(c.rest);break;case`record`:case`map`:a(c.keyType),a(c.valueType);break;case`set`:a(c.valueType);break;case`union`:for(let e of c.options)a(e);break;case`intersection`:a(c.left),a(c.right);break;case`optional`:case`nullable`:case`default`:case`prefault`:case`catch`:case`readonly`:case`nonoptional`:case`promise`:case`success`:a(c.innerType);break;case`pipe`:a(c.in),a(c.out);break;case`function`:a(c.input),a(c.output);break;case`lazy`:{let r=c._cachedInner??(n?e._zod.innerType:void 0);s(r?eu(r,t,!1):Ql);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(let e in c){let t=Object.getOwnPropertyDescriptor(c,e);if(!t||t.get)continue;let n=t.value;if(n&&typeof n==`object`){if(n._zod)a(n);else if(Array.isArray(n))for(let e of n)a(e)}}}return t.delete(e),tu(e,i)}function tu(e,t){return t!==Ql&&Xl.set(e,t===$l),t}function nu(e,t){let n=e.buckets.get(t);return n||(n=new WeakMap,e.buckets.set(t,n)),n}var ru,iu=[],au={alloc(e,t,n){let r=ru;if(!r)return n;ru=void 0;let i={value:n,issues:null};return r.set(t.value,i),iu.push(i),n},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,n=(e,n)=>{if(n.direction!==`backward`&&su(n,e.value))throw new Gl;return t(e,n)};e._zod.parse=n,e._zod.run===t&&(e._zod.run=n)})},attach(e){var t;let n,r=!1,i,a;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,o=(s,c)=>{if(n===void 0){let i=eu(e,new Set,!1);if(i===Zl)return e._zod.parse=t,e._zod.run===o&&(e._zod.run=t),t(s,c);i===$l||r?n=!0:r=!0}let l=s.value;if(!Jl(l))return t(s,c);let u=c[Kl];u||(u={buckets:new WeakMap,backEdges:void 0},c[Kl]=u);let d;i===c?d=a:(d=nu(u,e),i=c,a=d);let f=d.get(l);if(f)return s.value=f.value,f.issues?f.issues.length&&s.issues.push(...Yl(f.issues)):(s.memo=!0,u.backEdges??(u.backEdges=new WeakSet),u.backEdges.add(f.value)),s;ru=d;let p=iu.length,m=t(s,c);ru=void 0;let h=iu.length>p?iu.pop():void 0;return m instanceof Promise?m.then(e=>(h&&(h.issues=e.issues.length?Yl(e.issues):ql),e)):(h&&(h.issues=m.issues.length?Yl(m.issues):ql),m)};e._zod.parse=o,e._zod.run===t&&(e._zod.run=o)})}};function ou(){return au}function su(e,t){let n=e[Kl]?.backEdges;return n!==void 0&&Jl(t)&&n.has(t)}var cu=()=>{let 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(t){return e[t]??null}let 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`,credit_card:`credit card number`,iban:`IBAN`,jwt:`JWT`,template_literal:`input`},r={nan:`NaN`};function i(e,t){return e===`number`&&typeof t==`number`&&!Number.isFinite(t)?String(t):r[e]??e}return e=>{switch(e.code){case`invalid_type`:return`Invalid input: expected ${i(e.expected)}, received ${i(po(e.input),e.input)}`;case`invalid_value`:return e.values.length===1?`Invalid input: expected ${Wa(e.values[0])}`:`Invalid option: expected one of ${_a(e.values,`|`)}`;case`too_big`:{let n=e.exact?`exactly `:e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Too big: expected ${e.origin??`value`} to have ${n}${e.maximum.toString()} ${r.unit??`elements`}`:`Too big: expected ${e.origin??`value`} to be ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.exact?`exactly `:e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Too small: expected ${e.origin} to have ${n}${e.minimum.toString()} ${r.unit}`:`Too small: expected ${e.origin} to be ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Invalid string: must start with "${t.prefix}"`:t.format===`ends_with`?`Invalid string: must end with "${t.suffix}"`:t.format===`includes`?`Invalid string: must include "${t.includes}"`:t.format===`regex`?`Invalid string: must match pattern ${t.pattern}`:`Invalid ${n[t.format]??e.format}`}case`not_multiple_of`:return`Invalid number: must be a multiple of ${e.divisor}`;case`unrecognized_keys`:return`Unrecognized key${e.keys.length>1?`s`:``}: ${_a(e.keys,`, `)}`;case`invalid_key`:return`Invalid key in ${e.origin}`;case`invalid_union`:return e.options&&Array.isArray(e.options)&&e.options.length>0?`Invalid discriminator value. Expected ${e.options.map(e=>`'${e}'`).join(` | `)}`:e.inclusive===!1?`Invalid input: more than one option matched`:`Invalid input`;case`invalid_element`:return`Invalid value in ${e.origin}`;default:return`Invalid input`}}};function lu(){return{localeError:cu()}}var uu,du=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function fu(){return new du}(uu=globalThis).__zod_globalRegistry??(uu.__zod_globalRegistry=fu());var pu=globalThis.__zod_globalRegistry;function mu(e,t){return new e({type:`string`,...M(t)})}function hu(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...M(t)})}function gu(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...M(t)})}function _u(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...M(t)})}function vu(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...M(t)})}function yu(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...M(t)})}function bu(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...M(t)})}function xu(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...M(t)})}function Su(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...M(t)})}function Cu(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...M(t)})}function wu(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...M(t)})}function Tu(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...M(t)})}function Eu(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...M(t)})}function Du(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...M(t)})}function Ou(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...M(t)})}function ku(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...M(t)})}function Au(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...M(t)})}function ju(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...M(t)})}function Mu(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...M(t)})}function Nu(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...M(t)})}function Pu(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...M(t)})}function Fu(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...M(t)})}function Iu(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...M(t)})}function Lu(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...M(t)})}function Ru(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...M(t)})}function zu(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...M(t)})}function Bu(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...M(t)})}function Vu(e,t){return new e({type:`number`,checks:[],...M(t)})}function Hu(e,t){return new e({type:`number`,coerce:!0,checks:[],...M(t)})}function Uu(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...M(t)})}function Wu(e,t){return new e({type:`boolean`,...M(t)})}function Gu(e,t){return new e({type:`undefined`,...M(t)})}function Ku(e,t){return new e({type:`null`,...M(t)})}function qu(e){return new e({type:`any`})}function Ju(e){return new e({type:`unknown`})}function Yu(e,t){return new e({type:`never`,...M(t)})}function Xu(e,t){return new Js({check:`less_than`,...M(t),value:e,inclusive:!1})}function Zu(e,t){return new Js({check:`less_than`,...M(t),value:e,inclusive:!0})}function Qu(e,t){return new Ys({check:`greater_than`,...M(t),value:e,inclusive:!1})}function $u(e,t){return new Ys({check:`greater_than`,...M(t),value:e,inclusive:!0})}function ed(e,t){return new Xs({check:`multiple_of`,...M(t),value:e})}function td(e,t){return new Qs({check:`max_length`,...M(t),maximum:e})}function nd(e,t){return new $s({check:`min_length`,...M(t),minimum:e})}function rd(e,t){return new ec({check:`length_equals`,...M(t),length:e})}function id(e,t){return new nc({check:`string_format`,format:`regex`,...M(t),pattern:e})}function ad(e){return new rc({check:`string_format`,format:`lowercase`,...M(e)})}function od(e){return new ic({check:`string_format`,format:`uppercase`,...M(e)})}function sd(e,t){return new ac({check:`string_format`,format:`includes`,...M(t),includes:e})}function cd(e,t){return new oc({check:`string_format`,format:`starts_with`,...M(t),prefix:e})}function ld(e,t){return new sc({check:`string_format`,format:`ends_with`,...M(t),suffix:e})}function I(e){return new cc({check:`overwrite`,tx:e})}function ud(e){return I(t=>t.normalize(e))}function L(){return I(e=>e.trim())}function R(){return I(e=>e.toLowerCase())}function dd(){return I(e=>e.toUpperCase())}function fd(){return I(e=>Fa(e))}function pd(e,t,n){return new e({type:`array`,element:t,...M(n)})}function md(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...M(n)})}function hd(e,t){let n=gd(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(mo(e,t.value,n._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,`input`in r||(r.input=t.value),r.inst??=n,r.continue??=!n._zod.def.abort,t.issues.push(mo(r))}},e(t.value,t)),t);return n}function gd(e,t){let n=new Gs({check:`custom`,...M(t)});return n._zod.check=e,n}function _d(e,...t){for(let n of t)for(let t of Reflect.ownKeys(n))Object.prototype.propertyIsEnumerable.call(n,t)&&Ea(e,t,n[t]);return e}function vd(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??pu,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 yd(e,t,n,r,i){let a=typeof t.unrepresentable==`function`?t.unrepresentable({zodSchema:e,path:r.path,message:i}):t.unrepresentable;if(a===`any`)return!1;if(a===void 0||a===`throw`)throw Error(i);return Object.assign(n,a),!0}function bd(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,bd(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&_d(o.schema,c),t.io===`input`&&Ad(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 xd(e){return e.replace(/~/g,`~0`).replace(/\//g,`~1`)}function Sd(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);if(e.external&&e.sharedDefsExtractedFor===e.external)return;let r=new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${xd(a)}`}}let i=`#/${r}/`;if(t[1]===n&&!t[1].schema.id)return{ref:`#`};let a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+xd(a)}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/<root>
70
-
71
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}r.count>1&&e.reused===`ref`&&a(n)}e.external&&(e.sharedDefsExtractedFor=e.external)}function Cd(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let n=[];for(let e of t){if(!e||typeof e!=`object`)return;Cd(e);let t=Object.keys(e);if(t.length!==1||t[0]!==`type`)return;let r=e.type;for(let e of Array.isArray(r)?r:[r]){if(typeof e!=`string`)return;n.includes(e)||n.push(e)}}delete e.anyOf,e.type=n.length===1?n[0]:n}var wd=new Set([`type`,`properties`,`required`,`additionalProperties`]),Td=[`oneOf`,`anyOf`];function Ed(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!=`object`||!t?null:Object.keys(t).length?t:null}function Dd(e){let t=[];for(let n of e){if(typeof n!=`object`||n.type!==`object`)return null;for(let e in n)if(!wd.has(e))return null;t.push(n)}let n={},r=new Set;for(let e of t){for(let r in e.properties){if(Object.prototype.hasOwnProperty.call(n,r))continue;let e=[];for(let n of t){let t=n.properties?.[r]??Ed(n);t!=null&&(e.some(e=>JSON.stringify(e)===JSON.stringify(t))||e.push(t))}Ea(n,r,e.length===1?e[0]:Dd(e)??{allOf:e})}for(let t of e.required??[])r.add(t)}let i={type:`object`,properties:n};if(r.size&&(i.required=[...r]),t.every(e=>e.additionalProperties===!1))i.additionalProperties=!1;else{let e=[];for(let n of t){let t=Ed(n);t&&!e.some(e=>JSON.stringify(e)===JSON.stringify(t))&&e.push(t)}e.length===1?i.additionalProperties=e[0]:e.length>1&&(i.additionalProperties={allOf:e})}return i}function Od(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let t of wd)if(t in e)return;let n=t.filter(e=>Td.some(t=>Array.isArray(e[t]))),r=null;if(!n.length)r=Dd(t);else{let e=n[0],i=Td.find(t=>Array.isArray(e[t]));if(Object.keys(e).length!==1)return;let a=t.filter(t=>t!==e),o=e[i].map(e=>Dd([...a,e]));if(o.some(e=>!e))return;r={[i]:o}}r&&(delete e.allOf,_d(e,r))}function kd(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):_d(i,s),_d(i,a),t._zod.parent===o)for(let e in i)e!==`$ref`&&e!==`allOf`&&(e in a||delete i[e]);if(s.$ref&&n.def)for(let e in i)e!==`$ref`&&e!==`allOf`&&e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e!==`$ref`&&e!==`allOf`&&e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let t of[...e.seen.entries()].reverse())r(t[0]);if(e.target!==`openapi-3.0`)for(let t of e.seen.entries())Cd(t[1].def??t[1].schema);for(let t of e.deferred)t();if(e.intersections.length){let t=new Map;for(let n of e.seen.values())for(let e of[n.schema,n.def]){let n=e?.allOf;if(!Array.isArray(n))continue;let r=t.get(n);r?r.push(e):t.set(n,[e])}for(let n of e.intersections)for(let e of t.get(n)??[])Od(e)}}let 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){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}_d(i,n.defId?n.schema:n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,Ea(o,e.defId,e.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{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:Md(t,`input`,e.processors),output:Md(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function Ad(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return Ad(r.element,n);if(r.type===`set`)return Ad(r.valueType,n);if(r.type===`lazy`)return Ad(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 Ad(r.innerType,n);if(r.type===`intersection`)return Ad(r.left,n)||Ad(r.right,n);if(r.type===`record`||r.type===`map`)return Ad(r.keyType,n)||Ad(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:Ad(r.in,n)||Ad(r.out,n);if(r.type===`object`){for(let e in r.shape)if(Ad(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(Ad(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(Ad(e,n))return!0;return!!(r.rest&&Ad(r.rest,n))}return!1}var jd=(e,t={})=>n=>{let r=vd({...n,processors:t});return bd(e,r),Sd(r,e),kd(r,e)},Md=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=vd({...i??{},target:a,io:t,processors:n});return bd(e,o),Sd(o,e),kd(o,e)},Nd=(e,t,n)=>{(e[t]===void 0||n>e[t])&&(e[t]=n)},Pd=(e,t,n)=>{(e[t]===void 0||n<e[t])&&(e[t]=n)},Fd=(e,t)=>{Nd(e,`minimum`,t),Pd(e,`maximum`,t)},Id=(e,t)=>{e.multipleOf??=[],e.multipleOf.includes(t)||e.multipleOf.push(t)},Ld=(e,t)=>{e.patterns??=new Set,e.patterns.add(t)},Rd=(e,t)=>{e.mime=e.mime?e.mime.filter(e=>t.includes(e)):[...t]},zd=(e,t)=>{e.format=t,t.includes(`int`)&&(e.isInt=!0)},Bd=(e,t)=>Nd(e,`minimum`,t.minimum),Vd=(e,t)=>Pd(e,`maximum`,t.maximum),Hd=e=>(t,n)=>{zd(t,n.format);let[r,i]=e[n.format];Nd(t,`minimum`,r),Pd(t,`maximum`,i)},Ud={greater_than:(e,t)=>Nd(e,t.inclusive?`minimum`:`exclusiveMinimum`,t.value),less_than:(e,t)=>Pd(e,t.inclusive?`maximum`:`exclusiveMaximum`,t.value),multiple_of:(e,t)=>Id(e,t.value),number_format:Hd(Ka),bigint_format:Hd(qa),min_length:Bd,max_length:Vd,length_equals:(e,t)=>Fd(e,t.length),min_size:Bd,max_size:Vd,size_equals:(e,t)=>Fd(e,t.size),string_format:(e,t)=>{zd(e,t.format),t.pattern&&Ld(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)=>Rd(e,t.mime)};function Wd(e){let t={},n=e._zod.def,r=e._zod.traits.has(`$ZodCheck`)?[e,...n.checks??[]]:n.checks??[];for(let e of r)Ud[e._zod.def.check]?.(t,e._zod.def);let i=e._zod.bag;i.minimum!==void 0&&Nd(t,`minimum`,i.minimum),i.exclusiveMinimum!==void 0&&Nd(t,`exclusiveMinimum`,i.exclusiveMinimum),i.maximum!==void 0&&Pd(t,`maximum`,i.maximum),i.exclusiveMaximum!==void 0&&Pd(t,`exclusiveMaximum`,i.exclusiveMaximum),i.multipleOf!==void 0&&Id(t,i.multipleOf),i.format!==void 0&&(t.format??=i.format,i.format.includes(`int`)&&(t.isInt=!0)),i.mime&&Rd(t,i.mime);for(let e of i.patterns??[])Ld(t,e);return t}var Gd={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},Kd=new Map([[Gc,Ds],[qc,Os]]),qd=e=>Kd.get(e)??e,Jd=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l,laxFormat:u}=Wd(e);if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=Gd[s]??s,i.format===``&&delete i.format,(s===`time`||u)&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c].map(qd);e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},Yd=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,multipleOf:s,exclusiveMaximum:c,exclusiveMinimum:l,isInt:u}=Wd(e);i.type=u?`integer`:`number`;let d=typeof l==`number`&&l>=(a??-1/0),f=typeof c==`number`&&c<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;if(d?p?(i.minimum=l,i.exclusiveMinimum=!0):i.exclusiveMinimum=l:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=c,i.exclusiveMaximum=!0):i.exclusiveMaximum=c:typeof o==`number`&&(i.maximum=o),s){let n=new Set;for(let a of s)Number.isFinite(a)&&a!==0?n.add(Math.abs(a)):yd(e,t,i,r,`A multipleOf divisor of ${a} cannot be represented in JSON Schema`);let[a,...o]=n;a!==void 0&&(i.multipleOf=a),o.length&&(i.allOf=[...i.allOf??[],...o.map(e=>({multipleOf:e}))])}},Xd=(e,t,n,r)=>{n.type=`boolean`},Zd=(e,t,n,r)=>{yd(e,t,n,r,`BigInt cannot be represented in JSON Schema`)},Qd=(e,t,n,r)=>{yd(e,t,n,r,`Symbols cannot be represented in JSON Schema`)},$d=(e,t,n,r)=>{t.target===`openapi-3.0`?(n.type=`string`,n.nullable=!0,n.enum=[null]):n.type=`null`},ef=(e,t,n,r)=>{yd(e,t,n,r,`Undefined cannot be represented in JSON Schema`)},tf=(e,t,n,r)=>{yd(e,t,n,r,`Void cannot be represented in JSON Schema`)},nf=(e,t,n,r)=>{n.not={}},rf=(e,t,n,r)=>{},af=(e,t,n,r)=>{},of=(e,t,n,r)=>{yd(e,t,n,r,`Date cannot be represented in JSON Schema`)},sf=(e,t,n,r)=>{let i=e._zod.def,a=ga(i.entries);if(a.length===0){n.not={};return}a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},cf=(e,t,n,r)=>{let i=e._zod.def;if(i.values.length===0){n.not={};return}let a=[];for(let o of i.values)if(o===void 0){if(yd(e,t,n,r,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof o==`bigint`){if(yd(e,t,n,r,`BigInt literals cannot be represented in JSON Schema`))return;a.push(Number(o))}else a.push(o);if(a.length!==0){if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a}},lf=(e,t,n,r)=>{yd(e,t,n,r,`NaN cannot be represented in JSON Schema`)},uf=(e,t,n,r)=>{let i=n,a=e._zod.pattern;if(!a)throw Error(`Pattern not found in template literal`);i.type=`string`,i.pattern=a.source},df=(e,t,n,r)=>{let i=n;i.type=`string`,i.format=`binary`,i.contentEncoding=`binary`;let{minimum:a,maximum:o,mime:s}=Wd(e);a!==void 0&&(i.minLength=a),o!==void 0&&(i.maxLength=o),s&&(s.length===0?i.not={}:s.length===1?i.contentMediaType=s[0]:i.anyOf=s.map(e=>({contentMediaType:e})))},ff=(e,t,n,r)=>{n.type=`boolean`},pf=(e,t,n,r)=>{yd(e,t,n,r,`Custom types cannot be represented in JSON Schema`)},mf=(e,t,n,r)=>{yd(e,t,n,r,`Function types cannot be represented in JSON Schema`)},hf=(e,t,n,r)=>{yd(e,t,n,r,`Transforms cannot be represented in JSON Schema`)},gf=(e,t,n,r)=>{yd(e,t,n,r,`Map cannot be represented in JSON Schema`)},_f=(e,t,n,r)=>{yd(e,t,n,r,`Set cannot be represented in JSON Schema`)},vf=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=Wd(e);typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=bd(a.element,t,{...r,path:[...r.path,`items`]})};function yf(e){let t=e._zod.def;return t.type===`pipe`&&t.in._zod.traits.has(`$ZodTransform`)?yf(t.out):t.type===`catch`?yf(t.innerType):e._zod.optin}var bf=(e,t,n,r)=>{let i=n,a=e._zod.def,o=a.shape;if(Object.getOwnPropertySymbols(o).length&&yd(e,t,i,r,`Symbol keys cannot be represented in JSON Schema`))return;i.type=`object`,i.properties={};for(let e in o)Ea(i.properties,e,bd(o[e],t,{...r,path:[...r.path,`properties`,e]}));let s=new Set(Object.keys(o)),c=new Set([...s].filter(e=>{let n=a.shape[e];return t.io===`input`?yf(n)===void 0:n._zod.optout===void 0}));c.size>0&&(i.required=Array.from(c)),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=bd(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},xf=(e,t,n,r)=>{let i=n,a=e._zod.def;if(Object.getOwnPropertySymbols(a.shape).length&&yd(e,t,i,r,`Symbol keys cannot be represented in JSON Schema`))return;if(t.io===`output`){for(let n in a.shape)if(Ad(a.shape[n])&&yd(e,t,i,r,`z.properties() returns its input, so the output of a transforming schema at key "${n}" cannot be represented in JSON Schema`))return}i.type=`object`,i.properties={};for(let e in a.shape)Ea(i.properties,e,bd(a.shape[e],t,{...r,path:[...r.path,`properties`,e]}));let o=Object.keys(a.shape).filter(e=>yf(a.shape[e])===void 0);o.length>0&&(i.required=o)},Sf=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>bd(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},Cf=(e,t,n,r)=>{let i=e._zod.def,a=bd(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=bd(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1,c=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]];n.allOf=c,t.intersections.push(c)},wf=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`array`;let o=t.target===`draft-2020-12`?`prefixItems`:`items`,s=t.target===`draft-2020-12`||t.target===`openapi-3.0`?`items`:`additionalItems`,c=a.items.map((e,n)=>bd(e,t,{...r,path:[...r.path,o,n]})),l=a.rest?bd(a.rest,t,{...r,path:[...r.path,s,...t.target===`openapi-3.0`?[a.items.length]:[]]}):null,u=a.items.length;for(;u>0;){let e=a.items[u-1];if(!(t.io===`input`?yf(e)!==void 0:e._zod.optout===`optional`))break;u--}let d=a.items.length,f=!a.rest;t.target===`draft-2020-12`?(i.prefixItems=c,f?i.items=!1:l&&(i.items=l),u>0&&(i.minItems=u),f&&(i.maxItems=d)):t.target===`openapi-3.0`?(i.items={anyOf:c},l&&i.items.anyOf.push(l),u>0&&(i.minItems=u),f&&(i.maxItems=d)):(i.items=c,f?i.additionalItems=!1:l&&(i.additionalItems=l),u>0&&(i.minItems=u),f&&(i.maxItems=d));let{minimum:p,maximum:m}=Wd(e);typeof p==`number`&&(i.minItems=p),typeof m==`number`&&(i.maxItems=m)};function Tf(e,t,n){if(t.$ref){if(n.has(t))return t;n.add(t);let r=e.get(t)?.def;if(!r)return t;let i=Tf(e,r,n);return i===r?t:i}for(let r of[`anyOf`,`oneOf`]){let i=t[r];if(!Array.isArray(i))continue;let a=i.map(t=>Tf(e,t,n));a.some((e,t)=>e!==i[t])&&(t={...t,[r]:a})}let r=Array.isArray(t.type)?t.type:[t.type],i=!r.includes(`string`)&&r.some(e=>e===`number`||e===`integer`),a=t.enum??(t.const===void 0?void 0:[t.const]);if(!i&&!a?.some(e=>typeof e==`number`))return t;let{minimum:o,maximum:s,exclusiveMinimum:c,exclusiveMaximum:l,multipleOf:u,format:d,id:f,...p}=t;return p.enum?p.enum=p.enum.map(e=>typeof e==`number`?String(e):e):typeof p.const==`number`&&(p.const=String(p.const)),i?(p.type=`string`,a||(p.pattern=(r.includes(`number`)?zs:Rs).source),p):p}var Ef=new WeakMap;function Df(e){let t=new Map;for(let n of e.seen.values())n.def&&!t.has(n.schema)&&t.set(n.schema,n);let n=new Map;for(let r of Ef.get(e)??[]){let i=e.seen.get(r),a=(i?.def??i?.schema)?.propertyNames;if(!a||a===!0||n.has(a))continue;let o=Tf(t,a,new Set);o!==a&&n.set(a,o)}if(n.size)for(let t of e.seen.values())for(let e of[t.schema,t.def]){let t=e&&n.get(e.propertyNames);t&&(e.propertyNames=t)}}var Of=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=Wd(o).patterns;if(a.mode===`loose`&&s&&s.size>0){let e=bd(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)Ea(i.patternProperties,qd(t).source,e)}else{if(t.target===`draft-07`||t.target===`draft-2020-12`){i.propertyNames=bd(a.keyType,t,{...r,path:[...r.path,`propertyNames`]});let n=Ef.get(t);n||(n=[],Ef.set(t,n),t.deferred.push(()=>Df(t))),n.push(e)}i.additionalProperties=bd(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]})}let c=o._zod.values,l=t.io===`input`&&yf(a.valueType)!==void 0;if(c&&!a.partial&&!l){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e.map(String))}},kf=(e,t,n,r)=>{let i=e._zod.def,a=bd(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},Af=(e,t,n,r)=>{let i=e._zod.def;bd(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},jf=Symbol();function Mf(e,t,n,r,i){let a=!1,o=JSON.stringify(e,(e,t)=>typeof t==`bigint`?(a=!0,null):t);return a?(yd(t,n,r,i,`BigInt defaults cannot be represented in JSON Schema`),jf):JSON.parse(o)}var Nf=(e,t,n,r)=>{let i=e._zod.def;bd(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o=Mf(i.defaultValue,e,t,n,r);o!==jf&&(n.default=o)},Pf=(e,t,n,r)=>{let i=e._zod.def;bd(i.innerType,t,r);let a=t.seen.get(e);if(a.ref=i.innerType,t.io!==`input`)return;let o=Mf(i.defaultValue,e,t,n,r);o!==jf&&(n._prefault=o)},Ff=(e,t,n,r)=>{let i=e._zod.def;bd(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{yd(e,t,n,r,`Dynamic catch values are not supported in JSON Schema`);return}n.default=o},If=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;bd(o,t,r);let s=t.seen.get(e);s.ref=o},Lf=(e,t,n,r)=>{let i=e._zod.def;bd(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},Rf=(e,t,n,r)=>{let i=e._zod.def;bd(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},zf=(e,t,n,r)=>{let i=e._zod.def;bd(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Bf=(e,t,n,r)=>{let i=e._zod.innerType;bd(i,t,r);let a=t.seen.get(e);a.ref=i},Vf={string:Jd,number:Yd,boolean:Xd,bigint:Zd,symbol:Qd,null:$d,undefined:ef,void:tf,never:nf,any:rf,unknown:af,date:of,enum:sf,literal:cf,nan:lf,template_literal:uf,file:df,success:ff,custom:pf,properties:xf,function:mf,transform:hf,map:gf,set:_f,array:vf,object:bf,union:Sf,intersection:Cf,tuple:wf,record:Of,nullable:kf,nonoptional:Af,default:Nf,prefault:Pf,catch:Ff,pipe:If,readonly:Lf,promise:Rf,optional:zf,lazy:Bf};function Hf(e,t){if(`_idmap`in e){let n=e,r=vd({...t,processors:Vf}),i={};for(let e of n._idmap.entries()){let[t,n]=e;bd(n,r)}let a={};r.external={registry:n,uri:t?.uri,defs:i};for(let e of n._idmap.entries()){let[t,n]=e;Sd(r,n),Ea(a,t,kd(r,n))}return Object.keys(i).length>0&&(a.__shared={[r.target===`draft-2020-12`?`$defs`:`definitions`]:i}),{schemas:a}}let n=vd({...t,processors:Vf});return bd(e,n),Sd(n,e),kd(n,e)}var Uf=new WeakSet([Object.prototype,Error.prototype]);function Wf(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let e=n(this);return Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0})}})}var Gf=P(`ZodError`,(e,t)=>{Ho.init(e,t),e.name=`ZodError`;let n=Object.getPrototypeOf(e);Uf.has(n)||(Uf.add(n),Wf(n,`format`,e=>t=>Go(e,t)),Wf(n,`flatten`,e=>t=>Wo(e,t)),Wf(n,`addIssue`,e=>t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,va,2)}),Wf(n,`addIssues`,e=>t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,va,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},void 0,{Parent:Error}),Kf=qo(Gf),qf=Jo(Gf),Jf=F(Gf),Yf=Xo(Gf),Xf=ns(Gf),Zf=rs(Gf),Qf=is(Gf),$f=as(Gf),ep=os(Gf),z=ss(Gf),tp=cs(Gf),np=ls(Gf);function rp(){Po.localeError||Fo(lu())}function ip(){Po.memoizer||Fo({memoizer:ou()})}var ap=P(`ZodType`,(e,t)=>(rp(),dc.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(Na(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return Ua(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(Em(e,t))},superRefine(e,t){return this.check(Dm(e,t))},overwrite(e){return this.check(I(e))},optional(){return Z(this)},exactOptional(){return sm(this)},nullable(){return lm(this)},nullish(){return Z(lm(this))},nonoptional(e){return hm(this,e)},array(){return W(this)},or(e){return q([this,e])},and(e){return $p(this,e)},transform(e){return ym(this,im(e))},default(e){return dm(this,e)},prefault(e){return pm(this,e)},catch(e){return _m(this,e)},pipe(e){return ym(this,e)},readonly(){return Sm(this)},describe(e){let t=this.clone();return pu.add(t,{description:e}),t},meta(...e){if(e.length===0)return pu.get(this);let t=this.clone();return pu.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 _o(this,`~standard`,{...mc(this),jsonSchema:{input:Md(this,`input`),output:Md(this,`output`)}})},set"~standard"(e){go(this,`~standard`,e)},parse:function e(t,n){return Kf(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await qf(this,t,n,{callee:e})},safeParse(e,t){return Jf(this,e,t)},async safeParseAsync(e,t){return Yf(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){go(this,`spa`,e)},validate(e,t){return $o(this,e,t)},validateAsync(e,t){return ts(this,e,t)},encode:function e(t,n){return Xf(this,t,n,{callee:e})},decode:function e(t,n){return Zf(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await Qf(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await $f(this,t,n,{callee:e})},safeEncode(e,t){return ep(this,e,t)},safeDecode(e,t){return z(this,e,t)},async safeEncodeAsync(e,t){return tp(this,e,t)},async safeDecodeAsync(e,t){return np(this,e,t)},toJSONSchema(e){return jd(this,{})(e)},get description(){return pu.get(this)?.description},get _def(){return this._zod.def}}),op=P(`_ZodString`,(e,t)=>{hc.init(e,t),ap.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Jd(e,t,n,r)},vo({format:e=>Wd(e).format??null,minLength:e=>Wd(e).minimum??null,maxLength:e=>Wd(e).maximum??null},{regex(...e){return this.check(id(...e))},includes(...e){return this.check(sd(...e))},startsWith(...e){return this.check(cd(...e))},endsWith(...e){return this.check(ld(...e))},min(...e){return this.check(nd(...e))},max(...e){return this.check(td(...e))},length(...e){return this.check(rd(...e))},nonempty(...e){return this.check(nd(1,...e))},lowercase(e){return this.check(ad(e))},uppercase(e){return this.check(od(e))},trim(){return this.check(L())},normalize(...e){return this.check(ud(...e))},toLowerCase(){return this.check(R())},toUpperCase(){return this.check(dd())},slugify(){return this.check(fd())}})),sp=P(`ZodString`,(e,t)=>{hc.init(e,t),op.init(e,t)},{email(e){return this.check(hu(pp,e))},url(e){return this.check(xu(_p,e))},jwt(e){return this.check(Iu(Np,e))},emoji(e){return this.check(Su(yp,e))},guid(e){return this.check(gu(hp,e))},uuid(e){return this.check(_u(gp,e))},uuidv4(e){return this.check(vu(gp,e))},uuidv6(e){return this.check(yu(gp,e))},uuidv7(e){return this.check(bu(gp,e))},nanoid(e){return this.check(Cu(bp,e))},cuid(e){return this.check(wu(xp,e))},cuid2(e){return this.check(Tu(Sp,e))},ulid(e){return this.check(Eu(Cp,e))},base64(e){return this.check(Nu(Ap,e))},base64url(e){return this.check(Pu(jp,e))},xid(e){return this.check(Du(wp,e))},ksuid(e){return this.check(Ou(Tp,e))},ipv4(e){return this.check(ku(Ep,e))},ipv6(e){return this.check(Au(Dp,e))},cidrv4(e){return this.check(ju(Op,e))},cidrv6(e){return this.check(Mu(kp,e))},e164(e){return this.check(Fu(Mp,e))},datetime(e){return this.check(Lu(lp,e))},date(e){return this.check(Ru(up,e))},time(e){return this.check(zu(dp,e))},duration(e){return this.check(Bu(fp,e))}});function B(e){return mu(sp,e)}var cp=P(`ZodStringFormat`,(e,t)=>{gc.init(e,t),op.init(e,t)}),lp=P(`ZodISODateTime`,(e,t)=>{Nc.init(e,t),cp.init(e,t)}),up=P(`ZodISODate`,(e,t)=>{Pc.init(e,t),cp.init(e,t)}),dp=P(`ZodISOTime`,(e,t)=>{Fc.init(e,t),cp.init(e,t)}),fp=P(`ZodISODuration`,(e,t)=>{Ic.init(e,t),cp.init(e,t)}),pp=P(`ZodEmail`,(e,t)=>{yc.init(e,t),cp.init(e,t)});function mp(e){return hu(pp,e)}var hp=P(`ZodGUID`,(e,t)=>{_c.init(e,t),cp.init(e,t)}),gp=P(`ZodUUID`,(e,t)=>{vc.init(e,t),cp.init(e,t)}),_p=P(`ZodURL`,(e,t)=>{Tc.init(e,t),cp.init(e,t)});function vp(e){return xu(_p,e)}var yp=P(`ZodEmoji`,(e,t)=>{Ec.init(e,t),cp.init(e,t)}),bp=P(`ZodNanoID`,(e,t)=>{Dc.init(e,t),cp.init(e,t)}),xp=P(`ZodCUID`,(e,t)=>{Oc.init(e,t),cp.init(e,t)}),Sp=P(`ZodCUID2`,(e,t)=>{kc.init(e,t),cp.init(e,t)}),Cp=P(`ZodULID`,(e,t)=>{Ac.init(e,t),cp.init(e,t)}),wp=P(`ZodXID`,(e,t)=>{jc.init(e,t),cp.init(e,t)}),Tp=P(`ZodKSUID`,(e,t)=>{Mc.init(e,t),cp.init(e,t)}),Ep=P(`ZodIPv4`,(e,t)=>{Lc.init(e,t),cp.init(e,t)}),Dp=P(`ZodIPv6`,(e,t)=>{Bc.init(e,t),cp.init(e,t)}),Op=P(`ZodCIDRv4`,(e,t)=>{Vc.init(e,t),cp.init(e,t)}),kp=P(`ZodCIDRv6`,(e,t)=>{Uc.init(e,t),cp.init(e,t)}),Ap=P(`ZodBase64`,(e,t)=>{Kc.init(e,t),cp.init(e,t)}),jp=P(`ZodBase64URL`,(e,t)=>{Yc.init(e,t),cp.init(e,t)}),Mp=P(`ZodE164`,(e,t)=>{Xc.init(e,t),cp.init(e,t)}),Np=P(`ZodJWT`,(e,t)=>{Qc.init(e,t),cp.init(e,t)}),Pp=P(`ZodNumber`,(e,t)=>{$c.init(e,t),ap.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Yd(e,t,n,r),e.isFinite=!0},vo({minValue:e=>{let{minimum:t,exclusiveMinimum:n}=Wd(e);return Math.max(t??-1/0,n??-1/0)},maxValue:e=>{let{maximum:t,exclusiveMaximum:n}=Wd(e);return Math.min(t??1/0,n??1/0)},isInt:e=>{let{isInt:t,multipleOf:n}=Wd(e);return!!t||!!n?.some(Number.isSafeInteger)},format:e=>Wd(e).format??null},{gt(e,t){return this.check(Qu(e,t))},gte(e,t){return this.check($u(e,t))},min(e,t){return this.check($u(e,t))},lt(e,t){return this.check(Xu(e,t))},lte(e,t){return this.check(Zu(e,t))},max(e,t){return this.check(Zu(e,t))},int(e){return this.check(Ip(e))},safe(e){return this.check(Ip(e))},positive(e){return this.check(Qu(0,e))},nonnegative(e){return this.check($u(0,e))},negative(e){return this.check(Xu(0,e))},nonpositive(e){return this.check(Zu(0,e))},multipleOf(e,t){return this.check(ed(e,t))},step(e,t){return this.check(ed(e,t))},finite(){return this}}));function V(e){return Vu(Pp,e)}var Fp=P(`ZodNumberFormat`,(e,t)=>{el.init(e,t),Pp.init(e,t)});function Ip(e){return Uu(Fp,e)}var Lp=P(`ZodBoolean`,(e,t)=>{tl.init(e,t),ap.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Xd(e,t,n,r)});function H(e){return Wu(Lp,e)}var Rp=P(`ZodUndefined`,(e,t)=>{nl.init(e,t),ap.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ef(e,t,n,r)});function zp(e){return Gu(Rp,e)}var Bp=P(`ZodNull`,(e,t)=>{rl.init(e,t),ap.init(e,t),e._zod.processJSONSchema=(t,n,r)=>$d(e,t,n,r)});function Vp(e){return Ku(Bp,e)}var Hp=P(`ZodAny`,(e,t)=>{il.init(e,t),ap.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function Up(){return qu(Hp)}var Wp=P(`ZodUnknown`,(e,t)=>{al.init(e,t),ap.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function U(){return Ju(Wp)}var Gp=P(`ZodNever`,(e,t)=>{ol.init(e,t),ap.init(e,t),e._zod.processJSONSchema=(t,n,r)=>nf(e,t,n,r)});function Kp(e){return Yu(Gp,e)}var qp=P(`ZodArray`,(e,t)=>{ip(),cl.init(e,t),ap.init(e,t),e._zod.processJSONSchema=(t,n,r)=>vf(e,t,n,r),e.element=t.element},{min(e,t){return this.check(nd(e,t))},nonempty(e){return this.check(nd(1,e))},max(e,t){return this.check(td(e,t))},length(e,t){return this.check(rd(e,t))},unwrap(){return this.element}});function W(e,t){return pd(qp,e,t)}var Jp=P(`ZodObject`,(e,t)=>{ip(),ml.init(e,t),ap.init(e,t),e._zod.processJSONSchema=(t,n,r)=>bf(e,t,n,r),wo(e,`shape`,e=>e._zod.def.shape,!1)},{keyof(){return Y(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(Na(this._zod.def,{catchall:e}))},passthrough(){return this.clone(Na(this._zod.def,{catchall:U()}))},loose(){return this.clone(Na(this._zod.def,{catchall:U()}))},strict(){return this.clone(Na(this._zod.def,{catchall:Kp()}))},strip(){return this.clone(Na(this._zod.def,{catchall:void 0}))},extend(e){return Za(this,e)},safeExtend(e){return $a(this,e)},merge(e){return eo(this,e)},pick(e){return Ja(this,e)},omit(e){return Xa(this,e)},partial(...e){return to(am,this,e[0])},exactPartial(...e){return to(om,this,e[0],`exactPartial`)},required(...e){return no(mm,this,e[0])}});function G(e,t){return new Jp({type:`object`,shape:e??{},...M(t)})}function K(e,t){return new Jp({type:`object`,shape:e,catchall:U(),...M(t)})}var Yp=P(`ZodUnion`,(e,t)=>{gl.init(e,t),ap.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Sf(e,t,n,r),e.options=t.options});function q(e,t){return new Yp({type:`union`,options:e,...M(t)})}var Xp=P(`ZodDiscriminatedUnion`,(e,t)=>{Yp.init(e,t),vl.init(e,t)});function Zp(e,t,n){return new Xp({type:`union`,options:t,discriminator:e,...M(n)})}var Qp=P(`ZodIntersection`,(e,t)=>{yl.init(e,t),ap.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Cf(e,t,n,r)});function $p(e,t){return new Qp({type:`intersection`,left:e,right:t})}var em=P(`ZodRecord`,(e,t)=>{ip(),Sl.init(e,t),ap.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Of(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function J(e,t,n){return!t||!t._zod?new em({type:`record`,keyType:B(),valueType:e,...M(t)}):new em({type:`record`,keyType:e,valueType:t,...M(n)})}var tm=P(`ZodEnum`,(e,t)=>{Cl.init(e,t),ap.init(e,t),e._zod.processJSONSchema=(t,n,r)=>sf(e,t,n,r),e.enum=t.entries,e.options=[...e._zod.values];let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new tm({...t,checks:[],...M(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new tm({...t,checks:[],...M(r),entries:i})}});function Y(e,t){return new tm({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...M(t)})}var nm=P(`ZodLiteral`,(e,t)=>{wl.init(e,t),ap.init(e,t),e._zod.processJSONSchema=(t,n,r)=>cf(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function X(e,t){return new nm({type:`literal`,values:Array.isArray(e)?e:[e],...M(t)})}var rm=P(`ZodTransform`,(e,t)=>{ip(),Tl.init(e,t),ap.init(e,t),e._zod.processJSONSchema=(t,n,r)=>hf(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new No(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(mo(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,`input`in t||(t.input=n.value),t.inst??=e,n.issues.push(mo(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function im(e){return new rm({type:`transform`,transform:e})}var am=P(`ZodOptional`,(e,t)=>{Dl.init(e,t),ap.init(e,t),e._zod.processJSONSchema=(t,n,r)=>zf(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Z(e){return new am({type:`optional`,innerType:e})}var om=P(`ZodExactOptional`,(e,t)=>{Ol.init(e,t),ap.init(e,t),e._zod.processJSONSchema=(t,n,r)=>zf(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function sm(e){return new om({type:`optional`,innerType:e})}var cm=P(`ZodNullable`,(e,t)=>{kl.init(e,t),ap.init(e,t),e._zod.processJSONSchema=(t,n,r)=>kf(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function lm(e){return new cm({type:`nullable`,innerType:e})}var um=P(`ZodDefault`,(e,t)=>{Al.init(e,t),ap.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Nf(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function dm(e,t){return new um({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():Ba(t)}})}var fm=P(`ZodPrefault`,(e,t)=>{Ml.init(e,t),ap.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Pf(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function pm(e,t){return new fm({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():Ba(t)}})}var mm=P(`ZodNonOptional`,(e,t)=>{Nl.init(e,t),ap.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Af(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function hm(e,t){return new mm({type:`nonoptional`,innerType:e,...M(t)})}var gm=P(`ZodCatch`,(e,t)=>{Il.init(e,t),ap.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ff(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function _m(e,t){return new gm({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:Eo(t)})}var vm=P(`ZodPipe`,(e,t)=>{Ll.init(e,t),ap.init(e,t),e._zod.processJSONSchema=(t,n,r)=>If(e,t,n,r),e.in=t.in,e.out=t.out});function ym(e,t){return new vm({type:`pipe`,in:e,out:t})}var bm=P(`ZodPreprocess`,(e,t)=>{vm.init(e,t),zl.init(e,t)}),xm=P(`ZodReadonly`,(e,t)=>{Bl.init(e,t),ap.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Lf(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Sm(e){return new xm({type:`readonly`,innerType:e})}var Cm=P(`ZodLazy`,(e,t)=>{Hl.init(e,t),ap.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Bf(e,t,n,r),e.unwrap=()=>e._zod.def.getter()});function wm(e){return new Cm({type:`lazy`,getter:e})}var Tm=P(`ZodCustom`,(e,t)=>{Ul.init(e,t),ap.init(e,t),e._zod.processJSONSchema=(t,n,r)=>pf(e,t,n,r)});function Em(e,t={}){return md(Tm,e,t)}function Dm(e,t){return hd(e,t)}function Om(e,t){return new bm({type:`pipe`,in:im(e),out:t})}var km={invalid_type:`invalid_type`,too_big:`too_big`,too_small:`too_small`,invalid_format:`invalid_format`,not_multiple_of:`not_multiple_of`,unrecognized_keys:`unrecognized_keys`,invalid_union:`invalid_union`,invalid_key:`invalid_key`,invalid_element:`invalid_element`,invalid_value:`invalid_value`,custom:`custom`},Am;Am||={};function jm(e){return Lu(lp,e)}function Mm(e){return Ru(up,e)}function Nm(e){return Hu(Pp,e)}var Pm=[`2025-11-25`,`2025-06-18`,`2025-03-26`,`2024-11-05`,`2024-10-07`],Fm=`io.modelcontextprotocol/related-task`,Im=`io.modelcontextprotocol/protocolVersion`,Lm=`io.modelcontextprotocol/clientInfo`,Rm=`io.modelcontextprotocol/serverInfo`,zm=`io.modelcontextprotocol/clientCapabilities`,Bm=`io.modelcontextprotocol/subscriptionId`,Vm=`io.modelcontextprotocol/logLevel`,Hm=wm(()=>q([B(),V(),H(),Vp(),J(B(),Hm),W(Hm)])),Um=J(B(),Hm),Wm=W(Hm),Gm=q([B(),V().int()]),Km=B(),qm=G({ttl:V().optional()}),Jm=G({taskId:B()}),Ym=K({progressToken:Gm.optional(),[Fm]:Jm.optional()}),Xm=G({_meta:Ym.optional()}),Zm=Xm.extend({task:qm.optional()}),Qm=G({method:B(),params:Xm.loose().optional()}),$m=G({_meta:Ym.optional()}),eh=G({method:B(),params:$m.loose().optional()}),th=K({get[Rm](){return gh.optional().catch(void 0)}}),nh=K({_meta:th.optional()}),rh=q([B(),V().int()]),ih=G({jsonrpc:X(`2.0`),id:rh,...Qm.shape}).strict(),ah=G({jsonrpc:X(`2.0`),...eh.shape}).strict(),oh=G({jsonrpc:X(`2.0`),id:rh,result:nh}).strict(),sh=G({jsonrpc:X(`2.0`),id:rh.optional(),error:G({code:V().int(),message:B(),data:U().optional()})}).strict(),ch=q([ih,ah,oh,sh]),lh=q([oh,sh]),uh=nh.strict(),dh=$m.extend({requestId:rh.optional(),reason:B().optional()}),fh=eh.extend({method:X(`notifications/cancelled`),params:dh}),ph=G({src:B(),mimeType:B().optional(),sizes:W(B()).optional(),theme:Y([`light`,`dark`]).optional()}),mh=G({icons:W(ph).optional()}),hh=G({name:B(),title:B().optional()}),gh=hh.extend({...hh.shape,...mh.shape,version:B(),websiteUrl:B().optional(),description:B().optional()}),_h=Om(e=>e&&typeof e==`object`&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,$p(G({form:$p(G({applyDefaults:H().optional()}),Um).optional(),url:Um.optional()}),Um.optional())),vh=K({list:Um.optional(),cancel:Um.optional(),requests:K({sampling:K({createMessage:Um.optional()}).optional(),elicitation:K({create:Um.optional()}).optional()}).optional()}),yh=K({list:Um.optional(),cancel:Um.optional(),requests:K({tools:K({call:Um.optional()}).optional()}).optional()}),bh=G({experimental:J(B(),Um).optional(),sampling:G({context:Um.optional(),tools:Um.optional()}).optional(),elicitation:_h.optional(),roots:G({listChanged:H().optional()}).optional(),tasks:vh.optional(),extensions:J(B(),Um).optional()}),xh=Xm.extend({protocolVersion:B(),capabilities:bh,clientInfo:gh}),Sh=Qm.extend({method:X(`initialize`),params:xh}),Ch=G({experimental:J(B(),Um).optional(),logging:Um.optional(),completions:Um.optional(),prompts:G({listChanged:H().optional()}).optional(),resources:G({subscribe:H().optional(),listChanged:H().optional()}).optional(),tools:G({listChanged:H().optional()}).optional(),tasks:yh.optional(),extensions:J(B(),Um).optional()}),wh=nh.extend({protocolVersion:B(),capabilities:Ch,serverInfo:gh,instructions:B().optional()}),Th=eh.extend({method:X(`notifications/initialized`),params:$m.optional()}),Eh=Qm.extend({method:X(`server/discover`),params:Xm.optional()}),Dh=nh.extend({supportedVersions:W(B()),capabilities:Ch,instructions:B().optional()}),Oh=Qm.extend({method:X(`ping`),params:Xm.optional()}),kh=G({progress:V(),total:Z(V()),message:Z(B())}),Ah=G({...$m.shape,...kh.shape,progressToken:Gm}),jh=eh.extend({method:X(`notifications/progress`),params:Ah}),Mh=Xm.extend({cursor:Km.optional()}),Nh=Qm.extend({params:Mh.optional()}),Ph=nh.extend({nextCursor:Km.optional()}),Fh=G({uri:B(),mimeType:Z(B()),_meta:J(B(),U()).optional()}),Ih=Fh.extend({text:B()}),Lh=B().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:`Invalid Base64 string`}),Rh=Fh.extend({blob:Lh}),zh=Y([`user`,`assistant`]),Bh=G({audience:W(zh).optional(),priority:V().min(0).max(1).optional(),lastModified:jm({offset:!0}).optional()}),Vh=G({...hh.shape,...mh.shape,uri:B(),description:Z(B()),mimeType:Z(B()),size:Z(V()),annotations:Bh.optional(),_meta:Z(K({}))}),Hh=G({...hh.shape,...mh.shape,uriTemplate:B(),description:Z(B()),mimeType:Z(B()),annotations:Bh.optional(),_meta:Z(K({}))}),Uh=Nh.extend({method:X(`resources/list`)}),Wh=Ph.extend({resources:W(Vh)}),Gh=Nh.extend({method:X(`resources/templates/list`)}),Kh=Ph.extend({resourceTemplates:W(Hh)}),qh=Xm.extend({uri:B()}),Jh=qh,Yh=Qm.extend({method:X(`resources/read`),params:Jh}),Xh=nh.extend({contents:W(q([Ih,Rh]))}),Zh=eh.extend({method:X(`notifications/resources/list_changed`),params:$m.optional()}),Qh=qh,$h=Qm.extend({method:X(`resources/subscribe`),params:Qh}),eg=qh,tg=Qm.extend({method:X(`resources/unsubscribe`),params:eg}),ng=G({toolsListChanged:H().optional(),promptsListChanged:H().optional(),resourcesListChanged:H().optional(),resourceSubscriptions:W(B()).optional()}),rg=Xm.extend({notifications:ng}),ig=Qm.extend({method:X(`subscriptions/listen`),params:rg}),ag=$m.extend({notifications:ng}),og=eh.extend({method:X(`notifications/subscriptions/acknowledged`),params:ag}),sg=th.extend({[Bm]:rh}),cg=nh.extend({_meta:sg}),lg=$m.extend({uri:B()}),ug=eh.extend({method:X(`notifications/resources/updated`),params:lg}),dg=G({name:B(),description:Z(B()),required:Z(H())}),fg=G({...hh.shape,...mh.shape,description:Z(B()),arguments:Z(W(dg)),_meta:Z(K({}))}),pg=Nh.extend({method:X(`prompts/list`)}),mg=Ph.extend({prompts:W(fg)}),hg=Xm.extend({name:B(),arguments:J(B(),B()).optional()}),gg=Qm.extend({method:X(`prompts/get`),params:hg}),_g=G({type:X(`text`),text:B(),annotations:Bh.optional(),_meta:J(B(),U()).optional()}),vg=G({type:X(`image`),data:Lh,mimeType:B(),annotations:Bh.optional(),_meta:J(B(),U()).optional()}),yg=G({type:X(`audio`),data:Lh,mimeType:B(),annotations:Bh.optional(),_meta:J(B(),U()).optional()}),bg=G({type:X(`tool_use`),name:B(),id:B(),input:J(B(),U()),_meta:J(B(),U()).optional()}),xg=G({type:X(`resource`),resource:q([Ih,Rh]),annotations:Bh.optional(),_meta:J(B(),U()).optional()}),Sg=Vh.extend({type:X(`resource_link`)}),Cg=q([_g,vg,yg,Sg,xg]),wg=G({role:zh,content:Cg}),Tg=nh.extend({description:B().optional(),messages:W(wg)}),Eg=eh.extend({method:X(`notifications/prompts/list_changed`),params:$m.optional()}),Dg=G({title:B().optional(),readOnlyHint:H().optional(),destructiveHint:H().optional(),idempotentHint:H().optional(),openWorldHint:H().optional()}),Og=G({taskSupport:Y([`required`,`optional`,`forbidden`]).optional()}),kg=G({...hh.shape,...mh.shape,description:B().optional(),inputSchema:G({type:X(`object`),properties:J(B(),Hm).optional(),required:W(B()).optional()}).catchall(U()),outputSchema:K({$schema:B().optional()}).optional(),annotations:Dg.optional(),execution:Og.optional(),_meta:J(B(),U()).optional()}),Ag=Nh.extend({method:X(`tools/list`)}),jg=Ph.extend({tools:W(kg)}),Mg=nh.extend({content:W(Cg).default([]),structuredContent:U().optional(),isError:H().optional()}),Ng=Mg.or(nh.extend({toolResult:U()})),Pg=Zm.extend({name:B(),arguments:J(B(),U()).optional()}),Fg=Qm.extend({method:X(`tools/call`),params:Pg}),Ig=eh.extend({method:X(`notifications/tools/list_changed`),params:$m.optional()}),Lg=G({autoRefresh:H().default(!0),debounceMs:V().int().nonnegative().default(300)}),Rg=Y([`debug`,`info`,`notice`,`warning`,`error`,`critical`,`alert`,`emergency`]),zg=Xm.extend({level:Rg}),Bg=Qm.extend({method:X(`logging/setLevel`),params:zg}),Vg=$m.extend({level:Rg,logger:B().optional(),data:U()}),Hg=eh.extend({method:X(`notifications/message`),params:Vg}),Ug=G({name:B().optional()}),Wg=G({hints:W(Ug).optional(),costPriority:V().min(0).max(1).optional(),speedPriority:V().min(0).max(1).optional(),intelligencePriority:V().min(0).max(1).optional()}),Gg=G({mode:Y([`auto`,`required`,`none`]).optional()}),Kg=G({type:X(`tool_result`),toolUseId:B().describe(`The unique identifier for the corresponding tool call.`),content:W(Cg),structuredContent:U().optional(),isError:H().optional(),_meta:J(B(),U()).optional()}),qg=Zp(`type`,[_g,vg,yg]),Jg=Zp(`type`,[_g,vg,yg,bg,Kg]),Yg=G({role:zh,content:q([Jg,W(Jg)]),_meta:J(B(),U()).optional()}),Xg=Zm.extend({messages:W(Yg),modelPreferences:Wg.optional(),systemPrompt:B().optional(),includeContext:Y([`none`,`thisServer`,`allServers`]).optional(),temperature:V().optional(),maxTokens:V().int(),stopSequences:W(B()).optional(),metadata:Um.optional(),tools:W(kg).optional(),toolChoice:Gg.optional()}),Zg=Qm.extend({method:X(`sampling/createMessage`),params:Xg}),Qg=nh.extend({model:B(),stopReason:Z(Y([`endTurn`,`stopSequence`,`maxTokens`]).or(B())),role:zh,content:qg}),$g=nh.extend({model:B(),stopReason:Z(Y([`endTurn`,`stopSequence`,`maxTokens`,`toolUse`]).or(B())),role:zh,content:q([Jg,W(Jg)])}),e_=G({type:X(`boolean`),title:B().optional(),description:B().optional(),default:H().optional()}),t_=G({type:X(`string`),title:B().optional(),description:B().optional(),minLength:V().optional(),maxLength:V().optional(),format:Y([`email`,`uri`,`date`,`date-time`]).optional(),default:B().optional()}),n_=G({type:Y([`number`,`integer`]),title:B().optional(),description:B().optional(),minimum:V().optional(),maximum:V().optional(),default:V().optional()}),r_=G({type:X(`string`),title:B().optional(),description:B().optional(),enum:W(B()),default:B().optional()}),i_=G({type:X(`string`),title:B().optional(),description:B().optional(),oneOf:W(G({const:B(),title:B()})),default:B().optional()}),a_=G({type:X(`string`),title:B().optional(),description:B().optional(),enum:W(B()),enumNames:W(B()).optional(),default:B().optional()}),o_=q([r_,i_]),s_=G({type:X(`array`),title:B().optional(),description:B().optional(),minItems:V().optional(),maxItems:V().optional(),items:G({type:X(`string`),enum:W(B())}),default:W(B()).optional()}),c_=G({type:X(`array`),title:B().optional(),description:B().optional(),minItems:V().optional(),maxItems:V().optional(),items:G({anyOf:W(G({const:B(),title:B()}))}),default:W(B()).optional()}),l_=q([s_,c_]),u_=q([a_,o_,l_]),d_=q([u_,e_,t_,n_]),f_=Zm.extend({mode:X(`form`).optional(),message:B(),requestedSchema:G({type:X(`object`),properties:J(B(),d_),required:W(B()).optional()}).catchall(U())}),p_=Zm.extend({mode:X(`url`),message:B(),elicitationId:B(),url:B().url()}),m_=q([f_,p_]),h_=Qm.extend({method:X(`elicitation/create`),params:m_}),g_=$m.extend({elicitationId:B()}),__=eh.extend({method:X(`notifications/elicitation/complete`),params:g_}),v_=nh.extend({action:Y([`accept`,`decline`,`cancel`]),content:Om(e=>e===null?void 0:e,J(B(),q([B(),V(),H(),W(B())])).optional())}),y_=G({type:X(`ref/resource`),uri:B()}),b_=G({type:X(`ref/prompt`),name:B()}),x_=Xm.extend({ref:q([b_,y_]),argument:G({name:B(),value:B()}),context:G({arguments:J(B(),B()).optional()}).optional()}),S_=Qm.extend({method:X(`completion/complete`),params:x_}),C_=nh.extend({completion:K({values:W(B()).max(100),total:Z(V().int()),hasMore:Z(H())})}),w_=G({uri:B().startsWith(`file://`),name:B().optional(),_meta:J(B(),U()).optional()}),T_=Qm.extend({method:X(`roots/list`),params:Xm.optional()}),E_=nh.extend({roots:W(w_)}),D_=eh.extend({method:X(`notifications/roots/list_changed`),params:$m.optional()}),O_=K({ttl:V().optional(),pollInterval:V().optional()}),k_=Y([`working`,`input_required`,`completed`,`failed`,`cancelled`]),A_=G({taskId:B(),status:k_,ttl:q([V(),Vp()]),createdAt:B(),lastUpdatedAt:B(),pollInterval:Z(V()),statusMessage:Z(B())}),j_=nh.extend({task:A_}),M_=$m.merge(A_),N_=eh.extend({method:X(`notifications/tasks/status`),params:M_}),P_=Qm.extend({method:X(`tasks/get`),params:Xm.extend({taskId:B()})}),F_=nh.merge(A_),I_=Qm.extend({method:X(`tasks/result`),params:Xm.extend({taskId:B()})}),L_=nh.loose(),R_=Nh.extend({method:X(`tasks/list`)}),z_=Ph.extend({tasks:W(A_)}),B_=Qm.extend({method:X(`tasks/cancel`),params:Xm.extend({taskId:B()})}),V_=nh.merge(A_),H_=q([Oh,Sh,Eh,S_,Bg,gg,pg,Uh,Gh,Yh,$h,tg,ig,Fg,Ag]),U_=q([fh,jh,Th,D_]),W_=q([uh,Qg,$g,v_,E_]),G_=q([Oh,Zg,h_,T_]),K_=q([fh,jh,Hg,ug,Zh,Ig,Eg,og,__]),q_=q([uh,wh,Dh,C_,Tg,mg,Wh,Kh,Xh,Mg,jg,cg]),J_=vp().superRefine((e,t)=>{if(!URL.canParse(e))return t.addIssue({code:km.custom,message:`URL must be parseable`,fatal:!0}),Oo}).refine(e=>{let t=new URL(e);return t.protocol!==`javascript:`&&t.protocol!==`data:`&&t.protocol!==`vbscript:`},{message:`URL cannot use javascript:, data:, or vbscript: scheme`}),Y_=K({resource:B().url(),authorization_servers:W(J_).optional(),jwks_uri:B().url().optional(),scopes_supported:W(B()).optional(),bearer_methods_supported:W(B()).optional(),resource_signing_alg_values_supported:W(B()).optional(),resource_name:B().optional(),resource_documentation:B().optional(),resource_policy_uri:B().url().optional(),resource_tos_uri:B().url().optional(),tls_client_certificate_bound_access_tokens:H().optional(),authorization_details_types_supported:W(B()).optional(),dpop_signing_alg_values_supported:W(B()).optional(),dpop_bound_access_tokens_required:H().optional()}),X_=K({issuer:B(),authorization_endpoint:J_,token_endpoint:J_,registration_endpoint:J_.optional(),scopes_supported:W(B()).optional(),response_types_supported:W(B()),response_modes_supported:W(B()).optional(),grant_types_supported:W(B()).optional(),token_endpoint_auth_methods_supported:W(B()).optional(),token_endpoint_auth_signing_alg_values_supported:W(B()).optional(),service_documentation:J_.optional(),revocation_endpoint:J_.optional(),revocation_endpoint_auth_methods_supported:W(B()).optional(),revocation_endpoint_auth_signing_alg_values_supported:W(B()).optional(),introspection_endpoint:B().optional(),introspection_endpoint_auth_methods_supported:W(B()).optional(),introspection_endpoint_auth_signing_alg_values_supported:W(B()).optional(),code_challenge_methods_supported:W(B()).optional(),client_id_metadata_document_supported:H().optional(),authorization_response_iss_parameter_supported:H().optional().catch(void 0)}),Z_=K({issuer:B(),authorization_endpoint:J_,token_endpoint:J_,userinfo_endpoint:J_.optional(),jwks_uri:J_,registration_endpoint:J_.optional(),scopes_supported:W(B()).optional(),response_types_supported:W(B()),response_modes_supported:W(B()).optional(),grant_types_supported:W(B()).optional(),acr_values_supported:W(B()).optional(),subject_types_supported:W(B()),id_token_signing_alg_values_supported:W(B()),id_token_encryption_alg_values_supported:W(B()).optional(),id_token_encryption_enc_values_supported:W(B()).optional(),userinfo_signing_alg_values_supported:W(B()).optional(),userinfo_encryption_alg_values_supported:W(B()).optional(),userinfo_encryption_enc_values_supported:W(B()).optional(),request_object_signing_alg_values_supported:W(B()).optional(),request_object_encryption_alg_values_supported:W(B()).optional(),request_object_encryption_enc_values_supported:W(B()).optional(),token_endpoint_auth_methods_supported:W(B()).optional(),token_endpoint_auth_signing_alg_values_supported:W(B()).optional(),display_values_supported:W(B()).optional(),claim_types_supported:W(B()).optional(),claims_supported:W(B()).optional(),service_documentation:B().optional(),claims_locales_supported:W(B()).optional(),ui_locales_supported:W(B()).optional(),claims_parameter_supported:H().optional(),request_parameter_supported:H().optional(),request_uri_parameter_supported:H().optional(),require_request_uri_registration:H().optional(),op_policy_uri:J_.optional(),op_tos_uri:J_.optional(),client_id_metadata_document_supported:H().optional(),authorization_response_iss_parameter_supported:H().optional().catch(void 0)}),Q_=G({...Z_.shape,...X_.pick({code_challenge_methods_supported:!0}).shape}),$_=G({access_token:B(),id_token:B().optional(),token_type:B(),expires_in:Nm().optional(),scope:B().optional(),refresh_token:B().optional()}).strip(),ev=G({issued_token_type:X(`urn:ietf:params:oauth:token-type:id-jag`),access_token:B(),token_type:B().optional(),expires_in:V().optional(),scope:B().optional()}).strip(),tv=G({error:B(),error_description:B().optional(),error_uri:B().optional()}),nv=J_.optional().or(X(``).transform(()=>void 0)),rv=G({redirect_uris:W(J_),token_endpoint_auth_method:B().optional(),grant_types:W(B()).optional(),response_types:W(B()).optional(),application_type:B().optional(),client_name:B().optional(),client_uri:J_.optional(),logo_uri:nv,scope:B().optional(),contacts:W(B()).optional(),tos_uri:nv,policy_uri:B().optional(),jwks_uri:J_.optional(),jwks:Up().optional(),software_id:B().optional(),software_version:B().optional(),software_statement:B().optional()}).strip(),iv=G({client_id:B(),client_secret:B().optional(),client_id_issued_at:V().optional(),client_secret_expires_at:V().optional()}).strip(),av=rv.merge(iv),ov=G({error:B(),error_description:B().optional()}).strip(),sv=G({token:B(),token_type_hint:B().optional()}).strip(),cv=Symbol.for(`mcp.sdk.errorBrands`);function lv(e,t){let n=new Set,r=t;for(;typeof r==`function`;){let e=r.mcpBrand;Object.prototype.hasOwnProperty.call(r,`mcpBrand`)&&typeof e==`string`&&n.add(e),r=Object.getPrototypeOf(r)}n.size!==0&&Object.defineProperty(e,cv,{value:n,enumerable:!1,configurable:!0})}function uv(e,t){try{if(typeof t==`object`&&t&&Object.prototype.hasOwnProperty.call(e,`mcpBrand`)&&typeof e.mcpBrand==`string`&&Object.prototype.hasOwnProperty.call(t,cv)){let n=t[cv];if(n&&typeof n.has==`function`&&n.has(e.mcpBrand))return!0}}catch{}return Function.prototype[Symbol.hasInstance].call(e,t)}(class e extends Error{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.OAuthError`})}static[Symbol.hasInstance](e){return uv(this,e)}static isInstance(e){if(typeof this!=`function`)throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return uv(this,e)}constructor(e,t,n){super(t),this.code=e,this.errorUri=n,this.name=`OAuthError`,lv(this,new.target)}toResponseObject(){let e={error:this.code,error_description:this.message};return this.errorUri&&(e.error_uri=this.errorUri),e}static fromResponse(t){return new e(t.error,t.error_description??t.error,t.error_uri)}});var dv=function(e){return e.NotConnected=`NOT_CONNECTED`,e.AlreadyConnected=`ALREADY_CONNECTED`,e.NotInitialized=`NOT_INITIALIZED`,e.CapabilityNotSupported=`CAPABILITY_NOT_SUPPORTED`,e.RequestTimeout=`REQUEST_TIMEOUT`,e.ConnectionClosed=`CONNECTION_CLOSED`,e.SendFailed=`SEND_FAILED`,e.InvalidResult=`INVALID_RESULT`,e.UnsupportedResultType=`UNSUPPORTED_RESULT_TYPE`,e.InputRequiredRoundsExceeded=`INPUT_REQUIRED_ROUNDS_EXCEEDED`,e.ListPaginationExceeded=`LIST_PAGINATION_EXCEEDED`,e.MethodNotSupportedByProtocolVersion=`METHOD_NOT_SUPPORTED_BY_PROTOCOL_VERSION`,e.EraNegotiationFailed=`ERA_NEGOTIATION_FAILED`,e.ClientHttpNotImplemented=`CLIENT_HTTP_NOT_IMPLEMENTED`,e.ClientHttpAuthentication=`CLIENT_HTTP_AUTHENTICATION`,e.ClientHttpForbidden=`CLIENT_HTTP_FORBIDDEN`,e.ClientHttpUnexpectedContent=`CLIENT_HTTP_UNEXPECTED_CONTENT`,e.ClientHttpFailedToOpenStream=`CLIENT_HTTP_FAILED_TO_OPEN_STREAM`,e.ClientHttpFailedToTerminateSession=`CLIENT_HTTP_FAILED_TO_TERMINATE_SESSION`,e}({}),fv=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.SdkError`})}static[Symbol.hasInstance](e){return uv(this,e)}static isInstance(e){if(typeof this!=`function`)throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return uv(this,e)}constructor(e,t,n){super(t),this.code=e,this.data=n,this.name=`SdkError`,lv(this,new.target)}};(class extends fv{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.SdkHttpError`})}constructor(e,t,n){super(e,t,n),this.name=`SdkHttpError`}get status(){return this.data.status}get statusText(){return this.data.statusText}});var pv=`2026-07-28`;function mv(e){return e>=pv}function hv(e){let t=e.structuredContent;return t===void 0||typeof t==`object`&&t&&!Array.isArray(t)||(e.content?.some(e=>e.type===`text`)??!1)?e:{...e,content:[...e.content??[],{type:`text`,text:JSON.stringify(t)}]}}var gv=[`task`,`inputRequests`,`requestState`];function _v(e){return typeof e!=`object`||!e||Array.isArray(e)||e.content!==void 0||gv.some(t=>t in e)?e:{...e,content:[]}}function vv(){let e=wm(()=>q([B(),V(),H(),Vp(),J(B(),e),W(e)])),t=J(B(),e),n=q([B(),V().int()]),r=B(),i=G({ttl:V().optional()}),a=G({taskId:B()}),o=K({progressToken:n.optional(),"io.modelcontextprotocol/related-task":a.optional()}),s=G({_meta:o.optional()}),c=s.extend({task:i.optional()}),l=G({method:B(),params:s.loose().optional()}),u=G({_meta:o.optional()}),d=G({method:B(),params:u.loose().optional()}),f=K({_meta:o.optional()}),p=q([B(),V().int()]),m=f.strict(),h=u.extend({requestId:p.optional(),reason:B().optional()}),g=d.extend({method:X(`notifications/cancelled`),params:h}),_=G({src:B(),mimeType:B().optional(),sizes:W(B()).optional(),theme:Y([`light`,`dark`]).optional()}),v=G({icons:W(_).optional()}),y=G({name:B(),title:B().optional()}),b=y.extend({...y.shape,...v.shape,version:B(),websiteUrl:B().optional(),description:B().optional()}),ee=Om(e=>e&&typeof e==`object`&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,$p(G({form:$p(G({applyDefaults:H().optional()}),t).optional(),url:t.optional()}),t.optional())),te=K({list:t.optional(),cancel:t.optional(),requests:K({sampling:K({createMessage:t.optional()}).optional(),elicitation:K({create:t.optional()}).optional()}).optional()}),x=K({list:t.optional(),cancel:t.optional(),requests:K({tools:K({call:t.optional()}).optional()}).optional()}),ne=G({experimental:J(B(),t).optional(),sampling:G({context:t.optional(),tools:t.optional()}).optional(),elicitation:ee.optional(),roots:G({listChanged:H().optional()}).optional(),tasks:te.optional(),extensions:J(B(),t).optional()}),S=s.extend({protocolVersion:B(),capabilities:ne,clientInfo:b}),re=l.extend({method:X(`initialize`),params:S}),C=G({experimental:J(B(),t).optional(),logging:t.optional(),completions:t.optional(),prompts:G({listChanged:H().optional()}).optional(),resources:G({subscribe:H().optional(),listChanged:H().optional()}).optional(),tools:G({listChanged:H().optional()}).optional(),tasks:x.optional(),extensions:J(B(),t).optional()}),ie=f.extend({protocolVersion:B(),capabilities:C,serverInfo:b,instructions:B().optional()}),ae=d.extend({method:X(`notifications/initialized`),params:u.optional()}),oe=l.extend({method:X(`ping`),params:s.optional()}),se=G({progress:V(),total:Z(V()),message:Z(B())}),ce=G({...u.shape,...se.shape,progressToken:n}),le=d.extend({method:X(`notifications/progress`),params:ce}),ue=s.extend({cursor:r.optional()}),de=l.extend({params:ue.optional()}),fe=f.extend({nextCursor:r.optional()}),pe=G({uri:B(),mimeType:Z(B()),_meta:J(B(),U()).optional()}),me=pe.extend({text:B()}),he=B().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:`Invalid Base64 string`}),ge=pe.extend({blob:he}),_e=Y([`user`,`assistant`]),ve=G({audience:W(_e).optional(),priority:V().min(0).max(1).optional(),lastModified:jm({offset:!0}).optional()}),ye=G({...y.shape,...v.shape,uri:B(),description:Z(B()),mimeType:Z(B()),size:Z(V()),annotations:ve.optional(),_meta:Z(K({}))}),be=G({...y.shape,...v.shape,uriTemplate:B(),description:Z(B()),mimeType:Z(B()),annotations:ve.optional(),_meta:Z(K({}))}),xe=de.extend({method:X(`resources/list`)}),Se=fe.extend({resources:W(ye)}),Ce=de.extend({method:X(`resources/templates/list`)}),we=fe.extend({resourceTemplates:W(be)}),Te=s.extend({uri:B()}),Ee=Te,w=l.extend({method:X(`resources/read`),params:Ee}),T=f.extend({contents:W(q([me,ge]))}),De=d.extend({method:X(`notifications/resources/list_changed`),params:u.optional()}),Oe=Te,ke=l.extend({method:X(`resources/subscribe`),params:Oe}),Ae=Te,je=l.extend({method:X(`resources/unsubscribe`),params:Ae}),Me=u.extend({uri:B()}),Ne=d.extend({method:X(`notifications/resources/updated`),params:Me}),Pe=G({name:B(),description:Z(B()),required:Z(H())}),Fe=G({...y.shape,...v.shape,description:Z(B()),arguments:Z(W(Pe)),_meta:Z(K({}))}),Ie=de.extend({method:X(`prompts/list`)}),Le=fe.extend({prompts:W(Fe)}),Re=s.extend({name:B(),arguments:J(B(),B()).optional()}),ze=l.extend({method:X(`prompts/get`),params:Re}),Be=G({type:X(`text`),text:B(),annotations:ve.optional(),_meta:J(B(),U()).optional()}),Ve=G({type:X(`image`),data:he,mimeType:B(),annotations:ve.optional(),_meta:J(B(),U()).optional()}),He=G({type:X(`audio`),data:he,mimeType:B(),annotations:ve.optional(),_meta:J(B(),U()).optional()}),Ue=G({type:X(`tool_use`),name:B(),id:B(),input:J(B(),U()),_meta:J(B(),U()).optional()}),We=G({type:X(`resource`),resource:q([me,ge]),annotations:ve.optional(),_meta:J(B(),U()).optional()}),Ge=ye.extend({type:X(`resource_link`)}),Ke=q([Be,Ve,He,Ge,We]),qe=G({role:_e,content:Ke}),Je=f.extend({description:B().optional(),messages:W(qe)}),Ye=d.extend({method:X(`notifications/prompts/list_changed`),params:u.optional()}),Xe=G({title:B().optional(),readOnlyHint:H().optional(),destructiveHint:H().optional(),idempotentHint:H().optional(),openWorldHint:H().optional()}),Ze=G({taskSupport:Y([`required`,`optional`,`forbidden`]).optional()}),Qe=G({...y.shape,...v.shape,description:B().optional(),inputSchema:G({type:X(`object`),properties:J(B(),e).optional(),required:W(B()).optional()}).catchall(U()),outputSchema:G({type:X(`object`),properties:J(B(),e).optional(),required:W(B()).optional()}).catchall(U()).optional(),annotations:Xe.optional(),execution:Ze.optional(),_meta:J(B(),U()).optional()}),$e=de.extend({method:X(`tools/list`)}),et=fe.extend({tools:W(Qe)}),tt=f.extend({content:W(Ke),structuredContent:J(B(),U()).optional(),isError:H().optional()}),nt=c.extend({name:B(),arguments:J(B(),U()).optional()}),rt=l.extend({method:X(`tools/call`),params:nt}),it=d.extend({method:X(`notifications/tools/list_changed`),params:u.optional()}),at=Y([`debug`,`info`,`notice`,`warning`,`error`,`critical`,`alert`,`emergency`]),ot=s.extend({level:at}),st=l.extend({method:X(`logging/setLevel`),params:ot}),ct=u.extend({level:at,logger:B().optional(),data:U()}),lt=d.extend({method:X(`notifications/message`),params:ct}),ut=G({name:B().optional()}),dt=G({hints:W(ut).optional(),costPriority:V().min(0).max(1).optional(),speedPriority:V().min(0).max(1).optional(),intelligencePriority:V().min(0).max(1).optional()}),ft=G({mode:Y([`auto`,`required`,`none`]).optional()}),pt=G({type:X(`tool_result`),toolUseId:B().describe(`The unique identifier for the corresponding tool call.`),content:W(Ke),structuredContent:G({}).loose().optional(),isError:H().optional(),_meta:J(B(),U()).optional()}),mt=Zp(`type`,[Be,Ve,He]),ht=Zp(`type`,[Be,Ve,He,Ue,pt]),gt=G({role:_e,content:q([ht,W(ht)]),_meta:J(B(),U()).optional()}),_t=c.extend({messages:W(gt),modelPreferences:dt.optional(),systemPrompt:B().optional(),includeContext:Y([`none`,`thisServer`,`allServers`]).optional(),temperature:V().optional(),maxTokens:V().int(),stopSequences:W(B()).optional(),metadata:t.optional(),tools:W(Qe).optional(),toolChoice:ft.optional()}),vt=l.extend({method:X(`sampling/createMessage`),params:_t}),yt=f.extend({model:B(),stopReason:Z(Y([`endTurn`,`stopSequence`,`maxTokens`]).or(B())),role:_e,content:mt}),bt=f.extend({model:B(),stopReason:Z(Y([`endTurn`,`stopSequence`,`maxTokens`,`toolUse`]).or(B())),role:_e,content:q([ht,W(ht)])}),xt=G({type:X(`boolean`),title:B().optional(),description:B().optional(),default:H().optional()}),St=G({type:X(`string`),title:B().optional(),description:B().optional(),minLength:V().optional(),maxLength:V().optional(),format:Y([`email`,`uri`,`date`,`date-time`]).optional(),default:B().optional()}),Ct=G({type:Y([`number`,`integer`]),title:B().optional(),description:B().optional(),minimum:V().optional(),maximum:V().optional(),default:V().optional()}),wt=G({type:X(`string`),title:B().optional(),description:B().optional(),enum:W(B()),default:B().optional()}),Tt=G({type:X(`string`),title:B().optional(),description:B().optional(),oneOf:W(G({const:B(),title:B()})),default:B().optional()}),Et=G({type:X(`string`),title:B().optional(),description:B().optional(),enum:W(B()),enumNames:W(B()).optional(),default:B().optional()}),Dt=q([wt,Tt]),Ot=G({type:X(`array`),title:B().optional(),description:B().optional(),minItems:V().optional(),maxItems:V().optional(),items:G({type:X(`string`),enum:W(B())}),default:W(B()).optional()}),kt=G({type:X(`array`),title:B().optional(),description:B().optional(),minItems:V().optional(),maxItems:V().optional(),items:G({anyOf:W(G({const:B(),title:B()}))}),default:W(B()).optional()}),At=q([Ot,kt]),jt=q([Et,Dt,At]),Mt=q([jt,xt,St,Ct]),Nt=c.extend({mode:X(`form`).optional(),message:B(),requestedSchema:G({type:X(`object`),properties:J(B(),Mt),required:W(B()).optional()}).catchall(U())}),Pt=c.extend({mode:X(`url`),message:B(),elicitationId:B(),url:B().url()}),Ft=q([Nt,Pt]),It=l.extend({method:X(`elicitation/create`),params:Ft}),Lt=u.extend({elicitationId:B()}),Rt=d.extend({method:X(`notifications/elicitation/complete`),params:Lt}),zt=f.extend({action:Y([`accept`,`decline`,`cancel`]),content:Om(e=>e===null?void 0:e,J(B(),q([B(),V(),H(),W(B())])).optional())}),Bt=G({type:X(`ref/resource`),uri:B()}),Vt=G({type:X(`ref/prompt`),name:B()}),Ht=s.extend({ref:q([Vt,Bt]),argument:G({name:B(),value:B()}),context:G({arguments:J(B(),B()).optional()}).optional()}),Ut=l.extend({method:X(`completion/complete`),params:Ht}),Wt=f.extend({completion:K({values:W(B()).max(100),total:Z(V().int()),hasMore:Z(H())})}),Gt=G({uri:B().startsWith(`file://`),name:B().optional(),_meta:J(B(),U()).optional()}),Kt=l.extend({method:X(`roots/list`),params:s.optional()}),qt=f.extend({roots:W(Gt)}),Jt=d.extend({method:X(`notifications/roots/list_changed`),params:u.optional()}),Yt=K({ttl:V().optional(),pollInterval:V().optional()}),Xt=Y([`working`,`input_required`,`completed`,`failed`,`cancelled`]),Zt=G({taskId:B(),status:Xt,ttl:q([V(),Vp()]),createdAt:B(),lastUpdatedAt:B(),pollInterval:Z(V()),statusMessage:Z(B())}),Qt=f.extend({task:Zt}),$t=u.merge(Zt),E=d.extend({method:X(`notifications/tasks/status`),params:$t}),en=l.extend({method:X(`tasks/get`),params:s.extend({taskId:B()})}),tn=f.merge(Zt),nn=l.extend({method:X(`tasks/result`),params:s.extend({taskId:B()})}),rn=f.loose(),D=de.extend({method:X(`tasks/list`)}),an=fe.extend({tasks:W(Zt)}),on=l.extend({method:X(`tasks/cancel`),params:s.extend({taskId:B()})});return{JSONValueSchema:e,JSONObjectSchema:t,ProgressTokenSchema:n,CursorSchema:r,TaskMetadataSchema:i,RelatedTaskMetadataSchema:a,RequestMetaSchema:o,BaseRequestParamsSchema:s,TaskAugmentedRequestParamsSchema:c,RequestSchema:l,NotificationsParamsSchema:u,NotificationSchema:d,ResultSchema:f,RequestIdSchema:p,EmptyResultSchema:m,CancelledNotificationParamsSchema:h,CancelledNotificationSchema:g,IconSchema:_,IconsSchema:v,BaseMetadataSchema:y,ImplementationSchema:b,ClientTasksCapabilitySchema:te,ServerTasksCapabilitySchema:x,ClientCapabilitiesSchema:ne,InitializeRequestParamsSchema:S,InitializeRequestSchema:re,ServerCapabilitiesSchema:C,InitializeResultSchema:ie,InitializedNotificationSchema:ae,PingRequestSchema:oe,ProgressSchema:se,ProgressNotificationParamsSchema:ce,ProgressNotificationSchema:le,PaginatedRequestParamsSchema:ue,PaginatedRequestSchema:de,PaginatedResultSchema:fe,ResourceContentsSchema:pe,TextResourceContentsSchema:me,BlobResourceContentsSchema:ge,RoleSchema:_e,AnnotationsSchema:ve,ResourceSchema:ye,ResourceTemplateSchema:be,ListResourcesRequestSchema:xe,ListResourcesResultSchema:Se,ListResourceTemplatesRequestSchema:Ce,ListResourceTemplatesResultSchema:we,ResourceRequestParamsSchema:Te,ReadResourceRequestParamsSchema:Ee,ReadResourceRequestSchema:w,ReadResourceResultSchema:T,ResourceListChangedNotificationSchema:De,SubscribeRequestParamsSchema:Oe,SubscribeRequestSchema:ke,UnsubscribeRequestParamsSchema:Ae,UnsubscribeRequestSchema:je,ResourceUpdatedNotificationParamsSchema:Me,ResourceUpdatedNotificationSchema:Ne,PromptArgumentSchema:Pe,PromptSchema:Fe,ListPromptsRequestSchema:Ie,ListPromptsResultSchema:Le,GetPromptRequestParamsSchema:Re,GetPromptRequestSchema:ze,TextContentSchema:Be,ImageContentSchema:Ve,AudioContentSchema:He,ToolUseContentSchema:Ue,EmbeddedResourceSchema:We,ResourceLinkSchema:Ge,ContentBlockSchema:Ke,PromptMessageSchema:qe,GetPromptResultSchema:Je,PromptListChangedNotificationSchema:Ye,ToolAnnotationsSchema:Xe,ToolExecutionSchema:Ze,ToolSchema:Qe,ListToolsRequestSchema:$e,ListToolsResultSchema:et,CallToolResultSchema:tt,CallToolRequestParamsSchema:nt,CallToolRequestSchema:rt,ToolListChangedNotificationSchema:it,LoggingLevelSchema:at,SetLevelRequestParamsSchema:ot,SetLevelRequestSchema:st,LoggingMessageNotificationParamsSchema:ct,LoggingMessageNotificationSchema:lt,ModelHintSchema:ut,ModelPreferencesSchema:dt,ToolChoiceSchema:ft,ToolResultContentSchema:pt,SamplingContentSchema:mt,SamplingMessageContentBlockSchema:ht,SamplingMessageSchema:gt,CreateMessageRequestParamsSchema:_t,CreateMessageRequestSchema:vt,CreateMessageResultSchema:yt,CreateMessageResultWithToolsSchema:bt,BooleanSchemaSchema:xt,StringSchemaSchema:St,NumberSchemaSchema:Ct,UntitledSingleSelectEnumSchemaSchema:wt,TitledSingleSelectEnumSchemaSchema:Tt,LegacyTitledEnumSchemaSchema:Et,SingleSelectEnumSchemaSchema:Dt,UntitledMultiSelectEnumSchemaSchema:Ot,TitledMultiSelectEnumSchemaSchema:kt,MultiSelectEnumSchemaSchema:At,EnumSchemaSchema:jt,PrimitiveSchemaDefinitionSchema:Mt,ElicitRequestFormParamsSchema:Nt,ElicitRequestURLParamsSchema:Pt,ElicitRequestParamsSchema:Ft,ElicitRequestSchema:It,ElicitationCompleteNotificationParamsSchema:Lt,ElicitationCompleteNotificationSchema:Rt,ElicitResultSchema:zt,ResourceTemplateReferenceSchema:Bt,PromptReferenceSchema:Vt,CompleteRequestParamsSchema:Ht,CompleteRequestSchema:Ut,CompleteResultSchema:Wt,RootSchema:Gt,ListRootsRequestSchema:Kt,ListRootsResultSchema:qt,RootsListChangedNotificationSchema:Jt,TaskCreationParamsSchema:Yt,TaskStatusSchema:Xt,TaskSchema:Zt,CreateTaskResultSchema:Qt,TaskStatusNotificationParamsSchema:$t,TaskStatusNotificationSchema:E,GetTaskRequestSchema:en,GetTaskResultSchema:tn,GetTaskPayloadRequestSchema:nn,GetTaskPayloadResultSchema:rn,ListTasksRequestSchema:D,ListTasksResultSchema:an,CancelTaskRequestSchema:on,CancelTaskResultSchema:f.merge(Zt),ClientRequestSchema:q([oe,re,Ut,st,ze,Ie,xe,Ce,w,ke,je,rt,$e,en,nn,D,on]),ClientNotificationSchema:q([g,le,ae,Jt,E]),ClientResultSchema:q([m,yt,bt,zt,qt,tn,an,Qt]),ServerRequestSchema:q([oe,vt,It,Kt,en,nn,D,on]),ServerNotificationSchema:q([g,le,lt,Ne,De,it,Ye,E,Rt]),ServerResultSchema:q([m,ie,Wt,Je,Le,Se,we,T,tt,et,tn,an,Qt]),CallToolResultWireSchema:U().superRefine((e,t)=>{if(typeof e==`object`&&e&&!Array.isArray(e)&&e.content===void 0){for(let n of gv)if(n in e){t.addIssue({code:`custom`,message:`content is required when the body carries '${n}' — another result family cannot default into an empty tools/call success`});return}}}).transform(_v).pipe(tt)}}var yv;function bv(){return yv??=vv()}function xv(e){return e.type!==`object`}var Sv=new Set([`const`,`enum`,`default`,`examples`]),Cv=new Set([`properties`,`patternProperties`,`$defs`,`definitions`,`dependentSchemas`,`dependencies`]);function wv(e){return e!==void 0&&!(typeof e==`string`&&e.startsWith(`#`))}function Tv(e){let t=typeof e.$schema==`string`?e.$schema:void 0;if(wv(e.$id))return{...t!==void 0&&{$schema:t},type:`object`,properties:{result:e},required:[`result`]};let n=ha(e.$schema)&&e.$recursiveAnchor!==!0,r=(e,t)=>{if(Array.isArray(e))return e.map(e=>r(e,!1));if(typeof e!=`object`||!e||!t&&wv(e.$id))return e;let i={},a=!1;for(let[o,s]of Object.entries(e))t?i[o]=r(s,!1):(o===`$ref`||o===`$dynamicRef`)&&typeof s==`string`?i[o]=s===`#`?`#/properties/result`:s.startsWith(`#/`)?`#/properties/result${s.slice(1)}`:s:o===`$recursiveRef`&&s===`#`&&n?a=!0:i[o]=Sv.has(o)?s:Cv.has(o)?r(s,!0):r(s,!1);return a&&(`$ref`in i?i.allOf=[...Array.isArray(i.allOf)?i.allOf:[],{$ref:`#/properties/result`}]:i.$ref=`#/properties/result`),i};return{...t!==void 0&&{$schema:t},type:`object`,properties:{result:r(e,!1)},required:[`result`]}}var Ev={ping:null,initialize:null,"completion/complete":null,"logging/setLevel":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"resources/subscribe":null,"resources/unsubscribe":null,"tools/call":null,"tools/list":null,"tasks/get":null,"tasks/result":null,"tasks/list":null,"tasks/cancel":null,"sampling/createMessage":null,"elicitation/create":null,"roots/list":null},Dv={"notifications/cancelled":null,"notifications/progress":null,"notifications/initialized":null,"notifications/roots/list_changed":null,"notifications/tasks/status":null,"notifications/message":null,"notifications/resources/updated":null,"notifications/resources/list_changed":null,"notifications/tools/list_changed":null,"notifications/prompts/list_changed":null,"notifications/elicitation/complete":null},Ov={ping:null,initialize:null,"completion/complete":null,"logging/setLevel":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"resources/subscribe":null,"resources/unsubscribe":null,"tools/call":null,"tools/list":null,"sampling/createMessage":null,"elicitation/create":null,"roots/list":null},kv;function Av(){if(kv)return kv;let e=bv();return kv={requestSchemas:{ping:e.PingRequestSchema,initialize:e.InitializeRequestSchema,"completion/complete":e.CompleteRequestSchema,"logging/setLevel":e.SetLevelRequestSchema,"prompts/get":e.GetPromptRequestSchema,"prompts/list":e.ListPromptsRequestSchema,"resources/list":e.ListResourcesRequestSchema,"resources/templates/list":e.ListResourceTemplatesRequestSchema,"resources/read":e.ReadResourceRequestSchema,"resources/subscribe":e.SubscribeRequestSchema,"resources/unsubscribe":e.UnsubscribeRequestSchema,"tools/call":e.CallToolRequestSchema,"tools/list":e.ListToolsRequestSchema,"tasks/get":e.GetTaskRequestSchema,"tasks/result":e.GetTaskPayloadRequestSchema,"tasks/list":e.ListTasksRequestSchema,"tasks/cancel":e.CancelTaskRequestSchema,"sampling/createMessage":e.CreateMessageRequestSchema,"elicitation/create":e.ElicitRequestSchema,"roots/list":e.ListRootsRequestSchema},notificationSchemas:{"notifications/cancelled":e.CancelledNotificationSchema,"notifications/progress":e.ProgressNotificationSchema,"notifications/initialized":e.InitializedNotificationSchema,"notifications/roots/list_changed":e.RootsListChangedNotificationSchema,"notifications/tasks/status":e.TaskStatusNotificationSchema,"notifications/message":e.LoggingMessageNotificationSchema,"notifications/resources/updated":e.ResourceUpdatedNotificationSchema,"notifications/resources/list_changed":e.ResourceListChangedNotificationSchema,"notifications/tools/list_changed":e.ToolListChangedNotificationSchema,"notifications/prompts/list_changed":e.PromptListChangedNotificationSchema,"notifications/elicitation/complete":e.ElicitationCompleteNotificationSchema},resultSchemas:{ping:e.EmptyResultSchema,initialize:e.InitializeResultSchema,"completion/complete":e.CompleteResultSchema,"logging/setLevel":e.EmptyResultSchema,"prompts/get":e.GetPromptResultSchema,"prompts/list":e.ListPromptsResultSchema,"resources/list":e.ListResourcesResultSchema,"resources/templates/list":e.ListResourceTemplatesResultSchema,"resources/read":e.ReadResourceResultSchema,"resources/subscribe":e.EmptyResultSchema,"resources/unsubscribe":e.EmptyResultSchema,"tools/call":e.CallToolResultWireSchema,"tools/list":e.ListToolsResultSchema,"sampling/createMessage":e.CreateMessageResultWithToolsSchema,"elicitation/create":e.ElicitResultSchema,"roots/list":e.ListRootsResultSchema}},kv}function jv(e){return Object.prototype.hasOwnProperty.call(Ev,e)}function Mv(e){return Object.prototype.hasOwnProperty.call(Dv,e)}function Nv(e){return Object.prototype.hasOwnProperty.call(Ov,e)}function Pv(e){return Nv(e)?Av().resultSchemas[e]:void 0}function Fv(e){return jv(e)?Av().requestSchemas[e]:void 0}function Iv(e){return Mv(e)?Av().notificationSchemas[e]:void 0}Object.keys(Ev),Object.keys(Dv);function Lv(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Rv(e,t){if(e===void 0)return{ok:!1,reason:`not-in-era`};let n=e.safeParse(t);return n.success?{ok:!0,value:n.data}:{ok:!1,reason:`invalid`,message:String(n.error)}}var zv={ok:!1,reason:`not-in-era`};function Bv(e){return Lv(e)&&Lv(e.outputSchema)&&xv(e.outputSchema)}function Vv(e){return e}var Hv={era:`2025-11-25`,hasRequestMethod:jv,hasNotificationMethod:Mv,validateRequest:(e,t)=>Rv(Fv(e),t),validateResult:(e,t)=>Rv(Pv(e),t),validateNotification:(e,t)=>Rv(Iv(e),t),hasInputRequestMethod:()=>!1,validateInputRequest:()=>zv,validateInputResponse:()=>zv,samplingResultVariant:((e,t)=>{let n=bv();return Rv(e?n.CreateMessageResultWithToolsSchema:n.CreateMessageResultSchema,t)}),outboundEnvelope:e=>void 0,validateEnvelopeMeta:e=>[],projectCallToolResult(e,t){let n=hv(e),r=n.structuredContent;if(r===void 0)return n;let i=typeof r!=`object`||!r||Array.isArray(r),a=t!==void 0&&xv(t);return!i&&!a?n:{...n,structuredContent:{result:r}}},decodeResult(e,t){if(Lv(t)&&`resultType`in t){let e={...t};return delete e.resultType,{kind:`complete`,result:Vv(e)}}return{kind:`complete`,result:Vv(t)}},encodeResult(e,t){if(e!==`tools/list`)return t;let n=t.tools;return!Array.isArray(n)||!n.some(e=>Bv(e))?t:{...t,tools:n.map(e=>Bv(e)?{...e,outputSchema:Tv(e.outputSchema)}:e)}},encodeErrorCode:e=>e===-32002?-32602:e,checkInboundEnvelope:e=>void 0};function Uv(){let e=wm(()=>q([B(),V(),H(),Vp(),J(B(),e),W(e)])),t=J(B(),e),n=q([B(),V().int()]),r=B(),i=q([B(),V().int()]),a=Y([`user`,`assistant`]),o=Y([`debug`,`info`,`notice`,`warning`,`error`,`critical`,`alert`,`emergency`]),s=B().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:`Invalid Base64 string`}),c=G({ttl:V().optional()}),l=G({taskId:B()}),u=K({progressToken:n.optional(),"io.modelcontextprotocol/related-task":l.optional()}),d=G({_meta:u.optional()}),f=d.extend({task:c.optional()}),p=G({_meta:u.optional()}),m=G({method:B(),params:p.loose().optional()}),h=G({src:B(),mimeType:B().optional(),sizes:W(B()).optional(),theme:Y([`light`,`dark`]).optional()}),g=G({icons:W(h).optional()}),_=G({name:B(),title:B().optional()}),v=_.extend({..._.shape,...g.shape,version:B(),websiteUrl:B().optional(),description:B().optional()}),y=Om(e=>e&&typeof e==`object`&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,$p(G({form:$p(G({applyDefaults:H().optional()}),t).optional(),url:t.optional()}),t.optional())),b=K({list:t.optional(),cancel:t.optional(),requests:K({sampling:K({createMessage:t.optional()}).optional(),elicitation:K({create:t.optional()}).optional()}).optional()}),ee=K({list:t.optional(),cancel:t.optional(),requests:K({tools:K({call:t.optional()}).optional()}).optional()}),te=G({experimental:J(B(),t).optional(),sampling:G({context:t.optional(),tools:t.optional()}).optional(),elicitation:y.optional(),roots:G({listChanged:H().optional()}).optional(),tasks:b.optional(),extensions:J(B(),t).optional()}),x=G({experimental:J(B(),t).optional(),logging:t.optional(),completions:t.optional(),prompts:G({listChanged:H().optional()}).optional(),resources:G({subscribe:H().optional(),listChanged:H().optional()}).optional(),tools:G({listChanged:H().optional()}).optional(),tasks:ee.optional(),extensions:J(B(),t).optional()}),ne=G({progress:V(),total:Z(V()),message:Z(B())}),S=G({...p.shape,...ne.shape,progressToken:n}),re=m.extend({method:X(`notifications/progress`),params:S}),C=p.extend({level:o,logger:B().optional(),data:U()}),ie=m.extend({method:X(`notifications/message`),params:C}),ae=G({uri:B(),mimeType:Z(B()),_meta:J(B(),U()).optional()}),oe=ae.extend({text:B()}),se=ae.extend({blob:s}),ce=G({audience:W(a).optional(),priority:V().min(0).max(1).optional(),lastModified:jm({offset:!0}).optional()}),le=G({..._.shape,...g.shape,uri:B(),description:Z(B()),mimeType:Z(B()),size:Z(V()),annotations:ce.optional(),_meta:Z(K({}))}),ue=G({..._.shape,...g.shape,uriTemplate:B(),description:Z(B()),mimeType:Z(B()),annotations:ce.optional(),_meta:Z(K({}))}),de=m.extend({method:X(`notifications/resources/list_changed`),params:p.optional()}),fe=p.extend({uri:B()}),pe=m.extend({method:X(`notifications/resources/updated`),params:fe}),me=G({name:B(),description:Z(B()),required:Z(H())}),he=G({..._.shape,...g.shape,description:Z(B()),arguments:Z(W(me)),_meta:Z(K({}))}),ge=m.extend({method:X(`notifications/prompts/list_changed`),params:p.optional()}),_e=G({type:X(`text`),text:B(),annotations:ce.optional(),_meta:J(B(),U()).optional()}),ve=G({type:X(`image`),data:s,mimeType:B(),annotations:ce.optional(),_meta:J(B(),U()).optional()}),ye=G({type:X(`audio`),data:s,mimeType:B(),annotations:ce.optional(),_meta:J(B(),U()).optional()}),be=G({type:X(`tool_use`),name:B(),id:B(),input:J(B(),U()),_meta:J(B(),U()).optional()}),xe=G({type:X(`resource`),resource:q([oe,se]),annotations:ce.optional(),_meta:J(B(),U()).optional()}),Se=le.extend({type:X(`resource_link`)}),Ce=q([_e,ve,ye,Se,xe]),we=G({role:a,content:Ce}),Te=G({title:B().optional(),readOnlyHint:H().optional(),destructiveHint:H().optional(),idempotentHint:H().optional(),openWorldHint:H().optional()}),Ee=m.extend({method:X(`notifications/tools/list_changed`),params:p.optional()}),w=G({name:B().optional()}),T=G({hints:W(w).optional(),costPriority:V().min(0).max(1).optional(),speedPriority:V().min(0).max(1).optional(),intelligencePriority:V().min(0).max(1).optional()}),De=G({mode:Y([`auto`,`required`,`none`]).optional()}),Oe=G({type:X(`boolean`),title:B().optional(),description:B().optional(),default:H().optional()}),ke=G({type:X(`string`),title:B().optional(),description:B().optional(),minLength:V().optional(),maxLength:V().optional(),format:Y([`email`,`uri`,`date`,`date-time`]).optional(),default:B().optional()}),Ae=G({type:Y([`number`,`integer`]),title:B().optional(),description:B().optional(),minimum:V().optional(),maximum:V().optional(),default:V().optional()}),je=G({type:X(`string`),title:B().optional(),description:B().optional(),enum:W(B()),default:B().optional()}),Me=G({type:X(`string`),title:B().optional(),description:B().optional(),oneOf:W(G({const:B(),title:B()})),default:B().optional()}),Ne=G({type:X(`string`),title:B().optional(),description:B().optional(),enum:W(B()),enumNames:W(B()).optional(),default:B().optional()}),Pe=q([je,Me]),Fe=G({type:X(`array`),title:B().optional(),description:B().optional(),minItems:V().optional(),maxItems:V().optional(),items:G({type:X(`string`),enum:W(B())}),default:W(B()).optional()}),Ie=G({type:X(`array`),title:B().optional(),description:B().optional(),minItems:V().optional(),maxItems:V().optional(),items:G({anyOf:W(G({const:B(),title:B()}))}),default:W(B()).optional()}),Le=q([Fe,Ie]),Re=q([Ne,Pe,Le]),ze=q([Re,Oe,ke,Ae]),Be=f.extend({mode:X(`form`).optional(),message:B(),requestedSchema:G({type:X(`object`),properties:J(B(),ze),required:W(B()).optional()}).catchall(U())}),Ve=G({type:X(`ref/resource`),uri:B()}),He=G({type:X(`ref/prompt`),name:B()}),Ue=G({uri:B().startsWith(`file://`),name:B().optional(),_meta:J(B(),U()).optional()}),We=te.shape,Ge=G({experimental:We.experimental,sampling:We.sampling,elicitation:We.elicitation,roots:We.roots,extensions:We.extensions}),Ke=x.shape,qe=G({experimental:Ke.experimental,logging:Ke.logging,completions:Ke.completions,prompts:Ke.prompts,resources:Ke.resources,tools:Ke.tools,extensions:Ke.extensions}),Je=K({progressToken:n.optional(),[Im]:B(),[Lm]:v.optional(),[zm]:Ge,[Vm]:o.optional()}),Ye=G({..._.shape,...g.shape,description:B().optional(),inputSchema:K({$schema:B().optional(),type:X(`object`)}),outputSchema:K({$schema:B().optional()}).optional(),annotations:Te.optional(),_meta:J(B(),U()).optional()}),Xe=G({type:X(`tool_result`),toolUseId:B(),content:W(Ce),structuredContent:U().optional(),isError:H().optional(),_meta:J(B(),U()).optional()}),Ze=q([_e,ve,ye,be,Xe]),Qe=G({role:a,content:q([Ze,W(Ze)]),_meta:J(B(),U()).optional()}),$e=B(),et=K({[Rm]:v.optional().catch(void 0)}),tt=et.optional();function nt(e){return K({_meta:tt,resultType:$e.default(`complete`),...e})}let rt=nt({}),it=nt({nextCursor:r.optional()}),at=nt({content:W(Ce),structuredContent:U().optional(),isError:H().optional()}),ot=nt({ttlMs:V().int().min(0),cacheScope:Y([`public`,`private`]),tools:W(Ye),nextCursor:r.optional()}),st=nt({ttlMs:V().int().min(0),cacheScope:Y([`public`,`private`]),prompts:W(he),nextCursor:r.optional()}),ct=nt({description:B().optional(),messages:W(we)}),lt=nt({ttlMs:V().int().min(0),cacheScope:Y([`public`,`private`]),resources:W(le),nextCursor:r.optional()}),ut=nt({ttlMs:V().int().min(0),cacheScope:Y([`public`,`private`]),resourceTemplates:W(ue),nextCursor:r.optional()}),dt=nt({ttlMs:V().int().min(0),cacheScope:Y([`public`,`private`]),contents:W(q([oe,se]))}),ft=nt({completion:G({values:W(B()).max(100),total:V().int().optional(),hasMore:H().optional()}).loose()}),pt=nt({ttlMs:V().int().min(0),cacheScope:Y([`public`,`private`])}),mt=nt({ttlMs:V().int().min(0).catch(0),cacheScope:Y([`public`,`private`]).catch(`private`),supportedVersions:W(B()),capabilities:qe,instructions:B().optional()}),ht=G({messages:W(Qe),modelPreferences:T.optional(),systemPrompt:B().optional(),includeContext:Y([`none`,`thisServer`,`allServers`]).optional(),temperature:V().optional(),maxTokens:V().int(),stopSequences:W(B()).optional(),metadata:t.optional(),tools:W(Ye).optional(),toolChoice:De.optional()}),gt=G({method:X(`sampling/createMessage`),params:ht}),_t=G({method:X(`roots/list`),params:G({_meta:J(B(),U()).optional()}).optional()}),vt=G({...Qe.shape,model:B(),stopReason:B().optional()}),yt=G({roots:W(Ue)}),bt=G({action:Y([`accept`,`decline`,`cancel`]),content:J(B(),q([B(),V(),H(),W(B())])).optional()}),xt=G({mode:X(`url`),message:B(),url:B().url()}),St=q([Be,xt]),Ct=G({method:X(`elicitation/create`),params:St}),wt=q([gt,_t,Ct]),Tt=q([vt,yt,bt]),Et=J(B(),wt),Dt=J(B(),Tt),Ot=nt({inputRequests:Et.optional(),requestState:B().optional()}),kt={inputResponses:Dt.optional(),requestState:B().optional()},At=G({_meta:Je,...kt}),jt=K({progressToken:n.optional()});function Mt(e,t){return G({method:X(e),params:G({_meta:Je,...t})})}function Nt(e,t){return G({method:X(e),params:G({_meta:jt.optional(),...t}).optional()})}let Pt={name:B(),arguments:J(B(),U()).optional(),...kt},Ft={cursor:r.optional()},It=Mt(`tools/call`,Pt),Lt=Mt(`tools/list`,Ft),Rt=Mt(`prompts/list`,Ft),zt=Mt(`prompts/get`,{name:B(),arguments:J(B(),B()).optional(),...kt}),Bt=Mt(`resources/list`,Ft),Vt=Mt(`resources/templates/list`,Ft),Ht=Mt(`resources/read`,{uri:B(),...kt}),Ut={ref:q([He,Ve]),argument:G({name:B(),value:B()}),context:G({arguments:J(B(),B()).optional()}).optional()},Wt=Mt(`completion/complete`,Ut),Gt=Mt(`server/discover`,{}),Kt=G({toolsListChanged:H().optional(),promptsListChanged:H().optional(),resourcesListChanged:H().optional(),resourceSubscriptions:W(B()).optional()}),qt={notifications:Kt},Jt=Mt(`subscriptions/listen`,qt),Yt=et.extend({"io.modelcontextprotocol/subscriptionId":i}),Xt=K({_meta:Yt,resultType:$e.default(`complete`)}),Zt={"tools/call":Nt(`tools/call`,Pt),"tools/list":Nt(`tools/list`,Ft),"prompts/get":Nt(`prompts/get`,{name:B(),arguments:J(B(),B()).optional()}),"prompts/list":Nt(`prompts/list`,Ft),"resources/list":Nt(`resources/list`,Ft),"resources/templates/list":Nt(`resources/templates/list`,Ft),"resources/read":Nt(`resources/read`,{uri:B()}),"completion/complete":Nt(`completion/complete`,Ut),"server/discover":Nt(`server/discover`,{}),"subscriptions/listen":Nt(`subscriptions/listen`,qt)};function Qt(e){return K({_meta:tt,...e})}let $t={"tools/call":Qt({content:W(Ce),structuredContent:U().optional(),isError:H().optional()}),"tools/list":Qt({ttlMs:V().int().min(0),cacheScope:Y([`public`,`private`]),tools:W(Ye),nextCursor:r.optional()}),"prompts/get":Qt({description:B().optional(),messages:W(we)}),"prompts/list":Qt({ttlMs:V().int().min(0),cacheScope:Y([`public`,`private`]),prompts:W(he),nextCursor:r.optional()}),"resources/list":Qt({ttlMs:V().int().min(0),cacheScope:Y([`public`,`private`]),resources:W(le),nextCursor:r.optional()}),"resources/templates/list":Qt({ttlMs:V().int().min(0),cacheScope:Y([`public`,`private`]),resourceTemplates:W(ue),nextCursor:r.optional()}),"resources/read":Qt({ttlMs:V().int().min(0),cacheScope:Y([`public`,`private`]),contents:W(q([oe,se]))}),"completion/complete":Qt({completion:G({values:W(B()).max(100),total:V().int().optional(),hasMore:H().optional()}).loose()}),"server/discover":Qt({ttlMs:V().int().min(0).catch(0),cacheScope:Y([`public`,`private`]).catch(`private`),supportedVersions:W(B()),capabilities:qe,instructions:B().optional()}),"subscriptions/listen":Qt({})},E=K({"io.modelcontextprotocol/subscriptionId":i.optional()}),en=G({method:X(`notifications/subscriptions/acknowledged`),params:G({_meta:E.optional(),notifications:Kt})}),tn=G({_meta:E.optional(),requestId:i,reason:B().optional()}),nn=G({method:X(`notifications/cancelled`),params:tn}),rn={"notifications/cancelled":nn,"notifications/progress":re,"notifications/message":ie,"notifications/resources/updated":pe,"notifications/resources/list_changed":de,"notifications/tools/list_changed":Ee,"notifications/prompts/list_changed":ge,"notifications/subscriptions/acknowledged":en},D=e=>G({jsonrpc:X(`2.0`),id:q([B(),V().int()]),result:e}).strict();return{JSONValueSchema:e,JSONObjectSchema:t,ProgressTokenSchema:n,CursorSchema:r,RequestIdSchema:i,RoleSchema:a,LoggingLevelSchema:o,TaskMetadataSchema:c,RelatedTaskMetadataSchema:l,RequestMetaSchema:u,BaseRequestParamsSchema:d,TaskAugmentedRequestParamsSchema:f,NotificationsParamsSchema:p,NotificationSchema:m,IconSchema:h,IconsSchema:g,BaseMetadataSchema:_,ImplementationSchema:v,ClientTasksCapabilitySchema:b,ServerTasksCapabilitySchema:ee,ClientCapabilitiesSchema:te,ServerCapabilitiesSchema:x,ProgressSchema:ne,ProgressNotificationParamsSchema:S,ProgressNotificationSchema:re,LoggingMessageNotificationParamsSchema:C,LoggingMessageNotificationSchema:ie,ResourceContentsSchema:ae,TextResourceContentsSchema:oe,BlobResourceContentsSchema:se,AnnotationsSchema:ce,ResourceSchema:le,ResourceTemplateSchema:ue,ResourceListChangedNotificationSchema:de,ResourceUpdatedNotificationParamsSchema:fe,ResourceUpdatedNotificationSchema:pe,PromptArgumentSchema:me,PromptSchema:he,PromptListChangedNotificationSchema:ge,TextContentSchema:_e,ImageContentSchema:ve,AudioContentSchema:ye,ToolUseContentSchema:be,EmbeddedResourceSchema:xe,ResourceLinkSchema:Se,ContentBlockSchema:Ce,PromptMessageSchema:we,ToolAnnotationsSchema:Te,ToolListChangedNotificationSchema:Ee,ModelHintSchema:w,ModelPreferencesSchema:T,ToolChoiceSchema:De,BooleanSchemaSchema:Oe,StringSchemaSchema:ke,NumberSchemaSchema:Ae,UntitledSingleSelectEnumSchemaSchema:je,TitledSingleSelectEnumSchemaSchema:Me,LegacyTitledEnumSchemaSchema:Ne,SingleSelectEnumSchemaSchema:Pe,UntitledMultiSelectEnumSchemaSchema:Fe,TitledMultiSelectEnumSchemaSchema:Ie,MultiSelectEnumSchemaSchema:Le,EnumSchemaSchema:Re,PrimitiveSchemaDefinitionSchema:ze,ElicitRequestFormParamsSchema:Be,ResourceTemplateReferenceSchema:Ve,PromptReferenceSchema:He,RootSchema:Ue,ClientCapabilities2026Schema:Ge,ServerCapabilities2026Schema:qe,RequestMetaEnvelopeSchema:Je,ToolSchema:Ye,ToolResultContentSchema:Xe,SamplingMessageContentBlockSchema:Ze,SamplingMessageSchema:Qe,ResultTypeSchema:$e,ResultMetaSchema:et,ResultSchema:rt,PaginatedResultSchema:it,CallToolResultSchema:at,ListToolsResultSchema:ot,ListPromptsResultSchema:st,GetPromptResultSchema:ct,ListResourcesResultSchema:lt,ListResourceTemplatesResultSchema:ut,ReadResourceResultSchema:dt,CompleteResultSchema:ft,CacheableResultSchema:pt,DiscoverResultSchema:mt,CreateMessageRequestParamsSchema:ht,CreateMessageRequestSchema:gt,ListRootsRequestSchema:_t,CreateMessageResultSchema:vt,ListRootsResultSchema:yt,ElicitResultSchema:bt,ElicitRequestURLParamsSchema:xt,ElicitRequestParamsSchema:St,ElicitRequestSchema:Ct,InputRequestSchema:wt,InputResponseSchema:Tt,InputRequestsSchema:Et,InputResponsesSchema:Dt,InputRequiredResultSchema:Ot,InputResponseRequestParamsSchema:At,CallToolRequestSchema:It,ListToolsRequestSchema:Lt,ListPromptsRequestSchema:Rt,GetPromptRequestSchema:zt,ListResourcesRequestSchema:Bt,ListResourceTemplatesRequestSchema:Vt,ReadResourceRequestSchema:Ht,CompleteRequestSchema:Wt,DiscoverRequestSchema:Gt,SubscriptionFilterSchema:Kt,SubscriptionsListenRequestSchema:Jt,SubscriptionsListenResultMetaSchema:Yt,SubscriptionsListenResultSchema:Xt,dispatchRequestSchemas:Zt,dispatchResultSchemas:$t,NotificationMetaSchema:E,SubscriptionsAcknowledgedNotificationSchema:en,CancelledNotificationParamsSchema:tn,CancelledNotificationSchema:nn,notificationSchemas2026:rn,JSONRPCResultResponseSchema:D(rt),CallToolResultResponseSchema:D(q([at,Ot])),ListToolsResultResponseSchema:D(ot),ListPromptsResultResponseSchema:D(st),GetPromptResultResponseSchema:D(q([ct,Ot])),ListResourcesResultResponseSchema:D(lt),ListResourceTemplatesResultResponseSchema:D(ut),ReadResourceResultResponseSchema:D(q([dt,Ot])),CompleteResultResponseSchema:D(ft),DiscoverResultResponseSchema:D(mt)}}var Wv;function Gv(){return Wv??=Uv()}var Kv=[`tools/list`,`prompts/list`,`resources/list`,`resources/templates/list`,`resources/read`,`server/discover`];function qv(e){return Kv.includes(e)}var Jv=Symbol(`modelcontextprotocol.resultCacheHintFallback`);function Yv(e){return e[Jv]}function Xv(e){return typeof e==`number`&&Number.isSafeInteger(e)&&e>=0}function Zv(e){return e===`public`||e===`private`}var Q=function(e){return e[e.ParseError=-32700]=`ParseError`,e[e.InvalidRequest=-32600]=`InvalidRequest`,e[e.MethodNotFound=-32601]=`MethodNotFound`,e[e.InvalidParams=-32602]=`InvalidParams`,e[e.InternalError=-32603]=`InternalError`,e[e.ResourceNotFound=-32002]=`ResourceNotFound`,e[e.MissingRequiredClientCapability=-32021]=`MissingRequiredClientCapability`,e[e.UnsupportedProtocolVersion=-32022]=`UnsupportedProtocolVersion`,e[e.UrlElicitationRequired=-32042]=`UrlElicitationRequired`,e}({}),Qv=class e extends Error{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.ProtocolError`})}static[Symbol.hasInstance](e){return uv(this,e)}static isInstance(e){if(typeof this!=`function`)throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return uv(this,e)}constructor(e,t,n){super(t),this.code=e,this.data=n,this.name=`ProtocolError`,lv(this,new.target)}static fromError(t,n,r){if(t===Q.UrlElicitationRequired&&r){let e=r;if(e.elicitations)return new ey(e.elicitations,n)}if(t===Q.UnsupportedProtocolVersion&&r){let e=r;if(Array.isArray(e.supported)&&typeof e.requested==`string`)return new ty({supported:e.supported,requested:e.requested},n)}if(t===Q.InvalidParams||t===Q.ResourceNotFound){let e=r;if(typeof e?.uri==`string`&&(t===Q.ResourceNotFound||Object.keys(e).length===1))return new $v(e.uri,n)}if(t===Q.MissingRequiredClientCapability&&r){let e=r;if(e.requiredCapabilities!==null&&typeof e.requiredCapabilities==`object`&&!Array.isArray(e.requiredCapabilities))return new ny({requiredCapabilities:e.requiredCapabilities},n)}return new e(t,n,r)}},$v=class extends Qv{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.ResourceNotFoundError`})}constructor(e,t=`Resource not found: ${e}`){super(Q.InvalidParams,t,{uri:e})}get uri(){return this.data.uri}},ey=class extends Qv{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.UrlElicitationRequiredError`})}constructor(e,t=`URL elicitation${e.length>1?`s`:``} required`){super(Q.UrlElicitationRequired,t,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}},ty=class extends Qv{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.UnsupportedProtocolVersionError`})}constructor(e,t=`Unsupported protocol version: ${e.requested}`){super(Q.UnsupportedProtocolVersion,t,e)}get supported(){return this.data.supported}get requested(){return this.data.requested}},ny=class extends Qv{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.MissingRequiredClientCapabilityError`})}constructor(e,t=`Missing required client capabilities: ${Object.keys(e.requiredCapabilities).join(`, `)}`){super(Q.MissingRequiredClientCapability,t,e)}get requiredCapabilities(){return this.data.requiredCapabilities}},ry=0,iy=`private`,ay=[`tools/call`,`prompts/get`,`resources/read`];function oy(e,t){let n=t.resultType;if(n===void 0)return{...t,resultType:`complete`};if(n===`complete`||ay.includes(e))return t;throw new Qv(Q.InternalError,`Handler for ${e} returned resultType '${String(n)}', but results of ${e} only support 'complete' on protocol revision 2026-07-28`)}function sy(e,t){let n=Yv(t);if(t.resultType!==`complete`||!qv(e))return n===void 0?t:fy(t);let r=t,i=Xv(r.ttlMs)?r.ttlMs:uy(n),a=Zv(r.cacheScope)?r.cacheScope:dy(n),o={...r,ttlMs:i,cacheScope:a};return delete o[Jv],o}function cy(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function ly(e,t){if(t===void 0)return e;let n=e._meta;return n===void 0?{...e,_meta:{[Rm]:t}}:!cy(n)||n[`io.modelcontextprotocol/serverInfo`]!==void 0?e:{...e,_meta:{...n,[Rm]:t}}}function uy(e){return e!==void 0&&Xv(e.ttlMs)?e.ttlMs:ry}function dy(e){return e!==void 0&&Zv(e.cacheScope)?e.cacheScope:iy}function fy(e){let t={...e};return delete t[Jv],t}var py=[`elicitation/create`,`sampling/createMessage`,`roots/list`],my;function hy(){if(my)return my;let e=Gv();return my={request:{"elicitation/create":G({method:X(`elicitation/create`),params:e.ElicitRequestParamsSchema}),"sampling/createMessage":G({method:X(`sampling/createMessage`),params:e.CreateMessageRequestParamsSchema}),"roots/list":G({method:X(`roots/list`),params:K({}).optional()})},response:{"elicitation/create":e.ElicitResultSchema,"sampling/createMessage":e.CreateMessageResultSchema,"roots/list":e.ListRootsResultSchema}},my}function gy(e){return py.includes(e)}function _y(e){return gy(e)?hy().request[e]:void 0}function vy(e){return gy(e)?hy().response[e]:void 0}var yy={"tools/call":null,"tools/list":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"completion/complete":null,"server/discover":null,"subscriptions/listen":null},by={"notifications/cancelled":null,"notifications/progress":null,"notifications/message":null,"notifications/resources/updated":null,"notifications/resources/list_changed":null,"notifications/tools/list_changed":null,"notifications/prompts/list_changed":null,"notifications/subscriptions/acknowledged":null};function xy(e){return Object.prototype.hasOwnProperty.call(yy,e)}function Sy(e){return Object.prototype.hasOwnProperty.call(by,e)}function Cy(e){return Object.prototype.hasOwnProperty.call(yy,e)}function wy(e){return xy(e)?Gv().dispatchRequestSchemas[e]:void 0}function Ty(e){return Cy(e)?Gv().dispatchResultSchemas[e]:void 0}function Ey(e){return Sy(e)?Gv().notificationSchemas2026[e]:void 0}Object.keys(yy),Object.keys(by);function Dy(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Oy(e,t){if(e===void 0)return{ok:!1,reason:`not-in-era`};let n=e.safeParse(t);return n.success?{ok:!0,value:n.data}:{ok:!1,reason:`invalid`,message:String(n.error)}}var ky={ok:!1,reason:`not-in-era`},Ay=[Im,zm];function jy(e,t){let n=t,r=!1,i=()=>(r||=(n={...n},!0),n),a=t.tools;e===`tools/list`&&Array.isArray(a)&&a.some(e=>Dy(e)&&`execution`in e)&&(i().tools=a.map(e=>{if(!Dy(e)||!(`execution`in e))return e;let t={...e};return delete t.execution,t}));let o=t.capabilities;if(Dy(o)&&`tasks`in o){let e={...o};delete e.tasks,i().capabilities=e}return n}var My={era:`2026-07-28`,hasRequestMethod:xy,hasNotificationMethod:Sy,hasInputRequestMethod:e=>_y(e)!==void 0,validateRequest:(e,t)=>Oy(wy(e),t),validateResult:(e,t)=>Oy(Ty(e),t),validateNotification:(e,t)=>Oy(Ey(e),t),validateInputRequest:(e,t)=>Oy(_y(e),t),validateInputResponse:(e,t)=>Oy(vy(e),t),samplingResultVariant:()=>ky,outboundEnvelope(e){return{[Im]:e.protocolVersion,[Lm]:e.clientInfo,[zm]:e.clientCapabilities,...e.logLevel!==void 0&&{"io.modelcontextprotocol/logLevel":e.logLevel}}},validateEnvelopeMeta(e){let t=[];for(let n of Ay)n in e||t.push({key:n,problem:`missing`});let n=Gv().RequestMetaEnvelopeSchema.safeParse(e);if(!n.success)for(let e of n.error.issues){let n=e.path.map(String),r=n.length>0?n.join(`.`):`_meta`;n.length===1&&t.some(e=>e.key===r&&e.problem===`missing`)||t.push({key:r,problem:e.message})}return t},projectCallToolResult:e=>hv(e),inputRequestSchema:_y,decodeResult(e,t){if(!Dy(t))return{kind:`invalid`,error:new fv(dv.InvalidResult,`Invalid result for ${e}: not an object`,{method:e})};let n=t.resultType;if(n===void 0)return{kind:`invalid`,error:new fv(dv.InvalidResult,`Invalid result for ${e}: missing required resultType — servers implementing protocol revision 2026-07-28 MUST include it (the absent-means-complete bridge applies only to earlier-revision servers)`,{method:e,violation:`missing-resultType`})};if(typeof n!=`string`)return{kind:`invalid`,error:new fv(dv.InvalidResult,`Invalid result for ${e}: non-string resultType`,{method:e,resultType:n})};if(n===`input_required`){let n=t.inputRequests,r=Dy(n)?n:{},i=t.requestState;return Object.keys(r).length===0&&typeof i!=`string`?{kind:`invalid`,error:new fv(dv.InvalidResult,`Invalid result for ${e}: input_required carries neither inputRequests nor requestState (every input_required result must include at least one of the two)`,{method:e,violation:`input-required-missing-both`})}:{kind:`input_required`,inputRequests:r,...typeof i==`string`&&{requestState:i}}}if(n!==`complete`)return{kind:`invalid`,error:new fv(dv.UnsupportedResultType,`Unsupported result type '${n}' for ${e}`,{resultType:n,method:e})};let r=Py(),i=Object.hasOwn(r,e)?r[e]:void 0;if(i!==void 0){let n=i.safeParse(t);if(!n.success)return{kind:`invalid`,error:new fv(dv.InvalidResult,`Invalid result for ${e}: ${n.error}`,{method:e})}}let a={...t};return delete a.resultType,{kind:`complete`,result:a}},encodeResult(e,t,n){return ly(sy(e,oy(e,jy(e,t))),n)},encodeErrorCode:e=>e===-32002?-32602:e,checkInboundEnvelope(e){if(e.envelope===void 0)return`Request is missing the required _meta envelope for protocol revision 2026-07-28 (io.modelcontextprotocol/protocolVersion, io.modelcontextprotocol/clientCapabilities)`;let t=Gv().RequestMetaEnvelopeSchema.safeParse(e.envelope);if(!t.success)return`Invalid _meta envelope for protocol revision 2026-07-28: ${t.error.issues.map(e=>e.message).join(`; `)}`}},Ny;function Py(){if(Ny)return Ny;let e=Gv();return Ny={"tools/call":e.CallToolResultSchema,"tools/list":e.ListToolsResultSchema,"prompts/get":e.GetPromptResultSchema,"prompts/list":e.ListPromptsResultSchema,"resources/list":e.ListResourcesResultSchema,"resources/templates/list":e.ListResourceTemplatesResultSchema,"resources/read":e.ReadResourceResultSchema,"completion/complete":e.CompleteResultSchema,"server/discover":e.DiscoverResultSchema},Ny}var Fy=`2026-07-28`;function Iy(e){return e!==void 0&&mv(e)?My:Hv}function Ly(e){return e.revision===void 0?e.era===`modern`?My.era:Hv.era:Iy(e.revision).era}function Ry(e){return By.some(t=>t.hasRequestMethod(e))}function zy(e){return By.some(t=>t.hasNotificationMethod(e))}var By=[Hv,My],Vy=j({AnnotationsSchema:()=>Bh,AudioContentSchema:()=>yg,BaseMetadataSchema:()=>hh,BaseRequestParamsSchema:()=>Xm,BlobResourceContentsSchema:()=>Rh,BooleanSchemaSchema:()=>e_,CallToolRequestParamsSchema:()=>Pg,CallToolRequestSchema:()=>Fg,CallToolResultSchema:()=>Mg,CancelTaskRequestSchema:()=>B_,CancelTaskResultSchema:()=>V_,CancelledNotificationParamsSchema:()=>dh,CancelledNotificationSchema:()=>fh,ClientCapabilitiesSchema:()=>bh,ClientNotificationSchema:()=>U_,ClientRequestSchema:()=>H_,ClientResultSchema:()=>W_,ClientTasksCapabilitySchema:()=>vh,CompatibilityCallToolResultSchema:()=>Ng,CompleteRequestParamsSchema:()=>x_,CompleteRequestSchema:()=>S_,CompleteResultSchema:()=>C_,ContentBlockSchema:()=>Cg,CreateMessageRequestParamsSchema:()=>Xg,CreateMessageRequestSchema:()=>Zg,CreateMessageResultSchema:()=>Qg,CreateMessageResultWithToolsSchema:()=>$g,CreateTaskResultSchema:()=>j_,CursorSchema:()=>Km,DiscoverRequestSchema:()=>Eh,DiscoverResultSchema:()=>Dh,ElicitRequestFormParamsSchema:()=>f_,ElicitRequestParamsSchema:()=>m_,ElicitRequestSchema:()=>h_,ElicitRequestURLParamsSchema:()=>p_,ElicitResultSchema:()=>v_,ElicitationCompleteNotificationParamsSchema:()=>g_,ElicitationCompleteNotificationSchema:()=>__,EmbeddedResourceSchema:()=>xg,EmptyResultSchema:()=>uh,EnumSchemaSchema:()=>u_,GetPromptRequestParamsSchema:()=>hg,GetPromptRequestSchema:()=>gg,GetPromptResultSchema:()=>Tg,GetTaskPayloadRequestSchema:()=>I_,GetTaskPayloadResultSchema:()=>L_,GetTaskRequestSchema:()=>P_,GetTaskResultSchema:()=>F_,IconSchema:()=>ph,IconsSchema:()=>mh,ImageContentSchema:()=>vg,ImplementationSchema:()=>gh,InitializeRequestParamsSchema:()=>xh,InitializeRequestSchema:()=>Sh,InitializeResultSchema:()=>wh,InitializedNotificationSchema:()=>Th,JSONArraySchema:()=>Wm,JSONObjectSchema:()=>Um,JSONRPCErrorResponseSchema:()=>sh,JSONRPCMessageSchema:()=>ch,JSONRPCNotificationSchema:()=>ah,JSONRPCRequestSchema:()=>ih,JSONRPCResponseSchema:()=>lh,JSONRPCResultResponseSchema:()=>oh,JSONValueSchema:()=>Hm,LegacyTitledEnumSchemaSchema:()=>a_,ListChangedOptionsBaseSchema:()=>Lg,ListPromptsRequestSchema:()=>pg,ListPromptsResultSchema:()=>mg,ListResourceTemplatesRequestSchema:()=>Gh,ListResourceTemplatesResultSchema:()=>Kh,ListResourcesRequestSchema:()=>Uh,ListResourcesResultSchema:()=>Wh,ListRootsRequestSchema:()=>T_,ListRootsResultSchema:()=>E_,ListTasksRequestSchema:()=>R_,ListTasksResultSchema:()=>z_,ListToolsRequestSchema:()=>Ag,ListToolsResultSchema:()=>jg,LoggingLevelSchema:()=>Rg,LoggingMessageNotificationParamsSchema:()=>Vg,LoggingMessageNotificationSchema:()=>Hg,ModelHintSchema:()=>Ug,ModelPreferencesSchema:()=>Wg,MultiSelectEnumSchemaSchema:()=>l_,NotificationSchema:()=>eh,NotificationsParamsSchema:()=>$m,NumberSchemaSchema:()=>n_,PaginatedRequestParamsSchema:()=>Mh,PaginatedRequestSchema:()=>Nh,PaginatedResultSchema:()=>Ph,PingRequestSchema:()=>Oh,PrimitiveSchemaDefinitionSchema:()=>d_,ProgressNotificationParamsSchema:()=>Ah,ProgressNotificationSchema:()=>jh,ProgressSchema:()=>kh,ProgressTokenSchema:()=>Gm,PromptArgumentSchema:()=>dg,PromptListChangedNotificationSchema:()=>Eg,PromptMessageSchema:()=>wg,PromptReferenceSchema:()=>b_,PromptSchema:()=>fg,ReadResourceRequestParamsSchema:()=>Jh,ReadResourceRequestSchema:()=>Yh,ReadResourceResultSchema:()=>Xh,RelatedTaskMetadataSchema:()=>Jm,RequestIdSchema:()=>rh,RequestMetaSchema:()=>Ym,RequestSchema:()=>Qm,ResourceContentsSchema:()=>Fh,ResourceLinkSchema:()=>Sg,ResourceListChangedNotificationSchema:()=>Zh,ResourceRequestParamsSchema:()=>qh,ResourceSchema:()=>Vh,ResourceTemplateReferenceSchema:()=>y_,ResourceTemplateSchema:()=>Hh,ResourceUpdatedNotificationParamsSchema:()=>lg,ResourceUpdatedNotificationSchema:()=>ug,ResultMetaObjectSchema:()=>th,ResultSchema:()=>nh,RoleSchema:()=>zh,RootSchema:()=>w_,RootsListChangedNotificationSchema:()=>D_,SamplingContentSchema:()=>qg,SamplingMessageContentBlockSchema:()=>Jg,SamplingMessageSchema:()=>Yg,ServerCapabilitiesSchema:()=>Ch,ServerNotificationSchema:()=>K_,ServerRequestSchema:()=>G_,ServerResultSchema:()=>q_,ServerTasksCapabilitySchema:()=>yh,SetLevelRequestParamsSchema:()=>zg,SetLevelRequestSchema:()=>Bg,SingleSelectEnumSchemaSchema:()=>o_,StringSchemaSchema:()=>t_,SubscribeRequestParamsSchema:()=>Qh,SubscribeRequestSchema:()=>$h,SubscriptionFilterSchema:()=>ng,SubscriptionsAcknowledgedNotificationParamsSchema:()=>ag,SubscriptionsAcknowledgedNotificationSchema:()=>og,SubscriptionsListenRequestParamsSchema:()=>rg,SubscriptionsListenRequestSchema:()=>ig,SubscriptionsListenResultMetaSchema:()=>sg,SubscriptionsListenResultSchema:()=>cg,TaskAugmentedRequestParamsSchema:()=>Zm,TaskCreationParamsSchema:()=>O_,TaskMetadataSchema:()=>qm,TaskSchema:()=>A_,TaskStatusNotificationParamsSchema:()=>M_,TaskStatusNotificationSchema:()=>N_,TaskStatusSchema:()=>k_,TextContentSchema:()=>_g,TextResourceContentsSchema:()=>Ih,TitledMultiSelectEnumSchemaSchema:()=>c_,TitledSingleSelectEnumSchemaSchema:()=>i_,ToolAnnotationsSchema:()=>Dg,ToolChoiceSchema:()=>Gg,ToolExecutionSchema:()=>Og,ToolListChangedNotificationSchema:()=>Ig,ToolResultContentSchema:()=>Kg,ToolSchema:()=>kg,ToolUseContentSchema:()=>bg,UnsubscribeRequestParamsSchema:()=>eg,UnsubscribeRequestSchema:()=>tg,UntitledMultiSelectEnumSchemaSchema:()=>s_,UntitledSingleSelectEnumSchemaSchema:()=>r_}),Hy=e=>ih.safeParse(e).success,Uy=e=>ah.safeParse(e).success,Wy=e=>oh.safeParse(e).success,Gy=e=>sh.safeParse(e).success;Q.InvalidRequest,Q.UnsupportedProtocolVersion,Q.InvalidParams,Q.MethodNotFound,Q.InvalidParams,Q.MissingRequiredClientCapability,Q.ParseError,Q.InvalidRequest,Q.MethodNotFound,Q.UnsupportedProtocolVersion,Q.MissingRequiredClientCapability;function Ky(e,t){return Jf(e,t)}function qy(e){return new Set(e.flatMap(e=>Object.keys(e.shape)))}function Jy(e){if(e==null)return!1;let t=typeof e;return t!==`object`&&t!==`function`||!(`~standard`in e)?!1:typeof e[`~standard`]?.validate==`function`}var Yy=!1,Xy=`draft-2020-12`;function Zy(e,t=`input`){let n=e[`~standard`],r;if(n.jsonSchema)r=n.jsonSchema[t]({target:Xy});else if(n.vendor===`zod`){if(!(`_zod`in e))throw Error(`Schema appears to be from zod 3, which the SDK cannot convert to JSON Schema. Upgrade to zod >=4.2.0, or wrap your JSON Schema with fromJsonSchema().`);Yy||(Yy=!0,console.warn("[mcp-sdk] Your zod version does not implement `~standard.jsonSchema` (added in zod 4.2.0). Falling back to z.toJSONSchema(). Upgrade to zod >=4.2.0 to silence this warning.")),r=Hf(e,{target:Xy,io:t})}else throw Error(`Schema library "${n.vendor}" does not implement StandardJSONSchemaV1 (\`~standard.jsonSchema\`). Upgrade to a version that does, or wrap your JSON Schema with fromJsonSchema().`);if(t===`output`)return r.type===void 0&&Qy(r)?{type:`object`,...r}:r;if(r.type!==void 0&&r.type!==`object`)throw Error(`MCP tool and prompt schemas must describe objects (got type: ${JSON.stringify(r.type)}). Wrap your schema in z.object({...}) or equivalent.`);return{type:`object`,...r}}function Qy(e){if(`properties`in e||`patternProperties`in e||`additionalProperties`in e||`required`in e)return!0;for(let t of[`oneOf`,`anyOf`,`allOf`]){let n=e[t];if(Array.isArray(n)&&n.length>0)return n.every(e=>typeof e==`object`&&!!e&&(e.type===`object`||Qy(e)))}return!1}function $y(e){return e.path?.length?`${e.path.map(e=>String(typeof e==`object`?e.key:e)).join(`.`)}: ${e.message}`:e.message}async function eb(e,t){let n=await e[`~standard`].validate(t);return n.issues&&n.issues.length>0?{success:!1,error:n.issues.map(e=>$y(e)).join(`, `)}:{success:!0,data:n.value}}function tb(e){let t=Hf(e,{target:Xy,io:`input`});return typeof t.pattern==`string`?t.pattern:void 0}var nb=/\\\.\\d\{(\d+)\}/;function rb(e){let t=nb.exec(e),n=[void 0,-1,0];return t&&n.push(Number(t[1])),[!1,!0].flatMap(e=>[!1,!0].flatMap(t=>n.map(n=>jm({local:e,offset:t,precision:n}))))}function ib(e,t){let n;switch(e){case`email`:n=[mp()];break;case`uri`:n=[vp()];break;case`date`:n=[Mm()];break;case`date-time`:n=rb(t)}return new Set(n.map(e=>tb(e)).filter(e=>e!==void 0))}function ab(e,t,n){return n!==`zod`||ib(e,t).has(t)}function ob(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function sb(e){try{return Zy(e,`input`)}catch(e){let t=e instanceof Error?e.message:String(e);throw new Qv(Q.InvalidParams,`Elicitation requestedSchema must describe an object with flat primitive properties: ${t}`)}}var cb=new Set([`$comment`,`deprecated`,`description`,`examples`,`readOnly`,`title`,`writeOnly`]);function lb(e){return cb.has(e)||e.startsWith(`x-`)}var ub=new Set([`$schema`,...Object.keys(f_.shape.requestedSchema.shape)]),db={string:qy([t_,r_,i_,a_]),number:qy([n_]),integer:qy([n_]),boolean:qy([e_]),array:qy([s_,c_])},fb=new Set(t_.shape.format.unwrap().options);function pb(e,t,n,r){if(!ob(e))return e;let i=typeof e.type==`string`&&Object.hasOwn(db,e.type)?db[e.type]:void 0;if(i===void 0)return e;let a={};for(let[o,s]of Object.entries(e))i.has(o)||lb(o)?a[o]=s:o===`pattern`&&e.type===`string`&&typeof e.format==`string`?fb.has(e.format)?(typeof s!=`string`||!ab(e.format,s,n))&&r.push(`${t}.${o}`):a[o]=s:r.push(`${t}.${o}`);return a}function mb(e,t){let n={},r=[];for(let[i,a]of Object.entries(e))i===`properties`&&ob(a)?n[i]=Object.fromEntries(Object.entries(a).map(([e,n])=>[e,pb(n,`properties.${e}`,t,r)])):ub.has(i)?n[i]=a:lb(i)||r.push(i);if(r.length>0)throw new Qv(Q.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${r.join(`, `)}`);return n}function hb(e,t){if(!ob(e.properties))return t;let n=Object.entries(e.properties).filter(([,e])=>!Ky(d_,e).success).map(([e])=>`properties.${e}`);return n.length>0?n.join(`, `):t}function gb(e,t,n=``){return Array.isArray(e)&&Array.isArray(t)?e.flatMap((e,r)=>gb(e,t[r],`${n}[${r}]`)):!ob(e)||!ob(t)?[]:Object.entries(e).flatMap(([e,r])=>{let i=n?`${n}.${e}`:e;return Object.prototype.hasOwnProperty.call(t,e)?gb(r,t[e],i):lb(e)?[]:[i]})}function _b(e){if(!Jy(e.requestedSchema))return{...e,mode:`form`,requestedSchema:e.requestedSchema};let t=e.requestedSchema[`~standard`].vendor,n=mb(sb(e.requestedSchema),t),r=Ky(f_.shape.requestedSchema,n);if(!r.success)throw new Qv(Q.InvalidParams,`Elicitation requestedSchema only supports flat primitive properties (string, number, integer, boolean, and string enums): ${hb(n,r.error.message)}`);let i=gb(n,r.data);if(i.length>0)throw new Qv(Q.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${i.join(`, `)}`);let a=(r.data.required??[]).filter(e=>!Object.prototype.hasOwnProperty.call(r.data.properties,e));if(a.length>0)throw new Qv(Q.InvalidParams,`Elicitation requestedSchema lists required properties that are not defined in properties: ${a.join(`, `)}`);return{...e,mode:`form`,requestedSchema:r.data}}function vb(e){let t=e.inputRequests!==void 0&&Object.keys(e.inputRequests).length>0,n=typeof e.requestState==`string`;if(!t&&!n)throw TypeError(`inputRequired() requires at least one of inputRequests (with at least one entry) or requestState (spec: every InputRequiredResult MUST include at least one of the two)`);return{resultType:`input_required`,...e.inputRequests!==void 0&&{inputRequests:e.inputRequests},...e.requestState!==void 0&&{requestState:e.requestState}}}Object.assign(vb,{elicit(e){try{return{method:`elicitation/create`,params:_b(e)}}catch(e){throw e instanceof Qv?TypeError(e.message,{cause:e}):e}},elicitUrl(e){return{method:`elicitation/create`,params:{...e,mode:`url`}}},createMessage(e){return{method:`sampling/createMessage`,params:e}},listRoots(){return{method:`roots/list`}}});var yb=`AnnotationsSchema.AudioContentSchema.BaseMetadataSchema.BlobResourceContentsSchema.BooleanSchemaSchema.CallToolRequestSchema.CallToolRequestParamsSchema.CallToolResultSchema.CancelledNotificationSchema.CancelledNotificationParamsSchema.CancelTaskRequestSchema.CancelTaskResultSchema.ClientCapabilitiesSchema.ClientNotificationSchema.ClientRequestSchema.ClientResultSchema.CompatibilityCallToolResultSchema.CompleteRequestSchema.CompleteRequestParamsSchema.CompleteResultSchema.ContentBlockSchema.CreateMessageRequestSchema.CreateMessageRequestParamsSchema.CreateMessageResultSchema.CreateMessageResultWithToolsSchema.CreateTaskResultSchema.CursorSchema.DiscoverRequestSchema.DiscoverResultSchema.ElicitationCompleteNotificationSchema.ElicitationCompleteNotificationParamsSchema.ElicitRequestSchema.ElicitRequestFormParamsSchema.ElicitRequestParamsSchema.ElicitRequestURLParamsSchema.ElicitResultSchema.EmbeddedResourceSchema.EmptyResultSchema.EnumSchemaSchema.GetPromptRequestSchema.GetPromptRequestParamsSchema.GetPromptResultSchema.GetTaskPayloadRequestSchema.GetTaskPayloadResultSchema.GetTaskRequestSchema.GetTaskResultSchema.IconSchema.IconsSchema.ImageContentSchema.ImplementationSchema.InitializedNotificationSchema.InitializeRequestSchema.InitializeRequestParamsSchema.InitializeResultSchema.JSONArraySchema.JSONObjectSchema.JSONRPCErrorResponseSchema.JSONRPCMessageSchema.JSONRPCNotificationSchema.JSONRPCRequestSchema.JSONRPCResponseSchema.JSONRPCResultResponseSchema.JSONValueSchema.LegacyTitledEnumSchemaSchema.ListPromptsRequestSchema.ListPromptsResultSchema.ListResourcesRequestSchema.ListResourcesResultSchema.ListResourceTemplatesRequestSchema.ListResourceTemplatesResultSchema.ListRootsRequestSchema.ListRootsResultSchema.ListTasksRequestSchema.ListTasksResultSchema.ListToolsRequestSchema.ListToolsResultSchema.LoggingLevelSchema.LoggingMessageNotificationSchema.LoggingMessageNotificationParamsSchema.ModelHintSchema.ModelPreferencesSchema.MultiSelectEnumSchemaSchema.NotificationSchema.NumberSchemaSchema.PaginatedRequestSchema.PaginatedRequestParamsSchema.PaginatedResultSchema.PingRequestSchema.PrimitiveSchemaDefinitionSchema.ProgressSchema.ProgressNotificationSchema.ProgressNotificationParamsSchema.ProgressTokenSchema.PromptSchema.PromptArgumentSchema.PromptListChangedNotificationSchema.PromptMessageSchema.PromptReferenceSchema.ReadResourceRequestSchema.ReadResourceRequestParamsSchema.ReadResourceResultSchema.RelatedTaskMetadataSchema.RequestSchema.RequestIdSchema.RequestMetaSchema.ResourceSchema.ResourceContentsSchema.ResourceLinkSchema.ResourceListChangedNotificationSchema.ResourceRequestParamsSchema.ResourceTemplateSchema.ResourceTemplateReferenceSchema.ResourceUpdatedNotificationSchema.ResourceUpdatedNotificationParamsSchema.ResultMetaObjectSchema.ResultSchema.RoleSchema.RootSchema.RootsListChangedNotificationSchema.SamplingContentSchema.SamplingMessageSchema.SamplingMessageContentBlockSchema.ServerCapabilitiesSchema.ServerNotificationSchema.ServerRequestSchema.ServerResultSchema.SetLevelRequestSchema.SetLevelRequestParamsSchema.SingleSelectEnumSchemaSchema.StringSchemaSchema.SubscribeRequestSchema.SubscribeRequestParamsSchema.SubscriptionFilterSchema.SubscriptionsAcknowledgedNotificationSchema.SubscriptionsAcknowledgedNotificationParamsSchema.SubscriptionsListenRequestSchema.SubscriptionsListenRequestParamsSchema.SubscriptionsListenResultSchema.SubscriptionsListenResultMetaSchema.TaskAugmentedRequestParamsSchema.TaskCreationParamsSchema.TaskMetadataSchema.TaskSchema.TaskStatusSchema.TaskStatusNotificationSchema.TaskStatusNotificationParamsSchema.TextContentSchema.TextResourceContentsSchema.TitledMultiSelectEnumSchemaSchema.TitledSingleSelectEnumSchemaSchema.ToolSchema.ToolAnnotationsSchema.ToolChoiceSchema.ToolExecutionSchema.ToolListChangedNotificationSchema.ToolResultContentSchema.ToolUseContentSchema.UnsubscribeRequestSchema.UnsubscribeRequestParamsSchema.UntitledMultiSelectEnumSchemaSchema.UntitledSingleSelectEnumSchemaSchema`.split(`.`),bb={IdJagTokenExchangeResponseSchema:ev,OAuthClientInformationFullSchema:av,OAuthClientInformationSchema:iv,OAuthClientMetadataSchema:rv,OAuthClientRegistrationErrorSchema:ov,OAuthErrorResponseSchema:tv,OAuthMetadataSchema:X_,OAuthProtectedResourceMetadataSchema:Y_,OAuthTokenRevocationRequestSchema:sv,OAuthTokensSchema:$_,OpenIdProviderDiscoveryMetadataSchema:Q_,OpenIdProviderMetadataSchema:Z_},xb={},Sb={};function Cb(e,t){let n=e.slice(0,-6);xb[n]=t,Sb[n]=e=>t.safeParse(e).success}for(let e of yb)Cb(e,Vy[e]);for(let[e,t]of Object.entries(bb))Cb(e,t);Object.freeze(xb),Object.freeze(Sb);function wb(e){switch(e){case`initialize`:case`notifications/initialized`:return Iy(void 0);case`server/discover`:return Iy(Fy);default:return}}var Tb=[Im,Lm,zm,Vm],Eb=[`inputResponses`,`requestState`];function Db(e,t){let n=e.params;if(!Mb(n))return{message:e,lifted:{}};let r=n._meta,i=Mb(r)?Tb.filter(e=>e in r):[],a=t===`request`?Eb.filter(e=>e in n):[];if(i.length===0&&a.length===0)return{message:e,lifted:{}};let o={},s={...n};if(i.length>0&&Mb(r)){let e={},t={...r};for(let n of i)e[n]=r[n],delete t[n];o.envelope=e,Object.keys(t).length>0?s._meta=t:delete s._meta}for(let e of a)e===`inputResponses`&&(o.inputResponses=s[e]),e===`requestState`&&(o.requestState=s[e]),delete s[e];return{message:{...e,params:s},lifted:o}}function Ob(e,t){let n=e.validateResult(t,void 0);if(n.ok||n.reason!==`not-in-era`)return{"~standard":{version:1,vendor:`mcp-wire-codec`,validate(n){let r=e.validateResult(t,n);return r.ok?{value:r.value}:{issues:[{message:r.reason===`invalid`?r.message:`not-in-era: ${t}`}]}}}}}function kb(e){return()=>e}var Ab=kb(void 0),jb=class{_transport;_requestMessageId=0;_requestHandlers=new Map;_requestHandlerAbortControllers=new Map;_notificationHandlers=new Map;_responseHandlers=new Map;_progressHandlers=new Map;_timeoutInfo=new Map;_pendingDebouncedNotifications=new Set;_negotiatedProtocolVersion;_supportedProtocolVersions;onclose;onerror;fallbackRequestHandler;fallbackNotificationHandler;constructor(e){this._options=e,this._supportedProtocolVersions=e?.supportedProtocolVersions??Pm,this.setNotificationHandler(`notifications/cancelled`,e=>{this._oncancel(e)}),this.setNotificationHandler(`notifications/progress`,e=>{this._onprogress(e)}),this.setRequestHandler(`ping`,e=>({}))}_shouldDropInbound(e){}_outboundMetaEnvelope(){}_envelopeOutbound(e){let t=this._outboundMetaEnvelope();if(t===void 0)return e;let n=e.params??{};return{...e,params:{...n,_meta:{...t,...n._meta}}}}_resolveNonCompleteResult(e,t){return Promise.reject(new fv(dv.UnsupportedResultType,`Unsupported result type '${e.kind}' for ${t.request.method}`,{resultType:e.kind,method:t.request.method}))}_getRequestHandler(e){return this._requestHandlers.get(e)}async _oncancel(e){e.params.requestId&&this._requestHandlerAbortControllers.get(e.params.requestId)?.abort(e.params.reason)}_setupTimeout(e,t,n,r,i=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(r,t),startTime:Date.now(),timeout:t,maxTotalTimeout:n,resetTimeoutOnProgress:i,onTimeout:r})}_resetTimeout(e){let t=this._timeoutInfo.get(e);if(!t)return!1;let n=Date.now()-t.startTime;if(t.maxTotalTimeout&&n>=t.maxTotalTimeout)throw this._timeoutInfo.delete(e),new fv(dv.RequestTimeout,`Maximum total timeout exceeded`,{maxTotalTimeout:t.maxTotalTimeout,totalElapsed:n});return clearTimeout(t.timeoutId),t.timeoutId=setTimeout(t.onTimeout,t.timeout),!0}_cleanupTimeout(e){let t=this._timeoutInfo.get(e);t&&(clearTimeout(t.timeoutId),this._timeoutInfo.delete(e))}async connect(e){this._transport=e;let t=this.transport?.onclose;this._transport.onclose=()=>{try{t?.()}finally{this._onclose()}};let n=this.transport?.onerror;this._transport.onerror=e=>{n?.(e),this._onerror(e)};let r=this._transport?.onmessage;this._transport.onmessage=(e,t)=>{r?.(e,t),Wy(e)||Gy(e)?this._onresponse(e):Hy(e)?this._onrequest(e,t):Uy(e)?this._onnotification(e,t):this._onerror(Error(`Unknown message type: ${JSON.stringify(e)}`))},e.setSupportedProtocolVersions?.(this._supportedProtocolVersions),await this._transport.start()}_onclose(){let e=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._pendingDebouncedNotifications.clear();for(let e of this._timeoutInfo.values())clearTimeout(e.timeoutId);this._timeoutInfo.clear();let t=this._requestHandlerAbortControllers;this._requestHandlerAbortControllers=new Map;let n=new fv(dv.ConnectionClosed,`Connection closed`);this._transport=void 0;try{this.onclose?.()}finally{for(let t of e.values())t(n);for(let e of t.values())e.abort(n)}}_onerror(e){this.onerror?.(e)}_onnotification(e,t){let{message:n}=Db(e,`notification`),r=this._negotiatedWireCodec();if(t?.classification===void 0&&this._shouldDropInbound(e)===`drop`)return;if(t?.classification!==void 0){let e=Ly(t.classification);if(e!==r.era){this._onerror(Error(`Era mismatch on inbound notification '${n.method}': classified as ${e} but this instance serves ${r.era}`));return}}if(zy(n.method)&&!r.hasNotificationMethod(n.method))return;let i=this._notificationHandlers.get(n.method),a=this.fallbackNotificationHandler;(i!==void 0||a!==void 0)&&Promise.resolve().then(()=>i===void 0?a(n):i(n,r)).catch(e=>this._onerror(Error(`Uncaught error in notification handler: ${e}`)))}_onrequest(e,t){let{message:n,lifted:r}=Db(e,`request`),i=this._negotiatedWireCodec();if(t?.classification===void 0&&this._shouldDropInbound(e)===`drop`){this._onerror(Error(`Dropped inbound request '${e.method}': not servable on this connection's protocol era`));return}let a=this._transport,o=(e,t,r)=>{let i={jsonrpc:`2.0`,id:n.id,error:{code:e,message:t,...r!==void 0&&{data:r}}};a?.send(i).catch(e=>this._onerror(Error(`Failed to send an error response: ${e}`)))};if(t?.classification!==void 0){let e=Ly(t.classification);if(e!==i.era){this._onerror(Error(`Era mismatch on inbound request '${n.method}': classified as ${e} but this instance serves ${i.era}`));let r=t.classification.revision??e;o(Q.UnsupportedProtocolVersion,`Unsupported protocol version: ${r}`,{supported:this._supportedProtocolVersions,requested:r});return}}if(Ry(n.method)&&!i.hasRequestMethod(n.method)){o(Q.MethodNotFound,`Method not found`);return}let s=this._requestHandlers.get(n.method)??this.fallbackRequestHandler;if(s===void 0){o(Q.MethodNotFound,`Method not found`);return}let c=i.checkInboundEnvelope(r);if(c!==void 0){o(Q.InvalidParams,c);return}let l=(e,t)=>this._notificationViaCodec(this._resolveOutboundCodec(e.method),e,{...t,relatedRequestId:n.id}),u=(e,t,r)=>this._requestWithSchemaViaCodec(this._resolveOutboundCodec(e.method),e,t,{...r,relatedRequestId:n.id}),d=new AbortController;this._requestHandlerAbortControllers.set(n.id,d);let f=r.inputResponses===void 0?void 0:Pb(r.inputResponses),p={sessionId:a?.sessionId,mcpReq:{id:n.id,method:n.method,_meta:n.params?._meta,...r.envelope!==void 0&&{envelope:r.envelope},...f!==void 0&&{inputResponses:f.accepted},...f!==void 0&&f.droppedKeys.length>0&&{droppedInputResponseKeys:f.droppedKeys},requestState:r.requestState===void 0?Ab:kb(r.requestState),signal:d.signal,send:((e,t,n)=>{let r=this._resolveOutboundCodec(e.method);if(this._assertOutboundRequestInEra(r,e.method),Jy(t))return u(e,t,n);let i=Ob(r,e.method);if(i===void 0)throw TypeError(`'${e.method}' is not a spec method; pass a result schema as the second argument to ctx.mcpReq.send().`);return u(e,i,t)}),notify:l},http:t?.authInfo?{authInfo:t.authInfo}:void 0},m=this.buildContext(p,t);Promise.resolve().then(()=>s(n,m)).then(async e=>{if(d.signal.aborted)return;let t;try{t=i.encodeResult(n.method,e,this._outboundServerInfo())}catch(e){this._onerror(Error(`Failed to encode result for ${n.method}: ${e}`)),o(Q.InternalError,`Internal error`);return}let r={result:t,jsonrpc:`2.0`,id:n.id};await a?.send(r)},async e=>{if(d.signal.aborted)return;let t=Number.isSafeInteger(e.code)?e.code:Q.InternalError,r={jsonrpc:`2.0`,id:n.id,error:{code:i.encodeErrorCode(t),message:e.message??`Internal error`,...e.data!==void 0&&{data:e.data}}};await a?.send(r)}).catch(e=>this._onerror(Error(`Failed to send response: ${e}`))).finally(()=>{this._requestHandlerAbortControllers.get(n.id)===d&&this._requestHandlerAbortControllers.delete(n.id)})}_onprogress(e){let{progressToken:t,...n}=e.params,r=Number(t),i=this._progressHandlers.get(r);if(!i){this._onerror(Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let a=this._responseHandlers.get(r),o=this._timeoutInfo.get(r);if(o&&a&&o.resetTimeoutOnProgress)try{this._resetTimeout(r)}catch(e){this._responseHandlers.delete(r),this._progressHandlers.delete(r),this._cleanupTimeout(r),a(e);return}i(n)}_onresponse(e){let t=Number(e.id),n=this._responseHandlers.get(t);if(n===void 0){this._onerror(Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}this._responseHandlers.delete(t),this._cleanupTimeout(t),this._progressHandlers.delete(t),Wy(e)?n(e):n(Qv.fromError(e.error.code,e.error.message,e.error.data))}get transport(){return this._transport}async close(){await this._transport?.close()}request(e,t,n){let r=this._resolveOutboundCodec(e.method);if(this._assertOutboundRequestInEra(r,e.method),Jy(t))return this._requestWithSchemaViaCodec(r,e,t,n);let i=Ob(r,e.method);if(i===void 0)throw TypeError(`'${e.method}' is not a spec method; pass a result schema as the second argument to request().`);return this._requestWithSchemaViaCodec(r,e,i,t)}_negotiatedWireCodec(){return Iy(this._negotiatedProtocolVersion)}_wireCodec(){return this._negotiatedWireCodec()}_resolveOutboundCodec(e){if(this._negotiatedProtocolVersion===void 0){let t=wb(e);if(t)return t}return this._negotiatedWireCodec()}_assertOutboundRequestInEra(e,t){if(Ry(t)&&!e.hasRequestMethod(t))throw new fv(dv.MethodNotSupportedByProtocolVersion,`Method '${t}' is not supported by the negotiated protocol version (wire era ${e.era})`,{method:t,era:e.era})}_requestWithSchema(e,t,n){let r=this._resolveOutboundCodec(e.method);return this._assertOutboundRequestInEra(r,e.method),this._requestWithSchemaViaCodec(r,e,t,n)}_requestWithSchemaViaCodec(e,t,n,r){let{relatedRequestId:i,resumptionToken:a,onresumptiontoken:o,headers:s}=r??{},c=Date.now(),l,u;return new Promise((d,f)=>{let p=e=>{f(e)};if(!this._transport){p(Error(`Not connected`));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(t.method)}catch(e){p(e);return}if(r?.signal?.aborted){let e=r.signal.reason;throw e instanceof fv?e:new fv(dv.RequestTimeout,String(e))}let m=e.era===`2026-07-28`&&this._transport.hasPerRequestStream===!0?new AbortController:void 0,h=this._requestMessageId++;u=h;let g={...t,jsonrpc:`2.0`,id:h};r?.onprogress&&(this._progressHandlers.set(h,r.onprogress),g.params={...t.params,_meta:{...t.params?._meta,progressToken:h}});let _=this._envelopeOutbound(g),v=!1,y=e=>{v||(this._progressHandlers.delete(h),m===void 0?this._transport?.send(this._envelopeOutbound({jsonrpc:`2.0`,method:`notifications/cancelled`,params:{requestId:h,reason:String(e)}}),{relatedRequestId:i,resumptionToken:a,onresumptiontoken:o}).catch(e=>this._onerror(Error(`Failed to send cancellation: ${e}`))):m.abort(),f(e instanceof fv?e:new fv(dv.RequestTimeout,String(e))))};this._responseHandlers.set(h,i=>{if(r?.signal?.aborted)return;if(v=!0,i instanceof Error)return f(i);let a;try{a=e.decodeResult(t.method,i.result)}catch(e){return f(e instanceof Error?e:Error(String(e)))}if(a.kind===`invalid`)return f(a.error);if(a.kind===`input_required`){if(r?.allowInputRequired===!0)return d(Fb(a));let i={codec:e,request:t,resultSchema:n,options:r,flowStartedAt:c,retry:(r,i)=>this._requestWithSchemaViaCodec(e,r===void 0?{method:t.method}:{method:t.method,params:r},n,i)};return d(this._resolveNonCompleteResult(a,i))}let o=a.result;eb(n,o).then(e=>{e.success?d(e.data):f(new fv(dv.InvalidResult,`Invalid result for ${t.method}: ${e.error}`))},f)}),l=()=>y(r?.signal?.reason),r?.signal?.addEventListener(`abort`,l,{once:!0});let b=r?.timeout??6e4;this._setupTimeout(h,b,r?.maxTotalTimeout,()=>y(new fv(dv.RequestTimeout,`Request timed out`,{timeout:b})),r?.resetTimeoutOnProgress??!1),this._transport.send(_,{relatedRequestId:i,resumptionToken:a,onresumptiontoken:o,headers:s,requestSignal:m?.signal}).catch(e=>{this._progressHandlers.delete(h),f(e)})}).finally(()=>{l&&r?.signal?.removeEventListener(`abort`,l),u!==void 0&&(this._responseHandlers.delete(u),this._cleanupTimeout(u))})}async notification(e,t){return this._notificationViaCodec(this._resolveOutboundCodec(e.method),e,t)}async _notificationViaCodec(e,t,n){if(!this._transport)throw new fv(dv.NotConnected,`Not connected`);if(zy(t.method)&&!e.hasNotificationMethod(t.method))throw new fv(dv.MethodNotSupportedByProtocolVersion,`Notification '${t.method}' is not supported by the negotiated protocol version (wire era ${e.era})`,{method:t.method,era:e.era});this.assertNotificationCapability(t.method);let r=this._envelopeOutbound({jsonrpc:`2.0`,...t});if((this._options?.debouncedNotificationMethods??[]).includes(t.method)&&!t.params&&!n?.relatedRequestId){if(this._pendingDebouncedNotifications.has(t.method))return;this._pendingDebouncedNotifications.add(t.method),Promise.resolve().then(()=>{this._pendingDebouncedNotifications.delete(t.method),this._transport&&this._transport?.send(r,n).catch(e=>this._onerror(e))});return}await this._transport.send(r,n)}setRequestHandler(e,t,n){this.assertRequestHandlerCapability(e);let r;if(typeof t==`function`){if(!Ry(e))throw TypeError(`'${e}' is not a spec request method; pass schemas as the second argument to setRequestHandler().`);r=(n,r)=>{let i=this._negotiatedWireCodec(),a=i.validateRequest(e,n);if(!a.ok&&a.reason===`not-in-era`&&(a=i.validateInputRequest(e,n)),!a.ok)throw a.reason===`not-in-era`?new Qv(Q.InternalError,`No wire schema for ${e} in the resolved era`):Error(a.message);return Promise.resolve(t(a.value,r))}}else if(n)r=async(r,i)=>{let a=await eb(t.params,{...r.params});if(!a.success)throw new Qv(Q.InvalidParams,`Invalid params for ${e}: ${a.error}`);return n(a.data,i)};else throw TypeError(`setRequestHandler: handler is required`);this._requestHandlers.set(e,this._wrapHandler(e,r))}_wrapHandler(e,t){return t}_outboundServerInfo(){}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,t,n){if(typeof t==`function`){if(!zy(e))throw TypeError(`'${e}' is not a spec notification method; pass schemas as the second argument to setNotificationHandler().`);this._notificationHandlers.set(e,(n,r)=>{let i=r.validateNotification(e,n);if(!i.ok)throw i.reason===`not-in-era`?new Qv(Q.InternalError,`No wire schema for ${e} in the resolved era`):Error(i.message);return Promise.resolve(t(i.value))});return}if(!n)throw TypeError(`setNotificationHandler: handler is required`);this._notificationHandlers.set(e,async r=>{let i=await eb(t.params,{...r.params});if(!i.success)throw new Qv(Q.InvalidParams,`Invalid params for notification ${e}: ${i.error}`);await n(i.data,r)})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}};function Mb(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Nb(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Pb(e){let t={},n=[];if(!Nb(e))return{accepted:t,droppedKeys:n};for(let[r,i]of Object.entries(e)){if(!Nb(i)||`method`in i||`result`in i){n.push(r);continue}t[r]=i}return{accepted:t,droppedKeys:n}}function Fb(e){return{resultType:`input_required`,inputRequests:e.inputRequests,...e.requestState!==void 0&&{requestState:e.requestState}}}pa((e=>{var t=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,n=/\\([\u000b\u0020-\u00ff])/g,r=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;e.parse=i;function i(e){if(!e)throw TypeError(`argument string is required`);var i=typeof e==`object`?a(e):e;if(typeof i!=`string`)throw TypeError(`argument string is required to be a string`);var s=i.indexOf(`;`),c=s===-1?i.trim():i.slice(0,s).trim();if(!r.test(c))throw TypeError(`invalid media type`);var l=new o(c.toLowerCase());if(s!==-1){var u,d,f;for(t.lastIndex=s;d=t.exec(i);){if(d.index!==s)throw TypeError(`invalid parameter format`);s+=d[0].length,u=d[1].toLowerCase(),f=d[2],f.charCodeAt(0)===34&&(f=f.slice(1,-1),f.indexOf(`\\`)!==-1&&(f=f.replace(n,`$1`))),l.parameters[u]=f}if(s!==i.length)throw TypeError(`invalid parameter format`)}return l}function a(e){var t;if(typeof e.getHeader==`function`?t=e.getHeader(`content-type`):typeof e.headers==`object`&&(t=e.headers&&e.headers[`content-type`]),typeof t!=`string`)throw TypeError(`content-type header is missing from object`);return t}function o(e){this.parameters=Object.create(null),this.type=e}}))(),typeof self<`u`&&self.location&&self.location.origin!==`null`?new URL(self.location.origin+self.location.pathname+location.search):new URL(`https://github.com/cfworker`);var Ib=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,Lb=/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,Rb=/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,zb=/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,Bb=/^(?:(?:https?|ftp):\/\/)(?:\S+(?::\S*)?@)?(?:(?!10(?:\.\d{1,3}){3})(?!127(?:\.\d{1,3}){3})(?!169\.254(?:\.\d{1,3}){2})(?!192\.168(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u{00a1}-\u{ffff}0-9]+-?)*[a-z\u{00a1}-\u{ffff}0-9]+)(?:\.(?:[a-z\u{00a1}-\u{ffff}0-9]+-?)*[a-z\u{00a1}-\u{ffff}0-9]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,Vb=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,Hb=/^(?:\/(?:[^~/]|~0|~1)*)*$/,Ub=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,Wb=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,Gb=/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,Kb=/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i;function qb(e){return e.test.bind(e)}Jb.bind(void 0,!1),qb(Rb),qb(zb),qb(Bb),qb(Lb),qb(Gb),qb(Kb),qb(Vb),qb(Hb),qb(Ub),qb(Wb);function Jb(e,t){let n=t.match(Ib);if(!n)return!1;let r=+n[1],i=+n[2],a=+n[3],o=!!n[5];return(r<=23&&i<=59&&a<=59||r==23&&i==59&&a==60)&&(!e||o)}globalThis.crypto;var Yb=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.OAuthClientFlowError`})}static[Symbol.hasInstance](e){return uv(this,e)}static isInstance(e){if(typeof this!=`function`)throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return uv(this,e)}constructor(e){super(e),this.name=new.target.name,lv(this,new.target)}};(class extends Yb{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.IssuerMismatchError`})}kind;expected;received;constructor(e,t,n){super(`Issuer mismatch in ${e===`metadata`?`authorization server metadata (RFC 8414 §3.3)`:`authorization response (RFC 9207)`}: expected ${JSON.stringify(t)}, received ${JSON.stringify(n)}`),this.kind=e,this.expected=t,this.received=n}}),class extends Yb{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.RegistrationRejectedError`})}status;body;submittedMetadata;constructor(e){super(`Dynamic Client Registration rejected (HTTP ${e.status}): ${e.body}`),this.status=e.status,this.body=e.body,this.submittedMetadata=e.submittedMetadata}},class extends Yb{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.InsecureTokenEndpointError`})}tokenEndpoint;constructor(e){super(`Refusing to send credentials to non-https token endpoint '${e}'. OAuth token requests MUST use TLS (localhost / 127.0.0.1 / ::1 are exempt).`),this.tokenEndpoint=e}},class extends Yb{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.AuthorizationServerMismatchError`})}constructor(e,t){super(`Authorization server changed between redirect and callback (redirected to ${JSON.stringify(e)}, callback resolved ${JSON.stringify(t)}); refusing to send authorization_code/code_verifier to a different token endpoint`),this.recordedIssuer=e,this.currentIssuer=t}},class extends Yb{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.InsufficientScopeError`})}requiredScope;resourceMetadataUrl;errorDescription;constructor(e){super(`Insufficient scope${e.requiredScope?`: required "${e.requiredScope}"`:``}`),this.requiredScope=e.requiredScope,this.resourceMetadataUrl=e.resourceMetadataUrl,this.errorDescription=e.errorDescription}},class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.UnauthorizedError`})}static[Symbol.hasInstance](e){return uv(this,e)}static isInstance(e){if(typeof this!=`function`)throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return uv(this,e)}constructor(e){super(e??`Unauthorized`),this.name=`UnauthorizedError`,lv(this,new.target)}},class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.SseError`})}static[Symbol.hasInstance](e){return uv(this,e)}static isInstance(e){if(typeof this!=`function`)throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return uv(this,e)}constructor(e,t,n){super(`SSE error: ${t}`),this.code=e,this.event=n,lv(this,new.target)}};var Xb=class{_eventSlots=new Map;setHandler(e,t){let n=this._ensureEventSlot(e);n.onHandler&&t&&console.warn(`[MCP Apps] on${String(e)} handler replaced. Use addEventListener("${String(e)}", …) to add multiple listeners without replacing.`),n.onHandler=t}getHandler(e){return this._eventSlots.get(e)?.onHandler}addEventListener(e,t){this._ensureEventSlot(e).listeners.push(t)}removeEventListener(e,t){let n=this._eventSlots.get(e);if(!n)return;let r=n.listeners.indexOf(t);r!==-1&&n.listeners.splice(r,1)}dispatch(e,t){let n=this._eventSlots.get(e);if(n){n.onHandler?.(t);for(let e of[...n.listeners])e(t)}}_ensureEventSlot(e){let t=this._eventSlots.get(e);return t||(t={listeners:[]},this._eventSlots.set(e,t)),t}},Zb=class{_methods=new Set;claim(e,t){if(this._methods.has(e))throw Error(`Handler for "${e}" already registered (via ${t}). Use addEventListener() to attach multiple listeners, or the on* setter for replace semantics.`);this._methods.add(e)}replace(e){this._methods.add(e)}release(e){this._methods.delete(e)}has(e){return this._methods.has(e)}},Qb=new Set;function $b(e,t){let[n,r]=t,i=n?.shape;if(typeof i?.method?.value!=`string`)return;let a=i.method.value,o=e===`request`?`setRequestHandler`:`setNotificationHandler`;Qb.has(o)||(Qb.add(o),console.warn(`[ext-apps] ${o}(Schema, handler) is deprecated; use ${o}("${a}", { params: Schema.shape.params }, handler).`));let s=r;return[a,{params:i.params},e===`request`?(e,t)=>s({method:a,params:e},ex(t)):e=>s({method:a,params:e})]}function ex(e){return{signal:e.mcpReq.signal,requestId:e.mcpReq.id,sessionId:e.sessionId,_meta:e.mcpReq._meta,sendRequest:e.mcpReq.send,sendNotification:e.mcpReq.notify,authInfo:e.http?.authInfo}}var tx=`2026-01-26`,nx=class{eventTarget;eventSource;messageListener;constructor(e=window.parent,t){this.eventTarget=e,this.eventSource=t,this.messageListener=e=>{if(t&&e.source!==this.eventSource){console.debug(`Ignoring message from unknown source`,e);return}let n=ch.safeParse(e.data);n.success?(console.debug(`Parsed message`,n.data),this.onmessage?.(n.data)):e.data?.jsonrpc===`2.0`?(console.error(`Failed to parse message`,n.error.message,e),this.onerror?.(Error(`Invalid JSON-RPC message received: `+n.error.message))):console.debug(`Ignoring non-JSON-RPC message`,n.error.message,e)}}async start(){window.addEventListener(`message`,this.messageListener)}async send(e,t){e.method!==`ui/notifications/tool-input-partial`&&console.debug(`Sending message`,e),this.eventTarget.postMessage(e,`*`)}async close(){window.removeEventListener(`message`,this.messageListener),this.onclose?.()}onclose;onerror;onmessage;sessionId;setProtocolVersion},rx=q([X(`light`),X(`dark`)]).describe(`Color theme preference for the host environment.`),ix=q([X(`inline`),X(`fullscreen`),X(`pip`)]).describe(`Display mode for UI presentation.`),ax=J(q([X(`--color-background-primary`),X(`--color-background-secondary`),X(`--color-background-tertiary`),X(`--color-background-inverse`),X(`--color-background-ghost`),X(`--color-background-info`),X(`--color-background-danger`),X(`--color-background-success`),X(`--color-background-warning`),X(`--color-background-disabled`),X(`--color-text-primary`),X(`--color-text-secondary`),X(`--color-text-tertiary`),X(`--color-text-inverse`),X(`--color-text-ghost`),X(`--color-text-info`),X(`--color-text-danger`),X(`--color-text-success`),X(`--color-text-warning`),X(`--color-text-disabled`),X(`--color-border-primary`),X(`--color-border-secondary`),X(`--color-border-tertiary`),X(`--color-border-inverse`),X(`--color-border-ghost`),X(`--color-border-info`),X(`--color-border-danger`),X(`--color-border-success`),X(`--color-border-warning`),X(`--color-border-disabled`),X(`--color-ring-primary`),X(`--color-ring-secondary`),X(`--color-ring-inverse`),X(`--color-ring-info`),X(`--color-ring-danger`),X(`--color-ring-success`),X(`--color-ring-warning`),X(`--font-sans`),X(`--font-mono`),X(`--font-weight-normal`),X(`--font-weight-medium`),X(`--font-weight-semibold`),X(`--font-weight-bold`),X(`--font-text-xs-size`),X(`--font-text-sm-size`),X(`--font-text-md-size`),X(`--font-text-lg-size`),X(`--font-heading-xs-size`),X(`--font-heading-sm-size`),X(`--font-heading-md-size`),X(`--font-heading-lg-size`),X(`--font-heading-xl-size`),X(`--font-heading-2xl-size`),X(`--font-heading-3xl-size`),X(`--font-text-xs-line-height`),X(`--font-text-sm-line-height`),X(`--font-text-md-line-height`),X(`--font-text-lg-line-height`),X(`--font-heading-xs-line-height`),X(`--font-heading-sm-line-height`),X(`--font-heading-md-line-height`),X(`--font-heading-lg-line-height`),X(`--font-heading-xl-line-height`),X(`--font-heading-2xl-line-height`),X(`--font-heading-3xl-line-height`),X(`--border-radius-xs`),X(`--border-radius-sm`),X(`--border-radius-md`),X(`--border-radius-lg`),X(`--border-radius-xl`),X(`--border-radius-full`),X(`--border-width-regular`),X(`--shadow-hairline`),X(`--shadow-sm`),X(`--shadow-md`),X(`--shadow-lg`)]).describe(`CSS variable keys available to MCP apps for theming.`).describe(`Style variables for theming MCP apps.
72
-
73
- Individual style keys are optional - hosts may provide any subset of these values.
74
- Values are strings containing CSS values (colors, sizes, font stacks, etc.).
75
-
76
- Note: This type uses \`Record<K, string | undefined>\` rather than \`Partial<Record<K, string>>\`
77
- for compatibility with Zod schema generation. Both are functionally equivalent for validation.`),q([B(),zp()]).describe(`Style variables for theming MCP apps.
78
-
79
- Individual style keys are optional - hosts may provide any subset of these values.
80
- Values are strings containing CSS values (colors, sizes, font stacks, etc.).
81
-
82
- Note: This type uses \`Record<K, string | undefined>\` rather than \`Partial<Record<K, string>>\`
83
- for compatibility with Zod schema generation. Both are functionally equivalent for validation.`)).describe(`Style variables for theming MCP apps.
84
-
85
- Individual style keys are optional - hosts may provide any subset of these values.
86
- Values are strings containing CSS values (colors, sizes, font stacks, etc.).
87
-
88
- Note: This type uses \`Record<K, string | undefined>\` rather than \`Partial<Record<K, string>>\`
89
- for compatibility with Zod schema generation. Both are functionally equivalent for validation.`);G({method:X(`ui/open-link`),params:G({url:B().describe(`URL to open in the host's browser`)})});var ox=G({isError:H().optional().describe(`True if the host failed to open the URL (e.g., due to security policy).`)}).passthrough(),sx=G({isError:H().optional().describe(`True if the download failed (e.g., user cancelled or host denied).`)}).passthrough(),cx=G({isError:H().optional().describe(`True if the host rejected or failed to deliver the message.`)}).passthrough();G({method:X(`ui/notifications/sandbox-proxy-ready`),params:G({})});var lx=G({connectDomains:W(B()).optional().describe(`Origins for network requests (fetch/XHR/WebSocket).
90
-
91
- - Maps to CSP \`connect-src\` directive
92
- - Empty or omitted → no network connections (secure default)`),resourceDomains:W(B()).optional().describe("Origins for static resources (images, scripts, stylesheets, fonts, media).\n\n- Maps to CSP `img-src`, `script-src`, `style-src`, `font-src`, `media-src` directives\n- Wildcard subdomains supported: `https://*.example.com`\n- Empty or omitted → no network resources (secure default)"),frameDomains:W(B()).optional().describe("Origins for nested iframes.\n\n- Maps to CSP `frame-src` directive\n- Empty or omitted → no nested iframes allowed (`frame-src 'none'`)"),baseUriDomains:W(B()).optional().describe("Allowed base URIs for the document.\n\n- Maps to CSP `base-uri` directive\n- Empty or omitted → only same origin allowed (`base-uri 'self'`)")}),ux=G({camera:G({}).optional().describe(`Request camera access.
93
-
94
- Maps to Permission Policy \`camera\` feature.`),microphone:G({}).optional().describe(`Request microphone access.
95
-
96
- Maps to Permission Policy \`microphone\` feature.`),geolocation:G({}).optional().describe(`Request geolocation access.
97
-
98
- Maps to Permission Policy \`geolocation\` feature.`),clipboardWrite:G({}).optional().describe(`Request clipboard write access.
99
-
100
- Maps to Permission Policy \`clipboard-write\` feature.`)});G({method:X(`ui/notifications/size-changed`),params:G({width:V().optional().describe(`New width in pixels.`),height:V().optional().describe(`New height in pixels.`)})});var dx=G({method:X(`ui/notifications/tool-input`),params:G({arguments:J(B(),U().describe(`Complete tool call arguments as key-value pairs.`)).optional().describe(`Complete tool call arguments as key-value pairs.`)})}),fx=G({method:X(`ui/notifications/tool-input-partial`),params:G({arguments:J(B(),U().describe(`Partial tool call arguments (incomplete, may change).`)).optional().describe(`Partial tool call arguments (incomplete, may change).`)})}),px=G({method:X(`ui/notifications/tool-cancelled`),params:G({reason:B().optional().describe(`Optional reason for the cancellation (e.g., "user action", "timeout").`)})}),mx=G({fonts:B().optional()}),hx=G({variables:ax.optional().describe(`CSS variables for theming the app.`),css:mx.optional().describe(`CSS blocks that apps can inject.`)}),gx=G({method:X(`ui/resource-teardown`),params:G({})}),_x=J(B(),U()),vx=G({text:G({}).optional().describe(`Host supports text content blocks.`),image:G({}).optional().describe(`Host supports image content blocks.`),audio:G({}).optional().describe(`Host supports audio content blocks.`),resource:G({}).optional().describe(`Host supports resource content blocks.`),resourceLink:G({}).optional().describe(`Host supports resource link content blocks.`),structuredContent:G({}).optional().describe(`Host supports structured content.`)});G({method:X(`ui/notifications/request-teardown`),params:G({}).optional()});var yx=G({experimental:J(B(),J(B(),Up()).describe(`Experimental features keyed by identifier.`)).optional().describe(`Experimental features keyed by identifier.`),openLinks:G({}).optional().describe(`Host supports opening external URLs.`),downloadFile:G({}).optional().describe(`Host supports file downloads via ui/download-file.`),serverTools:G({listChanged:H().optional().describe(`Host supports tools/list_changed notifications.`)}).optional().describe(`Host can proxy tool calls to the MCP server.`),serverResources:G({listChanged:H().optional().describe(`Host supports resources/list_changed notifications.`)}).optional().describe(`Host can proxy resource reads to the MCP server.`),logging:G({}).optional().describe(`Host accepts log messages.`),sandbox:G({permissions:ux.optional().describe(`Permissions granted by the host (camera, microphone, geolocation).`),csp:lx.optional().describe(`CSP domains approved by the host.`)}).optional().describe(`Sandbox configuration applied by the host.`),updateModelContext:vx.optional().describe(`Host accepts context updates (ui/update-model-context) to be included in the model's context for future turns.`),message:vx.optional().describe(`Host supports receiving content messages (ui/message) from the view.`),sampling:G({tools:G({}).optional().describe("Host supports tool use via `tools` and `toolChoice` parameters.")}).optional().describe("Host supports LLM sampling (sampling/createMessage) from the view.\nMirrors the MCP `ClientCapabilities.sampling` shape so hosts can pass it through.")}),bx=G({experimental:J(B(),J(B(),Up()).describe(`Experimental features keyed by identifier.`)).optional().describe(`Experimental features keyed by identifier.`),tools:G({listChanged:H().optional().describe(`App supports tools/list_changed notifications.`)}).optional().describe(`App exposes MCP-style tools that the host can call.`),availableDisplayModes:W(ix).optional().describe(`Display modes the app supports.`)});G({method:X(`ui/notifications/initialized`),params:G({}).optional()}),G({csp:lx.optional().describe(`Content Security Policy configuration for UI resources.`),permissions:ux.optional().describe(`Sandbox permissions requested by the UI resource.`),domain:B().optional().describe(`Dedicated origin for view sandbox.
101
-
102
- Useful when views need stable, dedicated origins for OAuth callbacks, CORS policies, or API key allowlists.
103
-
104
- **Host-dependent:** The format and validation rules for this field are determined by each host. Servers MUST consult host-specific documentation for the expected domain format. Common patterns include:
105
- - Hash-based subdomains (e.g., \`{hash}.claudemcpcontent.com\`)
106
- - URL-derived subdomains (e.g., \`www-example-com.oaiusercontent.com\`)
107
-
108
- If omitted, host uses default sandbox origin (typically per-conversation).`),prefersBorder:H().optional().describe(`Visual boundary preference - true if view prefers a visible border.
109
-
110
- Boolean requesting whether a visible border and background is provided by the host. Specifying an explicit value for this is recommended because hosts' defaults may vary.
111
-
112
- - \`true\`: request visible border + background
113
- - \`false\`: request no visible border + background
114
- - omitted: host decides border`)}),G({method:X(`ui/request-display-mode`),params:G({mode:ix.describe(`The display mode being requested.`)})});var xx=G({mode:ix.describe(`The display mode that was actually set. May differ from requested if not supported.`)}).passthrough(),Sx=q([X(`model`),X(`app`)]).describe(`Tool visibility scope - who can access the tool.`);G({resourceUri:B().optional(),visibility:W(Sx).optional().describe(`Who can access this tool. Default: ["model", "app"]
115
- - "model": Tool visible to and callable by the agent
116
- - "app": Tool callable by the app from this server only`),csp:Kp().optional(),permissions:Kp().optional()}),G({mimeTypes:W(B()).optional().describe('Array of supported MIME types for UI resources.\nMust include `"text/html;profile=mcp-app"` for MCP Apps support.')}),G({method:X(`ui/download-file`),params:G({contents:W(q([xg,Sg])).describe(`Resource contents to download — embedded (inline data) or linked (host fetches). Uses standard MCP resource types.`)})}),G({method:X(`ui/message`),params:G({role:X(`user`).describe(`Message role, currently only "user" is supported.`),content:W(Cg).describe(`Message content blocks (text, image, etc.).`)})}),G({method:X(`ui/notifications/sandbox-resource-ready`),params:G({html:B().describe(`HTML content to load into the inner iframe.`),sandbox:B().optional().describe(`Optional override for the inner iframe's sandbox attribute.`),csp:lx.optional().describe(`CSP configuration from resource metadata.`),permissions:ux.optional().describe(`Sandbox permissions from resource metadata.`)})});var Cx=G({method:X(`ui/notifications/tool-result`),params:Mg.describe(`Standard MCP tool execution result.`)}),wx=G({toolInfo:G({id:rh.optional().describe(`JSON-RPC id of the tools/call request.`),tool:kg.describe(`Tool definition including name, inputSchema, etc.`)}).optional().describe(`Metadata of the tool call that instantiated this App.`),theme:rx.optional().describe(`Current color theme preference.`),styles:hx.optional().describe(`Style configuration for theming the app.`),displayMode:ix.optional().describe(`How the UI is currently displayed.`),availableDisplayModes:W(ix).optional().describe(`Display modes the host supports.`),containerDimensions:q([G({height:V().describe(`Fixed container height in pixels.`)}),G({maxHeight:q([V(),zp()]).optional().describe(`Maximum container height in pixels.`)})]).and(q([G({width:V().describe(`Fixed container width in pixels.`)}),G({maxWidth:q([V(),zp()]).optional().describe(`Maximum container width in pixels.`)})])).optional().describe(`Container dimensions. Represents the dimensions of the iframe or other
117
- container holding the app. Specify either width or maxWidth, and either height or maxHeight.`),locale:B().optional().describe(`User's language and region preference in BCP 47 format.`),timeZone:B().optional().describe(`User's timezone in IANA format.`),userAgent:B().optional().describe(`Host application identifier.`),platform:q([X(`web`),X(`desktop`),X(`mobile`)]).optional().describe(`Platform type for responsive design decisions.`),deviceCapabilities:G({touch:H().optional().describe(`Whether the device supports touch input.`),hover:H().optional().describe(`Whether the device supports hover interactions.`)}).optional().describe(`Device input capabilities.`),safeAreaInsets:G({top:V().describe(`Top safe area inset in pixels.`),right:V().describe(`Right safe area inset in pixels.`),bottom:V().describe(`Bottom safe area inset in pixels.`),left:V().describe(`Left safe area inset in pixels.`)}).optional().describe(`Mobile safe area boundaries in pixels.`)}).passthrough(),Tx=G({method:X(`ui/notifications/host-context-changed`),params:wx.describe(`Partial context update containing only changed fields.`)});G({method:X(`ui/update-model-context`),params:G({content:W(Cg).optional().describe(`Context content blocks (text, image, etc.).`),structuredContent:J(B(),U().describe(`Structured content for machine-readable context data.`)).optional().describe(`Structured content for machine-readable context data.`)})}),G({method:X(`ui/initialize`),params:G({appInfo:gh.describe(`App identification (name and version).`),appCapabilities:bx.describe(`Features and capabilities this app provides.`),protocolVersion:B().describe(`Protocol version this app supports.`)})});var Ex=G({protocolVersion:B().describe(`Negotiated protocol version string (e.g., "2025-11-21").`),hostInfo:gh.describe(`Host application identification and version.`),hostCapabilities:yx.describe(`Features and capabilities provided by the host.`),hostContext:wx.describe(`Rich context about the host environment.`)}).passthrough(),Dx={target:`draft-2020-12`};async function Ox(e,t){let n=e[`~standard`];if(n.jsonSchema)return n.jsonSchema[t](Dx);throw Error(`Schema (vendor: ${n.vendor}) does not implement Standard JSON Schema (~standard.jsonSchema). Use a library that does (zod v4, ArkType, Valibot) or wrap your schema accordingly.`)}async function kx(e,t,n=``){let r=await e[`~standard`].validate(t);if(r.issues){let e=r.issues.map(e=>{let t=e.path?.map(e=>typeof e==`object`?e.key:e).join(`.`);return t?`${t}: ${e.message}`:e.message}).join(`; `);throw Error(n+e)}return r.value}function Ax(e,t){let n={...e,...t};return t.experimental!==void 0&&(n.experimental={...e.experimental,...t.experimental}),t.tools!==void 0&&(n.tools={...e.tools,...t.tools}),n}var jx=class e extends jb{_appInfo;_appCapabilities;options;_hostCapabilities;_hostInfo;_hostContext;_registeredTools={};_initializedSent=!1;_registeredEvents=new Set;_events=new Xb;_methods=new Zb;setRequestHandler=(...e)=>{let[t,...n]=$b(`request`,e)??e;this._methods.claim(t,`setRequestHandler`),super.setRequestHandler.call(this,t,...n)};setNotificationHandler=(...e)=>{let[t,...n]=$b(`notification`,e)??e;this._methods.claim(t,`setNotificationHandler`),super.setNotificationHandler.call(this,t,...n)};removeRequestHandler=e=>{this._methods.release(e),super.removeRequestHandler(e)};removeNotificationHandler=e=>{this._methods.release(e),super.removeNotificationHandler(e)};replaceRequestHandler=(e,...t)=>{this._methods.replace(e),super.setRequestHandler.call(this,e,...t)};_assertInitialized(e){if(this._initializedSent)return;let t=`[ext-apps] App.${e}() called before connect() completed the ui/initialize handshake. Await app.connect() before calling this method, or move data loading to an ontoolresult handler.`;if(this.options?.strict)throw Error(t);console.warn(`${t}. This will throw in a future release.`)}eventSchemas={toolinput:dx,toolinputpartial:fx,toolresult:Cx,toolcancelled:px,hostcontextchanged:Tx};static ONE_SHOT_EVENTS=new Set([`toolinput`,`toolinputpartial`,`toolresult`,`toolcancelled`]);_everHadListener=new Set;_assertHandlerTiming(t){if(!e.ONE_SHOT_EVENTS.has(t)||this._everHadListener.has(t)||(this._everHadListener.add(t),!this._initializedSent))return;let n=`[ext-apps] "${String(t)}" handler registered after connect() completed the ui/initialize handshake. The host may have already sent this notification. Register handlers before calling app.connect().`;if(this.options?.strict)throw Error(n);console.warn(n)}setEventHandler(e,t){t&&this._assertHandlerTiming(e),this._ensureEventSlot(e),this._events.setHandler(e,t)}addEventListener(e,t){this._assertHandlerTiming(e),this._ensureEventSlot(e),this._events.addEventListener(e,t)}removeEventListener(e,t){this._events.removeEventListener(e,t)}_ensureEventSlot(e){if(this._registeredEvents.has(e))return;let t=this.eventSchemas[e];if(!t)throw Error(`Unknown event: ${String(e)}`);this.setNotificationHandler(t.shape.method.value,{params:t.shape.params},t=>{let n=t;e===`hostcontextchanged`&&(this._hostContext={...this._hostContext,...n}),this._events.dispatch(e,n)}),this._registeredEvents.add(e)}getEventHandler(e){return this._events.getHandler(e)}warnIfRequestHandlerReplaced(e,t,n){t&&n&&console.warn(`[MCP Apps] ${e} handler replaced. Previous handler will no longer be called.`)}constructor(e,t={},n={autoResize:!0}){super(n),this._appInfo=e,this._appCapabilities=t,this.options=n,this._methods.replace(`notifications/cancelled`),this._methods.replace(`notifications/progress`),!n.allowUnsafeEval&&Fo({jitless:!0}),this.replaceRequestHandler(`ping`,e=>(console.log(`Received ping:`,e.params),{})),this.setEventHandler(`hostcontextchanged`,void 0)}buildContext(e){return e}registerAppCapabilities(e){if(this.transport)throw Error(`Cannot register capabilities after transport is established`);this._appCapabilities=Ax(this._appCapabilities,e)}registerTool(e,t,n){if(this._registeredTools[e])throw Error(`Tool ${e} is already registered`);let r=this,i=()=>{r._initializedSent&&r._appCapabilities.tools?.listChanged&&r.sendToolListChanged()},a=t.inputSchema!==void 0,o={title:t.title,description:t.description,inputSchema:t.inputSchema,outputSchema:t.outputSchema,annotations:t.annotations,_meta:t._meta,enabled:!0,enable(){this.enabled=!0,i()},disable(){this.enabled=!1,i()},update(e){Object.assign(this,e),i()},remove(){r._registeredTools[e]===o&&(delete r._registeredTools[e],i())},handler:async(t,r)=>{if(!o.enabled)throw Error(`Tool ${e} is disabled`);let i;if(a){let a=o.inputSchema;i=await n(a?await kx(a,t??{},`Invalid input for tool ${e}: `):t??{},r)}else i=await n(r);return o.outputSchema&&!i.isError&&(i.structuredContent=await kx(o.outputSchema,i.structuredContent,`Invalid output for tool ${e}: `)),i}};return this._registeredTools[e]=o,!this._appCapabilities.tools&&!this.transport&&this.registerAppCapabilities({tools:{listChanged:!0}}),this.ensureToolHandlersInitialized(),i(),o}_toolHandlersInitialized=!1;ensureToolHandlersInitialized(){this._toolHandlersInitialized||(this._toolHandlersInitialized=!0,this.oncalltool=async(e,t)=>{let n=this._registeredTools[e.name];if(!n)throw Error(`Tool ${e.name} not found`);return n.handler(e.arguments,t)},this.onlisttools=async(e,t)=>({tools:await Promise.all(Object.entries(this._registeredTools).filter(([e,t])=>t.enabled).map(async([e,t])=>{let n={name:e,title:t.title,description:t.description,inputSchema:t.inputSchema?await Ox(t.inputSchema,`input`):{type:`object`,properties:{}}};return t.outputSchema&&(n.outputSchema=await Ox(t.outputSchema,`output`)),t.annotations&&(n.annotations=t.annotations),t._meta&&(n._meta=t._meta),n}))}))}async sendToolListChanged(e={}){this._assertInitialized(`sendToolListChanged`),await this.notification({method:`notifications/tools/list_changed`,params:e})}getHostCapabilities(){return this._hostCapabilities}getHostVersion(){return this._hostInfo}getHostContext(){return this._hostContext}get ontoolinput(){return this.getEventHandler(`toolinput`)}set ontoolinput(e){this.setEventHandler(`toolinput`,e)}get ontoolinputpartial(){return this.getEventHandler(`toolinputpartial`)}set ontoolinputpartial(e){this.setEventHandler(`toolinputpartial`,e)}get ontoolresult(){return this.getEventHandler(`toolresult`)}set ontoolresult(e){this.setEventHandler(`toolresult`,e)}get ontoolcancelled(){return this.getEventHandler(`toolcancelled`)}set ontoolcancelled(e){this.setEventHandler(`toolcancelled`,e)}get onhostcontextchanged(){return this.getEventHandler(`hostcontextchanged`)}set onhostcontextchanged(e){this.setEventHandler(`hostcontextchanged`,e)}_onteardown;get onteardown(){return this._onteardown}set onteardown(e){this.warnIfRequestHandlerReplaced(`onteardown`,this._onteardown,e),this._onteardown=e,this.replaceRequestHandler(`ui/resource-teardown`,{params:gx.shape.params,result:_x},(e,t)=>{if(!this._onteardown)throw Error(`No onteardown handler set`);return this._onteardown(e,t)})}_oncalltool;get oncalltool(){return this._oncalltool}set oncalltool(e){this.warnIfRequestHandlerReplaced(`oncalltool`,this._oncalltool,e),this._oncalltool=e,this.replaceRequestHandler(`tools/call`,(e,t)=>{if(!this._oncalltool)throw Error(`No oncalltool handler set`);return this._oncalltool(e.params,t)})}_onlisttools;get onlisttools(){return this._onlisttools}set onlisttools(e){this.warnIfRequestHandlerReplaced(`onlisttools`,this._onlisttools,e),this._onlisttools=e,this.replaceRequestHandler(`tools/list`,(e,t)=>{if(!this._onlisttools)throw Error(`No onlisttools handler set`);return this._onlisttools(e.params,t)})}assertCapabilityForMethod(e){if(e===`sampling/createMessage`&&!this._hostCapabilities?.sampling)throw Error(`Host does not support sampling (required for ${e})`)}assertRequestHandlerCapability(e){switch(e){case`tools/call`:case`tools/list`:if(!this._appCapabilities.tools)throw Error(`Client does not support tool capability (required for ${e})`);return;default:return}}assertNotificationCapability(e){}async callServerTool(e,t){if(this._assertInitialized(`callServerTool`),typeof e==`string`)throw Error(`callServerTool() expects an object as its first argument, but received a string ("${e}"). Did you mean: callServerTool({ name: "${e}", arguments: { ... } })?`);return await this.request({method:`tools/call`,params:e},{onprogress:()=>{},resetTimeoutOnProgress:!0,...t})}async readServerResource(e,t){return this._assertInitialized(`readServerResource`),await this.request({method:`resources/read`,params:e},t)}async listServerResources(e,t){return this._assertInitialized(`listServerResources`),await this.request({method:`resources/list`,params:e},t)}async createSamplingMessage(e,t){return this._assertInitialized(`createSamplingMessage`),await this.request({method:`sampling/createMessage`,params:e},t)}sendMessage(e,t){return this._assertInitialized(`sendMessage`),this.request({method:`ui/message`,params:e},cx,t)}sendLog(e){return this.notification({method:`notifications/message`,params:e})}updateModelContext(e,t){return this._assertInitialized(`updateModelContext`),this.request({method:`ui/update-model-context`,params:e},uh,t)}openLink(e,t){return this._assertInitialized(`openLink`),this.request({method:`ui/open-link`,params:e},ox,t)}sendOpenLink=this.openLink;downloadFile(e,t){return this._assertInitialized(`downloadFile`),this.request({method:`ui/download-file`,params:e},sx,t)}requestTeardown(e={}){return this.notification({method:`ui/notifications/request-teardown`,params:e})}requestDisplayMode(e,t){return this._assertInitialized(`requestDisplayMode`),this.request({method:`ui/request-display-mode`,params:e},xx,t)}sendSizeChanged(e){return this.notification({method:`ui/notifications/size-changed`,params:e})}setupSizeChangedNotifications(){let e=!1,t=0,n=0,r=()=>{e||(e=!0,requestAnimationFrame(()=>{e=!1;let r=document.documentElement,i=r.style.height;r.style.height=`max-content`;let a=Math.ceil(r.getBoundingClientRect().height);r.style.height=i;let o=Math.ceil(window.innerWidth);(o!==t||a!==n)&&(t=o,n=a,this.sendSizeChanged({width:o,height:a}))}))};r();let i=new ResizeObserver(r);return i.observe(document.documentElement),i.observe(document.body),()=>i.disconnect()}async connect(e=new nx(window.parent,window.parent),t){if(this.transport)throw Error(`App is already connected. Call close() before connecting again.`);this._initializedSent=!1;try{await super.connect(e);let n=await this.request({method:`ui/initialize`,params:{appCapabilities:this._appCapabilities,appInfo:this._appInfo,protocolVersion:tx}},Ex,t);if(n===void 0)throw Error(`Server sent invalid initialize result: ${n}`);this._hostCapabilities=n.hostCapabilities,this._hostInfo=n.hostInfo,this._hostContext=n.hostContext,await this.notification({method:`ui/notifications/initialized`}),this._initializedSent=!0,this.options?.autoResize&&this.setupSizeChangedNotifications()}catch(e){throw this.close(),e}}},Mx=e((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),$=e(((e,t)=>{t.exports=Mx()}))();function Nx({className:e=``}){return(0,$.jsxs)(`svg`,{viewBox:`0 0 2500 2500`,className:e,"aria-hidden":`true`,fillRule:`evenodd`,clipRule:`evenodd`,children:[(0,$.jsx)(`path`,{d:`m2499.6 1250c0 690.2-559.6 1249.8-1250.1 1249.9-690 0-1249.6-559.7-1249.5-1250-.2-690.3 559.4-1249.9 1249.7-1249.9s1249.9 559.7 1249.9 1250z`,fill:`#eab300`}),(0,$.jsxs)(`g`,{fill:`#fff`,children:[(0,$.jsx)(`path`,{d:`m1741.5 943.8c-16.1-167.4-160.6-223.5-343.2-239.5v-232.3h-141.3v226.1c-37.1 0-75.1.7-112.8 1.5v-227.6h-141.3l-.1 232.1c-30.6.6-60.7 1.2-90 1.2v-.7l-194.9-.1v151s104.4-2 102.6-.1c57.3 0 75.9 33.2 81.3 61.9v264.6c4 0 9.1.2 14.9 1h-14.9l-.1 370.7c-2.5 18-13.1 46.7-53.1 46.8 1.8 1.6-102.7 0-102.7 0l-28.1 168.8h184c34.2 0 67.9.6 100.9.8l.1 234.9h141.2v-232.4c38.7.8 76.2 1.1 112.9 1.1l-.1 231.3h141.3v-234.4c237.6-13.6 404.1-73.5 424.7-296.7 16.7-179.7-67.8-260-202.7-292.4 82.1-41.6 133.4-115.1 121.4-237.6zm-197.8 502.2c0 175.5-300.5 155.6-396.4 155.6v-311.3c95.9.2 396.4-27.3 396.4 155.7zm-65.8-439.1c0 159.7-250.8 141-330.6 141.1v-282.2c79.9 0 330.7-25.4 330.6 141.1z`}),(0,$.jsx)(`path`,{d:`m902 1175.7h21v15.5h-21z`})]})]})}function Px({children:e,active:t,onNavigate:n,navigation:r=!0}){return(0,$.jsxs)(`div`,{className:r?`local-shell`:`local-shell setup-shell`,children:[(0,$.jsxs)(`header`,{className:`local-header`,children:[(0,$.jsxs)(`div`,{className:`brand-mark`,children:[(0,$.jsx)(Nx,{className:`brand-symbol`}),(0,$.jsx)(`span`,{children:`BSV MCP`})]}),r&&n?(0,$.jsx)(`nav`,{className:`local-nav`,"aria-label":`Local app sections`,children:[`explorer`,`wallet`,`ordinals`,`sweep`].map(e=>(0,$.jsx)(`button`,{type:`button`,className:t===e?`nav-tab active`:`nav-tab`,"aria-current":t===e?`page`:void 0,onClick:()=>n(e),children:e},e))}):null]}),(0,$.jsx)(`main`,{className:`local-content`,children:e}),(0,$.jsxs)(`footer`,{className:`local-footer`,children:[(0,$.jsx)(`span`,{children:`LOCAL PROCESS`}),(0,$.jsx)(`span`,{className:`status-dot`,"aria-hidden":`true`}),(0,$.jsx)(`span`,{children:`PRIVATE BY DEFAULT`})]})]})}function Fx({eyebrow:e,title:t,description:n}){return(0,$.jsxs)(`header`,{className:`page-header`,children:[(0,$.jsxs)(`p`,{className:`eyebrow`,children:[(0,$.jsx)(`span`,{children:`#`}),` `,e]}),(0,$.jsx)(`h1`,{children:t}),n?(0,$.jsx)(`p`,{className:`page-description`,children:n}):null]})}function Ix({children:e,className:t=``}){return(0,$.jsx)(`section`,{className:`surface ${t}`,children:e})}function Lx({children:e,tone:t=`info`}){return(0,$.jsx)(`div`,{className:`notice notice-${t}`,role:t===`error`||t===`warning`?`alert`:`status`,children:e})}function Rx({children:e,type:t=`button`,variant:n=`primary`,disabled:r,onClick:i,"aria-busy":a}){return(0,$.jsx)(`button`,{type:t,className:`button button-${n}`,disabled:r,onClick:i,"aria-busy":a,children:e})}function zx({label:e=`Loading`}){return(0,$.jsxs)(`div`,{className:`spinner-row`,role:`status`,children:[(0,$.jsx)(`span`,{className:`spinner`,"aria-hidden":`true`}),e]})}function Bx({label:e,value:t}){return(0,$.jsxs)(`div`,{className:`data-row`,children:[(0,$.jsx)(`span`,{className:`data-label`,children:e}),(0,$.jsx)(`span`,{className:`data-value`,children:t})]})}function Vx(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}function Hx(e){return Array.isArray(e)?e.filter(e=>!!(e&&typeof e==`object`)):[]}function Ux(e,t=8){return e.length<=t*2+3?e:`${e.slice(0,t)}…${e.slice(-t)}`}function Wx(e){return Number(e??0).toLocaleString()}function Gx(){let e=(0,A.useRef)(null),[t,n]=(0,A.useState)(!1),[r,i]=(0,A.useState)();return(0,A.useEffect)(()=>{let t=new jx({name:`BSV MCP`,version:`1.0.0`});return e.current=t,t.ontoolresult=()=>n(!0),t.connect().then(()=>n(!0)).catch(e=>i(String(e))),()=>{e.current=null}},[]),{call:(0,A.useCallback)(async(t,n={})=>{let r=e.current;if(!r)throw Error(`The local app is not connected to its MCP host.`);let i=(await r.callServerTool({name:t,arguments:n}))?.structuredContent;if(!i)throw Error(`The MCP host returned no structured data.`);return Vx(i)},[]),ready:t,error:r}}function Kx(){let{call:e,ready:t,error:n}=Gx(),[r,i]=(0,A.useState)(`explorer`);return n?(0,$.jsx)(Px,{navigation:!1,children:(0,$.jsxs)(Lx,{tone:`error`,children:[`Could not connect to the MCP host: `,n]})}):t?(0,$.jsxs)(Px,{active:r,onNavigate:i,children:[r===`explorer`?(0,$.jsx)(qx,{call:e}):null,r===`wallet`?(0,$.jsx)(Zx,{call:e}):null,r===`ordinals`?(0,$.jsx)(Qx,{call:e}):null,r===`sweep`?(0,$.jsx)(eS,{call:e}):null]}):(0,$.jsx)(Px,{navigation:!1,children:(0,$.jsx)(`div`,{className:`center-state`,children:(0,$.jsx)(zx,{label:`Connecting to MCP host`})})})}function qx({call:e}){let[t,n]=(0,A.useState)(),[r,i]=(0,A.useState)(),[a,o]=(0,A.useState)(``);(0,A.useEffect)(()=>{e(`app_explorer_data`).then(n).catch(e=>i(String(e)))},[e]);async function s(){let t=a.trim();if(t){i(void 0);try{let r=/^[0-9a-f]{64}$/i.test(t)?{txid:t}:t.startsWith(`1`)?{address:t}:{query:t};n(await e(`app_explorer_data`,r))}catch(e){i(String(e))}}}let c=Vx(t?.chainInfo),l=Hx(t?.recentBlocks);return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Fx,{eyebrow:`explorer`,title:`Read the chain`,description:`Inspect live network data without leaving your local MCP session.`}),r?(0,$.jsx)(Lx,{tone:`error`,children:r}):null,!t&&!r?(0,$.jsx)(Ix,{children:(0,$.jsx)(`div`,{className:`surface-body`,children:(0,$.jsx)(zx,{label:`Loading explorer data`})})}):null,t?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`grid grid-stats`,children:[(0,$.jsx)(Jx,{label:`Block height`,value:Number(c.blocks??0)?Number(c.blocks).toLocaleString():`—`}),(0,$.jsx)(Jx,{label:`BSV price`,value:typeof t.price==`number`?`$${t.price.toFixed(2)}`:`—`}),(0,$.jsx)(Jx,{label:`Difficulty`,value:Yx(c.difficulty)}),(0,$.jsx)(Jx,{label:`Best block`,value:c.bestblockhash?Ux(String(c.bestblockhash),6):`—`})]}),(0,$.jsxs)(Ix,{className:`stack-surface`,children:[(0,$.jsx)(`div`,{className:`surface-header`,children:(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`p`,{className:`section-label`,children:`lookup`}),(0,$.jsx)(`h2`,{children:`Search BSV`})]})}),(0,$.jsxs)(`div`,{className:`surface-body`,children:[(0,$.jsxs)(`div`,{className:`search-row`,children:[(0,$.jsx)(`input`,{className:`field`,value:a,onChange:e=>o(e.target.value),onKeyDown:e=>{e.key===`Enter`&&s()},placeholder:`Transaction ID or address`,"aria-label":`Transaction ID or address`}),(0,$.jsx)(Rx,{onClick:()=>void s(),children:`Search`})]}),(0,$.jsx)(Xx,{data:t,query:a})]})]}),l.length?(0,$.jsxs)(Ix,{className:`stack-surface`,children:[(0,$.jsx)(`div`,{className:`surface-header`,children:(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`p`,{className:`section-label`,children:`network`}),(0,$.jsx)(`h2`,{children:`Recent blocks`})]})}),(0,$.jsxs)(`div`,{className:`table`,children:[(0,$.jsxs)(`div`,{className:`table-row table-head`,children:[(0,$.jsx)(`span`,{children:`Height`}),(0,$.jsx)(`span`,{children:`Hash`}),(0,$.jsx)(`span`,{children:`Txs`}),(0,$.jsx)(`span`,{children:`Size`}),(0,$.jsx)(`span`,{children:`Time`})]}),l.map((e,t)=>(0,$.jsxs)(`div`,{className:`table-row`,children:[(0,$.jsx)(`span`,{className:`mono`,children:Number(e.height??0).toLocaleString()}),(0,$.jsx)(`span`,{className:`mono dim`,children:Ux(String(e.hash??`—`),10)}),(0,$.jsx)(`span`,{className:`dim`,children:Hx(e.tx).length||`—`}),(0,$.jsx)(`span`,{className:`dim`,children:e.size?`${(Number(e.size)/1024).toFixed(1)} KB`:`—`}),(0,$.jsx)(`span`,{className:`dim`,children:e.time?new Date(Number(e.time)*1e3).toLocaleTimeString():`—`})]},String(e.hash??t)))]})]}):null]}):null]})}function Jx({label:e,value:t}){return(0,$.jsxs)(`div`,{className:`stat-card`,children:[(0,$.jsx)(`div`,{className:`stat-label`,children:e}),(0,$.jsx)(`div`,{className:`stat-value`,children:t})]})}function Yx(e){let t=Number(e??0);if(!t)return`—`;for(let[e,n]of[[`PH`,0x38d7ea4c68000],[`TH`,0xe8d4a51000],[`GH`,1e9],[`MH`,1e6]])if(t>=n)return`${(t/n).toFixed(1)} ${e}`;return t.toLocaleString()}function Xx({data:e,query:t}){let n=Vx(e.transaction),r=Vx(e.addressInfo);if(!Object.keys(n).length&&!Object.keys(r).length&&t)return(0,$.jsx)(`div`,{className:`empty`,children:`No results found`});if(Object.keys(n).length)return(0,$.jsxs)(`div`,{className:`data-list`,children:[(0,$.jsx)(Bx,{label:`TXID`,value:(0,$.jsx)(`span`,{className:`mono`,children:String(n.txid??t)})}),(0,$.jsx)(Bx,{label:`Size`,value:`${n.size??`—`} bytes`}),(0,$.jsx)(Bx,{label:`Fee`,value:n.fee==null?`—`:`${Wx(n.fee)} sats`}),(0,$.jsx)(Bx,{label:`Confirmations`,value:String(n.confirmations??`—`)}),(0,$.jsx)(Bx,{label:`Outputs`,value:Hx(n.outputs).length})]});if(Object.keys(r).length){let e=Vx(r.balance);return(0,$.jsxs)(`div`,{className:`data-list`,children:[(0,$.jsx)(Bx,{label:`Address`,value:(0,$.jsx)(`span`,{className:`mono`,children:t})}),(0,$.jsx)(Bx,{label:`Confirmed`,value:`${Wx(e.confirmed)} sats`}),(0,$.jsx)(Bx,{label:`Unconfirmed`,value:`${Wx(e.unconfirmed)} sats`}),(0,$.jsx)(Bx,{label:`Transactions`,value:Hx(r.history).length||`—`})]})}return(0,$.jsx)(`div`,{className:`empty`,children:`Enter a transaction ID or address to search.`})}function Zx({call:e}){let[t,n]=(0,A.useState)(),[r,i]=(0,A.useState)();if((0,A.useEffect)(()=>{e(`app_wallet_data`).then(e=>{if(e.error)throw Error(String(e.error));n(e)}).catch(e=>i(String(e)))},[e]),r)return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Fx,{eyebrow:`wallet`,title:`Wallet`,description:`This session has no unlocked Vault wallet yet.`}),(0,$.jsx)(Lx,{tone:`error`,children:r}),(0,$.jsx)(Ix,{children:(0,$.jsxs)(`div`,{className:`surface-body`,children:[(0,$.jsx)(`p`,{children:`Import an existing key or create a Vault wallet in the local browser.`}),(0,$.jsx)(Rx,{onClick:()=>{e(`wallet_onboarding`).catch(e=>i(String(e)))},children:`Open wallet setup`})]})})]});if(!t)return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Fx,{eyebrow:`wallet`,title:`Wallet`}),(0,$.jsx)(Ix,{children:(0,$.jsx)(`div`,{className:`surface-body`,children:(0,$.jsx)(zx,{label:`Loading wallet data`})})})]});let a=Vx(t.balance),o=Hx(t.utxos),s=Number(a.satoshis??0),c=String(a.bsv??(s/1e8).toFixed(8));return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Fx,{eyebrow:`wallet`,title:`Your local wallet`,description:`Balances and unspent outputs are read from the connected wallet service.`}),(0,$.jsxs)(`div`,{className:`grid grid-three`,children:[(0,$.jsx)(Jx,{label:`Balance`,value:`${c} BSV`}),(0,$.jsx)(Jx,{label:`Satoshis`,value:`${Wx(s)} sats`}),(0,$.jsx)(Jx,{label:`UTXOs`,value:String(a.utxoCount??o.length)})]}),t.address?(0,$.jsxs)(`div`,{className:`address-row`,children:[(0,$.jsx)(`code`,{children:String(t.address)}),(0,$.jsx)(`button`,{className:`copy-button`,type:`button`,onClick:()=>void navigator.clipboard?.writeText(String(t.address)),children:`copy`})]}):null,(0,$.jsxs)(Ix,{className:`stack-surface`,children:[(0,$.jsx)(`div`,{className:`surface-header`,children:(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`p`,{className:`section-label`,children:`outputs`}),(0,$.jsx)(`h2`,{children:`Unspent outputs`})]})}),o.length?(0,$.jsxs)(`div`,{className:`table`,children:[(0,$.jsxs)(`div`,{className:`table-row table-head`,children:[(0,$.jsx)(`span`,{children:`TXID`}),(0,$.jsx)(`span`,{children:`Index`}),(0,$.jsx)(`span`,{children:`Value`})]}),o.slice(0,25).map((e,t)=>(0,$.jsxs)(`div`,{className:`table-row`,children:[(0,$.jsx)(`span`,{className:`mono dim`,children:Ux(String(e.txid??`—`),10)}),(0,$.jsx)(`span`,{className:`mono`,children:String(e.vout??e.outputIndex??`—`)}),(0,$.jsxs)(`span`,{className:`mono`,children:[Wx(e.satoshis),` sats`]})]},`${String(e.txid??t)}-${String(e.vout??e.outputIndex??t)}`))]}):(0,$.jsx)(`div`,{className:`empty`,children:`No UTXOs found.`})]})]})}function Qx({call:e}){let[t,n]=(0,A.useState)(),[r,i]=(0,A.useState)(),[a,o]=(0,A.useState)(``),s=(0,A.useCallback)(async t=>{i(void 0);try{let r=await e(`app_ordinals_data`,t?{query:t}:{});if(r.error)throw Error(String(r.error));n(r)}catch(e){i(String(e))}},[e]);(0,A.useEffect)(()=>{s()},[s]);let c=Hx(t?.listings),l=String(t?.contentBaseUrl??``);return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Fx,{eyebrow:`ordinals`,title:`Inscription collection`,description:`Browse the latest ordinal listings available to this wallet.`}),r?(0,$.jsx)(Lx,{tone:`error`,children:r}):null,(0,$.jsx)(Ix,{children:(0,$.jsxs)(`div`,{className:`surface-body`,children:[(0,$.jsxs)(`div`,{className:`search-row`,children:[(0,$.jsx)(`input`,{className:`field`,value:a,onChange:e=>o(e.target.value),onKeyDown:e=>{e.key===`Enter`&&s(a.trim()||void 0)},placeholder:`Search listings`,"aria-label":`Search listings`}),(0,$.jsx)(Rx,{onClick:()=>void s(a.trim()||void 0),children:`Search`})]}),!t&&!r?(0,$.jsx)(zx,{label:`Loading listings`}):null]})}),t?(0,$.jsx)(`div`,{className:`grid grid-three stack-grid`,children:c.length?c.map((e,t)=>(0,$.jsx)($x,{item:e,base:l},`${String(e.outpoint??t)}`)):(0,$.jsx)(`div`,{className:`empty`,children:`No listings found.`})}):null]})}function $x({item:e,base:t}){let n=Vx(Vx(e.data).ordlock),r=String(n.content_type??``),i=String(n.origin??e.outpoint??``),a=r.startsWith(`image/`)&&/^https?:\/\//.test(t);return(0,$.jsxs)(`article`,{className:`ordinal-card`,title:String(e.outpoint??``),children:[(0,$.jsx)(`div`,{className:`ordinal-image`,children:a?(0,$.jsx)(`img`,{src:`${t}/${encodeURIComponent(i)}`,alt:`Inscription preview`,loading:`lazy`}):(0,$.jsx)(`span`,{children:r?r.split(`/`)[1]:`?`})}),(0,$.jsxs)(`div`,{className:`ordinal-info`,children:[(0,$.jsx)(`div`,{className:`ordinal-name`,children:String(n.name??Ux(String(e.outpoint??`inscription`),10))}),(0,$.jsxs)(`div`,{className:`ordinal-meta`,children:[(0,$.jsx)(`span`,{children:r?r.split(`/`)[0]:`unknown`}),n.price==null?null:(0,$.jsxs)(`span`,{children:[Wx(n.price),` sats`]})]})]})]})}function eS({call:e}){let[t,n]=(0,A.useState)(``),r=(0,A.useRef)(``),[i,a]=(0,A.useState)(``),[o,s]=(0,A.useState)(),[c,l]=(0,A.useState)(new Set),[u,d]=(0,A.useState)([]),[f,p]=(0,A.useState)(`input`),[m,h]=(0,A.useState)(),g=(0,A.useMemo)(()=>{if(!o)return[];let e=[],t=Hx(o.funding),n=Hx(o.ordinals);t.length&&e.push({type:`bsv`,name:`BSV funding`,detail:`${t.length} UTXOs`,value:`${(Number(o.totalFundingSats??0)/1e8).toFixed(8)} BSV`,inputs:t}),n.length&&e.push({type:`ordinals`,name:`Ordinals`,detail:`${n.length} inscriptions`,value:`${n.length} NFTs`,inputs:n});for(let t of Hx(o.bsv21Tokens)){let n=String(t.tokenId??``),r=Hx(t.inputs);e.push({type:`bsv21:${n}`,name:`${String(t.symbol??Ux(n,6))} token`,detail:`${r.length} UTXOs`,value:String(t.totalAmount??`0`),inputs:r})}return e},[o]);async function _(){h(void 0);let i=t.trim();try{let t=(/^[0-9a-f]{64}$/i.test(i)?new kr(i,16):kr.fromWif(i)).toPublicKey().toAddress();r.current=i,n(``),a(t),p(`scanning`);let o=await e(`app_sweep_scan`,{address:t});if(o.error)throw Error(String(o.error));s(o),l(new Set(tS(o))),p(`review`)}catch(e){r.current=``,n(``),h(e instanceof Error?e.message:String(e)),p(`error`)}}async function v(){if(!o||!c.size||!r.current)return;p(`working`),h(void 0);let t=[];try{for(let n of g.filter(e=>c.has(e.type))){let i=await e(`app_sweep_prepare`,{sweepType:n.type===`bsv`?`bsv`:n.type===`ordinals`?`ordinals`:`bsv21`,inputs:n.inputs.map(e=>({outpoint:e.outpoint,satoshis:e.satoshis,lockingScript:e.lockingScript}))});if(i.error)throw Error(String(i.error));let a=/^[0-9a-f]{64}$/i.test(r.current)?new kr(r.current,16):kr.fromWif(r.current),o=ua.fromBEEF(tn(String(i.txHex),`hex`)),s=new Set(Hx(i.inputsToSign).map(e=>`${String(e.outpoint).replace(`_`,`.`)}`));for(let e of o.inputs)s.has(`${e.sourceTXID}.${e.sourceOutputIndex}`)&&(e.unlockingScriptTemplate=new Ei().unlock(a,`all`,!0));await o.sign();let c={};o.inputs.forEach((e,t)=>{s.has(`${e.sourceTXID}.${e.sourceOutputIndex}`)&&(c[String(t)]={unlockingScript:e.unlockingScript?.toHex()??``})});let l=await e(`app_sweep_complete`,{reference:i.reference,spends:c});if(l.error)throw Error(String(l.error));t.push({type:n.name,txid:String(l.txid??``)})}r.current=``,d(t),p(`complete`)}catch(e){r.current=``,h(e instanceof Error?e.message:String(e)),p(`error`)}}function y(){r.current=``,n(``),a(``),s(void 0),l(new Set),d([]),h(void 0),p(`input`)}return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Fx,{eyebrow:`sweep`,title:`Import funds`,description:`Scan a key locally, choose the assets to move, and sign in this browser tab.`}),m?(0,$.jsx)(Lx,{tone:`error`,children:m}):null,(0,$.jsxs)(Ix,{children:[(0,$.jsx)(`div`,{className:`surface-header`,children:(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`p`,{className:`section-label`,children:f===`review`?`review`:f===`complete`?`complete`:`private key`}),(0,$.jsx)(`h2`,{children:f===`review`?`Assets at ${Ux(i,8)}`:f===`complete`?`Sweep complete`:`Sweep assets into your wallet`})]})}),(0,$.jsxs)(`div`,{className:`surface-body`,children:[f===`input`||f===`error`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`label`,{className:`field-label`,htmlFor:`sweep-key`,children:[`WIF or 64-character hex`,(0,$.jsx)(`input`,{id:`sweep-key`,className:`field`,type:`password`,value:t,onChange:e=>n(e.target.value),onKeyDown:e=>{e.key===`Enter`&&_()},autoComplete:`new-password`,spellCheck:!1})]}),(0,$.jsx)(`p`,{className:`dim`,children:`The key is used only in this tab and cleared after scanning or sweeping.`}),(0,$.jsx)(`div`,{className:`form-actions`,children:(0,$.jsx)(Rx,{onClick:()=>void _(),disabled:!t.trim(),children:`Scan address`})})]}):null,f===`scanning`||f===`working`?(0,$.jsx)(zx,{label:f===`scanning`?`Scanning ${Ux(i,8)}…`:`Signing and broadcasting selected assets…`}):null,f===`review`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:`role-grid`,children:g.length?g.map(e=>(0,$.jsx)(`button`,{type:`button`,className:c.has(e.type)?`asset-card asset-selected`:`asset-card`,onClick:()=>l(t=>{let n=new Set(t);return n.has(e.type)?n.delete(e.type):n.add(e.type),n}),children:(0,$.jsxs)(`div`,{className:`asset-info`,children:[(0,$.jsxs)(`div`,{className:`asset-name`,children:[c.has(e.type)?`✓ `:``,e.name]}),(0,$.jsxs)(`div`,{className:`ordinal-meta`,children:[(0,$.jsx)(`span`,{children:e.detail}),(0,$.jsx)(`span`,{children:e.value})]})]})},e.type)):(0,$.jsx)(`div`,{className:`empty`,children:`No assets found at this address.`})}),(0,$.jsxs)(`div`,{className:`form-actions`,children:[(0,$.jsx)(Rx,{variant:`secondary`,onClick:y,children:`Back`}),(0,$.jsx)(Rx,{onClick:()=>void v(),disabled:!c.size,children:`Sweep selected`})]})]}):null,f===`complete`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:`data-list`,children:u.map(e=>(0,$.jsx)(Bx,{label:String(e.type),value:(0,$.jsx)(`span`,{className:`mono`,children:Ux(String(e.txid),12)})},`${String(e.type)}:${String(e.txid)}`))}),(0,$.jsx)(`div`,{className:`form-actions`,children:(0,$.jsx)(Rx,{onClick:y,children:`Sweep another key`})})]}):null]})]})]})}function tS(e){let t=[];Hx(e.funding).length&&t.push(`bsv`),Hx(e.ordinals).length&&t.push(`ordinals`);for(let n of Hx(e.bsv21Tokens))t.push(`bsv21:${String(n.tokenId??``)}`);return t}var nS=s();function rS(e,t,n){let r=Math.abs(n)*Math.PI/180;return{width:e*Math.cos(r)+t*Math.sin(r)+12,height:t*Math.cos(r)+e*Math.sin(r)+12}}function iS(e,t){return Math.abs(e.x-t.x)*2<e.width+t.width&&Math.abs(e.y-t.y)*2<e.height+t.height}function aS(e,t,n,r,i){for(let a=0;a<2800;a++){let o=a*2.399963+i,s=Math.sqrt(a/2800)*.52,c={x:e*(.5+Math.cos(o)*s),y:t*(.5+Math.sin(o)*s),...n};if(!(c.x-n.width/2<8||c.x+n.width/2>e-8||c.y-n.height/2<8||c.y+n.height/2>t-8)&&!r.some(e=>iS(c,e)))return c}}function oS(e){if(e.title)return e.title;let t=e.name.replace(/^[^_]+_/,``).replace(/_/g,` `).replace(/([a-z])([A-Z])/g,`$1 $2`).toLowerCase();return(t.charAt(0).toUpperCase()+t.slice(1)).replace(/\b(bsv|bap|mnee|utxo|utxos)\b/gi,e=>e.toUpperCase())}function sS(e,t,n,r,i){let a=document.createElement(`canvas`).getContext(`2d`);if(!a)return;let o=oS(e).split(` `),s=o.length>1&&oS(e).length>10?[o.slice(0,Math.ceil(o.length/2)).join(` `),o.slice(Math.ceil(o.length/2)).join(` `)]:[oS(e)],c=Math.min(t/760,n/600,1.25),l=[0,-7,5,-3,8,0,-5,4][i%8];for(let o of[1,.85,.7]){let u=Math.max(15,[100,66,52,58,43,48,36,42,32,38,30,34][i%12]*c*o);a.font=`${u}px "Geist Pixel Line"`;let d=aS(t,n,rS(Math.max(...s.map(e=>a.measureText(e).width)),s.length*u*1.03,l),r,i*1.37);if(d)return{...d,tool:e,lines:s,size:u,angle:l}}}function cS({tools:e}){let t=(0,A.useRef)(null),[n,r]=(0,A.useState)([]),[i,a]=(0,A.useState)(),[o,s]=(0,A.useState)(!1),c=(0,A.useRef)({width:0,height:0}),l=(0,A.useRef)(0);return(0,A.useLayoutEffect)(()=>{let n=t.current;if(!n)return;let i=()=>{let t=n.clientWidth,i=n.clientHeight;if(t===c.current.width&&i===c.current.height)return;c.current={width:t,height:i};let o=[],s=[...e??[]].sort((e,t)=>Number(/^send bsv$/i.test(oS(t)))-Number(/^send bsv$/i.test(oS(e))));for(let e of s){let n=sS(e,t,i,o,o.length);if(n&&o.push(n),o.length===12)break}r(o),a(void 0)};c.current={width:0,height:0};let o=!1,s=new ResizeObserver(i);return document.fonts.load(`30px "Geist Pixel Line"`).catch(()=>[]).then(()=>{o||(i(),s.observe(n))}),()=>{o=!0,s.disconnect()}},[e]),(0,A.useEffect)(()=>{if(o||!e?.length)return;let t,n=setInterval(()=>{document.hidden||window.matchMedia(`(prefers-reduced-motion: reduce)`).matches||(r(e=>{if(e.length<2)return e;let t=1+Math.floor(Math.random()*(e.length-1));return e.map((e,n)=>({...e,exiting:n===t||l.current%3==2&&n===t+1}))}),t=setTimeout(()=>{r(t=>{let n=t.filter(e=>e.exiting).map(e=>e.tool.name),r=t.filter(e=>!e.exiting),i=e.filter(e=>!r.some(t=>t.tool.name===e.name)&&!n.includes(e.name)).sort(()=>Math.random()-.5);for(let e of i){let t=sS(e,c.current.width,c.current.height,r,1+l.current++%11);if(t&&r.push(t),r.length>=12)break}return r})},650))},3200);return()=>{clearInterval(n),clearTimeout(t),r(e=>e.map(e=>({...e,exiting:!1})))}},[e,o]),(0,$.jsxs)(`section`,{className:`tool-cloud-section`,"aria-label":`Explore your wallet tools`,children:[(0,$.jsxs)(`svg`,{className:`cloud-orbits`,viewBox:`0 0 760 650`,fill:`none`,"aria-hidden":`true`,children:[(0,$.jsx)(`ellipse`,{cx:`380`,cy:`325`,rx:`365`,ry:`220`,transform:`rotate(-16 380 325)`}),(0,$.jsx)(`ellipse`,{cx:`380`,cy:`325`,rx:`365`,ry:`170`,transform:`rotate(22 380 325)`}),(0,$.jsx)(`circle`,{cx:`110`,cy:`160`,r:`4`}),(0,$.jsx)(`circle`,{cx:`660`,cy:`450`,r:`6`}),(0,$.jsx)(`circle`,{cx:`230`,cy:`570`,r:`3`})]}),(0,$.jsx)(`ul`,{ref:t,className:`tool-cloud`,"aria-label":`Available MCP tools`,onMouseEnter:()=>s(!0),onMouseLeave:e=>{e.currentTarget.contains(document.activeElement)||(s(!1),a(void 0))},onFocus:()=>s(!0),onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||(s(!1),a(void 0))},onKeyDown:e=>{e.key===`Escape`&&a(void 0)},children:n.map(e=>(0,$.jsx)(`li`,{className:e.exiting?`is-fading`:``,style:{left:e.x,top:e.y},children:(0,$.jsx)(`button`,{type:`button`,className:`tool-cloud-word tool-cloud-weight-${Math.round(e.size)%5}`,style:{fontSize:e.size,transform:`rotate(${e.angle}deg)`},"aria-describedby":i?.tool.name===e.tool.name?`tool-cloud-popover`:void 0,onMouseEnter:t=>a({tool:e.tool,rect:t.currentTarget.getBoundingClientRect()}),onMouseLeave:()=>a(void 0),onFocus:t=>a({tool:e.tool,rect:t.currentTarget.getBoundingClientRect()}),onClick:t=>a({tool:e.tool,rect:t.currentTarget.getBoundingClientRect()}),children:e.lines.map(e=>(0,$.jsx)(`span`,{children:e},e))})},e.tool.name))}),i&&(0,nS.createPortal)((0,$.jsxs)(`div`,{id:`tool-cloud-popover`,role:`tooltip`,className:`tool-cloud-popover`,style:{left:Math.max(12,Math.min(window.innerWidth-292,i.rect.left+i.rect.width/2-140)),...i.rect.top>window.innerHeight/2?{bottom:window.innerHeight-i.rect.top+12}:{top:i.rect.bottom+12}},children:[(0,$.jsx)(`strong`,{children:oS(i.tool)}),(0,$.jsx)(`code`,{children:i.tool.name}),(0,$.jsx)(`p`,{children:i.tool.description||`Available in your MCP client.`})]}),document.body)]})}function lS({tools:e}){return(0,$.jsxs)(`div`,{className:`wallet-ready`,children:[(0,$.jsxs)(`div`,{className:`ready-copy`,children:[(0,$.jsx)(`span`,{className:`ready-check`,"aria-hidden":`true`,children:`✓`}),(0,$.jsx)(`p`,{className:`ready-eyebrow`,children:`Setup complete`}),(0,$.jsxs)(`h1`,{children:[`Your wallet.`,(0,$.jsx)(`br`,{}),`Ready for anything.`]}),(0,$.jsxs)(`p`,{className:`ready-description`,children:[`Your keys are encrypted in your local Vault.`,(0,$.jsx)(`br`,{}),`Return to your MCP client to get started.`]})]}),(0,$.jsx)(cS,{tools:e})]})}function uS(e){if(e.length===0)return`Enter a Vault password.`;if(e.length<12)return`Use at least 12 characters.`;if(/^\s+$/u.test(e))return`The password cannot be only spaces.`;let t=[/[a-z]/u.test(e),/[A-Z]/u.test(e),/[0-9]/u.test(e),/[^A-Za-z0-9]/u.test(e)].filter(Boolean).length;if(e.length<16&&t<3)return`Use at least 16 characters, or mix upper, lower, and digits.`}function dS(e){if(e.location===`mcp-client`)return{title:e.serverName||e.account,origin:`Saved in ${e.client??`an MCP client`}`,detail:`A payment key is still in that client’s MCP config. Import it into Vault, then remove the key from the client config.`};if(e.location===`environment`)return{title:`MCP environment payment key`,origin:`Current MCP server environment`,detail:`A payment key is in the server environment. Import it into Vault and remove PRIVATE_KEY_WIF from the client config.`};let t=e.location===`legacy-root`?`Earlier BSV MCP wallet`:e.location===`account`?`BSV MCP account`:`Configured wallet`;return{title:e.account,origin:t,detail:e.encryptedBackup?`An encrypted key backup was found. You’ll need its password.`:e.plaintextKeys?`An unencrypted ${e.keyFile??`key`} file was found. Importing will add an encrypted copy to Vault.`:`Wallet data was found, but no key backup. This source cannot be imported on its own.`}}function fS({token:e,onWelcome:t,onUnlock:n,standalone:r=!1}){let[i,a]=(0,A.useState)([]),[o,s]=(0,A.useState)(),[c,l]=(0,A.useState)(),[u,d]=(0,A.useState)(),[f,p]=(0,A.useState)(`imported-wallet`),[m,h]=(0,A.useState)(``),[g,_]=(0,A.useState)(``),[v,y]=(0,A.useState)(``),[b,ee]=(0,A.useState)(!1),[te,x]=(0,A.useState)(!0),[ne,S]=(0,A.useState)(!1),[re,C]=(0,A.useState)(!1),[ie,ae]=(0,A.useState)(``),[oe,se]=(0,A.useState)(0),[ce,le]=(0,A.useState)(``),[ue,de]=(0,A.useState)();(0,A.useEffect)(()=>{e&&fetch(`/api/inventory?revision=${oe}`,{headers:{Authorization:`Bearer ${e}`}}).then(async e=>{if(!e.ok)throw Error(`Could not inspect your wallets. Reopen setup and try again.`);return e.json()}).then(e=>{let t=e.boundAccounts??[];a(t),s((e.sources??[]).filter(e=>e.location!==`account`||!t.some(t=>t.name===e.account)))}).catch(e=>le(e.message))},[e,oe]);function fe(){l(void 0),d(void 0),ee(!1),h(``),_(``),y(``),le(``)}async function pe(t){if(t.preventDefault(),ne||!b||!c&&!u)return;let n=uS(g);if(n){le(n);return}if(g!==v){le(`The Vault passwords don’t match.`);return}if(u&&u.size>1048576){le(`Choose a key backup smaller than 1 MB.`);return}S(!0),le(``);try{let t=await fetch(`/api/embedded/import`,{method:`POST`,headers:{Authorization:`Bearer ${e}`,"Content-Type":`application/json`},body:JSON.stringify({source:c,accountName:f,activate:!1,sourcePassphrase:m,destinationPassphrase:g,passwordConfirmation:v,confirmation:`IMPORT_WALLET_CONFIRMED`,eraseSources:te,...u?{backupText:await u.text(),backupName:u.name}:{}})}),n=await t.json();if(!t.ok)throw Error(n.error||`The wallet could not be imported.`);if(n.saved===!0&&n.ready===!1){fe(),ae(n.accountName),se(e=>e+1);return}if(n.ready!==!0)throw Error(`The wallet was saved, but could not be activated. Reopen setup to unlock it.`);h(``),_(``),y(``),de(n.tools),C(!0)}catch(e){le(e instanceof Error?e.message:`The wallet could not be imported.`)}finally{S(!1)}}return re&&!r?(0,$.jsx)(Px,{navigation:!1,children:(0,$.jsx)(lS,{tools:ue})}):(0,$.jsxs)(Px,{navigation:!1,children:[(0,$.jsx)(Fx,{eyebrow:`Existing wallet`,title:re?r?`Your wallet is saved`:`Your wallet is ready`:`Bring your wallet with you`,description:re?r?`Your keys are protected in your local Vault.`:`Your keys are protected in your local Vault and your wallet is available in this session.`:`Choose a wallet found on this computer, or browse for a key backup.`}),ce&&(0,$.jsx)(Lx,{tone:`error`,children:ce}),ie&&(0,$.jsxs)(Lx,{tone:`success`,children:[ie,` is saved in your Vault. Import another wallet below, or choose your default keys to continue.`]}),re?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Lx,{tone:`success`,children:r?`Open wallet setup in your MCP client to unlock and use your saved wallet.`:`Return to your MCP client to use your wallet.`}),!r&&(0,$.jsx)(cS,{tools:ue})]}):!c&&!u?(0,$.jsx)(Ix,{children:(0,$.jsxs)(`div`,{className:`surface-body`,children:[(0,$.jsx)(`h2`,{children:`Choose your wallet`}),i.map(e=>(0,$.jsxs)(`button`,{className:`setup-choice wallet-source-choice`,type:`button`,onClick:()=>n(e.name),children:[(0,$.jsx)(`strong`,{children:e.name}),(0,$.jsx)(`span`,{children:`Saved in your Vault · choose default keys`})]},e.name)),o===void 0?(0,$.jsx)(`p`,{children:`Looking for local wallets…`}):o.length===0?(0,$.jsx)(`p`,{children:`No additional local wallets were found. You can choose a backup below.`}):o.map(e=>{let t=dS(e);return(0,$.jsxs)(`button`,{type:`button`,className:`setup-choice wallet-source-choice`,onClick:()=>{l(e),p(e.account),le(``)},children:[(0,$.jsx)(`strong`,{children:t.title}),(0,$.jsx)(`span`,{children:t.origin}),(0,$.jsx)(`span`,{children:t.detail}),(e.configPath||e.directory)&&(0,$.jsx)(`span`,{children:e.configPath||e.directory})]},`${e.location}:${e.account}`)}),(0,$.jsxs)(`label`,{className:`field-label`,children:[`Browse for a key backup`,(0,$.jsx)(`input`,{className:`field`,type:`file`,disabled:ne,accept:`.bep,.json`,onChange:e=>{d(e.target.files?.[0]),l(void 0),le(``)}})]}),(0,$.jsx)(Rx,{variant:`secondary`,onClick:t,children:`Back`})]})}):(0,$.jsx)(Ix,{children:(0,$.jsxs)(`div`,{className:`surface-body`,children:[(0,$.jsx)(`h2`,{children:`Protect and import`}),(0,$.jsx)(`p`,{children:u?.name||c?.account}),c&&!c.encryptedBackup&&!c.plaintextKeys&&(0,$.jsx)(Lx,{children:`These databases contain wallet records. Select the matching key backup to recover signing access.`}),(0,$.jsxs)(`form`,{className:`stack-surface`,onSubmit:pe,children:[c&&!c.encryptedBackup&&!c.plaintextKeys&&(0,$.jsxs)(`label`,{className:`field-label`,children:[`Matching key backup`,(0,$.jsx)(`input`,{className:`field`,required:!0,type:`file`,disabled:ne,accept:`.bep,.json`,onChange:e=>d(e.target.files?.[0])})]}),(0,$.jsxs)(`label`,{className:`field-label`,children:[`Wallet name`,(0,$.jsx)(`input`,{className:`field`,required:!0,value:f,onChange:e=>p(e.target.value),disabled:ne||!!c})]}),(0,$.jsxs)(`label`,{className:`field-label`,children:[`Backup password, if encrypted`,(0,$.jsx)(`input`,{className:`field`,type:`password`,autoComplete:`off`,value:m,onChange:e=>h(e.target.value),disabled:ne})]}),(0,$.jsxs)(`label`,{className:`field-label`,children:[`Vault password`,(0,$.jsx)(`input`,{className:`field`,required:!0,type:`password`,autoComplete:`new-password`,minLength:8,value:g,onChange:e=>_(e.target.value),disabled:ne})]}),(0,$.jsx)(`p`,{children:`Use your existing Vault password, or choose one if this is your first wallet.`}),(0,$.jsxs)(`label`,{className:`field-label`,children:[`Confirm Vault password`,(0,$.jsx)(`input`,{className:`field`,required:!0,type:`password`,autoComplete:`new-password`,value:v,onChange:e=>y(e.target.value),disabled:ne})]}),(0,$.jsxs)(`label`,{className:`checkbox-field`,children:[(0,$.jsx)(`input`,{required:!0,type:`checkbox`,checked:b,onChange:e=>ee(e.target.checked),disabled:ne}),` `,`Import this wallet into my local encrypted Vault.`]}),c?.plaintextKeys||c?.location===`mcp-client`?(0,$.jsxs)(`label`,{className:`checkbox-field`,children:[(0,$.jsx)(`input`,{type:`checkbox`,checked:te,onChange:e=>x(e.target.checked),disabled:ne}),` `,`After import, overwrite and remove the plaintext copy that was imported. This cannot erase SSD snapshots or other backups.`]}):null,(0,$.jsxs)(`div`,{className:`form-actions`,children:[(0,$.jsx)(Rx,{variant:`secondary`,type:`button`,onClick:fe,disabled:ne,children:`Back`}),(0,$.jsx)(Rx,{type:`submit`,disabled:ne||!b,children:ne?`Importing…`:`Import wallet`})]})]})]})})]})}function pS({token:e,onLinked:t}){let[n,r]=(0,A.useState)(``),[i,a]=(0,A.useState)(),[o,s]=(0,A.useState)(``),[c,l]=(0,A.useState)(`vault-key`),[u,d]=(0,A.useState)(``),[f,p]=(0,A.useState)(!1);async function m(){if(!f){p(!0),d(``);try{let l=i?.keys.find(e=>e.entryId===o);if(i&&!l)throw Error(`Choose a private key.`);let u=await fetch(i?`/api/embedded/link-key`:`/api/embedded/vault-keys`,{method:`POST`,headers:{Authorization:`Bearer ${e}`,"Content-Type":`application/json`},body:JSON.stringify(i?{password:n,accountName:c,vaultId:i.vaultId,entryId:l?.entryId,publicKey:l?.publicKey}:{password:n})}),d=await u.json();if(!u.ok)throw Error(d.error||`Could not open the Vault.`);i?(r(``),a(void 0),t()):(a(d),s(d.keys[0]?.entryId??``))}catch(e){d(e instanceof Error?e.message:`Could not use this key.`)}finally{p(!1)}}}return(0,$.jsx)(Ix,{children:(0,$.jsxs)(`div`,{className:`surface-body`,children:[(0,$.jsx)(`h2`,{children:`Use a key already in your Vault`}),(0,$.jsx)(`p`,{children:`Link an existing private key to a new wallet account, then assign it to a role. This does not import another wallet’s transaction history.`}),u&&(0,$.jsx)(Lx,{tone:`error`,children:u}),i?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`label`,{className:`field-label`,children:[`Private key`,(0,$.jsx)(`select`,{className:`field`,value:o,onChange:e=>s(e.target.value),disabled:f,children:i.keys.map(e=>(0,$.jsxs)(`option`,{value:e.entryId,children:[e.label,` · `,e.publicKey.slice(-8)]},e.entryId))})]}),!i.keys.length&&(0,$.jsx)(Lx,{children:`No compatible private keys found. HD roots and non-key entries cannot be used directly.`}),(0,$.jsxs)(`label`,{className:`field-label`,children:[`Account name`,(0,$.jsx)(`input`,{className:`field`,value:c,onChange:e=>l(e.target.value),disabled:f})]})]}):(0,$.jsxs)(`label`,{className:`field-label`,children:[`Vault password`,(0,$.jsx)(`input`,{className:`field`,type:`password`,autoComplete:`off`,value:n,onChange:e=>r(e.target.value),disabled:f})]}),(0,$.jsx)(`div`,{className:`form-actions`,children:(0,$.jsx)(Rx,{onClick:m,disabled:f||!n||!!i&&!o,children:f?`Please wait…`:i?`Link selected key`:`Show Vault keys`})})]})})}var mS=[{id:`payments`,label:`Payment key`},{id:`identity`,label:`Identity key`},{id:`ordinals`,label:`Ordinals key`}];function hS({token:e,onBack:t,onUnlock:n}){let[r,i]=(0,A.useState)(),[a,o]=(0,A.useState)({}),[s,c]=(0,A.useState)(``),[l,u]=(0,A.useState)(!1),[d,f]=(0,A.useState)(!1),[p,m]=(0,A.useState)(0);(0,A.useEffect)(()=>{fetch(`/api/embedded/roles`,{headers:{Authorization:`Bearer ${e}`}}).then(async e=>{if(!e.ok)throw Error(`Could not load key settings.`);let t=await e.json();i(t),o({payments:t.defaults.payments??t.keys[0]?.selector??null,identity:t.defaults.identity===void 0?void 0:t.defaults.identity,ordinals:t.defaults.ordinals===void 0?void 0:t.defaults.ordinals})}).catch(e=>c(e.message))},[e,p]);async function h(){if(r&&!l){u(!0),c(``);try{let t=await fetch(`/api/embedded/roles`,{method:`POST`,headers:{Authorization:`Bearer ${e}`,"Content-Type":`application/json`},body:JSON.stringify({defaults:a,revision:r.revision})});if(!t.ok)throw Error(`Could not save key settings. Reload and try again.`);let o=await t.json();if(i(o),!o.effective.payments)throw Error(`Select a payment key to continue.`);n(o.effective.payments.split(`:`)[0])}catch(e){c(e instanceof Error?e.message:`Could not save settings.`)}finally{u(!1)}}}return(0,$.jsxs)(Px,{navigation:!1,children:[(0,$.jsx)(Fx,{eyebrow:`Your Vault`,title:`Choose your default keys`,description:`Keep all your keys in one Vault. Choose which key each role uses; project MCP settings can override individual roles.`}),s&&(0,$.jsx)(Lx,{tone:`error`,children:s}),d?(0,$.jsx)(pS,{token:e,onLinked:()=>{f(!1),m(e=>e+1)}}):(0,$.jsx)(Rx,{variant:`secondary`,onClick:()=>f(!0),children:`Choose another key from Vault`}),(0,$.jsx)(Ix,{children:(0,$.jsxs)(`div`,{className:`surface-body`,children:[(0,$.jsx)(`p`,{children:`Import several wallets before unlocking. Choosing a default does not move keys or funds.`}),mS.map(e=>(0,$.jsxs)(`label`,{className:`field-label`,children:[e.label,(0,$.jsxs)(`select`,{className:`field`,value:a[e.id]===void 0?`inherit`:a[e.id]??``,disabled:!r||l,onChange:t=>o({...a,[e.id]:t.target.value===`inherit`?void 0:t.target.value||null}),children:[e.id!==`payments`&&(0,$.jsx)(`option`,{value:`inherit`,children:`Use payment key`}),(0,$.jsx)(`option`,{value:``,children:e.id===`payments`?`Choose a key`:`Disabled`}),r?.keys.map(e=>(0,$.jsxs)(`option`,{value:e.selector,children:[e.selector,` · `,e.publicKey.slice(-8)]},e.selector))]}),r?.overrides.includes(e.id)&&(0,$.jsxs)(`span`,{className:`source-detail`,children:[`Project configuration overrides this role:`,` `,r.effective[e.id]??`disabled`,`.`]})]},e.id)),(0,$.jsxs)(`div`,{className:`form-actions`,children:[(0,$.jsx)(Rx,{variant:`secondary`,onClick:t,disabled:l,children:`Import more wallets`}),(0,$.jsx)(Rx,{onClick:h,disabled:!r||l,children:`Save defaults and unlock`})]})]})})]})}function gS({token:e,standalone:t=!1}){let[n,r]=(0,A.useState)(`welcome`),[i,a]=(0,A.useState)([]),[o,s]=(0,A.useState)(`default`),[c,l]=(0,A.useState)(``),[u,d]=(0,A.useState)(``),[f,p]=(0,A.useState)(!1),[m,h]=(0,A.useState)(``),[g,_]=(0,A.useState)(),[v,y]=(0,A.useState)(!1),[b,ee]=(0,A.useState)(!1),[te,x]=(0,A.useState)(!1);(0,A.useEffect)(()=>{e&&fetch(`/api/inventory`,{headers:{Authorization:`Bearer ${e}`}}).then(e=>e.ok?e.json():void 0).then(e=>{e?.sources?.length&&s(`new-wallet`),a(e?.boundAccounts??[]),y(e?.vaultExists===!0),x(Array.isArray(e?.sources)&&e.sources.some(e=>e.location===`mcp-client`||e.location===`environment`))}).catch(()=>{})},[e]);function ne(e){f||b||(r(e),window.history.pushState({view:e},``,`/setup/source?mode=migration&view=${e}`))}(0,A.useEffect)(()=>{let e=()=>{if(f||b){window.history.replaceState({view:n},``,`/setup/source?mode=migration&view=${n}`);return}let e=window.history.state?.view;r(e===`create`||e===`existing`||e===`unlock`||e===`roles`?e:`welcome`),l(``),d(``),h(``)};return window.addEventListener(`popstate`,e),()=>window.removeEventListener(`popstate`,e)},[f,b,n]);function S(){l(``),d(``),h(``),ne(`welcome`)}async function re(t){if(t.preventDefault(),!f){if(n===`unlock`){if(!c){h(`Enter your Vault password.`);return}}else{let e=uS(c);if(e){h(e);return}}if(n!==`unlock`&&c!==u){h(`The passwords don’t match. Try again.`);return}p(!0),h(``);try{let t=await fetch(n===`unlock`?`/api/embedded/unlock`:`/api/embedded/create`,{method:`POST`,headers:{Authorization:`Bearer ${e}`,"Content-Type":`application/json`},body:JSON.stringify({accountName:o,activate:!1,password:c,passwordConfirmation:u,confirmation:`CREATE_NEW_CONFIRMED`})}),i=await t.json();if(!t.ok)throw Error(i.error||`Your wallet could not be created. Please try again.`);if(l(``),d(``),i.saved===!0){r(`roles`),window.history.pushState({view:`roles`},``,`/setup/source?mode=migration&view=roles`);return}if(i.ready!==!0)throw Error(`Your wallet was saved, but could not be activated. Reopen setup to unlock it.`);_(i.tools),ee(!0)}catch(e){h(e instanceof Error?e.message:`Your wallet could not be created.`)}finally{p(!1)}}}return e?n===`roles`?(0,$.jsx)(hS,{token:e,onBack:()=>ne(`existing`),onUnlock:e=>{s(e),ne(`unlock`)}}):n===`existing`?(0,$.jsx)(fS,{token:e,standalone:t,onWelcome:S,onUnlock:()=>ne(`roles`)}):b&&!t?(0,$.jsx)(Px,{navigation:!1,children:(0,$.jsx)(lS,{tools:g})}):(0,$.jsxs)(Px,{navigation:!1,children:[(0,$.jsx)(Fx,{eyebrow:b?`Wallet saved`:n===`welcome`?`Welcome`:n===`unlock`?`Saved wallet`:`New wallet`,title:b?t?`Your wallet is saved`:`Your wallet is ready`:n===`welcome`?`Your wallet starts here`:n===`unlock`?`Unlock your wallet`:`Make it yours`,description:b?`Your keys are saved in your encrypted local Vault.`:n===`welcome`?`Start fresh, or bring a wallet you already use.`:n===`unlock`?`Enter your Vault password to use your wallet in this session.`:v?`Give your new wallet a name and enter your existing Vault password.`:`Give your wallet a name and choose a password to protect it.`}),b?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Lx,{tone:`success`,children:t?`Open wallet setup in your MCP client to unlock and use your saved wallet.`:`Your wallet is ready to use. Return to your MCP client to continue.`}),!t&&(0,$.jsx)(cS,{tools:g})]}):n===`welcome`?(0,$.jsxs)(`div`,{className:`setup-choices`,children:[te?(0,$.jsx)(Lx,{children:`A payment key is still in an MCP client config. Choose “Use an existing wallet” to import it into Vault.`}):null,(i.length>0||v)&&(0,$.jsx)(Rx,{onClick:()=>ne(`roles`),children:`Choose default keys`}),(0,$.jsxs)(`button`,{type:`button`,className:`setup-choice`,onClick:()=>ne(`create`),children:[(0,$.jsx)(`span`,{className:`choice-icon`,"aria-hidden":`true`,children:`+`}),(0,$.jsxs)(`span`,{children:[(0,$.jsx)(`strong`,{children:`Create a new wallet`}),(0,$.jsx)(`span`,{children:`Get a fresh wallet, protected by your password.`})]}),(0,$.jsx)(`span`,{className:`choice-arrow`,"aria-hidden":`true`,children:`→`})]}),(0,$.jsxs)(`button`,{type:`button`,className:`setup-choice`,onClick:()=>ne(`existing`),children:[(0,$.jsx)(`span`,{className:`choice-icon`,"aria-hidden":`true`,children:`↗`}),(0,$.jsxs)(`span`,{children:[(0,$.jsx)(`strong`,{children:`Use an existing wallet`}),(0,$.jsx)(`span`,{children:`Bring your existing keys and account with you.`})]}),(0,$.jsx)(`span`,{className:`choice-arrow`,"aria-hidden":`true`,children:`→`})]}),(0,$.jsx)(`p`,{className:`setup-reassurance`,children:`Your keys stay on this computer, encrypted in your Vault.`})]}):(0,$.jsx)(Ix,{children:(0,$.jsxs)(`form`,{className:`surface-body`,onSubmit:re,children:[(0,$.jsxs)(`label`,{className:`field-label`,htmlFor:`wallet-name`,children:[`Wallet name`,(0,$.jsx)(`input`,{id:`wallet-name`,className:`field`,value:o,onChange:e=>s(e.target.value),autoComplete:`off`,pattern:`[a-z0-9][a-z0-9_-]{0,63}`,required:!0,disabled:f||n===`unlock`})]}),(0,$.jsxs)(`label`,{className:`field-label`,htmlFor:`new-password`,children:[`Password`,(0,$.jsx)(`input`,{id:`new-password`,className:`field`,type:`password`,value:c,onChange:e=>l(e.target.value),autoComplete:`new-password`,minLength:8,required:!0,disabled:f}),(0,$.jsx)(`span`,{className:`source-detail`,children:v?`Use the password for your existing Vault.`:`Use at least 12 characters, or 16+ as a passphrase. On this Mac, Touch ID can wrap the Vault as well. Keep the recovery password somewhere safe.`})]}),n!==`unlock`&&(0,$.jsxs)(`label`,{className:`field-label`,htmlFor:`confirm-password`,children:[`Confirm password`,(0,$.jsx)(`input`,{id:`confirm-password`,className:`field`,type:`password`,value:u,onChange:e=>d(e.target.value),autoComplete:`new-password`,required:!0,disabled:f})]}),m?(0,$.jsx)(`div`,{className:`stack-surface`,children:(0,$.jsx)(Lx,{tone:`error`,children:m})}):null,(0,$.jsxs)(`div`,{className:`form-actions`,children:[(0,$.jsx)(Rx,{variant:`secondary`,onClick:S,disabled:f,children:`Back`}),(0,$.jsx)(Rx,{type:`submit`,disabled:f,"aria-busy":f,children:f?`Please wait…`:n===`unlock`?`Unlock wallet`:`Create wallet`})]})]})})]}):(0,$.jsx)(Px,{navigation:!1,children:(0,$.jsx)(Fx,{eyebrow:`Setup connection`,title:`Reopen wallet setup`,description:`Open wallet setup from your MCP client to start a private local session.`})})}var _S=[`identity-signing`,`payments`,`one-sat`,`encryption`],vS=[`source`,`destination`,`unlock`,`review`],yS=`migration`,bS=new Set(`token.setuptoken.setup_token.passphrase.sourcepassphrase.source_passphrase.destinationpassphrase.destination_passphrase.password.passwd.session.sessionid.session_id.secret.privatekey.private_key.wif.mnemonic.auth.authorization.accesstoken.access_token.refreshtoken.refresh_token.idtoken.id_token.apikey.api_key`.split(`.`));function xS(e){return vS.indexOf(e)}function SS(e){if(typeof e!=`string`)return null;switch(e.length>1&&e.endsWith(`/`)?e.slice(0,-1):e){case`/setup/source`:return`source`;case`/setup/destination`:return`destination`;case`/setup/unlock`:return`unlock`;case`/setup/review`:return`review`;default:return null}}function CS(e){try{return new URLSearchParams(e).get(`mode`)===yS}catch{return!1}}function wS(e,t){let n=xS(e),r=xS(t);return n!==-1&&r!==-1&&n<=r}function TS(e,t,n){if(!CS(t))return`source`;let r=SS(e);return r===null?`source`:wS(r,n)?r:n}function ES(e,t){let n=new URLSearchParams(t);for(let e of[...n.keys()])bS.has(e.toLowerCase())&&n.delete(e);n.set(`mode`,yS);let r=n.toString();return`/setup/${e}${r?`?${r}`:``}`}function DS(){return{pathname:window.location.pathname,search:window.location.search}}function OS(e){let{maxStep:t,busy:n}=e,[r,i]=(0,A.useState)(`source`),a=(0,A.useRef)(`source`),o=(0,A.useRef)(t),s=(0,A.useRef)(n);return(0,A.useEffect)(()=>{a.current=r,o.current=t,s.current=n}),(0,A.useEffect)(()=>{if(typeof window>`u`)return;let e=DS(),t=TS(e.pathname,e.search,o.current);a.current=t,i(t),window.history.replaceState(null,``,ES(t,e.search))},[]),(0,A.useEffect)(()=>{if(typeof window>`u`)return;let e=()=>{let e=a.current,t=DS();if(s.current){window.history.replaceState(null,``,ES(e,t.search));return}let n=TS(t.pathname,t.search,o.current);n!==e&&(a.current=n,i(n));let r=ES(n,t.search);`${t.pathname}${t.search}`!==r&&window.history.replaceState(null,``,r)};return window.addEventListener(`popstate`,e),()=>window.removeEventListener(`popstate`,e)},[]),(0,A.useEffect)(()=>{typeof window>`u`||wS(r,t)||(a.current=t,i(t),window.history.replaceState(null,``,ES(t,window.location.search)))},[t,r]),{step:r,goToStep:(0,A.useCallback)(e=>{typeof window>`u`||n||wS(e,t)&&e!==r&&(i(e),a.current=e,window.history.pushState(null,``,ES(e,window.location.search)))},[n,t,r])}}var kS={"identity-signing":`Identity signing`,payments:`Payments`,"one-sat":`OneSat assets`,encryption:`Encryption`};function AS(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}function jS(e){return e instanceof Error?e.message:String(e)}function MS({token:e,onWelcome:t}){let[n,r]=(0,A.useState)(),[i,a]=(0,A.useState)(),[o,s]=(0,A.useState)(),[c,l]=(0,A.useState)(),[u,d]=(0,A.useState)(),[f,p]=(0,A.useState)(),[m,h]=(0,A.useState)({}),[g,_]=(0,A.useState)(``),[v,y]=(0,A.useState)(``),[b,ee]=(0,A.useState)(``),[te,x]=(0,A.useState)(`Inspecting local setup…`),[ne,S]=(0,A.useState)(),[re,C]=(0,A.useState)(!1),[ie,ae]=(0,A.useState)(),[oe,se]=(0,A.useState)(),{step:ce,goToStep:le}=OS({maxStep:f?`review`:c?`unlock`:o?`destination`:`source`,busy:ie!==void 0}),[ue,de]=(0,A.useState)();(0,A.useEffect)(()=>{ue&&ie===void 0&&(le(ue),de(void 0))},[ue,ie,le]);function fe(){_(``),y(``),se(void 0);let e=vS.indexOf(ce);e>0&&le(vS[e-1])}let pe=(0,A.useCallback)(async(t,n={})=>{let r=await fetch(t,{...n,headers:{Authorization:`Bearer ${e}`,...n.body?{"Content-Type":`application/json`}:{},...n.headers}}),i=null;try{i=await r.json()}catch{}if(!r.ok){let e=AS(i),t=Error(typeof e.error==`string`?e.error:`Local setup request failed`);throw Object.assign(t,{noEffect:e.noEffect===!0}),t}return AS(i)},[e]);(0,A.useEffect)(()=>{if(!e){S(`This setup link is missing its local authorization token. Reopen it from BSV MCP.`);return}Promise.all([pe(`/api/inventory`),pe(`/api/migration/capabilities`)]).then(([e,t])=>{r(e),a(t),x(`Select a source to begin the local migration.`)}).catch(e=>S(jS(e)))},[pe,e]);function me(e){ie===void 0&&(s(e),de(`destination`),l(void 0),d(void 0),p(void 0),h({}),ee(``),S(void 0),se(void 0),x(`Source selected: ${e.account}. Choose a Vault destination.`))}function he(e){e.preventDefault(),o&&i?.destinationDefaults&&(l({accountName:o.account,vaultPath:i.destinationDefaults.vaultPath,vaultEntryId:`new`}),de(`unlock`),ee(``),p(void 0),h({}),S(void 0),se(void 0),x(`Destination selected. Unlock the Vault locally to preview preservation.`))}async function ge(e){if(e.preventDefault(),!o||!c||!i?.available)return;let t=g,n=v;if(_(``),y(``),ee(``),!t.trim()&&!n.trim()){se(`Enter the source backup passphrase or the destination Vault passphrase to unlock locally.`),x(`Action needs attention. Enter at least one passphrase.`);return}se(void 0),ae(`unlock`),S(void 0),C(!1),x(`Unlocking locally…`);try{let e=await pe(`/api/migration/unlock`,{method:`POST`,body:JSON.stringify({source:o,destination:c,sourcePassphrase:t,destinationPassphrase:n||void 0})});d(e.session),de(`review`),p(e.preview),h(BS(e.preview)),x(`Preview ready. Review preservation before cutover.`)}catch(e){_e(e)}finally{_(``),y(``),ae(void 0)}}function _e(e){let t=e;S(jS(e)),C(t?.noEffect===!0),x(`Action needs attention.`)}async function ve(){if(_(``),y(``),ee(``),se(void 0),!u){x(`Unlock fields cleared.`);return}ae(`lock`);try{await pe(`/api/migration/lock`,{method:`POST`,body:JSON.stringify({sessionId:u.sessionId})}),d(void 0),p(void 0),h({}),x(`Vault session locked. Unlock again locally to continue.`)}catch(e){_e(e)}finally{ae(void 0)}}async function ye(){if(u){ae(`refresh`);try{let e=await pe(`/api/migration/preview`,{method:`POST`,body:JSON.stringify({sessionId:u.sessionId})});p(e.preview),h(BS(e.preview)),ee(``),S(void 0),x(`Preview refreshed. Review it before trying the cutover again.`)}catch(e){_e(e)}finally{ae(void 0)}}}async function be(e,t){if(u&&[`keep-existing`,`import-source`,`skip`].includes(t)){ae(`resolve:${e}`);try{let n=(await pe(`/api/migration/resolve`,{method:`POST`,body:JSON.stringify({sessionId:u.sessionId,conflictId:e,resolution:t})})).preview;p(n),h(BS(n)),ee(``),S(void 0),x(`Conflict resolution saved. Review the updated preservation preview.`)}catch(e){_e(e)}finally{ae(void 0)}}}async function xe(){if(u){ae(`reconcile`);try{let e=await pe(`/api/migration/reconcile`,{method:`POST`,body:JSON.stringify({sessionId:u.sessionId})});e.phase===`destination`?(d(void 0),p(void 0),h({}),ee(``),x(`Backend confirmed the source is safe to retry. Unlock again locally.`)):e.phase===`complete`?(ee(``),x(`Vault cutover complete and verified.`)):x(`Cutover status is still unknown. Keep the source and backup until reconciliation succeeds.`)}catch(e){_e(e)}finally{ae(void 0)}}}async function Se(){if(u&&f&&HS(f,m,b)){ae(`cutover`),S(void 0),x(`Preparing a recoverable backup…`);try{let e=await pe(`/api/migration/cutover`,{method:`POST`,body:JSON.stringify({sessionId:u.sessionId,confirmation:`MIGRATE_AND_SWITCH`,roleSelection:f.projectRoles?VS(f,m):void 0})});if(e.error)throw Error(String(e.error));x(`Migration verified. Account ${String(AS(e).accountName??c?.accountName??``)} is ready in Vault.`),p(void 0)}catch(e){_e(e)}finally{ae(void 0)}}}return(0,$.jsxs)(Px,{navigation:!1,children:[(0,$.jsx)(Fx,{eyebrow:`Step ${vS.indexOf(ce)+1} of ${vS.length}`,title:`Set up your wallet`,description:`Bring an existing wallet into your local encrypted Vault.`}),ce===`source`&&t?(0,$.jsx)(`div`,{className:`form-actions`,children:(0,$.jsx)(Rx,{variant:`secondary`,onClick:t,disabled:ie!==void 0,children:`Back`})}):null,ce===`source`?null:(0,$.jsxs)(`div`,{className:`form-actions`,children:[(0,$.jsx)(Rx,{variant:`secondary`,onClick:fe,disabled:ie!==void 0,children:`Back`}),(0,$.jsxs)(`span`,{className:`dim`,children:[`Wallet: `,o?.account]})]}),ne?(0,$.jsx)(Ix,{children:(0,$.jsxs)(`div`,{className:`surface-body`,children:[(0,$.jsxs)(Lx,{tone:`error`,children:[ne,re?` No destination write or source change was reported; retry the preview when ready.`:``]}),(0,$.jsx)(`div`,{className:`form-actions`,children:(0,$.jsx)(Rx,{variant:`secondary`,disabled:ie!==void 0||!u,"aria-busy":ie!==void 0||void 0,onClick:re?ye:xe,children:ie===void 0?re?`Retry preview`:`Reconcile cutover`:re?`Retrying preview…`:`Reconciling cutover…`})})]})}):null,ce===`source`?(0,$.jsx)(NS,{inventory:n,source:o,onSelect:me,disabled:ie!==void 0}):null,ce===`destination`?(0,$.jsx)(PS,{source:o,destination:c,defaults:i?.destinationDefaults,onSubmit:he,pending:ie}):null,ce===`unlock`?(0,$.jsx)(FS,{source:o,destination:c,backend:i,sourcePassphrase:g,destinationPassphrase:v,setSourcePassphrase:_,setDestinationPassphrase:y,validationError:oe,onSubmit:ge,onLock:ve,pending:ie}):null,ce===`review`?(0,$.jsx)(IS,{preview:f,roles:m,setRoles:h,confirmation:b,setConfirmation:ee,onRefresh:ye,onResolve:be,onCutover:Se,canCutover:!!(f&&HS(f,m,b)),pending:ie,status:te}):null,(0,$.jsx)(`p`,{role:`status`,"aria-live":`polite`,className:`dim migration-footnote`,children:te}),(0,$.jsx)(zS,{inventory:n})]})}function NS({inventory:e,source:t,onSelect:n,disabled:r}){let i={"legacy-root":`Earlier BSV MCP wallet`,account:`BSV MCP account`,custom:`Configured wallet`,environment:`Current MCP server environment`,"mcp-client":`MCP client config`};return(0,$.jsxs)(Ix,{children:[(0,$.jsx)(`div`,{className:`surface-header`,children:(0,$.jsx)(`h2`,{children:`Choose a wallet to bring into Vault`})}),(0,$.jsxs)(`div`,{className:`surface-body`,children:[(0,$.jsx)(`p`,{children:`These files were found on this computer. Choose the wallet you want to keep using.`}),e?e.sources.length?e.sources.map(e=>{let a=t?.account===e.account&&t.location===e.location,o=e.encryptedBackup||e.plaintextKeys,s=[...e.encryptedBackup?[`keys.bep — encrypted key backup`]:[],...e.location===`mcp-client`||e.location===`environment`?[`Payment key in MCP config — import into Vault`]:e.plaintextKeys?[`${e.keyFile??`keys.json`} — unencrypted key file`]:[],...e.walletDatabases.map(e=>`${e} — wallet database`)],c=e.location===`mcp-client`?`Saved in ${e.client??`an MCP client`}`:i[e.location],l=e.location===`mcp-client`?`A payment key is still in that client’s MCP config. Import it into Vault, then remove it from the client config.`:e.location===`environment`?`A payment key is in the server environment. Import it into Vault and remove PRIVATE_KEY_WIF from the client config.`:e.encryptedBackup?`An encrypted key backup was found. You’ll need its password.`:e.plaintextKeys?`An unencrypted key file was found. Importing will add an encrypted copy to Vault.`:`Wallet data was found, but no key backup. This source cannot be imported on its own.`;return(0,$.jsxs)(`div`,{className:`source-row`,children:[(0,$.jsxs)(`div`,{className:`source-meta`,children:[(0,$.jsx)(`span`,{className:`source-title`,children:e.serverName||e.account}),(0,$.jsx)(`span`,{className:`source-detail`,children:c}),(0,$.jsx)(`p`,{className:`source-detail`,children:l}),(0,$.jsx)(`div`,{className:`source-location`,children:e.configPath||e.directory||e.location}),(0,$.jsxs)(`details`,{className:`source-files`,children:[(0,$.jsxs)(`summary`,{children:[`Files found (`,s.length,`)`]}),(0,$.jsx)(`ul`,{className:`file-list`,children:s.map(e=>(0,$.jsx)(`li`,{children:e},e))})]})]}),o?(0,$.jsx)(Rx,{variant:a?`secondary`:`primary`,disabled:r,onClick:()=>n(e),children:a?`Selected`:`Use this wallet`}):(0,$.jsx)(`span`,{className:`source-detail`,children:`Key backup needed`})]},`${e.location}:${e.account}`)}):(0,$.jsx)(Lx,{tone:`info`,children:`No existing wallet files were found.`}):(0,$.jsx)(zx,{label:`Finding local wallets`}),e?(0,$.jsx)(`p`,{className:`dim`,children:e.vaultExists?`A Vault file was found. Its contents can be checked after you unlock it.`:`No Vault file was found on this computer.`}):null]})]})}function PS({source:e,destination:t,defaults:n,onSubmit:r,pending:i}){return(0,$.jsxs)(Ix,{className:`stack-surface`,children:[(0,$.jsx)(`div`,{className:`surface-header`,children:(0,$.jsx)(`h2`,{children:`Where your wallet will be saved`})}),(0,$.jsxs)(`div`,{className:`surface-body`,children:[(0,$.jsx)(`p`,{children:`Your wallet will be added to the local encrypted Vault. Its existing keys and address will be checked before anything is switched.`}),n&&e?(0,$.jsxs)(`form`,{onSubmit:r,children:[(0,$.jsxs)(`dl`,{className:`stack-surface`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`field-label`,children:`Wallet`}),(0,$.jsx)(`dd`,{children:e.account})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`field-label`,children:`Vault location`}),(0,$.jsx)(`dd`,{style:{overflowWrap:`anywhere`},children:t?.vaultPath??n.vaultPath})]})]}),(0,$.jsx)(`p`,{className:`dim`,children:`A new entry will be created for this wallet. Existing Vault entries are kept.`}),(0,$.jsx)(`div`,{className:`form-actions`,children:(0,$.jsx)(Rx,{type:`submit`,disabled:i!==void 0,children:`Continue`})})]}):(0,$.jsx)(Lx,{tone:`info`,children:`The local server has not provided a Vault destination. Reopen setup after its configuration is complete.`})]})]})}function FS({source:e,destination:t,backend:n,sourcePassphrase:r,destinationPassphrase:i,setSourcePassphrase:a,setDestinationPassphrase:o,validationError:s,onSubmit:c,onLock:l,pending:u}){return n?.available?(0,$.jsxs)(Ix,{className:`stack-surface`,children:[(0,$.jsx)(`div`,{className:`surface-header`,children:(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`p`,{className:`section-label`,children:`03 / unlock`}),(0,$.jsx)(`h2`,{children:`Unlock locally and preview`})]})}),(0,$.jsxs)(`div`,{className:`surface-body`,children:[n?(0,$.jsx)(Lx,{tone:n.available?`success`:`warning`,children:n.available?`Vault migration backend is ready. Unlock stays on this device.`:n.reason??`Vault migration is unavailable.`}):(0,$.jsx)(zx,{label:`Checking Vault migration support`}),(0,$.jsxs)(`form`,{onSubmit:c,children:[(0,$.jsxs)(`label`,{className:`field-label`,children:[`Source backup passphrase`,(0,$.jsx)(`input`,{className:`field`,type:`password`,value:r,onChange:e=>a(e.target.value),autoComplete:`current-password`,pattern:`.*\\S.*`,title:`Use at least one non-whitespace character.`,"aria-invalid":s?!0:void 0,"aria-describedby":s?`unlock-validation-error`:void 0,disabled:!n?.available||!e||!t||u!==void 0})]}),(0,$.jsxs)(`label`,{className:`field-label`,children:[`Destination Vault passphrase`,(0,$.jsx)(`input`,{className:`field`,type:`password`,value:i,onChange:e=>o(e.target.value),autoComplete:`new-password`,pattern:`.*\\S.*`,title:`Use at least one non-whitespace character.`,"aria-invalid":s?!0:void 0,"aria-describedby":s?`unlock-validation-error`:void 0,disabled:!n?.available||!e||!t||u!==void 0})]}),s?(0,$.jsx)(`div`,{id:`unlock-validation-error`,children:(0,$.jsx)(Lx,{tone:`error`,children:s})}):null,(0,$.jsxs)(`div`,{className:`form-actions`,children:[(0,$.jsx)(Rx,{type:`submit`,"aria-busy":u===`unlock`||void 0,disabled:!n?.available||!e||!t||u!==void 0,children:u===`unlock`?`Unlocking…`:`Unlock locally`}),(0,$.jsx)(Rx,{type:`button`,variant:`secondary`,onClick:l,"aria-busy":u===`lock`||void 0,disabled:u!==void 0,children:u===`lock`?`Locking…`:`Lock session`})]})]}),(0,$.jsx)(`p`,{className:`dim`,children:`Passphrases are sent only to the loopback setup server and cleared after each request.`})]})]}):(0,$.jsxs)(Ix,{children:[(0,$.jsx)(`div`,{className:`surface-header`,children:(0,$.jsx)(`h2`,{children:`Setup is not ready to continue`})}),(0,$.jsxs)(`div`,{className:`surface-body`,children:[(0,$.jsx)(`p`,{children:`The local server cannot import this wallet yet. Your existing files have not been changed.`}),n?.reason?(0,$.jsxs)(`details`,{children:[(0,$.jsx)(`summary`,{children:`Connection details`}),(0,$.jsx)(`p`,{children:n.reason})]}):null]})]})}function IS({preview:e,roles:t,setRoles:n,confirmation:r,setConfirmation:i,onRefresh:a,onResolve:o,onCutover:s,canCutover:c,pending:l,status:u}){if(!e)return null;let d=AS(AS(e.projectRoles?.current).current);return(0,$.jsxs)(Ix,{className:`stack-surface`,children:[(0,$.jsxs)(`div`,{className:`surface-header`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`p`,{className:`section-label`,children:`04 / verify`}),(0,$.jsx)(`h2`,{children:`Review preservation`})]}),(0,$.jsx)(Rx,{variant:`secondary`,onClick:a,"aria-busy":l===`refresh`||void 0,disabled:l!==void 0,children:l===`refresh`?`Refreshing preview…`:`Refresh preview`})]}),(0,$.jsxs)(`div`,{className:`surface-body`,children:[(0,$.jsx)(Lx,{tone:`info`,children:u}),(0,$.jsxs)(`div`,{className:`grid grid-two`,children:[(0,$.jsxs)(`div`,{className:`data-list`,children:[(0,$.jsx)(LS,{label:`Source`,value:`${e.source.account} · ${e.source.location}`}),(0,$.jsx)(LS,{label:`Identity`,value:e.preservation.identity}),(0,$.jsx)(LS,{label:`Addresses`,value:e.preservation.addresses}),(0,$.jsx)(LS,{label:`Databases`,value:e.preservation.databases.length?e.preservation.databases.join(`, `):`none`}),(0,$.jsx)(LS,{label:`Vault entries`,value:e.preservation.vaultEntries})]}),(0,$.jsx)(`pre`,{className:`json-preview`,children:JSON.stringify({source:e.source,destination:e.destination,conflicts:e.conflicts},null,2)})]}),e.projectRoles?(0,$.jsx)(RS,{projectRoles:e.projectRoles,assignments:d,roles:t,setRoles:n,onRefresh:a,pending:l}):null,e.conflicts.length?(0,$.jsx)(`div`,{className:`conflict-list`,children:e.conflicts.map(e=>(0,$.jsxs)(`div`,{className:`role-row`,children:[(0,$.jsx)(`label`,{className:`role-label`,htmlFor:`conflict-resolution-${e.id}`,children:e.message}),(0,$.jsxs)(`select`,{id:`conflict-resolution-${e.id}`,className:`select`,"aria-label":`Resolve conflict: ${e.message}`,value:e.resolution??``,onChange:t=>o(e.id,t.target.value),disabled:l!==void 0,children:[(0,$.jsx)(`option`,{value:``,children:`Choose a resolution`}),(0,$.jsx)(`option`,{value:`keep-existing`,children:`Keep existing Vault entry`}),(0,$.jsx)(`option`,{value:`import-source`,children:`Import source material`}),(0,$.jsx)(`option`,{value:`skip`,children:`Skip this item`})]})]},e.id))}):(0,$.jsx)(`p`,{className:`dim`,children:`No conflicts reported.`}),(0,$.jsxs)(`label`,{className:`field-label`,children:[`Type `,(0,$.jsx)(`strong`,{children:`MIGRATE_AND_SWITCH`}),` to authorize`,(0,$.jsx)(`input`,{className:`field`,value:r,onChange:e=>i(e.target.value),autoComplete:`off`,disabled:l!==void 0})]}),(0,$.jsx)(`div`,{className:`form-actions`,children:(0,$.jsx)(Rx,{onClick:s,"aria-busy":l===`cutover`||void 0,disabled:!c||l!==void 0,children:l===`cutover`?`Migrating to Vault…`:`Import and switch to Vault`})})]})]})}function LS({label:e,value:t}){return(0,$.jsxs)(`div`,{className:`data-row`,children:[(0,$.jsx)(`span`,{className:`data-label`,children:e}),(0,$.jsx)(`span`,{className:`data-value`,children:t})]})}function RS({projectRoles:e,assignments:t,roles:n,setRoles:r,onRefresh:i,pending:a}){let o=AS(e).presentation,s=e.candidates,c=Array.isArray(o&&o.roles)?o.roles.filter(e=>!!(e&&typeof e==`object`)):[],l=c.length?c.map(e=>({role:String(e.role),label:String(e.label??kS[e.role]??e.role),current:e.current,selectedValue:typeof e.selectedValue==`string`?e.selectedValue:void 0,choices:Array.isArray(e.choices)?e.choices.filter(e=>!!(e&&typeof e==`object`)):[]})):_S.map(e=>({role:e,label:kS[e],current:t[e],selectedValue:void 0,choices:[]}));return(0,$.jsxs)(`div`,{className:`stack-surface`,children:[(0,$.jsx)(`p`,{className:`section-label`,children:`project roles`}),(0,$.jsx)(`h3`,{children:`Choose a verified key for each role`}),(0,$.jsx)(`p`,{className:`dim`,children:`Only candidate IDs are sent when you continue. Key material and paths stay in the trusted backend.`}),s.length===0?(0,$.jsxs)(`div`,{className:`stack-surface`,children:[(0,$.jsx)(Lx,{tone:`info`,children:`No verified keys are available for project roles. Refresh the preview to check again.`}),(0,$.jsx)(`div`,{className:`form-actions`,children:(0,$.jsx)(Rx,{variant:`secondary`,onClick:i,"aria-busy":a===`refresh`||void 0,disabled:a!==void 0,children:a===`refresh`?`Refreshing preview…`:`Refresh preview`})})]}):null,(0,$.jsx)(`div`,{className:`role-grid`,children:l.map(e=>{let t=e.role,i=typeof e.current==`string`?`keep:${e.current}`:`unassigned`,o=n[t]??e.selectedValue??i;return(0,$.jsxs)(`label`,{className:`role-row`,children:[(0,$.jsx)(`span`,{className:`role-label`,children:e.label}),(0,$.jsx)(`span`,{className:`role-help`,children:typeof e.current==`string`?`Current: ${String(e.current)}`:`No current assignment`}),(0,$.jsxs)(`select`,{className:`select`,value:o,disabled:a!==void 0,onChange:e=>r(n=>({...n,[t]:e.target.value})),children:[(0,$.jsx)(`option`,{value:`unassigned`,children:`Leave unassigned`}),typeof e.current==`string`?(0,$.jsx)(`option`,{value:i,children:`Keep current selection`}):null,e.choices.length?e.choices.map(e=>(0,$.jsx)(`option`,{value:String(e.value),disabled:e.disabled===!0,children:String(e.label??e.value)},String(e.value))):s.map(e=>(0,$.jsxs)(`option`,{value:`select:${e.candidateId}`,disabled:!!e.unavailableReason||!e.supportedRoles.includes(t),children:[e.label,e.publicDerivationLabel?` · ${e.publicDerivationLabel}`:``,e.unavailableReason?` · ${e.unavailableReason}`:``]},e.candidateId))]})]},t)})})]})}function zS({inventory:e}){return e?.migrationRequired?(0,$.jsx)(`p`,{className:`dim migration-footnote`,children:`No source is erased and the running wallet is not switched until explicit cutover completes and verifies.`}):null}function BS(e){let t=AS(e.projectRoles).presentation;if(t&&Array.isArray(t.roles)){let e=Object.fromEntries(t.roles.filter(e=>!!(e&&typeof e==`object`)).map(e=>[e.role,e.selectedValue]));return Object.fromEntries(_S.map(t=>[t,typeof e[t]==`string`?e[t]:`unassigned`]))}let n=AS(AS(e.projectRoles?.current).current);return Object.fromEntries(_S.map(e=>[e,typeof n[e]==`string`?`keep:${n[e]}`:`unassigned`]))}function VS(e,t){let n=AS(e.projectRoles).presentation,r=AS(e.projectRoles?.current),i=n&&typeof n.revision==`number`?n.revision:typeof r.revision==`number`?r.revision:null;return{expectedProjectId:e.projectRoles?.projectId??``,expectedRevision:i,roleAssignments:Object.fromEntries(_S.map(e=>[e,t[e]??`unassigned`]))}}function HS(e,t,n){return n===`MIGRATE_AND_SWITCH`&&e.conflicts.every(e=>!!e.resolution)&&(!e.projectRoles||_S.every(e=>typeof t[e]==`string`))}var US={mode:null,token:``,flow:null},WS=null;function GS(){return US}function KS(){if(!WS){let e=window.location.hash.slice(1);WS={mode:window.location.pathname.startsWith(`/setup/`)?`migration`:new URLSearchParams(window.location.search).get(`mode`),token:e,flow:new URLSearchParams(window.location.search).get(`flow`)}}return WS}function qS(){return()=>{}}function JS(){let{mode:e,token:t,flow:n}=(0,A.useSyncExternalStore)(qS,KS,GS);return(0,A.useEffect)(()=>{typeof window>`u`||t&&window.history.replaceState(null,``,`${window.location.pathname}?mode=${e??`migration`}${n===`project`||n===`standalone`?`&flow=${n}`:``}`)},[e,t,n]),e===`migration`||t.length>0?n===`project`?(0,$.jsx)(MS,{token:t}):(0,$.jsx)(gS,{token:t,standalone:n===`standalone`}):(0,$.jsx)(Kx,{})}var YS=document.getElementById(`root`);if(!YS)throw Error(`Local app is missing its root element`);(0,da.createRoot)(YS).render((0,$.jsx)(JS,{}));