palmier 0.7.3 → 0.7.6
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.
- package/README.md +26 -16
- package/dist/device-capabilities.d.ts +9 -0
- package/dist/device-capabilities.js +36 -0
- package/dist/mcp-tools.js +55 -38
- package/dist/pwa/assets/index-uSwkmHBs.js +118 -0
- package/dist/pwa/assets/{web-SlBB3mP3.js → web-7raT3zOZ.js} +1 -1
- package/dist/pwa/assets/{web-Dwi8DLNK.js → web-DnuoxUd4.js} +1 -1
- package/dist/pwa/index.html +1 -1
- package/dist/pwa/service-worker.js +1 -1
- package/dist/rpc-handler.js +24 -5
- package/dist/transports/http-transport.js +1 -1
- package/package.json +1 -1
- package/palmier-server/pwa/src/components/HostMenu.tsx +137 -141
- package/palmier-server/pwa/src/components/TaskListView.tsx +4 -4
- package/palmier-server/pwa/src/constants.ts +1 -1
- package/palmier-server/pwa/src/pages/Dashboard.tsx +4 -4
- package/palmier-server/server/src/index.ts +17 -12
- package/palmier-server/server/src/routes/device.ts +4 -4
- package/palmier-server/spec.md +2 -2
- package/src/device-capabilities.ts +55 -0
- package/src/mcp-tools.ts +54 -36
- package/src/rpc-handler.ts +24 -5
- package/src/transports/http-transport.ts +1 -1
- package/dist/location-device.d.ts +0 -8
- package/dist/location-device.js +0 -32
- package/dist/pwa/assets/index-CPIqbV9-.js +0 -118
- package/src/location-device.ts +0 -35
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
var Ew=Object.defineProperty;var kw=(e,n,r)=>n in e?Ew(e,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[n]=r;var C=(e,n,r)=>kw(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"]'))a(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"&&a(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 a(l){if(l.ep)return;l.ep=!0;const u=r(l);fetch(l.href,u)}})();function x0(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Jf={exports:{}},nl={};/**
|
|
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 Oy;function Cw(){if(Oy)return nl;Oy=1;var e=Symbol.for("react.transitional.element"),n=Symbol.for("react.fragment");function r(a,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:a,key:c,ref:l!==void 0?l:null,props:u}}return nl.Fragment=n,nl.jsx=r,nl.jsxs=r,nl}var Ry;function Aw(){return Ry||(Ry=1,Jf.exports=Cw()),Jf.exports}var w=Aw(),Xf={exports:{}},Ge={};/**
|
|
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 My;function Tw(){if(My)return Ge;My=1;var e=Symbol.for("react.transitional.element"),n=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),a=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"),b=Symbol.iterator;function x(U){return U===null||typeof U!="object"?null:(U=b&&U[b]||U["@@iterator"],typeof U=="function"?U:null)}var k={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},z=Object.assign,B={};function M(U,W,_){this.props=U,this.context=W,this.refs=B,this.updater=_||k}M.prototype.isReactComponent={},M.prototype.setState=function(U,W){if(typeof U!="object"&&typeof U!="function"&&U!=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,U,W,"setState")},M.prototype.forceUpdate=function(U){this.updater.enqueueForceUpdate(this,U,"forceUpdate")};function F(){}F.prototype=M.prototype;function G(U,W,_){this.props=U,this.context=W,this.refs=B,this.updater=_||k}var se=G.prototype=new F;se.constructor=G,z(se,M.prototype),se.isPureReactComponent=!0;var O=Array.isArray;function j(){}var V={H:null,A:null,T:null,S:null},J=Object.prototype.hasOwnProperty;function Y(U,W,_){var he=_.ref;return{$$typeof:e,type:U,key:W,ref:he!==void 0?he:null,props:_}}function N(U,W){return Y(U.type,W,U.props)}function Q(U){return typeof U=="object"&&U!==null&&U.$$typeof===e}function Z(U){var W={"=":"=0",":":"=2"};return"$"+U.replace(/[=:]/g,function(_){return W[_]})}var ge=/\/+/g;function fe(U,W){return typeof U=="object"&&U!==null&&U.key!=null?Z(""+U.key):W.toString(36)}function H(U){switch(U.status){case"fulfilled":return U.value;case"rejected":throw U.reason;default:switch(typeof U.status=="string"?U.then(j,j):(U.status="pending",U.then(function(W){U.status==="pending"&&(U.status="fulfilled",U.value=W)},function(W){U.status==="pending"&&(U.status="rejected",U.reason=W)})),U.status){case"fulfilled":return U.value;case"rejected":throw U.reason}}throw U}function q(U,W,_,he,pe){var ve=typeof U;(ve==="undefined"||ve==="boolean")&&(U=null);var je=!1;if(U===null)je=!0;else switch(ve){case"bigint":case"string":case"number":je=!0;break;case"object":switch(U.$$typeof){case e:case n:je=!0;break;case y:return je=U._init,q(je(U._payload),W,_,he,pe)}}if(je)return pe=pe(U),je=he===""?"."+fe(U,0):he,O(pe)?(_="",je!=null&&(_=je.replace(ge,"$&/")+"/"),q(pe,W,_,"",function(ze){return ze})):pe!=null&&(Q(pe)&&(pe=N(pe,_+(pe.key==null||U&&U.key===pe.key?"":(""+pe.key).replace(ge,"$&/")+"/")+je)),W.push(pe)),1;je=0;var De=he===""?".":he+":";if(O(U))for(var ke=0;ke<U.length;ke++)he=U[ke],ve=De+fe(he,ke),je+=q(he,W,_,ve,pe);else if(ke=x(U),typeof ke=="function")for(U=ke.call(U),ke=0;!(he=U.next()).done;)he=he.value,ve=De+fe(he,ke++),je+=q(he,W,_,ve,pe);else if(ve==="object"){if(typeof U.then=="function")return q(H(U),W,_,he,pe);throw W=String(U),Error("Objects are not valid as a React child (found: "+(W==="[object Object]"?"object with keys {"+Object.keys(U).join(", ")+"}":W)+"). If you meant to render a collection of children, use an array instead.")}return je}function re(U,W,_){if(U==null)return U;var he=[],pe=0;return q(U,he,"","",function(ve){return W.call(_,ve,pe++)}),he}function ye(U){if(U._status===-1){var W=U._result;W=W(),W.then(function(_){(U._status===0||U._status===-1)&&(U._status=1,U._result=_)},function(_){(U._status===0||U._status===-1)&&(U._status=2,U._result=_)}),U._status===-1&&(U._status=0,U._result=W)}if(U._status===1)return U._result.default;throw U._result}var _e=typeof reportError=="function"?reportError:function(U){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var W=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof U=="object"&&U!==null&&typeof U.message=="string"?String(U.message):String(U),error:U});if(!window.dispatchEvent(W))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",U);return}console.error(U)},R={map:re,forEach:function(U,W,_){re(U,function(){W.apply(this,arguments)},_)},count:function(U){var W=0;return re(U,function(){W++}),W},toArray:function(U){return re(U,function(W){return W})||[]},only:function(U){if(!Q(U))throw Error("React.Children.only expected to receive a single React element child.");return U}};return Ge.Activity=g,Ge.Children=R,Ge.Component=M,Ge.Fragment=r,Ge.Profiler=l,Ge.PureComponent=G,Ge.StrictMode=a,Ge.Suspense=m,Ge.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=V,Ge.__COMPILER_RUNTIME={__proto__:null,c:function(U){return V.H.useMemoCache(U)}},Ge.cache=function(U){return function(){return U.apply(null,arguments)}},Ge.cacheSignal=function(){return null},Ge.cloneElement=function(U,W,_){if(U==null)throw Error("The argument must be a React element, but you passed "+U+".");var he=z({},U.props),pe=U.key;if(W!=null)for(ve in W.key!==void 0&&(pe=""+W.key),W)!J.call(W,ve)||ve==="key"||ve==="__self"||ve==="__source"||ve==="ref"&&W.ref===void 0||(he[ve]=W[ve]);var ve=arguments.length-2;if(ve===1)he.children=_;else if(1<ve){for(var je=Array(ve),De=0;De<ve;De++)je[De]=arguments[De+2];he.children=je}return Y(U.type,pe,he)},Ge.createContext=function(U){return U={$$typeof:c,_currentValue:U,_currentValue2:U,_threadCount:0,Provider:null,Consumer:null},U.Provider=U,U.Consumer={$$typeof:u,_context:U},U},Ge.createElement=function(U,W,_){var he,pe={},ve=null;if(W!=null)for(he in W.key!==void 0&&(ve=""+W.key),W)J.call(W,he)&&he!=="key"&&he!=="__self"&&he!=="__source"&&(pe[he]=W[he]);var je=arguments.length-2;if(je===1)pe.children=_;else if(1<je){for(var De=Array(je),ke=0;ke<je;ke++)De[ke]=arguments[ke+2];pe.children=De}if(U&&U.defaultProps)for(he in je=U.defaultProps,je)pe[he]===void 0&&(pe[he]=je[he]);return Y(U,ve,pe)},Ge.createRef=function(){return{current:null}},Ge.forwardRef=function(U){return{$$typeof:f,render:U}},Ge.isValidElement=Q,Ge.lazy=function(U){return{$$typeof:y,_payload:{_status:-1,_result:U},_init:ye}},Ge.memo=function(U,W){return{$$typeof:d,type:U,compare:W===void 0?null:W}},Ge.startTransition=function(U){var W=V.T,_={};V.T=_;try{var he=U(),pe=V.S;pe!==null&&pe(_,he),typeof he=="object"&&he!==null&&typeof he.then=="function"&&he.then(j,_e)}catch(ve){_e(ve)}finally{W!==null&&_.types!==null&&(W.types=_.types),V.T=W}},Ge.unstable_useCacheRefresh=function(){return V.H.useCacheRefresh()},Ge.use=function(U){return V.H.use(U)},Ge.useActionState=function(U,W,_){return V.H.useActionState(U,W,_)},Ge.useCallback=function(U,W){return V.H.useCallback(U,W)},Ge.useContext=function(U){return V.H.useContext(U)},Ge.useDebugValue=function(){},Ge.useDeferredValue=function(U,W){return V.H.useDeferredValue(U,W)},Ge.useEffect=function(U,W){return V.H.useEffect(U,W)},Ge.useEffectEvent=function(U){return V.H.useEffectEvent(U)},Ge.useId=function(){return V.H.useId()},Ge.useImperativeHandle=function(U,W,_){return V.H.useImperativeHandle(U,W,_)},Ge.useInsertionEffect=function(U,W){return V.H.useInsertionEffect(U,W)},Ge.useLayoutEffect=function(U,W){return V.H.useLayoutEffect(U,W)},Ge.useMemo=function(U,W){return V.H.useMemo(U,W)},Ge.useOptimistic=function(U,W){return V.H.useOptimistic(U,W)},Ge.useReducer=function(U,W,_){return V.H.useReducer(U,W,_)},Ge.useRef=function(U){return V.H.useRef(U)},Ge.useState=function(U){return V.H.useState(U)},Ge.useSyncExternalStore=function(U,W,_){return V.H.useSyncExternalStore(U,W,_)},Ge.useTransition=function(){return V.H.useTransition()},Ge.version="19.2.4",Ge}var Dy;function cd(){return Dy||(Dy=1,Xf.exports=Tw()),Xf.exports}var L=cd(),Qf={exports:{}},rl={},Kf={exports:{}},Zf={};/**
|
|
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 zy;function jw(){return zy||(zy=1,(function(e){function n(q,re){var ye=q.length;q.push(re);e:for(;0<ye;){var _e=ye-1>>>1,R=q[_e];if(0<l(R,re))q[_e]=re,q[ye]=R,ye=_e;else break e}}function r(q){return q.length===0?null:q[0]}function a(q){if(q.length===0)return null;var re=q[0],ye=q.pop();if(ye!==re){q[0]=ye;e:for(var _e=0,R=q.length,U=R>>>1;_e<U;){var W=2*(_e+1)-1,_=q[W],he=W+1,pe=q[he];if(0>l(_,ye))he<R&&0>l(pe,_)?(q[_e]=pe,q[he]=ye,_e=he):(q[_e]=_,q[W]=ye,_e=W);else if(he<R&&0>l(pe,ye))q[_e]=pe,q[he]=ye,_e=he;else break e}}return re}function l(q,re){var ye=q.sortIndex-re.sortIndex;return ye!==0?ye:q.id-re.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,b=3,x=!1,k=!1,z=!1,B=!1,M=typeof setTimeout=="function"?setTimeout:null,F=typeof clearTimeout=="function"?clearTimeout:null,G=typeof setImmediate<"u"?setImmediate:null;function se(q){for(var re=r(d);re!==null;){if(re.callback===null)a(d);else if(re.startTime<=q)a(d),re.sortIndex=re.expirationTime,n(m,re);else break;re=r(d)}}function O(q){if(z=!1,se(q),!k)if(r(m)!==null)k=!0,j||(j=!0,Z());else{var re=r(d);re!==null&&H(O,re.startTime-q)}}var j=!1,V=-1,J=5,Y=-1;function N(){return B?!0:!(e.unstable_now()-Y<J)}function Q(){if(B=!1,j){var q=e.unstable_now();Y=q;var re=!0;try{e:{k=!1,z&&(z=!1,F(V),V=-1),x=!0;var ye=b;try{t:{for(se(q),g=r(m);g!==null&&!(g.expirationTime>q&&N());){var _e=g.callback;if(typeof _e=="function"){g.callback=null,b=g.priorityLevel;var R=_e(g.expirationTime<=q);if(q=e.unstable_now(),typeof R=="function"){g.callback=R,se(q),re=!0;break t}g===r(m)&&a(m),se(q)}else a(m);g=r(m)}if(g!==null)re=!0;else{var U=r(d);U!==null&&H(O,U.startTime-q),re=!1}}break e}finally{g=null,b=ye,x=!1}re=void 0}}finally{re?Z():j=!1}}}var Z;if(typeof G=="function")Z=function(){G(Q)};else if(typeof MessageChannel<"u"){var ge=new MessageChannel,fe=ge.port2;ge.port1.onmessage=Q,Z=function(){fe.postMessage(null)}}else Z=function(){M(Q,0)};function H(q,re){V=M(function(){q(e.unstable_now())},re)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(q){q.callback=null},e.unstable_forceFrameRate=function(q){0>q||125<q?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):J=0<q?Math.floor(1e3/q):5},e.unstable_getCurrentPriorityLevel=function(){return b},e.unstable_next=function(q){switch(b){case 1:case 2:case 3:var re=3;break;default:re=b}var ye=b;b=re;try{return q()}finally{b=ye}},e.unstable_requestPaint=function(){B=!0},e.unstable_runWithPriority=function(q,re){switch(q){case 1:case 2:case 3:case 4:case 5:break;default:q=3}var ye=b;b=q;try{return re()}finally{b=ye}},e.unstable_scheduleCallback=function(q,re,ye){var _e=e.unstable_now();switch(typeof ye=="object"&&ye!==null?(ye=ye.delay,ye=typeof ye=="number"&&0<ye?_e+ye:_e):ye=_e,q){case 1:var R=-1;break;case 2:R=250;break;case 5:R=1073741823;break;case 4:R=1e4;break;default:R=5e3}return R=ye+R,q={id:y++,callback:re,priorityLevel:q,startTime:ye,expirationTime:R,sortIndex:-1},ye>_e?(q.sortIndex=ye,n(d,q),r(m)===null&&q===r(d)&&(z?(F(V),V=-1):z=!0,H(O,ye-_e))):(q.sortIndex=R,n(m,q),k||x||(k=!0,j||(j=!0,Z()))),q},e.unstable_shouldYield=N,e.unstable_wrapCallback=function(q){var re=b;return function(){var ye=b;b=re;try{return q.apply(this,arguments)}finally{b=ye}}}})(Zf)),Zf}var Ly;function Nw(){return Ly||(Ly=1,Kf.exports=jw()),Kf.exports}var Wf={exports:{}},nn={};/**
|
|
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 Uy;function Ow(){if(Uy)return nn;Uy=1;var e=cd();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 a={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 nn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=a,nn.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)},nn.flushSync=function(m){var d=c.T,y=a.p;try{if(c.T=null,a.p=2,m)return m()}finally{c.T=d,a.p=y,a.d.f()}},nn.preconnect=function(m,d){typeof m=="string"&&(d?(d=d.crossOrigin,d=typeof d=="string"?d==="use-credentials"?d:"":void 0):d=null,a.d.C(m,d))},nn.prefetchDNS=function(m){typeof m=="string"&&a.d.D(m)},nn.preinit=function(m,d){if(typeof m=="string"&&d&&typeof d.as=="string"){var y=d.as,g=f(y,d.crossOrigin),b=typeof d.integrity=="string"?d.integrity:void 0,x=typeof d.fetchPriority=="string"?d.fetchPriority:void 0;y==="style"?a.d.S(m,typeof d.precedence=="string"?d.precedence:void 0,{crossOrigin:g,integrity:b,fetchPriority:x}):y==="script"&&a.d.X(m,{crossOrigin:g,integrity:b,fetchPriority:x,nonce:typeof d.nonce=="string"?d.nonce:void 0})}},nn.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);a.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&&a.d.M(m)},nn.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);a.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})}},nn.preloadModule=function(m,d){if(typeof m=="string")if(d){var y=f(d.as,d.crossOrigin);a.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 a.d.m(m)},nn.requestFormReset=function(m){a.d.r(m)},nn.unstable_batchedUpdates=function(m,d){return m(d)},nn.useFormState=function(m,d,y){return c.H.useFormState(m,d,y)},nn.useFormStatus=function(){return c.H.useHostTransitionStatus()},nn.version="19.2.4",nn}var By;function w0(){if(By)return Wf.exports;By=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(),Wf.exports=Ow(),Wf.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 Py;function Rw(){if(Py)return rl;Py=1;var e=Nw(),n=cd(),r=w0();function a(t){var i="https://react.dev/errors/"+t;if(1<arguments.length){i+="?args[]="+encodeURIComponent(arguments[1]);for(var s=2;s<arguments.length;s++)i+="&args[]="+encodeURIComponent(arguments[s])}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,s=t;if(t.alternate)for(;i.return;)i=i.return;else{t=i;do i=t,(i.flags&4098)!==0&&(s=i.return),t=i.return;while(t)}return i.tag===3?s: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(a(188))}function d(t){var i=t.alternate;if(!i){if(i=u(t),i===null)throw Error(a(188));return i!==t?null:t}for(var s=t,o=i;;){var h=s.return;if(h===null)break;var p=h.alternate;if(p===null){if(o=h.return,o!==null){s=o;continue}break}if(h.child===p.child){for(p=h.child;p;){if(p===s)return m(h),t;if(p===o)return m(h),i;p=p.sibling}throw Error(a(188))}if(s.return!==o.return)s=h,o=p;else{for(var v=!1,S=h.child;S;){if(S===s){v=!0,s=h,o=p;break}if(S===o){v=!0,o=h,s=p;break}S=S.sibling}if(!v){for(S=p.child;S;){if(S===s){v=!0,s=p,o=h;break}if(S===o){v=!0,o=p,s=h;break}S=S.sibling}if(!v)throw Error(a(189))}}if(s.alternate!==o)throw Error(a(190))}if(s.tag!==3)throw Error(a(188));return s.stateNode.current===s?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,b=Symbol.for("react.element"),x=Symbol.for("react.transitional.element"),k=Symbol.for("react.portal"),z=Symbol.for("react.fragment"),B=Symbol.for("react.strict_mode"),M=Symbol.for("react.profiler"),F=Symbol.for("react.consumer"),G=Symbol.for("react.context"),se=Symbol.for("react.forward_ref"),O=Symbol.for("react.suspense"),j=Symbol.for("react.suspense_list"),V=Symbol.for("react.memo"),J=Symbol.for("react.lazy"),Y=Symbol.for("react.activity"),N=Symbol.for("react.memo_cache_sentinel"),Q=Symbol.iterator;function Z(t){return t===null||typeof t!="object"?null:(t=Q&&t[Q]||t["@@iterator"],typeof t=="function"?t:null)}var ge=Symbol.for("react.client.reference");function fe(t){if(t==null)return null;if(typeof t=="function")return t.$$typeof===ge?null:t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case z:return"Fragment";case M:return"Profiler";case B:return"StrictMode";case O:return"Suspense";case j:return"SuspenseList";case Y:return"Activity"}if(typeof t=="object")switch(t.$$typeof){case k:return"Portal";case G:return t.displayName||"Context";case F:return(t._context.displayName||"Context")+".Consumer";case se:var i=t.render;return t=t.displayName,t||(t=i.displayName||i.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case V:return i=t.displayName||null,i!==null?i:fe(t.type)||"Memo";case J:i=t._payload,t=t._init;try{return fe(t(i))}catch{}}return null}var H=Array.isArray,q=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,re=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ye={pending:!1,data:null,method:null,action:null},_e=[],R=-1;function U(t){return{current:t}}function W(t){0>R||(t.current=_e[R],_e[R]=null,R--)}function _(t,i){R++,_e[R]=t.current,t.current=i}var he=U(null),pe=U(null),ve=U(null),je=U(null);function De(t,i){switch(_(ve,i),_(pe,t),_(he,null),i.nodeType){case 9:case 11:t=(t=i.documentElement)&&(t=t.namespaceURI)?ey(t):0;break;default:if(t=i.tagName,i=i.namespaceURI)i=ey(i),t=ty(i,t);else switch(t){case"svg":t=1;break;case"math":t=2;break;default:t=0}}W(he),_(he,t)}function ke(){W(he),W(pe),W(ve)}function ze(t){t.memoizedState!==null&&_(je,t);var i=he.current,s=ty(i,t.type);i!==s&&(_(pe,t),_(he,s))}function $e(t){pe.current===t&&(W(he),W(pe)),je.current===t&&(W(je),Zs._currentValue=ye)}var Ie,qe;function rt(t){if(Ie===void 0)try{throw Error()}catch(s){var i=s.stack.trim().match(/\n( *(at )?)/);Ie=i&&i[1]||"",qe=-1<s.stack.indexOf(`
|
|
42
|
+
at`)?" (<anonymous>)":-1<s.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
43
|
+
`+Ie+t+qe}var xe=!1;function Le(t,i){if(!t||xe)return"";xe=!0;var s=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var o={DetermineComponentFrameRoot:function(){try{if(i){var me=function(){throw Error()};if(Object.defineProperty(me.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(me,[])}catch(ae){var ne=ae}Reflect.construct(t,[],me)}else{try{me.call()}catch(ae){ne=ae}t.call(me.prototype)}}else{try{throw Error()}catch(ae){ne=ae}(me=t())&&typeof me.catch=="function"&&me.catch(function(){})}}catch(ae){if(ae&&ne&&typeof ae.stack=="string")return[ae.stack,ne.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],S=p[1];if(v&&S){var P=v.split(`
|
|
44
|
+
`),te=S.split(`
|
|
45
|
+
`);for(h=o=0;o<P.length&&!P[o].includes("DetermineComponentFrameRoot");)o++;for(;h<te.length&&!te[h].includes("DetermineComponentFrameRoot");)h++;if(o===P.length||h===te.length)for(o=P.length-1,h=te.length-1;1<=o&&0<=h&&P[o]!==te[h];)h--;for(;1<=o&&0<=h;o--,h--)if(P[o]!==te[h]){if(o!==1||h!==1)do if(o--,h--,0>h||P[o]!==te[h]){var le=`
|
|
46
|
+
`+P[o].replace(" at new "," at ");return t.displayName&&le.includes("<anonymous>")&&(le=le.replace("<anonymous>",t.displayName)),le}while(1<=o&&0<=h);break}}}finally{xe=!1,Error.prepareStackTrace=s}return(s=t?t.displayName||t.name:"")?rt(s):""}function Fe(t,i){switch(t.tag){case 26:case 27:case 5:return rt(t.type);case 16:return rt("Lazy");case 13:return t.child!==i&&i!==null?rt("Suspense Fallback"):rt("Suspense");case 19:return rt("SuspenseList");case 0:case 15:return Le(t.type,!1);case 11:return Le(t.type.render,!1);case 1:return Le(t.type,!0);case 31:return rt("Activity");default:return""}}function Tt(t){try{var i="",s=null;do i+=Fe(t,s),s=t,t=t.return;while(t);return i}catch(o){return`
|
|
47
|
+
Error generating stack: `+o.message+`
|
|
48
|
+
`+o.stack}}var hn=Object.prototype.hasOwnProperty,Wn=e.unstable_scheduleCallback,en=e.unstable_cancelCallback,wn=e.unstable_shouldYield,fr=e.unstable_requestPaint,yt=e.unstable_now,Mi=e.unstable_getCurrentPriorityLevel,oe=e.unstable_ImmediatePriority,Se=e.unstable_UserBlockingPriority,Be=e.unstable_NormalPriority,Ye=e.unstable_LowPriority,it=e.unstable_IdlePriority,Ce=e.log,Ve=e.unstable_setDisableYieldValue,st=null,ot=null;function ct(t){if(typeof Ce=="function"&&Ve(t),ot&&typeof ot.setStrictMode=="function")try{ot.setStrictMode(st,t)}catch{}}var mt=Math.clz32?Math.clz32:la,Bn=Math.log,sn=Math.LN2;function la(t){return t>>>=0,t===0?32:31-(Bn(t)/sn|0)|0}var Qr=256,kr=262144,Kr=4194304;function er(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 Di(t,i,s){var o=t.pendingLanes;if(o===0)return 0;var h=0,p=t.suspendedLanes,v=t.pingedLanes;t=t.warmLanes;var S=o&134217727;return S!==0?(o=S&~p,o!==0?h=er(o):(v&=S,v!==0?h=er(v):s||(s=S&~t,s!==0&&(h=er(s))))):(S=o&~p,S!==0?h=er(S):v!==0?h=er(v):s||(s=o&~t,s!==0&&(h=er(s)))),h===0?0:i!==0&&i!==h&&(i&p)===0&&(p=h&-h,s=i&-i,p>=s||p===32&&(s&4194048)!==0)?i:h}function zi(t,i){return(t.pendingLanes&~(t.suspendedLanes&~t.pingedLanes)&i)===0}function hs(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 oa(){var t=Kr;return Kr<<=1,(Kr&62914560)===0&&(Kr=4194304),t}function Zr(t){for(var i=[],s=0;31>s;s++)i.push(t);return i}function tr(t,i){t.pendingLanes|=i,i!==268435456&&(t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0)}function Wr(t,i,s,o,h,p){var v=t.pendingLanes;t.pendingLanes=s,t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0,t.expiredLanes&=s,t.entangledLanes&=s,t.errorRecoveryDisabledLanes&=s,t.shellSuspendCounter=0;var S=t.entanglements,P=t.expirationTimes,te=t.hiddenUpdates;for(s=v&~s;0<s;){var le=31-mt(s),me=1<<le;S[le]=0,P[le]=-1;var ne=te[le];if(ne!==null)for(te[le]=null,le=0;le<ne.length;le++){var ae=ne[le];ae!==null&&(ae.lane&=-536870913)}s&=~me}o!==0&&ei(t,o,0),p!==0&&h===0&&t.tag!==0&&(t.suspendedLanes|=p&~(v&~i))}function ei(t,i,s){t.pendingLanes|=i,t.suspendedLanes&=~i;var o=31-mt(i);t.entangledLanes|=i,t.entanglements[o]=t.entanglements[o]|1073741824|s&261930}function Li(t,i){var s=t.entangledLanes|=i;for(t=t.entanglements;s;){var o=31-mt(s),h=1<<o;h&i|t[o]&i&&(t[o]|=i),s&=~h}}function ti(t,i){var s=i&-i;return s=(s&42)!==0?1:Cr(s),(s&(t.suspendedLanes|i))!==0?0:s}function Cr(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 Ui(t){return t&=-t,2<t?8<t?(t&134217727)!==0?32:268435456:8:2}function ds(){var t=re.p;return t!==0?t:(t=window.event,t===void 0?32:Ey(t.type))}function Ul(t,i){var s=re.p;try{return re.p=t,i()}finally{re.p=s}}var hr=Math.random().toString(36).slice(2),wt="__reactFiber$"+hr,Mt="__reactProps$"+hr,Sn="__reactContainer$"+hr,Bi="__reactEvents$"+hr,ms="__reactListeners$"+hr,Bl="__reactHandles$"+hr,Pl="__reactResources$"+hr,$t="__reactMarker$"+hr;function ua(t){delete t[wt],delete t[Mt],delete t[Bi],delete t[ms],delete t[Bl]}function E(t){var i=t[wt];if(i)return i;for(var s=t.parentNode;s;){if(i=s[Sn]||s[wt]){if(s=i.alternate,i.child!==null||s!==null&&s.child!==null)for(t=oy(t);t!==null;){if(s=t[wt])return s;t=oy(t)}return i}t=s,s=t.parentNode}return null}function T(t){if(t=t[wt]||t[Sn]){var i=t.tag;if(i===5||i===6||i===13||i===31||i===26||i===27||i===3)return t}return null}function A(t){var i=t.tag;if(i===5||i===26||i===27||i===6)return t.stateNode;throw Error(a(33))}function D(t){var i=t[Pl];return i||(i=t[Pl]={hoistableStyles:new Map,hoistableScripts:new Map}),i}function I(t){t[$t]=!0}var K=new Set,de={};function be(t,i){ie(t,i),ie(t+"Capture",i)}function ie(t,i){for(de[t]=i,t=0;t<i.length;t++)K.add(i[t])}var ce=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={},Ke={};function kt(t){return hn.call(Ke,t)?!0:hn.call(Oe,t)?!1:ce.test(t)?Ke[t]=!0:(Oe[t]=!0,!1)}function tn(t,i,s){if(kt(i))if(s===null)t.removeAttribute(i);else{switch(typeof s){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,""+s)}}function nr(t,i,s){if(s===null)t.removeAttribute(i);else{switch(typeof s){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(i);return}t.setAttribute(i,""+s)}}function Ar(t,i,s,o){if(o===null)t.removeAttribute(s);else{switch(typeof o){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(s);return}t.setAttributeNS(i,s,""+o)}}function Pn(t){switch(typeof t){case"bigint":case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function Yd(t){var i=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(i==="checkbox"||i==="radio")}function yv(t,i,s){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){s=""+v,p.call(this,v)}}),Object.defineProperty(t,i,{enumerable:o.enumerable}),{getValue:function(){return s},setValue:function(v){s=""+v},stopTracking:function(){t._valueTracker=null,delete t[i]}}}}function Hu(t){if(!t._valueTracker){var i=Yd(t)?"checked":"value";t._valueTracker=yv(t,i,""+t[i])}}function Vd(t){if(!t)return!1;var i=t._valueTracker;if(!i)return!0;var s=i.getValue(),o="";return t&&(o=Yd(t)?t.checked?"true":"false":t.value),t=o,t!==s?(i.setValue(t),!0):!1}function Hl(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 bv=/[\n"\\]/g;function Hn(t){return t.replace(bv,function(i){return"\\"+i.charCodeAt(0).toString(16)+" "})}function qu(t,i,s,o,h,p,v,S){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=""+Pn(i)):t.value!==""+Pn(i)&&(t.value=""+Pn(i)):v!=="submit"&&v!=="reset"||t.removeAttribute("value"),i!=null?Iu(t,v,Pn(i)):s!=null?Iu(t,v,Pn(s)):o!=null&&t.removeAttribute("value"),h==null&&p!=null&&(t.defaultChecked=!!p),h!=null&&(t.checked=h&&typeof h!="function"&&typeof h!="symbol"),S!=null&&typeof S!="function"&&typeof S!="symbol"&&typeof S!="boolean"?t.name=""+Pn(S):t.removeAttribute("name")}function Jd(t,i,s,o,h,p,v,S){if(p!=null&&typeof p!="function"&&typeof p!="symbol"&&typeof p!="boolean"&&(t.type=p),i!=null||s!=null){if(!(p!=="submit"&&p!=="reset"||i!=null)){Hu(t);return}s=s!=null?""+Pn(s):"",i=i!=null?""+Pn(i):s,S||i===t.value||(t.value=i),t.defaultValue=i}o=o??h,o=typeof o!="function"&&typeof o!="symbol"&&!!o,t.checked=S?t.checked:!!o,t.defaultChecked=!!o,v!=null&&typeof v!="function"&&typeof v!="symbol"&&typeof v!="boolean"&&(t.name=v),Hu(t)}function Iu(t,i,s){i==="number"&&Hl(t.ownerDocument)===t||t.defaultValue===""+s||(t.defaultValue=""+s)}function ca(t,i,s,o){if(t=t.options,i){i={};for(var h=0;h<s.length;h++)i["$"+s[h]]=!0;for(s=0;s<t.length;s++)h=i.hasOwnProperty("$"+t[s].value),t[s].selected!==h&&(t[s].selected=h),h&&o&&(t[s].defaultSelected=!0)}else{for(s=""+Pn(s),i=null,h=0;h<t.length;h++){if(t[h].value===s){t[h].selected=!0,o&&(t[h].defaultSelected=!0);return}i!==null||t[h].disabled||(i=t[h])}i!==null&&(i.selected=!0)}}function Xd(t,i,s){if(i!=null&&(i=""+Pn(i),i!==t.value&&(t.value=i),s==null)){t.defaultValue!==i&&(t.defaultValue=i);return}t.defaultValue=s!=null?""+Pn(s):""}function Qd(t,i,s,o){if(i==null){if(o!=null){if(s!=null)throw Error(a(92));if(H(o)){if(1<o.length)throw Error(a(93));o=o[0]}s=o}s==null&&(s=""),i=s}s=Pn(i),t.defaultValue=s,o=t.textContent,o===s&&o!==""&&o!==null&&(t.value=o),Hu(t)}function fa(t,i){if(i){var s=t.firstChild;if(s&&s===t.lastChild&&s.nodeType===3){s.nodeValue=i;return}}t.textContent=i}var vv=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 Kd(t,i,s){var o=i.indexOf("--")===0;s==null||typeof s=="boolean"||s===""?o?t.setProperty(i,""):i==="float"?t.cssFloat="":t[i]="":o?t.setProperty(i,s):typeof s!="number"||s===0||vv.has(i)?i==="float"?t.cssFloat=s:t[i]=(""+s).trim():t[i]=s+"px"}function Zd(t,i,s){if(i!=null&&typeof i!="object")throw Error(a(62));if(t=t.style,s!=null){for(var o in s)!s.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)&&s[h]!==o&&Kd(t,h,o)}else for(var p in i)i.hasOwnProperty(p)&&Kd(t,p,i[p])}function Fu(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 xv=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"]]),wv=/^[\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 ql(t){return wv.test(""+t)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":t}function Tr(){}var $u=null;function Gu(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var ha=null,da=null;function Wd(t){var i=T(t);if(i&&(t=i.stateNode)){var s=t[Mt]||null;e:switch(t=i.stateNode,i.type){case"input":if(qu(t,s.value,s.defaultValue,s.defaultValue,s.checked,s.defaultChecked,s.type,s.name),i=s.name,s.type==="radio"&&i!=null){for(s=t;s.parentNode;)s=s.parentNode;for(s=s.querySelectorAll('input[name="'+Hn(""+i)+'"][type="radio"]'),i=0;i<s.length;i++){var o=s[i];if(o!==t&&o.form===t.form){var h=o[Mt]||null;if(!h)throw Error(a(90));qu(o,h.value,h.defaultValue,h.defaultValue,h.checked,h.defaultChecked,h.type,h.name)}}for(i=0;i<s.length;i++)o=s[i],o.form===t.form&&Vd(o)}break e;case"textarea":Xd(t,s.value,s.defaultValue);break e;case"select":i=s.value,i!=null&&ca(t,!!s.multiple,i,!1)}}}var Yu=!1;function em(t,i,s){if(Yu)return t(i,s);Yu=!0;try{var o=t(i);return o}finally{if(Yu=!1,(ha!==null||da!==null)&&(jo(),ha&&(i=ha,t=da,da=ha=null,Wd(i),t)))for(i=0;i<t.length;i++)Wd(t[i])}}function ps(t,i){var s=t.stateNode;if(s===null)return null;var o=s[Mt]||null;if(o===null)return null;s=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(s&&typeof s!="function")throw Error(a(231,i,typeof s));return s}var jr=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Vu=!1;if(jr)try{var gs={};Object.defineProperty(gs,"passive",{get:function(){Vu=!0}}),window.addEventListener("test",gs,gs),window.removeEventListener("test",gs,gs)}catch{Vu=!1}var ni=null,Ju=null,Il=null;function tm(){if(Il)return Il;var t,i=Ju,s=i.length,o,h="value"in ni?ni.value:ni.textContent,p=h.length;for(t=0;t<s&&i[t]===h[t];t++);var v=s-t;for(o=1;o<=v&&i[s-o]===h[p-o];o++);return Il=h.slice(t,1<o?1-o:void 0)}function Fl(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 $l(){return!0}function nm(){return!1}function dn(t){function i(s,o,h,p,v){this._reactName=s,this._targetInst=h,this.type=o,this.nativeEvent=p,this.target=v,this.currentTarget=null;for(var S in t)t.hasOwnProperty(S)&&(s=t[S],this[S]=s?s(p):p[S]);return this.isDefaultPrevented=(p.defaultPrevented!=null?p.defaultPrevented:p.returnValue===!1)?$l:nm,this.isPropagationStopped=nm,this}return g(i.prototype,{preventDefault:function(){this.defaultPrevented=!0;var s=this.nativeEvent;s&&(s.preventDefault?s.preventDefault():typeof s.returnValue!="unknown"&&(s.returnValue=!1),this.isDefaultPrevented=$l)},stopPropagation:function(){var s=this.nativeEvent;s&&(s.stopPropagation?s.stopPropagation():typeof s.cancelBubble!="unknown"&&(s.cancelBubble=!0),this.isPropagationStopped=$l)},persist:function(){},isPersistent:$l}),i}var Pi={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Gl=dn(Pi),ys=g({},Pi,{view:0,detail:0}),Sv=dn(ys),Xu,Qu,bs,Yl=g({},ys,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Zu,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!==bs&&(bs&&t.type==="mousemove"?(Xu=t.screenX-bs.screenX,Qu=t.screenY-bs.screenY):Qu=Xu=0,bs=t),Xu)},movementY:function(t){return"movementY"in t?t.movementY:Qu}}),rm=dn(Yl),_v=g({},Yl,{dataTransfer:0}),Ev=dn(_v),kv=g({},ys,{relatedTarget:0}),Ku=dn(kv),Cv=g({},Pi,{animationName:0,elapsedTime:0,pseudoElement:0}),Av=dn(Cv),Tv=g({},Pi,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),jv=dn(Tv),Nv=g({},Pi,{data:0}),im=dn(Nv),Ov={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Rv={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"},Mv={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Dv(t){var i=this.nativeEvent;return i.getModifierState?i.getModifierState(t):(t=Mv[t])?!!i[t]:!1}function Zu(){return Dv}var zv=g({},ys,{key:function(t){if(t.key){var i=Ov[t.key]||t.key;if(i!=="Unidentified")return i}return t.type==="keypress"?(t=Fl(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?Rv[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Zu,charCode:function(t){return t.type==="keypress"?Fl(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?Fl(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),Lv=dn(zv),Uv=g({},Yl,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),am=dn(Uv),Bv=g({},ys,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Zu}),Pv=dn(Bv),Hv=g({},Pi,{propertyName:0,elapsedTime:0,pseudoElement:0}),qv=dn(Hv),Iv=g({},Yl,{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}),Fv=dn(Iv),$v=g({},Pi,{newState:0,oldState:0}),Gv=dn($v),Yv=[9,13,27,32],Wu=jr&&"CompositionEvent"in window,vs=null;jr&&"documentMode"in document&&(vs=document.documentMode);var Vv=jr&&"TextEvent"in window&&!vs,sm=jr&&(!Wu||vs&&8<vs&&11>=vs),lm=" ",om=!1;function um(t,i){switch(t){case"keyup":return Yv.indexOf(i.keyCode)!==-1;case"keydown":return i.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function cm(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var ma=!1;function Jv(t,i){switch(t){case"compositionend":return cm(i);case"keypress":return i.which!==32?null:(om=!0,lm);case"textInput":return t=i.data,t===lm&&om?null:t;default:return null}}function Xv(t,i){if(ma)return t==="compositionend"||!Wu&&um(t,i)?(t=tm(),Il=Ju=ni=null,ma=!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 sm&&i.locale!=="ko"?null:i.data;default:return null}}var Qv={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 fm(t){var i=t&&t.nodeName&&t.nodeName.toLowerCase();return i==="input"?!!Qv[t.type]:i==="textarea"}function hm(t,i,s,o){ha?da?da.push(o):da=[o]:ha=o,i=Lo(i,"onChange"),0<i.length&&(s=new Gl("onChange","change",null,s,o),t.push({event:s,listeners:i}))}var xs=null,ws=null;function Kv(t){Jg(t,0)}function Vl(t){var i=A(t);if(Vd(i))return t}function dm(t,i){if(t==="change")return i}var mm=!1;if(jr){var ec;if(jr){var tc="oninput"in document;if(!tc){var pm=document.createElement("div");pm.setAttribute("oninput","return;"),tc=typeof pm.oninput=="function"}ec=tc}else ec=!1;mm=ec&&(!document.documentMode||9<document.documentMode)}function gm(){xs&&(xs.detachEvent("onpropertychange",ym),ws=xs=null)}function ym(t){if(t.propertyName==="value"&&Vl(ws)){var i=[];hm(i,ws,t,Gu(t)),em(Kv,i)}}function Zv(t,i,s){t==="focusin"?(gm(),xs=i,ws=s,xs.attachEvent("onpropertychange",ym)):t==="focusout"&&gm()}function Wv(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return Vl(ws)}function ex(t,i){if(t==="click")return Vl(i)}function tx(t,i){if(t==="input"||t==="change")return Vl(i)}function nx(t,i){return t===i&&(t!==0||1/t===1/i)||t!==t&&i!==i}var _n=typeof Object.is=="function"?Object.is:nx;function Ss(t,i){if(_n(t,i))return!0;if(typeof t!="object"||t===null||typeof i!="object"||i===null)return!1;var s=Object.keys(t),o=Object.keys(i);if(s.length!==o.length)return!1;for(o=0;o<s.length;o++){var h=s[o];if(!hn.call(i,h)||!_n(t[h],i[h]))return!1}return!0}function bm(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function vm(t,i){var s=bm(t);t=0;for(var o;s;){if(s.nodeType===3){if(o=t+s.textContent.length,t<=i&&o>=i)return{node:s,offset:i-t};t=o}e:{for(;s;){if(s.nextSibling){s=s.nextSibling;break e}s=s.parentNode}s=void 0}s=bm(s)}}function xm(t,i){return t&&i?t===i?!0:t&&t.nodeType===3?!1:i&&i.nodeType===3?xm(t,i.parentNode):"contains"in t?t.contains(i):t.compareDocumentPosition?!!(t.compareDocumentPosition(i)&16):!1:!1}function wm(t){t=t!=null&&t.ownerDocument!=null&&t.ownerDocument.defaultView!=null?t.ownerDocument.defaultView:window;for(var i=Hl(t.document);i instanceof t.HTMLIFrameElement;){try{var s=typeof i.contentWindow.location.href=="string"}catch{s=!1}if(s)t=i.contentWindow;else break;i=Hl(t.document)}return i}function nc(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 rx=jr&&"documentMode"in document&&11>=document.documentMode,pa=null,rc=null,_s=null,ic=!1;function Sm(t,i,s){var o=s.window===s?s.document:s.nodeType===9?s:s.ownerDocument;ic||pa==null||pa!==Hl(o)||(o=pa,"selectionStart"in o&&nc(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}),_s&&Ss(_s,o)||(_s=o,o=Lo(rc,"onSelect"),0<o.length&&(i=new Gl("onSelect","select",null,i,s),t.push({event:i,listeners:o}),i.target=pa)))}function Hi(t,i){var s={};return s[t.toLowerCase()]=i.toLowerCase(),s["Webkit"+t]="webkit"+i,s["Moz"+t]="moz"+i,s}var ga={animationend:Hi("Animation","AnimationEnd"),animationiteration:Hi("Animation","AnimationIteration"),animationstart:Hi("Animation","AnimationStart"),transitionrun:Hi("Transition","TransitionRun"),transitionstart:Hi("Transition","TransitionStart"),transitioncancel:Hi("Transition","TransitionCancel"),transitionend:Hi("Transition","TransitionEnd")},ac={},_m={};jr&&(_m=document.createElement("div").style,"AnimationEvent"in window||(delete ga.animationend.animation,delete ga.animationiteration.animation,delete ga.animationstart.animation),"TransitionEvent"in window||delete ga.transitionend.transition);function qi(t){if(ac[t])return ac[t];if(!ga[t])return t;var i=ga[t],s;for(s in i)if(i.hasOwnProperty(s)&&s in _m)return ac[t]=i[s];return t}var Em=qi("animationend"),km=qi("animationiteration"),Cm=qi("animationstart"),ix=qi("transitionrun"),ax=qi("transitionstart"),sx=qi("transitioncancel"),Am=qi("transitionend"),Tm=new Map,sc="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(" ");sc.push("scrollEnd");function rr(t,i){Tm.set(t,i),be(i,[t])}var Jl=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)},qn=[],ya=0,lc=0;function Xl(){for(var t=ya,i=lc=ya=0;i<t;){var s=qn[i];qn[i++]=null;var o=qn[i];qn[i++]=null;var h=qn[i];qn[i++]=null;var p=qn[i];if(qn[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&&jm(s,h,p)}}function Ql(t,i,s,o){qn[ya++]=t,qn[ya++]=i,qn[ya++]=s,qn[ya++]=o,lc|=o,t.lanes|=o,t=t.alternate,t!==null&&(t.lanes|=o)}function oc(t,i,s,o){return Ql(t,i,s,o),Kl(t)}function Ii(t,i){return Ql(t,null,null,i),Kl(t)}function jm(t,i,s){t.lanes|=s;var o=t.alternate;o!==null&&(o.lanes|=s);for(var h=!1,p=t.return;p!==null;)p.childLanes|=s,o=p.alternate,o!==null&&(o.childLanes|=s),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-mt(s),t=p.hiddenUpdates,o=t[h],o===null?t[h]=[i]:o.push(i),i.lane=s|536870912),p):null}function Kl(t){if(50<Gs)throw Gs=0,bf=null,Error(a(185));for(var i=t.return;i!==null;)t=i,i=t.return;return t.tag===3?t.stateNode:null}var ba={};function lx(t,i,s,o){this.tag=t,this.key=s,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 En(t,i,s,o){return new lx(t,i,s,o)}function uc(t){return t=t.prototype,!(!t||!t.isReactComponent)}function Nr(t,i){var s=t.alternate;return s===null?(s=En(t.tag,i,t.key,t.mode),s.elementType=t.elementType,s.type=t.type,s.stateNode=t.stateNode,s.alternate=t,t.alternate=s):(s.pendingProps=i,s.type=t.type,s.flags=0,s.subtreeFlags=0,s.deletions=null),s.flags=t.flags&65011712,s.childLanes=t.childLanes,s.lanes=t.lanes,s.child=t.child,s.memoizedProps=t.memoizedProps,s.memoizedState=t.memoizedState,s.updateQueue=t.updateQueue,i=t.dependencies,s.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext},s.sibling=t.sibling,s.index=t.index,s.ref=t.ref,s.refCleanup=t.refCleanup,s}function Nm(t,i){t.flags&=65011714;var s=t.alternate;return s===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=s.childLanes,t.lanes=s.lanes,t.child=s.child,t.subtreeFlags=0,t.deletions=null,t.memoizedProps=s.memoizedProps,t.memoizedState=s.memoizedState,t.updateQueue=s.updateQueue,t.type=s.type,i=s.dependencies,t.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext}),t}function Zl(t,i,s,o,h,p){var v=0;if(o=t,typeof t=="function")uc(t)&&(v=1);else if(typeof t=="string")v=hw(t,s,he.current)?26:t==="html"||t==="head"||t==="body"?27:5;else e:switch(t){case Y:return t=En(31,s,i,h),t.elementType=Y,t.lanes=p,t;case z:return Fi(s.children,h,p,i);case B:v=8,h|=24;break;case M:return t=En(12,s,i,h|2),t.elementType=M,t.lanes=p,t;case O:return t=En(13,s,i,h),t.elementType=O,t.lanes=p,t;case j:return t=En(19,s,i,h),t.elementType=j,t.lanes=p,t;default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case G:v=10;break e;case F:v=9;break e;case se:v=11;break e;case V:v=14;break e;case J:v=16,o=null;break e}v=29,s=Error(a(130,t===null?"null":typeof t,"")),o=null}return i=En(v,s,i,h),i.elementType=t,i.type=o,i.lanes=p,i}function Fi(t,i,s,o){return t=En(7,t,o,i),t.lanes=s,t}function cc(t,i,s){return t=En(6,t,null,i),t.lanes=s,t}function Om(t){var i=En(18,null,null,0);return i.stateNode=t,i}function fc(t,i,s){return i=En(4,t.children!==null?t.children:[],t.key,i),i.lanes=s,i.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},i}var Rm=new WeakMap;function In(t,i){if(typeof t=="object"&&t!==null){var s=Rm.get(t);return s!==void 0?s:(i={value:t,source:i,stack:Tt(i)},Rm.set(t,i),i)}return{value:t,source:i,stack:Tt(i)}}var va=[],xa=0,Wl=null,Es=0,Fn=[],$n=0,ri=null,dr=1,mr="";function Or(t,i){va[xa++]=Es,va[xa++]=Wl,Wl=t,Es=i}function Mm(t,i,s){Fn[$n++]=dr,Fn[$n++]=mr,Fn[$n++]=ri,ri=t;var o=dr;t=mr;var h=32-mt(o)-1;o&=~(1<<h),s+=1;var p=32-mt(i)+h;if(30<p){var v=h-h%5;p=(o&(1<<v)-1).toString(32),o>>=v,h-=v,dr=1<<32-mt(i)+h|s<<h|o,mr=p+t}else dr=1<<p|s<<h|o,mr=t}function hc(t){t.return!==null&&(Or(t,1),Mm(t,1,0))}function dc(t){for(;t===Wl;)Wl=va[--xa],va[xa]=null,Es=va[--xa],va[xa]=null;for(;t===ri;)ri=Fn[--$n],Fn[$n]=null,mr=Fn[--$n],Fn[$n]=null,dr=Fn[--$n],Fn[$n]=null}function Dm(t,i){Fn[$n++]=dr,Fn[$n++]=mr,Fn[$n++]=ri,dr=i.id,mr=i.overflow,ri=t}var Xt=null,Ct=null,at=!1,ii=null,Gn=!1,mc=Error(a(519));function ai(t){var i=Error(a(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw ks(In(i,t)),mc}function zm(t){var i=t.stateNode,s=t.type,o=t.memoizedProps;switch(i[wt]=t,i[Mt]=o,s){case"dialog":We("cancel",i),We("close",i);break;case"iframe":case"object":case"embed":We("load",i);break;case"video":case"audio":for(s=0;s<Vs.length;s++)We(Vs[s],i);break;case"source":We("error",i);break;case"img":case"image":case"link":We("error",i),We("load",i);break;case"details":We("toggle",i);break;case"input":We("invalid",i),Jd(i,o.value,o.defaultValue,o.checked,o.defaultChecked,o.type,o.name,!0);break;case"select":We("invalid",i);break;case"textarea":We("invalid",i),Qd(i,o.value,o.defaultValue,o.children)}s=o.children,typeof s!="string"&&typeof s!="number"&&typeof s!="bigint"||i.textContent===""+s||o.suppressHydrationWarning===!0||Zg(i.textContent,s)?(o.popover!=null&&(We("beforetoggle",i),We("toggle",i)),o.onScroll!=null&&We("scroll",i),o.onScrollEnd!=null&&We("scrollend",i),o.onClick!=null&&(i.onclick=Tr),i=!0):i=!1,i||ai(t,!0)}function Lm(t){for(Xt=t.return;Xt;)switch(Xt.tag){case 5:case 31:case 13:Gn=!1;return;case 27:case 3:Gn=!0;return;default:Xt=Xt.return}}function wa(t){if(t!==Xt)return!1;if(!at)return Lm(t),at=!0,!1;var i=t.tag,s;if((s=i!==3&&i!==27)&&((s=i===5)&&(s=t.type,s=!(s!=="form"&&s!=="button")||Mf(t.type,t.memoizedProps)),s=!s),s&&Ct&&ai(t),Lm(t),i===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(a(317));Ct=ly(t)}else if(i===31){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(a(317));Ct=ly(t)}else i===27?(i=Ct,vi(t.type)?(t=Bf,Bf=null,Ct=t):Ct=i):Ct=Xt?Vn(t.stateNode.nextSibling):null;return!0}function $i(){Ct=Xt=null,at=!1}function pc(){var t=ii;return t!==null&&(yn===null?yn=t:yn.push.apply(yn,t),ii=null),t}function ks(t){ii===null?ii=[t]:ii.push(t)}var gc=U(null),Gi=null,Rr=null;function si(t,i,s){_(gc,i._currentValue),i._currentValue=s}function Mr(t){t._currentValue=gc.current,W(gc)}function yc(t,i,s){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===s)break;t=t.return}}function bc(t,i,s,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 S=p;p=h;for(var P=0;P<i.length;P++)if(S.context===i[P]){p.lanes|=s,S=p.alternate,S!==null&&(S.lanes|=s),yc(p.return,s,t),o||(v=null);break e}p=S.next}}else if(h.tag===18){if(v=h.return,v===null)throw Error(a(341));v.lanes|=s,p=v.alternate,p!==null&&(p.lanes|=s),yc(v,s,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 Sa(t,i,s,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(a(387));if(v=v.memoizedProps,v!==null){var S=h.type;_n(h.pendingProps.value,v.value)||(t!==null?t.push(S):t=[S])}}else if(h===je.current){if(v=h.alternate,v===null)throw Error(a(387));v.memoizedState.memoizedState!==h.memoizedState.memoizedState&&(t!==null?t.push(Zs):t=[Zs])}h=h.return}t!==null&&bc(i,t,s,o),i.flags|=262144}function eo(t){for(t=t.firstContext;t!==null;){if(!_n(t.context._currentValue,t.memoizedValue))return!0;t=t.next}return!1}function Yi(t){Gi=t,Rr=null,t=t.dependencies,t!==null&&(t.firstContext=null)}function Qt(t){return Um(Gi,t)}function to(t,i){return Gi===null&&Yi(t),Um(t,i)}function Um(t,i){var s=i._currentValue;if(i={context:i,memoizedValue:s,next:null},Rr===null){if(t===null)throw Error(a(308));Rr=i,t.dependencies={lanes:0,firstContext:i},t.flags|=524288}else Rr=Rr.next=i;return s}var ox=typeof AbortController<"u"?AbortController:function(){var t=[],i=this.signal={aborted:!1,addEventListener:function(s,o){t.push(o)}};this.abort=function(){i.aborted=!0,t.forEach(function(s){return s()})}},ux=e.unstable_scheduleCallback,cx=e.unstable_NormalPriority,Pt={$$typeof:G,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function vc(){return{controller:new ox,data:new Map,refCount:0}}function Cs(t){t.refCount--,t.refCount===0&&ux(cx,function(){t.controller.abort()})}var As=null,xc=0,_a=0,Ea=null;function fx(t,i){if(As===null){var s=As=[];xc=0,_a=Ef(),Ea={status:"pending",value:void 0,then:function(o){s.push(o)}}}return xc++,i.then(Bm,Bm),i}function Bm(){if(--xc===0&&As!==null){Ea!==null&&(Ea.status="fulfilled");var t=As;As=null,_a=0,Ea=null;for(var i=0;i<t.length;i++)(0,t[i])()}}function hx(t,i){var s=[],o={status:"pending",value:null,reason:null,then:function(h){s.push(h)}};return t.then(function(){o.status="fulfilled",o.value=i;for(var h=0;h<s.length;h++)(0,s[h])(i)},function(h){for(o.status="rejected",o.reason=h,h=0;h<s.length;h++)(0,s[h])(void 0)}),o}var Pm=q.S;q.S=function(t,i){Sg=yt(),typeof i=="object"&&i!==null&&typeof i.then=="function"&&fx(t,i),Pm!==null&&Pm(t,i)};var Vi=U(null);function wc(){var t=Vi.current;return t!==null?t:St.pooledCache}function no(t,i){i===null?_(Vi,Vi.current):_(Vi,i.pool)}function Hm(){var t=wc();return t===null?null:{parent:Pt._currentValue,pool:t}}var ka=Error(a(460)),Sc=Error(a(474)),ro=Error(a(542)),io={then:function(){}};function qm(t){return t=t.status,t==="fulfilled"||t==="rejected"}function Im(t,i,s){switch(s=t[s],s===void 0?t.push(i):s!==i&&(i.then(Tr,Tr),i=s),i.status){case"fulfilled":return i.value;case"rejected":throw t=i.reason,$m(t),t;default:if(typeof i.status=="string")i.then(Tr,Tr);else{if(t=St,t!==null&&100<t.shellSuspendCounter)throw Error(a(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,$m(t),t}throw Xi=i,ka}}function Ji(t){try{var i=t._init;return i(t._payload)}catch(s){throw s!==null&&typeof s=="object"&&typeof s.then=="function"?(Xi=s,ka):s}}var Xi=null;function Fm(){if(Xi===null)throw Error(a(459));var t=Xi;return Xi=null,t}function $m(t){if(t===ka||t===ro)throw Error(a(483))}var Ca=null,Ts=0;function ao(t){var i=Ts;return Ts+=1,Ca===null&&(Ca=[]),Im(Ca,t,i)}function js(t,i){i=i.props.ref,t.ref=i!==void 0?i:null}function so(t,i){throw i.$$typeof===b?Error(a(525)):(t=Object.prototype.toString.call(i),Error(a(31,t==="[object Object]"?"object with keys {"+Object.keys(i).join(", ")+"}":t)))}function Gm(t){function i(X,$){if(t){var ee=X.deletions;ee===null?(X.deletions=[$],X.flags|=16):ee.push($)}}function s(X,$){if(!t)return null;for(;$!==null;)i(X,$),$=$.sibling;return null}function o(X){for(var $=new Map;X!==null;)X.key!==null?$.set(X.key,X):$.set(X.index,X),X=X.sibling;return $}function h(X,$){return X=Nr(X,$),X.index=0,X.sibling=null,X}function p(X,$,ee){return X.index=ee,t?(ee=X.alternate,ee!==null?(ee=ee.index,ee<$?(X.flags|=67108866,$):ee):(X.flags|=67108866,$)):(X.flags|=1048576,$)}function v(X){return t&&X.alternate===null&&(X.flags|=67108866),X}function S(X,$,ee,ue){return $===null||$.tag!==6?($=cc(ee,X.mode,ue),$.return=X,$):($=h($,ee),$.return=X,$)}function P(X,$,ee,ue){var Ue=ee.type;return Ue===z?le(X,$,ee.props.children,ue,ee.key):$!==null&&($.elementType===Ue||typeof Ue=="object"&&Ue!==null&&Ue.$$typeof===J&&Ji(Ue)===$.type)?($=h($,ee.props),js($,ee),$.return=X,$):($=Zl(ee.type,ee.key,ee.props,null,X.mode,ue),js($,ee),$.return=X,$)}function te(X,$,ee,ue){return $===null||$.tag!==4||$.stateNode.containerInfo!==ee.containerInfo||$.stateNode.implementation!==ee.implementation?($=fc(ee,X.mode,ue),$.return=X,$):($=h($,ee.children||[]),$.return=X,$)}function le(X,$,ee,ue,Ue){return $===null||$.tag!==7?($=Fi(ee,X.mode,ue,Ue),$.return=X,$):($=h($,ee),$.return=X,$)}function me(X,$,ee){if(typeof $=="string"&&$!==""||typeof $=="number"||typeof $=="bigint")return $=cc(""+$,X.mode,ee),$.return=X,$;if(typeof $=="object"&&$!==null){switch($.$$typeof){case x:return ee=Zl($.type,$.key,$.props,null,X.mode,ee),js(ee,$),ee.return=X,ee;case k:return $=fc($,X.mode,ee),$.return=X,$;case J:return $=Ji($),me(X,$,ee)}if(H($)||Z($))return $=Fi($,X.mode,ee,null),$.return=X,$;if(typeof $.then=="function")return me(X,ao($),ee);if($.$$typeof===G)return me(X,to(X,$),ee);so(X,$)}return null}function ne(X,$,ee,ue){var Ue=$!==null?$.key:null;if(typeof ee=="string"&&ee!==""||typeof ee=="number"||typeof ee=="bigint")return Ue!==null?null:S(X,$,""+ee,ue);if(typeof ee=="object"&&ee!==null){switch(ee.$$typeof){case x:return ee.key===Ue?P(X,$,ee,ue):null;case k:return ee.key===Ue?te(X,$,ee,ue):null;case J:return ee=Ji(ee),ne(X,$,ee,ue)}if(H(ee)||Z(ee))return Ue!==null?null:le(X,$,ee,ue,null);if(typeof ee.then=="function")return ne(X,$,ao(ee),ue);if(ee.$$typeof===G)return ne(X,$,to(X,ee),ue);so(X,ee)}return null}function ae(X,$,ee,ue,Ue){if(typeof ue=="string"&&ue!==""||typeof ue=="number"||typeof ue=="bigint")return X=X.get(ee)||null,S($,X,""+ue,Ue);if(typeof ue=="object"&&ue!==null){switch(ue.$$typeof){case x:return X=X.get(ue.key===null?ee:ue.key)||null,P($,X,ue,Ue);case k:return X=X.get(ue.key===null?ee:ue.key)||null,te($,X,ue,Ue);case J:return ue=Ji(ue),ae(X,$,ee,ue,Ue)}if(H(ue)||Z(ue))return X=X.get(ee)||null,le($,X,ue,Ue,null);if(typeof ue.then=="function")return ae(X,$,ee,ao(ue),Ue);if(ue.$$typeof===G)return ae(X,$,ee,to($,ue),Ue);so($,ue)}return null}function Re(X,$,ee,ue){for(var Ue=null,ft=null,Me=$,Xe=$=0,nt=null;Me!==null&&Xe<ee.length;Xe++){Me.index>Xe?(nt=Me,Me=null):nt=Me.sibling;var ht=ne(X,Me,ee[Xe],ue);if(ht===null){Me===null&&(Me=nt);break}t&&Me&&ht.alternate===null&&i(X,Me),$=p(ht,$,Xe),ft===null?Ue=ht:ft.sibling=ht,ft=ht,Me=nt}if(Xe===ee.length)return s(X,Me),at&&Or(X,Xe),Ue;if(Me===null){for(;Xe<ee.length;Xe++)Me=me(X,ee[Xe],ue),Me!==null&&($=p(Me,$,Xe),ft===null?Ue=Me:ft.sibling=Me,ft=Me);return at&&Or(X,Xe),Ue}for(Me=o(Me);Xe<ee.length;Xe++)nt=ae(Me,X,Xe,ee[Xe],ue),nt!==null&&(t&&nt.alternate!==null&&Me.delete(nt.key===null?Xe:nt.key),$=p(nt,$,Xe),ft===null?Ue=nt:ft.sibling=nt,ft=nt);return t&&Me.forEach(function(Ei){return i(X,Ei)}),at&&Or(X,Xe),Ue}function He(X,$,ee,ue){if(ee==null)throw Error(a(151));for(var Ue=null,ft=null,Me=$,Xe=$=0,nt=null,ht=ee.next();Me!==null&&!ht.done;Xe++,ht=ee.next()){Me.index>Xe?(nt=Me,Me=null):nt=Me.sibling;var Ei=ne(X,Me,ht.value,ue);if(Ei===null){Me===null&&(Me=nt);break}t&&Me&&Ei.alternate===null&&i(X,Me),$=p(Ei,$,Xe),ft===null?Ue=Ei:ft.sibling=Ei,ft=Ei,Me=nt}if(ht.done)return s(X,Me),at&&Or(X,Xe),Ue;if(Me===null){for(;!ht.done;Xe++,ht=ee.next())ht=me(X,ht.value,ue),ht!==null&&($=p(ht,$,Xe),ft===null?Ue=ht:ft.sibling=ht,ft=ht);return at&&Or(X,Xe),Ue}for(Me=o(Me);!ht.done;Xe++,ht=ee.next())ht=ae(Me,X,Xe,ht.value,ue),ht!==null&&(t&&ht.alternate!==null&&Me.delete(ht.key===null?Xe:ht.key),$=p(ht,$,Xe),ft===null?Ue=ht:ft.sibling=ht,ft=ht);return t&&Me.forEach(function(_w){return i(X,_w)}),at&&Or(X,Xe),Ue}function xt(X,$,ee,ue){if(typeof ee=="object"&&ee!==null&&ee.type===z&&ee.key===null&&(ee=ee.props.children),typeof ee=="object"&&ee!==null){switch(ee.$$typeof){case x:e:{for(var Ue=ee.key;$!==null;){if($.key===Ue){if(Ue=ee.type,Ue===z){if($.tag===7){s(X,$.sibling),ue=h($,ee.props.children),ue.return=X,X=ue;break e}}else if($.elementType===Ue||typeof Ue=="object"&&Ue!==null&&Ue.$$typeof===J&&Ji(Ue)===$.type){s(X,$.sibling),ue=h($,ee.props),js(ue,ee),ue.return=X,X=ue;break e}s(X,$);break}else i(X,$);$=$.sibling}ee.type===z?(ue=Fi(ee.props.children,X.mode,ue,ee.key),ue.return=X,X=ue):(ue=Zl(ee.type,ee.key,ee.props,null,X.mode,ue),js(ue,ee),ue.return=X,X=ue)}return v(X);case k:e:{for(Ue=ee.key;$!==null;){if($.key===Ue)if($.tag===4&&$.stateNode.containerInfo===ee.containerInfo&&$.stateNode.implementation===ee.implementation){s(X,$.sibling),ue=h($,ee.children||[]),ue.return=X,X=ue;break e}else{s(X,$);break}else i(X,$);$=$.sibling}ue=fc(ee,X.mode,ue),ue.return=X,X=ue}return v(X);case J:return ee=Ji(ee),xt(X,$,ee,ue)}if(H(ee))return Re(X,$,ee,ue);if(Z(ee)){if(Ue=Z(ee),typeof Ue!="function")throw Error(a(150));return ee=Ue.call(ee),He(X,$,ee,ue)}if(typeof ee.then=="function")return xt(X,$,ao(ee),ue);if(ee.$$typeof===G)return xt(X,$,to(X,ee),ue);so(X,ee)}return typeof ee=="string"&&ee!==""||typeof ee=="number"||typeof ee=="bigint"?(ee=""+ee,$!==null&&$.tag===6?(s(X,$.sibling),ue=h($,ee),ue.return=X,X=ue):(s(X,$),ue=cc(ee,X.mode,ue),ue.return=X,X=ue),v(X)):s(X,$)}return function(X,$,ee,ue){try{Ts=0;var Ue=xt(X,$,ee,ue);return Ca=null,Ue}catch(Me){if(Me===ka||Me===ro)throw Me;var ft=En(29,Me,null,X.mode);return ft.lanes=ue,ft.return=X,ft}finally{}}}var Qi=Gm(!0),Ym=Gm(!1),li=!1;function _c(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Ec(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 oi(t){return{lane:t,tag:0,payload:null,callback:null,next:null}}function ui(t,i,s){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=Kl(t),jm(t,null,s),i}return Ql(t,o,i,s),Kl(t)}function Ns(t,i,s){if(i=i.updateQueue,i!==null&&(i=i.shared,(s&4194048)!==0)){var o=i.lanes;o&=t.pendingLanes,s|=o,i.lanes=s,Li(t,s)}}function kc(t,i){var s=t.updateQueue,o=t.alternate;if(o!==null&&(o=o.updateQueue,s===o)){var h=null,p=null;if(s=s.firstBaseUpdate,s!==null){do{var v={lane:s.lane,tag:s.tag,payload:s.payload,callback:null,next:null};p===null?h=p=v:p=p.next=v,s=s.next}while(s!==null);p===null?h=p=i:p=p.next=i}else h=p=i;s={baseState:o.baseState,firstBaseUpdate:h,lastBaseUpdate:p,shared:o.shared,callbacks:o.callbacks},t.updateQueue=s;return}t=s.lastBaseUpdate,t===null?s.firstBaseUpdate=i:t.next=i,s.lastBaseUpdate=i}var Cc=!1;function Os(){if(Cc){var t=Ea;if(t!==null)throw t}}function Rs(t,i,s,o){Cc=!1;var h=t.updateQueue;li=!1;var p=h.firstBaseUpdate,v=h.lastBaseUpdate,S=h.shared.pending;if(S!==null){h.shared.pending=null;var P=S,te=P.next;P.next=null,v===null?p=te:v.next=te,v=P;var le=t.alternate;le!==null&&(le=le.updateQueue,S=le.lastBaseUpdate,S!==v&&(S===null?le.firstBaseUpdate=te:S.next=te,le.lastBaseUpdate=P))}if(p!==null){var me=h.baseState;v=0,le=te=P=null,S=p;do{var ne=S.lane&-536870913,ae=ne!==S.lane;if(ae?(tt&ne)===ne:(o&ne)===ne){ne!==0&&ne===_a&&(Cc=!0),le!==null&&(le=le.next={lane:0,tag:S.tag,payload:S.payload,callback:null,next:null});e:{var Re=t,He=S;ne=i;var xt=s;switch(He.tag){case 1:if(Re=He.payload,typeof Re=="function"){me=Re.call(xt,me,ne);break e}me=Re;break e;case 3:Re.flags=Re.flags&-65537|128;case 0:if(Re=He.payload,ne=typeof Re=="function"?Re.call(xt,me,ne):Re,ne==null)break e;me=g({},me,ne);break e;case 2:li=!0}}ne=S.callback,ne!==null&&(t.flags|=64,ae&&(t.flags|=8192),ae=h.callbacks,ae===null?h.callbacks=[ne]:ae.push(ne))}else ae={lane:ne,tag:S.tag,payload:S.payload,callback:S.callback,next:null},le===null?(te=le=ae,P=me):le=le.next=ae,v|=ne;if(S=S.next,S===null){if(S=h.shared.pending,S===null)break;ae=S,S=ae.next,ae.next=null,h.lastBaseUpdate=ae,h.shared.pending=null}}while(!0);le===null&&(P=me),h.baseState=P,h.firstBaseUpdate=te,h.lastBaseUpdate=le,p===null&&(h.shared.lanes=0),mi|=v,t.lanes=v,t.memoizedState=me}}function Vm(t,i){if(typeof t!="function")throw Error(a(191,t));t.call(i)}function Jm(t,i){var s=t.callbacks;if(s!==null)for(t.callbacks=null,t=0;t<s.length;t++)Vm(s[t],i)}var Aa=U(null),lo=U(0);function Xm(t,i){t=Ir,_(lo,t),_(Aa,i),Ir=t|i.baseLanes}function Ac(){_(lo,Ir),_(Aa,Aa.current)}function Tc(){Ir=lo.current,W(Aa),W(lo)}var kn=U(null),Yn=null;function ci(t){var i=t.alternate;_(Lt,Lt.current&1),_(kn,t),Yn===null&&(i===null||Aa.current!==null||i.memoizedState!==null)&&(Yn=t)}function jc(t){_(Lt,Lt.current),_(kn,t),Yn===null&&(Yn=t)}function Qm(t){t.tag===22?(_(Lt,Lt.current),_(kn,t),Yn===null&&(Yn=t)):fi()}function fi(){_(Lt,Lt.current),_(kn,kn.current)}function Cn(t){W(kn),Yn===t&&(Yn=null),W(Lt)}var Lt=U(0);function oo(t){for(var i=t;i!==null;){if(i.tag===13){var s=i.memoizedState;if(s!==null&&(s=s.dehydrated,s===null||Lf(s)||Uf(s)))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 Dr=0,Je=null,bt=null,Ht=null,uo=!1,Ta=!1,Ki=!1,co=0,Ms=0,ja=null,dx=0;function Dt(){throw Error(a(321))}function Nc(t,i){if(i===null)return!1;for(var s=0;s<i.length&&s<t.length;s++)if(!_n(t[s],i[s]))return!1;return!0}function Oc(t,i,s,o,h,p){return Dr=p,Je=i,i.memoizedState=null,i.updateQueue=null,i.lanes=0,q.H=t===null||t.memoizedState===null?Mp:Yc,Ki=!1,p=s(o,h),Ki=!1,Ta&&(p=Zm(i,s,o,h)),Km(t),p}function Km(t){q.H=Ls;var i=bt!==null&&bt.next!==null;if(Dr=0,Ht=bt=Je=null,uo=!1,Ms=0,ja=null,i)throw Error(a(300));t===null||qt||(t=t.dependencies,t!==null&&eo(t)&&(qt=!0))}function Zm(t,i,s,o){Je=t;var h=0;do{if(Ta&&(ja=null),Ms=0,Ta=!1,25<=h)throw Error(a(301));if(h+=1,Ht=bt=null,t.updateQueue!=null){var p=t.updateQueue;p.lastEffect=null,p.events=null,p.stores=null,p.memoCache!=null&&(p.memoCache.index=0)}q.H=Dp,p=i(s,o)}while(Ta);return p}function mx(){var t=q.H,i=t.useState()[0];return i=typeof i.then=="function"?Ds(i):i,t=t.useState()[0],(bt!==null?bt.memoizedState:null)!==t&&(Je.flags|=1024),i}function Rc(){var t=co!==0;return co=0,t}function Mc(t,i,s){i.updateQueue=t.updateQueue,i.flags&=-2053,t.lanes&=~s}function Dc(t){if(uo){for(t=t.memoizedState;t!==null;){var i=t.queue;i!==null&&(i.pending=null),t=t.next}uo=!1}Dr=0,Ht=bt=Je=null,Ta=!1,Ms=co=0,ja=null}function ln(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Ht===null?Je.memoizedState=Ht=t:Ht=Ht.next=t,Ht}function Ut(){if(bt===null){var t=Je.alternate;t=t!==null?t.memoizedState:null}else t=bt.next;var i=Ht===null?Je.memoizedState:Ht.next;if(i!==null)Ht=i,bt=t;else{if(t===null)throw Je.alternate===null?Error(a(467)):Error(a(310));bt=t,t={memoizedState:bt.memoizedState,baseState:bt.baseState,baseQueue:bt.baseQueue,queue:bt.queue,next:null},Ht===null?Je.memoizedState=Ht=t:Ht=Ht.next=t}return Ht}function fo(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Ds(t){var i=Ms;return Ms+=1,ja===null&&(ja=[]),t=Im(ja,t,i),i=Je,(Ht===null?i.memoizedState:Ht.next)===null&&(i=i.alternate,q.H=i===null||i.memoizedState===null?Mp:Yc),t}function ho(t){if(t!==null&&typeof t=="object"){if(typeof t.then=="function")return Ds(t);if(t.$$typeof===G)return Qt(t)}throw Error(a(438,String(t)))}function zc(t){var i=null,s=Je.updateQueue;if(s!==null&&(i=s.memoCache),i==null){var o=Je.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}),s===null&&(s=fo(),Je.updateQueue=s),s.memoCache=i,s=i.data[i.index],s===void 0)for(s=i.data[i.index]=Array(t),o=0;o<t;o++)s[o]=N;return i.index++,s}function zr(t,i){return typeof i=="function"?i(t):i}function mo(t){var i=Ut();return Lc(i,bt,t)}function Lc(t,i,s){var o=t.queue;if(o===null)throw Error(a(311));o.lastRenderedReducer=s;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 S=v=null,P=null,te=i,le=!1;do{var me=te.lane&-536870913;if(me!==te.lane?(tt&me)===me:(Dr&me)===me){var ne=te.revertLane;if(ne===0)P!==null&&(P=P.next={lane:0,revertLane:0,gesture:null,action:te.action,hasEagerState:te.hasEagerState,eagerState:te.eagerState,next:null}),me===_a&&(le=!0);else if((Dr&ne)===ne){te=te.next,ne===_a&&(le=!0);continue}else me={lane:0,revertLane:te.revertLane,gesture:null,action:te.action,hasEagerState:te.hasEagerState,eagerState:te.eagerState,next:null},P===null?(S=P=me,v=p):P=P.next=me,Je.lanes|=ne,mi|=ne;me=te.action,Ki&&s(p,me),p=te.hasEagerState?te.eagerState:s(p,me)}else ne={lane:me,revertLane:te.revertLane,gesture:te.gesture,action:te.action,hasEagerState:te.hasEagerState,eagerState:te.eagerState,next:null},P===null?(S=P=ne,v=p):P=P.next=ne,Je.lanes|=me,mi|=me;te=te.next}while(te!==null&&te!==i);if(P===null?v=p:P.next=S,!_n(p,t.memoizedState)&&(qt=!0,le&&(s=Ea,s!==null)))throw s;t.memoizedState=p,t.baseState=v,t.baseQueue=P,o.lastRenderedState=p}return h===null&&(o.lanes=0),[t.memoizedState,o.dispatch]}function Uc(t){var i=Ut(),s=i.queue;if(s===null)throw Error(a(311));s.lastRenderedReducer=t;var o=s.dispatch,h=s.pending,p=i.memoizedState;if(h!==null){s.pending=null;var v=h=h.next;do p=t(p,v.action),v=v.next;while(v!==h);_n(p,i.memoizedState)||(qt=!0),i.memoizedState=p,i.baseQueue===null&&(i.baseState=p),s.lastRenderedState=p}return[p,o]}function Wm(t,i,s){var o=Je,h=Ut(),p=at;if(p){if(s===void 0)throw Error(a(407));s=s()}else s=i();var v=!_n((bt||h).memoizedState,s);if(v&&(h.memoizedState=s,qt=!0),h=h.queue,Hc(np.bind(null,o,h,t),[t]),h.getSnapshot!==i||v||Ht!==null&&Ht.memoizedState.tag&1){if(o.flags|=2048,Na(9,{destroy:void 0},tp.bind(null,o,h,s,i),null),St===null)throw Error(a(349));p||(Dr&127)!==0||ep(o,i,s)}return s}function ep(t,i,s){t.flags|=16384,t={getSnapshot:i,value:s},i=Je.updateQueue,i===null?(i=fo(),Je.updateQueue=i,i.stores=[t]):(s=i.stores,s===null?i.stores=[t]:s.push(t))}function tp(t,i,s,o){i.value=s,i.getSnapshot=o,rp(i)&&ip(t)}function np(t,i,s){return s(function(){rp(i)&&ip(t)})}function rp(t){var i=t.getSnapshot;t=t.value;try{var s=i();return!_n(t,s)}catch{return!0}}function ip(t){var i=Ii(t,2);i!==null&&bn(i,t,2)}function Bc(t){var i=ln();if(typeof t=="function"){var s=t;if(t=s(),Ki){ct(!0);try{s()}finally{ct(!1)}}}return i.memoizedState=i.baseState=t,i.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:zr,lastRenderedState:t},i}function ap(t,i,s,o){return t.baseState=s,Lc(t,bt,typeof o=="function"?o:zr)}function px(t,i,s,o,h){if(yo(t))throw Error(a(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)}};q.T!==null?s(!0):p.isTransition=!1,o(p),s=i.pending,s===null?(p.next=i.pending=p,sp(i,p)):(p.next=s.next,i.pending=s.next=p)}}function sp(t,i){var s=i.action,o=i.payload,h=t.state;if(i.isTransition){var p=q.T,v={};q.T=v;try{var S=s(h,o),P=q.S;P!==null&&P(v,S),lp(t,i,S)}catch(te){Pc(t,i,te)}finally{p!==null&&v.types!==null&&(p.types=v.types),q.T=p}}else try{p=s(h,o),lp(t,i,p)}catch(te){Pc(t,i,te)}}function lp(t,i,s){s!==null&&typeof s=="object"&&typeof s.then=="function"?s.then(function(o){op(t,i,o)},function(o){return Pc(t,i,o)}):op(t,i,s)}function op(t,i,s){i.status="fulfilled",i.value=s,up(i),t.state=s,i=t.pending,i!==null&&(s=i.next,s===i?t.pending=null:(s=s.next,i.next=s,sp(t,s)))}function Pc(t,i,s){var o=t.pending;if(t.pending=null,o!==null){o=o.next;do i.status="rejected",i.reason=s,up(i),i=i.next;while(i!==o)}t.action=null}function up(t){t=t.listeners;for(var i=0;i<t.length;i++)(0,t[i])()}function cp(t,i){return i}function fp(t,i){if(at){var s=St.formState;if(s!==null){e:{var o=Je;if(at){if(Ct){t:{for(var h=Ct,p=Gn;h.nodeType!==8;){if(!p){h=null;break t}if(h=Vn(h.nextSibling),h===null){h=null;break t}}p=h.data,h=p==="F!"||p==="F"?h:null}if(h){Ct=Vn(h.nextSibling),o=h.data==="F!";break e}}ai(o)}o=!1}o&&(i=s[0])}}return s=ln(),s.memoizedState=s.baseState=i,o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:cp,lastRenderedState:i},s.queue=o,s=Np.bind(null,Je,o),o.dispatch=s,o=Bc(!1),p=Gc.bind(null,Je,!1,o.queue),o=ln(),h={state:i,dispatch:null,action:t,pending:null},o.queue=h,s=px.bind(null,Je,h,p,s),h.dispatch=s,o.memoizedState=t,[i,s,!1]}function hp(t){var i=Ut();return dp(i,bt,t)}function dp(t,i,s){if(i=Lc(t,i,cp)[0],t=mo(zr)[0],typeof i=="object"&&i!==null&&typeof i.then=="function")try{var o=Ds(i)}catch(v){throw v===ka?ro:v}else o=i;i=Ut();var h=i.queue,p=h.dispatch;return s!==i.memoizedState&&(Je.flags|=2048,Na(9,{destroy:void 0},gx.bind(null,h,s),null)),[o,p,t]}function gx(t,i){t.action=i}function mp(t){var i=Ut(),s=bt;if(s!==null)return dp(i,s,t);Ut(),i=i.memoizedState,s=Ut();var o=s.queue.dispatch;return s.memoizedState=t,[i,o,!1]}function Na(t,i,s,o){return t={tag:t,create:s,deps:o,inst:i,next:null},i=Je.updateQueue,i===null&&(i=fo(),Je.updateQueue=i),s=i.lastEffect,s===null?i.lastEffect=t.next=t:(o=s.next,s.next=t,t.next=o,i.lastEffect=t),t}function pp(){return Ut().memoizedState}function po(t,i,s,o){var h=ln();Je.flags|=t,h.memoizedState=Na(1|i,{destroy:void 0},s,o===void 0?null:o)}function go(t,i,s,o){var h=Ut();o=o===void 0?null:o;var p=h.memoizedState.inst;bt!==null&&o!==null&&Nc(o,bt.memoizedState.deps)?h.memoizedState=Na(i,p,s,o):(Je.flags|=t,h.memoizedState=Na(1|i,p,s,o))}function gp(t,i){po(8390656,8,t,i)}function Hc(t,i){go(2048,8,t,i)}function yx(t){Je.flags|=4;var i=Je.updateQueue;if(i===null)i=fo(),Je.updateQueue=i,i.events=[t];else{var s=i.events;s===null?i.events=[t]:s.push(t)}}function yp(t){var i=Ut().memoizedState;return yx({ref:i,nextImpl:t}),function(){if((dt&2)!==0)throw Error(a(440));return i.impl.apply(void 0,arguments)}}function bp(t,i){return go(4,2,t,i)}function vp(t,i){return go(4,4,t,i)}function xp(t,i){if(typeof i=="function"){t=t();var s=i(t);return function(){typeof s=="function"?s():i(null)}}if(i!=null)return t=t(),i.current=t,function(){i.current=null}}function wp(t,i,s){s=s!=null?s.concat([t]):null,go(4,4,xp.bind(null,i,t),s)}function qc(){}function Sp(t,i){var s=Ut();i=i===void 0?null:i;var o=s.memoizedState;return i!==null&&Nc(i,o[1])?o[0]:(s.memoizedState=[t,i],t)}function _p(t,i){var s=Ut();i=i===void 0?null:i;var o=s.memoizedState;if(i!==null&&Nc(i,o[1]))return o[0];if(o=t(),Ki){ct(!0);try{t()}finally{ct(!1)}}return s.memoizedState=[o,i],o}function Ic(t,i,s){return s===void 0||(Dr&1073741824)!==0&&(tt&261930)===0?t.memoizedState=i:(t.memoizedState=s,t=Eg(),Je.lanes|=t,mi|=t,s)}function Ep(t,i,s,o){return _n(s,i)?s:Aa.current!==null?(t=Ic(t,s,o),_n(t,i)||(qt=!0),t):(Dr&42)===0||(Dr&1073741824)!==0&&(tt&261930)===0?(qt=!0,t.memoizedState=s):(t=Eg(),Je.lanes|=t,mi|=t,i)}function kp(t,i,s,o,h){var p=re.p;re.p=p!==0&&8>p?p:8;var v=q.T,S={};q.T=S,Gc(t,!1,i,s);try{var P=h(),te=q.S;if(te!==null&&te(S,P),P!==null&&typeof P=="object"&&typeof P.then=="function"){var le=hx(P,o);zs(t,i,le,jn(t))}else zs(t,i,o,jn(t))}catch(me){zs(t,i,{then:function(){},status:"rejected",reason:me},jn())}finally{re.p=p,v!==null&&S.types!==null&&(v.types=S.types),q.T=v}}function bx(){}function Fc(t,i,s,o){if(t.tag!==5)throw Error(a(476));var h=Cp(t).queue;kp(t,h,i,ye,s===null?bx:function(){return Ap(t),s(o)})}function Cp(t){var i=t.memoizedState;if(i!==null)return i;i={memoizedState:ye,baseState:ye,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:zr,lastRenderedState:ye},next:null};var s={};return i.next={memoizedState:s,baseState:s,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:zr,lastRenderedState:s},next:null},t.memoizedState=i,t=t.alternate,t!==null&&(t.memoizedState=i),i}function Ap(t){var i=Cp(t);i.next===null&&(i=t.alternate.memoizedState),zs(t,i.next.queue,{},jn())}function $c(){return Qt(Zs)}function Tp(){return Ut().memoizedState}function jp(){return Ut().memoizedState}function vx(t){for(var i=t.return;i!==null;){switch(i.tag){case 24:case 3:var s=jn();t=oi(s);var o=ui(i,t,s);o!==null&&(bn(o,i,s),Ns(o,i,s)),i={cache:vc()},t.payload=i;return}i=i.return}}function xx(t,i,s){var o=jn();s={lane:o,revertLane:0,gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null},yo(t)?Op(i,s):(s=oc(t,i,s,o),s!==null&&(bn(s,t,o),Rp(s,i,o)))}function Np(t,i,s){var o=jn();zs(t,i,s,o)}function zs(t,i,s,o){var h={lane:o,revertLane:0,gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null};if(yo(t))Op(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,S=p(v,s);if(h.hasEagerState=!0,h.eagerState=S,_n(S,v))return Ql(t,i,h,0),St===null&&Xl(),!1}catch{}finally{}if(s=oc(t,i,h,o),s!==null)return bn(s,t,o),Rp(s,i,o),!0}return!1}function Gc(t,i,s,o){if(o={lane:2,revertLane:Ef(),gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null},yo(t)){if(i)throw Error(a(479))}else i=oc(t,s,o,2),i!==null&&bn(i,t,2)}function yo(t){var i=t.alternate;return t===Je||i!==null&&i===Je}function Op(t,i){Ta=uo=!0;var s=t.pending;s===null?i.next=i:(i.next=s.next,s.next=i),t.pending=i}function Rp(t,i,s){if((s&4194048)!==0){var o=i.lanes;o&=t.pendingLanes,s|=o,i.lanes=s,Li(t,s)}}var Ls={readContext:Qt,use:ho,useCallback:Dt,useContext:Dt,useEffect:Dt,useImperativeHandle:Dt,useLayoutEffect:Dt,useInsertionEffect:Dt,useMemo:Dt,useReducer:Dt,useRef:Dt,useState:Dt,useDebugValue:Dt,useDeferredValue:Dt,useTransition:Dt,useSyncExternalStore:Dt,useId:Dt,useHostTransitionStatus:Dt,useFormState:Dt,useActionState:Dt,useOptimistic:Dt,useMemoCache:Dt,useCacheRefresh:Dt};Ls.useEffectEvent=Dt;var Mp={readContext:Qt,use:ho,useCallback:function(t,i){return ln().memoizedState=[t,i===void 0?null:i],t},useContext:Qt,useEffect:gp,useImperativeHandle:function(t,i,s){s=s!=null?s.concat([t]):null,po(4194308,4,xp.bind(null,i,t),s)},useLayoutEffect:function(t,i){return po(4194308,4,t,i)},useInsertionEffect:function(t,i){po(4,2,t,i)},useMemo:function(t,i){var s=ln();i=i===void 0?null:i;var o=t();if(Ki){ct(!0);try{t()}finally{ct(!1)}}return s.memoizedState=[o,i],o},useReducer:function(t,i,s){var o=ln();if(s!==void 0){var h=s(i);if(Ki){ct(!0);try{s(i)}finally{ct(!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=xx.bind(null,Je,t),[o.memoizedState,t]},useRef:function(t){var i=ln();return t={current:t},i.memoizedState=t},useState:function(t){t=Bc(t);var i=t.queue,s=Np.bind(null,Je,i);return i.dispatch=s,[t.memoizedState,s]},useDebugValue:qc,useDeferredValue:function(t,i){var s=ln();return Ic(s,t,i)},useTransition:function(){var t=Bc(!1);return t=kp.bind(null,Je,t.queue,!0,!1),ln().memoizedState=t,[!1,t]},useSyncExternalStore:function(t,i,s){var o=Je,h=ln();if(at){if(s===void 0)throw Error(a(407));s=s()}else{if(s=i(),St===null)throw Error(a(349));(tt&127)!==0||ep(o,i,s)}h.memoizedState=s;var p={value:s,getSnapshot:i};return h.queue=p,gp(np.bind(null,o,p,t),[t]),o.flags|=2048,Na(9,{destroy:void 0},tp.bind(null,o,p,s,i),null),s},useId:function(){var t=ln(),i=St.identifierPrefix;if(at){var s=mr,o=dr;s=(o&~(1<<32-mt(o)-1)).toString(32)+s,i="_"+i+"R_"+s,s=co++,0<s&&(i+="H"+s.toString(32)),i+="_"}else s=dx++,i="_"+i+"r_"+s.toString(32)+"_";return t.memoizedState=i},useHostTransitionStatus:$c,useFormState:fp,useActionState:fp,useOptimistic:function(t){var i=ln();i.memoizedState=i.baseState=t;var s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return i.queue=s,i=Gc.bind(null,Je,!0,s),s.dispatch=i,[t,i]},useMemoCache:zc,useCacheRefresh:function(){return ln().memoizedState=vx.bind(null,Je)},useEffectEvent:function(t){var i=ln(),s={impl:t};return i.memoizedState=s,function(){if((dt&2)!==0)throw Error(a(440));return s.impl.apply(void 0,arguments)}}},Yc={readContext:Qt,use:ho,useCallback:Sp,useContext:Qt,useEffect:Hc,useImperativeHandle:wp,useInsertionEffect:bp,useLayoutEffect:vp,useMemo:_p,useReducer:mo,useRef:pp,useState:function(){return mo(zr)},useDebugValue:qc,useDeferredValue:function(t,i){var s=Ut();return Ep(s,bt.memoizedState,t,i)},useTransition:function(){var t=mo(zr)[0],i=Ut().memoizedState;return[typeof t=="boolean"?t:Ds(t),i]},useSyncExternalStore:Wm,useId:Tp,useHostTransitionStatus:$c,useFormState:hp,useActionState:hp,useOptimistic:function(t,i){var s=Ut();return ap(s,bt,t,i)},useMemoCache:zc,useCacheRefresh:jp};Yc.useEffectEvent=yp;var Dp={readContext:Qt,use:ho,useCallback:Sp,useContext:Qt,useEffect:Hc,useImperativeHandle:wp,useInsertionEffect:bp,useLayoutEffect:vp,useMemo:_p,useReducer:Uc,useRef:pp,useState:function(){return Uc(zr)},useDebugValue:qc,useDeferredValue:function(t,i){var s=Ut();return bt===null?Ic(s,t,i):Ep(s,bt.memoizedState,t,i)},useTransition:function(){var t=Uc(zr)[0],i=Ut().memoizedState;return[typeof t=="boolean"?t:Ds(t),i]},useSyncExternalStore:Wm,useId:Tp,useHostTransitionStatus:$c,useFormState:mp,useActionState:mp,useOptimistic:function(t,i){var s=Ut();return bt!==null?ap(s,bt,t,i):(s.baseState=t,[t,s.queue.dispatch])},useMemoCache:zc,useCacheRefresh:jp};Dp.useEffectEvent=yp;function Vc(t,i,s,o){i=t.memoizedState,s=s(o,i),s=s==null?i:g({},i,s),t.memoizedState=s,t.lanes===0&&(t.updateQueue.baseState=s)}var Jc={enqueueSetState:function(t,i,s){t=t._reactInternals;var o=jn(),h=oi(o);h.payload=i,s!=null&&(h.callback=s),i=ui(t,h,o),i!==null&&(bn(i,t,o),Ns(i,t,o))},enqueueReplaceState:function(t,i,s){t=t._reactInternals;var o=jn(),h=oi(o);h.tag=1,h.payload=i,s!=null&&(h.callback=s),i=ui(t,h,o),i!==null&&(bn(i,t,o),Ns(i,t,o))},enqueueForceUpdate:function(t,i){t=t._reactInternals;var s=jn(),o=oi(s);o.tag=2,i!=null&&(o.callback=i),i=ui(t,o,s),i!==null&&(bn(i,t,s),Ns(i,t,s))}};function zp(t,i,s,o,h,p,v){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(o,p,v):i.prototype&&i.prototype.isPureReactComponent?!Ss(s,o)||!Ss(h,p):!0}function Lp(t,i,s,o){t=i.state,typeof i.componentWillReceiveProps=="function"&&i.componentWillReceiveProps(s,o),typeof i.UNSAFE_componentWillReceiveProps=="function"&&i.UNSAFE_componentWillReceiveProps(s,o),i.state!==t&&Jc.enqueueReplaceState(i,i.state,null)}function Zi(t,i){var s=i;if("ref"in i){s={};for(var o in i)o!=="ref"&&(s[o]=i[o])}if(t=t.defaultProps){s===i&&(s=g({},s));for(var h in t)s[h]===void 0&&(s[h]=t[h])}return s}function Up(t){Jl(t)}function Bp(t){console.error(t)}function Pp(t){Jl(t)}function bo(t,i){try{var s=t.onUncaughtError;s(i.value,{componentStack:i.stack})}catch(o){setTimeout(function(){throw o})}}function Hp(t,i,s){try{var o=t.onCaughtError;o(s.value,{componentStack:s.stack,errorBoundary:i.tag===1?i.stateNode:null})}catch(h){setTimeout(function(){throw h})}}function Xc(t,i,s){return s=oi(s),s.tag=3,s.payload={element:null},s.callback=function(){bo(t,i)},s}function qp(t){return t=oi(t),t.tag=3,t}function Ip(t,i,s,o){var h=s.type.getDerivedStateFromError;if(typeof h=="function"){var p=o.value;t.payload=function(){return h(p)},t.callback=function(){Hp(i,s,o)}}var v=s.stateNode;v!==null&&typeof v.componentDidCatch=="function"&&(t.callback=function(){Hp(i,s,o),typeof h!="function"&&(pi===null?pi=new Set([this]):pi.add(this));var S=o.stack;this.componentDidCatch(o.value,{componentStack:S!==null?S:""})})}function wx(t,i,s,o,h){if(s.flags|=32768,o!==null&&typeof o=="object"&&typeof o.then=="function"){if(i=s.alternate,i!==null&&Sa(i,s,h,!0),s=kn.current,s!==null){switch(s.tag){case 31:case 13:return Yn===null?No():s.alternate===null&&zt===0&&(zt=3),s.flags&=-257,s.flags|=65536,s.lanes=h,o===io?s.flags|=16384:(i=s.updateQueue,i===null?s.updateQueue=new Set([o]):i.add(o),wf(t,o,h)),!1;case 22:return s.flags|=65536,o===io?s.flags|=16384:(i=s.updateQueue,i===null?(i={transitions:null,markerInstances:null,retryQueue:new Set([o])},s.updateQueue=i):(s=i.retryQueue,s===null?i.retryQueue=new Set([o]):s.add(o)),wf(t,o,h)),!1}throw Error(a(435,s.tag))}return wf(t,o,h),No(),!1}if(at)return i=kn.current,i!==null?((i.flags&65536)===0&&(i.flags|=256),i.flags|=65536,i.lanes=h,o!==mc&&(t=Error(a(422),{cause:o}),ks(In(t,s)))):(o!==mc&&(i=Error(a(423),{cause:o}),ks(In(i,s))),t=t.current.alternate,t.flags|=65536,h&=-h,t.lanes|=h,o=In(o,s),h=Xc(t.stateNode,o,h),kc(t,h),zt!==4&&(zt=2)),!1;var p=Error(a(520),{cause:o});if(p=In(p,s),$s===null?$s=[p]:$s.push(p),zt!==4&&(zt=2),i===null)return!0;o=In(o,s),s=i;do{switch(s.tag){case 3:return s.flags|=65536,t=h&-h,s.lanes|=t,t=Xc(s.stateNode,o,t),kc(s,t),!1;case 1:if(i=s.type,p=s.stateNode,(s.flags&128)===0&&(typeof i.getDerivedStateFromError=="function"||p!==null&&typeof p.componentDidCatch=="function"&&(pi===null||!pi.has(p))))return s.flags|=65536,h&=-h,s.lanes|=h,h=qp(h),Ip(h,t,s,o),kc(s,h),!1}s=s.return}while(s!==null);return!1}var Qc=Error(a(461)),qt=!1;function Kt(t,i,s,o){i.child=t===null?Ym(i,null,s,o):Qi(i,t.child,s,o)}function Fp(t,i,s,o,h){s=s.render;var p=i.ref;if("ref"in o){var v={};for(var S in o)S!=="ref"&&(v[S]=o[S])}else v=o;return Yi(i),o=Oc(t,i,s,v,p,h),S=Rc(),t!==null&&!qt?(Mc(t,i,h),Lr(t,i,h)):(at&&S&&hc(i),i.flags|=1,Kt(t,i,o,h),i.child)}function $p(t,i,s,o,h){if(t===null){var p=s.type;return typeof p=="function"&&!uc(p)&&p.defaultProps===void 0&&s.compare===null?(i.tag=15,i.type=p,Gp(t,i,p,o,h)):(t=Zl(s.type,null,o,i,i.mode,h),t.ref=i.ref,t.return=i,i.child=t)}if(p=t.child,!af(t,h)){var v=p.memoizedProps;if(s=s.compare,s=s!==null?s:Ss,s(v,o)&&t.ref===i.ref)return Lr(t,i,h)}return i.flags|=1,t=Nr(p,o),t.ref=i.ref,t.return=i,i.child=t}function Gp(t,i,s,o,h){if(t!==null){var p=t.memoizedProps;if(Ss(p,o)&&t.ref===i.ref)if(qt=!1,i.pendingProps=o=p,af(t,h))(t.flags&131072)!==0&&(qt=!0);else return i.lanes=t.lanes,Lr(t,i,h)}return Kc(t,i,s,o,h)}function Yp(t,i,s,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|s:s,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 Vp(t,i,p,s,o)}if((s&536870912)!==0)i.memoizedState={baseLanes:0,cachePool:null},t!==null&&no(i,p!==null?p.cachePool:null),p!==null?Xm(i,p):Ac(),Qm(i);else return o=i.lanes=536870912,Vp(t,i,p!==null?p.baseLanes|s:s,s,o)}else p!==null?(no(i,p.cachePool),Xm(i,p),fi(),i.memoizedState=null):(t!==null&&no(i,null),Ac(),fi());return Kt(t,i,h,s),i.child}function Us(t,i){return t!==null&&t.tag===22||i.stateNode!==null||(i.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),i.sibling}function Vp(t,i,s,o,h){var p=wc();return p=p===null?null:{parent:Pt._currentValue,pool:p},i.memoizedState={baseLanes:s,cachePool:p},t!==null&&no(i,null),Ac(),Qm(i),t!==null&&Sa(t,i,o,!0),i.childLanes=h,null}function vo(t,i){return i=wo({mode:i.mode,children:i.children},t.mode),i.ref=t.ref,t.child=i,i.return=t,i}function Jp(t,i,s){return Qi(i,t.child,null,s),t=vo(i,i.pendingProps),t.flags|=2,Cn(i),i.memoizedState=null,t}function Sx(t,i,s){var o=i.pendingProps,h=(i.flags&128)!==0;if(i.flags&=-129,t===null){if(at){if(o.mode==="hidden")return t=vo(i,o),i.lanes=536870912,Us(null,t);if(jc(i),(t=Ct)?(t=sy(t,Gn),t=t!==null&&t.data==="&"?t:null,t!==null&&(i.memoizedState={dehydrated:t,treeContext:ri!==null?{id:dr,overflow:mr}:null,retryLane:536870912,hydrationErrors:null},s=Om(t),s.return=i,i.child=s,Xt=i,Ct=null)):t=null,t===null)throw ai(i);return i.lanes=536870912,null}return vo(i,o)}var p=t.memoizedState;if(p!==null){var v=p.dehydrated;if(jc(i),h)if(i.flags&256)i.flags&=-257,i=Jp(t,i,s);else if(i.memoizedState!==null)i.child=t.child,i.flags|=128,i=null;else throw Error(a(558));else if(qt||Sa(t,i,s,!1),h=(s&t.childLanes)!==0,qt||h){if(o=St,o!==null&&(v=ti(o,s),v!==0&&v!==p.retryLane))throw p.retryLane=v,Ii(t,v),bn(o,t,v),Qc;No(),i=Jp(t,i,s)}else t=p.treeContext,Ct=Vn(v.nextSibling),Xt=i,at=!0,ii=null,Gn=!1,t!==null&&Dm(i,t),i=vo(i,o),i.flags|=4096;return i}return t=Nr(t.child,{mode:o.mode,children:o.children}),t.ref=i.ref,i.child=t,t.return=i,t}function xo(t,i){var s=i.ref;if(s===null)t!==null&&t.ref!==null&&(i.flags|=4194816);else{if(typeof s!="function"&&typeof s!="object")throw Error(a(284));(t===null||t.ref!==s)&&(i.flags|=4194816)}}function Kc(t,i,s,o,h){return Yi(i),s=Oc(t,i,s,o,void 0,h),o=Rc(),t!==null&&!qt?(Mc(t,i,h),Lr(t,i,h)):(at&&o&&hc(i),i.flags|=1,Kt(t,i,s,h),i.child)}function Xp(t,i,s,o,h,p){return Yi(i),i.updateQueue=null,s=Zm(i,o,s,h),Km(t),o=Rc(),t!==null&&!qt?(Mc(t,i,p),Lr(t,i,p)):(at&&o&&hc(i),i.flags|=1,Kt(t,i,s,p),i.child)}function Qp(t,i,s,o,h){if(Yi(i),i.stateNode===null){var p=ba,v=s.contextType;typeof v=="object"&&v!==null&&(p=Qt(v)),p=new s(o,p),i.memoizedState=p.state!==null&&p.state!==void 0?p.state:null,p.updater=Jc,i.stateNode=p,p._reactInternals=i,p=i.stateNode,p.props=o,p.state=i.memoizedState,p.refs={},_c(i),v=s.contextType,p.context=typeof v=="object"&&v!==null?Qt(v):ba,p.state=i.memoizedState,v=s.getDerivedStateFromProps,typeof v=="function"&&(Vc(i,s,v,o),p.state=i.memoizedState),typeof s.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&&Jc.enqueueReplaceState(p,p.state,null),Rs(i,o,p,h),Os(),p.state=i.memoizedState),typeof p.componentDidMount=="function"&&(i.flags|=4194308),o=!0}else if(t===null){p=i.stateNode;var S=i.memoizedProps,P=Zi(s,S);p.props=P;var te=p.context,le=s.contextType;v=ba,typeof le=="object"&&le!==null&&(v=Qt(le));var me=s.getDerivedStateFromProps;le=typeof me=="function"||typeof p.getSnapshotBeforeUpdate=="function",S=i.pendingProps!==S,le||typeof p.UNSAFE_componentWillReceiveProps!="function"&&typeof p.componentWillReceiveProps!="function"||(S||te!==v)&&Lp(i,p,o,v),li=!1;var ne=i.memoizedState;p.state=ne,Rs(i,o,p,h),Os(),te=i.memoizedState,S||ne!==te||li?(typeof me=="function"&&(Vc(i,s,me,o),te=i.memoizedState),(P=li||zp(i,s,P,o,ne,te,v))?(le||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=te),p.props=o,p.state=te,p.context=v,o=P):(typeof p.componentDidMount=="function"&&(i.flags|=4194308),o=!1)}else{p=i.stateNode,Ec(t,i),v=i.memoizedProps,le=Zi(s,v),p.props=le,me=i.pendingProps,ne=p.context,te=s.contextType,P=ba,typeof te=="object"&&te!==null&&(P=Qt(te)),S=s.getDerivedStateFromProps,(te=typeof S=="function"||typeof p.getSnapshotBeforeUpdate=="function")||typeof p.UNSAFE_componentWillReceiveProps!="function"&&typeof p.componentWillReceiveProps!="function"||(v!==me||ne!==P)&&Lp(i,p,o,P),li=!1,ne=i.memoizedState,p.state=ne,Rs(i,o,p,h),Os();var ae=i.memoizedState;v!==me||ne!==ae||li||t!==null&&t.dependencies!==null&&eo(t.dependencies)?(typeof S=="function"&&(Vc(i,s,S,o),ae=i.memoizedState),(le=li||zp(i,s,le,o,ne,ae,P)||t!==null&&t.dependencies!==null&&eo(t.dependencies))?(te||typeof p.UNSAFE_componentWillUpdate!="function"&&typeof p.componentWillUpdate!="function"||(typeof p.componentWillUpdate=="function"&&p.componentWillUpdate(o,ae,P),typeof p.UNSAFE_componentWillUpdate=="function"&&p.UNSAFE_componentWillUpdate(o,ae,P)),typeof p.componentDidUpdate=="function"&&(i.flags|=4),typeof p.getSnapshotBeforeUpdate=="function"&&(i.flags|=1024)):(typeof p.componentDidUpdate!="function"||v===t.memoizedProps&&ne===t.memoizedState||(i.flags|=4),typeof p.getSnapshotBeforeUpdate!="function"||v===t.memoizedProps&&ne===t.memoizedState||(i.flags|=1024),i.memoizedProps=o,i.memoizedState=ae),p.props=o,p.state=ae,p.context=P,o=le):(typeof p.componentDidUpdate!="function"||v===t.memoizedProps&&ne===t.memoizedState||(i.flags|=4),typeof p.getSnapshotBeforeUpdate!="function"||v===t.memoizedProps&&ne===t.memoizedState||(i.flags|=1024),o=!1)}return p=o,xo(t,i),o=(i.flags&128)!==0,p||o?(p=i.stateNode,s=o&&typeof s.getDerivedStateFromError!="function"?null:p.render(),i.flags|=1,t!==null&&o?(i.child=Qi(i,t.child,null,h),i.child=Qi(i,null,s,h)):Kt(t,i,s,h),i.memoizedState=p.state,t=i.child):t=Lr(t,i,h),t}function Kp(t,i,s,o){return $i(),i.flags|=256,Kt(t,i,s,o),i.child}var Zc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Wc(t){return{baseLanes:t,cachePool:Hm()}}function ef(t,i,s){return t=t!==null?t.childLanes&~s:0,i&&(t|=Tn),t}function Zp(t,i,s){var o=i.pendingProps,h=!1,p=(i.flags&128)!==0,v;if((v=p)||(v=t!==null&&t.memoizedState===null?!1:(Lt.current&2)!==0),v&&(h=!0,i.flags&=-129),v=(i.flags&32)!==0,i.flags&=-33,t===null){if(at){if(h?ci(i):fi(),(t=Ct)?(t=sy(t,Gn),t=t!==null&&t.data!=="&"?t:null,t!==null&&(i.memoizedState={dehydrated:t,treeContext:ri!==null?{id:dr,overflow:mr}:null,retryLane:536870912,hydrationErrors:null},s=Om(t),s.return=i,i.child=s,Xt=i,Ct=null)):t=null,t===null)throw ai(i);return Uf(t)?i.lanes=32:i.lanes=536870912,null}var S=o.children;return o=o.fallback,h?(fi(),h=i.mode,S=wo({mode:"hidden",children:S},h),o=Fi(o,h,s,null),S.return=i,o.return=i,S.sibling=o,i.child=S,o=i.child,o.memoizedState=Wc(s),o.childLanes=ef(t,v,s),i.memoizedState=Zc,Us(null,o)):(ci(i),tf(i,S))}var P=t.memoizedState;if(P!==null&&(S=P.dehydrated,S!==null)){if(p)i.flags&256?(ci(i),i.flags&=-257,i=nf(t,i,s)):i.memoizedState!==null?(fi(),i.child=t.child,i.flags|=128,i=null):(fi(),S=o.fallback,h=i.mode,o=wo({mode:"visible",children:o.children},h),S=Fi(S,h,s,null),S.flags|=2,o.return=i,S.return=i,o.sibling=S,i.child=o,Qi(i,t.child,null,s),o=i.child,o.memoizedState=Wc(s),o.childLanes=ef(t,v,s),i.memoizedState=Zc,i=Us(null,o));else if(ci(i),Uf(S)){if(v=S.nextSibling&&S.nextSibling.dataset,v)var te=v.dgst;v=te,o=Error(a(419)),o.stack="",o.digest=v,ks({value:o,source:null,stack:null}),i=nf(t,i,s)}else if(qt||Sa(t,i,s,!1),v=(s&t.childLanes)!==0,qt||v){if(v=St,v!==null&&(o=ti(v,s),o!==0&&o!==P.retryLane))throw P.retryLane=o,Ii(t,o),bn(v,t,o),Qc;Lf(S)||No(),i=nf(t,i,s)}else Lf(S)?(i.flags|=192,i.child=t.child,i=null):(t=P.treeContext,Ct=Vn(S.nextSibling),Xt=i,at=!0,ii=null,Gn=!1,t!==null&&Dm(i,t),i=tf(i,o.children),i.flags|=4096);return i}return h?(fi(),S=o.fallback,h=i.mode,P=t.child,te=P.sibling,o=Nr(P,{mode:"hidden",children:o.children}),o.subtreeFlags=P.subtreeFlags&65011712,te!==null?S=Nr(te,S):(S=Fi(S,h,s,null),S.flags|=2),S.return=i,o.return=i,o.sibling=S,i.child=o,Us(null,o),o=i.child,S=t.child.memoizedState,S===null?S=Wc(s):(h=S.cachePool,h!==null?(P=Pt._currentValue,h=h.parent!==P?{parent:P,pool:P}:h):h=Hm(),S={baseLanes:S.baseLanes|s,cachePool:h}),o.memoizedState=S,o.childLanes=ef(t,v,s),i.memoizedState=Zc,Us(t.child,o)):(ci(i),s=t.child,t=s.sibling,s=Nr(s,{mode:"visible",children:o.children}),s.return=i,s.sibling=null,t!==null&&(v=i.deletions,v===null?(i.deletions=[t],i.flags|=16):v.push(t)),i.child=s,i.memoizedState=null,s)}function tf(t,i){return i=wo({mode:"visible",children:i},t.mode),i.return=t,t.child=i}function wo(t,i){return t=En(22,t,null,i),t.lanes=0,t}function nf(t,i,s){return Qi(i,t.child,null,s),t=tf(i,i.pendingProps.children),t.flags|=2,i.memoizedState=null,t}function Wp(t,i,s){t.lanes|=i;var o=t.alternate;o!==null&&(o.lanes|=i),yc(t.return,i,s)}function rf(t,i,s,o,h,p){var v=t.memoizedState;v===null?t.memoizedState={isBackwards:i,rendering:null,renderingStartTime:0,last:o,tail:s,tailMode:h,treeForkCount:p}:(v.isBackwards=i,v.rendering=null,v.renderingStartTime=0,v.last=o,v.tail=s,v.tailMode=h,v.treeForkCount=p)}function eg(t,i,s){var o=i.pendingProps,h=o.revealOrder,p=o.tail;o=o.children;var v=Lt.current,S=(v&2)!==0;if(S?(v=v&1|2,i.flags|=128):v&=1,_(Lt,v),Kt(t,i,o,s),o=at?Es:0,!S&&t!==null&&(t.flags&128)!==0)e:for(t=i.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&Wp(t,s,i);else if(t.tag===19)Wp(t,s,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(s=i.child,h=null;s!==null;)t=s.alternate,t!==null&&oo(t)===null&&(h=s),s=s.sibling;s=h,s===null?(h=i.child,i.child=null):(h=s.sibling,s.sibling=null),rf(i,!1,h,s,p,o);break;case"backwards":case"unstable_legacy-backwards":for(s=null,h=i.child,i.child=null;h!==null;){if(t=h.alternate,t!==null&&oo(t)===null){i.child=h;break}t=h.sibling,h.sibling=s,s=h,h=t}rf(i,!0,s,null,p,o);break;case"together":rf(i,!1,null,null,void 0,o);break;default:i.memoizedState=null}return i.child}function Lr(t,i,s){if(t!==null&&(i.dependencies=t.dependencies),mi|=i.lanes,(s&i.childLanes)===0)if(t!==null){if(Sa(t,i,s,!1),(s&i.childLanes)===0)return null}else return null;if(t!==null&&i.child!==t.child)throw Error(a(153));if(i.child!==null){for(t=i.child,s=Nr(t,t.pendingProps),i.child=s,s.return=i;t.sibling!==null;)t=t.sibling,s=s.sibling=Nr(t,t.pendingProps),s.return=i;s.sibling=null}return i.child}function af(t,i){return(t.lanes&i)!==0?!0:(t=t.dependencies,!!(t!==null&&eo(t)))}function _x(t,i,s){switch(i.tag){case 3:De(i,i.stateNode.containerInfo),si(i,Pt,t.memoizedState.cache),$i();break;case 27:case 5:ze(i);break;case 4:De(i,i.stateNode.containerInfo);break;case 10:si(i,i.type,i.memoizedProps.value);break;case 31:if(i.memoizedState!==null)return i.flags|=128,jc(i),null;break;case 13:var o=i.memoizedState;if(o!==null)return o.dehydrated!==null?(ci(i),i.flags|=128,null):(s&i.child.childLanes)!==0?Zp(t,i,s):(ci(i),t=Lr(t,i,s),t!==null?t.sibling:null);ci(i);break;case 19:var h=(t.flags&128)!==0;if(o=(s&i.childLanes)!==0,o||(Sa(t,i,s,!1),o=(s&i.childLanes)!==0),h){if(o)return eg(t,i,s);i.flags|=128}if(h=i.memoizedState,h!==null&&(h.rendering=null,h.tail=null,h.lastEffect=null),_(Lt,Lt.current),o)break;return null;case 22:return i.lanes=0,Yp(t,i,s,i.pendingProps);case 24:si(i,Pt,t.memoizedState.cache)}return Lr(t,i,s)}function tg(t,i,s){if(t!==null)if(t.memoizedProps!==i.pendingProps)qt=!0;else{if(!af(t,s)&&(i.flags&128)===0)return qt=!1,_x(t,i,s);qt=(t.flags&131072)!==0}else qt=!1,at&&(i.flags&1048576)!==0&&Mm(i,Es,i.index);switch(i.lanes=0,i.tag){case 16:e:{var o=i.pendingProps;if(t=Ji(i.elementType),i.type=t,typeof t=="function")uc(t)?(o=Zi(t,o),i.tag=1,i=Qp(null,i,t,o,s)):(i.tag=0,i=Kc(null,i,t,o,s));else{if(t!=null){var h=t.$$typeof;if(h===se){i.tag=11,i=Fp(null,i,t,o,s);break e}else if(h===V){i.tag=14,i=$p(null,i,t,o,s);break e}}throw i=fe(t)||t,Error(a(306,i,""))}}return i;case 0:return Kc(t,i,i.type,i.pendingProps,s);case 1:return o=i.type,h=Zi(o,i.pendingProps),Qp(t,i,o,h,s);case 3:e:{if(De(i,i.stateNode.containerInfo),t===null)throw Error(a(387));o=i.pendingProps;var p=i.memoizedState;h=p.element,Ec(t,i),Rs(i,o,null,s);var v=i.memoizedState;if(o=v.cache,si(i,Pt,o),o!==p.cache&&bc(i,[Pt],s,!0),Os(),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=Kp(t,i,o,s);break e}else if(o!==h){h=In(Error(a(424)),i),ks(h),i=Kp(t,i,o,s);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(Ct=Vn(t.firstChild),Xt=i,at=!0,ii=null,Gn=!0,s=Ym(i,null,o,s),i.child=s;s;)s.flags=s.flags&-3|4096,s=s.sibling}else{if($i(),o===h){i=Lr(t,i,s);break e}Kt(t,i,o,s)}i=i.child}return i;case 26:return xo(t,i),t===null?(s=hy(i.type,null,i.pendingProps,null))?i.memoizedState=s:at||(s=i.type,t=i.pendingProps,o=Uo(ve.current).createElement(s),o[wt]=i,o[Mt]=t,Zt(o,s,t),I(o),i.stateNode=o):i.memoizedState=hy(i.type,t.memoizedProps,i.pendingProps,t.memoizedState),null;case 27:return ze(i),t===null&&at&&(o=i.stateNode=uy(i.type,i.pendingProps,ve.current),Xt=i,Gn=!0,h=Ct,vi(i.type)?(Bf=h,Ct=Vn(o.firstChild)):Ct=h),Kt(t,i,i.pendingProps.children,s),xo(t,i),t===null&&(i.flags|=4194304),i.child;case 5:return t===null&&at&&((h=o=Ct)&&(o=Wx(o,i.type,i.pendingProps,Gn),o!==null?(i.stateNode=o,Xt=i,Ct=Vn(o.firstChild),Gn=!1,h=!0):h=!1),h||ai(i)),ze(i),h=i.type,p=i.pendingProps,v=t!==null?t.memoizedProps:null,o=p.children,Mf(h,p)?o=null:v!==null&&Mf(h,v)&&(i.flags|=32),i.memoizedState!==null&&(h=Oc(t,i,mx,null,null,s),Zs._currentValue=h),xo(t,i),Kt(t,i,o,s),i.child;case 6:return t===null&&at&&((t=s=Ct)&&(s=ew(s,i.pendingProps,Gn),s!==null?(i.stateNode=s,Xt=i,Ct=null,t=!0):t=!1),t||ai(i)),null;case 13:return Zp(t,i,s);case 4:return De(i,i.stateNode.containerInfo),o=i.pendingProps,t===null?i.child=Qi(i,null,o,s):Kt(t,i,o,s),i.child;case 11:return Fp(t,i,i.type,i.pendingProps,s);case 7:return Kt(t,i,i.pendingProps,s),i.child;case 8:return Kt(t,i,i.pendingProps.children,s),i.child;case 12:return Kt(t,i,i.pendingProps.children,s),i.child;case 10:return o=i.pendingProps,si(i,i.type,o.value),Kt(t,i,o.children,s),i.child;case 9:return h=i.type._context,o=i.pendingProps.children,Yi(i),h=Qt(h),o=o(h),i.flags|=1,Kt(t,i,o,s),i.child;case 14:return $p(t,i,i.type,i.pendingProps,s);case 15:return Gp(t,i,i.type,i.pendingProps,s);case 19:return eg(t,i,s);case 31:return Sx(t,i,s);case 22:return Yp(t,i,s,i.pendingProps);case 24:return Yi(i),o=Qt(Pt),t===null?(h=wc(),h===null&&(h=St,p=vc(),h.pooledCache=p,p.refCount++,p!==null&&(h.pooledCacheLanes|=s),h=p),i.memoizedState={parent:o,cache:h},_c(i),si(i,Pt,h)):((t.lanes&s)!==0&&(Ec(t,i),Rs(i,null,null,s),Os()),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),si(i,Pt,o)):(o=p.cache,si(i,Pt,o),o!==h.cache&&bc(i,[Pt],s,!0))),Kt(t,i,i.pendingProps.children,s),i.child;case 29:throw i.pendingProps}throw Error(a(156,i.tag))}function Ur(t){t.flags|=4}function sf(t,i,s,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(Tg())t.flags|=8192;else throw Xi=io,Sc}else t.flags&=-16777217}function ng(t,i){if(i.type!=="stylesheet"||(i.state.loading&4)!==0)t.flags&=-16777217;else if(t.flags|=16777216,!yy(i))if(Tg())t.flags|=8192;else throw Xi=io,Sc}function So(t,i){i!==null&&(t.flags|=4),t.flags&16384&&(i=t.tag!==22?oa():536870912,t.lanes|=i,Da|=i)}function Bs(t,i){if(!at)switch(t.tailMode){case"hidden":i=t.tail;for(var s=null;i!==null;)i.alternate!==null&&(s=i),i=i.sibling;s===null?t.tail=null:s.sibling=null;break;case"collapsed":s=t.tail;for(var o=null;s!==null;)s.alternate!==null&&(o=s),s=s.sibling;o===null?i||t.tail===null?t.tail=null:t.tail.sibling=null:o.sibling=null}}function At(t){var i=t.alternate!==null&&t.alternate.child===t.child,s=0,o=0;if(i)for(var h=t.child;h!==null;)s|=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;)s|=h.lanes|h.childLanes,o|=h.subtreeFlags,o|=h.flags,h.return=t,h=h.sibling;return t.subtreeFlags|=o,t.childLanes=s,i}function Ex(t,i,s){var o=i.pendingProps;switch(dc(i),i.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return At(i),null;case 1:return At(i),null;case 3:return s=i.stateNode,o=null,t!==null&&(o=t.memoizedState.cache),i.memoizedState.cache!==o&&(i.flags|=2048),Mr(Pt),ke(),s.pendingContext&&(s.context=s.pendingContext,s.pendingContext=null),(t===null||t.child===null)&&(wa(i)?Ur(i):t===null||t.memoizedState.isDehydrated&&(i.flags&256)===0||(i.flags|=1024,pc())),At(i),null;case 26:var h=i.type,p=i.memoizedState;return t===null?(Ur(i),p!==null?(At(i),ng(i,p)):(At(i),sf(i,h,null,o,s))):p?p!==t.memoizedState?(Ur(i),At(i),ng(i,p)):(At(i),i.flags&=-16777217):(t=t.memoizedProps,t!==o&&Ur(i),At(i),sf(i,h,t,o,s)),null;case 27:if($e(i),s=ve.current,h=i.type,t!==null&&i.stateNode!=null)t.memoizedProps!==o&&Ur(i);else{if(!o){if(i.stateNode===null)throw Error(a(166));return At(i),null}t=he.current,wa(i)?zm(i):(t=uy(h,o,s),i.stateNode=t,Ur(i))}return At(i),null;case 5:if($e(i),h=i.type,t!==null&&i.stateNode!=null)t.memoizedProps!==o&&Ur(i);else{if(!o){if(i.stateNode===null)throw Error(a(166));return At(i),null}if(p=he.current,wa(i))zm(i);else{var v=Uo(ve.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[wt]=i,p[Mt]=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(Zt(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&&Ur(i)}}return At(i),sf(i,i.type,t===null?null:t.memoizedProps,i.pendingProps,s),null;case 6:if(t&&i.stateNode!=null)t.memoizedProps!==o&&Ur(i);else{if(typeof o!="string"&&i.stateNode===null)throw Error(a(166));if(t=ve.current,wa(i)){if(t=i.stateNode,s=i.memoizedProps,o=null,h=Xt,h!==null)switch(h.tag){case 27:case 5:o=h.memoizedProps}t[wt]=i,t=!!(t.nodeValue===s||o!==null&&o.suppressHydrationWarning===!0||Zg(t.nodeValue,s)),t||ai(i,!0)}else t=Uo(t).createTextNode(o),t[wt]=i,i.stateNode=t}return At(i),null;case 31:if(s=i.memoizedState,t===null||t.memoizedState!==null){if(o=wa(i),s!==null){if(t===null){if(!o)throw Error(a(318));if(t=i.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(a(557));t[wt]=i}else $i(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;At(i),t=!1}else s=pc(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=s),t=!0;if(!t)return i.flags&256?(Cn(i),i):(Cn(i),null);if((i.flags&128)!==0)throw Error(a(558))}return At(i),null;case 13:if(o=i.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(h=wa(i),o!==null&&o.dehydrated!==null){if(t===null){if(!h)throw Error(a(318));if(h=i.memoizedState,h=h!==null?h.dehydrated:null,!h)throw Error(a(317));h[wt]=i}else $i(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;At(i),h=!1}else h=pc(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=h),h=!0;if(!h)return i.flags&256?(Cn(i),i):(Cn(i),null)}return Cn(i),(i.flags&128)!==0?(i.lanes=s,i):(s=o!==null,t=t!==null&&t.memoizedState!==null,s&&(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)),s!==t&&s&&(i.child.flags|=8192),So(i,i.updateQueue),At(i),null);case 4:return ke(),t===null&&Tf(i.stateNode.containerInfo),At(i),null;case 10:return Mr(i.type),At(i),null;case 19:if(W(Lt),o=i.memoizedState,o===null)return At(i),null;if(h=(i.flags&128)!==0,p=o.rendering,p===null)if(h)Bs(o,!1);else{if(zt!==0||t!==null&&(t.flags&128)!==0)for(t=i.child;t!==null;){if(p=oo(t),p!==null){for(i.flags|=128,Bs(o,!1),t=p.updateQueue,i.updateQueue=t,So(i,t),i.subtreeFlags=0,t=s,s=i.child;s!==null;)Nm(s,t),s=s.sibling;return _(Lt,Lt.current&1|2),at&&Or(i,o.treeForkCount),i.child}t=t.sibling}o.tail!==null&&yt()>Ao&&(i.flags|=128,h=!0,Bs(o,!1),i.lanes=4194304)}else{if(!h)if(t=oo(p),t!==null){if(i.flags|=128,h=!0,t=t.updateQueue,i.updateQueue=t,So(i,t),Bs(o,!0),o.tail===null&&o.tailMode==="hidden"&&!p.alternate&&!at)return At(i),null}else 2*yt()-o.renderingStartTime>Ao&&s!==536870912&&(i.flags|=128,h=!0,Bs(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=yt(),t.sibling=null,s=Lt.current,_(Lt,h?s&1|2:s&1),at&&Or(i,o.treeForkCount),t):(At(i),null);case 22:case 23:return Cn(i),Tc(),o=i.memoizedState!==null,t!==null?t.memoizedState!==null!==o&&(i.flags|=8192):o&&(i.flags|=8192),o?(s&536870912)!==0&&(i.flags&128)===0&&(At(i),i.subtreeFlags&6&&(i.flags|=8192)):At(i),s=i.updateQueue,s!==null&&So(i,s.retryQueue),s=null,t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(s=t.memoizedState.cachePool.pool),o=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(o=i.memoizedState.cachePool.pool),o!==s&&(i.flags|=2048),t!==null&&W(Vi),null;case 24:return s=null,t!==null&&(s=t.memoizedState.cache),i.memoizedState.cache!==s&&(i.flags|=2048),Mr(Pt),At(i),null;case 25:return null;case 30:return null}throw Error(a(156,i.tag))}function kx(t,i){switch(dc(i),i.tag){case 1:return t=i.flags,t&65536?(i.flags=t&-65537|128,i):null;case 3:return Mr(Pt),ke(),t=i.flags,(t&65536)!==0&&(t&128)===0?(i.flags=t&-65537|128,i):null;case 26:case 27:case 5:return $e(i),null;case 31:if(i.memoizedState!==null){if(Cn(i),i.alternate===null)throw Error(a(340));$i()}return t=i.flags,t&65536?(i.flags=t&-65537|128,i):null;case 13:if(Cn(i),t=i.memoizedState,t!==null&&t.dehydrated!==null){if(i.alternate===null)throw Error(a(340));$i()}return t=i.flags,t&65536?(i.flags=t&-65537|128,i):null;case 19:return W(Lt),null;case 4:return ke(),null;case 10:return Mr(i.type),null;case 22:case 23:return Cn(i),Tc(),t!==null&&W(Vi),t=i.flags,t&65536?(i.flags=t&-65537|128,i):null;case 24:return Mr(Pt),null;case 25:return null;default:return null}}function rg(t,i){switch(dc(i),i.tag){case 3:Mr(Pt),ke();break;case 26:case 27:case 5:$e(i);break;case 4:ke();break;case 31:i.memoizedState!==null&&Cn(i);break;case 13:Cn(i);break;case 19:W(Lt);break;case 10:Mr(i.type);break;case 22:case 23:Cn(i),Tc(),t!==null&&W(Vi);break;case 24:Mr(Pt)}}function Ps(t,i){try{var s=i.updateQueue,o=s!==null?s.lastEffect:null;if(o!==null){var h=o.next;s=h;do{if((s.tag&t)===t){o=void 0;var p=s.create,v=s.inst;o=p(),v.destroy=o}s=s.next}while(s!==h)}}catch(S){gt(i,i.return,S)}}function hi(t,i,s){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,S=v.destroy;if(S!==void 0){v.destroy=void 0,h=i;var P=s,te=S;try{te()}catch(le){gt(h,P,le)}}}o=o.next}while(o!==p)}}catch(le){gt(i,i.return,le)}}function ig(t){var i=t.updateQueue;if(i!==null){var s=t.stateNode;try{Jm(i,s)}catch(o){gt(t,t.return,o)}}}function ag(t,i,s){s.props=Zi(t.type,t.memoizedProps),s.state=t.memoizedState;try{s.componentWillUnmount()}catch(o){gt(t,i,o)}}function Hs(t,i){try{var s=t.ref;if(s!==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 s=="function"?t.refCleanup=s(o):s.current=o}}catch(h){gt(t,i,h)}}function pr(t,i){var s=t.ref,o=t.refCleanup;if(s!==null)if(typeof o=="function")try{o()}catch(h){gt(t,i,h)}finally{t.refCleanup=null,t=t.alternate,t!=null&&(t.refCleanup=null)}else if(typeof s=="function")try{s(null)}catch(h){gt(t,i,h)}else s.current=null}function sg(t){var i=t.type,s=t.memoizedProps,o=t.stateNode;try{e:switch(i){case"button":case"input":case"select":case"textarea":s.autoFocus&&o.focus();break e;case"img":s.src?o.src=s.src:s.srcSet&&(o.srcset=s.srcSet)}}catch(h){gt(t,t.return,h)}}function lf(t,i,s){try{var o=t.stateNode;Vx(o,t.type,s,i),o[Mt]=i}catch(h){gt(t,t.return,h)}}function lg(t){return t.tag===5||t.tag===3||t.tag===26||t.tag===27&&vi(t.type)||t.tag===4}function of(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||lg(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&&vi(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 uf(t,i,s){var o=t.tag;if(o===5||o===6)t=t.stateNode,i?(s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s).insertBefore(t,i):(i=s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s,i.appendChild(t),s=s._reactRootContainer,s!=null||i.onclick!==null||(i.onclick=Tr));else if(o!==4&&(o===27&&vi(t.type)&&(s=t.stateNode,i=null),t=t.child,t!==null))for(uf(t,i,s),t=t.sibling;t!==null;)uf(t,i,s),t=t.sibling}function _o(t,i,s){var o=t.tag;if(o===5||o===6)t=t.stateNode,i?s.insertBefore(t,i):s.appendChild(t);else if(o!==4&&(o===27&&vi(t.type)&&(s=t.stateNode),t=t.child,t!==null))for(_o(t,i,s),t=t.sibling;t!==null;)_o(t,i,s),t=t.sibling}function og(t){var i=t.stateNode,s=t.memoizedProps;try{for(var o=t.type,h=i.attributes;h.length;)i.removeAttributeNode(h[0]);Zt(i,o,s),i[wt]=t,i[Mt]=s}catch(p){gt(t,t.return,p)}}var Br=!1,It=!1,cf=!1,ug=typeof WeakSet=="function"?WeakSet:Set,Yt=null;function Cx(t,i){if(t=t.containerInfo,Of=$o,t=wm(t),nc(t)){if("selectionStart"in t)var s={start:t.selectionStart,end:t.selectionEnd};else e:{s=(s=t.ownerDocument)&&s.defaultView||window;var o=s.getSelection&&s.getSelection();if(o&&o.rangeCount!==0){s=o.anchorNode;var h=o.anchorOffset,p=o.focusNode;o=o.focusOffset;try{s.nodeType,p.nodeType}catch{s=null;break e}var v=0,S=-1,P=-1,te=0,le=0,me=t,ne=null;t:for(;;){for(var ae;me!==s||h!==0&&me.nodeType!==3||(S=v+h),me!==p||o!==0&&me.nodeType!==3||(P=v+o),me.nodeType===3&&(v+=me.nodeValue.length),(ae=me.firstChild)!==null;)ne=me,me=ae;for(;;){if(me===t)break t;if(ne===s&&++te===h&&(S=v),ne===p&&++le===o&&(P=v),(ae=me.nextSibling)!==null)break;me=ne,ne=me.parentNode}me=ae}s=S===-1||P===-1?null:{start:S,end:P}}else s=null}s=s||{start:0,end:0}}else s=null;for(Rf={focusedElem:t,selectionRange:s},$o=!1,Yt=i;Yt!==null;)if(i=Yt,t=i.child,(i.subtreeFlags&1028)!==0&&t!==null)t.return=i,Yt=t;else for(;Yt!==null;){switch(i=Yt,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(s=0;s<t.length;s++)h=t[s],h.ref.impl=h.nextImpl;break;case 11:case 15:break;case 1:if((t&1024)!==0&&p!==null){t=void 0,s=i,h=p.memoizedProps,p=p.memoizedState,o=s.stateNode;try{var Re=Zi(s.type,h);t=o.getSnapshotBeforeUpdate(Re,p),o.__reactInternalSnapshotBeforeUpdate=t}catch(He){gt(s,s.return,He)}}break;case 3:if((t&1024)!==0){if(t=i.stateNode.containerInfo,s=t.nodeType,s===9)zf(t);else if(s===1)switch(t.nodeName){case"HEAD":case"HTML":case"BODY":zf(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(a(163))}if(t=i.sibling,t!==null){t.return=i.return,Yt=t;break}Yt=i.return}}function cg(t,i,s){var o=s.flags;switch(s.tag){case 0:case 11:case 15:Hr(t,s),o&4&&Ps(5,s);break;case 1:if(Hr(t,s),o&4)if(t=s.stateNode,i===null)try{t.componentDidMount()}catch(v){gt(s,s.return,v)}else{var h=Zi(s.type,i.memoizedProps);i=i.memoizedState;try{t.componentDidUpdate(h,i,t.__reactInternalSnapshotBeforeUpdate)}catch(v){gt(s,s.return,v)}}o&64&&ig(s),o&512&&Hs(s,s.return);break;case 3:if(Hr(t,s),o&64&&(t=s.updateQueue,t!==null)){if(i=null,s.child!==null)switch(s.child.tag){case 27:case 5:i=s.child.stateNode;break;case 1:i=s.child.stateNode}try{Jm(t,i)}catch(v){gt(s,s.return,v)}}break;case 27:i===null&&o&4&&og(s);case 26:case 5:Hr(t,s),i===null&&o&4&&sg(s),o&512&&Hs(s,s.return);break;case 12:Hr(t,s);break;case 31:Hr(t,s),o&4&&dg(t,s);break;case 13:Hr(t,s),o&4&&mg(t,s),o&64&&(t=s.memoizedState,t!==null&&(t=t.dehydrated,t!==null&&(s=zx.bind(null,s),tw(t,s))));break;case 22:if(o=s.memoizedState!==null||Br,!o){i=i!==null&&i.memoizedState!==null||It,h=Br;var p=It;Br=o,(It=i)&&!p?qr(t,s,(s.subtreeFlags&8772)!==0):Hr(t,s),Br=h,It=p}break;case 30:break;default:Hr(t,s)}}function fg(t){var i=t.alternate;i!==null&&(t.alternate=null,fg(i)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(i=t.stateNode,i!==null&&ua(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 jt=null,mn=!1;function Pr(t,i,s){for(s=s.child;s!==null;)hg(t,i,s),s=s.sibling}function hg(t,i,s){if(ot&&typeof ot.onCommitFiberUnmount=="function")try{ot.onCommitFiberUnmount(st,s)}catch{}switch(s.tag){case 26:It||pr(s,i),Pr(t,i,s),s.memoizedState?s.memoizedState.count--:s.stateNode&&(s=s.stateNode,s.parentNode.removeChild(s));break;case 27:It||pr(s,i);var o=jt,h=mn;vi(s.type)&&(jt=s.stateNode,mn=!1),Pr(t,i,s),Xs(s.stateNode),jt=o,mn=h;break;case 5:It||pr(s,i);case 6:if(o=jt,h=mn,jt=null,Pr(t,i,s),jt=o,mn=h,jt!==null)if(mn)try{(jt.nodeType===9?jt.body:jt.nodeName==="HTML"?jt.ownerDocument.body:jt).removeChild(s.stateNode)}catch(p){gt(s,i,p)}else try{jt.removeChild(s.stateNode)}catch(p){gt(s,i,p)}break;case 18:jt!==null&&(mn?(t=jt,iy(t.nodeType===9?t.body:t.nodeName==="HTML"?t.ownerDocument.body:t,s.stateNode),Ia(t)):iy(jt,s.stateNode));break;case 4:o=jt,h=mn,jt=s.stateNode.containerInfo,mn=!0,Pr(t,i,s),jt=o,mn=h;break;case 0:case 11:case 14:case 15:hi(2,s,i),It||hi(4,s,i),Pr(t,i,s);break;case 1:It||(pr(s,i),o=s.stateNode,typeof o.componentWillUnmount=="function"&&ag(s,i,o)),Pr(t,i,s);break;case 21:Pr(t,i,s);break;case 22:It=(o=It)||s.memoizedState!==null,Pr(t,i,s),It=o;break;default:Pr(t,i,s)}}function dg(t,i){if(i.memoizedState===null&&(t=i.alternate,t!==null&&(t=t.memoizedState,t!==null))){t=t.dehydrated;try{Ia(t)}catch(s){gt(i,i.return,s)}}}function mg(t,i){if(i.memoizedState===null&&(t=i.alternate,t!==null&&(t=t.memoizedState,t!==null&&(t=t.dehydrated,t!==null))))try{Ia(t)}catch(s){gt(i,i.return,s)}}function Ax(t){switch(t.tag){case 31:case 13:case 19:var i=t.stateNode;return i===null&&(i=t.stateNode=new ug),i;case 22:return t=t.stateNode,i=t._retryCache,i===null&&(i=t._retryCache=new ug),i;default:throw Error(a(435,t.tag))}}function Eo(t,i){var s=Ax(t);i.forEach(function(o){if(!s.has(o)){s.add(o);var h=Lx.bind(null,t,o);o.then(h,h)}})}function pn(t,i){var s=i.deletions;if(s!==null)for(var o=0;o<s.length;o++){var h=s[o],p=t,v=i,S=v;e:for(;S!==null;){switch(S.tag){case 27:if(vi(S.type)){jt=S.stateNode,mn=!1;break e}break;case 5:jt=S.stateNode,mn=!1;break e;case 3:case 4:jt=S.stateNode.containerInfo,mn=!0;break e}S=S.return}if(jt===null)throw Error(a(160));hg(p,v,h),jt=null,mn=!1,p=h.alternate,p!==null&&(p.return=null),h.return=null}if(i.subtreeFlags&13886)for(i=i.child;i!==null;)pg(i,t),i=i.sibling}var ir=null;function pg(t,i){var s=t.alternate,o=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:pn(i,t),gn(t),o&4&&(hi(3,t,t.return),Ps(3,t),hi(5,t,t.return));break;case 1:pn(i,t),gn(t),o&512&&(It||s===null||pr(s,s.return)),o&64&&Br&&(t=t.updateQueue,t!==null&&(o=t.callbacks,o!==null&&(s=t.shared.hiddenCallbacks,t.shared.hiddenCallbacks=s===null?o:s.concat(o))));break;case 26:var h=ir;if(pn(i,t),gn(t),o&512&&(It||s===null||pr(s,s.return)),o&4){var p=s!==null?s.memoizedState:null;if(o=t.memoizedState,s===null)if(o===null)if(t.stateNode===null){e:{o=t.type,s=t.memoizedProps,h=h.ownerDocument||h;t:switch(o){case"title":p=h.getElementsByTagName("title")[0],(!p||p[$t]||p[wt]||p.namespaceURI==="http://www.w3.org/2000/svg"||p.hasAttribute("itemprop"))&&(p=h.createElement(o),h.head.insertBefore(p,h.querySelector("head > title"))),Zt(p,o,s),p[wt]=t,I(p),o=p;break e;case"link":var v=py("link","href",h).get(o+(s.href||""));if(v){for(var S=0;S<v.length;S++)if(p=v[S],p.getAttribute("href")===(s.href==null||s.href===""?null:s.href)&&p.getAttribute("rel")===(s.rel==null?null:s.rel)&&p.getAttribute("title")===(s.title==null?null:s.title)&&p.getAttribute("crossorigin")===(s.crossOrigin==null?null:s.crossOrigin)){v.splice(S,1);break t}}p=h.createElement(o),Zt(p,o,s),h.head.appendChild(p);break;case"meta":if(v=py("meta","content",h).get(o+(s.content||""))){for(S=0;S<v.length;S++)if(p=v[S],p.getAttribute("content")===(s.content==null?null:""+s.content)&&p.getAttribute("name")===(s.name==null?null:s.name)&&p.getAttribute("property")===(s.property==null?null:s.property)&&p.getAttribute("http-equiv")===(s.httpEquiv==null?null:s.httpEquiv)&&p.getAttribute("charset")===(s.charSet==null?null:s.charSet)){v.splice(S,1);break t}}p=h.createElement(o),Zt(p,o,s),h.head.appendChild(p);break;default:throw Error(a(468,o))}p[wt]=t,I(p),o=p}t.stateNode=o}else gy(h,t.type,t.stateNode);else t.stateNode=my(h,o,t.memoizedProps);else p!==o?(p===null?s.stateNode!==null&&(s=s.stateNode,s.parentNode.removeChild(s)):p.count--,o===null?gy(h,t.type,t.stateNode):my(h,o,t.memoizedProps)):o===null&&t.stateNode!==null&&lf(t,t.memoizedProps,s.memoizedProps)}break;case 27:pn(i,t),gn(t),o&512&&(It||s===null||pr(s,s.return)),s!==null&&o&4&&lf(t,t.memoizedProps,s.memoizedProps);break;case 5:if(pn(i,t),gn(t),o&512&&(It||s===null||pr(s,s.return)),t.flags&32){h=t.stateNode;try{fa(h,"")}catch(Re){gt(t,t.return,Re)}}o&4&&t.stateNode!=null&&(h=t.memoizedProps,lf(t,h,s!==null?s.memoizedProps:h)),o&1024&&(cf=!0);break;case 6:if(pn(i,t),gn(t),o&4){if(t.stateNode===null)throw Error(a(162));o=t.memoizedProps,s=t.stateNode;try{s.nodeValue=o}catch(Re){gt(t,t.return,Re)}}break;case 3:if(Ho=null,h=ir,ir=Bo(i.containerInfo),pn(i,t),ir=h,gn(t),o&4&&s!==null&&s.memoizedState.isDehydrated)try{Ia(i.containerInfo)}catch(Re){gt(t,t.return,Re)}cf&&(cf=!1,gg(t));break;case 4:o=ir,ir=Bo(t.stateNode.containerInfo),pn(i,t),gn(t),ir=o;break;case 12:pn(i,t),gn(t);break;case 31:pn(i,t),gn(t),o&4&&(o=t.updateQueue,o!==null&&(t.updateQueue=null,Eo(t,o)));break;case 13:pn(i,t),gn(t),t.child.flags&8192&&t.memoizedState!==null!=(s!==null&&s.memoizedState!==null)&&(Co=yt()),o&4&&(o=t.updateQueue,o!==null&&(t.updateQueue=null,Eo(t,o)));break;case 22:h=t.memoizedState!==null;var P=s!==null&&s.memoizedState!==null,te=Br,le=It;if(Br=te||h,It=le||P,pn(i,t),It=le,Br=te,gn(t),o&8192)e:for(i=t.stateNode,i._visibility=h?i._visibility&-2:i._visibility|1,h&&(s===null||P||Br||It||Wi(t)),s=null,i=t;;){if(i.tag===5||i.tag===26){if(s===null){P=s=i;try{if(p=P.stateNode,h)v=p.style,typeof v.setProperty=="function"?v.setProperty("display","none","important"):v.display="none";else{S=P.stateNode;var me=P.memoizedProps.style,ne=me!=null&&me.hasOwnProperty("display")?me.display:null;S.style.display=ne==null||typeof ne=="boolean"?"":(""+ne).trim()}}catch(Re){gt(P,P.return,Re)}}}else if(i.tag===6){if(s===null){P=i;try{P.stateNode.nodeValue=h?"":P.memoizedProps}catch(Re){gt(P,P.return,Re)}}}else if(i.tag===18){if(s===null){P=i;try{var ae=P.stateNode;h?ay(ae,!0):ay(P.stateNode,!1)}catch(Re){gt(P,P.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;s===i&&(s=null),i=i.return}s===i&&(s=null),i.sibling.return=i.return,i=i.sibling}o&4&&(o=t.updateQueue,o!==null&&(s=o.retryQueue,s!==null&&(o.retryQueue=null,Eo(t,s))));break;case 19:pn(i,t),gn(t),o&4&&(o=t.updateQueue,o!==null&&(t.updateQueue=null,Eo(t,o)));break;case 30:break;case 21:break;default:pn(i,t),gn(t)}}function gn(t){var i=t.flags;if(i&2){try{for(var s,o=t.return;o!==null;){if(lg(o)){s=o;break}o=o.return}if(s==null)throw Error(a(160));switch(s.tag){case 27:var h=s.stateNode,p=of(t);_o(t,p,h);break;case 5:var v=s.stateNode;s.flags&32&&(fa(v,""),s.flags&=-33);var S=of(t);_o(t,S,v);break;case 3:case 4:var P=s.stateNode.containerInfo,te=of(t);uf(t,te,P);break;default:throw Error(a(161))}}catch(le){gt(t,t.return,le)}t.flags&=-3}i&4096&&(t.flags&=-4097)}function gg(t){if(t.subtreeFlags&1024)for(t=t.child;t!==null;){var i=t;gg(i),i.tag===5&&i.flags&1024&&i.stateNode.reset(),t=t.sibling}}function Hr(t,i){if(i.subtreeFlags&8772)for(i=i.child;i!==null;)cg(t,i.alternate,i),i=i.sibling}function Wi(t){for(t=t.child;t!==null;){var i=t;switch(i.tag){case 0:case 11:case 14:case 15:hi(4,i,i.return),Wi(i);break;case 1:pr(i,i.return);var s=i.stateNode;typeof s.componentWillUnmount=="function"&&ag(i,i.return,s),Wi(i);break;case 27:Xs(i.stateNode);case 26:case 5:pr(i,i.return),Wi(i);break;case 22:i.memoizedState===null&&Wi(i);break;case 30:Wi(i);break;default:Wi(i)}t=t.sibling}}function qr(t,i,s){for(s=s&&(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:qr(h,p,s),Ps(4,p);break;case 1:if(qr(h,p,s),o=p,h=o.stateNode,typeof h.componentDidMount=="function")try{h.componentDidMount()}catch(te){gt(o,o.return,te)}if(o=p,h=o.updateQueue,h!==null){var S=o.stateNode;try{var P=h.shared.hiddenCallbacks;if(P!==null)for(h.shared.hiddenCallbacks=null,h=0;h<P.length;h++)Vm(P[h],S)}catch(te){gt(o,o.return,te)}}s&&v&64&&ig(p),Hs(p,p.return);break;case 27:og(p);case 26:case 5:qr(h,p,s),s&&o===null&&v&4&&sg(p),Hs(p,p.return);break;case 12:qr(h,p,s);break;case 31:qr(h,p,s),s&&v&4&&dg(h,p);break;case 13:qr(h,p,s),s&&v&4&&mg(h,p);break;case 22:p.memoizedState===null&&qr(h,p,s),Hs(p,p.return);break;case 30:break;default:qr(h,p,s)}i=i.sibling}}function ff(t,i){var s=null;t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(s=t.memoizedState.cachePool.pool),t=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(t=i.memoizedState.cachePool.pool),t!==s&&(t!=null&&t.refCount++,s!=null&&Cs(s))}function hf(t,i){t=null,i.alternate!==null&&(t=i.alternate.memoizedState.cache),i=i.memoizedState.cache,i!==t&&(i.refCount++,t!=null&&Cs(t))}function ar(t,i,s,o){if(i.subtreeFlags&10256)for(i=i.child;i!==null;)yg(t,i,s,o),i=i.sibling}function yg(t,i,s,o){var h=i.flags;switch(i.tag){case 0:case 11:case 15:ar(t,i,s,o),h&2048&&Ps(9,i);break;case 1:ar(t,i,s,o);break;case 3:ar(t,i,s,o),h&2048&&(t=null,i.alternate!==null&&(t=i.alternate.memoizedState.cache),i=i.memoizedState.cache,i!==t&&(i.refCount++,t!=null&&Cs(t)));break;case 12:if(h&2048){ar(t,i,s,o),t=i.stateNode;try{var p=i.memoizedProps,v=p.id,S=p.onPostCommit;typeof S=="function"&&S(v,i.alternate===null?"mount":"update",t.passiveEffectDuration,-0)}catch(P){gt(i,i.return,P)}}else ar(t,i,s,o);break;case 31:ar(t,i,s,o);break;case 13:ar(t,i,s,o);break;case 23:break;case 22:p=i.stateNode,v=i.alternate,i.memoizedState!==null?p._visibility&2?ar(t,i,s,o):qs(t,i):p._visibility&2?ar(t,i,s,o):(p._visibility|=2,Oa(t,i,s,o,(i.subtreeFlags&10256)!==0||!1)),h&2048&&ff(v,i);break;case 24:ar(t,i,s,o),h&2048&&hf(i.alternate,i);break;default:ar(t,i,s,o)}}function Oa(t,i,s,o,h){for(h=h&&((i.subtreeFlags&10256)!==0||!1),i=i.child;i!==null;){var p=t,v=i,S=s,P=o,te=v.flags;switch(v.tag){case 0:case 11:case 15:Oa(p,v,S,P,h),Ps(8,v);break;case 23:break;case 22:var le=v.stateNode;v.memoizedState!==null?le._visibility&2?Oa(p,v,S,P,h):qs(p,v):(le._visibility|=2,Oa(p,v,S,P,h)),h&&te&2048&&ff(v.alternate,v);break;case 24:Oa(p,v,S,P,h),h&&te&2048&&hf(v.alternate,v);break;default:Oa(p,v,S,P,h)}i=i.sibling}}function qs(t,i){if(i.subtreeFlags&10256)for(i=i.child;i!==null;){var s=t,o=i,h=o.flags;switch(o.tag){case 22:qs(s,o),h&2048&&ff(o.alternate,o);break;case 24:qs(s,o),h&2048&&hf(o.alternate,o);break;default:qs(s,o)}i=i.sibling}}var Is=8192;function Ra(t,i,s){if(t.subtreeFlags&Is)for(t=t.child;t!==null;)bg(t,i,s),t=t.sibling}function bg(t,i,s){switch(t.tag){case 26:Ra(t,i,s),t.flags&Is&&t.memoizedState!==null&&dw(s,ir,t.memoizedState,t.memoizedProps);break;case 5:Ra(t,i,s);break;case 3:case 4:var o=ir;ir=Bo(t.stateNode.containerInfo),Ra(t,i,s),ir=o;break;case 22:t.memoizedState===null&&(o=t.alternate,o!==null&&o.memoizedState!==null?(o=Is,Is=16777216,Ra(t,i,s),Is=o):Ra(t,i,s));break;default:Ra(t,i,s)}}function vg(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 Fs(t){var i=t.deletions;if((t.flags&16)!==0){if(i!==null)for(var s=0;s<i.length;s++){var o=i[s];Yt=o,wg(o,t)}vg(t)}if(t.subtreeFlags&10256)for(t=t.child;t!==null;)xg(t),t=t.sibling}function xg(t){switch(t.tag){case 0:case 11:case 15:Fs(t),t.flags&2048&&hi(9,t,t.return);break;case 3:Fs(t);break;case 12:Fs(t);break;case 22:var i=t.stateNode;t.memoizedState!==null&&i._visibility&2&&(t.return===null||t.return.tag!==13)?(i._visibility&=-3,ko(t)):Fs(t);break;default:Fs(t)}}function ko(t){var i=t.deletions;if((t.flags&16)!==0){if(i!==null)for(var s=0;s<i.length;s++){var o=i[s];Yt=o,wg(o,t)}vg(t)}for(t=t.child;t!==null;){switch(i=t,i.tag){case 0:case 11:case 15:hi(8,i,i.return),ko(i);break;case 22:s=i.stateNode,s._visibility&2&&(s._visibility&=-3,ko(i));break;default:ko(i)}t=t.sibling}}function wg(t,i){for(;Yt!==null;){var s=Yt;switch(s.tag){case 0:case 11:case 15:hi(8,s,i);break;case 23:case 22:if(s.memoizedState!==null&&s.memoizedState.cachePool!==null){var o=s.memoizedState.cachePool.pool;o!=null&&o.refCount++}break;case 24:Cs(s.memoizedState.cache)}if(o=s.child,o!==null)o.return=s,Yt=o;else e:for(s=t;Yt!==null;){o=Yt;var h=o.sibling,p=o.return;if(fg(o),o===s){Yt=null;break e}if(h!==null){h.return=p,Yt=h;break e}Yt=p}}}var Tx={getCacheForType:function(t){var i=Qt(Pt),s=i.data.get(t);return s===void 0&&(s=t(),i.data.set(t,s)),s},cacheSignal:function(){return Qt(Pt).controller.signal}},jx=typeof WeakMap=="function"?WeakMap:Map,dt=0,St=null,Ze=null,tt=0,pt=0,An=null,di=!1,Ma=!1,df=!1,Ir=0,zt=0,mi=0,ea=0,mf=0,Tn=0,Da=0,$s=null,yn=null,pf=!1,Co=0,Sg=0,Ao=1/0,To=null,pi=null,Gt=0,gi=null,za=null,Fr=0,gf=0,yf=null,_g=null,Gs=0,bf=null;function jn(){return(dt&2)!==0&&tt!==0?tt&-tt:q.T!==null?Ef():ds()}function Eg(){if(Tn===0)if((tt&536870912)===0||at){var t=kr;kr<<=1,(kr&3932160)===0&&(kr=262144),Tn=t}else Tn=536870912;return t=kn.current,t!==null&&(t.flags|=32),Tn}function bn(t,i,s){(t===St&&(pt===2||pt===9)||t.cancelPendingCommit!==null)&&(La(t,0),yi(t,tt,Tn,!1)),tr(t,s),((dt&2)===0||t!==St)&&(t===St&&((dt&2)===0&&(ea|=s),zt===4&&yi(t,tt,Tn,!1)),gr(t))}function kg(t,i,s){if((dt&6)!==0)throw Error(a(327));var o=!s&&(i&127)===0&&(i&t.expiredLanes)===0||zi(t,i),h=o?Rx(t,i):xf(t,i,!0),p=o;do{if(h===0){Ma&&!o&&yi(t,i,0,!1);break}else{if(s=t.current.alternate,p&&!Nx(s)){h=xf(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 S=t;h=$s;var P=S.current.memoizedState.isDehydrated;if(P&&(La(S,v).flags|=256),v=xf(S,v,!1),v!==2){if(df&&!P){S.errorRecoveryDisabledLanes|=p,ea|=p,h=4;break e}p=yn,yn=h,p!==null&&(yn===null?yn=p:yn.push.apply(yn,p))}h=v}if(p=!1,h!==2)continue}}if(h===1){La(t,0),yi(t,i,0,!0);break}e:{switch(o=t,p=h,p){case 0:case 1:throw Error(a(345));case 4:if((i&4194048)!==i)break;case 6:yi(o,i,Tn,!di);break e;case 2:yn=null;break;case 3:case 5:break;default:throw Error(a(329))}if((i&62914560)===i&&(h=Co+300-yt(),10<h)){if(yi(o,i,Tn,!di),Di(o,0,!0)!==0)break e;Fr=i,o.timeoutHandle=ny(Cg.bind(null,o,s,yn,To,pf,i,Tn,ea,Da,di,p,"Throttled",-0,0),h);break e}Cg(o,s,yn,To,pf,i,Tn,ea,Da,di,p,null,-0,0)}}break}while(!0);gr(t)}function Cg(t,i,s,o,h,p,v,S,P,te,le,me,ne,ae){if(t.timeoutHandle=-1,me=i.subtreeFlags,me&8192||(me&16785408)===16785408){me={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Tr},bg(i,p,me);var Re=(p&62914560)===p?Co-yt():(p&4194048)===p?Sg-yt():0;if(Re=mw(me,Re),Re!==null){Fr=p,t.cancelPendingCommit=Re(Dg.bind(null,t,i,p,s,o,h,v,S,P,le,me,null,ne,ae)),yi(t,p,v,!te);return}}Dg(t,i,p,s,o,h,v,S,P)}function Nx(t){for(var i=t;;){var s=i.tag;if((s===0||s===11||s===15)&&i.flags&16384&&(s=i.updateQueue,s!==null&&(s=s.stores,s!==null)))for(var o=0;o<s.length;o++){var h=s[o],p=h.getSnapshot;h=h.value;try{if(!_n(p(),h))return!1}catch{return!1}}if(s=i.child,i.subtreeFlags&16384&&s!==null)s.return=i,i=s;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 yi(t,i,s,o){i&=~mf,i&=~ea,t.suspendedLanes|=i,t.pingedLanes&=~i,o&&(t.warmLanes|=i),o=t.expirationTimes;for(var h=i;0<h;){var p=31-mt(h),v=1<<p;o[p]=-1,h&=~v}s!==0&&ei(t,s,i)}function jo(){return(dt&6)===0?(Ys(0),!1):!0}function vf(){if(Ze!==null){if(pt===0)var t=Ze.return;else t=Ze,Rr=Gi=null,Dc(t),Ca=null,Ts=0,t=Ze;for(;t!==null;)rg(t.alternate,t),t=t.return;Ze=null}}function La(t,i){var s=t.timeoutHandle;s!==-1&&(t.timeoutHandle=-1,Qx(s)),s=t.cancelPendingCommit,s!==null&&(t.cancelPendingCommit=null,s()),Fr=0,vf(),St=t,Ze=s=Nr(t.current,null),tt=i,pt=0,An=null,di=!1,Ma=zi(t,i),df=!1,Da=Tn=mf=ea=mi=zt=0,yn=$s=null,pf=!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-mt(o),p=1<<h;i|=t[h],o&=~p}return Ir=i,Xl(),s}function Ag(t,i){Je=null,q.H=Ls,i===ka||i===ro?(i=Fm(),pt=3):i===Sc?(i=Fm(),pt=4):pt=i===Qc?8:i!==null&&typeof i=="object"&&typeof i.then=="function"?6:1,An=i,Ze===null&&(zt=1,bo(t,In(i,t.current)))}function Tg(){var t=kn.current;return t===null?!0:(tt&4194048)===tt?Yn===null:(tt&62914560)===tt||(tt&536870912)!==0?t===Yn:!1}function jg(){var t=q.H;return q.H=Ls,t===null?Ls:t}function Ng(){var t=q.A;return q.A=Tx,t}function No(){zt=4,di||(tt&4194048)!==tt&&kn.current!==null||(Ma=!0),(mi&134217727)===0&&(ea&134217727)===0||St===null||yi(St,tt,Tn,!1)}function xf(t,i,s){var o=dt;dt|=2;var h=jg(),p=Ng();(St!==t||tt!==i)&&(To=null,La(t,i)),i=!1;var v=zt;e:do try{if(pt!==0&&Ze!==null){var S=Ze,P=An;switch(pt){case 8:vf(),v=6;break e;case 3:case 2:case 9:case 6:kn.current===null&&(i=!0);var te=pt;if(pt=0,An=null,Ua(t,S,P,te),s&&Ma){v=0;break e}break;default:te=pt,pt=0,An=null,Ua(t,S,P,te)}}Ox(),v=zt;break}catch(le){Ag(t,le)}while(!0);return i&&t.shellSuspendCounter++,Rr=Gi=null,dt=o,q.H=h,q.A=p,Ze===null&&(St=null,tt=0,Xl()),v}function Ox(){for(;Ze!==null;)Og(Ze)}function Rx(t,i){var s=dt;dt|=2;var o=jg(),h=Ng();St!==t||tt!==i?(To=null,Ao=yt()+500,La(t,i)):Ma=zi(t,i);e:do try{if(pt!==0&&Ze!==null){i=Ze;var p=An;t:switch(pt){case 1:pt=0,An=null,Ua(t,i,p,1);break;case 2:case 9:if(qm(p)){pt=0,An=null,Rg(i);break}i=function(){pt!==2&&pt!==9||St!==t||(pt=7),gr(t)},p.then(i,i);break e;case 3:pt=7;break e;case 4:pt=5;break e;case 7:qm(p)?(pt=0,An=null,Rg(i)):(pt=0,An=null,Ua(t,i,p,7));break;case 5:var v=null;switch(Ze.tag){case 26:v=Ze.memoizedState;case 5:case 27:var S=Ze;if(v?yy(v):S.stateNode.complete){pt=0,An=null;var P=S.sibling;if(P!==null)Ze=P;else{var te=S.return;te!==null?(Ze=te,Oo(te)):Ze=null}break t}}pt=0,An=null,Ua(t,i,p,5);break;case 6:pt=0,An=null,Ua(t,i,p,6);break;case 8:vf(),zt=6;break e;default:throw Error(a(462))}}Mx();break}catch(le){Ag(t,le)}while(!0);return Rr=Gi=null,q.H=o,q.A=h,dt=s,Ze!==null?0:(St=null,tt=0,Xl(),zt)}function Mx(){for(;Ze!==null&&!wn();)Og(Ze)}function Og(t){var i=tg(t.alternate,t,Ir);t.memoizedProps=t.pendingProps,i===null?Oo(t):Ze=i}function Rg(t){var i=t,s=i.alternate;switch(i.tag){case 15:case 0:i=Xp(s,i,i.pendingProps,i.type,void 0,tt);break;case 11:i=Xp(s,i,i.pendingProps,i.type.render,i.ref,tt);break;case 5:Dc(i);default:rg(s,i),i=Ze=Nm(i,Ir),i=tg(s,i,Ir)}t.memoizedProps=t.pendingProps,i===null?Oo(t):Ze=i}function Ua(t,i,s,o){Rr=Gi=null,Dc(i),Ca=null,Ts=0;var h=i.return;try{if(wx(t,h,i,s,tt)){zt=1,bo(t,In(s,t.current)),Ze=null;return}}catch(p){if(h!==null)throw Ze=h,p;zt=1,bo(t,In(s,t.current)),Ze=null;return}i.flags&32768?(at||o===1?t=!0:Ma||(tt&536870912)!==0?t=!1:(di=t=!0,(o===2||o===9||o===3||o===6)&&(o=kn.current,o!==null&&o.tag===13&&(o.flags|=16384))),Mg(i,t)):Oo(i)}function Oo(t){var i=t;do{if((i.flags&32768)!==0){Mg(i,di);return}t=i.return;var s=Ex(i.alternate,i,Ir);if(s!==null){Ze=s;return}if(i=i.sibling,i!==null){Ze=i;return}Ze=i=t}while(i!==null);zt===0&&(zt=5)}function Mg(t,i){do{var s=kx(t.alternate,t);if(s!==null){s.flags&=32767,Ze=s;return}if(s=t.return,s!==null&&(s.flags|=32768,s.subtreeFlags=0,s.deletions=null),!i&&(t=t.sibling,t!==null)){Ze=t;return}Ze=t=s}while(t!==null);zt=6,Ze=null}function Dg(t,i,s,o,h,p,v,S,P){t.cancelPendingCommit=null;do Ro();while(Gt!==0);if((dt&6)!==0)throw Error(a(327));if(i!==null){if(i===t.current)throw Error(a(177));if(p=i.lanes|i.childLanes,p|=lc,Wr(t,s,p,v,S,P),t===St&&(Ze=St=null,tt=0),za=i,gi=t,Fr=s,gf=p,yf=h,_g=o,(i.subtreeFlags&10256)!==0||(i.flags&10256)!==0?(t.callbackNode=null,t.callbackPriority=0,Ux(Be,function(){return Pg(),null})):(t.callbackNode=null,t.callbackPriority=0),o=(i.flags&13878)!==0,(i.subtreeFlags&13878)!==0||o){o=q.T,q.T=null,h=re.p,re.p=2,v=dt,dt|=4;try{Cx(t,i,s)}finally{dt=v,re.p=h,q.T=o}}Gt=1,zg(),Lg(),Ug()}}function zg(){if(Gt===1){Gt=0;var t=gi,i=za,s=(i.flags&13878)!==0;if((i.subtreeFlags&13878)!==0||s){s=q.T,q.T=null;var o=re.p;re.p=2;var h=dt;dt|=4;try{pg(i,t);var p=Rf,v=wm(t.containerInfo),S=p.focusedElem,P=p.selectionRange;if(v!==S&&S&&S.ownerDocument&&xm(S.ownerDocument.documentElement,S)){if(P!==null&&nc(S)){var te=P.start,le=P.end;if(le===void 0&&(le=te),"selectionStart"in S)S.selectionStart=te,S.selectionEnd=Math.min(le,S.value.length);else{var me=S.ownerDocument||document,ne=me&&me.defaultView||window;if(ne.getSelection){var ae=ne.getSelection(),Re=S.textContent.length,He=Math.min(P.start,Re),xt=P.end===void 0?He:Math.min(P.end,Re);!ae.extend&&He>xt&&(v=xt,xt=He,He=v);var X=vm(S,He),$=vm(S,xt);if(X&&$&&(ae.rangeCount!==1||ae.anchorNode!==X.node||ae.anchorOffset!==X.offset||ae.focusNode!==$.node||ae.focusOffset!==$.offset)){var ee=me.createRange();ee.setStart(X.node,X.offset),ae.removeAllRanges(),He>xt?(ae.addRange(ee),ae.extend($.node,$.offset)):(ee.setEnd($.node,$.offset),ae.addRange(ee))}}}}for(me=[],ae=S;ae=ae.parentNode;)ae.nodeType===1&&me.push({element:ae,left:ae.scrollLeft,top:ae.scrollTop});for(typeof S.focus=="function"&&S.focus(),S=0;S<me.length;S++){var ue=me[S];ue.element.scrollLeft=ue.left,ue.element.scrollTop=ue.top}}$o=!!Of,Rf=Of=null}finally{dt=h,re.p=o,q.T=s}}t.current=i,Gt=2}}function Lg(){if(Gt===2){Gt=0;var t=gi,i=za,s=(i.flags&8772)!==0;if((i.subtreeFlags&8772)!==0||s){s=q.T,q.T=null;var o=re.p;re.p=2;var h=dt;dt|=4;try{cg(t,i.alternate,i)}finally{dt=h,re.p=o,q.T=s}}Gt=3}}function Ug(){if(Gt===4||Gt===3){Gt=0,fr();var t=gi,i=za,s=Fr,o=_g;(i.subtreeFlags&10256)!==0||(i.flags&10256)!==0?Gt=5:(Gt=0,za=gi=null,Bg(t,t.pendingLanes));var h=t.pendingLanes;if(h===0&&(pi=null),Ui(s),i=i.stateNode,ot&&typeof ot.onCommitFiberRoot=="function")try{ot.onCommitFiberRoot(st,i,void 0,(i.current.flags&128)===128)}catch{}if(o!==null){i=q.T,h=re.p,re.p=2,q.T=null;try{for(var p=t.onRecoverableError,v=0;v<o.length;v++){var S=o[v];p(S.value,{componentStack:S.stack})}}finally{q.T=i,re.p=h}}(Fr&3)!==0&&Ro(),gr(t),h=t.pendingLanes,(s&261930)!==0&&(h&42)!==0?t===bf?Gs++:(Gs=0,bf=t):Gs=0,Ys(0)}}function Bg(t,i){(t.pooledCacheLanes&=i)===0&&(i=t.pooledCache,i!=null&&(t.pooledCache=null,Cs(i)))}function Ro(){return zg(),Lg(),Ug(),Pg()}function Pg(){if(Gt!==5)return!1;var t=gi,i=gf;gf=0;var s=Ui(Fr),o=q.T,h=re.p;try{re.p=32>s?32:s,q.T=null,s=yf,yf=null;var p=gi,v=Fr;if(Gt=0,za=gi=null,Fr=0,(dt&6)!==0)throw Error(a(331));var S=dt;if(dt|=4,xg(p.current),yg(p,p.current,v,s),dt=S,Ys(0,!1),ot&&typeof ot.onPostCommitFiberRoot=="function")try{ot.onPostCommitFiberRoot(st,p)}catch{}return!0}finally{re.p=h,q.T=o,Bg(t,i)}}function Hg(t,i,s){i=In(s,i),i=Xc(t.stateNode,i,2),t=ui(t,i,2),t!==null&&(tr(t,2),gr(t))}function gt(t,i,s){if(t.tag===3)Hg(t,t,s);else for(;i!==null;){if(i.tag===3){Hg(i,t,s);break}else if(i.tag===1){var o=i.stateNode;if(typeof i.type.getDerivedStateFromError=="function"||typeof o.componentDidCatch=="function"&&(pi===null||!pi.has(o))){t=In(s,t),s=qp(2),o=ui(i,s,2),o!==null&&(Ip(s,o,i,t),tr(o,2),gr(o));break}}i=i.return}}function wf(t,i,s){var o=t.pingCache;if(o===null){o=t.pingCache=new jx;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(s)||(df=!0,h.add(s),t=Dx.bind(null,t,i,s),i.then(t,t))}function Dx(t,i,s){var o=t.pingCache;o!==null&&o.delete(i),t.pingedLanes|=t.suspendedLanes&s,t.warmLanes&=~s,St===t&&(tt&s)===s&&(zt===4||zt===3&&(tt&62914560)===tt&&300>yt()-Co?(dt&2)===0&&La(t,0):mf|=s,Da===tt&&(Da=0)),gr(t)}function qg(t,i){i===0&&(i=oa()),t=Ii(t,i),t!==null&&(tr(t,i),gr(t))}function zx(t){var i=t.memoizedState,s=0;i!==null&&(s=i.retryLane),qg(t,s)}function Lx(t,i){var s=0;switch(t.tag){case 31:case 13:var o=t.stateNode,h=t.memoizedState;h!==null&&(s=h.retryLane);break;case 19:o=t.stateNode;break;case 22:o=t.stateNode._retryCache;break;default:throw Error(a(314))}o!==null&&o.delete(i),qg(t,s)}function Ux(t,i){return Wn(t,i)}var Mo=null,Ba=null,Sf=!1,Do=!1,_f=!1,bi=0;function gr(t){t!==Ba&&t.next===null&&(Ba===null?Mo=Ba=t:Ba=Ba.next=t),Do=!0,Sf||(Sf=!0,Px())}function Ys(t,i){if(!_f&&Do){_f=!0;do for(var s=!1,o=Mo;o!==null;){if(t!==0){var h=o.pendingLanes;if(h===0)var p=0;else{var v=o.suspendedLanes,S=o.pingedLanes;p=(1<<31-mt(42|t)+1)-1,p&=h&~(v&~S),p=p&201326741?p&201326741|1:p?p|2:0}p!==0&&(s=!0,Gg(o,p))}else p=tt,p=Di(o,o===St?p:0,o.cancelPendingCommit!==null||o.timeoutHandle!==-1),(p&3)===0||zi(o,p)||(s=!0,Gg(o,p));o=o.next}while(s);_f=!1}}function Bx(){Ig()}function Ig(){Do=Sf=!1;var t=0;bi!==0&&Xx()&&(t=bi);for(var i=yt(),s=null,o=Mo;o!==null;){var h=o.next,p=Fg(o,i);p===0?(o.next=null,s===null?Mo=h:s.next=h,h===null&&(Ba=s)):(s=o,(t!==0||(p&3)!==0)&&(Do=!0)),o=h}Gt!==0&&Gt!==5||Ys(t),bi!==0&&(bi=0)}function Fg(t,i){for(var s=t.suspendedLanes,o=t.pingedLanes,h=t.expirationTimes,p=t.pendingLanes&-62914561;0<p;){var v=31-mt(p),S=1<<v,P=h[v];P===-1?((S&s)===0||(S&o)!==0)&&(h[v]=hs(S,i)):P<=i&&(t.expiredLanes|=S),p&=~S}if(i=St,s=tt,s=Di(t,t===i?s:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),o=t.callbackNode,s===0||t===i&&(pt===2||pt===9)||t.cancelPendingCommit!==null)return o!==null&&o!==null&&en(o),t.callbackNode=null,t.callbackPriority=0;if((s&3)===0||zi(t,s)){if(i=s&-s,i===t.callbackPriority)return i;switch(o!==null&&en(o),Ui(s)){case 2:case 8:s=Se;break;case 32:s=Be;break;case 268435456:s=it;break;default:s=Be}return o=$g.bind(null,t),s=Wn(s,o),t.callbackPriority=i,t.callbackNode=s,i}return o!==null&&o!==null&&en(o),t.callbackPriority=2,t.callbackNode=null,2}function $g(t,i){if(Gt!==0&&Gt!==5)return t.callbackNode=null,t.callbackPriority=0,null;var s=t.callbackNode;if(Ro()&&t.callbackNode!==s)return null;var o=tt;return o=Di(t,t===St?o:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),o===0?null:(kg(t,o,i),Fg(t,yt()),t.callbackNode!=null&&t.callbackNode===s?$g.bind(null,t):null)}function Gg(t,i){if(Ro())return null;kg(t,i,!0)}function Px(){Kx(function(){(dt&6)!==0?Wn(oe,Bx):Ig()})}function Ef(){if(bi===0){var t=_a;t===0&&(t=Qr,Qr<<=1,(Qr&261888)===0&&(Qr=256)),bi=t}return bi}function Yg(t){return t==null||typeof t=="symbol"||typeof t=="boolean"?null:typeof t=="function"?t:ql(""+t)}function Vg(t,i){var s=i.ownerDocument.createElement("input");return s.name=i.name,s.value=i.value,t.id&&s.setAttribute("form",t.id),i.parentNode.insertBefore(s,i),t=new FormData(t),s.parentNode.removeChild(s),t}function Hx(t,i,s,o,h){if(i==="submit"&&s&&s.stateNode===h){var p=Yg((h[Mt]||null).action),v=o.submitter;v&&(i=(i=v[Mt]||null)?Yg(i.formAction):v.getAttribute("formAction"),i!==null&&(p=i,v=null));var S=new Gl("action","action",null,o,h);t.push({event:S,listeners:[{instance:null,listener:function(){if(o.defaultPrevented){if(bi!==0){var P=v?Vg(h,v):new FormData(h);Fc(s,{pending:!0,data:P,method:h.method,action:p},null,P)}}else typeof p=="function"&&(S.preventDefault(),P=v?Vg(h,v):new FormData(h),Fc(s,{pending:!0,data:P,method:h.method,action:p},p,P))},currentTarget:h}]})}}for(var kf=0;kf<sc.length;kf++){var Cf=sc[kf],qx=Cf.toLowerCase(),Ix=Cf[0].toUpperCase()+Cf.slice(1);rr(qx,"on"+Ix)}rr(Em,"onAnimationEnd"),rr(km,"onAnimationIteration"),rr(Cm,"onAnimationStart"),rr("dblclick","onDoubleClick"),rr("focusin","onFocus"),rr("focusout","onBlur"),rr(ix,"onTransitionRun"),rr(ax,"onTransitionStart"),rr(sx,"onTransitionCancel"),rr(Am,"onTransitionEnd"),ie("onMouseEnter",["mouseout","mouseover"]),ie("onMouseLeave",["mouseout","mouseover"]),ie("onPointerEnter",["pointerout","pointerover"]),ie("onPointerLeave",["pointerout","pointerover"]),be("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),be("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),be("onBeforeInput",["compositionend","keypress","textInput","paste"]),be("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),be("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),be("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Vs="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(" "),Fx=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Vs));function Jg(t,i){i=(i&4)!==0;for(var s=0;s<t.length;s++){var o=t[s],h=o.event;o=o.listeners;e:{var p=void 0;if(i)for(var v=o.length-1;0<=v;v--){var S=o[v],P=S.instance,te=S.currentTarget;if(S=S.listener,P!==p&&h.isPropagationStopped())break e;p=S,h.currentTarget=te;try{p(h)}catch(le){Jl(le)}h.currentTarget=null,p=P}else for(v=0;v<o.length;v++){if(S=o[v],P=S.instance,te=S.currentTarget,S=S.listener,P!==p&&h.isPropagationStopped())break e;p=S,h.currentTarget=te;try{p(h)}catch(le){Jl(le)}h.currentTarget=null,p=P}}}}function We(t,i){var s=i[Bi];s===void 0&&(s=i[Bi]=new Set);var o=t+"__bubble";s.has(o)||(Xg(i,t,2,!1),s.add(o))}function Af(t,i,s){var o=0;i&&(o|=4),Xg(s,t,o,i)}var zo="_reactListening"+Math.random().toString(36).slice(2);function Tf(t){if(!t[zo]){t[zo]=!0,K.forEach(function(s){s!=="selectionchange"&&(Fx.has(s)||Af(s,!1,t),Af(s,!0,t))});var i=t.nodeType===9?t:t.ownerDocument;i===null||i[zo]||(i[zo]=!0,Af("selectionchange",!1,i))}}function Xg(t,i,s,o){switch(Ey(i)){case 2:var h=yw;break;case 8:h=bw;break;default:h=Ff}s=h.bind(null,i,s,t),h=void 0,!Vu||i!=="touchstart"&&i!=="touchmove"&&i!=="wheel"||(h=!0),o?h!==void 0?t.addEventListener(i,s,{capture:!0,passive:h}):t.addEventListener(i,s,!0):h!==void 0?t.addEventListener(i,s,{passive:h}):t.addEventListener(i,s,!1)}function jf(t,i,s,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 S=o.stateNode.containerInfo;if(S===h)break;if(v===4)for(v=o.return;v!==null;){var P=v.tag;if((P===3||P===4)&&v.stateNode.containerInfo===h)return;v=v.return}for(;S!==null;){if(v=E(S),v===null)return;if(P=v.tag,P===5||P===6||P===26||P===27){o=p=v;continue e}S=S.parentNode}}o=o.return}em(function(){var te=p,le=Gu(s),me=[];e:{var ne=Tm.get(t);if(ne!==void 0){var ae=Gl,Re=t;switch(t){case"keypress":if(Fl(s)===0)break e;case"keydown":case"keyup":ae=Lv;break;case"focusin":Re="focus",ae=Ku;break;case"focusout":Re="blur",ae=Ku;break;case"beforeblur":case"afterblur":ae=Ku;break;case"click":if(s.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":ae=rm;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ae=Ev;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ae=Pv;break;case Em:case km:case Cm:ae=Av;break;case Am:ae=qv;break;case"scroll":case"scrollend":ae=Sv;break;case"wheel":ae=Fv;break;case"copy":case"cut":case"paste":ae=jv;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ae=am;break;case"toggle":case"beforetoggle":ae=Gv}var He=(i&4)!==0,xt=!He&&(t==="scroll"||t==="scrollend"),X=He?ne!==null?ne+"Capture":null:ne;He=[];for(var $=te,ee;$!==null;){var ue=$;if(ee=ue.stateNode,ue=ue.tag,ue!==5&&ue!==26&&ue!==27||ee===null||X===null||(ue=ps($,X),ue!=null&&He.push(Js($,ue,ee))),xt)break;$=$.return}0<He.length&&(ne=new ae(ne,Re,null,s,le),me.push({event:ne,listeners:He}))}}if((i&7)===0){e:{if(ne=t==="mouseover"||t==="pointerover",ae=t==="mouseout"||t==="pointerout",ne&&s!==$u&&(Re=s.relatedTarget||s.fromElement)&&(E(Re)||Re[Sn]))break e;if((ae||ne)&&(ne=le.window===le?le:(ne=le.ownerDocument)?ne.defaultView||ne.parentWindow:window,ae?(Re=s.relatedTarget||s.toElement,ae=te,Re=Re?E(Re):null,Re!==null&&(xt=u(Re),He=Re.tag,Re!==xt||He!==5&&He!==27&&He!==6)&&(Re=null)):(ae=null,Re=te),ae!==Re)){if(He=rm,ue="onMouseLeave",X="onMouseEnter",$="mouse",(t==="pointerout"||t==="pointerover")&&(He=am,ue="onPointerLeave",X="onPointerEnter",$="pointer"),xt=ae==null?ne:A(ae),ee=Re==null?ne:A(Re),ne=new He(ue,$+"leave",ae,s,le),ne.target=xt,ne.relatedTarget=ee,ue=null,E(le)===te&&(He=new He(X,$+"enter",Re,s,le),He.target=ee,He.relatedTarget=xt,ue=He),xt=ue,ae&&Re)t:{for(He=$x,X=ae,$=Re,ee=0,ue=X;ue;ue=He(ue))ee++;ue=0;for(var Ue=$;Ue;Ue=He(Ue))ue++;for(;0<ee-ue;)X=He(X),ee--;for(;0<ue-ee;)$=He($),ue--;for(;ee--;){if(X===$||$!==null&&X===$.alternate){He=X;break t}X=He(X),$=He($)}He=null}else He=null;ae!==null&&Qg(me,ne,ae,He,!1),Re!==null&&xt!==null&&Qg(me,xt,Re,He,!0)}}e:{if(ne=te?A(te):window,ae=ne.nodeName&&ne.nodeName.toLowerCase(),ae==="select"||ae==="input"&&ne.type==="file")var ft=dm;else if(fm(ne))if(mm)ft=tx;else{ft=Wv;var Me=Zv}else ae=ne.nodeName,!ae||ae.toLowerCase()!=="input"||ne.type!=="checkbox"&&ne.type!=="radio"?te&&Fu(te.elementType)&&(ft=dm):ft=ex;if(ft&&(ft=ft(t,te))){hm(me,ft,s,le);break e}Me&&Me(t,ne,te),t==="focusout"&&te&&ne.type==="number"&&te.memoizedProps.value!=null&&Iu(ne,"number",ne.value)}switch(Me=te?A(te):window,t){case"focusin":(fm(Me)||Me.contentEditable==="true")&&(pa=Me,rc=te,_s=null);break;case"focusout":_s=rc=pa=null;break;case"mousedown":ic=!0;break;case"contextmenu":case"mouseup":case"dragend":ic=!1,Sm(me,s,le);break;case"selectionchange":if(rx)break;case"keydown":case"keyup":Sm(me,s,le)}var Xe;if(Wu)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 ma?um(t,s)&&(nt="onCompositionEnd"):t==="keydown"&&s.keyCode===229&&(nt="onCompositionStart");nt&&(sm&&s.locale!=="ko"&&(ma||nt!=="onCompositionStart"?nt==="onCompositionEnd"&&ma&&(Xe=tm()):(ni=le,Ju="value"in ni?ni.value:ni.textContent,ma=!0)),Me=Lo(te,nt),0<Me.length&&(nt=new im(nt,t,null,s,le),me.push({event:nt,listeners:Me}),Xe?nt.data=Xe:(Xe=cm(s),Xe!==null&&(nt.data=Xe)))),(Xe=Vv?Jv(t,s):Xv(t,s))&&(nt=Lo(te,"onBeforeInput"),0<nt.length&&(Me=new im("onBeforeInput","beforeinput",null,s,le),me.push({event:Me,listeners:nt}),Me.data=Xe)),Hx(me,t,te,s,le)}Jg(me,i)})}function Js(t,i,s){return{instance:t,listener:i,currentTarget:s}}function Lo(t,i){for(var s=i+"Capture",o=[];t!==null;){var h=t,p=h.stateNode;if(h=h.tag,h!==5&&h!==26&&h!==27||p===null||(h=ps(t,s),h!=null&&o.unshift(Js(t,h,p)),h=ps(t,i),h!=null&&o.push(Js(t,h,p))),t.tag===3)return o;t=t.return}return[]}function $x(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5&&t.tag!==27);return t||null}function Qg(t,i,s,o,h){for(var p=i._reactName,v=[];s!==null&&s!==o;){var S=s,P=S.alternate,te=S.stateNode;if(S=S.tag,P!==null&&P===o)break;S!==5&&S!==26&&S!==27||te===null||(P=te,h?(te=ps(s,p),te!=null&&v.unshift(Js(s,te,P))):h||(te=ps(s,p),te!=null&&v.push(Js(s,te,P)))),s=s.return}v.length!==0&&t.push({event:i,listeners:v})}var Gx=/\r\n?/g,Yx=/\u0000|\uFFFD/g;function Kg(t){return(typeof t=="string"?t:""+t).replace(Gx,`
|
|
49
|
+
`).replace(Yx,"")}function Zg(t,i){return i=Kg(i),Kg(t)===i}function vt(t,i,s,o,h,p){switch(s){case"children":typeof o=="string"?i==="body"||i==="textarea"&&o===""||fa(t,o):(typeof o=="number"||typeof o=="bigint")&&i!=="body"&&fa(t,""+o);break;case"className":nr(t,"class",o);break;case"tabIndex":nr(t,"tabindex",o);break;case"dir":case"role":case"viewBox":case"width":case"height":nr(t,s,o);break;case"style":Zd(t,o,p);break;case"data":if(i!=="object"){nr(t,"data",o);break}case"src":case"href":if(o===""&&(i!=="a"||s!=="href")){t.removeAttribute(s);break}if(o==null||typeof o=="function"||typeof o=="symbol"||typeof o=="boolean"){t.removeAttribute(s);break}o=ql(""+o),t.setAttribute(s,o);break;case"action":case"formAction":if(typeof o=="function"){t.setAttribute(s,"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"&&(s==="formAction"?(i!=="input"&&vt(t,i,"name",h.name,h,null),vt(t,i,"formEncType",h.formEncType,h,null),vt(t,i,"formMethod",h.formMethod,h,null),vt(t,i,"formTarget",h.formTarget,h,null)):(vt(t,i,"encType",h.encType,h,null),vt(t,i,"method",h.method,h,null),vt(t,i,"target",h.target,h,null)));if(o==null||typeof o=="symbol"||typeof o=="boolean"){t.removeAttribute(s);break}o=ql(""+o),t.setAttribute(s,o);break;case"onClick":o!=null&&(t.onclick=Tr);break;case"onScroll":o!=null&&We("scroll",t);break;case"onScrollEnd":o!=null&&We("scrollend",t);break;case"dangerouslySetInnerHTML":if(o!=null){if(typeof o!="object"||!("__html"in o))throw Error(a(61));if(s=o.__html,s!=null){if(h.children!=null)throw Error(a(60));t.innerHTML=s}}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}s=ql(""+o),t.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",s);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(s,""+o):t.removeAttribute(s);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(s,""):t.removeAttribute(s);break;case"capture":case"download":o===!0?t.setAttribute(s,""):o!==!1&&o!=null&&typeof o!="function"&&typeof o!="symbol"?t.setAttribute(s,o):t.removeAttribute(s);break;case"cols":case"rows":case"size":case"span":o!=null&&typeof o!="function"&&typeof o!="symbol"&&!isNaN(o)&&1<=o?t.setAttribute(s,o):t.removeAttribute(s);break;case"rowSpan":case"start":o==null||typeof o=="function"||typeof o=="symbol"||isNaN(o)?t.removeAttribute(s):t.setAttribute(s,o);break;case"popover":We("beforetoggle",t),We("toggle",t),tn(t,"popover",o);break;case"xlinkActuate":Ar(t,"http://www.w3.org/1999/xlink","xlink:actuate",o);break;case"xlinkArcrole":Ar(t,"http://www.w3.org/1999/xlink","xlink:arcrole",o);break;case"xlinkRole":Ar(t,"http://www.w3.org/1999/xlink","xlink:role",o);break;case"xlinkShow":Ar(t,"http://www.w3.org/1999/xlink","xlink:show",o);break;case"xlinkTitle":Ar(t,"http://www.w3.org/1999/xlink","xlink:title",o);break;case"xlinkType":Ar(t,"http://www.w3.org/1999/xlink","xlink:type",o);break;case"xmlBase":Ar(t,"http://www.w3.org/XML/1998/namespace","xml:base",o);break;case"xmlLang":Ar(t,"http://www.w3.org/XML/1998/namespace","xml:lang",o);break;case"xmlSpace":Ar(t,"http://www.w3.org/XML/1998/namespace","xml:space",o);break;case"is":tn(t,"is",o);break;case"innerText":case"textContent":break;default:(!(2<s.length)||s[0]!=="o"&&s[0]!=="O"||s[1]!=="n"&&s[1]!=="N")&&(s=xv.get(s)||s,tn(t,s,o))}}function Nf(t,i,s,o,h,p){switch(s){case"style":Zd(t,o,p);break;case"dangerouslySetInnerHTML":if(o!=null){if(typeof o!="object"||!("__html"in o))throw Error(a(61));if(s=o.__html,s!=null){if(h.children!=null)throw Error(a(60));t.innerHTML=s}}break;case"children":typeof o=="string"?fa(t,o):(typeof o=="number"||typeof o=="bigint")&&fa(t,""+o);break;case"onScroll":o!=null&&We("scroll",t);break;case"onScrollEnd":o!=null&&We("scrollend",t);break;case"onClick":o!=null&&(t.onclick=Tr);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!de.hasOwnProperty(s))e:{if(s[0]==="o"&&s[1]==="n"&&(h=s.endsWith("Capture"),i=s.slice(2,h?s.length-7:void 0),p=t[Mt]||null,p=p!=null?p[s]:null,typeof p=="function"&&t.removeEventListener(i,p,h),typeof o=="function")){typeof p!="function"&&p!==null&&(s in t?t[s]=null:t.hasAttribute(s)&&t.removeAttribute(s)),t.addEventListener(i,o,h);break e}s in t?t[s]=o:o===!0?t.setAttribute(s,""):tn(t,s,o)}}}function Zt(t,i,s){switch(i){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":We("error",t),We("load",t);var o=!1,h=!1,p;for(p in s)if(s.hasOwnProperty(p)){var v=s[p];if(v!=null)switch(p){case"src":o=!0;break;case"srcSet":h=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(a(137,i));default:vt(t,i,p,v,s,null)}}h&&vt(t,i,"srcSet",s.srcSet,s,null),o&&vt(t,i,"src",s.src,s,null);return;case"input":We("invalid",t);var S=p=v=h=null,P=null,te=null;for(o in s)if(s.hasOwnProperty(o)){var le=s[o];if(le!=null)switch(o){case"name":h=le;break;case"type":v=le;break;case"checked":P=le;break;case"defaultChecked":te=le;break;case"value":p=le;break;case"defaultValue":S=le;break;case"children":case"dangerouslySetInnerHTML":if(le!=null)throw Error(a(137,i));break;default:vt(t,i,o,le,s,null)}}Jd(t,p,S,P,te,v,h,!1);return;case"select":We("invalid",t),o=v=p=null;for(h in s)if(s.hasOwnProperty(h)&&(S=s[h],S!=null))switch(h){case"value":p=S;break;case"defaultValue":v=S;break;case"multiple":o=S;default:vt(t,i,h,S,s,null)}i=p,s=v,t.multiple=!!o,i!=null?ca(t,!!o,i,!1):s!=null&&ca(t,!!o,s,!0);return;case"textarea":We("invalid",t),p=h=o=null;for(v in s)if(s.hasOwnProperty(v)&&(S=s[v],S!=null))switch(v){case"value":o=S;break;case"defaultValue":h=S;break;case"children":p=S;break;case"dangerouslySetInnerHTML":if(S!=null)throw Error(a(91));break;default:vt(t,i,v,S,s,null)}Qd(t,o,h,p);return;case"option":for(P in s)if(s.hasOwnProperty(P)&&(o=s[P],o!=null))switch(P){case"selected":t.selected=o&&typeof o!="function"&&typeof o!="symbol";break;default:vt(t,i,P,o,s,null)}return;case"dialog":We("beforetoggle",t),We("toggle",t),We("cancel",t),We("close",t);break;case"iframe":case"object":We("load",t);break;case"video":case"audio":for(o=0;o<Vs.length;o++)We(Vs[o],t);break;case"image":We("error",t),We("load",t);break;case"details":We("toggle",t);break;case"embed":case"source":case"link":We("error",t),We("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(te in s)if(s.hasOwnProperty(te)&&(o=s[te],o!=null))switch(te){case"children":case"dangerouslySetInnerHTML":throw Error(a(137,i));default:vt(t,i,te,o,s,null)}return;default:if(Fu(i)){for(le in s)s.hasOwnProperty(le)&&(o=s[le],o!==void 0&&Nf(t,i,le,o,s,void 0));return}}for(S in s)s.hasOwnProperty(S)&&(o=s[S],o!=null&&vt(t,i,S,o,s,null))}function Vx(t,i,s,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,S=null,P=null,te=null,le=null;for(ae in s){var me=s[ae];if(s.hasOwnProperty(ae)&&me!=null)switch(ae){case"checked":break;case"value":break;case"defaultValue":P=me;default:o.hasOwnProperty(ae)||vt(t,i,ae,null,o,me)}}for(var ne in o){var ae=o[ne];if(me=s[ne],o.hasOwnProperty(ne)&&(ae!=null||me!=null))switch(ne){case"type":p=ae;break;case"name":h=ae;break;case"checked":te=ae;break;case"defaultChecked":le=ae;break;case"value":v=ae;break;case"defaultValue":S=ae;break;case"children":case"dangerouslySetInnerHTML":if(ae!=null)throw Error(a(137,i));break;default:ae!==me&&vt(t,i,ne,ae,o,me)}}qu(t,v,S,P,te,le,p,h);return;case"select":ae=v=S=ne=null;for(p in s)if(P=s[p],s.hasOwnProperty(p)&&P!=null)switch(p){case"value":break;case"multiple":ae=P;default:o.hasOwnProperty(p)||vt(t,i,p,null,o,P)}for(h in o)if(p=o[h],P=s[h],o.hasOwnProperty(h)&&(p!=null||P!=null))switch(h){case"value":ne=p;break;case"defaultValue":S=p;break;case"multiple":v=p;default:p!==P&&vt(t,i,h,p,o,P)}i=S,s=v,o=ae,ne!=null?ca(t,!!s,ne,!1):!!o!=!!s&&(i!=null?ca(t,!!s,i,!0):ca(t,!!s,s?[]:"",!1));return;case"textarea":ae=ne=null;for(S in s)if(h=s[S],s.hasOwnProperty(S)&&h!=null&&!o.hasOwnProperty(S))switch(S){case"value":break;case"children":break;default:vt(t,i,S,null,o,h)}for(v in o)if(h=o[v],p=s[v],o.hasOwnProperty(v)&&(h!=null||p!=null))switch(v){case"value":ne=h;break;case"defaultValue":ae=h;break;case"children":break;case"dangerouslySetInnerHTML":if(h!=null)throw Error(a(91));break;default:h!==p&&vt(t,i,v,h,o,p)}Xd(t,ne,ae);return;case"option":for(var Re in s)if(ne=s[Re],s.hasOwnProperty(Re)&&ne!=null&&!o.hasOwnProperty(Re))switch(Re){case"selected":t.selected=!1;break;default:vt(t,i,Re,null,o,ne)}for(P in o)if(ne=o[P],ae=s[P],o.hasOwnProperty(P)&&ne!==ae&&(ne!=null||ae!=null))switch(P){case"selected":t.selected=ne&&typeof ne!="function"&&typeof ne!="symbol";break;default:vt(t,i,P,ne,o,ae)}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 He in s)ne=s[He],s.hasOwnProperty(He)&&ne!=null&&!o.hasOwnProperty(He)&&vt(t,i,He,null,o,ne);for(te in o)if(ne=o[te],ae=s[te],o.hasOwnProperty(te)&&ne!==ae&&(ne!=null||ae!=null))switch(te){case"children":case"dangerouslySetInnerHTML":if(ne!=null)throw Error(a(137,i));break;default:vt(t,i,te,ne,o,ae)}return;default:if(Fu(i)){for(var xt in s)ne=s[xt],s.hasOwnProperty(xt)&&ne!==void 0&&!o.hasOwnProperty(xt)&&Nf(t,i,xt,void 0,o,ne);for(le in o)ne=o[le],ae=s[le],!o.hasOwnProperty(le)||ne===ae||ne===void 0&&ae===void 0||Nf(t,i,le,ne,o,ae);return}}for(var X in s)ne=s[X],s.hasOwnProperty(X)&&ne!=null&&!o.hasOwnProperty(X)&&vt(t,i,X,null,o,ne);for(me in o)ne=o[me],ae=s[me],!o.hasOwnProperty(me)||ne===ae||ne==null&&ae==null||vt(t,i,me,ne,o,ae)}function Wg(t){switch(t){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Jx(){if(typeof performance.getEntriesByType=="function"){for(var t=0,i=0,s=performance.getEntriesByType("resource"),o=0;o<s.length;o++){var h=s[o],p=h.transferSize,v=h.initiatorType,S=h.duration;if(p&&S&&Wg(v)){for(v=0,S=h.responseEnd,o+=1;o<s.length;o++){var P=s[o],te=P.startTime;if(te>S)break;var le=P.transferSize,me=P.initiatorType;le&&Wg(me)&&(P=P.responseEnd,v+=le*(P<S?1:(S-te)/(P-te)))}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 Of=null,Rf=null;function Uo(t){return t.nodeType===9?t:t.ownerDocument}function ey(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 ty(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 Mf(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 Df=null;function Xx(){var t=window.event;return t&&t.type==="popstate"?t===Df?!1:(Df=t,!0):(Df=null,!1)}var ny=typeof setTimeout=="function"?setTimeout:void 0,Qx=typeof clearTimeout=="function"?clearTimeout:void 0,ry=typeof Promise=="function"?Promise:void 0,Kx=typeof queueMicrotask=="function"?queueMicrotask:typeof ry<"u"?function(t){return ry.resolve(null).then(t).catch(Zx)}:ny;function Zx(t){setTimeout(function(){throw t})}function vi(t){return t==="head"}function iy(t,i){var s=i,o=0;do{var h=s.nextSibling;if(t.removeChild(s),h&&h.nodeType===8)if(s=h.data,s==="/$"||s==="/&"){if(o===0){t.removeChild(h),Ia(i);return}o--}else if(s==="$"||s==="$?"||s==="$~"||s==="$!"||s==="&")o++;else if(s==="html")Xs(t.ownerDocument.documentElement);else if(s==="head"){s=t.ownerDocument.head,Xs(s);for(var p=s.firstChild;p;){var v=p.nextSibling,S=p.nodeName;p[$t]||S==="SCRIPT"||S==="STYLE"||S==="LINK"&&p.rel.toLowerCase()==="stylesheet"||s.removeChild(p),p=v}}else s==="body"&&Xs(t.ownerDocument.body);s=h}while(s);Ia(i)}function ay(t,i){var s=t;t=0;do{var o=s.nextSibling;if(s.nodeType===1?i?(s._stashedDisplay=s.style.display,s.style.display="none"):(s.style.display=s._stashedDisplay||"",s.getAttribute("style")===""&&s.removeAttribute("style")):s.nodeType===3&&(i?(s._stashedText=s.nodeValue,s.nodeValue=""):s.nodeValue=s._stashedText||""),o&&o.nodeType===8)if(s=o.data,s==="/$"){if(t===0)break;t--}else s!=="$"&&s!=="$?"&&s!=="$~"&&s!=="$!"||t++;s=o}while(s)}function zf(t){var i=t.firstChild;for(i&&i.nodeType===10&&(i=i.nextSibling);i;){var s=i;switch(i=i.nextSibling,s.nodeName){case"HTML":case"HEAD":case"BODY":zf(s),ua(s);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(s.rel.toLowerCase()==="stylesheet")continue}t.removeChild(s)}}function Wx(t,i,s,o){for(;t.nodeType===1;){var h=s;if(t.nodeName.toLowerCase()!==i.toLowerCase()){if(!o&&(t.nodeName!=="INPUT"||t.type!=="hidden"))break}else if(o){if(!t[$t])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=Vn(t.nextSibling),t===null)break}return null}function ew(t,i,s){if(i==="")return null;for(;t.nodeType!==3;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!s||(t=Vn(t.nextSibling),t===null))return null;return t}function sy(t,i){for(;t.nodeType!==8;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!i||(t=Vn(t.nextSibling),t===null))return null;return t}function Lf(t){return t.data==="$?"||t.data==="$~"}function Uf(t){return t.data==="$!"||t.data==="$?"&&t.ownerDocument.readyState!=="loading"}function tw(t,i){var s=t.ownerDocument;if(t.data==="$~")t._reactRetry=i;else if(t.data!=="$?"||s.readyState!=="loading")i();else{var o=function(){i(),s.removeEventListener("DOMContentLoaded",o)};s.addEventListener("DOMContentLoaded",o),t._reactRetry=o}}function Vn(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 Bf=null;function ly(t){t=t.nextSibling;for(var i=0;t;){if(t.nodeType===8){var s=t.data;if(s==="/$"||s==="/&"){if(i===0)return Vn(t.nextSibling);i--}else s!=="$"&&s!=="$!"&&s!=="$?"&&s!=="$~"&&s!=="&"||i++}t=t.nextSibling}return null}function oy(t){t=t.previousSibling;for(var i=0;t;){if(t.nodeType===8){var s=t.data;if(s==="$"||s==="$!"||s==="$?"||s==="$~"||s==="&"){if(i===0)return t;i--}else s!=="/$"&&s!=="/&"||i++}t=t.previousSibling}return null}function uy(t,i,s){switch(i=Uo(s),t){case"html":if(t=i.documentElement,!t)throw Error(a(452));return t;case"head":if(t=i.head,!t)throw Error(a(453));return t;case"body":if(t=i.body,!t)throw Error(a(454));return t;default:throw Error(a(451))}}function Xs(t){for(var i=t.attributes;i.length;)t.removeAttributeNode(i[0]);ua(t)}var Jn=new Map,cy=new Set;function Bo(t){return typeof t.getRootNode=="function"?t.getRootNode():t.nodeType===9?t:t.ownerDocument}var $r=re.d;re.d={f:nw,r:rw,D:iw,C:aw,L:sw,m:lw,X:uw,S:ow,M:cw};function nw(){var t=$r.f(),i=jo();return t||i}function rw(t){var i=T(t);i!==null&&i.tag===5&&i.type==="form"?Ap(i):$r.r(t)}var Pa=typeof document>"u"?null:document;function fy(t,i,s){var o=Pa;if(o&&typeof i=="string"&&i){var h=Hn(i);h='link[rel="'+t+'"][href="'+h+'"]',typeof s=="string"&&(h+='[crossorigin="'+s+'"]'),cy.has(h)||(cy.add(h),t={rel:t,crossOrigin:s,href:i},o.querySelector(h)===null&&(i=o.createElement("link"),Zt(i,"link",t),I(i),o.head.appendChild(i)))}}function iw(t){$r.D(t),fy("dns-prefetch",t,null)}function aw(t,i){$r.C(t,i),fy("preconnect",t,i)}function sw(t,i,s){$r.L(t,i,s);var o=Pa;if(o&&t&&i){var h='link[rel="preload"][as="'+Hn(i)+'"]';i==="image"&&s&&s.imageSrcSet?(h+='[imagesrcset="'+Hn(s.imageSrcSet)+'"]',typeof s.imageSizes=="string"&&(h+='[imagesizes="'+Hn(s.imageSizes)+'"]')):h+='[href="'+Hn(t)+'"]';var p=h;switch(i){case"style":p=Ha(t);break;case"script":p=qa(t)}Jn.has(p)||(t=g({rel:"preload",href:i==="image"&&s&&s.imageSrcSet?void 0:t,as:i},s),Jn.set(p,t),o.querySelector(h)!==null||i==="style"&&o.querySelector(Qs(p))||i==="script"&&o.querySelector(Ks(p))||(i=o.createElement("link"),Zt(i,"link",t),I(i),o.head.appendChild(i)))}}function lw(t,i){$r.m(t,i);var s=Pa;if(s&&t){var o=i&&typeof i.as=="string"?i.as:"script",h='link[rel="modulepreload"][as="'+Hn(o)+'"][href="'+Hn(t)+'"]',p=h;switch(o){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":p=qa(t)}if(!Jn.has(p)&&(t=g({rel:"modulepreload",href:t},i),Jn.set(p,t),s.querySelector(h)===null)){switch(o){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(s.querySelector(Ks(p)))return}o=s.createElement("link"),Zt(o,"link",t),I(o),s.head.appendChild(o)}}}function ow(t,i,s){$r.S(t,i,s);var o=Pa;if(o&&t){var h=D(o).hoistableStyles,p=Ha(t);i=i||"default";var v=h.get(p);if(!v){var S={loading:0,preload:null};if(v=o.querySelector(Qs(p)))S.loading=5;else{t=g({rel:"stylesheet",href:t,"data-precedence":i},s),(s=Jn.get(p))&&Pf(t,s);var P=v=o.createElement("link");I(P),Zt(P,"link",t),P._p=new Promise(function(te,le){P.onload=te,P.onerror=le}),P.addEventListener("load",function(){S.loading|=1}),P.addEventListener("error",function(){S.loading|=2}),S.loading|=4,Po(v,i,o)}v={type:"stylesheet",instance:v,count:1,state:S},h.set(p,v)}}}function uw(t,i){$r.X(t,i);var s=Pa;if(s&&t){var o=D(s).hoistableScripts,h=qa(t),p=o.get(h);p||(p=s.querySelector(Ks(h)),p||(t=g({src:t,async:!0},i),(i=Jn.get(h))&&Hf(t,i),p=s.createElement("script"),I(p),Zt(p,"link",t),s.head.appendChild(p)),p={type:"script",instance:p,count:1,state:null},o.set(h,p))}}function cw(t,i){$r.M(t,i);var s=Pa;if(s&&t){var o=D(s).hoistableScripts,h=qa(t),p=o.get(h);p||(p=s.querySelector(Ks(h)),p||(t=g({src:t,async:!0,type:"module"},i),(i=Jn.get(h))&&Hf(t,i),p=s.createElement("script"),I(p),Zt(p,"link",t),s.head.appendChild(p)),p={type:"script",instance:p,count:1,state:null},o.set(h,p))}}function hy(t,i,s,o){var h=(h=ve.current)?Bo(h):null;if(!h)throw Error(a(446));switch(t){case"meta":case"title":return null;case"style":return typeof s.precedence=="string"&&typeof s.href=="string"?(i=Ha(s.href),s=D(h).hoistableStyles,o=s.get(i),o||(o={type:"style",instance:null,count:0,state:null},s.set(i,o)),o):{type:"void",instance:null,count:0,state:null};case"link":if(s.rel==="stylesheet"&&typeof s.href=="string"&&typeof s.precedence=="string"){t=Ha(s.href);var p=D(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(Qs(t)))&&!p._p&&(v.instance=p,v.state.loading=5),Jn.has(t)||(s={rel:"preload",as:"style",href:s.href,crossOrigin:s.crossOrigin,integrity:s.integrity,media:s.media,hrefLang:s.hrefLang,referrerPolicy:s.referrerPolicy},Jn.set(t,s),p||fw(h,t,s,v.state))),i&&o===null)throw Error(a(528,""));return v}if(i&&o!==null)throw Error(a(529,""));return null;case"script":return i=s.async,s=s.src,typeof s=="string"&&i&&typeof i!="function"&&typeof i!="symbol"?(i=qa(s),s=D(h).hoistableScripts,o=s.get(i),o||(o={type:"script",instance:null,count:0,state:null},s.set(i,o)),o):{type:"void",instance:null,count:0,state:null};default:throw Error(a(444,t))}}function Ha(t){return'href="'+Hn(t)+'"'}function Qs(t){return'link[rel="stylesheet"]['+t+"]"}function dy(t){return g({},t,{"data-precedence":t.precedence,precedence:null})}function fw(t,i,s,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}),Zt(i,"link",s),I(i),t.head.appendChild(i))}function qa(t){return'[src="'+Hn(t)+'"]'}function Ks(t){return"script[async]"+t}function my(t,i,s){if(i.count++,i.instance===null)switch(i.type){case"style":var o=t.querySelector('style[data-href~="'+Hn(s.href)+'"]');if(o)return i.instance=o,I(o),o;var h=g({},s,{"data-href":s.href,"data-precedence":s.precedence,href:null,precedence:null});return o=(t.ownerDocument||t).createElement("style"),I(o),Zt(o,"style",h),Po(o,s.precedence,t),i.instance=o;case"stylesheet":h=Ha(s.href);var p=t.querySelector(Qs(h));if(p)return i.state.loading|=4,i.instance=p,I(p),p;o=dy(s),(h=Jn.get(h))&&Pf(o,h),p=(t.ownerDocument||t).createElement("link"),I(p);var v=p;return v._p=new Promise(function(S,P){v.onload=S,v.onerror=P}),Zt(p,"link",o),i.state.loading|=4,Po(p,s.precedence,t),i.instance=p;case"script":return p=qa(s.src),(h=t.querySelector(Ks(p)))?(i.instance=h,I(h),h):(o=s,(h=Jn.get(p))&&(o=g({},s),Hf(o,h)),t=t.ownerDocument||t,h=t.createElement("script"),I(h),Zt(h,"link",o),t.head.appendChild(h),i.instance=h);case"void":return null;default:throw Error(a(443,i.type))}else i.type==="stylesheet"&&(i.state.loading&4)===0&&(o=i.instance,i.state.loading|=4,Po(o,s.precedence,t));return i.instance}function Po(t,i,s){for(var o=s.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 S=o[v];if(S.dataset.precedence===i)p=S;else if(p!==h)break}p?p.parentNode.insertBefore(t,p.nextSibling):(i=s.nodeType===9?s.head:s,i.insertBefore(t,i.firstChild))}function Pf(t,i){t.crossOrigin==null&&(t.crossOrigin=i.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=i.referrerPolicy),t.title==null&&(t.title=i.title)}function Hf(t,i){t.crossOrigin==null&&(t.crossOrigin=i.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=i.referrerPolicy),t.integrity==null&&(t.integrity=i.integrity)}var Ho=null;function py(t,i,s){if(Ho===null){var o=new Map,h=Ho=new Map;h.set(s,o)}else h=Ho,o=h.get(s),o||(o=new Map,h.set(s,o));if(o.has(t))return o;for(o.set(t,null),s=s.getElementsByTagName(t),h=0;h<s.length;h++){var p=s[h];if(!(p[$t]||p[wt]||t==="link"&&p.getAttribute("rel")==="stylesheet")&&p.namespaceURI!=="http://www.w3.org/2000/svg"){var v=p.getAttribute(i)||"";v=t+v;var S=o.get(v);S?S.push(p):o.set(v,[p])}}return o}function gy(t,i,s){t=t.ownerDocument||t,t.head.insertBefore(s,i==="title"?t.querySelector("head > title"):null)}function hw(t,i,s){if(s===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 yy(t){return!(t.type==="stylesheet"&&(t.state.loading&3)===0)}function dw(t,i,s,o){if(s.type==="stylesheet"&&(typeof o.media!="string"||matchMedia(o.media).matches!==!1)&&(s.state.loading&4)===0){if(s.instance===null){var h=Ha(o.href),p=i.querySelector(Qs(h));if(p){i=p._p,i!==null&&typeof i=="object"&&typeof i.then=="function"&&(t.count++,t=qo.bind(t),i.then(t,t)),s.state.loading|=4,s.instance=p,I(p);return}p=i.ownerDocument||i,o=dy(o),(h=Jn.get(h))&&Pf(o,h),p=p.createElement("link"),I(p);var v=p;v._p=new Promise(function(S,P){v.onload=S,v.onerror=P}),Zt(p,"link",o),s.instance=p}t.stylesheets===null&&(t.stylesheets=new Map),t.stylesheets.set(s,i),(i=s.state.preload)&&(s.state.loading&3)===0&&(t.count++,s=qo.bind(t),i.addEventListener("load",s),i.addEventListener("error",s))}}var qf=0;function mw(t,i){return t.stylesheets&&t.count===0&&Fo(t,t.stylesheets),0<t.count||0<t.imgCount?function(s){var o=setTimeout(function(){if(t.stylesheets&&Fo(t,t.stylesheets),t.unsuspend){var p=t.unsuspend;t.unsuspend=null,p()}},6e4+i);0<t.imgBytes&&qf===0&&(qf=62500*Jx());var h=setTimeout(function(){if(t.waitingForImages=!1,t.count===0&&(t.stylesheets&&Fo(t,t.stylesheets),t.unsuspend)){var p=t.unsuspend;t.unsuspend=null,p()}},(t.imgBytes>qf?50:800)+i);return t.unsuspend=s,function(){t.unsuspend=null,clearTimeout(o),clearTimeout(h)}}:null}function qo(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Fo(this,this.stylesheets);else if(this.unsuspend){var t=this.unsuspend;this.unsuspend=null,t()}}}var Io=null;function Fo(t,i){t.stylesheets=null,t.unsuspend!==null&&(t.count++,Io=new Map,i.forEach(pw,t),Io=null,qo.call(t))}function pw(t,i){if(!(i.state.loading&4)){var s=Io.get(t);if(s)var o=s.get(null);else{s=new Map,Io.set(t,s);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")&&(s.set(v.dataset.precedence,v),o=v)}o&&s.set(null,o)}h=i.instance,v=h.getAttribute("data-precedence"),p=s.get(v)||o,p===o&&s.set(null,h),s.set(v,h),this.count++,o=qo.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 Zs={$$typeof:G,Provider:null,Consumer:null,_currentValue:ye,_currentValue2:ye,_threadCount:0};function gw(t,i,s,o,h,p,v,S,P){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=Zr(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Zr(0),this.hiddenUpdates=Zr(null),this.identifierPrefix=o,this.onUncaughtError=h,this.onCaughtError=p,this.onRecoverableError=v,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=P,this.incompleteTransitions=new Map}function by(t,i,s,o,h,p,v,S,P,te,le,me){return t=new gw(t,i,s,v,P,te,le,me,S),i=1,p===!0&&(i|=24),p=En(3,null,null,i),t.current=p,p.stateNode=t,i=vc(),i.refCount++,t.pooledCache=i,i.refCount++,p.memoizedState={element:o,isDehydrated:s,cache:i},_c(p),t}function vy(t){return t?(t=ba,t):ba}function xy(t,i,s,o,h,p){h=vy(h),o.context===null?o.context=h:o.pendingContext=h,o=oi(i),o.payload={element:s},p=p===void 0?null:p,p!==null&&(o.callback=p),s=ui(t,o,i),s!==null&&(bn(s,t,i),Ns(s,t,i))}function wy(t,i){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var s=t.retryLane;t.retryLane=s!==0&&s<i?s:i}}function If(t,i){wy(t,i),(t=t.alternate)&&wy(t,i)}function Sy(t){if(t.tag===13||t.tag===31){var i=Ii(t,67108864);i!==null&&bn(i,t,67108864),If(t,67108864)}}function _y(t){if(t.tag===13||t.tag===31){var i=jn();i=Cr(i);var s=Ii(t,i);s!==null&&bn(s,t,i),If(t,i)}}var $o=!0;function yw(t,i,s,o){var h=q.T;q.T=null;var p=re.p;try{re.p=2,Ff(t,i,s,o)}finally{re.p=p,q.T=h}}function bw(t,i,s,o){var h=q.T;q.T=null;var p=re.p;try{re.p=8,Ff(t,i,s,o)}finally{re.p=p,q.T=h}}function Ff(t,i,s,o){if($o){var h=$f(o);if(h===null)jf(t,i,o,Go,s),ky(t,o);else if(xw(h,t,i,s,o))o.stopPropagation();else if(ky(t,o),i&4&&-1<vw.indexOf(t)){for(;h!==null;){var p=T(h);if(p!==null)switch(p.tag){case 3:if(p=p.stateNode,p.current.memoizedState.isDehydrated){var v=er(p.pendingLanes);if(v!==0){var S=p;for(S.pendingLanes|=2,S.entangledLanes|=2;v;){var P=1<<31-mt(v);S.entanglements[1]|=P,v&=~P}gr(p),(dt&6)===0&&(Ao=yt()+500,Ys(0))}}break;case 31:case 13:S=Ii(p,2),S!==null&&bn(S,p,2),jo(),If(p,2)}if(p=$f(o),p===null&&jf(t,i,o,Go,s),p===h)break;h=p}h!==null&&o.stopPropagation()}else jf(t,i,o,null,s)}}function $f(t){return t=Gu(t),Gf(t)}var Go=null;function Gf(t){if(Go=null,t=E(t),t!==null){var i=u(t);if(i===null)t=null;else{var s=i.tag;if(s===13){if(t=c(i),t!==null)return t;t=null}else if(s===31){if(t=f(i),t!==null)return t;t=null}else if(s===3){if(i.stateNode.current.memoizedState.isDehydrated)return i.tag===3?i.stateNode.containerInfo:null;t=null}else i!==t&&(t=null)}}return Go=t,null}function Ey(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(Mi()){case oe:return 2;case Se:return 8;case Be:case Ye:return 32;case it:return 268435456;default:return 32}default:return 32}}var Yf=!1,xi=null,wi=null,Si=null,Ws=new Map,el=new Map,_i=[],vw="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 ky(t,i){switch(t){case"focusin":case"focusout":xi=null;break;case"dragenter":case"dragleave":wi=null;break;case"mouseover":case"mouseout":Si=null;break;case"pointerover":case"pointerout":Ws.delete(i.pointerId);break;case"gotpointercapture":case"lostpointercapture":el.delete(i.pointerId)}}function tl(t,i,s,o,h,p){return t===null||t.nativeEvent!==p?(t={blockedOn:i,domEventName:s,eventSystemFlags:o,nativeEvent:p,targetContainers:[h]},i!==null&&(i=T(i),i!==null&&Sy(i)),t):(t.eventSystemFlags|=o,i=t.targetContainers,h!==null&&i.indexOf(h)===-1&&i.push(h),t)}function xw(t,i,s,o,h){switch(i){case"focusin":return xi=tl(xi,t,i,s,o,h),!0;case"dragenter":return wi=tl(wi,t,i,s,o,h),!0;case"mouseover":return Si=tl(Si,t,i,s,o,h),!0;case"pointerover":var p=h.pointerId;return Ws.set(p,tl(Ws.get(p)||null,t,i,s,o,h)),!0;case"gotpointercapture":return p=h.pointerId,el.set(p,tl(el.get(p)||null,t,i,s,o,h)),!0}return!1}function Cy(t){var i=E(t.target);if(i!==null){var s=u(i);if(s!==null){if(i=s.tag,i===13){if(i=c(s),i!==null){t.blockedOn=i,Ul(t.priority,function(){_y(s)});return}}else if(i===31){if(i=f(s),i!==null){t.blockedOn=i,Ul(t.priority,function(){_y(s)});return}}else if(i===3&&s.stateNode.current.memoizedState.isDehydrated){t.blockedOn=s.tag===3?s.stateNode.containerInfo:null;return}}}t.blockedOn=null}function Yo(t){if(t.blockedOn!==null)return!1;for(var i=t.targetContainers;0<i.length;){var s=$f(t.nativeEvent);if(s===null){s=t.nativeEvent;var o=new s.constructor(s.type,s);$u=o,s.target.dispatchEvent(o),$u=null}else return i=T(s),i!==null&&Sy(i),t.blockedOn=s,!1;i.shift()}return!0}function Ay(t,i,s){Yo(t)&&s.delete(i)}function ww(){Yf=!1,xi!==null&&Yo(xi)&&(xi=null),wi!==null&&Yo(wi)&&(wi=null),Si!==null&&Yo(Si)&&(Si=null),Ws.forEach(Ay),el.forEach(Ay)}function Vo(t,i){t.blockedOn===i&&(t.blockedOn=null,Yf||(Yf=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,ww)))}var Jo=null;function Ty(t){Jo!==t&&(Jo=t,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){Jo===t&&(Jo=null);for(var i=0;i<t.length;i+=3){var s=t[i],o=t[i+1],h=t[i+2];if(typeof o!="function"){if(Gf(o||s)===null)continue;break}var p=T(s);p!==null&&(t.splice(i,3),i-=3,Fc(p,{pending:!0,data:h,method:s.method,action:o},o,h))}}))}function Ia(t){function i(P){return Vo(P,t)}xi!==null&&Vo(xi,t),wi!==null&&Vo(wi,t),Si!==null&&Vo(Si,t),Ws.forEach(i),el.forEach(i);for(var s=0;s<_i.length;s++){var o=_i[s];o.blockedOn===t&&(o.blockedOn=null)}for(;0<_i.length&&(s=_i[0],s.blockedOn===null);)Cy(s),s.blockedOn===null&&_i.shift();if(s=(t.ownerDocument||t).$$reactFormReplay,s!=null)for(o=0;o<s.length;o+=3){var h=s[o],p=s[o+1],v=h[Mt]||null;if(typeof p=="function")v||Ty(s);else if(v){var S=null;if(p&&p.hasAttribute("formAction")){if(h=p,v=p[Mt]||null)S=v.formAction;else if(Gf(h)!==null)continue}else S=v.action;typeof S=="function"?s[o+1]=S:(s.splice(o,3),o-=3),Ty(s)}}}function jy(){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(s,20)}function s(){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(s,100),function(){o=!0,navigation.removeEventListener("navigate",t),navigation.removeEventListener("navigatesuccess",i),navigation.removeEventListener("navigateerror",i),h!==null&&(h(),h=null)}}}function Vf(t){this._internalRoot=t}Xo.prototype.render=Vf.prototype.render=function(t){var i=this._internalRoot;if(i===null)throw Error(a(409));var s=i.current,o=jn();xy(s,o,t,i,null,null)},Xo.prototype.unmount=Vf.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var i=t.containerInfo;xy(t.current,2,null,t,null,null),jo(),i[Sn]=null}};function Xo(t){this._internalRoot=t}Xo.prototype.unstable_scheduleHydration=function(t){if(t){var i=ds();t={blockedOn:null,target:t,priority:i};for(var s=0;s<_i.length&&i!==0&&i<_i[s].priority;s++);_i.splice(s,0,t),s===0&&Cy(t)}};var Ny=n.version;if(Ny!=="19.2.4")throw Error(a(527,Ny,"19.2.4"));re.findDOMNode=function(t){var i=t._reactInternals;if(i===void 0)throw typeof t.render=="function"?Error(a(188)):(t=Object.keys(t).join(","),Error(a(268,t)));return t=d(i),t=t!==null?y(t):null,t=t===null?null:t.stateNode,t};var Sw={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:q,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Qo=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Qo.isDisabled&&Qo.supportsFiber)try{st=Qo.inject(Sw),ot=Qo}catch{}}return rl.createRoot=function(t,i){if(!l(t))throw Error(a(299));var s=!1,o="",h=Up,p=Bp,v=Pp;return i!=null&&(i.unstable_strictMode===!0&&(s=!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=by(t,1,!1,null,null,s,o,null,h,p,v,jy),t[Sn]=i.current,Tf(t),new Vf(i)},rl.hydrateRoot=function(t,i,s){if(!l(t))throw Error(a(299));var o=!1,h="",p=Up,v=Bp,S=Pp,P=null;return s!=null&&(s.unstable_strictMode===!0&&(o=!0),s.identifierPrefix!==void 0&&(h=s.identifierPrefix),s.onUncaughtError!==void 0&&(p=s.onUncaughtError),s.onCaughtError!==void 0&&(v=s.onCaughtError),s.onRecoverableError!==void 0&&(S=s.onRecoverableError),s.formState!==void 0&&(P=s.formState)),i=by(t,1,!0,i,s??null,o,h,P,p,v,S,jy),i.context=vy(null),s=i.current,o=jn(),o=Cr(o),h=oi(o),h.callback=null,ui(s,h,o),s=o,i.current.lanes=s,tr(i,s),gr(i),t[Sn]=i.current,Tf(t),new Xo(i)},rl.version="19.2.4",rl}var Hy;function Mw(){if(Hy)return Qf.exports;Hy=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(),Qf.exports=Rw(),Qf.exports}var Dw=Mw();/**
|
|
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 qy="popstate";function Iy(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function zw(e={}){function n(a,l){var d;let u=(d=l.state)==null?void 0:d.masked,{pathname:c,search:f,hash:m}=u||a.location;return zh("",{pathname:c,search:f,hash:m},l.state&&l.state.usr||null,l.state&&l.state.key||"default",u?{pathname:a.location.pathname,search:a.location.search,hash:a.location.hash}:void 0)}function r(a,l){return typeof l=="string"?l:wl(l)}return Uw(n,r,null,e)}function Rt(e,n){if(e===!1||e===null||typeof e>"u")throw new Error(n)}function wr(e,n){if(!e){typeof console<"u"&&console.warn(n);try{throw new Error(n)}catch{}}}function Lw(){return Math.random().toString(36).substring(2,10)}function Fy(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 zh(e,n,r=null,a,l){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof n=="string"?ls(n):n,state:r,key:n&&n.key||a||Lw(),unstable_mask:l}}function wl({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 ls(e){let n={};if(e){let r=e.indexOf("#");r>=0&&(n.hash=e.substring(r),e=e.substring(0,r));let a=e.indexOf("?");a>=0&&(n.search=e.substring(a),e=e.substring(0,a)),e&&(n.pathname=e)}return n}function Uw(e,n,r,a={}){let{window:l=document.defaultView,v5Compat:u=!1}=a,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 B=y(),M=B==null?null:B-d;d=B,m&&m({action:f,location:z.location,delta:M})}function b(B,M){f="PUSH";let F=Iy(B)?B:zh(z.location,B,M);d=y()+1;let G=Fy(F,d),se=z.createHref(F.unstable_mask||F);try{c.pushState(G,"",se)}catch(O){if(O instanceof DOMException&&O.name==="DataCloneError")throw O;l.location.assign(se)}u&&m&&m({action:f,location:z.location,delta:1})}function x(B,M){f="REPLACE";let F=Iy(B)?B:zh(z.location,B,M);d=y();let G=Fy(F,d),se=z.createHref(F.unstable_mask||F);c.replaceState(G,"",se),u&&m&&m({action:f,location:z.location,delta:0})}function k(B){return Bw(B)}let z={get action(){return f},get location(){return e(l,c)},listen(B){if(m)throw new Error("A history only accepts one active listener");return l.addEventListener(qy,g),m=B,()=>{l.removeEventListener(qy,g),m=null}},createHref(B){return n(l,B)},createURL:k,encodeLocation(B){let M=k(B);return{pathname:M.pathname,search:M.search,hash:M.hash}},push:b,replace:x,go(B){return c.go(B)}};return z}function Bw(e,n=!1){let r="http://localhost";typeof window<"u"&&(r=window.location.origin!=="null"?window.location.origin:window.location.href),Rt(r,"No window.location.(origin|href) available to create URL");let a=typeof e=="string"?e:wl(e);return a=a.replace(/ $/,"%20"),!n&&a.startsWith("//")&&(a=r+a),new URL(a,r)}function S0(e,n,r="/"){return Pw(e,n,r,!1)}function Pw(e,n,r,a){let l=typeof n=="string"?ls(n):n,u=Vr(l.pathname||"/",r);if(u==null)return null;let c=_0(e);Hw(c);let f=null;for(let m=0;f==null&&m<c.length;++m){let d=Kw(u);f=Xw(c[m],d,a)}return f}function _0(e,n=[],r=[],a="",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(a)&&m)return;Rt(y.relativePath.startsWith(a),`Absolute route path "${y.relativePath}" nested under path "${a}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),y.relativePath=y.relativePath.slice(a.length)}let g=xr([a,y.relativePath]),b=r.concat(y);c.children&&c.children.length>0&&(Rt(c.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${g}".`),_0(c.children,n,b,g,m)),!(c.path==null&&!c.index)&&n.push({path:g,score:Vw(g,c.index),routesMeta:b})};return e.forEach((c,f)=>{var m;if(c.path===""||!((m=c.path)!=null&&m.includes("?")))u(c,f);else for(let d of E0(c.path))u(c,f,!0,d)}),n}function E0(e){let n=e.split("/");if(n.length===0)return[];let[r,...a]=n,l=r.endsWith("?"),u=r.replace(/\?$/,"");if(a.length===0)return l?[u,""]:[u];let c=E0(a.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 Hw(e){e.sort((n,r)=>n.score!==r.score?r.score-n.score:Jw(n.routesMeta.map(a=>a.childrenIndex),r.routesMeta.map(a=>a.childrenIndex)))}var qw=/^:[\w-]+$/,Iw=3,Fw=2,$w=1,Gw=10,Yw=-2,$y=e=>e==="*";function Vw(e,n){let r=e.split("/"),a=r.length;return r.some($y)&&(a+=Yw),n&&(a+=Fw),r.filter(l=>!$y(l)).reduce((l,u)=>l+(qw.test(u)?Iw:u===""?$w:Gw),a)}function Jw(e,n){return e.length===n.length&&e.slice(0,-1).every((a,l)=>a===n[l])?e[e.length-1]-n[n.length-1]:0}function Xw(e,n,r=!1){let{routesMeta:a}=e,l={},u="/",c=[];for(let f=0;f<a.length;++f){let m=a[f],d=f===a.length-1,y=u==="/"?n:n.slice(u.length)||"/",g=du({path:m.relativePath,caseSensitive:m.caseSensitive,end:d},y),b=m.route;if(!g&&d&&r&&!a[a.length-1].route.index&&(g=du({path:m.relativePath,caseSensitive:m.caseSensitive,end:!1},y)),!g)return null;Object.assign(l,g.params),c.push({params:l,pathname:xr([u,g.pathname]),pathnameBase:tS(xr([u,g.pathnameBase])),route:b}),g.pathnameBase!=="/"&&(u=xr([u,g.pathnameBase]))}return c}function du(e,n){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[r,a]=Qw(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:a.reduce((d,{paramName:y,isOptional:g},b)=>{if(y==="*"){let k=f[b]||"";c=u.slice(0,u.length-k.length).replace(/(.)\/+$/,"$1")}const x=f[b];return g&&!x?d[y]=void 0:d[y]=(x||"").replace(/%2F/g,"/"),d},{}),pathname:u,pathnameBase:c,pattern:e}}function Qw(e,n=!1,r=!0){wr(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 a=[],l="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(c,f,m,d,y)=>{if(a.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("*")?(a.push({paramName:"*"}),l+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?l+="\\/*$":e!==""&&e!=="/"&&(l+="(?:(?=\\/|$))"),[new RegExp(l,n?void 0:"i"),a]}function Kw(e){try{return e.split("/").map(n=>decodeURIComponent(n).replace(/\//g,"%2F")).join("/")}catch(n){return wr(!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 Vr(e,n){if(n==="/")return e;if(!e.toLowerCase().startsWith(n.toLowerCase()))return null;let r=n.endsWith("/")?n.length-1:n.length,a=e.charAt(r);return a&&a!=="/"?null:e.slice(r)||"/"}var Zw=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function Ww(e,n="/"){let{pathname:r,search:a="",hash:l=""}=typeof e=="string"?ls(e):e,u;return r?(r=r.replace(/\/\/+/g,"/"),r.startsWith("/")?u=Gy(r.substring(1),"/"):u=Gy(r,n)):u=n,{pathname:u,search:nS(a),hash:rS(l)}}function Gy(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 eh(e,n,r,a){return`Cannot include a '${e}' character in a manually specified \`to.${n}\` field [${JSON.stringify(a)}]. 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 eS(e){return e.filter((n,r)=>r===0||n.route.path&&n.route.path.length>0)}function k0(e){let n=eS(e);return n.map((r,a)=>a===n.length-1?r.pathname:r.pathnameBase)}function fd(e,n,r,a=!1){let l;typeof e=="string"?l=ls(e):(l={...e},Rt(!l.pathname||!l.pathname.includes("?"),eh("?","pathname","search",l)),Rt(!l.pathname||!l.pathname.includes("#"),eh("#","pathname","hash",l)),Rt(!l.search||!l.search.includes("#"),eh("#","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(!a&&c.startsWith("..")){let b=c.split("/");for(;b[0]==="..";)b.shift(),g-=1;l.pathname=b.join("/")}f=g>=0?n[g]:"/"}let m=Ww(l,f),d=c&&c!=="/"&&c.endsWith("/"),y=(u||c===".")&&r.endsWith("/");return!m.pathname.endsWith("/")&&(d||y)&&(m.pathname+="/"),m}var xr=e=>e.join("/").replace(/\/\/+/g,"/"),tS=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),nS=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,rS=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,iS=class{constructor(e,n,r,a=!1){this.status=e,this.statusText=n||"",this.internal=a,r instanceof Error?(this.data=r.toString(),this.error=r):this.data=r}};function aS(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function sS(e){return e.map(n=>n.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var C0=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function A0(e,n){let r=e;if(typeof r!="string"||!Zw.test(r))return{absoluteURL:void 0,isExternal:!1,to:r};let a=r,l=!1;if(C0)try{let u=new URL(window.location.href),c=r.startsWith("//")?new URL(u.protocol+r):new URL(r),f=Vr(c.pathname,n);c.origin===u.origin&&f!=null?r=f+c.search+c.hash:l=!0}catch{wr(!1,`<Link to="${r}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:a,isExternal:l,to:r}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var T0=["POST","PUT","PATCH","DELETE"];new Set(T0);var lS=["GET",...T0];new Set(lS);var os=L.createContext(null);os.displayName="DataRouter";var ju=L.createContext(null);ju.displayName="DataRouterState";var oS=L.createContext(!1),j0=L.createContext({isTransitioning:!1});j0.displayName="ViewTransition";var uS=L.createContext(new Map);uS.displayName="Fetchers";var cS=L.createContext(null);cS.displayName="Await";var Zn=L.createContext(null);Zn.displayName="Navigation";var Tl=L.createContext(null);Tl.displayName="Location";var Sr=L.createContext({outlet:null,matches:[],isDataRoute:!1});Sr.displayName="Route";var hd=L.createContext(null);hd.displayName="RouteError";var N0="REACT_ROUTER_ERROR",fS="REDIRECT",hS="ROUTE_ERROR_RESPONSE";function dS(e){if(e.startsWith(`${N0}:${fS}:{`))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 mS(e){if(e.startsWith(`${N0}:${hS}:{`))try{let n=JSON.parse(e.slice(40));if(typeof n=="object"&&n&&typeof n.status=="number"&&typeof n.statusText=="string")return new iS(n.status,n.statusText,n.data)}catch{}}function pS(e,{relative:n}={}){Rt(jl(),"useHref() may be used only in the context of a <Router> component.");let{basename:r,navigator:a}=L.useContext(Zn),{hash:l,pathname:u,search:c}=Nl(e,{relative:n}),f=u;return r!=="/"&&(f=u==="/"?r:xr([r,u])),a.createHref({pathname:f,search:c,hash:l})}function jl(){return L.useContext(Tl)!=null}function _r(){return Rt(jl(),"useLocation() may be used only in the context of a <Router> component."),L.useContext(Tl).location}var O0="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function R0(e){L.useContext(Zn).static||L.useLayoutEffect(e)}function ia(){let{isDataRoute:e}=L.useContext(Sr);return e?jS():gS()}function gS(){Rt(jl(),"useNavigate() may be used only in the context of a <Router> component.");let e=L.useContext(os),{basename:n,navigator:r}=L.useContext(Zn),{matches:a}=L.useContext(Sr),{pathname:l}=_r(),u=JSON.stringify(k0(a)),c=L.useRef(!1);return R0(()=>{c.current=!0}),L.useCallback((m,d={})=>{if(wr(c.current,O0),!c.current)return;if(typeof m=="number"){r.go(m);return}let y=fd(m,JSON.parse(u),l,d.relative==="path");e==null&&n!=="/"&&(y.pathname=y.pathname==="/"?n:xr([n,y.pathname])),(d.replace?r.replace:r.push)(y,d.state,d)},[n,r,u,l,e])}L.createContext(null);function yS(){let{matches:e}=L.useContext(Sr),n=e[e.length-1];return n?n.params:{}}function Nl(e,{relative:n}={}){let{matches:r}=L.useContext(Sr),{pathname:a}=_r(),l=JSON.stringify(k0(r));return L.useMemo(()=>fd(e,JSON.parse(l),a,n==="path"),[e,l,a,n])}function bS(e,n){return M0(e,n)}function M0(e,n,r){var B;Rt(jl(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:a}=L.useContext(Zn),{matches:l}=L.useContext(Sr),u=l[l.length-1],c=u?u.params:{},f=u?u.pathname:"/",m=u?u.pathnameBase:"/",d=u&&u.route;{let M=d&&d.path||"";z0(f,!d||M.endsWith("*")||M.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${f}" (under <Route path="${M}">) 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="${M}"> to <Route path="${M==="/"?"*":`${M}/*`}">.`)}let y=_r(),g;if(n){let M=typeof n=="string"?ls(n):n;Rt(m==="/"||((B=M.pathname)==null?void 0:B.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 "${M.pathname}" was given in the \`location\` prop.`),g=M}else g=y;let b=g.pathname||"/",x=b;if(m!=="/"){let M=m.replace(/^\//,"").split("/");x="/"+b.replace(/^\//,"").split("/").slice(M.length).join("/")}let k=S0(e,{pathname:x});wr(d||k!=null,`No routes matched location "${g.pathname}${g.search}${g.hash}" `),wr(k==null||k[k.length-1].route.element!==void 0||k[k.length-1].route.Component!==void 0||k[k.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 z=_S(k&&k.map(M=>Object.assign({},M,{params:Object.assign({},c,M.params),pathname:xr([m,a.encodeLocation?a.encodeLocation(M.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:M.pathname]),pathnameBase:M.pathnameBase==="/"?m:xr([m,a.encodeLocation?a.encodeLocation(M.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:M.pathnameBase])})),l,r);return n&&z?L.createElement(Tl.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,...g},navigationType:"POP"}},z):z}function vS(){let e=TS(),n=aS(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),r=e instanceof Error?e.stack:null,a="rgba(200,200,200, 0.5)",l={padding:"0.5rem",backgroundColor:a},u={padding:"2px 4px",backgroundColor:a},c=null;return console.error("Error handled by React Router default ErrorBoundary:",e),c=L.createElement(L.Fragment,null,L.createElement("p",null,"💿 Hey developer 👋"),L.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",L.createElement("code",{style:u},"ErrorBoundary")," or"," ",L.createElement("code",{style:u},"errorElement")," prop on your route.")),L.createElement(L.Fragment,null,L.createElement("h2",null,"Unexpected Application Error!"),L.createElement("h3",{style:{fontStyle:"italic"}},n),r?L.createElement("pre",{style:l},r):null,c)}var xS=L.createElement(vS,null),D0=class extends L.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=mS(e.digest);r&&(e=r)}let n=e!==void 0?L.createElement(Sr.Provider,{value:this.props.routeContext},L.createElement(hd.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?L.createElement(wS,{error:e},n):n}};D0.contextType=oS;var th=new WeakMap;function wS({children:e,error:n}){let{basename:r}=L.useContext(Zn);if(typeof n=="object"&&n&&"digest"in n&&typeof n.digest=="string"){let a=dS(n.digest);if(a){let l=th.get(n);if(l)throw l;let u=A0(a.location,r);if(C0&&!th.get(n))if(u.isExternal||a.reloadDocument)window.location.href=u.absoluteURL||u.to;else{const c=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(u.to,{replace:a.replace}));throw th.set(n,c),c}return L.createElement("meta",{httpEquiv:"refresh",content:`0;url=${u.absoluteURL||u.to}`})}}return e}function SS({routeContext:e,match:n,children:r}){let a=L.useContext(os);return a&&a.static&&a.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(a.staticContext._deepestRenderedBoundaryId=n.route.id),L.createElement(Sr.Provider,{value:e},r)}function _S(e,n=[],r){let a=r==null?void 0:r.state;if(e==null){if(!a)return null;if(a.errors)e=a.matches;else if(n.length===0&&!a.initialized&&a.matches.length>0)e=a.matches;else return null}let l=e,u=a==null?void 0:a.errors;if(u!=null){let y=l.findIndex(g=>g.route.id&&(u==null?void 0:u[g.route.id])!==void 0);Rt(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&&a){c=a.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:b,errors:x}=a,k=g.route.loader&&!b.hasOwnProperty(g.route.id)&&(!x||x[g.route.id]===void 0);if(g.route.lazy||k){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=a&&m?(y,g)=>{var b,x;m(y,{location:a.location,params:((x=(b=a.matches)==null?void 0:b[0])==null?void 0:x.params)??{},unstable_pattern:sS(a.matches),errorInfo:g})}:void 0;return l.reduceRight((y,g,b)=>{let x,k=!1,z=null,B=null;a&&(x=u&&g.route.id?u[g.route.id]:void 0,z=g.route.errorElement||xS,c&&(f<0&&b===0?(z0("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),k=!0,B=null):f===b&&(k=!0,B=g.route.hydrateFallbackElement||null)));let M=n.concat(l.slice(0,b+1)),F=()=>{let G;return x?G=z:k?G=B:g.route.Component?G=L.createElement(g.route.Component,null):g.route.element?G=g.route.element:G=y,L.createElement(SS,{match:g,routeContext:{outlet:y,matches:M,isDataRoute:a!=null},children:G})};return a&&(g.route.ErrorBoundary||g.route.errorElement||b===0)?L.createElement(D0,{location:a.location,revalidation:a.revalidation,component:z,error:x,children:F(),routeContext:{outlet:null,matches:M,isDataRoute:!0},onError:d}):F()},null)}function dd(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function ES(e){let n=L.useContext(os);return Rt(n,dd(e)),n}function kS(e){let n=L.useContext(ju);return Rt(n,dd(e)),n}function CS(e){let n=L.useContext(Sr);return Rt(n,dd(e)),n}function md(e){let n=CS(e),r=n.matches[n.matches.length-1];return Rt(r.route.id,`${e} can only be used on routes that contain a unique "id"`),r.route.id}function AS(){return md("useRouteId")}function TS(){var a;let e=L.useContext(hd),n=kS("useRouteError"),r=md("useRouteError");return e!==void 0?e:(a=n.errors)==null?void 0:a[r]}function jS(){let{router:e}=ES("useNavigate"),n=md("useNavigate"),r=L.useRef(!1);return R0(()=>{r.current=!0}),L.useCallback(async(l,u={})=>{wr(r.current,O0),r.current&&(typeof l=="number"?await e.navigate(l):await e.navigate(l,{fromRouteId:n,...u}))},[e,n])}var Yy={};function z0(e,n,r){!n&&!Yy[e]&&(Yy[e]=!0,wr(!1,r))}L.memo(NS);function NS({routes:e,future:n,state:r,isStatic:a,onError:l}){return M0(e,void 0,{state:r,isStatic:a,onError:l})}function Ya(e){Rt(!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 OS({basename:e="/",children:n=null,location:r,navigationType:a="POP",navigator:l,static:u=!1,unstable_useTransitions:c}){Rt(!jl(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let f=e.replace(/^\/*/,"/"),m=L.useMemo(()=>({basename:f,navigator:l,static:u,unstable_useTransitions:c,future:{}}),[f,l,u,c]);typeof r=="string"&&(r=ls(r));let{pathname:d="/",search:y="",hash:g="",state:b=null,key:x="default",unstable_mask:k}=r,z=L.useMemo(()=>{let B=Vr(d,f);return B==null?null:{location:{pathname:B,search:y,hash:g,state:b,key:x,unstable_mask:k},navigationType:a}},[f,d,y,g,b,x,a,k]);return wr(z!=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.`),z==null?null:L.createElement(Zn.Provider,{value:m},L.createElement(Tl.Provider,{children:n,value:z}))}function RS({children:e,location:n}){return bS(Lh(e),n)}function Lh(e,n=[]){let r=[];return L.Children.forEach(e,(a,l)=>{if(!L.isValidElement(a))return;let u=[...n,l];if(a.type===L.Fragment){r.push.apply(r,Lh(a.props.children,u));return}Rt(a.type===Ya,`[${typeof a.type=="string"?a.type:a.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),Rt(!a.props.index||!a.props.children,"An index route cannot have child routes.");let c={id:a.props.id||u.join("-"),caseSensitive:a.props.caseSensitive,element:a.props.element,Component:a.props.Component,index:a.props.index,path:a.props.path,middleware:a.props.middleware,loader:a.props.loader,action:a.props.action,hydrateFallbackElement:a.props.hydrateFallbackElement,HydrateFallback:a.props.HydrateFallback,errorElement:a.props.errorElement,ErrorBoundary:a.props.ErrorBoundary,hasErrorBoundary:a.props.hasErrorBoundary===!0||a.props.ErrorBoundary!=null||a.props.errorElement!=null,shouldRevalidate:a.props.shouldRevalidate,handle:a.props.handle,lazy:a.props.lazy};a.props.children&&(c.children=Lh(a.props.children,u)),r.push(c)}),r}var ou="get",uu="application/x-www-form-urlencoded";function Nu(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function MS(e){return Nu(e)&&e.tagName.toLowerCase()==="button"}function DS(e){return Nu(e)&&e.tagName.toLowerCase()==="form"}function zS(e){return Nu(e)&&e.tagName.toLowerCase()==="input"}function LS(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function US(e,n){return e.button===0&&(!n||n==="_self")&&!LS(e)}var Ko=null;function BS(){if(Ko===null)try{new FormData(document.createElement("form"),0),Ko=!1}catch{Ko=!0}return Ko}var PS=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function nh(e){return e!=null&&!PS.has(e)?(wr(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${uu}"`),null):e}function HS(e,n){let r,a,l,u,c;if(DS(e)){let f=e.getAttribute("action");a=f?Vr(f,n):null,r=e.getAttribute("method")||ou,l=nh(e.getAttribute("enctype"))||uu,u=new FormData(e)}else if(MS(e)||zS(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(a=m?Vr(m,n):null,r=e.getAttribute("formmethod")||f.getAttribute("method")||ou,l=nh(e.getAttribute("formenctype"))||nh(f.getAttribute("enctype"))||uu,u=new FormData(f,e),!BS()){let{name:d,type:y,value:g}=e;if(y==="image"){let b=d?`${d}.`:"";u.append(`${b}x`,"0"),u.append(`${b}y`,"0")}else d&&u.append(d,g)}}else{if(Nu(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');r=ou,a=null,l=uu,c=e}return u&&l==="text/plain"&&(c=u,u=void 0),{action:a,method:r.toLowerCase(),encType:l,formData:u,body:c}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function pd(e,n){if(e===!1||e===null||typeof e>"u")throw new Error(n)}function qS(e,n,r,a){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}_.${a}`:l.pathname=`${l.pathname}.${a}`:l.pathname==="/"?l.pathname=`_root.${a}`:n&&Vr(l.pathname,n)==="/"?l.pathname=`${n.replace(/\/$/,"")}/_root.${a}`:l.pathname=`${l.pathname.replace(/\/$/,"")}.${a}`,l}async function IS(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 FS(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 $S(e,n,r){let a=await Promise.all(e.map(async l=>{let u=n.routes[l.route.id];if(u){let c=await IS(u,r);return c.links?c.links():[]}return[]}));return JS(a.flat(1).filter(FS).filter(l=>l.rel==="stylesheet"||l.rel==="preload").map(l=>l.rel==="stylesheet"?{...l,rel:"prefetch",as:"style"}:{...l,rel:"prefetch"}))}function Vy(e,n,r,a,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=a.routes[m.route.id];if(!y||!y.hasLoader)return!1;if(c(m,d)||f(m,d))return!0;if(m.route.shouldRevalidate){let b=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 b=="boolean")return b}return!0}):[]}function GS(e,n,{includeHydrateFallback:r}={}){return YS(e.map(a=>{let l=n.routes[a.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 YS(e){return[...new Set(e)]}function VS(e){let n={},r=Object.keys(e).sort();for(let a of r)n[a]=e[a];return n}function JS(e,n){let r=new Set;return new Set(n),e.reduce((a,l)=>{let u=JSON.stringify(VS(l));return r.has(u)||(r.add(u),a.push({key:u,link:l})),a},[])}function L0(){let e=L.useContext(os);return pd(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function XS(){let e=L.useContext(ju);return pd(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var gd=L.createContext(void 0);gd.displayName="FrameworkContext";function U0(){let e=L.useContext(gd);return pd(e,"You must render this element inside a <HydratedRouter> element"),e}function QS(e,n){let r=L.useContext(gd),[a,l]=L.useState(!1),[u,c]=L.useState(!1),{onFocus:f,onBlur:m,onMouseEnter:d,onMouseLeave:y,onTouchStart:g}=n,b=L.useRef(null);L.useEffect(()=>{if(e==="render"&&c(!0),e==="viewport"){let z=M=>{M.forEach(F=>{c(F.isIntersecting)})},B=new IntersectionObserver(z,{threshold:.5});return b.current&&B.observe(b.current),()=>{B.disconnect()}}},[e]),L.useEffect(()=>{if(a){let z=setTimeout(()=>{c(!0)},100);return()=>{clearTimeout(z)}}},[a]);let x=()=>{l(!0)},k=()=>{l(!1),c(!1)};return r?e!=="intent"?[u,b,{}]:[u,b,{onFocus:il(f,x),onBlur:il(m,k),onMouseEnter:il(d,x),onMouseLeave:il(y,k),onTouchStart:il(g,x)}]:[!1,b,{}]}function il(e,n){return r=>{e&&e(r),r.defaultPrevented||n(r)}}function KS({page:e,...n}){let{router:r}=L0(),a=L.useMemo(()=>S0(r.routes,e,r.basename),[r.routes,e,r.basename]);return a?L.createElement(WS,{page:e,matches:a,...n}):null}function ZS(e){let{manifest:n,routeModules:r}=U0(),[a,l]=L.useState([]);return L.useEffect(()=>{let u=!1;return $S(e,n,r).then(c=>{u||l(c)}),()=>{u=!0}},[e,n,r]),a}function WS({page:e,matches:n,...r}){let a=_r(),{future:l,manifest:u,routeModules:c}=U0(),{basename:f}=L0(),{loaderData:m,matches:d}=XS(),y=L.useMemo(()=>Vy(e,n,d,u,a,"data"),[e,n,d,u,a]),g=L.useMemo(()=>Vy(e,n,d,u,a,"assets"),[e,n,d,u,a]),b=L.useMemo(()=>{if(e===a.pathname+a.search+a.hash)return[];let z=new Set,B=!1;if(n.forEach(F=>{var se;let G=u.routes[F.route.id];!G||!G.hasLoader||(!y.some(O=>O.route.id===F.route.id)&&F.route.id in m&&((se=c[F.route.id])!=null&&se.shouldRevalidate)||G.hasClientLoader?B=!0:z.add(F.route.id))}),z.size===0)return[];let M=qS(e,f,l.unstable_trailingSlashAwareDataRequests,"data");return B&&z.size>0&&M.searchParams.set("_routes",n.filter(F=>z.has(F.route.id)).map(F=>F.route.id).join(",")),[M.pathname+M.search]},[f,l.unstable_trailingSlashAwareDataRequests,m,a,u,y,n,e,c]),x=L.useMemo(()=>GS(g,u),[g,u]),k=ZS(g);return L.createElement(L.Fragment,null,b.map(z=>L.createElement("link",{key:z,rel:"prefetch",as:"fetch",href:z,...r})),x.map(z=>L.createElement("link",{key:z,rel:"modulepreload",href:z,...r})),k.map(({key:z,link:B})=>L.createElement("link",{key:z,nonce:r.nonce,...B,crossOrigin:B.crossOrigin??r.crossOrigin})))}function e_(...e){return n=>{e.forEach(r=>{typeof r=="function"?r(n):r!=null&&(r.current=n)})}}var t_=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{t_&&(window.__reactRouterVersion="7.13.1")}catch{}function n_({basename:e,children:n,unstable_useTransitions:r,window:a}){let l=L.useRef();l.current==null&&(l.current=zw({window:a,v5Compat:!0}));let u=l.current,[c,f]=L.useState({action:u.action,location:u.location}),m=L.useCallback(d=>{r===!1?f(d):L.startTransition(()=>f(d))},[r]);return L.useLayoutEffect(()=>u.listen(m),[u,m]),L.createElement(OS,{basename:e,children:n,location:c.location,navigationType:c.action,navigator:u,unstable_useTransitions:r})}var B0=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,P0=L.forwardRef(function({onClick:n,discover:r="render",prefetch:a="none",relative:l,reloadDocument:u,replace:c,unstable_mask:f,state:m,target:d,to:y,preventScrollReset:g,viewTransition:b,unstable_defaultShouldRevalidate:x,...k},z){let{basename:B,navigator:M,unstable_useTransitions:F}=L.useContext(Zn),G=typeof y=="string"&&B0.test(y),se=A0(y,B);y=se.to;let O=pS(y,{relative:l}),j=_r(),V=null;if(f){let H=fd(f,[],j.unstable_mask?j.unstable_mask.pathname:"/",!0);B!=="/"&&(H.pathname=H.pathname==="/"?B:xr([B,H.pathname])),V=M.createHref(H)}let[J,Y,N]=QS(a,k),Q=s_(y,{replace:c,unstable_mask:f,state:m,target:d,preventScrollReset:g,relative:l,viewTransition:b,unstable_defaultShouldRevalidate:x,unstable_useTransitions:F});function Z(H){n&&n(H),H.defaultPrevented||Q(H)}let ge=!(se.isExternal||u),fe=L.createElement("a",{...k,...N,href:(ge?V:void 0)||se.absoluteURL||O,onClick:ge?Z:n,ref:e_(z,Y),target:d,"data-discover":!G&&r==="render"?"true":void 0});return J&&!G?L.createElement(L.Fragment,null,fe,L.createElement(KS,{page:O})):fe});P0.displayName="Link";var r_=L.forwardRef(function({"aria-current":n="page",caseSensitive:r=!1,className:a="",end:l=!1,style:u,to:c,viewTransition:f,children:m,...d},y){let g=Nl(c,{relative:d.relative}),b=_r(),x=L.useContext(ju),{navigator:k,basename:z}=L.useContext(Zn),B=x!=null&&f_(g)&&f===!0,M=k.encodeLocation?k.encodeLocation(g).pathname:g.pathname,F=b.pathname,G=x&&x.navigation&&x.navigation.location?x.navigation.location.pathname:null;r||(F=F.toLowerCase(),G=G?G.toLowerCase():null,M=M.toLowerCase()),G&&z&&(G=Vr(G,z)||G);const se=M!=="/"&&M.endsWith("/")?M.length-1:M.length;let O=F===M||!l&&F.startsWith(M)&&F.charAt(se)==="/",j=G!=null&&(G===M||!l&&G.startsWith(M)&&G.charAt(M.length)==="/"),V={isActive:O,isPending:j,isTransitioning:B},J=O?n:void 0,Y;typeof a=="function"?Y=a(V):Y=[a,O?"active":null,j?"pending":null,B?"transitioning":null].filter(Boolean).join(" ");let N=typeof u=="function"?u(V):u;return L.createElement(P0,{...d,"aria-current":J,className:Y,ref:y,style:N,to:c,viewTransition:f},typeof m=="function"?m(V):m)});r_.displayName="NavLink";var i_=L.forwardRef(({discover:e="render",fetcherKey:n,navigate:r,reloadDocument:a,replace:l,state:u,method:c=ou,action:f,onSubmit:m,relative:d,preventScrollReset:y,viewTransition:g,unstable_defaultShouldRevalidate:b,...x},k)=>{let{unstable_useTransitions:z}=L.useContext(Zn),B=u_(),M=c_(f,{relative:d}),F=c.toLowerCase()==="get"?"get":"post",G=typeof f=="string"&&B0.test(f),se=O=>{if(m&&m(O),O.defaultPrevented)return;O.preventDefault();let j=O.nativeEvent.submitter,V=(j==null?void 0:j.getAttribute("formmethod"))||c,J=()=>B(j||O.currentTarget,{fetcherKey:n,method:V,navigate:r,replace:l,state:u,relative:d,preventScrollReset:y,viewTransition:g,unstable_defaultShouldRevalidate:b});z&&r!==!1?L.startTransition(()=>J()):J()};return L.createElement("form",{ref:k,method:F,action:M,onSubmit:a?m:se,...x,"data-discover":!G&&e==="render"?"true":void 0})});i_.displayName="Form";function a_(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function H0(e){let n=L.useContext(os);return Rt(n,a_(e)),n}function s_(e,{target:n,replace:r,unstable_mask:a,state:l,preventScrollReset:u,relative:c,viewTransition:f,unstable_defaultShouldRevalidate:m,unstable_useTransitions:d}={}){let y=ia(),g=_r(),b=Nl(e,{relative:c});return L.useCallback(x=>{if(US(x,n)){x.preventDefault();let k=r!==void 0?r:wl(g)===wl(b),z=()=>y(e,{replace:k,unstable_mask:a,state:l,preventScrollReset:u,relative:c,viewTransition:f,unstable_defaultShouldRevalidate:m});d?L.startTransition(()=>z()):z()}},[g,y,b,r,a,l,n,e,u,c,f,m,d])}var l_=0,o_=()=>`__${String(++l_)}__`;function u_(){let{router:e}=H0("useSubmit"),{basename:n}=L.useContext(Zn),r=AS(),a=e.fetch,l=e.navigate;return L.useCallback(async(u,c={})=>{let{action:f,method:m,encType:d,formData:y,body:g}=HS(u,n);if(c.navigate===!1){let b=c.fetcherKey||o_();await a(b,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})},[a,l,n,r])}function c_(e,{relative:n}={}){let{basename:r}=L.useContext(Zn),a=L.useContext(Sr);Rt(a,"useFormAction must be used inside a RouteContext");let[l]=a.matches.slice(-1),u={...Nl(e||".",{relative:n})},c=_r();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:xr([r,u.pathname])),wl(u)}function f_(e,{relative:n}={}){let r=L.useContext(j0);Rt(r!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:a}=H0("useViewTransitionState"),l=Nl(e,{relative:n});if(!r.isTransitioning)return!1;let u=Vr(r.currentLocation.pathname,a)||r.currentLocation.pathname,c=Vr(r.nextLocation.pathname,a)||r.nextLocation.pathname;return du(l.pathname,c)!=null||du(l.pathname,u)!=null}var mu=w0();const q0=L.createContext(null),I0="palmier_paired_hosts",Uh="palmier_active_host";function rh(){try{const e=localStorage.getItem(I0);if(e)return JSON.parse(e)}catch{}return[]}function h_(e){localStorage.setItem(I0,JSON.stringify(e))}function d_(){return localStorage.getItem(Uh)}function m_(e){e?localStorage.setItem(Uh,e):localStorage.removeItem(Uh)}const p_=!!window.__PALMIER_SERVE__&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1");function g_({children:e}){const[n,r]=L.useState(rh),[a,l]=L.useState(()=>{const y=d_(),g=rh();return y&&g.some(b=>b.hostId===y)?y:g.length>0?g[0].hostId:null});L.useEffect(()=>{if(!p_)return;const y="local";if(!rh().find(b=>b.hostId===y)){const b={hostId:y,clientToken:"",directUrl:window.location.origin};r(x=>[...x.filter(k=>k.hostId!==y),b]),l(y)}},[]),L.useEffect(()=>{h_(n)},[n]),L.useEffect(()=>{m_(a)},[a]);const u=L.useCallback(y=>{r(g=>[...g.filter(x=>x.hostId!==y.hostId),y]),l(y.hostId)},[]),c=L.useCallback(y=>{r(g=>{const b=g.filter(x=>x.hostId!==y);return b.length>0?l(b[0].hostId):l(null),b})},[]),f=L.useCallback((y,g)=>{r(b=>b.map(x=>x.hostId===y?{...x,name:g}:x))},[]),m=L.useCallback(y=>{l(y)},[]),d=L.useCallback(()=>n.find(y=>y.hostId===a)??null,[n,a]);return w.jsx(q0.Provider,{value:{pairedHosts:n,activeHostId:a,addPairedHost:u,removePairedHost:c,renamePairedHost:f,setActiveHostId:m,getActiveHost:d},children:e})}function Ol(){const e=L.useContext(q0);if(!e)throw new Error("useHostStore must be used within HostStoreProvider");return e}const Ln=new Uint8Array(0),aa=new TextEncoder,Mn=new TextDecoder;function y_(...e){let n=0;for(let l=0;l<e.length;l++)n+=e[l].length;const r=new Uint8Array(n);let a=0;for(let l=0;l<e.length;l++)r.set(e[l],a),a+=e[l].length;return r}function ml(...e){const n=[];for(let r=0;r<e.length;r++)n.push(aa.encode(e[r]));return n.length===0?Ln:n.length===1?n[0]:y_(...n)}function Jy(e){return!e||e.length===0?"":Mn.decode(e)}const Xy="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ",Qy=36,b_=0xcfd41b9100000,Ky=33,v_=333,Zy=22;function x_(e){for(let n=0;n<e.length;n++)e[n]=Math.floor(Math.random()*255)}function w_(e){var n;(n=globalThis==null?void 0:globalThis.crypto)!=null&&n.getRandomValues?globalThis.crypto.getRandomValues(e):x_(e)}class S_{constructor(){C(this,"buf");C(this,"seq");C(this,"inc");C(this,"inited");this.buf=new Uint8Array(Zy),this.inited=!1}init(){this.inited=!0,this.setPre(),this.initSeqAndInc(),this.fillSeq()}initSeqAndInc(){this.seq=Math.floor(Math.random()*b_),this.inc=Math.floor(Math.random()*(v_-Ky)+Ky)}setPre(){const n=new Uint8Array(12);w_(n);for(let r=0;r<12;r++){const a=n[r]%36;this.buf[r]=Xy.charCodeAt(a)}}fillSeq(){let n=this.seq;for(let r=Zy-1;r>=12;r--)this.buf[r]=Xy.charCodeAt(n%Qy),n=Math.floor(n/Qy)}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 Ni=new S_;var Gr;(function(e){e.Disconnect="disconnect",e.Reconnect="reconnect",e.Update="update",e.LDM="ldm",e.Error="error"})(Gr||(Gr={}));var Qa;(function(e){e.Reconnecting="reconnecting",e.PingTimer="pingTimer",e.StaleConnection="staleConnection",e.ClientInitiatedReconnect="client initiated reconnect"})(Qa||(Qa={}));var Ee;(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"})(Ee||(Ee={}));function __(e){return typeof e.code=="string"}class F0{constructor(){C(this,"messages");this.messages=new Map,this.messages.set(Ee.InvalidPayload,"Invalid payload type - payloads can be 'binary', 'string', or 'json'"),this.messages.set(Ee.BadJson,"Bad JSON"),this.messages.set(Ee.WssRequired,"TLS is required, therefore a secure websocket connection is also required")}static getMessage(n){return E_.getMessage(n)}getMessage(n){return this.messages.get(n)||n}}const E_=new F0;class Ne extends Error{constructor(r,a,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=a,this.chainedError=l}static errorForCode(r,a){const l=F0.getMessage(r);return new Ne(l,r,a)}isAuthError(){return this.code===Ee.AuthenticationExpired||this.code===Ee.AuthorizationViolation||this.code===Ee.AccountExpired}isAuthTimeout(){return this.code===Ee.AuthenticationTimeout}isPermissionError(){return this.code===Ee.PermissionsViolation}isProtocolError(){return this.code===Ee.ProtocolError}isJetStreamError(){return this.api_error!==void 0}jsError(){return this.api_error?this.api_error:null}}var On;(function(e){e[e.Exact=0]="Exact",e[e.CanonicalMIME=1]="CanonicalMIME",e[e.IgnoreCase=2]="IgnoreCase"})(On||(On={}));var lr;(function(e){e.Timer="timer",e.Count="count",e.JitterTimer="jitterTimer",e.SentinelMsg="sentinelMsg"})(lr||(lr={}));var pl;(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"})(pl||(pl={}));const pu="Nats-Service-Error",gu="Nats-Service-Error-Code";class yu extends Error{constructor(r,a){super(a);C(this,"code");this.code=r}static isServiceError(r){return yu.toServiceError(r)!==null}static toServiceError(r){var l,u;const a=((l=r==null?void 0:r.headers)==null?void 0:l.get(gu))||"";if(a!==""){const c=parseInt(a)||400,f=((u=r==null?void 0:r.headers)==null?void 0:u.get(pu))||"";return new yu(c,f.length?f:a)}return null}}function Yr(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}.${Ni.next()}`}const Bh="127.0.0.1";var Ai;(function(e){e.PING="PING",e.STATS="STATS",e.INFO="INFO"})(Ai||(Ai={}));function Ou(e,...n){for(let r=0;r<n.length;r++){const a=n[r];Object.keys(a).forEach(function(l){e[l]=a[l]})}return e}function Zo(e){return Mn.decode(e).replace(/\n/g,"␊").replace(/\r/g,"␍")}function ns(e,n=!0){const r=n?Ne.errorForCode(Ee.Timeout):null;let a,l;const u=new Promise((c,f)=>{a={cancel:()=>{l&&clearTimeout(l)}},l=setTimeout(()=>{f(r===null?Ne.errorForCode(Ee.Timeout):r)},e)});return Object.assign(u,a)}function us(e=0){let n;const r=new Promise(a=>{const l=setTimeout(()=>{a()},e);n={cancel:()=>{l&&clearTimeout(l)}}});return Object.assign(r,n)}function Ot(){let e={};const n=new Promise((r,a)=>{e={resolve:r,reject:a}});return Object.assign(n,e)}function $0(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 k_(e){return e===0?0:Math.floor(e/2+Math.random()*e)}function yd(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 k_(r>n?e[n]:e[r])}}}function Nt(e){return e*1e6}function bd(e){return Math.floor(e/1e6)}function Wy(e){let a=!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`,Ee.BadHeader);a&&97<=c&&c<=122?c-=32:!a&&65<=c&&c<=90&&(c+=32),l[u]=c,a=c==45}return String.fromCharCode(...l)}function Jr(e=0,n=""){if(e===0&&n!==""||e>0&&n==="")throw new Error("setting status requires both code and description");return new Ti(e,n)}const ih="NATS/1.0";class Ti{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,a]of this.headers){const l=n.values(r);if(a.length!==l.length)return!1;const u=[...a].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 Ti,l=Mn.decode(n).split(`\r
|
|
61
|
+
`),u=l[0];if(u!==ih){let c=u.replace(ih,"").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=ih;this._code>0&&this._description!==""&&(n+=` ${this._code} ${this._description}`);for(const[r,a]of this.headers)for(let l=0;l<a.length;l++)n=`${n}\r
|
|
62
|
+
${r}: ${a[l]}`;return`${n}\r
|
|
63
|
+
\r
|
|
64
|
+
`}encode(){return aa.encode(this.toString())}static validHeaderValue(n){if(/[\r\n]/.test(n))throw new Ne("invalid header value - \\r and \\n are not allowed.",Ee.BadHeader);return n.trim()}keys(){const n=[];for(const r of this.headers.keys())n.push(r);return n}findKeys(n,r=On.Exact){const a=this.keys();switch(r){case On.Exact:return a.filter(l=>l===n);case On.CanonicalMIME:return n=Wy(n),a.filter(l=>l===n);default:{const l=n.toLowerCase();return a.filter(u=>l===u.toLowerCase())}}}get(n,r=On.Exact){const a=this.findKeys(n,r);if(a.length){const l=this.headers.get(a[0]);if(l)return Array.isArray(l)?l[0]:l}return""}last(n,r=On.Exact){const a=this.findKeys(n,r);if(a.length){const l=this.headers.get(a[0]);if(l)return Array.isArray(l)?l[l.length-1]:l}return""}has(n,r=On.Exact){return this.findKeys(n,r).length>0}set(n,r,a=On.Exact){this.delete(n,a),this.append(n,r,a)}append(n,r,a=On.Exact){const l=Wy(n);a===On.CanonicalMIME&&(n=l);const u=this.findKeys(n,a);n=u.length>0?u[0]:n;const c=Ti.validHeaderValue(r);let f=this.headers.get(n);f||(f=[],this.headers.set(n,f)),f.push(c)}values(n,r=On.Exact){const a=[];return this.findKeys(n,r).forEach(u=>{const c=this.headers.get(u);c&&a.push(...c)}),a}delete(n,r=On.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 Ti;for(const a in n)r.headers.set(a,n[a]);return r}}function bu(){return{encode(e){return aa.encode(e)},decode(e){return Mn.decode(e)}}}function or(e){return{encode(n){try{return n===void 0&&(n=null),aa.encode(JSON.stringify(n))}catch(r){throw Ne.errorForCode(Ee.BadJson,r)}},decode(n){try{return JSON.parse(Mn.decode(n),e)}catch(r){throw Ne.errorForCode(Ee.BadJson,r)}}}}function G0(e){var n;return e&&e.data.length===0&&((n=e.headers)==null?void 0:n.code)===503?Ne.errorForCode(Ee.NoResponders):null}class vd{constructor(n,r,a){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=a}get subject(){return this._subject?this._subject:(this._subject=Mn.decode(this._msg.subject),this._subject)}get reply(){return this._reply?this._reply:(this._reply=Mn.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=Ti.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=Ln,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,a=this._msg.size===-1?0:this._msg.size;return n+r+a}json(n){return or(n).decode(this.data)}string(){return Mn.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(a,l){return(a==="start"||a==="stop")&&l!==""?new Date(Date.parse(l)):l}):null}}C(vd,"jc");function Ka(e){return Ru("durable",e)}function on(e){return Ru("stream",e)}function Ru(e,n=""){if(n==="")throw Error(`${e} name required`);return[".","*",">","/","\\"," "," ",`
|
|
65
|
+
`,"\r"].forEach(a=>{if(n.indexOf(a)!==-1){switch(a){case`
|
|
66
|
+
`:a="\\n";break;case"\r":a="\\r";break;case" ":a="\\t";break}throw Error(`invalid ${e} name - ${e} name cannot contain '${a}'`)}}),""}function hl(e,n=""){if(n==="")throw Error(`${e} name required`);const r=C_(n);if(r.length)throw new Error(`invalid ${e} name - ${e} name ${r}`)}function C_(e=""){if(e==="")throw Error("name required");const n=/^[-\w]+$/g;if(e.match(n)===null){for(const a of e.split(""))if(a.match(n)===null)return`cannot contain '${a}'`}return""}function Ph(e){if(e.data.length>0)return!1;const n=e.headers;return n?n.code>=100&&n.code<200:!1}function Hh(e){var n;return Ph(e)&&((n=e.headers)==null?void 0:n.description)==="Idle Heartbeat"}function A_(e,n,r){const a=Jr(e,n),l={hdr:1,sid:0,size:0},u=new vd(l,Ln,{});return u._headers=a,u._subject=r,u}function Za(e){if(e.data.length!==0)return null;const n=e.headers;return n?Y0(n.code,n.description):null}var Qn;(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"})(Qn||(Qn={}));function T_(e){return e.code!==Ee.JetStream409?!1:[Qn.MaxBatchExceeded,Qn.MaxExpiresExceeded,Qn.MaxBytesExceeded,Qn.MaxMessageSizeExceeded,Qn.PushConsumer,Qn.IdleHeartbeatMissed,Qn.ConsumerDeleted].find(r=>e.message.indexOf(r)!==-1)!==void 0}function Y0(e,n=""){if(e<300)return null;switch(n=n.toLowerCase(),e){case 404:return new Ne(n,Ee.JetStream404NoMessages);case 408:return new Ne(n,Ee.JetStream408RequestTimeout);case 409:{const r=n.startsWith(Qn.IdleHeartbeatMissed)?Ee.JetStreamIdleHeartBeat:Ee.JetStream409;return new Ne(n,r)}case 503:return Ne.errorForCode(Ee.JetStreamNotEnabled,new Error(n));default:return n===""&&(n=Ee.Unknown),new Ne(n,`${e}`)}}class Jt{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=Ot(),this.yields=[],this.iterClosed=Ot(),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:a}=this.ingestionFilterFn?this.ingestionFilterFn(n,this.ctx||this):{ingest:!0,protocol:!1};r&&(a&&(this.filtered++,this.pendingFiltered++),this.yields.push(n),this.signal.resolve())}async*iterate(){if(this.noIterator)throw new Ne("unsupported iterator",Ee.ApiError);if(this.yielding)throw new Ne("already yielding",Ee.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=Ot())}}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 xd{constructor(n,r,a={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=(a==null?void 0:a.maxOut)||2,this.cancelAfter=(a==null?void 0:a.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,a=2){this.interval=n,this.maxOut=a,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 qh;(function(e){e.Limits="limits",e.Interest="interest",e.Workqueue="workqueue"})(qh||(qh={}));var Sl;(function(e){e.Old="old",e.New="new"})(Sl||(Sl={}));var Ih;(function(e){e.File="file",e.Memory="memory"})(Ih||(Ih={}));var Bt;(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"})(Bt||(Bt={}));var Vt;(function(e){e.None="none",e.All="all",e.Explicit="explicit",e.NotSet=""})(Vt||(Vt={}));var rs;(function(e){e.Instant="instant",e.Original="original"})(rs||(rs={}));var Oi;(function(e){e.None="none",e.S2="s2"})(Oi||(Oi={}));var vu;(function(e){e.CreateOrUpdate="",e.Update="update",e.Create="create"})(vu||(vu={}));function j_(e,n={}){return Object.assign({name:e,deliver_policy:Bt.All,ack_policy:Vt.Explicit,ack_wait:Nt(30*1e3),replay_policy:rs.Instant},n)}var eb;(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"})(eb||(eb={}));var fn;(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"})(fn||(fn={}));var sr;(function(e){e.LastValue="",e.AllHistory="history",e.UpdatesOnly="updates"})(sr||(sr={}));var Xa;(function(e){e.Stream="Nats-Stream",e.Sequence="Nats-Sequence",e.TimeStamp="Nats-Time-Stamp",e.Subject="Nats-Subject"})(Xa||(Xa={}));var tb;(function(e){e.Stream="Nats-Stream",e.Subject="Nats-Subject",e.Sequence="Nats-Sequence",e.LastSequence="Nats-Last-Sequence",e.Size="Nats-Msg-Size"})(tb||(tb={}));const Rn="KV_";class N_{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=j_("",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(a=>{this.filterSubject(a)}),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?Vt.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 Ka(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=Bt.StartSequence,this.config.opt_start_seq=n,this}startTime(n){return this.config.deliver_policy=Bt.StartTime,this.config.opt_start_time=n.toISOString(),this}deliverAll(){return this.config.deliver_policy=Bt.All,this}deliverLastPerSubject(){return this.config.deliver_policy=Bt.LastPerSubject,this}deliverLast(){return this.config.deliver_policy=Bt.Last,this}deliverNew(){return this.config.deliver_policy=Bt.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=Vt.None,this}ackAll(){return this.config.ack_policy=Vt.All,this}ackExplicit(){return this.config.ack_policy=Vt.Explicit,this}ackWait(n){return this.config.ack_wait=Nt(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=rs.Instant,this}replayOriginal(){return this.config.replay_policy=rs.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=Nt(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=Nt(n),this}maxPullBatch(n){return this.config.max_batch=n,this}maxPullRequestExpires(n){return this.config.max_expires=Nt(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 ji(e){return new N_(e)}function nb(e){return typeof e.getOpts=="function"}class O_{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 a=atob(n);return r?Uint8Array.from(a,l=>l.charCodeAt(0)):a}}class Wa{static encode(n){return Wa.toB64URLEncoding(O_.encode(n))}static decode(n,r=!1){return Wa.decode(Wa.fromB64URLEncoding(n),r)}static toB64URLEncoding(n){return n.replace(/\+/g,"-").replace(/\//g,"_")}static fromB64URLEncoding(n){return n.replace(/_/g,"/").replace(/-/g,"+")}}class is{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 a=new Uint8Array(r);let l=0;for(let u=0;u<n.length;u++)a.set(n[u],l),l+=n[u].length;return a}static fromAscii(n){return n||(n=""),aa.encode(n)}static toAscii(n){return Mn.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 a=0;a<this.buffers.length;a++)n.set(this.buffers[a],r),r+=this.buffers[a].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 a=this.byteLength;(n===void 0||n>a)&&(n=a);const l=r.subarray(0,n);return a>n&&this.buffers.push(r.subarray(n)),this.byteLength=a-n,l}}return new Uint8Array(0)}fill(n,...r){n&&(this.buffers.push(n),this.byteLength+=n.length);for(let a=0;a<r.length;a++)r[a]&&r[a].length&&(this.buffers.push(r[a]),this.byteLength+=r[a].length)}peek(){return this.buffers.length?(this.pack(),this.buffers[0]):new Uint8Array(0)}size(){return this.byteLength}length(){return this.buffers.length}}function R_(e,n){return n.forEach(function(r){r&&typeof r!="string"&&!Array.isArray(r)&&Object.keys(r).forEach(function(a){if(a!=="default"&&!(a in e)){var l=Object.getOwnPropertyDescriptor(r,a);Object.defineProperty(e,a,l.get?l:{enumerable:!0,get:function(){return r[a]}})}})}),Object.freeze(e)}var M_=typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{},al=M_.performance||{};al.now||al.mozNow||al.msNow||al.oNow||al.webkitNow;var rb={versions:{}},D_=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function z_(e){if(e.__esModule)return e;var n=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(e).forEach(function(r){var a=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,a.get?a:{enumerable:!0,get:function(){return e[r]}})}),n}var ah,Mu={exports:{}},ib={},ab=z_(R_({__proto__:null,default:ib},[ib]));ah=Mu,(function(){var e="input is invalid type",n=typeof window=="object",r=n?window:{};r.JS_SHA256_NO_WINDOW&&(n=!1);var a=!n&&typeof self=="object",l=!r.JS_SHA256_NO_NODE_JS&&rb.versions&&rb.versions.node;l?r=D_:a&&(r=self);var u=!r.JS_SHA256_NO_COMMON_JS&&ah.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"],b=[];!r.JS_SHA256_NO_NODE_JS&&Array.isArray||(Array.isArray=function(O){return Object.prototype.toString.call(O)==="[object Array]"}),!c||!r.JS_SHA256_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(O){return typeof O=="object"&&O.buffer&&O.buffer.constructor===ArrayBuffer});var x=function(O,j){return function(V){return new F(j,!0).update(V)[O]()}},k=function(O){var j=x("hex",O);l&&(j=z(j,O)),j.create=function(){return new F(O)},j.update=function(Y){return j.create().update(Y)};for(var V=0;V<g.length;++V){var J=g[V];j[J]=x(J,O)}return j},z=function(O,j){var V,J=ab,Y=ab.Buffer,N=j?"sha224":"sha256";return V=Y.from&&!r.JS_SHA256_NO_BUFFER_FROM?Y.from:function(Q){return new Y(Q)},function(Q){if(typeof Q=="string")return J.createHash(N).update(Q,"utf8").digest("hex");if(Q==null)throw new Error(e);return Q.constructor===ArrayBuffer&&(Q=new Uint8Array(Q)),Array.isArray(Q)||ArrayBuffer.isView(Q)||Q.constructor===Y?J.createHash(N).update(V(Q)).digest("hex"):O(Q)}},B=function(O,j){return function(V,J){return new G(V,j,!0).update(J)[O]()}},M=function(O){var j=B("hex",O);j.create=function(Y){return new G(Y,O)},j.update=function(Y,N){return j.create(Y).update(N)};for(var V=0;V<g.length;++V){var J=g[V];j[J]=B(J,O)}return j};function F(O,j){j?(b[0]=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,this.blocks=b):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],O?(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=O}function G(O,j,V){var J,Y=typeof O;if(Y==="string"){var N,Q=[],Z=O.length,ge=0;for(J=0;J<Z;++J)(N=O.charCodeAt(J))<128?Q[ge++]=N:N<2048?(Q[ge++]=192|N>>>6,Q[ge++]=128|63&N):N<55296||N>=57344?(Q[ge++]=224|N>>>12,Q[ge++]=128|N>>>6&63,Q[ge++]=128|63&N):(N=65536+((1023&N)<<10|1023&O.charCodeAt(++J)),Q[ge++]=240|N>>>18,Q[ge++]=128|N>>>12&63,Q[ge++]=128|N>>>6&63,Q[ge++]=128|63&N);O=Q}else{if(Y!=="object")throw new Error(e);if(O===null)throw new Error(e);if(c&&O.constructor===ArrayBuffer)O=new Uint8Array(O);else if(!(Array.isArray(O)||c&&ArrayBuffer.isView(O)))throw new Error(e)}O.length>64&&(O=new F(j,!0).update(O).array());var fe=[],H=[];for(J=0;J<64;++J){var q=O[J]||0;fe[J]=92^q,H[J]=54^q}F.call(this,j,V),this.update(H),this.oKeyPad=fe,this.inner=!0,this.sharedMemory=V}F.prototype.update=function(O){if(!this.finalized){var j,V=typeof O;if(V!=="string"){if(V!=="object")throw new Error(e);if(O===null)throw new Error(e);if(c&&O.constructor===ArrayBuffer)O=new Uint8Array(O);else if(!(Array.isArray(O)||c&&ArrayBuffer.isView(O)))throw new Error(e);j=!0}for(var J,Y,N=0,Q=O.length,Z=this.blocks;N<Q;){if(this.hashed&&(this.hashed=!1,Z[0]=this.block,this.block=Z[16]=Z[1]=Z[2]=Z[3]=Z[4]=Z[5]=Z[6]=Z[7]=Z[8]=Z[9]=Z[10]=Z[11]=Z[12]=Z[13]=Z[14]=Z[15]=0),j)for(Y=this.start;N<Q&&Y<64;++N)Z[Y>>>2]|=O[N]<<d[3&Y++];else for(Y=this.start;N<Q&&Y<64;++N)(J=O.charCodeAt(N))<128?Z[Y>>>2]|=J<<d[3&Y++]:J<2048?(Z[Y>>>2]|=(192|J>>>6)<<d[3&Y++],Z[Y>>>2]|=(128|63&J)<<d[3&Y++]):J<55296||J>=57344?(Z[Y>>>2]|=(224|J>>>12)<<d[3&Y++],Z[Y>>>2]|=(128|J>>>6&63)<<d[3&Y++],Z[Y>>>2]|=(128|63&J)<<d[3&Y++]):(J=65536+((1023&J)<<10|1023&O.charCodeAt(++N)),Z[Y>>>2]|=(240|J>>>18)<<d[3&Y++],Z[Y>>>2]|=(128|J>>>12&63)<<d[3&Y++],Z[Y>>>2]|=(128|J>>>6&63)<<d[3&Y++],Z[Y>>>2]|=(128|63&J)<<d[3&Y++]);this.lastByteIndex=Y,this.bytes+=Y-this.start,Y>=64?(this.block=Z[16],this.start=Y-64,this.hash(),this.hashed=!0):this.start=Y}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296|0,this.bytes=this.bytes%4294967296),this}},F.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var O=this.blocks,j=this.lastByteIndex;O[16]=this.block,O[j>>>2]|=m[3&j],this.block=O[16],j>=56&&(this.hashed||this.hash(),O[0]=this.block,O[16]=O[1]=O[2]=O[3]=O[4]=O[5]=O[6]=O[7]=O[8]=O[9]=O[10]=O[11]=O[12]=O[13]=O[14]=O[15]=0),O[14]=this.hBytes<<3|this.bytes>>>29,O[15]=this.bytes<<3,this.hash()}},F.prototype.hash=function(){var O,j,V,J,Y,N,Q,Z,ge,fe=this.h0,H=this.h1,q=this.h2,re=this.h3,ye=this.h4,_e=this.h5,R=this.h6,U=this.h7,W=this.blocks;for(O=16;O<64;++O)j=((Y=W[O-15])>>>7|Y<<25)^(Y>>>18|Y<<14)^Y>>>3,V=((Y=W[O-2])>>>17|Y<<15)^(Y>>>19|Y<<13)^Y>>>10,W[O]=W[O-16]+j+W[O-7]+V|0;for(ge=H&q,O=0;O<64;O+=4)this.first?(this.is224?(N=300032,U=(Y=W[0]-1413257819)-150054599|0,re=Y+24177077|0):(N=704751109,U=(Y=W[0]-210244248)-1521486534|0,re=Y+143694565|0),this.first=!1):(j=(fe>>>2|fe<<30)^(fe>>>13|fe<<19)^(fe>>>22|fe<<10),J=(N=fe&H)^fe&q^ge,U=re+(Y=U+(V=(ye>>>6|ye<<26)^(ye>>>11|ye<<21)^(ye>>>25|ye<<7))+(ye&_e^~ye&R)+y[O]+W[O])|0,re=Y+(j+J)|0),j=(re>>>2|re<<30)^(re>>>13|re<<19)^(re>>>22|re<<10),J=(Q=re&fe)^re&H^N,R=q+(Y=R+(V=(U>>>6|U<<26)^(U>>>11|U<<21)^(U>>>25|U<<7))+(U&ye^~U&_e)+y[O+1]+W[O+1])|0,j=((q=Y+(j+J)|0)>>>2|q<<30)^(q>>>13|q<<19)^(q>>>22|q<<10),J=(Z=q&re)^q&fe^Q,_e=H+(Y=_e+(V=(R>>>6|R<<26)^(R>>>11|R<<21)^(R>>>25|R<<7))+(R&U^~R&ye)+y[O+2]+W[O+2])|0,j=((H=Y+(j+J)|0)>>>2|H<<30)^(H>>>13|H<<19)^(H>>>22|H<<10),J=(ge=H&q)^H&re^Z,ye=fe+(Y=ye+(V=(_e>>>6|_e<<26)^(_e>>>11|_e<<21)^(_e>>>25|_e<<7))+(_e&R^~_e&U)+y[O+3]+W[O+3])|0,fe=Y+(j+J)|0,this.chromeBugWorkAround=!0;this.h0=this.h0+fe|0,this.h1=this.h1+H|0,this.h2=this.h2+q|0,this.h3=this.h3+re|0,this.h4=this.h4+ye|0,this.h5=this.h5+_e|0,this.h6=this.h6+R|0,this.h7=this.h7+U|0},F.prototype.hex=function(){this.finalize();var O=this.h0,j=this.h1,V=this.h2,J=this.h3,Y=this.h4,N=this.h5,Q=this.h6,Z=this.h7,ge=f[O>>>28&15]+f[O>>>24&15]+f[O>>>20&15]+f[O>>>16&15]+f[O>>>12&15]+f[O>>>8&15]+f[O>>>4&15]+f[15&O]+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]+f[V>>>28&15]+f[V>>>24&15]+f[V>>>20&15]+f[V>>>16&15]+f[V>>>12&15]+f[V>>>8&15]+f[V>>>4&15]+f[15&V]+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]+f[Y>>>28&15]+f[Y>>>24&15]+f[Y>>>20&15]+f[Y>>>16&15]+f[Y>>>12&15]+f[Y>>>8&15]+f[Y>>>4&15]+f[15&Y]+f[N>>>28&15]+f[N>>>24&15]+f[N>>>20&15]+f[N>>>16&15]+f[N>>>12&15]+f[N>>>8&15]+f[N>>>4&15]+f[15&N]+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];return this.is224||(ge+=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]),ge},F.prototype.toString=F.prototype.hex,F.prototype.digest=function(){this.finalize();var O=this.h0,j=this.h1,V=this.h2,J=this.h3,Y=this.h4,N=this.h5,Q=this.h6,Z=this.h7,ge=[O>>>24&255,O>>>16&255,O>>>8&255,255&O,j>>>24&255,j>>>16&255,j>>>8&255,255&j,V>>>24&255,V>>>16&255,V>>>8&255,255&V,J>>>24&255,J>>>16&255,J>>>8&255,255&J,Y>>>24&255,Y>>>16&255,Y>>>8&255,255&Y,N>>>24&255,N>>>16&255,N>>>8&255,255&N,Q>>>24&255,Q>>>16&255,Q>>>8&255,255&Q];return this.is224||ge.push(Z>>>24&255,Z>>>16&255,Z>>>8&255,255&Z),ge},F.prototype.array=F.prototype.digest,F.prototype.arrayBuffer=function(){this.finalize();var O=new ArrayBuffer(this.is224?28:32),j=new DataView(O);return j.setUint32(0,this.h0),j.setUint32(4,this.h1),j.setUint32(8,this.h2),j.setUint32(12,this.h3),j.setUint32(16,this.h4),j.setUint32(20,this.h5),j.setUint32(24,this.h6),this.is224||j.setUint32(28,this.h7),O},G.prototype=new F,G.prototype.finalize=function(){if(F.prototype.finalize.call(this),this.inner){this.inner=!1;var O=this.array();F.call(this,this.is224,this.sharedMemory),this.update(this.oKeyPad),this.update(O),F.prototype.finalize.call(this)}};var se=k();se.sha256=se,se.sha224=k(!0),se.sha256.hmac=M(),se.sha224.hmac=M(!0),u?ah.exports=se:(r.sha256=se.sha256,r.sha224=se.sha224)})();Mu.exports;Mu.exports.sha224;var sb=Mu.exports.sha256;function Fh(e){return q_(e)}function L_(e){if(!/^[0-9A-Fa-f]+$/.test(e))return!1;const r=/^[0-9A-F]+$/.test(e),a=/^[0-9a-f]+$/.test(e);return r||a?e.length%2===0:!1}function U_(e){return/^[A-Za-z0-9\-_]*(={0,2})?$/.test(e)||/^[A-Za-z0-9+/]*(={0,2})?$/.test(e)}function B_(e){return L_(e)?"hex":U_(e)?"b64":""}function P_(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 H_(e){e=e.replace(/-/g,"+"),e=e.replace(/_/g,"/");const n=atob(e);return Uint8Array.from(n,r=>r.charCodeAt(0))}function q_(e){switch(B_(e)){case"hex":return P_(e);case"b64":return H_(e)}return null}function I_(e,n){const r=typeof e=="string"?Fh(e):e,a=typeof n=="string"?Fh(n):n;if(r===null||a===null||r.length!==a.length)return!1;for(let l=0;l<r.length;l++)if(r[l]!==a[l])return!1;return!0}class V0{constructor(n,r,a=!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=Ni.next(),a&&(this.ctx=new Error)}}class F_ extends V0{constructor(r,a,l={maxWait:1e3}){super(r,a);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=Ot(),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,a){r?(this.ctx&&(r.stack+=`
|
|
67
|
+
|
|
68
|
+
${this.ctx.stack}`),this.cancel(r)):(this.callback(null,a),this.opts.strategy===lr.Count&&(this.max--,this.max===0&&this.cancel()),this.opts.strategy===lr.JitterTimer&&(clearTimeout(this.timer),this.timer=setTimeout(()=>{this.cancel()},this.opts.jitter||300)),this.opts.strategy===lr.SentinelMsg&&a&&a.data.length===0&&this.cancel())}}class J0 extends V0{constructor(r,a,l={timeout:1e3},u=!0){super(r,a,u);C(this,"deferred");C(this,"timer");this.deferred=Ot(),this.timer=ns(l.timeout,u)}resolver(r,a){this.timer&&this.timer.cancel(),r?(this.ctx&&(r.stack+=`
|
|
69
|
+
|
|
70
|
+
${this.ctx.stack}`),this.deferred.reject(r)):this.deferred.resolve(a),this.cancel()}cancel(r){this.timer&&this.timer.cancel(),this.mux.cancel(this),this.deferred.reject(r||Ne.errorForCode(Ee.Cancelled))}}const $_="$JS.API";function G_(e){return e=e||{},e.domain&&(e.apiPrefix=`$JS.${e.domain}.API`,delete e.domain),Ou({apiPrefix:$_,timeout:5e3},e)}class Rl{constructor(n,r){C(this,"nc");C(this,"opts");C(this,"prefix");C(this,"timeout");C(this,"jc");this.nc=n,this.opts=G_(r),this._parseOpts(),this.prefix=this.opts.apiPrefix,this.timeout=this.opts.timeout,this.jc=or()}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,a){a=a||{},a.timeout=this.timeout;let l=Ln;r&&(l=this.jc.encode(r));let{retries:u}=a;u=u||1,u=u===-1?Number.MAX_SAFE_INTEGER:u;const c=yd();for(let f=0;f<u;f++)try{const m=await this.nc.request(n,l,a);return this.parseJsResponse(m)}catch(m){const d=m;if((d.code==="503"||d.code===Ee.Timeout)&&f+1<u)await us(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),a=r;if(a.error){const l=Y0(a.error.code,a.error.description);if(l!==null)throw l.api_error=a.error,l}return r}}class dl{constructor(n,r,a,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=a,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 a=this.countResponse(r);return a===0?[]:(this.offset+=a,this.filter(r))}catch(r){throw this.err=r,r}}countResponse(n){var r,a,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((a=n.consumers)==null?void 0:a.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 na(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 $h(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 Y_{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=na(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:$h(this.server,na(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=na(n)),$h(this.server,n)>=0}}class xu extends Rl{constructor(n,r){super(n,r)}async add(n,r,a=vu.Create){if(on(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=a,l.config.durable_name&&Ka(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{Ru("name",m)}catch(b){const x=b.message,k=x.indexOf("cannot contain");throw k!==-1?new Error(`consumer 'name' ${x.substring(k)}`):b}let d,y="";if(Array.isArray(r.filter_subjects)){const{min:b,ok:x}=u.features.get(ut.JS_MULTIPLE_CONSUMER_FILTER);if(!x)throw new Error(`consumer 'filter_subjects' requires server ${b}`);f=!1}if(r.metadata){const{min:b,ok:x}=u.features.get(ut.JS_STREAM_CONSUMER_METADATA);if(!x)throw new Error(`consumer 'metadata' requires server ${b}`)}if(f&&(y=r.name??r.durable_name??""),y!==""){let b=r.filter_subject??void 0;b===">"&&(b=void 0),d=b!==void 0?`${this.prefix}.CONSUMER.CREATE.${n}.${y}.${b}`:`${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,a){const l=await this.info(n,r),u=a;return this.add(n,Object.assign(l.config,u),vu.Update)}async info(n,r){return on(n),Ka(r),await this._request(`${this.prefix}.CONSUMER.INFO.${n}.${r}`)}async delete(n,r){return on(n),Ka(r),(await this._request(`${this.prefix}.CONSUMER.DELETE.${n}.${r}`)).success}list(n){on(n);const r=l=>l.consumers,a=`${this.prefix}.CONSUMER.LIST.${n}`;return new dl(a,r,this)}pause(n,r,a){const l=`${this.prefix}.CONSUMER.PAUSE.${n}.${r}`,u={pause_until:a.toISOString()};return this._request(l,u)}resume(n,r){return this.pause(n,r,new Date(0))}}function Fa(e,n,r=!1){if(r===!0&&!e)throw Ne.errorForCode(Ee.ApiError,new Error(`${n} is not a function`));if(e&&typeof e!="function")throw Ne.errorForCode(Ee.ApiError,new Error(`${n} is not a function`))}class V_ extends Jt{constructor(r,a,l){super();C(this,"sub");C(this,"adapter");C(this,"subIterDone");Fa(l.adapter,"adapter",!0),this.adapter=l.adapter,l.callback&&Fa(l.callback,"callback"),this.noIterator=typeof l.callback=="function",l.ingestionFilterFn&&(Fa(l.ingestionFilterFn,"ingestionFilterFn"),this.ingestionFilterFn=l.ingestionFilterFn),l.protocolFilterFn&&(Fa(l.protocolFilterFn,"protocolFilterFn"),this.protocolFilterFn=l.protocolFilterFn),l.dispatchedFn&&(Fa(l.dispatchedFn,"dispatchedFn"),this.dispatchedFn=l.dispatchedFn),l.cleanupFn&&Fa(l.cleanupFn,"cleanupFn");let u=(y,g)=>{this.callback(y,g)};if(l.callback){const y=l.callback;u=(g,b)=>{const[x,k]=this.adapter(g,b);if(x){y(x,null);return}const{ingest:z}=this.ingestionFilterFn?this.ingestionFilterFn(k,this):{ingest:!0};z&&(!this.protocolFilterFn||this.protocolFilterFn(k))&&(y(x,k),this.dispatchedFn&&k&&this.dispatchedFn(k))}}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(a,d),l.cleanupFn&&(this.sub.cleanupFn=l.cleanupFn),this.noIterator||this.iterClosed.then(()=>{this.unsubscribe()}),this.subIterDone=Ot(),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,a){this.sub.cancelTimeout();const[l,u]=this.adapter(r,a);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 Dn;function J_(e){Dn=e}function X0(){return Dn!==void 0&&Dn.defaultPort!==void 0?Dn.defaultPort:4222}function sh(){return Dn!==void 0&&Dn.urlParseFn?Dn.urlParseFn:void 0}function X_(){if(!Dn||typeof Dn.factory!="function")throw new Error("transport fn is not set");return Dn.factory()}function Gh(){return Dn!==void 0&&Dn.dnsResolveFn?Dn.dnsResolveFn:void 0}const cu=`\r
|
|
71
|
+
`,wu=is.fromAscii(cu),Q_=new Uint8Array(wu)[0],K_=new Uint8Array(wu)[1];function Z_(e){for(let n=0;n<e.length;n++){const r=n+1;if(e.byteLength>r&&e[n]===Q_&&e[r]===K_)return r+1}return 0}function W_(e){const n=Z_(e);if(n>0){const a=new Uint8Array(e).slice(0,n);return Mn.decode(a)}return""}const eE=4,Q0=48,tE=65,nE=97;function rE(e,n,r,a){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]=a,l}function Yh(e){return iE(e)!==void 0}function iE(e){for(let n=0;n<e.length;n++)switch(e[n]){case".":return K0(e);case":":return aE(e)}}function K0(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:a,c:l,ok:u}=sE(e);if(!u||a>255)return;e=e.substring(l),n[r]=a}return rE(n[0],n[1],n[2],n[3])}function aE(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 a=0;for(;a<16;){const{n:l,c:u,ok:c}=lE(e);if(!c||l>65535)return;if(u<e.length&&e[u]==="."){if(r<0&&a!=12||a+4>16)return;const f=K0(e);if(f===void 0)return;n[a]=f[12],n[a+1]=f[13],n[a+2]=f[14],n[a+3]=f[15],e="",a+=eE;break}if(n[a]=l>>8,n[a+1]=l,a+=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=a,e=e.substring(1),e.length===0)break}}if(e.length===0){if(a<16){if(r<0)return;const l=16-a;for(let u=a-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 sE(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)-Q0),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 lE(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)-Q0;else if(97<=e.charCodeAt(r)&&e.charCodeAt(r)<=102)n*=16,n+=e.charCodeAt(r)-nE+10;else if(65<=e.charCodeAt(r)&&e.charCodeAt(r)<=70)n*=16,n+=e.charCodeAt(r)-tE+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 oE(e){return e.indexOf("[")!==-1||e.indexOf("::")!==-1?!1:e.indexOf(".")!==-1||e.split(":").length<=2}function Vh(e){return!oE(e)}function uE(e){const n="::FFFF:",r=e.toUpperCase().indexOf(n);if(r!==-1&&e.indexOf(".")!==-1){let a=e.substring(r+n.length);return a=a.replace("[",""),a.replace("]","")}return e}function cE(e){e=e.trim(),e.match(/^(.*:\/\/)(.*)/m)&&(e=e.replace(/^(.*:\/\/)(.*)/gm,"$2")),e=uE(e),Vh(e)&&e.indexOf("[")===-1&&(e=`[${e}]`);const n=Vh(e)?e.match(/(]:)(\d+)/):e.match(/(:)(\d+)/),r=n&&n.length===3&&n[1]&&n[2]?parseInt(n[2]):4222,a=r===80?"https":"http",l=new URL(`${a}://${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 gl{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 a=cE(n);this.listen=a.listen,this.hostname=a.hostname,this.port=a.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(Yh(this.hostname))return[this];{const a=await n.fn(this.hostname);n.debug&&console.log(`resolve ${this.hostname} = ${a.join(",")}`);for(const l of a){const u=this.port===80?"https":"http",c=new URL(`${u}://${Vh(l)?"["+l+"]":l}`);c.port=`${this.port}`;const f=new gl(c.host,!1);f.tlsName=this.hostname,r.push(f)}}return n.randomize&&$0(r),this.resolves=r,r}}class fE{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 a=sh();n&&(n.forEach(l=>{l=a?a(l):l,this.servers.push(new gl(l))}),this.randomize&&(this.servers=$0(this.servers))),this.servers.length===0&&this.addServer(`${Bh}:${X0()}`,!1),this.currentServer=this.servers[0]}clear(){this.servers.length=0}updateTLSName(){const n=this.getCurrentServer();Yh(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 a=sh();n=a?a(n):n;const l=new gl(n,r);Yh(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 a=[];let l=[];const u=sh(),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 gl(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),a.push(d)}),{added:a,deleted:l}}}class hE{constructor(){C(this,"baseInbox");C(this,"reqs");this.reqs=new Map}size(){return this.reqs.size}init(n){return this.baseInbox=`${Yr(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 a=r.permissionContext;if(a.operation==="publish"){const l=this.all().find(u=>u.requestSubject===a.subject);if(l)return l.resolver(r,{}),!0}}return!1}dispatcher(){return(n,r)=>{const a=this.getToken(r);if(a){const l=this.get(a);l&&(n===null&&r.headers&&(n=G0(r)),l.resolver(n,r))}}}close(){const n=Ne.errorForCode(Ee.Timeout);this.reqs.forEach(r=>{r.resolver(n,{})})}}class dE{constructor(n,r,a){C(this,"ph");C(this,"interval");C(this,"maxOut");C(this,"timer");C(this,"pendings");this.ph=n,this.interval=r,this.maxOut=a,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:Qa.PingTimer,data:`${this.pendings.length+1}`}),this.pendings.length===this.maxOut){this.cancel(!0);return}const n=Ot();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 mE extends Error{constructor(n){super(n),this.name="AssertionError"}}function pE(e,n="Assertion failed."){if(!e)throw new mE(n)}const lb=32*1024,lh=2**32-2;function Wo(e,n,r=0){const a=n.byteLength-r;return e.byteLength>a&&(e=e.subarray(0,a)),n.set(e,r),e.byteLength}class oh{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){pE(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=Wo(this._buf.subarray(this._off),n);return this._off+=r,r}writeByte(n){return this.write(Uint8Array.of(n))}writeString(n){return this.write(aa.encode(n))}write(n){const r=this._grow(n.byteLength);return Wo(n,this._buf,r)}_grow(n){const r=this.length;r===0&&this._off!==0&&this.reset();const a=this._tryGrowByReslice(n);if(a>=0)return a;const l=this.capacity;if(n<=Math.floor(l/2)-r)Wo(this._buf.subarray(this._off),this._buf);else{if(l+n>lh)throw new Error("The buffer cannot be grown beyond the maximum size.");{const u=new Uint8Array(Math.min(2*l+n,lh));Wo(this._buf.subarray(this._off),u),this._buf=u}}return this._off=0,this._reslice(Math.min(r+n,lh)),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 a=new Uint8Array(lb);for(;;){const l=this.capacity-this.length<lb,u=l?a: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 un;(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"})(un||(un={}));function ob(){const e={};return e.sid=-1,e.hdr=-1,e.size=-1,e}const gE=48;class ub{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=Ae.OP_START,this.as=0,this.drop=0,this.hdr=0}parse(n){let r;for(r=0;r<n.length;r++){const a=n[r];switch(this.state){case Ae.OP_START:switch(a){case Te.M:case Te.m:this.state=Ae.OP_M,this.hdr=-1,this.ma=ob();break;case Te.H:case Te.h:this.state=Ae.OP_H,this.hdr=0,this.ma=ob();break;case Te.P:case Te.p:this.state=Ae.OP_P;break;case Te.PLUS:this.state=Ae.OP_PLUS;break;case Te.MINUS:this.state=Ae.OP_MINUS;break;case Te.I:case Te.i:this.state=Ae.OP_I;break;default:throw this.fail(n.subarray(r))}break;case Ae.OP_H:switch(a){case Te.M:case Te.m:this.state=Ae.OP_M;break;default:throw this.fail(n.subarray(r))}break;case Ae.OP_M:switch(a){case Te.S:case Te.s:this.state=Ae.OP_MS;break;default:throw this.fail(n.subarray(r))}break;case Ae.OP_MS:switch(a){case Te.G:case Te.g:this.state=Ae.OP_MSG;break;default:throw this.fail(n.subarray(r))}break;case Ae.OP_MSG:switch(a){case Te.SPACE:case Te.TAB:this.state=Ae.OP_MSG_SPC;break;default:throw this.fail(n.subarray(r))}break;case Ae.OP_MSG_SPC:switch(a){case Te.SPACE:case Te.TAB:continue;default:this.state=Ae.MSG_ARG,this.as=r}break;case Ae.MSG_ARG:switch(a){case Te.CR:this.drop=1;break;case Te.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=Ae.MSG_PAYLOAD,r=this.as+this.ma.size-1;break}default:this.argBuf&&this.argBuf.writeByte(a)}break;case Ae.MSG_PAYLOAD:if(this.msgBuf)if(this.msgBuf.length>=this.ma.size){const l=this.msgBuf.bytes({copy:!1});this.dispatcher.push({kind:un.MSG,msg:this.ma,data:l}),this.argBuf=void 0,this.msgBuf=void 0,this.state=Ae.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(a)}else r-this.as>=this.ma.size&&(this.dispatcher.push({kind:un.MSG,msg:this.ma,data:n.subarray(this.as,r)}),this.argBuf=void 0,this.msgBuf=void 0,this.state=Ae.MSG_END);break;case Ae.MSG_END:switch(a){case Te.NL:this.drop=0,this.as=r+1,this.state=Ae.OP_START;break;default:continue}break;case Ae.OP_PLUS:switch(a){case Te.O:case Te.o:this.state=Ae.OP_PLUS_O;break;default:throw this.fail(n.subarray(r))}break;case Ae.OP_PLUS_O:switch(a){case Te.K:case Te.k:this.state=Ae.OP_PLUS_OK;break;default:throw this.fail(n.subarray(r))}break;case Ae.OP_PLUS_OK:switch(a){case Te.NL:this.dispatcher.push({kind:un.OK}),this.drop=0,this.state=Ae.OP_START;break}break;case Ae.OP_MINUS:switch(a){case Te.E:case Te.e:this.state=Ae.OP_MINUS_E;break;default:throw this.fail(n.subarray(r))}break;case Ae.OP_MINUS_E:switch(a){case Te.R:case Te.r:this.state=Ae.OP_MINUS_ER;break;default:throw this.fail(n.subarray(r))}break;case Ae.OP_MINUS_ER:switch(a){case Te.R:case Te.r:this.state=Ae.OP_MINUS_ERR;break;default:throw this.fail(n.subarray(r))}break;case Ae.OP_MINUS_ERR:switch(a){case Te.SPACE:case Te.TAB:this.state=Ae.OP_MINUS_ERR_SPC;break;default:throw this.fail(n.subarray(r))}break;case Ae.OP_MINUS_ERR_SPC:switch(a){case Te.SPACE:case Te.TAB:continue;default:this.state=Ae.MINUS_ERR_ARG,this.as=r}break;case Ae.MINUS_ERR_ARG:switch(a){case Te.CR:this.drop=1;break;case Te.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:un.ERR,data:l}),this.drop=0,this.as=r+1,this.state=Ae.OP_START;break}default:this.argBuf&&this.argBuf.write(Uint8Array.of(a))}break;case Ae.OP_P:switch(a){case Te.I:case Te.i:this.state=Ae.OP_PI;break;case Te.O:case Te.o:this.state=Ae.OP_PO;break;default:throw this.fail(n.subarray(r))}break;case Ae.OP_PO:switch(a){case Te.N:case Te.n:this.state=Ae.OP_PON;break;default:throw this.fail(n.subarray(r))}break;case Ae.OP_PON:switch(a){case Te.G:case Te.g:this.state=Ae.OP_PONG;break;default:throw this.fail(n.subarray(r))}break;case Ae.OP_PONG:switch(a){case Te.NL:this.dispatcher.push({kind:un.PONG}),this.drop=0,this.state=Ae.OP_START;break}break;case Ae.OP_PI:switch(a){case Te.N:case Te.n:this.state=Ae.OP_PIN;break;default:throw this.fail(n.subarray(r))}break;case Ae.OP_PIN:switch(a){case Te.G:case Te.g:this.state=Ae.OP_PING;break;default:throw this.fail(n.subarray(r))}break;case Ae.OP_PING:switch(a){case Te.NL:this.dispatcher.push({kind:un.PING}),this.drop=0,this.state=Ae.OP_START;break}break;case Ae.OP_I:switch(a){case Te.N:case Te.n:this.state=Ae.OP_IN;break;default:throw this.fail(n.subarray(r))}break;case Ae.OP_IN:switch(a){case Te.F:case Te.f:this.state=Ae.OP_INF;break;default:throw this.fail(n.subarray(r))}break;case Ae.OP_INF:switch(a){case Te.O:case Te.o:this.state=Ae.OP_INFO;break;default:throw this.fail(n.subarray(r))}break;case Ae.OP_INFO:switch(a){case Te.SPACE:case Te.TAB:this.state=Ae.OP_INFO_SPC;break;default:throw this.fail(n.subarray(r))}break;case Ae.OP_INFO_SPC:switch(a){case Te.SPACE:case Te.TAB:continue;default:this.state=Ae.INFO_ARG,this.as=r}break;case Ae.INFO_ARG:switch(a){case Te.CR:this.drop=1;break;case Te.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:un.INFO,data:l}),this.drop=0,this.as=r+1,this.state=Ae.OP_START;break}default:this.argBuf&&this.argBuf.writeByte(a)}break;default:throw this.fail(n.subarray(r))}}(this.state===Ae.MSG_ARG||this.state===Ae.MINUS_ERR_ARG||this.state===Ae.INFO_ARG)&&!this.argBuf&&(this.argBuf=new oh(n.subarray(this.as,r-this.drop))),this.state===Ae.MSG_PAYLOAD&&!this.msgBuf&&(this.argBuf||this.cloneMsgArg(),this.msgBuf=new oh(n.subarray(this.as)))}cloneMsgArg(){const n=this.ma.subject.length,r=this.ma.reply?this.ma.reply.length:0,a=new Uint8Array(n+r);a.set(this.ma.subject),this.ma.reply&&a.set(this.ma.reply,n),this.argBuf=new oh(a),this.ma.subject=a.subarray(0,n),this.ma.reply&&(this.ma.reply=a.subarray(n))}processMsgArgs(n){if(this.hdr>=0)return this.processHeaderMsgArgs(n);const r=[];let a=-1;for(let l=0;l<n.length;l++)switch(n[l]){case Te.SPACE:case Te.TAB:case Te.CR:case Te.NL:a>=0&&(r.push(n.subarray(a,l)),a=-1);break;default:a<0&&(a=l)}switch(a>=0&&r.push(n.subarray(a)),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}: ${Mn.decode(n)}`)}processHeaderMsgArgs(n){const r=[];let a=-1;for(let l=0;l<n.length;l++)switch(n[l]){case Te.SPACE:case Te.TAB:case Te.CR:case Te.NL:a>=0&&(r.push(n.subarray(a,l)),a=-1);break;default:a<0&&(a=l)}switch(a>=0&&r.push(n.subarray(a)),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 a=0;a<n.length;a++){if(n[a]<48||n[a]>57)return-1;r=r*10+(n[a]-gE)}return r}}var Ae;(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"})(Ae||(Ae={}));var Te;(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"})(Te||(Te={}));(function(e){var n=function(E,T){this.hi=E|0,this.lo=T|0},r=function(E){var T,A=new Float64Array(16);if(E)for(T=0;T<E.length;T++)A[T]=E[T];return A},a=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]),b=r([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),x=r([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function k(E,T){return E<<T|E>>>32-T}function z(E,T){var A=E[T+3]&255;return A=A<<8|E[T+2]&255,A=A<<8|E[T+1]&255,A<<8|E[T+0]&255}function B(E,T){var A=E[T]<<24|E[T+1]<<16|E[T+2]<<8|E[T+3],D=E[T+4]<<24|E[T+5]<<16|E[T+6]<<8|E[T+7];return new n(A,D)}function M(E,T,A){var D;for(D=0;D<4;D++)E[T+D]=A&255,A>>>=8}function F(E,T,A){E[T]=A.hi>>24&255,E[T+1]=A.hi>>16&255,E[T+2]=A.hi>>8&255,E[T+3]=A.hi&255,E[T+4]=A.lo>>24&255,E[T+5]=A.lo>>16&255,E[T+6]=A.lo>>8&255,E[T+7]=A.lo&255}function G(E,T,A,D,I){var K,de=0;for(K=0;K<I;K++)de|=E[T+K]^A[D+K];return(1&de-1>>>8)-1}function se(E,T,A,D){return G(E,T,A,D,16)}function O(E,T,A,D){return G(E,T,A,D,32)}function j(E,T,A,D,I){var K=new Uint32Array(16),de=new Uint32Array(16),be=new Uint32Array(16),ie=new Uint32Array(4),ce,Oe,Ke;for(ce=0;ce<4;ce++)de[5*ce]=z(D,4*ce),de[1+ce]=z(A,4*ce),de[6+ce]=z(T,4*ce),de[11+ce]=z(A,16+4*ce);for(ce=0;ce<16;ce++)be[ce]=de[ce];for(ce=0;ce<20;ce++){for(Oe=0;Oe<4;Oe++){for(Ke=0;Ke<4;Ke++)ie[Ke]=de[(5*Oe+4*Ke)%16];for(ie[1]^=k(ie[0]+ie[3]|0,7),ie[2]^=k(ie[1]+ie[0]|0,9),ie[3]^=k(ie[2]+ie[1]|0,13),ie[0]^=k(ie[3]+ie[2]|0,18),Ke=0;Ke<4;Ke++)K[4*Oe+(Oe+Ke)%4]=ie[Ke]}for(Ke=0;Ke<16;Ke++)de[Ke]=K[Ke]}if(I){for(ce=0;ce<16;ce++)de[ce]=de[ce]+be[ce]|0;for(ce=0;ce<4;ce++)de[5*ce]=de[5*ce]-z(D,4*ce)|0,de[6+ce]=de[6+ce]-z(T,4*ce)|0;for(ce=0;ce<4;ce++)M(E,4*ce,de[5*ce]),M(E,16+4*ce,de[6+ce])}else for(ce=0;ce<16;ce++)M(E,4*ce,de[ce]+be[ce]|0)}function V(E,T,A,D){return j(E,T,A,D,!1),0}function J(E,T,A,D){return j(E,T,A,D,!0),0}var Y=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function N(E,T,A,D,I,K,de){var be=new Uint8Array(16),ie=new Uint8Array(64),ce,Oe;if(!I)return 0;for(Oe=0;Oe<16;Oe++)be[Oe]=0;for(Oe=0;Oe<8;Oe++)be[Oe]=K[Oe];for(;I>=64;){for(V(ie,be,de,Y),Oe=0;Oe<64;Oe++)E[T+Oe]=(A?A[D+Oe]:0)^ie[Oe];for(ce=1,Oe=8;Oe<16;Oe++)ce=ce+(be[Oe]&255)|0,be[Oe]=ce&255,ce>>>=8;I-=64,T+=64,A&&(D+=64)}if(I>0)for(V(ie,be,de,Y),Oe=0;Oe<I;Oe++)E[T+Oe]=(A?A[D+Oe]:0)^ie[Oe];return 0}function Q(E,T,A,D,I){return N(E,T,null,0,A,D,I)}function Z(E,T,A,D,I){var K=new Uint8Array(32);return J(K,D,I,Y),Q(E,T,A,D.subarray(16),K)}function ge(E,T,A,D,I,K,de){var be=new Uint8Array(32);return J(be,K,de,Y),N(E,T,A,D,I,K.subarray(16),be)}function fe(E,T){var A,D=0;for(A=0;A<17;A++)D=D+(E[A]+T[A]|0)|0,E[A]=D&255,D>>>=8}var H=new Uint32Array([5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,252]);function q(E,T,A,D,I,K){var de,be,ie,ce,Oe=new Uint32Array(17),Ke=new Uint32Array(17),kt=new Uint32Array(17),tn=new Uint32Array(17),nr=new Uint32Array(17);for(ie=0;ie<17;ie++)Ke[ie]=kt[ie]=0;for(ie=0;ie<16;ie++)Ke[ie]=K[ie];for(Ke[3]&=15,Ke[4]&=252,Ke[7]&=15,Ke[8]&=252,Ke[11]&=15,Ke[12]&=252,Ke[15]&=15;I>0;){for(ie=0;ie<17;ie++)tn[ie]=0;for(ie=0;ie<16&&ie<I;++ie)tn[ie]=A[D+ie];for(tn[ie]=1,D+=ie,I-=ie,fe(kt,tn),be=0;be<17;be++)for(Oe[be]=0,ie=0;ie<17;ie++)Oe[be]=Oe[be]+kt[ie]*(ie<=be?Ke[be-ie]:320*Ke[be+17-ie]|0)|0|0;for(be=0;be<17;be++)kt[be]=Oe[be];for(ce=0,ie=0;ie<16;ie++)ce=ce+kt[ie]|0,kt[ie]=ce&255,ce>>>=8;for(ce=ce+kt[16]|0,kt[16]=ce&3,ce=5*(ce>>>2)|0,ie=0;ie<16;ie++)ce=ce+kt[ie]|0,kt[ie]=ce&255,ce>>>=8;ce=ce+kt[16]|0,kt[16]=ce}for(ie=0;ie<17;ie++)nr[ie]=kt[ie];for(fe(kt,H),de=-(kt[16]>>>7)|0,ie=0;ie<17;ie++)kt[ie]^=de&(nr[ie]^kt[ie]);for(ie=0;ie<16;ie++)tn[ie]=K[ie+16];for(tn[16]=0,fe(kt,tn),ie=0;ie<16;ie++)E[T+ie]=kt[ie];return 0}function re(E,T,A,D,I,K){var de=new Uint8Array(16);return q(de,0,A,D,I,K),se(E,T,de,0)}function ye(E,T,A,D,I){var K;if(A<32)return-1;for(ge(E,0,T,0,A,D,I),q(E,16,E,32,A-32,E),K=0;K<16;K++)E[K]=0;return 0}function _e(E,T,A,D,I){var K,de=new Uint8Array(32);if(A<32||(Z(de,0,32,D,I),re(T,16,T,32,A-32,de)!==0))return-1;for(ge(E,0,T,0,A,D,I),K=0;K<32;K++)E[K]=0;return 0}function R(E,T){var A;for(A=0;A<16;A++)E[A]=T[A]|0}function U(E){var T,A;for(A=0;A<16;A++)E[A]+=65536,T=Math.floor(E[A]/65536),E[(A+1)*(A<15?1:0)]+=T-1+37*(T-1)*(A===15?1:0),E[A]-=T*65536}function W(E,T,A){for(var D,I=~(A-1),K=0;K<16;K++)D=I&(E[K]^T[K]),E[K]^=D,T[K]^=D}function _(E,T){var A,D,I,K=r(),de=r();for(A=0;A<16;A++)de[A]=T[A];for(U(de),U(de),U(de),D=0;D<2;D++){for(K[0]=de[0]-65517,A=1;A<15;A++)K[A]=de[A]-65535-(K[A-1]>>16&1),K[A-1]&=65535;K[15]=de[15]-32767-(K[14]>>16&1),I=K[15]>>16&1,K[14]&=65535,W(de,K,1-I)}for(A=0;A<16;A++)E[2*A]=de[A]&255,E[2*A+1]=de[A]>>8}function he(E,T){var A=new Uint8Array(32),D=new Uint8Array(32);return _(A,E),_(D,T),O(A,0,D,0)}function pe(E){var T=new Uint8Array(32);return _(T,E),T[0]&1}function ve(E,T){var A;for(A=0;A<16;A++)E[A]=T[2*A]+(T[2*A+1]<<8);E[15]&=32767}function je(E,T,A){var D;for(D=0;D<16;D++)E[D]=T[D]+A[D]|0}function De(E,T,A){var D;for(D=0;D<16;D++)E[D]=T[D]-A[D]|0}function ke(E,T,A){var D,I,K=new Float64Array(31);for(D=0;D<31;D++)K[D]=0;for(D=0;D<16;D++)for(I=0;I<16;I++)K[D+I]+=T[D]*A[I];for(D=0;D<15;D++)K[D]+=38*K[D+16];for(D=0;D<16;D++)E[D]=K[D];U(E),U(E)}function ze(E,T){ke(E,T,T)}function $e(E,T){var A=r(),D;for(D=0;D<16;D++)A[D]=T[D];for(D=253;D>=0;D--)ze(A,A),D!==2&&D!==4&&ke(A,A,T);for(D=0;D<16;D++)E[D]=A[D]}function Ie(E,T){var A=r(),D;for(D=0;D<16;D++)A[D]=T[D];for(D=250;D>=0;D--)ze(A,A),D!==1&&ke(A,A,T);for(D=0;D<16;D++)E[D]=A[D]}function qe(E,T,A){var D=new Uint8Array(32),I=new Float64Array(80),K,de,be=r(),ie=r(),ce=r(),Oe=r(),Ke=r(),kt=r();for(de=0;de<31;de++)D[de]=T[de];for(D[31]=T[31]&127|64,D[0]&=248,ve(I,A),de=0;de<16;de++)ie[de]=I[de],Oe[de]=be[de]=ce[de]=0;for(be[0]=Oe[0]=1,de=254;de>=0;--de)K=D[de>>>3]>>>(de&7)&1,W(be,ie,K),W(ce,Oe,K),je(Ke,be,ce),De(be,be,ce),je(ce,ie,Oe),De(ie,ie,Oe),ze(Oe,Ke),ze(kt,be),ke(be,ce,be),ke(ce,ie,Ke),je(Ke,be,ce),De(be,be,ce),ze(ie,be),De(ce,Oe,kt),ke(be,ce,m),je(be,be,Oe),ke(ce,ce,be),ke(be,Oe,kt),ke(Oe,ie,I),ze(ie,Ke),W(be,ie,K),W(ce,Oe,K);for(de=0;de<16;de++)I[de+16]=be[de],I[de+32]=ce[de],I[de+48]=ie[de],I[de+64]=Oe[de];var tn=I.subarray(32),nr=I.subarray(16);return $e(tn,tn),ke(nr,nr,tn),_(E,nr),0}function rt(E,T){return qe(E,T,u)}function xe(E,T){return a(T,32),rt(E,T)}function Le(E,T,A){var D=new Uint8Array(32);return qe(D,A,T),J(E,l,D,Y)}var Fe=ye,Tt=_e;function hn(E,T,A,D,I,K){var de=new Uint8Array(32);return Le(de,I,K),Fe(E,T,A,D,de)}function Wn(E,T,A,D,I,K){var de=new Uint8Array(32);return Le(de,I,K),Tt(E,T,A,D,de)}function en(){var E=0,T=0,A=0,D=0,I=65535,K,de,be;for(be=0;be<arguments.length;be++)K=arguments[be].lo,de=arguments[be].hi,E+=K&I,T+=K>>>16,A+=de&I,D+=de>>>16;return T+=E>>>16,A+=T>>>16,D+=A>>>16,new n(A&I|D<<16,E&I|T<<16)}function wn(E,T){return new n(E.hi>>>T,E.lo>>>T|E.hi<<32-T)}function fr(){var E=0,T=0,A;for(A=0;A<arguments.length;A++)E^=arguments[A].lo,T^=arguments[A].hi;return new n(T,E)}function yt(E,T){var A,D,I=32-T;return T<32?(A=E.hi>>>T|E.lo<<I,D=E.lo>>>T|E.hi<<I):T<64&&(A=E.lo>>>T|E.hi<<I,D=E.hi>>>T|E.lo<<I),new n(A,D)}function Mi(E,T,A){var D=E.hi&T.hi^~E.hi&A.hi,I=E.lo&T.lo^~E.lo&A.lo;return new n(D,I)}function oe(E,T,A){var D=E.hi&T.hi^E.hi&A.hi^T.hi&A.hi,I=E.lo&T.lo^E.lo&A.lo^T.lo&A.lo;return new n(D,I)}function Se(E){return fr(yt(E,28),yt(E,34),yt(E,39))}function Be(E){return fr(yt(E,14),yt(E,18),yt(E,41))}function Ye(E){return fr(yt(E,1),yt(E,8),wn(E,7))}function it(E){return fr(yt(E,19),yt(E,61),wn(E,6))}var Ce=[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 Ve(E,T,A){var D=[],I=[],K=[],de=[],be,ie,ce;for(ie=0;ie<8;ie++)D[ie]=K[ie]=B(E,8*ie);for(var Oe=0;A>=128;){for(ie=0;ie<16;ie++)de[ie]=B(T,8*ie+Oe);for(ie=0;ie<80;ie++){for(ce=0;ce<8;ce++)I[ce]=K[ce];for(be=en(K[7],Be(K[4]),Mi(K[4],K[5],K[6]),Ce[ie],de[ie%16]),I[7]=en(be,Se(K[0]),oe(K[0],K[1],K[2])),I[3]=en(I[3],be),ce=0;ce<8;ce++)K[(ce+1)%8]=I[ce];if(ie%16===15)for(ce=0;ce<16;ce++)de[ce]=en(de[ce],de[(ce+9)%16],Ye(de[(ce+1)%16]),it(de[(ce+14)%16]))}for(ie=0;ie<8;ie++)K[ie]=en(K[ie],D[ie]),D[ie]=K[ie];Oe+=128,A-=128}for(ie=0;ie<8;ie++)F(E,8*ie,D[ie]);return A}var st=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 ot(E,T,A){var D=new Uint8Array(64),I=new Uint8Array(256),K,de=A;for(K=0;K<64;K++)D[K]=st[K];for(Ve(D,T,A),A%=128,K=0;K<256;K++)I[K]=0;for(K=0;K<A;K++)I[K]=T[de-A+K];for(I[A]=128,A=256-128*(A<112?1:0),I[A-9]=0,F(I,A-8,new n(de/536870912|0,de<<3)),Ve(D,I,A),K=0;K<64;K++)E[K]=D[K];return 0}function ct(E,T){var A=r(),D=r(),I=r(),K=r(),de=r(),be=r(),ie=r(),ce=r(),Oe=r();De(A,E[1],E[0]),De(Oe,T[1],T[0]),ke(A,A,Oe),je(D,E[0],E[1]),je(Oe,T[0],T[1]),ke(D,D,Oe),ke(I,E[3],T[3]),ke(I,I,y),ke(K,E[2],T[2]),je(K,K,K),De(de,D,A),De(be,K,I),je(ie,K,I),je(ce,D,A),ke(E[0],de,be),ke(E[1],ce,ie),ke(E[2],ie,be),ke(E[3],de,ce)}function mt(E,T,A){var D;for(D=0;D<4;D++)W(E[D],T[D],A)}function Bn(E,T){var A=r(),D=r(),I=r();$e(I,T[2]),ke(A,T[0],I),ke(D,T[1],I),_(E,D),E[31]^=pe(A)<<7}function sn(E,T,A){var D,I;for(R(E[0],c),R(E[1],f),R(E[2],f),R(E[3],c),I=255;I>=0;--I)D=A[I/8|0]>>(I&7)&1,mt(E,T,D),ct(T,E),ct(E,E),mt(E,T,D)}function la(E,T){var A=[r(),r(),r(),r()];R(A[0],g),R(A[1],b),R(A[2],f),ke(A[3],g,b),sn(E,A,T)}function Qr(E,T,A){var D=new Uint8Array(64),I=[r(),r(),r(),r()],K;for(A||a(T,32),ot(D,T,32),D[0]&=248,D[31]&=127,D[31]|=64,la(I,D),Bn(E,I),K=0;K<32;K++)T[K+32]=E[K];return 0}var kr=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 Kr(E,T){var A,D,I,K;for(D=63;D>=32;--D){for(A=0,I=D-32,K=D-12;I<K;++I)T[I]+=A-16*T[D]*kr[I-(D-32)],A=Math.floor((T[I]+128)/256),T[I]-=A*256;T[I]+=A,T[D]=0}for(A=0,I=0;I<32;I++)T[I]+=A-(T[31]>>4)*kr[I],A=T[I]>>8,T[I]&=255;for(I=0;I<32;I++)T[I]-=A*kr[I];for(D=0;D<32;D++)T[D+1]+=T[D]>>8,E[D]=T[D]&255}function er(E){var T=new Float64Array(64),A;for(A=0;A<64;A++)T[A]=E[A];for(A=0;A<64;A++)E[A]=0;Kr(E,T)}function Di(E,T,A,D){var I=new Uint8Array(64),K=new Uint8Array(64),de=new Uint8Array(64),be,ie,ce=new Float64Array(64),Oe=[r(),r(),r(),r()];ot(I,D,32),I[0]&=248,I[31]&=127,I[31]|=64;var Ke=A+64;for(be=0;be<A;be++)E[64+be]=T[be];for(be=0;be<32;be++)E[32+be]=I[32+be];for(ot(de,E.subarray(32),A+32),er(de),la(Oe,de),Bn(E,Oe),be=32;be<64;be++)E[be]=D[be];for(ot(K,E,A+64),er(K),be=0;be<64;be++)ce[be]=0;for(be=0;be<32;be++)ce[be]=de[be];for(be=0;be<32;be++)for(ie=0;ie<32;ie++)ce[be+ie]+=K[be]*I[ie];return Kr(E.subarray(32),ce),Ke}function zi(E,T){var A=r(),D=r(),I=r(),K=r(),de=r(),be=r(),ie=r();return R(E[2],f),ve(E[1],T),ze(I,E[1]),ke(K,I,d),De(I,I,E[2]),je(K,E[2],K),ze(de,K),ze(be,de),ke(ie,be,de),ke(A,ie,I),ke(A,A,K),Ie(A,A),ke(A,A,I),ke(A,A,K),ke(A,A,K),ke(E[0],A,K),ze(D,E[0]),ke(D,D,K),he(D,I)&&ke(E[0],E[0],x),ze(D,E[0]),ke(D,D,K),he(D,I)?-1:(pe(E[0])===T[31]>>7&&De(E[0],c,E[0]),ke(E[3],E[0],E[1]),0)}function hs(E,T,A,D){var I,K=new Uint8Array(32),de=new Uint8Array(64),be=[r(),r(),r(),r()],ie=[r(),r(),r(),r()];if(A<64||zi(ie,D))return-1;for(I=0;I<A;I++)E[I]=T[I];for(I=0;I<32;I++)E[I+32]=D[I];if(ot(de,E,A),er(de),sn(be,ie,de),la(ie,T.subarray(32)),ct(be,ie),Bn(K,be),A-=64,O(T,0,K,0)){for(I=0;I<A;I++)E[I]=0;return-1}for(I=0;I<A;I++)E[I]=T[I+64];return A}var oa=32,Zr=24,tr=32,Wr=16,ei=32,Li=32,ti=32,Cr=32,Ui=32,ds=Zr,Ul=tr,hr=Wr,wt=64,Mt=32,Sn=64,Bi=32,ms=64;e.lowlevel={crypto_core_hsalsa20:J,crypto_stream_xor:ge,crypto_stream:Z,crypto_stream_salsa20_xor:N,crypto_stream_salsa20:Q,crypto_onetimeauth:q,crypto_onetimeauth_verify:re,crypto_verify_16:se,crypto_verify_32:O,crypto_secretbox:ye,crypto_secretbox_open:_e,crypto_scalarmult:qe,crypto_scalarmult_base:rt,crypto_box_beforenm:Le,crypto_box_afternm:Fe,crypto_box:hn,crypto_box_open:Wn,crypto_box_keypair:xe,crypto_hash:ot,crypto_sign:Di,crypto_sign_keypair:Qr,crypto_sign_open:hs,crypto_secretbox_KEYBYTES:oa,crypto_secretbox_NONCEBYTES:Zr,crypto_secretbox_ZEROBYTES:tr,crypto_secretbox_BOXZEROBYTES:Wr,crypto_scalarmult_BYTES:ei,crypto_scalarmult_SCALARBYTES:Li,crypto_box_PUBLICKEYBYTES:ti,crypto_box_SECRETKEYBYTES:Cr,crypto_box_BEFORENMBYTES:Ui,crypto_box_NONCEBYTES:ds,crypto_box_ZEROBYTES:Ul,crypto_box_BOXZEROBYTES:hr,crypto_sign_BYTES:wt,crypto_sign_PUBLICKEYBYTES:Mt,crypto_sign_SECRETKEYBYTES:Sn,crypto_sign_SEEDBYTES:Bi,crypto_hash_BYTES:ms,gf:r,D:d,L:kr,pack25519:_,unpack25519:ve,M:ke,A:je,S:ze,Z:De,pow2523:Ie,add:ct,set25519:R,modL:Kr,scalarmult:sn,scalarbase:la};function Bl(E,T){if(E.length!==oa)throw new Error("bad key size");if(T.length!==Zr)throw new Error("bad nonce size")}function Pl(E,T){if(E.length!==ti)throw new Error("bad public key size");if(T.length!==Cr)throw new Error("bad secret key size")}function $t(){for(var E=0;E<arguments.length;E++)if(!(arguments[E]instanceof Uint8Array))throw new TypeError("unexpected type, use Uint8Array")}function ua(E){for(var T=0;T<E.length;T++)E[T]=0}e.randomBytes=function(E){var T=new Uint8Array(E);return a(T,E),T},e.secretbox=function(E,T,A){$t(E,T,A),Bl(A,T);for(var D=new Uint8Array(tr+E.length),I=new Uint8Array(D.length),K=0;K<E.length;K++)D[K+tr]=E[K];return ye(I,D,D.length,T,A),I.subarray(Wr)},e.secretbox.open=function(E,T,A){$t(E,T,A),Bl(A,T);for(var D=new Uint8Array(Wr+E.length),I=new Uint8Array(D.length),K=0;K<E.length;K++)D[K+Wr]=E[K];return D.length<32||_e(I,D,D.length,T,A)!==0?null:I.subarray(tr)},e.secretbox.keyLength=oa,e.secretbox.nonceLength=Zr,e.secretbox.overheadLength=Wr,e.scalarMult=function(E,T){if($t(E,T),E.length!==Li)throw new Error("bad n size");if(T.length!==ei)throw new Error("bad p size");var A=new Uint8Array(ei);return qe(A,E,T),A},e.scalarMult.base=function(E){if($t(E),E.length!==Li)throw new Error("bad n size");var T=new Uint8Array(ei);return rt(T,E),T},e.scalarMult.scalarLength=Li,e.scalarMult.groupElementLength=ei,e.box=function(E,T,A,D){var I=e.box.before(A,D);return e.secretbox(E,T,I)},e.box.before=function(E,T){$t(E,T),Pl(E,T);var A=new Uint8Array(Ui);return Le(A,E,T),A},e.box.after=e.secretbox,e.box.open=function(E,T,A,D){var I=e.box.before(A,D);return e.secretbox.open(E,T,I)},e.box.open.after=e.secretbox.open,e.box.keyPair=function(){var E=new Uint8Array(ti),T=new Uint8Array(Cr);return xe(E,T),{publicKey:E,secretKey:T}},e.box.keyPair.fromSecretKey=function(E){if($t(E),E.length!==Cr)throw new Error("bad secret key size");var T=new Uint8Array(ti);return rt(T,E),{publicKey:T,secretKey:new Uint8Array(E)}},e.box.publicKeyLength=ti,e.box.secretKeyLength=Cr,e.box.sharedKeyLength=Ui,e.box.nonceLength=ds,e.box.overheadLength=e.secretbox.overheadLength,e.sign=function(E,T){if($t(E,T),T.length!==Sn)throw new Error("bad secret key size");var A=new Uint8Array(wt+E.length);return Di(A,E,E.length,T),A},e.sign.open=function(E,T){if($t(E,T),T.length!==Mt)throw new Error("bad public key size");var A=new Uint8Array(E.length),D=hs(A,E,E.length,T);if(D<0)return null;for(var I=new Uint8Array(D),K=0;K<I.length;K++)I[K]=A[K];return I},e.sign.detached=function(E,T){for(var A=e.sign(E,T),D=new Uint8Array(wt),I=0;I<D.length;I++)D[I]=A[I];return D},e.sign.detached.verify=function(E,T,A){if($t(E,T,A),T.length!==wt)throw new Error("bad signature size");if(A.length!==Mt)throw new Error("bad public key size");var D=new Uint8Array(wt+E.length),I=new Uint8Array(wt+E.length),K;for(K=0;K<wt;K++)D[K]=T[K];for(K=0;K<E.length;K++)D[K+wt]=E[K];return hs(I,D,D.length,A)>=0},e.sign.keyPair=function(){var E=new Uint8Array(Mt),T=new Uint8Array(Sn);return Qr(E,T),{publicKey:E,secretKey:T}},e.sign.keyPair.fromSecretKey=function(E){if($t(E),E.length!==Sn)throw new Error("bad secret key size");for(var T=new Uint8Array(Mt),A=0;A<T.length;A++)T[A]=E[32+A];return{publicKey:T,secretKey:new Uint8Array(E)}},e.sign.keyPair.fromSeed=function(E){if($t(E),E.length!==Bi)throw new Error("bad seed size");for(var T=new Uint8Array(Mt),A=new Uint8Array(Sn),D=0;D<32;D++)A[D]=E[D];return Qr(T,A,!0),{publicKey:T,secretKey:A}},e.sign.publicKeyLength=Mt,e.sign.secretKeyLength=Sn,e.sign.seedLength=Bi,e.sign.signatureLength=wt,e.hash=function(E){$t(E);var T=new Uint8Array(ms);return ot(T,E,E.length),T},e.hash.hashLength=ms,e.verify=function(E,T){return $t(E,T),E.length===0||T.length===0||E.length!==T.length?!1:G(E,0,T,0,E.length)===0},e.setPRNG=function(E){a=E},(function(){var E=typeof globalThis<"u"?globalThis.crypto||globalThis.msCrypto:null;if(E&&E.getRandomValues){var T=65536;e.setPRNG(function(A,D){var I,K=new Uint8Array(D);for(I=0;I<D;I+=T)E.getRandomValues(K.subarray(I,I+Math.min(D-I,T)));for(I=0;I<D;I++)A[I]=K[I];ua(K)})}else typeof require<"u"&&(E=require("crypto"),E&&E.randomBytes&&e.setPRNG(function(A,D){var I,K=E.randomBytes(D);for(I=0;I<D;I++)A[I]=K[I];ua(K)}))})()})(typeof module<"u"&&module.exports?module.exports:globalThis.nacl=globalThis.nacl||{});const eu=typeof module<"u"&&module.exports?module.exports:globalThis.nacl;eu.sign.keyPair.fromSeed,eu.sign.detached,eu.sign.detached.verify,eu.randomBytes;var cb;(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"})(cb||(cb={}));var fb;(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"})(fb||(fb={}));function yE(e){return n=>{let r={};return e.forEach(a=>{const l=a(n)||{};r=Object.assign(r,l)}),r}}function bE(){return()=>{}}function vE(e,n){return()=>{const r=typeof e=="function"?e():e,a=typeof n=="function"?n():n;return{user:r,pass:a}}}function xE(e){return()=>({auth_token:typeof e=="function"?e():e})}const Z0=120*1e3,wE=2,W0=2*1e3;function SE(){return{maxPingOut:2,maxReconnectAttempts:10,noRandomize:!1,pedantic:!1,pingInterval:Z0,reconnect:!0,reconnectJitter:100,reconnectJitterTLS:1e3,reconnectTimeWait:W0,tls:void 0,verbose:!1,waitOnFirstConnect:!1,ignoreAuthErrorAbort:!1}}function _E(e){const n=[];return typeof e.authenticator=="function"&&n.push(e.authenticator),Array.isArray(e.authenticator)&&n.push(...e.authenticator),e.token&&n.push(xE(e.token)),e.user&&n.push(vE(e.user,e.pass)),n.length===0?bE():yE(n)}function EE(e){const n=`${Bh}:${X0()}`;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",Ee.InvalidOption);e.servers.length===0&&e.port&&(e.servers=[`${Bh}:${e.port}`]),e.servers&&e.servers.length===0&&(e.servers=[n]);const r=Ou(SE(),e);if(r.authenticator=_E(r),["reconnectDelayHandler","authenticator"].forEach(a=>{if(r[a]&&typeof r[a]!="function")throw new Ne(`${a} option should be a function`,Ee.NotFunction)}),r.reconnectDelayHandler||(r.reconnectDelayHandler=()=>{let a=r.tls?r.reconnectJitterTLS:r.reconnectJitter;return a&&(a++,a=Math.floor(Math.random()*a)),r.reconnectTimeWait+a}),r.inboxPrefix)try{Yr(r.inboxPrefix)}catch(a){throw new Ne(a.message,Ee.ApiError)}if(r.resolve===void 0&&(r.resolve=typeof Gh()=="function"),r.resolve&&typeof Gh()!="function")throw new Ne("'resolve' is not supported on this client",Ee.InvalidOption);return r}function kE(e,n){const{proto:r,tls_required:a,tls_available:l}=e;if((r===void 0||r<1)&&n.noEcho)throw new Ne("noEcho",Ee.ServerOptionNotAvailable);const u=a||l||!1;if(n.tls&&!u)throw new Ne("tls",Ee.ServerOptionNotAvailable)}const CE=1024*32,AE=/^INFO\s+([^\r\n]+)\r\n/i,TE=ml(`PONG\r
|
|
72
|
+
`),hb=ml(`PING\r
|
|
73
|
+
`);class jE{constructor(n,r,a){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(a):{})||{};Ou(this,l)}}class e1 extends Jt{constructor(r,a,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");Ou(this,l),this.protocol=r,this.subject=a,this.draining=!1,this.noIterator=typeof l.callback=="function",this.closed=Ot();const u=!((c=r.options)!=null&&c.noAsyncTraces);l.timeout&&(this.timer=ns(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 a=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)&&(a(f,m),c(m))}}else this.protocolFilterFn=r.protocolFilterFn,this.dispatchedFn=r.dispatchedFn}callback(r,a){this.cancelTimeout(),r?this.stop(r):this.push(a)}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(Ee.ConnectionClosed)):this.isClosed()?Promise.reject(Ne.errorForCode(Ee.SubClosed)):(this.drained||(this.draining=!0,this.protocol.unsub(this),this.drained=this.protocol.flush(Ot()).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 NE{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,a=this.all();let l;if(r.operation==="subscription"&&(l=a.find(u=>u.subject===r.subject&&u.queue===r.queue)),r.operation==="publish"&&(l=a.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 Su{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=CE,this.outMsgs=0,this.inMsgs=0,this.outBytes=0,this.inBytes=0,this.options=n,this.publisher=r,this.subscriptions=new NE,this.muxSubscriptions=new hE,this.outbound=new is,this.pongs=[],this.whyClosed="",this.pendingLimit=n.pendingLimit||this.pendingLimit,this.features=new Y_({major:0,minor:0,micro:0}),this.connectPromise=null;const a=typeof n.servers=="string"?[n.servers]:n.servers;this.servers=new fE(a,{randomize:!n.noRandomize}),this.closed=Ot(),this.parser=new ub(this),this.heartbeats=new dE(this,this.options.pingInterval||Z0,this.options.maxPingOut||wE)}resetOutbound(){this.outbound.reset();const n=this.pongs;this.pongs=[];const r=Ne.errorForCode(Ee.Disconnect);r.stack="",n.forEach(a=>{a.reject(r)}),this.parser=new ub(this),this.infoReceived=!1}dispatchStatus(n){this.listeners.forEach(r=>{r.push(n)})}status(){const n=new Jt;return this.listeners.push(n),n}prepare(){this.transport&&this.transport.discard(),this.info=void 0,this.resetOutbound();const n=Ot();return n.catch(()=>{}),this.pongs.unshift(n),this.connectError=r=>{n.reject(r)},this.transport=X_(),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:Qa.StaleConnection,data:""}),this.transport.disconnect()}reconnect(){return this.connected&&(this.dispatchStatus({type:Qa.ClientInitiatedReconnect,data:""}),this.transport.disconnect()),Promise.resolve()}async disconnected(n){this.dispatchStatus({type:Gr.Disconnect,data:this.servers.getCurrentServer().toString()}),this.options.reconnect?await this.dialLoop().then(()=>{var r;this.dispatchStatus({type:Gr.Reconnect,data:this.servers.getCurrentServer().toString()}),((r=this.lastError)==null?void 0:r.code)===Ee.AuthenticationExpired&&(this.lastError=void 0)}).catch(r=>{this._close(r)}):await this._close(n)}async dial(n){const r=this.prepare();let a;try{a=ns(this.options.timeout||2e4);const l=this.transport.connect(n,this.options);await Promise.race([l,a]),(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([a,r]),a&&a.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 a&&a.cancel(),await this.transport.close(l),l}}async _doDial(n){const{resolve:r}=this.options,a=await n.resolve({fn:Gh(),debug:this.options.debug,randomize:!this.options.noRandomize,resolve:r});let l=null;for(const u of a)try{l=null,this.dispatchStatus({type:Qa.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():W0;let a=r;const l=this.selectServer();if(!l||this.abortReconnect)throw n||(this.lastError?this.lastError:Ne.errorForCode(Ee.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 a=Math.min(a,l.lastConnect+r-u),await us(a)}}static async connect(n,r){const a=new Su(n,r);return await a.dialLoop(),a}static toError(n){const r=n?n.toLowerCase():"";if(r.indexOf("permissions violation")!==-1){const a=new Ne(n,Ee.PermissionsViolation),l=n.match(/(Publish|Subscription) to "(\S+)"/);if(l){a.permissionContext={operation:l[1].toLowerCase(),subject:l[2],queue:void 0};const u=n.match(/using queue "(\S+)"/);u&&(a.permissionContext.queue=u[1])}return a}else return r.indexOf("authorization violation")!==-1?new Ne(n,Ee.AuthorizationViolation):r.indexOf("user authentication expired")!==-1?new Ne(n,Ee.AuthenticationExpired):r.indexOf("account authentication expired")!=-1?new Ne(n,Ee.AccountExpired):r.indexOf("authentication timeout")!==-1?new Ne(n,Ee.AuthenticationTimeout):new Ne(n,Ee.ProtocolError)}processMsg(n,r){if(this.inMsgs++,this.inBytes+=r.length,!this.subscriptions.sidCounter)return;const a=this.subscriptions.get(n.sid);a&&(a.received+=1,a.callback&&a.callback(null,new vd(n,r,this)),a.max!==void 0&&a.received>=a.max&&a.unsubscribe())}processError(n){const r=Jy(n),a=Su.toError(r),l={type:Gr.Error,data:a.code};if(a.isPermissionError()){let u=!1;if(a.permissionContext){l.permissionContext=a.permissionContext;const c=this.subscriptions.getMux();u=(c==null?void 0:c.subject)===a.permissionContext.subject}this.subscriptions.handleError(a),this.muxSubscriptions.handleError(u,a),u&&this.subscriptions.setMux(null)}this.dispatchStatus(l),this.handleError(a)}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(TE)}processPong(){const n=this.pongs.shift();n&&n.resolve()}processInfo(n){const r=JSON.parse(Jy(n));this.info=r;const a=this.options&&this.options.ignoreClusterUpdates?void 0:this.servers.update(r,this.transport.isEncrypted());if(!this.infoReceived){this.features.update(na(r.version)),this.infoReceived=!0,this.transport.isEncrypted()&&this.servers.updateTLSName();const{version:u,lang:c}=this.transport;try{const f=new jE({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(ml(`CONNECT ${m}${cu}`)),this.transport.send(hb)}catch(f){this._close(f)}}a&&this.dispatchStatus({type:Gr.Update,data:a}),(r.ldm!==void 0?r.ldm:!1)&&this.dispatchStatus({type:Gr.LDM,data:this.servers.getCurrentServer().toString()})}push(n){switch(n.kind){case un.MSG:{const{msg:r,data:a}=n;this.processMsg(r,a);break}case un.OK:break;case un.ERR:this.processError(n.data);break;case un.PING:this.processPing();break;case un.PONG:this.processPong();break;case un.INFO:this.processInfo(n.data);break}}sendCommand(n,...r){const a=this.outbound.length();let l;typeof n=="string"?l=ml(n):l=n,this.outbound.fill(l,...r),a===0?queueMicrotask(()=>{this.flushPending()}):this.outbound.size()>=this.pendingLimit&&this.flushPending()}publish(n,r=Ln,a){let l;if(r instanceof Uint8Array)l=r;else if(typeof r=="string")l=aa.encode(r);else throw Ne.errorForCode(Ee.BadPayload);let u=l.length;a=a||{},a.reply=a.reply||"";let c=Ln,f=0;if(a.headers){if(this.info&&!this.info.headers)throw new Ne("headers",Ee.ServerOptionNotAvailable);c=a.headers.encode(),f=c.length,u=l.length+f}if(this.info&&u>this.info.max_payload)throw Ne.errorForCode(Ee.MaxPayloadExceeded);this.outBytes+=u,this.outMsgs++;let m;a.headers?(a.reply?m=`HPUB ${n} ${a.reply} ${f} ${u}\r
|
|
74
|
+
`:m=`HPUB ${n} ${f} ${u}\r
|
|
75
|
+
`,this.sendCommand(m,c,l,wu)):(a.reply?m=`PUB ${n} ${a.reply} ${u}\r
|
|
76
|
+
`:m=`PUB ${n} ${u}\r
|
|
77
|
+
`,this.sendCommand(m,l,wu))}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=Ot()),this.pongs.push(n),this.outbound.fill(hb),this.flushPending(),n}sendSubscriptions(){const n=[];this.subscriptions.all().forEach(r=>{const a=r;a.queue?n.push(`SUB ${a.subject} ${a.queue} ${a.sid}${cu}`):n.push(`SUB ${a.subject} ${a.sid}${cu}`)}),n.length&&this.transport.send(ml(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(a=>{r.push(a.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),a=new e1(this,`${r}*`);a.callback=this.muxSubscriptions.dispatcher(),this.subscriptions.setMux(a),this.subscribe(a)}}selectServer(){const n=this.servers.selectServer();if(n!==void 0)return this.server=n,this.server}getServer(){return this.server}}const OE="$SRV";class db{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,a,l){var u,c;return l=l||{},l.headers=l.headers||Jr(),(u=l.headers)==null||u.set(gu,`${n}`),(c=l.headers)==null||c.set(pu,r),this.msg.respond(a,l)}json(n){return this.msg.json(n)}string(){return this.msg.string()}}class _l{constructor(n,r="",a=""){C(this,"subject");C(this,"queue");C(this,"srv");r!==""&&ME("service group",r);let l="";if(n instanceof Ml)this.srv=n,l="";else if(n instanceof _l){const u=n;this.srv=u.srv,a===""&&u.queue!==""&&(a=u.queue),l=u.subject}else throw new Error("unknown ServiceGroup type");this.subject=this.calcSubject(l,r),this.queue=a}calcSubject(n,r=""){return r===""?n:n!==""?`${n}.${r}`:r}addEndpoint(n="",r){r=r||{subject:n};const a=typeof r=="function"?{handler:r,subject:n}:r;hl("endpoint",n);let{subject:l,handler:u,metadata:c,queue:f}=a;l=l||n,f=f||this.queue,RE("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 _l(this,n,r)}}function RE(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((a,l)=>{if(a===">"&&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(a=>{if(a===">")throw new Error(`${e} name cannot contain internal '>': '${n}'`)})}class Ml{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"),hl("name",this.config.name),hl("queue",this.config.queue),na(this.config.version),this._id=Ni.next(),this.internal=[],this._done=Ot(),this._stopped=!1,this.handlers=[],this.started=new Date().toISOString(),this.reset(),this.nc.closed().then(()=>{this.close().catch()}).catch(a=>{this.close(a).catch()})}static controlSubject(n,r="",a="",l){const u=l??OE;return r===""&&a===""?`${u}.${n}`:(hl("control subject name",r),a!==""?(hl("control subject id",a),`${u}.${n}.${r}.${a}`):`${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=Jr();if(n instanceof yu){const a=n;r.set(pu,a.message),r.set(gu,`${a.code}`)}else r.set(pu,n.message),r.set(gu,"500");return r}setupHandler(n,r=!1){const a=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 DE(l,u,a),f.queue=a;const m=c?(d,y)=>{if(d){this.close(d);return}const g=Date.now();try{c(d,new db(y))}catch(b){f.stats.countError(b),y==null||y.respond(Ln,{headers:this.errorToHeader(b)})}finally{f.stats.countLatency(g)}}:void 0;return f.sub=this.nc.subscribe(u,{callback:m,queue:a}),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:pl.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:a,name:l,queue:u}=n;return{subject:r,metadata:a,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(a){r.stats.countError(a)}n.push(r.stats.stats(r.qi))}return{type:pl.STATS,name:this.name,id:this.id,version:this.version,started:this.started,metadata:this.metadata,endpoints:n}}addInternalHandler(n,r){const a=`${n}`.toUpperCase();this._doAddInternalHandler(`${a}-all`,n,r),this._doAddInternalHandler(`${a}-kind`,n,r,this.name),this._doAddInternalHandler(`${a}`,n,r,this.name,this.id)}_doAddInternalHandler(n,r,a,l="",u=""){const c={};c.name=n,c.subject=Ml.controlSubject(r,l,u),c.handler=a,this.setupHandler(c,!0)}start(){const n=or(),r=(c,f)=>c?(this.close(c),Promise.reject(c)):this.stats().then(m=>(f==null||f.respond(n.encode(m)),Promise.resolve())),a=(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(Ai.PING,u),this.addInternalHandler(Ai.STATS,r),this.addInternalHandler(Ai.INFO,a),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(a=>a.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:pl.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 _l(this,n,r)}addEndpoint(n,r){return new _l(this).addEndpoint(n,r)}_addEndpoint(n){const r=new Jt;r.noIterator=typeof n.handler=="function",r.noIterator||(n.handler=(l,u)=>{l?this.stop(l).catch():r.push(new db(u))},r.iterClosed.then(()=>{this.close().catch()}));const a=this.setupHandler(n,!1);return a.qi=r,this.handlers.push(a),r}}class DE{constructor(n,r,a=""){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=a}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+=Nt(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:a,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:a,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=Nt(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 zE{constructor(n,r={strategy:lr.JitterTimer,maxWait:2e3},a){C(this,"nc");C(this,"prefix");C(this,"opts");this.nc=n,this.prefix=a,this.opts=r}ping(n="",r=""){return this.q(Ai.PING,n,r)}stats(n="",r=""){return this.q(Ai.STATS,n,r)}info(n="",r=""){return this.q(Ai.INFO,n,r)}async q(n,r="",a=""){const l=new Jt,u=or(),c=Ml.controlSubject(n,r,a,this.prefix),f=await this.nc.requestMany(c,Ln,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 t1(){return{key:{encode(e){return e},decode(e){return e}},value:{encode(e){return e},decode(e){return e}}}}function LE(){return{replicas:1,history:1,timeout:2e3,max_bytes:-1,maxValueSize:-1,codec:t1(),storage:Ih.File}}const _u="KV-Operation",mb="$KV",UE=/^[-/=.\w]+$/,BE=/^[-/=.>*\w]+$/,PE=/^[-\w]+$/;function HE(e){if(e.startsWith(".")||e.endsWith(".")||!UE.test(e))throw new Error(`invalid key: ${e}`)}function qE(e){if(e.startsWith(".")||e.endsWith(".")||!BE.test(e))throw new Error(`invalid key: ${e}`)}function IE(e){if(e.startsWith(".")||e.endsWith("."))throw new Error(`invalid key: ${e}`);const n=e.split(".");let r=!1;for(let a=0;a<n.length;a++)switch(n[a]){case"*":r=!0;break;case">":if(a!==n.length-1)throw new Error(`invalid key: ${e}`);r=!0;break}return r}function fu(e){if(!PE.test(e))throw new Error(`invalid bucket name: ${e}`)}var br;(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"})(br||(br={}));class El{constructor(n,r,a){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",HE);C(this,"validateSearchKey",qE);C(this,"hasWildcards",IE);fu(n),this.js=r,this.jsm=a,this.bucket=n,this.prefix=mb,this.editPrefix="",this.useJsPrefix=!1,this._prefixLen=0}static async create(n,r,a={}){fu(r);const l=await n.jetstreamManager(),u=new El(r,n,l);return await u.init(a),u}static async bind(n,r,a={}){const l=await n.jetstreamManager(),u={config:{allow_direct:a.allow_direct}};fu(r);const c=new El(r,n,l);return u.config.name=a.streamName??c.bucketName(),Object.assign(c,u),c.stream=u.config.name,c.codec=a.codec||t1(),c.direct=u.config.allow_direct??!1,c.initializePrefixes(u),c}async init(n={}){const r=Object.assign(LE(),n);this.codec=r.codec;const a={};this.stream=a.name=n.streamName??this.bucketName(),a.retention=qh.Limits,a.max_msgs_per_subject=r.history,r.maxBucketSize&&(r.max_bytes=r.maxBucketSize),r.max_bytes&&(a.max_bytes=r.max_bytes),a.max_msg_size=r.maxValueSize,a.storage=r.storage;const l=n.placementCluster??"";if(l&&(n.placement={},n.placement.cluster=l,n.placement.tags=[]),n.placement&&(a.placement=n.placement),n.republish&&(a.republish=n.republish),n.description&&(a.description=n.description),n.mirror){const g=Object.assign({},n.mirror);g.name.startsWith(Rn)||(g.name=`${Rn}${g.name}`),a.mirror=g,a.mirror_direct=!0}else if(n.sources){const g=n.sources.map(b=>{const x=Object.assign({},b),k=x.name.startsWith(Rn)?x.name.substring(Rn.length):x.name;return x.name.startsWith(Rn)||(x.name=`${Rn}${x.name}`),!b.external&&k!==this.bucket&&(x.subject_transforms=[{src:`$KV.${k}.>`,dest:`$KV.${this.bucket}.>`}]),x});a.sources=g,a.subjects=[this.subjectForBucket()]}else a.subjects=[this.subjectForBucket()];n.metadata&&(a.metadata=n.metadata),typeof n.compression=="boolean"&&(a.compression=n.compression?Oi.S2:Oi.None);const u=this.js.nc,c=u.getServerVersion(),f=c?$h(c,na("2.7.2"))>=0:!1;a.discard=f?Sl.New:Sl.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,a.allow_direct=n.allow_direct,this.direct=a.allow_direct,a.num_replicas=r.replicas,r.ttl&&(a.max_age=Nt(r.ttl)),a.allow_rollup_hdrs=!0;let y;try{y=await this.jsm.streams.info(a.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(a);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 a=r.name;if(a.startsWith(Rn)&&(a=a.substring(Rn.length)),r.external&&r.external.api!==""){const l=r.name.substring(Rn.length);this.useJsPrefix=!1,this.prefix=`$KV.${l}`,this.editPrefix=`${r.external.api}.$KV.${a}`}else this.editPrefix=this.prefix}}bucketName(){return this.stream??`${Rn}${this.bucket}`}subjectForBucket(){return`${this.prefix}.${this.bucket}.>`}subjectForKey(n,r=!1){const a=[];return r?(this.useJsPrefix&&a.push(this.js.apiPrefix),this.editPrefix!==""?a.push(this.editPrefix):a.push(this.prefix)):this.prefix&&a.push(this.prefix),a.push(n),a.join(".")}fullKeyName(n){return this.prefix!==""?`${this.prefix}.${n}`:`${mb}.${this.bucket}.${n}`}get prefixLen(){return this._prefixLen===0&&(this._prefixLen=this.prefix.length+1),this._prefixLen}encodeKey(n){const r=[];for(const a of n.split("."))switch(a){case">":case"*":r.push(a);break;default:r.push(this.codec.key.encode(a));break}return r.join(".")}decodeKey(n){const r=[];for(const a of n.split("."))switch(a){case">":case"*":r.push(a);break;default:r.push(this.codec.key.decode(a));break}return r.join(".")}close(){return Promise.resolve()}dataLen(n,r){const a=r&&r.get(fn.MessageSizeHdr)||"";return a!==""?parseInt(a,10):n.length}smToEntry(n){return new rk(this.bucket,this.prefixLen,n)}jmToEntry(n){const r=this.decodeKey(n.subject.substring(this.prefixLen));return new ik(this.bucket,r,n)}async create(n,r){var u;let a;try{const c=await this.put(n,r,{previousSeq:0});return Promise.resolve(c)}catch(c){if(a=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(a)}catch(c){return Promise.reject(c)}}update(n,r,a){if(a<=0)throw new Error("version must be greater than 0");return this.put(n,r,{previousSeq:a})}async put(n,r,a={}){var c,f;const l=this.encodeKey(n);this.validateKey(l);const u={};if(a.previousSeq!==void 0){const m=Jr();u.headers=m,m.set(br.ExpectedLastSubjectSequenceHdr,`${a.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 a=this.encodeKey(n);this.validateKey(a);let l={last_by_subj:this.subjectForKey(a)};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!==a?null:c}catch(c){if(c.code===Ee.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=Ot(),a=[],l=await this.watch({key:">",initializedFn:()=>{r.resolve()}});(async()=>{for await(const m of l)(m.operation==="DEL"||m.operation==="PURGE")&&a.push(m)})().then(),await r,l.stop();const u=Date.now()-n,c=a.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,a){if(!this.hasWildcards(n))return this._doDeleteOrPurge(n,r,a);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,a){const l=this.encodeKey(n);this.validateKey(l);const u=Jr();u.set(_u,r),r==="PURGE"&&u.set(fn.RollupHdr,fn.RollupValueSubject),a!=null&&a.previousSeq&&u.set(br.ExpectedLastSubjectSequenceHdr,`${a.previousSeq}`),await this.js.publish(this.subjectForKey(l,!0),Ln,{headers:u})}_buildCC(n,r,a={}){let u=(Array.isArray(n)?n:[n]).map(m=>{const d=this.encodeKey(m);return this.validateSearchKey(m),this.fullKeyName(d)}),c=Bt.LastPerSubject;r===sr.AllHistory&&(c=Bt.All),r===sr.UpdatesOnly&&(c=Bt.New);let f;return u.length===1&&(f=u[0],u=void 0),Object.assign({deliver_policy:c,ack_policy:Vt.None,filter_subjects:u,filter_subject:f,flow_control:!0,idle_heartbeat:Nt(5*1e3)},a)}remove(n){return this.purge(n)}async history(n={}){const r=n.key??">",a=new Jt,l={};l.headers_only=n.headers_only||!1;let u;u=()=>{a.stop()};let c=0;const f=this._buildCC(r,sr.AllHistory,l),m=f.filter_subject,d=ji(f);d.bindStream(this.stream),d.orderedConsumer(),d.callback((g,b)=>{if(g){a.stop(g);return}if(b){const x=this.jmToEntry(b);a.push(x),a.received++,(u&&c>0&&a.received>=c||b.info.pending===0)&&(a.push(u),u=void 0)}});const y=await this.js.subscribe(m,d);if(u){const{info:{last:g}}=y,b=g.num_pending+g.delivered.consumer_seq;if(b===0||a.received>=b)try{u()}catch(x){a.stop(x)}finally{u=void 0}else c=b}return a._data=y,a.iterClosed.then(()=>{y.unsubscribe()}),y.closed.then(()=>{a.stop()}).catch(g=>{a.stop(g)}),a}canSetWatcherName(){const r=this.js.nc,{ok:a}=r.features.get(ut.JS_NEW_CONSUMER_CREATE_API);return a}async watch(n={}){const r=n.key??">",a=new Jt,l={};l.headers_only=n.headers_only||!1;let u=sr.LastValue;n.include===sr.AllHistory?u=sr.AllHistory:n.include===sr.UpdatesOnly&&(u=sr.UpdatesOnly);const c=n.ignoreDeletes===!0;let f=n.initializedFn,m=0;const d=this._buildCC(r,u,l),y=d.filter_subject,g=ji(d);this.canSetWatcherName()&&g.consumerName(Ni.next()),g.bindStream(this.stream),n.resumeFromRevision&&n.resumeFromRevision>0&&g.startSequence(n.resumeFromRevision),g.orderedConsumer(),g.callback((x,k)=>{if(x){a.stop(x);return}if(k){const z=this.jmToEntry(k);if(c&&z.operation==="DEL")return;a.push(z),a.received++,f&&(m>0&&a.received>=m||k.info.pending===0)&&(a.push(f),f=void 0)}});const b=await this.js.subscribe(y,g);if(f){const{info:{last:x}}=b,k=x.num_pending+x.delivered.consumer_seq;if(k===0||a.received>=k)try{f()}catch(z){a.stop(z)}finally{f=void 0}else m=k}return a._data=b,a.iterClosed.then(()=>{b.unsubscribe()}),b.closed.then(()=>{a.stop()}).catch(x=>{a.stop(x)}),a}async keys(n=">"){const r=new Jt,a=this._buildCC(n,sr.LastValue,{headers_only:!0}),l=Array.isArray(n)?">":a.filter_subject,u=ji(a);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(_u);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)??"",a=this.bucketName(),l=await this.jsm.streams.info(a);return new n1(l,r)}}class n1{constructor(n,r=""){C(this,"si");C(this,"cluster");this.si=n,this.cluster=r}get bucket(){return this.si.config.name.startsWith(Rn)?this.si.config.name.substring(Rn.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 bd(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!==Oi.None:!1}}const wd="OBJ_",pb="SHA-256=";function FE(e){return fu(e),`${wd}${e}`}function $E(e){return e.startsWith(wd)?e.substring(4):e}class Jh{constructor(n){C(this,"si");C(this,"backingStore");this.si=n,this.backingStore="JetStream"}get bucket(){return $E(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!==Oi.None:!1}}function tu(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 Xn;(function(e){e[e.Unset=-1]="Unset",e[e.Consume=0]="Consume",e[e.Fetch=1]="Fetch"})(Xn||(Xn={}));var vr;(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"})(vr||(vr={}));var es;(function(e){e.DebugEvent="debug",e.Discard="discard",e.Reset="reset",e.Next="next"})(es||(es={}));const gb=Uint8Array.of(43,65,67,75),GE=Uint8Array.of(45,78,65,75),sl=Uint8Array.of(43,87,80,73),YE=Uint8Array.of(43,78,88,84),VE=Uint8Array.of(43,84,69,82,77),JE=Uint8Array.of(32);function kl(e,n=5e3){return new fk(e,n)}class uh extends Jt{constructor(r,a,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=a;this.opts=this.parseOptions(a,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=Yr(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:a,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,b,x,k;if(m){this.stop(m);return}if((g=this.monitor)==null||g.work(),d.subject===this.inbox){if(Hh(d))return;const z=(b=d.headers)==null?void 0:b.code,B=((k=(x=d.headers)==null?void 0:x.description)==null?void 0:k.toLowerCase())||"unknown",{msgsLeft:M,bytesLeft:F}=this.parseDiscard(d.headers);if(M>0||F>0)this.pending.msgs-=M,this.pending.bytes-=F,this.pending.requests--,this.notify(es.Discard,{msgsLeft:M,bytesLeft:F});else if(z===400){this.stop(new Ne(B,`${z}`));return}else if(z===409&&B==="consumer deleted"){if(this.notify(vr.ConsumerDeleted,`${z} ${B}`),!this.refilling||this.abortOnMissingResource){const G=new Ne(B,`${z}`);this.stop(G);return}}else if(z===503){if(this.notify(vr.NoResponders,`${z} No Responders`),!this.refilling||this.abortOnMissingResource){const G=new Ne("no responders",`${z}`);this.stop(G);return}}else this.notify(es.DebugEvent,`${z} ${B}`)}else this._push(kl(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||a&&this.pending.bytes<=u){const z=this.pullOptions();this.pull(z)}}else this.pending.requests===0&&this._push(()=>{this.stop()})}}),this.sub.closed.then(()=>{this.sub.draining&&this._push(()=>{this.stop()})}),l&&(this.monitor=new xd(l,m=>(this.notify(vr.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 Gr.Disconnect:(d=this.monitor)==null||d.cancel();break;case Gr.Reconnect:this.resetPending().then(g=>{var b;g&&((b=this.monitor)==null||b.restart())}).catch(()=>{});break}})(),this.pull(this.pullOptions())}_push(r){if(!this.callback)super.push(r);else{const a=typeof r=="function"?r:null;try{a?a():this.callback(r)}catch(l){this.stop(l)}}}notify(r,a){this.listeners.length>0&&this.listeners.forEach(l=>{l.done||l.push({type:r,data:a})})}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,a=0;const l=yd([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(a++,this.notify(vr.StreamNotFound,a),!this.refilling||this.abortOnMissingResource)return this.stop(c),!1}else if(c.message==="consumer not found"){if(r++,this.notify(vr.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,a=0;this.inBackOff=!0;const f=l.backoff(u),m=us(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 a=this.consumer.api.nc;this._push(()=>{a.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(es.Next,r)})}pullOptions(){const r=this.opts.max_messages-this.pending.msgs,a=this.opts.max_bytes-this.pending.bytes,l=Nt(this.opts.idle_heartbeat),u=Nt(this.opts.expires);return{batch:r,max_bytes:a,idle_heartbeat:l,expires:u}}parseDiscard(r){const a={msgsLeft:0,bytesLeft:0},l=r==null?void 0:r.get(fn.PendingMessagesHdr);l&&(a.msgsLeft=parseInt(l));const u=r==null?void 0:r.get(fn.PendingBytesHdr);return u&&(a.bytesLeft=parseInt(u)),a}trackTimeout(r){this.timeout=r}close(){return this.stop(),this.iterClosed}closed(){return this.iterClosed}clearTimers(){var r,a;(r=this.monitor)==null||r.cancel(),this.monitor=null,(a=this.timeout)==null||a.cancel(),this.timeout=null}setCleanupHandler(r){this.cleanupHandler=r}stop(r){var a,l;this.done||((a=this.sub)==null||a.unsubscribe(),this.clearTimers(),(l=this.statusIterator)==null||l.stop(),this._push(()=>{super.stop(r),this.listeners.forEach(u=>{u.stop()})}))}parseOptions(r,a=!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,a){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 Jt;return this.listeners.push(r),Promise.resolve(r)}}class XE extends Jt{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(a=>{this.stop(a||void 0)}),(async()=>{const a=await this.src.status();for await(const l of a)this.notify(l.type,l.data)})().catch(()=>{})}notify(r,a){this.listeners.length>0&&this.listeners.forEach(l=>{l.done||l.push({type:r,data:a})})}stop(r){var a;this.done||((a=this.src)==null||a.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 Jt;return this.listeners.push(r),Promise.resolve(r)}}class Xh{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 uh(this,n,!0))}fetch(n={max_messages:100,expires:3e4}){const r=new uh(this,n,!1),a=Math.round(r.opts.expires*1.05),l=ns(a);return r.closed().catch(()=>{}).finally(()=>{l.cancel()}),l.catch(()=>{r.close().catch()}),r.trackTimeout(l),Promise.resolve(r)}next(n={expires:3e4}){const r=Ot(),a=n;a.max_messages=1;const l=new uh(this,a,!1),u=Math.round(l.opts.expires*1.05);u>=6e4&&(async()=>{for await(const f of await l.status())if(f.type===vr.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=ns(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:a}=this._info;return this.api.info(r,a).then(l=>(this._info=l,this._info))}}class QE{constructor(n,r,a={}){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=Ni.next(),typeof a.name_prefix=="string"&&(Ru("name_prefix",a.name_prefix),this.namePrefix=a.name_prefix+this.namePrefix),this.serial=0,this.currentConsumer=null,this.userCallback=null,this.iter=null,this.type=Xn.Unset,this.consumerOpts=a,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 a={name:r,deliver_policy:Bt.StartSequence,opt_start_seq:n,ack_policy:Vt.None,inactive_threshold:Nt(300*1e3),num_replicas:1};return this.consumerOpts.headers_only===!0&&(a.headers_only=!0),Array.isArray(this.consumerOpts.filterSubjects)&&(a.filter_subjects=this.consumerOpts.filterSubjects),typeof this.consumerOpts.filterSubjects=="string"&&(a.filter_subject=this.consumerOpts.filterSubjects),this.consumerOpts.replay_policy&&(a.replay_policy=this.consumerOpts.replay_policy),n===this.startSeq+1&&(a.deliver_policy=this.consumerOpts.deliver_policy||Bt.StartSequence,(this.consumerOpts.deliver_policy===Bt.LastPerSubject||this.consumerOpts.deliver_policy===Bt.New||this.consumerOpts.deliver_policy===Bt.Last)&&(delete a.opt_start_seq,a.deliver_policy=this.consumerOpts.deliver_policy),a.deliver_policy===Bt.LastPerSubject&&typeof a.filter_subjects>"u"&&typeof a.filter_subject>"u"&&(a.filter_subject=">"),this.consumerOpts.opt_start_time&&(delete a.opt_start_seq,a.deliver_policy=Bt.StartTime,a.opt_start_time=this.consumerOpts.opt_start_time),this.consumerOpts.inactive_threshold&&(a.inactive_threshold=Nt(this.consumerOpts.inactive_threshold))),a}async resetConsumer(n=0){var c,f,m,d,y;Ni.next();const r=this.serial===0;(c=this.consumer)==null||c.delete().catch(()=>{}),n=n===0?1:n,this.cursor.deliver_seq=0;const a=this.getConsumerOpts(n);a.max_deliver=1,a.mem_storage=!0;const l=yd([((f=this.opts)==null?void 0:f.expires)||3e4]);let u;for(let g=0;;g++)try{u=await this.api.add(this.stream,a),(m=this.iter)==null||m.notify(vr.OrderedConsumerRecreated,u.name);break}catch(b){if(b.message==="stream not found"&&((d=this.iter)==null||d.notify(vr.StreamNotFound,g),this.type===Xn.Fetch||this.opts.abort_on_missing_resource===!0))return(y=this.iter)==null||y.stop(b),Promise.reject(b);if(r&&g>=this.maxInitialReset)throw b;await us(l.backoff(g+1))}return u}internalHandler(n){return r=>{var l;if(this.serial!==n)return;const a=r.info.deliverySequence;if(a!==this.cursor.deliver_seq+1){this.notifyOrderedResetAndReset();return}this.cursor.deliver_seq=a,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 a=r.fromFetch||!1,l=r.orderedReset||!1;if(this.type===Xn.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||a)&&(this.iter=new XE),this.consumer=new Xh(this.api,this.currentConsumer);const u=n;u.callback=this.internalHandler(this.serial);let c=null;this.type===Xn.Fetch&&a?c=await this.consumer.fetch(n):this.type===Xn.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(es.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===Xn.Fetch)return Promise.reject(new Error("ordered consumer initialized as fetch"));if(this.type===Xn.Consume)return Promise.reject(new Error("ordered consumer doesn't support concurrent consume"));const{callback:a}=n;return a&&(this.userCallback=a),this.type=Xn.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===Xn.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:a}=n;return a&&(this.userCallback=a),this.type=Xn.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 a=Ot();return r.callback=u=>{this.userCallback=null,a.resolve(u)},(await this.fetch(r)).iterClosed.then(u=>{u&&a.reject(u),a.resolve(null)}).catch(u=>{a.reject(u)}),a}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 Qh{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 Xh(this.api,n)}async get(n,r={}){return typeof r=="object"?this.ordered(n,r):(await this.checkVersion(),this.api.info(n,r).then(a=>a.config.deliver_subject!==void 0?Promise.reject(new Error("push consumer not supported")):new Xh(this.api,a)).catch(a=>Promise.reject(a)))}async ordered(n,r){await this.checkVersion();const a=this.api;return new Sd(a.nc,a.opts).info(n).then(u=>Promise.resolve(new QE(this.api,n,r))).catch(u=>Promise.reject(u))}}class Du{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 Du(this.api,n)}else return this}info(n=!1,r){return n?Promise.resolve(this._info):this.api.info(this.name,r).then(a=>(this._info=a,this._info))}getConsumerFromInfo(n){return new Qh(new xu(this.api.nc,this.api.opts)).getPullConsumerFor(n)}getConsumer(n){return new Qh(new xu(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 Sd extends Rl{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 a(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=>{a("stream sources",l)}),n.mirror&&a("stream mirror",n.mirror)}async add(n={}){var l;this.checkStreamConfigVersions(n),on(n.name),n.mirror=tu(n.mirror),n.sources=(l=n.sources)==null?void 0:l.map(tu);const a=await this._request(`${this.prefix}.STREAM.CREATE.${n.name}`,n);return this._fixInfo(a),a}async delete(n){return on(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),on(n);const a=await this.info(n),l=Object.assign(a.config,r);l.mirror=tu(l.mirror),l.sources=(f=l.sources)==null?void 0:f.map(tu);const c=await this._request(`${this.prefix}.STREAM.UPDATE.${n}`,l);return this._fixInfo(c),c}async info(n,r){on(n);const a=`${this.prefix}.STREAM.INFO.${n}`;let u=await this._request(a,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 x=await this._request(a,y);c=x.total,d.push(x);const k=Object.getOwnPropertyNames(x.state.subjects).length;if(m+=k,k<f)break}let b={};for(let x=0;x<d.length;x++)u=d[x],u.state.subjects&&(b=Object.assign(b,u.state.subjects));u.offset=0,u.total=0,u.limit=0,u.state.subjects=b}return this._fixInfo(u),u}list(n=""){const r=n!=null&&n.length?{subject:n}:{},a=u=>{const c=u;return c.streams.forEach(f=>{this._fixInfo(f)}),c.streams},l=`${this.prefix}.STREAM.LIST`;return new dl(l,a,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 on(n),await this._request(`${this.prefix}.STREAM.PURGE.${n}`,r)}async deleteMessage(n,r,a=!0){on(n);const l={seq:r};return a||(l.no_erase=!0),(await this._request(`${this.prefix}.STREAM.MSG.DELETE.${n}`,l)).success}async getMessage(n,r){on(n);const l=await this._request(`${this.prefix}.STREAM.MSG.GET.${n}`,r);return new r1(l)}find(n){return this.findStream(n)}listKvs(){const n=a=>{var m;const u=a.streams.filter(d=>d.config.name.startsWith(Rn));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 n1(d,c))},r=`${this.prefix}.STREAM.LIST`;return new dl(r,n,this)}listObjectStores(){const n=a=>{const u=a.streams.filter(f=>f.config.name.startsWith(wd));return u.forEach(f=>{this._fixInfo(f)}),u.map(f=>new Jh(f))},r=`${this.prefix}.STREAM.LIST`;return new dl(r,n,this)}names(n=""){const r=n!=null&&n.length?{subject:n}:{},a=u=>u.streams,l=`${this.prefix}.STREAM.NAMES`;return new dl(l,a,this,r)}async get(n){const r=await this.info(n);return Promise.resolve(new Du(this,r))}}class KE extends Rl{constructor(n,r){super(n,r)}async getMessage(n,r){on(n);let a=r;const{last_by_subj:l}=a;l&&(a=null);const u=a?this.jc.encode(a):Ln,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=Za(m);if(d)return Promise.reject(d);const y=new Kh(m);return Promise.resolve(y)}async getBatch(n,r){on(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 Jt,f=await this.nc.requestMany(l,u,{strategy:lr.SentinelMsg});return(async()=>{var g,b,x;let m=!1,d=!1,y;for await(const k of f){if(!m){m=!0;const z=((g=k.headers)==null?void 0:g.code)||0;if(z!==0&&z<200||z>299){y=(b=k.headers)==null?void 0:b.description.toLowerCase();break}if(((x=k.headers)==null?void 0:x.get("Nats-Num-Pending"))===""){d=!0;break}}if(k.data.length===0)break;c.push(new Kh(k))}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 Kh{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(Xa.Subject)}get seq(){const n=this.header.last(Xa.Sequence);return typeof n=="string"?parseInt(n):0}get time(){return new Date(Date.parse(this.timestamp))}get timestamp(){return this.header.last(Xa.TimeStamp)}get stream(){return this.header.last(Xa.Stream)}json(n){return or(n).decode(this.data)}string(){return Mn.decode(this.data)}}C(Kh,"jc");class ZE extends Rl{constructor(r,a){super(r,a);C(this,"streams");C(this,"consumers");C(this,"direct");this.streams=new Sd(r,a),this.consumers=new xu(r,a),this.direct=new KE(r,a)}async getAccountInfo(){return await this._request(`${this.prefix}.INFO`)}jetstream(){return this.nc.jetstream(this.getOptions())}advisories(){const r=new Jt;return this.nc.subscribe("$JS.EVENT.ADVISORY.>",{callback:(a,l)=>{if(a)throw a;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 r1{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):Ln}get header(){if(!this._header)if(this.smr.message.hdrs){const n=this._parse(this.smr.message.hdrs);this._header=Ti.decode(n)}else this._header=Jr();return this._header}_parse(n){const r=atob(n),a=r.length,l=new Uint8Array(a);for(let u=0;u<a;u++)l[u]=r.charCodeAt(u);return l}json(n){return or(n).decode(this.data)}string(){return Mn.decode(this.data)}}C(r1,"jc");class WE{constructor(n){C(this,"api");this.api=n}get(n){return this.api.info(n).then(r=>new Du(this.api,r))}}class ch{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=Ti.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 yb(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 ek(){return new ReadableStream({pull(e){e.enqueue(new Uint8Array(0)),e.close()}})}class yl{constructor(n,r,a){C(this,"jsm");C(this,"js");C(this,"stream");C(this,"name");this.name=n,this.jsm=r,this.js=a}_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 ch(r):null}async list(){const n=[],r=await this.watch({ignoreDeletes:!0,includeHistory:!0});for await(const a of r){if(a===null)break;n.push(a)}return Promise.resolve(n)}async rawInfo(n){const{name:r,error:a}=this._checkNotEmpty(n);if(a)return Promise.reject(a);const l=this._metaSubject(r);try{const u=await this.jsm.streams.getMessage(this.stream,{last_by_subj:l}),f=or().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 Jh(n)))}async status(n){const r=await this._si(n);return r===null?Promise.reject(new Error("object store not found")):Promise.resolve(new Jh(r))}destroy(){return this.jsm.streams.delete(this.stream)}async _put(n,r,a){var se;const l=this.js.getOptions();a=a||{timeout:l.timeout},a.timeout=a.timeout||l.timeout,a.previousRevision=a.previousRevision??void 0;const{timeout:u,previousRevision:c}=a,f=this.js.nc.info,m=(f==null?void 0:f.max_payload)||1024;n=n||{},n.options=n.options||{};let d=((se=n.options)==null?void 0:se.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:b}=this._checkNotEmpty(n.name);if(b)return Promise.reject(b);const x=Ni.next(),k=this._chunkSubject(x),z=this._metaSubject(g),B=Object.assign({bucket:this.name,nuid:x,size:0,chunks:0},yb(n)),M=Ot(),F=[],G=new is;try{const O=r?r.getReader():null,j=sb.create();for(;;){const{done:V,value:J}=O?await O.read():{done:!0,value:void 0};if(V){if(G.size()>0){const Z=G.drain();j.update(Z),B.chunks++,B.size+=Z.length,F.push(this.js.publish(k,Z,{timeout:u}))}await Promise.all(F),F.length=0,B.mtime=new Date().toISOString();const Y=Wa.encode(j.digest());B.digest=`${pb}${Y}`,B.deleted=!1;const N=Jr();typeof c=="number"&&N.set(br.ExpectedLastSubjectSequenceHdr,`${c}`),N.set(fn.RollupHdr,fn.RollupValueSubject);const Q=await this.js.publish(z,or().encode(B),{headers:N,timeout:u});if(B.revision=Q.seq,y)try{await this.jsm.streams.purge(this.stream,{filter:`$O.${this.name}.C.${y.nuid}`})}catch{}M.resolve(new ch(B));break}if(J)for(G.fill(J);G.size()>d;){B.chunks++,B.size+=d;const Y=G.drain(n.options.max_chunk_size);j.update(Y),F.push(this.js.publish(k,Y,{timeout:u}))}}}catch(O){await this.jsm.streams.purge(this.stream,{filter:k}),M.reject(O)}return M}putBlob(n,r,a){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),a)}put(n,r,a){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,a)}async getBlob(n){async function r(u){const c=new is,f=u.getReader();for(;;){const{done:m,value:d}=await f.read();if(m)return c.drain();d&&d.length&&c.fill(d)}}const a=await this.get(n);if(a===null)return Promise.resolve(null);const l=await Promise.all([a.error,r(a.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 yl.create(this.js,r.options.link.bucket):this).get(g)}if(!r.digest.startsWith(pb))return Promise.reject(new Error(`unknown digest type: ${r.digest}`));const a=Fh(r.digest.substring(8));if(a===null)return Promise.reject(new Error(`unable to parse digest: ${r.digest}`));const l=Ot(),u={info:new ch(r),error:l};if(r.size===0)return u.data=ek(),l.resolve(null),Promise.resolve(u);let c;const f=ji();f.orderedConsumer();const m=sb.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&&(I_(a,m.digest())?c.close():c.error(new Error(`received a corrupt object, digests do not match received: ${r.digest} calculated ${a}`)),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 yl))return Promise.reject("bucket required");const a=r,{name:l,error:u}=this._checkNotEmpty(n);if(u)return Promise.reject(u);const c={name:l,options:{link:{bucket:a.name}}};return this._put(c,null)}async link(n,r){const{name:a,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:a,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 a=or(),l=Jr();return l.set(fn.RollupHdr,fn.RollupValueSubject),await this.js.publish(this._metaSubject(r.name),a.encode(r),{headers:l}),this.jsm.streams.purge(this.stream,{filter:this._chunkSubject(r.nuid)})}async update(n,r={}){const a=await this.rawInfo(n);if(a===null)return Promise.reject(new Error("object not found"));if(a.deleted)return Promise.reject(new Error("cannot update meta for a deleted object"));r.name=r.name??a.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({},a,yb(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 a=new Jt,l=this._metaSubjectAll();try{await this.jsm.streams.getMessage(this.stream,{last_by_subj:l})}catch(m){m.code==="404"?(a.push(null),r=!0):a.stop(m)}const u=or(),c=ji();c.orderedConsumer(),n.includeHistory?c.deliverLastPerSubject():(r=!0,c.deliverNew()),c.callback((m,d)=>{var y;if(m){a.stop(m);return}if(d!==null){const g=u.decode(d.data);g.deleted&&n.ignoreDeletes===!0||a.push(g),((y=d.info)==null?void 0:y.pending)===0&&!r&&(r=!0,a.push(null))}});const f=await this.js.subscribe(l,c);return a._data=f,a.iterClosed.then(()=>{f.unsubscribe()}),f.closed.then(()=>{a.stop()}).catch(m=>{a.stop(m)}),a}_chunkSubject(n){return`$O.${this.name}.C.${n}`}_metaSubject(n){return`$O.${this.name}.M.${Wa.encode(n)}`}_metaSubjectAll(){return`$O.${this.name}.M.>`}async init(n={}){try{this.stream=FE(this.name)}catch(l){return Promise.reject(l)}const r=(n==null?void 0:n.ttl)||0;delete n.ttl;const a=Object.assign({max_age:r},n);a.name=this.stream,a.num_replicas=n.replicas??1,a.allow_direct=!0,a.allow_rollup_hdrs=!0,a.discard=Sl.New,a.subjects=[`$O.${this.name}.C.>`,`$O.${this.name}.M.>`],n.placement&&(a.placement=n.placement),n.metadata&&(a.metadata=n.metadata),typeof n.compression=="boolean"&&(a.compression=n.compression?Oi.S2:Oi.None);try{await this.jsm.streams.info(a.name)}catch(l){l.message==="stream not found"&&await this.jsm.streams.add(a)}}static async create(n,r,a={}){const l=await n.jetstreamManager(),u=new yl(r,l,n);return await u.init(a),Promise.resolve(u)}}class tk{constructor(n){C(this,"js");this.js=n}kv(n,r={}){const a=this.js,{ok:l,min:u}=a.nc.features.get(ut.JS_KV);return l?r.bindOnly?El.bind(this.js,n,r):El.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 a=this.js,{ok:l,min:u}=a.nc.features.get(ut.JS_OBJECTSTORE);return l?yl.create(this.js,n,r):Promise.reject(new Error(`objectstore is only supported on servers ${u} or better`))}}class _d extends Rl{constructor(r,a){super(r,a);C(this,"consumers");C(this,"streams");C(this,"consumerAPI");C(this,"streamAPI");this.consumerAPI=new xu(r,a),this.streamAPI=new Sd(r,a),this.consumers=new Qh(this.consumerAPI),this.streams=new WE(this.streamAPI)}jetstreamManager(r){r===void 0&&(r=this.opts.checkAPI);const a=Object.assign({},this.opts,{checkAPI:r});return this.nc.jetstreamManager(a)}get apiPrefix(){return this.prefix}get views(){return new tk(this)}async publish(r,a=Ln,l){l=l||{},l.expect=l.expect||{};const u=(l==null?void 0:l.headers)||Jr();l&&(l.msgID&&u.set(br.MsgIdHdr,l.msgID),l.expect.lastMsgID&&u.set(br.ExpectedLastMsgIdHdr,l.expect.lastMsgID),l.expect.streamName&&u.set(br.ExpectedStreamHdr,l.expect.streamName),typeof l.expect.lastSequence=="number"&&u.set(br.ExpectedLastSeqHdr,`${l.expect.lastSequence}`),typeof l.expect.lastSubjectSequence=="number"&&u.set(br.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 b=0;b<m;b++)try{y=await this.nc.request(r,a,f);break}catch(x){if(x.code==="503"&&b+1<m)await us(d);else throw x}const g=this.parseJsResponse(y);if(g.stream==="")throw Ne.errorForCode(Ee.JetStreamInvalidAck);return g.duplicate=g.duplicate?g.duplicate:!1,g}async pull(r,a,l=0){on(r),Ka(a);let u=this.timeout;l>u&&(u=l),l=l<0?0:Nt(l);const c={batch:1,no_wait:l===0,expires:l},f=await this.nc.request(`${this.prefix}.CONSUMER.MSG.NEXT.${r}.${a}`,this.jc.encode(c),{noMux:!0,timeout:u}),m=Za(f);if(m)throw m;return kl(f,this.timeout)}fetch(r,a,l={}){on(r),Ka(a);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 F=this.nc.features.get(ut.JS_PULL_MAX_BYTES);if(!F.ok)throw new Error(`max_bytes is only supported on servers ${F.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=Nt(g)),g===0&&y.no_wait===!1)throw new Error("expires or no_wait is required");const b=l.idle_heartbeat||0;b&&(y.idle_heartbeat=Nt(b),l.delay_heartbeat===!0&&(y.idle_heartbeat=Nt(b*4)));const x=new Jt,k=y.batch;let z=0;x.protocolFilterFn=(F,G=!1)=>Hh(F.msg)?(d==null||d.work(),!1):!0,x.dispatchedFn=F=>{if(F){if(c&&(f+=F.data.length),z++,u&&F.info.pending===0)return;(x.getPending()===1&&F.info.pending===0||k===z||m>0&&f>=m)&&x.stop()}};const B=Yr(this.nc.options.inboxPrefix),M=this.nc.subscribe(B,{max:l.batch,callback:(F,G)=>{F===null&&(F=Za(G)),F!==null?(u&&(u.cancel(),u=null),__(F)?x.stop(a1(F)===null?void 0:F):x.stop(F)):(d==null||d.work(),x.received++,x.push(kl(G,this.timeout)))}});return g&&(u=ns(g),u.catch(()=>{M.isClosed()||(M.drain().catch(()=>{}),u=null),d&&d.cancel()})),(async()=>{try{b&&(d=new xd(b,F=>(x.push(()=>{x.err=new Ne(`${Qn.IdleHeartbeatMissed}: ${F}`,Ee.JetStreamIdleHeartBeat)}),!0)))}catch{}await M.closed,u!==null&&(u.cancel(),u=null),d&&d.cancel(),x.stop()})().catch(),this.nc.publish(`${this.prefix}.CONSUMER.MSG.NEXT.${r}.${a}`,this.jc.encode(y),{reply:B}),x}async pullSubscribe(r,a=ji()){const l=await this._processOptions(r,a);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===Vt.None||u===Vt.All)throw new Error("ack policy for pull consumers must be explicit");const c=this._buildTypedSubscriptionOpts(l),f=new ak(this,l.deliver,c);f.info=l;try{await this._maybeCreateConsumer(l)}catch(m){throw f.unsubscribe(),m}return f}async subscribe(r,a=ji()){const l=await this._processOptions(r,a);if(!l.isBind&&!l.config.deliver_subject)throw new Error("push consumer requires deliver_subject");const u=this._buildTypedSubscriptionOpts(l),c=new i1(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,a=ji()){const l=nb(a)?a.getOpts():a;if(l.isBind=nb(a)?a.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!==Vt.NotSet&&l.config.ack_policy!==Vt.None)throw new Ne("ordered consumer: ack_policy can only be set to 'none'",Ee.ApiError);if(l.config.durable_name&&l.config.durable_name.length>0)throw new Ne("ordered consumer: durable_name cannot be set",Ee.ApiError);if(l.config.deliver_subject&&l.config.deliver_subject.length>0)throw new Ne("ordered consumer: deliver_subject cannot be set",Ee.ApiError);if(l.config.max_deliver!==void 0&&l.config.max_deliver>1)throw new Ne("ordered consumer: max_deliver cannot be set",Ee.ApiError);if(l.config.deliver_group&&l.config.deliver_group.length>0)throw new Ne("ordered consumer: deliver_group cannot be set",Ee.ApiError);l.config.deliver_subject=Yr(this.nc.options.inboxPrefix),l.config.ack_policy=Vt.None,l.config.max_deliver=1,l.config.flow_control=!0,l.config.idle_heartbeat=l.config.idle_heartbeat||Nt(5e3),l.config.ack_wait=Nt(1320*60*1e3),l.config.mem_storage=!0,l.config.num_replicas=1}if(l.config.ack_policy===Vt.NotSet&&(l.config.ack_policy=Vt.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||Yr(this.nc.options.inboxPrefix),l}_buildTypedSubscriptionOpts(r){const a={};return a.adapter=sk(r.callbackFn===void 0,this.timeout),a.ingestionFilterFn=_d.ingestionFn(r.ordered),a.protocolFilterFn=(l,u=!1)=>{const c=l;return Ph(c.msg)?(u||c.msg.respond(),!1):!0},!r.mack&&r.config.ack_policy!==Vt.None&&(a.dispatchedFn=uk),r.callbackFn&&(a.callback=r.callbackFn),a.max=r.max||0,a.queue=r.queue,a}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:Bt.All,ack_policy:Vt.Explicit,ack_wait:Nt(30*1e3),replay_policy:rs.Instant},r.config);const a=await this.consumerAPI.add(r.stream,r.config);if(Array.isArray(r.config.filter_subjects&&!Array.isArray(a.config.filter_subjects)))throw new Error("jetstream server doesn't support consumers with multiple filter subjects");r.name=a.name,r.config=a.config,r.last=a}static ingestionFn(r){return(a,l)=>{var m;const u=l;if(!a)return{ingest:!1,protocol:!1};const c=a;if(Za(c.msg)||(m=u.monitor)==null||m.work(),Hh(c.msg)){const d=r?u._checkHbOrderConsumer(c.msg):!0;return r||u.info.flow_control.heartbeat_count++,{ingest:d,protocol:!0}}else if(Ph(c.msg))return u.info.flow_control.fc_count++,{ingest:!0,protocol:!0};return{ingest:r?u._checkOrderedConsumer(a):!0,protocol:!1}}}}class Ed{constructor(n){C(this,"options");C(this,"protocol");C(this,"draining");C(this,"listeners");C(this,"_services");this.draining=!1,this.options=EE(n),this.listeners=[]}static connect(n={}){return new Promise((r,a)=>{const l=new Ed(n);Su.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=>{a(u)})})}closed(){return this.protocol.closed}async close(){await this.protocol.close()}_check(n,r,a){if(this.isClosed())throw Ne.errorForCode(Ee.ConnectionClosed);if(r&&this.isDraining()||a&&this.protocol.noMorePublishing)throw Ne.errorForCode(Ee.ConnectionDraining);if(n=n||"",n.length===0)throw Ne.errorForCode(Ee.BadSubject)}publish(n,r,a){this._check(n,!1,!0),this.protocol.publish(n,r,a)}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 a=new e1(this.protocol,n,r);return this.protocol.subscribe(a),a}_resub(n,r,a){this._check(r,!0,!1);const l=n;l.max=a,a&&(l.max=a+l.received),this.protocol.resub(l,r)}requestMany(n,r=Ln,a={maxWait:1e3,maxMessages:-1}){const l=!this.protocol.options.noAsyncTraces;try{this._check(n,!0,!0)}catch(m){return Promise.reject(m)}if(a.strategy=a.strategy||lr.Timer,a.maxWait=a.maxWait||1e3,a.maxWait<1)return Promise.reject(new Ne("timeout",Ee.InvalidOption));const u=new Jt;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(a.noMux){const m=l?new Error().stack:null;let d=typeof a.maxMessages=="number"&&a.maxMessages>0?a.maxMessages:-1;const y=this.subscribe(Yr(this.options.inboxPrefix),{callback:(k,z)=>{var B,M;if(((B=z==null?void 0:z.data)==null?void 0:B.length)===0&&((M=z==null?void 0:z.headers)==null?void 0:M.status)===Ee.NoResponders&&(k=Ne.errorForCode(Ee.NoResponders)),k){m&&(k.stack+=`
|
|
82
|
+
|
|
83
|
+
${m}`),g(k);return}f(null,z),a.strategy===lr.Count&&(d--,d===0&&g()),a.strategy===lr.JitterTimer&&(x(),b=setTimeout(()=>{g()},300)),a.strategy===lr.SentinelMsg&&z&&z.data.length===0&&g()}});y.requestSubject=n,y.closed.then(()=>{c()}).catch(k=>{u.stop(k)});const g=k=>{k&&u.push(()=>{throw k}),x(),y.drain().then(()=>{c()}).catch(z=>{c()})};u.iterClosed.then(()=>{x(),y==null||y.unsubscribe()}).catch(k=>{x(),y==null||y.unsubscribe()});try{this.publish(n,r,{reply:y.getSubject()})}catch(k){g(k)}let b=setTimeout(()=>{g()},a.maxWait);const x=()=>{b&&clearTimeout(b)}}else{const m=a;m.callback=f,u.iterClosed.then(()=>{d.cancel()}).catch(y=>{d.cancel(y)});const d=new F_(this.protocol.muxSubscriptions,n,m);this.protocol.request(d);try{this.publish(n,r,{reply:`${this.protocol.muxSubscriptions.baseInbox}${d.token}`,headers:a.headers})}catch(y){d.cancel(y)}}return Promise.resolve(u)}request(n,r,a={timeout:1e3,noMux:!1}){try{this._check(n,!0,!0)}catch(u){return Promise.reject(u)}const l=!this.protocol.options.noAsyncTraces;if(a.timeout=a.timeout||1e3,a.timeout<1)return Promise.reject(new Ne("timeout",Ee.InvalidOption));if(!a.noMux&&a.reply)return Promise.reject(new Ne("reply can only be used with noMux",Ee.InvalidOption));if(a.noMux){const u=a.reply?a.reply:Yr(this.options.inboxPrefix),c=Ot(),f=l?new Error:null,m=this.subscribe(u,{max:1,timeout:a.timeout,callback:(d,y)=>{d?(f&&d.code!==Ee.Timeout&&(d.stack+=`
|
|
84
|
+
|
|
85
|
+
${f.stack}`),m.unsubscribe(),c.reject(d)):(d=G0(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:a.headers}),c}else{const u=new J0(this.protocol.muxSubscriptions,n,a,l);this.protocol.request(u);try{this.publish(n,r,{reply:`${this.protocol.muxSubscriptions.baseInbox}${u.token}`,headers:a.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(Ee.ConnectionClosed)):this.protocol.flush()}drain(){return this.isClosed()?Promise.reject(Ne.errorForCode(Ee.ConnectionClosed)):this.isDraining()?Promise.reject(Ne.errorForCode(Ee.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 Jt;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,a)=>r==="time"?new Date(Date.parse(a)):a)}stats(){return{inBytes:this.protocol.inBytes,outBytes:this.protocol.outBytes,inMsgs:this.protocol.inMsgs,outMsgs:this.protocol.outMsgs}}async jetstreamManager(n={}){const r=new ZE(this,n);if(n.checkAPI!==!1)try{await r.getAccountInfo()}catch(a){const l=a;throw l.code===Ee.NoResponders&&(l.code=Ee.JetStreamNotEnabled),l}return r}jetstream(n={}){return new _d(this,n)}getServerVersion(){const n=this.info;return n?na(n.version):void 0}async rtt(){if(!this.protocol._closed&&!this.protocol.connected)throw Ne.errorForCode(Ee.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 nk(this)),this._services}reconnect(){return this.isClosed()?Promise.reject(Ne.errorForCode(Ee.ConnectionClosed)):this.isDraining()?Promise.reject(Ne.errorForCode(Ee.ConnectionDraining)):this.protocol.reconnect()}}class nk{constructor(n){C(this,"nc");this.nc=n}add(n){try{return new Ml(this.nc,n).start()}catch(r){return Promise.reject(r)}}client(n,r){return new zE(this.nc,n,r)}}class rk{constructor(n,r,a){C(this,"bucket");C(this,"sm");C(this,"prefixLen");this.bucket=n,this.prefixLen=r,this.sm=a}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(_u)||"PUT"}get length(){const n=this.sm.header.get(fn.MessageSizeHdr)||"";return n!==""?parseInt(n,10):this.sm.data.length}json(){return this.sm.json()}string(){return this.sm.string()}}class ik{constructor(n,r,a){C(this,"bucket");C(this,"key");C(this,"sm");this.bucket=n,this.key=r,this.sm=a}get value(){return this.sm.data}get created(){return new Date(bd(this.sm.info.timestampNanos))}get revision(){return this.sm.seq}get operation(){var n;return((n=this.sm.headers)==null?void 0:n.get(_u))||"PUT"}get delta(){return this.sm.info.pending}get length(){var r;const n=((r=this.sm.headers)==null?void 0:r.get(fn.MessageSizeHdr))||"";return n!==""?parseInt(n,10):this.sm.data.length}json(){return this.sm.json()}string(){return this.sm.string()}}class i1 extends V_{constructor(r,a,l){super(r.nc,a,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 a=Yr(this.js.nc.options.inboxPrefix);this.js.nc._resub(this.sub,a);const u=this.info;u.config.name=Ni.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=a,u.config.deliver_subject=a,u.config.deliver_policy=Bt.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}`,Ee.RequestError,m);this.sub.callback(d,{})})}_maybeSetupHbMonitoring(){var a,l;const r=((l=(a=this.info)==null?void 0:a.config)==null?void 0:l.idle_heartbeat)||0;r&&this._setupHbMonitoring(bd(r))}_setupHbMonitoring(r,a=0){const l={cancelAfter:0,maxOut:2};a&&(l.cancelAfter=a);const u=this.sub,c=f=>{var y,g,b,x;const m=A_(409,`${Qn.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 k=((b=(g=this.info)==null?void 0:g.ordered_consumer_sequence)==null?void 0:b.stream_seq)||0;return this._resetOrderedConsumer(k+1),(x=this.monitor)==null||x.restart(),!1}return!u.noIterator};this.monitor=new xd(r,c,l)}_checkHbOrderConsumer(r){const a=r.headers.get(fn.ConsumerStalledHdr);a!==""&&this.js.nc.publish(a);const l=parseInt(r.headers.get(fn.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 a=this.info.ordered_consumer_sequence,l=r.info.streamSequence,u=r.info.deliverySequence;return u!=a.delivery_seq+1?(this._resetOrderedConsumer(a.stream_seq+1),!1):(a.delivery_seq=u,a.stream_seq=l,!0)}async destroy(){this.isClosed()||await this.drain();const r=this.sub.info,a=r.config.durable_name||r.name,l=`${r.api.prefix}.CONSUMER.DELETE.${r.stream}.${a}`;await r.api._request(l)}async consumerInfo(){const r=this.sub.info,a=r.config.durable_name||r.name,l=`${r.api.prefix}.CONSUMER.INFO.${r.stream}.${a}`,u=await r.api._request(l);return r.last=u,u}}class ak extends i1{constructor(n,r,a){super(n,r,a)}pull(n={batch:1}){const{stream:r,config:a,name:l}=this.sub.info,u=a.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=Nt(f));let m=0;if(n.idle_heartbeat&&n.idle_heartbeat>0&&(m=n.idle_heartbeat,c.idle_heartbeat=Nt(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 sk(e,n){return e?ok(n):lk(n)}function lk(e){return(n,r)=>n?[n,null]:(n=Za(r),n?[n,null]:[null,kl(r,e)])}function ok(e){return(n,r)=>{if(n)return[n,null];const a=Za(r);return a!==null?[a1(a),null]:[null,kl(r,e)]}}function a1(e){if(e!==null)switch(e.code){case Ee.JetStream404NoMessages:case Ee.JetStream408RequestTimeout:return null;case Ee.JetStream409:return T_(e)?e:null;default:return e}return null}function uk(e){e&&e.ack()}function ck(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 fk{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=ck(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]===sl[0]&&n[1]===sl[1]&&n[2]===sl[2]&&n[3]===sl[3]}async ackAck(n){var a;n=n||{},n.timeout=n.timeout||this.timeout;const r=Ot();if(this.didAck)r.resolve(!1);else if(this.didAck=!0,this.msg.reply){const u=this.msg.publisher,c=!((a=u.options)!=null&&a.noAsyncTraces),f=new J0(u.muxSubscriptions,this.msg.reply,{timeout:n.timeout},c);u.request(f);try{u.publish(this.msg.reply,gb,{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(gb)}nak(n){let r=GE;n&&(r=bu().encode(`-NAK ${JSON.stringify({delay:Nt(n)})}`)),this.doAck(r)}working(){this.doAck(sl)}next(n,r={batch:1}){const a={};a.batch=r.batch||1,a.no_wait=r.no_wait||!1,r.expires&&r.expires>0&&(a.expires=Nt(r.expires));const l=or().encode(a),u=is.concat(YE,JE,l),c=n?{reply:n}:void 0;this.msg.respond(u,c)}term(n=""){let r=VE;(n==null?void 0:n.length)>0&&(r=bu().encode(`+TERM ${n}`)),this.doAck(r)}json(){return this.msg.json()}string(){return this.msg.string()}}const hk="1.30.3",dk="nats.ws";class mk{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=hk,this.lang=dk,this.connected=!1,this.done=!1,this.socketClosed=!1,this.encrypted=!1,this.peeked=!1,this.yields=[],this.signal=Ot(),this.closedNotification=Ot()}async connect(n,r){const a=Ot();if(r.tls)return a.reject(new Ne("tls",Ee.InvalidOption)),a;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=is.concat(...this.yields),f=W_(c);if(f!==""){const m=AE.exec(f);if(!m){r.debug&&console.error("!!!",Zo(c)),a.reject(new Error("unexpected response from server"));return}try{const d=JSON.parse(m[1]);kE(d,this.options),this.peeked=!0,this.connected=!0,this.signal.resolve(),a.resolve()}catch(d){a.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,Ee.Unknown,new Error(c.error));a.reject(f)},a}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 us(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(`> ${Zo(n[r])}`),yield n[r];if(this.done)break;this.yields.length===0&&(n.length=0,this.yields=n,this.signal=Ot())}}isEncrypted(){return this.connected&&this.encrypted}send(n){if(!this.isDiscarded())try{this.socket.send(n.buffer),this.options.debug&&console.info(`< ${Zo(n)}`);return}catch(r){this.options.debug&&console.error(`!!! ${Zo(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 pk(e,n){/^(.*:\/\/)(.*)/.test(e)||(typeof n=="boolean"?e=`${n===!0?"https":"http"}://${e}`:e=`https://${e}`);let a=new URL(e);const l=a.protocol.toLowerCase();l==="ws:"&&(n=!1),l==="wss:"&&(n=!0),l!=="https:"&&l!=="http"&&(e=e.replace(/^(.*:\/\/)(.*)/gm,"$2"),a=new URL(`http://${e}`));let u,c;const f=a.hostname,m=a.pathname,d=a.search||"";switch(l){case"http:":case"ws:":case"nats:":c=a.port||"80",u="ws:";break;case"https:":case"wss:":case"tls:":c=a.port||"443",u="wss:";break;default:c=a.port||n===!0?"443":"80",u=n===!0?"wss:":"ws:";break}return`${u}//${f}:${c}${m}${d}`}function s1(e={}){return J_({defaultPort:443,urlParseFn:pk,factory:()=>new mk}),Ed.connect(e)}/*! Capacitor: https://capacitorjs.com/ - MIT License */var as;(function(e){e.Unimplemented="UNIMPLEMENTED",e.Unavailable="UNAVAILABLE"})(as||(as={}));class fh extends Error{constructor(n,r,a){super(n),this.message=n,this.code=r,this.data=a}}const gk=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"},yk=e=>{const n=e.CapacitorCustomPlatform||null,r=e.Capacitor||{},a=r.Plugins=r.Plugins||{},l=()=>n!==null?n.name:gk(e),u=()=>l()!=="web",c=g=>{const b=d.get(g);return!!(b!=null&&b.platforms.has(l())||f(g))},f=g=>{var b;return(b=r.PluginHeaders)===null||b===void 0?void 0:b.find(x=>x.name===g)},m=g=>e.console.error(g),d=new Map,y=(g,b={})=>{const x=d.get(g);if(x)return console.warn(`Capacitor plugin "${g}" already registered. Cannot register plugins twice.`),x.proxy;const k=l(),z=f(g);let B;const M=async()=>(!B&&k in b?B=typeof b[k]=="function"?B=await b[k]():B=b[k]:n!==null&&!B&&"web"in b&&(B=typeof b.web=="function"?B=await b.web():B=b.web),B),F=(J,Y)=>{var N,Q;if(z){const Z=z==null?void 0:z.methods.find(ge=>Y===ge.name);if(Z)return Z.rtype==="promise"?ge=>r.nativePromise(g,Y.toString(),ge):(ge,fe)=>r.nativeCallback(g,Y.toString(),ge,fe);if(J)return(N=J[Y])===null||N===void 0?void 0:N.bind(J)}else{if(J)return(Q=J[Y])===null||Q===void 0?void 0:Q.bind(J);throw new fh(`"${g}" plugin is not implemented on ${k}`,as.Unimplemented)}},G=J=>{let Y;const N=(...Q)=>{const Z=M().then(ge=>{const fe=F(ge,J);if(fe){const H=fe(...Q);return Y=H==null?void 0:H.remove,H}else throw new fh(`"${g}.${J}()" is not implemented on ${k}`,as.Unimplemented)});return J==="addListener"&&(Z.remove=async()=>Y()),Z};return N.toString=()=>`${J.toString()}() { [capacitor code] }`,Object.defineProperty(N,"name",{value:J,writable:!1,configurable:!1}),N},se=G("addListener"),O=G("removeListener"),j=(J,Y)=>{const N=se({eventName:J},Y),Q=async()=>{const ge=await N;O({eventName:J,callbackId:ge},Y)},Z=new Promise(ge=>N.then(()=>ge({remove:Q})));return Z.remove=async()=>{console.warn("Using addListener() without 'await' is deprecated."),await Q()},Z},V=new Proxy({},{get(J,Y){switch(Y){case"$$typeof":return;case"toJSON":return()=>({});case"addListener":return z?j:se;case"removeListener":return O;default:return G(Y)}}});return a[g]=V,d.set(g,{name:g,proxy:V,platforms:new Set([...Object.keys(b),...z?[k]:[]])}),V};return r.convertFileSrc||(r.convertFileSrc=g=>g),r.getPlatform=l,r.handleError=m,r.isNativePlatform=u,r.isPluginAvailable=c,r.registerPlugin=y,r.Exception=fh,r.DEBUG=!!r.DEBUG,r.isLoggingEnabled=!!r.isLoggingEnabled,r},bk=e=>e.Capacitor=yk(e),Un=bk(typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}),cr=Un.registerPlugin;class kd{constructor(){this.listeners={},this.retainedEventArguments={},this.windowListeners={}}addListener(n,r){let a=!1;this.listeners[n]||(this.listeners[n]=[],a=!0),this.listeners[n].push(r);const u=this.windowListeners[n];u&&!u.registered&&this.addWindowListener(u),a&&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,a){const l=this.listeners[n];if(!l){if(a){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:a=>{this.notifyListeners(r,a)}}}unimplemented(n="not implemented"){return new Un.Exception(n,as.Unimplemented)}unavailable(n="not available"){return new Un.Exception(n,as.Unavailable)}async removeListener(n,r){const a=this.listeners[n];if(!a)return;const l=a.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(a=>{this.notifyListeners(n,a)}))}}const bb=e=>encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape),vb=e=>e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent);class vk extends kd{async getCookies(){const n=document.cookie,r={};return n.split(";").forEach(a=>{if(a.length<=0)return;let[l,u]=a.replace(/=/,"CAP_COOKIE").split("CAP_COOKIE");l=vb(l).trim(),u=vb(u).trim(),r[l]=u}),r}async setCookie(n){try{const r=bb(n.key),a=bb(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}=${a||""}${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)}}}cr("CapacitorCookies",{web:()=>new vk});const xk=async e=>new Promise((n,r)=>{const a=new FileReader;a.onload=()=>{const l=a.result;n(l.indexOf(",")>=0?l.split(",")[1]:l)},a.onerror=l=>r(l),a.readAsDataURL(e)}),wk=(e={})=>{const n=Object.keys(e);return Object.keys(e).map(l=>l.toLocaleLowerCase()).reduce((l,u,c)=>(l[u]=e[n[c]],l),{})},Sk=(e,n=!0)=>e?Object.entries(e).reduce((a,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}`),`${a}&${m}`},"").substr(1):null,_k=(e,n={})=>{const r=Object.assign({method:e.method||"GET",headers:e.headers},n),l=wk(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 Ek extends kd{async request(n){const r=_k(n,n.webFetchExtra),a=Sk(n.params,n.shouldEncodeUrlParams),l=a?`${n.url}?${a}`: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 xk(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,b)=>{y[b]=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"}))}}cr("CapacitorHttp",{web:()=>new Ek});var xb;(function(e){e.Dark="DARK",e.Light="LIGHT",e.Default="DEFAULT"})(xb||(xb={}));var wb;(function(e){e.StatusBar="StatusBar",e.NavigationBar="NavigationBar"})(wb||(wb={}));class kk extends kd{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")}}cr("SystemBars",{web:()=>new kk});const Cd=Un.isNativePlatform()?"https://app.palmier.me":"";async function l1(e,n,r,a){const l=`${Cd}${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 l1("POST",e,n)}function Ak(e,n){return l1("GET",e,void 0)}const o1=L.createContext({connected:!1,mode:"disconnected",nc:null,request(){return Promise.reject(new Error("No host connection"))},subscribeEvents(){return()=>{}},activeHost:null,unauthorized:!1}),Tk=2e3,hh=6e3;function jk({children:e}){const{getActiveHost:n}=Ol(),r=n(),[a,l]=L.useState(null),[u,c]=L.useState(!1),f=L.useRef(null),[m,d]=L.useState(!1),[y,g]=L.useState(!1),b=L.useRef(bu()),x=L.useRef(new Set),k=L.useRef(0),z=r!=null&&!!r.directUrl,B=r?z?m?"direct":"disconnected":u?"nats":"disconnected":"disconnected",M=B!=="disconnected";L.useEffect(()=>{g(!1)},[r==null?void 0:r.hostId,r==null?void 0:r.clientToken]),L.useEffect(()=>{if(z){f.current&&(f.current.close().catch(()=>{}),f.current=null,l(null),c(!1));return}if(!r)return;let se=!1;async function O(){try{const j=await fetch(`${Cd}/api/config`);if(!j.ok){console.error("[NATS] Failed to fetch config");return}const V=await j.json();if(!V.natsWsUrl){console.warn("[NATS] No WebSocket URL configured");return}if(se)return;console.log("[NATS] Connecting to",V.natsWsUrl);const J=await s1({servers:V.natsWsUrl,token:V.natsToken});if(se){J.close().catch(()=>{});return}console.log("[NATS] Connected"),f.current=J,l(J),c(!0),J.closed().then(()=>{console.log("[NATS] Connection closed"),se||(l(null),c(!1),f.current=null)})}catch(j){console.error("[NATS] Connection failed:",j),se||c(!1)}}return O(),()=>{se=!0,f.current&&(f.current.close().catch(()=>{}),f.current=null,l(null),c(!1))}},[z,r]),L.useEffect(()=>{if(!r||!z){d(!1);return}const se=new AbortController;async function O(){var Y;const V=new AbortController,J=setTimeout(()=>V.abort(),Tk);se.signal.addEventListener("abort",()=>V.abort());try{const N=await fetch(`${r.directUrl}/events`,{headers:{Authorization:`Bearer ${r.clientToken}`},signal:V.signal});return clearTimeout(J),N.ok?((Y=N.body)==null?void 0:Y.getReader())??null:null}catch{return clearTimeout(J),null}}async function j(V){d(!0),console.log("[HOST] SSE connected to",r.directUrl),k.current=Date.now();function J(){setTimeout(()=>{se.signal.aborted||Date.now()-k.current<hh||(console.log("[HOST] Heartbeat timeout — no data for",hh/1e3,"s"),se.abort(),d(!1),console.log("[HOST] Direct host unreachable"))},hh)}J();const Y=new TextDecoder;let N="";try{for(;;){const{done:Q,value:Z}=await V.read();if(Q)break;N+=Y.decode(Z,{stream:!0}),k.current=Date.now(),J();const ge=N.split(`
|
|
88
|
+
`);N=ge.pop()??"";for(const fe of ge)if(fe.startsWith("data: ")){const H=fe.slice(6);try{const q=JSON.parse(H);if(q.task_id&&q.event_type){const re=`host-event.${r.hostId}.${q.task_id}`;for(const ye of x.current)ye({subject:re,data:b.current.encode(H)})}}catch{}}}}catch{}}return(async()=>{const V=await O();V&&await j(V)})(),()=>{se.abort(),d(!1)}},[r,z]);const F=L.useCallback(async(se,O,j)=>{if(!r)throw new Error("No active host");function V(ge){ge&&typeof ge=="object"&&ge.error==="Unauthorized"&&g(!0)}if(z){console.log(`[HOST/HTTP] → ${se}`,O??"");const ge=await fetch(`${r.directUrl}/rpc/${se}`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${r.clientToken}`},body:O!=null?JSON.stringify(O):void 0,signal:j!=null&&j.timeout?AbortSignal.timeout(j.timeout):void 0});if(ge.status===401)throw g(!0),new Error("Unauthorized");const fe=await ge.json();return V(fe),console.log(`[HOST/HTTP] ← ${se}`,fe),fe}if(!f.current)throw new Error("Not connected");const J=`host.${r.hostId}.rpc.${se}`,Y={...O??{},clientToken:r.clientToken},N=b.current.encode(JSON.stringify(Y));console.log(`[HOST/NATS] → ${se}`,O??"");const Q=await f.current.request(J,N,{timeout:(j==null?void 0:j.timeout)??1e4}),Z=JSON.parse(b.current.decode(Q.data));return V(Z),console.log(`[HOST/NATS] ← ${se}`,Z),Z},[r,z]),G=L.useCallback((se,O)=>{if(z)return x.current.add(O),()=>{x.current.delete(O)};if(f.current){const j=f.current.subscribe(`host-event.${se}.>`);let V=!1;return(async()=>{try{for await(const J of j){if(V)break;O({subject:J.subject,data:J.data})}}catch{}})(),()=>{V=!0,j.unsubscribe()}}return()=>{}},[r,z]);return w.jsx(o1.Provider,{value:{connected:M,mode:B,nc:a,request:F,subscribeEvents:G,activeHost:r,unauthorized:y},children:e})}function Ad(){return L.useContext(o1)}function Eu(e){const n=new Date(e),r=new Date,a=n.toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"});return n.toDateString()===r.toDateString()?a:`${n.toLocaleDateString(void 0,{month:"short",day:"numeric"})} ${a}`}const u1={};function Nk(e){for(const n of e)u1[n.key]=n.label}function Zh(e){return u1[e]??e}const Ok=()=>window.matchMedia("(max-width: 600px)").matches;function Rk({task:e,lastEvent:n,onEdit:r,onDelete:a,onViewRun:l}){const{request:u}=Ad(),[c,f]=L.useState(!1),[m,d]=L.useState(!1),[y,g]=L.useState(!1),b=L.useRef(null),x=(n==null?void 0:n.running_state)==="started",k=!e.triggers_enabled||e.triggers.length===0?"var(--color-text-secondary)":x?"var(--color-success)":(n==null?void 0:n.running_state)==="failed"?"var(--color-error)":"var(--color-success)";L.useEffect(()=>{if(!m)return;function N(Q){b.current&&!b.current.contains(Q.target)&&d(!1)}return document.addEventListener("mousedown",N),()=>document.removeEventListener("mousedown",N)},[m]);function z(){Ok()?g(!0):d(N=>!N)}function B(){d(!1),g(!1)}async function M(){if(B(),!!confirm("Abort this task?")){f(!0);try{await u("task.abort",{id:e.id})}catch(N){console.error("Abort failed:",N)}finally{f(!1)}}}async function F(){B();try{const N=await u("task.run",{id:e.id});l(e.id,N.run_id)}catch(N){console.error("Run failed:",N)}}async function G(){if(B(),!!confirm("Delete this task? Results and reports will be kept."))try{await u("task.delete",{id:e.id}),a(e.id)}catch(N){console.error("Delete failed:",N)}}const se={started:"Started",finished:"Finished",aborted:"Aborted",failed:"Failed"};function O(N){if(N.length===0)return"";if(N.length===1)return V(N[0]);const Q=N.map(j);if(new Set(Q.map(ge=>ge.kind)).size===1){const ge=Q[0].kind;if(ge==="hourly")return"Every hour";const fe=Q.map(H=>H.detail);return`${ge.charAt(0).toUpperCase()+ge.slice(1)}: ${fe.join(", ")}`}return N.map(V).join(", ")}function j(N){if(N.type==="once"){const _e=new Date(N.value);return{kind:"once",detail:isNaN(_e.getTime())?N.value:`${_e.toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"})} at ${_e.toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"})}`}}const Q=N.value.split(" ");if(Q.length!==5)return{kind:"unknown",detail:N.value};const[Z,ge,fe,,H]=Q,q=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];if(ge==="*")return{kind:"hourly",detail:""};const re=new Date;re.setHours(Number(ge),Number(Z),0,0);const ye=re.toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"});return H!=="*"?{kind:"weekly",detail:`${q[Number(H)]??H} at ${ye}`}:fe!=="*"?{kind:"monthly",detail:`day ${fe} at ${ye}`}:{kind:"daily",detail:ye}}function V(N){const Q=j(N);return Q.kind==="hourly"?"Every hour":Q.kind==="once"?`Once on ${Q.detail}`:`${Q.kind.charAt(0).toUpperCase()+Q.kind.slice(1)}: ${Q.detail}`}const J=O(e.triggers),Y=w.jsxs(w.Fragment,{children:[w.jsxs("button",{onClick:()=>{B(),r(e)},children:[w.jsx("span",{className:"menu-icon",children:"✎"}),"Edit"]}),w.jsxs("button",{onClick:()=>{B(),l(e.id)},children:[w.jsx("span",{className:"menu-icon",children:"📄"}),"View All Runs"]}),x?w.jsxs("button",{className:"menu-item-danger",onClick:M,disabled:c,children:[w.jsx("span",{className:"menu-icon",children:"◼"}),"Abort"]}):w.jsxs(w.Fragment,{children:[w.jsxs("button",{onClick:F,children:[w.jsx("span",{className:"menu-icon",children:"▶"}),"Run Now"]}),w.jsxs("button",{className:"menu-item-danger",onClick:G,children:[w.jsx("span",{className:"menu-icon",children:"🗑"}),"Delete"]})]})]});return w.jsxs(w.Fragment,{children:[w.jsxs("div",{className:"task-card",onClick:()=>x?l(e.id,"latest"):l(e.id),children:[w.jsxs("div",{className:"task-card-header",children:[w.jsxs("div",{className:"task-card-title-row",children:[x?w.jsx("span",{className:"status-spinner",children:w.jsx("span",{})}):w.jsx("span",{className:"status-dot",style:{backgroundColor:k}}),w.jsx("h3",{className:"task-card-name",children:e.name||e.user_prompt})]}),w.jsx("div",{className:"task-card-actions",onClick:N=>N.stopPropagation(),children:w.jsxs("div",{className:"task-card-menu",ref:b,children:[w.jsx("button",{className:"task-card-menu-btn",onClick:z,"aria-label":"Task actions",children:"⋮"}),m&&w.jsx("div",{className:"task-card-menu-dropdown",children:Y})]})})]}),w.jsxs("div",{className:"task-card-meta",children:[e.agent&&w.jsx("span",{className:"task-card-agent",children:Zh(e.agent)}),n&&se[n.running_state]&&w.jsxs("span",{className:"task-card-last-event",children:[se[n.running_state]," ",Eu(n.time_stamp)]}),e.triggers.length>0&&w.jsx("span",{className:"task-card-triggers",children:e.triggers_enabled?J:"Triggers disabled"})]})]}),y&&mu.createPortal(w.jsx("div",{className:"bottom-sheet-overlay",onClick:()=>g(!1),children:w.jsxs("div",{className:"bottom-sheet",onClick:N=>N.stopPropagation(),children:[w.jsx("div",{className:"bottom-sheet-handle"}),w.jsx("div",{className:"bottom-sheet-title",children:e.name||e.user_prompt}),w.jsx("div",{className:"bottom-sheet-actions",children:Y})]})}),document.body)]})}function Mk({permissions:e}){return w.jsxs("div",{className:"plan-dialog",children:[w.jsx("h2",{children:"Granted Permissions"}),w.jsx("div",{className:"plan-dialog-scroll",children:e&&e.length>0?w.jsx("div",{className:"permissions-section",children:w.jsx("ul",{className:"permissions-list",children:e.map((n,r)=>w.jsxs("li",{className:"permission-item",children:[w.jsx("span",{className:"permission-tool",children:n.name}),w.jsx("span",{className:"permission-desc",children:n.description})]},r))})}):w.jsx("p",{className:"plan-empty",children:"No permissions have been granted for this task."})}),w.jsx("div",{className:"plan-dialog-actions",children:w.jsx("button",{className:"btn btn-secondary",onClick:()=>history.back(),children:"Back"})})]})}const Va=[];function Dk(){const e=Va.pop();e&&(e.pushed.current=!1,e.close())}let Sb=!1;function zk(){Sb||(Sb=!0,window.addEventListener("popstate",Dk))}function Lk(e,n){const r=L.useRef(!1),a=L.useRef(n);a.current=n;const l=L.useCallback(()=>a.current(),[]),u=L.useRef({close:l,pushed:r});u.current.close=l,L.useEffect(()=>{if(e&&!r.current)zk(),history.pushState({modal:!0},""),Va.push(u.current),r.current=!0;else if(!e&&r.current){r.current=!1;const c=Va.indexOf(u.current);c!==-1&&Va.splice(c,1),history.back()}},[e,l]),L.useEffect(()=>{const c=u.current;return()=>{if(r.current){r.current=!1;const f=Va.indexOf(c);f!==-1&&Va.splice(f,1),history.back()}}},[])}const Uk=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];function Ci(e="daily"){return{schedule:e,time:"00:00",dayOfWeek:"1",dayOfMonth:"1",onceDate:"",onceTime:"00:00"}}function Bk(e){const n=e.split(" ");if(n.length!==5)return Ci();const[r,a,l,,u]=n;if(a==="*")return Ci("hourly");const c=`${a.padStart(2,"0")}:${r.padStart(2,"0")}`;return u!=="*"?{...Ci("weekly"),time:c,dayOfWeek:u}:l!=="*"?{...Ci("monthly"),time:c,dayOfMonth:l}:{...Ci("daily"),time:c}}function _b(e){if(e.type==="once"){const[n,r]=e.value.split("T");return{...Ci("once"),onceDate:n??"",onceTime:(r??"09:00").slice(0,5)}}return Bk(e.value)}function Pk(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 Hk(e){return e.schedule==="once"?e.onceDate?{type:"once",value:`${e.onceDate}T${e.onceTime}`}:null:{type:"cron",value:Pk(e)}}function qk({initial:e,agents:n,hostPlatform:r,onSaved:a,onRun:l,onCancel:u}){var rt;const{request:c}=Ad(),f=()=>{var Fe;const xe=localStorage.getItem("palmier:lastAgent"),Le=n.map(Tt=>Tt.key);return xe&&Le.includes(xe)?xe:((Fe=n[0])==null?void 0:Fe.key)??""},[m,d]=L.useState((e==null?void 0:e.user_prompt)??""),[y,g]=L.useState((e==null?void 0:e.agent)??f()),b=!!((rt=e==null?void 0:e.permissions)!=null&&rt.length),[x,k]=L.useState(!1),z=L.useCallback(()=>k(!1),[]);Lk(x,z);const[B,M]=L.useState(null),[F,G]=L.useState(()=>((e==null?void 0:e.triggers)??[]).map(_b)),[se,O]=L.useState(()=>{var xe;return((xe=((e==null?void 0:e.triggers)??[]).map(_b)[0])==null?void 0:xe.schedule)??"daily"}),[j,V]=L.useState((e==null?void 0:e.triggers_enabled)??!1),[J,Y]=L.useState((e==null?void 0:e.requires_confirmation)??!1),[N,Q]=L.useState((e==null?void 0:e.yolo_mode)??!1),[Z,ge]=L.useState((e==null?void 0:e.foreground_mode)??!1),[fe,H]=L.useState(null),q=fe!==null,[re,ye]=L.useState(!!(e!=null&&e.command)),[_e,R]=L.useState((e==null?void 0:e.command)??""),U=L.useRef(null),W=!!e,_=!W||m!==((e==null?void 0:e.user_prompt)??"")||y!==((e==null?void 0:e.agent)??"")||j!==((e==null?void 0:e.triggers_enabled)??!0)||J!==((e==null?void 0:e.requires_confirmation)??!1)||N!==((e==null?void 0:e.yolo_mode)??!1)||Z!==((e==null?void 0:e.foreground_mode)??!1)||re!==!!(e!=null&&e.command)||re&&_e!==((e==null?void 0:e.command)??"")||JSON.stringify(ze())!==JSON.stringify((e==null?void 0:e.triggers)??[]),he=j&&F.some(xe=>xe.schedule==="once"&&(!xe.onceDate||new Date(`${xe.onceDate}T${xe.onceTime}`)<=new Date)),pe=_&&!!m.trim()&&!he&&(!re||!!_e.trim());function ve(xe,Le){G(Fe=>Fe.map((Tt,hn)=>hn===xe?{...Tt,...Le}:Tt))}function je(xe){G(Le=>{const Fe=Le.filter((Tt,hn)=>hn!==xe);return Fe.length===0&&(V(!1),Y(!1)),Fe})}function De(){G(xe=>[...xe,Ci(se)])}function ke(xe){O(xe),G([Ci(xe)])}function ze(){return F.flatMap(xe=>{const Le=Hk(xe);return Le?[Le]:[]})}function $e(){return N?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 Ie(){H("save"),M(null);try{const xe=W?"task.update":"task.create",Le={user_prompt:m,agent:y,triggers:ze(),triggers_enabled:j,requires_confirmation:J,yolo_mode:N,foreground_mode:Z,command:re?_e:""};W&&(Le.id=e.id);const Fe=await c(xe,Le,{timeout:45e3});return Fe.error?(M(Fe.error),null):(W||localStorage.setItem("palmier:lastAgent",y),a(Fe),Fe)}catch(xe){return M(xe instanceof Error?xe.message:String(xe)),null}finally{H(null)}}async function qe(){H("run"),M(null);try{const Le=await c("task.run_oneoff",{user_prompt:m,agent:y,requires_confirmation:J,yolo_mode:N,foreground_mode:Z,command:re?_e:""});if(Le.error){M(Le.error);return}localStorage.setItem("palmier:lastAgent",y),l(Le.task_id,Le.run_id),u()}catch(xe){M(xe instanceof Error?xe.message:String(xe))}finally{H(null)}}return w.jsx("div",{className:"task-form-overlay",children:w.jsx("div",{className:"task-form",children:x?w.jsx(Mk,{permissions:e==null?void 0:e.permissions}):w.jsxs(w.Fragment,{children:[w.jsx("div",{className:"task-form-header",children:w.jsx("h2",{children:e?"Edit Task":"New Task"})}),B&&w.jsx("div",{className:"form-error",children:B}),w.jsx("textarea",{autoFocus:!e,className:"form-textarea",value:m,onChange:xe=>d(xe.target.value),placeholder:re?"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:q}),w.jsxs("div",{className:"plan-actions",children:[b&&w.jsx("button",{className:"btn btn-link",onClick:()=>k(!0),children:"Granted Permissions"}),w.jsxs("div",{className:"agent-picker-section-inline",style:{marginLeft:"auto"},children:[w.jsx("span",{className:"agent-picker-label",children:"Run with"}),w.jsx("select",{className:"form-select form-select-sm",value:y,onChange:xe=>g(xe.target.value),children:n.map(xe=>w.jsx("option",{value:xe.key,children:xe.label},xe.key))})]})]}),w.jsxs("div",{className:"toggles-group",children:[w.jsxs("div",{className:`command-section${re?" command-section-active":""}`,children:[w.jsxs("label",{className:"toggle-label",children:[w.jsx("input",{type:"checkbox",checked:re,onChange:xe=>{ye(xe.target.checked),xe.target.checked?setTimeout(()=>{var Le;return(Le=U.current)==null?void 0:Le.focus()},0):R("")},disabled:q}),"Reactive"]}),re&&w.jsxs(w.Fragment,{children:[w.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."}),w.jsx("input",{ref:U,className:"form-input form-input-mono",type:"text",value:_e,onChange:xe=>R(xe.target.value),placeholder:"gws gmail +watch --project my-project",disabled:q})]})]}),r==="win32"&&w.jsxs("label",{className:"toggle-label",children:[w.jsx("input",{type:"checkbox",checked:Z,onChange:xe=>ge(xe.target.checked),disabled:q}),"Run in the foreground (host must login to Windows)"]}),w.jsxs("label",{className:"toggle-label",children:[w.jsx("input",{type:"checkbox",checked:N,onChange:xe=>Q(xe.target.checked),disabled:q}),"Yolo mode"]}),N&&w.jsx("p",{className:"command-help-text",children:"The agent will auto-approve all tool calls without asking for permission."}),w.jsxs("div",{className:"triggers-section",children:[w.jsxs("label",{className:"toggle-label",children:[w.jsx("input",{type:"checkbox",checked:j,onChange:xe=>{xe.target.checked?(V(!0),F.length===0&&De()):(V(!1),Y(!1),G(Le=>{const Fe=Le.filter(Tt=>Tt.schedule==="once"?Tt.onceDate&&new Date(`${Tt.onceDate}T${Tt.onceTime}`)>new Date:!0);return Fe.length===1&&Fe[0].schedule==="daily"&&Fe[0].time==="00:00"?[]:Fe}))},disabled:q}),"Enable schedule"]}),w.jsxs("div",{className:`triggers-section-body${j?"":" disabled"}`,children:[F.length>0&&w.jsxs("select",{className:"form-select",value:se,disabled:!j,onChange:xe=>ke(xe.target.value),children:[w.jsx("option",{value:"once",children:"Specific Time"}),w.jsx("option",{value:"hourly",children:"Hourly"}),w.jsx("option",{value:"daily",children:"Daily"}),w.jsx("option",{value:"weekly",children:"Weekly"}),w.jsx("option",{value:"monthly",children:"Monthly"})]}),se!=="hourly"&&F.map((xe,Le)=>w.jsxs("div",{className:"trigger-row-card",children:[w.jsxs("div",{className:"trigger-row-content",children:[se==="daily"&&w.jsx("input",{className:"form-input",type:"time",value:xe.time,disabled:!j,onChange:Fe=>ve(Le,{time:Fe.target.value})}),se==="weekly"&&w.jsxs("div",{className:"trigger-row-top",children:[w.jsx("select",{className:"form-select",value:xe.dayOfWeek,disabled:!j,onChange:Fe=>ve(Le,{dayOfWeek:Fe.target.value}),children:Uk.map((Fe,Tt)=>w.jsx("option",{value:String(Tt),children:Fe},Tt))}),w.jsx("input",{className:"form-input",type:"time",value:xe.time,disabled:!j,onChange:Fe=>ve(Le,{time:Fe.target.value})})]}),se==="monthly"&&w.jsxs("div",{className:"trigger-row-top",children:[w.jsx("select",{className:"form-select",value:xe.dayOfMonth,disabled:!j,onChange:Fe=>ve(Le,{dayOfMonth:Fe.target.value}),children:Array.from({length:28},(Fe,Tt)=>Tt+1).map(Fe=>w.jsxs("option",{value:String(Fe),children:["Day ",Fe]},Fe))}),w.jsx("input",{className:"form-input",type:"time",value:xe.time,disabled:!j,onChange:Fe=>ve(Le,{time:Fe.target.value})})]}),se==="once"&&w.jsxs("div",{className:"trigger-row-top",children:[w.jsx("input",{className:"form-input",type:"date",value:xe.onceDate,min:new Date().toISOString().split("T")[0],disabled:!j,onChange:Fe=>ve(Le,{onceDate:Fe.target.value})}),w.jsx("input",{className:"form-input",type:"time",value:xe.onceTime,min:xe.onceDate===new Date().toISOString().split("T")[0]?new Date().toTimeString().slice(0,5):void 0,disabled:!j,onChange:Fe=>ve(Le,{onceTime:Fe.target.value})})]})]}),F.length>1&&w.jsx("button",{className:"trigger-remove-btn",onClick:()=>je(Le),disabled:!j,title:"Remove trigger",children:"×"})]},Le)),F.length>0&&se!=="hourly"&&w.jsx("button",{className:"trigger-add-btn",onClick:De,disabled:!j,children:"+ Add"})]})]}),j&&F.length>0&&w.jsxs("label",{className:"toggle-label",children:[w.jsx("input",{type:"checkbox",checked:J,onChange:xe=>Y(xe.target.checked),disabled:q}),"Confirm before each run"]})]}),!N&&(()=>{const xe=n.find(Le=>Le.key===y);return(xe==null?void 0:xe.supportsPermissions)===!1&&w.jsxs("div",{className:"form-warning",children:["Palmier does not support runtime permission granting for ",xe.label,". The task may fail if required permissions are not pre-configured."]})})(),w.jsxs("div",{className:"form-actions",children:[(()=>{const xe=F.length>0,Le=!!m.trim()&&(!re||!!_e.trim());return W?_?w.jsxs("button",{className:"btn btn-primary",onClick:()=>$e()&&Ie(),disabled:!pe||q,children:[fe==="save"&&w.jsx("span",{className:"btn-spinner"}),"Save"]}):w.jsx("button",{className:"btn btn-primary",disabled:!0,children:"Save"}):xe?w.jsxs("button",{className:"btn btn-primary",onClick:()=>$e()&&Ie(),disabled:!pe||q,children:[fe==="save"&&w.jsx("span",{className:"btn-spinner"}),"Schedule"]}):w.jsxs(w.Fragment,{children:[w.jsxs("button",{className:"btn btn-primary",onClick:()=>$e()&&qe(),disabled:!Le||q,children:[fe==="run"&&w.jsx("span",{className:"btn-spinner"}),"Run"]}),w.jsx("button",{className:"btn btn-secondary",onClick:()=>$e()&&Ie(),disabled:!pe||q,children:"Save"})]})})(),w.jsx("button",{className:"btn btn-secondary",onClick:()=>{_&&m.trim()&&!confirm("You have unsaved changes. Discard?")||u()},style:{marginLeft:"auto"},children:"Cancel"})]})]})})})}const Ik="0.7.4";function Fk(e,n){if(e.includes("-"))return!1;const r=e.split(".").map(Number),a=n.split(".").map(Number);for(let l=0;l<3;l++){if((r[l]??0)<(a[l]??0))return!0;if((r[l]??0)>(a[l]??0))return!1}return!1}function $k({connected:e,hostId:n,request:r,subscribeEvents:a,onViewRun:l,onUpdateRequired:u,onVersion:c,onCapabilityTokens:f}){const[m,d]=L.useState([]),[y,g]=L.useState(!1),[b,x]=L.useState(null),[k,z]=L.useState(new Map),[B,M]=L.useState(new Map),[F,G]=L.useState(new Map),[se,O]=L.useState(new Map),[j,V]=L.useState(new Map),[J,Y]=L.useState(!1),[N,Q]=L.useState(void 0),[Z,ge]=L.useState([]),[fe,H]=L.useState(),q=L.useCallback(()=>{Y(!1),Q(void 0)},[]),re=L.useCallback(async()=>{var _,he;if(e){g(!0),x(null);try{const pe=await r("task.list"),ve=pe.tasks??[],je=new Map,De=new Map,ke=new Map,ze=new Map,$e=new Map;for(const qe of ve)qe.status&&(je.set(qe.id,qe.status),(_=qe.status.pending_permission)!=null&&_.length&&ke.set(qe.id,qe.status.pending_permission),(he=qe.status.pending_input)!=null&&he.length&&(ze.set(qe.id,{questions:qe.status.pending_input}),$e.set(qe.id,new Array(qe.status.pending_input.length).fill(""))));z(je),M(De),G(ke),O(ze),V($e),d(ve),ge(pe.agents??[]),H(pe.host_platform),Nk(pe.agents??[]);const Ie=pe.version??null;c==null||c(Ie),f==null||f(pe.capability_tokens??{}),u==null||u(!!Ie&&Fk(Ie,Ik))}catch(pe){const ve=pe instanceof Error?pe.message:String(pe);ve==="Not connected"||ve.includes("503")||ve.toLowerCase().includes("no responders")?x(null):x(ve),d([])}finally{g(!1)}}},[e,n,r]);L.useEffect(()=>{e?re():(d([]),g(!1))},[e,n,re]),L.useEffect(()=>{if(!e||!n)return;const _={decode:pe=>new TextDecoder().decode(pe)};return a(n,async pe=>{var $e;const ve=pe.subject.split(".");if(ve.length<3)return;const je=ve.slice(2).join(".");let De={};try{De=JSON.parse(_.decode(pe.data))}catch{return}const ke=De.event_type,ze=De.session_id;if(ke==="input-request"&&ze){const Ie=De.input_questions,qe=De.agent_name,rt=De.description;Ie!=null&&Ie.length&&(O(xe=>{if(xe.has(ze))return xe;const Le=new Map(xe);return Le.set(ze,{questions:Ie,description:rt,agentName:qe}),Le}),V(xe=>{if(xe.has(ze))return xe;const Le=new Map(xe);return Le.set(ze,new Array(Ie.length).fill("")),Le}));return}if(ke==="input-resolved"&&ze){O(Ie=>{if(!Ie.has(ze))return Ie;const qe=new Map(Ie);return qe.delete(ze),qe}),V(Ie=>{const qe=new Map(Ie);return qe.delete(ze),qe});return}if(ke==="confirm-request"&&ze){const Ie=De.description,qe=De.agent_name;Ie&&M(rt=>{if(rt.has(ze))return rt;const xe=new Map(rt);return xe.set(ze,{description:Ie,agentName:qe}),xe});return}if(ke==="confirm-resolved"&&ze){M(Ie=>{if(!Ie.has(ze))return Ie;const qe=new Map(Ie);return qe.delete(ze),qe});return}if(ke==="permission-resolved"){G(Ie=>{if(!Ie.has(je))return Ie;const qe=new Map(Ie);return qe.delete(je),qe});return}try{const Ie=await r("task.status",{id:je},{timeout:5e3});if(Ie.error)return;z(qe=>{const rt=new Map(qe);return rt.set(je,Ie),rt}),($e=Ie.pending_permission)!=null&&$e.length&&G(qe=>{if(qe.has(je))return qe;const rt=new Map(qe);return rt.set(je,Ie.pending_permission),rt})}catch{}})},[e,n,a,r]);async function ye(_,he){try{await r("task.user_input",{id:_,value:[he]})}catch(pe){console.error("[TaskListView] Failed to respond to confirmation:",pe)}}async function _e(_,he){try{await r("task.user_input",{id:_,value:[he]})}catch(pe){console.error("[TaskListView] Failed to respond to permission request:",pe)}}async function R(_,he){try{await r("task.user_input",{id:_,value:he})}catch(pe){console.error("[TaskListView] Failed to respond to input request:",pe)}}function U(_){d(he=>{const pe=he.findIndex(ve=>ve.id===_.id);if(pe>=0){const ve=[...he];return ve[pe]=_,ve}return[_,...he]}),Y(!1),Q(void 0)}function W(_){d(he=>he.filter(pe=>pe.id!==_)),z(he=>{const pe=new Map(he);return pe.delete(_),pe}),O(he=>{const pe=new Map(he);return pe.delete(_),pe}),V(he=>{const pe=new Map(he);return pe.delete(_),pe})}return w.jsxs(w.Fragment,{children:[b&&w.jsxs("div",{className:"form-error",children:[b,b.toLowerCase().includes("failed to fetch")&&w.jsxs(w.Fragment,{children:[" ",w.jsx("a",{href:"#",onClick:_=>{_.preventDefault(),window.location.reload()},children:"Reload"})]})]}),w.jsx("div",{className:"new-task-input-card",onClick:()=>{Q(void 0),Y(!0)},role:"button",tabIndex:0,onKeyDown:_=>{(_.key==="Enter"||_.key===" ")&&(Q(void 0),Y(!0))},children:w.jsx("span",{className:"new-task-placeholder",children:"Describe your new task..."})}),y&&!m.length?w.jsx("div",{className:"task-list",children:[0,1,2].map(_=>w.jsxs("div",{className:"task-card",style:{pointerEvents:"none"},children:[w.jsx("div",{className:"task-card-header",children:w.jsxs("div",{className:"task-card-title-row",children:[w.jsx("div",{className:"skeleton-line",style:{width:10,height:10,borderRadius:"50%"}}),w.jsx("div",{className:"skeleton-line",style:{width:`${60+_*12}%`}})]})}),w.jsxs("div",{className:"task-card-meta",children:[w.jsx("div",{className:"skeleton-line",style:{width:"30%"}}),w.jsx("div",{className:"skeleton-line",style:{width:"25%"}})]})]},_))}):w.jsx("div",{className:"task-list",children:m.map(_=>w.jsx(Rk,{task:_,lastEvent:k.get(_.id),onEdit:async he=>{try{const pe=await r("task.get",{id:he.id});Q(pe.error?he:pe)}catch{Q(he)}Y(!0)},onDelete:W,onViewRun:l},_.id))}),J&&w.jsx(qk,{initial:N,agents:Z,hostPlatform:fe,onSaved:U,onRun:l,onCancel:q}),mu.createPortal(w.jsxs(w.Fragment,{children:[[...B.entries()].map(([_,{description:he,agentName:pe}])=>{var je;const ve=pe||((je=m.find(De=>De.id===_))==null?void 0:je.name);return w.jsx("div",{className:"confirm-modal-overlay",children:w.jsxs("div",{className:"confirm-modal",children:[w.jsx("h2",{className:"confirm-modal-title",children:"Confirmation Required"}),ve&&w.jsx("p",{className:"confirm-modal-subtitle",children:ve}),w.jsx("p",{className:"confirm-modal-message",children:he}),w.jsxs("div",{className:"confirm-modal-actions",children:[w.jsx("button",{className:"btn btn-primary",onClick:()=>ye(_,"confirmed"),children:"Confirm"}),w.jsx("button",{className:"btn btn-secondary",onClick:()=>ye(_,"aborted"),children:"Abort"})]})]})},_)}),[...F.entries()].map(([_,he])=>{const pe=m.find(ve=>ve.id===_);return w.jsx("div",{className:"confirm-modal-overlay",children:w.jsxs("div",{className:"confirm-modal permission-modal",children:[w.jsx("h2",{className:"confirm-modal-title",children:"Permission Required"}),w.jsx("p",{className:"confirm-modal-message",children:w.jsx("strong",{children:(pe==null?void 0:pe.name)||(pe==null?void 0:pe.user_prompt)||_})}),w.jsx("div",{className:"permission-list",children:he.map((ve,je)=>w.jsxs("div",{className:"permission-item",children:[w.jsx("span",{className:"permission-name",children:ve.name}),ve.description&&w.jsx("span",{className:"permission-desc",children:ve.description})]},je))}),w.jsxs("div",{className:"permission-actions",children:[w.jsx("button",{className:"btn btn-primary",onClick:()=>_e(_,"granted"),children:"Allow Once"}),w.jsx("button",{className:"btn btn-secondary",onClick:()=>_e(_,"granted_all"),children:"Allow Always"})]}),w.jsx("button",{className:"permission-abort-link",onClick:()=>_e(_,"aborted"),children:"Deny & Abort Task"})]})},_)}),[...se.entries()].map(([_,{questions:he,description:pe,agentName:ve}])=>{var ke;const je=j.get(_)??new Array(he.length).fill(""),De=ve||((ke=m.find(ze=>ze.id===_))==null?void 0:ke.name);return w.jsx("div",{className:"confirm-modal-overlay",children:w.jsxs("div",{className:"confirm-modal input-modal",children:[w.jsx("h2",{className:"confirm-modal-title",children:"Input Required"}),De&&w.jsx("p",{className:"confirm-modal-subtitle",children:De}),pe&&w.jsx("p",{className:"confirm-modal-message",children:pe}),w.jsx("div",{className:"input-list",children:he.map((ze,$e)=>w.jsxs("div",{className:"input-item",children:[w.jsx("label",{className:"input-label",children:ze}),w.jsx("input",{type:"text",className:"input-field",value:je[$e]??"",onChange:Ie=>{V(qe=>{const rt=new Map(qe),xe=[...rt.get(_)??[]];return xe[$e]=Ie.target.value,rt.set(_,xe),rt})},autoFocus:$e===0})]},$e))}),w.jsx("div",{className:"input-actions",children:w.jsx("button",{className:"btn btn-primary",disabled:je.some(ze=>!ze.trim()),onClick:()=>R(_,je),children:"Submit"})}),w.jsx("button",{className:"permission-abort-link",onClick:()=>R(_,["aborted"]),children:"Cancel"})]})},_)})]}),document.body)]})}function Gk(){const e=ia(),r=_r().pathname.startsWith("/runs");return w.jsxs(w.Fragment,{children:[w.jsxs("button",{className:`tab-btn ${r?"":"tab-btn-active"}`,onClick:()=>e("/"),children:[w.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:[w.jsx("rect",{x:"2",y:"2",width:"12",height:"12",rx:"2"}),w.jsx("path",{d:"M5.5 8L7 9.5L10.5 6"})]}),"Tasks"]}),w.jsxs("button",{className:`tab-btn ${r?"tab-btn-active":""}`,onClick:()=>e("/runs"),children:[w.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:w.jsx("path",{d:"M2 8H4.5L6 4L8 12L10 6L11.5 8H14"})}),"Runs"]})]})}const Yk="modulepreload",Vk=function(e){return"/"+e},Eb={},c1=function(n,r,a){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=Vk(d),d in Eb)return;Eb[d]=!0;const y=d.endsWith(".css"),g=y?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${d}"]${g}`))return;const b=document.createElement("link");if(b.rel=y?"stylesheet":Yk,y||(b.as="script"),b.crossOrigin="",b.href=d,m&&b.setAttribute("nonce",m),document.head.appendChild(b),y)return new Promise((x,k)=>{b.addEventListener("load",x),b.addEventListener("error",()=>k(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)})},Jk=cr("App",{web:()=>c1(()=>import("./web-DnuoxUd4.js"),[]).then(e=>new e.AppWeb)}),Wt=cr("Preferences",{web:()=>c1(()=>import("./web-7raT3zOZ.js"),[]).then(e=>new e.PreferencesWeb)});function f1(e){const[n,r]=L.useState(()=>window.matchMedia(e).matches);return L.useEffect(()=>{const a=window.matchMedia(e),l=u=>r(u.matches);return a.addEventListener("change",l),r(a.matches),()=>a.removeEventListener("change",l)},[e]),n}const nu=Un.isNativePlatform()?cr("LocationPermission"):null,dh=Un.isNativePlatform()?cr("NotificationListener"):null,mh=Un.isNativePlatform()?cr("SmsPermission"):null,ph=Un.isNativePlatform()?cr("ContactsPermission"):null,gh=Un.isNativePlatform()?cr("CalendarPermission"):null,yh=Un.isNativePlatform()?cr("DndAccess"):null,kb=!!window.__PALMIER_SERVE__,Cb=Un.isNativePlatform();function Ab({daemonVersion:e,capabilityTokens:n,activeClientToken:r,request:a,onCapabilityTokensChange:l}){var it;const{pairedHosts:u,activeHostId:c,setActiveHostId:f,removePairedHost:m,renamePairedHost:d}=Ol(),y=ia(),g=f1("(min-width: 768px)"),[b,x]=L.useState(!1),[k,z]=L.useState(!1),[B,M]=L.useState(null),[F,G]=L.useState(""),[se,O]=L.useState(null),[j,V]=L.useState(!1),[J,Y]=L.useState(!1),[N,Q]=L.useState(!1),[Z,ge]=L.useState(!1),[fe,H]=L.useState(!1),[q,re]=L.useState(!1),[ye,_e]=L.useState(!1),[R,U]=L.useState(!1);function W(Ce){return!!(r&&(n==null?void 0:n[Ce])===r)}const _=W("location"),he=W("notifications"),pe=W("sms"),ve=W("contacts"),je=W("calendar"),De=W("dnd"),ke=W("alert"),ze=W("battery");function $e(Ce,Ve){const st={};for(const[ot,ct]of Object.entries(n??{}))st[ot]=ct??null;st[Ce]=Ve?r??null:null,l==null||l(st)}L.useEffect(()=>{if(!Cb||!nu||!a)return;function Ce(){_&&nu.check().then(({fine:st})=>{st||a("device.location.disable").then(()=>{$e("location",!1)}).catch(()=>{})})}Ce();const Ve=Jk.addListener("resume",()=>{Ce()});return()=>{Ve.then(st=>st.remove())}},[_,r]);async function Ie(){if(!(!dh||!a)){Y(!0);try{if(he)await Wt.set({key:"notificationListenerEnabled",value:"false"}),await a("device.capability.disable",{capability:"notifications"}),$e("notifications",!1);else{const{enabled:Ce}=await dh.check();if(!Ce&&!(await dh.request()).enabled)return;const{value:Ve}=await Wt.get({key:"fcmToken"});if(!Ve){console.warn("No FCM token available");return}await Wt.set({key:"notificationListenerEnabled",value:"true"}),await a("device.capability.enable",{capability:"notifications",fcmToken:Ve}),$e("notifications",!0)}}catch(Ce){console.error("Failed to toggle notification listener:",Ce)}finally{Y(!1)}}}async function qe(){if(!(!mh||!a)){Q(!0);try{if(pe)await Wt.set({key:"smsListenerEnabled",value:"false"}),await a("device.capability.disable",{capability:"sms"}),$e("sms",!1);else{const{granted:Ce}=await mh.check();if(!Ce&&!(await mh.request()).granted)return;const{value:Ve}=await Wt.get({key:"fcmToken"});if(!Ve){console.warn("No FCM token available");return}await Wt.set({key:"smsListenerEnabled",value:"true"}),await a("device.capability.enable",{capability:"sms",fcmToken:Ve}),$e("sms",!0)}}catch(Ce){console.error("Failed to toggle SMS access:",Ce)}finally{Q(!1)}}}async function rt(){if(!(!ph||!a)){ge(!0);try{if(ve)await Wt.set({key:"contactsAccessEnabled",value:"false"}),await a("device.capability.disable",{capability:"contacts"}),$e("contacts",!1);else{const{granted:Ce}=await ph.check();if(!Ce&&!(await ph.request()).granted)return;const{value:Ve}=await Wt.get({key:"fcmToken"});if(!Ve){console.warn("No FCM token available");return}await Wt.set({key:"contactsAccessEnabled",value:"true"}),await a("device.capability.enable",{capability:"contacts",fcmToken:Ve}),$e("contacts",!0)}}catch(Ce){console.error("Failed to toggle contacts access:",Ce)}finally{ge(!1)}}}async function xe(){if(!(!gh||!a)){H(!0);try{if(je)await Wt.set({key:"calendarAccessEnabled",value:"false"}),await a("device.capability.disable",{capability:"calendar"}),$e("calendar",!1);else{const{granted:Ce}=await gh.check();if(!Ce&&!(await gh.request()).granted)return;const{value:Ve}=await Wt.get({key:"fcmToken"});if(!Ve){console.warn("No FCM token available");return}await Wt.set({key:"calendarAccessEnabled",value:"true"}),await a("device.capability.enable",{capability:"calendar",fcmToken:Ve}),$e("calendar",!0)}}catch(Ce){console.error("Failed to toggle calendar access:",Ce)}finally{H(!1)}}}async function Le(){if(!(!yh||!a)){re(!0);try{if(De)await a("device.capability.disable",{capability:"dnd"}),$e("dnd",!1);else{const{enabled:Ce}=await yh.check();if(!Ce&&!(await yh.request()).enabled)return;const{value:Ve}=await Wt.get({key:"fcmToken"});if(!Ve){console.warn("No FCM token available");return}await a("device.capability.enable",{capability:"dnd",fcmToken:Ve}),$e("dnd",!0)}}catch(Ce){console.error("Failed to toggle DND access:",Ce)}finally{re(!1)}}}async function Fe(){if(a){_e(!0);try{if(ke)await a("device.capability.disable",{capability:"alert"}),$e("alert",!1);else{const{value:Ce}=await Wt.get({key:"fcmToken"});if(!Ce){console.warn("No FCM token available");return}await a("device.capability.enable",{capability:"alert",fcmToken:Ce}),$e("alert",!0)}}catch(Ce){console.error("Failed to toggle alert access:",Ce)}finally{_e(!1)}}}async function Tt(){if(a){U(!0);try{if(ze)await a("device.capability.disable",{capability:"battery"}),$e("battery",!1);else{const{value:Ce}=await Wt.get({key:"fcmToken"});if(!Ce){console.warn("No FCM token available");return}await a("device.capability.enable",{capability:"battery",fcmToken:Ce}),$e("battery",!0)}}catch(Ce){console.error("Failed to toggle battery access:",Ce)}finally{U(!1)}}}async function hn(){if(a){V(!0);try{if(_)await a("device.location.disable"),$e("location",!1);else{if(nu&&!(await nu.request()).fine)return;const{value:Ce}=await Wt.get({key:"fcmToken"});if(!Ce){console.warn("No FCM token available");return}await a("device.location.enable",{fcmToken:Ce}),$e("location",!0)}}catch(Ce){console.error("Failed to toggle location:",Ce)}finally{V(!1)}}}const Wn=L.useRef(null),en=L.useRef(null),wn=L.useCallback(()=>{z(!0)},[]);function fr(){k&&(x(!1),z(!1))}function yt(){z(!1),x(!0)}function Mi(Ce,Ve){M(Ce),G(Ve)}function oe(){B&&F.trim()&&d(B,F.trim()),M(null),G("")}function Se(){M(null),G("")}L.useEffect(()=>{B&&en.current&&(en.current.focus(),en.current.select())},[B]),L.useEffect(()=>{if(!b||k)return;function Ce(Ve){Ve.key==="Escape"&&wn()}return document.addEventListener("keydown",Ce),()=>{document.removeEventListener("keydown",Ce)}},[b,k,wn]);const Be=w.jsxs(w.Fragment,{children:[w.jsxs("div",{className:"drawer-header",children:[w.jsx("span",{className:"drawer-title",children:"Palmier"}),!g&&w.jsx("button",{className:"drawer-close-btn",onClick:wn,"aria-label":"Close menu",children:w.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:w.jsx("path",{d:"M4 4L12 12M12 4L4 12",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]}),!kb&&u.length>0&&w.jsxs("div",{className:"drawer-section",children:[w.jsx("h3",{className:"drawer-section-label",children:"Hosts"}),w.jsx("div",{className:"host-picker-inline",children:w.jsx("div",{className:"host-picker-list",role:"listbox",children:u.map(Ce=>{const Ve=Ce.hostId===c,st=B===Ce.hostId,ot=Ce.name||Ce.hostId.slice(0,8);return w.jsx("div",{className:"host-picker-item-wrapper",children:w.jsxs("div",{className:`host-picker-item ${Ve?"host-picker-item-active":""}`,onClick:()=>{st||Ve||(f(Ce.hostId),g||wn())},role:"option","aria-selected":Ve,children:[st?w.jsx("input",{ref:en,className:"form-input host-picker-rename-input",type:"text",value:F,onChange:ct=>G(ct.target.value),onKeyDown:ct=>{ct.key==="Enter"&&oe(),ct.key==="Escape"&&Se()},onBlur:oe,onClick:ct=>ct.stopPropagation()}):w.jsx("span",{className:"host-picker-item-name",children:ot}),w.jsxs("div",{className:"host-picker-item-actions",children:[Ve&&!st&&w.jsx("button",{className:"host-picker-edit-btn",onClick:ct=>{ct.stopPropagation(),Mi(Ce.hostId,ot)},"aria-label":"Rename host",children:w.jsx("svg",{width:"13",height:"13",viewBox:"0 0 13 13",fill:"none",children:w.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"})})}),!Ve&&w.jsx("button",{className:"host-picker-delete-btn",onClick:ct=>{ct.stopPropagation(),O(Ce.hostId)},"aria-label":`Unpair ${ot}`,children:w.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:w.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"})})})]})]})},Ce.hostId)})})})]}),!kb&&w.jsxs(w.Fragment,{children:[w.jsx("div",{className:"drawer-divider"}),w.jsx("div",{className:"drawer-section",children:w.jsx("button",{className:"btn btn-primary btn-full",onClick:()=>{y("/pair"),g||wn()},children:"Pair New Host"})})]}),Cb&&w.jsxs(w.Fragment,{children:[w.jsx("div",{className:"drawer-divider"}),w.jsxs("div",{className:"drawer-section",children:[w.jsxs("label",{className:"drawer-toggle",children:[w.jsx("span",{className:"drawer-toggle-label",children:"Location Access"}),w.jsx("button",{className:`toggle-switch ${_?"toggle-switch-on":""}`,onClick:hn,disabled:j,role:"switch","aria-checked":_,children:w.jsx("span",{className:"toggle-switch-thumb"})})]}),w.jsxs("label",{className:"drawer-toggle",children:[w.jsx("span",{className:"drawer-toggle-label",children:"Notification Access"}),w.jsx("button",{className:`toggle-switch ${he?"toggle-switch-on":""}`,onClick:Ie,disabled:J,role:"switch","aria-checked":he,children:w.jsx("span",{className:"toggle-switch-thumb"})})]}),w.jsxs("label",{className:"drawer-toggle",children:[w.jsx("span",{className:"drawer-toggle-label",children:"SMS Access"}),w.jsx("button",{className:`toggle-switch ${pe?"toggle-switch-on":""}`,onClick:qe,disabled:N,role:"switch","aria-checked":pe,children:w.jsx("span",{className:"toggle-switch-thumb"})})]}),w.jsxs("label",{className:"drawer-toggle",children:[w.jsx("span",{className:"drawer-toggle-label",children:"Contacts Access"}),w.jsx("button",{className:`toggle-switch ${ve?"toggle-switch-on":""}`,onClick:rt,disabled:Z,role:"switch","aria-checked":ve,children:w.jsx("span",{className:"toggle-switch-thumb"})})]}),w.jsxs("label",{className:"drawer-toggle",children:[w.jsx("span",{className:"drawer-toggle-label",children:"Calendar Access"}),w.jsx("button",{className:`toggle-switch ${je?"toggle-switch-on":""}`,onClick:xe,disabled:fe,role:"switch","aria-checked":je,children:w.jsx("span",{className:"toggle-switch-thumb"})})]}),w.jsxs("label",{className:"drawer-toggle",children:[w.jsx("span",{className:"drawer-toggle-label",children:"Do Not Disturb Control"}),w.jsx("button",{className:`toggle-switch ${De?"toggle-switch-on":""}`,onClick:Le,disabled:q,role:"switch","aria-checked":De,children:w.jsx("span",{className:"toggle-switch-thumb"})})]}),w.jsxs("label",{className:"drawer-toggle",children:[w.jsx("span",{className:"drawer-toggle-label",children:"Alert Access"}),w.jsx("button",{className:`toggle-switch ${ke?"toggle-switch-on":""}`,onClick:Fe,disabled:ye,role:"switch","aria-checked":ke,children:w.jsx("span",{className:"toggle-switch-thumb"})})]}),w.jsxs("label",{className:"drawer-toggle",children:[w.jsx("span",{className:"drawer-toggle-label",children:"Battery Access"}),w.jsx("button",{className:`toggle-switch ${ze?"toggle-switch-on":""}`,onClick:Tt,disabled:R,role:"switch","aria-checked":ze,children:w.jsx("span",{className:"toggle-switch-thumb"})})]})]})]}),w.jsxs("div",{className:"drawer-footer",children:[e&&w.jsxs("div",{className:"drawer-version",children:["Palmier v",e]}),w.jsxs("div",{className:"drawer-legal",children:[w.jsx("a",{href:"https://www.palmier.me/terms",target:"_blank",rel:"noopener noreferrer",children:"Terms"}),w.jsx("span",{className:"drawer-legal-sep",children:"·"}),w.jsx("a",{href:"https://www.palmier.me/privacy",target:"_blank",rel:"noopener noreferrer",children:"Privacy"})]})]})]}),Ye=se&&mu.createPortal(w.jsx("div",{className:"confirm-modal-overlay",onClick:()=>O(null),children:w.jsxs("div",{className:"confirm-modal",onClick:Ce=>Ce.stopPropagation(),children:[w.jsx("h2",{className:"confirm-modal-title",children:"Delete host?"}),w.jsxs("p",{className:"confirm-modal-message",children:['"',((it=u.find(Ce=>Ce.hostId===se))==null?void 0:it.name)||se.slice(0,8),'" will be unpaired from this device.']}),w.jsxs("div",{className:"confirm-modal-actions",children:[w.jsx("button",{className:"btn btn-secondary",onClick:()=>O(null),children:"Cancel"}),w.jsx("button",{className:"btn btn-danger",onClick:()=>{m(se),O(null)},children:"Delete"})]})]})}),document.body);return g?w.jsxs(w.Fragment,{children:[w.jsx("div",{className:"drawer-panel drawer-panel-desktop",ref:Wn,children:Be}),Ye]}):w.jsxs(w.Fragment,{children:[w.jsx("button",{className:"hamburger-btn",onClick:yt,"aria-label":"Open menu",children:w.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:w.jsx("path",{d:"M3 5H17M3 10H17M3 15H17",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})}),b&&mu.createPortal(w.jsx("div",{className:`drawer-overlay ${k?"drawer-overlay-closing":""}`,onClick:wn,onAnimationEnd:fr,children:w.jsx("div",{className:`drawer-panel ${k?"drawer-panel-closing":""}`,ref:Wn,onClick:Ce=>Ce.stopPropagation(),children:Be})}),document.body),Ye]})}const Xk=10;function Qk({connected:e,hostId:n,request:r,subscribeEvents:a,filterTaskId:l,onClearFilter:u}){const[c,f]=L.useState([]),[m,d]=L.useState(0),[y,g]=L.useState(!1),[b,x]=L.useState(!1),k=ia(),z=L.useRef(null),B=L.useCallback(O=>{const j={offset:O,limit:Xk};return l&&(j.task_id=l),j},[l]),M=L.useCallback(async(O,j)=>{if(e){j?x(!0):g(!0);try{const V=await r("taskrun.list",B(O)),J=V.entries??[];d(V.total??0),f(j?Y=>{const N=new Set(Y.map(Z=>`${Z.task_id}:${Z.run_id}`)),Q=J.filter(Z=>!N.has(`${Z.task_id}:${Z.run_id}`));return[...Y,...Q]}:J)}catch(V){V instanceof Error&&V.message==="Not connected"||console.error("Failed to load runs:",V)}finally{g(!1),x(!1)}}},[e,r,B]);L.useEffect(()=>{e?(f([]),d(0),M(0,!1)):(f([]),d(0))},[e,n,M,l]),L.useEffect(()=>!e||!n?void 0:a(n,async j=>{try{const V=JSON.parse(new TextDecoder().decode(j.data));if(V.event_type==="running-state"&&V.running_state&&["monitoring","started","finished","failed","aborted"].includes(V.running_state)){const J=await r("taskrun.list",B(0)),Y=J.entries??[];d(J.total??0),f(N=>{const Q=new Map(Y.map(H=>[`${H.task_id}:${H.run_id}`,H])),Z=N.map(H=>{const q=`${H.task_id}:${H.run_id}`;return Q.get(q)??H}),ge=new Set(Z.map(H=>`${H.task_id}:${H.run_id}`));return[...Y.filter(H=>!ge.has(`${H.task_id}:${H.run_id}`)),...Z]})}}catch{}}),[e,n,a,r]),L.useEffect(()=>{const O=z.current;if(!O)return;const j=new IntersectionObserver(V=>{V[0].isIntersecting&&!b&&c.length<m&&M(c.length,!0)},{threshold:.1});return j.observe(O),()=>j.disconnect()},[c.length,m,b,M]);function F(O,j){if(!O||!j)return"";const V=Math.round((j-O)/1e3);if(V<60)return`${V}s`;const J=Math.floor(V/60),Y=V%60;return`${J}m ${Y}s`}const G={monitoring:"Monitoring",started:"Running",finished:"Finished",failed:"Failed",aborted:"Aborted"};function se(O){if(O==="failed")return"var(--color-error)";if(O==="aborted")return"var(--color-warning, #d97706)"}return y&&c.length===0&&e?w.jsx("div",{className:"task-list",children:[0,1,2].map(O=>w.jsxs("div",{className:"task-card",style:{pointerEvents:"none"},children:[w.jsx("div",{className:"task-card-header",children:w.jsx("div",{className:"task-card-title-row",children:w.jsx("div",{className:"skeleton-line",style:{width:`${70+O*10}%`}})})}),w.jsx("div",{className:"task-card-meta",children:w.jsx("div",{className:"skeleton-line",style:{width:"45%"}})})]},O))}):!e||y&&c.length===0?w.jsx("div",{className:"runs-view",children:w.jsxs("div",{className:"empty-state",children:[w.jsx("p",{className:"empty-state-text",children:"Runs"}),w.jsx("p",{className:"empty-state-hint",children:"Run history will appear here"})]})}):c.length===0?w.jsxs(w.Fragment,{children:[l&&u&&w.jsx("div",{style:{marginBottom:"var(--space-sm)"},children:w.jsxs("span",{className:"runs-filter-chip",children:["Filtered by task",w.jsx("button",{onClick:u,"aria-label":"Clear filter",children:"×"})]})}),w.jsx("div",{className:"runs-view",children:w.jsxs("div",{className:"empty-state",children:[w.jsx("p",{className:"empty-state-text",children:"No runs yet"}),w.jsx("p",{className:"empty-state-hint",children:l?"This task hasn't been executed yet. Run it from the task menu or wait for its next trigger.":"Run history will appear here."})]})})]}):w.jsxs(w.Fragment,{children:[l&&u&&w.jsx("div",{style:{marginBottom:"var(--space-sm)"},children:w.jsxs("span",{className:"runs-filter-chip",children:["Filtered by task",w.jsx("button",{onClick:u,"aria-label":"Clear filter",children:"×"})]})}),w.jsxs("div",{className:"task-list",children:[c.map((O,j)=>w.jsxs("div",{className:"runs-card",onClick:()=>!O.error&&k(`/runs/${O.task_id}/${encodeURIComponent(O.run_id)}`),children:[w.jsxs("div",{className:"runs-card-body",children:[w.jsx("h3",{className:"runs-card-name",children:O.task_name||O.task_id}),w.jsxs("div",{className:"runs-card-meta",children:[w.jsx("span",{style:{color:se(O.running_state)},children:G[O.running_state??""]??O.running_state}),O.end_time&&w.jsx("span",{children:Eu(O.end_time)}),O.start_time&&O.end_time&&w.jsx("span",{style:{color:"var(--color-muted)"},children:F(O.start_time,O.end_time)}),O.error&&w.jsx("span",{style:{color:"var(--color-muted)"},children:O.error})]})]}),w.jsx("span",{className:"runs-card-chevron",children:"›"})]},`${O.task_id}-${O.run_id}-${j}`)),w.jsx("div",{ref:z,style:{height:1}}),b&&w.jsx("div",{className:"loading-state",style:{padding:"var(--space-md)"},children:w.jsx("div",{className:"spinner"})})]})]})}function Kk(e,n){const r={};return(e[e.length-1]===""?[...e,""]:e).join((r.padRight?" ":"")+","+(r.padLeft===!1?"":" ")).trim()}const Zk=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Wk=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,e2={};function Tb(e,n){return(e2.jsx?Wk:Zk).test(e)}const t2=/[ \t\n\f\r]/g;function n2(e){return typeof e=="object"?e.type==="text"?jb(e.value):!1:jb(e)}function jb(e){return e.replace(t2,"")===""}class Dl{constructor(n,r,a){this.normal=r,this.property=n,a&&(this.space=a)}}Dl.prototype.normal={};Dl.prototype.property={};Dl.prototype.space=void 0;function h1(e,n){const r={},a={};for(const l of e)Object.assign(r,l.property),Object.assign(a,l.normal);return new Dl(r,a,n)}function Wh(e){return e.toLowerCase()}class xn{constructor(n,r){this.attribute=r,this.property=n}}xn.prototype.attribute="";xn.prototype.booleanish=!1;xn.prototype.boolean=!1;xn.prototype.commaOrSpaceSeparated=!1;xn.prototype.commaSeparated=!1;xn.prototype.defined=!1;xn.prototype.mustUseProperty=!1;xn.prototype.number=!1;xn.prototype.overloadedBoolean=!1;xn.prototype.property="";xn.prototype.spaceSeparated=!1;xn.prototype.space=void 0;let r2=0;const Qe=sa(),Ft=sa(),ed=sa(),we=sa(),Et=sa(),ts=sa(),Nn=sa();function sa(){return 2**++r2}const td=Object.freeze(Object.defineProperty({__proto__:null,boolean:Qe,booleanish:Ft,commaOrSpaceSeparated:Nn,commaSeparated:ts,number:we,overloadedBoolean:ed,spaceSeparated:Et},Symbol.toStringTag,{value:"Module"})),bh=Object.keys(td);class Td extends xn{constructor(n,r,a,l){let u=-1;if(super(n,r),Nb(this,"space",l),typeof a=="number")for(;++u<bh.length;){const c=bh[u];Nb(this,bh[u],(a&td[c])===td[c])}}}Td.prototype.defined=!0;function Nb(e,n,r){r&&(e[n]=r)}function cs(e){const n={},r={};for(const[a,l]of Object.entries(e.properties)){const u=new Td(a,e.transform(e.attributes||{},a),l,e.space);e.mustUseProperty&&e.mustUseProperty.includes(a)&&(u.mustUseProperty=!0),n[a]=u,r[Wh(a)]=a,r[Wh(u.attribute)]=a}return new Dl(n,r,e.space)}const d1=cs({properties:{ariaActiveDescendant:null,ariaAtomic:Ft,ariaAutoComplete:null,ariaBusy:Ft,ariaChecked:Ft,ariaColCount:we,ariaColIndex:we,ariaColSpan:we,ariaControls:Et,ariaCurrent:null,ariaDescribedBy:Et,ariaDetails:null,ariaDisabled:Ft,ariaDropEffect:Et,ariaErrorMessage:null,ariaExpanded:Ft,ariaFlowTo:Et,ariaGrabbed:Ft,ariaHasPopup:null,ariaHidden:Ft,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Et,ariaLevel:we,ariaLive:null,ariaModal:Ft,ariaMultiLine:Ft,ariaMultiSelectable:Ft,ariaOrientation:null,ariaOwns:Et,ariaPlaceholder:null,ariaPosInSet:we,ariaPressed:Ft,ariaReadOnly:Ft,ariaRelevant:null,ariaRequired:Ft,ariaRoleDescription:Et,ariaRowCount:we,ariaRowIndex:we,ariaRowSpan:we,ariaSelected:Ft,ariaSetSize:we,ariaSort:null,ariaValueMax:we,ariaValueMin:we,ariaValueNow:we,ariaValueText:null,role:null},transform(e,n){return n==="role"?n:"aria-"+n.slice(4).toLowerCase()}});function m1(e,n){return n in e?e[n]:n}function p1(e,n){return m1(e,n.toLowerCase())}const i2=cs({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:ts,acceptCharset:Et,accessKey:Et,action:null,allow:null,allowFullScreen:Qe,allowPaymentRequest:Qe,allowUserMedia:Qe,alt:null,as:null,async:Qe,autoCapitalize:null,autoComplete:Et,autoFocus:Qe,autoPlay:Qe,blocking:Et,capture:null,charSet:null,checked:Qe,cite:null,className:Et,cols:we,colSpan:null,content:null,contentEditable:Ft,controls:Qe,controlsList:Et,coords:we|ts,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Qe,defer:Qe,dir:null,dirName:null,disabled:Qe,download:ed,draggable:Ft,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Qe,formTarget:null,headers:Et,height:we,hidden:ed,high:we,href:null,hrefLang:null,htmlFor:Et,httpEquiv:Et,id:null,imageSizes:null,imageSrcSet:null,inert:Qe,inputMode:null,integrity:null,is:null,isMap:Qe,itemId:null,itemProp:Et,itemRef:Et,itemScope:Qe,itemType:Et,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Qe,low:we,manifest:null,max:null,maxLength:we,media:null,method:null,min:null,minLength:we,multiple:Qe,muted:Qe,name:null,nonce:null,noModule:Qe,noValidate:Qe,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:Qe,optimum:we,pattern:null,ping:Et,placeholder:null,playsInline:Qe,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Qe,referrerPolicy:null,rel:Et,required:Qe,reversed:Qe,rows:we,rowSpan:we,sandbox:Et,scope:null,scoped:Qe,seamless:Qe,selected:Qe,shadowRootClonable:Qe,shadowRootDelegatesFocus:Qe,shadowRootMode:null,shape:null,size:we,sizes:null,slot:null,span:we,spellCheck:Ft,src:null,srcDoc:null,srcLang:null,srcSet:null,start:we,step:null,style:null,tabIndex:we,target:null,title:null,translate:null,type:null,typeMustMatch:Qe,useMap:null,value:Ft,width:we,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Et,axis:null,background:null,bgColor:null,border:we,borderColor:null,bottomMargin:we,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Qe,declare:Qe,event:null,face:null,frame:null,frameBorder:null,hSpace:we,leftMargin:we,link:null,longDesc:null,lowSrc:null,marginHeight:we,marginWidth:we,noResize:Qe,noHref:Qe,noShade:Qe,noWrap:Qe,object:null,profile:null,prompt:null,rev:null,rightMargin:we,rules:null,scheme:null,scrolling:Ft,standby:null,summary:null,text:null,topMargin:we,valueType:null,version:null,vAlign:null,vLink:null,vSpace:we,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Qe,disableRemotePlayback:Qe,prefix:null,property:null,results:we,security:null,unselectable:null},space:"html",transform:p1}),a2=cs({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:Nn,accentHeight:we,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:we,amplitude:we,arabicForm:null,ascent:we,attributeName:null,attributeType:null,azimuth:we,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:we,by:null,calcMode:null,capHeight:we,className:Et,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:we,diffuseConstant:we,direction:null,display:null,dur:null,divisor:we,dominantBaseline:null,download:Qe,dx:null,dy:null,edgeMode:null,editable:null,elevation:we,enableBackground:null,end:null,event:null,exponent:we,externalResourcesRequired:null,fill:null,fillOpacity:we,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:ts,g2:ts,glyphName:ts,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:we,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:we,horizOriginX:we,horizOriginY:we,id:null,ideographic:we,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:we,k:we,k1:we,k2:we,k3:we,k4:we,kernelMatrix:Nn,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:we,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:we,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:we,overlineThickness:we,paintOrder:null,panose1:null,path:null,pathLength:we,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Et,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:we,pointsAtY:we,pointsAtZ:we,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Nn,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Nn,rev:Nn,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Nn,requiredFeatures:Nn,requiredFonts:Nn,requiredFormats:Nn,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:we,specularExponent:we,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:we,strikethroughThickness:we,string:null,stroke:null,strokeDashArray:Nn,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:we,strokeOpacity:we,strokeWidth:null,style:null,surfaceScale:we,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Nn,tabIndex:we,tableValues:null,target:null,targetX:we,targetY:we,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Nn,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:we,underlineThickness:we,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:we,values:null,vAlphabetic:we,vMathematical:we,vectorEffect:null,vHanging:we,vIdeographic:we,version:null,vertAdvY:we,vertOriginX:we,vertOriginY:we,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:we,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:m1}),g1=cs({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()}}),y1=cs({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:p1}),b1=cs({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,n){return"xml:"+n.slice(3).toLowerCase()}}),s2={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"},l2=/[A-Z]/g,Ob=/-[a-z]/g,o2=/^data[-\w.:]+$/i;function u2(e,n){const r=Wh(n);let a=n,l=xn;if(r in e.normal)return e.property[e.normal[r]];if(r.length>4&&r.slice(0,4)==="data"&&o2.test(n)){if(n.charAt(4)==="-"){const u=n.slice(5).replace(Ob,f2);a="data"+u.charAt(0).toUpperCase()+u.slice(1)}else{const u=n.slice(4);if(!Ob.test(u)){let c=u.replace(l2,c2);c.charAt(0)!=="-"&&(c="-"+c),n="data"+c}}l=Td}return new l(a,n)}function c2(e){return"-"+e.toLowerCase()}function f2(e){return e.charAt(1).toUpperCase()}const h2=h1([d1,i2,g1,y1,b1],"html"),jd=h1([d1,a2,g1,y1,b1],"svg");function d2(e){return e.join(" ").trim()}var $a={},vh,Rb;function m2(){if(Rb)return vh;Rb=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,n=/\n/g,r=/^\s*/,a=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,l=/^:\s*/,u=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,f=/^\s+|\s+$/g,m=`
|
|
91
|
+
`,d="/",y="*",g="",b="comment",x="declaration";function k(B,M){if(typeof B!="string")throw new TypeError("First argument must be a string");if(!B)return[];M=M||{};var F=1,G=1;function se(fe){var H=fe.match(n);H&&(F+=H.length);var q=fe.lastIndexOf(m);G=~q?fe.length-q:G+fe.length}function O(){var fe={line:F,column:G};return function(H){return H.position=new j(fe),Y(),H}}function j(fe){this.start=fe,this.end={line:F,column:G},this.source=M.source}j.prototype.content=B;function V(fe){var H=new Error(M.source+":"+F+":"+G+": "+fe);if(H.reason=fe,H.filename=M.source,H.line=F,H.column=G,H.source=B,!M.silent)throw H}function J(fe){var H=fe.exec(B);if(H){var q=H[0];return se(q),B=B.slice(q.length),H}}function Y(){J(r)}function N(fe){var H;for(fe=fe||[];H=Q();)H!==!1&&fe.push(H);return fe}function Q(){var fe=O();if(!(d!=B.charAt(0)||y!=B.charAt(1))){for(var H=2;g!=B.charAt(H)&&(y!=B.charAt(H)||d!=B.charAt(H+1));)++H;if(H+=2,g===B.charAt(H-1))return V("End of comment missing");var q=B.slice(2,H-2);return G+=2,se(q),B=B.slice(H),G+=2,fe({type:b,comment:q})}}function Z(){var fe=O(),H=J(a);if(H){if(Q(),!J(l))return V("property missing ':'");var q=J(u),re=fe({type:x,property:z(H[0].replace(e,g)),value:q?z(q[0].replace(e,g)):g});return J(c),re}}function ge(){var fe=[];N(fe);for(var H;H=Z();)H!==!1&&(fe.push(H),N(fe));return fe}return Y(),ge()}function z(B){return B?B.replace(f,g):g}return vh=k,vh}var Mb;function p2(){if(Mb)return $a;Mb=1;var e=$a&&$a.__importDefault||function(a){return a&&a.__esModule?a:{default:a}};Object.defineProperty($a,"__esModule",{value:!0}),$a.default=r;const n=e(m2());function r(a,l){let u=null;if(!a||typeof a!="string")return u;const c=(0,n.default)(a),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 $a}var ll={},Db;function g2(){if(Db)return ll;Db=1,Object.defineProperty(ll,"__esModule",{value:!0}),ll.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,n=/-([a-z])/g,r=/^[^-]+$/,a=/^-(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(a,f),d.replace(n,c))};return ll.camelCase=m,ll}var ol,zb;function y2(){if(zb)return ol;zb=1;var e=ol&&ol.__importDefault||function(l){return l&&l.__esModule?l:{default:l}},n=e(p2()),r=g2();function a(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 a.default=a,ol=a,ol}var b2=y2();const v2=x0(b2),v1=x1("end"),Nd=x1("start");function x1(e){return n;function n(r){const a=r&&r.position&&r.position[e]||{};if(typeof a.line=="number"&&a.line>0&&typeof a.column=="number"&&a.column>0)return{line:a.line,column:a.column,offset:typeof a.offset=="number"&&a.offset>-1?a.offset:void 0}}}function x2(e){const n=Nd(e),r=v1(e);if(n&&r)return{start:n,end:r}}function bl(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Lb(e.position):"start"in e||"end"in e?Lb(e):"line"in e||"column"in e?nd(e):""}function nd(e){return Ub(e&&e.line)+":"+Ub(e&&e.column)}function Lb(e){return nd(e&&e.start)+"-"+nd(e&&e.end)}function Ub(e){return e&&typeof e=="number"?e:1}class an extends Error{constructor(n,r,a){super(),typeof r=="string"&&(a=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 a=="string"){const m=a.indexOf(":");m===-1?u.ruleId=a:(u.source=a.slice(0,m),u.ruleId=a.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=bl(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}}an.prototype.file="";an.prototype.name="";an.prototype.reason="";an.prototype.message="";an.prototype.stack="";an.prototype.column=void 0;an.prototype.line=void 0;an.prototype.ancestors=void 0;an.prototype.cause=void 0;an.prototype.fatal=void 0;an.prototype.place=void 0;an.prototype.ruleId=void 0;an.prototype.source=void 0;const Od={}.hasOwnProperty,w2=new Map,S2=/[A-Z]/g,_2=new Set(["table","tbody","thead","tfoot","tr"]),E2=new Set(["td","th"]),w1="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function k2(e,n){if(!n||n.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const r=n.filePath||void 0;let a;if(n.development){if(typeof n.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");a=M2(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");a=R2(r,n.jsx,n.jsxs)}const l={Fragment:n.Fragment,ancestors:[],components:n.components||{},create:a,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"?jd:h2,stylePropertyNameCase:n.stylePropertyNameCase||"dom",tableCellAlignToStyle:n.tableCellAlignToStyle!==!1},u=S1(l,e,void 0);return u&&typeof u!="string"?u:l.create(e,l.Fragment,{children:u||void 0},void 0)}function S1(e,n,r){if(n.type==="element")return C2(e,n,r);if(n.type==="mdxFlowExpression"||n.type==="mdxTextExpression")return A2(e,n);if(n.type==="mdxJsxFlowElement"||n.type==="mdxJsxTextElement")return j2(e,n,r);if(n.type==="mdxjsEsm")return T2(e,n);if(n.type==="root")return N2(e,n,r);if(n.type==="text")return O2(e,n)}function C2(e,n,r){const a=e.schema;let l=a;n.tagName.toLowerCase()==="svg"&&a.space==="html"&&(l=jd,e.schema=l),e.ancestors.push(n);const u=E1(e,n.tagName,!1),c=D2(e,n);let f=Md(e,n);return _2.has(n.tagName)&&(f=f.filter(function(m){return typeof m=="string"?!n2(m):!0})),_1(e,c,u,n),Rd(c,f),e.ancestors.pop(),e.schema=a,e.create(n,u,c,r)}function A2(e,n){if(n.data&&n.data.estree&&e.evaluater){const a=n.data.estree.body[0];return a.type,e.evaluater.evaluateExpression(a.expression)}Cl(e,n.position)}function T2(e,n){if(n.data&&n.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(n.data.estree);Cl(e,n.position)}function j2(e,n,r){const a=e.schema;let l=a;n.name==="svg"&&a.space==="html"&&(l=jd,e.schema=l),e.ancestors.push(n);const u=n.name===null?e.Fragment:E1(e,n.name,!0),c=z2(e,n),f=Md(e,n);return _1(e,c,u,n),Rd(c,f),e.ancestors.pop(),e.schema=a,e.create(n,u,c,r)}function N2(e,n,r){const a={};return Rd(a,Md(e,n)),e.create(n,e.Fragment,a,r)}function O2(e,n){return n.value}function _1(e,n,r,a){typeof r!="string"&&r!==e.Fragment&&e.passNode&&(n.node=a)}function Rd(e,n){if(n.length>0){const r=n.length>1?n:n[0];r&&(e.children=r)}}function R2(e,n,r){return a;function a(l,u,c,f){const d=Array.isArray(c.children)?r:n;return f?d(u,c,f):d(u,c)}}function M2(e,n){return r;function r(a,l,u,c){const f=Array.isArray(u.children),m=Nd(a);return n(l,u,c,f,{columnNumber:m?m.column-1:void 0,fileName:e,lineNumber:m?m.line:void 0},void 0)}}function D2(e,n){const r={};let a,l;for(l in n.properties)if(l!=="children"&&Od.call(n.properties,l)){const u=L2(e,l,n.properties[l]);if(u){const[c,f]=u;e.tableCellAlignToStyle&&c==="align"&&typeof f=="string"&&E2.has(n.tagName)?a=f:r[c]=f}}if(a){const u=r.style||(r.style={});u[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=a}return r}function z2(e,n){const r={};for(const a of n.attributes)if(a.type==="mdxJsxExpressionAttribute")if(a.data&&a.data.estree&&e.evaluater){const u=a.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 Cl(e,n.position);else{const l=a.name;let u;if(a.value&&typeof a.value=="object")if(a.value.data&&a.value.data.estree&&e.evaluater){const f=a.value.data.estree.body[0];f.type,u=e.evaluater.evaluateExpression(f.expression)}else Cl(e,n.position);else u=a.value===null?!0:a.value;r[l]=u}return r}function Md(e,n){const r=[];let a=-1;const l=e.passKeys?new Map:w2;for(;++a<n.children.length;){const u=n.children[a];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=S1(e,u,c);f!==void 0&&r.push(f)}return r}function L2(e,n,r){const a=u2(e.schema,n);if(!(r==null||typeof r=="number"&&Number.isNaN(r))){if(Array.isArray(r)&&(r=a.commaSeparated?Kk(r):d2(r)),a.property==="style"){let l=typeof r=="object"?r:U2(e,String(r));return e.stylePropertyNameCase==="css"&&(l=B2(l)),["style",l]}return[e.elementAttributeNameCase==="react"&&a.space?s2[a.property]||a.property:a.attribute,r]}}function U2(e,n){try{return v2(n,{reactCompat:!0})}catch(r){if(e.ignoreInvalidStyle)return{};const a=r,l=new an("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:a,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw l.file=e.filePath||void 0,l.url=w1+"#cannot-parse-style-attribute",l}}function E1(e,n,r){let a;if(!r)a={type:"Literal",value:n};else if(n.includes(".")){const l=n.split(".");let u=-1,c;for(;++u<l.length;){const f=Tb(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}a=c}else a=Tb(n)&&!/^[a-z]/.test(n)?{type:"Identifier",name:n}:{type:"Literal",value:n};if(a.type==="Literal"){const l=a.value;return Od.call(e.components,l)?e.components[l]:l}if(e.evaluater)return e.evaluater.evaluateExpression(a);Cl(e)}function Cl(e,n){const r=new an("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=w1+"#cannot-handle-mdx-estrees-without-createevaluater",r}function B2(e){const n={};let r;for(r in e)Od.call(e,r)&&(n[P2(r)]=e[r]);return n}function P2(e){let n=e.replace(S2,H2);return n.slice(0,3)==="ms-"&&(n="-"+n),n}function H2(e){return"-"+e.toLowerCase()}const xh={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"]},q2={};function Dd(e,n){const r=q2,a=typeof r.includeImageAlt=="boolean"?r.includeImageAlt:!0,l=typeof r.includeHtml=="boolean"?r.includeHtml:!0;return k1(e,a,l)}function k1(e,n,r){if(I2(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 Bb(e.children,n,r)}return Array.isArray(e)?Bb(e,n,r):""}function Bb(e,n,r){const a=[];let l=-1;for(;++l<e.length;)a[l]=k1(e[l],n,r);return a.join("")}function I2(e){return!!(e&&typeof e=="object")}const Pb=document.createElement("i");function zd(e){const n="&"+e+";";Pb.innerHTML=n;const r=Pb.textContent;return r.charCodeAt(r.length-1)===59&&e!=="semi"||r===n?!1:r}function zn(e,n,r,a){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,a.length<1e4)c=Array.from(a),c.unshift(n,r),e.splice(...c);else for(r&&e.splice(n,r);u<a.length;)c=a.slice(u,u+1e4),c.unshift(n,0),e.splice(...c),u+=1e4,n+=1e4}function Kn(e,n){return e.length>0?(zn(e,e.length,0,n),e):n}const Hb={}.hasOwnProperty;function C1(e){const n={};let r=-1;for(;++r<e.length;)F2(n,e[r]);return n}function F2(e,n){let r;for(r in n){const l=(Hb.call(e,r)?e[r]:void 0)||(e[r]={}),u=n[r];let c;if(u)for(c in u){Hb.call(l,c)||(l[c]=[]);const f=u[c];$2(l[c],Array.isArray(f)?f:f?[f]:[])}}}function $2(e,n){let r=-1;const a=[];for(;++r<n.length;)(n[r].add==="after"?e:a).push(n[r]);zn(e,0,0,a)}function A1(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 ur(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const cn=Ri(/[A-Za-z]/),rn=Ri(/[\dA-Za-z]/),G2=Ri(/[#-'*+\--9=?A-Z^-~]/);function ku(e){return e!==null&&(e<32||e===127)}const rd=Ri(/\d/),Y2=Ri(/[\dA-Fa-f]/),V2=Ri(/[!-/:-@[-`{-~]/);function Pe(e){return e!==null&&e<-2}function _t(e){return e!==null&&(e<0||e===32)}function et(e){return e===-2||e===-1||e===32}const zu=Ri(new RegExp("\\p{P}|\\p{S}","u")),ra=Ri(/\s/);function Ri(e){return n;function n(r){return r!==null&&r>-1&&e.test(String.fromCharCode(r))}}function fs(e){const n=[];let r=-1,a=0,l=0;for(;++r<e.length;){const u=e.charCodeAt(r);let c="";if(u===37&&rn(e.charCodeAt(r+1))&&rn(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(a,r),encodeURIComponent(c)),a=r+l+1,c=""),l&&(r+=l,l=0)}return n.join("")+e.slice(a)}function lt(e,n,r,a){const l=a?a-1:Number.POSITIVE_INFINITY;let u=0;return c;function c(m){return et(m)?(e.enter(r),f(m)):n(m)}function f(m){return et(m)&&u++<l?(e.consume(m),f):(e.exit(r),n(m))}}const J2={tokenize:X2};function X2(e){const n=e.attempt(this.parser.constructs.contentInitial,a,l);let r;return n;function a(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 Pe(f)?(e.consume(f),e.exit("chunkText"),u):(e.consume(f),c)}}const Q2={tokenize:K2},qb={tokenize:Z2};function K2(e){const n=this,r=[];let a=0,l,u,c;return f;function f(G){if(a<r.length){const se=r[a];return n.containerState=se[1],e.attempt(se[0].continuation,m,d)(G)}return d(G)}function m(G){if(a++,n.containerState._closeFlow){n.containerState._closeFlow=void 0,l&&F();const se=n.events.length;let O=se,j;for(;O--;)if(n.events[O][0]==="exit"&&n.events[O][1].type==="chunkFlow"){j=n.events[O][1].end;break}M(a);let V=se;for(;V<n.events.length;)n.events[V][1].end={...j},V++;return zn(n.events,O+1,0,n.events.slice(se)),n.events.length=V,d(G)}return f(G)}function d(G){if(a===r.length){if(!l)return b(G);if(l.currentConstruct&&l.currentConstruct.concrete)return k(G);n.interrupt=!!(l.currentConstruct&&!l._gfmTableDynamicInterruptHack)}return n.containerState={},e.check(qb,y,g)(G)}function y(G){return l&&F(),M(a),b(G)}function g(G){return n.parser.lazy[n.now().line]=a!==r.length,c=n.now().offset,k(G)}function b(G){return n.containerState={},e.attempt(qb,x,k)(G)}function x(G){return a++,r.push([n.currentConstruct,n.containerState]),b(G)}function k(G){if(G===null){l&&F(),M(0),e.consume(G);return}return l=l||n.parser.flow(n.now()),e.enter("chunkFlow",{_tokenizer:l,contentType:"flow",previous:u}),z(G)}function z(G){if(G===null){B(e.exit("chunkFlow"),!0),M(0),e.consume(G);return}return Pe(G)?(e.consume(G),B(e.exit("chunkFlow")),a=0,n.interrupt=void 0,f):(e.consume(G),z)}function B(G,se){const O=n.sliceStream(G);if(se&&O.push(null),G.previous=u,u&&(u.next=G),u=G,l.defineSkip(G.start),l.write(O),n.parser.lazy[G.start.line]){let j=l.events.length;for(;j--;)if(l.events[j][1].start.offset<c&&(!l.events[j][1].end||l.events[j][1].end.offset>c))return;const V=n.events.length;let J=V,Y,N;for(;J--;)if(n.events[J][0]==="exit"&&n.events[J][1].type==="chunkFlow"){if(Y){N=n.events[J][1].end;break}Y=!0}for(M(a),j=V;j<n.events.length;)n.events[j][1].end={...N},j++;zn(n.events,J+1,0,n.events.slice(V)),n.events.length=j}}function M(G){let se=r.length;for(;se-- >G;){const O=r[se];n.containerState=O[1],O[0].exit.call(n,e)}r.length=G}function F(){l.write([null]),u=void 0,l=void 0,n.containerState._closeFlow=void 0}}function Z2(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 ss(e){if(e===null||_t(e)||ra(e))return 1;if(zu(e))return 2}function Lu(e,n,r){const a=[];let l=-1;for(;++l<e.length;){const u=e[l].resolveAll;u&&!a.includes(u)&&(n=u(n,r),a.push(u))}return n}const id={name:"attention",resolveAll:W2,tokenize:eC};function W2(e,n){let r=-1,a,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(a=r;a--;)if(e[a][0]==="exit"&&e[a][1].type==="attentionSequence"&&e[a][1]._open&&n.sliceSerialize(e[a][1]).charCodeAt(0)===n.sliceSerialize(e[r][1]).charCodeAt(0)){if((e[a][1]._close||e[r][1]._open)&&(e[r][1].end.offset-e[r][1].start.offset)%3&&!((e[a][1].end.offset-e[a][1].start.offset+e[r][1].end.offset-e[r][1].start.offset)%3))continue;m=e[a][1].end.offset-e[a][1].start.offset>1&&e[r][1].end.offset-e[r][1].start.offset>1?2:1;const g={...e[a][1].end},b={...e[r][1].start};Ib(g,-m),Ib(b,m),c={type:m>1?"strongSequence":"emphasisSequence",start:g,end:{...e[a][1].end}},f={type:m>1?"strongSequence":"emphasisSequence",start:{...e[r][1].start},end:b},u={type:m>1?"strongText":"emphasisText",start:{...e[a][1].end},end:{...e[r][1].start}},l={type:m>1?"strong":"emphasis",start:{...c.start},end:{...f.end}},e[a][1].end={...c.start},e[r][1].start={...f.end},d=[],e[a][1].end.offset-e[a][1].start.offset&&(d=Kn(d,[["enter",e[a][1],n],["exit",e[a][1],n]])),d=Kn(d,[["enter",l,n],["enter",c,n],["exit",c,n],["enter",u,n]]),d=Kn(d,Lu(n.parser.constructs.insideSpan.null,e.slice(a+1,r),n)),d=Kn(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=Kn(d,[["enter",e[r][1],n],["exit",e[r][1],n]])):y=0,zn(e,a-1,r-a+3,d),r=a+d.length-y-2;break}}for(r=-1;++r<e.length;)e[r][1].type==="attentionSequence"&&(e[r][1].type="data");return e}function eC(e,n){const r=this.parser.constructs.attentionMarkers.null,a=this.previous,l=ss(a);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=ss(m),g=!y||y===2&&l||r.includes(m),b=!l||l===2&&y||r.includes(a);return d._open=!!(u===42?g:g&&(l||!b)),d._close=!!(u===42?b:b&&(y||!g)),n(m)}}function Ib(e,n){e.column+=n,e.offset+=n,e._bufferIndex+=n}const tC={name:"autolink",tokenize:nC};function nC(e,n,r){let a=0;return l;function l(x){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(x),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),u}function u(x){return cn(x)?(e.consume(x),c):x===64?r(x):d(x)}function c(x){return x===43||x===45||x===46||rn(x)?(a=1,f(x)):d(x)}function f(x){return x===58?(e.consume(x),a=0,m):(x===43||x===45||x===46||rn(x))&&a++<32?(e.consume(x),f):(a=0,d(x))}function m(x){return x===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(x),e.exit("autolinkMarker"),e.exit("autolink"),n):x===null||x===32||x===60||ku(x)?r(x):(e.consume(x),m)}function d(x){return x===64?(e.consume(x),y):G2(x)?(e.consume(x),d):r(x)}function y(x){return rn(x)?g(x):r(x)}function g(x){return x===46?(e.consume(x),a=0,y):x===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(x),e.exit("autolinkMarker"),e.exit("autolink"),n):b(x)}function b(x){if((x===45||rn(x))&&a++<63){const k=x===45?b:g;return e.consume(x),k}return r(x)}}const zl={partial:!0,tokenize:rC};function rC(e,n,r){return a;function a(u){return et(u)?lt(e,l,"linePrefix")(u):l(u)}function l(u){return u===null||Pe(u)?n(u):r(u)}}const T1={continuation:{tokenize:aC},exit:sC,name:"blockQuote",tokenize:iC};function iC(e,n,r){const a=this;return l;function l(c){if(c===62){const f=a.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 et(c)?(e.enter("blockQuotePrefixWhitespace"),e.consume(c),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),n):(e.exit("blockQuotePrefix"),n(c))}}function aC(e,n,r){const a=this;return l;function l(c){return et(c)?lt(e,u,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(c):u(c)}function u(c){return e.attempt(T1,n,r)(c)}}function sC(e){e.exit("blockQuote")}const j1={name:"characterEscape",tokenize:lC};function lC(e,n,r){return a;function a(u){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(u),e.exit("escapeMarker"),l}function l(u){return V2(u)?(e.enter("characterEscapeValue"),e.consume(u),e.exit("characterEscapeValue"),e.exit("characterEscape"),n):r(u)}}const N1={name:"characterReference",tokenize:oC};function oC(e,n,r){const a=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=rn,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=Y2,y):(e.enter("characterReferenceValue"),u=7,c=rd,y(g))}function y(g){if(g===59&&l){const b=e.exit("characterReferenceValue");return c===rn&&!zd(a.sliceSerialize(b))?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 Fb={partial:!0,tokenize:cC},$b={concrete:!0,name:"codeFenced",tokenize:uC};function uC(e,n,r){const a=this,l={partial:!0,tokenize:O};let u=0,c=0,f;return m;function m(j){return d(j)}function d(j){const V=a.events[a.events.length-1];return u=V&&V[1].type==="linePrefix"?V[2].sliceSerialize(V[1],!0).length:0,f=j,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),y(j)}function y(j){return j===f?(c++,e.consume(j),y):c<3?r(j):(e.exit("codeFencedFenceSequence"),et(j)?lt(e,g,"whitespace")(j):g(j))}function g(j){return j===null||Pe(j)?(e.exit("codeFencedFence"),a.interrupt?n(j):e.check(Fb,z,se)(j)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),b(j))}function b(j){return j===null||Pe(j)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),g(j)):et(j)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),lt(e,x,"whitespace")(j)):j===96&&j===f?r(j):(e.consume(j),b)}function x(j){return j===null||Pe(j)?g(j):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),k(j))}function k(j){return j===null||Pe(j)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),g(j)):j===96&&j===f?r(j):(e.consume(j),k)}function z(j){return e.attempt(l,se,B)(j)}function B(j){return e.enter("lineEnding"),e.consume(j),e.exit("lineEnding"),M}function M(j){return u>0&&et(j)?lt(e,F,"linePrefix",u+1)(j):F(j)}function F(j){return j===null||Pe(j)?e.check(Fb,z,se)(j):(e.enter("codeFlowValue"),G(j))}function G(j){return j===null||Pe(j)?(e.exit("codeFlowValue"),F(j)):(e.consume(j),G)}function se(j){return e.exit("codeFenced"),n(j)}function O(j,V,J){let Y=0;return N;function N(H){return j.enter("lineEnding"),j.consume(H),j.exit("lineEnding"),Q}function Q(H){return j.enter("codeFencedFence"),et(H)?lt(j,Z,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(H):Z(H)}function Z(H){return H===f?(j.enter("codeFencedFenceSequence"),ge(H)):J(H)}function ge(H){return H===f?(Y++,j.consume(H),ge):Y>=c?(j.exit("codeFencedFenceSequence"),et(H)?lt(j,fe,"whitespace")(H):fe(H)):J(H)}function fe(H){return H===null||Pe(H)?(j.exit("codeFencedFence"),V(H)):J(H)}}}function cC(e,n,r){const a=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 a.parser.lazy[a.now().line]?r(c):n(c)}}const wh={name:"codeIndented",tokenize:hC},fC={partial:!0,tokenize:dC};function hC(e,n,r){const a=this;return l;function l(d){return e.enter("codeIndented"),lt(e,u,"linePrefix",5)(d)}function u(d){const y=a.events[a.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):Pe(d)?e.attempt(fC,c,m)(d):(e.enter("codeFlowValue"),f(d))}function f(d){return d===null||Pe(d)?(e.exit("codeFlowValue"),c(d)):(e.consume(d),f)}function m(d){return e.exit("codeIndented"),n(d)}}function dC(e,n,r){const a=this;return l;function l(c){return a.parser.lazy[a.now().line]?r(c):Pe(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),l):lt(e,u,"linePrefix",5)(c)}function u(c){const f=a.events[a.events.length-1];return f&&f[1].type==="linePrefix"&&f[2].sliceSerialize(f[1],!0).length>=4?n(c):Pe(c)?l(c):r(c)}}const mC={name:"codeText",previous:gC,resolve:pC,tokenize:yC};function pC(e){let n=e.length-4,r=3,a,l;if((e[r][1].type==="lineEnding"||e[r][1].type==="space")&&(e[n][1].type==="lineEnding"||e[n][1].type==="space")){for(a=r;++a<n;)if(e[a][1].type==="codeTextData"){e[r][1].type="codeTextPadding",e[n][1].type="codeTextPadding",r+=2,n-=2;break}}for(a=r-1,n++;++a<=n;)l===void 0?a!==n&&e[a][1].type!=="lineEnding"&&(l=a):(a===n||e[a][1].type==="lineEnding")&&(e[l][1].type="codeTextData",a!==l+2&&(e[l][1].end=e[a-1][1].end,e.splice(l+2,a-l-2),n-=a-l-2,a=l+2),l=void 0);return e}function gC(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function yC(e,n,r){let a=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),a++,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)):Pe(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||Pe(g)?(e.exit("codeTextData"),m(g)):(e.consume(g),d)}function y(g){return g===96?(e.consume(g),l++,y):l===a?(e.exit("codeTextSequence"),e.exit("codeText"),n(g)):(u.type="codeTextData",d(g))}}class bC{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 a=r??Number.POSITIVE_INFINITY;return a<this.left.length?this.left.slice(n,a):n>this.left.length?this.right.slice(this.right.length-a+this.left.length,this.right.length-n+this.left.length).reverse():this.left.slice(n).concat(this.right.slice(this.right.length-a+this.left.length).reverse())}splice(n,r,a){const l=r||0;this.setCursor(Math.trunc(n));const u=this.right.splice(this.right.length-l,Number.POSITIVE_INFINITY);return a&&ul(this.left,a),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),ul(this.left,n)}unshift(n){this.setCursor(0),this.right.push(n)}unshiftMany(n){this.setCursor(0),ul(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);ul(this.right,r.reverse())}else{const r=this.right.splice(this.left.length+this.right.length-n,Number.POSITIVE_INFINITY);ul(this.left,r.reverse())}}}function ul(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 O1(e){const n={};let r=-1,a,l,u,c,f,m,d;const y=new bC(e);for(;++r<y.length;){for(;r in n;)r=n[r];if(a=y.get(r),r&&a[1].type==="chunkFlow"&&y.get(r-1)[1].type==="listItemPrefix"&&(m=a[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(a[0]==="enter")a[1].contentType&&(Object.assign(n,vC(y,r)),r=n[r],d=!0);else if(a[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&&(a[1].end={...y.get(l)[1].start},f=y.slice(l,r),f.unshift(a),y.splice(l,r-l+1,f))}}return zn(e,0,Number.POSITIVE_INFINITY,y.slice(0)),!d}function vC(e,n){const r=e.get(n)[1],a=e.get(n)[2];let l=n-1;const u=[];let c=r._tokenizer;c||(c=a.parser[r.contentType](r.start),r._contentTypeTextTrailing&&(c._contentTypeTextTrailing=!0));const f=c.events,m=[],d={};let y,g,b=-1,x=r,k=0,z=0;const B=[z];for(;x;){for(;e.get(++l)[1]!==x;);u.push(l),x._tokenizer||(y=a.sliceStream(x),x.next||y.push(null),g&&c.defineSkip(x.start),x._isInFirstContentOfListItem&&(c._gfmTasklistFirstContentOfListItem=!0),c.write(y),x._isInFirstContentOfListItem&&(c._gfmTasklistFirstContentOfListItem=void 0)),g=x,x=x.next}for(x=r;++b<f.length;)f[b][0]==="exit"&&f[b-1][0]==="enter"&&f[b][1].type===f[b-1][1].type&&f[b][1].start.line!==f[b][1].end.line&&(z=b+1,B.push(z),x._tokenizer=void 0,x.previous=void 0,x=x.next);for(c.events=[],x?(x._tokenizer=void 0,x.previous=void 0):B.pop(),b=B.length;b--;){const M=f.slice(B[b],B[b+1]),F=u.pop();m.push([F,F+M.length-1]),e.splice(F,2,M)}for(m.reverse(),b=-1;++b<m.length;)d[k+m[b][0]]=k+m[b][1],k+=m[b][1]-m[b][0]-1;return d}const xC={resolve:SC,tokenize:_C},wC={partial:!0,tokenize:EC};function SC(e){return O1(e),e}function _C(e,n){let r;return a;function a(f){return e.enter("content"),r=e.enter("chunkContent",{contentType:"content"}),l(f)}function l(f){return f===null?u(f):Pe(f)?e.check(wC,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 EC(e,n,r){const a=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||Pe(c))return r(c);const f=a.events[a.events.length-1];return!a.parser.constructs.disable.null.includes("codeIndented")&&f&&f[1].type==="linePrefix"&&f[2].sliceSerialize(f[1],!0).length>=4?n(c):e.interrupt(a.parser.constructs.flow,r,n)(c)}}function R1(e,n,r,a,l,u,c,f,m){const d=m||Number.POSITIVE_INFINITY;let y=0;return g;function g(M){return M===60?(e.enter(a),e.enter(l),e.enter(u),e.consume(M),e.exit(u),b):M===null||M===32||M===41||ku(M)?r(M):(e.enter(a),e.enter(c),e.enter(f),e.enter("chunkString",{contentType:"string"}),z(M))}function b(M){return M===62?(e.enter(u),e.consume(M),e.exit(u),e.exit(l),e.exit(a),n):(e.enter(f),e.enter("chunkString",{contentType:"string"}),x(M))}function x(M){return M===62?(e.exit("chunkString"),e.exit(f),b(M)):M===null||M===60||Pe(M)?r(M):(e.consume(M),M===92?k:x)}function k(M){return M===60||M===62||M===92?(e.consume(M),x):x(M)}function z(M){return!y&&(M===null||M===41||_t(M))?(e.exit("chunkString"),e.exit(f),e.exit(c),e.exit(a),n(M)):y<d&&M===40?(e.consume(M),y++,z):M===41?(e.consume(M),y--,z):M===null||M===32||M===40||ku(M)?r(M):(e.consume(M),M===92?B:z)}function B(M){return M===40||M===41||M===92?(e.consume(M),z):z(M)}}function M1(e,n,r,a,l,u){const c=this;let f=0,m;return d;function d(x){return e.enter(a),e.enter(l),e.consume(x),e.exit(l),e.enter(u),y}function y(x){return f>999||x===null||x===91||x===93&&!m||x===94&&!f&&"_hiddenFootnoteSupport"in c.parser.constructs?r(x):x===93?(e.exit(u),e.enter(l),e.consume(x),e.exit(l),e.exit(a),n):Pe(x)?(e.enter("lineEnding"),e.consume(x),e.exit("lineEnding"),y):(e.enter("chunkString",{contentType:"string"}),g(x))}function g(x){return x===null||x===91||x===93||Pe(x)||f++>999?(e.exit("chunkString"),y(x)):(e.consume(x),m||(m=!et(x)),x===92?b:g)}function b(x){return x===91||x===92||x===93?(e.consume(x),f++,g):g(x)}}function D1(e,n,r,a,l,u){let c;return f;function f(b){return b===34||b===39||b===40?(e.enter(a),e.enter(l),e.consume(b),e.exit(l),c=b===40?41:b,m):r(b)}function m(b){return b===c?(e.enter(l),e.consume(b),e.exit(l),e.exit(a),n):(e.enter(u),d(b))}function d(b){return b===c?(e.exit(u),m(c)):b===null?r(b):Pe(b)?(e.enter("lineEnding"),e.consume(b),e.exit("lineEnding"),lt(e,d,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),y(b))}function y(b){return b===c||b===null||Pe(b)?(e.exit("chunkString"),d(b)):(e.consume(b),b===92?g:y)}function g(b){return b===c||b===92?(e.consume(b),y):y(b)}}function vl(e,n){let r;return a;function a(l){return Pe(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),r=!0,a):et(l)?lt(e,a,r?"linePrefix":"lineSuffix")(l):n(l)}}const kC={name:"definition",tokenize:AC},CC={partial:!0,tokenize:TC};function AC(e,n,r){const a=this;let l;return u;function u(x){return e.enter("definition"),c(x)}function c(x){return M1.call(a,e,f,r,"definitionLabel","definitionLabelMarker","definitionLabelString")(x)}function f(x){return l=ur(a.sliceSerialize(a.events[a.events.length-1][1]).slice(1,-1)),x===58?(e.enter("definitionMarker"),e.consume(x),e.exit("definitionMarker"),m):r(x)}function m(x){return _t(x)?vl(e,d)(x):d(x)}function d(x){return R1(e,y,r,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(x)}function y(x){return e.attempt(CC,g,g)(x)}function g(x){return et(x)?lt(e,b,"whitespace")(x):b(x)}function b(x){return x===null||Pe(x)?(e.exit("definition"),a.parser.defined.push(l),n(x)):r(x)}}function TC(e,n,r){return a;function a(f){return _t(f)?vl(e,l)(f):r(f)}function l(f){return D1(e,u,r,"definitionTitle","definitionTitleMarker","definitionTitleString")(f)}function u(f){return et(f)?lt(e,c,"whitespace")(f):c(f)}function c(f){return f===null||Pe(f)?n(f):r(f)}}const jC={name:"hardBreakEscape",tokenize:NC};function NC(e,n,r){return a;function a(u){return e.enter("hardBreakEscape"),e.consume(u),l}function l(u){return Pe(u)?(e.exit("hardBreakEscape"),n(u)):r(u)}}const OC={name:"headingAtx",resolve:RC,tokenize:MC};function RC(e,n){let r=e.length-2,a=3,l,u;return e[a][1].type==="whitespace"&&(a+=2),r-2>a&&e[r][1].type==="whitespace"&&(r-=2),e[r][1].type==="atxHeadingSequence"&&(a===r-1||r-4>a&&e[r-2][1].type==="whitespace")&&(r-=a+1===r?2:4),r>a&&(l={type:"atxHeadingText",start:e[a][1].start,end:e[r][1].end},u={type:"chunkText",start:e[a][1].start,end:e[r][1].end,contentType:"text"},zn(e,a,r-a+1,[["enter",l,n],["enter",u,n],["exit",u,n],["exit",l,n]])),e}function MC(e,n,r){let a=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&&a++<6?(e.consume(y),c):y===null||_t(y)?(e.exit("atxHeadingSequence"),f(y)):r(y)}function f(y){return y===35?(e.enter("atxHeadingSequence"),m(y)):y===null||Pe(y)?(e.exit("atxHeading"),n(y)):et(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||_t(y)?(e.exit("atxHeadingText"),f(y)):(e.consume(y),d)}}const DC=["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"],Gb=["pre","script","style","textarea"],zC={concrete:!0,name:"htmlFlow",resolveTo:BC,tokenize:PC},LC={partial:!0,tokenize:qC},UC={partial:!0,tokenize:HC};function BC(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 PC(e,n,r){const a=this;let l,u,c,f,m;return d;function d(_){return y(_)}function y(_){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(_),g}function g(_){return _===33?(e.consume(_),b):_===47?(e.consume(_),u=!0,z):_===63?(e.consume(_),l=3,a.interrupt?n:R):cn(_)?(e.consume(_),c=String.fromCharCode(_),B):r(_)}function b(_){return _===45?(e.consume(_),l=2,x):_===91?(e.consume(_),l=5,f=0,k):cn(_)?(e.consume(_),l=4,a.interrupt?n:R):r(_)}function x(_){return _===45?(e.consume(_),a.interrupt?n:R):r(_)}function k(_){const he="CDATA[";return _===he.charCodeAt(f++)?(e.consume(_),f===he.length?a.interrupt?n:Z:k):r(_)}function z(_){return cn(_)?(e.consume(_),c=String.fromCharCode(_),B):r(_)}function B(_){if(_===null||_===47||_===62||_t(_)){const he=_===47,pe=c.toLowerCase();return!he&&!u&&Gb.includes(pe)?(l=1,a.interrupt?n(_):Z(_)):DC.includes(c.toLowerCase())?(l=6,he?(e.consume(_),M):a.interrupt?n(_):Z(_)):(l=7,a.interrupt&&!a.parser.lazy[a.now().line]?r(_):u?F(_):G(_))}return _===45||rn(_)?(e.consume(_),c+=String.fromCharCode(_),B):r(_)}function M(_){return _===62?(e.consume(_),a.interrupt?n:Z):r(_)}function F(_){return et(_)?(e.consume(_),F):N(_)}function G(_){return _===47?(e.consume(_),N):_===58||_===95||cn(_)?(e.consume(_),se):et(_)?(e.consume(_),G):N(_)}function se(_){return _===45||_===46||_===58||_===95||rn(_)?(e.consume(_),se):O(_)}function O(_){return _===61?(e.consume(_),j):et(_)?(e.consume(_),O):G(_)}function j(_){return _===null||_===60||_===61||_===62||_===96?r(_):_===34||_===39?(e.consume(_),m=_,V):et(_)?(e.consume(_),j):J(_)}function V(_){return _===m?(e.consume(_),m=null,Y):_===null||Pe(_)?r(_):(e.consume(_),V)}function J(_){return _===null||_===34||_===39||_===47||_===60||_===61||_===62||_===96||_t(_)?O(_):(e.consume(_),J)}function Y(_){return _===47||_===62||et(_)?G(_):r(_)}function N(_){return _===62?(e.consume(_),Q):r(_)}function Q(_){return _===null||Pe(_)?Z(_):et(_)?(e.consume(_),Q):r(_)}function Z(_){return _===45&&l===2?(e.consume(_),q):_===60&&l===1?(e.consume(_),re):_===62&&l===4?(e.consume(_),U):_===63&&l===3?(e.consume(_),R):_===93&&l===5?(e.consume(_),_e):Pe(_)&&(l===6||l===7)?(e.exit("htmlFlowData"),e.check(LC,W,ge)(_)):_===null||Pe(_)?(e.exit("htmlFlowData"),ge(_)):(e.consume(_),Z)}function ge(_){return e.check(UC,fe,W)(_)}function fe(_){return e.enter("lineEnding"),e.consume(_),e.exit("lineEnding"),H}function H(_){return _===null||Pe(_)?ge(_):(e.enter("htmlFlowData"),Z(_))}function q(_){return _===45?(e.consume(_),R):Z(_)}function re(_){return _===47?(e.consume(_),c="",ye):Z(_)}function ye(_){if(_===62){const he=c.toLowerCase();return Gb.includes(he)?(e.consume(_),U):Z(_)}return cn(_)&&c.length<8?(e.consume(_),c+=String.fromCharCode(_),ye):Z(_)}function _e(_){return _===93?(e.consume(_),R):Z(_)}function R(_){return _===62?(e.consume(_),U):_===45&&l===2?(e.consume(_),R):Z(_)}function U(_){return _===null||Pe(_)?(e.exit("htmlFlowData"),W(_)):(e.consume(_),U)}function W(_){return e.exit("htmlFlow"),n(_)}}function HC(e,n,r){const a=this;return l;function l(c){return Pe(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),u):r(c)}function u(c){return a.parser.lazy[a.now().line]?r(c):n(c)}}function qC(e,n,r){return a;function a(l){return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),e.attempt(zl,n,r)}}const IC={name:"htmlText",tokenize:FC};function FC(e,n,r){const a=this;let l,u,c;return f;function f(R){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(R),m}function m(R){return R===33?(e.consume(R),d):R===47?(e.consume(R),O):R===63?(e.consume(R),G):cn(R)?(e.consume(R),J):r(R)}function d(R){return R===45?(e.consume(R),y):R===91?(e.consume(R),u=0,k):cn(R)?(e.consume(R),F):r(R)}function y(R){return R===45?(e.consume(R),x):r(R)}function g(R){return R===null?r(R):R===45?(e.consume(R),b):Pe(R)?(c=g,re(R)):(e.consume(R),g)}function b(R){return R===45?(e.consume(R),x):g(R)}function x(R){return R===62?q(R):R===45?b(R):g(R)}function k(R){const U="CDATA[";return R===U.charCodeAt(u++)?(e.consume(R),u===U.length?z:k):r(R)}function z(R){return R===null?r(R):R===93?(e.consume(R),B):Pe(R)?(c=z,re(R)):(e.consume(R),z)}function B(R){return R===93?(e.consume(R),M):z(R)}function M(R){return R===62?q(R):R===93?(e.consume(R),M):z(R)}function F(R){return R===null||R===62?q(R):Pe(R)?(c=F,re(R)):(e.consume(R),F)}function G(R){return R===null?r(R):R===63?(e.consume(R),se):Pe(R)?(c=G,re(R)):(e.consume(R),G)}function se(R){return R===62?q(R):G(R)}function O(R){return cn(R)?(e.consume(R),j):r(R)}function j(R){return R===45||rn(R)?(e.consume(R),j):V(R)}function V(R){return Pe(R)?(c=V,re(R)):et(R)?(e.consume(R),V):q(R)}function J(R){return R===45||rn(R)?(e.consume(R),J):R===47||R===62||_t(R)?Y(R):r(R)}function Y(R){return R===47?(e.consume(R),q):R===58||R===95||cn(R)?(e.consume(R),N):Pe(R)?(c=Y,re(R)):et(R)?(e.consume(R),Y):q(R)}function N(R){return R===45||R===46||R===58||R===95||rn(R)?(e.consume(R),N):Q(R)}function Q(R){return R===61?(e.consume(R),Z):Pe(R)?(c=Q,re(R)):et(R)?(e.consume(R),Q):Y(R)}function Z(R){return R===null||R===60||R===61||R===62||R===96?r(R):R===34||R===39?(e.consume(R),l=R,ge):Pe(R)?(c=Z,re(R)):et(R)?(e.consume(R),Z):(e.consume(R),fe)}function ge(R){return R===l?(e.consume(R),l=void 0,H):R===null?r(R):Pe(R)?(c=ge,re(R)):(e.consume(R),ge)}function fe(R){return R===null||R===34||R===39||R===60||R===61||R===96?r(R):R===47||R===62||_t(R)?Y(R):(e.consume(R),fe)}function H(R){return R===47||R===62||_t(R)?Y(R):r(R)}function q(R){return R===62?(e.consume(R),e.exit("htmlTextData"),e.exit("htmlText"),n):r(R)}function re(R){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(R),e.exit("lineEnding"),ye}function ye(R){return et(R)?lt(e,_e,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(R):_e(R)}function _e(R){return e.enter("htmlTextData"),c(R)}}const Ld={name:"labelEnd",resolveAll:VC,resolveTo:JC,tokenize:XC},$C={tokenize:QC},GC={tokenize:KC},YC={tokenize:ZC};function VC(e){let n=-1;const r=[];for(;++n<e.length;){const a=e[n][1];if(r.push(e[n]),a.type==="labelImage"||a.type==="labelLink"||a.type==="labelEnd"){const l=a.type==="labelImage"?4:2;a.type="data",n+=l}}return e.length!==r.length&&zn(e,0,e.length,r),e}function JC(e,n){let r=e.length,a=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")){a=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+a+2][1].end},end:{...e[c-2][1].start}};return f=[["enter",m,n],["enter",d,n]],f=Kn(f,e.slice(u+1,u+a+3)),f=Kn(f,[["enter",y,n]]),f=Kn(f,Lu(n.parser.constructs.insideSpan.null,e.slice(u+a+4,c-3),n)),f=Kn(f,[["exit",y,n],e[c-2],e[c-1],["exit",d,n]]),f=Kn(f,e.slice(c+1)),f=Kn(f,[["exit",m,n]]),zn(e,u,e.length,f),e}function XC(e,n,r){const a=this;let l=a.events.length,u,c;for(;l--;)if((a.events[l][1].type==="labelImage"||a.events[l][1].type==="labelLink")&&!a.events[l][1]._balanced){u=a.events[l][1];break}return f;function f(b){return u?u._inactive?g(b):(c=a.parser.defined.includes(ur(a.sliceSerialize({start:u.end,end:a.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(b),e.exit("labelMarker"),e.exit("labelEnd"),m):r(b)}function m(b){return b===40?e.attempt($C,y,c?y:g)(b):b===91?e.attempt(GC,y,c?d:g)(b):c?y(b):g(b)}function d(b){return e.attempt(YC,y,g)(b)}function y(b){return n(b)}function g(b){return u._balanced=!0,r(b)}}function QC(e,n,r){return a;function a(g){return e.enter("resource"),e.enter("resourceMarker"),e.consume(g),e.exit("resourceMarker"),l}function l(g){return _t(g)?vl(e,u)(g):u(g)}function u(g){return g===41?y(g):R1(e,c,f,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(g)}function c(g){return _t(g)?vl(e,m)(g):y(g)}function f(g){return r(g)}function m(g){return g===34||g===39||g===40?D1(e,d,r,"resourceTitle","resourceTitleMarker","resourceTitleString")(g):y(g)}function d(g){return _t(g)?vl(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 KC(e,n,r){const a=this;return l;function l(f){return M1.call(a,e,u,c,"reference","referenceMarker","referenceString")(f)}function u(f){return a.parser.defined.includes(ur(a.sliceSerialize(a.events[a.events.length-1][1]).slice(1,-1)))?n(f):r(f)}function c(f){return r(f)}}function ZC(e,n,r){return a;function a(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 WC={name:"labelStartImage",resolveAll:Ld.resolveAll,tokenize:eA};function eA(e,n,r){const a=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 a.parser.constructs?r(f):n(f)}}const tA={name:"labelStartLink",resolveAll:Ld.resolveAll,tokenize:nA};function nA(e,n,r){const a=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 a.parser.constructs?r(c):n(c)}}const Sh={name:"lineEnding",tokenize:rA};function rA(e,n){return r;function r(a){return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),lt(e,n,"linePrefix")}}const hu={name:"thematicBreak",tokenize:iA};function iA(e,n,r){let a=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)):a>=3&&(d===null||Pe(d))?(e.exit("thematicBreak"),n(d)):r(d)}function m(d){return d===l?(e.consume(d),a++,m):(e.exit("thematicBreakSequence"),et(d)?lt(e,f,"whitespace")(d):f(d))}}const vn={continuation:{tokenize:oA},exit:cA,name:"list",tokenize:lA},aA={partial:!0,tokenize:fA},sA={partial:!0,tokenize:uA};function lA(e,n,r){const a=this,l=a.events[a.events.length-1];let u=l&&l[1].type==="linePrefix"?l[2].sliceSerialize(l[1],!0).length:0,c=0;return f;function f(x){const k=a.containerState.type||(x===42||x===43||x===45?"listUnordered":"listOrdered");if(k==="listUnordered"?!a.containerState.marker||x===a.containerState.marker:rd(x)){if(a.containerState.type||(a.containerState.type=k,e.enter(k,{_container:!0})),k==="listUnordered")return e.enter("listItemPrefix"),x===42||x===45?e.check(hu,r,d)(x):d(x);if(!a.interrupt||x===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),m(x)}return r(x)}function m(x){return rd(x)&&++c<10?(e.consume(x),m):(!a.interrupt||c<2)&&(a.containerState.marker?x===a.containerState.marker:x===41||x===46)?(e.exit("listItemValue"),d(x)):r(x)}function d(x){return e.enter("listItemMarker"),e.consume(x),e.exit("listItemMarker"),a.containerState.marker=a.containerState.marker||x,e.check(zl,a.interrupt?r:y,e.attempt(aA,b,g))}function y(x){return a.containerState.initialBlankLine=!0,u++,b(x)}function g(x){return et(x)?(e.enter("listItemPrefixWhitespace"),e.consume(x),e.exit("listItemPrefixWhitespace"),b):r(x)}function b(x){return a.containerState.size=u+a.sliceSerialize(e.exit("listItemPrefix"),!0).length,n(x)}}function oA(e,n,r){const a=this;return a.containerState._closeFlow=void 0,e.check(zl,l,u);function l(f){return a.containerState.furtherBlankLines=a.containerState.furtherBlankLines||a.containerState.initialBlankLine,lt(e,n,"listItemIndent",a.containerState.size+1)(f)}function u(f){return a.containerState.furtherBlankLines||!et(f)?(a.containerState.furtherBlankLines=void 0,a.containerState.initialBlankLine=void 0,c(f)):(a.containerState.furtherBlankLines=void 0,a.containerState.initialBlankLine=void 0,e.attempt(sA,n,c)(f))}function c(f){return a.containerState._closeFlow=!0,a.interrupt=void 0,lt(e,e.attempt(vn,n,r),"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(f)}}function uA(e,n,r){const a=this;return lt(e,l,"listItemIndent",a.containerState.size+1);function l(u){const c=a.events[a.events.length-1];return c&&c[1].type==="listItemIndent"&&c[2].sliceSerialize(c[1],!0).length===a.containerState.size?n(u):r(u)}}function cA(e){e.exit(this.containerState.type)}function fA(e,n,r){const a=this;return lt(e,l,"listItemPrefixWhitespace",a.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function l(u){const c=a.events[a.events.length-1];return!et(u)&&c&&c[1].type==="listItemPrefixWhitespace"?n(u):r(u)}}const Yb={name:"setextUnderline",resolveTo:hA,tokenize:dA};function hA(e,n){let r=e.length,a,l,u;for(;r--;)if(e[r][0]==="enter"){if(e[r][1].type==="content"){a=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[a][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[a][1],n]),e[a][1].end={...e[u][1].end}):e[a][1]=c,e.push(["exit",c,n]),e}function dA(e,n,r){const a=this;let l;return u;function u(d){let y=a.events.length,g;for(;y--;)if(a.events[y][1].type!=="lineEnding"&&a.events[y][1].type!=="linePrefix"&&a.events[y][1].type!=="content"){g=a.events[y][1].type==="paragraph";break}return!a.parser.lazy[a.now().line]&&(a.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"),et(d)?lt(e,m,"lineSuffix")(d):m(d))}function m(d){return d===null||Pe(d)?(e.exit("setextHeadingLine"),n(d)):r(d)}}const mA={tokenize:pA};function pA(e){const n=this,r=e.attempt(zl,a,e.attempt(this.parser.constructs.flowInitial,l,lt(e,e.attempt(this.parser.constructs.flow,l,e.attempt(xC,l)),"linePrefix")));return r;function a(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 gA={resolveAll:L1()},yA=z1("string"),bA=z1("text");function z1(e){return{resolveAll:L1(e==="text"?vA:void 0),tokenize:n};function n(r){const a=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 b=-1;if(g)for(;++b<g.length;){const x=g[b];if(!x.previous||x.previous.call(a,a.previous))return!0}return!1}}}function L1(e){return n;function n(r,a){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,a):r}}function vA(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 a=e[r-1][1],l=n.sliceStream(a);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:a.start._bufferIndex+c,_index:a.start._index+u,line:a.end.line,column:a.end.column-f,offset:a.end.offset-f},end:{...a.end}};a.end={...d.start},a.start.offset===a.end.offset?Object.assign(a,d):(e.splice(r,0,["enter",d,n],["exit",d,n]),r+=2)}r++}return e}const xA={42:vn,43:vn,45:vn,48:vn,49:vn,50:vn,51:vn,52:vn,53:vn,54:vn,55:vn,56:vn,57:vn,62:T1},wA={91:kC},SA={[-2]:wh,[-1]:wh,32:wh},_A={35:OC,42:hu,45:[Yb,hu],60:zC,61:Yb,95:hu,96:$b,126:$b},EA={38:N1,92:j1},kA={[-5]:Sh,[-4]:Sh,[-3]:Sh,33:WC,38:N1,42:id,60:[tC,IC],91:tA,92:[jC,j1],93:Ld,95:id,96:mC},CA={null:[id,gA]},AA={null:[42,95]},TA={null:[]},jA=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:AA,contentInitial:wA,disable:TA,document:xA,flow:_A,flowInitial:SA,insideSpan:CA,string:EA,text:kA},Symbol.toStringTag,{value:"Module"}));function NA(e,n,r){let a={_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:V(O),check:V(j),consume:F,enter:G,exit:se,interrupt:V(j,{interrupt:!0})},d={code:null,containerState:{},defineSkip:z,events:[],now:k,parser:e,previous:null,sliceSerialize:b,sliceStream:x,write:g};let y=n.tokenize.call(d,m);return n.resolveAll&&u.push(n),d;function g(Q){return c=Kn(c,Q),B(),c[c.length-1]!==null?[]:(J(n,0),d.events=Lu(u,d.events,d),d.events)}function b(Q,Z){return RA(x(Q),Z)}function x(Q){return OA(c,Q)}function k(){const{_bufferIndex:Q,_index:Z,line:ge,column:fe,offset:H}=a;return{_bufferIndex:Q,_index:Z,line:ge,column:fe,offset:H}}function z(Q){l[Q.line]=Q.column,N()}function B(){let Q;for(;a._index<c.length;){const Z=c[a._index];if(typeof Z=="string")for(Q=a._index,a._bufferIndex<0&&(a._bufferIndex=0);a._index===Q&&a._bufferIndex<Z.length;)M(Z.charCodeAt(a._bufferIndex));else M(Z)}}function M(Q){y=y(Q)}function F(Q){Pe(Q)?(a.line++,a.column=1,a.offset+=Q===-3?2:1,N()):Q!==-1&&(a.column++,a.offset++),a._bufferIndex<0?a._index++:(a._bufferIndex++,a._bufferIndex===c[a._index].length&&(a._bufferIndex=-1,a._index++)),d.previous=Q}function G(Q,Z){const ge=Z||{};return ge.type=Q,ge.start=k(),d.events.push(["enter",ge,d]),f.push(ge),ge}function se(Q){const Z=f.pop();return Z.end=k(),d.events.push(["exit",Z,d]),Z}function O(Q,Z){J(Q,Z.from)}function j(Q,Z){Z.restore()}function V(Q,Z){return ge;function ge(fe,H,q){let re,ye,_e,R;return Array.isArray(fe)?W(fe):"tokenize"in fe?W([fe]):U(fe);function U(ve){return je;function je(De){const ke=De!==null&&ve[De],ze=De!==null&&ve.null,$e=[...Array.isArray(ke)?ke:ke?[ke]:[],...Array.isArray(ze)?ze:ze?[ze]:[]];return W($e)(De)}}function W(ve){return re=ve,ye=0,ve.length===0?q:_(ve[ye])}function _(ve){return je;function je(De){return R=Y(),_e=ve,ve.partial||(d.currentConstruct=ve),ve.name&&d.parser.constructs.disable.null.includes(ve.name)?pe():ve.tokenize.call(Z?Object.assign(Object.create(d),Z):d,m,he,pe)(De)}}function he(ve){return Q(_e,R),H}function pe(ve){return R.restore(),++ye<re.length?_(re[ye]):q}}}function J(Q,Z){Q.resolveAll&&!u.includes(Q)&&u.push(Q),Q.resolve&&zn(d.events,Z,d.events.length-Z,Q.resolve(d.events.slice(Z),d)),Q.resolveTo&&(d.events=Q.resolveTo(d.events,d))}function Y(){const Q=k(),Z=d.previous,ge=d.currentConstruct,fe=d.events.length,H=Array.from(f);return{from:fe,restore:q};function q(){a=Q,d.previous=Z,d.currentConstruct=ge,d.events.length=fe,f=H,N()}}function N(){a.line in l&&a.column<2&&(a.column=l[a.line],a.offset+=l[a.line]-1)}}function OA(e,n){const r=n.start._index,a=n.start._bufferIndex,l=n.end._index,u=n.end._bufferIndex;let c;if(r===l)c=[e[r].slice(a,u)];else{if(c=e.slice(r,l),a>-1){const f=c[0];typeof f=="string"?c[0]=f.slice(a):c.shift()}u>0&&c.push(e[l].slice(0,u))}return c}function RA(e,n){let r=-1;const a=[];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=`
|
|
92
|
+
`;break}case-3:{c=`\r
|
|
93
|
+
`;break}case-2:{c=n?" ":" ";break}case-1:{if(!n&&l)continue;c=" ";break}default:c=String.fromCharCode(u)}l=u===-2,a.push(c)}return a.join("")}function MA(e){const a={constructs:C1([jA,...(e||{}).extensions||[]]),content:l(J2),defined:[],document:l(Q2),flow:l(mA),lazy:{},string:l(yA),text:l(bA)};return a;function l(u){return c;function c(f){return NA(a,u,f)}}}function DA(e){for(;!O1(e););return e}const Vb=/[\0\t\n\r]/g;function zA(){let e=1,n="",r=!0,a;return l;function l(u,c,f){const m=[];let d,y,g,b,x;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(Vb.lastIndex=g,d=Vb.exec(u),b=d&&d.index!==void 0?d.index:u.length,x=u.charCodeAt(b),!d){n=u.slice(g);break}if(x===10&&g===b&&a)m.push(-3),a=void 0;else switch(a&&(m.push(-5),a=void 0),g<b&&(m.push(u.slice(g,b)),e+=b-g),x){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:a=!0,e=1}g=b+1}return f&&(a&&m.push(-5),n&&m.push(n),m.push(null)),m}}const LA=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function UA(e){return e.replace(LA,BA)}function BA(e,n,r){if(n)return n;if(r.charCodeAt(0)===35){const l=r.charCodeAt(1),u=l===120||l===88;return A1(r.slice(u?2:1),u?16:10)}return zd(r)||e}const U1={}.hasOwnProperty;function PA(e,n,r){return n&&typeof n=="object"&&(r=n,n=void 0),HA(r)(DA(MA(r).document().write(zA()(e,n,!0))))}function HA(e){const n={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:u(hn),autolinkProtocol:Y,autolinkEmail:Y,atxHeading:u(xe),blockQuote:u(ze),characterEscape:Y,characterReference:Y,codeFenced:u($e),codeFencedFenceInfo:c,codeFencedFenceMeta:c,codeIndented:u($e,c),codeText:u(Ie,c),codeTextData:Y,data:Y,codeFlowValue:Y,definition:u(qe),definitionDestinationString:c,definitionLabelString:c,definitionTitleString:c,emphasis:u(rt),hardBreakEscape:u(Le),hardBreakTrailing:u(Le),htmlFlow:u(Fe,c),htmlFlowData:Y,htmlText:u(Fe,c),htmlTextData:Y,image:u(Tt),label:c,link:u(hn),listItem:u(en),listItemValue:b,listOrdered:u(Wn,g),listUnordered:u(Wn),paragraph:u(wn),reference:_,referenceString:c,resourceDestinationString:c,resourceTitleString:c,setextHeading:u(xe),strong:u(fr),thematicBreak:u(Mi)},exit:{atxHeading:m(),atxHeadingSequence:O,autolink:m(),autolinkEmail:ke,autolinkProtocol:De,blockQuote:m(),characterEscapeValue:N,characterReferenceMarkerHexadecimal:pe,characterReferenceMarkerNumeric:pe,characterReferenceValue:ve,characterReference:je,codeFenced:m(B),codeFencedFence:z,codeFencedFenceInfo:x,codeFencedFenceMeta:k,codeFlowValue:N,codeIndented:m(M),codeText:m(H),codeTextData:N,data:N,definition:m(),definitionDestinationString:se,definitionLabelString:F,definitionTitleString:G,emphasis:m(),hardBreakEscape:m(Z),hardBreakTrailing:m(Z),htmlFlow:m(ge),htmlFlowData:N,htmlText:m(fe),htmlTextData:N,image:m(re),label:_e,labelText:ye,lineEnding:Q,link:m(q),listItem:m(),listOrdered:m(),listUnordered:m(),paragraph:m(),referenceString:he,resourceDestinationString:R,resourceTitleString:U,resource:W,setextHeading:m(J),setextHeadingLineSequence:V,setextHeadingText:j,strong:m(),thematicBreak:m()}};B1(n,(e||{}).mdastExtensions||[]);const r={};return a;function a(oe){let Se={type:"root",children:[]};const Be={stack:[Se],tokenStack:[],config:n,enter:f,exit:d,buffer:c,resume:y,data:r},Ye=[];let it=-1;for(;++it<oe.length;)if(oe[it][1].type==="listOrdered"||oe[it][1].type==="listUnordered")if(oe[it][0]==="enter")Ye.push(it);else{const Ce=Ye.pop();it=l(oe,Ce,it)}for(it=-1;++it<oe.length;){const Ce=n[oe[it][0]];U1.call(Ce,oe[it][1].type)&&Ce[oe[it][1].type].call(Object.assign({sliceSerialize:oe[it][2].sliceSerialize},Be),oe[it][1])}if(Be.tokenStack.length>0){const Ce=Be.tokenStack[Be.tokenStack.length-1];(Ce[1]||Jb).call(Be,void 0,Ce[0])}for(Se.position={start:ki(oe.length>0?oe[0][1].start:{line:1,column:1,offset:0}),end:ki(oe.length>0?oe[oe.length-2][1].end:{line:1,column:1,offset:0})},it=-1;++it<n.transforms.length;)Se=n.transforms[it](Se)||Se;return Se}function l(oe,Se,Be){let Ye=Se-1,it=-1,Ce=!1,Ve,st,ot,ct;for(;++Ye<=Be;){const mt=oe[Ye];switch(mt[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{mt[0]==="enter"?it++:it--,ct=void 0;break}case"lineEndingBlank":{mt[0]==="enter"&&(Ve&&!ct&&!it&&!ot&&(ot=Ye),ct=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:ct=void 0}if(!it&&mt[0]==="enter"&&mt[1].type==="listItemPrefix"||it===-1&&mt[0]==="exit"&&(mt[1].type==="listUnordered"||mt[1].type==="listOrdered")){if(Ve){let Bn=Ye;for(st=void 0;Bn--;){const sn=oe[Bn];if(sn[1].type==="lineEnding"||sn[1].type==="lineEndingBlank"){if(sn[0]==="exit")continue;st&&(oe[st][1].type="lineEndingBlank",Ce=!0),sn[1].type="lineEnding",st=Bn}else if(!(sn[1].type==="linePrefix"||sn[1].type==="blockQuotePrefix"||sn[1].type==="blockQuotePrefixWhitespace"||sn[1].type==="blockQuoteMarker"||sn[1].type==="listItemIndent"))break}ot&&(!st||ot<st)&&(Ve._spread=!0),Ve.end=Object.assign({},st?oe[st][1].start:mt[1].end),oe.splice(st||Ye,0,["exit",Ve,mt[2]]),Ye++,Be++}if(mt[1].type==="listItemPrefix"){const Bn={type:"listItem",_spread:!1,start:Object.assign({},mt[1].start),end:void 0};Ve=Bn,oe.splice(Ye,0,["enter",Bn,mt[2]]),Ye++,Be++,ot=void 0,ct=!0}}}return oe[Se][1]._spread=Ce,Be}function u(oe,Se){return Be;function Be(Ye){f.call(this,oe(Ye),Ye),Se&&Se.call(this,Ye)}}function c(){this.stack.push({type:"fragment",children:[]})}function f(oe,Se,Be){this.stack[this.stack.length-1].children.push(oe),this.stack.push(oe),this.tokenStack.push([Se,Be||void 0]),oe.position={start:ki(Se.start),end:void 0}}function m(oe){return Se;function Se(Be){oe&&oe.call(this,Be),d.call(this,Be)}}function d(oe,Se){const Be=this.stack.pop(),Ye=this.tokenStack.pop();if(Ye)Ye[0].type!==oe.type&&(Se?Se.call(this,oe,Ye[0]):(Ye[1]||Jb).call(this,oe,Ye[0]));else throw new Error("Cannot close `"+oe.type+"` ("+bl({start:oe.start,end:oe.end})+"): it’s not open");Be.position.end=ki(oe.end)}function y(){return Dd(this.stack.pop())}function g(){this.data.expectingFirstListItemValue=!0}function b(oe){if(this.data.expectingFirstListItemValue){const Se=this.stack[this.stack.length-2];Se.start=Number.parseInt(this.sliceSerialize(oe),10),this.data.expectingFirstListItemValue=void 0}}function x(){const oe=this.resume(),Se=this.stack[this.stack.length-1];Se.lang=oe}function k(){const oe=this.resume(),Se=this.stack[this.stack.length-1];Se.meta=oe}function z(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function B(){const oe=this.resume(),Se=this.stack[this.stack.length-1];Se.value=oe.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function M(){const oe=this.resume(),Se=this.stack[this.stack.length-1];Se.value=oe.replace(/(\r?\n|\r)$/g,"")}function F(oe){const Se=this.resume(),Be=this.stack[this.stack.length-1];Be.label=Se,Be.identifier=ur(this.sliceSerialize(oe)).toLowerCase()}function G(){const oe=this.resume(),Se=this.stack[this.stack.length-1];Se.title=oe}function se(){const oe=this.resume(),Se=this.stack[this.stack.length-1];Se.url=oe}function O(oe){const Se=this.stack[this.stack.length-1];if(!Se.depth){const Be=this.sliceSerialize(oe).length;Se.depth=Be}}function j(){this.data.setextHeadingSlurpLineEnding=!0}function V(oe){const Se=this.stack[this.stack.length-1];Se.depth=this.sliceSerialize(oe).codePointAt(0)===61?1:2}function J(){this.data.setextHeadingSlurpLineEnding=void 0}function Y(oe){const Be=this.stack[this.stack.length-1].children;let Ye=Be[Be.length-1];(!Ye||Ye.type!=="text")&&(Ye=yt(),Ye.position={start:ki(oe.start),end:void 0},Be.push(Ye)),this.stack.push(Ye)}function N(oe){const Se=this.stack.pop();Se.value+=this.sliceSerialize(oe),Se.position.end=ki(oe.end)}function Q(oe){const Se=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Be=Se.children[Se.children.length-1];Be.position.end=ki(oe.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&n.canContainEols.includes(Se.type)&&(Y.call(this,oe),N.call(this,oe))}function Z(){this.data.atHardBreak=!0}function ge(){const oe=this.resume(),Se=this.stack[this.stack.length-1];Se.value=oe}function fe(){const oe=this.resume(),Se=this.stack[this.stack.length-1];Se.value=oe}function H(){const oe=this.resume(),Se=this.stack[this.stack.length-1];Se.value=oe}function q(){const oe=this.stack[this.stack.length-1];if(this.data.inReference){const Se=this.data.referenceType||"shortcut";oe.type+="Reference",oe.referenceType=Se,delete oe.url,delete oe.title}else delete oe.identifier,delete oe.label;this.data.referenceType=void 0}function re(){const oe=this.stack[this.stack.length-1];if(this.data.inReference){const Se=this.data.referenceType||"shortcut";oe.type+="Reference",oe.referenceType=Se,delete oe.url,delete oe.title}else delete oe.identifier,delete oe.label;this.data.referenceType=void 0}function ye(oe){const Se=this.sliceSerialize(oe),Be=this.stack[this.stack.length-2];Be.label=UA(Se),Be.identifier=ur(Se).toLowerCase()}function _e(){const oe=this.stack[this.stack.length-1],Se=this.resume(),Be=this.stack[this.stack.length-1];if(this.data.inReference=!0,Be.type==="link"){const Ye=oe.children;Be.children=Ye}else Be.alt=Se}function R(){const oe=this.resume(),Se=this.stack[this.stack.length-1];Se.url=oe}function U(){const oe=this.resume(),Se=this.stack[this.stack.length-1];Se.title=oe}function W(){this.data.inReference=void 0}function _(){this.data.referenceType="collapsed"}function he(oe){const Se=this.resume(),Be=this.stack[this.stack.length-1];Be.label=Se,Be.identifier=ur(this.sliceSerialize(oe)).toLowerCase(),this.data.referenceType="full"}function pe(oe){this.data.characterReferenceType=oe.type}function ve(oe){const Se=this.sliceSerialize(oe),Be=this.data.characterReferenceType;let Ye;Be?(Ye=A1(Se,Be==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Ye=zd(Se);const it=this.stack[this.stack.length-1];it.value+=Ye}function je(oe){const Se=this.stack.pop();Se.position.end=ki(oe.end)}function De(oe){N.call(this,oe);const Se=this.stack[this.stack.length-1];Se.url=this.sliceSerialize(oe)}function ke(oe){N.call(this,oe);const Se=this.stack[this.stack.length-1];Se.url="mailto:"+this.sliceSerialize(oe)}function ze(){return{type:"blockquote",children:[]}}function $e(){return{type:"code",lang:null,meta:null,value:""}}function Ie(){return{type:"inlineCode",value:""}}function qe(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function rt(){return{type:"emphasis",children:[]}}function xe(){return{type:"heading",depth:0,children:[]}}function Le(){return{type:"break"}}function Fe(){return{type:"html",value:""}}function Tt(){return{type:"image",title:null,url:"",alt:null}}function hn(){return{type:"link",title:null,url:"",children:[]}}function Wn(oe){return{type:"list",ordered:oe.type==="listOrdered",start:null,spread:oe._spread,children:[]}}function en(oe){return{type:"listItem",spread:oe._spread,checked:null,children:[]}}function wn(){return{type:"paragraph",children:[]}}function fr(){return{type:"strong",children:[]}}function yt(){return{type:"text",value:""}}function Mi(){return{type:"thematicBreak"}}}function ki(e){return{line:e.line,column:e.column,offset:e.offset}}function B1(e,n){let r=-1;for(;++r<n.length;){const a=n[r];Array.isArray(a)?B1(e,a):qA(e,a)}}function qA(e,n){let r;for(r in n)if(U1.call(n,r))switch(r){case"canContainEols":{const a=n[r];a&&e[r].push(...a);break}case"transforms":{const a=n[r];a&&e[r].push(...a);break}case"enter":case"exit":{const a=n[r];a&&Object.assign(e[r],a);break}}}function Jb(e,n){throw e?new Error("Cannot close `"+e.type+"` ("+bl({start:e.start,end:e.end})+"): a different token (`"+n.type+"`, "+bl({start:n.start,end:n.end})+") is open"):new Error("Cannot close document, a token (`"+n.type+"`, "+bl({start:n.start,end:n.end})+") is still open")}function IA(e){const n=this;n.parser=r;function r(a){return PA(a,{...n.data("settings"),...e,extensions:n.data("micromarkExtensions")||[],mdastExtensions:n.data("fromMarkdownExtensions")||[]})}}function FA(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 $A(e,n){const r={type:"element",tagName:"br",properties:{},children:[]};return e.patch(n,r),[e.applyData(n,r),{type:"text",value:`
|
|
94
|
+
`}]}function GA(e,n){const r=n.value?n.value+`
|
|
95
|
+
`:"",a={},l=n.lang?n.lang.split(/\s+/):[];l.length>0&&(a.className=["language-"+l[0]]);let u={type:"element",tagName:"code",properties:a,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 YA(e,n){const r={type:"element",tagName:"del",properties:{},children:e.all(n)};return e.patch(n,r),e.applyData(n,r)}function VA(e,n){const r={type:"element",tagName:"em",properties:{},children:e.all(n)};return e.patch(n,r),e.applyData(n,r)}function JA(e,n){const r=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",a=String(n.identifier).toUpperCase(),l=fs(a.toLowerCase()),u=e.footnoteOrder.indexOf(a);let c,f=e.footnoteCounts.get(a);f===void 0?(f=0,e.footnoteOrder.push(a),c=e.footnoteOrder.length):c=u+1,f+=1,e.footnoteCounts.set(a,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 XA(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 QA(e,n){if(e.options.allowDangerousHtml){const r={type:"raw",value:n.value};return e.patch(n,r),e.applyData(n,r)}}function P1(e,n){const r=n.referenceType;let a="]";if(r==="collapsed"?a+="[]":r==="full"&&(a+="["+(n.label||n.identifier)+"]"),n.type==="imageReference")return[{type:"text",value:"!["+n.alt+a}];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+=a:l.push({type:"text",value:a}),l}function KA(e,n){const r=String(n.identifier).toUpperCase(),a=e.definitionById.get(r);if(!a)return P1(e,n);const l={src:fs(a.url||""),alt:n.alt};a.title!==null&&a.title!==void 0&&(l.title=a.title);const u={type:"element",tagName:"img",properties:l,children:[]};return e.patch(n,u),e.applyData(n,u)}function ZA(e,n){const r={src:fs(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 a={type:"element",tagName:"img",properties:r,children:[]};return e.patch(n,a),e.applyData(n,a)}function WA(e,n){const r={type:"text",value:n.value.replace(/\r?\n|\r/g," ")};e.patch(n,r);const a={type:"element",tagName:"code",properties:{},children:[r]};return e.patch(n,a),e.applyData(n,a)}function eT(e,n){const r=String(n.identifier).toUpperCase(),a=e.definitionById.get(r);if(!a)return P1(e,n);const l={href:fs(a.url||"")};a.title!==null&&a.title!==void 0&&(l.title=a.title);const u={type:"element",tagName:"a",properties:l,children:e.all(n)};return e.patch(n,u),e.applyData(n,u)}function tT(e,n){const r={href:fs(n.url)};n.title!==null&&n.title!==void 0&&(r.title=n.title);const a={type:"element",tagName:"a",properties:r,children:e.all(n)};return e.patch(n,a),e.applyData(n,a)}function nT(e,n,r){const a=e.all(n),l=r?rT(r):H1(n),u={},c=[];if(typeof n.checked=="boolean"){const y=a[0];let g;y&&y.type==="element"&&y.tagName==="p"?g=y:(g={type:"element",tagName:"p",properties:{},children:[]},a.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<a.length;){const y=a[f];(l||f!==0||y.type!=="element"||y.tagName!=="p")&&c.push({type:"text",value:`
|
|
96
|
+
`}),y.type==="element"&&y.tagName==="p"&&!l?c.push(...y.children):c.push(y)}const m=a[a.length-1];m&&(l||m.type!=="element"||m.tagName!=="p")&&c.push({type:"text",value:`
|
|
97
|
+
`});const d={type:"element",tagName:"li",properties:u,children:c};return e.patch(n,d),e.applyData(n,d)}function rT(e){let n=!1;if(e.type==="list"){n=e.spread||!1;const r=e.children;let a=-1;for(;!n&&++a<r.length;)n=H1(r[a])}return n}function H1(e){const n=e.spread;return n??e.children.length>1}function iT(e,n){const r={},a=e.all(n);let l=-1;for(typeof n.start=="number"&&n.start!==1&&(r.start=n.start);++l<a.length;){const c=a[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(a,!0)};return e.patch(n,u),e.applyData(n,u)}function aT(e,n){const r={type:"element",tagName:"p",properties:{},children:e.all(n)};return e.patch(n,r),e.applyData(n,r)}function sT(e,n){const r={type:"root",children:e.wrap(e.all(n))};return e.patch(n,r),e.applyData(n,r)}function lT(e,n){const r={type:"element",tagName:"strong",properties:{},children:e.all(n)};return e.patch(n,r),e.applyData(n,r)}function oT(e,n){const r=e.all(n),a=r.shift(),l=[];if(a){const c={type:"element",tagName:"thead",properties:{},children:e.wrap([a],!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=Nd(n.children[1]),m=v1(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 uT(e,n,r){const a=r?r.children:void 0,u=(a?a.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],b={},x=c?c[m]:void 0;x&&(b.align=x);let k={type:"element",tagName:u,properties:b,children:[]};g&&(k.children=e.all(g),e.patch(g,k),k=e.applyData(g,k)),d.push(k)}const y={type:"element",tagName:"tr",properties:{},children:e.wrap(d,!0)};return e.patch(n,y),e.applyData(n,y)}function cT(e,n){const r={type:"element",tagName:"td",properties:{},children:e.all(n)};return e.patch(n,r),e.applyData(n,r)}const Xb=9,Qb=32;function fT(e){const n=String(e),r=/\r?\n|\r/g;let a=r.exec(n),l=0;const u=[];for(;a;)u.push(Kb(n.slice(l,a.index),l>0,!0),a[0]),l=a.index+a[0].length,a=r.exec(n);return u.push(Kb(n.slice(l),l>0,!1)),u.join("")}function Kb(e,n,r){let a=0,l=e.length;if(n){let u=e.codePointAt(a);for(;u===Xb||u===Qb;)a++,u=e.codePointAt(a)}if(r){let u=e.codePointAt(l-1);for(;u===Xb||u===Qb;)l--,u=e.codePointAt(l-1)}return l>a?e.slice(a,l):""}function hT(e,n){const r={type:"text",value:fT(String(n.value))};return e.patch(n,r),e.applyData(n,r)}function dT(e,n){const r={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(n,r),e.applyData(n,r)}const mT={blockquote:FA,break:$A,code:GA,delete:YA,emphasis:VA,footnoteReference:JA,heading:XA,html:QA,imageReference:KA,image:ZA,inlineCode:WA,linkReference:eT,link:tT,listItem:nT,list:iT,paragraph:aT,root:sT,strong:lT,table:oT,tableCell:cT,tableRow:uT,text:hT,thematicBreak:dT,toml:ru,yaml:ru,definition:ru,footnoteDefinition:ru};function ru(){}const q1=-1,Uu=0,xl=1,Cu=2,Ud=3,Bd=4,Pd=5,Hd=6,I1=7,F1=8,Zb=typeof self=="object"?self:globalThis,pT=(e,n)=>{const r=(l,u)=>(e.set(u,l),l),a=l=>{if(e.has(l))return e.get(l);const[u,c]=n[l];switch(u){case Uu:case q1:return r(c,l);case xl:{const f=r([],l);for(const m of c)f.push(a(m));return f}case Cu:{const f=r({},l);for(const[m,d]of c)f[a(m)]=a(d);return f}case Ud:return r(new Date(c),l);case Bd:{const{source:f,flags:m}=c;return r(new RegExp(f,m),l)}case Pd:{const f=r(new Map,l);for(const[m,d]of c)f.set(a(m),a(d));return f}case Hd:{const f=r(new Set,l);for(const m of c)f.add(a(m));return f}case I1:{const{name:f,message:m}=c;return r(new Zb[f](m),l)}case F1: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 Zb[u](c),l)};return a},Wb=e=>pT(new Map,e)(0),Ga="",{toString:gT}={},{keys:yT}=Object,cl=e=>{const n=typeof e;if(n!=="object"||!e)return[Uu,n];const r=gT.call(e).slice(8,-1);switch(r){case"Array":return[xl,Ga];case"Object":return[Cu,Ga];case"Date":return[Ud,Ga];case"RegExp":return[Bd,Ga];case"Map":return[Pd,Ga];case"Set":return[Hd,Ga];case"DataView":return[xl,r]}return r.includes("Array")?[xl,r]:r.includes("Error")?[I1,r]:[Cu,r]},iu=([e,n])=>e===Uu&&(n==="function"||n==="symbol"),bT=(e,n,r,a)=>{const l=(c,f)=>{const m=a.push(c)-1;return r.set(f,m),m},u=c=>{if(r.has(c))return r.get(c);let[f,m]=cl(c);switch(f){case Uu:{let y=c;switch(m){case"bigint":f=F1,y=c.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+m);y=null;break;case"undefined":return l([q1],c)}return l([f,y],c)}case xl:{if(m){let b=c;return m==="DataView"?b=new Uint8Array(c.buffer):m==="ArrayBuffer"&&(b=new Uint8Array(c)),l([m,[...b]],c)}const y=[],g=l([f,y],c);for(const b of c)y.push(u(b));return g}case Cu:{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 b of yT(c))(e||!iu(cl(c[b])))&&y.push([u(b),u(c[b])]);return g}case Ud:return l([f,c.toISOString()],c);case Bd:{const{source:y,flags:g}=c;return l([f,{source:y,flags:g}],c)}case Pd:{const y=[],g=l([f,y],c);for(const[b,x]of c)(e||!(iu(cl(b))||iu(cl(x))))&&y.push([u(b),u(x)]);return g}case Hd:{const y=[],g=l([f,y],c);for(const b of c)(e||!iu(cl(b)))&&y.push(u(b));return g}}const{message:d}=c;return l([f,{name:m,message:d}],c)};return u},e0=(e,{json:n,lossy:r}={})=>{const a=[];return bT(!(n||r),!!n,new Map,a)(e),a},Au=typeof structuredClone=="function"?(e,n)=>n&&("json"in n||"lossy"in n)?Wb(e0(e,n)):structuredClone(e):(e,n)=>Wb(e0(e,n));function vT(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 xT(e,n){return"Back to reference "+(e+1)+(n>1?"-"+n:"")}function wT(e){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=e.options.footnoteBackContent||vT,a=e.options.footnoteBackLabel||xT,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(),b=fs(g.toLowerCase());let x=0;const k=[],z=e.footnoteCounts.get(g);for(;z!==void 0&&++x<=z;){k.length>0&&k.push({type:"text",value:" "});let F=typeof r=="string"?r:r(m,x);typeof F=="string"&&(F={type:"text",value:F}),k.push({type:"element",tagName:"a",properties:{href:"#"+n+"fnref-"+b+(x>1?"-"+x:""),dataFootnoteBackref:"",ariaLabel:typeof a=="string"?a:a(m,x),className:["data-footnote-backref"]},children:Array.isArray(F)?F:[F]})}const B=y[y.length-1];if(B&&B.type==="element"&&B.tagName==="p"){const F=B.children[B.children.length-1];F&&F.type==="text"?F.value+=" ":B.children.push({type:"text",value:" "}),B.children.push(...k)}else y.push(...k);const M={type:"element",tagName:"li",properties:{id:n+"fn-"+b},children:e.wrap(y,!0)};e.patch(d,M),f.push(M)}if(f.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:u,properties:{...Au(c),id:"footnote-label"},children:[{type:"text",value:l}]},{type:"text",value:`
|
|
98
|
+
`},{type:"element",tagName:"ol",properties:{},children:e.wrap(f,!0)},{type:"text",value:`
|
|
99
|
+
`}]}}const Bu=(function(e){if(e==null)return kT;if(typeof e=="function")return Pu(e);if(typeof e=="object")return Array.isArray(e)?ST(e):_T(e);if(typeof e=="string")return ET(e);throw new Error("Expected function, string, or object as test")});function ST(e){const n=[];let r=-1;for(;++r<e.length;)n[r]=Bu(e[r]);return Pu(a);function a(...l){let u=-1;for(;++u<n.length;)if(n[u].apply(this,l))return!0;return!1}}function _T(e){const n=e;return Pu(r);function r(a){const l=a;let u;for(u in e)if(l[u]!==n[u])return!1;return!0}}function ET(e){return Pu(n);function n(r){return r&&r.type===e}}function Pu(e){return n;function n(r,a,l){return!!(CT(r)&&e.call(this,r,typeof a=="number"?a:void 0,l||void 0))}}function kT(){return!0}function CT(e){return e!==null&&typeof e=="object"&&"type"in e}const $1=[],AT=!0,ad=!1,TT="skip";function G1(e,n,r,a){let l;typeof n=="function"&&typeof r!="function"?(a=r,r=n):l=n;const u=Bu(l),c=a?-1:1;f(e,void 0,[])();function f(m,d,y){const g=m&&typeof m=="object"?m:{};if(typeof g.type=="string"){const x=typeof g.tagName=="string"?g.tagName:typeof g.name=="string"?g.name:void 0;Object.defineProperty(b,"name",{value:"node ("+(m.type+(x?"<"+x+">":""))+")"})}return b;function b(){let x=$1,k,z,B;if((!n||u(m,d,y[y.length-1]||void 0))&&(x=jT(r(m,y)),x[0]===ad))return x;if("children"in m&&m.children){const M=m;if(M.children&&x[0]!==TT)for(z=(a?M.children.length:-1)+c,B=y.concat(M);z>-1&&z<M.children.length;){const F=M.children[z];if(k=f(F,z,B)(),k[0]===ad)return k;z=typeof k[1]=="number"?k[1]:z+c}}return x}}}function jT(e){return Array.isArray(e)?e:typeof e=="number"?[AT,e]:e==null?$1:[e]}function qd(e,n,r,a){let l,u,c;typeof n=="function"&&typeof r!="function"?(u=void 0,c=n,l=r):(u=n,c=r,l=a),G1(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 sd={}.hasOwnProperty,NT={};function OT(e,n){const r=n||NT,a=new Map,l=new Map,u=new Map,c={...mT,...r.handlers},f={all:d,applyData:MT,definitionById:a,footnoteById:l,footnoteCounts:u,footnoteOrder:[],handlers:c,one:m,options:r,patch:RT,wrap:zT};return qd(e,function(y){if(y.type==="definition"||y.type==="footnoteDefinition"){const g=y.type==="definition"?a:l,b=String(y.identifier).toUpperCase();g.has(b)||g.set(b,y)}}),f;function m(y,g){const b=y.type,x=f.handlers[b];if(sd.call(f.handlers,b)&&x)return x(f,y,g);if(f.options.passThrough&&f.options.passThrough.includes(b)){if("children"in y){const{children:z,...B}=y,M=Au(B);return M.children=f.all(y),M}return Au(y)}return(f.options.unknownHandler||DT)(f,y,g)}function d(y){const g=[];if("children"in y){const b=y.children;let x=-1;for(;++x<b.length;){const k=f.one(b[x],y);if(k){if(x&&b[x-1].type==="break"&&(!Array.isArray(k)&&k.type==="text"&&(k.value=t0(k.value)),!Array.isArray(k)&&k.type==="element")){const z=k.children[0];z&&z.type==="text"&&(z.value=t0(z.value))}Array.isArray(k)?g.push(...k):g.push(k)}}}return g}}function RT(e,n){e.position&&(n.position=x2(e))}function MT(e,n){let r=n;if(e&&e.data){const a=e.data.hName,l=e.data.hChildren,u=e.data.hProperties;if(typeof a=="string")if(r.type==="element")r.tagName=a;else{const c="children"in r?r.children:[r];r={type:"element",tagName:a,properties:{},children:c}}r.type==="element"&&u&&Object.assign(r.properties,Au(u)),"children"in r&&r.children&&l!==null&&l!==void 0&&(r.children=l)}return r}function DT(e,n){const r=n.data||{},a="value"in n&&!(sd.call(r,"hProperties")||sd.call(r,"hChildren"))?{type:"text",value:n.value}:{type:"element",tagName:"div",properties:{},children:e.all(n)};return e.patch(n,a),e.applyData(n,a)}function zT(e,n){const r=[];let a=-1;for(n&&r.push({type:"text",value:`
|
|
100
|
+
`});++a<e.length;)a&&r.push({type:"text",value:`
|
|
101
|
+
`}),r.push(e[a]);return n&&e.length>0&&r.push({type:"text",value:`
|
|
102
|
+
`}),r}function t0(e){let n=0,r=e.charCodeAt(n);for(;r===9||r===32;)n++,r=e.charCodeAt(n);return e.slice(n)}function n0(e,n){const r=OT(e,n),a=r.one(e,void 0),l=wT(r),u=Array.isArray(a)?{type:"root",children:a}:a||{type:"root",children:[]};return l&&u.children.push({type:"text",value:`
|
|
103
|
+
`},l),u}function LT(e,n){return e&&"run"in e?async function(r,a){const l=n0(r,{file:a,...n});await e.run(l,a)}:function(r,a){return n0(r,{file:a,...e||n})}}function r0(e){if(e)throw e}var _h,i0;function UT(){if(i0)return _h;i0=1;var e=Object.prototype.hasOwnProperty,n=Object.prototype.toString,r=Object.defineProperty,a=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 b;for(b in d);return typeof b>"u"||e.call(d,b)},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(a)return a(d,y).value}else return;return d[y]};return _h=function m(){var d,y,g,b,x,k,z=arguments[0],B=1,M=arguments.length,F=!1;for(typeof z=="boolean"&&(F=z,z=arguments[1]||{},B=2),(z==null||typeof z!="object"&&typeof z!="function")&&(z={});B<M;++B)if(d=arguments[B],d!=null)for(y in d)g=f(z,y),b=f(d,y),z!==b&&(F&&b&&(u(b)||(x=l(b)))?(x?(x=!1,k=g&&l(g)?g:[]):k=g&&u(g)?g:{},c(z,{name:y,newValue:m(F,k,b)})):typeof b<"u"&&c(z,{name:y,newValue:b}));return z},_h}var BT=UT();const Eh=x0(BT);function ld(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 PT(){const e=[],n={run:r,use:a};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?HT(y,f)(...d):c(null,...d)}}function a(l){if(typeof l!="function")throw new TypeError("Expected `middelware` to be a function, not "+l);return e.push(l),n}}function HT(e,n){let r;return a;function a(...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 yr={basename:qT,dirname:IT,extname:FT,join:$T,sep:"/"};function qT(e,n){if(n!==void 0&&typeof n!="string")throw new TypeError('"ext" argument must be a string');Ll(e);let r=0,a=-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 a<0&&(u=!0,a=l+1);return a<0?"":e.slice(r,a)}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&&(a=l):(f=-1,a=c));return r===a?a=c:a<0&&(a=e.length),e.slice(r,a)}function IT(e){if(Ll(e),e.length===0)return".";let n=-1,r=e.length,a;for(;--r;)if(e.codePointAt(r)===47){if(a){n=r;break}}else a||(a=!0);return n<0?e.codePointAt(0)===47?"/":".":n===1&&e.codePointAt(0)===47?"//":e.slice(0,n)}function FT(e){Ll(e);let n=e.length,r=-1,a=0,l=-1,u=0,c;for(;n--;){const f=e.codePointAt(n);if(f===47){if(c){a=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===a+1?"":e.slice(l,r)}function $T(...e){let n=-1,r;for(;++n<e.length;)Ll(e[n]),e[n]&&(r=r===void 0?e[n]:r+"/"+e[n]);return r===void 0?".":GT(r)}function GT(e){Ll(e);const n=e.codePointAt(0)===47;let r=YT(e,!n);return r.length===0&&!n&&(r="."),r.length>0&&e.codePointAt(e.length-1)===47&&(r+="/"),n?"/"+r:r}function YT(e,n){let r="",a=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||a!==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="",a=0):(r=r.slice(0,m),a=r.length-1-r.lastIndexOf("/")),l=c,u=0;continue}}else if(r.length>0){r="",a=0,l=c,u=0;continue}}n&&(r=r.length>0?r+"/..":"..",a=2)}else r.length>0?r+="/"+e.slice(l+1,c):r=e.slice(l+1,c),a=c-l-1;l=c,u=0}else f===46&&u>-1?u++:u=-1}return r}function Ll(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const VT={cwd:JT};function JT(){return"/"}function od(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function XT(e){if(typeof e=="string")e=new URL(e);else if(!od(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 QT(e)}function QT(e){if(e.hostname!==""){const a=new TypeError('File URL host must be "localhost" or empty on darwin');throw a.code="ERR_INVALID_FILE_URL_HOST",a}const n=e.pathname;let r=-1;for(;++r<n.length;)if(n.codePointAt(r)===37&&n.codePointAt(r+1)===50){const a=n.codePointAt(r+2);if(a===70||a===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 kh=["history","path","basename","stem","extname","dirname"];class Y1{constructor(n){let r;n?od(n)?r={path:n}:typeof n=="string"||KT(n)?r={value:n}:r=n:r={},this.cwd="cwd"in r?"":VT.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let a=-1;for(;++a<kh.length;){const u=kh[a];u in r&&r[u]!==void 0&&r[u]!==null&&(this[u]=u==="history"?[...r[u]]:r[u])}let l;for(l in r)kh.includes(l)||(this[l]=r[l])}get basename(){return typeof this.path=="string"?yr.basename(this.path):void 0}set basename(n){Ah(n,"basename"),Ch(n,"basename"),this.path=yr.join(this.dirname||"",n)}get dirname(){return typeof this.path=="string"?yr.dirname(this.path):void 0}set dirname(n){a0(this.basename,"dirname"),this.path=yr.join(n||"",this.basename)}get extname(){return typeof this.path=="string"?yr.extname(this.path):void 0}set extname(n){if(Ch(n,"extname"),a0(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=yr.join(this.dirname,this.stem+(n||""))}get path(){return this.history[this.history.length-1]}set path(n){od(n)&&(n=XT(n)),Ah(n,"path"),this.path!==n&&this.history.push(n)}get stem(){return typeof this.path=="string"?yr.basename(this.path,this.extname):void 0}set stem(n){Ah(n,"stem"),Ch(n,"stem"),this.path=yr.join(this.dirname||"",n+(this.extname||""))}fail(n,r,a){const l=this.message(n,r,a);throw l.fatal=!0,l}info(n,r,a){const l=this.message(n,r,a);return l.fatal=void 0,l}message(n,r,a){const l=new an(n,r,a);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 Ch(e,n){if(e&&e.includes(yr.sep))throw new Error("`"+n+"` cannot be a path: did not expect `"+yr.sep+"`")}function Ah(e,n){if(!e)throw new Error("`"+n+"` cannot be empty")}function a0(e,n){if(!e)throw new Error("Setting `"+n+"` requires `path` to be set too")}function KT(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const ZT=(function(e){const a=this.constructor.prototype,l=a[e],u=function(){return l.apply(u,arguments)};return Object.setPrototypeOf(u,a),u}),WT={}.hasOwnProperty;class Id extends ZT{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=PT()}copy(){const n=new Id;let r=-1;for(;++r<this.attachers.length;){const a=this.attachers[r];n.use(...a)}return n.data(Eh(!0,{},this.namespace)),n}data(n,r){return typeof n=="string"?arguments.length===2?(Nh("data",this.frozen),this.namespace[n]=r,this):WT.call(this.namespace,n)&&this.namespace[n]||void 0:n?(Nh("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,...a]=this.attachers[this.freezeIndex];if(a[0]===!1)continue;a[0]===!0&&(a[0]=void 0);const l=r.call(n,...a);typeof l=="function"&&this.transformers.use(l)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(n){this.freeze();const r=au(n),a=this.parser||this.Parser;return Th("parse",a),a(String(r),r)}process(n,r){const a=this;return this.freeze(),Th("process",this.parser||this.Parser),jh("process",this.compiler||this.Compiler),r?l(void 0,r):new Promise(l);function l(u,c){const f=au(n),m=a.parse(f);a.run(m,f,function(y,g,b){if(y||!g||!b)return d(y);const x=g,k=a.stringify(x,b);nj(k)?b.value=k:b.result=k,d(y,b)});function d(y,g){y||!g?c(y):u?u(g):r(void 0,g)}}}processSync(n){let r=!1,a;return this.freeze(),Th("processSync",this.parser||this.Parser),jh("processSync",this.compiler||this.Compiler),this.process(n,l),l0("processSync","process",r),a;function l(u,c){r=!0,r0(u),a=c}}run(n,r,a){s0(n),this.freeze();const l=this.transformers;return!a&&typeof r=="function"&&(a=r,r=void 0),a?u(void 0,a):new Promise(u);function u(c,f){const m=au(r);l.run(n,m,d);function d(y,g,b){const x=g||n;y?f(y):c?c(x):a(void 0,x,b)}}}runSync(n,r){let a=!1,l;return this.run(n,r,u),l0("runSync","run",a),l;function u(c,f){r0(c),l=f,a=!0}}stringify(n,r){this.freeze();const a=au(r),l=this.compiler||this.Compiler;return jh("stringify",l),s0(n),l(n,a)}use(n,...r){const a=this.attachers,l=this.namespace;if(Nh("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=Eh(!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,b=-1;for(;++g<a.length;)if(a[g][0]===d){b=g;break}if(b===-1)a.push([d,...y]);else if(y.length>0){let[x,...k]=y;const z=a[b][1];ld(z)&&ld(x)&&(x=Eh(!0,z,x)),a[b]=[d,x,...k]}}}}const ej=new Id().freeze();function Th(e,n){if(typeof n!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function jh(e,n){if(typeof n!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Nh(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 s0(e){if(!ld(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function l0(e,n,r){if(!r)throw new Error("`"+e+"` finished async. Use `"+n+"` instead")}function au(e){return tj(e)?e:new Y1(e)}function tj(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function nj(e){return typeof e=="string"||rj(e)}function rj(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const ij="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",o0=[],u0={allowDangerousHtml:!0},aj=/^(https?|ircs?|mailto|xmpp)$/i,sj=[{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 c0(e){const n=lj(e),r=oj(e);return uj(n.runSync(n.parse(r),r),e)}function lj(e){const n=e.rehypePlugins||o0,r=e.remarkPlugins||o0,a=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...u0}:u0;return ej().use(IA).use(r).use(LT,a).use(n)}function oj(e){const n=e.children||"",r=new Y1;return typeof n=="string"&&(r.value=n),r}function uj(e,n){const r=n.allowedElements,a=n.allowElement,l=n.components,u=n.disallowedElements,c=n.skipHtml,f=n.unwrapDisallowed,m=n.urlTransform||cj;for(const y of sj)Object.hasOwn(n,y.from)&&(""+y.from+(y.to?"use `"+y.to+"` instead":"remove it")+ij+y.id,void 0);return qd(e,d),k2(e,{Fragment:w.Fragment,components:l,ignoreInvalidStyle:!0,jsx:w.jsx,jsxs:w.jsxs,passKeys:!0,passNode:!0});function d(y,g,b){if(y.type==="raw"&&b&&typeof g=="number")return c?b.children.splice(g,1):b.children[g]={type:"text",value:y.value},g;if(y.type==="element"){let x;for(x in xh)if(Object.hasOwn(xh,x)&&Object.hasOwn(y.properties,x)){const k=y.properties[x],z=xh[x];(z===null||z.includes(y.tagName))&&(y.properties[x]=m(String(k||""),x,y))}}if(y.type==="element"){let x=r?!r.includes(y.tagName):u?u.includes(y.tagName):!1;if(!x&&a&&typeof g=="number"&&(x=!a(y,g,b)),x&&b&&typeof g=="number")return f&&y.children?b.children.splice(g,1,...y.children):b.children.splice(g,1),g}}}function cj(e){const n=e.indexOf(":"),r=e.indexOf("?"),a=e.indexOf("#"),l=e.indexOf("/");return n===-1||l!==-1&&n>l||r!==-1&&n>r||a!==-1&&n>a||aj.test(e.slice(0,n))?e:""}function f0(e,n){const r=String(e);if(typeof n!="string")throw new TypeError("Expected character");let a=0,l=r.indexOf(n);for(;l!==-1;)a++,l=r.indexOf(n,l+n.length);return a}function fj(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function V1(e,n,r){const l=Bu((r||{}).ignore||[]),u=hj(n);let c=-1;for(;++c<u.length;)G1(e,"text",f);function f(d,y){let g=-1,b;for(;++g<y.length;){const x=y[g],k=b?b.children:void 0;if(l(x,k?k.indexOf(x):void 0,b))return;b=x}if(b)return m(d,y)}function m(d,y){const g=y[y.length-1],b=u[c][0],x=u[c][1];let k=0;const B=g.children.indexOf(d);let M=!1,F=[];b.lastIndex=0;let G=b.exec(d.value);for(;G;){const se=G.index,O={index:G.index,input:G.input,stack:[...y,d]};let j=x(...G,O);if(typeof j=="string"&&(j=j.length>0?{type:"text",value:j}:void 0),j===!1?b.lastIndex=se+1:(k!==se&&F.push({type:"text",value:d.value.slice(k,se)}),Array.isArray(j)?F.push(...j):j&&F.push(j),k=se+G[0].length,M=!0),!b.global)break;G=b.exec(d.value)}return M?(k<d.value.length&&F.push({type:"text",value:d.value.slice(k)}),g.children.splice(B,1,...F)):F=[d],B+F.length}}function hj(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 a=-1;for(;++a<r.length;){const l=r[a];n.push([dj(l[0]),mj(l[1])])}return n}function dj(e){return typeof e=="string"?new RegExp(fj(e),"g"):e}function mj(e){return typeof e=="function"?e:function(){return e}}const Oh="phrasing",Rh=["autolink","link","image","label"];function pj(){return{transforms:[Sj],enter:{literalAutolink:yj,literalAutolinkEmail:Mh,literalAutolinkHttp:Mh,literalAutolinkWww:Mh},exit:{literalAutolink:wj,literalAutolinkEmail:xj,literalAutolinkHttp:bj,literalAutolinkWww:vj}}}function gj(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Oh,notInConstruct:Rh},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Oh,notInConstruct:Rh},{character:":",before:"[ps]",after:"\\/",inConstruct:Oh,notInConstruct:Rh}]}}function yj(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function Mh(e){this.config.enter.autolinkProtocol.call(this,e)}function bj(e){this.config.exit.autolinkProtocol.call(this,e)}function vj(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 xj(e){this.config.exit.autolinkEmail.call(this,e)}function wj(e){this.exit(e)}function Sj(e){V1(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,_j],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),Ej]],{ignore:["link","linkReference"]})}function _j(e,n,r,a,l){let u="";if(!J1(l)||(/^w/i.test(n)&&(r=n+r,n="",u="http://"),!kj(r)))return!1;const c=Cj(r+a);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 Ej(e,n,r,a){return!J1(a,!0)||/[-\d_]$/.test(r)?!1:{type:"link",title:null,url:"mailto:"+n+"@"+r,children:[{type:"text",value:n+"@"+r}]}}function kj(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 Cj(e){const n=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!n)return[e,void 0];e=e.slice(0,n.index);let r=n[0],a=r.indexOf(")");const l=f0(e,"(");let u=f0(e,")");for(;a!==-1&&l>u;)e+=r.slice(0,a+1),r=r.slice(a+1),a=r.indexOf(")"),u++;return[e,r]}function J1(e,n){const r=e.input.charCodeAt(e.index-1);return(e.index===0||ra(r)||zu(r))&&(!n||r!==47)}X1.peek=zj;function Aj(){this.buffer()}function Tj(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function jj(){this.buffer()}function Nj(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function Oj(e){const n=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=ur(this.sliceSerialize(e)).toLowerCase(),r.label=n}function Rj(e){this.exit(e)}function Mj(e){const n=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=ur(this.sliceSerialize(e)).toLowerCase(),r.label=n}function Dj(e){this.exit(e)}function zj(){return"["}function X1(e,n,r,a){const l=r.createTracker(a);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 Lj(){return{enter:{gfmFootnoteCallString:Aj,gfmFootnoteCall:Tj,gfmFootnoteDefinitionLabelString:jj,gfmFootnoteDefinition:Nj},exit:{gfmFootnoteCallString:Oj,gfmFootnoteCall:Rj,gfmFootnoteDefinitionLabelString:Mj,gfmFootnoteDefinition:Dj}}}function Uj(e){let n=!1;return e&&e.firstLineBlank&&(n=!0),{handlers:{footnoteDefinition:r,footnoteReference:X1},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function r(a,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(a),{before:m,after:"]"})),y(),m+=f.move("]:"),a.children&&a.children.length>0&&(f.shift(4),m+=f.move((n?`
|
|
104
|
+
`:" ")+u.indentLines(u.containerFlow(a,f.current()),n?Q1:Bj))),d(),m}}function Bj(e,n,r){return n===0?e:Q1(e,n,r)}function Q1(e,n,r){return(r?"":" ")+e}const Pj=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];K1.peek=$j;function Hj(){return{canContainEols:["delete"],enter:{strikethrough:Ij},exit:{strikethrough:Fj}}}function qj(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:Pj}],handlers:{delete:K1}}}function Ij(e){this.enter({type:"delete",children:[]},e)}function Fj(e){this.exit(e)}function K1(e,n,r,a){const l=r.createTracker(a),u=r.enter("strikethrough");let c=l.move("~~");return c+=r.containerPhrasing(e,{...l.current(),before:c,after:"~"}),c+=l.move("~~"),u(),c}function $j(){return"~"}function Gj(e){return e.length}function Yj(e,n){const r=n||{},a=(r.align||[]).concat(),l=r.stringLength||Gj,u=[],c=[],f=[],m=[];let d=0,y=-1;for(;++y<e.length;){const z=[],B=[];let M=-1;for(e[y].length>d&&(d=e[y].length);++M<e[y].length;){const F=Vj(e[y][M]);if(r.alignDelimiters!==!1){const G=l(F);B[M]=G,(m[M]===void 0||G>m[M])&&(m[M]=G)}z.push(F)}c[y]=z,f[y]=B}let g=-1;if(typeof a=="object"&&"length"in a)for(;++g<d;)u[g]=h0(a[g]);else{const z=h0(a);for(;++g<d;)u[g]=z}g=-1;const b=[],x=[];for(;++g<d;){const z=u[g];let B="",M="";z===99?(B=":",M=":"):z===108?B=":":z===114&&(M=":");let F=r.alignDelimiters===!1?1:Math.max(1,m[g]-B.length-M.length);const G=B+"-".repeat(F)+M;r.alignDelimiters!==!1&&(F=B.length+F+M.length,F>m[g]&&(m[g]=F),x[g]=F),b[g]=G}c.splice(1,0,b),f.splice(1,0,x),y=-1;const k=[];for(;++y<c.length;){const z=c[y],B=f[y];g=-1;const M=[];for(;++g<d;){const F=z[g]||"";let G="",se="";if(r.alignDelimiters!==!1){const O=m[g]-(B[g]||0),j=u[g];j===114?G=" ".repeat(O):j===99?O%2?(G=" ".repeat(O/2+.5),se=" ".repeat(O/2-.5)):(G=" ".repeat(O/2),se=G):se=" ".repeat(O)}r.delimiterStart!==!1&&!g&&M.push("|"),r.padding!==!1&&!(r.alignDelimiters===!1&&F==="")&&(r.delimiterStart!==!1||g)&&M.push(" "),r.alignDelimiters!==!1&&M.push(G),M.push(F),r.alignDelimiters!==!1&&M.push(se),r.padding!==!1&&M.push(" "),(r.delimiterEnd!==!1||g!==d-1)&&M.push("|")}k.push(r.delimiterEnd===!1?M.join("").replace(/ +$/,""):M.join(""))}return k.join(`
|
|
105
|
+
`)}function Vj(e){return e==null?"":String(e)}function h0(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 Jj(e,n,r,a){const l=r.enter("blockquote"),u=r.createTracker(a);u.move("> "),u.shift(2);const c=r.indentLines(r.containerFlow(e,u.current()),Xj);return l(),c}function Xj(e,n,r){return">"+(r?"":" ")+e}function Qj(e,n){return d0(e,n.inConstruct,!0)&&!d0(e,n.notInConstruct,!1)}function d0(e,n,r){if(typeof n=="string"&&(n=[n]),!n||n.length===0)return r;let a=-1;for(;++a<n.length;)if(e.includes(n[a]))return!0;return!1}function m0(e,n,r,a){let l=-1;for(;++l<r.unsafe.length;)if(r.unsafe[l].character===`
|
|
106
|
+
`&&Qj(r.stack,r.unsafe[l]))return/[ \t]/.test(a.before)?"":" ";return`\\
|
|
107
|
+
`}function Kj(e,n){const r=String(e);let a=r.indexOf(n),l=a,u=0,c=0;if(typeof n!="string")throw new TypeError("Expected substring");for(;a!==-1;)a===l?++u>c&&(c=u):u=1,l=a+n.length,a=r.indexOf(n,l);return c}function Zj(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 Wj(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 eN(e,n,r,a){const l=Wj(r),u=e.value||"",c=l==="`"?"GraveAccent":"Tilde";if(Zj(e,r)){const g=r.enter("codeIndented"),b=r.indentLines(u,tN);return g(),b}const f=r.createTracker(a),m=l.repeat(Math.max(Kj(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:`
|
|
108
|
+
`,encode:["`"],...f.current()})),g()}return y+=f.move(`
|
|
109
|
+
`),u&&(y+=f.move(u+`
|
|
110
|
+
`)),y+=f.move(m),d(),y}function tN(e,n,r){return(r?"":" ")+e}function Fd(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 nN(e,n,r,a){const l=Fd(r),u=l==='"'?"Quote":"Apostrophe",c=r.enter("definition");let f=r.enter("label");const m=r.createTracker(a);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?" ":`
|
|
111
|
+
`,...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 rN(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 Al(e){return"&#x"+e.toString(16).toUpperCase()+";"}function Tu(e,n,r){const a=ss(e),l=ss(n);return a===void 0?l===void 0?r==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:l===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:a===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}}Z1.peek=iN;function Z1(e,n,r,a){const l=rN(r),u=r.enter("emphasis"),c=r.createTracker(a),f=c.move(l);let m=c.move(r.containerPhrasing(e,{after:l,before:f,...c.current()}));const d=m.charCodeAt(0),y=Tu(a.before.charCodeAt(a.before.length-1),d,l);y.inside&&(m=Al(d)+m.slice(1));const g=m.charCodeAt(m.length-1),b=Tu(a.after.charCodeAt(0),g,l);b.inside&&(m=m.slice(0,-1)+Al(g));const x=c.move(l);return u(),r.attentionEncodeSurroundingInfo={after:b.outside,before:y.outside},f+m+x}function iN(e,n,r){return r.options.emphasis||"*"}function aN(e,n){let r=!1;return qd(e,function(a){if("value"in a&&/\r?\n|\r/.test(a.value)||a.type==="break")return r=!0,ad}),!!((!e.depth||e.depth<3)&&Dd(e)&&(n.options.setext||r))}function sN(e,n,r,a){const l=Math.max(Math.min(6,e.depth||1),1),u=r.createTracker(a);if(aN(e,r)){const y=r.enter("headingSetext"),g=r.enter("phrasing"),b=r.containerPhrasing(e,{...u.current(),before:`
|
|
112
|
+
`,after:`
|
|
113
|
+
`});return g(),y(),b+`
|
|
114
|
+
`+(l===1?"=":"-").repeat(b.length-(Math.max(b.lastIndexOf("\r"),b.lastIndexOf(`
|
|
115
|
+
`))+1))}const c="#".repeat(l),f=r.enter("headingAtx"),m=r.enter("phrasing");u.move(c+" ");let d=r.containerPhrasing(e,{before:"# ",after:`
|
|
116
|
+
`,...u.current()});return/^[\t ]/.test(d)&&(d=Al(d.charCodeAt(0))+d.slice(1)),d=d?c+" "+d:c,r.options.closeAtx&&(d+=" "+c),m(),f(),d}W1.peek=lN;function W1(e){return e.value||""}function lN(){return"<"}ev.peek=oN;function ev(e,n,r,a){const l=Fd(r),u=l==='"'?"Quote":"Apostrophe",c=r.enter("image");let f=r.enter("label");const m=r.createTracker(a);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 oN(){return"!"}tv.peek=uN;function tv(e,n,r,a){const l=e.referenceType,u=r.enter("imageReference");let c=r.enter("label");const f=r.createTracker(a);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 uN(){return"!"}nv.peek=cN;function nv(e,n,r){let a=e.value||"",l="`",u=-1;for(;new RegExp("(^|[^`])"+l+"([^`]|$)").test(a);)l+="`";for(/[^ \r\n]/.test(a)&&(/^[ \r\n]/.test(a)&&/[ \r\n]$/.test(a)||/^`|`$/.test(a))&&(a=" "+a+" ");++u<r.unsafe.length;){const c=r.unsafe[u],f=r.compilePattern(c);let m;if(c.atBreak)for(;m=f.exec(a);){let d=m.index;a.charCodeAt(d)===10&&a.charCodeAt(d-1)===13&&d--,a=a.slice(0,d)+" "+a.slice(m.index+1)}}return l+a+l}function cN(){return"`"}function rv(e,n){const r=Dd(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))}iv.peek=fN;function iv(e,n,r,a){const l=Fd(r),u=l==='"'?"Quote":"Apostrophe",c=r.createTracker(a);let f,m;if(rv(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 fN(e,n,r){return rv(e,r)?"<":"["}av.peek=hN;function av(e,n,r,a){const l=e.referenceType,u=r.enter("linkReference");let c=r.enter("label");const f=r.createTracker(a);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 hN(){return"["}function $d(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 dN(e){const n=$d(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 mN(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 sv(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 pN(e,n,r,a){const l=r.enter("list"),u=r.bulletCurrent;let c=e.ordered?mN(r):$d(r);const f=e.ordered?c==="."?")":".":dN(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),sv(r)===c&&y){let g=-1;for(;++g<e.children.length;){const b=e.children[g];if(b&&b.type==="listItem"&&b.children&&b.children[0]&&b.children[0].type==="thematicBreak"){m=!0;break}}}}m&&(c=f),r.bulletCurrent=c;const d=r.containerFlow(e,a);return r.bulletLastUsed=c,r.bulletCurrent=u,l(),d}function gN(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 yN(e,n,r,a){const l=gN(r);let u=r.bulletCurrent||$d(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(a);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,b,x){return b?(x?"":" ".repeat(c))+g:(x?u:u+" ".repeat(c-u.length))+g}}function bN(e,n,r,a){const l=r.enter("paragraph"),u=r.enter("phrasing"),c=r.containerPhrasing(e,a);return u(),l(),c}const vN=Bu(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function xN(e,n,r,a){return(e.children.some(function(c){return vN(c)})?r.containerPhrasing:r.containerFlow).call(r,e,a)}function wN(e){const n=e.options.strong||"*";if(n!=="*"&&n!=="_")throw new Error("Cannot serialize strong with `"+n+"` for `options.strong`, expected `*`, or `_`");return n}lv.peek=SN;function lv(e,n,r,a){const l=wN(r),u=r.enter("strong"),c=r.createTracker(a),f=c.move(l+l);let m=c.move(r.containerPhrasing(e,{after:l,before:f,...c.current()}));const d=m.charCodeAt(0),y=Tu(a.before.charCodeAt(a.before.length-1),d,l);y.inside&&(m=Al(d)+m.slice(1));const g=m.charCodeAt(m.length-1),b=Tu(a.after.charCodeAt(0),g,l);b.inside&&(m=m.slice(0,-1)+Al(g));const x=c.move(l+l);return u(),r.attentionEncodeSurroundingInfo={after:b.outside,before:y.outside},f+m+x}function SN(e,n,r){return r.options.strong||"*"}function _N(e,n,r,a){return r.safe(e.value,a)}function EN(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 kN(e,n,r){const a=(sv(r)+(r.options.ruleSpaces?" ":"")).repeat(EN(r));return r.options.ruleSpaces?a.slice(0,-1):a}const ov={blockquote:Jj,break:m0,code:eN,definition:nN,emphasis:Z1,hardBreak:m0,heading:sN,html:W1,image:ev,imageReference:tv,inlineCode:nv,link:iv,linkReference:av,list:pN,listItem:yN,paragraph:bN,root:xN,strong:lv,text:_N,thematicBreak:kN};function CN(){return{enter:{table:AN,tableData:p0,tableHeader:p0,tableRow:jN},exit:{codeText:NN,table:TN,tableData:Dh,tableHeader:Dh,tableRow:Dh}}}function AN(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 TN(e){this.exit(e),this.data.inTable=void 0}function jN(e){this.enter({type:"tableRow",children:[]},e)}function Dh(e){this.exit(e)}function p0(e){this.enter({type:"tableCell",children:[]},e)}function NN(e){let n=this.resume();this.data.inTable&&(n=n.replace(/\\([\\|])/g,ON));const r=this.stack[this.stack.length-1];r.type,r.value=n,this.exit(e)}function ON(e,n){return n==="|"?n:e}function RN(e){const n=e||{},r=n.tableCellPadding,a=n.tablePipeAlign,l=n.stringLength,u=r?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
|
|
117
|
+
`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:b,table:c,tableCell:m,tableRow:f}};function c(x,k,z,B){return d(y(x,z,B),x.align)}function f(x,k,z,B){const M=g(x,z,B),F=d([M]);return F.slice(0,F.indexOf(`
|
|
118
|
+
`))}function m(x,k,z,B){const M=z.enter("tableCell"),F=z.enter("phrasing"),G=z.containerPhrasing(x,{...B,before:u,after:u});return F(),M(),G}function d(x,k){return Yj(x,{align:k,alignDelimiters:a,padding:r,stringLength:l})}function y(x,k,z){const B=x.children;let M=-1;const F=[],G=k.enter("table");for(;++M<B.length;)F[M]=g(B[M],k,z);return G(),F}function g(x,k,z){const B=x.children;let M=-1;const F=[],G=k.enter("tableRow");for(;++M<B.length;)F[M]=m(B[M],x,k,z);return G(),F}function b(x,k,z){let B=ov.inlineCode(x,k,z);return z.stack.includes("tableCell")&&(B=B.replace(/\|/g,"\\$&")),B}}function MN(){return{exit:{taskListCheckValueChecked:g0,taskListCheckValueUnchecked:g0,paragraph:zN}}}function DN(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:LN}}}function g0(e){const n=this.stack[this.stack.length-2];n.type,n.checked=e.type==="taskListCheckValueChecked"}function zN(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 a=r.children[0];if(a&&a.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&&(a.value=a.value.slice(1),a.value.length===0?r.children.shift():r.position&&a.position&&typeof a.position.start.offset=="number"&&(a.position.start.column++,a.position.start.offset++,r.position.start=Object.assign({},a.position.start)))}}this.exit(e)}function LN(e,n,r,a){const l=e.children[0],u=typeof e.checked=="boolean"&&l&&l.type==="paragraph",c="["+(e.checked?"x":" ")+"] ",f=r.createTracker(a);u&&f.move(c);let m=ov.listItem(e,n,r,{...a,...f.current()});return u&&(m=m.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,d)),m;function d(y){return y+c}}function UN(){return[pj(),Lj(),Hj(),CN(),MN()]}function BN(e){return{extensions:[gj(),Uj(e),qj(),RN(e),DN()]}}const PN={tokenize:GN,partial:!0},uv={tokenize:YN,partial:!0},cv={tokenize:VN,partial:!0},fv={tokenize:JN,partial:!0},HN={tokenize:XN,partial:!0},hv={name:"wwwAutolink",tokenize:FN,previous:mv},dv={name:"protocolAutolink",tokenize:$N,previous:pv},Xr={name:"emailAutolink",tokenize:IN,previous:gv},Er={};function qN(){return{text:Er}}let ta=48;for(;ta<123;)Er[ta]=Xr,ta++,ta===58?ta=65:ta===91&&(ta=97);Er[43]=Xr;Er[45]=Xr;Er[46]=Xr;Er[95]=Xr;Er[72]=[Xr,dv];Er[104]=[Xr,dv];Er[87]=[Xr,hv];Er[119]=[Xr,hv];function IN(e,n,r){const a=this;let l,u;return c;function c(g){return!ud(g)||!gv.call(a,a.previous)||Gd(a.events)?r(g):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),f(g))}function f(g){return ud(g)?(e.consume(g),f):g===64?(e.consume(g),m):r(g)}function m(g){return g===46?e.check(HN,y,d)(g):g===45||g===95||rn(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&&cn(a.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),n(g)):r(g)}}function FN(e,n,r){const a=this;return l;function l(c){return c!==87&&c!==119||!mv.call(a,a.previous)||Gd(a.events)?r(c):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(PN,e.attempt(uv,e.attempt(cv,u),r),r)(c))}function u(c){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),n(c)}}function $N(e,n,r){const a=this;let l="",u=!1;return c;function c(g){return(g===72||g===104)&&pv.call(a,a.previous)&&!Gd(a.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),l+=String.fromCodePoint(g),e.consume(g),f):r(g)}function f(g){if(cn(g)&&l.length<5)return l+=String.fromCodePoint(g),e.consume(g),f;if(g===58){const b=l.toLowerCase();if(b==="http"||b==="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||ku(g)||_t(g)||ra(g)||zu(g)?r(g):e.attempt(uv,e.attempt(cv,y),r)(g)}function y(g){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),n(g)}}function GN(e,n,r){let a=0;return l;function l(c){return(c===87||c===119)&&a<3?(a++,e.consume(c),l):c===46&&a===3?(e.consume(c),u):r(c)}function u(c){return c===null?r(c):n(c)}}function YN(e,n,r){let a,l,u;return c;function c(d){return d===46||d===95?e.check(fv,m,f)(d):d===null||_t(d)||ra(d)||d!==45&&zu(d)?m(d):(u=!0,e.consume(d),c)}function f(d){return d===95?a=!0:(l=a,a=void 0),e.consume(d),c}function m(d){return l||a||!u?r(d):n(d)}}function VN(e,n){let r=0,a=0;return l;function l(c){return c===40?(r++,e.consume(c),l):c===41&&a<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(fv,n,u)(c):c===null||_t(c)||ra(c)?n(c):(e.consume(c),l)}function u(c){return c===41&&a++,e.consume(c),l}}function JN(e,n,r){return a;function a(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),a):f===38?(e.consume(f),u):f===93?(e.consume(f),l):f===60||f===null||_t(f)||ra(f)?n(f):r(f)}function l(f){return f===null||f===40||f===91||_t(f)||ra(f)?n(f):a(f)}function u(f){return cn(f)?c(f):r(f)}function c(f){return f===59?(e.consume(f),a):cn(f)?(e.consume(f),c):r(f)}}function XN(e,n,r){return a;function a(u){return e.consume(u),l}function l(u){return rn(u)?r(u):n(u)}}function mv(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||_t(e)}function pv(e){return!cn(e)}function gv(e){return!(e===47||ud(e))}function ud(e){return e===43||e===45||e===46||e===95||rn(e)}function Gd(e){let n=e.length,r=!1;for(;n--;){const a=e[n][1];if((a.type==="labelLink"||a.type==="labelImage")&&!a._balanced){r=!0;break}if(a._gfmAutolinkLiteralWalkedInto){r=!1;break}}return e.length>0&&!r&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),r}const QN={tokenize:iO,partial:!0};function KN(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:tO,continuation:{tokenize:nO},exit:rO}},text:{91:{name:"gfmFootnoteCall",tokenize:eO},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:ZN,resolveTo:WN}}}}function ZN(e,n,r){const a=this;let l=a.events.length;const u=a.parser.gfmFootnotes||(a.parser.gfmFootnotes=[]);let c;for(;l--;){const m=a.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=ur(a.sliceSerialize({start:c.end,end:a.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 WN(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 a={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",a,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",a,n]];return e.splice(r,e.length-r+1,...f),e}function eO(e,n,r){const a=this,l=a.parser.gfmFootnotes||(a.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||_t(g))return r(g);if(g===93){e.exit("chunkString");const b=e.exit("gfmFootnoteCallString");return l.includes(ur(a.sliceSerialize(b)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(g),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),n):r(g)}return _t(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 tO(e,n,r){const a=this,l=a.parser.gfmFootnotes||(a.parser.gfmFootnotes=[]);let u,c=0,f;return m;function m(k){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(k),e.exit("gfmFootnoteDefinitionLabelMarker"),d}function d(k){return k===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(k),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",y):r(k)}function y(k){if(c>999||k===93&&!f||k===null||k===91||_t(k))return r(k);if(k===93){e.exit("chunkString");const z=e.exit("gfmFootnoteDefinitionLabelString");return u=ur(a.sliceSerialize(z)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(k),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),b}return _t(k)||(f=!0),c++,e.consume(k),k===92?g:y}function g(k){return k===91||k===92||k===93?(e.consume(k),c++,y):y(k)}function b(k){return k===58?(e.enter("definitionMarker"),e.consume(k),e.exit("definitionMarker"),l.includes(u)||l.push(u),lt(e,x,"gfmFootnoteDefinitionWhitespace")):r(k)}function x(k){return n(k)}}function nO(e,n,r){return e.check(zl,n,e.attempt(QN,n,r))}function rO(e){e.exit("gfmFootnoteDefinition")}function iO(e,n,r){const a=this;return lt(e,l,"gfmFootnoteDefinitionIndent",5);function l(u){const c=a.events[a.events.length-1];return c&&c[1].type==="gfmFootnoteDefinitionIndent"&&c[2].sliceSerialize(c[1],!0).length===4?n(u):r(u)}}function aO(e){let r=(e||{}).singleTilde;const a={name:"strikethrough",tokenize:u,resolveAll:l};return r==null&&(r=!0),{text:{126:a},insideSpan:{null:[a]},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)},b=[["enter",y,f],["enter",c[d][1],f],["exit",c[d][1],f],["enter",g,f]],x=f.parser.constructs.insideSpan.null;x&&zn(b,b.length,0,Lu(x,c.slice(d+1,m),f)),zn(b,b.length,0,[["exit",g,f],["enter",c[m][1],f],["exit",c[m][1],f],["exit",y,f]]),zn(c,d-1,m-d+3,b),m=d+b.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 b;function b(k){return d===126&&y[y.length-1][1].type!=="characterEscape"?m(k):(c.enter("strikethroughSequenceTemporary"),x(k))}function x(k){const z=ss(d);if(k===126)return g>1?m(k):(c.consume(k),g++,x);if(g<2&&!r)return m(k);const B=c.exit("strikethroughSequenceTemporary"),M=ss(k);return B._open=!M||M===2&&!!z,B._close=!z||z===2&&!!M,f(k)}}}class sO{constructor(){this.map=[]}add(n,r,a){lO(this,n,r,a)}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 a=[];for(;r>0;)r-=1,a.push(n.slice(this.map[r][0]+this.map[r][1]),this.map[r][2]),n.length=this.map[r][0];a.push(n.slice()),n.length=0;let l=a.pop();for(;l;){for(const u of l)n.push(u);l=a.pop()}this.map.length=0}}function lO(e,n,r,a){let l=0;if(!(r===0&&a.length===0)){for(;l<e.map.length;){if(e.map[l][0]===n){e.map[l][1]+=r,e.map[l][2].push(...a);return}l+=1}e.map.push([n,r,a])}}function oO(e,n){let r=!1;const a=[];for(;n<e.length;){const l=e[n];if(r){if(l[0]==="enter")l[1].type==="tableContent"&&a.push(e[n+1][1].type==="tableDelimiterMarker"?"left":"none");else if(l[1].type==="tableContent"){if(e[n-1][1].type==="tableDelimiterMarker"){const u=a.length-1;a[u]=a[u]==="left"?"center":"right"}}else if(l[1].type==="tableDelimiterRow")break}else l[0]==="enter"&&l[1].type==="tableDelimiterRow"&&(r=!0);n+=1}return a}function uO(){return{flow:{null:{name:"table",tokenize:cO,resolveAll:fO}}}}function cO(e,n,r){const a=this;let l=0,u=0,c;return f;function f(N){let Q=a.events.length-1;for(;Q>-1;){const fe=a.events[Q][1].type;if(fe==="lineEnding"||fe==="linePrefix")Q--;else break}const Z=Q>-1?a.events[Q][1].type:null,ge=Z==="tableHead"||Z==="tableRow"?j:m;return ge===j&&a.parser.lazy[a.now().line]?r(N):ge(N)}function m(N){return e.enter("tableHead"),e.enter("tableRow"),d(N)}function d(N){return N===124||(c=!0,u+=1),y(N)}function y(N){return N===null?r(N):Pe(N)?u>1?(u=0,a.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(N),e.exit("lineEnding"),x):r(N):et(N)?lt(e,y,"whitespace")(N):(u+=1,c&&(c=!1,l+=1),N===124?(e.enter("tableCellDivider"),e.consume(N),e.exit("tableCellDivider"),c=!0,y):(e.enter("data"),g(N)))}function g(N){return N===null||N===124||_t(N)?(e.exit("data"),y(N)):(e.consume(N),N===92?b:g)}function b(N){return N===92||N===124?(e.consume(N),g):g(N)}function x(N){return a.interrupt=!1,a.parser.lazy[a.now().line]?r(N):(e.enter("tableDelimiterRow"),c=!1,et(N)?lt(e,k,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(N):k(N))}function k(N){return N===45||N===58?B(N):N===124?(c=!0,e.enter("tableCellDivider"),e.consume(N),e.exit("tableCellDivider"),z):O(N)}function z(N){return et(N)?lt(e,B,"whitespace")(N):B(N)}function B(N){return N===58?(u+=1,c=!0,e.enter("tableDelimiterMarker"),e.consume(N),e.exit("tableDelimiterMarker"),M):N===45?(u+=1,M(N)):N===null||Pe(N)?se(N):O(N)}function M(N){return N===45?(e.enter("tableDelimiterFiller"),F(N)):O(N)}function F(N){return N===45?(e.consume(N),F):N===58?(c=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(N),e.exit("tableDelimiterMarker"),G):(e.exit("tableDelimiterFiller"),G(N))}function G(N){return et(N)?lt(e,se,"whitespace")(N):se(N)}function se(N){return N===124?k(N):N===null||Pe(N)?!c||l!==u?O(N):(e.exit("tableDelimiterRow"),e.exit("tableHead"),n(N)):O(N)}function O(N){return r(N)}function j(N){return e.enter("tableRow"),V(N)}function V(N){return N===124?(e.enter("tableCellDivider"),e.consume(N),e.exit("tableCellDivider"),V):N===null||Pe(N)?(e.exit("tableRow"),n(N)):et(N)?lt(e,V,"whitespace")(N):(e.enter("data"),J(N))}function J(N){return N===null||N===124||_t(N)?(e.exit("data"),V(N)):(e.consume(N),N===92?Y:J)}function Y(N){return N===92||N===124?(e.consume(N),J):J(N)}}function fO(e,n){let r=-1,a=!0,l=0,u=[0,0,0,0],c=[0,0,0,0],f=!1,m=0,d,y,g;const b=new sO;for(;++r<e.length;){const x=e[r],k=x[1];x[0]==="enter"?k.type==="tableHead"?(f=!1,m!==0&&(y0(b,n,m,d,y),y=void 0,m=0),d={type:"table",start:Object.assign({},k.start),end:Object.assign({},k.end)},b.add(r,0,[["enter",d,n]])):k.type==="tableRow"||k.type==="tableDelimiterRow"?(a=!0,g=void 0,u=[0,0,0,0],c=[0,r+1,0,0],f&&(f=!1,y={type:"tableBody",start:Object.assign({},k.start),end:Object.assign({},k.end)},b.add(r,0,[["enter",y,n]])),l=k.type==="tableDelimiterRow"?2:y?3:1):l&&(k.type==="data"||k.type==="tableDelimiterMarker"||k.type==="tableDelimiterFiller")?(a=!1,c[2]===0&&(u[1]!==0&&(c[0]=c[1],g=su(b,n,u,l,void 0,g),u=[0,0,0,0]),c[2]=r)):k.type==="tableCellDivider"&&(a?a=!1:(u[1]!==0&&(c[0]=c[1],g=su(b,n,u,l,void 0,g)),u=c,c=[u[1],r,0,0])):k.type==="tableHead"?(f=!0,m=r):k.type==="tableRow"||k.type==="tableDelimiterRow"?(m=r,u[1]!==0?(c[0]=c[1],g=su(b,n,u,l,r,g)):c[1]!==0&&(g=su(b,n,c,l,r,g)),l=0):l&&(k.type==="data"||k.type==="tableDelimiterMarker"||k.type==="tableDelimiterFiller")&&(c[3]=r)}for(m!==0&&y0(b,n,m,d,y),b.consume(n.events),r=-1;++r<n.events.length;){const x=n.events[r];x[0]==="enter"&&x[1].type==="table"&&(x[1]._align=oO(n.events,r))}return e}function su(e,n,r,a,l,u){const c=a===1?"tableHeader":a===2?"tableDelimiter":"tableData",f="tableContent";r[0]!==0&&(u.end=Object.assign({},Ja(n.events,r[0])),e.add(r[0],0,[["exit",u,n]]));const m=Ja(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=Ja(n.events,r[2]),y=Ja(n.events,r[3]),g={type:f,start:Object.assign({},d),end:Object.assign({},y)};if(e.add(r[2],0,[["enter",g,n]]),a!==2){const b=n.events[r[2]],x=n.events[r[3]];if(b[1].end=Object.assign({},x[1].end),b[1].type="chunkText",b[1].contentType="text",r[3]>r[2]+1){const k=r[2]+1,z=r[3]-r[2]-1;e.add(k,z,[])}}e.add(r[3]+1,0,[["exit",g,n]])}return l!==void 0&&(u.end=Object.assign({},Ja(n.events,l)),e.add(l,0,[["exit",u,n]]),u=void 0),u}function y0(e,n,r,a,l){const u=[],c=Ja(n.events,r);l&&(l.end=Object.assign({},c),u.push(["exit",l,n])),a.end=Object.assign({},c),u.push(["exit",a,n]),e.add(r+1,0,u)}function Ja(e,n){const r=e[n],a=r[0]==="enter"?"start":"end";return r[1][a]}const hO={name:"tasklistCheck",tokenize:mO};function dO(){return{text:{91:hO}}}function mO(e,n,r){const a=this;return l;function l(m){return a.previous!==null||!a._gfmTasklistFirstContentOfListItem?r(m):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(m),e.exit("taskListCheckMarker"),u)}function u(m){return _t(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 Pe(m)?n(m):et(m)?e.check({tokenize:pO},n,r)(m):r(m)}}function pO(e,n,r){return lt(e,a,"whitespace");function a(l){return l===null?r(l):n(l)}}function gO(e){return C1([qN(),KN(),aO(e),uO(),dO()])}const yO={};function b0(e){const n=this,r=e||yO,a=n.data(),l=a.micromarkExtensions||(a.micromarkExtensions=[]),u=a.fromMarkdownExtensions||(a.fromMarkdownExtensions=[]),c=a.toMarkdownExtensions||(a.toMarkdownExtensions=[]);l.push(gO(r)),u.push(UN()),c.push(BN(r))}function bO(e){V1(e,[/\r?\n|\r/g,vO])}function vO(){return{type:"break"}}function v0(){return function(e){bO(e)}}function xO({connected:e,hostId:n,request:r,subscribeEvents:a,taskId:l,runId:u}){const c=ia(),[f,m]=L.useState(!0),[d,y]=L.useState([]),[g,b]=L.useState(),[x,k]=L.useState(),z=g==="started"||g==="monitoring",B=g==="followup",M=g==="started"||g==="followup",[F,G]=L.useState(null),[se,O]=L.useState(!1),[j,V]=L.useState(""),[J,Y]=L.useState(!1),N=L.useRef(null);async function Q(){try{const H=await r("task.result",{id:l,run_id:u});if(H.error){console.error("No result:",H.error),c("/runs",{replace:!0});return}y(H.messages??[]),b(H.running_state),k(H.agent)}catch(H){console.error("Failed to load result:",H),c("/runs",{replace:!0})}finally{m(!1)}}async function Z(H){var q;try{const ye=(q=(await r("task.reports",{id:l,run_id:u,report_files:[H]})).reports)==null?void 0:q[0];ye!=null&&ye.data_url?G({file:H,data_url:ye.data_url}):G({file:H,content:(ye==null?void 0:ye.content)??"Report not found."})}catch{G({file:H,content:"Failed to load report."})}}L.useEffect(()=>{e&&(m(!0),Q())},[e,l,u]),L.useEffect(()=>!e||!n?void 0:a(n,async q=>{try{const re=JSON.parse(new TextDecoder().decode(q.data));if(re.event_type!=="running-state"&&re.event_type!=="result-updated"||q.subject.split(".").pop()!==l||re.event_type==="result-updated"&&re.run_id&&re.run_id!==u)return;Q()}catch{}}),[e,n,l,a,r]),L.useEffect(()=>{N.current&&(N.current.scrollTop=N.current.scrollHeight)},[d]);function ge(H){if(H==="input")return"User Input";if(H==="permission")return"Permission";if(H==="confirmation")return"Confirmation"}function fe(H){return H==="started"?"Task started":H==="finished"?"Task finished":H==="failed"?"Task failed":H==="error"?"Command failed":H==="aborted"?"Task aborted":H==="confirmation"?"Task confirmed":H==="stopped"?"Follow-up stopped":H??""}return w.jsxs("div",{className:"run-detail",children:[w.jsxs("button",{className:"run-detail-back",onClick:()=>c(-1),children:[w.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:w.jsx("path",{d:"M15 18l-6-6 6-6"})}),"Back"]}),f?w.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"var(--space-sm)",padding:"var(--space-sm) 0"},children:[w.jsx("div",{className:"skeleton-line",style:{width:"40%"}}),w.jsx("div",{className:"skeleton-line",style:{width:"55%"}}),w.jsx("div",{className:"skeleton-line",style:{width:"100%",height:"8rem",marginTop:"var(--space-sm)"}})]}):w.jsxs(w.Fragment,{children:[w.jsxs("div",{className:"chat-thread",ref:N,children:[d.map((H,q)=>{const re=M&&H.role==="assistant"&&!d.slice(q+1).some(ye=>ye.role==="assistant"||ye.role==="user");return H.role==="status"&&H.type==="monitoring"?null:H.role==="status"?w.jsxs("div",{className:`chat-status${H.type==="error"?" chat-status--error":""}`,children:[w.jsxs("div",{children:[fe(H.type),H.time>0&&w.jsx("span",{className:"chat-status-time",children:Eu(H.time)})]}),H.content&&w.jsx("pre",{className:"chat-status-detail",children:H.content})]},q):w.jsxs("div",{className:`chat-message chat-message--${H.role}`,children:[H.role==="assistant"&&x&&w.jsx("div",{className:"chat-message-agent",children:Zh(x)}),w.jsxs("div",{className:"chat-message-content",children:[w.jsx(c0,{remarkPlugins:[b0,v0],children:H.content}),re&&w.jsxs("div",{className:"chat-typing-indicator",children:[w.jsx("span",{}),w.jsx("span",{}),w.jsx("span",{})]})]}),H.attachments&&H.attachments.length>0&&w.jsx("div",{className:"chat-message-attachments",children:H.attachments.map(ye=>w.jsx("button",{className:"chat-attachment-chip",onClick:()=>Z(ye),children:ye},ye))}),w.jsxs("div",{className:"chat-message-meta",children:[ge(H.type)&&w.jsx("span",{className:"chat-message-type",children:ge(H.type)}),H.time>0&&w.jsx("span",{children:Eu(H.time)})]})]},q)}),M&&(()=>{const H=d.filter(q=>q.role!=="status");return H.length===0||H[H.length-1].role!=="assistant"})()&&w.jsxs("div",{className:"chat-message chat-message--assistant",children:[x&&w.jsx("div",{className:"chat-message-agent",children:Zh(x)}),w.jsxs("div",{className:"chat-typing-indicator",children:[w.jsx("span",{}),w.jsx("span",{}),w.jsx("span",{})]})]}),g==="monitoring"&&w.jsxs("div",{className:"chat-monitoring-indicator",children:[w.jsx("span",{className:"chat-monitoring-dot"}),"Monitoring command output"]})]}),z?w.jsx("div",{className:"chat-abort-bar",children:w.jsx("button",{className:"btn btn-secondary chat-abort-btn",disabled:se,onClick:async()=>{if(confirm("Abort this task?")){O(!0);try{await r("task.abort",{id:l})}catch(H){console.error("Abort failed:",H)}finally{O(!1)}}},children:se?"Aborting...":"Abort Task"})}):B?w.jsx("div",{className:"chat-input-bar",children:w.jsx("button",{className:"btn btn-secondary chat-stop-btn",disabled:se,onClick:async()=>{O(!0);try{await r("task.stop_followup",{id:l,run_id:u})}catch(H){console.error("Stop failed:",H)}finally{O(!1)}},children:w.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor",children:w.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"2"})})})}):w.jsxs("form",{className:"chat-input-bar",onSubmit:async H=>{H.preventDefault();const q=j.trim();if(!(!q||J)){Y(!0);try{await r("task.followup",{id:l,run_id:u,message:q}),V("")}catch(re){console.error("Follow-up failed:",re)}finally{Y(!1)}}},children:[w.jsx("input",{className:"chat-input",type:"text",placeholder:"Follow-up message",value:j,onChange:H=>V(H.target.value),disabled:J}),w.jsx("button",{className:"btn btn-primary chat-send-btn",type:"submit",disabled:!j.trim()||J,children:w.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[w.jsx("line",{x1:"22",y1:"2",x2:"11",y2:"13"}),w.jsx("polygon",{points:"22 2 15 22 11 13 2 9 22 2"})]})})]})]}),F&&w.jsx("div",{className:"report-dialog-overlay",onClick:()=>G(null),children:w.jsxs("div",{className:"report-dialog",onClick:H=>H.stopPropagation(),children:[w.jsxs("div",{className:"report-dialog-header",children:[w.jsx("span",{className:"report-dialog-title",children:F.file}),w.jsx("button",{className:"report-dialog-close",onClick:()=>G(null),"aria-label":"Close",children:w.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[w.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),w.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),w.jsx("div",{className:"report-dialog-body",children:F.data_url?w.jsx("img",{src:F.data_url,alt:F.file,style:{maxWidth:"100%",height:"auto"}}):w.jsx(c0,{remarkPlugins:[b0,v0],components:{a:({...H})=>w.jsx("a",{...H,target:"_blank",rel:"noopener noreferrer"})},children:F.content??""})})]})})]})}function wO(){const{getActiveHost:e}=Ol(),n=e(),r=L.useRef(null);L.useEffect(()=>{if(Un.isNativePlatform()||!n||n.directUrl||r.current===n.hostId)return;async function a(){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 Ak("/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)}}a()},[n])}function lu(){var ye;const{pairedHosts:e,activeHostId:n,removePairedHost:r}=Ol(),{connected:a,request:l,subscribeEvents:u,unauthorized:c}=Ad(),f=ia(),m=_r(),d=yS(),y=f1("(min-width: 768px)"),g=m.pathname.startsWith("/runs"),b=d.runId?void 0:d.taskId,[x,k]=L.useState(null),z=d.runId,B=z==="latest";L.useEffect(()=>{if(!B||!d.taskId||!a){k(null);return}l("taskrun.list",{task_id:d.taskId,limit:1}).then(_e=>{var U,W;const R=(W=(U=_e.entries)==null?void 0:U[0])==null?void 0:W.run_id;k(R??null)}).catch(()=>k(null))},[B,d.taskId,a]);const M=B?x:z,F=!!(d.taskId&&M&&M!=="latest"),[G,se]=L.useState(!1),[O,j]=L.useState(!1),[V,J]=L.useState(null),[Y,N]=L.useState(null),[Q,Z]=L.useState({});wO(),L.useEffect(()=>{window.scrollTo(0,0)},[n]);function ge(_e,R){f(R?`/runs/${encodeURIComponent(_e)}/${encodeURIComponent(R)}`:`/runs/${encodeURIComponent(_e)}`)}async function fe(){j(!0),J(null);try{const _e=await l("host.update");if(_e.error){J(_e.error),j(!1);return}}catch{}setTimeout(()=>window.location.reload(),1e4)}const H=e.length>0,q=H&&a&&n&&!c,re=((ye=e.find(_e=>_e.hostId===n))==null?void 0:ye.clientToken)??null;return w.jsxs("div",{className:"dashboard",children:[y&&w.jsx(Ab,{daemonVersion:Y,capabilityTokens:Q,activeClientToken:re,request:l,onCapabilityTokensChange:Z}),w.jsxs("div",{className:"dashboard-content",children:[w.jsxs("div",{className:"tab-bar",children:[!y&&w.jsx(Ab,{daemonVersion:Y,capabilityTokens:Q,activeClientToken:re,request:l,onCapabilityTokensChange:Z}),w.jsx(Gk,{})]}),w.jsx("main",{className:"dashboard-main",children:c?w.jsxs("div",{className:"revoked-state",children:[w.jsx("div",{className:"revoked-icon",children:w.jsxs("svg",{width:"32",height:"32",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[w.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),w.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"}),w.jsx("line",{x1:"12",y1:"15",x2:"12",y2:"18"})]})}),w.jsx("h2",{className:"revoked-title",children:"Client Revoked"}),w.jsx("p",{className:"revoked-description",children:"This client was revoked by the host. To reconnect, generate a new pairing code on the host machine."}),w.jsx("div",{className:"revoked-command",children:w.jsx("code",{children:"palmier pair"})}),w.jsxs("div",{className:"revoked-actions",children:[w.jsx("button",{className:"btn btn-primary",onClick:()=>f("/pair"),children:"Re-pair Device"}),w.jsx("button",{className:"btn btn-secondary",onClick:()=>{n&&r(n)},children:"Remove Host"})]})]}):q?w.jsxs(w.Fragment,{children:[w.jsx("div",{style:{display:g?"none":"contents"},children:w.jsx($k,{connected:a,hostId:n,request:l,subscribeEvents:u,onViewRun:ge,onUpdateRequired:se,onVersion:N,onCapabilityTokens:Z})}),F?w.jsx(xO,{connected:a,hostId:n,request:l,subscribeEvents:u,taskId:d.taskId,runId:decodeURIComponent(M)}):g?w.jsx(Qk,{connected:a,hostId:n,request:l,subscribeEvents:u,filterTaskId:b,onClearFilter:()=>f("/runs")}):null]}):w.jsxs("div",{className:"empty-state",children:[w.jsx("p",{children:H?"Connecting to host...":"No hosts paired yet."}),!H&&w.jsx("button",{className:"btn btn-primary",onClick:()=>f("/pair"),children:"Pair Host"})]})}),G&&!O&&!V&&w.jsx("div",{className:"confirm-modal-overlay",children:w.jsxs("div",{className:"confirm-modal",children:[w.jsx("h2",{className:"confirm-modal-title",children:"Update Required"}),w.jsxs("p",{className:"confirm-modal-message",children:["Your Palmier host",Y?` (v${Y})`:""," is too old for this version of the app. Please update to continue."]}),w.jsx("div",{className:"confirm-modal-actions",children:w.jsx("button",{className:"btn btn-primary",onClick:fe,children:"Update Now"})})]})}),O&&w.jsx("div",{className:"confirm-modal-overlay",children:w.jsxs("div",{className:"confirm-modal",children:[w.jsx("h2",{className:"confirm-modal-title",children:"Updating..."}),w.jsx("p",{className:"confirm-modal-message",children:"Installing update and restarting daemon. Please wait..."})]})}),V&&w.jsx("div",{className:"confirm-modal-overlay",children:w.jsxs("div",{className:"confirm-modal",children:[w.jsx("h2",{className:"confirm-modal-title",children:"Update Failed"}),w.jsx("p",{className:"confirm-modal-message",style:{whiteSpace:"pre-line"},children:V}),w.jsx("div",{className:"confirm-modal-actions",children:w.jsx("button",{className:"btn btn-secondary",onClick:()=>{J(null)},children:"Retry"})})]})})]})]})}const fl=!!window.__PALMIER_SERVE__;function SO(){const[e,n]=L.useState(""),[r,a]=L.useState(!1),[l,u]=L.useState(null),{addPairedHost:c}=Ol(),f=ia();async function m(){const d=e.trim().toUpperCase();if(!d){u("Enter a pairing code.");return}a(!0),u(null);try{let y;if(fl){const b=await fetch("/pair",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:d,label:navigator.userAgent})});if(!b.ok){const x=await b.json().catch(()=>({error:"Connection failed"}));throw new Error(x.error||`HTTP ${b.status}`)}y=await b.json()}else{const b=await fetch(`${Cd}/api/config`);if(!b.ok)throw new Error("Failed to fetch server config");const x=await b.json();if(!x.natsWsUrl)throw new Error("Server has no NATS WebSocket URL configured");const k=await s1({servers:x.natsWsUrl,token:x.natsToken}),z=bu(),B=`pair.${d}`,M=await k.request(B,z.encode(JSON.stringify({label:navigator.userAgent})),{timeout:1e4});y=JSON.parse(z.decode(M.data)),await k.close()}const g={hostId:y.hostId,clientToken:y.clientToken,directUrl:fl?window.location.origin:void 0};c(g),Un.isNativePlatform()&&await Wt.set({key:"hostId",value:y.hostId}),f("/")}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{a(!1)}}return w.jsx("div",{className:"pair-page",children:w.jsxs("div",{className:"pair-card",children:[w.jsxs("div",{className:"pair-header",children:[w.jsx("h1",{className:"pair-title",children:fl?"Pair":"Pair with Host"}),w.jsx("p",{className:"pair-subtitle",children:fl?"Enter the pairing code shown in your terminal.":"Connect this device to a Palmier host"})]}),!fl&&w.jsxs("div",{className:"pair-instructions",children:[w.jsxs("div",{className:"pair-instruction-block",children:[w.jsx("h3",{className:"pair-instruction-heading",children:"Setting up a new host?"}),w.jsxs("ol",{className:"pair-steps",children:[w.jsxs("li",{children:["Install at least one agent CLI (e.g., ",w.jsx("a",{href:"https://www.palmier.me/agents",target:"_blank",rel:"noopener noreferrer",children:"Claude Code, Gemini CLI, Codex CLI"}),")"]}),w.jsxs("li",{children:["Install Palmier on your host machine:",w.jsx("code",{className:"pair-command",children:"npm install -g palmier"})]}),w.jsxs("li",{children:["Run the setup wizard:",w.jsx("code",{className:"pair-command",children:"palmier init"})]}),w.jsx("li",{children:"A pairing code will display automatically"})]})]}),w.jsx("div",{className:"pair-instruction-divider"}),w.jsxs("div",{className:"pair-instruction-block",children:[w.jsx("h3",{className:"pair-instruction-heading",children:"Pairing an existing host?"}),w.jsxs("ol",{className:"pair-steps",children:[w.jsxs("li",{children:["Run ",w.jsx("code",{children:"palmier pair"})," on the host machine"]}),w.jsx("li",{children:"Enter the 6-character code below"})]})]})]}),w.jsxs("div",{className:"pair-form",children:[w.jsxs("label",{className:"form-label",htmlFor:"pair-code",children:["Pairing code",w.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&&w.jsx("p",{className:"pair-error",children:l}),w.jsxs("button",{className:"btn btn-primary btn-full",onClick:m,disabled:r||!e.trim(),children:[r&&w.jsx("span",{className:"btn-spinner"}),r?"Pairing...":"Pair"]}),w.jsx("button",{className:"btn btn-secondary btn-full",onClick:()=>f("/"),disabled:r,children:"Cancel"}),w.jsxs("p",{className:"pair-consent",children:["By pairing, you agree to our"," ",w.jsx("a",{href:"https://www.palmier.me/terms",target:"_blank",rel:"noopener noreferrer",children:"Terms of Service"})," and"," ",w.jsx("a",{href:"https://www.palmier.me/privacy",target:"_blank",rel:"noopener noreferrer",children:"Privacy Policy"}),"."]})]})]})})}function _O(){return w.jsx(g_,{children:w.jsx(jk,{children:w.jsxs(RS,{children:[w.jsx(Ya,{path:"/",element:w.jsx(lu,{})}),w.jsx(Ya,{path:"/runs",element:w.jsx(lu,{})}),w.jsx(Ya,{path:"/runs/:taskId",element:w.jsx(lu,{})}),w.jsx(Ya,{path:"/runs/:taskId/:runId",element:w.jsx(lu,{})}),w.jsx(Ya,{path:"/pair",element:w.jsx(SO,{})})]})})})}Dw.createRoot(document.getElementById("root")).render(w.jsx(L.StrictMode,{children:w.jsx(n_,{children:w.jsx(_O,{})})}));export{kd as W};
|