palmier 0.9.2 → 0.9.4
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 +21 -20
- package/dist/commands/run.js +6 -0
- package/dist/commands/serve.js +61 -36
- package/dist/platform/linux.js +14 -0
- package/dist/pwa/assets/index-BsB1tIsn.css +1 -0
- package/dist/pwa/assets/index-DX5qJgHZ.js +120 -0
- package/dist/pwa/assets/{web-C2AU9S9n.js → web-Dcldtodb.js} +1 -1
- package/dist/pwa/assets/{web-CfD_ah7K.js → web-DdVpqhvX.js} +1 -1
- package/dist/pwa/assets/{web-DugGj1t8.js → web-Eg0A6HEi.js} +1 -1
- package/dist/pwa/index.html +3 -3
- package/dist/pwa/manifest.webmanifest +1 -1
- package/dist/pwa/service-worker.js +1 -1
- package/dist/rpc-handler.js +41 -19
- package/dist/task.d.ts +7 -0
- package/dist/task.js +17 -0
- package/dist/types.d.ts +4 -0
- package/package.json +1 -1
- package/palmier-server/pwa/index.html +1 -1
- package/palmier-server/pwa/src/App.css +42 -81
- package/palmier-server/pwa/src/components/CapabilityToggles.tsx +51 -9
- package/palmier-server/pwa/src/components/ConnectionStatusIcon.tsx +5 -1
- package/palmier-server/pwa/src/components/HostMenu.tsx +10 -10
- package/palmier-server/pwa/src/components/{PlanDialog.tsx → PermissionsDialog.tsx} +6 -6
- package/palmier-server/pwa/src/components/RunDetailView.tsx +3 -1
- package/palmier-server/pwa/src/components/SessionsView.tsx +1 -0
- package/palmier-server/pwa/src/components/SwipeToDeleteRow.tsx +13 -3
- package/palmier-server/pwa/src/components/TaskForm.tsx +7 -5
- package/palmier-server/pwa/src/constants.ts +1 -1
- package/palmier-server/pwa/src/contexts/HostConnectionContext.tsx +23 -8
- package/palmier-server/pwa/src/pages/PairHost.tsx +11 -4
- package/palmier-server/pwa/src/pages/PairSetup.tsx +8 -6
- package/palmier-server/pwa/vite.config.ts +1 -1
- package/palmier-server/spec.md +2 -2
- package/src/commands/run.ts +3 -0
- package/src/commands/serve.ts +62 -37
- package/src/platform/linux.ts +9 -0
- package/src/rpc-handler.ts +34 -18
- package/src/task.ts +21 -0
- package/src/types.ts +4 -0
- package/dist/pwa/assets/index-BLCVzS_l.js +0 -120
- package/dist/pwa/assets/index-Cjjw24Ok.css +0 -1
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
var Qw=Object.defineProperty;var Zw=(e,t,r)=>t in e?Qw(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var C=(e,t,r)=>Zw(e,typeof t!="symbol"?t+"":t,r);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const l of document.querySelectorAll('link[rel="modulepreload"]'))s(l);new MutationObserver(l=>{for(const u of l)if(u.type==="childList")for(const c of u.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&s(c)}).observe(document,{childList:!0,subtree:!0});function r(l){const u={};return l.integrity&&(u.integrity=l.integrity),l.referrerPolicy&&(u.referrerPolicy=l.referrerPolicy),l.crossOrigin==="use-credentials"?u.credentials="include":l.crossOrigin==="anonymous"?u.credentials="omit":u.credentials="same-origin",u}function s(l){if(l.ep)return;l.ep=!0;const u=r(l);fetch(l.href,u)}})();function Hb(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var fh={exports:{}},pl={};/**
|
|
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 Gy;function Ww(){if(Gy)return pl;Gy=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function r(s,l,u){var c=null;if(u!==void 0&&(c=""+u),l.key!==void 0&&(c=""+l.key),"key"in l){u={};for(var f in l)f!=="key"&&(u[f]=l[f])}else u=l;return l=u.ref,{$$typeof:e,type:s,key:c,ref:l!==void 0?l:null,props:u}}return pl.Fragment=t,pl.jsx=r,pl.jsxs=r,pl}var Vy;function eS(){return Vy||(Vy=1,fh.exports=Ww()),fh.exports}var b=eS(),hh={exports:{}},Ye={};/**
|
|
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 Jy;function tS(){if(Jy)return Ye;Jy=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),l=Symbol.for("react.profiler"),u=Symbol.for("react.consumer"),c=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),m=Symbol.for("react.suspense"),d=Symbol.for("react.memo"),y=Symbol.for("react.lazy"),g=Symbol.for("react.activity"),x=Symbol.iterator;function w(L){return L===null||typeof L!="object"?null:(L=x&&L[x]||L["@@iterator"],typeof L=="function"?L:null)}var E={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},R=Object.assign,B={};function D(L,Q,A){this.props=L,this.context=Q,this.refs=B,this.updater=A||E}D.prototype.isReactComponent={},D.prototype.setState=function(L,Q){if(typeof L!="object"&&typeof L!="function"&&L!=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,L,Q,"setState")},D.prototype.forceUpdate=function(L){this.updater.enqueueForceUpdate(this,L,"forceUpdate")};function P(){}P.prototype=D.prototype;function F(L,Q,A){this.props=L,this.context=Q,this.refs=B,this.updater=A||E}var ue=F.prototype=new P;ue.constructor=F,R(ue,D.prototype),ue.isPureReactComponent=!0;var U=Array.isArray;function M(){}var K={H:null,A:null,T:null,S:null},V=Object.prototype.hasOwnProperty;function q(L,Q,A){var xe=A.ref;return{$$typeof:e,type:L,key:Q,ref:xe!==void 0?xe:null,props:A}}function O(L,Q){return q(L.type,Q,L.props)}function X(L){return typeof L=="object"&&L!==null&&L.$$typeof===e}function J(L){var Q={"=":"=0",":":"=2"};return"$"+L.replace(/[=:]/g,function(A){return Q[A]})}var le=/\/+/g;function te(L,Q){return typeof L=="object"&&L!==null&&L.key!=null?J(""+L.key):Q.toString(36)}function $(L){switch(L.status){case"fulfilled":return L.value;case"rejected":throw L.reason;default:switch(typeof L.status=="string"?L.then(M,M):(L.status="pending",L.then(function(Q){L.status==="pending"&&(L.status="fulfilled",L.value=Q)},function(Q){L.status==="pending"&&(L.status="rejected",L.reason=Q)})),L.status){case"fulfilled":return L.value;case"rejected":throw L.reason}}throw L}function H(L,Q,A,xe,_e){var Te=typeof L;(Te==="undefined"||Te==="boolean")&&(L=null);var Le=!1;if(L===null)Le=!0;else switch(Te){case"bigint":case"string":case"number":Le=!0;break;case"object":switch(L.$$typeof){case e:case t:Le=!0;break;case y:return Le=L._init,H(Le(L._payload),Q,A,xe,_e)}}if(Le)return _e=_e(L),Le=xe===""?"."+te(L,0):xe,U(_e)?(A="",Le!=null&&(A=Le.replace(le,"$&/")+"/"),H(_e,Q,A,"",function(Ne){return Ne})):_e!=null&&(X(_e)&&(_e=O(_e,A+(_e.key==null||L&&L.key===_e.key?"":(""+_e.key).replace(le,"$&/")+"/")+Le)),Q.push(_e)),1;Le=0;var $e=xe===""?".":xe+":";if(U(L))for(var Ce=0;Ce<L.length;Ce++)xe=L[Ce],Te=$e+te(xe,Ce),Le+=H(xe,Q,A,Te,_e);else if(Ce=w(L),typeof Ce=="function")for(L=Ce.call(L),Ce=0;!(xe=L.next()).done;)xe=xe.value,Te=$e+te(xe,Ce++),Le+=H(xe,Q,A,Te,_e);else if(Te==="object"){if(typeof L.then=="function")return H($(L),Q,A,xe,_e);throw Q=String(L),Error("Objects are not valid as a React child (found: "+(Q==="[object Object]"?"object with keys {"+Object.keys(L).join(", ")+"}":Q)+"). If you meant to render a collection of children, use an array instead.")}return Le}function ee(L,Q,A){if(L==null)return L;var xe=[],_e=0;return H(L,xe,"","",function(Te){return Q.call(A,Te,_e++)}),xe}function oe(L){if(L._status===-1){var Q=L._result;Q=Q(),Q.then(function(A){(L._status===0||L._status===-1)&&(L._status=1,L._result=A)},function(A){(L._status===0||L._status===-1)&&(L._status=2,L._result=A)}),L._status===-1&&(L._status=0,L._result=Q)}if(L._status===1)return L._result.default;throw L._result}var be=typeof reportError=="function"?reportError:function(L){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var Q=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof L=="object"&&L!==null&&typeof L.message=="string"?String(L.message):String(L),error:L});if(!window.dispatchEvent(Q))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",L);return}console.error(L)},_={map:ee,forEach:function(L,Q,A){ee(L,function(){Q.apply(this,arguments)},A)},count:function(L){var Q=0;return ee(L,function(){Q++}),Q},toArray:function(L){return ee(L,function(Q){return Q})||[]},only:function(L){if(!X(L))throw Error("React.Children.only expected to receive a single React element child.");return L}};return Ye.Activity=g,Ye.Children=_,Ye.Component=D,Ye.Fragment=r,Ye.Profiler=l,Ye.PureComponent=F,Ye.StrictMode=s,Ye.Suspense=m,Ye.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=K,Ye.__COMPILER_RUNTIME={__proto__:null,c:function(L){return K.H.useMemoCache(L)}},Ye.cache=function(L){return function(){return L.apply(null,arguments)}},Ye.cacheSignal=function(){return null},Ye.cloneElement=function(L,Q,A){if(L==null)throw Error("The argument must be a React element, but you passed "+L+".");var xe=R({},L.props),_e=L.key;if(Q!=null)for(Te in Q.key!==void 0&&(_e=""+Q.key),Q)!V.call(Q,Te)||Te==="key"||Te==="__self"||Te==="__source"||Te==="ref"&&Q.ref===void 0||(xe[Te]=Q[Te]);var Te=arguments.length-2;if(Te===1)xe.children=A;else if(1<Te){for(var Le=Array(Te),$e=0;$e<Te;$e++)Le[$e]=arguments[$e+2];xe.children=Le}return q(L.type,_e,xe)},Ye.createContext=function(L){return L={$$typeof:c,_currentValue:L,_currentValue2:L,_threadCount:0,Provider:null,Consumer:null},L.Provider=L,L.Consumer={$$typeof:u,_context:L},L},Ye.createElement=function(L,Q,A){var xe,_e={},Te=null;if(Q!=null)for(xe in Q.key!==void 0&&(Te=""+Q.key),Q)V.call(Q,xe)&&xe!=="key"&&xe!=="__self"&&xe!=="__source"&&(_e[xe]=Q[xe]);var Le=arguments.length-2;if(Le===1)_e.children=A;else if(1<Le){for(var $e=Array(Le),Ce=0;Ce<Le;Ce++)$e[Ce]=arguments[Ce+2];_e.children=$e}if(L&&L.defaultProps)for(xe in Le=L.defaultProps,Le)_e[xe]===void 0&&(_e[xe]=Le[xe]);return q(L,Te,_e)},Ye.createRef=function(){return{current:null}},Ye.forwardRef=function(L){return{$$typeof:f,render:L}},Ye.isValidElement=X,Ye.lazy=function(L){return{$$typeof:y,_payload:{_status:-1,_result:L},_init:oe}},Ye.memo=function(L,Q){return{$$typeof:d,type:L,compare:Q===void 0?null:Q}},Ye.startTransition=function(L){var Q=K.T,A={};K.T=A;try{var xe=L(),_e=K.S;_e!==null&&_e(A,xe),typeof xe=="object"&&xe!==null&&typeof xe.then=="function"&&xe.then(M,be)}catch(Te){be(Te)}finally{Q!==null&&A.types!==null&&(Q.types=A.types),K.T=Q}},Ye.unstable_useCacheRefresh=function(){return K.H.useCacheRefresh()},Ye.use=function(L){return K.H.use(L)},Ye.useActionState=function(L,Q,A){return K.H.useActionState(L,Q,A)},Ye.useCallback=function(L,Q){return K.H.useCallback(L,Q)},Ye.useContext=function(L){return K.H.useContext(L)},Ye.useDebugValue=function(){},Ye.useDeferredValue=function(L,Q){return K.H.useDeferredValue(L,Q)},Ye.useEffect=function(L,Q){return K.H.useEffect(L,Q)},Ye.useEffectEvent=function(L){return K.H.useEffectEvent(L)},Ye.useId=function(){return K.H.useId()},Ye.useImperativeHandle=function(L,Q,A){return K.H.useImperativeHandle(L,Q,A)},Ye.useInsertionEffect=function(L,Q){return K.H.useInsertionEffect(L,Q)},Ye.useLayoutEffect=function(L,Q){return K.H.useLayoutEffect(L,Q)},Ye.useMemo=function(L,Q){return K.H.useMemo(L,Q)},Ye.useOptimistic=function(L,Q){return K.H.useOptimistic(L,Q)},Ye.useReducer=function(L,Q,A){return K.H.useReducer(L,Q,A)},Ye.useRef=function(L){return K.H.useRef(L)},Ye.useState=function(L){return K.H.useState(L)},Ye.useSyncExternalStore=function(L,Q,A){return K.H.useSyncExternalStore(L,Q,A)},Ye.useTransition=function(){return K.H.useTransition()},Ye.version="19.2.4",Ye}var Xy;function Ed(){return Xy||(Xy=1,hh.exports=tS()),hh.exports}var j=Ed(),dh={exports:{}},gl={},mh={exports:{}},ph={};/**
|
|
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 Ky;function nS(){return Ky||(Ky=1,(function(e){function t(H,ee){var oe=H.length;H.push(ee);e:for(;0<oe;){var be=oe-1>>>1,_=H[be];if(0<l(_,ee))H[be]=ee,H[oe]=_,oe=be;else break e}}function r(H){return H.length===0?null:H[0]}function s(H){if(H.length===0)return null;var ee=H[0],oe=H.pop();if(oe!==ee){H[0]=oe;e:for(var be=0,_=H.length,L=_>>>1;be<L;){var Q=2*(be+1)-1,A=H[Q],xe=Q+1,_e=H[xe];if(0>l(A,oe))xe<_&&0>l(_e,A)?(H[be]=_e,H[xe]=oe,be=xe):(H[be]=A,H[Q]=oe,be=Q);else if(xe<_&&0>l(_e,oe))H[be]=_e,H[xe]=oe,be=xe;else break e}}return ee}function l(H,ee){var oe=H.sortIndex-ee.sortIndex;return oe!==0?oe:H.id-ee.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var u=performance;e.unstable_now=function(){return u.now()}}else{var c=Date,f=c.now();e.unstable_now=function(){return c.now()-f}}var m=[],d=[],y=1,g=null,x=3,w=!1,E=!1,R=!1,B=!1,D=typeof setTimeout=="function"?setTimeout:null,P=typeof clearTimeout=="function"?clearTimeout:null,F=typeof setImmediate<"u"?setImmediate:null;function ue(H){for(var ee=r(d);ee!==null;){if(ee.callback===null)s(d);else if(ee.startTime<=H)s(d),ee.sortIndex=ee.expirationTime,t(m,ee);else break;ee=r(d)}}function U(H){if(R=!1,ue(H),!E)if(r(m)!==null)E=!0,M||(M=!0,J());else{var ee=r(d);ee!==null&&$(U,ee.startTime-H)}}var M=!1,K=-1,V=5,q=-1;function O(){return B?!0:!(e.unstable_now()-q<V)}function X(){if(B=!1,M){var H=e.unstable_now();q=H;var ee=!0;try{e:{E=!1,R&&(R=!1,P(K),K=-1),w=!0;var oe=x;try{t:{for(ue(H),g=r(m);g!==null&&!(g.expirationTime>H&&O());){var be=g.callback;if(typeof be=="function"){g.callback=null,x=g.priorityLevel;var _=be(g.expirationTime<=H);if(H=e.unstable_now(),typeof _=="function"){g.callback=_,ue(H),ee=!0;break t}g===r(m)&&s(m),ue(H)}else s(m);g=r(m)}if(g!==null)ee=!0;else{var L=r(d);L!==null&&$(U,L.startTime-H),ee=!1}}break e}finally{g=null,x=oe,w=!1}ee=void 0}}finally{ee?J():M=!1}}}var J;if(typeof F=="function")J=function(){F(X)};else if(typeof MessageChannel<"u"){var le=new MessageChannel,te=le.port2;le.port1.onmessage=X,J=function(){te.postMessage(null)}}else J=function(){D(X,0)};function $(H,ee){K=D(function(){H(e.unstable_now())},ee)}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(H){H.callback=null},e.unstable_forceFrameRate=function(H){0>H||125<H?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):V=0<H?Math.floor(1e3/H):5},e.unstable_getCurrentPriorityLevel=function(){return x},e.unstable_next=function(H){switch(x){case 1:case 2:case 3:var ee=3;break;default:ee=x}var oe=x;x=ee;try{return H()}finally{x=oe}},e.unstable_requestPaint=function(){B=!0},e.unstable_runWithPriority=function(H,ee){switch(H){case 1:case 2:case 3:case 4:case 5:break;default:H=3}var oe=x;x=H;try{return ee()}finally{x=oe}},e.unstable_scheduleCallback=function(H,ee,oe){var be=e.unstable_now();switch(typeof oe=="object"&&oe!==null?(oe=oe.delay,oe=typeof oe=="number"&&0<oe?be+oe:be):oe=be,H){case 1:var _=-1;break;case 2:_=250;break;case 5:_=1073741823;break;case 4:_=1e4;break;default:_=5e3}return _=oe+_,H={id:y++,callback:ee,priorityLevel:H,startTime:oe,expirationTime:_,sortIndex:-1},oe>be?(H.sortIndex=oe,t(d,H),r(m)===null&&H===r(d)&&(R?(P(K),K=-1):R=!0,$(U,oe-be))):(H.sortIndex=_,t(m,H),E||w||(E=!0,M||(M=!0,J()))),H},e.unstable_shouldYield=O,e.unstable_wrapCallback=function(H){var ee=x;return function(){var oe=x;x=ee;try{return H.apply(this,arguments)}finally{x=oe}}}})(ph)),ph}var Qy;function rS(){return Qy||(Qy=1,mh.exports=nS()),mh.exports}var gh={exports:{}},dn={};/**
|
|
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 Zy;function iS(){if(Zy)return dn;Zy=1;var e=Ed();function t(m){var d="https://react.dev/errors/"+m;if(1<arguments.length){d+="?args[]="+encodeURIComponent(arguments[1]);for(var y=2;y<arguments.length;y++)d+="&args[]="+encodeURIComponent(arguments[y])}return"Minified React error #"+m+"; visit "+d+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function r(){}var s={d:{f:r,r:function(){throw Error(t(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 dn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=s,dn.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(t(299));return u(m,d,null,y)},dn.flushSync=function(m){var d=c.T,y=s.p;try{if(c.T=null,s.p=2,m)return m()}finally{c.T=d,s.p=y,s.d.f()}},dn.preconnect=function(m,d){typeof m=="string"&&(d?(d=d.crossOrigin,d=typeof d=="string"?d==="use-credentials"?d:"":void 0):d=null,s.d.C(m,d))},dn.prefetchDNS=function(m){typeof m=="string"&&s.d.D(m)},dn.preinit=function(m,d){if(typeof m=="string"&&d&&typeof d.as=="string"){var y=d.as,g=f(y,d.crossOrigin),x=typeof d.integrity=="string"?d.integrity:void 0,w=typeof d.fetchPriority=="string"?d.fetchPriority:void 0;y==="style"?s.d.S(m,typeof d.precedence=="string"?d.precedence:void 0,{crossOrigin:g,integrity:x,fetchPriority:w}):y==="script"&&s.d.X(m,{crossOrigin:g,integrity:x,fetchPriority:w,nonce:typeof d.nonce=="string"?d.nonce:void 0})}},dn.preinitModule=function(m,d){if(typeof m=="string")if(typeof d=="object"&&d!==null){if(d.as==null||d.as==="script"){var y=f(d.as,d.crossOrigin);s.d.M(m,{crossOrigin:y,integrity:typeof d.integrity=="string"?d.integrity:void 0,nonce:typeof d.nonce=="string"?d.nonce:void 0})}}else d==null&&s.d.M(m)},dn.preload=function(m,d){if(typeof m=="string"&&typeof d=="object"&&d!==null&&typeof d.as=="string"){var y=d.as,g=f(y,d.crossOrigin);s.d.L(m,y,{crossOrigin:g,integrity:typeof d.integrity=="string"?d.integrity:void 0,nonce:typeof d.nonce=="string"?d.nonce:void 0,type:typeof d.type=="string"?d.type:void 0,fetchPriority:typeof d.fetchPriority=="string"?d.fetchPriority:void 0,referrerPolicy:typeof d.referrerPolicy=="string"?d.referrerPolicy:void 0,imageSrcSet:typeof d.imageSrcSet=="string"?d.imageSrcSet:void 0,imageSizes:typeof d.imageSizes=="string"?d.imageSizes:void 0,media:typeof d.media=="string"?d.media:void 0})}},dn.preloadModule=function(m,d){if(typeof m=="string")if(d){var y=f(d.as,d.crossOrigin);s.d.m(m,{as:typeof d.as=="string"&&d.as!=="script"?d.as:void 0,crossOrigin:y,integrity:typeof d.integrity=="string"?d.integrity:void 0})}else s.d.m(m)},dn.requestFormReset=function(m){s.d.r(m)},dn.unstable_batchedUpdates=function(m,d){return m(d)},dn.useFormState=function(m,d,y){return c.H.useFormState(m,d,y)},dn.useFormStatus=function(){return c.H.useHostTransitionStatus()},dn.version="19.2.4",dn}var Wy;function Ib(){if(Wy)return gh.exports;Wy=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),gh.exports=iS(),gh.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 e0;function sS(){if(e0)return gl;e0=1;var e=rS(),t=Ed(),r=Ib();function s(n){var i="https://react.dev/errors/"+n;if(1<arguments.length){i+="?args[]="+encodeURIComponent(arguments[1]);for(var a=2;a<arguments.length;a++)i+="&args[]="+encodeURIComponent(arguments[a])}return"Minified React error #"+n+"; visit "+i+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function l(n){return!(!n||n.nodeType!==1&&n.nodeType!==9&&n.nodeType!==11)}function u(n){var i=n,a=n;if(n.alternate)for(;i.return;)i=i.return;else{n=i;do i=n,(i.flags&4098)!==0&&(a=i.return),n=i.return;while(n)}return i.tag===3?a:null}function c(n){if(n.tag===13){var i=n.memoizedState;if(i===null&&(n=n.alternate,n!==null&&(i=n.memoizedState)),i!==null)return i.dehydrated}return null}function f(n){if(n.tag===31){var i=n.memoizedState;if(i===null&&(n=n.alternate,n!==null&&(i=n.memoizedState)),i!==null)return i.dehydrated}return null}function m(n){if(u(n)!==n)throw Error(s(188))}function d(n){var i=n.alternate;if(!i){if(i=u(n),i===null)throw Error(s(188));return i!==n?null:n}for(var a=n,o=i;;){var h=a.return;if(h===null)break;var p=h.alternate;if(p===null){if(o=h.return,o!==null){a=o;continue}break}if(h.child===p.child){for(p=h.child;p;){if(p===a)return m(h),n;if(p===o)return m(h),i;p=p.sibling}throw Error(s(188))}if(a.return!==o.return)a=h,o=p;else{for(var v=!1,S=h.child;S;){if(S===a){v=!0,a=h,o=p;break}if(S===o){v=!0,o=h,a=p;break}S=S.sibling}if(!v){for(S=p.child;S;){if(S===a){v=!0,a=p,o=h;break}if(S===o){v=!0,o=p,a=h;break}S=S.sibling}if(!v)throw Error(s(189))}}if(a.alternate!==o)throw Error(s(190))}if(a.tag!==3)throw Error(s(188));return a.stateNode.current===a?n:i}function y(n){var i=n.tag;if(i===5||i===26||i===27||i===6)return n;for(n=n.child;n!==null;){if(i=y(n),i!==null)return i;n=n.sibling}return null}var g=Object.assign,x=Symbol.for("react.element"),w=Symbol.for("react.transitional.element"),E=Symbol.for("react.portal"),R=Symbol.for("react.fragment"),B=Symbol.for("react.strict_mode"),D=Symbol.for("react.profiler"),P=Symbol.for("react.consumer"),F=Symbol.for("react.context"),ue=Symbol.for("react.forward_ref"),U=Symbol.for("react.suspense"),M=Symbol.for("react.suspense_list"),K=Symbol.for("react.memo"),V=Symbol.for("react.lazy"),q=Symbol.for("react.activity"),O=Symbol.for("react.memo_cache_sentinel"),X=Symbol.iterator;function J(n){return n===null||typeof n!="object"?null:(n=X&&n[X]||n["@@iterator"],typeof n=="function"?n:null)}var le=Symbol.for("react.client.reference");function te(n){if(n==null)return null;if(typeof n=="function")return n.$$typeof===le?null:n.displayName||n.name||null;if(typeof n=="string")return n;switch(n){case R:return"Fragment";case D:return"Profiler";case B:return"StrictMode";case U:return"Suspense";case M:return"SuspenseList";case q:return"Activity"}if(typeof n=="object")switch(n.$$typeof){case E:return"Portal";case F:return n.displayName||"Context";case P:return(n._context.displayName||"Context")+".Consumer";case ue:var i=n.render;return n=n.displayName,n||(n=i.displayName||i.name||"",n=n!==""?"ForwardRef("+n+")":"ForwardRef"),n;case K:return i=n.displayName||null,i!==null?i:te(n.type)||"Memo";case V:i=n._payload,n=n._init;try{return te(n(i))}catch{}}return null}var $=Array.isArray,H=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ee=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,oe={pending:!1,data:null,method:null,action:null},be=[],_=-1;function L(n){return{current:n}}function Q(n){0>_||(n.current=be[_],be[_]=null,_--)}function A(n,i){_++,be[_]=n.current,n.current=i}var xe=L(null),_e=L(null),Te=L(null),Le=L(null);function $e(n,i){switch(A(Te,i),A(_e,n),A(xe,null),i.nodeType){case 9:case 11:n=(n=i.documentElement)&&(n=n.namespaceURI)?py(n):0;break;default:if(n=i.tagName,i=i.namespaceURI)i=py(i),n=gy(i,n);else switch(n){case"svg":n=1;break;case"math":n=2;break;default:n=0}}Q(xe),A(xe,n)}function Ce(){Q(xe),Q(_e),Q(Te)}function Ne(n){n.memoizedState!==null&&A(Le,n);var i=xe.current,a=gy(i,n.type);i!==a&&(A(_e,n),A(xe,a))}function je(n){_e.current===n&&(Q(xe),Q(_e)),Le.current===n&&(Q(Le),fl._currentValue=oe)}var Fe,Qe;function qe(n){if(Fe===void 0)try{throw Error()}catch(a){var i=a.stack.trim().match(/\n( *(at )?)/);Fe=i&&i[1]||"",Qe=-1<a.stack.indexOf(`
|
|
42
|
-
at`)?" (<anonymous>)":-1<a.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
43
|
-
`+Fe+n+Qe}var ct=!1;function vt(n,i){if(!n||ct)return"";ct=!0;var a=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var o={DetermineComponentFrameRoot:function(){try{if(i){var ge=function(){throw Error()};if(Object.defineProperty(ge.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ge,[])}catch(ae){var ie=ae}Reflect.construct(n,[],ge)}else{try{ge.call()}catch(ae){ie=ae}n.call(ge.prototype)}}else{try{throw Error()}catch(ae){ie=ae}(ge=n())&&typeof ge.catch=="function"&&ge.catch(function(){})}}catch(ae){if(ae&&ie&&typeof ae.stack=="string")return[ae.stack,ie.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 I=v.split(`
|
|
44
|
-
`),re=S.split(`
|
|
45
|
-
`);for(h=o=0;o<I.length&&!I[o].includes("DetermineComponentFrameRoot");)o++;for(;h<re.length&&!re[h].includes("DetermineComponentFrameRoot");)h++;if(o===I.length||h===re.length)for(o=I.length-1,h=re.length-1;1<=o&&0<=h&&I[o]!==re[h];)h--;for(;1<=o&&0<=h;o--,h--)if(I[o]!==re[h]){if(o!==1||h!==1)do if(o--,h--,0>h||I[o]!==re[h]){var ce=`
|
|
46
|
-
`+I[o].replace(" at new "," at ");return n.displayName&&ce.includes("<anonymous>")&&(ce=ce.replace("<anonymous>",n.displayName)),ce}while(1<=o&&0<=h);break}}}finally{ct=!1,Error.prepareStackTrace=a}return(a=n?n.displayName||n.name:"")?qe(a):""}function Ve(n,i){switch(n.tag){case 26:case 27:case 5:return qe(n.type);case 16:return qe("Lazy");case 13:return n.child!==i&&i!==null?qe("Suspense Fallback"):qe("Suspense");case 19:return qe("SuspenseList");case 0:case 15:return vt(n.type,!1);case 11:return vt(n.type.render,!1);case 1:return vt(n.type,!0);case 31:return qe("Activity");default:return""}}function He(n){try{var i="",a=null;do i+=Ve(n,a),a=n,n=n.return;while(n);return i}catch(o){return`
|
|
47
|
-
Error generating stack: `+o.message+`
|
|
48
|
-
`+o.stack}}var nt=Object.prototype.hasOwnProperty,ft=e.unstable_scheduleCallback,rt=e.unstable_cancelCallback,qt=e.unstable_shouldYield,jt=e.unstable_requestPaint,ht=e.unstable_now,Fi=e.unstable_getCurrentPriorityLevel,fe=e.unstable_ImmediatePriority,ve=e.unstable_UserBlockingPriority,Ue=e.unstable_NormalPriority,Je=e.unstable_LowPriority,lt=e.unstable_IdlePriority,nn=e.log,_n=e.unstable_setDisableYieldValue,Wt=null,yt=null;function Ht(n){if(typeof nn=="function"&&_n(n),yt&&typeof yt.setStrictMode=="function")try{yt.setStrictMode(Wt,n)}catch{}}var de=Math.clz32?Math.clz32:Ot,Ie=Math.log,Ae=Math.LN2;function Ot(n){return n>>>=0,n===0?32:31-(Ie(n)/Ae|0)|0}var Pt=256,fn=262144,ii=4194304;function ur(n){var i=n&42;if(i!==0)return i;switch(n&-n){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return n&261888;case 262144:case 524288:case 1048576:case 2097152:return n&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return n&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return n}}function $i(n,i,a){var o=n.pendingLanes;if(o===0)return 0;var h=0,p=n.suspendedLanes,v=n.pingedLanes;n=n.warmLanes;var S=o&134217727;return S!==0?(o=S&~p,o!==0?h=ur(o):(v&=S,v!==0?h=ur(v):a||(a=S&~n,a!==0&&(h=ur(a))))):(S=o&~p,S!==0?h=ur(S):v!==0?h=ur(v):a||(a=o&~n,a!==0&&(h=ur(a)))),h===0?0:i!==0&&i!==h&&(i&p)===0&&(p=h&-h,a=i&-i,p>=a||p===32&&(a&4194048)!==0)?i:h}function Yi(n,i){return(n.pendingLanes&~(n.suspendedLanes&~n.pingedLanes)&i)===0}function Ea(n,i){switch(n){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 bs(){var n=ii;return ii<<=1,(ii&62914560)===0&&(ii=4194304),n}function si(n){for(var i=[],a=0;31>a;a++)i.push(n);return i}function cr(n,i){n.pendingLanes|=i,i!==268435456&&(n.suspendedLanes=0,n.pingedLanes=0,n.warmLanes=0)}function ai(n,i,a,o,h,p){var v=n.pendingLanes;n.pendingLanes=a,n.suspendedLanes=0,n.pingedLanes=0,n.warmLanes=0,n.expiredLanes&=a,n.entangledLanes&=a,n.errorRecoveryDisabledLanes&=a,n.shellSuspendCounter=0;var S=n.entanglements,I=n.expirationTimes,re=n.hiddenUpdates;for(a=v&~a;0<a;){var ce=31-de(a),ge=1<<ce;S[ce]=0,I[ce]=-1;var ie=re[ce];if(ie!==null)for(re[ce]=null,ce=0;ce<ie.length;ce++){var ae=ie[ce];ae!==null&&(ae.lane&=-536870913)}a&=~ge}o!==0&&li(n,o,0),p!==0&&h===0&&n.tag!==0&&(n.suspendedLanes|=p&~(v&~i))}function li(n,i,a){n.pendingLanes|=i,n.suspendedLanes&=~i;var o=31-de(i);n.entangledLanes|=i,n.entanglements[o]=n.entanglements[o]|1073741824|a&261930}function Gi(n,i){var a=n.entangledLanes|=i;for(n=n.entanglements;a;){var o=31-de(a),h=1<<o;h&i|n[o]&i&&(n[o]|=i),a&=~h}}function oi(n,i){var a=i&-i;return a=(a&42)!==0?1:Mr(a),(a&(n.suspendedLanes|i))!==0?0:a}function Mr(n){switch(n){case 2:n=1;break;case 8:n=4;break;case 32:n=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:n=128;break;case 268435456:n=134217728;break;default:n=0}return n}function Vi(n){return n&=-n,2<n?8<n?(n&134217727)!==0?32:268435456:8:2}function Ca(){var n=ee.p;return n!==0?n:(n=window.event,n===void 0?32:Py(n.type))}function Xl(n,i){var a=ee.p;try{return ee.p=n,i()}finally{ee.p=a}}var Sr=Math.random().toString(36).slice(2),Ct="__reactFiber$"+Sr,It="__reactProps$"+Sr,Rn="__reactContainer$"+Sr,Ji="__reactEvents$"+Sr,Aa="__reactListeners$"+Sr,Kl="__reactHandles$"+Sr,Ql="__reactResources$"+Sr,en="__reactMarker$"+Sr;function xs(n){delete n[Ct],delete n[It],delete n[Ji],delete n[Aa],delete n[Kl]}function k(n){var i=n[Ct];if(i)return i;for(var a=n.parentNode;a;){if(i=a[Rn]||a[Ct]){if(a=i.alternate,i.child!==null||a!==null&&a.child!==null)for(n=_y(n);n!==null;){if(a=n[Ct])return a;n=_y(n)}return i}n=a,a=n.parentNode}return null}function N(n){if(n=n[Ct]||n[Rn]){var i=n.tag;if(i===5||i===6||i===13||i===31||i===26||i===27||i===3)return n}return null}function T(n){var i=n.tag;if(i===5||i===26||i===27||i===6)return n.stateNode;throw Error(s(33))}function z(n){var i=n[Ql];return i||(i=n[Ql]={hoistableStyles:new Map,hoistableScripts:new Map}),i}function Y(n){n[en]=!0}var W=new Set,pe={};function ye(n,i){se(n,i),se(n+"Capture",i)}function se(n,i){for(pe[n]=i,n=0;n<i.length;n++)W.add(i[n])}var me=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]*$"),Re={},Ze={};function Rt(n){return nt.call(Ze,n)?!0:nt.call(Re,n)?!1:me.test(n)?Ze[n]=!0:(Re[n]=!0,!1)}function hn(n,i,a){if(Rt(i))if(a===null)n.removeAttribute(i);else{switch(typeof a){case"undefined":case"function":case"symbol":n.removeAttribute(i);return;case"boolean":var o=i.toLowerCase().slice(0,5);if(o!=="data-"&&o!=="aria-"){n.removeAttribute(i);return}}n.setAttribute(i,""+a)}}function fr(n,i,a){if(a===null)n.removeAttribute(i);else{switch(typeof a){case"undefined":case"function":case"symbol":case"boolean":n.removeAttribute(i);return}n.setAttribute(i,""+a)}}function Dr(n,i,a,o){if(o===null)n.removeAttribute(a);else{switch(typeof o){case"undefined":case"function":case"symbol":case"boolean":n.removeAttribute(a);return}n.setAttributeNS(i,a,""+o)}}function Xn(n){switch(typeof n){case"bigint":case"boolean":case"number":case"string":case"undefined":return n;case"object":return n;default:return""}}function lm(n){var i=n.type;return(n=n.nodeName)&&n.toLowerCase()==="input"&&(i==="checkbox"||i==="radio")}function $1(n,i,a){var o=Object.getOwnPropertyDescriptor(n.constructor.prototype,i);if(!n.hasOwnProperty(i)&&typeof o<"u"&&typeof o.get=="function"&&typeof o.set=="function"){var h=o.get,p=o.set;return Object.defineProperty(n,i,{configurable:!0,get:function(){return h.call(this)},set:function(v){a=""+v,p.call(this,v)}}),Object.defineProperty(n,i,{enumerable:o.enumerable}),{getValue:function(){return a},setValue:function(v){a=""+v},stopTracking:function(){n._valueTracker=null,delete n[i]}}}}function rc(n){if(!n._valueTracker){var i=lm(n)?"checked":"value";n._valueTracker=$1(n,i,""+n[i])}}function om(n){if(!n)return!1;var i=n._valueTracker;if(!i)return!0;var a=i.getValue(),o="";return n&&(o=lm(n)?n.checked?"true":"false":n.value),n=o,n!==a?(i.setValue(n),!0):!1}function Zl(n){if(n=n||(typeof document<"u"?document:void 0),typeof n>"u")return null;try{return n.activeElement||n.body}catch{return n.body}}var Y1=/[\n"\\]/g;function Kn(n){return n.replace(Y1,function(i){return"\\"+i.charCodeAt(0).toString(16)+" "})}function ic(n,i,a,o,h,p,v,S){n.name="",v!=null&&typeof v!="function"&&typeof v!="symbol"&&typeof v!="boolean"?n.type=v:n.removeAttribute("type"),i!=null?v==="number"?(i===0&&n.value===""||n.value!=i)&&(n.value=""+Xn(i)):n.value!==""+Xn(i)&&(n.value=""+Xn(i)):v!=="submit"&&v!=="reset"||n.removeAttribute("value"),i!=null?sc(n,v,Xn(i)):a!=null?sc(n,v,Xn(a)):o!=null&&n.removeAttribute("value"),h==null&&p!=null&&(n.defaultChecked=!!p),h!=null&&(n.checked=h&&typeof h!="function"&&typeof h!="symbol"),S!=null&&typeof S!="function"&&typeof S!="symbol"&&typeof S!="boolean"?n.name=""+Xn(S):n.removeAttribute("name")}function um(n,i,a,o,h,p,v,S){if(p!=null&&typeof p!="function"&&typeof p!="symbol"&&typeof p!="boolean"&&(n.type=p),i!=null||a!=null){if(!(p!=="submit"&&p!=="reset"||i!=null)){rc(n);return}a=a!=null?""+Xn(a):"",i=i!=null?""+Xn(i):a,S||i===n.value||(n.value=i),n.defaultValue=i}o=o??h,o=typeof o!="function"&&typeof o!="symbol"&&!!o,n.checked=S?n.checked:!!o,n.defaultChecked=!!o,v!=null&&typeof v!="function"&&typeof v!="symbol"&&typeof v!="boolean"&&(n.name=v),rc(n)}function sc(n,i,a){i==="number"&&Zl(n.ownerDocument)===n||n.defaultValue===""+a||(n.defaultValue=""+a)}function vs(n,i,a,o){if(n=n.options,i){i={};for(var h=0;h<a.length;h++)i["$"+a[h]]=!0;for(a=0;a<n.length;a++)h=i.hasOwnProperty("$"+n[a].value),n[a].selected!==h&&(n[a].selected=h),h&&o&&(n[a].defaultSelected=!0)}else{for(a=""+Xn(a),i=null,h=0;h<n.length;h++){if(n[h].value===a){n[h].selected=!0,o&&(n[h].defaultSelected=!0);return}i!==null||n[h].disabled||(i=n[h])}i!==null&&(i.selected=!0)}}function cm(n,i,a){if(i!=null&&(i=""+Xn(i),i!==n.value&&(n.value=i),a==null)){n.defaultValue!==i&&(n.defaultValue=i);return}n.defaultValue=a!=null?""+Xn(a):""}function fm(n,i,a,o){if(i==null){if(o!=null){if(a!=null)throw Error(s(92));if($(o)){if(1<o.length)throw Error(s(93));o=o[0]}a=o}a==null&&(a=""),i=a}a=Xn(i),n.defaultValue=a,o=n.textContent,o===a&&o!==""&&o!==null&&(n.value=o),rc(n)}function ws(n,i){if(i){var a=n.firstChild;if(a&&a===n.lastChild&&a.nodeType===3){a.nodeValue=i;return}}n.textContent=i}var G1=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 hm(n,i,a){var o=i.indexOf("--")===0;a==null||typeof a=="boolean"||a===""?o?n.setProperty(i,""):i==="float"?n.cssFloat="":n[i]="":o?n.setProperty(i,a):typeof a!="number"||a===0||G1.has(i)?i==="float"?n.cssFloat=a:n[i]=(""+a).trim():n[i]=a+"px"}function dm(n,i,a){if(i!=null&&typeof i!="object")throw Error(s(62));if(n=n.style,a!=null){for(var o in a)!a.hasOwnProperty(o)||i!=null&&i.hasOwnProperty(o)||(o.indexOf("--")===0?n.setProperty(o,""):o==="float"?n.cssFloat="":n[o]="");for(var h in i)o=i[h],i.hasOwnProperty(h)&&a[h]!==o&&hm(n,h,o)}else for(var p in i)i.hasOwnProperty(p)&&hm(n,p,i[p])}function ac(n){if(n.indexOf("-")===-1)return!1;switch(n){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var V1=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"]]),J1=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function Wl(n){return J1.test(""+n)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":n}function Lr(){}var lc=null;function oc(n){return n=n.target||n.srcElement||window,n.correspondingUseElement&&(n=n.correspondingUseElement),n.nodeType===3?n.parentNode:n}var Ss=null,_s=null;function mm(n){var i=N(n);if(i&&(n=i.stateNode)){var a=n[It]||null;e:switch(n=i.stateNode,i.type){case"input":if(ic(n,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name),i=a.name,a.type==="radio"&&i!=null){for(a=n;a.parentNode;)a=a.parentNode;for(a=a.querySelectorAll('input[name="'+Kn(""+i)+'"][type="radio"]'),i=0;i<a.length;i++){var o=a[i];if(o!==n&&o.form===n.form){var h=o[It]||null;if(!h)throw Error(s(90));ic(o,h.value,h.defaultValue,h.defaultValue,h.checked,h.defaultChecked,h.type,h.name)}}for(i=0;i<a.length;i++)o=a[i],o.form===n.form&&om(o)}break e;case"textarea":cm(n,a.value,a.defaultValue);break e;case"select":i=a.value,i!=null&&vs(n,!!a.multiple,i,!1)}}}var uc=!1;function pm(n,i,a){if(uc)return n(i,a);uc=!0;try{var o=n(i);return o}finally{if(uc=!1,(Ss!==null||_s!==null)&&(Ho(),Ss&&(i=Ss,n=_s,_s=Ss=null,mm(i),n)))for(i=0;i<n.length;i++)mm(n[i])}}function Ta(n,i){var a=n.stateNode;if(a===null)return null;var o=a[It]||null;if(o===null)return null;a=o[i];e:switch(i){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(o=!o.disabled)||(n=n.type,o=!(n==="button"||n==="input"||n==="select"||n==="textarea")),n=!o;break e;default:n=!1}if(n)return null;if(a&&typeof a!="function")throw Error(s(231,i,typeof a));return a}var zr=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),cc=!1;if(zr)try{var ja={};Object.defineProperty(ja,"passive",{get:function(){cc=!0}}),window.addEventListener("test",ja,ja),window.removeEventListener("test",ja,ja)}catch{cc=!1}var ui=null,fc=null,eo=null;function gm(){if(eo)return eo;var n,i=fc,a=i.length,o,h="value"in ui?ui.value:ui.textContent,p=h.length;for(n=0;n<a&&i[n]===h[n];n++);var v=a-n;for(o=1;o<=v&&i[a-o]===h[p-o];o++);return eo=h.slice(n,1<o?1-o:void 0)}function to(n){var i=n.keyCode;return"charCode"in n?(n=n.charCode,n===0&&i===13&&(n=13)):n=i,n===10&&(n=13),32<=n||n===13?n:0}function no(){return!0}function ym(){return!1}function kn(n){function i(a,o,h,p,v){this._reactName=a,this._targetInst=h,this.type=o,this.nativeEvent=p,this.target=v,this.currentTarget=null;for(var S in n)n.hasOwnProperty(S)&&(a=n[S],this[S]=a?a(p):p[S]);return this.isDefaultPrevented=(p.defaultPrevented!=null?p.defaultPrevented:p.returnValue===!1)?no:ym,this.isPropagationStopped=ym,this}return g(i.prototype,{preventDefault:function(){this.defaultPrevented=!0;var a=this.nativeEvent;a&&(a.preventDefault?a.preventDefault():typeof a.returnValue!="unknown"&&(a.returnValue=!1),this.isDefaultPrevented=no)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=no)},persist:function(){},isPersistent:no}),i}var Xi={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(n){return n.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},ro=kn(Xi),Na=g({},Xi,{view:0,detail:0}),X1=kn(Na),hc,dc,Oa,io=g({},Na,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:pc,button:0,buttons:0,relatedTarget:function(n){return n.relatedTarget===void 0?n.fromElement===n.srcElement?n.toElement:n.fromElement:n.relatedTarget},movementX:function(n){return"movementX"in n?n.movementX:(n!==Oa&&(Oa&&n.type==="mousemove"?(hc=n.screenX-Oa.screenX,dc=n.screenY-Oa.screenY):dc=hc=0,Oa=n),hc)},movementY:function(n){return"movementY"in n?n.movementY:dc}}),bm=kn(io),K1=g({},io,{dataTransfer:0}),Q1=kn(K1),Z1=g({},Na,{relatedTarget:0}),mc=kn(Z1),W1=g({},Xi,{animationName:0,elapsedTime:0,pseudoElement:0}),ev=kn(W1),tv=g({},Xi,{clipboardData:function(n){return"clipboardData"in n?n.clipboardData:window.clipboardData}}),nv=kn(tv),rv=g({},Xi,{data:0}),xm=kn(rv),iv={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},sv={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"},av={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function lv(n){var i=this.nativeEvent;return i.getModifierState?i.getModifierState(n):(n=av[n])?!!i[n]:!1}function pc(){return lv}var ov=g({},Na,{key:function(n){if(n.key){var i=iv[n.key]||n.key;if(i!=="Unidentified")return i}return n.type==="keypress"?(n=to(n),n===13?"Enter":String.fromCharCode(n)):n.type==="keydown"||n.type==="keyup"?sv[n.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:pc,charCode:function(n){return n.type==="keypress"?to(n):0},keyCode:function(n){return n.type==="keydown"||n.type==="keyup"?n.keyCode:0},which:function(n){return n.type==="keypress"?to(n):n.type==="keydown"||n.type==="keyup"?n.keyCode:0}}),uv=kn(ov),cv=g({},io,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),vm=kn(cv),fv=g({},Na,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:pc}),hv=kn(fv),dv=g({},Xi,{propertyName:0,elapsedTime:0,pseudoElement:0}),mv=kn(dv),pv=g({},io,{deltaX:function(n){return"deltaX"in n?n.deltaX:"wheelDeltaX"in n?-n.wheelDeltaX:0},deltaY:function(n){return"deltaY"in n?n.deltaY:"wheelDeltaY"in n?-n.wheelDeltaY:"wheelDelta"in n?-n.wheelDelta:0},deltaZ:0,deltaMode:0}),gv=kn(pv),yv=g({},Xi,{newState:0,oldState:0}),bv=kn(yv),xv=[9,13,27,32],gc=zr&&"CompositionEvent"in window,Ra=null;zr&&"documentMode"in document&&(Ra=document.documentMode);var vv=zr&&"TextEvent"in window&&!Ra,wm=zr&&(!gc||Ra&&8<Ra&&11>=Ra),Sm=" ",_m=!1;function km(n,i){switch(n){case"keyup":return xv.indexOf(i.keyCode)!==-1;case"keydown":return i.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Em(n){return n=n.detail,typeof n=="object"&&"data"in n?n.data:null}var ks=!1;function wv(n,i){switch(n){case"compositionend":return Em(i);case"keypress":return i.which!==32?null:(_m=!0,Sm);case"textInput":return n=i.data,n===Sm&&_m?null:n;default:return null}}function Sv(n,i){if(ks)return n==="compositionend"||!gc&&km(n,i)?(n=gm(),eo=fc=ui=null,ks=!1,n):null;switch(n){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 wm&&i.locale!=="ko"?null:i.data;default:return null}}var _v={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 Cm(n){var i=n&&n.nodeName&&n.nodeName.toLowerCase();return i==="input"?!!_v[n.type]:i==="textarea"}function Am(n,i,a,o){Ss?_s?_s.push(o):_s=[o]:Ss=o,i=Jo(i,"onChange"),0<i.length&&(a=new ro("onChange","change",null,a,o),n.push({event:a,listeners:i}))}var Ma=null,Da=null;function kv(n){uy(n,0)}function so(n){var i=T(n);if(om(i))return n}function Tm(n,i){if(n==="change")return i}var jm=!1;if(zr){var yc;if(zr){var bc="oninput"in document;if(!bc){var Nm=document.createElement("div");Nm.setAttribute("oninput","return;"),bc=typeof Nm.oninput=="function"}yc=bc}else yc=!1;jm=yc&&(!document.documentMode||9<document.documentMode)}function Om(){Ma&&(Ma.detachEvent("onpropertychange",Rm),Da=Ma=null)}function Rm(n){if(n.propertyName==="value"&&so(Da)){var i=[];Am(i,Da,n,oc(n)),pm(kv,i)}}function Ev(n,i,a){n==="focusin"?(Om(),Ma=i,Da=a,Ma.attachEvent("onpropertychange",Rm)):n==="focusout"&&Om()}function Cv(n){if(n==="selectionchange"||n==="keyup"||n==="keydown")return so(Da)}function Av(n,i){if(n==="click")return so(i)}function Tv(n,i){if(n==="input"||n==="change")return so(i)}function jv(n,i){return n===i&&(n!==0||1/n===1/i)||n!==n&&i!==i}var Mn=typeof Object.is=="function"?Object.is:jv;function La(n,i){if(Mn(n,i))return!0;if(typeof n!="object"||n===null||typeof i!="object"||i===null)return!1;var a=Object.keys(n),o=Object.keys(i);if(a.length!==o.length)return!1;for(o=0;o<a.length;o++){var h=a[o];if(!nt.call(i,h)||!Mn(n[h],i[h]))return!1}return!0}function Mm(n){for(;n&&n.firstChild;)n=n.firstChild;return n}function Dm(n,i){var a=Mm(n);n=0;for(var o;a;){if(a.nodeType===3){if(o=n+a.textContent.length,n<=i&&o>=i)return{node:a,offset:i-n};n=o}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=Mm(a)}}function Lm(n,i){return n&&i?n===i?!0:n&&n.nodeType===3?!1:i&&i.nodeType===3?Lm(n,i.parentNode):"contains"in n?n.contains(i):n.compareDocumentPosition?!!(n.compareDocumentPosition(i)&16):!1:!1}function zm(n){n=n!=null&&n.ownerDocument!=null&&n.ownerDocument.defaultView!=null?n.ownerDocument.defaultView:window;for(var i=Zl(n.document);i instanceof n.HTMLIFrameElement;){try{var a=typeof i.contentWindow.location.href=="string"}catch{a=!1}if(a)n=i.contentWindow;else break;i=Zl(n.document)}return i}function xc(n){var i=n&&n.nodeName&&n.nodeName.toLowerCase();return i&&(i==="input"&&(n.type==="text"||n.type==="search"||n.type==="tel"||n.type==="url"||n.type==="password")||i==="textarea"||n.contentEditable==="true")}var Nv=zr&&"documentMode"in document&&11>=document.documentMode,Es=null,vc=null,za=null,wc=!1;function Um(n,i,a){var o=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;wc||Es==null||Es!==Zl(o)||(o=Es,"selectionStart"in o&&xc(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}),za&&La(za,o)||(za=o,o=Jo(vc,"onSelect"),0<o.length&&(i=new ro("onSelect","select",null,i,a),n.push({event:i,listeners:o}),i.target=Es)))}function Ki(n,i){var a={};return a[n.toLowerCase()]=i.toLowerCase(),a["Webkit"+n]="webkit"+i,a["Moz"+n]="moz"+i,a}var Cs={animationend:Ki("Animation","AnimationEnd"),animationiteration:Ki("Animation","AnimationIteration"),animationstart:Ki("Animation","AnimationStart"),transitionrun:Ki("Transition","TransitionRun"),transitionstart:Ki("Transition","TransitionStart"),transitioncancel:Ki("Transition","TransitionCancel"),transitionend:Ki("Transition","TransitionEnd")},Sc={},Bm={};zr&&(Bm=document.createElement("div").style,"AnimationEvent"in window||(delete Cs.animationend.animation,delete Cs.animationiteration.animation,delete Cs.animationstart.animation),"TransitionEvent"in window||delete Cs.transitionend.transition);function Qi(n){if(Sc[n])return Sc[n];if(!Cs[n])return n;var i=Cs[n],a;for(a in i)if(i.hasOwnProperty(a)&&a in Bm)return Sc[n]=i[a];return n}var Pm=Qi("animationend"),qm=Qi("animationiteration"),Hm=Qi("animationstart"),Ov=Qi("transitionrun"),Rv=Qi("transitionstart"),Mv=Qi("transitioncancel"),Im=Qi("transitionend"),Fm=new Map,_c="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(" ");_c.push("scrollEnd");function hr(n,i){Fm.set(n,i),ye(i,[n])}var ao=typeof reportError=="function"?reportError:function(n){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var i=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof n=="object"&&n!==null&&typeof n.message=="string"?String(n.message):String(n),error:n});if(!window.dispatchEvent(i))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",n);return}console.error(n)},Qn=[],As=0,kc=0;function lo(){for(var n=As,i=kc=As=0;i<n;){var a=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&&$m(a,h,p)}}function oo(n,i,a,o){Qn[As++]=n,Qn[As++]=i,Qn[As++]=a,Qn[As++]=o,kc|=o,n.lanes|=o,n=n.alternate,n!==null&&(n.lanes|=o)}function Ec(n,i,a,o){return oo(n,i,a,o),uo(n)}function Zi(n,i){return oo(n,null,null,i),uo(n)}function $m(n,i,a){n.lanes|=a;var o=n.alternate;o!==null&&(o.lanes|=a);for(var h=!1,p=n.return;p!==null;)p.childLanes|=a,o=p.alternate,o!==null&&(o.childLanes|=a),p.tag===22&&(n=p.stateNode,n===null||n._visibility&1||(h=!0)),n=p,p=p.return;return n.tag===3?(p=n.stateNode,h&&i!==null&&(h=31-de(a),n=p.hiddenUpdates,o=n[h],o===null?n[h]=[i]:o.push(i),i.lane=a|536870912),p):null}function uo(n){if(50<il)throw il=0,Lf=null,Error(s(185));for(var i=n.return;i!==null;)n=i,i=n.return;return n.tag===3?n.stateNode:null}var Ts={};function Dv(n,i,a,o){this.tag=n,this.key=a,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=i,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=o,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Dn(n,i,a,o){return new Dv(n,i,a,o)}function Cc(n){return n=n.prototype,!(!n||!n.isReactComponent)}function Ur(n,i){var a=n.alternate;return a===null?(a=Dn(n.tag,i,n.key,n.mode),a.elementType=n.elementType,a.type=n.type,a.stateNode=n.stateNode,a.alternate=n,n.alternate=a):(a.pendingProps=i,a.type=n.type,a.flags=0,a.subtreeFlags=0,a.deletions=null),a.flags=n.flags&65011712,a.childLanes=n.childLanes,a.lanes=n.lanes,a.child=n.child,a.memoizedProps=n.memoizedProps,a.memoizedState=n.memoizedState,a.updateQueue=n.updateQueue,i=n.dependencies,a.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext},a.sibling=n.sibling,a.index=n.index,a.ref=n.ref,a.refCleanup=n.refCleanup,a}function Ym(n,i){n.flags&=65011714;var a=n.alternate;return a===null?(n.childLanes=0,n.lanes=i,n.child=null,n.subtreeFlags=0,n.memoizedProps=null,n.memoizedState=null,n.updateQueue=null,n.dependencies=null,n.stateNode=null):(n.childLanes=a.childLanes,n.lanes=a.lanes,n.child=a.child,n.subtreeFlags=0,n.deletions=null,n.memoizedProps=a.memoizedProps,n.memoizedState=a.memoizedState,n.updateQueue=a.updateQueue,n.type=a.type,i=a.dependencies,n.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext}),n}function co(n,i,a,o,h,p){var v=0;if(o=n,typeof n=="function")Cc(n)&&(v=1);else if(typeof n=="string")v=Pw(n,a,xe.current)?26:n==="html"||n==="head"||n==="body"?27:5;else e:switch(n){case q:return n=Dn(31,a,i,h),n.elementType=q,n.lanes=p,n;case R:return Wi(a.children,h,p,i);case B:v=8,h|=24;break;case D:return n=Dn(12,a,i,h|2),n.elementType=D,n.lanes=p,n;case U:return n=Dn(13,a,i,h),n.elementType=U,n.lanes=p,n;case M:return n=Dn(19,a,i,h),n.elementType=M,n.lanes=p,n;default:if(typeof n=="object"&&n!==null)switch(n.$$typeof){case F:v=10;break e;case P:v=9;break e;case ue:v=11;break e;case K:v=14;break e;case V:v=16,o=null;break e}v=29,a=Error(s(130,n===null?"null":typeof n,"")),o=null}return i=Dn(v,a,i,h),i.elementType=n,i.type=o,i.lanes=p,i}function Wi(n,i,a,o){return n=Dn(7,n,o,i),n.lanes=a,n}function Ac(n,i,a){return n=Dn(6,n,null,i),n.lanes=a,n}function Gm(n){var i=Dn(18,null,null,0);return i.stateNode=n,i}function Tc(n,i,a){return i=Dn(4,n.children!==null?n.children:[],n.key,i),i.lanes=a,i.stateNode={containerInfo:n.containerInfo,pendingChildren:null,implementation:n.implementation},i}var Vm=new WeakMap;function Zn(n,i){if(typeof n=="object"&&n!==null){var a=Vm.get(n);return a!==void 0?a:(i={value:n,source:i,stack:He(i)},Vm.set(n,i),i)}return{value:n,source:i,stack:He(i)}}var js=[],Ns=0,fo=null,Ua=0,Wn=[],er=0,ci=null,_r=1,kr="";function Br(n,i){js[Ns++]=Ua,js[Ns++]=fo,fo=n,Ua=i}function Jm(n,i,a){Wn[er++]=_r,Wn[er++]=kr,Wn[er++]=ci,ci=n;var o=_r;n=kr;var h=32-de(o)-1;o&=~(1<<h),a+=1;var p=32-de(i)+h;if(30<p){var v=h-h%5;p=(o&(1<<v)-1).toString(32),o>>=v,h-=v,_r=1<<32-de(i)+h|a<<h|o,kr=p+n}else _r=1<<p|a<<h|o,kr=n}function jc(n){n.return!==null&&(Br(n,1),Jm(n,1,0))}function Nc(n){for(;n===fo;)fo=js[--Ns],js[Ns]=null,Ua=js[--Ns],js[Ns]=null;for(;n===ci;)ci=Wn[--er],Wn[er]=null,kr=Wn[--er],Wn[er]=null,_r=Wn[--er],Wn[er]=null}function Xm(n,i){Wn[er++]=_r,Wn[er++]=kr,Wn[er++]=ci,_r=i.id,kr=i.overflow,ci=n}var ln=null,Mt=null,at=!1,fi=null,tr=!1,Oc=Error(s(519));function hi(n){var i=Error(s(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Ba(Zn(i,n)),Oc}function Km(n){var i=n.stateNode,a=n.type,o=n.memoizedProps;switch(i[Ct]=n,i[It]=o,a){case"dialog":et("cancel",i),et("close",i);break;case"iframe":case"object":case"embed":et("load",i);break;case"video":case"audio":for(a=0;a<al.length;a++)et(al[a],i);break;case"source":et("error",i);break;case"img":case"image":case"link":et("error",i),et("load",i);break;case"details":et("toggle",i);break;case"input":et("invalid",i),um(i,o.value,o.defaultValue,o.checked,o.defaultChecked,o.type,o.name,!0);break;case"select":et("invalid",i);break;case"textarea":et("invalid",i),fm(i,o.value,o.defaultValue,o.children)}a=o.children,typeof a!="string"&&typeof a!="number"&&typeof a!="bigint"||i.textContent===""+a||o.suppressHydrationWarning===!0||dy(i.textContent,a)?(o.popover!=null&&(et("beforetoggle",i),et("toggle",i)),o.onScroll!=null&&et("scroll",i),o.onScrollEnd!=null&&et("scrollend",i),o.onClick!=null&&(i.onclick=Lr),i=!0):i=!1,i||hi(n,!0)}function Qm(n){for(ln=n.return;ln;)switch(ln.tag){case 5:case 31:case 13:tr=!1;return;case 27:case 3:tr=!0;return;default:ln=ln.return}}function Os(n){if(n!==ln)return!1;if(!at)return Qm(n),at=!0,!1;var i=n.tag,a;if((a=i!==3&&i!==27)&&((a=i===5)&&(a=n.type,a=!(a!=="form"&&a!=="button")||Kf(n.type,n.memoizedProps)),a=!a),a&&Mt&&hi(n),Qm(n),i===13){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(s(317));Mt=Sy(n)}else if(i===31){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(s(317));Mt=Sy(n)}else i===27?(i=Mt,Ci(n.type)?(n=th,th=null,Mt=n):Mt=i):Mt=ln?rr(n.stateNode.nextSibling):null;return!0}function es(){Mt=ln=null,at=!1}function Rc(){var n=fi;return n!==null&&(Tn===null?Tn=n:Tn.push.apply(Tn,n),fi=null),n}function Ba(n){fi===null?fi=[n]:fi.push(n)}var Mc=L(null),ts=null,Pr=null;function di(n,i,a){A(Mc,i._currentValue),i._currentValue=a}function qr(n){n._currentValue=Mc.current,Q(Mc)}function Dc(n,i,a){for(;n!==null;){var o=n.alternate;if((n.childLanes&i)!==i?(n.childLanes|=i,o!==null&&(o.childLanes|=i)):o!==null&&(o.childLanes&i)!==i&&(o.childLanes|=i),n===a)break;n=n.return}}function Lc(n,i,a,o){var h=n.child;for(h!==null&&(h.return=n);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 I=0;I<i.length;I++)if(S.context===i[I]){p.lanes|=a,S=p.alternate,S!==null&&(S.lanes|=a),Dc(p.return,a,n),o||(v=null);break e}p=S.next}}else if(h.tag===18){if(v=h.return,v===null)throw Error(s(341));v.lanes|=a,p=v.alternate,p!==null&&(p.lanes|=a),Dc(v,a,n),v=null}else v=h.child;if(v!==null)v.return=h;else for(v=h;v!==null;){if(v===n){v=null;break}if(h=v.sibling,h!==null){h.return=v.return,v=h;break}v=v.return}h=v}}function Rs(n,i,a,o){n=null;for(var h=i,p=!1;h!==null;){if(!p){if((h.flags&524288)!==0)p=!0;else if((h.flags&262144)!==0)break}if(h.tag===10){var v=h.alternate;if(v===null)throw Error(s(387));if(v=v.memoizedProps,v!==null){var S=h.type;Mn(h.pendingProps.value,v.value)||(n!==null?n.push(S):n=[S])}}else if(h===Le.current){if(v=h.alternate,v===null)throw Error(s(387));v.memoizedState.memoizedState!==h.memoizedState.memoizedState&&(n!==null?n.push(fl):n=[fl])}h=h.return}n!==null&&Lc(i,n,a,o),i.flags|=262144}function ho(n){for(n=n.firstContext;n!==null;){if(!Mn(n.context._currentValue,n.memoizedValue))return!0;n=n.next}return!1}function ns(n){ts=n,Pr=null,n=n.dependencies,n!==null&&(n.firstContext=null)}function on(n){return Zm(ts,n)}function mo(n,i){return ts===null&&ns(n),Zm(n,i)}function Zm(n,i){var a=i._currentValue;if(i={context:i,memoizedValue:a,next:null},Pr===null){if(n===null)throw Error(s(308));Pr=i,n.dependencies={lanes:0,firstContext:i},n.flags|=524288}else Pr=Pr.next=i;return a}var Lv=typeof AbortController<"u"?AbortController:function(){var n=[],i=this.signal={aborted:!1,addEventListener:function(a,o){n.push(o)}};this.abort=function(){i.aborted=!0,n.forEach(function(a){return a()})}},zv=e.unstable_scheduleCallback,Uv=e.unstable_NormalPriority,Jt={$$typeof:F,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function zc(){return{controller:new Lv,data:new Map,refCount:0}}function Pa(n){n.refCount--,n.refCount===0&&zv(Uv,function(){n.controller.abort()})}var qa=null,Uc=0,Ms=0,Ds=null;function Bv(n,i){if(qa===null){var a=qa=[];Uc=0,Ms=Hf(),Ds={status:"pending",value:void 0,then:function(o){a.push(o)}}}return Uc++,i.then(Wm,Wm),i}function Wm(){if(--Uc===0&&qa!==null){Ds!==null&&(Ds.status="fulfilled");var n=qa;qa=null,Ms=0,Ds=null;for(var i=0;i<n.length;i++)(0,n[i])()}}function Pv(n,i){var a=[],o={status:"pending",value:null,reason:null,then:function(h){a.push(h)}};return n.then(function(){o.status="fulfilled",o.value=i;for(var h=0;h<a.length;h++)(0,a[h])(i)},function(h){for(o.status="rejected",o.reason=h,h=0;h<a.length;h++)(0,a[h])(void 0)}),o}var ep=H.S;H.S=function(n,i){Ug=ht(),typeof i=="object"&&i!==null&&typeof i.then=="function"&&Bv(n,i),ep!==null&&ep(n,i)};var rs=L(null);function Bc(){var n=rs.current;return n!==null?n:At.pooledCache}function po(n,i){i===null?A(rs,rs.current):A(rs,i.pool)}function tp(){var n=Bc();return n===null?null:{parent:Jt._currentValue,pool:n}}var Ls=Error(s(460)),Pc=Error(s(474)),go=Error(s(542)),yo={then:function(){}};function np(n){return n=n.status,n==="fulfilled"||n==="rejected"}function rp(n,i,a){switch(a=n[a],a===void 0?n.push(i):a!==i&&(i.then(Lr,Lr),i=a),i.status){case"fulfilled":return i.value;case"rejected":throw n=i.reason,sp(n),n;default:if(typeof i.status=="string")i.then(Lr,Lr);else{if(n=At,n!==null&&100<n.shellSuspendCounter)throw Error(s(482));n=i,n.status="pending",n.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 n=i.reason,sp(n),n}throw ss=i,Ls}}function is(n){try{var i=n._init;return i(n._payload)}catch(a){throw a!==null&&typeof a=="object"&&typeof a.then=="function"?(ss=a,Ls):a}}var ss=null;function ip(){if(ss===null)throw Error(s(459));var n=ss;return ss=null,n}function sp(n){if(n===Ls||n===go)throw Error(s(483))}var zs=null,Ha=0;function bo(n){var i=Ha;return Ha+=1,zs===null&&(zs=[]),rp(zs,n,i)}function Ia(n,i){i=i.props.ref,n.ref=i!==void 0?i:null}function xo(n,i){throw i.$$typeof===x?Error(s(525)):(n=Object.prototype.toString.call(i),Error(s(31,n==="[object Object]"?"object with keys {"+Object.keys(i).join(", ")+"}":n)))}function ap(n){function i(Z,G){if(n){var ne=Z.deletions;ne===null?(Z.deletions=[G],Z.flags|=16):ne.push(G)}}function a(Z,G){if(!n)return null;for(;G!==null;)i(Z,G),G=G.sibling;return null}function o(Z){for(var G=new Map;Z!==null;)Z.key!==null?G.set(Z.key,Z):G.set(Z.index,Z),Z=Z.sibling;return G}function h(Z,G){return Z=Ur(Z,G),Z.index=0,Z.sibling=null,Z}function p(Z,G,ne){return Z.index=ne,n?(ne=Z.alternate,ne!==null?(ne=ne.index,ne<G?(Z.flags|=67108866,G):ne):(Z.flags|=67108866,G)):(Z.flags|=1048576,G)}function v(Z){return n&&Z.alternate===null&&(Z.flags|=67108866),Z}function S(Z,G,ne,he){return G===null||G.tag!==6?(G=Ac(ne,Z.mode,he),G.return=Z,G):(G=h(G,ne),G.return=Z,G)}function I(Z,G,ne,he){var ze=ne.type;return ze===R?ce(Z,G,ne.props.children,he,ne.key):G!==null&&(G.elementType===ze||typeof ze=="object"&&ze!==null&&ze.$$typeof===V&&is(ze)===G.type)?(G=h(G,ne.props),Ia(G,ne),G.return=Z,G):(G=co(ne.type,ne.key,ne.props,null,Z.mode,he),Ia(G,ne),G.return=Z,G)}function re(Z,G,ne,he){return G===null||G.tag!==4||G.stateNode.containerInfo!==ne.containerInfo||G.stateNode.implementation!==ne.implementation?(G=Tc(ne,Z.mode,he),G.return=Z,G):(G=h(G,ne.children||[]),G.return=Z,G)}function ce(Z,G,ne,he,ze){return G===null||G.tag!==7?(G=Wi(ne,Z.mode,he,ze),G.return=Z,G):(G=h(G,ne),G.return=Z,G)}function ge(Z,G,ne){if(typeof G=="string"&&G!==""||typeof G=="number"||typeof G=="bigint")return G=Ac(""+G,Z.mode,ne),G.return=Z,G;if(typeof G=="object"&&G!==null){switch(G.$$typeof){case w:return ne=co(G.type,G.key,G.props,null,Z.mode,ne),Ia(ne,G),ne.return=Z,ne;case E:return G=Tc(G,Z.mode,ne),G.return=Z,G;case V:return G=is(G),ge(Z,G,ne)}if($(G)||J(G))return G=Wi(G,Z.mode,ne,null),G.return=Z,G;if(typeof G.then=="function")return ge(Z,bo(G),ne);if(G.$$typeof===F)return ge(Z,mo(Z,G),ne);xo(Z,G)}return null}function ie(Z,G,ne,he){var ze=G!==null?G.key:null;if(typeof ne=="string"&&ne!==""||typeof ne=="number"||typeof ne=="bigint")return ze!==null?null:S(Z,G,""+ne,he);if(typeof ne=="object"&&ne!==null){switch(ne.$$typeof){case w:return ne.key===ze?I(Z,G,ne,he):null;case E:return ne.key===ze?re(Z,G,ne,he):null;case V:return ne=is(ne),ie(Z,G,ne,he)}if($(ne)||J(ne))return ze!==null?null:ce(Z,G,ne,he,null);if(typeof ne.then=="function")return ie(Z,G,bo(ne),he);if(ne.$$typeof===F)return ie(Z,G,mo(Z,ne),he);xo(Z,ne)}return null}function ae(Z,G,ne,he,ze){if(typeof he=="string"&&he!==""||typeof he=="number"||typeof he=="bigint")return Z=Z.get(ne)||null,S(G,Z,""+he,ze);if(typeof he=="object"&&he!==null){switch(he.$$typeof){case w:return Z=Z.get(he.key===null?ne:he.key)||null,I(G,Z,he,ze);case E:return Z=Z.get(he.key===null?ne:he.key)||null,re(G,Z,he,ze);case V:return he=is(he),ae(Z,G,ne,he,ze)}if($(he)||J(he))return Z=Z.get(ne)||null,ce(G,Z,he,ze,null);if(typeof he.then=="function")return ae(Z,G,ne,bo(he),ze);if(he.$$typeof===F)return ae(Z,G,ne,mo(G,he),ze);xo(G,he)}return null}function Me(Z,G,ne,he){for(var ze=null,dt=null,De=G,Xe=G=0,st=null;De!==null&&Xe<ne.length;Xe++){De.index>Xe?(st=De,De=null):st=De.sibling;var mt=ie(Z,De,ne[Xe],he);if(mt===null){De===null&&(De=st);break}n&&De&&mt.alternate===null&&i(Z,De),G=p(mt,G,Xe),dt===null?ze=mt:dt.sibling=mt,dt=mt,De=st}if(Xe===ne.length)return a(Z,De),at&&Br(Z,Xe),ze;if(De===null){for(;Xe<ne.length;Xe++)De=ge(Z,ne[Xe],he),De!==null&&(G=p(De,G,Xe),dt===null?ze=De:dt.sibling=De,dt=De);return at&&Br(Z,Xe),ze}for(De=o(De);Xe<ne.length;Xe++)st=ae(De,Z,Xe,ne[Xe],he),st!==null&&(n&&st.alternate!==null&&De.delete(st.key===null?Xe:st.key),G=p(st,G,Xe),dt===null?ze=st:dt.sibling=st,dt=st);return n&&De.forEach(function(Oi){return i(Z,Oi)}),at&&Br(Z,Xe),ze}function Pe(Z,G,ne,he){if(ne==null)throw Error(s(151));for(var ze=null,dt=null,De=G,Xe=G=0,st=null,mt=ne.next();De!==null&&!mt.done;Xe++,mt=ne.next()){De.index>Xe?(st=De,De=null):st=De.sibling;var Oi=ie(Z,De,mt.value,he);if(Oi===null){De===null&&(De=st);break}n&&De&&Oi.alternate===null&&i(Z,De),G=p(Oi,G,Xe),dt===null?ze=Oi:dt.sibling=Oi,dt=Oi,De=st}if(mt.done)return a(Z,De),at&&Br(Z,Xe),ze;if(De===null){for(;!mt.done;Xe++,mt=ne.next())mt=ge(Z,mt.value,he),mt!==null&&(G=p(mt,G,Xe),dt===null?ze=mt:dt.sibling=mt,dt=mt);return at&&Br(Z,Xe),ze}for(De=o(De);!mt.done;Xe++,mt=ne.next())mt=ae(De,Z,Xe,mt.value,he),mt!==null&&(n&&mt.alternate!==null&&De.delete(mt.key===null?Xe:mt.key),G=p(mt,G,Xe),dt===null?ze=mt:dt.sibling=mt,dt=mt);return n&&De.forEach(function(Kw){return i(Z,Kw)}),at&&Br(Z,Xe),ze}function _t(Z,G,ne,he){if(typeof ne=="object"&&ne!==null&&ne.type===R&&ne.key===null&&(ne=ne.props.children),typeof ne=="object"&&ne!==null){switch(ne.$$typeof){case w:e:{for(var ze=ne.key;G!==null;){if(G.key===ze){if(ze=ne.type,ze===R){if(G.tag===7){a(Z,G.sibling),he=h(G,ne.props.children),he.return=Z,Z=he;break e}}else if(G.elementType===ze||typeof ze=="object"&&ze!==null&&ze.$$typeof===V&&is(ze)===G.type){a(Z,G.sibling),he=h(G,ne.props),Ia(he,ne),he.return=Z,Z=he;break e}a(Z,G);break}else i(Z,G);G=G.sibling}ne.type===R?(he=Wi(ne.props.children,Z.mode,he,ne.key),he.return=Z,Z=he):(he=co(ne.type,ne.key,ne.props,null,Z.mode,he),Ia(he,ne),he.return=Z,Z=he)}return v(Z);case E:e:{for(ze=ne.key;G!==null;){if(G.key===ze)if(G.tag===4&&G.stateNode.containerInfo===ne.containerInfo&&G.stateNode.implementation===ne.implementation){a(Z,G.sibling),he=h(G,ne.children||[]),he.return=Z,Z=he;break e}else{a(Z,G);break}else i(Z,G);G=G.sibling}he=Tc(ne,Z.mode,he),he.return=Z,Z=he}return v(Z);case V:return ne=is(ne),_t(Z,G,ne,he)}if($(ne))return Me(Z,G,ne,he);if(J(ne)){if(ze=J(ne),typeof ze!="function")throw Error(s(150));return ne=ze.call(ne),Pe(Z,G,ne,he)}if(typeof ne.then=="function")return _t(Z,G,bo(ne),he);if(ne.$$typeof===F)return _t(Z,G,mo(Z,ne),he);xo(Z,ne)}return typeof ne=="string"&&ne!==""||typeof ne=="number"||typeof ne=="bigint"?(ne=""+ne,G!==null&&G.tag===6?(a(Z,G.sibling),he=h(G,ne),he.return=Z,Z=he):(a(Z,G),he=Ac(ne,Z.mode,he),he.return=Z,Z=he),v(Z)):a(Z,G)}return function(Z,G,ne,he){try{Ha=0;var ze=_t(Z,G,ne,he);return zs=null,ze}catch(De){if(De===Ls||De===go)throw De;var dt=Dn(29,De,null,Z.mode);return dt.lanes=he,dt.return=Z,dt}finally{}}}var as=ap(!0),lp=ap(!1),mi=!1;function qc(n){n.updateQueue={baseState:n.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Hc(n,i){n=n.updateQueue,i.updateQueue===n&&(i.updateQueue={baseState:n.baseState,firstBaseUpdate:n.firstBaseUpdate,lastBaseUpdate:n.lastBaseUpdate,shared:n.shared,callbacks:null})}function pi(n){return{lane:n,tag:0,payload:null,callback:null,next:null}}function gi(n,i,a){var o=n.updateQueue;if(o===null)return null;if(o=o.shared,(pt&2)!==0){var h=o.pending;return h===null?i.next=i:(i.next=h.next,h.next=i),o.pending=i,i=uo(n),$m(n,null,a),i}return oo(n,o,i,a),uo(n)}function Fa(n,i,a){if(i=i.updateQueue,i!==null&&(i=i.shared,(a&4194048)!==0)){var o=i.lanes;o&=n.pendingLanes,a|=o,i.lanes=a,Gi(n,a)}}function Ic(n,i){var a=n.updateQueue,o=n.alternate;if(o!==null&&(o=o.updateQueue,a===o)){var h=null,p=null;if(a=a.firstBaseUpdate,a!==null){do{var v={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};p===null?h=p=v:p=p.next=v,a=a.next}while(a!==null);p===null?h=p=i:p=p.next=i}else h=p=i;a={baseState:o.baseState,firstBaseUpdate:h,lastBaseUpdate:p,shared:o.shared,callbacks:o.callbacks},n.updateQueue=a;return}n=a.lastBaseUpdate,n===null?a.firstBaseUpdate=i:n.next=i,a.lastBaseUpdate=i}var Fc=!1;function $a(){if(Fc){var n=Ds;if(n!==null)throw n}}function Ya(n,i,a,o){Fc=!1;var h=n.updateQueue;mi=!1;var p=h.firstBaseUpdate,v=h.lastBaseUpdate,S=h.shared.pending;if(S!==null){h.shared.pending=null;var I=S,re=I.next;I.next=null,v===null?p=re:v.next=re,v=I;var ce=n.alternate;ce!==null&&(ce=ce.updateQueue,S=ce.lastBaseUpdate,S!==v&&(S===null?ce.firstBaseUpdate=re:S.next=re,ce.lastBaseUpdate=I))}if(p!==null){var ge=h.baseState;v=0,ce=re=I=null,S=p;do{var ie=S.lane&-536870913,ae=ie!==S.lane;if(ae?(it&ie)===ie:(o&ie)===ie){ie!==0&&ie===Ms&&(Fc=!0),ce!==null&&(ce=ce.next={lane:0,tag:S.tag,payload:S.payload,callback:null,next:null});e:{var Me=n,Pe=S;ie=i;var _t=a;switch(Pe.tag){case 1:if(Me=Pe.payload,typeof Me=="function"){ge=Me.call(_t,ge,ie);break e}ge=Me;break e;case 3:Me.flags=Me.flags&-65537|128;case 0:if(Me=Pe.payload,ie=typeof Me=="function"?Me.call(_t,ge,ie):Me,ie==null)break e;ge=g({},ge,ie);break e;case 2:mi=!0}}ie=S.callback,ie!==null&&(n.flags|=64,ae&&(n.flags|=8192),ae=h.callbacks,ae===null?h.callbacks=[ie]:ae.push(ie))}else ae={lane:ie,tag:S.tag,payload:S.payload,callback:S.callback,next:null},ce===null?(re=ce=ae,I=ge):ce=ce.next=ae,v|=ie;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);ce===null&&(I=ge),h.baseState=I,h.firstBaseUpdate=re,h.lastBaseUpdate=ce,p===null&&(h.shared.lanes=0),wi|=v,n.lanes=v,n.memoizedState=ge}}function op(n,i){if(typeof n!="function")throw Error(s(191,n));n.call(i)}function up(n,i){var a=n.callbacks;if(a!==null)for(n.callbacks=null,n=0;n<a.length;n++)op(a[n],i)}var Us=L(null),vo=L(0);function cp(n,i){n=Xr,A(vo,n),A(Us,i),Xr=n|i.baseLanes}function $c(){A(vo,Xr),A(Us,Us.current)}function Yc(){Xr=vo.current,Q(Us),Q(vo)}var Ln=L(null),nr=null;function yi(n){var i=n.alternate;A(Yt,Yt.current&1),A(Ln,n),nr===null&&(i===null||Us.current!==null||i.memoizedState!==null)&&(nr=n)}function Gc(n){A(Yt,Yt.current),A(Ln,n),nr===null&&(nr=n)}function fp(n){n.tag===22?(A(Yt,Yt.current),A(Ln,n),nr===null&&(nr=n)):bi()}function bi(){A(Yt,Yt.current),A(Ln,Ln.current)}function zn(n){Q(Ln),nr===n&&(nr=null),Q(Yt)}var Yt=L(0);function wo(n){for(var i=n;i!==null;){if(i.tag===13){var a=i.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||Wf(a)||eh(a)))return i}else if(i.tag===19&&(i.memoizedProps.revealOrder==="forwards"||i.memoizedProps.revealOrder==="backwards"||i.memoizedProps.revealOrder==="unstable_legacy-backwards"||i.memoizedProps.revealOrder==="together")){if((i.flags&128)!==0)return i}else if(i.child!==null){i.child.return=i,i=i.child;continue}if(i===n)break;for(;i.sibling===null;){if(i.return===null||i.return===n)return null;i=i.return}i.sibling.return=i.return,i=i.sibling}return null}var Hr=0,Ge=null,wt=null,Xt=null,So=!1,Bs=!1,ls=!1,_o=0,Ga=0,Ps=null,qv=0;function Ft(){throw Error(s(321))}function Vc(n,i){if(i===null)return!1;for(var a=0;a<i.length&&a<n.length;a++)if(!Mn(n[a],i[a]))return!1;return!0}function Jc(n,i,a,o,h,p){return Hr=p,Ge=i,i.memoizedState=null,i.updateQueue=null,i.lanes=0,H.H=n===null||n.memoizedState===null?Jp:cf,ls=!1,p=a(o,h),ls=!1,Bs&&(p=dp(i,a,o,h)),hp(n),p}function hp(n){H.H=Xa;var i=wt!==null&&wt.next!==null;if(Hr=0,Xt=wt=Ge=null,So=!1,Ga=0,Ps=null,i)throw Error(s(300));n===null||Kt||(n=n.dependencies,n!==null&&ho(n)&&(Kt=!0))}function dp(n,i,a,o){Ge=n;var h=0;do{if(Bs&&(Ps=null),Ga=0,Bs=!1,25<=h)throw Error(s(301));if(h+=1,Xt=wt=null,n.updateQueue!=null){var p=n.updateQueue;p.lastEffect=null,p.events=null,p.stores=null,p.memoCache!=null&&(p.memoCache.index=0)}H.H=Xp,p=i(a,o)}while(Bs);return p}function Hv(){var n=H.H,i=n.useState()[0];return i=typeof i.then=="function"?Va(i):i,n=n.useState()[0],(wt!==null?wt.memoizedState:null)!==n&&(Ge.flags|=1024),i}function Xc(){var n=_o!==0;return _o=0,n}function Kc(n,i,a){i.updateQueue=n.updateQueue,i.flags&=-2053,n.lanes&=~a}function Qc(n){if(So){for(n=n.memoizedState;n!==null;){var i=n.queue;i!==null&&(i.pending=null),n=n.next}So=!1}Hr=0,Xt=wt=Ge=null,Bs=!1,Ga=_o=0,Ps=null}function yn(){var n={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Xt===null?Ge.memoizedState=Xt=n:Xt=Xt.next=n,Xt}function Gt(){if(wt===null){var n=Ge.alternate;n=n!==null?n.memoizedState:null}else n=wt.next;var i=Xt===null?Ge.memoizedState:Xt.next;if(i!==null)Xt=i,wt=n;else{if(n===null)throw Ge.alternate===null?Error(s(467)):Error(s(310));wt=n,n={memoizedState:wt.memoizedState,baseState:wt.baseState,baseQueue:wt.baseQueue,queue:wt.queue,next:null},Xt===null?Ge.memoizedState=Xt=n:Xt=Xt.next=n}return Xt}function ko(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Va(n){var i=Ga;return Ga+=1,Ps===null&&(Ps=[]),n=rp(Ps,n,i),i=Ge,(Xt===null?i.memoizedState:Xt.next)===null&&(i=i.alternate,H.H=i===null||i.memoizedState===null?Jp:cf),n}function Eo(n){if(n!==null&&typeof n=="object"){if(typeof n.then=="function")return Va(n);if(n.$$typeof===F)return on(n)}throw Error(s(438,String(n)))}function Zc(n){var i=null,a=Ge.updateQueue;if(a!==null&&(i=a.memoCache),i==null){var o=Ge.alternate;o!==null&&(o=o.updateQueue,o!==null&&(o=o.memoCache,o!=null&&(i={data:o.data.map(function(h){return h.slice()}),index:0})))}if(i==null&&(i={data:[],index:0}),a===null&&(a=ko(),Ge.updateQueue=a),a.memoCache=i,a=i.data[i.index],a===void 0)for(a=i.data[i.index]=Array(n),o=0;o<n;o++)a[o]=O;return i.index++,a}function Ir(n,i){return typeof i=="function"?i(n):i}function Co(n){var i=Gt();return Wc(i,wt,n)}function Wc(n,i,a){var o=n.queue;if(o===null)throw Error(s(311));o.lastRenderedReducer=a;var h=n.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=n.baseState,h===null)n.memoizedState=p;else{i=h.next;var S=v=null,I=null,re=i,ce=!1;do{var ge=re.lane&-536870913;if(ge!==re.lane?(it&ge)===ge:(Hr&ge)===ge){var ie=re.revertLane;if(ie===0)I!==null&&(I=I.next={lane:0,revertLane:0,gesture:null,action:re.action,hasEagerState:re.hasEagerState,eagerState:re.eagerState,next:null}),ge===Ms&&(ce=!0);else if((Hr&ie)===ie){re=re.next,ie===Ms&&(ce=!0);continue}else ge={lane:0,revertLane:re.revertLane,gesture:null,action:re.action,hasEagerState:re.hasEagerState,eagerState:re.eagerState,next:null},I===null?(S=I=ge,v=p):I=I.next=ge,Ge.lanes|=ie,wi|=ie;ge=re.action,ls&&a(p,ge),p=re.hasEagerState?re.eagerState:a(p,ge)}else ie={lane:ge,revertLane:re.revertLane,gesture:re.gesture,action:re.action,hasEagerState:re.hasEagerState,eagerState:re.eagerState,next:null},I===null?(S=I=ie,v=p):I=I.next=ie,Ge.lanes|=ge,wi|=ge;re=re.next}while(re!==null&&re!==i);if(I===null?v=p:I.next=S,!Mn(p,n.memoizedState)&&(Kt=!0,ce&&(a=Ds,a!==null)))throw a;n.memoizedState=p,n.baseState=v,n.baseQueue=I,o.lastRenderedState=p}return h===null&&(o.lanes=0),[n.memoizedState,o.dispatch]}function ef(n){var i=Gt(),a=i.queue;if(a===null)throw Error(s(311));a.lastRenderedReducer=n;var o=a.dispatch,h=a.pending,p=i.memoizedState;if(h!==null){a.pending=null;var v=h=h.next;do p=n(p,v.action),v=v.next;while(v!==h);Mn(p,i.memoizedState)||(Kt=!0),i.memoizedState=p,i.baseQueue===null&&(i.baseState=p),a.lastRenderedState=p}return[p,o]}function mp(n,i,a){var o=Ge,h=Gt(),p=at;if(p){if(a===void 0)throw Error(s(407));a=a()}else a=i();var v=!Mn((wt||h).memoizedState,a);if(v&&(h.memoizedState=a,Kt=!0),h=h.queue,rf(yp.bind(null,o,h,n),[n]),h.getSnapshot!==i||v||Xt!==null&&Xt.memoizedState.tag&1){if(o.flags|=2048,qs(9,{destroy:void 0},gp.bind(null,o,h,a,i),null),At===null)throw Error(s(349));p||(Hr&127)!==0||pp(o,i,a)}return a}function pp(n,i,a){n.flags|=16384,n={getSnapshot:i,value:a},i=Ge.updateQueue,i===null?(i=ko(),Ge.updateQueue=i,i.stores=[n]):(a=i.stores,a===null?i.stores=[n]:a.push(n))}function gp(n,i,a,o){i.value=a,i.getSnapshot=o,bp(i)&&xp(n)}function yp(n,i,a){return a(function(){bp(i)&&xp(n)})}function bp(n){var i=n.getSnapshot;n=n.value;try{var a=i();return!Mn(n,a)}catch{return!0}}function xp(n){var i=Zi(n,2);i!==null&&jn(i,n,2)}function tf(n){var i=yn();if(typeof n=="function"){var a=n;if(n=a(),ls){Ht(!0);try{a()}finally{Ht(!1)}}}return i.memoizedState=i.baseState=n,i.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ir,lastRenderedState:n},i}function vp(n,i,a,o){return n.baseState=a,Wc(n,wt,typeof o=="function"?o:Ir)}function Iv(n,i,a,o,h){if(jo(n))throw Error(s(485));if(n=i.action,n!==null){var p={payload:h,action:n,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(v){p.listeners.push(v)}};H.T!==null?a(!0):p.isTransition=!1,o(p),a=i.pending,a===null?(p.next=i.pending=p,wp(i,p)):(p.next=a.next,i.pending=a.next=p)}}function wp(n,i){var a=i.action,o=i.payload,h=n.state;if(i.isTransition){var p=H.T,v={};H.T=v;try{var S=a(h,o),I=H.S;I!==null&&I(v,S),Sp(n,i,S)}catch(re){nf(n,i,re)}finally{p!==null&&v.types!==null&&(p.types=v.types),H.T=p}}else try{p=a(h,o),Sp(n,i,p)}catch(re){nf(n,i,re)}}function Sp(n,i,a){a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(function(o){_p(n,i,o)},function(o){return nf(n,i,o)}):_p(n,i,a)}function _p(n,i,a){i.status="fulfilled",i.value=a,kp(i),n.state=a,i=n.pending,i!==null&&(a=i.next,a===i?n.pending=null:(a=a.next,i.next=a,wp(n,a)))}function nf(n,i,a){var o=n.pending;if(n.pending=null,o!==null){o=o.next;do i.status="rejected",i.reason=a,kp(i),i=i.next;while(i!==o)}n.action=null}function kp(n){n=n.listeners;for(var i=0;i<n.length;i++)(0,n[i])()}function Ep(n,i){return i}function Cp(n,i){if(at){var a=At.formState;if(a!==null){e:{var o=Ge;if(at){if(Mt){t:{for(var h=Mt,p=tr;h.nodeType!==8;){if(!p){h=null;break t}if(h=rr(h.nextSibling),h===null){h=null;break t}}p=h.data,h=p==="F!"||p==="F"?h:null}if(h){Mt=rr(h.nextSibling),o=h.data==="F!";break e}}hi(o)}o=!1}o&&(i=a[0])}}return a=yn(),a.memoizedState=a.baseState=i,o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ep,lastRenderedState:i},a.queue=o,a=Yp.bind(null,Ge,o),o.dispatch=a,o=tf(!1),p=uf.bind(null,Ge,!1,o.queue),o=yn(),h={state:i,dispatch:null,action:n,pending:null},o.queue=h,a=Iv.bind(null,Ge,h,p,a),h.dispatch=a,o.memoizedState=n,[i,a,!1]}function Ap(n){var i=Gt();return Tp(i,wt,n)}function Tp(n,i,a){if(i=Wc(n,i,Ep)[0],n=Co(Ir)[0],typeof i=="object"&&i!==null&&typeof i.then=="function")try{var o=Va(i)}catch(v){throw v===Ls?go:v}else o=i;i=Gt();var h=i.queue,p=h.dispatch;return a!==i.memoizedState&&(Ge.flags|=2048,qs(9,{destroy:void 0},Fv.bind(null,h,a),null)),[o,p,n]}function Fv(n,i){n.action=i}function jp(n){var i=Gt(),a=wt;if(a!==null)return Tp(i,a,n);Gt(),i=i.memoizedState,a=Gt();var o=a.queue.dispatch;return a.memoizedState=n,[i,o,!1]}function qs(n,i,a,o){return n={tag:n,create:a,deps:o,inst:i,next:null},i=Ge.updateQueue,i===null&&(i=ko(),Ge.updateQueue=i),a=i.lastEffect,a===null?i.lastEffect=n.next=n:(o=a.next,a.next=n,n.next=o,i.lastEffect=n),n}function Np(){return Gt().memoizedState}function Ao(n,i,a,o){var h=yn();Ge.flags|=n,h.memoizedState=qs(1|i,{destroy:void 0},a,o===void 0?null:o)}function To(n,i,a,o){var h=Gt();o=o===void 0?null:o;var p=h.memoizedState.inst;wt!==null&&o!==null&&Vc(o,wt.memoizedState.deps)?h.memoizedState=qs(i,p,a,o):(Ge.flags|=n,h.memoizedState=qs(1|i,p,a,o))}function Op(n,i){Ao(8390656,8,n,i)}function rf(n,i){To(2048,8,n,i)}function $v(n){Ge.flags|=4;var i=Ge.updateQueue;if(i===null)i=ko(),Ge.updateQueue=i,i.events=[n];else{var a=i.events;a===null?i.events=[n]:a.push(n)}}function Rp(n){var i=Gt().memoizedState;return $v({ref:i,nextImpl:n}),function(){if((pt&2)!==0)throw Error(s(440));return i.impl.apply(void 0,arguments)}}function Mp(n,i){return To(4,2,n,i)}function Dp(n,i){return To(4,4,n,i)}function Lp(n,i){if(typeof i=="function"){n=n();var a=i(n);return function(){typeof a=="function"?a():i(null)}}if(i!=null)return n=n(),i.current=n,function(){i.current=null}}function zp(n,i,a){a=a!=null?a.concat([n]):null,To(4,4,Lp.bind(null,i,n),a)}function sf(){}function Up(n,i){var a=Gt();i=i===void 0?null:i;var o=a.memoizedState;return i!==null&&Vc(i,o[1])?o[0]:(a.memoizedState=[n,i],n)}function Bp(n,i){var a=Gt();i=i===void 0?null:i;var o=a.memoizedState;if(i!==null&&Vc(i,o[1]))return o[0];if(o=n(),ls){Ht(!0);try{n()}finally{Ht(!1)}}return a.memoizedState=[o,i],o}function af(n,i,a){return a===void 0||(Hr&1073741824)!==0&&(it&261930)===0?n.memoizedState=i:(n.memoizedState=a,n=Pg(),Ge.lanes|=n,wi|=n,a)}function Pp(n,i,a,o){return Mn(a,i)?a:Us.current!==null?(n=af(n,a,o),Mn(n,i)||(Kt=!0),n):(Hr&42)===0||(Hr&1073741824)!==0&&(it&261930)===0?(Kt=!0,n.memoizedState=a):(n=Pg(),Ge.lanes|=n,wi|=n,i)}function qp(n,i,a,o,h){var p=ee.p;ee.p=p!==0&&8>p?p:8;var v=H.T,S={};H.T=S,uf(n,!1,i,a);try{var I=h(),re=H.S;if(re!==null&&re(S,I),I!==null&&typeof I=="object"&&typeof I.then=="function"){var ce=Pv(I,o);Ja(n,i,ce,Pn(n))}else Ja(n,i,o,Pn(n))}catch(ge){Ja(n,i,{then:function(){},status:"rejected",reason:ge},Pn())}finally{ee.p=p,v!==null&&S.types!==null&&(v.types=S.types),H.T=v}}function Yv(){}function lf(n,i,a,o){if(n.tag!==5)throw Error(s(476));var h=Hp(n).queue;qp(n,h,i,oe,a===null?Yv:function(){return Ip(n),a(o)})}function Hp(n){var i=n.memoizedState;if(i!==null)return i;i={memoizedState:oe,baseState:oe,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ir,lastRenderedState:oe},next:null};var a={};return i.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ir,lastRenderedState:a},next:null},n.memoizedState=i,n=n.alternate,n!==null&&(n.memoizedState=i),i}function Ip(n){var i=Hp(n);i.next===null&&(i=n.alternate.memoizedState),Ja(n,i.next.queue,{},Pn())}function of(){return on(fl)}function Fp(){return Gt().memoizedState}function $p(){return Gt().memoizedState}function Gv(n){for(var i=n.return;i!==null;){switch(i.tag){case 24:case 3:var a=Pn();n=pi(a);var o=gi(i,n,a);o!==null&&(jn(o,i,a),Fa(o,i,a)),i={cache:zc()},n.payload=i;return}i=i.return}}function Vv(n,i,a){var o=Pn();a={lane:o,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},jo(n)?Gp(i,a):(a=Ec(n,i,a,o),a!==null&&(jn(a,n,o),Vp(a,i,o)))}function Yp(n,i,a){var o=Pn();Ja(n,i,a,o)}function Ja(n,i,a,o){var h={lane:o,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(jo(n))Gp(i,h);else{var p=n.alternate;if(n.lanes===0&&(p===null||p.lanes===0)&&(p=i.lastRenderedReducer,p!==null))try{var v=i.lastRenderedState,S=p(v,a);if(h.hasEagerState=!0,h.eagerState=S,Mn(S,v))return oo(n,i,h,0),At===null&&lo(),!1}catch{}finally{}if(a=Ec(n,i,h,o),a!==null)return jn(a,n,o),Vp(a,i,o),!0}return!1}function uf(n,i,a,o){if(o={lane:2,revertLane:Hf(),gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null},jo(n)){if(i)throw Error(s(479))}else i=Ec(n,a,o,2),i!==null&&jn(i,n,2)}function jo(n){var i=n.alternate;return n===Ge||i!==null&&i===Ge}function Gp(n,i){Bs=So=!0;var a=n.pending;a===null?i.next=i:(i.next=a.next,a.next=i),n.pending=i}function Vp(n,i,a){if((a&4194048)!==0){var o=i.lanes;o&=n.pendingLanes,a|=o,i.lanes=a,Gi(n,a)}}var Xa={readContext:on,use:Eo,useCallback:Ft,useContext:Ft,useEffect:Ft,useImperativeHandle:Ft,useLayoutEffect:Ft,useInsertionEffect:Ft,useMemo:Ft,useReducer:Ft,useRef:Ft,useState:Ft,useDebugValue:Ft,useDeferredValue:Ft,useTransition:Ft,useSyncExternalStore:Ft,useId:Ft,useHostTransitionStatus:Ft,useFormState:Ft,useActionState:Ft,useOptimistic:Ft,useMemoCache:Ft,useCacheRefresh:Ft};Xa.useEffectEvent=Ft;var Jp={readContext:on,use:Eo,useCallback:function(n,i){return yn().memoizedState=[n,i===void 0?null:i],n},useContext:on,useEffect:Op,useImperativeHandle:function(n,i,a){a=a!=null?a.concat([n]):null,Ao(4194308,4,Lp.bind(null,i,n),a)},useLayoutEffect:function(n,i){return Ao(4194308,4,n,i)},useInsertionEffect:function(n,i){Ao(4,2,n,i)},useMemo:function(n,i){var a=yn();i=i===void 0?null:i;var o=n();if(ls){Ht(!0);try{n()}finally{Ht(!1)}}return a.memoizedState=[o,i],o},useReducer:function(n,i,a){var o=yn();if(a!==void 0){var h=a(i);if(ls){Ht(!0);try{a(i)}finally{Ht(!1)}}}else h=i;return o.memoizedState=o.baseState=h,n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:n,lastRenderedState:h},o.queue=n,n=n.dispatch=Vv.bind(null,Ge,n),[o.memoizedState,n]},useRef:function(n){var i=yn();return n={current:n},i.memoizedState=n},useState:function(n){n=tf(n);var i=n.queue,a=Yp.bind(null,Ge,i);return i.dispatch=a,[n.memoizedState,a]},useDebugValue:sf,useDeferredValue:function(n,i){var a=yn();return af(a,n,i)},useTransition:function(){var n=tf(!1);return n=qp.bind(null,Ge,n.queue,!0,!1),yn().memoizedState=n,[!1,n]},useSyncExternalStore:function(n,i,a){var o=Ge,h=yn();if(at){if(a===void 0)throw Error(s(407));a=a()}else{if(a=i(),At===null)throw Error(s(349));(it&127)!==0||pp(o,i,a)}h.memoizedState=a;var p={value:a,getSnapshot:i};return h.queue=p,Op(yp.bind(null,o,p,n),[n]),o.flags|=2048,qs(9,{destroy:void 0},gp.bind(null,o,p,a,i),null),a},useId:function(){var n=yn(),i=At.identifierPrefix;if(at){var a=kr,o=_r;a=(o&~(1<<32-de(o)-1)).toString(32)+a,i="_"+i+"R_"+a,a=_o++,0<a&&(i+="H"+a.toString(32)),i+="_"}else a=qv++,i="_"+i+"r_"+a.toString(32)+"_";return n.memoizedState=i},useHostTransitionStatus:of,useFormState:Cp,useActionState:Cp,useOptimistic:function(n){var i=yn();i.memoizedState=i.baseState=n;var a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return i.queue=a,i=uf.bind(null,Ge,!0,a),a.dispatch=i,[n,i]},useMemoCache:Zc,useCacheRefresh:function(){return yn().memoizedState=Gv.bind(null,Ge)},useEffectEvent:function(n){var i=yn(),a={impl:n};return i.memoizedState=a,function(){if((pt&2)!==0)throw Error(s(440));return a.impl.apply(void 0,arguments)}}},cf={readContext:on,use:Eo,useCallback:Up,useContext:on,useEffect:rf,useImperativeHandle:zp,useInsertionEffect:Mp,useLayoutEffect:Dp,useMemo:Bp,useReducer:Co,useRef:Np,useState:function(){return Co(Ir)},useDebugValue:sf,useDeferredValue:function(n,i){var a=Gt();return Pp(a,wt.memoizedState,n,i)},useTransition:function(){var n=Co(Ir)[0],i=Gt().memoizedState;return[typeof n=="boolean"?n:Va(n),i]},useSyncExternalStore:mp,useId:Fp,useHostTransitionStatus:of,useFormState:Ap,useActionState:Ap,useOptimistic:function(n,i){var a=Gt();return vp(a,wt,n,i)},useMemoCache:Zc,useCacheRefresh:$p};cf.useEffectEvent=Rp;var Xp={readContext:on,use:Eo,useCallback:Up,useContext:on,useEffect:rf,useImperativeHandle:zp,useInsertionEffect:Mp,useLayoutEffect:Dp,useMemo:Bp,useReducer:ef,useRef:Np,useState:function(){return ef(Ir)},useDebugValue:sf,useDeferredValue:function(n,i){var a=Gt();return wt===null?af(a,n,i):Pp(a,wt.memoizedState,n,i)},useTransition:function(){var n=ef(Ir)[0],i=Gt().memoizedState;return[typeof n=="boolean"?n:Va(n),i]},useSyncExternalStore:mp,useId:Fp,useHostTransitionStatus:of,useFormState:jp,useActionState:jp,useOptimistic:function(n,i){var a=Gt();return wt!==null?vp(a,wt,n,i):(a.baseState=n,[n,a.queue.dispatch])},useMemoCache:Zc,useCacheRefresh:$p};Xp.useEffectEvent=Rp;function ff(n,i,a,o){i=n.memoizedState,a=a(o,i),a=a==null?i:g({},i,a),n.memoizedState=a,n.lanes===0&&(n.updateQueue.baseState=a)}var hf={enqueueSetState:function(n,i,a){n=n._reactInternals;var o=Pn(),h=pi(o);h.payload=i,a!=null&&(h.callback=a),i=gi(n,h,o),i!==null&&(jn(i,n,o),Fa(i,n,o))},enqueueReplaceState:function(n,i,a){n=n._reactInternals;var o=Pn(),h=pi(o);h.tag=1,h.payload=i,a!=null&&(h.callback=a),i=gi(n,h,o),i!==null&&(jn(i,n,o),Fa(i,n,o))},enqueueForceUpdate:function(n,i){n=n._reactInternals;var a=Pn(),o=pi(a);o.tag=2,i!=null&&(o.callback=i),i=gi(n,o,a),i!==null&&(jn(i,n,a),Fa(i,n,a))}};function Kp(n,i,a,o,h,p,v){return n=n.stateNode,typeof n.shouldComponentUpdate=="function"?n.shouldComponentUpdate(o,p,v):i.prototype&&i.prototype.isPureReactComponent?!La(a,o)||!La(h,p):!0}function Qp(n,i,a,o){n=i.state,typeof i.componentWillReceiveProps=="function"&&i.componentWillReceiveProps(a,o),typeof i.UNSAFE_componentWillReceiveProps=="function"&&i.UNSAFE_componentWillReceiveProps(a,o),i.state!==n&&hf.enqueueReplaceState(i,i.state,null)}function os(n,i){var a=i;if("ref"in i){a={};for(var o in i)o!=="ref"&&(a[o]=i[o])}if(n=n.defaultProps){a===i&&(a=g({},a));for(var h in n)a[h]===void 0&&(a[h]=n[h])}return a}function Zp(n){ao(n)}function Wp(n){console.error(n)}function eg(n){ao(n)}function No(n,i){try{var a=n.onUncaughtError;a(i.value,{componentStack:i.stack})}catch(o){setTimeout(function(){throw o})}}function tg(n,i,a){try{var o=n.onCaughtError;o(a.value,{componentStack:a.stack,errorBoundary:i.tag===1?i.stateNode:null})}catch(h){setTimeout(function(){throw h})}}function df(n,i,a){return a=pi(a),a.tag=3,a.payload={element:null},a.callback=function(){No(n,i)},a}function ng(n){return n=pi(n),n.tag=3,n}function rg(n,i,a,o){var h=a.type.getDerivedStateFromError;if(typeof h=="function"){var p=o.value;n.payload=function(){return h(p)},n.callback=function(){tg(i,a,o)}}var v=a.stateNode;v!==null&&typeof v.componentDidCatch=="function"&&(n.callback=function(){tg(i,a,o),typeof h!="function"&&(Si===null?Si=new Set([this]):Si.add(this));var S=o.stack;this.componentDidCatch(o.value,{componentStack:S!==null?S:""})})}function Jv(n,i,a,o,h){if(a.flags|=32768,o!==null&&typeof o=="object"&&typeof o.then=="function"){if(i=a.alternate,i!==null&&Rs(i,a,h,!0),a=Ln.current,a!==null){switch(a.tag){case 31:case 13:return nr===null?Io():a.alternate===null&&$t===0&&($t=3),a.flags&=-257,a.flags|=65536,a.lanes=h,o===yo?a.flags|=16384:(i=a.updateQueue,i===null?a.updateQueue=new Set([o]):i.add(o),Bf(n,o,h)),!1;case 22:return a.flags|=65536,o===yo?a.flags|=16384:(i=a.updateQueue,i===null?(i={transitions:null,markerInstances:null,retryQueue:new Set([o])},a.updateQueue=i):(a=i.retryQueue,a===null?i.retryQueue=new Set([o]):a.add(o)),Bf(n,o,h)),!1}throw Error(s(435,a.tag))}return Bf(n,o,h),Io(),!1}if(at)return i=Ln.current,i!==null?((i.flags&65536)===0&&(i.flags|=256),i.flags|=65536,i.lanes=h,o!==Oc&&(n=Error(s(422),{cause:o}),Ba(Zn(n,a)))):(o!==Oc&&(i=Error(s(423),{cause:o}),Ba(Zn(i,a))),n=n.current.alternate,n.flags|=65536,h&=-h,n.lanes|=h,o=Zn(o,a),h=df(n.stateNode,o,h),Ic(n,h),$t!==4&&($t=2)),!1;var p=Error(s(520),{cause:o});if(p=Zn(p,a),rl===null?rl=[p]:rl.push(p),$t!==4&&($t=2),i===null)return!0;o=Zn(o,a),a=i;do{switch(a.tag){case 3:return a.flags|=65536,n=h&-h,a.lanes|=n,n=df(a.stateNode,o,n),Ic(a,n),!1;case 1:if(i=a.type,p=a.stateNode,(a.flags&128)===0&&(typeof i.getDerivedStateFromError=="function"||p!==null&&typeof p.componentDidCatch=="function"&&(Si===null||!Si.has(p))))return a.flags|=65536,h&=-h,a.lanes|=h,h=ng(h),rg(h,n,a,o),Ic(a,h),!1}a=a.return}while(a!==null);return!1}var mf=Error(s(461)),Kt=!1;function un(n,i,a,o){i.child=n===null?lp(i,null,a,o):as(i,n.child,a,o)}function ig(n,i,a,o,h){a=a.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 ns(i),o=Jc(n,i,a,v,p,h),S=Xc(),n!==null&&!Kt?(Kc(n,i,h),Fr(n,i,h)):(at&&S&&jc(i),i.flags|=1,un(n,i,o,h),i.child)}function sg(n,i,a,o,h){if(n===null){var p=a.type;return typeof p=="function"&&!Cc(p)&&p.defaultProps===void 0&&a.compare===null?(i.tag=15,i.type=p,ag(n,i,p,o,h)):(n=co(a.type,null,o,i,i.mode,h),n.ref=i.ref,n.return=i,i.child=n)}if(p=n.child,!Sf(n,h)){var v=p.memoizedProps;if(a=a.compare,a=a!==null?a:La,a(v,o)&&n.ref===i.ref)return Fr(n,i,h)}return i.flags|=1,n=Ur(p,o),n.ref=i.ref,n.return=i,i.child=n}function ag(n,i,a,o,h){if(n!==null){var p=n.memoizedProps;if(La(p,o)&&n.ref===i.ref)if(Kt=!1,i.pendingProps=o=p,Sf(n,h))(n.flags&131072)!==0&&(Kt=!0);else return i.lanes=n.lanes,Fr(n,i,h)}return pf(n,i,a,o,h)}function lg(n,i,a,o){var h=o.children,p=n!==null?n.memoizedState:null;if(n===null&&i.stateNode===null&&(i.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),o.mode==="hidden"){if((i.flags&128)!==0){if(p=p!==null?p.baseLanes|a:a,n!==null){for(o=i.child=n.child,h=0;o!==null;)h=h|o.lanes|o.childLanes,o=o.sibling;o=h&~p}else o=0,i.child=null;return og(n,i,p,a,o)}if((a&536870912)!==0)i.memoizedState={baseLanes:0,cachePool:null},n!==null&&po(i,p!==null?p.cachePool:null),p!==null?cp(i,p):$c(),fp(i);else return o=i.lanes=536870912,og(n,i,p!==null?p.baseLanes|a:a,a,o)}else p!==null?(po(i,p.cachePool),cp(i,p),bi(),i.memoizedState=null):(n!==null&&po(i,null),$c(),bi());return un(n,i,h,a),i.child}function Ka(n,i){return n!==null&&n.tag===22||i.stateNode!==null||(i.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),i.sibling}function og(n,i,a,o,h){var p=Bc();return p=p===null?null:{parent:Jt._currentValue,pool:p},i.memoizedState={baseLanes:a,cachePool:p},n!==null&&po(i,null),$c(),fp(i),n!==null&&Rs(n,i,o,!0),i.childLanes=h,null}function Oo(n,i){return i=Mo({mode:i.mode,children:i.children},n.mode),i.ref=n.ref,n.child=i,i.return=n,i}function ug(n,i,a){return as(i,n.child,null,a),n=Oo(i,i.pendingProps),n.flags|=2,zn(i),i.memoizedState=null,n}function Xv(n,i,a){var o=i.pendingProps,h=(i.flags&128)!==0;if(i.flags&=-129,n===null){if(at){if(o.mode==="hidden")return n=Oo(i,o),i.lanes=536870912,Ka(null,n);if(Gc(i),(n=Mt)?(n=wy(n,tr),n=n!==null&&n.data==="&"?n:null,n!==null&&(i.memoizedState={dehydrated:n,treeContext:ci!==null?{id:_r,overflow:kr}:null,retryLane:536870912,hydrationErrors:null},a=Gm(n),a.return=i,i.child=a,ln=i,Mt=null)):n=null,n===null)throw hi(i);return i.lanes=536870912,null}return Oo(i,o)}var p=n.memoizedState;if(p!==null){var v=p.dehydrated;if(Gc(i),h)if(i.flags&256)i.flags&=-257,i=ug(n,i,a);else if(i.memoizedState!==null)i.child=n.child,i.flags|=128,i=null;else throw Error(s(558));else if(Kt||Rs(n,i,a,!1),h=(a&n.childLanes)!==0,Kt||h){if(o=At,o!==null&&(v=oi(o,a),v!==0&&v!==p.retryLane))throw p.retryLane=v,Zi(n,v),jn(o,n,v),mf;Io(),i=ug(n,i,a)}else n=p.treeContext,Mt=rr(v.nextSibling),ln=i,at=!0,fi=null,tr=!1,n!==null&&Xm(i,n),i=Oo(i,o),i.flags|=4096;return i}return n=Ur(n.child,{mode:o.mode,children:o.children}),n.ref=i.ref,i.child=n,n.return=i,n}function Ro(n,i){var a=i.ref;if(a===null)n!==null&&n.ref!==null&&(i.flags|=4194816);else{if(typeof a!="function"&&typeof a!="object")throw Error(s(284));(n===null||n.ref!==a)&&(i.flags|=4194816)}}function pf(n,i,a,o,h){return ns(i),a=Jc(n,i,a,o,void 0,h),o=Xc(),n!==null&&!Kt?(Kc(n,i,h),Fr(n,i,h)):(at&&o&&jc(i),i.flags|=1,un(n,i,a,h),i.child)}function cg(n,i,a,o,h,p){return ns(i),i.updateQueue=null,a=dp(i,o,a,h),hp(n),o=Xc(),n!==null&&!Kt?(Kc(n,i,p),Fr(n,i,p)):(at&&o&&jc(i),i.flags|=1,un(n,i,a,p),i.child)}function fg(n,i,a,o,h){if(ns(i),i.stateNode===null){var p=Ts,v=a.contextType;typeof v=="object"&&v!==null&&(p=on(v)),p=new a(o,p),i.memoizedState=p.state!==null&&p.state!==void 0?p.state:null,p.updater=hf,i.stateNode=p,p._reactInternals=i,p=i.stateNode,p.props=o,p.state=i.memoizedState,p.refs={},qc(i),v=a.contextType,p.context=typeof v=="object"&&v!==null?on(v):Ts,p.state=i.memoizedState,v=a.getDerivedStateFromProps,typeof v=="function"&&(ff(i,a,v,o),p.state=i.memoizedState),typeof a.getDerivedStateFromProps=="function"||typeof p.getSnapshotBeforeUpdate=="function"||typeof p.UNSAFE_componentWillMount!="function"&&typeof p.componentWillMount!="function"||(v=p.state,typeof p.componentWillMount=="function"&&p.componentWillMount(),typeof p.UNSAFE_componentWillMount=="function"&&p.UNSAFE_componentWillMount(),v!==p.state&&hf.enqueueReplaceState(p,p.state,null),Ya(i,o,p,h),$a(),p.state=i.memoizedState),typeof p.componentDidMount=="function"&&(i.flags|=4194308),o=!0}else if(n===null){p=i.stateNode;var S=i.memoizedProps,I=os(a,S);p.props=I;var re=p.context,ce=a.contextType;v=Ts,typeof ce=="object"&&ce!==null&&(v=on(ce));var ge=a.getDerivedStateFromProps;ce=typeof ge=="function"||typeof p.getSnapshotBeforeUpdate=="function",S=i.pendingProps!==S,ce||typeof p.UNSAFE_componentWillReceiveProps!="function"&&typeof p.componentWillReceiveProps!="function"||(S||re!==v)&&Qp(i,p,o,v),mi=!1;var ie=i.memoizedState;p.state=ie,Ya(i,o,p,h),$a(),re=i.memoizedState,S||ie!==re||mi?(typeof ge=="function"&&(ff(i,a,ge,o),re=i.memoizedState),(I=mi||Kp(i,a,I,o,ie,re,v))?(ce||typeof p.UNSAFE_componentWillMount!="function"&&typeof p.componentWillMount!="function"||(typeof p.componentWillMount=="function"&&p.componentWillMount(),typeof p.UNSAFE_componentWillMount=="function"&&p.UNSAFE_componentWillMount()),typeof p.componentDidMount=="function"&&(i.flags|=4194308)):(typeof p.componentDidMount=="function"&&(i.flags|=4194308),i.memoizedProps=o,i.memoizedState=re),p.props=o,p.state=re,p.context=v,o=I):(typeof p.componentDidMount=="function"&&(i.flags|=4194308),o=!1)}else{p=i.stateNode,Hc(n,i),v=i.memoizedProps,ce=os(a,v),p.props=ce,ge=i.pendingProps,ie=p.context,re=a.contextType,I=Ts,typeof re=="object"&&re!==null&&(I=on(re)),S=a.getDerivedStateFromProps,(re=typeof S=="function"||typeof p.getSnapshotBeforeUpdate=="function")||typeof p.UNSAFE_componentWillReceiveProps!="function"&&typeof p.componentWillReceiveProps!="function"||(v!==ge||ie!==I)&&Qp(i,p,o,I),mi=!1,ie=i.memoizedState,p.state=ie,Ya(i,o,p,h),$a();var ae=i.memoizedState;v!==ge||ie!==ae||mi||n!==null&&n.dependencies!==null&&ho(n.dependencies)?(typeof S=="function"&&(ff(i,a,S,o),ae=i.memoizedState),(ce=mi||Kp(i,a,ce,o,ie,ae,I)||n!==null&&n.dependencies!==null&&ho(n.dependencies))?(re||typeof p.UNSAFE_componentWillUpdate!="function"&&typeof p.componentWillUpdate!="function"||(typeof p.componentWillUpdate=="function"&&p.componentWillUpdate(o,ae,I),typeof p.UNSAFE_componentWillUpdate=="function"&&p.UNSAFE_componentWillUpdate(o,ae,I)),typeof p.componentDidUpdate=="function"&&(i.flags|=4),typeof p.getSnapshotBeforeUpdate=="function"&&(i.flags|=1024)):(typeof p.componentDidUpdate!="function"||v===n.memoizedProps&&ie===n.memoizedState||(i.flags|=4),typeof p.getSnapshotBeforeUpdate!="function"||v===n.memoizedProps&&ie===n.memoizedState||(i.flags|=1024),i.memoizedProps=o,i.memoizedState=ae),p.props=o,p.state=ae,p.context=I,o=ce):(typeof p.componentDidUpdate!="function"||v===n.memoizedProps&&ie===n.memoizedState||(i.flags|=4),typeof p.getSnapshotBeforeUpdate!="function"||v===n.memoizedProps&&ie===n.memoizedState||(i.flags|=1024),o=!1)}return p=o,Ro(n,i),o=(i.flags&128)!==0,p||o?(p=i.stateNode,a=o&&typeof a.getDerivedStateFromError!="function"?null:p.render(),i.flags|=1,n!==null&&o?(i.child=as(i,n.child,null,h),i.child=as(i,null,a,h)):un(n,i,a,h),i.memoizedState=p.state,n=i.child):n=Fr(n,i,h),n}function hg(n,i,a,o){return es(),i.flags|=256,un(n,i,a,o),i.child}var gf={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function yf(n){return{baseLanes:n,cachePool:tp()}}function bf(n,i,a){return n=n!==null?n.childLanes&~a:0,i&&(n|=Bn),n}function dg(n,i,a){var o=i.pendingProps,h=!1,p=(i.flags&128)!==0,v;if((v=p)||(v=n!==null&&n.memoizedState===null?!1:(Yt.current&2)!==0),v&&(h=!0,i.flags&=-129),v=(i.flags&32)!==0,i.flags&=-33,n===null){if(at){if(h?yi(i):bi(),(n=Mt)?(n=wy(n,tr),n=n!==null&&n.data!=="&"?n:null,n!==null&&(i.memoizedState={dehydrated:n,treeContext:ci!==null?{id:_r,overflow:kr}:null,retryLane:536870912,hydrationErrors:null},a=Gm(n),a.return=i,i.child=a,ln=i,Mt=null)):n=null,n===null)throw hi(i);return eh(n)?i.lanes=32:i.lanes=536870912,null}var S=o.children;return o=o.fallback,h?(bi(),h=i.mode,S=Mo({mode:"hidden",children:S},h),o=Wi(o,h,a,null),S.return=i,o.return=i,S.sibling=o,i.child=S,o=i.child,o.memoizedState=yf(a),o.childLanes=bf(n,v,a),i.memoizedState=gf,Ka(null,o)):(yi(i),xf(i,S))}var I=n.memoizedState;if(I!==null&&(S=I.dehydrated,S!==null)){if(p)i.flags&256?(yi(i),i.flags&=-257,i=vf(n,i,a)):i.memoizedState!==null?(bi(),i.child=n.child,i.flags|=128,i=null):(bi(),S=o.fallback,h=i.mode,o=Mo({mode:"visible",children:o.children},h),S=Wi(S,h,a,null),S.flags|=2,o.return=i,S.return=i,o.sibling=S,i.child=o,as(i,n.child,null,a),o=i.child,o.memoizedState=yf(a),o.childLanes=bf(n,v,a),i.memoizedState=gf,i=Ka(null,o));else if(yi(i),eh(S)){if(v=S.nextSibling&&S.nextSibling.dataset,v)var re=v.dgst;v=re,o=Error(s(419)),o.stack="",o.digest=v,Ba({value:o,source:null,stack:null}),i=vf(n,i,a)}else if(Kt||Rs(n,i,a,!1),v=(a&n.childLanes)!==0,Kt||v){if(v=At,v!==null&&(o=oi(v,a),o!==0&&o!==I.retryLane))throw I.retryLane=o,Zi(n,o),jn(v,n,o),mf;Wf(S)||Io(),i=vf(n,i,a)}else Wf(S)?(i.flags|=192,i.child=n.child,i=null):(n=I.treeContext,Mt=rr(S.nextSibling),ln=i,at=!0,fi=null,tr=!1,n!==null&&Xm(i,n),i=xf(i,o.children),i.flags|=4096);return i}return h?(bi(),S=o.fallback,h=i.mode,I=n.child,re=I.sibling,o=Ur(I,{mode:"hidden",children:o.children}),o.subtreeFlags=I.subtreeFlags&65011712,re!==null?S=Ur(re,S):(S=Wi(S,h,a,null),S.flags|=2),S.return=i,o.return=i,o.sibling=S,i.child=o,Ka(null,o),o=i.child,S=n.child.memoizedState,S===null?S=yf(a):(h=S.cachePool,h!==null?(I=Jt._currentValue,h=h.parent!==I?{parent:I,pool:I}:h):h=tp(),S={baseLanes:S.baseLanes|a,cachePool:h}),o.memoizedState=S,o.childLanes=bf(n,v,a),i.memoizedState=gf,Ka(n.child,o)):(yi(i),a=n.child,n=a.sibling,a=Ur(a,{mode:"visible",children:o.children}),a.return=i,a.sibling=null,n!==null&&(v=i.deletions,v===null?(i.deletions=[n],i.flags|=16):v.push(n)),i.child=a,i.memoizedState=null,a)}function xf(n,i){return i=Mo({mode:"visible",children:i},n.mode),i.return=n,n.child=i}function Mo(n,i){return n=Dn(22,n,null,i),n.lanes=0,n}function vf(n,i,a){return as(i,n.child,null,a),n=xf(i,i.pendingProps.children),n.flags|=2,i.memoizedState=null,n}function mg(n,i,a){n.lanes|=i;var o=n.alternate;o!==null&&(o.lanes|=i),Dc(n.return,i,a)}function wf(n,i,a,o,h,p){var v=n.memoizedState;v===null?n.memoizedState={isBackwards:i,rendering:null,renderingStartTime:0,last:o,tail:a,tailMode:h,treeForkCount:p}:(v.isBackwards=i,v.rendering=null,v.renderingStartTime=0,v.last=o,v.tail=a,v.tailMode=h,v.treeForkCount=p)}function pg(n,i,a){var o=i.pendingProps,h=o.revealOrder,p=o.tail;o=o.children;var v=Yt.current,S=(v&2)!==0;if(S?(v=v&1|2,i.flags|=128):v&=1,A(Yt,v),un(n,i,o,a),o=at?Ua:0,!S&&n!==null&&(n.flags&128)!==0)e:for(n=i.child;n!==null;){if(n.tag===13)n.memoizedState!==null&&mg(n,a,i);else if(n.tag===19)mg(n,a,i);else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===i)break e;for(;n.sibling===null;){if(n.return===null||n.return===i)break e;n=n.return}n.sibling.return=n.return,n=n.sibling}switch(h){case"forwards":for(a=i.child,h=null;a!==null;)n=a.alternate,n!==null&&wo(n)===null&&(h=a),a=a.sibling;a=h,a===null?(h=i.child,i.child=null):(h=a.sibling,a.sibling=null),wf(i,!1,h,a,p,o);break;case"backwards":case"unstable_legacy-backwards":for(a=null,h=i.child,i.child=null;h!==null;){if(n=h.alternate,n!==null&&wo(n)===null){i.child=h;break}n=h.sibling,h.sibling=a,a=h,h=n}wf(i,!0,a,null,p,o);break;case"together":wf(i,!1,null,null,void 0,o);break;default:i.memoizedState=null}return i.child}function Fr(n,i,a){if(n!==null&&(i.dependencies=n.dependencies),wi|=i.lanes,(a&i.childLanes)===0)if(n!==null){if(Rs(n,i,a,!1),(a&i.childLanes)===0)return null}else return null;if(n!==null&&i.child!==n.child)throw Error(s(153));if(i.child!==null){for(n=i.child,a=Ur(n,n.pendingProps),i.child=a,a.return=i;n.sibling!==null;)n=n.sibling,a=a.sibling=Ur(n,n.pendingProps),a.return=i;a.sibling=null}return i.child}function Sf(n,i){return(n.lanes&i)!==0?!0:(n=n.dependencies,!!(n!==null&&ho(n)))}function Kv(n,i,a){switch(i.tag){case 3:$e(i,i.stateNode.containerInfo),di(i,Jt,n.memoizedState.cache),es();break;case 27:case 5:Ne(i);break;case 4:$e(i,i.stateNode.containerInfo);break;case 10:di(i,i.type,i.memoizedProps.value);break;case 31:if(i.memoizedState!==null)return i.flags|=128,Gc(i),null;break;case 13:var o=i.memoizedState;if(o!==null)return o.dehydrated!==null?(yi(i),i.flags|=128,null):(a&i.child.childLanes)!==0?dg(n,i,a):(yi(i),n=Fr(n,i,a),n!==null?n.sibling:null);yi(i);break;case 19:var h=(n.flags&128)!==0;if(o=(a&i.childLanes)!==0,o||(Rs(n,i,a,!1),o=(a&i.childLanes)!==0),h){if(o)return pg(n,i,a);i.flags|=128}if(h=i.memoizedState,h!==null&&(h.rendering=null,h.tail=null,h.lastEffect=null),A(Yt,Yt.current),o)break;return null;case 22:return i.lanes=0,lg(n,i,a,i.pendingProps);case 24:di(i,Jt,n.memoizedState.cache)}return Fr(n,i,a)}function gg(n,i,a){if(n!==null)if(n.memoizedProps!==i.pendingProps)Kt=!0;else{if(!Sf(n,a)&&(i.flags&128)===0)return Kt=!1,Kv(n,i,a);Kt=(n.flags&131072)!==0}else Kt=!1,at&&(i.flags&1048576)!==0&&Jm(i,Ua,i.index);switch(i.lanes=0,i.tag){case 16:e:{var o=i.pendingProps;if(n=is(i.elementType),i.type=n,typeof n=="function")Cc(n)?(o=os(n,o),i.tag=1,i=fg(null,i,n,o,a)):(i.tag=0,i=pf(null,i,n,o,a));else{if(n!=null){var h=n.$$typeof;if(h===ue){i.tag=11,i=ig(null,i,n,o,a);break e}else if(h===K){i.tag=14,i=sg(null,i,n,o,a);break e}}throw i=te(n)||n,Error(s(306,i,""))}}return i;case 0:return pf(n,i,i.type,i.pendingProps,a);case 1:return o=i.type,h=os(o,i.pendingProps),fg(n,i,o,h,a);case 3:e:{if($e(i,i.stateNode.containerInfo),n===null)throw Error(s(387));o=i.pendingProps;var p=i.memoizedState;h=p.element,Hc(n,i),Ya(i,o,null,a);var v=i.memoizedState;if(o=v.cache,di(i,Jt,o),o!==p.cache&&Lc(i,[Jt],a,!0),$a(),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=hg(n,i,o,a);break e}else if(o!==h){h=Zn(Error(s(424)),i),Ba(h),i=hg(n,i,o,a);break e}else{switch(n=i.stateNode.containerInfo,n.nodeType){case 9:n=n.body;break;default:n=n.nodeName==="HTML"?n.ownerDocument.body:n}for(Mt=rr(n.firstChild),ln=i,at=!0,fi=null,tr=!0,a=lp(i,null,o,a),i.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling}else{if(es(),o===h){i=Fr(n,i,a);break e}un(n,i,o,a)}i=i.child}return i;case 26:return Ro(n,i),n===null?(a=Ay(i.type,null,i.pendingProps,null))?i.memoizedState=a:at||(a=i.type,n=i.pendingProps,o=Xo(Te.current).createElement(a),o[Ct]=i,o[It]=n,cn(o,a,n),Y(o),i.stateNode=o):i.memoizedState=Ay(i.type,n.memoizedProps,i.pendingProps,n.memoizedState),null;case 27:return Ne(i),n===null&&at&&(o=i.stateNode=ky(i.type,i.pendingProps,Te.current),ln=i,tr=!0,h=Mt,Ci(i.type)?(th=h,Mt=rr(o.firstChild)):Mt=h),un(n,i,i.pendingProps.children,a),Ro(n,i),n===null&&(i.flags|=4194304),i.child;case 5:return n===null&&at&&((h=o=Mt)&&(o=Cw(o,i.type,i.pendingProps,tr),o!==null?(i.stateNode=o,ln=i,Mt=rr(o.firstChild),tr=!1,h=!0):h=!1),h||hi(i)),Ne(i),h=i.type,p=i.pendingProps,v=n!==null?n.memoizedProps:null,o=p.children,Kf(h,p)?o=null:v!==null&&Kf(h,v)&&(i.flags|=32),i.memoizedState!==null&&(h=Jc(n,i,Hv,null,null,a),fl._currentValue=h),Ro(n,i),un(n,i,o,a),i.child;case 6:return n===null&&at&&((n=a=Mt)&&(a=Aw(a,i.pendingProps,tr),a!==null?(i.stateNode=a,ln=i,Mt=null,n=!0):n=!1),n||hi(i)),null;case 13:return dg(n,i,a);case 4:return $e(i,i.stateNode.containerInfo),o=i.pendingProps,n===null?i.child=as(i,null,o,a):un(n,i,o,a),i.child;case 11:return ig(n,i,i.type,i.pendingProps,a);case 7:return un(n,i,i.pendingProps,a),i.child;case 8:return un(n,i,i.pendingProps.children,a),i.child;case 12:return un(n,i,i.pendingProps.children,a),i.child;case 10:return o=i.pendingProps,di(i,i.type,o.value),un(n,i,o.children,a),i.child;case 9:return h=i.type._context,o=i.pendingProps.children,ns(i),h=on(h),o=o(h),i.flags|=1,un(n,i,o,a),i.child;case 14:return sg(n,i,i.type,i.pendingProps,a);case 15:return ag(n,i,i.type,i.pendingProps,a);case 19:return pg(n,i,a);case 31:return Xv(n,i,a);case 22:return lg(n,i,a,i.pendingProps);case 24:return ns(i),o=on(Jt),n===null?(h=Bc(),h===null&&(h=At,p=zc(),h.pooledCache=p,p.refCount++,p!==null&&(h.pooledCacheLanes|=a),h=p),i.memoizedState={parent:o,cache:h},qc(i),di(i,Jt,h)):((n.lanes&a)!==0&&(Hc(n,i),Ya(i,null,null,a),$a()),h=n.memoizedState,p=i.memoizedState,h.parent!==o?(h={parent:o,cache:o},i.memoizedState=h,i.lanes===0&&(i.memoizedState=i.updateQueue.baseState=h),di(i,Jt,o)):(o=p.cache,di(i,Jt,o),o!==h.cache&&Lc(i,[Jt],a,!0))),un(n,i,i.pendingProps.children,a),i.child;case 29:throw i.pendingProps}throw Error(s(156,i.tag))}function $r(n){n.flags|=4}function _f(n,i,a,o,h){if((i=(n.mode&32)!==0)&&(i=!1),i){if(n.flags|=16777216,(h&335544128)===h)if(n.stateNode.complete)n.flags|=8192;else if(Fg())n.flags|=8192;else throw ss=yo,Pc}else n.flags&=-16777217}function yg(n,i){if(i.type!=="stylesheet"||(i.state.loading&4)!==0)n.flags&=-16777217;else if(n.flags|=16777216,!Ry(i))if(Fg())n.flags|=8192;else throw ss=yo,Pc}function Do(n,i){i!==null&&(n.flags|=4),n.flags&16384&&(i=n.tag!==22?bs():536870912,n.lanes|=i,$s|=i)}function Qa(n,i){if(!at)switch(n.tailMode){case"hidden":i=n.tail;for(var a=null;i!==null;)i.alternate!==null&&(a=i),i=i.sibling;a===null?n.tail=null:a.sibling=null;break;case"collapsed":a=n.tail;for(var o=null;a!==null;)a.alternate!==null&&(o=a),a=a.sibling;o===null?i||n.tail===null?n.tail=null:n.tail.sibling=null:o.sibling=null}}function Dt(n){var i=n.alternate!==null&&n.alternate.child===n.child,a=0,o=0;if(i)for(var h=n.child;h!==null;)a|=h.lanes|h.childLanes,o|=h.subtreeFlags&65011712,o|=h.flags&65011712,h.return=n,h=h.sibling;else for(h=n.child;h!==null;)a|=h.lanes|h.childLanes,o|=h.subtreeFlags,o|=h.flags,h.return=n,h=h.sibling;return n.subtreeFlags|=o,n.childLanes=a,i}function Qv(n,i,a){var o=i.pendingProps;switch(Nc(i),i.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Dt(i),null;case 1:return Dt(i),null;case 3:return a=i.stateNode,o=null,n!==null&&(o=n.memoizedState.cache),i.memoizedState.cache!==o&&(i.flags|=2048),qr(Jt),Ce(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(n===null||n.child===null)&&(Os(i)?$r(i):n===null||n.memoizedState.isDehydrated&&(i.flags&256)===0||(i.flags|=1024,Rc())),Dt(i),null;case 26:var h=i.type,p=i.memoizedState;return n===null?($r(i),p!==null?(Dt(i),yg(i,p)):(Dt(i),_f(i,h,null,o,a))):p?p!==n.memoizedState?($r(i),Dt(i),yg(i,p)):(Dt(i),i.flags&=-16777217):(n=n.memoizedProps,n!==o&&$r(i),Dt(i),_f(i,h,n,o,a)),null;case 27:if(je(i),a=Te.current,h=i.type,n!==null&&i.stateNode!=null)n.memoizedProps!==o&&$r(i);else{if(!o){if(i.stateNode===null)throw Error(s(166));return Dt(i),null}n=xe.current,Os(i)?Km(i):(n=ky(h,o,a),i.stateNode=n,$r(i))}return Dt(i),null;case 5:if(je(i),h=i.type,n!==null&&i.stateNode!=null)n.memoizedProps!==o&&$r(i);else{if(!o){if(i.stateNode===null)throw Error(s(166));return Dt(i),null}if(p=xe.current,Os(i))Km(i);else{var v=Xo(Te.current);switch(p){case 1:p=v.createElementNS("http://www.w3.org/2000/svg",h);break;case 2:p=v.createElementNS("http://www.w3.org/1998/Math/MathML",h);break;default:switch(h){case"svg":p=v.createElementNS("http://www.w3.org/2000/svg",h);break;case"math":p=v.createElementNS("http://www.w3.org/1998/Math/MathML",h);break;case"script":p=v.createElement("div"),p.innerHTML="<script><\/script>",p=p.removeChild(p.firstChild);break;case"select":p=typeof o.is=="string"?v.createElement("select",{is:o.is}):v.createElement("select"),o.multiple?p.multiple=!0:o.size&&(p.size=o.size);break;default:p=typeof o.is=="string"?v.createElement(h,{is:o.is}):v.createElement(h)}}p[Ct]=i,p[It]=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(cn(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&&$r(i)}}return Dt(i),_f(i,i.type,n===null?null:n.memoizedProps,i.pendingProps,a),null;case 6:if(n&&i.stateNode!=null)n.memoizedProps!==o&&$r(i);else{if(typeof o!="string"&&i.stateNode===null)throw Error(s(166));if(n=Te.current,Os(i)){if(n=i.stateNode,a=i.memoizedProps,o=null,h=ln,h!==null)switch(h.tag){case 27:case 5:o=h.memoizedProps}n[Ct]=i,n=!!(n.nodeValue===a||o!==null&&o.suppressHydrationWarning===!0||dy(n.nodeValue,a)),n||hi(i,!0)}else n=Xo(n).createTextNode(o),n[Ct]=i,i.stateNode=n}return Dt(i),null;case 31:if(a=i.memoizedState,n===null||n.memoizedState!==null){if(o=Os(i),a!==null){if(n===null){if(!o)throw Error(s(318));if(n=i.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(s(557));n[Ct]=i}else es(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;Dt(i),n=!1}else a=Rc(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=a),n=!0;if(!n)return i.flags&256?(zn(i),i):(zn(i),null);if((i.flags&128)!==0)throw Error(s(558))}return Dt(i),null;case 13:if(o=i.memoizedState,n===null||n.memoizedState!==null&&n.memoizedState.dehydrated!==null){if(h=Os(i),o!==null&&o.dehydrated!==null){if(n===null){if(!h)throw Error(s(318));if(h=i.memoizedState,h=h!==null?h.dehydrated:null,!h)throw Error(s(317));h[Ct]=i}else es(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;Dt(i),h=!1}else h=Rc(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=h),h=!0;if(!h)return i.flags&256?(zn(i),i):(zn(i),null)}return zn(i),(i.flags&128)!==0?(i.lanes=a,i):(a=o!==null,n=n!==null&&n.memoizedState!==null,a&&(o=i.child,h=null,o.alternate!==null&&o.alternate.memoizedState!==null&&o.alternate.memoizedState.cachePool!==null&&(h=o.alternate.memoizedState.cachePool.pool),p=null,o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(p=o.memoizedState.cachePool.pool),p!==h&&(o.flags|=2048)),a!==n&&a&&(i.child.flags|=8192),Do(i,i.updateQueue),Dt(i),null);case 4:return Ce(),n===null&&Yf(i.stateNode.containerInfo),Dt(i),null;case 10:return qr(i.type),Dt(i),null;case 19:if(Q(Yt),o=i.memoizedState,o===null)return Dt(i),null;if(h=(i.flags&128)!==0,p=o.rendering,p===null)if(h)Qa(o,!1);else{if($t!==0||n!==null&&(n.flags&128)!==0)for(n=i.child;n!==null;){if(p=wo(n),p!==null){for(i.flags|=128,Qa(o,!1),n=p.updateQueue,i.updateQueue=n,Do(i,n),i.subtreeFlags=0,n=a,a=i.child;a!==null;)Ym(a,n),a=a.sibling;return A(Yt,Yt.current&1|2),at&&Br(i,o.treeForkCount),i.child}n=n.sibling}o.tail!==null&&ht()>Po&&(i.flags|=128,h=!0,Qa(o,!1),i.lanes=4194304)}else{if(!h)if(n=wo(p),n!==null){if(i.flags|=128,h=!0,n=n.updateQueue,i.updateQueue=n,Do(i,n),Qa(o,!0),o.tail===null&&o.tailMode==="hidden"&&!p.alternate&&!at)return Dt(i),null}else 2*ht()-o.renderingStartTime>Po&&a!==536870912&&(i.flags|=128,h=!0,Qa(o,!1),i.lanes=4194304);o.isBackwards?(p.sibling=i.child,i.child=p):(n=o.last,n!==null?n.sibling=p:i.child=p,o.last=p)}return o.tail!==null?(n=o.tail,o.rendering=n,o.tail=n.sibling,o.renderingStartTime=ht(),n.sibling=null,a=Yt.current,A(Yt,h?a&1|2:a&1),at&&Br(i,o.treeForkCount),n):(Dt(i),null);case 22:case 23:return zn(i),Yc(),o=i.memoizedState!==null,n!==null?n.memoizedState!==null!==o&&(i.flags|=8192):o&&(i.flags|=8192),o?(a&536870912)!==0&&(i.flags&128)===0&&(Dt(i),i.subtreeFlags&6&&(i.flags|=8192)):Dt(i),a=i.updateQueue,a!==null&&Do(i,a.retryQueue),a=null,n!==null&&n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(a=n.memoizedState.cachePool.pool),o=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(o=i.memoizedState.cachePool.pool),o!==a&&(i.flags|=2048),n!==null&&Q(rs),null;case 24:return a=null,n!==null&&(a=n.memoizedState.cache),i.memoizedState.cache!==a&&(i.flags|=2048),qr(Jt),Dt(i),null;case 25:return null;case 30:return null}throw Error(s(156,i.tag))}function Zv(n,i){switch(Nc(i),i.tag){case 1:return n=i.flags,n&65536?(i.flags=n&-65537|128,i):null;case 3:return qr(Jt),Ce(),n=i.flags,(n&65536)!==0&&(n&128)===0?(i.flags=n&-65537|128,i):null;case 26:case 27:case 5:return je(i),null;case 31:if(i.memoizedState!==null){if(zn(i),i.alternate===null)throw Error(s(340));es()}return n=i.flags,n&65536?(i.flags=n&-65537|128,i):null;case 13:if(zn(i),n=i.memoizedState,n!==null&&n.dehydrated!==null){if(i.alternate===null)throw Error(s(340));es()}return n=i.flags,n&65536?(i.flags=n&-65537|128,i):null;case 19:return Q(Yt),null;case 4:return Ce(),null;case 10:return qr(i.type),null;case 22:case 23:return zn(i),Yc(),n!==null&&Q(rs),n=i.flags,n&65536?(i.flags=n&-65537|128,i):null;case 24:return qr(Jt),null;case 25:return null;default:return null}}function bg(n,i){switch(Nc(i),i.tag){case 3:qr(Jt),Ce();break;case 26:case 27:case 5:je(i);break;case 4:Ce();break;case 31:i.memoizedState!==null&&zn(i);break;case 13:zn(i);break;case 19:Q(Yt);break;case 10:qr(i.type);break;case 22:case 23:zn(i),Yc(),n!==null&&Q(rs);break;case 24:qr(Jt)}}function Za(n,i){try{var a=i.updateQueue,o=a!==null?a.lastEffect:null;if(o!==null){var h=o.next;a=h;do{if((a.tag&n)===n){o=void 0;var p=a.create,v=a.inst;o=p(),v.destroy=o}a=a.next}while(a!==h)}}catch(S){xt(i,i.return,S)}}function xi(n,i,a){try{var o=i.updateQueue,h=o!==null?o.lastEffect:null;if(h!==null){var p=h.next;o=p;do{if((o.tag&n)===n){var v=o.inst,S=v.destroy;if(S!==void 0){v.destroy=void 0,h=i;var I=a,re=S;try{re()}catch(ce){xt(h,I,ce)}}}o=o.next}while(o!==p)}}catch(ce){xt(i,i.return,ce)}}function xg(n){var i=n.updateQueue;if(i!==null){var a=n.stateNode;try{up(i,a)}catch(o){xt(n,n.return,o)}}}function vg(n,i,a){a.props=os(n.type,n.memoizedProps),a.state=n.memoizedState;try{a.componentWillUnmount()}catch(o){xt(n,i,o)}}function Wa(n,i){try{var a=n.ref;if(a!==null){switch(n.tag){case 26:case 27:case 5:var o=n.stateNode;break;case 30:o=n.stateNode;break;default:o=n.stateNode}typeof a=="function"?n.refCleanup=a(o):a.current=o}}catch(h){xt(n,i,h)}}function Er(n,i){var a=n.ref,o=n.refCleanup;if(a!==null)if(typeof o=="function")try{o()}catch(h){xt(n,i,h)}finally{n.refCleanup=null,n=n.alternate,n!=null&&(n.refCleanup=null)}else if(typeof a=="function")try{a(null)}catch(h){xt(n,i,h)}else a.current=null}function wg(n){var i=n.type,a=n.memoizedProps,o=n.stateNode;try{e:switch(i){case"button":case"input":case"select":case"textarea":a.autoFocus&&o.focus();break e;case"img":a.src?o.src=a.src:a.srcSet&&(o.srcset=a.srcSet)}}catch(h){xt(n,n.return,h)}}function kf(n,i,a){try{var o=n.stateNode;vw(o,n.type,a,i),o[It]=i}catch(h){xt(n,n.return,h)}}function Sg(n){return n.tag===5||n.tag===3||n.tag===26||n.tag===27&&Ci(n.type)||n.tag===4}function Ef(n){e:for(;;){for(;n.sibling===null;){if(n.return===null||Sg(n.return))return null;n=n.return}for(n.sibling.return=n.return,n=n.sibling;n.tag!==5&&n.tag!==6&&n.tag!==18;){if(n.tag===27&&Ci(n.type)||n.flags&2||n.child===null||n.tag===4)continue e;n.child.return=n,n=n.child}if(!(n.flags&2))return n.stateNode}}function Cf(n,i,a){var o=n.tag;if(o===5||o===6)n=n.stateNode,i?(a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a).insertBefore(n,i):(i=a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a,i.appendChild(n),a=a._reactRootContainer,a!=null||i.onclick!==null||(i.onclick=Lr));else if(o!==4&&(o===27&&Ci(n.type)&&(a=n.stateNode,i=null),n=n.child,n!==null))for(Cf(n,i,a),n=n.sibling;n!==null;)Cf(n,i,a),n=n.sibling}function Lo(n,i,a){var o=n.tag;if(o===5||o===6)n=n.stateNode,i?a.insertBefore(n,i):a.appendChild(n);else if(o!==4&&(o===27&&Ci(n.type)&&(a=n.stateNode),n=n.child,n!==null))for(Lo(n,i,a),n=n.sibling;n!==null;)Lo(n,i,a),n=n.sibling}function _g(n){var i=n.stateNode,a=n.memoizedProps;try{for(var o=n.type,h=i.attributes;h.length;)i.removeAttributeNode(h[0]);cn(i,o,a),i[Ct]=n,i[It]=a}catch(p){xt(n,n.return,p)}}var Yr=!1,Qt=!1,Af=!1,kg=typeof WeakSet=="function"?WeakSet:Set,rn=null;function Wv(n,i){if(n=n.containerInfo,Jf=nu,n=zm(n),xc(n)){if("selectionStart"in n)var a={start:n.selectionStart,end:n.selectionEnd};else e:{a=(a=n.ownerDocument)&&a.defaultView||window;var o=a.getSelection&&a.getSelection();if(o&&o.rangeCount!==0){a=o.anchorNode;var h=o.anchorOffset,p=o.focusNode;o=o.focusOffset;try{a.nodeType,p.nodeType}catch{a=null;break e}var v=0,S=-1,I=-1,re=0,ce=0,ge=n,ie=null;t:for(;;){for(var ae;ge!==a||h!==0&&ge.nodeType!==3||(S=v+h),ge!==p||o!==0&&ge.nodeType!==3||(I=v+o),ge.nodeType===3&&(v+=ge.nodeValue.length),(ae=ge.firstChild)!==null;)ie=ge,ge=ae;for(;;){if(ge===n)break t;if(ie===a&&++re===h&&(S=v),ie===p&&++ce===o&&(I=v),(ae=ge.nextSibling)!==null)break;ge=ie,ie=ge.parentNode}ge=ae}a=S===-1||I===-1?null:{start:S,end:I}}else a=null}a=a||{start:0,end:0}}else a=null;for(Xf={focusedElem:n,selectionRange:a},nu=!1,rn=i;rn!==null;)if(i=rn,n=i.child,(i.subtreeFlags&1028)!==0&&n!==null)n.return=i,rn=n;else for(;rn!==null;){switch(i=rn,p=i.alternate,n=i.flags,i.tag){case 0:if((n&4)!==0&&(n=i.updateQueue,n=n!==null?n.events:null,n!==null))for(a=0;a<n.length;a++)h=n[a],h.ref.impl=h.nextImpl;break;case 11:case 15:break;case 1:if((n&1024)!==0&&p!==null){n=void 0,a=i,h=p.memoizedProps,p=p.memoizedState,o=a.stateNode;try{var Me=os(a.type,h);n=o.getSnapshotBeforeUpdate(Me,p),o.__reactInternalSnapshotBeforeUpdate=n}catch(Pe){xt(a,a.return,Pe)}}break;case 3:if((n&1024)!==0){if(n=i.stateNode.containerInfo,a=n.nodeType,a===9)Zf(n);else if(a===1)switch(n.nodeName){case"HEAD":case"HTML":case"BODY":Zf(n);break;default:n.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((n&1024)!==0)throw Error(s(163))}if(n=i.sibling,n!==null){n.return=i.return,rn=n;break}rn=i.return}}function Eg(n,i,a){var o=a.flags;switch(a.tag){case 0:case 11:case 15:Vr(n,a),o&4&&Za(5,a);break;case 1:if(Vr(n,a),o&4)if(n=a.stateNode,i===null)try{n.componentDidMount()}catch(v){xt(a,a.return,v)}else{var h=os(a.type,i.memoizedProps);i=i.memoizedState;try{n.componentDidUpdate(h,i,n.__reactInternalSnapshotBeforeUpdate)}catch(v){xt(a,a.return,v)}}o&64&&xg(a),o&512&&Wa(a,a.return);break;case 3:if(Vr(n,a),o&64&&(n=a.updateQueue,n!==null)){if(i=null,a.child!==null)switch(a.child.tag){case 27:case 5:i=a.child.stateNode;break;case 1:i=a.child.stateNode}try{up(n,i)}catch(v){xt(a,a.return,v)}}break;case 27:i===null&&o&4&&_g(a);case 26:case 5:Vr(n,a),i===null&&o&4&&wg(a),o&512&&Wa(a,a.return);break;case 12:Vr(n,a);break;case 31:Vr(n,a),o&4&&Tg(n,a);break;case 13:Vr(n,a),o&4&&jg(n,a),o&64&&(n=a.memoizedState,n!==null&&(n=n.dehydrated,n!==null&&(a=ow.bind(null,a),Tw(n,a))));break;case 22:if(o=a.memoizedState!==null||Yr,!o){i=i!==null&&i.memoizedState!==null||Qt,h=Yr;var p=Qt;Yr=o,(Qt=i)&&!p?Jr(n,a,(a.subtreeFlags&8772)!==0):Vr(n,a),Yr=h,Qt=p}break;case 30:break;default:Vr(n,a)}}function Cg(n){var i=n.alternate;i!==null&&(n.alternate=null,Cg(i)),n.child=null,n.deletions=null,n.sibling=null,n.tag===5&&(i=n.stateNode,i!==null&&xs(i)),n.stateNode=null,n.return=null,n.dependencies=null,n.memoizedProps=null,n.memoizedState=null,n.pendingProps=null,n.stateNode=null,n.updateQueue=null}var Lt=null,En=!1;function Gr(n,i,a){for(a=a.child;a!==null;)Ag(n,i,a),a=a.sibling}function Ag(n,i,a){if(yt&&typeof yt.onCommitFiberUnmount=="function")try{yt.onCommitFiberUnmount(Wt,a)}catch{}switch(a.tag){case 26:Qt||Er(a,i),Gr(n,i,a),a.memoizedState?a.memoizedState.count--:a.stateNode&&(a=a.stateNode,a.parentNode.removeChild(a));break;case 27:Qt||Er(a,i);var o=Lt,h=En;Ci(a.type)&&(Lt=a.stateNode,En=!1),Gr(n,i,a),ol(a.stateNode),Lt=o,En=h;break;case 5:Qt||Er(a,i);case 6:if(o=Lt,h=En,Lt=null,Gr(n,i,a),Lt=o,En=h,Lt!==null)if(En)try{(Lt.nodeType===9?Lt.body:Lt.nodeName==="HTML"?Lt.ownerDocument.body:Lt).removeChild(a.stateNode)}catch(p){xt(a,i,p)}else try{Lt.removeChild(a.stateNode)}catch(p){xt(a,i,p)}break;case 18:Lt!==null&&(En?(n=Lt,xy(n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n,a.stateNode),Zs(n)):xy(Lt,a.stateNode));break;case 4:o=Lt,h=En,Lt=a.stateNode.containerInfo,En=!0,Gr(n,i,a),Lt=o,En=h;break;case 0:case 11:case 14:case 15:xi(2,a,i),Qt||xi(4,a,i),Gr(n,i,a);break;case 1:Qt||(Er(a,i),o=a.stateNode,typeof o.componentWillUnmount=="function"&&vg(a,i,o)),Gr(n,i,a);break;case 21:Gr(n,i,a);break;case 22:Qt=(o=Qt)||a.memoizedState!==null,Gr(n,i,a),Qt=o;break;default:Gr(n,i,a)}}function Tg(n,i){if(i.memoizedState===null&&(n=i.alternate,n!==null&&(n=n.memoizedState,n!==null))){n=n.dehydrated;try{Zs(n)}catch(a){xt(i,i.return,a)}}}function jg(n,i){if(i.memoizedState===null&&(n=i.alternate,n!==null&&(n=n.memoizedState,n!==null&&(n=n.dehydrated,n!==null))))try{Zs(n)}catch(a){xt(i,i.return,a)}}function ew(n){switch(n.tag){case 31:case 13:case 19:var i=n.stateNode;return i===null&&(i=n.stateNode=new kg),i;case 22:return n=n.stateNode,i=n._retryCache,i===null&&(i=n._retryCache=new kg),i;default:throw Error(s(435,n.tag))}}function zo(n,i){var a=ew(n);i.forEach(function(o){if(!a.has(o)){a.add(o);var h=uw.bind(null,n,o);o.then(h,h)}})}function Cn(n,i){var a=i.deletions;if(a!==null)for(var o=0;o<a.length;o++){var h=a[o],p=n,v=i,S=v;e:for(;S!==null;){switch(S.tag){case 27:if(Ci(S.type)){Lt=S.stateNode,En=!1;break e}break;case 5:Lt=S.stateNode,En=!1;break e;case 3:case 4:Lt=S.stateNode.containerInfo,En=!0;break e}S=S.return}if(Lt===null)throw Error(s(160));Ag(p,v,h),Lt=null,En=!1,p=h.alternate,p!==null&&(p.return=null),h.return=null}if(i.subtreeFlags&13886)for(i=i.child;i!==null;)Ng(i,n),i=i.sibling}var dr=null;function Ng(n,i){var a=n.alternate,o=n.flags;switch(n.tag){case 0:case 11:case 14:case 15:Cn(i,n),An(n),o&4&&(xi(3,n,n.return),Za(3,n),xi(5,n,n.return));break;case 1:Cn(i,n),An(n),o&512&&(Qt||a===null||Er(a,a.return)),o&64&&Yr&&(n=n.updateQueue,n!==null&&(o=n.callbacks,o!==null&&(a=n.shared.hiddenCallbacks,n.shared.hiddenCallbacks=a===null?o:a.concat(o))));break;case 26:var h=dr;if(Cn(i,n),An(n),o&512&&(Qt||a===null||Er(a,a.return)),o&4){var p=a!==null?a.memoizedState:null;if(o=n.memoizedState,a===null)if(o===null)if(n.stateNode===null){e:{o=n.type,a=n.memoizedProps,h=h.ownerDocument||h;t:switch(o){case"title":p=h.getElementsByTagName("title")[0],(!p||p[en]||p[Ct]||p.namespaceURI==="http://www.w3.org/2000/svg"||p.hasAttribute("itemprop"))&&(p=h.createElement(o),h.head.insertBefore(p,h.querySelector("head > title"))),cn(p,o,a),p[Ct]=n,Y(p),o=p;break e;case"link":var v=Ny("link","href",h).get(o+(a.href||""));if(v){for(var S=0;S<v.length;S++)if(p=v[S],p.getAttribute("href")===(a.href==null||a.href===""?null:a.href)&&p.getAttribute("rel")===(a.rel==null?null:a.rel)&&p.getAttribute("title")===(a.title==null?null:a.title)&&p.getAttribute("crossorigin")===(a.crossOrigin==null?null:a.crossOrigin)){v.splice(S,1);break t}}p=h.createElement(o),cn(p,o,a),h.head.appendChild(p);break;case"meta":if(v=Ny("meta","content",h).get(o+(a.content||""))){for(S=0;S<v.length;S++)if(p=v[S],p.getAttribute("content")===(a.content==null?null:""+a.content)&&p.getAttribute("name")===(a.name==null?null:a.name)&&p.getAttribute("property")===(a.property==null?null:a.property)&&p.getAttribute("http-equiv")===(a.httpEquiv==null?null:a.httpEquiv)&&p.getAttribute("charset")===(a.charSet==null?null:a.charSet)){v.splice(S,1);break t}}p=h.createElement(o),cn(p,o,a),h.head.appendChild(p);break;default:throw Error(s(468,o))}p[Ct]=n,Y(p),o=p}n.stateNode=o}else Oy(h,n.type,n.stateNode);else n.stateNode=jy(h,o,n.memoizedProps);else p!==o?(p===null?a.stateNode!==null&&(a=a.stateNode,a.parentNode.removeChild(a)):p.count--,o===null?Oy(h,n.type,n.stateNode):jy(h,o,n.memoizedProps)):o===null&&n.stateNode!==null&&kf(n,n.memoizedProps,a.memoizedProps)}break;case 27:Cn(i,n),An(n),o&512&&(Qt||a===null||Er(a,a.return)),a!==null&&o&4&&kf(n,n.memoizedProps,a.memoizedProps);break;case 5:if(Cn(i,n),An(n),o&512&&(Qt||a===null||Er(a,a.return)),n.flags&32){h=n.stateNode;try{ws(h,"")}catch(Me){xt(n,n.return,Me)}}o&4&&n.stateNode!=null&&(h=n.memoizedProps,kf(n,h,a!==null?a.memoizedProps:h)),o&1024&&(Af=!0);break;case 6:if(Cn(i,n),An(n),o&4){if(n.stateNode===null)throw Error(s(162));o=n.memoizedProps,a=n.stateNode;try{a.nodeValue=o}catch(Me){xt(n,n.return,Me)}}break;case 3:if(Zo=null,h=dr,dr=Ko(i.containerInfo),Cn(i,n),dr=h,An(n),o&4&&a!==null&&a.memoizedState.isDehydrated)try{Zs(i.containerInfo)}catch(Me){xt(n,n.return,Me)}Af&&(Af=!1,Og(n));break;case 4:o=dr,dr=Ko(n.stateNode.containerInfo),Cn(i,n),An(n),dr=o;break;case 12:Cn(i,n),An(n);break;case 31:Cn(i,n),An(n),o&4&&(o=n.updateQueue,o!==null&&(n.updateQueue=null,zo(n,o)));break;case 13:Cn(i,n),An(n),n.child.flags&8192&&n.memoizedState!==null!=(a!==null&&a.memoizedState!==null)&&(Bo=ht()),o&4&&(o=n.updateQueue,o!==null&&(n.updateQueue=null,zo(n,o)));break;case 22:h=n.memoizedState!==null;var I=a!==null&&a.memoizedState!==null,re=Yr,ce=Qt;if(Yr=re||h,Qt=ce||I,Cn(i,n),Qt=ce,Yr=re,An(n),o&8192)e:for(i=n.stateNode,i._visibility=h?i._visibility&-2:i._visibility|1,h&&(a===null||I||Yr||Qt||us(n)),a=null,i=n;;){if(i.tag===5||i.tag===26){if(a===null){I=a=i;try{if(p=I.stateNode,h)v=p.style,typeof v.setProperty=="function"?v.setProperty("display","none","important"):v.display="none";else{S=I.stateNode;var ge=I.memoizedProps.style,ie=ge!=null&&ge.hasOwnProperty("display")?ge.display:null;S.style.display=ie==null||typeof ie=="boolean"?"":(""+ie).trim()}}catch(Me){xt(I,I.return,Me)}}}else if(i.tag===6){if(a===null){I=i;try{I.stateNode.nodeValue=h?"":I.memoizedProps}catch(Me){xt(I,I.return,Me)}}}else if(i.tag===18){if(a===null){I=i;try{var ae=I.stateNode;h?vy(ae,!0):vy(I.stateNode,!1)}catch(Me){xt(I,I.return,Me)}}}else if((i.tag!==22&&i.tag!==23||i.memoizedState===null||i===n)&&i.child!==null){i.child.return=i,i=i.child;continue}if(i===n)break e;for(;i.sibling===null;){if(i.return===null||i.return===n)break e;a===i&&(a=null),i=i.return}a===i&&(a=null),i.sibling.return=i.return,i=i.sibling}o&4&&(o=n.updateQueue,o!==null&&(a=o.retryQueue,a!==null&&(o.retryQueue=null,zo(n,a))));break;case 19:Cn(i,n),An(n),o&4&&(o=n.updateQueue,o!==null&&(n.updateQueue=null,zo(n,o)));break;case 30:break;case 21:break;default:Cn(i,n),An(n)}}function An(n){var i=n.flags;if(i&2){try{for(var a,o=n.return;o!==null;){if(Sg(o)){a=o;break}o=o.return}if(a==null)throw Error(s(160));switch(a.tag){case 27:var h=a.stateNode,p=Ef(n);Lo(n,p,h);break;case 5:var v=a.stateNode;a.flags&32&&(ws(v,""),a.flags&=-33);var S=Ef(n);Lo(n,S,v);break;case 3:case 4:var I=a.stateNode.containerInfo,re=Ef(n);Cf(n,re,I);break;default:throw Error(s(161))}}catch(ce){xt(n,n.return,ce)}n.flags&=-3}i&4096&&(n.flags&=-4097)}function Og(n){if(n.subtreeFlags&1024)for(n=n.child;n!==null;){var i=n;Og(i),i.tag===5&&i.flags&1024&&i.stateNode.reset(),n=n.sibling}}function Vr(n,i){if(i.subtreeFlags&8772)for(i=i.child;i!==null;)Eg(n,i.alternate,i),i=i.sibling}function us(n){for(n=n.child;n!==null;){var i=n;switch(i.tag){case 0:case 11:case 14:case 15:xi(4,i,i.return),us(i);break;case 1:Er(i,i.return);var a=i.stateNode;typeof a.componentWillUnmount=="function"&&vg(i,i.return,a),us(i);break;case 27:ol(i.stateNode);case 26:case 5:Er(i,i.return),us(i);break;case 22:i.memoizedState===null&&us(i);break;case 30:us(i);break;default:us(i)}n=n.sibling}}function Jr(n,i,a){for(a=a&&(i.subtreeFlags&8772)!==0,i=i.child;i!==null;){var o=i.alternate,h=n,p=i,v=p.flags;switch(p.tag){case 0:case 11:case 15:Jr(h,p,a),Za(4,p);break;case 1:if(Jr(h,p,a),o=p,h=o.stateNode,typeof h.componentDidMount=="function")try{h.componentDidMount()}catch(re){xt(o,o.return,re)}if(o=p,h=o.updateQueue,h!==null){var S=o.stateNode;try{var I=h.shared.hiddenCallbacks;if(I!==null)for(h.shared.hiddenCallbacks=null,h=0;h<I.length;h++)op(I[h],S)}catch(re){xt(o,o.return,re)}}a&&v&64&&xg(p),Wa(p,p.return);break;case 27:_g(p);case 26:case 5:Jr(h,p,a),a&&o===null&&v&4&&wg(p),Wa(p,p.return);break;case 12:Jr(h,p,a);break;case 31:Jr(h,p,a),a&&v&4&&Tg(h,p);break;case 13:Jr(h,p,a),a&&v&4&&jg(h,p);break;case 22:p.memoizedState===null&&Jr(h,p,a),Wa(p,p.return);break;case 30:break;default:Jr(h,p,a)}i=i.sibling}}function Tf(n,i){var a=null;n!==null&&n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(a=n.memoizedState.cachePool.pool),n=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(n=i.memoizedState.cachePool.pool),n!==a&&(n!=null&&n.refCount++,a!=null&&Pa(a))}function jf(n,i){n=null,i.alternate!==null&&(n=i.alternate.memoizedState.cache),i=i.memoizedState.cache,i!==n&&(i.refCount++,n!=null&&Pa(n))}function mr(n,i,a,o){if(i.subtreeFlags&10256)for(i=i.child;i!==null;)Rg(n,i,a,o),i=i.sibling}function Rg(n,i,a,o){var h=i.flags;switch(i.tag){case 0:case 11:case 15:mr(n,i,a,o),h&2048&&Za(9,i);break;case 1:mr(n,i,a,o);break;case 3:mr(n,i,a,o),h&2048&&(n=null,i.alternate!==null&&(n=i.alternate.memoizedState.cache),i=i.memoizedState.cache,i!==n&&(i.refCount++,n!=null&&Pa(n)));break;case 12:if(h&2048){mr(n,i,a,o),n=i.stateNode;try{var p=i.memoizedProps,v=p.id,S=p.onPostCommit;typeof S=="function"&&S(v,i.alternate===null?"mount":"update",n.passiveEffectDuration,-0)}catch(I){xt(i,i.return,I)}}else mr(n,i,a,o);break;case 31:mr(n,i,a,o);break;case 13:mr(n,i,a,o);break;case 23:break;case 22:p=i.stateNode,v=i.alternate,i.memoizedState!==null?p._visibility&2?mr(n,i,a,o):el(n,i):p._visibility&2?mr(n,i,a,o):(p._visibility|=2,Hs(n,i,a,o,(i.subtreeFlags&10256)!==0||!1)),h&2048&&Tf(v,i);break;case 24:mr(n,i,a,o),h&2048&&jf(i.alternate,i);break;default:mr(n,i,a,o)}}function Hs(n,i,a,o,h){for(h=h&&((i.subtreeFlags&10256)!==0||!1),i=i.child;i!==null;){var p=n,v=i,S=a,I=o,re=v.flags;switch(v.tag){case 0:case 11:case 15:Hs(p,v,S,I,h),Za(8,v);break;case 23:break;case 22:var ce=v.stateNode;v.memoizedState!==null?ce._visibility&2?Hs(p,v,S,I,h):el(p,v):(ce._visibility|=2,Hs(p,v,S,I,h)),h&&re&2048&&Tf(v.alternate,v);break;case 24:Hs(p,v,S,I,h),h&&re&2048&&jf(v.alternate,v);break;default:Hs(p,v,S,I,h)}i=i.sibling}}function el(n,i){if(i.subtreeFlags&10256)for(i=i.child;i!==null;){var a=n,o=i,h=o.flags;switch(o.tag){case 22:el(a,o),h&2048&&Tf(o.alternate,o);break;case 24:el(a,o),h&2048&&jf(o.alternate,o);break;default:el(a,o)}i=i.sibling}}var tl=8192;function Is(n,i,a){if(n.subtreeFlags&tl)for(n=n.child;n!==null;)Mg(n,i,a),n=n.sibling}function Mg(n,i,a){switch(n.tag){case 26:Is(n,i,a),n.flags&tl&&n.memoizedState!==null&&qw(a,dr,n.memoizedState,n.memoizedProps);break;case 5:Is(n,i,a);break;case 3:case 4:var o=dr;dr=Ko(n.stateNode.containerInfo),Is(n,i,a),dr=o;break;case 22:n.memoizedState===null&&(o=n.alternate,o!==null&&o.memoizedState!==null?(o=tl,tl=16777216,Is(n,i,a),tl=o):Is(n,i,a));break;default:Is(n,i,a)}}function Dg(n){var i=n.alternate;if(i!==null&&(n=i.child,n!==null)){i.child=null;do i=n.sibling,n.sibling=null,n=i;while(n!==null)}}function nl(n){var i=n.deletions;if((n.flags&16)!==0){if(i!==null)for(var a=0;a<i.length;a++){var o=i[a];rn=o,zg(o,n)}Dg(n)}if(n.subtreeFlags&10256)for(n=n.child;n!==null;)Lg(n),n=n.sibling}function Lg(n){switch(n.tag){case 0:case 11:case 15:nl(n),n.flags&2048&&xi(9,n,n.return);break;case 3:nl(n);break;case 12:nl(n);break;case 22:var i=n.stateNode;n.memoizedState!==null&&i._visibility&2&&(n.return===null||n.return.tag!==13)?(i._visibility&=-3,Uo(n)):nl(n);break;default:nl(n)}}function Uo(n){var i=n.deletions;if((n.flags&16)!==0){if(i!==null)for(var a=0;a<i.length;a++){var o=i[a];rn=o,zg(o,n)}Dg(n)}for(n=n.child;n!==null;){switch(i=n,i.tag){case 0:case 11:case 15:xi(8,i,i.return),Uo(i);break;case 22:a=i.stateNode,a._visibility&2&&(a._visibility&=-3,Uo(i));break;default:Uo(i)}n=n.sibling}}function zg(n,i){for(;rn!==null;){var a=rn;switch(a.tag){case 0:case 11:case 15:xi(8,a,i);break;case 23:case 22:if(a.memoizedState!==null&&a.memoizedState.cachePool!==null){var o=a.memoizedState.cachePool.pool;o!=null&&o.refCount++}break;case 24:Pa(a.memoizedState.cache)}if(o=a.child,o!==null)o.return=a,rn=o;else e:for(a=n;rn!==null;){o=rn;var h=o.sibling,p=o.return;if(Cg(o),o===a){rn=null;break e}if(h!==null){h.return=p,rn=h;break e}rn=p}}}var tw={getCacheForType:function(n){var i=on(Jt),a=i.data.get(n);return a===void 0&&(a=n(),i.data.set(n,a)),a},cacheSignal:function(){return on(Jt).controller.signal}},nw=typeof WeakMap=="function"?WeakMap:Map,pt=0,At=null,We=null,it=0,bt=0,Un=null,vi=!1,Fs=!1,Nf=!1,Xr=0,$t=0,wi=0,cs=0,Of=0,Bn=0,$s=0,rl=null,Tn=null,Rf=!1,Bo=0,Ug=0,Po=1/0,qo=null,Si=null,tn=0,_i=null,Ys=null,Kr=0,Mf=0,Df=null,Bg=null,il=0,Lf=null;function Pn(){return(pt&2)!==0&&it!==0?it&-it:H.T!==null?Hf():Ca()}function Pg(){if(Bn===0)if((it&536870912)===0||at){var n=fn;fn<<=1,(fn&3932160)===0&&(fn=262144),Bn=n}else Bn=536870912;return n=Ln.current,n!==null&&(n.flags|=32),Bn}function jn(n,i,a){(n===At&&(bt===2||bt===9)||n.cancelPendingCommit!==null)&&(Gs(n,0),ki(n,it,Bn,!1)),cr(n,a),((pt&2)===0||n!==At)&&(n===At&&((pt&2)===0&&(cs|=a),$t===4&&ki(n,it,Bn,!1)),Cr(n))}function qg(n,i,a){if((pt&6)!==0)throw Error(s(327));var o=!a&&(i&127)===0&&(i&n.expiredLanes)===0||Yi(n,i),h=o?sw(n,i):Uf(n,i,!0),p=o;do{if(h===0){Fs&&!o&&ki(n,i,0,!1);break}else{if(a=n.current.alternate,p&&!rw(a)){h=Uf(n,i,!1),p=!1;continue}if(h===2){if(p=i,n.errorRecoveryDisabledLanes&p)var v=0;else v=n.pendingLanes&-536870913,v=v!==0?v:v&536870912?536870912:0;if(v!==0){i=v;e:{var S=n;h=rl;var I=S.current.memoizedState.isDehydrated;if(I&&(Gs(S,v).flags|=256),v=Uf(S,v,!1),v!==2){if(Nf&&!I){S.errorRecoveryDisabledLanes|=p,cs|=p,h=4;break e}p=Tn,Tn=h,p!==null&&(Tn===null?Tn=p:Tn.push.apply(Tn,p))}h=v}if(p=!1,h!==2)continue}}if(h===1){Gs(n,0),ki(n,i,0,!0);break}e:{switch(o=n,p=h,p){case 0:case 1:throw Error(s(345));case 4:if((i&4194048)!==i)break;case 6:ki(o,i,Bn,!vi);break e;case 2:Tn=null;break;case 3:case 5:break;default:throw Error(s(329))}if((i&62914560)===i&&(h=Bo+300-ht(),10<h)){if(ki(o,i,Bn,!vi),$i(o,0,!0)!==0)break e;Kr=i,o.timeoutHandle=yy(Hg.bind(null,o,a,Tn,qo,Rf,i,Bn,cs,$s,vi,p,"Throttled",-0,0),h);break e}Hg(o,a,Tn,qo,Rf,i,Bn,cs,$s,vi,p,null,-0,0)}}break}while(!0);Cr(n)}function Hg(n,i,a,o,h,p,v,S,I,re,ce,ge,ie,ae){if(n.timeoutHandle=-1,ge=i.subtreeFlags,ge&8192||(ge&16785408)===16785408){ge={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Lr},Mg(i,p,ge);var Me=(p&62914560)===p?Bo-ht():(p&4194048)===p?Ug-ht():0;if(Me=Hw(ge,Me),Me!==null){Kr=p,n.cancelPendingCommit=Me(Xg.bind(null,n,i,p,a,o,h,v,S,I,ce,ge,null,ie,ae)),ki(n,p,v,!re);return}}Xg(n,i,p,a,o,h,v,S,I)}function rw(n){for(var i=n;;){var a=i.tag;if((a===0||a===11||a===15)&&i.flags&16384&&(a=i.updateQueue,a!==null&&(a=a.stores,a!==null)))for(var o=0;o<a.length;o++){var h=a[o],p=h.getSnapshot;h=h.value;try{if(!Mn(p(),h))return!1}catch{return!1}}if(a=i.child,i.subtreeFlags&16384&&a!==null)a.return=i,i=a;else{if(i===n)break;for(;i.sibling===null;){if(i.return===null||i.return===n)return!0;i=i.return}i.sibling.return=i.return,i=i.sibling}}return!0}function ki(n,i,a,o){i&=~Of,i&=~cs,n.suspendedLanes|=i,n.pingedLanes&=~i,o&&(n.warmLanes|=i),o=n.expirationTimes;for(var h=i;0<h;){var p=31-de(h),v=1<<p;o[p]=-1,h&=~v}a!==0&&li(n,a,i)}function Ho(){return(pt&6)===0?(sl(0),!1):!0}function zf(){if(We!==null){if(bt===0)var n=We.return;else n=We,Pr=ts=null,Qc(n),zs=null,Ha=0,n=We;for(;n!==null;)bg(n.alternate,n),n=n.return;We=null}}function Gs(n,i){var a=n.timeoutHandle;a!==-1&&(n.timeoutHandle=-1,_w(a)),a=n.cancelPendingCommit,a!==null&&(n.cancelPendingCommit=null,a()),Kr=0,zf(),At=n,We=a=Ur(n.current,null),it=i,bt=0,Un=null,vi=!1,Fs=Yi(n,i),Nf=!1,$s=Bn=Of=cs=wi=$t=0,Tn=rl=null,Rf=!1,(i&8)!==0&&(i|=i&32);var o=n.entangledLanes;if(o!==0)for(n=n.entanglements,o&=i;0<o;){var h=31-de(o),p=1<<h;i|=n[h],o&=~p}return Xr=i,lo(),a}function Ig(n,i){Ge=null,H.H=Xa,i===Ls||i===go?(i=ip(),bt=3):i===Pc?(i=ip(),bt=4):bt=i===mf?8:i!==null&&typeof i=="object"&&typeof i.then=="function"?6:1,Un=i,We===null&&($t=1,No(n,Zn(i,n.current)))}function Fg(){var n=Ln.current;return n===null?!0:(it&4194048)===it?nr===null:(it&62914560)===it||(it&536870912)!==0?n===nr:!1}function $g(){var n=H.H;return H.H=Xa,n===null?Xa:n}function Yg(){var n=H.A;return H.A=tw,n}function Io(){$t=4,vi||(it&4194048)!==it&&Ln.current!==null||(Fs=!0),(wi&134217727)===0&&(cs&134217727)===0||At===null||ki(At,it,Bn,!1)}function Uf(n,i,a){var o=pt;pt|=2;var h=$g(),p=Yg();(At!==n||it!==i)&&(qo=null,Gs(n,i)),i=!1;var v=$t;e:do try{if(bt!==0&&We!==null){var S=We,I=Un;switch(bt){case 8:zf(),v=6;break e;case 3:case 2:case 9:case 6:Ln.current===null&&(i=!0);var re=bt;if(bt=0,Un=null,Vs(n,S,I,re),a&&Fs){v=0;break e}break;default:re=bt,bt=0,Un=null,Vs(n,S,I,re)}}iw(),v=$t;break}catch(ce){Ig(n,ce)}while(!0);return i&&n.shellSuspendCounter++,Pr=ts=null,pt=o,H.H=h,H.A=p,We===null&&(At=null,it=0,lo()),v}function iw(){for(;We!==null;)Gg(We)}function sw(n,i){var a=pt;pt|=2;var o=$g(),h=Yg();At!==n||it!==i?(qo=null,Po=ht()+500,Gs(n,i)):Fs=Yi(n,i);e:do try{if(bt!==0&&We!==null){i=We;var p=Un;t:switch(bt){case 1:bt=0,Un=null,Vs(n,i,p,1);break;case 2:case 9:if(np(p)){bt=0,Un=null,Vg(i);break}i=function(){bt!==2&&bt!==9||At!==n||(bt=7),Cr(n)},p.then(i,i);break e;case 3:bt=7;break e;case 4:bt=5;break e;case 7:np(p)?(bt=0,Un=null,Vg(i)):(bt=0,Un=null,Vs(n,i,p,7));break;case 5:var v=null;switch(We.tag){case 26:v=We.memoizedState;case 5:case 27:var S=We;if(v?Ry(v):S.stateNode.complete){bt=0,Un=null;var I=S.sibling;if(I!==null)We=I;else{var re=S.return;re!==null?(We=re,Fo(re)):We=null}break t}}bt=0,Un=null,Vs(n,i,p,5);break;case 6:bt=0,Un=null,Vs(n,i,p,6);break;case 8:zf(),$t=6;break e;default:throw Error(s(462))}}aw();break}catch(ce){Ig(n,ce)}while(!0);return Pr=ts=null,H.H=o,H.A=h,pt=a,We!==null?0:(At=null,it=0,lo(),$t)}function aw(){for(;We!==null&&!qt();)Gg(We)}function Gg(n){var i=gg(n.alternate,n,Xr);n.memoizedProps=n.pendingProps,i===null?Fo(n):We=i}function Vg(n){var i=n,a=i.alternate;switch(i.tag){case 15:case 0:i=cg(a,i,i.pendingProps,i.type,void 0,it);break;case 11:i=cg(a,i,i.pendingProps,i.type.render,i.ref,it);break;case 5:Qc(i);default:bg(a,i),i=We=Ym(i,Xr),i=gg(a,i,Xr)}n.memoizedProps=n.pendingProps,i===null?Fo(n):We=i}function Vs(n,i,a,o){Pr=ts=null,Qc(i),zs=null,Ha=0;var h=i.return;try{if(Jv(n,h,i,a,it)){$t=1,No(n,Zn(a,n.current)),We=null;return}}catch(p){if(h!==null)throw We=h,p;$t=1,No(n,Zn(a,n.current)),We=null;return}i.flags&32768?(at||o===1?n=!0:Fs||(it&536870912)!==0?n=!1:(vi=n=!0,(o===2||o===9||o===3||o===6)&&(o=Ln.current,o!==null&&o.tag===13&&(o.flags|=16384))),Jg(i,n)):Fo(i)}function Fo(n){var i=n;do{if((i.flags&32768)!==0){Jg(i,vi);return}n=i.return;var a=Qv(i.alternate,i,Xr);if(a!==null){We=a;return}if(i=i.sibling,i!==null){We=i;return}We=i=n}while(i!==null);$t===0&&($t=5)}function Jg(n,i){do{var a=Zv(n.alternate,n);if(a!==null){a.flags&=32767,We=a;return}if(a=n.return,a!==null&&(a.flags|=32768,a.subtreeFlags=0,a.deletions=null),!i&&(n=n.sibling,n!==null)){We=n;return}We=n=a}while(n!==null);$t=6,We=null}function Xg(n,i,a,o,h,p,v,S,I){n.cancelPendingCommit=null;do $o();while(tn!==0);if((pt&6)!==0)throw Error(s(327));if(i!==null){if(i===n.current)throw Error(s(177));if(p=i.lanes|i.childLanes,p|=kc,ai(n,a,p,v,S,I),n===At&&(We=At=null,it=0),Ys=i,_i=n,Kr=a,Mf=p,Df=h,Bg=o,(i.subtreeFlags&10256)!==0||(i.flags&10256)!==0?(n.callbackNode=null,n.callbackPriority=0,cw(Ue,function(){return ey(),null})):(n.callbackNode=null,n.callbackPriority=0),o=(i.flags&13878)!==0,(i.subtreeFlags&13878)!==0||o){o=H.T,H.T=null,h=ee.p,ee.p=2,v=pt,pt|=4;try{Wv(n,i,a)}finally{pt=v,ee.p=h,H.T=o}}tn=1,Kg(),Qg(),Zg()}}function Kg(){if(tn===1){tn=0;var n=_i,i=Ys,a=(i.flags&13878)!==0;if((i.subtreeFlags&13878)!==0||a){a=H.T,H.T=null;var o=ee.p;ee.p=2;var h=pt;pt|=4;try{Ng(i,n);var p=Xf,v=zm(n.containerInfo),S=p.focusedElem,I=p.selectionRange;if(v!==S&&S&&S.ownerDocument&&Lm(S.ownerDocument.documentElement,S)){if(I!==null&&xc(S)){var re=I.start,ce=I.end;if(ce===void 0&&(ce=re),"selectionStart"in S)S.selectionStart=re,S.selectionEnd=Math.min(ce,S.value.length);else{var ge=S.ownerDocument||document,ie=ge&&ge.defaultView||window;if(ie.getSelection){var ae=ie.getSelection(),Me=S.textContent.length,Pe=Math.min(I.start,Me),_t=I.end===void 0?Pe:Math.min(I.end,Me);!ae.extend&&Pe>_t&&(v=_t,_t=Pe,Pe=v);var Z=Dm(S,Pe),G=Dm(S,_t);if(Z&&G&&(ae.rangeCount!==1||ae.anchorNode!==Z.node||ae.anchorOffset!==Z.offset||ae.focusNode!==G.node||ae.focusOffset!==G.offset)){var ne=ge.createRange();ne.setStart(Z.node,Z.offset),ae.removeAllRanges(),Pe>_t?(ae.addRange(ne),ae.extend(G.node,G.offset)):(ne.setEnd(G.node,G.offset),ae.addRange(ne))}}}}for(ge=[],ae=S;ae=ae.parentNode;)ae.nodeType===1&&ge.push({element:ae,left:ae.scrollLeft,top:ae.scrollTop});for(typeof S.focus=="function"&&S.focus(),S=0;S<ge.length;S++){var he=ge[S];he.element.scrollLeft=he.left,he.element.scrollTop=he.top}}nu=!!Jf,Xf=Jf=null}finally{pt=h,ee.p=o,H.T=a}}n.current=i,tn=2}}function Qg(){if(tn===2){tn=0;var n=_i,i=Ys,a=(i.flags&8772)!==0;if((i.subtreeFlags&8772)!==0||a){a=H.T,H.T=null;var o=ee.p;ee.p=2;var h=pt;pt|=4;try{Eg(n,i.alternate,i)}finally{pt=h,ee.p=o,H.T=a}}tn=3}}function Zg(){if(tn===4||tn===3){tn=0,jt();var n=_i,i=Ys,a=Kr,o=Bg;(i.subtreeFlags&10256)!==0||(i.flags&10256)!==0?tn=5:(tn=0,Ys=_i=null,Wg(n,n.pendingLanes));var h=n.pendingLanes;if(h===0&&(Si=null),Vi(a),i=i.stateNode,yt&&typeof yt.onCommitFiberRoot=="function")try{yt.onCommitFiberRoot(Wt,i,void 0,(i.current.flags&128)===128)}catch{}if(o!==null){i=H.T,h=ee.p,ee.p=2,H.T=null;try{for(var p=n.onRecoverableError,v=0;v<o.length;v++){var S=o[v];p(S.value,{componentStack:S.stack})}}finally{H.T=i,ee.p=h}}(Kr&3)!==0&&$o(),Cr(n),h=n.pendingLanes,(a&261930)!==0&&(h&42)!==0?n===Lf?il++:(il=0,Lf=n):il=0,sl(0)}}function Wg(n,i){(n.pooledCacheLanes&=i)===0&&(i=n.pooledCache,i!=null&&(n.pooledCache=null,Pa(i)))}function $o(){return Kg(),Qg(),Zg(),ey()}function ey(){if(tn!==5)return!1;var n=_i,i=Mf;Mf=0;var a=Vi(Kr),o=H.T,h=ee.p;try{ee.p=32>a?32:a,H.T=null,a=Df,Df=null;var p=_i,v=Kr;if(tn=0,Ys=_i=null,Kr=0,(pt&6)!==0)throw Error(s(331));var S=pt;if(pt|=4,Lg(p.current),Rg(p,p.current,v,a),pt=S,sl(0,!1),yt&&typeof yt.onPostCommitFiberRoot=="function")try{yt.onPostCommitFiberRoot(Wt,p)}catch{}return!0}finally{ee.p=h,H.T=o,Wg(n,i)}}function ty(n,i,a){i=Zn(a,i),i=df(n.stateNode,i,2),n=gi(n,i,2),n!==null&&(cr(n,2),Cr(n))}function xt(n,i,a){if(n.tag===3)ty(n,n,a);else for(;i!==null;){if(i.tag===3){ty(i,n,a);break}else if(i.tag===1){var o=i.stateNode;if(typeof i.type.getDerivedStateFromError=="function"||typeof o.componentDidCatch=="function"&&(Si===null||!Si.has(o))){n=Zn(a,n),a=ng(2),o=gi(i,a,2),o!==null&&(rg(a,o,i,n),cr(o,2),Cr(o));break}}i=i.return}}function Bf(n,i,a){var o=n.pingCache;if(o===null){o=n.pingCache=new nw;var h=new Set;o.set(i,h)}else h=o.get(i),h===void 0&&(h=new Set,o.set(i,h));h.has(a)||(Nf=!0,h.add(a),n=lw.bind(null,n,i,a),i.then(n,n))}function lw(n,i,a){var o=n.pingCache;o!==null&&o.delete(i),n.pingedLanes|=n.suspendedLanes&a,n.warmLanes&=~a,At===n&&(it&a)===a&&($t===4||$t===3&&(it&62914560)===it&&300>ht()-Bo?(pt&2)===0&&Gs(n,0):Of|=a,$s===it&&($s=0)),Cr(n)}function ny(n,i){i===0&&(i=bs()),n=Zi(n,i),n!==null&&(cr(n,i),Cr(n))}function ow(n){var i=n.memoizedState,a=0;i!==null&&(a=i.retryLane),ny(n,a)}function uw(n,i){var a=0;switch(n.tag){case 31:case 13:var o=n.stateNode,h=n.memoizedState;h!==null&&(a=h.retryLane);break;case 19:o=n.stateNode;break;case 22:o=n.stateNode._retryCache;break;default:throw Error(s(314))}o!==null&&o.delete(i),ny(n,a)}function cw(n,i){return ft(n,i)}var Yo=null,Js=null,Pf=!1,Go=!1,qf=!1,Ei=0;function Cr(n){n!==Js&&n.next===null&&(Js===null?Yo=Js=n:Js=Js.next=n),Go=!0,Pf||(Pf=!0,hw())}function sl(n,i){if(!qf&&Go){qf=!0;do for(var a=!1,o=Yo;o!==null;){if(n!==0){var h=o.pendingLanes;if(h===0)var p=0;else{var v=o.suspendedLanes,S=o.pingedLanes;p=(1<<31-de(42|n)+1)-1,p&=h&~(v&~S),p=p&201326741?p&201326741|1:p?p|2:0}p!==0&&(a=!0,ay(o,p))}else p=it,p=$i(o,o===At?p:0,o.cancelPendingCommit!==null||o.timeoutHandle!==-1),(p&3)===0||Yi(o,p)||(a=!0,ay(o,p));o=o.next}while(a);qf=!1}}function fw(){ry()}function ry(){Go=Pf=!1;var n=0;Ei!==0&&Sw()&&(n=Ei);for(var i=ht(),a=null,o=Yo;o!==null;){var h=o.next,p=iy(o,i);p===0?(o.next=null,a===null?Yo=h:a.next=h,h===null&&(Js=a)):(a=o,(n!==0||(p&3)!==0)&&(Go=!0)),o=h}tn!==0&&tn!==5||sl(n),Ei!==0&&(Ei=0)}function iy(n,i){for(var a=n.suspendedLanes,o=n.pingedLanes,h=n.expirationTimes,p=n.pendingLanes&-62914561;0<p;){var v=31-de(p),S=1<<v,I=h[v];I===-1?((S&a)===0||(S&o)!==0)&&(h[v]=Ea(S,i)):I<=i&&(n.expiredLanes|=S),p&=~S}if(i=At,a=it,a=$i(n,n===i?a:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),o=n.callbackNode,a===0||n===i&&(bt===2||bt===9)||n.cancelPendingCommit!==null)return o!==null&&o!==null&&rt(o),n.callbackNode=null,n.callbackPriority=0;if((a&3)===0||Yi(n,a)){if(i=a&-a,i===n.callbackPriority)return i;switch(o!==null&&rt(o),Vi(a)){case 2:case 8:a=ve;break;case 32:a=Ue;break;case 268435456:a=lt;break;default:a=Ue}return o=sy.bind(null,n),a=ft(a,o),n.callbackPriority=i,n.callbackNode=a,i}return o!==null&&o!==null&&rt(o),n.callbackPriority=2,n.callbackNode=null,2}function sy(n,i){if(tn!==0&&tn!==5)return n.callbackNode=null,n.callbackPriority=0,null;var a=n.callbackNode;if($o()&&n.callbackNode!==a)return null;var o=it;return o=$i(n,n===At?o:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),o===0?null:(qg(n,o,i),iy(n,ht()),n.callbackNode!=null&&n.callbackNode===a?sy.bind(null,n):null)}function ay(n,i){if($o())return null;qg(n,i,!0)}function hw(){kw(function(){(pt&6)!==0?ft(fe,fw):ry()})}function Hf(){if(Ei===0){var n=Ms;n===0&&(n=Pt,Pt<<=1,(Pt&261888)===0&&(Pt=256)),Ei=n}return Ei}function ly(n){return n==null||typeof n=="symbol"||typeof n=="boolean"?null:typeof n=="function"?n:Wl(""+n)}function oy(n,i){var a=i.ownerDocument.createElement("input");return a.name=i.name,a.value=i.value,n.id&&a.setAttribute("form",n.id),i.parentNode.insertBefore(a,i),n=new FormData(n),a.parentNode.removeChild(a),n}function dw(n,i,a,o,h){if(i==="submit"&&a&&a.stateNode===h){var p=ly((h[It]||null).action),v=o.submitter;v&&(i=(i=v[It]||null)?ly(i.formAction):v.getAttribute("formAction"),i!==null&&(p=i,v=null));var S=new ro("action","action",null,o,h);n.push({event:S,listeners:[{instance:null,listener:function(){if(o.defaultPrevented){if(Ei!==0){var I=v?oy(h,v):new FormData(h);lf(a,{pending:!0,data:I,method:h.method,action:p},null,I)}}else typeof p=="function"&&(S.preventDefault(),I=v?oy(h,v):new FormData(h),lf(a,{pending:!0,data:I,method:h.method,action:p},p,I))},currentTarget:h}]})}}for(var If=0;If<_c.length;If++){var Ff=_c[If],mw=Ff.toLowerCase(),pw=Ff[0].toUpperCase()+Ff.slice(1);hr(mw,"on"+pw)}hr(Pm,"onAnimationEnd"),hr(qm,"onAnimationIteration"),hr(Hm,"onAnimationStart"),hr("dblclick","onDoubleClick"),hr("focusin","onFocus"),hr("focusout","onBlur"),hr(Ov,"onTransitionRun"),hr(Rv,"onTransitionStart"),hr(Mv,"onTransitionCancel"),hr(Im,"onTransitionEnd"),se("onMouseEnter",["mouseout","mouseover"]),se("onMouseLeave",["mouseout","mouseover"]),se("onPointerEnter",["pointerout","pointerover"]),se("onPointerLeave",["pointerout","pointerover"]),ye("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),ye("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),ye("onBeforeInput",["compositionend","keypress","textInput","paste"]),ye("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),ye("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),ye("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var al="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(" "),gw=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(al));function uy(n,i){i=(i&4)!==0;for(var a=0;a<n.length;a++){var o=n[a],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],I=S.instance,re=S.currentTarget;if(S=S.listener,I!==p&&h.isPropagationStopped())break e;p=S,h.currentTarget=re;try{p(h)}catch(ce){ao(ce)}h.currentTarget=null,p=I}else for(v=0;v<o.length;v++){if(S=o[v],I=S.instance,re=S.currentTarget,S=S.listener,I!==p&&h.isPropagationStopped())break e;p=S,h.currentTarget=re;try{p(h)}catch(ce){ao(ce)}h.currentTarget=null,p=I}}}}function et(n,i){var a=i[Ji];a===void 0&&(a=i[Ji]=new Set);var o=n+"__bubble";a.has(o)||(cy(i,n,2,!1),a.add(o))}function $f(n,i,a){var o=0;i&&(o|=4),cy(a,n,o,i)}var Vo="_reactListening"+Math.random().toString(36).slice(2);function Yf(n){if(!n[Vo]){n[Vo]=!0,W.forEach(function(a){a!=="selectionchange"&&(gw.has(a)||$f(a,!1,n),$f(a,!0,n))});var i=n.nodeType===9?n:n.ownerDocument;i===null||i[Vo]||(i[Vo]=!0,$f("selectionchange",!1,i))}}function cy(n,i,a,o){switch(Py(i)){case 2:var h=$w;break;case 8:h=Yw;break;default:h=ah}a=h.bind(null,i,a,n),h=void 0,!cc||i!=="touchstart"&&i!=="touchmove"&&i!=="wheel"||(h=!0),o?h!==void 0?n.addEventListener(i,a,{capture:!0,passive:h}):n.addEventListener(i,a,!0):h!==void 0?n.addEventListener(i,a,{passive:h}):n.addEventListener(i,a,!1)}function Gf(n,i,a,o,h){var p=o;if((i&1)===0&&(i&2)===0&&o!==null)e:for(;;){if(o===null)return;var v=o.tag;if(v===3||v===4){var S=o.stateNode.containerInfo;if(S===h)break;if(v===4)for(v=o.return;v!==null;){var I=v.tag;if((I===3||I===4)&&v.stateNode.containerInfo===h)return;v=v.return}for(;S!==null;){if(v=k(S),v===null)return;if(I=v.tag,I===5||I===6||I===26||I===27){o=p=v;continue e}S=S.parentNode}}o=o.return}pm(function(){var re=p,ce=oc(a),ge=[];e:{var ie=Fm.get(n);if(ie!==void 0){var ae=ro,Me=n;switch(n){case"keypress":if(to(a)===0)break e;case"keydown":case"keyup":ae=uv;break;case"focusin":Me="focus",ae=mc;break;case"focusout":Me="blur",ae=mc;break;case"beforeblur":case"afterblur":ae=mc;break;case"click":if(a.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":ae=bm;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ae=Q1;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ae=hv;break;case Pm:case qm:case Hm:ae=ev;break;case Im:ae=mv;break;case"scroll":case"scrollend":ae=X1;break;case"wheel":ae=gv;break;case"copy":case"cut":case"paste":ae=nv;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ae=vm;break;case"toggle":case"beforetoggle":ae=bv}var Pe=(i&4)!==0,_t=!Pe&&(n==="scroll"||n==="scrollend"),Z=Pe?ie!==null?ie+"Capture":null:ie;Pe=[];for(var G=re,ne;G!==null;){var he=G;if(ne=he.stateNode,he=he.tag,he!==5&&he!==26&&he!==27||ne===null||Z===null||(he=Ta(G,Z),he!=null&&Pe.push(ll(G,he,ne))),_t)break;G=G.return}0<Pe.length&&(ie=new ae(ie,Me,null,a,ce),ge.push({event:ie,listeners:Pe}))}}if((i&7)===0){e:{if(ie=n==="mouseover"||n==="pointerover",ae=n==="mouseout"||n==="pointerout",ie&&a!==lc&&(Me=a.relatedTarget||a.fromElement)&&(k(Me)||Me[Rn]))break e;if((ae||ie)&&(ie=ce.window===ce?ce:(ie=ce.ownerDocument)?ie.defaultView||ie.parentWindow:window,ae?(Me=a.relatedTarget||a.toElement,ae=re,Me=Me?k(Me):null,Me!==null&&(_t=u(Me),Pe=Me.tag,Me!==_t||Pe!==5&&Pe!==27&&Pe!==6)&&(Me=null)):(ae=null,Me=re),ae!==Me)){if(Pe=bm,he="onMouseLeave",Z="onMouseEnter",G="mouse",(n==="pointerout"||n==="pointerover")&&(Pe=vm,he="onPointerLeave",Z="onPointerEnter",G="pointer"),_t=ae==null?ie:T(ae),ne=Me==null?ie:T(Me),ie=new Pe(he,G+"leave",ae,a,ce),ie.target=_t,ie.relatedTarget=ne,he=null,k(ce)===re&&(Pe=new Pe(Z,G+"enter",Me,a,ce),Pe.target=ne,Pe.relatedTarget=_t,he=Pe),_t=he,ae&&Me)t:{for(Pe=yw,Z=ae,G=Me,ne=0,he=Z;he;he=Pe(he))ne++;he=0;for(var ze=G;ze;ze=Pe(ze))he++;for(;0<ne-he;)Z=Pe(Z),ne--;for(;0<he-ne;)G=Pe(G),he--;for(;ne--;){if(Z===G||G!==null&&Z===G.alternate){Pe=Z;break t}Z=Pe(Z),G=Pe(G)}Pe=null}else Pe=null;ae!==null&&fy(ge,ie,ae,Pe,!1),Me!==null&&_t!==null&&fy(ge,_t,Me,Pe,!0)}}e:{if(ie=re?T(re):window,ae=ie.nodeName&&ie.nodeName.toLowerCase(),ae==="select"||ae==="input"&&ie.type==="file")var dt=Tm;else if(Cm(ie))if(jm)dt=Tv;else{dt=Cv;var De=Ev}else ae=ie.nodeName,!ae||ae.toLowerCase()!=="input"||ie.type!=="checkbox"&&ie.type!=="radio"?re&&ac(re.elementType)&&(dt=Tm):dt=Av;if(dt&&(dt=dt(n,re))){Am(ge,dt,a,ce);break e}De&&De(n,ie,re),n==="focusout"&&re&&ie.type==="number"&&re.memoizedProps.value!=null&&sc(ie,"number",ie.value)}switch(De=re?T(re):window,n){case"focusin":(Cm(De)||De.contentEditable==="true")&&(Es=De,vc=re,za=null);break;case"focusout":za=vc=Es=null;break;case"mousedown":wc=!0;break;case"contextmenu":case"mouseup":case"dragend":wc=!1,Um(ge,a,ce);break;case"selectionchange":if(Nv)break;case"keydown":case"keyup":Um(ge,a,ce)}var Xe;if(gc)e:{switch(n){case"compositionstart":var st="onCompositionStart";break e;case"compositionend":st="onCompositionEnd";break e;case"compositionupdate":st="onCompositionUpdate";break e}st=void 0}else ks?km(n,a)&&(st="onCompositionEnd"):n==="keydown"&&a.keyCode===229&&(st="onCompositionStart");st&&(wm&&a.locale!=="ko"&&(ks||st!=="onCompositionStart"?st==="onCompositionEnd"&&ks&&(Xe=gm()):(ui=ce,fc="value"in ui?ui.value:ui.textContent,ks=!0)),De=Jo(re,st),0<De.length&&(st=new xm(st,n,null,a,ce),ge.push({event:st,listeners:De}),Xe?st.data=Xe:(Xe=Em(a),Xe!==null&&(st.data=Xe)))),(Xe=vv?wv(n,a):Sv(n,a))&&(st=Jo(re,"onBeforeInput"),0<st.length&&(De=new xm("onBeforeInput","beforeinput",null,a,ce),ge.push({event:De,listeners:st}),De.data=Xe)),dw(ge,n,re,a,ce)}uy(ge,i)})}function ll(n,i,a){return{instance:n,listener:i,currentTarget:a}}function Jo(n,i){for(var a=i+"Capture",o=[];n!==null;){var h=n,p=h.stateNode;if(h=h.tag,h!==5&&h!==26&&h!==27||p===null||(h=Ta(n,a),h!=null&&o.unshift(ll(n,h,p)),h=Ta(n,i),h!=null&&o.push(ll(n,h,p))),n.tag===3)return o;n=n.return}return[]}function yw(n){if(n===null)return null;do n=n.return;while(n&&n.tag!==5&&n.tag!==27);return n||null}function fy(n,i,a,o,h){for(var p=i._reactName,v=[];a!==null&&a!==o;){var S=a,I=S.alternate,re=S.stateNode;if(S=S.tag,I!==null&&I===o)break;S!==5&&S!==26&&S!==27||re===null||(I=re,h?(re=Ta(a,p),re!=null&&v.unshift(ll(a,re,I))):h||(re=Ta(a,p),re!=null&&v.push(ll(a,re,I)))),a=a.return}v.length!==0&&n.push({event:i,listeners:v})}var bw=/\r\n?/g,xw=/\u0000|\uFFFD/g;function hy(n){return(typeof n=="string"?n:""+n).replace(bw,`
|
|
49
|
-
`).replace(xw,"")}function dy(n,i){return i=hy(i),hy(n)===i}function St(n,i,a,o,h,p){switch(a){case"children":typeof o=="string"?i==="body"||i==="textarea"&&o===""||ws(n,o):(typeof o=="number"||typeof o=="bigint")&&i!=="body"&&ws(n,""+o);break;case"className":fr(n,"class",o);break;case"tabIndex":fr(n,"tabindex",o);break;case"dir":case"role":case"viewBox":case"width":case"height":fr(n,a,o);break;case"style":dm(n,o,p);break;case"data":if(i!=="object"){fr(n,"data",o);break}case"src":case"href":if(o===""&&(i!=="a"||a!=="href")){n.removeAttribute(a);break}if(o==null||typeof o=="function"||typeof o=="symbol"||typeof o=="boolean"){n.removeAttribute(a);break}o=Wl(""+o),n.setAttribute(a,o);break;case"action":case"formAction":if(typeof o=="function"){n.setAttribute(a,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof p=="function"&&(a==="formAction"?(i!=="input"&&St(n,i,"name",h.name,h,null),St(n,i,"formEncType",h.formEncType,h,null),St(n,i,"formMethod",h.formMethod,h,null),St(n,i,"formTarget",h.formTarget,h,null)):(St(n,i,"encType",h.encType,h,null),St(n,i,"method",h.method,h,null),St(n,i,"target",h.target,h,null)));if(o==null||typeof o=="symbol"||typeof o=="boolean"){n.removeAttribute(a);break}o=Wl(""+o),n.setAttribute(a,o);break;case"onClick":o!=null&&(n.onclick=Lr);break;case"onScroll":o!=null&&et("scroll",n);break;case"onScrollEnd":o!=null&&et("scrollend",n);break;case"dangerouslySetInnerHTML":if(o!=null){if(typeof o!="object"||!("__html"in o))throw Error(s(61));if(a=o.__html,a!=null){if(h.children!=null)throw Error(s(60));n.innerHTML=a}}break;case"multiple":n.multiple=o&&typeof o!="function"&&typeof o!="symbol";break;case"muted":n.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"){n.removeAttribute("xlink:href");break}a=Wl(""+o),n.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",a);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":o!=null&&typeof o!="function"&&typeof o!="symbol"?n.setAttribute(a,""+o):n.removeAttribute(a);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":o&&typeof o!="function"&&typeof o!="symbol"?n.setAttribute(a,""):n.removeAttribute(a);break;case"capture":case"download":o===!0?n.setAttribute(a,""):o!==!1&&o!=null&&typeof o!="function"&&typeof o!="symbol"?n.setAttribute(a,o):n.removeAttribute(a);break;case"cols":case"rows":case"size":case"span":o!=null&&typeof o!="function"&&typeof o!="symbol"&&!isNaN(o)&&1<=o?n.setAttribute(a,o):n.removeAttribute(a);break;case"rowSpan":case"start":o==null||typeof o=="function"||typeof o=="symbol"||isNaN(o)?n.removeAttribute(a):n.setAttribute(a,o);break;case"popover":et("beforetoggle",n),et("toggle",n),hn(n,"popover",o);break;case"xlinkActuate":Dr(n,"http://www.w3.org/1999/xlink","xlink:actuate",o);break;case"xlinkArcrole":Dr(n,"http://www.w3.org/1999/xlink","xlink:arcrole",o);break;case"xlinkRole":Dr(n,"http://www.w3.org/1999/xlink","xlink:role",o);break;case"xlinkShow":Dr(n,"http://www.w3.org/1999/xlink","xlink:show",o);break;case"xlinkTitle":Dr(n,"http://www.w3.org/1999/xlink","xlink:title",o);break;case"xlinkType":Dr(n,"http://www.w3.org/1999/xlink","xlink:type",o);break;case"xmlBase":Dr(n,"http://www.w3.org/XML/1998/namespace","xml:base",o);break;case"xmlLang":Dr(n,"http://www.w3.org/XML/1998/namespace","xml:lang",o);break;case"xmlSpace":Dr(n,"http://www.w3.org/XML/1998/namespace","xml:space",o);break;case"is":hn(n,"is",o);break;case"innerText":case"textContent":break;default:(!(2<a.length)||a[0]!=="o"&&a[0]!=="O"||a[1]!=="n"&&a[1]!=="N")&&(a=V1.get(a)||a,hn(n,a,o))}}function Vf(n,i,a,o,h,p){switch(a){case"style":dm(n,o,p);break;case"dangerouslySetInnerHTML":if(o!=null){if(typeof o!="object"||!("__html"in o))throw Error(s(61));if(a=o.__html,a!=null){if(h.children!=null)throw Error(s(60));n.innerHTML=a}}break;case"children":typeof o=="string"?ws(n,o):(typeof o=="number"||typeof o=="bigint")&&ws(n,""+o);break;case"onScroll":o!=null&&et("scroll",n);break;case"onScrollEnd":o!=null&&et("scrollend",n);break;case"onClick":o!=null&&(n.onclick=Lr);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!pe.hasOwnProperty(a))e:{if(a[0]==="o"&&a[1]==="n"&&(h=a.endsWith("Capture"),i=a.slice(2,h?a.length-7:void 0),p=n[It]||null,p=p!=null?p[a]:null,typeof p=="function"&&n.removeEventListener(i,p,h),typeof o=="function")){typeof p!="function"&&p!==null&&(a in n?n[a]=null:n.hasAttribute(a)&&n.removeAttribute(a)),n.addEventListener(i,o,h);break e}a in n?n[a]=o:o===!0?n.setAttribute(a,""):hn(n,a,o)}}}function cn(n,i,a){switch(i){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":et("error",n),et("load",n);var o=!1,h=!1,p;for(p in a)if(a.hasOwnProperty(p)){var v=a[p];if(v!=null)switch(p){case"src":o=!0;break;case"srcSet":h=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(s(137,i));default:St(n,i,p,v,a,null)}}h&&St(n,i,"srcSet",a.srcSet,a,null),o&&St(n,i,"src",a.src,a,null);return;case"input":et("invalid",n);var S=p=v=h=null,I=null,re=null;for(o in a)if(a.hasOwnProperty(o)){var ce=a[o];if(ce!=null)switch(o){case"name":h=ce;break;case"type":v=ce;break;case"checked":I=ce;break;case"defaultChecked":re=ce;break;case"value":p=ce;break;case"defaultValue":S=ce;break;case"children":case"dangerouslySetInnerHTML":if(ce!=null)throw Error(s(137,i));break;default:St(n,i,o,ce,a,null)}}um(n,p,S,I,re,v,h,!1);return;case"select":et("invalid",n),o=v=p=null;for(h in a)if(a.hasOwnProperty(h)&&(S=a[h],S!=null))switch(h){case"value":p=S;break;case"defaultValue":v=S;break;case"multiple":o=S;default:St(n,i,h,S,a,null)}i=p,a=v,n.multiple=!!o,i!=null?vs(n,!!o,i,!1):a!=null&&vs(n,!!o,a,!0);return;case"textarea":et("invalid",n),p=h=o=null;for(v in a)if(a.hasOwnProperty(v)&&(S=a[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(s(91));break;default:St(n,i,v,S,a,null)}fm(n,o,h,p);return;case"option":for(I in a)if(a.hasOwnProperty(I)&&(o=a[I],o!=null))switch(I){case"selected":n.selected=o&&typeof o!="function"&&typeof o!="symbol";break;default:St(n,i,I,o,a,null)}return;case"dialog":et("beforetoggle",n),et("toggle",n),et("cancel",n),et("close",n);break;case"iframe":case"object":et("load",n);break;case"video":case"audio":for(o=0;o<al.length;o++)et(al[o],n);break;case"image":et("error",n),et("load",n);break;case"details":et("toggle",n);break;case"embed":case"source":case"link":et("error",n),et("load",n);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(re in a)if(a.hasOwnProperty(re)&&(o=a[re],o!=null))switch(re){case"children":case"dangerouslySetInnerHTML":throw Error(s(137,i));default:St(n,i,re,o,a,null)}return;default:if(ac(i)){for(ce in a)a.hasOwnProperty(ce)&&(o=a[ce],o!==void 0&&Vf(n,i,ce,o,a,void 0));return}}for(S in a)a.hasOwnProperty(S)&&(o=a[S],o!=null&&St(n,i,S,o,a,null))}function vw(n,i,a,o){switch(i){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var h=null,p=null,v=null,S=null,I=null,re=null,ce=null;for(ae in a){var ge=a[ae];if(a.hasOwnProperty(ae)&&ge!=null)switch(ae){case"checked":break;case"value":break;case"defaultValue":I=ge;default:o.hasOwnProperty(ae)||St(n,i,ae,null,o,ge)}}for(var ie in o){var ae=o[ie];if(ge=a[ie],o.hasOwnProperty(ie)&&(ae!=null||ge!=null))switch(ie){case"type":p=ae;break;case"name":h=ae;break;case"checked":re=ae;break;case"defaultChecked":ce=ae;break;case"value":v=ae;break;case"defaultValue":S=ae;break;case"children":case"dangerouslySetInnerHTML":if(ae!=null)throw Error(s(137,i));break;default:ae!==ge&&St(n,i,ie,ae,o,ge)}}ic(n,v,S,I,re,ce,p,h);return;case"select":ae=v=S=ie=null;for(p in a)if(I=a[p],a.hasOwnProperty(p)&&I!=null)switch(p){case"value":break;case"multiple":ae=I;default:o.hasOwnProperty(p)||St(n,i,p,null,o,I)}for(h in o)if(p=o[h],I=a[h],o.hasOwnProperty(h)&&(p!=null||I!=null))switch(h){case"value":ie=p;break;case"defaultValue":S=p;break;case"multiple":v=p;default:p!==I&&St(n,i,h,p,o,I)}i=S,a=v,o=ae,ie!=null?vs(n,!!a,ie,!1):!!o!=!!a&&(i!=null?vs(n,!!a,i,!0):vs(n,!!a,a?[]:"",!1));return;case"textarea":ae=ie=null;for(S in a)if(h=a[S],a.hasOwnProperty(S)&&h!=null&&!o.hasOwnProperty(S))switch(S){case"value":break;case"children":break;default:St(n,i,S,null,o,h)}for(v in o)if(h=o[v],p=a[v],o.hasOwnProperty(v)&&(h!=null||p!=null))switch(v){case"value":ie=h;break;case"defaultValue":ae=h;break;case"children":break;case"dangerouslySetInnerHTML":if(h!=null)throw Error(s(91));break;default:h!==p&&St(n,i,v,h,o,p)}cm(n,ie,ae);return;case"option":for(var Me in a)if(ie=a[Me],a.hasOwnProperty(Me)&&ie!=null&&!o.hasOwnProperty(Me))switch(Me){case"selected":n.selected=!1;break;default:St(n,i,Me,null,o,ie)}for(I in o)if(ie=o[I],ae=a[I],o.hasOwnProperty(I)&&ie!==ae&&(ie!=null||ae!=null))switch(I){case"selected":n.selected=ie&&typeof ie!="function"&&typeof ie!="symbol";break;default:St(n,i,I,ie,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 Pe in a)ie=a[Pe],a.hasOwnProperty(Pe)&&ie!=null&&!o.hasOwnProperty(Pe)&&St(n,i,Pe,null,o,ie);for(re in o)if(ie=o[re],ae=a[re],o.hasOwnProperty(re)&&ie!==ae&&(ie!=null||ae!=null))switch(re){case"children":case"dangerouslySetInnerHTML":if(ie!=null)throw Error(s(137,i));break;default:St(n,i,re,ie,o,ae)}return;default:if(ac(i)){for(var _t in a)ie=a[_t],a.hasOwnProperty(_t)&&ie!==void 0&&!o.hasOwnProperty(_t)&&Vf(n,i,_t,void 0,o,ie);for(ce in o)ie=o[ce],ae=a[ce],!o.hasOwnProperty(ce)||ie===ae||ie===void 0&&ae===void 0||Vf(n,i,ce,ie,o,ae);return}}for(var Z in a)ie=a[Z],a.hasOwnProperty(Z)&&ie!=null&&!o.hasOwnProperty(Z)&&St(n,i,Z,null,o,ie);for(ge in o)ie=o[ge],ae=a[ge],!o.hasOwnProperty(ge)||ie===ae||ie==null&&ae==null||St(n,i,ge,ie,o,ae)}function my(n){switch(n){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function ww(){if(typeof performance.getEntriesByType=="function"){for(var n=0,i=0,a=performance.getEntriesByType("resource"),o=0;o<a.length;o++){var h=a[o],p=h.transferSize,v=h.initiatorType,S=h.duration;if(p&&S&&my(v)){for(v=0,S=h.responseEnd,o+=1;o<a.length;o++){var I=a[o],re=I.startTime;if(re>S)break;var ce=I.transferSize,ge=I.initiatorType;ce&&my(ge)&&(I=I.responseEnd,v+=ce*(I<S?1:(S-re)/(I-re)))}if(--o,i+=8*(p+v)/(h.duration/1e3),n++,10<n)break}}if(0<n)return i/n/1e6}return navigator.connection&&(n=navigator.connection.downlink,typeof n=="number")?n:5}var Jf=null,Xf=null;function Xo(n){return n.nodeType===9?n:n.ownerDocument}function py(n){switch(n){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function gy(n,i){if(n===0)switch(i){case"svg":return 1;case"math":return 2;default:return 0}return n===1&&i==="foreignObject"?0:n}function Kf(n,i){return n==="textarea"||n==="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 Qf=null;function Sw(){var n=window.event;return n&&n.type==="popstate"?n===Qf?!1:(Qf=n,!0):(Qf=null,!1)}var yy=typeof setTimeout=="function"?setTimeout:void 0,_w=typeof clearTimeout=="function"?clearTimeout:void 0,by=typeof Promise=="function"?Promise:void 0,kw=typeof queueMicrotask=="function"?queueMicrotask:typeof by<"u"?function(n){return by.resolve(null).then(n).catch(Ew)}:yy;function Ew(n){setTimeout(function(){throw n})}function Ci(n){return n==="head"}function xy(n,i){var a=i,o=0;do{var h=a.nextSibling;if(n.removeChild(a),h&&h.nodeType===8)if(a=h.data,a==="/$"||a==="/&"){if(o===0){n.removeChild(h),Zs(i);return}o--}else if(a==="$"||a==="$?"||a==="$~"||a==="$!"||a==="&")o++;else if(a==="html")ol(n.ownerDocument.documentElement);else if(a==="head"){a=n.ownerDocument.head,ol(a);for(var p=a.firstChild;p;){var v=p.nextSibling,S=p.nodeName;p[en]||S==="SCRIPT"||S==="STYLE"||S==="LINK"&&p.rel.toLowerCase()==="stylesheet"||a.removeChild(p),p=v}}else a==="body"&&ol(n.ownerDocument.body);a=h}while(a);Zs(i)}function vy(n,i){var a=n;n=0;do{var o=a.nextSibling;if(a.nodeType===1?i?(a._stashedDisplay=a.style.display,a.style.display="none"):(a.style.display=a._stashedDisplay||"",a.getAttribute("style")===""&&a.removeAttribute("style")):a.nodeType===3&&(i?(a._stashedText=a.nodeValue,a.nodeValue=""):a.nodeValue=a._stashedText||""),o&&o.nodeType===8)if(a=o.data,a==="/$"){if(n===0)break;n--}else a!=="$"&&a!=="$?"&&a!=="$~"&&a!=="$!"||n++;a=o}while(a)}function Zf(n){var i=n.firstChild;for(i&&i.nodeType===10&&(i=i.nextSibling);i;){var a=i;switch(i=i.nextSibling,a.nodeName){case"HTML":case"HEAD":case"BODY":Zf(a),xs(a);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(a.rel.toLowerCase()==="stylesheet")continue}n.removeChild(a)}}function Cw(n,i,a,o){for(;n.nodeType===1;){var h=a;if(n.nodeName.toLowerCase()!==i.toLowerCase()){if(!o&&(n.nodeName!=="INPUT"||n.type!=="hidden"))break}else if(o){if(!n[en])switch(i){case"meta":if(!n.hasAttribute("itemprop"))break;return n;case"link":if(p=n.getAttribute("rel"),p==="stylesheet"&&n.hasAttribute("data-precedence"))break;if(p!==h.rel||n.getAttribute("href")!==(h.href==null||h.href===""?null:h.href)||n.getAttribute("crossorigin")!==(h.crossOrigin==null?null:h.crossOrigin)||n.getAttribute("title")!==(h.title==null?null:h.title))break;return n;case"style":if(n.hasAttribute("data-precedence"))break;return n;case"script":if(p=n.getAttribute("src"),(p!==(h.src==null?null:h.src)||n.getAttribute("type")!==(h.type==null?null:h.type)||n.getAttribute("crossorigin")!==(h.crossOrigin==null?null:h.crossOrigin))&&p&&n.hasAttribute("async")&&!n.hasAttribute("itemprop"))break;return n;default:return n}}else if(i==="input"&&n.type==="hidden"){var p=h.name==null?null:""+h.name;if(h.type==="hidden"&&n.getAttribute("name")===p)return n}else return n;if(n=rr(n.nextSibling),n===null)break}return null}function Aw(n,i,a){if(i==="")return null;for(;n.nodeType!==3;)if((n.nodeType!==1||n.nodeName!=="INPUT"||n.type!=="hidden")&&!a||(n=rr(n.nextSibling),n===null))return null;return n}function wy(n,i){for(;n.nodeType!==8;)if((n.nodeType!==1||n.nodeName!=="INPUT"||n.type!=="hidden")&&!i||(n=rr(n.nextSibling),n===null))return null;return n}function Wf(n){return n.data==="$?"||n.data==="$~"}function eh(n){return n.data==="$!"||n.data==="$?"&&n.ownerDocument.readyState!=="loading"}function Tw(n,i){var a=n.ownerDocument;if(n.data==="$~")n._reactRetry=i;else if(n.data!=="$?"||a.readyState!=="loading")i();else{var o=function(){i(),a.removeEventListener("DOMContentLoaded",o)};a.addEventListener("DOMContentLoaded",o),n._reactRetry=o}}function rr(n){for(;n!=null;n=n.nextSibling){var i=n.nodeType;if(i===1||i===3)break;if(i===8){if(i=n.data,i==="$"||i==="$!"||i==="$?"||i==="$~"||i==="&"||i==="F!"||i==="F")break;if(i==="/$"||i==="/&")return null}}return n}var th=null;function Sy(n){n=n.nextSibling;for(var i=0;n;){if(n.nodeType===8){var a=n.data;if(a==="/$"||a==="/&"){if(i===0)return rr(n.nextSibling);i--}else a!=="$"&&a!=="$!"&&a!=="$?"&&a!=="$~"&&a!=="&"||i++}n=n.nextSibling}return null}function _y(n){n=n.previousSibling;for(var i=0;n;){if(n.nodeType===8){var a=n.data;if(a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"){if(i===0)return n;i--}else a!=="/$"&&a!=="/&"||i++}n=n.previousSibling}return null}function ky(n,i,a){switch(i=Xo(a),n){case"html":if(n=i.documentElement,!n)throw Error(s(452));return n;case"head":if(n=i.head,!n)throw Error(s(453));return n;case"body":if(n=i.body,!n)throw Error(s(454));return n;default:throw Error(s(451))}}function ol(n){for(var i=n.attributes;i.length;)n.removeAttributeNode(i[0]);xs(n)}var ir=new Map,Ey=new Set;function Ko(n){return typeof n.getRootNode=="function"?n.getRootNode():n.nodeType===9?n:n.ownerDocument}var Qr=ee.d;ee.d={f:jw,r:Nw,D:Ow,C:Rw,L:Mw,m:Dw,X:zw,S:Lw,M:Uw};function jw(){var n=Qr.f(),i=Ho();return n||i}function Nw(n){var i=N(n);i!==null&&i.tag===5&&i.type==="form"?Ip(i):Qr.r(n)}var Xs=typeof document>"u"?null:document;function Cy(n,i,a){var o=Xs;if(o&&typeof i=="string"&&i){var h=Kn(i);h='link[rel="'+n+'"][href="'+h+'"]',typeof a=="string"&&(h+='[crossorigin="'+a+'"]'),Ey.has(h)||(Ey.add(h),n={rel:n,crossOrigin:a,href:i},o.querySelector(h)===null&&(i=o.createElement("link"),cn(i,"link",n),Y(i),o.head.appendChild(i)))}}function Ow(n){Qr.D(n),Cy("dns-prefetch",n,null)}function Rw(n,i){Qr.C(n,i),Cy("preconnect",n,i)}function Mw(n,i,a){Qr.L(n,i,a);var o=Xs;if(o&&n&&i){var h='link[rel="preload"][as="'+Kn(i)+'"]';i==="image"&&a&&a.imageSrcSet?(h+='[imagesrcset="'+Kn(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(h+='[imagesizes="'+Kn(a.imageSizes)+'"]')):h+='[href="'+Kn(n)+'"]';var p=h;switch(i){case"style":p=Ks(n);break;case"script":p=Qs(n)}ir.has(p)||(n=g({rel:"preload",href:i==="image"&&a&&a.imageSrcSet?void 0:n,as:i},a),ir.set(p,n),o.querySelector(h)!==null||i==="style"&&o.querySelector(ul(p))||i==="script"&&o.querySelector(cl(p))||(i=o.createElement("link"),cn(i,"link",n),Y(i),o.head.appendChild(i)))}}function Dw(n,i){Qr.m(n,i);var a=Xs;if(a&&n){var o=i&&typeof i.as=="string"?i.as:"script",h='link[rel="modulepreload"][as="'+Kn(o)+'"][href="'+Kn(n)+'"]',p=h;switch(o){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":p=Qs(n)}if(!ir.has(p)&&(n=g({rel:"modulepreload",href:n},i),ir.set(p,n),a.querySelector(h)===null)){switch(o){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(cl(p)))return}o=a.createElement("link"),cn(o,"link",n),Y(o),a.head.appendChild(o)}}}function Lw(n,i,a){Qr.S(n,i,a);var o=Xs;if(o&&n){var h=z(o).hoistableStyles,p=Ks(n);i=i||"default";var v=h.get(p);if(!v){var S={loading:0,preload:null};if(v=o.querySelector(ul(p)))S.loading=5;else{n=g({rel:"stylesheet",href:n,"data-precedence":i},a),(a=ir.get(p))&&nh(n,a);var I=v=o.createElement("link");Y(I),cn(I,"link",n),I._p=new Promise(function(re,ce){I.onload=re,I.onerror=ce}),I.addEventListener("load",function(){S.loading|=1}),I.addEventListener("error",function(){S.loading|=2}),S.loading|=4,Qo(v,i,o)}v={type:"stylesheet",instance:v,count:1,state:S},h.set(p,v)}}}function zw(n,i){Qr.X(n,i);var a=Xs;if(a&&n){var o=z(a).hoistableScripts,h=Qs(n),p=o.get(h);p||(p=a.querySelector(cl(h)),p||(n=g({src:n,async:!0},i),(i=ir.get(h))&&rh(n,i),p=a.createElement("script"),Y(p),cn(p,"link",n),a.head.appendChild(p)),p={type:"script",instance:p,count:1,state:null},o.set(h,p))}}function Uw(n,i){Qr.M(n,i);var a=Xs;if(a&&n){var o=z(a).hoistableScripts,h=Qs(n),p=o.get(h);p||(p=a.querySelector(cl(h)),p||(n=g({src:n,async:!0,type:"module"},i),(i=ir.get(h))&&rh(n,i),p=a.createElement("script"),Y(p),cn(p,"link",n),a.head.appendChild(p)),p={type:"script",instance:p,count:1,state:null},o.set(h,p))}}function Ay(n,i,a,o){var h=(h=Te.current)?Ko(h):null;if(!h)throw Error(s(446));switch(n){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(i=Ks(a.href),a=z(h).hoistableStyles,o=a.get(i),o||(o={type:"style",instance:null,count:0,state:null},a.set(i,o)),o):{type:"void",instance:null,count:0,state:null};case"link":if(a.rel==="stylesheet"&&typeof a.href=="string"&&typeof a.precedence=="string"){n=Ks(a.href);var p=z(h).hoistableStyles,v=p.get(n);if(v||(h=h.ownerDocument||h,v={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},p.set(n,v),(p=h.querySelector(ul(n)))&&!p._p&&(v.instance=p,v.state.loading=5),ir.has(n)||(a={rel:"preload",as:"style",href:a.href,crossOrigin:a.crossOrigin,integrity:a.integrity,media:a.media,hrefLang:a.hrefLang,referrerPolicy:a.referrerPolicy},ir.set(n,a),p||Bw(h,n,a,v.state))),i&&o===null)throw Error(s(528,""));return v}if(i&&o!==null)throw Error(s(529,""));return null;case"script":return i=a.async,a=a.src,typeof a=="string"&&i&&typeof i!="function"&&typeof i!="symbol"?(i=Qs(a),a=z(h).hoistableScripts,o=a.get(i),o||(o={type:"script",instance:null,count:0,state:null},a.set(i,o)),o):{type:"void",instance:null,count:0,state:null};default:throw Error(s(444,n))}}function Ks(n){return'href="'+Kn(n)+'"'}function ul(n){return'link[rel="stylesheet"]['+n+"]"}function Ty(n){return g({},n,{"data-precedence":n.precedence,precedence:null})}function Bw(n,i,a,o){n.querySelector('link[rel="preload"][as="style"]['+i+"]")?o.loading=1:(i=n.createElement("link"),o.preload=i,i.addEventListener("load",function(){return o.loading|=1}),i.addEventListener("error",function(){return o.loading|=2}),cn(i,"link",a),Y(i),n.head.appendChild(i))}function Qs(n){return'[src="'+Kn(n)+'"]'}function cl(n){return"script[async]"+n}function jy(n,i,a){if(i.count++,i.instance===null)switch(i.type){case"style":var o=n.querySelector('style[data-href~="'+Kn(a.href)+'"]');if(o)return i.instance=o,Y(o),o;var h=g({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return o=(n.ownerDocument||n).createElement("style"),Y(o),cn(o,"style",h),Qo(o,a.precedence,n),i.instance=o;case"stylesheet":h=Ks(a.href);var p=n.querySelector(ul(h));if(p)return i.state.loading|=4,i.instance=p,Y(p),p;o=Ty(a),(h=ir.get(h))&&nh(o,h),p=(n.ownerDocument||n).createElement("link"),Y(p);var v=p;return v._p=new Promise(function(S,I){v.onload=S,v.onerror=I}),cn(p,"link",o),i.state.loading|=4,Qo(p,a.precedence,n),i.instance=p;case"script":return p=Qs(a.src),(h=n.querySelector(cl(p)))?(i.instance=h,Y(h),h):(o=a,(h=ir.get(p))&&(o=g({},a),rh(o,h)),n=n.ownerDocument||n,h=n.createElement("script"),Y(h),cn(h,"link",o),n.head.appendChild(h),i.instance=h);case"void":return null;default:throw Error(s(443,i.type))}else i.type==="stylesheet"&&(i.state.loading&4)===0&&(o=i.instance,i.state.loading|=4,Qo(o,a.precedence,n));return i.instance}function Qo(n,i,a){for(var o=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),h=o.length?o[o.length-1]:null,p=h,v=0;v<o.length;v++){var S=o[v];if(S.dataset.precedence===i)p=S;else if(p!==h)break}p?p.parentNode.insertBefore(n,p.nextSibling):(i=a.nodeType===9?a.head:a,i.insertBefore(n,i.firstChild))}function nh(n,i){n.crossOrigin==null&&(n.crossOrigin=i.crossOrigin),n.referrerPolicy==null&&(n.referrerPolicy=i.referrerPolicy),n.title==null&&(n.title=i.title)}function rh(n,i){n.crossOrigin==null&&(n.crossOrigin=i.crossOrigin),n.referrerPolicy==null&&(n.referrerPolicy=i.referrerPolicy),n.integrity==null&&(n.integrity=i.integrity)}var Zo=null;function Ny(n,i,a){if(Zo===null){var o=new Map,h=Zo=new Map;h.set(a,o)}else h=Zo,o=h.get(a),o||(o=new Map,h.set(a,o));if(o.has(n))return o;for(o.set(n,null),a=a.getElementsByTagName(n),h=0;h<a.length;h++){var p=a[h];if(!(p[en]||p[Ct]||n==="link"&&p.getAttribute("rel")==="stylesheet")&&p.namespaceURI!=="http://www.w3.org/2000/svg"){var v=p.getAttribute(i)||"";v=n+v;var S=o.get(v);S?S.push(p):o.set(v,[p])}}return o}function Oy(n,i,a){n=n.ownerDocument||n,n.head.insertBefore(a,i==="title"?n.querySelector("head > title"):null)}function Pw(n,i,a){if(a===1||i.itemProp!=null)return!1;switch(n){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 n=i.disabled,typeof i.precedence=="string"&&n==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 Ry(n){return!(n.type==="stylesheet"&&(n.state.loading&3)===0)}function qw(n,i,a,o){if(a.type==="stylesheet"&&(typeof o.media!="string"||matchMedia(o.media).matches!==!1)&&(a.state.loading&4)===0){if(a.instance===null){var h=Ks(o.href),p=i.querySelector(ul(h));if(p){i=p._p,i!==null&&typeof i=="object"&&typeof i.then=="function"&&(n.count++,n=Wo.bind(n),i.then(n,n)),a.state.loading|=4,a.instance=p,Y(p);return}p=i.ownerDocument||i,o=Ty(o),(h=ir.get(h))&&nh(o,h),p=p.createElement("link"),Y(p);var v=p;v._p=new Promise(function(S,I){v.onload=S,v.onerror=I}),cn(p,"link",o),a.instance=p}n.stylesheets===null&&(n.stylesheets=new Map),n.stylesheets.set(a,i),(i=a.state.preload)&&(a.state.loading&3)===0&&(n.count++,a=Wo.bind(n),i.addEventListener("load",a),i.addEventListener("error",a))}}var ih=0;function Hw(n,i){return n.stylesheets&&n.count===0&&tu(n,n.stylesheets),0<n.count||0<n.imgCount?function(a){var o=setTimeout(function(){if(n.stylesheets&&tu(n,n.stylesheets),n.unsuspend){var p=n.unsuspend;n.unsuspend=null,p()}},6e4+i);0<n.imgBytes&&ih===0&&(ih=62500*ww());var h=setTimeout(function(){if(n.waitingForImages=!1,n.count===0&&(n.stylesheets&&tu(n,n.stylesheets),n.unsuspend)){var p=n.unsuspend;n.unsuspend=null,p()}},(n.imgBytes>ih?50:800)+i);return n.unsuspend=a,function(){n.unsuspend=null,clearTimeout(o),clearTimeout(h)}}:null}function Wo(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)tu(this,this.stylesheets);else if(this.unsuspend){var n=this.unsuspend;this.unsuspend=null,n()}}}var eu=null;function tu(n,i){n.stylesheets=null,n.unsuspend!==null&&(n.count++,eu=new Map,i.forEach(Iw,n),eu=null,Wo.call(n))}function Iw(n,i){if(!(i.state.loading&4)){var a=eu.get(n);if(a)var o=a.get(null);else{a=new Map,eu.set(n,a);for(var h=n.querySelectorAll("link[data-precedence],style[data-precedence]"),p=0;p<h.length;p++){var v=h[p];(v.nodeName==="LINK"||v.getAttribute("media")!=="not all")&&(a.set(v.dataset.precedence,v),o=v)}o&&a.set(null,o)}h=i.instance,v=h.getAttribute("data-precedence"),p=a.get(v)||o,p===o&&a.set(null,h),a.set(v,h),this.count++,o=Wo.bind(this),h.addEventListener("load",o),h.addEventListener("error",o),p?p.parentNode.insertBefore(h,p.nextSibling):(n=n.nodeType===9?n.head:n,n.insertBefore(h,n.firstChild)),i.state.loading|=4}}var fl={$$typeof:F,Provider:null,Consumer:null,_currentValue:oe,_currentValue2:oe,_threadCount:0};function Fw(n,i,a,o,h,p,v,S,I){this.tag=1,this.containerInfo=n,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=si(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=si(0),this.hiddenUpdates=si(null),this.identifierPrefix=o,this.onUncaughtError=h,this.onCaughtError=p,this.onRecoverableError=v,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=I,this.incompleteTransitions=new Map}function My(n,i,a,o,h,p,v,S,I,re,ce,ge){return n=new Fw(n,i,a,v,I,re,ce,ge,S),i=1,p===!0&&(i|=24),p=Dn(3,null,null,i),n.current=p,p.stateNode=n,i=zc(),i.refCount++,n.pooledCache=i,i.refCount++,p.memoizedState={element:o,isDehydrated:a,cache:i},qc(p),n}function Dy(n){return n?(n=Ts,n):Ts}function Ly(n,i,a,o,h,p){h=Dy(h),o.context===null?o.context=h:o.pendingContext=h,o=pi(i),o.payload={element:a},p=p===void 0?null:p,p!==null&&(o.callback=p),a=gi(n,o,i),a!==null&&(jn(a,n,i),Fa(a,n,i))}function zy(n,i){if(n=n.memoizedState,n!==null&&n.dehydrated!==null){var a=n.retryLane;n.retryLane=a!==0&&a<i?a:i}}function sh(n,i){zy(n,i),(n=n.alternate)&&zy(n,i)}function Uy(n){if(n.tag===13||n.tag===31){var i=Zi(n,67108864);i!==null&&jn(i,n,67108864),sh(n,67108864)}}function By(n){if(n.tag===13||n.tag===31){var i=Pn();i=Mr(i);var a=Zi(n,i);a!==null&&jn(a,n,i),sh(n,i)}}var nu=!0;function $w(n,i,a,o){var h=H.T;H.T=null;var p=ee.p;try{ee.p=2,ah(n,i,a,o)}finally{ee.p=p,H.T=h}}function Yw(n,i,a,o){var h=H.T;H.T=null;var p=ee.p;try{ee.p=8,ah(n,i,a,o)}finally{ee.p=p,H.T=h}}function ah(n,i,a,o){if(nu){var h=lh(o);if(h===null)Gf(n,i,o,ru,a),qy(n,o);else if(Vw(h,n,i,a,o))o.stopPropagation();else if(qy(n,o),i&4&&-1<Gw.indexOf(n)){for(;h!==null;){var p=N(h);if(p!==null)switch(p.tag){case 3:if(p=p.stateNode,p.current.memoizedState.isDehydrated){var v=ur(p.pendingLanes);if(v!==0){var S=p;for(S.pendingLanes|=2,S.entangledLanes|=2;v;){var I=1<<31-de(v);S.entanglements[1]|=I,v&=~I}Cr(p),(pt&6)===0&&(Po=ht()+500,sl(0))}}break;case 31:case 13:S=Zi(p,2),S!==null&&jn(S,p,2),Ho(),sh(p,2)}if(p=lh(o),p===null&&Gf(n,i,o,ru,a),p===h)break;h=p}h!==null&&o.stopPropagation()}else Gf(n,i,o,null,a)}}function lh(n){return n=oc(n),oh(n)}var ru=null;function oh(n){if(ru=null,n=k(n),n!==null){var i=u(n);if(i===null)n=null;else{var a=i.tag;if(a===13){if(n=c(i),n!==null)return n;n=null}else if(a===31){if(n=f(i),n!==null)return n;n=null}else if(a===3){if(i.stateNode.current.memoizedState.isDehydrated)return i.tag===3?i.stateNode.containerInfo:null;n=null}else i!==n&&(n=null)}}return ru=n,null}function Py(n){switch(n){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(Fi()){case fe:return 2;case ve:return 8;case Ue:case Je:return 32;case lt:return 268435456;default:return 32}default:return 32}}var uh=!1,Ai=null,Ti=null,ji=null,hl=new Map,dl=new Map,Ni=[],Gw="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 qy(n,i){switch(n){case"focusin":case"focusout":Ai=null;break;case"dragenter":case"dragleave":Ti=null;break;case"mouseover":case"mouseout":ji=null;break;case"pointerover":case"pointerout":hl.delete(i.pointerId);break;case"gotpointercapture":case"lostpointercapture":dl.delete(i.pointerId)}}function ml(n,i,a,o,h,p){return n===null||n.nativeEvent!==p?(n={blockedOn:i,domEventName:a,eventSystemFlags:o,nativeEvent:p,targetContainers:[h]},i!==null&&(i=N(i),i!==null&&Uy(i)),n):(n.eventSystemFlags|=o,i=n.targetContainers,h!==null&&i.indexOf(h)===-1&&i.push(h),n)}function Vw(n,i,a,o,h){switch(i){case"focusin":return Ai=ml(Ai,n,i,a,o,h),!0;case"dragenter":return Ti=ml(Ti,n,i,a,o,h),!0;case"mouseover":return ji=ml(ji,n,i,a,o,h),!0;case"pointerover":var p=h.pointerId;return hl.set(p,ml(hl.get(p)||null,n,i,a,o,h)),!0;case"gotpointercapture":return p=h.pointerId,dl.set(p,ml(dl.get(p)||null,n,i,a,o,h)),!0}return!1}function Hy(n){var i=k(n.target);if(i!==null){var a=u(i);if(a!==null){if(i=a.tag,i===13){if(i=c(a),i!==null){n.blockedOn=i,Xl(n.priority,function(){By(a)});return}}else if(i===31){if(i=f(a),i!==null){n.blockedOn=i,Xl(n.priority,function(){By(a)});return}}else if(i===3&&a.stateNode.current.memoizedState.isDehydrated){n.blockedOn=a.tag===3?a.stateNode.containerInfo:null;return}}}n.blockedOn=null}function iu(n){if(n.blockedOn!==null)return!1;for(var i=n.targetContainers;0<i.length;){var a=lh(n.nativeEvent);if(a===null){a=n.nativeEvent;var o=new a.constructor(a.type,a);lc=o,a.target.dispatchEvent(o),lc=null}else return i=N(a),i!==null&&Uy(i),n.blockedOn=a,!1;i.shift()}return!0}function Iy(n,i,a){iu(n)&&a.delete(i)}function Jw(){uh=!1,Ai!==null&&iu(Ai)&&(Ai=null),Ti!==null&&iu(Ti)&&(Ti=null),ji!==null&&iu(ji)&&(ji=null),hl.forEach(Iy),dl.forEach(Iy)}function su(n,i){n.blockedOn===i&&(n.blockedOn=null,uh||(uh=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,Jw)))}var au=null;function Fy(n){au!==n&&(au=n,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){au===n&&(au=null);for(var i=0;i<n.length;i+=3){var a=n[i],o=n[i+1],h=n[i+2];if(typeof o!="function"){if(oh(o||a)===null)continue;break}var p=N(a);p!==null&&(n.splice(i,3),i-=3,lf(p,{pending:!0,data:h,method:a.method,action:o},o,h))}}))}function Zs(n){function i(I){return su(I,n)}Ai!==null&&su(Ai,n),Ti!==null&&su(Ti,n),ji!==null&&su(ji,n),hl.forEach(i),dl.forEach(i);for(var a=0;a<Ni.length;a++){var o=Ni[a];o.blockedOn===n&&(o.blockedOn=null)}for(;0<Ni.length&&(a=Ni[0],a.blockedOn===null);)Hy(a),a.blockedOn===null&&Ni.shift();if(a=(n.ownerDocument||n).$$reactFormReplay,a!=null)for(o=0;o<a.length;o+=3){var h=a[o],p=a[o+1],v=h[It]||null;if(typeof p=="function")v||Fy(a);else if(v){var S=null;if(p&&p.hasAttribute("formAction")){if(h=p,v=p[It]||null)S=v.formAction;else if(oh(h)!==null)continue}else S=v.action;typeof S=="function"?a[o+1]=S:(a.splice(o,3),o-=3),Fy(a)}}}function $y(){function n(p){p.canIntercept&&p.info==="react-transition"&&p.intercept({handler:function(){return new Promise(function(v){return h=v})},focusReset:"manual",scroll:"manual"})}function i(){h!==null&&(h(),h=null),o||setTimeout(a,20)}function a(){if(!o&&!navigation.transition){var p=navigation.currentEntry;p&&p.url!=null&&navigation.navigate(p.url,{state:p.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var o=!1,h=null;return navigation.addEventListener("navigate",n),navigation.addEventListener("navigatesuccess",i),navigation.addEventListener("navigateerror",i),setTimeout(a,100),function(){o=!0,navigation.removeEventListener("navigate",n),navigation.removeEventListener("navigatesuccess",i),navigation.removeEventListener("navigateerror",i),h!==null&&(h(),h=null)}}}function ch(n){this._internalRoot=n}lu.prototype.render=ch.prototype.render=function(n){var i=this._internalRoot;if(i===null)throw Error(s(409));var a=i.current,o=Pn();Ly(a,o,n,i,null,null)},lu.prototype.unmount=ch.prototype.unmount=function(){var n=this._internalRoot;if(n!==null){this._internalRoot=null;var i=n.containerInfo;Ly(n.current,2,null,n,null,null),Ho(),i[Rn]=null}};function lu(n){this._internalRoot=n}lu.prototype.unstable_scheduleHydration=function(n){if(n){var i=Ca();n={blockedOn:null,target:n,priority:i};for(var a=0;a<Ni.length&&i!==0&&i<Ni[a].priority;a++);Ni.splice(a,0,n),a===0&&Hy(n)}};var Yy=t.version;if(Yy!=="19.2.4")throw Error(s(527,Yy,"19.2.4"));ee.findDOMNode=function(n){var i=n._reactInternals;if(i===void 0)throw typeof n.render=="function"?Error(s(188)):(n=Object.keys(n).join(","),Error(s(268,n)));return n=d(i),n=n!==null?y(n):null,n=n===null?null:n.stateNode,n};var Xw={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:H,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var ou=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!ou.isDisabled&&ou.supportsFiber)try{Wt=ou.inject(Xw),yt=ou}catch{}}return gl.createRoot=function(n,i){if(!l(n))throw Error(s(299));var a=!1,o="",h=Zp,p=Wp,v=eg;return i!=null&&(i.unstable_strictMode===!0&&(a=!0),i.identifierPrefix!==void 0&&(o=i.identifierPrefix),i.onUncaughtError!==void 0&&(h=i.onUncaughtError),i.onCaughtError!==void 0&&(p=i.onCaughtError),i.onRecoverableError!==void 0&&(v=i.onRecoverableError)),i=My(n,1,!1,null,null,a,o,null,h,p,v,$y),n[Rn]=i.current,Yf(n),new ch(i)},gl.hydrateRoot=function(n,i,a){if(!l(n))throw Error(s(299));var o=!1,h="",p=Zp,v=Wp,S=eg,I=null;return a!=null&&(a.unstable_strictMode===!0&&(o=!0),a.identifierPrefix!==void 0&&(h=a.identifierPrefix),a.onUncaughtError!==void 0&&(p=a.onUncaughtError),a.onCaughtError!==void 0&&(v=a.onCaughtError),a.onRecoverableError!==void 0&&(S=a.onRecoverableError),a.formState!==void 0&&(I=a.formState)),i=My(n,1,!0,i,a??null,o,h,I,p,v,S,$y),i.context=Dy(null),a=i.current,o=Pn(),o=Mr(o),h=pi(o),h.callback=null,gi(a,h,o),a=o,i.current.lanes=a,cr(i,a),Cr(i),n[Rn]=i.current,Yf(n),new lu(i)},gl.version="19.2.4",gl}var t0;function aS(){if(t0)return dh.exports;t0=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),dh.exports=sS(),dh.exports}var lS=aS();/**
|
|
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 n0="popstate";function r0(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function oS(e={}){function t(s,l){var d;let u=(d=l.state)==null?void 0:d.masked,{pathname:c,search:f,hash:m}=u||s.location;return Kh("",{pathname:c,search:f,hash:m},l.state&&l.state.usr||null,l.state&&l.state.key||"default",u?{pathname:s.location.pathname,search:s.location.search,hash:s.location.hash}:void 0)}function r(s,l){return typeof l=="string"?l:Dl(l)}return cS(t,r,null,e)}function Bt(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function vr(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function uS(){return Math.random().toString(36).substring(2,10)}function i0(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.unstable_mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function Kh(e,t,r=null,s,l){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?xa(t):t,state:r,key:t&&t.key||s||uS(),unstable_mask:l}}function Dl({pathname:e="/",search:t="",hash:r=""}){return t&&t!=="?"&&(e+=t.charAt(0)==="?"?t:"?"+t),r&&r!=="#"&&(e+=r.charAt(0)==="#"?r:"#"+r),e}function xa(e){let t={};if(e){let r=e.indexOf("#");r>=0&&(t.hash=e.substring(r),e=e.substring(0,r));let s=e.indexOf("?");s>=0&&(t.search=e.substring(s),e=e.substring(0,s)),e&&(t.pathname=e)}return t}function cS(e,t,r,s={}){let{window:l=document.defaultView,v5Compat:u=!1}=s,c=l.history,f="POP",m=null,d=y();d==null&&(d=0,c.replaceState({...c.state,idx:d},""));function y(){return(c.state||{idx:null}).idx}function g(){f="POP";let B=y(),D=B==null?null:B-d;d=B,m&&m({action:f,location:R.location,delta:D})}function x(B,D){f="PUSH";let P=r0(B)?B:Kh(R.location,B,D);d=y()+1;let F=i0(P,d),ue=R.createHref(P.unstable_mask||P);try{c.pushState(F,"",ue)}catch(U){if(U instanceof DOMException&&U.name==="DataCloneError")throw U;l.location.assign(ue)}u&&m&&m({action:f,location:R.location,delta:1})}function w(B,D){f="REPLACE";let P=r0(B)?B:Kh(R.location,B,D);d=y();let F=i0(P,d),ue=R.createHref(P.unstable_mask||P);c.replaceState(F,"",ue),u&&m&&m({action:f,location:R.location,delta:0})}function E(B){return fS(B)}let R={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(n0,g),m=B,()=>{l.removeEventListener(n0,g),m=null}},createHref(B){return t(l,B)},createURL:E,encodeLocation(B){let D=E(B);return{pathname:D.pathname,search:D.search,hash:D.hash}},push:x,replace:w,go(B){return c.go(B)}};return R}function fS(e,t=!1){let r="http://localhost";typeof window<"u"&&(r=window.location.origin!=="null"?window.location.origin:window.location.href),Bt(r,"No window.location.(origin|href) available to create URL");let s=typeof e=="string"?e:Dl(e);return s=s.replace(/ $/,"%20"),!t&&s.startsWith("//")&&(s=r+s),new URL(s,r)}function Fb(e,t,r="/"){return hS(e,t,r,!1)}function hS(e,t,r,s){let l=typeof t=="string"?xa(t):t,u=ti(l.pathname||"/",r);if(u==null)return null;let c=$b(e);dS(c);let f=null;for(let m=0;f==null&&m<c.length;++m){let d=kS(u);f=SS(c[m],d,s)}return f}function $b(e,t=[],r=[],s="",l=!1){let u=(c,f,m=l,d)=>{let y={relativePath:d===void 0?c.path||"":d,caseSensitive:c.caseSensitive===!0,childrenIndex:f,route:c};if(y.relativePath.startsWith("/")){if(!y.relativePath.startsWith(s)&&m)return;Bt(y.relativePath.startsWith(s),`Absolute route path "${y.relativePath}" nested under path "${s}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),y.relativePath=y.relativePath.slice(s.length)}let g=Nr([s,y.relativePath]),x=r.concat(y);c.children&&c.children.length>0&&(Bt(c.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${g}".`),$b(c.children,t,x,g,m)),!(c.path==null&&!c.index)&&t.push({path:g,score:vS(g,c.index),routesMeta:x})};return e.forEach((c,f)=>{var m;if(c.path===""||!((m=c.path)!=null&&m.includes("?")))u(c,f);else for(let d of Yb(c.path))u(c,f,!0,d)}),t}function Yb(e){let t=e.split("/");if(t.length===0)return[];let[r,...s]=t,l=r.endsWith("?"),u=r.replace(/\?$/,"");if(s.length===0)return l?[u,""]:[u];let c=Yb(s.join("/")),f=[];return f.push(...c.map(m=>m===""?u:[u,m].join("/"))),l&&f.push(...c),f.map(m=>e.startsWith("/")&&m===""?"/":m)}function dS(e){e.sort((t,r)=>t.score!==r.score?r.score-t.score:wS(t.routesMeta.map(s=>s.childrenIndex),r.routesMeta.map(s=>s.childrenIndex)))}var mS=/^:[\w-]+$/,pS=3,gS=2,yS=1,bS=10,xS=-2,s0=e=>e==="*";function vS(e,t){let r=e.split("/"),s=r.length;return r.some(s0)&&(s+=xS),t&&(s+=gS),r.filter(l=>!s0(l)).reduce((l,u)=>l+(mS.test(u)?pS:u===""?yS:bS),s)}function wS(e,t){return e.length===t.length&&e.slice(0,-1).every((s,l)=>s===t[l])?e[e.length-1]-t[t.length-1]:0}function SS(e,t,r=!1){let{routesMeta:s}=e,l={},u="/",c=[];for(let f=0;f<s.length;++f){let m=s[f],d=f===s.length-1,y=u==="/"?t:t.slice(u.length)||"/",g=Cu({path:m.relativePath,caseSensitive:m.caseSensitive,end:d},y),x=m.route;if(!g&&d&&r&&!s[s.length-1].route.index&&(g=Cu({path:m.relativePath,caseSensitive:m.caseSensitive,end:!1},y)),!g)return null;Object.assign(l,g.params),c.push({params:l,pathname:Nr([u,g.pathname]),pathnameBase:TS(Nr([u,g.pathnameBase])),route:x}),g.pathnameBase!=="/"&&(u=Nr([u,g.pathnameBase]))}return c}function Cu(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[r,s]=_S(e.path,e.caseSensitive,e.end),l=t.match(r);if(!l)return null;let u=l[0],c=u.replace(/(.)\/+$/,"$1"),f=l.slice(1);return{params:s.reduce((d,{paramName:y,isOptional:g},x)=>{if(y==="*"){let E=f[x]||"";c=u.slice(0,u.length-E.length).replace(/(.)\/+$/,"$1")}const w=f[x];return g&&!w?d[y]=void 0:d[y]=(w||"").replace(/%2F/g,"/"),d},{}),pathname:u,pathnameBase:c,pattern:e}}function _S(e,t=!1,r=!0){vr(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let s=[],l="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(c,f,m,d,y)=>{if(s.push({paramName:f,isOptional:m!=null}),m){let g=y.charAt(d+c.length);return g&&g!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(s.push({paramName:"*"}),l+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?l+="\\/*$":e!==""&&e!=="/"&&(l+="(?:(?=\\/|$))"),[new RegExp(l,t?void 0:"i"),s]}function kS(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return vr(!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 (${t}).`),e}}function ti(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let r=t.endsWith("/")?t.length-1:t.length,s=e.charAt(r);return s&&s!=="/"?null:e.slice(r)||"/"}var ES=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function CS(e,t="/"){let{pathname:r,search:s="",hash:l=""}=typeof e=="string"?xa(e):e,u;return r?(r=r.replace(/\/\/+/g,"/"),r.startsWith("/")?u=a0(r.substring(1),"/"):u=a0(r,t)):u=t,{pathname:u,search:jS(s),hash:NS(l)}}function a0(e,t){let r=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(l=>{l===".."?r.length>1&&r.pop():l!=="."&&r.push(l)}),r.length>1?r.join("/"):"/"}function yh(e,t,r,s){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(s)}]. Please separate it out to the \`to.${r}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function AS(e){return e.filter((t,r)=>r===0||t.route.path&&t.route.path.length>0)}function Cd(e){let t=AS(e);return t.map((r,s)=>s===t.length-1?r.pathname:r.pathnameBase)}function Fu(e,t,r,s=!1){let l;typeof e=="string"?l=xa(e):(l={...e},Bt(!l.pathname||!l.pathname.includes("?"),yh("?","pathname","search",l)),Bt(!l.pathname||!l.pathname.includes("#"),yh("#","pathname","hash",l)),Bt(!l.search||!l.search.includes("#"),yh("#","search","hash",l)));let u=e===""||l.pathname==="",c=u?"/":l.pathname,f;if(c==null)f=r;else{let g=t.length-1;if(!s&&c.startsWith("..")){let x=c.split("/");for(;x[0]==="..";)x.shift(),g-=1;l.pathname=x.join("/")}f=g>=0?t[g]:"/"}let m=CS(l,f),d=c&&c!=="/"&&c.endsWith("/"),y=(u||c===".")&&r.endsWith("/");return!m.pathname.endsWith("/")&&(d||y)&&(m.pathname+="/"),m}var Nr=e=>e.join("/").replace(/\/\/+/g,"/"),TS=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),jS=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,NS=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,OS=class{constructor(e,t,r,s=!1){this.status=e,this.statusText=t||"",this.internal=s,r instanceof Error?(this.data=r.toString(),this.error=r):this.data=r}};function RS(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function MS(e){return e.map(t=>t.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var Gb=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Vb(e,t){let r=e;if(typeof r!="string"||!ES.test(r))return{absoluteURL:void 0,isExternal:!1,to:r};let s=r,l=!1;if(Gb)try{let u=new URL(window.location.href),c=r.startsWith("//")?new URL(u.protocol+r):new URL(r),f=ti(c.pathname,t);c.origin===u.origin&&f!=null?r=f+c.search+c.hash:l=!0}catch{vr(!1,`<Link to="${r}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:s,isExternal:l,to:r}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var Jb=["POST","PUT","PATCH","DELETE"];new Set(Jb);var DS=["GET",...Jb];new Set(DS);var va=j.createContext(null);va.displayName="DataRouter";var $u=j.createContext(null);$u.displayName="DataRouterState";var LS=j.createContext(!1),Xb=j.createContext({isTransitioning:!1});Xb.displayName="ViewTransition";var zS=j.createContext(new Map);zS.displayName="Fetchers";var US=j.createContext(null);US.displayName="Await";var Jn=j.createContext(null);Jn.displayName="Navigation";var Il=j.createContext(null);Il.displayName="Location";var wr=j.createContext({outlet:null,matches:[],isDataRoute:!1});wr.displayName="Route";var Ad=j.createContext(null);Ad.displayName="RouteError";var Kb="REACT_ROUTER_ERROR",BS="REDIRECT",PS="ROUTE_ERROR_RESPONSE";function qS(e){if(e.startsWith(`${Kb}:${BS}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.location=="string"&&typeof t.reloadDocument=="boolean"&&typeof t.replace=="boolean")return t}catch{}}function HS(e){if(e.startsWith(`${Kb}:${PS}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new OS(t.status,t.statusText,t.data)}catch{}}function IS(e,{relative:t}={}){Bt(wa(),"useHref() may be used only in the context of a <Router> component.");let{basename:r,navigator:s}=j.useContext(Jn),{hash:l,pathname:u,search:c}=Fl(e,{relative:t}),f=u;return r!=="/"&&(f=u==="/"?r:Nr([r,u])),s.createHref({pathname:f,search:c,hash:l})}function wa(){return j.useContext(Il)!=null}function or(){return Bt(wa(),"useLocation() may be used only in the context of a <Router> component."),j.useContext(Il).location}var Qb="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function Zb(e){j.useContext(Jn).static||j.useLayoutEffect(e)}function Or(){let{isDataRoute:e}=j.useContext(wr);return e?t_():FS()}function FS(){Bt(wa(),"useNavigate() may be used only in the context of a <Router> component.");let e=j.useContext(va),{basename:t,navigator:r}=j.useContext(Jn),{matches:s}=j.useContext(wr),{pathname:l}=or(),u=JSON.stringify(Cd(s)),c=j.useRef(!1);return Zb(()=>{c.current=!0}),j.useCallback((m,d={})=>{if(vr(c.current,Qb),!c.current)return;if(typeof m=="number"){r.go(m);return}let y=Fu(m,JSON.parse(u),l,d.relative==="path");e==null&&t!=="/"&&(y.pathname=y.pathname==="/"?t:Nr([t,y.pathname])),(d.replace?r.replace:r.push)(y,d.state,d)},[t,r,u,l,e])}j.createContext(null);function Yu(){let{matches:e}=j.useContext(wr),t=e[e.length-1];return t?t.params:{}}function Fl(e,{relative:t}={}){let{matches:r}=j.useContext(wr),{pathname:s}=or(),l=JSON.stringify(Cd(r));return j.useMemo(()=>Fu(e,JSON.parse(l),s,t==="path"),[e,l,s,t])}function $S(e,t){return Wb(e,t)}function Wb(e,t,r){var B;Bt(wa(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:s}=j.useContext(Jn),{matches:l}=j.useContext(wr),u=l[l.length-1],c=u?u.params:{},f=u?u.pathname:"/",m=u?u.pathnameBase:"/",d=u&&u.route;{let D=d&&d.path||"";tx(f,!d||D.endsWith("*")||D.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${f}" (under <Route path="${D}">) 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="${D}"> to <Route path="${D==="/"?"*":`${D}/*`}">.`)}let y=or(),g;if(t){let D=typeof t=="string"?xa(t):t;Bt(m==="/"||((B=D.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 "${D.pathname}" was given in the \`location\` prop.`),g=D}else g=y;let x=g.pathname||"/",w=x;if(m!=="/"){let D=m.replace(/^\//,"").split("/");w="/"+x.replace(/^\//,"").split("/").slice(D.length).join("/")}let E=Fb(e,{pathname:w});vr(d||E!=null,`No routes matched location "${g.pathname}${g.search}${g.hash}" `),vr(E==null||E[E.length-1].route.element!==void 0||E[E.length-1].route.Component!==void 0||E[E.length-1].route.lazy!==void 0,`Matched leaf route at location "${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 R=XS(E&&E.map(D=>Object.assign({},D,{params:Object.assign({},c,D.params),pathname:Nr([m,s.encodeLocation?s.encodeLocation(D.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:D.pathname]),pathnameBase:D.pathnameBase==="/"?m:Nr([m,s.encodeLocation?s.encodeLocation(D.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:D.pathnameBase])})),l,r);return t&&R?j.createElement(Il.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,...g},navigationType:"POP"}},R):R}function YS(){let e=e_(),t=RS(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),r=e instanceof Error?e.stack:null,s="rgba(200,200,200, 0.5)",l={padding:"0.5rem",backgroundColor:s},u={padding:"2px 4px",backgroundColor:s},c=null;return console.error("Error handled by React Router default ErrorBoundary:",e),c=j.createElement(j.Fragment,null,j.createElement("p",null,"💿 Hey developer 👋"),j.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",j.createElement("code",{style:u},"ErrorBoundary")," or"," ",j.createElement("code",{style:u},"errorElement")," prop on your route.")),j.createElement(j.Fragment,null,j.createElement("h2",null,"Unexpected Application Error!"),j.createElement("h3",{style:{fontStyle:"italic"}},t),r?j.createElement("pre",{style:l},r):null,c)}var GS=j.createElement(YS,null),ex=class extends j.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,t){return t.location!==e.location||t.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):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=HS(e.digest);r&&(e=r)}let t=e!==void 0?j.createElement(wr.Provider,{value:this.props.routeContext},j.createElement(Ad.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?j.createElement(VS,{error:e},t):t}};ex.contextType=LS;var bh=new WeakMap;function VS({children:e,error:t}){let{basename:r}=j.useContext(Jn);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let s=qS(t.digest);if(s){let l=bh.get(t);if(l)throw l;let u=Vb(s.location,r);if(Gb&&!bh.get(t))if(u.isExternal||s.reloadDocument)window.location.href=u.absoluteURL||u.to;else{const c=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(u.to,{replace:s.replace}));throw bh.set(t,c),c}return j.createElement("meta",{httpEquiv:"refresh",content:`0;url=${u.absoluteURL||u.to}`})}}return e}function JS({routeContext:e,match:t,children:r}){let s=j.useContext(va);return s&&s.static&&s.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(s.staticContext._deepestRenderedBoundaryId=t.route.id),j.createElement(wr.Provider,{value:e},r)}function XS(e,t=[],r){let s=r==null?void 0:r.state;if(e==null){if(!s)return null;if(s.errors)e=s.matches;else if(t.length===0&&!s.initialized&&s.matches.length>0)e=s.matches;else return null}let l=e,u=s==null?void 0:s.errors;if(u!=null){let y=l.findIndex(g=>g.route.id&&(u==null?void 0:u[g.route.id])!==void 0);Bt(y>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(u).join(",")}`),l=l.slice(0,Math.min(l.length,y+1))}let c=!1,f=-1;if(r&&s){c=s.renderFallback;for(let y=0;y<l.length;y++){let g=l[y];if((g.route.HydrateFallback||g.route.hydrateFallbackElement)&&(f=y),g.route.id){let{loaderData:x,errors:w}=s,E=g.route.loader&&!x.hasOwnProperty(g.route.id)&&(!w||w[g.route.id]===void 0);if(g.route.lazy||E){r.isStatic&&(c=!0),f>=0?l=l.slice(0,f+1):l=[l[0]];break}}}}let m=r==null?void 0:r.onError,d=s&&m?(y,g)=>{var x,w;m(y,{location:s.location,params:((w=(x=s.matches)==null?void 0:x[0])==null?void 0:w.params)??{},unstable_pattern:MS(s.matches),errorInfo:g})}:void 0;return l.reduceRight((y,g,x)=>{let w,E=!1,R=null,B=null;s&&(w=u&&g.route.id?u[g.route.id]:void 0,R=g.route.errorElement||GS,c&&(f<0&&x===0?(tx("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),E=!0,B=null):f===x&&(E=!0,B=g.route.hydrateFallbackElement||null)));let D=t.concat(l.slice(0,x+1)),P=()=>{let F;return w?F=R:E?F=B:g.route.Component?F=j.createElement(g.route.Component,null):g.route.element?F=g.route.element:F=y,j.createElement(JS,{match:g,routeContext:{outlet:y,matches:D,isDataRoute:s!=null},children:F})};return s&&(g.route.ErrorBoundary||g.route.errorElement||x===0)?j.createElement(ex,{location:s.location,revalidation:s.revalidation,component:R,error:w,children:P(),routeContext:{outlet:null,matches:D,isDataRoute:!0},onError:d}):P()},null)}function Td(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function KS(e){let t=j.useContext(va);return Bt(t,Td(e)),t}function QS(e){let t=j.useContext($u);return Bt(t,Td(e)),t}function ZS(e){let t=j.useContext(wr);return Bt(t,Td(e)),t}function jd(e){let t=ZS(e),r=t.matches[t.matches.length-1];return Bt(r.route.id,`${e} can only be used on routes that contain a unique "id"`),r.route.id}function WS(){return jd("useRouteId")}function e_(){var s;let e=j.useContext(Ad),t=QS("useRouteError"),r=jd("useRouteError");return e!==void 0?e:(s=t.errors)==null?void 0:s[r]}function t_(){let{router:e}=KS("useNavigate"),t=jd("useNavigate"),r=j.useRef(!1);return Zb(()=>{r.current=!0}),j.useCallback(async(l,u={})=>{vr(r.current,Qb),r.current&&(typeof l=="number"?await e.navigate(l):await e.navigate(l,{fromRouteId:t,...u}))},[e,t])}var l0={};function tx(e,t,r){!t&&!l0[e]&&(l0[e]=!0,vr(!1,r))}j.memo(n_);function n_({routes:e,future:t,state:r,isStatic:s,onError:l}){return Wb(e,void 0,{state:r,isStatic:s,onError:l})}function Ll({to:e,replace:t,state:r,relative:s}){Bt(wa(),"<Navigate> may be used only in the context of a <Router> component.");let{static:l}=j.useContext(Jn);vr(!l,"<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.");let{matches:u}=j.useContext(wr),{pathname:c}=or(),f=Or(),m=Fu(e,Cd(u),c,s==="path"),d=JSON.stringify(m);return j.useEffect(()=>{f(JSON.parse(d),{replace:t,state:r,relative:s})},[f,d,s,t,r]),null}function gr(e){Bt(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function r_({basename:e="/",children:t=null,location:r,navigationType:s="POP",navigator:l,static:u=!1,unstable_useTransitions:c}){Bt(!wa(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let f=e.replace(/^\/*/,"/"),m=j.useMemo(()=>({basename:f,navigator:l,static:u,unstable_useTransitions:c,future:{}}),[f,l,u,c]);typeof r=="string"&&(r=xa(r));let{pathname:d="/",search:y="",hash:g="",state:x=null,key:w="default",unstable_mask:E}=r,R=j.useMemo(()=>{let B=ti(d,f);return B==null?null:{location:{pathname:B,search:y,hash:g,state:x,key:w,unstable_mask:E},navigationType:s}},[f,d,y,g,x,w,s,E]);return vr(R!=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.`),R==null?null:j.createElement(Jn.Provider,{value:m},j.createElement(Il.Provider,{children:t,value:R}))}function nx({children:e,location:t}){return $S(Qh(e),t)}function Qh(e,t=[]){let r=[];return j.Children.forEach(e,(s,l)=>{if(!j.isValidElement(s))return;let u=[...t,l];if(s.type===j.Fragment){r.push.apply(r,Qh(s.props.children,u));return}Bt(s.type===gr,`[${typeof s.type=="string"?s.type:s.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),Bt(!s.props.index||!s.props.children,"An index route cannot have child routes.");let c={id:s.props.id||u.join("-"),caseSensitive:s.props.caseSensitive,element:s.props.element,Component:s.props.Component,index:s.props.index,path:s.props.path,middleware:s.props.middleware,loader:s.props.loader,action:s.props.action,hydrateFallbackElement:s.props.hydrateFallbackElement,HydrateFallback:s.props.HydrateFallback,errorElement:s.props.errorElement,ErrorBoundary:s.props.ErrorBoundary,hasErrorBoundary:s.props.hasErrorBoundary===!0||s.props.ErrorBoundary!=null||s.props.errorElement!=null,shouldRevalidate:s.props.shouldRevalidate,handle:s.props.handle,lazy:s.props.lazy};s.props.children&&(c.children=Qh(s.props.children,u)),r.push(c)}),r}var vu="get",wu="application/x-www-form-urlencoded";function Gu(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function i_(e){return Gu(e)&&e.tagName.toLowerCase()==="button"}function s_(e){return Gu(e)&&e.tagName.toLowerCase()==="form"}function a_(e){return Gu(e)&&e.tagName.toLowerCase()==="input"}function l_(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function o_(e,t){return e.button===0&&(!t||t==="_self")&&!l_(e)}var uu=null;function u_(){if(uu===null)try{new FormData(document.createElement("form"),0),uu=!1}catch{uu=!0}return uu}var c_=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function xh(e){return e!=null&&!c_.has(e)?(vr(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${wu}"`),null):e}function f_(e,t){let r,s,l,u,c;if(s_(e)){let f=e.getAttribute("action");s=f?ti(f,t):null,r=e.getAttribute("method")||vu,l=xh(e.getAttribute("enctype"))||wu,u=new FormData(e)}else if(i_(e)||a_(e)&&(e.type==="submit"||e.type==="image")){let f=e.form;if(f==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let m=e.getAttribute("formaction")||f.getAttribute("action");if(s=m?ti(m,t):null,r=e.getAttribute("formmethod")||f.getAttribute("method")||vu,l=xh(e.getAttribute("formenctype"))||xh(f.getAttribute("enctype"))||wu,u=new FormData(f,e),!u_()){let{name:d,type:y,value:g}=e;if(y==="image"){let x=d?`${d}.`:"";u.append(`${x}x`,"0"),u.append(`${x}y`,"0")}else d&&u.append(d,g)}}else{if(Gu(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');r=vu,s=null,l=wu,c=e}return u&&l==="text/plain"&&(c=u,u=void 0),{action:s,method:r.toLowerCase(),encType:l,formData:u,body:c}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function Nd(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function h_(e,t,r,s){let l=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return r?l.pathname.endsWith("/")?l.pathname=`${l.pathname}_.${s}`:l.pathname=`${l.pathname}.${s}`:l.pathname==="/"?l.pathname=`_root.${s}`:t&&ti(l.pathname,t)==="/"?l.pathname=`${t.replace(/\/$/,"")}/_root.${s}`:l.pathname=`${l.pathname.replace(/\/$/,"")}.${s}`,l}async function d_(e,t){if(e.id in t)return t[e.id];try{let r=await import(e.module);return t[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 m_(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 p_(e,t,r){let s=await Promise.all(e.map(async l=>{let u=t.routes[l.route.id];if(u){let c=await d_(u,r);return c.links?c.links():[]}return[]}));return x_(s.flat(1).filter(m_).filter(l=>l.rel==="stylesheet"||l.rel==="preload").map(l=>l.rel==="stylesheet"?{...l,rel:"prefetch",as:"style"}:{...l,rel:"prefetch"}))}function o0(e,t,r,s,l,u){let c=(m,d)=>r[d]?m.route.id!==r[d].route.id:!0,f=(m,d)=>{var y;return r[d].pathname!==m.pathname||((y=r[d].route.path)==null?void 0:y.endsWith("*"))&&r[d].params["*"]!==m.params["*"]};return u==="assets"?t.filter((m,d)=>c(m,d)||f(m,d)):u==="data"?t.filter((m,d)=>{var g;let y=s.routes[m.route.id];if(!y||!y.hasLoader)return!1;if(c(m,d)||f(m,d))return!0;if(m.route.shouldRevalidate){let x=m.route.shouldRevalidate({currentUrl:new URL(l.pathname+l.search+l.hash,window.origin),currentParams:((g=r[0])==null?void 0:g.params)||{},nextUrl:new URL(e,window.origin),nextParams:m.params,defaultShouldRevalidate:!0});if(typeof x=="boolean")return x}return!0}):[]}function g_(e,t,{includeHydrateFallback:r}={}){return y_(e.map(s=>{let l=t.routes[s.route.id];if(!l)return[];let u=[l.module];return l.clientActionModule&&(u=u.concat(l.clientActionModule)),l.clientLoaderModule&&(u=u.concat(l.clientLoaderModule)),r&&l.hydrateFallbackModule&&(u=u.concat(l.hydrateFallbackModule)),l.imports&&(u=u.concat(l.imports)),u}).flat(1))}function y_(e){return[...new Set(e)]}function b_(e){let t={},r=Object.keys(e).sort();for(let s of r)t[s]=e[s];return t}function x_(e,t){let r=new Set;return new Set(t),e.reduce((s,l)=>{let u=JSON.stringify(b_(l));return r.has(u)||(r.add(u),s.push({key:u,link:l})),s},[])}function rx(){let e=j.useContext(va);return Nd(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function v_(){let e=j.useContext($u);return Nd(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var Od=j.createContext(void 0);Od.displayName="FrameworkContext";function ix(){let e=j.useContext(Od);return Nd(e,"You must render this element inside a <HydratedRouter> element"),e}function w_(e,t){let r=j.useContext(Od),[s,l]=j.useState(!1),[u,c]=j.useState(!1),{onFocus:f,onBlur:m,onMouseEnter:d,onMouseLeave:y,onTouchStart:g}=t,x=j.useRef(null);j.useEffect(()=>{if(e==="render"&&c(!0),e==="viewport"){let R=D=>{D.forEach(P=>{c(P.isIntersecting)})},B=new IntersectionObserver(R,{threshold:.5});return x.current&&B.observe(x.current),()=>{B.disconnect()}}},[e]),j.useEffect(()=>{if(s){let R=setTimeout(()=>{c(!0)},100);return()=>{clearTimeout(R)}}},[s]);let w=()=>{l(!0)},E=()=>{l(!1),c(!1)};return r?e!=="intent"?[u,x,{}]:[u,x,{onFocus:yl(f,w),onBlur:yl(m,E),onMouseEnter:yl(d,w),onMouseLeave:yl(y,E),onTouchStart:yl(g,w)}]:[!1,x,{}]}function yl(e,t){return r=>{e&&e(r),r.defaultPrevented||t(r)}}function S_({page:e,...t}){let{router:r}=rx(),s=j.useMemo(()=>Fb(r.routes,e,r.basename),[r.routes,e,r.basename]);return s?j.createElement(k_,{page:e,matches:s,...t}):null}function __(e){let{manifest:t,routeModules:r}=ix(),[s,l]=j.useState([]);return j.useEffect(()=>{let u=!1;return p_(e,t,r).then(c=>{u||l(c)}),()=>{u=!0}},[e,t,r]),s}function k_({page:e,matches:t,...r}){let s=or(),{future:l,manifest:u,routeModules:c}=ix(),{basename:f}=rx(),{loaderData:m,matches:d}=v_(),y=j.useMemo(()=>o0(e,t,d,u,s,"data"),[e,t,d,u,s]),g=j.useMemo(()=>o0(e,t,d,u,s,"assets"),[e,t,d,u,s]),x=j.useMemo(()=>{if(e===s.pathname+s.search+s.hash)return[];let R=new Set,B=!1;if(t.forEach(P=>{var ue;let F=u.routes[P.route.id];!F||!F.hasLoader||(!y.some(U=>U.route.id===P.route.id)&&P.route.id in m&&((ue=c[P.route.id])!=null&&ue.shouldRevalidate)||F.hasClientLoader?B=!0:R.add(P.route.id))}),R.size===0)return[];let D=h_(e,f,l.unstable_trailingSlashAwareDataRequests,"data");return B&&R.size>0&&D.searchParams.set("_routes",t.filter(P=>R.has(P.route.id)).map(P=>P.route.id).join(",")),[D.pathname+D.search]},[f,l.unstable_trailingSlashAwareDataRequests,m,s,u,y,t,e,c]),w=j.useMemo(()=>g_(g,u),[g,u]),E=__(g);return j.createElement(j.Fragment,null,x.map(R=>j.createElement("link",{key:R,rel:"prefetch",as:"fetch",href:R,...r})),w.map(R=>j.createElement("link",{key:R,rel:"modulepreload",href:R,...r})),E.map(({key:R,link:B})=>j.createElement("link",{key:R,nonce:r.nonce,...B,crossOrigin:B.crossOrigin??r.crossOrigin})))}function E_(...e){return t=>{e.forEach(r=>{typeof r=="function"?r(t):r!=null&&(r.current=t)})}}var C_=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{C_&&(window.__reactRouterVersion="7.13.1")}catch{}function A_({basename:e,children:t,unstable_useTransitions:r,window:s}){let l=j.useRef();l.current==null&&(l.current=oS({window:s,v5Compat:!0}));let u=l.current,[c,f]=j.useState({action:u.action,location:u.location}),m=j.useCallback(d=>{r===!1?f(d):j.startTransition(()=>f(d))},[r]);return j.useLayoutEffect(()=>u.listen(m),[u,m]),j.createElement(r_,{basename:e,children:t,location:c.location,navigationType:c.action,navigator:u,unstable_useTransitions:r})}var sx=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,ax=j.forwardRef(function({onClick:t,discover:r="render",prefetch:s="none",relative:l,reloadDocument:u,replace:c,unstable_mask:f,state:m,target:d,to:y,preventScrollReset:g,viewTransition:x,unstable_defaultShouldRevalidate:w,...E},R){let{basename:B,navigator:D,unstable_useTransitions:P}=j.useContext(Jn),F=typeof y=="string"&&sx.test(y),ue=Vb(y,B);y=ue.to;let U=IS(y,{relative:l}),M=or(),K=null;if(f){let $=Fu(f,[],M.unstable_mask?M.unstable_mask.pathname:"/",!0);B!=="/"&&($.pathname=$.pathname==="/"?B:Nr([B,$.pathname])),K=D.createHref($)}let[V,q,O]=w_(s,E),X=O_(y,{replace:c,unstable_mask:f,state:m,target:d,preventScrollReset:g,relative:l,viewTransition:x,unstable_defaultShouldRevalidate:w,unstable_useTransitions:P});function J($){t&&t($),$.defaultPrevented||X($)}let le=!(ue.isExternal||u),te=j.createElement("a",{...E,...O,href:(le?K:void 0)||ue.absoluteURL||U,onClick:le?J:t,ref:E_(R,q),target:d,"data-discover":!F&&r==="render"?"true":void 0});return V&&!F?j.createElement(j.Fragment,null,te,j.createElement(S_,{page:U})):te});ax.displayName="Link";var T_=j.forwardRef(function({"aria-current":t="page",caseSensitive:r=!1,className:s="",end:l=!1,style:u,to:c,viewTransition:f,children:m,...d},y){let g=Fl(c,{relative:d.relative}),x=or(),w=j.useContext($u),{navigator:E,basename:R}=j.useContext(Jn),B=w!=null&&z_(g)&&f===!0,D=E.encodeLocation?E.encodeLocation(g).pathname:g.pathname,P=x.pathname,F=w&&w.navigation&&w.navigation.location?w.navigation.location.pathname:null;r||(P=P.toLowerCase(),F=F?F.toLowerCase():null,D=D.toLowerCase()),F&&R&&(F=ti(F,R)||F);const ue=D!=="/"&&D.endsWith("/")?D.length-1:D.length;let U=P===D||!l&&P.startsWith(D)&&P.charAt(ue)==="/",M=F!=null&&(F===D||!l&&F.startsWith(D)&&F.charAt(D.length)==="/"),K={isActive:U,isPending:M,isTransitioning:B},V=U?t:void 0,q;typeof s=="function"?q=s(K):q=[s,U?"active":null,M?"pending":null,B?"transitioning":null].filter(Boolean).join(" ");let O=typeof u=="function"?u(K):u;return j.createElement(ax,{...d,"aria-current":V,className:q,ref:y,style:O,to:c,viewTransition:f},typeof m=="function"?m(K):m)});T_.displayName="NavLink";var j_=j.forwardRef(({discover:e="render",fetcherKey:t,navigate:r,reloadDocument:s,replace:l,state:u,method:c=vu,action:f,onSubmit:m,relative:d,preventScrollReset:y,viewTransition:g,unstable_defaultShouldRevalidate:x,...w},E)=>{let{unstable_useTransitions:R}=j.useContext(Jn),B=D_(),D=L_(f,{relative:d}),P=c.toLowerCase()==="get"?"get":"post",F=typeof f=="string"&&sx.test(f),ue=U=>{if(m&&m(U),U.defaultPrevented)return;U.preventDefault();let M=U.nativeEvent.submitter,K=(M==null?void 0:M.getAttribute("formmethod"))||c,V=()=>B(M||U.currentTarget,{fetcherKey:t,method:K,navigate:r,replace:l,state:u,relative:d,preventScrollReset:y,viewTransition:g,unstable_defaultShouldRevalidate:x});R&&r!==!1?j.startTransition(()=>V()):V()};return j.createElement("form",{ref:E,method:P,action:D,onSubmit:s?m:ue,...w,"data-discover":!F&&e==="render"?"true":void 0})});j_.displayName="Form";function N_(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function lx(e){let t=j.useContext(va);return Bt(t,N_(e)),t}function O_(e,{target:t,replace:r,unstable_mask:s,state:l,preventScrollReset:u,relative:c,viewTransition:f,unstable_defaultShouldRevalidate:m,unstable_useTransitions:d}={}){let y=Or(),g=or(),x=Fl(e,{relative:c});return j.useCallback(w=>{if(o_(w,t)){w.preventDefault();let E=r!==void 0?r:Dl(g)===Dl(x),R=()=>y(e,{replace:E,unstable_mask:s,state:l,preventScrollReset:u,relative:c,viewTransition:f,unstable_defaultShouldRevalidate:m});d?j.startTransition(()=>R()):R()}},[g,y,x,r,s,l,t,e,u,c,f,m,d])}var R_=0,M_=()=>`__${String(++R_)}__`;function D_(){let{router:e}=lx("useSubmit"),{basename:t}=j.useContext(Jn),r=WS(),s=e.fetch,l=e.navigate;return j.useCallback(async(u,c={})=>{let{action:f,method:m,encType:d,formData:y,body:g}=f_(u,t);if(c.navigate===!1){let x=c.fetcherKey||M_();await s(x,r,c.action||f,{unstable_defaultShouldRevalidate:c.unstable_defaultShouldRevalidate,preventScrollReset:c.preventScrollReset,formData:y,body:g,formMethod:c.method||m,formEncType:c.encType||d,flushSync:c.flushSync})}else await l(c.action||f,{unstable_defaultShouldRevalidate:c.unstable_defaultShouldRevalidate,preventScrollReset:c.preventScrollReset,formData:y,body:g,formMethod:c.method||m,formEncType:c.encType||d,replace:c.replace,state:c.state,fromRouteId:r,flushSync:c.flushSync,viewTransition:c.viewTransition})},[s,l,t,r])}function L_(e,{relative:t}={}){let{basename:r}=j.useContext(Jn),s=j.useContext(wr);Bt(s,"useFormAction must be used inside a RouteContext");let[l]=s.matches.slice(-1),u={...Fl(e||".",{relative:t})},c=or();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:Nr([r,u.pathname])),Dl(u)}function z_(e,{relative:t}={}){let r=j.useContext(Xb);Bt(r!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:s}=lx("useViewTransitionState"),l=Fl(e,{relative:t});if(!r.isTransitioning)return!1;let u=ti(r.currentLocation.pathname,s)||r.currentLocation.pathname,c=ti(r.nextLocation.pathname,s)||r.nextLocation.pathname;return Cu(l.pathname,c)!=null||Cu(l.pathname,u)!=null}var aa=Ib();const ox=j.createContext(null),ux="palmier_paired_hosts";function U_(){try{const e=localStorage.getItem(ux);if(e)return JSON.parse(e)}catch{}return[]}function B_(e){localStorage.setItem(ux,JSON.stringify(e))}const u0="local",P_=!!window.__PALMIER_SERVE__&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1");function q_({children:e}){const[t,r]=j.useState(()=>{const m=U_();return P_&&!m.some(d=>d.hostId===u0)&&m.push({hostId:u0,clientToken:"",directUrl:window.location.origin}),m});j.useEffect(()=>{B_(t)},[t]);const s=j.useCallback(m=>{r(d=>[...d.filter(g=>g.hostId!==m.hostId),m])},[]),l=j.useCallback(m=>{r(d=>d.filter(y=>y.hostId!==m))},[]),u=j.useCallback((m,d)=>{r(y=>y.map(g=>g.hostId===m?{...g,name:d}:g))},[]),c=j.useCallback((m,d)=>{r(y=>y.map(g=>g.hostId!==m||g.lanUrl===d?g:{...g,lanUrl:d}))},[]),f=j.useCallback((m,d)=>{r(y=>y.map(g=>g.hostId!==m||g.lastAgent===d?g:{...g,lastAgent:d}))},[]);return b.jsx(ox.Provider,{value:{pairedHosts:t,addPairedHost:s,removePairedHost:l,renamePairedHost:u,setHostLanUrl:c,setHostLastAgent:f},children:e})}function Pi(){const e=j.useContext(ox);if(!e)throw new Error("useHostStore must be used within HostStoreProvider");return e}const Gn=new Uint8Array(0),qi=new TextEncoder,Fn=new TextDecoder;function H_(...e){let t=0;for(let l=0;l<e.length;l++)t+=e[l].length;const r=new Uint8Array(t);let s=0;for(let l=0;l<e.length;l++)r.set(e[l],s),s+=e[l].length;return r}function Al(...e){const t=[];for(let r=0;r<e.length;r++)t.push(qi.encode(e[r]));return t.length===0?Gn:t.length===1?t[0]:H_(...t)}function c0(e){return!e||e.length===0?"":Fn.decode(e)}const f0="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ",h0=36,I_=0xcfd41b9100000,d0=33,F_=333,m0=22;function $_(e){for(let t=0;t<e.length;t++)e[t]=Math.floor(Math.random()*255)}function Y_(e){var t;(t=globalThis==null?void 0:globalThis.crypto)!=null&&t.getRandomValues?globalThis.crypto.getRandomValues(e):$_(e)}class G_{constructor(){C(this,"buf");C(this,"seq");C(this,"inc");C(this,"inited");this.buf=new Uint8Array(m0),this.inited=!1}init(){this.inited=!0,this.setPre(),this.initSeqAndInc(),this.fillSeq()}initSeqAndInc(){this.seq=Math.floor(Math.random()*I_),this.inc=Math.floor(Math.random()*(F_-d0)+d0)}setPre(){const t=new Uint8Array(12);Y_(t);for(let r=0;r<12;r++){const s=t[r]%36;this.buf[r]=f0.charCodeAt(s)}}fillSeq(){let t=this.seq;for(let r=m0-1;r>=12;r--)this.buf[r]=f0.charCodeAt(t%h0),t=Math.floor(t/h0)}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 Ui=new G_;var Zr;(function(e){e.Disconnect="disconnect",e.Reconnect="reconnect",e.Update="update",e.LDM="ldm",e.Error="error"})(Zr||(Zr={}));var la;(function(e){e.Reconnecting="reconnecting",e.PingTimer="pingTimer",e.StaleConnection="staleConnection",e.ClientInitiatedReconnect="client initiated reconnect"})(la||(la={}));var Se;(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"})(Se||(Se={}));function V_(e){return typeof e.code=="string"}class cx{constructor(){C(this,"messages");this.messages=new Map,this.messages.set(Se.InvalidPayload,"Invalid payload type - payloads can be 'binary', 'string', or 'json'"),this.messages.set(Se.BadJson,"Bad JSON"),this.messages.set(Se.WssRequired,"TLS is required, therefore a secure websocket connection is also required")}static getMessage(t){return J_.getMessage(t)}getMessage(t){return this.messages.get(t)||t}}const J_=new cx;class Oe extends Error{constructor(r,s,l){super(r);C(this,"name");C(this,"message");C(this,"code");C(this,"permissionContext");C(this,"chainedError");C(this,"api_error");this.name="NatsError",this.message=r,this.code=s,this.chainedError=l}static errorForCode(r,s){const l=cx.getMessage(r);return new Oe(l,r,s)}isAuthError(){return this.code===Se.AuthenticationExpired||this.code===Se.AuthorizationViolation||this.code===Se.AccountExpired}isAuthTimeout(){return this.code===Se.AuthenticationTimeout}isPermissionError(){return this.code===Se.PermissionsViolation}isProtocolError(){return this.code===Se.ProtocolError}isJetStreamError(){return this.api_error!==void 0}jsError(){return this.api_error?this.api_error:null}}var Hn;(function(e){e[e.Exact=0]="Exact",e[e.CanonicalMIME=1]="CanonicalMIME",e[e.IgnoreCase=2]="IgnoreCase"})(Hn||(Hn={}));var yr;(function(e){e.Timer="timer",e.Count="count",e.JitterTimer="jitterTimer",e.SentinelMsg="sentinelMsg"})(yr||(yr={}));var Tl;(function(e){e.STATS="io.nats.micro.v1.stats_response",e.INFO="io.nats.micro.v1.info_response",e.PING="io.nats.micro.v1.ping_response"})(Tl||(Tl={}));const Au="Nats-Service-Error",Tu="Nats-Service-Error-Code";class ju extends Error{constructor(r,s){super(s);C(this,"code");this.code=r}static isServiceError(r){return ju.toServiceError(r)!==null}static toServiceError(r){var l,u;const s=((l=r==null?void 0:r.headers)==null?void 0:l.get(Tu))||"";if(s!==""){const c=parseInt(s)||400,f=((u=r==null?void 0:r.headers)==null?void 0:u.get(Au))||"";return new ju(c,f.length?f:s)}return null}}function ei(e=""){if(e=e||"_INBOX",typeof e!="string")throw new Error("prefix must be a string");return e.split(".").forEach(t=>{if(t==="*"||t===">")throw new Error(`inbox prefixes cannot have wildcards '${e}'`)}),`${e}.${Ui.next()}`}const Zh="127.0.0.1";var Di;(function(e){e.PING="PING",e.STATS="STATS",e.INFO="INFO"})(Di||(Di={}));function Vu(e,...t){for(let r=0;r<t.length;r++){const s=t[r];Object.keys(s).forEach(function(l){e[l]=s[l]})}return e}function cu(e){return Fn.decode(e).replace(/\n/g,"␊").replace(/\r/g,"␍")}function ma(e,t=!0){const r=t?Oe.errorForCode(Se.Timeout):null;let s,l;const u=new Promise((c,f)=>{s={cancel:()=>{l&&clearTimeout(l)}},l=setTimeout(()=>{f(r===null?Oe.errorForCode(Se.Timeout):r)},e)});return Object.assign(u,s)}function Sa(e=0){let t;const r=new Promise(s=>{const l=setTimeout(()=>{s()},e);t={cancel:()=>{l&&clearTimeout(l)}}});return Object.assign(r,t)}function Ut(){let e={};const t=new Promise((r,s)=>{e={resolve:r,reject:s}});return Object.assign(t,e)}function fx(e){for(let t=e.length-1;t>0;t--){const r=Math.floor(Math.random()*(t+1));[e[t],e[r]]=[e[r],e[t]]}return e}function X_(e){return e===0?0:Math.floor(e/2+Math.random()*e)}function Rd(e=[0,250,250,500,500,3e3,5e3]){Array.isArray(e)||(e=[0,250,250,500,500,3e3,5e3]);const t=e.length-1;return{backoff(r){return X_(r>t?e[t]:e[r])}}}function zt(e){return e*1e6}function Md(e){return Math.floor(e/1e6)}function p0(e){let s=!0;const l=new Array(e.length);for(let u=0;u<e.length;u++){let c=e.charCodeAt(u);if(c===58||c<33||c>126)throw new Oe(`'${e[u]}' is not a valid character for a header key`,Se.BadHeader);s&&97<=c&&c<=122?c-=32:!s&&65<=c&&c<=90&&(c+=32),l[u]=c,s=c==45}return String.fromCharCode(...l)}function ni(e=0,t=""){if(e===0&&t!==""||e>0&&t==="")throw new Error("setting status requires both code and description");return new Li(e,t)}const vh="NATS/1.0";class Li{constructor(t=0,r=""){C(this,"_code");C(this,"headers");C(this,"_description");this._code=t,this._description=r,this.headers=new Map}[Symbol.iterator](){return this.headers.entries()}size(){return this.headers.size}equals(t){if(t&&this.headers.size===t.headers.size&&this._code===t._code){for(const[r,s]of this.headers){const l=t.values(r);if(s.length!==l.length)return!1;const u=[...s].sort(),c=[...l].sort();for(let f=0;f<u.length;f++)if(u[f]!==c[f])return!1}return!0}return!1}static decode(t){const r=new Li,l=Fn.decode(t).split(`\r
|
|
61
|
-
`),u=l[0];if(u!==vh){let c=u.replace(vh,"").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 t=vh;this._code>0&&this._description!==""&&(t+=` ${this._code} ${this._description}`);for(const[r,s]of this.headers)for(let l=0;l<s.length;l++)t=`${t}\r
|
|
62
|
-
${r}: ${s[l]}`;return`${t}\r
|
|
63
|
-
\r
|
|
64
|
-
`}encode(){return qi.encode(this.toString())}static validHeaderValue(t){if(/[\r\n]/.test(t))throw new Oe("invalid header value - \\r and \\n are not allowed.",Se.BadHeader);return t.trim()}keys(){const t=[];for(const r of this.headers.keys())t.push(r);return t}findKeys(t,r=Hn.Exact){const s=this.keys();switch(r){case Hn.Exact:return s.filter(l=>l===t);case Hn.CanonicalMIME:return t=p0(t),s.filter(l=>l===t);default:{const l=t.toLowerCase();return s.filter(u=>l===u.toLowerCase())}}}get(t,r=Hn.Exact){const s=this.findKeys(t,r);if(s.length){const l=this.headers.get(s[0]);if(l)return Array.isArray(l)?l[0]:l}return""}last(t,r=Hn.Exact){const s=this.findKeys(t,r);if(s.length){const l=this.headers.get(s[0]);if(l)return Array.isArray(l)?l[l.length-1]:l}return""}has(t,r=Hn.Exact){return this.findKeys(t,r).length>0}set(t,r,s=Hn.Exact){this.delete(t,s),this.append(t,r,s)}append(t,r,s=Hn.Exact){const l=p0(t);s===Hn.CanonicalMIME&&(t=l);const u=this.findKeys(t,s);t=u.length>0?u[0]:t;const c=Li.validHeaderValue(r);let f=this.headers.get(t);f||(f=[],this.headers.set(t,f)),f.push(c)}values(t,r=Hn.Exact){const s=[];return this.findKeys(t,r).forEach(u=>{const c=this.headers.get(u);c&&s.push(...c)}),s}delete(t,r=Hn.Exact){this.findKeys(t,r).forEach(l=>{this.headers.delete(l)})}get hasError(){return this._code>=300}get status(){return`${this._code} ${this._description}`.trim()}toRecord(){const t={};return this.keys().forEach(r=>{t[r]=this.values(r)}),t}get code(){return this._code}get description(){return this._description}static fromRecord(t){const r=new Li;for(const s in t)r.headers.set(s,t[s]);return r}}function Nu(){return{encode(e){return qi.encode(e)},decode(e){return Fn.decode(e)}}}function br(e){return{encode(t){try{return t===void 0&&(t=null),qi.encode(JSON.stringify(t))}catch(r){throw Oe.errorForCode(Se.BadJson,r)}},decode(t){try{return JSON.parse(Fn.decode(t),e)}catch(r){throw Oe.errorForCode(Se.BadJson,r)}}}}function hx(e){var t;return e&&e.data.length===0&&((t=e.headers)==null?void 0:t.code)===503?Oe.errorForCode(Se.NoResponders):null}class Dd{constructor(t,r,s){C(this,"_headers");C(this,"_msg");C(this,"_rdata");C(this,"_reply");C(this,"_subject");C(this,"publisher");this._msg=t,this._rdata=r,this.publisher=s}get subject(){return this._subject?this._subject:(this._subject=Fn.decode(this._msg.subject),this._subject)}get reply(){return this._reply?this._reply:(this._reply=Fn.decode(this._msg.reply),this._reply)}get sid(){return this._msg.sid}get headers(){if(this._msg.hdr>-1&&!this._headers){const t=this._rdata.subarray(0,this._msg.hdr);this._headers=Li.decode(t)}return this._headers}get data(){return this._rdata?this._msg.hdr>-1?this._rdata.subarray(this._msg.hdr):this._rdata:new Uint8Array(0)}respond(t=Gn,r){return this.reply?(this.publisher.publish(this.reply,t,r),!0):!1}size(){var l;const t=this._msg.subject.length,r=((l=this._msg.reply)==null?void 0:l.length)||0,s=this._msg.size===-1?0:this._msg.size;return t+r+s}json(t){return br(t).decode(this.data)}string(){return Fn.decode(this.data)}requestInfo(){var r;const t=(r=this.headers)==null?void 0:r.get("Nats-Request-Info");return t?JSON.parse(t,function(s,l){return(s==="start"||s==="stop")&&l!==""?new Date(Date.parse(l)):l}):null}}C(Dd,"jc");function oa(e){return Ju("durable",e)}function bn(e){return Ju("stream",e)}function Ju(e,t=""){if(t==="")throw Error(`${e} name required`);return[".","*",">","/","\\"," "," ",`
|
|
65
|
-
`,"\r"].forEach(s=>{if(t.indexOf(s)!==-1){switch(s){case`
|
|
66
|
-
`:s="\\n";break;case"\r":s="\\r";break;case" ":s="\\t";break}throw Error(`invalid ${e} name - ${e} name cannot contain '${s}'`)}}),""}function El(e,t=""){if(t==="")throw Error(`${e} name required`);const r=K_(t);if(r.length)throw new Error(`invalid ${e} name - ${e} name ${r}`)}function K_(e=""){if(e==="")throw Error("name required");const t=/^[-\w]+$/g;if(e.match(t)===null){for(const s of e.split(""))if(s.match(t)===null)return`cannot contain '${s}'`}return""}function Wh(e){if(e.data.length>0)return!1;const t=e.headers;return t?t.code>=100&&t.code<200:!1}function ed(e){var t;return Wh(e)&&((t=e.headers)==null?void 0:t.description)==="Idle Heartbeat"}function Q_(e,t,r){const s=ni(e,t),l={hdr:1,sid:0,size:0},u=new Dd(l,Gn,{});return u._headers=s,u._subject=r,u}function ua(e){if(e.data.length!==0)return null;const t=e.headers;return t?dx(t.code,t.description):null}var ar;(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"})(ar||(ar={}));function Z_(e){return e.code!==Se.JetStream409?!1:[ar.MaxBatchExceeded,ar.MaxExpiresExceeded,ar.MaxBytesExceeded,ar.MaxMessageSizeExceeded,ar.PushConsumer,ar.IdleHeartbeatMissed,ar.ConsumerDeleted].find(r=>e.message.indexOf(r)!==-1)!==void 0}function dx(e,t=""){if(e<300)return null;switch(t=t.toLowerCase(),e){case 404:return new Oe(t,Se.JetStream404NoMessages);case 408:return new Oe(t,Se.JetStream408RequestTimeout);case 409:{const r=t.startsWith(ar.IdleHeartbeatMissed)?Se.JetStreamIdleHeartBeat:Se.JetStream409;return new Oe(t,r)}case 503:return Oe.errorForCode(Se.JetStreamNotEnabled,new Error(t));default:return t===""&&(t=Se.Unknown),new Oe(t,`${e}`)}}class an{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=Ut(),this.yields=[],this.iterClosed=Ut(),this.time=0,this.yielding=!1}[Symbol.asyncIterator](){return this.iterate()}push(t){if(this.done)return;if(typeof t=="function"){this.yields.push(t),this.signal.resolve();return}const{ingest:r,protocol:s}=this.ingestionFilterFn?this.ingestionFilterFn(t,this.ctx||this):{ingest:!0,protocol:!1};r&&(s&&(this.filtered++,this.pendingFiltered++),this.yields.push(t),this.signal.resolve())}async*iterate(){if(this.noIterator)throw new Oe("unsupported iterator",Se.ApiError);if(this.yielding)throw new Oe("already yielding",Se.ApiError);this.yielding=!0;try{for(;;){if(this.yields.length===0&&await this.signal,this.err)throw this.err;const t=this.yields;this.inflight=t.length,this.yields=[];for(let r=0;r<t.length;r++){if(typeof t[r]=="function"){const l=t[r];try{l()}catch(u){throw u}if(this.err)throw this.err;continue}if(this.protocolFilterFn?this.protocolFilterFn(t[r]):!0){this.processed++;const l=Date.now();yield t[r],this.time=Date.now()-l,this.dispatchedFn&&t[r]&&this.dispatchedFn(t[r])}else this.pendingFiltered--;this.inflight--}if(this.done)break;this.yields.length===0&&(t.length=0,this.yields=t,this.signal=Ut())}}finally{this.stop()}}stop(t){this.done||(this.err=t,this.done=!0,this.signal.resolve(),this.iterClosed.resolve(t))}getProcessed(){return this.noIterator?this.received:this.processed}getPending(){return this.yields.length+this.inflight-this.pendingFiltered}getReceived(){return this.received-this.filtered}}class Ld{constructor(t,r,s={maxOut:2}){C(this,"interval");C(this,"maxOut");C(this,"cancelAfter");C(this,"timer");C(this,"autoCancelTimer");C(this,"last");C(this,"missed");C(this,"count");C(this,"callback");this.interval=t,this.maxOut=(s==null?void 0:s.maxOut)||2,this.cancelAfter=(s==null?void 0:s.cancelAfter)||0,this.last=Date.now(),this.missed=0,this.count=0,this.callback=r,this._schedule()}cancel(){this.autoCancelTimer&&clearTimeout(this.autoCancelTimer),this.timer&&clearInterval(this.timer),this.timer=0,this.autoCancelTimer=0,this.missed=0}work(){this.last=Date.now(),this.missed=0}_change(t,r=0,s=2){this.interval=t,this.maxOut=s,this.cancelAfter=r,this.restart()}restart(){this.cancel(),this._schedule()}_schedule(){this.cancelAfter>0&&(this.autoCancelTimer=setTimeout(()=>{this.cancel()},this.cancelAfter)),this.timer=setInterval(()=>{if(this.count++,Date.now()-this.last>this.interval&&this.missed++,this.missed>=this.maxOut)try{this.callback(this.missed)===!0&&this.cancel()}catch(t){console.log(t)}},this.interval)}}var td;(function(e){e.Limits="limits",e.Interest="interest",e.Workqueue="workqueue"})(td||(td={}));var zl;(function(e){e.Old="old",e.New="new"})(zl||(zl={}));var nd;(function(e){e.File="file",e.Memory="memory"})(nd||(nd={}));var Vt;(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"})(Vt||(Vt={}));var sn;(function(e){e.None="none",e.All="all",e.Explicit="explicit",e.NotSet=""})(sn||(sn={}));var pa;(function(e){e.Instant="instant",e.Original="original"})(pa||(pa={}));var Bi;(function(e){e.None="none",e.S2="s2"})(Bi||(Bi={}));var Ou;(function(e){e.CreateOrUpdate="",e.Update="update",e.Create="create"})(Ou||(Ou={}));function W_(e,t={}){return Object.assign({name:e,deliver_policy:Vt.All,ack_policy:sn.Explicit,ack_wait:zt(30*1e3),replay_policy:pa.Instant},t)}var g0;(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"})(g0||(g0={}));var Sn;(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"})(Sn||(Sn={}));var pr;(function(e){e.LastValue="",e.AllHistory="history",e.UpdatesOnly="updates"})(pr||(pr={}));var ia;(function(e){e.Stream="Nats-Stream",e.Sequence="Nats-Sequence",e.TimeStamp="Nats-Time-Stamp",e.Subject="Nats-Subject"})(ia||(ia={}));var y0;(function(e){e.Stream="Nats-Stream",e.Subject="Nats-Subject",e.Sequence="Nats-Sequence",e.LastSequence="Nats-Last-Sequence",e.Size="Nats-Msg-Size"})(y0||(y0={}));const In="KV_";class ek{constructor(t){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=W_("",t||{})}getOpts(){var r;const t={};if(t.config=Object.assign({},this.config),t.config.filter_subject&&(this.filterSubject(t.config.filter_subject),t.config.filter_subject=void 0),t.config.filter_subjects&&((r=t.config.filter_subjects)==null||r.forEach(s=>{this.filterSubject(s)}),t.config.filter_subjects=void 0),t.mack=this.mack,t.stream=this.stream,t.callbackFn=this.callbackFn,t.max=this.max,t.queue=this.qname,t.ordered=this.ordered,t.config.ack_policy=t.ordered?sn.None:t.config.ack_policy,t.isBind=t.isBind||!1,this.filters)switch(this.filters.length){case 0:break;case 1:t.config.filter_subject=this.filters[0];break;default:t.config.filter_subjects=this.filters}return t}description(t){return this.config.description=t,this}deliverTo(t){return this.config.deliver_subject=t,this}durable(t){return oa(t),this.config.durable_name=t,this}startSequence(t){if(t<=0)throw new Error("sequence must be greater than 0");return this.config.deliver_policy=Vt.StartSequence,this.config.opt_start_seq=t,this}startTime(t){return this.config.deliver_policy=Vt.StartTime,this.config.opt_start_time=t.toISOString(),this}deliverAll(){return this.config.deliver_policy=Vt.All,this}deliverLastPerSubject(){return this.config.deliver_policy=Vt.LastPerSubject,this}deliverLast(){return this.config.deliver_policy=Vt.Last,this}deliverNew(){return this.config.deliver_policy=Vt.New,this}startAtTimeDelta(t){return this.startTime(new Date(Date.now()-t)),this}headersOnly(){return this.config.headers_only=!0,this}ackNone(){return this.config.ack_policy=sn.None,this}ackAll(){return this.config.ack_policy=sn.All,this}ackExplicit(){return this.config.ack_policy=sn.Explicit,this}ackWait(t){return this.config.ack_wait=zt(t),this}maxDeliver(t){return this.config.max_deliver=t,this}filterSubject(t){return this.filters=this.filters||[],this.filters.push(t),this}replayInstantly(){return this.config.replay_policy=pa.Instant,this}replayOriginal(){return this.config.replay_policy=pa.Original,this}sample(t){if(t=Math.trunc(t),t<0||t>100)throw new Error("value must be between 0-100");return this.config.sample_freq=`${t}%`,this}limit(t){return this.config.rate_limit_bps=t,this}maxWaiting(t){return this.config.max_waiting=t,this}maxAckPending(t){return this.config.max_ack_pending=t,this}idleHeartbeat(t){return this.config.idle_heartbeat=zt(t),this}flowControl(){return this.config.flow_control=!0,this}deliverGroup(t){return this.queue(t),this}manualAck(){return this.mack=!0,this}maxMessages(t){return this.max=t,this}callback(t){return this.callbackFn=t,this}queue(t){return this.qname=t,this.config.deliver_group=t,this}orderedConsumer(){return this.ordered=!0,this}bind(t,r){return this.stream=t,this.config.durable_name=r,this.isBind=!0,this}bindStream(t){return this.stream=t,this}inactiveEphemeralThreshold(t){return this.config.inactive_threshold=zt(t),this}maxPullBatch(t){return this.config.max_batch=t,this}maxPullRequestExpires(t){return this.config.max_expires=zt(t),this}memory(){return this.config.mem_storage=!0,this}numReplicas(t){return this.config.num_replicas=t,this}consumerName(t){return this.config.name=t,this}}function zi(e){return new ek(e)}function b0(e){return typeof e.getOpts=="function"}class tk{static encode(t){if(typeof t=="string")return btoa(t);const r=Array.from(t);return btoa(String.fromCharCode(...r))}static decode(t,r=!1){const s=atob(t);return r?Uint8Array.from(s,l=>l.charCodeAt(0)):s}}class ca{static encode(t){return ca.toB64URLEncoding(tk.encode(t))}static decode(t,r=!1){return ca.decode(ca.fromB64URLEncoding(t),r)}static toB64URLEncoding(t){return t.replace(/\+/g,"-").replace(/\//g,"_")}static fromB64URLEncoding(t){return t.replace(/_/g,"/").replace(/-/g,"+")}}class ga{constructor(){C(this,"buffers");C(this,"byteLength");this.buffers=[],this.byteLength=0}static concat(...t){let r=0;for(let u=0;u<t.length;u++)r+=t[u].length;const s=new Uint8Array(r);let l=0;for(let u=0;u<t.length;u++)s.set(t[u],l),l+=t[u].length;return s}static fromAscii(t){return t||(t=""),qi.encode(t)}static toAscii(t){return Fn.decode(t)}reset(){this.buffers.length=0,this.byteLength=0}pack(){if(this.buffers.length>1){const t=new Uint8Array(this.byteLength);let r=0;for(let s=0;s<this.buffers.length;s++)t.set(this.buffers[s],r),r+=this.buffers[s].length;this.buffers.length=0,this.buffers.push(t)}}shift(){if(this.buffers.length){const t=this.buffers.shift();if(t)return this.byteLength-=t.length,t}return new Uint8Array(0)}drain(t){if(this.buffers.length){this.pack();const r=this.buffers.pop();if(r){const s=this.byteLength;(t===void 0||t>s)&&(t=s);const l=r.subarray(0,t);return s>t&&this.buffers.push(r.subarray(t)),this.byteLength=s-t,l}}return new Uint8Array(0)}fill(t,...r){t&&(this.buffers.push(t),this.byteLength+=t.length);for(let s=0;s<r.length;s++)r[s]&&r[s].length&&(this.buffers.push(r[s]),this.byteLength+=r[s].length)}peek(){return this.buffers.length?(this.pack(),this.buffers[0]):new Uint8Array(0)}size(){return this.byteLength}length(){return this.buffers.length}}function nk(e,t){return t.forEach(function(r){r&&typeof r!="string"&&!Array.isArray(r)&&Object.keys(r).forEach(function(s){if(s!=="default"&&!(s in e)){var l=Object.getOwnPropertyDescriptor(r,s);Object.defineProperty(e,s,l.get?l:{enumerable:!0,get:function(){return r[s]}})}})}),Object.freeze(e)}var rk=typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{},bl=rk.performance||{};bl.now||bl.mozNow||bl.msNow||bl.oNow||bl.webkitNow;var x0={versions:{}},ik=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function sk(e){if(e.__esModule)return e;var t=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(e).forEach(function(r){var s=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,s.get?s:{enumerable:!0,get:function(){return e[r]}})}),t}var wh,Xu={exports:{}},v0={},w0=sk(nk({__proto__:null,default:v0},[v0]));wh=Xu,(function(){var e="input is invalid type",t=typeof window=="object",r=t?window:{};r.JS_SHA256_NO_WINDOW&&(t=!1);var s=!t&&typeof self=="object",l=!r.JS_SHA256_NO_NODE_JS&&x0.versions&&x0.versions.node;l?r=ik:s&&(r=self);var u=!r.JS_SHA256_NO_COMMON_JS&&wh.exports,c=!r.JS_SHA256_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",f="0123456789abcdef".split(""),m=[-2147483648,8388608,32768,128],d=[24,16,8,0],y=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],g=["hex","array","digest","arrayBuffer"],x=[];!r.JS_SHA256_NO_NODE_JS&&Array.isArray||(Array.isArray=function(U){return Object.prototype.toString.call(U)==="[object Array]"}),!c||!r.JS_SHA256_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(U){return typeof U=="object"&&U.buffer&&U.buffer.constructor===ArrayBuffer});var w=function(U,M){return function(K){return new P(M,!0).update(K)[U]()}},E=function(U){var M=w("hex",U);l&&(M=R(M,U)),M.create=function(){return new P(U)},M.update=function(q){return M.create().update(q)};for(var K=0;K<g.length;++K){var V=g[K];M[V]=w(V,U)}return M},R=function(U,M){var K,V=w0,q=w0.Buffer,O=M?"sha224":"sha256";return K=q.from&&!r.JS_SHA256_NO_BUFFER_FROM?q.from:function(X){return new q(X)},function(X){if(typeof X=="string")return V.createHash(O).update(X,"utf8").digest("hex");if(X==null)throw new Error(e);return X.constructor===ArrayBuffer&&(X=new Uint8Array(X)),Array.isArray(X)||ArrayBuffer.isView(X)||X.constructor===q?V.createHash(O).update(K(X)).digest("hex"):U(X)}},B=function(U,M){return function(K,V){return new F(K,M,!0).update(V)[U]()}},D=function(U){var M=B("hex",U);M.create=function(q){return new F(q,U)},M.update=function(q,O){return M.create(q).update(O)};for(var K=0;K<g.length;++K){var V=g[K];M[V]=B(V,U)}return M};function P(U,M){M?(x[0]=x[16]=x[1]=x[2]=x[3]=x[4]=x[5]=x[6]=x[7]=x[8]=x[9]=x[10]=x[11]=x[12]=x[13]=x[14]=x[15]=0,this.blocks=x):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],U?(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=U}function F(U,M,K){var V,q=typeof U;if(q==="string"){var O,X=[],J=U.length,le=0;for(V=0;V<J;++V)(O=U.charCodeAt(V))<128?X[le++]=O:O<2048?(X[le++]=192|O>>>6,X[le++]=128|63&O):O<55296||O>=57344?(X[le++]=224|O>>>12,X[le++]=128|O>>>6&63,X[le++]=128|63&O):(O=65536+((1023&O)<<10|1023&U.charCodeAt(++V)),X[le++]=240|O>>>18,X[le++]=128|O>>>12&63,X[le++]=128|O>>>6&63,X[le++]=128|63&O);U=X}else{if(q!=="object")throw new Error(e);if(U===null)throw new Error(e);if(c&&U.constructor===ArrayBuffer)U=new Uint8Array(U);else if(!(Array.isArray(U)||c&&ArrayBuffer.isView(U)))throw new Error(e)}U.length>64&&(U=new P(M,!0).update(U).array());var te=[],$=[];for(V=0;V<64;++V){var H=U[V]||0;te[V]=92^H,$[V]=54^H}P.call(this,M,K),this.update($),this.oKeyPad=te,this.inner=!0,this.sharedMemory=K}P.prototype.update=function(U){if(!this.finalized){var M,K=typeof U;if(K!=="string"){if(K!=="object")throw new Error(e);if(U===null)throw new Error(e);if(c&&U.constructor===ArrayBuffer)U=new Uint8Array(U);else if(!(Array.isArray(U)||c&&ArrayBuffer.isView(U)))throw new Error(e);M=!0}for(var V,q,O=0,X=U.length,J=this.blocks;O<X;){if(this.hashed&&(this.hashed=!1,J[0]=this.block,this.block=J[16]=J[1]=J[2]=J[3]=J[4]=J[5]=J[6]=J[7]=J[8]=J[9]=J[10]=J[11]=J[12]=J[13]=J[14]=J[15]=0),M)for(q=this.start;O<X&&q<64;++O)J[q>>>2]|=U[O]<<d[3&q++];else for(q=this.start;O<X&&q<64;++O)(V=U.charCodeAt(O))<128?J[q>>>2]|=V<<d[3&q++]:V<2048?(J[q>>>2]|=(192|V>>>6)<<d[3&q++],J[q>>>2]|=(128|63&V)<<d[3&q++]):V<55296||V>=57344?(J[q>>>2]|=(224|V>>>12)<<d[3&q++],J[q>>>2]|=(128|V>>>6&63)<<d[3&q++],J[q>>>2]|=(128|63&V)<<d[3&q++]):(V=65536+((1023&V)<<10|1023&U.charCodeAt(++O)),J[q>>>2]|=(240|V>>>18)<<d[3&q++],J[q>>>2]|=(128|V>>>12&63)<<d[3&q++],J[q>>>2]|=(128|V>>>6&63)<<d[3&q++],J[q>>>2]|=(128|63&V)<<d[3&q++]);this.lastByteIndex=q,this.bytes+=q-this.start,q>=64?(this.block=J[16],this.start=q-64,this.hash(),this.hashed=!0):this.start=q}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296|0,this.bytes=this.bytes%4294967296),this}},P.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var U=this.blocks,M=this.lastByteIndex;U[16]=this.block,U[M>>>2]|=m[3&M],this.block=U[16],M>=56&&(this.hashed||this.hash(),U[0]=this.block,U[16]=U[1]=U[2]=U[3]=U[4]=U[5]=U[6]=U[7]=U[8]=U[9]=U[10]=U[11]=U[12]=U[13]=U[14]=U[15]=0),U[14]=this.hBytes<<3|this.bytes>>>29,U[15]=this.bytes<<3,this.hash()}},P.prototype.hash=function(){var U,M,K,V,q,O,X,J,le,te=this.h0,$=this.h1,H=this.h2,ee=this.h3,oe=this.h4,be=this.h5,_=this.h6,L=this.h7,Q=this.blocks;for(U=16;U<64;++U)M=((q=Q[U-15])>>>7|q<<25)^(q>>>18|q<<14)^q>>>3,K=((q=Q[U-2])>>>17|q<<15)^(q>>>19|q<<13)^q>>>10,Q[U]=Q[U-16]+M+Q[U-7]+K|0;for(le=$&H,U=0;U<64;U+=4)this.first?(this.is224?(O=300032,L=(q=Q[0]-1413257819)-150054599|0,ee=q+24177077|0):(O=704751109,L=(q=Q[0]-210244248)-1521486534|0,ee=q+143694565|0),this.first=!1):(M=(te>>>2|te<<30)^(te>>>13|te<<19)^(te>>>22|te<<10),V=(O=te&$)^te&H^le,L=ee+(q=L+(K=(oe>>>6|oe<<26)^(oe>>>11|oe<<21)^(oe>>>25|oe<<7))+(oe&be^~oe&_)+y[U]+Q[U])|0,ee=q+(M+V)|0),M=(ee>>>2|ee<<30)^(ee>>>13|ee<<19)^(ee>>>22|ee<<10),V=(X=ee&te)^ee&$^O,_=H+(q=_+(K=(L>>>6|L<<26)^(L>>>11|L<<21)^(L>>>25|L<<7))+(L&oe^~L&be)+y[U+1]+Q[U+1])|0,M=((H=q+(M+V)|0)>>>2|H<<30)^(H>>>13|H<<19)^(H>>>22|H<<10),V=(J=H&ee)^H&te^X,be=$+(q=be+(K=(_>>>6|_<<26)^(_>>>11|_<<21)^(_>>>25|_<<7))+(_&L^~_&oe)+y[U+2]+Q[U+2])|0,M=(($=q+(M+V)|0)>>>2|$<<30)^($>>>13|$<<19)^($>>>22|$<<10),V=(le=$&H)^$&ee^J,oe=te+(q=oe+(K=(be>>>6|be<<26)^(be>>>11|be<<21)^(be>>>25|be<<7))+(be&_^~be&L)+y[U+3]+Q[U+3])|0,te=q+(M+V)|0,this.chromeBugWorkAround=!0;this.h0=this.h0+te|0,this.h1=this.h1+$|0,this.h2=this.h2+H|0,this.h3=this.h3+ee|0,this.h4=this.h4+oe|0,this.h5=this.h5+be|0,this.h6=this.h6+_|0,this.h7=this.h7+L|0},P.prototype.hex=function(){this.finalize();var U=this.h0,M=this.h1,K=this.h2,V=this.h3,q=this.h4,O=this.h5,X=this.h6,J=this.h7,le=f[U>>>28&15]+f[U>>>24&15]+f[U>>>20&15]+f[U>>>16&15]+f[U>>>12&15]+f[U>>>8&15]+f[U>>>4&15]+f[15&U]+f[M>>>28&15]+f[M>>>24&15]+f[M>>>20&15]+f[M>>>16&15]+f[M>>>12&15]+f[M>>>8&15]+f[M>>>4&15]+f[15&M]+f[K>>>28&15]+f[K>>>24&15]+f[K>>>20&15]+f[K>>>16&15]+f[K>>>12&15]+f[K>>>8&15]+f[K>>>4&15]+f[15&K]+f[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[q>>>28&15]+f[q>>>24&15]+f[q>>>20&15]+f[q>>>16&15]+f[q>>>12&15]+f[q>>>8&15]+f[q>>>4&15]+f[15&q]+f[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[X>>>28&15]+f[X>>>24&15]+f[X>>>20&15]+f[X>>>16&15]+f[X>>>12&15]+f[X>>>8&15]+f[X>>>4&15]+f[15&X];return this.is224||(le+=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]),le},P.prototype.toString=P.prototype.hex,P.prototype.digest=function(){this.finalize();var U=this.h0,M=this.h1,K=this.h2,V=this.h3,q=this.h4,O=this.h5,X=this.h6,J=this.h7,le=[U>>>24&255,U>>>16&255,U>>>8&255,255&U,M>>>24&255,M>>>16&255,M>>>8&255,255&M,K>>>24&255,K>>>16&255,K>>>8&255,255&K,V>>>24&255,V>>>16&255,V>>>8&255,255&V,q>>>24&255,q>>>16&255,q>>>8&255,255&q,O>>>24&255,O>>>16&255,O>>>8&255,255&O,X>>>24&255,X>>>16&255,X>>>8&255,255&X];return this.is224||le.push(J>>>24&255,J>>>16&255,J>>>8&255,255&J),le},P.prototype.array=P.prototype.digest,P.prototype.arrayBuffer=function(){this.finalize();var U=new ArrayBuffer(this.is224?28:32),M=new DataView(U);return M.setUint32(0,this.h0),M.setUint32(4,this.h1),M.setUint32(8,this.h2),M.setUint32(12,this.h3),M.setUint32(16,this.h4),M.setUint32(20,this.h5),M.setUint32(24,this.h6),this.is224||M.setUint32(28,this.h7),U},F.prototype=new P,F.prototype.finalize=function(){if(P.prototype.finalize.call(this),this.inner){this.inner=!1;var U=this.array();P.call(this,this.is224,this.sharedMemory),this.update(this.oKeyPad),this.update(U),P.prototype.finalize.call(this)}};var ue=E();ue.sha256=ue,ue.sha224=E(!0),ue.sha256.hmac=D(),ue.sha224.hmac=D(!0),u?wh.exports=ue:(r.sha256=ue.sha256,r.sha224=ue.sha224)})();Xu.exports;Xu.exports.sha224;var S0=Xu.exports.sha256;function rd(e){return fk(e)}function ak(e){if(!/^[0-9A-Fa-f]+$/.test(e))return!1;const r=/^[0-9A-F]+$/.test(e),s=/^[0-9a-f]+$/.test(e);return r||s?e.length%2===0:!1}function lk(e){return/^[A-Za-z0-9\-_]*(={0,2})?$/.test(e)||/^[A-Za-z0-9+/]*(={0,2})?$/.test(e)}function ok(e){return ak(e)?"hex":lk(e)?"b64":""}function uk(e){if(e.length%2!==0)throw new Error("hex string must have an even length");const t=new Uint8Array(e.length/2);for(let r=0;r<e.length;r+=2)t[r/2]=parseInt(e.substring(r,r+2),16);return t}function ck(e){e=e.replace(/-/g,"+"),e=e.replace(/_/g,"/");const t=atob(e);return Uint8Array.from(t,r=>r.charCodeAt(0))}function fk(e){switch(ok(e)){case"hex":return uk(e);case"b64":return ck(e)}return null}function hk(e,t){const r=typeof e=="string"?rd(e):e,s=typeof t=="string"?rd(t):t;if(r===null||s===null||r.length!==s.length)return!1;for(let l=0;l<r.length;l++)if(r[l]!==s[l])return!1;return!0}class mx{constructor(t,r,s=!0){C(this,"token");C(this,"received");C(this,"ctx");C(this,"requestSubject");C(this,"mux");this.mux=t,this.requestSubject=r,this.received=0,this.token=Ui.next(),s&&(this.ctx=new Error)}}class dk extends mx{constructor(r,s,l={maxWait:1e3}){super(r,s);C(this,"callback");C(this,"done");C(this,"timer");C(this,"max");C(this,"opts");if(this.opts=l,typeof this.opts.callback!="function")throw new Error("callback is required");this.callback=this.opts.callback,this.max=typeof l.maxMessages=="number"&&l.maxMessages>0?l.maxMessages:-1,this.done=Ut(),this.done.then(()=>{this.callback(null,null)}),this.timer=setTimeout(()=>{this.cancel()},l.maxWait)}cancel(r){r&&this.callback(r,null),clearTimeout(this.timer),this.mux.cancel(this),this.done.resolve()}resolver(r,s){r?(this.ctx&&(r.stack+=`
|
|
67
|
-
|
|
68
|
-
${this.ctx.stack}`),this.cancel(r)):(this.callback(null,s),this.opts.strategy===yr.Count&&(this.max--,this.max===0&&this.cancel()),this.opts.strategy===yr.JitterTimer&&(clearTimeout(this.timer),this.timer=setTimeout(()=>{this.cancel()},this.opts.jitter||300)),this.opts.strategy===yr.SentinelMsg&&s&&s.data.length===0&&this.cancel())}}class px extends mx{constructor(r,s,l={timeout:1e3},u=!0){super(r,s,u);C(this,"deferred");C(this,"timer");this.deferred=Ut(),this.timer=ma(l.timeout,u)}resolver(r,s){this.timer&&this.timer.cancel(),r?(this.ctx&&(r.stack+=`
|
|
69
|
-
|
|
70
|
-
${this.ctx.stack}`),this.deferred.reject(r)):this.deferred.resolve(s),this.cancel()}cancel(r){this.timer&&this.timer.cancel(),this.mux.cancel(this),this.deferred.reject(r||Oe.errorForCode(Se.Cancelled))}}const mk="$JS.API";function pk(e){return e=e||{},e.domain&&(e.apiPrefix=`$JS.${e.domain}.API`,delete e.domain),Vu({apiPrefix:mk,timeout:5e3},e)}class $l{constructor(t,r){C(this,"nc");C(this,"opts");C(this,"prefix");C(this,"timeout");C(this,"jc");this.nc=t,this.opts=pk(r),this._parseOpts(),this.prefix=this.opts.apiPrefix,this.timeout=this.opts.timeout,this.jc=br()}getOptions(){return Object.assign({},this.opts)}_parseOpts(){let t=this.opts.apiPrefix;if(!t||t.length===0)throw new Error("invalid empty prefix");t[t.length-1]==="."&&(t=t.substr(0,t.length-1)),this.opts.apiPrefix=t}async _request(t,r=null,s){s=s||{},s.timeout=this.timeout;let l=Gn;r&&(l=this.jc.encode(r));let{retries:u}=s;u=u||1,u=u===-1?Number.MAX_SAFE_INTEGER:u;const c=Rd();for(let f=0;f<u;f++)try{const m=await this.nc.request(t,l,s);return this.parseJsResponse(m)}catch(m){const d=m;if((d.code==="503"||d.code===Se.Timeout)&&f+1<u)await Sa(c.backoff(f));else throw m}}async findStream(t){const r={subject:t},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(t){const r=this.jc.decode(t.data),s=r;if(s.error){const l=dx(s.error.code,s.error.description);if(l!==null)throw l.api_error=s.error,l}return r}}class Cl{constructor(t,r,s,l){C(this,"err");C(this,"offset");C(this,"pageInfo");C(this,"subject");C(this,"jsm");C(this,"filter");C(this,"payload");if(!t)throw new Error("subject is required");this.subject=t,this.jsm=s,this.offset=0,this.pageInfo={},this.filter=r,this.payload=l||{}}async next(){if(this.err)return[];if(this.pageInfo&&this.offset>=this.pageInfo.total)return[];const t={offset:this.offset};this.payload&&Object.assign(t,this.payload);try{const r=await this.jsm._request(this.subject,t,{timeout:this.jsm.timeout});this.pageInfo=r;const s=this.countResponse(r);return s===0?[]:(this.offset+=s,this.filter(r))}catch(r){throw this.err=r,r}}countResponse(t){var r,s,l;switch(t==null?void 0:t.type){case"io.nats.jetstream.api.v1.stream_names_response":case"io.nats.jetstream.api.v1.stream_list_response":return((r=t.streams)==null?void 0:r.length)||0;case"io.nats.jetstream.api.v1.consumer_list_response":return((s=t.consumers)==null?void 0:s.length)||0;default:return console.error(`jslister.ts: unknown API response for paged output: ${t==null?void 0:t.type}`),((l=t.streams)==null?void 0:l.length)||0}return 0}async*[Symbol.asyncIterator](){let t=await this.next();for(;t.length>0;){for(const r of t)yield r;t=await this.next()}}}function ds(e=""){const t=e.match(/(\d+).(\d+).(\d+)/);if(t)return{major:parseInt(t[1]),minor:parseInt(t[2]),micro:parseInt(t[3])};throw new Error(`'${e}' is not a semver value`)}function id(e,t){return e.major<t.major?-1:e.major>t.major?1:e.minor<t.minor?-1:e.minor>t.minor?1:e.micro<t.micro?-1:e.micro>t.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 gk{constructor(t){C(this,"server");C(this,"features");C(this,"disabled");this.features=new Map,this.disabled=[],this.update(t)}resetDisabled(){this.disabled.length=0,this.update(this.server)}disable(t){this.disabled.push(t),this.update(this.server)}isDisabled(t){return this.disabled.indexOf(t)!==-1}update(t){typeof t=="string"&&(t=ds(t)),this.server=t,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(t,r){this.features.set(t,{min:r,ok:id(this.server,ds(r))>=0})}get(t){return this.features.get(t)||{min:"unknown",ok:!1}}supports(t){var r;return((r=this.get(t))==null?void 0:r.ok)||!1}require(t){return typeof t=="string"&&(t=ds(t)),id(this.server,t)>=0}}class Ru extends $l{constructor(t,r){super(t,r)}async add(t,r,s=Ou.Create){if(bn(t),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=t,l.action=s,l.config.durable_name&&oa(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{Ju("name",m)}catch(x){const w=x.message,E=w.indexOf("cannot contain");throw E!==-1?new Error(`consumer 'name' ${w.substring(E)}`):x}let d,y="";if(Array.isArray(r.filter_subjects)){const{min:x,ok:w}=u.features.get(ut.JS_MULTIPLE_CONSUMER_FILTER);if(!w)throw new Error(`consumer 'filter_subjects' requires server ${x}`);f=!1}if(r.metadata){const{min:x,ok:w}=u.features.get(ut.JS_STREAM_CONSUMER_METADATA);if(!w)throw new Error(`consumer 'metadata' requires server ${x}`)}if(f&&(y=r.name??r.durable_name??""),y!==""){let x=r.filter_subject??void 0;x===">"&&(x=void 0),d=x!==void 0?`${this.prefix}.CONSUMER.CREATE.${t}.${y}.${x}`:`${this.prefix}.CONSUMER.CREATE.${t}.${y}`}else d=r.durable_name?`${this.prefix}.CONSUMER.DURABLE.CREATE.${t}.${r.durable_name}`:`${this.prefix}.CONSUMER.CREATE.${t}`;return await this._request(d,l)}async update(t,r,s){const l=await this.info(t,r),u=s;return this.add(t,Object.assign(l.config,u),Ou.Update)}async info(t,r){return bn(t),oa(r),await this._request(`${this.prefix}.CONSUMER.INFO.${t}.${r}`)}async delete(t,r){return bn(t),oa(r),(await this._request(`${this.prefix}.CONSUMER.DELETE.${t}.${r}`)).success}list(t){bn(t);const r=l=>l.consumers,s=`${this.prefix}.CONSUMER.LIST.${t}`;return new Cl(s,r,this)}pause(t,r,s){const l=`${this.prefix}.CONSUMER.PAUSE.${t}.${r}`,u={pause_until:s.toISOString()};return this._request(l,u)}resume(t,r){return this.pause(t,r,new Date(0))}}function Ws(e,t,r=!1){if(r===!0&&!e)throw Oe.errorForCode(Se.ApiError,new Error(`${t} is not a function`));if(e&&typeof e!="function")throw Oe.errorForCode(Se.ApiError,new Error(`${t} is not a function`))}class yk extends an{constructor(r,s,l){super();C(this,"sub");C(this,"adapter");C(this,"subIterDone");Ws(l.adapter,"adapter",!0),this.adapter=l.adapter,l.callback&&Ws(l.callback,"callback"),this.noIterator=typeof l.callback=="function",l.ingestionFilterFn&&(Ws(l.ingestionFilterFn,"ingestionFilterFn"),this.ingestionFilterFn=l.ingestionFilterFn),l.protocolFilterFn&&(Ws(l.protocolFilterFn,"protocolFilterFn"),this.protocolFilterFn=l.protocolFilterFn),l.dispatchedFn&&(Ws(l.dispatchedFn,"dispatchedFn"),this.dispatchedFn=l.dispatchedFn),l.cleanupFn&&Ws(l.cleanupFn,"cleanupFn");let u=(y,g)=>{this.callback(y,g)};if(l.callback){const y=l.callback;u=(g,x)=>{const[w,E]=this.adapter(g,x);if(w){y(w,null);return}const{ingest:R}=this.ingestionFilterFn?this.ingestionFilterFn(E,this):{ingest:!0};R&&(!this.protocolFilterFn||this.protocolFilterFn(E))&&(y(w,E),this.dispatchedFn&&E&&this.dispatchedFn(E))}}const{max:c,queue:f,timeout:m}=l,d={queue:f,timeout:m,callback:u};c&&c>0&&(d.max=c),this.sub=r.subscribe(s,d),l.cleanupFn&&(this.sub.cleanupFn=l.cleanupFn),this.noIterator||this.iterClosed.then(()=>{this.unsubscribe()}),this.subIterDone=Ut(),Promise.all([this.sub.closed,this.iterClosed]).then(()=>{this.subIterDone.resolve()}).catch(()=>{this.subIterDone.resolve()}),(async y=>{await y.closed,this.stop()})(this.sub).then().catch()}unsubscribe(r){this.sub.unsubscribe(r)}drain(){return this.sub.drain()}isDraining(){return this.sub.isDraining()}isClosed(){return this.sub.isClosed()}callback(r,s){this.sub.cancelTimeout();const[l,u]=this.adapter(r,s);l&&this.stop(l),u&&this.push(u)}getSubject(){return this.sub.getSubject()}getReceived(){return this.sub.getReceived()}getProcessed(){return this.sub.getProcessed()}getPending(){return this.sub.getPending()}getID(){return this.sub.getID()}getMax(){return this.sub.getMax()}get closed(){return this.sub.closed}}let $n;function bk(e){$n=e}function gx(){return $n!==void 0&&$n.defaultPort!==void 0?$n.defaultPort:4222}function Sh(){return $n!==void 0&&$n.urlParseFn?$n.urlParseFn:void 0}function xk(){if(!$n||typeof $n.factory!="function")throw new Error("transport fn is not set");return $n.factory()}function sd(){return $n!==void 0&&$n.dnsResolveFn?$n.dnsResolveFn:void 0}const Su=`\r
|
|
71
|
-
`,Mu=ga.fromAscii(Su),vk=new Uint8Array(Mu)[0],wk=new Uint8Array(Mu)[1];function Sk(e){for(let t=0;t<e.length;t++){const r=t+1;if(e.byteLength>r&&e[t]===vk&&e[r]===wk)return r+1}return 0}function _k(e){const t=Sk(e);if(t>0){const s=new Uint8Array(e).slice(0,t);return Fn.decode(s)}return""}const kk=4,yx=48,Ek=65,Ck=97;function Ak(e,t,r,s){const l=new Uint8Array(16);return[0,0,0,0,0,0,0,0,0,0,255,255].forEach((c,f)=>{l[f]=c}),l[12]=e,l[13]=t,l[14]=r,l[15]=s,l}function ad(e){return Tk(e)!==void 0}function Tk(e){for(let t=0;t<e.length;t++)switch(e[t]){case".":return bx(e);case":":return jk(e)}}function bx(e){const t=new Uint8Array(4);for(let r=0;r<4;r++){if(e.length===0)return;if(r>0){if(e[0]!==".")return;e=e.substring(1)}const{n:s,c:l,ok:u}=Nk(e);if(!u||s>255)return;e=e.substring(l),t[r]=s}return Ak(t[0],t[1],t[2],t[3])}function jk(e){const t=new Uint8Array(16);let r=-1;if(e.length>=2&&e[0]===":"&&e[1]===":"&&(r=0,e=e.substring(2),e.length===0))return t;let s=0;for(;s<16;){const{n:l,c:u,ok:c}=Ok(e);if(!c||l>65535)return;if(u<e.length&&e[u]==="."){if(r<0&&s!=12||s+4>16)return;const f=bx(e);if(f===void 0)return;t[s]=f[12],t[s+1]=f[13],t[s+2]=f[14],t[s+3]=f[15],e="",s+=kk;break}if(t[s]=l>>8,t[s+1]=l,s+=2,e=e.substring(u),e.length===0)break;if(e[0]!==":"||e.length==1)return;if(e=e.substring(1),e[0]===":"){if(r>=0)return;if(r=s,e=e.substring(1),e.length===0)break}}if(e.length===0){if(s<16){if(r<0)return;const l=16-s;for(let u=s-1;u>=r;u--)t[u+l]=t[u];for(let u=r+l-1;u>=r;u--)t[u]=0}else if(r>=0)return;return t}}function Nk(e){let t=0,r=0;for(t=0;t<e.length&&48<=e.charCodeAt(t)&&e.charCodeAt(t)<=57;t++)if(r=r*10+(e.charCodeAt(t)-yx),r>=16777215)return{n:16777215,c:t,ok:!1};return t===0?{n:0,c:0,ok:!1}:{n:r,c:t,ok:!0}}function Ok(e){let t=0,r=0;for(r=0;r<e.length;r++){if(48<=e.charCodeAt(r)&&e.charCodeAt(r)<=57)t*=16,t+=e.charCodeAt(r)-yx;else if(97<=e.charCodeAt(r)&&e.charCodeAt(r)<=102)t*=16,t+=e.charCodeAt(r)-Ck+10;else if(65<=e.charCodeAt(r)&&e.charCodeAt(r)<=70)t*=16,t+=e.charCodeAt(r)-Ek+10;else break;if(t>=16777215)return{n:0,c:r,ok:!1}}return r===0?{n:0,c:r,ok:!1}:{n:t,c:r,ok:!0}}function Rk(e){return e.indexOf("[")!==-1||e.indexOf("::")!==-1?!1:e.indexOf(".")!==-1||e.split(":").length<=2}function ld(e){return!Rk(e)}function Mk(e){const t="::FFFF:",r=e.toUpperCase().indexOf(t);if(r!==-1&&e.indexOf(".")!==-1){let s=e.substring(r+t.length);return s=s.replace("[",""),s.replace("]","")}return e}function Dk(e){e=e.trim(),e.match(/^(.*:\/\/)(.*)/m)&&(e=e.replace(/^(.*:\/\/)(.*)/gm,"$2")),e=Mk(e),ld(e)&&e.indexOf("[")===-1&&(e=`[${e}]`);const t=ld(e)?e.match(/(]:)(\d+)/):e.match(/(:)(\d+)/),r=t&&t.length===3&&t[1]&&t[2]?parseInt(t[2]):4222,s=r===80?"https":"http",l=new URL(`${s}://${e}`);l.port=`${r}`;let u=l.hostname;return u.charAt(0)==="["&&(u=u.substring(1,u.length-1)),{listen:l.host,hostname:u,port:r}}class jl{constructor(t,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=t,this.tlsName="";const s=Dk(t);this.listen=s.listen,this.hostname=s.hostname,this.port=s.port,this.didConnect=!1,this.reconnects=0,this.lastConnect=0,this.gossiped=r}toString(){return this.listen}async resolve(t){if(!t.fn||t.resolve===!1)return[this];const r=[];if(ad(this.hostname))return[this];{const s=await t.fn(this.hostname);t.debug&&console.log(`resolve ${this.hostname} = ${s.join(",")}`);for(const l of s){const u=this.port===80?"https":"http",c=new URL(`${u}://${ld(l)?"["+l+"]":l}`);c.port=`${this.port}`;const f=new jl(c.host,!1);f.tlsName=this.hostname,r.push(f)}}return t.randomize&&fx(r),this.resolves=r,r}}class Lk{constructor(t=[],r={}){C(this,"firstSelect");C(this,"servers");C(this,"currentServer");C(this,"tlsName");C(this,"randomize");this.firstSelect=!0,this.servers=[],this.tlsName="",this.randomize=r.randomize||!1;const s=Sh();t&&(t.forEach(l=>{l=s?s(l):l,this.servers.push(new jl(l))}),this.randomize&&(this.servers=fx(this.servers))),this.servers.length===0&&this.addServer(`${Zh}:${gx()}`,!1),this.currentServer=this.servers[0]}clear(){this.servers.length=0}updateTLSName(){const t=this.getCurrentServer();ad(t.hostname)||(this.tlsName=t.hostname,this.servers.forEach(r=>{r.gossiped&&(r.tlsName=this.tlsName)}))}getCurrentServer(){return this.currentServer}addServer(t,r=!1){const s=Sh();t=s?s(t):t;const l=new jl(t,r);ad(l.hostname)&&(l.tlsName=this.tlsName),this.servers.push(l)}selectServer(){if(this.firstSelect)return this.firstSelect=!1,this.currentServer;const t=this.servers.shift();return t&&(this.servers.push(t),this.currentServer=t),t}removeCurrentServer(){this.removeServer(this.currentServer)}removeServer(t){if(t){const r=this.servers.indexOf(t);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(t,r){const s=[];let l=[];const u=Sh(),c=new Map;t.connect_urls&&t.connect_urls.length>0&&t.connect_urls.forEach(m=>{m=u?u(m,r):m;const d=new jl(m,!0);c.set(m,d)});const f=[];return this.servers.forEach((m,d)=>{const y=m.listen;m.gossiped&&this.currentServer.listen!==y&&c.get(y)===void 0&&f.push(d),c.delete(y)}),f.reverse(),f.forEach(m=>{const d=this.servers.splice(m,1);l=l.concat(d[0].listen)}),c.forEach((m,d)=>{this.servers.push(m),s.push(d)}),{added:s,deleted:l}}}class zk{constructor(){C(this,"baseInbox");C(this,"reqs");this.reqs=new Map}size(){return this.reqs.size}init(t){return this.baseInbox=`${ei(t)}.`,this.baseInbox}add(t){isNaN(t.received)||(t.received=0),this.reqs.set(t.token,t)}get(t){return this.reqs.get(t)}cancel(t){this.reqs.delete(t.token)}getToken(t){const r=t.subject||"";return r.indexOf(this.baseInbox)===0?r.substring(this.baseInbox.length):null}all(){return Array.from(this.reqs.values())}handleError(t,r){if(r&&r.permissionContext){if(t)return this.all().forEach(l=>{l.resolver(r,{})}),!0;const s=r.permissionContext;if(s.operation==="publish"){const l=this.all().find(u=>u.requestSubject===s.subject);if(l)return l.resolver(r,{}),!0}}return!1}dispatcher(){return(t,r)=>{const s=this.getToken(r);if(s){const l=this.get(s);l&&(t===null&&r.headers&&(t=hx(r)),l.resolver(t,r))}}}close(){const t=Oe.errorForCode(Se.Timeout);this.reqs.forEach(r=>{r.resolver(t,{})})}}class Uk{constructor(t,r,s){C(this,"ph");C(this,"interval");C(this,"maxOut");C(this,"timer");C(this,"pendings");this.ph=t,this.interval=r,this.maxOut=s,this.pendings=[]}start(){this.cancel(),this._schedule()}cancel(t){this.timer&&(clearTimeout(this.timer),this.timer=void 0),this._reset(),t&&this.ph.disconnect()}_schedule(){this.timer=setTimeout(()=>{if(this.ph.dispatchStatus({type:la.PingTimer,data:`${this.pendings.length+1}`}),this.pendings.length===this.maxOut){this.cancel(!0);return}const t=Ut();this.ph.flush(t).then(()=>{this._reset()}).catch(()=>{this.cancel()}),this.pendings.push(t),this._schedule()},this.interval)}_reset(){this.pendings=this.pendings.filter(t=>(t.resolve(),!1))}}class Bk extends Error{constructor(t){super(t),this.name="AssertionError"}}function Pk(e,t="Assertion failed."){if(!e)throw new Bk(t)}const _0=32*1024,_h=2**32-2;function fu(e,t,r=0){const s=t.byteLength-r;return e.byteLength>s&&(e=e.subarray(0,s)),t.set(e,r),e.byteLength}class kh{constructor(t){C(this,"_buf");C(this,"_off");if(this._off=0,t==null){this._buf=new Uint8Array(0);return}this._buf=new Uint8Array(t)}bytes(t={copy:!0}){return t.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(t){if(t===0){this.reset();return}if(t<0||t>this.length)throw Error("bytes.Buffer: truncation out of range");this._reslice(this._off+t)}reset(){this._reslice(0),this._off=0}_tryGrowByReslice(t){const r=this._buf.byteLength;return t<=this.capacity-r?(this._reslice(r+t),r):-1}_reslice(t){Pk(t<=this._buf.buffer.byteLength),this._buf=new Uint8Array(this._buf.buffer,0,t)}readByte(){const t=new Uint8Array(1);return this.read(t)?t[0]:null}read(t){if(this.empty())return this.reset(),t.byteLength===0?0:null;const r=fu(this._buf.subarray(this._off),t);return this._off+=r,r}writeByte(t){return this.write(Uint8Array.of(t))}writeString(t){return this.write(qi.encode(t))}write(t){const r=this._grow(t.byteLength);return fu(t,this._buf,r)}_grow(t){const r=this.length;r===0&&this._off!==0&&this.reset();const s=this._tryGrowByReslice(t);if(s>=0)return s;const l=this.capacity;if(t<=Math.floor(l/2)-r)fu(this._buf.subarray(this._off),this._buf);else{if(l+t>_h)throw new Error("The buffer cannot be grown beyond the maximum size.");{const u=new Uint8Array(Math.min(2*l+t,_h));fu(this._buf.subarray(this._off),u),this._buf=u}}return this._off=0,this._reslice(Math.min(r+t,_h)),r}grow(t){if(t<0)throw Error("Buffer._grow: negative count");const r=this._grow(t);this._reslice(r)}readFrom(t){let r=0;const s=new Uint8Array(_0);for(;;){const l=this.capacity-this.length<_0,u=l?s:new Uint8Array(this._buf.buffer,this.length),c=t.read(u);if(c===null)return r;l?this.write(u.subarray(0,c)):this._reslice(this.length+c),r+=c}}}var xn;(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"})(xn||(xn={}));function k0(){const e={};return e.sid=-1,e.hdr=-1,e.size=-1,e}const qk=48;class E0{constructor(t){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=t,this.state=ke.OP_START,this.as=0,this.drop=0,this.hdr=0}parse(t){let r;for(r=0;r<t.length;r++){const s=t[r];switch(this.state){case ke.OP_START:switch(s){case Ee.M:case Ee.m:this.state=ke.OP_M,this.hdr=-1,this.ma=k0();break;case Ee.H:case Ee.h:this.state=ke.OP_H,this.hdr=0,this.ma=k0();break;case Ee.P:case Ee.p:this.state=ke.OP_P;break;case Ee.PLUS:this.state=ke.OP_PLUS;break;case Ee.MINUS:this.state=ke.OP_MINUS;break;case Ee.I:case Ee.i:this.state=ke.OP_I;break;default:throw this.fail(t.subarray(r))}break;case ke.OP_H:switch(s){case Ee.M:case Ee.m:this.state=ke.OP_M;break;default:throw this.fail(t.subarray(r))}break;case ke.OP_M:switch(s){case Ee.S:case Ee.s:this.state=ke.OP_MS;break;default:throw this.fail(t.subarray(r))}break;case ke.OP_MS:switch(s){case Ee.G:case Ee.g:this.state=ke.OP_MSG;break;default:throw this.fail(t.subarray(r))}break;case ke.OP_MSG:switch(s){case Ee.SPACE:case Ee.TAB:this.state=ke.OP_MSG_SPC;break;default:throw this.fail(t.subarray(r))}break;case ke.OP_MSG_SPC:switch(s){case Ee.SPACE:case Ee.TAB:continue;default:this.state=ke.MSG_ARG,this.as=r}break;case ke.MSG_ARG:switch(s){case Ee.CR:this.drop=1;break;case Ee.NL:{const l=this.argBuf?this.argBuf.bytes():t.subarray(this.as,r-this.drop);this.processMsgArgs(l),this.drop=0,this.as=r+1,this.state=ke.MSG_PAYLOAD,r=this.as+this.ma.size-1;break}default:this.argBuf&&this.argBuf.writeByte(s)}break;case ke.MSG_PAYLOAD:if(this.msgBuf)if(this.msgBuf.length>=this.ma.size){const l=this.msgBuf.bytes({copy:!1});this.dispatcher.push({kind:xn.MSG,msg:this.ma,data:l}),this.argBuf=void 0,this.msgBuf=void 0,this.state=ke.MSG_END}else{let l=this.ma.size-this.msgBuf.length;const u=t.length-r;u<l&&(l=u),l>0?(this.msgBuf.write(t.subarray(r,r+l)),r=r+l-1):this.msgBuf.writeByte(s)}else r-this.as>=this.ma.size&&(this.dispatcher.push({kind:xn.MSG,msg:this.ma,data:t.subarray(this.as,r)}),this.argBuf=void 0,this.msgBuf=void 0,this.state=ke.MSG_END);break;case ke.MSG_END:switch(s){case Ee.NL:this.drop=0,this.as=r+1,this.state=ke.OP_START;break;default:continue}break;case ke.OP_PLUS:switch(s){case Ee.O:case Ee.o:this.state=ke.OP_PLUS_O;break;default:throw this.fail(t.subarray(r))}break;case ke.OP_PLUS_O:switch(s){case Ee.K:case Ee.k:this.state=ke.OP_PLUS_OK;break;default:throw this.fail(t.subarray(r))}break;case ke.OP_PLUS_OK:switch(s){case Ee.NL:this.dispatcher.push({kind:xn.OK}),this.drop=0,this.state=ke.OP_START;break}break;case ke.OP_MINUS:switch(s){case Ee.E:case Ee.e:this.state=ke.OP_MINUS_E;break;default:throw this.fail(t.subarray(r))}break;case ke.OP_MINUS_E:switch(s){case Ee.R:case Ee.r:this.state=ke.OP_MINUS_ER;break;default:throw this.fail(t.subarray(r))}break;case ke.OP_MINUS_ER:switch(s){case Ee.R:case Ee.r:this.state=ke.OP_MINUS_ERR;break;default:throw this.fail(t.subarray(r))}break;case ke.OP_MINUS_ERR:switch(s){case Ee.SPACE:case Ee.TAB:this.state=ke.OP_MINUS_ERR_SPC;break;default:throw this.fail(t.subarray(r))}break;case ke.OP_MINUS_ERR_SPC:switch(s){case Ee.SPACE:case Ee.TAB:continue;default:this.state=ke.MINUS_ERR_ARG,this.as=r}break;case ke.MINUS_ERR_ARG:switch(s){case Ee.CR:this.drop=1;break;case Ee.NL:{let l;this.argBuf?(l=this.argBuf.bytes(),this.argBuf=void 0):l=t.subarray(this.as,r-this.drop),this.dispatcher.push({kind:xn.ERR,data:l}),this.drop=0,this.as=r+1,this.state=ke.OP_START;break}default:this.argBuf&&this.argBuf.write(Uint8Array.of(s))}break;case ke.OP_P:switch(s){case Ee.I:case Ee.i:this.state=ke.OP_PI;break;case Ee.O:case Ee.o:this.state=ke.OP_PO;break;default:throw this.fail(t.subarray(r))}break;case ke.OP_PO:switch(s){case Ee.N:case Ee.n:this.state=ke.OP_PON;break;default:throw this.fail(t.subarray(r))}break;case ke.OP_PON:switch(s){case Ee.G:case Ee.g:this.state=ke.OP_PONG;break;default:throw this.fail(t.subarray(r))}break;case ke.OP_PONG:switch(s){case Ee.NL:this.dispatcher.push({kind:xn.PONG}),this.drop=0,this.state=ke.OP_START;break}break;case ke.OP_PI:switch(s){case Ee.N:case Ee.n:this.state=ke.OP_PIN;break;default:throw this.fail(t.subarray(r))}break;case ke.OP_PIN:switch(s){case Ee.G:case Ee.g:this.state=ke.OP_PING;break;default:throw this.fail(t.subarray(r))}break;case ke.OP_PING:switch(s){case Ee.NL:this.dispatcher.push({kind:xn.PING}),this.drop=0,this.state=ke.OP_START;break}break;case ke.OP_I:switch(s){case Ee.N:case Ee.n:this.state=ke.OP_IN;break;default:throw this.fail(t.subarray(r))}break;case ke.OP_IN:switch(s){case Ee.F:case Ee.f:this.state=ke.OP_INF;break;default:throw this.fail(t.subarray(r))}break;case ke.OP_INF:switch(s){case Ee.O:case Ee.o:this.state=ke.OP_INFO;break;default:throw this.fail(t.subarray(r))}break;case ke.OP_INFO:switch(s){case Ee.SPACE:case Ee.TAB:this.state=ke.OP_INFO_SPC;break;default:throw this.fail(t.subarray(r))}break;case ke.OP_INFO_SPC:switch(s){case Ee.SPACE:case Ee.TAB:continue;default:this.state=ke.INFO_ARG,this.as=r}break;case ke.INFO_ARG:switch(s){case Ee.CR:this.drop=1;break;case Ee.NL:{let l;this.argBuf?(l=this.argBuf.bytes(),this.argBuf=void 0):l=t.subarray(this.as,r-this.drop),this.dispatcher.push({kind:xn.INFO,data:l}),this.drop=0,this.as=r+1,this.state=ke.OP_START;break}default:this.argBuf&&this.argBuf.writeByte(s)}break;default:throw this.fail(t.subarray(r))}}(this.state===ke.MSG_ARG||this.state===ke.MINUS_ERR_ARG||this.state===ke.INFO_ARG)&&!this.argBuf&&(this.argBuf=new kh(t.subarray(this.as,r-this.drop))),this.state===ke.MSG_PAYLOAD&&!this.msgBuf&&(this.argBuf||this.cloneMsgArg(),this.msgBuf=new kh(t.subarray(this.as)))}cloneMsgArg(){const t=this.ma.subject.length,r=this.ma.reply?this.ma.reply.length:0,s=new Uint8Array(t+r);s.set(this.ma.subject),this.ma.reply&&s.set(this.ma.reply,t),this.argBuf=new kh(s),this.ma.subject=s.subarray(0,t),this.ma.reply&&(this.ma.reply=s.subarray(t))}processMsgArgs(t){if(this.hdr>=0)return this.processHeaderMsgArgs(t);const r=[];let s=-1;for(let l=0;l<t.length;l++)switch(t[l]){case Ee.SPACE:case Ee.TAB:case Ee.CR:case Ee.NL:s>=0&&(r.push(t.subarray(s,l)),s=-1);break;default:s<0&&(s=l)}switch(s>=0&&r.push(t.subarray(s)),r.length){case 3:this.ma.subject=r[0],this.ma.sid=this.protoParseInt(r[1]),this.ma.reply=void 0,this.ma.size=this.protoParseInt(r[2]);break;case 4:this.ma.subject=r[0],this.ma.sid=this.protoParseInt(r[1]),this.ma.reply=r[2],this.ma.size=this.protoParseInt(r[3]);break;default:throw this.fail(t,"processMsgArgs Parse Error")}if(this.ma.sid<0)throw this.fail(t,"processMsgArgs Bad or Missing Sid Error");if(this.ma.size<0)throw this.fail(t,"processMsgArgs Bad or Missing Size Error")}fail(t,r=""){return r?r=`${r} [${this.state}]`:r=`parse error [${this.state}]`,new Error(`${r}: ${Fn.decode(t)}`)}processHeaderMsgArgs(t){const r=[];let s=-1;for(let l=0;l<t.length;l++)switch(t[l]){case Ee.SPACE:case Ee.TAB:case Ee.CR:case Ee.NL:s>=0&&(r.push(t.subarray(s,l)),s=-1);break;default:s<0&&(s=l)}switch(s>=0&&r.push(t.subarray(s)),r.length){case 4:this.ma.subject=r[0],this.ma.sid=this.protoParseInt(r[1]),this.ma.reply=void 0,this.ma.hdr=this.protoParseInt(r[2]),this.ma.size=this.protoParseInt(r[3]);break;case 5:this.ma.subject=r[0],this.ma.sid=this.protoParseInt(r[1]),this.ma.reply=r[2],this.ma.hdr=this.protoParseInt(r[3]),this.ma.size=this.protoParseInt(r[4]);break;default:throw this.fail(t,"processHeaderMsgArgs Parse Error")}if(this.ma.sid<0)throw this.fail(t,"processHeaderMsgArgs Bad or Missing Sid Error");if(this.ma.hdr<0||this.ma.hdr>this.ma.size)throw this.fail(t,"processHeaderMsgArgs Bad or Missing Header Size Error");if(this.ma.size<0)throw this.fail(t,"processHeaderMsgArgs Bad or Missing Size Error")}protoParseInt(t){if(t.length===0)return-1;let r=0;for(let s=0;s<t.length;s++){if(t[s]<48||t[s]>57)return-1;r=r*10+(t[s]-qk)}return r}}var ke;(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"})(ke||(ke={}));var Ee;(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"})(Ee||(Ee={}));(function(e){var t=function(k,N){this.hi=k|0,this.lo=N|0},r=function(k){var N,T=new Float64Array(16);if(k)for(N=0;N<k.length;N++)T[N]=k[N];return T},s=function(){throw new Error("no PRNG")},l=new Uint8Array(16),u=new Uint8Array(32);u[0]=9;var c=r(),f=r([1]),m=r([56129,1]),d=r([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),y=r([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),g=r([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),x=r([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),w=r([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function E(k,N){return k<<N|k>>>32-N}function R(k,N){var T=k[N+3]&255;return T=T<<8|k[N+2]&255,T=T<<8|k[N+1]&255,T<<8|k[N+0]&255}function B(k,N){var T=k[N]<<24|k[N+1]<<16|k[N+2]<<8|k[N+3],z=k[N+4]<<24|k[N+5]<<16|k[N+6]<<8|k[N+7];return new t(T,z)}function D(k,N,T){var z;for(z=0;z<4;z++)k[N+z]=T&255,T>>>=8}function P(k,N,T){k[N]=T.hi>>24&255,k[N+1]=T.hi>>16&255,k[N+2]=T.hi>>8&255,k[N+3]=T.hi&255,k[N+4]=T.lo>>24&255,k[N+5]=T.lo>>16&255,k[N+6]=T.lo>>8&255,k[N+7]=T.lo&255}function F(k,N,T,z,Y){var W,pe=0;for(W=0;W<Y;W++)pe|=k[N+W]^T[z+W];return(1&pe-1>>>8)-1}function ue(k,N,T,z){return F(k,N,T,z,16)}function U(k,N,T,z){return F(k,N,T,z,32)}function M(k,N,T,z,Y){var W=new Uint32Array(16),pe=new Uint32Array(16),ye=new Uint32Array(16),se=new Uint32Array(4),me,Re,Ze;for(me=0;me<4;me++)pe[5*me]=R(z,4*me),pe[1+me]=R(T,4*me),pe[6+me]=R(N,4*me),pe[11+me]=R(T,16+4*me);for(me=0;me<16;me++)ye[me]=pe[me];for(me=0;me<20;me++){for(Re=0;Re<4;Re++){for(Ze=0;Ze<4;Ze++)se[Ze]=pe[(5*Re+4*Ze)%16];for(se[1]^=E(se[0]+se[3]|0,7),se[2]^=E(se[1]+se[0]|0,9),se[3]^=E(se[2]+se[1]|0,13),se[0]^=E(se[3]+se[2]|0,18),Ze=0;Ze<4;Ze++)W[4*Re+(Re+Ze)%4]=se[Ze]}for(Ze=0;Ze<16;Ze++)pe[Ze]=W[Ze]}if(Y){for(me=0;me<16;me++)pe[me]=pe[me]+ye[me]|0;for(me=0;me<4;me++)pe[5*me]=pe[5*me]-R(z,4*me)|0,pe[6+me]=pe[6+me]-R(N,4*me)|0;for(me=0;me<4;me++)D(k,4*me,pe[5*me]),D(k,16+4*me,pe[6+me])}else for(me=0;me<16;me++)D(k,4*me,pe[me]+ye[me]|0)}function K(k,N,T,z){return M(k,N,T,z,!1),0}function V(k,N,T,z){return M(k,N,T,z,!0),0}var q=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function O(k,N,T,z,Y,W,pe){var ye=new Uint8Array(16),se=new Uint8Array(64),me,Re;if(!Y)return 0;for(Re=0;Re<16;Re++)ye[Re]=0;for(Re=0;Re<8;Re++)ye[Re]=W[Re];for(;Y>=64;){for(K(se,ye,pe,q),Re=0;Re<64;Re++)k[N+Re]=(T?T[z+Re]:0)^se[Re];for(me=1,Re=8;Re<16;Re++)me=me+(ye[Re]&255)|0,ye[Re]=me&255,me>>>=8;Y-=64,N+=64,T&&(z+=64)}if(Y>0)for(K(se,ye,pe,q),Re=0;Re<Y;Re++)k[N+Re]=(T?T[z+Re]:0)^se[Re];return 0}function X(k,N,T,z,Y){return O(k,N,null,0,T,z,Y)}function J(k,N,T,z,Y){var W=new Uint8Array(32);return V(W,z,Y,q),X(k,N,T,z.subarray(16),W)}function le(k,N,T,z,Y,W,pe){var ye=new Uint8Array(32);return V(ye,W,pe,q),O(k,N,T,z,Y,W.subarray(16),ye)}function te(k,N){var T,z=0;for(T=0;T<17;T++)z=z+(k[T]+N[T]|0)|0,k[T]=z&255,z>>>=8}var $=new Uint32Array([5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,252]);function H(k,N,T,z,Y,W){var pe,ye,se,me,Re=new Uint32Array(17),Ze=new Uint32Array(17),Rt=new Uint32Array(17),hn=new Uint32Array(17),fr=new Uint32Array(17);for(se=0;se<17;se++)Ze[se]=Rt[se]=0;for(se=0;se<16;se++)Ze[se]=W[se];for(Ze[3]&=15,Ze[4]&=252,Ze[7]&=15,Ze[8]&=252,Ze[11]&=15,Ze[12]&=252,Ze[15]&=15;Y>0;){for(se=0;se<17;se++)hn[se]=0;for(se=0;se<16&&se<Y;++se)hn[se]=T[z+se];for(hn[se]=1,z+=se,Y-=se,te(Rt,hn),ye=0;ye<17;ye++)for(Re[ye]=0,se=0;se<17;se++)Re[ye]=Re[ye]+Rt[se]*(se<=ye?Ze[ye-se]:320*Ze[ye+17-se]|0)|0|0;for(ye=0;ye<17;ye++)Rt[ye]=Re[ye];for(me=0,se=0;se<16;se++)me=me+Rt[se]|0,Rt[se]=me&255,me>>>=8;for(me=me+Rt[16]|0,Rt[16]=me&3,me=5*(me>>>2)|0,se=0;se<16;se++)me=me+Rt[se]|0,Rt[se]=me&255,me>>>=8;me=me+Rt[16]|0,Rt[16]=me}for(se=0;se<17;se++)fr[se]=Rt[se];for(te(Rt,$),pe=-(Rt[16]>>>7)|0,se=0;se<17;se++)Rt[se]^=pe&(fr[se]^Rt[se]);for(se=0;se<16;se++)hn[se]=W[se+16];for(hn[16]=0,te(Rt,hn),se=0;se<16;se++)k[N+se]=Rt[se];return 0}function ee(k,N,T,z,Y,W){var pe=new Uint8Array(16);return H(pe,0,T,z,Y,W),ue(k,N,pe,0)}function oe(k,N,T,z,Y){var W;if(T<32)return-1;for(le(k,0,N,0,T,z,Y),H(k,16,k,32,T-32,k),W=0;W<16;W++)k[W]=0;return 0}function be(k,N,T,z,Y){var W,pe=new Uint8Array(32);if(T<32||(J(pe,0,32,z,Y),ee(N,16,N,32,T-32,pe)!==0))return-1;for(le(k,0,N,0,T,z,Y),W=0;W<32;W++)k[W]=0;return 0}function _(k,N){var T;for(T=0;T<16;T++)k[T]=N[T]|0}function L(k){var N,T;for(T=0;T<16;T++)k[T]+=65536,N=Math.floor(k[T]/65536),k[(T+1)*(T<15?1:0)]+=N-1+37*(N-1)*(T===15?1:0),k[T]-=N*65536}function Q(k,N,T){for(var z,Y=~(T-1),W=0;W<16;W++)z=Y&(k[W]^N[W]),k[W]^=z,N[W]^=z}function A(k,N){var T,z,Y,W=r(),pe=r();for(T=0;T<16;T++)pe[T]=N[T];for(L(pe),L(pe),L(pe),z=0;z<2;z++){for(W[0]=pe[0]-65517,T=1;T<15;T++)W[T]=pe[T]-65535-(W[T-1]>>16&1),W[T-1]&=65535;W[15]=pe[15]-32767-(W[14]>>16&1),Y=W[15]>>16&1,W[14]&=65535,Q(pe,W,1-Y)}for(T=0;T<16;T++)k[2*T]=pe[T]&255,k[2*T+1]=pe[T]>>8}function xe(k,N){var T=new Uint8Array(32),z=new Uint8Array(32);return A(T,k),A(z,N),U(T,0,z,0)}function _e(k){var N=new Uint8Array(32);return A(N,k),N[0]&1}function Te(k,N){var T;for(T=0;T<16;T++)k[T]=N[2*T]+(N[2*T+1]<<8);k[15]&=32767}function Le(k,N,T){var z;for(z=0;z<16;z++)k[z]=N[z]+T[z]|0}function $e(k,N,T){var z;for(z=0;z<16;z++)k[z]=N[z]-T[z]|0}function Ce(k,N,T){var z,Y,W=new Float64Array(31);for(z=0;z<31;z++)W[z]=0;for(z=0;z<16;z++)for(Y=0;Y<16;Y++)W[z+Y]+=N[z]*T[Y];for(z=0;z<15;z++)W[z]+=38*W[z+16];for(z=0;z<16;z++)k[z]=W[z];L(k),L(k)}function Ne(k,N){Ce(k,N,N)}function je(k,N){var T=r(),z;for(z=0;z<16;z++)T[z]=N[z];for(z=253;z>=0;z--)Ne(T,T),z!==2&&z!==4&&Ce(T,T,N);for(z=0;z<16;z++)k[z]=T[z]}function Fe(k,N){var T=r(),z;for(z=0;z<16;z++)T[z]=N[z];for(z=250;z>=0;z--)Ne(T,T),z!==1&&Ce(T,T,N);for(z=0;z<16;z++)k[z]=T[z]}function Qe(k,N,T){var z=new Uint8Array(32),Y=new Float64Array(80),W,pe,ye=r(),se=r(),me=r(),Re=r(),Ze=r(),Rt=r();for(pe=0;pe<31;pe++)z[pe]=N[pe];for(z[31]=N[31]&127|64,z[0]&=248,Te(Y,T),pe=0;pe<16;pe++)se[pe]=Y[pe],Re[pe]=ye[pe]=me[pe]=0;for(ye[0]=Re[0]=1,pe=254;pe>=0;--pe)W=z[pe>>>3]>>>(pe&7)&1,Q(ye,se,W),Q(me,Re,W),Le(Ze,ye,me),$e(ye,ye,me),Le(me,se,Re),$e(se,se,Re),Ne(Re,Ze),Ne(Rt,ye),Ce(ye,me,ye),Ce(me,se,Ze),Le(Ze,ye,me),$e(ye,ye,me),Ne(se,ye),$e(me,Re,Rt),Ce(ye,me,m),Le(ye,ye,Re),Ce(me,me,ye),Ce(ye,Re,Rt),Ce(Re,se,Y),Ne(se,Ze),Q(ye,se,W),Q(me,Re,W);for(pe=0;pe<16;pe++)Y[pe+16]=ye[pe],Y[pe+32]=me[pe],Y[pe+48]=se[pe],Y[pe+64]=Re[pe];var hn=Y.subarray(32),fr=Y.subarray(16);return je(hn,hn),Ce(fr,fr,hn),A(k,fr),0}function qe(k,N){return Qe(k,N,u)}function ct(k,N){return s(N,32),qe(k,N)}function vt(k,N,T){var z=new Uint8Array(32);return Qe(z,T,N),V(k,l,z,q)}var Ve=oe,He=be;function nt(k,N,T,z,Y,W){var pe=new Uint8Array(32);return vt(pe,Y,W),Ve(k,N,T,z,pe)}function ft(k,N,T,z,Y,W){var pe=new Uint8Array(32);return vt(pe,Y,W),He(k,N,T,z,pe)}function rt(){var k=0,N=0,T=0,z=0,Y=65535,W,pe,ye;for(ye=0;ye<arguments.length;ye++)W=arguments[ye].lo,pe=arguments[ye].hi,k+=W&Y,N+=W>>>16,T+=pe&Y,z+=pe>>>16;return N+=k>>>16,T+=N>>>16,z+=T>>>16,new t(T&Y|z<<16,k&Y|N<<16)}function qt(k,N){return new t(k.hi>>>N,k.lo>>>N|k.hi<<32-N)}function jt(){var k=0,N=0,T;for(T=0;T<arguments.length;T++)k^=arguments[T].lo,N^=arguments[T].hi;return new t(N,k)}function ht(k,N){var T,z,Y=32-N;return N<32?(T=k.hi>>>N|k.lo<<Y,z=k.lo>>>N|k.hi<<Y):N<64&&(T=k.lo>>>N|k.hi<<Y,z=k.hi>>>N|k.lo<<Y),new t(T,z)}function Fi(k,N,T){var z=k.hi&N.hi^~k.hi&T.hi,Y=k.lo&N.lo^~k.lo&T.lo;return new t(z,Y)}function fe(k,N,T){var z=k.hi&N.hi^k.hi&T.hi^N.hi&T.hi,Y=k.lo&N.lo^k.lo&T.lo^N.lo&T.lo;return new t(z,Y)}function ve(k){return jt(ht(k,28),ht(k,34),ht(k,39))}function Ue(k){return jt(ht(k,14),ht(k,18),ht(k,41))}function Je(k){return jt(ht(k,1),ht(k,8),qt(k,7))}function lt(k){return jt(ht(k,19),ht(k,61),qt(k,6))}var nn=[new t(1116352408,3609767458),new t(1899447441,602891725),new t(3049323471,3964484399),new t(3921009573,2173295548),new t(961987163,4081628472),new t(1508970993,3053834265),new t(2453635748,2937671579),new t(2870763221,3664609560),new t(3624381080,2734883394),new t(310598401,1164996542),new t(607225278,1323610764),new t(1426881987,3590304994),new t(1925078388,4068182383),new t(2162078206,991336113),new t(2614888103,633803317),new t(3248222580,3479774868),new t(3835390401,2666613458),new t(4022224774,944711139),new t(264347078,2341262773),new t(604807628,2007800933),new t(770255983,1495990901),new t(1249150122,1856431235),new t(1555081692,3175218132),new t(1996064986,2198950837),new t(2554220882,3999719339),new t(2821834349,766784016),new t(2952996808,2566594879),new t(3210313671,3203337956),new t(3336571891,1034457026),new t(3584528711,2466948901),new t(113926993,3758326383),new t(338241895,168717936),new t(666307205,1188179964),new t(773529912,1546045734),new t(1294757372,1522805485),new t(1396182291,2643833823),new t(1695183700,2343527390),new t(1986661051,1014477480),new t(2177026350,1206759142),new t(2456956037,344077627),new t(2730485921,1290863460),new t(2820302411,3158454273),new t(3259730800,3505952657),new t(3345764771,106217008),new t(3516065817,3606008344),new t(3600352804,1432725776),new t(4094571909,1467031594),new t(275423344,851169720),new t(430227734,3100823752),new t(506948616,1363258195),new t(659060556,3750685593),new t(883997877,3785050280),new t(958139571,3318307427),new t(1322822218,3812723403),new t(1537002063,2003034995),new t(1747873779,3602036899),new t(1955562222,1575990012),new t(2024104815,1125592928),new t(2227730452,2716904306),new t(2361852424,442776044),new t(2428436474,593698344),new t(2756734187,3733110249),new t(3204031479,2999351573),new t(3329325298,3815920427),new t(3391569614,3928383900),new t(3515267271,566280711),new t(3940187606,3454069534),new t(4118630271,4000239992),new t(116418474,1914138554),new t(174292421,2731055270),new t(289380356,3203993006),new t(460393269,320620315),new t(685471733,587496836),new t(852142971,1086792851),new t(1017036298,365543100),new t(1126000580,2618297676),new t(1288033470,3409855158),new t(1501505948,4234509866),new t(1607167915,987167468),new t(1816402316,1246189591)];function _n(k,N,T){var z=[],Y=[],W=[],pe=[],ye,se,me;for(se=0;se<8;se++)z[se]=W[se]=B(k,8*se);for(var Re=0;T>=128;){for(se=0;se<16;se++)pe[se]=B(N,8*se+Re);for(se=0;se<80;se++){for(me=0;me<8;me++)Y[me]=W[me];for(ye=rt(W[7],Ue(W[4]),Fi(W[4],W[5],W[6]),nn[se],pe[se%16]),Y[7]=rt(ye,ve(W[0]),fe(W[0],W[1],W[2])),Y[3]=rt(Y[3],ye),me=0;me<8;me++)W[(me+1)%8]=Y[me];if(se%16===15)for(me=0;me<16;me++)pe[me]=rt(pe[me],pe[(me+9)%16],Je(pe[(me+1)%16]),lt(pe[(me+14)%16]))}for(se=0;se<8;se++)W[se]=rt(W[se],z[se]),z[se]=W[se];Re+=128,T-=128}for(se=0;se<8;se++)P(k,8*se,z[se]);return T}var Wt=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 yt(k,N,T){var z=new Uint8Array(64),Y=new Uint8Array(256),W,pe=T;for(W=0;W<64;W++)z[W]=Wt[W];for(_n(z,N,T),T%=128,W=0;W<256;W++)Y[W]=0;for(W=0;W<T;W++)Y[W]=N[pe-T+W];for(Y[T]=128,T=256-128*(T<112?1:0),Y[T-9]=0,P(Y,T-8,new t(pe/536870912|0,pe<<3)),_n(z,Y,T),W=0;W<64;W++)k[W]=z[W];return 0}function Ht(k,N){var T=r(),z=r(),Y=r(),W=r(),pe=r(),ye=r(),se=r(),me=r(),Re=r();$e(T,k[1],k[0]),$e(Re,N[1],N[0]),Ce(T,T,Re),Le(z,k[0],k[1]),Le(Re,N[0],N[1]),Ce(z,z,Re),Ce(Y,k[3],N[3]),Ce(Y,Y,y),Ce(W,k[2],N[2]),Le(W,W,W),$e(pe,z,T),$e(ye,W,Y),Le(se,W,Y),Le(me,z,T),Ce(k[0],pe,ye),Ce(k[1],me,se),Ce(k[2],se,ye),Ce(k[3],pe,me)}function de(k,N,T){var z;for(z=0;z<4;z++)Q(k[z],N[z],T)}function Ie(k,N){var T=r(),z=r(),Y=r();je(Y,N[2]),Ce(T,N[0],Y),Ce(z,N[1],Y),A(k,z),k[31]^=_e(T)<<7}function Ae(k,N,T){var z,Y;for(_(k[0],c),_(k[1],f),_(k[2],f),_(k[3],c),Y=255;Y>=0;--Y)z=T[Y/8|0]>>(Y&7)&1,de(k,N,z),Ht(N,k),Ht(k,k),de(k,N,z)}function Ot(k,N){var T=[r(),r(),r(),r()];_(T[0],g),_(T[1],x),_(T[2],f),Ce(T[3],g,x),Ae(k,T,N)}function Pt(k,N,T){var z=new Uint8Array(64),Y=[r(),r(),r(),r()],W;for(T||s(N,32),yt(z,N,32),z[0]&=248,z[31]&=127,z[31]|=64,Ot(Y,z),Ie(k,Y),W=0;W<32;W++)N[W+32]=k[W];return 0}var fn=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function ii(k,N){var T,z,Y,W;for(z=63;z>=32;--z){for(T=0,Y=z-32,W=z-12;Y<W;++Y)N[Y]+=T-16*N[z]*fn[Y-(z-32)],T=Math.floor((N[Y]+128)/256),N[Y]-=T*256;N[Y]+=T,N[z]=0}for(T=0,Y=0;Y<32;Y++)N[Y]+=T-(N[31]>>4)*fn[Y],T=N[Y]>>8,N[Y]&=255;for(Y=0;Y<32;Y++)N[Y]-=T*fn[Y];for(z=0;z<32;z++)N[z+1]+=N[z]>>8,k[z]=N[z]&255}function ur(k){var N=new Float64Array(64),T;for(T=0;T<64;T++)N[T]=k[T];for(T=0;T<64;T++)k[T]=0;ii(k,N)}function $i(k,N,T,z){var Y=new Uint8Array(64),W=new Uint8Array(64),pe=new Uint8Array(64),ye,se,me=new Float64Array(64),Re=[r(),r(),r(),r()];yt(Y,z,32),Y[0]&=248,Y[31]&=127,Y[31]|=64;var Ze=T+64;for(ye=0;ye<T;ye++)k[64+ye]=N[ye];for(ye=0;ye<32;ye++)k[32+ye]=Y[32+ye];for(yt(pe,k.subarray(32),T+32),ur(pe),Ot(Re,pe),Ie(k,Re),ye=32;ye<64;ye++)k[ye]=z[ye];for(yt(W,k,T+64),ur(W),ye=0;ye<64;ye++)me[ye]=0;for(ye=0;ye<32;ye++)me[ye]=pe[ye];for(ye=0;ye<32;ye++)for(se=0;se<32;se++)me[ye+se]+=W[ye]*Y[se];return ii(k.subarray(32),me),Ze}function Yi(k,N){var T=r(),z=r(),Y=r(),W=r(),pe=r(),ye=r(),se=r();return _(k[2],f),Te(k[1],N),Ne(Y,k[1]),Ce(W,Y,d),$e(Y,Y,k[2]),Le(W,k[2],W),Ne(pe,W),Ne(ye,pe),Ce(se,ye,pe),Ce(T,se,Y),Ce(T,T,W),Fe(T,T),Ce(T,T,Y),Ce(T,T,W),Ce(T,T,W),Ce(k[0],T,W),Ne(z,k[0]),Ce(z,z,W),xe(z,Y)&&Ce(k[0],k[0],w),Ne(z,k[0]),Ce(z,z,W),xe(z,Y)?-1:(_e(k[0])===N[31]>>7&&$e(k[0],c,k[0]),Ce(k[3],k[0],k[1]),0)}function Ea(k,N,T,z){var Y,W=new Uint8Array(32),pe=new Uint8Array(64),ye=[r(),r(),r(),r()],se=[r(),r(),r(),r()];if(T<64||Yi(se,z))return-1;for(Y=0;Y<T;Y++)k[Y]=N[Y];for(Y=0;Y<32;Y++)k[Y+32]=z[Y];if(yt(pe,k,T),ur(pe),Ae(ye,se,pe),Ot(se,N.subarray(32)),Ht(ye,se),Ie(W,ye),T-=64,U(N,0,W,0)){for(Y=0;Y<T;Y++)k[Y]=0;return-1}for(Y=0;Y<T;Y++)k[Y]=N[Y+64];return T}var bs=32,si=24,cr=32,ai=16,li=32,Gi=32,oi=32,Mr=32,Vi=32,Ca=si,Xl=cr,Sr=ai,Ct=64,It=32,Rn=64,Ji=32,Aa=64;e.lowlevel={crypto_core_hsalsa20:V,crypto_stream_xor:le,crypto_stream:J,crypto_stream_salsa20_xor:O,crypto_stream_salsa20:X,crypto_onetimeauth:H,crypto_onetimeauth_verify:ee,crypto_verify_16:ue,crypto_verify_32:U,crypto_secretbox:oe,crypto_secretbox_open:be,crypto_scalarmult:Qe,crypto_scalarmult_base:qe,crypto_box_beforenm:vt,crypto_box_afternm:Ve,crypto_box:nt,crypto_box_open:ft,crypto_box_keypair:ct,crypto_hash:yt,crypto_sign:$i,crypto_sign_keypair:Pt,crypto_sign_open:Ea,crypto_secretbox_KEYBYTES:bs,crypto_secretbox_NONCEBYTES:si,crypto_secretbox_ZEROBYTES:cr,crypto_secretbox_BOXZEROBYTES:ai,crypto_scalarmult_BYTES:li,crypto_scalarmult_SCALARBYTES:Gi,crypto_box_PUBLICKEYBYTES:oi,crypto_box_SECRETKEYBYTES:Mr,crypto_box_BEFORENMBYTES:Vi,crypto_box_NONCEBYTES:Ca,crypto_box_ZEROBYTES:Xl,crypto_box_BOXZEROBYTES:Sr,crypto_sign_BYTES:Ct,crypto_sign_PUBLICKEYBYTES:It,crypto_sign_SECRETKEYBYTES:Rn,crypto_sign_SEEDBYTES:Ji,crypto_hash_BYTES:Aa,gf:r,D:d,L:fn,pack25519:A,unpack25519:Te,M:Ce,A:Le,S:Ne,Z:$e,pow2523:Fe,add:Ht,set25519:_,modL:ii,scalarmult:Ae,scalarbase:Ot};function Kl(k,N){if(k.length!==bs)throw new Error("bad key size");if(N.length!==si)throw new Error("bad nonce size")}function Ql(k,N){if(k.length!==oi)throw new Error("bad public key size");if(N.length!==Mr)throw new Error("bad secret key size")}function en(){for(var k=0;k<arguments.length;k++)if(!(arguments[k]instanceof Uint8Array))throw new TypeError("unexpected type, use Uint8Array")}function xs(k){for(var N=0;N<k.length;N++)k[N]=0}e.randomBytes=function(k){var N=new Uint8Array(k);return s(N,k),N},e.secretbox=function(k,N,T){en(k,N,T),Kl(T,N);for(var z=new Uint8Array(cr+k.length),Y=new Uint8Array(z.length),W=0;W<k.length;W++)z[W+cr]=k[W];return oe(Y,z,z.length,N,T),Y.subarray(ai)},e.secretbox.open=function(k,N,T){en(k,N,T),Kl(T,N);for(var z=new Uint8Array(ai+k.length),Y=new Uint8Array(z.length),W=0;W<k.length;W++)z[W+ai]=k[W];return z.length<32||be(Y,z,z.length,N,T)!==0?null:Y.subarray(cr)},e.secretbox.keyLength=bs,e.secretbox.nonceLength=si,e.secretbox.overheadLength=ai,e.scalarMult=function(k,N){if(en(k,N),k.length!==Gi)throw new Error("bad n size");if(N.length!==li)throw new Error("bad p size");var T=new Uint8Array(li);return Qe(T,k,N),T},e.scalarMult.base=function(k){if(en(k),k.length!==Gi)throw new Error("bad n size");var N=new Uint8Array(li);return qe(N,k),N},e.scalarMult.scalarLength=Gi,e.scalarMult.groupElementLength=li,e.box=function(k,N,T,z){var Y=e.box.before(T,z);return e.secretbox(k,N,Y)},e.box.before=function(k,N){en(k,N),Ql(k,N);var T=new Uint8Array(Vi);return vt(T,k,N),T},e.box.after=e.secretbox,e.box.open=function(k,N,T,z){var Y=e.box.before(T,z);return e.secretbox.open(k,N,Y)},e.box.open.after=e.secretbox.open,e.box.keyPair=function(){var k=new Uint8Array(oi),N=new Uint8Array(Mr);return ct(k,N),{publicKey:k,secretKey:N}},e.box.keyPair.fromSecretKey=function(k){if(en(k),k.length!==Mr)throw new Error("bad secret key size");var N=new Uint8Array(oi);return qe(N,k),{publicKey:N,secretKey:new Uint8Array(k)}},e.box.publicKeyLength=oi,e.box.secretKeyLength=Mr,e.box.sharedKeyLength=Vi,e.box.nonceLength=Ca,e.box.overheadLength=e.secretbox.overheadLength,e.sign=function(k,N){if(en(k,N),N.length!==Rn)throw new Error("bad secret key size");var T=new Uint8Array(Ct+k.length);return $i(T,k,k.length,N),T},e.sign.open=function(k,N){if(en(k,N),N.length!==It)throw new Error("bad public key size");var T=new Uint8Array(k.length),z=Ea(T,k,k.length,N);if(z<0)return null;for(var Y=new Uint8Array(z),W=0;W<Y.length;W++)Y[W]=T[W];return Y},e.sign.detached=function(k,N){for(var T=e.sign(k,N),z=new Uint8Array(Ct),Y=0;Y<z.length;Y++)z[Y]=T[Y];return z},e.sign.detached.verify=function(k,N,T){if(en(k,N,T),N.length!==Ct)throw new Error("bad signature size");if(T.length!==It)throw new Error("bad public key size");var z=new Uint8Array(Ct+k.length),Y=new Uint8Array(Ct+k.length),W;for(W=0;W<Ct;W++)z[W]=N[W];for(W=0;W<k.length;W++)z[W+Ct]=k[W];return Ea(Y,z,z.length,T)>=0},e.sign.keyPair=function(){var k=new Uint8Array(It),N=new Uint8Array(Rn);return Pt(k,N),{publicKey:k,secretKey:N}},e.sign.keyPair.fromSecretKey=function(k){if(en(k),k.length!==Rn)throw new Error("bad secret key size");for(var N=new Uint8Array(It),T=0;T<N.length;T++)N[T]=k[32+T];return{publicKey:N,secretKey:new Uint8Array(k)}},e.sign.keyPair.fromSeed=function(k){if(en(k),k.length!==Ji)throw new Error("bad seed size");for(var N=new Uint8Array(It),T=new Uint8Array(Rn),z=0;z<32;z++)T[z]=k[z];return Pt(N,T,!0),{publicKey:N,secretKey:T}},e.sign.publicKeyLength=It,e.sign.secretKeyLength=Rn,e.sign.seedLength=Ji,e.sign.signatureLength=Ct,e.hash=function(k){en(k);var N=new Uint8Array(Aa);return yt(N,k,k.length),N},e.hash.hashLength=Aa,e.verify=function(k,N){return en(k,N),k.length===0||N.length===0||k.length!==N.length?!1:F(k,0,N,0,k.length)===0},e.setPRNG=function(k){s=k},(function(){var k=typeof globalThis<"u"?globalThis.crypto||globalThis.msCrypto:null;if(k&&k.getRandomValues){var N=65536;e.setPRNG(function(T,z){var Y,W=new Uint8Array(z);for(Y=0;Y<z;Y+=N)k.getRandomValues(W.subarray(Y,Y+Math.min(z-Y,N)));for(Y=0;Y<z;Y++)T[Y]=W[Y];xs(W)})}else typeof require<"u"&&(k=require("crypto"),k&&k.randomBytes&&e.setPRNG(function(T,z){var Y,W=k.randomBytes(z);for(Y=0;Y<z;Y++)T[Y]=W[Y];xs(W)}))})()})(typeof module<"u"&&module.exports?module.exports:globalThis.nacl=globalThis.nacl||{});const hu=typeof module<"u"&&module.exports?module.exports:globalThis.nacl,Hk={fromSeed:hu.sign.keyPair.fromSeed,sign:hu.sign.detached,verify:hu.sign.detached.verify,randomBytes:hu.randomBytes};let xx;function Ik(e){xx=e}function Mi(){return xx}const Fk=new Uint16Array([0,4129,8258,12387,16516,20645,24774,28903,33032,37161,41290,45419,49548,53677,57806,61935,4657,528,12915,8786,21173,17044,29431,25302,37689,33560,45947,41818,54205,50076,62463,58334,9314,13379,1056,5121,25830,29895,17572,21637,42346,46411,34088,38153,58862,62927,50604,54669,13907,9842,5649,1584,30423,26358,22165,18100,46939,42874,38681,34616,63455,59390,55197,51132,18628,22757,26758,30887,2112,6241,10242,14371,51660,55789,59790,63919,35144,39273,43274,47403,23285,19156,31415,27286,6769,2640,14899,10770,56317,52188,64447,60318,39801,35672,47931,43802,27814,31879,19684,23749,11298,15363,3168,7233,60846,64911,52716,56781,44330,48395,36200,40265,32407,28342,24277,20212,15891,11826,7761,3696,65439,61374,57309,53244,48923,44858,40793,36728,37256,33193,45514,41451,53516,49453,61774,57711,4224,161,12482,8419,20484,16421,28742,24679,33721,37784,41979,46042,49981,54044,58239,62302,689,4752,8947,13010,16949,21012,25207,29270,46570,42443,38312,34185,62830,58703,54572,50445,13538,9411,5280,1153,29798,25671,21540,17413,42971,47098,34713,38840,59231,63358,50973,55100,9939,14066,1681,5808,26199,30326,17941,22068,55628,51565,63758,59695,39368,35305,47498,43435,22596,18533,30726,26663,6336,2273,14466,10403,52093,56156,60223,64286,35833,39896,43963,48026,19061,23124,27191,31254,2801,6864,10931,14994,64814,60687,56684,52557,48554,44427,40424,36297,31782,27655,23652,19525,15522,11395,7392,3265,61215,65342,53085,57212,44955,49082,36825,40952,28183,32310,20053,24180,11923,16050,3793,7920]);class Du{static checksum(t){let r=0;for(let s=0;s<t.byteLength;s++){let l=t[s];r=r<<8&65535^Fk[(r>>8^l)&255]}return r}static validate(t,r){return Du.checksum(t)==r}}const Eh="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";class C0{static encode(t){let r=0,s=0,l=new Uint8Array(t),u=new Uint8Array(t.byteLength*2),c=0;for(let f=0;f<l.byteLength;f++)for(s=s<<8|l[f],r+=8;r>=5;){let m=s>>>r-5&31;u[c++]=Eh.charAt(m).charCodeAt(0),r-=5}if(r>0){let f=s<<5-r&31;u[c++]=Eh.charAt(f).charCodeAt(0)}return u.slice(0,c)}static decode(t){let r=0,s=0,l=0,u=new Uint8Array(t),c=new Uint8Array(u.byteLength*5/8|0);for(let f=0;f<u.byteLength;f++){let m=String.fromCharCode(u[f]),d=Eh.indexOf(m);if(d===-1)throw new Error("Illegal Base32 character: "+u[f]);s=s<<5|d,r+=5,r>=8&&(c[l++]=s>>>r-8&255,r-=8)}return c.slice(0,l)}}class Et extends Error{constructor(r,s){super(r);C(this,"name");C(this,"code");C(this,"chainedError");this.name="NKeysError",this.code=r,this.chainedError=s}}function $k(){return Ku(kt.Operator)}function Yk(){return Ku(kt.Account)}function Gk(){return Ku(kt.User)}var gt;(function(e){e.InvalidPrefixByte="nkeys: invalid prefix byte",e.InvalidKey="nkeys: invalid key",e.InvalidPublicKey="nkeys: invalid public key",e.InvalidSeedLen="nkeys: invalid seed length",e.InvalidSeed="nkeys: invalid seed",e.InvalidEncoding="nkeys: invalid encoded key",e.InvalidSignature="nkeys: signature verification failed",e.CannotSign="nkeys: cannot sign, no private key available",e.PublicKeyOnly="nkeys: no seed or private key available",e.InvalidChecksum="nkeys: invalid checksum",e.SerializationError="nkeys: serialization error",e.ApiError="nkeys: api error",e.ClearedPair="nkeys: pair is cleared"})(gt||(gt={}));var kt;(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"})(kt||(kt={}));class sa{static isValidPublicPrefix(t){return t==kt.Server||t==kt.Operator||t==kt.Cluster||t==kt.Account||t==kt.User}static startsWithValidPrefix(t){let r=t[0];return r=="S"||r=="P"||r=="O"||r=="N"||r=="C"||r=="A"||r=="U"}static isValidPrefix(t){return this.parsePrefix(t)!=-1}static parsePrefix(t){switch(t){case kt.Seed:return kt.Seed;case kt.Private:return kt.Private;case kt.Operator:return kt.Operator;case kt.Server:return kt.Server;case kt.Cluster:return kt.Cluster;case kt.Account:return kt.Account;case kt.User:return kt.User;default:return-1}}}class vn{static encode(t,r){if(!r||!(r instanceof Uint8Array))throw new Et(gt.SerializationError);if(!sa.isValidPrefix(t))throw new Et(gt.InvalidPrefixByte);return vn._encode(!1,t,r)}static encodeSeed(t,r){if(!r)throw new Et(gt.ApiError);if(!sa.isValidPublicPrefix(t))throw new Et(gt.InvalidPrefixByte);if(r.byteLength!==32)throw new Et(gt.InvalidSeedLen);return vn._encode(!0,t,r)}static decode(t,r){if(!sa.isValidPrefix(t))throw new Et(gt.InvalidPrefixByte);const s=vn._decode(r);if(s[0]!==t)throw new Et(gt.InvalidPrefixByte);return s.slice(1)}static decodeSeed(t){const r=vn._decode(t),s=vn._decodePrefix(r);if(s[0]!=kt.Seed)throw new Et(gt.InvalidSeed);if(!sa.isValidPublicPrefix(s[1]))throw new Et(gt.InvalidPrefixByte);return{buf:r.slice(2),prefix:s[1]}}static _encode(t,r,s){const l=t?2:1,u=s.byteLength,c=l+u+2,f=l+u,m=new Uint8Array(c);if(t){const g=vn._encodePrefix(kt.Seed,r);m.set(g)}else m[0]=r;m.set(s,l);const d=Du.checksum(m.slice(0,f));return new DataView(m.buffer).setUint16(f,d,!0),C0.encode(m)}static _decode(t){if(t.byteLength<4)throw new Et(gt.InvalidEncoding);let r;try{r=C0.decode(t)}catch(f){throw new Et(gt.InvalidEncoding,f)}const s=r.byteLength-2,u=new DataView(r.buffer).getUint16(s,!0),c=r.slice(0,s);if(!Du.validate(c,u))throw new Et(gt.InvalidChecksum);return c}static _encodePrefix(t,r){const s=t|r>>5,l=(r&31)<<3;return new Uint8Array([s,l])}static _decodePrefix(t){const r=t[0]&248,s=(t[0]&7)<<5|(t[1]&248)>>3;return new Uint8Array([r,s])}}class vx{constructor(t){C(this,"seed");this.seed=t}getRawSeed(){if(!this.seed)throw new Et(gt.ClearedPair);return vn.decodeSeed(this.seed).buf}getSeed(){if(!this.seed)throw new Et(gt.ClearedPair);return this.seed}getPublicKey(){if(!this.seed)throw new Et(gt.ClearedPair);const t=vn.decodeSeed(this.seed),r=Mi().fromSeed(this.getRawSeed()),s=vn.encode(t.prefix,r.publicKey);return new TextDecoder().decode(s)}getPrivateKey(){if(!this.seed)throw new Et(gt.ClearedPair);const t=Mi().fromSeed(this.getRawSeed());return vn.encode(kt.Private,t.secretKey)}sign(t){if(!this.seed)throw new Et(gt.ClearedPair);const r=Mi().fromSeed(this.getRawSeed());return Mi().sign(t,r.secretKey)}verify(t,r){if(!this.seed)throw new Et(gt.ClearedPair);const s=Mi().fromSeed(this.getRawSeed());return Mi().verify(t,r,s.publicKey)}clear(){this.seed&&(this.seed.fill(0),this.seed=void 0)}}function Ku(e){const t=Mi().randomBytes(32);let r=vn.encodeSeed(e,new Uint8Array(t));return new vx(r)}class Vk{constructor(t){C(this,"publicKey");this.publicKey=t}getPublicKey(){if(!this.publicKey)throw new Et(gt.ClearedPair);return new TextDecoder().decode(this.publicKey)}getPrivateKey(){throw this.publicKey?new Et(gt.PublicKeyOnly):new Et(gt.ClearedPair)}getSeed(){throw this.publicKey?new Et(gt.PublicKeyOnly):new Et(gt.ClearedPair)}sign(t){throw this.publicKey?new Et(gt.CannotSign):new Et(gt.ClearedPair)}verify(t,r){if(!this.publicKey)throw new Et(gt.ClearedPair);let s=vn._decode(this.publicKey);return Mi().verify(t,r,s.slice(1))}clear(){this.publicKey&&(this.publicKey.fill(0),this.publicKey=void 0)}}function Jk(e){const t=new TextEncoder().encode(e),r=vn._decode(t),s=sa.parsePrefix(r[0]);if(sa.isValidPublicPrefix(s))return new Vk(t);throw new Et(gt.InvalidPublicKey)}function Xk(e){return vn.decodeSeed(e),new vx(e)}function Kk(e){return btoa(String.fromCharCode(...e))}function Qk(e){const t=atob(e),r=new Uint8Array(t.length);for(let s=0;s<t.length;s++)r[s]=t.charCodeAt(s);return r}Ik(Hk);const A0={createAccount:Yk,createOperator:$k,createPair:Ku,createUser:Gk,fromPublic:Jk,fromSeed:Xk,NKeysError:Et,NKeysErrorCode:gt,Prefix:kt,decode:Qk,encode:Kk};function Zk(e){return t=>{let r={};return e.forEach(s=>{const l=s(t)||{};r=Object.assign(r,l)}),r}}function Wk(){return()=>{}}function e2(e,t){return()=>{const r=typeof e=="function"?e():e,s=typeof t=="function"?t():t;return{user:r,pass:s}}}function t2(e){return()=>({auth_token:typeof e=="function"?e():e})}function n2(e){return t=>{const r=typeof e=="function"?e():e,s=r?A0.fromSeed(r):void 0,l=s?s.getPublicKey():"",u=qi.encode(t||""),c=s!==void 0&&t?s.sign(u):void 0,f=c?A0.encode(c):"";return{nkey:l,sig:f}}}function wx(e,t){return r=>{const s=typeof e=="function"?e():e,l=n2(t),{nkey:u,sig:c}=l(r);return{jwt:s,nkey:u,sig:c}}}const Sx=120*1e3,r2=2,_x=2*1e3;function i2(){return{maxPingOut:2,maxReconnectAttempts:10,noRandomize:!1,pedantic:!1,pingInterval:Sx,reconnect:!0,reconnectJitter:100,reconnectJitterTLS:1e3,reconnectTimeWait:_x,tls:void 0,verbose:!1,waitOnFirstConnect:!1,ignoreAuthErrorAbort:!1}}function s2(e){const t=[];return typeof e.authenticator=="function"&&t.push(e.authenticator),Array.isArray(e.authenticator)&&t.push(...e.authenticator),e.token&&t.push(t2(e.token)),e.user&&t.push(e2(e.user,e.pass)),t.length===0?Wk():Zk(t)}function a2(e){const t=`${Zh}:${gx()}`;if(e=e||{servers:[t]},e.servers=e.servers||[],typeof e.servers=="string"&&(e.servers=[e.servers]),e.servers.length>0&&e.port)throw new Oe("port and servers options are mutually exclusive",Se.InvalidOption);e.servers.length===0&&e.port&&(e.servers=[`${Zh}:${e.port}`]),e.servers&&e.servers.length===0&&(e.servers=[t]);const r=Vu(i2(),e);if(r.authenticator=s2(r),["reconnectDelayHandler","authenticator"].forEach(s=>{if(r[s]&&typeof r[s]!="function")throw new Oe(`${s} option should be a function`,Se.NotFunction)}),r.reconnectDelayHandler||(r.reconnectDelayHandler=()=>{let s=r.tls?r.reconnectJitterTLS:r.reconnectJitter;return s&&(s++,s=Math.floor(Math.random()*s)),r.reconnectTimeWait+s}),r.inboxPrefix)try{ei(r.inboxPrefix)}catch(s){throw new Oe(s.message,Se.ApiError)}if(r.resolve===void 0&&(r.resolve=typeof sd()=="function"),r.resolve&&typeof sd()!="function")throw new Oe("'resolve' is not supported on this client",Se.InvalidOption);return r}function l2(e,t){const{proto:r,tls_required:s,tls_available:l}=e;if((r===void 0||r<1)&&t.noEcho)throw new Oe("noEcho",Se.ServerOptionNotAvailable);const u=s||l||!1;if(t.tls&&!u)throw new Oe("tls",Se.ServerOptionNotAvailable)}const o2=1024*32,u2=/^INFO\s+([^\r\n]+)\r\n/i,c2=Al(`PONG\r
|
|
72
|
-
`),T0=Al(`PING\r
|
|
73
|
-
`);class f2{constructor(t,r,s){C(this,"echo");C(this,"no_responders");C(this,"protocol");C(this,"verbose");C(this,"pedantic");C(this,"jwt");C(this,"nkey");C(this,"sig");C(this,"user");C(this,"pass");C(this,"auth_token");C(this,"tls_required");C(this,"name");C(this,"lang");C(this,"version");C(this,"headers");this.protocol=1,this.version=t.version,this.lang=t.lang,this.echo=r.noEcho?!1:void 0,this.verbose=r.verbose,this.pedantic=r.pedantic,this.tls_required=r.tls?!0:void 0,this.name=r.name;const l=(r&&typeof r.authenticator=="function"?r.authenticator(s):{})||{};Vu(this,l)}}class kx extends an{constructor(r,s,l={}){var c;super();C(this,"sid");C(this,"queue");C(this,"draining");C(this,"max");C(this,"subject");C(this,"drained");C(this,"protocol");C(this,"timer");C(this,"info");C(this,"cleanupFn");C(this,"closed");C(this,"requestSubject");Vu(this,l),this.protocol=r,this.subject=s,this.draining=!1,this.noIterator=typeof l.callback=="function",this.closed=Ut();const u=!((c=r.options)!=null&&c.noAsyncTraces);l.timeout&&(this.timer=ma(l.timeout,u),this.timer.then(()=>{this.timer=void 0}).catch(f=>{this.stop(f),this.noIterator&&this.callback(f,{})})),this.noIterator||this.iterClosed.then(()=>{this.closed.resolve(),this.unsubscribe()})}setPrePostHandlers(r){if(this.noIterator){const s=this.callback,l=r.ingestionFilterFn?r.ingestionFilterFn:()=>({ingest:!0,protocol:!1}),u=r.protocolFilterFn?r.protocolFilterFn:()=>!0,c=r.dispatchedFn?r.dispatchedFn:()=>{};this.callback=(f,m)=>{const{ingest:d}=l(m);d&&u(m)&&(s(f,m),c(m))}}else this.protocolFilterFn=r.protocolFilterFn,this.dispatchedFn=r.dispatchedFn}callback(r,s){this.cancelTimeout(),r?this.stop(r):this.push(s)}close(){if(!this.isClosed()){this.cancelTimeout();const r=()=>{if(this.stop(),this.cleanupFn)try{this.cleanupFn(this,this.info)}catch{}this.closed.resolve()};this.noIterator?r():this.push(r)}}unsubscribe(r){this.protocol.unsubscribe(this,r)}cancelTimeout(){this.timer&&(this.timer.cancel(),this.timer=void 0)}drain(){return this.protocol.isClosed()?Promise.reject(Oe.errorForCode(Se.ConnectionClosed)):this.isClosed()?Promise.reject(Oe.errorForCode(Se.SubClosed)):(this.drained||(this.draining=!0,this.protocol.unsub(this),this.drained=this.protocol.flush(Ut()).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 h2{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(t){return this.sidCounter++,t.sid=this.sidCounter,this.subs.set(t.sid,t),t}setMux(t){return this.mux=t,t}getMux(){return this.mux}get(t){return this.subs.get(t)}resub(t){return this.sidCounter++,this.subs.delete(t.sid),t.sid=this.sidCounter,this.subs.set(t.sid,t),t}all(){return Array.from(this.subs.values())}cancel(t){t&&(t.close(),this.subs.delete(t.sid))}handleError(t){if(t&&t.permissionContext){const r=t.permissionContext,s=this.all();let l;if(r.operation==="subscription"&&(l=s.find(u=>u.subject===r.subject&&u.queue===r.queue)),r.operation==="publish"&&(l=s.find(u=>u.requestSubject===r.subject)),l)return l.callback(t,{}),l.close(),this.subs.delete(l.sid),l!==this.mux}return!1}close(){this.subs.forEach(t=>{t.close()})}}class Lu{constructor(t,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=o2,this.outMsgs=0,this.inMsgs=0,this.outBytes=0,this.inBytes=0,this.options=t,this.publisher=r,this.subscriptions=new h2,this.muxSubscriptions=new zk,this.outbound=new ga,this.pongs=[],this.whyClosed="",this.pendingLimit=t.pendingLimit||this.pendingLimit,this.features=new gk({major:0,minor:0,micro:0}),this.connectPromise=null;const s=typeof t.servers=="string"?[t.servers]:t.servers;this.servers=new Lk(s,{randomize:!t.noRandomize}),this.closed=Ut(),this.parser=new E0(this),this.heartbeats=new Uk(this,this.options.pingInterval||Sx,this.options.maxPingOut||r2)}resetOutbound(){this.outbound.reset();const t=this.pongs;this.pongs=[];const r=Oe.errorForCode(Se.Disconnect);r.stack="",t.forEach(s=>{s.reject(r)}),this.parser=new E0(this),this.infoReceived=!1}dispatchStatus(t){this.listeners.forEach(r=>{r.push(t)})}status(){const t=new an;return this.listeners.push(t),t}prepare(){this.transport&&this.transport.discard(),this.info=void 0,this.resetOutbound();const t=Ut();return t.catch(()=>{}),this.pongs.unshift(t),this.connectError=r=>{t.reject(r)},this.transport=xk(),this.transport.closed().then(async r=>{if(this.connected=!1,!this.isClosed()){await this.disconnected(this.transport.closeError||this.lastError);return}}),t}disconnect(){this.dispatchStatus({type:la.StaleConnection,data:""}),this.transport.disconnect()}reconnect(){return this.connected&&(this.dispatchStatus({type:la.ClientInitiatedReconnect,data:""}),this.transport.disconnect()),Promise.resolve()}async disconnected(t){this.dispatchStatus({type:Zr.Disconnect,data:this.servers.getCurrentServer().toString()}),this.options.reconnect?await this.dialLoop().then(()=>{var r;this.dispatchStatus({type:Zr.Reconnect,data:this.servers.getCurrentServer().toString()}),((r=this.lastError)==null?void 0:r.code)===Se.AuthenticationExpired&&(this.lastError=void 0)}).catch(r=>{this._close(r)}):await this._close(t)}async dial(t){const r=this.prepare();let s;try{s=ma(this.options.timeout||2e4);const l=this.transport.connect(t,this.options);await Promise.race([l,s]),(async()=>{try{for await(const u of this.transport)this.parser.parse(u)}catch(u){console.log("reader closed",u)}})().then()}catch(l){r.reject(l)}try{await Promise.race([s,r]),s&&s.cancel(),this.connected=!0,this.connectError=void 0,this.sendSubscriptions(),this.connectedOnce=!0,this.server.didConnect=!0,this.server.reconnects=0,this.flushPending(),this.heartbeats.start()}catch(l){throw s&&s.cancel(),await this.transport.close(l),l}}async _doDial(t){const{resolve:r}=this.options,s=await t.resolve({fn:sd(),debug:this.options.debug,randomize:!this.options.noRandomize,resolve:r});let l=null;for(const u of s)try{l=null,this.dispatchStatus({type:la.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 t;for(;;){this._closed&&this.servers.clear();const r=this.options.reconnectDelayHandler?this.options.reconnectDelayHandler():_x;let s=r;const l=this.selectServer();if(!l||this.abortReconnect)throw t||(this.lastError?this.lastError:Oe.errorForCode(Se.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(t=c,!this.connectedOnce){if(this.options.waitOnFirstConnect)continue;this.servers.removeCurrentServer()}l.reconnects++;const f=this.options.maxReconnectAttempts||0;f!==-1&&l.reconnects>=f&&this.servers.removeCurrentServer()}}else s=Math.min(s,l.lastConnect+r-u),await Sa(s)}}static async connect(t,r){const s=new Lu(t,r);return await s.dialLoop(),s}static toError(t){const r=t?t.toLowerCase():"";if(r.indexOf("permissions violation")!==-1){const s=new Oe(t,Se.PermissionsViolation),l=t.match(/(Publish|Subscription) to "(\S+)"/);if(l){s.permissionContext={operation:l[1].toLowerCase(),subject:l[2],queue:void 0};const u=t.match(/using queue "(\S+)"/);u&&(s.permissionContext.queue=u[1])}return s}else return r.indexOf("authorization violation")!==-1?new Oe(t,Se.AuthorizationViolation):r.indexOf("user authentication expired")!==-1?new Oe(t,Se.AuthenticationExpired):r.indexOf("account authentication expired")!=-1?new Oe(t,Se.AccountExpired):r.indexOf("authentication timeout")!==-1?new Oe(t,Se.AuthenticationTimeout):new Oe(t,Se.ProtocolError)}processMsg(t,r){if(this.inMsgs++,this.inBytes+=r.length,!this.subscriptions.sidCounter)return;const s=this.subscriptions.get(t.sid);s&&(s.received+=1,s.callback&&s.callback(null,new Dd(t,r,this)),s.max!==void 0&&s.received>=s.max&&s.unsubscribe())}processError(t){const r=c0(t),s=Lu.toError(r),l={type:Zr.Error,data:s.code};if(s.isPermissionError()){let u=!1;if(s.permissionContext){l.permissionContext=s.permissionContext;const c=this.subscriptions.getMux();u=(c==null?void 0:c.subject)===s.permissionContext.subject}this.subscriptions.handleError(s),this.muxSubscriptions.handleError(u,s),u&&this.subscriptions.setMux(null)}this.dispatchStatus(l),this.handleError(s)}handleError(t){t.isAuthError()?this.handleAuthError(t):t.isProtocolError()?this.lastError=t:t.isAuthTimeout()&&(this.lastError=t),t.isPermissionError()||(this.lastError=t)}handleAuthError(t){this.lastError&&t.code===this.lastError.code&&this.options.ignoreAuthErrorAbort===!1&&(this.abortReconnect=!0),this.connectError?this.connectError(t):this.disconnect()}processPing(){this.transport.send(c2)}processPong(){const t=this.pongs.shift();t&&t.resolve()}processInfo(t){const r=JSON.parse(c0(t));this.info=r;const s=this.options&&this.options.ignoreClusterUpdates?void 0:this.servers.update(r,this.transport.isEncrypted());if(!this.infoReceived){this.features.update(ds(r.version)),this.infoReceived=!0,this.transport.isEncrypted()&&this.servers.updateTLSName();const{version:u,lang:c}=this.transport;try{const f=new f2({version:u,lang:c},this.options,r.nonce);r.headers&&(f.headers=!0,f.no_responders=!0);const m=JSON.stringify(f);this.transport.send(Al(`CONNECT ${m}${Su}`)),this.transport.send(T0)}catch(f){this._close(f)}}s&&this.dispatchStatus({type:Zr.Update,data:s}),(r.ldm!==void 0?r.ldm:!1)&&this.dispatchStatus({type:Zr.LDM,data:this.servers.getCurrentServer().toString()})}push(t){switch(t.kind){case xn.MSG:{const{msg:r,data:s}=t;this.processMsg(r,s);break}case xn.OK:break;case xn.ERR:this.processError(t.data);break;case xn.PING:this.processPing();break;case xn.PONG:this.processPong();break;case xn.INFO:this.processInfo(t.data);break}}sendCommand(t,...r){const s=this.outbound.length();let l;typeof t=="string"?l=Al(t):l=t,this.outbound.fill(l,...r),s===0?queueMicrotask(()=>{this.flushPending()}):this.outbound.size()>=this.pendingLimit&&this.flushPending()}publish(t,r=Gn,s){let l;if(r instanceof Uint8Array)l=r;else if(typeof r=="string")l=qi.encode(r);else throw Oe.errorForCode(Se.BadPayload);let u=l.length;s=s||{},s.reply=s.reply||"";let c=Gn,f=0;if(s.headers){if(this.info&&!this.info.headers)throw new Oe("headers",Se.ServerOptionNotAvailable);c=s.headers.encode(),f=c.length,u=l.length+f}if(this.info&&u>this.info.max_payload)throw Oe.errorForCode(Se.MaxPayloadExceeded);this.outBytes+=u,this.outMsgs++;let m;s.headers?(s.reply?m=`HPUB ${t} ${s.reply} ${f} ${u}\r
|
|
74
|
-
`:m=`HPUB ${t} ${f} ${u}\r
|
|
75
|
-
`,this.sendCommand(m,c,l,Mu)):(s.reply?m=`PUB ${t} ${s.reply} ${u}\r
|
|
76
|
-
`:m=`PUB ${t} ${u}\r
|
|
77
|
-
`,this.sendCommand(m,l,Mu))}request(t){return this.initMux(),this.muxSubscriptions.add(t),t}subscribe(t){return this.subscriptions.add(t),this._subunsub(t),t}_sub(t){t.queue?this.sendCommand(`SUB ${t.subject} ${t.queue} ${t.sid}\r
|
|
78
|
-
`):this.sendCommand(`SUB ${t.subject} ${t.sid}\r
|
|
79
|
-
`)}_subunsub(t){return this._sub(t),t.max&&this.unsubscribe(t,t.max),t}unsubscribe(t,r){this.unsub(t,r),(t.max===void 0||t.received>=t.max)&&this.subscriptions.cancel(t)}unsub(t,r){!t||this.isClosed()||(r?this.sendCommand(`UNSUB ${t.sid} ${r}\r
|
|
80
|
-
`):this.sendCommand(`UNSUB ${t.sid}\r
|
|
81
|
-
`),t.max=r)}resub(t,r){!t||this.isClosed()||(this.unsub(t),t.subject=r,this.subscriptions.resub(t),this._sub(t))}flush(t){return t||(t=Ut()),this.pongs.push(t),this.outbound.fill(T0),this.flushPending(),t}sendSubscriptions(){const t=[];this.subscriptions.all().forEach(r=>{const s=r;s.queue?t.push(`SUB ${s.subject} ${s.queue} ${s.sid}${Su}`):t.push(`SUB ${s.subject} ${s.sid}${Su}`)}),t.length&&this.transport.send(Al(t.join("")))}async _close(t){this._closed||(this.whyClosed=new Error("close trace").stack||"",this.heartbeats.cancel(),this.connectError&&(this.connectError(t),this.connectError=void 0),this.muxSubscriptions.close(),this.subscriptions.close(),this.listeners.forEach(r=>{r.stop()}),this._closed=!0,await this.transport.close(t),await this.closed.resolve(t))}close(){return this._close()}isClosed(){return this._closed}drain(){const t=this.subscriptions.all(),r=[];return t.forEach(s=>{r.push(s.drain())}),Promise.all(r).then(async()=>(this.noMorePublishing=!0,await this.flush(),this.close())).catch(()=>{})}flushPending(){if(!(!this.infoReceived||!this.connected)&&this.outbound.size()){const t=this.outbound.drain();this.transport.send(t)}}initMux(){if(!this.subscriptions.getMux()){const r=this.muxSubscriptions.init(this.options.inboxPrefix),s=new kx(this,`${r}*`);s.callback=this.muxSubscriptions.dispatcher(),this.subscriptions.setMux(s),this.subscribe(s)}}selectServer(){const t=this.servers.selectServer();if(t!==void 0)return this.server=t,this.server}getServer(){return this.server}}const d2="$SRV";class j0{constructor(t){C(this,"msg");this.msg=t}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(t,r){return this.msg.respond(t,r)}respondError(t,r,s,l){var u,c;return l=l||{},l.headers=l.headers||ni(),(u=l.headers)==null||u.set(Tu,`${t}`),(c=l.headers)==null||c.set(Au,r),this.msg.respond(s,l)}json(t){return this.msg.json(t)}string(){return this.msg.string()}}class Ul{constructor(t,r="",s=""){C(this,"subject");C(this,"queue");C(this,"srv");r!==""&&p2("service group",r);let l="";if(t instanceof Yl)this.srv=t,l="";else if(t instanceof Ul){const u=t;this.srv=u.srv,s===""&&u.queue!==""&&(s=u.queue),l=u.subject}else throw new Error("unknown ServiceGroup type");this.subject=this.calcSubject(l,r),this.queue=s}calcSubject(t,r=""){return r===""?t:t!==""?`${t}.${r}`:r}addEndpoint(t="",r){r=r||{subject:t};const s=typeof r=="function"?{handler:r,subject:t}:r;El("endpoint",t);let{subject:l,handler:u,metadata:c,queue:f}=s;l=l||t,f=f||this.queue,m2("endpoint subject",l),l=this.calcSubject(this.subject,l);const m={name:t,subject:l,queue:f,handler:u,metadata:c};return this.srv._addEndpoint(m)}addGroup(t="",r=""){return new Ul(this,t,r)}}function m2(e,t){if(t==="")throw new Error(`${e} cannot be empty`);if(t.indexOf(" ")!==-1)throw new Error(`${e} cannot contain spaces: '${t}'`);const r=t.split(".");r.forEach((s,l)=>{if(s===">"&&l!==r.length-1)throw new Error(`${e} cannot have internal '>': '${t}'`)})}function p2(e,t){if(t.indexOf(" ")!==-1)throw new Error(`${e} cannot contain spaces: '${t}'`);t.split(".").forEach(s=>{if(s===">")throw new Error(`${e} name cannot contain internal '>': '${t}'`)})}class Yl{constructor(t,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=t,this.config=Object.assign({},r),this.config.queue||(this.config.queue="q"),El("name",this.config.name),El("queue",this.config.queue),ds(this.config.version),this._id=Ui.next(),this.internal=[],this._done=Ut(),this._stopped=!1,this.handlers=[],this.started=new Date().toISOString(),this.reset(),this.nc.closed().then(()=>{this.close().catch()}).catch(s=>{this.close(s).catch()})}static controlSubject(t,r="",s="",l){const u=l??d2;return r===""&&s===""?`${u}.${t}`:(El("control subject name",r),s!==""?(El("control subject id",s),`${u}.${t}.${r}.${s}`):`${u}.${t}.${r}`)}get subjects(){return this.handlers.filter(t=>t.internal===!1).map(t=>t.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(t){const r=ni();if(t instanceof ju){const s=t;r.set(Au,s.message),r.set(Tu,`${s.code}`)}else r.set(Au,t.message),r.set(Tu,"500");return r}setupHandler(t,r=!1){const s=r?"":t.queue?t.queue:this.config.queue,{name:l,subject:u,handler:c}=t,f=t;f.internal=r,r&&this.internal.push(f),f.stats=new g2(l,u,s),f.queue=s;const m=c?(d,y)=>{if(d){this.close(d);return}const g=Date.now();try{c(d,new j0(y))}catch(x){f.stats.countError(x),y==null||y.respond(Gn,{headers:this.errorToHeader(x)})}finally{f.stats.countLatency(g)}}:void 0;return f.sub=this.nc.subscribe(u,{callback:m,queue:s}),f.sub.closed.then(()=>{this._stopped||this.close(new Error(`required subscription ${t.subject} stopped`)).catch()}).catch(d=>{if(!this._stopped){const y=new Error(`required subscription ${t.subject} errored: ${d.message}`);y.stack=d.stack,this.close(y).catch()}}),f}info(){return{type:Tl.INFO,name:this.name,id:this.id,version:this.version,description:this.description,metadata:this.metadata,endpoints:this.endpoints()}}endpoints(){return this.handlers.map(t=>{const{subject:r,metadata:s,name:l,queue:u}=t;return{subject:r,metadata:s,name:l,queue_group:u}})}async stats(){const t=[];for(const r of this.handlers){if(typeof this.config.statsHandler=="function")try{r.stats.data=await this.config.statsHandler(r)}catch(s){r.stats.countError(s)}t.push(r.stats.stats(r.qi))}return{type:Tl.STATS,name:this.name,id:this.id,version:this.version,started:this.started,metadata:this.metadata,endpoints:t}}addInternalHandler(t,r){const s=`${t}`.toUpperCase();this._doAddInternalHandler(`${s}-all`,t,r),this._doAddInternalHandler(`${s}-kind`,t,r,this.name),this._doAddInternalHandler(`${s}`,t,r,this.name,this.id)}_doAddInternalHandler(t,r,s,l="",u=""){const c={};c.name=t,c.subject=Yl.controlSubject(r,l,u),c.handler=s,this.setupHandler(c,!0)}start(){const t=br(),r=(c,f)=>c?(this.close(c),Promise.reject(c)):this.stats().then(m=>(f==null||f.respond(t.encode(m)),Promise.resolve())),s=(c,f)=>c?(this.close(c),Promise.reject(c)):(f==null||f.respond(t.encode(this.info())),Promise.resolve()),l=t.encode(this.ping()),u=(c,f)=>c?(this.close(c).then().catch(),Promise.reject(c)):(f.respond(l),Promise.resolve());return this.addInternalHandler(Di.PING,u),this.addInternalHandler(Di.STATS,r),this.addInternalHandler(Di.INFO,s),this.handlers.forEach(c=>{const{subject:f}=c;typeof f=="string"&&c.handler!==null&&this.setupHandler(c)}),Promise.resolve(this)}close(t){if(this._stopped)return this._done;this._stopped=!0;let r=[];return this.nc.isClosed()||(r=this.handlers.concat(this.internal).map(s=>s.sub.drain())),Promise.allSettled(r).then(()=>{this._done.resolve(t||null)}),this._done}get stopped(){return this._done}get isStopped(){return this._stopped}stop(t){return this.close(t)}ping(){return{type:Tl.PING,name:this.name,id:this.id,version:this.version,metadata:this.metadata}}reset(){if(this.started=new Date().toISOString(),this.handlers)for(const t of this.handlers)t.stats.reset(t.qi)}addGroup(t,r){return new Ul(this,t,r)}addEndpoint(t,r){return new Ul(this).addEndpoint(t,r)}_addEndpoint(t){const r=new an;r.noIterator=typeof t.handler=="function",r.noIterator||(t.handler=(l,u)=>{l?this.stop(l).catch():r.push(new j0(u))},r.iterClosed.then(()=>{this.close().catch()}));const s=this.setupHandler(t,!1);return s.qi=r,this.handlers.push(s),r}}class g2{constructor(t,r,s=""){C(this,"name");C(this,"subject");C(this,"average_processing_time");C(this,"num_requests");C(this,"processing_time");C(this,"num_errors");C(this,"last_error");C(this,"data");C(this,"metadata");C(this,"queue");this.name=t,this.subject=r,this.average_processing_time=0,this.num_errors=0,this.num_requests=0,this.processing_time=0,this.queue=s}reset(t){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=t;r&&(r.time=0,r.processed=0)}countLatency(t){this.num_requests++,this.processing_time+=zt(Date.now()-t),this.average_processing_time=Math.round(this.processing_time/this.num_requests)}countError(t){this.num_errors++,this.last_error=t.message}_stats(){const{name:t,subject:r,average_processing_time:s,num_errors:l,num_requests:u,processing_time:c,last_error:f,data:m,queue:d}=this;return{name:t,subject:r,average_processing_time:s,num_errors:l,num_requests:u,processing_time:c,last_error:f,data:m,queue_group:d}}stats(t){const r=t;return(r==null?void 0:r.noIterator)===!1&&(this.processing_time=zt(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 y2{constructor(t,r={strategy:yr.JitterTimer,maxWait:2e3},s){C(this,"nc");C(this,"prefix");C(this,"opts");this.nc=t,this.prefix=s,this.opts=r}ping(t="",r=""){return this.q(Di.PING,t,r)}stats(t="",r=""){return this.q(Di.STATS,t,r)}info(t="",r=""){return this.q(Di.INFO,t,r)}async q(t,r="",s=""){const l=new an,u=br(),c=Yl.controlSubject(t,r,s,this.prefix),f=await this.nc.requestMany(c,Gn,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 Ex(){return{key:{encode(e){return e},decode(e){return e}},value:{encode(e){return e},decode(e){return e}}}}function b2(){return{replicas:1,history:1,timeout:2e3,max_bytes:-1,maxValueSize:-1,codec:Ex(),storage:nd.File}}const zu="KV-Operation",N0="$KV",x2=/^[-/=.\w]+$/,v2=/^[-/=.>*\w]+$/,w2=/^[-\w]+$/;function S2(e){if(e.startsWith(".")||e.endsWith(".")||!x2.test(e))throw new Error(`invalid key: ${e}`)}function _2(e){if(e.startsWith(".")||e.endsWith(".")||!v2.test(e))throw new Error(`invalid key: ${e}`)}function k2(e){if(e.startsWith(".")||e.endsWith("."))throw new Error(`invalid key: ${e}`);const t=e.split(".");let r=!1;for(let s=0;s<t.length;s++)switch(t[s]){case"*":r=!0;break;case">":if(s!==t.length-1)throw new Error(`invalid key: ${e}`);r=!0;break}return r}function _u(e){if(!w2.test(e))throw new Error(`invalid bucket name: ${e}`)}var Tr;(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"})(Tr||(Tr={}));class Bl{constructor(t,r,s){C(this,"js");C(this,"jsm");C(this,"stream");C(this,"bucket");C(this,"direct");C(this,"codec");C(this,"prefix");C(this,"editPrefix");C(this,"useJsPrefix");C(this,"_prefixLen");C(this,"validateKey",S2);C(this,"validateSearchKey",_2);C(this,"hasWildcards",k2);_u(t),this.js=r,this.jsm=s,this.bucket=t,this.prefix=N0,this.editPrefix="",this.useJsPrefix=!1,this._prefixLen=0}static async create(t,r,s={}){_u(r);const l=await t.jetstreamManager(),u=new Bl(r,t,l);return await u.init(s),u}static async bind(t,r,s={}){const l=await t.jetstreamManager(),u={config:{allow_direct:s.allow_direct}};_u(r);const c=new Bl(r,t,l);return u.config.name=s.streamName??c.bucketName(),Object.assign(c,u),c.stream=u.config.name,c.codec=s.codec||Ex(),c.direct=u.config.allow_direct??!1,c.initializePrefixes(u),c}async init(t={}){const r=Object.assign(b2(),t);this.codec=r.codec;const s={};this.stream=s.name=t.streamName??this.bucketName(),s.retention=td.Limits,s.max_msgs_per_subject=r.history,r.maxBucketSize&&(r.max_bytes=r.maxBucketSize),r.max_bytes&&(s.max_bytes=r.max_bytes),s.max_msg_size=r.maxValueSize,s.storage=r.storage;const l=t.placementCluster??"";if(l&&(t.placement={},t.placement.cluster=l,t.placement.tags=[]),t.placement&&(s.placement=t.placement),t.republish&&(s.republish=t.republish),t.description&&(s.description=t.description),t.mirror){const g=Object.assign({},t.mirror);g.name.startsWith(In)||(g.name=`${In}${g.name}`),s.mirror=g,s.mirror_direct=!0}else if(t.sources){const g=t.sources.map(x=>{const w=Object.assign({},x),E=w.name.startsWith(In)?w.name.substring(In.length):w.name;return w.name.startsWith(In)||(w.name=`${In}${w.name}`),!x.external&&E!==this.bucket&&(w.subject_transforms=[{src:`$KV.${E}.>`,dest:`$KV.${this.bucket}.>`}]),w});s.sources=g,s.subjects=[this.subjectForBucket()]}else s.subjects=[this.subjectForBucket()];t.metadata&&(s.metadata=t.metadata),typeof t.compression=="boolean"&&(s.compression=t.compression?Bi.S2:Bi.None);const u=this.js.nc,c=u.getServerVersion(),f=c?id(c,ds("2.7.2"))>=0:!1;s.discard=f?zl.New:zl.Old;const{ok:m,min:d}=u.features.get(ut.JS_ALLOW_DIRECT);if(!m&&t.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}`))}t.allow_direct=typeof t.allow_direct=="boolean"?t.allow_direct:m,s.allow_direct=t.allow_direct,this.direct=s.allow_direct,s.num_replicas=r.replicas,r.ttl&&(s.max_age=zt(r.ttl)),s.allow_rollup_hdrs=!0;let y;try{y=await this.jsm.streams.info(s.name),!y.config.allow_direct&&this.direct===!0&&(this.direct=!1)}catch(g){if(g.message==="stream not found")y=await this.jsm.streams.add(s);else throw g}this.initializePrefixes(y)}initializePrefixes(t){this._prefixLen=0,this.prefix=`$KV.${this.bucket}`,this.useJsPrefix=this.js.apiPrefix!=="$JS.API";const{mirror:r}=t.config;if(r){let s=r.name;if(s.startsWith(In)&&(s=s.substring(In.length)),r.external&&r.external.api!==""){const l=r.name.substring(In.length);this.useJsPrefix=!1,this.prefix=`$KV.${l}`,this.editPrefix=`${r.external.api}.$KV.${s}`}else this.editPrefix=this.prefix}}bucketName(){return this.stream??`${In}${this.bucket}`}subjectForBucket(){return`${this.prefix}.${this.bucket}.>`}subjectForKey(t,r=!1){const s=[];return r?(this.useJsPrefix&&s.push(this.js.apiPrefix),this.editPrefix!==""?s.push(this.editPrefix):s.push(this.prefix)):this.prefix&&s.push(this.prefix),s.push(t),s.join(".")}fullKeyName(t){return this.prefix!==""?`${this.prefix}.${t}`:`${N0}.${this.bucket}.${t}`}get prefixLen(){return this._prefixLen===0&&(this._prefixLen=this.prefix.length+1),this._prefixLen}encodeKey(t){const r=[];for(const s of t.split("."))switch(s){case">":case"*":r.push(s);break;default:r.push(this.codec.key.encode(s));break}return r.join(".")}decodeKey(t){const r=[];for(const s of t.split("."))switch(s){case">":case"*":r.push(s);break;default:r.push(this.codec.key.decode(s));break}return r.join(".")}close(){return Promise.resolve()}dataLen(t,r){const s=r&&r.get(Sn.MessageSizeHdr)||"";return s!==""?parseInt(s,10):t.length}smToEntry(t){return new P2(this.bucket,this.prefixLen,t)}jmToEntry(t){const r=this.decodeKey(t.subject.substring(this.prefixLen));return new q2(this.bucket,r,t)}async create(t,r){var u;let s;try{const c=await this.put(t,r,{previousSeq:0});return Promise.resolve(c)}catch(c){if(s=c,((u=c==null?void 0:c.api_error)==null?void 0:u.err_code)!==10071)return Promise.reject(c)}let l=0;try{const c=await this.get(t);return(c==null?void 0:c.operation)==="DEL"||(c==null?void 0:c.operation)==="PURGE"?(l=c!==null?c.revision:0,this.update(t,r,l)):Promise.reject(s)}catch(c){return Promise.reject(c)}}update(t,r,s){if(s<=0)throw new Error("version must be greater than 0");return this.put(t,r,{previousSeq:s})}async put(t,r,s={}){var c,f;const l=this.encodeKey(t);this.validateKey(l);const u={};if(s.previousSeq!==void 0){const m=ni();u.headers=m,m.set(Tr.ExpectedLastSubjectSequenceHdr,`${s.previousSeq}`)}try{return(await this.js.publish(this.subjectForKey(l,!0),r,u)).seq}catch(m){const d=m;return d.isJetStreamError()?(d.message=(c=d.api_error)==null?void 0:c.description,d.code=`${(f=d.api_error)==null?void 0:f.code}`,Promise.reject(d)):Promise.reject(m)}}async get(t,r){const s=this.encodeKey(t);this.validateKey(s);let l={last_by_subj:this.subjectForKey(s)};r&&r.revision>0&&(l={seq:r.revision});let u;try{this.direct?u=await this.jsm.direct.getMessage(this.bucketName(),l):u=await this.jsm.streams.getMessage(this.bucketName(),l);const c=this.smToEntry(u);return c.key!==s?null:c}catch(c){if(c.code===Se.JetStream404NoMessages)return null;throw c}}purge(t,r){return this._deleteOrPurge(t,"PURGE",r)}delete(t,r){return this._deleteOrPurge(t,"DEL",r)}async purgeDeletes(t=1800*1e3){const r=Ut(),s=[],l=await this.watch({key:">",initializedFn:()=>{r.resolve()}});(async()=>{for await(const m of l)(m.operation==="DEL"||m.operation==="PURGE")&&s.push(m)})().then(),await r,l.stop();const u=Date.now()-t,c=s.map(m=>{const d=this.subjectForKey(m.key);return m.created.getTime()>=u?this.jsm.streams.purge(this.stream,{filter:d,keep:1}):this.jsm.streams.purge(this.stream,{filter:d,keep:0})}),f=await Promise.all(c);return f.unshift({success:!0,purged:0}),f.reduce((m,d)=>(m.purged+=d.purged,m))}async _deleteOrPurge(t,r,s){if(!this.hasWildcards(t))return this._doDeleteOrPurge(t,r,s);const l=await this.keys(t),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(t,r,s){const l=this.encodeKey(t);this.validateKey(l);const u=ni();u.set(zu,r),r==="PURGE"&&u.set(Sn.RollupHdr,Sn.RollupValueSubject),s!=null&&s.previousSeq&&u.set(Tr.ExpectedLastSubjectSequenceHdr,`${s.previousSeq}`),await this.js.publish(this.subjectForKey(l,!0),Gn,{headers:u})}_buildCC(t,r,s={}){let u=(Array.isArray(t)?t:[t]).map(m=>{const d=this.encodeKey(m);return this.validateSearchKey(m),this.fullKeyName(d)}),c=Vt.LastPerSubject;r===pr.AllHistory&&(c=Vt.All),r===pr.UpdatesOnly&&(c=Vt.New);let f;return u.length===1&&(f=u[0],u=void 0),Object.assign({deliver_policy:c,ack_policy:sn.None,filter_subjects:u,filter_subject:f,flow_control:!0,idle_heartbeat:zt(5*1e3)},s)}remove(t){return this.purge(t)}async history(t={}){const r=t.key??">",s=new an,l={};l.headers_only=t.headers_only||!1;let u;u=()=>{s.stop()};let c=0;const f=this._buildCC(r,pr.AllHistory,l),m=f.filter_subject,d=zi(f);d.bindStream(this.stream),d.orderedConsumer(),d.callback((g,x)=>{if(g){s.stop(g);return}if(x){const w=this.jmToEntry(x);s.push(w),s.received++,(u&&c>0&&s.received>=c||x.info.pending===0)&&(s.push(u),u=void 0)}});const y=await this.js.subscribe(m,d);if(u){const{info:{last:g}}=y,x=g.num_pending+g.delivered.consumer_seq;if(x===0||s.received>=x)try{u()}catch(w){s.stop(w)}finally{u=void 0}else c=x}return s._data=y,s.iterClosed.then(()=>{y.unsubscribe()}),y.closed.then(()=>{s.stop()}).catch(g=>{s.stop(g)}),s}canSetWatcherName(){const r=this.js.nc,{ok:s}=r.features.get(ut.JS_NEW_CONSUMER_CREATE_API);return s}async watch(t={}){const r=t.key??">",s=new an,l={};l.headers_only=t.headers_only||!1;let u=pr.LastValue;t.include===pr.AllHistory?u=pr.AllHistory:t.include===pr.UpdatesOnly&&(u=pr.UpdatesOnly);const c=t.ignoreDeletes===!0;let f=t.initializedFn,m=0;const d=this._buildCC(r,u,l),y=d.filter_subject,g=zi(d);this.canSetWatcherName()&&g.consumerName(Ui.next()),g.bindStream(this.stream),t.resumeFromRevision&&t.resumeFromRevision>0&&g.startSequence(t.resumeFromRevision),g.orderedConsumer(),g.callback((w,E)=>{if(w){s.stop(w);return}if(E){const R=this.jmToEntry(E);if(c&&R.operation==="DEL")return;s.push(R),s.received++,f&&(m>0&&s.received>=m||E.info.pending===0)&&(s.push(f),f=void 0)}});const x=await this.js.subscribe(y,g);if(f){const{info:{last:w}}=x,E=w.num_pending+w.delivered.consumer_seq;if(E===0||s.received>=E)try{f()}catch(R){s.stop(R)}finally{f=void 0}else m=E}return s._data=x,s.iterClosed.then(()=>{x.unsubscribe()}),x.closed.then(()=>{s.stop()}).catch(w=>{s.stop(w)}),s}async keys(t=">"){const r=new an,s=this._buildCC(t,pr.LastValue,{headers_only:!0}),l=Array.isArray(t)?">":s.filter_subject,u=zi(s);u.bindStream(this.stream),u.orderedConsumer();const c=await this.js.subscribe(l,u);return(async()=>{var m;for await(const d of c){const y=(m=d.headers)==null?void 0:m.get(zu);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(t){return this.jsm.streams.purge(this.bucketName(),t)}destroy(){return this.jsm.streams.delete(this.bucketName())}async status(){var u;const r=((u=this.js.nc.info)==null?void 0:u.cluster)??"",s=this.bucketName(),l=await this.jsm.streams.info(s);return new Cx(l,r)}}class Cx{constructor(t,r=""){C(this,"si");C(this,"cluster");this.si=t,this.cluster=r}get bucket(){return this.si.config.name.startsWith(In)?this.si.config.name.substring(In.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 Md(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 t;return((t=this.si.config.placement)==null?void 0:t.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!==Bi.None:!1}}const zd="OBJ_",O0="SHA-256=";function E2(e){return _u(e),`${zd}${e}`}function C2(e){return e.startsWith(zd)?e.substring(4):e}class od{constructor(t){C(this,"si");C(this,"backingStore");this.si=t,this.backingStore="JetStream"}get bucket(){return C2(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!==Bi.None:!1}}function du(e){if(e===void 0)return;const{domain:t}=e;if(t===void 0)return e;const r=Object.assign({},e);if(delete r.domain,t==="")return r;if(r.external)throw new Error("domain and external are both set");return r.external={api:`$JS.${t}.API`},r}var sr;(function(e){e[e.Unset=-1]="Unset",e[e.Consume=0]="Consume",e[e.Fetch=1]="Fetch"})(sr||(sr={}));var jr;(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"})(jr||(jr={}));var fa;(function(e){e.DebugEvent="debug",e.Discard="discard",e.Reset="reset",e.Next="next"})(fa||(fa={}));const R0=Uint8Array.of(43,65,67,75),A2=Uint8Array.of(45,78,65,75),xl=Uint8Array.of(43,87,80,73),T2=Uint8Array.of(43,78,88,84),j2=Uint8Array.of(43,84,69,82,77),N2=Uint8Array.of(32);function Pl(e,t=5e3){return new V2(e,t)}class Ch extends an{constructor(r,s,l=!1){super();C(this,"consumer");C(this,"opts");C(this,"sub");C(this,"monitor");C(this,"pending");C(this,"inbox");C(this,"refilling");C(this,"pong");C(this,"callback");C(this,"timeout");C(this,"cleanupHandler");C(this,"listeners");C(this,"statusIterator");C(this,"forOrderedConsumer");C(this,"resetHandler");C(this,"abortOnMissingResource");C(this,"bind");C(this,"inBackOff");this.consumer=r;const u=s;this.opts=this.parseOptions(s,l),this.callback=u.callback||null,this.noIterator=typeof this.callback=="function",this.monitor=null,this.pong=null,this.pending={msgs:0,bytes:0,requests:0},this.refilling=l,this.timeout=null,this.inbox=ei(r.api.nc.options.inboxPrefix),this.listeners=[],this.forOrderedConsumer=!1,this.abortOnMissingResource=u.abort_on_missing_resource===!0,this.bind=u.bind===!0,this.inBackOff=!1,this.start()}start(){const{max_messages:r,max_bytes:s,idle_heartbeat:l,threshold_bytes:u,threshold_messages:c}=this.opts;this.closed().then(m=>{if(this.cleanupHandler)try{this.cleanupHandler(m)}catch{}});const{sub:f}=this;f&&f.unsubscribe(),this.sub=this.consumer.api.nc.subscribe(this.inbox,{callback:(m,d)=>{var g,x,w,E;if(m){this.stop(m);return}if((g=this.monitor)==null||g.work(),d.subject===this.inbox){if(ed(d))return;const R=(x=d.headers)==null?void 0:x.code,B=((E=(w=d.headers)==null?void 0:w.description)==null?void 0:E.toLowerCase())||"unknown",{msgsLeft:D,bytesLeft:P}=this.parseDiscard(d.headers);if(D>0||P>0)this.pending.msgs-=D,this.pending.bytes-=P,this.pending.requests--,this.notify(fa.Discard,{msgsLeft:D,bytesLeft:P});else if(R===400){this.stop(new Oe(B,`${R}`));return}else if(R===409&&B==="consumer deleted"){if(this.notify(jr.ConsumerDeleted,`${R} ${B}`),!this.refilling||this.abortOnMissingResource){const F=new Oe(B,`${R}`);this.stop(F);return}}else if(R===503){if(this.notify(jr.NoResponders,`${R} No Responders`),!this.refilling||this.abortOnMissingResource){const F=new Oe("no responders",`${R}`);this.stop(F);return}}else this.notify(fa.DebugEvent,`${R} ${B}`)}else this._push(Pl(d,this.consumer.api.timeout)),this.received++,this.pending.msgs&&this.pending.msgs--,this.pending.bytes&&(this.pending.bytes-=d.size());if(this.pending.msgs===0&&this.pending.bytes===0&&(this.pending.requests=0),this.refilling){if(r&&this.pending.msgs<=c||s&&this.pending.bytes<=u){const R=this.pullOptions();this.pull(R)}}else this.pending.requests===0&&this._push(()=>{this.stop()})}}),this.sub.closed.then(()=>{this.sub.draining&&this._push(()=>{this.stop()})}),l&&(this.monitor=new Ld(l,m=>(this.notify(jr.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 Zr.Disconnect:(d=this.monitor)==null||d.cancel();break;case Zr.Reconnect:this.resetPending().then(g=>{var x;g&&((x=this.monitor)==null||x.restart())}).catch(()=>{});break}})(),this.pull(this.pullOptions())}_push(r){if(!this.callback)super.push(r);else{const s=typeof r=="function"?r:null;try{s?s():this.callback(r)}catch(l){this.stop(l)}}}notify(r,s){this.listeners.length>0&&this.listeners.forEach(l=>{l.done||l.push({type:r,data:s})})}resetPending(){return this.bind?this.resetPendingNoInfo():this.resetPendingWithInfo()}resetPendingNoInfo(){return this.pending.msgs=0,this.pending.bytes=0,this.pending.requests=0,this.pull(this.pullOptions()),Promise.resolve(!0)}async resetPendingWithInfo(){if(this.inBackOff)return!1;let r=0,s=0;const l=Rd([this.opts.expires]);let u=0;for(;;){if(this.done)return!1;if(this.consumer.api.nc.isClosed())return console.error("aborting resetPending - connection is closed"),!1;try{return await this.consumer.info(),this.inBackOff=!1,r=0,this.pending.msgs=0,this.pending.bytes=0,this.pending.requests=0,this.pull(this.pullOptions()),!0}catch(c){if(c.message==="stream not found"){if(s++,this.notify(jr.StreamNotFound,s),!this.refilling||this.abortOnMissingResource)return this.stop(c),!1}else if(c.message==="consumer not found"){if(r++,this.notify(jr.ConsumerNotFound,r),this.resetHandler)try{this.resetHandler()}catch{}if(!this.refilling||this.abortOnMissingResource)return this.stop(c),!1;if(this.forOrderedConsumer)return!1}else r=0,s=0;this.inBackOff=!0;const f=l.backoff(u),m=Sa(f);await Promise.race([m,this.consumer.api.nc.closed()]),m.cancel(),u++}}}pull(r){this.pending.bytes+=r.max_bytes??0,this.pending.msgs+=r.batch??0,this.pending.requests++;const s=this.consumer.api.nc;this._push(()=>{s.publish(`${this.consumer.api.prefix}.CONSUMER.MSG.NEXT.${this.consumer.stream}.${this.consumer.name}`,this.consumer.api.jc.encode(r),{reply:this.inbox}),this.notify(fa.Next,r)})}pullOptions(){const r=this.opts.max_messages-this.pending.msgs,s=this.opts.max_bytes-this.pending.bytes,l=zt(this.opts.idle_heartbeat),u=zt(this.opts.expires);return{batch:r,max_bytes:s,idle_heartbeat:l,expires:u}}parseDiscard(r){const s={msgsLeft:0,bytesLeft:0},l=r==null?void 0:r.get(Sn.PendingMessagesHdr);l&&(s.msgsLeft=parseInt(l));const u=r==null?void 0:r.get(Sn.PendingBytesHdr);return u&&(s.bytesLeft=parseInt(u)),s}trackTimeout(r){this.timeout=r}close(){return this.stop(),this.iterClosed}closed(){return this.iterClosed}clearTimers(){var r,s;(r=this.monitor)==null||r.cancel(),this.monitor=null,(s=this.timeout)==null||s.cancel(),this.timeout=null}setCleanupHandler(r){this.cleanupHandler=r}stop(r){var s,l;this.done||((s=this.sub)==null||s.unsubscribe(),this.clearTimers(),(l=this.statusIterator)==null||l.stop(),this._push(()=>{super.stop(r),this.listeners.forEach(u=>{u.stop()})}))}parseOptions(r,s=!1){const l=r||{};if(l.max_messages=l.max_messages||0,l.max_bytes=l.max_bytes||0,l.max_messages!==0&&l.max_bytes!==0)throw new Error("only specify one of max_messages or max_bytes");if(l.max_messages===0&&(l.max_messages=100),l.expires=l.expires||3e4,l.expires<1e3)throw new Error("expires should be at least 1000ms");if(l.idle_heartbeat=l.idle_heartbeat||l.expires/2,l.idle_heartbeat=l.idle_heartbeat>3e4?3e4:l.idle_heartbeat,s){const u=Math.round(l.max_messages*.75)||1;l.threshold_messages=l.threshold_messages||u;const c=Math.round(l.max_bytes*.75)||1;l.threshold_bytes=l.threshold_bytes||c}return l}status(){const r=new an;return this.listeners.push(r),Promise.resolve(r)}}class O2 extends an{constructor(){super();C(this,"src");C(this,"listeners");this.listeners=[]}setSource(r){this.src&&(this.src.resetHandler=void 0,this.src.setCleanupHandler(),this.src.stop()),this.src=r,this.src.setCleanupHandler(s=>{this.stop(s||void 0)}),(async()=>{const s=await this.src.status();for await(const l of s)this.notify(l.type,l.data)})().catch(()=>{})}notify(r,s){this.listeners.length>0&&this.listeners.forEach(l=>{l.done||l.push({type:r,data:s})})}stop(r){var s;this.done||((s=this.src)==null||s.stop(r),super.stop(r),this.listeners.forEach(l=>{l.stop()}))}close(){return this.stop(),this.iterClosed}closed(){return this.iterClosed}status(){const r=new an;return this.listeners.push(r),Promise.resolve(r)}}class ud{constructor(t,r){C(this,"api");C(this,"_info");C(this,"stream");C(this,"name");this.api=t,this._info=r,this.stream=r.stream_name,this.name=r.name}consume(t={max_messages:100,expires:3e4}){return Promise.resolve(new Ch(this,t,!0))}fetch(t={max_messages:100,expires:3e4}){const r=new Ch(this,t,!1),s=Math.round(r.opts.expires*1.05),l=ma(s);return r.closed().catch(()=>{}).finally(()=>{l.cancel()}),l.catch(()=>{r.close().catch()}),r.trackTimeout(l),Promise.resolve(r)}next(t={expires:3e4}){const r=Ut(),s=t;s.max_messages=1;const l=new Ch(this,s,!1),u=Math.round(l.opts.expires*1.05);u>=6e4&&(async()=>{for await(const f of await l.status())if(f.type===jr.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=ma(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:t,name:r}=this._info;return this.api.delete(t,r)}info(t=!1){if(t)return Promise.resolve(this._info);const{stream_name:r,name:s}=this._info;return this.api.info(r,s).then(l=>(this._info=l,this._info))}}class R2{constructor(t,r,s={}){C(this,"api");C(this,"consumerOpts");C(this,"consumer");C(this,"opts");C(this,"cursor");C(this,"stream");C(this,"namePrefix");C(this,"serial");C(this,"currentConsumer");C(this,"userCallback");C(this,"iter");C(this,"type");C(this,"startSeq");C(this,"maxInitialReset");this.api=t,this.stream=r,this.cursor={stream_seq:1,deliver_seq:0},this.namePrefix=Ui.next(),typeof s.name_prefix=="string"&&(Ju("name_prefix",s.name_prefix),this.namePrefix=s.name_prefix+this.namePrefix),this.serial=0,this.currentConsumer=null,this.userCallback=null,this.iter=null,this.type=sr.Unset,this.consumerOpts=s,this.maxInitialReset=30,this.startSeq=this.consumerOpts.opt_start_seq||0,this.cursor.stream_seq=this.startSeq>0?this.startSeq-1:0}getConsumerOpts(t){this.serial++;const r=`${this.namePrefix}_${this.serial}`;t=t===0?1:t;const s={name:r,deliver_policy:Vt.StartSequence,opt_start_seq:t,ack_policy:sn.None,inactive_threshold:zt(300*1e3),num_replicas:1};return this.consumerOpts.headers_only===!0&&(s.headers_only=!0),Array.isArray(this.consumerOpts.filterSubjects)&&(s.filter_subjects=this.consumerOpts.filterSubjects),typeof this.consumerOpts.filterSubjects=="string"&&(s.filter_subject=this.consumerOpts.filterSubjects),this.consumerOpts.replay_policy&&(s.replay_policy=this.consumerOpts.replay_policy),t===this.startSeq+1&&(s.deliver_policy=this.consumerOpts.deliver_policy||Vt.StartSequence,(this.consumerOpts.deliver_policy===Vt.LastPerSubject||this.consumerOpts.deliver_policy===Vt.New||this.consumerOpts.deliver_policy===Vt.Last)&&(delete s.opt_start_seq,s.deliver_policy=this.consumerOpts.deliver_policy),s.deliver_policy===Vt.LastPerSubject&&typeof s.filter_subjects>"u"&&typeof s.filter_subject>"u"&&(s.filter_subject=">"),this.consumerOpts.opt_start_time&&(delete s.opt_start_seq,s.deliver_policy=Vt.StartTime,s.opt_start_time=this.consumerOpts.opt_start_time),this.consumerOpts.inactive_threshold&&(s.inactive_threshold=zt(this.consumerOpts.inactive_threshold))),s}async resetConsumer(t=0){var c,f,m,d,y;Ui.next();const r=this.serial===0;(c=this.consumer)==null||c.delete().catch(()=>{}),t=t===0?1:t,this.cursor.deliver_seq=0;const s=this.getConsumerOpts(t);s.max_deliver=1,s.mem_storage=!0;const l=Rd([((f=this.opts)==null?void 0:f.expires)||3e4]);let u;for(let g=0;;g++)try{u=await this.api.add(this.stream,s),(m=this.iter)==null||m.notify(jr.OrderedConsumerRecreated,u.name);break}catch(x){if(x.message==="stream not found"&&((d=this.iter)==null||d.notify(jr.StreamNotFound,g),this.type===sr.Fetch||this.opts.abort_on_missing_resource===!0))return(y=this.iter)==null||y.stop(x),Promise.reject(x);if(r&&g>=this.maxInitialReset)throw x;await Sa(l.backoff(g+1))}return u}internalHandler(t){return r=>{var l;if(this.serial!==t)return;const s=r.info.deliverySequence;if(s!==this.cursor.deliver_seq+1){this.notifyOrderedResetAndReset();return}this.cursor.deliver_seq=s,this.cursor.stream_seq=r.info.streamSequence,this.userCallback?this.userCallback(r):(l=this.iter)==null||l.push(r)}}async reset(t={max_messages:100,expires:3e4},r){var m,d;r=r||{};const s=r.fromFetch||!1,l=r.orderedReset||!1;if(this.type===sr.Fetch&&l){(m=this.iter)==null||m.src.stop(),await((d=this.iter)==null?void 0:d.closed()),this.currentConsumer=null;return}(this.currentConsumer===null||l)&&(this.currentConsumer=await this.resetConsumer(this.cursor.stream_seq+1)),(this.iter===null||s)&&(this.iter=new O2),this.consumer=new ud(this.api,this.currentConsumer);const u=t;u.callback=this.internalHandler(this.serial);let c=null;this.type===sr.Fetch&&s?c=await this.consumer.fetch(t):this.type===sr.Consume&&(c=await this.consumer.consume(t));const f=c;f.forOrderedConsumer=!0,f.resetHandler=()=>{this.notifyOrderedResetAndReset()},this.iter.setSource(f)}notifyOrderedResetAndReset(){var t;(t=this.iter)==null||t.notify(fa.Reset,""),this.reset(this.opts,{orderedReset:!0})}async consume(t={max_messages:100,expires:3e4}){if(t.bind)return Promise.reject(new Error("bind is not supported"));if(this.type===sr.Fetch)return Promise.reject(new Error("ordered consumer initialized as fetch"));if(this.type===sr.Consume)return Promise.reject(new Error("ordered consumer doesn't support concurrent consume"));const{callback:s}=t;return s&&(this.userCallback=s),this.type=sr.Consume,this.opts=t,await this.reset(t),this.iter}async fetch(t={max_messages:100,expires:3e4}){var l;if(t.bind)return Promise.reject(new Error("bind is not supported"));if(this.type===sr.Consume)return Promise.reject(new Error("ordered consumer already initialized as consume"));if(((l=this.iter)==null?void 0:l.done)===!1)return Promise.reject(new Error("ordered consumer doesn't support concurrent fetch"));const{callback:s}=t;return s&&(this.userCallback=s),this.type=sr.Fetch,this.opts=t,await this.reset(t,{fromFetch:!0}),this.iter}async next(t={expires:3e4}){const r=t;if(r.bind)return Promise.reject(new Error("bind is not supported"));r.max_messages=1;const s=Ut();return r.callback=u=>{this.userCallback=null,s.resolve(u)},(await this.fetch(r)).iterClosed.then(u=>{u&&s.reject(u),s.resolve(null)}).catch(u=>{s.reject(u)}),s}delete(){return this.currentConsumer?this.api.delete(this.stream,this.currentConsumer.name).then(t=>Promise.resolve(t)).catch(t=>Promise.reject(t)).finally(()=>{this.currentConsumer=null}):Promise.resolve(!1)}async info(t){return this.currentConsumer==null?(this.currentConsumer=await this.resetConsumer(this.startSeq),Promise.resolve(this.currentConsumer)):t&&this.currentConsumer?Promise.resolve(this.currentConsumer):this.api.info(this.stream,this.currentConsumer.name)}}class cd{constructor(t){C(this,"api");C(this,"notified");this.api=t,this.notified=!1}checkVersion(){const t=this.api.nc.features.get(ut.JS_SIMPLIFICATION);return t.ok?Promise.resolve():Promise.reject(new Error(`consumers framework is only supported on servers ${t.min} or better`))}getPullConsumerFor(t){if(t.config.deliver_subject!==void 0)throw new Error("push consumer not supported");return new ud(this.api,t)}async get(t,r={}){return typeof r=="object"?this.ordered(t,r):(await this.checkVersion(),this.api.info(t,r).then(s=>s.config.deliver_subject!==void 0?Promise.reject(new Error("push consumer not supported")):new ud(this.api,s)).catch(s=>Promise.reject(s)))}async ordered(t,r){await this.checkVersion();const s=this.api;return new Ud(s.nc,s.opts).info(t).then(u=>Promise.resolve(new R2(this.api,t,r))).catch(u=>Promise.reject(u))}}class Qu{constructor(t,r){C(this,"api");C(this,"_info");this.api=t,this._info=r}get name(){return this._info.config.name}alternates(){return this.info().then(t=>t.alternates?t.alternates:[])}async best(){if(await this.info(),this._info.alternates){const t=await this.api.info(this._info.alternates[0].name);return new Qu(this.api,t)}else return this}info(t=!1,r){return t?Promise.resolve(this._info):this.api.info(this.name,r).then(s=>(this._info=s,this._info))}getConsumerFromInfo(t){return new cd(new Ru(this.api.nc,this.api.opts)).getPullConsumerFor(t)}getConsumer(t){return new cd(new Ru(this.api.nc,this.api.opts)).get(this.name,t)}getMessage(t){return this.api.getMessage(this.name,t)}deleteMessage(t,r){return this.api.deleteMessage(this.name,t,r)}}class Ud extends $l{constructor(t,r){super(t,r)}checkStreamConfigVersions(t){const r=this.nc;if(t.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(t.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(t.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(t.compression){const{min:l,ok:u}=r.features.get(ut.JS_STREAM_COMPRESSION);if(!u)throw new Error(`stream 'compression' requires server ${l}`)}if(t.consumer_limits){const{min:l,ok:u}=r.features.get(ut.JS_DEFAULT_CONSUMER_LIMITS);if(!u)throw new Error(`stream 'consumer_limits' requires server ${l}`)}function s(l,u){var f;if((((f=u==null?void 0:u.subject_transforms)==null?void 0:f.length)||0)>0){const{min:m,ok:d}=r.features.get(ut.JS_STREAM_SOURCE_SUBJECT_TRANSFORM);if(!d)throw new Error(`${l} 'subject_transforms' requires server ${m}`)}}t.sources&&t.sources.forEach(l=>{s("stream sources",l)}),t.mirror&&s("stream mirror",t.mirror)}async add(t={}){var l;this.checkStreamConfigVersions(t),bn(t.name),t.mirror=du(t.mirror),t.sources=(l=t.sources)==null?void 0:l.map(du);const s=await this._request(`${this.prefix}.STREAM.CREATE.${t.name}`,t);return this._fixInfo(s),s}async delete(t){return bn(t),(await this._request(`${this.prefix}.STREAM.DELETE.${t}`)).success}async update(t,r={}){var f;if(typeof t=="object"){const m=t;t=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),bn(t);const s=await this.info(t),l=Object.assign(s.config,r);l.mirror=du(l.mirror),l.sources=(f=l.sources)==null?void 0:f.map(du);const c=await this._request(`${this.prefix}.STREAM.UPDATE.${t}`,l);return this._fixInfo(c),c}async info(t,r){bn(t);const s=`${this.prefix}.STREAM.INFO.${t}`;let u=await this._request(s,r),{total:c,limit:f}=u,m=u.state.subjects?Object.getOwnPropertyNames(u.state.subjects).length:1;if(c&&c>m){const d=[u],y=r||{};let g=0;for(;c>m;){g++,y.offset=f*g;const w=await this._request(s,y);c=w.total,d.push(w);const E=Object.getOwnPropertyNames(w.state.subjects).length;if(m+=E,E<f)break}let x={};for(let w=0;w<d.length;w++)u=d[w],u.state.subjects&&(x=Object.assign(x,u.state.subjects));u.offset=0,u.total=0,u.limit=0,u.state.subjects=x}return this._fixInfo(u),u}list(t=""){const r=t!=null&&t.length?{subject:t}:{},s=u=>{const c=u;return c.streams.forEach(f=>{this._fixInfo(f)}),c.streams},l=`${this.prefix}.STREAM.LIST`;return new Cl(l,s,this,r)}_fixInfo(t){t.config.sealed=t.config.sealed||!1,t.config.deny_delete=t.config.deny_delete||!1,t.config.deny_purge=t.config.deny_purge||!1,t.config.allow_rollup_hdrs=t.config.allow_rollup_hdrs||!1}async purge(t,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 bn(t),await this._request(`${this.prefix}.STREAM.PURGE.${t}`,r)}async deleteMessage(t,r,s=!0){bn(t);const l={seq:r};return s||(l.no_erase=!0),(await this._request(`${this.prefix}.STREAM.MSG.DELETE.${t}`,l)).success}async getMessage(t,r){bn(t);const l=await this._request(`${this.prefix}.STREAM.MSG.GET.${t}`,r);return new Ax(l)}find(t){return this.findStream(t)}listKvs(){const t=s=>{var m;const u=s.streams.filter(d=>d.config.name.startsWith(In));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 Cx(d,c))},r=`${this.prefix}.STREAM.LIST`;return new Cl(r,t,this)}listObjectStores(){const t=s=>{const u=s.streams.filter(f=>f.config.name.startsWith(zd));return u.forEach(f=>{this._fixInfo(f)}),u.map(f=>new od(f))},r=`${this.prefix}.STREAM.LIST`;return new Cl(r,t,this)}names(t=""){const r=t!=null&&t.length?{subject:t}:{},s=u=>u.streams,l=`${this.prefix}.STREAM.NAMES`;return new Cl(l,s,this,r)}async get(t){const r=await this.info(t);return Promise.resolve(new Qu(this,r))}}class M2 extends $l{constructor(t,r){super(t,r)}async getMessage(t,r){bn(t);let s=r;const{last_by_subj:l}=s;l&&(s=null);const u=s?this.jc.encode(s):Gn,c=this.opts.apiPrefix||"$JS.API",f=l?`${c}.DIRECT.GET.${t}.${l}`:`${c}.DIRECT.GET.${t}`,m=await this.nc.request(f,u,{timeout:this.timeout}),d=ua(m);if(d)return Promise.reject(d);const y=new fd(m);return Promise.resolve(y)}async getBatch(t,r){bn(t);const l=`${this.opts.apiPrefix||"$JS.API"}.DIRECT.GET.${t}`;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 an,f=await this.nc.requestMany(l,u,{strategy:yr.SentinelMsg});return(async()=>{var g,x,w;let m=!1,d=!1,y;for await(const E of f){if(!m){m=!0;const R=((g=E.headers)==null?void 0:g.code)||0;if(R!==0&&R<200||R>299){y=(x=E.headers)==null?void 0:x.description.toLowerCase();break}if(((w=E.headers)==null?void 0:w.get("Nats-Num-Pending"))===""){d=!0;break}}if(E.data.length===0)break;c.push(new fd(E))}c.push(()=>{if(d)throw new Error("batch direct get not supported by the server");if(y)throw new Error(`bad request: ${y}`);c.stop()})})(),Promise.resolve(c)}}class fd{constructor(t){C(this,"data");C(this,"header");if(!t.headers)throw new Error("headers expected");this.data=t.data,this.header=t.headers}get subject(){return this.header.last(ia.Subject)}get seq(){const t=this.header.last(ia.Sequence);return typeof t=="string"?parseInt(t):0}get time(){return new Date(Date.parse(this.timestamp))}get timestamp(){return this.header.last(ia.TimeStamp)}get stream(){return this.header.last(ia.Stream)}json(t){return br(t).decode(this.data)}string(){return Fn.decode(this.data)}}C(fd,"jc");class D2 extends $l{constructor(r,s){super(r,s);C(this,"streams");C(this,"consumers");C(this,"direct");this.streams=new Ud(r,s),this.consumers=new Ru(r,s),this.direct=new M2(r,s)}async getAccountInfo(){return await this._request(`${this.prefix}.INFO`)}jetstream(){return this.nc.jetstream(this.getOptions())}advisories(){const r=new an;return this.nc.subscribe("$JS.EVENT.ADVISORY.>",{callback:(s,l)=>{if(s)throw s;try{const u=this.parseJsResponse(l),c=u.type.split("."),f=c[c.length-1];r.push({kind:f,data:u})}catch(u){r.stop(u)}}}),r}}class Ax{constructor(t){C(this,"_header");C(this,"smr");this.smr=t}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):Gn}get header(){if(!this._header)if(this.smr.message.hdrs){const t=this._parse(this.smr.message.hdrs);this._header=Li.decode(t)}else this._header=ni();return this._header}_parse(t){const r=atob(t),s=r.length,l=new Uint8Array(s);for(let u=0;u<s;u++)l[u]=r.charCodeAt(u);return l}json(t){return br(t).decode(this.data)}string(){return Fn.decode(this.data)}}C(Ax,"jc");class L2{constructor(t){C(this,"api");this.api=t}get(t){return this.api.info(t).then(r=>new Qu(this.api,r))}}class Ah{constructor(t){C(this,"info");C(this,"hdrs");this.info=t}get name(){return this.info.name}get description(){return this.info.description??""}get headers(){return this.hdrs||(this.hdrs=Li.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 t,r;return((t=this.info.options)==null?void 0:t.link)!==void 0&&((r=this.info.options)==null?void 0:r.link)!==null}}function M0(e){const t={name:e.name,description:e.description??"",options:e.options,metadata:e.metadata};if(e.headers){const r=e.headers;t.headers=r.toRecord()}return t}function z2(){return new ReadableStream({pull(e){e.enqueue(new Uint8Array(0)),e.close()}})}class Nl{constructor(t,r,s){C(this,"jsm");C(this,"js");C(this,"stream");C(this,"name");this.name=t,this.jsm=r,this.js=s}_checkNotEmpty(t){return!t||t.length===0?{name:t,error:new Error("name cannot be empty")}:{name:t}}async info(t){const r=await this.rawInfo(t);return r?new Ah(r):null}async list(){const t=[],r=await this.watch({ignoreDeletes:!0,includeHistory:!0});for await(const s of r){if(s===null)break;t.push(s)}return Promise.resolve(t)}async rawInfo(t){const{name:r,error:s}=this._checkNotEmpty(t);if(s)return Promise.reject(s);const l=this._metaSubject(r);try{const u=await this.jsm.streams.getMessage(this.stream,{last_by_subj:l}),f=br().decode(u.data);return f.revision=u.seq,f}catch(u){return u.code==="404"?null:Promise.reject(u)}}async _si(t){try{return await this.jsm.streams.info(this.stream,t)}catch(r){return r.code==="404"?null:Promise.reject(r)}}async seal(){let t=await this._si();return t===null?Promise.reject(new Error("object store not found")):(t.config.sealed=!0,t=await this.jsm.streams.update(this.stream,t.config),Promise.resolve(new od(t)))}async status(t){const r=await this._si(t);return r===null?Promise.reject(new Error("object store not found")):Promise.resolve(new od(r))}destroy(){return this.jsm.streams.delete(this.stream)}async _put(t,r,s){var ue;const l=this.js.getOptions();s=s||{timeout:l.timeout},s.timeout=s.timeout||l.timeout,s.previousRevision=s.previousRevision??void 0;const{timeout:u,previousRevision:c}=s,f=this.js.nc.info,m=(f==null?void 0:f.max_payload)||1024;t=t||{},t.options=t.options||{};let d=((ue=t.options)==null?void 0:ue.max_chunk_size)||128*1024;d=d>m?m:d,t.options.max_chunk_size=d;const y=await this.info(t.name),{name:g,error:x}=this._checkNotEmpty(t.name);if(x)return Promise.reject(x);const w=Ui.next(),E=this._chunkSubject(w),R=this._metaSubject(g),B=Object.assign({bucket:this.name,nuid:w,size:0,chunks:0},M0(t)),D=Ut(),P=[],F=new ga;try{const U=r?r.getReader():null,M=S0.create();for(;;){const{done:K,value:V}=U?await U.read():{done:!0,value:void 0};if(K){if(F.size()>0){const J=F.drain();M.update(J),B.chunks++,B.size+=J.length,P.push(this.js.publish(E,J,{timeout:u}))}await Promise.all(P),P.length=0,B.mtime=new Date().toISOString();const q=ca.encode(M.digest());B.digest=`${O0}${q}`,B.deleted=!1;const O=ni();typeof c=="number"&&O.set(Tr.ExpectedLastSubjectSequenceHdr,`${c}`),O.set(Sn.RollupHdr,Sn.RollupValueSubject);const X=await this.js.publish(R,br().encode(B),{headers:O,timeout:u});if(B.revision=X.seq,y)try{await this.jsm.streams.purge(this.stream,{filter:`$O.${this.name}.C.${y.nuid}`})}catch{}D.resolve(new Ah(B));break}if(V)for(F.fill(V);F.size()>d;){B.chunks++,B.size+=d;const q=F.drain(t.options.max_chunk_size);M.update(q),P.push(this.js.publish(E,q,{timeout:u}))}}}catch(U){await this.jsm.streams.purge(this.stream,{filter:E}),D.reject(U)}return D}putBlob(t,r,s){function l(u){return new ReadableStream({pull(c){c.enqueue(u),c.close()}})}return r===null&&(r=new Uint8Array(0)),this.put(t,l(r),s)}put(t,r,s){var l;return(l=t==null?void 0:t.options)!=null&&l.link?Promise.reject(new Error("link cannot be set when putting the object in bucket")):this._put(t,r,s)}async getBlob(t){async function r(u){const c=new ga,f=u.getReader();for(;;){const{done:m,value:d}=await f.read();if(m)return c.drain();d&&d.length&&c.fill(d)}}const s=await this.get(t);if(s===null)return Promise.resolve(null);const l=await Promise.all([s.error,r(s.data)]);return l[0]?Promise.reject(l[0]):Promise.resolve(l[1])}async get(t){const r=await this.rawInfo(t);if(r===null||r.deleted)return Promise.resolve(null);if(r.options&&r.options.link){const g=r.options.link.name||"";if(g==="")throw new Error("link is a bucket");return(r.options.link.bucket!==this.name?await Nl.create(this.js,r.options.link.bucket):this).get(g)}if(!r.digest.startsWith(O0))return Promise.reject(new Error(`unknown digest type: ${r.digest}`));const s=rd(r.digest.substring(8));if(s===null)return Promise.reject(new Error(`unable to parse digest: ${r.digest}`));const l=Ut(),u={info:new Ah(r),error:l};if(r.size===0)return u.data=z2(),l.resolve(null),Promise.resolve(u);let c;const f=zi();f.orderedConsumer();const m=S0.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&&(hk(s,m.digest())?c.close():c.error(new Error(`received a corrupt object, digests do not match received: ${r.digest} calculated ${s}`)),y.unsubscribe())})().then(()=>{l.resolve()}).catch(g=>{c.error(g),l.reject(g)}),u.data=new ReadableStream({start(g){c=g},cancel(){y.unsubscribe()}}),u}linkStore(t,r){if(!(r instanceof Nl))return Promise.reject("bucket required");const s=r,{name:l,error:u}=this._checkNotEmpty(t);if(u)return Promise.reject(u);const c={name:l,options:{link:{bucket:s.name}}};return this._put(c,null)}async link(t,r){const{name:s,error:l}=this._checkNotEmpty(t);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(t);if(u!==null&&!u.deleted)return Promise.reject(new Error("an object already exists with that name"));const c={bucket:r.bucket,name:r.name},f={name:s,bucket:r.bucket,options:{link:c}};await this.js.publish(this._metaSubject(t),JSON.stringify(f));const m=await this.info(t);return Promise.resolve(m)}async delete(t){const r=await this.rawInfo(t);if(r===null)return Promise.resolve({purged:0,success:!1});r.deleted=!0,r.size=0,r.chunks=0,r.digest="";const s=br(),l=ni();return l.set(Sn.RollupHdr,Sn.RollupValueSubject),await this.js.publish(this._metaSubject(r.name),s.encode(r),{headers:l}),this.jsm.streams.purge(this.stream,{filter:this._chunkSubject(r.nuid)})}async update(t,r={}){const s=await this.rawInfo(t);if(s===null)return Promise.reject(new Error("object not found"));if(s.deleted)return Promise.reject(new Error("cannot update meta for a deleted object"));r.name=r.name??s.name;const{name:l,error:u}=this._checkNotEmpty(r.name);if(u)return Promise.reject(u);if(t!==r.name){const m=await this.info(r.name);if(m&&!m.deleted)return Promise.reject(new Error("an object already exists with that name"))}r.name=l;const c=Object.assign({},s,M0(r)),f=await this.js.publish(this._metaSubject(c.name),JSON.stringify(c));return t!==r.name&&await this.jsm.streams.purge(this.stream,{filter:this._metaSubject(t)}),Promise.resolve(f)}async watch(t={}){t.includeHistory=t.includeHistory??!1,t.ignoreDeletes=t.ignoreDeletes??!1;let r=!1;const s=new an,l=this._metaSubjectAll();try{await this.jsm.streams.getMessage(this.stream,{last_by_subj:l})}catch(m){m.code==="404"?(s.push(null),r=!0):s.stop(m)}const u=br(),c=zi();c.orderedConsumer(),t.includeHistory?c.deliverLastPerSubject():(r=!0,c.deliverNew()),c.callback((m,d)=>{var y;if(m){s.stop(m);return}if(d!==null){const g=u.decode(d.data);g.deleted&&t.ignoreDeletes===!0||s.push(g),((y=d.info)==null?void 0:y.pending)===0&&!r&&(r=!0,s.push(null))}});const f=await this.js.subscribe(l,c);return s._data=f,s.iterClosed.then(()=>{f.unsubscribe()}),f.closed.then(()=>{s.stop()}).catch(m=>{s.stop(m)}),s}_chunkSubject(t){return`$O.${this.name}.C.${t}`}_metaSubject(t){return`$O.${this.name}.M.${ca.encode(t)}`}_metaSubjectAll(){return`$O.${this.name}.M.>`}async init(t={}){try{this.stream=E2(this.name)}catch(l){return Promise.reject(l)}const r=(t==null?void 0:t.ttl)||0;delete t.ttl;const s=Object.assign({max_age:r},t);s.name=this.stream,s.num_replicas=t.replicas??1,s.allow_direct=!0,s.allow_rollup_hdrs=!0,s.discard=zl.New,s.subjects=[`$O.${this.name}.C.>`,`$O.${this.name}.M.>`],t.placement&&(s.placement=t.placement),t.metadata&&(s.metadata=t.metadata),typeof t.compression=="boolean"&&(s.compression=t.compression?Bi.S2:Bi.None);try{await this.jsm.streams.info(s.name)}catch(l){l.message==="stream not found"&&await this.jsm.streams.add(s)}}static async create(t,r,s={}){const l=await t.jetstreamManager(),u=new Nl(r,l,t);return await u.init(s),Promise.resolve(u)}}class U2{constructor(t){C(this,"js");this.js=t}kv(t,r={}){const s=this.js,{ok:l,min:u}=s.nc.features.get(ut.JS_KV);return l?r.bindOnly?Bl.bind(this.js,t,r):Bl.create(this.js,t,r):Promise.reject(new Error(`kv is only supported on servers ${u} or better`))}os(t,r={}){var c;if(typeof((c=crypto==null?void 0:crypto.subtle)==null?void 0:c.digest)!="function")return Promise.reject(new Error("objectstore: unable to calculate hashes - crypto.subtle.digest with sha256 support is required"));const s=this.js,{ok:l,min:u}=s.nc.features.get(ut.JS_OBJECTSTORE);return l?Nl.create(this.js,t,r):Promise.reject(new Error(`objectstore is only supported on servers ${u} or better`))}}class Bd extends $l{constructor(r,s){super(r,s);C(this,"consumers");C(this,"streams");C(this,"consumerAPI");C(this,"streamAPI");this.consumerAPI=new Ru(r,s),this.streamAPI=new Ud(r,s),this.consumers=new cd(this.consumerAPI),this.streams=new L2(this.streamAPI)}jetstreamManager(r){r===void 0&&(r=this.opts.checkAPI);const s=Object.assign({},this.opts,{checkAPI:r});return this.nc.jetstreamManager(s)}get apiPrefix(){return this.prefix}get views(){return new U2(this)}async publish(r,s=Gn,l){l=l||{},l.expect=l.expect||{};const u=(l==null?void 0:l.headers)||ni();l&&(l.msgID&&u.set(Tr.MsgIdHdr,l.msgID),l.expect.lastMsgID&&u.set(Tr.ExpectedLastMsgIdHdr,l.expect.lastMsgID),l.expect.streamName&&u.set(Tr.ExpectedStreamHdr,l.expect.streamName),typeof l.expect.lastSequence=="number"&&u.set(Tr.ExpectedLastSeqHdr,`${l.expect.lastSequence}`),typeof l.expect.lastSubjectSequence=="number"&&u.set(Tr.ExpectedLastSubjectSequenceHdr,`${l.expect.lastSubjectSequence}`));const c=l.timeout||this.timeout,f={};c&&(f.timeout=c),l&&(f.headers=u);let{retries:m,retry_delay:d}=l;m=m||1,d=d||250;let y;for(let x=0;x<m;x++)try{y=await this.nc.request(r,s,f);break}catch(w){if(w.code==="503"&&x+1<m)await Sa(d);else throw w}const g=this.parseJsResponse(y);if(g.stream==="")throw Oe.errorForCode(Se.JetStreamInvalidAck);return g.duplicate=g.duplicate?g.duplicate:!1,g}async pull(r,s,l=0){bn(r),oa(s);let u=this.timeout;l>u&&(u=l),l=l<0?0:zt(l);const c={batch:1,no_wait:l===0,expires:l},f=await this.nc.request(`${this.prefix}.CONSUMER.MSG.NEXT.${r}.${s}`,this.jc.encode(c),{noMux:!0,timeout:u}),m=ua(f);if(m)throw m;return Pl(f,this.timeout)}fetch(r,s,l={}){bn(r),oa(s);let u=null;const c=(l.max_bytes??0)>0;let f=0;const m=c?l.max_bytes:0;let d=null;const y={};if(y.batch=l.batch||1,m){const P=this.nc.features.get(ut.JS_PULL_MAX_BYTES);if(!P.ok)throw new Error(`max_bytes is only supported on servers ${P.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=zt(g)),g===0&&y.no_wait===!1)throw new Error("expires or no_wait is required");const x=l.idle_heartbeat||0;x&&(y.idle_heartbeat=zt(x),l.delay_heartbeat===!0&&(y.idle_heartbeat=zt(x*4)));const w=new an,E=y.batch;let R=0;w.protocolFilterFn=(P,F=!1)=>ed(P.msg)?(d==null||d.work(),!1):!0,w.dispatchedFn=P=>{if(P){if(c&&(f+=P.data.length),R++,u&&P.info.pending===0)return;(w.getPending()===1&&P.info.pending===0||E===R||m>0&&f>=m)&&w.stop()}};const B=ei(this.nc.options.inboxPrefix),D=this.nc.subscribe(B,{max:l.batch,callback:(P,F)=>{P===null&&(P=ua(F)),P!==null?(u&&(u.cancel(),u=null),V_(P)?w.stop(jx(P)===null?void 0:P):w.stop(P)):(d==null||d.work(),w.received++,w.push(Pl(F,this.timeout)))}});return g&&(u=ma(g),u.catch(()=>{D.isClosed()||(D.drain().catch(()=>{}),u=null),d&&d.cancel()})),(async()=>{try{x&&(d=new Ld(x,P=>(w.push(()=>{w.err=new Oe(`${ar.IdleHeartbeatMissed}: ${P}`,Se.JetStreamIdleHeartBeat)}),!0)))}catch{}await D.closed,u!==null&&(u.cancel(),u=null),d&&d.cancel(),w.stop()})().catch(),this.nc.publish(`${this.prefix}.CONSUMER.MSG.NEXT.${r}.${s}`,this.jc.encode(y),{reply:B}),w}async pullSubscribe(r,s=zi()){const l=await this._processOptions(r,s);if(l.ordered)throw new Error("pull subscribers cannot be be ordered");if(l.config.deliver_subject)throw new Error("consumer info specifies deliver_subject - pull consumers cannot have deliver_subject set");const u=l.config.ack_policy;if(u===sn.None||u===sn.All)throw new Error("ack policy for pull consumers must be explicit");const c=this._buildTypedSubscriptionOpts(l),f=new H2(this,l.deliver,c);f.info=l;try{await this._maybeCreateConsumer(l)}catch(m){throw f.unsubscribe(),m}return f}async subscribe(r,s=zi()){const l=await this._processOptions(r,s);if(!l.isBind&&!l.config.deliver_subject)throw new Error("push consumer requires deliver_subject");const u=this._buildTypedSubscriptionOpts(l),c=new Tx(this,l.deliver,u);c.info=l;try{await this._maybeCreateConsumer(l)}catch(f){throw c.unsubscribe(),f}return c._maybeSetupHbMonitoring(),c}async _processOptions(r,s=zi()){const l=b0(s)?s.getOpts():s;if(l.isBind=b0(s)?s.isBind:!1,l.flow_control={heartbeat_count:0,fc_count:0,consumer_restarts:0},l.ordered){if(l.ordered_consumer_sequence={stream_seq:0,delivery_seq:0},l.config.ack_policy!==sn.NotSet&&l.config.ack_policy!==sn.None)throw new Oe("ordered consumer: ack_policy can only be set to 'none'",Se.ApiError);if(l.config.durable_name&&l.config.durable_name.length>0)throw new Oe("ordered consumer: durable_name cannot be set",Se.ApiError);if(l.config.deliver_subject&&l.config.deliver_subject.length>0)throw new Oe("ordered consumer: deliver_subject cannot be set",Se.ApiError);if(l.config.max_deliver!==void 0&&l.config.max_deliver>1)throw new Oe("ordered consumer: max_deliver cannot be set",Se.ApiError);if(l.config.deliver_group&&l.config.deliver_group.length>0)throw new Oe("ordered consumer: deliver_group cannot be set",Se.ApiError);l.config.deliver_subject=ei(this.nc.options.inboxPrefix),l.config.ack_policy=sn.None,l.config.max_deliver=1,l.config.flow_control=!0,l.config.idle_heartbeat=l.config.idle_heartbeat||zt(5e3),l.config.ack_wait=zt(1320*60*1e3),l.config.mem_storage=!0,l.config.num_replicas=1}if(l.config.ack_policy===sn.NotSet&&(l.config.ack_policy=sn.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||ei(this.nc.options.inboxPrefix),l}_buildTypedSubscriptionOpts(r){const s={};return s.adapter=I2(r.callbackFn===void 0,this.timeout),s.ingestionFilterFn=Bd.ingestionFn(r.ordered),s.protocolFilterFn=(l,u=!1)=>{const c=l;return Wh(c.msg)?(u||c.msg.respond(),!1):!0},!r.mack&&r.config.ack_policy!==sn.None&&(s.dispatchedFn=Y2),r.callbackFn&&(s.callback=r.callbackFn),s.max=r.max||0,s.queue=r.queue,s}async _maybeCreateConsumer(r){if(r.attached)return;if(r.isBind)throw new Error(`unable to bind - durable consumer ${r.config.durable_name} doesn't exist in ${r.stream}`);r.config=Object.assign({deliver_policy:Vt.All,ack_policy:sn.Explicit,ack_wait:zt(30*1e3),replay_policy:pa.Instant},r.config);const s=await this.consumerAPI.add(r.stream,r.config);if(Array.isArray(r.config.filter_subjects&&!Array.isArray(s.config.filter_subjects)))throw new Error("jetstream server doesn't support consumers with multiple filter subjects");r.name=s.name,r.config=s.config,r.last=s}static ingestionFn(r){return(s,l)=>{var m;const u=l;if(!s)return{ingest:!1,protocol:!1};const c=s;if(ua(c.msg)||(m=u.monitor)==null||m.work(),ed(c.msg)){const d=r?u._checkHbOrderConsumer(c.msg):!0;return r||u.info.flow_control.heartbeat_count++,{ingest:d,protocol:!0}}else if(Wh(c.msg))return u.info.flow_control.fc_count++,{ingest:!0,protocol:!0};return{ingest:r?u._checkOrderedConsumer(s):!0,protocol:!1}}}}class Pd{constructor(t){C(this,"options");C(this,"protocol");C(this,"draining");C(this,"listeners");C(this,"_services");this.draining=!1,this.options=a2(t),this.listeners=[]}static connect(t={}){return new Promise((r,s)=>{const l=new Pd(t);Lu.connect(l.options,l).then(u=>{l.protocol=u,(async function(){for await(const c of u.status())l.listeners.forEach(f=>{f.push(c)})})(),r(l)}).catch(u=>{s(u)})})}closed(){return this.protocol.closed}async close(){await this.protocol.close()}_check(t,r,s){if(this.isClosed())throw Oe.errorForCode(Se.ConnectionClosed);if(r&&this.isDraining()||s&&this.protocol.noMorePublishing)throw Oe.errorForCode(Se.ConnectionDraining);if(t=t||"",t.length===0)throw Oe.errorForCode(Se.BadSubject)}publish(t,r,s){this._check(t,!1,!0),this.protocol.publish(t,r,s)}publishMessage(t){return this.publish(t.subject,t.data,{reply:t.reply,headers:t.headers})}respondMessage(t){return t.reply?(this.publish(t.reply,t.data,{reply:t.reply,headers:t.headers}),!0):!1}subscribe(t,r={}){this._check(t,!0,!1);const s=new kx(this.protocol,t,r);return this.protocol.subscribe(s),s}_resub(t,r,s){this._check(r,!0,!1);const l=t;l.max=s,s&&(l.max=s+l.received),this.protocol.resub(l,r)}requestMany(t,r=Gn,s={maxWait:1e3,maxMessages:-1}){const l=!this.protocol.options.noAsyncTraces;try{this._check(t,!0,!0)}catch(m){return Promise.reject(m)}if(s.strategy=s.strategy||yr.Timer,s.maxWait=s.maxWait||1e3,s.maxWait<1)return Promise.reject(new Oe("timeout",Se.InvalidOption));const u=new an;function c(m){u.push(()=>{u.stop(m)})}function f(m,d){m||d===null?c(m===null?void 0:m):u.push(d)}if(s.noMux){const m=l?new Error().stack:null;let d=typeof s.maxMessages=="number"&&s.maxMessages>0?s.maxMessages:-1;const y=this.subscribe(ei(this.options.inboxPrefix),{callback:(E,R)=>{var B,D;if(((B=R==null?void 0:R.data)==null?void 0:B.length)===0&&((D=R==null?void 0:R.headers)==null?void 0:D.status)===Se.NoResponders&&(E=Oe.errorForCode(Se.NoResponders)),E){m&&(E.stack+=`
|
|
82
|
-
|
|
83
|
-
${m}`),g(E);return}f(null,R),s.strategy===yr.Count&&(d--,d===0&&g()),s.strategy===yr.JitterTimer&&(w(),x=setTimeout(()=>{g()},300)),s.strategy===yr.SentinelMsg&&R&&R.data.length===0&&g()}});y.requestSubject=t,y.closed.then(()=>{c()}).catch(E=>{u.stop(E)});const g=E=>{E&&u.push(()=>{throw E}),w(),y.drain().then(()=>{c()}).catch(R=>{c()})};u.iterClosed.then(()=>{w(),y==null||y.unsubscribe()}).catch(E=>{w(),y==null||y.unsubscribe()});try{this.publish(t,r,{reply:y.getSubject()})}catch(E){g(E)}let x=setTimeout(()=>{g()},s.maxWait);const w=()=>{x&&clearTimeout(x)}}else{const m=s;m.callback=f,u.iterClosed.then(()=>{d.cancel()}).catch(y=>{d.cancel(y)});const d=new dk(this.protocol.muxSubscriptions,t,m);this.protocol.request(d);try{this.publish(t,r,{reply:`${this.protocol.muxSubscriptions.baseInbox}${d.token}`,headers:s.headers})}catch(y){d.cancel(y)}}return Promise.resolve(u)}request(t,r,s={timeout:1e3,noMux:!1}){try{this._check(t,!0,!0)}catch(u){return Promise.reject(u)}const l=!this.protocol.options.noAsyncTraces;if(s.timeout=s.timeout||1e3,s.timeout<1)return Promise.reject(new Oe("timeout",Se.InvalidOption));if(!s.noMux&&s.reply)return Promise.reject(new Oe("reply can only be used with noMux",Se.InvalidOption));if(s.noMux){const u=s.reply?s.reply:ei(this.options.inboxPrefix),c=Ut(),f=l?new Error:null,m=this.subscribe(u,{max:1,timeout:s.timeout,callback:(d,y)=>{d?(f&&d.code!==Se.Timeout&&(d.stack+=`
|
|
84
|
-
|
|
85
|
-
${f.stack}`),m.unsubscribe(),c.reject(d)):(d=hx(y),d?(f&&(d.stack+=`
|
|
86
|
-
|
|
87
|
-
${f.stack}`),c.reject(d)):c.resolve(y))}});return m.requestSubject=t,this.protocol.publish(t,r,{reply:u,headers:s.headers}),c}else{const u=new px(this.protocol.muxSubscriptions,t,s,l);this.protocol.request(u);try{this.publish(t,r,{reply:`${this.protocol.muxSubscriptions.baseInbox}${u.token}`,headers:s.headers})}catch(f){u.cancel(f)}const c=Promise.race([u.timer,u.deferred]);return c.catch(()=>{u.cancel()}),c}}flush(){return this.isClosed()?Promise.reject(Oe.errorForCode(Se.ConnectionClosed)):this.protocol.flush()}drain(){return this.isClosed()?Promise.reject(Oe.errorForCode(Se.ConnectionClosed)):this.isDraining()?Promise.reject(Oe.errorForCode(Se.ConnectionDraining)):(this.draining=!0,this.protocol.drain())}isClosed(){return this.protocol.isClosed()}isDraining(){return this.draining}getServer(){const t=this.protocol.getServer();return t?t.listen:""}status(){const t=new an;return t.iterClosed.then(()=>{const r=this.listeners.indexOf(t);this.listeners.splice(r,1)}),this.listeners.push(t),t}get info(){return this.protocol.isClosed()?void 0:this.protocol.info}async context(){return(await this.request("$SYS.REQ.USER.INFO")).json((r,s)=>r==="time"?new Date(Date.parse(s)):s)}stats(){return{inBytes:this.protocol.inBytes,outBytes:this.protocol.outBytes,inMsgs:this.protocol.inMsgs,outMsgs:this.protocol.outMsgs}}async jetstreamManager(t={}){const r=new D2(this,t);if(t.checkAPI!==!1)try{await r.getAccountInfo()}catch(s){const l=s;throw l.code===Se.NoResponders&&(l.code=Se.JetStreamNotEnabled),l}return r}jetstream(t={}){return new Bd(this,t)}getServerVersion(){const t=this.info;return t?ds(t.version):void 0}async rtt(){if(!this.protocol._closed&&!this.protocol.connected)throw Oe.errorForCode(Se.Disconnect);const t=Date.now();return await this.flush(),Date.now()-t}get features(){return this.protocol.features}get services(){return this._services||(this._services=new B2(this)),this._services}reconnect(){return this.isClosed()?Promise.reject(Oe.errorForCode(Se.ConnectionClosed)):this.isDraining()?Promise.reject(Oe.errorForCode(Se.ConnectionDraining)):this.protocol.reconnect()}}class B2{constructor(t){C(this,"nc");this.nc=t}add(t){try{return new Yl(this.nc,t).start()}catch(r){return Promise.reject(r)}}client(t,r){return new y2(this.nc,t,r)}}class P2{constructor(t,r,s){C(this,"bucket");C(this,"sm");C(this,"prefixLen");this.bucket=t,this.prefixLen=r,this.sm=s}get key(){return this.sm.subject.substring(this.prefixLen)}get value(){return this.sm.data}get delta(){return 0}get created(){return this.sm.time}get revision(){return this.sm.seq}get operation(){return this.sm.header.get(zu)||"PUT"}get length(){const t=this.sm.header.get(Sn.MessageSizeHdr)||"";return t!==""?parseInt(t,10):this.sm.data.length}json(){return this.sm.json()}string(){return this.sm.string()}}class q2{constructor(t,r,s){C(this,"bucket");C(this,"key");C(this,"sm");this.bucket=t,this.key=r,this.sm=s}get value(){return this.sm.data}get created(){return new Date(Md(this.sm.info.timestampNanos))}get revision(){return this.sm.seq}get operation(){var t;return((t=this.sm.headers)==null?void 0:t.get(zu))||"PUT"}get delta(){return this.sm.info.pending}get length(){var r;const t=((r=this.sm.headers)==null?void 0:r.get(Sn.MessageSizeHdr))||"";return t!==""?parseInt(t,10):this.sm.data.length}json(){return this.sm.json()}string(){return this.sm.string()}}class Tx extends yk{constructor(r,s,l){super(r.nc,s,l);C(this,"js");C(this,"monitor");this.js=r,this.monitor=null,this.sub.closed.then(()=>{this.monitor&&this.monitor.cancel()})}set info(r){this.sub.info=r}get info(){return this.sub.info}_resetOrderedConsumer(r){if(this.info===null||this.sub.isClosed())return;const s=ei(this.js.nc.options.inboxPrefix);this.js.nc._resub(this.sub,s);const u=this.info;u.config.name=Ui.next(),u.ordered_consumer_sequence.delivery_seq=0,u.flow_control.heartbeat_count=0,u.flow_control.fc_count=0,u.flow_control.consumer_restarts++,u.deliver=s,u.config.deliver_subject=s,u.config.deliver_policy=Vt.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 Oe(`unable to recreate ordered consumer ${u.stream} at seq ${r}`,Se.RequestError,m);this.sub.callback(d,{})})}_maybeSetupHbMonitoring(){var s,l;const r=((l=(s=this.info)==null?void 0:s.config)==null?void 0:l.idle_heartbeat)||0;r&&this._setupHbMonitoring(Md(r))}_setupHbMonitoring(r,s=0){const l={cancelAfter:0,maxOut:2};s&&(l.cancelAfter=s);const u=this.sub,c=f=>{var y,g,x,w;const m=Q_(409,`${ar.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 E=((x=(g=this.info)==null?void 0:g.ordered_consumer_sequence)==null?void 0:x.stream_seq)||0;return this._resetOrderedConsumer(E+1),(w=this.monitor)==null||w.restart(),!1}return!u.noIterator};this.monitor=new Ld(r,c,l)}_checkHbOrderConsumer(r){const s=r.headers.get(Sn.ConsumerStalledHdr);s!==""&&this.js.nc.publish(s);const l=parseInt(r.headers.get(Sn.LastConsumerSeqHdr),10),u=this.info.ordered_consumer_sequence;return this.info.flow_control.heartbeat_count++,l!==u.delivery_seq&&this._resetOrderedConsumer(u.stream_seq+1),!1}_checkOrderedConsumer(r){const s=this.info.ordered_consumer_sequence,l=r.info.streamSequence,u=r.info.deliverySequence;return u!=s.delivery_seq+1?(this._resetOrderedConsumer(s.stream_seq+1),!1):(s.delivery_seq=u,s.stream_seq=l,!0)}async destroy(){this.isClosed()||await this.drain();const r=this.sub.info,s=r.config.durable_name||r.name,l=`${r.api.prefix}.CONSUMER.DELETE.${r.stream}.${s}`;await r.api._request(l)}async consumerInfo(){const r=this.sub.info,s=r.config.durable_name||r.name,l=`${r.api.prefix}.CONSUMER.INFO.${r.stream}.${s}`,u=await r.api._request(l);return r.last=u,u}}class H2 extends Tx{constructor(t,r,s){super(t,r,s)}pull(t={batch:1}){const{stream:r,config:s,name:l}=this.sub.info,u=s.durable_name??l,c={};if(c.batch=t.batch||1,c.no_wait=t.no_wait||!1,(t.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=t.max_bytes}let f=0;t.expires&&t.expires>0&&(f=t.expires,c.expires=zt(f));let m=0;if(t.idle_heartbeat&&t.idle_heartbeat>0&&(m=t.idle_heartbeat,c.idle_heartbeat=zt(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 I2(e,t){return e?$2(t):F2(t)}function F2(e){return(t,r)=>t?[t,null]:(t=ua(r),t?[t,null]:[null,Pl(r,e)])}function $2(e){return(t,r)=>{if(t)return[t,null];const s=ua(r);return s!==null?[jx(s),null]:[null,Pl(r,e)]}}function jx(e){if(e!==null)switch(e.code){case Se.JetStream404NoMessages:case Se.JetStream408RequestTimeout:return null;case Se.JetStream409:return Z_(e)?e:null;default:return e}return null}function Y2(e){e&&e.ack()}function G2(e){const t=e.split(".");if(t.length===9&&t.splice(2,0,"_",""),t.length<11||t[0]!=="$JS"||t[1]!=="ACK")throw new Error("not js message");const r={};return r.domain=t[2]==="_"?"":t[2],r.account_hash=t[3],r.stream=t[4],r.consumer=t[5],r.deliveryCount=parseInt(t[6],10),r.redeliveryCount=r.deliveryCount,r.redelivered=r.deliveryCount>1,r.streamSequence=parseInt(t[7],10),r.deliverySequence=parseInt(t[8],10),r.timestampNanos=parseInt(t[9],10),r.pending=parseInt(t[10],10),r}class V2{constructor(t,r){C(this,"msg");C(this,"di");C(this,"didAck");C(this,"timeout");this.msg=t,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=G2(this.reply)),this.di}get redelivered(){return this.info.deliveryCount>1}get reply(){return this.msg.reply||""}get seq(){return this.info.streamSequence}doAck(t){this.didAck||(this.didAck=!this.isWIP(t),this.msg.respond(t))}isWIP(t){return t.length===4&&t[0]===xl[0]&&t[1]===xl[1]&&t[2]===xl[2]&&t[3]===xl[3]}async ackAck(t){var s;t=t||{},t.timeout=t.timeout||this.timeout;const r=Ut();if(this.didAck)r.resolve(!1);else if(this.didAck=!0,this.msg.reply){const u=this.msg.publisher,c=!((s=u.options)!=null&&s.noAsyncTraces),f=new px(u.muxSubscriptions,this.msg.reply,{timeout:t.timeout},c);u.request(f);try{u.publish(this.msg.reply,R0,{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(R0)}nak(t){let r=A2;t&&(r=Nu().encode(`-NAK ${JSON.stringify({delay:zt(t)})}`)),this.doAck(r)}working(){this.doAck(xl)}next(t,r={batch:1}){const s={};s.batch=r.batch||1,s.no_wait=r.no_wait||!1,r.expires&&r.expires>0&&(s.expires=zt(r.expires));const l=br().encode(s),u=ga.concat(T2,N2,l),c=t?{reply:t}:void 0;this.msg.respond(u,c)}term(t=""){let r=j2;(t==null?void 0:t.length)>0&&(r=Nu().encode(`+TERM ${t}`)),this.doAck(r)}json(){return this.msg.json()}string(){return this.msg.string()}}const J2="1.30.3",X2="nats.ws";class K2{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=J2,this.lang=X2,this.connected=!1,this.done=!1,this.socketClosed=!1,this.encrypted=!1,this.peeked=!1,this.yields=[],this.signal=Ut(),this.closedNotification=Ut()}async connect(t,r){const s=Ut();if(r.tls)return s.reject(new Oe("tls",Se.InvalidOption)),s;this.options=r;const l=t.src;if(r.wsFactory){const{socket:u,encrypted:c}=await r.wsFactory(t.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=ga.concat(...this.yields),f=_k(c);if(f!==""){const m=u2.exec(f);if(!m){r.debug&&console.error("!!!",cu(c)),s.reject(new Error("unexpected response from server"));return}try{const d=JSON.parse(m[1]);l2(d,this.options),this.peeked=!0,this.connected=!0,this.signal.resolve(),s.resolve()}catch(d){s.reject(d);return}}},this.socket.onclose=u=>{if(this.isDiscarded())return;this.socketClosed=!0;let c;this.done||(u.wasClean||(c=new Error(u.reason)),this._closed(c))},this.socket.onerror=u=>{if(this.isDiscarded())return;const c=u,f=new Oe(c.message,Se.Unknown,new Error(c.error));s.reject(f)},s}disconnect(){this._closed(void 0,!0)}async _closed(t,r=!0){if(!this.isDiscarded()&&this.connected&&!this.done){if(this.closeError=t,!t)for(;!this.socketClosed&&this.socket.bufferedAmount>0;)await Sa(100);this.done=!0;try{this.socket.close(t?1002:1e3,t?t.message:void 0)}catch{}r&&this.closedNotification.resolve(t)}}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 t=this.yields;this.yields=[];for(let r=0;r<t.length;r++)this.options.debug&&console.info(`> ${cu(t[r])}`),yield t[r];if(this.done)break;this.yields.length===0&&(t.length=0,this.yields=t,this.signal=Ut())}}isEncrypted(){return this.connected&&this.encrypted}send(t){if(!this.isDiscarded())try{this.socket.send(t.buffer),this.options.debug&&console.info(`< ${cu(t)}`);return}catch(r){this.options.debug&&console.error(`!!! ${cu(t)}: ${r}`)}}close(t){return this._closed(t,!1)}closed(){return this.closedNotification}isDiscarded(){return this.done?(this.discard(),!0):!1}discard(){var t;this.done=!0;try{(t=this.socket)==null||t.close()}catch{}}}function Q2(e,t){/^(.*:\/\/)(.*)/.test(e)||(typeof t=="boolean"?e=`${t===!0?"https":"http"}://${e}`:e=`https://${e}`);let s=new URL(e);const l=s.protocol.toLowerCase();l==="ws:"&&(t=!1),l==="wss:"&&(t=!0),l!=="https:"&&l!=="http"&&(e=e.replace(/^(.*:\/\/)(.*)/gm,"$2"),s=new URL(`http://${e}`));let u,c;const f=s.hostname,m=s.pathname,d=s.search||"";switch(l){case"http:":case"ws:":case"nats:":c=s.port||"80",u="ws:";break;case"https:":case"wss:":case"tls:":c=s.port||"443",u="wss:";break;default:c=s.port||t===!0?"443":"80",u=t===!0?"wss:":"ws:";break}return`${u}//${f}:${c}${m}${d}`}function Nx(e={}){return bk({defaultPort:443,urlParseFn:Q2,factory:()=>new K2}),Pd.connect(e)}/*! Capacitor: https://capacitorjs.com/ - MIT License */var ya;(function(e){e.Unimplemented="UNIMPLEMENTED",e.Unavailable="UNAVAILABLE"})(ya||(ya={}));class Th extends Error{constructor(t,r,s){super(t),this.message=t,this.code=r,this.data=s}}const Z2=e=>{var t,r;return e!=null&&e.androidBridge?"android":!((r=(t=e==null?void 0:e.webkit)===null||t===void 0?void 0:t.messageHandlers)===null||r===void 0)&&r.bridge?"ios":"web"},W2=e=>{const t=e.CapacitorCustomPlatform||null,r=e.Capacitor||{},s=r.Plugins=r.Plugins||{},l=()=>t!==null?t.name:Z2(e),u=()=>l()!=="web",c=g=>{const x=d.get(g);return!!(x!=null&&x.platforms.has(l())||f(g))},f=g=>{var x;return(x=r.PluginHeaders)===null||x===void 0?void 0:x.find(w=>w.name===g)},m=g=>e.console.error(g),d=new Map,y=(g,x={})=>{const w=d.get(g);if(w)return console.warn(`Capacitor plugin "${g}" already registered. Cannot register plugins twice.`),w.proxy;const E=l(),R=f(g);let B;const D=async()=>(!B&&E in x?B=typeof x[E]=="function"?B=await x[E]():B=x[E]:t!==null&&!B&&"web"in x&&(B=typeof x.web=="function"?B=await x.web():B=x.web),B),P=(V,q)=>{var O,X;if(R){const J=R==null?void 0:R.methods.find(le=>q===le.name);if(J)return J.rtype==="promise"?le=>r.nativePromise(g,q.toString(),le):(le,te)=>r.nativeCallback(g,q.toString(),le,te);if(V)return(O=V[q])===null||O===void 0?void 0:O.bind(V)}else{if(V)return(X=V[q])===null||X===void 0?void 0:X.bind(V);throw new Th(`"${g}" plugin is not implemented on ${E}`,ya.Unimplemented)}},F=V=>{let q;const O=(...X)=>{const J=D().then(le=>{const te=P(le,V);if(te){const $=te(...X);return q=$==null?void 0:$.remove,$}else throw new Th(`"${g}.${V}()" is not implemented on ${E}`,ya.Unimplemented)});return V==="addListener"&&(J.remove=async()=>q()),J};return O.toString=()=>`${V.toString()}() { [capacitor code] }`,Object.defineProperty(O,"name",{value:V,writable:!1,configurable:!1}),O},ue=F("addListener"),U=F("removeListener"),M=(V,q)=>{const O=ue({eventName:V},q),X=async()=>{const le=await O;U({eventName:V,callbackId:le},q)},J=new Promise(le=>O.then(()=>le({remove:X})));return J.remove=async()=>{console.warn("Using addListener() without 'await' is deprecated."),await X()},J},K=new Proxy({},{get(V,q){switch(q){case"$$typeof":return;case"toJSON":return()=>({});case"addListener":return R?M:ue;case"removeListener":return U;default:return F(q)}}});return s[g]=K,d.set(g,{name:g,proxy:K,platforms:new Set([...Object.keys(x),...R?[E]:[]])}),K};return r.convertFileSrc||(r.convertFileSrc=g=>g),r.getPlatform=l,r.handleError=m,r.isNativePlatform=u,r.isPluginAvailable=c,r.registerPlugin=y,r.Exception=Th,r.DEBUG=!!r.DEBUG,r.isLoggingEnabled=!!r.isLoggingEnabled,r},eE=e=>e.Capacitor=W2(e),Vn=eE(typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}),gs=Vn.registerPlugin;class qd{constructor(){this.listeners={},this.retainedEventArguments={},this.windowListeners={}}addListener(t,r){let s=!1;this.listeners[t]||(this.listeners[t]=[],s=!0),this.listeners[t].push(r);const u=this.windowListeners[t];u&&!u.registered&&this.addWindowListener(u),s&&this.sendRetainedArgumentsForEvent(t);const c=async()=>this.removeListener(t,r);return Promise.resolve({remove:c})}async removeAllListeners(){this.listeners={};for(const t in this.windowListeners)this.removeWindowListener(this.windowListeners[t]);this.windowListeners={}}notifyListeners(t,r,s){const l=this.listeners[t];if(!l){if(s){let u=this.retainedEventArguments[t];u||(u=[]),u.push(r),this.retainedEventArguments[t]=u}return}l.forEach(u=>u(r))}hasListeners(t){var r;return!!(!((r=this.listeners[t])===null||r===void 0)&&r.length)}registerWindowListener(t,r){this.windowListeners[r]={registered:!1,windowEventName:t,pluginEventName:r,handler:s=>{this.notifyListeners(r,s)}}}unimplemented(t="not implemented"){return new Vn.Exception(t,ya.Unimplemented)}unavailable(t="not available"){return new Vn.Exception(t,ya.Unavailable)}async removeListener(t,r){const s=this.listeners[t];if(!s)return;const l=s.indexOf(r);this.listeners[t].splice(l,1),this.listeners[t].length||this.removeWindowListener(this.windowListeners[t])}addWindowListener(t){window.addEventListener(t.windowEventName,t.handler),t.registered=!0}removeWindowListener(t){t&&(window.removeEventListener(t.windowEventName,t.handler),t.registered=!1)}sendRetainedArgumentsForEvent(t){const r=this.retainedEventArguments[t];r&&(delete this.retainedEventArguments[t],r.forEach(s=>{this.notifyListeners(t,s)}))}}const D0=e=>encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape),L0=e=>e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent);class tE extends qd{async getCookies(){const t=document.cookie,r={};return t.split(";").forEach(s=>{if(s.length<=0)return;let[l,u]=s.replace(/=/,"CAP_COOKIE").split("CAP_COOKIE");l=L0(l).trim(),u=L0(u).trim(),r[l]=u}),r}async setCookie(t){try{const r=D0(t.key),s=D0(t.value),l=t.expires?`; expires=${t.expires.replace("expires=","")}`:"",u=(t.path||"/").replace("path=",""),c=t.url!=null&&t.url.length>0?`domain=${t.url}`:"";document.cookie=`${r}=${s||""}${l}; path=${u}; ${c};`}catch(r){return Promise.reject(r)}}async deleteCookie(t){try{document.cookie=`${t.key}=; Max-Age=0`}catch(r){return Promise.reject(r)}}async clearCookies(){try{const t=document.cookie.split(";")||[];for(const r of t)document.cookie=r.replace(/^ +/,"").replace(/=.*/,`=;expires=${new Date().toUTCString()};path=/`)}catch(t){return Promise.reject(t)}}async clearAllCookies(){try{await this.clearCookies()}catch(t){return Promise.reject(t)}}}gs("CapacitorCookies",{web:()=>new tE});const nE=async e=>new Promise((t,r)=>{const s=new FileReader;s.onload=()=>{const l=s.result;t(l.indexOf(",")>=0?l.split(",")[1]:l)},s.onerror=l=>r(l),s.readAsDataURL(e)}),rE=(e={})=>{const t=Object.keys(e);return Object.keys(e).map(l=>l.toLocaleLowerCase()).reduce((l,u,c)=>(l[u]=e[t[c]],l),{})},iE=(e,t=!0)=>e?Object.entries(e).reduce((s,l)=>{const[u,c]=l;let f,m;return Array.isArray(c)?(m="",c.forEach(d=>{f=t?encodeURIComponent(d):d,m+=`${u}=${f}&`}),m.slice(0,-1)):(f=t?encodeURIComponent(c):c,m=`${u}=${f}`),`${s}&${m}`},"").substr(1):null,sE=(e,t={})=>{const r=Object.assign({method:e.method||"GET",headers:e.headers},t),l=rE(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 aE extends qd{async request(t){const r=sE(t,t.webFetchExtra),s=iE(t.params,t.shouldEncodeUrlParams),l=s?`${t.url}?${s}`:t.url,u=await fetch(l,r),c=u.headers.get("content-type")||"";let{responseType:f="text"}=u.ok?t:{};c.includes("application/json")&&(f="json");let m,d;switch(f){case"arraybuffer":case"blob":d=await u.blob(),m=await nE(d);break;case"json":m=await u.json();break;case"document":case"text":default:m=await u.text()}const y={};return u.headers.forEach((g,x)=>{y[x]=g}),{data:m,headers:y,status:u.status,url:u.url}}async get(t){return this.request(Object.assign(Object.assign({},t),{method:"GET"}))}async post(t){return this.request(Object.assign(Object.assign({},t),{method:"POST"}))}async put(t){return this.request(Object.assign(Object.assign({},t),{method:"PUT"}))}async patch(t){return this.request(Object.assign(Object.assign({},t),{method:"PATCH"}))}async delete(t){return this.request(Object.assign(Object.assign({},t),{method:"DELETE"}))}}gs("CapacitorHttp",{web:()=>new aE});var z0;(function(e){e.Dark="DARK",e.Light="LIGHT",e.Default="DEFAULT"})(z0||(z0={}));var U0;(function(e){e.StatusBar="StatusBar",e.NavigationBar="NavigationBar"})(U0||(U0={}));class lE extends qd{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")}}gs("SystemBars",{web:()=>new lE});const oE="modulepreload",uE=function(e){return"/"+e},B0={},Hd=function(t,r,s){let l=Promise.resolve();if(r&&r.length>0){let c=function(d){return Promise.all(d.map(y=>Promise.resolve(y).then(g=>({status:"fulfilled",value:g}),g=>({status:"rejected",reason:g}))))};document.getElementsByTagName("link");const f=document.querySelector("meta[property=csp-nonce]"),m=(f==null?void 0:f.nonce)||(f==null?void 0:f.getAttribute("nonce"));l=c(r.map(d=>{if(d=uE(d),d in B0)return;B0[d]=!0;const y=d.endsWith(".css"),g=y?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${d}"]${g}`))return;const x=document.createElement("link");if(x.rel=y?"stylesheet":oE,y||(x.as="script"),x.crossOrigin="",x.href=d,m&&x.setAttribute("nonce",m),document.head.appendChild(x),y)return new Promise((w,E)=>{x.addEventListener("load",w),x.addEventListener("error",()=>E(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 t().catch(u)})},hd=gs("App",{web:()=>Hd(()=>import("./web-DugGj1t8.js"),[]).then(e=>new e.AppWeb)}),cE=gs("Network",{web:()=>Hd(()=>import("./web-CfD_ah7K.js"),[]).then(e=>new e.NetworkWeb)}),Uu=Vn.isNativePlatform()?"https://app.palmier.me":"";async function Ox(e,t,r,s){const l=`${Uu}${t}`;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} ${t} failed:`,c.status,m),new Error(m||`Request failed with status ${c.status}`)}return console.log(`[API] ${e} ${t} ->`,c.status),c.json()}function fE(e,t,r){return Ox("POST",e,t)}function hE(e,t){return Ox("GET",e,void 0)}const P0=Vn.isNativePlatform(),Rx=j.createContext(null),dE=2e3,jh=6e3,mE=1500,pE=6e4;function gE({children:e,activeHost:t}){const[r,s]=j.useState(null),[l,u]=j.useState(!1),c=j.useRef(null),[f,m]=j.useState(!1),[d,y]=j.useState(!1),[g,x]=j.useState(!1),[w,E]=j.useState(!1),R=j.useRef(Nu()),B=j.useRef(new Set),D=j.useRef(0),P=!!t.directUrl,F=P0&&!P&&!!t.lanUrl&&w,ue=d||g?"disconnected":P?f?"direct":"connecting":l?F?"lan":"nats":"connecting",U=ue!=="connecting"&&ue!=="disconnected";j.useEffect(()=>{y(!1),x(!1)},[t.hostId,t.clientToken]),j.useEffect(()=>{if(!P0||P||!t.lanUrl){E(!1);return}let V=!1;const q=t.lanUrl,O=t.hostId;async function X(){console.log("[HOST/LAN] probing",q);try{const $=await fetch(`${q}/health`,{signal:AbortSignal.timeout(mE)});if(V)return;if(!$.ok){console.log("[HOST/LAN] probe got non-ok:",$.status),E(!1);return}const H=await $.json(),ee=H.hostId===O;ee?console.log("[HOST/LAN] reachable"):console.log("[HOST/LAN] hostId mismatch — got:",H.hostId,"expected:",O),E(ee)}catch($){V||(console.log("[HOST/LAN] probe failed:",$ instanceof Error?$.message:$),E(!1))}}X();const J=window.setInterval(X,pE),le=hd.addListener("appStateChange",$=>{$.isActive&&X()}),te=cE.addListener("networkStatusChange",()=>X());return()=>{V=!0,clearInterval(J),le.then($=>$.remove()),te.then($=>$.remove())}},[t.hostId,t.lanUrl,P]),j.useEffect(()=>{if(P){c.current&&(c.current.close().catch(()=>{}),c.current=null,s(null),u(!1));return}let V=!1,q=1e3;const O=3e4;async function X(){for(;!V;)try{const J=await fetch(`${Uu}/api/nats-credentials/${t.hostId}`);if(V)return;if(J.status===401||J.status===403||J.status===404){console.error("[NATS] Host not found or rejected by relay:",J.status),x(!0);return}if(!J.ok)throw new Error(`credentials fetch ${J.status}`);const le=await J.json();if(!le.natsWsUrl){console.error("[NATS] Relay returned empty natsWsUrl — treating as terminal"),x(!0);return}if(V)return;console.log("[NATS] Connecting to",le.natsWsUrl);const te=await Nx({servers:le.natsWsUrl,authenticator:wx(le.natsJwt,new TextEncoder().encode(le.natsNkeySeed))});if(V){te.close().catch(()=>{});return}if(console.log("[NATS] Connected"),c.current=te,s(te),u(!0),q=1e3,await te.closed(),V)return;console.log("[NATS] Connection closed, will reconnect"),c.current=null,s(null),u(!1)}catch(J){if(V)return;console.warn(`[NATS] Connect failed, retrying in ${q}ms:`,J),u(!1),await new Promise(le=>setTimeout(le,q)),q=Math.min(q*2,O)}}return X(),()=>{V=!0,c.current&&(c.current.close().catch(()=>{}),c.current=null,s(null),u(!1))}},[P,t]),j.useEffect(()=>{if(P)return;const V=hd.addListener("appStateChange",q=>{q.isActive&&c.current&&(console.log("[NATS] App resumed; cycling NATS conn to recover from possible dead socket"),c.current.close().catch(()=>{}))});return()=>{V.then(q=>q.remove())}},[P]),j.useEffect(()=>{if(!P){m(!1);return}const V=new AbortController;async function q(){var le;const X=new AbortController,J=setTimeout(()=>X.abort(),dE);V.signal.addEventListener("abort",()=>X.abort());try{const te=await fetch(`${t.directUrl}/events`,{headers:{Authorization:`Bearer ${t.clientToken}`},signal:X.signal});return clearTimeout(J),te.ok?((le=te.body)==null?void 0:le.getReader())??null:null}catch{return clearTimeout(J),null}}async function O(X){m(!0),console.log("[HOST] SSE connected to",t.directUrl),D.current=Date.now();function J(){setTimeout(()=>{V.signal.aborted||Date.now()-D.current<jh||(console.log("[HOST] Heartbeat timeout — no data for",jh/1e3,"s"),V.abort(),m(!1),console.log("[HOST] Direct host unreachable"))},jh)}J();const le=new TextDecoder;let te="";try{for(;;){const{done:$,value:H}=await X.read();if($)break;te+=le.decode(H,{stream:!0}),D.current=Date.now(),J();const ee=te.split(`
|
|
88
|
-
`);te=ee.pop()??"";for(const oe of ee)if(oe.startsWith("data: ")){const be=oe.slice(6);try{const _=JSON.parse(be);if(_.task_id&&_.event_type){const L=`host-event.${t.hostId}.${_.task_id}`;for(const Q of B.current)Q({subject:L,data:R.current.encode(be)})}}catch{}}}}catch{}}return(async()=>{const X=await q();X&&await O(X)})(),()=>{V.abort(),m(!1)}},[t,P]);const M=j.useCallback(async(V,q,O)=>{function X(te){te&&typeof te=="object"&&te.error==="Unauthorized"&&y(!0)}async function J(te,$){console.log(`[HOST/${$}] → ${V}`,q??"");const H=await fetch(`${te}/rpc/${V}`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t.clientToken}`},body:q!=null?JSON.stringify(q):void 0,signal:O!=null&&O.timeout?AbortSignal.timeout(O.timeout):void 0});if(H.status===401)throw y(!0),new Error("Unauthorized");const ee=await H.json();return X(ee),console.log(`[HOST/${$}] ← ${V}`,ee),ee}async function le(){if(!c.current)throw new Error("Not connected");const te=`host.${t.hostId}.rpc.${V}`,$={...q??{},clientToken:t.clientToken},H=R.current.encode(JSON.stringify($));console.log(`[HOST/NATS] → ${V}`,q??"");const ee=await c.current.request(te,H,{timeout:(O==null?void 0:O.timeout)??1e4}),oe=JSON.parse(R.current.decode(ee.data));return X(oe),console.log(`[HOST/NATS] ← ${V}`,oe),oe}if(P)return J(t.directUrl,"HTTP");if(F&&t.lanUrl)try{return await J(t.lanUrl,"LAN")}catch(te){if(te instanceof Error&&te.message==="Unauthorized")throw te;console.log("[HOST/LAN] failed, falling back to NATS:",te),E(!1)}return le()},[t,P,F]),K=j.useCallback((V,q)=>{if(P)return B.current.add(q),()=>{B.current.delete(q)};if(c.current){const O=c.current.subscribe(`host-event.${V}.>`);let X=!1;return(async()=>{try{for await(const J of O){if(X)break;q({subject:J.subject,data:J.data})}}catch{}})(),()=>{X=!0,O.unsubscribe()}}return()=>{}},[t,P]);return b.jsx(Rx.Provider,{value:{connected:U,mode:ue,nc:r,request:M,subscribeEvents:K,activeHost:t,unauthorized:d},children:e})}function Hi(){const e=j.useContext(Rx);if(!e)throw new Error("useHostConnection must be used within HostConnectionProvider");return e}const mn=Vn.isNativePlatform()?gs("Device"):null;function Bu(e){const t=new Date(e),r=new Date,s=t.toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"});return t.toDateString()===r.toDateString()?s:`${t.toLocaleDateString(void 0,{month:"short",day:"numeric"})} ${s}`}const Mx={};function yE(e){for(const t of e)Mx[t.key]=t.label}function dd(e){return Mx[e]??e}const bE=()=>window.matchMedia("(max-width: 600px)").matches;function xE({task:e,lastEvent:t,onEdit:r,onDelete:s,onViewRun:l}){var le;const{request:u}=Hi(),[c,f]=j.useState(!1),[m,d]=j.useState(!1),[y,g]=j.useState(!1),x=j.useRef(null),w=(t==null?void 0:t.running_state)==="started",E=(((le=e.schedule_values)==null?void 0:le.length)??0)>0,R=e.schedule_type==="on_new_notification"||e.schedule_type==="on_new_sms",D=!!e.schedule_enabled&&!!e.schedule_type&&(E||R)?w?"var(--color-success)":(t==null?void 0:t.running_state)==="failed"?"var(--color-error)":"var(--color-success)":"var(--color-text-secondary)";j.useEffect(()=>{if(!m)return;function te($){x.current&&!x.current.contains($.target)&&d(!1)}return document.addEventListener("mousedown",te),()=>document.removeEventListener("mousedown",te)},[m]);function P(){bE()?g(!0):d(te=>!te)}function F(){d(!1),g(!1)}async function ue(){if(F(),!!confirm("Abort this task?")){f(!0);try{await u("task.abort",{id:e.id})}catch(te){console.error("Abort failed:",te)}finally{f(!1)}}}async function U(){F();try{const te=await u("task.run",{id:e.id});l(e.id,te.run_id)}catch(te){console.error("Run failed:",te)}}async function M(){if(F(),!!confirm("Delete this task? Results and reports will be kept."))try{await u("task.delete",{id:e.id}),s(e.id)}catch(te){console.error("Delete failed:",te)}}const K={started:"Started",finished:"Finished",aborted:"Aborted",failed:"Failed"};function V(te,$){if(te==="specific_times"){const xe=new Date($);return{kind:"specific_times",detail:isNaN(xe.getTime())?$:`${xe.toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"})} at ${xe.toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"})}`}}const H=$.split(" ");if(H.length!==5)return{kind:"unknown",detail:$};const[ee,oe,be,,_]=H,L=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];if(oe==="*")return{kind:"hourly",detail:""};const Q=new Date;Q.setHours(Number(oe),Number(ee),0,0);const A=Q.toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"});return _!=="*"?{kind:"weekly",detail:`${L[Number(_)]??_} at ${A}`}:be!=="*"?{kind:"monthly",detail:`day ${be} at ${A}`}:{kind:"daily",detail:A}}function q(te,$){const H=V(te,$);return H.kind==="hourly"?"Every hour":H.kind==="specific_times"?`Once on ${H.detail}`:`${H.kind.charAt(0).toUpperCase()+H.kind.slice(1)}: ${H.detail}`}function O(te,$){if(!te)return"";if(te==="on_new_notification")return"On new notification";if(te==="on_new_sms")return"On new SMS";if(!$||$.length===0)return"";if($.length===1)return q(te,$[0]);const H=$.map(oe=>V(te,oe));if(new Set(H.map(oe=>oe.kind)).size===1){const oe=H[0].kind;if(oe==="hourly")return"Every hour";const be=H.map(_=>_.detail);return`${oe.charAt(0).toUpperCase()+oe.slice(1)}: ${be.join(", ")}`}return $.map(oe=>q(te,oe)).join(", ")}const X=O(e.schedule_type,e.schedule_values),J=b.jsxs(b.Fragment,{children:[b.jsxs("button",{onClick:()=>{F(),r(e)},children:[b.jsx("span",{className:"menu-icon",children:"✎"}),"Edit"]}),b.jsxs("button",{onClick:()=>{F(),l(e.id)},children:[b.jsx("span",{className:"menu-icon",children:"📄"}),"View All Runs"]}),w?b.jsxs("button",{className:"menu-item-danger",onClick:ue,disabled:c,children:[b.jsx("span",{className:"menu-icon",children:"◼"}),"Abort"]}):b.jsxs(b.Fragment,{children:[b.jsxs("button",{onClick:U,children:[b.jsx("span",{className:"menu-icon",children:"▶"}),"Run Now"]}),b.jsxs("button",{className:"menu-item-danger",onClick:M,children:[b.jsx("span",{className:"menu-icon",children:"🗑"}),"Delete"]})]})]});return b.jsxs(b.Fragment,{children:[b.jsxs("div",{className:"task-card",onClick:()=>l(e.id,"latest"),children:[b.jsxs("div",{className:"task-card-header",children:[b.jsxs("div",{className:"task-card-title-row",children:[w?b.jsx("span",{className:"status-spinner",children:b.jsx("span",{})}):b.jsx("span",{className:"status-dot",style:{backgroundColor:D}}),b.jsx("h3",{className:"task-card-name",children:e.name||e.user_prompt})]}),b.jsx("div",{className:"task-card-actions",onClick:te=>te.stopPropagation(),children:b.jsxs("div",{className:"task-card-menu",ref:x,children:[b.jsx("button",{className:"task-card-menu-btn",onClick:P,"aria-label":"Task actions",children:"⋮"}),m&&b.jsx("div",{className:"task-card-menu-dropdown",children:J})]})})]}),b.jsxs("div",{className:"task-card-meta",children:[e.agent&&b.jsx("span",{className:"task-card-agent",children:dd(e.agent)}),t&&K[t.running_state]&&b.jsxs("span",{className:"task-card-last-event",children:[K[t.running_state]," ",Bu(t.time_stamp)]}),e.schedule_type&&(E||R)&&b.jsx("span",{className:"task-card-triggers",children:e.schedule_enabled?X:"Schedule disabled"})]})]}),y&&aa.createPortal(b.jsx("div",{className:"bottom-sheet-overlay",onClick:()=>g(!1),children:b.jsxs("div",{className:"bottom-sheet",onClick:te=>te.stopPropagation(),children:[b.jsx("div",{className:"bottom-sheet-handle"}),b.jsx("div",{className:"bottom-sheet-title",children:e.name||e.user_prompt}),b.jsx("div",{className:"bottom-sheet-actions",children:J})]})}),document.body)]})}function vE({permissions:e}){return b.jsxs("div",{className:"plan-dialog",children:[b.jsx("h2",{children:"Granted Permissions"}),b.jsx("div",{className:"plan-dialog-scroll",children:e&&e.length>0?b.jsx("div",{className:"permissions-section",children:b.jsx("ul",{className:"permissions-list",children:e.map((t,r)=>b.jsxs("li",{className:"permission-item",children:[b.jsx("span",{className:"permission-tool",children:t.name}),b.jsx("span",{className:"permission-desc",children:t.description})]},r))})}):b.jsx("p",{className:"plan-empty",children:"No permissions have been granted for this task."})}),b.jsx("div",{className:"plan-dialog-actions",children:b.jsx("button",{className:"btn btn-secondary",onClick:()=>history.back(),children:"Back"})})]})}const na=[];function wE(){const e=na.pop();e&&(e.pushed.current=!1,e.close())}let q0=!1;function SE(){q0||(q0=!0,window.addEventListener("popstate",wE))}function H0(e,t){const r=j.useRef(!1),s=j.useRef(t);s.current=t;const l=j.useCallback(()=>s.current(),[]),u=j.useRef({close:l,pushed:r});u.current.close=l,j.useEffect(()=>{if(e&&!r.current)SE(),history.pushState({modal:!0},""),na.push(u.current),r.current=!0;else if(!e&&r.current){r.current=!1;const c=na.indexOf(u.current);c!==-1&&na.splice(c,1),history.back()}},[e,l]),j.useEffect(()=>{const c=u.current;return()=>{if(r.current){r.current=!1;const f=na.indexOf(c);f!==-1&&na.splice(f,1),history.back()}}},[])}const _E=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],kE=["specific_times","hourly","daily","weekly","monthly"];function mu(e){return kE.includes(e)}function EE(e){return e==="on_new_notification"||e==="on_new_sms"}function Wr(e="daily"){return{schedule:e,time:"00:00",dayOfWeek:"1",dayOfMonth:"1",onceDate:"",onceTime:"00:00"}}function CE(e){const t=e.split(" ");if(t.length!==5)return Wr();const[r,s,l,,u]=t;if(s==="*")return Wr("hourly");const c=`${s.padStart(2,"0")}:${r.padStart(2,"0")}`;return u!=="*"?{...Wr("weekly"),time:c,dayOfWeek:u}:l!=="*"?{...Wr("monthly"),time:c,dayOfMonth:l}:{...Wr("daily"),time:c}}function Dx(e,t){if(e==="specific_times"){const[r,s]=t.split("T");return{...Wr("specific_times"),onceDate:r??"",onceTime:(s??"09:00").slice(0,5)}}return CE(t)}function AE(e){const[t,r]=e.time.split(":").map(Number);switch(e.schedule){case"hourly":return"0 * * * *";case"daily":return`${r} ${t} * * *`;case"weekly":return`${r} ${t} * * ${e.dayOfWeek}`;case"monthly":return`${r} ${t} ${e.dayOfMonth} * *`;default:return"0 * * * *"}}function TE(e){return e.schedule==="specific_times"?e.onceDate?`${e.onceDate}T${e.onceTime}`:null:AE(e)}function Nh(e){return e==="specific_times"?"specific_times":e==="on_new_notification"?"on_new_notification":e==="on_new_sms"?"on_new_sms":"crons"}function Oh(e){var s;if(!e)return"daily";if(e.command)return"command";const t=e.schedule_type;if(t==="on_new_notification"||t==="on_new_sms")return t;if(t!=="crons"&&t!=="specific_times")return"ondemand";const r=(s=e.schedule_values)==null?void 0:s[0];return r?Dx(t,r).schedule:"ondemand"}function jE({initial:e,agents:t,hostPlatform:r,isNotificationListener:s,onSaved:l,onRun:u,onCancel:c}){var Ht;const{request:f,activeHost:m}=Hi(),{setHostLastAgent:d}=Pi(),y=()=>{var Ae;const de=m.lastAgent,Ie=t.map(Ot=>Ot.key);return de&&Ie.includes(de)?de:((Ae=t[0])==null?void 0:Ae.key)??""},[g,x]=j.useState((e==null?void 0:e.user_prompt)??""),[w,E]=j.useState((e==null?void 0:e.agent)??y()),R=!!((Ht=e==null?void 0:e.permissions)!=null&&Ht.length),[B,D]=j.useState(!1),P=j.useCallback(()=>D(!1),[]);H0(B,P);const[F,ue]=j.useState(null),[U,M]=j.useState(()=>Oh(e)),[K,V]=j.useState(()=>{const de=e==null?void 0:e.schedule_type,Ie=e==null?void 0:e.schedule_values;if(Ie&&(de==="crons"||de==="specific_times"))return Ie.map(Ot=>Dx(de,Ot));const Ae=Oh(e);return mu(Ae)?[Wr(Ae)]:[]}),[q,O]=j.useState((e==null?void 0:e.requires_confirmation)??!1),[X,J]=j.useState((e==null?void 0:e.schedule_enabled)??!0),[le,te]=j.useState((e==null?void 0:e.yolo_mode)??!1),[$,H]=j.useState((e==null?void 0:e.foreground_mode)??!1),[ee,oe]=j.useState((e==null?void 0:e.command)??""),[be,_]=j.useState(!1),L=(e==null?void 0:e.schedule_type)==="on_new_notification"&&e.schedule_values&&e.schedule_values.length>0?e.schedule_values[0]:"",[Q,A]=j.useState(L),[xe,_e]=j.useState([]),[Te,Le]=j.useState(!1),[$e,Ce]=j.useState(!1),[Ne,je]=j.useState(""),Fe=j.useCallback(()=>Ce(!1),[]);H0($e,Fe),j.useEffect(()=>{if(U!=="on_new_notification"||!s||!Vn.isNativePlatform()||!mn)return;let de=!1;return Le(!0),mn.getInstalledApps().then(({apps:Ie})=>{if(de)return;const Ae="com.palmier.app",Ot=Ie.filter(Pt=>Pt.packageName!==Ae).sort((Pt,fn)=>(Pt.appName||Pt.packageName).localeCompare(fn.appName||fn.packageName));_e(Ot)}).catch(()=>{}).finally(()=>{de||Le(!1)}),()=>{de=!0}},[U,s]);const Qe=(e==null?void 0:e.schedule_type)==="on_new_sms"&&e.schedule_values&&e.schedule_values.length>0?e.schedule_values[0]:"",[qe,ct]=j.useState(Qe),vt=j.useRef(null),Ve=mu(U),He=U==="command",nt=EE(U),ft=t.find(de=>de.key===w),rt=!!(ft!=null&&ft.supportsYolo);j.useEffect(()=>{!rt&&le&&te(!1)},[rt,le]);const qt=!!e,jt=Oh(e),ht=!qt||g!==((e==null?void 0:e.user_prompt)??"")||w!==((e==null?void 0:e.agent)??"")||U!==jt||q!==((e==null?void 0:e.requires_confirmation)??!1)||X!==((e==null?void 0:e.schedule_enabled)??!0)||le!==((e==null?void 0:e.yolo_mode)??!1)||$!==((e==null?void 0:e.foreground_mode)??!1)||He&&ee!==((e==null?void 0:e.command)??"")||Ve&&(JSON.stringify(nn())!==JSON.stringify((e==null?void 0:e.schedule_values)??[])||Nh(U)!==((e==null?void 0:e.schedule_type)??void 0))||nt&&U!==(e==null?void 0:e.schedule_type)||U==="on_new_notification"&&Q.trim()!==L.trim()||U==="on_new_sms"&&qe.trim()!==Qe.trim(),Fi=Ve&&K.some(de=>de.schedule==="specific_times"&&(!de.onceDate||new Date(`${de.onceDate}T${de.onceTime}`)<=new Date)),fe=ht&&!!g.trim()&&!Fi&&(!He||!!ee.trim())&&(!Ve||K.length>0);function ve(de,Ie){V(Ae=>Ae.map((Ot,Pt)=>Pt===de?{...Ot,...Ie}:Ot))}function Ue(de){V(Ie=>Ie.filter((Ae,Ot)=>Ot!==de))}function Je(){mu(U)&&V(de=>[...de,de.length>0?{...de[de.length-1]}:Wr(U)])}function lt(de){M(de),mu(de)?V([Wr(de)]):(V([]),O(!1)),de==="command"?setTimeout(()=>{var Ie;return(Ie=vt.current)==null?void 0:Ie.focus()},0):oe(""),de!=="on_new_notification"&&A(L),de!=="on_new_sms"&&ct(Qe)}function nn(){return K.flatMap(de=>{const Ie=TE(de);return Ie?[Ie]:[]})}function _n(){return le?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 Wt(){_(!0),ue(null);try{const de=Ve?nn():U==="on_new_notification"&&Q.trim()?[Q.trim()]:U==="on_new_sms"&&qe.trim()?[qe.trim()]:[],Ie=Ve||nt?Nh(U):null,Ae={user_prompt:g,agent:w,schedule_type:Ie,schedule_values:de.length>0?de:null,schedule_enabled:U!=="ondemand"&&X,requires_confirmation:Ve?q:!1,yolo_mode:le,foreground_mode:$,command:He?ee:""};qt&&(Ae.id=e.id);const Pt=await f(qt?"task.update":"task.create",Ae,{timeout:45e3});if(Pt.error){ue(Pt.error);return}if(qt||d(m.hostId,w),He&&!qt){l(Pt);try{const fn=await f("task.run",{id:Pt.id});fn.run_id?u(Pt.id,fn.run_id):fn.error||u(Pt.id)}catch{}return}l(Pt)}catch(de){ue(de instanceof Error?de.message:String(de))}finally{_(!1)}}const yt=qt?"Save":He?"Run":(Ve||nt)&&X?"Schedule":"Save";return b.jsxs("div",{className:"task-form-overlay",children:[b.jsx("div",{className:"task-form",children:B?b.jsx(vE,{permissions:e==null?void 0:e.permissions}):b.jsxs(b.Fragment,{children:[b.jsx("div",{className:"task-form-header",children:b.jsx("h2",{children:e?"Edit Task":"New Task"})}),F&&b.jsx("div",{className:"form-error",children:F}),b.jsx("textarea",{autoFocus:!e,className:"form-textarea",value:g,onChange:de=>x(de.target.value),placeholder:He?"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:be}),b.jsxs("div",{className:"plan-actions",children:[b.jsxs("div",{className:"agent-picker-section-inline",children:[b.jsx("span",{className:"agent-picker-label",children:"Run with"}),b.jsx("select",{className:"form-select form-select-sm",value:w,onChange:de=>E(de.target.value),disabled:be,children:t.map(de=>b.jsx("option",{value:de.key,children:de.label},de.key))})]}),rt&&b.jsxs("label",{className:"yolo-inline",style:{marginLeft:"auto"},children:[b.jsx("input",{type:"checkbox",checked:le,onChange:de=>te(de.target.checked),disabled:be}),"Yolo"]}),rt&&le&&b.jsx("p",{className:"yolo-warning",children:"The agent will auto-approve all tool calls without asking for permission."}),R&&b.jsx("div",{className:"granted-permissions-row",children:b.jsx("button",{className:"btn btn-link",onClick:()=>D(!0),children:"Granted Permissions"})})]}),b.jsx("div",{className:"toggles-group",children:b.jsxs("div",{className:"schedule-section",children:[b.jsx("h3",{className:"schedule-section-title",children:"Schedule"}),b.jsxs("select",{className:"form-select",value:U,onChange:de=>lt(de.target.value),disabled:be,children:[b.jsx("option",{value:"ondemand",children:"On Demand"}),b.jsx("option",{value:"specific_times",children:"Specific Times"}),b.jsx("option",{value:"hourly",children:"Hourly"}),b.jsx("option",{value:"daily",children:"Daily"}),b.jsx("option",{value:"weekly",children:"Weekly"}),b.jsx("option",{value:"monthly",children:"Monthly"}),b.jsx("option",{value:"on_new_notification",children:"On New Notification"}),b.jsx("option",{value:"on_new_sms",children:"On New SMS"}),b.jsx("option",{value:"command",children:"Command-triggered"})]}),nt&&b.jsxs("div",{className:"schedule-reactive",children:[b.jsxs("p",{className:"command-help-text",children:[U==="on_new_notification"?"Runs each time a new push notification arrives on the paired Android device.":"Runs each time a new SMS arrives on the paired Android device."," ","The triggering payload is spliced into your task prompt — reference it as “the new ",U==="on_new_notification"?"notification":"SMS","”."]}),U==="on_new_notification"&&(()=>{const de=xe.find(Ae=>Ae.packageName===Q),Ie=(de==null?void 0:de.appName)||Q;return b.jsxs(b.Fragment,{children:[s?Q.trim()?b.jsxs("div",{className:"app-filter-selected",children:[b.jsx("span",{className:"app-filter-selected-name",children:Ie}),(de==null?void 0:de.appName)&&b.jsx("span",{className:"app-filter-selected-pkg",children:de.packageName}),b.jsx("button",{type:"button",className:"app-filter-selected-clear",onClick:()=>A(""),"aria-label":"Clear app filter",disabled:be,children:"✕"})]}):b.jsx("button",{type:"button",className:"btn btn-link app-filter-trigger",onClick:()=>{je(""),Ce(!0)},disabled:be,children:"Select app"}):b.jsx("input",{className:"form-input",type:"text",value:Q,onChange:Ae=>A(Ae.target.value),placeholder:"App (optional), e.g. com.google.android.gm",disabled:be}),b.jsx("p",{className:"command-help-text app-filter-help",children:Q.trim()?`Only notifications from ${Ie} will trigger this task.`:"Every notification from your device triggers this task."})]})})(),U==="on_new_sms"&&b.jsxs(b.Fragment,{children:[b.jsx("input",{className:"form-input",type:"text",value:qe,onChange:de=>ct(de.target.value),placeholder:"From (optional), e.g. +1 555-1234)",disabled:be}),b.jsx("p",{className:"command-help-text app-filter-help",children:qe.trim()?`Only SMS from ${qe.trim()} will trigger this task. Formatting (spaces, dashes, parens) is ignored.`:"Every SMS that arrives on your device triggers this task."})]})]}),He&&b.jsxs("div",{className:"schedule-reactive",children:[b.jsx("p",{className:"command-help-text",children:"Runs a command and invokes the task for each line of output. Use “the input” in your task description to reference each line."}),b.jsx("input",{ref:vt,className:"form-input form-input-mono",type:"text",value:ee,onChange:de=>oe(de.target.value),placeholder:"gws gmail +watch --project my-project",disabled:be})]}),Ve&&U!=="hourly"&&b.jsxs(b.Fragment,{children:[K.map((de,Ie)=>b.jsxs("div",{className:"trigger-row-card",children:[b.jsxs("div",{className:"trigger-row-content",children:[U==="daily"&&b.jsx("input",{className:"form-input",type:"time",value:de.time,onChange:Ae=>ve(Ie,{time:Ae.target.value})}),U==="weekly"&&b.jsxs("div",{className:"trigger-row-top",children:[b.jsx("select",{className:"form-select",value:de.dayOfWeek,onChange:Ae=>ve(Ie,{dayOfWeek:Ae.target.value}),children:_E.map((Ae,Ot)=>b.jsx("option",{value:String(Ot),children:Ae},Ot))}),b.jsx("input",{className:"form-input",type:"time",value:de.time,onChange:Ae=>ve(Ie,{time:Ae.target.value})})]}),U==="monthly"&&b.jsxs("div",{className:"trigger-row-top",children:[b.jsx("select",{className:"form-select",value:de.dayOfMonth,onChange:Ae=>ve(Ie,{dayOfMonth:Ae.target.value}),children:Array.from({length:28},(Ae,Ot)=>Ot+1).map(Ae=>b.jsxs("option",{value:String(Ae),children:["Day ",Ae]},Ae))}),b.jsx("input",{className:"form-input",type:"time",value:de.time,onChange:Ae=>ve(Ie,{time:Ae.target.value})})]}),U==="specific_times"&&b.jsxs("div",{className:"trigger-row-top",children:[b.jsx("input",{className:"form-input",type:"date",value:de.onceDate,min:new Date().toISOString().split("T")[0],onChange:Ae=>ve(Ie,{onceDate:Ae.target.value})}),b.jsx("input",{className:"form-input",type:"time",value:de.onceTime,min:de.onceDate===new Date().toISOString().split("T")[0]?new Date().toTimeString().slice(0,5):void 0,onChange:Ae=>ve(Ie,{onceTime:Ae.target.value})})]})]}),K.length>1&&b.jsx("button",{className:"trigger-remove-btn",onClick:()=>Ue(Ie),title:"Remove trigger",children:"×"})]},Ie)),b.jsx("button",{className:"trigger-add-btn",onClick:Je,children:"+ Add"})]}),r==="win32"&&b.jsxs("label",{className:"toggle-label",children:[b.jsx("input",{type:"checkbox",checked:$,onChange:de=>H(de.target.checked),disabled:be}),"Run in the foreground (host must login to Windows)"]}),Ve&&b.jsxs("label",{className:"toggle-label",children:[b.jsx("input",{type:"checkbox",checked:q,onChange:de=>O(de.target.checked),disabled:be}),"Confirm before each run"]}),U!=="ondemand"&&b.jsxs("label",{className:"toggle-label",children:[b.jsx("input",{type:"checkbox",checked:X,onChange:de=>J(de.target.checked),disabled:be}),"Enabled"]})]})}),!le&&ft&&!ft.supportsPermissions&&b.jsxs("div",{className:"form-warning",children:["Palmier does not support runtime permission granting for ",ft.label,". The task may fail if required permissions are not pre-configured."]}),b.jsxs("div",{className:"form-actions",children:[b.jsxs("button",{className:"btn btn-primary",onClick:()=>_n()&&Wt(),disabled:!fe||be,children:[be&&b.jsx("span",{className:"btn-spinner"}),yt]}),b.jsx("button",{className:"btn btn-secondary",onClick:()=>{ht&&g.trim()&&!confirm("You have unsaved changes. Discard?")||c()},style:{marginLeft:"auto"},children:"Cancel"})]})]})}),$e&&(()=>{const de=Ne.trim().toLowerCase(),Ie=de?xe.filter(Ae=>Ae.packageName.toLowerCase().includes(de)||Ae.appName.toLowerCase().includes(de)):xe;return b.jsx("div",{className:"app-filter-overlay",onClick:Fe,children:b.jsxs("div",{className:"app-filter-dialog",onClick:Ae=>Ae.stopPropagation(),children:[b.jsxs("div",{className:"app-filter-header",children:[b.jsx("h2",{children:"Select app"}),b.jsx("button",{className:"app-filter-close",onClick:Fe,"aria-label":"Close",children:b.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:b.jsx("path",{d:"M4 4L12 12M12 4L4 12",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]}),b.jsx("input",{className:"form-input app-filter-search",type:"text",value:Ne,onChange:Ae=>je(Ae.target.value),onKeyDown:Ae=>{Ae.key==="Enter"&&Ne.trim()&&(A(Ne.trim()),Fe())},placeholder:"Search or type a package name",autoFocus:!0}),b.jsxs("ul",{className:"app-filter-list",children:[Te&&xe.length===0?Array.from({length:6}).map((Ae,Ot)=>b.jsx("li",{className:"app-filter-row app-filter-skeleton",children:b.jsx("div",{className:"app-filter-skeleton-bar"})},`sk-${Ot}`)):Ie.length===0&&!Ne.trim()?b.jsx("li",{className:"app-filter-empty",children:"No apps"}):Ie.map(Ae=>b.jsx("li",{className:"app-filter-row",onClick:()=>{A(Ae.packageName),Fe()},children:b.jsxs("div",{className:"app-filter-row-labels",children:[b.jsx("div",{className:"app-filter-row-name",children:Ae.appName||Ae.packageName}),Ae.appName&&b.jsx("div",{className:"app-filter-row-pkg",children:Ae.packageName})]})},Ae.packageName)),Ne.trim()&&b.jsx("li",{className:"app-filter-row",onClick:()=>{A(Ne.trim()),Fe()},children:b.jsx("div",{className:"app-filter-row-labels",children:b.jsx("div",{className:"app-filter-row-name",children:Ne.trim()})})})]})]})})})()]})}function Lx({pullDistance:e,refreshing:t,threshold:r}){const s=e>0||t,l=e>=r;return b.jsx("div",{className:"pull-to-refresh",style:{transform:`translateY(${e}px)`,opacity:s?Math.min(1,e/30):0},"aria-hidden":!s,children:b.jsx("div",{className:"pull-to-refresh-badge",children:t?b.jsx("div",{className:"spinner"}):b.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.25",strokeLinecap:"round",strokeLinejoin:"round",style:{transform:l?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.15s"},children:[b.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),b.jsx("polyline",{points:"19 12 12 19 5 12"})]})})})}function zx({onRefresh:e,threshold:t=70,maxPull:r=110,enabled:s=!0}){const[l,u]=j.useState(0),[c,f]=j.useState(!1),m=j.useRef(null),d=j.useRef(!1),y=j.useRef(0),g=j.useRef(!1),x=j.useRef(e);return j.useEffect(()=>{x.current=e}),j.useEffect(()=>{if(!s)return;const w=B=>{if(g.current||window.scrollY>0){m.current=null;return}m.current=B.touches[0].clientY,d.current=!1,y.current=0},E=B=>{if(g.current||m.current==null)return;const D=B.touches[0].clientY-m.current;if(D<=0){d.current=!1,y.current=0,u(0);return}d.current=!0;const P=Math.min(r,D*.5);y.current=P,u(P),B.cancelable&&B.preventDefault()},R=()=>{if(!d.current){m.current=null,u(0);return}const B=y.current;m.current=null,d.current=!1,y.current=0,B>=t?(g.current=!0,f(!0),u(t),Promise.resolve(x.current()).catch(()=>{}).finally(()=>{g.current=!1,f(!1),u(0)})):u(0)};return window.addEventListener("touchstart",w,{passive:!0}),window.addEventListener("touchmove",E,{passive:!1}),window.addEventListener("touchend",R,{passive:!0}),window.addEventListener("touchcancel",R,{passive:!0}),()=>{window.removeEventListener("touchstart",w),window.removeEventListener("touchmove",E),window.removeEventListener("touchend",R),window.removeEventListener("touchcancel",R)}},[s,t,r]),{pullDistance:l,refreshing:c,threshold:t}}function NE({connected:e,hostId:t,request:r,subscribeEvents:s,agents:l,hostPlatform:u,isNotificationListener:c,onViewRun:f}){const[m,d]=j.useState([]),[y,g]=j.useState(!1),[x,w]=j.useState(null),[E,R]=j.useState(new Map),[B,D]=j.useState(!1),[P,F]=j.useState(void 0),ue=j.useCallback(()=>{D(!1),F(void 0)},[]),U=j.useCallback(async()=>{if(e){g(!0),w(null);try{const O=(await r("task.list")).tasks??[],X=new Map;for(const J of O)J.status&&X.set(J.id,J.status);R(X),d(O)}catch(q){const O=q instanceof Error?q.message:String(q);O==="Not connected"||O.includes("503")||O.toLowerCase().includes("no responders")?w(null):w(O),d([])}finally{g(!1)}}},[e,t,r]);j.useEffect(()=>{e?U():(d([]),g(!1))},[e,t,U]);const M=zx({onRefresh:U,enabled:e});j.useEffect(()=>!e||!t?void 0:s(t,async O=>{const X=O.subject.split(".");if(X.length<3)return;const J=X.slice(2).join(".");let le={};try{le=JSON.parse(new TextDecoder().decode(O.data))}catch{return}const te=le.event_type;if(!(te!=="running-state"&&te!=="permission-resolved"))try{const $=await r("task.status",{id:J},{timeout:5e3});if($.error)return;R(H=>{const ee=new Map(H);return ee.set(J,$),ee})}catch{}}),[e,t,s,r]);function K(q){d(O=>{const X=O.findIndex(J=>J.id===q.id);if(X>=0){const J=[...O];return J[X]=q,J}return[q,...O]}),D(!1),F(void 0)}function V(q){d(O=>O.filter(X=>X.id!==q)),R(O=>{const X=new Map(O);return X.delete(q),X})}return b.jsxs(b.Fragment,{children:[b.jsx(Lx,{pullDistance:M.pullDistance,refreshing:M.refreshing,threshold:M.threshold}),x&&b.jsxs("div",{className:"form-error",children:[x,x.toLowerCase().includes("failed to fetch")&&b.jsxs(b.Fragment,{children:[" ",b.jsx("a",{href:"#",onClick:q=>{q.preventDefault(),window.location.reload()},children:"Reload"})]})]}),y&&!m.length?b.jsx("div",{className:"task-list",children:[0,1,2].map(q=>b.jsxs("div",{className:"task-card",style:{pointerEvents:"none"},children:[b.jsx("div",{className:"task-card-header",children:b.jsxs("div",{className:"task-card-title-row",children:[b.jsx("div",{className:"skeleton-line",style:{width:10,height:10,borderRadius:"50%"}}),b.jsx("div",{className:"skeleton-line",style:{width:`${60+q*12}%`}})]})}),b.jsxs("div",{className:"task-card-meta",children:[b.jsx("div",{className:"skeleton-line",style:{width:"30%"}}),b.jsx("div",{className:"skeleton-line",style:{width:"25%"}})]})]},q))}):m.length===0?b.jsxs("div",{className:"empty-state",children:[b.jsx("p",{className:"empty-state-text",children:"No tasks yet"}),b.jsx("p",{className:"empty-state-hint",children:"Tap the + button to create your first task."})]}):b.jsx("div",{className:"task-list",children:m.map(q=>b.jsx(xE,{task:q,lastEvent:E.get(q.id),onEdit:async O=>{try{const X=await r("task.get",{id:O.id});F(X.error?O:X)}catch{F(O)}D(!0)},onDelete:V,onViewRun:f},q.id))}),b.jsx("button",{className:"fab",onClick:()=>{F(void 0),D(!0)},"aria-label":"New task",title:"New task",children:b.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[b.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),b.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]})}),B&&b.jsx(jE,{initial:P,agents:l,hostPlatform:u,isNotificationListener:c,onSaved:K,onRun:f,onCancel:ue})]})}let ha=null;function I0(e){ha&&(e.preventDefault(),e.returnValue="")}function Rh(e){const t=!!ha;ha=e;const r=!!ha;r&&!t?window.addEventListener("beforeunload",I0):!r&&t&&window.removeEventListener("beforeunload",I0)}function ms(){return ha?window.confirm(ha):!0}function OE(){const e=Or(),t=or(),{hostId:r}=Yu(),s=t.pathname.endsWith("/tasks"),l=!s;function u(c){ms()&&r&&e(`/hosts/${encodeURIComponent(r)}${c}`)}return b.jsxs(b.Fragment,{children:[b.jsxs("button",{className:`tab-btn ${l?"tab-btn-active":""}`,onClick:()=>u(""),children:[b.jsx("svg",{className:"tab-icon",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:b.jsx("path",{d:"M2 8H4.5L6 4L8 12L10 6L11.5 8H14"})}),"Sessions"]}),b.jsxs("button",{className:`tab-btn ${s?"tab-btn-active":""}`,onClick:()=>u("/tasks"),children:[b.jsxs("svg",{className:"tab-icon",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[b.jsx("rect",{x:"2",y:"2",width:"12",height:"12",rx:"2"}),b.jsx("path",{d:"M5.5 8L7 9.5L10.5 6"})]}),"Tasks"]})]})}function Ux(e){const[t,r]=j.useState(()=>window.matchMedia(e).matches);return j.useEffect(()=>{const s=window.matchMedia(e),l=u=>r(u.matches);return s.addEventListener("change",l),r(s.matches),()=>s.removeEventListener("change",l)},[e]),t}const ku=Vn.isNativePlatform(),RE=["Device","Data","Messaging"],ME=[{capability:"sms-read",label:"Read SMS",group:"Messaging"},{capability:"sms-send",label:"Send SMS",group:"Messaging"},{capability:"send-email",label:"Send Email",group:"Messaging"},{capability:"notifications",label:"Notifications from Other Apps",group:"Data"},{capability:"contacts",label:"Manage Contacts",group:"Data"},{capability:"calendar",label:"Manage Calendar",group:"Data"},{capability:"location",label:"Get Location",group:"Device"},{capability:"dnd",label:"Set Ringer Mode",group:"Device"},{capability:"alarm",label:"Trigger Alarms",group:"Device"}];async function DE(){if(!ku||!mn)return new Set;try{const{capabilities:e}=await mn.getCapabilityStatus();return new Set(e.filter(t=>t.enabled).map(t=>t.name))}catch{return new Set}}function Bx({onChange:e}){const[t,r]=j.useState(new Map),[s,l]=j.useState(null),u=j.useCallback(async()=>{if(!(!ku||!mn))try{const{capabilities:m}=await mn.getCapabilityStatus(),d=new Map;for(const y of m)d.set(y.name,y);r(d),e==null||e(new Set(m.filter(y=>y.enabled).map(y=>y.name)))}catch(m){console.error("Failed to read capability status:",m)}},[e]);j.useEffect(()=>{u()},[u]),j.useEffect(()=>{if(!ku)return;const m=hd.addListener("resume",u);return()=>{m.then(d=>d.remove())}},[u]);async function c(m){if(!mn)return;const d=t.get(m.capability);if(d){l(m.capability);try{const y=await mn.setCapabilityEnabled({capability:m.capability,enabled:!d.enabled});!y.enabled&&y.reason==="no-email-client"&&alert("No email app is installed on this device. Install one (e.g. Gmail) before enabling Send Email."),await u()}catch(y){console.error(`Failed to toggle ${m.capability}:`,y)}finally{l(null)}}}const f=RE.map(m=>({group:m,items:ME.filter(d=>{const y=t.get(d.capability);return d.group===m&&(y==null?void 0:y.supported)})})).filter(m=>m.items.length>0);return!ku||f.length===0?null:b.jsx(b.Fragment,{children:f.map(({group:m,items:d},y)=>b.jsx("div",{className:y>0?"drawer-toggle-group drawer-toggle-group-divided":"drawer-toggle-group",children:d.map(g=>{const x=t.get(g.capability),w=!!(x!=null&&x.enabled);return b.jsxs("label",{className:"drawer-toggle",children:[b.jsx("span",{className:"drawer-toggle-label",children:g.label}),b.jsx("button",{className:`toggle-switch ${w?"toggle-switch-on":""}`,onClick:()=>c(g),disabled:s===g.capability,role:"switch","aria-checked":w,children:b.jsx("span",{className:"toggle-switch-thumb"})})]},g.capability)})},m))})}const F0=!!window.__PALMIER_SERVE__&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"),LE=Vn.isNativePlatform();function $0({daemonVersion:e,linkedClientToken:t,request:r,onEnabledCapabilitiesChange:s,onLinkedClientTokenChange:l}){var Ce;const{pairedHosts:u,removePairedHost:c,renamePairedHost:f}=Pi(),{activeHost:m}=Hi(),d=Or(),y=or(),x=Yu().hostId??null,w=m.clientToken||null,E=!!w&&t===w,R=Ux("(min-width: 768px)"),[B,D]=j.useState(!1);async function P(){if(!(!mn||!r||!w)){D(!0);try{const{token:Ne}=await mn.getFcmToken();if(!Ne)return;await r("device.link",{fcmToken:Ne}),l==null||l(w)}catch(Ne){console.error("Failed to make this the linked device:",Ne)}finally{D(!1)}}}async function F(Ne){const je=Ne===x;if(je&&r)try{await r("clients.revoke_self")}catch{}c(Ne),te(null),je&&d("/",{replace:!0})}function ue(Ne){const Fe=y.pathname.endsWith("/tasks")?"/tasks":"";d(`/hosts/${encodeURIComponent(Ne)}${Fe}`)}const[U,M]=j.useState(!1),[K,V]=j.useState(!1),[q,O]=j.useState(null),[X,J]=j.useState(""),[le,te]=j.useState(null),[$,H]=j.useState(!1),ee=j.useRef(null),oe=j.useRef(null),be=j.useCallback(()=>{V(!0)},[]);function _(){K&&(M(!1),V(!1))}function L(){V(!1),M(!0)}function Q(Ne,je){O(Ne),J(je)}function A(){q&&X.trim()&&f(q,X.trim()),O(null),J("")}function xe(){O(null),J("")}j.useEffect(()=>{q&&oe.current&&(oe.current.focus(),oe.current.select())},[q]),j.useEffect(()=>{if(!U||K)return;function Ne(je){je.key==="Escape"&&be()}return document.addEventListener("keydown",Ne),()=>{document.removeEventListener("keydown",Ne)}},[U,K,be]);const _e=b.jsxs(b.Fragment,{children:[!R&&b.jsx("button",{className:"drawer-close-btn",onClick:be,"aria-label":"Close menu",children:b.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:b.jsx("path",{d:"M4 4L12 12M12 4L4 12",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})}),!F0&&u.length>0&&b.jsxs("div",{className:"drawer-section",children:[b.jsx("h3",{className:"drawer-section-label",children:"Hosts"}),b.jsx("div",{className:"host-picker-inline",children:b.jsx("div",{className:"host-picker-list",role:"listbox",children:u.map(Ne=>{const je=Ne.hostId===x,Fe=q===Ne.hostId,Qe=Ne.name||Ne.hostId.slice(0,8);return b.jsx("div",{className:"host-picker-item-wrapper",children:b.jsxs("div",{className:`host-picker-item ${je?"host-picker-item-active":""}`,onClick:()=>{if(!Fe&&!je){if(!ms())return;ue(Ne.hostId),R||be()}},role:"option","aria-selected":je,children:[Fe?b.jsx("input",{ref:oe,className:"form-input host-picker-rename-input",type:"text",value:X,onChange:qe=>J(qe.target.value),onKeyDown:qe=>{qe.key==="Enter"&&A(),qe.key==="Escape"&&xe()},onBlur:A,onClick:qe=>qe.stopPropagation()}):b.jsx("span",{className:"host-picker-item-name",children:Qe}),b.jsxs("div",{className:"host-picker-item-actions",children:[je&&!Fe&&b.jsx("button",{className:"host-picker-edit-btn",onClick:qe=>{qe.stopPropagation(),Q(Ne.hostId,Qe)},"aria-label":"Rename host",children:b.jsx("svg",{width:"13",height:"13",viewBox:"0 0 13 13",fill:"none",children:b.jsx("path",{d:"M9.5 1.5L11.5 3.5M1.5 11.5L2 9L9 2L11 4L4 11L1.5 11.5Z",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})})}),!je&&b.jsx("button",{className:"host-picker-delete-btn",onClick:qe=>{qe.stopPropagation(),te(Ne.hostId)},"aria-label":`Unpair ${Qe}`,children:b.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:b.jsx("path",{d:"M4 5.5V11C4 11.2761 4.22386 11.5 4.5 11.5H9.5C9.77614 11.5 10 11.2761 10 11V5.5M3 4H11M5.5 4V3C5.5 2.72386 5.72386 2.5 6 2.5H8C8.27614 2.5 8.5 2.72386 8.5 3V4M6.5 6.5V9.5M7.5 6.5V9.5",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})})})]})]})},Ne.hostId)})})})]}),!F0&&b.jsxs(b.Fragment,{children:[b.jsx("div",{className:"drawer-divider"}),b.jsx("div",{className:"drawer-section",children:b.jsx("button",{className:"btn btn-primary btn-full",onClick:()=>{ms()&&(d("/pair"),R||be())},children:"Pair New Host"})})]}),LE&&r&&b.jsxs(b.Fragment,{children:[b.jsx("div",{className:"drawer-divider"}),b.jsxs("div",{className:"drawer-section",children:[b.jsx("h3",{className:"drawer-section-label",children:"Device Capabilities"}),E?b.jsx(Bx,{onChange:s}):b.jsxs(b.Fragment,{children:[b.jsx("p",{className:"drawer-section-hint",children:"This device isn't the linked device for this host, so it can't provide capabilities (SMS, contacts, location, etc.)."}),b.jsx("button",{className:"btn btn-secondary btn-full",onClick:()=>{t&&t!==w?H(!0):P()},disabled:B,children:B?"Linking…":"Link this device"})]})]})]}),b.jsxs("div",{className:"drawer-footer",children:[e&&b.jsxs("div",{className:"drawer-version",children:["Palmier v",e]}),b.jsxs("div",{className:"drawer-legal",children:[b.jsx("a",{href:"https://www.palmier.me/terms",target:"_blank",rel:"noopener noreferrer",children:"Terms"}),b.jsx("span",{className:"drawer-legal-sep",children:"·"}),b.jsx("a",{href:"https://www.palmier.me/privacy",target:"_blank",rel:"noopener noreferrer",children:"Privacy"})]})]})]}),Te=!!le&&le===x&&E,Le=le&&aa.createPortal(b.jsx("div",{className:"confirm-modal-overlay",onClick:()=>te(null),children:b.jsxs("div",{className:"confirm-modal",onClick:Ne=>Ne.stopPropagation(),children:[b.jsx("h2",{className:"confirm-modal-title",children:"Unpair host?"}),b.jsxs("p",{className:"confirm-modal-message",children:['"',((Ce=u.find(Ne=>Ne.hostId===le))==null?void 0:Ce.name)||le.slice(0,8),'" will be unpaired.',Te&&b.jsx(b.Fragment,{children:" This device is currently linked to the host — unpairing will revoke its access to all device capabilities (SMS, contacts, location, etc.) until another device is linked."})]}),b.jsxs("div",{className:"confirm-modal-actions",children:[b.jsx("button",{className:"btn btn-secondary",onClick:()=>te(null),children:"Cancel"}),b.jsx("button",{className:"btn btn-danger",onClick:()=>F(le),children:"Unpair"})]})]})}),document.body),$e=$&&aa.createPortal(b.jsx("div",{className:"confirm-modal-overlay",onClick:()=>H(!1),children:b.jsxs("div",{className:"confirm-modal",onClick:Ne=>Ne.stopPropagation(),children:[b.jsx("h2",{className:"confirm-modal-title",children:"Link this device?"}),b.jsx("p",{className:"confirm-modal-message",children:"Only one device can be linked at a time — switching will disable those capabilities on the currently linked device."}),b.jsxs("div",{className:"confirm-modal-actions",children:[b.jsx("button",{className:"btn btn-secondary",onClick:()=>H(!1),children:"Cancel"}),b.jsx("button",{className:"btn btn-primary",onClick:()=>{H(!1),P()},children:"Link"})]})]})}),document.body);return R?b.jsxs(b.Fragment,{children:[b.jsx("div",{className:"drawer-panel drawer-panel-desktop",ref:ee,children:_e}),Le,$e]}):b.jsxs(b.Fragment,{children:[b.jsx("button",{className:"hamburger-btn",onClick:L,"aria-label":"Open menu",children:b.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:b.jsx("path",{d:"M3 5H17M3 10H17M3 15H17",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})}),U&&aa.createPortal(b.jsx("div",{className:`drawer-overlay ${K?"drawer-overlay-closing":""}`,onClick:be,onAnimationEnd:_,children:b.jsx("div",{className:`drawer-panel ${K?"drawer-panel-closing":""}`,ref:ee,onClick:Ne=>Ne.stopPropagation(),children:_e})}),document.body),Le,$e]})}const zE=Vn.isNativePlatform(),Id={width:16,height:16,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};function UE(){return b.jsxs("svg",{...Id,"aria-hidden":"true",children:[b.jsx("path",{d:"M5 12.55a11 11 0 0 1 14.08 0"}),b.jsx("path",{d:"M1.42 9a16 16 0 0 1 21.16 0"}),b.jsx("path",{d:"M8.53 16.11a6 6 0 0 1 6.95 0"}),b.jsx("line",{x1:"12",y1:"20",x2:"12.01",y2:"20"})]})}function Y0(){return b.jsxs("svg",{...Id,"aria-hidden":"true",children:[b.jsx("circle",{cx:"12",cy:"12",r:"10"}),b.jsx("line",{x1:"2",y1:"12",x2:"22",y2:"12"}),b.jsx("path",{d:"M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"})]})}function BE(){return b.jsxs("svg",{...Id,"aria-hidden":"true",children:[b.jsx("path",{d:"M10.29 3.86 1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"}),b.jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),b.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]})}function PE(){const{mode:e}=Hi(),[t,r]=j.useState(!1),s=j.useRef(null);if(j.useEffect(()=>{if(!t)return;function f(m){var d;(d=s.current)!=null&&d.contains(m.target)||r(!1)}return document.addEventListener("pointerdown",f),()=>document.removeEventListener("pointerdown",f)},[t]),e==="direct")return null;let l,u,c;switch(e){case"lan":l=b.jsx(UE,{}),u="Connected via LAN",c="lan";break;case"nats":l=b.jsx(Y0,{}),u=zE?"Connected via relay":"Connected",c="relay";break;case"disconnected":l=b.jsx(BE,{}),u="Disconnected",c="disconnected";break;case"connecting":default:l=b.jsx(Y0,{}),u="Connecting…",c="connecting";break}return b.jsxs("div",{ref:s,className:`conn-status conn-status--${c}`,children:[b.jsx("button",{type:"button",className:"conn-status-btn","aria-label":u,onClick:()=>r(f=>!f),children:l}),b.jsx("div",{className:`conn-status-popover ${t?"conn-status-popover--open":""}`,role:"tooltip",children:u})]})}function G0(e,t){var s;const r=e.map(l=>l.key);return t&&r.includes(t)?t:((s=e[0])==null?void 0:s.key)??""}function qE({agents:e,hostPlatform:t,onStarted:r}){const{request:s,activeHost:l}=Hi(),{setHostLastAgent:u}=Pi(),[c,f]=j.useState(""),[m,d]=j.useState(()=>G0(e,l.lastAgent)),[y,g]=j.useState(!1),[x,w]=j.useState(!1),[E,R]=j.useState(null);j.useEffect(()=>{e.length&&(e.find(M=>M.key===m)||d(G0(e,l.lastAgent)))},[e,m,l.lastAgent]),j.useEffect(()=>{const M=c.trim().length>0;return Rh(M?"Your session draft will be lost. Continue?":null),()=>Rh(null)},[c]);const B=e.find(M=>M.key===m),D=!!(B!=null&&B.supportsYolo);j.useEffect(()=>{!D&&y&&g(!1)},[D,y]);const P=!!c.trim()&&!!m&&!x;function F(){return y?confirm(`Yolo mode is enabled. The agent will auto-approve all tool calls — it can read, write, delete files, run arbitrary commands, and access the network without asking for permission.
|
|
91
|
-
|
|
92
|
-
Are you sure you want to continue?`):!0}async function ue(){if(!(!P||!F())){w(!0),R(null);try{const M=await s("task.run_oneoff",{user_prompt:c,agent:m,yolo_mode:y,...t==="win32"?{foreground_mode:!0}:{}});if(M.error){R(M.error);return}u(l.hostId,m),f(""),Rh(null),M.task_id&&r(M.task_id,M.run_id)}catch(M){R(M instanceof Error?M.message:String(M))}finally{w(!1)}}}function U(M){M.key==="Enter"&&(M.metaKey||M.ctrlKey)&&(M.preventDefault(),ue())}return b.jsxs("div",{className:"session-composer",children:[E&&b.jsx("div",{className:"form-error",children:E}),b.jsx("textarea",{className:"session-composer-textarea",value:c,onChange:M=>f(M.target.value),onKeyDown:U,placeholder:"What can I do for you?",rows:3,disabled:x}),b.jsxs("div",{className:"session-composer-controls",children:[b.jsxs("div",{className:"agent-picker-section-inline",children:[b.jsx("span",{className:"agent-picker-label",children:"Run with"}),b.jsx("select",{className:"form-select form-select-sm",value:m,onChange:M=>d(M.target.value),disabled:x||!e.length,children:e.map(M=>b.jsx("option",{value:M.key,children:M.label},M.key))})]}),D&&b.jsxs("label",{className:"session-composer-yolo",children:[b.jsx("input",{type:"checkbox",checked:y,onChange:M=>g(M.target.checked),disabled:x}),"Yolo"]}),b.jsx("button",{className:"btn btn-primary chat-send-btn",onClick:ue,disabled:!P,"aria-label":"Run session",title:"Run session",children:x?b.jsx("span",{className:"btn-spinner"}):b.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[b.jsx("line",{x1:"22",y1:"2",x2:"11",y2:"13"}),b.jsx("polygon",{points:"22 2 15 22 11 13 2 9 22 2"})]})})]}),D&&y&&b.jsx("p",{className:"command-help-text",children:"The agent will auto-approve all tool calls without asking for permission."})]})}const fs=88,V0=6;function HE({id:e,revealedId:t,setRevealedId:r,onDelete:s,onClick:l,children:u,actionLabel:c="Delete"}){const f=t===e,[m,d]=j.useState(0),[y,g]=j.useState(!1),x=j.useRef(0),w=j.useRef(0),E=j.useRef(null),R=j.useRef(0),B=j.useRef(!1),D=j.useRef(null);j.useEffect(()=>{f||d(0)},[f]),j.useEffect(()=>{if(!f)return;function K(V){var q;(q=D.current)!=null&&q.contains(V.target)||r(null)}return document.addEventListener("pointerdown",K),()=>document.removeEventListener("pointerdown",K)},[f,r]);function P(K){K.button!==void 0&&K.button!==0||(x.current=K.clientX,w.current=K.clientY,E.current=null,R.current=f?-fs:0,B.current=!1)}function F(K){if(K.pointerType==="mouse"&&K.buttons===0)return;const V=K.clientX-x.current,q=K.clientY-w.current;if(E.current===null){if(Math.abs(V)<V0&&Math.abs(q)<V0)return;if(E.current=Math.abs(V)>Math.abs(q)?"x":"y",E.current==="x")try{K.currentTarget.setPointerCapture(K.pointerId)}catch{}}if(E.current!=="x")return;B.current=!0,y||g(!0);let O=R.current+V;O>0&&(O=O/4),O<-fs&&(O=-fs+(O+fs)/4),d(O)}function ue(){if(E.current!=="x"){g(!1);return}E.current=null,g(!1),m<=-44?(d(-fs),r(e)):(d(0),f&&r(null))}function U(K){if(B.current){B.current=!1,K.stopPropagation(),K.preventDefault();return}f&&(K.stopPropagation(),K.preventDefault(),r(null))}const M=m!==0?m:f?-fs:0;return b.jsxs("div",{ref:D,className:"swipe-row",children:[b.jsx("button",{type:"button",className:"swipe-row-action",style:{width:fs},onClick:K=>{K.stopPropagation(),s()},tabIndex:f?0:-1,"aria-hidden":!f,children:c}),b.jsx("div",{className:`swipe-row-content ${y?"swipe-row-content-dragging":""}`,style:{transform:`translateX(${M}px)`},onPointerDown:P,onPointerMove:F,onPointerUp:ue,onPointerCancel:ue,onClickCapture:U,onClick:l,children:u})]})}const IE=10;function FE({connected:e,hostId:t,request:r,subscribeEvents:s,agents:l,hostPlatform:u,filterTaskId:c,onClearFilter:f}){const[m,d]=j.useState([]),[y,g]=j.useState(0),[x,w]=j.useState(!1),[E,R]=j.useState(!1),[B,D]=j.useState(null),P=Or();async function F($){const H=`${$.task_id}:${$.run_id}`;d(ee=>ee.filter(oe=>`${oe.task_id}:${oe.run_id}`!==H)),g(ee=>Math.max(0,ee-1)),D(null);try{await r("taskrun.delete",{task_id:$.task_id,run_id:$.run_id})}catch(ee){console.error("Failed to delete run:",ee),d(oe=>[$,...oe]),g(oe=>oe+1)}}const ue=j.useRef(null),U=j.useCallback($=>{const H={offset:$,limit:IE};return c&&(H.task_id=c),H},[c]),M=j.useCallback(async($,H)=>{if(e){H?R(!0):w(!0);try{const ee=await r("taskrun.list",U($)),oe=ee.entries??[];g(ee.total??0),d(H?be=>{const _=new Set(be.map(Q=>`${Q.task_id}:${Q.run_id}`)),L=oe.filter(Q=>!_.has(`${Q.task_id}:${Q.run_id}`));return[...be,...L]}:oe)}catch(ee){ee instanceof Error&&ee.message==="Not connected"||console.error("Failed to load runs:",ee)}finally{w(!1),R(!1)}}},[e,r,U]);j.useEffect(()=>{e?(d([]),g(0),M(0,!1)):(d([]),g(0))},[e,t,M,c]);const K=zx({onRefresh:()=>M(0,!1),enabled:e});j.useEffect(()=>!e||!t?void 0:s(t,async H=>{try{const ee=JSON.parse(new TextDecoder().decode(H.data));if(ee.event_type==="running-state"&&ee.running_state&&["monitoring","started","finished","failed","aborted"].includes(ee.running_state)){const oe=await r("taskrun.list",U(0)),be=oe.entries??[];g(oe.total??0),d(_=>{const L=new Map(be.map(_e=>[`${_e.task_id}:${_e.run_id}`,_e])),Q=_.map(_e=>{const Te=`${_e.task_id}:${_e.run_id}`;return L.get(Te)??_e}),A=new Set(Q.map(_e=>`${_e.task_id}:${_e.run_id}`));return[...be.filter(_e=>!A.has(`${_e.task_id}:${_e.run_id}`)),...Q]})}}catch{}}),[e,t,s,r]),j.useEffect(()=>{const $=ue.current;if(!$)return;const H=new IntersectionObserver(ee=>{ee[0].isIntersecting&&!E&&m.length<y&&M(m.length,!0)},{threshold:.1});return H.observe($),()=>H.disconnect()},[m.length,y,E,M]);function V($,H){if(!$||!H)return"";const ee=Math.round((H-$)/1e3);if(ee<60)return`${ee}s`;const oe=Math.floor(ee/60),be=ee%60;return`${oe}m ${be}s`}const q={monitoring:"Monitoring",started:"Running",finished:"Finished",failed:"Failed",aborted:"Aborted"};function O($,H){ms()&&t&&P(`/hosts/${encodeURIComponent(t)}/runs/${encodeURIComponent($)}/${encodeURIComponent(H)}`)}const X=!c&&b.jsx(qE,{agents:l,hostPlatform:u,onStarted:($,H)=>{if(!t)return;const ee=`/hosts/${encodeURIComponent(t)}/runs/${encodeURIComponent($)}`;P(H?`${ee}/${encodeURIComponent(H)}`:ee)}}),J=b.jsx(Lx,{pullDistance:K.pullDistance,refreshing:K.refreshing,threshold:K.threshold}),le=c&&f&&b.jsx("div",{style:{marginBottom:"var(--space-sm)"},children:b.jsxs("span",{className:"sessions-filter-chip",children:["Filtered by task",b.jsx("button",{onClick:f,"aria-label":"Clear filter",children:"×"})]})});function te($){if($==="failed")return"var(--color-error)";if($==="aborted")return"var(--color-warning, #d97706)"}return x&&m.length===0&&e?b.jsxs(b.Fragment,{children:[J,X,b.jsx("div",{className:"task-list",children:[0,1,2].map($=>b.jsxs("div",{className:"task-card",style:{pointerEvents:"none"},children:[b.jsx("div",{className:"task-card-header",children:b.jsx("div",{className:"task-card-title-row",children:b.jsx("div",{className:"skeleton-line",style:{width:`${70+$*10}%`}})})}),b.jsx("div",{className:"task-card-meta",children:b.jsx("div",{className:"skeleton-line",style:{width:"45%"}})})]},$))})]}):!e||x&&m.length===0?b.jsxs(b.Fragment,{children:[J,X,b.jsx("div",{className:"sessions-view",children:b.jsxs("div",{className:"empty-state",children:[b.jsx("p",{className:"empty-state-text",children:"Sessions"}),b.jsx("p",{className:"empty-state-hint",children:"Your sessions will appear here"})]})})]}):m.length===0?b.jsxs(b.Fragment,{children:[J,X,le,b.jsx("div",{className:"sessions-view",children:b.jsxs("div",{className:"empty-state",children:[b.jsx("p",{className:"empty-state-text",children:"No sessions yet"}),b.jsx("p",{className:"empty-state-hint",children:c?"This task hasn't been executed yet. Run it from the task menu or wait for its next trigger.":"Your sessions will appear here."})]})})]}):b.jsxs(b.Fragment,{children:[J,X,le,b.jsxs("div",{className:"task-list",children:[m.map(($,H)=>{const ee=`${$.task_id}:${$.run_id}`;return b.jsx(HE,{id:ee,revealedId:B,setRevealedId:D,onDelete:()=>F($),onClick:()=>!$.error&&O($.task_id,$.run_id),children:b.jsxs("div",{className:"sessions-card",children:[b.jsxs("div",{className:"sessions-card-body",children:[b.jsx("h3",{className:"sessions-card-name",children:$.task_name||$.task_id}),b.jsxs("div",{className:"sessions-card-meta",children:[$.running_state==="started"?b.jsx("span",{className:"status-spinner","aria-label":"Running",children:b.jsx("span",{})}):b.jsx("span",{style:{color:te($.running_state)},children:q[$.running_state??""]??$.running_state}),$.end_time&&b.jsx("span",{children:Bu($.end_time)}),$.start_time&&$.end_time&&b.jsx("span",{style:{color:"var(--color-muted)"},children:V($.start_time,$.end_time)}),$.error&&b.jsx("span",{style:{color:"var(--color-muted)"},children:$.error})]})]}),b.jsx("span",{className:"sessions-card-chevron",children:"›"})]})},`${ee}-${H}`)}),b.jsx("div",{ref:ue,style:{height:1}}),E&&b.jsx("div",{className:"loading-state",style:{padding:"var(--space-md)"},children:b.jsx("div",{className:"spinner"})})]})]})}function $E(e,t){const r={};return(e[e.length-1]===""?[...e,""]:e).join((r.padRight?" ":"")+","+(r.padLeft===!1?"":" ")).trim()}const YE=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,GE=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,VE={};function J0(e,t){return(VE.jsx?GE:YE).test(e)}const JE=/[ \t\n\f\r]/g;function XE(e){return typeof e=="object"?e.type==="text"?X0(e.value):!1:X0(e)}function X0(e){return e.replace(JE,"")===""}class Gl{constructor(t,r,s){this.normal=r,this.property=t,s&&(this.space=s)}}Gl.prototype.normal={};Gl.prototype.property={};Gl.prototype.space=void 0;function Px(e,t){const r={},s={};for(const l of e)Object.assign(r,l.property),Object.assign(s,l.normal);return new Gl(r,s,t)}function md(e){return e.toLowerCase()}class On{constructor(t,r){this.attribute=r,this.property=t}}On.prototype.attribute="";On.prototype.booleanish=!1;On.prototype.boolean=!1;On.prototype.commaOrSpaceSeparated=!1;On.prototype.commaSeparated=!1;On.prototype.defined=!1;On.prototype.mustUseProperty=!1;On.prototype.number=!1;On.prototype.overloadedBoolean=!1;On.prototype.property="";On.prototype.spaceSeparated=!1;On.prototype.space=void 0;let KE=0;const Ke=ys(),Zt=ys(),pd=ys(),we=ys(),Nt=ys(),da=ys(),qn=ys();function ys(){return 2**++KE}const gd=Object.freeze(Object.defineProperty({__proto__:null,boolean:Ke,booleanish:Zt,commaOrSpaceSeparated:qn,commaSeparated:da,number:we,overloadedBoolean:pd,spaceSeparated:Nt},Symbol.toStringTag,{value:"Module"})),Mh=Object.keys(gd);class Fd extends On{constructor(t,r,s,l){let u=-1;if(super(t,r),K0(this,"space",l),typeof s=="number")for(;++u<Mh.length;){const c=Mh[u];K0(this,Mh[u],(s&gd[c])===gd[c])}}}Fd.prototype.defined=!0;function K0(e,t,r){r&&(e[t]=r)}function _a(e){const t={},r={};for(const[s,l]of Object.entries(e.properties)){const u=new Fd(s,e.transform(e.attributes||{},s),l,e.space);e.mustUseProperty&&e.mustUseProperty.includes(s)&&(u.mustUseProperty=!0),t[s]=u,r[md(s)]=s,r[md(u.attribute)]=s}return new Gl(t,r,e.space)}const qx=_a({properties:{ariaActiveDescendant:null,ariaAtomic:Zt,ariaAutoComplete:null,ariaBusy:Zt,ariaChecked:Zt,ariaColCount:we,ariaColIndex:we,ariaColSpan:we,ariaControls:Nt,ariaCurrent:null,ariaDescribedBy:Nt,ariaDetails:null,ariaDisabled:Zt,ariaDropEffect:Nt,ariaErrorMessage:null,ariaExpanded:Zt,ariaFlowTo:Nt,ariaGrabbed:Zt,ariaHasPopup:null,ariaHidden:Zt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Nt,ariaLevel:we,ariaLive:null,ariaModal:Zt,ariaMultiLine:Zt,ariaMultiSelectable:Zt,ariaOrientation:null,ariaOwns:Nt,ariaPlaceholder:null,ariaPosInSet:we,ariaPressed:Zt,ariaReadOnly:Zt,ariaRelevant:null,ariaRequired:Zt,ariaRoleDescription:Nt,ariaRowCount:we,ariaRowIndex:we,ariaRowSpan:we,ariaSelected:Zt,ariaSetSize:we,ariaSort:null,ariaValueMax:we,ariaValueMin:we,ariaValueNow:we,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function Hx(e,t){return t in e?e[t]:t}function Ix(e,t){return Hx(e,t.toLowerCase())}const QE=_a({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:da,acceptCharset:Nt,accessKey:Nt,action:null,allow:null,allowFullScreen:Ke,allowPaymentRequest:Ke,allowUserMedia:Ke,alt:null,as:null,async:Ke,autoCapitalize:null,autoComplete:Nt,autoFocus:Ke,autoPlay:Ke,blocking:Nt,capture:null,charSet:null,checked:Ke,cite:null,className:Nt,cols:we,colSpan:null,content:null,contentEditable:Zt,controls:Ke,controlsList:Nt,coords:we|da,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Ke,defer:Ke,dir:null,dirName:null,disabled:Ke,download:pd,draggable:Zt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Ke,formTarget:null,headers:Nt,height:we,hidden:pd,high:we,href:null,hrefLang:null,htmlFor:Nt,httpEquiv:Nt,id:null,imageSizes:null,imageSrcSet:null,inert:Ke,inputMode:null,integrity:null,is:null,isMap:Ke,itemId:null,itemProp:Nt,itemRef:Nt,itemScope:Ke,itemType:Nt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Ke,low:we,manifest:null,max:null,maxLength:we,media:null,method:null,min:null,minLength:we,multiple:Ke,muted:Ke,name:null,nonce:null,noModule:Ke,noValidate:Ke,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:Ke,optimum:we,pattern:null,ping:Nt,placeholder:null,playsInline:Ke,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Ke,referrerPolicy:null,rel:Nt,required:Ke,reversed:Ke,rows:we,rowSpan:we,sandbox:Nt,scope:null,scoped:Ke,seamless:Ke,selected:Ke,shadowRootClonable:Ke,shadowRootDelegatesFocus:Ke,shadowRootMode:null,shape:null,size:we,sizes:null,slot:null,span:we,spellCheck:Zt,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:Ke,useMap:null,value:Zt,width:we,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Nt,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:Ke,declare:Ke,event:null,face:null,frame:null,frameBorder:null,hSpace:we,leftMargin:we,link:null,longDesc:null,lowSrc:null,marginHeight:we,marginWidth:we,noResize:Ke,noHref:Ke,noShade:Ke,noWrap:Ke,object:null,profile:null,prompt:null,rev:null,rightMargin:we,rules:null,scheme:null,scrolling:Zt,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:Ke,disableRemotePlayback:Ke,prefix:null,property:null,results:we,security:null,unselectable:null},space:"html",transform:Ix}),ZE=_a({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:qn,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:Nt,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:Ke,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:da,g2:da,glyphName:da,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:qn,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:Nt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:we,pointsAtY:we,pointsAtZ:we,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:qn,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:qn,rev:qn,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:qn,requiredFeatures:qn,requiredFonts:qn,requiredFormats:qn,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:qn,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:qn,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:qn,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:Hx}),Fx=_a({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),$x=_a({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Ix}),Yx=_a({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),WE={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"},eC=/[A-Z]/g,Q0=/-[a-z]/g,tC=/^data[-\w.:]+$/i;function nC(e,t){const r=md(t);let s=t,l=On;if(r in e.normal)return e.property[e.normal[r]];if(r.length>4&&r.slice(0,4)==="data"&&tC.test(t)){if(t.charAt(4)==="-"){const u=t.slice(5).replace(Q0,iC);s="data"+u.charAt(0).toUpperCase()+u.slice(1)}else{const u=t.slice(4);if(!Q0.test(u)){let c=u.replace(eC,rC);c.charAt(0)!=="-"&&(c="-"+c),t="data"+c}}l=Fd}return new l(s,t)}function rC(e){return"-"+e.toLowerCase()}function iC(e){return e.charAt(1).toUpperCase()}const sC=Px([qx,QE,Fx,$x,Yx],"html"),$d=Px([qx,ZE,Fx,$x,Yx],"svg");function aC(e){return e.join(" ").trim()}var ea={},Dh,Z0;function lC(){if(Z0)return Dh;Z0=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,r=/^\s*/,s=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,l=/^:\s*/,u=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,f=/^\s+|\s+$/g,m=`
|
|
93
|
-
`,d="/",y="*",g="",x="comment",w="declaration";function E(B,D){if(typeof B!="string")throw new TypeError("First argument must be a string");if(!B)return[];D=D||{};var P=1,F=1;function ue(te){var $=te.match(t);$&&(P+=$.length);var H=te.lastIndexOf(m);F=~H?te.length-H:F+te.length}function U(){var te={line:P,column:F};return function($){return $.position=new M(te),q(),$}}function M(te){this.start=te,this.end={line:P,column:F},this.source=D.source}M.prototype.content=B;function K(te){var $=new Error(D.source+":"+P+":"+F+": "+te);if($.reason=te,$.filename=D.source,$.line=P,$.column=F,$.source=B,!D.silent)throw $}function V(te){var $=te.exec(B);if($){var H=$[0];return ue(H),B=B.slice(H.length),$}}function q(){V(r)}function O(te){var $;for(te=te||[];$=X();)$!==!1&&te.push($);return te}function X(){var te=U();if(!(d!=B.charAt(0)||y!=B.charAt(1))){for(var $=2;g!=B.charAt($)&&(y!=B.charAt($)||d!=B.charAt($+1));)++$;if($+=2,g===B.charAt($-1))return K("End of comment missing");var H=B.slice(2,$-2);return F+=2,ue(H),B=B.slice($),F+=2,te({type:x,comment:H})}}function J(){var te=U(),$=V(s);if($){if(X(),!V(l))return K("property missing ':'");var H=V(u),ee=te({type:w,property:R($[0].replace(e,g)),value:H?R(H[0].replace(e,g)):g});return V(c),ee}}function le(){var te=[];O(te);for(var $;$=J();)$!==!1&&(te.push($),O(te));return te}return q(),le()}function R(B){return B?B.replace(f,g):g}return Dh=E,Dh}var W0;function oC(){if(W0)return ea;W0=1;var e=ea&&ea.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(ea,"__esModule",{value:!0}),ea.default=r;const t=e(lC());function r(s,l){let u=null;if(!s||typeof s!="string")return u;const c=(0,t.default)(s),f=typeof l=="function";return c.forEach(m=>{if(m.type!=="declaration")return;const{property:d,value:y}=m;f?l(d,y,m):y&&(u=u||{},u[d]=y)}),u}return ea}var vl={},eb;function uC(){if(eb)return vl;eb=1,Object.defineProperty(vl,"__esModule",{value:!0}),vl.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,r=/^[^-]+$/,s=/^-(webkit|moz|ms|o|khtml)-/,l=/^-(ms)-/,u=function(d){return!d||r.test(d)||e.test(d)},c=function(d,y){return y.toUpperCase()},f=function(d,y){return"".concat(y,"-")},m=function(d,y){return y===void 0&&(y={}),u(d)?d:(d=d.toLowerCase(),y.reactCompat?d=d.replace(l,f):d=d.replace(s,f),d.replace(t,c))};return vl.camelCase=m,vl}var wl,tb;function cC(){if(tb)return wl;tb=1;var e=wl&&wl.__importDefault||function(l){return l&&l.__esModule?l:{default:l}},t=e(oC()),r=uC();function s(l,u){var c={};return!l||typeof l!="string"||(0,t.default)(l,function(f,m){f&&m&&(c[(0,r.camelCase)(f,u)]=m)}),c}return s.default=s,wl=s,wl}var fC=cC();const hC=Hb(fC),Gx=Vx("end"),Yd=Vx("start");function Vx(e){return t;function t(r){const s=r&&r.position&&r.position[e]||{};if(typeof s.line=="number"&&s.line>0&&typeof s.column=="number"&&s.column>0)return{line:s.line,column:s.column,offset:typeof s.offset=="number"&&s.offset>-1?s.offset:void 0}}}function dC(e){const t=Yd(e),r=Gx(e);if(t&&r)return{start:t,end:r}}function Ol(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?nb(e.position):"start"in e||"end"in e?nb(e):"line"in e||"column"in e?yd(e):""}function yd(e){return rb(e&&e.line)+":"+rb(e&&e.column)}function nb(e){return yd(e&&e.start)+"-"+yd(e&&e.end)}function rb(e){return e&&typeof e=="number"?e:1}class gn extends Error{constructor(t,r,s){super(),typeof r=="string"&&(s=r,r=void 0);let l="",u={},c=!1;if(r&&("line"in r&&"column"in r?u={place:r}:"start"in r&&"end"in r?u={place:r}:"type"in r?u={ancestors:[r],place:r.position}:u={...r}),typeof t=="string"?l=t:!u.cause&&t&&(c=!0,l=t.message,u.cause=t),!u.ruleId&&!u.source&&typeof s=="string"){const m=s.indexOf(":");m===-1?u.ruleId=s:(u.source=s.slice(0,m),u.ruleId=s.slice(m+1))}if(!u.place&&u.ancestors&&u.ancestors){const m=u.ancestors[u.ancestors.length-1];m&&(u.place=m.position)}const f=u.place&&"start"in u.place?u.place.start:u.place;this.ancestors=u.ancestors||void 0,this.cause=u.cause||void 0,this.column=f?f.column:void 0,this.fatal=void 0,this.file="",this.message=l,this.line=f?f.line:void 0,this.name=Ol(u.place)||"1:1",this.place=u.place||void 0,this.reason=this.message,this.ruleId=u.ruleId||void 0,this.source=u.source||void 0,this.stack=c&&u.cause&&typeof u.cause.stack=="string"?u.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}gn.prototype.file="";gn.prototype.name="";gn.prototype.reason="";gn.prototype.message="";gn.prototype.stack="";gn.prototype.column=void 0;gn.prototype.line=void 0;gn.prototype.ancestors=void 0;gn.prototype.cause=void 0;gn.prototype.fatal=void 0;gn.prototype.place=void 0;gn.prototype.ruleId=void 0;gn.prototype.source=void 0;const Gd={}.hasOwnProperty,mC=new Map,pC=/[A-Z]/g,gC=new Set(["table","tbody","thead","tfoot","tr"]),yC=new Set(["td","th"]),Jx="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function bC(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const r=t.filePath||void 0;let s;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");s=CC(r,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");s=EC(r,t.jsx,t.jsxs)}const l={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:s,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:r,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?$d:sC,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},u=Xx(l,e,void 0);return u&&typeof u!="string"?u:l.create(e,l.Fragment,{children:u||void 0},void 0)}function Xx(e,t,r){if(t.type==="element")return xC(e,t,r);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return vC(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return SC(e,t,r);if(t.type==="mdxjsEsm")return wC(e,t);if(t.type==="root")return _C(e,t,r);if(t.type==="text")return kC(e,t)}function xC(e,t,r){const s=e.schema;let l=s;t.tagName.toLowerCase()==="svg"&&s.space==="html"&&(l=$d,e.schema=l),e.ancestors.push(t);const u=Qx(e,t.tagName,!1),c=AC(e,t);let f=Jd(e,t);return gC.has(t.tagName)&&(f=f.filter(function(m){return typeof m=="string"?!XE(m):!0})),Kx(e,c,u,t),Vd(c,f),e.ancestors.pop(),e.schema=s,e.create(t,u,c,r)}function vC(e,t){if(t.data&&t.data.estree&&e.evaluater){const s=t.data.estree.body[0];return s.type,e.evaluater.evaluateExpression(s.expression)}ql(e,t.position)}function wC(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);ql(e,t.position)}function SC(e,t,r){const s=e.schema;let l=s;t.name==="svg"&&s.space==="html"&&(l=$d,e.schema=l),e.ancestors.push(t);const u=t.name===null?e.Fragment:Qx(e,t.name,!0),c=TC(e,t),f=Jd(e,t);return Kx(e,c,u,t),Vd(c,f),e.ancestors.pop(),e.schema=s,e.create(t,u,c,r)}function _C(e,t,r){const s={};return Vd(s,Jd(e,t)),e.create(t,e.Fragment,s,r)}function kC(e,t){return t.value}function Kx(e,t,r,s){typeof r!="string"&&r!==e.Fragment&&e.passNode&&(t.node=s)}function Vd(e,t){if(t.length>0){const r=t.length>1?t:t[0];r&&(e.children=r)}}function EC(e,t,r){return s;function s(l,u,c,f){const d=Array.isArray(c.children)?r:t;return f?d(u,c,f):d(u,c)}}function CC(e,t){return r;function r(s,l,u,c){const f=Array.isArray(u.children),m=Yd(s);return t(l,u,c,f,{columnNumber:m?m.column-1:void 0,fileName:e,lineNumber:m?m.line:void 0},void 0)}}function AC(e,t){const r={};let s,l;for(l in t.properties)if(l!=="children"&&Gd.call(t.properties,l)){const u=jC(e,l,t.properties[l]);if(u){const[c,f]=u;e.tableCellAlignToStyle&&c==="align"&&typeof f=="string"&&yC.has(t.tagName)?s=f:r[c]=f}}if(s){const u=r.style||(r.style={});u[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=s}return r}function TC(e,t){const r={};for(const s of t.attributes)if(s.type==="mdxJsxExpressionAttribute")if(s.data&&s.data.estree&&e.evaluater){const u=s.data.estree.body[0];u.type;const c=u.expression;c.type;const f=c.properties[0];f.type,Object.assign(r,e.evaluater.evaluateExpression(f.argument))}else ql(e,t.position);else{const l=s.name;let u;if(s.value&&typeof s.value=="object")if(s.value.data&&s.value.data.estree&&e.evaluater){const f=s.value.data.estree.body[0];f.type,u=e.evaluater.evaluateExpression(f.expression)}else ql(e,t.position);else u=s.value===null?!0:s.value;r[l]=u}return r}function Jd(e,t){const r=[];let s=-1;const l=e.passKeys?new Map:mC;for(;++s<t.children.length;){const u=t.children[s];let c;if(e.passKeys){const m=u.type==="element"?u.tagName:u.type==="mdxJsxFlowElement"||u.type==="mdxJsxTextElement"?u.name:void 0;if(m){const d=l.get(m)||0;c=m+"-"+d,l.set(m,d+1)}}const f=Xx(e,u,c);f!==void 0&&r.push(f)}return r}function jC(e,t,r){const s=nC(e.schema,t);if(!(r==null||typeof r=="number"&&Number.isNaN(r))){if(Array.isArray(r)&&(r=s.commaSeparated?$E(r):aC(r)),s.property==="style"){let l=typeof r=="object"?r:NC(e,String(r));return e.stylePropertyNameCase==="css"&&(l=OC(l)),["style",l]}return[e.elementAttributeNameCase==="react"&&s.space?WE[s.property]||s.property:s.attribute,r]}}function NC(e,t){try{return hC(t,{reactCompat:!0})}catch(r){if(e.ignoreInvalidStyle)return{};const s=r,l=new gn("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:s,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw l.file=e.filePath||void 0,l.url=Jx+"#cannot-parse-style-attribute",l}}function Qx(e,t,r){let s;if(!r)s={type:"Literal",value:t};else if(t.includes(".")){const l=t.split(".");let u=-1,c;for(;++u<l.length;){const f=J0(l[u])?{type:"Identifier",name:l[u]}:{type:"Literal",value:l[u]};c=c?{type:"MemberExpression",object:c,property:f,computed:!!(u&&f.type==="Literal"),optional:!1}:f}s=c}else s=J0(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(s.type==="Literal"){const l=s.value;return Gd.call(e.components,l)?e.components[l]:l}if(e.evaluater)return e.evaluater.evaluateExpression(s);ql(e)}function ql(e,t){const r=new gn("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw r.file=e.filePath||void 0,r.url=Jx+"#cannot-handle-mdx-estrees-without-createevaluater",r}function OC(e){const t={};let r;for(r in e)Gd.call(e,r)&&(t[RC(r)]=e[r]);return t}function RC(e){let t=e.replace(pC,MC);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function MC(e){return"-"+e.toLowerCase()}const Lh={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"]},DC={};function Xd(e,t){const r=DC,s=typeof r.includeImageAlt=="boolean"?r.includeImageAlt:!0,l=typeof r.includeHtml=="boolean"?r.includeHtml:!0;return Zx(e,s,l)}function Zx(e,t,r){if(LC(e)){if("value"in e)return e.type==="html"&&!r?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return ib(e.children,t,r)}return Array.isArray(e)?ib(e,t,r):""}function ib(e,t,r){const s=[];let l=-1;for(;++l<e.length;)s[l]=Zx(e[l],t,r);return s.join("")}function LC(e){return!!(e&&typeof e=="object")}const sb=document.createElement("i");function Kd(e){const t="&"+e+";";sb.innerHTML=t;const r=sb.textContent;return r.charCodeAt(r.length-1)===59&&e!=="semi"||r===t?!1:r}function Yn(e,t,r,s){const l=e.length;let u=0,c;if(t<0?t=-t>l?0:l+t:t=t>l?l:t,r=r>0?r:0,s.length<1e4)c=Array.from(s),c.unshift(t,r),e.splice(...c);else for(r&&e.splice(t,r);u<s.length;)c=s.slice(u,u+1e4),c.unshift(t,0),e.splice(...c),u+=1e4,t+=1e4}function lr(e,t){return e.length>0?(Yn(e,e.length,0,t),e):t}const ab={}.hasOwnProperty;function Wx(e){const t={};let r=-1;for(;++r<e.length;)zC(t,e[r]);return t}function zC(e,t){let r;for(r in t){const l=(ab.call(e,r)?e[r]:void 0)||(e[r]={}),u=t[r];let c;if(u)for(c in u){ab.call(l,c)||(l[c]=[]);const f=u[c];UC(l[c],Array.isArray(f)?f:f?[f]:[])}}}function UC(e,t){let r=-1;const s=[];for(;++r<t.length;)(t[r].add==="after"?e:s).push(t[r]);Yn(e,0,0,s)}function e1(e,t){const r=Number.parseInt(e,t);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 xr(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const wn=Ii(/[A-Za-z]/),pn=Ii(/[\dA-Za-z]/),BC=Ii(/[#-'*+\--9=?A-Z^-~]/);function Pu(e){return e!==null&&(e<32||e===127)}const bd=Ii(/\d/),PC=Ii(/[\dA-Fa-f]/),qC=Ii(/[!-/:-@[-`{-~]/);function Be(e){return e!==null&&e<-2}function Tt(e){return e!==null&&(e<0||e===32)}function tt(e){return e===-2||e===-1||e===32}const Zu=Ii(new RegExp("\\p{P}|\\p{S}","u")),ps=Ii(/\s/);function Ii(e){return t;function t(r){return r!==null&&r>-1&&e.test(String.fromCharCode(r))}}function ka(e){const t=[];let r=-1,s=0,l=0;for(;++r<e.length;){const u=e.charCodeAt(r);let c="";if(u===37&&pn(e.charCodeAt(r+1))&&pn(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&&(t.push(e.slice(s,r),encodeURIComponent(c)),s=r+l+1,c=""),l&&(r+=l,l=0)}return t.join("")+e.slice(s)}function ot(e,t,r,s){const l=s?s-1:Number.POSITIVE_INFINITY;let u=0;return c;function c(m){return tt(m)?(e.enter(r),f(m)):t(m)}function f(m){return tt(m)&&u++<l?(e.consume(m),f):(e.exit(r),t(m))}}const HC={tokenize:IC};function IC(e){const t=e.attempt(this.parser.constructs.contentInitial,s,l);let r;return t;function s(f){if(f===null){e.consume(f);return}return e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),ot(e,t,"linePrefix")}function l(f){return e.enter("paragraph"),u(f)}function u(f){const m=e.enter("chunkText",{contentType:"text",previous:r});return r&&(r.next=m),r=m,c(f)}function c(f){if(f===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(f);return}return Be(f)?(e.consume(f),e.exit("chunkText"),u):(e.consume(f),c)}}const FC={tokenize:$C},lb={tokenize:YC};function $C(e){const t=this,r=[];let s=0,l,u,c;return f;function f(F){if(s<r.length){const ue=r[s];return t.containerState=ue[1],e.attempt(ue[0].continuation,m,d)(F)}return d(F)}function m(F){if(s++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,l&&P();const ue=t.events.length;let U=ue,M;for(;U--;)if(t.events[U][0]==="exit"&&t.events[U][1].type==="chunkFlow"){M=t.events[U][1].end;break}D(s);let K=ue;for(;K<t.events.length;)t.events[K][1].end={...M},K++;return Yn(t.events,U+1,0,t.events.slice(ue)),t.events.length=K,d(F)}return f(F)}function d(F){if(s===r.length){if(!l)return x(F);if(l.currentConstruct&&l.currentConstruct.concrete)return E(F);t.interrupt=!!(l.currentConstruct&&!l._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(lb,y,g)(F)}function y(F){return l&&P(),D(s),x(F)}function g(F){return t.parser.lazy[t.now().line]=s!==r.length,c=t.now().offset,E(F)}function x(F){return t.containerState={},e.attempt(lb,w,E)(F)}function w(F){return s++,r.push([t.currentConstruct,t.containerState]),x(F)}function E(F){if(F===null){l&&P(),D(0),e.consume(F);return}return l=l||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:l,contentType:"flow",previous:u}),R(F)}function R(F){if(F===null){B(e.exit("chunkFlow"),!0),D(0),e.consume(F);return}return Be(F)?(e.consume(F),B(e.exit("chunkFlow")),s=0,t.interrupt=void 0,f):(e.consume(F),R)}function B(F,ue){const U=t.sliceStream(F);if(ue&&U.push(null),F.previous=u,u&&(u.next=F),u=F,l.defineSkip(F.start),l.write(U),t.parser.lazy[F.start.line]){let M=l.events.length;for(;M--;)if(l.events[M][1].start.offset<c&&(!l.events[M][1].end||l.events[M][1].end.offset>c))return;const K=t.events.length;let V=K,q,O;for(;V--;)if(t.events[V][0]==="exit"&&t.events[V][1].type==="chunkFlow"){if(q){O=t.events[V][1].end;break}q=!0}for(D(s),M=K;M<t.events.length;)t.events[M][1].end={...O},M++;Yn(t.events,V+1,0,t.events.slice(K)),t.events.length=M}}function D(F){let ue=r.length;for(;ue-- >F;){const U=r[ue];t.containerState=U[1],U[0].exit.call(t,e)}r.length=F}function P(){l.write([null]),u=void 0,l=void 0,t.containerState._closeFlow=void 0}}function YC(e,t,r){return ot(e,e.attempt(this.parser.constructs.document,t,r),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function ba(e){if(e===null||Tt(e)||ps(e))return 1;if(Zu(e))return 2}function Wu(e,t,r){const s=[];let l=-1;for(;++l<e.length;){const u=e[l].resolveAll;u&&!s.includes(u)&&(t=u(t,r),s.push(u))}return t}const xd={name:"attention",resolveAll:GC,tokenize:VC};function GC(e,t){let r=-1,s,l,u,c,f,m,d,y;for(;++r<e.length;)if(e[r][0]==="enter"&&e[r][1].type==="attentionSequence"&&e[r][1]._close){for(s=r;s--;)if(e[s][0]==="exit"&&e[s][1].type==="attentionSequence"&&e[s][1]._open&&t.sliceSerialize(e[s][1]).charCodeAt(0)===t.sliceSerialize(e[r][1]).charCodeAt(0)){if((e[s][1]._close||e[r][1]._open)&&(e[r][1].end.offset-e[r][1].start.offset)%3&&!((e[s][1].end.offset-e[s][1].start.offset+e[r][1].end.offset-e[r][1].start.offset)%3))continue;m=e[s][1].end.offset-e[s][1].start.offset>1&&e[r][1].end.offset-e[r][1].start.offset>1?2:1;const g={...e[s][1].end},x={...e[r][1].start};ob(g,-m),ob(x,m),c={type:m>1?"strongSequence":"emphasisSequence",start:g,end:{...e[s][1].end}},f={type:m>1?"strongSequence":"emphasisSequence",start:{...e[r][1].start},end:x},u={type:m>1?"strongText":"emphasisText",start:{...e[s][1].end},end:{...e[r][1].start}},l={type:m>1?"strong":"emphasis",start:{...c.start},end:{...f.end}},e[s][1].end={...c.start},e[r][1].start={...f.end},d=[],e[s][1].end.offset-e[s][1].start.offset&&(d=lr(d,[["enter",e[s][1],t],["exit",e[s][1],t]])),d=lr(d,[["enter",l,t],["enter",c,t],["exit",c,t],["enter",u,t]]),d=lr(d,Wu(t.parser.constructs.insideSpan.null,e.slice(s+1,r),t)),d=lr(d,[["exit",u,t],["enter",f,t],["exit",f,t],["exit",l,t]]),e[r][1].end.offset-e[r][1].start.offset?(y=2,d=lr(d,[["enter",e[r][1],t],["exit",e[r][1],t]])):y=0,Yn(e,s-1,r-s+3,d),r=s+d.length-y-2;break}}for(r=-1;++r<e.length;)e[r][1].type==="attentionSequence"&&(e[r][1].type="data");return e}function VC(e,t){const r=this.parser.constructs.attentionMarkers.null,s=this.previous,l=ba(s);let u;return c;function c(m){return u=m,e.enter("attentionSequence"),f(m)}function f(m){if(m===u)return e.consume(m),f;const d=e.exit("attentionSequence"),y=ba(m),g=!y||y===2&&l||r.includes(m),x=!l||l===2&&y||r.includes(s);return d._open=!!(u===42?g:g&&(l||!x)),d._close=!!(u===42?x:x&&(y||!g)),t(m)}}function ob(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const JC={name:"autolink",tokenize:XC};function XC(e,t,r){let s=0;return l;function l(w){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(w),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),u}function u(w){return wn(w)?(e.consume(w),c):w===64?r(w):d(w)}function c(w){return w===43||w===45||w===46||pn(w)?(s=1,f(w)):d(w)}function f(w){return w===58?(e.consume(w),s=0,m):(w===43||w===45||w===46||pn(w))&&s++<32?(e.consume(w),f):(s=0,d(w))}function m(w){return w===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(w),e.exit("autolinkMarker"),e.exit("autolink"),t):w===null||w===32||w===60||Pu(w)?r(w):(e.consume(w),m)}function d(w){return w===64?(e.consume(w),y):BC(w)?(e.consume(w),d):r(w)}function y(w){return pn(w)?g(w):r(w)}function g(w){return w===46?(e.consume(w),s=0,y):w===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(w),e.exit("autolinkMarker"),e.exit("autolink"),t):x(w)}function x(w){if((w===45||pn(w))&&s++<63){const E=w===45?x:g;return e.consume(w),E}return r(w)}}const Vl={partial:!0,tokenize:KC};function KC(e,t,r){return s;function s(u){return tt(u)?ot(e,l,"linePrefix")(u):l(u)}function l(u){return u===null||Be(u)?t(u):r(u)}}const t1={continuation:{tokenize:ZC},exit:WC,name:"blockQuote",tokenize:QC};function QC(e,t,r){const s=this;return l;function l(c){if(c===62){const f=s.containerState;return f.open||(e.enter("blockQuote",{_container:!0}),f.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(c),e.exit("blockQuoteMarker"),u}return r(c)}function u(c){return tt(c)?(e.enter("blockQuotePrefixWhitespace"),e.consume(c),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(c))}}function ZC(e,t,r){const s=this;return l;function l(c){return tt(c)?ot(e,u,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(c):u(c)}function u(c){return e.attempt(t1,t,r)(c)}}function WC(e){e.exit("blockQuote")}const n1={name:"characterEscape",tokenize:eA};function eA(e,t,r){return s;function s(u){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(u),e.exit("escapeMarker"),l}function l(u){return qC(u)?(e.enter("characterEscapeValue"),e.consume(u),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):r(u)}}const r1={name:"characterReference",tokenize:tA};function tA(e,t,r){const s=this;let l=0,u,c;return f;function f(g){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(g),e.exit("characterReferenceMarker"),m}function m(g){return g===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(g),e.exit("characterReferenceMarkerNumeric"),d):(e.enter("characterReferenceValue"),u=31,c=pn,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=PC,y):(e.enter("characterReferenceValue"),u=7,c=bd,y(g))}function y(g){if(g===59&&l){const x=e.exit("characterReferenceValue");return c===pn&&!Kd(s.sliceSerialize(x))?r(g):(e.enter("characterReferenceMarker"),e.consume(g),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return c(g)&&l++<u?(e.consume(g),y):r(g)}}const ub={partial:!0,tokenize:rA},cb={concrete:!0,name:"codeFenced",tokenize:nA};function nA(e,t,r){const s=this,l={partial:!0,tokenize:U};let u=0,c=0,f;return m;function m(M){return d(M)}function d(M){const K=s.events[s.events.length-1];return u=K&&K[1].type==="linePrefix"?K[2].sliceSerialize(K[1],!0).length:0,f=M,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),y(M)}function y(M){return M===f?(c++,e.consume(M),y):c<3?r(M):(e.exit("codeFencedFenceSequence"),tt(M)?ot(e,g,"whitespace")(M):g(M))}function g(M){return M===null||Be(M)?(e.exit("codeFencedFence"),s.interrupt?t(M):e.check(ub,R,ue)(M)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),x(M))}function x(M){return M===null||Be(M)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),g(M)):tt(M)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),ot(e,w,"whitespace")(M)):M===96&&M===f?r(M):(e.consume(M),x)}function w(M){return M===null||Be(M)?g(M):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),E(M))}function E(M){return M===null||Be(M)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),g(M)):M===96&&M===f?r(M):(e.consume(M),E)}function R(M){return e.attempt(l,ue,B)(M)}function B(M){return e.enter("lineEnding"),e.consume(M),e.exit("lineEnding"),D}function D(M){return u>0&&tt(M)?ot(e,P,"linePrefix",u+1)(M):P(M)}function P(M){return M===null||Be(M)?e.check(ub,R,ue)(M):(e.enter("codeFlowValue"),F(M))}function F(M){return M===null||Be(M)?(e.exit("codeFlowValue"),P(M)):(e.consume(M),F)}function ue(M){return e.exit("codeFenced"),t(M)}function U(M,K,V){let q=0;return O;function O($){return M.enter("lineEnding"),M.consume($),M.exit("lineEnding"),X}function X($){return M.enter("codeFencedFence"),tt($)?ot(M,J,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)($):J($)}function J($){return $===f?(M.enter("codeFencedFenceSequence"),le($)):V($)}function le($){return $===f?(q++,M.consume($),le):q>=c?(M.exit("codeFencedFenceSequence"),tt($)?ot(M,te,"whitespace")($):te($)):V($)}function te($){return $===null||Be($)?(M.exit("codeFencedFence"),K($)):V($)}}}function rA(e,t,r){const s=this;return l;function l(c){return c===null?r(c):(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),u)}function u(c){return s.parser.lazy[s.now().line]?r(c):t(c)}}const zh={name:"codeIndented",tokenize:sA},iA={partial:!0,tokenize:aA};function sA(e,t,r){const s=this;return l;function l(d){return e.enter("codeIndented"),ot(e,u,"linePrefix",5)(d)}function u(d){const y=s.events[s.events.length-1];return y&&y[1].type==="linePrefix"&&y[2].sliceSerialize(y[1],!0).length>=4?c(d):r(d)}function c(d){return d===null?m(d):Be(d)?e.attempt(iA,c,m)(d):(e.enter("codeFlowValue"),f(d))}function f(d){return d===null||Be(d)?(e.exit("codeFlowValue"),c(d)):(e.consume(d),f)}function m(d){return e.exit("codeIndented"),t(d)}}function aA(e,t,r){const s=this;return l;function l(c){return s.parser.lazy[s.now().line]?r(c):Be(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),l):ot(e,u,"linePrefix",5)(c)}function u(c){const f=s.events[s.events.length-1];return f&&f[1].type==="linePrefix"&&f[2].sliceSerialize(f[1],!0).length>=4?t(c):Be(c)?l(c):r(c)}}const lA={name:"codeText",previous:uA,resolve:oA,tokenize:cA};function oA(e){let t=e.length-4,r=3,s,l;if((e[r][1].type==="lineEnding"||e[r][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(s=r;++s<t;)if(e[s][1].type==="codeTextData"){e[r][1].type="codeTextPadding",e[t][1].type="codeTextPadding",r+=2,t-=2;break}}for(s=r-1,t++;++s<=t;)l===void 0?s!==t&&e[s][1].type!=="lineEnding"&&(l=s):(s===t||e[s][1].type==="lineEnding")&&(e[l][1].type="codeTextData",s!==l+2&&(e[l][1].end=e[s-1][1].end,e.splice(l+2,s-l-2),t-=s-l-2,s=l+2),l=void 0);return e}function uA(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function cA(e,t,r){let s=0,l,u;return c;function c(g){return e.enter("codeText"),e.enter("codeTextSequence"),f(g)}function f(g){return g===96?(e.consume(g),s++,f):(e.exit("codeTextSequence"),m(g))}function m(g){return g===null?r(g):g===32?(e.enter("space"),e.consume(g),e.exit("space"),m):g===96?(u=e.enter("codeTextSequence"),l=0,y(g)):Be(g)?(e.enter("lineEnding"),e.consume(g),e.exit("lineEnding"),m):(e.enter("codeTextData"),d(g))}function d(g){return g===null||g===32||g===96||Be(g)?(e.exit("codeTextData"),m(g)):(e.consume(g),d)}function y(g){return g===96?(e.consume(g),l++,y):l===s?(e.exit("codeTextSequence"),e.exit("codeText"),t(g)):(u.type="codeTextData",d(g))}}class fA{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,r){const s=r??Number.POSITIVE_INFINITY;return s<this.left.length?this.left.slice(t,s):t>this.left.length?this.right.slice(this.right.length-s+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-s+this.left.length).reverse())}splice(t,r,s){const l=r||0;this.setCursor(Math.trunc(t));const u=this.right.splice(this.right.length-l,Number.POSITIVE_INFINITY);return s&&Sl(this.left,s),u.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),Sl(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Sl(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const r=this.left.splice(t,Number.POSITIVE_INFINITY);Sl(this.right,r.reverse())}else{const r=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Sl(this.left,r.reverse())}}}function Sl(e,t){let r=0;if(t.length<1e4)e.push(...t);else for(;r<t.length;)e.push(...t.slice(r,r+1e4)),r+=1e4}function i1(e){const t={};let r=-1,s,l,u,c,f,m,d;const y=new fA(e);for(;++r<y.length;){for(;r in t;)r=t[r];if(s=y.get(r),r&&s[1].type==="chunkFlow"&&y.get(r-1)[1].type==="listItemPrefix"&&(m=s[1]._tokenizer.events,u=0,u<m.length&&m[u][1].type==="lineEndingBlank"&&(u+=2),u<m.length&&m[u][1].type==="content"))for(;++u<m.length&&m[u][1].type!=="content";)m[u][1].type==="chunkText"&&(m[u][1]._isInFirstContentOfListItem=!0,u++);if(s[0]==="enter")s[1].contentType&&(Object.assign(t,hA(y,r)),r=t[r],d=!0);else if(s[1]._container){for(u=r,l=void 0;u--;)if(c=y.get(u),c[1].type==="lineEnding"||c[1].type==="lineEndingBlank")c[0]==="enter"&&(l&&(y.get(l)[1].type="lineEndingBlank"),c[1].type="lineEnding",l=u);else if(!(c[1].type==="linePrefix"||c[1].type==="listItemIndent"))break;l&&(s[1].end={...y.get(l)[1].start},f=y.slice(l,r),f.unshift(s),y.splice(l,r-l+1,f))}}return Yn(e,0,Number.POSITIVE_INFINITY,y.slice(0)),!d}function hA(e,t){const r=e.get(t)[1],s=e.get(t)[2];let l=t-1;const u=[];let c=r._tokenizer;c||(c=s.parser[r.contentType](r.start),r._contentTypeTextTrailing&&(c._contentTypeTextTrailing=!0));const f=c.events,m=[],d={};let y,g,x=-1,w=r,E=0,R=0;const B=[R];for(;w;){for(;e.get(++l)[1]!==w;);u.push(l),w._tokenizer||(y=s.sliceStream(w),w.next||y.push(null),g&&c.defineSkip(w.start),w._isInFirstContentOfListItem&&(c._gfmTasklistFirstContentOfListItem=!0),c.write(y),w._isInFirstContentOfListItem&&(c._gfmTasklistFirstContentOfListItem=void 0)),g=w,w=w.next}for(w=r;++x<f.length;)f[x][0]==="exit"&&f[x-1][0]==="enter"&&f[x][1].type===f[x-1][1].type&&f[x][1].start.line!==f[x][1].end.line&&(R=x+1,B.push(R),w._tokenizer=void 0,w.previous=void 0,w=w.next);for(c.events=[],w?(w._tokenizer=void 0,w.previous=void 0):B.pop(),x=B.length;x--;){const D=f.slice(B[x],B[x+1]),P=u.pop();m.push([P,P+D.length-1]),e.splice(P,2,D)}for(m.reverse(),x=-1;++x<m.length;)d[E+m[x][0]]=E+m[x][1],E+=m[x][1]-m[x][0]-1;return d}const dA={resolve:pA,tokenize:gA},mA={partial:!0,tokenize:yA};function pA(e){return i1(e),e}function gA(e,t){let r;return s;function s(f){return e.enter("content"),r=e.enter("chunkContent",{contentType:"content"}),l(f)}function l(f){return f===null?u(f):Be(f)?e.check(mA,c,u)(f):(e.consume(f),l)}function u(f){return e.exit("chunkContent"),e.exit("content"),t(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 yA(e,t,r){const s=this;return l;function l(c){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),ot(e,u,"linePrefix")}function u(c){if(c===null||Be(c))return r(c);const f=s.events[s.events.length-1];return!s.parser.constructs.disable.null.includes("codeIndented")&&f&&f[1].type==="linePrefix"&&f[2].sliceSerialize(f[1],!0).length>=4?t(c):e.interrupt(s.parser.constructs.flow,r,t)(c)}}function s1(e,t,r,s,l,u,c,f,m){const d=m||Number.POSITIVE_INFINITY;let y=0;return g;function g(D){return D===60?(e.enter(s),e.enter(l),e.enter(u),e.consume(D),e.exit(u),x):D===null||D===32||D===41||Pu(D)?r(D):(e.enter(s),e.enter(c),e.enter(f),e.enter("chunkString",{contentType:"string"}),R(D))}function x(D){return D===62?(e.enter(u),e.consume(D),e.exit(u),e.exit(l),e.exit(s),t):(e.enter(f),e.enter("chunkString",{contentType:"string"}),w(D))}function w(D){return D===62?(e.exit("chunkString"),e.exit(f),x(D)):D===null||D===60||Be(D)?r(D):(e.consume(D),D===92?E:w)}function E(D){return D===60||D===62||D===92?(e.consume(D),w):w(D)}function R(D){return!y&&(D===null||D===41||Tt(D))?(e.exit("chunkString"),e.exit(f),e.exit(c),e.exit(s),t(D)):y<d&&D===40?(e.consume(D),y++,R):D===41?(e.consume(D),y--,R):D===null||D===32||D===40||Pu(D)?r(D):(e.consume(D),D===92?B:R)}function B(D){return D===40||D===41||D===92?(e.consume(D),R):R(D)}}function a1(e,t,r,s,l,u){const c=this;let f=0,m;return d;function d(w){return e.enter(s),e.enter(l),e.consume(w),e.exit(l),e.enter(u),y}function y(w){return f>999||w===null||w===91||w===93&&!m||w===94&&!f&&"_hiddenFootnoteSupport"in c.parser.constructs?r(w):w===93?(e.exit(u),e.enter(l),e.consume(w),e.exit(l),e.exit(s),t):Be(w)?(e.enter("lineEnding"),e.consume(w),e.exit("lineEnding"),y):(e.enter("chunkString",{contentType:"string"}),g(w))}function g(w){return w===null||w===91||w===93||Be(w)||f++>999?(e.exit("chunkString"),y(w)):(e.consume(w),m||(m=!tt(w)),w===92?x:g)}function x(w){return w===91||w===92||w===93?(e.consume(w),f++,g):g(w)}}function l1(e,t,r,s,l,u){let c;return f;function f(x){return x===34||x===39||x===40?(e.enter(s),e.enter(l),e.consume(x),e.exit(l),c=x===40?41:x,m):r(x)}function m(x){return x===c?(e.enter(l),e.consume(x),e.exit(l),e.exit(s),t):(e.enter(u),d(x))}function d(x){return x===c?(e.exit(u),m(c)):x===null?r(x):Be(x)?(e.enter("lineEnding"),e.consume(x),e.exit("lineEnding"),ot(e,d,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),y(x))}function y(x){return x===c||x===null||Be(x)?(e.exit("chunkString"),d(x)):(e.consume(x),x===92?g:y)}function g(x){return x===c||x===92?(e.consume(x),y):y(x)}}function Rl(e,t){let r;return s;function s(l){return Be(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),r=!0,s):tt(l)?ot(e,s,r?"linePrefix":"lineSuffix")(l):t(l)}}const bA={name:"definition",tokenize:vA},xA={partial:!0,tokenize:wA};function vA(e,t,r){const s=this;let l;return u;function u(w){return e.enter("definition"),c(w)}function c(w){return a1.call(s,e,f,r,"definitionLabel","definitionLabelMarker","definitionLabelString")(w)}function f(w){return l=xr(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)),w===58?(e.enter("definitionMarker"),e.consume(w),e.exit("definitionMarker"),m):r(w)}function m(w){return Tt(w)?Rl(e,d)(w):d(w)}function d(w){return s1(e,y,r,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(w)}function y(w){return e.attempt(xA,g,g)(w)}function g(w){return tt(w)?ot(e,x,"whitespace")(w):x(w)}function x(w){return w===null||Be(w)?(e.exit("definition"),s.parser.defined.push(l),t(w)):r(w)}}function wA(e,t,r){return s;function s(f){return Tt(f)?Rl(e,l)(f):r(f)}function l(f){return l1(e,u,r,"definitionTitle","definitionTitleMarker","definitionTitleString")(f)}function u(f){return tt(f)?ot(e,c,"whitespace")(f):c(f)}function c(f){return f===null||Be(f)?t(f):r(f)}}const SA={name:"hardBreakEscape",tokenize:_A};function _A(e,t,r){return s;function s(u){return e.enter("hardBreakEscape"),e.consume(u),l}function l(u){return Be(u)?(e.exit("hardBreakEscape"),t(u)):r(u)}}const kA={name:"headingAtx",resolve:EA,tokenize:CA};function EA(e,t){let r=e.length-2,s=3,l,u;return e[s][1].type==="whitespace"&&(s+=2),r-2>s&&e[r][1].type==="whitespace"&&(r-=2),e[r][1].type==="atxHeadingSequence"&&(s===r-1||r-4>s&&e[r-2][1].type==="whitespace")&&(r-=s+1===r?2:4),r>s&&(l={type:"atxHeadingText",start:e[s][1].start,end:e[r][1].end},u={type:"chunkText",start:e[s][1].start,end:e[r][1].end,contentType:"text"},Yn(e,s,r-s+1,[["enter",l,t],["enter",u,t],["exit",u,t],["exit",l,t]])),e}function CA(e,t,r){let s=0;return l;function l(y){return e.enter("atxHeading"),u(y)}function u(y){return e.enter("atxHeadingSequence"),c(y)}function c(y){return y===35&&s++<6?(e.consume(y),c):y===null||Tt(y)?(e.exit("atxHeadingSequence"),f(y)):r(y)}function f(y){return y===35?(e.enter("atxHeadingSequence"),m(y)):y===null||Be(y)?(e.exit("atxHeading"),t(y)):tt(y)?ot(e,f,"whitespace")(y):(e.enter("atxHeadingText"),d(y))}function m(y){return y===35?(e.consume(y),m):(e.exit("atxHeadingSequence"),f(y))}function d(y){return y===null||y===35||Tt(y)?(e.exit("atxHeadingText"),f(y)):(e.consume(y),d)}}const AA=["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"],fb=["pre","script","style","textarea"],TA={concrete:!0,name:"htmlFlow",resolveTo:OA,tokenize:RA},jA={partial:!0,tokenize:DA},NA={partial:!0,tokenize:MA};function OA(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function RA(e,t,r){const s=this;let l,u,c,f,m;return d;function d(A){return y(A)}function y(A){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(A),g}function g(A){return A===33?(e.consume(A),x):A===47?(e.consume(A),u=!0,R):A===63?(e.consume(A),l=3,s.interrupt?t:_):wn(A)?(e.consume(A),c=String.fromCharCode(A),B):r(A)}function x(A){return A===45?(e.consume(A),l=2,w):A===91?(e.consume(A),l=5,f=0,E):wn(A)?(e.consume(A),l=4,s.interrupt?t:_):r(A)}function w(A){return A===45?(e.consume(A),s.interrupt?t:_):r(A)}function E(A){const xe="CDATA[";return A===xe.charCodeAt(f++)?(e.consume(A),f===xe.length?s.interrupt?t:J:E):r(A)}function R(A){return wn(A)?(e.consume(A),c=String.fromCharCode(A),B):r(A)}function B(A){if(A===null||A===47||A===62||Tt(A)){const xe=A===47,_e=c.toLowerCase();return!xe&&!u&&fb.includes(_e)?(l=1,s.interrupt?t(A):J(A)):AA.includes(c.toLowerCase())?(l=6,xe?(e.consume(A),D):s.interrupt?t(A):J(A)):(l=7,s.interrupt&&!s.parser.lazy[s.now().line]?r(A):u?P(A):F(A))}return A===45||pn(A)?(e.consume(A),c+=String.fromCharCode(A),B):r(A)}function D(A){return A===62?(e.consume(A),s.interrupt?t:J):r(A)}function P(A){return tt(A)?(e.consume(A),P):O(A)}function F(A){return A===47?(e.consume(A),O):A===58||A===95||wn(A)?(e.consume(A),ue):tt(A)?(e.consume(A),F):O(A)}function ue(A){return A===45||A===46||A===58||A===95||pn(A)?(e.consume(A),ue):U(A)}function U(A){return A===61?(e.consume(A),M):tt(A)?(e.consume(A),U):F(A)}function M(A){return A===null||A===60||A===61||A===62||A===96?r(A):A===34||A===39?(e.consume(A),m=A,K):tt(A)?(e.consume(A),M):V(A)}function K(A){return A===m?(e.consume(A),m=null,q):A===null||Be(A)?r(A):(e.consume(A),K)}function V(A){return A===null||A===34||A===39||A===47||A===60||A===61||A===62||A===96||Tt(A)?U(A):(e.consume(A),V)}function q(A){return A===47||A===62||tt(A)?F(A):r(A)}function O(A){return A===62?(e.consume(A),X):r(A)}function X(A){return A===null||Be(A)?J(A):tt(A)?(e.consume(A),X):r(A)}function J(A){return A===45&&l===2?(e.consume(A),H):A===60&&l===1?(e.consume(A),ee):A===62&&l===4?(e.consume(A),L):A===63&&l===3?(e.consume(A),_):A===93&&l===5?(e.consume(A),be):Be(A)&&(l===6||l===7)?(e.exit("htmlFlowData"),e.check(jA,Q,le)(A)):A===null||Be(A)?(e.exit("htmlFlowData"),le(A)):(e.consume(A),J)}function le(A){return e.check(NA,te,Q)(A)}function te(A){return e.enter("lineEnding"),e.consume(A),e.exit("lineEnding"),$}function $(A){return A===null||Be(A)?le(A):(e.enter("htmlFlowData"),J(A))}function H(A){return A===45?(e.consume(A),_):J(A)}function ee(A){return A===47?(e.consume(A),c="",oe):J(A)}function oe(A){if(A===62){const xe=c.toLowerCase();return fb.includes(xe)?(e.consume(A),L):J(A)}return wn(A)&&c.length<8?(e.consume(A),c+=String.fromCharCode(A),oe):J(A)}function be(A){return A===93?(e.consume(A),_):J(A)}function _(A){return A===62?(e.consume(A),L):A===45&&l===2?(e.consume(A),_):J(A)}function L(A){return A===null||Be(A)?(e.exit("htmlFlowData"),Q(A)):(e.consume(A),L)}function Q(A){return e.exit("htmlFlow"),t(A)}}function MA(e,t,r){const s=this;return l;function l(c){return Be(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),u):r(c)}function u(c){return s.parser.lazy[s.now().line]?r(c):t(c)}}function DA(e,t,r){return s;function s(l){return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),e.attempt(Vl,t,r)}}const LA={name:"htmlText",tokenize:zA};function zA(e,t,r){const s=this;let l,u,c;return f;function f(_){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(_),m}function m(_){return _===33?(e.consume(_),d):_===47?(e.consume(_),U):_===63?(e.consume(_),F):wn(_)?(e.consume(_),V):r(_)}function d(_){return _===45?(e.consume(_),y):_===91?(e.consume(_),u=0,E):wn(_)?(e.consume(_),P):r(_)}function y(_){return _===45?(e.consume(_),w):r(_)}function g(_){return _===null?r(_):_===45?(e.consume(_),x):Be(_)?(c=g,ee(_)):(e.consume(_),g)}function x(_){return _===45?(e.consume(_),w):g(_)}function w(_){return _===62?H(_):_===45?x(_):g(_)}function E(_){const L="CDATA[";return _===L.charCodeAt(u++)?(e.consume(_),u===L.length?R:E):r(_)}function R(_){return _===null?r(_):_===93?(e.consume(_),B):Be(_)?(c=R,ee(_)):(e.consume(_),R)}function B(_){return _===93?(e.consume(_),D):R(_)}function D(_){return _===62?H(_):_===93?(e.consume(_),D):R(_)}function P(_){return _===null||_===62?H(_):Be(_)?(c=P,ee(_)):(e.consume(_),P)}function F(_){return _===null?r(_):_===63?(e.consume(_),ue):Be(_)?(c=F,ee(_)):(e.consume(_),F)}function ue(_){return _===62?H(_):F(_)}function U(_){return wn(_)?(e.consume(_),M):r(_)}function M(_){return _===45||pn(_)?(e.consume(_),M):K(_)}function K(_){return Be(_)?(c=K,ee(_)):tt(_)?(e.consume(_),K):H(_)}function V(_){return _===45||pn(_)?(e.consume(_),V):_===47||_===62||Tt(_)?q(_):r(_)}function q(_){return _===47?(e.consume(_),H):_===58||_===95||wn(_)?(e.consume(_),O):Be(_)?(c=q,ee(_)):tt(_)?(e.consume(_),q):H(_)}function O(_){return _===45||_===46||_===58||_===95||pn(_)?(e.consume(_),O):X(_)}function X(_){return _===61?(e.consume(_),J):Be(_)?(c=X,ee(_)):tt(_)?(e.consume(_),X):q(_)}function J(_){return _===null||_===60||_===61||_===62||_===96?r(_):_===34||_===39?(e.consume(_),l=_,le):Be(_)?(c=J,ee(_)):tt(_)?(e.consume(_),J):(e.consume(_),te)}function le(_){return _===l?(e.consume(_),l=void 0,$):_===null?r(_):Be(_)?(c=le,ee(_)):(e.consume(_),le)}function te(_){return _===null||_===34||_===39||_===60||_===61||_===96?r(_):_===47||_===62||Tt(_)?q(_):(e.consume(_),te)}function $(_){return _===47||_===62||Tt(_)?q(_):r(_)}function H(_){return _===62?(e.consume(_),e.exit("htmlTextData"),e.exit("htmlText"),t):r(_)}function ee(_){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(_),e.exit("lineEnding"),oe}function oe(_){return tt(_)?ot(e,be,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(_):be(_)}function be(_){return e.enter("htmlTextData"),c(_)}}const Qd={name:"labelEnd",resolveAll:qA,resolveTo:HA,tokenize:IA},UA={tokenize:FA},BA={tokenize:$A},PA={tokenize:YA};function qA(e){let t=-1;const r=[];for(;++t<e.length;){const s=e[t][1];if(r.push(e[t]),s.type==="labelImage"||s.type==="labelLink"||s.type==="labelEnd"){const l=s.type==="labelImage"?4:2;s.type="data",t+=l}}return e.length!==r.length&&Yn(e,0,e.length,r),e}function HA(e,t){let r=e.length,s=0,l,u,c,f;for(;r--;)if(l=e[r][1],u){if(l.type==="link"||l.type==="labelLink"&&l._inactive)break;e[r][0]==="enter"&&l.type==="labelLink"&&(l._inactive=!0)}else if(c){if(e[r][0]==="enter"&&(l.type==="labelImage"||l.type==="labelLink")&&!l._balanced&&(u=r,l.type!=="labelLink")){s=2;break}}else l.type==="labelEnd"&&(c=r);const m={type:e[u][1].type==="labelLink"?"link":"image",start:{...e[u][1].start},end:{...e[e.length-1][1].end}},d={type:"label",start:{...e[u][1].start},end:{...e[c][1].end}},y={type:"labelText",start:{...e[u+s+2][1].end},end:{...e[c-2][1].start}};return f=[["enter",m,t],["enter",d,t]],f=lr(f,e.slice(u+1,u+s+3)),f=lr(f,[["enter",y,t]]),f=lr(f,Wu(t.parser.constructs.insideSpan.null,e.slice(u+s+4,c-3),t)),f=lr(f,[["exit",y,t],e[c-2],e[c-1],["exit",d,t]]),f=lr(f,e.slice(c+1)),f=lr(f,[["exit",m,t]]),Yn(e,u,e.length,f),e}function IA(e,t,r){const s=this;let l=s.events.length,u,c;for(;l--;)if((s.events[l][1].type==="labelImage"||s.events[l][1].type==="labelLink")&&!s.events[l][1]._balanced){u=s.events[l][1];break}return f;function f(x){return u?u._inactive?g(x):(c=s.parser.defined.includes(xr(s.sliceSerialize({start:u.end,end:s.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(x),e.exit("labelMarker"),e.exit("labelEnd"),m):r(x)}function m(x){return x===40?e.attempt(UA,y,c?y:g)(x):x===91?e.attempt(BA,y,c?d:g)(x):c?y(x):g(x)}function d(x){return e.attempt(PA,y,g)(x)}function y(x){return t(x)}function g(x){return u._balanced=!0,r(x)}}function FA(e,t,r){return s;function s(g){return e.enter("resource"),e.enter("resourceMarker"),e.consume(g),e.exit("resourceMarker"),l}function l(g){return Tt(g)?Rl(e,u)(g):u(g)}function u(g){return g===41?y(g):s1(e,c,f,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(g)}function c(g){return Tt(g)?Rl(e,m)(g):y(g)}function f(g){return r(g)}function m(g){return g===34||g===39||g===40?l1(e,d,r,"resourceTitle","resourceTitleMarker","resourceTitleString")(g):y(g)}function d(g){return Tt(g)?Rl(e,y)(g):y(g)}function y(g){return g===41?(e.enter("resourceMarker"),e.consume(g),e.exit("resourceMarker"),e.exit("resource"),t):r(g)}}function $A(e,t,r){const s=this;return l;function l(f){return a1.call(s,e,u,c,"reference","referenceMarker","referenceString")(f)}function u(f){return s.parser.defined.includes(xr(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)))?t(f):r(f)}function c(f){return r(f)}}function YA(e,t,r){return s;function s(u){return e.enter("reference"),e.enter("referenceMarker"),e.consume(u),e.exit("referenceMarker"),l}function l(u){return u===93?(e.enter("referenceMarker"),e.consume(u),e.exit("referenceMarker"),e.exit("reference"),t):r(u)}}const GA={name:"labelStartImage",resolveAll:Qd.resolveAll,tokenize:VA};function VA(e,t,r){const s=this;return l;function l(f){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(f),e.exit("labelImageMarker"),u}function u(f){return f===91?(e.enter("labelMarker"),e.consume(f),e.exit("labelMarker"),e.exit("labelImage"),c):r(f)}function c(f){return f===94&&"_hiddenFootnoteSupport"in s.parser.constructs?r(f):t(f)}}const JA={name:"labelStartLink",resolveAll:Qd.resolveAll,tokenize:XA};function XA(e,t,r){const s=this;return l;function l(c){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(c),e.exit("labelMarker"),e.exit("labelLink"),u}function u(c){return c===94&&"_hiddenFootnoteSupport"in s.parser.constructs?r(c):t(c)}}const Uh={name:"lineEnding",tokenize:KA};function KA(e,t){return r;function r(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),ot(e,t,"linePrefix")}}const Eu={name:"thematicBreak",tokenize:QA};function QA(e,t,r){let s=0,l;return u;function u(d){return e.enter("thematicBreak"),c(d)}function c(d){return l=d,f(d)}function f(d){return d===l?(e.enter("thematicBreakSequence"),m(d)):s>=3&&(d===null||Be(d))?(e.exit("thematicBreak"),t(d)):r(d)}function m(d){return d===l?(e.consume(d),s++,m):(e.exit("thematicBreakSequence"),tt(d)?ot(e,f,"whitespace")(d):f(d))}}const Nn={continuation:{tokenize:tT},exit:rT,name:"list",tokenize:eT},ZA={partial:!0,tokenize:iT},WA={partial:!0,tokenize:nT};function eT(e,t,r){const s=this,l=s.events[s.events.length-1];let u=l&&l[1].type==="linePrefix"?l[2].sliceSerialize(l[1],!0).length:0,c=0;return f;function f(w){const E=s.containerState.type||(w===42||w===43||w===45?"listUnordered":"listOrdered");if(E==="listUnordered"?!s.containerState.marker||w===s.containerState.marker:bd(w)){if(s.containerState.type||(s.containerState.type=E,e.enter(E,{_container:!0})),E==="listUnordered")return e.enter("listItemPrefix"),w===42||w===45?e.check(Eu,r,d)(w):d(w);if(!s.interrupt||w===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),m(w)}return r(w)}function m(w){return bd(w)&&++c<10?(e.consume(w),m):(!s.interrupt||c<2)&&(s.containerState.marker?w===s.containerState.marker:w===41||w===46)?(e.exit("listItemValue"),d(w)):r(w)}function d(w){return e.enter("listItemMarker"),e.consume(w),e.exit("listItemMarker"),s.containerState.marker=s.containerState.marker||w,e.check(Vl,s.interrupt?r:y,e.attempt(ZA,x,g))}function y(w){return s.containerState.initialBlankLine=!0,u++,x(w)}function g(w){return tt(w)?(e.enter("listItemPrefixWhitespace"),e.consume(w),e.exit("listItemPrefixWhitespace"),x):r(w)}function x(w){return s.containerState.size=u+s.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(w)}}function tT(e,t,r){const s=this;return s.containerState._closeFlow=void 0,e.check(Vl,l,u);function l(f){return s.containerState.furtherBlankLines=s.containerState.furtherBlankLines||s.containerState.initialBlankLine,ot(e,t,"listItemIndent",s.containerState.size+1)(f)}function u(f){return s.containerState.furtherBlankLines||!tt(f)?(s.containerState.furtherBlankLines=void 0,s.containerState.initialBlankLine=void 0,c(f)):(s.containerState.furtherBlankLines=void 0,s.containerState.initialBlankLine=void 0,e.attempt(WA,t,c)(f))}function c(f){return s.containerState._closeFlow=!0,s.interrupt=void 0,ot(e,e.attempt(Nn,t,r),"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(f)}}function nT(e,t,r){const s=this;return ot(e,l,"listItemIndent",s.containerState.size+1);function l(u){const c=s.events[s.events.length-1];return c&&c[1].type==="listItemIndent"&&c[2].sliceSerialize(c[1],!0).length===s.containerState.size?t(u):r(u)}}function rT(e){e.exit(this.containerState.type)}function iT(e,t,r){const s=this;return ot(e,l,"listItemPrefixWhitespace",s.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function l(u){const c=s.events[s.events.length-1];return!tt(u)&&c&&c[1].type==="listItemPrefixWhitespace"?t(u):r(u)}}const hb={name:"setextUnderline",resolveTo:sT,tokenize:aT};function sT(e,t){let r=e.length,s,l,u;for(;r--;)if(e[r][0]==="enter"){if(e[r][1].type==="content"){s=r;break}e[r][1].type==="paragraph"&&(l=r)}else e[r][1].type==="content"&&e.splice(r,1),!u&&e[r][1].type==="definition"&&(u=r);const c={type:"setextHeading",start:{...e[s][1].start},end:{...e[e.length-1][1].end}};return e[l][1].type="setextHeadingText",u?(e.splice(l,0,["enter",c,t]),e.splice(u+1,0,["exit",e[s][1],t]),e[s][1].end={...e[u][1].end}):e[s][1]=c,e.push(["exit",c,t]),e}function aT(e,t,r){const s=this;let l;return u;function u(d){let y=s.events.length,g;for(;y--;)if(s.events[y][1].type!=="lineEnding"&&s.events[y][1].type!=="linePrefix"&&s.events[y][1].type!=="content"){g=s.events[y][1].type==="paragraph";break}return!s.parser.lazy[s.now().line]&&(s.interrupt||g)?(e.enter("setextHeadingLine"),l=d,c(d)):r(d)}function c(d){return e.enter("setextHeadingLineSequence"),f(d)}function f(d){return d===l?(e.consume(d),f):(e.exit("setextHeadingLineSequence"),tt(d)?ot(e,m,"lineSuffix")(d):m(d))}function m(d){return d===null||Be(d)?(e.exit("setextHeadingLine"),t(d)):r(d)}}const lT={tokenize:oT};function oT(e){const t=this,r=e.attempt(Vl,s,e.attempt(this.parser.constructs.flowInitial,l,ot(e,e.attempt(this.parser.constructs.flow,l,e.attempt(dA,l)),"linePrefix")));return r;function s(u){if(u===null){e.consume(u);return}return e.enter("lineEndingBlank"),e.consume(u),e.exit("lineEndingBlank"),t.currentConstruct=void 0,r}function l(u){if(u===null){e.consume(u);return}return e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),t.currentConstruct=void 0,r}}const uT={resolveAll:u1()},cT=o1("string"),fT=o1("text");function o1(e){return{resolveAll:u1(e==="text"?hT:void 0),tokenize:t};function t(r){const s=this,l=this.parser.constructs[e],u=r.attempt(l,c,f);return c;function c(y){return d(y)?u(y):f(y)}function f(y){if(y===null){r.consume(y);return}return r.enter("data"),r.consume(y),m}function m(y){return d(y)?(r.exit("data"),u(y)):(r.consume(y),m)}function d(y){if(y===null)return!0;const g=l[y];let x=-1;if(g)for(;++x<g.length;){const w=g[x];if(!w.previous||w.previous.call(s,s.previous))return!0}return!1}}}function u1(e){return t;function t(r,s){let l=-1,u;for(;++l<=r.length;)u===void 0?r[l]&&r[l][1].type==="data"&&(u=l,l++):(!r[l]||r[l][1].type!=="data")&&(l!==u+2&&(r[u][1].end=r[l-1][1].end,r.splice(u+2,l-u-2),l=u+2),u=void 0);return e?e(r,s):r}}function hT(e,t){let r=0;for(;++r<=e.length;)if((r===e.length||e[r][1].type==="lineEnding")&&e[r-1][1].type==="data"){const s=e[r-1][1],l=t.sliceStream(s);let u=l.length,c=-1,f=0,m;for(;u--;){const d=l[u];if(typeof d=="string"){for(c=d.length;d.charCodeAt(c-1)===32;)f++,c--;if(c)break;c=-1}else if(d===-2)m=!0,f++;else if(d!==-1){u++;break}}if(t._contentTypeTextTrailing&&r===e.length&&(f=0),f){const d={type:r===e.length||m||f<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:u?c:s.start._bufferIndex+c,_index:s.start._index+u,line:s.end.line,column:s.end.column-f,offset:s.end.offset-f},end:{...s.end}};s.end={...d.start},s.start.offset===s.end.offset?Object.assign(s,d):(e.splice(r,0,["enter",d,t],["exit",d,t]),r+=2)}r++}return e}const dT={42:Nn,43:Nn,45:Nn,48:Nn,49:Nn,50:Nn,51:Nn,52:Nn,53:Nn,54:Nn,55:Nn,56:Nn,57:Nn,62:t1},mT={91:bA},pT={[-2]:zh,[-1]:zh,32:zh},gT={35:kA,42:Eu,45:[hb,Eu],60:TA,61:hb,95:Eu,96:cb,126:cb},yT={38:r1,92:n1},bT={[-5]:Uh,[-4]:Uh,[-3]:Uh,33:GA,38:r1,42:xd,60:[JC,LA],91:JA,92:[SA,n1],93:Qd,95:xd,96:lA},xT={null:[xd,uT]},vT={null:[42,95]},wT={null:[]},ST=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:vT,contentInitial:mT,disable:wT,document:dT,flow:gT,flowInitial:pT,insideSpan:xT,string:yT,text:bT},Symbol.toStringTag,{value:"Module"}));function _T(e,t,r){let s={_bufferIndex:-1,_index:0,line:r&&r.line||1,column:r&&r.column||1,offset:r&&r.offset||0};const l={},u=[];let c=[],f=[];const m={attempt:K(U),check:K(M),consume:P,enter:F,exit:ue,interrupt:K(M,{interrupt:!0})},d={code:null,containerState:{},defineSkip:R,events:[],now:E,parser:e,previous:null,sliceSerialize:x,sliceStream:w,write:g};let y=t.tokenize.call(d,m);return t.resolveAll&&u.push(t),d;function g(X){return c=lr(c,X),B(),c[c.length-1]!==null?[]:(V(t,0),d.events=Wu(u,d.events,d),d.events)}function x(X,J){return ET(w(X),J)}function w(X){return kT(c,X)}function E(){const{_bufferIndex:X,_index:J,line:le,column:te,offset:$}=s;return{_bufferIndex:X,_index:J,line:le,column:te,offset:$}}function R(X){l[X.line]=X.column,O()}function B(){let X;for(;s._index<c.length;){const J=c[s._index];if(typeof J=="string")for(X=s._index,s._bufferIndex<0&&(s._bufferIndex=0);s._index===X&&s._bufferIndex<J.length;)D(J.charCodeAt(s._bufferIndex));else D(J)}}function D(X){y=y(X)}function P(X){Be(X)?(s.line++,s.column=1,s.offset+=X===-3?2:1,O()):X!==-1&&(s.column++,s.offset++),s._bufferIndex<0?s._index++:(s._bufferIndex++,s._bufferIndex===c[s._index].length&&(s._bufferIndex=-1,s._index++)),d.previous=X}function F(X,J){const le=J||{};return le.type=X,le.start=E(),d.events.push(["enter",le,d]),f.push(le),le}function ue(X){const J=f.pop();return J.end=E(),d.events.push(["exit",J,d]),J}function U(X,J){V(X,J.from)}function M(X,J){J.restore()}function K(X,J){return le;function le(te,$,H){let ee,oe,be,_;return Array.isArray(te)?Q(te):"tokenize"in te?Q([te]):L(te);function L(Te){return Le;function Le($e){const Ce=$e!==null&&Te[$e],Ne=$e!==null&&Te.null,je=[...Array.isArray(Ce)?Ce:Ce?[Ce]:[],...Array.isArray(Ne)?Ne:Ne?[Ne]:[]];return Q(je)($e)}}function Q(Te){return ee=Te,oe=0,Te.length===0?H:A(Te[oe])}function A(Te){return Le;function Le($e){return _=q(),be=Te,Te.partial||(d.currentConstruct=Te),Te.name&&d.parser.constructs.disable.null.includes(Te.name)?_e():Te.tokenize.call(J?Object.assign(Object.create(d),J):d,m,xe,_e)($e)}}function xe(Te){return X(be,_),$}function _e(Te){return _.restore(),++oe<ee.length?A(ee[oe]):H}}}function V(X,J){X.resolveAll&&!u.includes(X)&&u.push(X),X.resolve&&Yn(d.events,J,d.events.length-J,X.resolve(d.events.slice(J),d)),X.resolveTo&&(d.events=X.resolveTo(d.events,d))}function q(){const X=E(),J=d.previous,le=d.currentConstruct,te=d.events.length,$=Array.from(f);return{from:te,restore:H};function H(){s=X,d.previous=J,d.currentConstruct=le,d.events.length=te,f=$,O()}}function O(){s.line in l&&s.column<2&&(s.column=l[s.line],s.offset+=l[s.line]-1)}}function kT(e,t){const r=t.start._index,s=t.start._bufferIndex,l=t.end._index,u=t.end._bufferIndex;let c;if(r===l)c=[e[r].slice(s,u)];else{if(c=e.slice(r,l),s>-1){const f=c[0];typeof f=="string"?c[0]=f.slice(s):c.shift()}u>0&&c.push(e[l].slice(0,u))}return c}function ET(e,t){let r=-1;const s=[];let l;for(;++r<e.length;){const u=e[r];let c;if(typeof u=="string")c=u;else switch(u){case-5:{c="\r";break}case-4:{c=`
|
|
94
|
-
`;break}case-3:{c=`\r
|
|
95
|
-
`;break}case-2:{c=t?" ":" ";break}case-1:{if(!t&&l)continue;c=" ";break}default:c=String.fromCharCode(u)}l=u===-2,s.push(c)}return s.join("")}function CT(e){const s={constructs:Wx([ST,...(e||{}).extensions||[]]),content:l(HC),defined:[],document:l(FC),flow:l(lT),lazy:{},string:l(cT),text:l(fT)};return s;function l(u){return c;function c(f){return _T(s,u,f)}}}function AT(e){for(;!i1(e););return e}const db=/[\0\t\n\r]/g;function TT(){let e=1,t="",r=!0,s;return l;function l(u,c,f){const m=[];let d,y,g,x,w;for(u=t+(typeof u=="string"?u.toString():new TextDecoder(c||void 0).decode(u)),g=0,t="",r&&(u.charCodeAt(0)===65279&&g++,r=void 0);g<u.length;){if(db.lastIndex=g,d=db.exec(u),x=d&&d.index!==void 0?d.index:u.length,w=u.charCodeAt(x),!d){t=u.slice(g);break}if(w===10&&g===x&&s)m.push(-3),s=void 0;else switch(s&&(m.push(-5),s=void 0),g<x&&(m.push(u.slice(g,x)),e+=x-g),w){case 0:{m.push(65533),e++;break}case 9:{for(y=Math.ceil(e/4)*4,m.push(-2);e++<y;)m.push(-1);break}case 10:{m.push(-4),e=1;break}default:s=!0,e=1}g=x+1}return f&&(s&&m.push(-5),t&&m.push(t),m.push(null)),m}}const jT=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function NT(e){return e.replace(jT,OT)}function OT(e,t,r){if(t)return t;if(r.charCodeAt(0)===35){const l=r.charCodeAt(1),u=l===120||l===88;return e1(r.slice(u?2:1),u?16:10)}return Kd(r)||e}const c1={}.hasOwnProperty;function RT(e,t,r){return t&&typeof t=="object"&&(r=t,t=void 0),MT(r)(AT(CT(r).document().write(TT()(e,t,!0))))}function MT(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:u(nt),autolinkProtocol:q,autolinkEmail:q,atxHeading:u(ct),blockQuote:u(Ne),characterEscape:q,characterReference:q,codeFenced:u(je),codeFencedFenceInfo:c,codeFencedFenceMeta:c,codeIndented:u(je,c),codeText:u(Fe,c),codeTextData:q,data:q,codeFlowValue:q,definition:u(Qe),definitionDestinationString:c,definitionLabelString:c,definitionTitleString:c,emphasis:u(qe),hardBreakEscape:u(vt),hardBreakTrailing:u(vt),htmlFlow:u(Ve,c),htmlFlowData:q,htmlText:u(Ve,c),htmlTextData:q,image:u(He),label:c,link:u(nt),listItem:u(rt),listItemValue:x,listOrdered:u(ft,g),listUnordered:u(ft),paragraph:u(qt),reference:A,referenceString:c,resourceDestinationString:c,resourceTitleString:c,setextHeading:u(ct),strong:u(jt),thematicBreak:u(Fi)},exit:{atxHeading:m(),atxHeadingSequence:U,autolink:m(),autolinkEmail:Ce,autolinkProtocol:$e,blockQuote:m(),characterEscapeValue:O,characterReferenceMarkerHexadecimal:_e,characterReferenceMarkerNumeric:_e,characterReferenceValue:Te,characterReference:Le,codeFenced:m(B),codeFencedFence:R,codeFencedFenceInfo:w,codeFencedFenceMeta:E,codeFlowValue:O,codeIndented:m(D),codeText:m($),codeTextData:O,data:O,definition:m(),definitionDestinationString:ue,definitionLabelString:P,definitionTitleString:F,emphasis:m(),hardBreakEscape:m(J),hardBreakTrailing:m(J),htmlFlow:m(le),htmlFlowData:O,htmlText:m(te),htmlTextData:O,image:m(ee),label:be,labelText:oe,lineEnding:X,link:m(H),listItem:m(),listOrdered:m(),listUnordered:m(),paragraph:m(),referenceString:xe,resourceDestinationString:_,resourceTitleString:L,resource:Q,setextHeading:m(V),setextHeadingLineSequence:K,setextHeadingText:M,strong:m(),thematicBreak:m()}};f1(t,(e||{}).mdastExtensions||[]);const r={};return s;function s(fe){let ve={type:"root",children:[]};const Ue={stack:[ve],tokenStack:[],config:t,enter:f,exit:d,buffer:c,resume:y,data:r},Je=[];let lt=-1;for(;++lt<fe.length;)if(fe[lt][1].type==="listOrdered"||fe[lt][1].type==="listUnordered")if(fe[lt][0]==="enter")Je.push(lt);else{const nn=Je.pop();lt=l(fe,nn,lt)}for(lt=-1;++lt<fe.length;){const nn=t[fe[lt][0]];c1.call(nn,fe[lt][1].type)&&nn[fe[lt][1].type].call(Object.assign({sliceSerialize:fe[lt][2].sliceSerialize},Ue),fe[lt][1])}if(Ue.tokenStack.length>0){const nn=Ue.tokenStack[Ue.tokenStack.length-1];(nn[1]||mb).call(Ue,void 0,nn[0])}for(ve.position={start:Ri(fe.length>0?fe[0][1].start:{line:1,column:1,offset:0}),end:Ri(fe.length>0?fe[fe.length-2][1].end:{line:1,column:1,offset:0})},lt=-1;++lt<t.transforms.length;)ve=t.transforms[lt](ve)||ve;return ve}function l(fe,ve,Ue){let Je=ve-1,lt=-1,nn=!1,_n,Wt,yt,Ht;for(;++Je<=Ue;){const de=fe[Je];switch(de[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{de[0]==="enter"?lt++:lt--,Ht=void 0;break}case"lineEndingBlank":{de[0]==="enter"&&(_n&&!Ht&&!lt&&!yt&&(yt=Je),Ht=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Ht=void 0}if(!lt&&de[0]==="enter"&&de[1].type==="listItemPrefix"||lt===-1&&de[0]==="exit"&&(de[1].type==="listUnordered"||de[1].type==="listOrdered")){if(_n){let Ie=Je;for(Wt=void 0;Ie--;){const Ae=fe[Ie];if(Ae[1].type==="lineEnding"||Ae[1].type==="lineEndingBlank"){if(Ae[0]==="exit")continue;Wt&&(fe[Wt][1].type="lineEndingBlank",nn=!0),Ae[1].type="lineEnding",Wt=Ie}else if(!(Ae[1].type==="linePrefix"||Ae[1].type==="blockQuotePrefix"||Ae[1].type==="blockQuotePrefixWhitespace"||Ae[1].type==="blockQuoteMarker"||Ae[1].type==="listItemIndent"))break}yt&&(!Wt||yt<Wt)&&(_n._spread=!0),_n.end=Object.assign({},Wt?fe[Wt][1].start:de[1].end),fe.splice(Wt||Je,0,["exit",_n,de[2]]),Je++,Ue++}if(de[1].type==="listItemPrefix"){const Ie={type:"listItem",_spread:!1,start:Object.assign({},de[1].start),end:void 0};_n=Ie,fe.splice(Je,0,["enter",Ie,de[2]]),Je++,Ue++,yt=void 0,Ht=!0}}}return fe[ve][1]._spread=nn,Ue}function u(fe,ve){return Ue;function Ue(Je){f.call(this,fe(Je),Je),ve&&ve.call(this,Je)}}function c(){this.stack.push({type:"fragment",children:[]})}function f(fe,ve,Ue){this.stack[this.stack.length-1].children.push(fe),this.stack.push(fe),this.tokenStack.push([ve,Ue||void 0]),fe.position={start:Ri(ve.start),end:void 0}}function m(fe){return ve;function ve(Ue){fe&&fe.call(this,Ue),d.call(this,Ue)}}function d(fe,ve){const Ue=this.stack.pop(),Je=this.tokenStack.pop();if(Je)Je[0].type!==fe.type&&(ve?ve.call(this,fe,Je[0]):(Je[1]||mb).call(this,fe,Je[0]));else throw new Error("Cannot close `"+fe.type+"` ("+Ol({start:fe.start,end:fe.end})+"): it’s not open");Ue.position.end=Ri(fe.end)}function y(){return Xd(this.stack.pop())}function g(){this.data.expectingFirstListItemValue=!0}function x(fe){if(this.data.expectingFirstListItemValue){const ve=this.stack[this.stack.length-2];ve.start=Number.parseInt(this.sliceSerialize(fe),10),this.data.expectingFirstListItemValue=void 0}}function w(){const fe=this.resume(),ve=this.stack[this.stack.length-1];ve.lang=fe}function E(){const fe=this.resume(),ve=this.stack[this.stack.length-1];ve.meta=fe}function R(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function B(){const fe=this.resume(),ve=this.stack[this.stack.length-1];ve.value=fe.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function D(){const fe=this.resume(),ve=this.stack[this.stack.length-1];ve.value=fe.replace(/(\r?\n|\r)$/g,"")}function P(fe){const ve=this.resume(),Ue=this.stack[this.stack.length-1];Ue.label=ve,Ue.identifier=xr(this.sliceSerialize(fe)).toLowerCase()}function F(){const fe=this.resume(),ve=this.stack[this.stack.length-1];ve.title=fe}function ue(){const fe=this.resume(),ve=this.stack[this.stack.length-1];ve.url=fe}function U(fe){const ve=this.stack[this.stack.length-1];if(!ve.depth){const Ue=this.sliceSerialize(fe).length;ve.depth=Ue}}function M(){this.data.setextHeadingSlurpLineEnding=!0}function K(fe){const ve=this.stack[this.stack.length-1];ve.depth=this.sliceSerialize(fe).codePointAt(0)===61?1:2}function V(){this.data.setextHeadingSlurpLineEnding=void 0}function q(fe){const Ue=this.stack[this.stack.length-1].children;let Je=Ue[Ue.length-1];(!Je||Je.type!=="text")&&(Je=ht(),Je.position={start:Ri(fe.start),end:void 0},Ue.push(Je)),this.stack.push(Je)}function O(fe){const ve=this.stack.pop();ve.value+=this.sliceSerialize(fe),ve.position.end=Ri(fe.end)}function X(fe){const ve=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Ue=ve.children[ve.children.length-1];Ue.position.end=Ri(fe.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(ve.type)&&(q.call(this,fe),O.call(this,fe))}function J(){this.data.atHardBreak=!0}function le(){const fe=this.resume(),ve=this.stack[this.stack.length-1];ve.value=fe}function te(){const fe=this.resume(),ve=this.stack[this.stack.length-1];ve.value=fe}function $(){const fe=this.resume(),ve=this.stack[this.stack.length-1];ve.value=fe}function H(){const fe=this.stack[this.stack.length-1];if(this.data.inReference){const ve=this.data.referenceType||"shortcut";fe.type+="Reference",fe.referenceType=ve,delete fe.url,delete fe.title}else delete fe.identifier,delete fe.label;this.data.referenceType=void 0}function ee(){const fe=this.stack[this.stack.length-1];if(this.data.inReference){const ve=this.data.referenceType||"shortcut";fe.type+="Reference",fe.referenceType=ve,delete fe.url,delete fe.title}else delete fe.identifier,delete fe.label;this.data.referenceType=void 0}function oe(fe){const ve=this.sliceSerialize(fe),Ue=this.stack[this.stack.length-2];Ue.label=NT(ve),Ue.identifier=xr(ve).toLowerCase()}function be(){const fe=this.stack[this.stack.length-1],ve=this.resume(),Ue=this.stack[this.stack.length-1];if(this.data.inReference=!0,Ue.type==="link"){const Je=fe.children;Ue.children=Je}else Ue.alt=ve}function _(){const fe=this.resume(),ve=this.stack[this.stack.length-1];ve.url=fe}function L(){const fe=this.resume(),ve=this.stack[this.stack.length-1];ve.title=fe}function Q(){this.data.inReference=void 0}function A(){this.data.referenceType="collapsed"}function xe(fe){const ve=this.resume(),Ue=this.stack[this.stack.length-1];Ue.label=ve,Ue.identifier=xr(this.sliceSerialize(fe)).toLowerCase(),this.data.referenceType="full"}function _e(fe){this.data.characterReferenceType=fe.type}function Te(fe){const ve=this.sliceSerialize(fe),Ue=this.data.characterReferenceType;let Je;Ue?(Je=e1(ve,Ue==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Je=Kd(ve);const lt=this.stack[this.stack.length-1];lt.value+=Je}function Le(fe){const ve=this.stack.pop();ve.position.end=Ri(fe.end)}function $e(fe){O.call(this,fe);const ve=this.stack[this.stack.length-1];ve.url=this.sliceSerialize(fe)}function Ce(fe){O.call(this,fe);const ve=this.stack[this.stack.length-1];ve.url="mailto:"+this.sliceSerialize(fe)}function Ne(){return{type:"blockquote",children:[]}}function je(){return{type:"code",lang:null,meta:null,value:""}}function Fe(){return{type:"inlineCode",value:""}}function Qe(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function qe(){return{type:"emphasis",children:[]}}function ct(){return{type:"heading",depth:0,children:[]}}function vt(){return{type:"break"}}function Ve(){return{type:"html",value:""}}function He(){return{type:"image",title:null,url:"",alt:null}}function nt(){return{type:"link",title:null,url:"",children:[]}}function ft(fe){return{type:"list",ordered:fe.type==="listOrdered",start:null,spread:fe._spread,children:[]}}function rt(fe){return{type:"listItem",spread:fe._spread,checked:null,children:[]}}function qt(){return{type:"paragraph",children:[]}}function jt(){return{type:"strong",children:[]}}function ht(){return{type:"text",value:""}}function Fi(){return{type:"thematicBreak"}}}function Ri(e){return{line:e.line,column:e.column,offset:e.offset}}function f1(e,t){let r=-1;for(;++r<t.length;){const s=t[r];Array.isArray(s)?f1(e,s):DT(e,s)}}function DT(e,t){let r;for(r in t)if(c1.call(t,r))switch(r){case"canContainEols":{const s=t[r];s&&e[r].push(...s);break}case"transforms":{const s=t[r];s&&e[r].push(...s);break}case"enter":case"exit":{const s=t[r];s&&Object.assign(e[r],s);break}}}function mb(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Ol({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Ol({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Ol({start:t.start,end:t.end})+") is still open")}function LT(e){const t=this;t.parser=r;function r(s){return RT(s,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function zT(e,t){const r={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,r),e.applyData(t,r)}function UT(e,t){const r={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,r),[e.applyData(t,r),{type:"text",value:`
|
|
96
|
-
`}]}function BT(e,t){const r=t.value?t.value+`
|
|
97
|
-
`:"",s={},l=t.lang?t.lang.split(/\s+/):[];l.length>0&&(s.className=["language-"+l[0]]);let u={type:"element",tagName:"code",properties:s,children:[{type:"text",value:r}]};return t.meta&&(u.data={meta:t.meta}),e.patch(t,u),u=e.applyData(t,u),u={type:"element",tagName:"pre",properties:{},children:[u]},e.patch(t,u),u}function PT(e,t){const r={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function qT(e,t){const r={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function HT(e,t){const r=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",s=String(t.identifier).toUpperCase(),l=ka(s.toLowerCase()),u=e.footnoteOrder.indexOf(s);let c,f=e.footnoteCounts.get(s);f===void 0?(f=0,e.footnoteOrder.push(s),c=e.footnoteOrder.length):c=u+1,f+=1,e.footnoteCounts.set(s,f);const m={type:"element",tagName:"a",properties:{href:"#"+r+"fn-"+l,id:r+"fnref-"+l+(f>1?"-"+f:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(c)}]};e.patch(t,m);const d={type:"element",tagName:"sup",properties:{},children:[m]};return e.patch(t,d),e.applyData(t,d)}function IT(e,t){const r={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function FT(e,t){if(e.options.allowDangerousHtml){const r={type:"raw",value:t.value};return e.patch(t,r),e.applyData(t,r)}}function h1(e,t){const r=t.referenceType;let s="]";if(r==="collapsed"?s+="[]":r==="full"&&(s+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+s}];const l=e.all(t),u=l[0];u&&u.type==="text"?u.value="["+u.value:l.unshift({type:"text",value:"["});const c=l[l.length-1];return c&&c.type==="text"?c.value+=s:l.push({type:"text",value:s}),l}function $T(e,t){const r=String(t.identifier).toUpperCase(),s=e.definitionById.get(r);if(!s)return h1(e,t);const l={src:ka(s.url||""),alt:t.alt};s.title!==null&&s.title!==void 0&&(l.title=s.title);const u={type:"element",tagName:"img",properties:l,children:[]};return e.patch(t,u),e.applyData(t,u)}function YT(e,t){const r={src:ka(t.url)};t.alt!==null&&t.alt!==void 0&&(r.alt=t.alt),t.title!==null&&t.title!==void 0&&(r.title=t.title);const s={type:"element",tagName:"img",properties:r,children:[]};return e.patch(t,s),e.applyData(t,s)}function GT(e,t){const r={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,r);const s={type:"element",tagName:"code",properties:{},children:[r]};return e.patch(t,s),e.applyData(t,s)}function VT(e,t){const r=String(t.identifier).toUpperCase(),s=e.definitionById.get(r);if(!s)return h1(e,t);const l={href:ka(s.url||"")};s.title!==null&&s.title!==void 0&&(l.title=s.title);const u={type:"element",tagName:"a",properties:l,children:e.all(t)};return e.patch(t,u),e.applyData(t,u)}function JT(e,t){const r={href:ka(t.url)};t.title!==null&&t.title!==void 0&&(r.title=t.title);const s={type:"element",tagName:"a",properties:r,children:e.all(t)};return e.patch(t,s),e.applyData(t,s)}function XT(e,t,r){const s=e.all(t),l=r?KT(r):d1(t),u={},c=[];if(typeof t.checked=="boolean"){const y=s[0];let g;y&&y.type==="element"&&y.tagName==="p"?g=y:(g={type:"element",tagName:"p",properties:{},children:[]},s.unshift(g)),g.children.length>0&&g.children.unshift({type:"text",value:" "}),g.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),u.className=["task-list-item"]}let f=-1;for(;++f<s.length;){const y=s[f];(l||f!==0||y.type!=="element"||y.tagName!=="p")&&c.push({type:"text",value:`
|
|
98
|
-
`}),y.type==="element"&&y.tagName==="p"&&!l?c.push(...y.children):c.push(y)}const m=s[s.length-1];m&&(l||m.type!=="element"||m.tagName!=="p")&&c.push({type:"text",value:`
|
|
99
|
-
`});const d={type:"element",tagName:"li",properties:u,children:c};return e.patch(t,d),e.applyData(t,d)}function KT(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const r=e.children;let s=-1;for(;!t&&++s<r.length;)t=d1(r[s])}return t}function d1(e){const t=e.spread;return t??e.children.length>1}function QT(e,t){const r={},s=e.all(t);let l=-1;for(typeof t.start=="number"&&t.start!==1&&(r.start=t.start);++l<s.length;){const c=s[l];if(c.type==="element"&&c.tagName==="li"&&c.properties&&Array.isArray(c.properties.className)&&c.properties.className.includes("task-list-item")){r.className=["contains-task-list"];break}}const u={type:"element",tagName:t.ordered?"ol":"ul",properties:r,children:e.wrap(s,!0)};return e.patch(t,u),e.applyData(t,u)}function ZT(e,t){const r={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function WT(e,t){const r={type:"root",children:e.wrap(e.all(t))};return e.patch(t,r),e.applyData(t,r)}function ej(e,t){const r={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function tj(e,t){const r=e.all(t),s=r.shift(),l=[];if(s){const c={type:"element",tagName:"thead",properties:{},children:e.wrap([s],!0)};e.patch(t.children[0],c),l.push(c)}if(r.length>0){const c={type:"element",tagName:"tbody",properties:{},children:e.wrap(r,!0)},f=Yd(t.children[1]),m=Gx(t.children[t.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(t,u),e.applyData(t,u)}function nj(e,t,r){const s=r?r.children:void 0,u=(s?s.indexOf(t):1)===0?"th":"td",c=r&&r.type==="table"?r.align:void 0,f=c?c.length:t.children.length;let m=-1;const d=[];for(;++m<f;){const g=t.children[m],x={},w=c?c[m]:void 0;w&&(x.align=w);let E={type:"element",tagName:u,properties:x,children:[]};g&&(E.children=e.all(g),e.patch(g,E),E=e.applyData(g,E)),d.push(E)}const y={type:"element",tagName:"tr",properties:{},children:e.wrap(d,!0)};return e.patch(t,y),e.applyData(t,y)}function rj(e,t){const r={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}const pb=9,gb=32;function ij(e){const t=String(e),r=/\r?\n|\r/g;let s=r.exec(t),l=0;const u=[];for(;s;)u.push(yb(t.slice(l,s.index),l>0,!0),s[0]),l=s.index+s[0].length,s=r.exec(t);return u.push(yb(t.slice(l),l>0,!1)),u.join("")}function yb(e,t,r){let s=0,l=e.length;if(t){let u=e.codePointAt(s);for(;u===pb||u===gb;)s++,u=e.codePointAt(s)}if(r){let u=e.codePointAt(l-1);for(;u===pb||u===gb;)l--,u=e.codePointAt(l-1)}return l>s?e.slice(s,l):""}function sj(e,t){const r={type:"text",value:ij(String(t.value))};return e.patch(t,r),e.applyData(t,r)}function aj(e,t){const r={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,r),e.applyData(t,r)}const lj={blockquote:zT,break:UT,code:BT,delete:PT,emphasis:qT,footnoteReference:HT,heading:IT,html:FT,imageReference:$T,image:YT,inlineCode:GT,linkReference:VT,link:JT,listItem:XT,list:QT,paragraph:ZT,root:WT,strong:ej,table:tj,tableCell:rj,tableRow:nj,text:sj,thematicBreak:aj,toml:pu,yaml:pu,definition:pu,footnoteDefinition:pu};function pu(){}const m1=-1,ec=0,Ml=1,qu=2,Zd=3,Wd=4,em=5,tm=6,p1=7,g1=8,bb=typeof self=="object"?self:globalThis,oj=(e,t)=>{const r=(l,u)=>(e.set(u,l),l),s=l=>{if(e.has(l))return e.get(l);const[u,c]=t[l];switch(u){case ec:case m1:return r(c,l);case Ml:{const f=r([],l);for(const m of c)f.push(s(m));return f}case qu:{const f=r({},l);for(const[m,d]of c)f[s(m)]=s(d);return f}case Zd:return r(new Date(c),l);case Wd:{const{source:f,flags:m}=c;return r(new RegExp(f,m),l)}case em:{const f=r(new Map,l);for(const[m,d]of c)f.set(s(m),s(d));return f}case tm:{const f=r(new Set,l);for(const m of c)f.add(s(m));return f}case p1:{const{name:f,message:m}=c;return r(new bb[f](m),l)}case g1: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 bb[u](c),l)};return s},xb=e=>oj(new Map,e)(0),ta="",{toString:uj}={},{keys:cj}=Object,_l=e=>{const t=typeof e;if(t!=="object"||!e)return[ec,t];const r=uj.call(e).slice(8,-1);switch(r){case"Array":return[Ml,ta];case"Object":return[qu,ta];case"Date":return[Zd,ta];case"RegExp":return[Wd,ta];case"Map":return[em,ta];case"Set":return[tm,ta];case"DataView":return[Ml,r]}return r.includes("Array")?[Ml,r]:r.includes("Error")?[p1,r]:[qu,r]},gu=([e,t])=>e===ec&&(t==="function"||t==="symbol"),fj=(e,t,r,s)=>{const l=(c,f)=>{const m=s.push(c)-1;return r.set(f,m),m},u=c=>{if(r.has(c))return r.get(c);let[f,m]=_l(c);switch(f){case ec:{let y=c;switch(m){case"bigint":f=g1,y=c.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+m);y=null;break;case"undefined":return l([m1],c)}return l([f,y],c)}case Ml:{if(m){let x=c;return m==="DataView"?x=new Uint8Array(c.buffer):m==="ArrayBuffer"&&(x=new Uint8Array(c)),l([m,[...x]],c)}const y=[],g=l([f,y],c);for(const x of c)y.push(u(x));return g}case qu:{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(t&&"toJSON"in c)return u(c.toJSON());const y=[],g=l([f,y],c);for(const x of cj(c))(e||!gu(_l(c[x])))&&y.push([u(x),u(c[x])]);return g}case Zd:return l([f,c.toISOString()],c);case Wd:{const{source:y,flags:g}=c;return l([f,{source:y,flags:g}],c)}case em:{const y=[],g=l([f,y],c);for(const[x,w]of c)(e||!(gu(_l(x))||gu(_l(w))))&&y.push([u(x),u(w)]);return g}case tm:{const y=[],g=l([f,y],c);for(const x of c)(e||!gu(_l(x)))&&y.push(u(x));return g}}const{message:d}=c;return l([f,{name:m,message:d}],c)};return u},vb=(e,{json:t,lossy:r}={})=>{const s=[];return fj(!(t||r),!!t,new Map,s)(e),s},Hu=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?xb(vb(e,t)):structuredClone(e):(e,t)=>xb(vb(e,t));function hj(e,t){const r=[{type:"text",value:"↩"}];return t>1&&r.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),r}function dj(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function mj(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=e.options.footnoteBackContent||hj,s=e.options.footnoteBackLabel||dj,l=e.options.footnoteLabel||"Footnotes",u=e.options.footnoteLabelTagName||"h2",c=e.options.footnoteLabelProperties||{className:["sr-only"]},f=[];let m=-1;for(;++m<e.footnoteOrder.length;){const d=e.footnoteById.get(e.footnoteOrder[m]);if(!d)continue;const y=e.all(d),g=String(d.identifier).toUpperCase(),x=ka(g.toLowerCase());let w=0;const E=[],R=e.footnoteCounts.get(g);for(;R!==void 0&&++w<=R;){E.length>0&&E.push({type:"text",value:" "});let P=typeof r=="string"?r:r(m,w);typeof P=="string"&&(P={type:"text",value:P}),E.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+x+(w>1?"-"+w:""),dataFootnoteBackref:"",ariaLabel:typeof s=="string"?s:s(m,w),className:["data-footnote-backref"]},children:Array.isArray(P)?P:[P]})}const B=y[y.length-1];if(B&&B.type==="element"&&B.tagName==="p"){const P=B.children[B.children.length-1];P&&P.type==="text"?P.value+=" ":B.children.push({type:"text",value:" "}),B.children.push(...E)}else y.push(...E);const D={type:"element",tagName:"li",properties:{id:t+"fn-"+x},children:e.wrap(y,!0)};e.patch(d,D),f.push(D)}if(f.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:u,properties:{...Hu(c),id:"footnote-label"},children:[{type:"text",value:l}]},{type:"text",value:`
|
|
100
|
-
`},{type:"element",tagName:"ol",properties:{},children:e.wrap(f,!0)},{type:"text",value:`
|
|
101
|
-
`}]}}const tc=(function(e){if(e==null)return bj;if(typeof e=="function")return nc(e);if(typeof e=="object")return Array.isArray(e)?pj(e):gj(e);if(typeof e=="string")return yj(e);throw new Error("Expected function, string, or object as test")});function pj(e){const t=[];let r=-1;for(;++r<e.length;)t[r]=tc(e[r]);return nc(s);function s(...l){let u=-1;for(;++u<t.length;)if(t[u].apply(this,l))return!0;return!1}}function gj(e){const t=e;return nc(r);function r(s){const l=s;let u;for(u in e)if(l[u]!==t[u])return!1;return!0}}function yj(e){return nc(t);function t(r){return r&&r.type===e}}function nc(e){return t;function t(r,s,l){return!!(xj(r)&&e.call(this,r,typeof s=="number"?s:void 0,l||void 0))}}function bj(){return!0}function xj(e){return e!==null&&typeof e=="object"&&"type"in e}const y1=[],vj=!0,vd=!1,wj="skip";function b1(e,t,r,s){let l;typeof t=="function"&&typeof r!="function"?(s=r,r=t):l=t;const u=tc(l),c=s?-1:1;f(e,void 0,[])();function f(m,d,y){const g=m&&typeof m=="object"?m:{};if(typeof g.type=="string"){const w=typeof g.tagName=="string"?g.tagName:typeof g.name=="string"?g.name:void 0;Object.defineProperty(x,"name",{value:"node ("+(m.type+(w?"<"+w+">":""))+")"})}return x;function x(){let w=y1,E,R,B;if((!t||u(m,d,y[y.length-1]||void 0))&&(w=Sj(r(m,y)),w[0]===vd))return w;if("children"in m&&m.children){const D=m;if(D.children&&w[0]!==wj)for(R=(s?D.children.length:-1)+c,B=y.concat(D);R>-1&&R<D.children.length;){const P=D.children[R];if(E=f(P,R,B)(),E[0]===vd)return E;R=typeof E[1]=="number"?E[1]:R+c}}return w}}}function Sj(e){return Array.isArray(e)?e:typeof e=="number"?[vj,e]:e==null?y1:[e]}function nm(e,t,r,s){let l,u,c;typeof t=="function"&&typeof r!="function"?(u=void 0,c=t,l=r):(u=t,c=r,l=s),b1(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 wd={}.hasOwnProperty,_j={};function kj(e,t){const r=t||_j,s=new Map,l=new Map,u=new Map,c={...lj,...r.handlers},f={all:d,applyData:Cj,definitionById:s,footnoteById:l,footnoteCounts:u,footnoteOrder:[],handlers:c,one:m,options:r,patch:Ej,wrap:Tj};return nm(e,function(y){if(y.type==="definition"||y.type==="footnoteDefinition"){const g=y.type==="definition"?s:l,x=String(y.identifier).toUpperCase();g.has(x)||g.set(x,y)}}),f;function m(y,g){const x=y.type,w=f.handlers[x];if(wd.call(f.handlers,x)&&w)return w(f,y,g);if(f.options.passThrough&&f.options.passThrough.includes(x)){if("children"in y){const{children:R,...B}=y,D=Hu(B);return D.children=f.all(y),D}return Hu(y)}return(f.options.unknownHandler||Aj)(f,y,g)}function d(y){const g=[];if("children"in y){const x=y.children;let w=-1;for(;++w<x.length;){const E=f.one(x[w],y);if(E){if(w&&x[w-1].type==="break"&&(!Array.isArray(E)&&E.type==="text"&&(E.value=wb(E.value)),!Array.isArray(E)&&E.type==="element")){const R=E.children[0];R&&R.type==="text"&&(R.value=wb(R.value))}Array.isArray(E)?g.push(...E):g.push(E)}}}return g}}function Ej(e,t){e.position&&(t.position=dC(e))}function Cj(e,t){let r=t;if(e&&e.data){const s=e.data.hName,l=e.data.hChildren,u=e.data.hProperties;if(typeof s=="string")if(r.type==="element")r.tagName=s;else{const c="children"in r?r.children:[r];r={type:"element",tagName:s,properties:{},children:c}}r.type==="element"&&u&&Object.assign(r.properties,Hu(u)),"children"in r&&r.children&&l!==null&&l!==void 0&&(r.children=l)}return r}function Aj(e,t){const r=t.data||{},s="value"in t&&!(wd.call(r,"hProperties")||wd.call(r,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,s),e.applyData(t,s)}function Tj(e,t){const r=[];let s=-1;for(t&&r.push({type:"text",value:`
|
|
102
|
-
`});++s<e.length;)s&&r.push({type:"text",value:`
|
|
103
|
-
`}),r.push(e[s]);return t&&e.length>0&&r.push({type:"text",value:`
|
|
104
|
-
`}),r}function wb(e){let t=0,r=e.charCodeAt(t);for(;r===9||r===32;)t++,r=e.charCodeAt(t);return e.slice(t)}function Sb(e,t){const r=kj(e,t),s=r.one(e,void 0),l=mj(r),u=Array.isArray(s)?{type:"root",children:s}:s||{type:"root",children:[]};return l&&u.children.push({type:"text",value:`
|
|
105
|
-
`},l),u}function jj(e,t){return e&&"run"in e?async function(r,s){const l=Sb(r,{file:s,...t});await e.run(l,s)}:function(r,s){return Sb(r,{file:s,...e||t})}}function _b(e){if(e)throw e}var Bh,kb;function Nj(){if(kb)return Bh;kb=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,r=Object.defineProperty,s=Object.getOwnPropertyDescriptor,l=function(d){return typeof Array.isArray=="function"?Array.isArray(d):t.call(d)==="[object Array]"},u=function(d){if(!d||t.call(d)!=="[object Object]")return!1;var y=e.call(d,"constructor"),g=d.constructor&&d.constructor.prototype&&e.call(d.constructor.prototype,"isPrototypeOf");if(d.constructor&&!y&&!g)return!1;var x;for(x in d);return typeof x>"u"||e.call(d,x)},c=function(d,y){r&&y.name==="__proto__"?r(d,y.name,{enumerable:!0,configurable:!0,value:y.newValue,writable:!0}):d[y.name]=y.newValue},f=function(d,y){if(y==="__proto__")if(e.call(d,y)){if(s)return s(d,y).value}else return;return d[y]};return Bh=function m(){var d,y,g,x,w,E,R=arguments[0],B=1,D=arguments.length,P=!1;for(typeof R=="boolean"&&(P=R,R=arguments[1]||{},B=2),(R==null||typeof R!="object"&&typeof R!="function")&&(R={});B<D;++B)if(d=arguments[B],d!=null)for(y in d)g=f(R,y),x=f(d,y),R!==x&&(P&&x&&(u(x)||(w=l(x)))?(w?(w=!1,E=g&&l(g)?g:[]):E=g&&u(g)?g:{},c(R,{name:y,newValue:m(P,E,x)})):typeof x<"u"&&c(R,{name:y,newValue:x}));return R},Bh}var Oj=Nj();const Ph=Hb(Oj);function Sd(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function Rj(){const e=[],t={run:r,use:s};return t;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?Mj(y,f)(...d):c(null,...d)}}function s(l){if(typeof l!="function")throw new TypeError("Expected `middelware` to be a function, not "+l);return e.push(l),t}}function Mj(e,t){let r;return s;function s(...c){const f=e.length>c.length;let m;f&&c.push(l);try{m=e.apply(this,c)}catch(d){const y=d;if(f&&r)throw y;return l(y)}f||(m&&m.then&&typeof m.then=="function"?m.then(u,l):m instanceof Error?l(m):u(m))}function l(c,...f){r||(r=!0,t(c,...f))}function u(c){l(null,c)}}const Ar={basename:Dj,dirname:Lj,extname:zj,join:Uj,sep:"/"};function Dj(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Jl(e);let r=0,s=-1,l=e.length,u;if(t===void 0||t.length===0||t.length>e.length){for(;l--;)if(e.codePointAt(l)===47){if(u){r=l+1;break}}else s<0&&(u=!0,s=l+1);return s<0?"":e.slice(r,s)}if(t===e)return"";let c=-1,f=t.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)===t.codePointAt(f--)?f<0&&(s=l):(f=-1,s=c));return r===s?s=c:s<0&&(s=e.length),e.slice(r,s)}function Lj(e){if(Jl(e),e.length===0)return".";let t=-1,r=e.length,s;for(;--r;)if(e.codePointAt(r)===47){if(s){t=r;break}}else s||(s=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function zj(e){Jl(e);let t=e.length,r=-1,s=0,l=-1,u=0,c;for(;t--;){const f=e.codePointAt(t);if(f===47){if(c){s=t+1;break}continue}r<0&&(c=!0,r=t+1),f===46?l<0?l=t:u!==1&&(u=1):l>-1&&(u=-1)}return l<0||r<0||u===0||u===1&&l===r-1&&l===s+1?"":e.slice(l,r)}function Uj(...e){let t=-1,r;for(;++t<e.length;)Jl(e[t]),e[t]&&(r=r===void 0?e[t]:r+"/"+e[t]);return r===void 0?".":Bj(r)}function Bj(e){Jl(e);const t=e.codePointAt(0)===47;let r=Pj(e,!t);return r.length===0&&!t&&(r="."),r.length>0&&e.codePointAt(e.length-1)===47&&(r+="/"),t?"/"+r:r}function Pj(e,t){let r="",s=0,l=-1,u=0,c=-1,f,m;for(;++c<=e.length;){if(c<e.length)f=e.codePointAt(c);else{if(f===47)break;f=47}if(f===47){if(!(l===c-1||u===1))if(l!==c-1&&u===2){if(r.length<2||s!==2||r.codePointAt(r.length-1)!==46||r.codePointAt(r.length-2)!==46){if(r.length>2){if(m=r.lastIndexOf("/"),m!==r.length-1){m<0?(r="",s=0):(r=r.slice(0,m),s=r.length-1-r.lastIndexOf("/")),l=c,u=0;continue}}else if(r.length>0){r="",s=0,l=c,u=0;continue}}t&&(r=r.length>0?r+"/..":"..",s=2)}else r.length>0?r+="/"+e.slice(l+1,c):r=e.slice(l+1,c),s=c-l-1;l=c,u=0}else f===46&&u>-1?u++:u=-1}return r}function Jl(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const qj={cwd:Hj};function Hj(){return"/"}function _d(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function Ij(e){if(typeof e=="string")e=new URL(e);else if(!_d(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return Fj(e)}function Fj(e){if(e.hostname!==""){const s=new TypeError('File URL host must be "localhost" or empty on darwin');throw s.code="ERR_INVALID_FILE_URL_HOST",s}const t=e.pathname;let r=-1;for(;++r<t.length;)if(t.codePointAt(r)===37&&t.codePointAt(r+1)===50){const s=t.codePointAt(r+2);if(s===70||s===102){const l=new TypeError("File URL path must not include encoded / characters");throw l.code="ERR_INVALID_FILE_URL_PATH",l}}return decodeURIComponent(t)}const qh=["history","path","basename","stem","extname","dirname"];class x1{constructor(t){let r;t?_d(t)?r={path:t}:typeof t=="string"||$j(t)?r={value:t}:r=t:r={},this.cwd="cwd"in r?"":qj.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let s=-1;for(;++s<qh.length;){const u=qh[s];u in r&&r[u]!==void 0&&r[u]!==null&&(this[u]=u==="history"?[...r[u]]:r[u])}let l;for(l in r)qh.includes(l)||(this[l]=r[l])}get basename(){return typeof this.path=="string"?Ar.basename(this.path):void 0}set basename(t){Ih(t,"basename"),Hh(t,"basename"),this.path=Ar.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Ar.dirname(this.path):void 0}set dirname(t){Eb(this.basename,"dirname"),this.path=Ar.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Ar.extname(this.path):void 0}set extname(t){if(Hh(t,"extname"),Eb(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Ar.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){_d(t)&&(t=Ij(t)),Ih(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Ar.basename(this.path,this.extname):void 0}set stem(t){Ih(t,"stem"),Hh(t,"stem"),this.path=Ar.join(this.dirname||"",t+(this.extname||""))}fail(t,r,s){const l=this.message(t,r,s);throw l.fatal=!0,l}info(t,r,s){const l=this.message(t,r,s);return l.fatal=void 0,l}message(t,r,s){const l=new gn(t,r,s);return this.path&&(l.name=this.path+":"+l.name,l.file=this.path),l.fatal=!1,this.messages.push(l),l}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function Hh(e,t){if(e&&e.includes(Ar.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Ar.sep+"`")}function Ih(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function Eb(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function $j(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const Yj=(function(e){const s=this.constructor.prototype,l=s[e],u=function(){return l.apply(u,arguments)};return Object.setPrototypeOf(u,s),u}),Gj={}.hasOwnProperty;class rm extends Yj{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=Rj()}copy(){const t=new rm;let r=-1;for(;++r<this.attachers.length;){const s=this.attachers[r];t.use(...s)}return t.data(Ph(!0,{},this.namespace)),t}data(t,r){return typeof t=="string"?arguments.length===2?(Yh("data",this.frozen),this.namespace[t]=r,this):Gj.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Yh("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[r,...s]=this.attachers[this.freezeIndex];if(s[0]===!1)continue;s[0]===!0&&(s[0]=void 0);const l=r.call(t,...s);typeof l=="function"&&this.transformers.use(l)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const r=yu(t),s=this.parser||this.Parser;return Fh("parse",s),s(String(r),r)}process(t,r){const s=this;return this.freeze(),Fh("process",this.parser||this.Parser),$h("process",this.compiler||this.Compiler),r?l(void 0,r):new Promise(l);function l(u,c){const f=yu(t),m=s.parse(f);s.run(m,f,function(y,g,x){if(y||!g||!x)return d(y);const w=g,E=s.stringify(w,x);Xj(E)?x.value=E:x.result=E,d(y,x)});function d(y,g){y||!g?c(y):u?u(g):r(void 0,g)}}}processSync(t){let r=!1,s;return this.freeze(),Fh("processSync",this.parser||this.Parser),$h("processSync",this.compiler||this.Compiler),this.process(t,l),Ab("processSync","process",r),s;function l(u,c){r=!0,_b(u),s=c}}run(t,r,s){Cb(t),this.freeze();const l=this.transformers;return!s&&typeof r=="function"&&(s=r,r=void 0),s?u(void 0,s):new Promise(u);function u(c,f){const m=yu(r);l.run(t,m,d);function d(y,g,x){const w=g||t;y?f(y):c?c(w):s(void 0,w,x)}}}runSync(t,r){let s=!1,l;return this.run(t,r,u),Ab("runSync","run",s),l;function u(c,f){_b(c),l=f,s=!0}}stringify(t,r){this.freeze();const s=yu(r),l=this.compiler||this.Compiler;return $h("stringify",l),Cb(t),l(t,s)}use(t,...r){const s=this.attachers,l=this.namespace;if(Yh("use",this.frozen),t!=null)if(typeof t=="function")m(t,r);else if(typeof t=="object")Array.isArray(t)?f(t):c(t);else throw new TypeError("Expected usable value, not `"+t+"`");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=Ph(!0,l.settings,d.settings))}function f(d){let y=-1;if(d!=null)if(Array.isArray(d))for(;++y<d.length;){const g=d[y];u(g)}else throw new TypeError("Expected a list of plugins, not `"+d+"`")}function m(d,y){let g=-1,x=-1;for(;++g<s.length;)if(s[g][0]===d){x=g;break}if(x===-1)s.push([d,...y]);else if(y.length>0){let[w,...E]=y;const R=s[x][1];Sd(R)&&Sd(w)&&(w=Ph(!0,R,w)),s[x]=[d,w,...E]}}}}const Vj=new rm().freeze();function Fh(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function $h(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Yh(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function Cb(e){if(!Sd(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function Ab(e,t,r){if(!r)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function yu(e){return Jj(e)?e:new x1(e)}function Jj(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function Xj(e){return typeof e=="string"||Kj(e)}function Kj(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const Qj="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Tb=[],jb={allowDangerousHtml:!0},Zj=/^(https?|ircs?|mailto|xmpp)$/i,Wj=[{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 Nb(e){const t=eN(e),r=tN(e);return nN(t.runSync(t.parse(r),r),e)}function eN(e){const t=e.rehypePlugins||Tb,r=e.remarkPlugins||Tb,s=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...jb}:jb;return Vj().use(LT).use(r).use(jj,s).use(t)}function tN(e){const t=e.children||"",r=new x1;return typeof t=="string"&&(r.value=t),r}function nN(e,t){const r=t.allowedElements,s=t.allowElement,l=t.components,u=t.disallowedElements,c=t.skipHtml,f=t.unwrapDisallowed,m=t.urlTransform||rN;for(const y of Wj)Object.hasOwn(t,y.from)&&(""+y.from+(y.to?"use `"+y.to+"` instead":"remove it")+Qj+y.id,void 0);return nm(e,d),bC(e,{Fragment:b.Fragment,components:l,ignoreInvalidStyle:!0,jsx:b.jsx,jsxs:b.jsxs,passKeys:!0,passNode:!0});function d(y,g,x){if(y.type==="raw"&&x&&typeof g=="number")return c?x.children.splice(g,1):x.children[g]={type:"text",value:y.value},g;if(y.type==="element"){let w;for(w in Lh)if(Object.hasOwn(Lh,w)&&Object.hasOwn(y.properties,w)){const E=y.properties[w],R=Lh[w];(R===null||R.includes(y.tagName))&&(y.properties[w]=m(String(E||""),w,y))}}if(y.type==="element"){let w=r?!r.includes(y.tagName):u?u.includes(y.tagName):!1;if(!w&&s&&typeof g=="number"&&(w=!s(y,g,x)),w&&x&&typeof g=="number")return f&&y.children?x.children.splice(g,1,...y.children):x.children.splice(g,1),g}}}function rN(e){const t=e.indexOf(":"),r=e.indexOf("?"),s=e.indexOf("#"),l=e.indexOf("/");return t===-1||l!==-1&&t>l||r!==-1&&t>r||s!==-1&&t>s||Zj.test(e.slice(0,t))?e:""}function Ob(e,t){const r=String(e);if(typeof t!="string")throw new TypeError("Expected character");let s=0,l=r.indexOf(t);for(;l!==-1;)s++,l=r.indexOf(t,l+t.length);return s}function iN(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function v1(e,t,r){const l=tc((r||{}).ignore||[]),u=sN(t);let c=-1;for(;++c<u.length;)b1(e,"text",f);function f(d,y){let g=-1,x;for(;++g<y.length;){const w=y[g],E=x?x.children:void 0;if(l(w,E?E.indexOf(w):void 0,x))return;x=w}if(x)return m(d,y)}function m(d,y){const g=y[y.length-1],x=u[c][0],w=u[c][1];let E=0;const B=g.children.indexOf(d);let D=!1,P=[];x.lastIndex=0;let F=x.exec(d.value);for(;F;){const ue=F.index,U={index:F.index,input:F.input,stack:[...y,d]};let M=w(...F,U);if(typeof M=="string"&&(M=M.length>0?{type:"text",value:M}:void 0),M===!1?x.lastIndex=ue+1:(E!==ue&&P.push({type:"text",value:d.value.slice(E,ue)}),Array.isArray(M)?P.push(...M):M&&P.push(M),E=ue+F[0].length,D=!0),!x.global)break;F=x.exec(d.value)}return D?(E<d.value.length&&P.push({type:"text",value:d.value.slice(E)}),g.children.splice(B,1,...P)):P=[d],B+P.length}}function sN(e){const t=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const r=!e[0]||Array.isArray(e[0])?e:[e];let s=-1;for(;++s<r.length;){const l=r[s];t.push([aN(l[0]),lN(l[1])])}return t}function aN(e){return typeof e=="string"?new RegExp(iN(e),"g"):e}function lN(e){return typeof e=="function"?e:function(){return e}}const Gh="phrasing",Vh=["autolink","link","image","label"];function oN(){return{transforms:[pN],enter:{literalAutolink:cN,literalAutolinkEmail:Jh,literalAutolinkHttp:Jh,literalAutolinkWww:Jh},exit:{literalAutolink:mN,literalAutolinkEmail:dN,literalAutolinkHttp:fN,literalAutolinkWww:hN}}}function uN(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Gh,notInConstruct:Vh},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Gh,notInConstruct:Vh},{character:":",before:"[ps]",after:"\\/",inConstruct:Gh,notInConstruct:Vh}]}}function cN(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function Jh(e){this.config.enter.autolinkProtocol.call(this,e)}function fN(e){this.config.exit.autolinkProtocol.call(this,e)}function hN(e){this.config.exit.data.call(this,e);const t=this.stack[this.stack.length-1];t.type,t.url="http://"+this.sliceSerialize(e)}function dN(e){this.config.exit.autolinkEmail.call(this,e)}function mN(e){this.exit(e)}function pN(e){v1(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,gN],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),yN]],{ignore:["link","linkReference"]})}function gN(e,t,r,s,l){let u="";if(!w1(l)||(/^w/i.test(t)&&(r=t+r,t="",u="http://"),!bN(r)))return!1;const c=xN(r+s);if(!c[0])return!1;const f={type:"link",title:null,url:u+t+c[0],children:[{type:"text",value:t+c[0]}]};return c[1]?[f,{type:"text",value:c[1]}]:f}function yN(e,t,r,s){return!w1(s,!0)||/[-\d_]$/.test(r)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+r,children:[{type:"text",value:t+"@"+r}]}}function bN(e){const t=e.split(".");return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function xN(e){const t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let r=t[0],s=r.indexOf(")");const l=Ob(e,"(");let u=Ob(e,")");for(;s!==-1&&l>u;)e+=r.slice(0,s+1),r=r.slice(s+1),s=r.indexOf(")"),u++;return[e,r]}function w1(e,t){const r=e.input.charCodeAt(e.index-1);return(e.index===0||ps(r)||Zu(r))&&(!t||r!==47)}S1.peek=TN;function vN(){this.buffer()}function wN(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function SN(){this.buffer()}function _N(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function kN(e){const t=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=xr(this.sliceSerialize(e)).toLowerCase(),r.label=t}function EN(e){this.exit(e)}function CN(e){const t=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=xr(this.sliceSerialize(e)).toLowerCase(),r.label=t}function AN(e){this.exit(e)}function TN(){return"["}function S1(e,t,r,s){const l=r.createTracker(s);let u=l.move("[^");const c=r.enter("footnoteReference"),f=r.enter("reference");return u+=l.move(r.safe(r.associationId(e),{after:"]",before:u})),f(),c(),u+=l.move("]"),u}function jN(){return{enter:{gfmFootnoteCallString:vN,gfmFootnoteCall:wN,gfmFootnoteDefinitionLabelString:SN,gfmFootnoteDefinition:_N},exit:{gfmFootnoteCallString:kN,gfmFootnoteCall:EN,gfmFootnoteDefinitionLabelString:CN,gfmFootnoteDefinition:AN}}}function NN(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:r,footnoteReference:S1},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function r(s,l,u,c){const f=u.createTracker(c);let m=f.move("[^");const d=u.enter("footnoteDefinition"),y=u.enter("label");return m+=f.move(u.safe(u.associationId(s),{before:m,after:"]"})),y(),m+=f.move("]:"),s.children&&s.children.length>0&&(f.shift(4),m+=f.move((t?`
|
|
106
|
-
`:" ")+u.indentLines(u.containerFlow(s,f.current()),t?_1:ON))),d(),m}}function ON(e,t,r){return t===0?e:_1(e,t,r)}function _1(e,t,r){return(r?"":" ")+e}const RN=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];k1.peek=UN;function MN(){return{canContainEols:["delete"],enter:{strikethrough:LN},exit:{strikethrough:zN}}}function DN(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:RN}],handlers:{delete:k1}}}function LN(e){this.enter({type:"delete",children:[]},e)}function zN(e){this.exit(e)}function k1(e,t,r,s){const l=r.createTracker(s),u=r.enter("strikethrough");let c=l.move("~~");return c+=r.containerPhrasing(e,{...l.current(),before:c,after:"~"}),c+=l.move("~~"),u(),c}function UN(){return"~"}function BN(e){return e.length}function PN(e,t){const r=t||{},s=(r.align||[]).concat(),l=r.stringLength||BN,u=[],c=[],f=[],m=[];let d=0,y=-1;for(;++y<e.length;){const R=[],B=[];let D=-1;for(e[y].length>d&&(d=e[y].length);++D<e[y].length;){const P=qN(e[y][D]);if(r.alignDelimiters!==!1){const F=l(P);B[D]=F,(m[D]===void 0||F>m[D])&&(m[D]=F)}R.push(P)}c[y]=R,f[y]=B}let g=-1;if(typeof s=="object"&&"length"in s)for(;++g<d;)u[g]=Rb(s[g]);else{const R=Rb(s);for(;++g<d;)u[g]=R}g=-1;const x=[],w=[];for(;++g<d;){const R=u[g];let B="",D="";R===99?(B=":",D=":"):R===108?B=":":R===114&&(D=":");let P=r.alignDelimiters===!1?1:Math.max(1,m[g]-B.length-D.length);const F=B+"-".repeat(P)+D;r.alignDelimiters!==!1&&(P=B.length+P+D.length,P>m[g]&&(m[g]=P),w[g]=P),x[g]=F}c.splice(1,0,x),f.splice(1,0,w),y=-1;const E=[];for(;++y<c.length;){const R=c[y],B=f[y];g=-1;const D=[];for(;++g<d;){const P=R[g]||"";let F="",ue="";if(r.alignDelimiters!==!1){const U=m[g]-(B[g]||0),M=u[g];M===114?F=" ".repeat(U):M===99?U%2?(F=" ".repeat(U/2+.5),ue=" ".repeat(U/2-.5)):(F=" ".repeat(U/2),ue=F):ue=" ".repeat(U)}r.delimiterStart!==!1&&!g&&D.push("|"),r.padding!==!1&&!(r.alignDelimiters===!1&&P==="")&&(r.delimiterStart!==!1||g)&&D.push(" "),r.alignDelimiters!==!1&&D.push(F),D.push(P),r.alignDelimiters!==!1&&D.push(ue),r.padding!==!1&&D.push(" "),(r.delimiterEnd!==!1||g!==d-1)&&D.push("|")}E.push(r.delimiterEnd===!1?D.join("").replace(/ +$/,""):D.join(""))}return E.join(`
|
|
107
|
-
`)}function qN(e){return e==null?"":String(e)}function Rb(e){const t=typeof e=="string"?e.codePointAt(0):0;return t===67||t===99?99:t===76||t===108?108:t===82||t===114?114:0}function HN(e,t,r,s){const l=r.enter("blockquote"),u=r.createTracker(s);u.move("> "),u.shift(2);const c=r.indentLines(r.containerFlow(e,u.current()),IN);return l(),c}function IN(e,t,r){return">"+(r?"":" ")+e}function FN(e,t){return Mb(e,t.inConstruct,!0)&&!Mb(e,t.notInConstruct,!1)}function Mb(e,t,r){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return r;let s=-1;for(;++s<t.length;)if(e.includes(t[s]))return!0;return!1}function Db(e,t,r,s){let l=-1;for(;++l<r.unsafe.length;)if(r.unsafe[l].character===`
|
|
108
|
-
`&&FN(r.stack,r.unsafe[l]))return/[ \t]/.test(s.before)?"":" ";return`\\
|
|
109
|
-
`}function $N(e,t){const r=String(e);let s=r.indexOf(t),l=s,u=0,c=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;s!==-1;)s===l?++u>c&&(c=u):u=1,l=s+t.length,s=r.indexOf(t,l);return c}function YN(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function GN(e){const t=e.options.fence||"`";if(t!=="`"&&t!=="~")throw new Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function VN(e,t,r,s){const l=GN(r),u=e.value||"",c=l==="`"?"GraveAccent":"Tilde";if(YN(e,r)){const g=r.enter("codeIndented"),x=r.indentLines(u,JN);return g(),x}const f=r.createTracker(s),m=l.repeat(Math.max($N(u,l)+1,3)),d=r.enter("codeFenced");let y=f.move(m);if(e.lang){const g=r.enter(`codeFencedLang${c}`);y+=f.move(r.safe(e.lang,{before:y,after:" ",encode:["`"],...f.current()})),g()}if(e.lang&&e.meta){const g=r.enter(`codeFencedMeta${c}`);y+=f.move(" "),y+=f.move(r.safe(e.meta,{before:y,after:`
|
|
110
|
-
`,encode:["`"],...f.current()})),g()}return y+=f.move(`
|
|
111
|
-
`),u&&(y+=f.move(u+`
|
|
112
|
-
`)),y+=f.move(m),d(),y}function JN(e,t,r){return(r?"":" ")+e}function im(e){const t=e.options.quote||'"';if(t!=='"'&&t!=="'")throw new Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function XN(e,t,r,s){const l=im(r),u=l==='"'?"Quote":"Apostrophe",c=r.enter("definition");let f=r.enter("label");const m=r.createTracker(s);let d=m.move("[");return d+=m.move(r.safe(r.associationId(e),{before:d,after:"]",...m.current()})),d+=m.move("]: "),f(),!e.url||/[\0- \u007F]/.test(e.url)?(f=r.enter("destinationLiteral"),d+=m.move("<"),d+=m.move(r.safe(e.url,{before:d,after:">",...m.current()})),d+=m.move(">")):(f=r.enter("destinationRaw"),d+=m.move(r.safe(e.url,{before:d,after:e.title?" ":`
|
|
113
|
-
`,...m.current()}))),f(),e.title&&(f=r.enter(`title${u}`),d+=m.move(" "+l),d+=m.move(r.safe(e.title,{before:d,after:l,...m.current()})),d+=m.move(l),f()),c(),d}function KN(e){const t=e.options.emphasis||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function Hl(e){return"&#x"+e.toString(16).toUpperCase()+";"}function Iu(e,t,r){const s=ba(e),l=ba(t);return s===void 0?l===void 0?r==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:l===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:s===1?l===void 0?{inside:!1,outside:!1}:l===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:l===void 0?{inside:!1,outside:!1}:l===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}E1.peek=QN;function E1(e,t,r,s){const l=KN(r),u=r.enter("emphasis"),c=r.createTracker(s),f=c.move(l);let m=c.move(r.containerPhrasing(e,{after:l,before:f,...c.current()}));const d=m.charCodeAt(0),y=Iu(s.before.charCodeAt(s.before.length-1),d,l);y.inside&&(m=Hl(d)+m.slice(1));const g=m.charCodeAt(m.length-1),x=Iu(s.after.charCodeAt(0),g,l);x.inside&&(m=m.slice(0,-1)+Hl(g));const w=c.move(l);return u(),r.attentionEncodeSurroundingInfo={after:x.outside,before:y.outside},f+m+w}function QN(e,t,r){return r.options.emphasis||"*"}function ZN(e,t){let r=!1;return nm(e,function(s){if("value"in s&&/\r?\n|\r/.test(s.value)||s.type==="break")return r=!0,vd}),!!((!e.depth||e.depth<3)&&Xd(e)&&(t.options.setext||r))}function WN(e,t,r,s){const l=Math.max(Math.min(6,e.depth||1),1),u=r.createTracker(s);if(ZN(e,r)){const y=r.enter("headingSetext"),g=r.enter("phrasing"),x=r.containerPhrasing(e,{...u.current(),before:`
|
|
114
|
-
`,after:`
|
|
115
|
-
`});return g(),y(),x+`
|
|
116
|
-
`+(l===1?"=":"-").repeat(x.length-(Math.max(x.lastIndexOf("\r"),x.lastIndexOf(`
|
|
117
|
-
`))+1))}const c="#".repeat(l),f=r.enter("headingAtx"),m=r.enter("phrasing");u.move(c+" ");let d=r.containerPhrasing(e,{before:"# ",after:`
|
|
118
|
-
`,...u.current()});return/^[\t ]/.test(d)&&(d=Hl(d.charCodeAt(0))+d.slice(1)),d=d?c+" "+d:c,r.options.closeAtx&&(d+=" "+c),m(),f(),d}C1.peek=e3;function C1(e){return e.value||""}function e3(){return"<"}A1.peek=t3;function A1(e,t,r,s){const l=im(r),u=l==='"'?"Quote":"Apostrophe",c=r.enter("image");let f=r.enter("label");const m=r.createTracker(s);let d=m.move("![");return d+=m.move(r.safe(e.alt,{before:d,after:"]",...m.current()})),d+=m.move("]("),f(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(f=r.enter("destinationLiteral"),d+=m.move("<"),d+=m.move(r.safe(e.url,{before:d,after:">",...m.current()})),d+=m.move(">")):(f=r.enter("destinationRaw"),d+=m.move(r.safe(e.url,{before:d,after:e.title?" ":")",...m.current()}))),f(),e.title&&(f=r.enter(`title${u}`),d+=m.move(" "+l),d+=m.move(r.safe(e.title,{before:d,after:l,...m.current()})),d+=m.move(l),f()),d+=m.move(")"),c(),d}function t3(){return"!"}T1.peek=n3;function T1(e,t,r,s){const l=e.referenceType,u=r.enter("imageReference");let c=r.enter("label");const f=r.createTracker(s);let m=f.move("![");const d=r.safe(e.alt,{before:m,after:"]",...f.current()});m+=f.move(d+"]["),c();const y=r.stack;r.stack=[],c=r.enter("reference");const g=r.safe(r.associationId(e),{before:m,after:"]",...f.current()});return c(),r.stack=y,u(),l==="full"||!d||d!==g?m+=f.move(g+"]"):l==="shortcut"?m=m.slice(0,-1):m+=f.move("]"),m}function n3(){return"!"}j1.peek=r3;function j1(e,t,r){let s=e.value||"",l="`",u=-1;for(;new RegExp("(^|[^`])"+l+"([^`]|$)").test(s);)l+="`";for(/[^ \r\n]/.test(s)&&(/^[ \r\n]/.test(s)&&/[ \r\n]$/.test(s)||/^`|`$/.test(s))&&(s=" "+s+" ");++u<r.unsafe.length;){const c=r.unsafe[u],f=r.compilePattern(c);let m;if(c.atBreak)for(;m=f.exec(s);){let d=m.index;s.charCodeAt(d)===10&&s.charCodeAt(d-1)===13&&d--,s=s.slice(0,d)+" "+s.slice(m.index+1)}}return l+s+l}function r3(){return"`"}function N1(e,t){const r=Xd(e);return!!(!t.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))}O1.peek=i3;function O1(e,t,r,s){const l=im(r),u=l==='"'?"Quote":"Apostrophe",c=r.createTracker(s);let f,m;if(N1(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 i3(e,t,r){return N1(e,r)?"<":"["}R1.peek=s3;function R1(e,t,r,s){const l=e.referenceType,u=r.enter("linkReference");let c=r.enter("label");const f=r.createTracker(s);let m=f.move("[");const d=r.containerPhrasing(e,{before:m,after:"]",...f.current()});m+=f.move(d+"]["),c();const y=r.stack;r.stack=[],c=r.enter("reference");const g=r.safe(r.associationId(e),{before:m,after:"]",...f.current()});return c(),r.stack=y,u(),l==="full"||!d||d!==g?m+=f.move(g+"]"):l==="shortcut"?m=m.slice(0,-1):m+=f.move("]"),m}function s3(){return"["}function sm(e){const t=e.options.bullet||"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function a3(e){const t=sm(e),r=e.options.bulletOther;if(!r)return t==="*"?"-":"*";if(r!=="*"&&r!=="+"&&r!=="-")throw new Error("Cannot serialize items with `"+r+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(r===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+r+"`) to be different");return r}function l3(e){const t=e.options.bulletOrdered||".";if(t!=="."&&t!==")")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function M1(e){const t=e.options.rule||"*";if(t!=="*"&&t!=="-"&&t!=="_")throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function o3(e,t,r,s){const l=r.enter("list"),u=r.bulletCurrent;let c=e.ordered?l3(r):sm(r);const f=e.ordered?c==="."?")":".":a3(r);let m=t&&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),M1(r)===c&&y){let g=-1;for(;++g<e.children.length;){const x=e.children[g];if(x&&x.type==="listItem"&&x.children&&x.children[0]&&x.children[0].type==="thematicBreak"){m=!0;break}}}}m&&(c=f),r.bulletCurrent=c;const d=r.containerFlow(e,s);return r.bulletLastUsed=c,r.bulletCurrent=u,l(),d}function u3(e){const t=e.options.listItemIndent||"one";if(t!=="tab"&&t!=="one"&&t!=="mixed")throw new Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}function c3(e,t,r,s){const l=u3(r);let u=r.bulletCurrent||sm(r);t&&t.type==="list"&&t.ordered&&(u=(typeof t.start=="number"&&t.start>-1?t.start:1)+(r.options.incrementListMarker===!1?0:t.children.indexOf(e))+u);let c=u.length+1;(l==="tab"||l==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(c=Math.ceil(c/4)*4);const f=r.createTracker(s);f.move(u+" ".repeat(c-u.length)),f.shift(c);const m=r.enter("listItem"),d=r.indentLines(r.containerFlow(e,f.current()),y);return m(),d;function y(g,x,w){return x?(w?"":" ".repeat(c))+g:(w?u:u+" ".repeat(c-u.length))+g}}function f3(e,t,r,s){const l=r.enter("paragraph"),u=r.enter("phrasing"),c=r.containerPhrasing(e,s);return u(),l(),c}const h3=tc(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function d3(e,t,r,s){return(e.children.some(function(c){return h3(c)})?r.containerPhrasing:r.containerFlow).call(r,e,s)}function m3(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}D1.peek=p3;function D1(e,t,r,s){const l=m3(r),u=r.enter("strong"),c=r.createTracker(s),f=c.move(l+l);let m=c.move(r.containerPhrasing(e,{after:l,before:f,...c.current()}));const d=m.charCodeAt(0),y=Iu(s.before.charCodeAt(s.before.length-1),d,l);y.inside&&(m=Hl(d)+m.slice(1));const g=m.charCodeAt(m.length-1),x=Iu(s.after.charCodeAt(0),g,l);x.inside&&(m=m.slice(0,-1)+Hl(g));const w=c.move(l+l);return u(),r.attentionEncodeSurroundingInfo={after:x.outside,before:y.outside},f+m+w}function p3(e,t,r){return r.options.strong||"*"}function g3(e,t,r,s){return r.safe(e.value,s)}function y3(e){const t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function b3(e,t,r){const s=(M1(r)+(r.options.ruleSpaces?" ":"")).repeat(y3(r));return r.options.ruleSpaces?s.slice(0,-1):s}const L1={blockquote:HN,break:Db,code:VN,definition:XN,emphasis:E1,hardBreak:Db,heading:WN,html:C1,image:A1,imageReference:T1,inlineCode:j1,link:O1,linkReference:R1,list:o3,listItem:c3,paragraph:f3,root:d3,strong:D1,text:g3,thematicBreak:b3};function x3(){return{enter:{table:v3,tableData:Lb,tableHeader:Lb,tableRow:S3},exit:{codeText:_3,table:w3,tableData:Xh,tableHeader:Xh,tableRow:Xh}}}function v3(e){const t=e._align;this.enter({type:"table",align:t.map(function(r){return r==="none"?null:r}),children:[]},e),this.data.inTable=!0}function w3(e){this.exit(e),this.data.inTable=void 0}function S3(e){this.enter({type:"tableRow",children:[]},e)}function Xh(e){this.exit(e)}function Lb(e){this.enter({type:"tableCell",children:[]},e)}function _3(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,k3));const r=this.stack[this.stack.length-1];r.type,r.value=t,this.exit(e)}function k3(e,t){return t==="|"?t:e}function E3(e){const t=e||{},r=t.tableCellPadding,s=t.tablePipeAlign,l=t.stringLength,u=r?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
|
|
119
|
-
`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:x,table:c,tableCell:m,tableRow:f}};function c(w,E,R,B){return d(y(w,R,B),w.align)}function f(w,E,R,B){const D=g(w,R,B),P=d([D]);return P.slice(0,P.indexOf(`
|
|
120
|
-
`))}function m(w,E,R,B){const D=R.enter("tableCell"),P=R.enter("phrasing"),F=R.containerPhrasing(w,{...B,before:u,after:u});return P(),D(),F}function d(w,E){return PN(w,{align:E,alignDelimiters:s,padding:r,stringLength:l})}function y(w,E,R){const B=w.children;let D=-1;const P=[],F=E.enter("table");for(;++D<B.length;)P[D]=g(B[D],E,R);return F(),P}function g(w,E,R){const B=w.children;let D=-1;const P=[],F=E.enter("tableRow");for(;++D<B.length;)P[D]=m(B[D],w,E,R);return F(),P}function x(w,E,R){let B=L1.inlineCode(w,E,R);return R.stack.includes("tableCell")&&(B=B.replace(/\|/g,"\\$&")),B}}function C3(){return{exit:{taskListCheckValueChecked:zb,taskListCheckValueUnchecked:zb,paragraph:T3}}}function A3(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:j3}}}function zb(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function T3(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const r=this.stack[this.stack.length-1];r.type;const s=r.children[0];if(s&&s.type==="text"){const l=t.children;let u=-1,c;for(;++u<l.length;){const f=l[u];if(f.type==="paragraph"){c=f;break}}c===r&&(s.value=s.value.slice(1),s.value.length===0?r.children.shift():r.position&&s.position&&typeof s.position.start.offset=="number"&&(s.position.start.column++,s.position.start.offset++,r.position.start=Object.assign({},s.position.start)))}}this.exit(e)}function j3(e,t,r,s){const l=e.children[0],u=typeof e.checked=="boolean"&&l&&l.type==="paragraph",c="["+(e.checked?"x":" ")+"] ",f=r.createTracker(s);u&&f.move(c);let m=L1.listItem(e,t,r,{...s,...f.current()});return u&&(m=m.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,d)),m;function d(y){return y+c}}function N3(){return[oN(),jN(),MN(),x3(),C3()]}function O3(e){return{extensions:[uN(),NN(e),DN(),E3(e),A3()]}}const R3={tokenize:B3,partial:!0},z1={tokenize:P3,partial:!0},U1={tokenize:q3,partial:!0},B1={tokenize:H3,partial:!0},M3={tokenize:I3,partial:!0},P1={name:"wwwAutolink",tokenize:z3,previous:H1},q1={name:"protocolAutolink",tokenize:U3,previous:I1},ri={name:"emailAutolink",tokenize:L3,previous:F1},Rr={};function D3(){return{text:Rr}}let hs=48;for(;hs<123;)Rr[hs]=ri,hs++,hs===58?hs=65:hs===91&&(hs=97);Rr[43]=ri;Rr[45]=ri;Rr[46]=ri;Rr[95]=ri;Rr[72]=[ri,q1];Rr[104]=[ri,q1];Rr[87]=[ri,P1];Rr[119]=[ri,P1];function L3(e,t,r){const s=this;let l,u;return c;function c(g){return!kd(g)||!F1.call(s,s.previous)||am(s.events)?r(g):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),f(g))}function f(g){return kd(g)?(e.consume(g),f):g===64?(e.consume(g),m):r(g)}function m(g){return g===46?e.check(M3,y,d)(g):g===45||g===95||pn(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&&wn(s.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(g)):r(g)}}function z3(e,t,r){const s=this;return l;function l(c){return c!==87&&c!==119||!H1.call(s,s.previous)||am(s.events)?r(c):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(R3,e.attempt(z1,e.attempt(U1,u),r),r)(c))}function u(c){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(c)}}function U3(e,t,r){const s=this;let l="",u=!1;return c;function c(g){return(g===72||g===104)&&I1.call(s,s.previous)&&!am(s.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),l+=String.fromCodePoint(g),e.consume(g),f):r(g)}function f(g){if(wn(g)&&l.length<5)return l+=String.fromCodePoint(g),e.consume(g),f;if(g===58){const x=l.toLowerCase();if(x==="http"||x==="https")return e.consume(g),m}return r(g)}function m(g){return g===47?(e.consume(g),u?d:(u=!0,m)):r(g)}function d(g){return g===null||Pu(g)||Tt(g)||ps(g)||Zu(g)?r(g):e.attempt(z1,e.attempt(U1,y),r)(g)}function y(g){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(g)}}function B3(e,t,r){let s=0;return l;function l(c){return(c===87||c===119)&&s<3?(s++,e.consume(c),l):c===46&&s===3?(e.consume(c),u):r(c)}function u(c){return c===null?r(c):t(c)}}function P3(e,t,r){let s,l,u;return c;function c(d){return d===46||d===95?e.check(B1,m,f)(d):d===null||Tt(d)||ps(d)||d!==45&&Zu(d)?m(d):(u=!0,e.consume(d),c)}function f(d){return d===95?s=!0:(l=s,s=void 0),e.consume(d),c}function m(d){return l||s||!u?r(d):t(d)}}function q3(e,t){let r=0,s=0;return l;function l(c){return c===40?(r++,e.consume(c),l):c===41&&s<r?u(c):c===33||c===34||c===38||c===39||c===41||c===42||c===44||c===46||c===58||c===59||c===60||c===63||c===93||c===95||c===126?e.check(B1,t,u)(c):c===null||Tt(c)||ps(c)?t(c):(e.consume(c),l)}function u(c){return c===41&&s++,e.consume(c),l}}function H3(e,t,r){return s;function s(f){return f===33||f===34||f===39||f===41||f===42||f===44||f===46||f===58||f===59||f===63||f===95||f===126?(e.consume(f),s):f===38?(e.consume(f),u):f===93?(e.consume(f),l):f===60||f===null||Tt(f)||ps(f)?t(f):r(f)}function l(f){return f===null||f===40||f===91||Tt(f)||ps(f)?t(f):s(f)}function u(f){return wn(f)?c(f):r(f)}function c(f){return f===59?(e.consume(f),s):wn(f)?(e.consume(f),c):r(f)}}function I3(e,t,r){return s;function s(u){return e.consume(u),l}function l(u){return pn(u)?r(u):t(u)}}function H1(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Tt(e)}function I1(e){return!wn(e)}function F1(e){return!(e===47||kd(e))}function kd(e){return e===43||e===45||e===46||e===95||pn(e)}function am(e){let t=e.length,r=!1;for(;t--;){const s=e[t][1];if((s.type==="labelLink"||s.type==="labelImage")&&!s._balanced){r=!0;break}if(s._gfmAutolinkLiteralWalkedInto){r=!1;break}}return e.length>0&&!r&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),r}const F3={tokenize:Q3,partial:!0};function $3(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:J3,continuation:{tokenize:X3},exit:K3}},text:{91:{name:"gfmFootnoteCall",tokenize:V3},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:Y3,resolveTo:G3}}}}function Y3(e,t,r){const s=this;let l=s.events.length;const u=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let c;for(;l--;){const m=s.events[l][1];if(m.type==="labelImage"){c=m;break}if(m.type==="gfmFootnoteCall"||m.type==="labelLink"||m.type==="label"||m.type==="image"||m.type==="link")break}return f;function f(m){if(!c||!c._balanced)return r(m);const d=xr(s.sliceSerialize({start:c.end,end:s.now()}));return d.codePointAt(0)!==94||!u.includes(d.slice(1))?r(m):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(m),e.exit("gfmFootnoteCallLabelMarker"),t(m))}}function G3(e,t){let r=e.length;for(;r--;)if(e[r][1].type==="labelImage"&&e[r][0]==="enter"){e[r][1];break}e[r+1][1].type="data",e[r+3][1].type="gfmFootnoteCallLabelMarker";const s={type:"gfmFootnoteCall",start:Object.assign({},e[r+3][1].start),end:Object.assign({},e[e.length-1][1].end)},l={type:"gfmFootnoteCallMarker",start:Object.assign({},e[r+3][1].end),end:Object.assign({},e[r+3][1].end)};l.end.column++,l.end.offset++,l.end._bufferIndex++;const u={type:"gfmFootnoteCallString",start:Object.assign({},l.end),end:Object.assign({},e[e.length-1][1].start)},c={type:"chunkString",contentType:"string",start:Object.assign({},u.start),end:Object.assign({},u.end)},f=[e[r+1],e[r+2],["enter",s,t],e[r+3],e[r+4],["enter",l,t],["exit",l,t],["enter",u,t],["enter",c,t],["exit",c,t],["exit",u,t],e[e.length-2],e[e.length-1],["exit",s,t]];return e.splice(r,e.length-r+1,...f),e}function V3(e,t,r){const s=this,l=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let u=0,c;return f;function f(g){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(g),e.exit("gfmFootnoteCallLabelMarker"),m}function m(g){return g!==94?r(g):(e.enter("gfmFootnoteCallMarker"),e.consume(g),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",d)}function d(g){if(u>999||g===93&&!c||g===null||g===91||Tt(g))return r(g);if(g===93){e.exit("chunkString");const x=e.exit("gfmFootnoteCallString");return l.includes(xr(s.sliceSerialize(x)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(g),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):r(g)}return Tt(g)||(c=!0),u++,e.consume(g),g===92?y:d}function y(g){return g===91||g===92||g===93?(e.consume(g),u++,d):d(g)}}function J3(e,t,r){const s=this,l=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let u,c=0,f;return m;function m(E){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(E),e.exit("gfmFootnoteDefinitionLabelMarker"),d}function d(E){return E===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(E),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",y):r(E)}function y(E){if(c>999||E===93&&!f||E===null||E===91||Tt(E))return r(E);if(E===93){e.exit("chunkString");const R=e.exit("gfmFootnoteDefinitionLabelString");return u=xr(s.sliceSerialize(R)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(E),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),x}return Tt(E)||(f=!0),c++,e.consume(E),E===92?g:y}function g(E){return E===91||E===92||E===93?(e.consume(E),c++,y):y(E)}function x(E){return E===58?(e.enter("definitionMarker"),e.consume(E),e.exit("definitionMarker"),l.includes(u)||l.push(u),ot(e,w,"gfmFootnoteDefinitionWhitespace")):r(E)}function w(E){return t(E)}}function X3(e,t,r){return e.check(Vl,t,e.attempt(F3,t,r))}function K3(e){e.exit("gfmFootnoteDefinition")}function Q3(e,t,r){const s=this;return ot(e,l,"gfmFootnoteDefinitionIndent",5);function l(u){const c=s.events[s.events.length-1];return c&&c[1].type==="gfmFootnoteDefinitionIndent"&&c[2].sliceSerialize(c[1],!0).length===4?t(u):r(u)}}function Z3(e){let r=(e||{}).singleTilde;const s={name:"strikethrough",tokenize:u,resolveAll:l};return r==null&&(r=!0),{text:{126:s},insideSpan:{null:[s]},attentionMarkers:{null:[126]}};function l(c,f){let m=-1;for(;++m<c.length;)if(c[m][0]==="enter"&&c[m][1].type==="strikethroughSequenceTemporary"&&c[m][1]._close){let d=m;for(;d--;)if(c[d][0]==="exit"&&c[d][1].type==="strikethroughSequenceTemporary"&&c[d][1]._open&&c[m][1].end.offset-c[m][1].start.offset===c[d][1].end.offset-c[d][1].start.offset){c[m][1].type="strikethroughSequence",c[d][1].type="strikethroughSequence";const y={type:"strikethrough",start:Object.assign({},c[d][1].start),end:Object.assign({},c[m][1].end)},g={type:"strikethroughText",start:Object.assign({},c[d][1].end),end:Object.assign({},c[m][1].start)},x=[["enter",y,f],["enter",c[d][1],f],["exit",c[d][1],f],["enter",g,f]],w=f.parser.constructs.insideSpan.null;w&&Yn(x,x.length,0,Wu(w,c.slice(d+1,m),f)),Yn(x,x.length,0,[["exit",g,f],["enter",c[m][1],f],["exit",c[m][1],f],["exit",y,f]]),Yn(c,d-1,m-d+3,x),m=d+x.length-2;break}}for(m=-1;++m<c.length;)c[m][1].type==="strikethroughSequenceTemporary"&&(c[m][1].type="data");return c}function u(c,f,m){const d=this.previous,y=this.events;let g=0;return x;function x(E){return d===126&&y[y.length-1][1].type!=="characterEscape"?m(E):(c.enter("strikethroughSequenceTemporary"),w(E))}function w(E){const R=ba(d);if(E===126)return g>1?m(E):(c.consume(E),g++,w);if(g<2&&!r)return m(E);const B=c.exit("strikethroughSequenceTemporary"),D=ba(E);return B._open=!D||D===2&&!!R,B._close=!R||R===2&&!!D,f(E)}}}class W3{constructor(){this.map=[]}add(t,r,s){eO(this,t,r,s)}consume(t){if(this.map.sort(function(u,c){return u[0]-c[0]}),this.map.length===0)return;let r=this.map.length;const s=[];for(;r>0;)r-=1,s.push(t.slice(this.map[r][0]+this.map[r][1]),this.map[r][2]),t.length=this.map[r][0];s.push(t.slice()),t.length=0;let l=s.pop();for(;l;){for(const u of l)t.push(u);l=s.pop()}this.map.length=0}}function eO(e,t,r,s){let l=0;if(!(r===0&&s.length===0)){for(;l<e.map.length;){if(e.map[l][0]===t){e.map[l][1]+=r,e.map[l][2].push(...s);return}l+=1}e.map.push([t,r,s])}}function tO(e,t){let r=!1;const s=[];for(;t<e.length;){const l=e[t];if(r){if(l[0]==="enter")l[1].type==="tableContent"&&s.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(l[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const u=s.length-1;s[u]=s[u]==="left"?"center":"right"}}else if(l[1].type==="tableDelimiterRow")break}else l[0]==="enter"&&l[1].type==="tableDelimiterRow"&&(r=!0);t+=1}return s}function nO(){return{flow:{null:{name:"table",tokenize:rO,resolveAll:iO}}}}function rO(e,t,r){const s=this;let l=0,u=0,c;return f;function f(O){let X=s.events.length-1;for(;X>-1;){const te=s.events[X][1].type;if(te==="lineEnding"||te==="linePrefix")X--;else break}const J=X>-1?s.events[X][1].type:null,le=J==="tableHead"||J==="tableRow"?M:m;return le===M&&s.parser.lazy[s.now().line]?r(O):le(O)}function m(O){return e.enter("tableHead"),e.enter("tableRow"),d(O)}function d(O){return O===124||(c=!0,u+=1),y(O)}function y(O){return O===null?r(O):Be(O)?u>1?(u=0,s.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(O),e.exit("lineEnding"),w):r(O):tt(O)?ot(e,y,"whitespace")(O):(u+=1,c&&(c=!1,l+=1),O===124?(e.enter("tableCellDivider"),e.consume(O),e.exit("tableCellDivider"),c=!0,y):(e.enter("data"),g(O)))}function g(O){return O===null||O===124||Tt(O)?(e.exit("data"),y(O)):(e.consume(O),O===92?x:g)}function x(O){return O===92||O===124?(e.consume(O),g):g(O)}function w(O){return s.interrupt=!1,s.parser.lazy[s.now().line]?r(O):(e.enter("tableDelimiterRow"),c=!1,tt(O)?ot(e,E,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(O):E(O))}function E(O){return O===45||O===58?B(O):O===124?(c=!0,e.enter("tableCellDivider"),e.consume(O),e.exit("tableCellDivider"),R):U(O)}function R(O){return tt(O)?ot(e,B,"whitespace")(O):B(O)}function B(O){return O===58?(u+=1,c=!0,e.enter("tableDelimiterMarker"),e.consume(O),e.exit("tableDelimiterMarker"),D):O===45?(u+=1,D(O)):O===null||Be(O)?ue(O):U(O)}function D(O){return O===45?(e.enter("tableDelimiterFiller"),P(O)):U(O)}function P(O){return O===45?(e.consume(O),P):O===58?(c=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(O),e.exit("tableDelimiterMarker"),F):(e.exit("tableDelimiterFiller"),F(O))}function F(O){return tt(O)?ot(e,ue,"whitespace")(O):ue(O)}function ue(O){return O===124?E(O):O===null||Be(O)?!c||l!==u?U(O):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(O)):U(O)}function U(O){return r(O)}function M(O){return e.enter("tableRow"),K(O)}function K(O){return O===124?(e.enter("tableCellDivider"),e.consume(O),e.exit("tableCellDivider"),K):O===null||Be(O)?(e.exit("tableRow"),t(O)):tt(O)?ot(e,K,"whitespace")(O):(e.enter("data"),V(O))}function V(O){return O===null||O===124||Tt(O)?(e.exit("data"),K(O)):(e.consume(O),O===92?q:V)}function q(O){return O===92||O===124?(e.consume(O),V):V(O)}}function iO(e,t){let r=-1,s=!0,l=0,u=[0,0,0,0],c=[0,0,0,0],f=!1,m=0,d,y,g;const x=new W3;for(;++r<e.length;){const w=e[r],E=w[1];w[0]==="enter"?E.type==="tableHead"?(f=!1,m!==0&&(Ub(x,t,m,d,y),y=void 0,m=0),d={type:"table",start:Object.assign({},E.start),end:Object.assign({},E.end)},x.add(r,0,[["enter",d,t]])):E.type==="tableRow"||E.type==="tableDelimiterRow"?(s=!0,g=void 0,u=[0,0,0,0],c=[0,r+1,0,0],f&&(f=!1,y={type:"tableBody",start:Object.assign({},E.start),end:Object.assign({},E.end)},x.add(r,0,[["enter",y,t]])),l=E.type==="tableDelimiterRow"?2:y?3:1):l&&(E.type==="data"||E.type==="tableDelimiterMarker"||E.type==="tableDelimiterFiller")?(s=!1,c[2]===0&&(u[1]!==0&&(c[0]=c[1],g=bu(x,t,u,l,void 0,g),u=[0,0,0,0]),c[2]=r)):E.type==="tableCellDivider"&&(s?s=!1:(u[1]!==0&&(c[0]=c[1],g=bu(x,t,u,l,void 0,g)),u=c,c=[u[1],r,0,0])):E.type==="tableHead"?(f=!0,m=r):E.type==="tableRow"||E.type==="tableDelimiterRow"?(m=r,u[1]!==0?(c[0]=c[1],g=bu(x,t,u,l,r,g)):c[1]!==0&&(g=bu(x,t,c,l,r,g)),l=0):l&&(E.type==="data"||E.type==="tableDelimiterMarker"||E.type==="tableDelimiterFiller")&&(c[3]=r)}for(m!==0&&Ub(x,t,m,d,y),x.consume(t.events),r=-1;++r<t.events.length;){const w=t.events[r];w[0]==="enter"&&w[1].type==="table"&&(w[1]._align=tO(t.events,r))}return e}function bu(e,t,r,s,l,u){const c=s===1?"tableHeader":s===2?"tableDelimiter":"tableData",f="tableContent";r[0]!==0&&(u.end=Object.assign({},ra(t.events,r[0])),e.add(r[0],0,[["exit",u,t]]));const m=ra(t.events,r[1]);if(u={type:c,start:Object.assign({},m),end:Object.assign({},m)},e.add(r[1],0,[["enter",u,t]]),r[2]!==0){const d=ra(t.events,r[2]),y=ra(t.events,r[3]),g={type:f,start:Object.assign({},d),end:Object.assign({},y)};if(e.add(r[2],0,[["enter",g,t]]),s!==2){const x=t.events[r[2]],w=t.events[r[3]];if(x[1].end=Object.assign({},w[1].end),x[1].type="chunkText",x[1].contentType="text",r[3]>r[2]+1){const E=r[2]+1,R=r[3]-r[2]-1;e.add(E,R,[])}}e.add(r[3]+1,0,[["exit",g,t]])}return l!==void 0&&(u.end=Object.assign({},ra(t.events,l)),e.add(l,0,[["exit",u,t]]),u=void 0),u}function Ub(e,t,r,s,l){const u=[],c=ra(t.events,r);l&&(l.end=Object.assign({},c),u.push(["exit",l,t])),s.end=Object.assign({},c),u.push(["exit",s,t]),e.add(r+1,0,u)}function ra(e,t){const r=e[t],s=r[0]==="enter"?"start":"end";return r[1][s]}const sO={name:"tasklistCheck",tokenize:lO};function aO(){return{text:{91:sO}}}function lO(e,t,r){const s=this;return l;function l(m){return s.previous!==null||!s._gfmTasklistFirstContentOfListItem?r(m):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(m),e.exit("taskListCheckMarker"),u)}function u(m){return Tt(m)?(e.enter("taskListCheckValueUnchecked"),e.consume(m),e.exit("taskListCheckValueUnchecked"),c):m===88||m===120?(e.enter("taskListCheckValueChecked"),e.consume(m),e.exit("taskListCheckValueChecked"),c):r(m)}function c(m){return m===93?(e.enter("taskListCheckMarker"),e.consume(m),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),f):r(m)}function f(m){return Be(m)?t(m):tt(m)?e.check({tokenize:oO},t,r)(m):r(m)}}function oO(e,t,r){return ot(e,s,"whitespace");function s(l){return l===null?r(l):t(l)}}function uO(e){return Wx([D3(),$3(),Z3(e),nO(),aO()])}const cO={};function Bb(e){const t=this,r=e||cO,s=t.data(),l=s.micromarkExtensions||(s.micromarkExtensions=[]),u=s.fromMarkdownExtensions||(s.fromMarkdownExtensions=[]),c=s.toMarkdownExtensions||(s.toMarkdownExtensions=[]);l.push(uO(r)),u.push(N3()),c.push(O3(r))}function fO(e){v1(e,[/\r?\n|\r/g,hO])}function hO(){return{type:"break"}}function Pb(){return function(e){fO(e)}}function dO({connected:e,hostId:t,request:r,subscribeEvents:s,taskId:l,runId:u}){const c=Or(),[f,m]=j.useState(!0),[d,y]=j.useState([]),[g,x]=j.useState(),[w,E]=j.useState(),R=g==="started"||g==="monitoring",B=g==="followup",D=g==="started"||g==="followup",[P,F]=j.useState(null),[ue,U]=j.useState(!1),[M,K]=j.useState(""),[V,q]=j.useState(!1),O=j.useRef(null),X=j.useRef(null),J=j.useRef(null),[le,te]=j.useState(u==="latest"?void 0:u),$=u==="latest"&&le===null;j.useEffect(()=>{if(u!=="latest"){te(u);return}e&&(te(void 0),r("taskrun.list",{task_id:l,limit:1}).then(_=>{var L,Q;return te(((Q=(L=_.entries)==null?void 0:L[0])==null?void 0:Q.run_id)??null)}).catch(()=>te(null)))},[u,l,e,r]);async function H(){if(le)try{const _=await r("task.result",{id:l,run_id:le});if(_.error){console.error("No result:",_.error),c(t?`/hosts/${encodeURIComponent(t)}`:"/",{replace:!0});return}y(_.messages??[]),x(_.running_state),E(_.agent)}catch(_){console.error("Failed to load result:",_),c(t?`/hosts/${encodeURIComponent(t)}`:"/",{replace:!0})}finally{m(!1)}}async function ee(_){var L;if(le)try{const A=(L=(await r("task.reports",{id:l,run_id:le,report_files:[_]})).reports)==null?void 0:L[0];A!=null&&A.data_url?F({file:_,data_url:A.data_url}):F({file:_,content:(A==null?void 0:A.content)??"Report not found."})}catch{F({file:_,content:"Failed to load report."})}}j.useEffect(()=>{!e||!le||(m(!0),H())},[e,l,le]),j.useEffect(()=>!e||!t||!le?void 0:s(t,async L=>{try{const Q=JSON.parse(new TextDecoder().decode(L.data));if(Q.event_type!=="running-state"&&Q.event_type!=="result-updated"||L.subject.split(".").pop()!==l||Q.event_type==="result-updated"&&Q.run_id&&Q.run_id!==le)return;H()}catch{}}),[e,t,l,le,s,r]),j.useEffect(()=>{O.current&&(O.current.scrollTop=O.current.scrollHeight)},[d]),j.useEffect(()=>{f||$||!le||J.current!==le&&(J.current=le,requestAnimationFrame(()=>{O.current&&(O.current.scrollTop=O.current.scrollHeight),window.scrollTo({top:document.documentElement.scrollHeight,behavior:"auto"})}))},[f,$,le]);function oe(_){if(_==="input")return"User Input";if(_==="permission")return"Permission";if(_==="confirmation")return"Confirmation"}function be(_){return _==="started"?"Task started":_==="finished"?"Task finished":_==="failed"?"Task failed":_==="error"?"Command failed":_==="aborted"?"Task aborted":_==="confirmation"?"Task confirmed":_==="stopped"?"Follow-up stopped":_??""}return b.jsxs("div",{className:"run-detail",children:[b.jsxs("button",{className:"run-detail-back",onClick:()=>c(-1),children:[b.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:b.jsx("path",{d:"M15 18l-6-6 6-6"})}),"Back"]}),$?b.jsxs("div",{className:"empty-state",children:[b.jsx("p",{className:"empty-state-text",children:"No runs yet"}),b.jsx("p",{className:"empty-state-hint",children:"This task hasn't been executed yet. Run it from the task menu or wait for its next trigger."})]}):f?b.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"var(--space-sm)",padding:"var(--space-sm) 0"},children:[b.jsx("div",{className:"skeleton-line",style:{width:"40%"}}),b.jsx("div",{className:"skeleton-line",style:{width:"55%"}}),b.jsx("div",{className:"skeleton-line",style:{width:"100%",height:"8rem",marginTop:"var(--space-sm)"}})]}):b.jsxs(b.Fragment,{children:[b.jsxs("div",{className:"chat-thread",ref:O,children:[d.map((_,L)=>{const Q=D&&_.role==="assistant"&&!d.slice(L+1).some(A=>A.role==="assistant"||A.role==="user");return _.role==="status"&&_.type==="monitoring"?null:_.role==="status"?b.jsxs("div",{className:`chat-status${_.type==="error"?" chat-status--error":""}`,children:[b.jsxs("div",{children:[be(_.type),_.time>0&&b.jsx("span",{className:"chat-status-time",children:Bu(_.time)})]}),_.content&&b.jsx("pre",{className:"chat-status-detail",children:_.content})]},L):b.jsxs("div",{className:`chat-message chat-message--${_.role}`,children:[_.role==="assistant"&&w&&b.jsx("div",{className:"chat-message-agent",children:dd(w)}),b.jsxs("div",{className:"chat-message-content",children:[b.jsx(Nb,{remarkPlugins:[Bb,Pb],children:_.content}),Q&&b.jsxs("div",{className:"chat-typing-indicator",children:[b.jsx("span",{}),b.jsx("span",{}),b.jsx("span",{})]})]}),_.attachments&&_.attachments.length>0&&b.jsx("div",{className:"chat-message-attachments",children:_.attachments.map(A=>b.jsx("button",{className:"chat-attachment-chip",onClick:()=>ee(A),children:A},A))}),b.jsxs("div",{className:"chat-message-meta",children:[oe(_.type)&&b.jsx("span",{className:"chat-message-type",children:oe(_.type)}),_.time>0&&b.jsx("span",{children:Bu(_.time)})]})]},L)}),D&&(()=>{const _=d.filter(L=>L.role!=="status");return _.length===0||_[_.length-1].role!=="assistant"})()&&b.jsxs("div",{className:"chat-message chat-message--assistant",children:[w&&b.jsx("div",{className:"chat-message-agent",children:dd(w)}),b.jsxs("div",{className:"chat-typing-indicator",children:[b.jsx("span",{}),b.jsx("span",{}),b.jsx("span",{})]})]}),g==="monitoring"&&b.jsxs("div",{className:"chat-monitoring-indicator",children:[b.jsx("span",{className:"chat-monitoring-dot"}),"Monitoring command output"]})]}),R?b.jsx("div",{className:"chat-abort-bar",children:b.jsx("button",{className:"btn btn-secondary chat-abort-btn",disabled:ue,onClick:async()=>{if(confirm("Abort this task?")){U(!0);try{await r("task.abort",{id:l})}catch(_){console.error("Abort failed:",_)}finally{U(!1)}}},children:ue?"Aborting...":"Abort Task"})}):B?b.jsx("div",{className:"chat-input-bar",children:b.jsx("button",{className:"btn btn-secondary chat-stop-btn",disabled:ue,onClick:async()=>{U(!0);try{await r("task.stop_followup",{id:l,run_id:le})}catch(_){console.error("Stop failed:",_)}finally{U(!1)}},children:b.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor",children:b.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"2"})})})}):b.jsxs("form",{className:"chat-input-bar",onSubmit:async _=>{_.preventDefault();const L=M.trim();if(!(!L||V)){q(!0);try{await r("task.followup",{id:l,run_id:le,message:L}),K("")}catch(Q){console.error("Follow-up failed:",Q)}finally{q(!1)}}},children:[b.jsx("input",{ref:X,className:"chat-input",type:"text",placeholder:"Follow-up message",value:M,onChange:_=>K(_.target.value),disabled:V}),b.jsx("button",{className:"btn btn-primary chat-send-btn",type:"submit",disabled:!M.trim()||V,children:b.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[b.jsx("line",{x1:"22",y1:"2",x2:"11",y2:"13"}),b.jsx("polygon",{points:"22 2 15 22 11 13 2 9 22 2"})]})})]})]}),P&&b.jsx("div",{className:"report-dialog-overlay",onClick:()=>F(null),children:b.jsxs("div",{className:"report-dialog",onClick:_=>_.stopPropagation(),children:[b.jsxs("div",{className:"report-dialog-header",children:[b.jsx("span",{className:"report-dialog-title",children:P.file}),b.jsx("button",{className:"report-dialog-close",onClick:()=>F(null),"aria-label":"Close",children:b.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[b.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),b.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),b.jsx("div",{className:"report-dialog-body",children:P.data_url?b.jsx("img",{src:P.data_url,alt:P.file,style:{maxWidth:"100%",height:"auto"}}):b.jsx(Nb,{remarkPlugins:[Bb,Pb],components:{a:({..._})=>b.jsx("a",{..._,target:"_blank",rel:"noopener noreferrer"})},children:P.content??""})})]})})]})}function mO(){const{activeHost:e}=Hi(),t=j.useRef(null);j.useEffect(()=>{if(Vn.isNativePlatform()||e.directUrl||t.current===e.hostId)return;async function r(){var s;try{if(!("serviceWorker"in navigator)||!("PushManager"in window)){console.warn("[Push] Push notifications not supported");return}const l=await navigator.serviceWorker.ready;(s=l.active)==null||s.postMessage({type:"set-host-id",hostId:e.hostId});let u=await l.pushManager.getSubscription();if(!u){const{publicKey:f}=await hE("/api/push/vapid-key");if(!f){console.warn("[Push] No VAPID public key configured on server");return}if(await Notification.requestPermission()!=="granted"){console.log("[Push] Permission denied");return}u=await l.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:f})}const c=u.toJSON();await fE("/api/push/subscribe",{hostId:e.hostId,endpoint:c.endpoint,keys:{p256dh:c.keys.p256dh,auth:c.keys.auth}}),t.current=e.hostId}catch(l){console.error("[Push] Subscription failed:",l)}}r()},[e])}const pO="0.8.11";function gO(e,t){if(e.includes("-"))return!1;const r=e.split(".").map(Number),s=t.split(".").map(Number);for(let l=0;l<3;l++){if((r[l]??0)<(s[l]??0))return!0;if((r[l]??0)>(s[l]??0))return!1}return!1}function xu(){const{removePairedHost:e,setHostLanUrl:t}=Pi(),{connected:r,request:s,subscribeEvents:l,unauthorized:u,activeHost:c}=Hi(),f=c.hostId,m=c.clientToken||null,d=Or(),y=or(),g=Yu(),x=Ux("(min-width: 768px)"),w=y.pathname.endsWith("/tasks"),E=g.runId?void 0:g.taskId,R=!!(g.taskId&&g.runId),[B,D]=j.useState(!1),[P,F]=j.useState(!1),[ue,U]=j.useState(null),[M,K]=j.useState(null),[V,q]=j.useState(null),[O,X]=j.useState(new Set),[J,le]=j.useState([]),[te,$]=j.useState(),H=!!m&&V===m,[ee,oe]=j.useState(new Map),[be,_]=j.useState(new Map),[L,Q]=j.useState(new Map),[A,xe]=j.useState(new Map);mO(),j.useEffect(()=>{window.scrollTo(0,0)},[f]),j.useEffect(()=>{let je=!1;return DE().then(Fe=>{je||X(Fe)}),()=>{je=!0}},[]),j.useEffect(()=>{r&&s("host.info").then(je=>{var Ve,He,nt,ft,rt,qt;le(je.agents??[]),$(je.host_platform),q(je.linked_client_token??null),yE(je.agents??[]);const Fe=je.version??null;K(Fe),D(!!Fe&&gO(Fe,pO)),t(f,je.lan_url??void 0);const Qe=new Map,qe=new Map,ct=new Map,vt=new Map;for(const jt of je.pending_prompts??[])if(jt.type==="confirmation")Qe.set(jt.key,{description:((Ve=jt.meta)==null?void 0:Ve.description)??"",sessionName:(He=jt.meta)==null?void 0:He.session_name});else if(jt.type==="permission")qe.set(jt.key,{permissions:jt.params??[],sessionName:(nt=jt.meta)==null?void 0:nt.session_name});else if(jt.type==="input"){const ht=jt.params??((ft=jt.meta)==null?void 0:ft.input_questions)??[];ct.set(jt.key,{questions:ht,description:(rt=jt.meta)==null?void 0:rt.description,sessionName:(qt=jt.meta)==null?void 0:qt.session_name}),vt.set(jt.key,new Array(ht.length).fill(""))}oe(Qe),_(qe),Q(ct),xe(vt)}).catch(()=>{})},[r,f,s,t]),j.useEffect(()=>r?l(f,Fe=>{const Qe=Fe.subject.split(".");if(Qe.length<3)return;const qe=Qe.slice(2).join(".");let ct={};try{ct=JSON.parse(new TextDecoder().decode(Fe.data))}catch{return}const vt=ct.event_type,Ve=ct.session_id;if(vt==="input-request"&&Ve){const He=ct.input_questions,nt=ct.session_name,ft=ct.description;He!=null&&He.length&&(Q(rt=>{if(rt.has(Ve))return rt;const qt=new Map(rt);return qt.set(Ve,{questions:He,description:ft,sessionName:nt}),qt}),xe(rt=>{if(rt.has(Ve))return rt;const qt=new Map(rt);return qt.set(Ve,new Array(He.length).fill("")),qt}));return}if(vt==="input-resolved"&&Ve){Q(He=>{if(!He.has(Ve))return He;const nt=new Map(He);return nt.delete(Ve),nt}),xe(He=>{const nt=new Map(He);return nt.delete(Ve),nt});return}if(vt==="confirm-request"&&Ve){const He=ct.description,nt=ct.session_name;He&&oe(ft=>{if(ft.has(Ve))return ft;const rt=new Map(ft);return rt.set(Ve,{description:He,sessionName:nt}),rt});return}if(vt==="confirm-resolved"&&Ve){oe(He=>{if(!He.has(Ve))return He;const nt=new Map(He);return nt.delete(Ve),nt});return}if(vt==="permission-request"){const He=ct.required_permissions,nt=ct.session_name;He!=null&&He.length&&_(ft=>{if(ft.has(qe))return ft;const rt=new Map(ft);return rt.set(qe,{permissions:He,sessionName:nt}),rt});return}if(vt==="permission-resolved"){_(He=>{if(!He.has(qe))return He;const nt=new Map(He);return nt.delete(qe),nt});return}}):void 0,[r,f,l]);async function _e(je,Fe){try{await s("task.user_input",{id:je,value:[Fe]})}catch(Qe){console.error("[Dashboard] Failed to respond to confirmation:",Qe)}}async function Te(je,Fe){try{await s("task.user_input",{id:je,value:[Fe]})}catch(Qe){console.error("[Dashboard] Failed to respond to permission request:",Qe)}}async function Le(je,Fe){try{await s("task.user_input",{id:je,value:Fe})}catch(Qe){console.error("[Dashboard] Failed to respond to input request:",Qe)}}function $e(je,Fe){if(!ms())return;const Qe=`/hosts/${encodeURIComponent(f)}/runs/${encodeURIComponent(je)}`;d(Fe?`${Qe}/${encodeURIComponent(Fe)}`:Qe)}async function Ce(){F(!0),U(null);try{const je=await s("host.update");if(je.error){U(je.error),F(!1);return}}catch{}setTimeout(()=>window.location.reload(),15e3)}const Ne=r&&!u;return b.jsxs("div",{className:"dashboard",children:[x&&b.jsx($0,{daemonVersion:M,linkedClientToken:V,request:s,onEnabledCapabilitiesChange:X,onLinkedClientTokenChange:q}),b.jsxs("div",{className:"dashboard-content",children:[b.jsxs("header",{className:"app-header",children:[b.jsxs("div",{className:"app-title-bar",children:[!x&&b.jsx($0,{daemonVersion:M,linkedClientToken:V,request:s,onEnabledCapabilitiesChange:X,onLinkedClientTokenChange:q}),b.jsx("h1",{className:"app-title",children:"Palmier"}),b.jsx(PE,{})]}),b.jsx("div",{className:"tab-bar",children:b.jsx(OE,{})})]}),b.jsx("main",{className:"dashboard-main",children:u?b.jsxs("div",{className:"revoked-state",children:[b.jsx("div",{className:"revoked-icon",children:b.jsxs("svg",{width:"32",height:"32",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[b.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),b.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"}),b.jsx("line",{x1:"12",y1:"15",x2:"12",y2:"18"})]})}),b.jsx("h2",{className:"revoked-title",children:"Client Revoked"}),b.jsx("p",{className:"revoked-description",children:"This client was revoked by the host. To reconnect, generate a new pairing code on the host machine."}),b.jsx("div",{className:"revoked-command",children:b.jsx("code",{children:"palmier pair"})}),b.jsxs("div",{className:"revoked-actions",children:[b.jsx("button",{className:"btn btn-primary",onClick:()=>{ms()&&d("/pair")},children:"Re-pair Device"}),b.jsx("button",{className:"btn btn-secondary",onClick:()=>{e(f),d("/",{replace:!0})},children:"Remove Host"})]})]}):Ne?b.jsxs(b.Fragment,{children:[w&&!R&&b.jsx(NE,{connected:r,hostId:f,request:s,subscribeEvents:l,agents:J,hostPlatform:te,isNotificationListener:H&&O.has("notifications"),onViewRun:$e}),R?b.jsx(dO,{connected:r,hostId:f,request:s,subscribeEvents:l,taskId:g.taskId,runId:decodeURIComponent(g.runId)}):w?null:b.jsx(FE,{connected:r,hostId:f,request:s,subscribeEvents:l,agents:J,hostPlatform:te,filterTaskId:E,onClearFilter:()=>{ms()&&d(`/hosts/${encodeURIComponent(f)}`)}})]}):b.jsx("div",{className:"empty-state",children:b.jsx("p",{children:"Connecting to host..."})})}),B&&!P&&!ue&&b.jsx("div",{className:"confirm-modal-overlay",children:b.jsxs("div",{className:"confirm-modal",children:[b.jsx("h2",{className:"confirm-modal-title",children:"Update Required"}),b.jsxs("p",{className:"confirm-modal-message",children:["Your Palmier host",M?` (v${M})`:""," is too old for this version of the app. Please update to continue."]}),b.jsx("div",{className:"confirm-modal-actions",children:b.jsx("button",{className:"btn btn-primary",onClick:Ce,children:"Update Now"})})]})}),P&&b.jsx("div",{className:"confirm-modal-overlay",children:b.jsxs("div",{className:"confirm-modal",children:[b.jsx("h2",{className:"confirm-modal-title",children:"Updating..."}),b.jsx("p",{className:"confirm-modal-message",children:"Installing update and restarting daemon. Please wait..."})]})}),ue&&b.jsx("div",{className:"confirm-modal-overlay",children:b.jsxs("div",{className:"confirm-modal",children:[b.jsx("h2",{className:"confirm-modal-title",children:"Update Failed"}),b.jsx("p",{className:"confirm-modal-message",style:{whiteSpace:"pre-line"},children:ue}),b.jsx("div",{className:"confirm-modal-actions",children:b.jsx("button",{className:"btn btn-secondary",onClick:()=>{U(null)},children:"Retry"})})]})})]}),aa.createPortal(b.jsxs(b.Fragment,{children:[[...ee.entries()].map(([je,{description:Fe,sessionName:Qe}])=>b.jsx("div",{className:"confirm-modal-overlay",children:b.jsxs("div",{className:"confirm-modal",children:[b.jsx("h2",{className:"confirm-modal-title",children:"Confirmation Required"}),Qe&&b.jsx("p",{className:"confirm-modal-subtitle",children:Qe}),b.jsx("p",{className:"confirm-modal-message",children:Fe}),b.jsxs("div",{className:"confirm-modal-actions",children:[b.jsx("button",{className:"btn btn-primary",onClick:()=>_e(je,"confirmed"),children:"Confirm"}),b.jsx("button",{className:"btn btn-secondary",onClick:()=>_e(je,"aborted"),children:"Abort"})]})]})},je)),[...be.entries()].map(([je,{permissions:Fe,sessionName:Qe}])=>b.jsx("div",{className:"confirm-modal-overlay",children:b.jsxs("div",{className:"confirm-modal permission-modal",children:[b.jsx("h2",{className:"confirm-modal-title",children:"Permission Required"}),b.jsx("p",{className:"confirm-modal-message",children:b.jsx("strong",{children:Qe||je})}),b.jsx("div",{className:"permission-list",children:Fe.map((qe,ct)=>b.jsxs("div",{className:"permission-item",children:[b.jsx("span",{className:"permission-name",children:qe.name}),qe.description&&b.jsx("span",{className:"permission-desc",children:qe.description})]},ct))}),b.jsxs("div",{className:"permission-actions",children:[b.jsx("button",{className:"btn btn-primary",onClick:()=>Te(je,"granted"),children:"Allow Once"}),b.jsx("button",{className:"btn btn-secondary",onClick:()=>Te(je,"granted_all"),children:"Allow Always"})]}),b.jsx("button",{className:"permission-abort-link",onClick:()=>Te(je,"aborted"),children:"Deny & Abort Task"})]})},je)),[...L.entries()].map(([je,{questions:Fe,description:Qe,sessionName:qe}])=>{const ct=A.get(je)??new Array(Fe.length).fill("");return b.jsx("div",{className:"confirm-modal-overlay",children:b.jsxs("div",{className:"confirm-modal input-modal",children:[b.jsx("h2",{className:"confirm-modal-title",children:"Input Required"}),qe&&b.jsx("p",{className:"confirm-modal-subtitle",children:qe}),Qe&&b.jsx("p",{className:"confirm-modal-message",children:Qe}),b.jsx("div",{className:"input-list",children:Fe.map((vt,Ve)=>b.jsxs("div",{className:"input-item",children:[b.jsx("label",{className:"input-label",children:vt}),b.jsx("input",{type:"text",className:"input-field",value:ct[Ve]??"",onChange:He=>{xe(nt=>{const ft=new Map(nt),rt=[...ft.get(je)??[]];return rt[Ve]=He.target.value,ft.set(je,rt),ft})},autoFocus:Ve===0})]},Ve))}),b.jsx("div",{className:"input-actions",children:b.jsx("button",{className:"btn btn-primary",disabled:ct.some(vt=>!vt.trim()),onClick:()=>Le(je,ct),children:"Submit"})}),b.jsx("button",{className:"permission-abort-link",onClick:()=>Le(je,["aborted"]),children:"Cancel"})]})},je)})]}),document.body)]})}const yO=gs("Preferences",{web:()=>Hd(()=>import("./web-C2AU9S9n.js"),[]).then(e=>new e.PreferencesWeb)}),kl=!!window.__PALMIER_SERVE__&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"),qb=Vn.isNativePlatform();function bO(){const[e,t]=j.useState(""),[r,s]=j.useState(!0),[l,u]=j.useState(!1),[c,f]=j.useState(null),{addPairedHost:m}=Pi(),d=Or();async function y(){const g=e.trim().toUpperCase();if(!g){f("Enter a pairing code.");return}u(!0),f(null);try{let x;if(kl){const R=await fetch("/pair",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:g,label:navigator.userAgent})});if(!R.ok){const B=await R.json().catch(()=>({error:"Connection failed"}));throw new Error(B.error||`HTTP ${R.status}`)}x=await R.json()}else{const R=await fetch(`${Uu}/api/config`);if(!R.ok)throw new Error("Failed to fetch server config");const B=await R.json();if(!B.natsWsUrl)throw new Error("Server has no NATS WebSocket URL configured");const D=await Nx({servers:B.natsWsUrl,authenticator:wx(B.natsJwt,new TextEncoder().encode(B.natsNkeySeed))}),P=Nu(),F=`pair.${g}`,ue=await D.request(F,P.encode(JSON.stringify({label:navigator.userAgent})),{timeout:1e4});x=JSON.parse(P.decode(ue.data)),await D.close()}const w={hostId:x.hostId,clientToken:x.clientToken,directUrl:kl?window.location.origin:void 0,...x.hostName?{name:x.hostName}:{}};if(m(w),Vn.isNativePlatform()&&mn){await yO.set({key:"hostId",value:x.hostId});try{const{token:R}=await mn.getFcmToken();await fetch(`${Uu}/api/fcm/register`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({hostId:x.hostId,fcmToken:R})})}catch(R){console.warn("FCM token registration failed:",R)}}const E=`/hosts/${encodeURIComponent(x.hostId)}`;d(qb&&r?`${E}/pair/setup`:E)}catch(x){const w=x instanceof Error?x.message:String(x);w.includes("timeout")||w.includes("TIMEOUT")||w.includes("503")||w.toLowerCase().includes("no responders")?f("Code not found or expired. Check the code and try again."):f(w)}finally{u(!1)}}return b.jsx("div",{className:"pair-page",children:b.jsxs("div",{className:"pair-card",children:[b.jsxs("div",{className:"pair-header",children:[b.jsx("h1",{className:"pair-title",children:kl?"Pair":"Pair with Host"}),b.jsx("p",{className:"pair-subtitle",children:kl?"Enter the pairing code shown in your terminal.":"Connect this device to a Palmier host"})]}),!kl&&b.jsxs("div",{className:"pair-instructions",children:[b.jsxs("div",{className:"pair-instruction-block",children:[b.jsx("h3",{className:"pair-instruction-heading",children:"Setting up a new host?"}),b.jsxs("ol",{className:"pair-steps",children:[b.jsxs("li",{children:["Install at least one agent CLI (e.g., ",b.jsx("a",{href:"https://www.palmier.me/agents",target:"_blank",rel:"noopener noreferrer",children:"Claude Code, Gemini CLI, Codex CLI"}),")"]}),b.jsxs("li",{children:["Install Palmier on your host machine:",b.jsx("code",{className:"pair-command",children:"npm install -g palmier"})]}),b.jsxs("li",{children:["Run the setup wizard:",b.jsx("code",{className:"pair-command",children:"palmier init"})]}),b.jsx("li",{children:"A pairing code will display automatically"})]})]}),b.jsx("div",{className:"pair-instruction-divider"}),b.jsxs("div",{className:"pair-instruction-block",children:[b.jsx("h3",{className:"pair-instruction-heading",children:"Pairing an existing host?"}),b.jsxs("ol",{className:"pair-steps",children:[b.jsxs("li",{children:["Run ",b.jsx("code",{children:"palmier pair"})," on the host machine"]}),b.jsx("li",{children:"Enter the 6-character code below"})]})]})]}),b.jsxs("div",{className:"pair-form",children:[b.jsxs("label",{className:"form-label",htmlFor:"pair-code",children:["Pairing code",b.jsx("input",{id:"pair-code",type:"text",maxLength:6,value:e,onChange:g=>t(g.target.value.toUpperCase()),placeholder:"A7K9M2",className:"form-input form-input-mono pair-code-input",autoFocus:!0,autoComplete:"off",disabled:l})]}),qb&&b.jsxs("label",{className:"pair-checkbox",children:[b.jsx("input",{type:"checkbox",checked:r,onChange:g=>s(g.target.checked),disabled:l}),b.jsxs("span",{className:"pair-checkbox-text",children:[b.jsx("span",{className:"pair-checkbox-title",children:"Link this device"}),b.jsx("span",{className:"pair-checkbox-hint",children:"The host will use this device for SMS, contacts, calendar, location, and alarms. Only one device can be linked at a time."})]})]}),c&&b.jsx("p",{className:"pair-error",children:c}),b.jsxs("button",{className:"btn btn-primary btn-full",onClick:y,disabled:l||!e.trim(),children:[l&&b.jsx("span",{className:"btn-spinner"}),l?"Pairing...":"Pair"]}),b.jsx("button",{className:"btn btn-secondary btn-full",onClick:()=>d("/"),disabled:l,children:"Cancel"}),b.jsxs("p",{className:"pair-consent",children:["By pairing, you agree to our"," ",b.jsx("a",{href:"https://www.palmier.me/terms",target:"_blank",rel:"noopener noreferrer",children:"Terms of Service"})," and"," ",b.jsx("a",{href:"https://www.palmier.me/privacy",target:"_blank",rel:"noopener noreferrer",children:"Privacy Policy"}),"."]})]})]})})}function xO(){const e=Or(),{connected:t,request:r,activeHost:s}=Hi(),{setHostLanUrl:l,pairedHosts:u}=Pi(),c=u.length<=1,[f,m]=j.useState("loading"),[d,y]=j.useState(null),[g,x]=j.useState(null);function w(){e(`/hosts/${encodeURIComponent(s.hostId)}`,{replace:!0})}j.useEffect(()=>{if(!t||f!=="loading")return;let P=!1;return r("host.info").catch(()=>({})).then(F=>{if(P)return;l(s.hostId,F.lan_url??void 0);const ue=F.linked_client_token??null;y(ue);const U=!!ue&&ue!==s.clientToken;m(U?"confirming":"linking")}),()=>{P=!0}},[t,f,s,r,l]),j.useEffect(()=>{if(f!=="linking")return;let P=!1;return(async()=>{try{if(mn){const{token:F}=await mn.getFcmToken();if(!F)throw new Error("Could not read FCM token");await r("device.link",{fcmToken:F})}if(P)return;c?m("wizard"):w()}catch(F){if(P)return;x(F instanceof Error?F.message:String(F)),m("linkError")}})(),()=>{P=!0}},[f]);function E(){m("linking")}function R(){w()}function B(){x(null),m("linking")}const D=f==="confirming"&&aa.createPortal(b.jsx("div",{className:"confirm-modal-overlay",onClick:R,children:b.jsxs("div",{className:"confirm-modal",onClick:P=>P.stopPropagation(),children:[b.jsx("h2",{className:"confirm-modal-title",children:"Link this device?"}),b.jsx("p",{className:"confirm-modal-message",children:"Only one device can be linked at a time — switching will disable those capabilities on the currently linked device."}),b.jsxs("div",{className:"confirm-modal-actions",children:[b.jsx("button",{className:"btn btn-secondary",onClick:R,children:"Cancel"}),b.jsx("button",{className:"btn btn-primary",onClick:E,children:"Link"})]})]})}),document.body);if(f==="loading"||f==="confirming"||f==="linking"||f==="linkError"){const P=c;return b.jsxs("div",{className:"pair-setup",children:[b.jsxs("div",{className:"pair-setup-inner",children:[P&&b.jsx("h1",{className:"pair-setup-title",children:"Device Capabilities"}),b.jsxs("div",{className:"pair-setup-loading",children:[f==="loading"&&"Connecting to host…",f==="confirming"&&"Awaiting confirmation…",f==="linking"&&"Linking device…",f==="linkError"&&b.jsxs(b.Fragment,{children:[b.jsx("p",{className:"pair-error",children:g}),b.jsx("button",{className:"btn btn-primary",onClick:B,children:"Retry"}),b.jsx("button",{className:"btn btn-secondary",onClick:w,style:{marginTop:8},children:"Skip linking"})]})]})]}),D]})}return b.jsx("div",{className:"pair-setup",children:b.jsxs("div",{className:"pair-setup-inner",children:[b.jsx("h1",{className:"pair-setup-title",children:"Device Capabilities"}),b.jsx("p",{className:"pair-setup-description",children:"Choose what the host can use this device for. You can change these later from the menu."}),b.jsx(Bx,{}),b.jsx("div",{className:"pair-setup-actions",children:b.jsx("button",{className:"btn btn-primary btn-full",onClick:w,children:"Finish"})})]})})}function vO(){const e=Or();return j.useEffect(()=>{if(!mn)return;const t=mn.addListener("deepLink",({path:r})=>e(r));return()=>{t.then(r=>r.remove())}},[e]),null}function wO(){const{pairedHosts:e}=Pi();return e.length===0?b.jsx(Ll,{to:"/pair",replace:!0}):b.jsx(Ll,{to:`/hosts/${encodeURIComponent(e[0].hostId)}`,replace:!0})}function SO(){const{hostId:e}=Yu(),{pairedHosts:t}=Pi(),r=t.find(s=>s.hostId===e)??null;return r?b.jsx(gE,{activeHost:r,children:b.jsxs(nx,{children:[b.jsx(gr,{index:!0,element:b.jsx(xu,{})}),b.jsx(gr,{path:"tasks",element:b.jsx(xu,{})}),b.jsx(gr,{path:"runs/:taskId",element:b.jsx(xu,{})}),b.jsx(gr,{path:"runs/:taskId/:runId",element:b.jsx(xu,{})}),b.jsx(gr,{path:"pair/setup",element:b.jsx(xO,{})}),b.jsx(gr,{path:"*",element:b.jsx(Ll,{to:".",replace:!0})})]})}):b.jsx(Ll,{to:"/",replace:!0})}function _O(){return b.jsxs(q_,{children:[b.jsx(vO,{}),b.jsxs(nx,{children:[b.jsx(gr,{path:"/",element:b.jsx(wO,{})}),b.jsx(gr,{path:"/pair",element:b.jsx(bO,{})}),b.jsx(gr,{path:"/hosts/:hostId/*",element:b.jsx(SO,{})}),b.jsx(gr,{path:"*",element:b.jsx(Ll,{to:"/",replace:!0})})]})]})}lS.createRoot(document.getElementById("root")).render(b.jsx(j.StrictMode,{children:b.jsx(A_,{children:b.jsx(_O,{})})}));export{qd as W};
|