palmier 0.8.8 → 0.8.10

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.
Files changed (43) hide show
  1. package/README.md +27 -17
  2. package/dist/commands/info.js +5 -0
  3. package/dist/commands/init.js +8 -13
  4. package/dist/commands/pair.js +9 -3
  5. package/dist/network.d.ts +9 -0
  6. package/dist/network.js +34 -0
  7. package/dist/pwa/assets/{index-UaZFu6XL.css → index-DQJHVyP6.css} +1 -1
  8. package/dist/pwa/assets/index-iL_NTbsT.js +120 -0
  9. package/dist/pwa/assets/web-C9g_YGd8.js +1 -0
  10. package/dist/pwa/assets/{web-DYwZE4qa.js → web-CaRUL7Kz.js} +1 -1
  11. package/dist/pwa/assets/{web-nSzKzI8x.js → web-D4ty3qtI.js} +1 -1
  12. package/dist/pwa/index.html +2 -2
  13. package/dist/pwa/service-worker.js +1 -1
  14. package/dist/rpc-handler.js +2 -0
  15. package/dist/transports/http-transport.d.ts +0 -1
  16. package/dist/transports/http-transport.js +50 -38
  17. package/dist/types.d.ts +4 -2
  18. package/package.json +2 -1
  19. package/palmier-server/CLAUDE.md +4 -0
  20. package/palmier-server/PRODUCTION.md +1 -1
  21. package/palmier-server/README.md +1 -1
  22. package/palmier-server/pnpm-lock.yaml +12 -0
  23. package/palmier-server/pwa/package.json +1 -0
  24. package/palmier-server/pwa/src/App.css +61 -0
  25. package/palmier-server/pwa/src/components/CapabilityToggles.tsx +1 -1
  26. package/palmier-server/pwa/src/components/ConnectionStatusIcon.tsx +68 -0
  27. package/palmier-server/pwa/src/components/HostMenu.tsx +5 -4
  28. package/palmier-server/pwa/src/constants.ts +1 -1
  29. package/palmier-server/pwa/src/contexts/HostConnectionContext.tsx +165 -66
  30. package/palmier-server/pwa/src/contexts/HostStoreContext.tsx +12 -0
  31. package/palmier-server/pwa/src/pages/Dashboard.tsx +8 -2
  32. package/palmier-server/pwa/src/pages/PairHost.tsx +8 -10
  33. package/palmier-server/pwa/src/pages/PairSetup.tsx +5 -2
  34. package/palmier-server/pwa/src/types.ts +3 -1
  35. package/palmier-server/spec.md +21 -19
  36. package/src/commands/info.ts +6 -0
  37. package/src/commands/init.ts +8 -14
  38. package/src/commands/pair.ts +9 -3
  39. package/src/network.ts +32 -0
  40. package/src/rpc-handler.ts +2 -0
  41. package/src/transports/http-transport.ts +42 -40
  42. package/src/types.ts +5 -2
  43. package/dist/pwa/assets/index-BiAE5qeC.js +0 -120
@@ -0,0 +1,120 @@
1
+ var Vw=Object.defineProperty;var Jw=(e,n,r)=>n in e?Vw(e,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[n]=r;var C=(e,n,r)=>Jw(e,typeof n!="symbol"?n+"":n,r);(function(){const n=document.createElement("link").relList;if(n&&n.supports&&n.supports("modulepreload"))return;for(const l of document.querySelectorAll('link[rel="modulepreload"]'))s(l);new MutationObserver(l=>{for(const u of l)if(u.type==="childList")for(const c of u.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&s(c)}).observe(document,{childList:!0,subtree:!0});function r(l){const u={};return l.integrity&&(u.integrity=l.integrity),l.referrerPolicy&&(u.referrerPolicy=l.referrerPolicy),l.crossOrigin==="use-credentials"?u.credentials="include":l.crossOrigin==="anonymous"?u.credentials="omit":u.credentials="same-origin",u}function s(l){if(l.ep)return;l.ep=!0;const u=r(l);fetch(l.href,u)}})();function zb(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var oh={exports:{}},ml={};/**
2
+ * @license React
3
+ * react-jsx-runtime.production.js
4
+ *
5
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
6
+ *
7
+ * This source code is licensed under the MIT license found in the
8
+ * LICENSE file in the root directory of this source tree.
9
+ */var $y;function Xw(){if($y)return ml;$y=1;var e=Symbol.for("react.transitional.element"),n=Symbol.for("react.fragment");function r(s,l,u){var c=null;if(u!==void 0&&(c=""+u),l.key!==void 0&&(c=""+l.key),"key"in l){u={};for(var f in l)f!=="key"&&(u[f]=l[f])}else u=l;return l=u.ref,{$$typeof:e,type:s,key:c,ref:l!==void 0?l:null,props:u}}return ml.Fragment=n,ml.jsx=r,ml.jsxs=r,ml}var Yy;function Kw(){return Yy||(Yy=1,oh.exports=Xw()),oh.exports}var b=Kw(),uh={exports:{}},Ie={};/**
10
+ * @license React
11
+ * react.production.js
12
+ *
13
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
14
+ *
15
+ * This source code is licensed under the MIT license found in the
16
+ * LICENSE file in the root directory of this source tree.
17
+ */var Gy;function Qw(){if(Gy)return Ie;Gy=1;var e=Symbol.for("react.transitional.element"),n=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),l=Symbol.for("react.profiler"),u=Symbol.for("react.consumer"),c=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),m=Symbol.for("react.suspense"),d=Symbol.for("react.memo"),y=Symbol.for("react.lazy"),g=Symbol.for("react.activity"),x=Symbol.iterator;function w(M){return M===null||typeof M!="object"?null:(M=x&&M[x]||M["@@iterator"],typeof M=="function"?M:null)}var S={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},D=Object.assign,q={};function L(M,W,A){this.props=M,this.context=W,this.refs=q,this.updater=A||S}L.prototype.isReactComponent={},L.prototype.setState=function(M,W){if(typeof M!="object"&&typeof M!="function"&&M!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,M,W,"setState")},L.prototype.forceUpdate=function(M){this.updater.enqueueForceUpdate(this,M,"forceUpdate")};function $(){}$.prototype=L.prototype;function T(M,W,A){this.props=M,this.context=W,this.refs=q,this.updater=A||S}var te=T.prototype=new $;te.constructor=T,D(te,L.prototype),te.isPureReactComponent=!0;var B=Array.isArray;function z(){}var K={H:null,A:null,T:null,S:null},Q=Object.prototype.hasOwnProperty;function H(M,W,A){var ve=A.ref;return{$$typeof:e,type:M,key:W,ref:ve!==void 0?ve:null,props:A}}function R(M,W){return H(M.type,W,M.props)}function X(M){return typeof M=="object"&&M!==null&&M.$$typeof===e}function J(M){var W={"=":"=0",":":"=2"};return"$"+M.replace(/[=:]/g,function(A){return W[A]})}var ae=/\/+/g;function re(M,W){return typeof M=="object"&&M!==null&&M.key!=null?J(""+M.key):W.toString(36)}function F(M){switch(M.status){case"fulfilled":return M.value;case"rejected":throw M.reason;default:switch(typeof M.status=="string"?M.then(z,z):(M.status="pending",M.then(function(W){M.status==="pending"&&(M.status="fulfilled",M.value=W)},function(W){M.status==="pending"&&(M.status="rejected",M.reason=W)})),M.status){case"fulfilled":return M.value;case"rejected":throw M.reason}}throw M}function P(M,W,A,ve,Ce){var je=typeof M;(je==="undefined"||je==="boolean")&&(M=null);var ze=!1;if(M===null)ze=!0;else switch(je){case"bigint":case"string":case"number":ze=!0;break;case"object":switch(M.$$typeof){case e:case n:ze=!0;break;case y:return ze=M._init,P(ze(M._payload),W,A,ve,Ce)}}if(ze)return Ce=Ce(M),ze=ve===""?"."+re(M,0):ve,B(Ce)?(A="",ze!=null&&(A=ze.replace(ae,"$&/")+"/"),P(Ce,W,A,"",function(Ae){return Ae})):Ce!=null&&(X(Ce)&&(Ce=R(Ce,A+(Ce.key==null||M&&M.key===Ce.key?"":(""+Ce.key).replace(ae,"$&/")+"/")+ze)),W.push(Ce)),1;ze=0;var qe=ve===""?".":ve+":";if(B(M))for(var Te=0;Te<M.length;Te++)ve=M[Te],je=qe+re(ve,Te),ze+=P(ve,W,A,je,Ce);else if(Te=w(M),typeof Te=="function")for(M=Te.call(M),Te=0;!(ve=M.next()).done;)ve=ve.value,je=qe+re(ve,Te++),ze+=P(ve,W,A,je,Ce);else if(je==="object"){if(typeof M.then=="function")return P(F(M),W,A,ve,Ce);throw W=String(M),Error("Objects are not valid as a React child (found: "+(W==="[object Object]"?"object with keys {"+Object.keys(M).join(", ")+"}":W)+"). If you meant to render a collection of children, use an array instead.")}return ze}function V(M,W,A){if(M==null)return M;var ve=[],Ce=0;return P(M,ve,"","",function(je){return W.call(A,je,Ce++)}),ve}function ue(M){if(M._status===-1){var W=M._result;W=W(),W.then(function(A){(M._status===0||M._status===-1)&&(M._status=1,M._result=A)},function(A){(M._status===0||M._status===-1)&&(M._status=2,M._result=A)}),M._status===-1&&(M._status=0,M._result=W)}if(M._status===1)return M._result.default;throw M._result}var xe=typeof reportError=="function"?reportError:function(M){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var W=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof M=="object"&&M!==null&&typeof M.message=="string"?String(M.message):String(M),error:M});if(!window.dispatchEvent(W))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",M);return}console.error(M)},_={map:V,forEach:function(M,W,A){V(M,function(){W.apply(this,arguments)},A)},count:function(M){var W=0;return V(M,function(){W++}),W},toArray:function(M){return V(M,function(W){return W})||[]},only:function(M){if(!X(M))throw Error("React.Children.only expected to receive a single React element child.");return M}};return Ie.Activity=g,Ie.Children=_,Ie.Component=L,Ie.Fragment=r,Ie.Profiler=l,Ie.PureComponent=T,Ie.StrictMode=s,Ie.Suspense=m,Ie.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=K,Ie.__COMPILER_RUNTIME={__proto__:null,c:function(M){return K.H.useMemoCache(M)}},Ie.cache=function(M){return function(){return M.apply(null,arguments)}},Ie.cacheSignal=function(){return null},Ie.cloneElement=function(M,W,A){if(M==null)throw Error("The argument must be a React element, but you passed "+M+".");var ve=D({},M.props),Ce=M.key;if(W!=null)for(je in W.key!==void 0&&(Ce=""+W.key),W)!Q.call(W,je)||je==="key"||je==="__self"||je==="__source"||je==="ref"&&W.ref===void 0||(ve[je]=W[je]);var je=arguments.length-2;if(je===1)ve.children=A;else if(1<je){for(var ze=Array(je),qe=0;qe<je;qe++)ze[qe]=arguments[qe+2];ve.children=ze}return H(M.type,Ce,ve)},Ie.createContext=function(M){return M={$$typeof:c,_currentValue:M,_currentValue2:M,_threadCount:0,Provider:null,Consumer:null},M.Provider=M,M.Consumer={$$typeof:u,_context:M},M},Ie.createElement=function(M,W,A){var ve,Ce={},je=null;if(W!=null)for(ve in W.key!==void 0&&(je=""+W.key),W)Q.call(W,ve)&&ve!=="key"&&ve!=="__self"&&ve!=="__source"&&(Ce[ve]=W[ve]);var ze=arguments.length-2;if(ze===1)Ce.children=A;else if(1<ze){for(var qe=Array(ze),Te=0;Te<ze;Te++)qe[Te]=arguments[Te+2];Ce.children=qe}if(M&&M.defaultProps)for(ve in ze=M.defaultProps,ze)Ce[ve]===void 0&&(Ce[ve]=ze[ve]);return H(M,je,Ce)},Ie.createRef=function(){return{current:null}},Ie.forwardRef=function(M){return{$$typeof:f,render:M}},Ie.isValidElement=X,Ie.lazy=function(M){return{$$typeof:y,_payload:{_status:-1,_result:M},_init:ue}},Ie.memo=function(M,W){return{$$typeof:d,type:M,compare:W===void 0?null:W}},Ie.startTransition=function(M){var W=K.T,A={};K.T=A;try{var ve=M(),Ce=K.S;Ce!==null&&Ce(A,ve),typeof ve=="object"&&ve!==null&&typeof ve.then=="function"&&ve.then(z,xe)}catch(je){xe(je)}finally{W!==null&&A.types!==null&&(W.types=A.types),K.T=W}},Ie.unstable_useCacheRefresh=function(){return K.H.useCacheRefresh()},Ie.use=function(M){return K.H.use(M)},Ie.useActionState=function(M,W,A){return K.H.useActionState(M,W,A)},Ie.useCallback=function(M,W){return K.H.useCallback(M,W)},Ie.useContext=function(M){return K.H.useContext(M)},Ie.useDebugValue=function(){},Ie.useDeferredValue=function(M,W){return K.H.useDeferredValue(M,W)},Ie.useEffect=function(M,W){return K.H.useEffect(M,W)},Ie.useEffectEvent=function(M){return K.H.useEffectEvent(M)},Ie.useId=function(){return K.H.useId()},Ie.useImperativeHandle=function(M,W,A){return K.H.useImperativeHandle(M,W,A)},Ie.useInsertionEffect=function(M,W){return K.H.useInsertionEffect(M,W)},Ie.useLayoutEffect=function(M,W){return K.H.useLayoutEffect(M,W)},Ie.useMemo=function(M,W){return K.H.useMemo(M,W)},Ie.useOptimistic=function(M,W){return K.H.useOptimistic(M,W)},Ie.useReducer=function(M,W,A){return K.H.useReducer(M,W,A)},Ie.useRef=function(M){return K.H.useRef(M)},Ie.useState=function(M){return K.H.useState(M)},Ie.useSyncExternalStore=function(M,W,A){return K.H.useSyncExternalStore(M,W,A)},Ie.useTransition=function(){return K.H.useTransition()},Ie.version="19.2.4",Ie}var Vy;function Ed(){return Vy||(Vy=1,uh.exports=Qw()),uh.exports}var N=Ed(),ch={exports:{}},pl={},fh={exports:{}},hh={};/**
18
+ * @license React
19
+ * scheduler.production.js
20
+ *
21
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
22
+ *
23
+ * This source code is licensed under the MIT license found in the
24
+ * LICENSE file in the root directory of this source tree.
25
+ */var Jy;function Zw(){return Jy||(Jy=1,(function(e){function n(P,V){var ue=P.length;P.push(V);e:for(;0<ue;){var xe=ue-1>>>1,_=P[xe];if(0<l(_,V))P[xe]=V,P[ue]=_,ue=xe;else break e}}function r(P){return P.length===0?null:P[0]}function s(P){if(P.length===0)return null;var V=P[0],ue=P.pop();if(ue!==V){P[0]=ue;e:for(var xe=0,_=P.length,M=_>>>1;xe<M;){var W=2*(xe+1)-1,A=P[W],ve=W+1,Ce=P[ve];if(0>l(A,ue))ve<_&&0>l(Ce,A)?(P[xe]=Ce,P[ve]=ue,xe=ve):(P[xe]=A,P[W]=ue,xe=W);else if(ve<_&&0>l(Ce,ue))P[xe]=Ce,P[ve]=ue,xe=ve;else break e}}return V}function l(P,V){var ue=P.sortIndex-V.sortIndex;return ue!==0?ue:P.id-V.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var u=performance;e.unstable_now=function(){return u.now()}}else{var c=Date,f=c.now();e.unstable_now=function(){return c.now()-f}}var m=[],d=[],y=1,g=null,x=3,w=!1,S=!1,D=!1,q=!1,L=typeof setTimeout=="function"?setTimeout:null,$=typeof clearTimeout=="function"?clearTimeout:null,T=typeof setImmediate<"u"?setImmediate:null;function te(P){for(var V=r(d);V!==null;){if(V.callback===null)s(d);else if(V.startTime<=P)s(d),V.sortIndex=V.expirationTime,n(m,V);else break;V=r(d)}}function B(P){if(D=!1,te(P),!S)if(r(m)!==null)S=!0,z||(z=!0,J());else{var V=r(d);V!==null&&F(B,V.startTime-P)}}var z=!1,K=-1,Q=5,H=-1;function R(){return q?!0:!(e.unstable_now()-H<Q)}function X(){if(q=!1,z){var P=e.unstable_now();H=P;var V=!0;try{e:{S=!1,D&&(D=!1,$(K),K=-1),w=!0;var ue=x;try{t:{for(te(P),g=r(m);g!==null&&!(g.expirationTime>P&&R());){var xe=g.callback;if(typeof xe=="function"){g.callback=null,x=g.priorityLevel;var _=xe(g.expirationTime<=P);if(P=e.unstable_now(),typeof _=="function"){g.callback=_,te(P),V=!0;break t}g===r(m)&&s(m),te(P)}else s(m);g=r(m)}if(g!==null)V=!0;else{var M=r(d);M!==null&&F(B,M.startTime-P),V=!1}}break e}finally{g=null,x=ue,w=!1}V=void 0}}finally{V?J():z=!1}}}var J;if(typeof T=="function")J=function(){T(X)};else if(typeof MessageChannel<"u"){var ae=new MessageChannel,re=ae.port2;ae.port1.onmessage=X,J=function(){re.postMessage(null)}}else J=function(){L(X,0)};function F(P,V){K=L(function(){P(e.unstable_now())},V)}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(P){P.callback=null},e.unstable_forceFrameRate=function(P){0>P||125<P?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):Q=0<P?Math.floor(1e3/P):5},e.unstable_getCurrentPriorityLevel=function(){return x},e.unstable_next=function(P){switch(x){case 1:case 2:case 3:var V=3;break;default:V=x}var ue=x;x=V;try{return P()}finally{x=ue}},e.unstable_requestPaint=function(){q=!0},e.unstable_runWithPriority=function(P,V){switch(P){case 1:case 2:case 3:case 4:case 5:break;default:P=3}var ue=x;x=P;try{return V()}finally{x=ue}},e.unstable_scheduleCallback=function(P,V,ue){var xe=e.unstable_now();switch(typeof ue=="object"&&ue!==null?(ue=ue.delay,ue=typeof ue=="number"&&0<ue?xe+ue:xe):ue=xe,P){case 1:var _=-1;break;case 2:_=250;break;case 5:_=1073741823;break;case 4:_=1e4;break;default:_=5e3}return _=ue+_,P={id:y++,callback:V,priorityLevel:P,startTime:ue,expirationTime:_,sortIndex:-1},ue>xe?(P.sortIndex=ue,n(d,P),r(m)===null&&P===r(d)&&(D?($(K),K=-1):D=!0,F(B,ue-xe))):(P.sortIndex=_,n(m,P),S||w||(S=!0,z||(z=!0,J()))),P},e.unstable_shouldYield=R,e.unstable_wrapCallback=function(P){var V=x;return function(){var ue=x;x=V;try{return P.apply(this,arguments)}finally{x=ue}}}})(hh)),hh}var Xy;function Ww(){return Xy||(Xy=1,fh.exports=Zw()),fh.exports}var dh={exports:{}},cn={};/**
26
+ * @license React
27
+ * react-dom.production.js
28
+ *
29
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
30
+ *
31
+ * This source code is licensed under the MIT license found in the
32
+ * LICENSE file in the root directory of this source tree.
33
+ */var Ky;function eS(){if(Ky)return cn;Ky=1;var e=Ed();function n(m){var d="https://react.dev/errors/"+m;if(1<arguments.length){d+="?args[]="+encodeURIComponent(arguments[1]);for(var y=2;y<arguments.length;y++)d+="&args[]="+encodeURIComponent(arguments[y])}return"Minified React error #"+m+"; visit "+d+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function r(){}var s={d:{f:r,r:function(){throw Error(n(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},l=Symbol.for("react.portal");function u(m,d,y){var g=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:l,key:g==null?null:""+g,children:m,containerInfo:d,implementation:y}}var c=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function f(m,d){if(m==="font")return"";if(typeof d=="string")return d==="use-credentials"?d:""}return cn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=s,cn.createPortal=function(m,d){var y=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!d||d.nodeType!==1&&d.nodeType!==9&&d.nodeType!==11)throw Error(n(299));return u(m,d,null,y)},cn.flushSync=function(m){var d=c.T,y=s.p;try{if(c.T=null,s.p=2,m)return m()}finally{c.T=d,s.p=y,s.d.f()}},cn.preconnect=function(m,d){typeof m=="string"&&(d?(d=d.crossOrigin,d=typeof d=="string"?d==="use-credentials"?d:"":void 0):d=null,s.d.C(m,d))},cn.prefetchDNS=function(m){typeof m=="string"&&s.d.D(m)},cn.preinit=function(m,d){if(typeof m=="string"&&d&&typeof d.as=="string"){var y=d.as,g=f(y,d.crossOrigin),x=typeof d.integrity=="string"?d.integrity:void 0,w=typeof d.fetchPriority=="string"?d.fetchPriority:void 0;y==="style"?s.d.S(m,typeof d.precedence=="string"?d.precedence:void 0,{crossOrigin:g,integrity:x,fetchPriority:w}):y==="script"&&s.d.X(m,{crossOrigin:g,integrity:x,fetchPriority:w,nonce:typeof d.nonce=="string"?d.nonce:void 0})}},cn.preinitModule=function(m,d){if(typeof m=="string")if(typeof d=="object"&&d!==null){if(d.as==null||d.as==="script"){var y=f(d.as,d.crossOrigin);s.d.M(m,{crossOrigin:y,integrity:typeof d.integrity=="string"?d.integrity:void 0,nonce:typeof d.nonce=="string"?d.nonce:void 0})}}else d==null&&s.d.M(m)},cn.preload=function(m,d){if(typeof m=="string"&&typeof d=="object"&&d!==null&&typeof d.as=="string"){var y=d.as,g=f(y,d.crossOrigin);s.d.L(m,y,{crossOrigin:g,integrity:typeof d.integrity=="string"?d.integrity:void 0,nonce:typeof d.nonce=="string"?d.nonce:void 0,type:typeof d.type=="string"?d.type:void 0,fetchPriority:typeof d.fetchPriority=="string"?d.fetchPriority:void 0,referrerPolicy:typeof d.referrerPolicy=="string"?d.referrerPolicy:void 0,imageSrcSet:typeof d.imageSrcSet=="string"?d.imageSrcSet:void 0,imageSizes:typeof d.imageSizes=="string"?d.imageSizes:void 0,media:typeof d.media=="string"?d.media:void 0})}},cn.preloadModule=function(m,d){if(typeof m=="string")if(d){var y=f(d.as,d.crossOrigin);s.d.m(m,{as:typeof d.as=="string"&&d.as!=="script"?d.as:void 0,crossOrigin:y,integrity:typeof d.integrity=="string"?d.integrity:void 0})}else s.d.m(m)},cn.requestFormReset=function(m){s.d.r(m)},cn.unstable_batchedUpdates=function(m,d){return m(d)},cn.useFormState=function(m,d,y){return c.H.useFormState(m,d,y)},cn.useFormStatus=function(){return c.H.useHostTransitionStatus()},cn.version="19.2.4",cn}var Qy;function Ub(){if(Qy)return dh.exports;Qy=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(n){console.error(n)}}return e(),dh.exports=eS(),dh.exports}/**
34
+ * @license React
35
+ * react-dom-client.production.js
36
+ *
37
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
38
+ *
39
+ * This source code is licensed under the MIT license found in the
40
+ * LICENSE file in the root directory of this source tree.
41
+ */var Zy;function tS(){if(Zy)return pl;Zy=1;var e=Ww(),n=Ed(),r=Ub();function s(t){var i="https://react.dev/errors/"+t;if(1<arguments.length){i+="?args[]="+encodeURIComponent(arguments[1]);for(var a=2;a<arguments.length;a++)i+="&args[]="+encodeURIComponent(arguments[a])}return"Minified React error #"+t+"; visit "+i+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function l(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function u(t){var i=t,a=t;if(t.alternate)for(;i.return;)i=i.return;else{t=i;do i=t,(i.flags&4098)!==0&&(a=i.return),t=i.return;while(t)}return i.tag===3?a:null}function c(t){if(t.tag===13){var i=t.memoizedState;if(i===null&&(t=t.alternate,t!==null&&(i=t.memoizedState)),i!==null)return i.dehydrated}return null}function f(t){if(t.tag===31){var i=t.memoizedState;if(i===null&&(t=t.alternate,t!==null&&(i=t.memoizedState)),i!==null)return i.dehydrated}return null}function m(t){if(u(t)!==t)throw Error(s(188))}function d(t){var i=t.alternate;if(!i){if(i=u(t),i===null)throw Error(s(188));return i!==t?null:t}for(var a=t,o=i;;){var h=a.return;if(h===null)break;var p=h.alternate;if(p===null){if(o=h.return,o!==null){a=o;continue}break}if(h.child===p.child){for(p=h.child;p;){if(p===a)return m(h),t;if(p===o)return m(h),i;p=p.sibling}throw Error(s(188))}if(a.return!==o.return)a=h,o=p;else{for(var v=!1,E=h.child;E;){if(E===a){v=!0,a=h,o=p;break}if(E===o){v=!0,o=h,a=p;break}E=E.sibling}if(!v){for(E=p.child;E;){if(E===a){v=!0,a=p,o=h;break}if(E===o){v=!0,o=p,a=h;break}E=E.sibling}if(!v)throw Error(s(189))}}if(a.alternate!==o)throw Error(s(190))}if(a.tag!==3)throw Error(s(188));return a.stateNode.current===a?t:i}function y(t){var i=t.tag;if(i===5||i===26||i===27||i===6)return t;for(t=t.child;t!==null;){if(i=y(t),i!==null)return i;t=t.sibling}return null}var g=Object.assign,x=Symbol.for("react.element"),w=Symbol.for("react.transitional.element"),S=Symbol.for("react.portal"),D=Symbol.for("react.fragment"),q=Symbol.for("react.strict_mode"),L=Symbol.for("react.profiler"),$=Symbol.for("react.consumer"),T=Symbol.for("react.context"),te=Symbol.for("react.forward_ref"),B=Symbol.for("react.suspense"),z=Symbol.for("react.suspense_list"),K=Symbol.for("react.memo"),Q=Symbol.for("react.lazy"),H=Symbol.for("react.activity"),R=Symbol.for("react.memo_cache_sentinel"),X=Symbol.iterator;function J(t){return t===null||typeof t!="object"?null:(t=X&&t[X]||t["@@iterator"],typeof t=="function"?t:null)}var ae=Symbol.for("react.client.reference");function re(t){if(t==null)return null;if(typeof t=="function")return t.$$typeof===ae?null:t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case D:return"Fragment";case L:return"Profiler";case q:return"StrictMode";case B:return"Suspense";case z:return"SuspenseList";case H:return"Activity"}if(typeof t=="object")switch(t.$$typeof){case S:return"Portal";case T:return t.displayName||"Context";case $:return(t._context.displayName||"Context")+".Consumer";case te:var i=t.render;return t=t.displayName,t||(t=i.displayName||i.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case K:return i=t.displayName||null,i!==null?i:re(t.type)||"Memo";case Q:i=t._payload,t=t._init;try{return re(t(i))}catch{}}return null}var F=Array.isArray,P=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,V=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ue={pending:!1,data:null,method:null,action:null},xe=[],_=-1;function M(t){return{current:t}}function W(t){0>_||(t.current=xe[_],xe[_]=null,_--)}function A(t,i){_++,xe[_]=t.current,t.current=i}var ve=M(null),Ce=M(null),je=M(null),ze=M(null);function qe(t,i){switch(A(je,i),A(Ce,t),A(ve,null),i.nodeType){case 9:case 11:t=(t=i.documentElement)&&(t=t.namespaceURI)?dy(t):0;break;default:if(t=i.tagName,i=i.namespaceURI)i=dy(i),t=my(i,t);else switch(t){case"svg":t=1;break;case"math":t=2;break;default:t=0}}W(ve),A(ve,t)}function Te(){W(ve),W(Ce),W(je)}function Ae(t){t.memoizedState!==null&&A(ze,t);var i=ve.current,a=my(i,t.type);i!==a&&(A(Ce,t),A(ve,a))}function Je(t){Ce.current===t&&(W(ve),W(Ce)),ze.current===t&&(W(ze),cl._currentValue=ue)}var rt,kt;function Ke(t){if(rt===void 0)try{throw Error()}catch(a){var i=a.stack.trim().match(/\n( *(at )?)/);rt=i&&i[1]||"",kt=-1<a.stack.indexOf(`
42
+ at`)?" (<anonymous>)":-1<a.stack.indexOf("@")?"@unknown:0:0":""}return`
43
+ `+rt+t+kt}var ot=!1;function Fe(t,i){if(!t||ot)return"";ot=!0;var a=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var o={DetermineComponentFrameRoot:function(){try{if(i){var pe=function(){throw Error()};if(Object.defineProperty(pe.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(pe,[])}catch(oe){var se=oe}Reflect.construct(t,[],pe)}else{try{pe.call()}catch(oe){se=oe}t.call(pe.prototype)}}else{try{throw Error()}catch(oe){se=oe}(pe=t())&&typeof pe.catch=="function"&&pe.catch(function(){})}}catch(oe){if(oe&&se&&typeof oe.stack=="string")return[oe.stack,se.stack]}return[null,null]}};o.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var h=Object.getOwnPropertyDescriptor(o.DetermineComponentFrameRoot,"name");h&&h.configurable&&Object.defineProperty(o.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var p=o.DetermineComponentFrameRoot(),v=p[0],E=p[1];if(v&&E){var I=v.split(`
44
+ `),ie=E.split(`
45
+ `);for(h=o=0;o<I.length&&!I[o].includes("DetermineComponentFrameRoot");)o++;for(;h<ie.length&&!ie[h].includes("DetermineComponentFrameRoot");)h++;if(o===I.length||h===ie.length)for(o=I.length-1,h=ie.length-1;1<=o&&0<=h&&I[o]!==ie[h];)h--;for(;1<=o&&0<=h;o--,h--)if(I[o]!==ie[h]){if(o!==1||h!==1)do if(o--,h--,0>h||I[o]!==ie[h]){var ce=`
46
+ `+I[o].replace(" at new "," at ");return t.displayName&&ce.includes("<anonymous>")&&(ce=ce.replace("<anonymous>",t.displayName)),ce}while(1<=o&&0<=h);break}}}finally{ot=!1,Error.prepareStackTrace=a}return(a=t?t.displayName||t.name:"")?Ke(a):""}function He(t,i){switch(t.tag){case 26:case 27:case 5:return Ke(t.type);case 16:return Ke("Lazy");case 13:return t.child!==i&&i!==null?Ke("Suspense Fallback"):Ke("Suspense");case 19:return Ke("SuspenseList");case 0:case 15:return Fe(t.type,!1);case 11:return Fe(t.type.render,!1);case 1:return Fe(t.type,!0);case 31:return Ke("Activity");default:return""}}function et(t){try{var i="",a=null;do i+=He(t,a),a=t,t=t.return;while(t);return i}catch(o){return`
47
+ Error generating stack: `+o.message+`
48
+ `+o.stack}}var mt=Object.prototype.hasOwnProperty,it=e.unstable_scheduleCallback,Pt=e.unstable_cancelCallback,Nt=e.unstable_shouldYield,Tn=e.unstable_requestPaint,xt=e.unstable_now,jn=e.unstable_getCurrentPriorityLevel,fe=e.unstable_ImmediatePriority,we=e.unstable_UserBlockingPriority,Ue=e.unstable_NormalPriority,$e=e.unstable_LowPriority,at=e.unstable_IdlePriority,rn=e.log,xn=e.unstable_setDisableYieldValue,Gt=null,ge=null;function Le(t){if(typeof rn=="function"&&xn(t),ge&&typeof ge.setStrictMode=="function")try{ge.setStrictMode(Gt,t)}catch{}}var Se=Math.clz32?Math.clz32:Nn,ht=Math.log,pt=Math.LN2;function Nn(t){return t>>>=0,t===0?32:31-(ht(t)/pt|0)|0}var ri=256,Nr=262144,ii=4194304;function lr(t){var i=t&42;if(i!==0)return i;switch(t&-t){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return t&261888;case 262144:case 524288:case 1048576:case 2097152:return t&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return t&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return t}}function Ii(t,i,a){var o=t.pendingLanes;if(o===0)return 0;var h=0,p=t.suspendedLanes,v=t.pingedLanes;t=t.warmLanes;var E=o&134217727;return E!==0?(o=E&~p,o!==0?h=lr(o):(v&=E,v!==0?h=lr(v):a||(a=E&~t,a!==0&&(h=lr(a))))):(E=o&~p,E!==0?h=lr(E):v!==0?h=lr(v):a||(a=o&~t,a!==0&&(h=lr(a)))),h===0?0:i!==0&&i!==h&&(i&p)===0&&(p=h&-h,a=i&-i,p>=a||p===32&&(a&4194048)!==0)?i:h}function Fi(t,i){return(t.pendingLanes&~(t.suspendedLanes&~t.pingedLanes)&i)===0}function Ea(t,i){switch(t){case 1:case 2:case 4:case 8:case 64:return i+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 i+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 gs(){var t=ii;return ii<<=1,(ii&62914560)===0&&(ii=4194304),t}function si(t){for(var i=[],a=0;31>a;a++)i.push(t);return i}function or(t,i){t.pendingLanes|=i,i!==268435456&&(t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0)}function ai(t,i,a,o,h,p){var v=t.pendingLanes;t.pendingLanes=a,t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0,t.expiredLanes&=a,t.entangledLanes&=a,t.errorRecoveryDisabledLanes&=a,t.shellSuspendCounter=0;var E=t.entanglements,I=t.expirationTimes,ie=t.hiddenUpdates;for(a=v&~a;0<a;){var ce=31-Se(a),pe=1<<ce;E[ce]=0,I[ce]=-1;var se=ie[ce];if(se!==null)for(ie[ce]=null,ce=0;ce<se.length;ce++){var oe=se[ce];oe!==null&&(oe.lane&=-536870913)}a&=~pe}o!==0&&li(t,o,0),p!==0&&h===0&&t.tag!==0&&(t.suspendedLanes|=p&~(v&~i))}function li(t,i,a){t.pendingLanes|=i,t.suspendedLanes&=~i;var o=31-Se(i);t.entangledLanes|=i,t.entanglements[o]=t.entanglements[o]|1073741824|a&261930}function $i(t,i){var a=t.entangledLanes|=i;for(t=t.entanglements;a;){var o=31-Se(a),h=1<<o;h&i|t[o]&i&&(t[o]|=i),a&=~h}}function oi(t,i){var a=i&-i;return a=(a&42)!==0?1:Or(a),(a&(t.suspendedLanes|i))!==0?0:a}function Or(t){switch(t){case 2:t=1;break;case 8:t=4;break;case 32:t=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:t=128;break;case 268435456:t=134217728;break;default:t=0}return t}function Yi(t){return t&=-t,2<t?8<t?(t&134217727)!==0?32:268435456:8:2}function ka(){var t=V.p;return t!==0?t:(t=window.event,t===void 0?32:Uy(t.type))}function Xl(t,i){var a=V.p;try{return V.p=t,i()}finally{V.p=a}}var yr=Math.random().toString(36).slice(2),Ct="__reactFiber$"+yr,qt="__reactProps$"+yr,On="__reactContainer$"+yr,Gi="__reactEvents$"+yr,Ca="__reactListeners$"+yr,Kl="__reactHandles$"+yr,Ql="__reactResources$"+yr,Zt="__reactMarker$"+yr;function ys(t){delete t[Ct],delete t[qt],delete t[Gi],delete t[Ca],delete t[Kl]}function k(t){var i=t[Ct];if(i)return i;for(var a=t.parentNode;a;){if(i=a[On]||a[Ct]){if(a=i.alternate,i.child!==null||a!==null&&a.child!==null)for(t=wy(t);t!==null;){if(a=t[Ct])return a;t=wy(t)}return i}t=a,a=t.parentNode}return null}function O(t){if(t=t[Ct]||t[On]){var i=t.tag;if(i===5||i===6||i===13||i===31||i===26||i===27||i===3)return t}return null}function j(t){var i=t.tag;if(i===5||i===26||i===27||i===6)return t.stateNode;throw Error(s(33))}function U(t){var i=t[Ql];return i||(i=t[Ql]={hoistableStyles:new Map,hoistableScripts:new Map}),i}function Y(t){t[Zt]=!0}var ee=new Set,me={};function ye(t,i){le(t,i),le(t+"Capture",i)}function le(t,i){for(me[t]=i,t=0;t<i.length;t++)ee.add(i[t])}var de=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]*$"),Oe={},Xe={};function Ot(t){return mt.call(Xe,t)?!0:mt.call(Oe,t)?!1:de.test(t)?Xe[t]=!0:(Oe[t]=!0,!1)}function un(t,i,a){if(Ot(i))if(a===null)t.removeAttribute(i);else{switch(typeof a){case"undefined":case"function":case"symbol":t.removeAttribute(i);return;case"boolean":var o=i.toLowerCase().slice(0,5);if(o!=="data-"&&o!=="aria-"){t.removeAttribute(i);return}}t.setAttribute(i,""+a)}}function ur(t,i,a){if(a===null)t.removeAttribute(i);else{switch(typeof a){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(i);return}t.setAttribute(i,""+a)}}function Rr(t,i,a,o){if(o===null)t.removeAttribute(a);else{switch(typeof o){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(a);return}t.setAttributeNS(i,a,""+o)}}function Vn(t){switch(typeof t){case"bigint":case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function sm(t){var i=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(i==="checkbox"||i==="radio")}function q1(t,i,a){var o=Object.getOwnPropertyDescriptor(t.constructor.prototype,i);if(!t.hasOwnProperty(i)&&typeof o<"u"&&typeof o.get=="function"&&typeof o.set=="function"){var h=o.get,p=o.set;return Object.defineProperty(t,i,{configurable:!0,get:function(){return h.call(this)},set:function(v){a=""+v,p.call(this,v)}}),Object.defineProperty(t,i,{enumerable:o.enumerable}),{getValue:function(){return a},setValue:function(v){a=""+v},stopTracking:function(){t._valueTracker=null,delete t[i]}}}}function ec(t){if(!t._valueTracker){var i=sm(t)?"checked":"value";t._valueTracker=q1(t,i,""+t[i])}}function am(t){if(!t)return!1;var i=t._valueTracker;if(!i)return!0;var a=i.getValue(),o="";return t&&(o=sm(t)?t.checked?"true":"false":t.value),t=o,t!==a?(i.setValue(t),!0):!1}function Zl(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}var H1=/[\n"\\]/g;function Jn(t){return t.replace(H1,function(i){return"\\"+i.charCodeAt(0).toString(16)+" "})}function tc(t,i,a,o,h,p,v,E){t.name="",v!=null&&typeof v!="function"&&typeof v!="symbol"&&typeof v!="boolean"?t.type=v:t.removeAttribute("type"),i!=null?v==="number"?(i===0&&t.value===""||t.value!=i)&&(t.value=""+Vn(i)):t.value!==""+Vn(i)&&(t.value=""+Vn(i)):v!=="submit"&&v!=="reset"||t.removeAttribute("value"),i!=null?nc(t,v,Vn(i)):a!=null?nc(t,v,Vn(a)):o!=null&&t.removeAttribute("value"),h==null&&p!=null&&(t.defaultChecked=!!p),h!=null&&(t.checked=h&&typeof h!="function"&&typeof h!="symbol"),E!=null&&typeof E!="function"&&typeof E!="symbol"&&typeof E!="boolean"?t.name=""+Vn(E):t.removeAttribute("name")}function lm(t,i,a,o,h,p,v,E){if(p!=null&&typeof p!="function"&&typeof p!="symbol"&&typeof p!="boolean"&&(t.type=p),i!=null||a!=null){if(!(p!=="submit"&&p!=="reset"||i!=null)){ec(t);return}a=a!=null?""+Vn(a):"",i=i!=null?""+Vn(i):a,E||i===t.value||(t.value=i),t.defaultValue=i}o=o??h,o=typeof o!="function"&&typeof o!="symbol"&&!!o,t.checked=E?t.checked:!!o,t.defaultChecked=!!o,v!=null&&typeof v!="function"&&typeof v!="symbol"&&typeof v!="boolean"&&(t.name=v),ec(t)}function nc(t,i,a){i==="number"&&Zl(t.ownerDocument)===t||t.defaultValue===""+a||(t.defaultValue=""+a)}function bs(t,i,a,o){if(t=t.options,i){i={};for(var h=0;h<a.length;h++)i["$"+a[h]]=!0;for(a=0;a<t.length;a++)h=i.hasOwnProperty("$"+t[a].value),t[a].selected!==h&&(t[a].selected=h),h&&o&&(t[a].defaultSelected=!0)}else{for(a=""+Vn(a),i=null,h=0;h<t.length;h++){if(t[h].value===a){t[h].selected=!0,o&&(t[h].defaultSelected=!0);return}i!==null||t[h].disabled||(i=t[h])}i!==null&&(i.selected=!0)}}function om(t,i,a){if(i!=null&&(i=""+Vn(i),i!==t.value&&(t.value=i),a==null)){t.defaultValue!==i&&(t.defaultValue=i);return}t.defaultValue=a!=null?""+Vn(a):""}function um(t,i,a,o){if(i==null){if(o!=null){if(a!=null)throw Error(s(92));if(F(o)){if(1<o.length)throw Error(s(93));o=o[0]}a=o}a==null&&(a=""),i=a}a=Vn(i),t.defaultValue=a,o=t.textContent,o===a&&o!==""&&o!==null&&(t.value=o),ec(t)}function xs(t,i){if(i){var a=t.firstChild;if(a&&a===t.lastChild&&a.nodeType===3){a.nodeValue=i;return}}t.textContent=i}var I1=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 cm(t,i,a){var o=i.indexOf("--")===0;a==null||typeof a=="boolean"||a===""?o?t.setProperty(i,""):i==="float"?t.cssFloat="":t[i]="":o?t.setProperty(i,a):typeof a!="number"||a===0||I1.has(i)?i==="float"?t.cssFloat=a:t[i]=(""+a).trim():t[i]=a+"px"}function fm(t,i,a){if(i!=null&&typeof i!="object")throw Error(s(62));if(t=t.style,a!=null){for(var o in a)!a.hasOwnProperty(o)||i!=null&&i.hasOwnProperty(o)||(o.indexOf("--")===0?t.setProperty(o,""):o==="float"?t.cssFloat="":t[o]="");for(var h in i)o=i[h],i.hasOwnProperty(h)&&a[h]!==o&&cm(t,h,o)}else for(var p in i)i.hasOwnProperty(p)&&cm(t,p,i[p])}function rc(t){if(t.indexOf("-")===-1)return!1;switch(t){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var F1=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),$1=/^[\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 Wl(t){return $1.test(""+t)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":t}function Mr(){}var ic=null;function sc(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var vs=null,ws=null;function hm(t){var i=O(t);if(i&&(t=i.stateNode)){var a=t[qt]||null;e:switch(t=i.stateNode,i.type){case"input":if(tc(t,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name),i=a.name,a.type==="radio"&&i!=null){for(a=t;a.parentNode;)a=a.parentNode;for(a=a.querySelectorAll('input[name="'+Jn(""+i)+'"][type="radio"]'),i=0;i<a.length;i++){var o=a[i];if(o!==t&&o.form===t.form){var h=o[qt]||null;if(!h)throw Error(s(90));tc(o,h.value,h.defaultValue,h.defaultValue,h.checked,h.defaultChecked,h.type,h.name)}}for(i=0;i<a.length;i++)o=a[i],o.form===t.form&&am(o)}break e;case"textarea":om(t,a.value,a.defaultValue);break e;case"select":i=a.value,i!=null&&bs(t,!!a.multiple,i,!1)}}}var ac=!1;function dm(t,i,a){if(ac)return t(i,a);ac=!0;try{var o=t(i);return o}finally{if(ac=!1,(vs!==null||ws!==null)&&(Ho(),vs&&(i=vs,t=ws,ws=vs=null,hm(i),t)))for(i=0;i<t.length;i++)hm(t[i])}}function Aa(t,i){var a=t.stateNode;if(a===null)return null;var o=a[qt]||null;if(o===null)return null;a=o[i];e:switch(i){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(o=!o.disabled)||(t=t.type,o=!(t==="button"||t==="input"||t==="select"||t==="textarea")),t=!o;break e;default:t=!1}if(t)return null;if(a&&typeof a!="function")throw Error(s(231,i,typeof a));return a}var Dr=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),lc=!1;if(Dr)try{var Ta={};Object.defineProperty(Ta,"passive",{get:function(){lc=!0}}),window.addEventListener("test",Ta,Ta),window.removeEventListener("test",Ta,Ta)}catch{lc=!1}var ui=null,oc=null,eo=null;function mm(){if(eo)return eo;var t,i=oc,a=i.length,o,h="value"in ui?ui.value:ui.textContent,p=h.length;for(t=0;t<a&&i[t]===h[t];t++);var v=a-t;for(o=1;o<=v&&i[a-o]===h[p-o];o++);return eo=h.slice(t,1<o?1-o:void 0)}function to(t){var i=t.keyCode;return"charCode"in t?(t=t.charCode,t===0&&i===13&&(t=13)):t=i,t===10&&(t=13),32<=t||t===13?t:0}function no(){return!0}function pm(){return!1}function vn(t){function i(a,o,h,p,v){this._reactName=a,this._targetInst=h,this.type=o,this.nativeEvent=p,this.target=v,this.currentTarget=null;for(var E in t)t.hasOwnProperty(E)&&(a=t[E],this[E]=a?a(p):p[E]);return this.isDefaultPrevented=(p.defaultPrevented!=null?p.defaultPrevented:p.returnValue===!1)?no:pm,this.isPropagationStopped=pm,this}return g(i.prototype,{preventDefault:function(){this.defaultPrevented=!0;var a=this.nativeEvent;a&&(a.preventDefault?a.preventDefault():typeof a.returnValue!="unknown"&&(a.returnValue=!1),this.isDefaultPrevented=no)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=no)},persist:function(){},isPersistent:no}),i}var Vi={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},ro=vn(Vi),ja=g({},Vi,{view:0,detail:0}),Y1=vn(ja),uc,cc,Na,io=g({},ja,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:hc,button:0,buttons:0,relatedTarget:function(t){return t.relatedTarget===void 0?t.fromElement===t.srcElement?t.toElement:t.fromElement:t.relatedTarget},movementX:function(t){return"movementX"in t?t.movementX:(t!==Na&&(Na&&t.type==="mousemove"?(uc=t.screenX-Na.screenX,cc=t.screenY-Na.screenY):cc=uc=0,Na=t),uc)},movementY:function(t){return"movementY"in t?t.movementY:cc}}),gm=vn(io),G1=g({},io,{dataTransfer:0}),V1=vn(G1),J1=g({},ja,{relatedTarget:0}),fc=vn(J1),X1=g({},Vi,{animationName:0,elapsedTime:0,pseudoElement:0}),K1=vn(X1),Q1=g({},Vi,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),Z1=vn(Q1),W1=g({},Vi,{data:0}),ym=vn(W1),ev={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},tv={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"},nv={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function rv(t){var i=this.nativeEvent;return i.getModifierState?i.getModifierState(t):(t=nv[t])?!!i[t]:!1}function hc(){return rv}var iv=g({},ja,{key:function(t){if(t.key){var i=ev[t.key]||t.key;if(i!=="Unidentified")return i}return t.type==="keypress"?(t=to(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?tv[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:hc,charCode:function(t){return t.type==="keypress"?to(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?to(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),sv=vn(iv),av=g({},io,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),bm=vn(av),lv=g({},ja,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:hc}),ov=vn(lv),uv=g({},Vi,{propertyName:0,elapsedTime:0,pseudoElement:0}),cv=vn(uv),fv=g({},io,{deltaX:function(t){return"deltaX"in t?t.deltaX:"wheelDeltaX"in t?-t.wheelDeltaX:0},deltaY:function(t){return"deltaY"in t?t.deltaY:"wheelDeltaY"in t?-t.wheelDeltaY:"wheelDelta"in t?-t.wheelDelta:0},deltaZ:0,deltaMode:0}),hv=vn(fv),dv=g({},Vi,{newState:0,oldState:0}),mv=vn(dv),pv=[9,13,27,32],dc=Dr&&"CompositionEvent"in window,Oa=null;Dr&&"documentMode"in document&&(Oa=document.documentMode);var gv=Dr&&"TextEvent"in window&&!Oa,xm=Dr&&(!dc||Oa&&8<Oa&&11>=Oa),vm=" ",wm=!1;function Sm(t,i){switch(t){case"keyup":return pv.indexOf(i.keyCode)!==-1;case"keydown":return i.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function _m(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var Ss=!1;function yv(t,i){switch(t){case"compositionend":return _m(i);case"keypress":return i.which!==32?null:(wm=!0,vm);case"textInput":return t=i.data,t===vm&&wm?null:t;default:return null}}function bv(t,i){if(Ss)return t==="compositionend"||!dc&&Sm(t,i)?(t=mm(),eo=oc=ui=null,Ss=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(i.ctrlKey||i.altKey||i.metaKey)||i.ctrlKey&&i.altKey){if(i.char&&1<i.char.length)return i.char;if(i.which)return String.fromCharCode(i.which)}return null;case"compositionend":return xm&&i.locale!=="ko"?null:i.data;default:return null}}var xv={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 Em(t){var i=t&&t.nodeName&&t.nodeName.toLowerCase();return i==="input"?!!xv[t.type]:i==="textarea"}function km(t,i,a,o){vs?ws?ws.push(o):ws=[o]:vs=o,i=Jo(i,"onChange"),0<i.length&&(a=new ro("onChange","change",null,a,o),t.push({event:a,listeners:i}))}var Ra=null,Ma=null;function vv(t){ly(t,0)}function so(t){var i=j(t);if(am(i))return t}function Cm(t,i){if(t==="change")return i}var Am=!1;if(Dr){var mc;if(Dr){var pc="oninput"in document;if(!pc){var Tm=document.createElement("div");Tm.setAttribute("oninput","return;"),pc=typeof Tm.oninput=="function"}mc=pc}else mc=!1;Am=mc&&(!document.documentMode||9<document.documentMode)}function jm(){Ra&&(Ra.detachEvent("onpropertychange",Nm),Ma=Ra=null)}function Nm(t){if(t.propertyName==="value"&&so(Ma)){var i=[];km(i,Ma,t,sc(t)),dm(vv,i)}}function wv(t,i,a){t==="focusin"?(jm(),Ra=i,Ma=a,Ra.attachEvent("onpropertychange",Nm)):t==="focusout"&&jm()}function Sv(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return so(Ma)}function _v(t,i){if(t==="click")return so(i)}function Ev(t,i){if(t==="input"||t==="change")return so(i)}function kv(t,i){return t===i&&(t!==0||1/t===1/i)||t!==t&&i!==i}var Rn=typeof Object.is=="function"?Object.is:kv;function Da(t,i){if(Rn(t,i))return!0;if(typeof t!="object"||t===null||typeof i!="object"||i===null)return!1;var a=Object.keys(t),o=Object.keys(i);if(a.length!==o.length)return!1;for(o=0;o<a.length;o++){var h=a[o];if(!mt.call(i,h)||!Rn(t[h],i[h]))return!1}return!0}function Om(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function Rm(t,i){var a=Om(t);t=0;for(var o;a;){if(a.nodeType===3){if(o=t+a.textContent.length,t<=i&&o>=i)return{node:a,offset:i-t};t=o}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=Om(a)}}function Mm(t,i){return t&&i?t===i?!0:t&&t.nodeType===3?!1:i&&i.nodeType===3?Mm(t,i.parentNode):"contains"in t?t.contains(i):t.compareDocumentPosition?!!(t.compareDocumentPosition(i)&16):!1:!1}function Dm(t){t=t!=null&&t.ownerDocument!=null&&t.ownerDocument.defaultView!=null?t.ownerDocument.defaultView:window;for(var i=Zl(t.document);i instanceof t.HTMLIFrameElement;){try{var a=typeof i.contentWindow.location.href=="string"}catch{a=!1}if(a)t=i.contentWindow;else break;i=Zl(t.document)}return i}function gc(t){var i=t&&t.nodeName&&t.nodeName.toLowerCase();return i&&(i==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||i==="textarea"||t.contentEditable==="true")}var Cv=Dr&&"documentMode"in document&&11>=document.documentMode,_s=null,yc=null,La=null,bc=!1;function Lm(t,i,a){var o=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;bc||_s==null||_s!==Zl(o)||(o=_s,"selectionStart"in o&&gc(o)?o={start:o.selectionStart,end:o.selectionEnd}:(o=(o.ownerDocument&&o.ownerDocument.defaultView||window).getSelection(),o={anchorNode:o.anchorNode,anchorOffset:o.anchorOffset,focusNode:o.focusNode,focusOffset:o.focusOffset}),La&&Da(La,o)||(La=o,o=Jo(yc,"onSelect"),0<o.length&&(i=new ro("onSelect","select",null,i,a),t.push({event:i,listeners:o}),i.target=_s)))}function Ji(t,i){var a={};return a[t.toLowerCase()]=i.toLowerCase(),a["Webkit"+t]="webkit"+i,a["Moz"+t]="moz"+i,a}var Es={animationend:Ji("Animation","AnimationEnd"),animationiteration:Ji("Animation","AnimationIteration"),animationstart:Ji("Animation","AnimationStart"),transitionrun:Ji("Transition","TransitionRun"),transitionstart:Ji("Transition","TransitionStart"),transitioncancel:Ji("Transition","TransitionCancel"),transitionend:Ji("Transition","TransitionEnd")},xc={},zm={};Dr&&(zm=document.createElement("div").style,"AnimationEvent"in window||(delete Es.animationend.animation,delete Es.animationiteration.animation,delete Es.animationstart.animation),"TransitionEvent"in window||delete Es.transitionend.transition);function Xi(t){if(xc[t])return xc[t];if(!Es[t])return t;var i=Es[t],a;for(a in i)if(i.hasOwnProperty(a)&&a in zm)return xc[t]=i[a];return t}var Um=Xi("animationend"),Bm=Xi("animationiteration"),Pm=Xi("animationstart"),Av=Xi("transitionrun"),Tv=Xi("transitionstart"),jv=Xi("transitioncancel"),qm=Xi("transitionend"),Hm=new Map,vc="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");vc.push("scrollEnd");function cr(t,i){Hm.set(t,i),ye(i,[t])}var ao=typeof reportError=="function"?reportError:function(t){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var i=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof t=="object"&&t!==null&&typeof t.message=="string"?String(t.message):String(t),error:t});if(!window.dispatchEvent(i))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",t);return}console.error(t)},Xn=[],ks=0,wc=0;function lo(){for(var t=ks,i=wc=ks=0;i<t;){var a=Xn[i];Xn[i++]=null;var o=Xn[i];Xn[i++]=null;var h=Xn[i];Xn[i++]=null;var p=Xn[i];if(Xn[i++]=null,o!==null&&h!==null){var v=o.pending;v===null?h.next=h:(h.next=v.next,v.next=h),o.pending=h}p!==0&&Im(a,h,p)}}function oo(t,i,a,o){Xn[ks++]=t,Xn[ks++]=i,Xn[ks++]=a,Xn[ks++]=o,wc|=o,t.lanes|=o,t=t.alternate,t!==null&&(t.lanes|=o)}function Sc(t,i,a,o){return oo(t,i,a,o),uo(t)}function Ki(t,i){return oo(t,null,null,i),uo(t)}function Im(t,i,a){t.lanes|=a;var o=t.alternate;o!==null&&(o.lanes|=a);for(var h=!1,p=t.return;p!==null;)p.childLanes|=a,o=p.alternate,o!==null&&(o.childLanes|=a),p.tag===22&&(t=p.stateNode,t===null||t._visibility&1||(h=!0)),t=p,p=p.return;return t.tag===3?(p=t.stateNode,h&&i!==null&&(h=31-Se(a),t=p.hiddenUpdates,o=t[h],o===null?t[h]=[i]:o.push(i),i.lane=a|536870912),p):null}function uo(t){if(50<rl)throw rl=0,Rf=null,Error(s(185));for(var i=t.return;i!==null;)t=i,i=t.return;return t.tag===3?t.stateNode:null}var Cs={};function Nv(t,i,a,o){this.tag=t,this.key=a,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=i,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=o,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Mn(t,i,a,o){return new Nv(t,i,a,o)}function _c(t){return t=t.prototype,!(!t||!t.isReactComponent)}function Lr(t,i){var a=t.alternate;return a===null?(a=Mn(t.tag,i,t.key,t.mode),a.elementType=t.elementType,a.type=t.type,a.stateNode=t.stateNode,a.alternate=t,t.alternate=a):(a.pendingProps=i,a.type=t.type,a.flags=0,a.subtreeFlags=0,a.deletions=null),a.flags=t.flags&65011712,a.childLanes=t.childLanes,a.lanes=t.lanes,a.child=t.child,a.memoizedProps=t.memoizedProps,a.memoizedState=t.memoizedState,a.updateQueue=t.updateQueue,i=t.dependencies,a.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext},a.sibling=t.sibling,a.index=t.index,a.ref=t.ref,a.refCleanup=t.refCleanup,a}function Fm(t,i){t.flags&=65011714;var a=t.alternate;return a===null?(t.childLanes=0,t.lanes=i,t.child=null,t.subtreeFlags=0,t.memoizedProps=null,t.memoizedState=null,t.updateQueue=null,t.dependencies=null,t.stateNode=null):(t.childLanes=a.childLanes,t.lanes=a.lanes,t.child=a.child,t.subtreeFlags=0,t.deletions=null,t.memoizedProps=a.memoizedProps,t.memoizedState=a.memoizedState,t.updateQueue=a.updateQueue,t.type=a.type,i=a.dependencies,t.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext}),t}function co(t,i,a,o,h,p){var v=0;if(o=t,typeof t=="function")_c(t)&&(v=1);else if(typeof t=="string")v=Lw(t,a,ve.current)?26:t==="html"||t==="head"||t==="body"?27:5;else e:switch(t){case H:return t=Mn(31,a,i,h),t.elementType=H,t.lanes=p,t;case D:return Qi(a.children,h,p,i);case q:v=8,h|=24;break;case L:return t=Mn(12,a,i,h|2),t.elementType=L,t.lanes=p,t;case B:return t=Mn(13,a,i,h),t.elementType=B,t.lanes=p,t;case z:return t=Mn(19,a,i,h),t.elementType=z,t.lanes=p,t;default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case T:v=10;break e;case $:v=9;break e;case te:v=11;break e;case K:v=14;break e;case Q:v=16,o=null;break e}v=29,a=Error(s(130,t===null?"null":typeof t,"")),o=null}return i=Mn(v,a,i,h),i.elementType=t,i.type=o,i.lanes=p,i}function Qi(t,i,a,o){return t=Mn(7,t,o,i),t.lanes=a,t}function Ec(t,i,a){return t=Mn(6,t,null,i),t.lanes=a,t}function $m(t){var i=Mn(18,null,null,0);return i.stateNode=t,i}function kc(t,i,a){return i=Mn(4,t.children!==null?t.children:[],t.key,i),i.lanes=a,i.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},i}var Ym=new WeakMap;function Kn(t,i){if(typeof t=="object"&&t!==null){var a=Ym.get(t);return a!==void 0?a:(i={value:t,source:i,stack:et(i)},Ym.set(t,i),i)}return{value:t,source:i,stack:et(i)}}var As=[],Ts=0,fo=null,za=0,Qn=[],Zn=0,ci=null,br=1,xr="";function zr(t,i){As[Ts++]=za,As[Ts++]=fo,fo=t,za=i}function Gm(t,i,a){Qn[Zn++]=br,Qn[Zn++]=xr,Qn[Zn++]=ci,ci=t;var o=br;t=xr;var h=32-Se(o)-1;o&=~(1<<h),a+=1;var p=32-Se(i)+h;if(30<p){var v=h-h%5;p=(o&(1<<v)-1).toString(32),o>>=v,h-=v,br=1<<32-Se(i)+h|a<<h|o,xr=p+t}else br=1<<p|a<<h|o,xr=t}function Cc(t){t.return!==null&&(zr(t,1),Gm(t,1,0))}function Ac(t){for(;t===fo;)fo=As[--Ts],As[Ts]=null,za=As[--Ts],As[Ts]=null;for(;t===ci;)ci=Qn[--Zn],Qn[Zn]=null,xr=Qn[--Zn],Qn[Zn]=null,br=Qn[--Zn],Qn[Zn]=null}function Vm(t,i){Qn[Zn++]=br,Qn[Zn++]=xr,Qn[Zn++]=ci,br=i.id,xr=i.overflow,ci=t}var sn=null,Rt=null,st=!1,fi=null,Wn=!1,Tc=Error(s(519));function hi(t){var i=Error(s(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Ua(Kn(i,t)),Tc}function Jm(t){var i=t.stateNode,a=t.type,o=t.memoizedProps;switch(i[Ct]=t,i[qt]=o,a){case"dialog":Ze("cancel",i),Ze("close",i);break;case"iframe":case"object":case"embed":Ze("load",i);break;case"video":case"audio":for(a=0;a<sl.length;a++)Ze(sl[a],i);break;case"source":Ze("error",i);break;case"img":case"image":case"link":Ze("error",i),Ze("load",i);break;case"details":Ze("toggle",i);break;case"input":Ze("invalid",i),lm(i,o.value,o.defaultValue,o.checked,o.defaultChecked,o.type,o.name,!0);break;case"select":Ze("invalid",i);break;case"textarea":Ze("invalid",i),um(i,o.value,o.defaultValue,o.children)}a=o.children,typeof a!="string"&&typeof a!="number"&&typeof a!="bigint"||i.textContent===""+a||o.suppressHydrationWarning===!0||fy(i.textContent,a)?(o.popover!=null&&(Ze("beforetoggle",i),Ze("toggle",i)),o.onScroll!=null&&Ze("scroll",i),o.onScrollEnd!=null&&Ze("scrollend",i),o.onClick!=null&&(i.onclick=Mr),i=!0):i=!1,i||hi(t,!0)}function Xm(t){for(sn=t.return;sn;)switch(sn.tag){case 5:case 31:case 13:Wn=!1;return;case 27:case 3:Wn=!0;return;default:sn=sn.return}}function js(t){if(t!==sn)return!1;if(!st)return Xm(t),st=!0,!1;var i=t.tag,a;if((a=i!==3&&i!==27)&&((a=i===5)&&(a=t.type,a=!(a!=="form"&&a!=="button")||Vf(t.type,t.memoizedProps)),a=!a),a&&Rt&&hi(t),Xm(t),i===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(s(317));Rt=vy(t)}else if(i===31){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(s(317));Rt=vy(t)}else i===27?(i=Rt,Ci(t.type)?(t=Zf,Zf=null,Rt=t):Rt=i):Rt=sn?tr(t.stateNode.nextSibling):null;return!0}function Zi(){Rt=sn=null,st=!1}function jc(){var t=fi;return t!==null&&(En===null?En=t:En.push.apply(En,t),fi=null),t}function Ua(t){fi===null?fi=[t]:fi.push(t)}var Nc=M(null),Wi=null,Ur=null;function di(t,i,a){A(Nc,i._currentValue),i._currentValue=a}function Br(t){t._currentValue=Nc.current,W(Nc)}function Oc(t,i,a){for(;t!==null;){var o=t.alternate;if((t.childLanes&i)!==i?(t.childLanes|=i,o!==null&&(o.childLanes|=i)):o!==null&&(o.childLanes&i)!==i&&(o.childLanes|=i),t===a)break;t=t.return}}function Rc(t,i,a,o){var h=t.child;for(h!==null&&(h.return=t);h!==null;){var p=h.dependencies;if(p!==null){var v=h.child;p=p.firstContext;e:for(;p!==null;){var E=p;p=h;for(var I=0;I<i.length;I++)if(E.context===i[I]){p.lanes|=a,E=p.alternate,E!==null&&(E.lanes|=a),Oc(p.return,a,t),o||(v=null);break e}p=E.next}}else if(h.tag===18){if(v=h.return,v===null)throw Error(s(341));v.lanes|=a,p=v.alternate,p!==null&&(p.lanes|=a),Oc(v,a,t),v=null}else v=h.child;if(v!==null)v.return=h;else for(v=h;v!==null;){if(v===t){v=null;break}if(h=v.sibling,h!==null){h.return=v.return,v=h;break}v=v.return}h=v}}function Ns(t,i,a,o){t=null;for(var h=i,p=!1;h!==null;){if(!p){if((h.flags&524288)!==0)p=!0;else if((h.flags&262144)!==0)break}if(h.tag===10){var v=h.alternate;if(v===null)throw Error(s(387));if(v=v.memoizedProps,v!==null){var E=h.type;Rn(h.pendingProps.value,v.value)||(t!==null?t.push(E):t=[E])}}else if(h===ze.current){if(v=h.alternate,v===null)throw Error(s(387));v.memoizedState.memoizedState!==h.memoizedState.memoizedState&&(t!==null?t.push(cl):t=[cl])}h=h.return}t!==null&&Rc(i,t,a,o),i.flags|=262144}function ho(t){for(t=t.firstContext;t!==null;){if(!Rn(t.context._currentValue,t.memoizedValue))return!0;t=t.next}return!1}function es(t){Wi=t,Ur=null,t=t.dependencies,t!==null&&(t.firstContext=null)}function an(t){return Km(Wi,t)}function mo(t,i){return Wi===null&&es(t),Km(t,i)}function Km(t,i){var a=i._currentValue;if(i={context:i,memoizedValue:a,next:null},Ur===null){if(t===null)throw Error(s(308));Ur=i,t.dependencies={lanes:0,firstContext:i},t.flags|=524288}else Ur=Ur.next=i;return a}var Ov=typeof AbortController<"u"?AbortController:function(){var t=[],i=this.signal={aborted:!1,addEventListener:function(a,o){t.push(o)}};this.abort=function(){i.aborted=!0,t.forEach(function(a){return a()})}},Rv=e.unstable_scheduleCallback,Mv=e.unstable_NormalPriority,Vt={$$typeof:T,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Mc(){return{controller:new Ov,data:new Map,refCount:0}}function Ba(t){t.refCount--,t.refCount===0&&Rv(Mv,function(){t.controller.abort()})}var Pa=null,Dc=0,Os=0,Rs=null;function Dv(t,i){if(Pa===null){var a=Pa=[];Dc=0,Os=Bf(),Rs={status:"pending",value:void 0,then:function(o){a.push(o)}}}return Dc++,i.then(Qm,Qm),i}function Qm(){if(--Dc===0&&Pa!==null){Rs!==null&&(Rs.status="fulfilled");var t=Pa;Pa=null,Os=0,Rs=null;for(var i=0;i<t.length;i++)(0,t[i])()}}function Lv(t,i){var a=[],o={status:"pending",value:null,reason:null,then:function(h){a.push(h)}};return t.then(function(){o.status="fulfilled",o.value=i;for(var h=0;h<a.length;h++)(0,a[h])(i)},function(h){for(o.status="rejected",o.reason=h,h=0;h<a.length;h++)(0,a[h])(void 0)}),o}var Zm=P.S;P.S=function(t,i){Lg=xt(),typeof i=="object"&&i!==null&&typeof i.then=="function"&&Dv(t,i),Zm!==null&&Zm(t,i)};var ts=M(null);function Lc(){var t=ts.current;return t!==null?t:At.pooledCache}function po(t,i){i===null?A(ts,ts.current):A(ts,i.pool)}function Wm(){var t=Lc();return t===null?null:{parent:Vt._currentValue,pool:t}}var Ms=Error(s(460)),zc=Error(s(474)),go=Error(s(542)),yo={then:function(){}};function ep(t){return t=t.status,t==="fulfilled"||t==="rejected"}function tp(t,i,a){switch(a=t[a],a===void 0?t.push(i):a!==i&&(i.then(Mr,Mr),i=a),i.status){case"fulfilled":return i.value;case"rejected":throw t=i.reason,rp(t),t;default:if(typeof i.status=="string")i.then(Mr,Mr);else{if(t=At,t!==null&&100<t.shellSuspendCounter)throw Error(s(482));t=i,t.status="pending",t.then(function(o){if(i.status==="pending"){var h=i;h.status="fulfilled",h.value=o}},function(o){if(i.status==="pending"){var h=i;h.status="rejected",h.reason=o}})}switch(i.status){case"fulfilled":return i.value;case"rejected":throw t=i.reason,rp(t),t}throw rs=i,Ms}}function ns(t){try{var i=t._init;return i(t._payload)}catch(a){throw a!==null&&typeof a=="object"&&typeof a.then=="function"?(rs=a,Ms):a}}var rs=null;function np(){if(rs===null)throw Error(s(459));var t=rs;return rs=null,t}function rp(t){if(t===Ms||t===go)throw Error(s(483))}var Ds=null,qa=0;function bo(t){var i=qa;return qa+=1,Ds===null&&(Ds=[]),tp(Ds,t,i)}function Ha(t,i){i=i.props.ref,t.ref=i!==void 0?i:null}function xo(t,i){throw i.$$typeof===x?Error(s(525)):(t=Object.prototype.toString.call(i),Error(s(31,t==="[object Object]"?"object with keys {"+Object.keys(i).join(", ")+"}":t)))}function ip(t){function i(Z,G){if(t){var ne=Z.deletions;ne===null?(Z.deletions=[G],Z.flags|=16):ne.push(G)}}function a(Z,G){if(!t)return null;for(;G!==null;)i(Z,G),G=G.sibling;return null}function o(Z){for(var G=new Map;Z!==null;)Z.key!==null?G.set(Z.key,Z):G.set(Z.index,Z),Z=Z.sibling;return G}function h(Z,G){return Z=Lr(Z,G),Z.index=0,Z.sibling=null,Z}function p(Z,G,ne){return Z.index=ne,t?(ne=Z.alternate,ne!==null?(ne=ne.index,ne<G?(Z.flags|=67108866,G):ne):(Z.flags|=67108866,G)):(Z.flags|=1048576,G)}function v(Z){return t&&Z.alternate===null&&(Z.flags|=67108866),Z}function E(Z,G,ne,he){return G===null||G.tag!==6?(G=Ec(ne,Z.mode,he),G.return=Z,G):(G=h(G,ne),G.return=Z,G)}function I(Z,G,ne,he){var De=ne.type;return De===D?ce(Z,G,ne.props.children,he,ne.key):G!==null&&(G.elementType===De||typeof De=="object"&&De!==null&&De.$$typeof===Q&&ns(De)===G.type)?(G=h(G,ne.props),Ha(G,ne),G.return=Z,G):(G=co(ne.type,ne.key,ne.props,null,Z.mode,he),Ha(G,ne),G.return=Z,G)}function ie(Z,G,ne,he){return G===null||G.tag!==4||G.stateNode.containerInfo!==ne.containerInfo||G.stateNode.implementation!==ne.implementation?(G=kc(ne,Z.mode,he),G.return=Z,G):(G=h(G,ne.children||[]),G.return=Z,G)}function ce(Z,G,ne,he,De){return G===null||G.tag!==7?(G=Qi(ne,Z.mode,he,De),G.return=Z,G):(G=h(G,ne),G.return=Z,G)}function pe(Z,G,ne){if(typeof G=="string"&&G!==""||typeof G=="number"||typeof G=="bigint")return G=Ec(""+G,Z.mode,ne),G.return=Z,G;if(typeof G=="object"&&G!==null){switch(G.$$typeof){case w:return ne=co(G.type,G.key,G.props,null,Z.mode,ne),Ha(ne,G),ne.return=Z,ne;case S:return G=kc(G,Z.mode,ne),G.return=Z,G;case Q:return G=ns(G),pe(Z,G,ne)}if(F(G)||J(G))return G=Qi(G,Z.mode,ne,null),G.return=Z,G;if(typeof G.then=="function")return pe(Z,bo(G),ne);if(G.$$typeof===T)return pe(Z,mo(Z,G),ne);xo(Z,G)}return null}function se(Z,G,ne,he){var De=G!==null?G.key:null;if(typeof ne=="string"&&ne!==""||typeof ne=="number"||typeof ne=="bigint")return De!==null?null:E(Z,G,""+ne,he);if(typeof ne=="object"&&ne!==null){switch(ne.$$typeof){case w:return ne.key===De?I(Z,G,ne,he):null;case S:return ne.key===De?ie(Z,G,ne,he):null;case Q:return ne=ns(ne),se(Z,G,ne,he)}if(F(ne)||J(ne))return De!==null?null:ce(Z,G,ne,he,null);if(typeof ne.then=="function")return se(Z,G,bo(ne),he);if(ne.$$typeof===T)return se(Z,G,mo(Z,ne),he);xo(Z,ne)}return null}function oe(Z,G,ne,he,De){if(typeof he=="string"&&he!==""||typeof he=="number"||typeof he=="bigint")return Z=Z.get(ne)||null,E(G,Z,""+he,De);if(typeof he=="object"&&he!==null){switch(he.$$typeof){case w:return Z=Z.get(he.key===null?ne:he.key)||null,I(G,Z,he,De);case S:return Z=Z.get(he.key===null?ne:he.key)||null,ie(G,Z,he,De);case Q:return he=ns(he),oe(Z,G,ne,he,De)}if(F(he)||J(he))return Z=Z.get(ne)||null,ce(G,Z,he,De,null);if(typeof he.then=="function")return oe(Z,G,ne,bo(he),De);if(he.$$typeof===T)return oe(Z,G,ne,mo(G,he),De);xo(G,he)}return null}function Re(Z,G,ne,he){for(var De=null,ct=null,Me=G,Ge=G=0,nt=null;Me!==null&&Ge<ne.length;Ge++){Me.index>Ge?(nt=Me,Me=null):nt=Me.sibling;var ft=se(Z,Me,ne[Ge],he);if(ft===null){Me===null&&(Me=nt);break}t&&Me&&ft.alternate===null&&i(Z,Me),G=p(ft,G,Ge),ct===null?De=ft:ct.sibling=ft,ct=ft,Me=nt}if(Ge===ne.length)return a(Z,Me),st&&zr(Z,Ge),De;if(Me===null){for(;Ge<ne.length;Ge++)Me=pe(Z,ne[Ge],he),Me!==null&&(G=p(Me,G,Ge),ct===null?De=Me:ct.sibling=Me,ct=Me);return st&&zr(Z,Ge),De}for(Me=o(Me);Ge<ne.length;Ge++)nt=oe(Me,Z,Ge,ne[Ge],he),nt!==null&&(t&&nt.alternate!==null&&Me.delete(nt.key===null?Ge:nt.key),G=p(nt,G,Ge),ct===null?De=nt:ct.sibling=nt,ct=nt);return t&&Me.forEach(function(Oi){return i(Z,Oi)}),st&&zr(Z,Ge),De}function Pe(Z,G,ne,he){if(ne==null)throw Error(s(151));for(var De=null,ct=null,Me=G,Ge=G=0,nt=null,ft=ne.next();Me!==null&&!ft.done;Ge++,ft=ne.next()){Me.index>Ge?(nt=Me,Me=null):nt=Me.sibling;var Oi=se(Z,Me,ft.value,he);if(Oi===null){Me===null&&(Me=nt);break}t&&Me&&Oi.alternate===null&&i(Z,Me),G=p(Oi,G,Ge),ct===null?De=Oi:ct.sibling=Oi,ct=Oi,Me=nt}if(ft.done)return a(Z,Me),st&&zr(Z,Ge),De;if(Me===null){for(;!ft.done;Ge++,ft=ne.next())ft=pe(Z,ft.value,he),ft!==null&&(G=p(ft,G,Ge),ct===null?De=ft:ct.sibling=ft,ct=ft);return st&&zr(Z,Ge),De}for(Me=o(Me);!ft.done;Ge++,ft=ne.next())ft=oe(Me,Z,Ge,ft.value,he),ft!==null&&(t&&ft.alternate!==null&&Me.delete(ft.key===null?Ge:ft.key),G=p(ft,G,Ge),ct===null?De=ft:ct.sibling=ft,ct=ft);return t&&Me.forEach(function(Gw){return i(Z,Gw)}),st&&zr(Z,Ge),De}function St(Z,G,ne,he){if(typeof ne=="object"&&ne!==null&&ne.type===D&&ne.key===null&&(ne=ne.props.children),typeof ne=="object"&&ne!==null){switch(ne.$$typeof){case w:e:{for(var De=ne.key;G!==null;){if(G.key===De){if(De=ne.type,De===D){if(G.tag===7){a(Z,G.sibling),he=h(G,ne.props.children),he.return=Z,Z=he;break e}}else if(G.elementType===De||typeof De=="object"&&De!==null&&De.$$typeof===Q&&ns(De)===G.type){a(Z,G.sibling),he=h(G,ne.props),Ha(he,ne),he.return=Z,Z=he;break e}a(Z,G);break}else i(Z,G);G=G.sibling}ne.type===D?(he=Qi(ne.props.children,Z.mode,he,ne.key),he.return=Z,Z=he):(he=co(ne.type,ne.key,ne.props,null,Z.mode,he),Ha(he,ne),he.return=Z,Z=he)}return v(Z);case S:e:{for(De=ne.key;G!==null;){if(G.key===De)if(G.tag===4&&G.stateNode.containerInfo===ne.containerInfo&&G.stateNode.implementation===ne.implementation){a(Z,G.sibling),he=h(G,ne.children||[]),he.return=Z,Z=he;break e}else{a(Z,G);break}else i(Z,G);G=G.sibling}he=kc(ne,Z.mode,he),he.return=Z,Z=he}return v(Z);case Q:return ne=ns(ne),St(Z,G,ne,he)}if(F(ne))return Re(Z,G,ne,he);if(J(ne)){if(De=J(ne),typeof De!="function")throw Error(s(150));return ne=De.call(ne),Pe(Z,G,ne,he)}if(typeof ne.then=="function")return St(Z,G,bo(ne),he);if(ne.$$typeof===T)return St(Z,G,mo(Z,ne),he);xo(Z,ne)}return typeof ne=="string"&&ne!==""||typeof ne=="number"||typeof ne=="bigint"?(ne=""+ne,G!==null&&G.tag===6?(a(Z,G.sibling),he=h(G,ne),he.return=Z,Z=he):(a(Z,G),he=Ec(ne,Z.mode,he),he.return=Z,Z=he),v(Z)):a(Z,G)}return function(Z,G,ne,he){try{qa=0;var De=St(Z,G,ne,he);return Ds=null,De}catch(Me){if(Me===Ms||Me===go)throw Me;var ct=Mn(29,Me,null,Z.mode);return ct.lanes=he,ct.return=Z,ct}finally{}}}var is=ip(!0),sp=ip(!1),mi=!1;function Uc(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Bc(t,i){t=t.updateQueue,i.updateQueue===t&&(i.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,callbacks:null})}function pi(t){return{lane:t,tag:0,payload:null,callback:null,next:null}}function gi(t,i,a){var o=t.updateQueue;if(o===null)return null;if(o=o.shared,(dt&2)!==0){var h=o.pending;return h===null?i.next=i:(i.next=h.next,h.next=i),o.pending=i,i=uo(t),Im(t,null,a),i}return oo(t,o,i,a),uo(t)}function Ia(t,i,a){if(i=i.updateQueue,i!==null&&(i=i.shared,(a&4194048)!==0)){var o=i.lanes;o&=t.pendingLanes,a|=o,i.lanes=a,$i(t,a)}}function Pc(t,i){var a=t.updateQueue,o=t.alternate;if(o!==null&&(o=o.updateQueue,a===o)){var h=null,p=null;if(a=a.firstBaseUpdate,a!==null){do{var v={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};p===null?h=p=v:p=p.next=v,a=a.next}while(a!==null);p===null?h=p=i:p=p.next=i}else h=p=i;a={baseState:o.baseState,firstBaseUpdate:h,lastBaseUpdate:p,shared:o.shared,callbacks:o.callbacks},t.updateQueue=a;return}t=a.lastBaseUpdate,t===null?a.firstBaseUpdate=i:t.next=i,a.lastBaseUpdate=i}var qc=!1;function Fa(){if(qc){var t=Rs;if(t!==null)throw t}}function $a(t,i,a,o){qc=!1;var h=t.updateQueue;mi=!1;var p=h.firstBaseUpdate,v=h.lastBaseUpdate,E=h.shared.pending;if(E!==null){h.shared.pending=null;var I=E,ie=I.next;I.next=null,v===null?p=ie:v.next=ie,v=I;var ce=t.alternate;ce!==null&&(ce=ce.updateQueue,E=ce.lastBaseUpdate,E!==v&&(E===null?ce.firstBaseUpdate=ie:E.next=ie,ce.lastBaseUpdate=I))}if(p!==null){var pe=h.baseState;v=0,ce=ie=I=null,E=p;do{var se=E.lane&-536870913,oe=se!==E.lane;if(oe?(tt&se)===se:(o&se)===se){se!==0&&se===Os&&(qc=!0),ce!==null&&(ce=ce.next={lane:0,tag:E.tag,payload:E.payload,callback:null,next:null});e:{var Re=t,Pe=E;se=i;var St=a;switch(Pe.tag){case 1:if(Re=Pe.payload,typeof Re=="function"){pe=Re.call(St,pe,se);break e}pe=Re;break e;case 3:Re.flags=Re.flags&-65537|128;case 0:if(Re=Pe.payload,se=typeof Re=="function"?Re.call(St,pe,se):Re,se==null)break e;pe=g({},pe,se);break e;case 2:mi=!0}}se=E.callback,se!==null&&(t.flags|=64,oe&&(t.flags|=8192),oe=h.callbacks,oe===null?h.callbacks=[se]:oe.push(se))}else oe={lane:se,tag:E.tag,payload:E.payload,callback:E.callback,next:null},ce===null?(ie=ce=oe,I=pe):ce=ce.next=oe,v|=se;if(E=E.next,E===null){if(E=h.shared.pending,E===null)break;oe=E,E=oe.next,oe.next=null,h.lastBaseUpdate=oe,h.shared.pending=null}}while(!0);ce===null&&(I=pe),h.baseState=I,h.firstBaseUpdate=ie,h.lastBaseUpdate=ce,p===null&&(h.shared.lanes=0),wi|=v,t.lanes=v,t.memoizedState=pe}}function ap(t,i){if(typeof t!="function")throw Error(s(191,t));t.call(i)}function lp(t,i){var a=t.callbacks;if(a!==null)for(t.callbacks=null,t=0;t<a.length;t++)ap(a[t],i)}var Ls=M(null),vo=M(0);function op(t,i){t=Vr,A(vo,t),A(Ls,i),Vr=t|i.baseLanes}function Hc(){A(vo,Vr),A(Ls,Ls.current)}function Ic(){Vr=vo.current,W(Ls),W(vo)}var Dn=M(null),er=null;function yi(t){var i=t.alternate;A(Ft,Ft.current&1),A(Dn,t),er===null&&(i===null||Ls.current!==null||i.memoizedState!==null)&&(er=t)}function Fc(t){A(Ft,Ft.current),A(Dn,t),er===null&&(er=t)}function up(t){t.tag===22?(A(Ft,Ft.current),A(Dn,t),er===null&&(er=t)):bi()}function bi(){A(Ft,Ft.current),A(Dn,Dn.current)}function Ln(t){W(Dn),er===t&&(er=null),W(Ft)}var Ft=M(0);function wo(t){for(var i=t;i!==null;){if(i.tag===13){var a=i.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||Kf(a)||Qf(a)))return i}else if(i.tag===19&&(i.memoizedProps.revealOrder==="forwards"||i.memoizedProps.revealOrder==="backwards"||i.memoizedProps.revealOrder==="unstable_legacy-backwards"||i.memoizedProps.revealOrder==="together")){if((i.flags&128)!==0)return i}else if(i.child!==null){i.child.return=i,i=i.child;continue}if(i===t)break;for(;i.sibling===null;){if(i.return===null||i.return===t)return null;i=i.return}i.sibling.return=i.return,i=i.sibling}return null}var Pr=0,Ye=null,vt=null,Jt=null,So=!1,zs=!1,ss=!1,_o=0,Ya=0,Us=null,zv=0;function Ht(){throw Error(s(321))}function $c(t,i){if(i===null)return!1;for(var a=0;a<i.length&&a<t.length;a++)if(!Rn(t[a],i[a]))return!1;return!0}function Yc(t,i,a,o,h,p){return Pr=p,Ye=i,i.memoizedState=null,i.updateQueue=null,i.lanes=0,P.H=t===null||t.memoizedState===null?Gp:lf,ss=!1,p=a(o,h),ss=!1,zs&&(p=fp(i,a,o,h)),cp(t),p}function cp(t){P.H=Ja;var i=vt!==null&&vt.next!==null;if(Pr=0,Jt=vt=Ye=null,So=!1,Ya=0,Us=null,i)throw Error(s(300));t===null||Xt||(t=t.dependencies,t!==null&&ho(t)&&(Xt=!0))}function fp(t,i,a,o){Ye=t;var h=0;do{if(zs&&(Us=null),Ya=0,zs=!1,25<=h)throw Error(s(301));if(h+=1,Jt=vt=null,t.updateQueue!=null){var p=t.updateQueue;p.lastEffect=null,p.events=null,p.stores=null,p.memoCache!=null&&(p.memoCache.index=0)}P.H=Vp,p=i(a,o)}while(zs);return p}function Uv(){var t=P.H,i=t.useState()[0];return i=typeof i.then=="function"?Ga(i):i,t=t.useState()[0],(vt!==null?vt.memoizedState:null)!==t&&(Ye.flags|=1024),i}function Gc(){var t=_o!==0;return _o=0,t}function Vc(t,i,a){i.updateQueue=t.updateQueue,i.flags&=-2053,t.lanes&=~a}function Jc(t){if(So){for(t=t.memoizedState;t!==null;){var i=t.queue;i!==null&&(i.pending=null),t=t.next}So=!1}Pr=0,Jt=vt=Ye=null,zs=!1,Ya=_o=0,Us=null}function dn(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Jt===null?Ye.memoizedState=Jt=t:Jt=Jt.next=t,Jt}function $t(){if(vt===null){var t=Ye.alternate;t=t!==null?t.memoizedState:null}else t=vt.next;var i=Jt===null?Ye.memoizedState:Jt.next;if(i!==null)Jt=i,vt=t;else{if(t===null)throw Ye.alternate===null?Error(s(467)):Error(s(310));vt=t,t={memoizedState:vt.memoizedState,baseState:vt.baseState,baseQueue:vt.baseQueue,queue:vt.queue,next:null},Jt===null?Ye.memoizedState=Jt=t:Jt=Jt.next=t}return Jt}function Eo(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Ga(t){var i=Ya;return Ya+=1,Us===null&&(Us=[]),t=tp(Us,t,i),i=Ye,(Jt===null?i.memoizedState:Jt.next)===null&&(i=i.alternate,P.H=i===null||i.memoizedState===null?Gp:lf),t}function ko(t){if(t!==null&&typeof t=="object"){if(typeof t.then=="function")return Ga(t);if(t.$$typeof===T)return an(t)}throw Error(s(438,String(t)))}function Xc(t){var i=null,a=Ye.updateQueue;if(a!==null&&(i=a.memoCache),i==null){var o=Ye.alternate;o!==null&&(o=o.updateQueue,o!==null&&(o=o.memoCache,o!=null&&(i={data:o.data.map(function(h){return h.slice()}),index:0})))}if(i==null&&(i={data:[],index:0}),a===null&&(a=Eo(),Ye.updateQueue=a),a.memoCache=i,a=i.data[i.index],a===void 0)for(a=i.data[i.index]=Array(t),o=0;o<t;o++)a[o]=R;return i.index++,a}function qr(t,i){return typeof i=="function"?i(t):i}function Co(t){var i=$t();return Kc(i,vt,t)}function Kc(t,i,a){var o=t.queue;if(o===null)throw Error(s(311));o.lastRenderedReducer=a;var h=t.baseQueue,p=o.pending;if(p!==null){if(h!==null){var v=h.next;h.next=p.next,p.next=v}i.baseQueue=h=p,o.pending=null}if(p=t.baseState,h===null)t.memoizedState=p;else{i=h.next;var E=v=null,I=null,ie=i,ce=!1;do{var pe=ie.lane&-536870913;if(pe!==ie.lane?(tt&pe)===pe:(Pr&pe)===pe){var se=ie.revertLane;if(se===0)I!==null&&(I=I.next={lane:0,revertLane:0,gesture:null,action:ie.action,hasEagerState:ie.hasEagerState,eagerState:ie.eagerState,next:null}),pe===Os&&(ce=!0);else if((Pr&se)===se){ie=ie.next,se===Os&&(ce=!0);continue}else pe={lane:0,revertLane:ie.revertLane,gesture:null,action:ie.action,hasEagerState:ie.hasEagerState,eagerState:ie.eagerState,next:null},I===null?(E=I=pe,v=p):I=I.next=pe,Ye.lanes|=se,wi|=se;pe=ie.action,ss&&a(p,pe),p=ie.hasEagerState?ie.eagerState:a(p,pe)}else se={lane:pe,revertLane:ie.revertLane,gesture:ie.gesture,action:ie.action,hasEagerState:ie.hasEagerState,eagerState:ie.eagerState,next:null},I===null?(E=I=se,v=p):I=I.next=se,Ye.lanes|=pe,wi|=pe;ie=ie.next}while(ie!==null&&ie!==i);if(I===null?v=p:I.next=E,!Rn(p,t.memoizedState)&&(Xt=!0,ce&&(a=Rs,a!==null)))throw a;t.memoizedState=p,t.baseState=v,t.baseQueue=I,o.lastRenderedState=p}return h===null&&(o.lanes=0),[t.memoizedState,o.dispatch]}function Qc(t){var i=$t(),a=i.queue;if(a===null)throw Error(s(311));a.lastRenderedReducer=t;var o=a.dispatch,h=a.pending,p=i.memoizedState;if(h!==null){a.pending=null;var v=h=h.next;do p=t(p,v.action),v=v.next;while(v!==h);Rn(p,i.memoizedState)||(Xt=!0),i.memoizedState=p,i.baseQueue===null&&(i.baseState=p),a.lastRenderedState=p}return[p,o]}function hp(t,i,a){var o=Ye,h=$t(),p=st;if(p){if(a===void 0)throw Error(s(407));a=a()}else a=i();var v=!Rn((vt||h).memoizedState,a);if(v&&(h.memoizedState=a,Xt=!0),h=h.queue,ef(pp.bind(null,o,h,t),[t]),h.getSnapshot!==i||v||Jt!==null&&Jt.memoizedState.tag&1){if(o.flags|=2048,Bs(9,{destroy:void 0},mp.bind(null,o,h,a,i),null),At===null)throw Error(s(349));p||(Pr&127)!==0||dp(o,i,a)}return a}function dp(t,i,a){t.flags|=16384,t={getSnapshot:i,value:a},i=Ye.updateQueue,i===null?(i=Eo(),Ye.updateQueue=i,i.stores=[t]):(a=i.stores,a===null?i.stores=[t]:a.push(t))}function mp(t,i,a,o){i.value=a,i.getSnapshot=o,gp(i)&&yp(t)}function pp(t,i,a){return a(function(){gp(i)&&yp(t)})}function gp(t){var i=t.getSnapshot;t=t.value;try{var a=i();return!Rn(t,a)}catch{return!0}}function yp(t){var i=Ki(t,2);i!==null&&kn(i,t,2)}function Zc(t){var i=dn();if(typeof t=="function"){var a=t;if(t=a(),ss){Le(!0);try{a()}finally{Le(!1)}}}return i.memoizedState=i.baseState=t,i.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:qr,lastRenderedState:t},i}function bp(t,i,a,o){return t.baseState=a,Kc(t,vt,typeof o=="function"?o:qr)}function Bv(t,i,a,o,h){if(jo(t))throw Error(s(485));if(t=i.action,t!==null){var p={payload:h,action:t,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(v){p.listeners.push(v)}};P.T!==null?a(!0):p.isTransition=!1,o(p),a=i.pending,a===null?(p.next=i.pending=p,xp(i,p)):(p.next=a.next,i.pending=a.next=p)}}function xp(t,i){var a=i.action,o=i.payload,h=t.state;if(i.isTransition){var p=P.T,v={};P.T=v;try{var E=a(h,o),I=P.S;I!==null&&I(v,E),vp(t,i,E)}catch(ie){Wc(t,i,ie)}finally{p!==null&&v.types!==null&&(p.types=v.types),P.T=p}}else try{p=a(h,o),vp(t,i,p)}catch(ie){Wc(t,i,ie)}}function vp(t,i,a){a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(function(o){wp(t,i,o)},function(o){return Wc(t,i,o)}):wp(t,i,a)}function wp(t,i,a){i.status="fulfilled",i.value=a,Sp(i),t.state=a,i=t.pending,i!==null&&(a=i.next,a===i?t.pending=null:(a=a.next,i.next=a,xp(t,a)))}function Wc(t,i,a){var o=t.pending;if(t.pending=null,o!==null){o=o.next;do i.status="rejected",i.reason=a,Sp(i),i=i.next;while(i!==o)}t.action=null}function Sp(t){t=t.listeners;for(var i=0;i<t.length;i++)(0,t[i])()}function _p(t,i){return i}function Ep(t,i){if(st){var a=At.formState;if(a!==null){e:{var o=Ye;if(st){if(Rt){t:{for(var h=Rt,p=Wn;h.nodeType!==8;){if(!p){h=null;break t}if(h=tr(h.nextSibling),h===null){h=null;break t}}p=h.data,h=p==="F!"||p==="F"?h:null}if(h){Rt=tr(h.nextSibling),o=h.data==="F!";break e}}hi(o)}o=!1}o&&(i=a[0])}}return a=dn(),a.memoizedState=a.baseState=i,o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:_p,lastRenderedState:i},a.queue=o,a=Fp.bind(null,Ye,o),o.dispatch=a,o=Zc(!1),p=af.bind(null,Ye,!1,o.queue),o=dn(),h={state:i,dispatch:null,action:t,pending:null},o.queue=h,a=Bv.bind(null,Ye,h,p,a),h.dispatch=a,o.memoizedState=t,[i,a,!1]}function kp(t){var i=$t();return Cp(i,vt,t)}function Cp(t,i,a){if(i=Kc(t,i,_p)[0],t=Co(qr)[0],typeof i=="object"&&i!==null&&typeof i.then=="function")try{var o=Ga(i)}catch(v){throw v===Ms?go:v}else o=i;i=$t();var h=i.queue,p=h.dispatch;return a!==i.memoizedState&&(Ye.flags|=2048,Bs(9,{destroy:void 0},Pv.bind(null,h,a),null)),[o,p,t]}function Pv(t,i){t.action=i}function Ap(t){var i=$t(),a=vt;if(a!==null)return Cp(i,a,t);$t(),i=i.memoizedState,a=$t();var o=a.queue.dispatch;return a.memoizedState=t,[i,o,!1]}function Bs(t,i,a,o){return t={tag:t,create:a,deps:o,inst:i,next:null},i=Ye.updateQueue,i===null&&(i=Eo(),Ye.updateQueue=i),a=i.lastEffect,a===null?i.lastEffect=t.next=t:(o=a.next,a.next=t,t.next=o,i.lastEffect=t),t}function Tp(){return $t().memoizedState}function Ao(t,i,a,o){var h=dn();Ye.flags|=t,h.memoizedState=Bs(1|i,{destroy:void 0},a,o===void 0?null:o)}function To(t,i,a,o){var h=$t();o=o===void 0?null:o;var p=h.memoizedState.inst;vt!==null&&o!==null&&$c(o,vt.memoizedState.deps)?h.memoizedState=Bs(i,p,a,o):(Ye.flags|=t,h.memoizedState=Bs(1|i,p,a,o))}function jp(t,i){Ao(8390656,8,t,i)}function ef(t,i){To(2048,8,t,i)}function qv(t){Ye.flags|=4;var i=Ye.updateQueue;if(i===null)i=Eo(),Ye.updateQueue=i,i.events=[t];else{var a=i.events;a===null?i.events=[t]:a.push(t)}}function Np(t){var i=$t().memoizedState;return qv({ref:i,nextImpl:t}),function(){if((dt&2)!==0)throw Error(s(440));return i.impl.apply(void 0,arguments)}}function Op(t,i){return To(4,2,t,i)}function Rp(t,i){return To(4,4,t,i)}function Mp(t,i){if(typeof i=="function"){t=t();var a=i(t);return function(){typeof a=="function"?a():i(null)}}if(i!=null)return t=t(),i.current=t,function(){i.current=null}}function Dp(t,i,a){a=a!=null?a.concat([t]):null,To(4,4,Mp.bind(null,i,t),a)}function tf(){}function Lp(t,i){var a=$t();i=i===void 0?null:i;var o=a.memoizedState;return i!==null&&$c(i,o[1])?o[0]:(a.memoizedState=[t,i],t)}function zp(t,i){var a=$t();i=i===void 0?null:i;var o=a.memoizedState;if(i!==null&&$c(i,o[1]))return o[0];if(o=t(),ss){Le(!0);try{t()}finally{Le(!1)}}return a.memoizedState=[o,i],o}function nf(t,i,a){return a===void 0||(Pr&1073741824)!==0&&(tt&261930)===0?t.memoizedState=i:(t.memoizedState=a,t=Ug(),Ye.lanes|=t,wi|=t,a)}function Up(t,i,a,o){return Rn(a,i)?a:Ls.current!==null?(t=nf(t,a,o),Rn(t,i)||(Xt=!0),t):(Pr&42)===0||(Pr&1073741824)!==0&&(tt&261930)===0?(Xt=!0,t.memoizedState=a):(t=Ug(),Ye.lanes|=t,wi|=t,i)}function Bp(t,i,a,o,h){var p=V.p;V.p=p!==0&&8>p?p:8;var v=P.T,E={};P.T=E,af(t,!1,i,a);try{var I=h(),ie=P.S;if(ie!==null&&ie(E,I),I!==null&&typeof I=="object"&&typeof I.then=="function"){var ce=Lv(I,o);Va(t,i,ce,Bn(t))}else Va(t,i,o,Bn(t))}catch(pe){Va(t,i,{then:function(){},status:"rejected",reason:pe},Bn())}finally{V.p=p,v!==null&&E.types!==null&&(v.types=E.types),P.T=v}}function Hv(){}function rf(t,i,a,o){if(t.tag!==5)throw Error(s(476));var h=Pp(t).queue;Bp(t,h,i,ue,a===null?Hv:function(){return qp(t),a(o)})}function Pp(t){var i=t.memoizedState;if(i!==null)return i;i={memoizedState:ue,baseState:ue,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:qr,lastRenderedState:ue},next:null};var a={};return i.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:qr,lastRenderedState:a},next:null},t.memoizedState=i,t=t.alternate,t!==null&&(t.memoizedState=i),i}function qp(t){var i=Pp(t);i.next===null&&(i=t.alternate.memoizedState),Va(t,i.next.queue,{},Bn())}function sf(){return an(cl)}function Hp(){return $t().memoizedState}function Ip(){return $t().memoizedState}function Iv(t){for(var i=t.return;i!==null;){switch(i.tag){case 24:case 3:var a=Bn();t=pi(a);var o=gi(i,t,a);o!==null&&(kn(o,i,a),Ia(o,i,a)),i={cache:Mc()},t.payload=i;return}i=i.return}}function Fv(t,i,a){var o=Bn();a={lane:o,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},jo(t)?$p(i,a):(a=Sc(t,i,a,o),a!==null&&(kn(a,t,o),Yp(a,i,o)))}function Fp(t,i,a){var o=Bn();Va(t,i,a,o)}function Va(t,i,a,o){var h={lane:o,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(jo(t))$p(i,h);else{var p=t.alternate;if(t.lanes===0&&(p===null||p.lanes===0)&&(p=i.lastRenderedReducer,p!==null))try{var v=i.lastRenderedState,E=p(v,a);if(h.hasEagerState=!0,h.eagerState=E,Rn(E,v))return oo(t,i,h,0),At===null&&lo(),!1}catch{}finally{}if(a=Sc(t,i,h,o),a!==null)return kn(a,t,o),Yp(a,i,o),!0}return!1}function af(t,i,a,o){if(o={lane:2,revertLane:Bf(),gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null},jo(t)){if(i)throw Error(s(479))}else i=Sc(t,a,o,2),i!==null&&kn(i,t,2)}function jo(t){var i=t.alternate;return t===Ye||i!==null&&i===Ye}function $p(t,i){zs=So=!0;var a=t.pending;a===null?i.next=i:(i.next=a.next,a.next=i),t.pending=i}function Yp(t,i,a){if((a&4194048)!==0){var o=i.lanes;o&=t.pendingLanes,a|=o,i.lanes=a,$i(t,a)}}var Ja={readContext:an,use:ko,useCallback:Ht,useContext:Ht,useEffect:Ht,useImperativeHandle:Ht,useLayoutEffect:Ht,useInsertionEffect:Ht,useMemo:Ht,useReducer:Ht,useRef:Ht,useState:Ht,useDebugValue:Ht,useDeferredValue:Ht,useTransition:Ht,useSyncExternalStore:Ht,useId:Ht,useHostTransitionStatus:Ht,useFormState:Ht,useActionState:Ht,useOptimistic:Ht,useMemoCache:Ht,useCacheRefresh:Ht};Ja.useEffectEvent=Ht;var Gp={readContext:an,use:ko,useCallback:function(t,i){return dn().memoizedState=[t,i===void 0?null:i],t},useContext:an,useEffect:jp,useImperativeHandle:function(t,i,a){a=a!=null?a.concat([t]):null,Ao(4194308,4,Mp.bind(null,i,t),a)},useLayoutEffect:function(t,i){return Ao(4194308,4,t,i)},useInsertionEffect:function(t,i){Ao(4,2,t,i)},useMemo:function(t,i){var a=dn();i=i===void 0?null:i;var o=t();if(ss){Le(!0);try{t()}finally{Le(!1)}}return a.memoizedState=[o,i],o},useReducer:function(t,i,a){var o=dn();if(a!==void 0){var h=a(i);if(ss){Le(!0);try{a(i)}finally{Le(!1)}}}else h=i;return o.memoizedState=o.baseState=h,t={pending:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:h},o.queue=t,t=t.dispatch=Fv.bind(null,Ye,t),[o.memoizedState,t]},useRef:function(t){var i=dn();return t={current:t},i.memoizedState=t},useState:function(t){t=Zc(t);var i=t.queue,a=Fp.bind(null,Ye,i);return i.dispatch=a,[t.memoizedState,a]},useDebugValue:tf,useDeferredValue:function(t,i){var a=dn();return nf(a,t,i)},useTransition:function(){var t=Zc(!1);return t=Bp.bind(null,Ye,t.queue,!0,!1),dn().memoizedState=t,[!1,t]},useSyncExternalStore:function(t,i,a){var o=Ye,h=dn();if(st){if(a===void 0)throw Error(s(407));a=a()}else{if(a=i(),At===null)throw Error(s(349));(tt&127)!==0||dp(o,i,a)}h.memoizedState=a;var p={value:a,getSnapshot:i};return h.queue=p,jp(pp.bind(null,o,p,t),[t]),o.flags|=2048,Bs(9,{destroy:void 0},mp.bind(null,o,p,a,i),null),a},useId:function(){var t=dn(),i=At.identifierPrefix;if(st){var a=xr,o=br;a=(o&~(1<<32-Se(o)-1)).toString(32)+a,i="_"+i+"R_"+a,a=_o++,0<a&&(i+="H"+a.toString(32)),i+="_"}else a=zv++,i="_"+i+"r_"+a.toString(32)+"_";return t.memoizedState=i},useHostTransitionStatus:sf,useFormState:Ep,useActionState:Ep,useOptimistic:function(t){var i=dn();i.memoizedState=i.baseState=t;var a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return i.queue=a,i=af.bind(null,Ye,!0,a),a.dispatch=i,[t,i]},useMemoCache:Xc,useCacheRefresh:function(){return dn().memoizedState=Iv.bind(null,Ye)},useEffectEvent:function(t){var i=dn(),a={impl:t};return i.memoizedState=a,function(){if((dt&2)!==0)throw Error(s(440));return a.impl.apply(void 0,arguments)}}},lf={readContext:an,use:ko,useCallback:Lp,useContext:an,useEffect:ef,useImperativeHandle:Dp,useInsertionEffect:Op,useLayoutEffect:Rp,useMemo:zp,useReducer:Co,useRef:Tp,useState:function(){return Co(qr)},useDebugValue:tf,useDeferredValue:function(t,i){var a=$t();return Up(a,vt.memoizedState,t,i)},useTransition:function(){var t=Co(qr)[0],i=$t().memoizedState;return[typeof t=="boolean"?t:Ga(t),i]},useSyncExternalStore:hp,useId:Hp,useHostTransitionStatus:sf,useFormState:kp,useActionState:kp,useOptimistic:function(t,i){var a=$t();return bp(a,vt,t,i)},useMemoCache:Xc,useCacheRefresh:Ip};lf.useEffectEvent=Np;var Vp={readContext:an,use:ko,useCallback:Lp,useContext:an,useEffect:ef,useImperativeHandle:Dp,useInsertionEffect:Op,useLayoutEffect:Rp,useMemo:zp,useReducer:Qc,useRef:Tp,useState:function(){return Qc(qr)},useDebugValue:tf,useDeferredValue:function(t,i){var a=$t();return vt===null?nf(a,t,i):Up(a,vt.memoizedState,t,i)},useTransition:function(){var t=Qc(qr)[0],i=$t().memoizedState;return[typeof t=="boolean"?t:Ga(t),i]},useSyncExternalStore:hp,useId:Hp,useHostTransitionStatus:sf,useFormState:Ap,useActionState:Ap,useOptimistic:function(t,i){var a=$t();return vt!==null?bp(a,vt,t,i):(a.baseState=t,[t,a.queue.dispatch])},useMemoCache:Xc,useCacheRefresh:Ip};Vp.useEffectEvent=Np;function of(t,i,a,o){i=t.memoizedState,a=a(o,i),a=a==null?i:g({},i,a),t.memoizedState=a,t.lanes===0&&(t.updateQueue.baseState=a)}var uf={enqueueSetState:function(t,i,a){t=t._reactInternals;var o=Bn(),h=pi(o);h.payload=i,a!=null&&(h.callback=a),i=gi(t,h,o),i!==null&&(kn(i,t,o),Ia(i,t,o))},enqueueReplaceState:function(t,i,a){t=t._reactInternals;var o=Bn(),h=pi(o);h.tag=1,h.payload=i,a!=null&&(h.callback=a),i=gi(t,h,o),i!==null&&(kn(i,t,o),Ia(i,t,o))},enqueueForceUpdate:function(t,i){t=t._reactInternals;var a=Bn(),o=pi(a);o.tag=2,i!=null&&(o.callback=i),i=gi(t,o,a),i!==null&&(kn(i,t,a),Ia(i,t,a))}};function Jp(t,i,a,o,h,p,v){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(o,p,v):i.prototype&&i.prototype.isPureReactComponent?!Da(a,o)||!Da(h,p):!0}function Xp(t,i,a,o){t=i.state,typeof i.componentWillReceiveProps=="function"&&i.componentWillReceiveProps(a,o),typeof i.UNSAFE_componentWillReceiveProps=="function"&&i.UNSAFE_componentWillReceiveProps(a,o),i.state!==t&&uf.enqueueReplaceState(i,i.state,null)}function as(t,i){var a=i;if("ref"in i){a={};for(var o in i)o!=="ref"&&(a[o]=i[o])}if(t=t.defaultProps){a===i&&(a=g({},a));for(var h in t)a[h]===void 0&&(a[h]=t[h])}return a}function Kp(t){ao(t)}function Qp(t){console.error(t)}function Zp(t){ao(t)}function No(t,i){try{var a=t.onUncaughtError;a(i.value,{componentStack:i.stack})}catch(o){setTimeout(function(){throw o})}}function Wp(t,i,a){try{var o=t.onCaughtError;o(a.value,{componentStack:a.stack,errorBoundary:i.tag===1?i.stateNode:null})}catch(h){setTimeout(function(){throw h})}}function cf(t,i,a){return a=pi(a),a.tag=3,a.payload={element:null},a.callback=function(){No(t,i)},a}function eg(t){return t=pi(t),t.tag=3,t}function tg(t,i,a,o){var h=a.type.getDerivedStateFromError;if(typeof h=="function"){var p=o.value;t.payload=function(){return h(p)},t.callback=function(){Wp(i,a,o)}}var v=a.stateNode;v!==null&&typeof v.componentDidCatch=="function"&&(t.callback=function(){Wp(i,a,o),typeof h!="function"&&(Si===null?Si=new Set([this]):Si.add(this));var E=o.stack;this.componentDidCatch(o.value,{componentStack:E!==null?E:""})})}function $v(t,i,a,o,h){if(a.flags|=32768,o!==null&&typeof o=="object"&&typeof o.then=="function"){if(i=a.alternate,i!==null&&Ns(i,a,h,!0),a=Dn.current,a!==null){switch(a.tag){case 31:case 13:return er===null?Io():a.alternate===null&&It===0&&(It=3),a.flags&=-257,a.flags|=65536,a.lanes=h,o===yo?a.flags|=16384:(i=a.updateQueue,i===null?a.updateQueue=new Set([o]):i.add(o),Lf(t,o,h)),!1;case 22:return a.flags|=65536,o===yo?a.flags|=16384:(i=a.updateQueue,i===null?(i={transitions:null,markerInstances:null,retryQueue:new Set([o])},a.updateQueue=i):(a=i.retryQueue,a===null?i.retryQueue=new Set([o]):a.add(o)),Lf(t,o,h)),!1}throw Error(s(435,a.tag))}return Lf(t,o,h),Io(),!1}if(st)return i=Dn.current,i!==null?((i.flags&65536)===0&&(i.flags|=256),i.flags|=65536,i.lanes=h,o!==Tc&&(t=Error(s(422),{cause:o}),Ua(Kn(t,a)))):(o!==Tc&&(i=Error(s(423),{cause:o}),Ua(Kn(i,a))),t=t.current.alternate,t.flags|=65536,h&=-h,t.lanes|=h,o=Kn(o,a),h=cf(t.stateNode,o,h),Pc(t,h),It!==4&&(It=2)),!1;var p=Error(s(520),{cause:o});if(p=Kn(p,a),nl===null?nl=[p]:nl.push(p),It!==4&&(It=2),i===null)return!0;o=Kn(o,a),a=i;do{switch(a.tag){case 3:return a.flags|=65536,t=h&-h,a.lanes|=t,t=cf(a.stateNode,o,t),Pc(a,t),!1;case 1:if(i=a.type,p=a.stateNode,(a.flags&128)===0&&(typeof i.getDerivedStateFromError=="function"||p!==null&&typeof p.componentDidCatch=="function"&&(Si===null||!Si.has(p))))return a.flags|=65536,h&=-h,a.lanes|=h,h=eg(h),tg(h,t,a,o),Pc(a,h),!1}a=a.return}while(a!==null);return!1}var ff=Error(s(461)),Xt=!1;function ln(t,i,a,o){i.child=t===null?sp(i,null,a,o):is(i,t.child,a,o)}function ng(t,i,a,o,h){a=a.render;var p=i.ref;if("ref"in o){var v={};for(var E in o)E!=="ref"&&(v[E]=o[E])}else v=o;return es(i),o=Yc(t,i,a,v,p,h),E=Gc(),t!==null&&!Xt?(Vc(t,i,h),Hr(t,i,h)):(st&&E&&Cc(i),i.flags|=1,ln(t,i,o,h),i.child)}function rg(t,i,a,o,h){if(t===null){var p=a.type;return typeof p=="function"&&!_c(p)&&p.defaultProps===void 0&&a.compare===null?(i.tag=15,i.type=p,ig(t,i,p,o,h)):(t=co(a.type,null,o,i,i.mode,h),t.ref=i.ref,t.return=i,i.child=t)}if(p=t.child,!xf(t,h)){var v=p.memoizedProps;if(a=a.compare,a=a!==null?a:Da,a(v,o)&&t.ref===i.ref)return Hr(t,i,h)}return i.flags|=1,t=Lr(p,o),t.ref=i.ref,t.return=i,i.child=t}function ig(t,i,a,o,h){if(t!==null){var p=t.memoizedProps;if(Da(p,o)&&t.ref===i.ref)if(Xt=!1,i.pendingProps=o=p,xf(t,h))(t.flags&131072)!==0&&(Xt=!0);else return i.lanes=t.lanes,Hr(t,i,h)}return hf(t,i,a,o,h)}function sg(t,i,a,o){var h=o.children,p=t!==null?t.memoizedState:null;if(t===null&&i.stateNode===null&&(i.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),o.mode==="hidden"){if((i.flags&128)!==0){if(p=p!==null?p.baseLanes|a:a,t!==null){for(o=i.child=t.child,h=0;o!==null;)h=h|o.lanes|o.childLanes,o=o.sibling;o=h&~p}else o=0,i.child=null;return ag(t,i,p,a,o)}if((a&536870912)!==0)i.memoizedState={baseLanes:0,cachePool:null},t!==null&&po(i,p!==null?p.cachePool:null),p!==null?op(i,p):Hc(),up(i);else return o=i.lanes=536870912,ag(t,i,p!==null?p.baseLanes|a:a,a,o)}else p!==null?(po(i,p.cachePool),op(i,p),bi(),i.memoizedState=null):(t!==null&&po(i,null),Hc(),bi());return ln(t,i,h,a),i.child}function Xa(t,i){return t!==null&&t.tag===22||i.stateNode!==null||(i.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),i.sibling}function ag(t,i,a,o,h){var p=Lc();return p=p===null?null:{parent:Vt._currentValue,pool:p},i.memoizedState={baseLanes:a,cachePool:p},t!==null&&po(i,null),Hc(),up(i),t!==null&&Ns(t,i,o,!0),i.childLanes=h,null}function Oo(t,i){return i=Mo({mode:i.mode,children:i.children},t.mode),i.ref=t.ref,t.child=i,i.return=t,i}function lg(t,i,a){return is(i,t.child,null,a),t=Oo(i,i.pendingProps),t.flags|=2,Ln(i),i.memoizedState=null,t}function Yv(t,i,a){var o=i.pendingProps,h=(i.flags&128)!==0;if(i.flags&=-129,t===null){if(st){if(o.mode==="hidden")return t=Oo(i,o),i.lanes=536870912,Xa(null,t);if(Fc(i),(t=Rt)?(t=xy(t,Wn),t=t!==null&&t.data==="&"?t:null,t!==null&&(i.memoizedState={dehydrated:t,treeContext:ci!==null?{id:br,overflow:xr}:null,retryLane:536870912,hydrationErrors:null},a=$m(t),a.return=i,i.child=a,sn=i,Rt=null)):t=null,t===null)throw hi(i);return i.lanes=536870912,null}return Oo(i,o)}var p=t.memoizedState;if(p!==null){var v=p.dehydrated;if(Fc(i),h)if(i.flags&256)i.flags&=-257,i=lg(t,i,a);else if(i.memoizedState!==null)i.child=t.child,i.flags|=128,i=null;else throw Error(s(558));else if(Xt||Ns(t,i,a,!1),h=(a&t.childLanes)!==0,Xt||h){if(o=At,o!==null&&(v=oi(o,a),v!==0&&v!==p.retryLane))throw p.retryLane=v,Ki(t,v),kn(o,t,v),ff;Io(),i=lg(t,i,a)}else t=p.treeContext,Rt=tr(v.nextSibling),sn=i,st=!0,fi=null,Wn=!1,t!==null&&Vm(i,t),i=Oo(i,o),i.flags|=4096;return i}return t=Lr(t.child,{mode:o.mode,children:o.children}),t.ref=i.ref,i.child=t,t.return=i,t}function Ro(t,i){var a=i.ref;if(a===null)t!==null&&t.ref!==null&&(i.flags|=4194816);else{if(typeof a!="function"&&typeof a!="object")throw Error(s(284));(t===null||t.ref!==a)&&(i.flags|=4194816)}}function hf(t,i,a,o,h){return es(i),a=Yc(t,i,a,o,void 0,h),o=Gc(),t!==null&&!Xt?(Vc(t,i,h),Hr(t,i,h)):(st&&o&&Cc(i),i.flags|=1,ln(t,i,a,h),i.child)}function og(t,i,a,o,h,p){return es(i),i.updateQueue=null,a=fp(i,o,a,h),cp(t),o=Gc(),t!==null&&!Xt?(Vc(t,i,p),Hr(t,i,p)):(st&&o&&Cc(i),i.flags|=1,ln(t,i,a,p),i.child)}function ug(t,i,a,o,h){if(es(i),i.stateNode===null){var p=Cs,v=a.contextType;typeof v=="object"&&v!==null&&(p=an(v)),p=new a(o,p),i.memoizedState=p.state!==null&&p.state!==void 0?p.state:null,p.updater=uf,i.stateNode=p,p._reactInternals=i,p=i.stateNode,p.props=o,p.state=i.memoizedState,p.refs={},Uc(i),v=a.contextType,p.context=typeof v=="object"&&v!==null?an(v):Cs,p.state=i.memoizedState,v=a.getDerivedStateFromProps,typeof v=="function"&&(of(i,a,v,o),p.state=i.memoizedState),typeof a.getDerivedStateFromProps=="function"||typeof p.getSnapshotBeforeUpdate=="function"||typeof p.UNSAFE_componentWillMount!="function"&&typeof p.componentWillMount!="function"||(v=p.state,typeof p.componentWillMount=="function"&&p.componentWillMount(),typeof p.UNSAFE_componentWillMount=="function"&&p.UNSAFE_componentWillMount(),v!==p.state&&uf.enqueueReplaceState(p,p.state,null),$a(i,o,p,h),Fa(),p.state=i.memoizedState),typeof p.componentDidMount=="function"&&(i.flags|=4194308),o=!0}else if(t===null){p=i.stateNode;var E=i.memoizedProps,I=as(a,E);p.props=I;var ie=p.context,ce=a.contextType;v=Cs,typeof ce=="object"&&ce!==null&&(v=an(ce));var pe=a.getDerivedStateFromProps;ce=typeof pe=="function"||typeof p.getSnapshotBeforeUpdate=="function",E=i.pendingProps!==E,ce||typeof p.UNSAFE_componentWillReceiveProps!="function"&&typeof p.componentWillReceiveProps!="function"||(E||ie!==v)&&Xp(i,p,o,v),mi=!1;var se=i.memoizedState;p.state=se,$a(i,o,p,h),Fa(),ie=i.memoizedState,E||se!==ie||mi?(typeof pe=="function"&&(of(i,a,pe,o),ie=i.memoizedState),(I=mi||Jp(i,a,I,o,se,ie,v))?(ce||typeof p.UNSAFE_componentWillMount!="function"&&typeof p.componentWillMount!="function"||(typeof p.componentWillMount=="function"&&p.componentWillMount(),typeof p.UNSAFE_componentWillMount=="function"&&p.UNSAFE_componentWillMount()),typeof p.componentDidMount=="function"&&(i.flags|=4194308)):(typeof p.componentDidMount=="function"&&(i.flags|=4194308),i.memoizedProps=o,i.memoizedState=ie),p.props=o,p.state=ie,p.context=v,o=I):(typeof p.componentDidMount=="function"&&(i.flags|=4194308),o=!1)}else{p=i.stateNode,Bc(t,i),v=i.memoizedProps,ce=as(a,v),p.props=ce,pe=i.pendingProps,se=p.context,ie=a.contextType,I=Cs,typeof ie=="object"&&ie!==null&&(I=an(ie)),E=a.getDerivedStateFromProps,(ie=typeof E=="function"||typeof p.getSnapshotBeforeUpdate=="function")||typeof p.UNSAFE_componentWillReceiveProps!="function"&&typeof p.componentWillReceiveProps!="function"||(v!==pe||se!==I)&&Xp(i,p,o,I),mi=!1,se=i.memoizedState,p.state=se,$a(i,o,p,h),Fa();var oe=i.memoizedState;v!==pe||se!==oe||mi||t!==null&&t.dependencies!==null&&ho(t.dependencies)?(typeof E=="function"&&(of(i,a,E,o),oe=i.memoizedState),(ce=mi||Jp(i,a,ce,o,se,oe,I)||t!==null&&t.dependencies!==null&&ho(t.dependencies))?(ie||typeof p.UNSAFE_componentWillUpdate!="function"&&typeof p.componentWillUpdate!="function"||(typeof p.componentWillUpdate=="function"&&p.componentWillUpdate(o,oe,I),typeof p.UNSAFE_componentWillUpdate=="function"&&p.UNSAFE_componentWillUpdate(o,oe,I)),typeof p.componentDidUpdate=="function"&&(i.flags|=4),typeof p.getSnapshotBeforeUpdate=="function"&&(i.flags|=1024)):(typeof p.componentDidUpdate!="function"||v===t.memoizedProps&&se===t.memoizedState||(i.flags|=4),typeof p.getSnapshotBeforeUpdate!="function"||v===t.memoizedProps&&se===t.memoizedState||(i.flags|=1024),i.memoizedProps=o,i.memoizedState=oe),p.props=o,p.state=oe,p.context=I,o=ce):(typeof p.componentDidUpdate!="function"||v===t.memoizedProps&&se===t.memoizedState||(i.flags|=4),typeof p.getSnapshotBeforeUpdate!="function"||v===t.memoizedProps&&se===t.memoizedState||(i.flags|=1024),o=!1)}return p=o,Ro(t,i),o=(i.flags&128)!==0,p||o?(p=i.stateNode,a=o&&typeof a.getDerivedStateFromError!="function"?null:p.render(),i.flags|=1,t!==null&&o?(i.child=is(i,t.child,null,h),i.child=is(i,null,a,h)):ln(t,i,a,h),i.memoizedState=p.state,t=i.child):t=Hr(t,i,h),t}function cg(t,i,a,o){return Zi(),i.flags|=256,ln(t,i,a,o),i.child}var df={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function mf(t){return{baseLanes:t,cachePool:Wm()}}function pf(t,i,a){return t=t!==null?t.childLanes&~a:0,i&&(t|=Un),t}function fg(t,i,a){var o=i.pendingProps,h=!1,p=(i.flags&128)!==0,v;if((v=p)||(v=t!==null&&t.memoizedState===null?!1:(Ft.current&2)!==0),v&&(h=!0,i.flags&=-129),v=(i.flags&32)!==0,i.flags&=-33,t===null){if(st){if(h?yi(i):bi(),(t=Rt)?(t=xy(t,Wn),t=t!==null&&t.data!=="&"?t:null,t!==null&&(i.memoizedState={dehydrated:t,treeContext:ci!==null?{id:br,overflow:xr}:null,retryLane:536870912,hydrationErrors:null},a=$m(t),a.return=i,i.child=a,sn=i,Rt=null)):t=null,t===null)throw hi(i);return Qf(t)?i.lanes=32:i.lanes=536870912,null}var E=o.children;return o=o.fallback,h?(bi(),h=i.mode,E=Mo({mode:"hidden",children:E},h),o=Qi(o,h,a,null),E.return=i,o.return=i,E.sibling=o,i.child=E,o=i.child,o.memoizedState=mf(a),o.childLanes=pf(t,v,a),i.memoizedState=df,Xa(null,o)):(yi(i),gf(i,E))}var I=t.memoizedState;if(I!==null&&(E=I.dehydrated,E!==null)){if(p)i.flags&256?(yi(i),i.flags&=-257,i=yf(t,i,a)):i.memoizedState!==null?(bi(),i.child=t.child,i.flags|=128,i=null):(bi(),E=o.fallback,h=i.mode,o=Mo({mode:"visible",children:o.children},h),E=Qi(E,h,a,null),E.flags|=2,o.return=i,E.return=i,o.sibling=E,i.child=o,is(i,t.child,null,a),o=i.child,o.memoizedState=mf(a),o.childLanes=pf(t,v,a),i.memoizedState=df,i=Xa(null,o));else if(yi(i),Qf(E)){if(v=E.nextSibling&&E.nextSibling.dataset,v)var ie=v.dgst;v=ie,o=Error(s(419)),o.stack="",o.digest=v,Ua({value:o,source:null,stack:null}),i=yf(t,i,a)}else if(Xt||Ns(t,i,a,!1),v=(a&t.childLanes)!==0,Xt||v){if(v=At,v!==null&&(o=oi(v,a),o!==0&&o!==I.retryLane))throw I.retryLane=o,Ki(t,o),kn(v,t,o),ff;Kf(E)||Io(),i=yf(t,i,a)}else Kf(E)?(i.flags|=192,i.child=t.child,i=null):(t=I.treeContext,Rt=tr(E.nextSibling),sn=i,st=!0,fi=null,Wn=!1,t!==null&&Vm(i,t),i=gf(i,o.children),i.flags|=4096);return i}return h?(bi(),E=o.fallback,h=i.mode,I=t.child,ie=I.sibling,o=Lr(I,{mode:"hidden",children:o.children}),o.subtreeFlags=I.subtreeFlags&65011712,ie!==null?E=Lr(ie,E):(E=Qi(E,h,a,null),E.flags|=2),E.return=i,o.return=i,o.sibling=E,i.child=o,Xa(null,o),o=i.child,E=t.child.memoizedState,E===null?E=mf(a):(h=E.cachePool,h!==null?(I=Vt._currentValue,h=h.parent!==I?{parent:I,pool:I}:h):h=Wm(),E={baseLanes:E.baseLanes|a,cachePool:h}),o.memoizedState=E,o.childLanes=pf(t,v,a),i.memoizedState=df,Xa(t.child,o)):(yi(i),a=t.child,t=a.sibling,a=Lr(a,{mode:"visible",children:o.children}),a.return=i,a.sibling=null,t!==null&&(v=i.deletions,v===null?(i.deletions=[t],i.flags|=16):v.push(t)),i.child=a,i.memoizedState=null,a)}function gf(t,i){return i=Mo({mode:"visible",children:i},t.mode),i.return=t,t.child=i}function Mo(t,i){return t=Mn(22,t,null,i),t.lanes=0,t}function yf(t,i,a){return is(i,t.child,null,a),t=gf(i,i.pendingProps.children),t.flags|=2,i.memoizedState=null,t}function hg(t,i,a){t.lanes|=i;var o=t.alternate;o!==null&&(o.lanes|=i),Oc(t.return,i,a)}function bf(t,i,a,o,h,p){var v=t.memoizedState;v===null?t.memoizedState={isBackwards:i,rendering:null,renderingStartTime:0,last:o,tail:a,tailMode:h,treeForkCount:p}:(v.isBackwards=i,v.rendering=null,v.renderingStartTime=0,v.last=o,v.tail=a,v.tailMode=h,v.treeForkCount=p)}function dg(t,i,a){var o=i.pendingProps,h=o.revealOrder,p=o.tail;o=o.children;var v=Ft.current,E=(v&2)!==0;if(E?(v=v&1|2,i.flags|=128):v&=1,A(Ft,v),ln(t,i,o,a),o=st?za:0,!E&&t!==null&&(t.flags&128)!==0)e:for(t=i.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&hg(t,a,i);else if(t.tag===19)hg(t,a,i);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===i)break e;for(;t.sibling===null;){if(t.return===null||t.return===i)break e;t=t.return}t.sibling.return=t.return,t=t.sibling}switch(h){case"forwards":for(a=i.child,h=null;a!==null;)t=a.alternate,t!==null&&wo(t)===null&&(h=a),a=a.sibling;a=h,a===null?(h=i.child,i.child=null):(h=a.sibling,a.sibling=null),bf(i,!1,h,a,p,o);break;case"backwards":case"unstable_legacy-backwards":for(a=null,h=i.child,i.child=null;h!==null;){if(t=h.alternate,t!==null&&wo(t)===null){i.child=h;break}t=h.sibling,h.sibling=a,a=h,h=t}bf(i,!0,a,null,p,o);break;case"together":bf(i,!1,null,null,void 0,o);break;default:i.memoizedState=null}return i.child}function Hr(t,i,a){if(t!==null&&(i.dependencies=t.dependencies),wi|=i.lanes,(a&i.childLanes)===0)if(t!==null){if(Ns(t,i,a,!1),(a&i.childLanes)===0)return null}else return null;if(t!==null&&i.child!==t.child)throw Error(s(153));if(i.child!==null){for(t=i.child,a=Lr(t,t.pendingProps),i.child=a,a.return=i;t.sibling!==null;)t=t.sibling,a=a.sibling=Lr(t,t.pendingProps),a.return=i;a.sibling=null}return i.child}function xf(t,i){return(t.lanes&i)!==0?!0:(t=t.dependencies,!!(t!==null&&ho(t)))}function Gv(t,i,a){switch(i.tag){case 3:qe(i,i.stateNode.containerInfo),di(i,Vt,t.memoizedState.cache),Zi();break;case 27:case 5:Ae(i);break;case 4:qe(i,i.stateNode.containerInfo);break;case 10:di(i,i.type,i.memoizedProps.value);break;case 31:if(i.memoizedState!==null)return i.flags|=128,Fc(i),null;break;case 13:var o=i.memoizedState;if(o!==null)return o.dehydrated!==null?(yi(i),i.flags|=128,null):(a&i.child.childLanes)!==0?fg(t,i,a):(yi(i),t=Hr(t,i,a),t!==null?t.sibling:null);yi(i);break;case 19:var h=(t.flags&128)!==0;if(o=(a&i.childLanes)!==0,o||(Ns(t,i,a,!1),o=(a&i.childLanes)!==0),h){if(o)return dg(t,i,a);i.flags|=128}if(h=i.memoizedState,h!==null&&(h.rendering=null,h.tail=null,h.lastEffect=null),A(Ft,Ft.current),o)break;return null;case 22:return i.lanes=0,sg(t,i,a,i.pendingProps);case 24:di(i,Vt,t.memoizedState.cache)}return Hr(t,i,a)}function mg(t,i,a){if(t!==null)if(t.memoizedProps!==i.pendingProps)Xt=!0;else{if(!xf(t,a)&&(i.flags&128)===0)return Xt=!1,Gv(t,i,a);Xt=(t.flags&131072)!==0}else Xt=!1,st&&(i.flags&1048576)!==0&&Gm(i,za,i.index);switch(i.lanes=0,i.tag){case 16:e:{var o=i.pendingProps;if(t=ns(i.elementType),i.type=t,typeof t=="function")_c(t)?(o=as(t,o),i.tag=1,i=ug(null,i,t,o,a)):(i.tag=0,i=hf(null,i,t,o,a));else{if(t!=null){var h=t.$$typeof;if(h===te){i.tag=11,i=ng(null,i,t,o,a);break e}else if(h===K){i.tag=14,i=rg(null,i,t,o,a);break e}}throw i=re(t)||t,Error(s(306,i,""))}}return i;case 0:return hf(t,i,i.type,i.pendingProps,a);case 1:return o=i.type,h=as(o,i.pendingProps),ug(t,i,o,h,a);case 3:e:{if(qe(i,i.stateNode.containerInfo),t===null)throw Error(s(387));o=i.pendingProps;var p=i.memoizedState;h=p.element,Bc(t,i),$a(i,o,null,a);var v=i.memoizedState;if(o=v.cache,di(i,Vt,o),o!==p.cache&&Rc(i,[Vt],a,!0),Fa(),o=v.element,p.isDehydrated)if(p={element:o,isDehydrated:!1,cache:v.cache},i.updateQueue.baseState=p,i.memoizedState=p,i.flags&256){i=cg(t,i,o,a);break e}else if(o!==h){h=Kn(Error(s(424)),i),Ua(h),i=cg(t,i,o,a);break e}else{switch(t=i.stateNode.containerInfo,t.nodeType){case 9:t=t.body;break;default:t=t.nodeName==="HTML"?t.ownerDocument.body:t}for(Rt=tr(t.firstChild),sn=i,st=!0,fi=null,Wn=!0,a=sp(i,null,o,a),i.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling}else{if(Zi(),o===h){i=Hr(t,i,a);break e}ln(t,i,o,a)}i=i.child}return i;case 26:return Ro(t,i),t===null?(a=ky(i.type,null,i.pendingProps,null))?i.memoizedState=a:st||(a=i.type,t=i.pendingProps,o=Xo(je.current).createElement(a),o[Ct]=i,o[qt]=t,on(o,a,t),Y(o),i.stateNode=o):i.memoizedState=ky(i.type,t.memoizedProps,i.pendingProps,t.memoizedState),null;case 27:return Ae(i),t===null&&st&&(o=i.stateNode=Sy(i.type,i.pendingProps,je.current),sn=i,Wn=!0,h=Rt,Ci(i.type)?(Zf=h,Rt=tr(o.firstChild)):Rt=h),ln(t,i,i.pendingProps.children,a),Ro(t,i),t===null&&(i.flags|=4194304),i.child;case 5:return t===null&&st&&((h=o=Rt)&&(o=Sw(o,i.type,i.pendingProps,Wn),o!==null?(i.stateNode=o,sn=i,Rt=tr(o.firstChild),Wn=!1,h=!0):h=!1),h||hi(i)),Ae(i),h=i.type,p=i.pendingProps,v=t!==null?t.memoizedProps:null,o=p.children,Vf(h,p)?o=null:v!==null&&Vf(h,v)&&(i.flags|=32),i.memoizedState!==null&&(h=Yc(t,i,Uv,null,null,a),cl._currentValue=h),Ro(t,i),ln(t,i,o,a),i.child;case 6:return t===null&&st&&((t=a=Rt)&&(a=_w(a,i.pendingProps,Wn),a!==null?(i.stateNode=a,sn=i,Rt=null,t=!0):t=!1),t||hi(i)),null;case 13:return fg(t,i,a);case 4:return qe(i,i.stateNode.containerInfo),o=i.pendingProps,t===null?i.child=is(i,null,o,a):ln(t,i,o,a),i.child;case 11:return ng(t,i,i.type,i.pendingProps,a);case 7:return ln(t,i,i.pendingProps,a),i.child;case 8:return ln(t,i,i.pendingProps.children,a),i.child;case 12:return ln(t,i,i.pendingProps.children,a),i.child;case 10:return o=i.pendingProps,di(i,i.type,o.value),ln(t,i,o.children,a),i.child;case 9:return h=i.type._context,o=i.pendingProps.children,es(i),h=an(h),o=o(h),i.flags|=1,ln(t,i,o,a),i.child;case 14:return rg(t,i,i.type,i.pendingProps,a);case 15:return ig(t,i,i.type,i.pendingProps,a);case 19:return dg(t,i,a);case 31:return Yv(t,i,a);case 22:return sg(t,i,a,i.pendingProps);case 24:return es(i),o=an(Vt),t===null?(h=Lc(),h===null&&(h=At,p=Mc(),h.pooledCache=p,p.refCount++,p!==null&&(h.pooledCacheLanes|=a),h=p),i.memoizedState={parent:o,cache:h},Uc(i),di(i,Vt,h)):((t.lanes&a)!==0&&(Bc(t,i),$a(i,null,null,a),Fa()),h=t.memoizedState,p=i.memoizedState,h.parent!==o?(h={parent:o,cache:o},i.memoizedState=h,i.lanes===0&&(i.memoizedState=i.updateQueue.baseState=h),di(i,Vt,o)):(o=p.cache,di(i,Vt,o),o!==h.cache&&Rc(i,[Vt],a,!0))),ln(t,i,i.pendingProps.children,a),i.child;case 29:throw i.pendingProps}throw Error(s(156,i.tag))}function Ir(t){t.flags|=4}function vf(t,i,a,o,h){if((i=(t.mode&32)!==0)&&(i=!1),i){if(t.flags|=16777216,(h&335544128)===h)if(t.stateNode.complete)t.flags|=8192;else if(Hg())t.flags|=8192;else throw rs=yo,zc}else t.flags&=-16777217}function pg(t,i){if(i.type!=="stylesheet"||(i.state.loading&4)!==0)t.flags&=-16777217;else if(t.flags|=16777216,!Ny(i))if(Hg())t.flags|=8192;else throw rs=yo,zc}function Do(t,i){i!==null&&(t.flags|=4),t.flags&16384&&(i=t.tag!==22?gs():536870912,t.lanes|=i,Is|=i)}function Ka(t,i){if(!st)switch(t.tailMode){case"hidden":i=t.tail;for(var a=null;i!==null;)i.alternate!==null&&(a=i),i=i.sibling;a===null?t.tail=null:a.sibling=null;break;case"collapsed":a=t.tail;for(var o=null;a!==null;)a.alternate!==null&&(o=a),a=a.sibling;o===null?i||t.tail===null?t.tail=null:t.tail.sibling=null:o.sibling=null}}function Mt(t){var i=t.alternate!==null&&t.alternate.child===t.child,a=0,o=0;if(i)for(var h=t.child;h!==null;)a|=h.lanes|h.childLanes,o|=h.subtreeFlags&65011712,o|=h.flags&65011712,h.return=t,h=h.sibling;else for(h=t.child;h!==null;)a|=h.lanes|h.childLanes,o|=h.subtreeFlags,o|=h.flags,h.return=t,h=h.sibling;return t.subtreeFlags|=o,t.childLanes=a,i}function Vv(t,i,a){var o=i.pendingProps;switch(Ac(i),i.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Mt(i),null;case 1:return Mt(i),null;case 3:return a=i.stateNode,o=null,t!==null&&(o=t.memoizedState.cache),i.memoizedState.cache!==o&&(i.flags|=2048),Br(Vt),Te(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(t===null||t.child===null)&&(js(i)?Ir(i):t===null||t.memoizedState.isDehydrated&&(i.flags&256)===0||(i.flags|=1024,jc())),Mt(i),null;case 26:var h=i.type,p=i.memoizedState;return t===null?(Ir(i),p!==null?(Mt(i),pg(i,p)):(Mt(i),vf(i,h,null,o,a))):p?p!==t.memoizedState?(Ir(i),Mt(i),pg(i,p)):(Mt(i),i.flags&=-16777217):(t=t.memoizedProps,t!==o&&Ir(i),Mt(i),vf(i,h,t,o,a)),null;case 27:if(Je(i),a=je.current,h=i.type,t!==null&&i.stateNode!=null)t.memoizedProps!==o&&Ir(i);else{if(!o){if(i.stateNode===null)throw Error(s(166));return Mt(i),null}t=ve.current,js(i)?Jm(i):(t=Sy(h,o,a),i.stateNode=t,Ir(i))}return Mt(i),null;case 5:if(Je(i),h=i.type,t!==null&&i.stateNode!=null)t.memoizedProps!==o&&Ir(i);else{if(!o){if(i.stateNode===null)throw Error(s(166));return Mt(i),null}if(p=ve.current,js(i))Jm(i);else{var v=Xo(je.current);switch(p){case 1:p=v.createElementNS("http://www.w3.org/2000/svg",h);break;case 2:p=v.createElementNS("http://www.w3.org/1998/Math/MathML",h);break;default:switch(h){case"svg":p=v.createElementNS("http://www.w3.org/2000/svg",h);break;case"math":p=v.createElementNS("http://www.w3.org/1998/Math/MathML",h);break;case"script":p=v.createElement("div"),p.innerHTML="<script><\/script>",p=p.removeChild(p.firstChild);break;case"select":p=typeof o.is=="string"?v.createElement("select",{is:o.is}):v.createElement("select"),o.multiple?p.multiple=!0:o.size&&(p.size=o.size);break;default:p=typeof o.is=="string"?v.createElement(h,{is:o.is}):v.createElement(h)}}p[Ct]=i,p[qt]=o;e:for(v=i.child;v!==null;){if(v.tag===5||v.tag===6)p.appendChild(v.stateNode);else if(v.tag!==4&&v.tag!==27&&v.child!==null){v.child.return=v,v=v.child;continue}if(v===i)break e;for(;v.sibling===null;){if(v.return===null||v.return===i)break e;v=v.return}v.sibling.return=v.return,v=v.sibling}i.stateNode=p;e:switch(on(p,h,o),h){case"button":case"input":case"select":case"textarea":o=!!o.autoFocus;break e;case"img":o=!0;break e;default:o=!1}o&&Ir(i)}}return Mt(i),vf(i,i.type,t===null?null:t.memoizedProps,i.pendingProps,a),null;case 6:if(t&&i.stateNode!=null)t.memoizedProps!==o&&Ir(i);else{if(typeof o!="string"&&i.stateNode===null)throw Error(s(166));if(t=je.current,js(i)){if(t=i.stateNode,a=i.memoizedProps,o=null,h=sn,h!==null)switch(h.tag){case 27:case 5:o=h.memoizedProps}t[Ct]=i,t=!!(t.nodeValue===a||o!==null&&o.suppressHydrationWarning===!0||fy(t.nodeValue,a)),t||hi(i,!0)}else t=Xo(t).createTextNode(o),t[Ct]=i,i.stateNode=t}return Mt(i),null;case 31:if(a=i.memoizedState,t===null||t.memoizedState!==null){if(o=js(i),a!==null){if(t===null){if(!o)throw Error(s(318));if(t=i.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(s(557));t[Ct]=i}else Zi(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;Mt(i),t=!1}else a=jc(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=a),t=!0;if(!t)return i.flags&256?(Ln(i),i):(Ln(i),null);if((i.flags&128)!==0)throw Error(s(558))}return Mt(i),null;case 13:if(o=i.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(h=js(i),o!==null&&o.dehydrated!==null){if(t===null){if(!h)throw Error(s(318));if(h=i.memoizedState,h=h!==null?h.dehydrated:null,!h)throw Error(s(317));h[Ct]=i}else Zi(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;Mt(i),h=!1}else h=jc(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=h),h=!0;if(!h)return i.flags&256?(Ln(i),i):(Ln(i),null)}return Ln(i),(i.flags&128)!==0?(i.lanes=a,i):(a=o!==null,t=t!==null&&t.memoizedState!==null,a&&(o=i.child,h=null,o.alternate!==null&&o.alternate.memoizedState!==null&&o.alternate.memoizedState.cachePool!==null&&(h=o.alternate.memoizedState.cachePool.pool),p=null,o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(p=o.memoizedState.cachePool.pool),p!==h&&(o.flags|=2048)),a!==t&&a&&(i.child.flags|=8192),Do(i,i.updateQueue),Mt(i),null);case 4:return Te(),t===null&&If(i.stateNode.containerInfo),Mt(i),null;case 10:return Br(i.type),Mt(i),null;case 19:if(W(Ft),o=i.memoizedState,o===null)return Mt(i),null;if(h=(i.flags&128)!==0,p=o.rendering,p===null)if(h)Ka(o,!1);else{if(It!==0||t!==null&&(t.flags&128)!==0)for(t=i.child;t!==null;){if(p=wo(t),p!==null){for(i.flags|=128,Ka(o,!1),t=p.updateQueue,i.updateQueue=t,Do(i,t),i.subtreeFlags=0,t=a,a=i.child;a!==null;)Fm(a,t),a=a.sibling;return A(Ft,Ft.current&1|2),st&&zr(i,o.treeForkCount),i.child}t=t.sibling}o.tail!==null&&xt()>Po&&(i.flags|=128,h=!0,Ka(o,!1),i.lanes=4194304)}else{if(!h)if(t=wo(p),t!==null){if(i.flags|=128,h=!0,t=t.updateQueue,i.updateQueue=t,Do(i,t),Ka(o,!0),o.tail===null&&o.tailMode==="hidden"&&!p.alternate&&!st)return Mt(i),null}else 2*xt()-o.renderingStartTime>Po&&a!==536870912&&(i.flags|=128,h=!0,Ka(o,!1),i.lanes=4194304);o.isBackwards?(p.sibling=i.child,i.child=p):(t=o.last,t!==null?t.sibling=p:i.child=p,o.last=p)}return o.tail!==null?(t=o.tail,o.rendering=t,o.tail=t.sibling,o.renderingStartTime=xt(),t.sibling=null,a=Ft.current,A(Ft,h?a&1|2:a&1),st&&zr(i,o.treeForkCount),t):(Mt(i),null);case 22:case 23:return Ln(i),Ic(),o=i.memoizedState!==null,t!==null?t.memoizedState!==null!==o&&(i.flags|=8192):o&&(i.flags|=8192),o?(a&536870912)!==0&&(i.flags&128)===0&&(Mt(i),i.subtreeFlags&6&&(i.flags|=8192)):Mt(i),a=i.updateQueue,a!==null&&Do(i,a.retryQueue),a=null,t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(a=t.memoizedState.cachePool.pool),o=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(o=i.memoizedState.cachePool.pool),o!==a&&(i.flags|=2048),t!==null&&W(ts),null;case 24:return a=null,t!==null&&(a=t.memoizedState.cache),i.memoizedState.cache!==a&&(i.flags|=2048),Br(Vt),Mt(i),null;case 25:return null;case 30:return null}throw Error(s(156,i.tag))}function Jv(t,i){switch(Ac(i),i.tag){case 1:return t=i.flags,t&65536?(i.flags=t&-65537|128,i):null;case 3:return Br(Vt),Te(),t=i.flags,(t&65536)!==0&&(t&128)===0?(i.flags=t&-65537|128,i):null;case 26:case 27:case 5:return Je(i),null;case 31:if(i.memoizedState!==null){if(Ln(i),i.alternate===null)throw Error(s(340));Zi()}return t=i.flags,t&65536?(i.flags=t&-65537|128,i):null;case 13:if(Ln(i),t=i.memoizedState,t!==null&&t.dehydrated!==null){if(i.alternate===null)throw Error(s(340));Zi()}return t=i.flags,t&65536?(i.flags=t&-65537|128,i):null;case 19:return W(Ft),null;case 4:return Te(),null;case 10:return Br(i.type),null;case 22:case 23:return Ln(i),Ic(),t!==null&&W(ts),t=i.flags,t&65536?(i.flags=t&-65537|128,i):null;case 24:return Br(Vt),null;case 25:return null;default:return null}}function gg(t,i){switch(Ac(i),i.tag){case 3:Br(Vt),Te();break;case 26:case 27:case 5:Je(i);break;case 4:Te();break;case 31:i.memoizedState!==null&&Ln(i);break;case 13:Ln(i);break;case 19:W(Ft);break;case 10:Br(i.type);break;case 22:case 23:Ln(i),Ic(),t!==null&&W(ts);break;case 24:Br(Vt)}}function Qa(t,i){try{var a=i.updateQueue,o=a!==null?a.lastEffect:null;if(o!==null){var h=o.next;a=h;do{if((a.tag&t)===t){o=void 0;var p=a.create,v=a.inst;o=p(),v.destroy=o}a=a.next}while(a!==h)}}catch(E){bt(i,i.return,E)}}function xi(t,i,a){try{var o=i.updateQueue,h=o!==null?o.lastEffect:null;if(h!==null){var p=h.next;o=p;do{if((o.tag&t)===t){var v=o.inst,E=v.destroy;if(E!==void 0){v.destroy=void 0,h=i;var I=a,ie=E;try{ie()}catch(ce){bt(h,I,ce)}}}o=o.next}while(o!==p)}}catch(ce){bt(i,i.return,ce)}}function yg(t){var i=t.updateQueue;if(i!==null){var a=t.stateNode;try{lp(i,a)}catch(o){bt(t,t.return,o)}}}function bg(t,i,a){a.props=as(t.type,t.memoizedProps),a.state=t.memoizedState;try{a.componentWillUnmount()}catch(o){bt(t,i,o)}}function Za(t,i){try{var a=t.ref;if(a!==null){switch(t.tag){case 26:case 27:case 5:var o=t.stateNode;break;case 30:o=t.stateNode;break;default:o=t.stateNode}typeof a=="function"?t.refCleanup=a(o):a.current=o}}catch(h){bt(t,i,h)}}function vr(t,i){var a=t.ref,o=t.refCleanup;if(a!==null)if(typeof o=="function")try{o()}catch(h){bt(t,i,h)}finally{t.refCleanup=null,t=t.alternate,t!=null&&(t.refCleanup=null)}else if(typeof a=="function")try{a(null)}catch(h){bt(t,i,h)}else a.current=null}function xg(t){var i=t.type,a=t.memoizedProps,o=t.stateNode;try{e:switch(i){case"button":case"input":case"select":case"textarea":a.autoFocus&&o.focus();break e;case"img":a.src?o.src=a.src:a.srcSet&&(o.srcset=a.srcSet)}}catch(h){bt(t,t.return,h)}}function wf(t,i,a){try{var o=t.stateNode;gw(o,t.type,a,i),o[qt]=i}catch(h){bt(t,t.return,h)}}function vg(t){return t.tag===5||t.tag===3||t.tag===26||t.tag===27&&Ci(t.type)||t.tag===4}function Sf(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||vg(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.tag===27&&Ci(t.type)||t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function _f(t,i,a){var o=t.tag;if(o===5||o===6)t=t.stateNode,i?(a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a).insertBefore(t,i):(i=a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a,i.appendChild(t),a=a._reactRootContainer,a!=null||i.onclick!==null||(i.onclick=Mr));else if(o!==4&&(o===27&&Ci(t.type)&&(a=t.stateNode,i=null),t=t.child,t!==null))for(_f(t,i,a),t=t.sibling;t!==null;)_f(t,i,a),t=t.sibling}function Lo(t,i,a){var o=t.tag;if(o===5||o===6)t=t.stateNode,i?a.insertBefore(t,i):a.appendChild(t);else if(o!==4&&(o===27&&Ci(t.type)&&(a=t.stateNode),t=t.child,t!==null))for(Lo(t,i,a),t=t.sibling;t!==null;)Lo(t,i,a),t=t.sibling}function wg(t){var i=t.stateNode,a=t.memoizedProps;try{for(var o=t.type,h=i.attributes;h.length;)i.removeAttributeNode(h[0]);on(i,o,a),i[Ct]=t,i[qt]=a}catch(p){bt(t,t.return,p)}}var Fr=!1,Kt=!1,Ef=!1,Sg=typeof WeakSet=="function"?WeakSet:Set,en=null;function Xv(t,i){if(t=t.containerInfo,Yf=nu,t=Dm(t),gc(t)){if("selectionStart"in t)var a={start:t.selectionStart,end:t.selectionEnd};else e:{a=(a=t.ownerDocument)&&a.defaultView||window;var o=a.getSelection&&a.getSelection();if(o&&o.rangeCount!==0){a=o.anchorNode;var h=o.anchorOffset,p=o.focusNode;o=o.focusOffset;try{a.nodeType,p.nodeType}catch{a=null;break e}var v=0,E=-1,I=-1,ie=0,ce=0,pe=t,se=null;t:for(;;){for(var oe;pe!==a||h!==0&&pe.nodeType!==3||(E=v+h),pe!==p||o!==0&&pe.nodeType!==3||(I=v+o),pe.nodeType===3&&(v+=pe.nodeValue.length),(oe=pe.firstChild)!==null;)se=pe,pe=oe;for(;;){if(pe===t)break t;if(se===a&&++ie===h&&(E=v),se===p&&++ce===o&&(I=v),(oe=pe.nextSibling)!==null)break;pe=se,se=pe.parentNode}pe=oe}a=E===-1||I===-1?null:{start:E,end:I}}else a=null}a=a||{start:0,end:0}}else a=null;for(Gf={focusedElem:t,selectionRange:a},nu=!1,en=i;en!==null;)if(i=en,t=i.child,(i.subtreeFlags&1028)!==0&&t!==null)t.return=i,en=t;else for(;en!==null;){switch(i=en,p=i.alternate,t=i.flags,i.tag){case 0:if((t&4)!==0&&(t=i.updateQueue,t=t!==null?t.events:null,t!==null))for(a=0;a<t.length;a++)h=t[a],h.ref.impl=h.nextImpl;break;case 11:case 15:break;case 1:if((t&1024)!==0&&p!==null){t=void 0,a=i,h=p.memoizedProps,p=p.memoizedState,o=a.stateNode;try{var Re=as(a.type,h);t=o.getSnapshotBeforeUpdate(Re,p),o.__reactInternalSnapshotBeforeUpdate=t}catch(Pe){bt(a,a.return,Pe)}}break;case 3:if((t&1024)!==0){if(t=i.stateNode.containerInfo,a=t.nodeType,a===9)Xf(t);else if(a===1)switch(t.nodeName){case"HEAD":case"HTML":case"BODY":Xf(t);break;default:t.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((t&1024)!==0)throw Error(s(163))}if(t=i.sibling,t!==null){t.return=i.return,en=t;break}en=i.return}}function _g(t,i,a){var o=a.flags;switch(a.tag){case 0:case 11:case 15:Yr(t,a),o&4&&Qa(5,a);break;case 1:if(Yr(t,a),o&4)if(t=a.stateNode,i===null)try{t.componentDidMount()}catch(v){bt(a,a.return,v)}else{var h=as(a.type,i.memoizedProps);i=i.memoizedState;try{t.componentDidUpdate(h,i,t.__reactInternalSnapshotBeforeUpdate)}catch(v){bt(a,a.return,v)}}o&64&&yg(a),o&512&&Za(a,a.return);break;case 3:if(Yr(t,a),o&64&&(t=a.updateQueue,t!==null)){if(i=null,a.child!==null)switch(a.child.tag){case 27:case 5:i=a.child.stateNode;break;case 1:i=a.child.stateNode}try{lp(t,i)}catch(v){bt(a,a.return,v)}}break;case 27:i===null&&o&4&&wg(a);case 26:case 5:Yr(t,a),i===null&&o&4&&xg(a),o&512&&Za(a,a.return);break;case 12:Yr(t,a);break;case 31:Yr(t,a),o&4&&Cg(t,a);break;case 13:Yr(t,a),o&4&&Ag(t,a),o&64&&(t=a.memoizedState,t!==null&&(t=t.dehydrated,t!==null&&(a=iw.bind(null,a),Ew(t,a))));break;case 22:if(o=a.memoizedState!==null||Fr,!o){i=i!==null&&i.memoizedState!==null||Kt,h=Fr;var p=Kt;Fr=o,(Kt=i)&&!p?Gr(t,a,(a.subtreeFlags&8772)!==0):Yr(t,a),Fr=h,Kt=p}break;case 30:break;default:Yr(t,a)}}function Eg(t){var i=t.alternate;i!==null&&(t.alternate=null,Eg(i)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(i=t.stateNode,i!==null&&ys(i)),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}var Dt=null,wn=!1;function $r(t,i,a){for(a=a.child;a!==null;)kg(t,i,a),a=a.sibling}function kg(t,i,a){if(ge&&typeof ge.onCommitFiberUnmount=="function")try{ge.onCommitFiberUnmount(Gt,a)}catch{}switch(a.tag){case 26:Kt||vr(a,i),$r(t,i,a),a.memoizedState?a.memoizedState.count--:a.stateNode&&(a=a.stateNode,a.parentNode.removeChild(a));break;case 27:Kt||vr(a,i);var o=Dt,h=wn;Ci(a.type)&&(Dt=a.stateNode,wn=!1),$r(t,i,a),ll(a.stateNode),Dt=o,wn=h;break;case 5:Kt||vr(a,i);case 6:if(o=Dt,h=wn,Dt=null,$r(t,i,a),Dt=o,wn=h,Dt!==null)if(wn)try{(Dt.nodeType===9?Dt.body:Dt.nodeName==="HTML"?Dt.ownerDocument.body:Dt).removeChild(a.stateNode)}catch(p){bt(a,i,p)}else try{Dt.removeChild(a.stateNode)}catch(p){bt(a,i,p)}break;case 18:Dt!==null&&(wn?(t=Dt,yy(t.nodeType===9?t.body:t.nodeName==="HTML"?t.ownerDocument.body:t,a.stateNode),Ks(t)):yy(Dt,a.stateNode));break;case 4:o=Dt,h=wn,Dt=a.stateNode.containerInfo,wn=!0,$r(t,i,a),Dt=o,wn=h;break;case 0:case 11:case 14:case 15:xi(2,a,i),Kt||xi(4,a,i),$r(t,i,a);break;case 1:Kt||(vr(a,i),o=a.stateNode,typeof o.componentWillUnmount=="function"&&bg(a,i,o)),$r(t,i,a);break;case 21:$r(t,i,a);break;case 22:Kt=(o=Kt)||a.memoizedState!==null,$r(t,i,a),Kt=o;break;default:$r(t,i,a)}}function Cg(t,i){if(i.memoizedState===null&&(t=i.alternate,t!==null&&(t=t.memoizedState,t!==null))){t=t.dehydrated;try{Ks(t)}catch(a){bt(i,i.return,a)}}}function Ag(t,i){if(i.memoizedState===null&&(t=i.alternate,t!==null&&(t=t.memoizedState,t!==null&&(t=t.dehydrated,t!==null))))try{Ks(t)}catch(a){bt(i,i.return,a)}}function Kv(t){switch(t.tag){case 31:case 13:case 19:var i=t.stateNode;return i===null&&(i=t.stateNode=new Sg),i;case 22:return t=t.stateNode,i=t._retryCache,i===null&&(i=t._retryCache=new Sg),i;default:throw Error(s(435,t.tag))}}function zo(t,i){var a=Kv(t);i.forEach(function(o){if(!a.has(o)){a.add(o);var h=sw.bind(null,t,o);o.then(h,h)}})}function Sn(t,i){var a=i.deletions;if(a!==null)for(var o=0;o<a.length;o++){var h=a[o],p=t,v=i,E=v;e:for(;E!==null;){switch(E.tag){case 27:if(Ci(E.type)){Dt=E.stateNode,wn=!1;break e}break;case 5:Dt=E.stateNode,wn=!1;break e;case 3:case 4:Dt=E.stateNode.containerInfo,wn=!0;break e}E=E.return}if(Dt===null)throw Error(s(160));kg(p,v,h),Dt=null,wn=!1,p=h.alternate,p!==null&&(p.return=null),h.return=null}if(i.subtreeFlags&13886)for(i=i.child;i!==null;)Tg(i,t),i=i.sibling}var fr=null;function Tg(t,i){var a=t.alternate,o=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:Sn(i,t),_n(t),o&4&&(xi(3,t,t.return),Qa(3,t),xi(5,t,t.return));break;case 1:Sn(i,t),_n(t),o&512&&(Kt||a===null||vr(a,a.return)),o&64&&Fr&&(t=t.updateQueue,t!==null&&(o=t.callbacks,o!==null&&(a=t.shared.hiddenCallbacks,t.shared.hiddenCallbacks=a===null?o:a.concat(o))));break;case 26:var h=fr;if(Sn(i,t),_n(t),o&512&&(Kt||a===null||vr(a,a.return)),o&4){var p=a!==null?a.memoizedState:null;if(o=t.memoizedState,a===null)if(o===null)if(t.stateNode===null){e:{o=t.type,a=t.memoizedProps,h=h.ownerDocument||h;t:switch(o){case"title":p=h.getElementsByTagName("title")[0],(!p||p[Zt]||p[Ct]||p.namespaceURI==="http://www.w3.org/2000/svg"||p.hasAttribute("itemprop"))&&(p=h.createElement(o),h.head.insertBefore(p,h.querySelector("head > title"))),on(p,o,a),p[Ct]=t,Y(p),o=p;break e;case"link":var v=Ty("link","href",h).get(o+(a.href||""));if(v){for(var E=0;E<v.length;E++)if(p=v[E],p.getAttribute("href")===(a.href==null||a.href===""?null:a.href)&&p.getAttribute("rel")===(a.rel==null?null:a.rel)&&p.getAttribute("title")===(a.title==null?null:a.title)&&p.getAttribute("crossorigin")===(a.crossOrigin==null?null:a.crossOrigin)){v.splice(E,1);break t}}p=h.createElement(o),on(p,o,a),h.head.appendChild(p);break;case"meta":if(v=Ty("meta","content",h).get(o+(a.content||""))){for(E=0;E<v.length;E++)if(p=v[E],p.getAttribute("content")===(a.content==null?null:""+a.content)&&p.getAttribute("name")===(a.name==null?null:a.name)&&p.getAttribute("property")===(a.property==null?null:a.property)&&p.getAttribute("http-equiv")===(a.httpEquiv==null?null:a.httpEquiv)&&p.getAttribute("charset")===(a.charSet==null?null:a.charSet)){v.splice(E,1);break t}}p=h.createElement(o),on(p,o,a),h.head.appendChild(p);break;default:throw Error(s(468,o))}p[Ct]=t,Y(p),o=p}t.stateNode=o}else jy(h,t.type,t.stateNode);else t.stateNode=Ay(h,o,t.memoizedProps);else p!==o?(p===null?a.stateNode!==null&&(a=a.stateNode,a.parentNode.removeChild(a)):p.count--,o===null?jy(h,t.type,t.stateNode):Ay(h,o,t.memoizedProps)):o===null&&t.stateNode!==null&&wf(t,t.memoizedProps,a.memoizedProps)}break;case 27:Sn(i,t),_n(t),o&512&&(Kt||a===null||vr(a,a.return)),a!==null&&o&4&&wf(t,t.memoizedProps,a.memoizedProps);break;case 5:if(Sn(i,t),_n(t),o&512&&(Kt||a===null||vr(a,a.return)),t.flags&32){h=t.stateNode;try{xs(h,"")}catch(Re){bt(t,t.return,Re)}}o&4&&t.stateNode!=null&&(h=t.memoizedProps,wf(t,h,a!==null?a.memoizedProps:h)),o&1024&&(Ef=!0);break;case 6:if(Sn(i,t),_n(t),o&4){if(t.stateNode===null)throw Error(s(162));o=t.memoizedProps,a=t.stateNode;try{a.nodeValue=o}catch(Re){bt(t,t.return,Re)}}break;case 3:if(Zo=null,h=fr,fr=Ko(i.containerInfo),Sn(i,t),fr=h,_n(t),o&4&&a!==null&&a.memoizedState.isDehydrated)try{Ks(i.containerInfo)}catch(Re){bt(t,t.return,Re)}Ef&&(Ef=!1,jg(t));break;case 4:o=fr,fr=Ko(t.stateNode.containerInfo),Sn(i,t),_n(t),fr=o;break;case 12:Sn(i,t),_n(t);break;case 31:Sn(i,t),_n(t),o&4&&(o=t.updateQueue,o!==null&&(t.updateQueue=null,zo(t,o)));break;case 13:Sn(i,t),_n(t),t.child.flags&8192&&t.memoizedState!==null!=(a!==null&&a.memoizedState!==null)&&(Bo=xt()),o&4&&(o=t.updateQueue,o!==null&&(t.updateQueue=null,zo(t,o)));break;case 22:h=t.memoizedState!==null;var I=a!==null&&a.memoizedState!==null,ie=Fr,ce=Kt;if(Fr=ie||h,Kt=ce||I,Sn(i,t),Kt=ce,Fr=ie,_n(t),o&8192)e:for(i=t.stateNode,i._visibility=h?i._visibility&-2:i._visibility|1,h&&(a===null||I||Fr||Kt||ls(t)),a=null,i=t;;){if(i.tag===5||i.tag===26){if(a===null){I=a=i;try{if(p=I.stateNode,h)v=p.style,typeof v.setProperty=="function"?v.setProperty("display","none","important"):v.display="none";else{E=I.stateNode;var pe=I.memoizedProps.style,se=pe!=null&&pe.hasOwnProperty("display")?pe.display:null;E.style.display=se==null||typeof se=="boolean"?"":(""+se).trim()}}catch(Re){bt(I,I.return,Re)}}}else if(i.tag===6){if(a===null){I=i;try{I.stateNode.nodeValue=h?"":I.memoizedProps}catch(Re){bt(I,I.return,Re)}}}else if(i.tag===18){if(a===null){I=i;try{var oe=I.stateNode;h?by(oe,!0):by(I.stateNode,!1)}catch(Re){bt(I,I.return,Re)}}}else if((i.tag!==22&&i.tag!==23||i.memoizedState===null||i===t)&&i.child!==null){i.child.return=i,i=i.child;continue}if(i===t)break e;for(;i.sibling===null;){if(i.return===null||i.return===t)break e;a===i&&(a=null),i=i.return}a===i&&(a=null),i.sibling.return=i.return,i=i.sibling}o&4&&(o=t.updateQueue,o!==null&&(a=o.retryQueue,a!==null&&(o.retryQueue=null,zo(t,a))));break;case 19:Sn(i,t),_n(t),o&4&&(o=t.updateQueue,o!==null&&(t.updateQueue=null,zo(t,o)));break;case 30:break;case 21:break;default:Sn(i,t),_n(t)}}function _n(t){var i=t.flags;if(i&2){try{for(var a,o=t.return;o!==null;){if(vg(o)){a=o;break}o=o.return}if(a==null)throw Error(s(160));switch(a.tag){case 27:var h=a.stateNode,p=Sf(t);Lo(t,p,h);break;case 5:var v=a.stateNode;a.flags&32&&(xs(v,""),a.flags&=-33);var E=Sf(t);Lo(t,E,v);break;case 3:case 4:var I=a.stateNode.containerInfo,ie=Sf(t);_f(t,ie,I);break;default:throw Error(s(161))}}catch(ce){bt(t,t.return,ce)}t.flags&=-3}i&4096&&(t.flags&=-4097)}function jg(t){if(t.subtreeFlags&1024)for(t=t.child;t!==null;){var i=t;jg(i),i.tag===5&&i.flags&1024&&i.stateNode.reset(),t=t.sibling}}function Yr(t,i){if(i.subtreeFlags&8772)for(i=i.child;i!==null;)_g(t,i.alternate,i),i=i.sibling}function ls(t){for(t=t.child;t!==null;){var i=t;switch(i.tag){case 0:case 11:case 14:case 15:xi(4,i,i.return),ls(i);break;case 1:vr(i,i.return);var a=i.stateNode;typeof a.componentWillUnmount=="function"&&bg(i,i.return,a),ls(i);break;case 27:ll(i.stateNode);case 26:case 5:vr(i,i.return),ls(i);break;case 22:i.memoizedState===null&&ls(i);break;case 30:ls(i);break;default:ls(i)}t=t.sibling}}function Gr(t,i,a){for(a=a&&(i.subtreeFlags&8772)!==0,i=i.child;i!==null;){var o=i.alternate,h=t,p=i,v=p.flags;switch(p.tag){case 0:case 11:case 15:Gr(h,p,a),Qa(4,p);break;case 1:if(Gr(h,p,a),o=p,h=o.stateNode,typeof h.componentDidMount=="function")try{h.componentDidMount()}catch(ie){bt(o,o.return,ie)}if(o=p,h=o.updateQueue,h!==null){var E=o.stateNode;try{var I=h.shared.hiddenCallbacks;if(I!==null)for(h.shared.hiddenCallbacks=null,h=0;h<I.length;h++)ap(I[h],E)}catch(ie){bt(o,o.return,ie)}}a&&v&64&&yg(p),Za(p,p.return);break;case 27:wg(p);case 26:case 5:Gr(h,p,a),a&&o===null&&v&4&&xg(p),Za(p,p.return);break;case 12:Gr(h,p,a);break;case 31:Gr(h,p,a),a&&v&4&&Cg(h,p);break;case 13:Gr(h,p,a),a&&v&4&&Ag(h,p);break;case 22:p.memoizedState===null&&Gr(h,p,a),Za(p,p.return);break;case 30:break;default:Gr(h,p,a)}i=i.sibling}}function kf(t,i){var a=null;t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(a=t.memoizedState.cachePool.pool),t=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(t=i.memoizedState.cachePool.pool),t!==a&&(t!=null&&t.refCount++,a!=null&&Ba(a))}function Cf(t,i){t=null,i.alternate!==null&&(t=i.alternate.memoizedState.cache),i=i.memoizedState.cache,i!==t&&(i.refCount++,t!=null&&Ba(t))}function hr(t,i,a,o){if(i.subtreeFlags&10256)for(i=i.child;i!==null;)Ng(t,i,a,o),i=i.sibling}function Ng(t,i,a,o){var h=i.flags;switch(i.tag){case 0:case 11:case 15:hr(t,i,a,o),h&2048&&Qa(9,i);break;case 1:hr(t,i,a,o);break;case 3:hr(t,i,a,o),h&2048&&(t=null,i.alternate!==null&&(t=i.alternate.memoizedState.cache),i=i.memoizedState.cache,i!==t&&(i.refCount++,t!=null&&Ba(t)));break;case 12:if(h&2048){hr(t,i,a,o),t=i.stateNode;try{var p=i.memoizedProps,v=p.id,E=p.onPostCommit;typeof E=="function"&&E(v,i.alternate===null?"mount":"update",t.passiveEffectDuration,-0)}catch(I){bt(i,i.return,I)}}else hr(t,i,a,o);break;case 31:hr(t,i,a,o);break;case 13:hr(t,i,a,o);break;case 23:break;case 22:p=i.stateNode,v=i.alternate,i.memoizedState!==null?p._visibility&2?hr(t,i,a,o):Wa(t,i):p._visibility&2?hr(t,i,a,o):(p._visibility|=2,Ps(t,i,a,o,(i.subtreeFlags&10256)!==0||!1)),h&2048&&kf(v,i);break;case 24:hr(t,i,a,o),h&2048&&Cf(i.alternate,i);break;default:hr(t,i,a,o)}}function Ps(t,i,a,o,h){for(h=h&&((i.subtreeFlags&10256)!==0||!1),i=i.child;i!==null;){var p=t,v=i,E=a,I=o,ie=v.flags;switch(v.tag){case 0:case 11:case 15:Ps(p,v,E,I,h),Qa(8,v);break;case 23:break;case 22:var ce=v.stateNode;v.memoizedState!==null?ce._visibility&2?Ps(p,v,E,I,h):Wa(p,v):(ce._visibility|=2,Ps(p,v,E,I,h)),h&&ie&2048&&kf(v.alternate,v);break;case 24:Ps(p,v,E,I,h),h&&ie&2048&&Cf(v.alternate,v);break;default:Ps(p,v,E,I,h)}i=i.sibling}}function Wa(t,i){if(i.subtreeFlags&10256)for(i=i.child;i!==null;){var a=t,o=i,h=o.flags;switch(o.tag){case 22:Wa(a,o),h&2048&&kf(o.alternate,o);break;case 24:Wa(a,o),h&2048&&Cf(o.alternate,o);break;default:Wa(a,o)}i=i.sibling}}var el=8192;function qs(t,i,a){if(t.subtreeFlags&el)for(t=t.child;t!==null;)Og(t,i,a),t=t.sibling}function Og(t,i,a){switch(t.tag){case 26:qs(t,i,a),t.flags&el&&t.memoizedState!==null&&zw(a,fr,t.memoizedState,t.memoizedProps);break;case 5:qs(t,i,a);break;case 3:case 4:var o=fr;fr=Ko(t.stateNode.containerInfo),qs(t,i,a),fr=o;break;case 22:t.memoizedState===null&&(o=t.alternate,o!==null&&o.memoizedState!==null?(o=el,el=16777216,qs(t,i,a),el=o):qs(t,i,a));break;default:qs(t,i,a)}}function Rg(t){var i=t.alternate;if(i!==null&&(t=i.child,t!==null)){i.child=null;do i=t.sibling,t.sibling=null,t=i;while(t!==null)}}function tl(t){var i=t.deletions;if((t.flags&16)!==0){if(i!==null)for(var a=0;a<i.length;a++){var o=i[a];en=o,Dg(o,t)}Rg(t)}if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Mg(t),t=t.sibling}function Mg(t){switch(t.tag){case 0:case 11:case 15:tl(t),t.flags&2048&&xi(9,t,t.return);break;case 3:tl(t);break;case 12:tl(t);break;case 22:var i=t.stateNode;t.memoizedState!==null&&i._visibility&2&&(t.return===null||t.return.tag!==13)?(i._visibility&=-3,Uo(t)):tl(t);break;default:tl(t)}}function Uo(t){var i=t.deletions;if((t.flags&16)!==0){if(i!==null)for(var a=0;a<i.length;a++){var o=i[a];en=o,Dg(o,t)}Rg(t)}for(t=t.child;t!==null;){switch(i=t,i.tag){case 0:case 11:case 15:xi(8,i,i.return),Uo(i);break;case 22:a=i.stateNode,a._visibility&2&&(a._visibility&=-3,Uo(i));break;default:Uo(i)}t=t.sibling}}function Dg(t,i){for(;en!==null;){var a=en;switch(a.tag){case 0:case 11:case 15:xi(8,a,i);break;case 23:case 22:if(a.memoizedState!==null&&a.memoizedState.cachePool!==null){var o=a.memoizedState.cachePool.pool;o!=null&&o.refCount++}break;case 24:Ba(a.memoizedState.cache)}if(o=a.child,o!==null)o.return=a,en=o;else e:for(a=t;en!==null;){o=en;var h=o.sibling,p=o.return;if(Eg(o),o===a){en=null;break e}if(h!==null){h.return=p,en=h;break e}en=p}}}var Qv={getCacheForType:function(t){var i=an(Vt),a=i.data.get(t);return a===void 0&&(a=t(),i.data.set(t,a)),a},cacheSignal:function(){return an(Vt).controller.signal}},Zv=typeof WeakMap=="function"?WeakMap:Map,dt=0,At=null,Qe=null,tt=0,yt=0,zn=null,vi=!1,Hs=!1,Af=!1,Vr=0,It=0,wi=0,os=0,Tf=0,Un=0,Is=0,nl=null,En=null,jf=!1,Bo=0,Lg=0,Po=1/0,qo=null,Si=null,Wt=0,_i=null,Fs=null,Jr=0,Nf=0,Of=null,zg=null,rl=0,Rf=null;function Bn(){return(dt&2)!==0&&tt!==0?tt&-tt:P.T!==null?Bf():ka()}function Ug(){if(Un===0)if((tt&536870912)===0||st){var t=Nr;Nr<<=1,(Nr&3932160)===0&&(Nr=262144),Un=t}else Un=536870912;return t=Dn.current,t!==null&&(t.flags|=32),Un}function kn(t,i,a){(t===At&&(yt===2||yt===9)||t.cancelPendingCommit!==null)&&($s(t,0),Ei(t,tt,Un,!1)),or(t,a),((dt&2)===0||t!==At)&&(t===At&&((dt&2)===0&&(os|=a),It===4&&Ei(t,tt,Un,!1)),wr(t))}function Bg(t,i,a){if((dt&6)!==0)throw Error(s(327));var o=!a&&(i&127)===0&&(i&t.expiredLanes)===0||Fi(t,i),h=o?tw(t,i):Df(t,i,!0),p=o;do{if(h===0){Hs&&!o&&Ei(t,i,0,!1);break}else{if(a=t.current.alternate,p&&!Wv(a)){h=Df(t,i,!1),p=!1;continue}if(h===2){if(p=i,t.errorRecoveryDisabledLanes&p)var v=0;else v=t.pendingLanes&-536870913,v=v!==0?v:v&536870912?536870912:0;if(v!==0){i=v;e:{var E=t;h=nl;var I=E.current.memoizedState.isDehydrated;if(I&&($s(E,v).flags|=256),v=Df(E,v,!1),v!==2){if(Af&&!I){E.errorRecoveryDisabledLanes|=p,os|=p,h=4;break e}p=En,En=h,p!==null&&(En===null?En=p:En.push.apply(En,p))}h=v}if(p=!1,h!==2)continue}}if(h===1){$s(t,0),Ei(t,i,0,!0);break}e:{switch(o=t,p=h,p){case 0:case 1:throw Error(s(345));case 4:if((i&4194048)!==i)break;case 6:Ei(o,i,Un,!vi);break e;case 2:En=null;break;case 3:case 5:break;default:throw Error(s(329))}if((i&62914560)===i&&(h=Bo+300-xt(),10<h)){if(Ei(o,i,Un,!vi),Ii(o,0,!0)!==0)break e;Jr=i,o.timeoutHandle=py(Pg.bind(null,o,a,En,qo,jf,i,Un,os,Is,vi,p,"Throttled",-0,0),h);break e}Pg(o,a,En,qo,jf,i,Un,os,Is,vi,p,null,-0,0)}}break}while(!0);wr(t)}function Pg(t,i,a,o,h,p,v,E,I,ie,ce,pe,se,oe){if(t.timeoutHandle=-1,pe=i.subtreeFlags,pe&8192||(pe&16785408)===16785408){pe={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Mr},Og(i,p,pe);var Re=(p&62914560)===p?Bo-xt():(p&4194048)===p?Lg-xt():0;if(Re=Uw(pe,Re),Re!==null){Jr=p,t.cancelPendingCommit=Re(Vg.bind(null,t,i,p,a,o,h,v,E,I,ce,pe,null,se,oe)),Ei(t,p,v,!ie);return}}Vg(t,i,p,a,o,h,v,E,I)}function Wv(t){for(var i=t;;){var a=i.tag;if((a===0||a===11||a===15)&&i.flags&16384&&(a=i.updateQueue,a!==null&&(a=a.stores,a!==null)))for(var o=0;o<a.length;o++){var h=a[o],p=h.getSnapshot;h=h.value;try{if(!Rn(p(),h))return!1}catch{return!1}}if(a=i.child,i.subtreeFlags&16384&&a!==null)a.return=i,i=a;else{if(i===t)break;for(;i.sibling===null;){if(i.return===null||i.return===t)return!0;i=i.return}i.sibling.return=i.return,i=i.sibling}}return!0}function Ei(t,i,a,o){i&=~Tf,i&=~os,t.suspendedLanes|=i,t.pingedLanes&=~i,o&&(t.warmLanes|=i),o=t.expirationTimes;for(var h=i;0<h;){var p=31-Se(h),v=1<<p;o[p]=-1,h&=~v}a!==0&&li(t,a,i)}function Ho(){return(dt&6)===0?(il(0),!1):!0}function Mf(){if(Qe!==null){if(yt===0)var t=Qe.return;else t=Qe,Ur=Wi=null,Jc(t),Ds=null,qa=0,t=Qe;for(;t!==null;)gg(t.alternate,t),t=t.return;Qe=null}}function $s(t,i){var a=t.timeoutHandle;a!==-1&&(t.timeoutHandle=-1,xw(a)),a=t.cancelPendingCommit,a!==null&&(t.cancelPendingCommit=null,a()),Jr=0,Mf(),At=t,Qe=a=Lr(t.current,null),tt=i,yt=0,zn=null,vi=!1,Hs=Fi(t,i),Af=!1,Is=Un=Tf=os=wi=It=0,En=nl=null,jf=!1,(i&8)!==0&&(i|=i&32);var o=t.entangledLanes;if(o!==0)for(t=t.entanglements,o&=i;0<o;){var h=31-Se(o),p=1<<h;i|=t[h],o&=~p}return Vr=i,lo(),a}function qg(t,i){Ye=null,P.H=Ja,i===Ms||i===go?(i=np(),yt=3):i===zc?(i=np(),yt=4):yt=i===ff?8:i!==null&&typeof i=="object"&&typeof i.then=="function"?6:1,zn=i,Qe===null&&(It=1,No(t,Kn(i,t.current)))}function Hg(){var t=Dn.current;return t===null?!0:(tt&4194048)===tt?er===null:(tt&62914560)===tt||(tt&536870912)!==0?t===er:!1}function Ig(){var t=P.H;return P.H=Ja,t===null?Ja:t}function Fg(){var t=P.A;return P.A=Qv,t}function Io(){It=4,vi||(tt&4194048)!==tt&&Dn.current!==null||(Hs=!0),(wi&134217727)===0&&(os&134217727)===0||At===null||Ei(At,tt,Un,!1)}function Df(t,i,a){var o=dt;dt|=2;var h=Ig(),p=Fg();(At!==t||tt!==i)&&(qo=null,$s(t,i)),i=!1;var v=It;e:do try{if(yt!==0&&Qe!==null){var E=Qe,I=zn;switch(yt){case 8:Mf(),v=6;break e;case 3:case 2:case 9:case 6:Dn.current===null&&(i=!0);var ie=yt;if(yt=0,zn=null,Ys(t,E,I,ie),a&&Hs){v=0;break e}break;default:ie=yt,yt=0,zn=null,Ys(t,E,I,ie)}}ew(),v=It;break}catch(ce){qg(t,ce)}while(!0);return i&&t.shellSuspendCounter++,Ur=Wi=null,dt=o,P.H=h,P.A=p,Qe===null&&(At=null,tt=0,lo()),v}function ew(){for(;Qe!==null;)$g(Qe)}function tw(t,i){var a=dt;dt|=2;var o=Ig(),h=Fg();At!==t||tt!==i?(qo=null,Po=xt()+500,$s(t,i)):Hs=Fi(t,i);e:do try{if(yt!==0&&Qe!==null){i=Qe;var p=zn;t:switch(yt){case 1:yt=0,zn=null,Ys(t,i,p,1);break;case 2:case 9:if(ep(p)){yt=0,zn=null,Yg(i);break}i=function(){yt!==2&&yt!==9||At!==t||(yt=7),wr(t)},p.then(i,i);break e;case 3:yt=7;break e;case 4:yt=5;break e;case 7:ep(p)?(yt=0,zn=null,Yg(i)):(yt=0,zn=null,Ys(t,i,p,7));break;case 5:var v=null;switch(Qe.tag){case 26:v=Qe.memoizedState;case 5:case 27:var E=Qe;if(v?Ny(v):E.stateNode.complete){yt=0,zn=null;var I=E.sibling;if(I!==null)Qe=I;else{var ie=E.return;ie!==null?(Qe=ie,Fo(ie)):Qe=null}break t}}yt=0,zn=null,Ys(t,i,p,5);break;case 6:yt=0,zn=null,Ys(t,i,p,6);break;case 8:Mf(),It=6;break e;default:throw Error(s(462))}}nw();break}catch(ce){qg(t,ce)}while(!0);return Ur=Wi=null,P.H=o,P.A=h,dt=a,Qe!==null?0:(At=null,tt=0,lo(),It)}function nw(){for(;Qe!==null&&!Nt();)$g(Qe)}function $g(t){var i=mg(t.alternate,t,Vr);t.memoizedProps=t.pendingProps,i===null?Fo(t):Qe=i}function Yg(t){var i=t,a=i.alternate;switch(i.tag){case 15:case 0:i=og(a,i,i.pendingProps,i.type,void 0,tt);break;case 11:i=og(a,i,i.pendingProps,i.type.render,i.ref,tt);break;case 5:Jc(i);default:gg(a,i),i=Qe=Fm(i,Vr),i=mg(a,i,Vr)}t.memoizedProps=t.pendingProps,i===null?Fo(t):Qe=i}function Ys(t,i,a,o){Ur=Wi=null,Jc(i),Ds=null,qa=0;var h=i.return;try{if($v(t,h,i,a,tt)){It=1,No(t,Kn(a,t.current)),Qe=null;return}}catch(p){if(h!==null)throw Qe=h,p;It=1,No(t,Kn(a,t.current)),Qe=null;return}i.flags&32768?(st||o===1?t=!0:Hs||(tt&536870912)!==0?t=!1:(vi=t=!0,(o===2||o===9||o===3||o===6)&&(o=Dn.current,o!==null&&o.tag===13&&(o.flags|=16384))),Gg(i,t)):Fo(i)}function Fo(t){var i=t;do{if((i.flags&32768)!==0){Gg(i,vi);return}t=i.return;var a=Vv(i.alternate,i,Vr);if(a!==null){Qe=a;return}if(i=i.sibling,i!==null){Qe=i;return}Qe=i=t}while(i!==null);It===0&&(It=5)}function Gg(t,i){do{var a=Jv(t.alternate,t);if(a!==null){a.flags&=32767,Qe=a;return}if(a=t.return,a!==null&&(a.flags|=32768,a.subtreeFlags=0,a.deletions=null),!i&&(t=t.sibling,t!==null)){Qe=t;return}Qe=t=a}while(t!==null);It=6,Qe=null}function Vg(t,i,a,o,h,p,v,E,I){t.cancelPendingCommit=null;do $o();while(Wt!==0);if((dt&6)!==0)throw Error(s(327));if(i!==null){if(i===t.current)throw Error(s(177));if(p=i.lanes|i.childLanes,p|=wc,ai(t,a,p,v,E,I),t===At&&(Qe=At=null,tt=0),Fs=i,_i=t,Jr=a,Nf=p,Of=h,zg=o,(i.subtreeFlags&10256)!==0||(i.flags&10256)!==0?(t.callbackNode=null,t.callbackPriority=0,aw(Ue,function(){return Zg(),null})):(t.callbackNode=null,t.callbackPriority=0),o=(i.flags&13878)!==0,(i.subtreeFlags&13878)!==0||o){o=P.T,P.T=null,h=V.p,V.p=2,v=dt,dt|=4;try{Xv(t,i,a)}finally{dt=v,V.p=h,P.T=o}}Wt=1,Jg(),Xg(),Kg()}}function Jg(){if(Wt===1){Wt=0;var t=_i,i=Fs,a=(i.flags&13878)!==0;if((i.subtreeFlags&13878)!==0||a){a=P.T,P.T=null;var o=V.p;V.p=2;var h=dt;dt|=4;try{Tg(i,t);var p=Gf,v=Dm(t.containerInfo),E=p.focusedElem,I=p.selectionRange;if(v!==E&&E&&E.ownerDocument&&Mm(E.ownerDocument.documentElement,E)){if(I!==null&&gc(E)){var ie=I.start,ce=I.end;if(ce===void 0&&(ce=ie),"selectionStart"in E)E.selectionStart=ie,E.selectionEnd=Math.min(ce,E.value.length);else{var pe=E.ownerDocument||document,se=pe&&pe.defaultView||window;if(se.getSelection){var oe=se.getSelection(),Re=E.textContent.length,Pe=Math.min(I.start,Re),St=I.end===void 0?Pe:Math.min(I.end,Re);!oe.extend&&Pe>St&&(v=St,St=Pe,Pe=v);var Z=Rm(E,Pe),G=Rm(E,St);if(Z&&G&&(oe.rangeCount!==1||oe.anchorNode!==Z.node||oe.anchorOffset!==Z.offset||oe.focusNode!==G.node||oe.focusOffset!==G.offset)){var ne=pe.createRange();ne.setStart(Z.node,Z.offset),oe.removeAllRanges(),Pe>St?(oe.addRange(ne),oe.extend(G.node,G.offset)):(ne.setEnd(G.node,G.offset),oe.addRange(ne))}}}}for(pe=[],oe=E;oe=oe.parentNode;)oe.nodeType===1&&pe.push({element:oe,left:oe.scrollLeft,top:oe.scrollTop});for(typeof E.focus=="function"&&E.focus(),E=0;E<pe.length;E++){var he=pe[E];he.element.scrollLeft=he.left,he.element.scrollTop=he.top}}nu=!!Yf,Gf=Yf=null}finally{dt=h,V.p=o,P.T=a}}t.current=i,Wt=2}}function Xg(){if(Wt===2){Wt=0;var t=_i,i=Fs,a=(i.flags&8772)!==0;if((i.subtreeFlags&8772)!==0||a){a=P.T,P.T=null;var o=V.p;V.p=2;var h=dt;dt|=4;try{_g(t,i.alternate,i)}finally{dt=h,V.p=o,P.T=a}}Wt=3}}function Kg(){if(Wt===4||Wt===3){Wt=0,Tn();var t=_i,i=Fs,a=Jr,o=zg;(i.subtreeFlags&10256)!==0||(i.flags&10256)!==0?Wt=5:(Wt=0,Fs=_i=null,Qg(t,t.pendingLanes));var h=t.pendingLanes;if(h===0&&(Si=null),Yi(a),i=i.stateNode,ge&&typeof ge.onCommitFiberRoot=="function")try{ge.onCommitFiberRoot(Gt,i,void 0,(i.current.flags&128)===128)}catch{}if(o!==null){i=P.T,h=V.p,V.p=2,P.T=null;try{for(var p=t.onRecoverableError,v=0;v<o.length;v++){var E=o[v];p(E.value,{componentStack:E.stack})}}finally{P.T=i,V.p=h}}(Jr&3)!==0&&$o(),wr(t),h=t.pendingLanes,(a&261930)!==0&&(h&42)!==0?t===Rf?rl++:(rl=0,Rf=t):rl=0,il(0)}}function Qg(t,i){(t.pooledCacheLanes&=i)===0&&(i=t.pooledCache,i!=null&&(t.pooledCache=null,Ba(i)))}function $o(){return Jg(),Xg(),Kg(),Zg()}function Zg(){if(Wt!==5)return!1;var t=_i,i=Nf;Nf=0;var a=Yi(Jr),o=P.T,h=V.p;try{V.p=32>a?32:a,P.T=null,a=Of,Of=null;var p=_i,v=Jr;if(Wt=0,Fs=_i=null,Jr=0,(dt&6)!==0)throw Error(s(331));var E=dt;if(dt|=4,Mg(p.current),Ng(p,p.current,v,a),dt=E,il(0,!1),ge&&typeof ge.onPostCommitFiberRoot=="function")try{ge.onPostCommitFiberRoot(Gt,p)}catch{}return!0}finally{V.p=h,P.T=o,Qg(t,i)}}function Wg(t,i,a){i=Kn(a,i),i=cf(t.stateNode,i,2),t=gi(t,i,2),t!==null&&(or(t,2),wr(t))}function bt(t,i,a){if(t.tag===3)Wg(t,t,a);else for(;i!==null;){if(i.tag===3){Wg(i,t,a);break}else if(i.tag===1){var o=i.stateNode;if(typeof i.type.getDerivedStateFromError=="function"||typeof o.componentDidCatch=="function"&&(Si===null||!Si.has(o))){t=Kn(a,t),a=eg(2),o=gi(i,a,2),o!==null&&(tg(a,o,i,t),or(o,2),wr(o));break}}i=i.return}}function Lf(t,i,a){var o=t.pingCache;if(o===null){o=t.pingCache=new Zv;var h=new Set;o.set(i,h)}else h=o.get(i),h===void 0&&(h=new Set,o.set(i,h));h.has(a)||(Af=!0,h.add(a),t=rw.bind(null,t,i,a),i.then(t,t))}function rw(t,i,a){var o=t.pingCache;o!==null&&o.delete(i),t.pingedLanes|=t.suspendedLanes&a,t.warmLanes&=~a,At===t&&(tt&a)===a&&(It===4||It===3&&(tt&62914560)===tt&&300>xt()-Bo?(dt&2)===0&&$s(t,0):Tf|=a,Is===tt&&(Is=0)),wr(t)}function ey(t,i){i===0&&(i=gs()),t=Ki(t,i),t!==null&&(or(t,i),wr(t))}function iw(t){var i=t.memoizedState,a=0;i!==null&&(a=i.retryLane),ey(t,a)}function sw(t,i){var a=0;switch(t.tag){case 31:case 13:var o=t.stateNode,h=t.memoizedState;h!==null&&(a=h.retryLane);break;case 19:o=t.stateNode;break;case 22:o=t.stateNode._retryCache;break;default:throw Error(s(314))}o!==null&&o.delete(i),ey(t,a)}function aw(t,i){return it(t,i)}var Yo=null,Gs=null,zf=!1,Go=!1,Uf=!1,ki=0;function wr(t){t!==Gs&&t.next===null&&(Gs===null?Yo=Gs=t:Gs=Gs.next=t),Go=!0,zf||(zf=!0,ow())}function il(t,i){if(!Uf&&Go){Uf=!0;do for(var a=!1,o=Yo;o!==null;){if(t!==0){var h=o.pendingLanes;if(h===0)var p=0;else{var v=o.suspendedLanes,E=o.pingedLanes;p=(1<<31-Se(42|t)+1)-1,p&=h&~(v&~E),p=p&201326741?p&201326741|1:p?p|2:0}p!==0&&(a=!0,iy(o,p))}else p=tt,p=Ii(o,o===At?p:0,o.cancelPendingCommit!==null||o.timeoutHandle!==-1),(p&3)===0||Fi(o,p)||(a=!0,iy(o,p));o=o.next}while(a);Uf=!1}}function lw(){ty()}function ty(){Go=zf=!1;var t=0;ki!==0&&bw()&&(t=ki);for(var i=xt(),a=null,o=Yo;o!==null;){var h=o.next,p=ny(o,i);p===0?(o.next=null,a===null?Yo=h:a.next=h,h===null&&(Gs=a)):(a=o,(t!==0||(p&3)!==0)&&(Go=!0)),o=h}Wt!==0&&Wt!==5||il(t),ki!==0&&(ki=0)}function ny(t,i){for(var a=t.suspendedLanes,o=t.pingedLanes,h=t.expirationTimes,p=t.pendingLanes&-62914561;0<p;){var v=31-Se(p),E=1<<v,I=h[v];I===-1?((E&a)===0||(E&o)!==0)&&(h[v]=Ea(E,i)):I<=i&&(t.expiredLanes|=E),p&=~E}if(i=At,a=tt,a=Ii(t,t===i?a:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),o=t.callbackNode,a===0||t===i&&(yt===2||yt===9)||t.cancelPendingCommit!==null)return o!==null&&o!==null&&Pt(o),t.callbackNode=null,t.callbackPriority=0;if((a&3)===0||Fi(t,a)){if(i=a&-a,i===t.callbackPriority)return i;switch(o!==null&&Pt(o),Yi(a)){case 2:case 8:a=we;break;case 32:a=Ue;break;case 268435456:a=at;break;default:a=Ue}return o=ry.bind(null,t),a=it(a,o),t.callbackPriority=i,t.callbackNode=a,i}return o!==null&&o!==null&&Pt(o),t.callbackPriority=2,t.callbackNode=null,2}function ry(t,i){if(Wt!==0&&Wt!==5)return t.callbackNode=null,t.callbackPriority=0,null;var a=t.callbackNode;if($o()&&t.callbackNode!==a)return null;var o=tt;return o=Ii(t,t===At?o:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),o===0?null:(Bg(t,o,i),ny(t,xt()),t.callbackNode!=null&&t.callbackNode===a?ry.bind(null,t):null)}function iy(t,i){if($o())return null;Bg(t,i,!0)}function ow(){vw(function(){(dt&6)!==0?it(fe,lw):ty()})}function Bf(){if(ki===0){var t=Os;t===0&&(t=ri,ri<<=1,(ri&261888)===0&&(ri=256)),ki=t}return ki}function sy(t){return t==null||typeof t=="symbol"||typeof t=="boolean"?null:typeof t=="function"?t:Wl(""+t)}function ay(t,i){var a=i.ownerDocument.createElement("input");return a.name=i.name,a.value=i.value,t.id&&a.setAttribute("form",t.id),i.parentNode.insertBefore(a,i),t=new FormData(t),a.parentNode.removeChild(a),t}function uw(t,i,a,o,h){if(i==="submit"&&a&&a.stateNode===h){var p=sy((h[qt]||null).action),v=o.submitter;v&&(i=(i=v[qt]||null)?sy(i.formAction):v.getAttribute("formAction"),i!==null&&(p=i,v=null));var E=new ro("action","action",null,o,h);t.push({event:E,listeners:[{instance:null,listener:function(){if(o.defaultPrevented){if(ki!==0){var I=v?ay(h,v):new FormData(h);rf(a,{pending:!0,data:I,method:h.method,action:p},null,I)}}else typeof p=="function"&&(E.preventDefault(),I=v?ay(h,v):new FormData(h),rf(a,{pending:!0,data:I,method:h.method,action:p},p,I))},currentTarget:h}]})}}for(var Pf=0;Pf<vc.length;Pf++){var qf=vc[Pf],cw=qf.toLowerCase(),fw=qf[0].toUpperCase()+qf.slice(1);cr(cw,"on"+fw)}cr(Um,"onAnimationEnd"),cr(Bm,"onAnimationIteration"),cr(Pm,"onAnimationStart"),cr("dblclick","onDoubleClick"),cr("focusin","onFocus"),cr("focusout","onBlur"),cr(Av,"onTransitionRun"),cr(Tv,"onTransitionStart"),cr(jv,"onTransitionCancel"),cr(qm,"onTransitionEnd"),le("onMouseEnter",["mouseout","mouseover"]),le("onMouseLeave",["mouseout","mouseover"]),le("onPointerEnter",["pointerout","pointerover"]),le("onPointerLeave",["pointerout","pointerover"]),ye("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),ye("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),ye("onBeforeInput",["compositionend","keypress","textInput","paste"]),ye("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),ye("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),ye("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var sl="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(" "),hw=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(sl));function ly(t,i){i=(i&4)!==0;for(var a=0;a<t.length;a++){var o=t[a],h=o.event;o=o.listeners;e:{var p=void 0;if(i)for(var v=o.length-1;0<=v;v--){var E=o[v],I=E.instance,ie=E.currentTarget;if(E=E.listener,I!==p&&h.isPropagationStopped())break e;p=E,h.currentTarget=ie;try{p(h)}catch(ce){ao(ce)}h.currentTarget=null,p=I}else for(v=0;v<o.length;v++){if(E=o[v],I=E.instance,ie=E.currentTarget,E=E.listener,I!==p&&h.isPropagationStopped())break e;p=E,h.currentTarget=ie;try{p(h)}catch(ce){ao(ce)}h.currentTarget=null,p=I}}}}function Ze(t,i){var a=i[Gi];a===void 0&&(a=i[Gi]=new Set);var o=t+"__bubble";a.has(o)||(oy(i,t,2,!1),a.add(o))}function Hf(t,i,a){var o=0;i&&(o|=4),oy(a,t,o,i)}var Vo="_reactListening"+Math.random().toString(36).slice(2);function If(t){if(!t[Vo]){t[Vo]=!0,ee.forEach(function(a){a!=="selectionchange"&&(hw.has(a)||Hf(a,!1,t),Hf(a,!0,t))});var i=t.nodeType===9?t:t.ownerDocument;i===null||i[Vo]||(i[Vo]=!0,Hf("selectionchange",!1,i))}}function oy(t,i,a,o){switch(Uy(i)){case 2:var h=qw;break;case 8:h=Hw;break;default:h=rh}a=h.bind(null,i,a,t),h=void 0,!lc||i!=="touchstart"&&i!=="touchmove"&&i!=="wheel"||(h=!0),o?h!==void 0?t.addEventListener(i,a,{capture:!0,passive:h}):t.addEventListener(i,a,!0):h!==void 0?t.addEventListener(i,a,{passive:h}):t.addEventListener(i,a,!1)}function Ff(t,i,a,o,h){var p=o;if((i&1)===0&&(i&2)===0&&o!==null)e:for(;;){if(o===null)return;var v=o.tag;if(v===3||v===4){var E=o.stateNode.containerInfo;if(E===h)break;if(v===4)for(v=o.return;v!==null;){var I=v.tag;if((I===3||I===4)&&v.stateNode.containerInfo===h)return;v=v.return}for(;E!==null;){if(v=k(E),v===null)return;if(I=v.tag,I===5||I===6||I===26||I===27){o=p=v;continue e}E=E.parentNode}}o=o.return}dm(function(){var ie=p,ce=sc(a),pe=[];e:{var se=Hm.get(t);if(se!==void 0){var oe=ro,Re=t;switch(t){case"keypress":if(to(a)===0)break e;case"keydown":case"keyup":oe=sv;break;case"focusin":Re="focus",oe=fc;break;case"focusout":Re="blur",oe=fc;break;case"beforeblur":case"afterblur":oe=fc;break;case"click":if(a.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":oe=gm;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":oe=V1;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":oe=ov;break;case Um:case Bm:case Pm:oe=K1;break;case qm:oe=cv;break;case"scroll":case"scrollend":oe=Y1;break;case"wheel":oe=hv;break;case"copy":case"cut":case"paste":oe=Z1;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":oe=bm;break;case"toggle":case"beforetoggle":oe=mv}var Pe=(i&4)!==0,St=!Pe&&(t==="scroll"||t==="scrollend"),Z=Pe?se!==null?se+"Capture":null:se;Pe=[];for(var G=ie,ne;G!==null;){var he=G;if(ne=he.stateNode,he=he.tag,he!==5&&he!==26&&he!==27||ne===null||Z===null||(he=Aa(G,Z),he!=null&&Pe.push(al(G,he,ne))),St)break;G=G.return}0<Pe.length&&(se=new oe(se,Re,null,a,ce),pe.push({event:se,listeners:Pe}))}}if((i&7)===0){e:{if(se=t==="mouseover"||t==="pointerover",oe=t==="mouseout"||t==="pointerout",se&&a!==ic&&(Re=a.relatedTarget||a.fromElement)&&(k(Re)||Re[On]))break e;if((oe||se)&&(se=ce.window===ce?ce:(se=ce.ownerDocument)?se.defaultView||se.parentWindow:window,oe?(Re=a.relatedTarget||a.toElement,oe=ie,Re=Re?k(Re):null,Re!==null&&(St=u(Re),Pe=Re.tag,Re!==St||Pe!==5&&Pe!==27&&Pe!==6)&&(Re=null)):(oe=null,Re=ie),oe!==Re)){if(Pe=gm,he="onMouseLeave",Z="onMouseEnter",G="mouse",(t==="pointerout"||t==="pointerover")&&(Pe=bm,he="onPointerLeave",Z="onPointerEnter",G="pointer"),St=oe==null?se:j(oe),ne=Re==null?se:j(Re),se=new Pe(he,G+"leave",oe,a,ce),se.target=St,se.relatedTarget=ne,he=null,k(ce)===ie&&(Pe=new Pe(Z,G+"enter",Re,a,ce),Pe.target=ne,Pe.relatedTarget=St,he=Pe),St=he,oe&&Re)t:{for(Pe=dw,Z=oe,G=Re,ne=0,he=Z;he;he=Pe(he))ne++;he=0;for(var De=G;De;De=Pe(De))he++;for(;0<ne-he;)Z=Pe(Z),ne--;for(;0<he-ne;)G=Pe(G),he--;for(;ne--;){if(Z===G||G!==null&&Z===G.alternate){Pe=Z;break t}Z=Pe(Z),G=Pe(G)}Pe=null}else Pe=null;oe!==null&&uy(pe,se,oe,Pe,!1),Re!==null&&St!==null&&uy(pe,St,Re,Pe,!0)}}e:{if(se=ie?j(ie):window,oe=se.nodeName&&se.nodeName.toLowerCase(),oe==="select"||oe==="input"&&se.type==="file")var ct=Cm;else if(Em(se))if(Am)ct=Ev;else{ct=Sv;var Me=wv}else oe=se.nodeName,!oe||oe.toLowerCase()!=="input"||se.type!=="checkbox"&&se.type!=="radio"?ie&&rc(ie.elementType)&&(ct=Cm):ct=_v;if(ct&&(ct=ct(t,ie))){km(pe,ct,a,ce);break e}Me&&Me(t,se,ie),t==="focusout"&&ie&&se.type==="number"&&ie.memoizedProps.value!=null&&nc(se,"number",se.value)}switch(Me=ie?j(ie):window,t){case"focusin":(Em(Me)||Me.contentEditable==="true")&&(_s=Me,yc=ie,La=null);break;case"focusout":La=yc=_s=null;break;case"mousedown":bc=!0;break;case"contextmenu":case"mouseup":case"dragend":bc=!1,Lm(pe,a,ce);break;case"selectionchange":if(Cv)break;case"keydown":case"keyup":Lm(pe,a,ce)}var Ge;if(dc)e:{switch(t){case"compositionstart":var nt="onCompositionStart";break e;case"compositionend":nt="onCompositionEnd";break e;case"compositionupdate":nt="onCompositionUpdate";break e}nt=void 0}else Ss?Sm(t,a)&&(nt="onCompositionEnd"):t==="keydown"&&a.keyCode===229&&(nt="onCompositionStart");nt&&(xm&&a.locale!=="ko"&&(Ss||nt!=="onCompositionStart"?nt==="onCompositionEnd"&&Ss&&(Ge=mm()):(ui=ce,oc="value"in ui?ui.value:ui.textContent,Ss=!0)),Me=Jo(ie,nt),0<Me.length&&(nt=new ym(nt,t,null,a,ce),pe.push({event:nt,listeners:Me}),Ge?nt.data=Ge:(Ge=_m(a),Ge!==null&&(nt.data=Ge)))),(Ge=gv?yv(t,a):bv(t,a))&&(nt=Jo(ie,"onBeforeInput"),0<nt.length&&(Me=new ym("onBeforeInput","beforeinput",null,a,ce),pe.push({event:Me,listeners:nt}),Me.data=Ge)),uw(pe,t,ie,a,ce)}ly(pe,i)})}function al(t,i,a){return{instance:t,listener:i,currentTarget:a}}function Jo(t,i){for(var a=i+"Capture",o=[];t!==null;){var h=t,p=h.stateNode;if(h=h.tag,h!==5&&h!==26&&h!==27||p===null||(h=Aa(t,a),h!=null&&o.unshift(al(t,h,p)),h=Aa(t,i),h!=null&&o.push(al(t,h,p))),t.tag===3)return o;t=t.return}return[]}function dw(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5&&t.tag!==27);return t||null}function uy(t,i,a,o,h){for(var p=i._reactName,v=[];a!==null&&a!==o;){var E=a,I=E.alternate,ie=E.stateNode;if(E=E.tag,I!==null&&I===o)break;E!==5&&E!==26&&E!==27||ie===null||(I=ie,h?(ie=Aa(a,p),ie!=null&&v.unshift(al(a,ie,I))):h||(ie=Aa(a,p),ie!=null&&v.push(al(a,ie,I)))),a=a.return}v.length!==0&&t.push({event:i,listeners:v})}var mw=/\r\n?/g,pw=/\u0000|\uFFFD/g;function cy(t){return(typeof t=="string"?t:""+t).replace(mw,`
49
+ `).replace(pw,"")}function fy(t,i){return i=cy(i),cy(t)===i}function wt(t,i,a,o,h,p){switch(a){case"children":typeof o=="string"?i==="body"||i==="textarea"&&o===""||xs(t,o):(typeof o=="number"||typeof o=="bigint")&&i!=="body"&&xs(t,""+o);break;case"className":ur(t,"class",o);break;case"tabIndex":ur(t,"tabindex",o);break;case"dir":case"role":case"viewBox":case"width":case"height":ur(t,a,o);break;case"style":fm(t,o,p);break;case"data":if(i!=="object"){ur(t,"data",o);break}case"src":case"href":if(o===""&&(i!=="a"||a!=="href")){t.removeAttribute(a);break}if(o==null||typeof o=="function"||typeof o=="symbol"||typeof o=="boolean"){t.removeAttribute(a);break}o=Wl(""+o),t.setAttribute(a,o);break;case"action":case"formAction":if(typeof o=="function"){t.setAttribute(a,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof p=="function"&&(a==="formAction"?(i!=="input"&&wt(t,i,"name",h.name,h,null),wt(t,i,"formEncType",h.formEncType,h,null),wt(t,i,"formMethod",h.formMethod,h,null),wt(t,i,"formTarget",h.formTarget,h,null)):(wt(t,i,"encType",h.encType,h,null),wt(t,i,"method",h.method,h,null),wt(t,i,"target",h.target,h,null)));if(o==null||typeof o=="symbol"||typeof o=="boolean"){t.removeAttribute(a);break}o=Wl(""+o),t.setAttribute(a,o);break;case"onClick":o!=null&&(t.onclick=Mr);break;case"onScroll":o!=null&&Ze("scroll",t);break;case"onScrollEnd":o!=null&&Ze("scrollend",t);break;case"dangerouslySetInnerHTML":if(o!=null){if(typeof o!="object"||!("__html"in o))throw Error(s(61));if(a=o.__html,a!=null){if(h.children!=null)throw Error(s(60));t.innerHTML=a}}break;case"multiple":t.multiple=o&&typeof o!="function"&&typeof o!="symbol";break;case"muted":t.muted=o&&typeof o!="function"&&typeof o!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(o==null||typeof o=="function"||typeof o=="boolean"||typeof o=="symbol"){t.removeAttribute("xlink:href");break}a=Wl(""+o),t.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",a);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":o!=null&&typeof o!="function"&&typeof o!="symbol"?t.setAttribute(a,""+o):t.removeAttribute(a);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":o&&typeof o!="function"&&typeof o!="symbol"?t.setAttribute(a,""):t.removeAttribute(a);break;case"capture":case"download":o===!0?t.setAttribute(a,""):o!==!1&&o!=null&&typeof o!="function"&&typeof o!="symbol"?t.setAttribute(a,o):t.removeAttribute(a);break;case"cols":case"rows":case"size":case"span":o!=null&&typeof o!="function"&&typeof o!="symbol"&&!isNaN(o)&&1<=o?t.setAttribute(a,o):t.removeAttribute(a);break;case"rowSpan":case"start":o==null||typeof o=="function"||typeof o=="symbol"||isNaN(o)?t.removeAttribute(a):t.setAttribute(a,o);break;case"popover":Ze("beforetoggle",t),Ze("toggle",t),un(t,"popover",o);break;case"xlinkActuate":Rr(t,"http://www.w3.org/1999/xlink","xlink:actuate",o);break;case"xlinkArcrole":Rr(t,"http://www.w3.org/1999/xlink","xlink:arcrole",o);break;case"xlinkRole":Rr(t,"http://www.w3.org/1999/xlink","xlink:role",o);break;case"xlinkShow":Rr(t,"http://www.w3.org/1999/xlink","xlink:show",o);break;case"xlinkTitle":Rr(t,"http://www.w3.org/1999/xlink","xlink:title",o);break;case"xlinkType":Rr(t,"http://www.w3.org/1999/xlink","xlink:type",o);break;case"xmlBase":Rr(t,"http://www.w3.org/XML/1998/namespace","xml:base",o);break;case"xmlLang":Rr(t,"http://www.w3.org/XML/1998/namespace","xml:lang",o);break;case"xmlSpace":Rr(t,"http://www.w3.org/XML/1998/namespace","xml:space",o);break;case"is":un(t,"is",o);break;case"innerText":case"textContent":break;default:(!(2<a.length)||a[0]!=="o"&&a[0]!=="O"||a[1]!=="n"&&a[1]!=="N")&&(a=F1.get(a)||a,un(t,a,o))}}function $f(t,i,a,o,h,p){switch(a){case"style":fm(t,o,p);break;case"dangerouslySetInnerHTML":if(o!=null){if(typeof o!="object"||!("__html"in o))throw Error(s(61));if(a=o.__html,a!=null){if(h.children!=null)throw Error(s(60));t.innerHTML=a}}break;case"children":typeof o=="string"?xs(t,o):(typeof o=="number"||typeof o=="bigint")&&xs(t,""+o);break;case"onScroll":o!=null&&Ze("scroll",t);break;case"onScrollEnd":o!=null&&Ze("scrollend",t);break;case"onClick":o!=null&&(t.onclick=Mr);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!me.hasOwnProperty(a))e:{if(a[0]==="o"&&a[1]==="n"&&(h=a.endsWith("Capture"),i=a.slice(2,h?a.length-7:void 0),p=t[qt]||null,p=p!=null?p[a]:null,typeof p=="function"&&t.removeEventListener(i,p,h),typeof o=="function")){typeof p!="function"&&p!==null&&(a in t?t[a]=null:t.hasAttribute(a)&&t.removeAttribute(a)),t.addEventListener(i,o,h);break e}a in t?t[a]=o:o===!0?t.setAttribute(a,""):un(t,a,o)}}}function on(t,i,a){switch(i){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Ze("error",t),Ze("load",t);var o=!1,h=!1,p;for(p in a)if(a.hasOwnProperty(p)){var v=a[p];if(v!=null)switch(p){case"src":o=!0;break;case"srcSet":h=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(s(137,i));default:wt(t,i,p,v,a,null)}}h&&wt(t,i,"srcSet",a.srcSet,a,null),o&&wt(t,i,"src",a.src,a,null);return;case"input":Ze("invalid",t);var E=p=v=h=null,I=null,ie=null;for(o in a)if(a.hasOwnProperty(o)){var ce=a[o];if(ce!=null)switch(o){case"name":h=ce;break;case"type":v=ce;break;case"checked":I=ce;break;case"defaultChecked":ie=ce;break;case"value":p=ce;break;case"defaultValue":E=ce;break;case"children":case"dangerouslySetInnerHTML":if(ce!=null)throw Error(s(137,i));break;default:wt(t,i,o,ce,a,null)}}lm(t,p,E,I,ie,v,h,!1);return;case"select":Ze("invalid",t),o=v=p=null;for(h in a)if(a.hasOwnProperty(h)&&(E=a[h],E!=null))switch(h){case"value":p=E;break;case"defaultValue":v=E;break;case"multiple":o=E;default:wt(t,i,h,E,a,null)}i=p,a=v,t.multiple=!!o,i!=null?bs(t,!!o,i,!1):a!=null&&bs(t,!!o,a,!0);return;case"textarea":Ze("invalid",t),p=h=o=null;for(v in a)if(a.hasOwnProperty(v)&&(E=a[v],E!=null))switch(v){case"value":o=E;break;case"defaultValue":h=E;break;case"children":p=E;break;case"dangerouslySetInnerHTML":if(E!=null)throw Error(s(91));break;default:wt(t,i,v,E,a,null)}um(t,o,h,p);return;case"option":for(I in a)if(a.hasOwnProperty(I)&&(o=a[I],o!=null))switch(I){case"selected":t.selected=o&&typeof o!="function"&&typeof o!="symbol";break;default:wt(t,i,I,o,a,null)}return;case"dialog":Ze("beforetoggle",t),Ze("toggle",t),Ze("cancel",t),Ze("close",t);break;case"iframe":case"object":Ze("load",t);break;case"video":case"audio":for(o=0;o<sl.length;o++)Ze(sl[o],t);break;case"image":Ze("error",t),Ze("load",t);break;case"details":Ze("toggle",t);break;case"embed":case"source":case"link":Ze("error",t),Ze("load",t);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(ie in a)if(a.hasOwnProperty(ie)&&(o=a[ie],o!=null))switch(ie){case"children":case"dangerouslySetInnerHTML":throw Error(s(137,i));default:wt(t,i,ie,o,a,null)}return;default:if(rc(i)){for(ce in a)a.hasOwnProperty(ce)&&(o=a[ce],o!==void 0&&$f(t,i,ce,o,a,void 0));return}}for(E in a)a.hasOwnProperty(E)&&(o=a[E],o!=null&&wt(t,i,E,o,a,null))}function gw(t,i,a,o){switch(i){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var h=null,p=null,v=null,E=null,I=null,ie=null,ce=null;for(oe in a){var pe=a[oe];if(a.hasOwnProperty(oe)&&pe!=null)switch(oe){case"checked":break;case"value":break;case"defaultValue":I=pe;default:o.hasOwnProperty(oe)||wt(t,i,oe,null,o,pe)}}for(var se in o){var oe=o[se];if(pe=a[se],o.hasOwnProperty(se)&&(oe!=null||pe!=null))switch(se){case"type":p=oe;break;case"name":h=oe;break;case"checked":ie=oe;break;case"defaultChecked":ce=oe;break;case"value":v=oe;break;case"defaultValue":E=oe;break;case"children":case"dangerouslySetInnerHTML":if(oe!=null)throw Error(s(137,i));break;default:oe!==pe&&wt(t,i,se,oe,o,pe)}}tc(t,v,E,I,ie,ce,p,h);return;case"select":oe=v=E=se=null;for(p in a)if(I=a[p],a.hasOwnProperty(p)&&I!=null)switch(p){case"value":break;case"multiple":oe=I;default:o.hasOwnProperty(p)||wt(t,i,p,null,o,I)}for(h in o)if(p=o[h],I=a[h],o.hasOwnProperty(h)&&(p!=null||I!=null))switch(h){case"value":se=p;break;case"defaultValue":E=p;break;case"multiple":v=p;default:p!==I&&wt(t,i,h,p,o,I)}i=E,a=v,o=oe,se!=null?bs(t,!!a,se,!1):!!o!=!!a&&(i!=null?bs(t,!!a,i,!0):bs(t,!!a,a?[]:"",!1));return;case"textarea":oe=se=null;for(E in a)if(h=a[E],a.hasOwnProperty(E)&&h!=null&&!o.hasOwnProperty(E))switch(E){case"value":break;case"children":break;default:wt(t,i,E,null,o,h)}for(v in o)if(h=o[v],p=a[v],o.hasOwnProperty(v)&&(h!=null||p!=null))switch(v){case"value":se=h;break;case"defaultValue":oe=h;break;case"children":break;case"dangerouslySetInnerHTML":if(h!=null)throw Error(s(91));break;default:h!==p&&wt(t,i,v,h,o,p)}om(t,se,oe);return;case"option":for(var Re in a)if(se=a[Re],a.hasOwnProperty(Re)&&se!=null&&!o.hasOwnProperty(Re))switch(Re){case"selected":t.selected=!1;break;default:wt(t,i,Re,null,o,se)}for(I in o)if(se=o[I],oe=a[I],o.hasOwnProperty(I)&&se!==oe&&(se!=null||oe!=null))switch(I){case"selected":t.selected=se&&typeof se!="function"&&typeof se!="symbol";break;default:wt(t,i,I,se,o,oe)}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 Pe in a)se=a[Pe],a.hasOwnProperty(Pe)&&se!=null&&!o.hasOwnProperty(Pe)&&wt(t,i,Pe,null,o,se);for(ie in o)if(se=o[ie],oe=a[ie],o.hasOwnProperty(ie)&&se!==oe&&(se!=null||oe!=null))switch(ie){case"children":case"dangerouslySetInnerHTML":if(se!=null)throw Error(s(137,i));break;default:wt(t,i,ie,se,o,oe)}return;default:if(rc(i)){for(var St in a)se=a[St],a.hasOwnProperty(St)&&se!==void 0&&!o.hasOwnProperty(St)&&$f(t,i,St,void 0,o,se);for(ce in o)se=o[ce],oe=a[ce],!o.hasOwnProperty(ce)||se===oe||se===void 0&&oe===void 0||$f(t,i,ce,se,o,oe);return}}for(var Z in a)se=a[Z],a.hasOwnProperty(Z)&&se!=null&&!o.hasOwnProperty(Z)&&wt(t,i,Z,null,o,se);for(pe in o)se=o[pe],oe=a[pe],!o.hasOwnProperty(pe)||se===oe||se==null&&oe==null||wt(t,i,pe,se,o,oe)}function hy(t){switch(t){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function yw(){if(typeof performance.getEntriesByType=="function"){for(var t=0,i=0,a=performance.getEntriesByType("resource"),o=0;o<a.length;o++){var h=a[o],p=h.transferSize,v=h.initiatorType,E=h.duration;if(p&&E&&hy(v)){for(v=0,E=h.responseEnd,o+=1;o<a.length;o++){var I=a[o],ie=I.startTime;if(ie>E)break;var ce=I.transferSize,pe=I.initiatorType;ce&&hy(pe)&&(I=I.responseEnd,v+=ce*(I<E?1:(E-ie)/(I-ie)))}if(--o,i+=8*(p+v)/(h.duration/1e3),t++,10<t)break}}if(0<t)return i/t/1e6}return navigator.connection&&(t=navigator.connection.downlink,typeof t=="number")?t:5}var Yf=null,Gf=null;function Xo(t){return t.nodeType===9?t:t.ownerDocument}function dy(t){switch(t){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function my(t,i){if(t===0)switch(i){case"svg":return 1;case"math":return 2;default:return 0}return t===1&&i==="foreignObject"?0:t}function Vf(t,i){return t==="textarea"||t==="noscript"||typeof i.children=="string"||typeof i.children=="number"||typeof i.children=="bigint"||typeof i.dangerouslySetInnerHTML=="object"&&i.dangerouslySetInnerHTML!==null&&i.dangerouslySetInnerHTML.__html!=null}var Jf=null;function bw(){var t=window.event;return t&&t.type==="popstate"?t===Jf?!1:(Jf=t,!0):(Jf=null,!1)}var py=typeof setTimeout=="function"?setTimeout:void 0,xw=typeof clearTimeout=="function"?clearTimeout:void 0,gy=typeof Promise=="function"?Promise:void 0,vw=typeof queueMicrotask=="function"?queueMicrotask:typeof gy<"u"?function(t){return gy.resolve(null).then(t).catch(ww)}:py;function ww(t){setTimeout(function(){throw t})}function Ci(t){return t==="head"}function yy(t,i){var a=i,o=0;do{var h=a.nextSibling;if(t.removeChild(a),h&&h.nodeType===8)if(a=h.data,a==="/$"||a==="/&"){if(o===0){t.removeChild(h),Ks(i);return}o--}else if(a==="$"||a==="$?"||a==="$~"||a==="$!"||a==="&")o++;else if(a==="html")ll(t.ownerDocument.documentElement);else if(a==="head"){a=t.ownerDocument.head,ll(a);for(var p=a.firstChild;p;){var v=p.nextSibling,E=p.nodeName;p[Zt]||E==="SCRIPT"||E==="STYLE"||E==="LINK"&&p.rel.toLowerCase()==="stylesheet"||a.removeChild(p),p=v}}else a==="body"&&ll(t.ownerDocument.body);a=h}while(a);Ks(i)}function by(t,i){var a=t;t=0;do{var o=a.nextSibling;if(a.nodeType===1?i?(a._stashedDisplay=a.style.display,a.style.display="none"):(a.style.display=a._stashedDisplay||"",a.getAttribute("style")===""&&a.removeAttribute("style")):a.nodeType===3&&(i?(a._stashedText=a.nodeValue,a.nodeValue=""):a.nodeValue=a._stashedText||""),o&&o.nodeType===8)if(a=o.data,a==="/$"){if(t===0)break;t--}else a!=="$"&&a!=="$?"&&a!=="$~"&&a!=="$!"||t++;a=o}while(a)}function Xf(t){var i=t.firstChild;for(i&&i.nodeType===10&&(i=i.nextSibling);i;){var a=i;switch(i=i.nextSibling,a.nodeName){case"HTML":case"HEAD":case"BODY":Xf(a),ys(a);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(a.rel.toLowerCase()==="stylesheet")continue}t.removeChild(a)}}function Sw(t,i,a,o){for(;t.nodeType===1;){var h=a;if(t.nodeName.toLowerCase()!==i.toLowerCase()){if(!o&&(t.nodeName!=="INPUT"||t.type!=="hidden"))break}else if(o){if(!t[Zt])switch(i){case"meta":if(!t.hasAttribute("itemprop"))break;return t;case"link":if(p=t.getAttribute("rel"),p==="stylesheet"&&t.hasAttribute("data-precedence"))break;if(p!==h.rel||t.getAttribute("href")!==(h.href==null||h.href===""?null:h.href)||t.getAttribute("crossorigin")!==(h.crossOrigin==null?null:h.crossOrigin)||t.getAttribute("title")!==(h.title==null?null:h.title))break;return t;case"style":if(t.hasAttribute("data-precedence"))break;return t;case"script":if(p=t.getAttribute("src"),(p!==(h.src==null?null:h.src)||t.getAttribute("type")!==(h.type==null?null:h.type)||t.getAttribute("crossorigin")!==(h.crossOrigin==null?null:h.crossOrigin))&&p&&t.hasAttribute("async")&&!t.hasAttribute("itemprop"))break;return t;default:return t}}else if(i==="input"&&t.type==="hidden"){var p=h.name==null?null:""+h.name;if(h.type==="hidden"&&t.getAttribute("name")===p)return t}else return t;if(t=tr(t.nextSibling),t===null)break}return null}function _w(t,i,a){if(i==="")return null;for(;t.nodeType!==3;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!a||(t=tr(t.nextSibling),t===null))return null;return t}function xy(t,i){for(;t.nodeType!==8;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!i||(t=tr(t.nextSibling),t===null))return null;return t}function Kf(t){return t.data==="$?"||t.data==="$~"}function Qf(t){return t.data==="$!"||t.data==="$?"&&t.ownerDocument.readyState!=="loading"}function Ew(t,i){var a=t.ownerDocument;if(t.data==="$~")t._reactRetry=i;else if(t.data!=="$?"||a.readyState!=="loading")i();else{var o=function(){i(),a.removeEventListener("DOMContentLoaded",o)};a.addEventListener("DOMContentLoaded",o),t._reactRetry=o}}function tr(t){for(;t!=null;t=t.nextSibling){var i=t.nodeType;if(i===1||i===3)break;if(i===8){if(i=t.data,i==="$"||i==="$!"||i==="$?"||i==="$~"||i==="&"||i==="F!"||i==="F")break;if(i==="/$"||i==="/&")return null}}return t}var Zf=null;function vy(t){t=t.nextSibling;for(var i=0;t;){if(t.nodeType===8){var a=t.data;if(a==="/$"||a==="/&"){if(i===0)return tr(t.nextSibling);i--}else a!=="$"&&a!=="$!"&&a!=="$?"&&a!=="$~"&&a!=="&"||i++}t=t.nextSibling}return null}function wy(t){t=t.previousSibling;for(var i=0;t;){if(t.nodeType===8){var a=t.data;if(a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"){if(i===0)return t;i--}else a!=="/$"&&a!=="/&"||i++}t=t.previousSibling}return null}function Sy(t,i,a){switch(i=Xo(a),t){case"html":if(t=i.documentElement,!t)throw Error(s(452));return t;case"head":if(t=i.head,!t)throw Error(s(453));return t;case"body":if(t=i.body,!t)throw Error(s(454));return t;default:throw Error(s(451))}}function ll(t){for(var i=t.attributes;i.length;)t.removeAttributeNode(i[0]);ys(t)}var nr=new Map,_y=new Set;function Ko(t){return typeof t.getRootNode=="function"?t.getRootNode():t.nodeType===9?t:t.ownerDocument}var Xr=V.d;V.d={f:kw,r:Cw,D:Aw,C:Tw,L:jw,m:Nw,X:Rw,S:Ow,M:Mw};function kw(){var t=Xr.f(),i=Ho();return t||i}function Cw(t){var i=O(t);i!==null&&i.tag===5&&i.type==="form"?qp(i):Xr.r(t)}var Vs=typeof document>"u"?null:document;function Ey(t,i,a){var o=Vs;if(o&&typeof i=="string"&&i){var h=Jn(i);h='link[rel="'+t+'"][href="'+h+'"]',typeof a=="string"&&(h+='[crossorigin="'+a+'"]'),_y.has(h)||(_y.add(h),t={rel:t,crossOrigin:a,href:i},o.querySelector(h)===null&&(i=o.createElement("link"),on(i,"link",t),Y(i),o.head.appendChild(i)))}}function Aw(t){Xr.D(t),Ey("dns-prefetch",t,null)}function Tw(t,i){Xr.C(t,i),Ey("preconnect",t,i)}function jw(t,i,a){Xr.L(t,i,a);var o=Vs;if(o&&t&&i){var h='link[rel="preload"][as="'+Jn(i)+'"]';i==="image"&&a&&a.imageSrcSet?(h+='[imagesrcset="'+Jn(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(h+='[imagesizes="'+Jn(a.imageSizes)+'"]')):h+='[href="'+Jn(t)+'"]';var p=h;switch(i){case"style":p=Js(t);break;case"script":p=Xs(t)}nr.has(p)||(t=g({rel:"preload",href:i==="image"&&a&&a.imageSrcSet?void 0:t,as:i},a),nr.set(p,t),o.querySelector(h)!==null||i==="style"&&o.querySelector(ol(p))||i==="script"&&o.querySelector(ul(p))||(i=o.createElement("link"),on(i,"link",t),Y(i),o.head.appendChild(i)))}}function Nw(t,i){Xr.m(t,i);var a=Vs;if(a&&t){var o=i&&typeof i.as=="string"?i.as:"script",h='link[rel="modulepreload"][as="'+Jn(o)+'"][href="'+Jn(t)+'"]',p=h;switch(o){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":p=Xs(t)}if(!nr.has(p)&&(t=g({rel:"modulepreload",href:t},i),nr.set(p,t),a.querySelector(h)===null)){switch(o){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(ul(p)))return}o=a.createElement("link"),on(o,"link",t),Y(o),a.head.appendChild(o)}}}function Ow(t,i,a){Xr.S(t,i,a);var o=Vs;if(o&&t){var h=U(o).hoistableStyles,p=Js(t);i=i||"default";var v=h.get(p);if(!v){var E={loading:0,preload:null};if(v=o.querySelector(ol(p)))E.loading=5;else{t=g({rel:"stylesheet",href:t,"data-precedence":i},a),(a=nr.get(p))&&Wf(t,a);var I=v=o.createElement("link");Y(I),on(I,"link",t),I._p=new Promise(function(ie,ce){I.onload=ie,I.onerror=ce}),I.addEventListener("load",function(){E.loading|=1}),I.addEventListener("error",function(){E.loading|=2}),E.loading|=4,Qo(v,i,o)}v={type:"stylesheet",instance:v,count:1,state:E},h.set(p,v)}}}function Rw(t,i){Xr.X(t,i);var a=Vs;if(a&&t){var o=U(a).hoistableScripts,h=Xs(t),p=o.get(h);p||(p=a.querySelector(ul(h)),p||(t=g({src:t,async:!0},i),(i=nr.get(h))&&eh(t,i),p=a.createElement("script"),Y(p),on(p,"link",t),a.head.appendChild(p)),p={type:"script",instance:p,count:1,state:null},o.set(h,p))}}function Mw(t,i){Xr.M(t,i);var a=Vs;if(a&&t){var o=U(a).hoistableScripts,h=Xs(t),p=o.get(h);p||(p=a.querySelector(ul(h)),p||(t=g({src:t,async:!0,type:"module"},i),(i=nr.get(h))&&eh(t,i),p=a.createElement("script"),Y(p),on(p,"link",t),a.head.appendChild(p)),p={type:"script",instance:p,count:1,state:null},o.set(h,p))}}function ky(t,i,a,o){var h=(h=je.current)?Ko(h):null;if(!h)throw Error(s(446));switch(t){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(i=Js(a.href),a=U(h).hoistableStyles,o=a.get(i),o||(o={type:"style",instance:null,count:0,state:null},a.set(i,o)),o):{type:"void",instance:null,count:0,state:null};case"link":if(a.rel==="stylesheet"&&typeof a.href=="string"&&typeof a.precedence=="string"){t=Js(a.href);var p=U(h).hoistableStyles,v=p.get(t);if(v||(h=h.ownerDocument||h,v={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},p.set(t,v),(p=h.querySelector(ol(t)))&&!p._p&&(v.instance=p,v.state.loading=5),nr.has(t)||(a={rel:"preload",as:"style",href:a.href,crossOrigin:a.crossOrigin,integrity:a.integrity,media:a.media,hrefLang:a.hrefLang,referrerPolicy:a.referrerPolicy},nr.set(t,a),p||Dw(h,t,a,v.state))),i&&o===null)throw Error(s(528,""));return v}if(i&&o!==null)throw Error(s(529,""));return null;case"script":return i=a.async,a=a.src,typeof a=="string"&&i&&typeof i!="function"&&typeof i!="symbol"?(i=Xs(a),a=U(h).hoistableScripts,o=a.get(i),o||(o={type:"script",instance:null,count:0,state:null},a.set(i,o)),o):{type:"void",instance:null,count:0,state:null};default:throw Error(s(444,t))}}function Js(t){return'href="'+Jn(t)+'"'}function ol(t){return'link[rel="stylesheet"]['+t+"]"}function Cy(t){return g({},t,{"data-precedence":t.precedence,precedence:null})}function Dw(t,i,a,o){t.querySelector('link[rel="preload"][as="style"]['+i+"]")?o.loading=1:(i=t.createElement("link"),o.preload=i,i.addEventListener("load",function(){return o.loading|=1}),i.addEventListener("error",function(){return o.loading|=2}),on(i,"link",a),Y(i),t.head.appendChild(i))}function Xs(t){return'[src="'+Jn(t)+'"]'}function ul(t){return"script[async]"+t}function Ay(t,i,a){if(i.count++,i.instance===null)switch(i.type){case"style":var o=t.querySelector('style[data-href~="'+Jn(a.href)+'"]');if(o)return i.instance=o,Y(o),o;var h=g({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return o=(t.ownerDocument||t).createElement("style"),Y(o),on(o,"style",h),Qo(o,a.precedence,t),i.instance=o;case"stylesheet":h=Js(a.href);var p=t.querySelector(ol(h));if(p)return i.state.loading|=4,i.instance=p,Y(p),p;o=Cy(a),(h=nr.get(h))&&Wf(o,h),p=(t.ownerDocument||t).createElement("link"),Y(p);var v=p;return v._p=new Promise(function(E,I){v.onload=E,v.onerror=I}),on(p,"link",o),i.state.loading|=4,Qo(p,a.precedence,t),i.instance=p;case"script":return p=Xs(a.src),(h=t.querySelector(ul(p)))?(i.instance=h,Y(h),h):(o=a,(h=nr.get(p))&&(o=g({},a),eh(o,h)),t=t.ownerDocument||t,h=t.createElement("script"),Y(h),on(h,"link",o),t.head.appendChild(h),i.instance=h);case"void":return null;default:throw Error(s(443,i.type))}else i.type==="stylesheet"&&(i.state.loading&4)===0&&(o=i.instance,i.state.loading|=4,Qo(o,a.precedence,t));return i.instance}function Qo(t,i,a){for(var o=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),h=o.length?o[o.length-1]:null,p=h,v=0;v<o.length;v++){var E=o[v];if(E.dataset.precedence===i)p=E;else if(p!==h)break}p?p.parentNode.insertBefore(t,p.nextSibling):(i=a.nodeType===9?a.head:a,i.insertBefore(t,i.firstChild))}function Wf(t,i){t.crossOrigin==null&&(t.crossOrigin=i.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=i.referrerPolicy),t.title==null&&(t.title=i.title)}function eh(t,i){t.crossOrigin==null&&(t.crossOrigin=i.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=i.referrerPolicy),t.integrity==null&&(t.integrity=i.integrity)}var Zo=null;function Ty(t,i,a){if(Zo===null){var o=new Map,h=Zo=new Map;h.set(a,o)}else h=Zo,o=h.get(a),o||(o=new Map,h.set(a,o));if(o.has(t))return o;for(o.set(t,null),a=a.getElementsByTagName(t),h=0;h<a.length;h++){var p=a[h];if(!(p[Zt]||p[Ct]||t==="link"&&p.getAttribute("rel")==="stylesheet")&&p.namespaceURI!=="http://www.w3.org/2000/svg"){var v=p.getAttribute(i)||"";v=t+v;var E=o.get(v);E?E.push(p):o.set(v,[p])}}return o}function jy(t,i,a){t=t.ownerDocument||t,t.head.insertBefore(a,i==="title"?t.querySelector("head > title"):null)}function Lw(t,i,a){if(a===1||i.itemProp!=null)return!1;switch(t){case"meta":case"title":return!0;case"style":if(typeof i.precedence!="string"||typeof i.href!="string"||i.href==="")break;return!0;case"link":if(typeof i.rel!="string"||typeof i.href!="string"||i.href===""||i.onLoad||i.onError)break;switch(i.rel){case"stylesheet":return t=i.disabled,typeof i.precedence=="string"&&t==null;default:return!0}case"script":if(i.async&&typeof i.async!="function"&&typeof i.async!="symbol"&&!i.onLoad&&!i.onError&&i.src&&typeof i.src=="string")return!0}return!1}function Ny(t){return!(t.type==="stylesheet"&&(t.state.loading&3)===0)}function zw(t,i,a,o){if(a.type==="stylesheet"&&(typeof o.media!="string"||matchMedia(o.media).matches!==!1)&&(a.state.loading&4)===0){if(a.instance===null){var h=Js(o.href),p=i.querySelector(ol(h));if(p){i=p._p,i!==null&&typeof i=="object"&&typeof i.then=="function"&&(t.count++,t=Wo.bind(t),i.then(t,t)),a.state.loading|=4,a.instance=p,Y(p);return}p=i.ownerDocument||i,o=Cy(o),(h=nr.get(h))&&Wf(o,h),p=p.createElement("link"),Y(p);var v=p;v._p=new Promise(function(E,I){v.onload=E,v.onerror=I}),on(p,"link",o),a.instance=p}t.stylesheets===null&&(t.stylesheets=new Map),t.stylesheets.set(a,i),(i=a.state.preload)&&(a.state.loading&3)===0&&(t.count++,a=Wo.bind(t),i.addEventListener("load",a),i.addEventListener("error",a))}}var th=0;function Uw(t,i){return t.stylesheets&&t.count===0&&tu(t,t.stylesheets),0<t.count||0<t.imgCount?function(a){var o=setTimeout(function(){if(t.stylesheets&&tu(t,t.stylesheets),t.unsuspend){var p=t.unsuspend;t.unsuspend=null,p()}},6e4+i);0<t.imgBytes&&th===0&&(th=62500*yw());var h=setTimeout(function(){if(t.waitingForImages=!1,t.count===0&&(t.stylesheets&&tu(t,t.stylesheets),t.unsuspend)){var p=t.unsuspend;t.unsuspend=null,p()}},(t.imgBytes>th?50:800)+i);return t.unsuspend=a,function(){t.unsuspend=null,clearTimeout(o),clearTimeout(h)}}:null}function Wo(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)tu(this,this.stylesheets);else if(this.unsuspend){var t=this.unsuspend;this.unsuspend=null,t()}}}var eu=null;function tu(t,i){t.stylesheets=null,t.unsuspend!==null&&(t.count++,eu=new Map,i.forEach(Bw,t),eu=null,Wo.call(t))}function Bw(t,i){if(!(i.state.loading&4)){var a=eu.get(t);if(a)var o=a.get(null);else{a=new Map,eu.set(t,a);for(var h=t.querySelectorAll("link[data-precedence],style[data-precedence]"),p=0;p<h.length;p++){var v=h[p];(v.nodeName==="LINK"||v.getAttribute("media")!=="not all")&&(a.set(v.dataset.precedence,v),o=v)}o&&a.set(null,o)}h=i.instance,v=h.getAttribute("data-precedence"),p=a.get(v)||o,p===o&&a.set(null,h),a.set(v,h),this.count++,o=Wo.bind(this),h.addEventListener("load",o),h.addEventListener("error",o),p?p.parentNode.insertBefore(h,p.nextSibling):(t=t.nodeType===9?t.head:t,t.insertBefore(h,t.firstChild)),i.state.loading|=4}}var cl={$$typeof:T,Provider:null,Consumer:null,_currentValue:ue,_currentValue2:ue,_threadCount:0};function Pw(t,i,a,o,h,p,v,E,I){this.tag=1,this.containerInfo=t,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=si(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=si(0),this.hiddenUpdates=si(null),this.identifierPrefix=o,this.onUncaughtError=h,this.onCaughtError=p,this.onRecoverableError=v,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=I,this.incompleteTransitions=new Map}function Oy(t,i,a,o,h,p,v,E,I,ie,ce,pe){return t=new Pw(t,i,a,v,I,ie,ce,pe,E),i=1,p===!0&&(i|=24),p=Mn(3,null,null,i),t.current=p,p.stateNode=t,i=Mc(),i.refCount++,t.pooledCache=i,i.refCount++,p.memoizedState={element:o,isDehydrated:a,cache:i},Uc(p),t}function Ry(t){return t?(t=Cs,t):Cs}function My(t,i,a,o,h,p){h=Ry(h),o.context===null?o.context=h:o.pendingContext=h,o=pi(i),o.payload={element:a},p=p===void 0?null:p,p!==null&&(o.callback=p),a=gi(t,o,i),a!==null&&(kn(a,t,i),Ia(a,t,i))}function Dy(t,i){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var a=t.retryLane;t.retryLane=a!==0&&a<i?a:i}}function nh(t,i){Dy(t,i),(t=t.alternate)&&Dy(t,i)}function Ly(t){if(t.tag===13||t.tag===31){var i=Ki(t,67108864);i!==null&&kn(i,t,67108864),nh(t,67108864)}}function zy(t){if(t.tag===13||t.tag===31){var i=Bn();i=Or(i);var a=Ki(t,i);a!==null&&kn(a,t,i),nh(t,i)}}var nu=!0;function qw(t,i,a,o){var h=P.T;P.T=null;var p=V.p;try{V.p=2,rh(t,i,a,o)}finally{V.p=p,P.T=h}}function Hw(t,i,a,o){var h=P.T;P.T=null;var p=V.p;try{V.p=8,rh(t,i,a,o)}finally{V.p=p,P.T=h}}function rh(t,i,a,o){if(nu){var h=ih(o);if(h===null)Ff(t,i,o,ru,a),By(t,o);else if(Fw(h,t,i,a,o))o.stopPropagation();else if(By(t,o),i&4&&-1<Iw.indexOf(t)){for(;h!==null;){var p=O(h);if(p!==null)switch(p.tag){case 3:if(p=p.stateNode,p.current.memoizedState.isDehydrated){var v=lr(p.pendingLanes);if(v!==0){var E=p;for(E.pendingLanes|=2,E.entangledLanes|=2;v;){var I=1<<31-Se(v);E.entanglements[1]|=I,v&=~I}wr(p),(dt&6)===0&&(Po=xt()+500,il(0))}}break;case 31:case 13:E=Ki(p,2),E!==null&&kn(E,p,2),Ho(),nh(p,2)}if(p=ih(o),p===null&&Ff(t,i,o,ru,a),p===h)break;h=p}h!==null&&o.stopPropagation()}else Ff(t,i,o,null,a)}}function ih(t){return t=sc(t),sh(t)}var ru=null;function sh(t){if(ru=null,t=k(t),t!==null){var i=u(t);if(i===null)t=null;else{var a=i.tag;if(a===13){if(t=c(i),t!==null)return t;t=null}else if(a===31){if(t=f(i),t!==null)return t;t=null}else if(a===3){if(i.stateNode.current.memoizedState.isDehydrated)return i.tag===3?i.stateNode.containerInfo:null;t=null}else i!==t&&(t=null)}}return ru=t,null}function Uy(t){switch(t){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(jn()){case fe:return 2;case we:return 8;case Ue:case $e:return 32;case at:return 268435456;default:return 32}default:return 32}}var ah=!1,Ai=null,Ti=null,ji=null,fl=new Map,hl=new Map,Ni=[],Iw="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 By(t,i){switch(t){case"focusin":case"focusout":Ai=null;break;case"dragenter":case"dragleave":Ti=null;break;case"mouseover":case"mouseout":ji=null;break;case"pointerover":case"pointerout":fl.delete(i.pointerId);break;case"gotpointercapture":case"lostpointercapture":hl.delete(i.pointerId)}}function dl(t,i,a,o,h,p){return t===null||t.nativeEvent!==p?(t={blockedOn:i,domEventName:a,eventSystemFlags:o,nativeEvent:p,targetContainers:[h]},i!==null&&(i=O(i),i!==null&&Ly(i)),t):(t.eventSystemFlags|=o,i=t.targetContainers,h!==null&&i.indexOf(h)===-1&&i.push(h),t)}function Fw(t,i,a,o,h){switch(i){case"focusin":return Ai=dl(Ai,t,i,a,o,h),!0;case"dragenter":return Ti=dl(Ti,t,i,a,o,h),!0;case"mouseover":return ji=dl(ji,t,i,a,o,h),!0;case"pointerover":var p=h.pointerId;return fl.set(p,dl(fl.get(p)||null,t,i,a,o,h)),!0;case"gotpointercapture":return p=h.pointerId,hl.set(p,dl(hl.get(p)||null,t,i,a,o,h)),!0}return!1}function Py(t){var i=k(t.target);if(i!==null){var a=u(i);if(a!==null){if(i=a.tag,i===13){if(i=c(a),i!==null){t.blockedOn=i,Xl(t.priority,function(){zy(a)});return}}else if(i===31){if(i=f(a),i!==null){t.blockedOn=i,Xl(t.priority,function(){zy(a)});return}}else if(i===3&&a.stateNode.current.memoizedState.isDehydrated){t.blockedOn=a.tag===3?a.stateNode.containerInfo:null;return}}}t.blockedOn=null}function iu(t){if(t.blockedOn!==null)return!1;for(var i=t.targetContainers;0<i.length;){var a=ih(t.nativeEvent);if(a===null){a=t.nativeEvent;var o=new a.constructor(a.type,a);ic=o,a.target.dispatchEvent(o),ic=null}else return i=O(a),i!==null&&Ly(i),t.blockedOn=a,!1;i.shift()}return!0}function qy(t,i,a){iu(t)&&a.delete(i)}function $w(){ah=!1,Ai!==null&&iu(Ai)&&(Ai=null),Ti!==null&&iu(Ti)&&(Ti=null),ji!==null&&iu(ji)&&(ji=null),fl.forEach(qy),hl.forEach(qy)}function su(t,i){t.blockedOn===i&&(t.blockedOn=null,ah||(ah=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,$w)))}var au=null;function Hy(t){au!==t&&(au=t,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){au===t&&(au=null);for(var i=0;i<t.length;i+=3){var a=t[i],o=t[i+1],h=t[i+2];if(typeof o!="function"){if(sh(o||a)===null)continue;break}var p=O(a);p!==null&&(t.splice(i,3),i-=3,rf(p,{pending:!0,data:h,method:a.method,action:o},o,h))}}))}function Ks(t){function i(I){return su(I,t)}Ai!==null&&su(Ai,t),Ti!==null&&su(Ti,t),ji!==null&&su(ji,t),fl.forEach(i),hl.forEach(i);for(var a=0;a<Ni.length;a++){var o=Ni[a];o.blockedOn===t&&(o.blockedOn=null)}for(;0<Ni.length&&(a=Ni[0],a.blockedOn===null);)Py(a),a.blockedOn===null&&Ni.shift();if(a=(t.ownerDocument||t).$$reactFormReplay,a!=null)for(o=0;o<a.length;o+=3){var h=a[o],p=a[o+1],v=h[qt]||null;if(typeof p=="function")v||Hy(a);else if(v){var E=null;if(p&&p.hasAttribute("formAction")){if(h=p,v=p[qt]||null)E=v.formAction;else if(sh(h)!==null)continue}else E=v.action;typeof E=="function"?a[o+1]=E:(a.splice(o,3),o-=3),Hy(a)}}}function Iy(){function t(p){p.canIntercept&&p.info==="react-transition"&&p.intercept({handler:function(){return new Promise(function(v){return h=v})},focusReset:"manual",scroll:"manual"})}function i(){h!==null&&(h(),h=null),o||setTimeout(a,20)}function a(){if(!o&&!navigation.transition){var p=navigation.currentEntry;p&&p.url!=null&&navigation.navigate(p.url,{state:p.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var o=!1,h=null;return navigation.addEventListener("navigate",t),navigation.addEventListener("navigatesuccess",i),navigation.addEventListener("navigateerror",i),setTimeout(a,100),function(){o=!0,navigation.removeEventListener("navigate",t),navigation.removeEventListener("navigatesuccess",i),navigation.removeEventListener("navigateerror",i),h!==null&&(h(),h=null)}}}function lh(t){this._internalRoot=t}lu.prototype.render=lh.prototype.render=function(t){var i=this._internalRoot;if(i===null)throw Error(s(409));var a=i.current,o=Bn();My(a,o,t,i,null,null)},lu.prototype.unmount=lh.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var i=t.containerInfo;My(t.current,2,null,t,null,null),Ho(),i[On]=null}};function lu(t){this._internalRoot=t}lu.prototype.unstable_scheduleHydration=function(t){if(t){var i=ka();t={blockedOn:null,target:t,priority:i};for(var a=0;a<Ni.length&&i!==0&&i<Ni[a].priority;a++);Ni.splice(a,0,t),a===0&&Py(t)}};var Fy=n.version;if(Fy!=="19.2.4")throw Error(s(527,Fy,"19.2.4"));V.findDOMNode=function(t){var i=t._reactInternals;if(i===void 0)throw typeof t.render=="function"?Error(s(188)):(t=Object.keys(t).join(","),Error(s(268,t)));return t=d(i),t=t!==null?y(t):null,t=t===null?null:t.stateNode,t};var Yw={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:P,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var ou=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!ou.isDisabled&&ou.supportsFiber)try{Gt=ou.inject(Yw),ge=ou}catch{}}return pl.createRoot=function(t,i){if(!l(t))throw Error(s(299));var a=!1,o="",h=Kp,p=Qp,v=Zp;return i!=null&&(i.unstable_strictMode===!0&&(a=!0),i.identifierPrefix!==void 0&&(o=i.identifierPrefix),i.onUncaughtError!==void 0&&(h=i.onUncaughtError),i.onCaughtError!==void 0&&(p=i.onCaughtError),i.onRecoverableError!==void 0&&(v=i.onRecoverableError)),i=Oy(t,1,!1,null,null,a,o,null,h,p,v,Iy),t[On]=i.current,If(t),new lh(i)},pl.hydrateRoot=function(t,i,a){if(!l(t))throw Error(s(299));var o=!1,h="",p=Kp,v=Qp,E=Zp,I=null;return a!=null&&(a.unstable_strictMode===!0&&(o=!0),a.identifierPrefix!==void 0&&(h=a.identifierPrefix),a.onUncaughtError!==void 0&&(p=a.onUncaughtError),a.onCaughtError!==void 0&&(v=a.onCaughtError),a.onRecoverableError!==void 0&&(E=a.onRecoverableError),a.formState!==void 0&&(I=a.formState)),i=Oy(t,1,!0,i,a??null,o,h,I,p,v,E,Iy),i.context=Ry(null),a=i.current,o=Bn(),o=Or(o),h=pi(o),h.callback=null,gi(a,h,o),a=o,i.current.lanes=a,or(i,a),wr(i),t[On]=i.current,If(t),new lu(i)},pl.version="19.2.4",pl}var Wy;function nS(){if(Wy)return ch.exports;Wy=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(n){console.error(n)}}return e(),ch.exports=tS(),ch.exports}var rS=nS();/**
50
+ * react-router v7.13.1
51
+ *
52
+ * Copyright (c) Remix Software Inc.
53
+ *
54
+ * This source code is licensed under the MIT license found in the
55
+ * LICENSE.md file in the root directory of this source tree.
56
+ *
57
+ * @license MIT
58
+ */var e0="popstate";function t0(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function iS(e={}){function n(s,l){var d;let u=(d=l.state)==null?void 0:d.masked,{pathname:c,search:f,hash:m}=u||s.location;return Xh("",{pathname:c,search:f,hash:m},l.state&&l.state.usr||null,l.state&&l.state.key||"default",u?{pathname:s.location.pathname,search:s.location.search,hash:s.location.hash}:void 0)}function r(s,l){return typeof l=="string"?l:Dl(l)}return aS(n,r,null,e)}function Bt(e,n){if(e===!1||e===null||typeof e>"u")throw new Error(n)}function Cr(e,n){if(!e){typeof console<"u"&&console.warn(n);try{throw new Error(n)}catch{}}}function sS(){return Math.random().toString(36).substring(2,10)}function n0(e,n){return{usr:e.state,key:e.key,idx:n,masked:e.unstable_mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function Xh(e,n,r=null,s,l){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof n=="string"?ya(n):n,state:r,key:n&&n.key||s||sS(),unstable_mask:l}}function Dl({pathname:e="/",search:n="",hash:r=""}){return n&&n!=="?"&&(e+=n.charAt(0)==="?"?n:"?"+n),r&&r!=="#"&&(e+=r.charAt(0)==="#"?r:"#"+r),e}function ya(e){let n={};if(e){let r=e.indexOf("#");r>=0&&(n.hash=e.substring(r),e=e.substring(0,r));let s=e.indexOf("?");s>=0&&(n.search=e.substring(s),e=e.substring(0,s)),e&&(n.pathname=e)}return n}function aS(e,n,r,s={}){let{window:l=document.defaultView,v5Compat:u=!1}=s,c=l.history,f="POP",m=null,d=y();d==null&&(d=0,c.replaceState({...c.state,idx:d},""));function y(){return(c.state||{idx:null}).idx}function g(){f="POP";let q=y(),L=q==null?null:q-d;d=q,m&&m({action:f,location:D.location,delta:L})}function x(q,L){f="PUSH";let $=t0(q)?q:Xh(D.location,q,L);d=y()+1;let T=n0($,d),te=D.createHref($.unstable_mask||$);try{c.pushState(T,"",te)}catch(B){if(B instanceof DOMException&&B.name==="DataCloneError")throw B;l.location.assign(te)}u&&m&&m({action:f,location:D.location,delta:1})}function w(q,L){f="REPLACE";let $=t0(q)?q:Xh(D.location,q,L);d=y();let T=n0($,d),te=D.createHref($.unstable_mask||$);c.replaceState(T,"",te),u&&m&&m({action:f,location:D.location,delta:0})}function S(q){return lS(q)}let D={get action(){return f},get location(){return e(l,c)},listen(q){if(m)throw new Error("A history only accepts one active listener");return l.addEventListener(e0,g),m=q,()=>{l.removeEventListener(e0,g),m=null}},createHref(q){return n(l,q)},createURL:S,encodeLocation(q){let L=S(q);return{pathname:L.pathname,search:L.search,hash:L.hash}},push:x,replace:w,go(q){return c.go(q)}};return D}function lS(e,n=!1){let r="http://localhost";typeof window<"u"&&(r=window.location.origin!=="null"?window.location.origin:window.location.href),Bt(r,"No window.location.(origin|href) available to create URL");let s=typeof e=="string"?e:Dl(e);return s=s.replace(/ $/,"%20"),!n&&s.startsWith("//")&&(s=r+s),new URL(s,r)}function Bb(e,n,r="/"){return oS(e,n,r,!1)}function oS(e,n,r,s){let l=typeof n=="string"?ya(n):n,u=Wr(l.pathname||"/",r);if(u==null)return null;let c=Pb(e);uS(c);let f=null;for(let m=0;f==null&&m<c.length;++m){let d=vS(u);f=bS(c[m],d,s)}return f}function Pb(e,n=[],r=[],s="",l=!1){let u=(c,f,m=l,d)=>{let y={relativePath:d===void 0?c.path||"":d,caseSensitive:c.caseSensitive===!0,childrenIndex:f,route:c};if(y.relativePath.startsWith("/")){if(!y.relativePath.startsWith(s)&&m)return;Bt(y.relativePath.startsWith(s),`Absolute route path "${y.relativePath}" nested under path "${s}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),y.relativePath=y.relativePath.slice(s.length)}let g=kr([s,y.relativePath]),x=r.concat(y);c.children&&c.children.length>0&&(Bt(c.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${g}".`),Pb(c.children,n,x,g,m)),!(c.path==null&&!c.index)&&n.push({path:g,score:gS(g,c.index),routesMeta:x})};return e.forEach((c,f)=>{var m;if(c.path===""||!((m=c.path)!=null&&m.includes("?")))u(c,f);else for(let d of qb(c.path))u(c,f,!0,d)}),n}function qb(e){let n=e.split("/");if(n.length===0)return[];let[r,...s]=n,l=r.endsWith("?"),u=r.replace(/\?$/,"");if(s.length===0)return l?[u,""]:[u];let c=qb(s.join("/")),f=[];return f.push(...c.map(m=>m===""?u:[u,m].join("/"))),l&&f.push(...c),f.map(m=>e.startsWith("/")&&m===""?"/":m)}function uS(e){e.sort((n,r)=>n.score!==r.score?r.score-n.score:yS(n.routesMeta.map(s=>s.childrenIndex),r.routesMeta.map(s=>s.childrenIndex)))}var cS=/^:[\w-]+$/,fS=3,hS=2,dS=1,mS=10,pS=-2,r0=e=>e==="*";function gS(e,n){let r=e.split("/"),s=r.length;return r.some(r0)&&(s+=pS),n&&(s+=hS),r.filter(l=>!r0(l)).reduce((l,u)=>l+(cS.test(u)?fS:u===""?dS:mS),s)}function yS(e,n){return e.length===n.length&&e.slice(0,-1).every((s,l)=>s===n[l])?e[e.length-1]-n[n.length-1]:0}function bS(e,n,r=!1){let{routesMeta:s}=e,l={},u="/",c=[];for(let f=0;f<s.length;++f){let m=s[f],d=f===s.length-1,y=u==="/"?n:n.slice(u.length)||"/",g=ku({path:m.relativePath,caseSensitive:m.caseSensitive,end:d},y),x=m.route;if(!g&&d&&r&&!s[s.length-1].route.index&&(g=ku({path:m.relativePath,caseSensitive:m.caseSensitive,end:!1},y)),!g)return null;Object.assign(l,g.params),c.push({params:l,pathname:kr([u,g.pathname]),pathnameBase:ES(kr([u,g.pathnameBase])),route:x}),g.pathnameBase!=="/"&&(u=kr([u,g.pathnameBase]))}return c}function ku(e,n){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[r,s]=xS(e.path,e.caseSensitive,e.end),l=n.match(r);if(!l)return null;let u=l[0],c=u.replace(/(.)\/+$/,"$1"),f=l.slice(1);return{params:s.reduce((d,{paramName:y,isOptional:g},x)=>{if(y==="*"){let S=f[x]||"";c=u.slice(0,u.length-S.length).replace(/(.)\/+$/,"$1")}const w=f[x];return g&&!w?d[y]=void 0:d[y]=(w||"").replace(/%2F/g,"/"),d},{}),pathname:u,pathnameBase:c,pattern:e}}function xS(e,n=!1,r=!0){Cr(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let s=[],l="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(c,f,m,d,y)=>{if(s.push({paramName:f,isOptional:m!=null}),m){let g=y.charAt(d+c.length);return g&&g!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(s.push({paramName:"*"}),l+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?l+="\\/*$":e!==""&&e!=="/"&&(l+="(?:(?=\\/|$))"),[new RegExp(l,n?void 0:"i"),s]}function vS(e){try{return e.split("/").map(n=>decodeURIComponent(n).replace(/\//g,"%2F")).join("/")}catch(n){return Cr(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${n}).`),e}}function Wr(e,n){if(n==="/")return e;if(!e.toLowerCase().startsWith(n.toLowerCase()))return null;let r=n.endsWith("/")?n.length-1:n.length,s=e.charAt(r);return s&&s!=="/"?null:e.slice(r)||"/"}var wS=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function SS(e,n="/"){let{pathname:r,search:s="",hash:l=""}=typeof e=="string"?ya(e):e,u;return r?(r=r.replace(/\/\/+/g,"/"),r.startsWith("/")?u=i0(r.substring(1),"/"):u=i0(r,n)):u=n,{pathname:u,search:kS(s),hash:CS(l)}}function i0(e,n){let r=n.replace(/\/+$/,"").split("/");return e.split("/").forEach(l=>{l===".."?r.length>1&&r.pop():l!=="."&&r.push(l)}),r.length>1?r.join("/"):"/"}function mh(e,n,r,s){return`Cannot include a '${e}' character in a manually specified \`to.${n}\` field [${JSON.stringify(s)}]. Please separate it out to the \`to.${r}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function _S(e){return e.filter((n,r)=>r===0||n.route.path&&n.route.path.length>0)}function Hb(e){let n=_S(e);return n.map((r,s)=>s===n.length-1?r.pathname:r.pathnameBase)}function kd(e,n,r,s=!1){let l;typeof e=="string"?l=ya(e):(l={...e},Bt(!l.pathname||!l.pathname.includes("?"),mh("?","pathname","search",l)),Bt(!l.pathname||!l.pathname.includes("#"),mh("#","pathname","hash",l)),Bt(!l.search||!l.search.includes("#"),mh("#","search","hash",l)));let u=e===""||l.pathname==="",c=u?"/":l.pathname,f;if(c==null)f=r;else{let g=n.length-1;if(!s&&c.startsWith("..")){let x=c.split("/");for(;x[0]==="..";)x.shift(),g-=1;l.pathname=x.join("/")}f=g>=0?n[g]:"/"}let m=SS(l,f),d=c&&c!=="/"&&c.endsWith("/"),y=(u||c===".")&&r.endsWith("/");return!m.pathname.endsWith("/")&&(d||y)&&(m.pathname+="/"),m}var kr=e=>e.join("/").replace(/\/\/+/g,"/"),ES=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),kS=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,CS=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,AS=class{constructor(e,n,r,s=!1){this.status=e,this.statusText=n||"",this.internal=s,r instanceof Error?(this.data=r.toString(),this.error=r):this.data=r}};function TS(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function jS(e){return e.map(n=>n.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var Ib=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Fb(e,n){let r=e;if(typeof r!="string"||!wS.test(r))return{absoluteURL:void 0,isExternal:!1,to:r};let s=r,l=!1;if(Ib)try{let u=new URL(window.location.href),c=r.startsWith("//")?new URL(u.protocol+r):new URL(r),f=Wr(c.pathname,n);c.origin===u.origin&&f!=null?r=f+c.search+c.hash:l=!0}catch{Cr(!1,`<Link to="${r}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:s,isExternal:l,to:r}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var $b=["POST","PUT","PATCH","DELETE"];new Set($b);var NS=["GET",...$b];new Set(NS);var ba=N.createContext(null);ba.displayName="DataRouter";var Iu=N.createContext(null);Iu.displayName="DataRouterState";var OS=N.createContext(!1),Yb=N.createContext({isTransitioning:!1});Yb.displayName="ViewTransition";var RS=N.createContext(new Map);RS.displayName="Fetchers";var MS=N.createContext(null);MS.displayName="Await";var ar=N.createContext(null);ar.displayName="Navigation";var Hl=N.createContext(null);Hl.displayName="Location";var Ar=N.createContext({outlet:null,matches:[],isDataRoute:!1});Ar.displayName="Route";var Cd=N.createContext(null);Cd.displayName="RouteError";var Gb="REACT_ROUTER_ERROR",DS="REDIRECT",LS="ROUTE_ERROR_RESPONSE";function zS(e){if(e.startsWith(`${Gb}:${DS}:{`))try{let n=JSON.parse(e.slice(28));if(typeof n=="object"&&n&&typeof n.status=="number"&&typeof n.statusText=="string"&&typeof n.location=="string"&&typeof n.reloadDocument=="boolean"&&typeof n.replace=="boolean")return n}catch{}}function US(e){if(e.startsWith(`${Gb}:${LS}:{`))try{let n=JSON.parse(e.slice(40));if(typeof n=="object"&&n&&typeof n.status=="number"&&typeof n.statusText=="string")return new AS(n.status,n.statusText,n.data)}catch{}}function BS(e,{relative:n}={}){Bt(Il(),"useHref() may be used only in the context of a <Router> component.");let{basename:r,navigator:s}=N.useContext(ar),{hash:l,pathname:u,search:c}=Fl(e,{relative:n}),f=u;return r!=="/"&&(f=u==="/"?r:kr([r,u])),s.createHref({pathname:f,search:c,hash:l})}function Il(){return N.useContext(Hl)!=null}function Tr(){return Bt(Il(),"useLocation() may be used only in the context of a <Router> component."),N.useContext(Hl).location}var Vb="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function Jb(e){N.useContext(ar).static||N.useLayoutEffect(e)}function ti(){let{isDataRoute:e}=N.useContext(Ar);return e?ZS():PS()}function PS(){Bt(Il(),"useNavigate() may be used only in the context of a <Router> component.");let e=N.useContext(ba),{basename:n,navigator:r}=N.useContext(ar),{matches:s}=N.useContext(Ar),{pathname:l}=Tr(),u=JSON.stringify(Hb(s)),c=N.useRef(!1);return Jb(()=>{c.current=!0}),N.useCallback((m,d={})=>{if(Cr(c.current,Vb),!c.current)return;if(typeof m=="number"){r.go(m);return}let y=kd(m,JSON.parse(u),l,d.relative==="path");e==null&&n!=="/"&&(y.pathname=y.pathname==="/"?n:kr([n,y.pathname])),(d.replace?r.replace:r.push)(y,d.state,d)},[n,r,u,l,e])}N.createContext(null);function qS(){let{matches:e}=N.useContext(Ar),n=e[e.length-1];return n?n.params:{}}function Fl(e,{relative:n}={}){let{matches:r}=N.useContext(Ar),{pathname:s}=Tr(),l=JSON.stringify(Hb(r));return N.useMemo(()=>kd(e,JSON.parse(l),s,n==="path"),[e,l,s,n])}function HS(e,n){return Xb(e,n)}function Xb(e,n,r){var q;Bt(Il(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:s}=N.useContext(ar),{matches:l}=N.useContext(Ar),u=l[l.length-1],c=u?u.params:{},f=u?u.pathname:"/",m=u?u.pathnameBase:"/",d=u&&u.route;{let L=d&&d.path||"";Qb(f,!d||L.endsWith("*")||L.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${f}" (under <Route path="${L}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
59
+
60
+ Please change the parent <Route path="${L}"> to <Route path="${L==="/"?"*":`${L}/*`}">.`)}let y=Tr(),g;if(n){let L=typeof n=="string"?ya(n):n;Bt(m==="/"||((q=L.pathname)==null?void 0:q.startsWith(m)),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${m}" but pathname "${L.pathname}" was given in the \`location\` prop.`),g=L}else g=y;let x=g.pathname||"/",w=x;if(m!=="/"){let L=m.replace(/^\//,"").split("/");w="/"+x.replace(/^\//,"").split("/").slice(L.length).join("/")}let S=Bb(e,{pathname:w});Cr(d||S!=null,`No routes matched location "${g.pathname}${g.search}${g.hash}" `),Cr(S==null||S[S.length-1].route.element!==void 0||S[S.length-1].route.Component!==void 0||S[S.length-1].route.lazy!==void 0,`Matched leaf route at location "${g.pathname}${g.search}${g.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let D=GS(S&&S.map(L=>Object.assign({},L,{params:Object.assign({},c,L.params),pathname:kr([m,s.encodeLocation?s.encodeLocation(L.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:L.pathname]),pathnameBase:L.pathnameBase==="/"?m:kr([m,s.encodeLocation?s.encodeLocation(L.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:L.pathnameBase])})),l,r);return n&&D?N.createElement(Hl.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,...g},navigationType:"POP"}},D):D}function IS(){let e=QS(),n=TS(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),r=e instanceof Error?e.stack:null,s="rgba(200,200,200, 0.5)",l={padding:"0.5rem",backgroundColor:s},u={padding:"2px 4px",backgroundColor:s},c=null;return console.error("Error handled by React Router default ErrorBoundary:",e),c=N.createElement(N.Fragment,null,N.createElement("p",null,"💿 Hey developer 👋"),N.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",N.createElement("code",{style:u},"ErrorBoundary")," or"," ",N.createElement("code",{style:u},"errorElement")," prop on your route.")),N.createElement(N.Fragment,null,N.createElement("h2",null,"Unexpected Application Error!"),N.createElement("h3",{style:{fontStyle:"italic"}},n),r?N.createElement("pre",{style:l},r):null,c)}var FS=N.createElement(IS,null),Kb=class extends N.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,n){return n.location!==e.location||n.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:n.error,location:n.location,revalidation:e.revalidation||n.revalidation}}componentDidCatch(e,n){this.props.onError?this.props.onError(e,n):console.error("React Router caught the following error during render",e)}render(){let e=this.state.error;if(this.context&&typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){const r=US(e.digest);r&&(e=r)}let n=e!==void 0?N.createElement(Ar.Provider,{value:this.props.routeContext},N.createElement(Cd.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?N.createElement($S,{error:e},n):n}};Kb.contextType=OS;var ph=new WeakMap;function $S({children:e,error:n}){let{basename:r}=N.useContext(ar);if(typeof n=="object"&&n&&"digest"in n&&typeof n.digest=="string"){let s=zS(n.digest);if(s){let l=ph.get(n);if(l)throw l;let u=Fb(s.location,r);if(Ib&&!ph.get(n))if(u.isExternal||s.reloadDocument)window.location.href=u.absoluteURL||u.to;else{const c=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(u.to,{replace:s.replace}));throw ph.set(n,c),c}return N.createElement("meta",{httpEquiv:"refresh",content:`0;url=${u.absoluteURL||u.to}`})}}return e}function YS({routeContext:e,match:n,children:r}){let s=N.useContext(ba);return s&&s.static&&s.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(s.staticContext._deepestRenderedBoundaryId=n.route.id),N.createElement(Ar.Provider,{value:e},r)}function GS(e,n=[],r){let s=r==null?void 0:r.state;if(e==null){if(!s)return null;if(s.errors)e=s.matches;else if(n.length===0&&!s.initialized&&s.matches.length>0)e=s.matches;else return null}let l=e,u=s==null?void 0:s.errors;if(u!=null){let y=l.findIndex(g=>g.route.id&&(u==null?void 0:u[g.route.id])!==void 0);Bt(y>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(u).join(",")}`),l=l.slice(0,Math.min(l.length,y+1))}let c=!1,f=-1;if(r&&s){c=s.renderFallback;for(let y=0;y<l.length;y++){let g=l[y];if((g.route.HydrateFallback||g.route.hydrateFallbackElement)&&(f=y),g.route.id){let{loaderData:x,errors:w}=s,S=g.route.loader&&!x.hasOwnProperty(g.route.id)&&(!w||w[g.route.id]===void 0);if(g.route.lazy||S){r.isStatic&&(c=!0),f>=0?l=l.slice(0,f+1):l=[l[0]];break}}}}let m=r==null?void 0:r.onError,d=s&&m?(y,g)=>{var x,w;m(y,{location:s.location,params:((w=(x=s.matches)==null?void 0:x[0])==null?void 0:w.params)??{},unstable_pattern:jS(s.matches),errorInfo:g})}:void 0;return l.reduceRight((y,g,x)=>{let w,S=!1,D=null,q=null;s&&(w=u&&g.route.id?u[g.route.id]:void 0,D=g.route.errorElement||FS,c&&(f<0&&x===0?(Qb("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),S=!0,q=null):f===x&&(S=!0,q=g.route.hydrateFallbackElement||null)));let L=n.concat(l.slice(0,x+1)),$=()=>{let T;return w?T=D:S?T=q:g.route.Component?T=N.createElement(g.route.Component,null):g.route.element?T=g.route.element:T=y,N.createElement(YS,{match:g,routeContext:{outlet:y,matches:L,isDataRoute:s!=null},children:T})};return s&&(g.route.ErrorBoundary||g.route.errorElement||x===0)?N.createElement(Kb,{location:s.location,revalidation:s.revalidation,component:D,error:w,children:$(),routeContext:{outlet:null,matches:L,isDataRoute:!0},onError:d}):$()},null)}function Ad(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function VS(e){let n=N.useContext(ba);return Bt(n,Ad(e)),n}function JS(e){let n=N.useContext(Iu);return Bt(n,Ad(e)),n}function XS(e){let n=N.useContext(Ar);return Bt(n,Ad(e)),n}function Td(e){let n=XS(e),r=n.matches[n.matches.length-1];return Bt(r.route.id,`${e} can only be used on routes that contain a unique "id"`),r.route.id}function KS(){return Td("useRouteId")}function QS(){var s;let e=N.useContext(Cd),n=JS("useRouteError"),r=Td("useRouteError");return e!==void 0?e:(s=n.errors)==null?void 0:s[r]}function ZS(){let{router:e}=VS("useNavigate"),n=Td("useNavigate"),r=N.useRef(!1);return Jb(()=>{r.current=!0}),N.useCallback(async(l,u={})=>{Cr(r.current,Vb),r.current&&(typeof l=="number"?await e.navigate(l):await e.navigate(l,{fromRouteId:n,...u}))},[e,n])}var s0={};function Qb(e,n,r){!n&&!s0[e]&&(s0[e]=!0,Cr(!1,r))}N.memo(WS);function WS({routes:e,future:n,state:r,isStatic:s,onError:l}){return Xb(e,void 0,{state:r,isStatic:s,onError:l})}function Mi(e){Bt(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function e_({basename:e="/",children:n=null,location:r,navigationType:s="POP",navigator:l,static:u=!1,unstable_useTransitions:c}){Bt(!Il(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let f=e.replace(/^\/*/,"/"),m=N.useMemo(()=>({basename:f,navigator:l,static:u,unstable_useTransitions:c,future:{}}),[f,l,u,c]);typeof r=="string"&&(r=ya(r));let{pathname:d="/",search:y="",hash:g="",state:x=null,key:w="default",unstable_mask:S}=r,D=N.useMemo(()=>{let q=Wr(d,f);return q==null?null:{location:{pathname:q,search:y,hash:g,state:x,key:w,unstable_mask:S},navigationType:s}},[f,d,y,g,x,w,s,S]);return Cr(D!=null,`<Router basename="${f}"> is not able to match the URL "${d}${y}${g}" because it does not start with the basename, so the <Router> won't render anything.`),D==null?null:N.createElement(ar.Provider,{value:m},N.createElement(Hl.Provider,{children:n,value:D}))}function t_({children:e,location:n}){return HS(Kh(e),n)}function Kh(e,n=[]){let r=[];return N.Children.forEach(e,(s,l)=>{if(!N.isValidElement(s))return;let u=[...n,l];if(s.type===N.Fragment){r.push.apply(r,Kh(s.props.children,u));return}Bt(s.type===Mi,`[${typeof s.type=="string"?s.type:s.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),Bt(!s.props.index||!s.props.children,"An index route cannot have child routes.");let c={id:s.props.id||u.join("-"),caseSensitive:s.props.caseSensitive,element:s.props.element,Component:s.props.Component,index:s.props.index,path:s.props.path,middleware:s.props.middleware,loader:s.props.loader,action:s.props.action,hydrateFallbackElement:s.props.hydrateFallbackElement,HydrateFallback:s.props.HydrateFallback,errorElement:s.props.errorElement,ErrorBoundary:s.props.ErrorBoundary,hasErrorBoundary:s.props.hasErrorBoundary===!0||s.props.ErrorBoundary!=null||s.props.errorElement!=null,shouldRevalidate:s.props.shouldRevalidate,handle:s.props.handle,lazy:s.props.lazy};s.props.children&&(c.children=Kh(s.props.children,u)),r.push(c)}),r}var vu="get",wu="application/x-www-form-urlencoded";function Fu(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function n_(e){return Fu(e)&&e.tagName.toLowerCase()==="button"}function r_(e){return Fu(e)&&e.tagName.toLowerCase()==="form"}function i_(e){return Fu(e)&&e.tagName.toLowerCase()==="input"}function s_(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function a_(e,n){return e.button===0&&(!n||n==="_self")&&!s_(e)}var uu=null;function l_(){if(uu===null)try{new FormData(document.createElement("form"),0),uu=!1}catch{uu=!0}return uu}var o_=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function gh(e){return e!=null&&!o_.has(e)?(Cr(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${wu}"`),null):e}function u_(e,n){let r,s,l,u,c;if(r_(e)){let f=e.getAttribute("action");s=f?Wr(f,n):null,r=e.getAttribute("method")||vu,l=gh(e.getAttribute("enctype"))||wu,u=new FormData(e)}else if(n_(e)||i_(e)&&(e.type==="submit"||e.type==="image")){let f=e.form;if(f==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let m=e.getAttribute("formaction")||f.getAttribute("action");if(s=m?Wr(m,n):null,r=e.getAttribute("formmethod")||f.getAttribute("method")||vu,l=gh(e.getAttribute("formenctype"))||gh(f.getAttribute("enctype"))||wu,u=new FormData(f,e),!l_()){let{name:d,type:y,value:g}=e;if(y==="image"){let x=d?`${d}.`:"";u.append(`${x}x`,"0"),u.append(`${x}y`,"0")}else d&&u.append(d,g)}}else{if(Fu(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');r=vu,s=null,l=wu,c=e}return u&&l==="text/plain"&&(c=u,u=void 0),{action:s,method:r.toLowerCase(),encType:l,formData:u,body:c}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function jd(e,n){if(e===!1||e===null||typeof e>"u")throw new Error(n)}function c_(e,n,r,s){let l=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return r?l.pathname.endsWith("/")?l.pathname=`${l.pathname}_.${s}`:l.pathname=`${l.pathname}.${s}`:l.pathname==="/"?l.pathname=`_root.${s}`:n&&Wr(l.pathname,n)==="/"?l.pathname=`${n.replace(/\/$/,"")}/_root.${s}`:l.pathname=`${l.pathname.replace(/\/$/,"")}.${s}`,l}async function f_(e,n){if(e.id in n)return n[e.id];try{let r=await import(e.module);return n[e.id]=r,r}catch(r){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(r),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function h_(e){return e==null?!1:e.href==null?e.rel==="preload"&&typeof e.imageSrcSet=="string"&&typeof e.imageSizes=="string":typeof e.rel=="string"&&typeof e.href=="string"}async function d_(e,n,r){let s=await Promise.all(e.map(async l=>{let u=n.routes[l.route.id];if(u){let c=await f_(u,r);return c.links?c.links():[]}return[]}));return y_(s.flat(1).filter(h_).filter(l=>l.rel==="stylesheet"||l.rel==="preload").map(l=>l.rel==="stylesheet"?{...l,rel:"prefetch",as:"style"}:{...l,rel:"prefetch"}))}function a0(e,n,r,s,l,u){let c=(m,d)=>r[d]?m.route.id!==r[d].route.id:!0,f=(m,d)=>{var y;return r[d].pathname!==m.pathname||((y=r[d].route.path)==null?void 0:y.endsWith("*"))&&r[d].params["*"]!==m.params["*"]};return u==="assets"?n.filter((m,d)=>c(m,d)||f(m,d)):u==="data"?n.filter((m,d)=>{var g;let y=s.routes[m.route.id];if(!y||!y.hasLoader)return!1;if(c(m,d)||f(m,d))return!0;if(m.route.shouldRevalidate){let x=m.route.shouldRevalidate({currentUrl:new URL(l.pathname+l.search+l.hash,window.origin),currentParams:((g=r[0])==null?void 0:g.params)||{},nextUrl:new URL(e,window.origin),nextParams:m.params,defaultShouldRevalidate:!0});if(typeof x=="boolean")return x}return!0}):[]}function m_(e,n,{includeHydrateFallback:r}={}){return p_(e.map(s=>{let l=n.routes[s.route.id];if(!l)return[];let u=[l.module];return l.clientActionModule&&(u=u.concat(l.clientActionModule)),l.clientLoaderModule&&(u=u.concat(l.clientLoaderModule)),r&&l.hydrateFallbackModule&&(u=u.concat(l.hydrateFallbackModule)),l.imports&&(u=u.concat(l.imports)),u}).flat(1))}function p_(e){return[...new Set(e)]}function g_(e){let n={},r=Object.keys(e).sort();for(let s of r)n[s]=e[s];return n}function y_(e,n){let r=new Set;return new Set(n),e.reduce((s,l)=>{let u=JSON.stringify(g_(l));return r.has(u)||(r.add(u),s.push({key:u,link:l})),s},[])}function Zb(){let e=N.useContext(ba);return jd(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function b_(){let e=N.useContext(Iu);return jd(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var Nd=N.createContext(void 0);Nd.displayName="FrameworkContext";function Wb(){let e=N.useContext(Nd);return jd(e,"You must render this element inside a <HydratedRouter> element"),e}function x_(e,n){let r=N.useContext(Nd),[s,l]=N.useState(!1),[u,c]=N.useState(!1),{onFocus:f,onBlur:m,onMouseEnter:d,onMouseLeave:y,onTouchStart:g}=n,x=N.useRef(null);N.useEffect(()=>{if(e==="render"&&c(!0),e==="viewport"){let D=L=>{L.forEach($=>{c($.isIntersecting)})},q=new IntersectionObserver(D,{threshold:.5});return x.current&&q.observe(x.current),()=>{q.disconnect()}}},[e]),N.useEffect(()=>{if(s){let D=setTimeout(()=>{c(!0)},100);return()=>{clearTimeout(D)}}},[s]);let w=()=>{l(!0)},S=()=>{l(!1),c(!1)};return r?e!=="intent"?[u,x,{}]:[u,x,{onFocus:gl(f,w),onBlur:gl(m,S),onMouseEnter:gl(d,w),onMouseLeave:gl(y,S),onTouchStart:gl(g,w)}]:[!1,x,{}]}function gl(e,n){return r=>{e&&e(r),r.defaultPrevented||n(r)}}function v_({page:e,...n}){let{router:r}=Zb(),s=N.useMemo(()=>Bb(r.routes,e,r.basename),[r.routes,e,r.basename]);return s?N.createElement(S_,{page:e,matches:s,...n}):null}function w_(e){let{manifest:n,routeModules:r}=Wb(),[s,l]=N.useState([]);return N.useEffect(()=>{let u=!1;return d_(e,n,r).then(c=>{u||l(c)}),()=>{u=!0}},[e,n,r]),s}function S_({page:e,matches:n,...r}){let s=Tr(),{future:l,manifest:u,routeModules:c}=Wb(),{basename:f}=Zb(),{loaderData:m,matches:d}=b_(),y=N.useMemo(()=>a0(e,n,d,u,s,"data"),[e,n,d,u,s]),g=N.useMemo(()=>a0(e,n,d,u,s,"assets"),[e,n,d,u,s]),x=N.useMemo(()=>{if(e===s.pathname+s.search+s.hash)return[];let D=new Set,q=!1;if(n.forEach($=>{var te;let T=u.routes[$.route.id];!T||!T.hasLoader||(!y.some(B=>B.route.id===$.route.id)&&$.route.id in m&&((te=c[$.route.id])!=null&&te.shouldRevalidate)||T.hasClientLoader?q=!0:D.add($.route.id))}),D.size===0)return[];let L=c_(e,f,l.unstable_trailingSlashAwareDataRequests,"data");return q&&D.size>0&&L.searchParams.set("_routes",n.filter($=>D.has($.route.id)).map($=>$.route.id).join(",")),[L.pathname+L.search]},[f,l.unstable_trailingSlashAwareDataRequests,m,s,u,y,n,e,c]),w=N.useMemo(()=>m_(g,u),[g,u]),S=w_(g);return N.createElement(N.Fragment,null,x.map(D=>N.createElement("link",{key:D,rel:"prefetch",as:"fetch",href:D,...r})),w.map(D=>N.createElement("link",{key:D,rel:"modulepreload",href:D,...r})),S.map(({key:D,link:q})=>N.createElement("link",{key:D,nonce:r.nonce,...q,crossOrigin:q.crossOrigin??r.crossOrigin})))}function __(...e){return n=>{e.forEach(r=>{typeof r=="function"?r(n):r!=null&&(r.current=n)})}}var E_=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{E_&&(window.__reactRouterVersion="7.13.1")}catch{}function k_({basename:e,children:n,unstable_useTransitions:r,window:s}){let l=N.useRef();l.current==null&&(l.current=iS({window:s,v5Compat:!0}));let u=l.current,[c,f]=N.useState({action:u.action,location:u.location}),m=N.useCallback(d=>{r===!1?f(d):N.startTransition(()=>f(d))},[r]);return N.useLayoutEffect(()=>u.listen(m),[u,m]),N.createElement(e_,{basename:e,children:n,location:c.location,navigationType:c.action,navigator:u,unstable_useTransitions:r})}var ex=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,tx=N.forwardRef(function({onClick:n,discover:r="render",prefetch:s="none",relative:l,reloadDocument:u,replace:c,unstable_mask:f,state:m,target:d,to:y,preventScrollReset:g,viewTransition:x,unstable_defaultShouldRevalidate:w,...S},D){let{basename:q,navigator:L,unstable_useTransitions:$}=N.useContext(ar),T=typeof y=="string"&&ex.test(y),te=Fb(y,q);y=te.to;let B=BS(y,{relative:l}),z=Tr(),K=null;if(f){let F=kd(f,[],z.unstable_mask?z.unstable_mask.pathname:"/",!0);q!=="/"&&(F.pathname=F.pathname==="/"?q:kr([q,F.pathname])),K=L.createHref(F)}let[Q,H,R]=x_(s,S),X=j_(y,{replace:c,unstable_mask:f,state:m,target:d,preventScrollReset:g,relative:l,viewTransition:x,unstable_defaultShouldRevalidate:w,unstable_useTransitions:$});function J(F){n&&n(F),F.defaultPrevented||X(F)}let ae=!(te.isExternal||u),re=N.createElement("a",{...S,...R,href:(ae?K:void 0)||te.absoluteURL||B,onClick:ae?J:n,ref:__(D,H),target:d,"data-discover":!T&&r==="render"?"true":void 0});return Q&&!T?N.createElement(N.Fragment,null,re,N.createElement(v_,{page:B})):re});tx.displayName="Link";var C_=N.forwardRef(function({"aria-current":n="page",caseSensitive:r=!1,className:s="",end:l=!1,style:u,to:c,viewTransition:f,children:m,...d},y){let g=Fl(c,{relative:d.relative}),x=Tr(),w=N.useContext(Iu),{navigator:S,basename:D}=N.useContext(ar),q=w!=null&&D_(g)&&f===!0,L=S.encodeLocation?S.encodeLocation(g).pathname:g.pathname,$=x.pathname,T=w&&w.navigation&&w.navigation.location?w.navigation.location.pathname:null;r||($=$.toLowerCase(),T=T?T.toLowerCase():null,L=L.toLowerCase()),T&&D&&(T=Wr(T,D)||T);const te=L!=="/"&&L.endsWith("/")?L.length-1:L.length;let B=$===L||!l&&$.startsWith(L)&&$.charAt(te)==="/",z=T!=null&&(T===L||!l&&T.startsWith(L)&&T.charAt(L.length)==="/"),K={isActive:B,isPending:z,isTransitioning:q},Q=B?n:void 0,H;typeof s=="function"?H=s(K):H=[s,B?"active":null,z?"pending":null,q?"transitioning":null].filter(Boolean).join(" ");let R=typeof u=="function"?u(K):u;return N.createElement(tx,{...d,"aria-current":Q,className:H,ref:y,style:R,to:c,viewTransition:f},typeof m=="function"?m(K):m)});C_.displayName="NavLink";var A_=N.forwardRef(({discover:e="render",fetcherKey:n,navigate:r,reloadDocument:s,replace:l,state:u,method:c=vu,action:f,onSubmit:m,relative:d,preventScrollReset:y,viewTransition:g,unstable_defaultShouldRevalidate:x,...w},S)=>{let{unstable_useTransitions:D}=N.useContext(ar),q=R_(),L=M_(f,{relative:d}),$=c.toLowerCase()==="get"?"get":"post",T=typeof f=="string"&&ex.test(f),te=B=>{if(m&&m(B),B.defaultPrevented)return;B.preventDefault();let z=B.nativeEvent.submitter,K=(z==null?void 0:z.getAttribute("formmethod"))||c,Q=()=>q(z||B.currentTarget,{fetcherKey:n,method:K,navigate:r,replace:l,state:u,relative:d,preventScrollReset:y,viewTransition:g,unstable_defaultShouldRevalidate:x});D&&r!==!1?N.startTransition(()=>Q()):Q()};return N.createElement("form",{ref:S,method:$,action:L,onSubmit:s?m:te,...w,"data-discover":!T&&e==="render"?"true":void 0})});A_.displayName="Form";function T_(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function nx(e){let n=N.useContext(ba);return Bt(n,T_(e)),n}function j_(e,{target:n,replace:r,unstable_mask:s,state:l,preventScrollReset:u,relative:c,viewTransition:f,unstable_defaultShouldRevalidate:m,unstable_useTransitions:d}={}){let y=ti(),g=Tr(),x=Fl(e,{relative:c});return N.useCallback(w=>{if(a_(w,n)){w.preventDefault();let S=r!==void 0?r:Dl(g)===Dl(x),D=()=>y(e,{replace:S,unstable_mask:s,state:l,preventScrollReset:u,relative:c,viewTransition:f,unstable_defaultShouldRevalidate:m});d?N.startTransition(()=>D()):D()}},[g,y,x,r,s,l,n,e,u,c,f,m,d])}var N_=0,O_=()=>`__${String(++N_)}__`;function R_(){let{router:e}=nx("useSubmit"),{basename:n}=N.useContext(ar),r=KS(),s=e.fetch,l=e.navigate;return N.useCallback(async(u,c={})=>{let{action:f,method:m,encType:d,formData:y,body:g}=u_(u,n);if(c.navigate===!1){let x=c.fetcherKey||O_();await s(x,r,c.action||f,{unstable_defaultShouldRevalidate:c.unstable_defaultShouldRevalidate,preventScrollReset:c.preventScrollReset,formData:y,body:g,formMethod:c.method||m,formEncType:c.encType||d,flushSync:c.flushSync})}else await l(c.action||f,{unstable_defaultShouldRevalidate:c.unstable_defaultShouldRevalidate,preventScrollReset:c.preventScrollReset,formData:y,body:g,formMethod:c.method||m,formEncType:c.encType||d,replace:c.replace,state:c.state,fromRouteId:r,flushSync:c.flushSync,viewTransition:c.viewTransition})},[s,l,n,r])}function M_(e,{relative:n}={}){let{basename:r}=N.useContext(ar),s=N.useContext(Ar);Bt(s,"useFormAction must be used inside a RouteContext");let[l]=s.matches.slice(-1),u={...Fl(e||".",{relative:n})},c=Tr();if(e==null){u.search=c.search;let f=new URLSearchParams(u.search),m=f.getAll("index");if(m.some(y=>y==="")){f.delete("index"),m.filter(g=>g).forEach(g=>f.append("index",g));let y=f.toString();u.search=y?`?${y}`:""}}return(!e||e===".")&&l.route.index&&(u.search=u.search?u.search.replace(/^\?/,"?index&"):"?index"),r!=="/"&&(u.pathname=u.pathname==="/"?r:kr([r,u.pathname])),Dl(u)}function D_(e,{relative:n}={}){let r=N.useContext(Yb);Bt(r!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:s}=nx("useViewTransitionState"),l=Fl(e,{relative:n});if(!r.isTransitioning)return!1;let u=Wr(r.currentLocation.pathname,s)||r.currentLocation.pathname,c=Wr(r.nextLocation.pathname,s)||r.nextLocation.pathname;return ku(l.pathname,c)!=null||ku(l.pathname,u)!=null}var fa=Ub();const rx=N.createContext(null),ix="palmier_paired_hosts",Qh="palmier_active_host";function yh(){try{const e=localStorage.getItem(ix);if(e)return JSON.parse(e)}catch{}return[]}function L_(e){localStorage.setItem(ix,JSON.stringify(e))}function z_(){return localStorage.getItem(Qh)}function U_(e){e?localStorage.setItem(Qh,e):localStorage.removeItem(Qh)}const B_=!!window.__PALMIER_SERVE__&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1");function P_({children:e}){const[n,r]=N.useState(yh),[s,l]=N.useState(()=>{const g=z_(),x=yh();return g&&x.some(w=>w.hostId===g)?g:x.length>0?x[0].hostId:null});N.useEffect(()=>{if(!B_)return;const g="local";if(!yh().find(w=>w.hostId===g)){const w={hostId:g,clientToken:"",directUrl:window.location.origin};r(S=>[...S.filter(D=>D.hostId!==g),w]),l(g)}},[]),N.useEffect(()=>{L_(n)},[n]),N.useEffect(()=>{U_(s)},[s]);const u=N.useCallback(g=>{r(x=>[...x.filter(S=>S.hostId!==g.hostId),g]),l(g.hostId)},[]),c=N.useCallback(g=>{r(x=>x.filter(w=>w.hostId!==g)),l(x=>x!==g?x:null)},[]);N.useEffect(()=>{var g;s!==null&&!n.find(x=>x.hostId===s)?l(((g=n[0])==null?void 0:g.hostId)??null):s===null&&n.length>0&&l(n[0].hostId)},[n,s]);const f=N.useCallback((g,x)=>{r(w=>w.map(S=>S.hostId===g?{...S,name:x}:S))},[]),m=N.useCallback((g,x)=>{r(w=>w.map(S=>S.hostId!==g||S.lanUrl===x?S:{...S,lanUrl:x}))},[]),d=N.useCallback(g=>{l(g)},[]),y=N.useCallback(()=>n.find(g=>g.hostId===s)??null,[n,s]);return b.jsx(rx.Provider,{value:{pairedHosts:n,activeHostId:s,addPairedHost:u,removePairedHost:c,renamePairedHost:f,setHostLanUrl:m,setActiveHostId:d,getActiveHost:y},children:e})}function xa(){const e=N.useContext(rx);if(!e)throw new Error("useHostStore must be used within HostStoreProvider");return e}const Yn=new Uint8Array(0),qi=new TextEncoder,In=new TextDecoder;function q_(...e){let n=0;for(let l=0;l<e.length;l++)n+=e[l].length;const r=new Uint8Array(n);let s=0;for(let l=0;l<e.length;l++)r.set(e[l],s),s+=e[l].length;return r}function Al(...e){const n=[];for(let r=0;r<e.length;r++)n.push(qi.encode(e[r]));return n.length===0?Yn:n.length===1?n[0]:q_(...n)}function l0(e){return!e||e.length===0?"":In.decode(e)}const o0="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ",u0=36,H_=0xcfd41b9100000,c0=33,I_=333,f0=22;function F_(e){for(let n=0;n<e.length;n++)e[n]=Math.floor(Math.random()*255)}function $_(e){var n;(n=globalThis==null?void 0:globalThis.crypto)!=null&&n.getRandomValues?globalThis.crypto.getRandomValues(e):F_(e)}class Y_{constructor(){C(this,"buf");C(this,"seq");C(this,"inc");C(this,"inited");this.buf=new Uint8Array(f0),this.inited=!1}init(){this.inited=!0,this.setPre(),this.initSeqAndInc(),this.fillSeq()}initSeqAndInc(){this.seq=Math.floor(Math.random()*H_),this.inc=Math.floor(Math.random()*(I_-c0)+c0)}setPre(){const n=new Uint8Array(12);$_(n);for(let r=0;r<12;r++){const s=n[r]%36;this.buf[r]=o0.charCodeAt(s)}}fillSeq(){let n=this.seq;for(let r=f0-1;r>=12;r--)this.buf[r]=o0.charCodeAt(n%u0),n=Math.floor(n/u0)}next(){return this.inited||this.init(),this.seq+=this.inc,this.seq>0xcfd41b9100000&&(this.setPre(),this.initSeqAndInc()),this.fillSeq(),String.fromCharCode.apply(String,this.buf)}reset(){this.init()}}const Bi=new Y_;var Kr;(function(e){e.Disconnect="disconnect",e.Reconnect="reconnect",e.Update="update",e.LDM="ldm",e.Error="error"})(Kr||(Kr={}));var ia;(function(e){e.Reconnecting="reconnecting",e.PingTimer="pingTimer",e.StaleConnection="staleConnection",e.ClientInitiatedReconnect="client initiated reconnect"})(ia||(ia={}));var _e;(function(e){e.ApiError="BAD API",e.BadAuthentication="BAD_AUTHENTICATION",e.BadCreds="BAD_CREDS",e.BadHeader="BAD_HEADER",e.BadJson="BAD_JSON",e.BadPayload="BAD_PAYLOAD",e.BadSubject="BAD_SUBJECT",e.Cancelled="CANCELLED",e.ConnectionClosed="CONNECTION_CLOSED",e.ConnectionDraining="CONNECTION_DRAINING",e.ConnectionRefused="CONNECTION_REFUSED",e.ConnectionTimeout="CONNECTION_TIMEOUT",e.Disconnect="DISCONNECT",e.InvalidOption="INVALID_OPTION",e.InvalidPayload="INVALID_PAYLOAD",e.MaxPayloadExceeded="MAX_PAYLOAD_EXCEEDED",e.NoResponders="503",e.NotFunction="NOT_FUNC",e.RequestError="REQUEST_ERROR",e.ServerOptionNotAvailable="SERVER_OPT_NA",e.SubClosed="SUB_CLOSED",e.SubDraining="SUB_DRAINING",e.Timeout="TIMEOUT",e.Tls="TLS",e.Unknown="UNKNOWN_ERROR",e.WssRequired="WSS_REQUIRED",e.JetStreamInvalidAck="JESTREAM_INVALID_ACK",e.JetStream404NoMessages="404",e.JetStream408RequestTimeout="408",e.JetStream409MaxAckPendingExceeded="409",e.JetStream409="409",e.JetStreamNotEnabled="503",e.JetStreamIdleHeartBeat="IDLE_HEARTBEAT",e.AuthorizationViolation="AUTHORIZATION_VIOLATION",e.AuthenticationExpired="AUTHENTICATION_EXPIRED",e.ProtocolError="NATS_PROTOCOL_ERR",e.PermissionsViolation="PERMISSIONS_VIOLATION",e.AuthenticationTimeout="AUTHENTICATION_TIMEOUT",e.AccountExpired="ACCOUNT_EXPIRED"})(_e||(_e={}));function G_(e){return typeof e.code=="string"}class sx{constructor(){C(this,"messages");this.messages=new Map,this.messages.set(_e.InvalidPayload,"Invalid payload type - payloads can be 'binary', 'string', or 'json'"),this.messages.set(_e.BadJson,"Bad JSON"),this.messages.set(_e.WssRequired,"TLS is required, therefore a secure websocket connection is also required")}static getMessage(n){return V_.getMessage(n)}getMessage(n){return this.messages.get(n)||n}}const V_=new sx;class Ne extends Error{constructor(r,s,l){super(r);C(this,"name");C(this,"message");C(this,"code");C(this,"permissionContext");C(this,"chainedError");C(this,"api_error");this.name="NatsError",this.message=r,this.code=s,this.chainedError=l}static errorForCode(r,s){const l=sx.getMessage(r);return new Ne(l,r,s)}isAuthError(){return this.code===_e.AuthenticationExpired||this.code===_e.AuthorizationViolation||this.code===_e.AccountExpired}isAuthTimeout(){return this.code===_e.AuthenticationTimeout}isPermissionError(){return this.code===_e.PermissionsViolation}isProtocolError(){return this.code===_e.ProtocolError}isJetStreamError(){return this.api_error!==void 0}jsError(){return this.api_error?this.api_error:null}}var qn;(function(e){e[e.Exact=0]="Exact",e[e.CanonicalMIME=1]="CanonicalMIME",e[e.IgnoreCase=2]="IgnoreCase"})(qn||(qn={}));var mr;(function(e){e.Timer="timer",e.Count="count",e.JitterTimer="jitterTimer",e.SentinelMsg="sentinelMsg"})(mr||(mr={}));var Tl;(function(e){e.STATS="io.nats.micro.v1.stats_response",e.INFO="io.nats.micro.v1.info_response",e.PING="io.nats.micro.v1.ping_response"})(Tl||(Tl={}));const Cu="Nats-Service-Error",Au="Nats-Service-Error-Code";class Tu extends Error{constructor(r,s){super(s);C(this,"code");this.code=r}static isServiceError(r){return Tu.toServiceError(r)!==null}static toServiceError(r){var l,u;const s=((l=r==null?void 0:r.headers)==null?void 0:l.get(Au))||"";if(s!==""){const c=parseInt(s)||400,f=((u=r==null?void 0:r.headers)==null?void 0:u.get(Cu))||"";return new Tu(c,f.length?f:s)}return null}}function Zr(e=""){if(e=e||"_INBOX",typeof e!="string")throw new Error("prefix must be a string");return e.split(".").forEach(n=>{if(n==="*"||n===">")throw new Error(`inbox prefixes cannot have wildcards '${e}'`)}),`${e}.${Bi.next()}`}const Zh="127.0.0.1";var Li;(function(e){e.PING="PING",e.STATS="STATS",e.INFO="INFO"})(Li||(Li={}));function $u(e,...n){for(let r=0;r<n.length;r++){const s=n[r];Object.keys(s).forEach(function(l){e[l]=s[l]})}return e}function cu(e){return In.decode(e).replace(/\n/g,"␊").replace(/\r/g,"␍")}function ha(e,n=!0){const r=n?Ne.errorForCode(_e.Timeout):null;let s,l;const u=new Promise((c,f)=>{s={cancel:()=>{l&&clearTimeout(l)}},l=setTimeout(()=>{f(r===null?Ne.errorForCode(_e.Timeout):r)},e)});return Object.assign(u,s)}function va(e=0){let n;const r=new Promise(s=>{const l=setTimeout(()=>{s()},e);n={cancel:()=>{l&&clearTimeout(l)}}});return Object.assign(r,n)}function zt(){let e={};const n=new Promise((r,s)=>{e={resolve:r,reject:s}});return Object.assign(n,e)}function ax(e){for(let n=e.length-1;n>0;n--){const r=Math.floor(Math.random()*(n+1));[e[n],e[r]]=[e[r],e[n]]}return e}function J_(e){return e===0?0:Math.floor(e/2+Math.random()*e)}function Od(e=[0,250,250,500,500,3e3,5e3]){Array.isArray(e)||(e=[0,250,250,500,500,3e3,5e3]);const n=e.length-1;return{backoff(r){return J_(r>n?e[n]:e[r])}}}function Lt(e){return e*1e6}function Rd(e){return Math.floor(e/1e6)}function h0(e){let s=!0;const l=new Array(e.length);for(let u=0;u<e.length;u++){let c=e.charCodeAt(u);if(c===58||c<33||c>126)throw new Ne(`'${e[u]}' is not a valid character for a header key`,_e.BadHeader);s&&97<=c&&c<=122?c-=32:!s&&65<=c&&c<=90&&(c+=32),l[u]=c,s=c==45}return String.fromCharCode(...l)}function ei(e=0,n=""){if(e===0&&n!==""||e>0&&n==="")throw new Error("setting status requires both code and description");return new zi(e,n)}const bh="NATS/1.0";class zi{constructor(n=0,r=""){C(this,"_code");C(this,"headers");C(this,"_description");this._code=n,this._description=r,this.headers=new Map}[Symbol.iterator](){return this.headers.entries()}size(){return this.headers.size}equals(n){if(n&&this.headers.size===n.headers.size&&this._code===n._code){for(const[r,s]of this.headers){const l=n.values(r);if(s.length!==l.length)return!1;const u=[...s].sort(),c=[...l].sort();for(let f=0;f<u.length;f++)if(u[f]!==c[f])return!1}return!0}return!1}static decode(n){const r=new zi,l=In.decode(n).split(`\r
61
+ `),u=l[0];if(u!==bh){let c=u.replace(bh,"").trim();if(c.length>0){r._code=parseInt(c,10),isNaN(r._code)&&(r._code=0);const f=r._code.toString();c=c.replace(f,""),r._description=c.trim()}}return l.length>=1&&l.slice(1).map(c=>{if(c){const f=c.indexOf(":");if(f>-1){const m=c.slice(0,f),d=c.slice(f+1).trim();r.append(m,d)}}}),r}toString(){if(this.headers.size===0&&this._code===0)return"";let n=bh;this._code>0&&this._description!==""&&(n+=` ${this._code} ${this._description}`);for(const[r,s]of this.headers)for(let l=0;l<s.length;l++)n=`${n}\r
62
+ ${r}: ${s[l]}`;return`${n}\r
63
+ \r
64
+ `}encode(){return qi.encode(this.toString())}static validHeaderValue(n){if(/[\r\n]/.test(n))throw new Ne("invalid header value - \\r and \\n are not allowed.",_e.BadHeader);return n.trim()}keys(){const n=[];for(const r of this.headers.keys())n.push(r);return n}findKeys(n,r=qn.Exact){const s=this.keys();switch(r){case qn.Exact:return s.filter(l=>l===n);case qn.CanonicalMIME:return n=h0(n),s.filter(l=>l===n);default:{const l=n.toLowerCase();return s.filter(u=>l===u.toLowerCase())}}}get(n,r=qn.Exact){const s=this.findKeys(n,r);if(s.length){const l=this.headers.get(s[0]);if(l)return Array.isArray(l)?l[0]:l}return""}last(n,r=qn.Exact){const s=this.findKeys(n,r);if(s.length){const l=this.headers.get(s[0]);if(l)return Array.isArray(l)?l[l.length-1]:l}return""}has(n,r=qn.Exact){return this.findKeys(n,r).length>0}set(n,r,s=qn.Exact){this.delete(n,s),this.append(n,r,s)}append(n,r,s=qn.Exact){const l=h0(n);s===qn.CanonicalMIME&&(n=l);const u=this.findKeys(n,s);n=u.length>0?u[0]:n;const c=zi.validHeaderValue(r);let f=this.headers.get(n);f||(f=[],this.headers.set(n,f)),f.push(c)}values(n,r=qn.Exact){const s=[];return this.findKeys(n,r).forEach(u=>{const c=this.headers.get(u);c&&s.push(...c)}),s}delete(n,r=qn.Exact){this.findKeys(n,r).forEach(l=>{this.headers.delete(l)})}get hasError(){return this._code>=300}get status(){return`${this._code} ${this._description}`.trim()}toRecord(){const n={};return this.keys().forEach(r=>{n[r]=this.values(r)}),n}get code(){return this._code}get description(){return this._description}static fromRecord(n){const r=new zi;for(const s in n)r.headers.set(s,n[s]);return r}}function ju(){return{encode(e){return qi.encode(e)},decode(e){return In.decode(e)}}}function pr(e){return{encode(n){try{return n===void 0&&(n=null),qi.encode(JSON.stringify(n))}catch(r){throw Ne.errorForCode(_e.BadJson,r)}},decode(n){try{return JSON.parse(In.decode(n),e)}catch(r){throw Ne.errorForCode(_e.BadJson,r)}}}}function lx(e){var n;return e&&e.data.length===0&&((n=e.headers)==null?void 0:n.code)===503?Ne.errorForCode(_e.NoResponders):null}class Md{constructor(n,r,s){C(this,"_headers");C(this,"_msg");C(this,"_rdata");C(this,"_reply");C(this,"_subject");C(this,"publisher");this._msg=n,this._rdata=r,this.publisher=s}get subject(){return this._subject?this._subject:(this._subject=In.decode(this._msg.subject),this._subject)}get reply(){return this._reply?this._reply:(this._reply=In.decode(this._msg.reply),this._reply)}get sid(){return this._msg.sid}get headers(){if(this._msg.hdr>-1&&!this._headers){const n=this._rdata.subarray(0,this._msg.hdr);this._headers=zi.decode(n)}return this._headers}get data(){return this._rdata?this._msg.hdr>-1?this._rdata.subarray(this._msg.hdr):this._rdata:new Uint8Array(0)}respond(n=Yn,r){return this.reply?(this.publisher.publish(this.reply,n,r),!0):!1}size(){var l;const n=this._msg.subject.length,r=((l=this._msg.reply)==null?void 0:l.length)||0,s=this._msg.size===-1?0:this._msg.size;return n+r+s}json(n){return pr(n).decode(this.data)}string(){return In.decode(this.data)}requestInfo(){var r;const n=(r=this.headers)==null?void 0:r.get("Nats-Request-Info");return n?JSON.parse(n,function(s,l){return(s==="start"||s==="stop")&&l!==""?new Date(Date.parse(l)):l}):null}}C(Md,"jc");function sa(e){return Yu("durable",e)}function mn(e){return Yu("stream",e)}function Yu(e,n=""){if(n==="")throw Error(`${e} name required`);return[".","*",">","/","\\"," "," ",`
65
+ `,"\r"].forEach(s=>{if(n.indexOf(s)!==-1){switch(s){case`
66
+ `:s="\\n";break;case"\r":s="\\r";break;case" ":s="\\t";break}throw Error(`invalid ${e} name - ${e} name cannot contain '${s}'`)}}),""}function kl(e,n=""){if(n==="")throw Error(`${e} name required`);const r=X_(n);if(r.length)throw new Error(`invalid ${e} name - ${e} name ${r}`)}function X_(e=""){if(e==="")throw Error("name required");const n=/^[-\w]+$/g;if(e.match(n)===null){for(const s of e.split(""))if(s.match(n)===null)return`cannot contain '${s}'`}return""}function Wh(e){if(e.data.length>0)return!1;const n=e.headers;return n?n.code>=100&&n.code<200:!1}function ed(e){var n;return Wh(e)&&((n=e.headers)==null?void 0:n.description)==="Idle Heartbeat"}function K_(e,n,r){const s=ei(e,n),l={hdr:1,sid:0,size:0},u=new Md(l,Yn,{});return u._headers=s,u._subject=r,u}function aa(e){if(e.data.length!==0)return null;const n=e.headers;return n?ox(n.code,n.description):null}var ir;(function(e){e.MaxBatchExceeded="exceeded maxrequestbatch of",e.MaxExpiresExceeded="exceeded maxrequestexpires of",e.MaxBytesExceeded="exceeded maxrequestmaxbytes of",e.MaxMessageSizeExceeded="message size exceeds maxbytes",e.PushConsumer="consumer is push based",e.MaxWaitingExceeded="exceeded maxwaiting",e.IdleHeartbeatMissed="idle heartbeats missed",e.ConsumerDeleted="consumer deleted"})(ir||(ir={}));function Q_(e){return e.code!==_e.JetStream409?!1:[ir.MaxBatchExceeded,ir.MaxExpiresExceeded,ir.MaxBytesExceeded,ir.MaxMessageSizeExceeded,ir.PushConsumer,ir.IdleHeartbeatMissed,ir.ConsumerDeleted].find(r=>e.message.indexOf(r)!==-1)!==void 0}function ox(e,n=""){if(e<300)return null;switch(n=n.toLowerCase(),e){case 404:return new Ne(n,_e.JetStream404NoMessages);case 408:return new Ne(n,_e.JetStream408RequestTimeout);case 409:{const r=n.startsWith(ir.IdleHeartbeatMissed)?_e.JetStreamIdleHeartBeat:_e.JetStream409;return new Ne(n,r)}case 503:return Ne.errorForCode(_e.JetStreamNotEnabled,new Error(n));default:return n===""&&(n=_e.Unknown),new Ne(n,`${e}`)}}class nn{constructor(){C(this,"inflight");C(this,"processed");C(this,"received");C(this,"noIterator");C(this,"iterClosed");C(this,"done");C(this,"signal");C(this,"yields");C(this,"filtered");C(this,"pendingFiltered");C(this,"ingestionFilterFn");C(this,"protocolFilterFn");C(this,"dispatchedFn");C(this,"ctx");C(this,"_data");C(this,"err");C(this,"time");C(this,"yielding");this.inflight=0,this.filtered=0,this.pendingFiltered=0,this.processed=0,this.received=0,this.noIterator=!1,this.done=!1,this.signal=zt(),this.yields=[],this.iterClosed=zt(),this.time=0,this.yielding=!1}[Symbol.asyncIterator](){return this.iterate()}push(n){if(this.done)return;if(typeof n=="function"){this.yields.push(n),this.signal.resolve();return}const{ingest:r,protocol:s}=this.ingestionFilterFn?this.ingestionFilterFn(n,this.ctx||this):{ingest:!0,protocol:!1};r&&(s&&(this.filtered++,this.pendingFiltered++),this.yields.push(n),this.signal.resolve())}async*iterate(){if(this.noIterator)throw new Ne("unsupported iterator",_e.ApiError);if(this.yielding)throw new Ne("already yielding",_e.ApiError);this.yielding=!0;try{for(;;){if(this.yields.length===0&&await this.signal,this.err)throw this.err;const n=this.yields;this.inflight=n.length,this.yields=[];for(let r=0;r<n.length;r++){if(typeof n[r]=="function"){const l=n[r];try{l()}catch(u){throw u}if(this.err)throw this.err;continue}if(this.protocolFilterFn?this.protocolFilterFn(n[r]):!0){this.processed++;const l=Date.now();yield n[r],this.time=Date.now()-l,this.dispatchedFn&&n[r]&&this.dispatchedFn(n[r])}else this.pendingFiltered--;this.inflight--}if(this.done)break;this.yields.length===0&&(n.length=0,this.yields=n,this.signal=zt())}}finally{this.stop()}}stop(n){this.done||(this.err=n,this.done=!0,this.signal.resolve(),this.iterClosed.resolve(n))}getProcessed(){return this.noIterator?this.received:this.processed}getPending(){return this.yields.length+this.inflight-this.pendingFiltered}getReceived(){return this.received-this.filtered}}class Dd{constructor(n,r,s={maxOut:2}){C(this,"interval");C(this,"maxOut");C(this,"cancelAfter");C(this,"timer");C(this,"autoCancelTimer");C(this,"last");C(this,"missed");C(this,"count");C(this,"callback");this.interval=n,this.maxOut=(s==null?void 0:s.maxOut)||2,this.cancelAfter=(s==null?void 0:s.cancelAfter)||0,this.last=Date.now(),this.missed=0,this.count=0,this.callback=r,this._schedule()}cancel(){this.autoCancelTimer&&clearTimeout(this.autoCancelTimer),this.timer&&clearInterval(this.timer),this.timer=0,this.autoCancelTimer=0,this.missed=0}work(){this.last=Date.now(),this.missed=0}_change(n,r=0,s=2){this.interval=n,this.maxOut=s,this.cancelAfter=r,this.restart()}restart(){this.cancel(),this._schedule()}_schedule(){this.cancelAfter>0&&(this.autoCancelTimer=setTimeout(()=>{this.cancel()},this.cancelAfter)),this.timer=setInterval(()=>{if(this.count++,Date.now()-this.last>this.interval&&this.missed++,this.missed>=this.maxOut)try{this.callback(this.missed)===!0&&this.cancel()}catch(n){console.log(n)}},this.interval)}}var td;(function(e){e.Limits="limits",e.Interest="interest",e.Workqueue="workqueue"})(td||(td={}));var Ll;(function(e){e.Old="old",e.New="new"})(Ll||(Ll={}));var nd;(function(e){e.File="file",e.Memory="memory"})(nd||(nd={}));var Yt;(function(e){e.All="all",e.Last="last",e.New="new",e.StartSequence="by_start_sequence",e.StartTime="by_start_time",e.LastPerSubject="last_per_subject"})(Yt||(Yt={}));var tn;(function(e){e.None="none",e.All="all",e.Explicit="explicit",e.NotSet=""})(tn||(tn={}));var da;(function(e){e.Instant="instant",e.Original="original"})(da||(da={}));var Pi;(function(e){e.None="none",e.S2="s2"})(Pi||(Pi={}));var Nu;(function(e){e.CreateOrUpdate="",e.Update="update",e.Create="create"})(Nu||(Nu={}));function Z_(e,n={}){return Object.assign({name:e,deliver_policy:Yt.All,ack_policy:tn.Explicit,ack_wait:Lt(30*1e3),replay_policy:da.Instant},n)}var d0;(function(e){e.API="api_audit",e.StreamAction="stream_action",e.ConsumerAction="consumer_action",e.SnapshotCreate="snapshot_create",e.SnapshotComplete="snapshot_complete",e.RestoreCreate="restore_create",e.RestoreComplete="restore_complete",e.MaxDeliver="max_deliver",e.Terminated="terminated",e.Ack="consumer_ack",e.StreamLeaderElected="stream_leader_elected",e.StreamQuorumLost="stream_quorum_lost",e.ConsumerLeaderElected="consumer_leader_elected",e.ConsumerQuorumLost="consumer_quorum_lost"})(d0||(d0={}));var bn;(function(e){e.StreamSourceHdr="Nats-Stream-Source",e.LastConsumerSeqHdr="Nats-Last-Consumer",e.LastStreamSeqHdr="Nats-Last-Stream",e.ConsumerStalledHdr="Nats-Consumer-Stalled",e.MessageSizeHdr="Nats-Msg-Size",e.RollupHdr="Nats-Rollup",e.RollupValueSubject="sub",e.RollupValueAll="all",e.PendingMessagesHdr="Nats-Pending-Messages",e.PendingBytesHdr="Nats-Pending-Bytes"})(bn||(bn={}));var dr;(function(e){e.LastValue="",e.AllHistory="history",e.UpdatesOnly="updates"})(dr||(dr={}));var na;(function(e){e.Stream="Nats-Stream",e.Sequence="Nats-Sequence",e.TimeStamp="Nats-Time-Stamp",e.Subject="Nats-Subject"})(na||(na={}));var m0;(function(e){e.Stream="Nats-Stream",e.Subject="Nats-Subject",e.Sequence="Nats-Sequence",e.LastSequence="Nats-Last-Sequence",e.Size="Nats-Msg-Size"})(m0||(m0={}));const Hn="KV_";class W_{constructor(n){C(this,"config");C(this,"ordered");C(this,"mack");C(this,"stream");C(this,"callbackFn");C(this,"max");C(this,"qname");C(this,"isBind");C(this,"filters");this.stream="",this.mack=!1,this.ordered=!1,this.config=Z_("",n||{})}getOpts(){var r;const n={};if(n.config=Object.assign({},this.config),n.config.filter_subject&&(this.filterSubject(n.config.filter_subject),n.config.filter_subject=void 0),n.config.filter_subjects&&((r=n.config.filter_subjects)==null||r.forEach(s=>{this.filterSubject(s)}),n.config.filter_subjects=void 0),n.mack=this.mack,n.stream=this.stream,n.callbackFn=this.callbackFn,n.max=this.max,n.queue=this.qname,n.ordered=this.ordered,n.config.ack_policy=n.ordered?tn.None:n.config.ack_policy,n.isBind=n.isBind||!1,this.filters)switch(this.filters.length){case 0:break;case 1:n.config.filter_subject=this.filters[0];break;default:n.config.filter_subjects=this.filters}return n}description(n){return this.config.description=n,this}deliverTo(n){return this.config.deliver_subject=n,this}durable(n){return sa(n),this.config.durable_name=n,this}startSequence(n){if(n<=0)throw new Error("sequence must be greater than 0");return this.config.deliver_policy=Yt.StartSequence,this.config.opt_start_seq=n,this}startTime(n){return this.config.deliver_policy=Yt.StartTime,this.config.opt_start_time=n.toISOString(),this}deliverAll(){return this.config.deliver_policy=Yt.All,this}deliverLastPerSubject(){return this.config.deliver_policy=Yt.LastPerSubject,this}deliverLast(){return this.config.deliver_policy=Yt.Last,this}deliverNew(){return this.config.deliver_policy=Yt.New,this}startAtTimeDelta(n){return this.startTime(new Date(Date.now()-n)),this}headersOnly(){return this.config.headers_only=!0,this}ackNone(){return this.config.ack_policy=tn.None,this}ackAll(){return this.config.ack_policy=tn.All,this}ackExplicit(){return this.config.ack_policy=tn.Explicit,this}ackWait(n){return this.config.ack_wait=Lt(n),this}maxDeliver(n){return this.config.max_deliver=n,this}filterSubject(n){return this.filters=this.filters||[],this.filters.push(n),this}replayInstantly(){return this.config.replay_policy=da.Instant,this}replayOriginal(){return this.config.replay_policy=da.Original,this}sample(n){if(n=Math.trunc(n),n<0||n>100)throw new Error("value must be between 0-100");return this.config.sample_freq=`${n}%`,this}limit(n){return this.config.rate_limit_bps=n,this}maxWaiting(n){return this.config.max_waiting=n,this}maxAckPending(n){return this.config.max_ack_pending=n,this}idleHeartbeat(n){return this.config.idle_heartbeat=Lt(n),this}flowControl(){return this.config.flow_control=!0,this}deliverGroup(n){return this.queue(n),this}manualAck(){return this.mack=!0,this}maxMessages(n){return this.max=n,this}callback(n){return this.callbackFn=n,this}queue(n){return this.qname=n,this.config.deliver_group=n,this}orderedConsumer(){return this.ordered=!0,this}bind(n,r){return this.stream=n,this.config.durable_name=r,this.isBind=!0,this}bindStream(n){return this.stream=n,this}inactiveEphemeralThreshold(n){return this.config.inactive_threshold=Lt(n),this}maxPullBatch(n){return this.config.max_batch=n,this}maxPullRequestExpires(n){return this.config.max_expires=Lt(n),this}memory(){return this.config.mem_storage=!0,this}numReplicas(n){return this.config.num_replicas=n,this}consumerName(n){return this.config.name=n,this}}function Ui(e){return new W_(e)}function p0(e){return typeof e.getOpts=="function"}class e2{static encode(n){if(typeof n=="string")return btoa(n);const r=Array.from(n);return btoa(String.fromCharCode(...r))}static decode(n,r=!1){const s=atob(n);return r?Uint8Array.from(s,l=>l.charCodeAt(0)):s}}class la{static encode(n){return la.toB64URLEncoding(e2.encode(n))}static decode(n,r=!1){return la.decode(la.fromB64URLEncoding(n),r)}static toB64URLEncoding(n){return n.replace(/\+/g,"-").replace(/\//g,"_")}static fromB64URLEncoding(n){return n.replace(/_/g,"/").replace(/-/g,"+")}}class ma{constructor(){C(this,"buffers");C(this,"byteLength");this.buffers=[],this.byteLength=0}static concat(...n){let r=0;for(let u=0;u<n.length;u++)r+=n[u].length;const s=new Uint8Array(r);let l=0;for(let u=0;u<n.length;u++)s.set(n[u],l),l+=n[u].length;return s}static fromAscii(n){return n||(n=""),qi.encode(n)}static toAscii(n){return In.decode(n)}reset(){this.buffers.length=0,this.byteLength=0}pack(){if(this.buffers.length>1){const n=new Uint8Array(this.byteLength);let r=0;for(let s=0;s<this.buffers.length;s++)n.set(this.buffers[s],r),r+=this.buffers[s].length;this.buffers.length=0,this.buffers.push(n)}}shift(){if(this.buffers.length){const n=this.buffers.shift();if(n)return this.byteLength-=n.length,n}return new Uint8Array(0)}drain(n){if(this.buffers.length){this.pack();const r=this.buffers.pop();if(r){const s=this.byteLength;(n===void 0||n>s)&&(n=s);const l=r.subarray(0,n);return s>n&&this.buffers.push(r.subarray(n)),this.byteLength=s-n,l}}return new Uint8Array(0)}fill(n,...r){n&&(this.buffers.push(n),this.byteLength+=n.length);for(let s=0;s<r.length;s++)r[s]&&r[s].length&&(this.buffers.push(r[s]),this.byteLength+=r[s].length)}peek(){return this.buffers.length?(this.pack(),this.buffers[0]):new Uint8Array(0)}size(){return this.byteLength}length(){return this.buffers.length}}function t2(e,n){return n.forEach(function(r){r&&typeof r!="string"&&!Array.isArray(r)&&Object.keys(r).forEach(function(s){if(s!=="default"&&!(s in e)){var l=Object.getOwnPropertyDescriptor(r,s);Object.defineProperty(e,s,l.get?l:{enumerable:!0,get:function(){return r[s]}})}})}),Object.freeze(e)}var n2=typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{},yl=n2.performance||{};yl.now||yl.mozNow||yl.msNow||yl.oNow||yl.webkitNow;var g0={versions:{}},r2=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function i2(e){if(e.__esModule)return e;var n=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(e).forEach(function(r){var s=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,s.get?s:{enumerable:!0,get:function(){return e[r]}})}),n}var xh,Gu={exports:{}},y0={},b0=i2(t2({__proto__:null,default:y0},[y0]));xh=Gu,(function(){var e="input is invalid type",n=typeof window=="object",r=n?window:{};r.JS_SHA256_NO_WINDOW&&(n=!1);var s=!n&&typeof self=="object",l=!r.JS_SHA256_NO_NODE_JS&&g0.versions&&g0.versions.node;l?r=r2:s&&(r=self);var u=!r.JS_SHA256_NO_COMMON_JS&&xh.exports,c=!r.JS_SHA256_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",f="0123456789abcdef".split(""),m=[-2147483648,8388608,32768,128],d=[24,16,8,0],y=[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],g=["hex","array","digest","arrayBuffer"],x=[];!r.JS_SHA256_NO_NODE_JS&&Array.isArray||(Array.isArray=function(B){return Object.prototype.toString.call(B)==="[object Array]"}),!c||!r.JS_SHA256_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(B){return typeof B=="object"&&B.buffer&&B.buffer.constructor===ArrayBuffer});var w=function(B,z){return function(K){return new $(z,!0).update(K)[B]()}},S=function(B){var z=w("hex",B);l&&(z=D(z,B)),z.create=function(){return new $(B)},z.update=function(H){return z.create().update(H)};for(var K=0;K<g.length;++K){var Q=g[K];z[Q]=w(Q,B)}return z},D=function(B,z){var K,Q=b0,H=b0.Buffer,R=z?"sha224":"sha256";return K=H.from&&!r.JS_SHA256_NO_BUFFER_FROM?H.from:function(X){return new H(X)},function(X){if(typeof X=="string")return Q.createHash(R).update(X,"utf8").digest("hex");if(X==null)throw new Error(e);return X.constructor===ArrayBuffer&&(X=new Uint8Array(X)),Array.isArray(X)||ArrayBuffer.isView(X)||X.constructor===H?Q.createHash(R).update(K(X)).digest("hex"):B(X)}},q=function(B,z){return function(K,Q){return new T(K,z,!0).update(Q)[B]()}},L=function(B){var z=q("hex",B);z.create=function(H){return new T(H,B)},z.update=function(H,R){return z.create(H).update(R)};for(var K=0;K<g.length;++K){var Q=g[K];z[Q]=q(Q,B)}return z};function $(B,z){z?(x[0]=x[16]=x[1]=x[2]=x[3]=x[4]=x[5]=x[6]=x[7]=x[8]=x[9]=x[10]=x[11]=x[12]=x[13]=x[14]=x[15]=0,this.blocks=x):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],B?(this.h0=3238371032,this.h1=914150663,this.h2=812702999,this.h3=4144912697,this.h4=4290775857,this.h5=1750603025,this.h6=1694076839,this.h7=3204075428):(this.h0=1779033703,this.h1=3144134277,this.h2=1013904242,this.h3=2773480762,this.h4=1359893119,this.h5=2600822924,this.h6=528734635,this.h7=1541459225),this.block=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0,this.is224=B}function T(B,z,K){var Q,H=typeof B;if(H==="string"){var R,X=[],J=B.length,ae=0;for(Q=0;Q<J;++Q)(R=B.charCodeAt(Q))<128?X[ae++]=R:R<2048?(X[ae++]=192|R>>>6,X[ae++]=128|63&R):R<55296||R>=57344?(X[ae++]=224|R>>>12,X[ae++]=128|R>>>6&63,X[ae++]=128|63&R):(R=65536+((1023&R)<<10|1023&B.charCodeAt(++Q)),X[ae++]=240|R>>>18,X[ae++]=128|R>>>12&63,X[ae++]=128|R>>>6&63,X[ae++]=128|63&R);B=X}else{if(H!=="object")throw new Error(e);if(B===null)throw new Error(e);if(c&&B.constructor===ArrayBuffer)B=new Uint8Array(B);else if(!(Array.isArray(B)||c&&ArrayBuffer.isView(B)))throw new Error(e)}B.length>64&&(B=new $(z,!0).update(B).array());var re=[],F=[];for(Q=0;Q<64;++Q){var P=B[Q]||0;re[Q]=92^P,F[Q]=54^P}$.call(this,z,K),this.update(F),this.oKeyPad=re,this.inner=!0,this.sharedMemory=K}$.prototype.update=function(B){if(!this.finalized){var z,K=typeof B;if(K!=="string"){if(K!=="object")throw new Error(e);if(B===null)throw new Error(e);if(c&&B.constructor===ArrayBuffer)B=new Uint8Array(B);else if(!(Array.isArray(B)||c&&ArrayBuffer.isView(B)))throw new Error(e);z=!0}for(var Q,H,R=0,X=B.length,J=this.blocks;R<X;){if(this.hashed&&(this.hashed=!1,J[0]=this.block,this.block=J[16]=J[1]=J[2]=J[3]=J[4]=J[5]=J[6]=J[7]=J[8]=J[9]=J[10]=J[11]=J[12]=J[13]=J[14]=J[15]=0),z)for(H=this.start;R<X&&H<64;++R)J[H>>>2]|=B[R]<<d[3&H++];else for(H=this.start;R<X&&H<64;++R)(Q=B.charCodeAt(R))<128?J[H>>>2]|=Q<<d[3&H++]:Q<2048?(J[H>>>2]|=(192|Q>>>6)<<d[3&H++],J[H>>>2]|=(128|63&Q)<<d[3&H++]):Q<55296||Q>=57344?(J[H>>>2]|=(224|Q>>>12)<<d[3&H++],J[H>>>2]|=(128|Q>>>6&63)<<d[3&H++],J[H>>>2]|=(128|63&Q)<<d[3&H++]):(Q=65536+((1023&Q)<<10|1023&B.charCodeAt(++R)),J[H>>>2]|=(240|Q>>>18)<<d[3&H++],J[H>>>2]|=(128|Q>>>12&63)<<d[3&H++],J[H>>>2]|=(128|Q>>>6&63)<<d[3&H++],J[H>>>2]|=(128|63&Q)<<d[3&H++]);this.lastByteIndex=H,this.bytes+=H-this.start,H>=64?(this.block=J[16],this.start=H-64,this.hash(),this.hashed=!0):this.start=H}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296|0,this.bytes=this.bytes%4294967296),this}},$.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var B=this.blocks,z=this.lastByteIndex;B[16]=this.block,B[z>>>2]|=m[3&z],this.block=B[16],z>=56&&(this.hashed||this.hash(),B[0]=this.block,B[16]=B[1]=B[2]=B[3]=B[4]=B[5]=B[6]=B[7]=B[8]=B[9]=B[10]=B[11]=B[12]=B[13]=B[14]=B[15]=0),B[14]=this.hBytes<<3|this.bytes>>>29,B[15]=this.bytes<<3,this.hash()}},$.prototype.hash=function(){var B,z,K,Q,H,R,X,J,ae,re=this.h0,F=this.h1,P=this.h2,V=this.h3,ue=this.h4,xe=this.h5,_=this.h6,M=this.h7,W=this.blocks;for(B=16;B<64;++B)z=((H=W[B-15])>>>7|H<<25)^(H>>>18|H<<14)^H>>>3,K=((H=W[B-2])>>>17|H<<15)^(H>>>19|H<<13)^H>>>10,W[B]=W[B-16]+z+W[B-7]+K|0;for(ae=F&P,B=0;B<64;B+=4)this.first?(this.is224?(R=300032,M=(H=W[0]-1413257819)-150054599|0,V=H+24177077|0):(R=704751109,M=(H=W[0]-210244248)-1521486534|0,V=H+143694565|0),this.first=!1):(z=(re>>>2|re<<30)^(re>>>13|re<<19)^(re>>>22|re<<10),Q=(R=re&F)^re&P^ae,M=V+(H=M+(K=(ue>>>6|ue<<26)^(ue>>>11|ue<<21)^(ue>>>25|ue<<7))+(ue&xe^~ue&_)+y[B]+W[B])|0,V=H+(z+Q)|0),z=(V>>>2|V<<30)^(V>>>13|V<<19)^(V>>>22|V<<10),Q=(X=V&re)^V&F^R,_=P+(H=_+(K=(M>>>6|M<<26)^(M>>>11|M<<21)^(M>>>25|M<<7))+(M&ue^~M&xe)+y[B+1]+W[B+1])|0,z=((P=H+(z+Q)|0)>>>2|P<<30)^(P>>>13|P<<19)^(P>>>22|P<<10),Q=(J=P&V)^P&re^X,xe=F+(H=xe+(K=(_>>>6|_<<26)^(_>>>11|_<<21)^(_>>>25|_<<7))+(_&M^~_&ue)+y[B+2]+W[B+2])|0,z=((F=H+(z+Q)|0)>>>2|F<<30)^(F>>>13|F<<19)^(F>>>22|F<<10),Q=(ae=F&P)^F&V^J,ue=re+(H=ue+(K=(xe>>>6|xe<<26)^(xe>>>11|xe<<21)^(xe>>>25|xe<<7))+(xe&_^~xe&M)+y[B+3]+W[B+3])|0,re=H+(z+Q)|0,this.chromeBugWorkAround=!0;this.h0=this.h0+re|0,this.h1=this.h1+F|0,this.h2=this.h2+P|0,this.h3=this.h3+V|0,this.h4=this.h4+ue|0,this.h5=this.h5+xe|0,this.h6=this.h6+_|0,this.h7=this.h7+M|0},$.prototype.hex=function(){this.finalize();var B=this.h0,z=this.h1,K=this.h2,Q=this.h3,H=this.h4,R=this.h5,X=this.h6,J=this.h7,ae=f[B>>>28&15]+f[B>>>24&15]+f[B>>>20&15]+f[B>>>16&15]+f[B>>>12&15]+f[B>>>8&15]+f[B>>>4&15]+f[15&B]+f[z>>>28&15]+f[z>>>24&15]+f[z>>>20&15]+f[z>>>16&15]+f[z>>>12&15]+f[z>>>8&15]+f[z>>>4&15]+f[15&z]+f[K>>>28&15]+f[K>>>24&15]+f[K>>>20&15]+f[K>>>16&15]+f[K>>>12&15]+f[K>>>8&15]+f[K>>>4&15]+f[15&K]+f[Q>>>28&15]+f[Q>>>24&15]+f[Q>>>20&15]+f[Q>>>16&15]+f[Q>>>12&15]+f[Q>>>8&15]+f[Q>>>4&15]+f[15&Q]+f[H>>>28&15]+f[H>>>24&15]+f[H>>>20&15]+f[H>>>16&15]+f[H>>>12&15]+f[H>>>8&15]+f[H>>>4&15]+f[15&H]+f[R>>>28&15]+f[R>>>24&15]+f[R>>>20&15]+f[R>>>16&15]+f[R>>>12&15]+f[R>>>8&15]+f[R>>>4&15]+f[15&R]+f[X>>>28&15]+f[X>>>24&15]+f[X>>>20&15]+f[X>>>16&15]+f[X>>>12&15]+f[X>>>8&15]+f[X>>>4&15]+f[15&X];return this.is224||(ae+=f[J>>>28&15]+f[J>>>24&15]+f[J>>>20&15]+f[J>>>16&15]+f[J>>>12&15]+f[J>>>8&15]+f[J>>>4&15]+f[15&J]),ae},$.prototype.toString=$.prototype.hex,$.prototype.digest=function(){this.finalize();var B=this.h0,z=this.h1,K=this.h2,Q=this.h3,H=this.h4,R=this.h5,X=this.h6,J=this.h7,ae=[B>>>24&255,B>>>16&255,B>>>8&255,255&B,z>>>24&255,z>>>16&255,z>>>8&255,255&z,K>>>24&255,K>>>16&255,K>>>8&255,255&K,Q>>>24&255,Q>>>16&255,Q>>>8&255,255&Q,H>>>24&255,H>>>16&255,H>>>8&255,255&H,R>>>24&255,R>>>16&255,R>>>8&255,255&R,X>>>24&255,X>>>16&255,X>>>8&255,255&X];return this.is224||ae.push(J>>>24&255,J>>>16&255,J>>>8&255,255&J),ae},$.prototype.array=$.prototype.digest,$.prototype.arrayBuffer=function(){this.finalize();var B=new ArrayBuffer(this.is224?28:32),z=new DataView(B);return z.setUint32(0,this.h0),z.setUint32(4,this.h1),z.setUint32(8,this.h2),z.setUint32(12,this.h3),z.setUint32(16,this.h4),z.setUint32(20,this.h5),z.setUint32(24,this.h6),this.is224||z.setUint32(28,this.h7),B},T.prototype=new $,T.prototype.finalize=function(){if($.prototype.finalize.call(this),this.inner){this.inner=!1;var B=this.array();$.call(this,this.is224,this.sharedMemory),this.update(this.oKeyPad),this.update(B),$.prototype.finalize.call(this)}};var te=S();te.sha256=te,te.sha224=S(!0),te.sha256.hmac=L(),te.sha224.hmac=L(!0),u?xh.exports=te:(r.sha256=te.sha256,r.sha224=te.sha224)})();Gu.exports;Gu.exports.sha224;var x0=Gu.exports.sha256;function rd(e){return c2(e)}function s2(e){if(!/^[0-9A-Fa-f]+$/.test(e))return!1;const r=/^[0-9A-F]+$/.test(e),s=/^[0-9a-f]+$/.test(e);return r||s?e.length%2===0:!1}function a2(e){return/^[A-Za-z0-9\-_]*(={0,2})?$/.test(e)||/^[A-Za-z0-9+/]*(={0,2})?$/.test(e)}function l2(e){return s2(e)?"hex":a2(e)?"b64":""}function o2(e){if(e.length%2!==0)throw new Error("hex string must have an even length");const n=new Uint8Array(e.length/2);for(let r=0;r<e.length;r+=2)n[r/2]=parseInt(e.substring(r,r+2),16);return n}function u2(e){e=e.replace(/-/g,"+"),e=e.replace(/_/g,"/");const n=atob(e);return Uint8Array.from(n,r=>r.charCodeAt(0))}function c2(e){switch(l2(e)){case"hex":return o2(e);case"b64":return u2(e)}return null}function f2(e,n){const r=typeof e=="string"?rd(e):e,s=typeof n=="string"?rd(n):n;if(r===null||s===null||r.length!==s.length)return!1;for(let l=0;l<r.length;l++)if(r[l]!==s[l])return!1;return!0}class ux{constructor(n,r,s=!0){C(this,"token");C(this,"received");C(this,"ctx");C(this,"requestSubject");C(this,"mux");this.mux=n,this.requestSubject=r,this.received=0,this.token=Bi.next(),s&&(this.ctx=new Error)}}class h2 extends ux{constructor(r,s,l={maxWait:1e3}){super(r,s);C(this,"callback");C(this,"done");C(this,"timer");C(this,"max");C(this,"opts");if(this.opts=l,typeof this.opts.callback!="function")throw new Error("callback is required");this.callback=this.opts.callback,this.max=typeof l.maxMessages=="number"&&l.maxMessages>0?l.maxMessages:-1,this.done=zt(),this.done.then(()=>{this.callback(null,null)}),this.timer=setTimeout(()=>{this.cancel()},l.maxWait)}cancel(r){r&&this.callback(r,null),clearTimeout(this.timer),this.mux.cancel(this),this.done.resolve()}resolver(r,s){r?(this.ctx&&(r.stack+=`
67
+
68
+ ${this.ctx.stack}`),this.cancel(r)):(this.callback(null,s),this.opts.strategy===mr.Count&&(this.max--,this.max===0&&this.cancel()),this.opts.strategy===mr.JitterTimer&&(clearTimeout(this.timer),this.timer=setTimeout(()=>{this.cancel()},this.opts.jitter||300)),this.opts.strategy===mr.SentinelMsg&&s&&s.data.length===0&&this.cancel())}}class cx extends ux{constructor(r,s,l={timeout:1e3},u=!0){super(r,s,u);C(this,"deferred");C(this,"timer");this.deferred=zt(),this.timer=ha(l.timeout,u)}resolver(r,s){this.timer&&this.timer.cancel(),r?(this.ctx&&(r.stack+=`
69
+
70
+ ${this.ctx.stack}`),this.deferred.reject(r)):this.deferred.resolve(s),this.cancel()}cancel(r){this.timer&&this.timer.cancel(),this.mux.cancel(this),this.deferred.reject(r||Ne.errorForCode(_e.Cancelled))}}const d2="$JS.API";function m2(e){return e=e||{},e.domain&&(e.apiPrefix=`$JS.${e.domain}.API`,delete e.domain),$u({apiPrefix:d2,timeout:5e3},e)}class $l{constructor(n,r){C(this,"nc");C(this,"opts");C(this,"prefix");C(this,"timeout");C(this,"jc");this.nc=n,this.opts=m2(r),this._parseOpts(),this.prefix=this.opts.apiPrefix,this.timeout=this.opts.timeout,this.jc=pr()}getOptions(){return Object.assign({},this.opts)}_parseOpts(){let n=this.opts.apiPrefix;if(!n||n.length===0)throw new Error("invalid empty prefix");n[n.length-1]==="."&&(n=n.substr(0,n.length-1)),this.opts.apiPrefix=n}async _request(n,r=null,s){s=s||{},s.timeout=this.timeout;let l=Yn;r&&(l=this.jc.encode(r));let{retries:u}=s;u=u||1,u=u===-1?Number.MAX_SAFE_INTEGER:u;const c=Od();for(let f=0;f<u;f++)try{const m=await this.nc.request(n,l,s);return this.parseJsResponse(m)}catch(m){const d=m;if((d.code==="503"||d.code===_e.Timeout)&&f+1<u)await va(c.backoff(f));else throw m}}async findStream(n){const r={subject:n},l=await this._request(`${this.prefix}.STREAM.NAMES`,r);if(!l.streams||l.streams.length!==1)throw new Error("no stream matches subject");return l.streams[0]}getConnection(){return this.nc}parseJsResponse(n){const r=this.jc.decode(n.data),s=r;if(s.error){const l=ox(s.error.code,s.error.description);if(l!==null)throw l.api_error=s.error,l}return r}}class Cl{constructor(n,r,s,l){C(this,"err");C(this,"offset");C(this,"pageInfo");C(this,"subject");C(this,"jsm");C(this,"filter");C(this,"payload");if(!n)throw new Error("subject is required");this.subject=n,this.jsm=s,this.offset=0,this.pageInfo={},this.filter=r,this.payload=l||{}}async next(){if(this.err)return[];if(this.pageInfo&&this.offset>=this.pageInfo.total)return[];const n={offset:this.offset};this.payload&&Object.assign(n,this.payload);try{const r=await this.jsm._request(this.subject,n,{timeout:this.jsm.timeout});this.pageInfo=r;const s=this.countResponse(r);return s===0?[]:(this.offset+=s,this.filter(r))}catch(r){throw this.err=r,r}}countResponse(n){var r,s,l;switch(n==null?void 0:n.type){case"io.nats.jetstream.api.v1.stream_names_response":case"io.nats.jetstream.api.v1.stream_list_response":return((r=n.streams)==null?void 0:r.length)||0;case"io.nats.jetstream.api.v1.consumer_list_response":return((s=n.consumers)==null?void 0:s.length)||0;default:return console.error(`jslister.ts: unknown API response for paged output: ${n==null?void 0:n.type}`),((l=n.streams)==null?void 0:l.length)||0}return 0}async*[Symbol.asyncIterator](){let n=await this.next();for(;n.length>0;){for(const r of n)yield r;n=await this.next()}}}function fs(e=""){const n=e.match(/(\d+).(\d+).(\d+)/);if(n)return{major:parseInt(n[1]),minor:parseInt(n[2]),micro:parseInt(n[3])};throw new Error(`'${e}' is not a semver value`)}function id(e,n){return e.major<n.major?-1:e.major>n.major?1:e.minor<n.minor?-1:e.minor>n.minor?1:e.micro<n.micro?-1:e.micro>n.micro?1:0}var ut;(function(e){e.JS_KV="js_kv",e.JS_OBJECTSTORE="js_objectstore",e.JS_PULL_MAX_BYTES="js_pull_max_bytes",e.JS_NEW_CONSUMER_CREATE_API="js_new_consumer_create",e.JS_ALLOW_DIRECT="js_allow_direct",e.JS_MULTIPLE_CONSUMER_FILTER="js_multiple_consumer_filter",e.JS_SIMPLIFICATION="js_simplification",e.JS_STREAM_CONSUMER_METADATA="js_stream_consumer_metadata",e.JS_CONSUMER_FILTER_SUBJECTS="js_consumer_filter_subjects",e.JS_STREAM_FIRST_SEQ="js_stream_first_seq",e.JS_STREAM_SUBJECT_TRANSFORM="js_stream_subject_transform",e.JS_STREAM_SOURCE_SUBJECT_TRANSFORM="js_stream_source_subject_transform",e.JS_STREAM_COMPRESSION="js_stream_compression",e.JS_DEFAULT_CONSUMER_LIMITS="js_default_consumer_limits",e.JS_BATCH_DIRECT_GET="js_batch_direct_get"})(ut||(ut={}));class p2{constructor(n){C(this,"server");C(this,"features");C(this,"disabled");this.features=new Map,this.disabled=[],this.update(n)}resetDisabled(){this.disabled.length=0,this.update(this.server)}disable(n){this.disabled.push(n),this.update(this.server)}isDisabled(n){return this.disabled.indexOf(n)!==-1}update(n){typeof n=="string"&&(n=fs(n)),this.server=n,this.set(ut.JS_KV,"2.6.2"),this.set(ut.JS_OBJECTSTORE,"2.6.3"),this.set(ut.JS_PULL_MAX_BYTES,"2.8.3"),this.set(ut.JS_NEW_CONSUMER_CREATE_API,"2.9.0"),this.set(ut.JS_ALLOW_DIRECT,"2.9.0"),this.set(ut.JS_MULTIPLE_CONSUMER_FILTER,"2.10.0"),this.set(ut.JS_SIMPLIFICATION,"2.9.4"),this.set(ut.JS_STREAM_CONSUMER_METADATA,"2.10.0"),this.set(ut.JS_CONSUMER_FILTER_SUBJECTS,"2.10.0"),this.set(ut.JS_STREAM_FIRST_SEQ,"2.10.0"),this.set(ut.JS_STREAM_SUBJECT_TRANSFORM,"2.10.0"),this.set(ut.JS_STREAM_SOURCE_SUBJECT_TRANSFORM,"2.10.0"),this.set(ut.JS_STREAM_COMPRESSION,"2.10.0"),this.set(ut.JS_DEFAULT_CONSUMER_LIMITS,"2.10.0"),this.set(ut.JS_BATCH_DIRECT_GET,"2.11.0"),this.disabled.forEach(r=>{this.features.delete(r)})}set(n,r){this.features.set(n,{min:r,ok:id(this.server,fs(r))>=0})}get(n){return this.features.get(n)||{min:"unknown",ok:!1}}supports(n){var r;return((r=this.get(n))==null?void 0:r.ok)||!1}require(n){return typeof n=="string"&&(n=fs(n)),id(this.server,n)>=0}}class Ou extends $l{constructor(n,r){super(n,r)}async add(n,r,s=Nu.Create){if(mn(n),r.deliver_group&&r.flow_control)throw new Error("jetstream flow control is not supported with queue groups");if(r.deliver_group&&r.idle_heartbeat)throw new Error("jetstream idle heartbeat is not supported with queue groups");const l={};l.config=r,l.stream_name=n,l.action=s,l.config.durable_name&&sa(l.config.durable_name);const u=this.nc;let{min:c,ok:f}=u.features.get(ut.JS_NEW_CONSUMER_CREATE_API);const m=r.name===""?void 0:r.name;if(m&&!f)throw new Error(`consumer 'name' requires server ${c}`);if(m)try{Yu("name",m)}catch(x){const w=x.message,S=w.indexOf("cannot contain");throw S!==-1?new Error(`consumer 'name' ${w.substring(S)}`):x}let d,y="";if(Array.isArray(r.filter_subjects)){const{min:x,ok:w}=u.features.get(ut.JS_MULTIPLE_CONSUMER_FILTER);if(!w)throw new Error(`consumer 'filter_subjects' requires server ${x}`);f=!1}if(r.metadata){const{min:x,ok:w}=u.features.get(ut.JS_STREAM_CONSUMER_METADATA);if(!w)throw new Error(`consumer 'metadata' requires server ${x}`)}if(f&&(y=r.name??r.durable_name??""),y!==""){let x=r.filter_subject??void 0;x===">"&&(x=void 0),d=x!==void 0?`${this.prefix}.CONSUMER.CREATE.${n}.${y}.${x}`:`${this.prefix}.CONSUMER.CREATE.${n}.${y}`}else d=r.durable_name?`${this.prefix}.CONSUMER.DURABLE.CREATE.${n}.${r.durable_name}`:`${this.prefix}.CONSUMER.CREATE.${n}`;return await this._request(d,l)}async update(n,r,s){const l=await this.info(n,r),u=s;return this.add(n,Object.assign(l.config,u),Nu.Update)}async info(n,r){return mn(n),sa(r),await this._request(`${this.prefix}.CONSUMER.INFO.${n}.${r}`)}async delete(n,r){return mn(n),sa(r),(await this._request(`${this.prefix}.CONSUMER.DELETE.${n}.${r}`)).success}list(n){mn(n);const r=l=>l.consumers,s=`${this.prefix}.CONSUMER.LIST.${n}`;return new Cl(s,r,this)}pause(n,r,s){const l=`${this.prefix}.CONSUMER.PAUSE.${n}.${r}`,u={pause_until:s.toISOString()};return this._request(l,u)}resume(n,r){return this.pause(n,r,new Date(0))}}function Qs(e,n,r=!1){if(r===!0&&!e)throw Ne.errorForCode(_e.ApiError,new Error(`${n} is not a function`));if(e&&typeof e!="function")throw Ne.errorForCode(_e.ApiError,new Error(`${n} is not a function`))}class g2 extends nn{constructor(r,s,l){super();C(this,"sub");C(this,"adapter");C(this,"subIterDone");Qs(l.adapter,"adapter",!0),this.adapter=l.adapter,l.callback&&Qs(l.callback,"callback"),this.noIterator=typeof l.callback=="function",l.ingestionFilterFn&&(Qs(l.ingestionFilterFn,"ingestionFilterFn"),this.ingestionFilterFn=l.ingestionFilterFn),l.protocolFilterFn&&(Qs(l.protocolFilterFn,"protocolFilterFn"),this.protocolFilterFn=l.protocolFilterFn),l.dispatchedFn&&(Qs(l.dispatchedFn,"dispatchedFn"),this.dispatchedFn=l.dispatchedFn),l.cleanupFn&&Qs(l.cleanupFn,"cleanupFn");let u=(y,g)=>{this.callback(y,g)};if(l.callback){const y=l.callback;u=(g,x)=>{const[w,S]=this.adapter(g,x);if(w){y(w,null);return}const{ingest:D}=this.ingestionFilterFn?this.ingestionFilterFn(S,this):{ingest:!0};D&&(!this.protocolFilterFn||this.protocolFilterFn(S))&&(y(w,S),this.dispatchedFn&&S&&this.dispatchedFn(S))}}const{max:c,queue:f,timeout:m}=l,d={queue:f,timeout:m,callback:u};c&&c>0&&(d.max=c),this.sub=r.subscribe(s,d),l.cleanupFn&&(this.sub.cleanupFn=l.cleanupFn),this.noIterator||this.iterClosed.then(()=>{this.unsubscribe()}),this.subIterDone=zt(),Promise.all([this.sub.closed,this.iterClosed]).then(()=>{this.subIterDone.resolve()}).catch(()=>{this.subIterDone.resolve()}),(async y=>{await y.closed,this.stop()})(this.sub).then().catch()}unsubscribe(r){this.sub.unsubscribe(r)}drain(){return this.sub.drain()}isDraining(){return this.sub.isDraining()}isClosed(){return this.sub.isClosed()}callback(r,s){this.sub.cancelTimeout();const[l,u]=this.adapter(r,s);l&&this.stop(l),u&&this.push(u)}getSubject(){return this.sub.getSubject()}getReceived(){return this.sub.getReceived()}getProcessed(){return this.sub.getProcessed()}getPending(){return this.sub.getPending()}getID(){return this.sub.getID()}getMax(){return this.sub.getMax()}get closed(){return this.sub.closed}}let Fn;function y2(e){Fn=e}function fx(){return Fn!==void 0&&Fn.defaultPort!==void 0?Fn.defaultPort:4222}function vh(){return Fn!==void 0&&Fn.urlParseFn?Fn.urlParseFn:void 0}function b2(){if(!Fn||typeof Fn.factory!="function")throw new Error("transport fn is not set");return Fn.factory()}function sd(){return Fn!==void 0&&Fn.dnsResolveFn?Fn.dnsResolveFn:void 0}const Su=`\r
71
+ `,Ru=ma.fromAscii(Su),x2=new Uint8Array(Ru)[0],v2=new Uint8Array(Ru)[1];function w2(e){for(let n=0;n<e.length;n++){const r=n+1;if(e.byteLength>r&&e[n]===x2&&e[r]===v2)return r+1}return 0}function S2(e){const n=w2(e);if(n>0){const s=new Uint8Array(e).slice(0,n);return In.decode(s)}return""}const _2=4,hx=48,E2=65,k2=97;function C2(e,n,r,s){const l=new Uint8Array(16);return[0,0,0,0,0,0,0,0,0,0,255,255].forEach((c,f)=>{l[f]=c}),l[12]=e,l[13]=n,l[14]=r,l[15]=s,l}function ad(e){return A2(e)!==void 0}function A2(e){for(let n=0;n<e.length;n++)switch(e[n]){case".":return dx(e);case":":return T2(e)}}function dx(e){const n=new Uint8Array(4);for(let r=0;r<4;r++){if(e.length===0)return;if(r>0){if(e[0]!==".")return;e=e.substring(1)}const{n:s,c:l,ok:u}=j2(e);if(!u||s>255)return;e=e.substring(l),n[r]=s}return C2(n[0],n[1],n[2],n[3])}function T2(e){const n=new Uint8Array(16);let r=-1;if(e.length>=2&&e[0]===":"&&e[1]===":"&&(r=0,e=e.substring(2),e.length===0))return n;let s=0;for(;s<16;){const{n:l,c:u,ok:c}=N2(e);if(!c||l>65535)return;if(u<e.length&&e[u]==="."){if(r<0&&s!=12||s+4>16)return;const f=dx(e);if(f===void 0)return;n[s]=f[12],n[s+1]=f[13],n[s+2]=f[14],n[s+3]=f[15],e="",s+=_2;break}if(n[s]=l>>8,n[s+1]=l,s+=2,e=e.substring(u),e.length===0)break;if(e[0]!==":"||e.length==1)return;if(e=e.substring(1),e[0]===":"){if(r>=0)return;if(r=s,e=e.substring(1),e.length===0)break}}if(e.length===0){if(s<16){if(r<0)return;const l=16-s;for(let u=s-1;u>=r;u--)n[u+l]=n[u];for(let u=r+l-1;u>=r;u--)n[u]=0}else if(r>=0)return;return n}}function j2(e){let n=0,r=0;for(n=0;n<e.length&&48<=e.charCodeAt(n)&&e.charCodeAt(n)<=57;n++)if(r=r*10+(e.charCodeAt(n)-hx),r>=16777215)return{n:16777215,c:n,ok:!1};return n===0?{n:0,c:0,ok:!1}:{n:r,c:n,ok:!0}}function N2(e){let n=0,r=0;for(r=0;r<e.length;r++){if(48<=e.charCodeAt(r)&&e.charCodeAt(r)<=57)n*=16,n+=e.charCodeAt(r)-hx;else if(97<=e.charCodeAt(r)&&e.charCodeAt(r)<=102)n*=16,n+=e.charCodeAt(r)-k2+10;else if(65<=e.charCodeAt(r)&&e.charCodeAt(r)<=70)n*=16,n+=e.charCodeAt(r)-E2+10;else break;if(n>=16777215)return{n:0,c:r,ok:!1}}return r===0?{n:0,c:r,ok:!1}:{n,c:r,ok:!0}}function O2(e){return e.indexOf("[")!==-1||e.indexOf("::")!==-1?!1:e.indexOf(".")!==-1||e.split(":").length<=2}function ld(e){return!O2(e)}function R2(e){const n="::FFFF:",r=e.toUpperCase().indexOf(n);if(r!==-1&&e.indexOf(".")!==-1){let s=e.substring(r+n.length);return s=s.replace("[",""),s.replace("]","")}return e}function M2(e){e=e.trim(),e.match(/^(.*:\/\/)(.*)/m)&&(e=e.replace(/^(.*:\/\/)(.*)/gm,"$2")),e=R2(e),ld(e)&&e.indexOf("[")===-1&&(e=`[${e}]`);const n=ld(e)?e.match(/(]:)(\d+)/):e.match(/(:)(\d+)/),r=n&&n.length===3&&n[1]&&n[2]?parseInt(n[2]):4222,s=r===80?"https":"http",l=new URL(`${s}://${e}`);l.port=`${r}`;let u=l.hostname;return u.charAt(0)==="["&&(u=u.substring(1,u.length-1)),{listen:l.host,hostname:u,port:r}}class jl{constructor(n,r=!1){C(this,"src");C(this,"listen");C(this,"hostname");C(this,"port");C(this,"didConnect");C(this,"reconnects");C(this,"lastConnect");C(this,"gossiped");C(this,"tlsName");C(this,"resolves");this.src=n,this.tlsName="";const s=M2(n);this.listen=s.listen,this.hostname=s.hostname,this.port=s.port,this.didConnect=!1,this.reconnects=0,this.lastConnect=0,this.gossiped=r}toString(){return this.listen}async resolve(n){if(!n.fn||n.resolve===!1)return[this];const r=[];if(ad(this.hostname))return[this];{const s=await n.fn(this.hostname);n.debug&&console.log(`resolve ${this.hostname} = ${s.join(",")}`);for(const l of s){const u=this.port===80?"https":"http",c=new URL(`${u}://${ld(l)?"["+l+"]":l}`);c.port=`${this.port}`;const f=new jl(c.host,!1);f.tlsName=this.hostname,r.push(f)}}return n.randomize&&ax(r),this.resolves=r,r}}class D2{constructor(n=[],r={}){C(this,"firstSelect");C(this,"servers");C(this,"currentServer");C(this,"tlsName");C(this,"randomize");this.firstSelect=!0,this.servers=[],this.tlsName="",this.randomize=r.randomize||!1;const s=vh();n&&(n.forEach(l=>{l=s?s(l):l,this.servers.push(new jl(l))}),this.randomize&&(this.servers=ax(this.servers))),this.servers.length===0&&this.addServer(`${Zh}:${fx()}`,!1),this.currentServer=this.servers[0]}clear(){this.servers.length=0}updateTLSName(){const n=this.getCurrentServer();ad(n.hostname)||(this.tlsName=n.hostname,this.servers.forEach(r=>{r.gossiped&&(r.tlsName=this.tlsName)}))}getCurrentServer(){return this.currentServer}addServer(n,r=!1){const s=vh();n=s?s(n):n;const l=new jl(n,r);ad(l.hostname)&&(l.tlsName=this.tlsName),this.servers.push(l)}selectServer(){if(this.firstSelect)return this.firstSelect=!1,this.currentServer;const n=this.servers.shift();return n&&(this.servers.push(n),this.currentServer=n),n}removeCurrentServer(){this.removeServer(this.currentServer)}removeServer(n){if(n){const r=this.servers.indexOf(n);this.servers.splice(r,1)}}length(){return this.servers.length}next(){return this.servers.length?this.servers[0]:void 0}getServers(){return this.servers}update(n,r){const s=[];let l=[];const u=vh(),c=new Map;n.connect_urls&&n.connect_urls.length>0&&n.connect_urls.forEach(m=>{m=u?u(m,r):m;const d=new jl(m,!0);c.set(m,d)});const f=[];return this.servers.forEach((m,d)=>{const y=m.listen;m.gossiped&&this.currentServer.listen!==y&&c.get(y)===void 0&&f.push(d),c.delete(y)}),f.reverse(),f.forEach(m=>{const d=this.servers.splice(m,1);l=l.concat(d[0].listen)}),c.forEach((m,d)=>{this.servers.push(m),s.push(d)}),{added:s,deleted:l}}}class L2{constructor(){C(this,"baseInbox");C(this,"reqs");this.reqs=new Map}size(){return this.reqs.size}init(n){return this.baseInbox=`${Zr(n)}.`,this.baseInbox}add(n){isNaN(n.received)||(n.received=0),this.reqs.set(n.token,n)}get(n){return this.reqs.get(n)}cancel(n){this.reqs.delete(n.token)}getToken(n){const r=n.subject||"";return r.indexOf(this.baseInbox)===0?r.substring(this.baseInbox.length):null}all(){return Array.from(this.reqs.values())}handleError(n,r){if(r&&r.permissionContext){if(n)return this.all().forEach(l=>{l.resolver(r,{})}),!0;const s=r.permissionContext;if(s.operation==="publish"){const l=this.all().find(u=>u.requestSubject===s.subject);if(l)return l.resolver(r,{}),!0}}return!1}dispatcher(){return(n,r)=>{const s=this.getToken(r);if(s){const l=this.get(s);l&&(n===null&&r.headers&&(n=lx(r)),l.resolver(n,r))}}}close(){const n=Ne.errorForCode(_e.Timeout);this.reqs.forEach(r=>{r.resolver(n,{})})}}class z2{constructor(n,r,s){C(this,"ph");C(this,"interval");C(this,"maxOut");C(this,"timer");C(this,"pendings");this.ph=n,this.interval=r,this.maxOut=s,this.pendings=[]}start(){this.cancel(),this._schedule()}cancel(n){this.timer&&(clearTimeout(this.timer),this.timer=void 0),this._reset(),n&&this.ph.disconnect()}_schedule(){this.timer=setTimeout(()=>{if(this.ph.dispatchStatus({type:ia.PingTimer,data:`${this.pendings.length+1}`}),this.pendings.length===this.maxOut){this.cancel(!0);return}const n=zt();this.ph.flush(n).then(()=>{this._reset()}).catch(()=>{this.cancel()}),this.pendings.push(n),this._schedule()},this.interval)}_reset(){this.pendings=this.pendings.filter(n=>(n.resolve(),!1))}}class U2 extends Error{constructor(n){super(n),this.name="AssertionError"}}function B2(e,n="Assertion failed."){if(!e)throw new U2(n)}const v0=32*1024,wh=2**32-2;function fu(e,n,r=0){const s=n.byteLength-r;return e.byteLength>s&&(e=e.subarray(0,s)),n.set(e,r),e.byteLength}class Sh{constructor(n){C(this,"_buf");C(this,"_off");if(this._off=0,n==null){this._buf=new Uint8Array(0);return}this._buf=new Uint8Array(n)}bytes(n={copy:!0}){return n.copy===!1?this._buf.subarray(this._off):this._buf.slice(this._off)}empty(){return this._buf.byteLength<=this._off}get length(){return this._buf.byteLength-this._off}get capacity(){return this._buf.buffer.byteLength}truncate(n){if(n===0){this.reset();return}if(n<0||n>this.length)throw Error("bytes.Buffer: truncation out of range");this._reslice(this._off+n)}reset(){this._reslice(0),this._off=0}_tryGrowByReslice(n){const r=this._buf.byteLength;return n<=this.capacity-r?(this._reslice(r+n),r):-1}_reslice(n){B2(n<=this._buf.buffer.byteLength),this._buf=new Uint8Array(this._buf.buffer,0,n)}readByte(){const n=new Uint8Array(1);return this.read(n)?n[0]:null}read(n){if(this.empty())return this.reset(),n.byteLength===0?0:null;const r=fu(this._buf.subarray(this._off),n);return this._off+=r,r}writeByte(n){return this.write(Uint8Array.of(n))}writeString(n){return this.write(qi.encode(n))}write(n){const r=this._grow(n.byteLength);return fu(n,this._buf,r)}_grow(n){const r=this.length;r===0&&this._off!==0&&this.reset();const s=this._tryGrowByReslice(n);if(s>=0)return s;const l=this.capacity;if(n<=Math.floor(l/2)-r)fu(this._buf.subarray(this._off),this._buf);else{if(l+n>wh)throw new Error("The buffer cannot be grown beyond the maximum size.");{const u=new Uint8Array(Math.min(2*l+n,wh));fu(this._buf.subarray(this._off),u),this._buf=u}}return this._off=0,this._reslice(Math.min(r+n,wh)),r}grow(n){if(n<0)throw Error("Buffer._grow: negative count");const r=this._grow(n);this._reslice(r)}readFrom(n){let r=0;const s=new Uint8Array(v0);for(;;){const l=this.capacity-this.length<v0,u=l?s:new Uint8Array(this._buf.buffer,this.length),c=n.read(u);if(c===null)return r;l?this.write(u.subarray(0,c)):this._reslice(this.length+c),r+=c}}}var pn;(function(e){e[e.OK=0]="OK",e[e.ERR=1]="ERR",e[e.MSG=2]="MSG",e[e.INFO=3]="INFO",e[e.PING=4]="PING",e[e.PONG=5]="PONG"})(pn||(pn={}));function w0(){const e={};return e.sid=-1,e.hdr=-1,e.size=-1,e}const P2=48;class S0{constructor(n){C(this,"dispatcher");C(this,"state");C(this,"as");C(this,"drop");C(this,"hdr");C(this,"ma");C(this,"argBuf");C(this,"msgBuf");this.dispatcher=n,this.state=Ee.OP_START,this.as=0,this.drop=0,this.hdr=0}parse(n){let r;for(r=0;r<n.length;r++){const s=n[r];switch(this.state){case Ee.OP_START:switch(s){case ke.M:case ke.m:this.state=Ee.OP_M,this.hdr=-1,this.ma=w0();break;case ke.H:case ke.h:this.state=Ee.OP_H,this.hdr=0,this.ma=w0();break;case ke.P:case ke.p:this.state=Ee.OP_P;break;case ke.PLUS:this.state=Ee.OP_PLUS;break;case ke.MINUS:this.state=Ee.OP_MINUS;break;case ke.I:case ke.i:this.state=Ee.OP_I;break;default:throw this.fail(n.subarray(r))}break;case Ee.OP_H:switch(s){case ke.M:case ke.m:this.state=Ee.OP_M;break;default:throw this.fail(n.subarray(r))}break;case Ee.OP_M:switch(s){case ke.S:case ke.s:this.state=Ee.OP_MS;break;default:throw this.fail(n.subarray(r))}break;case Ee.OP_MS:switch(s){case ke.G:case ke.g:this.state=Ee.OP_MSG;break;default:throw this.fail(n.subarray(r))}break;case Ee.OP_MSG:switch(s){case ke.SPACE:case ke.TAB:this.state=Ee.OP_MSG_SPC;break;default:throw this.fail(n.subarray(r))}break;case Ee.OP_MSG_SPC:switch(s){case ke.SPACE:case ke.TAB:continue;default:this.state=Ee.MSG_ARG,this.as=r}break;case Ee.MSG_ARG:switch(s){case ke.CR:this.drop=1;break;case ke.NL:{const l=this.argBuf?this.argBuf.bytes():n.subarray(this.as,r-this.drop);this.processMsgArgs(l),this.drop=0,this.as=r+1,this.state=Ee.MSG_PAYLOAD,r=this.as+this.ma.size-1;break}default:this.argBuf&&this.argBuf.writeByte(s)}break;case Ee.MSG_PAYLOAD:if(this.msgBuf)if(this.msgBuf.length>=this.ma.size){const l=this.msgBuf.bytes({copy:!1});this.dispatcher.push({kind:pn.MSG,msg:this.ma,data:l}),this.argBuf=void 0,this.msgBuf=void 0,this.state=Ee.MSG_END}else{let l=this.ma.size-this.msgBuf.length;const u=n.length-r;u<l&&(l=u),l>0?(this.msgBuf.write(n.subarray(r,r+l)),r=r+l-1):this.msgBuf.writeByte(s)}else r-this.as>=this.ma.size&&(this.dispatcher.push({kind:pn.MSG,msg:this.ma,data:n.subarray(this.as,r)}),this.argBuf=void 0,this.msgBuf=void 0,this.state=Ee.MSG_END);break;case Ee.MSG_END:switch(s){case ke.NL:this.drop=0,this.as=r+1,this.state=Ee.OP_START;break;default:continue}break;case Ee.OP_PLUS:switch(s){case ke.O:case ke.o:this.state=Ee.OP_PLUS_O;break;default:throw this.fail(n.subarray(r))}break;case Ee.OP_PLUS_O:switch(s){case ke.K:case ke.k:this.state=Ee.OP_PLUS_OK;break;default:throw this.fail(n.subarray(r))}break;case Ee.OP_PLUS_OK:switch(s){case ke.NL:this.dispatcher.push({kind:pn.OK}),this.drop=0,this.state=Ee.OP_START;break}break;case Ee.OP_MINUS:switch(s){case ke.E:case ke.e:this.state=Ee.OP_MINUS_E;break;default:throw this.fail(n.subarray(r))}break;case Ee.OP_MINUS_E:switch(s){case ke.R:case ke.r:this.state=Ee.OP_MINUS_ER;break;default:throw this.fail(n.subarray(r))}break;case Ee.OP_MINUS_ER:switch(s){case ke.R:case ke.r:this.state=Ee.OP_MINUS_ERR;break;default:throw this.fail(n.subarray(r))}break;case Ee.OP_MINUS_ERR:switch(s){case ke.SPACE:case ke.TAB:this.state=Ee.OP_MINUS_ERR_SPC;break;default:throw this.fail(n.subarray(r))}break;case Ee.OP_MINUS_ERR_SPC:switch(s){case ke.SPACE:case ke.TAB:continue;default:this.state=Ee.MINUS_ERR_ARG,this.as=r}break;case Ee.MINUS_ERR_ARG:switch(s){case ke.CR:this.drop=1;break;case ke.NL:{let l;this.argBuf?(l=this.argBuf.bytes(),this.argBuf=void 0):l=n.subarray(this.as,r-this.drop),this.dispatcher.push({kind:pn.ERR,data:l}),this.drop=0,this.as=r+1,this.state=Ee.OP_START;break}default:this.argBuf&&this.argBuf.write(Uint8Array.of(s))}break;case Ee.OP_P:switch(s){case ke.I:case ke.i:this.state=Ee.OP_PI;break;case ke.O:case ke.o:this.state=Ee.OP_PO;break;default:throw this.fail(n.subarray(r))}break;case Ee.OP_PO:switch(s){case ke.N:case ke.n:this.state=Ee.OP_PON;break;default:throw this.fail(n.subarray(r))}break;case Ee.OP_PON:switch(s){case ke.G:case ke.g:this.state=Ee.OP_PONG;break;default:throw this.fail(n.subarray(r))}break;case Ee.OP_PONG:switch(s){case ke.NL:this.dispatcher.push({kind:pn.PONG}),this.drop=0,this.state=Ee.OP_START;break}break;case Ee.OP_PI:switch(s){case ke.N:case ke.n:this.state=Ee.OP_PIN;break;default:throw this.fail(n.subarray(r))}break;case Ee.OP_PIN:switch(s){case ke.G:case ke.g:this.state=Ee.OP_PING;break;default:throw this.fail(n.subarray(r))}break;case Ee.OP_PING:switch(s){case ke.NL:this.dispatcher.push({kind:pn.PING}),this.drop=0,this.state=Ee.OP_START;break}break;case Ee.OP_I:switch(s){case ke.N:case ke.n:this.state=Ee.OP_IN;break;default:throw this.fail(n.subarray(r))}break;case Ee.OP_IN:switch(s){case ke.F:case ke.f:this.state=Ee.OP_INF;break;default:throw this.fail(n.subarray(r))}break;case Ee.OP_INF:switch(s){case ke.O:case ke.o:this.state=Ee.OP_INFO;break;default:throw this.fail(n.subarray(r))}break;case Ee.OP_INFO:switch(s){case ke.SPACE:case ke.TAB:this.state=Ee.OP_INFO_SPC;break;default:throw this.fail(n.subarray(r))}break;case Ee.OP_INFO_SPC:switch(s){case ke.SPACE:case ke.TAB:continue;default:this.state=Ee.INFO_ARG,this.as=r}break;case Ee.INFO_ARG:switch(s){case ke.CR:this.drop=1;break;case ke.NL:{let l;this.argBuf?(l=this.argBuf.bytes(),this.argBuf=void 0):l=n.subarray(this.as,r-this.drop),this.dispatcher.push({kind:pn.INFO,data:l}),this.drop=0,this.as=r+1,this.state=Ee.OP_START;break}default:this.argBuf&&this.argBuf.writeByte(s)}break;default:throw this.fail(n.subarray(r))}}(this.state===Ee.MSG_ARG||this.state===Ee.MINUS_ERR_ARG||this.state===Ee.INFO_ARG)&&!this.argBuf&&(this.argBuf=new Sh(n.subarray(this.as,r-this.drop))),this.state===Ee.MSG_PAYLOAD&&!this.msgBuf&&(this.argBuf||this.cloneMsgArg(),this.msgBuf=new Sh(n.subarray(this.as)))}cloneMsgArg(){const n=this.ma.subject.length,r=this.ma.reply?this.ma.reply.length:0,s=new Uint8Array(n+r);s.set(this.ma.subject),this.ma.reply&&s.set(this.ma.reply,n),this.argBuf=new Sh(s),this.ma.subject=s.subarray(0,n),this.ma.reply&&(this.ma.reply=s.subarray(n))}processMsgArgs(n){if(this.hdr>=0)return this.processHeaderMsgArgs(n);const r=[];let s=-1;for(let l=0;l<n.length;l++)switch(n[l]){case ke.SPACE:case ke.TAB:case ke.CR:case ke.NL:s>=0&&(r.push(n.subarray(s,l)),s=-1);break;default:s<0&&(s=l)}switch(s>=0&&r.push(n.subarray(s)),r.length){case 3:this.ma.subject=r[0],this.ma.sid=this.protoParseInt(r[1]),this.ma.reply=void 0,this.ma.size=this.protoParseInt(r[2]);break;case 4:this.ma.subject=r[0],this.ma.sid=this.protoParseInt(r[1]),this.ma.reply=r[2],this.ma.size=this.protoParseInt(r[3]);break;default:throw this.fail(n,"processMsgArgs Parse Error")}if(this.ma.sid<0)throw this.fail(n,"processMsgArgs Bad or Missing Sid Error");if(this.ma.size<0)throw this.fail(n,"processMsgArgs Bad or Missing Size Error")}fail(n,r=""){return r?r=`${r} [${this.state}]`:r=`parse error [${this.state}]`,new Error(`${r}: ${In.decode(n)}`)}processHeaderMsgArgs(n){const r=[];let s=-1;for(let l=0;l<n.length;l++)switch(n[l]){case ke.SPACE:case ke.TAB:case ke.CR:case ke.NL:s>=0&&(r.push(n.subarray(s,l)),s=-1);break;default:s<0&&(s=l)}switch(s>=0&&r.push(n.subarray(s)),r.length){case 4:this.ma.subject=r[0],this.ma.sid=this.protoParseInt(r[1]),this.ma.reply=void 0,this.ma.hdr=this.protoParseInt(r[2]),this.ma.size=this.protoParseInt(r[3]);break;case 5:this.ma.subject=r[0],this.ma.sid=this.protoParseInt(r[1]),this.ma.reply=r[2],this.ma.hdr=this.protoParseInt(r[3]),this.ma.size=this.protoParseInt(r[4]);break;default:throw this.fail(n,"processHeaderMsgArgs Parse Error")}if(this.ma.sid<0)throw this.fail(n,"processHeaderMsgArgs Bad or Missing Sid Error");if(this.ma.hdr<0||this.ma.hdr>this.ma.size)throw this.fail(n,"processHeaderMsgArgs Bad or Missing Header Size Error");if(this.ma.size<0)throw this.fail(n,"processHeaderMsgArgs Bad or Missing Size Error")}protoParseInt(n){if(n.length===0)return-1;let r=0;for(let s=0;s<n.length;s++){if(n[s]<48||n[s]>57)return-1;r=r*10+(n[s]-P2)}return r}}var Ee;(function(e){e[e.OP_START=0]="OP_START",e[e.OP_PLUS=1]="OP_PLUS",e[e.OP_PLUS_O=2]="OP_PLUS_O",e[e.OP_PLUS_OK=3]="OP_PLUS_OK",e[e.OP_MINUS=4]="OP_MINUS",e[e.OP_MINUS_E=5]="OP_MINUS_E",e[e.OP_MINUS_ER=6]="OP_MINUS_ER",e[e.OP_MINUS_ERR=7]="OP_MINUS_ERR",e[e.OP_MINUS_ERR_SPC=8]="OP_MINUS_ERR_SPC",e[e.MINUS_ERR_ARG=9]="MINUS_ERR_ARG",e[e.OP_M=10]="OP_M",e[e.OP_MS=11]="OP_MS",e[e.OP_MSG=12]="OP_MSG",e[e.OP_MSG_SPC=13]="OP_MSG_SPC",e[e.MSG_ARG=14]="MSG_ARG",e[e.MSG_PAYLOAD=15]="MSG_PAYLOAD",e[e.MSG_END=16]="MSG_END",e[e.OP_H=17]="OP_H",e[e.OP_P=18]="OP_P",e[e.OP_PI=19]="OP_PI",e[e.OP_PIN=20]="OP_PIN",e[e.OP_PING=21]="OP_PING",e[e.OP_PO=22]="OP_PO",e[e.OP_PON=23]="OP_PON",e[e.OP_PONG=24]="OP_PONG",e[e.OP_I=25]="OP_I",e[e.OP_IN=26]="OP_IN",e[e.OP_INF=27]="OP_INF",e[e.OP_INFO=28]="OP_INFO",e[e.OP_INFO_SPC=29]="OP_INFO_SPC",e[e.INFO_ARG=30]="INFO_ARG"})(Ee||(Ee={}));var ke;(function(e){e[e.CR=13]="CR",e[e.E=69]="E",e[e.e=101]="e",e[e.F=70]="F",e[e.f=102]="f",e[e.G=71]="G",e[e.g=103]="g",e[e.H=72]="H",e[e.h=104]="h",e[e.I=73]="I",e[e.i=105]="i",e[e.K=75]="K",e[e.k=107]="k",e[e.M=77]="M",e[e.m=109]="m",e[e.MINUS=45]="MINUS",e[e.N=78]="N",e[e.n=110]="n",e[e.NL=10]="NL",e[e.O=79]="O",e[e.o=111]="o",e[e.P=80]="P",e[e.p=112]="p",e[e.PLUS=43]="PLUS",e[e.R=82]="R",e[e.r=114]="r",e[e.S=83]="S",e[e.s=115]="s",e[e.SPACE=32]="SPACE",e[e.TAB=9]="TAB"})(ke||(ke={}));(function(e){var n=function(k,O){this.hi=k|0,this.lo=O|0},r=function(k){var O,j=new Float64Array(16);if(k)for(O=0;O<k.length;O++)j[O]=k[O];return j},s=function(){throw new Error("no PRNG")},l=new Uint8Array(16),u=new Uint8Array(32);u[0]=9;var c=r(),f=r([1]),m=r([56129,1]),d=r([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),y=r([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),g=r([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),x=r([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),w=r([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function S(k,O){return k<<O|k>>>32-O}function D(k,O){var j=k[O+3]&255;return j=j<<8|k[O+2]&255,j=j<<8|k[O+1]&255,j<<8|k[O+0]&255}function q(k,O){var j=k[O]<<24|k[O+1]<<16|k[O+2]<<8|k[O+3],U=k[O+4]<<24|k[O+5]<<16|k[O+6]<<8|k[O+7];return new n(j,U)}function L(k,O,j){var U;for(U=0;U<4;U++)k[O+U]=j&255,j>>>=8}function $(k,O,j){k[O]=j.hi>>24&255,k[O+1]=j.hi>>16&255,k[O+2]=j.hi>>8&255,k[O+3]=j.hi&255,k[O+4]=j.lo>>24&255,k[O+5]=j.lo>>16&255,k[O+6]=j.lo>>8&255,k[O+7]=j.lo&255}function T(k,O,j,U,Y){var ee,me=0;for(ee=0;ee<Y;ee++)me|=k[O+ee]^j[U+ee];return(1&me-1>>>8)-1}function te(k,O,j,U){return T(k,O,j,U,16)}function B(k,O,j,U){return T(k,O,j,U,32)}function z(k,O,j,U,Y){var ee=new Uint32Array(16),me=new Uint32Array(16),ye=new Uint32Array(16),le=new Uint32Array(4),de,Oe,Xe;for(de=0;de<4;de++)me[5*de]=D(U,4*de),me[1+de]=D(j,4*de),me[6+de]=D(O,4*de),me[11+de]=D(j,16+4*de);for(de=0;de<16;de++)ye[de]=me[de];for(de=0;de<20;de++){for(Oe=0;Oe<4;Oe++){for(Xe=0;Xe<4;Xe++)le[Xe]=me[(5*Oe+4*Xe)%16];for(le[1]^=S(le[0]+le[3]|0,7),le[2]^=S(le[1]+le[0]|0,9),le[3]^=S(le[2]+le[1]|0,13),le[0]^=S(le[3]+le[2]|0,18),Xe=0;Xe<4;Xe++)ee[4*Oe+(Oe+Xe)%4]=le[Xe]}for(Xe=0;Xe<16;Xe++)me[Xe]=ee[Xe]}if(Y){for(de=0;de<16;de++)me[de]=me[de]+ye[de]|0;for(de=0;de<4;de++)me[5*de]=me[5*de]-D(U,4*de)|0,me[6+de]=me[6+de]-D(O,4*de)|0;for(de=0;de<4;de++)L(k,4*de,me[5*de]),L(k,16+4*de,me[6+de])}else for(de=0;de<16;de++)L(k,4*de,me[de]+ye[de]|0)}function K(k,O,j,U){return z(k,O,j,U,!1),0}function Q(k,O,j,U){return z(k,O,j,U,!0),0}var H=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function R(k,O,j,U,Y,ee,me){var ye=new Uint8Array(16),le=new Uint8Array(64),de,Oe;if(!Y)return 0;for(Oe=0;Oe<16;Oe++)ye[Oe]=0;for(Oe=0;Oe<8;Oe++)ye[Oe]=ee[Oe];for(;Y>=64;){for(K(le,ye,me,H),Oe=0;Oe<64;Oe++)k[O+Oe]=(j?j[U+Oe]:0)^le[Oe];for(de=1,Oe=8;Oe<16;Oe++)de=de+(ye[Oe]&255)|0,ye[Oe]=de&255,de>>>=8;Y-=64,O+=64,j&&(U+=64)}if(Y>0)for(K(le,ye,me,H),Oe=0;Oe<Y;Oe++)k[O+Oe]=(j?j[U+Oe]:0)^le[Oe];return 0}function X(k,O,j,U,Y){return R(k,O,null,0,j,U,Y)}function J(k,O,j,U,Y){var ee=new Uint8Array(32);return Q(ee,U,Y,H),X(k,O,j,U.subarray(16),ee)}function ae(k,O,j,U,Y,ee,me){var ye=new Uint8Array(32);return Q(ye,ee,me,H),R(k,O,j,U,Y,ee.subarray(16),ye)}function re(k,O){var j,U=0;for(j=0;j<17;j++)U=U+(k[j]+O[j]|0)|0,k[j]=U&255,U>>>=8}var F=new Uint32Array([5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,252]);function P(k,O,j,U,Y,ee){var me,ye,le,de,Oe=new Uint32Array(17),Xe=new Uint32Array(17),Ot=new Uint32Array(17),un=new Uint32Array(17),ur=new Uint32Array(17);for(le=0;le<17;le++)Xe[le]=Ot[le]=0;for(le=0;le<16;le++)Xe[le]=ee[le];for(Xe[3]&=15,Xe[4]&=252,Xe[7]&=15,Xe[8]&=252,Xe[11]&=15,Xe[12]&=252,Xe[15]&=15;Y>0;){for(le=0;le<17;le++)un[le]=0;for(le=0;le<16&&le<Y;++le)un[le]=j[U+le];for(un[le]=1,U+=le,Y-=le,re(Ot,un),ye=0;ye<17;ye++)for(Oe[ye]=0,le=0;le<17;le++)Oe[ye]=Oe[ye]+Ot[le]*(le<=ye?Xe[ye-le]:320*Xe[ye+17-le]|0)|0|0;for(ye=0;ye<17;ye++)Ot[ye]=Oe[ye];for(de=0,le=0;le<16;le++)de=de+Ot[le]|0,Ot[le]=de&255,de>>>=8;for(de=de+Ot[16]|0,Ot[16]=de&3,de=5*(de>>>2)|0,le=0;le<16;le++)de=de+Ot[le]|0,Ot[le]=de&255,de>>>=8;de=de+Ot[16]|0,Ot[16]=de}for(le=0;le<17;le++)ur[le]=Ot[le];for(re(Ot,F),me=-(Ot[16]>>>7)|0,le=0;le<17;le++)Ot[le]^=me&(ur[le]^Ot[le]);for(le=0;le<16;le++)un[le]=ee[le+16];for(un[16]=0,re(Ot,un),le=0;le<16;le++)k[O+le]=Ot[le];return 0}function V(k,O,j,U,Y,ee){var me=new Uint8Array(16);return P(me,0,j,U,Y,ee),te(k,O,me,0)}function ue(k,O,j,U,Y){var ee;if(j<32)return-1;for(ae(k,0,O,0,j,U,Y),P(k,16,k,32,j-32,k),ee=0;ee<16;ee++)k[ee]=0;return 0}function xe(k,O,j,U,Y){var ee,me=new Uint8Array(32);if(j<32||(J(me,0,32,U,Y),V(O,16,O,32,j-32,me)!==0))return-1;for(ae(k,0,O,0,j,U,Y),ee=0;ee<32;ee++)k[ee]=0;return 0}function _(k,O){var j;for(j=0;j<16;j++)k[j]=O[j]|0}function M(k){var O,j;for(j=0;j<16;j++)k[j]+=65536,O=Math.floor(k[j]/65536),k[(j+1)*(j<15?1:0)]+=O-1+37*(O-1)*(j===15?1:0),k[j]-=O*65536}function W(k,O,j){for(var U,Y=~(j-1),ee=0;ee<16;ee++)U=Y&(k[ee]^O[ee]),k[ee]^=U,O[ee]^=U}function A(k,O){var j,U,Y,ee=r(),me=r();for(j=0;j<16;j++)me[j]=O[j];for(M(me),M(me),M(me),U=0;U<2;U++){for(ee[0]=me[0]-65517,j=1;j<15;j++)ee[j]=me[j]-65535-(ee[j-1]>>16&1),ee[j-1]&=65535;ee[15]=me[15]-32767-(ee[14]>>16&1),Y=ee[15]>>16&1,ee[14]&=65535,W(me,ee,1-Y)}for(j=0;j<16;j++)k[2*j]=me[j]&255,k[2*j+1]=me[j]>>8}function ve(k,O){var j=new Uint8Array(32),U=new Uint8Array(32);return A(j,k),A(U,O),B(j,0,U,0)}function Ce(k){var O=new Uint8Array(32);return A(O,k),O[0]&1}function je(k,O){var j;for(j=0;j<16;j++)k[j]=O[2*j]+(O[2*j+1]<<8);k[15]&=32767}function ze(k,O,j){var U;for(U=0;U<16;U++)k[U]=O[U]+j[U]|0}function qe(k,O,j){var U;for(U=0;U<16;U++)k[U]=O[U]-j[U]|0}function Te(k,O,j){var U,Y,ee=new Float64Array(31);for(U=0;U<31;U++)ee[U]=0;for(U=0;U<16;U++)for(Y=0;Y<16;Y++)ee[U+Y]+=O[U]*j[Y];for(U=0;U<15;U++)ee[U]+=38*ee[U+16];for(U=0;U<16;U++)k[U]=ee[U];M(k),M(k)}function Ae(k,O){Te(k,O,O)}function Je(k,O){var j=r(),U;for(U=0;U<16;U++)j[U]=O[U];for(U=253;U>=0;U--)Ae(j,j),U!==2&&U!==4&&Te(j,j,O);for(U=0;U<16;U++)k[U]=j[U]}function rt(k,O){var j=r(),U;for(U=0;U<16;U++)j[U]=O[U];for(U=250;U>=0;U--)Ae(j,j),U!==1&&Te(j,j,O);for(U=0;U<16;U++)k[U]=j[U]}function kt(k,O,j){var U=new Uint8Array(32),Y=new Float64Array(80),ee,me,ye=r(),le=r(),de=r(),Oe=r(),Xe=r(),Ot=r();for(me=0;me<31;me++)U[me]=O[me];for(U[31]=O[31]&127|64,U[0]&=248,je(Y,j),me=0;me<16;me++)le[me]=Y[me],Oe[me]=ye[me]=de[me]=0;for(ye[0]=Oe[0]=1,me=254;me>=0;--me)ee=U[me>>>3]>>>(me&7)&1,W(ye,le,ee),W(de,Oe,ee),ze(Xe,ye,de),qe(ye,ye,de),ze(de,le,Oe),qe(le,le,Oe),Ae(Oe,Xe),Ae(Ot,ye),Te(ye,de,ye),Te(de,le,Xe),ze(Xe,ye,de),qe(ye,ye,de),Ae(le,ye),qe(de,Oe,Ot),Te(ye,de,m),ze(ye,ye,Oe),Te(de,de,ye),Te(ye,Oe,Ot),Te(Oe,le,Y),Ae(le,Xe),W(ye,le,ee),W(de,Oe,ee);for(me=0;me<16;me++)Y[me+16]=ye[me],Y[me+32]=de[me],Y[me+48]=le[me],Y[me+64]=Oe[me];var un=Y.subarray(32),ur=Y.subarray(16);return Je(un,un),Te(ur,ur,un),A(k,ur),0}function Ke(k,O){return kt(k,O,u)}function ot(k,O){return s(O,32),Ke(k,O)}function Fe(k,O,j){var U=new Uint8Array(32);return kt(U,j,O),Q(k,l,U,H)}var He=ue,et=xe;function mt(k,O,j,U,Y,ee){var me=new Uint8Array(32);return Fe(me,Y,ee),He(k,O,j,U,me)}function it(k,O,j,U,Y,ee){var me=new Uint8Array(32);return Fe(me,Y,ee),et(k,O,j,U,me)}function Pt(){var k=0,O=0,j=0,U=0,Y=65535,ee,me,ye;for(ye=0;ye<arguments.length;ye++)ee=arguments[ye].lo,me=arguments[ye].hi,k+=ee&Y,O+=ee>>>16,j+=me&Y,U+=me>>>16;return O+=k>>>16,j+=O>>>16,U+=j>>>16,new n(j&Y|U<<16,k&Y|O<<16)}function Nt(k,O){return new n(k.hi>>>O,k.lo>>>O|k.hi<<32-O)}function Tn(){var k=0,O=0,j;for(j=0;j<arguments.length;j++)k^=arguments[j].lo,O^=arguments[j].hi;return new n(O,k)}function xt(k,O){var j,U,Y=32-O;return O<32?(j=k.hi>>>O|k.lo<<Y,U=k.lo>>>O|k.hi<<Y):O<64&&(j=k.lo>>>O|k.hi<<Y,U=k.hi>>>O|k.lo<<Y),new n(j,U)}function jn(k,O,j){var U=k.hi&O.hi^~k.hi&j.hi,Y=k.lo&O.lo^~k.lo&j.lo;return new n(U,Y)}function fe(k,O,j){var U=k.hi&O.hi^k.hi&j.hi^O.hi&j.hi,Y=k.lo&O.lo^k.lo&j.lo^O.lo&j.lo;return new n(U,Y)}function we(k){return Tn(xt(k,28),xt(k,34),xt(k,39))}function Ue(k){return Tn(xt(k,14),xt(k,18),xt(k,41))}function $e(k){return Tn(xt(k,1),xt(k,8),Nt(k,7))}function at(k){return Tn(xt(k,19),xt(k,61),Nt(k,6))}var rn=[new n(1116352408,3609767458),new n(1899447441,602891725),new n(3049323471,3964484399),new n(3921009573,2173295548),new n(961987163,4081628472),new n(1508970993,3053834265),new n(2453635748,2937671579),new n(2870763221,3664609560),new n(3624381080,2734883394),new n(310598401,1164996542),new n(607225278,1323610764),new n(1426881987,3590304994),new n(1925078388,4068182383),new n(2162078206,991336113),new n(2614888103,633803317),new n(3248222580,3479774868),new n(3835390401,2666613458),new n(4022224774,944711139),new n(264347078,2341262773),new n(604807628,2007800933),new n(770255983,1495990901),new n(1249150122,1856431235),new n(1555081692,3175218132),new n(1996064986,2198950837),new n(2554220882,3999719339),new n(2821834349,766784016),new n(2952996808,2566594879),new n(3210313671,3203337956),new n(3336571891,1034457026),new n(3584528711,2466948901),new n(113926993,3758326383),new n(338241895,168717936),new n(666307205,1188179964),new n(773529912,1546045734),new n(1294757372,1522805485),new n(1396182291,2643833823),new n(1695183700,2343527390),new n(1986661051,1014477480),new n(2177026350,1206759142),new n(2456956037,344077627),new n(2730485921,1290863460),new n(2820302411,3158454273),new n(3259730800,3505952657),new n(3345764771,106217008),new n(3516065817,3606008344),new n(3600352804,1432725776),new n(4094571909,1467031594),new n(275423344,851169720),new n(430227734,3100823752),new n(506948616,1363258195),new n(659060556,3750685593),new n(883997877,3785050280),new n(958139571,3318307427),new n(1322822218,3812723403),new n(1537002063,2003034995),new n(1747873779,3602036899),new n(1955562222,1575990012),new n(2024104815,1125592928),new n(2227730452,2716904306),new n(2361852424,442776044),new n(2428436474,593698344),new n(2756734187,3733110249),new n(3204031479,2999351573),new n(3329325298,3815920427),new n(3391569614,3928383900),new n(3515267271,566280711),new n(3940187606,3454069534),new n(4118630271,4000239992),new n(116418474,1914138554),new n(174292421,2731055270),new n(289380356,3203993006),new n(460393269,320620315),new n(685471733,587496836),new n(852142971,1086792851),new n(1017036298,365543100),new n(1126000580,2618297676),new n(1288033470,3409855158),new n(1501505948,4234509866),new n(1607167915,987167468),new n(1816402316,1246189591)];function xn(k,O,j){var U=[],Y=[],ee=[],me=[],ye,le,de;for(le=0;le<8;le++)U[le]=ee[le]=q(k,8*le);for(var Oe=0;j>=128;){for(le=0;le<16;le++)me[le]=q(O,8*le+Oe);for(le=0;le<80;le++){for(de=0;de<8;de++)Y[de]=ee[de];for(ye=Pt(ee[7],Ue(ee[4]),jn(ee[4],ee[5],ee[6]),rn[le],me[le%16]),Y[7]=Pt(ye,we(ee[0]),fe(ee[0],ee[1],ee[2])),Y[3]=Pt(Y[3],ye),de=0;de<8;de++)ee[(de+1)%8]=Y[de];if(le%16===15)for(de=0;de<16;de++)me[de]=Pt(me[de],me[(de+9)%16],$e(me[(de+1)%16]),at(me[(de+14)%16]))}for(le=0;le<8;le++)ee[le]=Pt(ee[le],U[le]),U[le]=ee[le];Oe+=128,j-=128}for(le=0;le<8;le++)$(k,8*le,U[le]);return j}var Gt=new Uint8Array([106,9,230,103,243,188,201,8,187,103,174,133,132,202,167,59,60,110,243,114,254,148,248,43,165,79,245,58,95,29,54,241,81,14,82,127,173,230,130,209,155,5,104,140,43,62,108,31,31,131,217,171,251,65,189,107,91,224,205,25,19,126,33,121]);function ge(k,O,j){var U=new Uint8Array(64),Y=new Uint8Array(256),ee,me=j;for(ee=0;ee<64;ee++)U[ee]=Gt[ee];for(xn(U,O,j),j%=128,ee=0;ee<256;ee++)Y[ee]=0;for(ee=0;ee<j;ee++)Y[ee]=O[me-j+ee];for(Y[j]=128,j=256-128*(j<112?1:0),Y[j-9]=0,$(Y,j-8,new n(me/536870912|0,me<<3)),xn(U,Y,j),ee=0;ee<64;ee++)k[ee]=U[ee];return 0}function Le(k,O){var j=r(),U=r(),Y=r(),ee=r(),me=r(),ye=r(),le=r(),de=r(),Oe=r();qe(j,k[1],k[0]),qe(Oe,O[1],O[0]),Te(j,j,Oe),ze(U,k[0],k[1]),ze(Oe,O[0],O[1]),Te(U,U,Oe),Te(Y,k[3],O[3]),Te(Y,Y,y),Te(ee,k[2],O[2]),ze(ee,ee,ee),qe(me,U,j),qe(ye,ee,Y),ze(le,ee,Y),ze(de,U,j),Te(k[0],me,ye),Te(k[1],de,le),Te(k[2],le,ye),Te(k[3],me,de)}function Se(k,O,j){var U;for(U=0;U<4;U++)W(k[U],O[U],j)}function ht(k,O){var j=r(),U=r(),Y=r();Je(Y,O[2]),Te(j,O[0],Y),Te(U,O[1],Y),A(k,U),k[31]^=Ce(j)<<7}function pt(k,O,j){var U,Y;for(_(k[0],c),_(k[1],f),_(k[2],f),_(k[3],c),Y=255;Y>=0;--Y)U=j[Y/8|0]>>(Y&7)&1,Se(k,O,U),Le(O,k),Le(k,k),Se(k,O,U)}function Nn(k,O){var j=[r(),r(),r(),r()];_(j[0],g),_(j[1],x),_(j[2],f),Te(j[3],g,x),pt(k,j,O)}function ri(k,O,j){var U=new Uint8Array(64),Y=[r(),r(),r(),r()],ee;for(j||s(O,32),ge(U,O,32),U[0]&=248,U[31]&=127,U[31]|=64,Nn(Y,U),ht(k,Y),ee=0;ee<32;ee++)O[ee+32]=k[ee];return 0}var Nr=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function ii(k,O){var j,U,Y,ee;for(U=63;U>=32;--U){for(j=0,Y=U-32,ee=U-12;Y<ee;++Y)O[Y]+=j-16*O[U]*Nr[Y-(U-32)],j=Math.floor((O[Y]+128)/256),O[Y]-=j*256;O[Y]+=j,O[U]=0}for(j=0,Y=0;Y<32;Y++)O[Y]+=j-(O[31]>>4)*Nr[Y],j=O[Y]>>8,O[Y]&=255;for(Y=0;Y<32;Y++)O[Y]-=j*Nr[Y];for(U=0;U<32;U++)O[U+1]+=O[U]>>8,k[U]=O[U]&255}function lr(k){var O=new Float64Array(64),j;for(j=0;j<64;j++)O[j]=k[j];for(j=0;j<64;j++)k[j]=0;ii(k,O)}function Ii(k,O,j,U){var Y=new Uint8Array(64),ee=new Uint8Array(64),me=new Uint8Array(64),ye,le,de=new Float64Array(64),Oe=[r(),r(),r(),r()];ge(Y,U,32),Y[0]&=248,Y[31]&=127,Y[31]|=64;var Xe=j+64;for(ye=0;ye<j;ye++)k[64+ye]=O[ye];for(ye=0;ye<32;ye++)k[32+ye]=Y[32+ye];for(ge(me,k.subarray(32),j+32),lr(me),Nn(Oe,me),ht(k,Oe),ye=32;ye<64;ye++)k[ye]=U[ye];for(ge(ee,k,j+64),lr(ee),ye=0;ye<64;ye++)de[ye]=0;for(ye=0;ye<32;ye++)de[ye]=me[ye];for(ye=0;ye<32;ye++)for(le=0;le<32;le++)de[ye+le]+=ee[ye]*Y[le];return ii(k.subarray(32),de),Xe}function Fi(k,O){var j=r(),U=r(),Y=r(),ee=r(),me=r(),ye=r(),le=r();return _(k[2],f),je(k[1],O),Ae(Y,k[1]),Te(ee,Y,d),qe(Y,Y,k[2]),ze(ee,k[2],ee),Ae(me,ee),Ae(ye,me),Te(le,ye,me),Te(j,le,Y),Te(j,j,ee),rt(j,j),Te(j,j,Y),Te(j,j,ee),Te(j,j,ee),Te(k[0],j,ee),Ae(U,k[0]),Te(U,U,ee),ve(U,Y)&&Te(k[0],k[0],w),Ae(U,k[0]),Te(U,U,ee),ve(U,Y)?-1:(Ce(k[0])===O[31]>>7&&qe(k[0],c,k[0]),Te(k[3],k[0],k[1]),0)}function Ea(k,O,j,U){var Y,ee=new Uint8Array(32),me=new Uint8Array(64),ye=[r(),r(),r(),r()],le=[r(),r(),r(),r()];if(j<64||Fi(le,U))return-1;for(Y=0;Y<j;Y++)k[Y]=O[Y];for(Y=0;Y<32;Y++)k[Y+32]=U[Y];if(ge(me,k,j),lr(me),pt(ye,le,me),Nn(le,O.subarray(32)),Le(ye,le),ht(ee,ye),j-=64,B(O,0,ee,0)){for(Y=0;Y<j;Y++)k[Y]=0;return-1}for(Y=0;Y<j;Y++)k[Y]=O[Y+64];return j}var gs=32,si=24,or=32,ai=16,li=32,$i=32,oi=32,Or=32,Yi=32,ka=si,Xl=or,yr=ai,Ct=64,qt=32,On=64,Gi=32,Ca=64;e.lowlevel={crypto_core_hsalsa20:Q,crypto_stream_xor:ae,crypto_stream:J,crypto_stream_salsa20_xor:R,crypto_stream_salsa20:X,crypto_onetimeauth:P,crypto_onetimeauth_verify:V,crypto_verify_16:te,crypto_verify_32:B,crypto_secretbox:ue,crypto_secretbox_open:xe,crypto_scalarmult:kt,crypto_scalarmult_base:Ke,crypto_box_beforenm:Fe,crypto_box_afternm:He,crypto_box:mt,crypto_box_open:it,crypto_box_keypair:ot,crypto_hash:ge,crypto_sign:Ii,crypto_sign_keypair:ri,crypto_sign_open:Ea,crypto_secretbox_KEYBYTES:gs,crypto_secretbox_NONCEBYTES:si,crypto_secretbox_ZEROBYTES:or,crypto_secretbox_BOXZEROBYTES:ai,crypto_scalarmult_BYTES:li,crypto_scalarmult_SCALARBYTES:$i,crypto_box_PUBLICKEYBYTES:oi,crypto_box_SECRETKEYBYTES:Or,crypto_box_BEFORENMBYTES:Yi,crypto_box_NONCEBYTES:ka,crypto_box_ZEROBYTES:Xl,crypto_box_BOXZEROBYTES:yr,crypto_sign_BYTES:Ct,crypto_sign_PUBLICKEYBYTES:qt,crypto_sign_SECRETKEYBYTES:On,crypto_sign_SEEDBYTES:Gi,crypto_hash_BYTES:Ca,gf:r,D:d,L:Nr,pack25519:A,unpack25519:je,M:Te,A:ze,S:Ae,Z:qe,pow2523:rt,add:Le,set25519:_,modL:ii,scalarmult:pt,scalarbase:Nn};function Kl(k,O){if(k.length!==gs)throw new Error("bad key size");if(O.length!==si)throw new Error("bad nonce size")}function Ql(k,O){if(k.length!==oi)throw new Error("bad public key size");if(O.length!==Or)throw new Error("bad secret key size")}function Zt(){for(var k=0;k<arguments.length;k++)if(!(arguments[k]instanceof Uint8Array))throw new TypeError("unexpected type, use Uint8Array")}function ys(k){for(var O=0;O<k.length;O++)k[O]=0}e.randomBytes=function(k){var O=new Uint8Array(k);return s(O,k),O},e.secretbox=function(k,O,j){Zt(k,O,j),Kl(j,O);for(var U=new Uint8Array(or+k.length),Y=new Uint8Array(U.length),ee=0;ee<k.length;ee++)U[ee+or]=k[ee];return ue(Y,U,U.length,O,j),Y.subarray(ai)},e.secretbox.open=function(k,O,j){Zt(k,O,j),Kl(j,O);for(var U=new Uint8Array(ai+k.length),Y=new Uint8Array(U.length),ee=0;ee<k.length;ee++)U[ee+ai]=k[ee];return U.length<32||xe(Y,U,U.length,O,j)!==0?null:Y.subarray(or)},e.secretbox.keyLength=gs,e.secretbox.nonceLength=si,e.secretbox.overheadLength=ai,e.scalarMult=function(k,O){if(Zt(k,O),k.length!==$i)throw new Error("bad n size");if(O.length!==li)throw new Error("bad p size");var j=new Uint8Array(li);return kt(j,k,O),j},e.scalarMult.base=function(k){if(Zt(k),k.length!==$i)throw new Error("bad n size");var O=new Uint8Array(li);return Ke(O,k),O},e.scalarMult.scalarLength=$i,e.scalarMult.groupElementLength=li,e.box=function(k,O,j,U){var Y=e.box.before(j,U);return e.secretbox(k,O,Y)},e.box.before=function(k,O){Zt(k,O),Ql(k,O);var j=new Uint8Array(Yi);return Fe(j,k,O),j},e.box.after=e.secretbox,e.box.open=function(k,O,j,U){var Y=e.box.before(j,U);return e.secretbox.open(k,O,Y)},e.box.open.after=e.secretbox.open,e.box.keyPair=function(){var k=new Uint8Array(oi),O=new Uint8Array(Or);return ot(k,O),{publicKey:k,secretKey:O}},e.box.keyPair.fromSecretKey=function(k){if(Zt(k),k.length!==Or)throw new Error("bad secret key size");var O=new Uint8Array(oi);return Ke(O,k),{publicKey:O,secretKey:new Uint8Array(k)}},e.box.publicKeyLength=oi,e.box.secretKeyLength=Or,e.box.sharedKeyLength=Yi,e.box.nonceLength=ka,e.box.overheadLength=e.secretbox.overheadLength,e.sign=function(k,O){if(Zt(k,O),O.length!==On)throw new Error("bad secret key size");var j=new Uint8Array(Ct+k.length);return Ii(j,k,k.length,O),j},e.sign.open=function(k,O){if(Zt(k,O),O.length!==qt)throw new Error("bad public key size");var j=new Uint8Array(k.length),U=Ea(j,k,k.length,O);if(U<0)return null;for(var Y=new Uint8Array(U),ee=0;ee<Y.length;ee++)Y[ee]=j[ee];return Y},e.sign.detached=function(k,O){for(var j=e.sign(k,O),U=new Uint8Array(Ct),Y=0;Y<U.length;Y++)U[Y]=j[Y];return U},e.sign.detached.verify=function(k,O,j){if(Zt(k,O,j),O.length!==Ct)throw new Error("bad signature size");if(j.length!==qt)throw new Error("bad public key size");var U=new Uint8Array(Ct+k.length),Y=new Uint8Array(Ct+k.length),ee;for(ee=0;ee<Ct;ee++)U[ee]=O[ee];for(ee=0;ee<k.length;ee++)U[ee+Ct]=k[ee];return Ea(Y,U,U.length,j)>=0},e.sign.keyPair=function(){var k=new Uint8Array(qt),O=new Uint8Array(On);return ri(k,O),{publicKey:k,secretKey:O}},e.sign.keyPair.fromSecretKey=function(k){if(Zt(k),k.length!==On)throw new Error("bad secret key size");for(var O=new Uint8Array(qt),j=0;j<O.length;j++)O[j]=k[32+j];return{publicKey:O,secretKey:new Uint8Array(k)}},e.sign.keyPair.fromSeed=function(k){if(Zt(k),k.length!==Gi)throw new Error("bad seed size");for(var O=new Uint8Array(qt),j=new Uint8Array(On),U=0;U<32;U++)j[U]=k[U];return ri(O,j,!0),{publicKey:O,secretKey:j}},e.sign.publicKeyLength=qt,e.sign.secretKeyLength=On,e.sign.seedLength=Gi,e.sign.signatureLength=Ct,e.hash=function(k){Zt(k);var O=new Uint8Array(Ca);return ge(O,k,k.length),O},e.hash.hashLength=Ca,e.verify=function(k,O){return Zt(k,O),k.length===0||O.length===0||k.length!==O.length?!1:T(k,0,O,0,k.length)===0},e.setPRNG=function(k){s=k},(function(){var k=typeof globalThis<"u"?globalThis.crypto||globalThis.msCrypto:null;if(k&&k.getRandomValues){var O=65536;e.setPRNG(function(j,U){var Y,ee=new Uint8Array(U);for(Y=0;Y<U;Y+=O)k.getRandomValues(ee.subarray(Y,Y+Math.min(U-Y,O)));for(Y=0;Y<U;Y++)j[Y]=ee[Y];ys(ee)})}else typeof require<"u"&&(k=require("crypto"),k&&k.randomBytes&&e.setPRNG(function(j,U){var Y,ee=k.randomBytes(U);for(Y=0;Y<U;Y++)j[Y]=ee[Y];ys(ee)}))})()})(typeof module<"u"&&module.exports?module.exports:globalThis.nacl=globalThis.nacl||{});const hu=typeof module<"u"&&module.exports?module.exports:globalThis.nacl,q2={fromSeed:hu.sign.keyPair.fromSeed,sign:hu.sign.detached,verify:hu.sign.detached.verify,randomBytes:hu.randomBytes};let mx;function H2(e){mx=e}function Di(){return mx}const I2=new Uint16Array([0,4129,8258,12387,16516,20645,24774,28903,33032,37161,41290,45419,49548,53677,57806,61935,4657,528,12915,8786,21173,17044,29431,25302,37689,33560,45947,41818,54205,50076,62463,58334,9314,13379,1056,5121,25830,29895,17572,21637,42346,46411,34088,38153,58862,62927,50604,54669,13907,9842,5649,1584,30423,26358,22165,18100,46939,42874,38681,34616,63455,59390,55197,51132,18628,22757,26758,30887,2112,6241,10242,14371,51660,55789,59790,63919,35144,39273,43274,47403,23285,19156,31415,27286,6769,2640,14899,10770,56317,52188,64447,60318,39801,35672,47931,43802,27814,31879,19684,23749,11298,15363,3168,7233,60846,64911,52716,56781,44330,48395,36200,40265,32407,28342,24277,20212,15891,11826,7761,3696,65439,61374,57309,53244,48923,44858,40793,36728,37256,33193,45514,41451,53516,49453,61774,57711,4224,161,12482,8419,20484,16421,28742,24679,33721,37784,41979,46042,49981,54044,58239,62302,689,4752,8947,13010,16949,21012,25207,29270,46570,42443,38312,34185,62830,58703,54572,50445,13538,9411,5280,1153,29798,25671,21540,17413,42971,47098,34713,38840,59231,63358,50973,55100,9939,14066,1681,5808,26199,30326,17941,22068,55628,51565,63758,59695,39368,35305,47498,43435,22596,18533,30726,26663,6336,2273,14466,10403,52093,56156,60223,64286,35833,39896,43963,48026,19061,23124,27191,31254,2801,6864,10931,14994,64814,60687,56684,52557,48554,44427,40424,36297,31782,27655,23652,19525,15522,11395,7392,3265,61215,65342,53085,57212,44955,49082,36825,40952,28183,32310,20053,24180,11923,16050,3793,7920]);class Mu{static checksum(n){let r=0;for(let s=0;s<n.byteLength;s++){let l=n[s];r=r<<8&65535^I2[(r>>8^l)&255]}return r}static validate(n,r){return Mu.checksum(n)==r}}const _h="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";class _0{static encode(n){let r=0,s=0,l=new Uint8Array(n),u=new Uint8Array(n.byteLength*2),c=0;for(let f=0;f<l.byteLength;f++)for(s=s<<8|l[f],r+=8;r>=5;){let m=s>>>r-5&31;u[c++]=_h.charAt(m).charCodeAt(0),r-=5}if(r>0){let f=s<<5-r&31;u[c++]=_h.charAt(f).charCodeAt(0)}return u.slice(0,c)}static decode(n){let r=0,s=0,l=0,u=new Uint8Array(n),c=new Uint8Array(u.byteLength*5/8|0);for(let f=0;f<u.byteLength;f++){let m=String.fromCharCode(u[f]),d=_h.indexOf(m);if(d===-1)throw new Error("Illegal Base32 character: "+u[f]);s=s<<5|d,r+=5,r>=8&&(c[l++]=s>>>r-8&255,r-=8)}return c.slice(0,l)}}class Et extends Error{constructor(r,s){super(r);C(this,"name");C(this,"code");C(this,"chainedError");this.name="NKeysError",this.code=r,this.chainedError=s}}function F2(){return Vu(_t.Operator)}function $2(){return Vu(_t.Account)}function Y2(){return Vu(_t.User)}var gt;(function(e){e.InvalidPrefixByte="nkeys: invalid prefix byte",e.InvalidKey="nkeys: invalid key",e.InvalidPublicKey="nkeys: invalid public key",e.InvalidSeedLen="nkeys: invalid seed length",e.InvalidSeed="nkeys: invalid seed",e.InvalidEncoding="nkeys: invalid encoded key",e.InvalidSignature="nkeys: signature verification failed",e.CannotSign="nkeys: cannot sign, no private key available",e.PublicKeyOnly="nkeys: no seed or private key available",e.InvalidChecksum="nkeys: invalid checksum",e.SerializationError="nkeys: serialization error",e.ApiError="nkeys: api error",e.ClearedPair="nkeys: pair is cleared"})(gt||(gt={}));var _t;(function(e){e[e.Seed=144]="Seed",e[e.Private=120]="Private",e[e.Operator=112]="Operator",e[e.Server=104]="Server",e[e.Cluster=16]="Cluster",e[e.Account=0]="Account",e[e.User=160]="User"})(_t||(_t={}));class ra{static isValidPublicPrefix(n){return n==_t.Server||n==_t.Operator||n==_t.Cluster||n==_t.Account||n==_t.User}static startsWithValidPrefix(n){let r=n[0];return r=="S"||r=="P"||r=="O"||r=="N"||r=="C"||r=="A"||r=="U"}static isValidPrefix(n){return this.parsePrefix(n)!=-1}static parsePrefix(n){switch(n){case _t.Seed:return _t.Seed;case _t.Private:return _t.Private;case _t.Operator:return _t.Operator;case _t.Server:return _t.Server;case _t.Cluster:return _t.Cluster;case _t.Account:return _t.Account;case _t.User:return _t.User;default:return-1}}}class gn{static encode(n,r){if(!r||!(r instanceof Uint8Array))throw new Et(gt.SerializationError);if(!ra.isValidPrefix(n))throw new Et(gt.InvalidPrefixByte);return gn._encode(!1,n,r)}static encodeSeed(n,r){if(!r)throw new Et(gt.ApiError);if(!ra.isValidPublicPrefix(n))throw new Et(gt.InvalidPrefixByte);if(r.byteLength!==32)throw new Et(gt.InvalidSeedLen);return gn._encode(!0,n,r)}static decode(n,r){if(!ra.isValidPrefix(n))throw new Et(gt.InvalidPrefixByte);const s=gn._decode(r);if(s[0]!==n)throw new Et(gt.InvalidPrefixByte);return s.slice(1)}static decodeSeed(n){const r=gn._decode(n),s=gn._decodePrefix(r);if(s[0]!=_t.Seed)throw new Et(gt.InvalidSeed);if(!ra.isValidPublicPrefix(s[1]))throw new Et(gt.InvalidPrefixByte);return{buf:r.slice(2),prefix:s[1]}}static _encode(n,r,s){const l=n?2:1,u=s.byteLength,c=l+u+2,f=l+u,m=new Uint8Array(c);if(n){const g=gn._encodePrefix(_t.Seed,r);m.set(g)}else m[0]=r;m.set(s,l);const d=Mu.checksum(m.slice(0,f));return new DataView(m.buffer).setUint16(f,d,!0),_0.encode(m)}static _decode(n){if(n.byteLength<4)throw new Et(gt.InvalidEncoding);let r;try{r=_0.decode(n)}catch(f){throw new Et(gt.InvalidEncoding,f)}const s=r.byteLength-2,u=new DataView(r.buffer).getUint16(s,!0),c=r.slice(0,s);if(!Mu.validate(c,u))throw new Et(gt.InvalidChecksum);return c}static _encodePrefix(n,r){const s=n|r>>5,l=(r&31)<<3;return new Uint8Array([s,l])}static _decodePrefix(n){const r=n[0]&248,s=(n[0]&7)<<5|(n[1]&248)>>3;return new Uint8Array([r,s])}}class px{constructor(n){C(this,"seed");this.seed=n}getRawSeed(){if(!this.seed)throw new Et(gt.ClearedPair);return gn.decodeSeed(this.seed).buf}getSeed(){if(!this.seed)throw new Et(gt.ClearedPair);return this.seed}getPublicKey(){if(!this.seed)throw new Et(gt.ClearedPair);const n=gn.decodeSeed(this.seed),r=Di().fromSeed(this.getRawSeed()),s=gn.encode(n.prefix,r.publicKey);return new TextDecoder().decode(s)}getPrivateKey(){if(!this.seed)throw new Et(gt.ClearedPair);const n=Di().fromSeed(this.getRawSeed());return gn.encode(_t.Private,n.secretKey)}sign(n){if(!this.seed)throw new Et(gt.ClearedPair);const r=Di().fromSeed(this.getRawSeed());return Di().sign(n,r.secretKey)}verify(n,r){if(!this.seed)throw new Et(gt.ClearedPair);const s=Di().fromSeed(this.getRawSeed());return Di().verify(n,r,s.publicKey)}clear(){this.seed&&(this.seed.fill(0),this.seed=void 0)}}function Vu(e){const n=Di().randomBytes(32);let r=gn.encodeSeed(e,new Uint8Array(n));return new px(r)}class G2{constructor(n){C(this,"publicKey");this.publicKey=n}getPublicKey(){if(!this.publicKey)throw new Et(gt.ClearedPair);return new TextDecoder().decode(this.publicKey)}getPrivateKey(){throw this.publicKey?new Et(gt.PublicKeyOnly):new Et(gt.ClearedPair)}getSeed(){throw this.publicKey?new Et(gt.PublicKeyOnly):new Et(gt.ClearedPair)}sign(n){throw this.publicKey?new Et(gt.CannotSign):new Et(gt.ClearedPair)}verify(n,r){if(!this.publicKey)throw new Et(gt.ClearedPair);let s=gn._decode(this.publicKey);return Di().verify(n,r,s.slice(1))}clear(){this.publicKey&&(this.publicKey.fill(0),this.publicKey=void 0)}}function V2(e){const n=new TextEncoder().encode(e),r=gn._decode(n),s=ra.parsePrefix(r[0]);if(ra.isValidPublicPrefix(s))return new G2(n);throw new Et(gt.InvalidPublicKey)}function J2(e){return gn.decodeSeed(e),new px(e)}function X2(e){return btoa(String.fromCharCode(...e))}function K2(e){const n=atob(e),r=new Uint8Array(n.length);for(let s=0;s<n.length;s++)r[s]=n.charCodeAt(s);return r}H2(q2);const E0={createAccount:$2,createOperator:F2,createPair:Vu,createUser:Y2,fromPublic:V2,fromSeed:J2,NKeysError:Et,NKeysErrorCode:gt,Prefix:_t,decode:K2,encode:X2};function Q2(e){return n=>{let r={};return e.forEach(s=>{const l=s(n)||{};r=Object.assign(r,l)}),r}}function Z2(){return()=>{}}function W2(e,n){return()=>{const r=typeof e=="function"?e():e,s=typeof n=="function"?n():n;return{user:r,pass:s}}}function eE(e){return()=>({auth_token:typeof e=="function"?e():e})}function tE(e){return n=>{const r=typeof e=="function"?e():e,s=r?E0.fromSeed(r):void 0,l=s?s.getPublicKey():"",u=qi.encode(n||""),c=s!==void 0&&n?s.sign(u):void 0,f=c?E0.encode(c):"";return{nkey:l,sig:f}}}function gx(e,n){return r=>{const s=typeof e=="function"?e():e,l=tE(n),{nkey:u,sig:c}=l(r);return{jwt:s,nkey:u,sig:c}}}const yx=120*1e3,nE=2,bx=2*1e3;function rE(){return{maxPingOut:2,maxReconnectAttempts:10,noRandomize:!1,pedantic:!1,pingInterval:yx,reconnect:!0,reconnectJitter:100,reconnectJitterTLS:1e3,reconnectTimeWait:bx,tls:void 0,verbose:!1,waitOnFirstConnect:!1,ignoreAuthErrorAbort:!1}}function iE(e){const n=[];return typeof e.authenticator=="function"&&n.push(e.authenticator),Array.isArray(e.authenticator)&&n.push(...e.authenticator),e.token&&n.push(eE(e.token)),e.user&&n.push(W2(e.user,e.pass)),n.length===0?Z2():Q2(n)}function sE(e){const n=`${Zh}:${fx()}`;if(e=e||{servers:[n]},e.servers=e.servers||[],typeof e.servers=="string"&&(e.servers=[e.servers]),e.servers.length>0&&e.port)throw new Ne("port and servers options are mutually exclusive",_e.InvalidOption);e.servers.length===0&&e.port&&(e.servers=[`${Zh}:${e.port}`]),e.servers&&e.servers.length===0&&(e.servers=[n]);const r=$u(rE(),e);if(r.authenticator=iE(r),["reconnectDelayHandler","authenticator"].forEach(s=>{if(r[s]&&typeof r[s]!="function")throw new Ne(`${s} option should be a function`,_e.NotFunction)}),r.reconnectDelayHandler||(r.reconnectDelayHandler=()=>{let s=r.tls?r.reconnectJitterTLS:r.reconnectJitter;return s&&(s++,s=Math.floor(Math.random()*s)),r.reconnectTimeWait+s}),r.inboxPrefix)try{Zr(r.inboxPrefix)}catch(s){throw new Ne(s.message,_e.ApiError)}if(r.resolve===void 0&&(r.resolve=typeof sd()=="function"),r.resolve&&typeof sd()!="function")throw new Ne("'resolve' is not supported on this client",_e.InvalidOption);return r}function aE(e,n){const{proto:r,tls_required:s,tls_available:l}=e;if((r===void 0||r<1)&&n.noEcho)throw new Ne("noEcho",_e.ServerOptionNotAvailable);const u=s||l||!1;if(n.tls&&!u)throw new Ne("tls",_e.ServerOptionNotAvailable)}const lE=1024*32,oE=/^INFO\s+([^\r\n]+)\r\n/i,uE=Al(`PONG\r
72
+ `),k0=Al(`PING\r
73
+ `);class cE{constructor(n,r,s){C(this,"echo");C(this,"no_responders");C(this,"protocol");C(this,"verbose");C(this,"pedantic");C(this,"jwt");C(this,"nkey");C(this,"sig");C(this,"user");C(this,"pass");C(this,"auth_token");C(this,"tls_required");C(this,"name");C(this,"lang");C(this,"version");C(this,"headers");this.protocol=1,this.version=n.version,this.lang=n.lang,this.echo=r.noEcho?!1:void 0,this.verbose=r.verbose,this.pedantic=r.pedantic,this.tls_required=r.tls?!0:void 0,this.name=r.name;const l=(r&&typeof r.authenticator=="function"?r.authenticator(s):{})||{};$u(this,l)}}class xx extends nn{constructor(r,s,l={}){var c;super();C(this,"sid");C(this,"queue");C(this,"draining");C(this,"max");C(this,"subject");C(this,"drained");C(this,"protocol");C(this,"timer");C(this,"info");C(this,"cleanupFn");C(this,"closed");C(this,"requestSubject");$u(this,l),this.protocol=r,this.subject=s,this.draining=!1,this.noIterator=typeof l.callback=="function",this.closed=zt();const u=!((c=r.options)!=null&&c.noAsyncTraces);l.timeout&&(this.timer=ha(l.timeout,u),this.timer.then(()=>{this.timer=void 0}).catch(f=>{this.stop(f),this.noIterator&&this.callback(f,{})})),this.noIterator||this.iterClosed.then(()=>{this.closed.resolve(),this.unsubscribe()})}setPrePostHandlers(r){if(this.noIterator){const s=this.callback,l=r.ingestionFilterFn?r.ingestionFilterFn:()=>({ingest:!0,protocol:!1}),u=r.protocolFilterFn?r.protocolFilterFn:()=>!0,c=r.dispatchedFn?r.dispatchedFn:()=>{};this.callback=(f,m)=>{const{ingest:d}=l(m);d&&u(m)&&(s(f,m),c(m))}}else this.protocolFilterFn=r.protocolFilterFn,this.dispatchedFn=r.dispatchedFn}callback(r,s){this.cancelTimeout(),r?this.stop(r):this.push(s)}close(){if(!this.isClosed()){this.cancelTimeout();const r=()=>{if(this.stop(),this.cleanupFn)try{this.cleanupFn(this,this.info)}catch{}this.closed.resolve()};this.noIterator?r():this.push(r)}}unsubscribe(r){this.protocol.unsubscribe(this,r)}cancelTimeout(){this.timer&&(this.timer.cancel(),this.timer=void 0)}drain(){return this.protocol.isClosed()?Promise.reject(Ne.errorForCode(_e.ConnectionClosed)):this.isClosed()?Promise.reject(Ne.errorForCode(_e.SubClosed)):(this.drained||(this.draining=!0,this.protocol.unsub(this),this.drained=this.protocol.flush(zt()).then(()=>{this.protocol.subscriptions.cancel(this)}).catch(()=>{this.protocol.subscriptions.cancel(this)})),this.drained)}isDraining(){return this.draining}isClosed(){return this.done}getSubject(){return this.subject}getMax(){return this.max}getID(){return this.sid}}class fE{constructor(){C(this,"mux");C(this,"subs");C(this,"sidCounter");this.sidCounter=0,this.mux=null,this.subs=new Map}size(){return this.subs.size}add(n){return this.sidCounter++,n.sid=this.sidCounter,this.subs.set(n.sid,n),n}setMux(n){return this.mux=n,n}getMux(){return this.mux}get(n){return this.subs.get(n)}resub(n){return this.sidCounter++,this.subs.delete(n.sid),n.sid=this.sidCounter,this.subs.set(n.sid,n),n}all(){return Array.from(this.subs.values())}cancel(n){n&&(n.close(),this.subs.delete(n.sid))}handleError(n){if(n&&n.permissionContext){const r=n.permissionContext,s=this.all();let l;if(r.operation==="subscription"&&(l=s.find(u=>u.subject===r.subject&&u.queue===r.queue)),r.operation==="publish"&&(l=s.find(u=>u.requestSubject===r.subject)),l)return l.callback(n,{}),l.close(),this.subs.delete(l.sid),l!==this.mux}return!1}close(){this.subs.forEach(n=>{n.close()})}}class Du{constructor(n,r){C(this,"connected");C(this,"connectedOnce");C(this,"infoReceived");C(this,"info");C(this,"muxSubscriptions");C(this,"options");C(this,"outbound");C(this,"pongs");C(this,"subscriptions");C(this,"transport");C(this,"noMorePublishing");C(this,"connectError");C(this,"publisher");C(this,"_closed");C(this,"closed");C(this,"listeners");C(this,"heartbeats");C(this,"parser");C(this,"outMsgs");C(this,"inMsgs");C(this,"outBytes");C(this,"inBytes");C(this,"pendingLimit");C(this,"lastError");C(this,"abortReconnect");C(this,"whyClosed");C(this,"servers");C(this,"server");C(this,"features");C(this,"connectPromise");this._closed=!1,this.connected=!1,this.connectedOnce=!1,this.infoReceived=!1,this.noMorePublishing=!1,this.abortReconnect=!1,this.listeners=[],this.pendingLimit=lE,this.outMsgs=0,this.inMsgs=0,this.outBytes=0,this.inBytes=0,this.options=n,this.publisher=r,this.subscriptions=new fE,this.muxSubscriptions=new L2,this.outbound=new ma,this.pongs=[],this.whyClosed="",this.pendingLimit=n.pendingLimit||this.pendingLimit,this.features=new p2({major:0,minor:0,micro:0}),this.connectPromise=null;const s=typeof n.servers=="string"?[n.servers]:n.servers;this.servers=new D2(s,{randomize:!n.noRandomize}),this.closed=zt(),this.parser=new S0(this),this.heartbeats=new z2(this,this.options.pingInterval||yx,this.options.maxPingOut||nE)}resetOutbound(){this.outbound.reset();const n=this.pongs;this.pongs=[];const r=Ne.errorForCode(_e.Disconnect);r.stack="",n.forEach(s=>{s.reject(r)}),this.parser=new S0(this),this.infoReceived=!1}dispatchStatus(n){this.listeners.forEach(r=>{r.push(n)})}status(){const n=new nn;return this.listeners.push(n),n}prepare(){this.transport&&this.transport.discard(),this.info=void 0,this.resetOutbound();const n=zt();return n.catch(()=>{}),this.pongs.unshift(n),this.connectError=r=>{n.reject(r)},this.transport=b2(),this.transport.closed().then(async r=>{if(this.connected=!1,!this.isClosed()){await this.disconnected(this.transport.closeError||this.lastError);return}}),n}disconnect(){this.dispatchStatus({type:ia.StaleConnection,data:""}),this.transport.disconnect()}reconnect(){return this.connected&&(this.dispatchStatus({type:ia.ClientInitiatedReconnect,data:""}),this.transport.disconnect()),Promise.resolve()}async disconnected(n){this.dispatchStatus({type:Kr.Disconnect,data:this.servers.getCurrentServer().toString()}),this.options.reconnect?await this.dialLoop().then(()=>{var r;this.dispatchStatus({type:Kr.Reconnect,data:this.servers.getCurrentServer().toString()}),((r=this.lastError)==null?void 0:r.code)===_e.AuthenticationExpired&&(this.lastError=void 0)}).catch(r=>{this._close(r)}):await this._close(n)}async dial(n){const r=this.prepare();let s;try{s=ha(this.options.timeout||2e4);const l=this.transport.connect(n,this.options);await Promise.race([l,s]),(async()=>{try{for await(const u of this.transport)this.parser.parse(u)}catch(u){console.log("reader closed",u)}})().then()}catch(l){r.reject(l)}try{await Promise.race([s,r]),s&&s.cancel(),this.connected=!0,this.connectError=void 0,this.sendSubscriptions(),this.connectedOnce=!0,this.server.didConnect=!0,this.server.reconnects=0,this.flushPending(),this.heartbeats.start()}catch(l){throw s&&s.cancel(),await this.transport.close(l),l}}async _doDial(n){const{resolve:r}=this.options,s=await n.resolve({fn:sd(),debug:this.options.debug,randomize:!this.options.noRandomize,resolve:r});let l=null;for(const u of s)try{l=null,this.dispatchStatus({type:ia.Reconnecting,data:u.toString()}),await this.dial(u);return}catch(c){l=c}throw l}dialLoop(){return this.connectPromise===null&&(this.connectPromise=this.dodialLoop(),this.connectPromise.then(()=>{}).catch(()=>{}).finally(()=>{this.connectPromise=null})),this.connectPromise}async dodialLoop(){let n;for(;;){this._closed&&this.servers.clear();const r=this.options.reconnectDelayHandler?this.options.reconnectDelayHandler():bx;let s=r;const l=this.selectServer();if(!l||this.abortReconnect)throw n||(this.lastError?this.lastError:Ne.errorForCode(_e.ConnectionRefused));const u=Date.now();if(l.lastConnect===0||l.lastConnect+r<=u){l.lastConnect=Date.now();try{await this._doDial(l);break}catch(c){if(n=c,!this.connectedOnce){if(this.options.waitOnFirstConnect)continue;this.servers.removeCurrentServer()}l.reconnects++;const f=this.options.maxReconnectAttempts||0;f!==-1&&l.reconnects>=f&&this.servers.removeCurrentServer()}}else s=Math.min(s,l.lastConnect+r-u),await va(s)}}static async connect(n,r){const s=new Du(n,r);return await s.dialLoop(),s}static toError(n){const r=n?n.toLowerCase():"";if(r.indexOf("permissions violation")!==-1){const s=new Ne(n,_e.PermissionsViolation),l=n.match(/(Publish|Subscription) to "(\S+)"/);if(l){s.permissionContext={operation:l[1].toLowerCase(),subject:l[2],queue:void 0};const u=n.match(/using queue "(\S+)"/);u&&(s.permissionContext.queue=u[1])}return s}else return r.indexOf("authorization violation")!==-1?new Ne(n,_e.AuthorizationViolation):r.indexOf("user authentication expired")!==-1?new Ne(n,_e.AuthenticationExpired):r.indexOf("account authentication expired")!=-1?new Ne(n,_e.AccountExpired):r.indexOf("authentication timeout")!==-1?new Ne(n,_e.AuthenticationTimeout):new Ne(n,_e.ProtocolError)}processMsg(n,r){if(this.inMsgs++,this.inBytes+=r.length,!this.subscriptions.sidCounter)return;const s=this.subscriptions.get(n.sid);s&&(s.received+=1,s.callback&&s.callback(null,new Md(n,r,this)),s.max!==void 0&&s.received>=s.max&&s.unsubscribe())}processError(n){const r=l0(n),s=Du.toError(r),l={type:Kr.Error,data:s.code};if(s.isPermissionError()){let u=!1;if(s.permissionContext){l.permissionContext=s.permissionContext;const c=this.subscriptions.getMux();u=(c==null?void 0:c.subject)===s.permissionContext.subject}this.subscriptions.handleError(s),this.muxSubscriptions.handleError(u,s),u&&this.subscriptions.setMux(null)}this.dispatchStatus(l),this.handleError(s)}handleError(n){n.isAuthError()?this.handleAuthError(n):n.isProtocolError()?this.lastError=n:n.isAuthTimeout()&&(this.lastError=n),n.isPermissionError()||(this.lastError=n)}handleAuthError(n){this.lastError&&n.code===this.lastError.code&&this.options.ignoreAuthErrorAbort===!1&&(this.abortReconnect=!0),this.connectError?this.connectError(n):this.disconnect()}processPing(){this.transport.send(uE)}processPong(){const n=this.pongs.shift();n&&n.resolve()}processInfo(n){const r=JSON.parse(l0(n));this.info=r;const s=this.options&&this.options.ignoreClusterUpdates?void 0:this.servers.update(r,this.transport.isEncrypted());if(!this.infoReceived){this.features.update(fs(r.version)),this.infoReceived=!0,this.transport.isEncrypted()&&this.servers.updateTLSName();const{version:u,lang:c}=this.transport;try{const f=new cE({version:u,lang:c},this.options,r.nonce);r.headers&&(f.headers=!0,f.no_responders=!0);const m=JSON.stringify(f);this.transport.send(Al(`CONNECT ${m}${Su}`)),this.transport.send(k0)}catch(f){this._close(f)}}s&&this.dispatchStatus({type:Kr.Update,data:s}),(r.ldm!==void 0?r.ldm:!1)&&this.dispatchStatus({type:Kr.LDM,data:this.servers.getCurrentServer().toString()})}push(n){switch(n.kind){case pn.MSG:{const{msg:r,data:s}=n;this.processMsg(r,s);break}case pn.OK:break;case pn.ERR:this.processError(n.data);break;case pn.PING:this.processPing();break;case pn.PONG:this.processPong();break;case pn.INFO:this.processInfo(n.data);break}}sendCommand(n,...r){const s=this.outbound.length();let l;typeof n=="string"?l=Al(n):l=n,this.outbound.fill(l,...r),s===0?queueMicrotask(()=>{this.flushPending()}):this.outbound.size()>=this.pendingLimit&&this.flushPending()}publish(n,r=Yn,s){let l;if(r instanceof Uint8Array)l=r;else if(typeof r=="string")l=qi.encode(r);else throw Ne.errorForCode(_e.BadPayload);let u=l.length;s=s||{},s.reply=s.reply||"";let c=Yn,f=0;if(s.headers){if(this.info&&!this.info.headers)throw new Ne("headers",_e.ServerOptionNotAvailable);c=s.headers.encode(),f=c.length,u=l.length+f}if(this.info&&u>this.info.max_payload)throw Ne.errorForCode(_e.MaxPayloadExceeded);this.outBytes+=u,this.outMsgs++;let m;s.headers?(s.reply?m=`HPUB ${n} ${s.reply} ${f} ${u}\r
74
+ `:m=`HPUB ${n} ${f} ${u}\r
75
+ `,this.sendCommand(m,c,l,Ru)):(s.reply?m=`PUB ${n} ${s.reply} ${u}\r
76
+ `:m=`PUB ${n} ${u}\r
77
+ `,this.sendCommand(m,l,Ru))}request(n){return this.initMux(),this.muxSubscriptions.add(n),n}subscribe(n){return this.subscriptions.add(n),this._subunsub(n),n}_sub(n){n.queue?this.sendCommand(`SUB ${n.subject} ${n.queue} ${n.sid}\r
78
+ `):this.sendCommand(`SUB ${n.subject} ${n.sid}\r
79
+ `)}_subunsub(n){return this._sub(n),n.max&&this.unsubscribe(n,n.max),n}unsubscribe(n,r){this.unsub(n,r),(n.max===void 0||n.received>=n.max)&&this.subscriptions.cancel(n)}unsub(n,r){!n||this.isClosed()||(r?this.sendCommand(`UNSUB ${n.sid} ${r}\r
80
+ `):this.sendCommand(`UNSUB ${n.sid}\r
81
+ `),n.max=r)}resub(n,r){!n||this.isClosed()||(this.unsub(n),n.subject=r,this.subscriptions.resub(n),this._sub(n))}flush(n){return n||(n=zt()),this.pongs.push(n),this.outbound.fill(k0),this.flushPending(),n}sendSubscriptions(){const n=[];this.subscriptions.all().forEach(r=>{const s=r;s.queue?n.push(`SUB ${s.subject} ${s.queue} ${s.sid}${Su}`):n.push(`SUB ${s.subject} ${s.sid}${Su}`)}),n.length&&this.transport.send(Al(n.join("")))}async _close(n){this._closed||(this.whyClosed=new Error("close trace").stack||"",this.heartbeats.cancel(),this.connectError&&(this.connectError(n),this.connectError=void 0),this.muxSubscriptions.close(),this.subscriptions.close(),this.listeners.forEach(r=>{r.stop()}),this._closed=!0,await this.transport.close(n),await this.closed.resolve(n))}close(){return this._close()}isClosed(){return this._closed}drain(){const n=this.subscriptions.all(),r=[];return n.forEach(s=>{r.push(s.drain())}),Promise.all(r).then(async()=>(this.noMorePublishing=!0,await this.flush(),this.close())).catch(()=>{})}flushPending(){if(!(!this.infoReceived||!this.connected)&&this.outbound.size()){const n=this.outbound.drain();this.transport.send(n)}}initMux(){if(!this.subscriptions.getMux()){const r=this.muxSubscriptions.init(this.options.inboxPrefix),s=new xx(this,`${r}*`);s.callback=this.muxSubscriptions.dispatcher(),this.subscriptions.setMux(s),this.subscribe(s)}}selectServer(){const n=this.servers.selectServer();if(n!==void 0)return this.server=n,this.server}getServer(){return this.server}}const hE="$SRV";class C0{constructor(n){C(this,"msg");this.msg=n}get data(){return this.msg.data}get sid(){return this.msg.sid}get subject(){return this.msg.subject}get reply(){return this.msg.reply||""}get headers(){return this.msg.headers}respond(n,r){return this.msg.respond(n,r)}respondError(n,r,s,l){var u,c;return l=l||{},l.headers=l.headers||ei(),(u=l.headers)==null||u.set(Au,`${n}`),(c=l.headers)==null||c.set(Cu,r),this.msg.respond(s,l)}json(n){return this.msg.json(n)}string(){return this.msg.string()}}class zl{constructor(n,r="",s=""){C(this,"subject");C(this,"queue");C(this,"srv");r!==""&&mE("service group",r);let l="";if(n instanceof Yl)this.srv=n,l="";else if(n instanceof zl){const u=n;this.srv=u.srv,s===""&&u.queue!==""&&(s=u.queue),l=u.subject}else throw new Error("unknown ServiceGroup type");this.subject=this.calcSubject(l,r),this.queue=s}calcSubject(n,r=""){return r===""?n:n!==""?`${n}.${r}`:r}addEndpoint(n="",r){r=r||{subject:n};const s=typeof r=="function"?{handler:r,subject:n}:r;kl("endpoint",n);let{subject:l,handler:u,metadata:c,queue:f}=s;l=l||n,f=f||this.queue,dE("endpoint subject",l),l=this.calcSubject(this.subject,l);const m={name:n,subject:l,queue:f,handler:u,metadata:c};return this.srv._addEndpoint(m)}addGroup(n="",r=""){return new zl(this,n,r)}}function dE(e,n){if(n==="")throw new Error(`${e} cannot be empty`);if(n.indexOf(" ")!==-1)throw new Error(`${e} cannot contain spaces: '${n}'`);const r=n.split(".");r.forEach((s,l)=>{if(s===">"&&l!==r.length-1)throw new Error(`${e} cannot have internal '>': '${n}'`)})}function mE(e,n){if(n.indexOf(" ")!==-1)throw new Error(`${e} cannot contain spaces: '${n}'`);n.split(".").forEach(s=>{if(s===">")throw new Error(`${e} name cannot contain internal '>': '${n}'`)})}class Yl{constructor(n,r={name:"",version:""}){C(this,"nc");C(this,"_id");C(this,"config");C(this,"handlers");C(this,"internal");C(this,"_stopped");C(this,"_done");C(this,"started");this.nc=n,this.config=Object.assign({},r),this.config.queue||(this.config.queue="q"),kl("name",this.config.name),kl("queue",this.config.queue),fs(this.config.version),this._id=Bi.next(),this.internal=[],this._done=zt(),this._stopped=!1,this.handlers=[],this.started=new Date().toISOString(),this.reset(),this.nc.closed().then(()=>{this.close().catch()}).catch(s=>{this.close(s).catch()})}static controlSubject(n,r="",s="",l){const u=l??hE;return r===""&&s===""?`${u}.${n}`:(kl("control subject name",r),s!==""?(kl("control subject id",s),`${u}.${n}.${r}.${s}`):`${u}.${n}.${r}`)}get subjects(){return this.handlers.filter(n=>n.internal===!1).map(n=>n.subject)}get id(){return this._id}get name(){return this.config.name}get description(){return this.config.description??""}get version(){return this.config.version}get metadata(){return this.config.metadata}errorToHeader(n){const r=ei();if(n instanceof Tu){const s=n;r.set(Cu,s.message),r.set(Au,`${s.code}`)}else r.set(Cu,n.message),r.set(Au,"500");return r}setupHandler(n,r=!1){const s=r?"":n.queue?n.queue:this.config.queue,{name:l,subject:u,handler:c}=n,f=n;f.internal=r,r&&this.internal.push(f),f.stats=new pE(l,u,s),f.queue=s;const m=c?(d,y)=>{if(d){this.close(d);return}const g=Date.now();try{c(d,new C0(y))}catch(x){f.stats.countError(x),y==null||y.respond(Yn,{headers:this.errorToHeader(x)})}finally{f.stats.countLatency(g)}}:void 0;return f.sub=this.nc.subscribe(u,{callback:m,queue:s}),f.sub.closed.then(()=>{this._stopped||this.close(new Error(`required subscription ${n.subject} stopped`)).catch()}).catch(d=>{if(!this._stopped){const y=new Error(`required subscription ${n.subject} errored: ${d.message}`);y.stack=d.stack,this.close(y).catch()}}),f}info(){return{type:Tl.INFO,name:this.name,id:this.id,version:this.version,description:this.description,metadata:this.metadata,endpoints:this.endpoints()}}endpoints(){return this.handlers.map(n=>{const{subject:r,metadata:s,name:l,queue:u}=n;return{subject:r,metadata:s,name:l,queue_group:u}})}async stats(){const n=[];for(const r of this.handlers){if(typeof this.config.statsHandler=="function")try{r.stats.data=await this.config.statsHandler(r)}catch(s){r.stats.countError(s)}n.push(r.stats.stats(r.qi))}return{type:Tl.STATS,name:this.name,id:this.id,version:this.version,started:this.started,metadata:this.metadata,endpoints:n}}addInternalHandler(n,r){const s=`${n}`.toUpperCase();this._doAddInternalHandler(`${s}-all`,n,r),this._doAddInternalHandler(`${s}-kind`,n,r,this.name),this._doAddInternalHandler(`${s}`,n,r,this.name,this.id)}_doAddInternalHandler(n,r,s,l="",u=""){const c={};c.name=n,c.subject=Yl.controlSubject(r,l,u),c.handler=s,this.setupHandler(c,!0)}start(){const n=pr(),r=(c,f)=>c?(this.close(c),Promise.reject(c)):this.stats().then(m=>(f==null||f.respond(n.encode(m)),Promise.resolve())),s=(c,f)=>c?(this.close(c),Promise.reject(c)):(f==null||f.respond(n.encode(this.info())),Promise.resolve()),l=n.encode(this.ping()),u=(c,f)=>c?(this.close(c).then().catch(),Promise.reject(c)):(f.respond(l),Promise.resolve());return this.addInternalHandler(Li.PING,u),this.addInternalHandler(Li.STATS,r),this.addInternalHandler(Li.INFO,s),this.handlers.forEach(c=>{const{subject:f}=c;typeof f=="string"&&c.handler!==null&&this.setupHandler(c)}),Promise.resolve(this)}close(n){if(this._stopped)return this._done;this._stopped=!0;let r=[];return this.nc.isClosed()||(r=this.handlers.concat(this.internal).map(s=>s.sub.drain())),Promise.allSettled(r).then(()=>{this._done.resolve(n||null)}),this._done}get stopped(){return this._done}get isStopped(){return this._stopped}stop(n){return this.close(n)}ping(){return{type:Tl.PING,name:this.name,id:this.id,version:this.version,metadata:this.metadata}}reset(){if(this.started=new Date().toISOString(),this.handlers)for(const n of this.handlers)n.stats.reset(n.qi)}addGroup(n,r){return new zl(this,n,r)}addEndpoint(n,r){return new zl(this).addEndpoint(n,r)}_addEndpoint(n){const r=new nn;r.noIterator=typeof n.handler=="function",r.noIterator||(n.handler=(l,u)=>{l?this.stop(l).catch():r.push(new C0(u))},r.iterClosed.then(()=>{this.close().catch()}));const s=this.setupHandler(n,!1);return s.qi=r,this.handlers.push(s),r}}class pE{constructor(n,r,s=""){C(this,"name");C(this,"subject");C(this,"average_processing_time");C(this,"num_requests");C(this,"processing_time");C(this,"num_errors");C(this,"last_error");C(this,"data");C(this,"metadata");C(this,"queue");this.name=n,this.subject=r,this.average_processing_time=0,this.num_errors=0,this.num_requests=0,this.processing_time=0,this.queue=s}reset(n){this.num_requests=0,this.processing_time=0,this.average_processing_time=0,this.num_errors=0,this.last_error=void 0,this.data=void 0;const r=n;r&&(r.time=0,r.processed=0)}countLatency(n){this.num_requests++,this.processing_time+=Lt(Date.now()-n),this.average_processing_time=Math.round(this.processing_time/this.num_requests)}countError(n){this.num_errors++,this.last_error=n.message}_stats(){const{name:n,subject:r,average_processing_time:s,num_errors:l,num_requests:u,processing_time:c,last_error:f,data:m,queue:d}=this;return{name:n,subject:r,average_processing_time:s,num_errors:l,num_requests:u,processing_time:c,last_error:f,data:m,queue_group:d}}stats(n){const r=n;return(r==null?void 0:r.noIterator)===!1&&(this.processing_time=Lt(r.time),this.num_requests=r.processed,this.average_processing_time=this.processing_time>0&&this.num_requests>0?this.processing_time/this.num_requests:0),this._stats()}}class gE{constructor(n,r={strategy:mr.JitterTimer,maxWait:2e3},s){C(this,"nc");C(this,"prefix");C(this,"opts");this.nc=n,this.prefix=s,this.opts=r}ping(n="",r=""){return this.q(Li.PING,n,r)}stats(n="",r=""){return this.q(Li.STATS,n,r)}info(n="",r=""){return this.q(Li.INFO,n,r)}async q(n,r="",s=""){const l=new nn,u=pr(),c=Yl.controlSubject(n,r,s,this.prefix),f=await this.nc.requestMany(c,Yn,this.opts);return(async()=>{for await(const m of f)try{const d=u.decode(m.data);l.push(d)}catch(d){l.push(()=>{l.stop(d)})}l.push(()=>{l.stop()})})().catch(m=>{l.stop(m)}),l}}function vx(){return{key:{encode(e){return e},decode(e){return e}},value:{encode(e){return e},decode(e){return e}}}}function yE(){return{replicas:1,history:1,timeout:2e3,max_bytes:-1,maxValueSize:-1,codec:vx(),storage:nd.File}}const Lu="KV-Operation",A0="$KV",bE=/^[-/=.\w]+$/,xE=/^[-/=.>*\w]+$/,vE=/^[-\w]+$/;function wE(e){if(e.startsWith(".")||e.endsWith(".")||!bE.test(e))throw new Error(`invalid key: ${e}`)}function SE(e){if(e.startsWith(".")||e.endsWith(".")||!xE.test(e))throw new Error(`invalid key: ${e}`)}function _E(e){if(e.startsWith(".")||e.endsWith("."))throw new Error(`invalid key: ${e}`);const n=e.split(".");let r=!1;for(let s=0;s<n.length;s++)switch(n[s]){case"*":r=!0;break;case">":if(s!==n.length-1)throw new Error(`invalid key: ${e}`);r=!0;break}return r}function _u(e){if(!vE.test(e))throw new Error(`invalid bucket name: ${e}`)}var _r;(function(e){e.MsgIdHdr="Nats-Msg-Id",e.ExpectedStreamHdr="Nats-Expected-Stream",e.ExpectedLastSeqHdr="Nats-Expected-Last-Sequence",e.ExpectedLastMsgIdHdr="Nats-Expected-Last-Msg-Id",e.ExpectedLastSubjectSequenceHdr="Nats-Expected-Last-Subject-Sequence"})(_r||(_r={}));class Ul{constructor(n,r,s){C(this,"js");C(this,"jsm");C(this,"stream");C(this,"bucket");C(this,"direct");C(this,"codec");C(this,"prefix");C(this,"editPrefix");C(this,"useJsPrefix");C(this,"_prefixLen");C(this,"validateKey",wE);C(this,"validateSearchKey",SE);C(this,"hasWildcards",_E);_u(n),this.js=r,this.jsm=s,this.bucket=n,this.prefix=A0,this.editPrefix="",this.useJsPrefix=!1,this._prefixLen=0}static async create(n,r,s={}){_u(r);const l=await n.jetstreamManager(),u=new Ul(r,n,l);return await u.init(s),u}static async bind(n,r,s={}){const l=await n.jetstreamManager(),u={config:{allow_direct:s.allow_direct}};_u(r);const c=new Ul(r,n,l);return u.config.name=s.streamName??c.bucketName(),Object.assign(c,u),c.stream=u.config.name,c.codec=s.codec||vx(),c.direct=u.config.allow_direct??!1,c.initializePrefixes(u),c}async init(n={}){const r=Object.assign(yE(),n);this.codec=r.codec;const s={};this.stream=s.name=n.streamName??this.bucketName(),s.retention=td.Limits,s.max_msgs_per_subject=r.history,r.maxBucketSize&&(r.max_bytes=r.maxBucketSize),r.max_bytes&&(s.max_bytes=r.max_bytes),s.max_msg_size=r.maxValueSize,s.storage=r.storage;const l=n.placementCluster??"";if(l&&(n.placement={},n.placement.cluster=l,n.placement.tags=[]),n.placement&&(s.placement=n.placement),n.republish&&(s.republish=n.republish),n.description&&(s.description=n.description),n.mirror){const g=Object.assign({},n.mirror);g.name.startsWith(Hn)||(g.name=`${Hn}${g.name}`),s.mirror=g,s.mirror_direct=!0}else if(n.sources){const g=n.sources.map(x=>{const w=Object.assign({},x),S=w.name.startsWith(Hn)?w.name.substring(Hn.length):w.name;return w.name.startsWith(Hn)||(w.name=`${Hn}${w.name}`),!x.external&&S!==this.bucket&&(w.subject_transforms=[{src:`$KV.${S}.>`,dest:`$KV.${this.bucket}.>`}]),w});s.sources=g,s.subjects=[this.subjectForBucket()]}else s.subjects=[this.subjectForBucket()];n.metadata&&(s.metadata=n.metadata),typeof n.compression=="boolean"&&(s.compression=n.compression?Pi.S2:Pi.None);const u=this.js.nc,c=u.getServerVersion(),f=c?id(c,fs("2.7.2"))>=0:!1;s.discard=f?Ll.New:Ll.Old;const{ok:m,min:d}=u.features.get(ut.JS_ALLOW_DIRECT);if(!m&&n.allow_direct===!0){const g=c?`${c.major}.${c.minor}.${c.micro}`:"unknown";return Promise.reject(new Error(`allow_direct is not available on server version ${g} - requires ${d}`))}n.allow_direct=typeof n.allow_direct=="boolean"?n.allow_direct:m,s.allow_direct=n.allow_direct,this.direct=s.allow_direct,s.num_replicas=r.replicas,r.ttl&&(s.max_age=Lt(r.ttl)),s.allow_rollup_hdrs=!0;let y;try{y=await this.jsm.streams.info(s.name),!y.config.allow_direct&&this.direct===!0&&(this.direct=!1)}catch(g){if(g.message==="stream not found")y=await this.jsm.streams.add(s);else throw g}this.initializePrefixes(y)}initializePrefixes(n){this._prefixLen=0,this.prefix=`$KV.${this.bucket}`,this.useJsPrefix=this.js.apiPrefix!=="$JS.API";const{mirror:r}=n.config;if(r){let s=r.name;if(s.startsWith(Hn)&&(s=s.substring(Hn.length)),r.external&&r.external.api!==""){const l=r.name.substring(Hn.length);this.useJsPrefix=!1,this.prefix=`$KV.${l}`,this.editPrefix=`${r.external.api}.$KV.${s}`}else this.editPrefix=this.prefix}}bucketName(){return this.stream??`${Hn}${this.bucket}`}subjectForBucket(){return`${this.prefix}.${this.bucket}.>`}subjectForKey(n,r=!1){const s=[];return r?(this.useJsPrefix&&s.push(this.js.apiPrefix),this.editPrefix!==""?s.push(this.editPrefix):s.push(this.prefix)):this.prefix&&s.push(this.prefix),s.push(n),s.join(".")}fullKeyName(n){return this.prefix!==""?`${this.prefix}.${n}`:`${A0}.${this.bucket}.${n}`}get prefixLen(){return this._prefixLen===0&&(this._prefixLen=this.prefix.length+1),this._prefixLen}encodeKey(n){const r=[];for(const s of n.split("."))switch(s){case">":case"*":r.push(s);break;default:r.push(this.codec.key.encode(s));break}return r.join(".")}decodeKey(n){const r=[];for(const s of n.split("."))switch(s){case">":case"*":r.push(s);break;default:r.push(this.codec.key.decode(s));break}return r.join(".")}close(){return Promise.resolve()}dataLen(n,r){const s=r&&r.get(bn.MessageSizeHdr)||"";return s!==""?parseInt(s,10):n.length}smToEntry(n){return new BE(this.bucket,this.prefixLen,n)}jmToEntry(n){const r=this.decodeKey(n.subject.substring(this.prefixLen));return new PE(this.bucket,r,n)}async create(n,r){var u;let s;try{const c=await this.put(n,r,{previousSeq:0});return Promise.resolve(c)}catch(c){if(s=c,((u=c==null?void 0:c.api_error)==null?void 0:u.err_code)!==10071)return Promise.reject(c)}let l=0;try{const c=await this.get(n);return(c==null?void 0:c.operation)==="DEL"||(c==null?void 0:c.operation)==="PURGE"?(l=c!==null?c.revision:0,this.update(n,r,l)):Promise.reject(s)}catch(c){return Promise.reject(c)}}update(n,r,s){if(s<=0)throw new Error("version must be greater than 0");return this.put(n,r,{previousSeq:s})}async put(n,r,s={}){var c,f;const l=this.encodeKey(n);this.validateKey(l);const u={};if(s.previousSeq!==void 0){const m=ei();u.headers=m,m.set(_r.ExpectedLastSubjectSequenceHdr,`${s.previousSeq}`)}try{return(await this.js.publish(this.subjectForKey(l,!0),r,u)).seq}catch(m){const d=m;return d.isJetStreamError()?(d.message=(c=d.api_error)==null?void 0:c.description,d.code=`${(f=d.api_error)==null?void 0:f.code}`,Promise.reject(d)):Promise.reject(m)}}async get(n,r){const s=this.encodeKey(n);this.validateKey(s);let l={last_by_subj:this.subjectForKey(s)};r&&r.revision>0&&(l={seq:r.revision});let u;try{this.direct?u=await this.jsm.direct.getMessage(this.bucketName(),l):u=await this.jsm.streams.getMessage(this.bucketName(),l);const c=this.smToEntry(u);return c.key!==s?null:c}catch(c){if(c.code===_e.JetStream404NoMessages)return null;throw c}}purge(n,r){return this._deleteOrPurge(n,"PURGE",r)}delete(n,r){return this._deleteOrPurge(n,"DEL",r)}async purgeDeletes(n=1800*1e3){const r=zt(),s=[],l=await this.watch({key:">",initializedFn:()=>{r.resolve()}});(async()=>{for await(const m of l)(m.operation==="DEL"||m.operation==="PURGE")&&s.push(m)})().then(),await r,l.stop();const u=Date.now()-n,c=s.map(m=>{const d=this.subjectForKey(m.key);return m.created.getTime()>=u?this.jsm.streams.purge(this.stream,{filter:d,keep:1}):this.jsm.streams.purge(this.stream,{filter:d,keep:0})}),f=await Promise.all(c);return f.unshift({success:!0,purged:0}),f.reduce((m,d)=>(m.purged+=d.purged,m))}async _deleteOrPurge(n,r,s){if(!this.hasWildcards(n))return this._doDeleteOrPurge(n,r,s);const l=await this.keys(n),u=[];for await(const c of l)u.push(this._doDeleteOrPurge(c,r)),u.length===100&&(await Promise.all(u),u.length=0);u.length>0&&await Promise.all(u)}async _doDeleteOrPurge(n,r,s){const l=this.encodeKey(n);this.validateKey(l);const u=ei();u.set(Lu,r),r==="PURGE"&&u.set(bn.RollupHdr,bn.RollupValueSubject),s!=null&&s.previousSeq&&u.set(_r.ExpectedLastSubjectSequenceHdr,`${s.previousSeq}`),await this.js.publish(this.subjectForKey(l,!0),Yn,{headers:u})}_buildCC(n,r,s={}){let u=(Array.isArray(n)?n:[n]).map(m=>{const d=this.encodeKey(m);return this.validateSearchKey(m),this.fullKeyName(d)}),c=Yt.LastPerSubject;r===dr.AllHistory&&(c=Yt.All),r===dr.UpdatesOnly&&(c=Yt.New);let f;return u.length===1&&(f=u[0],u=void 0),Object.assign({deliver_policy:c,ack_policy:tn.None,filter_subjects:u,filter_subject:f,flow_control:!0,idle_heartbeat:Lt(5*1e3)},s)}remove(n){return this.purge(n)}async history(n={}){const r=n.key??">",s=new nn,l={};l.headers_only=n.headers_only||!1;let u;u=()=>{s.stop()};let c=0;const f=this._buildCC(r,dr.AllHistory,l),m=f.filter_subject,d=Ui(f);d.bindStream(this.stream),d.orderedConsumer(),d.callback((g,x)=>{if(g){s.stop(g);return}if(x){const w=this.jmToEntry(x);s.push(w),s.received++,(u&&c>0&&s.received>=c||x.info.pending===0)&&(s.push(u),u=void 0)}});const y=await this.js.subscribe(m,d);if(u){const{info:{last:g}}=y,x=g.num_pending+g.delivered.consumer_seq;if(x===0||s.received>=x)try{u()}catch(w){s.stop(w)}finally{u=void 0}else c=x}return s._data=y,s.iterClosed.then(()=>{y.unsubscribe()}),y.closed.then(()=>{s.stop()}).catch(g=>{s.stop(g)}),s}canSetWatcherName(){const r=this.js.nc,{ok:s}=r.features.get(ut.JS_NEW_CONSUMER_CREATE_API);return s}async watch(n={}){const r=n.key??">",s=new nn,l={};l.headers_only=n.headers_only||!1;let u=dr.LastValue;n.include===dr.AllHistory?u=dr.AllHistory:n.include===dr.UpdatesOnly&&(u=dr.UpdatesOnly);const c=n.ignoreDeletes===!0;let f=n.initializedFn,m=0;const d=this._buildCC(r,u,l),y=d.filter_subject,g=Ui(d);this.canSetWatcherName()&&g.consumerName(Bi.next()),g.bindStream(this.stream),n.resumeFromRevision&&n.resumeFromRevision>0&&g.startSequence(n.resumeFromRevision),g.orderedConsumer(),g.callback((w,S)=>{if(w){s.stop(w);return}if(S){const D=this.jmToEntry(S);if(c&&D.operation==="DEL")return;s.push(D),s.received++,f&&(m>0&&s.received>=m||S.info.pending===0)&&(s.push(f),f=void 0)}});const x=await this.js.subscribe(y,g);if(f){const{info:{last:w}}=x,S=w.num_pending+w.delivered.consumer_seq;if(S===0||s.received>=S)try{f()}catch(D){s.stop(D)}finally{f=void 0}else m=S}return s._data=x,s.iterClosed.then(()=>{x.unsubscribe()}),x.closed.then(()=>{s.stop()}).catch(w=>{s.stop(w)}),s}async keys(n=">"){const r=new nn,s=this._buildCC(n,dr.LastValue,{headers_only:!0}),l=Array.isArray(n)?">":s.filter_subject,u=Ui(s);u.bindStream(this.stream),u.orderedConsumer();const c=await this.js.subscribe(l,u);return(async()=>{var m;for await(const d of c){const y=(m=d.headers)==null?void 0:m.get(Lu);if(y!=="DEL"&&y!=="PURGE"){const g=this.decodeKey(d.subject.substring(this.prefixLen));r.push(g)}d.info.pending===0&&c.unsubscribe()}})().then(()=>{r.stop()}).catch(m=>{r.stop(m)}),c.info.last.num_pending===0&&c.unsubscribe(),r}purgeBucket(n){return this.jsm.streams.purge(this.bucketName(),n)}destroy(){return this.jsm.streams.delete(this.bucketName())}async status(){var u;const r=((u=this.js.nc.info)==null?void 0:u.cluster)??"",s=this.bucketName(),l=await this.jsm.streams.info(s);return new wx(l,r)}}class wx{constructor(n,r=""){C(this,"si");C(this,"cluster");this.si=n,this.cluster=r}get bucket(){return this.si.config.name.startsWith(Hn)?this.si.config.name.substring(Hn.length):this.si.config.name}get values(){return this.si.state.messages}get history(){return this.si.config.max_msgs_per_subject}get ttl(){return Rd(this.si.config.max_age)}get bucket_location(){return this.cluster}get backingStore(){return this.si.config.storage}get storage(){return this.si.config.storage}get replicas(){return this.si.config.num_replicas}get description(){return this.si.config.description??""}get maxBucketSize(){return this.si.config.max_bytes}get maxValueSize(){return this.si.config.max_msg_size}get max_bytes(){return this.si.config.max_bytes}get placement(){return this.si.config.placement||{cluster:"",tags:[]}}get placementCluster(){var n;return((n=this.si.config.placement)==null?void 0:n.cluster)??""}get republish(){return this.si.config.republish??{src:"",dest:""}}get streamInfo(){return this.si}get size(){return this.si.state.bytes}get metadata(){return this.si.config.metadata??{}}get compression(){return this.si.config.compression?this.si.config.compression!==Pi.None:!1}}const Ld="OBJ_",T0="SHA-256=";function EE(e){return _u(e),`${Ld}${e}`}function kE(e){return e.startsWith(Ld)?e.substring(4):e}class od{constructor(n){C(this,"si");C(this,"backingStore");this.si=n,this.backingStore="JetStream"}get bucket(){return kE(this.si.config.name)}get description(){return this.si.config.description??""}get ttl(){return this.si.config.max_age}get storage(){return this.si.config.storage}get replicas(){return this.si.config.num_replicas}get sealed(){return this.si.config.sealed}get size(){return this.si.state.bytes}get streamInfo(){return this.si}get metadata(){return this.si.config.metadata}get compression(){return this.si.config.compression?this.si.config.compression!==Pi.None:!1}}function du(e){if(e===void 0)return;const{domain:n}=e;if(n===void 0)return e;const r=Object.assign({},e);if(delete r.domain,n==="")return r;if(r.external)throw new Error("domain and external are both set");return r.external={api:`$JS.${n}.API`},r}var rr;(function(e){e[e.Unset=-1]="Unset",e[e.Consume=0]="Consume",e[e.Fetch=1]="Fetch"})(rr||(rr={}));var Er;(function(e){e.HeartbeatsMissed="heartbeats_missed",e.ConsumerNotFound="consumer_not_found",e.StreamNotFound="stream_not_found",e.ConsumerDeleted="consumer_deleted",e.OrderedConsumerRecreated="ordered_consumer_recreated",e.NoResponders="no_responders"})(Er||(Er={}));var oa;(function(e){e.DebugEvent="debug",e.Discard="discard",e.Reset="reset",e.Next="next"})(oa||(oa={}));const j0=Uint8Array.of(43,65,67,75),CE=Uint8Array.of(45,78,65,75),bl=Uint8Array.of(43,87,80,73),AE=Uint8Array.of(43,78,88,84),TE=Uint8Array.of(43,84,69,82,77),jE=Uint8Array.of(32);function Bl(e,n=5e3){return new GE(e,n)}class Eh extends nn{constructor(r,s,l=!1){super();C(this,"consumer");C(this,"opts");C(this,"sub");C(this,"monitor");C(this,"pending");C(this,"inbox");C(this,"refilling");C(this,"pong");C(this,"callback");C(this,"timeout");C(this,"cleanupHandler");C(this,"listeners");C(this,"statusIterator");C(this,"forOrderedConsumer");C(this,"resetHandler");C(this,"abortOnMissingResource");C(this,"bind");C(this,"inBackOff");this.consumer=r;const u=s;this.opts=this.parseOptions(s,l),this.callback=u.callback||null,this.noIterator=typeof this.callback=="function",this.monitor=null,this.pong=null,this.pending={msgs:0,bytes:0,requests:0},this.refilling=l,this.timeout=null,this.inbox=Zr(r.api.nc.options.inboxPrefix),this.listeners=[],this.forOrderedConsumer=!1,this.abortOnMissingResource=u.abort_on_missing_resource===!0,this.bind=u.bind===!0,this.inBackOff=!1,this.start()}start(){const{max_messages:r,max_bytes:s,idle_heartbeat:l,threshold_bytes:u,threshold_messages:c}=this.opts;this.closed().then(m=>{if(this.cleanupHandler)try{this.cleanupHandler(m)}catch{}});const{sub:f}=this;f&&f.unsubscribe(),this.sub=this.consumer.api.nc.subscribe(this.inbox,{callback:(m,d)=>{var g,x,w,S;if(m){this.stop(m);return}if((g=this.monitor)==null||g.work(),d.subject===this.inbox){if(ed(d))return;const D=(x=d.headers)==null?void 0:x.code,q=((S=(w=d.headers)==null?void 0:w.description)==null?void 0:S.toLowerCase())||"unknown",{msgsLeft:L,bytesLeft:$}=this.parseDiscard(d.headers);if(L>0||$>0)this.pending.msgs-=L,this.pending.bytes-=$,this.pending.requests--,this.notify(oa.Discard,{msgsLeft:L,bytesLeft:$});else if(D===400){this.stop(new Ne(q,`${D}`));return}else if(D===409&&q==="consumer deleted"){if(this.notify(Er.ConsumerDeleted,`${D} ${q}`),!this.refilling||this.abortOnMissingResource){const T=new Ne(q,`${D}`);this.stop(T);return}}else if(D===503){if(this.notify(Er.NoResponders,`${D} No Responders`),!this.refilling||this.abortOnMissingResource){const T=new Ne("no responders",`${D}`);this.stop(T);return}}else this.notify(oa.DebugEvent,`${D} ${q}`)}else this._push(Bl(d,this.consumer.api.timeout)),this.received++,this.pending.msgs&&this.pending.msgs--,this.pending.bytes&&(this.pending.bytes-=d.size());if(this.pending.msgs===0&&this.pending.bytes===0&&(this.pending.requests=0),this.refilling){if(r&&this.pending.msgs<=c||s&&this.pending.bytes<=u){const D=this.pullOptions();this.pull(D)}}else this.pending.requests===0&&this._push(()=>{this.stop()})}}),this.sub.closed.then(()=>{this.sub.draining&&this._push(()=>{this.stop()})}),l&&(this.monitor=new Dd(l,m=>(this.notify(Er.HeartbeatsMissed,m),this.resetPending().then(()=>{}).catch(()=>{}),!1),{maxOut:2})),(async()=>{var d;const m=this.consumer.api.nc.status();this.statusIterator=m;for await(const y of m)switch(y.type){case Kr.Disconnect:(d=this.monitor)==null||d.cancel();break;case Kr.Reconnect:this.resetPending().then(g=>{var x;g&&((x=this.monitor)==null||x.restart())}).catch(()=>{});break}})(),this.pull(this.pullOptions())}_push(r){if(!this.callback)super.push(r);else{const s=typeof r=="function"?r:null;try{s?s():this.callback(r)}catch(l){this.stop(l)}}}notify(r,s){this.listeners.length>0&&this.listeners.forEach(l=>{l.done||l.push({type:r,data:s})})}resetPending(){return this.bind?this.resetPendingNoInfo():this.resetPendingWithInfo()}resetPendingNoInfo(){return this.pending.msgs=0,this.pending.bytes=0,this.pending.requests=0,this.pull(this.pullOptions()),Promise.resolve(!0)}async resetPendingWithInfo(){if(this.inBackOff)return!1;let r=0,s=0;const l=Od([this.opts.expires]);let u=0;for(;;){if(this.done)return!1;if(this.consumer.api.nc.isClosed())return console.error("aborting resetPending - connection is closed"),!1;try{return await this.consumer.info(),this.inBackOff=!1,r=0,this.pending.msgs=0,this.pending.bytes=0,this.pending.requests=0,this.pull(this.pullOptions()),!0}catch(c){if(c.message==="stream not found"){if(s++,this.notify(Er.StreamNotFound,s),!this.refilling||this.abortOnMissingResource)return this.stop(c),!1}else if(c.message==="consumer not found"){if(r++,this.notify(Er.ConsumerNotFound,r),this.resetHandler)try{this.resetHandler()}catch{}if(!this.refilling||this.abortOnMissingResource)return this.stop(c),!1;if(this.forOrderedConsumer)return!1}else r=0,s=0;this.inBackOff=!0;const f=l.backoff(u),m=va(f);await Promise.race([m,this.consumer.api.nc.closed()]),m.cancel(),u++}}}pull(r){this.pending.bytes+=r.max_bytes??0,this.pending.msgs+=r.batch??0,this.pending.requests++;const s=this.consumer.api.nc;this._push(()=>{s.publish(`${this.consumer.api.prefix}.CONSUMER.MSG.NEXT.${this.consumer.stream}.${this.consumer.name}`,this.consumer.api.jc.encode(r),{reply:this.inbox}),this.notify(oa.Next,r)})}pullOptions(){const r=this.opts.max_messages-this.pending.msgs,s=this.opts.max_bytes-this.pending.bytes,l=Lt(this.opts.idle_heartbeat),u=Lt(this.opts.expires);return{batch:r,max_bytes:s,idle_heartbeat:l,expires:u}}parseDiscard(r){const s={msgsLeft:0,bytesLeft:0},l=r==null?void 0:r.get(bn.PendingMessagesHdr);l&&(s.msgsLeft=parseInt(l));const u=r==null?void 0:r.get(bn.PendingBytesHdr);return u&&(s.bytesLeft=parseInt(u)),s}trackTimeout(r){this.timeout=r}close(){return this.stop(),this.iterClosed}closed(){return this.iterClosed}clearTimers(){var r,s;(r=this.monitor)==null||r.cancel(),this.monitor=null,(s=this.timeout)==null||s.cancel(),this.timeout=null}setCleanupHandler(r){this.cleanupHandler=r}stop(r){var s,l;this.done||((s=this.sub)==null||s.unsubscribe(),this.clearTimers(),(l=this.statusIterator)==null||l.stop(),this._push(()=>{super.stop(r),this.listeners.forEach(u=>{u.stop()})}))}parseOptions(r,s=!1){const l=r||{};if(l.max_messages=l.max_messages||0,l.max_bytes=l.max_bytes||0,l.max_messages!==0&&l.max_bytes!==0)throw new Error("only specify one of max_messages or max_bytes");if(l.max_messages===0&&(l.max_messages=100),l.expires=l.expires||3e4,l.expires<1e3)throw new Error("expires should be at least 1000ms");if(l.idle_heartbeat=l.idle_heartbeat||l.expires/2,l.idle_heartbeat=l.idle_heartbeat>3e4?3e4:l.idle_heartbeat,s){const u=Math.round(l.max_messages*.75)||1;l.threshold_messages=l.threshold_messages||u;const c=Math.round(l.max_bytes*.75)||1;l.threshold_bytes=l.threshold_bytes||c}return l}status(){const r=new nn;return this.listeners.push(r),Promise.resolve(r)}}class NE extends nn{constructor(){super();C(this,"src");C(this,"listeners");this.listeners=[]}setSource(r){this.src&&(this.src.resetHandler=void 0,this.src.setCleanupHandler(),this.src.stop()),this.src=r,this.src.setCleanupHandler(s=>{this.stop(s||void 0)}),(async()=>{const s=await this.src.status();for await(const l of s)this.notify(l.type,l.data)})().catch(()=>{})}notify(r,s){this.listeners.length>0&&this.listeners.forEach(l=>{l.done||l.push({type:r,data:s})})}stop(r){var s;this.done||((s=this.src)==null||s.stop(r),super.stop(r),this.listeners.forEach(l=>{l.stop()}))}close(){return this.stop(),this.iterClosed}closed(){return this.iterClosed}status(){const r=new nn;return this.listeners.push(r),Promise.resolve(r)}}class ud{constructor(n,r){C(this,"api");C(this,"_info");C(this,"stream");C(this,"name");this.api=n,this._info=r,this.stream=r.stream_name,this.name=r.name}consume(n={max_messages:100,expires:3e4}){return Promise.resolve(new Eh(this,n,!0))}fetch(n={max_messages:100,expires:3e4}){const r=new Eh(this,n,!1),s=Math.round(r.opts.expires*1.05),l=ha(s);return r.closed().catch(()=>{}).finally(()=>{l.cancel()}),l.catch(()=>{r.close().catch()}),r.trackTimeout(l),Promise.resolve(r)}next(n={expires:3e4}){const r=zt(),s=n;s.max_messages=1;const l=new Eh(this,s,!1),u=Math.round(l.opts.expires*1.05);u>=6e4&&(async()=>{for await(const f of await l.status())if(f.type===Er.HeartbeatsMissed&&f.data>=2){r.reject(new Error("consumer missed heartbeats"));break}})().catch(),(async()=>{for await(const f of l){r.resolve(f);break}})().catch(()=>{});const c=ha(u);return l.closed().then(f=>{f?r.reject(f):r.resolve(null)}).catch(f=>{r.reject(f)}).finally(()=>{c.cancel()}),c.catch(f=>{r.resolve(null),l.close().catch()}),l.trackTimeout(c),r}delete(){const{stream_name:n,name:r}=this._info;return this.api.delete(n,r)}info(n=!1){if(n)return Promise.resolve(this._info);const{stream_name:r,name:s}=this._info;return this.api.info(r,s).then(l=>(this._info=l,this._info))}}class OE{constructor(n,r,s={}){C(this,"api");C(this,"consumerOpts");C(this,"consumer");C(this,"opts");C(this,"cursor");C(this,"stream");C(this,"namePrefix");C(this,"serial");C(this,"currentConsumer");C(this,"userCallback");C(this,"iter");C(this,"type");C(this,"startSeq");C(this,"maxInitialReset");this.api=n,this.stream=r,this.cursor={stream_seq:1,deliver_seq:0},this.namePrefix=Bi.next(),typeof s.name_prefix=="string"&&(Yu("name_prefix",s.name_prefix),this.namePrefix=s.name_prefix+this.namePrefix),this.serial=0,this.currentConsumer=null,this.userCallback=null,this.iter=null,this.type=rr.Unset,this.consumerOpts=s,this.maxInitialReset=30,this.startSeq=this.consumerOpts.opt_start_seq||0,this.cursor.stream_seq=this.startSeq>0?this.startSeq-1:0}getConsumerOpts(n){this.serial++;const r=`${this.namePrefix}_${this.serial}`;n=n===0?1:n;const s={name:r,deliver_policy:Yt.StartSequence,opt_start_seq:n,ack_policy:tn.None,inactive_threshold:Lt(300*1e3),num_replicas:1};return this.consumerOpts.headers_only===!0&&(s.headers_only=!0),Array.isArray(this.consumerOpts.filterSubjects)&&(s.filter_subjects=this.consumerOpts.filterSubjects),typeof this.consumerOpts.filterSubjects=="string"&&(s.filter_subject=this.consumerOpts.filterSubjects),this.consumerOpts.replay_policy&&(s.replay_policy=this.consumerOpts.replay_policy),n===this.startSeq+1&&(s.deliver_policy=this.consumerOpts.deliver_policy||Yt.StartSequence,(this.consumerOpts.deliver_policy===Yt.LastPerSubject||this.consumerOpts.deliver_policy===Yt.New||this.consumerOpts.deliver_policy===Yt.Last)&&(delete s.opt_start_seq,s.deliver_policy=this.consumerOpts.deliver_policy),s.deliver_policy===Yt.LastPerSubject&&typeof s.filter_subjects>"u"&&typeof s.filter_subject>"u"&&(s.filter_subject=">"),this.consumerOpts.opt_start_time&&(delete s.opt_start_seq,s.deliver_policy=Yt.StartTime,s.opt_start_time=this.consumerOpts.opt_start_time),this.consumerOpts.inactive_threshold&&(s.inactive_threshold=Lt(this.consumerOpts.inactive_threshold))),s}async resetConsumer(n=0){var c,f,m,d,y;Bi.next();const r=this.serial===0;(c=this.consumer)==null||c.delete().catch(()=>{}),n=n===0?1:n,this.cursor.deliver_seq=0;const s=this.getConsumerOpts(n);s.max_deliver=1,s.mem_storage=!0;const l=Od([((f=this.opts)==null?void 0:f.expires)||3e4]);let u;for(let g=0;;g++)try{u=await this.api.add(this.stream,s),(m=this.iter)==null||m.notify(Er.OrderedConsumerRecreated,u.name);break}catch(x){if(x.message==="stream not found"&&((d=this.iter)==null||d.notify(Er.StreamNotFound,g),this.type===rr.Fetch||this.opts.abort_on_missing_resource===!0))return(y=this.iter)==null||y.stop(x),Promise.reject(x);if(r&&g>=this.maxInitialReset)throw x;await va(l.backoff(g+1))}return u}internalHandler(n){return r=>{var l;if(this.serial!==n)return;const s=r.info.deliverySequence;if(s!==this.cursor.deliver_seq+1){this.notifyOrderedResetAndReset();return}this.cursor.deliver_seq=s,this.cursor.stream_seq=r.info.streamSequence,this.userCallback?this.userCallback(r):(l=this.iter)==null||l.push(r)}}async reset(n={max_messages:100,expires:3e4},r){var m,d;r=r||{};const s=r.fromFetch||!1,l=r.orderedReset||!1;if(this.type===rr.Fetch&&l){(m=this.iter)==null||m.src.stop(),await((d=this.iter)==null?void 0:d.closed()),this.currentConsumer=null;return}(this.currentConsumer===null||l)&&(this.currentConsumer=await this.resetConsumer(this.cursor.stream_seq+1)),(this.iter===null||s)&&(this.iter=new NE),this.consumer=new ud(this.api,this.currentConsumer);const u=n;u.callback=this.internalHandler(this.serial);let c=null;this.type===rr.Fetch&&s?c=await this.consumer.fetch(n):this.type===rr.Consume&&(c=await this.consumer.consume(n));const f=c;f.forOrderedConsumer=!0,f.resetHandler=()=>{this.notifyOrderedResetAndReset()},this.iter.setSource(f)}notifyOrderedResetAndReset(){var n;(n=this.iter)==null||n.notify(oa.Reset,""),this.reset(this.opts,{orderedReset:!0})}async consume(n={max_messages:100,expires:3e4}){if(n.bind)return Promise.reject(new Error("bind is not supported"));if(this.type===rr.Fetch)return Promise.reject(new Error("ordered consumer initialized as fetch"));if(this.type===rr.Consume)return Promise.reject(new Error("ordered consumer doesn't support concurrent consume"));const{callback:s}=n;return s&&(this.userCallback=s),this.type=rr.Consume,this.opts=n,await this.reset(n),this.iter}async fetch(n={max_messages:100,expires:3e4}){var l;if(n.bind)return Promise.reject(new Error("bind is not supported"));if(this.type===rr.Consume)return Promise.reject(new Error("ordered consumer already initialized as consume"));if(((l=this.iter)==null?void 0:l.done)===!1)return Promise.reject(new Error("ordered consumer doesn't support concurrent fetch"));const{callback:s}=n;return s&&(this.userCallback=s),this.type=rr.Fetch,this.opts=n,await this.reset(n,{fromFetch:!0}),this.iter}async next(n={expires:3e4}){const r=n;if(r.bind)return Promise.reject(new Error("bind is not supported"));r.max_messages=1;const s=zt();return r.callback=u=>{this.userCallback=null,s.resolve(u)},(await this.fetch(r)).iterClosed.then(u=>{u&&s.reject(u),s.resolve(null)}).catch(u=>{s.reject(u)}),s}delete(){return this.currentConsumer?this.api.delete(this.stream,this.currentConsumer.name).then(n=>Promise.resolve(n)).catch(n=>Promise.reject(n)).finally(()=>{this.currentConsumer=null}):Promise.resolve(!1)}async info(n){return this.currentConsumer==null?(this.currentConsumer=await this.resetConsumer(this.startSeq),Promise.resolve(this.currentConsumer)):n&&this.currentConsumer?Promise.resolve(this.currentConsumer):this.api.info(this.stream,this.currentConsumer.name)}}class cd{constructor(n){C(this,"api");C(this,"notified");this.api=n,this.notified=!1}checkVersion(){const n=this.api.nc.features.get(ut.JS_SIMPLIFICATION);return n.ok?Promise.resolve():Promise.reject(new Error(`consumers framework is only supported on servers ${n.min} or better`))}getPullConsumerFor(n){if(n.config.deliver_subject!==void 0)throw new Error("push consumer not supported");return new ud(this.api,n)}async get(n,r={}){return typeof r=="object"?this.ordered(n,r):(await this.checkVersion(),this.api.info(n,r).then(s=>s.config.deliver_subject!==void 0?Promise.reject(new Error("push consumer not supported")):new ud(this.api,s)).catch(s=>Promise.reject(s)))}async ordered(n,r){await this.checkVersion();const s=this.api;return new zd(s.nc,s.opts).info(n).then(u=>Promise.resolve(new OE(this.api,n,r))).catch(u=>Promise.reject(u))}}class Ju{constructor(n,r){C(this,"api");C(this,"_info");this.api=n,this._info=r}get name(){return this._info.config.name}alternates(){return this.info().then(n=>n.alternates?n.alternates:[])}async best(){if(await this.info(),this._info.alternates){const n=await this.api.info(this._info.alternates[0].name);return new Ju(this.api,n)}else return this}info(n=!1,r){return n?Promise.resolve(this._info):this.api.info(this.name,r).then(s=>(this._info=s,this._info))}getConsumerFromInfo(n){return new cd(new Ou(this.api.nc,this.api.opts)).getPullConsumerFor(n)}getConsumer(n){return new cd(new Ou(this.api.nc,this.api.opts)).get(this.name,n)}getMessage(n){return this.api.getMessage(this.name,n)}deleteMessage(n,r){return this.api.deleteMessage(this.name,n,r)}}class zd extends $l{constructor(n,r){super(n,r)}checkStreamConfigVersions(n){const r=this.nc;if(n.metadata){const{min:l,ok:u}=r.features.get(ut.JS_STREAM_CONSUMER_METADATA);if(!u)throw new Error(`stream 'metadata' requires server ${l}`)}if(n.first_seq){const{min:l,ok:u}=r.features.get(ut.JS_STREAM_FIRST_SEQ);if(!u)throw new Error(`stream 'first_seq' requires server ${l}`)}if(n.subject_transform){const{min:l,ok:u}=r.features.get(ut.JS_STREAM_SUBJECT_TRANSFORM);if(!u)throw new Error(`stream 'subject_transform' requires server ${l}`)}if(n.compression){const{min:l,ok:u}=r.features.get(ut.JS_STREAM_COMPRESSION);if(!u)throw new Error(`stream 'compression' requires server ${l}`)}if(n.consumer_limits){const{min:l,ok:u}=r.features.get(ut.JS_DEFAULT_CONSUMER_LIMITS);if(!u)throw new Error(`stream 'consumer_limits' requires server ${l}`)}function s(l,u){var f;if((((f=u==null?void 0:u.subject_transforms)==null?void 0:f.length)||0)>0){const{min:m,ok:d}=r.features.get(ut.JS_STREAM_SOURCE_SUBJECT_TRANSFORM);if(!d)throw new Error(`${l} 'subject_transforms' requires server ${m}`)}}n.sources&&n.sources.forEach(l=>{s("stream sources",l)}),n.mirror&&s("stream mirror",n.mirror)}async add(n={}){var l;this.checkStreamConfigVersions(n),mn(n.name),n.mirror=du(n.mirror),n.sources=(l=n.sources)==null?void 0:l.map(du);const s=await this._request(`${this.prefix}.STREAM.CREATE.${n.name}`,n);return this._fixInfo(s),s}async delete(n){return mn(n),(await this._request(`${this.prefix}.STREAM.DELETE.${n}`)).success}async update(n,r={}){var f;if(typeof n=="object"){const m=n;n=m.name,r=m,console.trace("\x1B[33m >> streams.update(config: StreamConfig) api changed to streams.update(name: string, config: StreamUpdateConfig) - this shim will be removed - update your code. \x1B[0m")}this.checkStreamConfigVersions(r),mn(n);const s=await this.info(n),l=Object.assign(s.config,r);l.mirror=du(l.mirror),l.sources=(f=l.sources)==null?void 0:f.map(du);const c=await this._request(`${this.prefix}.STREAM.UPDATE.${n}`,l);return this._fixInfo(c),c}async info(n,r){mn(n);const s=`${this.prefix}.STREAM.INFO.${n}`;let u=await this._request(s,r),{total:c,limit:f}=u,m=u.state.subjects?Object.getOwnPropertyNames(u.state.subjects).length:1;if(c&&c>m){const d=[u],y=r||{};let g=0;for(;c>m;){g++,y.offset=f*g;const w=await this._request(s,y);c=w.total,d.push(w);const S=Object.getOwnPropertyNames(w.state.subjects).length;if(m+=S,S<f)break}let x={};for(let w=0;w<d.length;w++)u=d[w],u.state.subjects&&(x=Object.assign(x,u.state.subjects));u.offset=0,u.total=0,u.limit=0,u.state.subjects=x}return this._fixInfo(u),u}list(n=""){const r=n!=null&&n.length?{subject:n}:{},s=u=>{const c=u;return c.streams.forEach(f=>{this._fixInfo(f)}),c.streams},l=`${this.prefix}.STREAM.LIST`;return new Cl(l,s,this,r)}_fixInfo(n){n.config.sealed=n.config.sealed||!1,n.config.deny_delete=n.config.deny_delete||!1,n.config.deny_purge=n.config.deny_purge||!1,n.config.allow_rollup_hdrs=n.config.allow_rollup_hdrs||!1}async purge(n,r){if(r){const{keep:l,seq:u}=r;if(typeof l=="number"&&typeof u=="number")throw new Error("can specify one of keep or seq")}return mn(n),await this._request(`${this.prefix}.STREAM.PURGE.${n}`,r)}async deleteMessage(n,r,s=!0){mn(n);const l={seq:r};return s||(l.no_erase=!0),(await this._request(`${this.prefix}.STREAM.MSG.DELETE.${n}`,l)).success}async getMessage(n,r){mn(n);const l=await this._request(`${this.prefix}.STREAM.MSG.GET.${n}`,r);return new Sx(l)}find(n){return this.findStream(n)}listKvs(){const n=s=>{var m;const u=s.streams.filter(d=>d.config.name.startsWith(Hn));u.forEach(d=>{this._fixInfo(d)});let c="";return u.length&&(c=((m=this.nc.info)==null?void 0:m.cluster)??""),u.map(d=>new wx(d,c))},r=`${this.prefix}.STREAM.LIST`;return new Cl(r,n,this)}listObjectStores(){const n=s=>{const u=s.streams.filter(f=>f.config.name.startsWith(Ld));return u.forEach(f=>{this._fixInfo(f)}),u.map(f=>new od(f))},r=`${this.prefix}.STREAM.LIST`;return new Cl(r,n,this)}names(n=""){const r=n!=null&&n.length?{subject:n}:{},s=u=>u.streams,l=`${this.prefix}.STREAM.NAMES`;return new Cl(l,s,this,r)}async get(n){const r=await this.info(n);return Promise.resolve(new Ju(this,r))}}class RE extends $l{constructor(n,r){super(n,r)}async getMessage(n,r){mn(n);let s=r;const{last_by_subj:l}=s;l&&(s=null);const u=s?this.jc.encode(s):Yn,c=this.opts.apiPrefix||"$JS.API",f=l?`${c}.DIRECT.GET.${n}.${l}`:`${c}.DIRECT.GET.${n}`,m=await this.nc.request(f,u,{timeout:this.timeout}),d=aa(m);if(d)return Promise.reject(d);const y=new fd(m);return Promise.resolve(y)}async getBatch(n,r){mn(n);const l=`${this.opts.apiPrefix||"$JS.API"}.DIRECT.GET.${n}`;if(!Array.isArray(r.multi_last)||r.multi_last.length===0)return Promise.reject("multi_last is required");const u=JSON.stringify(r,(m,d)=>m==="up_to_time"&&d instanceof Date?d.toISOString():d),c=new nn,f=await this.nc.requestMany(l,u,{strategy:mr.SentinelMsg});return(async()=>{var g,x,w;let m=!1,d=!1,y;for await(const S of f){if(!m){m=!0;const D=((g=S.headers)==null?void 0:g.code)||0;if(D!==0&&D<200||D>299){y=(x=S.headers)==null?void 0:x.description.toLowerCase();break}if(((w=S.headers)==null?void 0:w.get("Nats-Num-Pending"))===""){d=!0;break}}if(S.data.length===0)break;c.push(new fd(S))}c.push(()=>{if(d)throw new Error("batch direct get not supported by the server");if(y)throw new Error(`bad request: ${y}`);c.stop()})})(),Promise.resolve(c)}}class fd{constructor(n){C(this,"data");C(this,"header");if(!n.headers)throw new Error("headers expected");this.data=n.data,this.header=n.headers}get subject(){return this.header.last(na.Subject)}get seq(){const n=this.header.last(na.Sequence);return typeof n=="string"?parseInt(n):0}get time(){return new Date(Date.parse(this.timestamp))}get timestamp(){return this.header.last(na.TimeStamp)}get stream(){return this.header.last(na.Stream)}json(n){return pr(n).decode(this.data)}string(){return In.decode(this.data)}}C(fd,"jc");class ME extends $l{constructor(r,s){super(r,s);C(this,"streams");C(this,"consumers");C(this,"direct");this.streams=new zd(r,s),this.consumers=new Ou(r,s),this.direct=new RE(r,s)}async getAccountInfo(){return await this._request(`${this.prefix}.INFO`)}jetstream(){return this.nc.jetstream(this.getOptions())}advisories(){const r=new nn;return this.nc.subscribe("$JS.EVENT.ADVISORY.>",{callback:(s,l)=>{if(s)throw s;try{const u=this.parseJsResponse(l),c=u.type.split("."),f=c[c.length-1];r.push({kind:f,data:u})}catch(u){r.stop(u)}}}),r}}class Sx{constructor(n){C(this,"_header");C(this,"smr");this.smr=n}get subject(){return this.smr.message.subject}get seq(){return this.smr.message.seq}get timestamp(){return this.smr.message.time}get time(){return new Date(Date.parse(this.timestamp))}get data(){return this.smr.message.data?this._parse(this.smr.message.data):Yn}get header(){if(!this._header)if(this.smr.message.hdrs){const n=this._parse(this.smr.message.hdrs);this._header=zi.decode(n)}else this._header=ei();return this._header}_parse(n){const r=atob(n),s=r.length,l=new Uint8Array(s);for(let u=0;u<s;u++)l[u]=r.charCodeAt(u);return l}json(n){return pr(n).decode(this.data)}string(){return In.decode(this.data)}}C(Sx,"jc");class DE{constructor(n){C(this,"api");this.api=n}get(n){return this.api.info(n).then(r=>new Ju(this.api,r))}}class kh{constructor(n){C(this,"info");C(this,"hdrs");this.info=n}get name(){return this.info.name}get description(){return this.info.description??""}get headers(){return this.hdrs||(this.hdrs=zi.fromRecord(this.info.headers||{})),this.hdrs}get options(){return this.info.options}get bucket(){return this.info.bucket}get chunks(){return this.info.chunks}get deleted(){return this.info.deleted??!1}get digest(){return this.info.digest}get mtime(){return this.info.mtime}get nuid(){return this.info.nuid}get size(){return this.info.size}get revision(){return this.info.revision}get metadata(){return this.info.metadata||{}}isLink(){var n,r;return((n=this.info.options)==null?void 0:n.link)!==void 0&&((r=this.info.options)==null?void 0:r.link)!==null}}function N0(e){const n={name:e.name,description:e.description??"",options:e.options,metadata:e.metadata};if(e.headers){const r=e.headers;n.headers=r.toRecord()}return n}function LE(){return new ReadableStream({pull(e){e.enqueue(new Uint8Array(0)),e.close()}})}class Nl{constructor(n,r,s){C(this,"jsm");C(this,"js");C(this,"stream");C(this,"name");this.name=n,this.jsm=r,this.js=s}_checkNotEmpty(n){return!n||n.length===0?{name:n,error:new Error("name cannot be empty")}:{name:n}}async info(n){const r=await this.rawInfo(n);return r?new kh(r):null}async list(){const n=[],r=await this.watch({ignoreDeletes:!0,includeHistory:!0});for await(const s of r){if(s===null)break;n.push(s)}return Promise.resolve(n)}async rawInfo(n){const{name:r,error:s}=this._checkNotEmpty(n);if(s)return Promise.reject(s);const l=this._metaSubject(r);try{const u=await this.jsm.streams.getMessage(this.stream,{last_by_subj:l}),f=pr().decode(u.data);return f.revision=u.seq,f}catch(u){return u.code==="404"?null:Promise.reject(u)}}async _si(n){try{return await this.jsm.streams.info(this.stream,n)}catch(r){return r.code==="404"?null:Promise.reject(r)}}async seal(){let n=await this._si();return n===null?Promise.reject(new Error("object store not found")):(n.config.sealed=!0,n=await this.jsm.streams.update(this.stream,n.config),Promise.resolve(new od(n)))}async status(n){const r=await this._si(n);return r===null?Promise.reject(new Error("object store not found")):Promise.resolve(new od(r))}destroy(){return this.jsm.streams.delete(this.stream)}async _put(n,r,s){var te;const l=this.js.getOptions();s=s||{timeout:l.timeout},s.timeout=s.timeout||l.timeout,s.previousRevision=s.previousRevision??void 0;const{timeout:u,previousRevision:c}=s,f=this.js.nc.info,m=(f==null?void 0:f.max_payload)||1024;n=n||{},n.options=n.options||{};let d=((te=n.options)==null?void 0:te.max_chunk_size)||128*1024;d=d>m?m:d,n.options.max_chunk_size=d;const y=await this.info(n.name),{name:g,error:x}=this._checkNotEmpty(n.name);if(x)return Promise.reject(x);const w=Bi.next(),S=this._chunkSubject(w),D=this._metaSubject(g),q=Object.assign({bucket:this.name,nuid:w,size:0,chunks:0},N0(n)),L=zt(),$=[],T=new ma;try{const B=r?r.getReader():null,z=x0.create();for(;;){const{done:K,value:Q}=B?await B.read():{done:!0,value:void 0};if(K){if(T.size()>0){const J=T.drain();z.update(J),q.chunks++,q.size+=J.length,$.push(this.js.publish(S,J,{timeout:u}))}await Promise.all($),$.length=0,q.mtime=new Date().toISOString();const H=la.encode(z.digest());q.digest=`${T0}${H}`,q.deleted=!1;const R=ei();typeof c=="number"&&R.set(_r.ExpectedLastSubjectSequenceHdr,`${c}`),R.set(bn.RollupHdr,bn.RollupValueSubject);const X=await this.js.publish(D,pr().encode(q),{headers:R,timeout:u});if(q.revision=X.seq,y)try{await this.jsm.streams.purge(this.stream,{filter:`$O.${this.name}.C.${y.nuid}`})}catch{}L.resolve(new kh(q));break}if(Q)for(T.fill(Q);T.size()>d;){q.chunks++,q.size+=d;const H=T.drain(n.options.max_chunk_size);z.update(H),$.push(this.js.publish(S,H,{timeout:u}))}}}catch(B){await this.jsm.streams.purge(this.stream,{filter:S}),L.reject(B)}return L}putBlob(n,r,s){function l(u){return new ReadableStream({pull(c){c.enqueue(u),c.close()}})}return r===null&&(r=new Uint8Array(0)),this.put(n,l(r),s)}put(n,r,s){var l;return(l=n==null?void 0:n.options)!=null&&l.link?Promise.reject(new Error("link cannot be set when putting the object in bucket")):this._put(n,r,s)}async getBlob(n){async function r(u){const c=new ma,f=u.getReader();for(;;){const{done:m,value:d}=await f.read();if(m)return c.drain();d&&d.length&&c.fill(d)}}const s=await this.get(n);if(s===null)return Promise.resolve(null);const l=await Promise.all([s.error,r(s.data)]);return l[0]?Promise.reject(l[0]):Promise.resolve(l[1])}async get(n){const r=await this.rawInfo(n);if(r===null||r.deleted)return Promise.resolve(null);if(r.options&&r.options.link){const g=r.options.link.name||"";if(g==="")throw new Error("link is a bucket");return(r.options.link.bucket!==this.name?await Nl.create(this.js,r.options.link.bucket):this).get(g)}if(!r.digest.startsWith(T0))return Promise.reject(new Error(`unknown digest type: ${r.digest}`));const s=rd(r.digest.substring(8));if(s===null)return Promise.reject(new Error(`unable to parse digest: ${r.digest}`));const l=zt(),u={info:new kh(r),error:l};if(r.size===0)return u.data=LE(),l.resolve(null),Promise.resolve(u);let c;const f=Ui();f.orderedConsumer();const m=x0.create(),d=`$O.${this.name}.C.${r.nuid}`,y=await this.js.subscribe(d,f);return(async()=>{for await(const g of y)g.data.length>0&&(m.update(g.data),c.enqueue(g.data)),g.info.pending===0&&(f2(s,m.digest())?c.close():c.error(new Error(`received a corrupt object, digests do not match received: ${r.digest} calculated ${s}`)),y.unsubscribe())})().then(()=>{l.resolve()}).catch(g=>{c.error(g),l.reject(g)}),u.data=new ReadableStream({start(g){c=g},cancel(){y.unsubscribe()}}),u}linkStore(n,r){if(!(r instanceof Nl))return Promise.reject("bucket required");const s=r,{name:l,error:u}=this._checkNotEmpty(n);if(u)return Promise.reject(u);const c={name:l,options:{link:{bucket:s.name}}};return this._put(c,null)}async link(n,r){const{name:s,error:l}=this._checkNotEmpty(n);if(l)return Promise.reject(l);if(r.deleted)return Promise.reject(new Error("src object is deleted"));if(r.isLink())return Promise.reject(new Error("src object is a link"));const u=await this.rawInfo(n);if(u!==null&&!u.deleted)return Promise.reject(new Error("an object already exists with that name"));const c={bucket:r.bucket,name:r.name},f={name:s,bucket:r.bucket,options:{link:c}};await this.js.publish(this._metaSubject(n),JSON.stringify(f));const m=await this.info(n);return Promise.resolve(m)}async delete(n){const r=await this.rawInfo(n);if(r===null)return Promise.resolve({purged:0,success:!1});r.deleted=!0,r.size=0,r.chunks=0,r.digest="";const s=pr(),l=ei();return l.set(bn.RollupHdr,bn.RollupValueSubject),await this.js.publish(this._metaSubject(r.name),s.encode(r),{headers:l}),this.jsm.streams.purge(this.stream,{filter:this._chunkSubject(r.nuid)})}async update(n,r={}){const s=await this.rawInfo(n);if(s===null)return Promise.reject(new Error("object not found"));if(s.deleted)return Promise.reject(new Error("cannot update meta for a deleted object"));r.name=r.name??s.name;const{name:l,error:u}=this._checkNotEmpty(r.name);if(u)return Promise.reject(u);if(n!==r.name){const m=await this.info(r.name);if(m&&!m.deleted)return Promise.reject(new Error("an object already exists with that name"))}r.name=l;const c=Object.assign({},s,N0(r)),f=await this.js.publish(this._metaSubject(c.name),JSON.stringify(c));return n!==r.name&&await this.jsm.streams.purge(this.stream,{filter:this._metaSubject(n)}),Promise.resolve(f)}async watch(n={}){n.includeHistory=n.includeHistory??!1,n.ignoreDeletes=n.ignoreDeletes??!1;let r=!1;const s=new nn,l=this._metaSubjectAll();try{await this.jsm.streams.getMessage(this.stream,{last_by_subj:l})}catch(m){m.code==="404"?(s.push(null),r=!0):s.stop(m)}const u=pr(),c=Ui();c.orderedConsumer(),n.includeHistory?c.deliverLastPerSubject():(r=!0,c.deliverNew()),c.callback((m,d)=>{var y;if(m){s.stop(m);return}if(d!==null){const g=u.decode(d.data);g.deleted&&n.ignoreDeletes===!0||s.push(g),((y=d.info)==null?void 0:y.pending)===0&&!r&&(r=!0,s.push(null))}});const f=await this.js.subscribe(l,c);return s._data=f,s.iterClosed.then(()=>{f.unsubscribe()}),f.closed.then(()=>{s.stop()}).catch(m=>{s.stop(m)}),s}_chunkSubject(n){return`$O.${this.name}.C.${n}`}_metaSubject(n){return`$O.${this.name}.M.${la.encode(n)}`}_metaSubjectAll(){return`$O.${this.name}.M.>`}async init(n={}){try{this.stream=EE(this.name)}catch(l){return Promise.reject(l)}const r=(n==null?void 0:n.ttl)||0;delete n.ttl;const s=Object.assign({max_age:r},n);s.name=this.stream,s.num_replicas=n.replicas??1,s.allow_direct=!0,s.allow_rollup_hdrs=!0,s.discard=Ll.New,s.subjects=[`$O.${this.name}.C.>`,`$O.${this.name}.M.>`],n.placement&&(s.placement=n.placement),n.metadata&&(s.metadata=n.metadata),typeof n.compression=="boolean"&&(s.compression=n.compression?Pi.S2:Pi.None);try{await this.jsm.streams.info(s.name)}catch(l){l.message==="stream not found"&&await this.jsm.streams.add(s)}}static async create(n,r,s={}){const l=await n.jetstreamManager(),u=new Nl(r,l,n);return await u.init(s),Promise.resolve(u)}}class zE{constructor(n){C(this,"js");this.js=n}kv(n,r={}){const s=this.js,{ok:l,min:u}=s.nc.features.get(ut.JS_KV);return l?r.bindOnly?Ul.bind(this.js,n,r):Ul.create(this.js,n,r):Promise.reject(new Error(`kv is only supported on servers ${u} or better`))}os(n,r={}){var c;if(typeof((c=crypto==null?void 0:crypto.subtle)==null?void 0:c.digest)!="function")return Promise.reject(new Error("objectstore: unable to calculate hashes - crypto.subtle.digest with sha256 support is required"));const s=this.js,{ok:l,min:u}=s.nc.features.get(ut.JS_OBJECTSTORE);return l?Nl.create(this.js,n,r):Promise.reject(new Error(`objectstore is only supported on servers ${u} or better`))}}class Ud extends $l{constructor(r,s){super(r,s);C(this,"consumers");C(this,"streams");C(this,"consumerAPI");C(this,"streamAPI");this.consumerAPI=new Ou(r,s),this.streamAPI=new zd(r,s),this.consumers=new cd(this.consumerAPI),this.streams=new DE(this.streamAPI)}jetstreamManager(r){r===void 0&&(r=this.opts.checkAPI);const s=Object.assign({},this.opts,{checkAPI:r});return this.nc.jetstreamManager(s)}get apiPrefix(){return this.prefix}get views(){return new zE(this)}async publish(r,s=Yn,l){l=l||{},l.expect=l.expect||{};const u=(l==null?void 0:l.headers)||ei();l&&(l.msgID&&u.set(_r.MsgIdHdr,l.msgID),l.expect.lastMsgID&&u.set(_r.ExpectedLastMsgIdHdr,l.expect.lastMsgID),l.expect.streamName&&u.set(_r.ExpectedStreamHdr,l.expect.streamName),typeof l.expect.lastSequence=="number"&&u.set(_r.ExpectedLastSeqHdr,`${l.expect.lastSequence}`),typeof l.expect.lastSubjectSequence=="number"&&u.set(_r.ExpectedLastSubjectSequenceHdr,`${l.expect.lastSubjectSequence}`));const c=l.timeout||this.timeout,f={};c&&(f.timeout=c),l&&(f.headers=u);let{retries:m,retry_delay:d}=l;m=m||1,d=d||250;let y;for(let x=0;x<m;x++)try{y=await this.nc.request(r,s,f);break}catch(w){if(w.code==="503"&&x+1<m)await va(d);else throw w}const g=this.parseJsResponse(y);if(g.stream==="")throw Ne.errorForCode(_e.JetStreamInvalidAck);return g.duplicate=g.duplicate?g.duplicate:!1,g}async pull(r,s,l=0){mn(r),sa(s);let u=this.timeout;l>u&&(u=l),l=l<0?0:Lt(l);const c={batch:1,no_wait:l===0,expires:l},f=await this.nc.request(`${this.prefix}.CONSUMER.MSG.NEXT.${r}.${s}`,this.jc.encode(c),{noMux:!0,timeout:u}),m=aa(f);if(m)throw m;return Bl(f,this.timeout)}fetch(r,s,l={}){mn(r),sa(s);let u=null;const c=(l.max_bytes??0)>0;let f=0;const m=c?l.max_bytes:0;let d=null;const y={};if(y.batch=l.batch||1,m){const $=this.nc.features.get(ut.JS_PULL_MAX_BYTES);if(!$.ok)throw new Error(`max_bytes is only supported on servers ${$.min} or better`);y.max_bytes=m}y.no_wait=l.no_wait||!1,y.no_wait&&y.expires&&(y.expires=0);const g=l.expires||0;if(g&&(y.expires=Lt(g)),g===0&&y.no_wait===!1)throw new Error("expires or no_wait is required");const x=l.idle_heartbeat||0;x&&(y.idle_heartbeat=Lt(x),l.delay_heartbeat===!0&&(y.idle_heartbeat=Lt(x*4)));const w=new nn,S=y.batch;let D=0;w.protocolFilterFn=($,T=!1)=>ed($.msg)?(d==null||d.work(),!1):!0,w.dispatchedFn=$=>{if($){if(c&&(f+=$.data.length),D++,u&&$.info.pending===0)return;(w.getPending()===1&&$.info.pending===0||S===D||m>0&&f>=m)&&w.stop()}};const q=Zr(this.nc.options.inboxPrefix),L=this.nc.subscribe(q,{max:l.batch,callback:($,T)=>{$===null&&($=aa(T)),$!==null?(u&&(u.cancel(),u=null),G_($)?w.stop(Ex($)===null?void 0:$):w.stop($)):(d==null||d.work(),w.received++,w.push(Bl(T,this.timeout)))}});return g&&(u=ha(g),u.catch(()=>{L.isClosed()||(L.drain().catch(()=>{}),u=null),d&&d.cancel()})),(async()=>{try{x&&(d=new Dd(x,$=>(w.push(()=>{w.err=new Ne(`${ir.IdleHeartbeatMissed}: ${$}`,_e.JetStreamIdleHeartBeat)}),!0)))}catch{}await L.closed,u!==null&&(u.cancel(),u=null),d&&d.cancel(),w.stop()})().catch(),this.nc.publish(`${this.prefix}.CONSUMER.MSG.NEXT.${r}.${s}`,this.jc.encode(y),{reply:q}),w}async pullSubscribe(r,s=Ui()){const l=await this._processOptions(r,s);if(l.ordered)throw new Error("pull subscribers cannot be be ordered");if(l.config.deliver_subject)throw new Error("consumer info specifies deliver_subject - pull consumers cannot have deliver_subject set");const u=l.config.ack_policy;if(u===tn.None||u===tn.All)throw new Error("ack policy for pull consumers must be explicit");const c=this._buildTypedSubscriptionOpts(l),f=new qE(this,l.deliver,c);f.info=l;try{await this._maybeCreateConsumer(l)}catch(m){throw f.unsubscribe(),m}return f}async subscribe(r,s=Ui()){const l=await this._processOptions(r,s);if(!l.isBind&&!l.config.deliver_subject)throw new Error("push consumer requires deliver_subject");const u=this._buildTypedSubscriptionOpts(l),c=new _x(this,l.deliver,u);c.info=l;try{await this._maybeCreateConsumer(l)}catch(f){throw c.unsubscribe(),f}return c._maybeSetupHbMonitoring(),c}async _processOptions(r,s=Ui()){const l=p0(s)?s.getOpts():s;if(l.isBind=p0(s)?s.isBind:!1,l.flow_control={heartbeat_count:0,fc_count:0,consumer_restarts:0},l.ordered){if(l.ordered_consumer_sequence={stream_seq:0,delivery_seq:0},l.config.ack_policy!==tn.NotSet&&l.config.ack_policy!==tn.None)throw new Ne("ordered consumer: ack_policy can only be set to 'none'",_e.ApiError);if(l.config.durable_name&&l.config.durable_name.length>0)throw new Ne("ordered consumer: durable_name cannot be set",_e.ApiError);if(l.config.deliver_subject&&l.config.deliver_subject.length>0)throw new Ne("ordered consumer: deliver_subject cannot be set",_e.ApiError);if(l.config.max_deliver!==void 0&&l.config.max_deliver>1)throw new Ne("ordered consumer: max_deliver cannot be set",_e.ApiError);if(l.config.deliver_group&&l.config.deliver_group.length>0)throw new Ne("ordered consumer: deliver_group cannot be set",_e.ApiError);l.config.deliver_subject=Zr(this.nc.options.inboxPrefix),l.config.ack_policy=tn.None,l.config.max_deliver=1,l.config.flow_control=!0,l.config.idle_heartbeat=l.config.idle_heartbeat||Lt(5e3),l.config.ack_wait=Lt(1320*60*1e3),l.config.mem_storage=!0,l.config.num_replicas=1}if(l.config.ack_policy===tn.NotSet&&(l.config.ack_policy=tn.All),l.api=this,l.config=l.config||{},l.stream=l.stream?l.stream:await this.findStream(r),l.attached=!1,l.config.durable_name)try{const u=await this.consumerAPI.info(l.stream,l.config.durable_name);if(u){if(u.config.filter_subject&&u.config.filter_subject!==r)throw new Error("subject does not match consumer");const c=l.config.deliver_group??"";if(c===""&&u.push_bound===!0)throw new Error("duplicate subscription");const f=u.config.deliver_group??"";if(c!==f)throw f===""?new Error("durable requires no queue group"):new Error(`durable requires queue group '${f}'`);l.last=u,l.config=u.config,l.attached=!0,l.config.durable_name||(l.name=u.name)}}catch(u){if(u.code!=="404")throw u}return!l.attached&&l.config.filter_subject===void 0&&l.config.filter_subjects===void 0&&(l.config.filter_subject=r),l.deliver=l.config.deliver_subject||Zr(this.nc.options.inboxPrefix),l}_buildTypedSubscriptionOpts(r){const s={};return s.adapter=HE(r.callbackFn===void 0,this.timeout),s.ingestionFilterFn=Ud.ingestionFn(r.ordered),s.protocolFilterFn=(l,u=!1)=>{const c=l;return Wh(c.msg)?(u||c.msg.respond(),!1):!0},!r.mack&&r.config.ack_policy!==tn.None&&(s.dispatchedFn=$E),r.callbackFn&&(s.callback=r.callbackFn),s.max=r.max||0,s.queue=r.queue,s}async _maybeCreateConsumer(r){if(r.attached)return;if(r.isBind)throw new Error(`unable to bind - durable consumer ${r.config.durable_name} doesn't exist in ${r.stream}`);r.config=Object.assign({deliver_policy:Yt.All,ack_policy:tn.Explicit,ack_wait:Lt(30*1e3),replay_policy:da.Instant},r.config);const s=await this.consumerAPI.add(r.stream,r.config);if(Array.isArray(r.config.filter_subjects&&!Array.isArray(s.config.filter_subjects)))throw new Error("jetstream server doesn't support consumers with multiple filter subjects");r.name=s.name,r.config=s.config,r.last=s}static ingestionFn(r){return(s,l)=>{var m;const u=l;if(!s)return{ingest:!1,protocol:!1};const c=s;if(aa(c.msg)||(m=u.monitor)==null||m.work(),ed(c.msg)){const d=r?u._checkHbOrderConsumer(c.msg):!0;return r||u.info.flow_control.heartbeat_count++,{ingest:d,protocol:!0}}else if(Wh(c.msg))return u.info.flow_control.fc_count++,{ingest:!0,protocol:!0};return{ingest:r?u._checkOrderedConsumer(s):!0,protocol:!1}}}}class Bd{constructor(n){C(this,"options");C(this,"protocol");C(this,"draining");C(this,"listeners");C(this,"_services");this.draining=!1,this.options=sE(n),this.listeners=[]}static connect(n={}){return new Promise((r,s)=>{const l=new Bd(n);Du.connect(l.options,l).then(u=>{l.protocol=u,(async function(){for await(const c of u.status())l.listeners.forEach(f=>{f.push(c)})})(),r(l)}).catch(u=>{s(u)})})}closed(){return this.protocol.closed}async close(){await this.protocol.close()}_check(n,r,s){if(this.isClosed())throw Ne.errorForCode(_e.ConnectionClosed);if(r&&this.isDraining()||s&&this.protocol.noMorePublishing)throw Ne.errorForCode(_e.ConnectionDraining);if(n=n||"",n.length===0)throw Ne.errorForCode(_e.BadSubject)}publish(n,r,s){this._check(n,!1,!0),this.protocol.publish(n,r,s)}publishMessage(n){return this.publish(n.subject,n.data,{reply:n.reply,headers:n.headers})}respondMessage(n){return n.reply?(this.publish(n.reply,n.data,{reply:n.reply,headers:n.headers}),!0):!1}subscribe(n,r={}){this._check(n,!0,!1);const s=new xx(this.protocol,n,r);return this.protocol.subscribe(s),s}_resub(n,r,s){this._check(r,!0,!1);const l=n;l.max=s,s&&(l.max=s+l.received),this.protocol.resub(l,r)}requestMany(n,r=Yn,s={maxWait:1e3,maxMessages:-1}){const l=!this.protocol.options.noAsyncTraces;try{this._check(n,!0,!0)}catch(m){return Promise.reject(m)}if(s.strategy=s.strategy||mr.Timer,s.maxWait=s.maxWait||1e3,s.maxWait<1)return Promise.reject(new Ne("timeout",_e.InvalidOption));const u=new nn;function c(m){u.push(()=>{u.stop(m)})}function f(m,d){m||d===null?c(m===null?void 0:m):u.push(d)}if(s.noMux){const m=l?new Error().stack:null;let d=typeof s.maxMessages=="number"&&s.maxMessages>0?s.maxMessages:-1;const y=this.subscribe(Zr(this.options.inboxPrefix),{callback:(S,D)=>{var q,L;if(((q=D==null?void 0:D.data)==null?void 0:q.length)===0&&((L=D==null?void 0:D.headers)==null?void 0:L.status)===_e.NoResponders&&(S=Ne.errorForCode(_e.NoResponders)),S){m&&(S.stack+=`
82
+
83
+ ${m}`),g(S);return}f(null,D),s.strategy===mr.Count&&(d--,d===0&&g()),s.strategy===mr.JitterTimer&&(w(),x=setTimeout(()=>{g()},300)),s.strategy===mr.SentinelMsg&&D&&D.data.length===0&&g()}});y.requestSubject=n,y.closed.then(()=>{c()}).catch(S=>{u.stop(S)});const g=S=>{S&&u.push(()=>{throw S}),w(),y.drain().then(()=>{c()}).catch(D=>{c()})};u.iterClosed.then(()=>{w(),y==null||y.unsubscribe()}).catch(S=>{w(),y==null||y.unsubscribe()});try{this.publish(n,r,{reply:y.getSubject()})}catch(S){g(S)}let x=setTimeout(()=>{g()},s.maxWait);const w=()=>{x&&clearTimeout(x)}}else{const m=s;m.callback=f,u.iterClosed.then(()=>{d.cancel()}).catch(y=>{d.cancel(y)});const d=new h2(this.protocol.muxSubscriptions,n,m);this.protocol.request(d);try{this.publish(n,r,{reply:`${this.protocol.muxSubscriptions.baseInbox}${d.token}`,headers:s.headers})}catch(y){d.cancel(y)}}return Promise.resolve(u)}request(n,r,s={timeout:1e3,noMux:!1}){try{this._check(n,!0,!0)}catch(u){return Promise.reject(u)}const l=!this.protocol.options.noAsyncTraces;if(s.timeout=s.timeout||1e3,s.timeout<1)return Promise.reject(new Ne("timeout",_e.InvalidOption));if(!s.noMux&&s.reply)return Promise.reject(new Ne("reply can only be used with noMux",_e.InvalidOption));if(s.noMux){const u=s.reply?s.reply:Zr(this.options.inboxPrefix),c=zt(),f=l?new Error:null,m=this.subscribe(u,{max:1,timeout:s.timeout,callback:(d,y)=>{d?(f&&d.code!==_e.Timeout&&(d.stack+=`
84
+
85
+ ${f.stack}`),m.unsubscribe(),c.reject(d)):(d=lx(y),d?(f&&(d.stack+=`
86
+
87
+ ${f.stack}`),c.reject(d)):c.resolve(y))}});return m.requestSubject=n,this.protocol.publish(n,r,{reply:u,headers:s.headers}),c}else{const u=new cx(this.protocol.muxSubscriptions,n,s,l);this.protocol.request(u);try{this.publish(n,r,{reply:`${this.protocol.muxSubscriptions.baseInbox}${u.token}`,headers:s.headers})}catch(f){u.cancel(f)}const c=Promise.race([u.timer,u.deferred]);return c.catch(()=>{u.cancel()}),c}}flush(){return this.isClosed()?Promise.reject(Ne.errorForCode(_e.ConnectionClosed)):this.protocol.flush()}drain(){return this.isClosed()?Promise.reject(Ne.errorForCode(_e.ConnectionClosed)):this.isDraining()?Promise.reject(Ne.errorForCode(_e.ConnectionDraining)):(this.draining=!0,this.protocol.drain())}isClosed(){return this.protocol.isClosed()}isDraining(){return this.draining}getServer(){const n=this.protocol.getServer();return n?n.listen:""}status(){const n=new nn;return n.iterClosed.then(()=>{const r=this.listeners.indexOf(n);this.listeners.splice(r,1)}),this.listeners.push(n),n}get info(){return this.protocol.isClosed()?void 0:this.protocol.info}async context(){return(await this.request("$SYS.REQ.USER.INFO")).json((r,s)=>r==="time"?new Date(Date.parse(s)):s)}stats(){return{inBytes:this.protocol.inBytes,outBytes:this.protocol.outBytes,inMsgs:this.protocol.inMsgs,outMsgs:this.protocol.outMsgs}}async jetstreamManager(n={}){const r=new ME(this,n);if(n.checkAPI!==!1)try{await r.getAccountInfo()}catch(s){const l=s;throw l.code===_e.NoResponders&&(l.code=_e.JetStreamNotEnabled),l}return r}jetstream(n={}){return new Ud(this,n)}getServerVersion(){const n=this.info;return n?fs(n.version):void 0}async rtt(){if(!this.protocol._closed&&!this.protocol.connected)throw Ne.errorForCode(_e.Disconnect);const n=Date.now();return await this.flush(),Date.now()-n}get features(){return this.protocol.features}get services(){return this._services||(this._services=new UE(this)),this._services}reconnect(){return this.isClosed()?Promise.reject(Ne.errorForCode(_e.ConnectionClosed)):this.isDraining()?Promise.reject(Ne.errorForCode(_e.ConnectionDraining)):this.protocol.reconnect()}}class UE{constructor(n){C(this,"nc");this.nc=n}add(n){try{return new Yl(this.nc,n).start()}catch(r){return Promise.reject(r)}}client(n,r){return new gE(this.nc,n,r)}}class BE{constructor(n,r,s){C(this,"bucket");C(this,"sm");C(this,"prefixLen");this.bucket=n,this.prefixLen=r,this.sm=s}get key(){return this.sm.subject.substring(this.prefixLen)}get value(){return this.sm.data}get delta(){return 0}get created(){return this.sm.time}get revision(){return this.sm.seq}get operation(){return this.sm.header.get(Lu)||"PUT"}get length(){const n=this.sm.header.get(bn.MessageSizeHdr)||"";return n!==""?parseInt(n,10):this.sm.data.length}json(){return this.sm.json()}string(){return this.sm.string()}}class PE{constructor(n,r,s){C(this,"bucket");C(this,"key");C(this,"sm");this.bucket=n,this.key=r,this.sm=s}get value(){return this.sm.data}get created(){return new Date(Rd(this.sm.info.timestampNanos))}get revision(){return this.sm.seq}get operation(){var n;return((n=this.sm.headers)==null?void 0:n.get(Lu))||"PUT"}get delta(){return this.sm.info.pending}get length(){var r;const n=((r=this.sm.headers)==null?void 0:r.get(bn.MessageSizeHdr))||"";return n!==""?parseInt(n,10):this.sm.data.length}json(){return this.sm.json()}string(){return this.sm.string()}}class _x extends g2{constructor(r,s,l){super(r.nc,s,l);C(this,"js");C(this,"monitor");this.js=r,this.monitor=null,this.sub.closed.then(()=>{this.monitor&&this.monitor.cancel()})}set info(r){this.sub.info=r}get info(){return this.sub.info}_resetOrderedConsumer(r){if(this.info===null||this.sub.isClosed())return;const s=Zr(this.js.nc.options.inboxPrefix);this.js.nc._resub(this.sub,s);const u=this.info;u.config.name=Bi.next(),u.ordered_consumer_sequence.delivery_seq=0,u.flow_control.heartbeat_count=0,u.flow_control.fc_count=0,u.flow_control.consumer_restarts++,u.deliver=s,u.config.deliver_subject=s,u.config.deliver_policy=Yt.StartSequence,u.config.opt_start_seq=r;const c={};c.stream_name=this.info.stream,c.config=u.config;const f=`${u.api.prefix}.CONSUMER.CREATE.${u.stream}`;this.js._request(f,c,{retries:-1}).then(m=>{const d=m,y=this.sub.info;y.last=d,this.info.config=d.config,this.info.name=d.name}).catch(m=>{const d=new Ne(`unable to recreate ordered consumer ${u.stream} at seq ${r}`,_e.RequestError,m);this.sub.callback(d,{})})}_maybeSetupHbMonitoring(){var s,l;const r=((l=(s=this.info)==null?void 0:s.config)==null?void 0:l.idle_heartbeat)||0;r&&this._setupHbMonitoring(Rd(r))}_setupHbMonitoring(r,s=0){const l={cancelAfter:0,maxOut:2};s&&(l.cancelAfter=s);const u=this.sub,c=f=>{var y,g,x,w;const m=K_(409,`${ir.IdleHeartbeatMissed}: ${f}`,this.sub.subject);if(!((y=this.info)==null?void 0:y.ordered))this.sub.callback(null,m);else{if(!this.js.nc.protocol.connected)return!1;const S=((x=(g=this.info)==null?void 0:g.ordered_consumer_sequence)==null?void 0:x.stream_seq)||0;return this._resetOrderedConsumer(S+1),(w=this.monitor)==null||w.restart(),!1}return!u.noIterator};this.monitor=new Dd(r,c,l)}_checkHbOrderConsumer(r){const s=r.headers.get(bn.ConsumerStalledHdr);s!==""&&this.js.nc.publish(s);const l=parseInt(r.headers.get(bn.LastConsumerSeqHdr),10),u=this.info.ordered_consumer_sequence;return this.info.flow_control.heartbeat_count++,l!==u.delivery_seq&&this._resetOrderedConsumer(u.stream_seq+1),!1}_checkOrderedConsumer(r){const s=this.info.ordered_consumer_sequence,l=r.info.streamSequence,u=r.info.deliverySequence;return u!=s.delivery_seq+1?(this._resetOrderedConsumer(s.stream_seq+1),!1):(s.delivery_seq=u,s.stream_seq=l,!0)}async destroy(){this.isClosed()||await this.drain();const r=this.sub.info,s=r.config.durable_name||r.name,l=`${r.api.prefix}.CONSUMER.DELETE.${r.stream}.${s}`;await r.api._request(l)}async consumerInfo(){const r=this.sub.info,s=r.config.durable_name||r.name,l=`${r.api.prefix}.CONSUMER.INFO.${r.stream}.${s}`,u=await r.api._request(l);return r.last=u,u}}class qE extends _x{constructor(n,r,s){super(n,r,s)}pull(n={batch:1}){const{stream:r,config:s,name:l}=this.sub.info,u=s.durable_name??l,c={};if(c.batch=n.batch||1,c.no_wait=n.no_wait||!1,(n.max_bytes??0)>0){const d=this.js.nc.features.get(ut.JS_PULL_MAX_BYTES);if(!d.ok)throw new Error(`max_bytes is only supported on servers ${d.min} or better`);c.max_bytes=n.max_bytes}let f=0;n.expires&&n.expires>0&&(f=n.expires,c.expires=Lt(f));let m=0;if(n.idle_heartbeat&&n.idle_heartbeat>0&&(m=n.idle_heartbeat,c.idle_heartbeat=Lt(m)),m&&f===0)throw new Error("idle_heartbeat requires expires");if(m>f)throw new Error("expires must be greater than idle_heartbeat");if(this.info){this.monitor&&this.monitor.cancel(),f&&m&&(this.monitor?this.monitor._change(m,f):this._setupHbMonitoring(m,f));const d=this.info.api,y=`${d.prefix}.CONSUMER.MSG.NEXT.${r}.${u}`,g=this.sub.subject;d.nc.publish(y,d.jc.encode(c),{reply:g})}}}function HE(e,n){return e?FE(n):IE(n)}function IE(e){return(n,r)=>n?[n,null]:(n=aa(r),n?[n,null]:[null,Bl(r,e)])}function FE(e){return(n,r)=>{if(n)return[n,null];const s=aa(r);return s!==null?[Ex(s),null]:[null,Bl(r,e)]}}function Ex(e){if(e!==null)switch(e.code){case _e.JetStream404NoMessages:case _e.JetStream408RequestTimeout:return null;case _e.JetStream409:return Q_(e)?e:null;default:return e}return null}function $E(e){e&&e.ack()}function YE(e){const n=e.split(".");if(n.length===9&&n.splice(2,0,"_",""),n.length<11||n[0]!=="$JS"||n[1]!=="ACK")throw new Error("not js message");const r={};return r.domain=n[2]==="_"?"":n[2],r.account_hash=n[3],r.stream=n[4],r.consumer=n[5],r.deliveryCount=parseInt(n[6],10),r.redeliveryCount=r.deliveryCount,r.redelivered=r.deliveryCount>1,r.streamSequence=parseInt(n[7],10),r.deliverySequence=parseInt(n[8],10),r.timestampNanos=parseInt(n[9],10),r.pending=parseInt(n[10],10),r}class GE{constructor(n,r){C(this,"msg");C(this,"di");C(this,"didAck");C(this,"timeout");this.msg=n,this.didAck=!1,this.timeout=r}get subject(){return this.msg.subject}get sid(){return this.msg.sid}get data(){return this.msg.data}get headers(){return this.msg.headers}get info(){return this.di||(this.di=YE(this.reply)),this.di}get redelivered(){return this.info.deliveryCount>1}get reply(){return this.msg.reply||""}get seq(){return this.info.streamSequence}doAck(n){this.didAck||(this.didAck=!this.isWIP(n),this.msg.respond(n))}isWIP(n){return n.length===4&&n[0]===bl[0]&&n[1]===bl[1]&&n[2]===bl[2]&&n[3]===bl[3]}async ackAck(n){var s;n=n||{},n.timeout=n.timeout||this.timeout;const r=zt();if(this.didAck)r.resolve(!1);else if(this.didAck=!0,this.msg.reply){const u=this.msg.publisher,c=!((s=u.options)!=null&&s.noAsyncTraces),f=new cx(u.muxSubscriptions,this.msg.reply,{timeout:n.timeout},c);u.request(f);try{u.publish(this.msg.reply,j0,{reply:`${u.muxSubscriptions.baseInbox}${f.token}`})}catch(m){f.cancel(m)}try{await Promise.race([f.timer,f.deferred]),r.resolve(!0)}catch(m){f.cancel(m),r.reject(m)}}else r.resolve(!1);return r}ack(){this.doAck(j0)}nak(n){let r=CE;n&&(r=ju().encode(`-NAK ${JSON.stringify({delay:Lt(n)})}`)),this.doAck(r)}working(){this.doAck(bl)}next(n,r={batch:1}){const s={};s.batch=r.batch||1,s.no_wait=r.no_wait||!1,r.expires&&r.expires>0&&(s.expires=Lt(r.expires));const l=pr().encode(s),u=ma.concat(AE,jE,l),c=n?{reply:n}:void 0;this.msg.respond(u,c)}term(n=""){let r=TE;(n==null?void 0:n.length)>0&&(r=ju().encode(`+TERM ${n}`)),this.doAck(r)}json(){return this.msg.json()}string(){return this.msg.string()}}const VE="1.30.3",JE="nats.ws";class XE{constructor(){C(this,"version");C(this,"lang");C(this,"closeError");C(this,"connected");C(this,"done");C(this,"socket");C(this,"options");C(this,"socketClosed");C(this,"encrypted");C(this,"peeked");C(this,"yields");C(this,"signal");C(this,"closedNotification");this.version=VE,this.lang=JE,this.connected=!1,this.done=!1,this.socketClosed=!1,this.encrypted=!1,this.peeked=!1,this.yields=[],this.signal=zt(),this.closedNotification=zt()}async connect(n,r){const s=zt();if(r.tls)return s.reject(new Ne("tls",_e.InvalidOption)),s;this.options=r;const l=n.src;if(r.wsFactory){const{socket:u,encrypted:c}=await r.wsFactory(n.src,r);this.socket=u,this.encrypted=c}else this.encrypted=l.indexOf("wss://")===0,this.socket=new WebSocket(l);return this.socket.binaryType="arraybuffer",this.socket.onopen=()=>{this.isDiscarded()},this.socket.onmessage=u=>{if(this.isDiscarded())return;if(this.yields.push(new Uint8Array(u.data)),this.peeked){this.signal.resolve();return}const c=ma.concat(...this.yields),f=S2(c);if(f!==""){const m=oE.exec(f);if(!m){r.debug&&console.error("!!!",cu(c)),s.reject(new Error("unexpected response from server"));return}try{const d=JSON.parse(m[1]);aE(d,this.options),this.peeked=!0,this.connected=!0,this.signal.resolve(),s.resolve()}catch(d){s.reject(d);return}}},this.socket.onclose=u=>{if(this.isDiscarded())return;this.socketClosed=!0;let c;this.done||(u.wasClean||(c=new Error(u.reason)),this._closed(c))},this.socket.onerror=u=>{if(this.isDiscarded())return;const c=u,f=new Ne(c.message,_e.Unknown,new Error(c.error));s.reject(f)},s}disconnect(){this._closed(void 0,!0)}async _closed(n,r=!0){if(!this.isDiscarded()&&this.connected&&!this.done){if(this.closeError=n,!n)for(;!this.socketClosed&&this.socket.bufferedAmount>0;)await va(100);this.done=!0;try{this.socket.close(n?1002:1e3,n?n.message:void 0)}catch{}r&&this.closedNotification.resolve(n)}}get isClosed(){return this.done}[Symbol.asyncIterator](){return this.iterate()}async*iterate(){for(;;){if(this.isDiscarded())return;this.yields.length===0&&await this.signal;const n=this.yields;this.yields=[];for(let r=0;r<n.length;r++)this.options.debug&&console.info(`> ${cu(n[r])}`),yield n[r];if(this.done)break;this.yields.length===0&&(n.length=0,this.yields=n,this.signal=zt())}}isEncrypted(){return this.connected&&this.encrypted}send(n){if(!this.isDiscarded())try{this.socket.send(n.buffer),this.options.debug&&console.info(`< ${cu(n)}`);return}catch(r){this.options.debug&&console.error(`!!! ${cu(n)}: ${r}`)}}close(n){return this._closed(n,!1)}closed(){return this.closedNotification}isDiscarded(){return this.done?(this.discard(),!0):!1}discard(){var n;this.done=!0;try{(n=this.socket)==null||n.close()}catch{}}}function KE(e,n){/^(.*:\/\/)(.*)/.test(e)||(typeof n=="boolean"?e=`${n===!0?"https":"http"}://${e}`:e=`https://${e}`);let s=new URL(e);const l=s.protocol.toLowerCase();l==="ws:"&&(n=!1),l==="wss:"&&(n=!0),l!=="https:"&&l!=="http"&&(e=e.replace(/^(.*:\/\/)(.*)/gm,"$2"),s=new URL(`http://${e}`));let u,c;const f=s.hostname,m=s.pathname,d=s.search||"";switch(l){case"http:":case"ws:":case"nats:":c=s.port||"80",u="ws:";break;case"https:":case"wss:":case"tls:":c=s.port||"443",u="wss:";break;default:c=s.port||n===!0?"443":"80",u=n===!0?"wss:":"ws:";break}return`${u}//${f}:${c}${m}${d}`}function kx(e={}){return y2({defaultPort:443,urlParseFn:KE,factory:()=>new XE}),Bd.connect(e)}/*! Capacitor: https://capacitorjs.com/ - MIT License */var pa;(function(e){e.Unimplemented="UNIMPLEMENTED",e.Unavailable="UNAVAILABLE"})(pa||(pa={}));class Ch extends Error{constructor(n,r,s){super(n),this.message=n,this.code=r,this.data=s}}const QE=e=>{var n,r;return e!=null&&e.androidBridge?"android":!((r=(n=e==null?void 0:e.webkit)===null||n===void 0?void 0:n.messageHandlers)===null||r===void 0)&&r.bridge?"ios":"web"},ZE=e=>{const n=e.CapacitorCustomPlatform||null,r=e.Capacitor||{},s=r.Plugins=r.Plugins||{},l=()=>n!==null?n.name:QE(e),u=()=>l()!=="web",c=g=>{const x=d.get(g);return!!(x!=null&&x.platforms.has(l())||f(g))},f=g=>{var x;return(x=r.PluginHeaders)===null||x===void 0?void 0:x.find(w=>w.name===g)},m=g=>e.console.error(g),d=new Map,y=(g,x={})=>{const w=d.get(g);if(w)return console.warn(`Capacitor plugin "${g}" already registered. Cannot register plugins twice.`),w.proxy;const S=l(),D=f(g);let q;const L=async()=>(!q&&S in x?q=typeof x[S]=="function"?q=await x[S]():q=x[S]:n!==null&&!q&&"web"in x&&(q=typeof x.web=="function"?q=await x.web():q=x.web),q),$=(Q,H)=>{var R,X;if(D){const J=D==null?void 0:D.methods.find(ae=>H===ae.name);if(J)return J.rtype==="promise"?ae=>r.nativePromise(g,H.toString(),ae):(ae,re)=>r.nativeCallback(g,H.toString(),ae,re);if(Q)return(R=Q[H])===null||R===void 0?void 0:R.bind(Q)}else{if(Q)return(X=Q[H])===null||X===void 0?void 0:X.bind(Q);throw new Ch(`"${g}" plugin is not implemented on ${S}`,pa.Unimplemented)}},T=Q=>{let H;const R=(...X)=>{const J=L().then(ae=>{const re=$(ae,Q);if(re){const F=re(...X);return H=F==null?void 0:F.remove,F}else throw new Ch(`"${g}.${Q}()" is not implemented on ${S}`,pa.Unimplemented)});return Q==="addListener"&&(J.remove=async()=>H()),J};return R.toString=()=>`${Q.toString()}() { [capacitor code] }`,Object.defineProperty(R,"name",{value:Q,writable:!1,configurable:!1}),R},te=T("addListener"),B=T("removeListener"),z=(Q,H)=>{const R=te({eventName:Q},H),X=async()=>{const ae=await R;B({eventName:Q,callbackId:ae},H)},J=new Promise(ae=>R.then(()=>ae({remove:X})));return J.remove=async()=>{console.warn("Using addListener() without 'await' is deprecated."),await X()},J},K=new Proxy({},{get(Q,H){switch(H){case"$$typeof":return;case"toJSON":return()=>({});case"addListener":return D?z:te;case"removeListener":return B;default:return T(H)}}});return s[g]=K,d.set(g,{name:g,proxy:K,platforms:new Set([...Object.keys(x),...D?[S]:[]])}),K};return r.convertFileSrc||(r.convertFileSrc=g=>g),r.getPlatform=l,r.handleError=m,r.isNativePlatform=u,r.isPluginAvailable=c,r.registerPlugin=y,r.Exception=Ch,r.DEBUG=!!r.DEBUG,r.isLoggingEnabled=!!r.isLoggingEnabled,r},WE=e=>e.Capacitor=ZE(e),Gn=WE(typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}),ms=Gn.registerPlugin;class Pd{constructor(){this.listeners={},this.retainedEventArguments={},this.windowListeners={}}addListener(n,r){let s=!1;this.listeners[n]||(this.listeners[n]=[],s=!0),this.listeners[n].push(r);const u=this.windowListeners[n];u&&!u.registered&&this.addWindowListener(u),s&&this.sendRetainedArgumentsForEvent(n);const c=async()=>this.removeListener(n,r);return Promise.resolve({remove:c})}async removeAllListeners(){this.listeners={};for(const n in this.windowListeners)this.removeWindowListener(this.windowListeners[n]);this.windowListeners={}}notifyListeners(n,r,s){const l=this.listeners[n];if(!l){if(s){let u=this.retainedEventArguments[n];u||(u=[]),u.push(r),this.retainedEventArguments[n]=u}return}l.forEach(u=>u(r))}hasListeners(n){var r;return!!(!((r=this.listeners[n])===null||r===void 0)&&r.length)}registerWindowListener(n,r){this.windowListeners[r]={registered:!1,windowEventName:n,pluginEventName:r,handler:s=>{this.notifyListeners(r,s)}}}unimplemented(n="not implemented"){return new Gn.Exception(n,pa.Unimplemented)}unavailable(n="not available"){return new Gn.Exception(n,pa.Unavailable)}async removeListener(n,r){const s=this.listeners[n];if(!s)return;const l=s.indexOf(r);this.listeners[n].splice(l,1),this.listeners[n].length||this.removeWindowListener(this.windowListeners[n])}addWindowListener(n){window.addEventListener(n.windowEventName,n.handler),n.registered=!0}removeWindowListener(n){n&&(window.removeEventListener(n.windowEventName,n.handler),n.registered=!1)}sendRetainedArgumentsForEvent(n){const r=this.retainedEventArguments[n];r&&(delete this.retainedEventArguments[n],r.forEach(s=>{this.notifyListeners(n,s)}))}}const O0=e=>encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape),R0=e=>e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent);class ek extends Pd{async getCookies(){const n=document.cookie,r={};return n.split(";").forEach(s=>{if(s.length<=0)return;let[l,u]=s.replace(/=/,"CAP_COOKIE").split("CAP_COOKIE");l=R0(l).trim(),u=R0(u).trim(),r[l]=u}),r}async setCookie(n){try{const r=O0(n.key),s=O0(n.value),l=n.expires?`; expires=${n.expires.replace("expires=","")}`:"",u=(n.path||"/").replace("path=",""),c=n.url!=null&&n.url.length>0?`domain=${n.url}`:"";document.cookie=`${r}=${s||""}${l}; path=${u}; ${c};`}catch(r){return Promise.reject(r)}}async deleteCookie(n){try{document.cookie=`${n.key}=; Max-Age=0`}catch(r){return Promise.reject(r)}}async clearCookies(){try{const n=document.cookie.split(";")||[];for(const r of n)document.cookie=r.replace(/^ +/,"").replace(/=.*/,`=;expires=${new Date().toUTCString()};path=/`)}catch(n){return Promise.reject(n)}}async clearAllCookies(){try{await this.clearCookies()}catch(n){return Promise.reject(n)}}}ms("CapacitorCookies",{web:()=>new ek});const tk=async e=>new Promise((n,r)=>{const s=new FileReader;s.onload=()=>{const l=s.result;n(l.indexOf(",")>=0?l.split(",")[1]:l)},s.onerror=l=>r(l),s.readAsDataURL(e)}),nk=(e={})=>{const n=Object.keys(e);return Object.keys(e).map(l=>l.toLocaleLowerCase()).reduce((l,u,c)=>(l[u]=e[n[c]],l),{})},rk=(e,n=!0)=>e?Object.entries(e).reduce((s,l)=>{const[u,c]=l;let f,m;return Array.isArray(c)?(m="",c.forEach(d=>{f=n?encodeURIComponent(d):d,m+=`${u}=${f}&`}),m.slice(0,-1)):(f=n?encodeURIComponent(c):c,m=`${u}=${f}`),`${s}&${m}`},"").substr(1):null,ik=(e,n={})=>{const r=Object.assign({method:e.method||"GET",headers:e.headers},n),l=nk(e.headers)["content-type"]||"";if(typeof e.data=="string")r.body=e.data;else if(l.includes("application/x-www-form-urlencoded")){const u=new URLSearchParams;for(const[c,f]of Object.entries(e.data||{}))u.set(c,f);r.body=u.toString()}else if(l.includes("multipart/form-data")||e.data instanceof FormData){const u=new FormData;if(e.data instanceof FormData)e.data.forEach((f,m)=>{u.append(m,f)});else for(const f of Object.keys(e.data))u.append(f,e.data[f]);r.body=u;const c=new Headers(r.headers);c.delete("content-type"),r.headers=c}else(l.includes("application/json")||typeof e.data=="object")&&(r.body=JSON.stringify(e.data));return r};class sk extends Pd{async request(n){const r=ik(n,n.webFetchExtra),s=rk(n.params,n.shouldEncodeUrlParams),l=s?`${n.url}?${s}`:n.url,u=await fetch(l,r),c=u.headers.get("content-type")||"";let{responseType:f="text"}=u.ok?n:{};c.includes("application/json")&&(f="json");let m,d;switch(f){case"arraybuffer":case"blob":d=await u.blob(),m=await tk(d);break;case"json":m=await u.json();break;case"document":case"text":default:m=await u.text()}const y={};return u.headers.forEach((g,x)=>{y[x]=g}),{data:m,headers:y,status:u.status,url:u.url}}async get(n){return this.request(Object.assign(Object.assign({},n),{method:"GET"}))}async post(n){return this.request(Object.assign(Object.assign({},n),{method:"POST"}))}async put(n){return this.request(Object.assign(Object.assign({},n),{method:"PUT"}))}async patch(n){return this.request(Object.assign(Object.assign({},n),{method:"PATCH"}))}async delete(n){return this.request(Object.assign(Object.assign({},n),{method:"DELETE"}))}}ms("CapacitorHttp",{web:()=>new sk});var M0;(function(e){e.Dark="DARK",e.Light="LIGHT",e.Default="DEFAULT"})(M0||(M0={}));var D0;(function(e){e.StatusBar="StatusBar",e.NavigationBar="NavigationBar"})(D0||(D0={}));class ak extends Pd{async setStyle(){this.unavailable("not available for web")}async setAnimation(){this.unavailable("not available for web")}async show(){this.unavailable("not available for web")}async hide(){this.unavailable("not available for web")}}ms("SystemBars",{web:()=>new ak});const lk="modulepreload",ok=function(e){return"/"+e},L0={},qd=function(n,r,s){let l=Promise.resolve();if(r&&r.length>0){let c=function(d){return Promise.all(d.map(y=>Promise.resolve(y).then(g=>({status:"fulfilled",value:g}),g=>({status:"rejected",reason:g}))))};document.getElementsByTagName("link");const f=document.querySelector("meta[property=csp-nonce]"),m=(f==null?void 0:f.nonce)||(f==null?void 0:f.getAttribute("nonce"));l=c(r.map(d=>{if(d=ok(d),d in L0)return;L0[d]=!0;const y=d.endsWith(".css"),g=y?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${d}"]${g}`))return;const x=document.createElement("link");if(x.rel=y?"stylesheet":lk,y||(x.as="script"),x.crossOrigin="",x.href=d,m&&x.setAttribute("nonce",m),document.head.appendChild(x),y)return new Promise((w,S)=>{x.addEventListener("load",w),x.addEventListener("error",()=>S(new Error(`Unable to preload CSS for ${d}`)))})}))}function u(c){const f=new Event("vite:preloadError",{cancelable:!0});if(f.payload=c,window.dispatchEvent(f),!f.defaultPrevented)throw c}return l.then(c=>{for(const f of c||[])f.status==="rejected"&&u(f.reason);return n().catch(u)})},Cx=ms("App",{web:()=>qd(()=>import("./web-D4ty3qtI.js"),[]).then(e=>new e.AppWeb)}),uk=ms("Network",{web:()=>qd(()=>import("./web-C9g_YGd8.js"),[]).then(e=>new e.NetworkWeb)}),zu=Gn.isNativePlatform()?"https://app.palmier.me":"";async function Ax(e,n,r,s){const l=`${zu}${n}`;console.log(`[API] ${e} ${l}`);const c=await fetch(l,{method:e,headers:{"Content-Type":"application/json"},body:r!=null?JSON.stringify(r):void 0});if(!c.ok){const f=await c.text();let m;try{const d=JSON.parse(f);m=d.error??d.message??f}catch{m=f}throw console.error(`[API] ${e} ${n} failed:`,c.status,m),new Error(m||`Request failed with status ${c.status}`)}return console.log(`[API] ${e} ${n} ->`,c.status),c.json()}function ck(e,n,r){return Ax("POST",e,n)}function fk(e,n){return Ax("GET",e,void 0)}const z0=Gn.isNativePlatform(),Tx=N.createContext({connected:!1,mode:"connecting",nc:null,request(){return Promise.reject(new Error("No host connection"))},subscribeEvents(){return()=>{}},activeHost:null,unauthorized:!1}),hk=2e3,Ah=6e3,dk=1500,mk=6e4;function pk({children:e}){const{getActiveHost:n}=xa(),r=n(),[s,l]=N.useState(null),[u,c]=N.useState(!1),f=N.useRef(null),[m,d]=N.useState(!1),[y,g]=N.useState(!1),[x,w]=N.useState(!1),[S,D]=N.useState(!1),q=N.useRef(ju()),L=N.useRef(new Set),$=N.useRef(0),T=r!=null&&!!r.directUrl,te=z0&&!T&&!!(r!=null&&r.lanUrl)&&S,B=y||x?"disconnected":r?T?m?"direct":"connecting":u?te?"lan":"nats":"connecting":"connecting",z=B!=="connecting"&&B!=="disconnected";N.useEffect(()=>{g(!1),w(!1)},[r==null?void 0:r.hostId,r==null?void 0:r.clientToken]),N.useEffect(()=>{if(!z0||T||!(r!=null&&r.lanUrl)){D(!1);return}let H=!1;const R=r.lanUrl,X=r.hostId;async function J(){console.log("[HOST/LAN] probing",R);try{const P=await fetch(`${R}/health`,{signal:AbortSignal.timeout(dk)});if(H)return;if(!P.ok){console.log("[HOST/LAN] probe got non-ok:",P.status),D(!1);return}const V=await P.json(),ue=V.hostId===X;ue?console.log("[HOST/LAN] reachable"):console.log("[HOST/LAN] hostId mismatch — got:",V.hostId,"expected:",X),D(ue)}catch(P){H||(console.log("[HOST/LAN] probe failed:",P instanceof Error?P.message:P),D(!1))}}J();const ae=window.setInterval(J,mk),re=Cx.addListener("appStateChange",P=>{P.isActive&&J()}),F=uk.addListener("networkStatusChange",()=>J());return()=>{H=!0,clearInterval(ae),re.then(P=>P.remove()),F.then(P=>P.remove())}},[r==null?void 0:r.hostId,r==null?void 0:r.lanUrl,T]),N.useEffect(()=>{if(T){f.current&&(f.current.close().catch(()=>{}),f.current=null,l(null),c(!1));return}if(!r)return;let H=!1,R=1e3;const X=3e4;async function J(){for(;!H;)try{const ae=await fetch(`${zu}/api/nats-credentials/${r.hostId}`);if(H)return;if(ae.status===401||ae.status===403||ae.status===404){console.error("[NATS] Host not found or rejected by relay:",ae.status),w(!0);return}if(!ae.ok)throw new Error(`credentials fetch ${ae.status}`);const re=await ae.json();if(!re.natsWsUrl){console.error("[NATS] Relay returned empty natsWsUrl — treating as terminal"),w(!0);return}if(H)return;console.log("[NATS] Connecting to",re.natsWsUrl);const F=await kx({servers:re.natsWsUrl,authenticator:gx(re.natsJwt,new TextEncoder().encode(re.natsNkeySeed))});if(H){F.close().catch(()=>{});return}if(console.log("[NATS] Connected"),f.current=F,l(F),c(!0),R=1e3,await F.closed(),H)return;console.log("[NATS] Connection closed, will reconnect"),f.current=null,l(null),c(!1)}catch(ae){if(H)return;console.warn(`[NATS] Connect failed, retrying in ${R}ms:`,ae),c(!1),await new Promise(re=>setTimeout(re,R)),R=Math.min(R*2,X)}}return J(),()=>{H=!0,f.current&&(f.current.close().catch(()=>{}),f.current=null,l(null),c(!1))}},[T,r]),N.useEffect(()=>{if(!r||!T){d(!1);return}const H=new AbortController;async function R(){var re;const J=new AbortController,ae=setTimeout(()=>J.abort(),hk);H.signal.addEventListener("abort",()=>J.abort());try{const F=await fetch(`${r.directUrl}/events`,{headers:{Authorization:`Bearer ${r.clientToken}`},signal:J.signal});return clearTimeout(ae),F.ok?((re=F.body)==null?void 0:re.getReader())??null:null}catch{return clearTimeout(ae),null}}async function X(J){d(!0),console.log("[HOST] SSE connected to",r.directUrl),$.current=Date.now();function ae(){setTimeout(()=>{H.signal.aborted||Date.now()-$.current<Ah||(console.log("[HOST] Heartbeat timeout — no data for",Ah/1e3,"s"),H.abort(),d(!1),console.log("[HOST] Direct host unreachable"))},Ah)}ae();const re=new TextDecoder;let F="";try{for(;;){const{done:P,value:V}=await J.read();if(P)break;F+=re.decode(V,{stream:!0}),$.current=Date.now(),ae();const ue=F.split(`
88
+ `);F=ue.pop()??"";for(const xe of ue)if(xe.startsWith("data: ")){const _=xe.slice(6);try{const M=JSON.parse(_);if(M.task_id&&M.event_type){const W=`host-event.${r.hostId}.${M.task_id}`;for(const A of L.current)A({subject:W,data:q.current.encode(_)})}}catch{}}}}catch{}}return(async()=>{const J=await R();J&&await X(J)})(),()=>{H.abort(),d(!1)}},[r,T]);const K=N.useCallback(async(H,R,X)=>{if(!r)throw new Error("No active host");function J(F){F&&typeof F=="object"&&F.error==="Unauthorized"&&g(!0)}async function ae(F,P){console.log(`[HOST/${P}] → ${H}`,R??"");const V=await fetch(`${F}/rpc/${H}`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${r.clientToken}`},body:R!=null?JSON.stringify(R):void 0,signal:X!=null&&X.timeout?AbortSignal.timeout(X.timeout):void 0});if(V.status===401)throw g(!0),new Error("Unauthorized");const ue=await V.json();return J(ue),console.log(`[HOST/${P}] ← ${H}`,ue),ue}async function re(){if(!f.current)throw new Error("Not connected");const F=`host.${r.hostId}.rpc.${H}`,P={...R??{},clientToken:r.clientToken},V=q.current.encode(JSON.stringify(P));console.log(`[HOST/NATS] → ${H}`,R??"");const ue=await f.current.request(F,V,{timeout:(X==null?void 0:X.timeout)??1e4}),xe=JSON.parse(q.current.decode(ue.data));return J(xe),console.log(`[HOST/NATS] ← ${H}`,xe),xe}if(T)return ae(r.directUrl,"HTTP");if(te&&r.lanUrl)try{return await ae(r.lanUrl,"LAN")}catch(F){if(F instanceof Error&&F.message==="Unauthorized")throw F;console.log("[HOST/LAN] failed, falling back to NATS:",F),D(!1)}return re()},[r,T,te]),Q=N.useCallback((H,R)=>{if(T)return L.current.add(R),()=>{L.current.delete(R)};if(f.current){const X=f.current.subscribe(`host-event.${H}.>`);let J=!1;return(async()=>{try{for await(const ae of X){if(J)break;R({subject:ae.subject,data:ae.data})}}catch{}})(),()=>{J=!0,X.unsubscribe()}}return()=>{}},[r,T]);return b.jsx(Tx.Provider,{value:{connected:z,mode:B,nc:s,request:K,subscribeEvents:Q,activeHost:r,unauthorized:y},children:e})}function wa(){return N.useContext(Tx)}const Ut=Gn.isNativePlatform()?ms("Device"):null;function Uu(e){const n=new Date(e),r=new Date,s=n.toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"});return n.toDateString()===r.toDateString()?s:`${n.toLocaleDateString(void 0,{month:"short",day:"numeric"})} ${s}`}const jx={};function gk(e){for(const n of e)jx[n.key]=n.label}function hd(e){return jx[e]??e}const yk=()=>window.matchMedia("(max-width: 600px)").matches;function bk({task:e,lastEvent:n,onEdit:r,onDelete:s,onViewRun:l}){var ae;const{request:u}=wa(),[c,f]=N.useState(!1),[m,d]=N.useState(!1),[y,g]=N.useState(!1),x=N.useRef(null),w=(n==null?void 0:n.running_state)==="started",S=(((ae=e.schedule_values)==null?void 0:ae.length)??0)>0,D=e.schedule_type==="on_new_notification"||e.schedule_type==="on_new_sms",L=!!e.schedule_enabled&&!!e.schedule_type&&(S||D)?w?"var(--color-success)":(n==null?void 0:n.running_state)==="failed"?"var(--color-error)":"var(--color-success)":"var(--color-text-secondary)";N.useEffect(()=>{if(!m)return;function re(F){x.current&&!x.current.contains(F.target)&&d(!1)}return document.addEventListener("mousedown",re),()=>document.removeEventListener("mousedown",re)},[m]);function $(){yk()?g(!0):d(re=>!re)}function T(){d(!1),g(!1)}async function te(){if(T(),!!confirm("Abort this task?")){f(!0);try{await u("task.abort",{id:e.id})}catch(re){console.error("Abort failed:",re)}finally{f(!1)}}}async function B(){T();try{const re=await u("task.run",{id:e.id});l(e.id,re.run_id)}catch(re){console.error("Run failed:",re)}}async function z(){if(T(),!!confirm("Delete this task? Results and reports will be kept."))try{await u("task.delete",{id:e.id}),s(e.id)}catch(re){console.error("Delete failed:",re)}}const K={started:"Started",finished:"Finished",aborted:"Aborted",failed:"Failed"};function Q(re,F){if(re==="specific_times"){const ve=new Date(F);return{kind:"specific_times",detail:isNaN(ve.getTime())?F:`${ve.toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"})} at ${ve.toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"})}`}}const P=F.split(" ");if(P.length!==5)return{kind:"unknown",detail:F};const[V,ue,xe,,_]=P,M=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];if(ue==="*")return{kind:"hourly",detail:""};const W=new Date;W.setHours(Number(ue),Number(V),0,0);const A=W.toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"});return _!=="*"?{kind:"weekly",detail:`${M[Number(_)]??_} at ${A}`}:xe!=="*"?{kind:"monthly",detail:`day ${xe} at ${A}`}:{kind:"daily",detail:A}}function H(re,F){const P=Q(re,F);return P.kind==="hourly"?"Every hour":P.kind==="specific_times"?`Once on ${P.detail}`:`${P.kind.charAt(0).toUpperCase()+P.kind.slice(1)}: ${P.detail}`}function R(re,F){if(!re)return"";if(re==="on_new_notification")return"On new notification";if(re==="on_new_sms")return"On new SMS";if(!F||F.length===0)return"";if(F.length===1)return H(re,F[0]);const P=F.map(ue=>Q(re,ue));if(new Set(P.map(ue=>ue.kind)).size===1){const ue=P[0].kind;if(ue==="hourly")return"Every hour";const xe=P.map(_=>_.detail);return`${ue.charAt(0).toUpperCase()+ue.slice(1)}: ${xe.join(", ")}`}return F.map(ue=>H(re,ue)).join(", ")}const X=R(e.schedule_type,e.schedule_values),J=b.jsxs(b.Fragment,{children:[b.jsxs("button",{onClick:()=>{T(),r(e)},children:[b.jsx("span",{className:"menu-icon",children:"✎"}),"Edit"]}),b.jsxs("button",{onClick:()=>{T(),l(e.id)},children:[b.jsx("span",{className:"menu-icon",children:"📄"}),"View All Runs"]}),w?b.jsxs("button",{className:"menu-item-danger",onClick:te,disabled:c,children:[b.jsx("span",{className:"menu-icon",children:"◼"}),"Abort"]}):b.jsxs(b.Fragment,{children:[b.jsxs("button",{onClick:B,children:[b.jsx("span",{className:"menu-icon",children:"▶"}),"Run Now"]}),b.jsxs("button",{className:"menu-item-danger",onClick:z,children:[b.jsx("span",{className:"menu-icon",children:"🗑"}),"Delete"]})]})]});return b.jsxs(b.Fragment,{children:[b.jsxs("div",{className:"task-card",onClick:()=>l(e.id,"latest"),children:[b.jsxs("div",{className:"task-card-header",children:[b.jsxs("div",{className:"task-card-title-row",children:[w?b.jsx("span",{className:"status-spinner",children:b.jsx("span",{})}):b.jsx("span",{className:"status-dot",style:{backgroundColor:L}}),b.jsx("h3",{className:"task-card-name",children:e.name||e.user_prompt})]}),b.jsx("div",{className:"task-card-actions",onClick:re=>re.stopPropagation(),children:b.jsxs("div",{className:"task-card-menu",ref:x,children:[b.jsx("button",{className:"task-card-menu-btn",onClick:$,"aria-label":"Task actions",children:"⋮"}),m&&b.jsx("div",{className:"task-card-menu-dropdown",children:J})]})})]}),b.jsxs("div",{className:"task-card-meta",children:[e.agent&&b.jsx("span",{className:"task-card-agent",children:hd(e.agent)}),n&&K[n.running_state]&&b.jsxs("span",{className:"task-card-last-event",children:[K[n.running_state]," ",Uu(n.time_stamp)]}),e.schedule_type&&(S||D)&&b.jsx("span",{className:"task-card-triggers",children:e.schedule_enabled?X:"Schedule disabled"})]})]}),y&&fa.createPortal(b.jsx("div",{className:"bottom-sheet-overlay",onClick:()=>g(!1),children:b.jsxs("div",{className:"bottom-sheet",onClick:re=>re.stopPropagation(),children:[b.jsx("div",{className:"bottom-sheet-handle"}),b.jsx("div",{className:"bottom-sheet-title",children:e.name||e.user_prompt}),b.jsx("div",{className:"bottom-sheet-actions",children:J})]})}),document.body)]})}function xk({permissions:e}){return b.jsxs("div",{className:"plan-dialog",children:[b.jsx("h2",{children:"Granted Permissions"}),b.jsx("div",{className:"plan-dialog-scroll",children:e&&e.length>0?b.jsx("div",{className:"permissions-section",children:b.jsx("ul",{className:"permissions-list",children:e.map((n,r)=>b.jsxs("li",{className:"permission-item",children:[b.jsx("span",{className:"permission-tool",children:n.name}),b.jsx("span",{className:"permission-desc",children:n.description})]},r))})}):b.jsx("p",{className:"plan-empty",children:"No permissions have been granted for this task."})}),b.jsx("div",{className:"plan-dialog-actions",children:b.jsx("button",{className:"btn btn-secondary",onClick:()=>history.back(),children:"Back"})})]})}const ea=[];function vk(){const e=ea.pop();e&&(e.pushed.current=!1,e.close())}let U0=!1;function wk(){U0||(U0=!0,window.addEventListener("popstate",vk))}function B0(e,n){const r=N.useRef(!1),s=N.useRef(n);s.current=n;const l=N.useCallback(()=>s.current(),[]),u=N.useRef({close:l,pushed:r});u.current.close=l,N.useEffect(()=>{if(e&&!r.current)wk(),history.pushState({modal:!0},""),ea.push(u.current),r.current=!0;else if(!e&&r.current){r.current=!1;const c=ea.indexOf(u.current);c!==-1&&ea.splice(c,1),history.back()}},[e,l]),N.useEffect(()=>{const c=u.current;return()=>{if(r.current){r.current=!1;const f=ea.indexOf(c);f!==-1&&ea.splice(f,1),history.back()}}},[])}const Sk=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],_k=["specific_times","hourly","daily","weekly","monthly"];function mu(e){return _k.includes(e)}function Ek(e){return e==="on_new_notification"||e==="on_new_sms"}function Qr(e="daily"){return{schedule:e,time:"00:00",dayOfWeek:"1",dayOfMonth:"1",onceDate:"",onceTime:"00:00"}}function kk(e){const n=e.split(" ");if(n.length!==5)return Qr();const[r,s,l,,u]=n;if(s==="*")return Qr("hourly");const c=`${s.padStart(2,"0")}:${r.padStart(2,"0")}`;return u!=="*"?{...Qr("weekly"),time:c,dayOfWeek:u}:l!=="*"?{...Qr("monthly"),time:c,dayOfMonth:l}:{...Qr("daily"),time:c}}function Nx(e,n){if(e==="specific_times"){const[r,s]=n.split("T");return{...Qr("specific_times"),onceDate:r??"",onceTime:(s??"09:00").slice(0,5)}}return kk(n)}function Ck(e){const[n,r]=e.time.split(":").map(Number);switch(e.schedule){case"hourly":return"0 * * * *";case"daily":return`${r} ${n} * * *`;case"weekly":return`${r} ${n} * * ${e.dayOfWeek}`;case"monthly":return`${r} ${n} ${e.dayOfMonth} * *`;default:return"0 * * * *"}}function Ak(e){return e.schedule==="specific_times"?e.onceDate?`${e.onceDate}T${e.onceTime}`:null:Ck(e)}function Th(e){return e==="specific_times"?"specific_times":e==="on_new_notification"?"on_new_notification":e==="on_new_sms"?"on_new_sms":"crons"}function jh(e){var s;if(!e)return"daily";if(e.command)return"command";const n=e.schedule_type;if(n==="on_new_notification"||n==="on_new_sms")return n;if(n!=="crons"&&n!=="specific_times")return"ondemand";const r=(s=e.schedule_values)==null?void 0:s[0];return r?Nx(n,r).schedule:"ondemand"}function Tk({initial:e,agents:n,hostPlatform:r,isNotificationListener:s,onSaved:l,onRun:u,onCancel:c}){var Gt;const{request:f}=wa(),m=()=>{var Se;const ge=localStorage.getItem("palmier:lastAgent"),Le=n.map(ht=>ht.key);return ge&&Le.includes(ge)?ge:((Se=n[0])==null?void 0:Se.key)??""},[d,y]=N.useState((e==null?void 0:e.user_prompt)??""),[g,x]=N.useState((e==null?void 0:e.agent)??m()),w=!!((Gt=e==null?void 0:e.permissions)!=null&&Gt.length),[S,D]=N.useState(!1),q=N.useCallback(()=>D(!1),[]);B0(S,q);const[L,$]=N.useState(null),[T,te]=N.useState(()=>jh(e)),[B,z]=N.useState(()=>{const ge=e==null?void 0:e.schedule_type,Le=e==null?void 0:e.schedule_values;if(Le&&(ge==="crons"||ge==="specific_times"))return Le.map(ht=>Nx(ge,ht));const Se=jh(e);return mu(Se)?[Qr(Se)]:[]}),[K,Q]=N.useState((e==null?void 0:e.requires_confirmation)??!1),[H,R]=N.useState((e==null?void 0:e.schedule_enabled)??!0),[X,J]=N.useState((e==null?void 0:e.yolo_mode)??!1),[ae,re]=N.useState((e==null?void 0:e.foreground_mode)??!1),[F,P]=N.useState((e==null?void 0:e.command)??""),[V,ue]=N.useState(!1),xe=(e==null?void 0:e.schedule_type)==="on_new_notification"&&e.schedule_values&&e.schedule_values.length>0?e.schedule_values[0]:"",[_,M]=N.useState(xe),[W,A]=N.useState([]),[ve,Ce]=N.useState(!1),[je,ze]=N.useState(!1),[qe,Te]=N.useState(""),Ae=N.useCallback(()=>ze(!1),[]);B0(je,Ae),N.useEffect(()=>{if(T!=="on_new_notification"||!s||!Gn.isNativePlatform()||!Ut)return;let ge=!1;return Ce(!0),Ut.getInstalledApps().then(({apps:Le})=>{if(ge)return;const Se="com.palmier.app",ht=Le.filter(pt=>pt.packageName!==Se).sort((pt,Nn)=>(pt.appName||pt.packageName).localeCompare(Nn.appName||Nn.packageName));A(ht)}).catch(()=>{}).finally(()=>{ge||Ce(!1)}),()=>{ge=!0}},[T,s]);const Je=(e==null?void 0:e.schedule_type)==="on_new_sms"&&e.schedule_values&&e.schedule_values.length>0?e.schedule_values[0]:"",[rt,kt]=N.useState(Je),Ke=N.useRef(null),ot=mu(T),Fe=T==="command",He=Ek(T),et=n.find(ge=>ge.key===g),mt=!!(et!=null&&et.supportsYolo);N.useEffect(()=>{!mt&&X&&J(!1)},[mt,X]);const it=!!e,Pt=jh(e),Nt=!it||d!==((e==null?void 0:e.user_prompt)??"")||g!==((e==null?void 0:e.agent)??"")||T!==Pt||K!==((e==null?void 0:e.requires_confirmation)??!1)||H!==((e==null?void 0:e.schedule_enabled)??!0)||X!==((e==null?void 0:e.yolo_mode)??!1)||ae!==((e==null?void 0:e.foreground_mode)??!1)||Fe&&F!==((e==null?void 0:e.command)??"")||ot&&(JSON.stringify($e())!==JSON.stringify((e==null?void 0:e.schedule_values)??[])||Th(T)!==((e==null?void 0:e.schedule_type)??void 0))||He&&T!==(e==null?void 0:e.schedule_type)||T==="on_new_notification"&&_.trim()!==xe.trim()||T==="on_new_sms"&&rt.trim()!==Je.trim(),Tn=ot&&B.some(ge=>ge.schedule==="specific_times"&&(!ge.onceDate||new Date(`${ge.onceDate}T${ge.onceTime}`)<=new Date)),xt=Nt&&!!d.trim()&&!Tn&&(!Fe||!!F.trim())&&(!ot||B.length>0);function jn(ge,Le){z(Se=>Se.map((ht,pt)=>pt===ge?{...ht,...Le}:ht))}function fe(ge){z(Le=>Le.filter((Se,ht)=>ht!==ge))}function we(){mu(T)&&z(ge=>[...ge,ge.length>0?{...ge[ge.length-1]}:Qr(T)])}function Ue(ge){te(ge),mu(ge)?z([Qr(ge)]):(z([]),Q(!1)),ge==="command"?setTimeout(()=>{var Le;return(Le=Ke.current)==null?void 0:Le.focus()},0):P(""),ge!=="on_new_notification"&&M(xe),ge!=="on_new_sms"&&kt(Je)}function $e(){return B.flatMap(ge=>{const Le=Ak(ge);return Le?[Le]:[]})}function at(){return X?confirm(`Yolo mode is enabled. The agent will auto-approve all tool calls — it can read, write, delete files, run arbitrary commands, and access the network without asking for permission.
89
+
90
+ Are you sure you want to continue?`):!0}async function rn(){ue(!0),$(null);try{const ge=ot?$e():T==="on_new_notification"&&_.trim()?[_.trim()]:T==="on_new_sms"&&rt.trim()?[rt.trim()]:[],Le=ot||He?Th(T):null,Se={user_prompt:d,agent:g,schedule_type:Le,schedule_values:ge.length>0?ge:null,schedule_enabled:T!=="ondemand"&&H,requires_confirmation:ot?K:!1,yolo_mode:X,foreground_mode:ae,command:Fe?F:""};it&&(Se.id=e.id);const pt=await f(it?"task.update":"task.create",Se,{timeout:45e3});if(pt.error){$(pt.error);return}if(it||localStorage.setItem("palmier:lastAgent",g),Fe&&!it){l(pt);try{const Nn=await f("task.run",{id:pt.id});Nn.run_id?u(pt.id,Nn.run_id):Nn.error||u(pt.id)}catch{}return}l(pt)}catch(ge){$(ge instanceof Error?ge.message:String(ge))}finally{ue(!1)}}const xn=it?"Save":Fe?"Run":(ot||He)&&H?"Schedule":"Save";return b.jsxs("div",{className:"task-form-overlay",children:[b.jsx("div",{className:"task-form",children:S?b.jsx(xk,{permissions:e==null?void 0:e.permissions}):b.jsxs(b.Fragment,{children:[b.jsx("div",{className:"task-form-header",children:b.jsx("h2",{children:e?"Edit Task":"New Task"})}),L&&b.jsx("div",{className:"form-error",children:L}),b.jsx("textarea",{autoFocus:!e,className:"form-textarea",value:d,onChange:ge=>y(ge.target.value),placeholder:Fe?"If the input email contains an event, create a calendar entry for it.":"Research today's top AI news and write a summary.",rows:4,disabled:V}),b.jsxs("div",{className:"plan-actions",children:[b.jsxs("div",{className:"agent-picker-section-inline",children:[b.jsx("span",{className:"agent-picker-label",children:"Run with"}),b.jsx("select",{className:"form-select form-select-sm",value:g,onChange:ge=>x(ge.target.value),disabled:V,children:n.map(ge=>b.jsx("option",{value:ge.key,children:ge.label},ge.key))})]}),mt&&b.jsxs("label",{className:"yolo-inline",style:{marginLeft:"auto"},children:[b.jsx("input",{type:"checkbox",checked:X,onChange:ge=>J(ge.target.checked),disabled:V}),"Yolo"]}),mt&&X&&b.jsx("p",{className:"yolo-warning",children:"The agent will auto-approve all tool calls without asking for permission."}),w&&b.jsx("div",{className:"granted-permissions-row",children:b.jsx("button",{className:"btn btn-link",onClick:()=>D(!0),children:"Granted Permissions"})})]}),b.jsx("div",{className:"toggles-group",children:b.jsxs("div",{className:"schedule-section",children:[b.jsx("h3",{className:"schedule-section-title",children:"Schedule"}),b.jsxs("select",{className:"form-select",value:T,onChange:ge=>Ue(ge.target.value),disabled:V,children:[b.jsx("option",{value:"ondemand",children:"On Demand"}),b.jsx("option",{value:"specific_times",children:"Specific Times"}),b.jsx("option",{value:"hourly",children:"Hourly"}),b.jsx("option",{value:"daily",children:"Daily"}),b.jsx("option",{value:"weekly",children:"Weekly"}),b.jsx("option",{value:"monthly",children:"Monthly"}),b.jsx("option",{value:"on_new_notification",children:"On New Notification"}),b.jsx("option",{value:"on_new_sms",children:"On New SMS"}),b.jsx("option",{value:"command",children:"Command-triggered"})]}),He&&b.jsxs("div",{className:"schedule-reactive",children:[b.jsxs("p",{className:"command-help-text",children:[T==="on_new_notification"?"Runs each time a new push notification arrives on the paired Android device.":"Runs each time a new SMS arrives on the paired Android device."," ","The triggering payload is spliced into your task prompt — reference it as “the new ",T==="on_new_notification"?"notification":"SMS","”."]}),T==="on_new_notification"&&(()=>{const ge=W.find(Se=>Se.packageName===_),Le=(ge==null?void 0:ge.appName)||_;return b.jsxs(b.Fragment,{children:[s?_.trim()?b.jsxs("div",{className:"app-filter-selected",children:[b.jsx("span",{className:"app-filter-selected-name",children:Le}),(ge==null?void 0:ge.appName)&&b.jsx("span",{className:"app-filter-selected-pkg",children:ge.packageName}),b.jsx("button",{type:"button",className:"app-filter-selected-clear",onClick:()=>M(""),"aria-label":"Clear app filter",disabled:V,children:"✕"})]}):b.jsx("button",{type:"button",className:"btn btn-link app-filter-trigger",onClick:()=>{Te(""),ze(!0)},disabled:V,children:"Select app"}):b.jsx("input",{className:"form-input",type:"text",value:_,onChange:Se=>M(Se.target.value),placeholder:"App (optional), e.g. com.google.android.gm",disabled:V}),b.jsx("p",{className:"command-help-text app-filter-help",children:_.trim()?`Only notifications from ${Le} will trigger this task.`:"Every notification from your device triggers this task."})]})})(),T==="on_new_sms"&&b.jsxs(b.Fragment,{children:[b.jsx("input",{className:"form-input",type:"text",value:rt,onChange:ge=>kt(ge.target.value),placeholder:"From (optional), e.g. +1 555-1234)",disabled:V}),b.jsx("p",{className:"command-help-text app-filter-help",children:rt.trim()?`Only SMS from ${rt.trim()} will trigger this task. Formatting (spaces, dashes, parens) is ignored.`:"Every SMS that arrives on your device triggers this task."})]})]}),Fe&&b.jsxs("div",{className:"schedule-reactive",children:[b.jsx("p",{className:"command-help-text",children:"Runs a command and invokes the task for each line of output. Use “the input” in your task description to reference each line."}),b.jsx("input",{ref:Ke,className:"form-input form-input-mono",type:"text",value:F,onChange:ge=>P(ge.target.value),placeholder:"gws gmail +watch --project my-project",disabled:V})]}),ot&&T!=="hourly"&&b.jsxs(b.Fragment,{children:[B.map((ge,Le)=>b.jsxs("div",{className:"trigger-row-card",children:[b.jsxs("div",{className:"trigger-row-content",children:[T==="daily"&&b.jsx("input",{className:"form-input",type:"time",value:ge.time,onChange:Se=>jn(Le,{time:Se.target.value})}),T==="weekly"&&b.jsxs("div",{className:"trigger-row-top",children:[b.jsx("select",{className:"form-select",value:ge.dayOfWeek,onChange:Se=>jn(Le,{dayOfWeek:Se.target.value}),children:Sk.map((Se,ht)=>b.jsx("option",{value:String(ht),children:Se},ht))}),b.jsx("input",{className:"form-input",type:"time",value:ge.time,onChange:Se=>jn(Le,{time:Se.target.value})})]}),T==="monthly"&&b.jsxs("div",{className:"trigger-row-top",children:[b.jsx("select",{className:"form-select",value:ge.dayOfMonth,onChange:Se=>jn(Le,{dayOfMonth:Se.target.value}),children:Array.from({length:28},(Se,ht)=>ht+1).map(Se=>b.jsxs("option",{value:String(Se),children:["Day ",Se]},Se))}),b.jsx("input",{className:"form-input",type:"time",value:ge.time,onChange:Se=>jn(Le,{time:Se.target.value})})]}),T==="specific_times"&&b.jsxs("div",{className:"trigger-row-top",children:[b.jsx("input",{className:"form-input",type:"date",value:ge.onceDate,min:new Date().toISOString().split("T")[0],onChange:Se=>jn(Le,{onceDate:Se.target.value})}),b.jsx("input",{className:"form-input",type:"time",value:ge.onceTime,min:ge.onceDate===new Date().toISOString().split("T")[0]?new Date().toTimeString().slice(0,5):void 0,onChange:Se=>jn(Le,{onceTime:Se.target.value})})]})]}),B.length>1&&b.jsx("button",{className:"trigger-remove-btn",onClick:()=>fe(Le),title:"Remove trigger",children:"×"})]},Le)),b.jsx("button",{className:"trigger-add-btn",onClick:we,children:"+ Add"})]}),r==="win32"&&b.jsxs("label",{className:"toggle-label",children:[b.jsx("input",{type:"checkbox",checked:ae,onChange:ge=>re(ge.target.checked),disabled:V}),"Run in the foreground (host must login to Windows)"]}),ot&&b.jsxs("label",{className:"toggle-label",children:[b.jsx("input",{type:"checkbox",checked:K,onChange:ge=>Q(ge.target.checked),disabled:V}),"Confirm before each run"]}),T!=="ondemand"&&b.jsxs("label",{className:"toggle-label",children:[b.jsx("input",{type:"checkbox",checked:H,onChange:ge=>R(ge.target.checked),disabled:V}),"Enabled"]})]})}),!X&&et&&!et.supportsPermissions&&b.jsxs("div",{className:"form-warning",children:["Palmier does not support runtime permission granting for ",et.label,". The task may fail if required permissions are not pre-configured."]}),b.jsxs("div",{className:"form-actions",children:[b.jsxs("button",{className:"btn btn-primary",onClick:()=>at()&&rn(),disabled:!xt||V,children:[V&&b.jsx("span",{className:"btn-spinner"}),xn]}),b.jsx("button",{className:"btn btn-secondary",onClick:()=>{Nt&&d.trim()&&!confirm("You have unsaved changes. Discard?")||c()},style:{marginLeft:"auto"},children:"Cancel"})]})]})}),je&&(()=>{const ge=qe.trim().toLowerCase(),Le=ge?W.filter(Se=>Se.packageName.toLowerCase().includes(ge)||Se.appName.toLowerCase().includes(ge)):W;return b.jsx("div",{className:"app-filter-overlay",onClick:Ae,children:b.jsxs("div",{className:"app-filter-dialog",onClick:Se=>Se.stopPropagation(),children:[b.jsxs("div",{className:"app-filter-header",children:[b.jsx("h2",{children:"Select app"}),b.jsx("button",{className:"app-filter-close",onClick:Ae,"aria-label":"Close",children:b.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:b.jsx("path",{d:"M4 4L12 12M12 4L4 12",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]}),b.jsx("input",{className:"form-input app-filter-search",type:"text",value:qe,onChange:Se=>Te(Se.target.value),onKeyDown:Se=>{Se.key==="Enter"&&qe.trim()&&(M(qe.trim()),Ae())},placeholder:"Search or type a package name",autoFocus:!0}),b.jsxs("ul",{className:"app-filter-list",children:[ve&&W.length===0?Array.from({length:6}).map((Se,ht)=>b.jsx("li",{className:"app-filter-row app-filter-skeleton",children:b.jsx("div",{className:"app-filter-skeleton-bar"})},`sk-${ht}`)):Le.length===0&&!qe.trim()?b.jsx("li",{className:"app-filter-empty",children:"No apps"}):Le.map(Se=>b.jsx("li",{className:"app-filter-row",onClick:()=>{M(Se.packageName),Ae()},children:b.jsxs("div",{className:"app-filter-row-labels",children:[b.jsx("div",{className:"app-filter-row-name",children:Se.appName||Se.packageName}),Se.appName&&b.jsx("div",{className:"app-filter-row-pkg",children:Se.packageName})]})},Se.packageName)),qe.trim()&&b.jsx("li",{className:"app-filter-row",onClick:()=>{M(qe.trim()),Ae()},children:b.jsx("div",{className:"app-filter-row-labels",children:b.jsx("div",{className:"app-filter-row-name",children:qe.trim()})})})]})]})})})()]})}function Ox({pullDistance:e,refreshing:n,threshold:r}){const s=e>0||n,l=e>=r;return b.jsx("div",{className:"pull-to-refresh",style:{transform:`translateY(${e}px)`,opacity:s?Math.min(1,e/30):0},"aria-hidden":!s,children:b.jsx("div",{className:"pull-to-refresh-badge",children:n?b.jsx("div",{className:"spinner"}):b.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.25",strokeLinecap:"round",strokeLinejoin:"round",style:{transform:l?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.15s"},children:[b.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),b.jsx("polyline",{points:"19 12 12 19 5 12"})]})})})}function Rx({onRefresh:e,threshold:n=70,maxPull:r=110,enabled:s=!0}){const[l,u]=N.useState(0),[c,f]=N.useState(!1),m=N.useRef(null),d=N.useRef(!1),y=N.useRef(0),g=N.useRef(!1),x=N.useRef(e);return N.useEffect(()=>{x.current=e}),N.useEffect(()=>{if(!s)return;const w=q=>{if(g.current||window.scrollY>0){m.current=null;return}m.current=q.touches[0].clientY,d.current=!1,y.current=0},S=q=>{if(g.current||m.current==null)return;const L=q.touches[0].clientY-m.current;if(L<=0){d.current=!1,y.current=0,u(0);return}d.current=!0;const $=Math.min(r,L*.5);y.current=$,u($),q.cancelable&&q.preventDefault()},D=()=>{if(!d.current){m.current=null,u(0);return}const q=y.current;m.current=null,d.current=!1,y.current=0,q>=n?(g.current=!0,f(!0),u(n),Promise.resolve(x.current()).catch(()=>{}).finally(()=>{g.current=!1,f(!1),u(0)})):u(0)};return window.addEventListener("touchstart",w,{passive:!0}),window.addEventListener("touchmove",S,{passive:!1}),window.addEventListener("touchend",D,{passive:!0}),window.addEventListener("touchcancel",D,{passive:!0}),()=>{window.removeEventListener("touchstart",w),window.removeEventListener("touchmove",S),window.removeEventListener("touchend",D),window.removeEventListener("touchcancel",D)}},[s,n,r]),{pullDistance:l,refreshing:c,threshold:n}}function jk({connected:e,hostId:n,request:r,subscribeEvents:s,agents:l,hostPlatform:u,isNotificationListener:c,onViewRun:f}){const[m,d]=N.useState([]),[y,g]=N.useState(!1),[x,w]=N.useState(null),[S,D]=N.useState(new Map),[q,L]=N.useState(!1),[$,T]=N.useState(void 0),te=N.useCallback(()=>{L(!1),T(void 0)},[]),B=N.useCallback(async()=>{if(e){g(!0),w(null);try{const R=(await r("task.list")).tasks??[],X=new Map;for(const J of R)J.status&&X.set(J.id,J.status);D(X),d(R)}catch(H){const R=H instanceof Error?H.message:String(H);R==="Not connected"||R.includes("503")||R.toLowerCase().includes("no responders")?w(null):w(R),d([])}finally{g(!1)}}},[e,n,r]);N.useEffect(()=>{e?B():(d([]),g(!1))},[e,n,B]);const z=Rx({onRefresh:B,enabled:e});N.useEffect(()=>!e||!n?void 0:s(n,async R=>{const X=R.subject.split(".");if(X.length<3)return;const J=X.slice(2).join(".");let ae={};try{ae=JSON.parse(new TextDecoder().decode(R.data))}catch{return}const re=ae.event_type;if(!(re!=="running-state"&&re!=="permission-resolved"))try{const F=await r("task.status",{id:J},{timeout:5e3});if(F.error)return;D(P=>{const V=new Map(P);return V.set(J,F),V})}catch{}}),[e,n,s,r]);function K(H){d(R=>{const X=R.findIndex(J=>J.id===H.id);if(X>=0){const J=[...R];return J[X]=H,J}return[H,...R]}),L(!1),T(void 0)}function Q(H){d(R=>R.filter(X=>X.id!==H)),D(R=>{const X=new Map(R);return X.delete(H),X})}return b.jsxs(b.Fragment,{children:[b.jsx(Ox,{pullDistance:z.pullDistance,refreshing:z.refreshing,threshold:z.threshold}),x&&b.jsxs("div",{className:"form-error",children:[x,x.toLowerCase().includes("failed to fetch")&&b.jsxs(b.Fragment,{children:[" ",b.jsx("a",{href:"#",onClick:H=>{H.preventDefault(),window.location.reload()},children:"Reload"})]})]}),y&&!m.length?b.jsx("div",{className:"task-list",children:[0,1,2].map(H=>b.jsxs("div",{className:"task-card",style:{pointerEvents:"none"},children:[b.jsx("div",{className:"task-card-header",children:b.jsxs("div",{className:"task-card-title-row",children:[b.jsx("div",{className:"skeleton-line",style:{width:10,height:10,borderRadius:"50%"}}),b.jsx("div",{className:"skeleton-line",style:{width:`${60+H*12}%`}})]})}),b.jsxs("div",{className:"task-card-meta",children:[b.jsx("div",{className:"skeleton-line",style:{width:"30%"}}),b.jsx("div",{className:"skeleton-line",style:{width:"25%"}})]})]},H))}):m.length===0?b.jsxs("div",{className:"empty-state",children:[b.jsx("p",{className:"empty-state-text",children:"No tasks yet"}),b.jsx("p",{className:"empty-state-hint",children:"Tap the + button to create your first task."})]}):b.jsx("div",{className:"task-list",children:m.map(H=>b.jsx(bk,{task:H,lastEvent:S.get(H.id),onEdit:async R=>{try{const X=await r("task.get",{id:R.id});T(X.error?R:X)}catch{T(R)}L(!0)},onDelete:Q,onViewRun:f},H.id))}),b.jsx("button",{className:"fab",onClick:()=>{T(void 0),L(!0)},"aria-label":"New task",title:"New task",children:b.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[b.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),b.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]})}),q&&b.jsx(Tk,{initial:$,agents:l,hostPlatform:u,isNotificationListener:c,onSaved:K,onRun:f,onCancel:te})]})}let ua=null;function P0(e){ua&&(e.preventDefault(),e.returnValue="")}function Nh(e){const n=!!ua;ua=e;const r=!!ua;r&&!n?window.addEventListener("beforeunload",P0):!r&&n&&window.removeEventListener("beforeunload",P0)}function hs(){return ua?window.confirm(ua):!0}function Nk(){const e=ti(),r=Tr().pathname.startsWith("/tasks"),s=!r;function l(u){hs()&&e(u)}return b.jsxs(b.Fragment,{children:[b.jsxs("button",{className:`tab-btn ${s?"tab-btn-active":""}`,onClick:()=>l("/"),children:[b.jsx("svg",{className:"tab-icon",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:b.jsx("path",{d:"M2 8H4.5L6 4L8 12L10 6L11.5 8H14"})}),"Sessions"]}),b.jsxs("button",{className:`tab-btn ${r?"tab-btn-active":""}`,onClick:()=>l("/tasks"),children:[b.jsxs("svg",{className:"tab-icon",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[b.jsx("rect",{x:"2",y:"2",width:"12",height:"12",rx:"2"}),b.jsx("path",{d:"M5.5 8L7 9.5L10.5 6"})]}),"Tasks"]})]})}function Mx(e){const[n,r]=N.useState(()=>window.matchMedia(e).matches);return N.useEffect(()=>{const s=window.matchMedia(e),l=u=>r(u.matches);return s.addEventListener("change",l),r(s.matches),()=>s.removeEventListener("change",l)},[e]),n}const pu=Gn.isNativePlatform(),Ok=["Device","Data","Messaging"],Oh=[{capability:"sms-read",label:"Read SMS",group:"Messaging",permission:"smsRead"},{capability:"sms-send",label:"Send SMS",group:"Messaging",permission:"smsSend"},{capability:"send-email",label:"Send Email",group:"Messaging",permission:"postNotifications"},{capability:"notifications",label:"Notifications from Other Apps",group:"Data",permission:"notificationListener"},{capability:"contacts",label:"Manage Contacts",group:"Data",permission:"contacts"},{capability:"calendar",label:"Manage Calendar",group:"Data",permission:"calendar"},{capability:"location",label:"Get Location",group:"Device",permission:"location",enableMethod:"device.location.enable",disableMethod:"device.location.disable",enableParams:e=>({fcmToken:e}),disableParams:()=>({})},{capability:"battery",label:"Read Battery Status",group:"Device"},{capability:"dnd",label:"Set Ringer Mode",group:"Device",permission:"dnd"},{capability:"alarm",label:"Trigger Alarms",group:"Device",needsFullScreenIntent:!0}];function Dx({capabilityTokens:e,activeClientToken:n,request:r,onCapabilityTokensChange:s}){const[l,u]=N.useState(null),[c,f]=N.useState(null),[m,d]=N.useState(null),[y,g]=N.useState(null);N.useEffect(()=>{if(!pu||!Ut){g(new Set);return}Ut.getSupportedPermissions().then(({types:T})=>g(new Set(T))).catch(()=>g(new Set))},[]);function x(T){return!!(n&&(e==null?void 0:e[T])===n)}function w(T){return y?y.size===0?!0:!(T.permission&&!y.has(T.permission)||T.needsFullScreenIntent&&!y.has("fullScreenIntent")):!1}function S(T,te){const B={};for(const[z,K]of Object.entries(e??{}))B[z]=K??null;B[T]=te?n??null:null,s(B)}N.useEffect(()=>{if(!pu||!Ut||!x("location"))return;function te(){Ut.checkPermission({type:"location"}).then(({granted:z})=>{z||r("device.location.disable").then(()=>{S("location",!1)}).catch(()=>{})})}te();const B=Cx.addListener("resume",te);return()=>{B.then(z=>z.remove())}},[e,n]),N.useEffect(()=>{if(!pu||!Ut)return;const T=Oh.map(te=>te.capability).filter(te=>(e==null?void 0:e[te])===n);Ut.setEnabledCapabilities({capabilities:T}).catch(()=>{})},[e,n]);async function D(T,te=!1){var K,Q;const B=x(T.capability);if(B&&!te){d(T);return}if(!B&&!!(e!=null&&e[T.capability])&&e[T.capability]!==n&&!te){f(T);return}u(T.capability);try{if(B){const ae=T.disableMethod??"device.capability.disable",re=((K=T.disableParams)==null?void 0:K.call(T))??{capability:T.capability};await r(ae,re),S(T.capability,!1);return}if(Ut&&T.capability==="send-email")try{const ae=await Ut.hasEmailClient();if(ae.supported&&!ae.available){alert("No email app is installed on this device. Install one (e.g. Gmail) before enabling Sending Email.");return}}catch{}if(Ut&&T.permission){const ae=await Ut.checkPermission({type:T.permission});if(!ae.supported){console.warn(`Native build does not support permission '${T.permission}'`);return}if(!ae.granted&&!(await Ut.requestPermission({type:T.permission})).granted)return}if(Ut&&T.needsFullScreenIntent){const ae=await Ut.checkPermission({type:"fullScreenIntent"});if(!ae.supported){console.warn("Native build does not support fullScreenIntent");return}if(!ae.granted&&!(await Ut.requestPermission({type:"fullScreenIntent"})).granted)return}if(!Ut)return;const{token:H}=await Ut.getFcmToken();if(!H){console.warn("No FCM token available");return}const R=Oh.map(ae=>ae.capability).filter(ae=>ae===T.capability||(e==null?void 0:e[ae])===n);await Ut.setEnabledCapabilities({capabilities:R});const X=T.enableMethod??"device.capability.enable",J=((Q=T.enableParams)==null?void 0:Q.call(T,H))??{capability:T.capability,fcmToken:H};await r(X,J),S(T.capability,!0)}catch(H){console.error(`Failed to toggle ${T.capability}:`,H)}finally{u(null)}}const q=Ok.map(T=>({group:T,items:Oh.filter(te=>te.group===T&&w(te))})).filter(T=>T.items.length>0);if(!pu||q.length===0)return null;const L=c&&fa.createPortal(b.jsx("div",{className:"confirm-modal-overlay",onClick:()=>f(null),children:b.jsxs("div",{className:"confirm-modal",onClick:T=>T.stopPropagation(),children:[b.jsxs("h2",{className:"confirm-modal-title",children:["Switch ",c.label," to this device?"]}),b.jsxs("p",{className:"confirm-modal-message",children:[c.label," is currently enabled on another device. Switching will make this device the one the host uses for ",c.label,", and it will be disabled on the other device."]}),b.jsxs("div",{className:"confirm-modal-actions",children:[b.jsx("button",{className:"btn btn-secondary",onClick:()=>f(null),children:"Cancel"}),b.jsx("button",{className:"btn btn-primary",onClick:()=>{const T=c;f(null),D(T,!0)},children:"Switch"})]})]})}),document.body),$=m&&fa.createPortal(b.jsx("div",{className:"confirm-modal-overlay",onClick:()=>d(null),children:b.jsxs("div",{className:"confirm-modal",onClick:T=>T.stopPropagation(),children:[b.jsxs("h2",{className:"confirm-modal-title",children:["Disable ",m.label,"?"]}),b.jsxs("p",{className:"confirm-modal-message",children:["Agents running on the host will no longer be able to use ",m.label," until it is re-enabled on a device."]}),b.jsxs("div",{className:"confirm-modal-actions",children:[b.jsx("button",{className:"btn btn-secondary",onClick:()=>d(null),children:"Cancel"}),b.jsx("button",{className:"btn btn-danger",onClick:()=>{const T=m;d(null),D(T,!0)},children:"Disable"})]})]})}),document.body);return b.jsxs(b.Fragment,{children:[q.map(({group:T,items:te},B)=>b.jsx("div",{className:B>0?"drawer-toggle-group drawer-toggle-group-divided":"drawer-toggle-group",children:te.map(z=>{const K=x(z.capability);return b.jsxs("label",{className:"drawer-toggle",children:[b.jsx("span",{className:"drawer-toggle-label",children:z.label}),b.jsx("button",{className:`toggle-switch ${K?"toggle-switch-on":""}`,onClick:()=>D(z),disabled:l===z.capability,role:"switch","aria-checked":K,children:b.jsx("span",{className:"toggle-switch-thumb"})})]},z.capability)})},T)),L,$]})}const q0=!!window.__PALMIER_SERVE__&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"),Rk=Gn.isNativePlatform();function H0({daemonVersion:e,capabilityTokens:n,activeClientToken:r,request:s,onCapabilityTokensChange:l}){var P;const{pairedHosts:u,activeHostId:c,setActiveHostId:f,removePairedHost:m,renamePairedHost:d}=xa(),y=ti(),g=Mx("(min-width: 768px)"),[x,w]=N.useState(!1),[S,D]=N.useState(!1),[q,L]=N.useState(null),[$,T]=N.useState(""),[te,B]=N.useState(null),z=N.useRef(null),K=N.useRef(null),Q=N.useCallback(()=>{D(!0)},[]);function H(){S&&(w(!1),D(!1))}function R(){D(!1),w(!0)}function X(V,ue){L(V),T(ue)}function J(){q&&$.trim()&&d(q,$.trim()),L(null),T("")}function ae(){L(null),T("")}N.useEffect(()=>{q&&K.current&&(K.current.focus(),K.current.select())},[q]),N.useEffect(()=>{if(!x||S)return;function V(ue){ue.key==="Escape"&&Q()}return document.addEventListener("keydown",V),()=>{document.removeEventListener("keydown",V)}},[x,S,Q]);const re=b.jsxs(b.Fragment,{children:[!g&&b.jsx("button",{className:"drawer-close-btn",onClick:Q,"aria-label":"Close menu",children:b.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:b.jsx("path",{d:"M4 4L12 12M12 4L4 12",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})}),!q0&&u.length>0&&b.jsxs("div",{className:"drawer-section",children:[b.jsx("h3",{className:"drawer-section-label",children:"Hosts"}),b.jsx("div",{className:"host-picker-inline",children:b.jsx("div",{className:"host-picker-list",role:"listbox",children:u.map(V=>{const ue=V.hostId===c,xe=q===V.hostId,_=V.name||V.hostId.slice(0,8);return b.jsx("div",{className:"host-picker-item-wrapper",children:b.jsxs("div",{className:`host-picker-item ${ue?"host-picker-item-active":""}`,onClick:()=>{if(!xe&&!ue){if(!hs())return;f(V.hostId),g||Q()}},role:"option","aria-selected":ue,children:[xe?b.jsx("input",{ref:K,className:"form-input host-picker-rename-input",type:"text",value:$,onChange:M=>T(M.target.value),onKeyDown:M=>{M.key==="Enter"&&J(),M.key==="Escape"&&ae()},onBlur:J,onClick:M=>M.stopPropagation()}):b.jsx("span",{className:"host-picker-item-name",children:_}),b.jsxs("div",{className:"host-picker-item-actions",children:[ue&&!xe&&b.jsx("button",{className:"host-picker-edit-btn",onClick:M=>{M.stopPropagation(),X(V.hostId,_)},"aria-label":"Rename host",children:b.jsx("svg",{width:"13",height:"13",viewBox:"0 0 13 13",fill:"none",children:b.jsx("path",{d:"M9.5 1.5L11.5 3.5M1.5 11.5L2 9L9 2L11 4L4 11L1.5 11.5Z",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})})}),!ue&&b.jsx("button",{className:"host-picker-delete-btn",onClick:M=>{M.stopPropagation(),B(V.hostId)},"aria-label":`Unpair ${_}`,children:b.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:b.jsx("path",{d:"M4 5.5V11C4 11.2761 4.22386 11.5 4.5 11.5H9.5C9.77614 11.5 10 11.2761 10 11V5.5M3 4H11M5.5 4V3C5.5 2.72386 5.72386 2.5 6 2.5H8C8.27614 2.5 8.5 2.72386 8.5 3V4M6.5 6.5V9.5M7.5 6.5V9.5",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})})})]})]})},V.hostId)})})})]}),!q0&&b.jsxs(b.Fragment,{children:[b.jsx("div",{className:"drawer-divider"}),b.jsx("div",{className:"drawer-section",children:b.jsx("button",{className:"btn btn-primary btn-full",onClick:()=>{hs()&&(y("/pair"),g||Q())},children:"Pair New Host"})})]}),Rk&&s&&b.jsxs(b.Fragment,{children:[b.jsx("div",{className:"drawer-divider"}),b.jsxs("div",{className:"drawer-section",children:[b.jsx("h3",{className:"drawer-section-label",children:"Host capabilities on this device"}),b.jsx(Dx,{capabilityTokens:n,activeClientToken:r,request:s,onCapabilityTokensChange:V=>l==null?void 0:l(V)})]})]}),b.jsxs("div",{className:"drawer-footer",children:[e&&b.jsxs("div",{className:"drawer-version",children:["Palmier v",e]}),b.jsxs("div",{className:"drawer-legal",children:[b.jsx("a",{href:"https://www.palmier.me/terms",target:"_blank",rel:"noopener noreferrer",children:"Terms"}),b.jsx("span",{className:"drawer-legal-sep",children:"·"}),b.jsx("a",{href:"https://www.palmier.me/privacy",target:"_blank",rel:"noopener noreferrer",children:"Privacy"})]})]})]}),F=te&&fa.createPortal(b.jsx("div",{className:"confirm-modal-overlay",onClick:()=>B(null),children:b.jsxs("div",{className:"confirm-modal",onClick:V=>V.stopPropagation(),children:[b.jsx("h2",{className:"confirm-modal-title",children:"Delete host?"}),b.jsxs("p",{className:"confirm-modal-message",children:['"',((P=u.find(V=>V.hostId===te))==null?void 0:P.name)||te.slice(0,8),'" will be unpaired from this device.']}),b.jsxs("div",{className:"confirm-modal-actions",children:[b.jsx("button",{className:"btn btn-secondary",onClick:()=>B(null),children:"Cancel"}),b.jsx("button",{className:"btn btn-danger",onClick:()=>{m(te),B(null)},children:"Delete"})]})]})}),document.body);return g?b.jsxs(b.Fragment,{children:[b.jsx("div",{className:"drawer-panel drawer-panel-desktop",ref:z,children:re}),F]}):b.jsxs(b.Fragment,{children:[b.jsx("button",{className:"hamburger-btn",onClick:R,"aria-label":"Open menu",children:b.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:b.jsx("path",{d:"M3 5H17M3 10H17M3 15H17",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})}),x&&fa.createPortal(b.jsx("div",{className:`drawer-overlay ${S?"drawer-overlay-closing":""}`,onClick:Q,onAnimationEnd:H,children:b.jsx("div",{className:`drawer-panel ${S?"drawer-panel-closing":""}`,ref:z,onClick:V=>V.stopPropagation(),children:re})}),document.body),F]})}const Mk=Gn.isNativePlatform();function Dk(){const{mode:e}=wa(),[n,r]=N.useState(!1),s=N.useRef(null);if(N.useEffect(()=>{if(!n)return;function f(m){var d;(d=s.current)!=null&&d.contains(m.target)||r(!1)}return document.addEventListener("pointerdown",f),()=>document.removeEventListener("pointerdown",f)},[n]),e==="direct")return null;let l,u,c;switch(e){case"lan":l="📶",u="Connected via LAN",c="lan";break;case"nats":l="🌐",u=Mk?"Connected via relay":"Connected",c="relay";break;case"disconnected":l="⚠️",u="Disconnected",c="disconnected";break;case"connecting":default:l="🌐",u="Connecting…",c="connecting";break}return b.jsxs("div",{ref:s,className:`conn-status conn-status--${c}`,children:[b.jsx("button",{type:"button",className:"conn-status-btn","aria-label":u,onClick:()=>r(f=>!f),children:b.jsx("span",{"aria-hidden":"true",children:l})}),b.jsx("div",{className:`conn-status-popover ${n?"conn-status-popover--open":""}`,role:"tooltip",children:u})]})}function I0(e){var s;const n=localStorage.getItem("palmier:lastAgent"),r=e.map(l=>l.key);return n&&r.includes(n)?n:((s=e[0])==null?void 0:s.key)??""}function Lk({agents:e,hostPlatform:n,onStarted:r}){const{request:s}=wa(),[l,u]=N.useState(""),[c,f]=N.useState(()=>I0(e)),[m,d]=N.useState(!1),[y,g]=N.useState(!1),[x,w]=N.useState(null);N.useEffect(()=>{e.length&&(e.find(te=>te.key===c)||f(I0(e)))},[e,c]),N.useEffect(()=>{const te=l.trim().length>0;return Nh(te?"Your session draft will be lost. Continue?":null),()=>Nh(null)},[l]);const S=e.find(te=>te.key===c),D=!!(S!=null&&S.supportsYolo);N.useEffect(()=>{!D&&m&&d(!1)},[D,m]);const q=!!l.trim()&&!!c&&!y;function L(){return m?confirm(`Yolo mode is enabled. The agent will auto-approve all tool calls — it can read, write, delete files, run arbitrary commands, and access the network without asking for permission.
91
+
92
+ Are you sure you want to continue?`):!0}async function $(){if(!(!q||!L())){g(!0),w(null);try{const te=await s("task.run_oneoff",{user_prompt:l,agent:c,yolo_mode:m,...n==="win32"?{foreground_mode:!0}:{}});if(te.error){w(te.error);return}localStorage.setItem("palmier:lastAgent",c),u(""),Nh(null),te.task_id&&r(te.task_id,te.run_id)}catch(te){w(te instanceof Error?te.message:String(te))}finally{g(!1)}}}function T(te){te.key==="Enter"&&(te.metaKey||te.ctrlKey)&&(te.preventDefault(),$())}return b.jsxs("div",{className:"session-composer",children:[x&&b.jsx("div",{className:"form-error",children:x}),b.jsx("textarea",{className:"session-composer-textarea",value:l,onChange:te=>u(te.target.value),onKeyDown:T,placeholder:"What can I do for you?",rows:3,disabled:y}),b.jsxs("div",{className:"session-composer-controls",children:[b.jsxs("div",{className:"agent-picker-section-inline",children:[b.jsx("span",{className:"agent-picker-label",children:"Run with"}),b.jsx("select",{className:"form-select form-select-sm",value:c,onChange:te=>f(te.target.value),disabled:y||!e.length,children:e.map(te=>b.jsx("option",{value:te.key,children:te.label},te.key))})]}),D&&b.jsxs("label",{className:"session-composer-yolo",children:[b.jsx("input",{type:"checkbox",checked:m,onChange:te=>d(te.target.checked),disabled:y}),"Yolo"]}),b.jsx("button",{className:"btn btn-primary chat-send-btn",onClick:$,disabled:!q,"aria-label":"Run session",title:"Run session",children:y?b.jsx("span",{className:"btn-spinner"}):b.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[b.jsx("line",{x1:"22",y1:"2",x2:"11",y2:"13"}),b.jsx("polygon",{points:"22 2 15 22 11 13 2 9 22 2"})]})})]}),D&&m&&b.jsx("p",{className:"command-help-text",children:"The agent will auto-approve all tool calls without asking for permission."})]})}const us=88,F0=6;function zk({id:e,revealedId:n,setRevealedId:r,onDelete:s,onClick:l,children:u,actionLabel:c="Delete"}){const f=n===e,[m,d]=N.useState(0),[y,g]=N.useState(!1),x=N.useRef(0),w=N.useRef(0),S=N.useRef(null),D=N.useRef(0),q=N.useRef(!1),L=N.useRef(null);N.useEffect(()=>{f||d(0)},[f]),N.useEffect(()=>{if(!f)return;function K(Q){var H;(H=L.current)!=null&&H.contains(Q.target)||r(null)}return document.addEventListener("pointerdown",K),()=>document.removeEventListener("pointerdown",K)},[f,r]);function $(K){K.button!==void 0&&K.button!==0||(x.current=K.clientX,w.current=K.clientY,S.current=null,D.current=f?-us:0,q.current=!1)}function T(K){if(K.pointerType==="mouse"&&K.buttons===0)return;const Q=K.clientX-x.current,H=K.clientY-w.current;if(S.current===null){if(Math.abs(Q)<F0&&Math.abs(H)<F0)return;if(S.current=Math.abs(Q)>Math.abs(H)?"x":"y",S.current==="x")try{K.currentTarget.setPointerCapture(K.pointerId)}catch{}}if(S.current!=="x")return;q.current=!0,y||g(!0);let R=D.current+Q;R>0&&(R=R/4),R<-us&&(R=-us+(R+us)/4),d(R)}function te(){if(S.current!=="x"){g(!1);return}S.current=null,g(!1),m<=-44?(d(-us),r(e)):(d(0),f&&r(null))}function B(K){if(q.current){q.current=!1,K.stopPropagation(),K.preventDefault();return}f&&(K.stopPropagation(),K.preventDefault(),r(null))}const z=m!==0?m:f?-us:0;return b.jsxs("div",{ref:L,className:"swipe-row",children:[b.jsx("button",{type:"button",className:"swipe-row-action",style:{width:us},onClick:K=>{K.stopPropagation(),s()},tabIndex:f?0:-1,"aria-hidden":!f,children:c}),b.jsx("div",{className:`swipe-row-content ${y?"swipe-row-content-dragging":""}`,style:{transform:`translateX(${z}px)`},onPointerDown:$,onPointerMove:T,onPointerUp:te,onPointerCancel:te,onClickCapture:B,onClick:l,children:u})]})}const Uk=10;function Bk({connected:e,hostId:n,request:r,subscribeEvents:s,agents:l,hostPlatform:u,filterTaskId:c,onClearFilter:f}){const[m,d]=N.useState([]),[y,g]=N.useState(0),[x,w]=N.useState(!1),[S,D]=N.useState(!1),[q,L]=N.useState(null),$=ti();async function T(F){const P=`${F.task_id}:${F.run_id}`;d(V=>V.filter(ue=>`${ue.task_id}:${ue.run_id}`!==P)),g(V=>Math.max(0,V-1)),L(null);try{await r("taskrun.delete",{task_id:F.task_id,run_id:F.run_id})}catch(V){console.error("Failed to delete run:",V),d(ue=>[F,...ue]),g(ue=>ue+1)}}const te=N.useRef(null),B=N.useCallback(F=>{const P={offset:F,limit:Uk};return c&&(P.task_id=c),P},[c]),z=N.useCallback(async(F,P)=>{if(e){P?D(!0):w(!0);try{const V=await r("taskrun.list",B(F)),ue=V.entries??[];g(V.total??0),d(P?xe=>{const _=new Set(xe.map(W=>`${W.task_id}:${W.run_id}`)),M=ue.filter(W=>!_.has(`${W.task_id}:${W.run_id}`));return[...xe,...M]}:ue)}catch(V){V instanceof Error&&V.message==="Not connected"||console.error("Failed to load runs:",V)}finally{w(!1),D(!1)}}},[e,r,B]);N.useEffect(()=>{e?(d([]),g(0),z(0,!1)):(d([]),g(0))},[e,n,z,c]);const K=Rx({onRefresh:()=>z(0,!1),enabled:e});N.useEffect(()=>!e||!n?void 0:s(n,async P=>{try{const V=JSON.parse(new TextDecoder().decode(P.data));if(V.event_type==="running-state"&&V.running_state&&["monitoring","started","finished","failed","aborted"].includes(V.running_state)){const ue=await r("taskrun.list",B(0)),xe=ue.entries??[];g(ue.total??0),d(_=>{const M=new Map(xe.map(Ce=>[`${Ce.task_id}:${Ce.run_id}`,Ce])),W=_.map(Ce=>{const je=`${Ce.task_id}:${Ce.run_id}`;return M.get(je)??Ce}),A=new Set(W.map(Ce=>`${Ce.task_id}:${Ce.run_id}`));return[...xe.filter(Ce=>!A.has(`${Ce.task_id}:${Ce.run_id}`)),...W]})}}catch{}}),[e,n,s,r]),N.useEffect(()=>{const F=te.current;if(!F)return;const P=new IntersectionObserver(V=>{V[0].isIntersecting&&!S&&m.length<y&&z(m.length,!0)},{threshold:.1});return P.observe(F),()=>P.disconnect()},[m.length,y,S,z]);function Q(F,P){if(!F||!P)return"";const V=Math.round((P-F)/1e3);if(V<60)return`${V}s`;const ue=Math.floor(V/60),xe=V%60;return`${ue}m ${xe}s`}const H={monitoring:"Monitoring",started:"Running",finished:"Finished",failed:"Failed",aborted:"Aborted"};function R(F,P){hs()&&$(`/runs/${F}/${encodeURIComponent(P)}`)}const X=!c&&b.jsx(Lk,{agents:l,hostPlatform:u,onStarted:(F,P)=>{$(P?`/runs/${encodeURIComponent(F)}/${encodeURIComponent(P)}`:`/runs/${encodeURIComponent(F)}`)}}),J=b.jsx(Ox,{pullDistance:K.pullDistance,refreshing:K.refreshing,threshold:K.threshold}),ae=c&&f&&b.jsx("div",{style:{marginBottom:"var(--space-sm)"},children:b.jsxs("span",{className:"sessions-filter-chip",children:["Filtered by task",b.jsx("button",{onClick:f,"aria-label":"Clear filter",children:"×"})]})});function re(F){if(F==="failed")return"var(--color-error)";if(F==="aborted")return"var(--color-warning, #d97706)"}return x&&m.length===0&&e?b.jsxs(b.Fragment,{children:[J,X,b.jsx("div",{className:"task-list",children:[0,1,2].map(F=>b.jsxs("div",{className:"task-card",style:{pointerEvents:"none"},children:[b.jsx("div",{className:"task-card-header",children:b.jsx("div",{className:"task-card-title-row",children:b.jsx("div",{className:"skeleton-line",style:{width:`${70+F*10}%`}})})}),b.jsx("div",{className:"task-card-meta",children:b.jsx("div",{className:"skeleton-line",style:{width:"45%"}})})]},F))})]}):!e||x&&m.length===0?b.jsxs(b.Fragment,{children:[J,X,b.jsx("div",{className:"sessions-view",children:b.jsxs("div",{className:"empty-state",children:[b.jsx("p",{className:"empty-state-text",children:"Sessions"}),b.jsx("p",{className:"empty-state-hint",children:"Your sessions will appear here"})]})})]}):m.length===0?b.jsxs(b.Fragment,{children:[J,X,ae,b.jsx("div",{className:"sessions-view",children:b.jsxs("div",{className:"empty-state",children:[b.jsx("p",{className:"empty-state-text",children:"No sessions yet"}),b.jsx("p",{className:"empty-state-hint",children:c?"This task hasn't been executed yet. Run it from the task menu or wait for its next trigger.":"Your sessions will appear here."})]})})]}):b.jsxs(b.Fragment,{children:[J,X,ae,b.jsxs("div",{className:"task-list",children:[m.map((F,P)=>{const V=`${F.task_id}:${F.run_id}`;return b.jsx(zk,{id:V,revealedId:q,setRevealedId:L,onDelete:()=>T(F),onClick:()=>!F.error&&R(F.task_id,F.run_id),children:b.jsxs("div",{className:"sessions-card",children:[b.jsxs("div",{className:"sessions-card-body",children:[b.jsx("h3",{className:"sessions-card-name",children:F.task_name||F.task_id}),b.jsxs("div",{className:"sessions-card-meta",children:[F.running_state==="started"?b.jsx("span",{className:"status-spinner","aria-label":"Running",children:b.jsx("span",{})}):b.jsx("span",{style:{color:re(F.running_state)},children:H[F.running_state??""]??F.running_state}),F.end_time&&b.jsx("span",{children:Uu(F.end_time)}),F.start_time&&F.end_time&&b.jsx("span",{style:{color:"var(--color-muted)"},children:Q(F.start_time,F.end_time)}),F.error&&b.jsx("span",{style:{color:"var(--color-muted)"},children:F.error})]})]}),b.jsx("span",{className:"sessions-card-chevron",children:"›"})]})},`${V}-${P}`)}),b.jsx("div",{ref:te,style:{height:1}}),S&&b.jsx("div",{className:"loading-state",style:{padding:"var(--space-md)"},children:b.jsx("div",{className:"spinner"})})]})]})}function Pk(e,n){const r={};return(e[e.length-1]===""?[...e,""]:e).join((r.padRight?" ":"")+","+(r.padLeft===!1?"":" ")).trim()}const qk=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Hk=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Ik={};function $0(e,n){return(Ik.jsx?Hk:qk).test(e)}const Fk=/[ \t\n\f\r]/g;function $k(e){return typeof e=="object"?e.type==="text"?Y0(e.value):!1:Y0(e)}function Y0(e){return e.replace(Fk,"")===""}class Gl{constructor(n,r,s){this.normal=r,this.property=n,s&&(this.space=s)}}Gl.prototype.normal={};Gl.prototype.property={};Gl.prototype.space=void 0;function Lx(e,n){const r={},s={};for(const l of e)Object.assign(r,l.property),Object.assign(s,l.normal);return new Gl(r,s,n)}function dd(e){return e.toLowerCase()}class An{constructor(n,r){this.attribute=r,this.property=n}}An.prototype.attribute="";An.prototype.booleanish=!1;An.prototype.boolean=!1;An.prototype.commaOrSpaceSeparated=!1;An.prototype.commaSeparated=!1;An.prototype.defined=!1;An.prototype.mustUseProperty=!1;An.prototype.number=!1;An.prototype.overloadedBoolean=!1;An.prototype.property="";An.prototype.spaceSeparated=!1;An.prototype.space=void 0;let Yk=0;const Ve=ps(),Qt=ps(),md=ps(),be=ps(),jt=ps(),ca=ps(),Pn=ps();function ps(){return 2**++Yk}const pd=Object.freeze(Object.defineProperty({__proto__:null,boolean:Ve,booleanish:Qt,commaOrSpaceSeparated:Pn,commaSeparated:ca,number:be,overloadedBoolean:md,spaceSeparated:jt},Symbol.toStringTag,{value:"Module"})),Rh=Object.keys(pd);class Hd extends An{constructor(n,r,s,l){let u=-1;if(super(n,r),G0(this,"space",l),typeof s=="number")for(;++u<Rh.length;){const c=Rh[u];G0(this,Rh[u],(s&pd[c])===pd[c])}}}Hd.prototype.defined=!0;function G0(e,n,r){r&&(e[n]=r)}function Sa(e){const n={},r={};for(const[s,l]of Object.entries(e.properties)){const u=new Hd(s,e.transform(e.attributes||{},s),l,e.space);e.mustUseProperty&&e.mustUseProperty.includes(s)&&(u.mustUseProperty=!0),n[s]=u,r[dd(s)]=s,r[dd(u.attribute)]=s}return new Gl(n,r,e.space)}const zx=Sa({properties:{ariaActiveDescendant:null,ariaAtomic:Qt,ariaAutoComplete:null,ariaBusy:Qt,ariaChecked:Qt,ariaColCount:be,ariaColIndex:be,ariaColSpan:be,ariaControls:jt,ariaCurrent:null,ariaDescribedBy:jt,ariaDetails:null,ariaDisabled:Qt,ariaDropEffect:jt,ariaErrorMessage:null,ariaExpanded:Qt,ariaFlowTo:jt,ariaGrabbed:Qt,ariaHasPopup:null,ariaHidden:Qt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:jt,ariaLevel:be,ariaLive:null,ariaModal:Qt,ariaMultiLine:Qt,ariaMultiSelectable:Qt,ariaOrientation:null,ariaOwns:jt,ariaPlaceholder:null,ariaPosInSet:be,ariaPressed:Qt,ariaReadOnly:Qt,ariaRelevant:null,ariaRequired:Qt,ariaRoleDescription:jt,ariaRowCount:be,ariaRowIndex:be,ariaRowSpan:be,ariaSelected:Qt,ariaSetSize:be,ariaSort:null,ariaValueMax:be,ariaValueMin:be,ariaValueNow:be,ariaValueText:null,role:null},transform(e,n){return n==="role"?n:"aria-"+n.slice(4).toLowerCase()}});function Ux(e,n){return n in e?e[n]:n}function Bx(e,n){return Ux(e,n.toLowerCase())}const Gk=Sa({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:ca,acceptCharset:jt,accessKey:jt,action:null,allow:null,allowFullScreen:Ve,allowPaymentRequest:Ve,allowUserMedia:Ve,alt:null,as:null,async:Ve,autoCapitalize:null,autoComplete:jt,autoFocus:Ve,autoPlay:Ve,blocking:jt,capture:null,charSet:null,checked:Ve,cite:null,className:jt,cols:be,colSpan:null,content:null,contentEditable:Qt,controls:Ve,controlsList:jt,coords:be|ca,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Ve,defer:Ve,dir:null,dirName:null,disabled:Ve,download:md,draggable:Qt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Ve,formTarget:null,headers:jt,height:be,hidden:md,high:be,href:null,hrefLang:null,htmlFor:jt,httpEquiv:jt,id:null,imageSizes:null,imageSrcSet:null,inert:Ve,inputMode:null,integrity:null,is:null,isMap:Ve,itemId:null,itemProp:jt,itemRef:jt,itemScope:Ve,itemType:jt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Ve,low:be,manifest:null,max:null,maxLength:be,media:null,method:null,min:null,minLength:be,multiple:Ve,muted:Ve,name:null,nonce:null,noModule:Ve,noValidate:Ve,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:Ve,optimum:be,pattern:null,ping:jt,placeholder:null,playsInline:Ve,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Ve,referrerPolicy:null,rel:jt,required:Ve,reversed:Ve,rows:be,rowSpan:be,sandbox:jt,scope:null,scoped:Ve,seamless:Ve,selected:Ve,shadowRootClonable:Ve,shadowRootDelegatesFocus:Ve,shadowRootMode:null,shape:null,size:be,sizes:null,slot:null,span:be,spellCheck:Qt,src:null,srcDoc:null,srcLang:null,srcSet:null,start:be,step:null,style:null,tabIndex:be,target:null,title:null,translate:null,type:null,typeMustMatch:Ve,useMap:null,value:Qt,width:be,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:jt,axis:null,background:null,bgColor:null,border:be,borderColor:null,bottomMargin:be,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Ve,declare:Ve,event:null,face:null,frame:null,frameBorder:null,hSpace:be,leftMargin:be,link:null,longDesc:null,lowSrc:null,marginHeight:be,marginWidth:be,noResize:Ve,noHref:Ve,noShade:Ve,noWrap:Ve,object:null,profile:null,prompt:null,rev:null,rightMargin:be,rules:null,scheme:null,scrolling:Qt,standby:null,summary:null,text:null,topMargin:be,valueType:null,version:null,vAlign:null,vLink:null,vSpace:be,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Ve,disableRemotePlayback:Ve,prefix:null,property:null,results:be,security:null,unselectable:null},space:"html",transform:Bx}),Vk=Sa({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",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",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",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",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",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",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:Pn,accentHeight:be,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:be,amplitude:be,arabicForm:null,ascent:be,attributeName:null,attributeType:null,azimuth:be,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:be,by:null,calcMode:null,capHeight:be,className:jt,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:be,diffuseConstant:be,direction:null,display:null,dur:null,divisor:be,dominantBaseline:null,download:Ve,dx:null,dy:null,edgeMode:null,editable:null,elevation:be,enableBackground:null,end:null,event:null,exponent:be,externalResourcesRequired:null,fill:null,fillOpacity:be,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:ca,g2:ca,glyphName:ca,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:be,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:be,horizOriginX:be,horizOriginY:be,id:null,ideographic:be,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:be,k:be,k1:be,k2:be,k3:be,k4:be,kernelMatrix:Pn,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:be,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:be,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:be,overlineThickness:be,paintOrder:null,panose1:null,path:null,pathLength:be,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:jt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:be,pointsAtY:be,pointsAtZ:be,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Pn,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Pn,rev:Pn,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Pn,requiredFeatures:Pn,requiredFonts:Pn,requiredFormats:Pn,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:be,specularExponent:be,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:be,strikethroughThickness:be,string:null,stroke:null,strokeDashArray:Pn,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:be,strokeOpacity:be,strokeWidth:null,style:null,surfaceScale:be,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Pn,tabIndex:be,tableValues:null,target:null,targetX:be,targetY:be,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Pn,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:be,underlineThickness:be,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:be,values:null,vAlphabetic:be,vMathematical:be,vectorEffect:null,vHanging:be,vIdeographic:be,version:null,vertAdvY:be,vertOriginX:be,vertOriginY:be,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:be,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Ux}),Px=Sa({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,n){return"xlink:"+n.slice(5).toLowerCase()}}),qx=Sa({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Bx}),Hx=Sa({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,n){return"xml:"+n.slice(3).toLowerCase()}}),Jk={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},Xk=/[A-Z]/g,V0=/-[a-z]/g,Kk=/^data[-\w.:]+$/i;function Qk(e,n){const r=dd(n);let s=n,l=An;if(r in e.normal)return e.property[e.normal[r]];if(r.length>4&&r.slice(0,4)==="data"&&Kk.test(n)){if(n.charAt(4)==="-"){const u=n.slice(5).replace(V0,Wk);s="data"+u.charAt(0).toUpperCase()+u.slice(1)}else{const u=n.slice(4);if(!V0.test(u)){let c=u.replace(Xk,Zk);c.charAt(0)!=="-"&&(c="-"+c),n="data"+c}}l=Hd}return new l(s,n)}function Zk(e){return"-"+e.toLowerCase()}function Wk(e){return e.charAt(1).toUpperCase()}const eC=Lx([zx,Gk,Px,qx,Hx],"html"),Id=Lx([zx,Vk,Px,qx,Hx],"svg");function tC(e){return e.join(" ").trim()}var Zs={},Mh,J0;function nC(){if(J0)return Mh;J0=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,n=/\n/g,r=/^\s*/,s=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,l=/^:\s*/,u=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,f=/^\s+|\s+$/g,m=`
93
+ `,d="/",y="*",g="",x="comment",w="declaration";function S(q,L){if(typeof q!="string")throw new TypeError("First argument must be a string");if(!q)return[];L=L||{};var $=1,T=1;function te(re){var F=re.match(n);F&&($+=F.length);var P=re.lastIndexOf(m);T=~P?re.length-P:T+re.length}function B(){var re={line:$,column:T};return function(F){return F.position=new z(re),H(),F}}function z(re){this.start=re,this.end={line:$,column:T},this.source=L.source}z.prototype.content=q;function K(re){var F=new Error(L.source+":"+$+":"+T+": "+re);if(F.reason=re,F.filename=L.source,F.line=$,F.column=T,F.source=q,!L.silent)throw F}function Q(re){var F=re.exec(q);if(F){var P=F[0];return te(P),q=q.slice(P.length),F}}function H(){Q(r)}function R(re){var F;for(re=re||[];F=X();)F!==!1&&re.push(F);return re}function X(){var re=B();if(!(d!=q.charAt(0)||y!=q.charAt(1))){for(var F=2;g!=q.charAt(F)&&(y!=q.charAt(F)||d!=q.charAt(F+1));)++F;if(F+=2,g===q.charAt(F-1))return K("End of comment missing");var P=q.slice(2,F-2);return T+=2,te(P),q=q.slice(F),T+=2,re({type:x,comment:P})}}function J(){var re=B(),F=Q(s);if(F){if(X(),!Q(l))return K("property missing ':'");var P=Q(u),V=re({type:w,property:D(F[0].replace(e,g)),value:P?D(P[0].replace(e,g)):g});return Q(c),V}}function ae(){var re=[];R(re);for(var F;F=J();)F!==!1&&(re.push(F),R(re));return re}return H(),ae()}function D(q){return q?q.replace(f,g):g}return Mh=S,Mh}var X0;function rC(){if(X0)return Zs;X0=1;var e=Zs&&Zs.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(Zs,"__esModule",{value:!0}),Zs.default=r;const n=e(nC());function r(s,l){let u=null;if(!s||typeof s!="string")return u;const c=(0,n.default)(s),f=typeof l=="function";return c.forEach(m=>{if(m.type!=="declaration")return;const{property:d,value:y}=m;f?l(d,y,m):y&&(u=u||{},u[d]=y)}),u}return Zs}var xl={},K0;function iC(){if(K0)return xl;K0=1,Object.defineProperty(xl,"__esModule",{value:!0}),xl.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,n=/-([a-z])/g,r=/^[^-]+$/,s=/^-(webkit|moz|ms|o|khtml)-/,l=/^-(ms)-/,u=function(d){return!d||r.test(d)||e.test(d)},c=function(d,y){return y.toUpperCase()},f=function(d,y){return"".concat(y,"-")},m=function(d,y){return y===void 0&&(y={}),u(d)?d:(d=d.toLowerCase(),y.reactCompat?d=d.replace(l,f):d=d.replace(s,f),d.replace(n,c))};return xl.camelCase=m,xl}var vl,Q0;function sC(){if(Q0)return vl;Q0=1;var e=vl&&vl.__importDefault||function(l){return l&&l.__esModule?l:{default:l}},n=e(rC()),r=iC();function s(l,u){var c={};return!l||typeof l!="string"||(0,n.default)(l,function(f,m){f&&m&&(c[(0,r.camelCase)(f,u)]=m)}),c}return s.default=s,vl=s,vl}var aC=sC();const lC=zb(aC),Ix=Fx("end"),Fd=Fx("start");function Fx(e){return n;function n(r){const s=r&&r.position&&r.position[e]||{};if(typeof s.line=="number"&&s.line>0&&typeof s.column=="number"&&s.column>0)return{line:s.line,column:s.column,offset:typeof s.offset=="number"&&s.offset>-1?s.offset:void 0}}}function oC(e){const n=Fd(e),r=Ix(e);if(n&&r)return{start:n,end:r}}function Ol(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Z0(e.position):"start"in e||"end"in e?Z0(e):"line"in e||"column"in e?gd(e):""}function gd(e){return W0(e&&e.line)+":"+W0(e&&e.column)}function Z0(e){return gd(e&&e.start)+"-"+gd(e&&e.end)}function W0(e){return e&&typeof e=="number"?e:1}class hn extends Error{constructor(n,r,s){super(),typeof r=="string"&&(s=r,r=void 0);let l="",u={},c=!1;if(r&&("line"in r&&"column"in r?u={place:r}:"start"in r&&"end"in r?u={place:r}:"type"in r?u={ancestors:[r],place:r.position}:u={...r}),typeof n=="string"?l=n:!u.cause&&n&&(c=!0,l=n.message,u.cause=n),!u.ruleId&&!u.source&&typeof s=="string"){const m=s.indexOf(":");m===-1?u.ruleId=s:(u.source=s.slice(0,m),u.ruleId=s.slice(m+1))}if(!u.place&&u.ancestors&&u.ancestors){const m=u.ancestors[u.ancestors.length-1];m&&(u.place=m.position)}const f=u.place&&"start"in u.place?u.place.start:u.place;this.ancestors=u.ancestors||void 0,this.cause=u.cause||void 0,this.column=f?f.column:void 0,this.fatal=void 0,this.file="",this.message=l,this.line=f?f.line:void 0,this.name=Ol(u.place)||"1:1",this.place=u.place||void 0,this.reason=this.message,this.ruleId=u.ruleId||void 0,this.source=u.source||void 0,this.stack=c&&u.cause&&typeof u.cause.stack=="string"?u.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}hn.prototype.file="";hn.prototype.name="";hn.prototype.reason="";hn.prototype.message="";hn.prototype.stack="";hn.prototype.column=void 0;hn.prototype.line=void 0;hn.prototype.ancestors=void 0;hn.prototype.cause=void 0;hn.prototype.fatal=void 0;hn.prototype.place=void 0;hn.prototype.ruleId=void 0;hn.prototype.source=void 0;const $d={}.hasOwnProperty,uC=new Map,cC=/[A-Z]/g,fC=new Set(["table","tbody","thead","tfoot","tr"]),hC=new Set(["td","th"]),$x="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function dC(e,n){if(!n||n.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const r=n.filePath||void 0;let s;if(n.development){if(typeof n.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");s=wC(r,n.jsxDEV)}else{if(typeof n.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof n.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");s=vC(r,n.jsx,n.jsxs)}const l={Fragment:n.Fragment,ancestors:[],components:n.components||{},create:s,elementAttributeNameCase:n.elementAttributeNameCase||"react",evaluater:n.createEvaluater?n.createEvaluater():void 0,filePath:r,ignoreInvalidStyle:n.ignoreInvalidStyle||!1,passKeys:n.passKeys!==!1,passNode:n.passNode||!1,schema:n.space==="svg"?Id:eC,stylePropertyNameCase:n.stylePropertyNameCase||"dom",tableCellAlignToStyle:n.tableCellAlignToStyle!==!1},u=Yx(l,e,void 0);return u&&typeof u!="string"?u:l.create(e,l.Fragment,{children:u||void 0},void 0)}function Yx(e,n,r){if(n.type==="element")return mC(e,n,r);if(n.type==="mdxFlowExpression"||n.type==="mdxTextExpression")return pC(e,n);if(n.type==="mdxJsxFlowElement"||n.type==="mdxJsxTextElement")return yC(e,n,r);if(n.type==="mdxjsEsm")return gC(e,n);if(n.type==="root")return bC(e,n,r);if(n.type==="text")return xC(e,n)}function mC(e,n,r){const s=e.schema;let l=s;n.tagName.toLowerCase()==="svg"&&s.space==="html"&&(l=Id,e.schema=l),e.ancestors.push(n);const u=Vx(e,n.tagName,!1),c=SC(e,n);let f=Gd(e,n);return fC.has(n.tagName)&&(f=f.filter(function(m){return typeof m=="string"?!$k(m):!0})),Gx(e,c,u,n),Yd(c,f),e.ancestors.pop(),e.schema=s,e.create(n,u,c,r)}function pC(e,n){if(n.data&&n.data.estree&&e.evaluater){const s=n.data.estree.body[0];return s.type,e.evaluater.evaluateExpression(s.expression)}Pl(e,n.position)}function gC(e,n){if(n.data&&n.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(n.data.estree);Pl(e,n.position)}function yC(e,n,r){const s=e.schema;let l=s;n.name==="svg"&&s.space==="html"&&(l=Id,e.schema=l),e.ancestors.push(n);const u=n.name===null?e.Fragment:Vx(e,n.name,!0),c=_C(e,n),f=Gd(e,n);return Gx(e,c,u,n),Yd(c,f),e.ancestors.pop(),e.schema=s,e.create(n,u,c,r)}function bC(e,n,r){const s={};return Yd(s,Gd(e,n)),e.create(n,e.Fragment,s,r)}function xC(e,n){return n.value}function Gx(e,n,r,s){typeof r!="string"&&r!==e.Fragment&&e.passNode&&(n.node=s)}function Yd(e,n){if(n.length>0){const r=n.length>1?n:n[0];r&&(e.children=r)}}function vC(e,n,r){return s;function s(l,u,c,f){const d=Array.isArray(c.children)?r:n;return f?d(u,c,f):d(u,c)}}function wC(e,n){return r;function r(s,l,u,c){const f=Array.isArray(u.children),m=Fd(s);return n(l,u,c,f,{columnNumber:m?m.column-1:void 0,fileName:e,lineNumber:m?m.line:void 0},void 0)}}function SC(e,n){const r={};let s,l;for(l in n.properties)if(l!=="children"&&$d.call(n.properties,l)){const u=EC(e,l,n.properties[l]);if(u){const[c,f]=u;e.tableCellAlignToStyle&&c==="align"&&typeof f=="string"&&hC.has(n.tagName)?s=f:r[c]=f}}if(s){const u=r.style||(r.style={});u[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=s}return r}function _C(e,n){const r={};for(const s of n.attributes)if(s.type==="mdxJsxExpressionAttribute")if(s.data&&s.data.estree&&e.evaluater){const u=s.data.estree.body[0];u.type;const c=u.expression;c.type;const f=c.properties[0];f.type,Object.assign(r,e.evaluater.evaluateExpression(f.argument))}else Pl(e,n.position);else{const l=s.name;let u;if(s.value&&typeof s.value=="object")if(s.value.data&&s.value.data.estree&&e.evaluater){const f=s.value.data.estree.body[0];f.type,u=e.evaluater.evaluateExpression(f.expression)}else Pl(e,n.position);else u=s.value===null?!0:s.value;r[l]=u}return r}function Gd(e,n){const r=[];let s=-1;const l=e.passKeys?new Map:uC;for(;++s<n.children.length;){const u=n.children[s];let c;if(e.passKeys){const m=u.type==="element"?u.tagName:u.type==="mdxJsxFlowElement"||u.type==="mdxJsxTextElement"?u.name:void 0;if(m){const d=l.get(m)||0;c=m+"-"+d,l.set(m,d+1)}}const f=Yx(e,u,c);f!==void 0&&r.push(f)}return r}function EC(e,n,r){const s=Qk(e.schema,n);if(!(r==null||typeof r=="number"&&Number.isNaN(r))){if(Array.isArray(r)&&(r=s.commaSeparated?Pk(r):tC(r)),s.property==="style"){let l=typeof r=="object"?r:kC(e,String(r));return e.stylePropertyNameCase==="css"&&(l=CC(l)),["style",l]}return[e.elementAttributeNameCase==="react"&&s.space?Jk[s.property]||s.property:s.attribute,r]}}function kC(e,n){try{return lC(n,{reactCompat:!0})}catch(r){if(e.ignoreInvalidStyle)return{};const s=r,l=new hn("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:s,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw l.file=e.filePath||void 0,l.url=$x+"#cannot-parse-style-attribute",l}}function Vx(e,n,r){let s;if(!r)s={type:"Literal",value:n};else if(n.includes(".")){const l=n.split(".");let u=-1,c;for(;++u<l.length;){const f=$0(l[u])?{type:"Identifier",name:l[u]}:{type:"Literal",value:l[u]};c=c?{type:"MemberExpression",object:c,property:f,computed:!!(u&&f.type==="Literal"),optional:!1}:f}s=c}else s=$0(n)&&!/^[a-z]/.test(n)?{type:"Identifier",name:n}:{type:"Literal",value:n};if(s.type==="Literal"){const l=s.value;return $d.call(e.components,l)?e.components[l]:l}if(e.evaluater)return e.evaluater.evaluateExpression(s);Pl(e)}function Pl(e,n){const r=new hn("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:n,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw r.file=e.filePath||void 0,r.url=$x+"#cannot-handle-mdx-estrees-without-createevaluater",r}function CC(e){const n={};let r;for(r in e)$d.call(e,r)&&(n[AC(r)]=e[r]);return n}function AC(e){let n=e.replace(cC,TC);return n.slice(0,3)==="ms-"&&(n="-"+n),n}function TC(e){return"-"+e.toLowerCase()}const Dh={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},jC={};function Vd(e,n){const r=jC,s=typeof r.includeImageAlt=="boolean"?r.includeImageAlt:!0,l=typeof r.includeHtml=="boolean"?r.includeHtml:!0;return Jx(e,s,l)}function Jx(e,n,r){if(NC(e)){if("value"in e)return e.type==="html"&&!r?"":e.value;if(n&&"alt"in e&&e.alt)return e.alt;if("children"in e)return eb(e.children,n,r)}return Array.isArray(e)?eb(e,n,r):""}function eb(e,n,r){const s=[];let l=-1;for(;++l<e.length;)s[l]=Jx(e[l],n,r);return s.join("")}function NC(e){return!!(e&&typeof e=="object")}const tb=document.createElement("i");function Jd(e){const n="&"+e+";";tb.innerHTML=n;const r=tb.textContent;return r.charCodeAt(r.length-1)===59&&e!=="semi"||r===n?!1:r}function $n(e,n,r,s){const l=e.length;let u=0,c;if(n<0?n=-n>l?0:l+n:n=n>l?l:n,r=r>0?r:0,s.length<1e4)c=Array.from(s),c.unshift(n,r),e.splice(...c);else for(r&&e.splice(n,r);u<s.length;)c=s.slice(u,u+1e4),c.unshift(n,0),e.splice(...c),u+=1e4,n+=1e4}function sr(e,n){return e.length>0?($n(e,e.length,0,n),e):n}const nb={}.hasOwnProperty;function Xx(e){const n={};let r=-1;for(;++r<e.length;)OC(n,e[r]);return n}function OC(e,n){let r;for(r in n){const l=(nb.call(e,r)?e[r]:void 0)||(e[r]={}),u=n[r];let c;if(u)for(c in u){nb.call(l,c)||(l[c]=[]);const f=u[c];RC(l[c],Array.isArray(f)?f:f?[f]:[])}}}function RC(e,n){let r=-1;const s=[];for(;++r<n.length;)(n[r].add==="after"?e:s).push(n[r]);$n(e,0,0,s)}function Kx(e,n){const r=Number.parseInt(e,n);return r<9||r===11||r>13&&r<32||r>126&&r<160||r>55295&&r<57344||r>64975&&r<65008||(r&65535)===65535||(r&65535)===65534||r>1114111?"�":String.fromCodePoint(r)}function gr(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const yn=Hi(/[A-Za-z]/),fn=Hi(/[\dA-Za-z]/),MC=Hi(/[#-'*+\--9=?A-Z^-~]/);function Bu(e){return e!==null&&(e<32||e===127)}const yd=Hi(/\d/),DC=Hi(/[\dA-Fa-f]/),LC=Hi(/[!-/:-@[-`{-~]/);function Be(e){return e!==null&&e<-2}function Tt(e){return e!==null&&(e<0||e===32)}function We(e){return e===-2||e===-1||e===32}const Xu=Hi(new RegExp("\\p{P}|\\p{S}","u")),ds=Hi(/\s/);function Hi(e){return n;function n(r){return r!==null&&r>-1&&e.test(String.fromCharCode(r))}}function _a(e){const n=[];let r=-1,s=0,l=0;for(;++r<e.length;){const u=e.charCodeAt(r);let c="";if(u===37&&fn(e.charCodeAt(r+1))&&fn(e.charCodeAt(r+2)))l=2;else if(u<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(u))||(c=String.fromCharCode(u));else if(u>55295&&u<57344){const f=e.charCodeAt(r+1);u<56320&&f>56319&&f<57344?(c=String.fromCharCode(u,f),l=1):c="�"}else c=String.fromCharCode(u);c&&(n.push(e.slice(s,r),encodeURIComponent(c)),s=r+l+1,c=""),l&&(r+=l,l=0)}return n.join("")+e.slice(s)}function lt(e,n,r,s){const l=s?s-1:Number.POSITIVE_INFINITY;let u=0;return c;function c(m){return We(m)?(e.enter(r),f(m)):n(m)}function f(m){return We(m)&&u++<l?(e.consume(m),f):(e.exit(r),n(m))}}const zC={tokenize:UC};function UC(e){const n=e.attempt(this.parser.constructs.contentInitial,s,l);let r;return n;function s(f){if(f===null){e.consume(f);return}return e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),lt(e,n,"linePrefix")}function l(f){return e.enter("paragraph"),u(f)}function u(f){const m=e.enter("chunkText",{contentType:"text",previous:r});return r&&(r.next=m),r=m,c(f)}function c(f){if(f===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(f);return}return Be(f)?(e.consume(f),e.exit("chunkText"),u):(e.consume(f),c)}}const BC={tokenize:PC},rb={tokenize:qC};function PC(e){const n=this,r=[];let s=0,l,u,c;return f;function f(T){if(s<r.length){const te=r[s];return n.containerState=te[1],e.attempt(te[0].continuation,m,d)(T)}return d(T)}function m(T){if(s++,n.containerState._closeFlow){n.containerState._closeFlow=void 0,l&&$();const te=n.events.length;let B=te,z;for(;B--;)if(n.events[B][0]==="exit"&&n.events[B][1].type==="chunkFlow"){z=n.events[B][1].end;break}L(s);let K=te;for(;K<n.events.length;)n.events[K][1].end={...z},K++;return $n(n.events,B+1,0,n.events.slice(te)),n.events.length=K,d(T)}return f(T)}function d(T){if(s===r.length){if(!l)return x(T);if(l.currentConstruct&&l.currentConstruct.concrete)return S(T);n.interrupt=!!(l.currentConstruct&&!l._gfmTableDynamicInterruptHack)}return n.containerState={},e.check(rb,y,g)(T)}function y(T){return l&&$(),L(s),x(T)}function g(T){return n.parser.lazy[n.now().line]=s!==r.length,c=n.now().offset,S(T)}function x(T){return n.containerState={},e.attempt(rb,w,S)(T)}function w(T){return s++,r.push([n.currentConstruct,n.containerState]),x(T)}function S(T){if(T===null){l&&$(),L(0),e.consume(T);return}return l=l||n.parser.flow(n.now()),e.enter("chunkFlow",{_tokenizer:l,contentType:"flow",previous:u}),D(T)}function D(T){if(T===null){q(e.exit("chunkFlow"),!0),L(0),e.consume(T);return}return Be(T)?(e.consume(T),q(e.exit("chunkFlow")),s=0,n.interrupt=void 0,f):(e.consume(T),D)}function q(T,te){const B=n.sliceStream(T);if(te&&B.push(null),T.previous=u,u&&(u.next=T),u=T,l.defineSkip(T.start),l.write(B),n.parser.lazy[T.start.line]){let z=l.events.length;for(;z--;)if(l.events[z][1].start.offset<c&&(!l.events[z][1].end||l.events[z][1].end.offset>c))return;const K=n.events.length;let Q=K,H,R;for(;Q--;)if(n.events[Q][0]==="exit"&&n.events[Q][1].type==="chunkFlow"){if(H){R=n.events[Q][1].end;break}H=!0}for(L(s),z=K;z<n.events.length;)n.events[z][1].end={...R},z++;$n(n.events,Q+1,0,n.events.slice(K)),n.events.length=z}}function L(T){let te=r.length;for(;te-- >T;){const B=r[te];n.containerState=B[1],B[0].exit.call(n,e)}r.length=T}function $(){l.write([null]),u=void 0,l=void 0,n.containerState._closeFlow=void 0}}function qC(e,n,r){return lt(e,e.attempt(this.parser.constructs.document,n,r),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function ga(e){if(e===null||Tt(e)||ds(e))return 1;if(Xu(e))return 2}function Ku(e,n,r){const s=[];let l=-1;for(;++l<e.length;){const u=e[l].resolveAll;u&&!s.includes(u)&&(n=u(n,r),s.push(u))}return n}const bd={name:"attention",resolveAll:HC,tokenize:IC};function HC(e,n){let r=-1,s,l,u,c,f,m,d,y;for(;++r<e.length;)if(e[r][0]==="enter"&&e[r][1].type==="attentionSequence"&&e[r][1]._close){for(s=r;s--;)if(e[s][0]==="exit"&&e[s][1].type==="attentionSequence"&&e[s][1]._open&&n.sliceSerialize(e[s][1]).charCodeAt(0)===n.sliceSerialize(e[r][1]).charCodeAt(0)){if((e[s][1]._close||e[r][1]._open)&&(e[r][1].end.offset-e[r][1].start.offset)%3&&!((e[s][1].end.offset-e[s][1].start.offset+e[r][1].end.offset-e[r][1].start.offset)%3))continue;m=e[s][1].end.offset-e[s][1].start.offset>1&&e[r][1].end.offset-e[r][1].start.offset>1?2:1;const g={...e[s][1].end},x={...e[r][1].start};ib(g,-m),ib(x,m),c={type:m>1?"strongSequence":"emphasisSequence",start:g,end:{...e[s][1].end}},f={type:m>1?"strongSequence":"emphasisSequence",start:{...e[r][1].start},end:x},u={type:m>1?"strongText":"emphasisText",start:{...e[s][1].end},end:{...e[r][1].start}},l={type:m>1?"strong":"emphasis",start:{...c.start},end:{...f.end}},e[s][1].end={...c.start},e[r][1].start={...f.end},d=[],e[s][1].end.offset-e[s][1].start.offset&&(d=sr(d,[["enter",e[s][1],n],["exit",e[s][1],n]])),d=sr(d,[["enter",l,n],["enter",c,n],["exit",c,n],["enter",u,n]]),d=sr(d,Ku(n.parser.constructs.insideSpan.null,e.slice(s+1,r),n)),d=sr(d,[["exit",u,n],["enter",f,n],["exit",f,n],["exit",l,n]]),e[r][1].end.offset-e[r][1].start.offset?(y=2,d=sr(d,[["enter",e[r][1],n],["exit",e[r][1],n]])):y=0,$n(e,s-1,r-s+3,d),r=s+d.length-y-2;break}}for(r=-1;++r<e.length;)e[r][1].type==="attentionSequence"&&(e[r][1].type="data");return e}function IC(e,n){const r=this.parser.constructs.attentionMarkers.null,s=this.previous,l=ga(s);let u;return c;function c(m){return u=m,e.enter("attentionSequence"),f(m)}function f(m){if(m===u)return e.consume(m),f;const d=e.exit("attentionSequence"),y=ga(m),g=!y||y===2&&l||r.includes(m),x=!l||l===2&&y||r.includes(s);return d._open=!!(u===42?g:g&&(l||!x)),d._close=!!(u===42?x:x&&(y||!g)),n(m)}}function ib(e,n){e.column+=n,e.offset+=n,e._bufferIndex+=n}const FC={name:"autolink",tokenize:$C};function $C(e,n,r){let s=0;return l;function l(w){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(w),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),u}function u(w){return yn(w)?(e.consume(w),c):w===64?r(w):d(w)}function c(w){return w===43||w===45||w===46||fn(w)?(s=1,f(w)):d(w)}function f(w){return w===58?(e.consume(w),s=0,m):(w===43||w===45||w===46||fn(w))&&s++<32?(e.consume(w),f):(s=0,d(w))}function m(w){return w===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(w),e.exit("autolinkMarker"),e.exit("autolink"),n):w===null||w===32||w===60||Bu(w)?r(w):(e.consume(w),m)}function d(w){return w===64?(e.consume(w),y):MC(w)?(e.consume(w),d):r(w)}function y(w){return fn(w)?g(w):r(w)}function g(w){return w===46?(e.consume(w),s=0,y):w===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(w),e.exit("autolinkMarker"),e.exit("autolink"),n):x(w)}function x(w){if((w===45||fn(w))&&s++<63){const S=w===45?x:g;return e.consume(w),S}return r(w)}}const Vl={partial:!0,tokenize:YC};function YC(e,n,r){return s;function s(u){return We(u)?lt(e,l,"linePrefix")(u):l(u)}function l(u){return u===null||Be(u)?n(u):r(u)}}const Qx={continuation:{tokenize:VC},exit:JC,name:"blockQuote",tokenize:GC};function GC(e,n,r){const s=this;return l;function l(c){if(c===62){const f=s.containerState;return f.open||(e.enter("blockQuote",{_container:!0}),f.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(c),e.exit("blockQuoteMarker"),u}return r(c)}function u(c){return We(c)?(e.enter("blockQuotePrefixWhitespace"),e.consume(c),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),n):(e.exit("blockQuotePrefix"),n(c))}}function VC(e,n,r){const s=this;return l;function l(c){return We(c)?lt(e,u,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(c):u(c)}function u(c){return e.attempt(Qx,n,r)(c)}}function JC(e){e.exit("blockQuote")}const Zx={name:"characterEscape",tokenize:XC};function XC(e,n,r){return s;function s(u){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(u),e.exit("escapeMarker"),l}function l(u){return LC(u)?(e.enter("characterEscapeValue"),e.consume(u),e.exit("characterEscapeValue"),e.exit("characterEscape"),n):r(u)}}const Wx={name:"characterReference",tokenize:KC};function KC(e,n,r){const s=this;let l=0,u,c;return f;function f(g){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(g),e.exit("characterReferenceMarker"),m}function m(g){return g===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(g),e.exit("characterReferenceMarkerNumeric"),d):(e.enter("characterReferenceValue"),u=31,c=fn,y(g))}function d(g){return g===88||g===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(g),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),u=6,c=DC,y):(e.enter("characterReferenceValue"),u=7,c=yd,y(g))}function y(g){if(g===59&&l){const x=e.exit("characterReferenceValue");return c===fn&&!Jd(s.sliceSerialize(x))?r(g):(e.enter("characterReferenceMarker"),e.consume(g),e.exit("characterReferenceMarker"),e.exit("characterReference"),n)}return c(g)&&l++<u?(e.consume(g),y):r(g)}}const sb={partial:!0,tokenize:ZC},ab={concrete:!0,name:"codeFenced",tokenize:QC};function QC(e,n,r){const s=this,l={partial:!0,tokenize:B};let u=0,c=0,f;return m;function m(z){return d(z)}function d(z){const K=s.events[s.events.length-1];return u=K&&K[1].type==="linePrefix"?K[2].sliceSerialize(K[1],!0).length:0,f=z,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),y(z)}function y(z){return z===f?(c++,e.consume(z),y):c<3?r(z):(e.exit("codeFencedFenceSequence"),We(z)?lt(e,g,"whitespace")(z):g(z))}function g(z){return z===null||Be(z)?(e.exit("codeFencedFence"),s.interrupt?n(z):e.check(sb,D,te)(z)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),x(z))}function x(z){return z===null||Be(z)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),g(z)):We(z)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),lt(e,w,"whitespace")(z)):z===96&&z===f?r(z):(e.consume(z),x)}function w(z){return z===null||Be(z)?g(z):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),S(z))}function S(z){return z===null||Be(z)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),g(z)):z===96&&z===f?r(z):(e.consume(z),S)}function D(z){return e.attempt(l,te,q)(z)}function q(z){return e.enter("lineEnding"),e.consume(z),e.exit("lineEnding"),L}function L(z){return u>0&&We(z)?lt(e,$,"linePrefix",u+1)(z):$(z)}function $(z){return z===null||Be(z)?e.check(sb,D,te)(z):(e.enter("codeFlowValue"),T(z))}function T(z){return z===null||Be(z)?(e.exit("codeFlowValue"),$(z)):(e.consume(z),T)}function te(z){return e.exit("codeFenced"),n(z)}function B(z,K,Q){let H=0;return R;function R(F){return z.enter("lineEnding"),z.consume(F),z.exit("lineEnding"),X}function X(F){return z.enter("codeFencedFence"),We(F)?lt(z,J,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(F):J(F)}function J(F){return F===f?(z.enter("codeFencedFenceSequence"),ae(F)):Q(F)}function ae(F){return F===f?(H++,z.consume(F),ae):H>=c?(z.exit("codeFencedFenceSequence"),We(F)?lt(z,re,"whitespace")(F):re(F)):Q(F)}function re(F){return F===null||Be(F)?(z.exit("codeFencedFence"),K(F)):Q(F)}}}function ZC(e,n,r){const s=this;return l;function l(c){return c===null?r(c):(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),u)}function u(c){return s.parser.lazy[s.now().line]?r(c):n(c)}}const Lh={name:"codeIndented",tokenize:eA},WC={partial:!0,tokenize:tA};function eA(e,n,r){const s=this;return l;function l(d){return e.enter("codeIndented"),lt(e,u,"linePrefix",5)(d)}function u(d){const y=s.events[s.events.length-1];return y&&y[1].type==="linePrefix"&&y[2].sliceSerialize(y[1],!0).length>=4?c(d):r(d)}function c(d){return d===null?m(d):Be(d)?e.attempt(WC,c,m)(d):(e.enter("codeFlowValue"),f(d))}function f(d){return d===null||Be(d)?(e.exit("codeFlowValue"),c(d)):(e.consume(d),f)}function m(d){return e.exit("codeIndented"),n(d)}}function tA(e,n,r){const s=this;return l;function l(c){return s.parser.lazy[s.now().line]?r(c):Be(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),l):lt(e,u,"linePrefix",5)(c)}function u(c){const f=s.events[s.events.length-1];return f&&f[1].type==="linePrefix"&&f[2].sliceSerialize(f[1],!0).length>=4?n(c):Be(c)?l(c):r(c)}}const nA={name:"codeText",previous:iA,resolve:rA,tokenize:sA};function rA(e){let n=e.length-4,r=3,s,l;if((e[r][1].type==="lineEnding"||e[r][1].type==="space")&&(e[n][1].type==="lineEnding"||e[n][1].type==="space")){for(s=r;++s<n;)if(e[s][1].type==="codeTextData"){e[r][1].type="codeTextPadding",e[n][1].type="codeTextPadding",r+=2,n-=2;break}}for(s=r-1,n++;++s<=n;)l===void 0?s!==n&&e[s][1].type!=="lineEnding"&&(l=s):(s===n||e[s][1].type==="lineEnding")&&(e[l][1].type="codeTextData",s!==l+2&&(e[l][1].end=e[s-1][1].end,e.splice(l+2,s-l-2),n-=s-l-2,s=l+2),l=void 0);return e}function iA(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function sA(e,n,r){let s=0,l,u;return c;function c(g){return e.enter("codeText"),e.enter("codeTextSequence"),f(g)}function f(g){return g===96?(e.consume(g),s++,f):(e.exit("codeTextSequence"),m(g))}function m(g){return g===null?r(g):g===32?(e.enter("space"),e.consume(g),e.exit("space"),m):g===96?(u=e.enter("codeTextSequence"),l=0,y(g)):Be(g)?(e.enter("lineEnding"),e.consume(g),e.exit("lineEnding"),m):(e.enter("codeTextData"),d(g))}function d(g){return g===null||g===32||g===96||Be(g)?(e.exit("codeTextData"),m(g)):(e.consume(g),d)}function y(g){return g===96?(e.consume(g),l++,y):l===s?(e.exit("codeTextSequence"),e.exit("codeText"),n(g)):(u.type="codeTextData",d(g))}}class aA{constructor(n){this.left=n?[...n]:[],this.right=[]}get(n){if(n<0||n>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+n+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return n<this.left.length?this.left[n]:this.right[this.right.length-n+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(n,r){const s=r??Number.POSITIVE_INFINITY;return s<this.left.length?this.left.slice(n,s):n>this.left.length?this.right.slice(this.right.length-s+this.left.length,this.right.length-n+this.left.length).reverse():this.left.slice(n).concat(this.right.slice(this.right.length-s+this.left.length).reverse())}splice(n,r,s){const l=r||0;this.setCursor(Math.trunc(n));const u=this.right.splice(this.right.length-l,Number.POSITIVE_INFINITY);return s&&wl(this.left,s),u.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(n){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(n)}pushMany(n){this.setCursor(Number.POSITIVE_INFINITY),wl(this.left,n)}unshift(n){this.setCursor(0),this.right.push(n)}unshiftMany(n){this.setCursor(0),wl(this.right,n.reverse())}setCursor(n){if(!(n===this.left.length||n>this.left.length&&this.right.length===0||n<0&&this.left.length===0))if(n<this.left.length){const r=this.left.splice(n,Number.POSITIVE_INFINITY);wl(this.right,r.reverse())}else{const r=this.right.splice(this.left.length+this.right.length-n,Number.POSITIVE_INFINITY);wl(this.left,r.reverse())}}}function wl(e,n){let r=0;if(n.length<1e4)e.push(...n);else for(;r<n.length;)e.push(...n.slice(r,r+1e4)),r+=1e4}function e1(e){const n={};let r=-1,s,l,u,c,f,m,d;const y=new aA(e);for(;++r<y.length;){for(;r in n;)r=n[r];if(s=y.get(r),r&&s[1].type==="chunkFlow"&&y.get(r-1)[1].type==="listItemPrefix"&&(m=s[1]._tokenizer.events,u=0,u<m.length&&m[u][1].type==="lineEndingBlank"&&(u+=2),u<m.length&&m[u][1].type==="content"))for(;++u<m.length&&m[u][1].type!=="content";)m[u][1].type==="chunkText"&&(m[u][1]._isInFirstContentOfListItem=!0,u++);if(s[0]==="enter")s[1].contentType&&(Object.assign(n,lA(y,r)),r=n[r],d=!0);else if(s[1]._container){for(u=r,l=void 0;u--;)if(c=y.get(u),c[1].type==="lineEnding"||c[1].type==="lineEndingBlank")c[0]==="enter"&&(l&&(y.get(l)[1].type="lineEndingBlank"),c[1].type="lineEnding",l=u);else if(!(c[1].type==="linePrefix"||c[1].type==="listItemIndent"))break;l&&(s[1].end={...y.get(l)[1].start},f=y.slice(l,r),f.unshift(s),y.splice(l,r-l+1,f))}}return $n(e,0,Number.POSITIVE_INFINITY,y.slice(0)),!d}function lA(e,n){const r=e.get(n)[1],s=e.get(n)[2];let l=n-1;const u=[];let c=r._tokenizer;c||(c=s.parser[r.contentType](r.start),r._contentTypeTextTrailing&&(c._contentTypeTextTrailing=!0));const f=c.events,m=[],d={};let y,g,x=-1,w=r,S=0,D=0;const q=[D];for(;w;){for(;e.get(++l)[1]!==w;);u.push(l),w._tokenizer||(y=s.sliceStream(w),w.next||y.push(null),g&&c.defineSkip(w.start),w._isInFirstContentOfListItem&&(c._gfmTasklistFirstContentOfListItem=!0),c.write(y),w._isInFirstContentOfListItem&&(c._gfmTasklistFirstContentOfListItem=void 0)),g=w,w=w.next}for(w=r;++x<f.length;)f[x][0]==="exit"&&f[x-1][0]==="enter"&&f[x][1].type===f[x-1][1].type&&f[x][1].start.line!==f[x][1].end.line&&(D=x+1,q.push(D),w._tokenizer=void 0,w.previous=void 0,w=w.next);for(c.events=[],w?(w._tokenizer=void 0,w.previous=void 0):q.pop(),x=q.length;x--;){const L=f.slice(q[x],q[x+1]),$=u.pop();m.push([$,$+L.length-1]),e.splice($,2,L)}for(m.reverse(),x=-1;++x<m.length;)d[S+m[x][0]]=S+m[x][1],S+=m[x][1]-m[x][0]-1;return d}const oA={resolve:cA,tokenize:fA},uA={partial:!0,tokenize:hA};function cA(e){return e1(e),e}function fA(e,n){let r;return s;function s(f){return e.enter("content"),r=e.enter("chunkContent",{contentType:"content"}),l(f)}function l(f){return f===null?u(f):Be(f)?e.check(uA,c,u)(f):(e.consume(f),l)}function u(f){return e.exit("chunkContent"),e.exit("content"),n(f)}function c(f){return e.consume(f),e.exit("chunkContent"),r.next=e.enter("chunkContent",{contentType:"content",previous:r}),r=r.next,l}}function hA(e,n,r){const s=this;return l;function l(c){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),lt(e,u,"linePrefix")}function u(c){if(c===null||Be(c))return r(c);const f=s.events[s.events.length-1];return!s.parser.constructs.disable.null.includes("codeIndented")&&f&&f[1].type==="linePrefix"&&f[2].sliceSerialize(f[1],!0).length>=4?n(c):e.interrupt(s.parser.constructs.flow,r,n)(c)}}function t1(e,n,r,s,l,u,c,f,m){const d=m||Number.POSITIVE_INFINITY;let y=0;return g;function g(L){return L===60?(e.enter(s),e.enter(l),e.enter(u),e.consume(L),e.exit(u),x):L===null||L===32||L===41||Bu(L)?r(L):(e.enter(s),e.enter(c),e.enter(f),e.enter("chunkString",{contentType:"string"}),D(L))}function x(L){return L===62?(e.enter(u),e.consume(L),e.exit(u),e.exit(l),e.exit(s),n):(e.enter(f),e.enter("chunkString",{contentType:"string"}),w(L))}function w(L){return L===62?(e.exit("chunkString"),e.exit(f),x(L)):L===null||L===60||Be(L)?r(L):(e.consume(L),L===92?S:w)}function S(L){return L===60||L===62||L===92?(e.consume(L),w):w(L)}function D(L){return!y&&(L===null||L===41||Tt(L))?(e.exit("chunkString"),e.exit(f),e.exit(c),e.exit(s),n(L)):y<d&&L===40?(e.consume(L),y++,D):L===41?(e.consume(L),y--,D):L===null||L===32||L===40||Bu(L)?r(L):(e.consume(L),L===92?q:D)}function q(L){return L===40||L===41||L===92?(e.consume(L),D):D(L)}}function n1(e,n,r,s,l,u){const c=this;let f=0,m;return d;function d(w){return e.enter(s),e.enter(l),e.consume(w),e.exit(l),e.enter(u),y}function y(w){return f>999||w===null||w===91||w===93&&!m||w===94&&!f&&"_hiddenFootnoteSupport"in c.parser.constructs?r(w):w===93?(e.exit(u),e.enter(l),e.consume(w),e.exit(l),e.exit(s),n):Be(w)?(e.enter("lineEnding"),e.consume(w),e.exit("lineEnding"),y):(e.enter("chunkString",{contentType:"string"}),g(w))}function g(w){return w===null||w===91||w===93||Be(w)||f++>999?(e.exit("chunkString"),y(w)):(e.consume(w),m||(m=!We(w)),w===92?x:g)}function x(w){return w===91||w===92||w===93?(e.consume(w),f++,g):g(w)}}function r1(e,n,r,s,l,u){let c;return f;function f(x){return x===34||x===39||x===40?(e.enter(s),e.enter(l),e.consume(x),e.exit(l),c=x===40?41:x,m):r(x)}function m(x){return x===c?(e.enter(l),e.consume(x),e.exit(l),e.exit(s),n):(e.enter(u),d(x))}function d(x){return x===c?(e.exit(u),m(c)):x===null?r(x):Be(x)?(e.enter("lineEnding"),e.consume(x),e.exit("lineEnding"),lt(e,d,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),y(x))}function y(x){return x===c||x===null||Be(x)?(e.exit("chunkString"),d(x)):(e.consume(x),x===92?g:y)}function g(x){return x===c||x===92?(e.consume(x),y):y(x)}}function Rl(e,n){let r;return s;function s(l){return Be(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),r=!0,s):We(l)?lt(e,s,r?"linePrefix":"lineSuffix")(l):n(l)}}const dA={name:"definition",tokenize:pA},mA={partial:!0,tokenize:gA};function pA(e,n,r){const s=this;let l;return u;function u(w){return e.enter("definition"),c(w)}function c(w){return n1.call(s,e,f,r,"definitionLabel","definitionLabelMarker","definitionLabelString")(w)}function f(w){return l=gr(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)),w===58?(e.enter("definitionMarker"),e.consume(w),e.exit("definitionMarker"),m):r(w)}function m(w){return Tt(w)?Rl(e,d)(w):d(w)}function d(w){return t1(e,y,r,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(w)}function y(w){return e.attempt(mA,g,g)(w)}function g(w){return We(w)?lt(e,x,"whitespace")(w):x(w)}function x(w){return w===null||Be(w)?(e.exit("definition"),s.parser.defined.push(l),n(w)):r(w)}}function gA(e,n,r){return s;function s(f){return Tt(f)?Rl(e,l)(f):r(f)}function l(f){return r1(e,u,r,"definitionTitle","definitionTitleMarker","definitionTitleString")(f)}function u(f){return We(f)?lt(e,c,"whitespace")(f):c(f)}function c(f){return f===null||Be(f)?n(f):r(f)}}const yA={name:"hardBreakEscape",tokenize:bA};function bA(e,n,r){return s;function s(u){return e.enter("hardBreakEscape"),e.consume(u),l}function l(u){return Be(u)?(e.exit("hardBreakEscape"),n(u)):r(u)}}const xA={name:"headingAtx",resolve:vA,tokenize:wA};function vA(e,n){let r=e.length-2,s=3,l,u;return e[s][1].type==="whitespace"&&(s+=2),r-2>s&&e[r][1].type==="whitespace"&&(r-=2),e[r][1].type==="atxHeadingSequence"&&(s===r-1||r-4>s&&e[r-2][1].type==="whitespace")&&(r-=s+1===r?2:4),r>s&&(l={type:"atxHeadingText",start:e[s][1].start,end:e[r][1].end},u={type:"chunkText",start:e[s][1].start,end:e[r][1].end,contentType:"text"},$n(e,s,r-s+1,[["enter",l,n],["enter",u,n],["exit",u,n],["exit",l,n]])),e}function wA(e,n,r){let s=0;return l;function l(y){return e.enter("atxHeading"),u(y)}function u(y){return e.enter("atxHeadingSequence"),c(y)}function c(y){return y===35&&s++<6?(e.consume(y),c):y===null||Tt(y)?(e.exit("atxHeadingSequence"),f(y)):r(y)}function f(y){return y===35?(e.enter("atxHeadingSequence"),m(y)):y===null||Be(y)?(e.exit("atxHeading"),n(y)):We(y)?lt(e,f,"whitespace")(y):(e.enter("atxHeadingText"),d(y))}function m(y){return y===35?(e.consume(y),m):(e.exit("atxHeadingSequence"),f(y))}function d(y){return y===null||y===35||Tt(y)?(e.exit("atxHeadingText"),f(y)):(e.consume(y),d)}}const SA=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],lb=["pre","script","style","textarea"],_A={concrete:!0,name:"htmlFlow",resolveTo:CA,tokenize:AA},EA={partial:!0,tokenize:jA},kA={partial:!0,tokenize:TA};function CA(e){let n=e.length;for(;n--&&!(e[n][0]==="enter"&&e[n][1].type==="htmlFlow"););return n>1&&e[n-2][1].type==="linePrefix"&&(e[n][1].start=e[n-2][1].start,e[n+1][1].start=e[n-2][1].start,e.splice(n-2,2)),e}function AA(e,n,r){const s=this;let l,u,c,f,m;return d;function d(A){return y(A)}function y(A){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(A),g}function g(A){return A===33?(e.consume(A),x):A===47?(e.consume(A),u=!0,D):A===63?(e.consume(A),l=3,s.interrupt?n:_):yn(A)?(e.consume(A),c=String.fromCharCode(A),q):r(A)}function x(A){return A===45?(e.consume(A),l=2,w):A===91?(e.consume(A),l=5,f=0,S):yn(A)?(e.consume(A),l=4,s.interrupt?n:_):r(A)}function w(A){return A===45?(e.consume(A),s.interrupt?n:_):r(A)}function S(A){const ve="CDATA[";return A===ve.charCodeAt(f++)?(e.consume(A),f===ve.length?s.interrupt?n:J:S):r(A)}function D(A){return yn(A)?(e.consume(A),c=String.fromCharCode(A),q):r(A)}function q(A){if(A===null||A===47||A===62||Tt(A)){const ve=A===47,Ce=c.toLowerCase();return!ve&&!u&&lb.includes(Ce)?(l=1,s.interrupt?n(A):J(A)):SA.includes(c.toLowerCase())?(l=6,ve?(e.consume(A),L):s.interrupt?n(A):J(A)):(l=7,s.interrupt&&!s.parser.lazy[s.now().line]?r(A):u?$(A):T(A))}return A===45||fn(A)?(e.consume(A),c+=String.fromCharCode(A),q):r(A)}function L(A){return A===62?(e.consume(A),s.interrupt?n:J):r(A)}function $(A){return We(A)?(e.consume(A),$):R(A)}function T(A){return A===47?(e.consume(A),R):A===58||A===95||yn(A)?(e.consume(A),te):We(A)?(e.consume(A),T):R(A)}function te(A){return A===45||A===46||A===58||A===95||fn(A)?(e.consume(A),te):B(A)}function B(A){return A===61?(e.consume(A),z):We(A)?(e.consume(A),B):T(A)}function z(A){return A===null||A===60||A===61||A===62||A===96?r(A):A===34||A===39?(e.consume(A),m=A,K):We(A)?(e.consume(A),z):Q(A)}function K(A){return A===m?(e.consume(A),m=null,H):A===null||Be(A)?r(A):(e.consume(A),K)}function Q(A){return A===null||A===34||A===39||A===47||A===60||A===61||A===62||A===96||Tt(A)?B(A):(e.consume(A),Q)}function H(A){return A===47||A===62||We(A)?T(A):r(A)}function R(A){return A===62?(e.consume(A),X):r(A)}function X(A){return A===null||Be(A)?J(A):We(A)?(e.consume(A),X):r(A)}function J(A){return A===45&&l===2?(e.consume(A),P):A===60&&l===1?(e.consume(A),V):A===62&&l===4?(e.consume(A),M):A===63&&l===3?(e.consume(A),_):A===93&&l===5?(e.consume(A),xe):Be(A)&&(l===6||l===7)?(e.exit("htmlFlowData"),e.check(EA,W,ae)(A)):A===null||Be(A)?(e.exit("htmlFlowData"),ae(A)):(e.consume(A),J)}function ae(A){return e.check(kA,re,W)(A)}function re(A){return e.enter("lineEnding"),e.consume(A),e.exit("lineEnding"),F}function F(A){return A===null||Be(A)?ae(A):(e.enter("htmlFlowData"),J(A))}function P(A){return A===45?(e.consume(A),_):J(A)}function V(A){return A===47?(e.consume(A),c="",ue):J(A)}function ue(A){if(A===62){const ve=c.toLowerCase();return lb.includes(ve)?(e.consume(A),M):J(A)}return yn(A)&&c.length<8?(e.consume(A),c+=String.fromCharCode(A),ue):J(A)}function xe(A){return A===93?(e.consume(A),_):J(A)}function _(A){return A===62?(e.consume(A),M):A===45&&l===2?(e.consume(A),_):J(A)}function M(A){return A===null||Be(A)?(e.exit("htmlFlowData"),W(A)):(e.consume(A),M)}function W(A){return e.exit("htmlFlow"),n(A)}}function TA(e,n,r){const s=this;return l;function l(c){return Be(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),u):r(c)}function u(c){return s.parser.lazy[s.now().line]?r(c):n(c)}}function jA(e,n,r){return s;function s(l){return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),e.attempt(Vl,n,r)}}const NA={name:"htmlText",tokenize:OA};function OA(e,n,r){const s=this;let l,u,c;return f;function f(_){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(_),m}function m(_){return _===33?(e.consume(_),d):_===47?(e.consume(_),B):_===63?(e.consume(_),T):yn(_)?(e.consume(_),Q):r(_)}function d(_){return _===45?(e.consume(_),y):_===91?(e.consume(_),u=0,S):yn(_)?(e.consume(_),$):r(_)}function y(_){return _===45?(e.consume(_),w):r(_)}function g(_){return _===null?r(_):_===45?(e.consume(_),x):Be(_)?(c=g,V(_)):(e.consume(_),g)}function x(_){return _===45?(e.consume(_),w):g(_)}function w(_){return _===62?P(_):_===45?x(_):g(_)}function S(_){const M="CDATA[";return _===M.charCodeAt(u++)?(e.consume(_),u===M.length?D:S):r(_)}function D(_){return _===null?r(_):_===93?(e.consume(_),q):Be(_)?(c=D,V(_)):(e.consume(_),D)}function q(_){return _===93?(e.consume(_),L):D(_)}function L(_){return _===62?P(_):_===93?(e.consume(_),L):D(_)}function $(_){return _===null||_===62?P(_):Be(_)?(c=$,V(_)):(e.consume(_),$)}function T(_){return _===null?r(_):_===63?(e.consume(_),te):Be(_)?(c=T,V(_)):(e.consume(_),T)}function te(_){return _===62?P(_):T(_)}function B(_){return yn(_)?(e.consume(_),z):r(_)}function z(_){return _===45||fn(_)?(e.consume(_),z):K(_)}function K(_){return Be(_)?(c=K,V(_)):We(_)?(e.consume(_),K):P(_)}function Q(_){return _===45||fn(_)?(e.consume(_),Q):_===47||_===62||Tt(_)?H(_):r(_)}function H(_){return _===47?(e.consume(_),P):_===58||_===95||yn(_)?(e.consume(_),R):Be(_)?(c=H,V(_)):We(_)?(e.consume(_),H):P(_)}function R(_){return _===45||_===46||_===58||_===95||fn(_)?(e.consume(_),R):X(_)}function X(_){return _===61?(e.consume(_),J):Be(_)?(c=X,V(_)):We(_)?(e.consume(_),X):H(_)}function J(_){return _===null||_===60||_===61||_===62||_===96?r(_):_===34||_===39?(e.consume(_),l=_,ae):Be(_)?(c=J,V(_)):We(_)?(e.consume(_),J):(e.consume(_),re)}function ae(_){return _===l?(e.consume(_),l=void 0,F):_===null?r(_):Be(_)?(c=ae,V(_)):(e.consume(_),ae)}function re(_){return _===null||_===34||_===39||_===60||_===61||_===96?r(_):_===47||_===62||Tt(_)?H(_):(e.consume(_),re)}function F(_){return _===47||_===62||Tt(_)?H(_):r(_)}function P(_){return _===62?(e.consume(_),e.exit("htmlTextData"),e.exit("htmlText"),n):r(_)}function V(_){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(_),e.exit("lineEnding"),ue}function ue(_){return We(_)?lt(e,xe,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(_):xe(_)}function xe(_){return e.enter("htmlTextData"),c(_)}}const Xd={name:"labelEnd",resolveAll:LA,resolveTo:zA,tokenize:UA},RA={tokenize:BA},MA={tokenize:PA},DA={tokenize:qA};function LA(e){let n=-1;const r=[];for(;++n<e.length;){const s=e[n][1];if(r.push(e[n]),s.type==="labelImage"||s.type==="labelLink"||s.type==="labelEnd"){const l=s.type==="labelImage"?4:2;s.type="data",n+=l}}return e.length!==r.length&&$n(e,0,e.length,r),e}function zA(e,n){let r=e.length,s=0,l,u,c,f;for(;r--;)if(l=e[r][1],u){if(l.type==="link"||l.type==="labelLink"&&l._inactive)break;e[r][0]==="enter"&&l.type==="labelLink"&&(l._inactive=!0)}else if(c){if(e[r][0]==="enter"&&(l.type==="labelImage"||l.type==="labelLink")&&!l._balanced&&(u=r,l.type!=="labelLink")){s=2;break}}else l.type==="labelEnd"&&(c=r);const m={type:e[u][1].type==="labelLink"?"link":"image",start:{...e[u][1].start},end:{...e[e.length-1][1].end}},d={type:"label",start:{...e[u][1].start},end:{...e[c][1].end}},y={type:"labelText",start:{...e[u+s+2][1].end},end:{...e[c-2][1].start}};return f=[["enter",m,n],["enter",d,n]],f=sr(f,e.slice(u+1,u+s+3)),f=sr(f,[["enter",y,n]]),f=sr(f,Ku(n.parser.constructs.insideSpan.null,e.slice(u+s+4,c-3),n)),f=sr(f,[["exit",y,n],e[c-2],e[c-1],["exit",d,n]]),f=sr(f,e.slice(c+1)),f=sr(f,[["exit",m,n]]),$n(e,u,e.length,f),e}function UA(e,n,r){const s=this;let l=s.events.length,u,c;for(;l--;)if((s.events[l][1].type==="labelImage"||s.events[l][1].type==="labelLink")&&!s.events[l][1]._balanced){u=s.events[l][1];break}return f;function f(x){return u?u._inactive?g(x):(c=s.parser.defined.includes(gr(s.sliceSerialize({start:u.end,end:s.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(x),e.exit("labelMarker"),e.exit("labelEnd"),m):r(x)}function m(x){return x===40?e.attempt(RA,y,c?y:g)(x):x===91?e.attempt(MA,y,c?d:g)(x):c?y(x):g(x)}function d(x){return e.attempt(DA,y,g)(x)}function y(x){return n(x)}function g(x){return u._balanced=!0,r(x)}}function BA(e,n,r){return s;function s(g){return e.enter("resource"),e.enter("resourceMarker"),e.consume(g),e.exit("resourceMarker"),l}function l(g){return Tt(g)?Rl(e,u)(g):u(g)}function u(g){return g===41?y(g):t1(e,c,f,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(g)}function c(g){return Tt(g)?Rl(e,m)(g):y(g)}function f(g){return r(g)}function m(g){return g===34||g===39||g===40?r1(e,d,r,"resourceTitle","resourceTitleMarker","resourceTitleString")(g):y(g)}function d(g){return Tt(g)?Rl(e,y)(g):y(g)}function y(g){return g===41?(e.enter("resourceMarker"),e.consume(g),e.exit("resourceMarker"),e.exit("resource"),n):r(g)}}function PA(e,n,r){const s=this;return l;function l(f){return n1.call(s,e,u,c,"reference","referenceMarker","referenceString")(f)}function u(f){return s.parser.defined.includes(gr(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)))?n(f):r(f)}function c(f){return r(f)}}function qA(e,n,r){return s;function s(u){return e.enter("reference"),e.enter("referenceMarker"),e.consume(u),e.exit("referenceMarker"),l}function l(u){return u===93?(e.enter("referenceMarker"),e.consume(u),e.exit("referenceMarker"),e.exit("reference"),n):r(u)}}const HA={name:"labelStartImage",resolveAll:Xd.resolveAll,tokenize:IA};function IA(e,n,r){const s=this;return l;function l(f){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(f),e.exit("labelImageMarker"),u}function u(f){return f===91?(e.enter("labelMarker"),e.consume(f),e.exit("labelMarker"),e.exit("labelImage"),c):r(f)}function c(f){return f===94&&"_hiddenFootnoteSupport"in s.parser.constructs?r(f):n(f)}}const FA={name:"labelStartLink",resolveAll:Xd.resolveAll,tokenize:$A};function $A(e,n,r){const s=this;return l;function l(c){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(c),e.exit("labelMarker"),e.exit("labelLink"),u}function u(c){return c===94&&"_hiddenFootnoteSupport"in s.parser.constructs?r(c):n(c)}}const zh={name:"lineEnding",tokenize:YA};function YA(e,n){return r;function r(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),lt(e,n,"linePrefix")}}const Eu={name:"thematicBreak",tokenize:GA};function GA(e,n,r){let s=0,l;return u;function u(d){return e.enter("thematicBreak"),c(d)}function c(d){return l=d,f(d)}function f(d){return d===l?(e.enter("thematicBreakSequence"),m(d)):s>=3&&(d===null||Be(d))?(e.exit("thematicBreak"),n(d)):r(d)}function m(d){return d===l?(e.consume(d),s++,m):(e.exit("thematicBreakSequence"),We(d)?lt(e,f,"whitespace")(d):f(d))}}const Cn={continuation:{tokenize:KA},exit:ZA,name:"list",tokenize:XA},VA={partial:!0,tokenize:WA},JA={partial:!0,tokenize:QA};function XA(e,n,r){const s=this,l=s.events[s.events.length-1];let u=l&&l[1].type==="linePrefix"?l[2].sliceSerialize(l[1],!0).length:0,c=0;return f;function f(w){const S=s.containerState.type||(w===42||w===43||w===45?"listUnordered":"listOrdered");if(S==="listUnordered"?!s.containerState.marker||w===s.containerState.marker:yd(w)){if(s.containerState.type||(s.containerState.type=S,e.enter(S,{_container:!0})),S==="listUnordered")return e.enter("listItemPrefix"),w===42||w===45?e.check(Eu,r,d)(w):d(w);if(!s.interrupt||w===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),m(w)}return r(w)}function m(w){return yd(w)&&++c<10?(e.consume(w),m):(!s.interrupt||c<2)&&(s.containerState.marker?w===s.containerState.marker:w===41||w===46)?(e.exit("listItemValue"),d(w)):r(w)}function d(w){return e.enter("listItemMarker"),e.consume(w),e.exit("listItemMarker"),s.containerState.marker=s.containerState.marker||w,e.check(Vl,s.interrupt?r:y,e.attempt(VA,x,g))}function y(w){return s.containerState.initialBlankLine=!0,u++,x(w)}function g(w){return We(w)?(e.enter("listItemPrefixWhitespace"),e.consume(w),e.exit("listItemPrefixWhitespace"),x):r(w)}function x(w){return s.containerState.size=u+s.sliceSerialize(e.exit("listItemPrefix"),!0).length,n(w)}}function KA(e,n,r){const s=this;return s.containerState._closeFlow=void 0,e.check(Vl,l,u);function l(f){return s.containerState.furtherBlankLines=s.containerState.furtherBlankLines||s.containerState.initialBlankLine,lt(e,n,"listItemIndent",s.containerState.size+1)(f)}function u(f){return s.containerState.furtherBlankLines||!We(f)?(s.containerState.furtherBlankLines=void 0,s.containerState.initialBlankLine=void 0,c(f)):(s.containerState.furtherBlankLines=void 0,s.containerState.initialBlankLine=void 0,e.attempt(JA,n,c)(f))}function c(f){return s.containerState._closeFlow=!0,s.interrupt=void 0,lt(e,e.attempt(Cn,n,r),"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(f)}}function QA(e,n,r){const s=this;return lt(e,l,"listItemIndent",s.containerState.size+1);function l(u){const c=s.events[s.events.length-1];return c&&c[1].type==="listItemIndent"&&c[2].sliceSerialize(c[1],!0).length===s.containerState.size?n(u):r(u)}}function ZA(e){e.exit(this.containerState.type)}function WA(e,n,r){const s=this;return lt(e,l,"listItemPrefixWhitespace",s.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function l(u){const c=s.events[s.events.length-1];return!We(u)&&c&&c[1].type==="listItemPrefixWhitespace"?n(u):r(u)}}const ob={name:"setextUnderline",resolveTo:eT,tokenize:tT};function eT(e,n){let r=e.length,s,l,u;for(;r--;)if(e[r][0]==="enter"){if(e[r][1].type==="content"){s=r;break}e[r][1].type==="paragraph"&&(l=r)}else e[r][1].type==="content"&&e.splice(r,1),!u&&e[r][1].type==="definition"&&(u=r);const c={type:"setextHeading",start:{...e[s][1].start},end:{...e[e.length-1][1].end}};return e[l][1].type="setextHeadingText",u?(e.splice(l,0,["enter",c,n]),e.splice(u+1,0,["exit",e[s][1],n]),e[s][1].end={...e[u][1].end}):e[s][1]=c,e.push(["exit",c,n]),e}function tT(e,n,r){const s=this;let l;return u;function u(d){let y=s.events.length,g;for(;y--;)if(s.events[y][1].type!=="lineEnding"&&s.events[y][1].type!=="linePrefix"&&s.events[y][1].type!=="content"){g=s.events[y][1].type==="paragraph";break}return!s.parser.lazy[s.now().line]&&(s.interrupt||g)?(e.enter("setextHeadingLine"),l=d,c(d)):r(d)}function c(d){return e.enter("setextHeadingLineSequence"),f(d)}function f(d){return d===l?(e.consume(d),f):(e.exit("setextHeadingLineSequence"),We(d)?lt(e,m,"lineSuffix")(d):m(d))}function m(d){return d===null||Be(d)?(e.exit("setextHeadingLine"),n(d)):r(d)}}const nT={tokenize:rT};function rT(e){const n=this,r=e.attempt(Vl,s,e.attempt(this.parser.constructs.flowInitial,l,lt(e,e.attempt(this.parser.constructs.flow,l,e.attempt(oA,l)),"linePrefix")));return r;function s(u){if(u===null){e.consume(u);return}return e.enter("lineEndingBlank"),e.consume(u),e.exit("lineEndingBlank"),n.currentConstruct=void 0,r}function l(u){if(u===null){e.consume(u);return}return e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),n.currentConstruct=void 0,r}}const iT={resolveAll:s1()},sT=i1("string"),aT=i1("text");function i1(e){return{resolveAll:s1(e==="text"?lT:void 0),tokenize:n};function n(r){const s=this,l=this.parser.constructs[e],u=r.attempt(l,c,f);return c;function c(y){return d(y)?u(y):f(y)}function f(y){if(y===null){r.consume(y);return}return r.enter("data"),r.consume(y),m}function m(y){return d(y)?(r.exit("data"),u(y)):(r.consume(y),m)}function d(y){if(y===null)return!0;const g=l[y];let x=-1;if(g)for(;++x<g.length;){const w=g[x];if(!w.previous||w.previous.call(s,s.previous))return!0}return!1}}}function s1(e){return n;function n(r,s){let l=-1,u;for(;++l<=r.length;)u===void 0?r[l]&&r[l][1].type==="data"&&(u=l,l++):(!r[l]||r[l][1].type!=="data")&&(l!==u+2&&(r[u][1].end=r[l-1][1].end,r.splice(u+2,l-u-2),l=u+2),u=void 0);return e?e(r,s):r}}function lT(e,n){let r=0;for(;++r<=e.length;)if((r===e.length||e[r][1].type==="lineEnding")&&e[r-1][1].type==="data"){const s=e[r-1][1],l=n.sliceStream(s);let u=l.length,c=-1,f=0,m;for(;u--;){const d=l[u];if(typeof d=="string"){for(c=d.length;d.charCodeAt(c-1)===32;)f++,c--;if(c)break;c=-1}else if(d===-2)m=!0,f++;else if(d!==-1){u++;break}}if(n._contentTypeTextTrailing&&r===e.length&&(f=0),f){const d={type:r===e.length||m||f<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:u?c:s.start._bufferIndex+c,_index:s.start._index+u,line:s.end.line,column:s.end.column-f,offset:s.end.offset-f},end:{...s.end}};s.end={...d.start},s.start.offset===s.end.offset?Object.assign(s,d):(e.splice(r,0,["enter",d,n],["exit",d,n]),r+=2)}r++}return e}const oT={42:Cn,43:Cn,45:Cn,48:Cn,49:Cn,50:Cn,51:Cn,52:Cn,53:Cn,54:Cn,55:Cn,56:Cn,57:Cn,62:Qx},uT={91:dA},cT={[-2]:Lh,[-1]:Lh,32:Lh},fT={35:xA,42:Eu,45:[ob,Eu],60:_A,61:ob,95:Eu,96:ab,126:ab},hT={38:Wx,92:Zx},dT={[-5]:zh,[-4]:zh,[-3]:zh,33:HA,38:Wx,42:bd,60:[FC,NA],91:FA,92:[yA,Zx],93:Xd,95:bd,96:nA},mT={null:[bd,iT]},pT={null:[42,95]},gT={null:[]},yT=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:pT,contentInitial:uT,disable:gT,document:oT,flow:fT,flowInitial:cT,insideSpan:mT,string:hT,text:dT},Symbol.toStringTag,{value:"Module"}));function bT(e,n,r){let s={_bufferIndex:-1,_index:0,line:r&&r.line||1,column:r&&r.column||1,offset:r&&r.offset||0};const l={},u=[];let c=[],f=[];const m={attempt:K(B),check:K(z),consume:$,enter:T,exit:te,interrupt:K(z,{interrupt:!0})},d={code:null,containerState:{},defineSkip:D,events:[],now:S,parser:e,previous:null,sliceSerialize:x,sliceStream:w,write:g};let y=n.tokenize.call(d,m);return n.resolveAll&&u.push(n),d;function g(X){return c=sr(c,X),q(),c[c.length-1]!==null?[]:(Q(n,0),d.events=Ku(u,d.events,d),d.events)}function x(X,J){return vT(w(X),J)}function w(X){return xT(c,X)}function S(){const{_bufferIndex:X,_index:J,line:ae,column:re,offset:F}=s;return{_bufferIndex:X,_index:J,line:ae,column:re,offset:F}}function D(X){l[X.line]=X.column,R()}function q(){let X;for(;s._index<c.length;){const J=c[s._index];if(typeof J=="string")for(X=s._index,s._bufferIndex<0&&(s._bufferIndex=0);s._index===X&&s._bufferIndex<J.length;)L(J.charCodeAt(s._bufferIndex));else L(J)}}function L(X){y=y(X)}function $(X){Be(X)?(s.line++,s.column=1,s.offset+=X===-3?2:1,R()):X!==-1&&(s.column++,s.offset++),s._bufferIndex<0?s._index++:(s._bufferIndex++,s._bufferIndex===c[s._index].length&&(s._bufferIndex=-1,s._index++)),d.previous=X}function T(X,J){const ae=J||{};return ae.type=X,ae.start=S(),d.events.push(["enter",ae,d]),f.push(ae),ae}function te(X){const J=f.pop();return J.end=S(),d.events.push(["exit",J,d]),J}function B(X,J){Q(X,J.from)}function z(X,J){J.restore()}function K(X,J){return ae;function ae(re,F,P){let V,ue,xe,_;return Array.isArray(re)?W(re):"tokenize"in re?W([re]):M(re);function M(je){return ze;function ze(qe){const Te=qe!==null&&je[qe],Ae=qe!==null&&je.null,Je=[...Array.isArray(Te)?Te:Te?[Te]:[],...Array.isArray(Ae)?Ae:Ae?[Ae]:[]];return W(Je)(qe)}}function W(je){return V=je,ue=0,je.length===0?P:A(je[ue])}function A(je){return ze;function ze(qe){return _=H(),xe=je,je.partial||(d.currentConstruct=je),je.name&&d.parser.constructs.disable.null.includes(je.name)?Ce():je.tokenize.call(J?Object.assign(Object.create(d),J):d,m,ve,Ce)(qe)}}function ve(je){return X(xe,_),F}function Ce(je){return _.restore(),++ue<V.length?A(V[ue]):P}}}function Q(X,J){X.resolveAll&&!u.includes(X)&&u.push(X),X.resolve&&$n(d.events,J,d.events.length-J,X.resolve(d.events.slice(J),d)),X.resolveTo&&(d.events=X.resolveTo(d.events,d))}function H(){const X=S(),J=d.previous,ae=d.currentConstruct,re=d.events.length,F=Array.from(f);return{from:re,restore:P};function P(){s=X,d.previous=J,d.currentConstruct=ae,d.events.length=re,f=F,R()}}function R(){s.line in l&&s.column<2&&(s.column=l[s.line],s.offset+=l[s.line]-1)}}function xT(e,n){const r=n.start._index,s=n.start._bufferIndex,l=n.end._index,u=n.end._bufferIndex;let c;if(r===l)c=[e[r].slice(s,u)];else{if(c=e.slice(r,l),s>-1){const f=c[0];typeof f=="string"?c[0]=f.slice(s):c.shift()}u>0&&c.push(e[l].slice(0,u))}return c}function vT(e,n){let r=-1;const s=[];let l;for(;++r<e.length;){const u=e[r];let c;if(typeof u=="string")c=u;else switch(u){case-5:{c="\r";break}case-4:{c=`
94
+ `;break}case-3:{c=`\r
95
+ `;break}case-2:{c=n?" ":" ";break}case-1:{if(!n&&l)continue;c=" ";break}default:c=String.fromCharCode(u)}l=u===-2,s.push(c)}return s.join("")}function wT(e){const s={constructs:Xx([yT,...(e||{}).extensions||[]]),content:l(zC),defined:[],document:l(BC),flow:l(nT),lazy:{},string:l(sT),text:l(aT)};return s;function l(u){return c;function c(f){return bT(s,u,f)}}}function ST(e){for(;!e1(e););return e}const ub=/[\0\t\n\r]/g;function _T(){let e=1,n="",r=!0,s;return l;function l(u,c,f){const m=[];let d,y,g,x,w;for(u=n+(typeof u=="string"?u.toString():new TextDecoder(c||void 0).decode(u)),g=0,n="",r&&(u.charCodeAt(0)===65279&&g++,r=void 0);g<u.length;){if(ub.lastIndex=g,d=ub.exec(u),x=d&&d.index!==void 0?d.index:u.length,w=u.charCodeAt(x),!d){n=u.slice(g);break}if(w===10&&g===x&&s)m.push(-3),s=void 0;else switch(s&&(m.push(-5),s=void 0),g<x&&(m.push(u.slice(g,x)),e+=x-g),w){case 0:{m.push(65533),e++;break}case 9:{for(y=Math.ceil(e/4)*4,m.push(-2);e++<y;)m.push(-1);break}case 10:{m.push(-4),e=1;break}default:s=!0,e=1}g=x+1}return f&&(s&&m.push(-5),n&&m.push(n),m.push(null)),m}}const ET=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function kT(e){return e.replace(ET,CT)}function CT(e,n,r){if(n)return n;if(r.charCodeAt(0)===35){const l=r.charCodeAt(1),u=l===120||l===88;return Kx(r.slice(u?2:1),u?16:10)}return Jd(r)||e}const a1={}.hasOwnProperty;function AT(e,n,r){return n&&typeof n=="object"&&(r=n,n=void 0),TT(r)(ST(wT(r).document().write(_T()(e,n,!0))))}function TT(e){const n={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:u(mt),autolinkProtocol:H,autolinkEmail:H,atxHeading:u(ot),blockQuote:u(Ae),characterEscape:H,characterReference:H,codeFenced:u(Je),codeFencedFenceInfo:c,codeFencedFenceMeta:c,codeIndented:u(Je,c),codeText:u(rt,c),codeTextData:H,data:H,codeFlowValue:H,definition:u(kt),definitionDestinationString:c,definitionLabelString:c,definitionTitleString:c,emphasis:u(Ke),hardBreakEscape:u(Fe),hardBreakTrailing:u(Fe),htmlFlow:u(He,c),htmlFlowData:H,htmlText:u(He,c),htmlTextData:H,image:u(et),label:c,link:u(mt),listItem:u(Pt),listItemValue:x,listOrdered:u(it,g),listUnordered:u(it),paragraph:u(Nt),reference:A,referenceString:c,resourceDestinationString:c,resourceTitleString:c,setextHeading:u(ot),strong:u(Tn),thematicBreak:u(jn)},exit:{atxHeading:m(),atxHeadingSequence:B,autolink:m(),autolinkEmail:Te,autolinkProtocol:qe,blockQuote:m(),characterEscapeValue:R,characterReferenceMarkerHexadecimal:Ce,characterReferenceMarkerNumeric:Ce,characterReferenceValue:je,characterReference:ze,codeFenced:m(q),codeFencedFence:D,codeFencedFenceInfo:w,codeFencedFenceMeta:S,codeFlowValue:R,codeIndented:m(L),codeText:m(F),codeTextData:R,data:R,definition:m(),definitionDestinationString:te,definitionLabelString:$,definitionTitleString:T,emphasis:m(),hardBreakEscape:m(J),hardBreakTrailing:m(J),htmlFlow:m(ae),htmlFlowData:R,htmlText:m(re),htmlTextData:R,image:m(V),label:xe,labelText:ue,lineEnding:X,link:m(P),listItem:m(),listOrdered:m(),listUnordered:m(),paragraph:m(),referenceString:ve,resourceDestinationString:_,resourceTitleString:M,resource:W,setextHeading:m(Q),setextHeadingLineSequence:K,setextHeadingText:z,strong:m(),thematicBreak:m()}};l1(n,(e||{}).mdastExtensions||[]);const r={};return s;function s(fe){let we={type:"root",children:[]};const Ue={stack:[we],tokenStack:[],config:n,enter:f,exit:d,buffer:c,resume:y,data:r},$e=[];let at=-1;for(;++at<fe.length;)if(fe[at][1].type==="listOrdered"||fe[at][1].type==="listUnordered")if(fe[at][0]==="enter")$e.push(at);else{const rn=$e.pop();at=l(fe,rn,at)}for(at=-1;++at<fe.length;){const rn=n[fe[at][0]];a1.call(rn,fe[at][1].type)&&rn[fe[at][1].type].call(Object.assign({sliceSerialize:fe[at][2].sliceSerialize},Ue),fe[at][1])}if(Ue.tokenStack.length>0){const rn=Ue.tokenStack[Ue.tokenStack.length-1];(rn[1]||cb).call(Ue,void 0,rn[0])}for(we.position={start:Ri(fe.length>0?fe[0][1].start:{line:1,column:1,offset:0}),end:Ri(fe.length>0?fe[fe.length-2][1].end:{line:1,column:1,offset:0})},at=-1;++at<n.transforms.length;)we=n.transforms[at](we)||we;return we}function l(fe,we,Ue){let $e=we-1,at=-1,rn=!1,xn,Gt,ge,Le;for(;++$e<=Ue;){const Se=fe[$e];switch(Se[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Se[0]==="enter"?at++:at--,Le=void 0;break}case"lineEndingBlank":{Se[0]==="enter"&&(xn&&!Le&&!at&&!ge&&(ge=$e),Le=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Le=void 0}if(!at&&Se[0]==="enter"&&Se[1].type==="listItemPrefix"||at===-1&&Se[0]==="exit"&&(Se[1].type==="listUnordered"||Se[1].type==="listOrdered")){if(xn){let ht=$e;for(Gt=void 0;ht--;){const pt=fe[ht];if(pt[1].type==="lineEnding"||pt[1].type==="lineEndingBlank"){if(pt[0]==="exit")continue;Gt&&(fe[Gt][1].type="lineEndingBlank",rn=!0),pt[1].type="lineEnding",Gt=ht}else if(!(pt[1].type==="linePrefix"||pt[1].type==="blockQuotePrefix"||pt[1].type==="blockQuotePrefixWhitespace"||pt[1].type==="blockQuoteMarker"||pt[1].type==="listItemIndent"))break}ge&&(!Gt||ge<Gt)&&(xn._spread=!0),xn.end=Object.assign({},Gt?fe[Gt][1].start:Se[1].end),fe.splice(Gt||$e,0,["exit",xn,Se[2]]),$e++,Ue++}if(Se[1].type==="listItemPrefix"){const ht={type:"listItem",_spread:!1,start:Object.assign({},Se[1].start),end:void 0};xn=ht,fe.splice($e,0,["enter",ht,Se[2]]),$e++,Ue++,ge=void 0,Le=!0}}}return fe[we][1]._spread=rn,Ue}function u(fe,we){return Ue;function Ue($e){f.call(this,fe($e),$e),we&&we.call(this,$e)}}function c(){this.stack.push({type:"fragment",children:[]})}function f(fe,we,Ue){this.stack[this.stack.length-1].children.push(fe),this.stack.push(fe),this.tokenStack.push([we,Ue||void 0]),fe.position={start:Ri(we.start),end:void 0}}function m(fe){return we;function we(Ue){fe&&fe.call(this,Ue),d.call(this,Ue)}}function d(fe,we){const Ue=this.stack.pop(),$e=this.tokenStack.pop();if($e)$e[0].type!==fe.type&&(we?we.call(this,fe,$e[0]):($e[1]||cb).call(this,fe,$e[0]));else throw new Error("Cannot close `"+fe.type+"` ("+Ol({start:fe.start,end:fe.end})+"): it’s not open");Ue.position.end=Ri(fe.end)}function y(){return Vd(this.stack.pop())}function g(){this.data.expectingFirstListItemValue=!0}function x(fe){if(this.data.expectingFirstListItemValue){const we=this.stack[this.stack.length-2];we.start=Number.parseInt(this.sliceSerialize(fe),10),this.data.expectingFirstListItemValue=void 0}}function w(){const fe=this.resume(),we=this.stack[this.stack.length-1];we.lang=fe}function S(){const fe=this.resume(),we=this.stack[this.stack.length-1];we.meta=fe}function D(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function q(){const fe=this.resume(),we=this.stack[this.stack.length-1];we.value=fe.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function L(){const fe=this.resume(),we=this.stack[this.stack.length-1];we.value=fe.replace(/(\r?\n|\r)$/g,"")}function $(fe){const we=this.resume(),Ue=this.stack[this.stack.length-1];Ue.label=we,Ue.identifier=gr(this.sliceSerialize(fe)).toLowerCase()}function T(){const fe=this.resume(),we=this.stack[this.stack.length-1];we.title=fe}function te(){const fe=this.resume(),we=this.stack[this.stack.length-1];we.url=fe}function B(fe){const we=this.stack[this.stack.length-1];if(!we.depth){const Ue=this.sliceSerialize(fe).length;we.depth=Ue}}function z(){this.data.setextHeadingSlurpLineEnding=!0}function K(fe){const we=this.stack[this.stack.length-1];we.depth=this.sliceSerialize(fe).codePointAt(0)===61?1:2}function Q(){this.data.setextHeadingSlurpLineEnding=void 0}function H(fe){const Ue=this.stack[this.stack.length-1].children;let $e=Ue[Ue.length-1];(!$e||$e.type!=="text")&&($e=xt(),$e.position={start:Ri(fe.start),end:void 0},Ue.push($e)),this.stack.push($e)}function R(fe){const we=this.stack.pop();we.value+=this.sliceSerialize(fe),we.position.end=Ri(fe.end)}function X(fe){const we=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Ue=we.children[we.children.length-1];Ue.position.end=Ri(fe.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&n.canContainEols.includes(we.type)&&(H.call(this,fe),R.call(this,fe))}function J(){this.data.atHardBreak=!0}function ae(){const fe=this.resume(),we=this.stack[this.stack.length-1];we.value=fe}function re(){const fe=this.resume(),we=this.stack[this.stack.length-1];we.value=fe}function F(){const fe=this.resume(),we=this.stack[this.stack.length-1];we.value=fe}function P(){const fe=this.stack[this.stack.length-1];if(this.data.inReference){const we=this.data.referenceType||"shortcut";fe.type+="Reference",fe.referenceType=we,delete fe.url,delete fe.title}else delete fe.identifier,delete fe.label;this.data.referenceType=void 0}function V(){const fe=this.stack[this.stack.length-1];if(this.data.inReference){const we=this.data.referenceType||"shortcut";fe.type+="Reference",fe.referenceType=we,delete fe.url,delete fe.title}else delete fe.identifier,delete fe.label;this.data.referenceType=void 0}function ue(fe){const we=this.sliceSerialize(fe),Ue=this.stack[this.stack.length-2];Ue.label=kT(we),Ue.identifier=gr(we).toLowerCase()}function xe(){const fe=this.stack[this.stack.length-1],we=this.resume(),Ue=this.stack[this.stack.length-1];if(this.data.inReference=!0,Ue.type==="link"){const $e=fe.children;Ue.children=$e}else Ue.alt=we}function _(){const fe=this.resume(),we=this.stack[this.stack.length-1];we.url=fe}function M(){const fe=this.resume(),we=this.stack[this.stack.length-1];we.title=fe}function W(){this.data.inReference=void 0}function A(){this.data.referenceType="collapsed"}function ve(fe){const we=this.resume(),Ue=this.stack[this.stack.length-1];Ue.label=we,Ue.identifier=gr(this.sliceSerialize(fe)).toLowerCase(),this.data.referenceType="full"}function Ce(fe){this.data.characterReferenceType=fe.type}function je(fe){const we=this.sliceSerialize(fe),Ue=this.data.characterReferenceType;let $e;Ue?($e=Kx(we,Ue==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):$e=Jd(we);const at=this.stack[this.stack.length-1];at.value+=$e}function ze(fe){const we=this.stack.pop();we.position.end=Ri(fe.end)}function qe(fe){R.call(this,fe);const we=this.stack[this.stack.length-1];we.url=this.sliceSerialize(fe)}function Te(fe){R.call(this,fe);const we=this.stack[this.stack.length-1];we.url="mailto:"+this.sliceSerialize(fe)}function Ae(){return{type:"blockquote",children:[]}}function Je(){return{type:"code",lang:null,meta:null,value:""}}function rt(){return{type:"inlineCode",value:""}}function kt(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Ke(){return{type:"emphasis",children:[]}}function ot(){return{type:"heading",depth:0,children:[]}}function Fe(){return{type:"break"}}function He(){return{type:"html",value:""}}function et(){return{type:"image",title:null,url:"",alt:null}}function mt(){return{type:"link",title:null,url:"",children:[]}}function it(fe){return{type:"list",ordered:fe.type==="listOrdered",start:null,spread:fe._spread,children:[]}}function Pt(fe){return{type:"listItem",spread:fe._spread,checked:null,children:[]}}function Nt(){return{type:"paragraph",children:[]}}function Tn(){return{type:"strong",children:[]}}function xt(){return{type:"text",value:""}}function jn(){return{type:"thematicBreak"}}}function Ri(e){return{line:e.line,column:e.column,offset:e.offset}}function l1(e,n){let r=-1;for(;++r<n.length;){const s=n[r];Array.isArray(s)?l1(e,s):jT(e,s)}}function jT(e,n){let r;for(r in n)if(a1.call(n,r))switch(r){case"canContainEols":{const s=n[r];s&&e[r].push(...s);break}case"transforms":{const s=n[r];s&&e[r].push(...s);break}case"enter":case"exit":{const s=n[r];s&&Object.assign(e[r],s);break}}}function cb(e,n){throw e?new Error("Cannot close `"+e.type+"` ("+Ol({start:e.start,end:e.end})+"): a different token (`"+n.type+"`, "+Ol({start:n.start,end:n.end})+") is open"):new Error("Cannot close document, a token (`"+n.type+"`, "+Ol({start:n.start,end:n.end})+") is still open")}function NT(e){const n=this;n.parser=r;function r(s){return AT(s,{...n.data("settings"),...e,extensions:n.data("micromarkExtensions")||[],mdastExtensions:n.data("fromMarkdownExtensions")||[]})}}function OT(e,n){const r={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(n),!0)};return e.patch(n,r),e.applyData(n,r)}function RT(e,n){const r={type:"element",tagName:"br",properties:{},children:[]};return e.patch(n,r),[e.applyData(n,r),{type:"text",value:`
96
+ `}]}function MT(e,n){const r=n.value?n.value+`
97
+ `:"",s={},l=n.lang?n.lang.split(/\s+/):[];l.length>0&&(s.className=["language-"+l[0]]);let u={type:"element",tagName:"code",properties:s,children:[{type:"text",value:r}]};return n.meta&&(u.data={meta:n.meta}),e.patch(n,u),u=e.applyData(n,u),u={type:"element",tagName:"pre",properties:{},children:[u]},e.patch(n,u),u}function DT(e,n){const r={type:"element",tagName:"del",properties:{},children:e.all(n)};return e.patch(n,r),e.applyData(n,r)}function LT(e,n){const r={type:"element",tagName:"em",properties:{},children:e.all(n)};return e.patch(n,r),e.applyData(n,r)}function zT(e,n){const r=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",s=String(n.identifier).toUpperCase(),l=_a(s.toLowerCase()),u=e.footnoteOrder.indexOf(s);let c,f=e.footnoteCounts.get(s);f===void 0?(f=0,e.footnoteOrder.push(s),c=e.footnoteOrder.length):c=u+1,f+=1,e.footnoteCounts.set(s,f);const m={type:"element",tagName:"a",properties:{href:"#"+r+"fn-"+l,id:r+"fnref-"+l+(f>1?"-"+f:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(c)}]};e.patch(n,m);const d={type:"element",tagName:"sup",properties:{},children:[m]};return e.patch(n,d),e.applyData(n,d)}function UT(e,n){const r={type:"element",tagName:"h"+n.depth,properties:{},children:e.all(n)};return e.patch(n,r),e.applyData(n,r)}function BT(e,n){if(e.options.allowDangerousHtml){const r={type:"raw",value:n.value};return e.patch(n,r),e.applyData(n,r)}}function o1(e,n){const r=n.referenceType;let s="]";if(r==="collapsed"?s+="[]":r==="full"&&(s+="["+(n.label||n.identifier)+"]"),n.type==="imageReference")return[{type:"text",value:"!["+n.alt+s}];const l=e.all(n),u=l[0];u&&u.type==="text"?u.value="["+u.value:l.unshift({type:"text",value:"["});const c=l[l.length-1];return c&&c.type==="text"?c.value+=s:l.push({type:"text",value:s}),l}function PT(e,n){const r=String(n.identifier).toUpperCase(),s=e.definitionById.get(r);if(!s)return o1(e,n);const l={src:_a(s.url||""),alt:n.alt};s.title!==null&&s.title!==void 0&&(l.title=s.title);const u={type:"element",tagName:"img",properties:l,children:[]};return e.patch(n,u),e.applyData(n,u)}function qT(e,n){const r={src:_a(n.url)};n.alt!==null&&n.alt!==void 0&&(r.alt=n.alt),n.title!==null&&n.title!==void 0&&(r.title=n.title);const s={type:"element",tagName:"img",properties:r,children:[]};return e.patch(n,s),e.applyData(n,s)}function HT(e,n){const r={type:"text",value:n.value.replace(/\r?\n|\r/g," ")};e.patch(n,r);const s={type:"element",tagName:"code",properties:{},children:[r]};return e.patch(n,s),e.applyData(n,s)}function IT(e,n){const r=String(n.identifier).toUpperCase(),s=e.definitionById.get(r);if(!s)return o1(e,n);const l={href:_a(s.url||"")};s.title!==null&&s.title!==void 0&&(l.title=s.title);const u={type:"element",tagName:"a",properties:l,children:e.all(n)};return e.patch(n,u),e.applyData(n,u)}function FT(e,n){const r={href:_a(n.url)};n.title!==null&&n.title!==void 0&&(r.title=n.title);const s={type:"element",tagName:"a",properties:r,children:e.all(n)};return e.patch(n,s),e.applyData(n,s)}function $T(e,n,r){const s=e.all(n),l=r?YT(r):u1(n),u={},c=[];if(typeof n.checked=="boolean"){const y=s[0];let g;y&&y.type==="element"&&y.tagName==="p"?g=y:(g={type:"element",tagName:"p",properties:{},children:[]},s.unshift(g)),g.children.length>0&&g.children.unshift({type:"text",value:" "}),g.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:n.checked,disabled:!0},children:[]}),u.className=["task-list-item"]}let f=-1;for(;++f<s.length;){const y=s[f];(l||f!==0||y.type!=="element"||y.tagName!=="p")&&c.push({type:"text",value:`
98
+ `}),y.type==="element"&&y.tagName==="p"&&!l?c.push(...y.children):c.push(y)}const m=s[s.length-1];m&&(l||m.type!=="element"||m.tagName!=="p")&&c.push({type:"text",value:`
99
+ `});const d={type:"element",tagName:"li",properties:u,children:c};return e.patch(n,d),e.applyData(n,d)}function YT(e){let n=!1;if(e.type==="list"){n=e.spread||!1;const r=e.children;let s=-1;for(;!n&&++s<r.length;)n=u1(r[s])}return n}function u1(e){const n=e.spread;return n??e.children.length>1}function GT(e,n){const r={},s=e.all(n);let l=-1;for(typeof n.start=="number"&&n.start!==1&&(r.start=n.start);++l<s.length;){const c=s[l];if(c.type==="element"&&c.tagName==="li"&&c.properties&&Array.isArray(c.properties.className)&&c.properties.className.includes("task-list-item")){r.className=["contains-task-list"];break}}const u={type:"element",tagName:n.ordered?"ol":"ul",properties:r,children:e.wrap(s,!0)};return e.patch(n,u),e.applyData(n,u)}function VT(e,n){const r={type:"element",tagName:"p",properties:{},children:e.all(n)};return e.patch(n,r),e.applyData(n,r)}function JT(e,n){const r={type:"root",children:e.wrap(e.all(n))};return e.patch(n,r),e.applyData(n,r)}function XT(e,n){const r={type:"element",tagName:"strong",properties:{},children:e.all(n)};return e.patch(n,r),e.applyData(n,r)}function KT(e,n){const r=e.all(n),s=r.shift(),l=[];if(s){const c={type:"element",tagName:"thead",properties:{},children:e.wrap([s],!0)};e.patch(n.children[0],c),l.push(c)}if(r.length>0){const c={type:"element",tagName:"tbody",properties:{},children:e.wrap(r,!0)},f=Fd(n.children[1]),m=Ix(n.children[n.children.length-1]);f&&m&&(c.position={start:f,end:m}),l.push(c)}const u={type:"element",tagName:"table",properties:{},children:e.wrap(l,!0)};return e.patch(n,u),e.applyData(n,u)}function QT(e,n,r){const s=r?r.children:void 0,u=(s?s.indexOf(n):1)===0?"th":"td",c=r&&r.type==="table"?r.align:void 0,f=c?c.length:n.children.length;let m=-1;const d=[];for(;++m<f;){const g=n.children[m],x={},w=c?c[m]:void 0;w&&(x.align=w);let S={type:"element",tagName:u,properties:x,children:[]};g&&(S.children=e.all(g),e.patch(g,S),S=e.applyData(g,S)),d.push(S)}const y={type:"element",tagName:"tr",properties:{},children:e.wrap(d,!0)};return e.patch(n,y),e.applyData(n,y)}function ZT(e,n){const r={type:"element",tagName:"td",properties:{},children:e.all(n)};return e.patch(n,r),e.applyData(n,r)}const fb=9,hb=32;function WT(e){const n=String(e),r=/\r?\n|\r/g;let s=r.exec(n),l=0;const u=[];for(;s;)u.push(db(n.slice(l,s.index),l>0,!0),s[0]),l=s.index+s[0].length,s=r.exec(n);return u.push(db(n.slice(l),l>0,!1)),u.join("")}function db(e,n,r){let s=0,l=e.length;if(n){let u=e.codePointAt(s);for(;u===fb||u===hb;)s++,u=e.codePointAt(s)}if(r){let u=e.codePointAt(l-1);for(;u===fb||u===hb;)l--,u=e.codePointAt(l-1)}return l>s?e.slice(s,l):""}function ej(e,n){const r={type:"text",value:WT(String(n.value))};return e.patch(n,r),e.applyData(n,r)}function tj(e,n){const r={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(n,r),e.applyData(n,r)}const nj={blockquote:OT,break:RT,code:MT,delete:DT,emphasis:LT,footnoteReference:zT,heading:UT,html:BT,imageReference:PT,image:qT,inlineCode:HT,linkReference:IT,link:FT,listItem:$T,list:GT,paragraph:VT,root:JT,strong:XT,table:KT,tableCell:ZT,tableRow:QT,text:ej,thematicBreak:tj,toml:gu,yaml:gu,definition:gu,footnoteDefinition:gu};function gu(){}const c1=-1,Qu=0,Ml=1,Pu=2,Kd=3,Qd=4,Zd=5,Wd=6,f1=7,h1=8,mb=typeof self=="object"?self:globalThis,rj=(e,n)=>{const r=(l,u)=>(e.set(u,l),l),s=l=>{if(e.has(l))return e.get(l);const[u,c]=n[l];switch(u){case Qu:case c1:return r(c,l);case Ml:{const f=r([],l);for(const m of c)f.push(s(m));return f}case Pu:{const f=r({},l);for(const[m,d]of c)f[s(m)]=s(d);return f}case Kd:return r(new Date(c),l);case Qd:{const{source:f,flags:m}=c;return r(new RegExp(f,m),l)}case Zd:{const f=r(new Map,l);for(const[m,d]of c)f.set(s(m),s(d));return f}case Wd:{const f=r(new Set,l);for(const m of c)f.add(s(m));return f}case f1:{const{name:f,message:m}=c;return r(new mb[f](m),l)}case h1:return r(BigInt(c),l);case"BigInt":return r(Object(BigInt(c)),l);case"ArrayBuffer":return r(new Uint8Array(c).buffer,c);case"DataView":{const{buffer:f}=new Uint8Array(c);return r(new DataView(f),c)}}return r(new mb[u](c),l)};return s},pb=e=>rj(new Map,e)(0),Ws="",{toString:ij}={},{keys:sj}=Object,Sl=e=>{const n=typeof e;if(n!=="object"||!e)return[Qu,n];const r=ij.call(e).slice(8,-1);switch(r){case"Array":return[Ml,Ws];case"Object":return[Pu,Ws];case"Date":return[Kd,Ws];case"RegExp":return[Qd,Ws];case"Map":return[Zd,Ws];case"Set":return[Wd,Ws];case"DataView":return[Ml,r]}return r.includes("Array")?[Ml,r]:r.includes("Error")?[f1,r]:[Pu,r]},yu=([e,n])=>e===Qu&&(n==="function"||n==="symbol"),aj=(e,n,r,s)=>{const l=(c,f)=>{const m=s.push(c)-1;return r.set(f,m),m},u=c=>{if(r.has(c))return r.get(c);let[f,m]=Sl(c);switch(f){case Qu:{let y=c;switch(m){case"bigint":f=h1,y=c.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+m);y=null;break;case"undefined":return l([c1],c)}return l([f,y],c)}case Ml:{if(m){let x=c;return m==="DataView"?x=new Uint8Array(c.buffer):m==="ArrayBuffer"&&(x=new Uint8Array(c)),l([m,[...x]],c)}const y=[],g=l([f,y],c);for(const x of c)y.push(u(x));return g}case Pu:{if(m)switch(m){case"BigInt":return l([m,c.toString()],c);case"Boolean":case"Number":case"String":return l([m,c.valueOf()],c)}if(n&&"toJSON"in c)return u(c.toJSON());const y=[],g=l([f,y],c);for(const x of sj(c))(e||!yu(Sl(c[x])))&&y.push([u(x),u(c[x])]);return g}case Kd:return l([f,c.toISOString()],c);case Qd:{const{source:y,flags:g}=c;return l([f,{source:y,flags:g}],c)}case Zd:{const y=[],g=l([f,y],c);for(const[x,w]of c)(e||!(yu(Sl(x))||yu(Sl(w))))&&y.push([u(x),u(w)]);return g}case Wd:{const y=[],g=l([f,y],c);for(const x of c)(e||!yu(Sl(x)))&&y.push(u(x));return g}}const{message:d}=c;return l([f,{name:m,message:d}],c)};return u},gb=(e,{json:n,lossy:r}={})=>{const s=[];return aj(!(n||r),!!n,new Map,s)(e),s},qu=typeof structuredClone=="function"?(e,n)=>n&&("json"in n||"lossy"in n)?pb(gb(e,n)):structuredClone(e):(e,n)=>pb(gb(e,n));function lj(e,n){const r=[{type:"text",value:"↩"}];return n>1&&r.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(n)}]}),r}function oj(e,n){return"Back to reference "+(e+1)+(n>1?"-"+n:"")}function uj(e){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=e.options.footnoteBackContent||lj,s=e.options.footnoteBackLabel||oj,l=e.options.footnoteLabel||"Footnotes",u=e.options.footnoteLabelTagName||"h2",c=e.options.footnoteLabelProperties||{className:["sr-only"]},f=[];let m=-1;for(;++m<e.footnoteOrder.length;){const d=e.footnoteById.get(e.footnoteOrder[m]);if(!d)continue;const y=e.all(d),g=String(d.identifier).toUpperCase(),x=_a(g.toLowerCase());let w=0;const S=[],D=e.footnoteCounts.get(g);for(;D!==void 0&&++w<=D;){S.length>0&&S.push({type:"text",value:" "});let $=typeof r=="string"?r:r(m,w);typeof $=="string"&&($={type:"text",value:$}),S.push({type:"element",tagName:"a",properties:{href:"#"+n+"fnref-"+x+(w>1?"-"+w:""),dataFootnoteBackref:"",ariaLabel:typeof s=="string"?s:s(m,w),className:["data-footnote-backref"]},children:Array.isArray($)?$:[$]})}const q=y[y.length-1];if(q&&q.type==="element"&&q.tagName==="p"){const $=q.children[q.children.length-1];$&&$.type==="text"?$.value+=" ":q.children.push({type:"text",value:" "}),q.children.push(...S)}else y.push(...S);const L={type:"element",tagName:"li",properties:{id:n+"fn-"+x},children:e.wrap(y,!0)};e.patch(d,L),f.push(L)}if(f.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:u,properties:{...qu(c),id:"footnote-label"},children:[{type:"text",value:l}]},{type:"text",value:`
100
+ `},{type:"element",tagName:"ol",properties:{},children:e.wrap(f,!0)},{type:"text",value:`
101
+ `}]}}const Zu=(function(e){if(e==null)return dj;if(typeof e=="function")return Wu(e);if(typeof e=="object")return Array.isArray(e)?cj(e):fj(e);if(typeof e=="string")return hj(e);throw new Error("Expected function, string, or object as test")});function cj(e){const n=[];let r=-1;for(;++r<e.length;)n[r]=Zu(e[r]);return Wu(s);function s(...l){let u=-1;for(;++u<n.length;)if(n[u].apply(this,l))return!0;return!1}}function fj(e){const n=e;return Wu(r);function r(s){const l=s;let u;for(u in e)if(l[u]!==n[u])return!1;return!0}}function hj(e){return Wu(n);function n(r){return r&&r.type===e}}function Wu(e){return n;function n(r,s,l){return!!(mj(r)&&e.call(this,r,typeof s=="number"?s:void 0,l||void 0))}}function dj(){return!0}function mj(e){return e!==null&&typeof e=="object"&&"type"in e}const d1=[],pj=!0,xd=!1,gj="skip";function m1(e,n,r,s){let l;typeof n=="function"&&typeof r!="function"?(s=r,r=n):l=n;const u=Zu(l),c=s?-1:1;f(e,void 0,[])();function f(m,d,y){const g=m&&typeof m=="object"?m:{};if(typeof g.type=="string"){const w=typeof g.tagName=="string"?g.tagName:typeof g.name=="string"?g.name:void 0;Object.defineProperty(x,"name",{value:"node ("+(m.type+(w?"<"+w+">":""))+")"})}return x;function x(){let w=d1,S,D,q;if((!n||u(m,d,y[y.length-1]||void 0))&&(w=yj(r(m,y)),w[0]===xd))return w;if("children"in m&&m.children){const L=m;if(L.children&&w[0]!==gj)for(D=(s?L.children.length:-1)+c,q=y.concat(L);D>-1&&D<L.children.length;){const $=L.children[D];if(S=f($,D,q)(),S[0]===xd)return S;D=typeof S[1]=="number"?S[1]:D+c}}return w}}}function yj(e){return Array.isArray(e)?e:typeof e=="number"?[pj,e]:e==null?d1:[e]}function em(e,n,r,s){let l,u,c;typeof n=="function"&&typeof r!="function"?(u=void 0,c=n,l=r):(u=n,c=r,l=s),m1(e,u,f,l);function f(m,d){const y=d[d.length-1],g=y?y.children.indexOf(m):void 0;return c(m,g,y)}}const vd={}.hasOwnProperty,bj={};function xj(e,n){const r=n||bj,s=new Map,l=new Map,u=new Map,c={...nj,...r.handlers},f={all:d,applyData:wj,definitionById:s,footnoteById:l,footnoteCounts:u,footnoteOrder:[],handlers:c,one:m,options:r,patch:vj,wrap:_j};return em(e,function(y){if(y.type==="definition"||y.type==="footnoteDefinition"){const g=y.type==="definition"?s:l,x=String(y.identifier).toUpperCase();g.has(x)||g.set(x,y)}}),f;function m(y,g){const x=y.type,w=f.handlers[x];if(vd.call(f.handlers,x)&&w)return w(f,y,g);if(f.options.passThrough&&f.options.passThrough.includes(x)){if("children"in y){const{children:D,...q}=y,L=qu(q);return L.children=f.all(y),L}return qu(y)}return(f.options.unknownHandler||Sj)(f,y,g)}function d(y){const g=[];if("children"in y){const x=y.children;let w=-1;for(;++w<x.length;){const S=f.one(x[w],y);if(S){if(w&&x[w-1].type==="break"&&(!Array.isArray(S)&&S.type==="text"&&(S.value=yb(S.value)),!Array.isArray(S)&&S.type==="element")){const D=S.children[0];D&&D.type==="text"&&(D.value=yb(D.value))}Array.isArray(S)?g.push(...S):g.push(S)}}}return g}}function vj(e,n){e.position&&(n.position=oC(e))}function wj(e,n){let r=n;if(e&&e.data){const s=e.data.hName,l=e.data.hChildren,u=e.data.hProperties;if(typeof s=="string")if(r.type==="element")r.tagName=s;else{const c="children"in r?r.children:[r];r={type:"element",tagName:s,properties:{},children:c}}r.type==="element"&&u&&Object.assign(r.properties,qu(u)),"children"in r&&r.children&&l!==null&&l!==void 0&&(r.children=l)}return r}function Sj(e,n){const r=n.data||{},s="value"in n&&!(vd.call(r,"hProperties")||vd.call(r,"hChildren"))?{type:"text",value:n.value}:{type:"element",tagName:"div",properties:{},children:e.all(n)};return e.patch(n,s),e.applyData(n,s)}function _j(e,n){const r=[];let s=-1;for(n&&r.push({type:"text",value:`
102
+ `});++s<e.length;)s&&r.push({type:"text",value:`
103
+ `}),r.push(e[s]);return n&&e.length>0&&r.push({type:"text",value:`
104
+ `}),r}function yb(e){let n=0,r=e.charCodeAt(n);for(;r===9||r===32;)n++,r=e.charCodeAt(n);return e.slice(n)}function bb(e,n){const r=xj(e,n),s=r.one(e,void 0),l=uj(r),u=Array.isArray(s)?{type:"root",children:s}:s||{type:"root",children:[]};return l&&u.children.push({type:"text",value:`
105
+ `},l),u}function Ej(e,n){return e&&"run"in e?async function(r,s){const l=bb(r,{file:s,...n});await e.run(l,s)}:function(r,s){return bb(r,{file:s,...e||n})}}function xb(e){if(e)throw e}var Uh,vb;function kj(){if(vb)return Uh;vb=1;var e=Object.prototype.hasOwnProperty,n=Object.prototype.toString,r=Object.defineProperty,s=Object.getOwnPropertyDescriptor,l=function(d){return typeof Array.isArray=="function"?Array.isArray(d):n.call(d)==="[object Array]"},u=function(d){if(!d||n.call(d)!=="[object Object]")return!1;var y=e.call(d,"constructor"),g=d.constructor&&d.constructor.prototype&&e.call(d.constructor.prototype,"isPrototypeOf");if(d.constructor&&!y&&!g)return!1;var x;for(x in d);return typeof x>"u"||e.call(d,x)},c=function(d,y){r&&y.name==="__proto__"?r(d,y.name,{enumerable:!0,configurable:!0,value:y.newValue,writable:!0}):d[y.name]=y.newValue},f=function(d,y){if(y==="__proto__")if(e.call(d,y)){if(s)return s(d,y).value}else return;return d[y]};return Uh=function m(){var d,y,g,x,w,S,D=arguments[0],q=1,L=arguments.length,$=!1;for(typeof D=="boolean"&&($=D,D=arguments[1]||{},q=2),(D==null||typeof D!="object"&&typeof D!="function")&&(D={});q<L;++q)if(d=arguments[q],d!=null)for(y in d)g=f(D,y),x=f(d,y),D!==x&&($&&x&&(u(x)||(w=l(x)))?(w?(w=!1,S=g&&l(g)?g:[]):S=g&&u(g)?g:{},c(D,{name:y,newValue:m($,S,x)})):typeof x<"u"&&c(D,{name:y,newValue:x}));return D},Uh}var Cj=kj();const Bh=zb(Cj);function wd(e){if(typeof e!="object"||e===null)return!1;const n=Object.getPrototypeOf(e);return(n===null||n===Object.prototype||Object.getPrototypeOf(n)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function Aj(){const e=[],n={run:r,use:s};return n;function r(...l){let u=-1;const c=l.pop();if(typeof c!="function")throw new TypeError("Expected function as last argument, not "+c);f(null,...l);function f(m,...d){const y=e[++u];let g=-1;if(m){c(m);return}for(;++g<l.length;)(d[g]===null||d[g]===void 0)&&(d[g]=l[g]);l=d,y?Tj(y,f)(...d):c(null,...d)}}function s(l){if(typeof l!="function")throw new TypeError("Expected `middelware` to be a function, not "+l);return e.push(l),n}}function Tj(e,n){let r;return s;function s(...c){const f=e.length>c.length;let m;f&&c.push(l);try{m=e.apply(this,c)}catch(d){const y=d;if(f&&r)throw y;return l(y)}f||(m&&m.then&&typeof m.then=="function"?m.then(u,l):m instanceof Error?l(m):u(m))}function l(c,...f){r||(r=!0,n(c,...f))}function u(c){l(null,c)}}const Sr={basename:jj,dirname:Nj,extname:Oj,join:Rj,sep:"/"};function jj(e,n){if(n!==void 0&&typeof n!="string")throw new TypeError('"ext" argument must be a string');Jl(e);let r=0,s=-1,l=e.length,u;if(n===void 0||n.length===0||n.length>e.length){for(;l--;)if(e.codePointAt(l)===47){if(u){r=l+1;break}}else s<0&&(u=!0,s=l+1);return s<0?"":e.slice(r,s)}if(n===e)return"";let c=-1,f=n.length-1;for(;l--;)if(e.codePointAt(l)===47){if(u){r=l+1;break}}else c<0&&(u=!0,c=l+1),f>-1&&(e.codePointAt(l)===n.codePointAt(f--)?f<0&&(s=l):(f=-1,s=c));return r===s?s=c:s<0&&(s=e.length),e.slice(r,s)}function Nj(e){if(Jl(e),e.length===0)return".";let n=-1,r=e.length,s;for(;--r;)if(e.codePointAt(r)===47){if(s){n=r;break}}else s||(s=!0);return n<0?e.codePointAt(0)===47?"/":".":n===1&&e.codePointAt(0)===47?"//":e.slice(0,n)}function Oj(e){Jl(e);let n=e.length,r=-1,s=0,l=-1,u=0,c;for(;n--;){const f=e.codePointAt(n);if(f===47){if(c){s=n+1;break}continue}r<0&&(c=!0,r=n+1),f===46?l<0?l=n:u!==1&&(u=1):l>-1&&(u=-1)}return l<0||r<0||u===0||u===1&&l===r-1&&l===s+1?"":e.slice(l,r)}function Rj(...e){let n=-1,r;for(;++n<e.length;)Jl(e[n]),e[n]&&(r=r===void 0?e[n]:r+"/"+e[n]);return r===void 0?".":Mj(r)}function Mj(e){Jl(e);const n=e.codePointAt(0)===47;let r=Dj(e,!n);return r.length===0&&!n&&(r="."),r.length>0&&e.codePointAt(e.length-1)===47&&(r+="/"),n?"/"+r:r}function Dj(e,n){let r="",s=0,l=-1,u=0,c=-1,f,m;for(;++c<=e.length;){if(c<e.length)f=e.codePointAt(c);else{if(f===47)break;f=47}if(f===47){if(!(l===c-1||u===1))if(l!==c-1&&u===2){if(r.length<2||s!==2||r.codePointAt(r.length-1)!==46||r.codePointAt(r.length-2)!==46){if(r.length>2){if(m=r.lastIndexOf("/"),m!==r.length-1){m<0?(r="",s=0):(r=r.slice(0,m),s=r.length-1-r.lastIndexOf("/")),l=c,u=0;continue}}else if(r.length>0){r="",s=0,l=c,u=0;continue}}n&&(r=r.length>0?r+"/..":"..",s=2)}else r.length>0?r+="/"+e.slice(l+1,c):r=e.slice(l+1,c),s=c-l-1;l=c,u=0}else f===46&&u>-1?u++:u=-1}return r}function Jl(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const Lj={cwd:zj};function zj(){return"/"}function Sd(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function Uj(e){if(typeof e=="string")e=new URL(e);else if(!Sd(e)){const n=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw n.code="ERR_INVALID_ARG_TYPE",n}if(e.protocol!=="file:"){const n=new TypeError("The URL must be of scheme file");throw n.code="ERR_INVALID_URL_SCHEME",n}return Bj(e)}function Bj(e){if(e.hostname!==""){const s=new TypeError('File URL host must be "localhost" or empty on darwin');throw s.code="ERR_INVALID_FILE_URL_HOST",s}const n=e.pathname;let r=-1;for(;++r<n.length;)if(n.codePointAt(r)===37&&n.codePointAt(r+1)===50){const s=n.codePointAt(r+2);if(s===70||s===102){const l=new TypeError("File URL path must not include encoded / characters");throw l.code="ERR_INVALID_FILE_URL_PATH",l}}return decodeURIComponent(n)}const Ph=["history","path","basename","stem","extname","dirname"];class p1{constructor(n){let r;n?Sd(n)?r={path:n}:typeof n=="string"||Pj(n)?r={value:n}:r=n:r={},this.cwd="cwd"in r?"":Lj.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let s=-1;for(;++s<Ph.length;){const u=Ph[s];u in r&&r[u]!==void 0&&r[u]!==null&&(this[u]=u==="history"?[...r[u]]:r[u])}let l;for(l in r)Ph.includes(l)||(this[l]=r[l])}get basename(){return typeof this.path=="string"?Sr.basename(this.path):void 0}set basename(n){Hh(n,"basename"),qh(n,"basename"),this.path=Sr.join(this.dirname||"",n)}get dirname(){return typeof this.path=="string"?Sr.dirname(this.path):void 0}set dirname(n){wb(this.basename,"dirname"),this.path=Sr.join(n||"",this.basename)}get extname(){return typeof this.path=="string"?Sr.extname(this.path):void 0}set extname(n){if(qh(n,"extname"),wb(this.dirname,"extname"),n){if(n.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(n.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Sr.join(this.dirname,this.stem+(n||""))}get path(){return this.history[this.history.length-1]}set path(n){Sd(n)&&(n=Uj(n)),Hh(n,"path"),this.path!==n&&this.history.push(n)}get stem(){return typeof this.path=="string"?Sr.basename(this.path,this.extname):void 0}set stem(n){Hh(n,"stem"),qh(n,"stem"),this.path=Sr.join(this.dirname||"",n+(this.extname||""))}fail(n,r,s){const l=this.message(n,r,s);throw l.fatal=!0,l}info(n,r,s){const l=this.message(n,r,s);return l.fatal=void 0,l}message(n,r,s){const l=new hn(n,r,s);return this.path&&(l.name=this.path+":"+l.name,l.file=this.path),l.fatal=!1,this.messages.push(l),l}toString(n){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(n||void 0).decode(this.value)}}function qh(e,n){if(e&&e.includes(Sr.sep))throw new Error("`"+n+"` cannot be a path: did not expect `"+Sr.sep+"`")}function Hh(e,n){if(!e)throw new Error("`"+n+"` cannot be empty")}function wb(e,n){if(!e)throw new Error("Setting `"+n+"` requires `path` to be set too")}function Pj(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const qj=(function(e){const s=this.constructor.prototype,l=s[e],u=function(){return l.apply(u,arguments)};return Object.setPrototypeOf(u,s),u}),Hj={}.hasOwnProperty;class tm extends qj{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=Aj()}copy(){const n=new tm;let r=-1;for(;++r<this.attachers.length;){const s=this.attachers[r];n.use(...s)}return n.data(Bh(!0,{},this.namespace)),n}data(n,r){return typeof n=="string"?arguments.length===2?($h("data",this.frozen),this.namespace[n]=r,this):Hj.call(this.namespace,n)&&this.namespace[n]||void 0:n?($h("data",this.frozen),this.namespace=n,this):this.namespace}freeze(){if(this.frozen)return this;const n=this;for(;++this.freezeIndex<this.attachers.length;){const[r,...s]=this.attachers[this.freezeIndex];if(s[0]===!1)continue;s[0]===!0&&(s[0]=void 0);const l=r.call(n,...s);typeof l=="function"&&this.transformers.use(l)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(n){this.freeze();const r=bu(n),s=this.parser||this.Parser;return Ih("parse",s),s(String(r),r)}process(n,r){const s=this;return this.freeze(),Ih("process",this.parser||this.Parser),Fh("process",this.compiler||this.Compiler),r?l(void 0,r):new Promise(l);function l(u,c){const f=bu(n),m=s.parse(f);s.run(m,f,function(y,g,x){if(y||!g||!x)return d(y);const w=g,S=s.stringify(w,x);$j(S)?x.value=S:x.result=S,d(y,x)});function d(y,g){y||!g?c(y):u?u(g):r(void 0,g)}}}processSync(n){let r=!1,s;return this.freeze(),Ih("processSync",this.parser||this.Parser),Fh("processSync",this.compiler||this.Compiler),this.process(n,l),_b("processSync","process",r),s;function l(u,c){r=!0,xb(u),s=c}}run(n,r,s){Sb(n),this.freeze();const l=this.transformers;return!s&&typeof r=="function"&&(s=r,r=void 0),s?u(void 0,s):new Promise(u);function u(c,f){const m=bu(r);l.run(n,m,d);function d(y,g,x){const w=g||n;y?f(y):c?c(w):s(void 0,w,x)}}}runSync(n,r){let s=!1,l;return this.run(n,r,u),_b("runSync","run",s),l;function u(c,f){xb(c),l=f,s=!0}}stringify(n,r){this.freeze();const s=bu(r),l=this.compiler||this.Compiler;return Fh("stringify",l),Sb(n),l(n,s)}use(n,...r){const s=this.attachers,l=this.namespace;if($h("use",this.frozen),n!=null)if(typeof n=="function")m(n,r);else if(typeof n=="object")Array.isArray(n)?f(n):c(n);else throw new TypeError("Expected usable value, not `"+n+"`");return this;function u(d){if(typeof d=="function")m(d,[]);else if(typeof d=="object")if(Array.isArray(d)){const[y,...g]=d;m(y,g)}else c(d);else throw new TypeError("Expected usable value, not `"+d+"`")}function c(d){if(!("plugins"in d)&&!("settings"in d))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");f(d.plugins),d.settings&&(l.settings=Bh(!0,l.settings,d.settings))}function f(d){let y=-1;if(d!=null)if(Array.isArray(d))for(;++y<d.length;){const g=d[y];u(g)}else throw new TypeError("Expected a list of plugins, not `"+d+"`")}function m(d,y){let g=-1,x=-1;for(;++g<s.length;)if(s[g][0]===d){x=g;break}if(x===-1)s.push([d,...y]);else if(y.length>0){let[w,...S]=y;const D=s[x][1];wd(D)&&wd(w)&&(w=Bh(!0,D,w)),s[x]=[d,w,...S]}}}}const Ij=new tm().freeze();function Ih(e,n){if(typeof n!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Fh(e,n){if(typeof n!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function $h(e,n){if(n)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function Sb(e){if(!wd(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function _b(e,n,r){if(!r)throw new Error("`"+e+"` finished async. Use `"+n+"` instead")}function bu(e){return Fj(e)?e:new p1(e)}function Fj(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function $j(e){return typeof e=="string"||Yj(e)}function Yj(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const Gj="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Eb=[],kb={allowDangerousHtml:!0},Vj=/^(https?|ircs?|mailto|xmpp)$/i,Jj=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function Cb(e){const n=Xj(e),r=Kj(e);return Qj(n.runSync(n.parse(r),r),e)}function Xj(e){const n=e.rehypePlugins||Eb,r=e.remarkPlugins||Eb,s=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...kb}:kb;return Ij().use(NT).use(r).use(Ej,s).use(n)}function Kj(e){const n=e.children||"",r=new p1;return typeof n=="string"&&(r.value=n),r}function Qj(e,n){const r=n.allowedElements,s=n.allowElement,l=n.components,u=n.disallowedElements,c=n.skipHtml,f=n.unwrapDisallowed,m=n.urlTransform||Zj;for(const y of Jj)Object.hasOwn(n,y.from)&&(""+y.from+(y.to?"use `"+y.to+"` instead":"remove it")+Gj+y.id,void 0);return em(e,d),dC(e,{Fragment:b.Fragment,components:l,ignoreInvalidStyle:!0,jsx:b.jsx,jsxs:b.jsxs,passKeys:!0,passNode:!0});function d(y,g,x){if(y.type==="raw"&&x&&typeof g=="number")return c?x.children.splice(g,1):x.children[g]={type:"text",value:y.value},g;if(y.type==="element"){let w;for(w in Dh)if(Object.hasOwn(Dh,w)&&Object.hasOwn(y.properties,w)){const S=y.properties[w],D=Dh[w];(D===null||D.includes(y.tagName))&&(y.properties[w]=m(String(S||""),w,y))}}if(y.type==="element"){let w=r?!r.includes(y.tagName):u?u.includes(y.tagName):!1;if(!w&&s&&typeof g=="number"&&(w=!s(y,g,x)),w&&x&&typeof g=="number")return f&&y.children?x.children.splice(g,1,...y.children):x.children.splice(g,1),g}}}function Zj(e){const n=e.indexOf(":"),r=e.indexOf("?"),s=e.indexOf("#"),l=e.indexOf("/");return n===-1||l!==-1&&n>l||r!==-1&&n>r||s!==-1&&n>s||Vj.test(e.slice(0,n))?e:""}function Ab(e,n){const r=String(e);if(typeof n!="string")throw new TypeError("Expected character");let s=0,l=r.indexOf(n);for(;l!==-1;)s++,l=r.indexOf(n,l+n.length);return s}function Wj(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function g1(e,n,r){const l=Zu((r||{}).ignore||[]),u=eN(n);let c=-1;for(;++c<u.length;)m1(e,"text",f);function f(d,y){let g=-1,x;for(;++g<y.length;){const w=y[g],S=x?x.children:void 0;if(l(w,S?S.indexOf(w):void 0,x))return;x=w}if(x)return m(d,y)}function m(d,y){const g=y[y.length-1],x=u[c][0],w=u[c][1];let S=0;const q=g.children.indexOf(d);let L=!1,$=[];x.lastIndex=0;let T=x.exec(d.value);for(;T;){const te=T.index,B={index:T.index,input:T.input,stack:[...y,d]};let z=w(...T,B);if(typeof z=="string"&&(z=z.length>0?{type:"text",value:z}:void 0),z===!1?x.lastIndex=te+1:(S!==te&&$.push({type:"text",value:d.value.slice(S,te)}),Array.isArray(z)?$.push(...z):z&&$.push(z),S=te+T[0].length,L=!0),!x.global)break;T=x.exec(d.value)}return L?(S<d.value.length&&$.push({type:"text",value:d.value.slice(S)}),g.children.splice(q,1,...$)):$=[d],q+$.length}}function eN(e){const n=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const r=!e[0]||Array.isArray(e[0])?e:[e];let s=-1;for(;++s<r.length;){const l=r[s];n.push([tN(l[0]),nN(l[1])])}return n}function tN(e){return typeof e=="string"?new RegExp(Wj(e),"g"):e}function nN(e){return typeof e=="function"?e:function(){return e}}const Yh="phrasing",Gh=["autolink","link","image","label"];function rN(){return{transforms:[cN],enter:{literalAutolink:sN,literalAutolinkEmail:Vh,literalAutolinkHttp:Vh,literalAutolinkWww:Vh},exit:{literalAutolink:uN,literalAutolinkEmail:oN,literalAutolinkHttp:aN,literalAutolinkWww:lN}}}function iN(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Yh,notInConstruct:Gh},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Yh,notInConstruct:Gh},{character:":",before:"[ps]",after:"\\/",inConstruct:Yh,notInConstruct:Gh}]}}function sN(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function Vh(e){this.config.enter.autolinkProtocol.call(this,e)}function aN(e){this.config.exit.autolinkProtocol.call(this,e)}function lN(e){this.config.exit.data.call(this,e);const n=this.stack[this.stack.length-1];n.type,n.url="http://"+this.sliceSerialize(e)}function oN(e){this.config.exit.autolinkEmail.call(this,e)}function uN(e){this.exit(e)}function cN(e){g1(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,fN],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),hN]],{ignore:["link","linkReference"]})}function fN(e,n,r,s,l){let u="";if(!y1(l)||(/^w/i.test(n)&&(r=n+r,n="",u="http://"),!dN(r)))return!1;const c=mN(r+s);if(!c[0])return!1;const f={type:"link",title:null,url:u+n+c[0],children:[{type:"text",value:n+c[0]}]};return c[1]?[f,{type:"text",value:c[1]}]:f}function hN(e,n,r,s){return!y1(s,!0)||/[-\d_]$/.test(r)?!1:{type:"link",title:null,url:"mailto:"+n+"@"+r,children:[{type:"text",value:n+"@"+r}]}}function dN(e){const n=e.split(".");return!(n.length<2||n[n.length-1]&&(/_/.test(n[n.length-1])||!/[a-zA-Z\d]/.test(n[n.length-1]))||n[n.length-2]&&(/_/.test(n[n.length-2])||!/[a-zA-Z\d]/.test(n[n.length-2])))}function mN(e){const n=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!n)return[e,void 0];e=e.slice(0,n.index);let r=n[0],s=r.indexOf(")");const l=Ab(e,"(");let u=Ab(e,")");for(;s!==-1&&l>u;)e+=r.slice(0,s+1),r=r.slice(s+1),s=r.indexOf(")"),u++;return[e,r]}function y1(e,n){const r=e.input.charCodeAt(e.index-1);return(e.index===0||ds(r)||Xu(r))&&(!n||r!==47)}b1.peek=_N;function pN(){this.buffer()}function gN(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function yN(){this.buffer()}function bN(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function xN(e){const n=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=gr(this.sliceSerialize(e)).toLowerCase(),r.label=n}function vN(e){this.exit(e)}function wN(e){const n=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=gr(this.sliceSerialize(e)).toLowerCase(),r.label=n}function SN(e){this.exit(e)}function _N(){return"["}function b1(e,n,r,s){const l=r.createTracker(s);let u=l.move("[^");const c=r.enter("footnoteReference"),f=r.enter("reference");return u+=l.move(r.safe(r.associationId(e),{after:"]",before:u})),f(),c(),u+=l.move("]"),u}function EN(){return{enter:{gfmFootnoteCallString:pN,gfmFootnoteCall:gN,gfmFootnoteDefinitionLabelString:yN,gfmFootnoteDefinition:bN},exit:{gfmFootnoteCallString:xN,gfmFootnoteCall:vN,gfmFootnoteDefinitionLabelString:wN,gfmFootnoteDefinition:SN}}}function kN(e){let n=!1;return e&&e.firstLineBlank&&(n=!0),{handlers:{footnoteDefinition:r,footnoteReference:b1},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function r(s,l,u,c){const f=u.createTracker(c);let m=f.move("[^");const d=u.enter("footnoteDefinition"),y=u.enter("label");return m+=f.move(u.safe(u.associationId(s),{before:m,after:"]"})),y(),m+=f.move("]:"),s.children&&s.children.length>0&&(f.shift(4),m+=f.move((n?`
106
+ `:" ")+u.indentLines(u.containerFlow(s,f.current()),n?x1:CN))),d(),m}}function CN(e,n,r){return n===0?e:x1(e,n,r)}function x1(e,n,r){return(r?"":" ")+e}const AN=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];v1.peek=RN;function TN(){return{canContainEols:["delete"],enter:{strikethrough:NN},exit:{strikethrough:ON}}}function jN(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:AN}],handlers:{delete:v1}}}function NN(e){this.enter({type:"delete",children:[]},e)}function ON(e){this.exit(e)}function v1(e,n,r,s){const l=r.createTracker(s),u=r.enter("strikethrough");let c=l.move("~~");return c+=r.containerPhrasing(e,{...l.current(),before:c,after:"~"}),c+=l.move("~~"),u(),c}function RN(){return"~"}function MN(e){return e.length}function DN(e,n){const r=n||{},s=(r.align||[]).concat(),l=r.stringLength||MN,u=[],c=[],f=[],m=[];let d=0,y=-1;for(;++y<e.length;){const D=[],q=[];let L=-1;for(e[y].length>d&&(d=e[y].length);++L<e[y].length;){const $=LN(e[y][L]);if(r.alignDelimiters!==!1){const T=l($);q[L]=T,(m[L]===void 0||T>m[L])&&(m[L]=T)}D.push($)}c[y]=D,f[y]=q}let g=-1;if(typeof s=="object"&&"length"in s)for(;++g<d;)u[g]=Tb(s[g]);else{const D=Tb(s);for(;++g<d;)u[g]=D}g=-1;const x=[],w=[];for(;++g<d;){const D=u[g];let q="",L="";D===99?(q=":",L=":"):D===108?q=":":D===114&&(L=":");let $=r.alignDelimiters===!1?1:Math.max(1,m[g]-q.length-L.length);const T=q+"-".repeat($)+L;r.alignDelimiters!==!1&&($=q.length+$+L.length,$>m[g]&&(m[g]=$),w[g]=$),x[g]=T}c.splice(1,0,x),f.splice(1,0,w),y=-1;const S=[];for(;++y<c.length;){const D=c[y],q=f[y];g=-1;const L=[];for(;++g<d;){const $=D[g]||"";let T="",te="";if(r.alignDelimiters!==!1){const B=m[g]-(q[g]||0),z=u[g];z===114?T=" ".repeat(B):z===99?B%2?(T=" ".repeat(B/2+.5),te=" ".repeat(B/2-.5)):(T=" ".repeat(B/2),te=T):te=" ".repeat(B)}r.delimiterStart!==!1&&!g&&L.push("|"),r.padding!==!1&&!(r.alignDelimiters===!1&&$==="")&&(r.delimiterStart!==!1||g)&&L.push(" "),r.alignDelimiters!==!1&&L.push(T),L.push($),r.alignDelimiters!==!1&&L.push(te),r.padding!==!1&&L.push(" "),(r.delimiterEnd!==!1||g!==d-1)&&L.push("|")}S.push(r.delimiterEnd===!1?L.join("").replace(/ +$/,""):L.join(""))}return S.join(`
107
+ `)}function LN(e){return e==null?"":String(e)}function Tb(e){const n=typeof e=="string"?e.codePointAt(0):0;return n===67||n===99?99:n===76||n===108?108:n===82||n===114?114:0}function zN(e,n,r,s){const l=r.enter("blockquote"),u=r.createTracker(s);u.move("> "),u.shift(2);const c=r.indentLines(r.containerFlow(e,u.current()),UN);return l(),c}function UN(e,n,r){return">"+(r?"":" ")+e}function BN(e,n){return jb(e,n.inConstruct,!0)&&!jb(e,n.notInConstruct,!1)}function jb(e,n,r){if(typeof n=="string"&&(n=[n]),!n||n.length===0)return r;let s=-1;for(;++s<n.length;)if(e.includes(n[s]))return!0;return!1}function Nb(e,n,r,s){let l=-1;for(;++l<r.unsafe.length;)if(r.unsafe[l].character===`
108
+ `&&BN(r.stack,r.unsafe[l]))return/[ \t]/.test(s.before)?"":" ";return`\\
109
+ `}function PN(e,n){const r=String(e);let s=r.indexOf(n),l=s,u=0,c=0;if(typeof n!="string")throw new TypeError("Expected substring");for(;s!==-1;)s===l?++u>c&&(c=u):u=1,l=s+n.length,s=r.indexOf(n,l);return c}function qN(e,n){return!!(n.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function HN(e){const n=e.options.fence||"`";if(n!=="`"&&n!=="~")throw new Error("Cannot serialize code with `"+n+"` for `options.fence`, expected `` ` `` or `~`");return n}function IN(e,n,r,s){const l=HN(r),u=e.value||"",c=l==="`"?"GraveAccent":"Tilde";if(qN(e,r)){const g=r.enter("codeIndented"),x=r.indentLines(u,FN);return g(),x}const f=r.createTracker(s),m=l.repeat(Math.max(PN(u,l)+1,3)),d=r.enter("codeFenced");let y=f.move(m);if(e.lang){const g=r.enter(`codeFencedLang${c}`);y+=f.move(r.safe(e.lang,{before:y,after:" ",encode:["`"],...f.current()})),g()}if(e.lang&&e.meta){const g=r.enter(`codeFencedMeta${c}`);y+=f.move(" "),y+=f.move(r.safe(e.meta,{before:y,after:`
110
+ `,encode:["`"],...f.current()})),g()}return y+=f.move(`
111
+ `),u&&(y+=f.move(u+`
112
+ `)),y+=f.move(m),d(),y}function FN(e,n,r){return(r?"":" ")+e}function nm(e){const n=e.options.quote||'"';if(n!=='"'&&n!=="'")throw new Error("Cannot serialize title with `"+n+"` for `options.quote`, expected `\"`, or `'`");return n}function $N(e,n,r,s){const l=nm(r),u=l==='"'?"Quote":"Apostrophe",c=r.enter("definition");let f=r.enter("label");const m=r.createTracker(s);let d=m.move("[");return d+=m.move(r.safe(r.associationId(e),{before:d,after:"]",...m.current()})),d+=m.move("]: "),f(),!e.url||/[\0- \u007F]/.test(e.url)?(f=r.enter("destinationLiteral"),d+=m.move("<"),d+=m.move(r.safe(e.url,{before:d,after:">",...m.current()})),d+=m.move(">")):(f=r.enter("destinationRaw"),d+=m.move(r.safe(e.url,{before:d,after:e.title?" ":`
113
+ `,...m.current()}))),f(),e.title&&(f=r.enter(`title${u}`),d+=m.move(" "+l),d+=m.move(r.safe(e.title,{before:d,after:l,...m.current()})),d+=m.move(l),f()),c(),d}function YN(e){const n=e.options.emphasis||"*";if(n!=="*"&&n!=="_")throw new Error("Cannot serialize emphasis with `"+n+"` for `options.emphasis`, expected `*`, or `_`");return n}function ql(e){return"&#x"+e.toString(16).toUpperCase()+";"}function Hu(e,n,r){const s=ga(e),l=ga(n);return s===void 0?l===void 0?r==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:l===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:s===1?l===void 0?{inside:!1,outside:!1}:l===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:l===void 0?{inside:!1,outside:!1}:l===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}w1.peek=GN;function w1(e,n,r,s){const l=YN(r),u=r.enter("emphasis"),c=r.createTracker(s),f=c.move(l);let m=c.move(r.containerPhrasing(e,{after:l,before:f,...c.current()}));const d=m.charCodeAt(0),y=Hu(s.before.charCodeAt(s.before.length-1),d,l);y.inside&&(m=ql(d)+m.slice(1));const g=m.charCodeAt(m.length-1),x=Hu(s.after.charCodeAt(0),g,l);x.inside&&(m=m.slice(0,-1)+ql(g));const w=c.move(l);return u(),r.attentionEncodeSurroundingInfo={after:x.outside,before:y.outside},f+m+w}function GN(e,n,r){return r.options.emphasis||"*"}function VN(e,n){let r=!1;return em(e,function(s){if("value"in s&&/\r?\n|\r/.test(s.value)||s.type==="break")return r=!0,xd}),!!((!e.depth||e.depth<3)&&Vd(e)&&(n.options.setext||r))}function JN(e,n,r,s){const l=Math.max(Math.min(6,e.depth||1),1),u=r.createTracker(s);if(VN(e,r)){const y=r.enter("headingSetext"),g=r.enter("phrasing"),x=r.containerPhrasing(e,{...u.current(),before:`
114
+ `,after:`
115
+ `});return g(),y(),x+`
116
+ `+(l===1?"=":"-").repeat(x.length-(Math.max(x.lastIndexOf("\r"),x.lastIndexOf(`
117
+ `))+1))}const c="#".repeat(l),f=r.enter("headingAtx"),m=r.enter("phrasing");u.move(c+" ");let d=r.containerPhrasing(e,{before:"# ",after:`
118
+ `,...u.current()});return/^[\t ]/.test(d)&&(d=ql(d.charCodeAt(0))+d.slice(1)),d=d?c+" "+d:c,r.options.closeAtx&&(d+=" "+c),m(),f(),d}S1.peek=XN;function S1(e){return e.value||""}function XN(){return"<"}_1.peek=KN;function _1(e,n,r,s){const l=nm(r),u=l==='"'?"Quote":"Apostrophe",c=r.enter("image");let f=r.enter("label");const m=r.createTracker(s);let d=m.move("![");return d+=m.move(r.safe(e.alt,{before:d,after:"]",...m.current()})),d+=m.move("]("),f(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(f=r.enter("destinationLiteral"),d+=m.move("<"),d+=m.move(r.safe(e.url,{before:d,after:">",...m.current()})),d+=m.move(">")):(f=r.enter("destinationRaw"),d+=m.move(r.safe(e.url,{before:d,after:e.title?" ":")",...m.current()}))),f(),e.title&&(f=r.enter(`title${u}`),d+=m.move(" "+l),d+=m.move(r.safe(e.title,{before:d,after:l,...m.current()})),d+=m.move(l),f()),d+=m.move(")"),c(),d}function KN(){return"!"}E1.peek=QN;function E1(e,n,r,s){const l=e.referenceType,u=r.enter("imageReference");let c=r.enter("label");const f=r.createTracker(s);let m=f.move("![");const d=r.safe(e.alt,{before:m,after:"]",...f.current()});m+=f.move(d+"]["),c();const y=r.stack;r.stack=[],c=r.enter("reference");const g=r.safe(r.associationId(e),{before:m,after:"]",...f.current()});return c(),r.stack=y,u(),l==="full"||!d||d!==g?m+=f.move(g+"]"):l==="shortcut"?m=m.slice(0,-1):m+=f.move("]"),m}function QN(){return"!"}k1.peek=ZN;function k1(e,n,r){let s=e.value||"",l="`",u=-1;for(;new RegExp("(^|[^`])"+l+"([^`]|$)").test(s);)l+="`";for(/[^ \r\n]/.test(s)&&(/^[ \r\n]/.test(s)&&/[ \r\n]$/.test(s)||/^`|`$/.test(s))&&(s=" "+s+" ");++u<r.unsafe.length;){const c=r.unsafe[u],f=r.compilePattern(c);let m;if(c.atBreak)for(;m=f.exec(s);){let d=m.index;s.charCodeAt(d)===10&&s.charCodeAt(d-1)===13&&d--,s=s.slice(0,d)+" "+s.slice(m.index+1)}}return l+s+l}function ZN(){return"`"}function C1(e,n){const r=Vd(e);return!!(!n.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(r===e.url||"mailto:"+r===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}A1.peek=WN;function A1(e,n,r,s){const l=nm(r),u=l==='"'?"Quote":"Apostrophe",c=r.createTracker(s);let f,m;if(C1(e,r)){const y=r.stack;r.stack=[],f=r.enter("autolink");let g=c.move("<");return g+=c.move(r.containerPhrasing(e,{before:g,after:">",...c.current()})),g+=c.move(">"),f(),r.stack=y,g}f=r.enter("link"),m=r.enter("label");let d=c.move("[");return d+=c.move(r.containerPhrasing(e,{before:d,after:"](",...c.current()})),d+=c.move("]("),m(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(m=r.enter("destinationLiteral"),d+=c.move("<"),d+=c.move(r.safe(e.url,{before:d,after:">",...c.current()})),d+=c.move(">")):(m=r.enter("destinationRaw"),d+=c.move(r.safe(e.url,{before:d,after:e.title?" ":")",...c.current()}))),m(),e.title&&(m=r.enter(`title${u}`),d+=c.move(" "+l),d+=c.move(r.safe(e.title,{before:d,after:l,...c.current()})),d+=c.move(l),m()),d+=c.move(")"),f(),d}function WN(e,n,r){return C1(e,r)?"<":"["}T1.peek=e3;function T1(e,n,r,s){const l=e.referenceType,u=r.enter("linkReference");let c=r.enter("label");const f=r.createTracker(s);let m=f.move("[");const d=r.containerPhrasing(e,{before:m,after:"]",...f.current()});m+=f.move(d+"]["),c();const y=r.stack;r.stack=[],c=r.enter("reference");const g=r.safe(r.associationId(e),{before:m,after:"]",...f.current()});return c(),r.stack=y,u(),l==="full"||!d||d!==g?m+=f.move(g+"]"):l==="shortcut"?m=m.slice(0,-1):m+=f.move("]"),m}function e3(){return"["}function rm(e){const n=e.options.bullet||"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bullet`, expected `*`, `+`, or `-`");return n}function t3(e){const n=rm(e),r=e.options.bulletOther;if(!r)return n==="*"?"-":"*";if(r!=="*"&&r!=="+"&&r!=="-")throw new Error("Cannot serialize items with `"+r+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(r===n)throw new Error("Expected `bullet` (`"+n+"`) and `bulletOther` (`"+r+"`) to be different");return r}function n3(e){const n=e.options.bulletOrdered||".";if(n!=="."&&n!==")")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOrdered`, expected `.` or `)`");return n}function j1(e){const n=e.options.rule||"*";if(n!=="*"&&n!=="-"&&n!=="_")throw new Error("Cannot serialize rules with `"+n+"` for `options.rule`, expected `*`, `-`, or `_`");return n}function r3(e,n,r,s){const l=r.enter("list"),u=r.bulletCurrent;let c=e.ordered?n3(r):rm(r);const f=e.ordered?c==="."?")":".":t3(r);let m=n&&r.bulletLastUsed?c===r.bulletLastUsed:!1;if(!e.ordered){const y=e.children?e.children[0]:void 0;if((c==="*"||c==="-")&&y&&(!y.children||!y.children[0])&&r.stack[r.stack.length-1]==="list"&&r.stack[r.stack.length-2]==="listItem"&&r.stack[r.stack.length-3]==="list"&&r.stack[r.stack.length-4]==="listItem"&&r.indexStack[r.indexStack.length-1]===0&&r.indexStack[r.indexStack.length-2]===0&&r.indexStack[r.indexStack.length-3]===0&&(m=!0),j1(r)===c&&y){let g=-1;for(;++g<e.children.length;){const x=e.children[g];if(x&&x.type==="listItem"&&x.children&&x.children[0]&&x.children[0].type==="thematicBreak"){m=!0;break}}}}m&&(c=f),r.bulletCurrent=c;const d=r.containerFlow(e,s);return r.bulletLastUsed=c,r.bulletCurrent=u,l(),d}function i3(e){const n=e.options.listItemIndent||"one";if(n!=="tab"&&n!=="one"&&n!=="mixed")throw new Error("Cannot serialize items with `"+n+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return n}function s3(e,n,r,s){const l=i3(r);let u=r.bulletCurrent||rm(r);n&&n.type==="list"&&n.ordered&&(u=(typeof n.start=="number"&&n.start>-1?n.start:1)+(r.options.incrementListMarker===!1?0:n.children.indexOf(e))+u);let c=u.length+1;(l==="tab"||l==="mixed"&&(n&&n.type==="list"&&n.spread||e.spread))&&(c=Math.ceil(c/4)*4);const f=r.createTracker(s);f.move(u+" ".repeat(c-u.length)),f.shift(c);const m=r.enter("listItem"),d=r.indentLines(r.containerFlow(e,f.current()),y);return m(),d;function y(g,x,w){return x?(w?"":" ".repeat(c))+g:(w?u:u+" ".repeat(c-u.length))+g}}function a3(e,n,r,s){const l=r.enter("paragraph"),u=r.enter("phrasing"),c=r.containerPhrasing(e,s);return u(),l(),c}const l3=Zu(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function o3(e,n,r,s){return(e.children.some(function(c){return l3(c)})?r.containerPhrasing:r.containerFlow).call(r,e,s)}function u3(e){const n=e.options.strong||"*";if(n!=="*"&&n!=="_")throw new Error("Cannot serialize strong with `"+n+"` for `options.strong`, expected `*`, or `_`");return n}N1.peek=c3;function N1(e,n,r,s){const l=u3(r),u=r.enter("strong"),c=r.createTracker(s),f=c.move(l+l);let m=c.move(r.containerPhrasing(e,{after:l,before:f,...c.current()}));const d=m.charCodeAt(0),y=Hu(s.before.charCodeAt(s.before.length-1),d,l);y.inside&&(m=ql(d)+m.slice(1));const g=m.charCodeAt(m.length-1),x=Hu(s.after.charCodeAt(0),g,l);x.inside&&(m=m.slice(0,-1)+ql(g));const w=c.move(l+l);return u(),r.attentionEncodeSurroundingInfo={after:x.outside,before:y.outside},f+m+w}function c3(e,n,r){return r.options.strong||"*"}function f3(e,n,r,s){return r.safe(e.value,s)}function h3(e){const n=e.options.ruleRepetition||3;if(n<3)throw new Error("Cannot serialize rules with repetition `"+n+"` for `options.ruleRepetition`, expected `3` or more");return n}function d3(e,n,r){const s=(j1(r)+(r.options.ruleSpaces?" ":"")).repeat(h3(r));return r.options.ruleSpaces?s.slice(0,-1):s}const O1={blockquote:zN,break:Nb,code:IN,definition:$N,emphasis:w1,hardBreak:Nb,heading:JN,html:S1,image:_1,imageReference:E1,inlineCode:k1,link:A1,linkReference:T1,list:r3,listItem:s3,paragraph:a3,root:o3,strong:N1,text:f3,thematicBreak:d3};function m3(){return{enter:{table:p3,tableData:Ob,tableHeader:Ob,tableRow:y3},exit:{codeText:b3,table:g3,tableData:Jh,tableHeader:Jh,tableRow:Jh}}}function p3(e){const n=e._align;this.enter({type:"table",align:n.map(function(r){return r==="none"?null:r}),children:[]},e),this.data.inTable=!0}function g3(e){this.exit(e),this.data.inTable=void 0}function y3(e){this.enter({type:"tableRow",children:[]},e)}function Jh(e){this.exit(e)}function Ob(e){this.enter({type:"tableCell",children:[]},e)}function b3(e){let n=this.resume();this.data.inTable&&(n=n.replace(/\\([\\|])/g,x3));const r=this.stack[this.stack.length-1];r.type,r.value=n,this.exit(e)}function x3(e,n){return n==="|"?n:e}function v3(e){const n=e||{},r=n.tableCellPadding,s=n.tablePipeAlign,l=n.stringLength,u=r?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
119
+ `,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:x,table:c,tableCell:m,tableRow:f}};function c(w,S,D,q){return d(y(w,D,q),w.align)}function f(w,S,D,q){const L=g(w,D,q),$=d([L]);return $.slice(0,$.indexOf(`
120
+ `))}function m(w,S,D,q){const L=D.enter("tableCell"),$=D.enter("phrasing"),T=D.containerPhrasing(w,{...q,before:u,after:u});return $(),L(),T}function d(w,S){return DN(w,{align:S,alignDelimiters:s,padding:r,stringLength:l})}function y(w,S,D){const q=w.children;let L=-1;const $=[],T=S.enter("table");for(;++L<q.length;)$[L]=g(q[L],S,D);return T(),$}function g(w,S,D){const q=w.children;let L=-1;const $=[],T=S.enter("tableRow");for(;++L<q.length;)$[L]=m(q[L],w,S,D);return T(),$}function x(w,S,D){let q=O1.inlineCode(w,S,D);return D.stack.includes("tableCell")&&(q=q.replace(/\|/g,"\\$&")),q}}function w3(){return{exit:{taskListCheckValueChecked:Rb,taskListCheckValueUnchecked:Rb,paragraph:_3}}}function S3(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:E3}}}function Rb(e){const n=this.stack[this.stack.length-2];n.type,n.checked=e.type==="taskListCheckValueChecked"}function _3(e){const n=this.stack[this.stack.length-2];if(n&&n.type==="listItem"&&typeof n.checked=="boolean"){const r=this.stack[this.stack.length-1];r.type;const s=r.children[0];if(s&&s.type==="text"){const l=n.children;let u=-1,c;for(;++u<l.length;){const f=l[u];if(f.type==="paragraph"){c=f;break}}c===r&&(s.value=s.value.slice(1),s.value.length===0?r.children.shift():r.position&&s.position&&typeof s.position.start.offset=="number"&&(s.position.start.column++,s.position.start.offset++,r.position.start=Object.assign({},s.position.start)))}}this.exit(e)}function E3(e,n,r,s){const l=e.children[0],u=typeof e.checked=="boolean"&&l&&l.type==="paragraph",c="["+(e.checked?"x":" ")+"] ",f=r.createTracker(s);u&&f.move(c);let m=O1.listItem(e,n,r,{...s,...f.current()});return u&&(m=m.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,d)),m;function d(y){return y+c}}function k3(){return[rN(),EN(),TN(),m3(),w3()]}function C3(e){return{extensions:[iN(),kN(e),jN(),v3(e),S3()]}}const A3={tokenize:M3,partial:!0},R1={tokenize:D3,partial:!0},M1={tokenize:L3,partial:!0},D1={tokenize:z3,partial:!0},T3={tokenize:U3,partial:!0},L1={name:"wwwAutolink",tokenize:O3,previous:U1},z1={name:"protocolAutolink",tokenize:R3,previous:B1},ni={name:"emailAutolink",tokenize:N3,previous:P1},jr={};function j3(){return{text:jr}}let cs=48;for(;cs<123;)jr[cs]=ni,cs++,cs===58?cs=65:cs===91&&(cs=97);jr[43]=ni;jr[45]=ni;jr[46]=ni;jr[95]=ni;jr[72]=[ni,z1];jr[104]=[ni,z1];jr[87]=[ni,L1];jr[119]=[ni,L1];function N3(e,n,r){const s=this;let l,u;return c;function c(g){return!_d(g)||!P1.call(s,s.previous)||im(s.events)?r(g):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),f(g))}function f(g){return _d(g)?(e.consume(g),f):g===64?(e.consume(g),m):r(g)}function m(g){return g===46?e.check(T3,y,d)(g):g===45||g===95||fn(g)?(u=!0,e.consume(g),m):y(g)}function d(g){return e.consume(g),l=!0,m}function y(g){return u&&l&&yn(s.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),n(g)):r(g)}}function O3(e,n,r){const s=this;return l;function l(c){return c!==87&&c!==119||!U1.call(s,s.previous)||im(s.events)?r(c):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(A3,e.attempt(R1,e.attempt(M1,u),r),r)(c))}function u(c){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),n(c)}}function R3(e,n,r){const s=this;let l="",u=!1;return c;function c(g){return(g===72||g===104)&&B1.call(s,s.previous)&&!im(s.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),l+=String.fromCodePoint(g),e.consume(g),f):r(g)}function f(g){if(yn(g)&&l.length<5)return l+=String.fromCodePoint(g),e.consume(g),f;if(g===58){const x=l.toLowerCase();if(x==="http"||x==="https")return e.consume(g),m}return r(g)}function m(g){return g===47?(e.consume(g),u?d:(u=!0,m)):r(g)}function d(g){return g===null||Bu(g)||Tt(g)||ds(g)||Xu(g)?r(g):e.attempt(R1,e.attempt(M1,y),r)(g)}function y(g){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),n(g)}}function M3(e,n,r){let s=0;return l;function l(c){return(c===87||c===119)&&s<3?(s++,e.consume(c),l):c===46&&s===3?(e.consume(c),u):r(c)}function u(c){return c===null?r(c):n(c)}}function D3(e,n,r){let s,l,u;return c;function c(d){return d===46||d===95?e.check(D1,m,f)(d):d===null||Tt(d)||ds(d)||d!==45&&Xu(d)?m(d):(u=!0,e.consume(d),c)}function f(d){return d===95?s=!0:(l=s,s=void 0),e.consume(d),c}function m(d){return l||s||!u?r(d):n(d)}}function L3(e,n){let r=0,s=0;return l;function l(c){return c===40?(r++,e.consume(c),l):c===41&&s<r?u(c):c===33||c===34||c===38||c===39||c===41||c===42||c===44||c===46||c===58||c===59||c===60||c===63||c===93||c===95||c===126?e.check(D1,n,u)(c):c===null||Tt(c)||ds(c)?n(c):(e.consume(c),l)}function u(c){return c===41&&s++,e.consume(c),l}}function z3(e,n,r){return s;function s(f){return f===33||f===34||f===39||f===41||f===42||f===44||f===46||f===58||f===59||f===63||f===95||f===126?(e.consume(f),s):f===38?(e.consume(f),u):f===93?(e.consume(f),l):f===60||f===null||Tt(f)||ds(f)?n(f):r(f)}function l(f){return f===null||f===40||f===91||Tt(f)||ds(f)?n(f):s(f)}function u(f){return yn(f)?c(f):r(f)}function c(f){return f===59?(e.consume(f),s):yn(f)?(e.consume(f),c):r(f)}}function U3(e,n,r){return s;function s(u){return e.consume(u),l}function l(u){return fn(u)?r(u):n(u)}}function U1(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Tt(e)}function B1(e){return!yn(e)}function P1(e){return!(e===47||_d(e))}function _d(e){return e===43||e===45||e===46||e===95||fn(e)}function im(e){let n=e.length,r=!1;for(;n--;){const s=e[n][1];if((s.type==="labelLink"||s.type==="labelImage")&&!s._balanced){r=!0;break}if(s._gfmAutolinkLiteralWalkedInto){r=!1;break}}return e.length>0&&!r&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),r}const B3={tokenize:G3,partial:!0};function P3(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:F3,continuation:{tokenize:$3},exit:Y3}},text:{91:{name:"gfmFootnoteCall",tokenize:I3},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:q3,resolveTo:H3}}}}function q3(e,n,r){const s=this;let l=s.events.length;const u=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let c;for(;l--;){const m=s.events[l][1];if(m.type==="labelImage"){c=m;break}if(m.type==="gfmFootnoteCall"||m.type==="labelLink"||m.type==="label"||m.type==="image"||m.type==="link")break}return f;function f(m){if(!c||!c._balanced)return r(m);const d=gr(s.sliceSerialize({start:c.end,end:s.now()}));return d.codePointAt(0)!==94||!u.includes(d.slice(1))?r(m):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(m),e.exit("gfmFootnoteCallLabelMarker"),n(m))}}function H3(e,n){let r=e.length;for(;r--;)if(e[r][1].type==="labelImage"&&e[r][0]==="enter"){e[r][1];break}e[r+1][1].type="data",e[r+3][1].type="gfmFootnoteCallLabelMarker";const s={type:"gfmFootnoteCall",start:Object.assign({},e[r+3][1].start),end:Object.assign({},e[e.length-1][1].end)},l={type:"gfmFootnoteCallMarker",start:Object.assign({},e[r+3][1].end),end:Object.assign({},e[r+3][1].end)};l.end.column++,l.end.offset++,l.end._bufferIndex++;const u={type:"gfmFootnoteCallString",start:Object.assign({},l.end),end:Object.assign({},e[e.length-1][1].start)},c={type:"chunkString",contentType:"string",start:Object.assign({},u.start),end:Object.assign({},u.end)},f=[e[r+1],e[r+2],["enter",s,n],e[r+3],e[r+4],["enter",l,n],["exit",l,n],["enter",u,n],["enter",c,n],["exit",c,n],["exit",u,n],e[e.length-2],e[e.length-1],["exit",s,n]];return e.splice(r,e.length-r+1,...f),e}function I3(e,n,r){const s=this,l=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let u=0,c;return f;function f(g){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(g),e.exit("gfmFootnoteCallLabelMarker"),m}function m(g){return g!==94?r(g):(e.enter("gfmFootnoteCallMarker"),e.consume(g),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",d)}function d(g){if(u>999||g===93&&!c||g===null||g===91||Tt(g))return r(g);if(g===93){e.exit("chunkString");const x=e.exit("gfmFootnoteCallString");return l.includes(gr(s.sliceSerialize(x)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(g),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),n):r(g)}return Tt(g)||(c=!0),u++,e.consume(g),g===92?y:d}function y(g){return g===91||g===92||g===93?(e.consume(g),u++,d):d(g)}}function F3(e,n,r){const s=this,l=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let u,c=0,f;return m;function m(S){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(S),e.exit("gfmFootnoteDefinitionLabelMarker"),d}function d(S){return S===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(S),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",y):r(S)}function y(S){if(c>999||S===93&&!f||S===null||S===91||Tt(S))return r(S);if(S===93){e.exit("chunkString");const D=e.exit("gfmFootnoteDefinitionLabelString");return u=gr(s.sliceSerialize(D)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(S),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),x}return Tt(S)||(f=!0),c++,e.consume(S),S===92?g:y}function g(S){return S===91||S===92||S===93?(e.consume(S),c++,y):y(S)}function x(S){return S===58?(e.enter("definitionMarker"),e.consume(S),e.exit("definitionMarker"),l.includes(u)||l.push(u),lt(e,w,"gfmFootnoteDefinitionWhitespace")):r(S)}function w(S){return n(S)}}function $3(e,n,r){return e.check(Vl,n,e.attempt(B3,n,r))}function Y3(e){e.exit("gfmFootnoteDefinition")}function G3(e,n,r){const s=this;return lt(e,l,"gfmFootnoteDefinitionIndent",5);function l(u){const c=s.events[s.events.length-1];return c&&c[1].type==="gfmFootnoteDefinitionIndent"&&c[2].sliceSerialize(c[1],!0).length===4?n(u):r(u)}}function V3(e){let r=(e||{}).singleTilde;const s={name:"strikethrough",tokenize:u,resolveAll:l};return r==null&&(r=!0),{text:{126:s},insideSpan:{null:[s]},attentionMarkers:{null:[126]}};function l(c,f){let m=-1;for(;++m<c.length;)if(c[m][0]==="enter"&&c[m][1].type==="strikethroughSequenceTemporary"&&c[m][1]._close){let d=m;for(;d--;)if(c[d][0]==="exit"&&c[d][1].type==="strikethroughSequenceTemporary"&&c[d][1]._open&&c[m][1].end.offset-c[m][1].start.offset===c[d][1].end.offset-c[d][1].start.offset){c[m][1].type="strikethroughSequence",c[d][1].type="strikethroughSequence";const y={type:"strikethrough",start:Object.assign({},c[d][1].start),end:Object.assign({},c[m][1].end)},g={type:"strikethroughText",start:Object.assign({},c[d][1].end),end:Object.assign({},c[m][1].start)},x=[["enter",y,f],["enter",c[d][1],f],["exit",c[d][1],f],["enter",g,f]],w=f.parser.constructs.insideSpan.null;w&&$n(x,x.length,0,Ku(w,c.slice(d+1,m),f)),$n(x,x.length,0,[["exit",g,f],["enter",c[m][1],f],["exit",c[m][1],f],["exit",y,f]]),$n(c,d-1,m-d+3,x),m=d+x.length-2;break}}for(m=-1;++m<c.length;)c[m][1].type==="strikethroughSequenceTemporary"&&(c[m][1].type="data");return c}function u(c,f,m){const d=this.previous,y=this.events;let g=0;return x;function x(S){return d===126&&y[y.length-1][1].type!=="characterEscape"?m(S):(c.enter("strikethroughSequenceTemporary"),w(S))}function w(S){const D=ga(d);if(S===126)return g>1?m(S):(c.consume(S),g++,w);if(g<2&&!r)return m(S);const q=c.exit("strikethroughSequenceTemporary"),L=ga(S);return q._open=!L||L===2&&!!D,q._close=!D||D===2&&!!L,f(S)}}}class J3{constructor(){this.map=[]}add(n,r,s){X3(this,n,r,s)}consume(n){if(this.map.sort(function(u,c){return u[0]-c[0]}),this.map.length===0)return;let r=this.map.length;const s=[];for(;r>0;)r-=1,s.push(n.slice(this.map[r][0]+this.map[r][1]),this.map[r][2]),n.length=this.map[r][0];s.push(n.slice()),n.length=0;let l=s.pop();for(;l;){for(const u of l)n.push(u);l=s.pop()}this.map.length=0}}function X3(e,n,r,s){let l=0;if(!(r===0&&s.length===0)){for(;l<e.map.length;){if(e.map[l][0]===n){e.map[l][1]+=r,e.map[l][2].push(...s);return}l+=1}e.map.push([n,r,s])}}function K3(e,n){let r=!1;const s=[];for(;n<e.length;){const l=e[n];if(r){if(l[0]==="enter")l[1].type==="tableContent"&&s.push(e[n+1][1].type==="tableDelimiterMarker"?"left":"none");else if(l[1].type==="tableContent"){if(e[n-1][1].type==="tableDelimiterMarker"){const u=s.length-1;s[u]=s[u]==="left"?"center":"right"}}else if(l[1].type==="tableDelimiterRow")break}else l[0]==="enter"&&l[1].type==="tableDelimiterRow"&&(r=!0);n+=1}return s}function Q3(){return{flow:{null:{name:"table",tokenize:Z3,resolveAll:W3}}}}function Z3(e,n,r){const s=this;let l=0,u=0,c;return f;function f(R){let X=s.events.length-1;for(;X>-1;){const re=s.events[X][1].type;if(re==="lineEnding"||re==="linePrefix")X--;else break}const J=X>-1?s.events[X][1].type:null,ae=J==="tableHead"||J==="tableRow"?z:m;return ae===z&&s.parser.lazy[s.now().line]?r(R):ae(R)}function m(R){return e.enter("tableHead"),e.enter("tableRow"),d(R)}function d(R){return R===124||(c=!0,u+=1),y(R)}function y(R){return R===null?r(R):Be(R)?u>1?(u=0,s.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(R),e.exit("lineEnding"),w):r(R):We(R)?lt(e,y,"whitespace")(R):(u+=1,c&&(c=!1,l+=1),R===124?(e.enter("tableCellDivider"),e.consume(R),e.exit("tableCellDivider"),c=!0,y):(e.enter("data"),g(R)))}function g(R){return R===null||R===124||Tt(R)?(e.exit("data"),y(R)):(e.consume(R),R===92?x:g)}function x(R){return R===92||R===124?(e.consume(R),g):g(R)}function w(R){return s.interrupt=!1,s.parser.lazy[s.now().line]?r(R):(e.enter("tableDelimiterRow"),c=!1,We(R)?lt(e,S,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(R):S(R))}function S(R){return R===45||R===58?q(R):R===124?(c=!0,e.enter("tableCellDivider"),e.consume(R),e.exit("tableCellDivider"),D):B(R)}function D(R){return We(R)?lt(e,q,"whitespace")(R):q(R)}function q(R){return R===58?(u+=1,c=!0,e.enter("tableDelimiterMarker"),e.consume(R),e.exit("tableDelimiterMarker"),L):R===45?(u+=1,L(R)):R===null||Be(R)?te(R):B(R)}function L(R){return R===45?(e.enter("tableDelimiterFiller"),$(R)):B(R)}function $(R){return R===45?(e.consume(R),$):R===58?(c=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(R),e.exit("tableDelimiterMarker"),T):(e.exit("tableDelimiterFiller"),T(R))}function T(R){return We(R)?lt(e,te,"whitespace")(R):te(R)}function te(R){return R===124?S(R):R===null||Be(R)?!c||l!==u?B(R):(e.exit("tableDelimiterRow"),e.exit("tableHead"),n(R)):B(R)}function B(R){return r(R)}function z(R){return e.enter("tableRow"),K(R)}function K(R){return R===124?(e.enter("tableCellDivider"),e.consume(R),e.exit("tableCellDivider"),K):R===null||Be(R)?(e.exit("tableRow"),n(R)):We(R)?lt(e,K,"whitespace")(R):(e.enter("data"),Q(R))}function Q(R){return R===null||R===124||Tt(R)?(e.exit("data"),K(R)):(e.consume(R),R===92?H:Q)}function H(R){return R===92||R===124?(e.consume(R),Q):Q(R)}}function W3(e,n){let r=-1,s=!0,l=0,u=[0,0,0,0],c=[0,0,0,0],f=!1,m=0,d,y,g;const x=new J3;for(;++r<e.length;){const w=e[r],S=w[1];w[0]==="enter"?S.type==="tableHead"?(f=!1,m!==0&&(Mb(x,n,m,d,y),y=void 0,m=0),d={type:"table",start:Object.assign({},S.start),end:Object.assign({},S.end)},x.add(r,0,[["enter",d,n]])):S.type==="tableRow"||S.type==="tableDelimiterRow"?(s=!0,g=void 0,u=[0,0,0,0],c=[0,r+1,0,0],f&&(f=!1,y={type:"tableBody",start:Object.assign({},S.start),end:Object.assign({},S.end)},x.add(r,0,[["enter",y,n]])),l=S.type==="tableDelimiterRow"?2:y?3:1):l&&(S.type==="data"||S.type==="tableDelimiterMarker"||S.type==="tableDelimiterFiller")?(s=!1,c[2]===0&&(u[1]!==0&&(c[0]=c[1],g=xu(x,n,u,l,void 0,g),u=[0,0,0,0]),c[2]=r)):S.type==="tableCellDivider"&&(s?s=!1:(u[1]!==0&&(c[0]=c[1],g=xu(x,n,u,l,void 0,g)),u=c,c=[u[1],r,0,0])):S.type==="tableHead"?(f=!0,m=r):S.type==="tableRow"||S.type==="tableDelimiterRow"?(m=r,u[1]!==0?(c[0]=c[1],g=xu(x,n,u,l,r,g)):c[1]!==0&&(g=xu(x,n,c,l,r,g)),l=0):l&&(S.type==="data"||S.type==="tableDelimiterMarker"||S.type==="tableDelimiterFiller")&&(c[3]=r)}for(m!==0&&Mb(x,n,m,d,y),x.consume(n.events),r=-1;++r<n.events.length;){const w=n.events[r];w[0]==="enter"&&w[1].type==="table"&&(w[1]._align=K3(n.events,r))}return e}function xu(e,n,r,s,l,u){const c=s===1?"tableHeader":s===2?"tableDelimiter":"tableData",f="tableContent";r[0]!==0&&(u.end=Object.assign({},ta(n.events,r[0])),e.add(r[0],0,[["exit",u,n]]));const m=ta(n.events,r[1]);if(u={type:c,start:Object.assign({},m),end:Object.assign({},m)},e.add(r[1],0,[["enter",u,n]]),r[2]!==0){const d=ta(n.events,r[2]),y=ta(n.events,r[3]),g={type:f,start:Object.assign({},d),end:Object.assign({},y)};if(e.add(r[2],0,[["enter",g,n]]),s!==2){const x=n.events[r[2]],w=n.events[r[3]];if(x[1].end=Object.assign({},w[1].end),x[1].type="chunkText",x[1].contentType="text",r[3]>r[2]+1){const S=r[2]+1,D=r[3]-r[2]-1;e.add(S,D,[])}}e.add(r[3]+1,0,[["exit",g,n]])}return l!==void 0&&(u.end=Object.assign({},ta(n.events,l)),e.add(l,0,[["exit",u,n]]),u=void 0),u}function Mb(e,n,r,s,l){const u=[],c=ta(n.events,r);l&&(l.end=Object.assign({},c),u.push(["exit",l,n])),s.end=Object.assign({},c),u.push(["exit",s,n]),e.add(r+1,0,u)}function ta(e,n){const r=e[n],s=r[0]==="enter"?"start":"end";return r[1][s]}const eO={name:"tasklistCheck",tokenize:nO};function tO(){return{text:{91:eO}}}function nO(e,n,r){const s=this;return l;function l(m){return s.previous!==null||!s._gfmTasklistFirstContentOfListItem?r(m):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(m),e.exit("taskListCheckMarker"),u)}function u(m){return Tt(m)?(e.enter("taskListCheckValueUnchecked"),e.consume(m),e.exit("taskListCheckValueUnchecked"),c):m===88||m===120?(e.enter("taskListCheckValueChecked"),e.consume(m),e.exit("taskListCheckValueChecked"),c):r(m)}function c(m){return m===93?(e.enter("taskListCheckMarker"),e.consume(m),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),f):r(m)}function f(m){return Be(m)?n(m):We(m)?e.check({tokenize:rO},n,r)(m):r(m)}}function rO(e,n,r){return lt(e,s,"whitespace");function s(l){return l===null?r(l):n(l)}}function iO(e){return Xx([j3(),P3(),V3(e),Q3(),tO()])}const sO={};function Db(e){const n=this,r=e||sO,s=n.data(),l=s.micromarkExtensions||(s.micromarkExtensions=[]),u=s.fromMarkdownExtensions||(s.fromMarkdownExtensions=[]),c=s.toMarkdownExtensions||(s.toMarkdownExtensions=[]);l.push(iO(r)),u.push(k3()),c.push(C3(r))}function aO(e){g1(e,[/\r?\n|\r/g,lO])}function lO(){return{type:"break"}}function Lb(){return function(e){aO(e)}}function oO({connected:e,hostId:n,request:r,subscribeEvents:s,taskId:l,runId:u}){const c=ti(),[f,m]=N.useState(!0),[d,y]=N.useState([]),[g,x]=N.useState(),[w,S]=N.useState(),D=g==="started"||g==="monitoring",q=g==="followup",L=g==="started"||g==="followup",[$,T]=N.useState(null),[te,B]=N.useState(!1),[z,K]=N.useState(""),[Q,H]=N.useState(!1),R=N.useRef(null),X=N.useRef(null),J=N.useRef(null),[ae,re]=N.useState(u==="latest"?void 0:u),F=u==="latest"&&ae===null;N.useEffect(()=>{if(u!=="latest"){re(u);return}e&&(re(void 0),r("taskrun.list",{task_id:l,limit:1}).then(_=>{var M,W;return re(((W=(M=_.entries)==null?void 0:M[0])==null?void 0:W.run_id)??null)}).catch(()=>re(null)))},[u,l,e,r]);async function P(){if(ae)try{const _=await r("task.result",{id:l,run_id:ae});if(_.error){console.error("No result:",_.error),c("/runs",{replace:!0});return}y(_.messages??[]),x(_.running_state),S(_.agent)}catch(_){console.error("Failed to load result:",_),c("/runs",{replace:!0})}finally{m(!1)}}async function V(_){var M;if(ae)try{const A=(M=(await r("task.reports",{id:l,run_id:ae,report_files:[_]})).reports)==null?void 0:M[0];A!=null&&A.data_url?T({file:_,data_url:A.data_url}):T({file:_,content:(A==null?void 0:A.content)??"Report not found."})}catch{T({file:_,content:"Failed to load report."})}}N.useEffect(()=>{!e||!ae||(m(!0),P())},[e,l,ae]),N.useEffect(()=>!e||!n||!ae?void 0:s(n,async M=>{try{const W=JSON.parse(new TextDecoder().decode(M.data));if(W.event_type!=="running-state"&&W.event_type!=="result-updated"||M.subject.split(".").pop()!==l||W.event_type==="result-updated"&&W.run_id&&W.run_id!==ae)return;P()}catch{}}),[e,n,l,ae,s,r]),N.useEffect(()=>{R.current&&(R.current.scrollTop=R.current.scrollHeight)},[d]),N.useEffect(()=>{f||F||!ae||J.current!==ae&&(J.current=ae,requestAnimationFrame(()=>{R.current&&(R.current.scrollTop=R.current.scrollHeight),window.scrollTo({top:document.documentElement.scrollHeight,behavior:"auto"})}))},[f,F,ae]);function ue(_){if(_==="input")return"User Input";if(_==="permission")return"Permission";if(_==="confirmation")return"Confirmation"}function xe(_){return _==="started"?"Task started":_==="finished"?"Task finished":_==="failed"?"Task failed":_==="error"?"Command failed":_==="aborted"?"Task aborted":_==="confirmation"?"Task confirmed":_==="stopped"?"Follow-up stopped":_??""}return b.jsxs("div",{className:"run-detail",children:[b.jsxs("button",{className:"run-detail-back",onClick:()=>c(-1),children:[b.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:b.jsx("path",{d:"M15 18l-6-6 6-6"})}),"Back"]}),F?b.jsxs("div",{className:"empty-state",children:[b.jsx("p",{className:"empty-state-text",children:"No runs yet"}),b.jsx("p",{className:"empty-state-hint",children:"This task hasn't been executed yet. Run it from the task menu or wait for its next trigger."})]}):f?b.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"var(--space-sm)",padding:"var(--space-sm) 0"},children:[b.jsx("div",{className:"skeleton-line",style:{width:"40%"}}),b.jsx("div",{className:"skeleton-line",style:{width:"55%"}}),b.jsx("div",{className:"skeleton-line",style:{width:"100%",height:"8rem",marginTop:"var(--space-sm)"}})]}):b.jsxs(b.Fragment,{children:[b.jsxs("div",{className:"chat-thread",ref:R,children:[d.map((_,M)=>{const W=L&&_.role==="assistant"&&!d.slice(M+1).some(A=>A.role==="assistant"||A.role==="user");return _.role==="status"&&_.type==="monitoring"?null:_.role==="status"?b.jsxs("div",{className:`chat-status${_.type==="error"?" chat-status--error":""}`,children:[b.jsxs("div",{children:[xe(_.type),_.time>0&&b.jsx("span",{className:"chat-status-time",children:Uu(_.time)})]}),_.content&&b.jsx("pre",{className:"chat-status-detail",children:_.content})]},M):b.jsxs("div",{className:`chat-message chat-message--${_.role}`,children:[_.role==="assistant"&&w&&b.jsx("div",{className:"chat-message-agent",children:hd(w)}),b.jsxs("div",{className:"chat-message-content",children:[b.jsx(Cb,{remarkPlugins:[Db,Lb],children:_.content}),W&&b.jsxs("div",{className:"chat-typing-indicator",children:[b.jsx("span",{}),b.jsx("span",{}),b.jsx("span",{})]})]}),_.attachments&&_.attachments.length>0&&b.jsx("div",{className:"chat-message-attachments",children:_.attachments.map(A=>b.jsx("button",{className:"chat-attachment-chip",onClick:()=>V(A),children:A},A))}),b.jsxs("div",{className:"chat-message-meta",children:[ue(_.type)&&b.jsx("span",{className:"chat-message-type",children:ue(_.type)}),_.time>0&&b.jsx("span",{children:Uu(_.time)})]})]},M)}),L&&(()=>{const _=d.filter(M=>M.role!=="status");return _.length===0||_[_.length-1].role!=="assistant"})()&&b.jsxs("div",{className:"chat-message chat-message--assistant",children:[w&&b.jsx("div",{className:"chat-message-agent",children:hd(w)}),b.jsxs("div",{className:"chat-typing-indicator",children:[b.jsx("span",{}),b.jsx("span",{}),b.jsx("span",{})]})]}),g==="monitoring"&&b.jsxs("div",{className:"chat-monitoring-indicator",children:[b.jsx("span",{className:"chat-monitoring-dot"}),"Monitoring command output"]})]}),D?b.jsx("div",{className:"chat-abort-bar",children:b.jsx("button",{className:"btn btn-secondary chat-abort-btn",disabled:te,onClick:async()=>{if(confirm("Abort this task?")){B(!0);try{await r("task.abort",{id:l})}catch(_){console.error("Abort failed:",_)}finally{B(!1)}}},children:te?"Aborting...":"Abort Task"})}):q?b.jsx("div",{className:"chat-input-bar",children:b.jsx("button",{className:"btn btn-secondary chat-stop-btn",disabled:te,onClick:async()=>{B(!0);try{await r("task.stop_followup",{id:l,run_id:ae})}catch(_){console.error("Stop failed:",_)}finally{B(!1)}},children:b.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor",children:b.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"2"})})})}):b.jsxs("form",{className:"chat-input-bar",onSubmit:async _=>{_.preventDefault();const M=z.trim();if(!(!M||Q)){H(!0);try{await r("task.followup",{id:l,run_id:ae,message:M}),K("")}catch(W){console.error("Follow-up failed:",W)}finally{H(!1)}}},children:[b.jsx("input",{ref:X,className:"chat-input",type:"text",placeholder:"Follow-up message",value:z,onChange:_=>K(_.target.value),disabled:Q}),b.jsx("button",{className:"btn btn-primary chat-send-btn",type:"submit",disabled:!z.trim()||Q,children:b.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[b.jsx("line",{x1:"22",y1:"2",x2:"11",y2:"13"}),b.jsx("polygon",{points:"22 2 15 22 11 13 2 9 22 2"})]})})]})]}),$&&b.jsx("div",{className:"report-dialog-overlay",onClick:()=>T(null),children:b.jsxs("div",{className:"report-dialog",onClick:_=>_.stopPropagation(),children:[b.jsxs("div",{className:"report-dialog-header",children:[b.jsx("span",{className:"report-dialog-title",children:$.file}),b.jsx("button",{className:"report-dialog-close",onClick:()=>T(null),"aria-label":"Close",children:b.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[b.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),b.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),b.jsx("div",{className:"report-dialog-body",children:$.data_url?b.jsx("img",{src:$.data_url,alt:$.file,style:{maxWidth:"100%",height:"auto"}}):b.jsx(Cb,{remarkPlugins:[Db,Lb],components:{a:({..._})=>b.jsx("a",{..._,target:"_blank",rel:"noopener noreferrer"})},children:$.content??""})})]})})]})}function uO(){const{getActiveHost:e}=xa(),n=e(),r=N.useRef(null);N.useEffect(()=>{if(Gn.isNativePlatform()||!n||n.directUrl||r.current===n.hostId)return;async function s(){var l;try{if(!("serviceWorker"in navigator)||!("PushManager"in window)){console.warn("[Push] Push notifications not supported");return}const u=await navigator.serviceWorker.ready;(l=u.active)==null||l.postMessage({type:"set-host-id",hostId:n.hostId});let c=await u.pushManager.getSubscription();if(!c){const{publicKey:m}=await fk("/api/push/vapid-key");if(!m){console.warn("[Push] No VAPID public key configured on server");return}if(await Notification.requestPermission()!=="granted"){console.log("[Push] Permission denied");return}c=await u.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:m})}const f=c.toJSON();await ck("/api/push/subscribe",{hostId:n.hostId,endpoint:f.endpoint,keys:{p256dh:f.keys.p256dh,auth:f.keys.auth}}),r.current=n.hostId}catch(u){console.error("[Push] Subscription failed:",u)}}s()},[n])}const cO="0.8.9";function fO(e,n){if(e.includes("-"))return!1;const r=e.split(".").map(Number),s=n.split(".").map(Number);for(let l=0;l<3;l++){if((r[l]??0)<(s[l]??0))return!0;if((r[l]??0)>(s[l]??0))return!1}return!1}function _l(){var Te;const{pairedHosts:e,activeHostId:n,removePairedHost:r,setHostLanUrl:s}=xa(),{connected:l,request:u,subscribeEvents:c,unauthorized:f}=wa(),m=ti(),d=Tr(),y=qS(),g=Mx("(min-width: 768px)"),x=d.pathname.startsWith("/tasks"),w=y.runId?void 0:y.taskId,S=!!(y.taskId&&y.runId),[D,q]=N.useState(!1),[L,$]=N.useState(!1),[T,te]=N.useState(null),[B,z]=N.useState(null),[K,Q]=N.useState({}),[H,R]=N.useState([]),[X,J]=N.useState(),[ae,re]=N.useState(new Map),[F,P]=N.useState(new Map),[V,ue]=N.useState(new Map),[xe,_]=N.useState(new Map);uO(),N.useEffect(()=>{window.scrollTo(0,0)},[n]),N.useEffect(()=>{l&&u("host.info").then(Ae=>{var Fe,He,et,mt,it,Pt;R(Ae.agents??[]),J(Ae.host_platform),Q(Ae.capability_tokens??{}),gk(Ae.agents??[]);const Je=Ae.version??null;z(Je),q(!!Je&&fO(Je,cO)),n&&s(n,Ae.lan_url??void 0);const rt=new Map,kt=new Map,Ke=new Map,ot=new Map;for(const Nt of Ae.pending_prompts??[])if(Nt.type==="confirmation")rt.set(Nt.key,{description:((Fe=Nt.meta)==null?void 0:Fe.description)??"",sessionName:(He=Nt.meta)==null?void 0:He.session_name});else if(Nt.type==="permission")kt.set(Nt.key,{permissions:Nt.params??[],sessionName:(et=Nt.meta)==null?void 0:et.session_name});else if(Nt.type==="input"){const Tn=Nt.params??((mt=Nt.meta)==null?void 0:mt.input_questions)??[];Ke.set(Nt.key,{questions:Tn,description:(it=Nt.meta)==null?void 0:it.description,sessionName:(Pt=Nt.meta)==null?void 0:Pt.session_name}),ot.set(Nt.key,new Array(Tn.length).fill(""))}re(rt),P(kt),ue(Ke),_(ot)}).catch(()=>{})},[l,n,u,s]),N.useEffect(()=>!l||!n?void 0:c(n,Je=>{const rt=Je.subject.split(".");if(rt.length<3)return;const kt=rt.slice(2).join(".");let Ke={};try{Ke=JSON.parse(new TextDecoder().decode(Je.data))}catch{return}const ot=Ke.event_type,Fe=Ke.session_id;if(ot==="input-request"&&Fe){const He=Ke.input_questions,et=Ke.session_name,mt=Ke.description;He!=null&&He.length&&(ue(it=>{if(it.has(Fe))return it;const Pt=new Map(it);return Pt.set(Fe,{questions:He,description:mt,sessionName:et}),Pt}),_(it=>{if(it.has(Fe))return it;const Pt=new Map(it);return Pt.set(Fe,new Array(He.length).fill("")),Pt}));return}if(ot==="input-resolved"&&Fe){ue(He=>{if(!He.has(Fe))return He;const et=new Map(He);return et.delete(Fe),et}),_(He=>{const et=new Map(He);return et.delete(Fe),et});return}if(ot==="confirm-request"&&Fe){const He=Ke.description,et=Ke.session_name;He&&re(mt=>{if(mt.has(Fe))return mt;const it=new Map(mt);return it.set(Fe,{description:He,sessionName:et}),it});return}if(ot==="confirm-resolved"&&Fe){re(He=>{if(!He.has(Fe))return He;const et=new Map(He);return et.delete(Fe),et});return}if(ot==="permission-request"){const He=Ke.required_permissions,et=Ke.session_name;He!=null&&He.length&&P(mt=>{if(mt.has(kt))return mt;const it=new Map(mt);return it.set(kt,{permissions:He,sessionName:et}),it});return}if(ot==="permission-resolved"){P(He=>{if(!He.has(kt))return He;const et=new Map(He);return et.delete(kt),et});return}}),[l,n,c]);async function M(Ae,Je){try{await u("task.user_input",{id:Ae,value:[Je]})}catch(rt){console.error("[Dashboard] Failed to respond to confirmation:",rt)}}async function W(Ae,Je){try{await u("task.user_input",{id:Ae,value:[Je]})}catch(rt){console.error("[Dashboard] Failed to respond to permission request:",rt)}}async function A(Ae,Je){try{await u("task.user_input",{id:Ae,value:Je})}catch(rt){console.error("[Dashboard] Failed to respond to input request:",rt)}}function ve(Ae,Je){hs()&&m(Je?`/runs/${encodeURIComponent(Ae)}/${encodeURIComponent(Je)}`:`/runs/${encodeURIComponent(Ae)}`)}async function Ce(){$(!0),te(null);try{const Ae=await u("host.update");if(Ae.error){te(Ae.error),$(!1);return}}catch{}setTimeout(()=>window.location.reload(),15e3)}const je=e.length>0,ze=je&&l&&n&&!f,qe=((Te=e.find(Ae=>Ae.hostId===n))==null?void 0:Te.clientToken)??null;return b.jsxs("div",{className:"dashboard",children:[g&&b.jsx(H0,{daemonVersion:B,capabilityTokens:K,activeClientToken:qe,request:u,onCapabilityTokensChange:Q}),b.jsxs("div",{className:"dashboard-content",children:[b.jsxs("header",{className:"app-header",children:[b.jsxs("div",{className:"app-title-bar",children:[!g&&b.jsx(H0,{daemonVersion:B,capabilityTokens:K,activeClientToken:qe,request:u,onCapabilityTokensChange:Q}),b.jsx("h1",{className:"app-title",children:"Palmier"}),b.jsx(Dk,{})]}),b.jsx("div",{className:"tab-bar",children:b.jsx(Nk,{})})]}),b.jsx("main",{className:"dashboard-main",children:f?b.jsxs("div",{className:"revoked-state",children:[b.jsx("div",{className:"revoked-icon",children:b.jsxs("svg",{width:"32",height:"32",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[b.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),b.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"}),b.jsx("line",{x1:"12",y1:"15",x2:"12",y2:"18"})]})}),b.jsx("h2",{className:"revoked-title",children:"Client Revoked"}),b.jsx("p",{className:"revoked-description",children:"This client was revoked by the host. To reconnect, generate a new pairing code on the host machine."}),b.jsx("div",{className:"revoked-command",children:b.jsx("code",{children:"palmier pair"})}),b.jsxs("div",{className:"revoked-actions",children:[b.jsx("button",{className:"btn btn-primary",onClick:()=>{hs()&&m("/pair")},children:"Re-pair Device"}),b.jsx("button",{className:"btn btn-secondary",onClick:()=>{n&&r(n)},children:"Remove Host"})]})]}):ze?b.jsxs(b.Fragment,{children:[x&&!S&&b.jsx(jk,{connected:l,hostId:n,request:u,subscribeEvents:c,agents:H,hostPlatform:X,isNotificationListener:!!qe&&K.notifications===qe,onViewRun:ve}),S?b.jsx(oO,{connected:l,hostId:n,request:u,subscribeEvents:c,taskId:y.taskId,runId:decodeURIComponent(y.runId)}):x?null:b.jsx(Bk,{connected:l,hostId:n,request:u,subscribeEvents:c,agents:H,hostPlatform:X,filterTaskId:w,onClearFilter:()=>{hs()&&m("/")}})]}):b.jsxs("div",{className:"empty-state",children:[b.jsx("p",{children:je?"Connecting to host...":"No host computer paired yet."}),!je&&b.jsx("button",{className:"btn btn-primary",onClick:()=>m("/pair"),children:"Pair Host"})]})}),D&&!L&&!T&&b.jsx("div",{className:"confirm-modal-overlay",children:b.jsxs("div",{className:"confirm-modal",children:[b.jsx("h2",{className:"confirm-modal-title",children:"Update Required"}),b.jsxs("p",{className:"confirm-modal-message",children:["Your Palmier host",B?` (v${B})`:""," is too old for this version of the app. Please update to continue."]}),b.jsx("div",{className:"confirm-modal-actions",children:b.jsx("button",{className:"btn btn-primary",onClick:Ce,children:"Update Now"})})]})}),L&&b.jsx("div",{className:"confirm-modal-overlay",children:b.jsxs("div",{className:"confirm-modal",children:[b.jsx("h2",{className:"confirm-modal-title",children:"Updating..."}),b.jsx("p",{className:"confirm-modal-message",children:"Installing update and restarting daemon. Please wait..."})]})}),T&&b.jsx("div",{className:"confirm-modal-overlay",children:b.jsxs("div",{className:"confirm-modal",children:[b.jsx("h2",{className:"confirm-modal-title",children:"Update Failed"}),b.jsx("p",{className:"confirm-modal-message",style:{whiteSpace:"pre-line"},children:T}),b.jsx("div",{className:"confirm-modal-actions",children:b.jsx("button",{className:"btn btn-secondary",onClick:()=>{te(null)},children:"Retry"})})]})})]}),fa.createPortal(b.jsxs(b.Fragment,{children:[[...ae.entries()].map(([Ae,{description:Je,sessionName:rt}])=>b.jsx("div",{className:"confirm-modal-overlay",children:b.jsxs("div",{className:"confirm-modal",children:[b.jsx("h2",{className:"confirm-modal-title",children:"Confirmation Required"}),rt&&b.jsx("p",{className:"confirm-modal-subtitle",children:rt}),b.jsx("p",{className:"confirm-modal-message",children:Je}),b.jsxs("div",{className:"confirm-modal-actions",children:[b.jsx("button",{className:"btn btn-primary",onClick:()=>M(Ae,"confirmed"),children:"Confirm"}),b.jsx("button",{className:"btn btn-secondary",onClick:()=>M(Ae,"aborted"),children:"Abort"})]})]})},Ae)),[...F.entries()].map(([Ae,{permissions:Je,sessionName:rt}])=>b.jsx("div",{className:"confirm-modal-overlay",children:b.jsxs("div",{className:"confirm-modal permission-modal",children:[b.jsx("h2",{className:"confirm-modal-title",children:"Permission Required"}),b.jsx("p",{className:"confirm-modal-message",children:b.jsx("strong",{children:rt||Ae})}),b.jsx("div",{className:"permission-list",children:Je.map((kt,Ke)=>b.jsxs("div",{className:"permission-item",children:[b.jsx("span",{className:"permission-name",children:kt.name}),kt.description&&b.jsx("span",{className:"permission-desc",children:kt.description})]},Ke))}),b.jsxs("div",{className:"permission-actions",children:[b.jsx("button",{className:"btn btn-primary",onClick:()=>W(Ae,"granted"),children:"Allow Once"}),b.jsx("button",{className:"btn btn-secondary",onClick:()=>W(Ae,"granted_all"),children:"Allow Always"})]}),b.jsx("button",{className:"permission-abort-link",onClick:()=>W(Ae,"aborted"),children:"Deny & Abort Task"})]})},Ae)),[...V.entries()].map(([Ae,{questions:Je,description:rt,sessionName:kt}])=>{const Ke=xe.get(Ae)??new Array(Je.length).fill("");return b.jsx("div",{className:"confirm-modal-overlay",children:b.jsxs("div",{className:"confirm-modal input-modal",children:[b.jsx("h2",{className:"confirm-modal-title",children:"Input Required"}),kt&&b.jsx("p",{className:"confirm-modal-subtitle",children:kt}),rt&&b.jsx("p",{className:"confirm-modal-message",children:rt}),b.jsx("div",{className:"input-list",children:Je.map((ot,Fe)=>b.jsxs("div",{className:"input-item",children:[b.jsx("label",{className:"input-label",children:ot}),b.jsx("input",{type:"text",className:"input-field",value:Ke[Fe]??"",onChange:He=>{_(et=>{const mt=new Map(et),it=[...mt.get(Ae)??[]];return it[Fe]=He.target.value,mt.set(Ae,it),mt})},autoFocus:Fe===0})]},Fe))}),b.jsx("div",{className:"input-actions",children:b.jsx("button",{className:"btn btn-primary",disabled:Ke.some(ot=>!ot.trim()),onClick:()=>A(Ae,Ke),children:"Submit"})}),b.jsx("button",{className:"permission-abort-link",onClick:()=>A(Ae,["aborted"]),children:"Cancel"})]})},Ae)})]}),document.body)]})}const hO=ms("Preferences",{web:()=>qd(()=>import("./web-CaRUL7Kz.js"),[]).then(e=>new e.PreferencesWeb)}),El=!!window.__PALMIER_SERVE__&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1");function dO(){const[e,n]=N.useState(""),[r,s]=N.useState(!1),[l,u]=N.useState(null),{addPairedHost:c}=xa(),f=ti();async function m(){const d=e.trim().toUpperCase();if(!d){u("Enter a pairing code.");return}s(!0),u(null);try{let y;if(El){const x=await fetch("/pair",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:d,label:navigator.userAgent})});if(!x.ok){const w=await x.json().catch(()=>({error:"Connection failed"}));throw new Error(w.error||`HTTP ${x.status}`)}y=await x.json()}else{const x=await fetch(`${zu}/api/config`);if(!x.ok)throw new Error("Failed to fetch server config");const w=await x.json();if(!w.natsWsUrl)throw new Error("Server has no NATS WebSocket URL configured");const S=await kx({servers:w.natsWsUrl,authenticator:gx(w.natsJwt,new TextEncoder().encode(w.natsNkeySeed))}),D=ju(),q=`pair.${d}`,L=await S.request(q,D.encode(JSON.stringify({label:navigator.userAgent})),{timeout:1e4});y=JSON.parse(D.decode(L.data)),await S.close()}const g={hostId:y.hostId,clientToken:y.clientToken,directUrl:El?window.location.origin:void 0,...y.hostName?{name:y.hostName}:{}};if(c(g),Gn.isNativePlatform()&&Ut){await hO.set({key:"hostId",value:y.hostId});try{const{token:x}=await Ut.getFcmToken();await fetch(`${zu}/api/fcm/register`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({hostId:y.hostId,fcmToken:x})})}catch(x){console.warn("FCM token registration failed:",x)}}f(Gn.isNativePlatform()?"/pair/setup":"/")}catch(y){const g=y instanceof Error?y.message:String(y);g.includes("timeout")||g.includes("TIMEOUT")||g.includes("503")||g.toLowerCase().includes("no responders")?u("Code not found or expired. Check the code and try again."):u(g)}finally{s(!1)}}return b.jsx("div",{className:"pair-page",children:b.jsxs("div",{className:"pair-card",children:[b.jsxs("div",{className:"pair-header",children:[b.jsx("h1",{className:"pair-title",children:El?"Pair":"Pair with Host"}),b.jsx("p",{className:"pair-subtitle",children:El?"Enter the pairing code shown in your terminal.":"Connect this device to a Palmier host"})]}),!El&&b.jsxs("div",{className:"pair-instructions",children:[b.jsxs("div",{className:"pair-instruction-block",children:[b.jsx("h3",{className:"pair-instruction-heading",children:"Setting up a new host?"}),b.jsxs("ol",{className:"pair-steps",children:[b.jsxs("li",{children:["Install at least one agent CLI (e.g., ",b.jsx("a",{href:"https://www.palmier.me/agents",target:"_blank",rel:"noopener noreferrer",children:"Claude Code, Gemini CLI, Codex CLI"}),")"]}),b.jsxs("li",{children:["Install Palmier on your host machine:",b.jsx("code",{className:"pair-command",children:"npm install -g palmier"})]}),b.jsxs("li",{children:["Run the setup wizard:",b.jsx("code",{className:"pair-command",children:"palmier init"})]}),b.jsx("li",{children:"A pairing code will display automatically"})]})]}),b.jsx("div",{className:"pair-instruction-divider"}),b.jsxs("div",{className:"pair-instruction-block",children:[b.jsx("h3",{className:"pair-instruction-heading",children:"Pairing an existing host?"}),b.jsxs("ol",{className:"pair-steps",children:[b.jsxs("li",{children:["Run ",b.jsx("code",{children:"palmier pair"})," on the host machine"]}),b.jsx("li",{children:"Enter the 6-character code below"})]})]})]}),b.jsxs("div",{className:"pair-form",children:[b.jsxs("label",{className:"form-label",htmlFor:"pair-code",children:["Pairing code",b.jsx("input",{id:"pair-code",type:"text",maxLength:6,value:e,onChange:d=>n(d.target.value.toUpperCase()),placeholder:"A7K9M2",className:"form-input form-input-mono pair-code-input",autoFocus:!0,autoComplete:"off",disabled:r})]}),l&&b.jsx("p",{className:"pair-error",children:l}),b.jsxs("button",{className:"btn btn-primary btn-full",onClick:m,disabled:r||!e.trim(),children:[r&&b.jsx("span",{className:"btn-spinner"}),r?"Pairing...":"Pair"]}),b.jsx("button",{className:"btn btn-secondary btn-full",onClick:()=>f("/"),disabled:r,children:"Cancel"}),b.jsxs("p",{className:"pair-consent",children:["By pairing, you agree to our"," ",b.jsx("a",{href:"https://www.palmier.me/terms",target:"_blank",rel:"noopener noreferrer",children:"Terms of Service"})," and"," ",b.jsx("a",{href:"https://www.palmier.me/privacy",target:"_blank",rel:"noopener noreferrer",children:"Privacy Policy"}),"."]})]})]})})}function mO(){const e=ti(),{connected:n,request:r}=wa(),{getActiveHost:s,setHostLanUrl:l}=xa(),u=s(),c=(u==null?void 0:u.clientToken)??null,[f,m]=N.useState({}),[d,y]=N.useState(!1);return N.useEffect(()=>{u||e("/",{replace:!0})},[u,e]),N.useEffect(()=>{if(!n||!u)return;const g=u.hostId;let x=!1;return r("host.info").then(w=>{x||(m(w.capability_tokens??{}),l(g,w.lan_url??void 0),y(!0))}).catch(()=>{x||y(!0)}),()=>{x=!0}},[n,u,r,l]),b.jsx("div",{className:"pair-setup",children:b.jsxs("div",{className:"pair-setup-inner",children:[b.jsx("h1",{className:"pair-setup-title",children:"What capabilities of this device do you want your host computer to have?"}),b.jsx("p",{className:"pair-setup-description",children:"You can change these later from the menu."}),d?b.jsx(Dx,{capabilityTokens:f,activeClientToken:c,request:r,onCapabilityTokensChange:m}):b.jsx("div",{className:"pair-setup-loading",children:"Connecting to host…"}),b.jsx("div",{className:"pair-setup-actions",children:b.jsx("button",{className:"btn btn-primary btn-full",onClick:()=>e("/",{replace:!0}),children:"Finish"})})]})})}function pO(){const e=ti();return N.useEffect(()=>{if(!Ut)return;const n=Ut.addListener("deepLink",({path:r})=>e(r));return()=>{n.then(r=>r.remove())}},[e]),null}function gO(){return b.jsx(P_,{children:b.jsxs(pk,{children:[b.jsx(pO,{}),b.jsxs(t_,{children:[b.jsx(Mi,{path:"/",element:b.jsx(_l,{})}),b.jsx(Mi,{path:"/tasks",element:b.jsx(_l,{})}),b.jsx(Mi,{path:"/runs",element:b.jsx(_l,{})}),b.jsx(Mi,{path:"/runs/:taskId",element:b.jsx(_l,{})}),b.jsx(Mi,{path:"/runs/:taskId/:runId",element:b.jsx(_l,{})}),b.jsx(Mi,{path:"/pair",element:b.jsx(dO,{})}),b.jsx(Mi,{path:"/pair/setup",element:b.jsx(mO,{})})]})]})})}rS.createRoot(document.getElementById("root")).render(b.jsx(N.StrictMode,{children:b.jsx(k_,{children:b.jsx(gO,{})})}));export{Pd as W};