palmier 1.0.10 → 1.0.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- var rS=Object.defineProperty;var iS=(e,t,r)=>t in e?rS(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var C=(e,t,r)=>iS(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 Gb(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var hh={exports:{}},gl={};/**
1
+ var sS=Object.defineProperty;var aS=(e,t,r)=>t in e?sS(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var C=(e,t,r)=>aS(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 o of l)if(o.type==="childList")for(const c of o.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&s(c)}).observe(document,{childList:!0,subtree:!0});function r(l){const o={};return l.integrity&&(o.integrity=l.integrity),l.referrerPolicy&&(o.referrerPolicy=l.referrerPolicy),l.crossOrigin==="use-credentials"?o.credentials="include":l.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function s(l){if(l.ep)return;l.ep=!0;const o=r(l);fetch(l.href,o)}})();function Vb(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var hh={exports:{}},gl={};/**
2
2
  * @license React
3
3
  * react-jsx-runtime.production.js
4
4
  *
@@ -6,7 +6,7 @@ var rS=Object.defineProperty;var iS=(e,t,r)=>t in e?rS(e,t,{enumerable:!0,config
6
6
  *
7
7
  * This source code is licensed under the MIT license found in the
8
8
  * LICENSE file in the root directory of this source tree.
9
- */var Qy;function sS(){if(Qy)return gl;Qy=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 gl.Fragment=t,gl.jsx=r,gl.jsxs=r,gl}var Zy;function aS(){return Zy||(Zy=1,hh.exports=sS()),hh.exports}var b=aS(),dh={exports:{}},Je={};/**
9
+ */var Zy;function lS(){if(Zy)return gl;Zy=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function r(s,l,o){var c=null;if(o!==void 0&&(c=""+o),l.key!==void 0&&(c=""+l.key),"key"in l){o={};for(var f in l)f!=="key"&&(o[f]=l[f])}else o=l;return l=o.ref,{$$typeof:e,type:s,key:c,ref:l!==void 0?l:null,props:o}}return gl.Fragment=t,gl.jsx=r,gl.jsxs=r,gl}var Wy;function oS(){return Wy||(Wy=1,hh.exports=lS()),hh.exports}var b=oS(),dh={exports:{}},Je={};/**
10
10
  * @license React
11
11
  * react.production.js
12
12
  *
@@ -14,7 +14,7 @@ var rS=Object.defineProperty;var iS=(e,t,r)=>t in e?rS(e,t,{enumerable:!0,config
14
14
  *
15
15
  * This source code is licensed under the MIT license found in the
16
16
  * LICENSE file in the root directory of this source tree.
17
- */var Wy;function lS(){if(Wy)return Je;Wy=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"),d=Symbol.for("react.suspense"),m=Symbol.for("react.memo"),y=Symbol.for("react.lazy"),g=Symbol.for("react.activity"),x=Symbol.iterator;function v(U){return U===null||typeof U!="object"?null:(U=x&&U[x]||U["@@iterator"],typeof U=="function"?U:null)}var S={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},j=Object.assign,D={};function T(U,ee,_){this.props=U,this.context=ee,this.refs=D,this.updater=_||S}T.prototype.isReactComponent={},T.prototype.setState=function(U,ee){if(typeof U!="object"&&typeof U!="function"&&U!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,U,ee,"setState")},T.prototype.forceUpdate=function(U){this.updater.enqueueForceUpdate(this,U,"forceUpdate")};function P(){}P.prototype=T.prototype;function I(U,ee,_){this.props=U,this.context=ee,this.refs=D,this.updater=_||S}var W=I.prototype=new P;W.constructor=I,j(W,T.prototype),W.isPureReactComponent=!0;var B=Array.isArray;function R(){}var Z={H:null,A:null,T:null,S:null},F=Object.prototype.hasOwnProperty;function V(U,ee,_){var ge=_.ref;return{$$typeof:e,type:U,key:ee,ref:ge!==void 0?ge:null,props:_}}function L(U,ee){return V(U.type,ee,U.props)}function X(U){return typeof U=="object"&&U!==null&&U.$$typeof===e}function G(U){var ee={"=":"=0",":":"=2"};return"$"+U.replace(/[=:]/g,function(_){return ee[_]})}var ue=/\/+/g;function le(U,ee){return typeof U=="object"&&U!==null&&U.key!=null?G(""+U.key):ee.toString(36)}function re(U){switch(U.status){case"fulfilled":return U.value;case"rejected":throw U.reason;default:switch(typeof U.status=="string"?U.then(R,R):(U.status="pending",U.then(function(ee){U.status==="pending"&&(U.status="fulfilled",U.value=ee)},function(ee){U.status==="pending"&&(U.status="rejected",U.reason=ee)})),U.status){case"fulfilled":return U.value;case"rejected":throw U.reason}}throw U}function $(U,ee,_,ge,Ce){var we=typeof U;(we==="undefined"||we==="boolean")&&(U=null);var Te=!1;if(U===null)Te=!0;else switch(we){case"bigint":case"string":case"number":Te=!0;break;case"object":switch(U.$$typeof){case e:case t:Te=!0;break;case y:return Te=U._init,$(Te(U._payload),ee,_,ge,Ce)}}if(Te)return Ce=Ce(U),Te=ge===""?"."+le(U,0):ge,B(Ce)?(_="",Te!=null&&(_=Te.replace(ue,"$&/")+"/"),$(Ce,ee,_,"",function(dt){return dt})):Ce!=null&&(X(Ce)&&(Ce=L(Ce,_+(Ce.key==null||U&&U.key===Ce.key?"":(""+Ce.key).replace(ue,"$&/")+"/")+Te)),ee.push(Ce)),1;Te=0;var Ve=ge===""?".":ge+":";if(B(U))for(var Ae=0;Ae<U.length;Ae++)ge=U[Ae],we=Ve+le(ge,Ae),Te+=$(ge,ee,_,we,Ce);else if(Ae=v(U),typeof Ae=="function")for(U=Ae.call(U),Ae=0;!(ge=U.next()).done;)ge=ge.value,we=Ve+le(ge,Ae++),Te+=$(ge,ee,_,we,Ce);else if(we==="object"){if(typeof U.then=="function")return $(re(U),ee,_,ge,Ce);throw ee=String(U),Error("Objects are not valid as a React child (found: "+(ee==="[object Object]"?"object with keys {"+Object.keys(U).join(", ")+"}":ee)+"). If you meant to render a collection of children, use an array instead.")}return Te}function q(U,ee,_){if(U==null)return U;var ge=[],Ce=0;return $(U,ge,"","",function(we){return ee.call(_,we,Ce++)}),ge}function ae(U){if(U._status===-1){var ee=U._result;ee=ee(),ee.then(function(_){(U._status===0||U._status===-1)&&(U._status=1,U._result=_)},function(_){(U._status===0||U._status===-1)&&(U._status=2,U._result=_)}),U._status===-1&&(U._status=0,U._result=ee)}if(U._status===1)return U._result.default;throw U._result}var be=typeof reportError=="function"?reportError:function(U){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var ee=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof U=="object"&&U!==null&&typeof U.message=="string"?String(U.message):String(U),error:U});if(!window.dispatchEvent(ee))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",U);return}console.error(U)},M={map:q,forEach:function(U,ee,_){q(U,function(){ee.apply(this,arguments)},_)},count:function(U){var ee=0;return q(U,function(){ee++}),ee},toArray:function(U){return q(U,function(ee){return ee})||[]},only:function(U){if(!X(U))throw Error("React.Children.only expected to receive a single React element child.");return U}};return Je.Activity=g,Je.Children=M,Je.Component=T,Je.Fragment=r,Je.Profiler=l,Je.PureComponent=I,Je.StrictMode=s,Je.Suspense=d,Je.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=Z,Je.__COMPILER_RUNTIME={__proto__:null,c:function(U){return Z.H.useMemoCache(U)}},Je.cache=function(U){return function(){return U.apply(null,arguments)}},Je.cacheSignal=function(){return null},Je.cloneElement=function(U,ee,_){if(U==null)throw Error("The argument must be a React element, but you passed "+U+".");var ge=j({},U.props),Ce=U.key;if(ee!=null)for(we in ee.key!==void 0&&(Ce=""+ee.key),ee)!F.call(ee,we)||we==="key"||we==="__self"||we==="__source"||we==="ref"&&ee.ref===void 0||(ge[we]=ee[we]);var we=arguments.length-2;if(we===1)ge.children=_;else if(1<we){for(var Te=Array(we),Ve=0;Ve<we;Ve++)Te[Ve]=arguments[Ve+2];ge.children=Te}return V(U.type,Ce,ge)},Je.createContext=function(U){return U={$$typeof:c,_currentValue:U,_currentValue2:U,_threadCount:0,Provider:null,Consumer:null},U.Provider=U,U.Consumer={$$typeof:u,_context:U},U},Je.createElement=function(U,ee,_){var ge,Ce={},we=null;if(ee!=null)for(ge in ee.key!==void 0&&(we=""+ee.key),ee)F.call(ee,ge)&&ge!=="key"&&ge!=="__self"&&ge!=="__source"&&(Ce[ge]=ee[ge]);var Te=arguments.length-2;if(Te===1)Ce.children=_;else if(1<Te){for(var Ve=Array(Te),Ae=0;Ae<Te;Ae++)Ve[Ae]=arguments[Ae+2];Ce.children=Ve}if(U&&U.defaultProps)for(ge in Te=U.defaultProps,Te)Ce[ge]===void 0&&(Ce[ge]=Te[ge]);return V(U,we,Ce)},Je.createRef=function(){return{current:null}},Je.forwardRef=function(U){return{$$typeof:f,render:U}},Je.isValidElement=X,Je.lazy=function(U){return{$$typeof:y,_payload:{_status:-1,_result:U},_init:ae}},Je.memo=function(U,ee){return{$$typeof:m,type:U,compare:ee===void 0?null:ee}},Je.startTransition=function(U){var ee=Z.T,_={};Z.T=_;try{var ge=U(),Ce=Z.S;Ce!==null&&Ce(_,ge),typeof ge=="object"&&ge!==null&&typeof ge.then=="function"&&ge.then(R,be)}catch(we){be(we)}finally{ee!==null&&_.types!==null&&(ee.types=_.types),Z.T=ee}},Je.unstable_useCacheRefresh=function(){return Z.H.useCacheRefresh()},Je.use=function(U){return Z.H.use(U)},Je.useActionState=function(U,ee,_){return Z.H.useActionState(U,ee,_)},Je.useCallback=function(U,ee){return Z.H.useCallback(U,ee)},Je.useContext=function(U){return Z.H.useContext(U)},Je.useDebugValue=function(){},Je.useDeferredValue=function(U,ee){return Z.H.useDeferredValue(U,ee)},Je.useEffect=function(U,ee){return Z.H.useEffect(U,ee)},Je.useEffectEvent=function(U){return Z.H.useEffectEvent(U)},Je.useId=function(){return Z.H.useId()},Je.useImperativeHandle=function(U,ee,_){return Z.H.useImperativeHandle(U,ee,_)},Je.useInsertionEffect=function(U,ee){return Z.H.useInsertionEffect(U,ee)},Je.useLayoutEffect=function(U,ee){return Z.H.useLayoutEffect(U,ee)},Je.useMemo=function(U,ee){return Z.H.useMemo(U,ee)},Je.useOptimistic=function(U,ee){return Z.H.useOptimistic(U,ee)},Je.useReducer=function(U,ee,_){return Z.H.useReducer(U,ee,_)},Je.useRef=function(U){return Z.H.useRef(U)},Je.useState=function(U){return Z.H.useState(U)},Je.useSyncExternalStore=function(U,ee,_){return Z.H.useSyncExternalStore(U,ee,_)},Je.useTransition=function(){return Z.H.useTransition()},Je.version="19.2.4",Je}var e0;function Nd(){return e0||(e0=1,dh.exports=lS()),dh.exports}var A=Nd(),mh={exports:{}},yl={},ph={exports:{}},gh={};/**
17
+ */var e0;function uS(){if(e0)return Je;e0=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"),o=Symbol.for("react.consumer"),c=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),m=Symbol.for("react.memo"),y=Symbol.for("react.lazy"),g=Symbol.for("react.activity"),x=Symbol.iterator;function v(U){return U===null||typeof U!="object"?null:(U=x&&U[x]||U["@@iterator"],typeof U=="function"?U:null)}var S={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},A=Object.assign,M={};function T(U,ee,j){this.props=U,this.context=ee,this.refs=M,this.updater=j||S}T.prototype.isReactComponent={},T.prototype.setState=function(U,ee){if(typeof U!="object"&&typeof U!="function"&&U!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,U,ee,"setState")},T.prototype.forceUpdate=function(U){this.updater.enqueueForceUpdate(this,U,"forceUpdate")};function P(){}P.prototype=T.prototype;function I(U,ee,j){this.props=U,this.context=ee,this.refs=M,this.updater=j||S}var W=I.prototype=new P;W.constructor=I,A(W,T.prototype),W.isPureReactComponent=!0;var B=Array.isArray;function D(){}var Z={H:null,A:null,T:null,S:null},$=Object.prototype.hasOwnProperty;function V(U,ee,j){var ie=j.ref;return{$$typeof:e,type:U,key:ee,ref:ie!==void 0?ie:null,props:j}}function L(U,ee){return V(U.type,ee,U.props)}function X(U){return typeof U=="object"&&U!==null&&U.$$typeof===e}function G(U){var ee={"=":"=0",":":"=2"};return"$"+U.replace(/[=:]/g,function(j){return ee[j]})}var ce=/\/+/g;function oe(U,ee){return typeof U=="object"&&U!==null&&U.key!=null?G(""+U.key):ee.toString(36)}function re(U){switch(U.status){case"fulfilled":return U.value;case"rejected":throw U.reason;default:switch(typeof U.status=="string"?U.then(D,D):(U.status="pending",U.then(function(ee){U.status==="pending"&&(U.status="fulfilled",U.value=ee)},function(ee){U.status==="pending"&&(U.status="rejected",U.reason=ee)})),U.status){case"fulfilled":return U.value;case"rejected":throw U.reason}}throw U}function F(U,ee,j,ie,Ce){var _e=typeof U;(_e==="undefined"||_e==="boolean")&&(U=null);var Ee=!1;if(U===null)Ee=!0;else switch(_e){case"bigint":case"string":case"number":Ee=!0;break;case"object":switch(U.$$typeof){case e:case t:Ee=!0;break;case y:return Ee=U._init,F(Ee(U._payload),ee,j,ie,Ce)}}if(Ee)return Ce=Ce(U),Ee=ie===""?"."+oe(U,0):ie,B(Ce)?(j="",Ee!=null&&(j=Ee.replace(ce,"$&/")+"/"),F(Ce,ee,j,"",function(dt){return dt})):Ce!=null&&(X(Ce)&&(Ce=L(Ce,j+(Ce.key==null||U&&U.key===Ce.key?"":(""+Ce.key).replace(ce,"$&/")+"/")+Ee)),ee.push(Ce)),1;Ee=0;var Ve=ie===""?".":ie+":";if(B(U))for(var je=0;je<U.length;je++)ie=U[je],_e=Ve+oe(ie,je),Ee+=F(ie,ee,j,_e,Ce);else if(je=v(U),typeof je=="function")for(U=je.call(U),je=0;!(ie=U.next()).done;)ie=ie.value,_e=Ve+oe(ie,je++),Ee+=F(ie,ee,j,_e,Ce);else if(_e==="object"){if(typeof U.then=="function")return F(re(U),ee,j,ie,Ce);throw ee=String(U),Error("Objects are not valid as a React child (found: "+(ee==="[object Object]"?"object with keys {"+Object.keys(U).join(", ")+"}":ee)+"). If you meant to render a collection of children, use an array instead.")}return Ee}function q(U,ee,j){if(U==null)return U;var ie=[],Ce=0;return F(U,ie,"","",function(_e){return ee.call(j,_e,Ce++)}),ie}function le(U){if(U._status===-1){var ee=U._result;ee=ee(),ee.then(function(j){(U._status===0||U._status===-1)&&(U._status=1,U._result=j)},function(j){(U._status===0||U._status===-1)&&(U._status=2,U._result=j)}),U._status===-1&&(U._status=0,U._result=ee)}if(U._status===1)return U._result.default;throw U._result}var be=typeof reportError=="function"?reportError:function(U){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var ee=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof U=="object"&&U!==null&&typeof U.message=="string"?String(U.message):String(U),error:U});if(!window.dispatchEvent(ee))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",U);return}console.error(U)},O={map:q,forEach:function(U,ee,j){q(U,function(){ee.apply(this,arguments)},j)},count:function(U){var ee=0;return q(U,function(){ee++}),ee},toArray:function(U){return q(U,function(ee){return ee})||[]},only:function(U){if(!X(U))throw Error("React.Children.only expected to receive a single React element child.");return U}};return Je.Activity=g,Je.Children=O,Je.Component=T,Je.Fragment=r,Je.Profiler=l,Je.PureComponent=I,Je.StrictMode=s,Je.Suspense=d,Je.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=Z,Je.__COMPILER_RUNTIME={__proto__:null,c:function(U){return Z.H.useMemoCache(U)}},Je.cache=function(U){return function(){return U.apply(null,arguments)}},Je.cacheSignal=function(){return null},Je.cloneElement=function(U,ee,j){if(U==null)throw Error("The argument must be a React element, but you passed "+U+".");var ie=A({},U.props),Ce=U.key;if(ee!=null)for(_e in ee.key!==void 0&&(Ce=""+ee.key),ee)!$.call(ee,_e)||_e==="key"||_e==="__self"||_e==="__source"||_e==="ref"&&ee.ref===void 0||(ie[_e]=ee[_e]);var _e=arguments.length-2;if(_e===1)ie.children=j;else if(1<_e){for(var Ee=Array(_e),Ve=0;Ve<_e;Ve++)Ee[Ve]=arguments[Ve+2];ie.children=Ee}return V(U.type,Ce,ie)},Je.createContext=function(U){return U={$$typeof:c,_currentValue:U,_currentValue2:U,_threadCount:0,Provider:null,Consumer:null},U.Provider=U,U.Consumer={$$typeof:o,_context:U},U},Je.createElement=function(U,ee,j){var ie,Ce={},_e=null;if(ee!=null)for(ie in ee.key!==void 0&&(_e=""+ee.key),ee)$.call(ee,ie)&&ie!=="key"&&ie!=="__self"&&ie!=="__source"&&(Ce[ie]=ee[ie]);var Ee=arguments.length-2;if(Ee===1)Ce.children=j;else if(1<Ee){for(var Ve=Array(Ee),je=0;je<Ee;je++)Ve[je]=arguments[je+2];Ce.children=Ve}if(U&&U.defaultProps)for(ie in Ee=U.defaultProps,Ee)Ce[ie]===void 0&&(Ce[ie]=Ee[ie]);return V(U,_e,Ce)},Je.createRef=function(){return{current:null}},Je.forwardRef=function(U){return{$$typeof:f,render:U}},Je.isValidElement=X,Je.lazy=function(U){return{$$typeof:y,_payload:{_status:-1,_result:U},_init:le}},Je.memo=function(U,ee){return{$$typeof:m,type:U,compare:ee===void 0?null:ee}},Je.startTransition=function(U){var ee=Z.T,j={};Z.T=j;try{var ie=U(),Ce=Z.S;Ce!==null&&Ce(j,ie),typeof ie=="object"&&ie!==null&&typeof ie.then=="function"&&ie.then(D,be)}catch(_e){be(_e)}finally{ee!==null&&j.types!==null&&(ee.types=j.types),Z.T=ee}},Je.unstable_useCacheRefresh=function(){return Z.H.useCacheRefresh()},Je.use=function(U){return Z.H.use(U)},Je.useActionState=function(U,ee,j){return Z.H.useActionState(U,ee,j)},Je.useCallback=function(U,ee){return Z.H.useCallback(U,ee)},Je.useContext=function(U){return Z.H.useContext(U)},Je.useDebugValue=function(){},Je.useDeferredValue=function(U,ee){return Z.H.useDeferredValue(U,ee)},Je.useEffect=function(U,ee){return Z.H.useEffect(U,ee)},Je.useEffectEvent=function(U){return Z.H.useEffectEvent(U)},Je.useId=function(){return Z.H.useId()},Je.useImperativeHandle=function(U,ee,j){return Z.H.useImperativeHandle(U,ee,j)},Je.useInsertionEffect=function(U,ee){return Z.H.useInsertionEffect(U,ee)},Je.useLayoutEffect=function(U,ee){return Z.H.useLayoutEffect(U,ee)},Je.useMemo=function(U,ee){return Z.H.useMemo(U,ee)},Je.useOptimistic=function(U,ee){return Z.H.useOptimistic(U,ee)},Je.useReducer=function(U,ee,j){return Z.H.useReducer(U,ee,j)},Je.useRef=function(U){return Z.H.useRef(U)},Je.useState=function(U){return Z.H.useState(U)},Je.useSyncExternalStore=function(U,ee,j){return Z.H.useSyncExternalStore(U,ee,j)},Je.useTransition=function(){return Z.H.useTransition()},Je.version="19.2.4",Je}var t0;function Nd(){return t0||(t0=1,dh.exports=uS()),dh.exports}var E=Nd(),mh={exports:{}},yl={},ph={exports:{}},gh={};/**
18
18
  * @license React
19
19
  * scheduler.production.js
20
20
  *
@@ -22,7 +22,7 @@ var rS=Object.defineProperty;var iS=(e,t,r)=>t in e?rS(e,t,{enumerable:!0,config
22
22
  *
23
23
  * This source code is licensed under the MIT license found in the
24
24
  * LICENSE file in the root directory of this source tree.
25
- */var t0;function oS(){return t0||(t0=1,(function(e){function t($,q){var ae=$.length;$.push(q);e:for(;0<ae;){var be=ae-1>>>1,M=$[be];if(0<l(M,q))$[be]=q,$[ae]=M,ae=be;else break e}}function r($){return $.length===0?null:$[0]}function s($){if($.length===0)return null;var q=$[0],ae=$.pop();if(ae!==q){$[0]=ae;e:for(var be=0,M=$.length,U=M>>>1;be<U;){var ee=2*(be+1)-1,_=$[ee],ge=ee+1,Ce=$[ge];if(0>l(_,ae))ge<M&&0>l(Ce,_)?($[be]=Ce,$[ge]=ae,be=ge):($[be]=_,$[ee]=ae,be=ee);else if(ge<M&&0>l(Ce,ae))$[be]=Ce,$[ge]=ae,be=ge;else break e}}return q}function l($,q){var ae=$.sortIndex-q.sortIndex;return ae!==0?ae:$.id-q.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 d=[],m=[],y=1,g=null,x=3,v=!1,S=!1,j=!1,D=!1,T=typeof setTimeout=="function"?setTimeout:null,P=typeof clearTimeout=="function"?clearTimeout:null,I=typeof setImmediate<"u"?setImmediate:null;function W($){for(var q=r(m);q!==null;){if(q.callback===null)s(m);else if(q.startTime<=$)s(m),q.sortIndex=q.expirationTime,t(d,q);else break;q=r(m)}}function B($){if(j=!1,W($),!S)if(r(d)!==null)S=!0,R||(R=!0,G());else{var q=r(m);q!==null&&re(B,q.startTime-$)}}var R=!1,Z=-1,F=5,V=-1;function L(){return D?!0:!(e.unstable_now()-V<F)}function X(){if(D=!1,R){var $=e.unstable_now();V=$;var q=!0;try{e:{S=!1,j&&(j=!1,P(Z),Z=-1),v=!0;var ae=x;try{t:{for(W($),g=r(d);g!==null&&!(g.expirationTime>$&&L());){var be=g.callback;if(typeof be=="function"){g.callback=null,x=g.priorityLevel;var M=be(g.expirationTime<=$);if($=e.unstable_now(),typeof M=="function"){g.callback=M,W($),q=!0;break t}g===r(d)&&s(d),W($)}else s(d);g=r(d)}if(g!==null)q=!0;else{var U=r(m);U!==null&&re(B,U.startTime-$),q=!1}}break e}finally{g=null,x=ae,v=!1}q=void 0}}finally{q?G():R=!1}}}var G;if(typeof I=="function")G=function(){I(X)};else if(typeof MessageChannel<"u"){var ue=new MessageChannel,le=ue.port2;ue.port1.onmessage=X,G=function(){le.postMessage(null)}}else G=function(){T(X,0)};function re($,q){Z=T(function(){$(e.unstable_now())},q)}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($){$.callback=null},e.unstable_forceFrameRate=function($){0>$||125<$?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):F=0<$?Math.floor(1e3/$):5},e.unstable_getCurrentPriorityLevel=function(){return x},e.unstable_next=function($){switch(x){case 1:case 2:case 3:var q=3;break;default:q=x}var ae=x;x=q;try{return $()}finally{x=ae}},e.unstable_requestPaint=function(){D=!0},e.unstable_runWithPriority=function($,q){switch($){case 1:case 2:case 3:case 4:case 5:break;default:$=3}var ae=x;x=$;try{return q()}finally{x=ae}},e.unstable_scheduleCallback=function($,q,ae){var be=e.unstable_now();switch(typeof ae=="object"&&ae!==null?(ae=ae.delay,ae=typeof ae=="number"&&0<ae?be+ae:be):ae=be,$){case 1:var M=-1;break;case 2:M=250;break;case 5:M=1073741823;break;case 4:M=1e4;break;default:M=5e3}return M=ae+M,$={id:y++,callback:q,priorityLevel:$,startTime:ae,expirationTime:M,sortIndex:-1},ae>be?($.sortIndex=ae,t(m,$),r(d)===null&&$===r(m)&&(j?(P(Z),Z=-1):j=!0,re(B,ae-be))):($.sortIndex=M,t(d,$),S||v||(S=!0,R||(R=!0,G()))),$},e.unstable_shouldYield=L,e.unstable_wrapCallback=function($){var q=x;return function(){var ae=x;x=q;try{return $.apply(this,arguments)}finally{x=ae}}}})(gh)),gh}var n0;function uS(){return n0||(n0=1,ph.exports=oS()),ph.exports}var yh={exports:{}},Cn={};/**
25
+ */var n0;function cS(){return n0||(n0=1,(function(e){function t(F,q){var le=F.length;F.push(q);e:for(;0<le;){var be=le-1>>>1,O=F[be];if(0<l(O,q))F[be]=q,F[le]=O,le=be;else break e}}function r(F){return F.length===0?null:F[0]}function s(F){if(F.length===0)return null;var q=F[0],le=F.pop();if(le!==q){F[0]=le;e:for(var be=0,O=F.length,U=O>>>1;be<U;){var ee=2*(be+1)-1,j=F[ee],ie=ee+1,Ce=F[ie];if(0>l(j,le))ie<O&&0>l(Ce,j)?(F[be]=Ce,F[ie]=le,be=ie):(F[be]=j,F[ee]=le,be=ee);else if(ie<O&&0>l(Ce,le))F[be]=Ce,F[ie]=le,be=ie;else break e}}return q}function l(F,q){var le=F.sortIndex-q.sortIndex;return le!==0?le:F.id-q.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var o=performance;e.unstable_now=function(){return o.now()}}else{var c=Date,f=c.now();e.unstable_now=function(){return c.now()-f}}var d=[],m=[],y=1,g=null,x=3,v=!1,S=!1,A=!1,M=!1,T=typeof setTimeout=="function"?setTimeout:null,P=typeof clearTimeout=="function"?clearTimeout:null,I=typeof setImmediate<"u"?setImmediate:null;function W(F){for(var q=r(m);q!==null;){if(q.callback===null)s(m);else if(q.startTime<=F)s(m),q.sortIndex=q.expirationTime,t(d,q);else break;q=r(m)}}function B(F){if(A=!1,W(F),!S)if(r(d)!==null)S=!0,D||(D=!0,G());else{var q=r(m);q!==null&&re(B,q.startTime-F)}}var D=!1,Z=-1,$=5,V=-1;function L(){return M?!0:!(e.unstable_now()-V<$)}function X(){if(M=!1,D){var F=e.unstable_now();V=F;var q=!0;try{e:{S=!1,A&&(A=!1,P(Z),Z=-1),v=!0;var le=x;try{t:{for(W(F),g=r(d);g!==null&&!(g.expirationTime>F&&L());){var be=g.callback;if(typeof be=="function"){g.callback=null,x=g.priorityLevel;var O=be(g.expirationTime<=F);if(F=e.unstable_now(),typeof O=="function"){g.callback=O,W(F),q=!0;break t}g===r(d)&&s(d),W(F)}else s(d);g=r(d)}if(g!==null)q=!0;else{var U=r(m);U!==null&&re(B,U.startTime-F),q=!1}}break e}finally{g=null,x=le,v=!1}q=void 0}}finally{q?G():D=!1}}}var G;if(typeof I=="function")G=function(){I(X)};else if(typeof MessageChannel<"u"){var ce=new MessageChannel,oe=ce.port2;ce.port1.onmessage=X,G=function(){oe.postMessage(null)}}else G=function(){T(X,0)};function re(F,q){Z=T(function(){F(e.unstable_now())},q)}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(F){F.callback=null},e.unstable_forceFrameRate=function(F){0>F||125<F?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):$=0<F?Math.floor(1e3/F):5},e.unstable_getCurrentPriorityLevel=function(){return x},e.unstable_next=function(F){switch(x){case 1:case 2:case 3:var q=3;break;default:q=x}var le=x;x=q;try{return F()}finally{x=le}},e.unstable_requestPaint=function(){M=!0},e.unstable_runWithPriority=function(F,q){switch(F){case 1:case 2:case 3:case 4:case 5:break;default:F=3}var le=x;x=F;try{return q()}finally{x=le}},e.unstable_scheduleCallback=function(F,q,le){var be=e.unstable_now();switch(typeof le=="object"&&le!==null?(le=le.delay,le=typeof le=="number"&&0<le?be+le:be):le=be,F){case 1:var O=-1;break;case 2:O=250;break;case 5:O=1073741823;break;case 4:O=1e4;break;default:O=5e3}return O=le+O,F={id:y++,callback:q,priorityLevel:F,startTime:le,expirationTime:O,sortIndex:-1},le>be?(F.sortIndex=le,t(m,F),r(d)===null&&F===r(m)&&(A?(P(Z),Z=-1):A=!0,re(B,le-be))):(F.sortIndex=O,t(d,F),S||v||(S=!0,D||(D=!0,G()))),F},e.unstable_shouldYield=L,e.unstable_wrapCallback=function(F){var q=x;return function(){var le=x;x=q;try{return F.apply(this,arguments)}finally{x=le}}}})(gh)),gh}var r0;function fS(){return r0||(r0=1,ph.exports=cS()),ph.exports}var yh={exports:{}},Cn={};/**
26
26
  * @license React
27
27
  * react-dom.production.js
28
28
  *
@@ -30,7 +30,7 @@ var rS=Object.defineProperty;var iS=(e,t,r)=>t in e?rS(e,t,{enumerable:!0,config
30
30
  *
31
31
  * This source code is licensed under the MIT license found in the
32
32
  * LICENSE file in the root directory of this source tree.
33
- */var r0;function cS(){if(r0)return Cn;r0=1;var e=Nd();function t(d){var m="https://react.dev/errors/"+d;if(1<arguments.length){m+="?args[]="+encodeURIComponent(arguments[1]);for(var y=2;y<arguments.length;y++)m+="&args[]="+encodeURIComponent(arguments[y])}return"Minified React error #"+d+"; visit "+m+" 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(d,m,y){var g=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:l,key:g==null?null:""+g,children:d,containerInfo:m,implementation:y}}var c=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function f(d,m){if(d==="font")return"";if(typeof m=="string")return m==="use-credentials"?m:""}return Cn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=s,Cn.createPortal=function(d,m){var y=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!m||m.nodeType!==1&&m.nodeType!==9&&m.nodeType!==11)throw Error(t(299));return u(d,m,null,y)},Cn.flushSync=function(d){var m=c.T,y=s.p;try{if(c.T=null,s.p=2,d)return d()}finally{c.T=m,s.p=y,s.d.f()}},Cn.preconnect=function(d,m){typeof d=="string"&&(m?(m=m.crossOrigin,m=typeof m=="string"?m==="use-credentials"?m:"":void 0):m=null,s.d.C(d,m))},Cn.prefetchDNS=function(d){typeof d=="string"&&s.d.D(d)},Cn.preinit=function(d,m){if(typeof d=="string"&&m&&typeof m.as=="string"){var y=m.as,g=f(y,m.crossOrigin),x=typeof m.integrity=="string"?m.integrity:void 0,v=typeof m.fetchPriority=="string"?m.fetchPriority:void 0;y==="style"?s.d.S(d,typeof m.precedence=="string"?m.precedence:void 0,{crossOrigin:g,integrity:x,fetchPriority:v}):y==="script"&&s.d.X(d,{crossOrigin:g,integrity:x,fetchPriority:v,nonce:typeof m.nonce=="string"?m.nonce:void 0})}},Cn.preinitModule=function(d,m){if(typeof d=="string")if(typeof m=="object"&&m!==null){if(m.as==null||m.as==="script"){var y=f(m.as,m.crossOrigin);s.d.M(d,{crossOrigin:y,integrity:typeof m.integrity=="string"?m.integrity:void 0,nonce:typeof m.nonce=="string"?m.nonce:void 0})}}else m==null&&s.d.M(d)},Cn.preload=function(d,m){if(typeof d=="string"&&typeof m=="object"&&m!==null&&typeof m.as=="string"){var y=m.as,g=f(y,m.crossOrigin);s.d.L(d,y,{crossOrigin:g,integrity:typeof m.integrity=="string"?m.integrity:void 0,nonce:typeof m.nonce=="string"?m.nonce:void 0,type:typeof m.type=="string"?m.type:void 0,fetchPriority:typeof m.fetchPriority=="string"?m.fetchPriority:void 0,referrerPolicy:typeof m.referrerPolicy=="string"?m.referrerPolicy:void 0,imageSrcSet:typeof m.imageSrcSet=="string"?m.imageSrcSet:void 0,imageSizes:typeof m.imageSizes=="string"?m.imageSizes:void 0,media:typeof m.media=="string"?m.media:void 0})}},Cn.preloadModule=function(d,m){if(typeof d=="string")if(m){var y=f(m.as,m.crossOrigin);s.d.m(d,{as:typeof m.as=="string"&&m.as!=="script"?m.as:void 0,crossOrigin:y,integrity:typeof m.integrity=="string"?m.integrity:void 0})}else s.d.m(d)},Cn.requestFormReset=function(d){s.d.r(d)},Cn.unstable_batchedUpdates=function(d,m){return d(m)},Cn.useFormState=function(d,m,y){return c.H.useFormState(d,m,y)},Cn.useFormStatus=function(){return c.H.useHostTransitionStatus()},Cn.version="19.2.4",Cn}var i0;function Jb(){if(i0)return yh.exports;i0=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(),yh.exports=cS(),yh.exports}/**
33
+ */var i0;function hS(){if(i0)return Cn;i0=1;var e=Nd();function t(d){var m="https://react.dev/errors/"+d;if(1<arguments.length){m+="?args[]="+encodeURIComponent(arguments[1]);for(var y=2;y<arguments.length;y++)m+="&args[]="+encodeURIComponent(arguments[y])}return"Minified React error #"+d+"; visit "+m+" 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 o(d,m,y){var g=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:l,key:g==null?null:""+g,children:d,containerInfo:m,implementation:y}}var c=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function f(d,m){if(d==="font")return"";if(typeof m=="string")return m==="use-credentials"?m:""}return Cn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=s,Cn.createPortal=function(d,m){var y=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!m||m.nodeType!==1&&m.nodeType!==9&&m.nodeType!==11)throw Error(t(299));return o(d,m,null,y)},Cn.flushSync=function(d){var m=c.T,y=s.p;try{if(c.T=null,s.p=2,d)return d()}finally{c.T=m,s.p=y,s.d.f()}},Cn.preconnect=function(d,m){typeof d=="string"&&(m?(m=m.crossOrigin,m=typeof m=="string"?m==="use-credentials"?m:"":void 0):m=null,s.d.C(d,m))},Cn.prefetchDNS=function(d){typeof d=="string"&&s.d.D(d)},Cn.preinit=function(d,m){if(typeof d=="string"&&m&&typeof m.as=="string"){var y=m.as,g=f(y,m.crossOrigin),x=typeof m.integrity=="string"?m.integrity:void 0,v=typeof m.fetchPriority=="string"?m.fetchPriority:void 0;y==="style"?s.d.S(d,typeof m.precedence=="string"?m.precedence:void 0,{crossOrigin:g,integrity:x,fetchPriority:v}):y==="script"&&s.d.X(d,{crossOrigin:g,integrity:x,fetchPriority:v,nonce:typeof m.nonce=="string"?m.nonce:void 0})}},Cn.preinitModule=function(d,m){if(typeof d=="string")if(typeof m=="object"&&m!==null){if(m.as==null||m.as==="script"){var y=f(m.as,m.crossOrigin);s.d.M(d,{crossOrigin:y,integrity:typeof m.integrity=="string"?m.integrity:void 0,nonce:typeof m.nonce=="string"?m.nonce:void 0})}}else m==null&&s.d.M(d)},Cn.preload=function(d,m){if(typeof d=="string"&&typeof m=="object"&&m!==null&&typeof m.as=="string"){var y=m.as,g=f(y,m.crossOrigin);s.d.L(d,y,{crossOrigin:g,integrity:typeof m.integrity=="string"?m.integrity:void 0,nonce:typeof m.nonce=="string"?m.nonce:void 0,type:typeof m.type=="string"?m.type:void 0,fetchPriority:typeof m.fetchPriority=="string"?m.fetchPriority:void 0,referrerPolicy:typeof m.referrerPolicy=="string"?m.referrerPolicy:void 0,imageSrcSet:typeof m.imageSrcSet=="string"?m.imageSrcSet:void 0,imageSizes:typeof m.imageSizes=="string"?m.imageSizes:void 0,media:typeof m.media=="string"?m.media:void 0})}},Cn.preloadModule=function(d,m){if(typeof d=="string")if(m){var y=f(m.as,m.crossOrigin);s.d.m(d,{as:typeof m.as=="string"&&m.as!=="script"?m.as:void 0,crossOrigin:y,integrity:typeof m.integrity=="string"?m.integrity:void 0})}else s.d.m(d)},Cn.requestFormReset=function(d){s.d.r(d)},Cn.unstable_batchedUpdates=function(d,m){return d(m)},Cn.useFormState=function(d,m,y){return c.H.useFormState(d,m,y)},Cn.useFormStatus=function(){return c.H.useHostTransitionStatus()},Cn.version="19.2.4",Cn}var s0;function Yb(){if(s0)return yh.exports;s0=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(),yh.exports=hS(),yh.exports}/**
34
34
  * @license React
35
35
  * react-dom-client.production.js
36
36
  *
@@ -38,15 +38,15 @@ var rS=Object.defineProperty;var iS=(e,t,r)=>t in e?rS(e,t,{enumerable:!0,config
38
38
  *
39
39
  * This source code is licensed under the MIT license found in the
40
40
  * LICENSE file in the root directory of this source tree.
41
- */var s0;function fS(){if(s0)return yl;s0=1;var e=uS(),t=Nd(),r=Jb();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 d(n){if(u(n)!==n)throw Error(s(188))}function m(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 d(h),n;if(p===o)return d(h),i;p=p.sibling}throw Error(s(188))}if(a.return!==o.return)a=h,o=p;else{for(var w=!1,k=h.child;k;){if(k===a){w=!0,a=h,o=p;break}if(k===o){w=!0,o=h,a=p;break}k=k.sibling}if(!w){for(k=p.child;k;){if(k===a){w=!0,a=p,o=h;break}if(k===o){w=!0,o=p,a=h;break}k=k.sibling}if(!w)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"),v=Symbol.for("react.transitional.element"),S=Symbol.for("react.portal"),j=Symbol.for("react.fragment"),D=Symbol.for("react.strict_mode"),T=Symbol.for("react.profiler"),P=Symbol.for("react.consumer"),I=Symbol.for("react.context"),W=Symbol.for("react.forward_ref"),B=Symbol.for("react.suspense"),R=Symbol.for("react.suspense_list"),Z=Symbol.for("react.memo"),F=Symbol.for("react.lazy"),V=Symbol.for("react.activity"),L=Symbol.for("react.memo_cache_sentinel"),X=Symbol.iterator;function G(n){return n===null||typeof n!="object"?null:(n=X&&n[X]||n["@@iterator"],typeof n=="function"?n:null)}var ue=Symbol.for("react.client.reference");function le(n){if(n==null)return null;if(typeof n=="function")return n.$$typeof===ue?null:n.displayName||n.name||null;if(typeof n=="string")return n;switch(n){case j:return"Fragment";case T:return"Profiler";case D:return"StrictMode";case B:return"Suspense";case R:return"SuspenseList";case V:return"Activity"}if(typeof n=="object")switch(n.$$typeof){case S:return"Portal";case I:return n.displayName||"Context";case P:return(n._context.displayName||"Context")+".Consumer";case W:var i=n.render;return n=n.displayName,n||(n=i.displayName||i.name||"",n=n!==""?"ForwardRef("+n+")":"ForwardRef"),n;case Z:return i=n.displayName||null,i!==null?i:le(n.type)||"Memo";case F:i=n._payload,n=n._init;try{return le(n(i))}catch{}}return null}var re=Array.isArray,$=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,q=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ae={pending:!1,data:null,method:null,action:null},be=[],M=-1;function U(n){return{current:n}}function ee(n){0>M||(n.current=be[M],be[M]=null,M--)}function _(n,i){M++,be[M]=n.current,n.current=i}var ge=U(null),Ce=U(null),we=U(null),Te=U(null);function Ve(n,i){switch(_(we,i),_(Ce,n),_(ge,null),i.nodeType){case 9:case 11:n=(n=i.documentElement)&&(n=n.namespaceURI)?vy(n):0;break;default:if(n=i.tagName,i=i.namespaceURI)i=vy(i),n=wy(i,n);else switch(n){case"svg":n=1;break;case"math":n=2;break;default:n=0}}ee(ge),_(ge,n)}function Ae(){ee(ge),ee(Ce),ee(we)}function dt(n){n.memoizedState!==null&&_(Te,n);var i=ge.current,a=wy(i,n.type);i!==a&&(_(Ce,n),_(ge,a))}function qt(n){Ce.current===n&&(ee(ge),ee(Ce)),Te.current===n&&(ee(Te),hl._currentValue=ae)}var ln,tn;function Gt(n){if(ln===void 0)try{throw Error()}catch(a){var i=a.stack.trim().match(/\n( *(at )?)/);ln=i&&i[1]||"",tn=-1<a.stack.indexOf(`
41
+ */var a0;function dS(){if(a0)return yl;a0=1;var e=fS(),t=Nd(),r=Yb();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 o(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 d(n){if(o(n)!==n)throw Error(s(188))}function m(n){var i=n.alternate;if(!i){if(i=o(n),i===null)throw Error(s(188));return i!==n?null:n}for(var a=n,u=i;;){var h=a.return;if(h===null)break;var p=h.alternate;if(p===null){if(u=h.return,u!==null){a=u;continue}break}if(h.child===p.child){for(p=h.child;p;){if(p===a)return d(h),n;if(p===u)return d(h),i;p=p.sibling}throw Error(s(188))}if(a.return!==u.return)a=h,u=p;else{for(var w=!1,_=h.child;_;){if(_===a){w=!0,a=h,u=p;break}if(_===u){w=!0,u=h,a=p;break}_=_.sibling}if(!w){for(_=p.child;_;){if(_===a){w=!0,a=p,u=h;break}if(_===u){w=!0,u=p,a=h;break}_=_.sibling}if(!w)throw Error(s(189))}}if(a.alternate!==u)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"),v=Symbol.for("react.transitional.element"),S=Symbol.for("react.portal"),A=Symbol.for("react.fragment"),M=Symbol.for("react.strict_mode"),T=Symbol.for("react.profiler"),P=Symbol.for("react.consumer"),I=Symbol.for("react.context"),W=Symbol.for("react.forward_ref"),B=Symbol.for("react.suspense"),D=Symbol.for("react.suspense_list"),Z=Symbol.for("react.memo"),$=Symbol.for("react.lazy"),V=Symbol.for("react.activity"),L=Symbol.for("react.memo_cache_sentinel"),X=Symbol.iterator;function G(n){return n===null||typeof n!="object"?null:(n=X&&n[X]||n["@@iterator"],typeof n=="function"?n:null)}var ce=Symbol.for("react.client.reference");function oe(n){if(n==null)return null;if(typeof n=="function")return n.$$typeof===ce?null:n.displayName||n.name||null;if(typeof n=="string")return n;switch(n){case A:return"Fragment";case T:return"Profiler";case M:return"StrictMode";case B:return"Suspense";case D:return"SuspenseList";case V:return"Activity"}if(typeof n=="object")switch(n.$$typeof){case S:return"Portal";case I:return n.displayName||"Context";case P:return(n._context.displayName||"Context")+".Consumer";case W:var i=n.render;return n=n.displayName,n||(n=i.displayName||i.name||"",n=n!==""?"ForwardRef("+n+")":"ForwardRef"),n;case Z:return i=n.displayName||null,i!==null?i:oe(n.type)||"Memo";case $:i=n._payload,n=n._init;try{return oe(n(i))}catch{}}return null}var re=Array.isArray,F=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,q=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,le={pending:!1,data:null,method:null,action:null},be=[],O=-1;function U(n){return{current:n}}function ee(n){0>O||(n.current=be[O],be[O]=null,O--)}function j(n,i){O++,be[O]=n.current,n.current=i}var ie=U(null),Ce=U(null),_e=U(null),Ee=U(null);function Ve(n,i){switch(j(_e,i),j(Ce,n),j(ie,null),i.nodeType){case 9:case 11:n=(n=i.documentElement)&&(n=n.namespaceURI)?wy(n):0;break;default:if(n=i.tagName,i=i.namespaceURI)i=wy(i),n=Sy(i,n);else switch(n){case"svg":n=1;break;case"math":n=2;break;default:n=0}}ee(ie),j(ie,n)}function je(){ee(ie),ee(Ce),ee(_e)}function dt(n){n.memoizedState!==null&&j(Ee,n);var i=ie.current,a=Sy(i,n.type);i!==a&&(j(Ce,n),j(ie,a))}function qt(n){Ce.current===n&&(ee(ie),ee(Ce)),Ee.current===n&&(ee(Ee),hl._currentValue=le)}var ln,tn;function Gt(n){if(ln===void 0)try{throw Error()}catch(a){var i=a.stack.trim().match(/\n( *(at )?)/);ln=i&&i[1]||"",tn=-1<a.stack.indexOf(`
42
42
  at`)?" (<anonymous>)":-1<a.stack.indexOf("@")?"@unknown:0:0":""}return`
43
- `+ln+n+tn}var on=!1;function Rt(n,i){if(!n||on)return"";on=!0;var a=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var o={DetermineComponentFrameRoot:function(){try{if(i){var pe=function(){throw Error()};if(Object.defineProperty(pe.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(pe,[])}catch(oe){var ie=oe}Reflect.construct(n,[],pe)}else{try{pe.call()}catch(oe){ie=oe}n.call(pe.prototype)}}else{try{throw Error()}catch(oe){ie=oe}(pe=n())&&typeof pe.catch=="function"&&pe.catch(function(){})}}catch(oe){if(oe&&ie&&typeof oe.stack=="string")return[oe.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(),w=p[0],k=p[1];if(w&&k){var H=w.split(`
44
- `),ne=k.split(`
45
- `);for(h=o=0;o<H.length&&!H[o].includes("DetermineComponentFrameRoot");)o++;for(;h<ne.length&&!ne[h].includes("DetermineComponentFrameRoot");)h++;if(o===H.length||h===ne.length)for(o=H.length-1,h=ne.length-1;1<=o&&0<=h&&H[o]!==ne[h];)h--;for(;1<=o&&0<=h;o--,h--)if(H[o]!==ne[h]){if(o!==1||h!==1)do if(o--,h--,0>h||H[o]!==ne[h]){var fe=`
46
- `+H[o].replace(" at new "," at ");return n.displayName&&fe.includes("<anonymous>")&&(fe=fe.replace("<anonymous>",n.displayName)),fe}while(1<=o&&0<=h);break}}}finally{on=!1,Error.prepareStackTrace=a}return(a=n?n.displayName||n.name:"")?Gt(a):""}function Kt(n,i){switch(n.tag){case 26:case 27:case 5:return Gt(n.type);case 16:return Gt("Lazy");case 13:return n.child!==i&&i!==null?Gt("Suspense Fallback"):Gt("Suspense");case 19:return Gt("SuspenseList");case 0:case 15:return Rt(n.type,!1);case 11:return Rt(n.type.render,!1);case 1:return Rt(n.type,!0);case 31:return Gt("Activity");default:return""}}function Pe(n){try{var i="",a=null;do i+=Kt(n,a),a=n,n=n.return;while(n);return i}catch(o){return`
47
- Error generating stack: `+o.message+`
48
- `+o.stack}}var ct=Object.prototype.hasOwnProperty,Ke=e.unstable_scheduleCallback,bt=e.unstable_cancelCallback,zt=e.unstable_shouldYield,Pn=e.unstable_requestPaint,$e=e.unstable_now,Tn=e.unstable_getCurrentPriorityLevel,ce=e.unstable_ImmediatePriority,_e=e.unstable_UserBlockingPriority,Le=e.unstable_NormalPriority,Ge=e.unstable_LowPriority,et=e.unstable_IdlePriority,un=e.log,vn=e.unstable_setDisableYieldValue,Ct=null,xt=null;function Jt(n){if(typeof un=="function"&&vn(n),xt&&typeof xt.setStrictMode=="function")try{xt.setStrictMode(Ct,n)}catch{}}var nt=Math.clz32?Math.clz32:Oe,ve=Math.log,Be=Math.LN2;function Oe(n){return n>>>=0,n===0?32:31-(ve(n)/Be|0)|0}var _t=256,Qt=262144,On=4194304;function Jn(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 xe(n,i,a){var o=n.pendingLanes;if(o===0)return 0;var h=0,p=n.suspendedLanes,w=n.pingedLanes;n=n.warmLanes;var k=o&134217727;return k!==0?(o=k&~p,o!==0?h=Jn(o):(w&=k,w!==0?h=Jn(w):a||(a=k&~n,a!==0&&(h=Jn(a))))):(k=o&~p,k!==0?h=Jn(k):w!==0?h=Jn(w):a||(a=o&~n,a!==0&&(h=Jn(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 Ee(n,i){return(n.pendingLanes&~(n.suspendedLanes&~n.pingedLanes)&i)===0}function Ye(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 We(){var n=On;return On<<=1,(On&62914560)===0&&(On=4194304),n}function Fe(n){for(var i=[],a=0;31>a;a++)i.push(n);return i}function ft(n,i){n.pendingLanes|=i,i!==268435456&&(n.suspendedLanes=0,n.pingedLanes=0,n.warmLanes=0)}function rt(n,i,a,o,h,p){var w=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 k=n.entanglements,H=n.expirationTimes,ne=n.hiddenUpdates;for(a=w&~a;0<a;){var fe=31-nt(a),pe=1<<fe;k[fe]=0,H[fe]=-1;var ie=ne[fe];if(ie!==null)for(ne[fe]=null,fe=0;fe<ie.length;fe++){var oe=ie[fe];oe!==null&&(oe.lane&=-536870913)}a&=~pe}o!==0&&Ie(n,o,0),p!==0&&h===0&&n.tag!==0&&(n.suspendedLanes|=p&~(w&~i))}function Ie(n,i,a){n.pendingLanes|=i,n.suspendedLanes&=~i;var o=31-nt(i);n.entangledLanes|=i,n.entanglements[o]=n.entanglements[o]|1073741824|a&261930}function mt(n,i){var a=n.entangledLanes|=i;for(n=n.entanglements;a;){var o=31-nt(a),h=1<<o;h&i|n[o]&i&&(n[o]|=i),a&=~h}}function Xt(n,i){var a=i&-i;return a=(a&42)!==0?1:It(a),(a&(n.suspendedLanes|i))!==0?0:a}function It(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 nn(n){return n&=-n,2<n?8<n?(n&134217727)!==0?32:268435456:8:2}function Bn(){var n=q.p;return n!==0?n:(n=window.event,n===void 0?32:$y(n.type))}function Zi(n,i){var a=q.p;try{return q.p=n,i()}finally{q.p=a}}var Mt=Math.random().toString(36).slice(2),wt="__reactFiber$"+Mt,Zt="__reactProps$"+Mt,Xn="__reactContainer$"+Mt,Wi="__reactEvents$"+Mt,ja="__reactListeners$"+Mt,Ql="__reactHandles$"+Mt,Zl="__reactResources$"+Mt,pn="__reactMarker$"+Mt;function _s(n){delete n[wt],delete n[Zt],delete n[Wi],delete n[ja],delete n[Ql]}function E(n){var i=n[wt];if(i)return i;for(var a=n.parentNode;a;){if(i=a[Xn]||a[wt]){if(a=i.alternate,i.child!==null||a!==null&&a.child!==null)for(n=jy(n);n!==null;){if(a=n[wt])return a;n=jy(n)}return i}n=a,a=n.parentNode}return null}function O(n){if(n=n[wt]||n[Xn]){var i=n.tag;if(i===5||i===6||i===13||i===31||i===26||i===27||i===3)return n}return null}function N(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[Zl];return i||(i=n[Zl]={hoistableStyles:new Map,hoistableScripts:new Map}),i}function Y(n){n[pn]=!0}var Q=new Set,me={};function ye(n,i){se(n,i),se(n+"Capture",i)}function se(n,i){for(me[n]=i,n=0;n<i.length;n++)Q.add(i[n])}var de=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),Me={},tt={};function Pt(n){return ct.call(tt,n)?!0:ct.call(Me,n)?!1:de.test(n)?tt[n]=!0:(Me[n]=!0,!1)}function En(n,i,a){if(Pt(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 Cr(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 Gr(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 hr(n){switch(typeof n){case"bigint":case"boolean":case"number":case"string":case"undefined":return n;case"object":return n;default:return""}}function hm(n){var i=n.type;return(n=n.nodeName)&&n.toLowerCase()==="input"&&(i==="checkbox"||i==="radio")}function K1(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(w){a=""+w,p.call(this,w)}}),Object.defineProperty(n,i,{enumerable:o.enumerable}),{getValue:function(){return a},setValue:function(w){a=""+w},stopTracking:function(){n._valueTracker=null,delete n[i]}}}}function ic(n){if(!n._valueTracker){var i=hm(n)?"checked":"value";n._valueTracker=K1(n,i,""+n[i])}}function dm(n){if(!n)return!1;var i=n._valueTracker;if(!i)return!0;var a=i.getValue(),o="";return n&&(o=hm(n)?n.checked?"true":"false":n.value),n=o,n!==a?(i.setValue(n),!0):!1}function Wl(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 Q1=/[\n"\\]/g;function dr(n){return n.replace(Q1,function(i){return"\\"+i.charCodeAt(0).toString(16)+" "})}function sc(n,i,a,o,h,p,w,k){n.name="",w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"?n.type=w:n.removeAttribute("type"),i!=null?w==="number"?(i===0&&n.value===""||n.value!=i)&&(n.value=""+hr(i)):n.value!==""+hr(i)&&(n.value=""+hr(i)):w!=="submit"&&w!=="reset"||n.removeAttribute("value"),i!=null?ac(n,w,hr(i)):a!=null?ac(n,w,hr(a)):o!=null&&n.removeAttribute("value"),h==null&&p!=null&&(n.defaultChecked=!!p),h!=null&&(n.checked=h&&typeof h!="function"&&typeof h!="symbol"),k!=null&&typeof k!="function"&&typeof k!="symbol"&&typeof k!="boolean"?n.name=""+hr(k):n.removeAttribute("name")}function mm(n,i,a,o,h,p,w,k){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)){ic(n);return}a=a!=null?""+hr(a):"",i=i!=null?""+hr(i):a,k||i===n.value||(n.value=i),n.defaultValue=i}o=o??h,o=typeof o!="function"&&typeof o!="symbol"&&!!o,n.checked=k?n.checked:!!o,n.defaultChecked=!!o,w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"&&(n.name=w),ic(n)}function ac(n,i,a){i==="number"&&Wl(n.ownerDocument)===n||n.defaultValue===""+a||(n.defaultValue=""+a)}function ks(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=""+hr(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 pm(n,i,a){if(i!=null&&(i=""+hr(i),i!==n.value&&(n.value=i),a==null)){n.defaultValue!==i&&(n.defaultValue=i);return}n.defaultValue=a!=null?""+hr(a):""}function gm(n,i,a,o){if(i==null){if(o!=null){if(a!=null)throw Error(s(92));if(re(o)){if(1<o.length)throw Error(s(93));o=o[0]}a=o}a==null&&(a=""),i=a}a=hr(i),n.defaultValue=a,o=n.textContent,o===a&&o!==""&&o!==null&&(n.value=o),ic(n)}function Es(n,i){if(i){var a=n.firstChild;if(a&&a===n.lastChild&&a.nodeType===3){a.nodeValue=i;return}}n.textContent=i}var Z1=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 ym(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||Z1.has(i)?i==="float"?n.cssFloat=a:n[i]=(""+a).trim():n[i]=a+"px"}function bm(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&&ym(n,h,o)}else for(var p in i)i.hasOwnProperty(p)&&ym(n,p,i[p])}function lc(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 W1=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"]]),ev=/^[\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 eo(n){return ev.test(""+n)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":n}function Jr(){}var oc=null;function uc(n){return n=n.target||n.srcElement||window,n.correspondingUseElement&&(n=n.correspondingUseElement),n.nodeType===3?n.parentNode:n}var Cs=null,As=null;function xm(n){var i=O(n);if(i&&(n=i.stateNode)){var a=n[Zt]||null;e:switch(n=i.stateNode,i.type){case"input":if(sc(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="'+dr(""+i)+'"][type="radio"]'),i=0;i<a.length;i++){var o=a[i];if(o!==n&&o.form===n.form){var h=o[Zt]||null;if(!h)throw Error(s(90));sc(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&&dm(o)}break e;case"textarea":pm(n,a.value,a.defaultValue);break e;case"select":i=a.value,i!=null&&ks(n,!!a.multiple,i,!1)}}}var cc=!1;function vm(n,i,a){if(cc)return n(i,a);cc=!0;try{var o=n(i);return o}finally{if(cc=!1,(Cs!==null||As!==null)&&(Io(),Cs&&(i=Cs,n=As,As=Cs=null,xm(i),n)))for(i=0;i<n.length;i++)xm(n[i])}}function Na(n,i){var a=n.stateNode;if(a===null)return null;var o=a[Zt]||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 Xr=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),fc=!1;if(Xr)try{var Ta={};Object.defineProperty(Ta,"passive",{get:function(){fc=!0}}),window.addEventListener("test",Ta,Ta),window.removeEventListener("test",Ta,Ta)}catch{fc=!1}var xi=null,hc=null,to=null;function wm(){if(to)return to;var n,i=hc,a=i.length,o,h="value"in xi?xi.value:xi.textContent,p=h.length;for(n=0;n<a&&i[n]===h[n];n++);var w=a-n;for(o=1;o<=w&&i[a-o]===h[p-o];o++);return to=h.slice(n,1<o?1-o:void 0)}function no(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 ro(){return!0}function Sm(){return!1}function Hn(n){function i(a,o,h,p,w){this._reactName=a,this._targetInst=h,this.type=o,this.nativeEvent=p,this.target=w,this.currentTarget=null;for(var k in n)n.hasOwnProperty(k)&&(a=n[k],this[k]=a?a(p):p[k]);return this.isDefaultPrevented=(p.defaultPrevented!=null?p.defaultPrevented:p.returnValue===!1)?ro:Sm,this.isPropagationStopped=Sm,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=ro)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=ro)},persist:function(){},isPersistent:ro}),i}var es={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(n){return n.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},io=Hn(es),Oa=g({},es,{view:0,detail:0}),tv=Hn(Oa),dc,mc,Ra,so=g({},Oa,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:gc,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!==Ra&&(Ra&&n.type==="mousemove"?(dc=n.screenX-Ra.screenX,mc=n.screenY-Ra.screenY):mc=dc=0,Ra=n),dc)},movementY:function(n){return"movementY"in n?n.movementY:mc}}),_m=Hn(so),nv=g({},so,{dataTransfer:0}),rv=Hn(nv),iv=g({},Oa,{relatedTarget:0}),pc=Hn(iv),sv=g({},es,{animationName:0,elapsedTime:0,pseudoElement:0}),av=Hn(sv),lv=g({},es,{clipboardData:function(n){return"clipboardData"in n?n.clipboardData:window.clipboardData}}),ov=Hn(lv),uv=g({},es,{data:0}),km=Hn(uv),cv={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},fv={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"},hv={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function dv(n){var i=this.nativeEvent;return i.getModifierState?i.getModifierState(n):(n=hv[n])?!!i[n]:!1}function gc(){return dv}var mv=g({},Oa,{key:function(n){if(n.key){var i=cv[n.key]||n.key;if(i!=="Unidentified")return i}return n.type==="keypress"?(n=no(n),n===13?"Enter":String.fromCharCode(n)):n.type==="keydown"||n.type==="keyup"?fv[n.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:gc,charCode:function(n){return n.type==="keypress"?no(n):0},keyCode:function(n){return n.type==="keydown"||n.type==="keyup"?n.keyCode:0},which:function(n){return n.type==="keypress"?no(n):n.type==="keydown"||n.type==="keyup"?n.keyCode:0}}),pv=Hn(mv),gv=g({},so,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Em=Hn(gv),yv=g({},Oa,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:gc}),bv=Hn(yv),xv=g({},es,{propertyName:0,elapsedTime:0,pseudoElement:0}),vv=Hn(xv),wv=g({},so,{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}),Sv=Hn(wv),_v=g({},es,{newState:0,oldState:0}),kv=Hn(_v),Ev=[9,13,27,32],yc=Xr&&"CompositionEvent"in window,Ma=null;Xr&&"documentMode"in document&&(Ma=document.documentMode);var Cv=Xr&&"TextEvent"in window&&!Ma,Cm=Xr&&(!yc||Ma&&8<Ma&&11>=Ma),Am=" ",jm=!1;function Nm(n,i){switch(n){case"keyup":return Ev.indexOf(i.keyCode)!==-1;case"keydown":return i.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Tm(n){return n=n.detail,typeof n=="object"&&"data"in n?n.data:null}var js=!1;function Av(n,i){switch(n){case"compositionend":return Tm(i);case"keypress":return i.which!==32?null:(jm=!0,Am);case"textInput":return n=i.data,n===Am&&jm?null:n;default:return null}}function jv(n,i){if(js)return n==="compositionend"||!yc&&Nm(n,i)?(n=wm(),to=hc=xi=null,js=!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 Cm&&i.locale!=="ko"?null:i.data;default:return null}}var Nv={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 Om(n){var i=n&&n.nodeName&&n.nodeName.toLowerCase();return i==="input"?!!Nv[n.type]:i==="textarea"}function Rm(n,i,a,o){Cs?As?As.push(o):As=[o]:Cs=o,i=Xo(i,"onChange"),0<i.length&&(a=new io("onChange","change",null,a,o),n.push({event:a,listeners:i}))}var Da=null,La=null;function Tv(n){my(n,0)}function ao(n){var i=N(n);if(dm(i))return n}function Mm(n,i){if(n==="change")return i}var Dm=!1;if(Xr){var bc;if(Xr){var xc="oninput"in document;if(!xc){var Lm=document.createElement("div");Lm.setAttribute("oninput","return;"),xc=typeof Lm.oninput=="function"}bc=xc}else bc=!1;Dm=bc&&(!document.documentMode||9<document.documentMode)}function zm(){Da&&(Da.detachEvent("onpropertychange",Um),La=Da=null)}function Um(n){if(n.propertyName==="value"&&ao(La)){var i=[];Rm(i,La,n,uc(n)),vm(Tv,i)}}function Ov(n,i,a){n==="focusin"?(zm(),Da=i,La=a,Da.attachEvent("onpropertychange",Um)):n==="focusout"&&zm()}function Rv(n){if(n==="selectionchange"||n==="keyup"||n==="keydown")return ao(La)}function Mv(n,i){if(n==="click")return ao(i)}function Dv(n,i){if(n==="input"||n==="change")return ao(i)}function Lv(n,i){return n===i&&(n!==0||1/n===1/i)||n!==n&&i!==i}var Kn=typeof Object.is=="function"?Object.is:Lv;function za(n,i){if(Kn(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(!ct.call(i,h)||!Kn(n[h],i[h]))return!1}return!0}function Pm(n){for(;n&&n.firstChild;)n=n.firstChild;return n}function Bm(n,i){var a=Pm(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=Pm(a)}}function Hm(n,i){return n&&i?n===i?!0:n&&n.nodeType===3?!1:i&&i.nodeType===3?Hm(n,i.parentNode):"contains"in n?n.contains(i):n.compareDocumentPosition?!!(n.compareDocumentPosition(i)&16):!1:!1}function qm(n){n=n!=null&&n.ownerDocument!=null&&n.ownerDocument.defaultView!=null?n.ownerDocument.defaultView:window;for(var i=Wl(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=Wl(n.document)}return i}function vc(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 zv=Xr&&"documentMode"in document&&11>=document.documentMode,Ns=null,wc=null,Ua=null,Sc=!1;function Im(n,i,a){var o=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;Sc||Ns==null||Ns!==Wl(o)||(o=Ns,"selectionStart"in o&&vc(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}),Ua&&za(Ua,o)||(Ua=o,o=Xo(wc,"onSelect"),0<o.length&&(i=new io("onSelect","select",null,i,a),n.push({event:i,listeners:o}),i.target=Ns)))}function ts(n,i){var a={};return a[n.toLowerCase()]=i.toLowerCase(),a["Webkit"+n]="webkit"+i,a["Moz"+n]="moz"+i,a}var Ts={animationend:ts("Animation","AnimationEnd"),animationiteration:ts("Animation","AnimationIteration"),animationstart:ts("Animation","AnimationStart"),transitionrun:ts("Transition","TransitionRun"),transitionstart:ts("Transition","TransitionStart"),transitioncancel:ts("Transition","TransitionCancel"),transitionend:ts("Transition","TransitionEnd")},_c={},Fm={};Xr&&(Fm=document.createElement("div").style,"AnimationEvent"in window||(delete Ts.animationend.animation,delete Ts.animationiteration.animation,delete Ts.animationstart.animation),"TransitionEvent"in window||delete Ts.transitionend.transition);function ns(n){if(_c[n])return _c[n];if(!Ts[n])return n;var i=Ts[n],a;for(a in i)if(i.hasOwnProperty(a)&&a in Fm)return _c[n]=i[a];return n}var $m=ns("animationend"),Vm=ns("animationiteration"),Ym=ns("animationstart"),Uv=ns("transitionrun"),Pv=ns("transitionstart"),Bv=ns("transitioncancel"),Gm=ns("transitionend"),Jm=new Map,kc="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(" ");kc.push("scrollEnd");function Ar(n,i){Jm.set(n,i),ye(i,[n])}var lo=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)},mr=[],Os=0,Ec=0;function oo(){for(var n=Os,i=Ec=Os=0;i<n;){var a=mr[i];mr[i++]=null;var o=mr[i];mr[i++]=null;var h=mr[i];mr[i++]=null;var p=mr[i];if(mr[i++]=null,o!==null&&h!==null){var w=o.pending;w===null?h.next=h:(h.next=w.next,w.next=h),o.pending=h}p!==0&&Xm(a,h,p)}}function uo(n,i,a,o){mr[Os++]=n,mr[Os++]=i,mr[Os++]=a,mr[Os++]=o,Ec|=o,n.lanes|=o,n=n.alternate,n!==null&&(n.lanes|=o)}function Cc(n,i,a,o){return uo(n,i,a,o),co(n)}function rs(n,i){return uo(n,null,null,i),co(n)}function Xm(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-nt(a),n=p.hiddenUpdates,o=n[h],o===null?n[h]=[i]:o.push(i),i.lane=a|536870912),p):null}function co(n){if(50<sl)throw sl=0,zf=null,Error(s(185));for(var i=n.return;i!==null;)n=i,i=n.return;return n.tag===3?n.stateNode:null}var Rs={};function Hv(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 Qn(n,i,a,o){return new Hv(n,i,a,o)}function Ac(n){return n=n.prototype,!(!n||!n.isReactComponent)}function Kr(n,i){var a=n.alternate;return a===null?(a=Qn(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 Km(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 fo(n,i,a,o,h,p){var w=0;if(o=n,typeof n=="function")Ac(n)&&(w=1);else if(typeof n=="string")w=Vw(n,a,ge.current)?26:n==="html"||n==="head"||n==="body"?27:5;else e:switch(n){case V:return n=Qn(31,a,i,h),n.elementType=V,n.lanes=p,n;case j:return is(a.children,h,p,i);case D:w=8,h|=24;break;case T:return n=Qn(12,a,i,h|2),n.elementType=T,n.lanes=p,n;case B:return n=Qn(13,a,i,h),n.elementType=B,n.lanes=p,n;case R:return n=Qn(19,a,i,h),n.elementType=R,n.lanes=p,n;default:if(typeof n=="object"&&n!==null)switch(n.$$typeof){case I:w=10;break e;case P:w=9;break e;case W:w=11;break e;case Z:w=14;break e;case F:w=16,o=null;break e}w=29,a=Error(s(130,n===null?"null":typeof n,"")),o=null}return i=Qn(w,a,i,h),i.elementType=n,i.type=o,i.lanes=p,i}function is(n,i,a,o){return n=Qn(7,n,o,i),n.lanes=a,n}function jc(n,i,a){return n=Qn(6,n,null,i),n.lanes=a,n}function Qm(n){var i=Qn(18,null,null,0);return i.stateNode=n,i}function Nc(n,i,a){return i=Qn(4,n.children!==null?n.children:[],n.key,i),i.lanes=a,i.stateNode={containerInfo:n.containerInfo,pendingChildren:null,implementation:n.implementation},i}var Zm=new WeakMap;function pr(n,i){if(typeof n=="object"&&n!==null){var a=Zm.get(n);return a!==void 0?a:(i={value:n,source:i,stack:Pe(i)},Zm.set(n,i),i)}return{value:n,source:i,stack:Pe(i)}}var Ms=[],Ds=0,ho=null,Pa=0,gr=[],yr=0,vi=null,Ur=1,Pr="";function Qr(n,i){Ms[Ds++]=Pa,Ms[Ds++]=ho,ho=n,Pa=i}function Wm(n,i,a){gr[yr++]=Ur,gr[yr++]=Pr,gr[yr++]=vi,vi=n;var o=Ur;n=Pr;var h=32-nt(o)-1;o&=~(1<<h),a+=1;var p=32-nt(i)+h;if(30<p){var w=h-h%5;p=(o&(1<<w)-1).toString(32),o>>=w,h-=w,Ur=1<<32-nt(i)+h|a<<h|o,Pr=p+n}else Ur=1<<p|a<<h|o,Pr=n}function Tc(n){n.return!==null&&(Qr(n,1),Wm(n,1,0))}function Oc(n){for(;n===ho;)ho=Ms[--Ds],Ms[Ds]=null,Pa=Ms[--Ds],Ms[Ds]=null;for(;n===vi;)vi=gr[--yr],gr[yr]=null,Pr=gr[--yr],gr[yr]=null,Ur=gr[--yr],gr[yr]=null}function ep(n,i){gr[yr++]=Ur,gr[yr++]=Pr,gr[yr++]=vi,Ur=i.id,Pr=i.overflow,vi=n}var wn=null,Bt=null,ut=!1,wi=null,br=!1,Rc=Error(s(519));function Si(n){var i=Error(s(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Ba(pr(i,n)),Rc}function tp(n){var i=n.stateNode,a=n.type,o=n.memoizedProps;switch(i[wt]=n,i[Zt]=o,a){case"dialog":st("cancel",i),st("close",i);break;case"iframe":case"object":case"embed":st("load",i);break;case"video":case"audio":for(a=0;a<ll.length;a++)st(ll[a],i);break;case"source":st("error",i);break;case"img":case"image":case"link":st("error",i),st("load",i);break;case"details":st("toggle",i);break;case"input":st("invalid",i),mm(i,o.value,o.defaultValue,o.checked,o.defaultChecked,o.type,o.name,!0);break;case"select":st("invalid",i);break;case"textarea":st("invalid",i),gm(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||by(i.textContent,a)?(o.popover!=null&&(st("beforetoggle",i),st("toggle",i)),o.onScroll!=null&&st("scroll",i),o.onScrollEnd!=null&&st("scrollend",i),o.onClick!=null&&(i.onclick=Jr),i=!0):i=!1,i||Si(n,!0)}function np(n){for(wn=n.return;wn;)switch(wn.tag){case 5:case 31:case 13:br=!1;return;case 27:case 3:br=!0;return;default:wn=wn.return}}function Ls(n){if(n!==wn)return!1;if(!ut)return np(n),ut=!0,!1;var i=n.tag,a;if((a=i!==3&&i!==27)&&((a=i===5)&&(a=n.type,a=!(a!=="form"&&a!=="button")||Qf(n.type,n.memoizedProps)),a=!a),a&&Bt&&Si(n),np(n),i===13){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(s(317));Bt=Ay(n)}else if(i===31){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(s(317));Bt=Ay(n)}else i===27?(i=Bt,zi(n.type)?(n=nh,nh=null,Bt=n):Bt=i):Bt=wn?vr(n.stateNode.nextSibling):null;return!0}function ss(){Bt=wn=null,ut=!1}function Mc(){var n=wi;return n!==null&&($n===null?$n=n:$n.push.apply($n,n),wi=null),n}function Ba(n){wi===null?wi=[n]:wi.push(n)}var Dc=U(null),as=null,Zr=null;function _i(n,i,a){_(Dc,i._currentValue),i._currentValue=a}function Wr(n){n._currentValue=Dc.current,ee(Dc)}function Lc(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 zc(n,i,a,o){var h=n.child;for(h!==null&&(h.return=n);h!==null;){var p=h.dependencies;if(p!==null){var w=h.child;p=p.firstContext;e:for(;p!==null;){var k=p;p=h;for(var H=0;H<i.length;H++)if(k.context===i[H]){p.lanes|=a,k=p.alternate,k!==null&&(k.lanes|=a),Lc(p.return,a,n),o||(w=null);break e}p=k.next}}else if(h.tag===18){if(w=h.return,w===null)throw Error(s(341));w.lanes|=a,p=w.alternate,p!==null&&(p.lanes|=a),Lc(w,a,n),w=null}else w=h.child;if(w!==null)w.return=h;else for(w=h;w!==null;){if(w===n){w=null;break}if(h=w.sibling,h!==null){h.return=w.return,w=h;break}w=w.return}h=w}}function zs(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 w=h.alternate;if(w===null)throw Error(s(387));if(w=w.memoizedProps,w!==null){var k=h.type;Kn(h.pendingProps.value,w.value)||(n!==null?n.push(k):n=[k])}}else if(h===Te.current){if(w=h.alternate,w===null)throw Error(s(387));w.memoizedState.memoizedState!==h.memoizedState.memoizedState&&(n!==null?n.push(hl):n=[hl])}h=h.return}n!==null&&zc(i,n,a,o),i.flags|=262144}function mo(n){for(n=n.firstContext;n!==null;){if(!Kn(n.context._currentValue,n.memoizedValue))return!0;n=n.next}return!1}function ls(n){as=n,Zr=null,n=n.dependencies,n!==null&&(n.firstContext=null)}function Sn(n){return rp(as,n)}function po(n,i){return as===null&&ls(n),rp(n,i)}function rp(n,i){var a=i._currentValue;if(i={context:i,memoizedValue:a,next:null},Zr===null){if(n===null)throw Error(s(308));Zr=i,n.dependencies={lanes:0,firstContext:i},n.flags|=524288}else Zr=Zr.next=i;return a}var qv=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()})}},Iv=e.unstable_scheduleCallback,Fv=e.unstable_NormalPriority,cn={$$typeof:I,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Uc(){return{controller:new qv,data:new Map,refCount:0}}function Ha(n){n.refCount--,n.refCount===0&&Iv(Fv,function(){n.controller.abort()})}var qa=null,Pc=0,Us=0,Ps=null;function $v(n,i){if(qa===null){var a=qa=[];Pc=0,Us=If(),Ps={status:"pending",value:void 0,then:function(o){a.push(o)}}}return Pc++,i.then(ip,ip),i}function ip(){if(--Pc===0&&qa!==null){Ps!==null&&(Ps.status="fulfilled");var n=qa;qa=null,Us=0,Ps=null;for(var i=0;i<n.length;i++)(0,n[i])()}}function Vv(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 sp=$.S;$.S=function(n,i){Ig=$e(),typeof i=="object"&&i!==null&&typeof i.then=="function"&&$v(n,i),sp!==null&&sp(n,i)};var os=U(null);function Bc(){var n=os.current;return n!==null?n:Dt.pooledCache}function go(n,i){i===null?_(os,os.current):_(os,i.pool)}function ap(){var n=Bc();return n===null?null:{parent:cn._currentValue,pool:n}}var Bs=Error(s(460)),Hc=Error(s(474)),yo=Error(s(542)),bo={then:function(){}};function lp(n){return n=n.status,n==="fulfilled"||n==="rejected"}function op(n,i,a){switch(a=n[a],a===void 0?n.push(i):a!==i&&(i.then(Jr,Jr),i=a),i.status){case"fulfilled":return i.value;case"rejected":throw n=i.reason,cp(n),n;default:if(typeof i.status=="string")i.then(Jr,Jr);else{if(n=Dt,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,cp(n),n}throw cs=i,Bs}}function us(n){try{var i=n._init;return i(n._payload)}catch(a){throw a!==null&&typeof a=="object"&&typeof a.then=="function"?(cs=a,Bs):a}}var cs=null;function up(){if(cs===null)throw Error(s(459));var n=cs;return cs=null,n}function cp(n){if(n===Bs||n===yo)throw Error(s(483))}var Hs=null,Ia=0;function xo(n){var i=Ia;return Ia+=1,Hs===null&&(Hs=[]),op(Hs,n,i)}function Fa(n,i){i=i.props.ref,n.ref=i!==void 0?i:null}function vo(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 fp(n){function i(K,J){if(n){var te=K.deletions;te===null?(K.deletions=[J],K.flags|=16):te.push(J)}}function a(K,J){if(!n)return null;for(;J!==null;)i(K,J),J=J.sibling;return null}function o(K){for(var J=new Map;K!==null;)K.key!==null?J.set(K.key,K):J.set(K.index,K),K=K.sibling;return J}function h(K,J){return K=Kr(K,J),K.index=0,K.sibling=null,K}function p(K,J,te){return K.index=te,n?(te=K.alternate,te!==null?(te=te.index,te<J?(K.flags|=67108866,J):te):(K.flags|=67108866,J)):(K.flags|=1048576,J)}function w(K){return n&&K.alternate===null&&(K.flags|=67108866),K}function k(K,J,te,he){return J===null||J.tag!==6?(J=jc(te,K.mode,he),J.return=K,J):(J=h(J,te),J.return=K,J)}function H(K,J,te,he){var Ue=te.type;return Ue===j?fe(K,J,te.props.children,he,te.key):J!==null&&(J.elementType===Ue||typeof Ue=="object"&&Ue!==null&&Ue.$$typeof===F&&us(Ue)===J.type)?(J=h(J,te.props),Fa(J,te),J.return=K,J):(J=fo(te.type,te.key,te.props,null,K.mode,he),Fa(J,te),J.return=K,J)}function ne(K,J,te,he){return J===null||J.tag!==4||J.stateNode.containerInfo!==te.containerInfo||J.stateNode.implementation!==te.implementation?(J=Nc(te,K.mode,he),J.return=K,J):(J=h(J,te.children||[]),J.return=K,J)}function fe(K,J,te,he,Ue){return J===null||J.tag!==7?(J=is(te,K.mode,he,Ue),J.return=K,J):(J=h(J,te),J.return=K,J)}function pe(K,J,te){if(typeof J=="string"&&J!==""||typeof J=="number"||typeof J=="bigint")return J=jc(""+J,K.mode,te),J.return=K,J;if(typeof J=="object"&&J!==null){switch(J.$$typeof){case v:return te=fo(J.type,J.key,J.props,null,K.mode,te),Fa(te,J),te.return=K,te;case S:return J=Nc(J,K.mode,te),J.return=K,J;case F:return J=us(J),pe(K,J,te)}if(re(J)||G(J))return J=is(J,K.mode,te,null),J.return=K,J;if(typeof J.then=="function")return pe(K,xo(J),te);if(J.$$typeof===I)return pe(K,po(K,J),te);vo(K,J)}return null}function ie(K,J,te,he){var Ue=J!==null?J.key:null;if(typeof te=="string"&&te!==""||typeof te=="number"||typeof te=="bigint")return Ue!==null?null:k(K,J,""+te,he);if(typeof te=="object"&&te!==null){switch(te.$$typeof){case v:return te.key===Ue?H(K,J,te,he):null;case S:return te.key===Ue?ne(K,J,te,he):null;case F:return te=us(te),ie(K,J,te,he)}if(re(te)||G(te))return Ue!==null?null:fe(K,J,te,he,null);if(typeof te.then=="function")return ie(K,J,xo(te),he);if(te.$$typeof===I)return ie(K,J,po(K,te),he);vo(K,te)}return null}function oe(K,J,te,he,Ue){if(typeof he=="string"&&he!==""||typeof he=="number"||typeof he=="bigint")return K=K.get(te)||null,k(J,K,""+he,Ue);if(typeof he=="object"&&he!==null){switch(he.$$typeof){case v:return K=K.get(he.key===null?te:he.key)||null,H(J,K,he,Ue);case S:return K=K.get(he.key===null?te:he.key)||null,ne(J,K,he,Ue);case F:return he=us(he),oe(K,J,te,he,Ue)}if(re(he)||G(he))return K=K.get(te)||null,fe(J,K,he,Ue,null);if(typeof he.then=="function")return oe(K,J,te,xo(he),Ue);if(he.$$typeof===I)return oe(K,J,te,po(J,he),Ue);vo(J,he)}return null}function De(K,J,te,he){for(var Ue=null,gt=null,ze=J,Qe=J=0,ot=null;ze!==null&&Qe<te.length;Qe++){ze.index>Qe?(ot=ze,ze=null):ot=ze.sibling;var yt=ie(K,ze,te[Qe],he);if(yt===null){ze===null&&(ze=ot);break}n&&ze&&yt.alternate===null&&i(K,ze),J=p(yt,J,Qe),gt===null?Ue=yt:gt.sibling=yt,gt=yt,ze=ot}if(Qe===te.length)return a(K,ze),ut&&Qr(K,Qe),Ue;if(ze===null){for(;Qe<te.length;Qe++)ze=pe(K,te[Qe],he),ze!==null&&(J=p(ze,J,Qe),gt===null?Ue=ze:gt.sibling=ze,gt=ze);return ut&&Qr(K,Qe),Ue}for(ze=o(ze);Qe<te.length;Qe++)ot=oe(ze,K,Qe,te[Qe],he),ot!==null&&(n&&ot.alternate!==null&&ze.delete(ot.key===null?Qe:ot.key),J=p(ot,J,Qe),gt===null?Ue=ot:gt.sibling=ot,gt=ot);return n&&ze.forEach(function(qi){return i(K,qi)}),ut&&Qr(K,Qe),Ue}function qe(K,J,te,he){if(te==null)throw Error(s(151));for(var Ue=null,gt=null,ze=J,Qe=J=0,ot=null,yt=te.next();ze!==null&&!yt.done;Qe++,yt=te.next()){ze.index>Qe?(ot=ze,ze=null):ot=ze.sibling;var qi=ie(K,ze,yt.value,he);if(qi===null){ze===null&&(ze=ot);break}n&&ze&&qi.alternate===null&&i(K,ze),J=p(qi,J,Qe),gt===null?Ue=qi:gt.sibling=qi,gt=qi,ze=ot}if(yt.done)return a(K,ze),ut&&Qr(K,Qe),Ue;if(ze===null){for(;!yt.done;Qe++,yt=te.next())yt=pe(K,yt.value,he),yt!==null&&(J=p(yt,J,Qe),gt===null?Ue=yt:gt.sibling=yt,gt=yt);return ut&&Qr(K,Qe),Ue}for(ze=o(ze);!yt.done;Qe++,yt=te.next())yt=oe(ze,K,Qe,yt.value,he),yt!==null&&(n&&yt.alternate!==null&&ze.delete(yt.key===null?Qe:yt.key),J=p(yt,J,Qe),gt===null?Ue=yt:gt.sibling=yt,gt=yt);return n&&ze.forEach(function(nS){return i(K,nS)}),ut&&Qr(K,Qe),Ue}function Nt(K,J,te,he){if(typeof te=="object"&&te!==null&&te.type===j&&te.key===null&&(te=te.props.children),typeof te=="object"&&te!==null){switch(te.$$typeof){case v:e:{for(var Ue=te.key;J!==null;){if(J.key===Ue){if(Ue=te.type,Ue===j){if(J.tag===7){a(K,J.sibling),he=h(J,te.props.children),he.return=K,K=he;break e}}else if(J.elementType===Ue||typeof Ue=="object"&&Ue!==null&&Ue.$$typeof===F&&us(Ue)===J.type){a(K,J.sibling),he=h(J,te.props),Fa(he,te),he.return=K,K=he;break e}a(K,J);break}else i(K,J);J=J.sibling}te.type===j?(he=is(te.props.children,K.mode,he,te.key),he.return=K,K=he):(he=fo(te.type,te.key,te.props,null,K.mode,he),Fa(he,te),he.return=K,K=he)}return w(K);case S:e:{for(Ue=te.key;J!==null;){if(J.key===Ue)if(J.tag===4&&J.stateNode.containerInfo===te.containerInfo&&J.stateNode.implementation===te.implementation){a(K,J.sibling),he=h(J,te.children||[]),he.return=K,K=he;break e}else{a(K,J);break}else i(K,J);J=J.sibling}he=Nc(te,K.mode,he),he.return=K,K=he}return w(K);case F:return te=us(te),Nt(K,J,te,he)}if(re(te))return De(K,J,te,he);if(G(te)){if(Ue=G(te),typeof Ue!="function")throw Error(s(150));return te=Ue.call(te),qe(K,J,te,he)}if(typeof te.then=="function")return Nt(K,J,xo(te),he);if(te.$$typeof===I)return Nt(K,J,po(K,te),he);vo(K,te)}return typeof te=="string"&&te!==""||typeof te=="number"||typeof te=="bigint"?(te=""+te,J!==null&&J.tag===6?(a(K,J.sibling),he=h(J,te),he.return=K,K=he):(a(K,J),he=jc(te,K.mode,he),he.return=K,K=he),w(K)):a(K,J)}return function(K,J,te,he){try{Ia=0;var Ue=Nt(K,J,te,he);return Hs=null,Ue}catch(ze){if(ze===Bs||ze===yo)throw ze;var gt=Qn(29,ze,null,K.mode);return gt.lanes=he,gt.return=K,gt}finally{}}}var fs=fp(!0),hp=fp(!1),ki=!1;function qc(n){n.updateQueue={baseState:n.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Ic(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 Ei(n){return{lane:n,tag:0,payload:null,callback:null,next:null}}function Ci(n,i,a){var o=n.updateQueue;if(o===null)return null;if(o=o.shared,(vt&2)!==0){var h=o.pending;return h===null?i.next=i:(i.next=h.next,h.next=i),o.pending=i,i=co(n),Xm(n,null,a),i}return uo(n,o,i,a),co(n)}function $a(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,mt(n,a)}}function Fc(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 w={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};p===null?h=p=w:p=p.next=w,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 $c=!1;function Va(){if($c){var n=Ps;if(n!==null)throw n}}function Ya(n,i,a,o){$c=!1;var h=n.updateQueue;ki=!1;var p=h.firstBaseUpdate,w=h.lastBaseUpdate,k=h.shared.pending;if(k!==null){h.shared.pending=null;var H=k,ne=H.next;H.next=null,w===null?p=ne:w.next=ne,w=H;var fe=n.alternate;fe!==null&&(fe=fe.updateQueue,k=fe.lastBaseUpdate,k!==w&&(k===null?fe.firstBaseUpdate=ne:k.next=ne,fe.lastBaseUpdate=H))}if(p!==null){var pe=h.baseState;w=0,fe=ne=H=null,k=p;do{var ie=k.lane&-536870913,oe=ie!==k.lane;if(oe?(lt&ie)===ie:(o&ie)===ie){ie!==0&&ie===Us&&($c=!0),fe!==null&&(fe=fe.next={lane:0,tag:k.tag,payload:k.payload,callback:null,next:null});e:{var De=n,qe=k;ie=i;var Nt=a;switch(qe.tag){case 1:if(De=qe.payload,typeof De=="function"){pe=De.call(Nt,pe,ie);break e}pe=De;break e;case 3:De.flags=De.flags&-65537|128;case 0:if(De=qe.payload,ie=typeof De=="function"?De.call(Nt,pe,ie):De,ie==null)break e;pe=g({},pe,ie);break e;case 2:ki=!0}}ie=k.callback,ie!==null&&(n.flags|=64,oe&&(n.flags|=8192),oe=h.callbacks,oe===null?h.callbacks=[ie]:oe.push(ie))}else oe={lane:ie,tag:k.tag,payload:k.payload,callback:k.callback,next:null},fe===null?(ne=fe=oe,H=pe):fe=fe.next=oe,w|=ie;if(k=k.next,k===null){if(k=h.shared.pending,k===null)break;oe=k,k=oe.next,oe.next=null,h.lastBaseUpdate=oe,h.shared.pending=null}}while(!0);fe===null&&(H=pe),h.baseState=H,h.firstBaseUpdate=ne,h.lastBaseUpdate=fe,p===null&&(h.shared.lanes=0),Oi|=w,n.lanes=w,n.memoizedState=pe}}function dp(n,i){if(typeof n!="function")throw Error(s(191,n));n.call(i)}function mp(n,i){var a=n.callbacks;if(a!==null)for(n.callbacks=null,n=0;n<a.length;n++)dp(a[n],i)}var qs=U(null),wo=U(0);function pp(n,i){n=oi,_(wo,n),_(qs,i),oi=n|i.baseLanes}function Vc(){_(wo,oi),_(qs,qs.current)}function Yc(){oi=wo.current,ee(qs),ee(wo)}var Zn=U(null),xr=null;function Ai(n){var i=n.alternate;_(rn,rn.current&1),_(Zn,n),xr===null&&(i===null||qs.current!==null||i.memoizedState!==null)&&(xr=n)}function Gc(n){_(rn,rn.current),_(Zn,n),xr===null&&(xr=n)}function gp(n){n.tag===22?(_(rn,rn.current),_(Zn,n),xr===null&&(xr=n)):ji()}function ji(){_(rn,rn.current),_(Zn,Zn.current)}function Wn(n){ee(Zn),xr===n&&(xr=null),ee(rn)}var rn=U(0);function So(n){for(var i=n;i!==null;){if(i.tag===13){var a=i.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||eh(a)||th(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 ei=0,Xe=null,At=null,fn=null,_o=!1,Is=!1,hs=!1,ko=0,Ga=0,Fs=null,Yv=0;function Wt(){throw Error(s(321))}function Jc(n,i){if(i===null)return!1;for(var a=0;a<i.length&&a<n.length;a++)if(!Kn(n[a],i[a]))return!1;return!0}function Xc(n,i,a,o,h,p){return ei=p,Xe=i,i.memoizedState=null,i.updateQueue=null,i.lanes=0,$.H=n===null||n.memoizedState===null?Wp:ff,hs=!1,p=a(o,h),hs=!1,Is&&(p=bp(i,a,o,h)),yp(n),p}function yp(n){$.H=Ka;var i=At!==null&&At.next!==null;if(ei=0,fn=At=Xe=null,_o=!1,Ga=0,Fs=null,i)throw Error(s(300));n===null||hn||(n=n.dependencies,n!==null&&mo(n)&&(hn=!0))}function bp(n,i,a,o){Xe=n;var h=0;do{if(Is&&(Fs=null),Ga=0,Is=!1,25<=h)throw Error(s(301));if(h+=1,fn=At=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=eg,p=i(a,o)}while(Is);return p}function Gv(){var n=$.H,i=n.useState()[0];return i=typeof i.then=="function"?Ja(i):i,n=n.useState()[0],(At!==null?At.memoizedState:null)!==n&&(Xe.flags|=1024),i}function Kc(){var n=ko!==0;return ko=0,n}function Qc(n,i,a){i.updateQueue=n.updateQueue,i.flags&=-2053,n.lanes&=~a}function Zc(n){if(_o){for(n=n.memoizedState;n!==null;){var i=n.queue;i!==null&&(i.pending=null),n=n.next}_o=!1}ei=0,fn=At=Xe=null,Is=!1,Ga=ko=0,Fs=null}function Rn(){var n={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return fn===null?Xe.memoizedState=fn=n:fn=fn.next=n,fn}function sn(){if(At===null){var n=Xe.alternate;n=n!==null?n.memoizedState:null}else n=At.next;var i=fn===null?Xe.memoizedState:fn.next;if(i!==null)fn=i,At=n;else{if(n===null)throw Xe.alternate===null?Error(s(467)):Error(s(310));At=n,n={memoizedState:At.memoizedState,baseState:At.baseState,baseQueue:At.baseQueue,queue:At.queue,next:null},fn===null?Xe.memoizedState=fn=n:fn=fn.next=n}return fn}function Eo(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Ja(n){var i=Ga;return Ga+=1,Fs===null&&(Fs=[]),n=op(Fs,n,i),i=Xe,(fn===null?i.memoizedState:fn.next)===null&&(i=i.alternate,$.H=i===null||i.memoizedState===null?Wp:ff),n}function Co(n){if(n!==null&&typeof n=="object"){if(typeof n.then=="function")return Ja(n);if(n.$$typeof===I)return Sn(n)}throw Error(s(438,String(n)))}function Wc(n){var i=null,a=Xe.updateQueue;if(a!==null&&(i=a.memoCache),i==null){var o=Xe.alternate;o!==null&&(o=o.updateQueue,o!==null&&(o=o.memoCache,o!=null&&(i={data:o.data.map(function(h){return h.slice()}),index:0})))}if(i==null&&(i={data:[],index:0}),a===null&&(a=Eo(),Xe.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]=L;return i.index++,a}function ti(n,i){return typeof i=="function"?i(n):i}function Ao(n){var i=sn();return ef(i,At,n)}function ef(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 w=h.next;h.next=p.next,p.next=w}i.baseQueue=h=p,o.pending=null}if(p=n.baseState,h===null)n.memoizedState=p;else{i=h.next;var k=w=null,H=null,ne=i,fe=!1;do{var pe=ne.lane&-536870913;if(pe!==ne.lane?(lt&pe)===pe:(ei&pe)===pe){var ie=ne.revertLane;if(ie===0)H!==null&&(H=H.next={lane:0,revertLane:0,gesture:null,action:ne.action,hasEagerState:ne.hasEagerState,eagerState:ne.eagerState,next:null}),pe===Us&&(fe=!0);else if((ei&ie)===ie){ne=ne.next,ie===Us&&(fe=!0);continue}else pe={lane:0,revertLane:ne.revertLane,gesture:null,action:ne.action,hasEagerState:ne.hasEagerState,eagerState:ne.eagerState,next:null},H===null?(k=H=pe,w=p):H=H.next=pe,Xe.lanes|=ie,Oi|=ie;pe=ne.action,hs&&a(p,pe),p=ne.hasEagerState?ne.eagerState:a(p,pe)}else ie={lane:pe,revertLane:ne.revertLane,gesture:ne.gesture,action:ne.action,hasEagerState:ne.hasEagerState,eagerState:ne.eagerState,next:null},H===null?(k=H=ie,w=p):H=H.next=ie,Xe.lanes|=pe,Oi|=pe;ne=ne.next}while(ne!==null&&ne!==i);if(H===null?w=p:H.next=k,!Kn(p,n.memoizedState)&&(hn=!0,fe&&(a=Ps,a!==null)))throw a;n.memoizedState=p,n.baseState=w,n.baseQueue=H,o.lastRenderedState=p}return h===null&&(o.lanes=0),[n.memoizedState,o.dispatch]}function tf(n){var i=sn(),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 w=h=h.next;do p=n(p,w.action),w=w.next;while(w!==h);Kn(p,i.memoizedState)||(hn=!0),i.memoizedState=p,i.baseQueue===null&&(i.baseState=p),a.lastRenderedState=p}return[p,o]}function xp(n,i,a){var o=Xe,h=sn(),p=ut;if(p){if(a===void 0)throw Error(s(407));a=a()}else a=i();var w=!Kn((At||h).memoizedState,a);if(w&&(h.memoizedState=a,hn=!0),h=h.queue,sf(Sp.bind(null,o,h,n),[n]),h.getSnapshot!==i||w||fn!==null&&fn.memoizedState.tag&1){if(o.flags|=2048,$s(9,{destroy:void 0},wp.bind(null,o,h,a,i),null),Dt===null)throw Error(s(349));p||(ei&127)!==0||vp(o,i,a)}return a}function vp(n,i,a){n.flags|=16384,n={getSnapshot:i,value:a},i=Xe.updateQueue,i===null?(i=Eo(),Xe.updateQueue=i,i.stores=[n]):(a=i.stores,a===null?i.stores=[n]:a.push(n))}function wp(n,i,a,o){i.value=a,i.getSnapshot=o,_p(i)&&kp(n)}function Sp(n,i,a){return a(function(){_p(i)&&kp(n)})}function _p(n){var i=n.getSnapshot;n=n.value;try{var a=i();return!Kn(n,a)}catch{return!0}}function kp(n){var i=rs(n,2);i!==null&&Vn(i,n,2)}function nf(n){var i=Rn();if(typeof n=="function"){var a=n;if(n=a(),hs){Jt(!0);try{a()}finally{Jt(!1)}}}return i.memoizedState=i.baseState=n,i.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ti,lastRenderedState:n},i}function Ep(n,i,a,o){return n.baseState=a,ef(n,At,typeof o=="function"?o:ti)}function Jv(n,i,a,o,h){if(To(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(w){p.listeners.push(w)}};$.T!==null?a(!0):p.isTransition=!1,o(p),a=i.pending,a===null?(p.next=i.pending=p,Cp(i,p)):(p.next=a.next,i.pending=a.next=p)}}function Cp(n,i){var a=i.action,o=i.payload,h=n.state;if(i.isTransition){var p=$.T,w={};$.T=w;try{var k=a(h,o),H=$.S;H!==null&&H(w,k),Ap(n,i,k)}catch(ne){rf(n,i,ne)}finally{p!==null&&w.types!==null&&(p.types=w.types),$.T=p}}else try{p=a(h,o),Ap(n,i,p)}catch(ne){rf(n,i,ne)}}function Ap(n,i,a){a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(function(o){jp(n,i,o)},function(o){return rf(n,i,o)}):jp(n,i,a)}function jp(n,i,a){i.status="fulfilled",i.value=a,Np(i),n.state=a,i=n.pending,i!==null&&(a=i.next,a===i?n.pending=null:(a=a.next,i.next=a,Cp(n,a)))}function rf(n,i,a){var o=n.pending;if(n.pending=null,o!==null){o=o.next;do i.status="rejected",i.reason=a,Np(i),i=i.next;while(i!==o)}n.action=null}function Np(n){n=n.listeners;for(var i=0;i<n.length;i++)(0,n[i])()}function Tp(n,i){return i}function Op(n,i){if(ut){var a=Dt.formState;if(a!==null){e:{var o=Xe;if(ut){if(Bt){t:{for(var h=Bt,p=br;h.nodeType!==8;){if(!p){h=null;break t}if(h=vr(h.nextSibling),h===null){h=null;break t}}p=h.data,h=p==="F!"||p==="F"?h:null}if(h){Bt=vr(h.nextSibling),o=h.data==="F!";break e}}Si(o)}o=!1}o&&(i=a[0])}}return a=Rn(),a.memoizedState=a.baseState=i,o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Tp,lastRenderedState:i},a.queue=o,a=Kp.bind(null,Xe,o),o.dispatch=a,o=nf(!1),p=cf.bind(null,Xe,!1,o.queue),o=Rn(),h={state:i,dispatch:null,action:n,pending:null},o.queue=h,a=Jv.bind(null,Xe,h,p,a),h.dispatch=a,o.memoizedState=n,[i,a,!1]}function Rp(n){var i=sn();return Mp(i,At,n)}function Mp(n,i,a){if(i=ef(n,i,Tp)[0],n=Ao(ti)[0],typeof i=="object"&&i!==null&&typeof i.then=="function")try{var o=Ja(i)}catch(w){throw w===Bs?yo:w}else o=i;i=sn();var h=i.queue,p=h.dispatch;return a!==i.memoizedState&&(Xe.flags|=2048,$s(9,{destroy:void 0},Xv.bind(null,h,a),null)),[o,p,n]}function Xv(n,i){n.action=i}function Dp(n){var i=sn(),a=At;if(a!==null)return Mp(i,a,n);sn(),i=i.memoizedState,a=sn();var o=a.queue.dispatch;return a.memoizedState=n,[i,o,!1]}function $s(n,i,a,o){return n={tag:n,create:a,deps:o,inst:i,next:null},i=Xe.updateQueue,i===null&&(i=Eo(),Xe.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 Lp(){return sn().memoizedState}function jo(n,i,a,o){var h=Rn();Xe.flags|=n,h.memoizedState=$s(1|i,{destroy:void 0},a,o===void 0?null:o)}function No(n,i,a,o){var h=sn();o=o===void 0?null:o;var p=h.memoizedState.inst;At!==null&&o!==null&&Jc(o,At.memoizedState.deps)?h.memoizedState=$s(i,p,a,o):(Xe.flags|=n,h.memoizedState=$s(1|i,p,a,o))}function zp(n,i){jo(8390656,8,n,i)}function sf(n,i){No(2048,8,n,i)}function Kv(n){Xe.flags|=4;var i=Xe.updateQueue;if(i===null)i=Eo(),Xe.updateQueue=i,i.events=[n];else{var a=i.events;a===null?i.events=[n]:a.push(n)}}function Up(n){var i=sn().memoizedState;return Kv({ref:i,nextImpl:n}),function(){if((vt&2)!==0)throw Error(s(440));return i.impl.apply(void 0,arguments)}}function Pp(n,i){return No(4,2,n,i)}function Bp(n,i){return No(4,4,n,i)}function Hp(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 qp(n,i,a){a=a!=null?a.concat([n]):null,No(4,4,Hp.bind(null,i,n),a)}function af(){}function Ip(n,i){var a=sn();i=i===void 0?null:i;var o=a.memoizedState;return i!==null&&Jc(i,o[1])?o[0]:(a.memoizedState=[n,i],n)}function Fp(n,i){var a=sn();i=i===void 0?null:i;var o=a.memoizedState;if(i!==null&&Jc(i,o[1]))return o[0];if(o=n(),hs){Jt(!0);try{n()}finally{Jt(!1)}}return a.memoizedState=[o,i],o}function lf(n,i,a){return a===void 0||(ei&1073741824)!==0&&(lt&261930)===0?n.memoizedState=i:(n.memoizedState=a,n=$g(),Xe.lanes|=n,Oi|=n,a)}function $p(n,i,a,o){return Kn(a,i)?a:qs.current!==null?(n=lf(n,a,o),Kn(n,i)||(hn=!0),n):(ei&42)===0||(ei&1073741824)!==0&&(lt&261930)===0?(hn=!0,n.memoizedState=a):(n=$g(),Xe.lanes|=n,Oi|=n,i)}function Vp(n,i,a,o,h){var p=q.p;q.p=p!==0&&8>p?p:8;var w=$.T,k={};$.T=k,cf(n,!1,i,a);try{var H=h(),ne=$.S;if(ne!==null&&ne(k,H),H!==null&&typeof H=="object"&&typeof H.then=="function"){var fe=Vv(H,o);Xa(n,i,fe,nr(n))}else Xa(n,i,o,nr(n))}catch(pe){Xa(n,i,{then:function(){},status:"rejected",reason:pe},nr())}finally{q.p=p,w!==null&&k.types!==null&&(w.types=k.types),$.T=w}}function Qv(){}function of(n,i,a,o){if(n.tag!==5)throw Error(s(476));var h=Yp(n).queue;Vp(n,h,i,ae,a===null?Qv:function(){return Gp(n),a(o)})}function Yp(n){var i=n.memoizedState;if(i!==null)return i;i={memoizedState:ae,baseState:ae,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ti,lastRenderedState:ae},next:null};var a={};return i.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ti,lastRenderedState:a},next:null},n.memoizedState=i,n=n.alternate,n!==null&&(n.memoizedState=i),i}function Gp(n){var i=Yp(n);i.next===null&&(i=n.alternate.memoizedState),Xa(n,i.next.queue,{},nr())}function uf(){return Sn(hl)}function Jp(){return sn().memoizedState}function Xp(){return sn().memoizedState}function Zv(n){for(var i=n.return;i!==null;){switch(i.tag){case 24:case 3:var a=nr();n=Ei(a);var o=Ci(i,n,a);o!==null&&(Vn(o,i,a),$a(o,i,a)),i={cache:Uc()},n.payload=i;return}i=i.return}}function Wv(n,i,a){var o=nr();a={lane:o,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},To(n)?Qp(i,a):(a=Cc(n,i,a,o),a!==null&&(Vn(a,n,o),Zp(a,i,o)))}function Kp(n,i,a){var o=nr();Xa(n,i,a,o)}function Xa(n,i,a,o){var h={lane:o,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(To(n))Qp(i,h);else{var p=n.alternate;if(n.lanes===0&&(p===null||p.lanes===0)&&(p=i.lastRenderedReducer,p!==null))try{var w=i.lastRenderedState,k=p(w,a);if(h.hasEagerState=!0,h.eagerState=k,Kn(k,w))return uo(n,i,h,0),Dt===null&&oo(),!1}catch{}finally{}if(a=Cc(n,i,h,o),a!==null)return Vn(a,n,o),Zp(a,i,o),!0}return!1}function cf(n,i,a,o){if(o={lane:2,revertLane:If(),gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null},To(n)){if(i)throw Error(s(479))}else i=Cc(n,a,o,2),i!==null&&Vn(i,n,2)}function To(n){var i=n.alternate;return n===Xe||i!==null&&i===Xe}function Qp(n,i){Is=_o=!0;var a=n.pending;a===null?i.next=i:(i.next=a.next,a.next=i),n.pending=i}function Zp(n,i,a){if((a&4194048)!==0){var o=i.lanes;o&=n.pendingLanes,a|=o,i.lanes=a,mt(n,a)}}var Ka={readContext:Sn,use:Co,useCallback:Wt,useContext:Wt,useEffect:Wt,useImperativeHandle:Wt,useLayoutEffect:Wt,useInsertionEffect:Wt,useMemo:Wt,useReducer:Wt,useRef:Wt,useState:Wt,useDebugValue:Wt,useDeferredValue:Wt,useTransition:Wt,useSyncExternalStore:Wt,useId:Wt,useHostTransitionStatus:Wt,useFormState:Wt,useActionState:Wt,useOptimistic:Wt,useMemoCache:Wt,useCacheRefresh:Wt};Ka.useEffectEvent=Wt;var Wp={readContext:Sn,use:Co,useCallback:function(n,i){return Rn().memoizedState=[n,i===void 0?null:i],n},useContext:Sn,useEffect:zp,useImperativeHandle:function(n,i,a){a=a!=null?a.concat([n]):null,jo(4194308,4,Hp.bind(null,i,n),a)},useLayoutEffect:function(n,i){return jo(4194308,4,n,i)},useInsertionEffect:function(n,i){jo(4,2,n,i)},useMemo:function(n,i){var a=Rn();i=i===void 0?null:i;var o=n();if(hs){Jt(!0);try{n()}finally{Jt(!1)}}return a.memoizedState=[o,i],o},useReducer:function(n,i,a){var o=Rn();if(a!==void 0){var h=a(i);if(hs){Jt(!0);try{a(i)}finally{Jt(!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=Wv.bind(null,Xe,n),[o.memoizedState,n]},useRef:function(n){var i=Rn();return n={current:n},i.memoizedState=n},useState:function(n){n=nf(n);var i=n.queue,a=Kp.bind(null,Xe,i);return i.dispatch=a,[n.memoizedState,a]},useDebugValue:af,useDeferredValue:function(n,i){var a=Rn();return lf(a,n,i)},useTransition:function(){var n=nf(!1);return n=Vp.bind(null,Xe,n.queue,!0,!1),Rn().memoizedState=n,[!1,n]},useSyncExternalStore:function(n,i,a){var o=Xe,h=Rn();if(ut){if(a===void 0)throw Error(s(407));a=a()}else{if(a=i(),Dt===null)throw Error(s(349));(lt&127)!==0||vp(o,i,a)}h.memoizedState=a;var p={value:a,getSnapshot:i};return h.queue=p,zp(Sp.bind(null,o,p,n),[n]),o.flags|=2048,$s(9,{destroy:void 0},wp.bind(null,o,p,a,i),null),a},useId:function(){var n=Rn(),i=Dt.identifierPrefix;if(ut){var a=Pr,o=Ur;a=(o&~(1<<32-nt(o)-1)).toString(32)+a,i="_"+i+"R_"+a,a=ko++,0<a&&(i+="H"+a.toString(32)),i+="_"}else a=Yv++,i="_"+i+"r_"+a.toString(32)+"_";return n.memoizedState=i},useHostTransitionStatus:uf,useFormState:Op,useActionState:Op,useOptimistic:function(n){var i=Rn();i.memoizedState=i.baseState=n;var a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return i.queue=a,i=cf.bind(null,Xe,!0,a),a.dispatch=i,[n,i]},useMemoCache:Wc,useCacheRefresh:function(){return Rn().memoizedState=Zv.bind(null,Xe)},useEffectEvent:function(n){var i=Rn(),a={impl:n};return i.memoizedState=a,function(){if((vt&2)!==0)throw Error(s(440));return a.impl.apply(void 0,arguments)}}},ff={readContext:Sn,use:Co,useCallback:Ip,useContext:Sn,useEffect:sf,useImperativeHandle:qp,useInsertionEffect:Pp,useLayoutEffect:Bp,useMemo:Fp,useReducer:Ao,useRef:Lp,useState:function(){return Ao(ti)},useDebugValue:af,useDeferredValue:function(n,i){var a=sn();return $p(a,At.memoizedState,n,i)},useTransition:function(){var n=Ao(ti)[0],i=sn().memoizedState;return[typeof n=="boolean"?n:Ja(n),i]},useSyncExternalStore:xp,useId:Jp,useHostTransitionStatus:uf,useFormState:Rp,useActionState:Rp,useOptimistic:function(n,i){var a=sn();return Ep(a,At,n,i)},useMemoCache:Wc,useCacheRefresh:Xp};ff.useEffectEvent=Up;var eg={readContext:Sn,use:Co,useCallback:Ip,useContext:Sn,useEffect:sf,useImperativeHandle:qp,useInsertionEffect:Pp,useLayoutEffect:Bp,useMemo:Fp,useReducer:tf,useRef:Lp,useState:function(){return tf(ti)},useDebugValue:af,useDeferredValue:function(n,i){var a=sn();return At===null?lf(a,n,i):$p(a,At.memoizedState,n,i)},useTransition:function(){var n=tf(ti)[0],i=sn().memoizedState;return[typeof n=="boolean"?n:Ja(n),i]},useSyncExternalStore:xp,useId:Jp,useHostTransitionStatus:uf,useFormState:Dp,useActionState:Dp,useOptimistic:function(n,i){var a=sn();return At!==null?Ep(a,At,n,i):(a.baseState=n,[n,a.queue.dispatch])},useMemoCache:Wc,useCacheRefresh:Xp};eg.useEffectEvent=Up;function hf(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 df={enqueueSetState:function(n,i,a){n=n._reactInternals;var o=nr(),h=Ei(o);h.payload=i,a!=null&&(h.callback=a),i=Ci(n,h,o),i!==null&&(Vn(i,n,o),$a(i,n,o))},enqueueReplaceState:function(n,i,a){n=n._reactInternals;var o=nr(),h=Ei(o);h.tag=1,h.payload=i,a!=null&&(h.callback=a),i=Ci(n,h,o),i!==null&&(Vn(i,n,o),$a(i,n,o))},enqueueForceUpdate:function(n,i){n=n._reactInternals;var a=nr(),o=Ei(a);o.tag=2,i!=null&&(o.callback=i),i=Ci(n,o,a),i!==null&&(Vn(i,n,a),$a(i,n,a))}};function tg(n,i,a,o,h,p,w){return n=n.stateNode,typeof n.shouldComponentUpdate=="function"?n.shouldComponentUpdate(o,p,w):i.prototype&&i.prototype.isPureReactComponent?!za(a,o)||!za(h,p):!0}function ng(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&&df.enqueueReplaceState(i,i.state,null)}function ds(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 rg(n){lo(n)}function ig(n){console.error(n)}function sg(n){lo(n)}function Oo(n,i){try{var a=n.onUncaughtError;a(i.value,{componentStack:i.stack})}catch(o){setTimeout(function(){throw o})}}function ag(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 mf(n,i,a){return a=Ei(a),a.tag=3,a.payload={element:null},a.callback=function(){Oo(n,i)},a}function lg(n){return n=Ei(n),n.tag=3,n}function og(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(){ag(i,a,o)}}var w=a.stateNode;w!==null&&typeof w.componentDidCatch=="function"&&(n.callback=function(){ag(i,a,o),typeof h!="function"&&(Ri===null?Ri=new Set([this]):Ri.add(this));var k=o.stack;this.componentDidCatch(o.value,{componentStack:k!==null?k:""})})}function ew(n,i,a,o,h){if(a.flags|=32768,o!==null&&typeof o=="object"&&typeof o.then=="function"){if(i=a.alternate,i!==null&&zs(i,a,h,!0),a=Zn.current,a!==null){switch(a.tag){case 31:case 13:return xr===null?Fo():a.alternate===null&&en===0&&(en=3),a.flags&=-257,a.flags|=65536,a.lanes=h,o===bo?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===bo?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),Fo(),!1}if(ut)return i=Zn.current,i!==null?((i.flags&65536)===0&&(i.flags|=256),i.flags|=65536,i.lanes=h,o!==Rc&&(n=Error(s(422),{cause:o}),Ba(pr(n,a)))):(o!==Rc&&(i=Error(s(423),{cause:o}),Ba(pr(i,a))),n=n.current.alternate,n.flags|=65536,h&=-h,n.lanes|=h,o=pr(o,a),h=mf(n.stateNode,o,h),Fc(n,h),en!==4&&(en=2)),!1;var p=Error(s(520),{cause:o});if(p=pr(p,a),il===null?il=[p]:il.push(p),en!==4&&(en=2),i===null)return!0;o=pr(o,a),a=i;do{switch(a.tag){case 3:return a.flags|=65536,n=h&-h,a.lanes|=n,n=mf(a.stateNode,o,n),Fc(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"&&(Ri===null||!Ri.has(p))))return a.flags|=65536,h&=-h,a.lanes|=h,h=lg(h),og(h,n,a,o),Fc(a,h),!1}a=a.return}while(a!==null);return!1}var pf=Error(s(461)),hn=!1;function _n(n,i,a,o){i.child=n===null?hp(i,null,a,o):fs(i,n.child,a,o)}function ug(n,i,a,o,h){a=a.render;var p=i.ref;if("ref"in o){var w={};for(var k in o)k!=="ref"&&(w[k]=o[k])}else w=o;return ls(i),o=Xc(n,i,a,w,p,h),k=Kc(),n!==null&&!hn?(Qc(n,i,h),ni(n,i,h)):(ut&&k&&Tc(i),i.flags|=1,_n(n,i,o,h),i.child)}function cg(n,i,a,o,h){if(n===null){var p=a.type;return typeof p=="function"&&!Ac(p)&&p.defaultProps===void 0&&a.compare===null?(i.tag=15,i.type=p,fg(n,i,p,o,h)):(n=fo(a.type,null,o,i,i.mode,h),n.ref=i.ref,n.return=i,i.child=n)}if(p=n.child,!_f(n,h)){var w=p.memoizedProps;if(a=a.compare,a=a!==null?a:za,a(w,o)&&n.ref===i.ref)return ni(n,i,h)}return i.flags|=1,n=Kr(p,o),n.ref=i.ref,n.return=i,i.child=n}function fg(n,i,a,o,h){if(n!==null){var p=n.memoizedProps;if(za(p,o)&&n.ref===i.ref)if(hn=!1,i.pendingProps=o=p,_f(n,h))(n.flags&131072)!==0&&(hn=!0);else return i.lanes=n.lanes,ni(n,i,h)}return gf(n,i,a,o,h)}function hg(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 dg(n,i,p,a,o)}if((a&536870912)!==0)i.memoizedState={baseLanes:0,cachePool:null},n!==null&&go(i,p!==null?p.cachePool:null),p!==null?pp(i,p):Vc(),gp(i);else return o=i.lanes=536870912,dg(n,i,p!==null?p.baseLanes|a:a,a,o)}else p!==null?(go(i,p.cachePool),pp(i,p),ji(),i.memoizedState=null):(n!==null&&go(i,null),Vc(),ji());return _n(n,i,h,a),i.child}function Qa(n,i){return n!==null&&n.tag===22||i.stateNode!==null||(i.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),i.sibling}function dg(n,i,a,o,h){var p=Bc();return p=p===null?null:{parent:cn._currentValue,pool:p},i.memoizedState={baseLanes:a,cachePool:p},n!==null&&go(i,null),Vc(),gp(i),n!==null&&zs(n,i,o,!0),i.childLanes=h,null}function Ro(n,i){return i=Do({mode:i.mode,children:i.children},n.mode),i.ref=n.ref,n.child=i,i.return=n,i}function mg(n,i,a){return fs(i,n.child,null,a),n=Ro(i,i.pendingProps),n.flags|=2,Wn(i),i.memoizedState=null,n}function tw(n,i,a){var o=i.pendingProps,h=(i.flags&128)!==0;if(i.flags&=-129,n===null){if(ut){if(o.mode==="hidden")return n=Ro(i,o),i.lanes=536870912,Qa(null,n);if(Gc(i),(n=Bt)?(n=Cy(n,br),n=n!==null&&n.data==="&"?n:null,n!==null&&(i.memoizedState={dehydrated:n,treeContext:vi!==null?{id:Ur,overflow:Pr}:null,retryLane:536870912,hydrationErrors:null},a=Qm(n),a.return=i,i.child=a,wn=i,Bt=null)):n=null,n===null)throw Si(i);return i.lanes=536870912,null}return Ro(i,o)}var p=n.memoizedState;if(p!==null){var w=p.dehydrated;if(Gc(i),h)if(i.flags&256)i.flags&=-257,i=mg(n,i,a);else if(i.memoizedState!==null)i.child=n.child,i.flags|=128,i=null;else throw Error(s(558));else if(hn||zs(n,i,a,!1),h=(a&n.childLanes)!==0,hn||h){if(o=Dt,o!==null&&(w=Xt(o,a),w!==0&&w!==p.retryLane))throw p.retryLane=w,rs(n,w),Vn(o,n,w),pf;Fo(),i=mg(n,i,a)}else n=p.treeContext,Bt=vr(w.nextSibling),wn=i,ut=!0,wi=null,br=!1,n!==null&&ep(i,n),i=Ro(i,o),i.flags|=4096;return i}return n=Kr(n.child,{mode:o.mode,children:o.children}),n.ref=i.ref,i.child=n,n.return=i,n}function Mo(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 gf(n,i,a,o,h){return ls(i),a=Xc(n,i,a,o,void 0,h),o=Kc(),n!==null&&!hn?(Qc(n,i,h),ni(n,i,h)):(ut&&o&&Tc(i),i.flags|=1,_n(n,i,a,h),i.child)}function pg(n,i,a,o,h,p){return ls(i),i.updateQueue=null,a=bp(i,o,a,h),yp(n),o=Kc(),n!==null&&!hn?(Qc(n,i,p),ni(n,i,p)):(ut&&o&&Tc(i),i.flags|=1,_n(n,i,a,p),i.child)}function gg(n,i,a,o,h){if(ls(i),i.stateNode===null){var p=Rs,w=a.contextType;typeof w=="object"&&w!==null&&(p=Sn(w)),p=new a(o,p),i.memoizedState=p.state!==null&&p.state!==void 0?p.state:null,p.updater=df,i.stateNode=p,p._reactInternals=i,p=i.stateNode,p.props=o,p.state=i.memoizedState,p.refs={},qc(i),w=a.contextType,p.context=typeof w=="object"&&w!==null?Sn(w):Rs,p.state=i.memoizedState,w=a.getDerivedStateFromProps,typeof w=="function"&&(hf(i,a,w,o),p.state=i.memoizedState),typeof a.getDerivedStateFromProps=="function"||typeof p.getSnapshotBeforeUpdate=="function"||typeof p.UNSAFE_componentWillMount!="function"&&typeof p.componentWillMount!="function"||(w=p.state,typeof p.componentWillMount=="function"&&p.componentWillMount(),typeof p.UNSAFE_componentWillMount=="function"&&p.UNSAFE_componentWillMount(),w!==p.state&&df.enqueueReplaceState(p,p.state,null),Ya(i,o,p,h),Va(),p.state=i.memoizedState),typeof p.componentDidMount=="function"&&(i.flags|=4194308),o=!0}else if(n===null){p=i.stateNode;var k=i.memoizedProps,H=ds(a,k);p.props=H;var ne=p.context,fe=a.contextType;w=Rs,typeof fe=="object"&&fe!==null&&(w=Sn(fe));var pe=a.getDerivedStateFromProps;fe=typeof pe=="function"||typeof p.getSnapshotBeforeUpdate=="function",k=i.pendingProps!==k,fe||typeof p.UNSAFE_componentWillReceiveProps!="function"&&typeof p.componentWillReceiveProps!="function"||(k||ne!==w)&&ng(i,p,o,w),ki=!1;var ie=i.memoizedState;p.state=ie,Ya(i,o,p,h),Va(),ne=i.memoizedState,k||ie!==ne||ki?(typeof pe=="function"&&(hf(i,a,pe,o),ne=i.memoizedState),(H=ki||tg(i,a,H,o,ie,ne,w))?(fe||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=ne),p.props=o,p.state=ne,p.context=w,o=H):(typeof p.componentDidMount=="function"&&(i.flags|=4194308),o=!1)}else{p=i.stateNode,Ic(n,i),w=i.memoizedProps,fe=ds(a,w),p.props=fe,pe=i.pendingProps,ie=p.context,ne=a.contextType,H=Rs,typeof ne=="object"&&ne!==null&&(H=Sn(ne)),k=a.getDerivedStateFromProps,(ne=typeof k=="function"||typeof p.getSnapshotBeforeUpdate=="function")||typeof p.UNSAFE_componentWillReceiveProps!="function"&&typeof p.componentWillReceiveProps!="function"||(w!==pe||ie!==H)&&ng(i,p,o,H),ki=!1,ie=i.memoizedState,p.state=ie,Ya(i,o,p,h),Va();var oe=i.memoizedState;w!==pe||ie!==oe||ki||n!==null&&n.dependencies!==null&&mo(n.dependencies)?(typeof k=="function"&&(hf(i,a,k,o),oe=i.memoizedState),(fe=ki||tg(i,a,fe,o,ie,oe,H)||n!==null&&n.dependencies!==null&&mo(n.dependencies))?(ne||typeof p.UNSAFE_componentWillUpdate!="function"&&typeof p.componentWillUpdate!="function"||(typeof p.componentWillUpdate=="function"&&p.componentWillUpdate(o,oe,H),typeof p.UNSAFE_componentWillUpdate=="function"&&p.UNSAFE_componentWillUpdate(o,oe,H)),typeof p.componentDidUpdate=="function"&&(i.flags|=4),typeof p.getSnapshotBeforeUpdate=="function"&&(i.flags|=1024)):(typeof p.componentDidUpdate!="function"||w===n.memoizedProps&&ie===n.memoizedState||(i.flags|=4),typeof p.getSnapshotBeforeUpdate!="function"||w===n.memoizedProps&&ie===n.memoizedState||(i.flags|=1024),i.memoizedProps=o,i.memoizedState=oe),p.props=o,p.state=oe,p.context=H,o=fe):(typeof p.componentDidUpdate!="function"||w===n.memoizedProps&&ie===n.memoizedState||(i.flags|=4),typeof p.getSnapshotBeforeUpdate!="function"||w===n.memoizedProps&&ie===n.memoizedState||(i.flags|=1024),o=!1)}return p=o,Mo(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=fs(i,n.child,null,h),i.child=fs(i,null,a,h)):_n(n,i,a,h),i.memoizedState=p.state,n=i.child):n=ni(n,i,h),n}function yg(n,i,a,o){return ss(),i.flags|=256,_n(n,i,a,o),i.child}var yf={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function bf(n){return{baseLanes:n,cachePool:ap()}}function xf(n,i,a){return n=n!==null?n.childLanes&~a:0,i&&(n|=tr),n}function bg(n,i,a){var o=i.pendingProps,h=!1,p=(i.flags&128)!==0,w;if((w=p)||(w=n!==null&&n.memoizedState===null?!1:(rn.current&2)!==0),w&&(h=!0,i.flags&=-129),w=(i.flags&32)!==0,i.flags&=-33,n===null){if(ut){if(h?Ai(i):ji(),(n=Bt)?(n=Cy(n,br),n=n!==null&&n.data!=="&"?n:null,n!==null&&(i.memoizedState={dehydrated:n,treeContext:vi!==null?{id:Ur,overflow:Pr}:null,retryLane:536870912,hydrationErrors:null},a=Qm(n),a.return=i,i.child=a,wn=i,Bt=null)):n=null,n===null)throw Si(i);return th(n)?i.lanes=32:i.lanes=536870912,null}var k=o.children;return o=o.fallback,h?(ji(),h=i.mode,k=Do({mode:"hidden",children:k},h),o=is(o,h,a,null),k.return=i,o.return=i,k.sibling=o,i.child=k,o=i.child,o.memoizedState=bf(a),o.childLanes=xf(n,w,a),i.memoizedState=yf,Qa(null,o)):(Ai(i),vf(i,k))}var H=n.memoizedState;if(H!==null&&(k=H.dehydrated,k!==null)){if(p)i.flags&256?(Ai(i),i.flags&=-257,i=wf(n,i,a)):i.memoizedState!==null?(ji(),i.child=n.child,i.flags|=128,i=null):(ji(),k=o.fallback,h=i.mode,o=Do({mode:"visible",children:o.children},h),k=is(k,h,a,null),k.flags|=2,o.return=i,k.return=i,o.sibling=k,i.child=o,fs(i,n.child,null,a),o=i.child,o.memoizedState=bf(a),o.childLanes=xf(n,w,a),i.memoizedState=yf,i=Qa(null,o));else if(Ai(i),th(k)){if(w=k.nextSibling&&k.nextSibling.dataset,w)var ne=w.dgst;w=ne,o=Error(s(419)),o.stack="",o.digest=w,Ba({value:o,source:null,stack:null}),i=wf(n,i,a)}else if(hn||zs(n,i,a,!1),w=(a&n.childLanes)!==0,hn||w){if(w=Dt,w!==null&&(o=Xt(w,a),o!==0&&o!==H.retryLane))throw H.retryLane=o,rs(n,o),Vn(w,n,o),pf;eh(k)||Fo(),i=wf(n,i,a)}else eh(k)?(i.flags|=192,i.child=n.child,i=null):(n=H.treeContext,Bt=vr(k.nextSibling),wn=i,ut=!0,wi=null,br=!1,n!==null&&ep(i,n),i=vf(i,o.children),i.flags|=4096);return i}return h?(ji(),k=o.fallback,h=i.mode,H=n.child,ne=H.sibling,o=Kr(H,{mode:"hidden",children:o.children}),o.subtreeFlags=H.subtreeFlags&65011712,ne!==null?k=Kr(ne,k):(k=is(k,h,a,null),k.flags|=2),k.return=i,o.return=i,o.sibling=k,i.child=o,Qa(null,o),o=i.child,k=n.child.memoizedState,k===null?k=bf(a):(h=k.cachePool,h!==null?(H=cn._currentValue,h=h.parent!==H?{parent:H,pool:H}:h):h=ap(),k={baseLanes:k.baseLanes|a,cachePool:h}),o.memoizedState=k,o.childLanes=xf(n,w,a),i.memoizedState=yf,Qa(n.child,o)):(Ai(i),a=n.child,n=a.sibling,a=Kr(a,{mode:"visible",children:o.children}),a.return=i,a.sibling=null,n!==null&&(w=i.deletions,w===null?(i.deletions=[n],i.flags|=16):w.push(n)),i.child=a,i.memoizedState=null,a)}function vf(n,i){return i=Do({mode:"visible",children:i},n.mode),i.return=n,n.child=i}function Do(n,i){return n=Qn(22,n,null,i),n.lanes=0,n}function wf(n,i,a){return fs(i,n.child,null,a),n=vf(i,i.pendingProps.children),n.flags|=2,i.memoizedState=null,n}function xg(n,i,a){n.lanes|=i;var o=n.alternate;o!==null&&(o.lanes|=i),Lc(n.return,i,a)}function Sf(n,i,a,o,h,p){var w=n.memoizedState;w===null?n.memoizedState={isBackwards:i,rendering:null,renderingStartTime:0,last:o,tail:a,tailMode:h,treeForkCount:p}:(w.isBackwards=i,w.rendering=null,w.renderingStartTime=0,w.last=o,w.tail=a,w.tailMode=h,w.treeForkCount=p)}function vg(n,i,a){var o=i.pendingProps,h=o.revealOrder,p=o.tail;o=o.children;var w=rn.current,k=(w&2)!==0;if(k?(w=w&1|2,i.flags|=128):w&=1,_(rn,w),_n(n,i,o,a),o=ut?Pa:0,!k&&n!==null&&(n.flags&128)!==0)e:for(n=i.child;n!==null;){if(n.tag===13)n.memoizedState!==null&&xg(n,a,i);else if(n.tag===19)xg(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&&So(n)===null&&(h=a),a=a.sibling;a=h,a===null?(h=i.child,i.child=null):(h=a.sibling,a.sibling=null),Sf(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&&So(n)===null){i.child=h;break}n=h.sibling,h.sibling=a,a=h,h=n}Sf(i,!0,a,null,p,o);break;case"together":Sf(i,!1,null,null,void 0,o);break;default:i.memoizedState=null}return i.child}function ni(n,i,a){if(n!==null&&(i.dependencies=n.dependencies),Oi|=i.lanes,(a&i.childLanes)===0)if(n!==null){if(zs(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=Kr(n,n.pendingProps),i.child=a,a.return=i;n.sibling!==null;)n=n.sibling,a=a.sibling=Kr(n,n.pendingProps),a.return=i;a.sibling=null}return i.child}function _f(n,i){return(n.lanes&i)!==0?!0:(n=n.dependencies,!!(n!==null&&mo(n)))}function nw(n,i,a){switch(i.tag){case 3:Ve(i,i.stateNode.containerInfo),_i(i,cn,n.memoizedState.cache),ss();break;case 27:case 5:dt(i);break;case 4:Ve(i,i.stateNode.containerInfo);break;case 10:_i(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?(Ai(i),i.flags|=128,null):(a&i.child.childLanes)!==0?bg(n,i,a):(Ai(i),n=ni(n,i,a),n!==null?n.sibling:null);Ai(i);break;case 19:var h=(n.flags&128)!==0;if(o=(a&i.childLanes)!==0,o||(zs(n,i,a,!1),o=(a&i.childLanes)!==0),h){if(o)return vg(n,i,a);i.flags|=128}if(h=i.memoizedState,h!==null&&(h.rendering=null,h.tail=null,h.lastEffect=null),_(rn,rn.current),o)break;return null;case 22:return i.lanes=0,hg(n,i,a,i.pendingProps);case 24:_i(i,cn,n.memoizedState.cache)}return ni(n,i,a)}function wg(n,i,a){if(n!==null)if(n.memoizedProps!==i.pendingProps)hn=!0;else{if(!_f(n,a)&&(i.flags&128)===0)return hn=!1,nw(n,i,a);hn=(n.flags&131072)!==0}else hn=!1,ut&&(i.flags&1048576)!==0&&Wm(i,Pa,i.index);switch(i.lanes=0,i.tag){case 16:e:{var o=i.pendingProps;if(n=us(i.elementType),i.type=n,typeof n=="function")Ac(n)?(o=ds(n,o),i.tag=1,i=gg(null,i,n,o,a)):(i.tag=0,i=gf(null,i,n,o,a));else{if(n!=null){var h=n.$$typeof;if(h===W){i.tag=11,i=ug(null,i,n,o,a);break e}else if(h===Z){i.tag=14,i=cg(null,i,n,o,a);break e}}throw i=le(n)||n,Error(s(306,i,""))}}return i;case 0:return gf(n,i,i.type,i.pendingProps,a);case 1:return o=i.type,h=ds(o,i.pendingProps),gg(n,i,o,h,a);case 3:e:{if(Ve(i,i.stateNode.containerInfo),n===null)throw Error(s(387));o=i.pendingProps;var p=i.memoizedState;h=p.element,Ic(n,i),Ya(i,o,null,a);var w=i.memoizedState;if(o=w.cache,_i(i,cn,o),o!==p.cache&&zc(i,[cn],a,!0),Va(),o=w.element,p.isDehydrated)if(p={element:o,isDehydrated:!1,cache:w.cache},i.updateQueue.baseState=p,i.memoizedState=p,i.flags&256){i=yg(n,i,o,a);break e}else if(o!==h){h=pr(Error(s(424)),i),Ba(h),i=yg(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(Bt=vr(n.firstChild),wn=i,ut=!0,wi=null,br=!0,a=hp(i,null,o,a),i.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling}else{if(ss(),o===h){i=ni(n,i,a);break e}_n(n,i,o,a)}i=i.child}return i;case 26:return Mo(n,i),n===null?(a=Ry(i.type,null,i.pendingProps,null))?i.memoizedState=a:ut||(a=i.type,n=i.pendingProps,o=Ko(we.current).createElement(a),o[wt]=i,o[Zt]=n,kn(o,a,n),Y(o),i.stateNode=o):i.memoizedState=Ry(i.type,n.memoizedProps,i.pendingProps,n.memoizedState),null;case 27:return dt(i),n===null&&ut&&(o=i.stateNode=Ny(i.type,i.pendingProps,we.current),wn=i,br=!0,h=Bt,zi(i.type)?(nh=h,Bt=vr(o.firstChild)):Bt=h),_n(n,i,i.pendingProps.children,a),Mo(n,i),n===null&&(i.flags|=4194304),i.child;case 5:return n===null&&ut&&((h=o=Bt)&&(o=Rw(o,i.type,i.pendingProps,br),o!==null?(i.stateNode=o,wn=i,Bt=vr(o.firstChild),br=!1,h=!0):h=!1),h||Si(i)),dt(i),h=i.type,p=i.pendingProps,w=n!==null?n.memoizedProps:null,o=p.children,Qf(h,p)?o=null:w!==null&&Qf(h,w)&&(i.flags|=32),i.memoizedState!==null&&(h=Xc(n,i,Gv,null,null,a),hl._currentValue=h),Mo(n,i),_n(n,i,o,a),i.child;case 6:return n===null&&ut&&((n=a=Bt)&&(a=Mw(a,i.pendingProps,br),a!==null?(i.stateNode=a,wn=i,Bt=null,n=!0):n=!1),n||Si(i)),null;case 13:return bg(n,i,a);case 4:return Ve(i,i.stateNode.containerInfo),o=i.pendingProps,n===null?i.child=fs(i,null,o,a):_n(n,i,o,a),i.child;case 11:return ug(n,i,i.type,i.pendingProps,a);case 7:return _n(n,i,i.pendingProps,a),i.child;case 8:return _n(n,i,i.pendingProps.children,a),i.child;case 12:return _n(n,i,i.pendingProps.children,a),i.child;case 10:return o=i.pendingProps,_i(i,i.type,o.value),_n(n,i,o.children,a),i.child;case 9:return h=i.type._context,o=i.pendingProps.children,ls(i),h=Sn(h),o=o(h),i.flags|=1,_n(n,i,o,a),i.child;case 14:return cg(n,i,i.type,i.pendingProps,a);case 15:return fg(n,i,i.type,i.pendingProps,a);case 19:return vg(n,i,a);case 31:return tw(n,i,a);case 22:return hg(n,i,a,i.pendingProps);case 24:return ls(i),o=Sn(cn),n===null?(h=Bc(),h===null&&(h=Dt,p=Uc(),h.pooledCache=p,p.refCount++,p!==null&&(h.pooledCacheLanes|=a),h=p),i.memoizedState={parent:o,cache:h},qc(i),_i(i,cn,h)):((n.lanes&a)!==0&&(Ic(n,i),Ya(i,null,null,a),Va()),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),_i(i,cn,o)):(o=p.cache,_i(i,cn,o),o!==h.cache&&zc(i,[cn],a,!0))),_n(n,i,i.pendingProps.children,a),i.child;case 29:throw i.pendingProps}throw Error(s(156,i.tag))}function ri(n){n.flags|=4}function kf(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(Jg())n.flags|=8192;else throw cs=bo,Hc}else n.flags&=-16777217}function Sg(n,i){if(i.type!=="stylesheet"||(i.state.loading&4)!==0)n.flags&=-16777217;else if(n.flags|=16777216,!Uy(i))if(Jg())n.flags|=8192;else throw cs=bo,Hc}function Lo(n,i){i!==null&&(n.flags|=4),n.flags&16384&&(i=n.tag!==22?We():536870912,n.lanes|=i,Js|=i)}function Za(n,i){if(!ut)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 Ht(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 rw(n,i,a){var o=i.pendingProps;switch(Oc(i),i.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ht(i),null;case 1:return Ht(i),null;case 3:return a=i.stateNode,o=null,n!==null&&(o=n.memoizedState.cache),i.memoizedState.cache!==o&&(i.flags|=2048),Wr(cn),Ae(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(n===null||n.child===null)&&(Ls(i)?ri(i):n===null||n.memoizedState.isDehydrated&&(i.flags&256)===0||(i.flags|=1024,Mc())),Ht(i),null;case 26:var h=i.type,p=i.memoizedState;return n===null?(ri(i),p!==null?(Ht(i),Sg(i,p)):(Ht(i),kf(i,h,null,o,a))):p?p!==n.memoizedState?(ri(i),Ht(i),Sg(i,p)):(Ht(i),i.flags&=-16777217):(n=n.memoizedProps,n!==o&&ri(i),Ht(i),kf(i,h,n,o,a)),null;case 27:if(qt(i),a=we.current,h=i.type,n!==null&&i.stateNode!=null)n.memoizedProps!==o&&ri(i);else{if(!o){if(i.stateNode===null)throw Error(s(166));return Ht(i),null}n=ge.current,Ls(i)?tp(i):(n=Ny(h,o,a),i.stateNode=n,ri(i))}return Ht(i),null;case 5:if(qt(i),h=i.type,n!==null&&i.stateNode!=null)n.memoizedProps!==o&&ri(i);else{if(!o){if(i.stateNode===null)throw Error(s(166));return Ht(i),null}if(p=ge.current,Ls(i))tp(i);else{var w=Ko(we.current);switch(p){case 1:p=w.createElementNS("http://www.w3.org/2000/svg",h);break;case 2:p=w.createElementNS("http://www.w3.org/1998/Math/MathML",h);break;default:switch(h){case"svg":p=w.createElementNS("http://www.w3.org/2000/svg",h);break;case"math":p=w.createElementNS("http://www.w3.org/1998/Math/MathML",h);break;case"script":p=w.createElement("div"),p.innerHTML="<script><\/script>",p=p.removeChild(p.firstChild);break;case"select":p=typeof o.is=="string"?w.createElement("select",{is:o.is}):w.createElement("select"),o.multiple?p.multiple=!0:o.size&&(p.size=o.size);break;default:p=typeof o.is=="string"?w.createElement(h,{is:o.is}):w.createElement(h)}}p[wt]=i,p[Zt]=o;e:for(w=i.child;w!==null;){if(w.tag===5||w.tag===6)p.appendChild(w.stateNode);else if(w.tag!==4&&w.tag!==27&&w.child!==null){w.child.return=w,w=w.child;continue}if(w===i)break e;for(;w.sibling===null;){if(w.return===null||w.return===i)break e;w=w.return}w.sibling.return=w.return,w=w.sibling}i.stateNode=p;e:switch(kn(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&&ri(i)}}return Ht(i),kf(i,i.type,n===null?null:n.memoizedProps,i.pendingProps,a),null;case 6:if(n&&i.stateNode!=null)n.memoizedProps!==o&&ri(i);else{if(typeof o!="string"&&i.stateNode===null)throw Error(s(166));if(n=we.current,Ls(i)){if(n=i.stateNode,a=i.memoizedProps,o=null,h=wn,h!==null)switch(h.tag){case 27:case 5:o=h.memoizedProps}n[wt]=i,n=!!(n.nodeValue===a||o!==null&&o.suppressHydrationWarning===!0||by(n.nodeValue,a)),n||Si(i,!0)}else n=Ko(n).createTextNode(o),n[wt]=i,i.stateNode=n}return Ht(i),null;case 31:if(a=i.memoizedState,n===null||n.memoizedState!==null){if(o=Ls(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[wt]=i}else ss(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;Ht(i),n=!1}else a=Mc(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=a),n=!0;if(!n)return i.flags&256?(Wn(i),i):(Wn(i),null);if((i.flags&128)!==0)throw Error(s(558))}return Ht(i),null;case 13:if(o=i.memoizedState,n===null||n.memoizedState!==null&&n.memoizedState.dehydrated!==null){if(h=Ls(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[wt]=i}else ss(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;Ht(i),h=!1}else h=Mc(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=h),h=!0;if(!h)return i.flags&256?(Wn(i),i):(Wn(i),null)}return Wn(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),Lo(i,i.updateQueue),Ht(i),null);case 4:return Ae(),n===null&&Yf(i.stateNode.containerInfo),Ht(i),null;case 10:return Wr(i.type),Ht(i),null;case 19:if(ee(rn),o=i.memoizedState,o===null)return Ht(i),null;if(h=(i.flags&128)!==0,p=o.rendering,p===null)if(h)Za(o,!1);else{if(en!==0||n!==null&&(n.flags&128)!==0)for(n=i.child;n!==null;){if(p=So(n),p!==null){for(i.flags|=128,Za(o,!1),n=p.updateQueue,i.updateQueue=n,Lo(i,n),i.subtreeFlags=0,n=a,a=i.child;a!==null;)Km(a,n),a=a.sibling;return _(rn,rn.current&1|2),ut&&Qr(i,o.treeForkCount),i.child}n=n.sibling}o.tail!==null&&$e()>Ho&&(i.flags|=128,h=!0,Za(o,!1),i.lanes=4194304)}else{if(!h)if(n=So(p),n!==null){if(i.flags|=128,h=!0,n=n.updateQueue,i.updateQueue=n,Lo(i,n),Za(o,!0),o.tail===null&&o.tailMode==="hidden"&&!p.alternate&&!ut)return Ht(i),null}else 2*$e()-o.renderingStartTime>Ho&&a!==536870912&&(i.flags|=128,h=!0,Za(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=$e(),n.sibling=null,a=rn.current,_(rn,h?a&1|2:a&1),ut&&Qr(i,o.treeForkCount),n):(Ht(i),null);case 22:case 23:return Wn(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&&(Ht(i),i.subtreeFlags&6&&(i.flags|=8192)):Ht(i),a=i.updateQueue,a!==null&&Lo(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&&ee(os),null;case 24:return a=null,n!==null&&(a=n.memoizedState.cache),i.memoizedState.cache!==a&&(i.flags|=2048),Wr(cn),Ht(i),null;case 25:return null;case 30:return null}throw Error(s(156,i.tag))}function iw(n,i){switch(Oc(i),i.tag){case 1:return n=i.flags,n&65536?(i.flags=n&-65537|128,i):null;case 3:return Wr(cn),Ae(),n=i.flags,(n&65536)!==0&&(n&128)===0?(i.flags=n&-65537|128,i):null;case 26:case 27:case 5:return qt(i),null;case 31:if(i.memoizedState!==null){if(Wn(i),i.alternate===null)throw Error(s(340));ss()}return n=i.flags,n&65536?(i.flags=n&-65537|128,i):null;case 13:if(Wn(i),n=i.memoizedState,n!==null&&n.dehydrated!==null){if(i.alternate===null)throw Error(s(340));ss()}return n=i.flags,n&65536?(i.flags=n&-65537|128,i):null;case 19:return ee(rn),null;case 4:return Ae(),null;case 10:return Wr(i.type),null;case 22:case 23:return Wn(i),Yc(),n!==null&&ee(os),n=i.flags,n&65536?(i.flags=n&-65537|128,i):null;case 24:return Wr(cn),null;case 25:return null;default:return null}}function _g(n,i){switch(Oc(i),i.tag){case 3:Wr(cn),Ae();break;case 26:case 27:case 5:qt(i);break;case 4:Ae();break;case 31:i.memoizedState!==null&&Wn(i);break;case 13:Wn(i);break;case 19:ee(rn);break;case 10:Wr(i.type);break;case 22:case 23:Wn(i),Yc(),n!==null&&ee(os);break;case 24:Wr(cn)}}function Wa(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,w=a.inst;o=p(),w.destroy=o}a=a.next}while(a!==h)}}catch(k){Et(i,i.return,k)}}function Ni(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 w=o.inst,k=w.destroy;if(k!==void 0){w.destroy=void 0,h=i;var H=a,ne=k;try{ne()}catch(fe){Et(h,H,fe)}}}o=o.next}while(o!==p)}}catch(fe){Et(i,i.return,fe)}}function kg(n){var i=n.updateQueue;if(i!==null){var a=n.stateNode;try{mp(i,a)}catch(o){Et(n,n.return,o)}}}function Eg(n,i,a){a.props=ds(n.type,n.memoizedProps),a.state=n.memoizedState;try{a.componentWillUnmount()}catch(o){Et(n,i,o)}}function el(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){Et(n,i,h)}}function Br(n,i){var a=n.ref,o=n.refCleanup;if(a!==null)if(typeof o=="function")try{o()}catch(h){Et(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){Et(n,i,h)}else a.current=null}function Cg(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){Et(n,n.return,h)}}function Ef(n,i,a){try{var o=n.stateNode;Cw(o,n.type,a,i),o[Zt]=i}catch(h){Et(n,n.return,h)}}function Ag(n){return n.tag===5||n.tag===3||n.tag===26||n.tag===27&&zi(n.type)||n.tag===4}function Cf(n){e:for(;;){for(;n.sibling===null;){if(n.return===null||Ag(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&&zi(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 Af(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=Jr));else if(o!==4&&(o===27&&zi(n.type)&&(a=n.stateNode,i=null),n=n.child,n!==null))for(Af(n,i,a),n=n.sibling;n!==null;)Af(n,i,a),n=n.sibling}function zo(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&&zi(n.type)&&(a=n.stateNode),n=n.child,n!==null))for(zo(n,i,a),n=n.sibling;n!==null;)zo(n,i,a),n=n.sibling}function jg(n){var i=n.stateNode,a=n.memoizedProps;try{for(var o=n.type,h=i.attributes;h.length;)i.removeAttributeNode(h[0]);kn(i,o,a),i[wt]=n,i[Zt]=a}catch(p){Et(n,n.return,p)}}var ii=!1,dn=!1,jf=!1,Ng=typeof WeakSet=="function"?WeakSet:Set,yn=null;function sw(n,i){if(n=n.containerInfo,Xf=ru,n=qm(n),vc(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 w=0,k=-1,H=-1,ne=0,fe=0,pe=n,ie=null;t:for(;;){for(var oe;pe!==a||h!==0&&pe.nodeType!==3||(k=w+h),pe!==p||o!==0&&pe.nodeType!==3||(H=w+o),pe.nodeType===3&&(w+=pe.nodeValue.length),(oe=pe.firstChild)!==null;)ie=pe,pe=oe;for(;;){if(pe===n)break t;if(ie===a&&++ne===h&&(k=w),ie===p&&++fe===o&&(H=w),(oe=pe.nextSibling)!==null)break;pe=ie,ie=pe.parentNode}pe=oe}a=k===-1||H===-1?null:{start:k,end:H}}else a=null}a=a||{start:0,end:0}}else a=null;for(Kf={focusedElem:n,selectionRange:a},ru=!1,yn=i;yn!==null;)if(i=yn,n=i.child,(i.subtreeFlags&1028)!==0&&n!==null)n.return=i,yn=n;else for(;yn!==null;){switch(i=yn,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 De=ds(a.type,h);n=o.getSnapshotBeforeUpdate(De,p),o.__reactInternalSnapshotBeforeUpdate=n}catch(qe){Et(a,a.return,qe)}}break;case 3:if((n&1024)!==0){if(n=i.stateNode.containerInfo,a=n.nodeType,a===9)Wf(n);else if(a===1)switch(n.nodeName){case"HEAD":case"HTML":case"BODY":Wf(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,yn=n;break}yn=i.return}}function Tg(n,i,a){var o=a.flags;switch(a.tag){case 0:case 11:case 15:ai(n,a),o&4&&Wa(5,a);break;case 1:if(ai(n,a),o&4)if(n=a.stateNode,i===null)try{n.componentDidMount()}catch(w){Et(a,a.return,w)}else{var h=ds(a.type,i.memoizedProps);i=i.memoizedState;try{n.componentDidUpdate(h,i,n.__reactInternalSnapshotBeforeUpdate)}catch(w){Et(a,a.return,w)}}o&64&&kg(a),o&512&&el(a,a.return);break;case 3:if(ai(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{mp(n,i)}catch(w){Et(a,a.return,w)}}break;case 27:i===null&&o&4&&jg(a);case 26:case 5:ai(n,a),i===null&&o&4&&Cg(a),o&512&&el(a,a.return);break;case 12:ai(n,a);break;case 31:ai(n,a),o&4&&Mg(n,a);break;case 13:ai(n,a),o&4&&Dg(n,a),o&64&&(n=a.memoizedState,n!==null&&(n=n.dehydrated,n!==null&&(a=mw.bind(null,a),Dw(n,a))));break;case 22:if(o=a.memoizedState!==null||ii,!o){i=i!==null&&i.memoizedState!==null||dn,h=ii;var p=dn;ii=o,(dn=i)&&!p?li(n,a,(a.subtreeFlags&8772)!==0):ai(n,a),ii=h,dn=p}break;case 30:break;default:ai(n,a)}}function Og(n){var i=n.alternate;i!==null&&(n.alternate=null,Og(i)),n.child=null,n.deletions=null,n.sibling=null,n.tag===5&&(i=n.stateNode,i!==null&&_s(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 Ft=null,qn=!1;function si(n,i,a){for(a=a.child;a!==null;)Rg(n,i,a),a=a.sibling}function Rg(n,i,a){if(xt&&typeof xt.onCommitFiberUnmount=="function")try{xt.onCommitFiberUnmount(Ct,a)}catch{}switch(a.tag){case 26:dn||Br(a,i),si(n,i,a),a.memoizedState?a.memoizedState.count--:a.stateNode&&(a=a.stateNode,a.parentNode.removeChild(a));break;case 27:dn||Br(a,i);var o=Ft,h=qn;zi(a.type)&&(Ft=a.stateNode,qn=!1),si(n,i,a),ul(a.stateNode),Ft=o,qn=h;break;case 5:dn||Br(a,i);case 6:if(o=Ft,h=qn,Ft=null,si(n,i,a),Ft=o,qn=h,Ft!==null)if(qn)try{(Ft.nodeType===9?Ft.body:Ft.nodeName==="HTML"?Ft.ownerDocument.body:Ft).removeChild(a.stateNode)}catch(p){Et(a,i,p)}else try{Ft.removeChild(a.stateNode)}catch(p){Et(a,i,p)}break;case 18:Ft!==null&&(qn?(n=Ft,ky(n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n,a.stateNode),na(n)):ky(Ft,a.stateNode));break;case 4:o=Ft,h=qn,Ft=a.stateNode.containerInfo,qn=!0,si(n,i,a),Ft=o,qn=h;break;case 0:case 11:case 14:case 15:Ni(2,a,i),dn||Ni(4,a,i),si(n,i,a);break;case 1:dn||(Br(a,i),o=a.stateNode,typeof o.componentWillUnmount=="function"&&Eg(a,i,o)),si(n,i,a);break;case 21:si(n,i,a);break;case 22:dn=(o=dn)||a.memoizedState!==null,si(n,i,a),dn=o;break;default:si(n,i,a)}}function Mg(n,i){if(i.memoizedState===null&&(n=i.alternate,n!==null&&(n=n.memoizedState,n!==null))){n=n.dehydrated;try{na(n)}catch(a){Et(i,i.return,a)}}}function Dg(n,i){if(i.memoizedState===null&&(n=i.alternate,n!==null&&(n=n.memoizedState,n!==null&&(n=n.dehydrated,n!==null))))try{na(n)}catch(a){Et(i,i.return,a)}}function aw(n){switch(n.tag){case 31:case 13:case 19:var i=n.stateNode;return i===null&&(i=n.stateNode=new Ng),i;case 22:return n=n.stateNode,i=n._retryCache,i===null&&(i=n._retryCache=new Ng),i;default:throw Error(s(435,n.tag))}}function Uo(n,i){var a=aw(n);i.forEach(function(o){if(!a.has(o)){a.add(o);var h=pw.bind(null,n,o);o.then(h,h)}})}function In(n,i){var a=i.deletions;if(a!==null)for(var o=0;o<a.length;o++){var h=a[o],p=n,w=i,k=w;e:for(;k!==null;){switch(k.tag){case 27:if(zi(k.type)){Ft=k.stateNode,qn=!1;break e}break;case 5:Ft=k.stateNode,qn=!1;break e;case 3:case 4:Ft=k.stateNode.containerInfo,qn=!0;break e}k=k.return}if(Ft===null)throw Error(s(160));Rg(p,w,h),Ft=null,qn=!1,p=h.alternate,p!==null&&(p.return=null),h.return=null}if(i.subtreeFlags&13886)for(i=i.child;i!==null;)Lg(i,n),i=i.sibling}var jr=null;function Lg(n,i){var a=n.alternate,o=n.flags;switch(n.tag){case 0:case 11:case 14:case 15:In(i,n),Fn(n),o&4&&(Ni(3,n,n.return),Wa(3,n),Ni(5,n,n.return));break;case 1:In(i,n),Fn(n),o&512&&(dn||a===null||Br(a,a.return)),o&64&&ii&&(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=jr;if(In(i,n),Fn(n),o&512&&(dn||a===null||Br(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[pn]||p[wt]||p.namespaceURI==="http://www.w3.org/2000/svg"||p.hasAttribute("itemprop"))&&(p=h.createElement(o),h.head.insertBefore(p,h.querySelector("head > title"))),kn(p,o,a),p[wt]=n,Y(p),o=p;break e;case"link":var w=Ly("link","href",h).get(o+(a.href||""));if(w){for(var k=0;k<w.length;k++)if(p=w[k],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)){w.splice(k,1);break t}}p=h.createElement(o),kn(p,o,a),h.head.appendChild(p);break;case"meta":if(w=Ly("meta","content",h).get(o+(a.content||""))){for(k=0;k<w.length;k++)if(p=w[k],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)){w.splice(k,1);break t}}p=h.createElement(o),kn(p,o,a),h.head.appendChild(p);break;default:throw Error(s(468,o))}p[wt]=n,Y(p),o=p}n.stateNode=o}else zy(h,n.type,n.stateNode);else n.stateNode=Dy(h,o,n.memoizedProps);else p!==o?(p===null?a.stateNode!==null&&(a=a.stateNode,a.parentNode.removeChild(a)):p.count--,o===null?zy(h,n.type,n.stateNode):Dy(h,o,n.memoizedProps)):o===null&&n.stateNode!==null&&Ef(n,n.memoizedProps,a.memoizedProps)}break;case 27:In(i,n),Fn(n),o&512&&(dn||a===null||Br(a,a.return)),a!==null&&o&4&&Ef(n,n.memoizedProps,a.memoizedProps);break;case 5:if(In(i,n),Fn(n),o&512&&(dn||a===null||Br(a,a.return)),n.flags&32){h=n.stateNode;try{Es(h,"")}catch(De){Et(n,n.return,De)}}o&4&&n.stateNode!=null&&(h=n.memoizedProps,Ef(n,h,a!==null?a.memoizedProps:h)),o&1024&&(jf=!0);break;case 6:if(In(i,n),Fn(n),o&4){if(n.stateNode===null)throw Error(s(162));o=n.memoizedProps,a=n.stateNode;try{a.nodeValue=o}catch(De){Et(n,n.return,De)}}break;case 3:if(Wo=null,h=jr,jr=Qo(i.containerInfo),In(i,n),jr=h,Fn(n),o&4&&a!==null&&a.memoizedState.isDehydrated)try{na(i.containerInfo)}catch(De){Et(n,n.return,De)}jf&&(jf=!1,zg(n));break;case 4:o=jr,jr=Qo(n.stateNode.containerInfo),In(i,n),Fn(n),jr=o;break;case 12:In(i,n),Fn(n);break;case 31:In(i,n),Fn(n),o&4&&(o=n.updateQueue,o!==null&&(n.updateQueue=null,Uo(n,o)));break;case 13:In(i,n),Fn(n),n.child.flags&8192&&n.memoizedState!==null!=(a!==null&&a.memoizedState!==null)&&(Bo=$e()),o&4&&(o=n.updateQueue,o!==null&&(n.updateQueue=null,Uo(n,o)));break;case 22:h=n.memoizedState!==null;var H=a!==null&&a.memoizedState!==null,ne=ii,fe=dn;if(ii=ne||h,dn=fe||H,In(i,n),dn=fe,ii=ne,Fn(n),o&8192)e:for(i=n.stateNode,i._visibility=h?i._visibility&-2:i._visibility|1,h&&(a===null||H||ii||dn||ms(n)),a=null,i=n;;){if(i.tag===5||i.tag===26){if(a===null){H=a=i;try{if(p=H.stateNode,h)w=p.style,typeof w.setProperty=="function"?w.setProperty("display","none","important"):w.display="none";else{k=H.stateNode;var pe=H.memoizedProps.style,ie=pe!=null&&pe.hasOwnProperty("display")?pe.display:null;k.style.display=ie==null||typeof ie=="boolean"?"":(""+ie).trim()}}catch(De){Et(H,H.return,De)}}}else if(i.tag===6){if(a===null){H=i;try{H.stateNode.nodeValue=h?"":H.memoizedProps}catch(De){Et(H,H.return,De)}}}else if(i.tag===18){if(a===null){H=i;try{var oe=H.stateNode;h?Ey(oe,!0):Ey(H.stateNode,!1)}catch(De){Et(H,H.return,De)}}}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,Uo(n,a))));break;case 19:In(i,n),Fn(n),o&4&&(o=n.updateQueue,o!==null&&(n.updateQueue=null,Uo(n,o)));break;case 30:break;case 21:break;default:In(i,n),Fn(n)}}function Fn(n){var i=n.flags;if(i&2){try{for(var a,o=n.return;o!==null;){if(Ag(o)){a=o;break}o=o.return}if(a==null)throw Error(s(160));switch(a.tag){case 27:var h=a.stateNode,p=Cf(n);zo(n,p,h);break;case 5:var w=a.stateNode;a.flags&32&&(Es(w,""),a.flags&=-33);var k=Cf(n);zo(n,k,w);break;case 3:case 4:var H=a.stateNode.containerInfo,ne=Cf(n);Af(n,ne,H);break;default:throw Error(s(161))}}catch(fe){Et(n,n.return,fe)}n.flags&=-3}i&4096&&(n.flags&=-4097)}function zg(n){if(n.subtreeFlags&1024)for(n=n.child;n!==null;){var i=n;zg(i),i.tag===5&&i.flags&1024&&i.stateNode.reset(),n=n.sibling}}function ai(n,i){if(i.subtreeFlags&8772)for(i=i.child;i!==null;)Tg(n,i.alternate,i),i=i.sibling}function ms(n){for(n=n.child;n!==null;){var i=n;switch(i.tag){case 0:case 11:case 14:case 15:Ni(4,i,i.return),ms(i);break;case 1:Br(i,i.return);var a=i.stateNode;typeof a.componentWillUnmount=="function"&&Eg(i,i.return,a),ms(i);break;case 27:ul(i.stateNode);case 26:case 5:Br(i,i.return),ms(i);break;case 22:i.memoizedState===null&&ms(i);break;case 30:ms(i);break;default:ms(i)}n=n.sibling}}function li(n,i,a){for(a=a&&(i.subtreeFlags&8772)!==0,i=i.child;i!==null;){var o=i.alternate,h=n,p=i,w=p.flags;switch(p.tag){case 0:case 11:case 15:li(h,p,a),Wa(4,p);break;case 1:if(li(h,p,a),o=p,h=o.stateNode,typeof h.componentDidMount=="function")try{h.componentDidMount()}catch(ne){Et(o,o.return,ne)}if(o=p,h=o.updateQueue,h!==null){var k=o.stateNode;try{var H=h.shared.hiddenCallbacks;if(H!==null)for(h.shared.hiddenCallbacks=null,h=0;h<H.length;h++)dp(H[h],k)}catch(ne){Et(o,o.return,ne)}}a&&w&64&&kg(p),el(p,p.return);break;case 27:jg(p);case 26:case 5:li(h,p,a),a&&o===null&&w&4&&Cg(p),el(p,p.return);break;case 12:li(h,p,a);break;case 31:li(h,p,a),a&&w&4&&Mg(h,p);break;case 13:li(h,p,a),a&&w&4&&Dg(h,p);break;case 22:p.memoizedState===null&&li(h,p,a),el(p,p.return);break;case 30:break;default:li(h,p,a)}i=i.sibling}}function Nf(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&&Ha(a))}function Tf(n,i){n=null,i.alternate!==null&&(n=i.alternate.memoizedState.cache),i=i.memoizedState.cache,i!==n&&(i.refCount++,n!=null&&Ha(n))}function Nr(n,i,a,o){if(i.subtreeFlags&10256)for(i=i.child;i!==null;)Ug(n,i,a,o),i=i.sibling}function Ug(n,i,a,o){var h=i.flags;switch(i.tag){case 0:case 11:case 15:Nr(n,i,a,o),h&2048&&Wa(9,i);break;case 1:Nr(n,i,a,o);break;case 3:Nr(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&&Ha(n)));break;case 12:if(h&2048){Nr(n,i,a,o),n=i.stateNode;try{var p=i.memoizedProps,w=p.id,k=p.onPostCommit;typeof k=="function"&&k(w,i.alternate===null?"mount":"update",n.passiveEffectDuration,-0)}catch(H){Et(i,i.return,H)}}else Nr(n,i,a,o);break;case 31:Nr(n,i,a,o);break;case 13:Nr(n,i,a,o);break;case 23:break;case 22:p=i.stateNode,w=i.alternate,i.memoizedState!==null?p._visibility&2?Nr(n,i,a,o):tl(n,i):p._visibility&2?Nr(n,i,a,o):(p._visibility|=2,Vs(n,i,a,o,(i.subtreeFlags&10256)!==0||!1)),h&2048&&Nf(w,i);break;case 24:Nr(n,i,a,o),h&2048&&Tf(i.alternate,i);break;default:Nr(n,i,a,o)}}function Vs(n,i,a,o,h){for(h=h&&((i.subtreeFlags&10256)!==0||!1),i=i.child;i!==null;){var p=n,w=i,k=a,H=o,ne=w.flags;switch(w.tag){case 0:case 11:case 15:Vs(p,w,k,H,h),Wa(8,w);break;case 23:break;case 22:var fe=w.stateNode;w.memoizedState!==null?fe._visibility&2?Vs(p,w,k,H,h):tl(p,w):(fe._visibility|=2,Vs(p,w,k,H,h)),h&&ne&2048&&Nf(w.alternate,w);break;case 24:Vs(p,w,k,H,h),h&&ne&2048&&Tf(w.alternate,w);break;default:Vs(p,w,k,H,h)}i=i.sibling}}function tl(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:tl(a,o),h&2048&&Nf(o.alternate,o);break;case 24:tl(a,o),h&2048&&Tf(o.alternate,o);break;default:tl(a,o)}i=i.sibling}}var nl=8192;function Ys(n,i,a){if(n.subtreeFlags&nl)for(n=n.child;n!==null;)Pg(n,i,a),n=n.sibling}function Pg(n,i,a){switch(n.tag){case 26:Ys(n,i,a),n.flags&nl&&n.memoizedState!==null&&Yw(a,jr,n.memoizedState,n.memoizedProps);break;case 5:Ys(n,i,a);break;case 3:case 4:var o=jr;jr=Qo(n.stateNode.containerInfo),Ys(n,i,a),jr=o;break;case 22:n.memoizedState===null&&(o=n.alternate,o!==null&&o.memoizedState!==null?(o=nl,nl=16777216,Ys(n,i,a),nl=o):Ys(n,i,a));break;default:Ys(n,i,a)}}function Bg(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 rl(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];yn=o,qg(o,n)}Bg(n)}if(n.subtreeFlags&10256)for(n=n.child;n!==null;)Hg(n),n=n.sibling}function Hg(n){switch(n.tag){case 0:case 11:case 15:rl(n),n.flags&2048&&Ni(9,n,n.return);break;case 3:rl(n);break;case 12:rl(n);break;case 22:var i=n.stateNode;n.memoizedState!==null&&i._visibility&2&&(n.return===null||n.return.tag!==13)?(i._visibility&=-3,Po(n)):rl(n);break;default:rl(n)}}function Po(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];yn=o,qg(o,n)}Bg(n)}for(n=n.child;n!==null;){switch(i=n,i.tag){case 0:case 11:case 15:Ni(8,i,i.return),Po(i);break;case 22:a=i.stateNode,a._visibility&2&&(a._visibility&=-3,Po(i));break;default:Po(i)}n=n.sibling}}function qg(n,i){for(;yn!==null;){var a=yn;switch(a.tag){case 0:case 11:case 15:Ni(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:Ha(a.memoizedState.cache)}if(o=a.child,o!==null)o.return=a,yn=o;else e:for(a=n;yn!==null;){o=yn;var h=o.sibling,p=o.return;if(Og(o),o===a){yn=null;break e}if(h!==null){h.return=p,yn=h;break e}yn=p}}}var lw={getCacheForType:function(n){var i=Sn(cn),a=i.data.get(n);return a===void 0&&(a=n(),i.data.set(n,a)),a},cacheSignal:function(){return Sn(cn).controller.signal}},ow=typeof WeakMap=="function"?WeakMap:Map,vt=0,Dt=null,it=null,lt=0,kt=0,er=null,Ti=!1,Gs=!1,Of=!1,oi=0,en=0,Oi=0,ps=0,Rf=0,tr=0,Js=0,il=null,$n=null,Mf=!1,Bo=0,Ig=0,Ho=1/0,qo=null,Ri=null,gn=0,Mi=null,Xs=null,ui=0,Df=0,Lf=null,Fg=null,sl=0,zf=null;function nr(){return(vt&2)!==0&&lt!==0?lt&-lt:$.T!==null?If():Bn()}function $g(){if(tr===0)if((lt&536870912)===0||ut){var n=Qt;Qt<<=1,(Qt&3932160)===0&&(Qt=262144),tr=n}else tr=536870912;return n=Zn.current,n!==null&&(n.flags|=32),tr}function Vn(n,i,a){(n===Dt&&(kt===2||kt===9)||n.cancelPendingCommit!==null)&&(Ks(n,0),Di(n,lt,tr,!1)),ft(n,a),((vt&2)===0||n!==Dt)&&(n===Dt&&((vt&2)===0&&(ps|=a),en===4&&Di(n,lt,tr,!1)),Hr(n))}function Vg(n,i,a){if((vt&6)!==0)throw Error(s(327));var o=!a&&(i&127)===0&&(i&n.expiredLanes)===0||Ee(n,i),h=o?fw(n,i):Pf(n,i,!0),p=o;do{if(h===0){Gs&&!o&&Di(n,i,0,!1);break}else{if(a=n.current.alternate,p&&!uw(a)){h=Pf(n,i,!1),p=!1;continue}if(h===2){if(p=i,n.errorRecoveryDisabledLanes&p)var w=0;else w=n.pendingLanes&-536870913,w=w!==0?w:w&536870912?536870912:0;if(w!==0){i=w;e:{var k=n;h=il;var H=k.current.memoizedState.isDehydrated;if(H&&(Ks(k,w).flags|=256),w=Pf(k,w,!1),w!==2){if(Of&&!H){k.errorRecoveryDisabledLanes|=p,ps|=p,h=4;break e}p=$n,$n=h,p!==null&&($n===null?$n=p:$n.push.apply($n,p))}h=w}if(p=!1,h!==2)continue}}if(h===1){Ks(n,0),Di(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:Di(o,i,tr,!Ti);break e;case 2:$n=null;break;case 3:case 5:break;default:throw Error(s(329))}if((i&62914560)===i&&(h=Bo+300-$e(),10<h)){if(Di(o,i,tr,!Ti),xe(o,0,!0)!==0)break e;ui=i,o.timeoutHandle=Sy(Yg.bind(null,o,a,$n,qo,Mf,i,tr,ps,Js,Ti,p,"Throttled",-0,0),h);break e}Yg(o,a,$n,qo,Mf,i,tr,ps,Js,Ti,p,null,-0,0)}}break}while(!0);Hr(n)}function Yg(n,i,a,o,h,p,w,k,H,ne,fe,pe,ie,oe){if(n.timeoutHandle=-1,pe=i.subtreeFlags,pe&8192||(pe&16785408)===16785408){pe={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Jr},Pg(i,p,pe);var De=(p&62914560)===p?Bo-$e():(p&4194048)===p?Ig-$e():0;if(De=Gw(pe,De),De!==null){ui=p,n.cancelPendingCommit=De(ey.bind(null,n,i,p,a,o,h,w,k,H,fe,pe,null,ie,oe)),Di(n,p,w,!ne);return}}ey(n,i,p,a,o,h,w,k,H)}function uw(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(!Kn(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 Di(n,i,a,o){i&=~Rf,i&=~ps,n.suspendedLanes|=i,n.pingedLanes&=~i,o&&(n.warmLanes|=i),o=n.expirationTimes;for(var h=i;0<h;){var p=31-nt(h),w=1<<p;o[p]=-1,h&=~w}a!==0&&Ie(n,a,i)}function Io(){return(vt&6)===0?(al(0),!1):!0}function Uf(){if(it!==null){if(kt===0)var n=it.return;else n=it,Zr=as=null,Zc(n),Hs=null,Ia=0,n=it;for(;n!==null;)_g(n.alternate,n),n=n.return;it=null}}function Ks(n,i){var a=n.timeoutHandle;a!==-1&&(n.timeoutHandle=-1,Nw(a)),a=n.cancelPendingCommit,a!==null&&(n.cancelPendingCommit=null,a()),ui=0,Uf(),Dt=n,it=a=Kr(n.current,null),lt=i,kt=0,er=null,Ti=!1,Gs=Ee(n,i),Of=!1,Js=tr=Rf=ps=Oi=en=0,$n=il=null,Mf=!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-nt(o),p=1<<h;i|=n[h],o&=~p}return oi=i,oo(),a}function Gg(n,i){Xe=null,$.H=Ka,i===Bs||i===yo?(i=up(),kt=3):i===Hc?(i=up(),kt=4):kt=i===pf?8:i!==null&&typeof i=="object"&&typeof i.then=="function"?6:1,er=i,it===null&&(en=1,Oo(n,pr(i,n.current)))}function Jg(){var n=Zn.current;return n===null?!0:(lt&4194048)===lt?xr===null:(lt&62914560)===lt||(lt&536870912)!==0?n===xr:!1}function Xg(){var n=$.H;return $.H=Ka,n===null?Ka:n}function Kg(){var n=$.A;return $.A=lw,n}function Fo(){en=4,Ti||(lt&4194048)!==lt&&Zn.current!==null||(Gs=!0),(Oi&134217727)===0&&(ps&134217727)===0||Dt===null||Di(Dt,lt,tr,!1)}function Pf(n,i,a){var o=vt;vt|=2;var h=Xg(),p=Kg();(Dt!==n||lt!==i)&&(qo=null,Ks(n,i)),i=!1;var w=en;e:do try{if(kt!==0&&it!==null){var k=it,H=er;switch(kt){case 8:Uf(),w=6;break e;case 3:case 2:case 9:case 6:Zn.current===null&&(i=!0);var ne=kt;if(kt=0,er=null,Qs(n,k,H,ne),a&&Gs){w=0;break e}break;default:ne=kt,kt=0,er=null,Qs(n,k,H,ne)}}cw(),w=en;break}catch(fe){Gg(n,fe)}while(!0);return i&&n.shellSuspendCounter++,Zr=as=null,vt=o,$.H=h,$.A=p,it===null&&(Dt=null,lt=0,oo()),w}function cw(){for(;it!==null;)Qg(it)}function fw(n,i){var a=vt;vt|=2;var o=Xg(),h=Kg();Dt!==n||lt!==i?(qo=null,Ho=$e()+500,Ks(n,i)):Gs=Ee(n,i);e:do try{if(kt!==0&&it!==null){i=it;var p=er;t:switch(kt){case 1:kt=0,er=null,Qs(n,i,p,1);break;case 2:case 9:if(lp(p)){kt=0,er=null,Zg(i);break}i=function(){kt!==2&&kt!==9||Dt!==n||(kt=7),Hr(n)},p.then(i,i);break e;case 3:kt=7;break e;case 4:kt=5;break e;case 7:lp(p)?(kt=0,er=null,Zg(i)):(kt=0,er=null,Qs(n,i,p,7));break;case 5:var w=null;switch(it.tag){case 26:w=it.memoizedState;case 5:case 27:var k=it;if(w?Uy(w):k.stateNode.complete){kt=0,er=null;var H=k.sibling;if(H!==null)it=H;else{var ne=k.return;ne!==null?(it=ne,$o(ne)):it=null}break t}}kt=0,er=null,Qs(n,i,p,5);break;case 6:kt=0,er=null,Qs(n,i,p,6);break;case 8:Uf(),en=6;break e;default:throw Error(s(462))}}hw();break}catch(fe){Gg(n,fe)}while(!0);return Zr=as=null,$.H=o,$.A=h,vt=a,it!==null?0:(Dt=null,lt=0,oo(),en)}function hw(){for(;it!==null&&!zt();)Qg(it)}function Qg(n){var i=wg(n.alternate,n,oi);n.memoizedProps=n.pendingProps,i===null?$o(n):it=i}function Zg(n){var i=n,a=i.alternate;switch(i.tag){case 15:case 0:i=pg(a,i,i.pendingProps,i.type,void 0,lt);break;case 11:i=pg(a,i,i.pendingProps,i.type.render,i.ref,lt);break;case 5:Zc(i);default:_g(a,i),i=it=Km(i,oi),i=wg(a,i,oi)}n.memoizedProps=n.pendingProps,i===null?$o(n):it=i}function Qs(n,i,a,o){Zr=as=null,Zc(i),Hs=null,Ia=0;var h=i.return;try{if(ew(n,h,i,a,lt)){en=1,Oo(n,pr(a,n.current)),it=null;return}}catch(p){if(h!==null)throw it=h,p;en=1,Oo(n,pr(a,n.current)),it=null;return}i.flags&32768?(ut||o===1?n=!0:Gs||(lt&536870912)!==0?n=!1:(Ti=n=!0,(o===2||o===9||o===3||o===6)&&(o=Zn.current,o!==null&&o.tag===13&&(o.flags|=16384))),Wg(i,n)):$o(i)}function $o(n){var i=n;do{if((i.flags&32768)!==0){Wg(i,Ti);return}n=i.return;var a=rw(i.alternate,i,oi);if(a!==null){it=a;return}if(i=i.sibling,i!==null){it=i;return}it=i=n}while(i!==null);en===0&&(en=5)}function Wg(n,i){do{var a=iw(n.alternate,n);if(a!==null){a.flags&=32767,it=a;return}if(a=n.return,a!==null&&(a.flags|=32768,a.subtreeFlags=0,a.deletions=null),!i&&(n=n.sibling,n!==null)){it=n;return}it=n=a}while(n!==null);en=6,it=null}function ey(n,i,a,o,h,p,w,k,H){n.cancelPendingCommit=null;do Vo();while(gn!==0);if((vt&6)!==0)throw Error(s(327));if(i!==null){if(i===n.current)throw Error(s(177));if(p=i.lanes|i.childLanes,p|=Ec,rt(n,a,p,w,k,H),n===Dt&&(it=Dt=null,lt=0),Xs=i,Mi=n,ui=a,Df=p,Lf=h,Fg=o,(i.subtreeFlags&10256)!==0||(i.flags&10256)!==0?(n.callbackNode=null,n.callbackPriority=0,gw(Le,function(){return sy(),null})):(n.callbackNode=null,n.callbackPriority=0),o=(i.flags&13878)!==0,(i.subtreeFlags&13878)!==0||o){o=$.T,$.T=null,h=q.p,q.p=2,w=vt,vt|=4;try{sw(n,i,a)}finally{vt=w,q.p=h,$.T=o}}gn=1,ty(),ny(),ry()}}function ty(){if(gn===1){gn=0;var n=Mi,i=Xs,a=(i.flags&13878)!==0;if((i.subtreeFlags&13878)!==0||a){a=$.T,$.T=null;var o=q.p;q.p=2;var h=vt;vt|=4;try{Lg(i,n);var p=Kf,w=qm(n.containerInfo),k=p.focusedElem,H=p.selectionRange;if(w!==k&&k&&k.ownerDocument&&Hm(k.ownerDocument.documentElement,k)){if(H!==null&&vc(k)){var ne=H.start,fe=H.end;if(fe===void 0&&(fe=ne),"selectionStart"in k)k.selectionStart=ne,k.selectionEnd=Math.min(fe,k.value.length);else{var pe=k.ownerDocument||document,ie=pe&&pe.defaultView||window;if(ie.getSelection){var oe=ie.getSelection(),De=k.textContent.length,qe=Math.min(H.start,De),Nt=H.end===void 0?qe:Math.min(H.end,De);!oe.extend&&qe>Nt&&(w=Nt,Nt=qe,qe=w);var K=Bm(k,qe),J=Bm(k,Nt);if(K&&J&&(oe.rangeCount!==1||oe.anchorNode!==K.node||oe.anchorOffset!==K.offset||oe.focusNode!==J.node||oe.focusOffset!==J.offset)){var te=pe.createRange();te.setStart(K.node,K.offset),oe.removeAllRanges(),qe>Nt?(oe.addRange(te),oe.extend(J.node,J.offset)):(te.setEnd(J.node,J.offset),oe.addRange(te))}}}}for(pe=[],oe=k;oe=oe.parentNode;)oe.nodeType===1&&pe.push({element:oe,left:oe.scrollLeft,top:oe.scrollTop});for(typeof k.focus=="function"&&k.focus(),k=0;k<pe.length;k++){var he=pe[k];he.element.scrollLeft=he.left,he.element.scrollTop=he.top}}ru=!!Xf,Kf=Xf=null}finally{vt=h,q.p=o,$.T=a}}n.current=i,gn=2}}function ny(){if(gn===2){gn=0;var n=Mi,i=Xs,a=(i.flags&8772)!==0;if((i.subtreeFlags&8772)!==0||a){a=$.T,$.T=null;var o=q.p;q.p=2;var h=vt;vt|=4;try{Tg(n,i.alternate,i)}finally{vt=h,q.p=o,$.T=a}}gn=3}}function ry(){if(gn===4||gn===3){gn=0,Pn();var n=Mi,i=Xs,a=ui,o=Fg;(i.subtreeFlags&10256)!==0||(i.flags&10256)!==0?gn=5:(gn=0,Xs=Mi=null,iy(n,n.pendingLanes));var h=n.pendingLanes;if(h===0&&(Ri=null),nn(a),i=i.stateNode,xt&&typeof xt.onCommitFiberRoot=="function")try{xt.onCommitFiberRoot(Ct,i,void 0,(i.current.flags&128)===128)}catch{}if(o!==null){i=$.T,h=q.p,q.p=2,$.T=null;try{for(var p=n.onRecoverableError,w=0;w<o.length;w++){var k=o[w];p(k.value,{componentStack:k.stack})}}finally{$.T=i,q.p=h}}(ui&3)!==0&&Vo(),Hr(n),h=n.pendingLanes,(a&261930)!==0&&(h&42)!==0?n===zf?sl++:(sl=0,zf=n):sl=0,al(0)}}function iy(n,i){(n.pooledCacheLanes&=i)===0&&(i=n.pooledCache,i!=null&&(n.pooledCache=null,Ha(i)))}function Vo(){return ty(),ny(),ry(),sy()}function sy(){if(gn!==5)return!1;var n=Mi,i=Df;Df=0;var a=nn(ui),o=$.T,h=q.p;try{q.p=32>a?32:a,$.T=null,a=Lf,Lf=null;var p=Mi,w=ui;if(gn=0,Xs=Mi=null,ui=0,(vt&6)!==0)throw Error(s(331));var k=vt;if(vt|=4,Hg(p.current),Ug(p,p.current,w,a),vt=k,al(0,!1),xt&&typeof xt.onPostCommitFiberRoot=="function")try{xt.onPostCommitFiberRoot(Ct,p)}catch{}return!0}finally{q.p=h,$.T=o,iy(n,i)}}function ay(n,i,a){i=pr(a,i),i=mf(n.stateNode,i,2),n=Ci(n,i,2),n!==null&&(ft(n,2),Hr(n))}function Et(n,i,a){if(n.tag===3)ay(n,n,a);else for(;i!==null;){if(i.tag===3){ay(i,n,a);break}else if(i.tag===1){var o=i.stateNode;if(typeof i.type.getDerivedStateFromError=="function"||typeof o.componentDidCatch=="function"&&(Ri===null||!Ri.has(o))){n=pr(a,n),a=lg(2),o=Ci(i,a,2),o!==null&&(og(a,o,i,n),ft(o,2),Hr(o));break}}i=i.return}}function Bf(n,i,a){var o=n.pingCache;if(o===null){o=n.pingCache=new ow;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)||(Of=!0,h.add(a),n=dw.bind(null,n,i,a),i.then(n,n))}function dw(n,i,a){var o=n.pingCache;o!==null&&o.delete(i),n.pingedLanes|=n.suspendedLanes&a,n.warmLanes&=~a,Dt===n&&(lt&a)===a&&(en===4||en===3&&(lt&62914560)===lt&&300>$e()-Bo?(vt&2)===0&&Ks(n,0):Rf|=a,Js===lt&&(Js=0)),Hr(n)}function ly(n,i){i===0&&(i=We()),n=rs(n,i),n!==null&&(ft(n,i),Hr(n))}function mw(n){var i=n.memoizedState,a=0;i!==null&&(a=i.retryLane),ly(n,a)}function pw(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),ly(n,a)}function gw(n,i){return Ke(n,i)}var Yo=null,Zs=null,Hf=!1,Go=!1,qf=!1,Li=0;function Hr(n){n!==Zs&&n.next===null&&(Zs===null?Yo=Zs=n:Zs=Zs.next=n),Go=!0,Hf||(Hf=!0,bw())}function al(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 w=o.suspendedLanes,k=o.pingedLanes;p=(1<<31-nt(42|n)+1)-1,p&=h&~(w&~k),p=p&201326741?p&201326741|1:p?p|2:0}p!==0&&(a=!0,fy(o,p))}else p=lt,p=xe(o,o===Dt?p:0,o.cancelPendingCommit!==null||o.timeoutHandle!==-1),(p&3)===0||Ee(o,p)||(a=!0,fy(o,p));o=o.next}while(a);qf=!1}}function yw(){oy()}function oy(){Go=Hf=!1;var n=0;Li!==0&&jw()&&(n=Li);for(var i=$e(),a=null,o=Yo;o!==null;){var h=o.next,p=uy(o,i);p===0?(o.next=null,a===null?Yo=h:a.next=h,h===null&&(Zs=a)):(a=o,(n!==0||(p&3)!==0)&&(Go=!0)),o=h}gn!==0&&gn!==5||al(n),Li!==0&&(Li=0)}function uy(n,i){for(var a=n.suspendedLanes,o=n.pingedLanes,h=n.expirationTimes,p=n.pendingLanes&-62914561;0<p;){var w=31-nt(p),k=1<<w,H=h[w];H===-1?((k&a)===0||(k&o)!==0)&&(h[w]=Ye(k,i)):H<=i&&(n.expiredLanes|=k),p&=~k}if(i=Dt,a=lt,a=xe(n,n===i?a:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),o=n.callbackNode,a===0||n===i&&(kt===2||kt===9)||n.cancelPendingCommit!==null)return o!==null&&o!==null&&bt(o),n.callbackNode=null,n.callbackPriority=0;if((a&3)===0||Ee(n,a)){if(i=a&-a,i===n.callbackPriority)return i;switch(o!==null&&bt(o),nn(a)){case 2:case 8:a=_e;break;case 32:a=Le;break;case 268435456:a=et;break;default:a=Le}return o=cy.bind(null,n),a=Ke(a,o),n.callbackPriority=i,n.callbackNode=a,i}return o!==null&&o!==null&&bt(o),n.callbackPriority=2,n.callbackNode=null,2}function cy(n,i){if(gn!==0&&gn!==5)return n.callbackNode=null,n.callbackPriority=0,null;var a=n.callbackNode;if(Vo()&&n.callbackNode!==a)return null;var o=lt;return o=xe(n,n===Dt?o:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),o===0?null:(Vg(n,o,i),uy(n,$e()),n.callbackNode!=null&&n.callbackNode===a?cy.bind(null,n):null)}function fy(n,i){if(Vo())return null;Vg(n,i,!0)}function bw(){Tw(function(){(vt&6)!==0?Ke(ce,yw):oy()})}function If(){if(Li===0){var n=Us;n===0&&(n=_t,_t<<=1,(_t&261888)===0&&(_t=256)),Li=n}return Li}function hy(n){return n==null||typeof n=="symbol"||typeof n=="boolean"?null:typeof n=="function"?n:eo(""+n)}function dy(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 xw(n,i,a,o,h){if(i==="submit"&&a&&a.stateNode===h){var p=hy((h[Zt]||null).action),w=o.submitter;w&&(i=(i=w[Zt]||null)?hy(i.formAction):w.getAttribute("formAction"),i!==null&&(p=i,w=null));var k=new io("action","action",null,o,h);n.push({event:k,listeners:[{instance:null,listener:function(){if(o.defaultPrevented){if(Li!==0){var H=w?dy(h,w):new FormData(h);of(a,{pending:!0,data:H,method:h.method,action:p},null,H)}}else typeof p=="function"&&(k.preventDefault(),H=w?dy(h,w):new FormData(h),of(a,{pending:!0,data:H,method:h.method,action:p},p,H))},currentTarget:h}]})}}for(var Ff=0;Ff<kc.length;Ff++){var $f=kc[Ff],vw=$f.toLowerCase(),ww=$f[0].toUpperCase()+$f.slice(1);Ar(vw,"on"+ww)}Ar($m,"onAnimationEnd"),Ar(Vm,"onAnimationIteration"),Ar(Ym,"onAnimationStart"),Ar("dblclick","onDoubleClick"),Ar("focusin","onFocus"),Ar("focusout","onBlur"),Ar(Uv,"onTransitionRun"),Ar(Pv,"onTransitionStart"),Ar(Bv,"onTransitionCancel"),Ar(Gm,"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 ll="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(" "),Sw=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(ll));function my(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 w=o.length-1;0<=w;w--){var k=o[w],H=k.instance,ne=k.currentTarget;if(k=k.listener,H!==p&&h.isPropagationStopped())break e;p=k,h.currentTarget=ne;try{p(h)}catch(fe){lo(fe)}h.currentTarget=null,p=H}else for(w=0;w<o.length;w++){if(k=o[w],H=k.instance,ne=k.currentTarget,k=k.listener,H!==p&&h.isPropagationStopped())break e;p=k,h.currentTarget=ne;try{p(h)}catch(fe){lo(fe)}h.currentTarget=null,p=H}}}}function st(n,i){var a=i[Wi];a===void 0&&(a=i[Wi]=new Set);var o=n+"__bubble";a.has(o)||(py(i,n,2,!1),a.add(o))}function Vf(n,i,a){var o=0;i&&(o|=4),py(a,n,o,i)}var Jo="_reactListening"+Math.random().toString(36).slice(2);function Yf(n){if(!n[Jo]){n[Jo]=!0,Q.forEach(function(a){a!=="selectionchange"&&(Sw.has(a)||Vf(a,!1,n),Vf(a,!0,n))});var i=n.nodeType===9?n:n.ownerDocument;i===null||i[Jo]||(i[Jo]=!0,Vf("selectionchange",!1,i))}}function py(n,i,a,o){switch($y(i)){case 2:var h=Kw;break;case 8:h=Qw;break;default:h=lh}a=h.bind(null,i,a,n),h=void 0,!fc||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 w=o.tag;if(w===3||w===4){var k=o.stateNode.containerInfo;if(k===h)break;if(w===4)for(w=o.return;w!==null;){var H=w.tag;if((H===3||H===4)&&w.stateNode.containerInfo===h)return;w=w.return}for(;k!==null;){if(w=E(k),w===null)return;if(H=w.tag,H===5||H===6||H===26||H===27){o=p=w;continue e}k=k.parentNode}}o=o.return}vm(function(){var ne=p,fe=uc(a),pe=[];e:{var ie=Jm.get(n);if(ie!==void 0){var oe=io,De=n;switch(n){case"keypress":if(no(a)===0)break e;case"keydown":case"keyup":oe=pv;break;case"focusin":De="focus",oe=pc;break;case"focusout":De="blur",oe=pc;break;case"beforeblur":case"afterblur":oe=pc;break;case"click":if(a.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":oe=_m;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":oe=rv;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":oe=bv;break;case $m:case Vm:case Ym:oe=av;break;case Gm:oe=vv;break;case"scroll":case"scrollend":oe=tv;break;case"wheel":oe=Sv;break;case"copy":case"cut":case"paste":oe=ov;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":oe=Em;break;case"toggle":case"beforetoggle":oe=kv}var qe=(i&4)!==0,Nt=!qe&&(n==="scroll"||n==="scrollend"),K=qe?ie!==null?ie+"Capture":null:ie;qe=[];for(var J=ne,te;J!==null;){var he=J;if(te=he.stateNode,he=he.tag,he!==5&&he!==26&&he!==27||te===null||K===null||(he=Na(J,K),he!=null&&qe.push(ol(J,he,te))),Nt)break;J=J.return}0<qe.length&&(ie=new oe(ie,De,null,a,fe),pe.push({event:ie,listeners:qe}))}}if((i&7)===0){e:{if(ie=n==="mouseover"||n==="pointerover",oe=n==="mouseout"||n==="pointerout",ie&&a!==oc&&(De=a.relatedTarget||a.fromElement)&&(E(De)||De[Xn]))break e;if((oe||ie)&&(ie=fe.window===fe?fe:(ie=fe.ownerDocument)?ie.defaultView||ie.parentWindow:window,oe?(De=a.relatedTarget||a.toElement,oe=ne,De=De?E(De):null,De!==null&&(Nt=u(De),qe=De.tag,De!==Nt||qe!==5&&qe!==27&&qe!==6)&&(De=null)):(oe=null,De=ne),oe!==De)){if(qe=_m,he="onMouseLeave",K="onMouseEnter",J="mouse",(n==="pointerout"||n==="pointerover")&&(qe=Em,he="onPointerLeave",K="onPointerEnter",J="pointer"),Nt=oe==null?ie:N(oe),te=De==null?ie:N(De),ie=new qe(he,J+"leave",oe,a,fe),ie.target=Nt,ie.relatedTarget=te,he=null,E(fe)===ne&&(qe=new qe(K,J+"enter",De,a,fe),qe.target=te,qe.relatedTarget=Nt,he=qe),Nt=he,oe&&De)t:{for(qe=_w,K=oe,J=De,te=0,he=K;he;he=qe(he))te++;he=0;for(var Ue=J;Ue;Ue=qe(Ue))he++;for(;0<te-he;)K=qe(K),te--;for(;0<he-te;)J=qe(J),he--;for(;te--;){if(K===J||J!==null&&K===J.alternate){qe=K;break t}K=qe(K),J=qe(J)}qe=null}else qe=null;oe!==null&&gy(pe,ie,oe,qe,!1),De!==null&&Nt!==null&&gy(pe,Nt,De,qe,!0)}}e:{if(ie=ne?N(ne):window,oe=ie.nodeName&&ie.nodeName.toLowerCase(),oe==="select"||oe==="input"&&ie.type==="file")var gt=Mm;else if(Om(ie))if(Dm)gt=Dv;else{gt=Rv;var ze=Ov}else oe=ie.nodeName,!oe||oe.toLowerCase()!=="input"||ie.type!=="checkbox"&&ie.type!=="radio"?ne&&lc(ne.elementType)&&(gt=Mm):gt=Mv;if(gt&&(gt=gt(n,ne))){Rm(pe,gt,a,fe);break e}ze&&ze(n,ie,ne),n==="focusout"&&ne&&ie.type==="number"&&ne.memoizedProps.value!=null&&ac(ie,"number",ie.value)}switch(ze=ne?N(ne):window,n){case"focusin":(Om(ze)||ze.contentEditable==="true")&&(Ns=ze,wc=ne,Ua=null);break;case"focusout":Ua=wc=Ns=null;break;case"mousedown":Sc=!0;break;case"contextmenu":case"mouseup":case"dragend":Sc=!1,Im(pe,a,fe);break;case"selectionchange":if(zv)break;case"keydown":case"keyup":Im(pe,a,fe)}var Qe;if(yc)e:{switch(n){case"compositionstart":var ot="onCompositionStart";break e;case"compositionend":ot="onCompositionEnd";break e;case"compositionupdate":ot="onCompositionUpdate";break e}ot=void 0}else js?Nm(n,a)&&(ot="onCompositionEnd"):n==="keydown"&&a.keyCode===229&&(ot="onCompositionStart");ot&&(Cm&&a.locale!=="ko"&&(js||ot!=="onCompositionStart"?ot==="onCompositionEnd"&&js&&(Qe=wm()):(xi=fe,hc="value"in xi?xi.value:xi.textContent,js=!0)),ze=Xo(ne,ot),0<ze.length&&(ot=new km(ot,n,null,a,fe),pe.push({event:ot,listeners:ze}),Qe?ot.data=Qe:(Qe=Tm(a),Qe!==null&&(ot.data=Qe)))),(Qe=Cv?Av(n,a):jv(n,a))&&(ot=Xo(ne,"onBeforeInput"),0<ot.length&&(ze=new km("onBeforeInput","beforeinput",null,a,fe),pe.push({event:ze,listeners:ot}),ze.data=Qe)),xw(pe,n,ne,a,fe)}my(pe,i)})}function ol(n,i,a){return{instance:n,listener:i,currentTarget:a}}function Xo(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=Na(n,a),h!=null&&o.unshift(ol(n,h,p)),h=Na(n,i),h!=null&&o.push(ol(n,h,p))),n.tag===3)return o;n=n.return}return[]}function _w(n){if(n===null)return null;do n=n.return;while(n&&n.tag!==5&&n.tag!==27);return n||null}function gy(n,i,a,o,h){for(var p=i._reactName,w=[];a!==null&&a!==o;){var k=a,H=k.alternate,ne=k.stateNode;if(k=k.tag,H!==null&&H===o)break;k!==5&&k!==26&&k!==27||ne===null||(H=ne,h?(ne=Na(a,p),ne!=null&&w.unshift(ol(a,ne,H))):h||(ne=Na(a,p),ne!=null&&w.push(ol(a,ne,H)))),a=a.return}w.length!==0&&n.push({event:i,listeners:w})}var kw=/\r\n?/g,Ew=/\u0000|\uFFFD/g;function yy(n){return(typeof n=="string"?n:""+n).replace(kw,`
49
- `).replace(Ew,"")}function by(n,i){return i=yy(i),yy(n)===i}function jt(n,i,a,o,h,p){switch(a){case"children":typeof o=="string"?i==="body"||i==="textarea"&&o===""||Es(n,o):(typeof o=="number"||typeof o=="bigint")&&i!=="body"&&Es(n,""+o);break;case"className":Cr(n,"class",o);break;case"tabIndex":Cr(n,"tabindex",o);break;case"dir":case"role":case"viewBox":case"width":case"height":Cr(n,a,o);break;case"style":bm(n,o,p);break;case"data":if(i!=="object"){Cr(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=eo(""+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"&&jt(n,i,"name",h.name,h,null),jt(n,i,"formEncType",h.formEncType,h,null),jt(n,i,"formMethod",h.formMethod,h,null),jt(n,i,"formTarget",h.formTarget,h,null)):(jt(n,i,"encType",h.encType,h,null),jt(n,i,"method",h.method,h,null),jt(n,i,"target",h.target,h,null)));if(o==null||typeof o=="symbol"||typeof o=="boolean"){n.removeAttribute(a);break}o=eo(""+o),n.setAttribute(a,o);break;case"onClick":o!=null&&(n.onclick=Jr);break;case"onScroll":o!=null&&st("scroll",n);break;case"onScrollEnd":o!=null&&st("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=eo(""+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":st("beforetoggle",n),st("toggle",n),En(n,"popover",o);break;case"xlinkActuate":Gr(n,"http://www.w3.org/1999/xlink","xlink:actuate",o);break;case"xlinkArcrole":Gr(n,"http://www.w3.org/1999/xlink","xlink:arcrole",o);break;case"xlinkRole":Gr(n,"http://www.w3.org/1999/xlink","xlink:role",o);break;case"xlinkShow":Gr(n,"http://www.w3.org/1999/xlink","xlink:show",o);break;case"xlinkTitle":Gr(n,"http://www.w3.org/1999/xlink","xlink:title",o);break;case"xlinkType":Gr(n,"http://www.w3.org/1999/xlink","xlink:type",o);break;case"xmlBase":Gr(n,"http://www.w3.org/XML/1998/namespace","xml:base",o);break;case"xmlLang":Gr(n,"http://www.w3.org/XML/1998/namespace","xml:lang",o);break;case"xmlSpace":Gr(n,"http://www.w3.org/XML/1998/namespace","xml:space",o);break;case"is":En(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=W1.get(a)||a,En(n,a,o))}}function Jf(n,i,a,o,h,p){switch(a){case"style":bm(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"?Es(n,o):(typeof o=="number"||typeof o=="bigint")&&Es(n,""+o);break;case"onScroll":o!=null&&st("scroll",n);break;case"onScrollEnd":o!=null&&st("scrollend",n);break;case"onClick":o!=null&&(n.onclick=Jr);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!me.hasOwnProperty(a))e:{if(a[0]==="o"&&a[1]==="n"&&(h=a.endsWith("Capture"),i=a.slice(2,h?a.length-7:void 0),p=n[Zt]||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,""):En(n,a,o)}}}function kn(n,i,a){switch(i){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":st("error",n),st("load",n);var o=!1,h=!1,p;for(p in a)if(a.hasOwnProperty(p)){var w=a[p];if(w!=null)switch(p){case"src":o=!0;break;case"srcSet":h=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(s(137,i));default:jt(n,i,p,w,a,null)}}h&&jt(n,i,"srcSet",a.srcSet,a,null),o&&jt(n,i,"src",a.src,a,null);return;case"input":st("invalid",n);var k=p=w=h=null,H=null,ne=null;for(o in a)if(a.hasOwnProperty(o)){var fe=a[o];if(fe!=null)switch(o){case"name":h=fe;break;case"type":w=fe;break;case"checked":H=fe;break;case"defaultChecked":ne=fe;break;case"value":p=fe;break;case"defaultValue":k=fe;break;case"children":case"dangerouslySetInnerHTML":if(fe!=null)throw Error(s(137,i));break;default:jt(n,i,o,fe,a,null)}}mm(n,p,k,H,ne,w,h,!1);return;case"select":st("invalid",n),o=w=p=null;for(h in a)if(a.hasOwnProperty(h)&&(k=a[h],k!=null))switch(h){case"value":p=k;break;case"defaultValue":w=k;break;case"multiple":o=k;default:jt(n,i,h,k,a,null)}i=p,a=w,n.multiple=!!o,i!=null?ks(n,!!o,i,!1):a!=null&&ks(n,!!o,a,!0);return;case"textarea":st("invalid",n),p=h=o=null;for(w in a)if(a.hasOwnProperty(w)&&(k=a[w],k!=null))switch(w){case"value":o=k;break;case"defaultValue":h=k;break;case"children":p=k;break;case"dangerouslySetInnerHTML":if(k!=null)throw Error(s(91));break;default:jt(n,i,w,k,a,null)}gm(n,o,h,p);return;case"option":for(H in a)if(a.hasOwnProperty(H)&&(o=a[H],o!=null))switch(H){case"selected":n.selected=o&&typeof o!="function"&&typeof o!="symbol";break;default:jt(n,i,H,o,a,null)}return;case"dialog":st("beforetoggle",n),st("toggle",n),st("cancel",n),st("close",n);break;case"iframe":case"object":st("load",n);break;case"video":case"audio":for(o=0;o<ll.length;o++)st(ll[o],n);break;case"image":st("error",n),st("load",n);break;case"details":st("toggle",n);break;case"embed":case"source":case"link":st("error",n),st("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(ne in a)if(a.hasOwnProperty(ne)&&(o=a[ne],o!=null))switch(ne){case"children":case"dangerouslySetInnerHTML":throw Error(s(137,i));default:jt(n,i,ne,o,a,null)}return;default:if(lc(i)){for(fe in a)a.hasOwnProperty(fe)&&(o=a[fe],o!==void 0&&Jf(n,i,fe,o,a,void 0));return}}for(k in a)a.hasOwnProperty(k)&&(o=a[k],o!=null&&jt(n,i,k,o,a,null))}function Cw(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,w=null,k=null,H=null,ne=null,fe=null;for(oe in a){var pe=a[oe];if(a.hasOwnProperty(oe)&&pe!=null)switch(oe){case"checked":break;case"value":break;case"defaultValue":H=pe;default:o.hasOwnProperty(oe)||jt(n,i,oe,null,o,pe)}}for(var ie in o){var oe=o[ie];if(pe=a[ie],o.hasOwnProperty(ie)&&(oe!=null||pe!=null))switch(ie){case"type":p=oe;break;case"name":h=oe;break;case"checked":ne=oe;break;case"defaultChecked":fe=oe;break;case"value":w=oe;break;case"defaultValue":k=oe;break;case"children":case"dangerouslySetInnerHTML":if(oe!=null)throw Error(s(137,i));break;default:oe!==pe&&jt(n,i,ie,oe,o,pe)}}sc(n,w,k,H,ne,fe,p,h);return;case"select":oe=w=k=ie=null;for(p in a)if(H=a[p],a.hasOwnProperty(p)&&H!=null)switch(p){case"value":break;case"multiple":oe=H;default:o.hasOwnProperty(p)||jt(n,i,p,null,o,H)}for(h in o)if(p=o[h],H=a[h],o.hasOwnProperty(h)&&(p!=null||H!=null))switch(h){case"value":ie=p;break;case"defaultValue":k=p;break;case"multiple":w=p;default:p!==H&&jt(n,i,h,p,o,H)}i=k,a=w,o=oe,ie!=null?ks(n,!!a,ie,!1):!!o!=!!a&&(i!=null?ks(n,!!a,i,!0):ks(n,!!a,a?[]:"",!1));return;case"textarea":oe=ie=null;for(k in a)if(h=a[k],a.hasOwnProperty(k)&&h!=null&&!o.hasOwnProperty(k))switch(k){case"value":break;case"children":break;default:jt(n,i,k,null,o,h)}for(w in o)if(h=o[w],p=a[w],o.hasOwnProperty(w)&&(h!=null||p!=null))switch(w){case"value":ie=h;break;case"defaultValue":oe=h;break;case"children":break;case"dangerouslySetInnerHTML":if(h!=null)throw Error(s(91));break;default:h!==p&&jt(n,i,w,h,o,p)}pm(n,ie,oe);return;case"option":for(var De in a)if(ie=a[De],a.hasOwnProperty(De)&&ie!=null&&!o.hasOwnProperty(De))switch(De){case"selected":n.selected=!1;break;default:jt(n,i,De,null,o,ie)}for(H in o)if(ie=o[H],oe=a[H],o.hasOwnProperty(H)&&ie!==oe&&(ie!=null||oe!=null))switch(H){case"selected":n.selected=ie&&typeof ie!="function"&&typeof ie!="symbol";break;default:jt(n,i,H,ie,o,oe)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var qe in a)ie=a[qe],a.hasOwnProperty(qe)&&ie!=null&&!o.hasOwnProperty(qe)&&jt(n,i,qe,null,o,ie);for(ne in o)if(ie=o[ne],oe=a[ne],o.hasOwnProperty(ne)&&ie!==oe&&(ie!=null||oe!=null))switch(ne){case"children":case"dangerouslySetInnerHTML":if(ie!=null)throw Error(s(137,i));break;default:jt(n,i,ne,ie,o,oe)}return;default:if(lc(i)){for(var Nt in a)ie=a[Nt],a.hasOwnProperty(Nt)&&ie!==void 0&&!o.hasOwnProperty(Nt)&&Jf(n,i,Nt,void 0,o,ie);for(fe in o)ie=o[fe],oe=a[fe],!o.hasOwnProperty(fe)||ie===oe||ie===void 0&&oe===void 0||Jf(n,i,fe,ie,o,oe);return}}for(var K in a)ie=a[K],a.hasOwnProperty(K)&&ie!=null&&!o.hasOwnProperty(K)&&jt(n,i,K,null,o,ie);for(pe in o)ie=o[pe],oe=a[pe],!o.hasOwnProperty(pe)||ie===oe||ie==null&&oe==null||jt(n,i,pe,ie,o,oe)}function xy(n){switch(n){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Aw(){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,w=h.initiatorType,k=h.duration;if(p&&k&&xy(w)){for(w=0,k=h.responseEnd,o+=1;o<a.length;o++){var H=a[o],ne=H.startTime;if(ne>k)break;var fe=H.transferSize,pe=H.initiatorType;fe&&xy(pe)&&(H=H.responseEnd,w+=fe*(H<k?1:(k-ne)/(H-ne)))}if(--o,i+=8*(p+w)/(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 Xf=null,Kf=null;function Ko(n){return n.nodeType===9?n:n.ownerDocument}function vy(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 wy(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 Qf(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 Zf=null;function jw(){var n=window.event;return n&&n.type==="popstate"?n===Zf?!1:(Zf=n,!0):(Zf=null,!1)}var Sy=typeof setTimeout=="function"?setTimeout:void 0,Nw=typeof clearTimeout=="function"?clearTimeout:void 0,_y=typeof Promise=="function"?Promise:void 0,Tw=typeof queueMicrotask=="function"?queueMicrotask:typeof _y<"u"?function(n){return _y.resolve(null).then(n).catch(Ow)}:Sy;function Ow(n){setTimeout(function(){throw n})}function zi(n){return n==="head"}function ky(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),na(i);return}o--}else if(a==="$"||a==="$?"||a==="$~"||a==="$!"||a==="&")o++;else if(a==="html")ul(n.ownerDocument.documentElement);else if(a==="head"){a=n.ownerDocument.head,ul(a);for(var p=a.firstChild;p;){var w=p.nextSibling,k=p.nodeName;p[pn]||k==="SCRIPT"||k==="STYLE"||k==="LINK"&&p.rel.toLowerCase()==="stylesheet"||a.removeChild(p),p=w}}else a==="body"&&ul(n.ownerDocument.body);a=h}while(a);na(i)}function Ey(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 Wf(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":Wf(a),_s(a);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(a.rel.toLowerCase()==="stylesheet")continue}n.removeChild(a)}}function Rw(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[pn])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=vr(n.nextSibling),n===null)break}return null}function Mw(n,i,a){if(i==="")return null;for(;n.nodeType!==3;)if((n.nodeType!==1||n.nodeName!=="INPUT"||n.type!=="hidden")&&!a||(n=vr(n.nextSibling),n===null))return null;return n}function Cy(n,i){for(;n.nodeType!==8;)if((n.nodeType!==1||n.nodeName!=="INPUT"||n.type!=="hidden")&&!i||(n=vr(n.nextSibling),n===null))return null;return n}function eh(n){return n.data==="$?"||n.data==="$~"}function th(n){return n.data==="$!"||n.data==="$?"&&n.ownerDocument.readyState!=="loading"}function Dw(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 vr(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 nh=null;function Ay(n){n=n.nextSibling;for(var i=0;n;){if(n.nodeType===8){var a=n.data;if(a==="/$"||a==="/&"){if(i===0)return vr(n.nextSibling);i--}else a!=="$"&&a!=="$!"&&a!=="$?"&&a!=="$~"&&a!=="&"||i++}n=n.nextSibling}return null}function jy(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 Ny(n,i,a){switch(i=Ko(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 ul(n){for(var i=n.attributes;i.length;)n.removeAttributeNode(i[0]);_s(n)}var wr=new Map,Ty=new Set;function Qo(n){return typeof n.getRootNode=="function"?n.getRootNode():n.nodeType===9?n:n.ownerDocument}var ci=q.d;q.d={f:Lw,r:zw,D:Uw,C:Pw,L:Bw,m:Hw,X:Iw,S:qw,M:Fw};function Lw(){var n=ci.f(),i=Io();return n||i}function zw(n){var i=O(n);i!==null&&i.tag===5&&i.type==="form"?Gp(i):ci.r(n)}var Ws=typeof document>"u"?null:document;function Oy(n,i,a){var o=Ws;if(o&&typeof i=="string"&&i){var h=dr(i);h='link[rel="'+n+'"][href="'+h+'"]',typeof a=="string"&&(h+='[crossorigin="'+a+'"]'),Ty.has(h)||(Ty.add(h),n={rel:n,crossOrigin:a,href:i},o.querySelector(h)===null&&(i=o.createElement("link"),kn(i,"link",n),Y(i),o.head.appendChild(i)))}}function Uw(n){ci.D(n),Oy("dns-prefetch",n,null)}function Pw(n,i){ci.C(n,i),Oy("preconnect",n,i)}function Bw(n,i,a){ci.L(n,i,a);var o=Ws;if(o&&n&&i){var h='link[rel="preload"][as="'+dr(i)+'"]';i==="image"&&a&&a.imageSrcSet?(h+='[imagesrcset="'+dr(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(h+='[imagesizes="'+dr(a.imageSizes)+'"]')):h+='[href="'+dr(n)+'"]';var p=h;switch(i){case"style":p=ea(n);break;case"script":p=ta(n)}wr.has(p)||(n=g({rel:"preload",href:i==="image"&&a&&a.imageSrcSet?void 0:n,as:i},a),wr.set(p,n),o.querySelector(h)!==null||i==="style"&&o.querySelector(cl(p))||i==="script"&&o.querySelector(fl(p))||(i=o.createElement("link"),kn(i,"link",n),Y(i),o.head.appendChild(i)))}}function Hw(n,i){ci.m(n,i);var a=Ws;if(a&&n){var o=i&&typeof i.as=="string"?i.as:"script",h='link[rel="modulepreload"][as="'+dr(o)+'"][href="'+dr(n)+'"]',p=h;switch(o){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":p=ta(n)}if(!wr.has(p)&&(n=g({rel:"modulepreload",href:n},i),wr.set(p,n),a.querySelector(h)===null)){switch(o){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(fl(p)))return}o=a.createElement("link"),kn(o,"link",n),Y(o),a.head.appendChild(o)}}}function qw(n,i,a){ci.S(n,i,a);var o=Ws;if(o&&n){var h=z(o).hoistableStyles,p=ea(n);i=i||"default";var w=h.get(p);if(!w){var k={loading:0,preload:null};if(w=o.querySelector(cl(p)))k.loading=5;else{n=g({rel:"stylesheet",href:n,"data-precedence":i},a),(a=wr.get(p))&&rh(n,a);var H=w=o.createElement("link");Y(H),kn(H,"link",n),H._p=new Promise(function(ne,fe){H.onload=ne,H.onerror=fe}),H.addEventListener("load",function(){k.loading|=1}),H.addEventListener("error",function(){k.loading|=2}),k.loading|=4,Zo(w,i,o)}w={type:"stylesheet",instance:w,count:1,state:k},h.set(p,w)}}}function Iw(n,i){ci.X(n,i);var a=Ws;if(a&&n){var o=z(a).hoistableScripts,h=ta(n),p=o.get(h);p||(p=a.querySelector(fl(h)),p||(n=g({src:n,async:!0},i),(i=wr.get(h))&&ih(n,i),p=a.createElement("script"),Y(p),kn(p,"link",n),a.head.appendChild(p)),p={type:"script",instance:p,count:1,state:null},o.set(h,p))}}function Fw(n,i){ci.M(n,i);var a=Ws;if(a&&n){var o=z(a).hoistableScripts,h=ta(n),p=o.get(h);p||(p=a.querySelector(fl(h)),p||(n=g({src:n,async:!0,type:"module"},i),(i=wr.get(h))&&ih(n,i),p=a.createElement("script"),Y(p),kn(p,"link",n),a.head.appendChild(p)),p={type:"script",instance:p,count:1,state:null},o.set(h,p))}}function Ry(n,i,a,o){var h=(h=we.current)?Qo(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=ea(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=ea(a.href);var p=z(h).hoistableStyles,w=p.get(n);if(w||(h=h.ownerDocument||h,w={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},p.set(n,w),(p=h.querySelector(cl(n)))&&!p._p&&(w.instance=p,w.state.loading=5),wr.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},wr.set(n,a),p||$w(h,n,a,w.state))),i&&o===null)throw Error(s(528,""));return w}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=ta(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 ea(n){return'href="'+dr(n)+'"'}function cl(n){return'link[rel="stylesheet"]['+n+"]"}function My(n){return g({},n,{"data-precedence":n.precedence,precedence:null})}function $w(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}),kn(i,"link",a),Y(i),n.head.appendChild(i))}function ta(n){return'[src="'+dr(n)+'"]'}function fl(n){return"script[async]"+n}function Dy(n,i,a){if(i.count++,i.instance===null)switch(i.type){case"style":var o=n.querySelector('style[data-href~="'+dr(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),kn(o,"style",h),Zo(o,a.precedence,n),i.instance=o;case"stylesheet":h=ea(a.href);var p=n.querySelector(cl(h));if(p)return i.state.loading|=4,i.instance=p,Y(p),p;o=My(a),(h=wr.get(h))&&rh(o,h),p=(n.ownerDocument||n).createElement("link"),Y(p);var w=p;return w._p=new Promise(function(k,H){w.onload=k,w.onerror=H}),kn(p,"link",o),i.state.loading|=4,Zo(p,a.precedence,n),i.instance=p;case"script":return p=ta(a.src),(h=n.querySelector(fl(p)))?(i.instance=h,Y(h),h):(o=a,(h=wr.get(p))&&(o=g({},a),ih(o,h)),n=n.ownerDocument||n,h=n.createElement("script"),Y(h),kn(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,Zo(o,a.precedence,n));return i.instance}function Zo(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,w=0;w<o.length;w++){var k=o[w];if(k.dataset.precedence===i)p=k;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 rh(n,i){n.crossOrigin==null&&(n.crossOrigin=i.crossOrigin),n.referrerPolicy==null&&(n.referrerPolicy=i.referrerPolicy),n.title==null&&(n.title=i.title)}function ih(n,i){n.crossOrigin==null&&(n.crossOrigin=i.crossOrigin),n.referrerPolicy==null&&(n.referrerPolicy=i.referrerPolicy),n.integrity==null&&(n.integrity=i.integrity)}var Wo=null;function Ly(n,i,a){if(Wo===null){var o=new Map,h=Wo=new Map;h.set(a,o)}else h=Wo,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[pn]||p[wt]||n==="link"&&p.getAttribute("rel")==="stylesheet")&&p.namespaceURI!=="http://www.w3.org/2000/svg"){var w=p.getAttribute(i)||"";w=n+w;var k=o.get(w);k?k.push(p):o.set(w,[p])}}return o}function zy(n,i,a){n=n.ownerDocument||n,n.head.insertBefore(a,i==="title"?n.querySelector("head > title"):null)}function Vw(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 Uy(n){return!(n.type==="stylesheet"&&(n.state.loading&3)===0)}function Yw(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=ea(o.href),p=i.querySelector(cl(h));if(p){i=p._p,i!==null&&typeof i=="object"&&typeof i.then=="function"&&(n.count++,n=eu.bind(n),i.then(n,n)),a.state.loading|=4,a.instance=p,Y(p);return}p=i.ownerDocument||i,o=My(o),(h=wr.get(h))&&rh(o,h),p=p.createElement("link"),Y(p);var w=p;w._p=new Promise(function(k,H){w.onload=k,w.onerror=H}),kn(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=eu.bind(n),i.addEventListener("load",a),i.addEventListener("error",a))}}var sh=0;function Gw(n,i){return n.stylesheets&&n.count===0&&nu(n,n.stylesheets),0<n.count||0<n.imgCount?function(a){var o=setTimeout(function(){if(n.stylesheets&&nu(n,n.stylesheets),n.unsuspend){var p=n.unsuspend;n.unsuspend=null,p()}},6e4+i);0<n.imgBytes&&sh===0&&(sh=62500*Aw());var h=setTimeout(function(){if(n.waitingForImages=!1,n.count===0&&(n.stylesheets&&nu(n,n.stylesheets),n.unsuspend)){var p=n.unsuspend;n.unsuspend=null,p()}},(n.imgBytes>sh?50:800)+i);return n.unsuspend=a,function(){n.unsuspend=null,clearTimeout(o),clearTimeout(h)}}:null}function eu(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)nu(this,this.stylesheets);else if(this.unsuspend){var n=this.unsuspend;this.unsuspend=null,n()}}}var tu=null;function nu(n,i){n.stylesheets=null,n.unsuspend!==null&&(n.count++,tu=new Map,i.forEach(Jw,n),tu=null,eu.call(n))}function Jw(n,i){if(!(i.state.loading&4)){var a=tu.get(n);if(a)var o=a.get(null);else{a=new Map,tu.set(n,a);for(var h=n.querySelectorAll("link[data-precedence],style[data-precedence]"),p=0;p<h.length;p++){var w=h[p];(w.nodeName==="LINK"||w.getAttribute("media")!=="not all")&&(a.set(w.dataset.precedence,w),o=w)}o&&a.set(null,o)}h=i.instance,w=h.getAttribute("data-precedence"),p=a.get(w)||o,p===o&&a.set(null,h),a.set(w,h),this.count++,o=eu.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 hl={$$typeof:I,Provider:null,Consumer:null,_currentValue:ae,_currentValue2:ae,_threadCount:0};function Xw(n,i,a,o,h,p,w,k,H){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=Fe(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Fe(0),this.hiddenUpdates=Fe(null),this.identifierPrefix=o,this.onUncaughtError=h,this.onCaughtError=p,this.onRecoverableError=w,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=H,this.incompleteTransitions=new Map}function Py(n,i,a,o,h,p,w,k,H,ne,fe,pe){return n=new Xw(n,i,a,w,H,ne,fe,pe,k),i=1,p===!0&&(i|=24),p=Qn(3,null,null,i),n.current=p,p.stateNode=n,i=Uc(),i.refCount++,n.pooledCache=i,i.refCount++,p.memoizedState={element:o,isDehydrated:a,cache:i},qc(p),n}function By(n){return n?(n=Rs,n):Rs}function Hy(n,i,a,o,h,p){h=By(h),o.context===null?o.context=h:o.pendingContext=h,o=Ei(i),o.payload={element:a},p=p===void 0?null:p,p!==null&&(o.callback=p),a=Ci(n,o,i),a!==null&&(Vn(a,n,i),$a(a,n,i))}function qy(n,i){if(n=n.memoizedState,n!==null&&n.dehydrated!==null){var a=n.retryLane;n.retryLane=a!==0&&a<i?a:i}}function ah(n,i){qy(n,i),(n=n.alternate)&&qy(n,i)}function Iy(n){if(n.tag===13||n.tag===31){var i=rs(n,67108864);i!==null&&Vn(i,n,67108864),ah(n,67108864)}}function Fy(n){if(n.tag===13||n.tag===31){var i=nr();i=It(i);var a=rs(n,i);a!==null&&Vn(a,n,i),ah(n,i)}}var ru=!0;function Kw(n,i,a,o){var h=$.T;$.T=null;var p=q.p;try{q.p=2,lh(n,i,a,o)}finally{q.p=p,$.T=h}}function Qw(n,i,a,o){var h=$.T;$.T=null;var p=q.p;try{q.p=8,lh(n,i,a,o)}finally{q.p=p,$.T=h}}function lh(n,i,a,o){if(ru){var h=oh(o);if(h===null)Gf(n,i,o,iu,a),Vy(n,o);else if(Ww(h,n,i,a,o))o.stopPropagation();else if(Vy(n,o),i&4&&-1<Zw.indexOf(n)){for(;h!==null;){var p=O(h);if(p!==null)switch(p.tag){case 3:if(p=p.stateNode,p.current.memoizedState.isDehydrated){var w=Jn(p.pendingLanes);if(w!==0){var k=p;for(k.pendingLanes|=2,k.entangledLanes|=2;w;){var H=1<<31-nt(w);k.entanglements[1]|=H,w&=~H}Hr(p),(vt&6)===0&&(Ho=$e()+500,al(0))}}break;case 31:case 13:k=rs(p,2),k!==null&&Vn(k,p,2),Io(),ah(p,2)}if(p=oh(o),p===null&&Gf(n,i,o,iu,a),p===h)break;h=p}h!==null&&o.stopPropagation()}else Gf(n,i,o,null,a)}}function oh(n){return n=uc(n),uh(n)}var iu=null;function uh(n){if(iu=null,n=E(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 iu=n,null}function $y(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(Tn()){case ce:return 2;case _e:return 8;case Le:case Ge:return 32;case et:return 268435456;default:return 32}default:return 32}}var ch=!1,Ui=null,Pi=null,Bi=null,dl=new Map,ml=new Map,Hi=[],Zw="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 Vy(n,i){switch(n){case"focusin":case"focusout":Ui=null;break;case"dragenter":case"dragleave":Pi=null;break;case"mouseover":case"mouseout":Bi=null;break;case"pointerover":case"pointerout":dl.delete(i.pointerId);break;case"gotpointercapture":case"lostpointercapture":ml.delete(i.pointerId)}}function pl(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=O(i),i!==null&&Iy(i)),n):(n.eventSystemFlags|=o,i=n.targetContainers,h!==null&&i.indexOf(h)===-1&&i.push(h),n)}function Ww(n,i,a,o,h){switch(i){case"focusin":return Ui=pl(Ui,n,i,a,o,h),!0;case"dragenter":return Pi=pl(Pi,n,i,a,o,h),!0;case"mouseover":return Bi=pl(Bi,n,i,a,o,h),!0;case"pointerover":var p=h.pointerId;return dl.set(p,pl(dl.get(p)||null,n,i,a,o,h)),!0;case"gotpointercapture":return p=h.pointerId,ml.set(p,pl(ml.get(p)||null,n,i,a,o,h)),!0}return!1}function Yy(n){var i=E(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,Zi(n.priority,function(){Fy(a)});return}}else if(i===31){if(i=f(a),i!==null){n.blockedOn=i,Zi(n.priority,function(){Fy(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 su(n){if(n.blockedOn!==null)return!1;for(var i=n.targetContainers;0<i.length;){var a=oh(n.nativeEvent);if(a===null){a=n.nativeEvent;var o=new a.constructor(a.type,a);oc=o,a.target.dispatchEvent(o),oc=null}else return i=O(a),i!==null&&Iy(i),n.blockedOn=a,!1;i.shift()}return!0}function Gy(n,i,a){su(n)&&a.delete(i)}function eS(){ch=!1,Ui!==null&&su(Ui)&&(Ui=null),Pi!==null&&su(Pi)&&(Pi=null),Bi!==null&&su(Bi)&&(Bi=null),dl.forEach(Gy),ml.forEach(Gy)}function au(n,i){n.blockedOn===i&&(n.blockedOn=null,ch||(ch=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,eS)))}var lu=null;function Jy(n){lu!==n&&(lu=n,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){lu===n&&(lu=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(uh(o||a)===null)continue;break}var p=O(a);p!==null&&(n.splice(i,3),i-=3,of(p,{pending:!0,data:h,method:a.method,action:o},o,h))}}))}function na(n){function i(H){return au(H,n)}Ui!==null&&au(Ui,n),Pi!==null&&au(Pi,n),Bi!==null&&au(Bi,n),dl.forEach(i),ml.forEach(i);for(var a=0;a<Hi.length;a++){var o=Hi[a];o.blockedOn===n&&(o.blockedOn=null)}for(;0<Hi.length&&(a=Hi[0],a.blockedOn===null);)Yy(a),a.blockedOn===null&&Hi.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],w=h[Zt]||null;if(typeof p=="function")w||Jy(a);else if(w){var k=null;if(p&&p.hasAttribute("formAction")){if(h=p,w=p[Zt]||null)k=w.formAction;else if(uh(h)!==null)continue}else k=w.action;typeof k=="function"?a[o+1]=k:(a.splice(o,3),o-=3),Jy(a)}}}function Xy(){function n(p){p.canIntercept&&p.info==="react-transition"&&p.intercept({handler:function(){return new Promise(function(w){return h=w})},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 fh(n){this._internalRoot=n}ou.prototype.render=fh.prototype.render=function(n){var i=this._internalRoot;if(i===null)throw Error(s(409));var a=i.current,o=nr();Hy(a,o,n,i,null,null)},ou.prototype.unmount=fh.prototype.unmount=function(){var n=this._internalRoot;if(n!==null){this._internalRoot=null;var i=n.containerInfo;Hy(n.current,2,null,n,null,null),Io(),i[Xn]=null}};function ou(n){this._internalRoot=n}ou.prototype.unstable_scheduleHydration=function(n){if(n){var i=Bn();n={blockedOn:null,target:n,priority:i};for(var a=0;a<Hi.length&&i!==0&&i<Hi[a].priority;a++);Hi.splice(a,0,n),a===0&&Yy(n)}};var Ky=t.version;if(Ky!=="19.2.4")throw Error(s(527,Ky,"19.2.4"));q.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=m(i),n=n!==null?y(n):null,n=n===null?null:n.stateNode,n};var tS={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:$,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var uu=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!uu.isDisabled&&uu.supportsFiber)try{Ct=uu.inject(tS),xt=uu}catch{}}return yl.createRoot=function(n,i){if(!l(n))throw Error(s(299));var a=!1,o="",h=rg,p=ig,w=sg;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&&(w=i.onRecoverableError)),i=Py(n,1,!1,null,null,a,o,null,h,p,w,Xy),n[Xn]=i.current,Yf(n),new fh(i)},yl.hydrateRoot=function(n,i,a){if(!l(n))throw Error(s(299));var o=!1,h="",p=rg,w=ig,k=sg,H=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&&(w=a.onCaughtError),a.onRecoverableError!==void 0&&(k=a.onRecoverableError),a.formState!==void 0&&(H=a.formState)),i=Py(n,1,!0,i,a??null,o,h,H,p,w,k,Xy),i.context=By(null),a=i.current,o=nr(),o=It(o),h=Ei(o),h.callback=null,Ci(a,h,o),a=o,i.current.lanes=a,ft(i,a),Hr(i),n[Xn]=i.current,Yf(n),new ou(i)},yl.version="19.2.4",yl}var a0;function hS(){if(a0)return mh.exports;a0=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(),mh.exports=fS(),mh.exports}var dS=hS();/**
43
+ `+ln+n+tn}var on=!1;function Rt(n,i){if(!n||on)return"";on=!0;var a=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var u={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(ue){var se=ue}Reflect.construct(n,[],ge)}else{try{ge.call()}catch(ue){se=ue}n.call(ge.prototype)}}else{try{throw Error()}catch(ue){se=ue}(ge=n())&&typeof ge.catch=="function"&&ge.catch(function(){})}}catch(ue){if(ue&&se&&typeof ue.stack=="string")return[ue.stack,se.stack]}return[null,null]}};u.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var h=Object.getOwnPropertyDescriptor(u.DetermineComponentFrameRoot,"name");h&&h.configurable&&Object.defineProperty(u.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var p=u.DetermineComponentFrameRoot(),w=p[0],_=p[1];if(w&&_){var H=w.split(`
44
+ `),ne=_.split(`
45
+ `);for(h=u=0;u<H.length&&!H[u].includes("DetermineComponentFrameRoot");)u++;for(;h<ne.length&&!ne[h].includes("DetermineComponentFrameRoot");)h++;if(u===H.length||h===ne.length)for(u=H.length-1,h=ne.length-1;1<=u&&0<=h&&H[u]!==ne[h];)h--;for(;1<=u&&0<=h;u--,h--)if(H[u]!==ne[h]){if(u!==1||h!==1)do if(u--,h--,0>h||H[u]!==ne[h]){var he=`
46
+ `+H[u].replace(" at new "," at ");return n.displayName&&he.includes("<anonymous>")&&(he=he.replace("<anonymous>",n.displayName)),he}while(1<=u&&0<=h);break}}}finally{on=!1,Error.prepareStackTrace=a}return(a=n?n.displayName||n.name:"")?Gt(a):""}function Kt(n,i){switch(n.tag){case 26:case 27:case 5:return Gt(n.type);case 16:return Gt("Lazy");case 13:return n.child!==i&&i!==null?Gt("Suspense Fallback"):Gt("Suspense");case 19:return Gt("SuspenseList");case 0:case 15:return Rt(n.type,!1);case 11:return Rt(n.type.render,!1);case 1:return Rt(n.type,!0);case 31:return Gt("Activity");default:return""}}function Pe(n){try{var i="",a=null;do i+=Kt(n,a),a=n,n=n.return;while(n);return i}catch(u){return`
47
+ Error generating stack: `+u.message+`
48
+ `+u.stack}}var ct=Object.prototype.hasOwnProperty,Ke=e.unstable_scheduleCallback,bt=e.unstable_cancelCallback,zt=e.unstable_shouldYield,Pn=e.unstable_requestPaint,$e=e.unstable_now,Tn=e.unstable_getCurrentPriorityLevel,fe=e.unstable_ImmediatePriority,Se=e.unstable_UserBlockingPriority,Le=e.unstable_NormalPriority,Ge=e.unstable_LowPriority,et=e.unstable_IdlePriority,un=e.log,vn=e.unstable_setDisableYieldValue,Ct=null,xt=null;function Jt(n){if(typeof un=="function"&&vn(n),xt&&typeof xt.setStrictMode=="function")try{xt.setStrictMode(Ct,n)}catch{}}var nt=Math.clz32?Math.clz32:Oe,ve=Math.log,Be=Math.LN2;function Oe(n){return n>>>=0,n===0?32:31-(ve(n)/Be|0)|0}var _t=256,Qt=262144,On=4194304;function Xn(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 xe(n,i,a){var u=n.pendingLanes;if(u===0)return 0;var h=0,p=n.suspendedLanes,w=n.pingedLanes;n=n.warmLanes;var _=u&134217727;return _!==0?(u=_&~p,u!==0?h=Xn(u):(w&=_,w!==0?h=Xn(w):a||(a=_&~n,a!==0&&(h=Xn(a))))):(_=u&~p,_!==0?h=Xn(_):w!==0?h=Xn(w):a||(a=u&~n,a!==0&&(h=Xn(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 Ae(n,i){return(n.pendingLanes&~(n.suspendedLanes&~n.pingedLanes)&i)===0}function Ye(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 We(){var n=On;return On<<=1,(On&62914560)===0&&(On=4194304),n}function Fe(n){for(var i=[],a=0;31>a;a++)i.push(n);return i}function ft(n,i){n.pendingLanes|=i,i!==268435456&&(n.suspendedLanes=0,n.pingedLanes=0,n.warmLanes=0)}function rt(n,i,a,u,h,p){var w=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 _=n.entanglements,H=n.expirationTimes,ne=n.hiddenUpdates;for(a=w&~a;0<a;){var he=31-nt(a),ge=1<<he;_[he]=0,H[he]=-1;var se=ne[he];if(se!==null)for(ne[he]=null,he=0;he<se.length;he++){var ue=se[he];ue!==null&&(ue.lane&=-536870913)}a&=~ge}u!==0&&Ie(n,u,0),p!==0&&h===0&&n.tag!==0&&(n.suspendedLanes|=p&~(w&~i))}function Ie(n,i,a){n.pendingLanes|=i,n.suspendedLanes&=~i;var u=31-nt(i);n.entangledLanes|=i,n.entanglements[u]=n.entanglements[u]|1073741824|a&261930}function mt(n,i){var a=n.entangledLanes|=i;for(n=n.entanglements;a;){var u=31-nt(a),h=1<<u;h&i|n[u]&i&&(n[u]|=i),a&=~h}}function Xt(n,i){var a=i&-i;return a=(a&42)!==0?1:It(a),(a&(n.suspendedLanes|i))!==0?0:a}function It(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 nn(n){return n&=-n,2<n?8<n?(n&134217727)!==0?32:268435456:8:2}function Bn(){var n=q.p;return n!==0?n:(n=window.event,n===void 0?32:Vy(n.type))}function Zi(n,i){var a=q.p;try{return q.p=n,i()}finally{q.p=a}}var Mt=Math.random().toString(36).slice(2),wt="__reactFiber$"+Mt,Zt="__reactProps$"+Mt,Kn="__reactContainer$"+Mt,Wi="__reactEvents$"+Mt,ja="__reactListeners$"+Mt,Ql="__reactHandles$"+Mt,Zl="__reactResources$"+Mt,pn="__reactMarker$"+Mt;function _s(n){delete n[wt],delete n[Zt],delete n[Wi],delete n[ja],delete n[Ql]}function k(n){var i=n[wt];if(i)return i;for(var a=n.parentNode;a;){if(i=a[Kn]||a[wt]){if(a=i.alternate,i.child!==null||a!==null&&a.child!==null)for(n=Ny(n);n!==null;){if(a=n[wt])return a;n=Ny(n)}return i}n=a,a=n.parentNode}return null}function R(n){if(n=n[wt]||n[Kn]){var i=n.tag;if(i===5||i===6||i===13||i===31||i===26||i===27||i===3)return n}return null}function N(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[Zl];return i||(i=n[Zl]={hoistableStyles:new Map,hoistableScripts:new Map}),i}function Y(n){n[pn]=!0}var Q=new Set,pe={};function ye(n,i){ae(n,i),ae(n+"Capture",i)}function ae(n,i){for(pe[n]=i,n=0;n<i.length;n++)Q.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]*$"),Me={},tt={};function Pt(n){return ct.call(tt,n)?!0:ct.call(Me,n)?!1:me.test(n)?tt[n]=!0:(Me[n]=!0,!1)}function En(n,i,a){if(Pt(i))if(a===null)n.removeAttribute(i);else{switch(typeof a){case"undefined":case"function":case"symbol":n.removeAttribute(i);return;case"boolean":var u=i.toLowerCase().slice(0,5);if(u!=="data-"&&u!=="aria-"){n.removeAttribute(i);return}}n.setAttribute(i,""+a)}}function Cr(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 Gr(n,i,a,u){if(u===null)n.removeAttribute(a);else{switch(typeof u){case"undefined":case"function":case"symbol":case"boolean":n.removeAttribute(a);return}n.setAttributeNS(i,a,""+u)}}function hr(n){switch(typeof n){case"bigint":case"boolean":case"number":case"string":case"undefined":return n;case"object":return n;default:return""}}function dm(n){var i=n.type;return(n=n.nodeName)&&n.toLowerCase()==="input"&&(i==="checkbox"||i==="radio")}function Z1(n,i,a){var u=Object.getOwnPropertyDescriptor(n.constructor.prototype,i);if(!n.hasOwnProperty(i)&&typeof u<"u"&&typeof u.get=="function"&&typeof u.set=="function"){var h=u.get,p=u.set;return Object.defineProperty(n,i,{configurable:!0,get:function(){return h.call(this)},set:function(w){a=""+w,p.call(this,w)}}),Object.defineProperty(n,i,{enumerable:u.enumerable}),{getValue:function(){return a},setValue:function(w){a=""+w},stopTracking:function(){n._valueTracker=null,delete n[i]}}}}function ic(n){if(!n._valueTracker){var i=dm(n)?"checked":"value";n._valueTracker=Z1(n,i,""+n[i])}}function mm(n){if(!n)return!1;var i=n._valueTracker;if(!i)return!0;var a=i.getValue(),u="";return n&&(u=dm(n)?n.checked?"true":"false":n.value),n=u,n!==a?(i.setValue(n),!0):!1}function Wl(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 W1=/[\n"\\]/g;function dr(n){return n.replace(W1,function(i){return"\\"+i.charCodeAt(0).toString(16)+" "})}function sc(n,i,a,u,h,p,w,_){n.name="",w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"?n.type=w:n.removeAttribute("type"),i!=null?w==="number"?(i===0&&n.value===""||n.value!=i)&&(n.value=""+hr(i)):n.value!==""+hr(i)&&(n.value=""+hr(i)):w!=="submit"&&w!=="reset"||n.removeAttribute("value"),i!=null?ac(n,w,hr(i)):a!=null?ac(n,w,hr(a)):u!=null&&n.removeAttribute("value"),h==null&&p!=null&&(n.defaultChecked=!!p),h!=null&&(n.checked=h&&typeof h!="function"&&typeof h!="symbol"),_!=null&&typeof _!="function"&&typeof _!="symbol"&&typeof _!="boolean"?n.name=""+hr(_):n.removeAttribute("name")}function pm(n,i,a,u,h,p,w,_){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)){ic(n);return}a=a!=null?""+hr(a):"",i=i!=null?""+hr(i):a,_||i===n.value||(n.value=i),n.defaultValue=i}u=u??h,u=typeof u!="function"&&typeof u!="symbol"&&!!u,n.checked=_?n.checked:!!u,n.defaultChecked=!!u,w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"&&(n.name=w),ic(n)}function ac(n,i,a){i==="number"&&Wl(n.ownerDocument)===n||n.defaultValue===""+a||(n.defaultValue=""+a)}function ks(n,i,a,u){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&&u&&(n[a].defaultSelected=!0)}else{for(a=""+hr(a),i=null,h=0;h<n.length;h++){if(n[h].value===a){n[h].selected=!0,u&&(n[h].defaultSelected=!0);return}i!==null||n[h].disabled||(i=n[h])}i!==null&&(i.selected=!0)}}function gm(n,i,a){if(i!=null&&(i=""+hr(i),i!==n.value&&(n.value=i),a==null)){n.defaultValue!==i&&(n.defaultValue=i);return}n.defaultValue=a!=null?""+hr(a):""}function ym(n,i,a,u){if(i==null){if(u!=null){if(a!=null)throw Error(s(92));if(re(u)){if(1<u.length)throw Error(s(93));u=u[0]}a=u}a==null&&(a=""),i=a}a=hr(i),n.defaultValue=a,u=n.textContent,u===a&&u!==""&&u!==null&&(n.value=u),ic(n)}function Es(n,i){if(i){var a=n.firstChild;if(a&&a===n.lastChild&&a.nodeType===3){a.nodeValue=i;return}}n.textContent=i}var ev=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 bm(n,i,a){var u=i.indexOf("--")===0;a==null||typeof a=="boolean"||a===""?u?n.setProperty(i,""):i==="float"?n.cssFloat="":n[i]="":u?n.setProperty(i,a):typeof a!="number"||a===0||ev.has(i)?i==="float"?n.cssFloat=a:n[i]=(""+a).trim():n[i]=a+"px"}function xm(n,i,a){if(i!=null&&typeof i!="object")throw Error(s(62));if(n=n.style,a!=null){for(var u in a)!a.hasOwnProperty(u)||i!=null&&i.hasOwnProperty(u)||(u.indexOf("--")===0?n.setProperty(u,""):u==="float"?n.cssFloat="":n[u]="");for(var h in i)u=i[h],i.hasOwnProperty(h)&&a[h]!==u&&bm(n,h,u)}else for(var p in i)i.hasOwnProperty(p)&&bm(n,p,i[p])}function lc(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 tv=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"]]),nv=/^[\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 eo(n){return nv.test(""+n)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":n}function Jr(){}var oc=null;function uc(n){return n=n.target||n.srcElement||window,n.correspondingUseElement&&(n=n.correspondingUseElement),n.nodeType===3?n.parentNode:n}var Cs=null,As=null;function vm(n){var i=R(n);if(i&&(n=i.stateNode)){var a=n[Zt]||null;e:switch(n=i.stateNode,i.type){case"input":if(sc(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="'+dr(""+i)+'"][type="radio"]'),i=0;i<a.length;i++){var u=a[i];if(u!==n&&u.form===n.form){var h=u[Zt]||null;if(!h)throw Error(s(90));sc(u,h.value,h.defaultValue,h.defaultValue,h.checked,h.defaultChecked,h.type,h.name)}}for(i=0;i<a.length;i++)u=a[i],u.form===n.form&&mm(u)}break e;case"textarea":gm(n,a.value,a.defaultValue);break e;case"select":i=a.value,i!=null&&ks(n,!!a.multiple,i,!1)}}}var cc=!1;function wm(n,i,a){if(cc)return n(i,a);cc=!0;try{var u=n(i);return u}finally{if(cc=!1,(Cs!==null||As!==null)&&(Io(),Cs&&(i=Cs,n=As,As=Cs=null,vm(i),n)))for(i=0;i<n.length;i++)vm(n[i])}}function Na(n,i){var a=n.stateNode;if(a===null)return null;var u=a[Zt]||null;if(u===null)return null;a=u[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":(u=!u.disabled)||(n=n.type,u=!(n==="button"||n==="input"||n==="select"||n==="textarea")),n=!u;break e;default:n=!1}if(n)return null;if(a&&typeof a!="function")throw Error(s(231,i,typeof a));return a}var Xr=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),fc=!1;if(Xr)try{var Ta={};Object.defineProperty(Ta,"passive",{get:function(){fc=!0}}),window.addEventListener("test",Ta,Ta),window.removeEventListener("test",Ta,Ta)}catch{fc=!1}var xi=null,hc=null,to=null;function Sm(){if(to)return to;var n,i=hc,a=i.length,u,h="value"in xi?xi.value:xi.textContent,p=h.length;for(n=0;n<a&&i[n]===h[n];n++);var w=a-n;for(u=1;u<=w&&i[a-u]===h[p-u];u++);return to=h.slice(n,1<u?1-u:void 0)}function no(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 ro(){return!0}function _m(){return!1}function Hn(n){function i(a,u,h,p,w){this._reactName=a,this._targetInst=h,this.type=u,this.nativeEvent=p,this.target=w,this.currentTarget=null;for(var _ in n)n.hasOwnProperty(_)&&(a=n[_],this[_]=a?a(p):p[_]);return this.isDefaultPrevented=(p.defaultPrevented!=null?p.defaultPrevented:p.returnValue===!1)?ro:_m,this.isPropagationStopped=_m,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=ro)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=ro)},persist:function(){},isPersistent:ro}),i}var es={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(n){return n.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},io=Hn(es),Oa=g({},es,{view:0,detail:0}),rv=Hn(Oa),dc,mc,Ra,so=g({},Oa,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:gc,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!==Ra&&(Ra&&n.type==="mousemove"?(dc=n.screenX-Ra.screenX,mc=n.screenY-Ra.screenY):mc=dc=0,Ra=n),dc)},movementY:function(n){return"movementY"in n?n.movementY:mc}}),km=Hn(so),iv=g({},so,{dataTransfer:0}),sv=Hn(iv),av=g({},Oa,{relatedTarget:0}),pc=Hn(av),lv=g({},es,{animationName:0,elapsedTime:0,pseudoElement:0}),ov=Hn(lv),uv=g({},es,{clipboardData:function(n){return"clipboardData"in n?n.clipboardData:window.clipboardData}}),cv=Hn(uv),fv=g({},es,{data:0}),Em=Hn(fv),hv={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},dv={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},mv={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function pv(n){var i=this.nativeEvent;return i.getModifierState?i.getModifierState(n):(n=mv[n])?!!i[n]:!1}function gc(){return pv}var gv=g({},Oa,{key:function(n){if(n.key){var i=hv[n.key]||n.key;if(i!=="Unidentified")return i}return n.type==="keypress"?(n=no(n),n===13?"Enter":String.fromCharCode(n)):n.type==="keydown"||n.type==="keyup"?dv[n.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:gc,charCode:function(n){return n.type==="keypress"?no(n):0},keyCode:function(n){return n.type==="keydown"||n.type==="keyup"?n.keyCode:0},which:function(n){return n.type==="keypress"?no(n):n.type==="keydown"||n.type==="keyup"?n.keyCode:0}}),yv=Hn(gv),bv=g({},so,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Cm=Hn(bv),xv=g({},Oa,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:gc}),vv=Hn(xv),wv=g({},es,{propertyName:0,elapsedTime:0,pseudoElement:0}),Sv=Hn(wv),_v=g({},so,{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}),kv=Hn(_v),Ev=g({},es,{newState:0,oldState:0}),Cv=Hn(Ev),Av=[9,13,27,32],yc=Xr&&"CompositionEvent"in window,Ma=null;Xr&&"documentMode"in document&&(Ma=document.documentMode);var jv=Xr&&"TextEvent"in window&&!Ma,Am=Xr&&(!yc||Ma&&8<Ma&&11>=Ma),jm=" ",Nm=!1;function Tm(n,i){switch(n){case"keyup":return Av.indexOf(i.keyCode)!==-1;case"keydown":return i.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Om(n){return n=n.detail,typeof n=="object"&&"data"in n?n.data:null}var js=!1;function Nv(n,i){switch(n){case"compositionend":return Om(i);case"keypress":return i.which!==32?null:(Nm=!0,jm);case"textInput":return n=i.data,n===jm&&Nm?null:n;default:return null}}function Tv(n,i){if(js)return n==="compositionend"||!yc&&Tm(n,i)?(n=Sm(),to=hc=xi=null,js=!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 Am&&i.locale!=="ko"?null:i.data;default:return null}}var Ov={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 Rm(n){var i=n&&n.nodeName&&n.nodeName.toLowerCase();return i==="input"?!!Ov[n.type]:i==="textarea"}function Mm(n,i,a,u){Cs?As?As.push(u):As=[u]:Cs=u,i=Xo(i,"onChange"),0<i.length&&(a=new io("onChange","change",null,a,u),n.push({event:a,listeners:i}))}var Da=null,La=null;function Rv(n){py(n,0)}function ao(n){var i=N(n);if(mm(i))return n}function Dm(n,i){if(n==="change")return i}var Lm=!1;if(Xr){var bc;if(Xr){var xc="oninput"in document;if(!xc){var zm=document.createElement("div");zm.setAttribute("oninput","return;"),xc=typeof zm.oninput=="function"}bc=xc}else bc=!1;Lm=bc&&(!document.documentMode||9<document.documentMode)}function Um(){Da&&(Da.detachEvent("onpropertychange",Pm),La=Da=null)}function Pm(n){if(n.propertyName==="value"&&ao(La)){var i=[];Mm(i,La,n,uc(n)),wm(Rv,i)}}function Mv(n,i,a){n==="focusin"?(Um(),Da=i,La=a,Da.attachEvent("onpropertychange",Pm)):n==="focusout"&&Um()}function Dv(n){if(n==="selectionchange"||n==="keyup"||n==="keydown")return ao(La)}function Lv(n,i){if(n==="click")return ao(i)}function zv(n,i){if(n==="input"||n==="change")return ao(i)}function Uv(n,i){return n===i&&(n!==0||1/n===1/i)||n!==n&&i!==i}var Qn=typeof Object.is=="function"?Object.is:Uv;function za(n,i){if(Qn(n,i))return!0;if(typeof n!="object"||n===null||typeof i!="object"||i===null)return!1;var a=Object.keys(n),u=Object.keys(i);if(a.length!==u.length)return!1;for(u=0;u<a.length;u++){var h=a[u];if(!ct.call(i,h)||!Qn(n[h],i[h]))return!1}return!0}function Bm(n){for(;n&&n.firstChild;)n=n.firstChild;return n}function Hm(n,i){var a=Bm(n);n=0;for(var u;a;){if(a.nodeType===3){if(u=n+a.textContent.length,n<=i&&u>=i)return{node:a,offset:i-n};n=u}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=Bm(a)}}function qm(n,i){return n&&i?n===i?!0:n&&n.nodeType===3?!1:i&&i.nodeType===3?qm(n,i.parentNode):"contains"in n?n.contains(i):n.compareDocumentPosition?!!(n.compareDocumentPosition(i)&16):!1:!1}function Im(n){n=n!=null&&n.ownerDocument!=null&&n.ownerDocument.defaultView!=null?n.ownerDocument.defaultView:window;for(var i=Wl(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=Wl(n.document)}return i}function vc(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 Pv=Xr&&"documentMode"in document&&11>=document.documentMode,Ns=null,wc=null,Ua=null,Sc=!1;function Fm(n,i,a){var u=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;Sc||Ns==null||Ns!==Wl(u)||(u=Ns,"selectionStart"in u&&vc(u)?u={start:u.selectionStart,end:u.selectionEnd}:(u=(u.ownerDocument&&u.ownerDocument.defaultView||window).getSelection(),u={anchorNode:u.anchorNode,anchorOffset:u.anchorOffset,focusNode:u.focusNode,focusOffset:u.focusOffset}),Ua&&za(Ua,u)||(Ua=u,u=Xo(wc,"onSelect"),0<u.length&&(i=new io("onSelect","select",null,i,a),n.push({event:i,listeners:u}),i.target=Ns)))}function ts(n,i){var a={};return a[n.toLowerCase()]=i.toLowerCase(),a["Webkit"+n]="webkit"+i,a["Moz"+n]="moz"+i,a}var Ts={animationend:ts("Animation","AnimationEnd"),animationiteration:ts("Animation","AnimationIteration"),animationstart:ts("Animation","AnimationStart"),transitionrun:ts("Transition","TransitionRun"),transitionstart:ts("Transition","TransitionStart"),transitioncancel:ts("Transition","TransitionCancel"),transitionend:ts("Transition","TransitionEnd")},_c={},$m={};Xr&&($m=document.createElement("div").style,"AnimationEvent"in window||(delete Ts.animationend.animation,delete Ts.animationiteration.animation,delete Ts.animationstart.animation),"TransitionEvent"in window||delete Ts.transitionend.transition);function ns(n){if(_c[n])return _c[n];if(!Ts[n])return n;var i=Ts[n],a;for(a in i)if(i.hasOwnProperty(a)&&a in $m)return _c[n]=i[a];return n}var Vm=ns("animationend"),Ym=ns("animationiteration"),Gm=ns("animationstart"),Bv=ns("transitionrun"),Hv=ns("transitionstart"),qv=ns("transitioncancel"),Jm=ns("transitionend"),Xm=new Map,kc="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(" ");kc.push("scrollEnd");function Ar(n,i){Xm.set(n,i),ye(i,[n])}var lo=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)},mr=[],Os=0,Ec=0;function oo(){for(var n=Os,i=Ec=Os=0;i<n;){var a=mr[i];mr[i++]=null;var u=mr[i];mr[i++]=null;var h=mr[i];mr[i++]=null;var p=mr[i];if(mr[i++]=null,u!==null&&h!==null){var w=u.pending;w===null?h.next=h:(h.next=w.next,w.next=h),u.pending=h}p!==0&&Km(a,h,p)}}function uo(n,i,a,u){mr[Os++]=n,mr[Os++]=i,mr[Os++]=a,mr[Os++]=u,Ec|=u,n.lanes|=u,n=n.alternate,n!==null&&(n.lanes|=u)}function Cc(n,i,a,u){return uo(n,i,a,u),co(n)}function rs(n,i){return uo(n,null,null,i),co(n)}function Km(n,i,a){n.lanes|=a;var u=n.alternate;u!==null&&(u.lanes|=a);for(var h=!1,p=n.return;p!==null;)p.childLanes|=a,u=p.alternate,u!==null&&(u.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-nt(a),n=p.hiddenUpdates,u=n[h],u===null?n[h]=[i]:u.push(i),i.lane=a|536870912),p):null}function co(n){if(50<sl)throw sl=0,zf=null,Error(s(185));for(var i=n.return;i!==null;)n=i,i=n.return;return n.tag===3?n.stateNode:null}var Rs={};function Iv(n,i,a,u){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=u,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Zn(n,i,a,u){return new Iv(n,i,a,u)}function Ac(n){return n=n.prototype,!(!n||!n.isReactComponent)}function Kr(n,i){var a=n.alternate;return a===null?(a=Zn(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 Qm(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 fo(n,i,a,u,h,p){var w=0;if(u=n,typeof n=="function")Ac(n)&&(w=1);else if(typeof n=="string")w=Gw(n,a,ie.current)?26:n==="html"||n==="head"||n==="body"?27:5;else e:switch(n){case V:return n=Zn(31,a,i,h),n.elementType=V,n.lanes=p,n;case A:return is(a.children,h,p,i);case M:w=8,h|=24;break;case T:return n=Zn(12,a,i,h|2),n.elementType=T,n.lanes=p,n;case B:return n=Zn(13,a,i,h),n.elementType=B,n.lanes=p,n;case D:return n=Zn(19,a,i,h),n.elementType=D,n.lanes=p,n;default:if(typeof n=="object"&&n!==null)switch(n.$$typeof){case I:w=10;break e;case P:w=9;break e;case W:w=11;break e;case Z:w=14;break e;case $:w=16,u=null;break e}w=29,a=Error(s(130,n===null?"null":typeof n,"")),u=null}return i=Zn(w,a,i,h),i.elementType=n,i.type=u,i.lanes=p,i}function is(n,i,a,u){return n=Zn(7,n,u,i),n.lanes=a,n}function jc(n,i,a){return n=Zn(6,n,null,i),n.lanes=a,n}function Zm(n){var i=Zn(18,null,null,0);return i.stateNode=n,i}function Nc(n,i,a){return i=Zn(4,n.children!==null?n.children:[],n.key,i),i.lanes=a,i.stateNode={containerInfo:n.containerInfo,pendingChildren:null,implementation:n.implementation},i}var Wm=new WeakMap;function pr(n,i){if(typeof n=="object"&&n!==null){var a=Wm.get(n);return a!==void 0?a:(i={value:n,source:i,stack:Pe(i)},Wm.set(n,i),i)}return{value:n,source:i,stack:Pe(i)}}var Ms=[],Ds=0,ho=null,Pa=0,gr=[],yr=0,vi=null,Ur=1,Pr="";function Qr(n,i){Ms[Ds++]=Pa,Ms[Ds++]=ho,ho=n,Pa=i}function ep(n,i,a){gr[yr++]=Ur,gr[yr++]=Pr,gr[yr++]=vi,vi=n;var u=Ur;n=Pr;var h=32-nt(u)-1;u&=~(1<<h),a+=1;var p=32-nt(i)+h;if(30<p){var w=h-h%5;p=(u&(1<<w)-1).toString(32),u>>=w,h-=w,Ur=1<<32-nt(i)+h|a<<h|u,Pr=p+n}else Ur=1<<p|a<<h|u,Pr=n}function Tc(n){n.return!==null&&(Qr(n,1),ep(n,1,0))}function Oc(n){for(;n===ho;)ho=Ms[--Ds],Ms[Ds]=null,Pa=Ms[--Ds],Ms[Ds]=null;for(;n===vi;)vi=gr[--yr],gr[yr]=null,Pr=gr[--yr],gr[yr]=null,Ur=gr[--yr],gr[yr]=null}function tp(n,i){gr[yr++]=Ur,gr[yr++]=Pr,gr[yr++]=vi,Ur=i.id,Pr=i.overflow,vi=n}var wn=null,Bt=null,ut=!1,wi=null,br=!1,Rc=Error(s(519));function Si(n){var i=Error(s(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Ba(pr(i,n)),Rc}function np(n){var i=n.stateNode,a=n.type,u=n.memoizedProps;switch(i[wt]=n,i[Zt]=u,a){case"dialog":st("cancel",i),st("close",i);break;case"iframe":case"object":case"embed":st("load",i);break;case"video":case"audio":for(a=0;a<ll.length;a++)st(ll[a],i);break;case"source":st("error",i);break;case"img":case"image":case"link":st("error",i),st("load",i);break;case"details":st("toggle",i);break;case"input":st("invalid",i),pm(i,u.value,u.defaultValue,u.checked,u.defaultChecked,u.type,u.name,!0);break;case"select":st("invalid",i);break;case"textarea":st("invalid",i),ym(i,u.value,u.defaultValue,u.children)}a=u.children,typeof a!="string"&&typeof a!="number"&&typeof a!="bigint"||i.textContent===""+a||u.suppressHydrationWarning===!0||xy(i.textContent,a)?(u.popover!=null&&(st("beforetoggle",i),st("toggle",i)),u.onScroll!=null&&st("scroll",i),u.onScrollEnd!=null&&st("scrollend",i),u.onClick!=null&&(i.onclick=Jr),i=!0):i=!1,i||Si(n,!0)}function rp(n){for(wn=n.return;wn;)switch(wn.tag){case 5:case 31:case 13:br=!1;return;case 27:case 3:br=!0;return;default:wn=wn.return}}function Ls(n){if(n!==wn)return!1;if(!ut)return rp(n),ut=!0,!1;var i=n.tag,a;if((a=i!==3&&i!==27)&&((a=i===5)&&(a=n.type,a=!(a!=="form"&&a!=="button")||Qf(n.type,n.memoizedProps)),a=!a),a&&Bt&&Si(n),rp(n),i===13){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(s(317));Bt=jy(n)}else if(i===31){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(s(317));Bt=jy(n)}else i===27?(i=Bt,zi(n.type)?(n=nh,nh=null,Bt=n):Bt=i):Bt=wn?vr(n.stateNode.nextSibling):null;return!0}function ss(){Bt=wn=null,ut=!1}function Mc(){var n=wi;return n!==null&&($n===null?$n=n:$n.push.apply($n,n),wi=null),n}function Ba(n){wi===null?wi=[n]:wi.push(n)}var Dc=U(null),as=null,Zr=null;function _i(n,i,a){j(Dc,i._currentValue),i._currentValue=a}function Wr(n){n._currentValue=Dc.current,ee(Dc)}function Lc(n,i,a){for(;n!==null;){var u=n.alternate;if((n.childLanes&i)!==i?(n.childLanes|=i,u!==null&&(u.childLanes|=i)):u!==null&&(u.childLanes&i)!==i&&(u.childLanes|=i),n===a)break;n=n.return}}function zc(n,i,a,u){var h=n.child;for(h!==null&&(h.return=n);h!==null;){var p=h.dependencies;if(p!==null){var w=h.child;p=p.firstContext;e:for(;p!==null;){var _=p;p=h;for(var H=0;H<i.length;H++)if(_.context===i[H]){p.lanes|=a,_=p.alternate,_!==null&&(_.lanes|=a),Lc(p.return,a,n),u||(w=null);break e}p=_.next}}else if(h.tag===18){if(w=h.return,w===null)throw Error(s(341));w.lanes|=a,p=w.alternate,p!==null&&(p.lanes|=a),Lc(w,a,n),w=null}else w=h.child;if(w!==null)w.return=h;else for(w=h;w!==null;){if(w===n){w=null;break}if(h=w.sibling,h!==null){h.return=w.return,w=h;break}w=w.return}h=w}}function zs(n,i,a,u){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 w=h.alternate;if(w===null)throw Error(s(387));if(w=w.memoizedProps,w!==null){var _=h.type;Qn(h.pendingProps.value,w.value)||(n!==null?n.push(_):n=[_])}}else if(h===Ee.current){if(w=h.alternate,w===null)throw Error(s(387));w.memoizedState.memoizedState!==h.memoizedState.memoizedState&&(n!==null?n.push(hl):n=[hl])}h=h.return}n!==null&&zc(i,n,a,u),i.flags|=262144}function mo(n){for(n=n.firstContext;n!==null;){if(!Qn(n.context._currentValue,n.memoizedValue))return!0;n=n.next}return!1}function ls(n){as=n,Zr=null,n=n.dependencies,n!==null&&(n.firstContext=null)}function Sn(n){return ip(as,n)}function po(n,i){return as===null&&ls(n),ip(n,i)}function ip(n,i){var a=i._currentValue;if(i={context:i,memoizedValue:a,next:null},Zr===null){if(n===null)throw Error(s(308));Zr=i,n.dependencies={lanes:0,firstContext:i},n.flags|=524288}else Zr=Zr.next=i;return a}var Fv=typeof AbortController<"u"?AbortController:function(){var n=[],i=this.signal={aborted:!1,addEventListener:function(a,u){n.push(u)}};this.abort=function(){i.aborted=!0,n.forEach(function(a){return a()})}},$v=e.unstable_scheduleCallback,Vv=e.unstable_NormalPriority,cn={$$typeof:I,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Uc(){return{controller:new Fv,data:new Map,refCount:0}}function Ha(n){n.refCount--,n.refCount===0&&$v(Vv,function(){n.controller.abort()})}var qa=null,Pc=0,Us=0,Ps=null;function Yv(n,i){if(qa===null){var a=qa=[];Pc=0,Us=If(),Ps={status:"pending",value:void 0,then:function(u){a.push(u)}}}return Pc++,i.then(sp,sp),i}function sp(){if(--Pc===0&&qa!==null){Ps!==null&&(Ps.status="fulfilled");var n=qa;qa=null,Us=0,Ps=null;for(var i=0;i<n.length;i++)(0,n[i])()}}function Gv(n,i){var a=[],u={status:"pending",value:null,reason:null,then:function(h){a.push(h)}};return n.then(function(){u.status="fulfilled",u.value=i;for(var h=0;h<a.length;h++)(0,a[h])(i)},function(h){for(u.status="rejected",u.reason=h,h=0;h<a.length;h++)(0,a[h])(void 0)}),u}var ap=F.S;F.S=function(n,i){Fg=$e(),typeof i=="object"&&i!==null&&typeof i.then=="function"&&Yv(n,i),ap!==null&&ap(n,i)};var os=U(null);function Bc(){var n=os.current;return n!==null?n:Dt.pooledCache}function go(n,i){i===null?j(os,os.current):j(os,i.pool)}function lp(){var n=Bc();return n===null?null:{parent:cn._currentValue,pool:n}}var Bs=Error(s(460)),Hc=Error(s(474)),yo=Error(s(542)),bo={then:function(){}};function op(n){return n=n.status,n==="fulfilled"||n==="rejected"}function up(n,i,a){switch(a=n[a],a===void 0?n.push(i):a!==i&&(i.then(Jr,Jr),i=a),i.status){case"fulfilled":return i.value;case"rejected":throw n=i.reason,fp(n),n;default:if(typeof i.status=="string")i.then(Jr,Jr);else{if(n=Dt,n!==null&&100<n.shellSuspendCounter)throw Error(s(482));n=i,n.status="pending",n.then(function(u){if(i.status==="pending"){var h=i;h.status="fulfilled",h.value=u}},function(u){if(i.status==="pending"){var h=i;h.status="rejected",h.reason=u}})}switch(i.status){case"fulfilled":return i.value;case"rejected":throw n=i.reason,fp(n),n}throw cs=i,Bs}}function us(n){try{var i=n._init;return i(n._payload)}catch(a){throw a!==null&&typeof a=="object"&&typeof a.then=="function"?(cs=a,Bs):a}}var cs=null;function cp(){if(cs===null)throw Error(s(459));var n=cs;return cs=null,n}function fp(n){if(n===Bs||n===yo)throw Error(s(483))}var Hs=null,Ia=0;function xo(n){var i=Ia;return Ia+=1,Hs===null&&(Hs=[]),up(Hs,n,i)}function Fa(n,i){i=i.props.ref,n.ref=i!==void 0?i:null}function vo(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 hp(n){function i(K,J){if(n){var te=K.deletions;te===null?(K.deletions=[J],K.flags|=16):te.push(J)}}function a(K,J){if(!n)return null;for(;J!==null;)i(K,J),J=J.sibling;return null}function u(K){for(var J=new Map;K!==null;)K.key!==null?J.set(K.key,K):J.set(K.index,K),K=K.sibling;return J}function h(K,J){return K=Kr(K,J),K.index=0,K.sibling=null,K}function p(K,J,te){return K.index=te,n?(te=K.alternate,te!==null?(te=te.index,te<J?(K.flags|=67108866,J):te):(K.flags|=67108866,J)):(K.flags|=1048576,J)}function w(K){return n&&K.alternate===null&&(K.flags|=67108866),K}function _(K,J,te,de){return J===null||J.tag!==6?(J=jc(te,K.mode,de),J.return=K,J):(J=h(J,te),J.return=K,J)}function H(K,J,te,de){var Ue=te.type;return Ue===A?he(K,J,te.props.children,de,te.key):J!==null&&(J.elementType===Ue||typeof Ue=="object"&&Ue!==null&&Ue.$$typeof===$&&us(Ue)===J.type)?(J=h(J,te.props),Fa(J,te),J.return=K,J):(J=fo(te.type,te.key,te.props,null,K.mode,de),Fa(J,te),J.return=K,J)}function ne(K,J,te,de){return J===null||J.tag!==4||J.stateNode.containerInfo!==te.containerInfo||J.stateNode.implementation!==te.implementation?(J=Nc(te,K.mode,de),J.return=K,J):(J=h(J,te.children||[]),J.return=K,J)}function he(K,J,te,de,Ue){return J===null||J.tag!==7?(J=is(te,K.mode,de,Ue),J.return=K,J):(J=h(J,te),J.return=K,J)}function ge(K,J,te){if(typeof J=="string"&&J!==""||typeof J=="number"||typeof J=="bigint")return J=jc(""+J,K.mode,te),J.return=K,J;if(typeof J=="object"&&J!==null){switch(J.$$typeof){case v:return te=fo(J.type,J.key,J.props,null,K.mode,te),Fa(te,J),te.return=K,te;case S:return J=Nc(J,K.mode,te),J.return=K,J;case $:return J=us(J),ge(K,J,te)}if(re(J)||G(J))return J=is(J,K.mode,te,null),J.return=K,J;if(typeof J.then=="function")return ge(K,xo(J),te);if(J.$$typeof===I)return ge(K,po(K,J),te);vo(K,J)}return null}function se(K,J,te,de){var Ue=J!==null?J.key:null;if(typeof te=="string"&&te!==""||typeof te=="number"||typeof te=="bigint")return Ue!==null?null:_(K,J,""+te,de);if(typeof te=="object"&&te!==null){switch(te.$$typeof){case v:return te.key===Ue?H(K,J,te,de):null;case S:return te.key===Ue?ne(K,J,te,de):null;case $:return te=us(te),se(K,J,te,de)}if(re(te)||G(te))return Ue!==null?null:he(K,J,te,de,null);if(typeof te.then=="function")return se(K,J,xo(te),de);if(te.$$typeof===I)return se(K,J,po(K,te),de);vo(K,te)}return null}function ue(K,J,te,de,Ue){if(typeof de=="string"&&de!==""||typeof de=="number"||typeof de=="bigint")return K=K.get(te)||null,_(J,K,""+de,Ue);if(typeof de=="object"&&de!==null){switch(de.$$typeof){case v:return K=K.get(de.key===null?te:de.key)||null,H(J,K,de,Ue);case S:return K=K.get(de.key===null?te:de.key)||null,ne(J,K,de,Ue);case $:return de=us(de),ue(K,J,te,de,Ue)}if(re(de)||G(de))return K=K.get(te)||null,he(J,K,de,Ue,null);if(typeof de.then=="function")return ue(K,J,te,xo(de),Ue);if(de.$$typeof===I)return ue(K,J,te,po(J,de),Ue);vo(J,de)}return null}function De(K,J,te,de){for(var Ue=null,gt=null,ze=J,Qe=J=0,ot=null;ze!==null&&Qe<te.length;Qe++){ze.index>Qe?(ot=ze,ze=null):ot=ze.sibling;var yt=se(K,ze,te[Qe],de);if(yt===null){ze===null&&(ze=ot);break}n&&ze&&yt.alternate===null&&i(K,ze),J=p(yt,J,Qe),gt===null?Ue=yt:gt.sibling=yt,gt=yt,ze=ot}if(Qe===te.length)return a(K,ze),ut&&Qr(K,Qe),Ue;if(ze===null){for(;Qe<te.length;Qe++)ze=ge(K,te[Qe],de),ze!==null&&(J=p(ze,J,Qe),gt===null?Ue=ze:gt.sibling=ze,gt=ze);return ut&&Qr(K,Qe),Ue}for(ze=u(ze);Qe<te.length;Qe++)ot=ue(ze,K,Qe,te[Qe],de),ot!==null&&(n&&ot.alternate!==null&&ze.delete(ot.key===null?Qe:ot.key),J=p(ot,J,Qe),gt===null?Ue=ot:gt.sibling=ot,gt=ot);return n&&ze.forEach(function(qi){return i(K,qi)}),ut&&Qr(K,Qe),Ue}function qe(K,J,te,de){if(te==null)throw Error(s(151));for(var Ue=null,gt=null,ze=J,Qe=J=0,ot=null,yt=te.next();ze!==null&&!yt.done;Qe++,yt=te.next()){ze.index>Qe?(ot=ze,ze=null):ot=ze.sibling;var qi=se(K,ze,yt.value,de);if(qi===null){ze===null&&(ze=ot);break}n&&ze&&qi.alternate===null&&i(K,ze),J=p(qi,J,Qe),gt===null?Ue=qi:gt.sibling=qi,gt=qi,ze=ot}if(yt.done)return a(K,ze),ut&&Qr(K,Qe),Ue;if(ze===null){for(;!yt.done;Qe++,yt=te.next())yt=ge(K,yt.value,de),yt!==null&&(J=p(yt,J,Qe),gt===null?Ue=yt:gt.sibling=yt,gt=yt);return ut&&Qr(K,Qe),Ue}for(ze=u(ze);!yt.done;Qe++,yt=te.next())yt=ue(ze,K,Qe,yt.value,de),yt!==null&&(n&&yt.alternate!==null&&ze.delete(yt.key===null?Qe:yt.key),J=p(yt,J,Qe),gt===null?Ue=yt:gt.sibling=yt,gt=yt);return n&&ze.forEach(function(iS){return i(K,iS)}),ut&&Qr(K,Qe),Ue}function Nt(K,J,te,de){if(typeof te=="object"&&te!==null&&te.type===A&&te.key===null&&(te=te.props.children),typeof te=="object"&&te!==null){switch(te.$$typeof){case v:e:{for(var Ue=te.key;J!==null;){if(J.key===Ue){if(Ue=te.type,Ue===A){if(J.tag===7){a(K,J.sibling),de=h(J,te.props.children),de.return=K,K=de;break e}}else if(J.elementType===Ue||typeof Ue=="object"&&Ue!==null&&Ue.$$typeof===$&&us(Ue)===J.type){a(K,J.sibling),de=h(J,te.props),Fa(de,te),de.return=K,K=de;break e}a(K,J);break}else i(K,J);J=J.sibling}te.type===A?(de=is(te.props.children,K.mode,de,te.key),de.return=K,K=de):(de=fo(te.type,te.key,te.props,null,K.mode,de),Fa(de,te),de.return=K,K=de)}return w(K);case S:e:{for(Ue=te.key;J!==null;){if(J.key===Ue)if(J.tag===4&&J.stateNode.containerInfo===te.containerInfo&&J.stateNode.implementation===te.implementation){a(K,J.sibling),de=h(J,te.children||[]),de.return=K,K=de;break e}else{a(K,J);break}else i(K,J);J=J.sibling}de=Nc(te,K.mode,de),de.return=K,K=de}return w(K);case $:return te=us(te),Nt(K,J,te,de)}if(re(te))return De(K,J,te,de);if(G(te)){if(Ue=G(te),typeof Ue!="function")throw Error(s(150));return te=Ue.call(te),qe(K,J,te,de)}if(typeof te.then=="function")return Nt(K,J,xo(te),de);if(te.$$typeof===I)return Nt(K,J,po(K,te),de);vo(K,te)}return typeof te=="string"&&te!==""||typeof te=="number"||typeof te=="bigint"?(te=""+te,J!==null&&J.tag===6?(a(K,J.sibling),de=h(J,te),de.return=K,K=de):(a(K,J),de=jc(te,K.mode,de),de.return=K,K=de),w(K)):a(K,J)}return function(K,J,te,de){try{Ia=0;var Ue=Nt(K,J,te,de);return Hs=null,Ue}catch(ze){if(ze===Bs||ze===yo)throw ze;var gt=Zn(29,ze,null,K.mode);return gt.lanes=de,gt.return=K,gt}finally{}}}var fs=hp(!0),dp=hp(!1),ki=!1;function qc(n){n.updateQueue={baseState:n.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Ic(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 Ei(n){return{lane:n,tag:0,payload:null,callback:null,next:null}}function Ci(n,i,a){var u=n.updateQueue;if(u===null)return null;if(u=u.shared,(vt&2)!==0){var h=u.pending;return h===null?i.next=i:(i.next=h.next,h.next=i),u.pending=i,i=co(n),Km(n,null,a),i}return uo(n,u,i,a),co(n)}function $a(n,i,a){if(i=i.updateQueue,i!==null&&(i=i.shared,(a&4194048)!==0)){var u=i.lanes;u&=n.pendingLanes,a|=u,i.lanes=a,mt(n,a)}}function Fc(n,i){var a=n.updateQueue,u=n.alternate;if(u!==null&&(u=u.updateQueue,a===u)){var h=null,p=null;if(a=a.firstBaseUpdate,a!==null){do{var w={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};p===null?h=p=w:p=p.next=w,a=a.next}while(a!==null);p===null?h=p=i:p=p.next=i}else h=p=i;a={baseState:u.baseState,firstBaseUpdate:h,lastBaseUpdate:p,shared:u.shared,callbacks:u.callbacks},n.updateQueue=a;return}n=a.lastBaseUpdate,n===null?a.firstBaseUpdate=i:n.next=i,a.lastBaseUpdate=i}var $c=!1;function Va(){if($c){var n=Ps;if(n!==null)throw n}}function Ya(n,i,a,u){$c=!1;var h=n.updateQueue;ki=!1;var p=h.firstBaseUpdate,w=h.lastBaseUpdate,_=h.shared.pending;if(_!==null){h.shared.pending=null;var H=_,ne=H.next;H.next=null,w===null?p=ne:w.next=ne,w=H;var he=n.alternate;he!==null&&(he=he.updateQueue,_=he.lastBaseUpdate,_!==w&&(_===null?he.firstBaseUpdate=ne:_.next=ne,he.lastBaseUpdate=H))}if(p!==null){var ge=h.baseState;w=0,he=ne=H=null,_=p;do{var se=_.lane&-536870913,ue=se!==_.lane;if(ue?(lt&se)===se:(u&se)===se){se!==0&&se===Us&&($c=!0),he!==null&&(he=he.next={lane:0,tag:_.tag,payload:_.payload,callback:null,next:null});e:{var De=n,qe=_;se=i;var Nt=a;switch(qe.tag){case 1:if(De=qe.payload,typeof De=="function"){ge=De.call(Nt,ge,se);break e}ge=De;break e;case 3:De.flags=De.flags&-65537|128;case 0:if(De=qe.payload,se=typeof De=="function"?De.call(Nt,ge,se):De,se==null)break e;ge=g({},ge,se);break e;case 2:ki=!0}}se=_.callback,se!==null&&(n.flags|=64,ue&&(n.flags|=8192),ue=h.callbacks,ue===null?h.callbacks=[se]:ue.push(se))}else ue={lane:se,tag:_.tag,payload:_.payload,callback:_.callback,next:null},he===null?(ne=he=ue,H=ge):he=he.next=ue,w|=se;if(_=_.next,_===null){if(_=h.shared.pending,_===null)break;ue=_,_=ue.next,ue.next=null,h.lastBaseUpdate=ue,h.shared.pending=null}}while(!0);he===null&&(H=ge),h.baseState=H,h.firstBaseUpdate=ne,h.lastBaseUpdate=he,p===null&&(h.shared.lanes=0),Oi|=w,n.lanes=w,n.memoizedState=ge}}function mp(n,i){if(typeof n!="function")throw Error(s(191,n));n.call(i)}function pp(n,i){var a=n.callbacks;if(a!==null)for(n.callbacks=null,n=0;n<a.length;n++)mp(a[n],i)}var qs=U(null),wo=U(0);function gp(n,i){n=oi,j(wo,n),j(qs,i),oi=n|i.baseLanes}function Vc(){j(wo,oi),j(qs,qs.current)}function Yc(){oi=wo.current,ee(qs),ee(wo)}var Wn=U(null),xr=null;function Ai(n){var i=n.alternate;j(rn,rn.current&1),j(Wn,n),xr===null&&(i===null||qs.current!==null||i.memoizedState!==null)&&(xr=n)}function Gc(n){j(rn,rn.current),j(Wn,n),xr===null&&(xr=n)}function yp(n){n.tag===22?(j(rn,rn.current),j(Wn,n),xr===null&&(xr=n)):ji()}function ji(){j(rn,rn.current),j(Wn,Wn.current)}function er(n){ee(Wn),xr===n&&(xr=null),ee(rn)}var rn=U(0);function So(n){for(var i=n;i!==null;){if(i.tag===13){var a=i.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||eh(a)||th(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 ei=0,Xe=null,At=null,fn=null,_o=!1,Is=!1,hs=!1,ko=0,Ga=0,Fs=null,Jv=0;function Wt(){throw Error(s(321))}function Jc(n,i){if(i===null)return!1;for(var a=0;a<i.length&&a<n.length;a++)if(!Qn(n[a],i[a]))return!1;return!0}function Xc(n,i,a,u,h,p){return ei=p,Xe=i,i.memoizedState=null,i.updateQueue=null,i.lanes=0,F.H=n===null||n.memoizedState===null?eg:ff,hs=!1,p=a(u,h),hs=!1,Is&&(p=xp(i,a,u,h)),bp(n),p}function bp(n){F.H=Ka;var i=At!==null&&At.next!==null;if(ei=0,fn=At=Xe=null,_o=!1,Ga=0,Fs=null,i)throw Error(s(300));n===null||hn||(n=n.dependencies,n!==null&&mo(n)&&(hn=!0))}function xp(n,i,a,u){Xe=n;var h=0;do{if(Is&&(Fs=null),Ga=0,Is=!1,25<=h)throw Error(s(301));if(h+=1,fn=At=null,n.updateQueue!=null){var p=n.updateQueue;p.lastEffect=null,p.events=null,p.stores=null,p.memoCache!=null&&(p.memoCache.index=0)}F.H=tg,p=i(a,u)}while(Is);return p}function Xv(){var n=F.H,i=n.useState()[0];return i=typeof i.then=="function"?Ja(i):i,n=n.useState()[0],(At!==null?At.memoizedState:null)!==n&&(Xe.flags|=1024),i}function Kc(){var n=ko!==0;return ko=0,n}function Qc(n,i,a){i.updateQueue=n.updateQueue,i.flags&=-2053,n.lanes&=~a}function Zc(n){if(_o){for(n=n.memoizedState;n!==null;){var i=n.queue;i!==null&&(i.pending=null),n=n.next}_o=!1}ei=0,fn=At=Xe=null,Is=!1,Ga=ko=0,Fs=null}function Rn(){var n={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return fn===null?Xe.memoizedState=fn=n:fn=fn.next=n,fn}function sn(){if(At===null){var n=Xe.alternate;n=n!==null?n.memoizedState:null}else n=At.next;var i=fn===null?Xe.memoizedState:fn.next;if(i!==null)fn=i,At=n;else{if(n===null)throw Xe.alternate===null?Error(s(467)):Error(s(310));At=n,n={memoizedState:At.memoizedState,baseState:At.baseState,baseQueue:At.baseQueue,queue:At.queue,next:null},fn===null?Xe.memoizedState=fn=n:fn=fn.next=n}return fn}function Eo(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Ja(n){var i=Ga;return Ga+=1,Fs===null&&(Fs=[]),n=up(Fs,n,i),i=Xe,(fn===null?i.memoizedState:fn.next)===null&&(i=i.alternate,F.H=i===null||i.memoizedState===null?eg:ff),n}function Co(n){if(n!==null&&typeof n=="object"){if(typeof n.then=="function")return Ja(n);if(n.$$typeof===I)return Sn(n)}throw Error(s(438,String(n)))}function Wc(n){var i=null,a=Xe.updateQueue;if(a!==null&&(i=a.memoCache),i==null){var u=Xe.alternate;u!==null&&(u=u.updateQueue,u!==null&&(u=u.memoCache,u!=null&&(i={data:u.data.map(function(h){return h.slice()}),index:0})))}if(i==null&&(i={data:[],index:0}),a===null&&(a=Eo(),Xe.updateQueue=a),a.memoCache=i,a=i.data[i.index],a===void 0)for(a=i.data[i.index]=Array(n),u=0;u<n;u++)a[u]=L;return i.index++,a}function ti(n,i){return typeof i=="function"?i(n):i}function Ao(n){var i=sn();return ef(i,At,n)}function ef(n,i,a){var u=n.queue;if(u===null)throw Error(s(311));u.lastRenderedReducer=a;var h=n.baseQueue,p=u.pending;if(p!==null){if(h!==null){var w=h.next;h.next=p.next,p.next=w}i.baseQueue=h=p,u.pending=null}if(p=n.baseState,h===null)n.memoizedState=p;else{i=h.next;var _=w=null,H=null,ne=i,he=!1;do{var ge=ne.lane&-536870913;if(ge!==ne.lane?(lt&ge)===ge:(ei&ge)===ge){var se=ne.revertLane;if(se===0)H!==null&&(H=H.next={lane:0,revertLane:0,gesture:null,action:ne.action,hasEagerState:ne.hasEagerState,eagerState:ne.eagerState,next:null}),ge===Us&&(he=!0);else if((ei&se)===se){ne=ne.next,se===Us&&(he=!0);continue}else ge={lane:0,revertLane:ne.revertLane,gesture:null,action:ne.action,hasEagerState:ne.hasEagerState,eagerState:ne.eagerState,next:null},H===null?(_=H=ge,w=p):H=H.next=ge,Xe.lanes|=se,Oi|=se;ge=ne.action,hs&&a(p,ge),p=ne.hasEagerState?ne.eagerState:a(p,ge)}else se={lane:ge,revertLane:ne.revertLane,gesture:ne.gesture,action:ne.action,hasEagerState:ne.hasEagerState,eagerState:ne.eagerState,next:null},H===null?(_=H=se,w=p):H=H.next=se,Xe.lanes|=ge,Oi|=ge;ne=ne.next}while(ne!==null&&ne!==i);if(H===null?w=p:H.next=_,!Qn(p,n.memoizedState)&&(hn=!0,he&&(a=Ps,a!==null)))throw a;n.memoizedState=p,n.baseState=w,n.baseQueue=H,u.lastRenderedState=p}return h===null&&(u.lanes=0),[n.memoizedState,u.dispatch]}function tf(n){var i=sn(),a=i.queue;if(a===null)throw Error(s(311));a.lastRenderedReducer=n;var u=a.dispatch,h=a.pending,p=i.memoizedState;if(h!==null){a.pending=null;var w=h=h.next;do p=n(p,w.action),w=w.next;while(w!==h);Qn(p,i.memoizedState)||(hn=!0),i.memoizedState=p,i.baseQueue===null&&(i.baseState=p),a.lastRenderedState=p}return[p,u]}function vp(n,i,a){var u=Xe,h=sn(),p=ut;if(p){if(a===void 0)throw Error(s(407));a=a()}else a=i();var w=!Qn((At||h).memoizedState,a);if(w&&(h.memoizedState=a,hn=!0),h=h.queue,sf(_p.bind(null,u,h,n),[n]),h.getSnapshot!==i||w||fn!==null&&fn.memoizedState.tag&1){if(u.flags|=2048,$s(9,{destroy:void 0},Sp.bind(null,u,h,a,i),null),Dt===null)throw Error(s(349));p||(ei&127)!==0||wp(u,i,a)}return a}function wp(n,i,a){n.flags|=16384,n={getSnapshot:i,value:a},i=Xe.updateQueue,i===null?(i=Eo(),Xe.updateQueue=i,i.stores=[n]):(a=i.stores,a===null?i.stores=[n]:a.push(n))}function Sp(n,i,a,u){i.value=a,i.getSnapshot=u,kp(i)&&Ep(n)}function _p(n,i,a){return a(function(){kp(i)&&Ep(n)})}function kp(n){var i=n.getSnapshot;n=n.value;try{var a=i();return!Qn(n,a)}catch{return!0}}function Ep(n){var i=rs(n,2);i!==null&&Vn(i,n,2)}function nf(n){var i=Rn();if(typeof n=="function"){var a=n;if(n=a(),hs){Jt(!0);try{a()}finally{Jt(!1)}}}return i.memoizedState=i.baseState=n,i.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ti,lastRenderedState:n},i}function Cp(n,i,a,u){return n.baseState=a,ef(n,At,typeof u=="function"?u:ti)}function Kv(n,i,a,u,h){if(To(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(w){p.listeners.push(w)}};F.T!==null?a(!0):p.isTransition=!1,u(p),a=i.pending,a===null?(p.next=i.pending=p,Ap(i,p)):(p.next=a.next,i.pending=a.next=p)}}function Ap(n,i){var a=i.action,u=i.payload,h=n.state;if(i.isTransition){var p=F.T,w={};F.T=w;try{var _=a(h,u),H=F.S;H!==null&&H(w,_),jp(n,i,_)}catch(ne){rf(n,i,ne)}finally{p!==null&&w.types!==null&&(p.types=w.types),F.T=p}}else try{p=a(h,u),jp(n,i,p)}catch(ne){rf(n,i,ne)}}function jp(n,i,a){a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(function(u){Np(n,i,u)},function(u){return rf(n,i,u)}):Np(n,i,a)}function Np(n,i,a){i.status="fulfilled",i.value=a,Tp(i),n.state=a,i=n.pending,i!==null&&(a=i.next,a===i?n.pending=null:(a=a.next,i.next=a,Ap(n,a)))}function rf(n,i,a){var u=n.pending;if(n.pending=null,u!==null){u=u.next;do i.status="rejected",i.reason=a,Tp(i),i=i.next;while(i!==u)}n.action=null}function Tp(n){n=n.listeners;for(var i=0;i<n.length;i++)(0,n[i])()}function Op(n,i){return i}function Rp(n,i){if(ut){var a=Dt.formState;if(a!==null){e:{var u=Xe;if(ut){if(Bt){t:{for(var h=Bt,p=br;h.nodeType!==8;){if(!p){h=null;break t}if(h=vr(h.nextSibling),h===null){h=null;break t}}p=h.data,h=p==="F!"||p==="F"?h:null}if(h){Bt=vr(h.nextSibling),u=h.data==="F!";break e}}Si(u)}u=!1}u&&(i=a[0])}}return a=Rn(),a.memoizedState=a.baseState=i,u={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Op,lastRenderedState:i},a.queue=u,a=Qp.bind(null,Xe,u),u.dispatch=a,u=nf(!1),p=cf.bind(null,Xe,!1,u.queue),u=Rn(),h={state:i,dispatch:null,action:n,pending:null},u.queue=h,a=Kv.bind(null,Xe,h,p,a),h.dispatch=a,u.memoizedState=n,[i,a,!1]}function Mp(n){var i=sn();return Dp(i,At,n)}function Dp(n,i,a){if(i=ef(n,i,Op)[0],n=Ao(ti)[0],typeof i=="object"&&i!==null&&typeof i.then=="function")try{var u=Ja(i)}catch(w){throw w===Bs?yo:w}else u=i;i=sn();var h=i.queue,p=h.dispatch;return a!==i.memoizedState&&(Xe.flags|=2048,$s(9,{destroy:void 0},Qv.bind(null,h,a),null)),[u,p,n]}function Qv(n,i){n.action=i}function Lp(n){var i=sn(),a=At;if(a!==null)return Dp(i,a,n);sn(),i=i.memoizedState,a=sn();var u=a.queue.dispatch;return a.memoizedState=n,[i,u,!1]}function $s(n,i,a,u){return n={tag:n,create:a,deps:u,inst:i,next:null},i=Xe.updateQueue,i===null&&(i=Eo(),Xe.updateQueue=i),a=i.lastEffect,a===null?i.lastEffect=n.next=n:(u=a.next,a.next=n,n.next=u,i.lastEffect=n),n}function zp(){return sn().memoizedState}function jo(n,i,a,u){var h=Rn();Xe.flags|=n,h.memoizedState=$s(1|i,{destroy:void 0},a,u===void 0?null:u)}function No(n,i,a,u){var h=sn();u=u===void 0?null:u;var p=h.memoizedState.inst;At!==null&&u!==null&&Jc(u,At.memoizedState.deps)?h.memoizedState=$s(i,p,a,u):(Xe.flags|=n,h.memoizedState=$s(1|i,p,a,u))}function Up(n,i){jo(8390656,8,n,i)}function sf(n,i){No(2048,8,n,i)}function Zv(n){Xe.flags|=4;var i=Xe.updateQueue;if(i===null)i=Eo(),Xe.updateQueue=i,i.events=[n];else{var a=i.events;a===null?i.events=[n]:a.push(n)}}function Pp(n){var i=sn().memoizedState;return Zv({ref:i,nextImpl:n}),function(){if((vt&2)!==0)throw Error(s(440));return i.impl.apply(void 0,arguments)}}function Bp(n,i){return No(4,2,n,i)}function Hp(n,i){return No(4,4,n,i)}function qp(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 Ip(n,i,a){a=a!=null?a.concat([n]):null,No(4,4,qp.bind(null,i,n),a)}function af(){}function Fp(n,i){var a=sn();i=i===void 0?null:i;var u=a.memoizedState;return i!==null&&Jc(i,u[1])?u[0]:(a.memoizedState=[n,i],n)}function $p(n,i){var a=sn();i=i===void 0?null:i;var u=a.memoizedState;if(i!==null&&Jc(i,u[1]))return u[0];if(u=n(),hs){Jt(!0);try{n()}finally{Jt(!1)}}return a.memoizedState=[u,i],u}function lf(n,i,a){return a===void 0||(ei&1073741824)!==0&&(lt&261930)===0?n.memoizedState=i:(n.memoizedState=a,n=Vg(),Xe.lanes|=n,Oi|=n,a)}function Vp(n,i,a,u){return Qn(a,i)?a:qs.current!==null?(n=lf(n,a,u),Qn(n,i)||(hn=!0),n):(ei&42)===0||(ei&1073741824)!==0&&(lt&261930)===0?(hn=!0,n.memoizedState=a):(n=Vg(),Xe.lanes|=n,Oi|=n,i)}function Yp(n,i,a,u,h){var p=q.p;q.p=p!==0&&8>p?p:8;var w=F.T,_={};F.T=_,cf(n,!1,i,a);try{var H=h(),ne=F.S;if(ne!==null&&ne(_,H),H!==null&&typeof H=="object"&&typeof H.then=="function"){var he=Gv(H,u);Xa(n,i,he,rr(n))}else Xa(n,i,u,rr(n))}catch(ge){Xa(n,i,{then:function(){},status:"rejected",reason:ge},rr())}finally{q.p=p,w!==null&&_.types!==null&&(w.types=_.types),F.T=w}}function Wv(){}function of(n,i,a,u){if(n.tag!==5)throw Error(s(476));var h=Gp(n).queue;Yp(n,h,i,le,a===null?Wv:function(){return Jp(n),a(u)})}function Gp(n){var i=n.memoizedState;if(i!==null)return i;i={memoizedState:le,baseState:le,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ti,lastRenderedState:le},next:null};var a={};return i.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ti,lastRenderedState:a},next:null},n.memoizedState=i,n=n.alternate,n!==null&&(n.memoizedState=i),i}function Jp(n){var i=Gp(n);i.next===null&&(i=n.alternate.memoizedState),Xa(n,i.next.queue,{},rr())}function uf(){return Sn(hl)}function Xp(){return sn().memoizedState}function Kp(){return sn().memoizedState}function ew(n){for(var i=n.return;i!==null;){switch(i.tag){case 24:case 3:var a=rr();n=Ei(a);var u=Ci(i,n,a);u!==null&&(Vn(u,i,a),$a(u,i,a)),i={cache:Uc()},n.payload=i;return}i=i.return}}function tw(n,i,a){var u=rr();a={lane:u,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},To(n)?Zp(i,a):(a=Cc(n,i,a,u),a!==null&&(Vn(a,n,u),Wp(a,i,u)))}function Qp(n,i,a){var u=rr();Xa(n,i,a,u)}function Xa(n,i,a,u){var h={lane:u,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(To(n))Zp(i,h);else{var p=n.alternate;if(n.lanes===0&&(p===null||p.lanes===0)&&(p=i.lastRenderedReducer,p!==null))try{var w=i.lastRenderedState,_=p(w,a);if(h.hasEagerState=!0,h.eagerState=_,Qn(_,w))return uo(n,i,h,0),Dt===null&&oo(),!1}catch{}finally{}if(a=Cc(n,i,h,u),a!==null)return Vn(a,n,u),Wp(a,i,u),!0}return!1}function cf(n,i,a,u){if(u={lane:2,revertLane:If(),gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null},To(n)){if(i)throw Error(s(479))}else i=Cc(n,a,u,2),i!==null&&Vn(i,n,2)}function To(n){var i=n.alternate;return n===Xe||i!==null&&i===Xe}function Zp(n,i){Is=_o=!0;var a=n.pending;a===null?i.next=i:(i.next=a.next,a.next=i),n.pending=i}function Wp(n,i,a){if((a&4194048)!==0){var u=i.lanes;u&=n.pendingLanes,a|=u,i.lanes=a,mt(n,a)}}var Ka={readContext:Sn,use:Co,useCallback:Wt,useContext:Wt,useEffect:Wt,useImperativeHandle:Wt,useLayoutEffect:Wt,useInsertionEffect:Wt,useMemo:Wt,useReducer:Wt,useRef:Wt,useState:Wt,useDebugValue:Wt,useDeferredValue:Wt,useTransition:Wt,useSyncExternalStore:Wt,useId:Wt,useHostTransitionStatus:Wt,useFormState:Wt,useActionState:Wt,useOptimistic:Wt,useMemoCache:Wt,useCacheRefresh:Wt};Ka.useEffectEvent=Wt;var eg={readContext:Sn,use:Co,useCallback:function(n,i){return Rn().memoizedState=[n,i===void 0?null:i],n},useContext:Sn,useEffect:Up,useImperativeHandle:function(n,i,a){a=a!=null?a.concat([n]):null,jo(4194308,4,qp.bind(null,i,n),a)},useLayoutEffect:function(n,i){return jo(4194308,4,n,i)},useInsertionEffect:function(n,i){jo(4,2,n,i)},useMemo:function(n,i){var a=Rn();i=i===void 0?null:i;var u=n();if(hs){Jt(!0);try{n()}finally{Jt(!1)}}return a.memoizedState=[u,i],u},useReducer:function(n,i,a){var u=Rn();if(a!==void 0){var h=a(i);if(hs){Jt(!0);try{a(i)}finally{Jt(!1)}}}else h=i;return u.memoizedState=u.baseState=h,n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:n,lastRenderedState:h},u.queue=n,n=n.dispatch=tw.bind(null,Xe,n),[u.memoizedState,n]},useRef:function(n){var i=Rn();return n={current:n},i.memoizedState=n},useState:function(n){n=nf(n);var i=n.queue,a=Qp.bind(null,Xe,i);return i.dispatch=a,[n.memoizedState,a]},useDebugValue:af,useDeferredValue:function(n,i){var a=Rn();return lf(a,n,i)},useTransition:function(){var n=nf(!1);return n=Yp.bind(null,Xe,n.queue,!0,!1),Rn().memoizedState=n,[!1,n]},useSyncExternalStore:function(n,i,a){var u=Xe,h=Rn();if(ut){if(a===void 0)throw Error(s(407));a=a()}else{if(a=i(),Dt===null)throw Error(s(349));(lt&127)!==0||wp(u,i,a)}h.memoizedState=a;var p={value:a,getSnapshot:i};return h.queue=p,Up(_p.bind(null,u,p,n),[n]),u.flags|=2048,$s(9,{destroy:void 0},Sp.bind(null,u,p,a,i),null),a},useId:function(){var n=Rn(),i=Dt.identifierPrefix;if(ut){var a=Pr,u=Ur;a=(u&~(1<<32-nt(u)-1)).toString(32)+a,i="_"+i+"R_"+a,a=ko++,0<a&&(i+="H"+a.toString(32)),i+="_"}else a=Jv++,i="_"+i+"r_"+a.toString(32)+"_";return n.memoizedState=i},useHostTransitionStatus:uf,useFormState:Rp,useActionState:Rp,useOptimistic:function(n){var i=Rn();i.memoizedState=i.baseState=n;var a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return i.queue=a,i=cf.bind(null,Xe,!0,a),a.dispatch=i,[n,i]},useMemoCache:Wc,useCacheRefresh:function(){return Rn().memoizedState=ew.bind(null,Xe)},useEffectEvent:function(n){var i=Rn(),a={impl:n};return i.memoizedState=a,function(){if((vt&2)!==0)throw Error(s(440));return a.impl.apply(void 0,arguments)}}},ff={readContext:Sn,use:Co,useCallback:Fp,useContext:Sn,useEffect:sf,useImperativeHandle:Ip,useInsertionEffect:Bp,useLayoutEffect:Hp,useMemo:$p,useReducer:Ao,useRef:zp,useState:function(){return Ao(ti)},useDebugValue:af,useDeferredValue:function(n,i){var a=sn();return Vp(a,At.memoizedState,n,i)},useTransition:function(){var n=Ao(ti)[0],i=sn().memoizedState;return[typeof n=="boolean"?n:Ja(n),i]},useSyncExternalStore:vp,useId:Xp,useHostTransitionStatus:uf,useFormState:Mp,useActionState:Mp,useOptimistic:function(n,i){var a=sn();return Cp(a,At,n,i)},useMemoCache:Wc,useCacheRefresh:Kp};ff.useEffectEvent=Pp;var tg={readContext:Sn,use:Co,useCallback:Fp,useContext:Sn,useEffect:sf,useImperativeHandle:Ip,useInsertionEffect:Bp,useLayoutEffect:Hp,useMemo:$p,useReducer:tf,useRef:zp,useState:function(){return tf(ti)},useDebugValue:af,useDeferredValue:function(n,i){var a=sn();return At===null?lf(a,n,i):Vp(a,At.memoizedState,n,i)},useTransition:function(){var n=tf(ti)[0],i=sn().memoizedState;return[typeof n=="boolean"?n:Ja(n),i]},useSyncExternalStore:vp,useId:Xp,useHostTransitionStatus:uf,useFormState:Lp,useActionState:Lp,useOptimistic:function(n,i){var a=sn();return At!==null?Cp(a,At,n,i):(a.baseState=n,[n,a.queue.dispatch])},useMemoCache:Wc,useCacheRefresh:Kp};tg.useEffectEvent=Pp;function hf(n,i,a,u){i=n.memoizedState,a=a(u,i),a=a==null?i:g({},i,a),n.memoizedState=a,n.lanes===0&&(n.updateQueue.baseState=a)}var df={enqueueSetState:function(n,i,a){n=n._reactInternals;var u=rr(),h=Ei(u);h.payload=i,a!=null&&(h.callback=a),i=Ci(n,h,u),i!==null&&(Vn(i,n,u),$a(i,n,u))},enqueueReplaceState:function(n,i,a){n=n._reactInternals;var u=rr(),h=Ei(u);h.tag=1,h.payload=i,a!=null&&(h.callback=a),i=Ci(n,h,u),i!==null&&(Vn(i,n,u),$a(i,n,u))},enqueueForceUpdate:function(n,i){n=n._reactInternals;var a=rr(),u=Ei(a);u.tag=2,i!=null&&(u.callback=i),i=Ci(n,u,a),i!==null&&(Vn(i,n,a),$a(i,n,a))}};function ng(n,i,a,u,h,p,w){return n=n.stateNode,typeof n.shouldComponentUpdate=="function"?n.shouldComponentUpdate(u,p,w):i.prototype&&i.prototype.isPureReactComponent?!za(a,u)||!za(h,p):!0}function rg(n,i,a,u){n=i.state,typeof i.componentWillReceiveProps=="function"&&i.componentWillReceiveProps(a,u),typeof i.UNSAFE_componentWillReceiveProps=="function"&&i.UNSAFE_componentWillReceiveProps(a,u),i.state!==n&&df.enqueueReplaceState(i,i.state,null)}function ds(n,i){var a=i;if("ref"in i){a={};for(var u in i)u!=="ref"&&(a[u]=i[u])}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 ig(n){lo(n)}function sg(n){console.error(n)}function ag(n){lo(n)}function Oo(n,i){try{var a=n.onUncaughtError;a(i.value,{componentStack:i.stack})}catch(u){setTimeout(function(){throw u})}}function lg(n,i,a){try{var u=n.onCaughtError;u(a.value,{componentStack:a.stack,errorBoundary:i.tag===1?i.stateNode:null})}catch(h){setTimeout(function(){throw h})}}function mf(n,i,a){return a=Ei(a),a.tag=3,a.payload={element:null},a.callback=function(){Oo(n,i)},a}function og(n){return n=Ei(n),n.tag=3,n}function ug(n,i,a,u){var h=a.type.getDerivedStateFromError;if(typeof h=="function"){var p=u.value;n.payload=function(){return h(p)},n.callback=function(){lg(i,a,u)}}var w=a.stateNode;w!==null&&typeof w.componentDidCatch=="function"&&(n.callback=function(){lg(i,a,u),typeof h!="function"&&(Ri===null?Ri=new Set([this]):Ri.add(this));var _=u.stack;this.componentDidCatch(u.value,{componentStack:_!==null?_:""})})}function nw(n,i,a,u,h){if(a.flags|=32768,u!==null&&typeof u=="object"&&typeof u.then=="function"){if(i=a.alternate,i!==null&&zs(i,a,h,!0),a=Wn.current,a!==null){switch(a.tag){case 31:case 13:return xr===null?Fo():a.alternate===null&&en===0&&(en=3),a.flags&=-257,a.flags|=65536,a.lanes=h,u===bo?a.flags|=16384:(i=a.updateQueue,i===null?a.updateQueue=new Set([u]):i.add(u),Bf(n,u,h)),!1;case 22:return a.flags|=65536,u===bo?a.flags|=16384:(i=a.updateQueue,i===null?(i={transitions:null,markerInstances:null,retryQueue:new Set([u])},a.updateQueue=i):(a=i.retryQueue,a===null?i.retryQueue=new Set([u]):a.add(u)),Bf(n,u,h)),!1}throw Error(s(435,a.tag))}return Bf(n,u,h),Fo(),!1}if(ut)return i=Wn.current,i!==null?((i.flags&65536)===0&&(i.flags|=256),i.flags|=65536,i.lanes=h,u!==Rc&&(n=Error(s(422),{cause:u}),Ba(pr(n,a)))):(u!==Rc&&(i=Error(s(423),{cause:u}),Ba(pr(i,a))),n=n.current.alternate,n.flags|=65536,h&=-h,n.lanes|=h,u=pr(u,a),h=mf(n.stateNode,u,h),Fc(n,h),en!==4&&(en=2)),!1;var p=Error(s(520),{cause:u});if(p=pr(p,a),il===null?il=[p]:il.push(p),en!==4&&(en=2),i===null)return!0;u=pr(u,a),a=i;do{switch(a.tag){case 3:return a.flags|=65536,n=h&-h,a.lanes|=n,n=mf(a.stateNode,u,n),Fc(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"&&(Ri===null||!Ri.has(p))))return a.flags|=65536,h&=-h,a.lanes|=h,h=og(h),ug(h,n,a,u),Fc(a,h),!1}a=a.return}while(a!==null);return!1}var pf=Error(s(461)),hn=!1;function _n(n,i,a,u){i.child=n===null?dp(i,null,a,u):fs(i,n.child,a,u)}function cg(n,i,a,u,h){a=a.render;var p=i.ref;if("ref"in u){var w={};for(var _ in u)_!=="ref"&&(w[_]=u[_])}else w=u;return ls(i),u=Xc(n,i,a,w,p,h),_=Kc(),n!==null&&!hn?(Qc(n,i,h),ni(n,i,h)):(ut&&_&&Tc(i),i.flags|=1,_n(n,i,u,h),i.child)}function fg(n,i,a,u,h){if(n===null){var p=a.type;return typeof p=="function"&&!Ac(p)&&p.defaultProps===void 0&&a.compare===null?(i.tag=15,i.type=p,hg(n,i,p,u,h)):(n=fo(a.type,null,u,i,i.mode,h),n.ref=i.ref,n.return=i,i.child=n)}if(p=n.child,!_f(n,h)){var w=p.memoizedProps;if(a=a.compare,a=a!==null?a:za,a(w,u)&&n.ref===i.ref)return ni(n,i,h)}return i.flags|=1,n=Kr(p,u),n.ref=i.ref,n.return=i,i.child=n}function hg(n,i,a,u,h){if(n!==null){var p=n.memoizedProps;if(za(p,u)&&n.ref===i.ref)if(hn=!1,i.pendingProps=u=p,_f(n,h))(n.flags&131072)!==0&&(hn=!0);else return i.lanes=n.lanes,ni(n,i,h)}return gf(n,i,a,u,h)}function dg(n,i,a,u){var h=u.children,p=n!==null?n.memoizedState:null;if(n===null&&i.stateNode===null&&(i.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),u.mode==="hidden"){if((i.flags&128)!==0){if(p=p!==null?p.baseLanes|a:a,n!==null){for(u=i.child=n.child,h=0;u!==null;)h=h|u.lanes|u.childLanes,u=u.sibling;u=h&~p}else u=0,i.child=null;return mg(n,i,p,a,u)}if((a&536870912)!==0)i.memoizedState={baseLanes:0,cachePool:null},n!==null&&go(i,p!==null?p.cachePool:null),p!==null?gp(i,p):Vc(),yp(i);else return u=i.lanes=536870912,mg(n,i,p!==null?p.baseLanes|a:a,a,u)}else p!==null?(go(i,p.cachePool),gp(i,p),ji(),i.memoizedState=null):(n!==null&&go(i,null),Vc(),ji());return _n(n,i,h,a),i.child}function Qa(n,i){return n!==null&&n.tag===22||i.stateNode!==null||(i.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),i.sibling}function mg(n,i,a,u,h){var p=Bc();return p=p===null?null:{parent:cn._currentValue,pool:p},i.memoizedState={baseLanes:a,cachePool:p},n!==null&&go(i,null),Vc(),yp(i),n!==null&&zs(n,i,u,!0),i.childLanes=h,null}function Ro(n,i){return i=Do({mode:i.mode,children:i.children},n.mode),i.ref=n.ref,n.child=i,i.return=n,i}function pg(n,i,a){return fs(i,n.child,null,a),n=Ro(i,i.pendingProps),n.flags|=2,er(i),i.memoizedState=null,n}function rw(n,i,a){var u=i.pendingProps,h=(i.flags&128)!==0;if(i.flags&=-129,n===null){if(ut){if(u.mode==="hidden")return n=Ro(i,u),i.lanes=536870912,Qa(null,n);if(Gc(i),(n=Bt)?(n=Ay(n,br),n=n!==null&&n.data==="&"?n:null,n!==null&&(i.memoizedState={dehydrated:n,treeContext:vi!==null?{id:Ur,overflow:Pr}:null,retryLane:536870912,hydrationErrors:null},a=Zm(n),a.return=i,i.child=a,wn=i,Bt=null)):n=null,n===null)throw Si(i);return i.lanes=536870912,null}return Ro(i,u)}var p=n.memoizedState;if(p!==null){var w=p.dehydrated;if(Gc(i),h)if(i.flags&256)i.flags&=-257,i=pg(n,i,a);else if(i.memoizedState!==null)i.child=n.child,i.flags|=128,i=null;else throw Error(s(558));else if(hn||zs(n,i,a,!1),h=(a&n.childLanes)!==0,hn||h){if(u=Dt,u!==null&&(w=Xt(u,a),w!==0&&w!==p.retryLane))throw p.retryLane=w,rs(n,w),Vn(u,n,w),pf;Fo(),i=pg(n,i,a)}else n=p.treeContext,Bt=vr(w.nextSibling),wn=i,ut=!0,wi=null,br=!1,n!==null&&tp(i,n),i=Ro(i,u),i.flags|=4096;return i}return n=Kr(n.child,{mode:u.mode,children:u.children}),n.ref=i.ref,i.child=n,n.return=i,n}function Mo(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 gf(n,i,a,u,h){return ls(i),a=Xc(n,i,a,u,void 0,h),u=Kc(),n!==null&&!hn?(Qc(n,i,h),ni(n,i,h)):(ut&&u&&Tc(i),i.flags|=1,_n(n,i,a,h),i.child)}function gg(n,i,a,u,h,p){return ls(i),i.updateQueue=null,a=xp(i,u,a,h),bp(n),u=Kc(),n!==null&&!hn?(Qc(n,i,p),ni(n,i,p)):(ut&&u&&Tc(i),i.flags|=1,_n(n,i,a,p),i.child)}function yg(n,i,a,u,h){if(ls(i),i.stateNode===null){var p=Rs,w=a.contextType;typeof w=="object"&&w!==null&&(p=Sn(w)),p=new a(u,p),i.memoizedState=p.state!==null&&p.state!==void 0?p.state:null,p.updater=df,i.stateNode=p,p._reactInternals=i,p=i.stateNode,p.props=u,p.state=i.memoizedState,p.refs={},qc(i),w=a.contextType,p.context=typeof w=="object"&&w!==null?Sn(w):Rs,p.state=i.memoizedState,w=a.getDerivedStateFromProps,typeof w=="function"&&(hf(i,a,w,u),p.state=i.memoizedState),typeof a.getDerivedStateFromProps=="function"||typeof p.getSnapshotBeforeUpdate=="function"||typeof p.UNSAFE_componentWillMount!="function"&&typeof p.componentWillMount!="function"||(w=p.state,typeof p.componentWillMount=="function"&&p.componentWillMount(),typeof p.UNSAFE_componentWillMount=="function"&&p.UNSAFE_componentWillMount(),w!==p.state&&df.enqueueReplaceState(p,p.state,null),Ya(i,u,p,h),Va(),p.state=i.memoizedState),typeof p.componentDidMount=="function"&&(i.flags|=4194308),u=!0}else if(n===null){p=i.stateNode;var _=i.memoizedProps,H=ds(a,_);p.props=H;var ne=p.context,he=a.contextType;w=Rs,typeof he=="object"&&he!==null&&(w=Sn(he));var ge=a.getDerivedStateFromProps;he=typeof ge=="function"||typeof p.getSnapshotBeforeUpdate=="function",_=i.pendingProps!==_,he||typeof p.UNSAFE_componentWillReceiveProps!="function"&&typeof p.componentWillReceiveProps!="function"||(_||ne!==w)&&rg(i,p,u,w),ki=!1;var se=i.memoizedState;p.state=se,Ya(i,u,p,h),Va(),ne=i.memoizedState,_||se!==ne||ki?(typeof ge=="function"&&(hf(i,a,ge,u),ne=i.memoizedState),(H=ki||ng(i,a,H,u,se,ne,w))?(he||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=u,i.memoizedState=ne),p.props=u,p.state=ne,p.context=w,u=H):(typeof p.componentDidMount=="function"&&(i.flags|=4194308),u=!1)}else{p=i.stateNode,Ic(n,i),w=i.memoizedProps,he=ds(a,w),p.props=he,ge=i.pendingProps,se=p.context,ne=a.contextType,H=Rs,typeof ne=="object"&&ne!==null&&(H=Sn(ne)),_=a.getDerivedStateFromProps,(ne=typeof _=="function"||typeof p.getSnapshotBeforeUpdate=="function")||typeof p.UNSAFE_componentWillReceiveProps!="function"&&typeof p.componentWillReceiveProps!="function"||(w!==ge||se!==H)&&rg(i,p,u,H),ki=!1,se=i.memoizedState,p.state=se,Ya(i,u,p,h),Va();var ue=i.memoizedState;w!==ge||se!==ue||ki||n!==null&&n.dependencies!==null&&mo(n.dependencies)?(typeof _=="function"&&(hf(i,a,_,u),ue=i.memoizedState),(he=ki||ng(i,a,he,u,se,ue,H)||n!==null&&n.dependencies!==null&&mo(n.dependencies))?(ne||typeof p.UNSAFE_componentWillUpdate!="function"&&typeof p.componentWillUpdate!="function"||(typeof p.componentWillUpdate=="function"&&p.componentWillUpdate(u,ue,H),typeof p.UNSAFE_componentWillUpdate=="function"&&p.UNSAFE_componentWillUpdate(u,ue,H)),typeof p.componentDidUpdate=="function"&&(i.flags|=4),typeof p.getSnapshotBeforeUpdate=="function"&&(i.flags|=1024)):(typeof p.componentDidUpdate!="function"||w===n.memoizedProps&&se===n.memoizedState||(i.flags|=4),typeof p.getSnapshotBeforeUpdate!="function"||w===n.memoizedProps&&se===n.memoizedState||(i.flags|=1024),i.memoizedProps=u,i.memoizedState=ue),p.props=u,p.state=ue,p.context=H,u=he):(typeof p.componentDidUpdate!="function"||w===n.memoizedProps&&se===n.memoizedState||(i.flags|=4),typeof p.getSnapshotBeforeUpdate!="function"||w===n.memoizedProps&&se===n.memoizedState||(i.flags|=1024),u=!1)}return p=u,Mo(n,i),u=(i.flags&128)!==0,p||u?(p=i.stateNode,a=u&&typeof a.getDerivedStateFromError!="function"?null:p.render(),i.flags|=1,n!==null&&u?(i.child=fs(i,n.child,null,h),i.child=fs(i,null,a,h)):_n(n,i,a,h),i.memoizedState=p.state,n=i.child):n=ni(n,i,h),n}function bg(n,i,a,u){return ss(),i.flags|=256,_n(n,i,a,u),i.child}var yf={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function bf(n){return{baseLanes:n,cachePool:lp()}}function xf(n,i,a){return n=n!==null?n.childLanes&~a:0,i&&(n|=nr),n}function xg(n,i,a){var u=i.pendingProps,h=!1,p=(i.flags&128)!==0,w;if((w=p)||(w=n!==null&&n.memoizedState===null?!1:(rn.current&2)!==0),w&&(h=!0,i.flags&=-129),w=(i.flags&32)!==0,i.flags&=-33,n===null){if(ut){if(h?Ai(i):ji(),(n=Bt)?(n=Ay(n,br),n=n!==null&&n.data!=="&"?n:null,n!==null&&(i.memoizedState={dehydrated:n,treeContext:vi!==null?{id:Ur,overflow:Pr}:null,retryLane:536870912,hydrationErrors:null},a=Zm(n),a.return=i,i.child=a,wn=i,Bt=null)):n=null,n===null)throw Si(i);return th(n)?i.lanes=32:i.lanes=536870912,null}var _=u.children;return u=u.fallback,h?(ji(),h=i.mode,_=Do({mode:"hidden",children:_},h),u=is(u,h,a,null),_.return=i,u.return=i,_.sibling=u,i.child=_,u=i.child,u.memoizedState=bf(a),u.childLanes=xf(n,w,a),i.memoizedState=yf,Qa(null,u)):(Ai(i),vf(i,_))}var H=n.memoizedState;if(H!==null&&(_=H.dehydrated,_!==null)){if(p)i.flags&256?(Ai(i),i.flags&=-257,i=wf(n,i,a)):i.memoizedState!==null?(ji(),i.child=n.child,i.flags|=128,i=null):(ji(),_=u.fallback,h=i.mode,u=Do({mode:"visible",children:u.children},h),_=is(_,h,a,null),_.flags|=2,u.return=i,_.return=i,u.sibling=_,i.child=u,fs(i,n.child,null,a),u=i.child,u.memoizedState=bf(a),u.childLanes=xf(n,w,a),i.memoizedState=yf,i=Qa(null,u));else if(Ai(i),th(_)){if(w=_.nextSibling&&_.nextSibling.dataset,w)var ne=w.dgst;w=ne,u=Error(s(419)),u.stack="",u.digest=w,Ba({value:u,source:null,stack:null}),i=wf(n,i,a)}else if(hn||zs(n,i,a,!1),w=(a&n.childLanes)!==0,hn||w){if(w=Dt,w!==null&&(u=Xt(w,a),u!==0&&u!==H.retryLane))throw H.retryLane=u,rs(n,u),Vn(w,n,u),pf;eh(_)||Fo(),i=wf(n,i,a)}else eh(_)?(i.flags|=192,i.child=n.child,i=null):(n=H.treeContext,Bt=vr(_.nextSibling),wn=i,ut=!0,wi=null,br=!1,n!==null&&tp(i,n),i=vf(i,u.children),i.flags|=4096);return i}return h?(ji(),_=u.fallback,h=i.mode,H=n.child,ne=H.sibling,u=Kr(H,{mode:"hidden",children:u.children}),u.subtreeFlags=H.subtreeFlags&65011712,ne!==null?_=Kr(ne,_):(_=is(_,h,a,null),_.flags|=2),_.return=i,u.return=i,u.sibling=_,i.child=u,Qa(null,u),u=i.child,_=n.child.memoizedState,_===null?_=bf(a):(h=_.cachePool,h!==null?(H=cn._currentValue,h=h.parent!==H?{parent:H,pool:H}:h):h=lp(),_={baseLanes:_.baseLanes|a,cachePool:h}),u.memoizedState=_,u.childLanes=xf(n,w,a),i.memoizedState=yf,Qa(n.child,u)):(Ai(i),a=n.child,n=a.sibling,a=Kr(a,{mode:"visible",children:u.children}),a.return=i,a.sibling=null,n!==null&&(w=i.deletions,w===null?(i.deletions=[n],i.flags|=16):w.push(n)),i.child=a,i.memoizedState=null,a)}function vf(n,i){return i=Do({mode:"visible",children:i},n.mode),i.return=n,n.child=i}function Do(n,i){return n=Zn(22,n,null,i),n.lanes=0,n}function wf(n,i,a){return fs(i,n.child,null,a),n=vf(i,i.pendingProps.children),n.flags|=2,i.memoizedState=null,n}function vg(n,i,a){n.lanes|=i;var u=n.alternate;u!==null&&(u.lanes|=i),Lc(n.return,i,a)}function Sf(n,i,a,u,h,p){var w=n.memoizedState;w===null?n.memoizedState={isBackwards:i,rendering:null,renderingStartTime:0,last:u,tail:a,tailMode:h,treeForkCount:p}:(w.isBackwards=i,w.rendering=null,w.renderingStartTime=0,w.last=u,w.tail=a,w.tailMode=h,w.treeForkCount=p)}function wg(n,i,a){var u=i.pendingProps,h=u.revealOrder,p=u.tail;u=u.children;var w=rn.current,_=(w&2)!==0;if(_?(w=w&1|2,i.flags|=128):w&=1,j(rn,w),_n(n,i,u,a),u=ut?Pa:0,!_&&n!==null&&(n.flags&128)!==0)e:for(n=i.child;n!==null;){if(n.tag===13)n.memoizedState!==null&&vg(n,a,i);else if(n.tag===19)vg(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&&So(n)===null&&(h=a),a=a.sibling;a=h,a===null?(h=i.child,i.child=null):(h=a.sibling,a.sibling=null),Sf(i,!1,h,a,p,u);break;case"backwards":case"unstable_legacy-backwards":for(a=null,h=i.child,i.child=null;h!==null;){if(n=h.alternate,n!==null&&So(n)===null){i.child=h;break}n=h.sibling,h.sibling=a,a=h,h=n}Sf(i,!0,a,null,p,u);break;case"together":Sf(i,!1,null,null,void 0,u);break;default:i.memoizedState=null}return i.child}function ni(n,i,a){if(n!==null&&(i.dependencies=n.dependencies),Oi|=i.lanes,(a&i.childLanes)===0)if(n!==null){if(zs(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=Kr(n,n.pendingProps),i.child=a,a.return=i;n.sibling!==null;)n=n.sibling,a=a.sibling=Kr(n,n.pendingProps),a.return=i;a.sibling=null}return i.child}function _f(n,i){return(n.lanes&i)!==0?!0:(n=n.dependencies,!!(n!==null&&mo(n)))}function iw(n,i,a){switch(i.tag){case 3:Ve(i,i.stateNode.containerInfo),_i(i,cn,n.memoizedState.cache),ss();break;case 27:case 5:dt(i);break;case 4:Ve(i,i.stateNode.containerInfo);break;case 10:_i(i,i.type,i.memoizedProps.value);break;case 31:if(i.memoizedState!==null)return i.flags|=128,Gc(i),null;break;case 13:var u=i.memoizedState;if(u!==null)return u.dehydrated!==null?(Ai(i),i.flags|=128,null):(a&i.child.childLanes)!==0?xg(n,i,a):(Ai(i),n=ni(n,i,a),n!==null?n.sibling:null);Ai(i);break;case 19:var h=(n.flags&128)!==0;if(u=(a&i.childLanes)!==0,u||(zs(n,i,a,!1),u=(a&i.childLanes)!==0),h){if(u)return wg(n,i,a);i.flags|=128}if(h=i.memoizedState,h!==null&&(h.rendering=null,h.tail=null,h.lastEffect=null),j(rn,rn.current),u)break;return null;case 22:return i.lanes=0,dg(n,i,a,i.pendingProps);case 24:_i(i,cn,n.memoizedState.cache)}return ni(n,i,a)}function Sg(n,i,a){if(n!==null)if(n.memoizedProps!==i.pendingProps)hn=!0;else{if(!_f(n,a)&&(i.flags&128)===0)return hn=!1,iw(n,i,a);hn=(n.flags&131072)!==0}else hn=!1,ut&&(i.flags&1048576)!==0&&ep(i,Pa,i.index);switch(i.lanes=0,i.tag){case 16:e:{var u=i.pendingProps;if(n=us(i.elementType),i.type=n,typeof n=="function")Ac(n)?(u=ds(n,u),i.tag=1,i=yg(null,i,n,u,a)):(i.tag=0,i=gf(null,i,n,u,a));else{if(n!=null){var h=n.$$typeof;if(h===W){i.tag=11,i=cg(null,i,n,u,a);break e}else if(h===Z){i.tag=14,i=fg(null,i,n,u,a);break e}}throw i=oe(n)||n,Error(s(306,i,""))}}return i;case 0:return gf(n,i,i.type,i.pendingProps,a);case 1:return u=i.type,h=ds(u,i.pendingProps),yg(n,i,u,h,a);case 3:e:{if(Ve(i,i.stateNode.containerInfo),n===null)throw Error(s(387));u=i.pendingProps;var p=i.memoizedState;h=p.element,Ic(n,i),Ya(i,u,null,a);var w=i.memoizedState;if(u=w.cache,_i(i,cn,u),u!==p.cache&&zc(i,[cn],a,!0),Va(),u=w.element,p.isDehydrated)if(p={element:u,isDehydrated:!1,cache:w.cache},i.updateQueue.baseState=p,i.memoizedState=p,i.flags&256){i=bg(n,i,u,a);break e}else if(u!==h){h=pr(Error(s(424)),i),Ba(h),i=bg(n,i,u,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(Bt=vr(n.firstChild),wn=i,ut=!0,wi=null,br=!0,a=dp(i,null,u,a),i.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling}else{if(ss(),u===h){i=ni(n,i,a);break e}_n(n,i,u,a)}i=i.child}return i;case 26:return Mo(n,i),n===null?(a=My(i.type,null,i.pendingProps,null))?i.memoizedState=a:ut||(a=i.type,n=i.pendingProps,u=Ko(_e.current).createElement(a),u[wt]=i,u[Zt]=n,kn(u,a,n),Y(u),i.stateNode=u):i.memoizedState=My(i.type,n.memoizedProps,i.pendingProps,n.memoizedState),null;case 27:return dt(i),n===null&&ut&&(u=i.stateNode=Ty(i.type,i.pendingProps,_e.current),wn=i,br=!0,h=Bt,zi(i.type)?(nh=h,Bt=vr(u.firstChild)):Bt=h),_n(n,i,i.pendingProps.children,a),Mo(n,i),n===null&&(i.flags|=4194304),i.child;case 5:return n===null&&ut&&((h=u=Bt)&&(u=Dw(u,i.type,i.pendingProps,br),u!==null?(i.stateNode=u,wn=i,Bt=vr(u.firstChild),br=!1,h=!0):h=!1),h||Si(i)),dt(i),h=i.type,p=i.pendingProps,w=n!==null?n.memoizedProps:null,u=p.children,Qf(h,p)?u=null:w!==null&&Qf(h,w)&&(i.flags|=32),i.memoizedState!==null&&(h=Xc(n,i,Xv,null,null,a),hl._currentValue=h),Mo(n,i),_n(n,i,u,a),i.child;case 6:return n===null&&ut&&((n=a=Bt)&&(a=Lw(a,i.pendingProps,br),a!==null?(i.stateNode=a,wn=i,Bt=null,n=!0):n=!1),n||Si(i)),null;case 13:return xg(n,i,a);case 4:return Ve(i,i.stateNode.containerInfo),u=i.pendingProps,n===null?i.child=fs(i,null,u,a):_n(n,i,u,a),i.child;case 11:return cg(n,i,i.type,i.pendingProps,a);case 7:return _n(n,i,i.pendingProps,a),i.child;case 8:return _n(n,i,i.pendingProps.children,a),i.child;case 12:return _n(n,i,i.pendingProps.children,a),i.child;case 10:return u=i.pendingProps,_i(i,i.type,u.value),_n(n,i,u.children,a),i.child;case 9:return h=i.type._context,u=i.pendingProps.children,ls(i),h=Sn(h),u=u(h),i.flags|=1,_n(n,i,u,a),i.child;case 14:return fg(n,i,i.type,i.pendingProps,a);case 15:return hg(n,i,i.type,i.pendingProps,a);case 19:return wg(n,i,a);case 31:return rw(n,i,a);case 22:return dg(n,i,a,i.pendingProps);case 24:return ls(i),u=Sn(cn),n===null?(h=Bc(),h===null&&(h=Dt,p=Uc(),h.pooledCache=p,p.refCount++,p!==null&&(h.pooledCacheLanes|=a),h=p),i.memoizedState={parent:u,cache:h},qc(i),_i(i,cn,h)):((n.lanes&a)!==0&&(Ic(n,i),Ya(i,null,null,a),Va()),h=n.memoizedState,p=i.memoizedState,h.parent!==u?(h={parent:u,cache:u},i.memoizedState=h,i.lanes===0&&(i.memoizedState=i.updateQueue.baseState=h),_i(i,cn,u)):(u=p.cache,_i(i,cn,u),u!==h.cache&&zc(i,[cn],a,!0))),_n(n,i,i.pendingProps.children,a),i.child;case 29:throw i.pendingProps}throw Error(s(156,i.tag))}function ri(n){n.flags|=4}function kf(n,i,a,u,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(Xg())n.flags|=8192;else throw cs=bo,Hc}else n.flags&=-16777217}function _g(n,i){if(i.type!=="stylesheet"||(i.state.loading&4)!==0)n.flags&=-16777217;else if(n.flags|=16777216,!Py(i))if(Xg())n.flags|=8192;else throw cs=bo,Hc}function Lo(n,i){i!==null&&(n.flags|=4),n.flags&16384&&(i=n.tag!==22?We():536870912,n.lanes|=i,Js|=i)}function Za(n,i){if(!ut)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 u=null;a!==null;)a.alternate!==null&&(u=a),a=a.sibling;u===null?i||n.tail===null?n.tail=null:n.tail.sibling=null:u.sibling=null}}function Ht(n){var i=n.alternate!==null&&n.alternate.child===n.child,a=0,u=0;if(i)for(var h=n.child;h!==null;)a|=h.lanes|h.childLanes,u|=h.subtreeFlags&65011712,u|=h.flags&65011712,h.return=n,h=h.sibling;else for(h=n.child;h!==null;)a|=h.lanes|h.childLanes,u|=h.subtreeFlags,u|=h.flags,h.return=n,h=h.sibling;return n.subtreeFlags|=u,n.childLanes=a,i}function sw(n,i,a){var u=i.pendingProps;switch(Oc(i),i.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ht(i),null;case 1:return Ht(i),null;case 3:return a=i.stateNode,u=null,n!==null&&(u=n.memoizedState.cache),i.memoizedState.cache!==u&&(i.flags|=2048),Wr(cn),je(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(n===null||n.child===null)&&(Ls(i)?ri(i):n===null||n.memoizedState.isDehydrated&&(i.flags&256)===0||(i.flags|=1024,Mc())),Ht(i),null;case 26:var h=i.type,p=i.memoizedState;return n===null?(ri(i),p!==null?(Ht(i),_g(i,p)):(Ht(i),kf(i,h,null,u,a))):p?p!==n.memoizedState?(ri(i),Ht(i),_g(i,p)):(Ht(i),i.flags&=-16777217):(n=n.memoizedProps,n!==u&&ri(i),Ht(i),kf(i,h,n,u,a)),null;case 27:if(qt(i),a=_e.current,h=i.type,n!==null&&i.stateNode!=null)n.memoizedProps!==u&&ri(i);else{if(!u){if(i.stateNode===null)throw Error(s(166));return Ht(i),null}n=ie.current,Ls(i)?np(i):(n=Ty(h,u,a),i.stateNode=n,ri(i))}return Ht(i),null;case 5:if(qt(i),h=i.type,n!==null&&i.stateNode!=null)n.memoizedProps!==u&&ri(i);else{if(!u){if(i.stateNode===null)throw Error(s(166));return Ht(i),null}if(p=ie.current,Ls(i))np(i);else{var w=Ko(_e.current);switch(p){case 1:p=w.createElementNS("http://www.w3.org/2000/svg",h);break;case 2:p=w.createElementNS("http://www.w3.org/1998/Math/MathML",h);break;default:switch(h){case"svg":p=w.createElementNS("http://www.w3.org/2000/svg",h);break;case"math":p=w.createElementNS("http://www.w3.org/1998/Math/MathML",h);break;case"script":p=w.createElement("div"),p.innerHTML="<script><\/script>",p=p.removeChild(p.firstChild);break;case"select":p=typeof u.is=="string"?w.createElement("select",{is:u.is}):w.createElement("select"),u.multiple?p.multiple=!0:u.size&&(p.size=u.size);break;default:p=typeof u.is=="string"?w.createElement(h,{is:u.is}):w.createElement(h)}}p[wt]=i,p[Zt]=u;e:for(w=i.child;w!==null;){if(w.tag===5||w.tag===6)p.appendChild(w.stateNode);else if(w.tag!==4&&w.tag!==27&&w.child!==null){w.child.return=w,w=w.child;continue}if(w===i)break e;for(;w.sibling===null;){if(w.return===null||w.return===i)break e;w=w.return}w.sibling.return=w.return,w=w.sibling}i.stateNode=p;e:switch(kn(p,h,u),h){case"button":case"input":case"select":case"textarea":u=!!u.autoFocus;break e;case"img":u=!0;break e;default:u=!1}u&&ri(i)}}return Ht(i),kf(i,i.type,n===null?null:n.memoizedProps,i.pendingProps,a),null;case 6:if(n&&i.stateNode!=null)n.memoizedProps!==u&&ri(i);else{if(typeof u!="string"&&i.stateNode===null)throw Error(s(166));if(n=_e.current,Ls(i)){if(n=i.stateNode,a=i.memoizedProps,u=null,h=wn,h!==null)switch(h.tag){case 27:case 5:u=h.memoizedProps}n[wt]=i,n=!!(n.nodeValue===a||u!==null&&u.suppressHydrationWarning===!0||xy(n.nodeValue,a)),n||Si(i,!0)}else n=Ko(n).createTextNode(u),n[wt]=i,i.stateNode=n}return Ht(i),null;case 31:if(a=i.memoizedState,n===null||n.memoizedState!==null){if(u=Ls(i),a!==null){if(n===null){if(!u)throw Error(s(318));if(n=i.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(s(557));n[wt]=i}else ss(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;Ht(i),n=!1}else a=Mc(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=a),n=!0;if(!n)return i.flags&256?(er(i),i):(er(i),null);if((i.flags&128)!==0)throw Error(s(558))}return Ht(i),null;case 13:if(u=i.memoizedState,n===null||n.memoizedState!==null&&n.memoizedState.dehydrated!==null){if(h=Ls(i),u!==null&&u.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[wt]=i}else ss(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;Ht(i),h=!1}else h=Mc(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=h),h=!0;if(!h)return i.flags&256?(er(i),i):(er(i),null)}return er(i),(i.flags&128)!==0?(i.lanes=a,i):(a=u!==null,n=n!==null&&n.memoizedState!==null,a&&(u=i.child,h=null,u.alternate!==null&&u.alternate.memoizedState!==null&&u.alternate.memoizedState.cachePool!==null&&(h=u.alternate.memoizedState.cachePool.pool),p=null,u.memoizedState!==null&&u.memoizedState.cachePool!==null&&(p=u.memoizedState.cachePool.pool),p!==h&&(u.flags|=2048)),a!==n&&a&&(i.child.flags|=8192),Lo(i,i.updateQueue),Ht(i),null);case 4:return je(),n===null&&Yf(i.stateNode.containerInfo),Ht(i),null;case 10:return Wr(i.type),Ht(i),null;case 19:if(ee(rn),u=i.memoizedState,u===null)return Ht(i),null;if(h=(i.flags&128)!==0,p=u.rendering,p===null)if(h)Za(u,!1);else{if(en!==0||n!==null&&(n.flags&128)!==0)for(n=i.child;n!==null;){if(p=So(n),p!==null){for(i.flags|=128,Za(u,!1),n=p.updateQueue,i.updateQueue=n,Lo(i,n),i.subtreeFlags=0,n=a,a=i.child;a!==null;)Qm(a,n),a=a.sibling;return j(rn,rn.current&1|2),ut&&Qr(i,u.treeForkCount),i.child}n=n.sibling}u.tail!==null&&$e()>Ho&&(i.flags|=128,h=!0,Za(u,!1),i.lanes=4194304)}else{if(!h)if(n=So(p),n!==null){if(i.flags|=128,h=!0,n=n.updateQueue,i.updateQueue=n,Lo(i,n),Za(u,!0),u.tail===null&&u.tailMode==="hidden"&&!p.alternate&&!ut)return Ht(i),null}else 2*$e()-u.renderingStartTime>Ho&&a!==536870912&&(i.flags|=128,h=!0,Za(u,!1),i.lanes=4194304);u.isBackwards?(p.sibling=i.child,i.child=p):(n=u.last,n!==null?n.sibling=p:i.child=p,u.last=p)}return u.tail!==null?(n=u.tail,u.rendering=n,u.tail=n.sibling,u.renderingStartTime=$e(),n.sibling=null,a=rn.current,j(rn,h?a&1|2:a&1),ut&&Qr(i,u.treeForkCount),n):(Ht(i),null);case 22:case 23:return er(i),Yc(),u=i.memoizedState!==null,n!==null?n.memoizedState!==null!==u&&(i.flags|=8192):u&&(i.flags|=8192),u?(a&536870912)!==0&&(i.flags&128)===0&&(Ht(i),i.subtreeFlags&6&&(i.flags|=8192)):Ht(i),a=i.updateQueue,a!==null&&Lo(i,a.retryQueue),a=null,n!==null&&n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(a=n.memoizedState.cachePool.pool),u=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(u=i.memoizedState.cachePool.pool),u!==a&&(i.flags|=2048),n!==null&&ee(os),null;case 24:return a=null,n!==null&&(a=n.memoizedState.cache),i.memoizedState.cache!==a&&(i.flags|=2048),Wr(cn),Ht(i),null;case 25:return null;case 30:return null}throw Error(s(156,i.tag))}function aw(n,i){switch(Oc(i),i.tag){case 1:return n=i.flags,n&65536?(i.flags=n&-65537|128,i):null;case 3:return Wr(cn),je(),n=i.flags,(n&65536)!==0&&(n&128)===0?(i.flags=n&-65537|128,i):null;case 26:case 27:case 5:return qt(i),null;case 31:if(i.memoizedState!==null){if(er(i),i.alternate===null)throw Error(s(340));ss()}return n=i.flags,n&65536?(i.flags=n&-65537|128,i):null;case 13:if(er(i),n=i.memoizedState,n!==null&&n.dehydrated!==null){if(i.alternate===null)throw Error(s(340));ss()}return n=i.flags,n&65536?(i.flags=n&-65537|128,i):null;case 19:return ee(rn),null;case 4:return je(),null;case 10:return Wr(i.type),null;case 22:case 23:return er(i),Yc(),n!==null&&ee(os),n=i.flags,n&65536?(i.flags=n&-65537|128,i):null;case 24:return Wr(cn),null;case 25:return null;default:return null}}function kg(n,i){switch(Oc(i),i.tag){case 3:Wr(cn),je();break;case 26:case 27:case 5:qt(i);break;case 4:je();break;case 31:i.memoizedState!==null&&er(i);break;case 13:er(i);break;case 19:ee(rn);break;case 10:Wr(i.type);break;case 22:case 23:er(i),Yc(),n!==null&&ee(os);break;case 24:Wr(cn)}}function Wa(n,i){try{var a=i.updateQueue,u=a!==null?a.lastEffect:null;if(u!==null){var h=u.next;a=h;do{if((a.tag&n)===n){u=void 0;var p=a.create,w=a.inst;u=p(),w.destroy=u}a=a.next}while(a!==h)}}catch(_){Et(i,i.return,_)}}function Ni(n,i,a){try{var u=i.updateQueue,h=u!==null?u.lastEffect:null;if(h!==null){var p=h.next;u=p;do{if((u.tag&n)===n){var w=u.inst,_=w.destroy;if(_!==void 0){w.destroy=void 0,h=i;var H=a,ne=_;try{ne()}catch(he){Et(h,H,he)}}}u=u.next}while(u!==p)}}catch(he){Et(i,i.return,he)}}function Eg(n){var i=n.updateQueue;if(i!==null){var a=n.stateNode;try{pp(i,a)}catch(u){Et(n,n.return,u)}}}function Cg(n,i,a){a.props=ds(n.type,n.memoizedProps),a.state=n.memoizedState;try{a.componentWillUnmount()}catch(u){Et(n,i,u)}}function el(n,i){try{var a=n.ref;if(a!==null){switch(n.tag){case 26:case 27:case 5:var u=n.stateNode;break;case 30:u=n.stateNode;break;default:u=n.stateNode}typeof a=="function"?n.refCleanup=a(u):a.current=u}}catch(h){Et(n,i,h)}}function Br(n,i){var a=n.ref,u=n.refCleanup;if(a!==null)if(typeof u=="function")try{u()}catch(h){Et(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){Et(n,i,h)}else a.current=null}function Ag(n){var i=n.type,a=n.memoizedProps,u=n.stateNode;try{e:switch(i){case"button":case"input":case"select":case"textarea":a.autoFocus&&u.focus();break e;case"img":a.src?u.src=a.src:a.srcSet&&(u.srcset=a.srcSet)}}catch(h){Et(n,n.return,h)}}function Ef(n,i,a){try{var u=n.stateNode;jw(u,n.type,a,i),u[Zt]=i}catch(h){Et(n,n.return,h)}}function jg(n){return n.tag===5||n.tag===3||n.tag===26||n.tag===27&&zi(n.type)||n.tag===4}function Cf(n){e:for(;;){for(;n.sibling===null;){if(n.return===null||jg(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&&zi(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 Af(n,i,a){var u=n.tag;if(u===5||u===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=Jr));else if(u!==4&&(u===27&&zi(n.type)&&(a=n.stateNode,i=null),n=n.child,n!==null))for(Af(n,i,a),n=n.sibling;n!==null;)Af(n,i,a),n=n.sibling}function zo(n,i,a){var u=n.tag;if(u===5||u===6)n=n.stateNode,i?a.insertBefore(n,i):a.appendChild(n);else if(u!==4&&(u===27&&zi(n.type)&&(a=n.stateNode),n=n.child,n!==null))for(zo(n,i,a),n=n.sibling;n!==null;)zo(n,i,a),n=n.sibling}function Ng(n){var i=n.stateNode,a=n.memoizedProps;try{for(var u=n.type,h=i.attributes;h.length;)i.removeAttributeNode(h[0]);kn(i,u,a),i[wt]=n,i[Zt]=a}catch(p){Et(n,n.return,p)}}var ii=!1,dn=!1,jf=!1,Tg=typeof WeakSet=="function"?WeakSet:Set,yn=null;function lw(n,i){if(n=n.containerInfo,Xf=ru,n=Im(n),vc(n)){if("selectionStart"in n)var a={start:n.selectionStart,end:n.selectionEnd};else e:{a=(a=n.ownerDocument)&&a.defaultView||window;var u=a.getSelection&&a.getSelection();if(u&&u.rangeCount!==0){a=u.anchorNode;var h=u.anchorOffset,p=u.focusNode;u=u.focusOffset;try{a.nodeType,p.nodeType}catch{a=null;break e}var w=0,_=-1,H=-1,ne=0,he=0,ge=n,se=null;t:for(;;){for(var ue;ge!==a||h!==0&&ge.nodeType!==3||(_=w+h),ge!==p||u!==0&&ge.nodeType!==3||(H=w+u),ge.nodeType===3&&(w+=ge.nodeValue.length),(ue=ge.firstChild)!==null;)se=ge,ge=ue;for(;;){if(ge===n)break t;if(se===a&&++ne===h&&(_=w),se===p&&++he===u&&(H=w),(ue=ge.nextSibling)!==null)break;ge=se,se=ge.parentNode}ge=ue}a=_===-1||H===-1?null:{start:_,end:H}}else a=null}a=a||{start:0,end:0}}else a=null;for(Kf={focusedElem:n,selectionRange:a},ru=!1,yn=i;yn!==null;)if(i=yn,n=i.child,(i.subtreeFlags&1028)!==0&&n!==null)n.return=i,yn=n;else for(;yn!==null;){switch(i=yn,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,u=a.stateNode;try{var De=ds(a.type,h);n=u.getSnapshotBeforeUpdate(De,p),u.__reactInternalSnapshotBeforeUpdate=n}catch(qe){Et(a,a.return,qe)}}break;case 3:if((n&1024)!==0){if(n=i.stateNode.containerInfo,a=n.nodeType,a===9)Wf(n);else if(a===1)switch(n.nodeName){case"HEAD":case"HTML":case"BODY":Wf(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,yn=n;break}yn=i.return}}function Og(n,i,a){var u=a.flags;switch(a.tag){case 0:case 11:case 15:ai(n,a),u&4&&Wa(5,a);break;case 1:if(ai(n,a),u&4)if(n=a.stateNode,i===null)try{n.componentDidMount()}catch(w){Et(a,a.return,w)}else{var h=ds(a.type,i.memoizedProps);i=i.memoizedState;try{n.componentDidUpdate(h,i,n.__reactInternalSnapshotBeforeUpdate)}catch(w){Et(a,a.return,w)}}u&64&&Eg(a),u&512&&el(a,a.return);break;case 3:if(ai(n,a),u&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{pp(n,i)}catch(w){Et(a,a.return,w)}}break;case 27:i===null&&u&4&&Ng(a);case 26:case 5:ai(n,a),i===null&&u&4&&Ag(a),u&512&&el(a,a.return);break;case 12:ai(n,a);break;case 31:ai(n,a),u&4&&Dg(n,a);break;case 13:ai(n,a),u&4&&Lg(n,a),u&64&&(n=a.memoizedState,n!==null&&(n=n.dehydrated,n!==null&&(a=gw.bind(null,a),zw(n,a))));break;case 22:if(u=a.memoizedState!==null||ii,!u){i=i!==null&&i.memoizedState!==null||dn,h=ii;var p=dn;ii=u,(dn=i)&&!p?li(n,a,(a.subtreeFlags&8772)!==0):ai(n,a),ii=h,dn=p}break;case 30:break;default:ai(n,a)}}function Rg(n){var i=n.alternate;i!==null&&(n.alternate=null,Rg(i)),n.child=null,n.deletions=null,n.sibling=null,n.tag===5&&(i=n.stateNode,i!==null&&_s(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 Ft=null,qn=!1;function si(n,i,a){for(a=a.child;a!==null;)Mg(n,i,a),a=a.sibling}function Mg(n,i,a){if(xt&&typeof xt.onCommitFiberUnmount=="function")try{xt.onCommitFiberUnmount(Ct,a)}catch{}switch(a.tag){case 26:dn||Br(a,i),si(n,i,a),a.memoizedState?a.memoizedState.count--:a.stateNode&&(a=a.stateNode,a.parentNode.removeChild(a));break;case 27:dn||Br(a,i);var u=Ft,h=qn;zi(a.type)&&(Ft=a.stateNode,qn=!1),si(n,i,a),ul(a.stateNode),Ft=u,qn=h;break;case 5:dn||Br(a,i);case 6:if(u=Ft,h=qn,Ft=null,si(n,i,a),Ft=u,qn=h,Ft!==null)if(qn)try{(Ft.nodeType===9?Ft.body:Ft.nodeName==="HTML"?Ft.ownerDocument.body:Ft).removeChild(a.stateNode)}catch(p){Et(a,i,p)}else try{Ft.removeChild(a.stateNode)}catch(p){Et(a,i,p)}break;case 18:Ft!==null&&(qn?(n=Ft,Ey(n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n,a.stateNode),na(n)):Ey(Ft,a.stateNode));break;case 4:u=Ft,h=qn,Ft=a.stateNode.containerInfo,qn=!0,si(n,i,a),Ft=u,qn=h;break;case 0:case 11:case 14:case 15:Ni(2,a,i),dn||Ni(4,a,i),si(n,i,a);break;case 1:dn||(Br(a,i),u=a.stateNode,typeof u.componentWillUnmount=="function"&&Cg(a,i,u)),si(n,i,a);break;case 21:si(n,i,a);break;case 22:dn=(u=dn)||a.memoizedState!==null,si(n,i,a),dn=u;break;default:si(n,i,a)}}function Dg(n,i){if(i.memoizedState===null&&(n=i.alternate,n!==null&&(n=n.memoizedState,n!==null))){n=n.dehydrated;try{na(n)}catch(a){Et(i,i.return,a)}}}function Lg(n,i){if(i.memoizedState===null&&(n=i.alternate,n!==null&&(n=n.memoizedState,n!==null&&(n=n.dehydrated,n!==null))))try{na(n)}catch(a){Et(i,i.return,a)}}function ow(n){switch(n.tag){case 31:case 13:case 19:var i=n.stateNode;return i===null&&(i=n.stateNode=new Tg),i;case 22:return n=n.stateNode,i=n._retryCache,i===null&&(i=n._retryCache=new Tg),i;default:throw Error(s(435,n.tag))}}function Uo(n,i){var a=ow(n);i.forEach(function(u){if(!a.has(u)){a.add(u);var h=yw.bind(null,n,u);u.then(h,h)}})}function In(n,i){var a=i.deletions;if(a!==null)for(var u=0;u<a.length;u++){var h=a[u],p=n,w=i,_=w;e:for(;_!==null;){switch(_.tag){case 27:if(zi(_.type)){Ft=_.stateNode,qn=!1;break e}break;case 5:Ft=_.stateNode,qn=!1;break e;case 3:case 4:Ft=_.stateNode.containerInfo,qn=!0;break e}_=_.return}if(Ft===null)throw Error(s(160));Mg(p,w,h),Ft=null,qn=!1,p=h.alternate,p!==null&&(p.return=null),h.return=null}if(i.subtreeFlags&13886)for(i=i.child;i!==null;)zg(i,n),i=i.sibling}var jr=null;function zg(n,i){var a=n.alternate,u=n.flags;switch(n.tag){case 0:case 11:case 14:case 15:In(i,n),Fn(n),u&4&&(Ni(3,n,n.return),Wa(3,n),Ni(5,n,n.return));break;case 1:In(i,n),Fn(n),u&512&&(dn||a===null||Br(a,a.return)),u&64&&ii&&(n=n.updateQueue,n!==null&&(u=n.callbacks,u!==null&&(a=n.shared.hiddenCallbacks,n.shared.hiddenCallbacks=a===null?u:a.concat(u))));break;case 26:var h=jr;if(In(i,n),Fn(n),u&512&&(dn||a===null||Br(a,a.return)),u&4){var p=a!==null?a.memoizedState:null;if(u=n.memoizedState,a===null)if(u===null)if(n.stateNode===null){e:{u=n.type,a=n.memoizedProps,h=h.ownerDocument||h;t:switch(u){case"title":p=h.getElementsByTagName("title")[0],(!p||p[pn]||p[wt]||p.namespaceURI==="http://www.w3.org/2000/svg"||p.hasAttribute("itemprop"))&&(p=h.createElement(u),h.head.insertBefore(p,h.querySelector("head > title"))),kn(p,u,a),p[wt]=n,Y(p),u=p;break e;case"link":var w=zy("link","href",h).get(u+(a.href||""));if(w){for(var _=0;_<w.length;_++)if(p=w[_],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)){w.splice(_,1);break t}}p=h.createElement(u),kn(p,u,a),h.head.appendChild(p);break;case"meta":if(w=zy("meta","content",h).get(u+(a.content||""))){for(_=0;_<w.length;_++)if(p=w[_],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)){w.splice(_,1);break t}}p=h.createElement(u),kn(p,u,a),h.head.appendChild(p);break;default:throw Error(s(468,u))}p[wt]=n,Y(p),u=p}n.stateNode=u}else Uy(h,n.type,n.stateNode);else n.stateNode=Ly(h,u,n.memoizedProps);else p!==u?(p===null?a.stateNode!==null&&(a=a.stateNode,a.parentNode.removeChild(a)):p.count--,u===null?Uy(h,n.type,n.stateNode):Ly(h,u,n.memoizedProps)):u===null&&n.stateNode!==null&&Ef(n,n.memoizedProps,a.memoizedProps)}break;case 27:In(i,n),Fn(n),u&512&&(dn||a===null||Br(a,a.return)),a!==null&&u&4&&Ef(n,n.memoizedProps,a.memoizedProps);break;case 5:if(In(i,n),Fn(n),u&512&&(dn||a===null||Br(a,a.return)),n.flags&32){h=n.stateNode;try{Es(h,"")}catch(De){Et(n,n.return,De)}}u&4&&n.stateNode!=null&&(h=n.memoizedProps,Ef(n,h,a!==null?a.memoizedProps:h)),u&1024&&(jf=!0);break;case 6:if(In(i,n),Fn(n),u&4){if(n.stateNode===null)throw Error(s(162));u=n.memoizedProps,a=n.stateNode;try{a.nodeValue=u}catch(De){Et(n,n.return,De)}}break;case 3:if(Wo=null,h=jr,jr=Qo(i.containerInfo),In(i,n),jr=h,Fn(n),u&4&&a!==null&&a.memoizedState.isDehydrated)try{na(i.containerInfo)}catch(De){Et(n,n.return,De)}jf&&(jf=!1,Ug(n));break;case 4:u=jr,jr=Qo(n.stateNode.containerInfo),In(i,n),Fn(n),jr=u;break;case 12:In(i,n),Fn(n);break;case 31:In(i,n),Fn(n),u&4&&(u=n.updateQueue,u!==null&&(n.updateQueue=null,Uo(n,u)));break;case 13:In(i,n),Fn(n),n.child.flags&8192&&n.memoizedState!==null!=(a!==null&&a.memoizedState!==null)&&(Bo=$e()),u&4&&(u=n.updateQueue,u!==null&&(n.updateQueue=null,Uo(n,u)));break;case 22:h=n.memoizedState!==null;var H=a!==null&&a.memoizedState!==null,ne=ii,he=dn;if(ii=ne||h,dn=he||H,In(i,n),dn=he,ii=ne,Fn(n),u&8192)e:for(i=n.stateNode,i._visibility=h?i._visibility&-2:i._visibility|1,h&&(a===null||H||ii||dn||ms(n)),a=null,i=n;;){if(i.tag===5||i.tag===26){if(a===null){H=a=i;try{if(p=H.stateNode,h)w=p.style,typeof w.setProperty=="function"?w.setProperty("display","none","important"):w.display="none";else{_=H.stateNode;var ge=H.memoizedProps.style,se=ge!=null&&ge.hasOwnProperty("display")?ge.display:null;_.style.display=se==null||typeof se=="boolean"?"":(""+se).trim()}}catch(De){Et(H,H.return,De)}}}else if(i.tag===6){if(a===null){H=i;try{H.stateNode.nodeValue=h?"":H.memoizedProps}catch(De){Et(H,H.return,De)}}}else if(i.tag===18){if(a===null){H=i;try{var ue=H.stateNode;h?Cy(ue,!0):Cy(H.stateNode,!1)}catch(De){Et(H,H.return,De)}}}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}u&4&&(u=n.updateQueue,u!==null&&(a=u.retryQueue,a!==null&&(u.retryQueue=null,Uo(n,a))));break;case 19:In(i,n),Fn(n),u&4&&(u=n.updateQueue,u!==null&&(n.updateQueue=null,Uo(n,u)));break;case 30:break;case 21:break;default:In(i,n),Fn(n)}}function Fn(n){var i=n.flags;if(i&2){try{for(var a,u=n.return;u!==null;){if(jg(u)){a=u;break}u=u.return}if(a==null)throw Error(s(160));switch(a.tag){case 27:var h=a.stateNode,p=Cf(n);zo(n,p,h);break;case 5:var w=a.stateNode;a.flags&32&&(Es(w,""),a.flags&=-33);var _=Cf(n);zo(n,_,w);break;case 3:case 4:var H=a.stateNode.containerInfo,ne=Cf(n);Af(n,ne,H);break;default:throw Error(s(161))}}catch(he){Et(n,n.return,he)}n.flags&=-3}i&4096&&(n.flags&=-4097)}function Ug(n){if(n.subtreeFlags&1024)for(n=n.child;n!==null;){var i=n;Ug(i),i.tag===5&&i.flags&1024&&i.stateNode.reset(),n=n.sibling}}function ai(n,i){if(i.subtreeFlags&8772)for(i=i.child;i!==null;)Og(n,i.alternate,i),i=i.sibling}function ms(n){for(n=n.child;n!==null;){var i=n;switch(i.tag){case 0:case 11:case 14:case 15:Ni(4,i,i.return),ms(i);break;case 1:Br(i,i.return);var a=i.stateNode;typeof a.componentWillUnmount=="function"&&Cg(i,i.return,a),ms(i);break;case 27:ul(i.stateNode);case 26:case 5:Br(i,i.return),ms(i);break;case 22:i.memoizedState===null&&ms(i);break;case 30:ms(i);break;default:ms(i)}n=n.sibling}}function li(n,i,a){for(a=a&&(i.subtreeFlags&8772)!==0,i=i.child;i!==null;){var u=i.alternate,h=n,p=i,w=p.flags;switch(p.tag){case 0:case 11:case 15:li(h,p,a),Wa(4,p);break;case 1:if(li(h,p,a),u=p,h=u.stateNode,typeof h.componentDidMount=="function")try{h.componentDidMount()}catch(ne){Et(u,u.return,ne)}if(u=p,h=u.updateQueue,h!==null){var _=u.stateNode;try{var H=h.shared.hiddenCallbacks;if(H!==null)for(h.shared.hiddenCallbacks=null,h=0;h<H.length;h++)mp(H[h],_)}catch(ne){Et(u,u.return,ne)}}a&&w&64&&Eg(p),el(p,p.return);break;case 27:Ng(p);case 26:case 5:li(h,p,a),a&&u===null&&w&4&&Ag(p),el(p,p.return);break;case 12:li(h,p,a);break;case 31:li(h,p,a),a&&w&4&&Dg(h,p);break;case 13:li(h,p,a),a&&w&4&&Lg(h,p);break;case 22:p.memoizedState===null&&li(h,p,a),el(p,p.return);break;case 30:break;default:li(h,p,a)}i=i.sibling}}function Nf(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&&Ha(a))}function Tf(n,i){n=null,i.alternate!==null&&(n=i.alternate.memoizedState.cache),i=i.memoizedState.cache,i!==n&&(i.refCount++,n!=null&&Ha(n))}function Nr(n,i,a,u){if(i.subtreeFlags&10256)for(i=i.child;i!==null;)Pg(n,i,a,u),i=i.sibling}function Pg(n,i,a,u){var h=i.flags;switch(i.tag){case 0:case 11:case 15:Nr(n,i,a,u),h&2048&&Wa(9,i);break;case 1:Nr(n,i,a,u);break;case 3:Nr(n,i,a,u),h&2048&&(n=null,i.alternate!==null&&(n=i.alternate.memoizedState.cache),i=i.memoizedState.cache,i!==n&&(i.refCount++,n!=null&&Ha(n)));break;case 12:if(h&2048){Nr(n,i,a,u),n=i.stateNode;try{var p=i.memoizedProps,w=p.id,_=p.onPostCommit;typeof _=="function"&&_(w,i.alternate===null?"mount":"update",n.passiveEffectDuration,-0)}catch(H){Et(i,i.return,H)}}else Nr(n,i,a,u);break;case 31:Nr(n,i,a,u);break;case 13:Nr(n,i,a,u);break;case 23:break;case 22:p=i.stateNode,w=i.alternate,i.memoizedState!==null?p._visibility&2?Nr(n,i,a,u):tl(n,i):p._visibility&2?Nr(n,i,a,u):(p._visibility|=2,Vs(n,i,a,u,(i.subtreeFlags&10256)!==0||!1)),h&2048&&Nf(w,i);break;case 24:Nr(n,i,a,u),h&2048&&Tf(i.alternate,i);break;default:Nr(n,i,a,u)}}function Vs(n,i,a,u,h){for(h=h&&((i.subtreeFlags&10256)!==0||!1),i=i.child;i!==null;){var p=n,w=i,_=a,H=u,ne=w.flags;switch(w.tag){case 0:case 11:case 15:Vs(p,w,_,H,h),Wa(8,w);break;case 23:break;case 22:var he=w.stateNode;w.memoizedState!==null?he._visibility&2?Vs(p,w,_,H,h):tl(p,w):(he._visibility|=2,Vs(p,w,_,H,h)),h&&ne&2048&&Nf(w.alternate,w);break;case 24:Vs(p,w,_,H,h),h&&ne&2048&&Tf(w.alternate,w);break;default:Vs(p,w,_,H,h)}i=i.sibling}}function tl(n,i){if(i.subtreeFlags&10256)for(i=i.child;i!==null;){var a=n,u=i,h=u.flags;switch(u.tag){case 22:tl(a,u),h&2048&&Nf(u.alternate,u);break;case 24:tl(a,u),h&2048&&Tf(u.alternate,u);break;default:tl(a,u)}i=i.sibling}}var nl=8192;function Ys(n,i,a){if(n.subtreeFlags&nl)for(n=n.child;n!==null;)Bg(n,i,a),n=n.sibling}function Bg(n,i,a){switch(n.tag){case 26:Ys(n,i,a),n.flags&nl&&n.memoizedState!==null&&Jw(a,jr,n.memoizedState,n.memoizedProps);break;case 5:Ys(n,i,a);break;case 3:case 4:var u=jr;jr=Qo(n.stateNode.containerInfo),Ys(n,i,a),jr=u;break;case 22:n.memoizedState===null&&(u=n.alternate,u!==null&&u.memoizedState!==null?(u=nl,nl=16777216,Ys(n,i,a),nl=u):Ys(n,i,a));break;default:Ys(n,i,a)}}function Hg(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 rl(n){var i=n.deletions;if((n.flags&16)!==0){if(i!==null)for(var a=0;a<i.length;a++){var u=i[a];yn=u,Ig(u,n)}Hg(n)}if(n.subtreeFlags&10256)for(n=n.child;n!==null;)qg(n),n=n.sibling}function qg(n){switch(n.tag){case 0:case 11:case 15:rl(n),n.flags&2048&&Ni(9,n,n.return);break;case 3:rl(n);break;case 12:rl(n);break;case 22:var i=n.stateNode;n.memoizedState!==null&&i._visibility&2&&(n.return===null||n.return.tag!==13)?(i._visibility&=-3,Po(n)):rl(n);break;default:rl(n)}}function Po(n){var i=n.deletions;if((n.flags&16)!==0){if(i!==null)for(var a=0;a<i.length;a++){var u=i[a];yn=u,Ig(u,n)}Hg(n)}for(n=n.child;n!==null;){switch(i=n,i.tag){case 0:case 11:case 15:Ni(8,i,i.return),Po(i);break;case 22:a=i.stateNode,a._visibility&2&&(a._visibility&=-3,Po(i));break;default:Po(i)}n=n.sibling}}function Ig(n,i){for(;yn!==null;){var a=yn;switch(a.tag){case 0:case 11:case 15:Ni(8,a,i);break;case 23:case 22:if(a.memoizedState!==null&&a.memoizedState.cachePool!==null){var u=a.memoizedState.cachePool.pool;u!=null&&u.refCount++}break;case 24:Ha(a.memoizedState.cache)}if(u=a.child,u!==null)u.return=a,yn=u;else e:for(a=n;yn!==null;){u=yn;var h=u.sibling,p=u.return;if(Rg(u),u===a){yn=null;break e}if(h!==null){h.return=p,yn=h;break e}yn=p}}}var uw={getCacheForType:function(n){var i=Sn(cn),a=i.data.get(n);return a===void 0&&(a=n(),i.data.set(n,a)),a},cacheSignal:function(){return Sn(cn).controller.signal}},cw=typeof WeakMap=="function"?WeakMap:Map,vt=0,Dt=null,it=null,lt=0,kt=0,tr=null,Ti=!1,Gs=!1,Of=!1,oi=0,en=0,Oi=0,ps=0,Rf=0,nr=0,Js=0,il=null,$n=null,Mf=!1,Bo=0,Fg=0,Ho=1/0,qo=null,Ri=null,gn=0,Mi=null,Xs=null,ui=0,Df=0,Lf=null,$g=null,sl=0,zf=null;function rr(){return(vt&2)!==0&&lt!==0?lt&-lt:F.T!==null?If():Bn()}function Vg(){if(nr===0)if((lt&536870912)===0||ut){var n=Qt;Qt<<=1,(Qt&3932160)===0&&(Qt=262144),nr=n}else nr=536870912;return n=Wn.current,n!==null&&(n.flags|=32),nr}function Vn(n,i,a){(n===Dt&&(kt===2||kt===9)||n.cancelPendingCommit!==null)&&(Ks(n,0),Di(n,lt,nr,!1)),ft(n,a),((vt&2)===0||n!==Dt)&&(n===Dt&&((vt&2)===0&&(ps|=a),en===4&&Di(n,lt,nr,!1)),Hr(n))}function Yg(n,i,a){if((vt&6)!==0)throw Error(s(327));var u=!a&&(i&127)===0&&(i&n.expiredLanes)===0||Ae(n,i),h=u?dw(n,i):Pf(n,i,!0),p=u;do{if(h===0){Gs&&!u&&Di(n,i,0,!1);break}else{if(a=n.current.alternate,p&&!fw(a)){h=Pf(n,i,!1),p=!1;continue}if(h===2){if(p=i,n.errorRecoveryDisabledLanes&p)var w=0;else w=n.pendingLanes&-536870913,w=w!==0?w:w&536870912?536870912:0;if(w!==0){i=w;e:{var _=n;h=il;var H=_.current.memoizedState.isDehydrated;if(H&&(Ks(_,w).flags|=256),w=Pf(_,w,!1),w!==2){if(Of&&!H){_.errorRecoveryDisabledLanes|=p,ps|=p,h=4;break e}p=$n,$n=h,p!==null&&($n===null?$n=p:$n.push.apply($n,p))}h=w}if(p=!1,h!==2)continue}}if(h===1){Ks(n,0),Di(n,i,0,!0);break}e:{switch(u=n,p=h,p){case 0:case 1:throw Error(s(345));case 4:if((i&4194048)!==i)break;case 6:Di(u,i,nr,!Ti);break e;case 2:$n=null;break;case 3:case 5:break;default:throw Error(s(329))}if((i&62914560)===i&&(h=Bo+300-$e(),10<h)){if(Di(u,i,nr,!Ti),xe(u,0,!0)!==0)break e;ui=i,u.timeoutHandle=_y(Gg.bind(null,u,a,$n,qo,Mf,i,nr,ps,Js,Ti,p,"Throttled",-0,0),h);break e}Gg(u,a,$n,qo,Mf,i,nr,ps,Js,Ti,p,null,-0,0)}}break}while(!0);Hr(n)}function Gg(n,i,a,u,h,p,w,_,H,ne,he,ge,se,ue){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:Jr},Bg(i,p,ge);var De=(p&62914560)===p?Bo-$e():(p&4194048)===p?Fg-$e():0;if(De=Xw(ge,De),De!==null){ui=p,n.cancelPendingCommit=De(ty.bind(null,n,i,p,a,u,h,w,_,H,he,ge,null,se,ue)),Di(n,p,w,!ne);return}}ty(n,i,p,a,u,h,w,_,H)}function fw(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 u=0;u<a.length;u++){var h=a[u],p=h.getSnapshot;h=h.value;try{if(!Qn(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 Di(n,i,a,u){i&=~Rf,i&=~ps,n.suspendedLanes|=i,n.pingedLanes&=~i,u&&(n.warmLanes|=i),u=n.expirationTimes;for(var h=i;0<h;){var p=31-nt(h),w=1<<p;u[p]=-1,h&=~w}a!==0&&Ie(n,a,i)}function Io(){return(vt&6)===0?(al(0),!1):!0}function Uf(){if(it!==null){if(kt===0)var n=it.return;else n=it,Zr=as=null,Zc(n),Hs=null,Ia=0,n=it;for(;n!==null;)kg(n.alternate,n),n=n.return;it=null}}function Ks(n,i){var a=n.timeoutHandle;a!==-1&&(n.timeoutHandle=-1,Ow(a)),a=n.cancelPendingCommit,a!==null&&(n.cancelPendingCommit=null,a()),ui=0,Uf(),Dt=n,it=a=Kr(n.current,null),lt=i,kt=0,tr=null,Ti=!1,Gs=Ae(n,i),Of=!1,Js=nr=Rf=ps=Oi=en=0,$n=il=null,Mf=!1,(i&8)!==0&&(i|=i&32);var u=n.entangledLanes;if(u!==0)for(n=n.entanglements,u&=i;0<u;){var h=31-nt(u),p=1<<h;i|=n[h],u&=~p}return oi=i,oo(),a}function Jg(n,i){Xe=null,F.H=Ka,i===Bs||i===yo?(i=cp(),kt=3):i===Hc?(i=cp(),kt=4):kt=i===pf?8:i!==null&&typeof i=="object"&&typeof i.then=="function"?6:1,tr=i,it===null&&(en=1,Oo(n,pr(i,n.current)))}function Xg(){var n=Wn.current;return n===null?!0:(lt&4194048)===lt?xr===null:(lt&62914560)===lt||(lt&536870912)!==0?n===xr:!1}function Kg(){var n=F.H;return F.H=Ka,n===null?Ka:n}function Qg(){var n=F.A;return F.A=uw,n}function Fo(){en=4,Ti||(lt&4194048)!==lt&&Wn.current!==null||(Gs=!0),(Oi&134217727)===0&&(ps&134217727)===0||Dt===null||Di(Dt,lt,nr,!1)}function Pf(n,i,a){var u=vt;vt|=2;var h=Kg(),p=Qg();(Dt!==n||lt!==i)&&(qo=null,Ks(n,i)),i=!1;var w=en;e:do try{if(kt!==0&&it!==null){var _=it,H=tr;switch(kt){case 8:Uf(),w=6;break e;case 3:case 2:case 9:case 6:Wn.current===null&&(i=!0);var ne=kt;if(kt=0,tr=null,Qs(n,_,H,ne),a&&Gs){w=0;break e}break;default:ne=kt,kt=0,tr=null,Qs(n,_,H,ne)}}hw(),w=en;break}catch(he){Jg(n,he)}while(!0);return i&&n.shellSuspendCounter++,Zr=as=null,vt=u,F.H=h,F.A=p,it===null&&(Dt=null,lt=0,oo()),w}function hw(){for(;it!==null;)Zg(it)}function dw(n,i){var a=vt;vt|=2;var u=Kg(),h=Qg();Dt!==n||lt!==i?(qo=null,Ho=$e()+500,Ks(n,i)):Gs=Ae(n,i);e:do try{if(kt!==0&&it!==null){i=it;var p=tr;t:switch(kt){case 1:kt=0,tr=null,Qs(n,i,p,1);break;case 2:case 9:if(op(p)){kt=0,tr=null,Wg(i);break}i=function(){kt!==2&&kt!==9||Dt!==n||(kt=7),Hr(n)},p.then(i,i);break e;case 3:kt=7;break e;case 4:kt=5;break e;case 7:op(p)?(kt=0,tr=null,Wg(i)):(kt=0,tr=null,Qs(n,i,p,7));break;case 5:var w=null;switch(it.tag){case 26:w=it.memoizedState;case 5:case 27:var _=it;if(w?Py(w):_.stateNode.complete){kt=0,tr=null;var H=_.sibling;if(H!==null)it=H;else{var ne=_.return;ne!==null?(it=ne,$o(ne)):it=null}break t}}kt=0,tr=null,Qs(n,i,p,5);break;case 6:kt=0,tr=null,Qs(n,i,p,6);break;case 8:Uf(),en=6;break e;default:throw Error(s(462))}}mw();break}catch(he){Jg(n,he)}while(!0);return Zr=as=null,F.H=u,F.A=h,vt=a,it!==null?0:(Dt=null,lt=0,oo(),en)}function mw(){for(;it!==null&&!zt();)Zg(it)}function Zg(n){var i=Sg(n.alternate,n,oi);n.memoizedProps=n.pendingProps,i===null?$o(n):it=i}function Wg(n){var i=n,a=i.alternate;switch(i.tag){case 15:case 0:i=gg(a,i,i.pendingProps,i.type,void 0,lt);break;case 11:i=gg(a,i,i.pendingProps,i.type.render,i.ref,lt);break;case 5:Zc(i);default:kg(a,i),i=it=Qm(i,oi),i=Sg(a,i,oi)}n.memoizedProps=n.pendingProps,i===null?$o(n):it=i}function Qs(n,i,a,u){Zr=as=null,Zc(i),Hs=null,Ia=0;var h=i.return;try{if(nw(n,h,i,a,lt)){en=1,Oo(n,pr(a,n.current)),it=null;return}}catch(p){if(h!==null)throw it=h,p;en=1,Oo(n,pr(a,n.current)),it=null;return}i.flags&32768?(ut||u===1?n=!0:Gs||(lt&536870912)!==0?n=!1:(Ti=n=!0,(u===2||u===9||u===3||u===6)&&(u=Wn.current,u!==null&&u.tag===13&&(u.flags|=16384))),ey(i,n)):$o(i)}function $o(n){var i=n;do{if((i.flags&32768)!==0){ey(i,Ti);return}n=i.return;var a=sw(i.alternate,i,oi);if(a!==null){it=a;return}if(i=i.sibling,i!==null){it=i;return}it=i=n}while(i!==null);en===0&&(en=5)}function ey(n,i){do{var a=aw(n.alternate,n);if(a!==null){a.flags&=32767,it=a;return}if(a=n.return,a!==null&&(a.flags|=32768,a.subtreeFlags=0,a.deletions=null),!i&&(n=n.sibling,n!==null)){it=n;return}it=n=a}while(n!==null);en=6,it=null}function ty(n,i,a,u,h,p,w,_,H){n.cancelPendingCommit=null;do Vo();while(gn!==0);if((vt&6)!==0)throw Error(s(327));if(i!==null){if(i===n.current)throw Error(s(177));if(p=i.lanes|i.childLanes,p|=Ec,rt(n,a,p,w,_,H),n===Dt&&(it=Dt=null,lt=0),Xs=i,Mi=n,ui=a,Df=p,Lf=h,$g=u,(i.subtreeFlags&10256)!==0||(i.flags&10256)!==0?(n.callbackNode=null,n.callbackPriority=0,bw(Le,function(){return ay(),null})):(n.callbackNode=null,n.callbackPriority=0),u=(i.flags&13878)!==0,(i.subtreeFlags&13878)!==0||u){u=F.T,F.T=null,h=q.p,q.p=2,w=vt,vt|=4;try{lw(n,i,a)}finally{vt=w,q.p=h,F.T=u}}gn=1,ny(),ry(),iy()}}function ny(){if(gn===1){gn=0;var n=Mi,i=Xs,a=(i.flags&13878)!==0;if((i.subtreeFlags&13878)!==0||a){a=F.T,F.T=null;var u=q.p;q.p=2;var h=vt;vt|=4;try{zg(i,n);var p=Kf,w=Im(n.containerInfo),_=p.focusedElem,H=p.selectionRange;if(w!==_&&_&&_.ownerDocument&&qm(_.ownerDocument.documentElement,_)){if(H!==null&&vc(_)){var ne=H.start,he=H.end;if(he===void 0&&(he=ne),"selectionStart"in _)_.selectionStart=ne,_.selectionEnd=Math.min(he,_.value.length);else{var ge=_.ownerDocument||document,se=ge&&ge.defaultView||window;if(se.getSelection){var ue=se.getSelection(),De=_.textContent.length,qe=Math.min(H.start,De),Nt=H.end===void 0?qe:Math.min(H.end,De);!ue.extend&&qe>Nt&&(w=Nt,Nt=qe,qe=w);var K=Hm(_,qe),J=Hm(_,Nt);if(K&&J&&(ue.rangeCount!==1||ue.anchorNode!==K.node||ue.anchorOffset!==K.offset||ue.focusNode!==J.node||ue.focusOffset!==J.offset)){var te=ge.createRange();te.setStart(K.node,K.offset),ue.removeAllRanges(),qe>Nt?(ue.addRange(te),ue.extend(J.node,J.offset)):(te.setEnd(J.node,J.offset),ue.addRange(te))}}}}for(ge=[],ue=_;ue=ue.parentNode;)ue.nodeType===1&&ge.push({element:ue,left:ue.scrollLeft,top:ue.scrollTop});for(typeof _.focus=="function"&&_.focus(),_=0;_<ge.length;_++){var de=ge[_];de.element.scrollLeft=de.left,de.element.scrollTop=de.top}}ru=!!Xf,Kf=Xf=null}finally{vt=h,q.p=u,F.T=a}}n.current=i,gn=2}}function ry(){if(gn===2){gn=0;var n=Mi,i=Xs,a=(i.flags&8772)!==0;if((i.subtreeFlags&8772)!==0||a){a=F.T,F.T=null;var u=q.p;q.p=2;var h=vt;vt|=4;try{Og(n,i.alternate,i)}finally{vt=h,q.p=u,F.T=a}}gn=3}}function iy(){if(gn===4||gn===3){gn=0,Pn();var n=Mi,i=Xs,a=ui,u=$g;(i.subtreeFlags&10256)!==0||(i.flags&10256)!==0?gn=5:(gn=0,Xs=Mi=null,sy(n,n.pendingLanes));var h=n.pendingLanes;if(h===0&&(Ri=null),nn(a),i=i.stateNode,xt&&typeof xt.onCommitFiberRoot=="function")try{xt.onCommitFiberRoot(Ct,i,void 0,(i.current.flags&128)===128)}catch{}if(u!==null){i=F.T,h=q.p,q.p=2,F.T=null;try{for(var p=n.onRecoverableError,w=0;w<u.length;w++){var _=u[w];p(_.value,{componentStack:_.stack})}}finally{F.T=i,q.p=h}}(ui&3)!==0&&Vo(),Hr(n),h=n.pendingLanes,(a&261930)!==0&&(h&42)!==0?n===zf?sl++:(sl=0,zf=n):sl=0,al(0)}}function sy(n,i){(n.pooledCacheLanes&=i)===0&&(i=n.pooledCache,i!=null&&(n.pooledCache=null,Ha(i)))}function Vo(){return ny(),ry(),iy(),ay()}function ay(){if(gn!==5)return!1;var n=Mi,i=Df;Df=0;var a=nn(ui),u=F.T,h=q.p;try{q.p=32>a?32:a,F.T=null,a=Lf,Lf=null;var p=Mi,w=ui;if(gn=0,Xs=Mi=null,ui=0,(vt&6)!==0)throw Error(s(331));var _=vt;if(vt|=4,qg(p.current),Pg(p,p.current,w,a),vt=_,al(0,!1),xt&&typeof xt.onPostCommitFiberRoot=="function")try{xt.onPostCommitFiberRoot(Ct,p)}catch{}return!0}finally{q.p=h,F.T=u,sy(n,i)}}function ly(n,i,a){i=pr(a,i),i=mf(n.stateNode,i,2),n=Ci(n,i,2),n!==null&&(ft(n,2),Hr(n))}function Et(n,i,a){if(n.tag===3)ly(n,n,a);else for(;i!==null;){if(i.tag===3){ly(i,n,a);break}else if(i.tag===1){var u=i.stateNode;if(typeof i.type.getDerivedStateFromError=="function"||typeof u.componentDidCatch=="function"&&(Ri===null||!Ri.has(u))){n=pr(a,n),a=og(2),u=Ci(i,a,2),u!==null&&(ug(a,u,i,n),ft(u,2),Hr(u));break}}i=i.return}}function Bf(n,i,a){var u=n.pingCache;if(u===null){u=n.pingCache=new cw;var h=new Set;u.set(i,h)}else h=u.get(i),h===void 0&&(h=new Set,u.set(i,h));h.has(a)||(Of=!0,h.add(a),n=pw.bind(null,n,i,a),i.then(n,n))}function pw(n,i,a){var u=n.pingCache;u!==null&&u.delete(i),n.pingedLanes|=n.suspendedLanes&a,n.warmLanes&=~a,Dt===n&&(lt&a)===a&&(en===4||en===3&&(lt&62914560)===lt&&300>$e()-Bo?(vt&2)===0&&Ks(n,0):Rf|=a,Js===lt&&(Js=0)),Hr(n)}function oy(n,i){i===0&&(i=We()),n=rs(n,i),n!==null&&(ft(n,i),Hr(n))}function gw(n){var i=n.memoizedState,a=0;i!==null&&(a=i.retryLane),oy(n,a)}function yw(n,i){var a=0;switch(n.tag){case 31:case 13:var u=n.stateNode,h=n.memoizedState;h!==null&&(a=h.retryLane);break;case 19:u=n.stateNode;break;case 22:u=n.stateNode._retryCache;break;default:throw Error(s(314))}u!==null&&u.delete(i),oy(n,a)}function bw(n,i){return Ke(n,i)}var Yo=null,Zs=null,Hf=!1,Go=!1,qf=!1,Li=0;function Hr(n){n!==Zs&&n.next===null&&(Zs===null?Yo=Zs=n:Zs=Zs.next=n),Go=!0,Hf||(Hf=!0,vw())}function al(n,i){if(!qf&&Go){qf=!0;do for(var a=!1,u=Yo;u!==null;){if(n!==0){var h=u.pendingLanes;if(h===0)var p=0;else{var w=u.suspendedLanes,_=u.pingedLanes;p=(1<<31-nt(42|n)+1)-1,p&=h&~(w&~_),p=p&201326741?p&201326741|1:p?p|2:0}p!==0&&(a=!0,hy(u,p))}else p=lt,p=xe(u,u===Dt?p:0,u.cancelPendingCommit!==null||u.timeoutHandle!==-1),(p&3)===0||Ae(u,p)||(a=!0,hy(u,p));u=u.next}while(a);qf=!1}}function xw(){uy()}function uy(){Go=Hf=!1;var n=0;Li!==0&&Tw()&&(n=Li);for(var i=$e(),a=null,u=Yo;u!==null;){var h=u.next,p=cy(u,i);p===0?(u.next=null,a===null?Yo=h:a.next=h,h===null&&(Zs=a)):(a=u,(n!==0||(p&3)!==0)&&(Go=!0)),u=h}gn!==0&&gn!==5||al(n),Li!==0&&(Li=0)}function cy(n,i){for(var a=n.suspendedLanes,u=n.pingedLanes,h=n.expirationTimes,p=n.pendingLanes&-62914561;0<p;){var w=31-nt(p),_=1<<w,H=h[w];H===-1?((_&a)===0||(_&u)!==0)&&(h[w]=Ye(_,i)):H<=i&&(n.expiredLanes|=_),p&=~_}if(i=Dt,a=lt,a=xe(n,n===i?a:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),u=n.callbackNode,a===0||n===i&&(kt===2||kt===9)||n.cancelPendingCommit!==null)return u!==null&&u!==null&&bt(u),n.callbackNode=null,n.callbackPriority=0;if((a&3)===0||Ae(n,a)){if(i=a&-a,i===n.callbackPriority)return i;switch(u!==null&&bt(u),nn(a)){case 2:case 8:a=Se;break;case 32:a=Le;break;case 268435456:a=et;break;default:a=Le}return u=fy.bind(null,n),a=Ke(a,u),n.callbackPriority=i,n.callbackNode=a,i}return u!==null&&u!==null&&bt(u),n.callbackPriority=2,n.callbackNode=null,2}function fy(n,i){if(gn!==0&&gn!==5)return n.callbackNode=null,n.callbackPriority=0,null;var a=n.callbackNode;if(Vo()&&n.callbackNode!==a)return null;var u=lt;return u=xe(n,n===Dt?u:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),u===0?null:(Yg(n,u,i),cy(n,$e()),n.callbackNode!=null&&n.callbackNode===a?fy.bind(null,n):null)}function hy(n,i){if(Vo())return null;Yg(n,i,!0)}function vw(){Rw(function(){(vt&6)!==0?Ke(fe,xw):uy()})}function If(){if(Li===0){var n=Us;n===0&&(n=_t,_t<<=1,(_t&261888)===0&&(_t=256)),Li=n}return Li}function dy(n){return n==null||typeof n=="symbol"||typeof n=="boolean"?null:typeof n=="function"?n:eo(""+n)}function my(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 ww(n,i,a,u,h){if(i==="submit"&&a&&a.stateNode===h){var p=dy((h[Zt]||null).action),w=u.submitter;w&&(i=(i=w[Zt]||null)?dy(i.formAction):w.getAttribute("formAction"),i!==null&&(p=i,w=null));var _=new io("action","action",null,u,h);n.push({event:_,listeners:[{instance:null,listener:function(){if(u.defaultPrevented){if(Li!==0){var H=w?my(h,w):new FormData(h);of(a,{pending:!0,data:H,method:h.method,action:p},null,H)}}else typeof p=="function"&&(_.preventDefault(),H=w?my(h,w):new FormData(h),of(a,{pending:!0,data:H,method:h.method,action:p},p,H))},currentTarget:h}]})}}for(var Ff=0;Ff<kc.length;Ff++){var $f=kc[Ff],Sw=$f.toLowerCase(),_w=$f[0].toUpperCase()+$f.slice(1);Ar(Sw,"on"+_w)}Ar(Vm,"onAnimationEnd"),Ar(Ym,"onAnimationIteration"),Ar(Gm,"onAnimationStart"),Ar("dblclick","onDoubleClick"),Ar("focusin","onFocus"),Ar("focusout","onBlur"),Ar(Bv,"onTransitionRun"),Ar(Hv,"onTransitionStart"),Ar(qv,"onTransitionCancel"),Ar(Jm,"onTransitionEnd"),ae("onMouseEnter",["mouseout","mouseover"]),ae("onMouseLeave",["mouseout","mouseover"]),ae("onPointerEnter",["pointerout","pointerover"]),ae("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 ll="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(" "),kw=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(ll));function py(n,i){i=(i&4)!==0;for(var a=0;a<n.length;a++){var u=n[a],h=u.event;u=u.listeners;e:{var p=void 0;if(i)for(var w=u.length-1;0<=w;w--){var _=u[w],H=_.instance,ne=_.currentTarget;if(_=_.listener,H!==p&&h.isPropagationStopped())break e;p=_,h.currentTarget=ne;try{p(h)}catch(he){lo(he)}h.currentTarget=null,p=H}else for(w=0;w<u.length;w++){if(_=u[w],H=_.instance,ne=_.currentTarget,_=_.listener,H!==p&&h.isPropagationStopped())break e;p=_,h.currentTarget=ne;try{p(h)}catch(he){lo(he)}h.currentTarget=null,p=H}}}}function st(n,i){var a=i[Wi];a===void 0&&(a=i[Wi]=new Set);var u=n+"__bubble";a.has(u)||(gy(i,n,2,!1),a.add(u))}function Vf(n,i,a){var u=0;i&&(u|=4),gy(a,n,u,i)}var Jo="_reactListening"+Math.random().toString(36).slice(2);function Yf(n){if(!n[Jo]){n[Jo]=!0,Q.forEach(function(a){a!=="selectionchange"&&(kw.has(a)||Vf(a,!1,n),Vf(a,!0,n))});var i=n.nodeType===9?n:n.ownerDocument;i===null||i[Jo]||(i[Jo]=!0,Vf("selectionchange",!1,i))}}function gy(n,i,a,u){switch(Vy(i)){case 2:var h=Zw;break;case 8:h=Ww;break;default:h=lh}a=h.bind(null,i,a,n),h=void 0,!fc||i!=="touchstart"&&i!=="touchmove"&&i!=="wheel"||(h=!0),u?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,u,h){var p=u;if((i&1)===0&&(i&2)===0&&u!==null)e:for(;;){if(u===null)return;var w=u.tag;if(w===3||w===4){var _=u.stateNode.containerInfo;if(_===h)break;if(w===4)for(w=u.return;w!==null;){var H=w.tag;if((H===3||H===4)&&w.stateNode.containerInfo===h)return;w=w.return}for(;_!==null;){if(w=k(_),w===null)return;if(H=w.tag,H===5||H===6||H===26||H===27){u=p=w;continue e}_=_.parentNode}}u=u.return}wm(function(){var ne=p,he=uc(a),ge=[];e:{var se=Xm.get(n);if(se!==void 0){var ue=io,De=n;switch(n){case"keypress":if(no(a)===0)break e;case"keydown":case"keyup":ue=yv;break;case"focusin":De="focus",ue=pc;break;case"focusout":De="blur",ue=pc;break;case"beforeblur":case"afterblur":ue=pc;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":ue=km;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ue=sv;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ue=vv;break;case Vm:case Ym:case Gm:ue=ov;break;case Jm:ue=Sv;break;case"scroll":case"scrollend":ue=rv;break;case"wheel":ue=kv;break;case"copy":case"cut":case"paste":ue=cv;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ue=Cm;break;case"toggle":case"beforetoggle":ue=Cv}var qe=(i&4)!==0,Nt=!qe&&(n==="scroll"||n==="scrollend"),K=qe?se!==null?se+"Capture":null:se;qe=[];for(var J=ne,te;J!==null;){var de=J;if(te=de.stateNode,de=de.tag,de!==5&&de!==26&&de!==27||te===null||K===null||(de=Na(J,K),de!=null&&qe.push(ol(J,de,te))),Nt)break;J=J.return}0<qe.length&&(se=new ue(se,De,null,a,he),ge.push({event:se,listeners:qe}))}}if((i&7)===0){e:{if(se=n==="mouseover"||n==="pointerover",ue=n==="mouseout"||n==="pointerout",se&&a!==oc&&(De=a.relatedTarget||a.fromElement)&&(k(De)||De[Kn]))break e;if((ue||se)&&(se=he.window===he?he:(se=he.ownerDocument)?se.defaultView||se.parentWindow:window,ue?(De=a.relatedTarget||a.toElement,ue=ne,De=De?k(De):null,De!==null&&(Nt=o(De),qe=De.tag,De!==Nt||qe!==5&&qe!==27&&qe!==6)&&(De=null)):(ue=null,De=ne),ue!==De)){if(qe=km,de="onMouseLeave",K="onMouseEnter",J="mouse",(n==="pointerout"||n==="pointerover")&&(qe=Cm,de="onPointerLeave",K="onPointerEnter",J="pointer"),Nt=ue==null?se:N(ue),te=De==null?se:N(De),se=new qe(de,J+"leave",ue,a,he),se.target=Nt,se.relatedTarget=te,de=null,k(he)===ne&&(qe=new qe(K,J+"enter",De,a,he),qe.target=te,qe.relatedTarget=Nt,de=qe),Nt=de,ue&&De)t:{for(qe=Ew,K=ue,J=De,te=0,de=K;de;de=qe(de))te++;de=0;for(var Ue=J;Ue;Ue=qe(Ue))de++;for(;0<te-de;)K=qe(K),te--;for(;0<de-te;)J=qe(J),de--;for(;te--;){if(K===J||J!==null&&K===J.alternate){qe=K;break t}K=qe(K),J=qe(J)}qe=null}else qe=null;ue!==null&&yy(ge,se,ue,qe,!1),De!==null&&Nt!==null&&yy(ge,Nt,De,qe,!0)}}e:{if(se=ne?N(ne):window,ue=se.nodeName&&se.nodeName.toLowerCase(),ue==="select"||ue==="input"&&se.type==="file")var gt=Dm;else if(Rm(se))if(Lm)gt=zv;else{gt=Dv;var ze=Mv}else ue=se.nodeName,!ue||ue.toLowerCase()!=="input"||se.type!=="checkbox"&&se.type!=="radio"?ne&&lc(ne.elementType)&&(gt=Dm):gt=Lv;if(gt&&(gt=gt(n,ne))){Mm(ge,gt,a,he);break e}ze&&ze(n,se,ne),n==="focusout"&&ne&&se.type==="number"&&ne.memoizedProps.value!=null&&ac(se,"number",se.value)}switch(ze=ne?N(ne):window,n){case"focusin":(Rm(ze)||ze.contentEditable==="true")&&(Ns=ze,wc=ne,Ua=null);break;case"focusout":Ua=wc=Ns=null;break;case"mousedown":Sc=!0;break;case"contextmenu":case"mouseup":case"dragend":Sc=!1,Fm(ge,a,he);break;case"selectionchange":if(Pv)break;case"keydown":case"keyup":Fm(ge,a,he)}var Qe;if(yc)e:{switch(n){case"compositionstart":var ot="onCompositionStart";break e;case"compositionend":ot="onCompositionEnd";break e;case"compositionupdate":ot="onCompositionUpdate";break e}ot=void 0}else js?Tm(n,a)&&(ot="onCompositionEnd"):n==="keydown"&&a.keyCode===229&&(ot="onCompositionStart");ot&&(Am&&a.locale!=="ko"&&(js||ot!=="onCompositionStart"?ot==="onCompositionEnd"&&js&&(Qe=Sm()):(xi=he,hc="value"in xi?xi.value:xi.textContent,js=!0)),ze=Xo(ne,ot),0<ze.length&&(ot=new Em(ot,n,null,a,he),ge.push({event:ot,listeners:ze}),Qe?ot.data=Qe:(Qe=Om(a),Qe!==null&&(ot.data=Qe)))),(Qe=jv?Nv(n,a):Tv(n,a))&&(ot=Xo(ne,"onBeforeInput"),0<ot.length&&(ze=new Em("onBeforeInput","beforeinput",null,a,he),ge.push({event:ze,listeners:ot}),ze.data=Qe)),ww(ge,n,ne,a,he)}py(ge,i)})}function ol(n,i,a){return{instance:n,listener:i,currentTarget:a}}function Xo(n,i){for(var a=i+"Capture",u=[];n!==null;){var h=n,p=h.stateNode;if(h=h.tag,h!==5&&h!==26&&h!==27||p===null||(h=Na(n,a),h!=null&&u.unshift(ol(n,h,p)),h=Na(n,i),h!=null&&u.push(ol(n,h,p))),n.tag===3)return u;n=n.return}return[]}function Ew(n){if(n===null)return null;do n=n.return;while(n&&n.tag!==5&&n.tag!==27);return n||null}function yy(n,i,a,u,h){for(var p=i._reactName,w=[];a!==null&&a!==u;){var _=a,H=_.alternate,ne=_.stateNode;if(_=_.tag,H!==null&&H===u)break;_!==5&&_!==26&&_!==27||ne===null||(H=ne,h?(ne=Na(a,p),ne!=null&&w.unshift(ol(a,ne,H))):h||(ne=Na(a,p),ne!=null&&w.push(ol(a,ne,H)))),a=a.return}w.length!==0&&n.push({event:i,listeners:w})}var Cw=/\r\n?/g,Aw=/\u0000|\uFFFD/g;function by(n){return(typeof n=="string"?n:""+n).replace(Cw,`
49
+ `).replace(Aw,"")}function xy(n,i){return i=by(i),by(n)===i}function jt(n,i,a,u,h,p){switch(a){case"children":typeof u=="string"?i==="body"||i==="textarea"&&u===""||Es(n,u):(typeof u=="number"||typeof u=="bigint")&&i!=="body"&&Es(n,""+u);break;case"className":Cr(n,"class",u);break;case"tabIndex":Cr(n,"tabindex",u);break;case"dir":case"role":case"viewBox":case"width":case"height":Cr(n,a,u);break;case"style":xm(n,u,p);break;case"data":if(i!=="object"){Cr(n,"data",u);break}case"src":case"href":if(u===""&&(i!=="a"||a!=="href")){n.removeAttribute(a);break}if(u==null||typeof u=="function"||typeof u=="symbol"||typeof u=="boolean"){n.removeAttribute(a);break}u=eo(""+u),n.setAttribute(a,u);break;case"action":case"formAction":if(typeof u=="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"&&jt(n,i,"name",h.name,h,null),jt(n,i,"formEncType",h.formEncType,h,null),jt(n,i,"formMethod",h.formMethod,h,null),jt(n,i,"formTarget",h.formTarget,h,null)):(jt(n,i,"encType",h.encType,h,null),jt(n,i,"method",h.method,h,null),jt(n,i,"target",h.target,h,null)));if(u==null||typeof u=="symbol"||typeof u=="boolean"){n.removeAttribute(a);break}u=eo(""+u),n.setAttribute(a,u);break;case"onClick":u!=null&&(n.onclick=Jr);break;case"onScroll":u!=null&&st("scroll",n);break;case"onScrollEnd":u!=null&&st("scrollend",n);break;case"dangerouslySetInnerHTML":if(u!=null){if(typeof u!="object"||!("__html"in u))throw Error(s(61));if(a=u.__html,a!=null){if(h.children!=null)throw Error(s(60));n.innerHTML=a}}break;case"multiple":n.multiple=u&&typeof u!="function"&&typeof u!="symbol";break;case"muted":n.muted=u&&typeof u!="function"&&typeof u!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(u==null||typeof u=="function"||typeof u=="boolean"||typeof u=="symbol"){n.removeAttribute("xlink:href");break}a=eo(""+u),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":u!=null&&typeof u!="function"&&typeof u!="symbol"?n.setAttribute(a,""+u):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":u&&typeof u!="function"&&typeof u!="symbol"?n.setAttribute(a,""):n.removeAttribute(a);break;case"capture":case"download":u===!0?n.setAttribute(a,""):u!==!1&&u!=null&&typeof u!="function"&&typeof u!="symbol"?n.setAttribute(a,u):n.removeAttribute(a);break;case"cols":case"rows":case"size":case"span":u!=null&&typeof u!="function"&&typeof u!="symbol"&&!isNaN(u)&&1<=u?n.setAttribute(a,u):n.removeAttribute(a);break;case"rowSpan":case"start":u==null||typeof u=="function"||typeof u=="symbol"||isNaN(u)?n.removeAttribute(a):n.setAttribute(a,u);break;case"popover":st("beforetoggle",n),st("toggle",n),En(n,"popover",u);break;case"xlinkActuate":Gr(n,"http://www.w3.org/1999/xlink","xlink:actuate",u);break;case"xlinkArcrole":Gr(n,"http://www.w3.org/1999/xlink","xlink:arcrole",u);break;case"xlinkRole":Gr(n,"http://www.w3.org/1999/xlink","xlink:role",u);break;case"xlinkShow":Gr(n,"http://www.w3.org/1999/xlink","xlink:show",u);break;case"xlinkTitle":Gr(n,"http://www.w3.org/1999/xlink","xlink:title",u);break;case"xlinkType":Gr(n,"http://www.w3.org/1999/xlink","xlink:type",u);break;case"xmlBase":Gr(n,"http://www.w3.org/XML/1998/namespace","xml:base",u);break;case"xmlLang":Gr(n,"http://www.w3.org/XML/1998/namespace","xml:lang",u);break;case"xmlSpace":Gr(n,"http://www.w3.org/XML/1998/namespace","xml:space",u);break;case"is":En(n,"is",u);break;case"innerText":case"textContent":break;default:(!(2<a.length)||a[0]!=="o"&&a[0]!=="O"||a[1]!=="n"&&a[1]!=="N")&&(a=tv.get(a)||a,En(n,a,u))}}function Jf(n,i,a,u,h,p){switch(a){case"style":xm(n,u,p);break;case"dangerouslySetInnerHTML":if(u!=null){if(typeof u!="object"||!("__html"in u))throw Error(s(61));if(a=u.__html,a!=null){if(h.children!=null)throw Error(s(60));n.innerHTML=a}}break;case"children":typeof u=="string"?Es(n,u):(typeof u=="number"||typeof u=="bigint")&&Es(n,""+u);break;case"onScroll":u!=null&&st("scroll",n);break;case"onScrollEnd":u!=null&&st("scrollend",n);break;case"onClick":u!=null&&(n.onclick=Jr);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[Zt]||null,p=p!=null?p[a]:null,typeof p=="function"&&n.removeEventListener(i,p,h),typeof u=="function")){typeof p!="function"&&p!==null&&(a in n?n[a]=null:n.hasAttribute(a)&&n.removeAttribute(a)),n.addEventListener(i,u,h);break e}a in n?n[a]=u:u===!0?n.setAttribute(a,""):En(n,a,u)}}}function kn(n,i,a){switch(i){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":st("error",n),st("load",n);var u=!1,h=!1,p;for(p in a)if(a.hasOwnProperty(p)){var w=a[p];if(w!=null)switch(p){case"src":u=!0;break;case"srcSet":h=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(s(137,i));default:jt(n,i,p,w,a,null)}}h&&jt(n,i,"srcSet",a.srcSet,a,null),u&&jt(n,i,"src",a.src,a,null);return;case"input":st("invalid",n);var _=p=w=h=null,H=null,ne=null;for(u in a)if(a.hasOwnProperty(u)){var he=a[u];if(he!=null)switch(u){case"name":h=he;break;case"type":w=he;break;case"checked":H=he;break;case"defaultChecked":ne=he;break;case"value":p=he;break;case"defaultValue":_=he;break;case"children":case"dangerouslySetInnerHTML":if(he!=null)throw Error(s(137,i));break;default:jt(n,i,u,he,a,null)}}pm(n,p,_,H,ne,w,h,!1);return;case"select":st("invalid",n),u=w=p=null;for(h in a)if(a.hasOwnProperty(h)&&(_=a[h],_!=null))switch(h){case"value":p=_;break;case"defaultValue":w=_;break;case"multiple":u=_;default:jt(n,i,h,_,a,null)}i=p,a=w,n.multiple=!!u,i!=null?ks(n,!!u,i,!1):a!=null&&ks(n,!!u,a,!0);return;case"textarea":st("invalid",n),p=h=u=null;for(w in a)if(a.hasOwnProperty(w)&&(_=a[w],_!=null))switch(w){case"value":u=_;break;case"defaultValue":h=_;break;case"children":p=_;break;case"dangerouslySetInnerHTML":if(_!=null)throw Error(s(91));break;default:jt(n,i,w,_,a,null)}ym(n,u,h,p);return;case"option":for(H in a)if(a.hasOwnProperty(H)&&(u=a[H],u!=null))switch(H){case"selected":n.selected=u&&typeof u!="function"&&typeof u!="symbol";break;default:jt(n,i,H,u,a,null)}return;case"dialog":st("beforetoggle",n),st("toggle",n),st("cancel",n),st("close",n);break;case"iframe":case"object":st("load",n);break;case"video":case"audio":for(u=0;u<ll.length;u++)st(ll[u],n);break;case"image":st("error",n),st("load",n);break;case"details":st("toggle",n);break;case"embed":case"source":case"link":st("error",n),st("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(ne in a)if(a.hasOwnProperty(ne)&&(u=a[ne],u!=null))switch(ne){case"children":case"dangerouslySetInnerHTML":throw Error(s(137,i));default:jt(n,i,ne,u,a,null)}return;default:if(lc(i)){for(he in a)a.hasOwnProperty(he)&&(u=a[he],u!==void 0&&Jf(n,i,he,u,a,void 0));return}}for(_ in a)a.hasOwnProperty(_)&&(u=a[_],u!=null&&jt(n,i,_,u,a,null))}function jw(n,i,a,u){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,w=null,_=null,H=null,ne=null,he=null;for(ue in a){var ge=a[ue];if(a.hasOwnProperty(ue)&&ge!=null)switch(ue){case"checked":break;case"value":break;case"defaultValue":H=ge;default:u.hasOwnProperty(ue)||jt(n,i,ue,null,u,ge)}}for(var se in u){var ue=u[se];if(ge=a[se],u.hasOwnProperty(se)&&(ue!=null||ge!=null))switch(se){case"type":p=ue;break;case"name":h=ue;break;case"checked":ne=ue;break;case"defaultChecked":he=ue;break;case"value":w=ue;break;case"defaultValue":_=ue;break;case"children":case"dangerouslySetInnerHTML":if(ue!=null)throw Error(s(137,i));break;default:ue!==ge&&jt(n,i,se,ue,u,ge)}}sc(n,w,_,H,ne,he,p,h);return;case"select":ue=w=_=se=null;for(p in a)if(H=a[p],a.hasOwnProperty(p)&&H!=null)switch(p){case"value":break;case"multiple":ue=H;default:u.hasOwnProperty(p)||jt(n,i,p,null,u,H)}for(h in u)if(p=u[h],H=a[h],u.hasOwnProperty(h)&&(p!=null||H!=null))switch(h){case"value":se=p;break;case"defaultValue":_=p;break;case"multiple":w=p;default:p!==H&&jt(n,i,h,p,u,H)}i=_,a=w,u=ue,se!=null?ks(n,!!a,se,!1):!!u!=!!a&&(i!=null?ks(n,!!a,i,!0):ks(n,!!a,a?[]:"",!1));return;case"textarea":ue=se=null;for(_ in a)if(h=a[_],a.hasOwnProperty(_)&&h!=null&&!u.hasOwnProperty(_))switch(_){case"value":break;case"children":break;default:jt(n,i,_,null,u,h)}for(w in u)if(h=u[w],p=a[w],u.hasOwnProperty(w)&&(h!=null||p!=null))switch(w){case"value":se=h;break;case"defaultValue":ue=h;break;case"children":break;case"dangerouslySetInnerHTML":if(h!=null)throw Error(s(91));break;default:h!==p&&jt(n,i,w,h,u,p)}gm(n,se,ue);return;case"option":for(var De in a)if(se=a[De],a.hasOwnProperty(De)&&se!=null&&!u.hasOwnProperty(De))switch(De){case"selected":n.selected=!1;break;default:jt(n,i,De,null,u,se)}for(H in u)if(se=u[H],ue=a[H],u.hasOwnProperty(H)&&se!==ue&&(se!=null||ue!=null))switch(H){case"selected":n.selected=se&&typeof se!="function"&&typeof se!="symbol";break;default:jt(n,i,H,se,u,ue)}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 qe in a)se=a[qe],a.hasOwnProperty(qe)&&se!=null&&!u.hasOwnProperty(qe)&&jt(n,i,qe,null,u,se);for(ne in u)if(se=u[ne],ue=a[ne],u.hasOwnProperty(ne)&&se!==ue&&(se!=null||ue!=null))switch(ne){case"children":case"dangerouslySetInnerHTML":if(se!=null)throw Error(s(137,i));break;default:jt(n,i,ne,se,u,ue)}return;default:if(lc(i)){for(var Nt in a)se=a[Nt],a.hasOwnProperty(Nt)&&se!==void 0&&!u.hasOwnProperty(Nt)&&Jf(n,i,Nt,void 0,u,se);for(he in u)se=u[he],ue=a[he],!u.hasOwnProperty(he)||se===ue||se===void 0&&ue===void 0||Jf(n,i,he,se,u,ue);return}}for(var K in a)se=a[K],a.hasOwnProperty(K)&&se!=null&&!u.hasOwnProperty(K)&&jt(n,i,K,null,u,se);for(ge in u)se=u[ge],ue=a[ge],!u.hasOwnProperty(ge)||se===ue||se==null&&ue==null||jt(n,i,ge,se,u,ue)}function vy(n){switch(n){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Nw(){if(typeof performance.getEntriesByType=="function"){for(var n=0,i=0,a=performance.getEntriesByType("resource"),u=0;u<a.length;u++){var h=a[u],p=h.transferSize,w=h.initiatorType,_=h.duration;if(p&&_&&vy(w)){for(w=0,_=h.responseEnd,u+=1;u<a.length;u++){var H=a[u],ne=H.startTime;if(ne>_)break;var he=H.transferSize,ge=H.initiatorType;he&&vy(ge)&&(H=H.responseEnd,w+=he*(H<_?1:(_-ne)/(H-ne)))}if(--u,i+=8*(p+w)/(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 Xf=null,Kf=null;function Ko(n){return n.nodeType===9?n:n.ownerDocument}function wy(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 Sy(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 Qf(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 Zf=null;function Tw(){var n=window.event;return n&&n.type==="popstate"?n===Zf?!1:(Zf=n,!0):(Zf=null,!1)}var _y=typeof setTimeout=="function"?setTimeout:void 0,Ow=typeof clearTimeout=="function"?clearTimeout:void 0,ky=typeof Promise=="function"?Promise:void 0,Rw=typeof queueMicrotask=="function"?queueMicrotask:typeof ky<"u"?function(n){return ky.resolve(null).then(n).catch(Mw)}:_y;function Mw(n){setTimeout(function(){throw n})}function zi(n){return n==="head"}function Ey(n,i){var a=i,u=0;do{var h=a.nextSibling;if(n.removeChild(a),h&&h.nodeType===8)if(a=h.data,a==="/$"||a==="/&"){if(u===0){n.removeChild(h),na(i);return}u--}else if(a==="$"||a==="$?"||a==="$~"||a==="$!"||a==="&")u++;else if(a==="html")ul(n.ownerDocument.documentElement);else if(a==="head"){a=n.ownerDocument.head,ul(a);for(var p=a.firstChild;p;){var w=p.nextSibling,_=p.nodeName;p[pn]||_==="SCRIPT"||_==="STYLE"||_==="LINK"&&p.rel.toLowerCase()==="stylesheet"||a.removeChild(p),p=w}}else a==="body"&&ul(n.ownerDocument.body);a=h}while(a);na(i)}function Cy(n,i){var a=n;n=0;do{var u=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||""),u&&u.nodeType===8)if(a=u.data,a==="/$"){if(n===0)break;n--}else a!=="$"&&a!=="$?"&&a!=="$~"&&a!=="$!"||n++;a=u}while(a)}function Wf(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":Wf(a),_s(a);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(a.rel.toLowerCase()==="stylesheet")continue}n.removeChild(a)}}function Dw(n,i,a,u){for(;n.nodeType===1;){var h=a;if(n.nodeName.toLowerCase()!==i.toLowerCase()){if(!u&&(n.nodeName!=="INPUT"||n.type!=="hidden"))break}else if(u){if(!n[pn])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=vr(n.nextSibling),n===null)break}return null}function Lw(n,i,a){if(i==="")return null;for(;n.nodeType!==3;)if((n.nodeType!==1||n.nodeName!=="INPUT"||n.type!=="hidden")&&!a||(n=vr(n.nextSibling),n===null))return null;return n}function Ay(n,i){for(;n.nodeType!==8;)if((n.nodeType!==1||n.nodeName!=="INPUT"||n.type!=="hidden")&&!i||(n=vr(n.nextSibling),n===null))return null;return n}function eh(n){return n.data==="$?"||n.data==="$~"}function th(n){return n.data==="$!"||n.data==="$?"&&n.ownerDocument.readyState!=="loading"}function zw(n,i){var a=n.ownerDocument;if(n.data==="$~")n._reactRetry=i;else if(n.data!=="$?"||a.readyState!=="loading")i();else{var u=function(){i(),a.removeEventListener("DOMContentLoaded",u)};a.addEventListener("DOMContentLoaded",u),n._reactRetry=u}}function vr(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 nh=null;function jy(n){n=n.nextSibling;for(var i=0;n;){if(n.nodeType===8){var a=n.data;if(a==="/$"||a==="/&"){if(i===0)return vr(n.nextSibling);i--}else a!=="$"&&a!=="$!"&&a!=="$?"&&a!=="$~"&&a!=="&"||i++}n=n.nextSibling}return null}function Ny(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 Ty(n,i,a){switch(i=Ko(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 ul(n){for(var i=n.attributes;i.length;)n.removeAttributeNode(i[0]);_s(n)}var wr=new Map,Oy=new Set;function Qo(n){return typeof n.getRootNode=="function"?n.getRootNode():n.nodeType===9?n:n.ownerDocument}var ci=q.d;q.d={f:Uw,r:Pw,D:Bw,C:Hw,L:qw,m:Iw,X:$w,S:Fw,M:Vw};function Uw(){var n=ci.f(),i=Io();return n||i}function Pw(n){var i=R(n);i!==null&&i.tag===5&&i.type==="form"?Jp(i):ci.r(n)}var Ws=typeof document>"u"?null:document;function Ry(n,i,a){var u=Ws;if(u&&typeof i=="string"&&i){var h=dr(i);h='link[rel="'+n+'"][href="'+h+'"]',typeof a=="string"&&(h+='[crossorigin="'+a+'"]'),Oy.has(h)||(Oy.add(h),n={rel:n,crossOrigin:a,href:i},u.querySelector(h)===null&&(i=u.createElement("link"),kn(i,"link",n),Y(i),u.head.appendChild(i)))}}function Bw(n){ci.D(n),Ry("dns-prefetch",n,null)}function Hw(n,i){ci.C(n,i),Ry("preconnect",n,i)}function qw(n,i,a){ci.L(n,i,a);var u=Ws;if(u&&n&&i){var h='link[rel="preload"][as="'+dr(i)+'"]';i==="image"&&a&&a.imageSrcSet?(h+='[imagesrcset="'+dr(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(h+='[imagesizes="'+dr(a.imageSizes)+'"]')):h+='[href="'+dr(n)+'"]';var p=h;switch(i){case"style":p=ea(n);break;case"script":p=ta(n)}wr.has(p)||(n=g({rel:"preload",href:i==="image"&&a&&a.imageSrcSet?void 0:n,as:i},a),wr.set(p,n),u.querySelector(h)!==null||i==="style"&&u.querySelector(cl(p))||i==="script"&&u.querySelector(fl(p))||(i=u.createElement("link"),kn(i,"link",n),Y(i),u.head.appendChild(i)))}}function Iw(n,i){ci.m(n,i);var a=Ws;if(a&&n){var u=i&&typeof i.as=="string"?i.as:"script",h='link[rel="modulepreload"][as="'+dr(u)+'"][href="'+dr(n)+'"]',p=h;switch(u){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":p=ta(n)}if(!wr.has(p)&&(n=g({rel:"modulepreload",href:n},i),wr.set(p,n),a.querySelector(h)===null)){switch(u){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(fl(p)))return}u=a.createElement("link"),kn(u,"link",n),Y(u),a.head.appendChild(u)}}}function Fw(n,i,a){ci.S(n,i,a);var u=Ws;if(u&&n){var h=z(u).hoistableStyles,p=ea(n);i=i||"default";var w=h.get(p);if(!w){var _={loading:0,preload:null};if(w=u.querySelector(cl(p)))_.loading=5;else{n=g({rel:"stylesheet",href:n,"data-precedence":i},a),(a=wr.get(p))&&rh(n,a);var H=w=u.createElement("link");Y(H),kn(H,"link",n),H._p=new Promise(function(ne,he){H.onload=ne,H.onerror=he}),H.addEventListener("load",function(){_.loading|=1}),H.addEventListener("error",function(){_.loading|=2}),_.loading|=4,Zo(w,i,u)}w={type:"stylesheet",instance:w,count:1,state:_},h.set(p,w)}}}function $w(n,i){ci.X(n,i);var a=Ws;if(a&&n){var u=z(a).hoistableScripts,h=ta(n),p=u.get(h);p||(p=a.querySelector(fl(h)),p||(n=g({src:n,async:!0},i),(i=wr.get(h))&&ih(n,i),p=a.createElement("script"),Y(p),kn(p,"link",n),a.head.appendChild(p)),p={type:"script",instance:p,count:1,state:null},u.set(h,p))}}function Vw(n,i){ci.M(n,i);var a=Ws;if(a&&n){var u=z(a).hoistableScripts,h=ta(n),p=u.get(h);p||(p=a.querySelector(fl(h)),p||(n=g({src:n,async:!0,type:"module"},i),(i=wr.get(h))&&ih(n,i),p=a.createElement("script"),Y(p),kn(p,"link",n),a.head.appendChild(p)),p={type:"script",instance:p,count:1,state:null},u.set(h,p))}}function My(n,i,a,u){var h=(h=_e.current)?Qo(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=ea(a.href),a=z(h).hoistableStyles,u=a.get(i),u||(u={type:"style",instance:null,count:0,state:null},a.set(i,u)),u):{type:"void",instance:null,count:0,state:null};case"link":if(a.rel==="stylesheet"&&typeof a.href=="string"&&typeof a.precedence=="string"){n=ea(a.href);var p=z(h).hoistableStyles,w=p.get(n);if(w||(h=h.ownerDocument||h,w={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},p.set(n,w),(p=h.querySelector(cl(n)))&&!p._p&&(w.instance=p,w.state.loading=5),wr.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},wr.set(n,a),p||Yw(h,n,a,w.state))),i&&u===null)throw Error(s(528,""));return w}if(i&&u!==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=ta(a),a=z(h).hoistableScripts,u=a.get(i),u||(u={type:"script",instance:null,count:0,state:null},a.set(i,u)),u):{type:"void",instance:null,count:0,state:null};default:throw Error(s(444,n))}}function ea(n){return'href="'+dr(n)+'"'}function cl(n){return'link[rel="stylesheet"]['+n+"]"}function Dy(n){return g({},n,{"data-precedence":n.precedence,precedence:null})}function Yw(n,i,a,u){n.querySelector('link[rel="preload"][as="style"]['+i+"]")?u.loading=1:(i=n.createElement("link"),u.preload=i,i.addEventListener("load",function(){return u.loading|=1}),i.addEventListener("error",function(){return u.loading|=2}),kn(i,"link",a),Y(i),n.head.appendChild(i))}function ta(n){return'[src="'+dr(n)+'"]'}function fl(n){return"script[async]"+n}function Ly(n,i,a){if(i.count++,i.instance===null)switch(i.type){case"style":var u=n.querySelector('style[data-href~="'+dr(a.href)+'"]');if(u)return i.instance=u,Y(u),u;var h=g({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return u=(n.ownerDocument||n).createElement("style"),Y(u),kn(u,"style",h),Zo(u,a.precedence,n),i.instance=u;case"stylesheet":h=ea(a.href);var p=n.querySelector(cl(h));if(p)return i.state.loading|=4,i.instance=p,Y(p),p;u=Dy(a),(h=wr.get(h))&&rh(u,h),p=(n.ownerDocument||n).createElement("link"),Y(p);var w=p;return w._p=new Promise(function(_,H){w.onload=_,w.onerror=H}),kn(p,"link",u),i.state.loading|=4,Zo(p,a.precedence,n),i.instance=p;case"script":return p=ta(a.src),(h=n.querySelector(fl(p)))?(i.instance=h,Y(h),h):(u=a,(h=wr.get(p))&&(u=g({},a),ih(u,h)),n=n.ownerDocument||n,h=n.createElement("script"),Y(h),kn(h,"link",u),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&&(u=i.instance,i.state.loading|=4,Zo(u,a.precedence,n));return i.instance}function Zo(n,i,a){for(var u=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),h=u.length?u[u.length-1]:null,p=h,w=0;w<u.length;w++){var _=u[w];if(_.dataset.precedence===i)p=_;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 rh(n,i){n.crossOrigin==null&&(n.crossOrigin=i.crossOrigin),n.referrerPolicy==null&&(n.referrerPolicy=i.referrerPolicy),n.title==null&&(n.title=i.title)}function ih(n,i){n.crossOrigin==null&&(n.crossOrigin=i.crossOrigin),n.referrerPolicy==null&&(n.referrerPolicy=i.referrerPolicy),n.integrity==null&&(n.integrity=i.integrity)}var Wo=null;function zy(n,i,a){if(Wo===null){var u=new Map,h=Wo=new Map;h.set(a,u)}else h=Wo,u=h.get(a),u||(u=new Map,h.set(a,u));if(u.has(n))return u;for(u.set(n,null),a=a.getElementsByTagName(n),h=0;h<a.length;h++){var p=a[h];if(!(p[pn]||p[wt]||n==="link"&&p.getAttribute("rel")==="stylesheet")&&p.namespaceURI!=="http://www.w3.org/2000/svg"){var w=p.getAttribute(i)||"";w=n+w;var _=u.get(w);_?_.push(p):u.set(w,[p])}}return u}function Uy(n,i,a){n=n.ownerDocument||n,n.head.insertBefore(a,i==="title"?n.querySelector("head > title"):null)}function Gw(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 Py(n){return!(n.type==="stylesheet"&&(n.state.loading&3)===0)}function Jw(n,i,a,u){if(a.type==="stylesheet"&&(typeof u.media!="string"||matchMedia(u.media).matches!==!1)&&(a.state.loading&4)===0){if(a.instance===null){var h=ea(u.href),p=i.querySelector(cl(h));if(p){i=p._p,i!==null&&typeof i=="object"&&typeof i.then=="function"&&(n.count++,n=eu.bind(n),i.then(n,n)),a.state.loading|=4,a.instance=p,Y(p);return}p=i.ownerDocument||i,u=Dy(u),(h=wr.get(h))&&rh(u,h),p=p.createElement("link"),Y(p);var w=p;w._p=new Promise(function(_,H){w.onload=_,w.onerror=H}),kn(p,"link",u),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=eu.bind(n),i.addEventListener("load",a),i.addEventListener("error",a))}}var sh=0;function Xw(n,i){return n.stylesheets&&n.count===0&&nu(n,n.stylesheets),0<n.count||0<n.imgCount?function(a){var u=setTimeout(function(){if(n.stylesheets&&nu(n,n.stylesheets),n.unsuspend){var p=n.unsuspend;n.unsuspend=null,p()}},6e4+i);0<n.imgBytes&&sh===0&&(sh=62500*Nw());var h=setTimeout(function(){if(n.waitingForImages=!1,n.count===0&&(n.stylesheets&&nu(n,n.stylesheets),n.unsuspend)){var p=n.unsuspend;n.unsuspend=null,p()}},(n.imgBytes>sh?50:800)+i);return n.unsuspend=a,function(){n.unsuspend=null,clearTimeout(u),clearTimeout(h)}}:null}function eu(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)nu(this,this.stylesheets);else if(this.unsuspend){var n=this.unsuspend;this.unsuspend=null,n()}}}var tu=null;function nu(n,i){n.stylesheets=null,n.unsuspend!==null&&(n.count++,tu=new Map,i.forEach(Kw,n),tu=null,eu.call(n))}function Kw(n,i){if(!(i.state.loading&4)){var a=tu.get(n);if(a)var u=a.get(null);else{a=new Map,tu.set(n,a);for(var h=n.querySelectorAll("link[data-precedence],style[data-precedence]"),p=0;p<h.length;p++){var w=h[p];(w.nodeName==="LINK"||w.getAttribute("media")!=="not all")&&(a.set(w.dataset.precedence,w),u=w)}u&&a.set(null,u)}h=i.instance,w=h.getAttribute("data-precedence"),p=a.get(w)||u,p===u&&a.set(null,h),a.set(w,h),this.count++,u=eu.bind(this),h.addEventListener("load",u),h.addEventListener("error",u),p?p.parentNode.insertBefore(h,p.nextSibling):(n=n.nodeType===9?n.head:n,n.insertBefore(h,n.firstChild)),i.state.loading|=4}}var hl={$$typeof:I,Provider:null,Consumer:null,_currentValue:le,_currentValue2:le,_threadCount:0};function Qw(n,i,a,u,h,p,w,_,H){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=Fe(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Fe(0),this.hiddenUpdates=Fe(null),this.identifierPrefix=u,this.onUncaughtError=h,this.onCaughtError=p,this.onRecoverableError=w,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=H,this.incompleteTransitions=new Map}function By(n,i,a,u,h,p,w,_,H,ne,he,ge){return n=new Qw(n,i,a,w,H,ne,he,ge,_),i=1,p===!0&&(i|=24),p=Zn(3,null,null,i),n.current=p,p.stateNode=n,i=Uc(),i.refCount++,n.pooledCache=i,i.refCount++,p.memoizedState={element:u,isDehydrated:a,cache:i},qc(p),n}function Hy(n){return n?(n=Rs,n):Rs}function qy(n,i,a,u,h,p){h=Hy(h),u.context===null?u.context=h:u.pendingContext=h,u=Ei(i),u.payload={element:a},p=p===void 0?null:p,p!==null&&(u.callback=p),a=Ci(n,u,i),a!==null&&(Vn(a,n,i),$a(a,n,i))}function Iy(n,i){if(n=n.memoizedState,n!==null&&n.dehydrated!==null){var a=n.retryLane;n.retryLane=a!==0&&a<i?a:i}}function ah(n,i){Iy(n,i),(n=n.alternate)&&Iy(n,i)}function Fy(n){if(n.tag===13||n.tag===31){var i=rs(n,67108864);i!==null&&Vn(i,n,67108864),ah(n,67108864)}}function $y(n){if(n.tag===13||n.tag===31){var i=rr();i=It(i);var a=rs(n,i);a!==null&&Vn(a,n,i),ah(n,i)}}var ru=!0;function Zw(n,i,a,u){var h=F.T;F.T=null;var p=q.p;try{q.p=2,lh(n,i,a,u)}finally{q.p=p,F.T=h}}function Ww(n,i,a,u){var h=F.T;F.T=null;var p=q.p;try{q.p=8,lh(n,i,a,u)}finally{q.p=p,F.T=h}}function lh(n,i,a,u){if(ru){var h=oh(u);if(h===null)Gf(n,i,u,iu,a),Yy(n,u);else if(tS(h,n,i,a,u))u.stopPropagation();else if(Yy(n,u),i&4&&-1<eS.indexOf(n)){for(;h!==null;){var p=R(h);if(p!==null)switch(p.tag){case 3:if(p=p.stateNode,p.current.memoizedState.isDehydrated){var w=Xn(p.pendingLanes);if(w!==0){var _=p;for(_.pendingLanes|=2,_.entangledLanes|=2;w;){var H=1<<31-nt(w);_.entanglements[1]|=H,w&=~H}Hr(p),(vt&6)===0&&(Ho=$e()+500,al(0))}}break;case 31:case 13:_=rs(p,2),_!==null&&Vn(_,p,2),Io(),ah(p,2)}if(p=oh(u),p===null&&Gf(n,i,u,iu,a),p===h)break;h=p}h!==null&&u.stopPropagation()}else Gf(n,i,u,null,a)}}function oh(n){return n=uc(n),uh(n)}var iu=null;function uh(n){if(iu=null,n=k(n),n!==null){var i=o(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 iu=n,null}function Vy(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(Tn()){case fe:return 2;case Se:return 8;case Le:case Ge:return 32;case et:return 268435456;default:return 32}default:return 32}}var ch=!1,Ui=null,Pi=null,Bi=null,dl=new Map,ml=new Map,Hi=[],eS="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 Yy(n,i){switch(n){case"focusin":case"focusout":Ui=null;break;case"dragenter":case"dragleave":Pi=null;break;case"mouseover":case"mouseout":Bi=null;break;case"pointerover":case"pointerout":dl.delete(i.pointerId);break;case"gotpointercapture":case"lostpointercapture":ml.delete(i.pointerId)}}function pl(n,i,a,u,h,p){return n===null||n.nativeEvent!==p?(n={blockedOn:i,domEventName:a,eventSystemFlags:u,nativeEvent:p,targetContainers:[h]},i!==null&&(i=R(i),i!==null&&Fy(i)),n):(n.eventSystemFlags|=u,i=n.targetContainers,h!==null&&i.indexOf(h)===-1&&i.push(h),n)}function tS(n,i,a,u,h){switch(i){case"focusin":return Ui=pl(Ui,n,i,a,u,h),!0;case"dragenter":return Pi=pl(Pi,n,i,a,u,h),!0;case"mouseover":return Bi=pl(Bi,n,i,a,u,h),!0;case"pointerover":var p=h.pointerId;return dl.set(p,pl(dl.get(p)||null,n,i,a,u,h)),!0;case"gotpointercapture":return p=h.pointerId,ml.set(p,pl(ml.get(p)||null,n,i,a,u,h)),!0}return!1}function Gy(n){var i=k(n.target);if(i!==null){var a=o(i);if(a!==null){if(i=a.tag,i===13){if(i=c(a),i!==null){n.blockedOn=i,Zi(n.priority,function(){$y(a)});return}}else if(i===31){if(i=f(a),i!==null){n.blockedOn=i,Zi(n.priority,function(){$y(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 su(n){if(n.blockedOn!==null)return!1;for(var i=n.targetContainers;0<i.length;){var a=oh(n.nativeEvent);if(a===null){a=n.nativeEvent;var u=new a.constructor(a.type,a);oc=u,a.target.dispatchEvent(u),oc=null}else return i=R(a),i!==null&&Fy(i),n.blockedOn=a,!1;i.shift()}return!0}function Jy(n,i,a){su(n)&&a.delete(i)}function nS(){ch=!1,Ui!==null&&su(Ui)&&(Ui=null),Pi!==null&&su(Pi)&&(Pi=null),Bi!==null&&su(Bi)&&(Bi=null),dl.forEach(Jy),ml.forEach(Jy)}function au(n,i){n.blockedOn===i&&(n.blockedOn=null,ch||(ch=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,nS)))}var lu=null;function Xy(n){lu!==n&&(lu=n,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){lu===n&&(lu=null);for(var i=0;i<n.length;i+=3){var a=n[i],u=n[i+1],h=n[i+2];if(typeof u!="function"){if(uh(u||a)===null)continue;break}var p=R(a);p!==null&&(n.splice(i,3),i-=3,of(p,{pending:!0,data:h,method:a.method,action:u},u,h))}}))}function na(n){function i(H){return au(H,n)}Ui!==null&&au(Ui,n),Pi!==null&&au(Pi,n),Bi!==null&&au(Bi,n),dl.forEach(i),ml.forEach(i);for(var a=0;a<Hi.length;a++){var u=Hi[a];u.blockedOn===n&&(u.blockedOn=null)}for(;0<Hi.length&&(a=Hi[0],a.blockedOn===null);)Gy(a),a.blockedOn===null&&Hi.shift();if(a=(n.ownerDocument||n).$$reactFormReplay,a!=null)for(u=0;u<a.length;u+=3){var h=a[u],p=a[u+1],w=h[Zt]||null;if(typeof p=="function")w||Xy(a);else if(w){var _=null;if(p&&p.hasAttribute("formAction")){if(h=p,w=p[Zt]||null)_=w.formAction;else if(uh(h)!==null)continue}else _=w.action;typeof _=="function"?a[u+1]=_:(a.splice(u,3),u-=3),Xy(a)}}}function Ky(){function n(p){p.canIntercept&&p.info==="react-transition"&&p.intercept({handler:function(){return new Promise(function(w){return h=w})},focusReset:"manual",scroll:"manual"})}function i(){h!==null&&(h(),h=null),u||setTimeout(a,20)}function a(){if(!u&&!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 u=!1,h=null;return navigation.addEventListener("navigate",n),navigation.addEventListener("navigatesuccess",i),navigation.addEventListener("navigateerror",i),setTimeout(a,100),function(){u=!0,navigation.removeEventListener("navigate",n),navigation.removeEventListener("navigatesuccess",i),navigation.removeEventListener("navigateerror",i),h!==null&&(h(),h=null)}}}function fh(n){this._internalRoot=n}ou.prototype.render=fh.prototype.render=function(n){var i=this._internalRoot;if(i===null)throw Error(s(409));var a=i.current,u=rr();qy(a,u,n,i,null,null)},ou.prototype.unmount=fh.prototype.unmount=function(){var n=this._internalRoot;if(n!==null){this._internalRoot=null;var i=n.containerInfo;qy(n.current,2,null,n,null,null),Io(),i[Kn]=null}};function ou(n){this._internalRoot=n}ou.prototype.unstable_scheduleHydration=function(n){if(n){var i=Bn();n={blockedOn:null,target:n,priority:i};for(var a=0;a<Hi.length&&i!==0&&i<Hi[a].priority;a++);Hi.splice(a,0,n),a===0&&Gy(n)}};var Qy=t.version;if(Qy!=="19.2.4")throw Error(s(527,Qy,"19.2.4"));q.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=m(i),n=n!==null?y(n):null,n=n===null?null:n.stateNode,n};var rS={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:F,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var uu=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!uu.isDisabled&&uu.supportsFiber)try{Ct=uu.inject(rS),xt=uu}catch{}}return yl.createRoot=function(n,i){if(!l(n))throw Error(s(299));var a=!1,u="",h=ig,p=sg,w=ag;return i!=null&&(i.unstable_strictMode===!0&&(a=!0),i.identifierPrefix!==void 0&&(u=i.identifierPrefix),i.onUncaughtError!==void 0&&(h=i.onUncaughtError),i.onCaughtError!==void 0&&(p=i.onCaughtError),i.onRecoverableError!==void 0&&(w=i.onRecoverableError)),i=By(n,1,!1,null,null,a,u,null,h,p,w,Ky),n[Kn]=i.current,Yf(n),new fh(i)},yl.hydrateRoot=function(n,i,a){if(!l(n))throw Error(s(299));var u=!1,h="",p=ig,w=sg,_=ag,H=null;return a!=null&&(a.unstable_strictMode===!0&&(u=!0),a.identifierPrefix!==void 0&&(h=a.identifierPrefix),a.onUncaughtError!==void 0&&(p=a.onUncaughtError),a.onCaughtError!==void 0&&(w=a.onCaughtError),a.onRecoverableError!==void 0&&(_=a.onRecoverableError),a.formState!==void 0&&(H=a.formState)),i=By(n,1,!0,i,a??null,u,h,H,p,w,_,Ky),i.context=Hy(null),a=i.current,u=rr(),u=It(u),h=Ei(u),h.callback=null,Ci(a,h,u),a=u,i.current.lanes=a,ft(i,a),Hr(i),n[Kn]=i.current,Yf(n),new ou(i)},yl.version="19.2.4",yl}var l0;function mS(){if(l0)return mh.exports;l0=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(),mh.exports=dS(),mh.exports}var pS=mS();/**
50
50
  * react-router v7.13.1
51
51
  *
52
52
  * Copyright (c) Remix Software Inc.
@@ -55,67 +55,67 @@ Error generating stack: `+o.message+`
55
55
  * LICENSE.md file in the root directory of this source tree.
56
56
  *
57
57
  * @license MIT
58
- */var l0="popstate";function o0(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function mS(e={}){function t(s,l){var m;let u=(m=l.state)==null?void 0:m.masked,{pathname:c,search:f,hash:d}=u||s.location;return Wh("",{pathname:c,search:f,hash:d},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:zl(l)}return gS(t,r,null,e)}function Yt(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function Lr(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function pS(){return Math.random().toString(36).substring(2,10)}function u0(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 Wh(e,t,r=null,s,l){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?Sa(t):t,state:r,key:t&&t.key||s||pS(),unstable_mask:l}}function zl({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 Sa(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 gS(e,t,r,s={}){let{window:l=document.defaultView,v5Compat:u=!1}=s,c=l.history,f="POP",d=null,m=y();m==null&&(m=0,c.replaceState({...c.state,idx:m},""));function y(){return(c.state||{idx:null}).idx}function g(){f="POP";let D=y(),T=D==null?null:D-m;m=D,d&&d({action:f,location:j.location,delta:T})}function x(D,T){f="PUSH";let P=o0(D)?D:Wh(j.location,D,T);m=y()+1;let I=u0(P,m),W=j.createHref(P.unstable_mask||P);try{c.pushState(I,"",W)}catch(B){if(B instanceof DOMException&&B.name==="DataCloneError")throw B;l.location.assign(W)}u&&d&&d({action:f,location:j.location,delta:1})}function v(D,T){f="REPLACE";let P=o0(D)?D:Wh(j.location,D,T);m=y();let I=u0(P,m),W=j.createHref(P.unstable_mask||P);c.replaceState(I,"",W),u&&d&&d({action:f,location:j.location,delta:0})}function S(D){return yS(D)}let j={get action(){return f},get location(){return e(l,c)},listen(D){if(d)throw new Error("A history only accepts one active listener");return l.addEventListener(l0,g),d=D,()=>{l.removeEventListener(l0,g),d=null}},createHref(D){return t(l,D)},createURL:S,encodeLocation(D){let T=S(D);return{pathname:T.pathname,search:T.search,hash:T.hash}},push:x,replace:v,go(D){return c.go(D)}};return j}function yS(e,t=!1){let r="http://localhost";typeof window<"u"&&(r=window.location.origin!=="null"?window.location.origin:window.location.href),Yt(r,"No window.location.(origin|href) available to create URL");let s=typeof e=="string"?e:zl(e);return s=s.replace(/ $/,"%20"),!t&&s.startsWith("//")&&(s=r+s),new URL(s,r)}function Xb(e,t,r="/"){return bS(e,t,r,!1)}function bS(e,t,r,s){let l=typeof t=="string"?Sa(t):t,u=pi(l.pathname||"/",r);if(u==null)return null;let c=Kb(e);xS(c);let f=null;for(let d=0;f==null&&d<c.length;++d){let m=TS(u);f=jS(c[d],m,s)}return f}function Kb(e,t=[],r=[],s="",l=!1){let u=(c,f,d=l,m)=>{let y={relativePath:m===void 0?c.path||"":m,caseSensitive:c.caseSensitive===!0,childrenIndex:f,route:c};if(y.relativePath.startsWith("/")){if(!y.relativePath.startsWith(s)&&d)return;Yt(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=$r([s,y.relativePath]),x=r.concat(y);c.children&&c.children.length>0&&(Yt(c.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${g}".`),Kb(c.children,t,x,g,d)),!(c.path==null&&!c.index)&&t.push({path:g,score:CS(g,c.index),routesMeta:x})};return e.forEach((c,f)=>{var d;if(c.path===""||!((d=c.path)!=null&&d.includes("?")))u(c,f);else for(let m of Qb(c.path))u(c,f,!0,m)}),t}function Qb(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=Qb(s.join("/")),f=[];return f.push(...c.map(d=>d===""?u:[u,d].join("/"))),l&&f.push(...c),f.map(d=>e.startsWith("/")&&d===""?"/":d)}function xS(e){e.sort((t,r)=>t.score!==r.score?r.score-t.score:AS(t.routesMeta.map(s=>s.childrenIndex),r.routesMeta.map(s=>s.childrenIndex)))}var vS=/^:[\w-]+$/,wS=3,SS=2,_S=1,kS=10,ES=-2,c0=e=>e==="*";function CS(e,t){let r=e.split("/"),s=r.length;return r.some(c0)&&(s+=ES),t&&(s+=SS),r.filter(l=>!c0(l)).reduce((l,u)=>l+(vS.test(u)?wS:u===""?_S:kS),s)}function AS(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 jS(e,t,r=!1){let{routesMeta:s}=e,l={},u="/",c=[];for(let f=0;f<s.length;++f){let d=s[f],m=f===s.length-1,y=u==="/"?t:t.slice(u.length)||"/",g=ju({path:d.relativePath,caseSensitive:d.caseSensitive,end:m},y),x=d.route;if(!g&&m&&r&&!s[s.length-1].route.index&&(g=ju({path:d.relativePath,caseSensitive:d.caseSensitive,end:!1},y)),!g)return null;Object.assign(l,g.params),c.push({params:l,pathname:$r([u,g.pathname]),pathnameBase:DS($r([u,g.pathnameBase])),route:x}),g.pathnameBase!=="/"&&(u=$r([u,g.pathnameBase]))}return c}function ju(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[r,s]=NS(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((m,{paramName:y,isOptional:g},x)=>{if(y==="*"){let S=f[x]||"";c=u.slice(0,u.length-S.length).replace(/(.)\/+$/,"$1")}const v=f[x];return g&&!v?m[y]=void 0:m[y]=(v||"").replace(/%2F/g,"/"),m},{}),pathname:u,pathnameBase:c,pattern:e}}function NS(e,t=!1,r=!0){Lr(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,d,m,y)=>{if(s.push({paramName:f,isOptional:d!=null}),d){let g=y.charAt(m+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 TS(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return Lr(!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 pi(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 OS=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function RS(e,t="/"){let{pathname:r,search:s="",hash:l=""}=typeof e=="string"?Sa(e):e,u;return r?(r=r.replace(/\/\/+/g,"/"),r.startsWith("/")?u=f0(r.substring(1),"/"):u=f0(r,t)):u=t,{pathname:u,search:LS(s),hash:zS(l)}}function f0(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 bh(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 MS(e){return e.filter((t,r)=>r===0||t.route.path&&t.route.path.length>0)}function Td(e){let t=MS(e);return t.map((r,s)=>s===t.length-1?r.pathname:r.pathnameBase)}function $u(e,t,r,s=!1){let l;typeof e=="string"?l=Sa(e):(l={...e},Yt(!l.pathname||!l.pathname.includes("?"),bh("?","pathname","search",l)),Yt(!l.pathname||!l.pathname.includes("#"),bh("#","pathname","hash",l)),Yt(!l.search||!l.search.includes("#"),bh("#","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 d=RS(l,f),m=c&&c!=="/"&&c.endsWith("/"),y=(u||c===".")&&r.endsWith("/");return!d.pathname.endsWith("/")&&(m||y)&&(d.pathname+="/"),d}var $r=e=>e.join("/").replace(/\/\/+/g,"/"),DS=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),LS=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,zS=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,US=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 PS(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function BS(e){return e.map(t=>t.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var Zb=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Wb(e,t){let r=e;if(typeof r!="string"||!OS.test(r))return{absoluteURL:void 0,isExternal:!1,to:r};let s=r,l=!1;if(Zb)try{let u=new URL(window.location.href),c=r.startsWith("//")?new URL(u.protocol+r):new URL(r),f=pi(c.pathname,t);c.origin===u.origin&&f!=null?r=f+c.search+c.hash:l=!0}catch{Lr(!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 ex=["POST","PUT","PATCH","DELETE"];new Set(ex);var HS=["GET",...ex];new Set(HS);var _a=A.createContext(null);_a.displayName="DataRouter";var Vu=A.createContext(null);Vu.displayName="DataRouterState";var qS=A.createContext(!1),tx=A.createContext({isTransitioning:!1});tx.displayName="ViewTransition";var IS=A.createContext(new Map);IS.displayName="Fetchers";var FS=A.createContext(null);FS.displayName="Await";var fr=A.createContext(null);fr.displayName="Navigation";var $l=A.createContext(null);$l.displayName="Location";var zr=A.createContext({outlet:null,matches:[],isDataRoute:!1});zr.displayName="Route";var Od=A.createContext(null);Od.displayName="RouteError";var nx="REACT_ROUTER_ERROR",$S="REDIRECT",VS="ROUTE_ERROR_RESPONSE";function YS(e){if(e.startsWith(`${nx}:${$S}:{`))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 GS(e){if(e.startsWith(`${nx}:${VS}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new US(t.status,t.statusText,t.data)}catch{}}function JS(e,{relative:t}={}){Yt(ka(),"useHref() may be used only in the context of a <Router> component.");let{basename:r,navigator:s}=A.useContext(fr),{hash:l,pathname:u,search:c}=Vl(e,{relative:t}),f=u;return r!=="/"&&(f=u==="/"?r:$r([r,u])),s.createHref({pathname:f,search:c,hash:l})}function ka(){return A.useContext($l)!=null}function Er(){return Yt(ka(),"useLocation() may be used only in the context of a <Router> component."),A.useContext($l).location}var rx="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function ix(e){A.useContext(fr).static||A.useLayoutEffect(e)}function Vr(){let{isDataRoute:e}=A.useContext(zr);return e?l_():XS()}function XS(){Yt(ka(),"useNavigate() may be used only in the context of a <Router> component.");let e=A.useContext(_a),{basename:t,navigator:r}=A.useContext(fr),{matches:s}=A.useContext(zr),{pathname:l}=Er(),u=JSON.stringify(Td(s)),c=A.useRef(!1);return ix(()=>{c.current=!0}),A.useCallback((d,m={})=>{if(Lr(c.current,rx),!c.current)return;if(typeof d=="number"){r.go(d);return}let y=$u(d,JSON.parse(u),l,m.relative==="path");e==null&&t!=="/"&&(y.pathname=y.pathname==="/"?t:$r([t,y.pathname])),(m.replace?r.replace:r.push)(y,m.state,m)},[t,r,u,l,e])}A.createContext(null);function Yu(){let{matches:e}=A.useContext(zr),t=e[e.length-1];return t?t.params:{}}function Vl(e,{relative:t}={}){let{matches:r}=A.useContext(zr),{pathname:s}=Er(),l=JSON.stringify(Td(r));return A.useMemo(()=>$u(e,JSON.parse(l),s,t==="path"),[e,l,s,t])}function KS(e,t){return sx(e,t)}function sx(e,t,r){var D;Yt(ka(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:s}=A.useContext(fr),{matches:l}=A.useContext(zr),u=l[l.length-1],c=u?u.params:{},f=u?u.pathname:"/",d=u?u.pathnameBase:"/",m=u&&u.route;{let T=m&&m.path||"";lx(f,!m||T.endsWith("*")||T.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${f}" (under <Route path="${T}">) 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.
58
+ */var o0="popstate";function u0(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function gS(e={}){function t(s,l){var m;let o=(m=l.state)==null?void 0:m.masked,{pathname:c,search:f,hash:d}=o||s.location;return Wh("",{pathname:c,search:f,hash:d},l.state&&l.state.usr||null,l.state&&l.state.key||"default",o?{pathname:s.location.pathname,search:s.location.search,hash:s.location.hash}:void 0)}function r(s,l){return typeof l=="string"?l:zl(l)}return bS(t,r,null,e)}function Yt(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function Lr(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function yS(){return Math.random().toString(36).substring(2,10)}function c0(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 Wh(e,t,r=null,s,l){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?Sa(t):t,state:r,key:t&&t.key||s||yS(),unstable_mask:l}}function zl({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 Sa(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 bS(e,t,r,s={}){let{window:l=document.defaultView,v5Compat:o=!1}=s,c=l.history,f="POP",d=null,m=y();m==null&&(m=0,c.replaceState({...c.state,idx:m},""));function y(){return(c.state||{idx:null}).idx}function g(){f="POP";let M=y(),T=M==null?null:M-m;m=M,d&&d({action:f,location:A.location,delta:T})}function x(M,T){f="PUSH";let P=u0(M)?M:Wh(A.location,M,T);m=y()+1;let I=c0(P,m),W=A.createHref(P.unstable_mask||P);try{c.pushState(I,"",W)}catch(B){if(B instanceof DOMException&&B.name==="DataCloneError")throw B;l.location.assign(W)}o&&d&&d({action:f,location:A.location,delta:1})}function v(M,T){f="REPLACE";let P=u0(M)?M:Wh(A.location,M,T);m=y();let I=c0(P,m),W=A.createHref(P.unstable_mask||P);c.replaceState(I,"",W),o&&d&&d({action:f,location:A.location,delta:0})}function S(M){return xS(M)}let A={get action(){return f},get location(){return e(l,c)},listen(M){if(d)throw new Error("A history only accepts one active listener");return l.addEventListener(o0,g),d=M,()=>{l.removeEventListener(o0,g),d=null}},createHref(M){return t(l,M)},createURL:S,encodeLocation(M){let T=S(M);return{pathname:T.pathname,search:T.search,hash:T.hash}},push:x,replace:v,go(M){return c.go(M)}};return A}function xS(e,t=!1){let r="http://localhost";typeof window<"u"&&(r=window.location.origin!=="null"?window.location.origin:window.location.href),Yt(r,"No window.location.(origin|href) available to create URL");let s=typeof e=="string"?e:zl(e);return s=s.replace(/ $/,"%20"),!t&&s.startsWith("//")&&(s=r+s),new URL(s,r)}function Gb(e,t,r="/"){return vS(e,t,r,!1)}function vS(e,t,r,s){let l=typeof t=="string"?Sa(t):t,o=pi(l.pathname||"/",r);if(o==null)return null;let c=Jb(e);wS(c);let f=null;for(let d=0;f==null&&d<c.length;++d){let m=RS(o);f=TS(c[d],m,s)}return f}function Jb(e,t=[],r=[],s="",l=!1){let o=(c,f,d=l,m)=>{let y={relativePath:m===void 0?c.path||"":m,caseSensitive:c.caseSensitive===!0,childrenIndex:f,route:c};if(y.relativePath.startsWith("/")){if(!y.relativePath.startsWith(s)&&d)return;Yt(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=$r([s,y.relativePath]),x=r.concat(y);c.children&&c.children.length>0&&(Yt(c.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${g}".`),Jb(c.children,t,x,g,d)),!(c.path==null&&!c.index)&&t.push({path:g,score:jS(g,c.index),routesMeta:x})};return e.forEach((c,f)=>{var d;if(c.path===""||!((d=c.path)!=null&&d.includes("?")))o(c,f);else for(let m of Xb(c.path))o(c,f,!0,m)}),t}function Xb(e){let t=e.split("/");if(t.length===0)return[];let[r,...s]=t,l=r.endsWith("?"),o=r.replace(/\?$/,"");if(s.length===0)return l?[o,""]:[o];let c=Xb(s.join("/")),f=[];return f.push(...c.map(d=>d===""?o:[o,d].join("/"))),l&&f.push(...c),f.map(d=>e.startsWith("/")&&d===""?"/":d)}function wS(e){e.sort((t,r)=>t.score!==r.score?r.score-t.score:NS(t.routesMeta.map(s=>s.childrenIndex),r.routesMeta.map(s=>s.childrenIndex)))}var SS=/^:[\w-]+$/,_S=3,kS=2,ES=1,CS=10,AS=-2,f0=e=>e==="*";function jS(e,t){let r=e.split("/"),s=r.length;return r.some(f0)&&(s+=AS),t&&(s+=kS),r.filter(l=>!f0(l)).reduce((l,o)=>l+(SS.test(o)?_S:o===""?ES:CS),s)}function NS(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 TS(e,t,r=!1){let{routesMeta:s}=e,l={},o="/",c=[];for(let f=0;f<s.length;++f){let d=s[f],m=f===s.length-1,y=o==="/"?t:t.slice(o.length)||"/",g=ju({path:d.relativePath,caseSensitive:d.caseSensitive,end:m},y),x=d.route;if(!g&&m&&r&&!s[s.length-1].route.index&&(g=ju({path:d.relativePath,caseSensitive:d.caseSensitive,end:!1},y)),!g)return null;Object.assign(l,g.params),c.push({params:l,pathname:$r([o,g.pathname]),pathnameBase:zS($r([o,g.pathnameBase])),route:x}),g.pathnameBase!=="/"&&(o=$r([o,g.pathnameBase]))}return c}function ju(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[r,s]=OS(e.path,e.caseSensitive,e.end),l=t.match(r);if(!l)return null;let o=l[0],c=o.replace(/(.)\/+$/,"$1"),f=l.slice(1);return{params:s.reduce((m,{paramName:y,isOptional:g},x)=>{if(y==="*"){let S=f[x]||"";c=o.slice(0,o.length-S.length).replace(/(.)\/+$/,"$1")}const v=f[x];return g&&!v?m[y]=void 0:m[y]=(v||"").replace(/%2F/g,"/"),m},{}),pathname:o,pathnameBase:c,pattern:e}}function OS(e,t=!1,r=!0){Lr(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,d,m,y)=>{if(s.push({paramName:f,isOptional:d!=null}),d){let g=y.charAt(m+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 RS(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return Lr(!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 pi(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 MS=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function DS(e,t="/"){let{pathname:r,search:s="",hash:l=""}=typeof e=="string"?Sa(e):e,o;return r?(r=r.replace(/\/\/+/g,"/"),r.startsWith("/")?o=h0(r.substring(1),"/"):o=h0(r,t)):o=t,{pathname:o,search:US(s),hash:PS(l)}}function h0(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 bh(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 LS(e){return e.filter((t,r)=>r===0||t.route.path&&t.route.path.length>0)}function Td(e){let t=LS(e);return t.map((r,s)=>s===t.length-1?r.pathname:r.pathnameBase)}function $u(e,t,r,s=!1){let l;typeof e=="string"?l=Sa(e):(l={...e},Yt(!l.pathname||!l.pathname.includes("?"),bh("?","pathname","search",l)),Yt(!l.pathname||!l.pathname.includes("#"),bh("#","pathname","hash",l)),Yt(!l.search||!l.search.includes("#"),bh("#","search","hash",l)));let o=e===""||l.pathname==="",c=o?"/":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 d=DS(l,f),m=c&&c!=="/"&&c.endsWith("/"),y=(o||c===".")&&r.endsWith("/");return!d.pathname.endsWith("/")&&(m||y)&&(d.pathname+="/"),d}var $r=e=>e.join("/").replace(/\/\/+/g,"/"),zS=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),US=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,PS=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,BS=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 HS(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function qS(e){return e.map(t=>t.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var Kb=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Qb(e,t){let r=e;if(typeof r!="string"||!MS.test(r))return{absoluteURL:void 0,isExternal:!1,to:r};let s=r,l=!1;if(Kb)try{let o=new URL(window.location.href),c=r.startsWith("//")?new URL(o.protocol+r):new URL(r),f=pi(c.pathname,t);c.origin===o.origin&&f!=null?r=f+c.search+c.hash:l=!0}catch{Lr(!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 Zb=["POST","PUT","PATCH","DELETE"];new Set(Zb);var IS=["GET",...Zb];new Set(IS);var _a=E.createContext(null);_a.displayName="DataRouter";var Vu=E.createContext(null);Vu.displayName="DataRouterState";var FS=E.createContext(!1),Wb=E.createContext({isTransitioning:!1});Wb.displayName="ViewTransition";var $S=E.createContext(new Map);$S.displayName="Fetchers";var VS=E.createContext(null);VS.displayName="Await";var fr=E.createContext(null);fr.displayName="Navigation";var $l=E.createContext(null);$l.displayName="Location";var zr=E.createContext({outlet:null,matches:[],isDataRoute:!1});zr.displayName="Route";var Od=E.createContext(null);Od.displayName="RouteError";var ex="REACT_ROUTER_ERROR",YS="REDIRECT",GS="ROUTE_ERROR_RESPONSE";function JS(e){if(e.startsWith(`${ex}:${YS}:{`))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 XS(e){if(e.startsWith(`${ex}:${GS}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new BS(t.status,t.statusText,t.data)}catch{}}function KS(e,{relative:t}={}){Yt(ka(),"useHref() may be used only in the context of a <Router> component.");let{basename:r,navigator:s}=E.useContext(fr),{hash:l,pathname:o,search:c}=Vl(e,{relative:t}),f=o;return r!=="/"&&(f=o==="/"?r:$r([r,o])),s.createHref({pathname:f,search:c,hash:l})}function ka(){return E.useContext($l)!=null}function Er(){return Yt(ka(),"useLocation() may be used only in the context of a <Router> component."),E.useContext($l).location}var tx="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function nx(e){E.useContext(fr).static||E.useLayoutEffect(e)}function Vr(){let{isDataRoute:e}=E.useContext(zr);return e?u_():QS()}function QS(){Yt(ka(),"useNavigate() may be used only in the context of a <Router> component.");let e=E.useContext(_a),{basename:t,navigator:r}=E.useContext(fr),{matches:s}=E.useContext(zr),{pathname:l}=Er(),o=JSON.stringify(Td(s)),c=E.useRef(!1);return nx(()=>{c.current=!0}),E.useCallback((d,m={})=>{if(Lr(c.current,tx),!c.current)return;if(typeof d=="number"){r.go(d);return}let y=$u(d,JSON.parse(o),l,m.relative==="path");e==null&&t!=="/"&&(y.pathname=y.pathname==="/"?t:$r([t,y.pathname])),(m.replace?r.replace:r.push)(y,m.state,m)},[t,r,o,l,e])}E.createContext(null);function Yu(){let{matches:e}=E.useContext(zr),t=e[e.length-1];return t?t.params:{}}function Vl(e,{relative:t}={}){let{matches:r}=E.useContext(zr),{pathname:s}=Er(),l=JSON.stringify(Td(r));return E.useMemo(()=>$u(e,JSON.parse(l),s,t==="path"),[e,l,s,t])}function ZS(e,t){return rx(e,t)}function rx(e,t,r){var M;Yt(ka(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:s}=E.useContext(fr),{matches:l}=E.useContext(zr),o=l[l.length-1],c=o?o.params:{},f=o?o.pathname:"/",d=o?o.pathnameBase:"/",m=o&&o.route;{let T=m&&m.path||"";sx(f,!m||T.endsWith("*")||T.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${f}" (under <Route path="${T}">) 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
59
 
60
- Please change the parent <Route path="${T}"> to <Route path="${T==="/"?"*":`${T}/*`}">.`)}let y=Er(),g;if(t){let T=typeof t=="string"?Sa(t):t;Yt(d==="/"||((D=T.pathname)==null?void 0:D.startsWith(d)),`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 "${d}" but pathname "${T.pathname}" was given in the \`location\` prop.`),g=T}else g=y;let x=g.pathname||"/",v=x;if(d!=="/"){let T=d.replace(/^\//,"").split("/");v="/"+x.replace(/^\//,"").split("/").slice(T.length).join("/")}let S=Xb(e,{pathname:v});Lr(m||S!=null,`No routes matched location "${g.pathname}${g.search}${g.hash}" `),Lr(S==null||S[S.length-1].route.element!==void 0||S[S.length-1].route.Component!==void 0||S[S.length-1].route.lazy!==void 0,`Matched leaf route at location "${g.pathname}${g.search}${g.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let j=t_(S&&S.map(T=>Object.assign({},T,{params:Object.assign({},c,T.params),pathname:$r([d,s.encodeLocation?s.encodeLocation(T.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:T.pathname]),pathnameBase:T.pathnameBase==="/"?d:$r([d,s.encodeLocation?s.encodeLocation(T.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:T.pathnameBase])})),l,r);return t&&j?A.createElement($l.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,...g},navigationType:"POP"}},j):j}function QS(){let e=a_(),t=PS(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=A.createElement(A.Fragment,null,A.createElement("p",null,"💿 Hey developer 👋"),A.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",A.createElement("code",{style:u},"ErrorBoundary")," or"," ",A.createElement("code",{style:u},"errorElement")," prop on your route.")),A.createElement(A.Fragment,null,A.createElement("h2",null,"Unexpected Application Error!"),A.createElement("h3",{style:{fontStyle:"italic"}},t),r?A.createElement("pre",{style:l},r):null,c)}var ZS=A.createElement(QS,null),ax=class extends A.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=GS(e.digest);r&&(e=r)}let t=e!==void 0?A.createElement(zr.Provider,{value:this.props.routeContext},A.createElement(Od.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?A.createElement(WS,{error:e},t):t}};ax.contextType=qS;var xh=new WeakMap;function WS({children:e,error:t}){let{basename:r}=A.useContext(fr);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let s=YS(t.digest);if(s){let l=xh.get(t);if(l)throw l;let u=Wb(s.location,r);if(Zb&&!xh.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 xh.set(t,c),c}return A.createElement("meta",{httpEquiv:"refresh",content:`0;url=${u.absoluteURL||u.to}`})}}return e}function e_({routeContext:e,match:t,children:r}){let s=A.useContext(_a);return s&&s.static&&s.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(s.staticContext._deepestRenderedBoundaryId=t.route.id),A.createElement(zr.Provider,{value:e},r)}function t_(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);Yt(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:v}=s,S=g.route.loader&&!x.hasOwnProperty(g.route.id)&&(!v||v[g.route.id]===void 0);if(g.route.lazy||S){r.isStatic&&(c=!0),f>=0?l=l.slice(0,f+1):l=[l[0]];break}}}}let d=r==null?void 0:r.onError,m=s&&d?(y,g)=>{var x,v;d(y,{location:s.location,params:((v=(x=s.matches)==null?void 0:x[0])==null?void 0:v.params)??{},unstable_pattern:BS(s.matches),errorInfo:g})}:void 0;return l.reduceRight((y,g,x)=>{let v,S=!1,j=null,D=null;s&&(v=u&&g.route.id?u[g.route.id]:void 0,j=g.route.errorElement||ZS,c&&(f<0&&x===0?(lx("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),S=!0,D=null):f===x&&(S=!0,D=g.route.hydrateFallbackElement||null)));let T=t.concat(l.slice(0,x+1)),P=()=>{let I;return v?I=j:S?I=D:g.route.Component?I=A.createElement(g.route.Component,null):g.route.element?I=g.route.element:I=y,A.createElement(e_,{match:g,routeContext:{outlet:y,matches:T,isDataRoute:s!=null},children:I})};return s&&(g.route.ErrorBoundary||g.route.errorElement||x===0)?A.createElement(ax,{location:s.location,revalidation:s.revalidation,component:j,error:v,children:P(),routeContext:{outlet:null,matches:T,isDataRoute:!0},onError:m}):P()},null)}function Rd(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function n_(e){let t=A.useContext(_a);return Yt(t,Rd(e)),t}function r_(e){let t=A.useContext(Vu);return Yt(t,Rd(e)),t}function i_(e){let t=A.useContext(zr);return Yt(t,Rd(e)),t}function Md(e){let t=i_(e),r=t.matches[t.matches.length-1];return Yt(r.route.id,`${e} can only be used on routes that contain a unique "id"`),r.route.id}function s_(){return Md("useRouteId")}function a_(){var s;let e=A.useContext(Od),t=r_("useRouteError"),r=Md("useRouteError");return e!==void 0?e:(s=t.errors)==null?void 0:s[r]}function l_(){let{router:e}=n_("useNavigate"),t=Md("useNavigate"),r=A.useRef(!1);return ix(()=>{r.current=!0}),A.useCallback(async(l,u={})=>{Lr(r.current,rx),r.current&&(typeof l=="number"?await e.navigate(l):await e.navigate(l,{fromRouteId:t,...u}))},[e,t])}var h0={};function lx(e,t,r){!t&&!h0[e]&&(h0[e]=!0,Lr(!1,r))}A.memo(o_);function o_({routes:e,future:t,state:r,isStatic:s,onError:l}){return sx(e,void 0,{state:r,isStatic:s,onError:l})}function Ul({to:e,replace:t,state:r,relative:s}){Yt(ka(),"<Navigate> may be used only in the context of a <Router> component.");let{static:l}=A.useContext(fr);Lr(!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}=A.useContext(zr),{pathname:c}=Er(),f=Vr(),d=$u(e,Td(u),c,s==="path"),m=JSON.stringify(d);return A.useEffect(()=>{f(JSON.parse(m),{replace:t,state:r,relative:s})},[f,m,s,t,r]),null}function Or(e){Yt(!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 u_({basename:e="/",children:t=null,location:r,navigationType:s="POP",navigator:l,static:u=!1,unstable_useTransitions:c}){Yt(!ka(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let f=e.replace(/^\/*/,"/"),d=A.useMemo(()=>({basename:f,navigator:l,static:u,unstable_useTransitions:c,future:{}}),[f,l,u,c]);typeof r=="string"&&(r=Sa(r));let{pathname:m="/",search:y="",hash:g="",state:x=null,key:v="default",unstable_mask:S}=r,j=A.useMemo(()=>{let D=pi(m,f);return D==null?null:{location:{pathname:D,search:y,hash:g,state:x,key:v,unstable_mask:S},navigationType:s}},[f,m,y,g,x,v,s,S]);return Lr(j!=null,`<Router basename="${f}"> is not able to match the URL "${m}${y}${g}" because it does not start with the basename, so the <Router> won't render anything.`),j==null?null:A.createElement(fr.Provider,{value:d},A.createElement($l.Provider,{children:t,value:j}))}function ox({children:e,location:t}){return KS(ed(e),t)}function ed(e,t=[]){let r=[];return A.Children.forEach(e,(s,l)=>{if(!A.isValidElement(s))return;let u=[...t,l];if(s.type===A.Fragment){r.push.apply(r,ed(s.props.children,u));return}Yt(s.type===Or,`[${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>`),Yt(!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=ed(s.props.children,u)),r.push(c)}),r}var Su="get",_u="application/x-www-form-urlencoded";function Gu(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function c_(e){return Gu(e)&&e.tagName.toLowerCase()==="button"}function f_(e){return Gu(e)&&e.tagName.toLowerCase()==="form"}function h_(e){return Gu(e)&&e.tagName.toLowerCase()==="input"}function d_(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function m_(e,t){return e.button===0&&(!t||t==="_self")&&!d_(e)}var cu=null;function p_(){if(cu===null)try{new FormData(document.createElement("form"),0),cu=!1}catch{cu=!0}return cu}var g_=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function vh(e){return e!=null&&!g_.has(e)?(Lr(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${_u}"`),null):e}function y_(e,t){let r,s,l,u,c;if(f_(e)){let f=e.getAttribute("action");s=f?pi(f,t):null,r=e.getAttribute("method")||Su,l=vh(e.getAttribute("enctype"))||_u,u=new FormData(e)}else if(c_(e)||h_(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 d=e.getAttribute("formaction")||f.getAttribute("action");if(s=d?pi(d,t):null,r=e.getAttribute("formmethod")||f.getAttribute("method")||Su,l=vh(e.getAttribute("formenctype"))||vh(f.getAttribute("enctype"))||_u,u=new FormData(f,e),!p_()){let{name:m,type:y,value:g}=e;if(y==="image"){let x=m?`${m}.`:"";u.append(`${x}x`,"0"),u.append(`${x}y`,"0")}else m&&u.append(m,g)}}else{if(Gu(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');r=Su,s=null,l=_u,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 Dd(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function b_(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&&pi(l.pathname,t)==="/"?l.pathname=`${t.replace(/\/$/,"")}/_root.${s}`:l.pathname=`${l.pathname.replace(/\/$/,"")}.${s}`,l}async function x_(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 v_(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 w_(e,t,r){let s=await Promise.all(e.map(async l=>{let u=t.routes[l.route.id];if(u){let c=await x_(u,r);return c.links?c.links():[]}return[]}));return E_(s.flat(1).filter(v_).filter(l=>l.rel==="stylesheet"||l.rel==="preload").map(l=>l.rel==="stylesheet"?{...l,rel:"prefetch",as:"style"}:{...l,rel:"prefetch"}))}function d0(e,t,r,s,l,u){let c=(d,m)=>r[m]?d.route.id!==r[m].route.id:!0,f=(d,m)=>{var y;return r[m].pathname!==d.pathname||((y=r[m].route.path)==null?void 0:y.endsWith("*"))&&r[m].params["*"]!==d.params["*"]};return u==="assets"?t.filter((d,m)=>c(d,m)||f(d,m)):u==="data"?t.filter((d,m)=>{var g;let y=s.routes[d.route.id];if(!y||!y.hasLoader)return!1;if(c(d,m)||f(d,m))return!0;if(d.route.shouldRevalidate){let x=d.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:d.params,defaultShouldRevalidate:!0});if(typeof x=="boolean")return x}return!0}):[]}function S_(e,t,{includeHydrateFallback:r}={}){return __(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 __(e){return[...new Set(e)]}function k_(e){let t={},r=Object.keys(e).sort();for(let s of r)t[s]=e[s];return t}function E_(e,t){let r=new Set;return new Set(t),e.reduce((s,l)=>{let u=JSON.stringify(k_(l));return r.has(u)||(r.add(u),s.push({key:u,link:l})),s},[])}function ux(){let e=A.useContext(_a);return Dd(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function C_(){let e=A.useContext(Vu);return Dd(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var Ld=A.createContext(void 0);Ld.displayName="FrameworkContext";function cx(){let e=A.useContext(Ld);return Dd(e,"You must render this element inside a <HydratedRouter> element"),e}function A_(e,t){let r=A.useContext(Ld),[s,l]=A.useState(!1),[u,c]=A.useState(!1),{onFocus:f,onBlur:d,onMouseEnter:m,onMouseLeave:y,onTouchStart:g}=t,x=A.useRef(null);A.useEffect(()=>{if(e==="render"&&c(!0),e==="viewport"){let j=T=>{T.forEach(P=>{c(P.isIntersecting)})},D=new IntersectionObserver(j,{threshold:.5});return x.current&&D.observe(x.current),()=>{D.disconnect()}}},[e]),A.useEffect(()=>{if(s){let j=setTimeout(()=>{c(!0)},100);return()=>{clearTimeout(j)}}},[s]);let v=()=>{l(!0)},S=()=>{l(!1),c(!1)};return r?e!=="intent"?[u,x,{}]:[u,x,{onFocus:bl(f,v),onBlur:bl(d,S),onMouseEnter:bl(m,v),onMouseLeave:bl(y,S),onTouchStart:bl(g,v)}]:[!1,x,{}]}function bl(e,t){return r=>{e&&e(r),r.defaultPrevented||t(r)}}function j_({page:e,...t}){let{router:r}=ux(),s=A.useMemo(()=>Xb(r.routes,e,r.basename),[r.routes,e,r.basename]);return s?A.createElement(T_,{page:e,matches:s,...t}):null}function N_(e){let{manifest:t,routeModules:r}=cx(),[s,l]=A.useState([]);return A.useEffect(()=>{let u=!1;return w_(e,t,r).then(c=>{u||l(c)}),()=>{u=!0}},[e,t,r]),s}function T_({page:e,matches:t,...r}){let s=Er(),{future:l,manifest:u,routeModules:c}=cx(),{basename:f}=ux(),{loaderData:d,matches:m}=C_(),y=A.useMemo(()=>d0(e,t,m,u,s,"data"),[e,t,m,u,s]),g=A.useMemo(()=>d0(e,t,m,u,s,"assets"),[e,t,m,u,s]),x=A.useMemo(()=>{if(e===s.pathname+s.search+s.hash)return[];let j=new Set,D=!1;if(t.forEach(P=>{var W;let I=u.routes[P.route.id];!I||!I.hasLoader||(!y.some(B=>B.route.id===P.route.id)&&P.route.id in d&&((W=c[P.route.id])!=null&&W.shouldRevalidate)||I.hasClientLoader?D=!0:j.add(P.route.id))}),j.size===0)return[];let T=b_(e,f,l.unstable_trailingSlashAwareDataRequests,"data");return D&&j.size>0&&T.searchParams.set("_routes",t.filter(P=>j.has(P.route.id)).map(P=>P.route.id).join(",")),[T.pathname+T.search]},[f,l.unstable_trailingSlashAwareDataRequests,d,s,u,y,t,e,c]),v=A.useMemo(()=>S_(g,u),[g,u]),S=N_(g);return A.createElement(A.Fragment,null,x.map(j=>A.createElement("link",{key:j,rel:"prefetch",as:"fetch",href:j,...r})),v.map(j=>A.createElement("link",{key:j,rel:"modulepreload",href:j,...r})),S.map(({key:j,link:D})=>A.createElement("link",{key:j,nonce:r.nonce,...D,crossOrigin:D.crossOrigin??r.crossOrigin})))}function O_(...e){return t=>{e.forEach(r=>{typeof r=="function"?r(t):r!=null&&(r.current=t)})}}var R_=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{R_&&(window.__reactRouterVersion="7.13.1")}catch{}function M_({basename:e,children:t,unstable_useTransitions:r,window:s}){let l=A.useRef();l.current==null&&(l.current=mS({window:s,v5Compat:!0}));let u=l.current,[c,f]=A.useState({action:u.action,location:u.location}),d=A.useCallback(m=>{r===!1?f(m):A.startTransition(()=>f(m))},[r]);return A.useLayoutEffect(()=>u.listen(d),[u,d]),A.createElement(u_,{basename:e,children:t,location:c.location,navigationType:c.action,navigator:u,unstable_useTransitions:r})}var fx=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,hx=A.forwardRef(function({onClick:t,discover:r="render",prefetch:s="none",relative:l,reloadDocument:u,replace:c,unstable_mask:f,state:d,target:m,to:y,preventScrollReset:g,viewTransition:x,unstable_defaultShouldRevalidate:v,...S},j){let{basename:D,navigator:T,unstable_useTransitions:P}=A.useContext(fr),I=typeof y=="string"&&fx.test(y),W=Wb(y,D);y=W.to;let B=JS(y,{relative:l}),R=Er(),Z=null;if(f){let re=$u(f,[],R.unstable_mask?R.unstable_mask.pathname:"/",!0);D!=="/"&&(re.pathname=re.pathname==="/"?D:$r([D,re.pathname])),Z=T.createHref(re)}let[F,V,L]=A_(s,S),X=U_(y,{replace:c,unstable_mask:f,state:d,target:m,preventScrollReset:g,relative:l,viewTransition:x,unstable_defaultShouldRevalidate:v,unstable_useTransitions:P});function G(re){t&&t(re),re.defaultPrevented||X(re)}let ue=!(W.isExternal||u),le=A.createElement("a",{...S,...L,href:(ue?Z:void 0)||W.absoluteURL||B,onClick:ue?G:t,ref:O_(j,V),target:m,"data-discover":!I&&r==="render"?"true":void 0});return F&&!I?A.createElement(A.Fragment,null,le,A.createElement(j_,{page:B})):le});hx.displayName="Link";var D_=A.forwardRef(function({"aria-current":t="page",caseSensitive:r=!1,className:s="",end:l=!1,style:u,to:c,viewTransition:f,children:d,...m},y){let g=Vl(c,{relative:m.relative}),x=Er(),v=A.useContext(Vu),{navigator:S,basename:j}=A.useContext(fr),D=v!=null&&I_(g)&&f===!0,T=S.encodeLocation?S.encodeLocation(g).pathname:g.pathname,P=x.pathname,I=v&&v.navigation&&v.navigation.location?v.navigation.location.pathname:null;r||(P=P.toLowerCase(),I=I?I.toLowerCase():null,T=T.toLowerCase()),I&&j&&(I=pi(I,j)||I);const W=T!=="/"&&T.endsWith("/")?T.length-1:T.length;let B=P===T||!l&&P.startsWith(T)&&P.charAt(W)==="/",R=I!=null&&(I===T||!l&&I.startsWith(T)&&I.charAt(T.length)==="/"),Z={isActive:B,isPending:R,isTransitioning:D},F=B?t:void 0,V;typeof s=="function"?V=s(Z):V=[s,B?"active":null,R?"pending":null,D?"transitioning":null].filter(Boolean).join(" ");let L=typeof u=="function"?u(Z):u;return A.createElement(hx,{...m,"aria-current":F,className:V,ref:y,style:L,to:c,viewTransition:f},typeof d=="function"?d(Z):d)});D_.displayName="NavLink";var L_=A.forwardRef(({discover:e="render",fetcherKey:t,navigate:r,reloadDocument:s,replace:l,state:u,method:c=Su,action:f,onSubmit:d,relative:m,preventScrollReset:y,viewTransition:g,unstable_defaultShouldRevalidate:x,...v},S)=>{let{unstable_useTransitions:j}=A.useContext(fr),D=H_(),T=q_(f,{relative:m}),P=c.toLowerCase()==="get"?"get":"post",I=typeof f=="string"&&fx.test(f),W=B=>{if(d&&d(B),B.defaultPrevented)return;B.preventDefault();let R=B.nativeEvent.submitter,Z=(R==null?void 0:R.getAttribute("formmethod"))||c,F=()=>D(R||B.currentTarget,{fetcherKey:t,method:Z,navigate:r,replace:l,state:u,relative:m,preventScrollReset:y,viewTransition:g,unstable_defaultShouldRevalidate:x});j&&r!==!1?A.startTransition(()=>F()):F()};return A.createElement("form",{ref:S,method:P,action:T,onSubmit:s?d:W,...v,"data-discover":!I&&e==="render"?"true":void 0})});L_.displayName="Form";function z_(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function dx(e){let t=A.useContext(_a);return Yt(t,z_(e)),t}function U_(e,{target:t,replace:r,unstable_mask:s,state:l,preventScrollReset:u,relative:c,viewTransition:f,unstable_defaultShouldRevalidate:d,unstable_useTransitions:m}={}){let y=Vr(),g=Er(),x=Vl(e,{relative:c});return A.useCallback(v=>{if(m_(v,t)){v.preventDefault();let S=r!==void 0?r:zl(g)===zl(x),j=()=>y(e,{replace:S,unstable_mask:s,state:l,preventScrollReset:u,relative:c,viewTransition:f,unstable_defaultShouldRevalidate:d});m?A.startTransition(()=>j()):j()}},[g,y,x,r,s,l,t,e,u,c,f,d,m])}var P_=0,B_=()=>`__${String(++P_)}__`;function H_(){let{router:e}=dx("useSubmit"),{basename:t}=A.useContext(fr),r=s_(),s=e.fetch,l=e.navigate;return A.useCallback(async(u,c={})=>{let{action:f,method:d,encType:m,formData:y,body:g}=y_(u,t);if(c.navigate===!1){let x=c.fetcherKey||B_();await s(x,r,c.action||f,{unstable_defaultShouldRevalidate:c.unstable_defaultShouldRevalidate,preventScrollReset:c.preventScrollReset,formData:y,body:g,formMethod:c.method||d,formEncType:c.encType||m,flushSync:c.flushSync})}else await l(c.action||f,{unstable_defaultShouldRevalidate:c.unstable_defaultShouldRevalidate,preventScrollReset:c.preventScrollReset,formData:y,body:g,formMethod:c.method||d,formEncType:c.encType||m,replace:c.replace,state:c.state,fromRouteId:r,flushSync:c.flushSync,viewTransition:c.viewTransition})},[s,l,t,r])}function q_(e,{relative:t}={}){let{basename:r}=A.useContext(fr),s=A.useContext(zr);Yt(s,"useFormAction must be used inside a RouteContext");let[l]=s.matches.slice(-1),u={...Vl(e||".",{relative:t})},c=Er();if(e==null){u.search=c.search;let f=new URLSearchParams(u.search),d=f.getAll("index");if(d.some(y=>y==="")){f.delete("index"),d.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:$r([r,u.pathname])),zl(u)}function I_(e,{relative:t}={}){let r=A.useContext(tx);Yt(r!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:s}=dx("useViewTransitionState"),l=Vl(e,{relative:t});if(!r.isTransitioning)return!1;let u=pi(r.currentLocation.pathname,s)||r.currentLocation.pathname,c=pi(r.nextLocation.pathname,s)||r.nextLocation.pathname;return ju(l.pathname,c)!=null||ju(l.pathname,u)!=null}var di=Jb();const mx=A.createContext(null),px="palmier_paired_hosts",m0="palmier_last_host";function F_(){try{const e=localStorage.getItem(px);if(e)return JSON.parse(e)}catch{}return[]}function $_(e){localStorage.setItem(px,JSON.stringify(e))}const p0="local",V_=!!window.__PALMIER_SERVE__&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1");function Y_({children:e}){const[t,r]=A.useState(()=>{const x=F_();return V_&&!x.some(v=>v.hostId===p0)&&x.push({hostId:p0,clientToken:"",directUrl:window.location.origin}),x}),[s,l]=A.useState(()=>{try{return localStorage.getItem(m0)}catch{return null}});A.useEffect(()=>{$_(t)},[t]);const u=A.useCallback(x=>{l(v=>v===x?v:x);try{localStorage.setItem(m0,x)}catch{}},[]),c=A.useCallback(x=>{r(v=>[...v.filter(j=>j.hostId!==x.hostId),x])},[]),f=A.useCallback(x=>{r(v=>v.filter(S=>S.hostId!==x))},[]),d=A.useCallback((x,v)=>{r(S=>S.map(j=>j.hostId===x?{...j,name:v}:j))},[]),m=A.useCallback((x,v)=>{r(S=>S.map(j=>j.hostId!==x||j.lanUrl===v?j:{...j,lanUrl:v}))},[]),y=A.useCallback((x,v)=>{r(S=>S.map(j=>j.hostId!==x||j.lastAgent===v?j:{...j,lastAgent:v}))},[]),g=A.useCallback((x,v)=>{r(S=>S.map(j=>j.hostId!==x||j.timezone===v?j:{...j,timezone:v}))},[]);return b.jsx(mx.Provider,{value:{pairedHosts:t,lastHostId:s,addPairedHost:c,removePairedHost:f,renamePairedHost:d,setHostLanUrl:m,setHostLastAgent:y,setHostTimezone:g,setLastHostId:u},children:e})}function Xi(){const e=A.useContext(mx);if(!e)throw new Error("useHostStore must be used within HostStoreProvider");return e}const ur=new Uint8Array(0),Ki=new TextEncoder,ar=new TextDecoder;function G_(...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 jl(...e){const t=[];for(let r=0;r<e.length;r++)t.push(Ki.encode(e[r]));return t.length===0?ur:t.length===1?t[0]:G_(...t)}function g0(e){return!e||e.length===0?"":ar.decode(e)}const y0="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ",b0=36,J_=0xcfd41b9100000,x0=33,X_=333,v0=22;function K_(e){for(let t=0;t<e.length;t++)e[t]=Math.floor(Math.random()*255)}function Q_(e){var t;(t=globalThis==null?void 0:globalThis.crypto)!=null&&t.getRandomValues?globalThis.crypto.getRandomValues(e):K_(e)}class Z_{constructor(){C(this,"buf");C(this,"seq");C(this,"inc");C(this,"inited");this.buf=new Uint8Array(v0),this.inited=!1}init(){this.inited=!0,this.setPre(),this.initSeqAndInc(),this.fillSeq()}initSeqAndInc(){this.seq=Math.floor(Math.random()*J_),this.inc=Math.floor(Math.random()*(X_-x0)+x0)}setPre(){const t=new Uint8Array(12);Q_(t);for(let r=0;r<12;r++){const s=t[r]%36;this.buf[r]=y0.charCodeAt(s)}}fillSeq(){let t=this.seq;for(let r=v0-1;r>=12;r--)this.buf[r]=y0.charCodeAt(t%b0),t=Math.floor(t/b0)}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 Gi=new Z_;var fi;(function(e){e.Disconnect="disconnect",e.Reconnect="reconnect",e.Update="update",e.LDM="ldm",e.Error="error"})(fi||(fi={}));var ca;(function(e){e.Reconnecting="reconnecting",e.PingTimer="pingTimer",e.StaleConnection="staleConnection",e.ClientInitiatedReconnect="client initiated reconnect"})(ca||(ca={}));var ke;(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"})(ke||(ke={}));function W_(e){return typeof e.code=="string"}class gx{constructor(){C(this,"messages");this.messages=new Map,this.messages.set(ke.InvalidPayload,"Invalid payload type - payloads can be 'binary', 'string', or 'json'"),this.messages.set(ke.BadJson,"Bad JSON"),this.messages.set(ke.WssRequired,"TLS is required, therefore a secure websocket connection is also required")}static getMessage(t){return e2.getMessage(t)}getMessage(t){return this.messages.get(t)||t}}const e2=new gx;class Re 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=gx.getMessage(r);return new Re(l,r,s)}isAuthError(){return this.code===ke.AuthenticationExpired||this.code===ke.AuthorizationViolation||this.code===ke.AccountExpired}isAuthTimeout(){return this.code===ke.AuthenticationTimeout}isPermissionError(){return this.code===ke.PermissionsViolation}isProtocolError(){return this.code===ke.ProtocolError}isJetStreamError(){return this.api_error!==void 0}jsError(){return this.api_error?this.api_error:null}}var ir;(function(e){e[e.Exact=0]="Exact",e[e.CanonicalMIME=1]="CanonicalMIME",e[e.IgnoreCase=2]="IgnoreCase"})(ir||(ir={}));var Rr;(function(e){e.Timer="timer",e.Count="count",e.JitterTimer="jitterTimer",e.SentinelMsg="sentinelMsg"})(Rr||(Rr={}));var Nl;(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"})(Nl||(Nl={}));const Nu="Nats-Service-Error",Tu="Nats-Service-Error-Code";class Ou extends Error{constructor(r,s){super(s);C(this,"code");this.code=r}static isServiceError(r){return Ou.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(Nu))||"";return new Ou(c,f.length?f:s)}return null}}function mi(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}.${Gi.next()}`}const td="127.0.0.1";var $i;(function(e){e.PING="PING",e.STATS="STATS",e.INFO="INFO"})($i||($i={}));function Ju(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 fu(e){return ar.decode(e).replace(/\n/g,"␊").replace(/\r/g,"␍")}function ya(e,t=!0){const r=t?Re.errorForCode(ke.Timeout):null;let s,l;const u=new Promise((c,f)=>{s={cancel:()=>{l&&clearTimeout(l)}},l=setTimeout(()=>{f(r===null?Re.errorForCode(ke.Timeout):r)},e)});return Object.assign(u,s)}function Ea(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 Vt(){let e={};const t=new Promise((r,s)=>{e={resolve:r,reject:s}});return Object.assign(t,e)}function yx(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 t2(e){return e===0?0:Math.floor(e/2+Math.random()*e)}function zd(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 t2(r>t?e[t]:e[r])}}}function $t(e){return e*1e6}function Ud(e){return Math.floor(e/1e6)}function w0(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 Re(`'${e[u]}' is not a valid character for a header key`,ke.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 gi(e=0,t=""){if(e===0&&t!==""||e>0&&t==="")throw new Error("setting status requires both code and description");return new Vi(e,t)}const wh="NATS/1.0";class Vi{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 Vi,l=ar.decode(t).split(`\r
61
- `),u=l[0];if(u!==wh){let c=u.replace(wh,"").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 d=c.slice(0,f),m=c.slice(f+1).trim();r.append(d,m)}}}),r}toString(){if(this.headers.size===0&&this._code===0)return"";let t=wh;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
60
+ Please change the parent <Route path="${T}"> to <Route path="${T==="/"?"*":`${T}/*`}">.`)}let y=Er(),g;if(t){let T=typeof t=="string"?Sa(t):t;Yt(d==="/"||((M=T.pathname)==null?void 0:M.startsWith(d)),`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 "${d}" but pathname "${T.pathname}" was given in the \`location\` prop.`),g=T}else g=y;let x=g.pathname||"/",v=x;if(d!=="/"){let T=d.replace(/^\//,"").split("/");v="/"+x.replace(/^\//,"").split("/").slice(T.length).join("/")}let S=Gb(e,{pathname:v});Lr(m||S!=null,`No routes matched location "${g.pathname}${g.search}${g.hash}" `),Lr(S==null||S[S.length-1].route.element!==void 0||S[S.length-1].route.Component!==void 0||S[S.length-1].route.lazy!==void 0,`Matched leaf route at location "${g.pathname}${g.search}${g.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let A=r_(S&&S.map(T=>Object.assign({},T,{params:Object.assign({},c,T.params),pathname:$r([d,s.encodeLocation?s.encodeLocation(T.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:T.pathname]),pathnameBase:T.pathnameBase==="/"?d:$r([d,s.encodeLocation?s.encodeLocation(T.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:T.pathnameBase])})),l,r);return t&&A?E.createElement($l.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,...g},navigationType:"POP"}},A):A}function WS(){let e=o_(),t=HS(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},o={padding:"2px 4px",backgroundColor:s},c=null;return console.error("Error handled by React Router default ErrorBoundary:",e),c=E.createElement(E.Fragment,null,E.createElement("p",null,"💿 Hey developer 👋"),E.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",E.createElement("code",{style:o},"ErrorBoundary")," or"," ",E.createElement("code",{style:o},"errorElement")," prop on your route.")),E.createElement(E.Fragment,null,E.createElement("h2",null,"Unexpected Application Error!"),E.createElement("h3",{style:{fontStyle:"italic"}},t),r?E.createElement("pre",{style:l},r):null,c)}var e_=E.createElement(WS,null),ix=class extends E.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=XS(e.digest);r&&(e=r)}let t=e!==void 0?E.createElement(zr.Provider,{value:this.props.routeContext},E.createElement(Od.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?E.createElement(t_,{error:e},t):t}};ix.contextType=FS;var xh=new WeakMap;function t_({children:e,error:t}){let{basename:r}=E.useContext(fr);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let s=JS(t.digest);if(s){let l=xh.get(t);if(l)throw l;let o=Qb(s.location,r);if(Kb&&!xh.get(t))if(o.isExternal||s.reloadDocument)window.location.href=o.absoluteURL||o.to;else{const c=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(o.to,{replace:s.replace}));throw xh.set(t,c),c}return E.createElement("meta",{httpEquiv:"refresh",content:`0;url=${o.absoluteURL||o.to}`})}}return e}function n_({routeContext:e,match:t,children:r}){let s=E.useContext(_a);return s&&s.static&&s.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(s.staticContext._deepestRenderedBoundaryId=t.route.id),E.createElement(zr.Provider,{value:e},r)}function r_(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,o=s==null?void 0:s.errors;if(o!=null){let y=l.findIndex(g=>g.route.id&&(o==null?void 0:o[g.route.id])!==void 0);Yt(y>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(o).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:v}=s,S=g.route.loader&&!x.hasOwnProperty(g.route.id)&&(!v||v[g.route.id]===void 0);if(g.route.lazy||S){r.isStatic&&(c=!0),f>=0?l=l.slice(0,f+1):l=[l[0]];break}}}}let d=r==null?void 0:r.onError,m=s&&d?(y,g)=>{var x,v;d(y,{location:s.location,params:((v=(x=s.matches)==null?void 0:x[0])==null?void 0:v.params)??{},unstable_pattern:qS(s.matches),errorInfo:g})}:void 0;return l.reduceRight((y,g,x)=>{let v,S=!1,A=null,M=null;s&&(v=o&&g.route.id?o[g.route.id]:void 0,A=g.route.errorElement||e_,c&&(f<0&&x===0?(sx("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),S=!0,M=null):f===x&&(S=!0,M=g.route.hydrateFallbackElement||null)));let T=t.concat(l.slice(0,x+1)),P=()=>{let I;return v?I=A:S?I=M:g.route.Component?I=E.createElement(g.route.Component,null):g.route.element?I=g.route.element:I=y,E.createElement(n_,{match:g,routeContext:{outlet:y,matches:T,isDataRoute:s!=null},children:I})};return s&&(g.route.ErrorBoundary||g.route.errorElement||x===0)?E.createElement(ix,{location:s.location,revalidation:s.revalidation,component:A,error:v,children:P(),routeContext:{outlet:null,matches:T,isDataRoute:!0},onError:m}):P()},null)}function Rd(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function i_(e){let t=E.useContext(_a);return Yt(t,Rd(e)),t}function s_(e){let t=E.useContext(Vu);return Yt(t,Rd(e)),t}function a_(e){let t=E.useContext(zr);return Yt(t,Rd(e)),t}function Md(e){let t=a_(e),r=t.matches[t.matches.length-1];return Yt(r.route.id,`${e} can only be used on routes that contain a unique "id"`),r.route.id}function l_(){return Md("useRouteId")}function o_(){var s;let e=E.useContext(Od),t=s_("useRouteError"),r=Md("useRouteError");return e!==void 0?e:(s=t.errors)==null?void 0:s[r]}function u_(){let{router:e}=i_("useNavigate"),t=Md("useNavigate"),r=E.useRef(!1);return nx(()=>{r.current=!0}),E.useCallback(async(l,o={})=>{Lr(r.current,tx),r.current&&(typeof l=="number"?await e.navigate(l):await e.navigate(l,{fromRouteId:t,...o}))},[e,t])}var d0={};function sx(e,t,r){!t&&!d0[e]&&(d0[e]=!0,Lr(!1,r))}E.memo(c_);function c_({routes:e,future:t,state:r,isStatic:s,onError:l}){return rx(e,void 0,{state:r,isStatic:s,onError:l})}function Ul({to:e,replace:t,state:r,relative:s}){Yt(ka(),"<Navigate> may be used only in the context of a <Router> component.");let{static:l}=E.useContext(fr);Lr(!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:o}=E.useContext(zr),{pathname:c}=Er(),f=Vr(),d=$u(e,Td(o),c,s==="path"),m=JSON.stringify(d);return E.useEffect(()=>{f(JSON.parse(m),{replace:t,state:r,relative:s})},[f,m,s,t,r]),null}function Or(e){Yt(!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 f_({basename:e="/",children:t=null,location:r,navigationType:s="POP",navigator:l,static:o=!1,unstable_useTransitions:c}){Yt(!ka(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let f=e.replace(/^\/*/,"/"),d=E.useMemo(()=>({basename:f,navigator:l,static:o,unstable_useTransitions:c,future:{}}),[f,l,o,c]);typeof r=="string"&&(r=Sa(r));let{pathname:m="/",search:y="",hash:g="",state:x=null,key:v="default",unstable_mask:S}=r,A=E.useMemo(()=>{let M=pi(m,f);return M==null?null:{location:{pathname:M,search:y,hash:g,state:x,key:v,unstable_mask:S},navigationType:s}},[f,m,y,g,x,v,s,S]);return Lr(A!=null,`<Router basename="${f}"> is not able to match the URL "${m}${y}${g}" because it does not start with the basename, so the <Router> won't render anything.`),A==null?null:E.createElement(fr.Provider,{value:d},E.createElement($l.Provider,{children:t,value:A}))}function ax({children:e,location:t}){return ZS(ed(e),t)}function ed(e,t=[]){let r=[];return E.Children.forEach(e,(s,l)=>{if(!E.isValidElement(s))return;let o=[...t,l];if(s.type===E.Fragment){r.push.apply(r,ed(s.props.children,o));return}Yt(s.type===Or,`[${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>`),Yt(!s.props.index||!s.props.children,"An index route cannot have child routes.");let c={id:s.props.id||o.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=ed(s.props.children,o)),r.push(c)}),r}var Su="get",_u="application/x-www-form-urlencoded";function Gu(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function h_(e){return Gu(e)&&e.tagName.toLowerCase()==="button"}function d_(e){return Gu(e)&&e.tagName.toLowerCase()==="form"}function m_(e){return Gu(e)&&e.tagName.toLowerCase()==="input"}function p_(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function g_(e,t){return e.button===0&&(!t||t==="_self")&&!p_(e)}var cu=null;function y_(){if(cu===null)try{new FormData(document.createElement("form"),0),cu=!1}catch{cu=!0}return cu}var b_=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function vh(e){return e!=null&&!b_.has(e)?(Lr(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${_u}"`),null):e}function x_(e,t){let r,s,l,o,c;if(d_(e)){let f=e.getAttribute("action");s=f?pi(f,t):null,r=e.getAttribute("method")||Su,l=vh(e.getAttribute("enctype"))||_u,o=new FormData(e)}else if(h_(e)||m_(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 d=e.getAttribute("formaction")||f.getAttribute("action");if(s=d?pi(d,t):null,r=e.getAttribute("formmethod")||f.getAttribute("method")||Su,l=vh(e.getAttribute("formenctype"))||vh(f.getAttribute("enctype"))||_u,o=new FormData(f,e),!y_()){let{name:m,type:y,value:g}=e;if(y==="image"){let x=m?`${m}.`:"";o.append(`${x}x`,"0"),o.append(`${x}y`,"0")}else m&&o.append(m,g)}}else{if(Gu(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');r=Su,s=null,l=_u,c=e}return o&&l==="text/plain"&&(c=o,o=void 0),{action:s,method:r.toLowerCase(),encType:l,formData:o,body:c}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function Dd(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function v_(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&&pi(l.pathname,t)==="/"?l.pathname=`${t.replace(/\/$/,"")}/_root.${s}`:l.pathname=`${l.pathname.replace(/\/$/,"")}.${s}`,l}async function w_(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 S_(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 __(e,t,r){let s=await Promise.all(e.map(async l=>{let o=t.routes[l.route.id];if(o){let c=await w_(o,r);return c.links?c.links():[]}return[]}));return A_(s.flat(1).filter(S_).filter(l=>l.rel==="stylesheet"||l.rel==="preload").map(l=>l.rel==="stylesheet"?{...l,rel:"prefetch",as:"style"}:{...l,rel:"prefetch"}))}function m0(e,t,r,s,l,o){let c=(d,m)=>r[m]?d.route.id!==r[m].route.id:!0,f=(d,m)=>{var y;return r[m].pathname!==d.pathname||((y=r[m].route.path)==null?void 0:y.endsWith("*"))&&r[m].params["*"]!==d.params["*"]};return o==="assets"?t.filter((d,m)=>c(d,m)||f(d,m)):o==="data"?t.filter((d,m)=>{var g;let y=s.routes[d.route.id];if(!y||!y.hasLoader)return!1;if(c(d,m)||f(d,m))return!0;if(d.route.shouldRevalidate){let x=d.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:d.params,defaultShouldRevalidate:!0});if(typeof x=="boolean")return x}return!0}):[]}function k_(e,t,{includeHydrateFallback:r}={}){return E_(e.map(s=>{let l=t.routes[s.route.id];if(!l)return[];let o=[l.module];return l.clientActionModule&&(o=o.concat(l.clientActionModule)),l.clientLoaderModule&&(o=o.concat(l.clientLoaderModule)),r&&l.hydrateFallbackModule&&(o=o.concat(l.hydrateFallbackModule)),l.imports&&(o=o.concat(l.imports)),o}).flat(1))}function E_(e){return[...new Set(e)]}function C_(e){let t={},r=Object.keys(e).sort();for(let s of r)t[s]=e[s];return t}function A_(e,t){let r=new Set;return new Set(t),e.reduce((s,l)=>{let o=JSON.stringify(C_(l));return r.has(o)||(r.add(o),s.push({key:o,link:l})),s},[])}function lx(){let e=E.useContext(_a);return Dd(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function j_(){let e=E.useContext(Vu);return Dd(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var Ld=E.createContext(void 0);Ld.displayName="FrameworkContext";function ox(){let e=E.useContext(Ld);return Dd(e,"You must render this element inside a <HydratedRouter> element"),e}function N_(e,t){let r=E.useContext(Ld),[s,l]=E.useState(!1),[o,c]=E.useState(!1),{onFocus:f,onBlur:d,onMouseEnter:m,onMouseLeave:y,onTouchStart:g}=t,x=E.useRef(null);E.useEffect(()=>{if(e==="render"&&c(!0),e==="viewport"){let A=T=>{T.forEach(P=>{c(P.isIntersecting)})},M=new IntersectionObserver(A,{threshold:.5});return x.current&&M.observe(x.current),()=>{M.disconnect()}}},[e]),E.useEffect(()=>{if(s){let A=setTimeout(()=>{c(!0)},100);return()=>{clearTimeout(A)}}},[s]);let v=()=>{l(!0)},S=()=>{l(!1),c(!1)};return r?e!=="intent"?[o,x,{}]:[o,x,{onFocus:bl(f,v),onBlur:bl(d,S),onMouseEnter:bl(m,v),onMouseLeave:bl(y,S),onTouchStart:bl(g,v)}]:[!1,x,{}]}function bl(e,t){return r=>{e&&e(r),r.defaultPrevented||t(r)}}function T_({page:e,...t}){let{router:r}=lx(),s=E.useMemo(()=>Gb(r.routes,e,r.basename),[r.routes,e,r.basename]);return s?E.createElement(R_,{page:e,matches:s,...t}):null}function O_(e){let{manifest:t,routeModules:r}=ox(),[s,l]=E.useState([]);return E.useEffect(()=>{let o=!1;return __(e,t,r).then(c=>{o||l(c)}),()=>{o=!0}},[e,t,r]),s}function R_({page:e,matches:t,...r}){let s=Er(),{future:l,manifest:o,routeModules:c}=ox(),{basename:f}=lx(),{loaderData:d,matches:m}=j_(),y=E.useMemo(()=>m0(e,t,m,o,s,"data"),[e,t,m,o,s]),g=E.useMemo(()=>m0(e,t,m,o,s,"assets"),[e,t,m,o,s]),x=E.useMemo(()=>{if(e===s.pathname+s.search+s.hash)return[];let A=new Set,M=!1;if(t.forEach(P=>{var W;let I=o.routes[P.route.id];!I||!I.hasLoader||(!y.some(B=>B.route.id===P.route.id)&&P.route.id in d&&((W=c[P.route.id])!=null&&W.shouldRevalidate)||I.hasClientLoader?M=!0:A.add(P.route.id))}),A.size===0)return[];let T=v_(e,f,l.unstable_trailingSlashAwareDataRequests,"data");return M&&A.size>0&&T.searchParams.set("_routes",t.filter(P=>A.has(P.route.id)).map(P=>P.route.id).join(",")),[T.pathname+T.search]},[f,l.unstable_trailingSlashAwareDataRequests,d,s,o,y,t,e,c]),v=E.useMemo(()=>k_(g,o),[g,o]),S=O_(g);return E.createElement(E.Fragment,null,x.map(A=>E.createElement("link",{key:A,rel:"prefetch",as:"fetch",href:A,...r})),v.map(A=>E.createElement("link",{key:A,rel:"modulepreload",href:A,...r})),S.map(({key:A,link:M})=>E.createElement("link",{key:A,nonce:r.nonce,...M,crossOrigin:M.crossOrigin??r.crossOrigin})))}function M_(...e){return t=>{e.forEach(r=>{typeof r=="function"?r(t):r!=null&&(r.current=t)})}}var D_=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{D_&&(window.__reactRouterVersion="7.13.1")}catch{}function L_({basename:e,children:t,unstable_useTransitions:r,window:s}){let l=E.useRef();l.current==null&&(l.current=gS({window:s,v5Compat:!0}));let o=l.current,[c,f]=E.useState({action:o.action,location:o.location}),d=E.useCallback(m=>{r===!1?f(m):E.startTransition(()=>f(m))},[r]);return E.useLayoutEffect(()=>o.listen(d),[o,d]),E.createElement(f_,{basename:e,children:t,location:c.location,navigationType:c.action,navigator:o,unstable_useTransitions:r})}var ux=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,cx=E.forwardRef(function({onClick:t,discover:r="render",prefetch:s="none",relative:l,reloadDocument:o,replace:c,unstable_mask:f,state:d,target:m,to:y,preventScrollReset:g,viewTransition:x,unstable_defaultShouldRevalidate:v,...S},A){let{basename:M,navigator:T,unstable_useTransitions:P}=E.useContext(fr),I=typeof y=="string"&&ux.test(y),W=Qb(y,M);y=W.to;let B=KS(y,{relative:l}),D=Er(),Z=null;if(f){let re=$u(f,[],D.unstable_mask?D.unstable_mask.pathname:"/",!0);M!=="/"&&(re.pathname=re.pathname==="/"?M:$r([M,re.pathname])),Z=T.createHref(re)}let[$,V,L]=N_(s,S),X=B_(y,{replace:c,unstable_mask:f,state:d,target:m,preventScrollReset:g,relative:l,viewTransition:x,unstable_defaultShouldRevalidate:v,unstable_useTransitions:P});function G(re){t&&t(re),re.defaultPrevented||X(re)}let ce=!(W.isExternal||o),oe=E.createElement("a",{...S,...L,href:(ce?Z:void 0)||W.absoluteURL||B,onClick:ce?G:t,ref:M_(A,V),target:m,"data-discover":!I&&r==="render"?"true":void 0});return $&&!I?E.createElement(E.Fragment,null,oe,E.createElement(T_,{page:B})):oe});cx.displayName="Link";var z_=E.forwardRef(function({"aria-current":t="page",caseSensitive:r=!1,className:s="",end:l=!1,style:o,to:c,viewTransition:f,children:d,...m},y){let g=Vl(c,{relative:m.relative}),x=Er(),v=E.useContext(Vu),{navigator:S,basename:A}=E.useContext(fr),M=v!=null&&$_(g)&&f===!0,T=S.encodeLocation?S.encodeLocation(g).pathname:g.pathname,P=x.pathname,I=v&&v.navigation&&v.navigation.location?v.navigation.location.pathname:null;r||(P=P.toLowerCase(),I=I?I.toLowerCase():null,T=T.toLowerCase()),I&&A&&(I=pi(I,A)||I);const W=T!=="/"&&T.endsWith("/")?T.length-1:T.length;let B=P===T||!l&&P.startsWith(T)&&P.charAt(W)==="/",D=I!=null&&(I===T||!l&&I.startsWith(T)&&I.charAt(T.length)==="/"),Z={isActive:B,isPending:D,isTransitioning:M},$=B?t:void 0,V;typeof s=="function"?V=s(Z):V=[s,B?"active":null,D?"pending":null,M?"transitioning":null].filter(Boolean).join(" ");let L=typeof o=="function"?o(Z):o;return E.createElement(cx,{...m,"aria-current":$,className:V,ref:y,style:L,to:c,viewTransition:f},typeof d=="function"?d(Z):d)});z_.displayName="NavLink";var U_=E.forwardRef(({discover:e="render",fetcherKey:t,navigate:r,reloadDocument:s,replace:l,state:o,method:c=Su,action:f,onSubmit:d,relative:m,preventScrollReset:y,viewTransition:g,unstable_defaultShouldRevalidate:x,...v},S)=>{let{unstable_useTransitions:A}=E.useContext(fr),M=I_(),T=F_(f,{relative:m}),P=c.toLowerCase()==="get"?"get":"post",I=typeof f=="string"&&ux.test(f),W=B=>{if(d&&d(B),B.defaultPrevented)return;B.preventDefault();let D=B.nativeEvent.submitter,Z=(D==null?void 0:D.getAttribute("formmethod"))||c,$=()=>M(D||B.currentTarget,{fetcherKey:t,method:Z,navigate:r,replace:l,state:o,relative:m,preventScrollReset:y,viewTransition:g,unstable_defaultShouldRevalidate:x});A&&r!==!1?E.startTransition(()=>$()):$()};return E.createElement("form",{ref:S,method:P,action:T,onSubmit:s?d:W,...v,"data-discover":!I&&e==="render"?"true":void 0})});U_.displayName="Form";function P_(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function fx(e){let t=E.useContext(_a);return Yt(t,P_(e)),t}function B_(e,{target:t,replace:r,unstable_mask:s,state:l,preventScrollReset:o,relative:c,viewTransition:f,unstable_defaultShouldRevalidate:d,unstable_useTransitions:m}={}){let y=Vr(),g=Er(),x=Vl(e,{relative:c});return E.useCallback(v=>{if(g_(v,t)){v.preventDefault();let S=r!==void 0?r:zl(g)===zl(x),A=()=>y(e,{replace:S,unstable_mask:s,state:l,preventScrollReset:o,relative:c,viewTransition:f,unstable_defaultShouldRevalidate:d});m?E.startTransition(()=>A()):A()}},[g,y,x,r,s,l,t,e,o,c,f,d,m])}var H_=0,q_=()=>`__${String(++H_)}__`;function I_(){let{router:e}=fx("useSubmit"),{basename:t}=E.useContext(fr),r=l_(),s=e.fetch,l=e.navigate;return E.useCallback(async(o,c={})=>{let{action:f,method:d,encType:m,formData:y,body:g}=x_(o,t);if(c.navigate===!1){let x=c.fetcherKey||q_();await s(x,r,c.action||f,{unstable_defaultShouldRevalidate:c.unstable_defaultShouldRevalidate,preventScrollReset:c.preventScrollReset,formData:y,body:g,formMethod:c.method||d,formEncType:c.encType||m,flushSync:c.flushSync})}else await l(c.action||f,{unstable_defaultShouldRevalidate:c.unstable_defaultShouldRevalidate,preventScrollReset:c.preventScrollReset,formData:y,body:g,formMethod:c.method||d,formEncType:c.encType||m,replace:c.replace,state:c.state,fromRouteId:r,flushSync:c.flushSync,viewTransition:c.viewTransition})},[s,l,t,r])}function F_(e,{relative:t}={}){let{basename:r}=E.useContext(fr),s=E.useContext(zr);Yt(s,"useFormAction must be used inside a RouteContext");let[l]=s.matches.slice(-1),o={...Vl(e||".",{relative:t})},c=Er();if(e==null){o.search=c.search;let f=new URLSearchParams(o.search),d=f.getAll("index");if(d.some(y=>y==="")){f.delete("index"),d.filter(g=>g).forEach(g=>f.append("index",g));let y=f.toString();o.search=y?`?${y}`:""}}return(!e||e===".")&&l.route.index&&(o.search=o.search?o.search.replace(/^\?/,"?index&"):"?index"),r!=="/"&&(o.pathname=o.pathname==="/"?r:$r([r,o.pathname])),zl(o)}function $_(e,{relative:t}={}){let r=E.useContext(Wb);Yt(r!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:s}=fx("useViewTransitionState"),l=Vl(e,{relative:t});if(!r.isTransitioning)return!1;let o=pi(r.currentLocation.pathname,s)||r.currentLocation.pathname,c=pi(r.nextLocation.pathname,s)||r.nextLocation.pathname;return ju(l.pathname,c)!=null||ju(l.pathname,o)!=null}var di=Yb();const hx=E.createContext(null),dx="palmier_paired_hosts",p0="palmier_last_host";function V_(){try{const e=localStorage.getItem(dx);if(e)return JSON.parse(e)}catch{}return[]}function Y_(e){localStorage.setItem(dx,JSON.stringify(e))}const g0="local",G_=!!window.__PALMIER_SERVE__&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1");function J_({children:e}){const[t,r]=E.useState(()=>{const x=V_();return G_&&!x.some(v=>v.hostId===g0)&&x.push({hostId:g0,clientToken:"",directUrl:window.location.origin}),x}),[s,l]=E.useState(()=>{try{return localStorage.getItem(p0)}catch{return null}});E.useEffect(()=>{Y_(t)},[t]);const o=E.useCallback(x=>{l(v=>v===x?v:x);try{localStorage.setItem(p0,x)}catch{}},[]),c=E.useCallback(x=>{r(v=>[...v.filter(A=>A.hostId!==x.hostId),x])},[]),f=E.useCallback(x=>{r(v=>v.filter(S=>S.hostId!==x))},[]),d=E.useCallback((x,v)=>{r(S=>S.map(A=>A.hostId===x?{...A,name:v}:A))},[]),m=E.useCallback((x,v)=>{r(S=>S.map(A=>A.hostId!==x||A.lanUrl===v?A:{...A,lanUrl:v}))},[]),y=E.useCallback((x,v)=>{r(S=>S.map(A=>A.hostId!==x||A.lastAgent===v?A:{...A,lastAgent:v}))},[]),g=E.useCallback((x,v)=>{r(S=>S.map(A=>A.hostId!==x||A.timezone===v?A:{...A,timezone:v}))},[]);return b.jsx(hx.Provider,{value:{pairedHosts:t,lastHostId:s,addPairedHost:c,removePairedHost:f,renamePairedHost:d,setHostLanUrl:m,setHostLastAgent:y,setHostTimezone:g,setLastHostId:o},children:e})}function Xi(){const e=E.useContext(hx);if(!e)throw new Error("useHostStore must be used within HostStoreProvider");return e}const cr=new Uint8Array(0),Ki=new TextEncoder,lr=new TextDecoder;function X_(...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 jl(...e){const t=[];for(let r=0;r<e.length;r++)t.push(Ki.encode(e[r]));return t.length===0?cr:t.length===1?t[0]:X_(...t)}function y0(e){return!e||e.length===0?"":lr.decode(e)}const b0="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ",x0=36,K_=0xcfd41b9100000,v0=33,Q_=333,w0=22;function Z_(e){for(let t=0;t<e.length;t++)e[t]=Math.floor(Math.random()*255)}function W_(e){var t;(t=globalThis==null?void 0:globalThis.crypto)!=null&&t.getRandomValues?globalThis.crypto.getRandomValues(e):Z_(e)}class e2{constructor(){C(this,"buf");C(this,"seq");C(this,"inc");C(this,"inited");this.buf=new Uint8Array(w0),this.inited=!1}init(){this.inited=!0,this.setPre(),this.initSeqAndInc(),this.fillSeq()}initSeqAndInc(){this.seq=Math.floor(Math.random()*K_),this.inc=Math.floor(Math.random()*(Q_-v0)+v0)}setPre(){const t=new Uint8Array(12);W_(t);for(let r=0;r<12;r++){const s=t[r]%36;this.buf[r]=b0.charCodeAt(s)}}fillSeq(){let t=this.seq;for(let r=w0-1;r>=12;r--)this.buf[r]=b0.charCodeAt(t%x0),t=Math.floor(t/x0)}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 Gi=new e2;var fi;(function(e){e.Disconnect="disconnect",e.Reconnect="reconnect",e.Update="update",e.LDM="ldm",e.Error="error"})(fi||(fi={}));var ca;(function(e){e.Reconnecting="reconnecting",e.PingTimer="pingTimer",e.StaleConnection="staleConnection",e.ClientInitiatedReconnect="client initiated reconnect"})(ca||(ca={}));var ke;(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"})(ke||(ke={}));function t2(e){return typeof e.code=="string"}class mx{constructor(){C(this,"messages");this.messages=new Map,this.messages.set(ke.InvalidPayload,"Invalid payload type - payloads can be 'binary', 'string', or 'json'"),this.messages.set(ke.BadJson,"Bad JSON"),this.messages.set(ke.WssRequired,"TLS is required, therefore a secure websocket connection is also required")}static getMessage(t){return n2.getMessage(t)}getMessage(t){return this.messages.get(t)||t}}const n2=new mx;class Re 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=mx.getMessage(r);return new Re(l,r,s)}isAuthError(){return this.code===ke.AuthenticationExpired||this.code===ke.AuthorizationViolation||this.code===ke.AccountExpired}isAuthTimeout(){return this.code===ke.AuthenticationTimeout}isPermissionError(){return this.code===ke.PermissionsViolation}isProtocolError(){return this.code===ke.ProtocolError}isJetStreamError(){return this.api_error!==void 0}jsError(){return this.api_error?this.api_error:null}}var sr;(function(e){e[e.Exact=0]="Exact",e[e.CanonicalMIME=1]="CanonicalMIME",e[e.IgnoreCase=2]="IgnoreCase"})(sr||(sr={}));var Rr;(function(e){e.Timer="timer",e.Count="count",e.JitterTimer="jitterTimer",e.SentinelMsg="sentinelMsg"})(Rr||(Rr={}));var Nl;(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"})(Nl||(Nl={}));const Nu="Nats-Service-Error",Tu="Nats-Service-Error-Code";class Ou extends Error{constructor(r,s){super(s);C(this,"code");this.code=r}static isServiceError(r){return Ou.toServiceError(r)!==null}static toServiceError(r){var l,o;const s=((l=r==null?void 0:r.headers)==null?void 0:l.get(Tu))||"";if(s!==""){const c=parseInt(s)||400,f=((o=r==null?void 0:r.headers)==null?void 0:o.get(Nu))||"";return new Ou(c,f.length?f:s)}return null}}function mi(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}.${Gi.next()}`}const td="127.0.0.1";var $i;(function(e){e.PING="PING",e.STATS="STATS",e.INFO="INFO"})($i||($i={}));function Ju(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 fu(e){return lr.decode(e).replace(/\n/g,"␊").replace(/\r/g,"␍")}function ya(e,t=!0){const r=t?Re.errorForCode(ke.Timeout):null;let s,l;const o=new Promise((c,f)=>{s={cancel:()=>{l&&clearTimeout(l)}},l=setTimeout(()=>{f(r===null?Re.errorForCode(ke.Timeout):r)},e)});return Object.assign(o,s)}function Ea(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 Vt(){let e={};const t=new Promise((r,s)=>{e={resolve:r,reject:s}});return Object.assign(t,e)}function px(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 r2(e){return e===0?0:Math.floor(e/2+Math.random()*e)}function zd(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 r2(r>t?e[t]:e[r])}}}function $t(e){return e*1e6}function Ud(e){return Math.floor(e/1e6)}function S0(e){let s=!0;const l=new Array(e.length);for(let o=0;o<e.length;o++){let c=e.charCodeAt(o);if(c===58||c<33||c>126)throw new Re(`'${e[o]}' is not a valid character for a header key`,ke.BadHeader);s&&97<=c&&c<=122?c-=32:!s&&65<=c&&c<=90&&(c+=32),l[o]=c,s=c==45}return String.fromCharCode(...l)}function gi(e=0,t=""){if(e===0&&t!==""||e>0&&t==="")throw new Error("setting status requires both code and description");return new Vi(e,t)}const wh="NATS/1.0";class Vi{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 o=[...s].sort(),c=[...l].sort();for(let f=0;f<o.length;f++)if(o[f]!==c[f])return!1}return!0}return!1}static decode(t){const r=new Vi,l=lr.decode(t).split(`\r
61
+ `),o=l[0];if(o!==wh){let c=o.replace(wh,"").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 d=c.slice(0,f),m=c.slice(f+1).trim();r.append(d,m)}}}),r}toString(){if(this.headers.size===0&&this._code===0)return"";let t=wh;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
62
  ${r}: ${s[l]}`;return`${t}\r
63
63
  \r
64
- `}encode(){return Ki.encode(this.toString())}static validHeaderValue(t){if(/[\r\n]/.test(t))throw new Re("invalid header value - \\r and \\n are not allowed.",ke.BadHeader);return t.trim()}keys(){const t=[];for(const r of this.headers.keys())t.push(r);return t}findKeys(t,r=ir.Exact){const s=this.keys();switch(r){case ir.Exact:return s.filter(l=>l===t);case ir.CanonicalMIME:return t=w0(t),s.filter(l=>l===t);default:{const l=t.toLowerCase();return s.filter(u=>l===u.toLowerCase())}}}get(t,r=ir.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=ir.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=ir.Exact){return this.findKeys(t,r).length>0}set(t,r,s=ir.Exact){this.delete(t,s),this.append(t,r,s)}append(t,r,s=ir.Exact){const l=w0(t);s===ir.CanonicalMIME&&(t=l);const u=this.findKeys(t,s);t=u.length>0?u[0]:t;const c=Vi.validHeaderValue(r);let f=this.headers.get(t);f||(f=[],this.headers.set(t,f)),f.push(c)}values(t,r=ir.Exact){const s=[];return this.findKeys(t,r).forEach(u=>{const c=this.headers.get(u);c&&s.push(...c)}),s}delete(t,r=ir.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 Vi;for(const s in t)r.headers.set(s,t[s]);return r}}function Ru(){return{encode(e){return Ki.encode(e)},decode(e){return ar.decode(e)}}}function Mr(e){return{encode(t){try{return t===void 0&&(t=null),Ki.encode(JSON.stringify(t))}catch(r){throw Re.errorForCode(ke.BadJson,r)}},decode(t){try{return JSON.parse(ar.decode(t),e)}catch(r){throw Re.errorForCode(ke.BadJson,r)}}}}function bx(e){var t;return e&&e.data.length===0&&((t=e.headers)==null?void 0:t.code)===503?Re.errorForCode(ke.NoResponders):null}class Pd{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=ar.decode(this._msg.subject),this._subject)}get reply(){return this._reply?this._reply:(this._reply=ar.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=Vi.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=ur,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 Mr(t).decode(this.data)}string(){return ar.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(Pd,"jc");function fa(e){return Xu("durable",e)}function Mn(e){return Xu("stream",e)}function Xu(e,t=""){if(t==="")throw Error(`${e} name required`);return[".","*",">","/","\\"," "," ",`
64
+ `}encode(){return Ki.encode(this.toString())}static validHeaderValue(t){if(/[\r\n]/.test(t))throw new Re("invalid header value - \\r and \\n are not allowed.",ke.BadHeader);return t.trim()}keys(){const t=[];for(const r of this.headers.keys())t.push(r);return t}findKeys(t,r=sr.Exact){const s=this.keys();switch(r){case sr.Exact:return s.filter(l=>l===t);case sr.CanonicalMIME:return t=S0(t),s.filter(l=>l===t);default:{const l=t.toLowerCase();return s.filter(o=>l===o.toLowerCase())}}}get(t,r=sr.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=sr.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=sr.Exact){return this.findKeys(t,r).length>0}set(t,r,s=sr.Exact){this.delete(t,s),this.append(t,r,s)}append(t,r,s=sr.Exact){const l=S0(t);s===sr.CanonicalMIME&&(t=l);const o=this.findKeys(t,s);t=o.length>0?o[0]:t;const c=Vi.validHeaderValue(r);let f=this.headers.get(t);f||(f=[],this.headers.set(t,f)),f.push(c)}values(t,r=sr.Exact){const s=[];return this.findKeys(t,r).forEach(o=>{const c=this.headers.get(o);c&&s.push(...c)}),s}delete(t,r=sr.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 Vi;for(const s in t)r.headers.set(s,t[s]);return r}}function Ru(){return{encode(e){return Ki.encode(e)},decode(e){return lr.decode(e)}}}function Mr(e){return{encode(t){try{return t===void 0&&(t=null),Ki.encode(JSON.stringify(t))}catch(r){throw Re.errorForCode(ke.BadJson,r)}},decode(t){try{return JSON.parse(lr.decode(t),e)}catch(r){throw Re.errorForCode(ke.BadJson,r)}}}}function gx(e){var t;return e&&e.data.length===0&&((t=e.headers)==null?void 0:t.code)===503?Re.errorForCode(ke.NoResponders):null}class Pd{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=lr.decode(this._msg.subject),this._subject)}get reply(){return this._reply?this._reply:(this._reply=lr.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=Vi.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=cr,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 Mr(t).decode(this.data)}string(){return lr.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(Pd,"jc");function fa(e){return Xu("durable",e)}function Mn(e){return Xu("stream",e)}function Xu(e,t=""){if(t==="")throw Error(`${e} name required`);return[".","*",">","/","\\"," "," ",`
65
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 Cl(e,t=""){if(t==="")throw Error(`${e} name required`);const r=n2(t);if(r.length)throw new Error(`invalid ${e} name - ${e} name ${r}`)}function n2(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 nd(e){if(e.data.length>0)return!1;const t=e.headers;return t?t.code>=100&&t.code<200:!1}function rd(e){var t;return nd(e)&&((t=e.headers)==null?void 0:t.description)==="Idle Heartbeat"}function r2(e,t,r){const s=gi(e,t),l={hdr:1,sid:0,size:0},u=new Pd(l,ur,{});return u._headers=s,u._subject=r,u}function ha(e){if(e.data.length!==0)return null;const t=e.headers;return t?xx(t.code,t.description):null}var _r;(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"})(_r||(_r={}));function i2(e){return e.code!==ke.JetStream409?!1:[_r.MaxBatchExceeded,_r.MaxExpiresExceeded,_r.MaxBytesExceeded,_r.MaxMessageSizeExceeded,_r.PushConsumer,_r.IdleHeartbeatMissed,_r.ConsumerDeleted].find(r=>e.message.indexOf(r)!==-1)!==void 0}function xx(e,t=""){if(e<300)return null;switch(t=t.toLowerCase(),e){case 404:return new Re(t,ke.JetStream404NoMessages);case 408:return new Re(t,ke.JetStream408RequestTimeout);case 409:{const r=t.startsWith(_r.IdleHeartbeatMissed)?ke.JetStreamIdleHeartBeat:ke.JetStream409;return new Re(t,r)}case 503:return Re.errorForCode(ke.JetStreamNotEnabled,new Error(t));default:return t===""&&(t=ke.Unknown),new Re(t,`${e}`)}}class xn{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=Vt(),this.yields=[],this.iterClosed=Vt(),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 Re("unsupported iterator",ke.ApiError);if(this.yielding)throw new Re("already yielding",ke.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=Vt())}}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 Bd{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 id;(function(e){e.Limits="limits",e.Interest="interest",e.Workqueue="workqueue"})(id||(id={}));var Pl;(function(e){e.Old="old",e.New="new"})(Pl||(Pl={}));var sd;(function(e){e.File="file",e.Memory="memory"})(sd||(sd={}));var an;(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"})(an||(an={}));var bn;(function(e){e.None="none",e.All="all",e.Explicit="explicit",e.NotSet=""})(bn||(bn={}));var ba;(function(e){e.Instant="instant",e.Original="original"})(ba||(ba={}));var Ji;(function(e){e.None="none",e.S2="s2"})(Ji||(Ji={}));var Mu;(function(e){e.CreateOrUpdate="",e.Update="update",e.Create="create"})(Mu||(Mu={}));function s2(e,t={}){return Object.assign({name:e,deliver_policy:an.All,ack_policy:bn.Explicit,ack_wait:$t(30*1e3),replay_policy:ba.Instant},t)}var S0;(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"})(S0||(S0={}));var Un;(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"})(Un||(Un={}));var Tr;(function(e){e.LastValue="",e.AllHistory="history",e.UpdatesOnly="updates"})(Tr||(Tr={}));var oa;(function(e){e.Stream="Nats-Stream",e.Sequence="Nats-Sequence",e.TimeStamp="Nats-Time-Stamp",e.Subject="Nats-Subject"})(oa||(oa={}));var _0;(function(e){e.Stream="Nats-Stream",e.Subject="Nats-Subject",e.Sequence="Nats-Sequence",e.LastSequence="Nats-Last-Sequence",e.Size="Nats-Msg-Size"})(_0||(_0={}));const sr="KV_";class a2{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=s2("",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?bn.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 fa(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=an.StartSequence,this.config.opt_start_seq=t,this}startTime(t){return this.config.deliver_policy=an.StartTime,this.config.opt_start_time=t.toISOString(),this}deliverAll(){return this.config.deliver_policy=an.All,this}deliverLastPerSubject(){return this.config.deliver_policy=an.LastPerSubject,this}deliverLast(){return this.config.deliver_policy=an.Last,this}deliverNew(){return this.config.deliver_policy=an.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=bn.None,this}ackAll(){return this.config.ack_policy=bn.All,this}ackExplicit(){return this.config.ack_policy=bn.Explicit,this}ackWait(t){return this.config.ack_wait=$t(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=ba.Instant,this}replayOriginal(){return this.config.replay_policy=ba.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=$t(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=$t(t),this}maxPullBatch(t){return this.config.max_batch=t,this}maxPullRequestExpires(t){return this.config.max_expires=$t(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 Yi(e){return new a2(e)}function k0(e){return typeof e.getOpts=="function"}class l2{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 da{static encode(t){return da.toB64URLEncoding(l2.encode(t))}static decode(t,r=!1){return da.decode(da.fromB64URLEncoding(t),r)}static toB64URLEncoding(t){return t.replace(/\+/g,"-").replace(/\//g,"_")}static fromB64URLEncoding(t){return t.replace(/_/g,"/").replace(/-/g,"+")}}class xa{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=""),Ki.encode(t)}static toAscii(t){return ar.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 o2(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 u2=typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{},xl=u2.performance||{};xl.now||xl.mozNow||xl.msNow||xl.oNow||xl.webkitNow;var E0={versions:{}},c2=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function f2(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 Sh,Ku={exports:{}},C0={},A0=f2(o2({__proto__:null,default:C0},[C0]));Sh=Ku,(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&&E0.versions&&E0.versions.node;l?r=c2:s&&(r=self);var u=!r.JS_SHA256_NO_COMMON_JS&&Sh.exports,c=!r.JS_SHA256_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",f="0123456789abcdef".split(""),d=[-2147483648,8388608,32768,128],m=[24,16,8,0],y=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],g=["hex","array","digest","arrayBuffer"],x=[];!r.JS_SHA256_NO_NODE_JS&&Array.isArray||(Array.isArray=function(B){return Object.prototype.toString.call(B)==="[object Array]"}),!c||!r.JS_SHA256_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(B){return typeof B=="object"&&B.buffer&&B.buffer.constructor===ArrayBuffer});var v=function(B,R){return function(Z){return new P(R,!0).update(Z)[B]()}},S=function(B){var R=v("hex",B);l&&(R=j(R,B)),R.create=function(){return new P(B)},R.update=function(V){return R.create().update(V)};for(var Z=0;Z<g.length;++Z){var F=g[Z];R[F]=v(F,B)}return R},j=function(B,R){var Z,F=A0,V=A0.Buffer,L=R?"sha224":"sha256";return Z=V.from&&!r.JS_SHA256_NO_BUFFER_FROM?V.from:function(X){return new V(X)},function(X){if(typeof X=="string")return F.createHash(L).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===V?F.createHash(L).update(Z(X)).digest("hex"):B(X)}},D=function(B,R){return function(Z,F){return new I(Z,R,!0).update(F)[B]()}},T=function(B){var R=D("hex",B);R.create=function(V){return new I(V,B)},R.update=function(V,L){return R.create(V).update(L)};for(var Z=0;Z<g.length;++Z){var F=g[Z];R[F]=D(F,B)}return R};function P(B,R){R?(x[0]=x[16]=x[1]=x[2]=x[3]=x[4]=x[5]=x[6]=x[7]=x[8]=x[9]=x[10]=x[11]=x[12]=x[13]=x[14]=x[15]=0,this.blocks=x):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],B?(this.h0=3238371032,this.h1=914150663,this.h2=812702999,this.h3=4144912697,this.h4=4290775857,this.h5=1750603025,this.h6=1694076839,this.h7=3204075428):(this.h0=1779033703,this.h1=3144134277,this.h2=1013904242,this.h3=2773480762,this.h4=1359893119,this.h5=2600822924,this.h6=528734635,this.h7=1541459225),this.block=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0,this.is224=B}function I(B,R,Z){var F,V=typeof B;if(V==="string"){var L,X=[],G=B.length,ue=0;for(F=0;F<G;++F)(L=B.charCodeAt(F))<128?X[ue++]=L:L<2048?(X[ue++]=192|L>>>6,X[ue++]=128|63&L):L<55296||L>=57344?(X[ue++]=224|L>>>12,X[ue++]=128|L>>>6&63,X[ue++]=128|63&L):(L=65536+((1023&L)<<10|1023&B.charCodeAt(++F)),X[ue++]=240|L>>>18,X[ue++]=128|L>>>12&63,X[ue++]=128|L>>>6&63,X[ue++]=128|63&L);B=X}else{if(V!=="object")throw new Error(e);if(B===null)throw new Error(e);if(c&&B.constructor===ArrayBuffer)B=new Uint8Array(B);else if(!(Array.isArray(B)||c&&ArrayBuffer.isView(B)))throw new Error(e)}B.length>64&&(B=new P(R,!0).update(B).array());var le=[],re=[];for(F=0;F<64;++F){var $=B[F]||0;le[F]=92^$,re[F]=54^$}P.call(this,R,Z),this.update(re),this.oKeyPad=le,this.inner=!0,this.sharedMemory=Z}P.prototype.update=function(B){if(!this.finalized){var R,Z=typeof B;if(Z!=="string"){if(Z!=="object")throw new Error(e);if(B===null)throw new Error(e);if(c&&B.constructor===ArrayBuffer)B=new Uint8Array(B);else if(!(Array.isArray(B)||c&&ArrayBuffer.isView(B)))throw new Error(e);R=!0}for(var F,V,L=0,X=B.length,G=this.blocks;L<X;){if(this.hashed&&(this.hashed=!1,G[0]=this.block,this.block=G[16]=G[1]=G[2]=G[3]=G[4]=G[5]=G[6]=G[7]=G[8]=G[9]=G[10]=G[11]=G[12]=G[13]=G[14]=G[15]=0),R)for(V=this.start;L<X&&V<64;++L)G[V>>>2]|=B[L]<<m[3&V++];else for(V=this.start;L<X&&V<64;++L)(F=B.charCodeAt(L))<128?G[V>>>2]|=F<<m[3&V++]:F<2048?(G[V>>>2]|=(192|F>>>6)<<m[3&V++],G[V>>>2]|=(128|63&F)<<m[3&V++]):F<55296||F>=57344?(G[V>>>2]|=(224|F>>>12)<<m[3&V++],G[V>>>2]|=(128|F>>>6&63)<<m[3&V++],G[V>>>2]|=(128|63&F)<<m[3&V++]):(F=65536+((1023&F)<<10|1023&B.charCodeAt(++L)),G[V>>>2]|=(240|F>>>18)<<m[3&V++],G[V>>>2]|=(128|F>>>12&63)<<m[3&V++],G[V>>>2]|=(128|F>>>6&63)<<m[3&V++],G[V>>>2]|=(128|63&F)<<m[3&V++]);this.lastByteIndex=V,this.bytes+=V-this.start,V>=64?(this.block=G[16],this.start=V-64,this.hash(),this.hashed=!0):this.start=V}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 B=this.blocks,R=this.lastByteIndex;B[16]=this.block,B[R>>>2]|=d[3&R],this.block=B[16],R>=56&&(this.hashed||this.hash(),B[0]=this.block,B[16]=B[1]=B[2]=B[3]=B[4]=B[5]=B[6]=B[7]=B[8]=B[9]=B[10]=B[11]=B[12]=B[13]=B[14]=B[15]=0),B[14]=this.hBytes<<3|this.bytes>>>29,B[15]=this.bytes<<3,this.hash()}},P.prototype.hash=function(){var B,R,Z,F,V,L,X,G,ue,le=this.h0,re=this.h1,$=this.h2,q=this.h3,ae=this.h4,be=this.h5,M=this.h6,U=this.h7,ee=this.blocks;for(B=16;B<64;++B)R=((V=ee[B-15])>>>7|V<<25)^(V>>>18|V<<14)^V>>>3,Z=((V=ee[B-2])>>>17|V<<15)^(V>>>19|V<<13)^V>>>10,ee[B]=ee[B-16]+R+ee[B-7]+Z|0;for(ue=re&$,B=0;B<64;B+=4)this.first?(this.is224?(L=300032,U=(V=ee[0]-1413257819)-150054599|0,q=V+24177077|0):(L=704751109,U=(V=ee[0]-210244248)-1521486534|0,q=V+143694565|0),this.first=!1):(R=(le>>>2|le<<30)^(le>>>13|le<<19)^(le>>>22|le<<10),F=(L=le&re)^le&$^ue,U=q+(V=U+(Z=(ae>>>6|ae<<26)^(ae>>>11|ae<<21)^(ae>>>25|ae<<7))+(ae&be^~ae&M)+y[B]+ee[B])|0,q=V+(R+F)|0),R=(q>>>2|q<<30)^(q>>>13|q<<19)^(q>>>22|q<<10),F=(X=q&le)^q&re^L,M=$+(V=M+(Z=(U>>>6|U<<26)^(U>>>11|U<<21)^(U>>>25|U<<7))+(U&ae^~U&be)+y[B+1]+ee[B+1])|0,R=(($=V+(R+F)|0)>>>2|$<<30)^($>>>13|$<<19)^($>>>22|$<<10),F=(G=$&q)^$&le^X,be=re+(V=be+(Z=(M>>>6|M<<26)^(M>>>11|M<<21)^(M>>>25|M<<7))+(M&U^~M&ae)+y[B+2]+ee[B+2])|0,R=((re=V+(R+F)|0)>>>2|re<<30)^(re>>>13|re<<19)^(re>>>22|re<<10),F=(ue=re&$)^re&q^G,ae=le+(V=ae+(Z=(be>>>6|be<<26)^(be>>>11|be<<21)^(be>>>25|be<<7))+(be&M^~be&U)+y[B+3]+ee[B+3])|0,le=V+(R+F)|0,this.chromeBugWorkAround=!0;this.h0=this.h0+le|0,this.h1=this.h1+re|0,this.h2=this.h2+$|0,this.h3=this.h3+q|0,this.h4=this.h4+ae|0,this.h5=this.h5+be|0,this.h6=this.h6+M|0,this.h7=this.h7+U|0},P.prototype.hex=function(){this.finalize();var B=this.h0,R=this.h1,Z=this.h2,F=this.h3,V=this.h4,L=this.h5,X=this.h6,G=this.h7,ue=f[B>>>28&15]+f[B>>>24&15]+f[B>>>20&15]+f[B>>>16&15]+f[B>>>12&15]+f[B>>>8&15]+f[B>>>4&15]+f[15&B]+f[R>>>28&15]+f[R>>>24&15]+f[R>>>20&15]+f[R>>>16&15]+f[R>>>12&15]+f[R>>>8&15]+f[R>>>4&15]+f[15&R]+f[Z>>>28&15]+f[Z>>>24&15]+f[Z>>>20&15]+f[Z>>>16&15]+f[Z>>>12&15]+f[Z>>>8&15]+f[Z>>>4&15]+f[15&Z]+f[F>>>28&15]+f[F>>>24&15]+f[F>>>20&15]+f[F>>>16&15]+f[F>>>12&15]+f[F>>>8&15]+f[F>>>4&15]+f[15&F]+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[L>>>28&15]+f[L>>>24&15]+f[L>>>20&15]+f[L>>>16&15]+f[L>>>12&15]+f[L>>>8&15]+f[L>>>4&15]+f[15&L]+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||(ue+=f[G>>>28&15]+f[G>>>24&15]+f[G>>>20&15]+f[G>>>16&15]+f[G>>>12&15]+f[G>>>8&15]+f[G>>>4&15]+f[15&G]),ue},P.prototype.toString=P.prototype.hex,P.prototype.digest=function(){this.finalize();var B=this.h0,R=this.h1,Z=this.h2,F=this.h3,V=this.h4,L=this.h5,X=this.h6,G=this.h7,ue=[B>>>24&255,B>>>16&255,B>>>8&255,255&B,R>>>24&255,R>>>16&255,R>>>8&255,255&R,Z>>>24&255,Z>>>16&255,Z>>>8&255,255&Z,F>>>24&255,F>>>16&255,F>>>8&255,255&F,V>>>24&255,V>>>16&255,V>>>8&255,255&V,L>>>24&255,L>>>16&255,L>>>8&255,255&L,X>>>24&255,X>>>16&255,X>>>8&255,255&X];return this.is224||ue.push(G>>>24&255,G>>>16&255,G>>>8&255,255&G),ue},P.prototype.array=P.prototype.digest,P.prototype.arrayBuffer=function(){this.finalize();var B=new ArrayBuffer(this.is224?28:32),R=new DataView(B);return R.setUint32(0,this.h0),R.setUint32(4,this.h1),R.setUint32(8,this.h2),R.setUint32(12,this.h3),R.setUint32(16,this.h4),R.setUint32(20,this.h5),R.setUint32(24,this.h6),this.is224||R.setUint32(28,this.h7),B},I.prototype=new P,I.prototype.finalize=function(){if(P.prototype.finalize.call(this),this.inner){this.inner=!1;var B=this.array();P.call(this,this.is224,this.sharedMemory),this.update(this.oKeyPad),this.update(B),P.prototype.finalize.call(this)}};var W=S();W.sha256=W,W.sha224=S(!0),W.sha256.hmac=T(),W.sha224.hmac=T(!0),u?Sh.exports=W:(r.sha256=W.sha256,r.sha224=W.sha224)})();Ku.exports;Ku.exports.sha224;var j0=Ku.exports.sha256;function ad(e){return y2(e)}function h2(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 d2(e){return/^[A-Za-z0-9\-_]*(={0,2})?$/.test(e)||/^[A-Za-z0-9+/]*(={0,2})?$/.test(e)}function m2(e){return h2(e)?"hex":d2(e)?"b64":""}function p2(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 g2(e){e=e.replace(/-/g,"+"),e=e.replace(/_/g,"/");const t=atob(e);return Uint8Array.from(t,r=>r.charCodeAt(0))}function y2(e){switch(m2(e)){case"hex":return p2(e);case"b64":return g2(e)}return null}function b2(e,t){const r=typeof e=="string"?ad(e):e,s=typeof t=="string"?ad(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 vx{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=Gi.next(),s&&(this.ctx=new Error)}}class x2 extends vx{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=Vt(),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+=`
66
+ `:s="\\n";break;case"\r":s="\\r";break;case" ":s="\\t";break}throw Error(`invalid ${e} name - ${e} name cannot contain '${s}'`)}}),""}function Cl(e,t=""){if(t==="")throw Error(`${e} name required`);const r=i2(t);if(r.length)throw new Error(`invalid ${e} name - ${e} name ${r}`)}function i2(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 nd(e){if(e.data.length>0)return!1;const t=e.headers;return t?t.code>=100&&t.code<200:!1}function rd(e){var t;return nd(e)&&((t=e.headers)==null?void 0:t.description)==="Idle Heartbeat"}function s2(e,t,r){const s=gi(e,t),l={hdr:1,sid:0,size:0},o=new Pd(l,cr,{});return o._headers=s,o._subject=r,o}function ha(e){if(e.data.length!==0)return null;const t=e.headers;return t?yx(t.code,t.description):null}var _r;(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"})(_r||(_r={}));function a2(e){return e.code!==ke.JetStream409?!1:[_r.MaxBatchExceeded,_r.MaxExpiresExceeded,_r.MaxBytesExceeded,_r.MaxMessageSizeExceeded,_r.PushConsumer,_r.IdleHeartbeatMissed,_r.ConsumerDeleted].find(r=>e.message.indexOf(r)!==-1)!==void 0}function yx(e,t=""){if(e<300)return null;switch(t=t.toLowerCase(),e){case 404:return new Re(t,ke.JetStream404NoMessages);case 408:return new Re(t,ke.JetStream408RequestTimeout);case 409:{const r=t.startsWith(_r.IdleHeartbeatMissed)?ke.JetStreamIdleHeartBeat:ke.JetStream409;return new Re(t,r)}case 503:return Re.errorForCode(ke.JetStreamNotEnabled,new Error(t));default:return t===""&&(t=ke.Unknown),new Re(t,`${e}`)}}class xn{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=Vt(),this.yields=[],this.iterClosed=Vt(),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 Re("unsupported iterator",ke.ApiError);if(this.yielding)throw new Re("already yielding",ke.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(o){throw o}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=Vt())}}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 Bd{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 id;(function(e){e.Limits="limits",e.Interest="interest",e.Workqueue="workqueue"})(id||(id={}));var Pl;(function(e){e.Old="old",e.New="new"})(Pl||(Pl={}));var sd;(function(e){e.File="file",e.Memory="memory"})(sd||(sd={}));var an;(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"})(an||(an={}));var bn;(function(e){e.None="none",e.All="all",e.Explicit="explicit",e.NotSet=""})(bn||(bn={}));var ba;(function(e){e.Instant="instant",e.Original="original"})(ba||(ba={}));var Ji;(function(e){e.None="none",e.S2="s2"})(Ji||(Ji={}));var Mu;(function(e){e.CreateOrUpdate="",e.Update="update",e.Create="create"})(Mu||(Mu={}));function l2(e,t={}){return Object.assign({name:e,deliver_policy:an.All,ack_policy:bn.Explicit,ack_wait:$t(30*1e3),replay_policy:ba.Instant},t)}var _0;(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"})(_0||(_0={}));var Un;(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"})(Un||(Un={}));var Tr;(function(e){e.LastValue="",e.AllHistory="history",e.UpdatesOnly="updates"})(Tr||(Tr={}));var oa;(function(e){e.Stream="Nats-Stream",e.Sequence="Nats-Sequence",e.TimeStamp="Nats-Time-Stamp",e.Subject="Nats-Subject"})(oa||(oa={}));var k0;(function(e){e.Stream="Nats-Stream",e.Subject="Nats-Subject",e.Sequence="Nats-Sequence",e.LastSequence="Nats-Last-Sequence",e.Size="Nats-Msg-Size"})(k0||(k0={}));const ar="KV_";class o2{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=l2("",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?bn.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 fa(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=an.StartSequence,this.config.opt_start_seq=t,this}startTime(t){return this.config.deliver_policy=an.StartTime,this.config.opt_start_time=t.toISOString(),this}deliverAll(){return this.config.deliver_policy=an.All,this}deliverLastPerSubject(){return this.config.deliver_policy=an.LastPerSubject,this}deliverLast(){return this.config.deliver_policy=an.Last,this}deliverNew(){return this.config.deliver_policy=an.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=bn.None,this}ackAll(){return this.config.ack_policy=bn.All,this}ackExplicit(){return this.config.ack_policy=bn.Explicit,this}ackWait(t){return this.config.ack_wait=$t(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=ba.Instant,this}replayOriginal(){return this.config.replay_policy=ba.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=$t(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=$t(t),this}maxPullBatch(t){return this.config.max_batch=t,this}maxPullRequestExpires(t){return this.config.max_expires=$t(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 Yi(e){return new o2(e)}function E0(e){return typeof e.getOpts=="function"}class u2{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 da{static encode(t){return da.toB64URLEncoding(u2.encode(t))}static decode(t,r=!1){return da.decode(da.fromB64URLEncoding(t),r)}static toB64URLEncoding(t){return t.replace(/\+/g,"-").replace(/\//g,"_")}static fromB64URLEncoding(t){return t.replace(/_/g,"/").replace(/-/g,"+")}}class xa{constructor(){C(this,"buffers");C(this,"byteLength");this.buffers=[],this.byteLength=0}static concat(...t){let r=0;for(let o=0;o<t.length;o++)r+=t[o].length;const s=new Uint8Array(r);let l=0;for(let o=0;o<t.length;o++)s.set(t[o],l),l+=t[o].length;return s}static fromAscii(t){return t||(t=""),Ki.encode(t)}static toAscii(t){return lr.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 c2(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 f2=typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{},xl=f2.performance||{};xl.now||xl.mozNow||xl.msNow||xl.oNow||xl.webkitNow;var C0={versions:{}},h2=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function d2(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 Sh,Ku={exports:{}},A0={},j0=d2(c2({__proto__:null,default:A0},[A0]));Sh=Ku,(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&&C0.versions&&C0.versions.node;l?r=h2:s&&(r=self);var o=!r.JS_SHA256_NO_COMMON_JS&&Sh.exports,c=!r.JS_SHA256_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",f="0123456789abcdef".split(""),d=[-2147483648,8388608,32768,128],m=[24,16,8,0],y=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],g=["hex","array","digest","arrayBuffer"],x=[];!r.JS_SHA256_NO_NODE_JS&&Array.isArray||(Array.isArray=function(B){return Object.prototype.toString.call(B)==="[object Array]"}),!c||!r.JS_SHA256_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(B){return typeof B=="object"&&B.buffer&&B.buffer.constructor===ArrayBuffer});var v=function(B,D){return function(Z){return new P(D,!0).update(Z)[B]()}},S=function(B){var D=v("hex",B);l&&(D=A(D,B)),D.create=function(){return new P(B)},D.update=function(V){return D.create().update(V)};for(var Z=0;Z<g.length;++Z){var $=g[Z];D[$]=v($,B)}return D},A=function(B,D){var Z,$=j0,V=j0.Buffer,L=D?"sha224":"sha256";return Z=V.from&&!r.JS_SHA256_NO_BUFFER_FROM?V.from:function(X){return new V(X)},function(X){if(typeof X=="string")return $.createHash(L).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===V?$.createHash(L).update(Z(X)).digest("hex"):B(X)}},M=function(B,D){return function(Z,$){return new I(Z,D,!0).update($)[B]()}},T=function(B){var D=M("hex",B);D.create=function(V){return new I(V,B)},D.update=function(V,L){return D.create(V).update(L)};for(var Z=0;Z<g.length;++Z){var $=g[Z];D[$]=M($,B)}return D};function P(B,D){D?(x[0]=x[16]=x[1]=x[2]=x[3]=x[4]=x[5]=x[6]=x[7]=x[8]=x[9]=x[10]=x[11]=x[12]=x[13]=x[14]=x[15]=0,this.blocks=x):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],B?(this.h0=3238371032,this.h1=914150663,this.h2=812702999,this.h3=4144912697,this.h4=4290775857,this.h5=1750603025,this.h6=1694076839,this.h7=3204075428):(this.h0=1779033703,this.h1=3144134277,this.h2=1013904242,this.h3=2773480762,this.h4=1359893119,this.h5=2600822924,this.h6=528734635,this.h7=1541459225),this.block=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0,this.is224=B}function I(B,D,Z){var $,V=typeof B;if(V==="string"){var L,X=[],G=B.length,ce=0;for($=0;$<G;++$)(L=B.charCodeAt($))<128?X[ce++]=L:L<2048?(X[ce++]=192|L>>>6,X[ce++]=128|63&L):L<55296||L>=57344?(X[ce++]=224|L>>>12,X[ce++]=128|L>>>6&63,X[ce++]=128|63&L):(L=65536+((1023&L)<<10|1023&B.charCodeAt(++$)),X[ce++]=240|L>>>18,X[ce++]=128|L>>>12&63,X[ce++]=128|L>>>6&63,X[ce++]=128|63&L);B=X}else{if(V!=="object")throw new Error(e);if(B===null)throw new Error(e);if(c&&B.constructor===ArrayBuffer)B=new Uint8Array(B);else if(!(Array.isArray(B)||c&&ArrayBuffer.isView(B)))throw new Error(e)}B.length>64&&(B=new P(D,!0).update(B).array());var oe=[],re=[];for($=0;$<64;++$){var F=B[$]||0;oe[$]=92^F,re[$]=54^F}P.call(this,D,Z),this.update(re),this.oKeyPad=oe,this.inner=!0,this.sharedMemory=Z}P.prototype.update=function(B){if(!this.finalized){var D,Z=typeof B;if(Z!=="string"){if(Z!=="object")throw new Error(e);if(B===null)throw new Error(e);if(c&&B.constructor===ArrayBuffer)B=new Uint8Array(B);else if(!(Array.isArray(B)||c&&ArrayBuffer.isView(B)))throw new Error(e);D=!0}for(var $,V,L=0,X=B.length,G=this.blocks;L<X;){if(this.hashed&&(this.hashed=!1,G[0]=this.block,this.block=G[16]=G[1]=G[2]=G[3]=G[4]=G[5]=G[6]=G[7]=G[8]=G[9]=G[10]=G[11]=G[12]=G[13]=G[14]=G[15]=0),D)for(V=this.start;L<X&&V<64;++L)G[V>>>2]|=B[L]<<m[3&V++];else for(V=this.start;L<X&&V<64;++L)($=B.charCodeAt(L))<128?G[V>>>2]|=$<<m[3&V++]:$<2048?(G[V>>>2]|=(192|$>>>6)<<m[3&V++],G[V>>>2]|=(128|63&$)<<m[3&V++]):$<55296||$>=57344?(G[V>>>2]|=(224|$>>>12)<<m[3&V++],G[V>>>2]|=(128|$>>>6&63)<<m[3&V++],G[V>>>2]|=(128|63&$)<<m[3&V++]):($=65536+((1023&$)<<10|1023&B.charCodeAt(++L)),G[V>>>2]|=(240|$>>>18)<<m[3&V++],G[V>>>2]|=(128|$>>>12&63)<<m[3&V++],G[V>>>2]|=(128|$>>>6&63)<<m[3&V++],G[V>>>2]|=(128|63&$)<<m[3&V++]);this.lastByteIndex=V,this.bytes+=V-this.start,V>=64?(this.block=G[16],this.start=V-64,this.hash(),this.hashed=!0):this.start=V}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 B=this.blocks,D=this.lastByteIndex;B[16]=this.block,B[D>>>2]|=d[3&D],this.block=B[16],D>=56&&(this.hashed||this.hash(),B[0]=this.block,B[16]=B[1]=B[2]=B[3]=B[4]=B[5]=B[6]=B[7]=B[8]=B[9]=B[10]=B[11]=B[12]=B[13]=B[14]=B[15]=0),B[14]=this.hBytes<<3|this.bytes>>>29,B[15]=this.bytes<<3,this.hash()}},P.prototype.hash=function(){var B,D,Z,$,V,L,X,G,ce,oe=this.h0,re=this.h1,F=this.h2,q=this.h3,le=this.h4,be=this.h5,O=this.h6,U=this.h7,ee=this.blocks;for(B=16;B<64;++B)D=((V=ee[B-15])>>>7|V<<25)^(V>>>18|V<<14)^V>>>3,Z=((V=ee[B-2])>>>17|V<<15)^(V>>>19|V<<13)^V>>>10,ee[B]=ee[B-16]+D+ee[B-7]+Z|0;for(ce=re&F,B=0;B<64;B+=4)this.first?(this.is224?(L=300032,U=(V=ee[0]-1413257819)-150054599|0,q=V+24177077|0):(L=704751109,U=(V=ee[0]-210244248)-1521486534|0,q=V+143694565|0),this.first=!1):(D=(oe>>>2|oe<<30)^(oe>>>13|oe<<19)^(oe>>>22|oe<<10),$=(L=oe&re)^oe&F^ce,U=q+(V=U+(Z=(le>>>6|le<<26)^(le>>>11|le<<21)^(le>>>25|le<<7))+(le&be^~le&O)+y[B]+ee[B])|0,q=V+(D+$)|0),D=(q>>>2|q<<30)^(q>>>13|q<<19)^(q>>>22|q<<10),$=(X=q&oe)^q&re^L,O=F+(V=O+(Z=(U>>>6|U<<26)^(U>>>11|U<<21)^(U>>>25|U<<7))+(U&le^~U&be)+y[B+1]+ee[B+1])|0,D=((F=V+(D+$)|0)>>>2|F<<30)^(F>>>13|F<<19)^(F>>>22|F<<10),$=(G=F&q)^F&oe^X,be=re+(V=be+(Z=(O>>>6|O<<26)^(O>>>11|O<<21)^(O>>>25|O<<7))+(O&U^~O&le)+y[B+2]+ee[B+2])|0,D=((re=V+(D+$)|0)>>>2|re<<30)^(re>>>13|re<<19)^(re>>>22|re<<10),$=(ce=re&F)^re&q^G,le=oe+(V=le+(Z=(be>>>6|be<<26)^(be>>>11|be<<21)^(be>>>25|be<<7))+(be&O^~be&U)+y[B+3]+ee[B+3])|0,oe=V+(D+$)|0,this.chromeBugWorkAround=!0;this.h0=this.h0+oe|0,this.h1=this.h1+re|0,this.h2=this.h2+F|0,this.h3=this.h3+q|0,this.h4=this.h4+le|0,this.h5=this.h5+be|0,this.h6=this.h6+O|0,this.h7=this.h7+U|0},P.prototype.hex=function(){this.finalize();var B=this.h0,D=this.h1,Z=this.h2,$=this.h3,V=this.h4,L=this.h5,X=this.h6,G=this.h7,ce=f[B>>>28&15]+f[B>>>24&15]+f[B>>>20&15]+f[B>>>16&15]+f[B>>>12&15]+f[B>>>8&15]+f[B>>>4&15]+f[15&B]+f[D>>>28&15]+f[D>>>24&15]+f[D>>>20&15]+f[D>>>16&15]+f[D>>>12&15]+f[D>>>8&15]+f[D>>>4&15]+f[15&D]+f[Z>>>28&15]+f[Z>>>24&15]+f[Z>>>20&15]+f[Z>>>16&15]+f[Z>>>12&15]+f[Z>>>8&15]+f[Z>>>4&15]+f[15&Z]+f[$>>>28&15]+f[$>>>24&15]+f[$>>>20&15]+f[$>>>16&15]+f[$>>>12&15]+f[$>>>8&15]+f[$>>>4&15]+f[15&$]+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[L>>>28&15]+f[L>>>24&15]+f[L>>>20&15]+f[L>>>16&15]+f[L>>>12&15]+f[L>>>8&15]+f[L>>>4&15]+f[15&L]+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||(ce+=f[G>>>28&15]+f[G>>>24&15]+f[G>>>20&15]+f[G>>>16&15]+f[G>>>12&15]+f[G>>>8&15]+f[G>>>4&15]+f[15&G]),ce},P.prototype.toString=P.prototype.hex,P.prototype.digest=function(){this.finalize();var B=this.h0,D=this.h1,Z=this.h2,$=this.h3,V=this.h4,L=this.h5,X=this.h6,G=this.h7,ce=[B>>>24&255,B>>>16&255,B>>>8&255,255&B,D>>>24&255,D>>>16&255,D>>>8&255,255&D,Z>>>24&255,Z>>>16&255,Z>>>8&255,255&Z,$>>>24&255,$>>>16&255,$>>>8&255,255&$,V>>>24&255,V>>>16&255,V>>>8&255,255&V,L>>>24&255,L>>>16&255,L>>>8&255,255&L,X>>>24&255,X>>>16&255,X>>>8&255,255&X];return this.is224||ce.push(G>>>24&255,G>>>16&255,G>>>8&255,255&G),ce},P.prototype.array=P.prototype.digest,P.prototype.arrayBuffer=function(){this.finalize();var B=new ArrayBuffer(this.is224?28:32),D=new DataView(B);return D.setUint32(0,this.h0),D.setUint32(4,this.h1),D.setUint32(8,this.h2),D.setUint32(12,this.h3),D.setUint32(16,this.h4),D.setUint32(20,this.h5),D.setUint32(24,this.h6),this.is224||D.setUint32(28,this.h7),B},I.prototype=new P,I.prototype.finalize=function(){if(P.prototype.finalize.call(this),this.inner){this.inner=!1;var B=this.array();P.call(this,this.is224,this.sharedMemory),this.update(this.oKeyPad),this.update(B),P.prototype.finalize.call(this)}};var W=S();W.sha256=W,W.sha224=S(!0),W.sha256.hmac=T(),W.sha224.hmac=T(!0),o?Sh.exports=W:(r.sha256=W.sha256,r.sha224=W.sha224)})();Ku.exports;Ku.exports.sha224;var N0=Ku.exports.sha256;function ad(e){return x2(e)}function m2(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 p2(e){return/^[A-Za-z0-9\-_]*(={0,2})?$/.test(e)||/^[A-Za-z0-9+/]*(={0,2})?$/.test(e)}function g2(e){return m2(e)?"hex":p2(e)?"b64":""}function y2(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 b2(e){e=e.replace(/-/g,"+"),e=e.replace(/_/g,"/");const t=atob(e);return Uint8Array.from(t,r=>r.charCodeAt(0))}function x2(e){switch(g2(e)){case"hex":return y2(e);case"b64":return b2(e)}return null}function v2(e,t){const r=typeof e=="string"?ad(e):e,s=typeof t=="string"?ad(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 bx{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=Gi.next(),s&&(this.ctx=new Error)}}class w2 extends bx{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=Vt(),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
67
 
68
- ${this.ctx.stack}`),this.cancel(r)):(this.callback(null,s),this.opts.strategy===Rr.Count&&(this.max--,this.max===0&&this.cancel()),this.opts.strategy===Rr.JitterTimer&&(clearTimeout(this.timer),this.timer=setTimeout(()=>{this.cancel()},this.opts.jitter||300)),this.opts.strategy===Rr.SentinelMsg&&s&&s.data.length===0&&this.cancel())}}class wx extends vx{constructor(r,s,l={timeout:1e3},u=!0){super(r,s,u);C(this,"deferred");C(this,"timer");this.deferred=Vt(),this.timer=ya(l.timeout,u)}resolver(r,s){this.timer&&this.timer.cancel(),r?(this.ctx&&(r.stack+=`
68
+ ${this.ctx.stack}`),this.cancel(r)):(this.callback(null,s),this.opts.strategy===Rr.Count&&(this.max--,this.max===0&&this.cancel()),this.opts.strategy===Rr.JitterTimer&&(clearTimeout(this.timer),this.timer=setTimeout(()=>{this.cancel()},this.opts.jitter||300)),this.opts.strategy===Rr.SentinelMsg&&s&&s.data.length===0&&this.cancel())}}class xx extends bx{constructor(r,s,l={timeout:1e3},o=!0){super(r,s,o);C(this,"deferred");C(this,"timer");this.deferred=Vt(),this.timer=ya(l.timeout,o)}resolver(r,s){this.timer&&this.timer.cancel(),r?(this.ctx&&(r.stack+=`
69
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||Re.errorForCode(ke.Cancelled))}}const v2="$JS.API";function w2(e){return e=e||{},e.domain&&(e.apiPrefix=`$JS.${e.domain}.API`,delete e.domain),Ju({apiPrefix:v2,timeout:5e3},e)}class Yl{constructor(t,r){C(this,"nc");C(this,"opts");C(this,"prefix");C(this,"timeout");C(this,"jc");this.nc=t,this.opts=w2(r),this._parseOpts(),this.prefix=this.opts.apiPrefix,this.timeout=this.opts.timeout,this.jc=Mr()}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=ur;r&&(l=this.jc.encode(r));let{retries:u}=s;u=u||1,u=u===-1?Number.MAX_SAFE_INTEGER:u;const c=zd();for(let f=0;f<u;f++)try{const d=await this.nc.request(t,l,s);return this.parseJsResponse(d)}catch(d){const m=d;if((m.code==="503"||m.code===ke.Timeout)&&f+1<u)await Ea(c.backoff(f));else throw d}}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=xx(s.error.code,s.error.description);if(l!==null)throw l.api_error=s.error,l}return r}}class Al{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 bs(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 ld(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 pt;(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"})(pt||(pt={}));class S2{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=bs(t)),this.server=t,this.set(pt.JS_KV,"2.6.2"),this.set(pt.JS_OBJECTSTORE,"2.6.3"),this.set(pt.JS_PULL_MAX_BYTES,"2.8.3"),this.set(pt.JS_NEW_CONSUMER_CREATE_API,"2.9.0"),this.set(pt.JS_ALLOW_DIRECT,"2.9.0"),this.set(pt.JS_MULTIPLE_CONSUMER_FILTER,"2.10.0"),this.set(pt.JS_SIMPLIFICATION,"2.9.4"),this.set(pt.JS_STREAM_CONSUMER_METADATA,"2.10.0"),this.set(pt.JS_CONSUMER_FILTER_SUBJECTS,"2.10.0"),this.set(pt.JS_STREAM_FIRST_SEQ,"2.10.0"),this.set(pt.JS_STREAM_SUBJECT_TRANSFORM,"2.10.0"),this.set(pt.JS_STREAM_SOURCE_SUBJECT_TRANSFORM,"2.10.0"),this.set(pt.JS_STREAM_COMPRESSION,"2.10.0"),this.set(pt.JS_DEFAULT_CONSUMER_LIMITS,"2.10.0"),this.set(pt.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:ld(this.server,bs(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=bs(t)),ld(this.server,t)>=0}}class Du extends Yl{constructor(t,r){super(t,r)}async add(t,r,s=Mu.Create){if(Mn(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&&fa(l.config.durable_name);const u=this.nc;let{min:c,ok:f}=u.features.get(pt.JS_NEW_CONSUMER_CREATE_API);const d=r.name===""?void 0:r.name;if(d&&!f)throw new Error(`consumer 'name' requires server ${c}`);if(d)try{Xu("name",d)}catch(x){const v=x.message,S=v.indexOf("cannot contain");throw S!==-1?new Error(`consumer 'name' ${v.substring(S)}`):x}let m,y="";if(Array.isArray(r.filter_subjects)){const{min:x,ok:v}=u.features.get(pt.JS_MULTIPLE_CONSUMER_FILTER);if(!v)throw new Error(`consumer 'filter_subjects' requires server ${x}`);f=!1}if(r.metadata){const{min:x,ok:v}=u.features.get(pt.JS_STREAM_CONSUMER_METADATA);if(!v)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),m=x!==void 0?`${this.prefix}.CONSUMER.CREATE.${t}.${y}.${x}`:`${this.prefix}.CONSUMER.CREATE.${t}.${y}`}else m=r.durable_name?`${this.prefix}.CONSUMER.DURABLE.CREATE.${t}.${r.durable_name}`:`${this.prefix}.CONSUMER.CREATE.${t}`;return await this._request(m,l)}async update(t,r,s){const l=await this.info(t,r),u=s;return this.add(t,Object.assign(l.config,u),Mu.Update)}async info(t,r){return Mn(t),fa(r),await this._request(`${this.prefix}.CONSUMER.INFO.${t}.${r}`)}async delete(t,r){return Mn(t),fa(r),(await this._request(`${this.prefix}.CONSUMER.DELETE.${t}.${r}`)).success}list(t){Mn(t);const r=l=>l.consumers,s=`${this.prefix}.CONSUMER.LIST.${t}`;return new Al(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 ra(e,t,r=!1){if(r===!0&&!e)throw Re.errorForCode(ke.ApiError,new Error(`${t} is not a function`));if(e&&typeof e!="function")throw Re.errorForCode(ke.ApiError,new Error(`${t} is not a function`))}class _2 extends xn{constructor(r,s,l){super();C(this,"sub");C(this,"adapter");C(this,"subIterDone");ra(l.adapter,"adapter",!0),this.adapter=l.adapter,l.callback&&ra(l.callback,"callback"),this.noIterator=typeof l.callback=="function",l.ingestionFilterFn&&(ra(l.ingestionFilterFn,"ingestionFilterFn"),this.ingestionFilterFn=l.ingestionFilterFn),l.protocolFilterFn&&(ra(l.protocolFilterFn,"protocolFilterFn"),this.protocolFilterFn=l.protocolFilterFn),l.dispatchedFn&&(ra(l.dispatchedFn,"dispatchedFn"),this.dispatchedFn=l.dispatchedFn),l.cleanupFn&&ra(l.cleanupFn,"cleanupFn");let u=(y,g)=>{this.callback(y,g)};if(l.callback){const y=l.callback;u=(g,x)=>{const[v,S]=this.adapter(g,x);if(v){y(v,null);return}const{ingest:j}=this.ingestionFilterFn?this.ingestionFilterFn(S,this):{ingest:!0};j&&(!this.protocolFilterFn||this.protocolFilterFn(S))&&(y(v,S),this.dispatchedFn&&S&&this.dispatchedFn(S))}}const{max:c,queue:f,timeout:d}=l,m={queue:f,timeout:d,callback:u};c&&c>0&&(m.max=c),this.sub=r.subscribe(s,m),l.cleanupFn&&(this.sub.cleanupFn=l.cleanupFn),this.noIterator||this.iterClosed.then(()=>{this.unsubscribe()}),this.subIterDone=Vt(),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 lr;function k2(e){lr=e}function Sx(){return lr!==void 0&&lr.defaultPort!==void 0?lr.defaultPort:4222}function _h(){return lr!==void 0&&lr.urlParseFn?lr.urlParseFn:void 0}function E2(){if(!lr||typeof lr.factory!="function")throw new Error("transport fn is not set");return lr.factory()}function od(){return lr!==void 0&&lr.dnsResolveFn?lr.dnsResolveFn:void 0}const ku=`\r
71
- `,Lu=xa.fromAscii(ku),C2=new Uint8Array(Lu)[0],A2=new Uint8Array(Lu)[1];function j2(e){for(let t=0;t<e.length;t++){const r=t+1;if(e.byteLength>r&&e[t]===C2&&e[r]===A2)return r+1}return 0}function N2(e){const t=j2(e);if(t>0){const s=new Uint8Array(e).slice(0,t);return ar.decode(s)}return""}const T2=4,_x=48,O2=65,R2=97;function M2(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 ud(e){return D2(e)!==void 0}function D2(e){for(let t=0;t<e.length;t++)switch(e[t]){case".":return kx(e);case":":return L2(e)}}function kx(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}=z2(e);if(!u||s>255)return;e=e.substring(l),t[r]=s}return M2(t[0],t[1],t[2],t[3])}function L2(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}=U2(e);if(!c||l>65535)return;if(u<e.length&&e[u]==="."){if(r<0&&s!=12||s+4>16)return;const f=kx(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+=T2;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 z2(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)-_x),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 U2(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)-_x;else if(97<=e.charCodeAt(r)&&e.charCodeAt(r)<=102)t*=16,t+=e.charCodeAt(r)-R2+10;else if(65<=e.charCodeAt(r)&&e.charCodeAt(r)<=70)t*=16,t+=e.charCodeAt(r)-O2+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 P2(e){return e.indexOf("[")!==-1||e.indexOf("::")!==-1?!1:e.indexOf(".")!==-1||e.split(":").length<=2}function cd(e){return!P2(e)}function B2(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 H2(e){e=e.trim(),e.match(/^(.*:\/\/)(.*)/m)&&(e=e.replace(/^(.*:\/\/)(.*)/gm,"$2")),e=B2(e),cd(e)&&e.indexOf("[")===-1&&(e=`[${e}]`);const t=cd(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 Tl{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=H2(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(ud(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}://${cd(l)?"["+l+"]":l}`);c.port=`${this.port}`;const f=new Tl(c.host,!1);f.tlsName=this.hostname,r.push(f)}}return t.randomize&&yx(r),this.resolves=r,r}}class q2{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=_h();t&&(t.forEach(l=>{l=s?s(l):l,this.servers.push(new Tl(l))}),this.randomize&&(this.servers=yx(this.servers))),this.servers.length===0&&this.addServer(`${td}:${Sx()}`,!1),this.currentServer=this.servers[0]}clear(){this.servers.length=0}updateTLSName(){const t=this.getCurrentServer();ud(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=_h();t=s?s(t):t;const l=new Tl(t,r);ud(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=_h(),c=new Map;t.connect_urls&&t.connect_urls.length>0&&t.connect_urls.forEach(d=>{d=u?u(d,r):d;const m=new Tl(d,!0);c.set(d,m)});const f=[];return this.servers.forEach((d,m)=>{const y=d.listen;d.gossiped&&this.currentServer.listen!==y&&c.get(y)===void 0&&f.push(m),c.delete(y)}),f.reverse(),f.forEach(d=>{const m=this.servers.splice(d,1);l=l.concat(m[0].listen)}),c.forEach((d,m)=>{this.servers.push(d),s.push(m)}),{added:s,deleted:l}}}class I2{constructor(){C(this,"baseInbox");C(this,"reqs");this.reqs=new Map}size(){return this.reqs.size}init(t){return this.baseInbox=`${mi(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=bx(r)),l.resolver(t,r))}}}close(){const t=Re.errorForCode(ke.Timeout);this.reqs.forEach(r=>{r.resolver(t,{})})}}class F2{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:ca.PingTimer,data:`${this.pendings.length+1}`}),this.pendings.length===this.maxOut){this.cancel(!0);return}const t=Vt();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 $2 extends Error{constructor(t){super(t),this.name="AssertionError"}}function V2(e,t="Assertion failed."){if(!e)throw new $2(t)}const N0=32*1024,kh=2**32-2;function hu(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 Eh{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){V2(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=hu(this._buf.subarray(this._off),t);return this._off+=r,r}writeByte(t){return this.write(Uint8Array.of(t))}writeString(t){return this.write(Ki.encode(t))}write(t){const r=this._grow(t.byteLength);return hu(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)hu(this._buf.subarray(this._off),this._buf);else{if(l+t>kh)throw new Error("The buffer cannot be grown beyond the maximum size.");{const u=new Uint8Array(Math.min(2*l+t,kh));hu(this._buf.subarray(this._off),u),this._buf=u}}return this._off=0,this._reslice(Math.min(r+t,kh)),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(N0);for(;;){const l=this.capacity-this.length<N0,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 Dn;(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"})(Dn||(Dn={}));function T0(){const e={};return e.sid=-1,e.hdr=-1,e.size=-1,e}const Y2=48;class O0{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=je.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 je.OP_START:switch(s){case Ne.M:case Ne.m:this.state=je.OP_M,this.hdr=-1,this.ma=T0();break;case Ne.H:case Ne.h:this.state=je.OP_H,this.hdr=0,this.ma=T0();break;case Ne.P:case Ne.p:this.state=je.OP_P;break;case Ne.PLUS:this.state=je.OP_PLUS;break;case Ne.MINUS:this.state=je.OP_MINUS;break;case Ne.I:case Ne.i:this.state=je.OP_I;break;default:throw this.fail(t.subarray(r))}break;case je.OP_H:switch(s){case Ne.M:case Ne.m:this.state=je.OP_M;break;default:throw this.fail(t.subarray(r))}break;case je.OP_M:switch(s){case Ne.S:case Ne.s:this.state=je.OP_MS;break;default:throw this.fail(t.subarray(r))}break;case je.OP_MS:switch(s){case Ne.G:case Ne.g:this.state=je.OP_MSG;break;default:throw this.fail(t.subarray(r))}break;case je.OP_MSG:switch(s){case Ne.SPACE:case Ne.TAB:this.state=je.OP_MSG_SPC;break;default:throw this.fail(t.subarray(r))}break;case je.OP_MSG_SPC:switch(s){case Ne.SPACE:case Ne.TAB:continue;default:this.state=je.MSG_ARG,this.as=r}break;case je.MSG_ARG:switch(s){case Ne.CR:this.drop=1;break;case Ne.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=je.MSG_PAYLOAD,r=this.as+this.ma.size-1;break}default:this.argBuf&&this.argBuf.writeByte(s)}break;case je.MSG_PAYLOAD:if(this.msgBuf)if(this.msgBuf.length>=this.ma.size){const l=this.msgBuf.bytes({copy:!1});this.dispatcher.push({kind:Dn.MSG,msg:this.ma,data:l}),this.argBuf=void 0,this.msgBuf=void 0,this.state=je.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:Dn.MSG,msg:this.ma,data:t.subarray(this.as,r)}),this.argBuf=void 0,this.msgBuf=void 0,this.state=je.MSG_END);break;case je.MSG_END:switch(s){case Ne.NL:this.drop=0,this.as=r+1,this.state=je.OP_START;break;default:continue}break;case je.OP_PLUS:switch(s){case Ne.O:case Ne.o:this.state=je.OP_PLUS_O;break;default:throw this.fail(t.subarray(r))}break;case je.OP_PLUS_O:switch(s){case Ne.K:case Ne.k:this.state=je.OP_PLUS_OK;break;default:throw this.fail(t.subarray(r))}break;case je.OP_PLUS_OK:switch(s){case Ne.NL:this.dispatcher.push({kind:Dn.OK}),this.drop=0,this.state=je.OP_START;break}break;case je.OP_MINUS:switch(s){case Ne.E:case Ne.e:this.state=je.OP_MINUS_E;break;default:throw this.fail(t.subarray(r))}break;case je.OP_MINUS_E:switch(s){case Ne.R:case Ne.r:this.state=je.OP_MINUS_ER;break;default:throw this.fail(t.subarray(r))}break;case je.OP_MINUS_ER:switch(s){case Ne.R:case Ne.r:this.state=je.OP_MINUS_ERR;break;default:throw this.fail(t.subarray(r))}break;case je.OP_MINUS_ERR:switch(s){case Ne.SPACE:case Ne.TAB:this.state=je.OP_MINUS_ERR_SPC;break;default:throw this.fail(t.subarray(r))}break;case je.OP_MINUS_ERR_SPC:switch(s){case Ne.SPACE:case Ne.TAB:continue;default:this.state=je.MINUS_ERR_ARG,this.as=r}break;case je.MINUS_ERR_ARG:switch(s){case Ne.CR:this.drop=1;break;case Ne.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:Dn.ERR,data:l}),this.drop=0,this.as=r+1,this.state=je.OP_START;break}default:this.argBuf&&this.argBuf.write(Uint8Array.of(s))}break;case je.OP_P:switch(s){case Ne.I:case Ne.i:this.state=je.OP_PI;break;case Ne.O:case Ne.o:this.state=je.OP_PO;break;default:throw this.fail(t.subarray(r))}break;case je.OP_PO:switch(s){case Ne.N:case Ne.n:this.state=je.OP_PON;break;default:throw this.fail(t.subarray(r))}break;case je.OP_PON:switch(s){case Ne.G:case Ne.g:this.state=je.OP_PONG;break;default:throw this.fail(t.subarray(r))}break;case je.OP_PONG:switch(s){case Ne.NL:this.dispatcher.push({kind:Dn.PONG}),this.drop=0,this.state=je.OP_START;break}break;case je.OP_PI:switch(s){case Ne.N:case Ne.n:this.state=je.OP_PIN;break;default:throw this.fail(t.subarray(r))}break;case je.OP_PIN:switch(s){case Ne.G:case Ne.g:this.state=je.OP_PING;break;default:throw this.fail(t.subarray(r))}break;case je.OP_PING:switch(s){case Ne.NL:this.dispatcher.push({kind:Dn.PING}),this.drop=0,this.state=je.OP_START;break}break;case je.OP_I:switch(s){case Ne.N:case Ne.n:this.state=je.OP_IN;break;default:throw this.fail(t.subarray(r))}break;case je.OP_IN:switch(s){case Ne.F:case Ne.f:this.state=je.OP_INF;break;default:throw this.fail(t.subarray(r))}break;case je.OP_INF:switch(s){case Ne.O:case Ne.o:this.state=je.OP_INFO;break;default:throw this.fail(t.subarray(r))}break;case je.OP_INFO:switch(s){case Ne.SPACE:case Ne.TAB:this.state=je.OP_INFO_SPC;break;default:throw this.fail(t.subarray(r))}break;case je.OP_INFO_SPC:switch(s){case Ne.SPACE:case Ne.TAB:continue;default:this.state=je.INFO_ARG,this.as=r}break;case je.INFO_ARG:switch(s){case Ne.CR:this.drop=1;break;case Ne.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:Dn.INFO,data:l}),this.drop=0,this.as=r+1,this.state=je.OP_START;break}default:this.argBuf&&this.argBuf.writeByte(s)}break;default:throw this.fail(t.subarray(r))}}(this.state===je.MSG_ARG||this.state===je.MINUS_ERR_ARG||this.state===je.INFO_ARG)&&!this.argBuf&&(this.argBuf=new Eh(t.subarray(this.as,r-this.drop))),this.state===je.MSG_PAYLOAD&&!this.msgBuf&&(this.argBuf||this.cloneMsgArg(),this.msgBuf=new Eh(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 Eh(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 Ne.SPACE:case Ne.TAB:case Ne.CR:case Ne.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}: ${ar.decode(t)}`)}processHeaderMsgArgs(t){const r=[];let s=-1;for(let l=0;l<t.length;l++)switch(t[l]){case Ne.SPACE:case Ne.TAB:case Ne.CR:case Ne.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]-Y2)}return r}}var je;(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"})(je||(je={}));var Ne;(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"})(Ne||(Ne={}));(function(e){var t=function(E,O){this.hi=E|0,this.lo=O|0},r=function(E){var O,N=new Float64Array(16);if(E)for(O=0;O<E.length;O++)N[O]=E[O];return N},s=function(){throw new Error("no PRNG")},l=new Uint8Array(16),u=new Uint8Array(32);u[0]=9;var c=r(),f=r([1]),d=r([56129,1]),m=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]),v=r([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function S(E,O){return E<<O|E>>>32-O}function j(E,O){var N=E[O+3]&255;return N=N<<8|E[O+2]&255,N=N<<8|E[O+1]&255,N<<8|E[O+0]&255}function D(E,O){var N=E[O]<<24|E[O+1]<<16|E[O+2]<<8|E[O+3],z=E[O+4]<<24|E[O+5]<<16|E[O+6]<<8|E[O+7];return new t(N,z)}function T(E,O,N){var z;for(z=0;z<4;z++)E[O+z]=N&255,N>>>=8}function P(E,O,N){E[O]=N.hi>>24&255,E[O+1]=N.hi>>16&255,E[O+2]=N.hi>>8&255,E[O+3]=N.hi&255,E[O+4]=N.lo>>24&255,E[O+5]=N.lo>>16&255,E[O+6]=N.lo>>8&255,E[O+7]=N.lo&255}function I(E,O,N,z,Y){var Q,me=0;for(Q=0;Q<Y;Q++)me|=E[O+Q]^N[z+Q];return(1&me-1>>>8)-1}function W(E,O,N,z){return I(E,O,N,z,16)}function B(E,O,N,z){return I(E,O,N,z,32)}function R(E,O,N,z,Y){var Q=new Uint32Array(16),me=new Uint32Array(16),ye=new Uint32Array(16),se=new Uint32Array(4),de,Me,tt;for(de=0;de<4;de++)me[5*de]=j(z,4*de),me[1+de]=j(N,4*de),me[6+de]=j(O,4*de),me[11+de]=j(N,16+4*de);for(de=0;de<16;de++)ye[de]=me[de];for(de=0;de<20;de++){for(Me=0;Me<4;Me++){for(tt=0;tt<4;tt++)se[tt]=me[(5*Me+4*tt)%16];for(se[1]^=S(se[0]+se[3]|0,7),se[2]^=S(se[1]+se[0]|0,9),se[3]^=S(se[2]+se[1]|0,13),se[0]^=S(se[3]+se[2]|0,18),tt=0;tt<4;tt++)Q[4*Me+(Me+tt)%4]=se[tt]}for(tt=0;tt<16;tt++)me[tt]=Q[tt]}if(Y){for(de=0;de<16;de++)me[de]=me[de]+ye[de]|0;for(de=0;de<4;de++)me[5*de]=me[5*de]-j(z,4*de)|0,me[6+de]=me[6+de]-j(O,4*de)|0;for(de=0;de<4;de++)T(E,4*de,me[5*de]),T(E,16+4*de,me[6+de])}else for(de=0;de<16;de++)T(E,4*de,me[de]+ye[de]|0)}function Z(E,O,N,z){return R(E,O,N,z,!1),0}function F(E,O,N,z){return R(E,O,N,z,!0),0}var V=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function L(E,O,N,z,Y,Q,me){var ye=new Uint8Array(16),se=new Uint8Array(64),de,Me;if(!Y)return 0;for(Me=0;Me<16;Me++)ye[Me]=0;for(Me=0;Me<8;Me++)ye[Me]=Q[Me];for(;Y>=64;){for(Z(se,ye,me,V),Me=0;Me<64;Me++)E[O+Me]=(N?N[z+Me]:0)^se[Me];for(de=1,Me=8;Me<16;Me++)de=de+(ye[Me]&255)|0,ye[Me]=de&255,de>>>=8;Y-=64,O+=64,N&&(z+=64)}if(Y>0)for(Z(se,ye,me,V),Me=0;Me<Y;Me++)E[O+Me]=(N?N[z+Me]:0)^se[Me];return 0}function X(E,O,N,z,Y){return L(E,O,null,0,N,z,Y)}function G(E,O,N,z,Y){var Q=new Uint8Array(32);return F(Q,z,Y,V),X(E,O,N,z.subarray(16),Q)}function ue(E,O,N,z,Y,Q,me){var ye=new Uint8Array(32);return F(ye,Q,me,V),L(E,O,N,z,Y,Q.subarray(16),ye)}function le(E,O){var N,z=0;for(N=0;N<17;N++)z=z+(E[N]+O[N]|0)|0,E[N]=z&255,z>>>=8}var re=new Uint32Array([5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,252]);function $(E,O,N,z,Y,Q){var me,ye,se,de,Me=new Uint32Array(17),tt=new Uint32Array(17),Pt=new Uint32Array(17),En=new Uint32Array(17),Cr=new Uint32Array(17);for(se=0;se<17;se++)tt[se]=Pt[se]=0;for(se=0;se<16;se++)tt[se]=Q[se];for(tt[3]&=15,tt[4]&=252,tt[7]&=15,tt[8]&=252,tt[11]&=15,tt[12]&=252,tt[15]&=15;Y>0;){for(se=0;se<17;se++)En[se]=0;for(se=0;se<16&&se<Y;++se)En[se]=N[z+se];for(En[se]=1,z+=se,Y-=se,le(Pt,En),ye=0;ye<17;ye++)for(Me[ye]=0,se=0;se<17;se++)Me[ye]=Me[ye]+Pt[se]*(se<=ye?tt[ye-se]:320*tt[ye+17-se]|0)|0|0;for(ye=0;ye<17;ye++)Pt[ye]=Me[ye];for(de=0,se=0;se<16;se++)de=de+Pt[se]|0,Pt[se]=de&255,de>>>=8;for(de=de+Pt[16]|0,Pt[16]=de&3,de=5*(de>>>2)|0,se=0;se<16;se++)de=de+Pt[se]|0,Pt[se]=de&255,de>>>=8;de=de+Pt[16]|0,Pt[16]=de}for(se=0;se<17;se++)Cr[se]=Pt[se];for(le(Pt,re),me=-(Pt[16]>>>7)|0,se=0;se<17;se++)Pt[se]^=me&(Cr[se]^Pt[se]);for(se=0;se<16;se++)En[se]=Q[se+16];for(En[16]=0,le(Pt,En),se=0;se<16;se++)E[O+se]=Pt[se];return 0}function q(E,O,N,z,Y,Q){var me=new Uint8Array(16);return $(me,0,N,z,Y,Q),W(E,O,me,0)}function ae(E,O,N,z,Y){var Q;if(N<32)return-1;for(ue(E,0,O,0,N,z,Y),$(E,16,E,32,N-32,E),Q=0;Q<16;Q++)E[Q]=0;return 0}function be(E,O,N,z,Y){var Q,me=new Uint8Array(32);if(N<32||(G(me,0,32,z,Y),q(O,16,O,32,N-32,me)!==0))return-1;for(ue(E,0,O,0,N,z,Y),Q=0;Q<32;Q++)E[Q]=0;return 0}function M(E,O){var N;for(N=0;N<16;N++)E[N]=O[N]|0}function U(E){var O,N;for(N=0;N<16;N++)E[N]+=65536,O=Math.floor(E[N]/65536),E[(N+1)*(N<15?1:0)]+=O-1+37*(O-1)*(N===15?1:0),E[N]-=O*65536}function ee(E,O,N){for(var z,Y=~(N-1),Q=0;Q<16;Q++)z=Y&(E[Q]^O[Q]),E[Q]^=z,O[Q]^=z}function _(E,O){var N,z,Y,Q=r(),me=r();for(N=0;N<16;N++)me[N]=O[N];for(U(me),U(me),U(me),z=0;z<2;z++){for(Q[0]=me[0]-65517,N=1;N<15;N++)Q[N]=me[N]-65535-(Q[N-1]>>16&1),Q[N-1]&=65535;Q[15]=me[15]-32767-(Q[14]>>16&1),Y=Q[15]>>16&1,Q[14]&=65535,ee(me,Q,1-Y)}for(N=0;N<16;N++)E[2*N]=me[N]&255,E[2*N+1]=me[N]>>8}function ge(E,O){var N=new Uint8Array(32),z=new Uint8Array(32);return _(N,E),_(z,O),B(N,0,z,0)}function Ce(E){var O=new Uint8Array(32);return _(O,E),O[0]&1}function we(E,O){var N;for(N=0;N<16;N++)E[N]=O[2*N]+(O[2*N+1]<<8);E[15]&=32767}function Te(E,O,N){var z;for(z=0;z<16;z++)E[z]=O[z]+N[z]|0}function Ve(E,O,N){var z;for(z=0;z<16;z++)E[z]=O[z]-N[z]|0}function Ae(E,O,N){var z,Y,Q=new Float64Array(31);for(z=0;z<31;z++)Q[z]=0;for(z=0;z<16;z++)for(Y=0;Y<16;Y++)Q[z+Y]+=O[z]*N[Y];for(z=0;z<15;z++)Q[z]+=38*Q[z+16];for(z=0;z<16;z++)E[z]=Q[z];U(E),U(E)}function dt(E,O){Ae(E,O,O)}function qt(E,O){var N=r(),z;for(z=0;z<16;z++)N[z]=O[z];for(z=253;z>=0;z--)dt(N,N),z!==2&&z!==4&&Ae(N,N,O);for(z=0;z<16;z++)E[z]=N[z]}function ln(E,O){var N=r(),z;for(z=0;z<16;z++)N[z]=O[z];for(z=250;z>=0;z--)dt(N,N),z!==1&&Ae(N,N,O);for(z=0;z<16;z++)E[z]=N[z]}function tn(E,O,N){var z=new Uint8Array(32),Y=new Float64Array(80),Q,me,ye=r(),se=r(),de=r(),Me=r(),tt=r(),Pt=r();for(me=0;me<31;me++)z[me]=O[me];for(z[31]=O[31]&127|64,z[0]&=248,we(Y,N),me=0;me<16;me++)se[me]=Y[me],Me[me]=ye[me]=de[me]=0;for(ye[0]=Me[0]=1,me=254;me>=0;--me)Q=z[me>>>3]>>>(me&7)&1,ee(ye,se,Q),ee(de,Me,Q),Te(tt,ye,de),Ve(ye,ye,de),Te(de,se,Me),Ve(se,se,Me),dt(Me,tt),dt(Pt,ye),Ae(ye,de,ye),Ae(de,se,tt),Te(tt,ye,de),Ve(ye,ye,de),dt(se,ye),Ve(de,Me,Pt),Ae(ye,de,d),Te(ye,ye,Me),Ae(de,de,ye),Ae(ye,Me,Pt),Ae(Me,se,Y),dt(se,tt),ee(ye,se,Q),ee(de,Me,Q);for(me=0;me<16;me++)Y[me+16]=ye[me],Y[me+32]=de[me],Y[me+48]=se[me],Y[me+64]=Me[me];var En=Y.subarray(32),Cr=Y.subarray(16);return qt(En,En),Ae(Cr,Cr,En),_(E,Cr),0}function Gt(E,O){return tn(E,O,u)}function on(E,O){return s(O,32),Gt(E,O)}function Rt(E,O,N){var z=new Uint8Array(32);return tn(z,N,O),F(E,l,z,V)}var Kt=ae,Pe=be;function ct(E,O,N,z,Y,Q){var me=new Uint8Array(32);return Rt(me,Y,Q),Kt(E,O,N,z,me)}function Ke(E,O,N,z,Y,Q){var me=new Uint8Array(32);return Rt(me,Y,Q),Pe(E,O,N,z,me)}function bt(){var E=0,O=0,N=0,z=0,Y=65535,Q,me,ye;for(ye=0;ye<arguments.length;ye++)Q=arguments[ye].lo,me=arguments[ye].hi,E+=Q&Y,O+=Q>>>16,N+=me&Y,z+=me>>>16;return O+=E>>>16,N+=O>>>16,z+=N>>>16,new t(N&Y|z<<16,E&Y|O<<16)}function zt(E,O){return new t(E.hi>>>O,E.lo>>>O|E.hi<<32-O)}function Pn(){var E=0,O=0,N;for(N=0;N<arguments.length;N++)E^=arguments[N].lo,O^=arguments[N].hi;return new t(O,E)}function $e(E,O){var N,z,Y=32-O;return O<32?(N=E.hi>>>O|E.lo<<Y,z=E.lo>>>O|E.hi<<Y):O<64&&(N=E.lo>>>O|E.hi<<Y,z=E.hi>>>O|E.lo<<Y),new t(N,z)}function Tn(E,O,N){var z=E.hi&O.hi^~E.hi&N.hi,Y=E.lo&O.lo^~E.lo&N.lo;return new t(z,Y)}function ce(E,O,N){var z=E.hi&O.hi^E.hi&N.hi^O.hi&N.hi,Y=E.lo&O.lo^E.lo&N.lo^O.lo&N.lo;return new t(z,Y)}function _e(E){return Pn($e(E,28),$e(E,34),$e(E,39))}function Le(E){return Pn($e(E,14),$e(E,18),$e(E,41))}function Ge(E){return Pn($e(E,1),$e(E,8),zt(E,7))}function et(E){return Pn($e(E,19),$e(E,61),zt(E,6))}var un=[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 vn(E,O,N){var z=[],Y=[],Q=[],me=[],ye,se,de;for(se=0;se<8;se++)z[se]=Q[se]=D(E,8*se);for(var Me=0;N>=128;){for(se=0;se<16;se++)me[se]=D(O,8*se+Me);for(se=0;se<80;se++){for(de=0;de<8;de++)Y[de]=Q[de];for(ye=bt(Q[7],Le(Q[4]),Tn(Q[4],Q[5],Q[6]),un[se],me[se%16]),Y[7]=bt(ye,_e(Q[0]),ce(Q[0],Q[1],Q[2])),Y[3]=bt(Y[3],ye),de=0;de<8;de++)Q[(de+1)%8]=Y[de];if(se%16===15)for(de=0;de<16;de++)me[de]=bt(me[de],me[(de+9)%16],Ge(me[(de+1)%16]),et(me[(de+14)%16]))}for(se=0;se<8;se++)Q[se]=bt(Q[se],z[se]),z[se]=Q[se];Me+=128,N-=128}for(se=0;se<8;se++)P(E,8*se,z[se]);return N}var Ct=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 xt(E,O,N){var z=new Uint8Array(64),Y=new Uint8Array(256),Q,me=N;for(Q=0;Q<64;Q++)z[Q]=Ct[Q];for(vn(z,O,N),N%=128,Q=0;Q<256;Q++)Y[Q]=0;for(Q=0;Q<N;Q++)Y[Q]=O[me-N+Q];for(Y[N]=128,N=256-128*(N<112?1:0),Y[N-9]=0,P(Y,N-8,new t(me/536870912|0,me<<3)),vn(z,Y,N),Q=0;Q<64;Q++)E[Q]=z[Q];return 0}function Jt(E,O){var N=r(),z=r(),Y=r(),Q=r(),me=r(),ye=r(),se=r(),de=r(),Me=r();Ve(N,E[1],E[0]),Ve(Me,O[1],O[0]),Ae(N,N,Me),Te(z,E[0],E[1]),Te(Me,O[0],O[1]),Ae(z,z,Me),Ae(Y,E[3],O[3]),Ae(Y,Y,y),Ae(Q,E[2],O[2]),Te(Q,Q,Q),Ve(me,z,N),Ve(ye,Q,Y),Te(se,Q,Y),Te(de,z,N),Ae(E[0],me,ye),Ae(E[1],de,se),Ae(E[2],se,ye),Ae(E[3],me,de)}function nt(E,O,N){var z;for(z=0;z<4;z++)ee(E[z],O[z],N)}function ve(E,O){var N=r(),z=r(),Y=r();qt(Y,O[2]),Ae(N,O[0],Y),Ae(z,O[1],Y),_(E,z),E[31]^=Ce(N)<<7}function Be(E,O,N){var z,Y;for(M(E[0],c),M(E[1],f),M(E[2],f),M(E[3],c),Y=255;Y>=0;--Y)z=N[Y/8|0]>>(Y&7)&1,nt(E,O,z),Jt(O,E),Jt(E,E),nt(E,O,z)}function Oe(E,O){var N=[r(),r(),r(),r()];M(N[0],g),M(N[1],x),M(N[2],f),Ae(N[3],g,x),Be(E,N,O)}function _t(E,O,N){var z=new Uint8Array(64),Y=[r(),r(),r(),r()],Q;for(N||s(O,32),xt(z,O,32),z[0]&=248,z[31]&=127,z[31]|=64,Oe(Y,z),ve(E,Y),Q=0;Q<32;Q++)O[Q+32]=E[Q];return 0}var Qt=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 On(E,O){var N,z,Y,Q;for(z=63;z>=32;--z){for(N=0,Y=z-32,Q=z-12;Y<Q;++Y)O[Y]+=N-16*O[z]*Qt[Y-(z-32)],N=Math.floor((O[Y]+128)/256),O[Y]-=N*256;O[Y]+=N,O[z]=0}for(N=0,Y=0;Y<32;Y++)O[Y]+=N-(O[31]>>4)*Qt[Y],N=O[Y]>>8,O[Y]&=255;for(Y=0;Y<32;Y++)O[Y]-=N*Qt[Y];for(z=0;z<32;z++)O[z+1]+=O[z]>>8,E[z]=O[z]&255}function Jn(E){var O=new Float64Array(64),N;for(N=0;N<64;N++)O[N]=E[N];for(N=0;N<64;N++)E[N]=0;On(E,O)}function xe(E,O,N,z){var Y=new Uint8Array(64),Q=new Uint8Array(64),me=new Uint8Array(64),ye,se,de=new Float64Array(64),Me=[r(),r(),r(),r()];xt(Y,z,32),Y[0]&=248,Y[31]&=127,Y[31]|=64;var tt=N+64;for(ye=0;ye<N;ye++)E[64+ye]=O[ye];for(ye=0;ye<32;ye++)E[32+ye]=Y[32+ye];for(xt(me,E.subarray(32),N+32),Jn(me),Oe(Me,me),ve(E,Me),ye=32;ye<64;ye++)E[ye]=z[ye];for(xt(Q,E,N+64),Jn(Q),ye=0;ye<64;ye++)de[ye]=0;for(ye=0;ye<32;ye++)de[ye]=me[ye];for(ye=0;ye<32;ye++)for(se=0;se<32;se++)de[ye+se]+=Q[ye]*Y[se];return On(E.subarray(32),de),tt}function Ee(E,O){var N=r(),z=r(),Y=r(),Q=r(),me=r(),ye=r(),se=r();return M(E[2],f),we(E[1],O),dt(Y,E[1]),Ae(Q,Y,m),Ve(Y,Y,E[2]),Te(Q,E[2],Q),dt(me,Q),dt(ye,me),Ae(se,ye,me),Ae(N,se,Y),Ae(N,N,Q),ln(N,N),Ae(N,N,Y),Ae(N,N,Q),Ae(N,N,Q),Ae(E[0],N,Q),dt(z,E[0]),Ae(z,z,Q),ge(z,Y)&&Ae(E[0],E[0],v),dt(z,E[0]),Ae(z,z,Q),ge(z,Y)?-1:(Ce(E[0])===O[31]>>7&&Ve(E[0],c,E[0]),Ae(E[3],E[0],E[1]),0)}function Ye(E,O,N,z){var Y,Q=new Uint8Array(32),me=new Uint8Array(64),ye=[r(),r(),r(),r()],se=[r(),r(),r(),r()];if(N<64||Ee(se,z))return-1;for(Y=0;Y<N;Y++)E[Y]=O[Y];for(Y=0;Y<32;Y++)E[Y+32]=z[Y];if(xt(me,E,N),Jn(me),Be(ye,se,me),Oe(se,O.subarray(32)),Jt(ye,se),ve(Q,ye),N-=64,B(O,0,Q,0)){for(Y=0;Y<N;Y++)E[Y]=0;return-1}for(Y=0;Y<N;Y++)E[Y]=O[Y+64];return N}var We=32,Fe=24,ft=32,rt=16,Ie=32,mt=32,Xt=32,It=32,nn=32,Bn=Fe,Zi=ft,Mt=rt,wt=64,Zt=32,Xn=64,Wi=32,ja=64;e.lowlevel={crypto_core_hsalsa20:F,crypto_stream_xor:ue,crypto_stream:G,crypto_stream_salsa20_xor:L,crypto_stream_salsa20:X,crypto_onetimeauth:$,crypto_onetimeauth_verify:q,crypto_verify_16:W,crypto_verify_32:B,crypto_secretbox:ae,crypto_secretbox_open:be,crypto_scalarmult:tn,crypto_scalarmult_base:Gt,crypto_box_beforenm:Rt,crypto_box_afternm:Kt,crypto_box:ct,crypto_box_open:Ke,crypto_box_keypair:on,crypto_hash:xt,crypto_sign:xe,crypto_sign_keypair:_t,crypto_sign_open:Ye,crypto_secretbox_KEYBYTES:We,crypto_secretbox_NONCEBYTES:Fe,crypto_secretbox_ZEROBYTES:ft,crypto_secretbox_BOXZEROBYTES:rt,crypto_scalarmult_BYTES:Ie,crypto_scalarmult_SCALARBYTES:mt,crypto_box_PUBLICKEYBYTES:Xt,crypto_box_SECRETKEYBYTES:It,crypto_box_BEFORENMBYTES:nn,crypto_box_NONCEBYTES:Bn,crypto_box_ZEROBYTES:Zi,crypto_box_BOXZEROBYTES:Mt,crypto_sign_BYTES:wt,crypto_sign_PUBLICKEYBYTES:Zt,crypto_sign_SECRETKEYBYTES:Xn,crypto_sign_SEEDBYTES:Wi,crypto_hash_BYTES:ja,gf:r,D:m,L:Qt,pack25519:_,unpack25519:we,M:Ae,A:Te,S:dt,Z:Ve,pow2523:ln,add:Jt,set25519:M,modL:On,scalarmult:Be,scalarbase:Oe};function Ql(E,O){if(E.length!==We)throw new Error("bad key size");if(O.length!==Fe)throw new Error("bad nonce size")}function Zl(E,O){if(E.length!==Xt)throw new Error("bad public key size");if(O.length!==It)throw new Error("bad secret key size")}function pn(){for(var E=0;E<arguments.length;E++)if(!(arguments[E]instanceof Uint8Array))throw new TypeError("unexpected type, use Uint8Array")}function _s(E){for(var O=0;O<E.length;O++)E[O]=0}e.randomBytes=function(E){var O=new Uint8Array(E);return s(O,E),O},e.secretbox=function(E,O,N){pn(E,O,N),Ql(N,O);for(var z=new Uint8Array(ft+E.length),Y=new Uint8Array(z.length),Q=0;Q<E.length;Q++)z[Q+ft]=E[Q];return ae(Y,z,z.length,O,N),Y.subarray(rt)},e.secretbox.open=function(E,O,N){pn(E,O,N),Ql(N,O);for(var z=new Uint8Array(rt+E.length),Y=new Uint8Array(z.length),Q=0;Q<E.length;Q++)z[Q+rt]=E[Q];return z.length<32||be(Y,z,z.length,O,N)!==0?null:Y.subarray(ft)},e.secretbox.keyLength=We,e.secretbox.nonceLength=Fe,e.secretbox.overheadLength=rt,e.scalarMult=function(E,O){if(pn(E,O),E.length!==mt)throw new Error("bad n size");if(O.length!==Ie)throw new Error("bad p size");var N=new Uint8Array(Ie);return tn(N,E,O),N},e.scalarMult.base=function(E){if(pn(E),E.length!==mt)throw new Error("bad n size");var O=new Uint8Array(Ie);return Gt(O,E),O},e.scalarMult.scalarLength=mt,e.scalarMult.groupElementLength=Ie,e.box=function(E,O,N,z){var Y=e.box.before(N,z);return e.secretbox(E,O,Y)},e.box.before=function(E,O){pn(E,O),Zl(E,O);var N=new Uint8Array(nn);return Rt(N,E,O),N},e.box.after=e.secretbox,e.box.open=function(E,O,N,z){var Y=e.box.before(N,z);return e.secretbox.open(E,O,Y)},e.box.open.after=e.secretbox.open,e.box.keyPair=function(){var E=new Uint8Array(Xt),O=new Uint8Array(It);return on(E,O),{publicKey:E,secretKey:O}},e.box.keyPair.fromSecretKey=function(E){if(pn(E),E.length!==It)throw new Error("bad secret key size");var O=new Uint8Array(Xt);return Gt(O,E),{publicKey:O,secretKey:new Uint8Array(E)}},e.box.publicKeyLength=Xt,e.box.secretKeyLength=It,e.box.sharedKeyLength=nn,e.box.nonceLength=Bn,e.box.overheadLength=e.secretbox.overheadLength,e.sign=function(E,O){if(pn(E,O),O.length!==Xn)throw new Error("bad secret key size");var N=new Uint8Array(wt+E.length);return xe(N,E,E.length,O),N},e.sign.open=function(E,O){if(pn(E,O),O.length!==Zt)throw new Error("bad public key size");var N=new Uint8Array(E.length),z=Ye(N,E,E.length,O);if(z<0)return null;for(var Y=new Uint8Array(z),Q=0;Q<Y.length;Q++)Y[Q]=N[Q];return Y},e.sign.detached=function(E,O){for(var N=e.sign(E,O),z=new Uint8Array(wt),Y=0;Y<z.length;Y++)z[Y]=N[Y];return z},e.sign.detached.verify=function(E,O,N){if(pn(E,O,N),O.length!==wt)throw new Error("bad signature size");if(N.length!==Zt)throw new Error("bad public key size");var z=new Uint8Array(wt+E.length),Y=new Uint8Array(wt+E.length),Q;for(Q=0;Q<wt;Q++)z[Q]=O[Q];for(Q=0;Q<E.length;Q++)z[Q+wt]=E[Q];return Ye(Y,z,z.length,N)>=0},e.sign.keyPair=function(){var E=new Uint8Array(Zt),O=new Uint8Array(Xn);return _t(E,O),{publicKey:E,secretKey:O}},e.sign.keyPair.fromSecretKey=function(E){if(pn(E),E.length!==Xn)throw new Error("bad secret key size");for(var O=new Uint8Array(Zt),N=0;N<O.length;N++)O[N]=E[32+N];return{publicKey:O,secretKey:new Uint8Array(E)}},e.sign.keyPair.fromSeed=function(E){if(pn(E),E.length!==Wi)throw new Error("bad seed size");for(var O=new Uint8Array(Zt),N=new Uint8Array(Xn),z=0;z<32;z++)N[z]=E[z];return _t(O,N,!0),{publicKey:O,secretKey:N}},e.sign.publicKeyLength=Zt,e.sign.secretKeyLength=Xn,e.sign.seedLength=Wi,e.sign.signatureLength=wt,e.hash=function(E){pn(E);var O=new Uint8Array(ja);return xt(O,E,E.length),O},e.hash.hashLength=ja,e.verify=function(E,O){return pn(E,O),E.length===0||O.length===0||E.length!==O.length?!1:I(E,0,O,0,E.length)===0},e.setPRNG=function(E){s=E},(function(){var E=typeof globalThis<"u"?globalThis.crypto||globalThis.msCrypto:null;if(E&&E.getRandomValues){var O=65536;e.setPRNG(function(N,z){var Y,Q=new Uint8Array(z);for(Y=0;Y<z;Y+=O)E.getRandomValues(Q.subarray(Y,Y+Math.min(z-Y,O)));for(Y=0;Y<z;Y++)N[Y]=Q[Y];_s(Q)})}else typeof require<"u"&&(E=require("crypto"),E&&E.randomBytes&&e.setPRNG(function(N,z){var Y,Q=E.randomBytes(z);for(Y=0;Y<z;Y++)N[Y]=Q[Y];_s(Q)}))})()})(typeof module<"u"&&module.exports?module.exports:globalThis.nacl=globalThis.nacl||{});const du=typeof module<"u"&&module.exports?module.exports:globalThis.nacl,G2={fromSeed:du.sign.keyPair.fromSeed,sign:du.sign.detached,verify:du.sign.detached.verify,randomBytes:du.randomBytes};let Ex;function J2(e){Ex=e}function Fi(){return Ex}const X2=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 zu{static checksum(t){let r=0;for(let s=0;s<t.byteLength;s++){let l=t[s];r=r<<8&65535^X2[(r>>8^l)&255]}return r}static validate(t,r){return zu.checksum(t)==r}}const Ch="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";class R0{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 d=s>>>r-5&31;u[c++]=Ch.charAt(d).charCodeAt(0),r-=5}if(r>0){let f=s<<5-r&31;u[c++]=Ch.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 d=String.fromCharCode(u[f]),m=Ch.indexOf(d);if(m===-1)throw new Error("Illegal Base32 character: "+u[f]);s=s<<5|m,r+=5,r>=8&&(c[l++]=s>>>r-8&255,r-=8)}return c.slice(0,l)}}class Ot 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 K2(){return Qu(Tt.Operator)}function Q2(){return Qu(Tt.Account)}function Z2(){return Qu(Tt.User)}var St;(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"})(St||(St={}));var Tt;(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"})(Tt||(Tt={}));class ua{static isValidPublicPrefix(t){return t==Tt.Server||t==Tt.Operator||t==Tt.Cluster||t==Tt.Account||t==Tt.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 Tt.Seed:return Tt.Seed;case Tt.Private:return Tt.Private;case Tt.Operator:return Tt.Operator;case Tt.Server:return Tt.Server;case Tt.Cluster:return Tt.Cluster;case Tt.Account:return Tt.Account;case Tt.User:return Tt.User;default:return-1}}}class Ln{static encode(t,r){if(!r||!(r instanceof Uint8Array))throw new Ot(St.SerializationError);if(!ua.isValidPrefix(t))throw new Ot(St.InvalidPrefixByte);return Ln._encode(!1,t,r)}static encodeSeed(t,r){if(!r)throw new Ot(St.ApiError);if(!ua.isValidPublicPrefix(t))throw new Ot(St.InvalidPrefixByte);if(r.byteLength!==32)throw new Ot(St.InvalidSeedLen);return Ln._encode(!0,t,r)}static decode(t,r){if(!ua.isValidPrefix(t))throw new Ot(St.InvalidPrefixByte);const s=Ln._decode(r);if(s[0]!==t)throw new Ot(St.InvalidPrefixByte);return s.slice(1)}static decodeSeed(t){const r=Ln._decode(t),s=Ln._decodePrefix(r);if(s[0]!=Tt.Seed)throw new Ot(St.InvalidSeed);if(!ua.isValidPublicPrefix(s[1]))throw new Ot(St.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,d=new Uint8Array(c);if(t){const g=Ln._encodePrefix(Tt.Seed,r);d.set(g)}else d[0]=r;d.set(s,l);const m=zu.checksum(d.slice(0,f));return new DataView(d.buffer).setUint16(f,m,!0),R0.encode(d)}static _decode(t){if(t.byteLength<4)throw new Ot(St.InvalidEncoding);let r;try{r=R0.decode(t)}catch(f){throw new Ot(St.InvalidEncoding,f)}const s=r.byteLength-2,u=new DataView(r.buffer).getUint16(s,!0),c=r.slice(0,s);if(!zu.validate(c,u))throw new Ot(St.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 Cx{constructor(t){C(this,"seed");this.seed=t}getRawSeed(){if(!this.seed)throw new Ot(St.ClearedPair);return Ln.decodeSeed(this.seed).buf}getSeed(){if(!this.seed)throw new Ot(St.ClearedPair);return this.seed}getPublicKey(){if(!this.seed)throw new Ot(St.ClearedPair);const t=Ln.decodeSeed(this.seed),r=Fi().fromSeed(this.getRawSeed()),s=Ln.encode(t.prefix,r.publicKey);return new TextDecoder().decode(s)}getPrivateKey(){if(!this.seed)throw new Ot(St.ClearedPair);const t=Fi().fromSeed(this.getRawSeed());return Ln.encode(Tt.Private,t.secretKey)}sign(t){if(!this.seed)throw new Ot(St.ClearedPair);const r=Fi().fromSeed(this.getRawSeed());return Fi().sign(t,r.secretKey)}verify(t,r){if(!this.seed)throw new Ot(St.ClearedPair);const s=Fi().fromSeed(this.getRawSeed());return Fi().verify(t,r,s.publicKey)}clear(){this.seed&&(this.seed.fill(0),this.seed=void 0)}}function Qu(e){const t=Fi().randomBytes(32);let r=Ln.encodeSeed(e,new Uint8Array(t));return new Cx(r)}class W2{constructor(t){C(this,"publicKey");this.publicKey=t}getPublicKey(){if(!this.publicKey)throw new Ot(St.ClearedPair);return new TextDecoder().decode(this.publicKey)}getPrivateKey(){throw this.publicKey?new Ot(St.PublicKeyOnly):new Ot(St.ClearedPair)}getSeed(){throw this.publicKey?new Ot(St.PublicKeyOnly):new Ot(St.ClearedPair)}sign(t){throw this.publicKey?new Ot(St.CannotSign):new Ot(St.ClearedPair)}verify(t,r){if(!this.publicKey)throw new Ot(St.ClearedPair);let s=Ln._decode(this.publicKey);return Fi().verify(t,r,s.slice(1))}clear(){this.publicKey&&(this.publicKey.fill(0),this.publicKey=void 0)}}function ek(e){const t=new TextEncoder().encode(e),r=Ln._decode(t),s=ua.parsePrefix(r[0]);if(ua.isValidPublicPrefix(s))return new W2(t);throw new Ot(St.InvalidPublicKey)}function tk(e){return Ln.decodeSeed(e),new Cx(e)}function nk(e){return btoa(String.fromCharCode(...e))}function rk(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}J2(G2);const M0={createAccount:Q2,createOperator:K2,createPair:Qu,createUser:Z2,fromPublic:ek,fromSeed:tk,NKeysError:Ot,NKeysErrorCode:St,Prefix:Tt,decode:rk,encode:nk};function ik(e){return t=>{let r={};return e.forEach(s=>{const l=s(t)||{};r=Object.assign(r,l)}),r}}function sk(){return()=>{}}function ak(e,t){return()=>{const r=typeof e=="function"?e():e,s=typeof t=="function"?t():t;return{user:r,pass:s}}}function lk(e){return()=>({auth_token:typeof e=="function"?e():e})}function ok(e){return t=>{const r=typeof e=="function"?e():e,s=r?M0.fromSeed(r):void 0,l=s?s.getPublicKey():"",u=Ki.encode(t||""),c=s!==void 0&&t?s.sign(u):void 0,f=c?M0.encode(c):"";return{nkey:l,sig:f}}}function Ax(e,t){return r=>{const s=typeof e=="function"?e():e,l=ok(t),{nkey:u,sig:c}=l(r);return{jwt:s,nkey:u,sig:c}}}const jx=120*1e3,uk=2,Nx=2*1e3;function ck(){return{maxPingOut:2,maxReconnectAttempts:10,noRandomize:!1,pedantic:!1,pingInterval:jx,reconnect:!0,reconnectJitter:100,reconnectJitterTLS:1e3,reconnectTimeWait:Nx,tls:void 0,verbose:!1,waitOnFirstConnect:!1,ignoreAuthErrorAbort:!1}}function fk(e){const t=[];return typeof e.authenticator=="function"&&t.push(e.authenticator),Array.isArray(e.authenticator)&&t.push(...e.authenticator),e.token&&t.push(lk(e.token)),e.user&&t.push(ak(e.user,e.pass)),t.length===0?sk():ik(t)}function hk(e){const t=`${td}:${Sx()}`;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 Re("port and servers options are mutually exclusive",ke.InvalidOption);e.servers.length===0&&e.port&&(e.servers=[`${td}:${e.port}`]),e.servers&&e.servers.length===0&&(e.servers=[t]);const r=Ju(ck(),e);if(r.authenticator=fk(r),["reconnectDelayHandler","authenticator"].forEach(s=>{if(r[s]&&typeof r[s]!="function")throw new Re(`${s} option should be a function`,ke.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{mi(r.inboxPrefix)}catch(s){throw new Re(s.message,ke.ApiError)}if(r.resolve===void 0&&(r.resolve=typeof od()=="function"),r.resolve&&typeof od()!="function")throw new Re("'resolve' is not supported on this client",ke.InvalidOption);return r}function dk(e,t){const{proto:r,tls_required:s,tls_available:l}=e;if((r===void 0||r<1)&&t.noEcho)throw new Re("noEcho",ke.ServerOptionNotAvailable);const u=s||l||!1;if(t.tls&&!u)throw new Re("tls",ke.ServerOptionNotAvailable)}const mk=1024*32,pk=/^INFO\s+([^\r\n]+)\r\n/i,gk=jl(`PONG\r
72
- `),D0=jl(`PING\r
73
- `);class yk{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):{})||{};Ju(this,l)}}class Tx extends xn{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");Ju(this,l),this.protocol=r,this.subject=s,this.draining=!1,this.noIterator=typeof l.callback=="function",this.closed=Vt();const u=!((c=r.options)!=null&&c.noAsyncTraces);l.timeout&&(this.timer=ya(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,d)=>{const{ingest:m}=l(d);m&&u(d)&&(s(f,d),c(d))}}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(Re.errorForCode(ke.ConnectionClosed)):this.isClosed()?Promise.reject(Re.errorForCode(ke.SubClosed)):(this.drained||(this.draining=!0,this.protocol.unsub(this),this.drained=this.protocol.flush(Vt()).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 bk{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 Uu{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=mk,this.outMsgs=0,this.inMsgs=0,this.outBytes=0,this.inBytes=0,this.options=t,this.publisher=r,this.subscriptions=new bk,this.muxSubscriptions=new I2,this.outbound=new xa,this.pongs=[],this.whyClosed="",this.pendingLimit=t.pendingLimit||this.pendingLimit,this.features=new S2({major:0,minor:0,micro:0}),this.connectPromise=null;const s=typeof t.servers=="string"?[t.servers]:t.servers;this.servers=new q2(s,{randomize:!t.noRandomize}),this.closed=Vt(),this.parser=new O0(this),this.heartbeats=new F2(this,this.options.pingInterval||jx,this.options.maxPingOut||uk)}resetOutbound(){this.outbound.reset();const t=this.pongs;this.pongs=[];const r=Re.errorForCode(ke.Disconnect);r.stack="",t.forEach(s=>{s.reject(r)}),this.parser=new O0(this),this.infoReceived=!1}dispatchStatus(t){this.listeners.forEach(r=>{r.push(t)})}status(){const t=new xn;return this.listeners.push(t),t}prepare(){this.transport&&this.transport.discard(),this.info=void 0,this.resetOutbound();const t=Vt();return t.catch(()=>{}),this.pongs.unshift(t),this.connectError=r=>{t.reject(r)},this.transport=E2(),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:ca.StaleConnection,data:""}),this.transport.disconnect()}reconnect(){return this.connected&&(this.dispatchStatus({type:ca.ClientInitiatedReconnect,data:""}),this.transport.disconnect()),Promise.resolve()}async disconnected(t){this.dispatchStatus({type:fi.Disconnect,data:this.servers.getCurrentServer().toString()}),this.options.reconnect?await this.dialLoop().then(()=>{var r;this.dispatchStatus({type:fi.Reconnect,data:this.servers.getCurrentServer().toString()}),((r=this.lastError)==null?void 0:r.code)===ke.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=ya(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:od(),debug:this.options.debug,randomize:!this.options.noRandomize,resolve:r});let l=null;for(const u of s)try{l=null,this.dispatchStatus({type:ca.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():Nx;let s=r;const l=this.selectServer();if(!l||this.abortReconnect)throw t||(this.lastError?this.lastError:Re.errorForCode(ke.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 Ea(s)}}static async connect(t,r){const s=new Uu(t,r);return await s.dialLoop(),s}static toError(t){const r=t?t.toLowerCase():"";if(r.indexOf("permissions violation")!==-1){const s=new Re(t,ke.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 Re(t,ke.AuthorizationViolation):r.indexOf("user authentication expired")!==-1?new Re(t,ke.AuthenticationExpired):r.indexOf("account authentication expired")!=-1?new Re(t,ke.AccountExpired):r.indexOf("authentication timeout")!==-1?new Re(t,ke.AuthenticationTimeout):new Re(t,ke.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 Pd(t,r,this)),s.max!==void 0&&s.received>=s.max&&s.unsubscribe())}processError(t){const r=g0(t),s=Uu.toError(r),l={type:fi.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(gk)}processPong(){const t=this.pongs.shift();t&&t.resolve()}processInfo(t){const r=JSON.parse(g0(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(bs(r.version)),this.infoReceived=!0,this.transport.isEncrypted()&&this.servers.updateTLSName();const{version:u,lang:c}=this.transport;try{const f=new yk({version:u,lang:c},this.options,r.nonce);r.headers&&(f.headers=!0,f.no_responders=!0);const d=JSON.stringify(f);this.transport.send(jl(`CONNECT ${d}${ku}`)),this.transport.send(D0)}catch(f){this._close(f)}}s&&this.dispatchStatus({type:fi.Update,data:s}),(r.ldm!==void 0?r.ldm:!1)&&this.dispatchStatus({type:fi.LDM,data:this.servers.getCurrentServer().toString()})}push(t){switch(t.kind){case Dn.MSG:{const{msg:r,data:s}=t;this.processMsg(r,s);break}case Dn.OK:break;case Dn.ERR:this.processError(t.data);break;case Dn.PING:this.processPing();break;case Dn.PONG:this.processPong();break;case Dn.INFO:this.processInfo(t.data);break}}sendCommand(t,...r){const s=this.outbound.length();let l;typeof t=="string"?l=jl(t):l=t,this.outbound.fill(l,...r),s===0?queueMicrotask(()=>{this.flushPending()}):this.outbound.size()>=this.pendingLimit&&this.flushPending()}publish(t,r=ur,s){let l;if(r instanceof Uint8Array)l=r;else if(typeof r=="string")l=Ki.encode(r);else throw Re.errorForCode(ke.BadPayload);let u=l.length;s=s||{},s.reply=s.reply||"";let c=ur,f=0;if(s.headers){if(this.info&&!this.info.headers)throw new Re("headers",ke.ServerOptionNotAvailable);c=s.headers.encode(),f=c.length,u=l.length+f}if(this.info&&u>this.info.max_payload)throw Re.errorForCode(ke.MaxPayloadExceeded);this.outBytes+=u,this.outMsgs++;let d;s.headers?(s.reply?d=`HPUB ${t} ${s.reply} ${f} ${u}\r
74
- `:d=`HPUB ${t} ${f} ${u}\r
75
- `,this.sendCommand(d,c,l,Lu)):(s.reply?d=`PUB ${t} ${s.reply} ${u}\r
76
- `:d=`PUB ${t} ${u}\r
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||Re.errorForCode(ke.Cancelled))}}const S2="$JS.API";function _2(e){return e=e||{},e.domain&&(e.apiPrefix=`$JS.${e.domain}.API`,delete e.domain),Ju({apiPrefix:S2,timeout:5e3},e)}class Yl{constructor(t,r){C(this,"nc");C(this,"opts");C(this,"prefix");C(this,"timeout");C(this,"jc");this.nc=t,this.opts=_2(r),this._parseOpts(),this.prefix=this.opts.apiPrefix,this.timeout=this.opts.timeout,this.jc=Mr()}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=cr;r&&(l=this.jc.encode(r));let{retries:o}=s;o=o||1,o=o===-1?Number.MAX_SAFE_INTEGER:o;const c=zd();for(let f=0;f<o;f++)try{const d=await this.nc.request(t,l,s);return this.parseJsResponse(d)}catch(d){const m=d;if((m.code==="503"||m.code===ke.Timeout)&&f+1<o)await Ea(c.backoff(f));else throw d}}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=yx(s.error.code,s.error.description);if(l!==null)throw l.api_error=s.error,l}return r}}class Al{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 bs(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 ld(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 pt;(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"})(pt||(pt={}));class k2{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=bs(t)),this.server=t,this.set(pt.JS_KV,"2.6.2"),this.set(pt.JS_OBJECTSTORE,"2.6.3"),this.set(pt.JS_PULL_MAX_BYTES,"2.8.3"),this.set(pt.JS_NEW_CONSUMER_CREATE_API,"2.9.0"),this.set(pt.JS_ALLOW_DIRECT,"2.9.0"),this.set(pt.JS_MULTIPLE_CONSUMER_FILTER,"2.10.0"),this.set(pt.JS_SIMPLIFICATION,"2.9.4"),this.set(pt.JS_STREAM_CONSUMER_METADATA,"2.10.0"),this.set(pt.JS_CONSUMER_FILTER_SUBJECTS,"2.10.0"),this.set(pt.JS_STREAM_FIRST_SEQ,"2.10.0"),this.set(pt.JS_STREAM_SUBJECT_TRANSFORM,"2.10.0"),this.set(pt.JS_STREAM_SOURCE_SUBJECT_TRANSFORM,"2.10.0"),this.set(pt.JS_STREAM_COMPRESSION,"2.10.0"),this.set(pt.JS_DEFAULT_CONSUMER_LIMITS,"2.10.0"),this.set(pt.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:ld(this.server,bs(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=bs(t)),ld(this.server,t)>=0}}class Du extends Yl{constructor(t,r){super(t,r)}async add(t,r,s=Mu.Create){if(Mn(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&&fa(l.config.durable_name);const o=this.nc;let{min:c,ok:f}=o.features.get(pt.JS_NEW_CONSUMER_CREATE_API);const d=r.name===""?void 0:r.name;if(d&&!f)throw new Error(`consumer 'name' requires server ${c}`);if(d)try{Xu("name",d)}catch(x){const v=x.message,S=v.indexOf("cannot contain");throw S!==-1?new Error(`consumer 'name' ${v.substring(S)}`):x}let m,y="";if(Array.isArray(r.filter_subjects)){const{min:x,ok:v}=o.features.get(pt.JS_MULTIPLE_CONSUMER_FILTER);if(!v)throw new Error(`consumer 'filter_subjects' requires server ${x}`);f=!1}if(r.metadata){const{min:x,ok:v}=o.features.get(pt.JS_STREAM_CONSUMER_METADATA);if(!v)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),m=x!==void 0?`${this.prefix}.CONSUMER.CREATE.${t}.${y}.${x}`:`${this.prefix}.CONSUMER.CREATE.${t}.${y}`}else m=r.durable_name?`${this.prefix}.CONSUMER.DURABLE.CREATE.${t}.${r.durable_name}`:`${this.prefix}.CONSUMER.CREATE.${t}`;return await this._request(m,l)}async update(t,r,s){const l=await this.info(t,r),o=s;return this.add(t,Object.assign(l.config,o),Mu.Update)}async info(t,r){return Mn(t),fa(r),await this._request(`${this.prefix}.CONSUMER.INFO.${t}.${r}`)}async delete(t,r){return Mn(t),fa(r),(await this._request(`${this.prefix}.CONSUMER.DELETE.${t}.${r}`)).success}list(t){Mn(t);const r=l=>l.consumers,s=`${this.prefix}.CONSUMER.LIST.${t}`;return new Al(s,r,this)}pause(t,r,s){const l=`${this.prefix}.CONSUMER.PAUSE.${t}.${r}`,o={pause_until:s.toISOString()};return this._request(l,o)}resume(t,r){return this.pause(t,r,new Date(0))}}function ra(e,t,r=!1){if(r===!0&&!e)throw Re.errorForCode(ke.ApiError,new Error(`${t} is not a function`));if(e&&typeof e!="function")throw Re.errorForCode(ke.ApiError,new Error(`${t} is not a function`))}class E2 extends xn{constructor(r,s,l){super();C(this,"sub");C(this,"adapter");C(this,"subIterDone");ra(l.adapter,"adapter",!0),this.adapter=l.adapter,l.callback&&ra(l.callback,"callback"),this.noIterator=typeof l.callback=="function",l.ingestionFilterFn&&(ra(l.ingestionFilterFn,"ingestionFilterFn"),this.ingestionFilterFn=l.ingestionFilterFn),l.protocolFilterFn&&(ra(l.protocolFilterFn,"protocolFilterFn"),this.protocolFilterFn=l.protocolFilterFn),l.dispatchedFn&&(ra(l.dispatchedFn,"dispatchedFn"),this.dispatchedFn=l.dispatchedFn),l.cleanupFn&&ra(l.cleanupFn,"cleanupFn");let o=(y,g)=>{this.callback(y,g)};if(l.callback){const y=l.callback;o=(g,x)=>{const[v,S]=this.adapter(g,x);if(v){y(v,null);return}const{ingest:A}=this.ingestionFilterFn?this.ingestionFilterFn(S,this):{ingest:!0};A&&(!this.protocolFilterFn||this.protocolFilterFn(S))&&(y(v,S),this.dispatchedFn&&S&&this.dispatchedFn(S))}}const{max:c,queue:f,timeout:d}=l,m={queue:f,timeout:d,callback:o};c&&c>0&&(m.max=c),this.sub=r.subscribe(s,m),l.cleanupFn&&(this.sub.cleanupFn=l.cleanupFn),this.noIterator||this.iterClosed.then(()=>{this.unsubscribe()}),this.subIterDone=Vt(),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,o]=this.adapter(r,s);l&&this.stop(l),o&&this.push(o)}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 or;function C2(e){or=e}function vx(){return or!==void 0&&or.defaultPort!==void 0?or.defaultPort:4222}function _h(){return or!==void 0&&or.urlParseFn?or.urlParseFn:void 0}function A2(){if(!or||typeof or.factory!="function")throw new Error("transport fn is not set");return or.factory()}function od(){return or!==void 0&&or.dnsResolveFn?or.dnsResolveFn:void 0}const ku=`\r
71
+ `,Lu=xa.fromAscii(ku),j2=new Uint8Array(Lu)[0],N2=new Uint8Array(Lu)[1];function T2(e){for(let t=0;t<e.length;t++){const r=t+1;if(e.byteLength>r&&e[t]===j2&&e[r]===N2)return r+1}return 0}function O2(e){const t=T2(e);if(t>0){const s=new Uint8Array(e).slice(0,t);return lr.decode(s)}return""}const R2=4,wx=48,M2=65,D2=97;function L2(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 ud(e){return z2(e)!==void 0}function z2(e){for(let t=0;t<e.length;t++)switch(e[t]){case".":return Sx(e);case":":return U2(e)}}function Sx(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:o}=P2(e);if(!o||s>255)return;e=e.substring(l),t[r]=s}return L2(t[0],t[1],t[2],t[3])}function U2(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:o,ok:c}=B2(e);if(!c||l>65535)return;if(o<e.length&&e[o]==="."){if(r<0&&s!=12||s+4>16)return;const f=Sx(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+=R2;break}if(t[s]=l>>8,t[s+1]=l,s+=2,e=e.substring(o),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 o=s-1;o>=r;o--)t[o+l]=t[o];for(let o=r+l-1;o>=r;o--)t[o]=0}else if(r>=0)return;return t}}function P2(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)-wx),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 B2(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)-wx;else if(97<=e.charCodeAt(r)&&e.charCodeAt(r)<=102)t*=16,t+=e.charCodeAt(r)-D2+10;else if(65<=e.charCodeAt(r)&&e.charCodeAt(r)<=70)t*=16,t+=e.charCodeAt(r)-M2+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 H2(e){return e.indexOf("[")!==-1||e.indexOf("::")!==-1?!1:e.indexOf(".")!==-1||e.split(":").length<=2}function cd(e){return!H2(e)}function q2(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 I2(e){e=e.trim(),e.match(/^(.*:\/\/)(.*)/m)&&(e=e.replace(/^(.*:\/\/)(.*)/gm,"$2")),e=q2(e),cd(e)&&e.indexOf("[")===-1&&(e=`[${e}]`);const t=cd(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 o=l.hostname;return o.charAt(0)==="["&&(o=o.substring(1,o.length-1)),{listen:l.host,hostname:o,port:r}}class Tl{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=I2(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(ud(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 o=this.port===80?"https":"http",c=new URL(`${o}://${cd(l)?"["+l+"]":l}`);c.port=`${this.port}`;const f=new Tl(c.host,!1);f.tlsName=this.hostname,r.push(f)}}return t.randomize&&px(r),this.resolves=r,r}}class F2{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=_h();t&&(t.forEach(l=>{l=s?s(l):l,this.servers.push(new Tl(l))}),this.randomize&&(this.servers=px(this.servers))),this.servers.length===0&&this.addServer(`${td}:${vx()}`,!1),this.currentServer=this.servers[0]}clear(){this.servers.length=0}updateTLSName(){const t=this.getCurrentServer();ud(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=_h();t=s?s(t):t;const l=new Tl(t,r);ud(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 o=_h(),c=new Map;t.connect_urls&&t.connect_urls.length>0&&t.connect_urls.forEach(d=>{d=o?o(d,r):d;const m=new Tl(d,!0);c.set(d,m)});const f=[];return this.servers.forEach((d,m)=>{const y=d.listen;d.gossiped&&this.currentServer.listen!==y&&c.get(y)===void 0&&f.push(m),c.delete(y)}),f.reverse(),f.forEach(d=>{const m=this.servers.splice(d,1);l=l.concat(m[0].listen)}),c.forEach((d,m)=>{this.servers.push(d),s.push(m)}),{added:s,deleted:l}}}class $2{constructor(){C(this,"baseInbox");C(this,"reqs");this.reqs=new Map}size(){return this.reqs.size}init(t){return this.baseInbox=`${mi(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(o=>o.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=gx(r)),l.resolver(t,r))}}}close(){const t=Re.errorForCode(ke.Timeout);this.reqs.forEach(r=>{r.resolver(t,{})})}}class V2{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:ca.PingTimer,data:`${this.pendings.length+1}`}),this.pendings.length===this.maxOut){this.cancel(!0);return}const t=Vt();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 Y2 extends Error{constructor(t){super(t),this.name="AssertionError"}}function G2(e,t="Assertion failed."){if(!e)throw new Y2(t)}const T0=32*1024,kh=2**32-2;function hu(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 Eh{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){G2(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=hu(this._buf.subarray(this._off),t);return this._off+=r,r}writeByte(t){return this.write(Uint8Array.of(t))}writeString(t){return this.write(Ki.encode(t))}write(t){const r=this._grow(t.byteLength);return hu(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)hu(this._buf.subarray(this._off),this._buf);else{if(l+t>kh)throw new Error("The buffer cannot be grown beyond the maximum size.");{const o=new Uint8Array(Math.min(2*l+t,kh));hu(this._buf.subarray(this._off),o),this._buf=o}}return this._off=0,this._reslice(Math.min(r+t,kh)),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(T0);for(;;){const l=this.capacity-this.length<T0,o=l?s:new Uint8Array(this._buf.buffer,this.length),c=t.read(o);if(c===null)return r;l?this.write(o.subarray(0,c)):this._reslice(this.length+c),r+=c}}}var Dn;(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"})(Dn||(Dn={}));function O0(){const e={};return e.sid=-1,e.hdr=-1,e.size=-1,e}const J2=48;class R0{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=Ne.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 Ne.OP_START:switch(s){case Te.M:case Te.m:this.state=Ne.OP_M,this.hdr=-1,this.ma=O0();break;case Te.H:case Te.h:this.state=Ne.OP_H,this.hdr=0,this.ma=O0();break;case Te.P:case Te.p:this.state=Ne.OP_P;break;case Te.PLUS:this.state=Ne.OP_PLUS;break;case Te.MINUS:this.state=Ne.OP_MINUS;break;case Te.I:case Te.i:this.state=Ne.OP_I;break;default:throw this.fail(t.subarray(r))}break;case Ne.OP_H:switch(s){case Te.M:case Te.m:this.state=Ne.OP_M;break;default:throw this.fail(t.subarray(r))}break;case Ne.OP_M:switch(s){case Te.S:case Te.s:this.state=Ne.OP_MS;break;default:throw this.fail(t.subarray(r))}break;case Ne.OP_MS:switch(s){case Te.G:case Te.g:this.state=Ne.OP_MSG;break;default:throw this.fail(t.subarray(r))}break;case Ne.OP_MSG:switch(s){case Te.SPACE:case Te.TAB:this.state=Ne.OP_MSG_SPC;break;default:throw this.fail(t.subarray(r))}break;case Ne.OP_MSG_SPC:switch(s){case Te.SPACE:case Te.TAB:continue;default:this.state=Ne.MSG_ARG,this.as=r}break;case Ne.MSG_ARG:switch(s){case Te.CR:this.drop=1;break;case Te.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=Ne.MSG_PAYLOAD,r=this.as+this.ma.size-1;break}default:this.argBuf&&this.argBuf.writeByte(s)}break;case Ne.MSG_PAYLOAD:if(this.msgBuf)if(this.msgBuf.length>=this.ma.size){const l=this.msgBuf.bytes({copy:!1});this.dispatcher.push({kind:Dn.MSG,msg:this.ma,data:l}),this.argBuf=void 0,this.msgBuf=void 0,this.state=Ne.MSG_END}else{let l=this.ma.size-this.msgBuf.length;const o=t.length-r;o<l&&(l=o),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:Dn.MSG,msg:this.ma,data:t.subarray(this.as,r)}),this.argBuf=void 0,this.msgBuf=void 0,this.state=Ne.MSG_END);break;case Ne.MSG_END:switch(s){case Te.NL:this.drop=0,this.as=r+1,this.state=Ne.OP_START;break;default:continue}break;case Ne.OP_PLUS:switch(s){case Te.O:case Te.o:this.state=Ne.OP_PLUS_O;break;default:throw this.fail(t.subarray(r))}break;case Ne.OP_PLUS_O:switch(s){case Te.K:case Te.k:this.state=Ne.OP_PLUS_OK;break;default:throw this.fail(t.subarray(r))}break;case Ne.OP_PLUS_OK:switch(s){case Te.NL:this.dispatcher.push({kind:Dn.OK}),this.drop=0,this.state=Ne.OP_START;break}break;case Ne.OP_MINUS:switch(s){case Te.E:case Te.e:this.state=Ne.OP_MINUS_E;break;default:throw this.fail(t.subarray(r))}break;case Ne.OP_MINUS_E:switch(s){case Te.R:case Te.r:this.state=Ne.OP_MINUS_ER;break;default:throw this.fail(t.subarray(r))}break;case Ne.OP_MINUS_ER:switch(s){case Te.R:case Te.r:this.state=Ne.OP_MINUS_ERR;break;default:throw this.fail(t.subarray(r))}break;case Ne.OP_MINUS_ERR:switch(s){case Te.SPACE:case Te.TAB:this.state=Ne.OP_MINUS_ERR_SPC;break;default:throw this.fail(t.subarray(r))}break;case Ne.OP_MINUS_ERR_SPC:switch(s){case Te.SPACE:case Te.TAB:continue;default:this.state=Ne.MINUS_ERR_ARG,this.as=r}break;case Ne.MINUS_ERR_ARG:switch(s){case Te.CR:this.drop=1;break;case Te.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:Dn.ERR,data:l}),this.drop=0,this.as=r+1,this.state=Ne.OP_START;break}default:this.argBuf&&this.argBuf.write(Uint8Array.of(s))}break;case Ne.OP_P:switch(s){case Te.I:case Te.i:this.state=Ne.OP_PI;break;case Te.O:case Te.o:this.state=Ne.OP_PO;break;default:throw this.fail(t.subarray(r))}break;case Ne.OP_PO:switch(s){case Te.N:case Te.n:this.state=Ne.OP_PON;break;default:throw this.fail(t.subarray(r))}break;case Ne.OP_PON:switch(s){case Te.G:case Te.g:this.state=Ne.OP_PONG;break;default:throw this.fail(t.subarray(r))}break;case Ne.OP_PONG:switch(s){case Te.NL:this.dispatcher.push({kind:Dn.PONG}),this.drop=0,this.state=Ne.OP_START;break}break;case Ne.OP_PI:switch(s){case Te.N:case Te.n:this.state=Ne.OP_PIN;break;default:throw this.fail(t.subarray(r))}break;case Ne.OP_PIN:switch(s){case Te.G:case Te.g:this.state=Ne.OP_PING;break;default:throw this.fail(t.subarray(r))}break;case Ne.OP_PING:switch(s){case Te.NL:this.dispatcher.push({kind:Dn.PING}),this.drop=0,this.state=Ne.OP_START;break}break;case Ne.OP_I:switch(s){case Te.N:case Te.n:this.state=Ne.OP_IN;break;default:throw this.fail(t.subarray(r))}break;case Ne.OP_IN:switch(s){case Te.F:case Te.f:this.state=Ne.OP_INF;break;default:throw this.fail(t.subarray(r))}break;case Ne.OP_INF:switch(s){case Te.O:case Te.o:this.state=Ne.OP_INFO;break;default:throw this.fail(t.subarray(r))}break;case Ne.OP_INFO:switch(s){case Te.SPACE:case Te.TAB:this.state=Ne.OP_INFO_SPC;break;default:throw this.fail(t.subarray(r))}break;case Ne.OP_INFO_SPC:switch(s){case Te.SPACE:case Te.TAB:continue;default:this.state=Ne.INFO_ARG,this.as=r}break;case Ne.INFO_ARG:switch(s){case Te.CR:this.drop=1;break;case Te.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:Dn.INFO,data:l}),this.drop=0,this.as=r+1,this.state=Ne.OP_START;break}default:this.argBuf&&this.argBuf.writeByte(s)}break;default:throw this.fail(t.subarray(r))}}(this.state===Ne.MSG_ARG||this.state===Ne.MINUS_ERR_ARG||this.state===Ne.INFO_ARG)&&!this.argBuf&&(this.argBuf=new Eh(t.subarray(this.as,r-this.drop))),this.state===Ne.MSG_PAYLOAD&&!this.msgBuf&&(this.argBuf||this.cloneMsgArg(),this.msgBuf=new Eh(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 Eh(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 Te.SPACE:case Te.TAB:case Te.CR:case Te.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}: ${lr.decode(t)}`)}processHeaderMsgArgs(t){const r=[];let s=-1;for(let l=0;l<t.length;l++)switch(t[l]){case Te.SPACE:case Te.TAB:case Te.CR:case Te.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]-J2)}return r}}var Ne;(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"})(Ne||(Ne={}));var Te;(function(e){e[e.CR=13]="CR",e[e.E=69]="E",e[e.e=101]="e",e[e.F=70]="F",e[e.f=102]="f",e[e.G=71]="G",e[e.g=103]="g",e[e.H=72]="H",e[e.h=104]="h",e[e.I=73]="I",e[e.i=105]="i",e[e.K=75]="K",e[e.k=107]="k",e[e.M=77]="M",e[e.m=109]="m",e[e.MINUS=45]="MINUS",e[e.N=78]="N",e[e.n=110]="n",e[e.NL=10]="NL",e[e.O=79]="O",e[e.o=111]="o",e[e.P=80]="P",e[e.p=112]="p",e[e.PLUS=43]="PLUS",e[e.R=82]="R",e[e.r=114]="r",e[e.S=83]="S",e[e.s=115]="s",e[e.SPACE=32]="SPACE",e[e.TAB=9]="TAB"})(Te||(Te={}));(function(e){var t=function(k,R){this.hi=k|0,this.lo=R|0},r=function(k){var R,N=new Float64Array(16);if(k)for(R=0;R<k.length;R++)N[R]=k[R];return N},s=function(){throw new Error("no PRNG")},l=new Uint8Array(16),o=new Uint8Array(32);o[0]=9;var c=r(),f=r([1]),d=r([56129,1]),m=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]),v=r([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function S(k,R){return k<<R|k>>>32-R}function A(k,R){var N=k[R+3]&255;return N=N<<8|k[R+2]&255,N=N<<8|k[R+1]&255,N<<8|k[R+0]&255}function M(k,R){var N=k[R]<<24|k[R+1]<<16|k[R+2]<<8|k[R+3],z=k[R+4]<<24|k[R+5]<<16|k[R+6]<<8|k[R+7];return new t(N,z)}function T(k,R,N){var z;for(z=0;z<4;z++)k[R+z]=N&255,N>>>=8}function P(k,R,N){k[R]=N.hi>>24&255,k[R+1]=N.hi>>16&255,k[R+2]=N.hi>>8&255,k[R+3]=N.hi&255,k[R+4]=N.lo>>24&255,k[R+5]=N.lo>>16&255,k[R+6]=N.lo>>8&255,k[R+7]=N.lo&255}function I(k,R,N,z,Y){var Q,pe=0;for(Q=0;Q<Y;Q++)pe|=k[R+Q]^N[z+Q];return(1&pe-1>>>8)-1}function W(k,R,N,z){return I(k,R,N,z,16)}function B(k,R,N,z){return I(k,R,N,z,32)}function D(k,R,N,z,Y){var Q=new Uint32Array(16),pe=new Uint32Array(16),ye=new Uint32Array(16),ae=new Uint32Array(4),me,Me,tt;for(me=0;me<4;me++)pe[5*me]=A(z,4*me),pe[1+me]=A(N,4*me),pe[6+me]=A(R,4*me),pe[11+me]=A(N,16+4*me);for(me=0;me<16;me++)ye[me]=pe[me];for(me=0;me<20;me++){for(Me=0;Me<4;Me++){for(tt=0;tt<4;tt++)ae[tt]=pe[(5*Me+4*tt)%16];for(ae[1]^=S(ae[0]+ae[3]|0,7),ae[2]^=S(ae[1]+ae[0]|0,9),ae[3]^=S(ae[2]+ae[1]|0,13),ae[0]^=S(ae[3]+ae[2]|0,18),tt=0;tt<4;tt++)Q[4*Me+(Me+tt)%4]=ae[tt]}for(tt=0;tt<16;tt++)pe[tt]=Q[tt]}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]-A(z,4*me)|0,pe[6+me]=pe[6+me]-A(R,4*me)|0;for(me=0;me<4;me++)T(k,4*me,pe[5*me]),T(k,16+4*me,pe[6+me])}else for(me=0;me<16;me++)T(k,4*me,pe[me]+ye[me]|0)}function Z(k,R,N,z){return D(k,R,N,z,!1),0}function $(k,R,N,z){return D(k,R,N,z,!0),0}var V=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function L(k,R,N,z,Y,Q,pe){var ye=new Uint8Array(16),ae=new Uint8Array(64),me,Me;if(!Y)return 0;for(Me=0;Me<16;Me++)ye[Me]=0;for(Me=0;Me<8;Me++)ye[Me]=Q[Me];for(;Y>=64;){for(Z(ae,ye,pe,V),Me=0;Me<64;Me++)k[R+Me]=(N?N[z+Me]:0)^ae[Me];for(me=1,Me=8;Me<16;Me++)me=me+(ye[Me]&255)|0,ye[Me]=me&255,me>>>=8;Y-=64,R+=64,N&&(z+=64)}if(Y>0)for(Z(ae,ye,pe,V),Me=0;Me<Y;Me++)k[R+Me]=(N?N[z+Me]:0)^ae[Me];return 0}function X(k,R,N,z,Y){return L(k,R,null,0,N,z,Y)}function G(k,R,N,z,Y){var Q=new Uint8Array(32);return $(Q,z,Y,V),X(k,R,N,z.subarray(16),Q)}function ce(k,R,N,z,Y,Q,pe){var ye=new Uint8Array(32);return $(ye,Q,pe,V),L(k,R,N,z,Y,Q.subarray(16),ye)}function oe(k,R){var N,z=0;for(N=0;N<17;N++)z=z+(k[N]+R[N]|0)|0,k[N]=z&255,z>>>=8}var re=new Uint32Array([5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,252]);function F(k,R,N,z,Y,Q){var pe,ye,ae,me,Me=new Uint32Array(17),tt=new Uint32Array(17),Pt=new Uint32Array(17),En=new Uint32Array(17),Cr=new Uint32Array(17);for(ae=0;ae<17;ae++)tt[ae]=Pt[ae]=0;for(ae=0;ae<16;ae++)tt[ae]=Q[ae];for(tt[3]&=15,tt[4]&=252,tt[7]&=15,tt[8]&=252,tt[11]&=15,tt[12]&=252,tt[15]&=15;Y>0;){for(ae=0;ae<17;ae++)En[ae]=0;for(ae=0;ae<16&&ae<Y;++ae)En[ae]=N[z+ae];for(En[ae]=1,z+=ae,Y-=ae,oe(Pt,En),ye=0;ye<17;ye++)for(Me[ye]=0,ae=0;ae<17;ae++)Me[ye]=Me[ye]+Pt[ae]*(ae<=ye?tt[ye-ae]:320*tt[ye+17-ae]|0)|0|0;for(ye=0;ye<17;ye++)Pt[ye]=Me[ye];for(me=0,ae=0;ae<16;ae++)me=me+Pt[ae]|0,Pt[ae]=me&255,me>>>=8;for(me=me+Pt[16]|0,Pt[16]=me&3,me=5*(me>>>2)|0,ae=0;ae<16;ae++)me=me+Pt[ae]|0,Pt[ae]=me&255,me>>>=8;me=me+Pt[16]|0,Pt[16]=me}for(ae=0;ae<17;ae++)Cr[ae]=Pt[ae];for(oe(Pt,re),pe=-(Pt[16]>>>7)|0,ae=0;ae<17;ae++)Pt[ae]^=pe&(Cr[ae]^Pt[ae]);for(ae=0;ae<16;ae++)En[ae]=Q[ae+16];for(En[16]=0,oe(Pt,En),ae=0;ae<16;ae++)k[R+ae]=Pt[ae];return 0}function q(k,R,N,z,Y,Q){var pe=new Uint8Array(16);return F(pe,0,N,z,Y,Q),W(k,R,pe,0)}function le(k,R,N,z,Y){var Q;if(N<32)return-1;for(ce(k,0,R,0,N,z,Y),F(k,16,k,32,N-32,k),Q=0;Q<16;Q++)k[Q]=0;return 0}function be(k,R,N,z,Y){var Q,pe=new Uint8Array(32);if(N<32||(G(pe,0,32,z,Y),q(R,16,R,32,N-32,pe)!==0))return-1;for(ce(k,0,R,0,N,z,Y),Q=0;Q<32;Q++)k[Q]=0;return 0}function O(k,R){var N;for(N=0;N<16;N++)k[N]=R[N]|0}function U(k){var R,N;for(N=0;N<16;N++)k[N]+=65536,R=Math.floor(k[N]/65536),k[(N+1)*(N<15?1:0)]+=R-1+37*(R-1)*(N===15?1:0),k[N]-=R*65536}function ee(k,R,N){for(var z,Y=~(N-1),Q=0;Q<16;Q++)z=Y&(k[Q]^R[Q]),k[Q]^=z,R[Q]^=z}function j(k,R){var N,z,Y,Q=r(),pe=r();for(N=0;N<16;N++)pe[N]=R[N];for(U(pe),U(pe),U(pe),z=0;z<2;z++){for(Q[0]=pe[0]-65517,N=1;N<15;N++)Q[N]=pe[N]-65535-(Q[N-1]>>16&1),Q[N-1]&=65535;Q[15]=pe[15]-32767-(Q[14]>>16&1),Y=Q[15]>>16&1,Q[14]&=65535,ee(pe,Q,1-Y)}for(N=0;N<16;N++)k[2*N]=pe[N]&255,k[2*N+1]=pe[N]>>8}function ie(k,R){var N=new Uint8Array(32),z=new Uint8Array(32);return j(N,k),j(z,R),B(N,0,z,0)}function Ce(k){var R=new Uint8Array(32);return j(R,k),R[0]&1}function _e(k,R){var N;for(N=0;N<16;N++)k[N]=R[2*N]+(R[2*N+1]<<8);k[15]&=32767}function Ee(k,R,N){var z;for(z=0;z<16;z++)k[z]=R[z]+N[z]|0}function Ve(k,R,N){var z;for(z=0;z<16;z++)k[z]=R[z]-N[z]|0}function je(k,R,N){var z,Y,Q=new Float64Array(31);for(z=0;z<31;z++)Q[z]=0;for(z=0;z<16;z++)for(Y=0;Y<16;Y++)Q[z+Y]+=R[z]*N[Y];for(z=0;z<15;z++)Q[z]+=38*Q[z+16];for(z=0;z<16;z++)k[z]=Q[z];U(k),U(k)}function dt(k,R){je(k,R,R)}function qt(k,R){var N=r(),z;for(z=0;z<16;z++)N[z]=R[z];for(z=253;z>=0;z--)dt(N,N),z!==2&&z!==4&&je(N,N,R);for(z=0;z<16;z++)k[z]=N[z]}function ln(k,R){var N=r(),z;for(z=0;z<16;z++)N[z]=R[z];for(z=250;z>=0;z--)dt(N,N),z!==1&&je(N,N,R);for(z=0;z<16;z++)k[z]=N[z]}function tn(k,R,N){var z=new Uint8Array(32),Y=new Float64Array(80),Q,pe,ye=r(),ae=r(),me=r(),Me=r(),tt=r(),Pt=r();for(pe=0;pe<31;pe++)z[pe]=R[pe];for(z[31]=R[31]&127|64,z[0]&=248,_e(Y,N),pe=0;pe<16;pe++)ae[pe]=Y[pe],Me[pe]=ye[pe]=me[pe]=0;for(ye[0]=Me[0]=1,pe=254;pe>=0;--pe)Q=z[pe>>>3]>>>(pe&7)&1,ee(ye,ae,Q),ee(me,Me,Q),Ee(tt,ye,me),Ve(ye,ye,me),Ee(me,ae,Me),Ve(ae,ae,Me),dt(Me,tt),dt(Pt,ye),je(ye,me,ye),je(me,ae,tt),Ee(tt,ye,me),Ve(ye,ye,me),dt(ae,ye),Ve(me,Me,Pt),je(ye,me,d),Ee(ye,ye,Me),je(me,me,ye),je(ye,Me,Pt),je(Me,ae,Y),dt(ae,tt),ee(ye,ae,Q),ee(me,Me,Q);for(pe=0;pe<16;pe++)Y[pe+16]=ye[pe],Y[pe+32]=me[pe],Y[pe+48]=ae[pe],Y[pe+64]=Me[pe];var En=Y.subarray(32),Cr=Y.subarray(16);return qt(En,En),je(Cr,Cr,En),j(k,Cr),0}function Gt(k,R){return tn(k,R,o)}function on(k,R){return s(R,32),Gt(k,R)}function Rt(k,R,N){var z=new Uint8Array(32);return tn(z,N,R),$(k,l,z,V)}var Kt=le,Pe=be;function ct(k,R,N,z,Y,Q){var pe=new Uint8Array(32);return Rt(pe,Y,Q),Kt(k,R,N,z,pe)}function Ke(k,R,N,z,Y,Q){var pe=new Uint8Array(32);return Rt(pe,Y,Q),Pe(k,R,N,z,pe)}function bt(){var k=0,R=0,N=0,z=0,Y=65535,Q,pe,ye;for(ye=0;ye<arguments.length;ye++)Q=arguments[ye].lo,pe=arguments[ye].hi,k+=Q&Y,R+=Q>>>16,N+=pe&Y,z+=pe>>>16;return R+=k>>>16,N+=R>>>16,z+=N>>>16,new t(N&Y|z<<16,k&Y|R<<16)}function zt(k,R){return new t(k.hi>>>R,k.lo>>>R|k.hi<<32-R)}function Pn(){var k=0,R=0,N;for(N=0;N<arguments.length;N++)k^=arguments[N].lo,R^=arguments[N].hi;return new t(R,k)}function $e(k,R){var N,z,Y=32-R;return R<32?(N=k.hi>>>R|k.lo<<Y,z=k.lo>>>R|k.hi<<Y):R<64&&(N=k.lo>>>R|k.hi<<Y,z=k.hi>>>R|k.lo<<Y),new t(N,z)}function Tn(k,R,N){var z=k.hi&R.hi^~k.hi&N.hi,Y=k.lo&R.lo^~k.lo&N.lo;return new t(z,Y)}function fe(k,R,N){var z=k.hi&R.hi^k.hi&N.hi^R.hi&N.hi,Y=k.lo&R.lo^k.lo&N.lo^R.lo&N.lo;return new t(z,Y)}function Se(k){return Pn($e(k,28),$e(k,34),$e(k,39))}function Le(k){return Pn($e(k,14),$e(k,18),$e(k,41))}function Ge(k){return Pn($e(k,1),$e(k,8),zt(k,7))}function et(k){return Pn($e(k,19),$e(k,61),zt(k,6))}var un=[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 vn(k,R,N){var z=[],Y=[],Q=[],pe=[],ye,ae,me;for(ae=0;ae<8;ae++)z[ae]=Q[ae]=M(k,8*ae);for(var Me=0;N>=128;){for(ae=0;ae<16;ae++)pe[ae]=M(R,8*ae+Me);for(ae=0;ae<80;ae++){for(me=0;me<8;me++)Y[me]=Q[me];for(ye=bt(Q[7],Le(Q[4]),Tn(Q[4],Q[5],Q[6]),un[ae],pe[ae%16]),Y[7]=bt(ye,Se(Q[0]),fe(Q[0],Q[1],Q[2])),Y[3]=bt(Y[3],ye),me=0;me<8;me++)Q[(me+1)%8]=Y[me];if(ae%16===15)for(me=0;me<16;me++)pe[me]=bt(pe[me],pe[(me+9)%16],Ge(pe[(me+1)%16]),et(pe[(me+14)%16]))}for(ae=0;ae<8;ae++)Q[ae]=bt(Q[ae],z[ae]),z[ae]=Q[ae];Me+=128,N-=128}for(ae=0;ae<8;ae++)P(k,8*ae,z[ae]);return N}var Ct=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 xt(k,R,N){var z=new Uint8Array(64),Y=new Uint8Array(256),Q,pe=N;for(Q=0;Q<64;Q++)z[Q]=Ct[Q];for(vn(z,R,N),N%=128,Q=0;Q<256;Q++)Y[Q]=0;for(Q=0;Q<N;Q++)Y[Q]=R[pe-N+Q];for(Y[N]=128,N=256-128*(N<112?1:0),Y[N-9]=0,P(Y,N-8,new t(pe/536870912|0,pe<<3)),vn(z,Y,N),Q=0;Q<64;Q++)k[Q]=z[Q];return 0}function Jt(k,R){var N=r(),z=r(),Y=r(),Q=r(),pe=r(),ye=r(),ae=r(),me=r(),Me=r();Ve(N,k[1],k[0]),Ve(Me,R[1],R[0]),je(N,N,Me),Ee(z,k[0],k[1]),Ee(Me,R[0],R[1]),je(z,z,Me),je(Y,k[3],R[3]),je(Y,Y,y),je(Q,k[2],R[2]),Ee(Q,Q,Q),Ve(pe,z,N),Ve(ye,Q,Y),Ee(ae,Q,Y),Ee(me,z,N),je(k[0],pe,ye),je(k[1],me,ae),je(k[2],ae,ye),je(k[3],pe,me)}function nt(k,R,N){var z;for(z=0;z<4;z++)ee(k[z],R[z],N)}function ve(k,R){var N=r(),z=r(),Y=r();qt(Y,R[2]),je(N,R[0],Y),je(z,R[1],Y),j(k,z),k[31]^=Ce(N)<<7}function Be(k,R,N){var z,Y;for(O(k[0],c),O(k[1],f),O(k[2],f),O(k[3],c),Y=255;Y>=0;--Y)z=N[Y/8|0]>>(Y&7)&1,nt(k,R,z),Jt(R,k),Jt(k,k),nt(k,R,z)}function Oe(k,R){var N=[r(),r(),r(),r()];O(N[0],g),O(N[1],x),O(N[2],f),je(N[3],g,x),Be(k,N,R)}function _t(k,R,N){var z=new Uint8Array(64),Y=[r(),r(),r(),r()],Q;for(N||s(R,32),xt(z,R,32),z[0]&=248,z[31]&=127,z[31]|=64,Oe(Y,z),ve(k,Y),Q=0;Q<32;Q++)R[Q+32]=k[Q];return 0}var Qt=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 On(k,R){var N,z,Y,Q;for(z=63;z>=32;--z){for(N=0,Y=z-32,Q=z-12;Y<Q;++Y)R[Y]+=N-16*R[z]*Qt[Y-(z-32)],N=Math.floor((R[Y]+128)/256),R[Y]-=N*256;R[Y]+=N,R[z]=0}for(N=0,Y=0;Y<32;Y++)R[Y]+=N-(R[31]>>4)*Qt[Y],N=R[Y]>>8,R[Y]&=255;for(Y=0;Y<32;Y++)R[Y]-=N*Qt[Y];for(z=0;z<32;z++)R[z+1]+=R[z]>>8,k[z]=R[z]&255}function Xn(k){var R=new Float64Array(64),N;for(N=0;N<64;N++)R[N]=k[N];for(N=0;N<64;N++)k[N]=0;On(k,R)}function xe(k,R,N,z){var Y=new Uint8Array(64),Q=new Uint8Array(64),pe=new Uint8Array(64),ye,ae,me=new Float64Array(64),Me=[r(),r(),r(),r()];xt(Y,z,32),Y[0]&=248,Y[31]&=127,Y[31]|=64;var tt=N+64;for(ye=0;ye<N;ye++)k[64+ye]=R[ye];for(ye=0;ye<32;ye++)k[32+ye]=Y[32+ye];for(xt(pe,k.subarray(32),N+32),Xn(pe),Oe(Me,pe),ve(k,Me),ye=32;ye<64;ye++)k[ye]=z[ye];for(xt(Q,k,N+64),Xn(Q),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(ae=0;ae<32;ae++)me[ye+ae]+=Q[ye]*Y[ae];return On(k.subarray(32),me),tt}function Ae(k,R){var N=r(),z=r(),Y=r(),Q=r(),pe=r(),ye=r(),ae=r();return O(k[2],f),_e(k[1],R),dt(Y,k[1]),je(Q,Y,m),Ve(Y,Y,k[2]),Ee(Q,k[2],Q),dt(pe,Q),dt(ye,pe),je(ae,ye,pe),je(N,ae,Y),je(N,N,Q),ln(N,N),je(N,N,Y),je(N,N,Q),je(N,N,Q),je(k[0],N,Q),dt(z,k[0]),je(z,z,Q),ie(z,Y)&&je(k[0],k[0],v),dt(z,k[0]),je(z,z,Q),ie(z,Y)?-1:(Ce(k[0])===R[31]>>7&&Ve(k[0],c,k[0]),je(k[3],k[0],k[1]),0)}function Ye(k,R,N,z){var Y,Q=new Uint8Array(32),pe=new Uint8Array(64),ye=[r(),r(),r(),r()],ae=[r(),r(),r(),r()];if(N<64||Ae(ae,z))return-1;for(Y=0;Y<N;Y++)k[Y]=R[Y];for(Y=0;Y<32;Y++)k[Y+32]=z[Y];if(xt(pe,k,N),Xn(pe),Be(ye,ae,pe),Oe(ae,R.subarray(32)),Jt(ye,ae),ve(Q,ye),N-=64,B(R,0,Q,0)){for(Y=0;Y<N;Y++)k[Y]=0;return-1}for(Y=0;Y<N;Y++)k[Y]=R[Y+64];return N}var We=32,Fe=24,ft=32,rt=16,Ie=32,mt=32,Xt=32,It=32,nn=32,Bn=Fe,Zi=ft,Mt=rt,wt=64,Zt=32,Kn=64,Wi=32,ja=64;e.lowlevel={crypto_core_hsalsa20:$,crypto_stream_xor:ce,crypto_stream:G,crypto_stream_salsa20_xor:L,crypto_stream_salsa20:X,crypto_onetimeauth:F,crypto_onetimeauth_verify:q,crypto_verify_16:W,crypto_verify_32:B,crypto_secretbox:le,crypto_secretbox_open:be,crypto_scalarmult:tn,crypto_scalarmult_base:Gt,crypto_box_beforenm:Rt,crypto_box_afternm:Kt,crypto_box:ct,crypto_box_open:Ke,crypto_box_keypair:on,crypto_hash:xt,crypto_sign:xe,crypto_sign_keypair:_t,crypto_sign_open:Ye,crypto_secretbox_KEYBYTES:We,crypto_secretbox_NONCEBYTES:Fe,crypto_secretbox_ZEROBYTES:ft,crypto_secretbox_BOXZEROBYTES:rt,crypto_scalarmult_BYTES:Ie,crypto_scalarmult_SCALARBYTES:mt,crypto_box_PUBLICKEYBYTES:Xt,crypto_box_SECRETKEYBYTES:It,crypto_box_BEFORENMBYTES:nn,crypto_box_NONCEBYTES:Bn,crypto_box_ZEROBYTES:Zi,crypto_box_BOXZEROBYTES:Mt,crypto_sign_BYTES:wt,crypto_sign_PUBLICKEYBYTES:Zt,crypto_sign_SECRETKEYBYTES:Kn,crypto_sign_SEEDBYTES:Wi,crypto_hash_BYTES:ja,gf:r,D:m,L:Qt,pack25519:j,unpack25519:_e,M:je,A:Ee,S:dt,Z:Ve,pow2523:ln,add:Jt,set25519:O,modL:On,scalarmult:Be,scalarbase:Oe};function Ql(k,R){if(k.length!==We)throw new Error("bad key size");if(R.length!==Fe)throw new Error("bad nonce size")}function Zl(k,R){if(k.length!==Xt)throw new Error("bad public key size");if(R.length!==It)throw new Error("bad secret key size")}function pn(){for(var k=0;k<arguments.length;k++)if(!(arguments[k]instanceof Uint8Array))throw new TypeError("unexpected type, use Uint8Array")}function _s(k){for(var R=0;R<k.length;R++)k[R]=0}e.randomBytes=function(k){var R=new Uint8Array(k);return s(R,k),R},e.secretbox=function(k,R,N){pn(k,R,N),Ql(N,R);for(var z=new Uint8Array(ft+k.length),Y=new Uint8Array(z.length),Q=0;Q<k.length;Q++)z[Q+ft]=k[Q];return le(Y,z,z.length,R,N),Y.subarray(rt)},e.secretbox.open=function(k,R,N){pn(k,R,N),Ql(N,R);for(var z=new Uint8Array(rt+k.length),Y=new Uint8Array(z.length),Q=0;Q<k.length;Q++)z[Q+rt]=k[Q];return z.length<32||be(Y,z,z.length,R,N)!==0?null:Y.subarray(ft)},e.secretbox.keyLength=We,e.secretbox.nonceLength=Fe,e.secretbox.overheadLength=rt,e.scalarMult=function(k,R){if(pn(k,R),k.length!==mt)throw new Error("bad n size");if(R.length!==Ie)throw new Error("bad p size");var N=new Uint8Array(Ie);return tn(N,k,R),N},e.scalarMult.base=function(k){if(pn(k),k.length!==mt)throw new Error("bad n size");var R=new Uint8Array(Ie);return Gt(R,k),R},e.scalarMult.scalarLength=mt,e.scalarMult.groupElementLength=Ie,e.box=function(k,R,N,z){var Y=e.box.before(N,z);return e.secretbox(k,R,Y)},e.box.before=function(k,R){pn(k,R),Zl(k,R);var N=new Uint8Array(nn);return Rt(N,k,R),N},e.box.after=e.secretbox,e.box.open=function(k,R,N,z){var Y=e.box.before(N,z);return e.secretbox.open(k,R,Y)},e.box.open.after=e.secretbox.open,e.box.keyPair=function(){var k=new Uint8Array(Xt),R=new Uint8Array(It);return on(k,R),{publicKey:k,secretKey:R}},e.box.keyPair.fromSecretKey=function(k){if(pn(k),k.length!==It)throw new Error("bad secret key size");var R=new Uint8Array(Xt);return Gt(R,k),{publicKey:R,secretKey:new Uint8Array(k)}},e.box.publicKeyLength=Xt,e.box.secretKeyLength=It,e.box.sharedKeyLength=nn,e.box.nonceLength=Bn,e.box.overheadLength=e.secretbox.overheadLength,e.sign=function(k,R){if(pn(k,R),R.length!==Kn)throw new Error("bad secret key size");var N=new Uint8Array(wt+k.length);return xe(N,k,k.length,R),N},e.sign.open=function(k,R){if(pn(k,R),R.length!==Zt)throw new Error("bad public key size");var N=new Uint8Array(k.length),z=Ye(N,k,k.length,R);if(z<0)return null;for(var Y=new Uint8Array(z),Q=0;Q<Y.length;Q++)Y[Q]=N[Q];return Y},e.sign.detached=function(k,R){for(var N=e.sign(k,R),z=new Uint8Array(wt),Y=0;Y<z.length;Y++)z[Y]=N[Y];return z},e.sign.detached.verify=function(k,R,N){if(pn(k,R,N),R.length!==wt)throw new Error("bad signature size");if(N.length!==Zt)throw new Error("bad public key size");var z=new Uint8Array(wt+k.length),Y=new Uint8Array(wt+k.length),Q;for(Q=0;Q<wt;Q++)z[Q]=R[Q];for(Q=0;Q<k.length;Q++)z[Q+wt]=k[Q];return Ye(Y,z,z.length,N)>=0},e.sign.keyPair=function(){var k=new Uint8Array(Zt),R=new Uint8Array(Kn);return _t(k,R),{publicKey:k,secretKey:R}},e.sign.keyPair.fromSecretKey=function(k){if(pn(k),k.length!==Kn)throw new Error("bad secret key size");for(var R=new Uint8Array(Zt),N=0;N<R.length;N++)R[N]=k[32+N];return{publicKey:R,secretKey:new Uint8Array(k)}},e.sign.keyPair.fromSeed=function(k){if(pn(k),k.length!==Wi)throw new Error("bad seed size");for(var R=new Uint8Array(Zt),N=new Uint8Array(Kn),z=0;z<32;z++)N[z]=k[z];return _t(R,N,!0),{publicKey:R,secretKey:N}},e.sign.publicKeyLength=Zt,e.sign.secretKeyLength=Kn,e.sign.seedLength=Wi,e.sign.signatureLength=wt,e.hash=function(k){pn(k);var R=new Uint8Array(ja);return xt(R,k,k.length),R},e.hash.hashLength=ja,e.verify=function(k,R){return pn(k,R),k.length===0||R.length===0||k.length!==R.length?!1:I(k,0,R,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 R=65536;e.setPRNG(function(N,z){var Y,Q=new Uint8Array(z);for(Y=0;Y<z;Y+=R)k.getRandomValues(Q.subarray(Y,Y+Math.min(z-Y,R)));for(Y=0;Y<z;Y++)N[Y]=Q[Y];_s(Q)})}else typeof require<"u"&&(k=require("crypto"),k&&k.randomBytes&&e.setPRNG(function(N,z){var Y,Q=k.randomBytes(z);for(Y=0;Y<z;Y++)N[Y]=Q[Y];_s(Q)}))})()})(typeof module<"u"&&module.exports?module.exports:globalThis.nacl=globalThis.nacl||{});const du=typeof module<"u"&&module.exports?module.exports:globalThis.nacl,X2={fromSeed:du.sign.keyPair.fromSeed,sign:du.sign.detached,verify:du.sign.detached.verify,randomBytes:du.randomBytes};let _x;function K2(e){_x=e}function Fi(){return _x}const Q2=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 zu{static checksum(t){let r=0;for(let s=0;s<t.byteLength;s++){let l=t[s];r=r<<8&65535^Q2[(r>>8^l)&255]}return r}static validate(t,r){return zu.checksum(t)==r}}const Ch="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";class M0{static encode(t){let r=0,s=0,l=new Uint8Array(t),o=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 d=s>>>r-5&31;o[c++]=Ch.charAt(d).charCodeAt(0),r-=5}if(r>0){let f=s<<5-r&31;o[c++]=Ch.charAt(f).charCodeAt(0)}return o.slice(0,c)}static decode(t){let r=0,s=0,l=0,o=new Uint8Array(t),c=new Uint8Array(o.byteLength*5/8|0);for(let f=0;f<o.byteLength;f++){let d=String.fromCharCode(o[f]),m=Ch.indexOf(d);if(m===-1)throw new Error("Illegal Base32 character: "+o[f]);s=s<<5|m,r+=5,r>=8&&(c[l++]=s>>>r-8&255,r-=8)}return c.slice(0,l)}}class Ot 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 Z2(){return Qu(Tt.Operator)}function W2(){return Qu(Tt.Account)}function ek(){return Qu(Tt.User)}var St;(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"})(St||(St={}));var Tt;(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"})(Tt||(Tt={}));class ua{static isValidPublicPrefix(t){return t==Tt.Server||t==Tt.Operator||t==Tt.Cluster||t==Tt.Account||t==Tt.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 Tt.Seed:return Tt.Seed;case Tt.Private:return Tt.Private;case Tt.Operator:return Tt.Operator;case Tt.Server:return Tt.Server;case Tt.Cluster:return Tt.Cluster;case Tt.Account:return Tt.Account;case Tt.User:return Tt.User;default:return-1}}}class Ln{static encode(t,r){if(!r||!(r instanceof Uint8Array))throw new Ot(St.SerializationError);if(!ua.isValidPrefix(t))throw new Ot(St.InvalidPrefixByte);return Ln._encode(!1,t,r)}static encodeSeed(t,r){if(!r)throw new Ot(St.ApiError);if(!ua.isValidPublicPrefix(t))throw new Ot(St.InvalidPrefixByte);if(r.byteLength!==32)throw new Ot(St.InvalidSeedLen);return Ln._encode(!0,t,r)}static decode(t,r){if(!ua.isValidPrefix(t))throw new Ot(St.InvalidPrefixByte);const s=Ln._decode(r);if(s[0]!==t)throw new Ot(St.InvalidPrefixByte);return s.slice(1)}static decodeSeed(t){const r=Ln._decode(t),s=Ln._decodePrefix(r);if(s[0]!=Tt.Seed)throw new Ot(St.InvalidSeed);if(!ua.isValidPublicPrefix(s[1]))throw new Ot(St.InvalidPrefixByte);return{buf:r.slice(2),prefix:s[1]}}static _encode(t,r,s){const l=t?2:1,o=s.byteLength,c=l+o+2,f=l+o,d=new Uint8Array(c);if(t){const g=Ln._encodePrefix(Tt.Seed,r);d.set(g)}else d[0]=r;d.set(s,l);const m=zu.checksum(d.slice(0,f));return new DataView(d.buffer).setUint16(f,m,!0),M0.encode(d)}static _decode(t){if(t.byteLength<4)throw new Ot(St.InvalidEncoding);let r;try{r=M0.decode(t)}catch(f){throw new Ot(St.InvalidEncoding,f)}const s=r.byteLength-2,o=new DataView(r.buffer).getUint16(s,!0),c=r.slice(0,s);if(!zu.validate(c,o))throw new Ot(St.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 kx{constructor(t){C(this,"seed");this.seed=t}getRawSeed(){if(!this.seed)throw new Ot(St.ClearedPair);return Ln.decodeSeed(this.seed).buf}getSeed(){if(!this.seed)throw new Ot(St.ClearedPair);return this.seed}getPublicKey(){if(!this.seed)throw new Ot(St.ClearedPair);const t=Ln.decodeSeed(this.seed),r=Fi().fromSeed(this.getRawSeed()),s=Ln.encode(t.prefix,r.publicKey);return new TextDecoder().decode(s)}getPrivateKey(){if(!this.seed)throw new Ot(St.ClearedPair);const t=Fi().fromSeed(this.getRawSeed());return Ln.encode(Tt.Private,t.secretKey)}sign(t){if(!this.seed)throw new Ot(St.ClearedPair);const r=Fi().fromSeed(this.getRawSeed());return Fi().sign(t,r.secretKey)}verify(t,r){if(!this.seed)throw new Ot(St.ClearedPair);const s=Fi().fromSeed(this.getRawSeed());return Fi().verify(t,r,s.publicKey)}clear(){this.seed&&(this.seed.fill(0),this.seed=void 0)}}function Qu(e){const t=Fi().randomBytes(32);let r=Ln.encodeSeed(e,new Uint8Array(t));return new kx(r)}class tk{constructor(t){C(this,"publicKey");this.publicKey=t}getPublicKey(){if(!this.publicKey)throw new Ot(St.ClearedPair);return new TextDecoder().decode(this.publicKey)}getPrivateKey(){throw this.publicKey?new Ot(St.PublicKeyOnly):new Ot(St.ClearedPair)}getSeed(){throw this.publicKey?new Ot(St.PublicKeyOnly):new Ot(St.ClearedPair)}sign(t){throw this.publicKey?new Ot(St.CannotSign):new Ot(St.ClearedPair)}verify(t,r){if(!this.publicKey)throw new Ot(St.ClearedPair);let s=Ln._decode(this.publicKey);return Fi().verify(t,r,s.slice(1))}clear(){this.publicKey&&(this.publicKey.fill(0),this.publicKey=void 0)}}function nk(e){const t=new TextEncoder().encode(e),r=Ln._decode(t),s=ua.parsePrefix(r[0]);if(ua.isValidPublicPrefix(s))return new tk(t);throw new Ot(St.InvalidPublicKey)}function rk(e){return Ln.decodeSeed(e),new kx(e)}function ik(e){return btoa(String.fromCharCode(...e))}function sk(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}K2(X2);const D0={createAccount:W2,createOperator:Z2,createPair:Qu,createUser:ek,fromPublic:nk,fromSeed:rk,NKeysError:Ot,NKeysErrorCode:St,Prefix:Tt,decode:sk,encode:ik};function ak(e){return t=>{let r={};return e.forEach(s=>{const l=s(t)||{};r=Object.assign(r,l)}),r}}function lk(){return()=>{}}function ok(e,t){return()=>{const r=typeof e=="function"?e():e,s=typeof t=="function"?t():t;return{user:r,pass:s}}}function uk(e){return()=>({auth_token:typeof e=="function"?e():e})}function ck(e){return t=>{const r=typeof e=="function"?e():e,s=r?D0.fromSeed(r):void 0,l=s?s.getPublicKey():"",o=Ki.encode(t||""),c=s!==void 0&&t?s.sign(o):void 0,f=c?D0.encode(c):"";return{nkey:l,sig:f}}}function Ex(e,t){return r=>{const s=typeof e=="function"?e():e,l=ck(t),{nkey:o,sig:c}=l(r);return{jwt:s,nkey:o,sig:c}}}const Cx=120*1e3,fk=2,Ax=2*1e3;function hk(){return{maxPingOut:2,maxReconnectAttempts:10,noRandomize:!1,pedantic:!1,pingInterval:Cx,reconnect:!0,reconnectJitter:100,reconnectJitterTLS:1e3,reconnectTimeWait:Ax,tls:void 0,verbose:!1,waitOnFirstConnect:!1,ignoreAuthErrorAbort:!1}}function dk(e){const t=[];return typeof e.authenticator=="function"&&t.push(e.authenticator),Array.isArray(e.authenticator)&&t.push(...e.authenticator),e.token&&t.push(uk(e.token)),e.user&&t.push(ok(e.user,e.pass)),t.length===0?lk():ak(t)}function mk(e){const t=`${td}:${vx()}`;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 Re("port and servers options are mutually exclusive",ke.InvalidOption);e.servers.length===0&&e.port&&(e.servers=[`${td}:${e.port}`]),e.servers&&e.servers.length===0&&(e.servers=[t]);const r=Ju(hk(),e);if(r.authenticator=dk(r),["reconnectDelayHandler","authenticator"].forEach(s=>{if(r[s]&&typeof r[s]!="function")throw new Re(`${s} option should be a function`,ke.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{mi(r.inboxPrefix)}catch(s){throw new Re(s.message,ke.ApiError)}if(r.resolve===void 0&&(r.resolve=typeof od()=="function"),r.resolve&&typeof od()!="function")throw new Re("'resolve' is not supported on this client",ke.InvalidOption);return r}function pk(e,t){const{proto:r,tls_required:s,tls_available:l}=e;if((r===void 0||r<1)&&t.noEcho)throw new Re("noEcho",ke.ServerOptionNotAvailable);const o=s||l||!1;if(t.tls&&!o)throw new Re("tls",ke.ServerOptionNotAvailable)}const gk=1024*32,yk=/^INFO\s+([^\r\n]+)\r\n/i,bk=jl(`PONG\r
72
+ `),L0=jl(`PING\r
73
+ `);class xk{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):{})||{};Ju(this,l)}}class jx extends xn{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");Ju(this,l),this.protocol=r,this.subject=s,this.draining=!1,this.noIterator=typeof l.callback=="function",this.closed=Vt();const o=!((c=r.options)!=null&&c.noAsyncTraces);l.timeout&&(this.timer=ya(l.timeout,o),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}),o=r.protocolFilterFn?r.protocolFilterFn:()=>!0,c=r.dispatchedFn?r.dispatchedFn:()=>{};this.callback=(f,d)=>{const{ingest:m}=l(d);m&&o(d)&&(s(f,d),c(d))}}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(Re.errorForCode(ke.ConnectionClosed)):this.isClosed()?Promise.reject(Re.errorForCode(ke.SubClosed)):(this.drained||(this.draining=!0,this.protocol.unsub(this),this.drained=this.protocol.flush(Vt()).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 vk{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(o=>o.subject===r.subject&&o.queue===r.queue)),r.operation==="publish"&&(l=s.find(o=>o.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 Uu{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=gk,this.outMsgs=0,this.inMsgs=0,this.outBytes=0,this.inBytes=0,this.options=t,this.publisher=r,this.subscriptions=new vk,this.muxSubscriptions=new $2,this.outbound=new xa,this.pongs=[],this.whyClosed="",this.pendingLimit=t.pendingLimit||this.pendingLimit,this.features=new k2({major:0,minor:0,micro:0}),this.connectPromise=null;const s=typeof t.servers=="string"?[t.servers]:t.servers;this.servers=new F2(s,{randomize:!t.noRandomize}),this.closed=Vt(),this.parser=new R0(this),this.heartbeats=new V2(this,this.options.pingInterval||Cx,this.options.maxPingOut||fk)}resetOutbound(){this.outbound.reset();const t=this.pongs;this.pongs=[];const r=Re.errorForCode(ke.Disconnect);r.stack="",t.forEach(s=>{s.reject(r)}),this.parser=new R0(this),this.infoReceived=!1}dispatchStatus(t){this.listeners.forEach(r=>{r.push(t)})}status(){const t=new xn;return this.listeners.push(t),t}prepare(){this.transport&&this.transport.discard(),this.info=void 0,this.resetOutbound();const t=Vt();return t.catch(()=>{}),this.pongs.unshift(t),this.connectError=r=>{t.reject(r)},this.transport=A2(),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:ca.StaleConnection,data:""}),this.transport.disconnect()}reconnect(){return this.connected&&(this.dispatchStatus({type:ca.ClientInitiatedReconnect,data:""}),this.transport.disconnect()),Promise.resolve()}async disconnected(t){this.dispatchStatus({type:fi.Disconnect,data:this.servers.getCurrentServer().toString()}),this.options.reconnect?await this.dialLoop().then(()=>{var r;this.dispatchStatus({type:fi.Reconnect,data:this.servers.getCurrentServer().toString()}),((r=this.lastError)==null?void 0:r.code)===ke.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=ya(this.options.timeout||2e4);const l=this.transport.connect(t,this.options);await Promise.race([l,s]),(async()=>{try{for await(const o of this.transport)this.parser.parse(o)}catch(o){console.log("reader closed",o)}})().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:od(),debug:this.options.debug,randomize:!this.options.noRandomize,resolve:r});let l=null;for(const o of s)try{l=null,this.dispatchStatus({type:ca.Reconnecting,data:o.toString()}),await this.dial(o);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():Ax;let s=r;const l=this.selectServer();if(!l||this.abortReconnect)throw t||(this.lastError?this.lastError:Re.errorForCode(ke.ConnectionRefused));const o=Date.now();if(l.lastConnect===0||l.lastConnect+r<=o){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-o),await Ea(s)}}static async connect(t,r){const s=new Uu(t,r);return await s.dialLoop(),s}static toError(t){const r=t?t.toLowerCase():"";if(r.indexOf("permissions violation")!==-1){const s=new Re(t,ke.PermissionsViolation),l=t.match(/(Publish|Subscription) to "(\S+)"/);if(l){s.permissionContext={operation:l[1].toLowerCase(),subject:l[2],queue:void 0};const o=t.match(/using queue "(\S+)"/);o&&(s.permissionContext.queue=o[1])}return s}else return r.indexOf("authorization violation")!==-1?new Re(t,ke.AuthorizationViolation):r.indexOf("user authentication expired")!==-1?new Re(t,ke.AuthenticationExpired):r.indexOf("account authentication expired")!=-1?new Re(t,ke.AccountExpired):r.indexOf("authentication timeout")!==-1?new Re(t,ke.AuthenticationTimeout):new Re(t,ke.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 Pd(t,r,this)),s.max!==void 0&&s.received>=s.max&&s.unsubscribe())}processError(t){const r=y0(t),s=Uu.toError(r),l={type:fi.Error,data:s.code};if(s.isPermissionError()){let o=!1;if(s.permissionContext){l.permissionContext=s.permissionContext;const c=this.subscriptions.getMux();o=(c==null?void 0:c.subject)===s.permissionContext.subject}this.subscriptions.handleError(s),this.muxSubscriptions.handleError(o,s),o&&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(bk)}processPong(){const t=this.pongs.shift();t&&t.resolve()}processInfo(t){const r=JSON.parse(y0(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(bs(r.version)),this.infoReceived=!0,this.transport.isEncrypted()&&this.servers.updateTLSName();const{version:o,lang:c}=this.transport;try{const f=new xk({version:o,lang:c},this.options,r.nonce);r.headers&&(f.headers=!0,f.no_responders=!0);const d=JSON.stringify(f);this.transport.send(jl(`CONNECT ${d}${ku}`)),this.transport.send(L0)}catch(f){this._close(f)}}s&&this.dispatchStatus({type:fi.Update,data:s}),(r.ldm!==void 0?r.ldm:!1)&&this.dispatchStatus({type:fi.LDM,data:this.servers.getCurrentServer().toString()})}push(t){switch(t.kind){case Dn.MSG:{const{msg:r,data:s}=t;this.processMsg(r,s);break}case Dn.OK:break;case Dn.ERR:this.processError(t.data);break;case Dn.PING:this.processPing();break;case Dn.PONG:this.processPong();break;case Dn.INFO:this.processInfo(t.data);break}}sendCommand(t,...r){const s=this.outbound.length();let l;typeof t=="string"?l=jl(t):l=t,this.outbound.fill(l,...r),s===0?queueMicrotask(()=>{this.flushPending()}):this.outbound.size()>=this.pendingLimit&&this.flushPending()}publish(t,r=cr,s){let l;if(r instanceof Uint8Array)l=r;else if(typeof r=="string")l=Ki.encode(r);else throw Re.errorForCode(ke.BadPayload);let o=l.length;s=s||{},s.reply=s.reply||"";let c=cr,f=0;if(s.headers){if(this.info&&!this.info.headers)throw new Re("headers",ke.ServerOptionNotAvailable);c=s.headers.encode(),f=c.length,o=l.length+f}if(this.info&&o>this.info.max_payload)throw Re.errorForCode(ke.MaxPayloadExceeded);this.outBytes+=o,this.outMsgs++;let d;s.headers?(s.reply?d=`HPUB ${t} ${s.reply} ${f} ${o}\r
74
+ `:d=`HPUB ${t} ${f} ${o}\r
75
+ `,this.sendCommand(d,c,l,Lu)):(s.reply?d=`PUB ${t} ${s.reply} ${o}\r
76
+ `:d=`PUB ${t} ${o}\r
77
77
  `,this.sendCommand(d,l,Lu))}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
78
  `):this.sendCommand(`SUB ${t.subject} ${t.sid}\r
79
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
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=Vt()),this.pongs.push(t),this.outbound.fill(D0),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}${ku}`):t.push(`SUB ${s.subject} ${s.sid}${ku}`)}),t.length&&this.transport.send(jl(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 Tx(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 xk="$SRV";class L0{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||gi(),(u=l.headers)==null||u.set(Tu,`${t}`),(c=l.headers)==null||c.set(Nu,r),this.msg.respond(s,l)}json(t){return this.msg.json(t)}string(){return this.msg.string()}}class Bl{constructor(t,r="",s=""){C(this,"subject");C(this,"queue");C(this,"srv");r!==""&&wk("service group",r);let l="";if(t instanceof Gl)this.srv=t,l="";else if(t instanceof Bl){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;Cl("endpoint",t);let{subject:l,handler:u,metadata:c,queue:f}=s;l=l||t,f=f||this.queue,vk("endpoint subject",l),l=this.calcSubject(this.subject,l);const d={name:t,subject:l,queue:f,handler:u,metadata:c};return this.srv._addEndpoint(d)}addGroup(t="",r=""){return new Bl(this,t,r)}}function vk(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 wk(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 Gl{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"),Cl("name",this.config.name),Cl("queue",this.config.queue),bs(this.config.version),this._id=Gi.next(),this.internal=[],this._done=Vt(),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??xk;return r===""&&s===""?`${u}.${t}`:(Cl("control subject name",r),s!==""?(Cl("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=gi();if(t instanceof Ou){const s=t;r.set(Nu,s.message),r.set(Tu,`${s.code}`)}else r.set(Nu,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 Sk(l,u,s),f.queue=s;const d=c?(m,y)=>{if(m){this.close(m);return}const g=Date.now();try{c(m,new L0(y))}catch(x){f.stats.countError(x),y==null||y.respond(ur,{headers:this.errorToHeader(x)})}finally{f.stats.countLatency(g)}}:void 0;return f.sub=this.nc.subscribe(u,{callback:d,queue:s}),f.sub.closed.then(()=>{this._stopped||this.close(new Error(`required subscription ${t.subject} stopped`)).catch()}).catch(m=>{if(!this._stopped){const y=new Error(`required subscription ${t.subject} errored: ${m.message}`);y.stack=m.stack,this.close(y).catch()}}),f}info(){return{type:Nl.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:Nl.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=Gl.controlSubject(r,l,u),c.handler=s,this.setupHandler(c,!0)}start(){const t=Mr(),r=(c,f)=>c?(this.close(c),Promise.reject(c)):this.stats().then(d=>(f==null||f.respond(t.encode(d)),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($i.PING,u),this.addInternalHandler($i.STATS,r),this.addInternalHandler($i.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:Nl.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 Bl(this,t,r)}addEndpoint(t,r){return new Bl(this).addEndpoint(t,r)}_addEndpoint(t){const r=new xn;r.noIterator=typeof t.handler=="function",r.noIterator||(t.handler=(l,u)=>{l?this.stop(l).catch():r.push(new L0(u))},r.iterClosed.then(()=>{this.close().catch()}));const s=this.setupHandler(t,!1);return s.qi=r,this.handlers.push(s),r}}class Sk{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+=$t(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:d,queue:m}=this;return{name:t,subject:r,average_processing_time:s,num_errors:l,num_requests:u,processing_time:c,last_error:f,data:d,queue_group:m}}stats(t){const r=t;return(r==null?void 0:r.noIterator)===!1&&(this.processing_time=$t(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 _k{constructor(t,r={strategy:Rr.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($i.PING,t,r)}stats(t="",r=""){return this.q($i.STATS,t,r)}info(t="",r=""){return this.q($i.INFO,t,r)}async q(t,r="",s=""){const l=new xn,u=Mr(),c=Gl.controlSubject(t,r,s,this.prefix),f=await this.nc.requestMany(c,ur,this.opts);return(async()=>{for await(const d of f)try{const m=u.decode(d.data);l.push(m)}catch(m){l.push(()=>{l.stop(m)})}l.push(()=>{l.stop()})})().catch(d=>{l.stop(d)}),l}}function Ox(){return{key:{encode(e){return e},decode(e){return e}},value:{encode(e){return e},decode(e){return e}}}}function kk(){return{replicas:1,history:1,timeout:2e3,max_bytes:-1,maxValueSize:-1,codec:Ox(),storage:sd.File}}const Pu="KV-Operation",z0="$KV",Ek=/^[-/=.\w]+$/,Ck=/^[-/=.>*\w]+$/,Ak=/^[-\w]+$/;function jk(e){if(e.startsWith(".")||e.endsWith(".")||!Ek.test(e))throw new Error(`invalid key: ${e}`)}function Nk(e){if(e.startsWith(".")||e.endsWith(".")||!Ck.test(e))throw new Error(`invalid key: ${e}`)}function Tk(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 Eu(e){if(!Ak.test(e))throw new Error(`invalid bucket name: ${e}`)}var Ir;(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"})(Ir||(Ir={}));class Hl{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",jk);C(this,"validateSearchKey",Nk);C(this,"hasWildcards",Tk);Eu(t),this.js=r,this.jsm=s,this.bucket=t,this.prefix=z0,this.editPrefix="",this.useJsPrefix=!1,this._prefixLen=0}static async create(t,r,s={}){Eu(r);const l=await t.jetstreamManager(),u=new Hl(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}};Eu(r);const c=new Hl(r,t,l);return u.config.name=s.streamName??c.bucketName(),Object.assign(c,u),c.stream=u.config.name,c.codec=s.codec||Ox(),c.direct=u.config.allow_direct??!1,c.initializePrefixes(u),c}async init(t={}){const r=Object.assign(kk(),t);this.codec=r.codec;const s={};this.stream=s.name=t.streamName??this.bucketName(),s.retention=id.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(sr)||(g.name=`${sr}${g.name}`),s.mirror=g,s.mirror_direct=!0}else if(t.sources){const g=t.sources.map(x=>{const v=Object.assign({},x),S=v.name.startsWith(sr)?v.name.substring(sr.length):v.name;return v.name.startsWith(sr)||(v.name=`${sr}${v.name}`),!x.external&&S!==this.bucket&&(v.subject_transforms=[{src:`$KV.${S}.>`,dest:`$KV.${this.bucket}.>`}]),v});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?Ji.S2:Ji.None);const u=this.js.nc,c=u.getServerVersion(),f=c?ld(c,bs("2.7.2"))>=0:!1;s.discard=f?Pl.New:Pl.Old;const{ok:d,min:m}=u.features.get(pt.JS_ALLOW_DIRECT);if(!d&&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 ${m}`))}t.allow_direct=typeof t.allow_direct=="boolean"?t.allow_direct:d,s.allow_direct=t.allow_direct,this.direct=s.allow_direct,s.num_replicas=r.replicas,r.ttl&&(s.max_age=$t(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(sr)&&(s=s.substring(sr.length)),r.external&&r.external.api!==""){const l=r.name.substring(sr.length);this.useJsPrefix=!1,this.prefix=`$KV.${l}`,this.editPrefix=`${r.external.api}.$KV.${s}`}else this.editPrefix=this.prefix}}bucketName(){return this.stream??`${sr}${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}`:`${z0}.${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(Un.MessageSizeHdr)||"";return s!==""?parseInt(s,10):t.length}smToEntry(t){return new Vk(this.bucket,this.prefixLen,t)}jmToEntry(t){const r=this.decodeKey(t.subject.substring(this.prefixLen));return new Yk(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 d=gi();u.headers=d,d.set(Ir.ExpectedLastSubjectSequenceHdr,`${s.previousSeq}`)}try{return(await this.js.publish(this.subjectForKey(l,!0),r,u)).seq}catch(d){const m=d;return m.isJetStreamError()?(m.message=(c=m.api_error)==null?void 0:c.description,m.code=`${(f=m.api_error)==null?void 0:f.code}`,Promise.reject(m)):Promise.reject(d)}}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===ke.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=Vt(),s=[],l=await this.watch({key:">",initializedFn:()=>{r.resolve()}});(async()=>{for await(const d of l)(d.operation==="DEL"||d.operation==="PURGE")&&s.push(d)})().then(),await r,l.stop();const u=Date.now()-t,c=s.map(d=>{const m=this.subjectForKey(d.key);return d.created.getTime()>=u?this.jsm.streams.purge(this.stream,{filter:m,keep:1}):this.jsm.streams.purge(this.stream,{filter:m,keep:0})}),f=await Promise.all(c);return f.unshift({success:!0,purged:0}),f.reduce((d,m)=>(d.purged+=m.purged,d))}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=gi();u.set(Pu,r),r==="PURGE"&&u.set(Un.RollupHdr,Un.RollupValueSubject),s!=null&&s.previousSeq&&u.set(Ir.ExpectedLastSubjectSequenceHdr,`${s.previousSeq}`),await this.js.publish(this.subjectForKey(l,!0),ur,{headers:u})}_buildCC(t,r,s={}){let u=(Array.isArray(t)?t:[t]).map(d=>{const m=this.encodeKey(d);return this.validateSearchKey(d),this.fullKeyName(m)}),c=an.LastPerSubject;r===Tr.AllHistory&&(c=an.All),r===Tr.UpdatesOnly&&(c=an.New);let f;return u.length===1&&(f=u[0],u=void 0),Object.assign({deliver_policy:c,ack_policy:bn.None,filter_subjects:u,filter_subject:f,flow_control:!0,idle_heartbeat:$t(5*1e3)},s)}remove(t){return this.purge(t)}async history(t={}){const r=t.key??">",s=new xn,l={};l.headers_only=t.headers_only||!1;let u;u=()=>{s.stop()};let c=0;const f=this._buildCC(r,Tr.AllHistory,l),d=f.filter_subject,m=Yi(f);m.bindStream(this.stream),m.orderedConsumer(),m.callback((g,x)=>{if(g){s.stop(g);return}if(x){const v=this.jmToEntry(x);s.push(v),s.received++,(u&&c>0&&s.received>=c||x.info.pending===0)&&(s.push(u),u=void 0)}});const y=await this.js.subscribe(d,m);if(u){const{info:{last:g}}=y,x=g.num_pending+g.delivered.consumer_seq;if(x===0||s.received>=x)try{u()}catch(v){s.stop(v)}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(pt.JS_NEW_CONSUMER_CREATE_API);return s}async watch(t={}){const r=t.key??">",s=new xn,l={};l.headers_only=t.headers_only||!1;let u=Tr.LastValue;t.include===Tr.AllHistory?u=Tr.AllHistory:t.include===Tr.UpdatesOnly&&(u=Tr.UpdatesOnly);const c=t.ignoreDeletes===!0;let f=t.initializedFn,d=0;const m=this._buildCC(r,u,l),y=m.filter_subject,g=Yi(m);this.canSetWatcherName()&&g.consumerName(Gi.next()),g.bindStream(this.stream),t.resumeFromRevision&&t.resumeFromRevision>0&&g.startSequence(t.resumeFromRevision),g.orderedConsumer(),g.callback((v,S)=>{if(v){s.stop(v);return}if(S){const j=this.jmToEntry(S);if(c&&j.operation==="DEL")return;s.push(j),s.received++,f&&(d>0&&s.received>=d||S.info.pending===0)&&(s.push(f),f=void 0)}});const x=await this.js.subscribe(y,g);if(f){const{info:{last:v}}=x,S=v.num_pending+v.delivered.consumer_seq;if(S===0||s.received>=S)try{f()}catch(j){s.stop(j)}finally{f=void 0}else d=S}return s._data=x,s.iterClosed.then(()=>{x.unsubscribe()}),x.closed.then(()=>{s.stop()}).catch(v=>{s.stop(v)}),s}async keys(t=">"){const r=new xn,s=this._buildCC(t,Tr.LastValue,{headers_only:!0}),l=Array.isArray(t)?">":s.filter_subject,u=Yi(s);u.bindStream(this.stream),u.orderedConsumer();const c=await this.js.subscribe(l,u);return(async()=>{var d;for await(const m of c){const y=(d=m.headers)==null?void 0:d.get(Pu);if(y!=="DEL"&&y!=="PURGE"){const g=this.decodeKey(m.subject.substring(this.prefixLen));r.push(g)}m.info.pending===0&&c.unsubscribe()}})().then(()=>{r.stop()}).catch(d=>{r.stop(d)}),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 Rx(l,r)}}class Rx{constructor(t,r=""){C(this,"si");C(this,"cluster");this.si=t,this.cluster=r}get bucket(){return this.si.config.name.startsWith(sr)?this.si.config.name.substring(sr.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 Ud(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!==Ji.None:!1}}const Hd="OBJ_",U0="SHA-256=";function Ok(e){return Eu(e),`${Hd}${e}`}function Rk(e){return e.startsWith(Hd)?e.substring(4):e}class fd{constructor(t){C(this,"si");C(this,"backingStore");this.si=t,this.backingStore="JetStream"}get bucket(){return Rk(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!==Ji.None:!1}}function mu(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 Fr;(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"})(Fr||(Fr={}));var ma;(function(e){e.DebugEvent="debug",e.Discard="discard",e.Reset="reset",e.Next="next"})(ma||(ma={}));const P0=Uint8Array.of(43,65,67,75),Mk=Uint8Array.of(45,78,65,75),vl=Uint8Array.of(43,87,80,73),Dk=Uint8Array.of(43,78,88,84),Lk=Uint8Array.of(43,84,69,82,77),zk=Uint8Array.of(32);function ql(e,t=5e3){return new Wk(e,t)}class Ah extends xn{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=mi(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(d=>{if(this.cleanupHandler)try{this.cleanupHandler(d)}catch{}});const{sub:f}=this;f&&f.unsubscribe(),this.sub=this.consumer.api.nc.subscribe(this.inbox,{callback:(d,m)=>{var g,x,v,S;if(d){this.stop(d);return}if((g=this.monitor)==null||g.work(),m.subject===this.inbox){if(rd(m))return;const j=(x=m.headers)==null?void 0:x.code,D=((S=(v=m.headers)==null?void 0:v.description)==null?void 0:S.toLowerCase())||"unknown",{msgsLeft:T,bytesLeft:P}=this.parseDiscard(m.headers);if(T>0||P>0)this.pending.msgs-=T,this.pending.bytes-=P,this.pending.requests--,this.notify(ma.Discard,{msgsLeft:T,bytesLeft:P});else if(j===400){this.stop(new Re(D,`${j}`));return}else if(j===409&&D==="consumer deleted"){if(this.notify(Fr.ConsumerDeleted,`${j} ${D}`),!this.refilling||this.abortOnMissingResource){const I=new Re(D,`${j}`);this.stop(I);return}}else if(j===503){if(this.notify(Fr.NoResponders,`${j} No Responders`),!this.refilling||this.abortOnMissingResource){const I=new Re("no responders",`${j}`);this.stop(I);return}}else this.notify(ma.DebugEvent,`${j} ${D}`)}else this._push(ql(m,this.consumer.api.timeout)),this.received++,this.pending.msgs&&this.pending.msgs--,this.pending.bytes&&(this.pending.bytes-=m.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 j=this.pullOptions();this.pull(j)}}else this.pending.requests===0&&this._push(()=>{this.stop()})}}),this.sub.closed.then(()=>{this.sub.draining&&this._push(()=>{this.stop()})}),l&&(this.monitor=new Bd(l,d=>(this.notify(Fr.HeartbeatsMissed,d),this.resetPending().then(()=>{}).catch(()=>{}),!1),{maxOut:2})),(async()=>{var m;const d=this.consumer.api.nc.status();this.statusIterator=d;for await(const y of d)switch(y.type){case fi.Disconnect:(m=this.monitor)==null||m.cancel();break;case fi.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=zd([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(Fr.StreamNotFound,s),!this.refilling||this.abortOnMissingResource)return this.stop(c),!1}else if(c.message==="consumer not found"){if(r++,this.notify(Fr.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),d=Ea(f);await Promise.race([d,this.consumer.api.nc.closed()]),d.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(ma.Next,r)})}pullOptions(){const r=this.opts.max_messages-this.pending.msgs,s=this.opts.max_bytes-this.pending.bytes,l=$t(this.opts.idle_heartbeat),u=$t(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(Un.PendingMessagesHdr);l&&(s.msgsLeft=parseInt(l));const u=r==null?void 0:r.get(Un.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 xn;return this.listeners.push(r),Promise.resolve(r)}}class Uk extends xn{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 xn;return this.listeners.push(r),Promise.resolve(r)}}class hd{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 Ah(this,t,!0))}fetch(t={max_messages:100,expires:3e4}){const r=new Ah(this,t,!1),s=Math.round(r.opts.expires*1.05),l=ya(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=Vt(),s=t;s.max_messages=1;const l=new Ah(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===Fr.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=ya(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 Pk{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=Gi.next(),typeof s.name_prefix=="string"&&(Xu("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:an.StartSequence,opt_start_seq:t,ack_policy:bn.None,inactive_threshold:$t(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||an.StartSequence,(this.consumerOpts.deliver_policy===an.LastPerSubject||this.consumerOpts.deliver_policy===an.New||this.consumerOpts.deliver_policy===an.Last)&&(delete s.opt_start_seq,s.deliver_policy=this.consumerOpts.deliver_policy),s.deliver_policy===an.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=an.StartTime,s.opt_start_time=this.consumerOpts.opt_start_time),this.consumerOpts.inactive_threshold&&(s.inactive_threshold=$t(this.consumerOpts.inactive_threshold))),s}async resetConsumer(t=0){var c,f,d,m,y;Gi.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=zd([((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),(d=this.iter)==null||d.notify(Fr.OrderedConsumerRecreated,u.name);break}catch(x){if(x.message==="stream not found"&&((m=this.iter)==null||m.notify(Fr.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 Ea(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 d,m;r=r||{};const s=r.fromFetch||!1,l=r.orderedReset||!1;if(this.type===Sr.Fetch&&l){(d=this.iter)==null||d.src.stop(),await((m=this.iter)==null?void 0:m.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 Uk),this.consumer=new hd(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(ma.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=Vt();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 dd{constructor(t){C(this,"api");C(this,"notified");this.api=t,this.notified=!1}checkVersion(){const t=this.api.nc.features.get(pt.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 hd(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 hd(this.api,s)).catch(s=>Promise.reject(s)))}async ordered(t,r){await this.checkVersion();const s=this.api;return new qd(s.nc,s.opts).info(t).then(u=>Promise.resolve(new Pk(this.api,t,r))).catch(u=>Promise.reject(u))}}class Zu{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 Zu(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 dd(new Du(this.api.nc,this.api.opts)).getPullConsumerFor(t)}getConsumer(t){return new dd(new Du(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 qd extends Yl{constructor(t,r){super(t,r)}checkStreamConfigVersions(t){const r=this.nc;if(t.metadata){const{min:l,ok:u}=r.features.get(pt.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(pt.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(pt.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(pt.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(pt.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:d,ok:m}=r.features.get(pt.JS_STREAM_SOURCE_SUBJECT_TRANSFORM);if(!m)throw new Error(`${l} 'subject_transforms' requires server ${d}`)}}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),Mn(t.name),t.mirror=mu(t.mirror),t.sources=(l=t.sources)==null?void 0:l.map(mu);const s=await this._request(`${this.prefix}.STREAM.CREATE.${t.name}`,t);return this._fixInfo(s),s}async delete(t){return Mn(t),(await this._request(`${this.prefix}.STREAM.DELETE.${t}`)).success}async update(t,r={}){var f;if(typeof t=="object"){const d=t;t=d.name,r=d,console.trace("\x1B[33m >> streams.update(config: StreamConfig) api changed to streams.update(name: string, config: StreamUpdateConfig) - this shim will be removed - update your code. \x1B[0m")}this.checkStreamConfigVersions(r),Mn(t);const s=await this.info(t),l=Object.assign(s.config,r);l.mirror=mu(l.mirror),l.sources=(f=l.sources)==null?void 0:f.map(mu);const c=await this._request(`${this.prefix}.STREAM.UPDATE.${t}`,l);return this._fixInfo(c),c}async info(t,r){Mn(t);const s=`${this.prefix}.STREAM.INFO.${t}`;let u=await this._request(s,r),{total:c,limit:f}=u,d=u.state.subjects?Object.getOwnPropertyNames(u.state.subjects).length:1;if(c&&c>d){const m=[u],y=r||{};let g=0;for(;c>d;){g++,y.offset=f*g;const v=await this._request(s,y);c=v.total,m.push(v);const S=Object.getOwnPropertyNames(v.state.subjects).length;if(d+=S,S<f)break}let x={};for(let v=0;v<m.length;v++)u=m[v],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 Al(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 Mn(t),await this._request(`${this.prefix}.STREAM.PURGE.${t}`,r)}async deleteMessage(t,r,s=!0){Mn(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){Mn(t);const l=await this._request(`${this.prefix}.STREAM.MSG.GET.${t}`,r);return new Mx(l)}find(t){return this.findStream(t)}listKvs(){const t=s=>{var d;const u=s.streams.filter(m=>m.config.name.startsWith(sr));u.forEach(m=>{this._fixInfo(m)});let c="";return u.length&&(c=((d=this.nc.info)==null?void 0:d.cluster)??""),u.map(m=>new Rx(m,c))},r=`${this.prefix}.STREAM.LIST`;return new Al(r,t,this)}listObjectStores(){const t=s=>{const u=s.streams.filter(f=>f.config.name.startsWith(Hd));return u.forEach(f=>{this._fixInfo(f)}),u.map(f=>new fd(f))},r=`${this.prefix}.STREAM.LIST`;return new Al(r,t,this)}names(t=""){const r=t!=null&&t.length?{subject:t}:{},s=u=>u.streams,l=`${this.prefix}.STREAM.NAMES`;return new Al(l,s,this,r)}async get(t){const r=await this.info(t);return Promise.resolve(new Zu(this,r))}}class Bk extends Yl{constructor(t,r){super(t,r)}async getMessage(t,r){Mn(t);let s=r;const{last_by_subj:l}=s;l&&(s=null);const u=s?this.jc.encode(s):ur,c=this.opts.apiPrefix||"$JS.API",f=l?`${c}.DIRECT.GET.${t}.${l}`:`${c}.DIRECT.GET.${t}`,d=await this.nc.request(f,u,{timeout:this.timeout}),m=ha(d);if(m)return Promise.reject(m);const y=new md(d);return Promise.resolve(y)}async getBatch(t,r){Mn(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,(d,m)=>d==="up_to_time"&&m instanceof Date?m.toISOString():m),c=new xn,f=await this.nc.requestMany(l,u,{strategy:Rr.SentinelMsg});return(async()=>{var g,x,v;let d=!1,m=!1,y;for await(const S of f){if(!d){d=!0;const j=((g=S.headers)==null?void 0:g.code)||0;if(j!==0&&j<200||j>299){y=(x=S.headers)==null?void 0:x.description.toLowerCase();break}if(((v=S.headers)==null?void 0:v.get("Nats-Num-Pending"))===""){m=!0;break}}if(S.data.length===0)break;c.push(new md(S))}c.push(()=>{if(m)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 md{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(oa.Subject)}get seq(){const t=this.header.last(oa.Sequence);return typeof t=="string"?parseInt(t):0}get time(){return new Date(Date.parse(this.timestamp))}get timestamp(){return this.header.last(oa.TimeStamp)}get stream(){return this.header.last(oa.Stream)}json(t){return Mr(t).decode(this.data)}string(){return ar.decode(this.data)}}C(md,"jc");class Hk extends Yl{constructor(r,s){super(r,s);C(this,"streams");C(this,"consumers");C(this,"direct");this.streams=new qd(r,s),this.consumers=new Du(r,s),this.direct=new Bk(r,s)}async getAccountInfo(){return await this._request(`${this.prefix}.INFO`)}jetstream(){return this.nc.jetstream(this.getOptions())}advisories(){const r=new xn;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 Mx{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):ur}get header(){if(!this._header)if(this.smr.message.hdrs){const t=this._parse(this.smr.message.hdrs);this._header=Vi.decode(t)}else this._header=gi();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 Mr(t).decode(this.data)}string(){return ar.decode(this.data)}}C(Mx,"jc");class qk{constructor(t){C(this,"api");this.api=t}get(t){return this.api.info(t).then(r=>new Zu(this.api,r))}}class jh{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=Vi.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 B0(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 Ik(){return new ReadableStream({pull(e){e.enqueue(new Uint8Array(0)),e.close()}})}class Ol{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 jh(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=Mr().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 fd(t)))}async status(t){const r=await this._si(t);return r===null?Promise.reject(new Error("object store not found")):Promise.resolve(new fd(r))}destroy(){return this.jsm.streams.delete(this.stream)}async _put(t,r,s){var W;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,d=(f==null?void 0:f.max_payload)||1024;t=t||{},t.options=t.options||{};let m=((W=t.options)==null?void 0:W.max_chunk_size)||128*1024;m=m>d?d:m,t.options.max_chunk_size=m;const y=await this.info(t.name),{name:g,error:x}=this._checkNotEmpty(t.name);if(x)return Promise.reject(x);const v=Gi.next(),S=this._chunkSubject(v),j=this._metaSubject(g),D=Object.assign({bucket:this.name,nuid:v,size:0,chunks:0},B0(t)),T=Vt(),P=[],I=new xa;try{const B=r?r.getReader():null,R=j0.create();for(;;){const{done:Z,value:F}=B?await B.read():{done:!0,value:void 0};if(Z){if(I.size()>0){const G=I.drain();R.update(G),D.chunks++,D.size+=G.length,P.push(this.js.publish(S,G,{timeout:u}))}await Promise.all(P),P.length=0,D.mtime=new Date().toISOString();const V=da.encode(R.digest());D.digest=`${U0}${V}`,D.deleted=!1;const L=gi();typeof c=="number"&&L.set(Ir.ExpectedLastSubjectSequenceHdr,`${c}`),L.set(Un.RollupHdr,Un.RollupValueSubject);const X=await this.js.publish(j,Mr().encode(D),{headers:L,timeout:u});if(D.revision=X.seq,y)try{await this.jsm.streams.purge(this.stream,{filter:`$O.${this.name}.C.${y.nuid}`})}catch{}T.resolve(new jh(D));break}if(F)for(I.fill(F);I.size()>m;){D.chunks++,D.size+=m;const V=I.drain(t.options.max_chunk_size);R.update(V),P.push(this.js.publish(S,V,{timeout:u}))}}}catch(B){await this.jsm.streams.purge(this.stream,{filter:S}),T.reject(B)}return T}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 xa,f=u.getReader();for(;;){const{done:d,value:m}=await f.read();if(d)return c.drain();m&&m.length&&c.fill(m)}}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 Ol.create(this.js,r.options.link.bucket):this).get(g)}if(!r.digest.startsWith(U0))return Promise.reject(new Error(`unknown digest type: ${r.digest}`));const s=ad(r.digest.substring(8));if(s===null)return Promise.reject(new Error(`unable to parse digest: ${r.digest}`));const l=Vt(),u={info:new jh(r),error:l};if(r.size===0)return u.data=Ik(),l.resolve(null),Promise.resolve(u);let c;const f=Yi();f.orderedConsumer();const d=j0.create(),m=`$O.${this.name}.C.${r.nuid}`,y=await this.js.subscribe(m,f);return(async()=>{for await(const g of y)g.data.length>0&&(d.update(g.data),c.enqueue(g.data)),g.info.pending===0&&(b2(s,d.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 Ol))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 d=await this.info(t);return Promise.resolve(d)}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=Mr(),l=gi();return l.set(Un.RollupHdr,Un.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 d=await this.info(r.name);if(d&&!d.deleted)return Promise.reject(new Error("an object already exists with that name"))}r.name=l;const c=Object.assign({},s,B0(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 xn,l=this._metaSubjectAll();try{await this.jsm.streams.getMessage(this.stream,{last_by_subj:l})}catch(d){d.code==="404"?(s.push(null),r=!0):s.stop(d)}const u=Mr(),c=Yi();c.orderedConsumer(),t.includeHistory?c.deliverLastPerSubject():(r=!0,c.deliverNew()),c.callback((d,m)=>{var y;if(d){s.stop(d);return}if(m!==null){const g=u.decode(m.data);g.deleted&&t.ignoreDeletes===!0||s.push(g),((y=m.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(d=>{s.stop(d)}),s}_chunkSubject(t){return`$O.${this.name}.C.${t}`}_metaSubject(t){return`$O.${this.name}.M.${da.encode(t)}`}_metaSubjectAll(){return`$O.${this.name}.M.>`}async init(t={}){try{this.stream=Ok(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=Pl.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?Ji.S2:Ji.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 Ol(r,l,t);return await u.init(s),Promise.resolve(u)}}class Fk{constructor(t){C(this,"js");this.js=t}kv(t,r={}){const s=this.js,{ok:l,min:u}=s.nc.features.get(pt.JS_KV);return l?r.bindOnly?Hl.bind(this.js,t,r):Hl.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(pt.JS_OBJECTSTORE);return l?Ol.create(this.js,t,r):Promise.reject(new Error(`objectstore is only supported on servers ${u} or better`))}}class Id extends Yl{constructor(r,s){super(r,s);C(this,"consumers");C(this,"streams");C(this,"consumerAPI");C(this,"streamAPI");this.consumerAPI=new Du(r,s),this.streamAPI=new qd(r,s),this.consumers=new dd(this.consumerAPI),this.streams=new qk(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 Fk(this)}async publish(r,s=ur,l){l=l||{},l.expect=l.expect||{};const u=(l==null?void 0:l.headers)||gi();l&&(l.msgID&&u.set(Ir.MsgIdHdr,l.msgID),l.expect.lastMsgID&&u.set(Ir.ExpectedLastMsgIdHdr,l.expect.lastMsgID),l.expect.streamName&&u.set(Ir.ExpectedStreamHdr,l.expect.streamName),typeof l.expect.lastSequence=="number"&&u.set(Ir.ExpectedLastSeqHdr,`${l.expect.lastSequence}`),typeof l.expect.lastSubjectSequence=="number"&&u.set(Ir.ExpectedLastSubjectSequenceHdr,`${l.expect.lastSubjectSequence}`));const c=l.timeout||this.timeout,f={};c&&(f.timeout=c),l&&(f.headers=u);let{retries:d,retry_delay:m}=l;d=d||1,m=m||250;let y;for(let x=0;x<d;x++)try{y=await this.nc.request(r,s,f);break}catch(v){if(v.code==="503"&&x+1<d)await Ea(m);else throw v}const g=this.parseJsResponse(y);if(g.stream==="")throw Re.errorForCode(ke.JetStreamInvalidAck);return g.duplicate=g.duplicate?g.duplicate:!1,g}async pull(r,s,l=0){Mn(r),fa(s);let u=this.timeout;l>u&&(u=l),l=l<0?0:$t(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}),d=ha(f);if(d)throw d;return ql(f,this.timeout)}fetch(r,s,l={}){Mn(r),fa(s);let u=null;const c=(l.max_bytes??0)>0;let f=0;const d=c?l.max_bytes:0;let m=null;const y={};if(y.batch=l.batch||1,d){const P=this.nc.features.get(pt.JS_PULL_MAX_BYTES);if(!P.ok)throw new Error(`max_bytes is only supported on servers ${P.min} or better`);y.max_bytes=d}y.no_wait=l.no_wait||!1,y.no_wait&&y.expires&&(y.expires=0);const g=l.expires||0;if(g&&(y.expires=$t(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=$t(x),l.delay_heartbeat===!0&&(y.idle_heartbeat=$t(x*4)));const v=new xn,S=y.batch;let j=0;v.protocolFilterFn=(P,I=!1)=>rd(P.msg)?(m==null||m.work(),!1):!0,v.dispatchedFn=P=>{if(P){if(c&&(f+=P.data.length),j++,u&&P.info.pending===0)return;(v.getPending()===1&&P.info.pending===0||S===j||d>0&&f>=d)&&v.stop()}};const D=mi(this.nc.options.inboxPrefix),T=this.nc.subscribe(D,{max:l.batch,callback:(P,I)=>{P===null&&(P=ha(I)),P!==null?(u&&(u.cancel(),u=null),W_(P)?v.stop(Lx(P)===null?void 0:P):v.stop(P)):(m==null||m.work(),v.received++,v.push(ql(I,this.timeout)))}});return g&&(u=ya(g),u.catch(()=>{T.isClosed()||(T.drain().catch(()=>{}),u=null),m&&m.cancel()})),(async()=>{try{x&&(m=new Bd(x,P=>(v.push(()=>{v.err=new Re(`${_r.IdleHeartbeatMissed}: ${P}`,ke.JetStreamIdleHeartBeat)}),!0)))}catch{}await T.closed,u!==null&&(u.cancel(),u=null),m&&m.cancel(),v.stop()})().catch(),this.nc.publish(`${this.prefix}.CONSUMER.MSG.NEXT.${r}.${s}`,this.jc.encode(y),{reply:D}),v}async pullSubscribe(r,s=Yi()){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===bn.None||u===bn.All)throw new Error("ack policy for pull consumers must be explicit");const c=this._buildTypedSubscriptionOpts(l),f=new Gk(this,l.deliver,c);f.info=l;try{await this._maybeCreateConsumer(l)}catch(d){throw f.unsubscribe(),d}return f}async subscribe(r,s=Yi()){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 Dx(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=Yi()){const l=k0(s)?s.getOpts():s;if(l.isBind=k0(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!==bn.NotSet&&l.config.ack_policy!==bn.None)throw new Re("ordered consumer: ack_policy can only be set to 'none'",ke.ApiError);if(l.config.durable_name&&l.config.durable_name.length>0)throw new Re("ordered consumer: durable_name cannot be set",ke.ApiError);if(l.config.deliver_subject&&l.config.deliver_subject.length>0)throw new Re("ordered consumer: deliver_subject cannot be set",ke.ApiError);if(l.config.max_deliver!==void 0&&l.config.max_deliver>1)throw new Re("ordered consumer: max_deliver cannot be set",ke.ApiError);if(l.config.deliver_group&&l.config.deliver_group.length>0)throw new Re("ordered consumer: deliver_group cannot be set",ke.ApiError);l.config.deliver_subject=mi(this.nc.options.inboxPrefix),l.config.ack_policy=bn.None,l.config.max_deliver=1,l.config.flow_control=!0,l.config.idle_heartbeat=l.config.idle_heartbeat||$t(5e3),l.config.ack_wait=$t(1320*60*1e3),l.config.mem_storage=!0,l.config.num_replicas=1}if(l.config.ack_policy===bn.NotSet&&(l.config.ack_policy=bn.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||mi(this.nc.options.inboxPrefix),l}_buildTypedSubscriptionOpts(r){const s={};return s.adapter=Jk(r.callbackFn===void 0,this.timeout),s.ingestionFilterFn=Id.ingestionFn(r.ordered),s.protocolFilterFn=(l,u=!1)=>{const c=l;return nd(c.msg)?(u||c.msg.respond(),!1):!0},!r.mack&&r.config.ack_policy!==bn.None&&(s.dispatchedFn=Qk),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:an.All,ack_policy:bn.Explicit,ack_wait:$t(30*1e3),replay_policy:ba.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 d;const u=l;if(!s)return{ingest:!1,protocol:!1};const c=s;if(ha(c.msg)||(d=u.monitor)==null||d.work(),rd(c.msg)){const m=r?u._checkHbOrderConsumer(c.msg):!0;return r||u.info.flow_control.heartbeat_count++,{ingest:m,protocol:!0}}else if(nd(c.msg))return u.info.flow_control.fc_count++,{ingest:!0,protocol:!0};return{ingest:r?u._checkOrderedConsumer(s):!0,protocol:!1}}}}class Fd{constructor(t){C(this,"options");C(this,"protocol");C(this,"draining");C(this,"listeners");C(this,"_services");this.draining=!1,this.options=hk(t),this.listeners=[]}static connect(t={}){return new Promise((r,s)=>{const l=new Fd(t);Uu.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 Re.errorForCode(ke.ConnectionClosed);if(r&&this.isDraining()||s&&this.protocol.noMorePublishing)throw Re.errorForCode(ke.ConnectionDraining);if(t=t||"",t.length===0)throw Re.errorForCode(ke.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 Tx(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=ur,s={maxWait:1e3,maxMessages:-1}){const l=!this.protocol.options.noAsyncTraces;try{this._check(t,!0,!0)}catch(d){return Promise.reject(d)}if(s.strategy=s.strategy||Rr.Timer,s.maxWait=s.maxWait||1e3,s.maxWait<1)return Promise.reject(new Re("timeout",ke.InvalidOption));const u=new xn;function c(d){u.push(()=>{u.stop(d)})}function f(d,m){d||m===null?c(d===null?void 0:d):u.push(m)}if(s.noMux){const d=l?new Error().stack:null;let m=typeof s.maxMessages=="number"&&s.maxMessages>0?s.maxMessages:-1;const y=this.subscribe(mi(this.options.inboxPrefix),{callback:(S,j)=>{var D,T;if(((D=j==null?void 0:j.data)==null?void 0:D.length)===0&&((T=j==null?void 0:j.headers)==null?void 0:T.status)===ke.NoResponders&&(S=Re.errorForCode(ke.NoResponders)),S){d&&(S.stack+=`
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=Vt()),this.pongs.push(t),this.outbound.fill(L0),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}${ku}`):t.push(`SUB ${s.subject} ${s.sid}${ku}`)}),t.length&&this.transport.send(jl(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 jx(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 wk="$SRV";class z0{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 o,c;return l=l||{},l.headers=l.headers||gi(),(o=l.headers)==null||o.set(Tu,`${t}`),(c=l.headers)==null||c.set(Nu,r),this.msg.respond(s,l)}json(t){return this.msg.json(t)}string(){return this.msg.string()}}class Bl{constructor(t,r="",s=""){C(this,"subject");C(this,"queue");C(this,"srv");r!==""&&_k("service group",r);let l="";if(t instanceof Gl)this.srv=t,l="";else if(t instanceof Bl){const o=t;this.srv=o.srv,s===""&&o.queue!==""&&(s=o.queue),l=o.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;Cl("endpoint",t);let{subject:l,handler:o,metadata:c,queue:f}=s;l=l||t,f=f||this.queue,Sk("endpoint subject",l),l=this.calcSubject(this.subject,l);const d={name:t,subject:l,queue:f,handler:o,metadata:c};return this.srv._addEndpoint(d)}addGroup(t="",r=""){return new Bl(this,t,r)}}function Sk(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 _k(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 Gl{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"),Cl("name",this.config.name),Cl("queue",this.config.queue),bs(this.config.version),this._id=Gi.next(),this.internal=[],this._done=Vt(),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 o=l??wk;return r===""&&s===""?`${o}.${t}`:(Cl("control subject name",r),s!==""?(Cl("control subject id",s),`${o}.${t}.${r}.${s}`):`${o}.${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=gi();if(t instanceof Ou){const s=t;r.set(Nu,s.message),r.set(Tu,`${s.code}`)}else r.set(Nu,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:o,handler:c}=t,f=t;f.internal=r,r&&this.internal.push(f),f.stats=new kk(l,o,s),f.queue=s;const d=c?(m,y)=>{if(m){this.close(m);return}const g=Date.now();try{c(m,new z0(y))}catch(x){f.stats.countError(x),y==null||y.respond(cr,{headers:this.errorToHeader(x)})}finally{f.stats.countLatency(g)}}:void 0;return f.sub=this.nc.subscribe(o,{callback:d,queue:s}),f.sub.closed.then(()=>{this._stopped||this.close(new Error(`required subscription ${t.subject} stopped`)).catch()}).catch(m=>{if(!this._stopped){const y=new Error(`required subscription ${t.subject} errored: ${m.message}`);y.stack=m.stack,this.close(y).catch()}}),f}info(){return{type:Nl.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:o}=t;return{subject:r,metadata:s,name:l,queue_group:o}})}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:Nl.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="",o=""){const c={};c.name=t,c.subject=Gl.controlSubject(r,l,o),c.handler=s,this.setupHandler(c,!0)}start(){const t=Mr(),r=(c,f)=>c?(this.close(c),Promise.reject(c)):this.stats().then(d=>(f==null||f.respond(t.encode(d)),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()),o=(c,f)=>c?(this.close(c).then().catch(),Promise.reject(c)):(f.respond(l),Promise.resolve());return this.addInternalHandler($i.PING,o),this.addInternalHandler($i.STATS,r),this.addInternalHandler($i.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:Nl.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 Bl(this,t,r)}addEndpoint(t,r){return new Bl(this).addEndpoint(t,r)}_addEndpoint(t){const r=new xn;r.noIterator=typeof t.handler=="function",r.noIterator||(t.handler=(l,o)=>{l?this.stop(l).catch():r.push(new z0(o))},r.iterClosed.then(()=>{this.close().catch()}));const s=this.setupHandler(t,!1);return s.qi=r,this.handlers.push(s),r}}class kk{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+=$t(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:o,processing_time:c,last_error:f,data:d,queue:m}=this;return{name:t,subject:r,average_processing_time:s,num_errors:l,num_requests:o,processing_time:c,last_error:f,data:d,queue_group:m}}stats(t){const r=t;return(r==null?void 0:r.noIterator)===!1&&(this.processing_time=$t(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 Ek{constructor(t,r={strategy:Rr.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($i.PING,t,r)}stats(t="",r=""){return this.q($i.STATS,t,r)}info(t="",r=""){return this.q($i.INFO,t,r)}async q(t,r="",s=""){const l=new xn,o=Mr(),c=Gl.controlSubject(t,r,s,this.prefix),f=await this.nc.requestMany(c,cr,this.opts);return(async()=>{for await(const d of f)try{const m=o.decode(d.data);l.push(m)}catch(m){l.push(()=>{l.stop(m)})}l.push(()=>{l.stop()})})().catch(d=>{l.stop(d)}),l}}function Nx(){return{key:{encode(e){return e},decode(e){return e}},value:{encode(e){return e},decode(e){return e}}}}function Ck(){return{replicas:1,history:1,timeout:2e3,max_bytes:-1,maxValueSize:-1,codec:Nx(),storage:sd.File}}const Pu="KV-Operation",U0="$KV",Ak=/^[-/=.\w]+$/,jk=/^[-/=.>*\w]+$/,Nk=/^[-\w]+$/;function Tk(e){if(e.startsWith(".")||e.endsWith(".")||!Ak.test(e))throw new Error(`invalid key: ${e}`)}function Ok(e){if(e.startsWith(".")||e.endsWith(".")||!jk.test(e))throw new Error(`invalid key: ${e}`)}function Rk(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 Eu(e){if(!Nk.test(e))throw new Error(`invalid bucket name: ${e}`)}var Ir;(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"})(Ir||(Ir={}));class Hl{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",Tk);C(this,"validateSearchKey",Ok);C(this,"hasWildcards",Rk);Eu(t),this.js=r,this.jsm=s,this.bucket=t,this.prefix=U0,this.editPrefix="",this.useJsPrefix=!1,this._prefixLen=0}static async create(t,r,s={}){Eu(r);const l=await t.jetstreamManager(),o=new Hl(r,t,l);return await o.init(s),o}static async bind(t,r,s={}){const l=await t.jetstreamManager(),o={config:{allow_direct:s.allow_direct}};Eu(r);const c=new Hl(r,t,l);return o.config.name=s.streamName??c.bucketName(),Object.assign(c,o),c.stream=o.config.name,c.codec=s.codec||Nx(),c.direct=o.config.allow_direct??!1,c.initializePrefixes(o),c}async init(t={}){const r=Object.assign(Ck(),t);this.codec=r.codec;const s={};this.stream=s.name=t.streamName??this.bucketName(),s.retention=id.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(ar)||(g.name=`${ar}${g.name}`),s.mirror=g,s.mirror_direct=!0}else if(t.sources){const g=t.sources.map(x=>{const v=Object.assign({},x),S=v.name.startsWith(ar)?v.name.substring(ar.length):v.name;return v.name.startsWith(ar)||(v.name=`${ar}${v.name}`),!x.external&&S!==this.bucket&&(v.subject_transforms=[{src:`$KV.${S}.>`,dest:`$KV.${this.bucket}.>`}]),v});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?Ji.S2:Ji.None);const o=this.js.nc,c=o.getServerVersion(),f=c?ld(c,bs("2.7.2"))>=0:!1;s.discard=f?Pl.New:Pl.Old;const{ok:d,min:m}=o.features.get(pt.JS_ALLOW_DIRECT);if(!d&&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 ${m}`))}t.allow_direct=typeof t.allow_direct=="boolean"?t.allow_direct:d,s.allow_direct=t.allow_direct,this.direct=s.allow_direct,s.num_replicas=r.replicas,r.ttl&&(s.max_age=$t(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(ar)&&(s=s.substring(ar.length)),r.external&&r.external.api!==""){const l=r.name.substring(ar.length);this.useJsPrefix=!1,this.prefix=`$KV.${l}`,this.editPrefix=`${r.external.api}.$KV.${s}`}else this.editPrefix=this.prefix}}bucketName(){return this.stream??`${ar}${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}`:`${U0}.${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(Un.MessageSizeHdr)||"";return s!==""?parseInt(s,10):t.length}smToEntry(t){return new Gk(this.bucket,this.prefixLen,t)}jmToEntry(t){const r=this.decodeKey(t.subject.substring(this.prefixLen));return new Jk(this.bucket,r,t)}async create(t,r){var o;let s;try{const c=await this.put(t,r,{previousSeq:0});return Promise.resolve(c)}catch(c){if(s=c,((o=c==null?void 0:c.api_error)==null?void 0:o.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 o={};if(s.previousSeq!==void 0){const d=gi();o.headers=d,d.set(Ir.ExpectedLastSubjectSequenceHdr,`${s.previousSeq}`)}try{return(await this.js.publish(this.subjectForKey(l,!0),r,o)).seq}catch(d){const m=d;return m.isJetStreamError()?(m.message=(c=m.api_error)==null?void 0:c.description,m.code=`${(f=m.api_error)==null?void 0:f.code}`,Promise.reject(m)):Promise.reject(d)}}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 o;try{this.direct?o=await this.jsm.direct.getMessage(this.bucketName(),l):o=await this.jsm.streams.getMessage(this.bucketName(),l);const c=this.smToEntry(o);return c.key!==s?null:c}catch(c){if(c.code===ke.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=Vt(),s=[],l=await this.watch({key:">",initializedFn:()=>{r.resolve()}});(async()=>{for await(const d of l)(d.operation==="DEL"||d.operation==="PURGE")&&s.push(d)})().then(),await r,l.stop();const o=Date.now()-t,c=s.map(d=>{const m=this.subjectForKey(d.key);return d.created.getTime()>=o?this.jsm.streams.purge(this.stream,{filter:m,keep:1}):this.jsm.streams.purge(this.stream,{filter:m,keep:0})}),f=await Promise.all(c);return f.unshift({success:!0,purged:0}),f.reduce((d,m)=>(d.purged+=m.purged,d))}async _deleteOrPurge(t,r,s){if(!this.hasWildcards(t))return this._doDeleteOrPurge(t,r,s);const l=await this.keys(t),o=[];for await(const c of l)o.push(this._doDeleteOrPurge(c,r)),o.length===100&&(await Promise.all(o),o.length=0);o.length>0&&await Promise.all(o)}async _doDeleteOrPurge(t,r,s){const l=this.encodeKey(t);this.validateKey(l);const o=gi();o.set(Pu,r),r==="PURGE"&&o.set(Un.RollupHdr,Un.RollupValueSubject),s!=null&&s.previousSeq&&o.set(Ir.ExpectedLastSubjectSequenceHdr,`${s.previousSeq}`),await this.js.publish(this.subjectForKey(l,!0),cr,{headers:o})}_buildCC(t,r,s={}){let o=(Array.isArray(t)?t:[t]).map(d=>{const m=this.encodeKey(d);return this.validateSearchKey(d),this.fullKeyName(m)}),c=an.LastPerSubject;r===Tr.AllHistory&&(c=an.All),r===Tr.UpdatesOnly&&(c=an.New);let f;return o.length===1&&(f=o[0],o=void 0),Object.assign({deliver_policy:c,ack_policy:bn.None,filter_subjects:o,filter_subject:f,flow_control:!0,idle_heartbeat:$t(5*1e3)},s)}remove(t){return this.purge(t)}async history(t={}){const r=t.key??">",s=new xn,l={};l.headers_only=t.headers_only||!1;let o;o=()=>{s.stop()};let c=0;const f=this._buildCC(r,Tr.AllHistory,l),d=f.filter_subject,m=Yi(f);m.bindStream(this.stream),m.orderedConsumer(),m.callback((g,x)=>{if(g){s.stop(g);return}if(x){const v=this.jmToEntry(x);s.push(v),s.received++,(o&&c>0&&s.received>=c||x.info.pending===0)&&(s.push(o),o=void 0)}});const y=await this.js.subscribe(d,m);if(o){const{info:{last:g}}=y,x=g.num_pending+g.delivered.consumer_seq;if(x===0||s.received>=x)try{o()}catch(v){s.stop(v)}finally{o=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(pt.JS_NEW_CONSUMER_CREATE_API);return s}async watch(t={}){const r=t.key??">",s=new xn,l={};l.headers_only=t.headers_only||!1;let o=Tr.LastValue;t.include===Tr.AllHistory?o=Tr.AllHistory:t.include===Tr.UpdatesOnly&&(o=Tr.UpdatesOnly);const c=t.ignoreDeletes===!0;let f=t.initializedFn,d=0;const m=this._buildCC(r,o,l),y=m.filter_subject,g=Yi(m);this.canSetWatcherName()&&g.consumerName(Gi.next()),g.bindStream(this.stream),t.resumeFromRevision&&t.resumeFromRevision>0&&g.startSequence(t.resumeFromRevision),g.orderedConsumer(),g.callback((v,S)=>{if(v){s.stop(v);return}if(S){const A=this.jmToEntry(S);if(c&&A.operation==="DEL")return;s.push(A),s.received++,f&&(d>0&&s.received>=d||S.info.pending===0)&&(s.push(f),f=void 0)}});const x=await this.js.subscribe(y,g);if(f){const{info:{last:v}}=x,S=v.num_pending+v.delivered.consumer_seq;if(S===0||s.received>=S)try{f()}catch(A){s.stop(A)}finally{f=void 0}else d=S}return s._data=x,s.iterClosed.then(()=>{x.unsubscribe()}),x.closed.then(()=>{s.stop()}).catch(v=>{s.stop(v)}),s}async keys(t=">"){const r=new xn,s=this._buildCC(t,Tr.LastValue,{headers_only:!0}),l=Array.isArray(t)?">":s.filter_subject,o=Yi(s);o.bindStream(this.stream),o.orderedConsumer();const c=await this.js.subscribe(l,o);return(async()=>{var d;for await(const m of c){const y=(d=m.headers)==null?void 0:d.get(Pu);if(y!=="DEL"&&y!=="PURGE"){const g=this.decodeKey(m.subject.substring(this.prefixLen));r.push(g)}m.info.pending===0&&c.unsubscribe()}})().then(()=>{r.stop()}).catch(d=>{r.stop(d)}),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 o;const r=((o=this.js.nc.info)==null?void 0:o.cluster)??"",s=this.bucketName(),l=await this.jsm.streams.info(s);return new Tx(l,r)}}class Tx{constructor(t,r=""){C(this,"si");C(this,"cluster");this.si=t,this.cluster=r}get bucket(){return this.si.config.name.startsWith(ar)?this.si.config.name.substring(ar.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 Ud(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!==Ji.None:!1}}const Hd="OBJ_",P0="SHA-256=";function Mk(e){return Eu(e),`${Hd}${e}`}function Dk(e){return e.startsWith(Hd)?e.substring(4):e}class fd{constructor(t){C(this,"si");C(this,"backingStore");this.si=t,this.backingStore="JetStream"}get bucket(){return Dk(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!==Ji.None:!1}}function mu(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 Fr;(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"})(Fr||(Fr={}));var ma;(function(e){e.DebugEvent="debug",e.Discard="discard",e.Reset="reset",e.Next="next"})(ma||(ma={}));const B0=Uint8Array.of(43,65,67,75),Lk=Uint8Array.of(45,78,65,75),vl=Uint8Array.of(43,87,80,73),zk=Uint8Array.of(43,78,88,84),Uk=Uint8Array.of(43,84,69,82,77),Pk=Uint8Array.of(32);function ql(e,t=5e3){return new tE(e,t)}class Ah extends xn{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 o=s;this.opts=this.parseOptions(s,l),this.callback=o.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=mi(r.api.nc.options.inboxPrefix),this.listeners=[],this.forOrderedConsumer=!1,this.abortOnMissingResource=o.abort_on_missing_resource===!0,this.bind=o.bind===!0,this.inBackOff=!1,this.start()}start(){const{max_messages:r,max_bytes:s,idle_heartbeat:l,threshold_bytes:o,threshold_messages:c}=this.opts;this.closed().then(d=>{if(this.cleanupHandler)try{this.cleanupHandler(d)}catch{}});const{sub:f}=this;f&&f.unsubscribe(),this.sub=this.consumer.api.nc.subscribe(this.inbox,{callback:(d,m)=>{var g,x,v,S;if(d){this.stop(d);return}if((g=this.monitor)==null||g.work(),m.subject===this.inbox){if(rd(m))return;const A=(x=m.headers)==null?void 0:x.code,M=((S=(v=m.headers)==null?void 0:v.description)==null?void 0:S.toLowerCase())||"unknown",{msgsLeft:T,bytesLeft:P}=this.parseDiscard(m.headers);if(T>0||P>0)this.pending.msgs-=T,this.pending.bytes-=P,this.pending.requests--,this.notify(ma.Discard,{msgsLeft:T,bytesLeft:P});else if(A===400){this.stop(new Re(M,`${A}`));return}else if(A===409&&M==="consumer deleted"){if(this.notify(Fr.ConsumerDeleted,`${A} ${M}`),!this.refilling||this.abortOnMissingResource){const I=new Re(M,`${A}`);this.stop(I);return}}else if(A===503){if(this.notify(Fr.NoResponders,`${A} No Responders`),!this.refilling||this.abortOnMissingResource){const I=new Re("no responders",`${A}`);this.stop(I);return}}else this.notify(ma.DebugEvent,`${A} ${M}`)}else this._push(ql(m,this.consumer.api.timeout)),this.received++,this.pending.msgs&&this.pending.msgs--,this.pending.bytes&&(this.pending.bytes-=m.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<=o){const A=this.pullOptions();this.pull(A)}}else this.pending.requests===0&&this._push(()=>{this.stop()})}}),this.sub.closed.then(()=>{this.sub.draining&&this._push(()=>{this.stop()})}),l&&(this.monitor=new Bd(l,d=>(this.notify(Fr.HeartbeatsMissed,d),this.resetPending().then(()=>{}).catch(()=>{}),!1),{maxOut:2})),(async()=>{var m;const d=this.consumer.api.nc.status();this.statusIterator=d;for await(const y of d)switch(y.type){case fi.Disconnect:(m=this.monitor)==null||m.cancel();break;case fi.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=zd([this.opts.expires]);let o=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(Fr.StreamNotFound,s),!this.refilling||this.abortOnMissingResource)return this.stop(c),!1}else if(c.message==="consumer not found"){if(r++,this.notify(Fr.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(o),d=Ea(f);await Promise.race([d,this.consumer.api.nc.closed()]),d.cancel(),o++}}}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(ma.Next,r)})}pullOptions(){const r=this.opts.max_messages-this.pending.msgs,s=this.opts.max_bytes-this.pending.bytes,l=$t(this.opts.idle_heartbeat),o=$t(this.opts.expires);return{batch:r,max_bytes:s,idle_heartbeat:l,expires:o}}parseDiscard(r){const s={msgsLeft:0,bytesLeft:0},l=r==null?void 0:r.get(Un.PendingMessagesHdr);l&&(s.msgsLeft=parseInt(l));const o=r==null?void 0:r.get(Un.PendingBytesHdr);return o&&(s.bytesLeft=parseInt(o)),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(o=>{o.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 o=Math.round(l.max_messages*.75)||1;l.threshold_messages=l.threshold_messages||o;const c=Math.round(l.max_bytes*.75)||1;l.threshold_bytes=l.threshold_bytes||c}return l}status(){const r=new xn;return this.listeners.push(r),Promise.resolve(r)}}class Bk extends xn{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 xn;return this.listeners.push(r),Promise.resolve(r)}}class hd{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 Ah(this,t,!0))}fetch(t={max_messages:100,expires:3e4}){const r=new Ah(this,t,!1),s=Math.round(r.opts.expires*1.05),l=ya(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=Vt(),s=t;s.max_messages=1;const l=new Ah(this,s,!1),o=Math.round(l.opts.expires*1.05);o>=6e4&&(async()=>{for await(const f of await l.status())if(f.type===Fr.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=ya(o);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 Hk{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=Gi.next(),typeof s.name_prefix=="string"&&(Xu("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:an.StartSequence,opt_start_seq:t,ack_policy:bn.None,inactive_threshold:$t(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||an.StartSequence,(this.consumerOpts.deliver_policy===an.LastPerSubject||this.consumerOpts.deliver_policy===an.New||this.consumerOpts.deliver_policy===an.Last)&&(delete s.opt_start_seq,s.deliver_policy=this.consumerOpts.deliver_policy),s.deliver_policy===an.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=an.StartTime,s.opt_start_time=this.consumerOpts.opt_start_time),this.consumerOpts.inactive_threshold&&(s.inactive_threshold=$t(this.consumerOpts.inactive_threshold))),s}async resetConsumer(t=0){var c,f,d,m,y;Gi.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=zd([((f=this.opts)==null?void 0:f.expires)||3e4]);let o;for(let g=0;;g++)try{o=await this.api.add(this.stream,s),(d=this.iter)==null||d.notify(Fr.OrderedConsumerRecreated,o.name);break}catch(x){if(x.message==="stream not found"&&((m=this.iter)==null||m.notify(Fr.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 Ea(l.backoff(g+1))}return o}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 d,m;r=r||{};const s=r.fromFetch||!1,l=r.orderedReset||!1;if(this.type===Sr.Fetch&&l){(d=this.iter)==null||d.src.stop(),await((m=this.iter)==null?void 0:m.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 Bk),this.consumer=new hd(this.api,this.currentConsumer);const o=t;o.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(ma.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=Vt();return r.callback=o=>{this.userCallback=null,s.resolve(o)},(await this.fetch(r)).iterClosed.then(o=>{o&&s.reject(o),s.resolve(null)}).catch(o=>{s.reject(o)}),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 dd{constructor(t){C(this,"api");C(this,"notified");this.api=t,this.notified=!1}checkVersion(){const t=this.api.nc.features.get(pt.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 hd(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 hd(this.api,s)).catch(s=>Promise.reject(s)))}async ordered(t,r){await this.checkVersion();const s=this.api;return new qd(s.nc,s.opts).info(t).then(o=>Promise.resolve(new Hk(this.api,t,r))).catch(o=>Promise.reject(o))}}class Zu{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 Zu(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 dd(new Du(this.api.nc,this.api.opts)).getPullConsumerFor(t)}getConsumer(t){return new dd(new Du(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 qd extends Yl{constructor(t,r){super(t,r)}checkStreamConfigVersions(t){const r=this.nc;if(t.metadata){const{min:l,ok:o}=r.features.get(pt.JS_STREAM_CONSUMER_METADATA);if(!o)throw new Error(`stream 'metadata' requires server ${l}`)}if(t.first_seq){const{min:l,ok:o}=r.features.get(pt.JS_STREAM_FIRST_SEQ);if(!o)throw new Error(`stream 'first_seq' requires server ${l}`)}if(t.subject_transform){const{min:l,ok:o}=r.features.get(pt.JS_STREAM_SUBJECT_TRANSFORM);if(!o)throw new Error(`stream 'subject_transform' requires server ${l}`)}if(t.compression){const{min:l,ok:o}=r.features.get(pt.JS_STREAM_COMPRESSION);if(!o)throw new Error(`stream 'compression' requires server ${l}`)}if(t.consumer_limits){const{min:l,ok:o}=r.features.get(pt.JS_DEFAULT_CONSUMER_LIMITS);if(!o)throw new Error(`stream 'consumer_limits' requires server ${l}`)}function s(l,o){var f;if((((f=o==null?void 0:o.subject_transforms)==null?void 0:f.length)||0)>0){const{min:d,ok:m}=r.features.get(pt.JS_STREAM_SOURCE_SUBJECT_TRANSFORM);if(!m)throw new Error(`${l} 'subject_transforms' requires server ${d}`)}}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),Mn(t.name),t.mirror=mu(t.mirror),t.sources=(l=t.sources)==null?void 0:l.map(mu);const s=await this._request(`${this.prefix}.STREAM.CREATE.${t.name}`,t);return this._fixInfo(s),s}async delete(t){return Mn(t),(await this._request(`${this.prefix}.STREAM.DELETE.${t}`)).success}async update(t,r={}){var f;if(typeof t=="object"){const d=t;t=d.name,r=d,console.trace("\x1B[33m >> streams.update(config: StreamConfig) api changed to streams.update(name: string, config: StreamUpdateConfig) - this shim will be removed - update your code. \x1B[0m")}this.checkStreamConfigVersions(r),Mn(t);const s=await this.info(t),l=Object.assign(s.config,r);l.mirror=mu(l.mirror),l.sources=(f=l.sources)==null?void 0:f.map(mu);const c=await this._request(`${this.prefix}.STREAM.UPDATE.${t}`,l);return this._fixInfo(c),c}async info(t,r){Mn(t);const s=`${this.prefix}.STREAM.INFO.${t}`;let o=await this._request(s,r),{total:c,limit:f}=o,d=o.state.subjects?Object.getOwnPropertyNames(o.state.subjects).length:1;if(c&&c>d){const m=[o],y=r||{};let g=0;for(;c>d;){g++,y.offset=f*g;const v=await this._request(s,y);c=v.total,m.push(v);const S=Object.getOwnPropertyNames(v.state.subjects).length;if(d+=S,S<f)break}let x={};for(let v=0;v<m.length;v++)o=m[v],o.state.subjects&&(x=Object.assign(x,o.state.subjects));o.offset=0,o.total=0,o.limit=0,o.state.subjects=x}return this._fixInfo(o),o}list(t=""){const r=t!=null&&t.length?{subject:t}:{},s=o=>{const c=o;return c.streams.forEach(f=>{this._fixInfo(f)}),c.streams},l=`${this.prefix}.STREAM.LIST`;return new Al(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:o}=r;if(typeof l=="number"&&typeof o=="number")throw new Error("can specify one of keep or seq")}return Mn(t),await this._request(`${this.prefix}.STREAM.PURGE.${t}`,r)}async deleteMessage(t,r,s=!0){Mn(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){Mn(t);const l=await this._request(`${this.prefix}.STREAM.MSG.GET.${t}`,r);return new Ox(l)}find(t){return this.findStream(t)}listKvs(){const t=s=>{var d;const o=s.streams.filter(m=>m.config.name.startsWith(ar));o.forEach(m=>{this._fixInfo(m)});let c="";return o.length&&(c=((d=this.nc.info)==null?void 0:d.cluster)??""),o.map(m=>new Tx(m,c))},r=`${this.prefix}.STREAM.LIST`;return new Al(r,t,this)}listObjectStores(){const t=s=>{const o=s.streams.filter(f=>f.config.name.startsWith(Hd));return o.forEach(f=>{this._fixInfo(f)}),o.map(f=>new fd(f))},r=`${this.prefix}.STREAM.LIST`;return new Al(r,t,this)}names(t=""){const r=t!=null&&t.length?{subject:t}:{},s=o=>o.streams,l=`${this.prefix}.STREAM.NAMES`;return new Al(l,s,this,r)}async get(t){const r=await this.info(t);return Promise.resolve(new Zu(this,r))}}class qk extends Yl{constructor(t,r){super(t,r)}async getMessage(t,r){Mn(t);let s=r;const{last_by_subj:l}=s;l&&(s=null);const o=s?this.jc.encode(s):cr,c=this.opts.apiPrefix||"$JS.API",f=l?`${c}.DIRECT.GET.${t}.${l}`:`${c}.DIRECT.GET.${t}`,d=await this.nc.request(f,o,{timeout:this.timeout}),m=ha(d);if(m)return Promise.reject(m);const y=new md(d);return Promise.resolve(y)}async getBatch(t,r){Mn(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 o=JSON.stringify(r,(d,m)=>d==="up_to_time"&&m instanceof Date?m.toISOString():m),c=new xn,f=await this.nc.requestMany(l,o,{strategy:Rr.SentinelMsg});return(async()=>{var g,x,v;let d=!1,m=!1,y;for await(const S of f){if(!d){d=!0;const A=((g=S.headers)==null?void 0:g.code)||0;if(A!==0&&A<200||A>299){y=(x=S.headers)==null?void 0:x.description.toLowerCase();break}if(((v=S.headers)==null?void 0:v.get("Nats-Num-Pending"))===""){m=!0;break}}if(S.data.length===0)break;c.push(new md(S))}c.push(()=>{if(m)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 md{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(oa.Subject)}get seq(){const t=this.header.last(oa.Sequence);return typeof t=="string"?parseInt(t):0}get time(){return new Date(Date.parse(this.timestamp))}get timestamp(){return this.header.last(oa.TimeStamp)}get stream(){return this.header.last(oa.Stream)}json(t){return Mr(t).decode(this.data)}string(){return lr.decode(this.data)}}C(md,"jc");class Ik extends Yl{constructor(r,s){super(r,s);C(this,"streams");C(this,"consumers");C(this,"direct");this.streams=new qd(r,s),this.consumers=new Du(r,s),this.direct=new qk(r,s)}async getAccountInfo(){return await this._request(`${this.prefix}.INFO`)}jetstream(){return this.nc.jetstream(this.getOptions())}advisories(){const r=new xn;return this.nc.subscribe("$JS.EVENT.ADVISORY.>",{callback:(s,l)=>{if(s)throw s;try{const o=this.parseJsResponse(l),c=o.type.split("."),f=c[c.length-1];r.push({kind:f,data:o})}catch(o){r.stop(o)}}}),r}}class Ox{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):cr}get header(){if(!this._header)if(this.smr.message.hdrs){const t=this._parse(this.smr.message.hdrs);this._header=Vi.decode(t)}else this._header=gi();return this._header}_parse(t){const r=atob(t),s=r.length,l=new Uint8Array(s);for(let o=0;o<s;o++)l[o]=r.charCodeAt(o);return l}json(t){return Mr(t).decode(this.data)}string(){return lr.decode(this.data)}}C(Ox,"jc");class Fk{constructor(t){C(this,"api");this.api=t}get(t){return this.api.info(t).then(r=>new Zu(this.api,r))}}class jh{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=Vi.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 H0(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 $k(){return new ReadableStream({pull(e){e.enqueue(new Uint8Array(0)),e.close()}})}class Ol{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 jh(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 o=await this.jsm.streams.getMessage(this.stream,{last_by_subj:l}),f=Mr().decode(o.data);return f.revision=o.seq,f}catch(o){return o.code==="404"?null:Promise.reject(o)}}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 fd(t)))}async status(t){const r=await this._si(t);return r===null?Promise.reject(new Error("object store not found")):Promise.resolve(new fd(r))}destroy(){return this.jsm.streams.delete(this.stream)}async _put(t,r,s){var W;const l=this.js.getOptions();s=s||{timeout:l.timeout},s.timeout=s.timeout||l.timeout,s.previousRevision=s.previousRevision??void 0;const{timeout:o,previousRevision:c}=s,f=this.js.nc.info,d=(f==null?void 0:f.max_payload)||1024;t=t||{},t.options=t.options||{};let m=((W=t.options)==null?void 0:W.max_chunk_size)||128*1024;m=m>d?d:m,t.options.max_chunk_size=m;const y=await this.info(t.name),{name:g,error:x}=this._checkNotEmpty(t.name);if(x)return Promise.reject(x);const v=Gi.next(),S=this._chunkSubject(v),A=this._metaSubject(g),M=Object.assign({bucket:this.name,nuid:v,size:0,chunks:0},H0(t)),T=Vt(),P=[],I=new xa;try{const B=r?r.getReader():null,D=N0.create();for(;;){const{done:Z,value:$}=B?await B.read():{done:!0,value:void 0};if(Z){if(I.size()>0){const G=I.drain();D.update(G),M.chunks++,M.size+=G.length,P.push(this.js.publish(S,G,{timeout:o}))}await Promise.all(P),P.length=0,M.mtime=new Date().toISOString();const V=da.encode(D.digest());M.digest=`${P0}${V}`,M.deleted=!1;const L=gi();typeof c=="number"&&L.set(Ir.ExpectedLastSubjectSequenceHdr,`${c}`),L.set(Un.RollupHdr,Un.RollupValueSubject);const X=await this.js.publish(A,Mr().encode(M),{headers:L,timeout:o});if(M.revision=X.seq,y)try{await this.jsm.streams.purge(this.stream,{filter:`$O.${this.name}.C.${y.nuid}`})}catch{}T.resolve(new jh(M));break}if($)for(I.fill($);I.size()>m;){M.chunks++,M.size+=m;const V=I.drain(t.options.max_chunk_size);D.update(V),P.push(this.js.publish(S,V,{timeout:o}))}}}catch(B){await this.jsm.streams.purge(this.stream,{filter:S}),T.reject(B)}return T}putBlob(t,r,s){function l(o){return new ReadableStream({pull(c){c.enqueue(o),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(o){const c=new xa,f=o.getReader();for(;;){const{done:d,value:m}=await f.read();if(d)return c.drain();m&&m.length&&c.fill(m)}}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 Ol.create(this.js,r.options.link.bucket):this).get(g)}if(!r.digest.startsWith(P0))return Promise.reject(new Error(`unknown digest type: ${r.digest}`));const s=ad(r.digest.substring(8));if(s===null)return Promise.reject(new Error(`unable to parse digest: ${r.digest}`));const l=Vt(),o={info:new jh(r),error:l};if(r.size===0)return o.data=$k(),l.resolve(null),Promise.resolve(o);let c;const f=Yi();f.orderedConsumer();const d=N0.create(),m=`$O.${this.name}.C.${r.nuid}`,y=await this.js.subscribe(m,f);return(async()=>{for await(const g of y)g.data.length>0&&(d.update(g.data),c.enqueue(g.data)),g.info.pending===0&&(v2(s,d.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)}),o.data=new ReadableStream({start(g){c=g},cancel(){y.unsubscribe()}}),o}linkStore(t,r){if(!(r instanceof Ol))return Promise.reject("bucket required");const s=r,{name:l,error:o}=this._checkNotEmpty(t);if(o)return Promise.reject(o);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 o=await this.rawInfo(t);if(o!==null&&!o.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 d=await this.info(t);return Promise.resolve(d)}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=Mr(),l=gi();return l.set(Un.RollupHdr,Un.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:o}=this._checkNotEmpty(r.name);if(o)return Promise.reject(o);if(t!==r.name){const d=await this.info(r.name);if(d&&!d.deleted)return Promise.reject(new Error("an object already exists with that name"))}r.name=l;const c=Object.assign({},s,H0(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 xn,l=this._metaSubjectAll();try{await this.jsm.streams.getMessage(this.stream,{last_by_subj:l})}catch(d){d.code==="404"?(s.push(null),r=!0):s.stop(d)}const o=Mr(),c=Yi();c.orderedConsumer(),t.includeHistory?c.deliverLastPerSubject():(r=!0,c.deliverNew()),c.callback((d,m)=>{var y;if(d){s.stop(d);return}if(m!==null){const g=o.decode(m.data);g.deleted&&t.ignoreDeletes===!0||s.push(g),((y=m.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(d=>{s.stop(d)}),s}_chunkSubject(t){return`$O.${this.name}.C.${t}`}_metaSubject(t){return`$O.${this.name}.M.${da.encode(t)}`}_metaSubjectAll(){return`$O.${this.name}.M.>`}async init(t={}){try{this.stream=Mk(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=Pl.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?Ji.S2:Ji.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(),o=new Ol(r,l,t);return await o.init(s),Promise.resolve(o)}}class Vk{constructor(t){C(this,"js");this.js=t}kv(t,r={}){const s=this.js,{ok:l,min:o}=s.nc.features.get(pt.JS_KV);return l?r.bindOnly?Hl.bind(this.js,t,r):Hl.create(this.js,t,r):Promise.reject(new Error(`kv is only supported on servers ${o} 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:o}=s.nc.features.get(pt.JS_OBJECTSTORE);return l?Ol.create(this.js,t,r):Promise.reject(new Error(`objectstore is only supported on servers ${o} or better`))}}class Id extends Yl{constructor(r,s){super(r,s);C(this,"consumers");C(this,"streams");C(this,"consumerAPI");C(this,"streamAPI");this.consumerAPI=new Du(r,s),this.streamAPI=new qd(r,s),this.consumers=new dd(this.consumerAPI),this.streams=new Fk(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 Vk(this)}async publish(r,s=cr,l){l=l||{},l.expect=l.expect||{};const o=(l==null?void 0:l.headers)||gi();l&&(l.msgID&&o.set(Ir.MsgIdHdr,l.msgID),l.expect.lastMsgID&&o.set(Ir.ExpectedLastMsgIdHdr,l.expect.lastMsgID),l.expect.streamName&&o.set(Ir.ExpectedStreamHdr,l.expect.streamName),typeof l.expect.lastSequence=="number"&&o.set(Ir.ExpectedLastSeqHdr,`${l.expect.lastSequence}`),typeof l.expect.lastSubjectSequence=="number"&&o.set(Ir.ExpectedLastSubjectSequenceHdr,`${l.expect.lastSubjectSequence}`));const c=l.timeout||this.timeout,f={};c&&(f.timeout=c),l&&(f.headers=o);let{retries:d,retry_delay:m}=l;d=d||1,m=m||250;let y;for(let x=0;x<d;x++)try{y=await this.nc.request(r,s,f);break}catch(v){if(v.code==="503"&&x+1<d)await Ea(m);else throw v}const g=this.parseJsResponse(y);if(g.stream==="")throw Re.errorForCode(ke.JetStreamInvalidAck);return g.duplicate=g.duplicate?g.duplicate:!1,g}async pull(r,s,l=0){Mn(r),fa(s);let o=this.timeout;l>o&&(o=l),l=l<0?0:$t(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:o}),d=ha(f);if(d)throw d;return ql(f,this.timeout)}fetch(r,s,l={}){Mn(r),fa(s);let o=null;const c=(l.max_bytes??0)>0;let f=0;const d=c?l.max_bytes:0;let m=null;const y={};if(y.batch=l.batch||1,d){const P=this.nc.features.get(pt.JS_PULL_MAX_BYTES);if(!P.ok)throw new Error(`max_bytes is only supported on servers ${P.min} or better`);y.max_bytes=d}y.no_wait=l.no_wait||!1,y.no_wait&&y.expires&&(y.expires=0);const g=l.expires||0;if(g&&(y.expires=$t(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=$t(x),l.delay_heartbeat===!0&&(y.idle_heartbeat=$t(x*4)));const v=new xn,S=y.batch;let A=0;v.protocolFilterFn=(P,I=!1)=>rd(P.msg)?(m==null||m.work(),!1):!0,v.dispatchedFn=P=>{if(P){if(c&&(f+=P.data.length),A++,o&&P.info.pending===0)return;(v.getPending()===1&&P.info.pending===0||S===A||d>0&&f>=d)&&v.stop()}};const M=mi(this.nc.options.inboxPrefix),T=this.nc.subscribe(M,{max:l.batch,callback:(P,I)=>{P===null&&(P=ha(I)),P!==null?(o&&(o.cancel(),o=null),t2(P)?v.stop(Mx(P)===null?void 0:P):v.stop(P)):(m==null||m.work(),v.received++,v.push(ql(I,this.timeout)))}});return g&&(o=ya(g),o.catch(()=>{T.isClosed()||(T.drain().catch(()=>{}),o=null),m&&m.cancel()})),(async()=>{try{x&&(m=new Bd(x,P=>(v.push(()=>{v.err=new Re(`${_r.IdleHeartbeatMissed}: ${P}`,ke.JetStreamIdleHeartBeat)}),!0)))}catch{}await T.closed,o!==null&&(o.cancel(),o=null),m&&m.cancel(),v.stop()})().catch(),this.nc.publish(`${this.prefix}.CONSUMER.MSG.NEXT.${r}.${s}`,this.jc.encode(y),{reply:M}),v}async pullSubscribe(r,s=Yi()){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 o=l.config.ack_policy;if(o===bn.None||o===bn.All)throw new Error("ack policy for pull consumers must be explicit");const c=this._buildTypedSubscriptionOpts(l),f=new Xk(this,l.deliver,c);f.info=l;try{await this._maybeCreateConsumer(l)}catch(d){throw f.unsubscribe(),d}return f}async subscribe(r,s=Yi()){const l=await this._processOptions(r,s);if(!l.isBind&&!l.config.deliver_subject)throw new Error("push consumer requires deliver_subject");const o=this._buildTypedSubscriptionOpts(l),c=new Rx(this,l.deliver,o);c.info=l;try{await this._maybeCreateConsumer(l)}catch(f){throw c.unsubscribe(),f}return c._maybeSetupHbMonitoring(),c}async _processOptions(r,s=Yi()){const l=E0(s)?s.getOpts():s;if(l.isBind=E0(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!==bn.NotSet&&l.config.ack_policy!==bn.None)throw new Re("ordered consumer: ack_policy can only be set to 'none'",ke.ApiError);if(l.config.durable_name&&l.config.durable_name.length>0)throw new Re("ordered consumer: durable_name cannot be set",ke.ApiError);if(l.config.deliver_subject&&l.config.deliver_subject.length>0)throw new Re("ordered consumer: deliver_subject cannot be set",ke.ApiError);if(l.config.max_deliver!==void 0&&l.config.max_deliver>1)throw new Re("ordered consumer: max_deliver cannot be set",ke.ApiError);if(l.config.deliver_group&&l.config.deliver_group.length>0)throw new Re("ordered consumer: deliver_group cannot be set",ke.ApiError);l.config.deliver_subject=mi(this.nc.options.inboxPrefix),l.config.ack_policy=bn.None,l.config.max_deliver=1,l.config.flow_control=!0,l.config.idle_heartbeat=l.config.idle_heartbeat||$t(5e3),l.config.ack_wait=$t(1320*60*1e3),l.config.mem_storage=!0,l.config.num_replicas=1}if(l.config.ack_policy===bn.NotSet&&(l.config.ack_policy=bn.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 o=await this.consumerAPI.info(l.stream,l.config.durable_name);if(o){if(o.config.filter_subject&&o.config.filter_subject!==r)throw new Error("subject does not match consumer");const c=l.config.deliver_group??"";if(c===""&&o.push_bound===!0)throw new Error("duplicate subscription");const f=o.config.deliver_group??"";if(c!==f)throw f===""?new Error("durable requires no queue group"):new Error(`durable requires queue group '${f}'`);l.last=o,l.config=o.config,l.attached=!0,l.config.durable_name||(l.name=o.name)}}catch(o){if(o.code!=="404")throw o}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||mi(this.nc.options.inboxPrefix),l}_buildTypedSubscriptionOpts(r){const s={};return s.adapter=Kk(r.callbackFn===void 0,this.timeout),s.ingestionFilterFn=Id.ingestionFn(r.ordered),s.protocolFilterFn=(l,o=!1)=>{const c=l;return nd(c.msg)?(o||c.msg.respond(),!1):!0},!r.mack&&r.config.ack_policy!==bn.None&&(s.dispatchedFn=Wk),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:an.All,ack_policy:bn.Explicit,ack_wait:$t(30*1e3),replay_policy:ba.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 d;const o=l;if(!s)return{ingest:!1,protocol:!1};const c=s;if(ha(c.msg)||(d=o.monitor)==null||d.work(),rd(c.msg)){const m=r?o._checkHbOrderConsumer(c.msg):!0;return r||o.info.flow_control.heartbeat_count++,{ingest:m,protocol:!0}}else if(nd(c.msg))return o.info.flow_control.fc_count++,{ingest:!0,protocol:!0};return{ingest:r?o._checkOrderedConsumer(s):!0,protocol:!1}}}}class Fd{constructor(t){C(this,"options");C(this,"protocol");C(this,"draining");C(this,"listeners");C(this,"_services");this.draining=!1,this.options=mk(t),this.listeners=[]}static connect(t={}){return new Promise((r,s)=>{const l=new Fd(t);Uu.connect(l.options,l).then(o=>{l.protocol=o,(async function(){for await(const c of o.status())l.listeners.forEach(f=>{f.push(c)})})(),r(l)}).catch(o=>{s(o)})})}closed(){return this.protocol.closed}async close(){await this.protocol.close()}_check(t,r,s){if(this.isClosed())throw Re.errorForCode(ke.ConnectionClosed);if(r&&this.isDraining()||s&&this.protocol.noMorePublishing)throw Re.errorForCode(ke.ConnectionDraining);if(t=t||"",t.length===0)throw Re.errorForCode(ke.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 jx(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=cr,s={maxWait:1e3,maxMessages:-1}){const l=!this.protocol.options.noAsyncTraces;try{this._check(t,!0,!0)}catch(d){return Promise.reject(d)}if(s.strategy=s.strategy||Rr.Timer,s.maxWait=s.maxWait||1e3,s.maxWait<1)return Promise.reject(new Re("timeout",ke.InvalidOption));const o=new xn;function c(d){o.push(()=>{o.stop(d)})}function f(d,m){d||m===null?c(d===null?void 0:d):o.push(m)}if(s.noMux){const d=l?new Error().stack:null;let m=typeof s.maxMessages=="number"&&s.maxMessages>0?s.maxMessages:-1;const y=this.subscribe(mi(this.options.inboxPrefix),{callback:(S,A)=>{var M,T;if(((M=A==null?void 0:A.data)==null?void 0:M.length)===0&&((T=A==null?void 0:A.headers)==null?void 0:T.status)===ke.NoResponders&&(S=Re.errorForCode(ke.NoResponders)),S){d&&(S.stack+=`
82
82
 
83
- ${d}`),g(S);return}f(null,j),s.strategy===Rr.Count&&(m--,m===0&&g()),s.strategy===Rr.JitterTimer&&(v(),x=setTimeout(()=>{g()},300)),s.strategy===Rr.SentinelMsg&&j&&j.data.length===0&&g()}});y.requestSubject=t,y.closed.then(()=>{c()}).catch(S=>{u.stop(S)});const g=S=>{S&&u.push(()=>{throw S}),v(),y.drain().then(()=>{c()}).catch(j=>{c()})};u.iterClosed.then(()=>{v(),y==null||y.unsubscribe()}).catch(S=>{v(),y==null||y.unsubscribe()});try{this.publish(t,r,{reply:y.getSubject()})}catch(S){g(S)}let x=setTimeout(()=>{g()},s.maxWait);const v=()=>{x&&clearTimeout(x)}}else{const d=s;d.callback=f,u.iterClosed.then(()=>{m.cancel()}).catch(y=>{m.cancel(y)});const m=new x2(this.protocol.muxSubscriptions,t,d);this.protocol.request(m);try{this.publish(t,r,{reply:`${this.protocol.muxSubscriptions.baseInbox}${m.token}`,headers:s.headers})}catch(y){m.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 Re("timeout",ke.InvalidOption));if(!s.noMux&&s.reply)return Promise.reject(new Re("reply can only be used with noMux",ke.InvalidOption));if(s.noMux){const u=s.reply?s.reply:mi(this.options.inboxPrefix),c=Vt(),f=l?new Error:null,d=this.subscribe(u,{max:1,timeout:s.timeout,callback:(m,y)=>{m?(f&&m.code!==ke.Timeout&&(m.stack+=`
83
+ ${d}`),g(S);return}f(null,A),s.strategy===Rr.Count&&(m--,m===0&&g()),s.strategy===Rr.JitterTimer&&(v(),x=setTimeout(()=>{g()},300)),s.strategy===Rr.SentinelMsg&&A&&A.data.length===0&&g()}});y.requestSubject=t,y.closed.then(()=>{c()}).catch(S=>{o.stop(S)});const g=S=>{S&&o.push(()=>{throw S}),v(),y.drain().then(()=>{c()}).catch(A=>{c()})};o.iterClosed.then(()=>{v(),y==null||y.unsubscribe()}).catch(S=>{v(),y==null||y.unsubscribe()});try{this.publish(t,r,{reply:y.getSubject()})}catch(S){g(S)}let x=setTimeout(()=>{g()},s.maxWait);const v=()=>{x&&clearTimeout(x)}}else{const d=s;d.callback=f,o.iterClosed.then(()=>{m.cancel()}).catch(y=>{m.cancel(y)});const m=new w2(this.protocol.muxSubscriptions,t,d);this.protocol.request(m);try{this.publish(t,r,{reply:`${this.protocol.muxSubscriptions.baseInbox}${m.token}`,headers:s.headers})}catch(y){m.cancel(y)}}return Promise.resolve(o)}request(t,r,s={timeout:1e3,noMux:!1}){try{this._check(t,!0,!0)}catch(o){return Promise.reject(o)}const l=!this.protocol.options.noAsyncTraces;if(s.timeout=s.timeout||1e3,s.timeout<1)return Promise.reject(new Re("timeout",ke.InvalidOption));if(!s.noMux&&s.reply)return Promise.reject(new Re("reply can only be used with noMux",ke.InvalidOption));if(s.noMux){const o=s.reply?s.reply:mi(this.options.inboxPrefix),c=Vt(),f=l?new Error:null,d=this.subscribe(o,{max:1,timeout:s.timeout,callback:(m,y)=>{m?(f&&m.code!==ke.Timeout&&(m.stack+=`
84
84
 
85
- ${f.stack}`),d.unsubscribe(),c.reject(m)):(m=bx(y),m?(f&&(m.stack+=`
85
+ ${f.stack}`),d.unsubscribe(),c.reject(m)):(m=gx(y),m?(f&&(m.stack+=`
86
86
 
87
- ${f.stack}`),c.reject(m)):c.resolve(y))}});return d.requestSubject=t,this.protocol.publish(t,r,{reply:u,headers:s.headers}),c}else{const u=new wx(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(Re.errorForCode(ke.ConnectionClosed)):this.protocol.flush()}drain(){return this.isClosed()?Promise.reject(Re.errorForCode(ke.ConnectionClosed)):this.isDraining()?Promise.reject(Re.errorForCode(ke.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 xn;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 Hk(this,t);if(t.checkAPI!==!1)try{await r.getAccountInfo()}catch(s){const l=s;throw l.code===ke.NoResponders&&(l.code=ke.JetStreamNotEnabled),l}return r}jetstream(t={}){return new Id(this,t)}getServerVersion(){const t=this.info;return t?bs(t.version):void 0}async rtt(){if(!this.protocol._closed&&!this.protocol.connected)throw Re.errorForCode(ke.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 $k(this)),this._services}reconnect(){return this.isClosed()?Promise.reject(Re.errorForCode(ke.ConnectionClosed)):this.isDraining()?Promise.reject(Re.errorForCode(ke.ConnectionDraining)):this.protocol.reconnect()}}class $k{constructor(t){C(this,"nc");this.nc=t}add(t){try{return new Gl(this.nc,t).start()}catch(r){return Promise.reject(r)}}client(t,r){return new _k(this.nc,t,r)}}class Vk{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(Pu)||"PUT"}get length(){const t=this.sm.header.get(Un.MessageSizeHdr)||"";return t!==""?parseInt(t,10):this.sm.data.length}json(){return this.sm.json()}string(){return this.sm.string()}}class Yk{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(Ud(this.sm.info.timestampNanos))}get revision(){return this.sm.seq}get operation(){var t;return((t=this.sm.headers)==null?void 0:t.get(Pu))||"PUT"}get delta(){return this.sm.info.pending}get length(){var r;const t=((r=this.sm.headers)==null?void 0:r.get(Un.MessageSizeHdr))||"";return t!==""?parseInt(t,10):this.sm.data.length}json(){return this.sm.json()}string(){return this.sm.string()}}class Dx extends _2{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=mi(this.js.nc.options.inboxPrefix);this.js.nc._resub(this.sub,s);const u=this.info;u.config.name=Gi.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=an.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(d=>{const m=d,y=this.sub.info;y.last=m,this.info.config=m.config,this.info.name=m.name}).catch(d=>{const m=new Re(`unable to recreate ordered consumer ${u.stream} at seq ${r}`,ke.RequestError,d);this.sub.callback(m,{})})}_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(Ud(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,v;const d=r2(409,`${_r.IdleHeartbeatMissed}: ${f}`,this.sub.subject);if(!((y=this.info)==null?void 0:y.ordered))this.sub.callback(null,d);else{if(!this.js.nc.protocol.connected)return!1;const S=((x=(g=this.info)==null?void 0:g.ordered_consumer_sequence)==null?void 0:x.stream_seq)||0;return this._resetOrderedConsumer(S+1),(v=this.monitor)==null||v.restart(),!1}return!u.noIterator};this.monitor=new Bd(r,c,l)}_checkHbOrderConsumer(r){const s=r.headers.get(Un.ConsumerStalledHdr);s!==""&&this.js.nc.publish(s);const l=parseInt(r.headers.get(Un.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 Gk extends Dx{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 m=this.js.nc.features.get(pt.JS_PULL_MAX_BYTES);if(!m.ok)throw new Error(`max_bytes is only supported on servers ${m.min} or better`);c.max_bytes=t.max_bytes}let f=0;t.expires&&t.expires>0&&(f=t.expires,c.expires=$t(f));let d=0;if(t.idle_heartbeat&&t.idle_heartbeat>0&&(d=t.idle_heartbeat,c.idle_heartbeat=$t(d)),d&&f===0)throw new Error("idle_heartbeat requires expires");if(d>f)throw new Error("expires must be greater than idle_heartbeat");if(this.info){this.monitor&&this.monitor.cancel(),f&&d&&(this.monitor?this.monitor._change(d,f):this._setupHbMonitoring(d,f));const m=this.info.api,y=`${m.prefix}.CONSUMER.MSG.NEXT.${r}.${u}`,g=this.sub.subject;m.nc.publish(y,m.jc.encode(c),{reply:g})}}}function Jk(e,t){return e?Kk(t):Xk(t)}function Xk(e){return(t,r)=>t?[t,null]:(t=ha(r),t?[t,null]:[null,ql(r,e)])}function Kk(e){return(t,r)=>{if(t)return[t,null];const s=ha(r);return s!==null?[Lx(s),null]:[null,ql(r,e)]}}function Lx(e){if(e!==null)switch(e.code){case ke.JetStream404NoMessages:case ke.JetStream408RequestTimeout:return null;case ke.JetStream409:return i2(e)?e:null;default:return e}return null}function Qk(e){e&&e.ack()}function Zk(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 Wk{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=Zk(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]===vl[0]&&t[1]===vl[1]&&t[2]===vl[2]&&t[3]===vl[3]}async ackAck(t){var s;t=t||{},t.timeout=t.timeout||this.timeout;const r=Vt();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 wx(u.muxSubscriptions,this.msg.reply,{timeout:t.timeout},c);u.request(f);try{u.publish(this.msg.reply,P0,{reply:`${u.muxSubscriptions.baseInbox}${f.token}`})}catch(d){f.cancel(d)}try{await Promise.race([f.timer,f.deferred]),r.resolve(!0)}catch(d){f.cancel(d),r.reject(d)}}else r.resolve(!1);return r}ack(){this.doAck(P0)}nak(t){let r=Mk;t&&(r=Ru().encode(`-NAK ${JSON.stringify({delay:$t(t)})}`)),this.doAck(r)}working(){this.doAck(vl)}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=$t(r.expires));const l=Mr().encode(s),u=xa.concat(Dk,zk,l),c=t?{reply:t}:void 0;this.msg.respond(u,c)}term(t=""){let r=Lk;(t==null?void 0:t.length)>0&&(r=Ru().encode(`+TERM ${t}`)),this.doAck(r)}json(){return this.msg.json()}string(){return this.msg.string()}}const eE="1.30.3",tE="nats.ws";class nE{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=eE,this.lang=tE,this.connected=!1,this.done=!1,this.socketClosed=!1,this.encrypted=!1,this.peeked=!1,this.yields=[],this.signal=Vt(),this.closedNotification=Vt()}async connect(t,r){const s=Vt();if(r.tls)return s.reject(new Re("tls",ke.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=xa.concat(...this.yields),f=N2(c);if(f!==""){const d=pk.exec(f);if(!d){r.debug&&console.error("!!!",fu(c)),s.reject(new Error("unexpected response from server"));return}try{const m=JSON.parse(d[1]);dk(m,this.options),this.peeked=!0,this.connected=!0,this.signal.resolve(),s.resolve()}catch(m){s.reject(m);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 Re(c.message,ke.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 Ea(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(`> ${fu(t[r])}`),yield t[r];if(this.done)break;this.yields.length===0&&(t.length=0,this.yields=t,this.signal=Vt())}}isEncrypted(){return this.connected&&this.encrypted}send(t){if(!this.isDiscarded())try{this.socket.send(t.buffer),this.options.debug&&console.info(`< ${fu(t)}`);return}catch(r){this.options.debug&&console.error(`!!! ${fu(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 rE(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,d=s.pathname,m=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}${d}${m}`}function zx(e={}){return k2({defaultPort:443,urlParseFn:rE,factory:()=>new nE}),Fd.connect(e)}/*! Capacitor: https://capacitorjs.com/ - MIT License */var va;(function(e){e.Unimplemented="UNIMPLEMENTED",e.Unavailable="UNAVAILABLE"})(va||(va={}));class Nh extends Error{constructor(t,r,s){super(t),this.message=t,this.code=r,this.data=s}}const iE=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"},sE=e=>{const t=e.CapacitorCustomPlatform||null,r=e.Capacitor||{},s=r.Plugins=r.Plugins||{},l=()=>t!==null?t.name:iE(e),u=()=>l()!=="web",c=g=>{const x=m.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(v=>v.name===g)},d=g=>e.console.error(g),m=new Map,y=(g,x={})=>{const v=m.get(g);if(v)return console.warn(`Capacitor plugin "${g}" already registered. Cannot register plugins twice.`),v.proxy;const S=l(),j=f(g);let D;const T=async()=>(!D&&S in x?D=typeof x[S]=="function"?D=await x[S]():D=x[S]:t!==null&&!D&&"web"in x&&(D=typeof x.web=="function"?D=await x.web():D=x.web),D),P=(F,V)=>{var L,X;if(j){const G=j==null?void 0:j.methods.find(ue=>V===ue.name);if(G)return G.rtype==="promise"?ue=>r.nativePromise(g,V.toString(),ue):(ue,le)=>r.nativeCallback(g,V.toString(),ue,le);if(F)return(L=F[V])===null||L===void 0?void 0:L.bind(F)}else{if(F)return(X=F[V])===null||X===void 0?void 0:X.bind(F);throw new Nh(`"${g}" plugin is not implemented on ${S}`,va.Unimplemented)}},I=F=>{let V;const L=(...X)=>{const G=T().then(ue=>{const le=P(ue,F);if(le){const re=le(...X);return V=re==null?void 0:re.remove,re}else throw new Nh(`"${g}.${F}()" is not implemented on ${S}`,va.Unimplemented)});return F==="addListener"&&(G.remove=async()=>V()),G};return L.toString=()=>`${F.toString()}() { [capacitor code] }`,Object.defineProperty(L,"name",{value:F,writable:!1,configurable:!1}),L},W=I("addListener"),B=I("removeListener"),R=(F,V)=>{const L=W({eventName:F},V),X=async()=>{const ue=await L;B({eventName:F,callbackId:ue},V)},G=new Promise(ue=>L.then(()=>ue({remove:X})));return G.remove=async()=>{console.warn("Using addListener() without 'await' is deprecated."),await X()},G},Z=new Proxy({},{get(F,V){switch(V){case"$$typeof":return;case"toJSON":return()=>({});case"addListener":return j?R:W;case"removeListener":return B;default:return I(V)}}});return s[g]=Z,m.set(g,{name:g,proxy:Z,platforms:new Set([...Object.keys(x),...j?[S]:[]])}),Z};return r.convertFileSrc||(r.convertFileSrc=g=>g),r.getPlatform=l,r.handleError=d,r.isNativePlatform=u,r.isPluginAvailable=c,r.registerPlugin=y,r.Exception=Nh,r.DEBUG=!!r.DEBUG,r.isLoggingEnabled=!!r.isLoggingEnabled,r},aE=e=>e.Capacitor=sE(e),cr=aE(typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}),ws=cr.registerPlugin;class $d{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 cr.Exception(t,va.Unimplemented)}unavailable(t="not available"){return new cr.Exception(t,va.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 H0=e=>encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape),q0=e=>e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent);class lE extends $d{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=q0(l).trim(),u=q0(u).trim(),r[l]=u}),r}async setCookie(t){try{const r=H0(t.key),s=H0(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)}}}ws("CapacitorCookies",{web:()=>new lE});const oE=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)}),uE=(e={})=>{const t=Object.keys(e);return Object.keys(e).map(l=>l.toLocaleLowerCase()).reduce((l,u,c)=>(l[u]=e[t[c]],l),{})},cE=(e,t=!0)=>e?Object.entries(e).reduce((s,l)=>{const[u,c]=l;let f,d;return Array.isArray(c)?(d="",c.forEach(m=>{f=t?encodeURIComponent(m):m,d+=`${u}=${f}&`}),d.slice(0,-1)):(f=t?encodeURIComponent(c):c,d=`${u}=${f}`),`${s}&${d}`},"").substr(1):null,fE=(e,t={})=>{const r=Object.assign({method:e.method||"GET",headers:e.headers},t),l=uE(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,d)=>{u.append(d,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 hE extends $d{async request(t){const r=fE(t,t.webFetchExtra),s=cE(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 d,m;switch(f){case"arraybuffer":case"blob":m=await u.blob(),d=await oE(m);break;case"json":d=await u.json();break;case"document":case"text":default:d=await u.text()}const y={};return u.headers.forEach((g,x)=>{y[x]=g}),{data:d,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"}))}}ws("CapacitorHttp",{web:()=>new hE});var I0;(function(e){e.Dark="DARK",e.Light="LIGHT",e.Default="DEFAULT"})(I0||(I0={}));var F0;(function(e){e.StatusBar="StatusBar",e.NavigationBar="NavigationBar"})(F0||(F0={}));class dE extends $d{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")}}ws("SystemBars",{web:()=>new dE});const mE="modulepreload",pE=function(e){return"/"+e},$0={},Vd=function(t,r,s){let l=Promise.resolve();if(r&&r.length>0){let c=function(m){return Promise.all(m.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]"),d=(f==null?void 0:f.nonce)||(f==null?void 0:f.getAttribute("nonce"));l=c(r.map(m=>{if(m=pE(m),m in $0)return;$0[m]=!0;const y=m.endsWith(".css"),g=y?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${m}"]${g}`))return;const x=document.createElement("link");if(x.rel=y?"stylesheet":mE,y||(x.as="script"),x.crossOrigin="",x.href=m,d&&x.setAttribute("nonce",d),document.head.appendChild(x),y)return new Promise((v,S)=>{x.addEventListener("load",v),x.addEventListener("error",()=>S(new Error(`Unable to preload CSS for ${m}`)))})}))}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)})},pd=ws("App",{web:()=>Vd(()=>import("./web-DPL9I6BM.js"),[]).then(e=>new e.AppWeb)}),gE=ws("Network",{web:()=>Vd(()=>import("./web-DLOoT-tC.js"),[]).then(e=>new e.NetworkWeb)}),Bu=cr.isNativePlatform()?"https://app.palmier.me":"";async function Ux(e,t,r,s){const l=`${Bu}${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 d;try{const m=JSON.parse(f);d=m.error??m.message??f}catch{d=f}throw console.error(`[API] ${e} ${t} failed:`,c.status,d),new Error(d||`Request failed with status ${c.status}`)}return console.log(`[API] ${e} ${t} ->`,c.status),c.json()}function yE(e,t,r){return Ux("POST",e,t)}function bE(e,t){return Ux("GET",e,void 0)}const V0=cr.isNativePlatform(),Px=A.createContext(null),xE=2e3,Th=6e3,vE=1500,wE=6e4;function SE({children:e,activeHost:t}){const[r,s]=A.useState(null),[l,u]=A.useState(!1),c=A.useRef(null),[f,d]=A.useState(!1),[m,y]=A.useState(!1),[g,x]=A.useState(!1),[v,S]=A.useState(!1),j=A.useRef(Ru()),D=A.useRef(new Set),T=A.useRef(0),P=!!t.directUrl,I=V0&&!P&&!!t.lanUrl&&v,W=m||g?"disconnected":P?f?"direct":"connecting":l?I?"lan":"nats":"connecting",B=W!=="connecting"&&W!=="disconnected";A.useEffect(()=>{if(!V0||P||!t.lanUrl){S(!1);return}let F=!1;const V=t.lanUrl,L=t.hostId;async function X(){console.log("[HOST/LAN] probing",V);try{const re=await fetch(`${V}/health`,{signal:AbortSignal.timeout(vE)});if(F)return;if(!re.ok){console.log("[HOST/LAN] probe got non-ok:",re.status),S(!1);return}const $=await re.json(),q=$.hostId===L;q?console.log("[HOST/LAN] reachable"):console.log("[HOST/LAN] hostId mismatch — got:",$.hostId,"expected:",L),S(q)}catch(re){F||(console.log("[HOST/LAN] probe failed:",re instanceof Error?re.message:re),S(!1))}}X();const G=window.setInterval(X,wE),ue=pd.addListener("appStateChange",re=>{re.isActive&&X()}),le=gE.addListener("networkStatusChange",()=>X());return()=>{F=!0,clearInterval(G),ue.then(re=>re.remove()),le.then(re=>re.remove())}},[t.hostId,t.lanUrl,P]),A.useEffect(()=>{if(P){c.current&&(c.current.close().catch(()=>{}),c.current=null,s(null),u(!1));return}let F=!1,V=1e3;const L=3e4;async function X(){for(;!F;)try{const G=await fetch(`${Bu}/api/nats-credentials/${t.hostId}`);if(F)return;if(G.status===401||G.status===403||G.status===404){console.error("[NATS] Host not found or rejected by relay:",G.status),x(!0);return}if(!G.ok)throw new Error(`credentials fetch ${G.status}`);const ue=await G.json();if(!ue.natsWsUrl){console.error("[NATS] Relay returned empty natsWsUrl — treating as terminal"),x(!0);return}if(F)return;console.log("[NATS] Connecting to",ue.natsWsUrl);const le=await zx({servers:ue.natsWsUrl,authenticator:Ax(ue.natsJwt,new TextEncoder().encode(ue.natsNkeySeed)),pingInterval:3e4,maxPingOut:2});if(F){le.close().catch(()=>{});return}if(console.log("[NATS] Connected"),c.current=le,s(le),u(!0),V=1e3,await le.closed(),F)return;console.log("[NATS] Connection closed, will reconnect"),c.current=null,s(null),u(!1)}catch(G){if(F)return;console.warn(`[NATS] Connect failed, retrying in ${V}ms:`,G),u(!1),await new Promise(ue=>setTimeout(ue,V)),V=Math.min(V*2,L)}}return X(),()=>{F=!0,c.current&&(c.current.close().catch(()=>{}),c.current=null,s(null),u(!1))}},[P,t]),A.useEffect(()=>{if(P)return;const F=pd.addListener("appStateChange",V=>{if(!V.isActive||!c.current)return;const L=c.current;Promise.race([L.flush(),new Promise((X,G)=>setTimeout(()=>G(new Error("ping timeout")),2e3))]).catch(()=>{console.log("[NATS] Resume probe failed — cycling conn"),L.close().catch(()=>{})})});return()=>{F.then(V=>V.remove())}},[P]),A.useEffect(()=>{if(!P){d(!1);return}const F=new AbortController;async function V(){var ue;const X=new AbortController,G=setTimeout(()=>X.abort(),xE);F.signal.addEventListener("abort",()=>X.abort());try{const le=await fetch(`${t.directUrl}/events`,{headers:{Authorization:`Bearer ${t.clientToken}`},signal:X.signal});return clearTimeout(G),le.ok?((ue=le.body)==null?void 0:ue.getReader())??null:null}catch{return clearTimeout(G),null}}async function L(X){d(!0),console.log("[HOST] SSE connected to",t.directUrl),T.current=Date.now();function G(){setTimeout(()=>{F.signal.aborted||Date.now()-T.current<Th||(console.log("[HOST] Heartbeat timeout — no data for",Th/1e3,"s"),F.abort(),d(!1),console.log("[HOST] Direct host unreachable"))},Th)}G();const ue=new TextDecoder;let le="";try{for(;;){const{done:re,value:$}=await X.read();if(re)break;le+=ue.decode($,{stream:!0}),T.current=Date.now(),G();const q=le.split(`
88
- `);le=q.pop()??"";for(const ae of q)if(ae.startsWith("data: ")){const be=ae.slice(6);try{const M=JSON.parse(be);if(M.task_id&&M.event_type){const U=`host-event.${t.hostId}.${M.task_id}`;for(const ee of D.current)ee({subject:U,data:j.current.encode(be)})}}catch{}}}}catch{}}return(async()=>{const X=await V();X&&await L(X)})(),()=>{F.abort(),d(!1)}},[t,P]);const R=A.useCallback(async(F,V,L)=>{function X(le){le&&typeof le=="object"&&le.error==="Unauthorized"&&y(!0)}async function G(le,re){console.log(`[HOST/${re}] → ${F}`,V??"");const $=await fetch(`${le}/rpc/${F}`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t.clientToken}`},body:V!=null?JSON.stringify(V):void 0,signal:L!=null&&L.timeout?AbortSignal.timeout(L.timeout):void 0});if($.status===401)throw y(!0),new Error("Unauthorized");const q=await $.json();return X(q),console.log(`[HOST/${re}] ← ${F}`,q),q}async function ue(){if(!c.current)throw new Error("Not connected");const le=`host.${t.hostId}.rpc.${F}`,re={...V??{},clientToken:t.clientToken},$=j.current.encode(JSON.stringify(re));console.log(`[HOST/NATS] → ${F}`,V??"");const q=await c.current.request(le,$,{timeout:(L==null?void 0:L.timeout)??1e4}),ae=JSON.parse(j.current.decode(q.data));return X(ae),console.log(`[HOST/NATS] ← ${F}`,ae),ae}if(P)return G(t.directUrl,"HTTP");if(I&&t.lanUrl)try{return await G(t.lanUrl,"LAN")}catch(le){if(le instanceof Error&&le.message==="Unauthorized")throw le;console.log("[HOST/LAN] failed, falling back to NATS:",le),S(!1)}return ue()},[t,P,I]),Z=A.useCallback((F,V)=>{if(P)return D.current.add(V),()=>{D.current.delete(V)};if(c.current){const L=c.current.subscribe(`host-event.${F}.>`);let X=!1;return(async()=>{try{for await(const G of L){if(X)break;V({subject:G.subject,data:G.data})}}catch{}})(),()=>{X=!0,L.unsubscribe()}}return()=>{}},[t,P]);return b.jsx(Px.Provider,{value:{connected:B,mode:W,nc:r,request:R,subscribeEvents:Z,activeHost:t,unauthorized:m},children:e})}function yi(){const e=A.useContext(Px);if(!e)throw new Error("useHostConnection must be used within HostConnectionProvider");return e}const An=cr.isNativePlatform()?ws("Device"):null;function _E(e,t){const r=new Date(e),s=new Date,l={year:"numeric",month:"2-digit",day:"2-digit",timeZone:t};return r.toLocaleDateString(void 0,l)===s.toLocaleDateString(void 0,l)?new Intl.DateTimeFormat(void 0,{timeStyle:"short",timeZone:t}).format(r):new Intl.DateTimeFormat(void 0,{dateStyle:"medium",timeStyle:"short",timeZone:t}).format(r)}function Yd(){const{activeHost:e}=yi(),t=e.timezone;return A.useCallback(r=>_E(r,t),[t])}function kE(e){const t=new Intl.DateTimeFormat("en-CA",{timeZone:e,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",hour12:!1}).formatToParts(new Date),r=s=>{var l;return((l=t.find(u=>u.type===s))==null?void 0:l.value)??""};return{date:`${r("year")}-${r("month")}-${r("day")}`,time:`${r("hour")}:${r("minute")}`}}function EE(e){const t=new Intl.DateTimeFormat("en-CA",{timeZone:e,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",hour12:!1}).formatToParts(new Date),r=s=>{var l;return Number(((l=t.find(u=>u.type===s))==null?void 0:l.value)??"0")};return{year:r("year"),month:r("month"),day:r("day"),hour:r("hour")%24,minute:r("minute")}}function CE(e,t,r){return new Date(Date.UTC(e,t-1,r)).getUTCDay()}function AE(e,t){return new Date(Date.UTC(e,t,0)).getUTCDate()}function Y0(e,t){const r=new Date(Date.UTC(e.year,e.month-1,e.day));return r.setUTCDate(r.getUTCDate()+t),{year:r.getUTCFullYear(),month:r.getUTCMonth()+1,day:r.getUTCDate(),hour:e.hour,minute:e.minute}}function Rl(e,t){return e.year!==t.year?e.year-t.year:e.month!==t.month?e.month-t.month:e.day!==t.day?e.day-t.day:e.hour!==t.hour?e.hour-t.hour:e.minute-t.minute}function jE(e,t){const r=Date.UTC(e.year,e.month-1,e.day,e.hour,e.minute);if(!t)return r;const s=new Intl.DateTimeFormat("en-CA",{timeZone:t,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}).formatToParts(new Date(r)),l=c=>{var f;return Number(((f=s.find(d=>d.type===c))==null?void 0:f.value)??"0")},u=Date.UTC(l("year"),l("month")-1,l("day"),l("hour")%24,l("minute"),l("second"));return r-(u-r)}function NE(e,t){const r=e.split(" ");if(r.length!==5)return null;const[s,l,u,,c]=r;if(l==="*"){const y=Number(s);if(Number.isNaN(y))return null;if(y>t.minute)return{...t,minute:y};const g=new Date(Date.UTC(t.year,t.month-1,t.day,t.hour+1,y));return{year:g.getUTCFullYear(),month:g.getUTCMonth()+1,day:g.getUTCDate(),hour:g.getUTCHours(),minute:g.getUTCMinutes()}}const f=Number(s),d=Number(l);if(Number.isNaN(f)||Number.isNaN(d))return null;if(c!=="*"){const y=Number(c);if(Number.isNaN(y))return null;for(let g=0;g<8;g++){const x=Y0({...t,hour:d,minute:f},g);if(CE(x.year,x.month,x.day)===y&&Rl(x,t)>0)return x}return null}if(u!=="*"){const y=Number(u);if(Number.isNaN(y))return null;let g=t.year,x=t.month;for(let v=0;v<24;v++){if(y<=AE(g,x)){const S={year:g,month:x,day:y,hour:d,minute:f};if(Rl(S,t)>0)return S}x++,x>12&&(x=1,g++)}return null}const m={...t,hour:d,minute:f};return Rl(m,t)>0?m:Y0(m,1)}function TE(e){const t=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})/.exec(e);return t?{year:Number(t[1]),month:Number(t[2]),day:Number(t[3]),hour:Number(t[4]),minute:Number(t[5])}:null}function OE(e,t,r){if(!e||!t||t.length===0||e==="on_new_notification"||e==="on_new_sms")return null;const s=EE(r),l=[];for(const u of t)if(e==="specific_times"){const c=TE(u);c&&Rl(c,s)>0&&l.push(c)}else{const c=NE(u,s);c&&l.push(c)}return l.length===0?null:(l.sort(Rl),jE(l[0],r))}const Bx={};function RE(e){for(const t of e)Bx[t.key]=t.label}function gd(e){return Bx[e]??e}const ME=()=>window.matchMedia("(max-width: 600px)").matches;function DE({task:e,lastEvent:t,onEdit:r,onDelete:s,onViewRun:l}){var $;const{request:u,activeHost:c}=yi(),f=Yd(),d=c.timezone,[m,y]=A.useState(!1),[g,x]=A.useState(!1),[v,S]=A.useState(!1),j=A.useRef(null),D=(t==null?void 0:t.running_state)==="started",T=((($=e.schedule_values)==null?void 0:$.length)??0)>0,P=e.schedule_type==="on_new_notification"||e.schedule_type==="on_new_sms",I=!!e.command,W=!!e.schedule_type&&(T||P)||I,R=!!e.schedule_enabled&&W?D?"var(--color-success)":(t==null?void 0:t.running_state)==="failed"?"var(--color-error)":"var(--color-success)":"var(--color-text-secondary)";A.useEffect(()=>{if(!g)return;function q(ae){j.current&&!j.current.contains(ae.target)&&x(!1)}return document.addEventListener("mousedown",q),()=>document.removeEventListener("mousedown",q)},[g]);function Z(){ME()?S(!0):x(q=>!q)}function F(){x(!1),S(!1)}async function V(){if(F(),!!confirm("Abort this task?")){y(!0);try{await u("task.abort",{id:e.id})}catch(q){console.error("Abort failed:",q)}finally{y(!1)}}}async function L(){F();try{const q=await u("task.run",{id:e.id});l(e.id,q.run_id)}catch(q){console.error("Run failed:",q)}}async function X(){if(F(),!!confirm("Delete this task? Results and reports will be kept."))try{await u("task.delete",{id:e.id}),s(e.id)}catch(q){console.error("Delete failed:",q)}}const G={started:"Started",finished:"Finished",aborted:"Aborted",failed:"Failed"};function ue(){if(I)return"On Command Output";if(e.schedule_type==="on_new_notification")return"On new notification";if(e.schedule_type==="on_new_sms")return"On new SMS";const q=OE(e.schedule_type,e.schedule_values,d);return q===null?"No upcoming runs":`Next: ${f(q)}`}const le=ue(),re=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"]}),D?b.jsxs("button",{className:"menu-item-danger",onClick:V,disabled:m,children:[b.jsx("span",{className:"menu-icon",children:"◼"}),"Abort"]}):b.jsxs(b.Fragment,{children:[b.jsxs("button",{onClick:L,children:[b.jsx("span",{className:"menu-icon",children:"▶"}),"Run Now"]}),b.jsxs("button",{className:"menu-item-danger",onClick:X,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,D?"latest":void 0),children:[b.jsxs("div",{className:"task-card-header",children:[b.jsxs("div",{className:"task-card-title-row",children:[D?b.jsx("span",{className:"status-spinner",children:b.jsx("span",{})}):b.jsx("span",{className:"status-dot",style:{backgroundColor:R}}),b.jsx("h3",{className:"task-card-name",children:e.name||e.user_prompt})]}),b.jsx("div",{className:"task-card-actions",onClick:q=>q.stopPropagation(),children:b.jsxs("div",{className:"task-card-menu",ref:j,children:[b.jsx("button",{className:"task-card-menu-btn",onClick:Z,"aria-label":"Task actions",children:"⋮"}),g&&b.jsx("div",{className:"task-card-menu-dropdown",children:re})]})})]}),b.jsxs("div",{className:"task-card-meta",children:[e.agent&&b.jsx("span",{className:"task-card-agent",children:gd(e.agent)}),t&&G[t.running_state]&&b.jsxs("span",{className:"task-card-last-event",children:[G[t.running_state]," ",f(t.time_stamp)]}),W&&b.jsx("span",{className:"task-card-triggers",children:e.schedule_enabled?le:"Schedule disabled"})]})]}),v&&di.createPortal(b.jsx("div",{className:"bottom-sheet-overlay",onClick:()=>S(!1),children:b.jsxs("div",{className:"bottom-sheet",onClick:q=>q.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:re})]})}),document.body)]})}function LE({permissions:e}){return b.jsxs("div",{className:"permissions-dialog",children:[b.jsx("h2",{children:"Granted Permissions"}),b.jsx("div",{className:"permissions-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:"permissions-empty",children:"No permissions have been granted for this task."})}),b.jsx("div",{className:"permissions-dialog-actions",children:b.jsx("button",{className:"btn btn-secondary",onClick:()=>history.back(),children:"Back"})})]})}const aa=[];function zE(){const e=aa.pop();e&&(e.pushed.current=!1,e.close())}let G0=!1;function UE(){G0||(G0=!0,window.addEventListener("popstate",zE))}function yd(e,t){const r=A.useRef(!1),s=A.useRef(t);s.current=t;const l=A.useCallback(()=>s.current(),[]),u=A.useRef({close:l,pushed:r});u.current.close=l,A.useEffect(()=>{if(e&&!r.current)UE(),history.pushState({modal:!0},""),aa.push(u.current),r.current=!0;else if(!e&&r.current){r.current=!1;const c=aa.indexOf(u.current);c!==-1&&aa.splice(c,1),history.back()}},[e,l]),A.useEffect(()=>{const c=u.current;return()=>{if(r.current){r.current=!1;const f=aa.indexOf(c);f!==-1&&aa.splice(f,1),history.back()}}},[])}const PE=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],BE=["specific_times","hourly","daily","weekly","monthly"];function pu(e){return BE.includes(e)}function HE(e){return e==="on_new_notification"||e==="on_new_sms"}function hi(e="daily"){return{schedule:e,time:"00:00",dayOfWeek:"1",dayOfMonth:"1",onceDate:"",onceTime:"00:00"}}function qE(e){const t=e.split(" ");if(t.length!==5)return hi();const[r,s,l,,u]=t;if(s==="*")return hi("hourly");const c=`${s.padStart(2,"0")}:${r.padStart(2,"0")}`;return u!=="*"?{...hi("weekly"),time:c,dayOfWeek:u}:l!=="*"?{...hi("monthly"),time:c,dayOfMonth:l}:{...hi("daily"),time:c}}function Hx(e,t){if(e==="specific_times"){const[r,s]=t.split("T");return{...hi("specific_times"),onceDate:r??"",onceTime:(s??"09:00").slice(0,5)}}return qE(t)}function IE(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 FE(e){return e.schedule==="specific_times"?e.onceDate?`${e.onceDate}T${e.onceTime}`:null:IE(e)}function Oh(e){return e==="specific_times"?"specific_times":e==="on_new_notification"?"on_new_notification":e==="on_new_sms"?"on_new_sms":"crons"}function Rh(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?Hx(t,r).schedule:"ondemand"}function $E({initial:e,agents:t,hostPlatform:r,isNotificationListener:s,onSaved:l,onCancel:u}){var nt;const{request:c,activeHost:f}=yi(),{setHostLastAgent:d}=Xi(),m=()=>{var Oe;const ve=f.lastAgent,Be=t.map(_t=>_t.key);return ve&&Be.includes(ve)?ve:((Oe=t[0])==null?void 0:Oe.key)??""},[y,g]=A.useState((e==null?void 0:e.user_prompt)??""),[x,v]=A.useState((e==null?void 0:e.agent)??m()),S=!!((nt=e==null?void 0:e.permissions)!=null&&nt.length)&&x===(e==null?void 0:e.agent),[j,D]=A.useState(!1),T=A.useCallback(()=>D(!1),[]);yd(j,T);const[P,I]=A.useState(null),[W,B]=A.useState(()=>Rh(e)),[R,Z]=A.useState(()=>{const ve=e==null?void 0:e.schedule_type,Be=e==null?void 0:e.schedule_values;if(Be&&(ve==="crons"||ve==="specific_times"))return Be.map(_t=>Hx(ve,_t));const Oe=Rh(e);return pu(Oe)?[hi(Oe)]:[]}),[F,V]=A.useState((e==null?void 0:e.requires_confirmation)??!1),[L,X]=A.useState(e!=null&&e.schedule_type||e!=null&&e.command?e.schedule_enabled??!0:!0),[G,ue]=A.useState((e==null?void 0:e.yolo_mode)??!1),[le,re]=A.useState((e==null?void 0:e.foreground_mode)??!1),[$,q]=A.useState((e==null?void 0:e.command)??""),[ae,be]=A.useState(!1),M=(e==null?void 0:e.schedule_type)==="on_new_notification"&&e.schedule_values&&e.schedule_values.length>0?e.schedule_values[0]:"",[U,ee]=A.useState(M),[_,ge]=A.useState([]),[Ce,we]=A.useState(!1),[Te,Ve]=A.useState(!1),[Ae,dt]=A.useState(""),qt=A.useCallback(()=>Ve(!1),[]);yd(Te,qt),A.useEffect(()=>{if(W!=="on_new_notification"||!s||!cr.isNativePlatform()||!An)return;let ve=!1;return we(!0),An.getInstalledApps().then(({apps:Be})=>{if(ve)return;const Oe="com.palmier.app",_t=Be.filter(Qt=>Qt.packageName!==Oe).sort((Qt,On)=>(Qt.appName||Qt.packageName).localeCompare(On.appName||On.packageName));ge(_t)}).catch(()=>{}).finally(()=>{ve||we(!1)}),()=>{ve=!0}},[W,s]);const ln=(e==null?void 0:e.schedule_type)==="on_new_sms"&&e.schedule_values&&e.schedule_values.length>0?e.schedule_values[0]:"",[tn,Gt]=A.useState(ln),on=A.useRef(null),Rt=pu(W),Kt=W==="command",Pe=HE(W),ct=W==="specific_times"||W==="daily"||W==="weekly"||W==="monthly",Ke=t.find(ve=>ve.key===x),bt=!!(Ke!=null&&Ke.supportsYolo);A.useEffect(()=>{!bt&&G&&ue(!1)},[bt,G]);const zt=!!e,Pn=Rh(e),$e=!zt||y!==((e==null?void 0:e.user_prompt)??"")||x!==((e==null?void 0:e.agent)??"")||W!==Pn||F!==((e==null?void 0:e.requires_confirmation)??!1)||L!==(e!=null&&e.schedule_type||e!=null&&e.command?e.schedule_enabled??!0:!0)||G!==((e==null?void 0:e.yolo_mode)??!1)||le!==((e==null?void 0:e.foreground_mode)??!1)||Kt&&$!==((e==null?void 0:e.command)??"")||Rt&&(JSON.stringify(vn())!==JSON.stringify((e==null?void 0:e.schedule_values)??[])||Oh(W)!==((e==null?void 0:e.schedule_type)??void 0))||Pe&&W!==(e==null?void 0:e.schedule_type)||W==="on_new_notification"&&U.trim()!==M.trim()||W==="on_new_sms"&&tn.trim()!==ln.trim(),Tn=kE(f.timezone),ce=Rt&&R.some(ve=>ve.schedule==="specific_times"&&(!ve.onceDate||ve.onceDate<Tn.date||ve.onceDate===Tn.date&&(ve.onceTime??"")<=Tn.time)),_e=$e&&!!y.trim()&&!ce&&(!Kt||!!$.trim())&&(!Rt||R.length>0);function Le(ve,Be){Z(Oe=>Oe.map((_t,Qt)=>Qt===ve?{..._t,...Be}:_t))}function Ge(ve){Z(Be=>Be.filter((Oe,_t)=>_t!==ve))}function et(){pu(W)&&Z(ve=>[...ve,ve.length>0?{...ve[ve.length-1]}:hi(W)])}function un(ve){B(ve),pu(ve)?Z([hi(ve)]):(Z([]),V(!1)),ve==="command"?setTimeout(()=>{var Be;return(Be=on.current)==null?void 0:Be.focus()},0):q(""),ve!=="on_new_notification"&&ee(M),ve!=="on_new_sms"&&Gt(ln)}function vn(){return R.flatMap(ve=>{const Be=FE(ve);return Be?[Be]:[]})}function Ct(){return G?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.
87
+ ${f.stack}`),c.reject(m)):c.resolve(y))}});return d.requestSubject=t,this.protocol.publish(t,r,{reply:o,headers:s.headers}),c}else{const o=new xx(this.protocol.muxSubscriptions,t,s,l);this.protocol.request(o);try{this.publish(t,r,{reply:`${this.protocol.muxSubscriptions.baseInbox}${o.token}`,headers:s.headers})}catch(f){o.cancel(f)}const c=Promise.race([o.timer,o.deferred]);return c.catch(()=>{o.cancel()}),c}}flush(){return this.isClosed()?Promise.reject(Re.errorForCode(ke.ConnectionClosed)):this.protocol.flush()}drain(){return this.isClosed()?Promise.reject(Re.errorForCode(ke.ConnectionClosed)):this.isDraining()?Promise.reject(Re.errorForCode(ke.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 xn;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 Ik(this,t);if(t.checkAPI!==!1)try{await r.getAccountInfo()}catch(s){const l=s;throw l.code===ke.NoResponders&&(l.code=ke.JetStreamNotEnabled),l}return r}jetstream(t={}){return new Id(this,t)}getServerVersion(){const t=this.info;return t?bs(t.version):void 0}async rtt(){if(!this.protocol._closed&&!this.protocol.connected)throw Re.errorForCode(ke.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 Yk(this)),this._services}reconnect(){return this.isClosed()?Promise.reject(Re.errorForCode(ke.ConnectionClosed)):this.isDraining()?Promise.reject(Re.errorForCode(ke.ConnectionDraining)):this.protocol.reconnect()}}class Yk{constructor(t){C(this,"nc");this.nc=t}add(t){try{return new Gl(this.nc,t).start()}catch(r){return Promise.reject(r)}}client(t,r){return new Ek(this.nc,t,r)}}class Gk{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(Pu)||"PUT"}get length(){const t=this.sm.header.get(Un.MessageSizeHdr)||"";return t!==""?parseInt(t,10):this.sm.data.length}json(){return this.sm.json()}string(){return this.sm.string()}}class Jk{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(Ud(this.sm.info.timestampNanos))}get revision(){return this.sm.seq}get operation(){var t;return((t=this.sm.headers)==null?void 0:t.get(Pu))||"PUT"}get delta(){return this.sm.info.pending}get length(){var r;const t=((r=this.sm.headers)==null?void 0:r.get(Un.MessageSizeHdr))||"";return t!==""?parseInt(t,10):this.sm.data.length}json(){return this.sm.json()}string(){return this.sm.string()}}class Rx extends E2{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=mi(this.js.nc.options.inboxPrefix);this.js.nc._resub(this.sub,s);const o=this.info;o.config.name=Gi.next(),o.ordered_consumer_sequence.delivery_seq=0,o.flow_control.heartbeat_count=0,o.flow_control.fc_count=0,o.flow_control.consumer_restarts++,o.deliver=s,o.config.deliver_subject=s,o.config.deliver_policy=an.StartSequence,o.config.opt_start_seq=r;const c={};c.stream_name=this.info.stream,c.config=o.config;const f=`${o.api.prefix}.CONSUMER.CREATE.${o.stream}`;this.js._request(f,c,{retries:-1}).then(d=>{const m=d,y=this.sub.info;y.last=m,this.info.config=m.config,this.info.name=m.name}).catch(d=>{const m=new Re(`unable to recreate ordered consumer ${o.stream} at seq ${r}`,ke.RequestError,d);this.sub.callback(m,{})})}_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(Ud(r))}_setupHbMonitoring(r,s=0){const l={cancelAfter:0,maxOut:2};s&&(l.cancelAfter=s);const o=this.sub,c=f=>{var y,g,x,v;const d=s2(409,`${_r.IdleHeartbeatMissed}: ${f}`,this.sub.subject);if(!((y=this.info)==null?void 0:y.ordered))this.sub.callback(null,d);else{if(!this.js.nc.protocol.connected)return!1;const S=((x=(g=this.info)==null?void 0:g.ordered_consumer_sequence)==null?void 0:x.stream_seq)||0;return this._resetOrderedConsumer(S+1),(v=this.monitor)==null||v.restart(),!1}return!o.noIterator};this.monitor=new Bd(r,c,l)}_checkHbOrderConsumer(r){const s=r.headers.get(Un.ConsumerStalledHdr);s!==""&&this.js.nc.publish(s);const l=parseInt(r.headers.get(Un.LastConsumerSeqHdr),10),o=this.info.ordered_consumer_sequence;return this.info.flow_control.heartbeat_count++,l!==o.delivery_seq&&this._resetOrderedConsumer(o.stream_seq+1),!1}_checkOrderedConsumer(r){const s=this.info.ordered_consumer_sequence,l=r.info.streamSequence,o=r.info.deliverySequence;return o!=s.delivery_seq+1?(this._resetOrderedConsumer(s.stream_seq+1),!1):(s.delivery_seq=o,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}`,o=await r.api._request(l);return r.last=o,o}}class Xk extends Rx{constructor(t,r,s){super(t,r,s)}pull(t={batch:1}){const{stream:r,config:s,name:l}=this.sub.info,o=s.durable_name??l,c={};if(c.batch=t.batch||1,c.no_wait=t.no_wait||!1,(t.max_bytes??0)>0){const m=this.js.nc.features.get(pt.JS_PULL_MAX_BYTES);if(!m.ok)throw new Error(`max_bytes is only supported on servers ${m.min} or better`);c.max_bytes=t.max_bytes}let f=0;t.expires&&t.expires>0&&(f=t.expires,c.expires=$t(f));let d=0;if(t.idle_heartbeat&&t.idle_heartbeat>0&&(d=t.idle_heartbeat,c.idle_heartbeat=$t(d)),d&&f===0)throw new Error("idle_heartbeat requires expires");if(d>f)throw new Error("expires must be greater than idle_heartbeat");if(this.info){this.monitor&&this.monitor.cancel(),f&&d&&(this.monitor?this.monitor._change(d,f):this._setupHbMonitoring(d,f));const m=this.info.api,y=`${m.prefix}.CONSUMER.MSG.NEXT.${r}.${o}`,g=this.sub.subject;m.nc.publish(y,m.jc.encode(c),{reply:g})}}}function Kk(e,t){return e?Zk(t):Qk(t)}function Qk(e){return(t,r)=>t?[t,null]:(t=ha(r),t?[t,null]:[null,ql(r,e)])}function Zk(e){return(t,r)=>{if(t)return[t,null];const s=ha(r);return s!==null?[Mx(s),null]:[null,ql(r,e)]}}function Mx(e){if(e!==null)switch(e.code){case ke.JetStream404NoMessages:case ke.JetStream408RequestTimeout:return null;case ke.JetStream409:return a2(e)?e:null;default:return e}return null}function Wk(e){e&&e.ack()}function eE(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 tE{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=eE(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]===vl[0]&&t[1]===vl[1]&&t[2]===vl[2]&&t[3]===vl[3]}async ackAck(t){var s;t=t||{},t.timeout=t.timeout||this.timeout;const r=Vt();if(this.didAck)r.resolve(!1);else if(this.didAck=!0,this.msg.reply){const o=this.msg.publisher,c=!((s=o.options)!=null&&s.noAsyncTraces),f=new xx(o.muxSubscriptions,this.msg.reply,{timeout:t.timeout},c);o.request(f);try{o.publish(this.msg.reply,B0,{reply:`${o.muxSubscriptions.baseInbox}${f.token}`})}catch(d){f.cancel(d)}try{await Promise.race([f.timer,f.deferred]),r.resolve(!0)}catch(d){f.cancel(d),r.reject(d)}}else r.resolve(!1);return r}ack(){this.doAck(B0)}nak(t){let r=Lk;t&&(r=Ru().encode(`-NAK ${JSON.stringify({delay:$t(t)})}`)),this.doAck(r)}working(){this.doAck(vl)}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=$t(r.expires));const l=Mr().encode(s),o=xa.concat(zk,Pk,l),c=t?{reply:t}:void 0;this.msg.respond(o,c)}term(t=""){let r=Uk;(t==null?void 0:t.length)>0&&(r=Ru().encode(`+TERM ${t}`)),this.doAck(r)}json(){return this.msg.json()}string(){return this.msg.string()}}const nE="1.30.3",rE="nats.ws";class iE{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=nE,this.lang=rE,this.connected=!1,this.done=!1,this.socketClosed=!1,this.encrypted=!1,this.peeked=!1,this.yields=[],this.signal=Vt(),this.closedNotification=Vt()}async connect(t,r){const s=Vt();if(r.tls)return s.reject(new Re("tls",ke.InvalidOption)),s;this.options=r;const l=t.src;if(r.wsFactory){const{socket:o,encrypted:c}=await r.wsFactory(t.src,r);this.socket=o,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=o=>{if(this.isDiscarded())return;if(this.yields.push(new Uint8Array(o.data)),this.peeked){this.signal.resolve();return}const c=xa.concat(...this.yields),f=O2(c);if(f!==""){const d=yk.exec(f);if(!d){r.debug&&console.error("!!!",fu(c)),s.reject(new Error("unexpected response from server"));return}try{const m=JSON.parse(d[1]);pk(m,this.options),this.peeked=!0,this.connected=!0,this.signal.resolve(),s.resolve()}catch(m){s.reject(m);return}}},this.socket.onclose=o=>{if(this.isDiscarded())return;this.socketClosed=!0;let c;this.done||(o.wasClean||(c=new Error(o.reason)),this._closed(c))},this.socket.onerror=o=>{if(this.isDiscarded())return;const c=o,f=new Re(c.message,ke.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 Ea(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(`> ${fu(t[r])}`),yield t[r];if(this.done)break;this.yields.length===0&&(t.length=0,this.yields=t,this.signal=Vt())}}isEncrypted(){return this.connected&&this.encrypted}send(t){if(!this.isDiscarded())try{this.socket.send(t.buffer),this.options.debug&&console.info(`< ${fu(t)}`);return}catch(r){this.options.debug&&console.error(`!!! ${fu(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 sE(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 o,c;const f=s.hostname,d=s.pathname,m=s.search||"";switch(l){case"http:":case"ws:":case"nats:":c=s.port||"80",o="ws:";break;case"https:":case"wss:":case"tls:":c=s.port||"443",o="wss:";break;default:c=s.port||t===!0?"443":"80",o=t===!0?"wss:":"ws:";break}return`${o}//${f}:${c}${d}${m}`}function Dx(e={}){return C2({defaultPort:443,urlParseFn:sE,factory:()=>new iE}),Fd.connect(e)}/*! Capacitor: https://capacitorjs.com/ - MIT License */var va;(function(e){e.Unimplemented="UNIMPLEMENTED",e.Unavailable="UNAVAILABLE"})(va||(va={}));class Nh extends Error{constructor(t,r,s){super(t),this.message=t,this.code=r,this.data=s}}const aE=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"},lE=e=>{const t=e.CapacitorCustomPlatform||null,r=e.Capacitor||{},s=r.Plugins=r.Plugins||{},l=()=>t!==null?t.name:aE(e),o=()=>l()!=="web",c=g=>{const x=m.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(v=>v.name===g)},d=g=>e.console.error(g),m=new Map,y=(g,x={})=>{const v=m.get(g);if(v)return console.warn(`Capacitor plugin "${g}" already registered. Cannot register plugins twice.`),v.proxy;const S=l(),A=f(g);let M;const T=async()=>(!M&&S in x?M=typeof x[S]=="function"?M=await x[S]():M=x[S]:t!==null&&!M&&"web"in x&&(M=typeof x.web=="function"?M=await x.web():M=x.web),M),P=($,V)=>{var L,X;if(A){const G=A==null?void 0:A.methods.find(ce=>V===ce.name);if(G)return G.rtype==="promise"?ce=>r.nativePromise(g,V.toString(),ce):(ce,oe)=>r.nativeCallback(g,V.toString(),ce,oe);if($)return(L=$[V])===null||L===void 0?void 0:L.bind($)}else{if($)return(X=$[V])===null||X===void 0?void 0:X.bind($);throw new Nh(`"${g}" plugin is not implemented on ${S}`,va.Unimplemented)}},I=$=>{let V;const L=(...X)=>{const G=T().then(ce=>{const oe=P(ce,$);if(oe){const re=oe(...X);return V=re==null?void 0:re.remove,re}else throw new Nh(`"${g}.${$}()" is not implemented on ${S}`,va.Unimplemented)});return $==="addListener"&&(G.remove=async()=>V()),G};return L.toString=()=>`${$.toString()}() { [capacitor code] }`,Object.defineProperty(L,"name",{value:$,writable:!1,configurable:!1}),L},W=I("addListener"),B=I("removeListener"),D=($,V)=>{const L=W({eventName:$},V),X=async()=>{const ce=await L;B({eventName:$,callbackId:ce},V)},G=new Promise(ce=>L.then(()=>ce({remove:X})));return G.remove=async()=>{console.warn("Using addListener() without 'await' is deprecated."),await X()},G},Z=new Proxy({},{get($,V){switch(V){case"$$typeof":return;case"toJSON":return()=>({});case"addListener":return A?D:W;case"removeListener":return B;default:return I(V)}}});return s[g]=Z,m.set(g,{name:g,proxy:Z,platforms:new Set([...Object.keys(x),...A?[S]:[]])}),Z};return r.convertFileSrc||(r.convertFileSrc=g=>g),r.getPlatform=l,r.handleError=d,r.isNativePlatform=o,r.isPluginAvailable=c,r.registerPlugin=y,r.Exception=Nh,r.DEBUG=!!r.DEBUG,r.isLoggingEnabled=!!r.isLoggingEnabled,r},oE=e=>e.Capacitor=lE(e),Gn=oE(typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}),ws=Gn.registerPlugin;class $d{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 o=this.windowListeners[t];o&&!o.registered&&this.addWindowListener(o),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 o=this.retainedEventArguments[t];o||(o=[]),o.push(r),this.retainedEventArguments[t]=o}return}l.forEach(o=>o(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 Gn.Exception(t,va.Unimplemented)}unavailable(t="not available"){return new Gn.Exception(t,va.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 q0=e=>encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape),I0=e=>e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent);class uE extends $d{async getCookies(){const t=document.cookie,r={};return t.split(";").forEach(s=>{if(s.length<=0)return;let[l,o]=s.replace(/=/,"CAP_COOKIE").split("CAP_COOKIE");l=I0(l).trim(),o=I0(o).trim(),r[l]=o}),r}async setCookie(t){try{const r=q0(t.key),s=q0(t.value),l=t.expires?`; expires=${t.expires.replace("expires=","")}`:"",o=(t.path||"/").replace("path=",""),c=t.url!=null&&t.url.length>0?`domain=${t.url}`:"";document.cookie=`${r}=${s||""}${l}; path=${o}; ${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)}}}ws("CapacitorCookies",{web:()=>new uE});const cE=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)}),fE=(e={})=>{const t=Object.keys(e);return Object.keys(e).map(l=>l.toLocaleLowerCase()).reduce((l,o,c)=>(l[o]=e[t[c]],l),{})},hE=(e,t=!0)=>e?Object.entries(e).reduce((s,l)=>{const[o,c]=l;let f,d;return Array.isArray(c)?(d="",c.forEach(m=>{f=t?encodeURIComponent(m):m,d+=`${o}=${f}&`}),d.slice(0,-1)):(f=t?encodeURIComponent(c):c,d=`${o}=${f}`),`${s}&${d}`},"").substr(1):null,dE=(e,t={})=>{const r=Object.assign({method:e.method||"GET",headers:e.headers},t),l=fE(e.headers)["content-type"]||"";if(typeof e.data=="string")r.body=e.data;else if(l.includes("application/x-www-form-urlencoded")){const o=new URLSearchParams;for(const[c,f]of Object.entries(e.data||{}))o.set(c,f);r.body=o.toString()}else if(l.includes("multipart/form-data")||e.data instanceof FormData){const o=new FormData;if(e.data instanceof FormData)e.data.forEach((f,d)=>{o.append(d,f)});else for(const f of Object.keys(e.data))o.append(f,e.data[f]);r.body=o;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 mE extends $d{async request(t){const r=dE(t,t.webFetchExtra),s=hE(t.params,t.shouldEncodeUrlParams),l=s?`${t.url}?${s}`:t.url,o=await fetch(l,r),c=o.headers.get("content-type")||"";let{responseType:f="text"}=o.ok?t:{};c.includes("application/json")&&(f="json");let d,m;switch(f){case"arraybuffer":case"blob":m=await o.blob(),d=await cE(m);break;case"json":d=await o.json();break;case"document":case"text":default:d=await o.text()}const y={};return o.headers.forEach((g,x)=>{y[x]=g}),{data:d,headers:y,status:o.status,url:o.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"}))}}ws("CapacitorHttp",{web:()=>new mE});var F0;(function(e){e.Dark="DARK",e.Light="LIGHT",e.Default="DEFAULT"})(F0||(F0={}));var $0;(function(e){e.StatusBar="StatusBar",e.NavigationBar="NavigationBar"})($0||($0={}));class pE extends $d{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")}}ws("SystemBars",{web:()=>new pE});const gE="modulepreload",yE=function(e){return"/"+e},V0={},Vd=function(t,r,s){let l=Promise.resolve();if(r&&r.length>0){let c=function(m){return Promise.all(m.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]"),d=(f==null?void 0:f.nonce)||(f==null?void 0:f.getAttribute("nonce"));l=c(r.map(m=>{if(m=yE(m),m in V0)return;V0[m]=!0;const y=m.endsWith(".css"),g=y?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${m}"]${g}`))return;const x=document.createElement("link");if(x.rel=y?"stylesheet":gE,y||(x.as="script"),x.crossOrigin="",x.href=m,d&&x.setAttribute("nonce",d),document.head.appendChild(x),y)return new Promise((v,S)=>{x.addEventListener("load",v),x.addEventListener("error",()=>S(new Error(`Unable to preload CSS for ${m}`)))})}))}function o(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"&&o(f.reason);return t().catch(o)})},pd=ws("App",{web:()=>Vd(()=>import("./web-zYbQ8b4R.js"),[]).then(e=>new e.AppWeb)}),bE=ws("Network",{web:()=>Vd(()=>import("./web-DRfjN6eG.js"),[]).then(e=>new e.NetworkWeb)}),Bu=Gn.isNativePlatform()?"https://app.palmier.me":"";async function Lx(e,t,r,s){const l=`${Bu}${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 d;try{const m=JSON.parse(f);d=m.error??m.message??f}catch{d=f}throw console.error(`[API] ${e} ${t} failed:`,c.status,d),new Error(d||`Request failed with status ${c.status}`)}return console.log(`[API] ${e} ${t} ->`,c.status),c.json()}function xE(e,t,r){return Lx("POST",e,t)}function vE(e,t){return Lx("GET",e,void 0)}const Y0=Gn.isNativePlatform(),zx=E.createContext(null),wE=2e3,Th=6e3,SE=1500,_E=6e4;function kE({children:e,activeHost:t}){const[r,s]=E.useState(null),[l,o]=E.useState(!1),c=E.useRef(null),[f,d]=E.useState(!1),[m,y]=E.useState(!1),[g,x]=E.useState(!1),[v,S]=E.useState(!1),A=E.useRef(Ru()),M=E.useRef(new Set),T=E.useRef(0),P=!!t.directUrl,I=Y0&&!P&&!!t.lanUrl&&v,W=m||g?"disconnected":P?f?"direct":"connecting":l?I?"lan":"nats":"connecting",B=W!=="connecting"&&W!=="disconnected";E.useEffect(()=>{if(!Y0||P||!t.lanUrl){S(!1);return}let $=!1;const V=t.lanUrl,L=t.hostId;async function X(){console.log("[HOST/LAN] probing",V);try{const re=await fetch(`${V}/health`,{signal:AbortSignal.timeout(SE)});if($)return;if(!re.ok){console.log("[HOST/LAN] probe got non-ok:",re.status),S(!1);return}const F=await re.json(),q=F.hostId===L;q?console.log("[HOST/LAN] reachable"):console.log("[HOST/LAN] hostId mismatch — got:",F.hostId,"expected:",L),S(q)}catch(re){$||(console.log("[HOST/LAN] probe failed:",re instanceof Error?re.message:re),S(!1))}}X();const G=window.setInterval(X,_E),ce=pd.addListener("appStateChange",re=>{re.isActive&&X()}),oe=bE.addListener("networkStatusChange",()=>X());return()=>{$=!0,clearInterval(G),ce.then(re=>re.remove()),oe.then(re=>re.remove())}},[t.hostId,t.lanUrl,P]),E.useEffect(()=>{if(P){c.current&&(c.current.close().catch(()=>{}),c.current=null,s(null),o(!1));return}let $=!1,V=1e3;const L=3e4;async function X(){for(;!$;)try{const G=await fetch(`${Bu}/api/nats-credentials/${t.hostId}`);if($)return;if(G.status===401||G.status===403||G.status===404){console.error("[NATS] Host not found or rejected by relay:",G.status),x(!0);return}if(!G.ok)throw new Error(`credentials fetch ${G.status}`);const ce=await G.json();if(!ce.natsWsUrl){console.error("[NATS] Relay returned empty natsWsUrl — treating as terminal"),x(!0);return}if($)return;console.log("[NATS] Connecting to",ce.natsWsUrl);const oe=await Dx({servers:ce.natsWsUrl,authenticator:Ex(ce.natsJwt,new TextEncoder().encode(ce.natsNkeySeed)),pingInterval:3e4,maxPingOut:2});if($){oe.close().catch(()=>{});return}if(console.log("[NATS] Connected"),c.current=oe,s(oe),o(!0),V=1e3,await oe.closed(),$)return;console.log("[NATS] Connection closed, will reconnect"),c.current=null,s(null),o(!1)}catch(G){if($)return;console.warn(`[NATS] Connect failed, retrying in ${V}ms:`,G),o(!1),await new Promise(ce=>setTimeout(ce,V)),V=Math.min(V*2,L)}}return X(),()=>{$=!0,c.current&&(c.current.close().catch(()=>{}),c.current=null,s(null),o(!1))}},[P,t]),E.useEffect(()=>{if(P)return;const $=pd.addListener("appStateChange",V=>{if(!V.isActive||!c.current)return;const L=c.current;Promise.race([L.flush(),new Promise((X,G)=>setTimeout(()=>G(new Error("ping timeout")),2e3))]).catch(()=>{console.log("[NATS] Resume probe failed — cycling conn"),L.close().catch(()=>{})})});return()=>{$.then(V=>V.remove())}},[P]),E.useEffect(()=>{if(!P){d(!1);return}const $=new AbortController;async function V(){var ce;const X=new AbortController,G=setTimeout(()=>X.abort(),wE);$.signal.addEventListener("abort",()=>X.abort());try{const oe=await fetch(`${t.directUrl}/events`,{headers:{Authorization:`Bearer ${t.clientToken}`},signal:X.signal});return clearTimeout(G),oe.ok?((ce=oe.body)==null?void 0:ce.getReader())??null:null}catch{return clearTimeout(G),null}}async function L(X){d(!0),console.log("[HOST] SSE connected to",t.directUrl),T.current=Date.now();function G(){setTimeout(()=>{$.signal.aborted||Date.now()-T.current<Th||(console.log("[HOST] Heartbeat timeout — no data for",Th/1e3,"s"),$.abort(),d(!1),console.log("[HOST] Direct host unreachable"))},Th)}G();const ce=new TextDecoder;let oe="";try{for(;;){const{done:re,value:F}=await X.read();if(re)break;oe+=ce.decode(F,{stream:!0}),T.current=Date.now(),G();const q=oe.split(`
88
+ `);oe=q.pop()??"";for(const le of q)if(le.startsWith("data: ")){const be=le.slice(6);try{const O=JSON.parse(be);if(O.task_id&&O.event_type){const U=`host-event.${t.hostId}.${O.task_id}`;for(const ee of M.current)ee({subject:U,data:A.current.encode(be)})}}catch{}}}}catch{}}return(async()=>{const X=await V();X&&await L(X)})(),()=>{$.abort(),d(!1)}},[t,P]);const D=E.useCallback(async($,V,L)=>{function X(oe){oe&&typeof oe=="object"&&oe.error==="Unauthorized"&&y(!0)}async function G(oe,re){console.log(`[HOST/${re}] → ${$}`,V??"");const F=await fetch(`${oe}/rpc/${$}`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t.clientToken}`},body:V!=null?JSON.stringify(V):void 0,signal:L!=null&&L.timeout?AbortSignal.timeout(L.timeout):void 0});if(F.status===401)throw y(!0),new Error("Unauthorized");const q=await F.json();return X(q),console.log(`[HOST/${re}] ← ${$}`,q),q}async function ce(){if(!c.current)throw new Error("Not connected");const oe=`host.${t.hostId}.rpc.${$}`,re={...V??{},clientToken:t.clientToken},F=A.current.encode(JSON.stringify(re));console.log(`[HOST/NATS] → ${$}`,V??"");const q=await c.current.request(oe,F,{timeout:(L==null?void 0:L.timeout)??1e4}),le=JSON.parse(A.current.decode(q.data));return X(le),console.log(`[HOST/NATS] ← ${$}`,le),le}if(P)return G(t.directUrl,"HTTP");if(I&&t.lanUrl)try{return await G(t.lanUrl,"LAN")}catch(oe){if(oe instanceof Error&&oe.message==="Unauthorized")throw oe;console.log("[HOST/LAN] failed, falling back to NATS:",oe),S(!1)}return ce()},[t,P,I]),Z=E.useCallback(($,V)=>{if(P)return M.current.add(V),()=>{M.current.delete(V)};if(c.current){const L=c.current.subscribe(`host-event.${$}.>`);let X=!1;return(async()=>{try{for await(const G of L){if(X)break;V({subject:G.subject,data:G.data})}}catch{}})(),()=>{X=!0,L.unsubscribe()}}return()=>{}},[t,P]);return b.jsx(zx.Provider,{value:{connected:B,mode:W,nc:r,request:D,subscribeEvents:Z,activeHost:t,unauthorized:m},children:e})}function yi(){const e=E.useContext(zx);if(!e)throw new Error("useHostConnection must be used within HostConnectionProvider");return e}const An=Gn.isNativePlatform()?ws("Device"):null;function EE(e,t){const r=new Date(e),s=new Date,l={year:"numeric",month:"2-digit",day:"2-digit",timeZone:t};return r.toLocaleDateString(void 0,l)===s.toLocaleDateString(void 0,l)?new Intl.DateTimeFormat(void 0,{timeStyle:"short",timeZone:t}).format(r):new Intl.DateTimeFormat(void 0,{dateStyle:"medium",timeStyle:"short",timeZone:t}).format(r)}function Yd(){const{activeHost:e}=yi(),t=e.timezone;return E.useCallback(r=>EE(r,t),[t])}function CE(e){const t=new Intl.DateTimeFormat("en-CA",{timeZone:e,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",hour12:!1}).formatToParts(new Date),r=s=>{var l;return((l=t.find(o=>o.type===s))==null?void 0:l.value)??""};return{date:`${r("year")}-${r("month")}-${r("day")}`,time:`${r("hour")}:${r("minute")}`}}function AE(e){const t=new Intl.DateTimeFormat("en-CA",{timeZone:e,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",hour12:!1}).formatToParts(new Date),r=s=>{var l;return Number(((l=t.find(o=>o.type===s))==null?void 0:l.value)??"0")};return{year:r("year"),month:r("month"),day:r("day"),hour:r("hour")%24,minute:r("minute")}}function jE(e,t,r){return new Date(Date.UTC(e,t-1,r)).getUTCDay()}function NE(e,t){return new Date(Date.UTC(e,t,0)).getUTCDate()}function G0(e,t){const r=new Date(Date.UTC(e.year,e.month-1,e.day));return r.setUTCDate(r.getUTCDate()+t),{year:r.getUTCFullYear(),month:r.getUTCMonth()+1,day:r.getUTCDate(),hour:e.hour,minute:e.minute}}function Rl(e,t){return e.year!==t.year?e.year-t.year:e.month!==t.month?e.month-t.month:e.day!==t.day?e.day-t.day:e.hour!==t.hour?e.hour-t.hour:e.minute-t.minute}function TE(e,t){const r=Date.UTC(e.year,e.month-1,e.day,e.hour,e.minute);if(!t)return r;const s=new Intl.DateTimeFormat("en-CA",{timeZone:t,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}).formatToParts(new Date(r)),l=c=>{var f;return Number(((f=s.find(d=>d.type===c))==null?void 0:f.value)??"0")},o=Date.UTC(l("year"),l("month")-1,l("day"),l("hour")%24,l("minute"),l("second"));return r-(o-r)}function OE(e,t){const r=e.split(" ");if(r.length!==5)return null;const[s,l,o,,c]=r;if(l==="*"){const y=Number(s);if(Number.isNaN(y))return null;if(y>t.minute)return{...t,minute:y};const g=new Date(Date.UTC(t.year,t.month-1,t.day,t.hour+1,y));return{year:g.getUTCFullYear(),month:g.getUTCMonth()+1,day:g.getUTCDate(),hour:g.getUTCHours(),minute:g.getUTCMinutes()}}const f=Number(s),d=Number(l);if(Number.isNaN(f)||Number.isNaN(d))return null;if(c!=="*"){const y=Number(c);if(Number.isNaN(y))return null;for(let g=0;g<8;g++){const x=G0({...t,hour:d,minute:f},g);if(jE(x.year,x.month,x.day)===y&&Rl(x,t)>0)return x}return null}if(o!=="*"){const y=Number(o);if(Number.isNaN(y))return null;let g=t.year,x=t.month;for(let v=0;v<24;v++){if(y<=NE(g,x)){const S={year:g,month:x,day:y,hour:d,minute:f};if(Rl(S,t)>0)return S}x++,x>12&&(x=1,g++)}return null}const m={...t,hour:d,minute:f};return Rl(m,t)>0?m:G0(m,1)}function RE(e){const t=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})/.exec(e);return t?{year:Number(t[1]),month:Number(t[2]),day:Number(t[3]),hour:Number(t[4]),minute:Number(t[5])}:null}function ME(e,t,r){if(!e||!t||t.length===0||e==="on_new_notification"||e==="on_new_sms")return null;const s=AE(r),l=[];for(const o of t)if(e==="specific_times"){const c=RE(o);c&&Rl(c,s)>0&&l.push(c)}else{const c=OE(o,s);c&&l.push(c)}return l.length===0?null:(l.sort(Rl),TE(l[0],r))}const Ux={};function DE(e){for(const t of e)Ux[t.key]=t.label}function gd(e){return Ux[e]??e}const LE=()=>window.matchMedia("(max-width: 600px)").matches;function zE({task:e,lastEvent:t,onEdit:r,onDelete:s,onViewRun:l}){var F;const{request:o,activeHost:c}=yi(),f=Yd(),d=c.timezone,[m,y]=E.useState(!1),[g,x]=E.useState(!1),[v,S]=E.useState(!1),A=E.useRef(null),M=(t==null?void 0:t.running_state)==="started",T=(((F=e.schedule_values)==null?void 0:F.length)??0)>0,P=e.schedule_type==="on_new_notification"||e.schedule_type==="on_new_sms",I=!!e.command,W=!!e.schedule_type&&(T||P)||I,D=!!e.schedule_enabled&&W?M?"var(--color-success)":(t==null?void 0:t.running_state)==="failed"?"var(--color-error)":"var(--color-success)":"var(--color-text-secondary)";E.useEffect(()=>{if(!g)return;function q(le){A.current&&!A.current.contains(le.target)&&x(!1)}return document.addEventListener("mousedown",q),()=>document.removeEventListener("mousedown",q)},[g]);function Z(){LE()?S(!0):x(q=>!q)}function $(){x(!1),S(!1)}async function V(){if($(),!!confirm("Abort this task?")){y(!0);try{await o("task.abort",{id:e.id})}catch(q){console.error("Abort failed:",q)}finally{y(!1)}}}async function L(){$();try{const q=await o("task.run",{id:e.id});l(e.id,q.run_id)}catch(q){console.error("Run failed:",q)}}async function X(){if($(),!!confirm("Delete this task? Results and reports will be kept."))try{await o("task.delete",{id:e.id}),s(e.id)}catch(q){console.error("Delete failed:",q)}}const G={started:"Started",finished:"Finished",aborted:"Aborted",failed:"Failed"};function ce(){if(I)return"On Command Output";if(e.schedule_type==="on_new_notification")return"On new notification";if(e.schedule_type==="on_new_sms")return"On new SMS";const q=ME(e.schedule_type,e.schedule_values,d);return q===null?"No upcoming runs":`Next: ${f(q)}`}const oe=ce(),re=b.jsxs(b.Fragment,{children:[b.jsxs("button",{onClick:()=>{$(),r(e)},children:[b.jsx("span",{className:"menu-icon",children:"✎"}),"Edit"]}),b.jsxs("button",{onClick:()=>{$(),l(e.id)},children:[b.jsx("span",{className:"menu-icon",children:"📄"}),"View All Runs"]}),M?b.jsxs("button",{className:"menu-item-danger",onClick:V,disabled:m,children:[b.jsx("span",{className:"menu-icon",children:"◼"}),"Abort"]}):b.jsxs(b.Fragment,{children:[b.jsxs("button",{onClick:L,children:[b.jsx("span",{className:"menu-icon",children:"▶"}),"Run Now"]}),b.jsxs("button",{className:"menu-item-danger",onClick:X,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,M?"latest":void 0),children:[b.jsxs("div",{className:"task-card-header",children:[b.jsxs("div",{className:"task-card-title-row",children:[M?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:q=>q.stopPropagation(),children:b.jsxs("div",{className:"task-card-menu",ref:A,children:[b.jsx("button",{className:"task-card-menu-btn",onClick:Z,"aria-label":"Task actions",children:"⋮"}),g&&b.jsx("div",{className:"task-card-menu-dropdown",children:re})]})})]}),b.jsxs("div",{className:"task-card-meta",children:[e.agent&&b.jsx("span",{className:"task-card-agent",children:gd(e.agent)}),t&&G[t.running_state]&&b.jsxs("span",{className:"task-card-last-event",children:[G[t.running_state]," ",f(t.time_stamp)]}),W&&b.jsx("span",{className:"task-card-triggers",children:e.schedule_enabled?oe:"Schedule disabled"})]})]}),v&&di.createPortal(b.jsx("div",{className:"bottom-sheet-overlay",onClick:()=>S(!1),children:b.jsxs("div",{className:"bottom-sheet",onClick:q=>q.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:re})]})}),document.body)]})}function UE({permissions:e}){return b.jsxs("div",{className:"permissions-dialog",children:[b.jsx("h2",{children:"Granted Permissions"}),b.jsx("div",{className:"permissions-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:"permissions-empty",children:"No permissions have been granted for this task."})}),b.jsx("div",{className:"permissions-dialog-actions",children:b.jsx("button",{className:"btn btn-secondary",onClick:()=>history.back(),children:"Back"})})]})}const aa=[];function PE(){const e=aa.pop();e&&(e.pushed.current=!1,e.close())}let J0=!1;function BE(){J0||(J0=!0,window.addEventListener("popstate",PE))}function yd(e,t){const r=E.useRef(!1),s=E.useRef(t);s.current=t;const l=E.useCallback(()=>s.current(),[]),o=E.useRef({close:l,pushed:r});o.current.close=l,E.useEffect(()=>{if(e&&!r.current)BE(),history.pushState({modal:!0},""),aa.push(o.current),r.current=!0;else if(!e&&r.current){r.current=!1;const c=aa.indexOf(o.current);c!==-1&&aa.splice(c,1),history.back()}},[e,l]),E.useEffect(()=>{const c=o.current;return()=>{if(r.current){r.current=!1;const f=aa.indexOf(c);f!==-1&&aa.splice(f,1),history.back()}}},[])}const HE=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],qE=["specific_times","hourly","daily","weekly","monthly"];function pu(e){return qE.includes(e)}function IE(e){return e==="on_new_notification"||e==="on_new_sms"}function hi(e="daily"){return{schedule:e,time:"00:00",dayOfWeek:"1",dayOfMonth:"1",onceDate:"",onceTime:"00:00"}}function FE(e){const t=e.split(" ");if(t.length!==5)return hi();const[r,s,l,,o]=t;if(s==="*")return hi("hourly");const c=`${s.padStart(2,"0")}:${r.padStart(2,"0")}`;return o!=="*"?{...hi("weekly"),time:c,dayOfWeek:o}:l!=="*"?{...hi("monthly"),time:c,dayOfMonth:l}:{...hi("daily"),time:c}}function Px(e,t){if(e==="specific_times"){const[r,s]=t.split("T");return{...hi("specific_times"),onceDate:r??"",onceTime:(s??"09:00").slice(0,5)}}return FE(t)}function $E(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 VE(e){return e.schedule==="specific_times"?e.onceDate?`${e.onceDate}T${e.onceTime}`:null:$E(e)}function Oh(e){return e==="specific_times"?"specific_times":e==="on_new_notification"?"on_new_notification":e==="on_new_sms"?"on_new_sms":"crons"}function Rh(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?Px(t,r).schedule:"ondemand"}function YE({initial:e,agents:t,hostPlatform:r,isNotificationListener:s,onSaved:l,onCancel:o}){var nt;const{request:c,activeHost:f}=yi(),{setHostLastAgent:d}=Xi(),m=()=>{var Oe;const ve=f.lastAgent,Be=t.map(_t=>_t.key);return ve&&Be.includes(ve)?ve:((Oe=t[0])==null?void 0:Oe.key)??""},[y,g]=E.useState((e==null?void 0:e.user_prompt)??""),[x,v]=E.useState((e==null?void 0:e.agent)??m()),S=!!((nt=e==null?void 0:e.permissions)!=null&&nt.length)&&x===(e==null?void 0:e.agent),[A,M]=E.useState(!1),T=E.useCallback(()=>M(!1),[]);yd(A,T);const[P,I]=E.useState(null),[W,B]=E.useState(()=>Rh(e)),[D,Z]=E.useState(()=>{const ve=e==null?void 0:e.schedule_type,Be=e==null?void 0:e.schedule_values;if(Be&&(ve==="crons"||ve==="specific_times"))return Be.map(_t=>Px(ve,_t));const Oe=Rh(e);return pu(Oe)?[hi(Oe)]:[]}),[$,V]=E.useState((e==null?void 0:e.requires_confirmation)??!1),[L,X]=E.useState(e!=null&&e.schedule_type||e!=null&&e.command?e.schedule_enabled??!0:!0),[G,ce]=E.useState((e==null?void 0:e.yolo_mode)??!1),[oe,re]=E.useState((e==null?void 0:e.foreground_mode)??!1),[F,q]=E.useState((e==null?void 0:e.command)??""),[le,be]=E.useState(!1),O=(e==null?void 0:e.schedule_type)==="on_new_notification"&&e.schedule_values&&e.schedule_values.length>0?e.schedule_values[0]:"",[U,ee]=E.useState(O),[j,ie]=E.useState([]),[Ce,_e]=E.useState(!1),[Ee,Ve]=E.useState(!1),[je,dt]=E.useState(""),qt=E.useCallback(()=>Ve(!1),[]);yd(Ee,qt),E.useEffect(()=>{if(W!=="on_new_notification"||!s||!Gn.isNativePlatform()||!An)return;let ve=!1;return _e(!0),An.getInstalledApps().then(({apps:Be})=>{if(ve)return;const Oe="com.palmier.app",_t=Be.filter(Qt=>Qt.packageName!==Oe).sort((Qt,On)=>(Qt.appName||Qt.packageName).localeCompare(On.appName||On.packageName));ie(_t)}).catch(()=>{}).finally(()=>{ve||_e(!1)}),()=>{ve=!0}},[W,s]);const ln=(e==null?void 0:e.schedule_type)==="on_new_sms"&&e.schedule_values&&e.schedule_values.length>0?e.schedule_values[0]:"",[tn,Gt]=E.useState(ln),on=E.useRef(null),Rt=pu(W),Kt=W==="command",Pe=IE(W),ct=W==="specific_times"||W==="daily"||W==="weekly"||W==="monthly",Ke=t.find(ve=>ve.key===x),bt=!!(Ke!=null&&Ke.supportsYolo);E.useEffect(()=>{!bt&&G&&ce(!1)},[bt,G]);const zt=!!e,Pn=Rh(e),$e=!zt||y!==((e==null?void 0:e.user_prompt)??"")||x!==((e==null?void 0:e.agent)??"")||W!==Pn||$!==((e==null?void 0:e.requires_confirmation)??!1)||L!==(e!=null&&e.schedule_type||e!=null&&e.command?e.schedule_enabled??!0:!0)||G!==((e==null?void 0:e.yolo_mode)??!1)||oe!==((e==null?void 0:e.foreground_mode)??!1)||Kt&&F!==((e==null?void 0:e.command)??"")||Rt&&(JSON.stringify(vn())!==JSON.stringify((e==null?void 0:e.schedule_values)??[])||Oh(W)!==((e==null?void 0:e.schedule_type)??void 0))||Pe&&W!==(e==null?void 0:e.schedule_type)||W==="on_new_notification"&&U.trim()!==O.trim()||W==="on_new_sms"&&tn.trim()!==ln.trim(),Tn=CE(f.timezone),fe=Rt&&D.some(ve=>ve.schedule==="specific_times"&&(!ve.onceDate||ve.onceDate<Tn.date||ve.onceDate===Tn.date&&(ve.onceTime??"")<=Tn.time)),Se=$e&&!!y.trim()&&!fe&&(!Kt||!!F.trim())&&(!Rt||D.length>0);function Le(ve,Be){Z(Oe=>Oe.map((_t,Qt)=>Qt===ve?{..._t,...Be}:_t))}function Ge(ve){Z(Be=>Be.filter((Oe,_t)=>_t!==ve))}function et(){pu(W)&&Z(ve=>[...ve,ve.length>0?{...ve[ve.length-1]}:hi(W)])}function un(ve){B(ve),pu(ve)?Z([hi(ve)]):(Z([]),V(!1)),ve==="command"?setTimeout(()=>{var Be;return(Be=on.current)==null?void 0:Be.focus()},0):q(""),ve!=="on_new_notification"&&ee(O),ve!=="on_new_sms"&&Gt(ln)}function vn(){return D.flatMap(ve=>{const Be=VE(ve);return Be?[Be]:[]})}function Ct(){return G?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
89
 
90
- Are you sure you want to continue?`):!0}async function xt(){be(!0),I(null);try{const ve=Rt?vn():W==="on_new_notification"&&U.trim()?[U.trim()]:W==="on_new_sms"&&tn.trim()?[tn.trim()]:[],Be=Rt||Pe?Oh(W):null,Oe={user_prompt:y,agent:x,schedule_type:Be,schedule_values:ve.length>0?ve:null,schedule_enabled:W==="ondemand"?!0:L,requires_confirmation:Rt?F:!1,yolo_mode:G,foreground_mode:le,command:Kt?$:""};zt&&(Oe.id=e.id);const Qt=await c(zt?"task.update":"task.create",Oe,{timeout:45e3});if(Qt.error){I(Qt.error);return}zt||d(f.hostId,x),l(Qt)}catch(ve){I(ve instanceof Error?ve.message:String(ve))}finally{be(!1)}}const Jt=zt?"Save":(Rt||Pe||Kt)&&L?"Schedule":"Save";return b.jsxs("div",{className:"task-form-overlay",children:[b.jsx("div",{className:"task-form",children:j?b.jsx(LE,{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"})}),P&&b.jsx("div",{className:"form-error",children:P}),b.jsx("textarea",{autoFocus:!e,className:"form-textarea",value:y,onChange:ve=>g(ve.target.value),placeholder:Kt?"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:ae}),b.jsxs("div",{className:"plan-actions",children:[t.length>0&&b.jsx("div",{className:"agent-picker-section-inline",children:t.length>1?b.jsx("select",{className:"form-select form-select-sm",value:x,onChange:ve=>v(ve.target.value),disabled:ae,children:t.map(ve=>b.jsx("option",{value:ve.key,children:ve.label},ve.key))}):b.jsx("span",{className:"agent-picker-single",children:(Ke==null?void 0:Ke.label)??t[0].label})}),bt&&b.jsxs("label",{className:"yolo-inline",style:{marginLeft:"auto"},children:[b.jsx("input",{type:"checkbox",checked:G,onChange:ve=>ue(ve.target.checked),disabled:ae}),"Yolo"]}),bt&&G&&b.jsx("p",{className:"yolo-warning",children:"The agent will auto-approve all tool calls without asking for permission."}),S&&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.jsxs("h3",{className:"schedule-section-title",children:["Schedule ",ct&&b.jsx("span",{className:"schedule-section-hint",children:"based on host time"})]}),b.jsxs("select",{className:"form-select",value:W,onChange:ve=>un(ve.target.value),disabled:ae,children:[b.jsx("option",{value:"ondemand",children:"On User 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:"On Command Output"})]}),Pe&&b.jsxs("div",{className:"schedule-reactive",children:[b.jsxs("p",{className:"command-help-text",children:[W==="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 ",W==="on_new_notification"?"notification":"SMS","”."]}),W==="on_new_notification"&&(()=>{const ve=_.find(Oe=>Oe.packageName===U),Be=(ve==null?void 0:ve.appName)||U;return b.jsxs(b.Fragment,{children:[s?U.trim()?b.jsxs("div",{className:"app-filter-selected",children:[b.jsx("span",{className:"app-filter-selected-name",children:Be}),(ve==null?void 0:ve.appName)&&b.jsx("span",{className:"app-filter-selected-pkg",children:ve.packageName}),b.jsx("button",{type:"button",className:"app-filter-selected-clear",onClick:()=>ee(""),"aria-label":"Clear app filter",disabled:ae,children:"✕"})]}):b.jsx("button",{type:"button",className:"btn btn-link app-filter-trigger",onClick:()=>{dt(""),Ve(!0)},disabled:ae,children:"Select app"}):b.jsx("input",{className:"form-input",type:"text",value:U,onChange:Oe=>ee(Oe.target.value),placeholder:"App (optional), e.g. com.google.android.gm",disabled:ae}),b.jsx("p",{className:"command-help-text app-filter-help",children:U.trim()?`Only notifications from ${Be} will trigger this task.`:"Every notification from your device triggers this task."})]})})(),W==="on_new_sms"&&b.jsxs(b.Fragment,{children:[b.jsx("input",{className:"form-input",type:"text",value:tn,onChange:ve=>Gt(ve.target.value),placeholder:"From (optional), e.g. +1 555-1234)",disabled:ae}),b.jsx("p",{className:"command-help-text app-filter-help",children:tn.trim()?`Only SMS from ${tn.trim()} will trigger this task. Formatting (spaces, dashes, parens) is ignored.`:"Every SMS that arrives on your device triggers this task."})]})]}),Kt&&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:on,className:"form-input form-input-mono",type:"text",value:$,onChange:ve=>q(ve.target.value),placeholder:"gws gmail +watch --project my-project",disabled:ae})]}),Rt&&W!=="hourly"&&b.jsxs(b.Fragment,{children:[R.map((ve,Be)=>b.jsxs("div",{className:"trigger-row-card",children:[b.jsxs("div",{className:"trigger-row-content",children:[W==="daily"&&b.jsx("input",{className:"form-input",type:"time",value:ve.time,onChange:Oe=>Le(Be,{time:Oe.target.value})}),W==="weekly"&&b.jsxs("div",{className:"trigger-row-top",children:[b.jsx("select",{className:"form-select",value:ve.dayOfWeek,onChange:Oe=>Le(Be,{dayOfWeek:Oe.target.value}),children:PE.map((Oe,_t)=>b.jsx("option",{value:String(_t),children:Oe},_t))}),b.jsx("input",{className:"form-input",type:"time",value:ve.time,onChange:Oe=>Le(Be,{time:Oe.target.value})})]}),W==="monthly"&&b.jsxs("div",{className:"trigger-row-top",children:[b.jsx("select",{className:"form-select",value:ve.dayOfMonth,onChange:Oe=>Le(Be,{dayOfMonth:Oe.target.value}),children:Array.from({length:28},(Oe,_t)=>_t+1).map(Oe=>b.jsxs("option",{value:String(Oe),children:["Day ",Oe]},Oe))}),b.jsx("input",{className:"form-input",type:"time",value:ve.time,onChange:Oe=>Le(Be,{time:Oe.target.value})})]}),W==="specific_times"&&b.jsxs("div",{className:"trigger-row-top",children:[b.jsx("input",{className:"form-input",type:"date",value:ve.onceDate,min:Tn.date,onChange:Oe=>Le(Be,{onceDate:Oe.target.value})}),b.jsx("input",{className:"form-input",type:"time",value:ve.onceTime,min:ve.onceDate===Tn.date?Tn.time:void 0,onChange:Oe=>Le(Be,{onceTime:Oe.target.value})})]})]}),R.length>1&&b.jsx("button",{className:"trigger-remove-btn",onClick:()=>Ge(Be),title:"Remove trigger",children:"×"})]},Be)),b.jsx("button",{className:"trigger-add-btn",onClick:et,children:"+ Add"})]}),r==="win32"&&b.jsxs("label",{className:"toggle-label",children:[b.jsx("input",{type:"checkbox",checked:le,onChange:ve=>re(ve.target.checked),disabled:ae}),"Run in the foreground (host must login to Windows)"]}),Rt&&b.jsxs("label",{className:"toggle-label",children:[b.jsx("input",{type:"checkbox",checked:F,onChange:ve=>V(ve.target.checked),disabled:ae}),"Confirm before each run"]}),W!=="ondemand"&&b.jsxs("label",{className:"toggle-label",children:[b.jsx("input",{type:"checkbox",checked:L,onChange:ve=>X(ve.target.checked),disabled:ae}),"Enabled"]})]})}),!G&&Ke&&!Ke.supportsPermissions&&b.jsxs("div",{className:"form-warning",children:["Palmier does not support runtime permission granting for ",Ke.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:()=>Ct()&&xt(),disabled:!_e||ae,children:[ae&&b.jsx("span",{className:"btn-spinner"}),Jt]}),b.jsx("button",{className:"btn btn-secondary",onClick:()=>{$e&&y.trim()&&!confirm("You have unsaved changes. Discard?")||u()},style:{marginLeft:"auto"},children:"Cancel"})]})]})}),Te&&(()=>{const ve=Ae.trim().toLowerCase(),Be=ve?_.filter(Oe=>Oe.packageName.toLowerCase().includes(ve)||Oe.appName.toLowerCase().includes(ve)):_;return b.jsx("div",{className:"app-filter-overlay",onClick:qt,children:b.jsxs("div",{className:"app-filter-dialog",onClick:Oe=>Oe.stopPropagation(),children:[b.jsxs("div",{className:"app-filter-header",children:[b.jsx("h2",{children:"Select app"}),b.jsx("button",{className:"app-filter-close",onClick:qt,"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:Ae,onChange:Oe=>dt(Oe.target.value),onKeyDown:Oe=>{Oe.key==="Enter"&&Ae.trim()&&(ee(Ae.trim()),qt())},placeholder:"Search or type a package name",autoFocus:!0}),b.jsxs("ul",{className:"app-filter-list",children:[Ce&&_.length===0?Array.from({length:6}).map((Oe,_t)=>b.jsx("li",{className:"app-filter-row app-filter-skeleton",children:b.jsx("div",{className:"app-filter-skeleton-bar"})},`sk-${_t}`)):Be.length===0&&!Ae.trim()?b.jsx("li",{className:"app-filter-empty",children:"No apps"}):Be.map(Oe=>b.jsx("li",{className:"app-filter-row",onClick:()=>{ee(Oe.packageName),qt()},children:b.jsxs("div",{className:"app-filter-row-labels",children:[b.jsx("div",{className:"app-filter-row-name",children:Oe.appName||Oe.packageName}),Oe.appName&&b.jsx("div",{className:"app-filter-row-pkg",children:Oe.packageName})]})},Oe.packageName)),Ae.trim()&&b.jsx("li",{className:"app-filter-row",onClick:()=>{ee(Ae.trim()),qt()},children:b.jsx("div",{className:"app-filter-row-labels",children:b.jsx("div",{className:"app-filter-row-name",children:Ae.trim()})})})]})]})})})()]})}function qx({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 Ix({onRefresh:e,threshold:t=70,maxPull:r=110,enabled:s=!0}){const[l,u]=A.useState(0),[c,f]=A.useState(!1),d=A.useRef(null),m=A.useRef(!1),y=A.useRef(0),g=A.useRef(!1),x=A.useRef(e);return A.useEffect(()=>{x.current=e}),A.useEffect(()=>{if(!s)return;const v=D=>{if(g.current||window.scrollY>0){d.current=null;return}if(VE(D.target)){d.current=null;return}d.current=D.touches[0].clientY,m.current=!1,y.current=0},S=D=>{if(g.current||d.current==null)return;const T=D.touches[0].clientY-d.current;if(T<=0){m.current=!1,y.current=0,u(0);return}m.current=!0;const P=Math.min(r,T*.5);y.current=P,u(P),D.cancelable&&D.preventDefault()},j=()=>{if(!m.current){d.current=null,u(0);return}const D=y.current;d.current=null,m.current=!1,y.current=0,D>=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",v,{passive:!0}),window.addEventListener("touchmove",S,{passive:!1}),window.addEventListener("touchend",j,{passive:!0}),window.addEventListener("touchcancel",j,{passive:!0}),()=>{window.removeEventListener("touchstart",v),window.removeEventListener("touchmove",S),window.removeEventListener("touchend",j),window.removeEventListener("touchcancel",j)}},[s,t,r]),{pullDistance:l,refreshing:c,threshold:t}}function VE(e){let t=e;for(;t&&t!==document.body&&t!==document.documentElement;){const r=window.getComputedStyle(t).overflowY;if((r==="auto"||r==="scroll")&&t.scrollHeight>t.clientHeight)return!0;t=t.parentElement}return!1}function YE(e){return JSON.stringify([e.user_prompt,e.agent??null,e.schedule_type??null,e.schedule_values??null,e.schedule_enabled,e.requires_confirmation,e.yolo_mode??!1,e.foreground_mode??!1,e.command??"",e.permissions??null])}function GE({connected:e,hostId:t,request:r,subscribeEvents:s,agents:l,hostPlatform:u,isNotificationListener:c,onViewRun:f,hostInfoStatus:d}){const[m,y]=A.useState([]),[g,x]=A.useState(!1),[v,S]=A.useState(null),[j,D]=A.useState(new Map),[T,P]=A.useState(!1),[I,W]=A.useState(void 0),B=A.useCallback(()=>{P(!1),W(void 0)},[]),R=A.useCallback(async()=>{if(e){x(!0),S(null);try{const X=(await r("task.list")).tasks??[],G=new Map;for(const ue of X)ue.status&&G.set(ue.id,ue.status);D(G),y(X)}catch(L){const X=L instanceof Error?L.message:String(L);X==="Not connected"||X.includes("503")||X.toLowerCase().includes("no responders")?S(null):S(X),y([])}finally{x(!1)}}},[e,t,r]);A.useEffect(()=>{e?R():(y([]),x(!1))},[e,t,R]);const Z=Ix({onRefresh:R,enabled:e});A.useEffect(()=>!e||!t?void 0:s(t,async X=>{const G=X.subject.split(".");if(G.length<3)return;const ue=G.slice(2).join(".");let le={};try{le=JSON.parse(new TextDecoder().decode(X.data))}catch{return}const re=le.event_type;if(!(re!=="running-state"&&re!=="permission-resolved"))try{const $=await r("task.status",{id:ue},{timeout:5e3});if($.error)return;D(q=>{const ae=new Map(q);return ae.set(ue,$),ae})}catch{}}),[e,t,s,r]);function F(L){y(X=>{const G=X.findIndex(ue=>ue.id===L.id);if(G>=0){const ue=[...X];return ue[G]=L,ue}return[L,...X]}),P(!1),W(void 0)}function V(L){y(X=>X.filter(G=>G.id!==L)),D(X=>{const G=new Map(X);return G.delete(L),G})}return b.jsxs(b.Fragment,{children:[b.jsx(qx,{pullDistance:Z.pullDistance,refreshing:Z.refreshing,threshold:Z.threshold}),v&&b.jsxs("div",{className:"form-error",children:[v,v.toLowerCase().includes("failed to fetch")&&b.jsxs(b.Fragment,{children:[" ",b.jsx("a",{href:"#",onClick:L=>{L.preventDefault(),window.location.reload()},children:"Reload"})]})]}),g&&!m.length&&d==="ready"?b.jsx("div",{className:"task-list",children:[0,1,2].map(L=>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+L*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%"}})]})]},L))}):m.length===0?d==="loading"?b.jsx("div",{className:"empty-state",children:b.jsx("p",{className:"empty-state-text",children:"Connecting to host…"})}):d==="error"?b.jsxs("div",{className:"empty-state",children:[b.jsx("p",{className:"empty-state-text",children:"Couldn't reach host"}),b.jsxs("p",{className:"empty-state-hint",children:["The host didn't respond. Try running ",b.jsx("code",{children:"palmier restart"})," on the host machine to restart the daemon."]})]}):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(L=>b.jsx(DE,{task:L,lastEvent:j.get(L.id),onEdit:X=>{W(X),P(!0),r("task.get",{id:X.id}).then(G=>{G.error||W(G)}).catch(()=>{})},onDelete:V,onViewRun:f},L.id))}),b.jsx("button",{className:"fab",onClick:()=>{W(void 0),P(!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"})]})}),T&&b.jsx($E,{initial:I,agents:l,hostPlatform:u,isNotificationListener:c,onSaved:F,onCancel:B},I?YE(I):"new")]})}let pa=null;function J0(e){pa&&(e.preventDefault(),e.returnValue="")}function Mh(e){const t=!!pa;pa=e;const r=!!pa;r&&!t?window.addEventListener("beforeunload",J0):!r&&t&&window.removeEventListener("beforeunload",J0)}function xs(){return pa?window.confirm(pa):!0}function JE(){const e=Vr(),t=Er(),{hostId:r}=Yu(),s=t.pathname.endsWith("/tasks"),l=!s;function u(c){xs()&&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 Fx(e){const[t,r]=A.useState(()=>window.matchMedia(e).matches);return A.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 Cu=cr.isNativePlatform(),XE=["Device","Data","Messaging"],KE=[{capability:"sms-read",label:"Read SMS",group:"Messaging"},{capability:"sms-send",label:"Send SMS",group:"Messaging"},{capability:"send-email",label:"Prompt Email to Send",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 QE(){if(!Cu||!An)return new Set;try{const{capabilities:e}=await An.getCapabilityStatus();return new Set(e.filter(t=>t.enabled).map(t=>t.name))}catch{return new Set}}function $x({onChange:e,confirmDisable:t=!1}){const[r,s]=A.useState(new Map),[l,u]=A.useState(null),[c,f]=A.useState(null),d=A.useCallback(async()=>{if(!(!Cu||!An))try{const{capabilities:S}=await An.getCapabilityStatus(),j=new Map;for(const D of S)j.set(D.name,D);s(j),e==null||e(new Set(S.filter(D=>D.enabled).map(D=>D.name)))}catch(S){console.error("Failed to read capability status:",S)}},[e]);A.useEffect(()=>{d()},[d]),A.useEffect(()=>{if(!Cu)return;const S=pd.addListener("resume",d);return()=>{S.then(j=>j.remove())}},[d]);async function m(S,j){if(An){u(S.capability);try{const D=await An.setCapabilityEnabled({capability:S.capability,enabled:j});!D.enabled&&D.reason==="no-email-client"&&alert("No email app is installed on this device. Install one (e.g. Gmail) before enabling Send Email."),await d()}catch(D){console.error(`Failed to toggle ${S.capability}:`,D)}finally{u(null)}}}function y(S){const j=r.get(S.capability);if(j){if(j.enabled&&t){f(S);return}m(S,!j.enabled)}}function g(){const S=c;S&&(f(null),m(S,!1))}if(!Cu)return null;const x=XE.map(S=>({group:S,items:KE.filter(j=>{const D=r.get(j.capability);return j.group===S&&(D==null?void 0:D.supported)})})).filter(S=>S.items.length>0);if(x.length===0)return b.jsx("div",{className:"capability-toggles-loading",children:b.jsx("span",{className:"spinner"})});const v=c&&di.createPortal(b.jsx("div",{className:"confirm-modal-overlay",onClick:()=>f(null),children:b.jsxs("div",{className:"confirm-modal",onClick:S=>S.stopPropagation(),children:[b.jsxs("h2",{className:"confirm-modal-title",children:["Disable ",c.label,"?"]}),b.jsxs("p",{className:"confirm-modal-message",children:["All hosts linked to this device will no longer be able to use ",c.label,"."]}),b.jsxs("div",{className:"confirm-modal-actions",children:[b.jsx("button",{className:"btn btn-secondary",onClick:()=>f(null),children:"Cancel"}),b.jsx("button",{className:"btn btn-danger",onClick:g,children:"Disable"})]})]})}),document.body);return b.jsxs(b.Fragment,{children:[x.map(({group:S,items:j},D)=>b.jsx("div",{className:D>0?"drawer-toggle-group drawer-toggle-group-divided":"drawer-toggle-group",children:j.map(T=>{const P=r.get(T.capability),I=!!(P!=null&&P.enabled);return b.jsxs("label",{className:"drawer-toggle",children:[b.jsx("span",{className:"drawer-toggle-label",children:T.label}),b.jsx("button",{className:`toggle-switch ${I?"toggle-switch-on":""}`,onClick:()=>y(T),disabled:l===T.capability,role:"switch","aria-checked":I,children:b.jsx("span",{className:"toggle-switch-thumb"})})]},T.capability)})},S)),v]})}function Dh(e){return e.replace(/^https:\/\//,"")}function ZE({request:e,onClose:t}){const[r,s]=A.useState(null),[l,u]=A.useState(!1),[c,f]=A.useState(null),[d,m]=A.useState(!1);A.useEffect(()=>{let x=!1;return e("passwords.list").then(v=>{x||(v.passwords?s([...v.passwords].sort((S,j)=>S.origin===j.origin?S.username.localeCompare(j.username):S.origin.localeCompare(j.origin))):u(!0))}).catch(()=>{x||u(!0)}),()=>{x=!0}},[e]);async function y(){if(!c)return;const{origin:x,username:v}=c;m(!0);try{await e("passwords.delete",{origin:x,username:v}),s(S=>(S==null?void 0:S.filter(j=>!(j.origin===x&&j.username===v)))??S),f(null)}catch(S){console.error("Failed to delete password:",S)}finally{m(!1)}}const g=c&&di.createPortal(b.jsx("div",{className:"confirm-modal-overlay",onClick:()=>{d||f(null)},children:b.jsxs("div",{className:"confirm-modal",onClick:x=>x.stopPropagation(),children:[b.jsx("h2",{className:"confirm-modal-title",children:"Remove password?"}),b.jsxs("p",{className:"confirm-modal-message",children:["The saved password for ",b.jsx("strong",{children:c.username})," on"," ",b.jsx("strong",{children:Dh(c.origin)})," will be removed from this host."]}),b.jsxs("div",{className:"confirm-modal-actions",children:[b.jsx("button",{className:"btn btn-secondary",onClick:()=>f(null),disabled:d,children:"Cancel"}),b.jsx("button",{className:"btn btn-danger",onClick:y,disabled:d,children:d?"Removing…":"Remove"})]})]})}),document.body);return di.createPortal(b.jsxs(b.Fragment,{children:[b.jsx("div",{className:"confirm-modal-overlay",onClick:t,children:b.jsxs("div",{className:"confirm-modal passwords-dialog",onClick:x=>x.stopPropagation(),children:[b.jsx("h2",{className:"confirm-modal-title",children:"Saved Passwords"}),b.jsx("div",{className:"passwords-dialog-scroll",children:l?b.jsx("p",{className:"passwords-empty",children:"Couldn't load saved passwords."}):r===null?b.jsx("p",{className:"passwords-empty",children:"Loading…"}):r.length===0?b.jsx("p",{className:"passwords-empty",children:"No saved passwords. Passwords are saved when you approve them during a task."}):b.jsx("ul",{className:"passwords-list",children:r.map(x=>b.jsxs("li",{className:"password-item",children:[b.jsxs("div",{className:"password-item-text",children:[b.jsx("span",{className:"password-item-origin",children:Dh(x.origin)}),b.jsx("span",{className:"password-item-username",children:x.username})]}),b.jsx("button",{className:"password-delete-btn",onClick:()=>f(x),"aria-label":`Remove password for ${x.username} on ${Dh(x.origin)}`,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"})})})]},`${x.origin}
91
- ${x.username}`))})}),b.jsx("div",{className:"confirm-modal-actions",children:b.jsx("button",{className:"btn btn-primary",onClick:t,children:"Done"})})]})}),g]}),document.body)}const X0=!!window.__PALMIER_SERVE__&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"),WE=cr.isNativePlatform();function K0({daemonVersion:e,agents:t,playwrightCli:r,linkedClientToken:s,request:l,onEnabledCapabilitiesChange:u,onLinkedClientTokenChange:c}){var Kt;const{pairedHosts:f,removePairedHost:d,renamePairedHost:m}=Xi(),{activeHost:y}=yi(),g=Vr(),x=Er(),S=Yu().hostId??null,j=y.clientToken||null,D=!!j&&s===j,T=Fx("(min-width: 768px)"),[P,I]=A.useState(!1),[W,B]=A.useState(()=>Date.now());A.useEffect(()=>{const Pe=()=>B(Date.now()),ct=6e4-Date.now()%6e4,Ke=setTimeout(()=>{Pe();const bt=setInterval(Pe,6e4);Ke._iv=bt},ct);return()=>{const bt=Ke._iv;bt&&clearInterval(bt),clearTimeout(Ke)}},[]);const R=y.timezone?new Date(W).toLocaleString(void 0,{month:"short",day:"numeric",hour:"numeric",minute:"2-digit",timeZone:y.timezone}):"";async function Z(){if(!(!An||!l||!j)){I(!0);try{const{token:Pe}=await An.getFcmToken();if(!Pe)return;await l("device.link",{fcmToken:Pe}),c==null||c(j)}catch(Pe){console.error("Failed to make this the linked device:",Pe)}finally{I(!1)}}}async function F(Pe){const ct=Pe===S;if(ct&&l)try{await l("clients.revoke_self")}catch{}d(Pe),be(null),ct&&g("/",{replace:!0})}function V(Pe){const Ke=x.pathname.endsWith("/tasks")?"/tasks":"";g(`/hosts/${encodeURIComponent(Pe)}${Ke}`)}const[L,X]=A.useState(!1),[G,ue]=A.useState(!1),[le,re]=A.useState(null),[$,q]=A.useState(""),[ae,be]=A.useState(null),[M,U]=A.useState(!1),[ee,_]=A.useState(!1),ge=A.useRef(null),Ce=A.useRef(null),we=A.useCallback(()=>{ue(!0)},[]);function Te(){G&&(X(!1),ue(!1))}function Ve(){ue(!1),X(!0)}function Ae(Pe,ct){re(Pe),q(ct)}function dt(){le&&$.trim()&&m(le,$.trim()),re(null),q("")}function qt(){re(null),q("")}A.useEffect(()=>{le&&Ce.current&&(Ce.current.focus(),Ce.current.select())},[le]),A.useEffect(()=>{if(!L||G)return;function Pe(ct){ct.key==="Escape"&&we()}return document.addEventListener("keydown",Pe),()=>{document.removeEventListener("keydown",Pe)}},[L,G,we]);const ln=b.jsxs(b.Fragment,{children:[!T&&b.jsx("button",{className:"drawer-close-btn",onClick:we,"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"})})}),!X0&&f.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:f.map(Pe=>{const ct=Pe.hostId===S,Ke=le===Pe.hostId,bt=Pe.name||Pe.hostId.slice(0,8);return b.jsx("div",{className:"host-picker-item-wrapper",children:b.jsxs("div",{className:`host-picker-item ${ct?"host-picker-item-active":""}`,onClick:()=>{if(!Ke&&!ct){if(!xs())return;V(Pe.hostId),T||we()}},role:"option","aria-selected":ct,children:[Ke?b.jsx("input",{ref:Ce,className:"form-input host-picker-rename-input",type:"text",value:$,onChange:zt=>q(zt.target.value),onKeyDown:zt=>{zt.key==="Enter"&&dt(),zt.key==="Escape"&&qt()},onBlur:dt,onClick:zt=>zt.stopPropagation()}):b.jsx("span",{className:"host-picker-item-name",children:bt}),b.jsxs("div",{className:"host-picker-item-actions",children:[ct&&!Ke&&b.jsx("button",{className:"host-picker-edit-btn",onClick:zt=>{zt.stopPropagation(),Ae(Pe.hostId,bt)},"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"})})}),!ct&&b.jsx("button",{className:"host-picker-delete-btn",onClick:zt=>{zt.stopPropagation(),be(Pe.hostId)},"aria-label":`Unpair ${bt}`,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"})})})]})]})},Pe.hostId)})})})]}),!X0&&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:()=>{xs()&&(g("/pair"),T||we())},children:"Add New Host"})})]}),WE&&l&&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"}),D?b.jsx($x,{onChange:u,confirmDisable:!0}):b.jsxs(b.Fragment,{children:[b.jsx("p",{className:"drawer-section-hint",children:"This device isn't the linked device for the host, so it can't provide capabilities (SMS, contacts, location, etc.)."}),b.jsx("button",{className:"btn btn-secondary btn-full",onClick:()=>{s&&s!==j?U(!0):Z()},disabled:P,children:P?"Linking…":"Link the host to this device"})]})]})]}),l&&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:"Passwords"}),b.jsx("button",{className:"btn btn-link",onClick:()=>_(!0),children:"Manage saved passwords"})]})]}),b.jsxs("div",{className:"drawer-footer",children:[t&&t.length>0&&(()=>{const Pe=t.filter(Ke=>Ke.version),ct=t.filter(Ke=>!Ke.version);return b.jsxs("div",{className:"drawer-agents",children:[Pe.length>0&&b.jsxs("div",{className:"drawer-agents-section",children:[b.jsx("div",{className:"drawer-agents-heading",children:"Agents"}),Pe.map(Ke=>b.jsxs("div",{className:"drawer-agents-row",children:[b.jsx("span",{children:Ke.label}),b.jsxs("span",{className:"drawer-agents-version",children:["v",Ke.version]})]},Ke.key))]}),ct.length>0&&b.jsxs("div",{className:"drawer-agents-section",children:[b.jsx("div",{className:"drawer-agents-heading",children:"Version not managed by Palmier"}),ct.map(Ke=>b.jsx("div",{className:"drawer-agents-row",children:b.jsx("span",{children:Ke.label})},Ke.key))]})]})})(),r&&b.jsx("div",{className:"drawer-agents",children:b.jsxs("div",{className:"drawer-agents-section",children:[b.jsx("div",{className:"drawer-agents-heading",children:"Browser Automation"}),b.jsxs("div",{className:"drawer-agents-row",children:[b.jsx("span",{children:r.label}),b.jsxs("span",{className:"drawer-agents-version",children:["v",r.version]})]})]})}),(y.timezone||e)&&b.jsxs("div",{className:"drawer-host-info",children:[b.jsx("div",{className:"drawer-agents-heading",children:"Host"}),y.timezone&&b.jsxs("div",{className:"drawer-host-time",children:[R," · ",y.timezone]}),e&&b.jsxs("div",{className:"drawer-version",children:["Version: 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"})]})]})]}),tn=!!ae&&ae===S&&D,Gt=ae&&di.createPortal(b.jsx("div",{className:"confirm-modal-overlay",onClick:()=>be(null),children:b.jsxs("div",{className:"confirm-modal",onClick:Pe=>Pe.stopPropagation(),children:[b.jsx("h2",{className:"confirm-modal-title",children:"Remove host?"}),b.jsxs("p",{className:"confirm-modal-message",children:['"',((Kt=f.find(Pe=>Pe.hostId===ae))==null?void 0:Kt.name)||ae.slice(0,8),'" will be ',tn?"removed and unlinked":"removed",".",tn&&b.jsx(b.Fragment,{children:" This device is currently linked to the host — unlinking 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:()=>be(null),children:"Cancel"}),b.jsx("button",{className:"btn btn-danger",onClick:()=>F(ae),children:"Remove"})]})]})}),document.body),on=M&&di.createPortal(b.jsx("div",{className:"confirm-modal-overlay",onClick:()=>U(!1),children:b.jsxs("div",{className:"confirm-modal",onClick:Pe=>Pe.stopPropagation(),children:[b.jsx("h2",{className:"confirm-modal-title",children:"Link the host to this device?"}),b.jsx("p",{className:"confirm-modal-message",children:"Another device is already linked to this host. Only one device can be linked to the host — 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:()=>U(!1),children:"Cancel"}),b.jsx("button",{className:"btn btn-primary",onClick:()=>{U(!1),Z()},children:"Link"})]})]})}),document.body),Rt=ee&&l&&b.jsx(ZE,{request:l,onClose:()=>_(!1)});return T?b.jsxs(b.Fragment,{children:[b.jsx("div",{className:"drawer-panel drawer-panel-desktop",ref:ge,children:ln}),Gt,on,Rt]}):b.jsxs(b.Fragment,{children:[b.jsx("button",{className:"hamburger-btn",onClick:Ve,"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"})})}),L&&di.createPortal(b.jsx("div",{className:`drawer-overlay ${G?"drawer-overlay-closing":""}`,onClick:we,onAnimationEnd:Te,children:b.jsx("div",{className:`drawer-panel ${G?"drawer-panel-closing":""}`,ref:ge,onClick:Pe=>Pe.stopPropagation(),children:ln})}),document.body),Gt,on,Rt]})}const eC=cr.isNativePlatform(),Gd={width:16,height:16,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};function tC(){return b.jsxs("svg",{...Gd,"aria-hidden":"true",children:[b.jsx("path",{d:"M3 11 L12 3 L21 11"}),b.jsx("path",{d:"M5 9.5 V21 H19 V9.5"})]})}function Q0(){return b.jsxs("svg",{...Gd,"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 nC(){return b.jsxs("svg",{...Gd,"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 rC(){const{mode:e}=yi(),[t,r]=A.useState(!1),s=A.useRef(null);if(A.useEffect(()=>{if(!t)return;function f(m){var y;(y=s.current)!=null&&y.contains(m.target)||r(!1)}document.addEventListener("pointerdown",f);const d=window.setTimeout(()=>r(!1),3e3);return()=>{document.removeEventListener("pointerdown",f),clearTimeout(d)}},[t]),e==="direct")return null;let l,u,c;switch(e){case"lan":l=b.jsx(tC,{}),u="Connected via LAN",c="lan";break;case"nats":l=b.jsx(Q0,{}),u=eC?"Connected via relay":"Connected",c="relay";break;case"disconnected":l=b.jsx(nC,{}),u="Disconnected",c="disconnected";break;case"connecting":default:l=b.jsx(Q0,{}),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 Z0(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 iC({agents:e,hostPlatform:t,onStarted:r}){const{request:s,activeHost:l}=yi(),{setHostLastAgent:u}=Xi(),[c,f]=A.useState(""),[d,m]=A.useState(()=>Z0(e,l.lastAgent)),[y,g]=A.useState(!1),[x,v]=A.useState(!1),[S,j]=A.useState(null);A.useEffect(()=>{e.length&&(e.find(R=>R.key===d)||m(Z0(e,l.lastAgent)))},[e,d,l.lastAgent]),A.useEffect(()=>{const R=c.trim().length>0;return Mh(R?"Your session draft will be lost. Continue?":null),()=>Mh(null)},[c]);const D=e.find(R=>R.key===d),T=!!(D!=null&&D.supportsYolo);A.useEffect(()=>{!T&&y&&g(!1)},[T,y]);const P=!!c.trim()&&!!d&&!x;function I(){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.
90
+ Are you sure you want to continue?`):!0}async function xt(){be(!0),I(null);try{const ve=Rt?vn():W==="on_new_notification"&&U.trim()?[U.trim()]:W==="on_new_sms"&&tn.trim()?[tn.trim()]:[],Be=Rt||Pe?Oh(W):null,Oe={user_prompt:y,agent:x,schedule_type:Be,schedule_values:ve.length>0?ve:null,schedule_enabled:W==="ondemand"?!0:L,requires_confirmation:Rt?$:!1,yolo_mode:G,foreground_mode:oe,command:Kt?F:""};zt&&(Oe.id=e.id);const Qt=await c(zt?"task.update":"task.create",Oe,{timeout:45e3});if(Qt.error){I(Qt.error);return}zt||d(f.hostId,x),l(Qt)}catch(ve){I(ve instanceof Error?ve.message:String(ve))}finally{be(!1)}}const Jt=zt?"Save":(Rt||Pe||Kt)&&L?"Schedule":"Save";return b.jsxs("div",{className:"task-form-overlay",children:[b.jsx("div",{className:"task-form",children:A?b.jsx(UE,{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"})}),P&&b.jsx("div",{className:"form-error",children:P}),b.jsx("textarea",{autoFocus:!e,className:"form-textarea",value:y,onChange:ve=>g(ve.target.value),placeholder:Kt?"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:le}),b.jsxs("div",{className:"plan-actions",children:[t.length>0&&b.jsx("div",{className:"agent-picker-section-inline",children:t.length>1?b.jsx("select",{className:"form-select form-select-sm",value:x,onChange:ve=>v(ve.target.value),disabled:le,children:t.map(ve=>b.jsx("option",{value:ve.key,children:ve.label},ve.key))}):b.jsx("span",{className:"agent-picker-single",children:(Ke==null?void 0:Ke.label)??t[0].label})}),bt&&b.jsxs("label",{className:"yolo-inline",style:{marginLeft:"auto"},children:[b.jsx("input",{type:"checkbox",checked:G,onChange:ve=>ce(ve.target.checked),disabled:le}),"Yolo"]}),bt&&G&&b.jsx("p",{className:"yolo-warning",children:"The agent will auto-approve all tool calls without asking for permission."}),S&&b.jsx("div",{className:"granted-permissions-row",children:b.jsx("button",{className:"btn btn-link",onClick:()=>M(!0),children:"Granted Permissions"})})]}),b.jsx("div",{className:"toggles-group",children:b.jsxs("div",{className:"schedule-section",children:[b.jsxs("h3",{className:"schedule-section-title",children:["Schedule ",ct&&b.jsx("span",{className:"schedule-section-hint",children:"based on host time"})]}),b.jsxs("select",{className:"form-select",value:W,onChange:ve=>un(ve.target.value),disabled:le,children:[b.jsx("option",{value:"ondemand",children:"On User 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:"On Command Output"})]}),Pe&&b.jsxs("div",{className:"schedule-reactive",children:[b.jsxs("p",{className:"command-help-text",children:[W==="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 ",W==="on_new_notification"?"notification":"SMS","”."]}),W==="on_new_notification"&&(()=>{const ve=j.find(Oe=>Oe.packageName===U),Be=(ve==null?void 0:ve.appName)||U;return b.jsxs(b.Fragment,{children:[s?U.trim()?b.jsxs("div",{className:"app-filter-selected",children:[b.jsx("span",{className:"app-filter-selected-name",children:Be}),(ve==null?void 0:ve.appName)&&b.jsx("span",{className:"app-filter-selected-pkg",children:ve.packageName}),b.jsx("button",{type:"button",className:"app-filter-selected-clear",onClick:()=>ee(""),"aria-label":"Clear app filter",disabled:le,children:"✕"})]}):b.jsx("button",{type:"button",className:"btn btn-link app-filter-trigger",onClick:()=>{dt(""),Ve(!0)},disabled:le,children:"Select app"}):b.jsx("input",{className:"form-input",type:"text",value:U,onChange:Oe=>ee(Oe.target.value),placeholder:"App (optional), e.g. com.google.android.gm",disabled:le}),b.jsx("p",{className:"command-help-text app-filter-help",children:U.trim()?`Only notifications from ${Be} will trigger this task.`:"Every notification from your device triggers this task."})]})})(),W==="on_new_sms"&&b.jsxs(b.Fragment,{children:[b.jsx("input",{className:"form-input",type:"text",value:tn,onChange:ve=>Gt(ve.target.value),placeholder:"From (optional), e.g. +1 555-1234)",disabled:le}),b.jsx("p",{className:"command-help-text app-filter-help",children:tn.trim()?`Only SMS from ${tn.trim()} will trigger this task. Formatting (spaces, dashes, parens) is ignored.`:"Every SMS that arrives on your device triggers this task."})]})]}),Kt&&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:on,className:"form-input form-input-mono",type:"text",value:F,onChange:ve=>q(ve.target.value),placeholder:"gws gmail +watch --project my-project",disabled:le})]}),Rt&&W!=="hourly"&&b.jsxs(b.Fragment,{children:[D.map((ve,Be)=>b.jsxs("div",{className:"trigger-row-card",children:[b.jsxs("div",{className:"trigger-row-content",children:[W==="daily"&&b.jsx("input",{className:"form-input",type:"time",value:ve.time,onChange:Oe=>Le(Be,{time:Oe.target.value})}),W==="weekly"&&b.jsxs("div",{className:"trigger-row-top",children:[b.jsx("select",{className:"form-select",value:ve.dayOfWeek,onChange:Oe=>Le(Be,{dayOfWeek:Oe.target.value}),children:HE.map((Oe,_t)=>b.jsx("option",{value:String(_t),children:Oe},_t))}),b.jsx("input",{className:"form-input",type:"time",value:ve.time,onChange:Oe=>Le(Be,{time:Oe.target.value})})]}),W==="monthly"&&b.jsxs("div",{className:"trigger-row-top",children:[b.jsx("select",{className:"form-select",value:ve.dayOfMonth,onChange:Oe=>Le(Be,{dayOfMonth:Oe.target.value}),children:Array.from({length:28},(Oe,_t)=>_t+1).map(Oe=>b.jsxs("option",{value:String(Oe),children:["Day ",Oe]},Oe))}),b.jsx("input",{className:"form-input",type:"time",value:ve.time,onChange:Oe=>Le(Be,{time:Oe.target.value})})]}),W==="specific_times"&&b.jsxs("div",{className:"trigger-row-top",children:[b.jsx("input",{className:"form-input",type:"date",value:ve.onceDate,min:Tn.date,onChange:Oe=>Le(Be,{onceDate:Oe.target.value})}),b.jsx("input",{className:"form-input",type:"time",value:ve.onceTime,min:ve.onceDate===Tn.date?Tn.time:void 0,onChange:Oe=>Le(Be,{onceTime:Oe.target.value})})]})]}),D.length>1&&b.jsx("button",{className:"trigger-remove-btn",onClick:()=>Ge(Be),title:"Remove trigger",children:"×"})]},Be)),b.jsx("button",{className:"trigger-add-btn",onClick:et,children:"+ Add"})]}),r==="win32"&&b.jsxs("label",{className:"toggle-label",children:[b.jsx("input",{type:"checkbox",checked:oe,onChange:ve=>re(ve.target.checked),disabled:le}),"Run in the foreground (host must login to Windows)"]}),Rt&&b.jsxs("label",{className:"toggle-label",children:[b.jsx("input",{type:"checkbox",checked:$,onChange:ve=>V(ve.target.checked),disabled:le}),"Confirm before each run"]}),W!=="ondemand"&&b.jsxs("label",{className:"toggle-label",children:[b.jsx("input",{type:"checkbox",checked:L,onChange:ve=>X(ve.target.checked),disabled:le}),"Enabled"]})]})}),!G&&Ke&&!Ke.supportsPermissions&&b.jsxs("div",{className:"form-warning",children:["Palmier does not support runtime permission granting for ",Ke.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:()=>Ct()&&xt(),disabled:!Se||le,children:[le&&b.jsx("span",{className:"btn-spinner"}),Jt]}),b.jsx("button",{className:"btn btn-secondary",onClick:()=>{$e&&y.trim()&&!confirm("You have unsaved changes. Discard?")||o()},style:{marginLeft:"auto"},children:"Cancel"})]})]})}),Ee&&(()=>{const ve=je.trim().toLowerCase(),Be=ve?j.filter(Oe=>Oe.packageName.toLowerCase().includes(ve)||Oe.appName.toLowerCase().includes(ve)):j;return b.jsx("div",{className:"app-filter-overlay",onClick:qt,children:b.jsxs("div",{className:"app-filter-dialog",onClick:Oe=>Oe.stopPropagation(),children:[b.jsxs("div",{className:"app-filter-header",children:[b.jsx("h2",{children:"Select app"}),b.jsx("button",{className:"app-filter-close",onClick:qt,"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:je,onChange:Oe=>dt(Oe.target.value),onKeyDown:Oe=>{Oe.key==="Enter"&&je.trim()&&(ee(je.trim()),qt())},placeholder:"Search or type a package name",autoFocus:!0}),b.jsxs("ul",{className:"app-filter-list",children:[Ce&&j.length===0?Array.from({length:6}).map((Oe,_t)=>b.jsx("li",{className:"app-filter-row app-filter-skeleton",children:b.jsx("div",{className:"app-filter-skeleton-bar"})},`sk-${_t}`)):Be.length===0&&!je.trim()?b.jsx("li",{className:"app-filter-empty",children:"No apps"}):Be.map(Oe=>b.jsx("li",{className:"app-filter-row",onClick:()=>{ee(Oe.packageName),qt()},children:b.jsxs("div",{className:"app-filter-row-labels",children:[b.jsx("div",{className:"app-filter-row-name",children:Oe.appName||Oe.packageName}),Oe.appName&&b.jsx("div",{className:"app-filter-row-pkg",children:Oe.packageName})]})},Oe.packageName)),je.trim()&&b.jsx("li",{className:"app-filter-row",onClick:()=>{ee(je.trim()),qt()},children:b.jsx("div",{className:"app-filter-row-labels",children:b.jsx("div",{className:"app-filter-row-name",children:je.trim()})})})]})]})})})()]})}function Bx({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 Hx({onRefresh:e,threshold:t=70,maxPull:r=110,enabled:s=!0}){const[l,o]=E.useState(0),[c,f]=E.useState(!1),d=E.useRef(null),m=E.useRef(!1),y=E.useRef(0),g=E.useRef(!1),x=E.useRef(e);return E.useEffect(()=>{x.current=e}),E.useEffect(()=>{if(!s)return;const v=M=>{if(g.current||window.scrollY>0){d.current=null;return}if(GE(M.target)){d.current=null;return}d.current=M.touches[0].clientY,m.current=!1,y.current=0},S=M=>{if(g.current||d.current==null)return;const T=M.touches[0].clientY-d.current;if(T<=0){m.current=!1,y.current=0,o(0);return}m.current=!0;const P=Math.min(r,T*.5);y.current=P,o(P),M.cancelable&&M.preventDefault()},A=()=>{if(!m.current){d.current=null,o(0);return}const M=y.current;d.current=null,m.current=!1,y.current=0,M>=t?(g.current=!0,f(!0),o(t),Promise.resolve(x.current()).catch(()=>{}).finally(()=>{g.current=!1,f(!1),o(0)})):o(0)};return window.addEventListener("touchstart",v,{passive:!0}),window.addEventListener("touchmove",S,{passive:!1}),window.addEventListener("touchend",A,{passive:!0}),window.addEventListener("touchcancel",A,{passive:!0}),()=>{window.removeEventListener("touchstart",v),window.removeEventListener("touchmove",S),window.removeEventListener("touchend",A),window.removeEventListener("touchcancel",A)}},[s,t,r]),{pullDistance:l,refreshing:c,threshold:t}}function GE(e){let t=e;for(;t&&t!==document.body&&t!==document.documentElement;){const r=window.getComputedStyle(t).overflowY;if((r==="auto"||r==="scroll")&&t.scrollHeight>t.clientHeight)return!0;t=t.parentElement}return!1}function JE(e){return JSON.stringify([e.user_prompt,e.agent??null,e.schedule_type??null,e.schedule_values??null,e.schedule_enabled,e.requires_confirmation,e.yolo_mode??!1,e.foreground_mode??!1,e.command??"",e.permissions??null])}function XE({connected:e,hostId:t,request:r,subscribeEvents:s,agents:l,hostPlatform:o,isNotificationListener:c,onViewRun:f,hostInfoStatus:d}){const[m,y]=E.useState([]),[g,x]=E.useState(!1),[v,S]=E.useState(null),[A,M]=E.useState(new Map),[T,P]=E.useState(!1),[I,W]=E.useState(void 0),B=E.useCallback(()=>{P(!1),W(void 0)},[]),D=E.useCallback(async()=>{if(e){x(!0),S(null);try{const X=(await r("task.list")).tasks??[],G=new Map;for(const ce of X)ce.status&&G.set(ce.id,ce.status);M(G),y(X)}catch(L){const X=L instanceof Error?L.message:String(L);X==="Not connected"||X.includes("503")||X.toLowerCase().includes("no responders")?S(null):S(X),y([])}finally{x(!1)}}},[e,t,r]);E.useEffect(()=>{e?D():(y([]),x(!1))},[e,t,D]);const Z=Hx({onRefresh:D,enabled:e});E.useEffect(()=>!e||!t?void 0:s(t,async X=>{const G=X.subject.split(".");if(G.length<3)return;const ce=G.slice(2).join(".");let oe={};try{oe=JSON.parse(new TextDecoder().decode(X.data))}catch{return}const re=oe.event_type;if(!(re!=="running-state"&&re!=="permission-resolved"))try{const F=await r("task.status",{id:ce},{timeout:5e3});if(F.error)return;M(q=>{const le=new Map(q);return le.set(ce,F),le})}catch{}}),[e,t,s,r]);function $(L){y(X=>{const G=X.findIndex(ce=>ce.id===L.id);if(G>=0){const ce=[...X];return ce[G]=L,ce}return[L,...X]}),P(!1),W(void 0)}function V(L){y(X=>X.filter(G=>G.id!==L)),M(X=>{const G=new Map(X);return G.delete(L),G})}return b.jsxs(b.Fragment,{children:[b.jsx(Bx,{pullDistance:Z.pullDistance,refreshing:Z.refreshing,threshold:Z.threshold}),v&&b.jsxs("div",{className:"form-error",children:[v,v.toLowerCase().includes("failed to fetch")&&b.jsxs(b.Fragment,{children:[" ",b.jsx("a",{href:"#",onClick:L=>{L.preventDefault(),window.location.reload()},children:"Reload"})]})]}),g&&!m.length&&d==="ready"?b.jsx("div",{className:"task-list",children:[0,1,2].map(L=>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+L*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%"}})]})]},L))}):m.length===0?d==="loading"?b.jsx("div",{className:"empty-state",children:b.jsx("p",{className:"empty-state-text",children:"Connecting to host…"})}):d==="error"?b.jsxs("div",{className:"empty-state",children:[b.jsx("p",{className:"empty-state-text",children:"Couldn't reach host"}),b.jsxs("p",{className:"empty-state-hint",children:["The host didn't respond. Try running ",b.jsx("code",{children:"palmier restart"})," on the host machine to restart the daemon."]})]}):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(L=>b.jsx(zE,{task:L,lastEvent:A.get(L.id),onEdit:X=>{W(X),P(!0),r("task.get",{id:X.id}).then(G=>{G.error||W(G)}).catch(()=>{})},onDelete:V,onViewRun:f},L.id))}),b.jsx("button",{className:"fab",onClick:()=>{W(void 0),P(!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"})]})}),T&&b.jsx(YE,{initial:I,agents:l,hostPlatform:o,isNotificationListener:c,onSaved:$,onCancel:B},I?JE(I):"new")]})}let pa=null;function X0(e){pa&&(e.preventDefault(),e.returnValue="")}function Mh(e){const t=!!pa;pa=e;const r=!!pa;r&&!t?window.addEventListener("beforeunload",X0):!r&&t&&window.removeEventListener("beforeunload",X0)}function xs(){return pa?window.confirm(pa):!0}function KE(){const e=Vr(),t=Er(),{hostId:r}=Yu(),s=t.pathname.endsWith("/tasks"),l=!s;function o(c){xs()&&r&&e(`/hosts/${encodeURIComponent(r)}${c}`)}return b.jsxs(b.Fragment,{children:[b.jsxs("button",{className:`tab-btn ${l?"tab-btn-active":""}`,onClick:()=>o(""),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:()=>o("/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 qx(e){const[t,r]=E.useState(()=>window.matchMedia(e).matches);return E.useEffect(()=>{const s=window.matchMedia(e),l=o=>r(o.matches);return s.addEventListener("change",l),r(s.matches),()=>s.removeEventListener("change",l)},[e]),t}const Cu=Gn.isNativePlatform(),QE=["Device","Data","Messaging"],ZE=[{capability:"sms-read",label:"Read SMS",group:"Messaging"},{capability:"sms-send",label:"Send SMS",group:"Messaging"},{capability:"send-email",label:"Prompt Email to Send",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 WE(){if(!Cu||!An)return new Set;try{const{capabilities:e}=await An.getCapabilityStatus();return new Set(e.filter(t=>t.enabled).map(t=>t.name))}catch{return new Set}}function Ix({onChange:e,confirmDisable:t=!1}){const[r,s]=E.useState(new Map),[l,o]=E.useState(null),[c,f]=E.useState(null),d=E.useCallback(async()=>{if(!(!Cu||!An))try{const{capabilities:S}=await An.getCapabilityStatus(),A=new Map;for(const M of S)A.set(M.name,M);s(A),e==null||e(new Set(S.filter(M=>M.enabled).map(M=>M.name)))}catch(S){console.error("Failed to read capability status:",S)}},[e]);E.useEffect(()=>{d()},[d]),E.useEffect(()=>{if(!Cu)return;const S=pd.addListener("resume",d);return()=>{S.then(A=>A.remove())}},[d]);async function m(S,A){if(An){o(S.capability);try{const M=await An.setCapabilityEnabled({capability:S.capability,enabled:A});!M.enabled&&M.reason==="no-email-client"&&alert("No email app is installed on this device. Install one (e.g. Gmail) before enabling Send Email."),await d()}catch(M){console.error(`Failed to toggle ${S.capability}:`,M)}finally{o(null)}}}function y(S){const A=r.get(S.capability);if(A){if(A.enabled&&t){f(S);return}m(S,!A.enabled)}}function g(){const S=c;S&&(f(null),m(S,!1))}if(!Cu)return null;const x=QE.map(S=>({group:S,items:ZE.filter(A=>{const M=r.get(A.capability);return A.group===S&&(M==null?void 0:M.supported)})})).filter(S=>S.items.length>0);if(x.length===0)return b.jsx("div",{className:"capability-toggles-loading",children:b.jsx("span",{className:"spinner"})});const v=c&&di.createPortal(b.jsx("div",{className:"confirm-modal-overlay",onClick:()=>f(null),children:b.jsxs("div",{className:"confirm-modal",onClick:S=>S.stopPropagation(),children:[b.jsxs("h2",{className:"confirm-modal-title",children:["Disable ",c.label,"?"]}),b.jsxs("p",{className:"confirm-modal-message",children:["All hosts linked to this device will no longer be able to use ",c.label,"."]}),b.jsxs("div",{className:"confirm-modal-actions",children:[b.jsx("button",{className:"btn btn-secondary",onClick:()=>f(null),children:"Cancel"}),b.jsx("button",{className:"btn btn-danger",onClick:g,children:"Disable"})]})]})}),document.body);return b.jsxs(b.Fragment,{children:[x.map(({group:S,items:A},M)=>b.jsx("div",{className:M>0?"drawer-toggle-group drawer-toggle-group-divided":"drawer-toggle-group",children:A.map(T=>{const P=r.get(T.capability),I=!!(P!=null&&P.enabled);return b.jsxs("label",{className:"drawer-toggle",children:[b.jsx("span",{className:"drawer-toggle-label",children:T.label}),b.jsx("button",{className:`toggle-switch ${I?"toggle-switch-on":""}`,onClick:()=>y(T),disabled:l===T.capability,role:"switch","aria-checked":I,children:b.jsx("span",{className:"toggle-switch-thumb"})})]},T.capability)})},S)),v]})}function Dh(e){return e.replace(/^https:\/\//,"")}function eC({request:e,onClose:t}){const[r,s]=E.useState(null),[l,o]=E.useState(!1),[c,f]=E.useState(null),[d,m]=E.useState(!1);E.useEffect(()=>{let x=!1;return e("passwords.list").then(v=>{x||(v.passwords?s([...v.passwords].sort((S,A)=>S.origin===A.origin?S.username.localeCompare(A.username):S.origin.localeCompare(A.origin))):o(!0))}).catch(()=>{x||o(!0)}),()=>{x=!0}},[e]);async function y(){if(!c)return;const{origin:x,username:v}=c;m(!0);try{await e("passwords.delete",{origin:x,username:v}),s(S=>(S==null?void 0:S.filter(A=>!(A.origin===x&&A.username===v)))??S),f(null)}catch(S){console.error("Failed to delete password:",S)}finally{m(!1)}}const g=c&&di.createPortal(b.jsx("div",{className:"confirm-modal-overlay",onClick:()=>{d||f(null)},children:b.jsxs("div",{className:"confirm-modal",onClick:x=>x.stopPropagation(),children:[b.jsx("h2",{className:"confirm-modal-title",children:"Remove password?"}),b.jsxs("p",{className:"confirm-modal-message",children:["The saved password for ",b.jsx("strong",{children:c.username})," on"," ",b.jsx("strong",{children:Dh(c.origin)})," will be removed from this host."]}),b.jsxs("div",{className:"confirm-modal-actions",children:[b.jsx("button",{className:"btn btn-secondary",onClick:()=>f(null),disabled:d,children:"Cancel"}),b.jsx("button",{className:"btn btn-danger",onClick:y,disabled:d,children:d?"Removing…":"Remove"})]})]})}),document.body);return di.createPortal(b.jsxs(b.Fragment,{children:[b.jsx("div",{className:"confirm-modal-overlay",onClick:t,children:b.jsxs("div",{className:"confirm-modal passwords-dialog",onClick:x=>x.stopPropagation(),children:[b.jsx("h2",{className:"confirm-modal-title",children:"Saved Passwords"}),b.jsx("div",{className:"passwords-dialog-scroll",children:l?b.jsx("p",{className:"passwords-empty",children:"Couldn't load saved passwords."}):r===null?b.jsx("p",{className:"passwords-empty",children:"Loading…"}):r.length===0?b.jsx("p",{className:"passwords-empty",children:"No saved passwords. Passwords are saved when you approve them during a task."}):b.jsx("ul",{className:"passwords-list",children:r.map(x=>b.jsxs("li",{className:"password-item",children:[b.jsxs("div",{className:"password-item-text",children:[b.jsx("span",{className:"password-item-origin",children:Dh(x.origin)}),b.jsx("span",{className:"password-item-username",children:x.username})]}),b.jsx("button",{className:"password-delete-btn",onClick:()=>f(x),"aria-label":`Remove password for ${x.username} on ${Dh(x.origin)}`,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"})})})]},`${x.origin}
91
+ ${x.username}`))})}),b.jsx("div",{className:"confirm-modal-actions",children:b.jsx("button",{className:"btn btn-primary",onClick:t,children:"Done"})})]})}),g]}),document.body)}const K0=!!window.__PALMIER_SERVE__&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"),tC=Gn.isNativePlatform();function Q0({daemonVersion:e,agents:t,playwrightCli:r,linkedClientToken:s,request:l,onEnabledCapabilitiesChange:o,onLinkedClientTokenChange:c}){var Kt;const{pairedHosts:f,removePairedHost:d,renamePairedHost:m}=Xi(),{activeHost:y}=yi(),g=Vr(),x=Er(),S=Yu().hostId??null,A=y.clientToken||null,M=!!A&&s===A,T=qx("(min-width: 768px)"),[P,I]=E.useState(!1),[W,B]=E.useState(()=>Date.now());E.useEffect(()=>{const Pe=()=>B(Date.now()),ct=6e4-Date.now()%6e4,Ke=setTimeout(()=>{Pe();const bt=setInterval(Pe,6e4);Ke._iv=bt},ct);return()=>{const bt=Ke._iv;bt&&clearInterval(bt),clearTimeout(Ke)}},[]);const D=y.timezone?new Date(W).toLocaleString(void 0,{month:"short",day:"numeric",hour:"numeric",minute:"2-digit",timeZone:y.timezone}):"";async function Z(){if(!(!An||!l||!A)){I(!0);try{const{token:Pe}=await An.getFcmToken();if(!Pe)return;await l("device.link",{fcmToken:Pe}),c==null||c(A)}catch(Pe){console.error("Failed to make this the linked device:",Pe)}finally{I(!1)}}}async function $(Pe){const ct=Pe===S;if(ct&&l)try{await l("clients.revoke_self")}catch{}d(Pe),be(null),ct&&g("/",{replace:!0})}function V(Pe){const Ke=x.pathname.endsWith("/tasks")?"/tasks":"";g(`/hosts/${encodeURIComponent(Pe)}${Ke}`)}const[L,X]=E.useState(!1),[G,ce]=E.useState(!1),[oe,re]=E.useState(null),[F,q]=E.useState(""),[le,be]=E.useState(null),[O,U]=E.useState(!1),[ee,j]=E.useState(!1),ie=E.useRef(null),Ce=E.useRef(null),_e=E.useCallback(()=>{ce(!0)},[]);function Ee(){G&&(X(!1),ce(!1))}function Ve(){ce(!1),X(!0)}function je(Pe,ct){re(Pe),q(ct)}function dt(){oe&&F.trim()&&m(oe,F.trim()),re(null),q("")}function qt(){re(null),q("")}E.useEffect(()=>{oe&&Ce.current&&(Ce.current.focus(),Ce.current.select())},[oe]),E.useEffect(()=>{if(!L||G)return;function Pe(ct){ct.key==="Escape"&&_e()}return document.addEventListener("keydown",Pe),()=>{document.removeEventListener("keydown",Pe)}},[L,G,_e]);const ln=b.jsxs(b.Fragment,{children:[!T&&b.jsx("button",{className:"drawer-close-btn",onClick:_e,"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"})})}),!K0&&f.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:f.map(Pe=>{const ct=Pe.hostId===S,Ke=oe===Pe.hostId,bt=Pe.name||Pe.hostId.slice(0,8);return b.jsx("div",{className:"host-picker-item-wrapper",children:b.jsxs("div",{className:`host-picker-item ${ct?"host-picker-item-active":""}`,onClick:()=>{if(!Ke&&!ct){if(!xs())return;V(Pe.hostId),T||_e()}},role:"option","aria-selected":ct,children:[Ke?b.jsx("input",{ref:Ce,className:"form-input host-picker-rename-input",type:"text",value:F,onChange:zt=>q(zt.target.value),onKeyDown:zt=>{zt.key==="Enter"&&dt(),zt.key==="Escape"&&qt()},onBlur:dt,onClick:zt=>zt.stopPropagation()}):b.jsx("span",{className:"host-picker-item-name",children:bt}),b.jsxs("div",{className:"host-picker-item-actions",children:[ct&&!Ke&&b.jsx("button",{className:"host-picker-edit-btn",onClick:zt=>{zt.stopPropagation(),je(Pe.hostId,bt)},"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"})})}),!ct&&b.jsx("button",{className:"host-picker-delete-btn",onClick:zt=>{zt.stopPropagation(),be(Pe.hostId)},"aria-label":`Unpair ${bt}`,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"})})})]})]})},Pe.hostId)})})})]}),!K0&&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:()=>{xs()&&(g("/pair"),T||_e())},children:"Add New Host"})})]}),tC&&l&&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"}),M?b.jsx(Ix,{onChange:o,confirmDisable:!0}):b.jsxs(b.Fragment,{children:[b.jsx("p",{className:"drawer-section-hint",children:"This device isn't the linked device for the host, so it can't provide capabilities (SMS, contacts, location, etc.)."}),b.jsx("button",{className:"btn btn-secondary btn-full",onClick:()=>{s&&s!==A?U(!0):Z()},disabled:P,children:P?"Linking…":"Link the host to this device"})]})]})]}),l&&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:"Passwords"}),b.jsx("button",{className:"btn btn-link",onClick:()=>j(!0),children:"Manage saved passwords"})]})]}),b.jsxs("div",{className:"drawer-footer",children:[t&&t.length>0&&(()=>{const Pe=t.filter(Ke=>Ke.version),ct=t.filter(Ke=>!Ke.version);return b.jsxs("div",{className:"drawer-agents",children:[Pe.length>0&&b.jsxs("div",{className:"drawer-agents-section",children:[b.jsx("div",{className:"drawer-agents-heading",children:"Agents"}),Pe.map(Ke=>b.jsxs("div",{className:"drawer-agents-row",children:[b.jsx("span",{children:Ke.label}),b.jsxs("span",{className:"drawer-agents-version",children:["v",Ke.version]})]},Ke.key))]}),ct.length>0&&b.jsxs("div",{className:"drawer-agents-section",children:[b.jsx("div",{className:"drawer-agents-heading",children:"Version not managed by Palmier"}),ct.map(Ke=>b.jsx("div",{className:"drawer-agents-row",children:b.jsx("span",{children:Ke.label})},Ke.key))]})]})})(),r&&b.jsx("div",{className:"drawer-agents",children:b.jsxs("div",{className:"drawer-agents-section",children:[b.jsx("div",{className:"drawer-agents-heading",children:"Browser Automation"}),b.jsxs("div",{className:"drawer-agents-row",children:[b.jsx("span",{children:r.label}),b.jsxs("span",{className:"drawer-agents-version",children:["v",r.version]})]})]})}),(y.timezone||e)&&b.jsxs("div",{className:"drawer-host-info",children:[b.jsx("div",{className:"drawer-agents-heading",children:"Host"}),y.timezone&&b.jsxs("div",{className:"drawer-host-time",children:[D," · ",y.timezone]}),e&&b.jsxs("div",{className:"drawer-version",children:["Version: 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"})]})]})]}),tn=!!le&&le===S&&M,Gt=le&&di.createPortal(b.jsx("div",{className:"confirm-modal-overlay",onClick:()=>be(null),children:b.jsxs("div",{className:"confirm-modal",onClick:Pe=>Pe.stopPropagation(),children:[b.jsx("h2",{className:"confirm-modal-title",children:"Remove host?"}),b.jsxs("p",{className:"confirm-modal-message",children:['"',((Kt=f.find(Pe=>Pe.hostId===le))==null?void 0:Kt.name)||le.slice(0,8),'" will be ',tn?"removed and unlinked":"removed",".",tn&&b.jsx(b.Fragment,{children:" This device is currently linked to the host — unlinking 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:()=>be(null),children:"Cancel"}),b.jsx("button",{className:"btn btn-danger",onClick:()=>$(le),children:"Remove"})]})]})}),document.body),on=O&&di.createPortal(b.jsx("div",{className:"confirm-modal-overlay",onClick:()=>U(!1),children:b.jsxs("div",{className:"confirm-modal",onClick:Pe=>Pe.stopPropagation(),children:[b.jsx("h2",{className:"confirm-modal-title",children:"Link the host to this device?"}),b.jsx("p",{className:"confirm-modal-message",children:"Another device is already linked to this host. Only one device can be linked to the host — 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:()=>U(!1),children:"Cancel"}),b.jsx("button",{className:"btn btn-primary",onClick:()=>{U(!1),Z()},children:"Link"})]})]})}),document.body),Rt=ee&&l&&b.jsx(eC,{request:l,onClose:()=>j(!1)});return T?b.jsxs(b.Fragment,{children:[b.jsx("div",{className:"drawer-panel drawer-panel-desktop",ref:ie,children:ln}),Gt,on,Rt]}):b.jsxs(b.Fragment,{children:[b.jsx("button",{className:"hamburger-btn",onClick:Ve,"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"})})}),L&&di.createPortal(b.jsx("div",{className:`drawer-overlay ${G?"drawer-overlay-closing":""}`,onClick:_e,onAnimationEnd:Ee,children:b.jsx("div",{className:`drawer-panel ${G?"drawer-panel-closing":""}`,ref:ie,onClick:Pe=>Pe.stopPropagation(),children:ln})}),document.body),Gt,on,Rt]})}const nC=Gn.isNativePlatform(),Gd={width:16,height:16,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};function rC(){return b.jsxs("svg",{...Gd,"aria-hidden":"true",children:[b.jsx("path",{d:"M3 11 L12 3 L21 11"}),b.jsx("path",{d:"M5 9.5 V21 H19 V9.5"})]})}function Z0(){return b.jsxs("svg",{...Gd,"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 iC(){return b.jsxs("svg",{...Gd,"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 sC(){const{mode:e}=yi(),[t,r]=E.useState(!1),s=E.useRef(null);if(E.useEffect(()=>{if(!t)return;function f(m){var y;(y=s.current)!=null&&y.contains(m.target)||r(!1)}document.addEventListener("pointerdown",f);const d=window.setTimeout(()=>r(!1),3e3);return()=>{document.removeEventListener("pointerdown",f),clearTimeout(d)}},[t]),e==="direct")return null;let l,o,c;switch(e){case"lan":l=b.jsx(rC,{}),o="Connected via LAN",c="lan";break;case"nats":l=b.jsx(Z0,{}),o=nC?"Connected via relay":"Connected",c="relay";break;case"disconnected":l=b.jsx(iC,{}),o="Disconnected",c="disconnected";break;case"connecting":default:l=b.jsx(Z0,{}),o="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":o,onClick:()=>r(f=>!f),children:l}),b.jsx("div",{className:`conn-status-popover ${t?"conn-status-popover--open":""}`,role:"tooltip",children:o})]})}function W0(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 aC({agents:e,hostPlatform:t,onStarted:r}){const{request:s,activeHost:l}=yi(),{setHostLastAgent:o}=Xi(),[c,f]=E.useState(""),[d,m]=E.useState(()=>W0(e,l.lastAgent)),[y,g]=E.useState(!1),[x,v]=E.useState(!1),[S,A]=E.useState(null);E.useEffect(()=>{e.length&&(e.find(D=>D.key===d)||m(W0(e,l.lastAgent)))},[e,d,l.lastAgent]),E.useEffect(()=>{const D=c.trim().length>0;return Mh(D?"Your session draft will be lost. Continue?":null),()=>Mh(null)},[c]);const M=e.find(D=>D.key===d),T=!!(M!=null&&M.supportsYolo);E.useEffect(()=>{!T&&y&&g(!1)},[T,y]);const P=!!c.trim()&&!!d&&!x;function I(){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.
92
92
 
93
- Are you sure you want to continue?`):!0}async function W(){if(!(!P||!I())){v(!0),j(null);try{const R=await s("task.run_oneoff",{user_prompt:c,agent:d,yolo_mode:y,...t==="win32"?{foreground_mode:!0}:{}});if(R.error){j(R.error);return}u(l.hostId,d),f(""),Mh(null),R.task_id&&r(R.task_id,R.run_id)}catch(R){j(R instanceof Error?R.message:String(R))}finally{v(!1)}}}function B(R){R.key==="Enter"&&(R.metaKey||R.ctrlKey)&&(R.preventDefault(),W())}return b.jsxs("div",{className:"session-composer",children:[S&&b.jsx("div",{className:"form-error",children:S}),b.jsx("textarea",{className:"session-composer-textarea",value:c,onChange:R=>f(R.target.value),onKeyDown:B,placeholder:"What can I do for you?",rows:3,disabled:x}),b.jsxs("div",{className:"session-composer-controls",children:[e.length>0&&b.jsx("div",{className:"agent-picker-section-inline",children:e.length>1?b.jsx("select",{className:"form-select form-select-sm",value:d,onChange:R=>m(R.target.value),disabled:x,children:e.map(R=>b.jsx("option",{value:R.key,children:R.label},R.key))}):b.jsx("span",{className:"agent-picker-single",children:(D==null?void 0:D.label)??e[0].label})}),T&&b.jsxs("label",{className:"session-composer-yolo",children:[b.jsx("input",{type:"checkbox",checked:y,onChange:R=>g(R.target.checked),disabled:x}),"Yolo"]}),b.jsx("button",{className:"btn btn-primary chat-send-btn",onClick:W,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"})]})})]}),T&&y&&b.jsx("p",{className:"command-help-text",children:"The agent will auto-approve all tool calls without asking for permission."})]})}const gs=72,W0=6;function sC({id:e,revealedId:t,setRevealedId:r,onDelete:s,onClick:l,children:u,actionLabel:c="Delete",confirmMessage:f="Delete this item? This can't be undone."}){const d=t===e,[m,y]=A.useState(0),[g,x]=A.useState(!1),v=A.useRef(0),S=A.useRef(0),j=A.useRef(null),D=A.useRef(0),T=A.useRef(!1),P=A.useRef(null);A.useEffect(()=>{d||y(0)},[d]),A.useEffect(()=>{if(!d)return;function F(V){var L;(L=P.current)!=null&&L.contains(V.target)||r(null)}return document.addEventListener("pointerdown",F),()=>document.removeEventListener("pointerdown",F)},[d,r]);function I(F){F.button!==void 0&&F.button!==0||(v.current=F.clientX,S.current=F.clientY,j.current=null,D.current=d?-gs:0,T.current=!1)}function W(F){if(F.pointerType==="mouse"&&F.buttons===0)return;const V=F.clientX-v.current,L=F.clientY-S.current;if(j.current===null){if(Math.abs(V)<W0&&Math.abs(L)<W0)return;if(j.current=Math.abs(V)>Math.abs(L)?"x":"y",j.current==="x")try{F.currentTarget.setPointerCapture(F.pointerId)}catch{}}if(j.current!=="x")return;T.current=!0,g||x(!0);let X=D.current+V;X>0&&(X=X/4),X<-gs&&(X=-gs+(X+gs)/4),y(X)}function B(){if(j.current!=="x"){x(!1);return}j.current=null,x(!1),m<=-36?(y(-gs),r(e)):(y(0),d&&r(null))}function R(F){if(T.current){T.current=!1,F.stopPropagation(),F.preventDefault();return}d&&(F.stopPropagation(),F.preventDefault(),r(null))}const Z=m!==0?m:d?-gs:0;return b.jsxs("div",{ref:P,className:"swipe-row",children:[b.jsxs("button",{type:"button",className:"swipe-row-action",style:{width:gs},onClick:F=>{F.stopPropagation(),window.confirm(f)&&s()},tabIndex:d?0:-1,"aria-hidden":!d,"aria-label":c,children:[b.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[b.jsx("polyline",{points:"3 6 5 6 21 6"}),b.jsx("path",{d:"M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6"}),b.jsx("path",{d:"M10 11v6M14 11v6"}),b.jsx("path",{d:"M9 6V4a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v2"})]}),b.jsx("span",{className:"swipe-row-action-label",children:c})]}),b.jsx("div",{className:`swipe-row-content ${g?"swipe-row-content-dragging":""}`,style:{transform:`translateX(${Z}px)`},onPointerDown:I,onPointerMove:W,onPointerUp:B,onPointerCancel:B,onClickCapture:R,onClick:l,children:u})]})}const aC=10;function lC({connected:e,hostId:t,request:r,subscribeEvents:s,agents:l,hostPlatform:u,filterTaskId:c,onClearFilter:f,hostInfoStatus:d}){const m=Yd(),[y,g]=A.useState([]),[x,v]=A.useState(0),[S,j]=A.useState(!1),[D,T]=A.useState(!1),[P,I]=A.useState(null),W=Vr();async function B(q){const ae=`${q.task_id}:${q.run_id}`;g(be=>be.filter(M=>`${M.task_id}:${M.run_id}`!==ae)),v(be=>Math.max(0,be-1)),I(null);try{await r("taskrun.delete",{task_id:q.task_id,run_id:q.run_id})}catch(be){console.error("Failed to delete run:",be),g(M=>[q,...M]),v(M=>M+1)}}const R=A.useRef(null),Z=A.useCallback(q=>{const ae={offset:q,limit:aC};return c&&(ae.task_id=c),ae},[c]),F=A.useCallback(async(q,ae)=>{if(e){ae?T(!0):j(!0);try{const be=await r("taskrun.list",Z(q)),M=be.entries??[];v(be.total??0),g(ae?U=>{const ee=new Set(U.map(ge=>`${ge.task_id}:${ge.run_id}`)),_=M.filter(ge=>!ee.has(`${ge.task_id}:${ge.run_id}`));return[...U,..._]}:M)}catch(be){be instanceof Error&&be.message==="Not connected"||console.error("Failed to load runs:",be)}finally{j(!1),T(!1)}}},[e,r,Z]);A.useEffect(()=>{e?(g([]),v(0),F(0,!1)):(g([]),v(0))},[e,t,F,c]);const V=Ix({onRefresh:()=>F(0,!1),enabled:e});A.useEffect(()=>!e||!t?void 0:s(t,async ae=>{try{const be=JSON.parse(new TextDecoder().decode(ae.data));if(be.event_type==="running-state"&&be.running_state&&["started","finished","failed","aborted"].includes(be.running_state)){const M=await r("taskrun.list",Z(0)),U=M.entries??[];v(M.total??0),g(ee=>{const _=new Map(U.map(Te=>[`${Te.task_id}:${Te.run_id}`,Te])),ge=ee.map(Te=>{const Ve=`${Te.task_id}:${Te.run_id}`;return _.get(Ve)??Te}),Ce=new Set(ge.map(Te=>`${Te.task_id}:${Te.run_id}`));return[...U.filter(Te=>!Ce.has(`${Te.task_id}:${Te.run_id}`)),...ge]})}}catch{}}),[e,t,s,r]),A.useEffect(()=>{const q=R.current;if(!q)return;const ae=new IntersectionObserver(be=>{be[0].isIntersecting&&!D&&y.length<x&&F(y.length,!0)},{threshold:.1});return ae.observe(q),()=>ae.disconnect()},[y.length,x,D,F]);function L(q,ae){if(!q||!ae)return"";const be=Math.round((ae-q)/1e3);if(be<60)return`${be}s`;const M=Math.floor(be/60),U=be%60;return`${M}m ${U}s`}const X={started:"Running",finished:"Finished",failed:"Failed",aborted:"Aborted"};function G(q,ae){xs()&&t&&W(`/hosts/${encodeURIComponent(t)}/runs/${encodeURIComponent(q)}/${encodeURIComponent(ae)}`)}const ue=!c&&d==="ready"&&b.jsx(iC,{agents:l,hostPlatform:u,onStarted:(q,ae)=>{if(!t)return;const be=`/hosts/${encodeURIComponent(t)}/runs/${encodeURIComponent(q)}`;W(ae?`${be}/${encodeURIComponent(ae)}`:be)}}),le=b.jsx(qx,{pullDistance:V.pullDistance,refreshing:V.refreshing,threshold:V.threshold}),re=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 $(q){if(q==="failed")return"var(--color-error)";if(q==="aborted")return"var(--color-warning, #d97706)"}return S&&y.length===0&&e&&d==="ready"?b.jsxs(b.Fragment,{children:[le,ue,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.jsx("div",{className:"task-card-title-row",children:b.jsx("div",{className:"skeleton-line",style:{width:`${70+q*10}%`}})})}),b.jsx("div",{className:"task-card-meta",children:b.jsx("div",{className:"skeleton-line",style:{width:"45%"}})})]},q))})]}):y.length===0?b.jsxs(b.Fragment,{children:[le,ue,re,b.jsx("div",{className:"sessions-view",children:d==="loading"?b.jsx("div",{className:"empty-state",children:b.jsx("p",{className:"empty-state-text",children:"Connecting to host…"})}):d==="error"?b.jsxs("div",{className:"empty-state",children:[b.jsx("p",{className:"empty-state-text",children:"Couldn't reach host"}),b.jsxs("p",{className:"empty-state-hint",children:["The host didn't respond. Try running ",b.jsx("code",{children:"palmier restart"})," on the host machine to restart the daemon."]})]}):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:[le,ue,re,b.jsxs("div",{className:"task-list",children:[y.map((q,ae)=>{const be=`${q.task_id}:${q.run_id}`;return b.jsx(sC,{id:be,revealedId:P,setRevealedId:I,onDelete:()=>B(q),confirmMessage:"Delete this session? Its run history will be removed from the host.",onClick:()=>!q.error&&G(q.task_id,q.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:q.task_name||q.task_id}),b.jsxs("div",{className:"sessions-card-meta",children:[q.running_state==="started"?b.jsx("span",{className:"status-spinner","aria-label":"Running",children:b.jsx("span",{})}):b.jsx("span",{style:{color:$(q.running_state)},children:X[q.running_state??""]??q.running_state}),q.end_time&&b.jsx("span",{children:m(q.end_time)}),q.start_time&&q.end_time&&b.jsx("span",{style:{color:"var(--color-muted)"},children:L(q.start_time,q.end_time)}),q.error&&b.jsx("span",{style:{color:"var(--color-muted)"},children:q.error})]})]}),b.jsx("span",{className:"sessions-card-chevron",children:"›"})]})},`${be}-${ae}`)}),b.jsx("div",{ref:R,style:{height:1}}),D&&b.jsx("div",{className:"loading-state",style:{padding:"var(--space-md)"},children:b.jsx("div",{className:"spinner"})})]})]})}function oC(e,t){const r={};return(e[e.length-1]===""?[...e,""]:e).join((r.padRight?" ":"")+","+(r.padLeft===!1?"":" ")).trim()}const uC=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,cC=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,fC={};function eb(e,t){return(fC.jsx?cC:uC).test(e)}const hC=/[ \t\n\f\r]/g;function dC(e){return typeof e=="object"?e.type==="text"?tb(e.value):!1:tb(e)}function tb(e){return e.replace(hC,"")===""}class Jl{constructor(t,r,s){this.normal=r,this.property=t,s&&(this.space=s)}}Jl.prototype.normal={};Jl.prototype.property={};Jl.prototype.space=void 0;function Vx(e,t){const r={},s={};for(const l of e)Object.assign(r,l.property),Object.assign(s,l.normal);return new Jl(r,s,t)}function bd(e){return e.toLowerCase()}class Gn{constructor(t,r){this.attribute=r,this.property=t}}Gn.prototype.attribute="";Gn.prototype.booleanish=!1;Gn.prototype.boolean=!1;Gn.prototype.commaOrSpaceSeparated=!1;Gn.prototype.commaSeparated=!1;Gn.prototype.defined=!1;Gn.prototype.mustUseProperty=!1;Gn.prototype.number=!1;Gn.prototype.overloadedBoolean=!1;Gn.prototype.property="";Gn.prototype.spaceSeparated=!1;Gn.prototype.space=void 0;let mC=0;const Ze=Ss(),mn=Ss(),xd=Ss(),Se=Ss(),Ut=Ss(),ga=Ss(),rr=Ss();function Ss(){return 2**++mC}const vd=Object.freeze(Object.defineProperty({__proto__:null,boolean:Ze,booleanish:mn,commaOrSpaceSeparated:rr,commaSeparated:ga,number:Se,overloadedBoolean:xd,spaceSeparated:Ut},Symbol.toStringTag,{value:"Module"})),Lh=Object.keys(vd);class Jd extends Gn{constructor(t,r,s,l){let u=-1;if(super(t,r),nb(this,"space",l),typeof s=="number")for(;++u<Lh.length;){const c=Lh[u];nb(this,Lh[u],(s&vd[c])===vd[c])}}}Jd.prototype.defined=!0;function nb(e,t,r){r&&(e[t]=r)}function Ca(e){const t={},r={};for(const[s,l]of Object.entries(e.properties)){const u=new Jd(s,e.transform(e.attributes||{},s),l,e.space);e.mustUseProperty&&e.mustUseProperty.includes(s)&&(u.mustUseProperty=!0),t[s]=u,r[bd(s)]=s,r[bd(u.attribute)]=s}return new Jl(t,r,e.space)}const Yx=Ca({properties:{ariaActiveDescendant:null,ariaAtomic:mn,ariaAutoComplete:null,ariaBusy:mn,ariaChecked:mn,ariaColCount:Se,ariaColIndex:Se,ariaColSpan:Se,ariaControls:Ut,ariaCurrent:null,ariaDescribedBy:Ut,ariaDetails:null,ariaDisabled:mn,ariaDropEffect:Ut,ariaErrorMessage:null,ariaExpanded:mn,ariaFlowTo:Ut,ariaGrabbed:mn,ariaHasPopup:null,ariaHidden:mn,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Ut,ariaLevel:Se,ariaLive:null,ariaModal:mn,ariaMultiLine:mn,ariaMultiSelectable:mn,ariaOrientation:null,ariaOwns:Ut,ariaPlaceholder:null,ariaPosInSet:Se,ariaPressed:mn,ariaReadOnly:mn,ariaRelevant:null,ariaRequired:mn,ariaRoleDescription:Ut,ariaRowCount:Se,ariaRowIndex:Se,ariaRowSpan:Se,ariaSelected:mn,ariaSetSize:Se,ariaSort:null,ariaValueMax:Se,ariaValueMin:Se,ariaValueNow:Se,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function Gx(e,t){return t in e?e[t]:t}function Jx(e,t){return Gx(e,t.toLowerCase())}const pC=Ca({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:ga,acceptCharset:Ut,accessKey:Ut,action:null,allow:null,allowFullScreen:Ze,allowPaymentRequest:Ze,allowUserMedia:Ze,alt:null,as:null,async:Ze,autoCapitalize:null,autoComplete:Ut,autoFocus:Ze,autoPlay:Ze,blocking:Ut,capture:null,charSet:null,checked:Ze,cite:null,className:Ut,cols:Se,colSpan:null,content:null,contentEditable:mn,controls:Ze,controlsList:Ut,coords:Se|ga,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Ze,defer:Ze,dir:null,dirName:null,disabled:Ze,download:xd,draggable:mn,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Ze,formTarget:null,headers:Ut,height:Se,hidden:xd,high:Se,href:null,hrefLang:null,htmlFor:Ut,httpEquiv:Ut,id:null,imageSizes:null,imageSrcSet:null,inert:Ze,inputMode:null,integrity:null,is:null,isMap:Ze,itemId:null,itemProp:Ut,itemRef:Ut,itemScope:Ze,itemType:Ut,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Ze,low:Se,manifest:null,max:null,maxLength:Se,media:null,method:null,min:null,minLength:Se,multiple:Ze,muted:Ze,name:null,nonce:null,noModule:Ze,noValidate:Ze,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:Ze,optimum:Se,pattern:null,ping:Ut,placeholder:null,playsInline:Ze,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Ze,referrerPolicy:null,rel:Ut,required:Ze,reversed:Ze,rows:Se,rowSpan:Se,sandbox:Ut,scope:null,scoped:Ze,seamless:Ze,selected:Ze,shadowRootClonable:Ze,shadowRootDelegatesFocus:Ze,shadowRootMode:null,shape:null,size:Se,sizes:null,slot:null,span:Se,spellCheck:mn,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Se,step:null,style:null,tabIndex:Se,target:null,title:null,translate:null,type:null,typeMustMatch:Ze,useMap:null,value:mn,width:Se,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Ut,axis:null,background:null,bgColor:null,border:Se,borderColor:null,bottomMargin:Se,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Ze,declare:Ze,event:null,face:null,frame:null,frameBorder:null,hSpace:Se,leftMargin:Se,link:null,longDesc:null,lowSrc:null,marginHeight:Se,marginWidth:Se,noResize:Ze,noHref:Ze,noShade:Ze,noWrap:Ze,object:null,profile:null,prompt:null,rev:null,rightMargin:Se,rules:null,scheme:null,scrolling:mn,standby:null,summary:null,text:null,topMargin:Se,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Se,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Ze,disableRemotePlayback:Ze,prefix:null,property:null,results:Se,security:null,unselectable:null},space:"html",transform:Jx}),gC=Ca({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:rr,accentHeight:Se,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Se,amplitude:Se,arabicForm:null,ascent:Se,attributeName:null,attributeType:null,azimuth:Se,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Se,by:null,calcMode:null,capHeight:Se,className:Ut,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:Se,diffuseConstant:Se,direction:null,display:null,dur:null,divisor:Se,dominantBaseline:null,download:Ze,dx:null,dy:null,edgeMode:null,editable:null,elevation:Se,enableBackground:null,end:null,event:null,exponent:Se,externalResourcesRequired:null,fill:null,fillOpacity:Se,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:ga,g2:ga,glyphName:ga,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Se,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Se,horizOriginX:Se,horizOriginY:Se,id:null,ideographic:Se,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Se,k:Se,k1:Se,k2:Se,k3:Se,k4:Se,kernelMatrix:rr,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Se,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:Se,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:Se,overlineThickness:Se,paintOrder:null,panose1:null,path:null,pathLength:Se,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Ut,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Se,pointsAtY:Se,pointsAtZ:Se,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:rr,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:rr,rev:rr,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:rr,requiredFeatures:rr,requiredFonts:rr,requiredFormats:rr,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:Se,specularExponent:Se,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Se,strikethroughThickness:Se,string:null,stroke:null,strokeDashArray:rr,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Se,strokeOpacity:Se,strokeWidth:null,style:null,surfaceScale:Se,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:rr,tabIndex:Se,tableValues:null,target:null,targetX:Se,targetY:Se,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:rr,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Se,underlineThickness:Se,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Se,values:null,vAlphabetic:Se,vMathematical:Se,vectorEffect:null,vHanging:Se,vIdeographic:Se,version:null,vertAdvY:Se,vertOriginX:Se,vertOriginY:Se,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Se,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Gx}),Xx=Ca({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()}}),Kx=Ca({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Jx}),Qx=Ca({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),yC={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"},bC=/[A-Z]/g,rb=/-[a-z]/g,xC=/^data[-\w.:]+$/i;function vC(e,t){const r=bd(t);let s=t,l=Gn;if(r in e.normal)return e.property[e.normal[r]];if(r.length>4&&r.slice(0,4)==="data"&&xC.test(t)){if(t.charAt(4)==="-"){const u=t.slice(5).replace(rb,SC);s="data"+u.charAt(0).toUpperCase()+u.slice(1)}else{const u=t.slice(4);if(!rb.test(u)){let c=u.replace(bC,wC);c.charAt(0)!=="-"&&(c="-"+c),t="data"+c}}l=Jd}return new l(s,t)}function wC(e){return"-"+e.toLowerCase()}function SC(e){return e.charAt(1).toUpperCase()}const _C=Vx([Yx,pC,Xx,Kx,Qx],"html"),Xd=Vx([Yx,gC,Xx,Kx,Qx],"svg");function kC(e){return e.join(" ").trim()}var ia={},zh,ib;function EC(){if(ib)return zh;ib=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,r=/^\s*/,s=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,l=/^:\s*/,u=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,f=/^\s+|\s+$/g,d=`
94
- `,m="/",y="*",g="",x="comment",v="declaration";function S(D,T){if(typeof D!="string")throw new TypeError("First argument must be a string");if(!D)return[];T=T||{};var P=1,I=1;function W(le){var re=le.match(t);re&&(P+=re.length);var $=le.lastIndexOf(d);I=~$?le.length-$:I+le.length}function B(){var le={line:P,column:I};return function(re){return re.position=new R(le),V(),re}}function R(le){this.start=le,this.end={line:P,column:I},this.source=T.source}R.prototype.content=D;function Z(le){var re=new Error(T.source+":"+P+":"+I+": "+le);if(re.reason=le,re.filename=T.source,re.line=P,re.column=I,re.source=D,!T.silent)throw re}function F(le){var re=le.exec(D);if(re){var $=re[0];return W($),D=D.slice($.length),re}}function V(){F(r)}function L(le){var re;for(le=le||[];re=X();)re!==!1&&le.push(re);return le}function X(){var le=B();if(!(m!=D.charAt(0)||y!=D.charAt(1))){for(var re=2;g!=D.charAt(re)&&(y!=D.charAt(re)||m!=D.charAt(re+1));)++re;if(re+=2,g===D.charAt(re-1))return Z("End of comment missing");var $=D.slice(2,re-2);return I+=2,W($),D=D.slice(re),I+=2,le({type:x,comment:$})}}function G(){var le=B(),re=F(s);if(re){if(X(),!F(l))return Z("property missing ':'");var $=F(u),q=le({type:v,property:j(re[0].replace(e,g)),value:$?j($[0].replace(e,g)):g});return F(c),q}}function ue(){var le=[];L(le);for(var re;re=G();)re!==!1&&(le.push(re),L(le));return le}return V(),ue()}function j(D){return D?D.replace(f,g):g}return zh=S,zh}var sb;function CC(){if(sb)return ia;sb=1;var e=ia&&ia.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(ia,"__esModule",{value:!0}),ia.default=r;const t=e(EC());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(d=>{if(d.type!=="declaration")return;const{property:m,value:y}=d;f?l(m,y,d):y&&(u=u||{},u[m]=y)}),u}return ia}var wl={},ab;function AC(){if(ab)return wl;ab=1,Object.defineProperty(wl,"__esModule",{value:!0}),wl.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,r=/^[^-]+$/,s=/^-(webkit|moz|ms|o|khtml)-/,l=/^-(ms)-/,u=function(m){return!m||r.test(m)||e.test(m)},c=function(m,y){return y.toUpperCase()},f=function(m,y){return"".concat(y,"-")},d=function(m,y){return y===void 0&&(y={}),u(m)?m:(m=m.toLowerCase(),y.reactCompat?m=m.replace(l,f):m=m.replace(s,f),m.replace(t,c))};return wl.camelCase=d,wl}var Sl,lb;function jC(){if(lb)return Sl;lb=1;var e=Sl&&Sl.__importDefault||function(l){return l&&l.__esModule?l:{default:l}},t=e(CC()),r=AC();function s(l,u){var c={};return!l||typeof l!="string"||(0,t.default)(l,function(f,d){f&&d&&(c[(0,r.camelCase)(f,u)]=d)}),c}return s.default=s,Sl=s,Sl}var NC=jC();const TC=Gb(NC),Zx=Wx("end"),Kd=Wx("start");function Wx(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 OC(e){const t=Kd(e),r=Zx(e);if(t&&r)return{start:t,end:r}}function Ml(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?ob(e.position):"start"in e||"end"in e?ob(e):"line"in e||"column"in e?wd(e):""}function wd(e){return ub(e&&e.line)+":"+ub(e&&e.column)}function ob(e){return wd(e&&e.start)+"-"+wd(e&&e.end)}function ub(e){return e&&typeof e=="number"?e:1}class Nn 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 d=s.indexOf(":");d===-1?u.ruleId=s:(u.source=s.slice(0,d),u.ruleId=s.slice(d+1))}if(!u.place&&u.ancestors&&u.ancestors){const d=u.ancestors[u.ancestors.length-1];d&&(u.place=d.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=Ml(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}}Nn.prototype.file="";Nn.prototype.name="";Nn.prototype.reason="";Nn.prototype.message="";Nn.prototype.stack="";Nn.prototype.column=void 0;Nn.prototype.line=void 0;Nn.prototype.ancestors=void 0;Nn.prototype.cause=void 0;Nn.prototype.fatal=void 0;Nn.prototype.place=void 0;Nn.prototype.ruleId=void 0;Nn.prototype.source=void 0;const Qd={}.hasOwnProperty,RC=new Map,MC=/[A-Z]/g,DC=new Set(["table","tbody","thead","tfoot","tr"]),LC=new Set(["td","th"]),e1="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function zC(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=$C(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=FC(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"?Xd:_C,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},u=t1(l,e,void 0);return u&&typeof u!="string"?u:l.create(e,l.Fragment,{children:u||void 0},void 0)}function t1(e,t,r){if(t.type==="element")return UC(e,t,r);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return PC(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return HC(e,t,r);if(t.type==="mdxjsEsm")return BC(e,t);if(t.type==="root")return qC(e,t,r);if(t.type==="text")return IC(e,t)}function UC(e,t,r){const s=e.schema;let l=s;t.tagName.toLowerCase()==="svg"&&s.space==="html"&&(l=Xd,e.schema=l),e.ancestors.push(t);const u=r1(e,t.tagName,!1),c=VC(e,t);let f=Wd(e,t);return DC.has(t.tagName)&&(f=f.filter(function(d){return typeof d=="string"?!dC(d):!0})),n1(e,c,u,t),Zd(c,f),e.ancestors.pop(),e.schema=s,e.create(t,u,c,r)}function PC(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)}Il(e,t.position)}function BC(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Il(e,t.position)}function HC(e,t,r){const s=e.schema;let l=s;t.name==="svg"&&s.space==="html"&&(l=Xd,e.schema=l),e.ancestors.push(t);const u=t.name===null?e.Fragment:r1(e,t.name,!0),c=YC(e,t),f=Wd(e,t);return n1(e,c,u,t),Zd(c,f),e.ancestors.pop(),e.schema=s,e.create(t,u,c,r)}function qC(e,t,r){const s={};return Zd(s,Wd(e,t)),e.create(t,e.Fragment,s,r)}function IC(e,t){return t.value}function n1(e,t,r,s){typeof r!="string"&&r!==e.Fragment&&e.passNode&&(t.node=s)}function Zd(e,t){if(t.length>0){const r=t.length>1?t:t[0];r&&(e.children=r)}}function FC(e,t,r){return s;function s(l,u,c,f){const m=Array.isArray(c.children)?r:t;return f?m(u,c,f):m(u,c)}}function $C(e,t){return r;function r(s,l,u,c){const f=Array.isArray(u.children),d=Kd(s);return t(l,u,c,f,{columnNumber:d?d.column-1:void 0,fileName:e,lineNumber:d?d.line:void 0},void 0)}}function VC(e,t){const r={};let s,l;for(l in t.properties)if(l!=="children"&&Qd.call(t.properties,l)){const u=GC(e,l,t.properties[l]);if(u){const[c,f]=u;e.tableCellAlignToStyle&&c==="align"&&typeof f=="string"&&LC.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 YC(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 Il(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 Il(e,t.position);else u=s.value===null?!0:s.value;r[l]=u}return r}function Wd(e,t){const r=[];let s=-1;const l=e.passKeys?new Map:RC;for(;++s<t.children.length;){const u=t.children[s];let c;if(e.passKeys){const d=u.type==="element"?u.tagName:u.type==="mdxJsxFlowElement"||u.type==="mdxJsxTextElement"?u.name:void 0;if(d){const m=l.get(d)||0;c=d+"-"+m,l.set(d,m+1)}}const f=t1(e,u,c);f!==void 0&&r.push(f)}return r}function GC(e,t,r){const s=vC(e.schema,t);if(!(r==null||typeof r=="number"&&Number.isNaN(r))){if(Array.isArray(r)&&(r=s.commaSeparated?oC(r):kC(r)),s.property==="style"){let l=typeof r=="object"?r:JC(e,String(r));return e.stylePropertyNameCase==="css"&&(l=XC(l)),["style",l]}return[e.elementAttributeNameCase==="react"&&s.space?yC[s.property]||s.property:s.attribute,r]}}function JC(e,t){try{return TC(t,{reactCompat:!0})}catch(r){if(e.ignoreInvalidStyle)return{};const s=r,l=new Nn("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=e1+"#cannot-parse-style-attribute",l}}function r1(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=eb(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=eb(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(s.type==="Literal"){const l=s.value;return Qd.call(e.components,l)?e.components[l]:l}if(e.evaluater)return e.evaluater.evaluateExpression(s);Il(e)}function Il(e,t){const r=new Nn("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=e1+"#cannot-handle-mdx-estrees-without-createevaluater",r}function XC(e){const t={};let r;for(r in e)Qd.call(e,r)&&(t[KC(r)]=e[r]);return t}function KC(e){let t=e.replace(MC,QC);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function QC(e){return"-"+e.toLowerCase()}const Uh={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"]},ZC={};function em(e,t){const r=ZC,s=typeof r.includeImageAlt=="boolean"?r.includeImageAlt:!0,l=typeof r.includeHtml=="boolean"?r.includeHtml:!0;return i1(e,s,l)}function i1(e,t,r){if(WC(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 cb(e.children,t,r)}return Array.isArray(e)?cb(e,t,r):""}function cb(e,t,r){const s=[];let l=-1;for(;++l<e.length;)s[l]=i1(e[l],t,r);return s.join("")}function WC(e){return!!(e&&typeof e=="object")}const fb=document.createElement("i");function tm(e){const t="&"+e+";";fb.innerHTML=t;const r=fb.textContent;return r.charCodeAt(r.length-1)===59&&e!=="semi"||r===t?!1:r}function or(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 kr(e,t){return e.length>0?(or(e,e.length,0,t),e):t}const hb={}.hasOwnProperty;function s1(e){const t={};let r=-1;for(;++r<e.length;)eA(t,e[r]);return t}function eA(e,t){let r;for(r in t){const l=(hb.call(e,r)?e[r]:void 0)||(e[r]={}),u=t[r];let c;if(u)for(c in u){hb.call(l,c)||(l[c]=[]);const f=u[c];tA(l[c],Array.isArray(f)?f:f?[f]:[])}}}function tA(e,t){let r=-1;const s=[];for(;++r<t.length;)(t[r].add==="after"?e:s).push(t[r]);or(e,0,0,s)}function a1(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 Dr(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const zn=Qi(/[A-Za-z]/),jn=Qi(/[\dA-Za-z]/),nA=Qi(/[#-'*+\--9=?A-Z^-~]/);function Hu(e){return e!==null&&(e<32||e===127)}const Sd=Qi(/\d/),rA=Qi(/[\dA-Fa-f]/),iA=Qi(/[!-/:-@[-`{-~]/);function He(e){return e!==null&&e<-2}function Lt(e){return e!==null&&(e<0||e===32)}function at(e){return e===-2||e===-1||e===32}const Wu=Qi(new RegExp("\\p{P}|\\p{S}","u")),vs=Qi(/\s/);function Qi(e){return t;function t(r){return r!==null&&r>-1&&e.test(String.fromCharCode(r))}}function Aa(e){const t=[];let r=-1,s=0,l=0;for(;++r<e.length;){const u=e.charCodeAt(r);let c="";if(u===37&&jn(e.charCodeAt(r+1))&&jn(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 ht(e,t,r,s){const l=s?s-1:Number.POSITIVE_INFINITY;let u=0;return c;function c(d){return at(d)?(e.enter(r),f(d)):t(d)}function f(d){return at(d)&&u++<l?(e.consume(d),f):(e.exit(r),t(d))}}const sA={tokenize:aA};function aA(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"),ht(e,t,"linePrefix")}function l(f){return e.enter("paragraph"),u(f)}function u(f){const d=e.enter("chunkText",{contentType:"text",previous:r});return r&&(r.next=d),r=d,c(f)}function c(f){if(f===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(f);return}return He(f)?(e.consume(f),e.exit("chunkText"),u):(e.consume(f),c)}}const lA={tokenize:oA},db={tokenize:uA};function oA(e){const t=this,r=[];let s=0,l,u,c;return f;function f(I){if(s<r.length){const W=r[s];return t.containerState=W[1],e.attempt(W[0].continuation,d,m)(I)}return m(I)}function d(I){if(s++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,l&&P();const W=t.events.length;let B=W,R;for(;B--;)if(t.events[B][0]==="exit"&&t.events[B][1].type==="chunkFlow"){R=t.events[B][1].end;break}T(s);let Z=W;for(;Z<t.events.length;)t.events[Z][1].end={...R},Z++;return or(t.events,B+1,0,t.events.slice(W)),t.events.length=Z,m(I)}return f(I)}function m(I){if(s===r.length){if(!l)return x(I);if(l.currentConstruct&&l.currentConstruct.concrete)return S(I);t.interrupt=!!(l.currentConstruct&&!l._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(db,y,g)(I)}function y(I){return l&&P(),T(s),x(I)}function g(I){return t.parser.lazy[t.now().line]=s!==r.length,c=t.now().offset,S(I)}function x(I){return t.containerState={},e.attempt(db,v,S)(I)}function v(I){return s++,r.push([t.currentConstruct,t.containerState]),x(I)}function S(I){if(I===null){l&&P(),T(0),e.consume(I);return}return l=l||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:l,contentType:"flow",previous:u}),j(I)}function j(I){if(I===null){D(e.exit("chunkFlow"),!0),T(0),e.consume(I);return}return He(I)?(e.consume(I),D(e.exit("chunkFlow")),s=0,t.interrupt=void 0,f):(e.consume(I),j)}function D(I,W){const B=t.sliceStream(I);if(W&&B.push(null),I.previous=u,u&&(u.next=I),u=I,l.defineSkip(I.start),l.write(B),t.parser.lazy[I.start.line]){let R=l.events.length;for(;R--;)if(l.events[R][1].start.offset<c&&(!l.events[R][1].end||l.events[R][1].end.offset>c))return;const Z=t.events.length;let F=Z,V,L;for(;F--;)if(t.events[F][0]==="exit"&&t.events[F][1].type==="chunkFlow"){if(V){L=t.events[F][1].end;break}V=!0}for(T(s),R=Z;R<t.events.length;)t.events[R][1].end={...L},R++;or(t.events,F+1,0,t.events.slice(Z)),t.events.length=R}}function T(I){let W=r.length;for(;W-- >I;){const B=r[W];t.containerState=B[1],B[0].exit.call(t,e)}r.length=I}function P(){l.write([null]),u=void 0,l=void 0,t.containerState._closeFlow=void 0}}function uA(e,t,r){return ht(e,e.attempt(this.parser.constructs.document,t,r),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function wa(e){if(e===null||Lt(e)||vs(e))return 1;if(Wu(e))return 2}function ec(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 _d={name:"attention",resolveAll:cA,tokenize:fA};function cA(e,t){let r=-1,s,l,u,c,f,d,m,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;d=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};mb(g,-d),mb(x,d),c={type:d>1?"strongSequence":"emphasisSequence",start:g,end:{...e[s][1].end}},f={type:d>1?"strongSequence":"emphasisSequence",start:{...e[r][1].start},end:x},u={type:d>1?"strongText":"emphasisText",start:{...e[s][1].end},end:{...e[r][1].start}},l={type:d>1?"strong":"emphasis",start:{...c.start},end:{...f.end}},e[s][1].end={...c.start},e[r][1].start={...f.end},m=[],e[s][1].end.offset-e[s][1].start.offset&&(m=kr(m,[["enter",e[s][1],t],["exit",e[s][1],t]])),m=kr(m,[["enter",l,t],["enter",c,t],["exit",c,t],["enter",u,t]]),m=kr(m,ec(t.parser.constructs.insideSpan.null,e.slice(s+1,r),t)),m=kr(m,[["exit",u,t],["enter",f,t],["exit",f,t],["exit",l,t]]),e[r][1].end.offset-e[r][1].start.offset?(y=2,m=kr(m,[["enter",e[r][1],t],["exit",e[r][1],t]])):y=0,or(e,s-1,r-s+3,m),r=s+m.length-y-2;break}}for(r=-1;++r<e.length;)e[r][1].type==="attentionSequence"&&(e[r][1].type="data");return e}function fA(e,t){const r=this.parser.constructs.attentionMarkers.null,s=this.previous,l=wa(s);let u;return c;function c(d){return u=d,e.enter("attentionSequence"),f(d)}function f(d){if(d===u)return e.consume(d),f;const m=e.exit("attentionSequence"),y=wa(d),g=!y||y===2&&l||r.includes(d),x=!l||l===2&&y||r.includes(s);return m._open=!!(u===42?g:g&&(l||!x)),m._close=!!(u===42?x:x&&(y||!g)),t(d)}}function mb(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const hA={name:"autolink",tokenize:dA};function dA(e,t,r){let s=0;return l;function l(v){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(v),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),u}function u(v){return zn(v)?(e.consume(v),c):v===64?r(v):m(v)}function c(v){return v===43||v===45||v===46||jn(v)?(s=1,f(v)):m(v)}function f(v){return v===58?(e.consume(v),s=0,d):(v===43||v===45||v===46||jn(v))&&s++<32?(e.consume(v),f):(s=0,m(v))}function d(v){return v===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(v),e.exit("autolinkMarker"),e.exit("autolink"),t):v===null||v===32||v===60||Hu(v)?r(v):(e.consume(v),d)}function m(v){return v===64?(e.consume(v),y):nA(v)?(e.consume(v),m):r(v)}function y(v){return jn(v)?g(v):r(v)}function g(v){return v===46?(e.consume(v),s=0,y):v===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(v),e.exit("autolinkMarker"),e.exit("autolink"),t):x(v)}function x(v){if((v===45||jn(v))&&s++<63){const S=v===45?x:g;return e.consume(v),S}return r(v)}}const Xl={partial:!0,tokenize:mA};function mA(e,t,r){return s;function s(u){return at(u)?ht(e,l,"linePrefix")(u):l(u)}function l(u){return u===null||He(u)?t(u):r(u)}}const l1={continuation:{tokenize:gA},exit:yA,name:"blockQuote",tokenize:pA};function pA(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 at(c)?(e.enter("blockQuotePrefixWhitespace"),e.consume(c),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(c))}}function gA(e,t,r){const s=this;return l;function l(c){return at(c)?ht(e,u,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(c):u(c)}function u(c){return e.attempt(l1,t,r)(c)}}function yA(e){e.exit("blockQuote")}const o1={name:"characterEscape",tokenize:bA};function bA(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 iA(u)?(e.enter("characterEscapeValue"),e.consume(u),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):r(u)}}const u1={name:"characterReference",tokenize:xA};function xA(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"),d}function d(g){return g===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(g),e.exit("characterReferenceMarkerNumeric"),m):(e.enter("characterReferenceValue"),u=31,c=jn,y(g))}function m(g){return g===88||g===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(g),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),u=6,c=rA,y):(e.enter("characterReferenceValue"),u=7,c=Sd,y(g))}function y(g){if(g===59&&l){const x=e.exit("characterReferenceValue");return c===jn&&!tm(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 pb={partial:!0,tokenize:wA},gb={concrete:!0,name:"codeFenced",tokenize:vA};function vA(e,t,r){const s=this,l={partial:!0,tokenize:B};let u=0,c=0,f;return d;function d(R){return m(R)}function m(R){const Z=s.events[s.events.length-1];return u=Z&&Z[1].type==="linePrefix"?Z[2].sliceSerialize(Z[1],!0).length:0,f=R,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),y(R)}function y(R){return R===f?(c++,e.consume(R),y):c<3?r(R):(e.exit("codeFencedFenceSequence"),at(R)?ht(e,g,"whitespace")(R):g(R))}function g(R){return R===null||He(R)?(e.exit("codeFencedFence"),s.interrupt?t(R):e.check(pb,j,W)(R)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),x(R))}function x(R){return R===null||He(R)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),g(R)):at(R)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),ht(e,v,"whitespace")(R)):R===96&&R===f?r(R):(e.consume(R),x)}function v(R){return R===null||He(R)?g(R):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),S(R))}function S(R){return R===null||He(R)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),g(R)):R===96&&R===f?r(R):(e.consume(R),S)}function j(R){return e.attempt(l,W,D)(R)}function D(R){return e.enter("lineEnding"),e.consume(R),e.exit("lineEnding"),T}function T(R){return u>0&&at(R)?ht(e,P,"linePrefix",u+1)(R):P(R)}function P(R){return R===null||He(R)?e.check(pb,j,W)(R):(e.enter("codeFlowValue"),I(R))}function I(R){return R===null||He(R)?(e.exit("codeFlowValue"),P(R)):(e.consume(R),I)}function W(R){return e.exit("codeFenced"),t(R)}function B(R,Z,F){let V=0;return L;function L(re){return R.enter("lineEnding"),R.consume(re),R.exit("lineEnding"),X}function X(re){return R.enter("codeFencedFence"),at(re)?ht(R,G,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(re):G(re)}function G(re){return re===f?(R.enter("codeFencedFenceSequence"),ue(re)):F(re)}function ue(re){return re===f?(V++,R.consume(re),ue):V>=c?(R.exit("codeFencedFenceSequence"),at(re)?ht(R,le,"whitespace")(re):le(re)):F(re)}function le(re){return re===null||He(re)?(R.exit("codeFencedFence"),Z(re)):F(re)}}}function wA(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 Ph={name:"codeIndented",tokenize:_A},SA={partial:!0,tokenize:kA};function _A(e,t,r){const s=this;return l;function l(m){return e.enter("codeIndented"),ht(e,u,"linePrefix",5)(m)}function u(m){const y=s.events[s.events.length-1];return y&&y[1].type==="linePrefix"&&y[2].sliceSerialize(y[1],!0).length>=4?c(m):r(m)}function c(m){return m===null?d(m):He(m)?e.attempt(SA,c,d)(m):(e.enter("codeFlowValue"),f(m))}function f(m){return m===null||He(m)?(e.exit("codeFlowValue"),c(m)):(e.consume(m),f)}function d(m){return e.exit("codeIndented"),t(m)}}function kA(e,t,r){const s=this;return l;function l(c){return s.parser.lazy[s.now().line]?r(c):He(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),l):ht(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):He(c)?l(c):r(c)}}const EA={name:"codeText",previous:AA,resolve:CA,tokenize:jA};function CA(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 AA(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function jA(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"),d(g))}function d(g){return g===null?r(g):g===32?(e.enter("space"),e.consume(g),e.exit("space"),d):g===96?(u=e.enter("codeTextSequence"),l=0,y(g)):He(g)?(e.enter("lineEnding"),e.consume(g),e.exit("lineEnding"),d):(e.enter("codeTextData"),m(g))}function m(g){return g===null||g===32||g===96||He(g)?(e.exit("codeTextData"),d(g)):(e.consume(g),m)}function y(g){return g===96?(e.consume(g),l++,y):l===s?(e.exit("codeTextSequence"),e.exit("codeText"),t(g)):(u.type="codeTextData",m(g))}}class NA{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&&_l(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),_l(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),_l(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);_l(this.right,r.reverse())}else{const r=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);_l(this.left,r.reverse())}}}function _l(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 c1(e){const t={};let r=-1,s,l,u,c,f,d,m;const y=new NA(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"&&(d=s[1]._tokenizer.events,u=0,u<d.length&&d[u][1].type==="lineEndingBlank"&&(u+=2),u<d.length&&d[u][1].type==="content"))for(;++u<d.length&&d[u][1].type!=="content";)d[u][1].type==="chunkText"&&(d[u][1]._isInFirstContentOfListItem=!0,u++);if(s[0]==="enter")s[1].contentType&&(Object.assign(t,TA(y,r)),r=t[r],m=!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 or(e,0,Number.POSITIVE_INFINITY,y.slice(0)),!m}function TA(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,d=[],m={};let y,g,x=-1,v=r,S=0,j=0;const D=[j];for(;v;){for(;e.get(++l)[1]!==v;);u.push(l),v._tokenizer||(y=s.sliceStream(v),v.next||y.push(null),g&&c.defineSkip(v.start),v._isInFirstContentOfListItem&&(c._gfmTasklistFirstContentOfListItem=!0),c.write(y),v._isInFirstContentOfListItem&&(c._gfmTasklistFirstContentOfListItem=void 0)),g=v,v=v.next}for(v=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&&(j=x+1,D.push(j),v._tokenizer=void 0,v.previous=void 0,v=v.next);for(c.events=[],v?(v._tokenizer=void 0,v.previous=void 0):D.pop(),x=D.length;x--;){const T=f.slice(D[x],D[x+1]),P=u.pop();d.push([P,P+T.length-1]),e.splice(P,2,T)}for(d.reverse(),x=-1;++x<d.length;)m[S+d[x][0]]=S+d[x][1],S+=d[x][1]-d[x][0]-1;return m}const OA={resolve:MA,tokenize:DA},RA={partial:!0,tokenize:LA};function MA(e){return c1(e),e}function DA(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):He(f)?e.check(RA,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 LA(e,t,r){const s=this;return l;function l(c){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),ht(e,u,"linePrefix")}function u(c){if(c===null||He(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 f1(e,t,r,s,l,u,c,f,d){const m=d||Number.POSITIVE_INFINITY;let y=0;return g;function g(T){return T===60?(e.enter(s),e.enter(l),e.enter(u),e.consume(T),e.exit(u),x):T===null||T===32||T===41||Hu(T)?r(T):(e.enter(s),e.enter(c),e.enter(f),e.enter("chunkString",{contentType:"string"}),j(T))}function x(T){return T===62?(e.enter(u),e.consume(T),e.exit(u),e.exit(l),e.exit(s),t):(e.enter(f),e.enter("chunkString",{contentType:"string"}),v(T))}function v(T){return T===62?(e.exit("chunkString"),e.exit(f),x(T)):T===null||T===60||He(T)?r(T):(e.consume(T),T===92?S:v)}function S(T){return T===60||T===62||T===92?(e.consume(T),v):v(T)}function j(T){return!y&&(T===null||T===41||Lt(T))?(e.exit("chunkString"),e.exit(f),e.exit(c),e.exit(s),t(T)):y<m&&T===40?(e.consume(T),y++,j):T===41?(e.consume(T),y--,j):T===null||T===32||T===40||Hu(T)?r(T):(e.consume(T),T===92?D:j)}function D(T){return T===40||T===41||T===92?(e.consume(T),j):j(T)}}function h1(e,t,r,s,l,u){const c=this;let f=0,d;return m;function m(v){return e.enter(s),e.enter(l),e.consume(v),e.exit(l),e.enter(u),y}function y(v){return f>999||v===null||v===91||v===93&&!d||v===94&&!f&&"_hiddenFootnoteSupport"in c.parser.constructs?r(v):v===93?(e.exit(u),e.enter(l),e.consume(v),e.exit(l),e.exit(s),t):He(v)?(e.enter("lineEnding"),e.consume(v),e.exit("lineEnding"),y):(e.enter("chunkString",{contentType:"string"}),g(v))}function g(v){return v===null||v===91||v===93||He(v)||f++>999?(e.exit("chunkString"),y(v)):(e.consume(v),d||(d=!at(v)),v===92?x:g)}function x(v){return v===91||v===92||v===93?(e.consume(v),f++,g):g(v)}}function d1(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,d):r(x)}function d(x){return x===c?(e.enter(l),e.consume(x),e.exit(l),e.exit(s),t):(e.enter(u),m(x))}function m(x){return x===c?(e.exit(u),d(c)):x===null?r(x):He(x)?(e.enter("lineEnding"),e.consume(x),e.exit("lineEnding"),ht(e,m,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),y(x))}function y(x){return x===c||x===null||He(x)?(e.exit("chunkString"),m(x)):(e.consume(x),x===92?g:y)}function g(x){return x===c||x===92?(e.consume(x),y):y(x)}}function Dl(e,t){let r;return s;function s(l){return He(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),r=!0,s):at(l)?ht(e,s,r?"linePrefix":"lineSuffix")(l):t(l)}}const zA={name:"definition",tokenize:PA},UA={partial:!0,tokenize:BA};function PA(e,t,r){const s=this;let l;return u;function u(v){return e.enter("definition"),c(v)}function c(v){return h1.call(s,e,f,r,"definitionLabel","definitionLabelMarker","definitionLabelString")(v)}function f(v){return l=Dr(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)),v===58?(e.enter("definitionMarker"),e.consume(v),e.exit("definitionMarker"),d):r(v)}function d(v){return Lt(v)?Dl(e,m)(v):m(v)}function m(v){return f1(e,y,r,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(v)}function y(v){return e.attempt(UA,g,g)(v)}function g(v){return at(v)?ht(e,x,"whitespace")(v):x(v)}function x(v){return v===null||He(v)?(e.exit("definition"),s.parser.defined.push(l),t(v)):r(v)}}function BA(e,t,r){return s;function s(f){return Lt(f)?Dl(e,l)(f):r(f)}function l(f){return d1(e,u,r,"definitionTitle","definitionTitleMarker","definitionTitleString")(f)}function u(f){return at(f)?ht(e,c,"whitespace")(f):c(f)}function c(f){return f===null||He(f)?t(f):r(f)}}const HA={name:"hardBreakEscape",tokenize:qA};function qA(e,t,r){return s;function s(u){return e.enter("hardBreakEscape"),e.consume(u),l}function l(u){return He(u)?(e.exit("hardBreakEscape"),t(u)):r(u)}}const IA={name:"headingAtx",resolve:FA,tokenize:$A};function FA(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"},or(e,s,r-s+1,[["enter",l,t],["enter",u,t],["exit",u,t],["exit",l,t]])),e}function $A(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||Lt(y)?(e.exit("atxHeadingSequence"),f(y)):r(y)}function f(y){return y===35?(e.enter("atxHeadingSequence"),d(y)):y===null||He(y)?(e.exit("atxHeading"),t(y)):at(y)?ht(e,f,"whitespace")(y):(e.enter("atxHeadingText"),m(y))}function d(y){return y===35?(e.consume(y),d):(e.exit("atxHeadingSequence"),f(y))}function m(y){return y===null||y===35||Lt(y)?(e.exit("atxHeadingText"),f(y)):(e.consume(y),m)}}const VA=["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"],yb=["pre","script","style","textarea"],YA={concrete:!0,name:"htmlFlow",resolveTo:XA,tokenize:KA},GA={partial:!0,tokenize:ZA},JA={partial:!0,tokenize:QA};function XA(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 KA(e,t,r){const s=this;let l,u,c,f,d;return m;function m(_){return y(_)}function y(_){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(_),g}function g(_){return _===33?(e.consume(_),x):_===47?(e.consume(_),u=!0,j):_===63?(e.consume(_),l=3,s.interrupt?t:M):zn(_)?(e.consume(_),c=String.fromCharCode(_),D):r(_)}function x(_){return _===45?(e.consume(_),l=2,v):_===91?(e.consume(_),l=5,f=0,S):zn(_)?(e.consume(_),l=4,s.interrupt?t:M):r(_)}function v(_){return _===45?(e.consume(_),s.interrupt?t:M):r(_)}function S(_){const ge="CDATA[";return _===ge.charCodeAt(f++)?(e.consume(_),f===ge.length?s.interrupt?t:G:S):r(_)}function j(_){return zn(_)?(e.consume(_),c=String.fromCharCode(_),D):r(_)}function D(_){if(_===null||_===47||_===62||Lt(_)){const ge=_===47,Ce=c.toLowerCase();return!ge&&!u&&yb.includes(Ce)?(l=1,s.interrupt?t(_):G(_)):VA.includes(c.toLowerCase())?(l=6,ge?(e.consume(_),T):s.interrupt?t(_):G(_)):(l=7,s.interrupt&&!s.parser.lazy[s.now().line]?r(_):u?P(_):I(_))}return _===45||jn(_)?(e.consume(_),c+=String.fromCharCode(_),D):r(_)}function T(_){return _===62?(e.consume(_),s.interrupt?t:G):r(_)}function P(_){return at(_)?(e.consume(_),P):L(_)}function I(_){return _===47?(e.consume(_),L):_===58||_===95||zn(_)?(e.consume(_),W):at(_)?(e.consume(_),I):L(_)}function W(_){return _===45||_===46||_===58||_===95||jn(_)?(e.consume(_),W):B(_)}function B(_){return _===61?(e.consume(_),R):at(_)?(e.consume(_),B):I(_)}function R(_){return _===null||_===60||_===61||_===62||_===96?r(_):_===34||_===39?(e.consume(_),d=_,Z):at(_)?(e.consume(_),R):F(_)}function Z(_){return _===d?(e.consume(_),d=null,V):_===null||He(_)?r(_):(e.consume(_),Z)}function F(_){return _===null||_===34||_===39||_===47||_===60||_===61||_===62||_===96||Lt(_)?B(_):(e.consume(_),F)}function V(_){return _===47||_===62||at(_)?I(_):r(_)}function L(_){return _===62?(e.consume(_),X):r(_)}function X(_){return _===null||He(_)?G(_):at(_)?(e.consume(_),X):r(_)}function G(_){return _===45&&l===2?(e.consume(_),$):_===60&&l===1?(e.consume(_),q):_===62&&l===4?(e.consume(_),U):_===63&&l===3?(e.consume(_),M):_===93&&l===5?(e.consume(_),be):He(_)&&(l===6||l===7)?(e.exit("htmlFlowData"),e.check(GA,ee,ue)(_)):_===null||He(_)?(e.exit("htmlFlowData"),ue(_)):(e.consume(_),G)}function ue(_){return e.check(JA,le,ee)(_)}function le(_){return e.enter("lineEnding"),e.consume(_),e.exit("lineEnding"),re}function re(_){return _===null||He(_)?ue(_):(e.enter("htmlFlowData"),G(_))}function $(_){return _===45?(e.consume(_),M):G(_)}function q(_){return _===47?(e.consume(_),c="",ae):G(_)}function ae(_){if(_===62){const ge=c.toLowerCase();return yb.includes(ge)?(e.consume(_),U):G(_)}return zn(_)&&c.length<8?(e.consume(_),c+=String.fromCharCode(_),ae):G(_)}function be(_){return _===93?(e.consume(_),M):G(_)}function M(_){return _===62?(e.consume(_),U):_===45&&l===2?(e.consume(_),M):G(_)}function U(_){return _===null||He(_)?(e.exit("htmlFlowData"),ee(_)):(e.consume(_),U)}function ee(_){return e.exit("htmlFlow"),t(_)}}function QA(e,t,r){const s=this;return l;function l(c){return He(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 ZA(e,t,r){return s;function s(l){return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),e.attempt(Xl,t,r)}}const WA={name:"htmlText",tokenize:ej};function ej(e,t,r){const s=this;let l,u,c;return f;function f(M){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(M),d}function d(M){return M===33?(e.consume(M),m):M===47?(e.consume(M),B):M===63?(e.consume(M),I):zn(M)?(e.consume(M),F):r(M)}function m(M){return M===45?(e.consume(M),y):M===91?(e.consume(M),u=0,S):zn(M)?(e.consume(M),P):r(M)}function y(M){return M===45?(e.consume(M),v):r(M)}function g(M){return M===null?r(M):M===45?(e.consume(M),x):He(M)?(c=g,q(M)):(e.consume(M),g)}function x(M){return M===45?(e.consume(M),v):g(M)}function v(M){return M===62?$(M):M===45?x(M):g(M)}function S(M){const U="CDATA[";return M===U.charCodeAt(u++)?(e.consume(M),u===U.length?j:S):r(M)}function j(M){return M===null?r(M):M===93?(e.consume(M),D):He(M)?(c=j,q(M)):(e.consume(M),j)}function D(M){return M===93?(e.consume(M),T):j(M)}function T(M){return M===62?$(M):M===93?(e.consume(M),T):j(M)}function P(M){return M===null||M===62?$(M):He(M)?(c=P,q(M)):(e.consume(M),P)}function I(M){return M===null?r(M):M===63?(e.consume(M),W):He(M)?(c=I,q(M)):(e.consume(M),I)}function W(M){return M===62?$(M):I(M)}function B(M){return zn(M)?(e.consume(M),R):r(M)}function R(M){return M===45||jn(M)?(e.consume(M),R):Z(M)}function Z(M){return He(M)?(c=Z,q(M)):at(M)?(e.consume(M),Z):$(M)}function F(M){return M===45||jn(M)?(e.consume(M),F):M===47||M===62||Lt(M)?V(M):r(M)}function V(M){return M===47?(e.consume(M),$):M===58||M===95||zn(M)?(e.consume(M),L):He(M)?(c=V,q(M)):at(M)?(e.consume(M),V):$(M)}function L(M){return M===45||M===46||M===58||M===95||jn(M)?(e.consume(M),L):X(M)}function X(M){return M===61?(e.consume(M),G):He(M)?(c=X,q(M)):at(M)?(e.consume(M),X):V(M)}function G(M){return M===null||M===60||M===61||M===62||M===96?r(M):M===34||M===39?(e.consume(M),l=M,ue):He(M)?(c=G,q(M)):at(M)?(e.consume(M),G):(e.consume(M),le)}function ue(M){return M===l?(e.consume(M),l=void 0,re):M===null?r(M):He(M)?(c=ue,q(M)):(e.consume(M),ue)}function le(M){return M===null||M===34||M===39||M===60||M===61||M===96?r(M):M===47||M===62||Lt(M)?V(M):(e.consume(M),le)}function re(M){return M===47||M===62||Lt(M)?V(M):r(M)}function $(M){return M===62?(e.consume(M),e.exit("htmlTextData"),e.exit("htmlText"),t):r(M)}function q(M){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(M),e.exit("lineEnding"),ae}function ae(M){return at(M)?ht(e,be,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(M):be(M)}function be(M){return e.enter("htmlTextData"),c(M)}}const nm={name:"labelEnd",resolveAll:ij,resolveTo:sj,tokenize:aj},tj={tokenize:lj},nj={tokenize:oj},rj={tokenize:uj};function ij(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&&or(e,0,e.length,r),e}function sj(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 d={type:e[u][1].type==="labelLink"?"link":"image",start:{...e[u][1].start},end:{...e[e.length-1][1].end}},m={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",d,t],["enter",m,t]],f=kr(f,e.slice(u+1,u+s+3)),f=kr(f,[["enter",y,t]]),f=kr(f,ec(t.parser.constructs.insideSpan.null,e.slice(u+s+4,c-3),t)),f=kr(f,[["exit",y,t],e[c-2],e[c-1],["exit",m,t]]),f=kr(f,e.slice(c+1)),f=kr(f,[["exit",d,t]]),or(e,u,e.length,f),e}function aj(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(Dr(s.sliceSerialize({start:u.end,end:s.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(x),e.exit("labelMarker"),e.exit("labelEnd"),d):r(x)}function d(x){return x===40?e.attempt(tj,y,c?y:g)(x):x===91?e.attempt(nj,y,c?m:g)(x):c?y(x):g(x)}function m(x){return e.attempt(rj,y,g)(x)}function y(x){return t(x)}function g(x){return u._balanced=!0,r(x)}}function lj(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 Lt(g)?Dl(e,u)(g):u(g)}function u(g){return g===41?y(g):f1(e,c,f,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(g)}function c(g){return Lt(g)?Dl(e,d)(g):y(g)}function f(g){return r(g)}function d(g){return g===34||g===39||g===40?d1(e,m,r,"resourceTitle","resourceTitleMarker","resourceTitleString")(g):y(g)}function m(g){return Lt(g)?Dl(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 oj(e,t,r){const s=this;return l;function l(f){return h1.call(s,e,u,c,"reference","referenceMarker","referenceString")(f)}function u(f){return s.parser.defined.includes(Dr(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)))?t(f):r(f)}function c(f){return r(f)}}function uj(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 cj={name:"labelStartImage",resolveAll:nm.resolveAll,tokenize:fj};function fj(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 hj={name:"labelStartLink",resolveAll:nm.resolveAll,tokenize:dj};function dj(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 Bh={name:"lineEnding",tokenize:mj};function mj(e,t){return r;function r(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),ht(e,t,"linePrefix")}}const Au={name:"thematicBreak",tokenize:pj};function pj(e,t,r){let s=0,l;return u;function u(m){return e.enter("thematicBreak"),c(m)}function c(m){return l=m,f(m)}function f(m){return m===l?(e.enter("thematicBreakSequence"),d(m)):s>=3&&(m===null||He(m))?(e.exit("thematicBreak"),t(m)):r(m)}function d(m){return m===l?(e.consume(m),s++,d):(e.exit("thematicBreakSequence"),at(m)?ht(e,f,"whitespace")(m):f(m))}}const Yn={continuation:{tokenize:xj},exit:wj,name:"list",tokenize:bj},gj={partial:!0,tokenize:Sj},yj={partial:!0,tokenize:vj};function bj(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(v){const S=s.containerState.type||(v===42||v===43||v===45?"listUnordered":"listOrdered");if(S==="listUnordered"?!s.containerState.marker||v===s.containerState.marker:Sd(v)){if(s.containerState.type||(s.containerState.type=S,e.enter(S,{_container:!0})),S==="listUnordered")return e.enter("listItemPrefix"),v===42||v===45?e.check(Au,r,m)(v):m(v);if(!s.interrupt||v===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),d(v)}return r(v)}function d(v){return Sd(v)&&++c<10?(e.consume(v),d):(!s.interrupt||c<2)&&(s.containerState.marker?v===s.containerState.marker:v===41||v===46)?(e.exit("listItemValue"),m(v)):r(v)}function m(v){return e.enter("listItemMarker"),e.consume(v),e.exit("listItemMarker"),s.containerState.marker=s.containerState.marker||v,e.check(Xl,s.interrupt?r:y,e.attempt(gj,x,g))}function y(v){return s.containerState.initialBlankLine=!0,u++,x(v)}function g(v){return at(v)?(e.enter("listItemPrefixWhitespace"),e.consume(v),e.exit("listItemPrefixWhitespace"),x):r(v)}function x(v){return s.containerState.size=u+s.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(v)}}function xj(e,t,r){const s=this;return s.containerState._closeFlow=void 0,e.check(Xl,l,u);function l(f){return s.containerState.furtherBlankLines=s.containerState.furtherBlankLines||s.containerState.initialBlankLine,ht(e,t,"listItemIndent",s.containerState.size+1)(f)}function u(f){return s.containerState.furtherBlankLines||!at(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(yj,t,c)(f))}function c(f){return s.containerState._closeFlow=!0,s.interrupt=void 0,ht(e,e.attempt(Yn,t,r),"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(f)}}function vj(e,t,r){const s=this;return ht(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 wj(e){e.exit(this.containerState.type)}function Sj(e,t,r){const s=this;return ht(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!at(u)&&c&&c[1].type==="listItemPrefixWhitespace"?t(u):r(u)}}const bb={name:"setextUnderline",resolveTo:_j,tokenize:kj};function _j(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 kj(e,t,r){const s=this;let l;return u;function u(m){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=m,c(m)):r(m)}function c(m){return e.enter("setextHeadingLineSequence"),f(m)}function f(m){return m===l?(e.consume(m),f):(e.exit("setextHeadingLineSequence"),at(m)?ht(e,d,"lineSuffix")(m):d(m))}function d(m){return m===null||He(m)?(e.exit("setextHeadingLine"),t(m)):r(m)}}const Ej={tokenize:Cj};function Cj(e){const t=this,r=e.attempt(Xl,s,e.attempt(this.parser.constructs.flowInitial,l,ht(e,e.attempt(this.parser.constructs.flow,l,e.attempt(OA,l)),"linePrefix")));return r;function s(u){if(u===null){e.consume(u);return}return e.enter("lineEndingBlank"),e.consume(u),e.exit("lineEndingBlank"),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 Aj={resolveAll:p1()},jj=m1("string"),Nj=m1("text");function m1(e){return{resolveAll:p1(e==="text"?Tj: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 m(y)?u(y):f(y)}function f(y){if(y===null){r.consume(y);return}return r.enter("data"),r.consume(y),d}function d(y){return m(y)?(r.exit("data"),u(y)):(r.consume(y),d)}function m(y){if(y===null)return!0;const g=l[y];let x=-1;if(g)for(;++x<g.length;){const v=g[x];if(!v.previous||v.previous.call(s,s.previous))return!0}return!1}}}function p1(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 Tj(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,d;for(;u--;){const m=l[u];if(typeof m=="string"){for(c=m.length;m.charCodeAt(c-1)===32;)f++,c--;if(c)break;c=-1}else if(m===-2)d=!0,f++;else if(m!==-1){u++;break}}if(t._contentTypeTextTrailing&&r===e.length&&(f=0),f){const m={type:r===e.length||d||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={...m.start},s.start.offset===s.end.offset?Object.assign(s,m):(e.splice(r,0,["enter",m,t],["exit",m,t]),r+=2)}r++}return e}const Oj={42:Yn,43:Yn,45:Yn,48:Yn,49:Yn,50:Yn,51:Yn,52:Yn,53:Yn,54:Yn,55:Yn,56:Yn,57:Yn,62:l1},Rj={91:zA},Mj={[-2]:Ph,[-1]:Ph,32:Ph},Dj={35:IA,42:Au,45:[bb,Au],60:YA,61:bb,95:Au,96:gb,126:gb},Lj={38:u1,92:o1},zj={[-5]:Bh,[-4]:Bh,[-3]:Bh,33:cj,38:u1,42:_d,60:[hA,WA],91:hj,92:[HA,o1],93:nm,95:_d,96:EA},Uj={null:[_d,Aj]},Pj={null:[42,95]},Bj={null:[]},Hj=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:Pj,contentInitial:Rj,disable:Bj,document:Oj,flow:Dj,flowInitial:Mj,insideSpan:Uj,string:Lj,text:zj},Symbol.toStringTag,{value:"Module"}));function qj(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 d={attempt:Z(B),check:Z(R),consume:P,enter:I,exit:W,interrupt:Z(R,{interrupt:!0})},m={code:null,containerState:{},defineSkip:j,events:[],now:S,parser:e,previous:null,sliceSerialize:x,sliceStream:v,write:g};let y=t.tokenize.call(m,d);return t.resolveAll&&u.push(t),m;function g(X){return c=kr(c,X),D(),c[c.length-1]!==null?[]:(F(t,0),m.events=ec(u,m.events,m),m.events)}function x(X,G){return Fj(v(X),G)}function v(X){return Ij(c,X)}function S(){const{_bufferIndex:X,_index:G,line:ue,column:le,offset:re}=s;return{_bufferIndex:X,_index:G,line:ue,column:le,offset:re}}function j(X){l[X.line]=X.column,L()}function D(){let X;for(;s._index<c.length;){const G=c[s._index];if(typeof G=="string")for(X=s._index,s._bufferIndex<0&&(s._bufferIndex=0);s._index===X&&s._bufferIndex<G.length;)T(G.charCodeAt(s._bufferIndex));else T(G)}}function T(X){y=y(X)}function P(X){He(X)?(s.line++,s.column=1,s.offset+=X===-3?2:1,L()):X!==-1&&(s.column++,s.offset++),s._bufferIndex<0?s._index++:(s._bufferIndex++,s._bufferIndex===c[s._index].length&&(s._bufferIndex=-1,s._index++)),m.previous=X}function I(X,G){const ue=G||{};return ue.type=X,ue.start=S(),m.events.push(["enter",ue,m]),f.push(ue),ue}function W(X){const G=f.pop();return G.end=S(),m.events.push(["exit",G,m]),G}function B(X,G){F(X,G.from)}function R(X,G){G.restore()}function Z(X,G){return ue;function ue(le,re,$){let q,ae,be,M;return Array.isArray(le)?ee(le):"tokenize"in le?ee([le]):U(le);function U(we){return Te;function Te(Ve){const Ae=Ve!==null&&we[Ve],dt=Ve!==null&&we.null,qt=[...Array.isArray(Ae)?Ae:Ae?[Ae]:[],...Array.isArray(dt)?dt:dt?[dt]:[]];return ee(qt)(Ve)}}function ee(we){return q=we,ae=0,we.length===0?$:_(we[ae])}function _(we){return Te;function Te(Ve){return M=V(),be=we,we.partial||(m.currentConstruct=we),we.name&&m.parser.constructs.disable.null.includes(we.name)?Ce():we.tokenize.call(G?Object.assign(Object.create(m),G):m,d,ge,Ce)(Ve)}}function ge(we){return X(be,M),re}function Ce(we){return M.restore(),++ae<q.length?_(q[ae]):$}}}function F(X,G){X.resolveAll&&!u.includes(X)&&u.push(X),X.resolve&&or(m.events,G,m.events.length-G,X.resolve(m.events.slice(G),m)),X.resolveTo&&(m.events=X.resolveTo(m.events,m))}function V(){const X=S(),G=m.previous,ue=m.currentConstruct,le=m.events.length,re=Array.from(f);return{from:le,restore:$};function $(){s=X,m.previous=G,m.currentConstruct=ue,m.events.length=le,f=re,L()}}function L(){s.line in l&&s.column<2&&(s.column=l[s.line],s.offset+=l[s.line]-1)}}function Ij(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 Fj(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=`
93
+ Are you sure you want to continue?`):!0}async function W(){if(!(!P||!I())){v(!0),A(null);try{const D=await s("task.run_oneoff",{user_prompt:c,agent:d,yolo_mode:y,...t==="win32"?{foreground_mode:!0}:{}});if(D.error){A(D.error);return}o(l.hostId,d),f(""),Mh(null),D.task_id&&r(D.task_id,D.run_id)}catch(D){A(D instanceof Error?D.message:String(D))}finally{v(!1)}}}function B(D){D.key==="Enter"&&(D.metaKey||D.ctrlKey)&&(D.preventDefault(),W())}return b.jsxs("div",{className:"session-composer",children:[S&&b.jsx("div",{className:"form-error",children:S}),b.jsx("textarea",{className:"session-composer-textarea",value:c,onChange:D=>f(D.target.value),onKeyDown:B,placeholder:"What can I do for you?",rows:3,disabled:x}),b.jsxs("div",{className:"session-composer-controls",children:[e.length>0&&b.jsx("div",{className:"agent-picker-section-inline",children:e.length>1?b.jsx("select",{className:"form-select form-select-sm",value:d,onChange:D=>m(D.target.value),disabled:x,children:e.map(D=>b.jsx("option",{value:D.key,children:D.label},D.key))}):b.jsx("span",{className:"agent-picker-single",children:(M==null?void 0:M.label)??e[0].label})}),T&&b.jsxs("label",{className:"session-composer-yolo",children:[b.jsx("input",{type:"checkbox",checked:y,onChange:D=>g(D.target.checked),disabled:x}),"Yolo"]}),b.jsx("button",{className:"btn btn-primary chat-send-btn",onClick:W,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"})]})})]}),T&&y&&b.jsx("p",{className:"command-help-text",children:"The agent will auto-approve all tool calls without asking for permission."})]})}const gs=72,eb=6;function lC({id:e,revealedId:t,setRevealedId:r,onDelete:s,onClick:l,children:o,actionLabel:c="Delete",confirmMessage:f="Delete this item? This can't be undone."}){const d=t===e,[m,y]=E.useState(0),[g,x]=E.useState(!1),v=E.useRef(0),S=E.useRef(0),A=E.useRef(null),M=E.useRef(0),T=E.useRef(!1),P=E.useRef(null);E.useEffect(()=>{d||y(0)},[d]),E.useEffect(()=>{if(!d)return;function $(V){var L;(L=P.current)!=null&&L.contains(V.target)||r(null)}return document.addEventListener("pointerdown",$),()=>document.removeEventListener("pointerdown",$)},[d,r]);function I($){$.button!==void 0&&$.button!==0||(v.current=$.clientX,S.current=$.clientY,A.current=null,M.current=d?-gs:0,T.current=!1)}function W($){if($.pointerType==="mouse"&&$.buttons===0)return;const V=$.clientX-v.current,L=$.clientY-S.current;if(A.current===null){if(Math.abs(V)<eb&&Math.abs(L)<eb)return;if(A.current=Math.abs(V)>Math.abs(L)?"x":"y",A.current==="x")try{$.currentTarget.setPointerCapture($.pointerId)}catch{}}if(A.current!=="x")return;T.current=!0,g||x(!0);let X=M.current+V;X>0&&(X=X/4),X<-gs&&(X=-gs+(X+gs)/4),y(X)}function B(){if(A.current!=="x"){x(!1);return}A.current=null,x(!1),m<=-36?(y(-gs),r(e)):(y(0),d&&r(null))}function D($){if(T.current){T.current=!1,$.stopPropagation(),$.preventDefault();return}d&&($.stopPropagation(),$.preventDefault(),r(null))}const Z=m!==0?m:d?-gs:0;return b.jsxs("div",{ref:P,className:"swipe-row",children:[b.jsxs("button",{type:"button",className:"swipe-row-action",style:{width:gs},onClick:$=>{$.stopPropagation(),window.confirm(f)&&s()},tabIndex:d?0:-1,"aria-hidden":!d,"aria-label":c,children:[b.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[b.jsx("polyline",{points:"3 6 5 6 21 6"}),b.jsx("path",{d:"M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6"}),b.jsx("path",{d:"M10 11v6M14 11v6"}),b.jsx("path",{d:"M9 6V4a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v2"})]}),b.jsx("span",{className:"swipe-row-action-label",children:c})]}),b.jsx("div",{className:`swipe-row-content ${g?"swipe-row-content-dragging":""}`,style:{transform:`translateX(${Z}px)`},onPointerDown:I,onPointerMove:W,onPointerUp:B,onPointerCancel:B,onClickCapture:D,onClick:l,children:o})]})}const oC=10;function uC({connected:e,hostId:t,request:r,subscribeEvents:s,agents:l,hostPlatform:o,filterTaskId:c,onClearFilter:f,hostInfoStatus:d}){const m=Yd(),[y,g]=E.useState([]),[x,v]=E.useState(0),[S,A]=E.useState(!1),[M,T]=E.useState(!1),[P,I]=E.useState(null),W=Vr();async function B(q){const le=`${q.task_id}:${q.run_id}`;g(be=>be.filter(O=>`${O.task_id}:${O.run_id}`!==le)),v(be=>Math.max(0,be-1)),I(null);try{await r("taskrun.delete",{task_id:q.task_id,run_id:q.run_id})}catch(be){console.error("Failed to delete run:",be),g(O=>[q,...O]),v(O=>O+1)}}const D=E.useRef(null),Z=E.useCallback(q=>{const le={offset:q,limit:oC};return c&&(le.task_id=c),le},[c]),$=E.useCallback(async(q,le)=>{if(e){le?T(!0):A(!0);try{const be=await r("taskrun.list",Z(q)),O=be.entries??[];v(be.total??0),g(le?U=>{const ee=new Set(U.map(ie=>`${ie.task_id}:${ie.run_id}`)),j=O.filter(ie=>!ee.has(`${ie.task_id}:${ie.run_id}`));return[...U,...j]}:O)}catch(be){be instanceof Error&&be.message==="Not connected"||console.error("Failed to load runs:",be)}finally{A(!1),T(!1)}}},[e,r,Z]);E.useEffect(()=>{e?(g([]),v(0),$(0,!1)):(g([]),v(0))},[e,t,$,c]);const V=Hx({onRefresh:()=>$(0,!1),enabled:e});E.useEffect(()=>!e||!t?void 0:s(t,async le=>{try{const be=JSON.parse(new TextDecoder().decode(le.data));if(be.event_type==="running-state"&&be.running_state&&["started","finished","failed","aborted"].includes(be.running_state)){const O=await r("taskrun.list",Z(0)),U=O.entries??[];v(O.total??0),g(ee=>{const j=new Map(U.map(Ee=>[`${Ee.task_id}:${Ee.run_id}`,Ee])),ie=ee.map(Ee=>{const Ve=`${Ee.task_id}:${Ee.run_id}`;return j.get(Ve)??Ee}),Ce=new Set(ie.map(Ee=>`${Ee.task_id}:${Ee.run_id}`));return[...U.filter(Ee=>!Ce.has(`${Ee.task_id}:${Ee.run_id}`)),...ie]})}}catch{}}),[e,t,s,r]),E.useEffect(()=>{const q=D.current;if(!q)return;const le=new IntersectionObserver(be=>{be[0].isIntersecting&&!M&&y.length<x&&$(y.length,!0)},{threshold:.1});return le.observe(q),()=>le.disconnect()},[y.length,x,M,$]);function L(q,le){if(!q||!le)return"";const be=Math.round((le-q)/1e3);if(be<60)return`${be}s`;const O=Math.floor(be/60),U=be%60;return`${O}m ${U}s`}const X={started:"Running",finished:"Finished",failed:"Failed",aborted:"Aborted"};function G(q,le){xs()&&t&&W(`/hosts/${encodeURIComponent(t)}/runs/${encodeURIComponent(q)}/${encodeURIComponent(le)}`)}const ce=!c&&d==="ready"&&b.jsx(aC,{agents:l,hostPlatform:o,onStarted:(q,le)=>{if(!t)return;const be=`/hosts/${encodeURIComponent(t)}/runs/${encodeURIComponent(q)}`;W(le?`${be}/${encodeURIComponent(le)}`:be)}}),oe=b.jsx(Bx,{pullDistance:V.pullDistance,refreshing:V.refreshing,threshold:V.threshold}),re=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 F(q){if(q==="failed")return"var(--color-error)";if(q==="aborted")return"var(--color-warning, #d97706)"}return S&&y.length===0&&e&&d==="ready"?b.jsxs(b.Fragment,{children:[oe,ce,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.jsx("div",{className:"task-card-title-row",children:b.jsx("div",{className:"skeleton-line",style:{width:`${70+q*10}%`}})})}),b.jsx("div",{className:"task-card-meta",children:b.jsx("div",{className:"skeleton-line",style:{width:"45%"}})})]},q))})]}):y.length===0?b.jsxs(b.Fragment,{children:[oe,ce,re,b.jsx("div",{className:"sessions-view",children:d==="loading"?b.jsx("div",{className:"empty-state",children:b.jsx("p",{className:"empty-state-text",children:"Connecting to host…"})}):d==="error"?b.jsxs("div",{className:"empty-state",children:[b.jsx("p",{className:"empty-state-text",children:"Couldn't reach host"}),b.jsxs("p",{className:"empty-state-hint",children:["The host didn't respond. Try running ",b.jsx("code",{children:"palmier restart"})," on the host machine to restart the daemon."]})]}):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:[oe,ce,re,b.jsxs("div",{className:"task-list",children:[y.map((q,le)=>{const be=`${q.task_id}:${q.run_id}`;return b.jsx(lC,{id:be,revealedId:P,setRevealedId:I,onDelete:()=>B(q),confirmMessage:"Delete this session? Its run history will be removed from the host.",onClick:()=>!q.error&&G(q.task_id,q.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:q.task_name||q.task_id}),b.jsxs("div",{className:"sessions-card-meta",children:[q.running_state==="started"?b.jsx("span",{className:"status-spinner","aria-label":"Running",children:b.jsx("span",{})}):b.jsx("span",{style:{color:F(q.running_state)},children:X[q.running_state??""]??q.running_state}),q.end_time&&b.jsx("span",{children:m(q.end_time)}),q.start_time&&q.end_time&&b.jsx("span",{style:{color:"var(--color-muted)"},children:L(q.start_time,q.end_time)}),q.error&&b.jsx("span",{style:{color:"var(--color-muted)"},children:q.error})]})]}),b.jsx("span",{className:"sessions-card-chevron",children:"›"})]})},`${be}-${le}`)}),b.jsx("div",{ref:D,style:{height:1}}),M&&b.jsx("div",{className:"loading-state",style:{padding:"var(--space-md)"},children:b.jsx("div",{className:"spinner"})})]})]})}function cC(e,t){const r={};return(e[e.length-1]===""?[...e,""]:e).join((r.padRight?" ":"")+","+(r.padLeft===!1?"":" ")).trim()}const fC=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,hC=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,dC={};function tb(e,t){return(dC.jsx?hC:fC).test(e)}const mC=/[ \t\n\f\r]/g;function pC(e){return typeof e=="object"?e.type==="text"?nb(e.value):!1:nb(e)}function nb(e){return e.replace(mC,"")===""}class Jl{constructor(t,r,s){this.normal=r,this.property=t,s&&(this.space=s)}}Jl.prototype.normal={};Jl.prototype.property={};Jl.prototype.space=void 0;function Fx(e,t){const r={},s={};for(const l of e)Object.assign(r,l.property),Object.assign(s,l.normal);return new Jl(r,s,t)}function bd(e){return e.toLowerCase()}class Jn{constructor(t,r){this.attribute=r,this.property=t}}Jn.prototype.attribute="";Jn.prototype.booleanish=!1;Jn.prototype.boolean=!1;Jn.prototype.commaOrSpaceSeparated=!1;Jn.prototype.commaSeparated=!1;Jn.prototype.defined=!1;Jn.prototype.mustUseProperty=!1;Jn.prototype.number=!1;Jn.prototype.overloadedBoolean=!1;Jn.prototype.property="";Jn.prototype.spaceSeparated=!1;Jn.prototype.space=void 0;let gC=0;const Ze=Ss(),mn=Ss(),xd=Ss(),we=Ss(),Ut=Ss(),ga=Ss(),ir=Ss();function Ss(){return 2**++gC}const vd=Object.freeze(Object.defineProperty({__proto__:null,boolean:Ze,booleanish:mn,commaOrSpaceSeparated:ir,commaSeparated:ga,number:we,overloadedBoolean:xd,spaceSeparated:Ut},Symbol.toStringTag,{value:"Module"})),Lh=Object.keys(vd);class Jd extends Jn{constructor(t,r,s,l){let o=-1;if(super(t,r),rb(this,"space",l),typeof s=="number")for(;++o<Lh.length;){const c=Lh[o];rb(this,Lh[o],(s&vd[c])===vd[c])}}}Jd.prototype.defined=!0;function rb(e,t,r){r&&(e[t]=r)}function Ca(e){const t={},r={};for(const[s,l]of Object.entries(e.properties)){const o=new Jd(s,e.transform(e.attributes||{},s),l,e.space);e.mustUseProperty&&e.mustUseProperty.includes(s)&&(o.mustUseProperty=!0),t[s]=o,r[bd(s)]=s,r[bd(o.attribute)]=s}return new Jl(t,r,e.space)}const $x=Ca({properties:{ariaActiveDescendant:null,ariaAtomic:mn,ariaAutoComplete:null,ariaBusy:mn,ariaChecked:mn,ariaColCount:we,ariaColIndex:we,ariaColSpan:we,ariaControls:Ut,ariaCurrent:null,ariaDescribedBy:Ut,ariaDetails:null,ariaDisabled:mn,ariaDropEffect:Ut,ariaErrorMessage:null,ariaExpanded:mn,ariaFlowTo:Ut,ariaGrabbed:mn,ariaHasPopup:null,ariaHidden:mn,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Ut,ariaLevel:we,ariaLive:null,ariaModal:mn,ariaMultiLine:mn,ariaMultiSelectable:mn,ariaOrientation:null,ariaOwns:Ut,ariaPlaceholder:null,ariaPosInSet:we,ariaPressed:mn,ariaReadOnly:mn,ariaRelevant:null,ariaRequired:mn,ariaRoleDescription:Ut,ariaRowCount:we,ariaRowIndex:we,ariaRowSpan:we,ariaSelected:mn,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 Vx(e,t){return t in e?e[t]:t}function Yx(e,t){return Vx(e,t.toLowerCase())}const yC=Ca({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:ga,acceptCharset:Ut,accessKey:Ut,action:null,allow:null,allowFullScreen:Ze,allowPaymentRequest:Ze,allowUserMedia:Ze,alt:null,as:null,async:Ze,autoCapitalize:null,autoComplete:Ut,autoFocus:Ze,autoPlay:Ze,blocking:Ut,capture:null,charSet:null,checked:Ze,cite:null,className:Ut,cols:we,colSpan:null,content:null,contentEditable:mn,controls:Ze,controlsList:Ut,coords:we|ga,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Ze,defer:Ze,dir:null,dirName:null,disabled:Ze,download:xd,draggable:mn,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Ze,formTarget:null,headers:Ut,height:we,hidden:xd,high:we,href:null,hrefLang:null,htmlFor:Ut,httpEquiv:Ut,id:null,imageSizes:null,imageSrcSet:null,inert:Ze,inputMode:null,integrity:null,is:null,isMap:Ze,itemId:null,itemProp:Ut,itemRef:Ut,itemScope:Ze,itemType:Ut,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Ze,low:we,manifest:null,max:null,maxLength:we,media:null,method:null,min:null,minLength:we,multiple:Ze,muted:Ze,name:null,nonce:null,noModule:Ze,noValidate:Ze,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:Ze,optimum:we,pattern:null,ping:Ut,placeholder:null,playsInline:Ze,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Ze,referrerPolicy:null,rel:Ut,required:Ze,reversed:Ze,rows:we,rowSpan:we,sandbox:Ut,scope:null,scoped:Ze,seamless:Ze,selected:Ze,shadowRootClonable:Ze,shadowRootDelegatesFocus:Ze,shadowRootMode:null,shape:null,size:we,sizes:null,slot:null,span:we,spellCheck:mn,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:Ze,useMap:null,value:mn,width:we,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Ut,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:Ze,declare:Ze,event:null,face:null,frame:null,frameBorder:null,hSpace:we,leftMargin:we,link:null,longDesc:null,lowSrc:null,marginHeight:we,marginWidth:we,noResize:Ze,noHref:Ze,noShade:Ze,noWrap:Ze,object:null,profile:null,prompt:null,rev:null,rightMargin:we,rules:null,scheme:null,scrolling:mn,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:Ze,disableRemotePlayback:Ze,prefix:null,property:null,results:we,security:null,unselectable:null},space:"html",transform:Yx}),bC=Ca({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:ir,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:Ut,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:Ze,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:ga,g2:ga,glyphName:ga,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:ir,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:Ut,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:we,pointsAtY:we,pointsAtZ:we,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:ir,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:ir,rev:ir,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:ir,requiredFeatures:ir,requiredFonts:ir,requiredFormats:ir,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:ir,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:ir,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:ir,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:Vx}),Gx=Ca({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()}}),Jx=Ca({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Yx}),Xx=Ca({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),xC={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"},vC=/[A-Z]/g,ib=/-[a-z]/g,wC=/^data[-\w.:]+$/i;function SC(e,t){const r=bd(t);let s=t,l=Jn;if(r in e.normal)return e.property[e.normal[r]];if(r.length>4&&r.slice(0,4)==="data"&&wC.test(t)){if(t.charAt(4)==="-"){const o=t.slice(5).replace(ib,kC);s="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{const o=t.slice(4);if(!ib.test(o)){let c=o.replace(vC,_C);c.charAt(0)!=="-"&&(c="-"+c),t="data"+c}}l=Jd}return new l(s,t)}function _C(e){return"-"+e.toLowerCase()}function kC(e){return e.charAt(1).toUpperCase()}const EC=Fx([$x,yC,Gx,Jx,Xx],"html"),Xd=Fx([$x,bC,Gx,Jx,Xx],"svg");function CC(e){return e.join(" ").trim()}var ia={},zh,sb;function AC(){if(sb)return zh;sb=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,r=/^\s*/,s=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,l=/^:\s*/,o=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,f=/^\s+|\s+$/g,d=`
94
+ `,m="/",y="*",g="",x="comment",v="declaration";function S(M,T){if(typeof M!="string")throw new TypeError("First argument must be a string");if(!M)return[];T=T||{};var P=1,I=1;function W(oe){var re=oe.match(t);re&&(P+=re.length);var F=oe.lastIndexOf(d);I=~F?oe.length-F:I+oe.length}function B(){var oe={line:P,column:I};return function(re){return re.position=new D(oe),V(),re}}function D(oe){this.start=oe,this.end={line:P,column:I},this.source=T.source}D.prototype.content=M;function Z(oe){var re=new Error(T.source+":"+P+":"+I+": "+oe);if(re.reason=oe,re.filename=T.source,re.line=P,re.column=I,re.source=M,!T.silent)throw re}function $(oe){var re=oe.exec(M);if(re){var F=re[0];return W(F),M=M.slice(F.length),re}}function V(){$(r)}function L(oe){var re;for(oe=oe||[];re=X();)re!==!1&&oe.push(re);return oe}function X(){var oe=B();if(!(m!=M.charAt(0)||y!=M.charAt(1))){for(var re=2;g!=M.charAt(re)&&(y!=M.charAt(re)||m!=M.charAt(re+1));)++re;if(re+=2,g===M.charAt(re-1))return Z("End of comment missing");var F=M.slice(2,re-2);return I+=2,W(F),M=M.slice(re),I+=2,oe({type:x,comment:F})}}function G(){var oe=B(),re=$(s);if(re){if(X(),!$(l))return Z("property missing ':'");var F=$(o),q=oe({type:v,property:A(re[0].replace(e,g)),value:F?A(F[0].replace(e,g)):g});return $(c),q}}function ce(){var oe=[];L(oe);for(var re;re=G();)re!==!1&&(oe.push(re),L(oe));return oe}return V(),ce()}function A(M){return M?M.replace(f,g):g}return zh=S,zh}var ab;function jC(){if(ab)return ia;ab=1;var e=ia&&ia.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(ia,"__esModule",{value:!0}),ia.default=r;const t=e(AC());function r(s,l){let o=null;if(!s||typeof s!="string")return o;const c=(0,t.default)(s),f=typeof l=="function";return c.forEach(d=>{if(d.type!=="declaration")return;const{property:m,value:y}=d;f?l(m,y,d):y&&(o=o||{},o[m]=y)}),o}return ia}var wl={},lb;function NC(){if(lb)return wl;lb=1,Object.defineProperty(wl,"__esModule",{value:!0}),wl.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,r=/^[^-]+$/,s=/^-(webkit|moz|ms|o|khtml)-/,l=/^-(ms)-/,o=function(m){return!m||r.test(m)||e.test(m)},c=function(m,y){return y.toUpperCase()},f=function(m,y){return"".concat(y,"-")},d=function(m,y){return y===void 0&&(y={}),o(m)?m:(m=m.toLowerCase(),y.reactCompat?m=m.replace(l,f):m=m.replace(s,f),m.replace(t,c))};return wl.camelCase=d,wl}var Sl,ob;function TC(){if(ob)return Sl;ob=1;var e=Sl&&Sl.__importDefault||function(l){return l&&l.__esModule?l:{default:l}},t=e(jC()),r=NC();function s(l,o){var c={};return!l||typeof l!="string"||(0,t.default)(l,function(f,d){f&&d&&(c[(0,r.camelCase)(f,o)]=d)}),c}return s.default=s,Sl=s,Sl}var OC=TC();const RC=Vb(OC),Kx=Qx("end"),Kd=Qx("start");function Qx(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 MC(e){const t=Kd(e),r=Kx(e);if(t&&r)return{start:t,end:r}}function Ml(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?ub(e.position):"start"in e||"end"in e?ub(e):"line"in e||"column"in e?wd(e):""}function wd(e){return cb(e&&e.line)+":"+cb(e&&e.column)}function ub(e){return wd(e&&e.start)+"-"+wd(e&&e.end)}function cb(e){return e&&typeof e=="number"?e:1}class Nn extends Error{constructor(t,r,s){super(),typeof r=="string"&&(s=r,r=void 0);let l="",o={},c=!1;if(r&&("line"in r&&"column"in r?o={place:r}:"start"in r&&"end"in r?o={place:r}:"type"in r?o={ancestors:[r],place:r.position}:o={...r}),typeof t=="string"?l=t:!o.cause&&t&&(c=!0,l=t.message,o.cause=t),!o.ruleId&&!o.source&&typeof s=="string"){const d=s.indexOf(":");d===-1?o.ruleId=s:(o.source=s.slice(0,d),o.ruleId=s.slice(d+1))}if(!o.place&&o.ancestors&&o.ancestors){const d=o.ancestors[o.ancestors.length-1];d&&(o.place=d.position)}const f=o.place&&"start"in o.place?o.place.start:o.place;this.ancestors=o.ancestors||void 0,this.cause=o.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=Ml(o.place)||"1:1",this.place=o.place||void 0,this.reason=this.message,this.ruleId=o.ruleId||void 0,this.source=o.source||void 0,this.stack=c&&o.cause&&typeof o.cause.stack=="string"?o.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Nn.prototype.file="";Nn.prototype.name="";Nn.prototype.reason="";Nn.prototype.message="";Nn.prototype.stack="";Nn.prototype.column=void 0;Nn.prototype.line=void 0;Nn.prototype.ancestors=void 0;Nn.prototype.cause=void 0;Nn.prototype.fatal=void 0;Nn.prototype.place=void 0;Nn.prototype.ruleId=void 0;Nn.prototype.source=void 0;const Qd={}.hasOwnProperty,DC=new Map,LC=/[A-Z]/g,zC=new Set(["table","tbody","thead","tfoot","tr"]),UC=new Set(["td","th"]),Zx="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function PC(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=YC(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=VC(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"?Xd:EC,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},o=Wx(l,e,void 0);return o&&typeof o!="string"?o:l.create(e,l.Fragment,{children:o||void 0},void 0)}function Wx(e,t,r){if(t.type==="element")return BC(e,t,r);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return HC(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return IC(e,t,r);if(t.type==="mdxjsEsm")return qC(e,t);if(t.type==="root")return FC(e,t,r);if(t.type==="text")return $C(e,t)}function BC(e,t,r){const s=e.schema;let l=s;t.tagName.toLowerCase()==="svg"&&s.space==="html"&&(l=Xd,e.schema=l),e.ancestors.push(t);const o=t1(e,t.tagName,!1),c=GC(e,t);let f=Wd(e,t);return zC.has(t.tagName)&&(f=f.filter(function(d){return typeof d=="string"?!pC(d):!0})),e1(e,c,o,t),Zd(c,f),e.ancestors.pop(),e.schema=s,e.create(t,o,c,r)}function HC(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)}Il(e,t.position)}function qC(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Il(e,t.position)}function IC(e,t,r){const s=e.schema;let l=s;t.name==="svg"&&s.space==="html"&&(l=Xd,e.schema=l),e.ancestors.push(t);const o=t.name===null?e.Fragment:t1(e,t.name,!0),c=JC(e,t),f=Wd(e,t);return e1(e,c,o,t),Zd(c,f),e.ancestors.pop(),e.schema=s,e.create(t,o,c,r)}function FC(e,t,r){const s={};return Zd(s,Wd(e,t)),e.create(t,e.Fragment,s,r)}function $C(e,t){return t.value}function e1(e,t,r,s){typeof r!="string"&&r!==e.Fragment&&e.passNode&&(t.node=s)}function Zd(e,t){if(t.length>0){const r=t.length>1?t:t[0];r&&(e.children=r)}}function VC(e,t,r){return s;function s(l,o,c,f){const m=Array.isArray(c.children)?r:t;return f?m(o,c,f):m(o,c)}}function YC(e,t){return r;function r(s,l,o,c){const f=Array.isArray(o.children),d=Kd(s);return t(l,o,c,f,{columnNumber:d?d.column-1:void 0,fileName:e,lineNumber:d?d.line:void 0},void 0)}}function GC(e,t){const r={};let s,l;for(l in t.properties)if(l!=="children"&&Qd.call(t.properties,l)){const o=XC(e,l,t.properties[l]);if(o){const[c,f]=o;e.tableCellAlignToStyle&&c==="align"&&typeof f=="string"&&UC.has(t.tagName)?s=f:r[c]=f}}if(s){const o=r.style||(r.style={});o[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=s}return r}function JC(e,t){const r={};for(const s of t.attributes)if(s.type==="mdxJsxExpressionAttribute")if(s.data&&s.data.estree&&e.evaluater){const o=s.data.estree.body[0];o.type;const c=o.expression;c.type;const f=c.properties[0];f.type,Object.assign(r,e.evaluater.evaluateExpression(f.argument))}else Il(e,t.position);else{const l=s.name;let o;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,o=e.evaluater.evaluateExpression(f.expression)}else Il(e,t.position);else o=s.value===null?!0:s.value;r[l]=o}return r}function Wd(e,t){const r=[];let s=-1;const l=e.passKeys?new Map:DC;for(;++s<t.children.length;){const o=t.children[s];let c;if(e.passKeys){const d=o.type==="element"?o.tagName:o.type==="mdxJsxFlowElement"||o.type==="mdxJsxTextElement"?o.name:void 0;if(d){const m=l.get(d)||0;c=d+"-"+m,l.set(d,m+1)}}const f=Wx(e,o,c);f!==void 0&&r.push(f)}return r}function XC(e,t,r){const s=SC(e.schema,t);if(!(r==null||typeof r=="number"&&Number.isNaN(r))){if(Array.isArray(r)&&(r=s.commaSeparated?cC(r):CC(r)),s.property==="style"){let l=typeof r=="object"?r:KC(e,String(r));return e.stylePropertyNameCase==="css"&&(l=QC(l)),["style",l]}return[e.elementAttributeNameCase==="react"&&s.space?xC[s.property]||s.property:s.attribute,r]}}function KC(e,t){try{return RC(t,{reactCompat:!0})}catch(r){if(e.ignoreInvalidStyle)return{};const s=r,l=new Nn("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=Zx+"#cannot-parse-style-attribute",l}}function t1(e,t,r){let s;if(!r)s={type:"Literal",value:t};else if(t.includes(".")){const l=t.split(".");let o=-1,c;for(;++o<l.length;){const f=tb(l[o])?{type:"Identifier",name:l[o]}:{type:"Literal",value:l[o]};c=c?{type:"MemberExpression",object:c,property:f,computed:!!(o&&f.type==="Literal"),optional:!1}:f}s=c}else s=tb(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(s.type==="Literal"){const l=s.value;return Qd.call(e.components,l)?e.components[l]:l}if(e.evaluater)return e.evaluater.evaluateExpression(s);Il(e)}function Il(e,t){const r=new Nn("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=Zx+"#cannot-handle-mdx-estrees-without-createevaluater",r}function QC(e){const t={};let r;for(r in e)Qd.call(e,r)&&(t[ZC(r)]=e[r]);return t}function ZC(e){let t=e.replace(LC,WC);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function WC(e){return"-"+e.toLowerCase()}const Uh={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"]},eA={};function em(e,t){const r=eA,s=typeof r.includeImageAlt=="boolean"?r.includeImageAlt:!0,l=typeof r.includeHtml=="boolean"?r.includeHtml:!0;return n1(e,s,l)}function n1(e,t,r){if(tA(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 fb(e.children,t,r)}return Array.isArray(e)?fb(e,t,r):""}function fb(e,t,r){const s=[];let l=-1;for(;++l<e.length;)s[l]=n1(e[l],t,r);return s.join("")}function tA(e){return!!(e&&typeof e=="object")}const hb=document.createElement("i");function tm(e){const t="&"+e+";";hb.innerHTML=t;const r=hb.textContent;return r.charCodeAt(r.length-1)===59&&e!=="semi"||r===t?!1:r}function ur(e,t,r,s){const l=e.length;let o=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);o<s.length;)c=s.slice(o,o+1e4),c.unshift(t,0),e.splice(...c),o+=1e4,t+=1e4}function kr(e,t){return e.length>0?(ur(e,e.length,0,t),e):t}const db={}.hasOwnProperty;function r1(e){const t={};let r=-1;for(;++r<e.length;)nA(t,e[r]);return t}function nA(e,t){let r;for(r in t){const l=(db.call(e,r)?e[r]:void 0)||(e[r]={}),o=t[r];let c;if(o)for(c in o){db.call(l,c)||(l[c]=[]);const f=o[c];rA(l[c],Array.isArray(f)?f:f?[f]:[])}}}function rA(e,t){let r=-1;const s=[];for(;++r<t.length;)(t[r].add==="after"?e:s).push(t[r]);ur(e,0,0,s)}function i1(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 Dr(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const zn=Qi(/[A-Za-z]/),jn=Qi(/[\dA-Za-z]/),iA=Qi(/[#-'*+\--9=?A-Z^-~]/);function Hu(e){return e!==null&&(e<32||e===127)}const Sd=Qi(/\d/),sA=Qi(/[\dA-Fa-f]/),aA=Qi(/[!-/:-@[-`{-~]/);function He(e){return e!==null&&e<-2}function Lt(e){return e!==null&&(e<0||e===32)}function at(e){return e===-2||e===-1||e===32}const Wu=Qi(new RegExp("\\p{P}|\\p{S}","u")),vs=Qi(/\s/);function Qi(e){return t;function t(r){return r!==null&&r>-1&&e.test(String.fromCharCode(r))}}function Aa(e){const t=[];let r=-1,s=0,l=0;for(;++r<e.length;){const o=e.charCodeAt(r);let c="";if(o===37&&jn(e.charCodeAt(r+1))&&jn(e.charCodeAt(r+2)))l=2;else if(o<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(o))||(c=String.fromCharCode(o));else if(o>55295&&o<57344){const f=e.charCodeAt(r+1);o<56320&&f>56319&&f<57344?(c=String.fromCharCode(o,f),l=1):c="�"}else c=String.fromCharCode(o);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 ht(e,t,r,s){const l=s?s-1:Number.POSITIVE_INFINITY;let o=0;return c;function c(d){return at(d)?(e.enter(r),f(d)):t(d)}function f(d){return at(d)&&o++<l?(e.consume(d),f):(e.exit(r),t(d))}}const lA={tokenize:oA};function oA(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"),ht(e,t,"linePrefix")}function l(f){return e.enter("paragraph"),o(f)}function o(f){const d=e.enter("chunkText",{contentType:"text",previous:r});return r&&(r.next=d),r=d,c(f)}function c(f){if(f===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(f);return}return He(f)?(e.consume(f),e.exit("chunkText"),o):(e.consume(f),c)}}const uA={tokenize:cA},mb={tokenize:fA};function cA(e){const t=this,r=[];let s=0,l,o,c;return f;function f(I){if(s<r.length){const W=r[s];return t.containerState=W[1],e.attempt(W[0].continuation,d,m)(I)}return m(I)}function d(I){if(s++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,l&&P();const W=t.events.length;let B=W,D;for(;B--;)if(t.events[B][0]==="exit"&&t.events[B][1].type==="chunkFlow"){D=t.events[B][1].end;break}T(s);let Z=W;for(;Z<t.events.length;)t.events[Z][1].end={...D},Z++;return ur(t.events,B+1,0,t.events.slice(W)),t.events.length=Z,m(I)}return f(I)}function m(I){if(s===r.length){if(!l)return x(I);if(l.currentConstruct&&l.currentConstruct.concrete)return S(I);t.interrupt=!!(l.currentConstruct&&!l._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(mb,y,g)(I)}function y(I){return l&&P(),T(s),x(I)}function g(I){return t.parser.lazy[t.now().line]=s!==r.length,c=t.now().offset,S(I)}function x(I){return t.containerState={},e.attempt(mb,v,S)(I)}function v(I){return s++,r.push([t.currentConstruct,t.containerState]),x(I)}function S(I){if(I===null){l&&P(),T(0),e.consume(I);return}return l=l||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:l,contentType:"flow",previous:o}),A(I)}function A(I){if(I===null){M(e.exit("chunkFlow"),!0),T(0),e.consume(I);return}return He(I)?(e.consume(I),M(e.exit("chunkFlow")),s=0,t.interrupt=void 0,f):(e.consume(I),A)}function M(I,W){const B=t.sliceStream(I);if(W&&B.push(null),I.previous=o,o&&(o.next=I),o=I,l.defineSkip(I.start),l.write(B),t.parser.lazy[I.start.line]){let D=l.events.length;for(;D--;)if(l.events[D][1].start.offset<c&&(!l.events[D][1].end||l.events[D][1].end.offset>c))return;const Z=t.events.length;let $=Z,V,L;for(;$--;)if(t.events[$][0]==="exit"&&t.events[$][1].type==="chunkFlow"){if(V){L=t.events[$][1].end;break}V=!0}for(T(s),D=Z;D<t.events.length;)t.events[D][1].end={...L},D++;ur(t.events,$+1,0,t.events.slice(Z)),t.events.length=D}}function T(I){let W=r.length;for(;W-- >I;){const B=r[W];t.containerState=B[1],B[0].exit.call(t,e)}r.length=I}function P(){l.write([null]),o=void 0,l=void 0,t.containerState._closeFlow=void 0}}function fA(e,t,r){return ht(e,e.attempt(this.parser.constructs.document,t,r),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function wa(e){if(e===null||Lt(e)||vs(e))return 1;if(Wu(e))return 2}function ec(e,t,r){const s=[];let l=-1;for(;++l<e.length;){const o=e[l].resolveAll;o&&!s.includes(o)&&(t=o(t,r),s.push(o))}return t}const _d={name:"attention",resolveAll:hA,tokenize:dA};function hA(e,t){let r=-1,s,l,o,c,f,d,m,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;d=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};pb(g,-d),pb(x,d),c={type:d>1?"strongSequence":"emphasisSequence",start:g,end:{...e[s][1].end}},f={type:d>1?"strongSequence":"emphasisSequence",start:{...e[r][1].start},end:x},o={type:d>1?"strongText":"emphasisText",start:{...e[s][1].end},end:{...e[r][1].start}},l={type:d>1?"strong":"emphasis",start:{...c.start},end:{...f.end}},e[s][1].end={...c.start},e[r][1].start={...f.end},m=[],e[s][1].end.offset-e[s][1].start.offset&&(m=kr(m,[["enter",e[s][1],t],["exit",e[s][1],t]])),m=kr(m,[["enter",l,t],["enter",c,t],["exit",c,t],["enter",o,t]]),m=kr(m,ec(t.parser.constructs.insideSpan.null,e.slice(s+1,r),t)),m=kr(m,[["exit",o,t],["enter",f,t],["exit",f,t],["exit",l,t]]),e[r][1].end.offset-e[r][1].start.offset?(y=2,m=kr(m,[["enter",e[r][1],t],["exit",e[r][1],t]])):y=0,ur(e,s-1,r-s+3,m),r=s+m.length-y-2;break}}for(r=-1;++r<e.length;)e[r][1].type==="attentionSequence"&&(e[r][1].type="data");return e}function dA(e,t){const r=this.parser.constructs.attentionMarkers.null,s=this.previous,l=wa(s);let o;return c;function c(d){return o=d,e.enter("attentionSequence"),f(d)}function f(d){if(d===o)return e.consume(d),f;const m=e.exit("attentionSequence"),y=wa(d),g=!y||y===2&&l||r.includes(d),x=!l||l===2&&y||r.includes(s);return m._open=!!(o===42?g:g&&(l||!x)),m._close=!!(o===42?x:x&&(y||!g)),t(d)}}function pb(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const mA={name:"autolink",tokenize:pA};function pA(e,t,r){let s=0;return l;function l(v){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(v),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),o}function o(v){return zn(v)?(e.consume(v),c):v===64?r(v):m(v)}function c(v){return v===43||v===45||v===46||jn(v)?(s=1,f(v)):m(v)}function f(v){return v===58?(e.consume(v),s=0,d):(v===43||v===45||v===46||jn(v))&&s++<32?(e.consume(v),f):(s=0,m(v))}function d(v){return v===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(v),e.exit("autolinkMarker"),e.exit("autolink"),t):v===null||v===32||v===60||Hu(v)?r(v):(e.consume(v),d)}function m(v){return v===64?(e.consume(v),y):iA(v)?(e.consume(v),m):r(v)}function y(v){return jn(v)?g(v):r(v)}function g(v){return v===46?(e.consume(v),s=0,y):v===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(v),e.exit("autolinkMarker"),e.exit("autolink"),t):x(v)}function x(v){if((v===45||jn(v))&&s++<63){const S=v===45?x:g;return e.consume(v),S}return r(v)}}const Xl={partial:!0,tokenize:gA};function gA(e,t,r){return s;function s(o){return at(o)?ht(e,l,"linePrefix")(o):l(o)}function l(o){return o===null||He(o)?t(o):r(o)}}const s1={continuation:{tokenize:bA},exit:xA,name:"blockQuote",tokenize:yA};function yA(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"),o}return r(c)}function o(c){return at(c)?(e.enter("blockQuotePrefixWhitespace"),e.consume(c),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(c))}}function bA(e,t,r){const s=this;return l;function l(c){return at(c)?ht(e,o,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(c):o(c)}function o(c){return e.attempt(s1,t,r)(c)}}function xA(e){e.exit("blockQuote")}const a1={name:"characterEscape",tokenize:vA};function vA(e,t,r){return s;function s(o){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(o),e.exit("escapeMarker"),l}function l(o){return aA(o)?(e.enter("characterEscapeValue"),e.consume(o),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):r(o)}}const l1={name:"characterReference",tokenize:wA};function wA(e,t,r){const s=this;let l=0,o,c;return f;function f(g){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(g),e.exit("characterReferenceMarker"),d}function d(g){return g===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(g),e.exit("characterReferenceMarkerNumeric"),m):(e.enter("characterReferenceValue"),o=31,c=jn,y(g))}function m(g){return g===88||g===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(g),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),o=6,c=sA,y):(e.enter("characterReferenceValue"),o=7,c=Sd,y(g))}function y(g){if(g===59&&l){const x=e.exit("characterReferenceValue");return c===jn&&!tm(s.sliceSerialize(x))?r(g):(e.enter("characterReferenceMarker"),e.consume(g),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return c(g)&&l++<o?(e.consume(g),y):r(g)}}const gb={partial:!0,tokenize:_A},yb={concrete:!0,name:"codeFenced",tokenize:SA};function SA(e,t,r){const s=this,l={partial:!0,tokenize:B};let o=0,c=0,f;return d;function d(D){return m(D)}function m(D){const Z=s.events[s.events.length-1];return o=Z&&Z[1].type==="linePrefix"?Z[2].sliceSerialize(Z[1],!0).length:0,f=D,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),y(D)}function y(D){return D===f?(c++,e.consume(D),y):c<3?r(D):(e.exit("codeFencedFenceSequence"),at(D)?ht(e,g,"whitespace")(D):g(D))}function g(D){return D===null||He(D)?(e.exit("codeFencedFence"),s.interrupt?t(D):e.check(gb,A,W)(D)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),x(D))}function x(D){return D===null||He(D)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),g(D)):at(D)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),ht(e,v,"whitespace")(D)):D===96&&D===f?r(D):(e.consume(D),x)}function v(D){return D===null||He(D)?g(D):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),S(D))}function S(D){return D===null||He(D)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),g(D)):D===96&&D===f?r(D):(e.consume(D),S)}function A(D){return e.attempt(l,W,M)(D)}function M(D){return e.enter("lineEnding"),e.consume(D),e.exit("lineEnding"),T}function T(D){return o>0&&at(D)?ht(e,P,"linePrefix",o+1)(D):P(D)}function P(D){return D===null||He(D)?e.check(gb,A,W)(D):(e.enter("codeFlowValue"),I(D))}function I(D){return D===null||He(D)?(e.exit("codeFlowValue"),P(D)):(e.consume(D),I)}function W(D){return e.exit("codeFenced"),t(D)}function B(D,Z,$){let V=0;return L;function L(re){return D.enter("lineEnding"),D.consume(re),D.exit("lineEnding"),X}function X(re){return D.enter("codeFencedFence"),at(re)?ht(D,G,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(re):G(re)}function G(re){return re===f?(D.enter("codeFencedFenceSequence"),ce(re)):$(re)}function ce(re){return re===f?(V++,D.consume(re),ce):V>=c?(D.exit("codeFencedFenceSequence"),at(re)?ht(D,oe,"whitespace")(re):oe(re)):$(re)}function oe(re){return re===null||He(re)?(D.exit("codeFencedFence"),Z(re)):$(re)}}}function _A(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"),o)}function o(c){return s.parser.lazy[s.now().line]?r(c):t(c)}}const Ph={name:"codeIndented",tokenize:EA},kA={partial:!0,tokenize:CA};function EA(e,t,r){const s=this;return l;function l(m){return e.enter("codeIndented"),ht(e,o,"linePrefix",5)(m)}function o(m){const y=s.events[s.events.length-1];return y&&y[1].type==="linePrefix"&&y[2].sliceSerialize(y[1],!0).length>=4?c(m):r(m)}function c(m){return m===null?d(m):He(m)?e.attempt(kA,c,d)(m):(e.enter("codeFlowValue"),f(m))}function f(m){return m===null||He(m)?(e.exit("codeFlowValue"),c(m)):(e.consume(m),f)}function d(m){return e.exit("codeIndented"),t(m)}}function CA(e,t,r){const s=this;return l;function l(c){return s.parser.lazy[s.now().line]?r(c):He(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),l):ht(e,o,"linePrefix",5)(c)}function o(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):He(c)?l(c):r(c)}}const AA={name:"codeText",previous:NA,resolve:jA,tokenize:TA};function jA(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 NA(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function TA(e,t,r){let s=0,l,o;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"),d(g))}function d(g){return g===null?r(g):g===32?(e.enter("space"),e.consume(g),e.exit("space"),d):g===96?(o=e.enter("codeTextSequence"),l=0,y(g)):He(g)?(e.enter("lineEnding"),e.consume(g),e.exit("lineEnding"),d):(e.enter("codeTextData"),m(g))}function m(g){return g===null||g===32||g===96||He(g)?(e.exit("codeTextData"),d(g)):(e.consume(g),m)}function y(g){return g===96?(e.consume(g),l++,y):l===s?(e.exit("codeTextSequence"),e.exit("codeText"),t(g)):(o.type="codeTextData",m(g))}}class OA{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 o=this.right.splice(this.right.length-l,Number.POSITIVE_INFINITY);return s&&_l(this.left,s),o.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),_l(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),_l(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);_l(this.right,r.reverse())}else{const r=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);_l(this.left,r.reverse())}}}function _l(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 o1(e){const t={};let r=-1,s,l,o,c,f,d,m;const y=new OA(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"&&(d=s[1]._tokenizer.events,o=0,o<d.length&&d[o][1].type==="lineEndingBlank"&&(o+=2),o<d.length&&d[o][1].type==="content"))for(;++o<d.length&&d[o][1].type!=="content";)d[o][1].type==="chunkText"&&(d[o][1]._isInFirstContentOfListItem=!0,o++);if(s[0]==="enter")s[1].contentType&&(Object.assign(t,RA(y,r)),r=t[r],m=!0);else if(s[1]._container){for(o=r,l=void 0;o--;)if(c=y.get(o),c[1].type==="lineEnding"||c[1].type==="lineEndingBlank")c[0]==="enter"&&(l&&(y.get(l)[1].type="lineEndingBlank"),c[1].type="lineEnding",l=o);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 ur(e,0,Number.POSITIVE_INFINITY,y.slice(0)),!m}function RA(e,t){const r=e.get(t)[1],s=e.get(t)[2];let l=t-1;const o=[];let c=r._tokenizer;c||(c=s.parser[r.contentType](r.start),r._contentTypeTextTrailing&&(c._contentTypeTextTrailing=!0));const f=c.events,d=[],m={};let y,g,x=-1,v=r,S=0,A=0;const M=[A];for(;v;){for(;e.get(++l)[1]!==v;);o.push(l),v._tokenizer||(y=s.sliceStream(v),v.next||y.push(null),g&&c.defineSkip(v.start),v._isInFirstContentOfListItem&&(c._gfmTasklistFirstContentOfListItem=!0),c.write(y),v._isInFirstContentOfListItem&&(c._gfmTasklistFirstContentOfListItem=void 0)),g=v,v=v.next}for(v=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&&(A=x+1,M.push(A),v._tokenizer=void 0,v.previous=void 0,v=v.next);for(c.events=[],v?(v._tokenizer=void 0,v.previous=void 0):M.pop(),x=M.length;x--;){const T=f.slice(M[x],M[x+1]),P=o.pop();d.push([P,P+T.length-1]),e.splice(P,2,T)}for(d.reverse(),x=-1;++x<d.length;)m[S+d[x][0]]=S+d[x][1],S+=d[x][1]-d[x][0]-1;return m}const MA={resolve:LA,tokenize:zA},DA={partial:!0,tokenize:UA};function LA(e){return o1(e),e}function zA(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?o(f):He(f)?e.check(DA,c,o)(f):(e.consume(f),l)}function o(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 UA(e,t,r){const s=this;return l;function l(c){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),ht(e,o,"linePrefix")}function o(c){if(c===null||He(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 u1(e,t,r,s,l,o,c,f,d){const m=d||Number.POSITIVE_INFINITY;let y=0;return g;function g(T){return T===60?(e.enter(s),e.enter(l),e.enter(o),e.consume(T),e.exit(o),x):T===null||T===32||T===41||Hu(T)?r(T):(e.enter(s),e.enter(c),e.enter(f),e.enter("chunkString",{contentType:"string"}),A(T))}function x(T){return T===62?(e.enter(o),e.consume(T),e.exit(o),e.exit(l),e.exit(s),t):(e.enter(f),e.enter("chunkString",{contentType:"string"}),v(T))}function v(T){return T===62?(e.exit("chunkString"),e.exit(f),x(T)):T===null||T===60||He(T)?r(T):(e.consume(T),T===92?S:v)}function S(T){return T===60||T===62||T===92?(e.consume(T),v):v(T)}function A(T){return!y&&(T===null||T===41||Lt(T))?(e.exit("chunkString"),e.exit(f),e.exit(c),e.exit(s),t(T)):y<m&&T===40?(e.consume(T),y++,A):T===41?(e.consume(T),y--,A):T===null||T===32||T===40||Hu(T)?r(T):(e.consume(T),T===92?M:A)}function M(T){return T===40||T===41||T===92?(e.consume(T),A):A(T)}}function c1(e,t,r,s,l,o){const c=this;let f=0,d;return m;function m(v){return e.enter(s),e.enter(l),e.consume(v),e.exit(l),e.enter(o),y}function y(v){return f>999||v===null||v===91||v===93&&!d||v===94&&!f&&"_hiddenFootnoteSupport"in c.parser.constructs?r(v):v===93?(e.exit(o),e.enter(l),e.consume(v),e.exit(l),e.exit(s),t):He(v)?(e.enter("lineEnding"),e.consume(v),e.exit("lineEnding"),y):(e.enter("chunkString",{contentType:"string"}),g(v))}function g(v){return v===null||v===91||v===93||He(v)||f++>999?(e.exit("chunkString"),y(v)):(e.consume(v),d||(d=!at(v)),v===92?x:g)}function x(v){return v===91||v===92||v===93?(e.consume(v),f++,g):g(v)}}function f1(e,t,r,s,l,o){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,d):r(x)}function d(x){return x===c?(e.enter(l),e.consume(x),e.exit(l),e.exit(s),t):(e.enter(o),m(x))}function m(x){return x===c?(e.exit(o),d(c)):x===null?r(x):He(x)?(e.enter("lineEnding"),e.consume(x),e.exit("lineEnding"),ht(e,m,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),y(x))}function y(x){return x===c||x===null||He(x)?(e.exit("chunkString"),m(x)):(e.consume(x),x===92?g:y)}function g(x){return x===c||x===92?(e.consume(x),y):y(x)}}function Dl(e,t){let r;return s;function s(l){return He(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),r=!0,s):at(l)?ht(e,s,r?"linePrefix":"lineSuffix")(l):t(l)}}const PA={name:"definition",tokenize:HA},BA={partial:!0,tokenize:qA};function HA(e,t,r){const s=this;let l;return o;function o(v){return e.enter("definition"),c(v)}function c(v){return c1.call(s,e,f,r,"definitionLabel","definitionLabelMarker","definitionLabelString")(v)}function f(v){return l=Dr(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)),v===58?(e.enter("definitionMarker"),e.consume(v),e.exit("definitionMarker"),d):r(v)}function d(v){return Lt(v)?Dl(e,m)(v):m(v)}function m(v){return u1(e,y,r,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(v)}function y(v){return e.attempt(BA,g,g)(v)}function g(v){return at(v)?ht(e,x,"whitespace")(v):x(v)}function x(v){return v===null||He(v)?(e.exit("definition"),s.parser.defined.push(l),t(v)):r(v)}}function qA(e,t,r){return s;function s(f){return Lt(f)?Dl(e,l)(f):r(f)}function l(f){return f1(e,o,r,"definitionTitle","definitionTitleMarker","definitionTitleString")(f)}function o(f){return at(f)?ht(e,c,"whitespace")(f):c(f)}function c(f){return f===null||He(f)?t(f):r(f)}}const IA={name:"hardBreakEscape",tokenize:FA};function FA(e,t,r){return s;function s(o){return e.enter("hardBreakEscape"),e.consume(o),l}function l(o){return He(o)?(e.exit("hardBreakEscape"),t(o)):r(o)}}const $A={name:"headingAtx",resolve:VA,tokenize:YA};function VA(e,t){let r=e.length-2,s=3,l,o;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},o={type:"chunkText",start:e[s][1].start,end:e[r][1].end,contentType:"text"},ur(e,s,r-s+1,[["enter",l,t],["enter",o,t],["exit",o,t],["exit",l,t]])),e}function YA(e,t,r){let s=0;return l;function l(y){return e.enter("atxHeading"),o(y)}function o(y){return e.enter("atxHeadingSequence"),c(y)}function c(y){return y===35&&s++<6?(e.consume(y),c):y===null||Lt(y)?(e.exit("atxHeadingSequence"),f(y)):r(y)}function f(y){return y===35?(e.enter("atxHeadingSequence"),d(y)):y===null||He(y)?(e.exit("atxHeading"),t(y)):at(y)?ht(e,f,"whitespace")(y):(e.enter("atxHeadingText"),m(y))}function d(y){return y===35?(e.consume(y),d):(e.exit("atxHeadingSequence"),f(y))}function m(y){return y===null||y===35||Lt(y)?(e.exit("atxHeadingText"),f(y)):(e.consume(y),m)}}const GA=["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"],bb=["pre","script","style","textarea"],JA={concrete:!0,name:"htmlFlow",resolveTo:QA,tokenize:ZA},XA={partial:!0,tokenize:ej},KA={partial:!0,tokenize:WA};function QA(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 ZA(e,t,r){const s=this;let l,o,c,f,d;return m;function m(j){return y(j)}function y(j){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(j),g}function g(j){return j===33?(e.consume(j),x):j===47?(e.consume(j),o=!0,A):j===63?(e.consume(j),l=3,s.interrupt?t:O):zn(j)?(e.consume(j),c=String.fromCharCode(j),M):r(j)}function x(j){return j===45?(e.consume(j),l=2,v):j===91?(e.consume(j),l=5,f=0,S):zn(j)?(e.consume(j),l=4,s.interrupt?t:O):r(j)}function v(j){return j===45?(e.consume(j),s.interrupt?t:O):r(j)}function S(j){const ie="CDATA[";return j===ie.charCodeAt(f++)?(e.consume(j),f===ie.length?s.interrupt?t:G:S):r(j)}function A(j){return zn(j)?(e.consume(j),c=String.fromCharCode(j),M):r(j)}function M(j){if(j===null||j===47||j===62||Lt(j)){const ie=j===47,Ce=c.toLowerCase();return!ie&&!o&&bb.includes(Ce)?(l=1,s.interrupt?t(j):G(j)):GA.includes(c.toLowerCase())?(l=6,ie?(e.consume(j),T):s.interrupt?t(j):G(j)):(l=7,s.interrupt&&!s.parser.lazy[s.now().line]?r(j):o?P(j):I(j))}return j===45||jn(j)?(e.consume(j),c+=String.fromCharCode(j),M):r(j)}function T(j){return j===62?(e.consume(j),s.interrupt?t:G):r(j)}function P(j){return at(j)?(e.consume(j),P):L(j)}function I(j){return j===47?(e.consume(j),L):j===58||j===95||zn(j)?(e.consume(j),W):at(j)?(e.consume(j),I):L(j)}function W(j){return j===45||j===46||j===58||j===95||jn(j)?(e.consume(j),W):B(j)}function B(j){return j===61?(e.consume(j),D):at(j)?(e.consume(j),B):I(j)}function D(j){return j===null||j===60||j===61||j===62||j===96?r(j):j===34||j===39?(e.consume(j),d=j,Z):at(j)?(e.consume(j),D):$(j)}function Z(j){return j===d?(e.consume(j),d=null,V):j===null||He(j)?r(j):(e.consume(j),Z)}function $(j){return j===null||j===34||j===39||j===47||j===60||j===61||j===62||j===96||Lt(j)?B(j):(e.consume(j),$)}function V(j){return j===47||j===62||at(j)?I(j):r(j)}function L(j){return j===62?(e.consume(j),X):r(j)}function X(j){return j===null||He(j)?G(j):at(j)?(e.consume(j),X):r(j)}function G(j){return j===45&&l===2?(e.consume(j),F):j===60&&l===1?(e.consume(j),q):j===62&&l===4?(e.consume(j),U):j===63&&l===3?(e.consume(j),O):j===93&&l===5?(e.consume(j),be):He(j)&&(l===6||l===7)?(e.exit("htmlFlowData"),e.check(XA,ee,ce)(j)):j===null||He(j)?(e.exit("htmlFlowData"),ce(j)):(e.consume(j),G)}function ce(j){return e.check(KA,oe,ee)(j)}function oe(j){return e.enter("lineEnding"),e.consume(j),e.exit("lineEnding"),re}function re(j){return j===null||He(j)?ce(j):(e.enter("htmlFlowData"),G(j))}function F(j){return j===45?(e.consume(j),O):G(j)}function q(j){return j===47?(e.consume(j),c="",le):G(j)}function le(j){if(j===62){const ie=c.toLowerCase();return bb.includes(ie)?(e.consume(j),U):G(j)}return zn(j)&&c.length<8?(e.consume(j),c+=String.fromCharCode(j),le):G(j)}function be(j){return j===93?(e.consume(j),O):G(j)}function O(j){return j===62?(e.consume(j),U):j===45&&l===2?(e.consume(j),O):G(j)}function U(j){return j===null||He(j)?(e.exit("htmlFlowData"),ee(j)):(e.consume(j),U)}function ee(j){return e.exit("htmlFlow"),t(j)}}function WA(e,t,r){const s=this;return l;function l(c){return He(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),o):r(c)}function o(c){return s.parser.lazy[s.now().line]?r(c):t(c)}}function ej(e,t,r){return s;function s(l){return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),e.attempt(Xl,t,r)}}const tj={name:"htmlText",tokenize:nj};function nj(e,t,r){const s=this;let l,o,c;return f;function f(O){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(O),d}function d(O){return O===33?(e.consume(O),m):O===47?(e.consume(O),B):O===63?(e.consume(O),I):zn(O)?(e.consume(O),$):r(O)}function m(O){return O===45?(e.consume(O),y):O===91?(e.consume(O),o=0,S):zn(O)?(e.consume(O),P):r(O)}function y(O){return O===45?(e.consume(O),v):r(O)}function g(O){return O===null?r(O):O===45?(e.consume(O),x):He(O)?(c=g,q(O)):(e.consume(O),g)}function x(O){return O===45?(e.consume(O),v):g(O)}function v(O){return O===62?F(O):O===45?x(O):g(O)}function S(O){const U="CDATA[";return O===U.charCodeAt(o++)?(e.consume(O),o===U.length?A:S):r(O)}function A(O){return O===null?r(O):O===93?(e.consume(O),M):He(O)?(c=A,q(O)):(e.consume(O),A)}function M(O){return O===93?(e.consume(O),T):A(O)}function T(O){return O===62?F(O):O===93?(e.consume(O),T):A(O)}function P(O){return O===null||O===62?F(O):He(O)?(c=P,q(O)):(e.consume(O),P)}function I(O){return O===null?r(O):O===63?(e.consume(O),W):He(O)?(c=I,q(O)):(e.consume(O),I)}function W(O){return O===62?F(O):I(O)}function B(O){return zn(O)?(e.consume(O),D):r(O)}function D(O){return O===45||jn(O)?(e.consume(O),D):Z(O)}function Z(O){return He(O)?(c=Z,q(O)):at(O)?(e.consume(O),Z):F(O)}function $(O){return O===45||jn(O)?(e.consume(O),$):O===47||O===62||Lt(O)?V(O):r(O)}function V(O){return O===47?(e.consume(O),F):O===58||O===95||zn(O)?(e.consume(O),L):He(O)?(c=V,q(O)):at(O)?(e.consume(O),V):F(O)}function L(O){return O===45||O===46||O===58||O===95||jn(O)?(e.consume(O),L):X(O)}function X(O){return O===61?(e.consume(O),G):He(O)?(c=X,q(O)):at(O)?(e.consume(O),X):V(O)}function G(O){return O===null||O===60||O===61||O===62||O===96?r(O):O===34||O===39?(e.consume(O),l=O,ce):He(O)?(c=G,q(O)):at(O)?(e.consume(O),G):(e.consume(O),oe)}function ce(O){return O===l?(e.consume(O),l=void 0,re):O===null?r(O):He(O)?(c=ce,q(O)):(e.consume(O),ce)}function oe(O){return O===null||O===34||O===39||O===60||O===61||O===96?r(O):O===47||O===62||Lt(O)?V(O):(e.consume(O),oe)}function re(O){return O===47||O===62||Lt(O)?V(O):r(O)}function F(O){return O===62?(e.consume(O),e.exit("htmlTextData"),e.exit("htmlText"),t):r(O)}function q(O){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(O),e.exit("lineEnding"),le}function le(O){return at(O)?ht(e,be,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(O):be(O)}function be(O){return e.enter("htmlTextData"),c(O)}}const nm={name:"labelEnd",resolveAll:aj,resolveTo:lj,tokenize:oj},rj={tokenize:uj},ij={tokenize:cj},sj={tokenize:fj};function aj(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&&ur(e,0,e.length,r),e}function lj(e,t){let r=e.length,s=0,l,o,c,f;for(;r--;)if(l=e[r][1],o){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&&(o=r,l.type!=="labelLink")){s=2;break}}else l.type==="labelEnd"&&(c=r);const d={type:e[o][1].type==="labelLink"?"link":"image",start:{...e[o][1].start},end:{...e[e.length-1][1].end}},m={type:"label",start:{...e[o][1].start},end:{...e[c][1].end}},y={type:"labelText",start:{...e[o+s+2][1].end},end:{...e[c-2][1].start}};return f=[["enter",d,t],["enter",m,t]],f=kr(f,e.slice(o+1,o+s+3)),f=kr(f,[["enter",y,t]]),f=kr(f,ec(t.parser.constructs.insideSpan.null,e.slice(o+s+4,c-3),t)),f=kr(f,[["exit",y,t],e[c-2],e[c-1],["exit",m,t]]),f=kr(f,e.slice(c+1)),f=kr(f,[["exit",d,t]]),ur(e,o,e.length,f),e}function oj(e,t,r){const s=this;let l=s.events.length,o,c;for(;l--;)if((s.events[l][1].type==="labelImage"||s.events[l][1].type==="labelLink")&&!s.events[l][1]._balanced){o=s.events[l][1];break}return f;function f(x){return o?o._inactive?g(x):(c=s.parser.defined.includes(Dr(s.sliceSerialize({start:o.end,end:s.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(x),e.exit("labelMarker"),e.exit("labelEnd"),d):r(x)}function d(x){return x===40?e.attempt(rj,y,c?y:g)(x):x===91?e.attempt(ij,y,c?m:g)(x):c?y(x):g(x)}function m(x){return e.attempt(sj,y,g)(x)}function y(x){return t(x)}function g(x){return o._balanced=!0,r(x)}}function uj(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 Lt(g)?Dl(e,o)(g):o(g)}function o(g){return g===41?y(g):u1(e,c,f,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(g)}function c(g){return Lt(g)?Dl(e,d)(g):y(g)}function f(g){return r(g)}function d(g){return g===34||g===39||g===40?f1(e,m,r,"resourceTitle","resourceTitleMarker","resourceTitleString")(g):y(g)}function m(g){return Lt(g)?Dl(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 cj(e,t,r){const s=this;return l;function l(f){return c1.call(s,e,o,c,"reference","referenceMarker","referenceString")(f)}function o(f){return s.parser.defined.includes(Dr(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)))?t(f):r(f)}function c(f){return r(f)}}function fj(e,t,r){return s;function s(o){return e.enter("reference"),e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),l}function l(o){return o===93?(e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),e.exit("reference"),t):r(o)}}const hj={name:"labelStartImage",resolveAll:nm.resolveAll,tokenize:dj};function dj(e,t,r){const s=this;return l;function l(f){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(f),e.exit("labelImageMarker"),o}function o(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 mj={name:"labelStartLink",resolveAll:nm.resolveAll,tokenize:pj};function pj(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"),o}function o(c){return c===94&&"_hiddenFootnoteSupport"in s.parser.constructs?r(c):t(c)}}const Bh={name:"lineEnding",tokenize:gj};function gj(e,t){return r;function r(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),ht(e,t,"linePrefix")}}const Au={name:"thematicBreak",tokenize:yj};function yj(e,t,r){let s=0,l;return o;function o(m){return e.enter("thematicBreak"),c(m)}function c(m){return l=m,f(m)}function f(m){return m===l?(e.enter("thematicBreakSequence"),d(m)):s>=3&&(m===null||He(m))?(e.exit("thematicBreak"),t(m)):r(m)}function d(m){return m===l?(e.consume(m),s++,d):(e.exit("thematicBreakSequence"),at(m)?ht(e,f,"whitespace")(m):f(m))}}const Yn={continuation:{tokenize:wj},exit:_j,name:"list",tokenize:vj},bj={partial:!0,tokenize:kj},xj={partial:!0,tokenize:Sj};function vj(e,t,r){const s=this,l=s.events[s.events.length-1];let o=l&&l[1].type==="linePrefix"?l[2].sliceSerialize(l[1],!0).length:0,c=0;return f;function f(v){const S=s.containerState.type||(v===42||v===43||v===45?"listUnordered":"listOrdered");if(S==="listUnordered"?!s.containerState.marker||v===s.containerState.marker:Sd(v)){if(s.containerState.type||(s.containerState.type=S,e.enter(S,{_container:!0})),S==="listUnordered")return e.enter("listItemPrefix"),v===42||v===45?e.check(Au,r,m)(v):m(v);if(!s.interrupt||v===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),d(v)}return r(v)}function d(v){return Sd(v)&&++c<10?(e.consume(v),d):(!s.interrupt||c<2)&&(s.containerState.marker?v===s.containerState.marker:v===41||v===46)?(e.exit("listItemValue"),m(v)):r(v)}function m(v){return e.enter("listItemMarker"),e.consume(v),e.exit("listItemMarker"),s.containerState.marker=s.containerState.marker||v,e.check(Xl,s.interrupt?r:y,e.attempt(bj,x,g))}function y(v){return s.containerState.initialBlankLine=!0,o++,x(v)}function g(v){return at(v)?(e.enter("listItemPrefixWhitespace"),e.consume(v),e.exit("listItemPrefixWhitespace"),x):r(v)}function x(v){return s.containerState.size=o+s.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(v)}}function wj(e,t,r){const s=this;return s.containerState._closeFlow=void 0,e.check(Xl,l,o);function l(f){return s.containerState.furtherBlankLines=s.containerState.furtherBlankLines||s.containerState.initialBlankLine,ht(e,t,"listItemIndent",s.containerState.size+1)(f)}function o(f){return s.containerState.furtherBlankLines||!at(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(xj,t,c)(f))}function c(f){return s.containerState._closeFlow=!0,s.interrupt=void 0,ht(e,e.attempt(Yn,t,r),"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(f)}}function Sj(e,t,r){const s=this;return ht(e,l,"listItemIndent",s.containerState.size+1);function l(o){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(o):r(o)}}function _j(e){e.exit(this.containerState.type)}function kj(e,t,r){const s=this;return ht(e,l,"listItemPrefixWhitespace",s.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function l(o){const c=s.events[s.events.length-1];return!at(o)&&c&&c[1].type==="listItemPrefixWhitespace"?t(o):r(o)}}const xb={name:"setextUnderline",resolveTo:Ej,tokenize:Cj};function Ej(e,t){let r=e.length,s,l,o;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),!o&&e[r][1].type==="definition"&&(o=r);const c={type:"setextHeading",start:{...e[s][1].start},end:{...e[e.length-1][1].end}};return e[l][1].type="setextHeadingText",o?(e.splice(l,0,["enter",c,t]),e.splice(o+1,0,["exit",e[s][1],t]),e[s][1].end={...e[o][1].end}):e[s][1]=c,e.push(["exit",c,t]),e}function Cj(e,t,r){const s=this;let l;return o;function o(m){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=m,c(m)):r(m)}function c(m){return e.enter("setextHeadingLineSequence"),f(m)}function f(m){return m===l?(e.consume(m),f):(e.exit("setextHeadingLineSequence"),at(m)?ht(e,d,"lineSuffix")(m):d(m))}function d(m){return m===null||He(m)?(e.exit("setextHeadingLine"),t(m)):r(m)}}const Aj={tokenize:jj};function jj(e){const t=this,r=e.attempt(Xl,s,e.attempt(this.parser.constructs.flowInitial,l,ht(e,e.attempt(this.parser.constructs.flow,l,e.attempt(MA,l)),"linePrefix")));return r;function s(o){if(o===null){e.consume(o);return}return e.enter("lineEndingBlank"),e.consume(o),e.exit("lineEndingBlank"),t.currentConstruct=void 0,r}function l(o){if(o===null){e.consume(o);return}return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),t.currentConstruct=void 0,r}}const Nj={resolveAll:d1()},Tj=h1("string"),Oj=h1("text");function h1(e){return{resolveAll:d1(e==="text"?Rj:void 0),tokenize:t};function t(r){const s=this,l=this.parser.constructs[e],o=r.attempt(l,c,f);return c;function c(y){return m(y)?o(y):f(y)}function f(y){if(y===null){r.consume(y);return}return r.enter("data"),r.consume(y),d}function d(y){return m(y)?(r.exit("data"),o(y)):(r.consume(y),d)}function m(y){if(y===null)return!0;const g=l[y];let x=-1;if(g)for(;++x<g.length;){const v=g[x];if(!v.previous||v.previous.call(s,s.previous))return!0}return!1}}}function d1(e){return t;function t(r,s){let l=-1,o;for(;++l<=r.length;)o===void 0?r[l]&&r[l][1].type==="data"&&(o=l,l++):(!r[l]||r[l][1].type!=="data")&&(l!==o+2&&(r[o][1].end=r[l-1][1].end,r.splice(o+2,l-o-2),l=o+2),o=void 0);return e?e(r,s):r}}function Rj(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 o=l.length,c=-1,f=0,d;for(;o--;){const m=l[o];if(typeof m=="string"){for(c=m.length;m.charCodeAt(c-1)===32;)f++,c--;if(c)break;c=-1}else if(m===-2)d=!0,f++;else if(m!==-1){o++;break}}if(t._contentTypeTextTrailing&&r===e.length&&(f=0),f){const m={type:r===e.length||d||f<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:o?c:s.start._bufferIndex+c,_index:s.start._index+o,line:s.end.line,column:s.end.column-f,offset:s.end.offset-f},end:{...s.end}};s.end={...m.start},s.start.offset===s.end.offset?Object.assign(s,m):(e.splice(r,0,["enter",m,t],["exit",m,t]),r+=2)}r++}return e}const Mj={42:Yn,43:Yn,45:Yn,48:Yn,49:Yn,50:Yn,51:Yn,52:Yn,53:Yn,54:Yn,55:Yn,56:Yn,57:Yn,62:s1},Dj={91:PA},Lj={[-2]:Ph,[-1]:Ph,32:Ph},zj={35:$A,42:Au,45:[xb,Au],60:JA,61:xb,95:Au,96:yb,126:yb},Uj={38:l1,92:a1},Pj={[-5]:Bh,[-4]:Bh,[-3]:Bh,33:hj,38:l1,42:_d,60:[mA,tj],91:mj,92:[IA,a1],93:nm,95:_d,96:AA},Bj={null:[_d,Nj]},Hj={null:[42,95]},qj={null:[]},Ij=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:Hj,contentInitial:Dj,disable:qj,document:Mj,flow:zj,flowInitial:Lj,insideSpan:Bj,string:Uj,text:Pj},Symbol.toStringTag,{value:"Module"}));function Fj(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={},o=[];let c=[],f=[];const d={attempt:Z(B),check:Z(D),consume:P,enter:I,exit:W,interrupt:Z(D,{interrupt:!0})},m={code:null,containerState:{},defineSkip:A,events:[],now:S,parser:e,previous:null,sliceSerialize:x,sliceStream:v,write:g};let y=t.tokenize.call(m,d);return t.resolveAll&&o.push(t),m;function g(X){return c=kr(c,X),M(),c[c.length-1]!==null?[]:($(t,0),m.events=ec(o,m.events,m),m.events)}function x(X,G){return Vj(v(X),G)}function v(X){return $j(c,X)}function S(){const{_bufferIndex:X,_index:G,line:ce,column:oe,offset:re}=s;return{_bufferIndex:X,_index:G,line:ce,column:oe,offset:re}}function A(X){l[X.line]=X.column,L()}function M(){let X;for(;s._index<c.length;){const G=c[s._index];if(typeof G=="string")for(X=s._index,s._bufferIndex<0&&(s._bufferIndex=0);s._index===X&&s._bufferIndex<G.length;)T(G.charCodeAt(s._bufferIndex));else T(G)}}function T(X){y=y(X)}function P(X){He(X)?(s.line++,s.column=1,s.offset+=X===-3?2:1,L()):X!==-1&&(s.column++,s.offset++),s._bufferIndex<0?s._index++:(s._bufferIndex++,s._bufferIndex===c[s._index].length&&(s._bufferIndex=-1,s._index++)),m.previous=X}function I(X,G){const ce=G||{};return ce.type=X,ce.start=S(),m.events.push(["enter",ce,m]),f.push(ce),ce}function W(X){const G=f.pop();return G.end=S(),m.events.push(["exit",G,m]),G}function B(X,G){$(X,G.from)}function D(X,G){G.restore()}function Z(X,G){return ce;function ce(oe,re,F){let q,le,be,O;return Array.isArray(oe)?ee(oe):"tokenize"in oe?ee([oe]):U(oe);function U(_e){return Ee;function Ee(Ve){const je=Ve!==null&&_e[Ve],dt=Ve!==null&&_e.null,qt=[...Array.isArray(je)?je:je?[je]:[],...Array.isArray(dt)?dt:dt?[dt]:[]];return ee(qt)(Ve)}}function ee(_e){return q=_e,le=0,_e.length===0?F:j(_e[le])}function j(_e){return Ee;function Ee(Ve){return O=V(),be=_e,_e.partial||(m.currentConstruct=_e),_e.name&&m.parser.constructs.disable.null.includes(_e.name)?Ce():_e.tokenize.call(G?Object.assign(Object.create(m),G):m,d,ie,Ce)(Ve)}}function ie(_e){return X(be,O),re}function Ce(_e){return O.restore(),++le<q.length?j(q[le]):F}}}function $(X,G){X.resolveAll&&!o.includes(X)&&o.push(X),X.resolve&&ur(m.events,G,m.events.length-G,X.resolve(m.events.slice(G),m)),X.resolveTo&&(m.events=X.resolveTo(m.events,m))}function V(){const X=S(),G=m.previous,ce=m.currentConstruct,oe=m.events.length,re=Array.from(f);return{from:oe,restore:F};function F(){s=X,m.previous=G,m.currentConstruct=ce,m.events.length=oe,f=re,L()}}function L(){s.line in l&&s.column<2&&(s.column=l[s.line],s.offset+=l[s.line]-1)}}function $j(e,t){const r=t.start._index,s=t.start._bufferIndex,l=t.end._index,o=t.end._bufferIndex;let c;if(r===l)c=[e[r].slice(s,o)];else{if(c=e.slice(r,l),s>-1){const f=c[0];typeof f=="string"?c[0]=f.slice(s):c.shift()}o>0&&c.push(e[l].slice(0,o))}return c}function Vj(e,t){let r=-1;const s=[];let l;for(;++r<e.length;){const o=e[r];let c;if(typeof o=="string")c=o;else switch(o){case-5:{c="\r";break}case-4:{c=`
95
95
  `;break}case-3:{c=`\r
96
- `;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 $j(e){const s={constructs:s1([Hj,...(e||{}).extensions||[]]),content:l(sA),defined:[],document:l(lA),flow:l(Ej),lazy:{},string:l(jj),text:l(Nj)};return s;function l(u){return c;function c(f){return qj(s,u,f)}}}function Vj(e){for(;!c1(e););return e}const xb=/[\0\t\n\r]/g;function Yj(){let e=1,t="",r=!0,s;return l;function l(u,c,f){const d=[];let m,y,g,x,v;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(xb.lastIndex=g,m=xb.exec(u),x=m&&m.index!==void 0?m.index:u.length,v=u.charCodeAt(x),!m){t=u.slice(g);break}if(v===10&&g===x&&s)d.push(-3),s=void 0;else switch(s&&(d.push(-5),s=void 0),g<x&&(d.push(u.slice(g,x)),e+=x-g),v){case 0:{d.push(65533),e++;break}case 9:{for(y=Math.ceil(e/4)*4,d.push(-2);e++<y;)d.push(-1);break}case 10:{d.push(-4),e=1;break}default:s=!0,e=1}g=x+1}return f&&(s&&d.push(-5),t&&d.push(t),d.push(null)),d}}const Gj=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function Jj(e){return e.replace(Gj,Xj)}function Xj(e,t,r){if(t)return t;if(r.charCodeAt(0)===35){const l=r.charCodeAt(1),u=l===120||l===88;return a1(r.slice(u?2:1),u?16:10)}return tm(r)||e}const g1={}.hasOwnProperty;function Kj(e,t,r){return t&&typeof t=="object"&&(r=t,t=void 0),Qj(r)(Vj($j(r).document().write(Yj()(e,t,!0))))}function Qj(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:u(ct),autolinkProtocol:V,autolinkEmail:V,atxHeading:u(on),blockQuote:u(dt),characterEscape:V,characterReference:V,codeFenced:u(qt),codeFencedFenceInfo:c,codeFencedFenceMeta:c,codeIndented:u(qt,c),codeText:u(ln,c),codeTextData:V,data:V,codeFlowValue:V,definition:u(tn),definitionDestinationString:c,definitionLabelString:c,definitionTitleString:c,emphasis:u(Gt),hardBreakEscape:u(Rt),hardBreakTrailing:u(Rt),htmlFlow:u(Kt,c),htmlFlowData:V,htmlText:u(Kt,c),htmlTextData:V,image:u(Pe),label:c,link:u(ct),listItem:u(bt),listItemValue:x,listOrdered:u(Ke,g),listUnordered:u(Ke),paragraph:u(zt),reference:_,referenceString:c,resourceDestinationString:c,resourceTitleString:c,setextHeading:u(on),strong:u(Pn),thematicBreak:u(Tn)},exit:{atxHeading:d(),atxHeadingSequence:B,autolink:d(),autolinkEmail:Ae,autolinkProtocol:Ve,blockQuote:d(),characterEscapeValue:L,characterReferenceMarkerHexadecimal:Ce,characterReferenceMarkerNumeric:Ce,characterReferenceValue:we,characterReference:Te,codeFenced:d(D),codeFencedFence:j,codeFencedFenceInfo:v,codeFencedFenceMeta:S,codeFlowValue:L,codeIndented:d(T),codeText:d(re),codeTextData:L,data:L,definition:d(),definitionDestinationString:W,definitionLabelString:P,definitionTitleString:I,emphasis:d(),hardBreakEscape:d(G),hardBreakTrailing:d(G),htmlFlow:d(ue),htmlFlowData:L,htmlText:d(le),htmlTextData:L,image:d(q),label:be,labelText:ae,lineEnding:X,link:d($),listItem:d(),listOrdered:d(),listUnordered:d(),paragraph:d(),referenceString:ge,resourceDestinationString:M,resourceTitleString:U,resource:ee,setextHeading:d(F),setextHeadingLineSequence:Z,setextHeadingText:R,strong:d(),thematicBreak:d()}};y1(t,(e||{}).mdastExtensions||[]);const r={};return s;function s(ce){let _e={type:"root",children:[]};const Le={stack:[_e],tokenStack:[],config:t,enter:f,exit:m,buffer:c,resume:y,data:r},Ge=[];let et=-1;for(;++et<ce.length;)if(ce[et][1].type==="listOrdered"||ce[et][1].type==="listUnordered")if(ce[et][0]==="enter")Ge.push(et);else{const un=Ge.pop();et=l(ce,un,et)}for(et=-1;++et<ce.length;){const un=t[ce[et][0]];g1.call(un,ce[et][1].type)&&un[ce[et][1].type].call(Object.assign({sliceSerialize:ce[et][2].sliceSerialize},Le),ce[et][1])}if(Le.tokenStack.length>0){const un=Le.tokenStack[Le.tokenStack.length-1];(un[1]||vb).call(Le,void 0,un[0])}for(_e.position={start:Ii(ce.length>0?ce[0][1].start:{line:1,column:1,offset:0}),end:Ii(ce.length>0?ce[ce.length-2][1].end:{line:1,column:1,offset:0})},et=-1;++et<t.transforms.length;)_e=t.transforms[et](_e)||_e;return _e}function l(ce,_e,Le){let Ge=_e-1,et=-1,un=!1,vn,Ct,xt,Jt;for(;++Ge<=Le;){const nt=ce[Ge];switch(nt[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{nt[0]==="enter"?et++:et--,Jt=void 0;break}case"lineEndingBlank":{nt[0]==="enter"&&(vn&&!Jt&&!et&&!xt&&(xt=Ge),Jt=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Jt=void 0}if(!et&&nt[0]==="enter"&&nt[1].type==="listItemPrefix"||et===-1&&nt[0]==="exit"&&(nt[1].type==="listUnordered"||nt[1].type==="listOrdered")){if(vn){let ve=Ge;for(Ct=void 0;ve--;){const Be=ce[ve];if(Be[1].type==="lineEnding"||Be[1].type==="lineEndingBlank"){if(Be[0]==="exit")continue;Ct&&(ce[Ct][1].type="lineEndingBlank",un=!0),Be[1].type="lineEnding",Ct=ve}else if(!(Be[1].type==="linePrefix"||Be[1].type==="blockQuotePrefix"||Be[1].type==="blockQuotePrefixWhitespace"||Be[1].type==="blockQuoteMarker"||Be[1].type==="listItemIndent"))break}xt&&(!Ct||xt<Ct)&&(vn._spread=!0),vn.end=Object.assign({},Ct?ce[Ct][1].start:nt[1].end),ce.splice(Ct||Ge,0,["exit",vn,nt[2]]),Ge++,Le++}if(nt[1].type==="listItemPrefix"){const ve={type:"listItem",_spread:!1,start:Object.assign({},nt[1].start),end:void 0};vn=ve,ce.splice(Ge,0,["enter",ve,nt[2]]),Ge++,Le++,xt=void 0,Jt=!0}}}return ce[_e][1]._spread=un,Le}function u(ce,_e){return Le;function Le(Ge){f.call(this,ce(Ge),Ge),_e&&_e.call(this,Ge)}}function c(){this.stack.push({type:"fragment",children:[]})}function f(ce,_e,Le){this.stack[this.stack.length-1].children.push(ce),this.stack.push(ce),this.tokenStack.push([_e,Le||void 0]),ce.position={start:Ii(_e.start),end:void 0}}function d(ce){return _e;function _e(Le){ce&&ce.call(this,Le),m.call(this,Le)}}function m(ce,_e){const Le=this.stack.pop(),Ge=this.tokenStack.pop();if(Ge)Ge[0].type!==ce.type&&(_e?_e.call(this,ce,Ge[0]):(Ge[1]||vb).call(this,ce,Ge[0]));else throw new Error("Cannot close `"+ce.type+"` ("+Ml({start:ce.start,end:ce.end})+"): it’s not open");Le.position.end=Ii(ce.end)}function y(){return em(this.stack.pop())}function g(){this.data.expectingFirstListItemValue=!0}function x(ce){if(this.data.expectingFirstListItemValue){const _e=this.stack[this.stack.length-2];_e.start=Number.parseInt(this.sliceSerialize(ce),10),this.data.expectingFirstListItemValue=void 0}}function v(){const ce=this.resume(),_e=this.stack[this.stack.length-1];_e.lang=ce}function S(){const ce=this.resume(),_e=this.stack[this.stack.length-1];_e.meta=ce}function j(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function D(){const ce=this.resume(),_e=this.stack[this.stack.length-1];_e.value=ce.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function T(){const ce=this.resume(),_e=this.stack[this.stack.length-1];_e.value=ce.replace(/(\r?\n|\r)$/g,"")}function P(ce){const _e=this.resume(),Le=this.stack[this.stack.length-1];Le.label=_e,Le.identifier=Dr(this.sliceSerialize(ce)).toLowerCase()}function I(){const ce=this.resume(),_e=this.stack[this.stack.length-1];_e.title=ce}function W(){const ce=this.resume(),_e=this.stack[this.stack.length-1];_e.url=ce}function B(ce){const _e=this.stack[this.stack.length-1];if(!_e.depth){const Le=this.sliceSerialize(ce).length;_e.depth=Le}}function R(){this.data.setextHeadingSlurpLineEnding=!0}function Z(ce){const _e=this.stack[this.stack.length-1];_e.depth=this.sliceSerialize(ce).codePointAt(0)===61?1:2}function F(){this.data.setextHeadingSlurpLineEnding=void 0}function V(ce){const Le=this.stack[this.stack.length-1].children;let Ge=Le[Le.length-1];(!Ge||Ge.type!=="text")&&(Ge=$e(),Ge.position={start:Ii(ce.start),end:void 0},Le.push(Ge)),this.stack.push(Ge)}function L(ce){const _e=this.stack.pop();_e.value+=this.sliceSerialize(ce),_e.position.end=Ii(ce.end)}function X(ce){const _e=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Le=_e.children[_e.children.length-1];Le.position.end=Ii(ce.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(_e.type)&&(V.call(this,ce),L.call(this,ce))}function G(){this.data.atHardBreak=!0}function ue(){const ce=this.resume(),_e=this.stack[this.stack.length-1];_e.value=ce}function le(){const ce=this.resume(),_e=this.stack[this.stack.length-1];_e.value=ce}function re(){const ce=this.resume(),_e=this.stack[this.stack.length-1];_e.value=ce}function $(){const ce=this.stack[this.stack.length-1];if(this.data.inReference){const _e=this.data.referenceType||"shortcut";ce.type+="Reference",ce.referenceType=_e,delete ce.url,delete ce.title}else delete ce.identifier,delete ce.label;this.data.referenceType=void 0}function q(){const ce=this.stack[this.stack.length-1];if(this.data.inReference){const _e=this.data.referenceType||"shortcut";ce.type+="Reference",ce.referenceType=_e,delete ce.url,delete ce.title}else delete ce.identifier,delete ce.label;this.data.referenceType=void 0}function ae(ce){const _e=this.sliceSerialize(ce),Le=this.stack[this.stack.length-2];Le.label=Jj(_e),Le.identifier=Dr(_e).toLowerCase()}function be(){const ce=this.stack[this.stack.length-1],_e=this.resume(),Le=this.stack[this.stack.length-1];if(this.data.inReference=!0,Le.type==="link"){const Ge=ce.children;Le.children=Ge}else Le.alt=_e}function M(){const ce=this.resume(),_e=this.stack[this.stack.length-1];_e.url=ce}function U(){const ce=this.resume(),_e=this.stack[this.stack.length-1];_e.title=ce}function ee(){this.data.inReference=void 0}function _(){this.data.referenceType="collapsed"}function ge(ce){const _e=this.resume(),Le=this.stack[this.stack.length-1];Le.label=_e,Le.identifier=Dr(this.sliceSerialize(ce)).toLowerCase(),this.data.referenceType="full"}function Ce(ce){this.data.characterReferenceType=ce.type}function we(ce){const _e=this.sliceSerialize(ce),Le=this.data.characterReferenceType;let Ge;Le?(Ge=a1(_e,Le==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Ge=tm(_e);const et=this.stack[this.stack.length-1];et.value+=Ge}function Te(ce){const _e=this.stack.pop();_e.position.end=Ii(ce.end)}function Ve(ce){L.call(this,ce);const _e=this.stack[this.stack.length-1];_e.url=this.sliceSerialize(ce)}function Ae(ce){L.call(this,ce);const _e=this.stack[this.stack.length-1];_e.url="mailto:"+this.sliceSerialize(ce)}function dt(){return{type:"blockquote",children:[]}}function qt(){return{type:"code",lang:null,meta:null,value:""}}function ln(){return{type:"inlineCode",value:""}}function tn(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Gt(){return{type:"emphasis",children:[]}}function on(){return{type:"heading",depth:0,children:[]}}function Rt(){return{type:"break"}}function Kt(){return{type:"html",value:""}}function Pe(){return{type:"image",title:null,url:"",alt:null}}function ct(){return{type:"link",title:null,url:"",children:[]}}function Ke(ce){return{type:"list",ordered:ce.type==="listOrdered",start:null,spread:ce._spread,children:[]}}function bt(ce){return{type:"listItem",spread:ce._spread,checked:null,children:[]}}function zt(){return{type:"paragraph",children:[]}}function Pn(){return{type:"strong",children:[]}}function $e(){return{type:"text",value:""}}function Tn(){return{type:"thematicBreak"}}}function Ii(e){return{line:e.line,column:e.column,offset:e.offset}}function y1(e,t){let r=-1;for(;++r<t.length;){const s=t[r];Array.isArray(s)?y1(e,s):Zj(e,s)}}function Zj(e,t){let r;for(r in t)if(g1.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 vb(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Ml({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Ml({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Ml({start:t.start,end:t.end})+") is still open")}function Wj(e){const t=this;t.parser=r;function r(s){return Kj(s,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function eN(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 tN(e,t){const r={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,r),[e.applyData(t,r),{type:"text",value:`
97
- `}]}function nN(e,t){const r=t.value?t.value+`
98
- `:"",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 rN(e,t){const r={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function iN(e,t){const r={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function sN(e,t){const r=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",s=String(t.identifier).toUpperCase(),l=Aa(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 d={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,d);const m={type:"element",tagName:"sup",properties:{},children:[d]};return e.patch(t,m),e.applyData(t,m)}function aN(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 lN(e,t){if(e.options.allowDangerousHtml){const r={type:"raw",value:t.value};return e.patch(t,r),e.applyData(t,r)}}function b1(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 oN(e,t){const r=String(t.identifier).toUpperCase(),s=e.definitionById.get(r);if(!s)return b1(e,t);const l={src:Aa(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 uN(e,t){const r={src:Aa(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 cN(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 fN(e,t){const r=String(t.identifier).toUpperCase(),s=e.definitionById.get(r);if(!s)return b1(e,t);const l={href:Aa(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 hN(e,t){const r={href:Aa(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 dN(e,t,r){const s=e.all(t),l=r?mN(r):x1(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:`
96
+ `;break}case-2:{c=t?" ":" ";break}case-1:{if(!t&&l)continue;c=" ";break}default:c=String.fromCharCode(o)}l=o===-2,s.push(c)}return s.join("")}function Yj(e){const s={constructs:r1([Ij,...(e||{}).extensions||[]]),content:l(lA),defined:[],document:l(uA),flow:l(Aj),lazy:{},string:l(Tj),text:l(Oj)};return s;function l(o){return c;function c(f){return Fj(s,o,f)}}}function Gj(e){for(;!o1(e););return e}const vb=/[\0\t\n\r]/g;function Jj(){let e=1,t="",r=!0,s;return l;function l(o,c,f){const d=[];let m,y,g,x,v;for(o=t+(typeof o=="string"?o.toString():new TextDecoder(c||void 0).decode(o)),g=0,t="",r&&(o.charCodeAt(0)===65279&&g++,r=void 0);g<o.length;){if(vb.lastIndex=g,m=vb.exec(o),x=m&&m.index!==void 0?m.index:o.length,v=o.charCodeAt(x),!m){t=o.slice(g);break}if(v===10&&g===x&&s)d.push(-3),s=void 0;else switch(s&&(d.push(-5),s=void 0),g<x&&(d.push(o.slice(g,x)),e+=x-g),v){case 0:{d.push(65533),e++;break}case 9:{for(y=Math.ceil(e/4)*4,d.push(-2);e++<y;)d.push(-1);break}case 10:{d.push(-4),e=1;break}default:s=!0,e=1}g=x+1}return f&&(s&&d.push(-5),t&&d.push(t),d.push(null)),d}}const Xj=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function Kj(e){return e.replace(Xj,Qj)}function Qj(e,t,r){if(t)return t;if(r.charCodeAt(0)===35){const l=r.charCodeAt(1),o=l===120||l===88;return i1(r.slice(o?2:1),o?16:10)}return tm(r)||e}const m1={}.hasOwnProperty;function Zj(e,t,r){return t&&typeof t=="object"&&(r=t,t=void 0),Wj(r)(Gj(Yj(r).document().write(Jj()(e,t,!0))))}function Wj(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:o(ct),autolinkProtocol:V,autolinkEmail:V,atxHeading:o(on),blockQuote:o(dt),characterEscape:V,characterReference:V,codeFenced:o(qt),codeFencedFenceInfo:c,codeFencedFenceMeta:c,codeIndented:o(qt,c),codeText:o(ln,c),codeTextData:V,data:V,codeFlowValue:V,definition:o(tn),definitionDestinationString:c,definitionLabelString:c,definitionTitleString:c,emphasis:o(Gt),hardBreakEscape:o(Rt),hardBreakTrailing:o(Rt),htmlFlow:o(Kt,c),htmlFlowData:V,htmlText:o(Kt,c),htmlTextData:V,image:o(Pe),label:c,link:o(ct),listItem:o(bt),listItemValue:x,listOrdered:o(Ke,g),listUnordered:o(Ke),paragraph:o(zt),reference:j,referenceString:c,resourceDestinationString:c,resourceTitleString:c,setextHeading:o(on),strong:o(Pn),thematicBreak:o(Tn)},exit:{atxHeading:d(),atxHeadingSequence:B,autolink:d(),autolinkEmail:je,autolinkProtocol:Ve,blockQuote:d(),characterEscapeValue:L,characterReferenceMarkerHexadecimal:Ce,characterReferenceMarkerNumeric:Ce,characterReferenceValue:_e,characterReference:Ee,codeFenced:d(M),codeFencedFence:A,codeFencedFenceInfo:v,codeFencedFenceMeta:S,codeFlowValue:L,codeIndented:d(T),codeText:d(re),codeTextData:L,data:L,definition:d(),definitionDestinationString:W,definitionLabelString:P,definitionTitleString:I,emphasis:d(),hardBreakEscape:d(G),hardBreakTrailing:d(G),htmlFlow:d(ce),htmlFlowData:L,htmlText:d(oe),htmlTextData:L,image:d(q),label:be,labelText:le,lineEnding:X,link:d(F),listItem:d(),listOrdered:d(),listUnordered:d(),paragraph:d(),referenceString:ie,resourceDestinationString:O,resourceTitleString:U,resource:ee,setextHeading:d($),setextHeadingLineSequence:Z,setextHeadingText:D,strong:d(),thematicBreak:d()}};p1(t,(e||{}).mdastExtensions||[]);const r={};return s;function s(fe){let Se={type:"root",children:[]};const Le={stack:[Se],tokenStack:[],config:t,enter:f,exit:m,buffer:c,resume:y,data:r},Ge=[];let et=-1;for(;++et<fe.length;)if(fe[et][1].type==="listOrdered"||fe[et][1].type==="listUnordered")if(fe[et][0]==="enter")Ge.push(et);else{const un=Ge.pop();et=l(fe,un,et)}for(et=-1;++et<fe.length;){const un=t[fe[et][0]];m1.call(un,fe[et][1].type)&&un[fe[et][1].type].call(Object.assign({sliceSerialize:fe[et][2].sliceSerialize},Le),fe[et][1])}if(Le.tokenStack.length>0){const un=Le.tokenStack[Le.tokenStack.length-1];(un[1]||wb).call(Le,void 0,un[0])}for(Se.position={start:Ii(fe.length>0?fe[0][1].start:{line:1,column:1,offset:0}),end:Ii(fe.length>0?fe[fe.length-2][1].end:{line:1,column:1,offset:0})},et=-1;++et<t.transforms.length;)Se=t.transforms[et](Se)||Se;return Se}function l(fe,Se,Le){let Ge=Se-1,et=-1,un=!1,vn,Ct,xt,Jt;for(;++Ge<=Le;){const nt=fe[Ge];switch(nt[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{nt[0]==="enter"?et++:et--,Jt=void 0;break}case"lineEndingBlank":{nt[0]==="enter"&&(vn&&!Jt&&!et&&!xt&&(xt=Ge),Jt=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Jt=void 0}if(!et&&nt[0]==="enter"&&nt[1].type==="listItemPrefix"||et===-1&&nt[0]==="exit"&&(nt[1].type==="listUnordered"||nt[1].type==="listOrdered")){if(vn){let ve=Ge;for(Ct=void 0;ve--;){const Be=fe[ve];if(Be[1].type==="lineEnding"||Be[1].type==="lineEndingBlank"){if(Be[0]==="exit")continue;Ct&&(fe[Ct][1].type="lineEndingBlank",un=!0),Be[1].type="lineEnding",Ct=ve}else if(!(Be[1].type==="linePrefix"||Be[1].type==="blockQuotePrefix"||Be[1].type==="blockQuotePrefixWhitespace"||Be[1].type==="blockQuoteMarker"||Be[1].type==="listItemIndent"))break}xt&&(!Ct||xt<Ct)&&(vn._spread=!0),vn.end=Object.assign({},Ct?fe[Ct][1].start:nt[1].end),fe.splice(Ct||Ge,0,["exit",vn,nt[2]]),Ge++,Le++}if(nt[1].type==="listItemPrefix"){const ve={type:"listItem",_spread:!1,start:Object.assign({},nt[1].start),end:void 0};vn=ve,fe.splice(Ge,0,["enter",ve,nt[2]]),Ge++,Le++,xt=void 0,Jt=!0}}}return fe[Se][1]._spread=un,Le}function o(fe,Se){return Le;function Le(Ge){f.call(this,fe(Ge),Ge),Se&&Se.call(this,Ge)}}function c(){this.stack.push({type:"fragment",children:[]})}function f(fe,Se,Le){this.stack[this.stack.length-1].children.push(fe),this.stack.push(fe),this.tokenStack.push([Se,Le||void 0]),fe.position={start:Ii(Se.start),end:void 0}}function d(fe){return Se;function Se(Le){fe&&fe.call(this,Le),m.call(this,Le)}}function m(fe,Se){const Le=this.stack.pop(),Ge=this.tokenStack.pop();if(Ge)Ge[0].type!==fe.type&&(Se?Se.call(this,fe,Ge[0]):(Ge[1]||wb).call(this,fe,Ge[0]));else throw new Error("Cannot close `"+fe.type+"` ("+Ml({start:fe.start,end:fe.end})+"): it’s not open");Le.position.end=Ii(fe.end)}function y(){return em(this.stack.pop())}function g(){this.data.expectingFirstListItemValue=!0}function x(fe){if(this.data.expectingFirstListItemValue){const Se=this.stack[this.stack.length-2];Se.start=Number.parseInt(this.sliceSerialize(fe),10),this.data.expectingFirstListItemValue=void 0}}function v(){const fe=this.resume(),Se=this.stack[this.stack.length-1];Se.lang=fe}function S(){const fe=this.resume(),Se=this.stack[this.stack.length-1];Se.meta=fe}function A(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function M(){const fe=this.resume(),Se=this.stack[this.stack.length-1];Se.value=fe.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function T(){const fe=this.resume(),Se=this.stack[this.stack.length-1];Se.value=fe.replace(/(\r?\n|\r)$/g,"")}function P(fe){const Se=this.resume(),Le=this.stack[this.stack.length-1];Le.label=Se,Le.identifier=Dr(this.sliceSerialize(fe)).toLowerCase()}function I(){const fe=this.resume(),Se=this.stack[this.stack.length-1];Se.title=fe}function W(){const fe=this.resume(),Se=this.stack[this.stack.length-1];Se.url=fe}function B(fe){const Se=this.stack[this.stack.length-1];if(!Se.depth){const Le=this.sliceSerialize(fe).length;Se.depth=Le}}function D(){this.data.setextHeadingSlurpLineEnding=!0}function Z(fe){const Se=this.stack[this.stack.length-1];Se.depth=this.sliceSerialize(fe).codePointAt(0)===61?1:2}function $(){this.data.setextHeadingSlurpLineEnding=void 0}function V(fe){const Le=this.stack[this.stack.length-1].children;let Ge=Le[Le.length-1];(!Ge||Ge.type!=="text")&&(Ge=$e(),Ge.position={start:Ii(fe.start),end:void 0},Le.push(Ge)),this.stack.push(Ge)}function L(fe){const Se=this.stack.pop();Se.value+=this.sliceSerialize(fe),Se.position.end=Ii(fe.end)}function X(fe){const Se=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Le=Se.children[Se.children.length-1];Le.position.end=Ii(fe.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(Se.type)&&(V.call(this,fe),L.call(this,fe))}function G(){this.data.atHardBreak=!0}function ce(){const fe=this.resume(),Se=this.stack[this.stack.length-1];Se.value=fe}function oe(){const fe=this.resume(),Se=this.stack[this.stack.length-1];Se.value=fe}function re(){const fe=this.resume(),Se=this.stack[this.stack.length-1];Se.value=fe}function F(){const fe=this.stack[this.stack.length-1];if(this.data.inReference){const Se=this.data.referenceType||"shortcut";fe.type+="Reference",fe.referenceType=Se,delete fe.url,delete fe.title}else delete fe.identifier,delete fe.label;this.data.referenceType=void 0}function q(){const fe=this.stack[this.stack.length-1];if(this.data.inReference){const Se=this.data.referenceType||"shortcut";fe.type+="Reference",fe.referenceType=Se,delete fe.url,delete fe.title}else delete fe.identifier,delete fe.label;this.data.referenceType=void 0}function le(fe){const Se=this.sliceSerialize(fe),Le=this.stack[this.stack.length-2];Le.label=Kj(Se),Le.identifier=Dr(Se).toLowerCase()}function be(){const fe=this.stack[this.stack.length-1],Se=this.resume(),Le=this.stack[this.stack.length-1];if(this.data.inReference=!0,Le.type==="link"){const Ge=fe.children;Le.children=Ge}else Le.alt=Se}function O(){const fe=this.resume(),Se=this.stack[this.stack.length-1];Se.url=fe}function U(){const fe=this.resume(),Se=this.stack[this.stack.length-1];Se.title=fe}function ee(){this.data.inReference=void 0}function j(){this.data.referenceType="collapsed"}function ie(fe){const Se=this.resume(),Le=this.stack[this.stack.length-1];Le.label=Se,Le.identifier=Dr(this.sliceSerialize(fe)).toLowerCase(),this.data.referenceType="full"}function Ce(fe){this.data.characterReferenceType=fe.type}function _e(fe){const Se=this.sliceSerialize(fe),Le=this.data.characterReferenceType;let Ge;Le?(Ge=i1(Se,Le==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Ge=tm(Se);const et=this.stack[this.stack.length-1];et.value+=Ge}function Ee(fe){const Se=this.stack.pop();Se.position.end=Ii(fe.end)}function Ve(fe){L.call(this,fe);const Se=this.stack[this.stack.length-1];Se.url=this.sliceSerialize(fe)}function je(fe){L.call(this,fe);const Se=this.stack[this.stack.length-1];Se.url="mailto:"+this.sliceSerialize(fe)}function dt(){return{type:"blockquote",children:[]}}function qt(){return{type:"code",lang:null,meta:null,value:""}}function ln(){return{type:"inlineCode",value:""}}function tn(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Gt(){return{type:"emphasis",children:[]}}function on(){return{type:"heading",depth:0,children:[]}}function Rt(){return{type:"break"}}function Kt(){return{type:"html",value:""}}function Pe(){return{type:"image",title:null,url:"",alt:null}}function ct(){return{type:"link",title:null,url:"",children:[]}}function Ke(fe){return{type:"list",ordered:fe.type==="listOrdered",start:null,spread:fe._spread,children:[]}}function bt(fe){return{type:"listItem",spread:fe._spread,checked:null,children:[]}}function zt(){return{type:"paragraph",children:[]}}function Pn(){return{type:"strong",children:[]}}function $e(){return{type:"text",value:""}}function Tn(){return{type:"thematicBreak"}}}function Ii(e){return{line:e.line,column:e.column,offset:e.offset}}function p1(e,t){let r=-1;for(;++r<t.length;){const s=t[r];Array.isArray(s)?p1(e,s):eN(e,s)}}function eN(e,t){let r;for(r in t)if(m1.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 wb(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Ml({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Ml({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Ml({start:t.start,end:t.end})+") is still open")}function tN(e){const t=this;t.parser=r;function r(s){return Zj(s,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function nN(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 rN(e,t){const r={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,r),[e.applyData(t,r),{type:"text",value:`
97
+ `}]}function iN(e,t){const r=t.value?t.value+`
98
+ `:"",s={},l=t.lang?t.lang.split(/\s+/):[];l.length>0&&(s.className=["language-"+l[0]]);let o={type:"element",tagName:"code",properties:s,children:[{type:"text",value:r}]};return t.meta&&(o.data={meta:t.meta}),e.patch(t,o),o=e.applyData(t,o),o={type:"element",tagName:"pre",properties:{},children:[o]},e.patch(t,o),o}function sN(e,t){const r={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function aN(e,t){const r={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function lN(e,t){const r=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",s=String(t.identifier).toUpperCase(),l=Aa(s.toLowerCase()),o=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=o+1,f+=1,e.footnoteCounts.set(s,f);const d={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,d);const m={type:"element",tagName:"sup",properties:{},children:[d]};return e.patch(t,m),e.applyData(t,m)}function oN(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 uN(e,t){if(e.options.allowDangerousHtml){const r={type:"raw",value:t.value};return e.patch(t,r),e.applyData(t,r)}}function g1(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),o=l[0];o&&o.type==="text"?o.value="["+o.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 cN(e,t){const r=String(t.identifier).toUpperCase(),s=e.definitionById.get(r);if(!s)return g1(e,t);const l={src:Aa(s.url||""),alt:t.alt};s.title!==null&&s.title!==void 0&&(l.title=s.title);const o={type:"element",tagName:"img",properties:l,children:[]};return e.patch(t,o),e.applyData(t,o)}function fN(e,t){const r={src:Aa(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 hN(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 dN(e,t){const r=String(t.identifier).toUpperCase(),s=e.definitionById.get(r);if(!s)return g1(e,t);const l={href:Aa(s.url||"")};s.title!==null&&s.title!==void 0&&(l.title=s.title);const o={type:"element",tagName:"a",properties:l,children:e.all(t)};return e.patch(t,o),e.applyData(t,o)}function mN(e,t){const r={href:Aa(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 pN(e,t,r){const s=e.all(t),l=r?gN(r):y1(t),o={},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:[]}),o.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:`
99
99
  `}),y.type==="element"&&y.tagName==="p"&&!l?c.push(...y.children):c.push(y)}const d=s[s.length-1];d&&(l||d.type!=="element"||d.tagName!=="p")&&c.push({type:"text",value:`
100
- `});const m={type:"element",tagName:"li",properties:u,children:c};return e.patch(t,m),e.applyData(t,m)}function mN(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=x1(r[s])}return t}function x1(e){const t=e.spread;return t??e.children.length>1}function pN(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 gN(e,t){const r={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function yN(e,t){const r={type:"root",children:e.wrap(e.all(t))};return e.patch(t,r),e.applyData(t,r)}function bN(e,t){const r={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function xN(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=Kd(t.children[1]),d=Zx(t.children[t.children.length-1]);f&&d&&(c.position={start:f,end:d}),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 vN(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 d=-1;const m=[];for(;++d<f;){const g=t.children[d],x={},v=c?c[d]:void 0;v&&(x.align=v);let S={type:"element",tagName:u,properties:x,children:[]};g&&(S.children=e.all(g),e.patch(g,S),S=e.applyData(g,S)),m.push(S)}const y={type:"element",tagName:"tr",properties:{},children:e.wrap(m,!0)};return e.patch(t,y),e.applyData(t,y)}function wN(e,t){const r={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}const wb=9,Sb=32;function SN(e){const t=String(e),r=/\r?\n|\r/g;let s=r.exec(t),l=0;const u=[];for(;s;)u.push(_b(t.slice(l,s.index),l>0,!0),s[0]),l=s.index+s[0].length,s=r.exec(t);return u.push(_b(t.slice(l),l>0,!1)),u.join("")}function _b(e,t,r){let s=0,l=e.length;if(t){let u=e.codePointAt(s);for(;u===wb||u===Sb;)s++,u=e.codePointAt(s)}if(r){let u=e.codePointAt(l-1);for(;u===wb||u===Sb;)l--,u=e.codePointAt(l-1)}return l>s?e.slice(s,l):""}function _N(e,t){const r={type:"text",value:SN(String(t.value))};return e.patch(t,r),e.applyData(t,r)}function kN(e,t){const r={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,r),e.applyData(t,r)}const EN={blockquote:eN,break:tN,code:nN,delete:rN,emphasis:iN,footnoteReference:sN,heading:aN,html:lN,imageReference:oN,image:uN,inlineCode:cN,linkReference:fN,link:hN,listItem:dN,list:pN,paragraph:gN,root:yN,strong:bN,table:xN,tableCell:wN,tableRow:vN,text:_N,thematicBreak:kN,toml:gu,yaml:gu,definition:gu,footnoteDefinition:gu};function gu(){}const v1=-1,tc=0,Ll=1,qu=2,rm=3,im=4,sm=5,am=6,w1=7,S1=8,kb=typeof self=="object"?self:globalThis,CN=(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 tc:case v1:return r(c,l);case Ll:{const f=r([],l);for(const d of c)f.push(s(d));return f}case qu:{const f=r({},l);for(const[d,m]of c)f[s(d)]=s(m);return f}case rm:return r(new Date(c),l);case im:{const{source:f,flags:d}=c;return r(new RegExp(f,d),l)}case sm:{const f=r(new Map,l);for(const[d,m]of c)f.set(s(d),s(m));return f}case am:{const f=r(new Set,l);for(const d of c)f.add(s(d));return f}case w1:{const{name:f,message:d}=c;return r(new kb[f](d),l)}case S1: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 kb[u](c),l)};return s},Eb=e=>CN(new Map,e)(0),sa="",{toString:AN}={},{keys:jN}=Object,kl=e=>{const t=typeof e;if(t!=="object"||!e)return[tc,t];const r=AN.call(e).slice(8,-1);switch(r){case"Array":return[Ll,sa];case"Object":return[qu,sa];case"Date":return[rm,sa];case"RegExp":return[im,sa];case"Map":return[sm,sa];case"Set":return[am,sa];case"DataView":return[Ll,r]}return r.includes("Array")?[Ll,r]:r.includes("Error")?[w1,r]:[qu,r]},yu=([e,t])=>e===tc&&(t==="function"||t==="symbol"),NN=(e,t,r,s)=>{const l=(c,f)=>{const d=s.push(c)-1;return r.set(f,d),d},u=c=>{if(r.has(c))return r.get(c);let[f,d]=kl(c);switch(f){case tc:{let y=c;switch(d){case"bigint":f=S1,y=c.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+d);y=null;break;case"undefined":return l([v1],c)}return l([f,y],c)}case Ll:{if(d){let x=c;return d==="DataView"?x=new Uint8Array(c.buffer):d==="ArrayBuffer"&&(x=new Uint8Array(c)),l([d,[...x]],c)}const y=[],g=l([f,y],c);for(const x of c)y.push(u(x));return g}case qu:{if(d)switch(d){case"BigInt":return l([d,c.toString()],c);case"Boolean":case"Number":case"String":return l([d,c.valueOf()],c)}if(t&&"toJSON"in c)return u(c.toJSON());const y=[],g=l([f,y],c);for(const x of jN(c))(e||!yu(kl(c[x])))&&y.push([u(x),u(c[x])]);return g}case rm:return l([f,c.toISOString()],c);case im:{const{source:y,flags:g}=c;return l([f,{source:y,flags:g}],c)}case sm:{const y=[],g=l([f,y],c);for(const[x,v]of c)(e||!(yu(kl(x))||yu(kl(v))))&&y.push([u(x),u(v)]);return g}case am:{const y=[],g=l([f,y],c);for(const x of c)(e||!yu(kl(x)))&&y.push(u(x));return g}}const{message:m}=c;return l([f,{name:d,message:m}],c)};return u},Cb=(e,{json:t,lossy:r}={})=>{const s=[];return NN(!(t||r),!!t,new Map,s)(e),s},Iu=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?Eb(Cb(e,t)):structuredClone(e):(e,t)=>Eb(Cb(e,t));function TN(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 ON(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function RN(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=e.options.footnoteBackContent||TN,s=e.options.footnoteBackLabel||ON,l=e.options.footnoteLabel||"Footnotes",u=e.options.footnoteLabelTagName||"h2",c=e.options.footnoteLabelProperties||{className:["sr-only"]},f=[];let d=-1;for(;++d<e.footnoteOrder.length;){const m=e.footnoteById.get(e.footnoteOrder[d]);if(!m)continue;const y=e.all(m),g=String(m.identifier).toUpperCase(),x=Aa(g.toLowerCase());let v=0;const S=[],j=e.footnoteCounts.get(g);for(;j!==void 0&&++v<=j;){S.length>0&&S.push({type:"text",value:" "});let P=typeof r=="string"?r:r(d,v);typeof P=="string"&&(P={type:"text",value:P}),S.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+x+(v>1?"-"+v:""),dataFootnoteBackref:"",ariaLabel:typeof s=="string"?s:s(d,v),className:["data-footnote-backref"]},children:Array.isArray(P)?P:[P]})}const D=y[y.length-1];if(D&&D.type==="element"&&D.tagName==="p"){const P=D.children[D.children.length-1];P&&P.type==="text"?P.value+=" ":D.children.push({type:"text",value:" "}),D.children.push(...S)}else y.push(...S);const T={type:"element",tagName:"li",properties:{id:t+"fn-"+x},children:e.wrap(y,!0)};e.patch(m,T),f.push(T)}if(f.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:u,properties:{...Iu(c),id:"footnote-label"},children:[{type:"text",value:l}]},{type:"text",value:`
100
+ `});const m={type:"element",tagName:"li",properties:o,children:c};return e.patch(t,m),e.applyData(t,m)}function gN(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=y1(r[s])}return t}function y1(e){const t=e.spread;return t??e.children.length>1}function yN(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 o={type:"element",tagName:t.ordered?"ol":"ul",properties:r,children:e.wrap(s,!0)};return e.patch(t,o),e.applyData(t,o)}function bN(e,t){const r={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function xN(e,t){const r={type:"root",children:e.wrap(e.all(t))};return e.patch(t,r),e.applyData(t,r)}function vN(e,t){const r={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function wN(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=Kd(t.children[1]),d=Kx(t.children[t.children.length-1]);f&&d&&(c.position={start:f,end:d}),l.push(c)}const o={type:"element",tagName:"table",properties:{},children:e.wrap(l,!0)};return e.patch(t,o),e.applyData(t,o)}function SN(e,t,r){const s=r?r.children:void 0,o=(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 d=-1;const m=[];for(;++d<f;){const g=t.children[d],x={},v=c?c[d]:void 0;v&&(x.align=v);let S={type:"element",tagName:o,properties:x,children:[]};g&&(S.children=e.all(g),e.patch(g,S),S=e.applyData(g,S)),m.push(S)}const y={type:"element",tagName:"tr",properties:{},children:e.wrap(m,!0)};return e.patch(t,y),e.applyData(t,y)}function _N(e,t){const r={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}const Sb=9,_b=32;function kN(e){const t=String(e),r=/\r?\n|\r/g;let s=r.exec(t),l=0;const o=[];for(;s;)o.push(kb(t.slice(l,s.index),l>0,!0),s[0]),l=s.index+s[0].length,s=r.exec(t);return o.push(kb(t.slice(l),l>0,!1)),o.join("")}function kb(e,t,r){let s=0,l=e.length;if(t){let o=e.codePointAt(s);for(;o===Sb||o===_b;)s++,o=e.codePointAt(s)}if(r){let o=e.codePointAt(l-1);for(;o===Sb||o===_b;)l--,o=e.codePointAt(l-1)}return l>s?e.slice(s,l):""}function EN(e,t){const r={type:"text",value:kN(String(t.value))};return e.patch(t,r),e.applyData(t,r)}function CN(e,t){const r={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,r),e.applyData(t,r)}const AN={blockquote:nN,break:rN,code:iN,delete:sN,emphasis:aN,footnoteReference:lN,heading:oN,html:uN,imageReference:cN,image:fN,inlineCode:hN,linkReference:dN,link:mN,listItem:pN,list:yN,paragraph:bN,root:xN,strong:vN,table:wN,tableCell:_N,tableRow:SN,text:EN,thematicBreak:CN,toml:gu,yaml:gu,definition:gu,footnoteDefinition:gu};function gu(){}const b1=-1,tc=0,Ll=1,qu=2,rm=3,im=4,sm=5,am=6,x1=7,v1=8,Eb=typeof self=="object"?self:globalThis,jN=(e,t)=>{const r=(l,o)=>(e.set(o,l),l),s=l=>{if(e.has(l))return e.get(l);const[o,c]=t[l];switch(o){case tc:case b1:return r(c,l);case Ll:{const f=r([],l);for(const d of c)f.push(s(d));return f}case qu:{const f=r({},l);for(const[d,m]of c)f[s(d)]=s(m);return f}case rm:return r(new Date(c),l);case im:{const{source:f,flags:d}=c;return r(new RegExp(f,d),l)}case sm:{const f=r(new Map,l);for(const[d,m]of c)f.set(s(d),s(m));return f}case am:{const f=r(new Set,l);for(const d of c)f.add(s(d));return f}case x1:{const{name:f,message:d}=c;return r(new Eb[f](d),l)}case v1: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 Eb[o](c),l)};return s},Cb=e=>jN(new Map,e)(0),sa="",{toString:NN}={},{keys:TN}=Object,kl=e=>{const t=typeof e;if(t!=="object"||!e)return[tc,t];const r=NN.call(e).slice(8,-1);switch(r){case"Array":return[Ll,sa];case"Object":return[qu,sa];case"Date":return[rm,sa];case"RegExp":return[im,sa];case"Map":return[sm,sa];case"Set":return[am,sa];case"DataView":return[Ll,r]}return r.includes("Array")?[Ll,r]:r.includes("Error")?[x1,r]:[qu,r]},yu=([e,t])=>e===tc&&(t==="function"||t==="symbol"),ON=(e,t,r,s)=>{const l=(c,f)=>{const d=s.push(c)-1;return r.set(f,d),d},o=c=>{if(r.has(c))return r.get(c);let[f,d]=kl(c);switch(f){case tc:{let y=c;switch(d){case"bigint":f=v1,y=c.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+d);y=null;break;case"undefined":return l([b1],c)}return l([f,y],c)}case Ll:{if(d){let x=c;return d==="DataView"?x=new Uint8Array(c.buffer):d==="ArrayBuffer"&&(x=new Uint8Array(c)),l([d,[...x]],c)}const y=[],g=l([f,y],c);for(const x of c)y.push(o(x));return g}case qu:{if(d)switch(d){case"BigInt":return l([d,c.toString()],c);case"Boolean":case"Number":case"String":return l([d,c.valueOf()],c)}if(t&&"toJSON"in c)return o(c.toJSON());const y=[],g=l([f,y],c);for(const x of TN(c))(e||!yu(kl(c[x])))&&y.push([o(x),o(c[x])]);return g}case rm:return l([f,c.toISOString()],c);case im:{const{source:y,flags:g}=c;return l([f,{source:y,flags:g}],c)}case sm:{const y=[],g=l([f,y],c);for(const[x,v]of c)(e||!(yu(kl(x))||yu(kl(v))))&&y.push([o(x),o(v)]);return g}case am:{const y=[],g=l([f,y],c);for(const x of c)(e||!yu(kl(x)))&&y.push(o(x));return g}}const{message:m}=c;return l([f,{name:d,message:m}],c)};return o},Ab=(e,{json:t,lossy:r}={})=>{const s=[];return ON(!(t||r),!!t,new Map,s)(e),s},Iu=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?Cb(Ab(e,t)):structuredClone(e):(e,t)=>Cb(Ab(e,t));function RN(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 MN(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function DN(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=e.options.footnoteBackContent||RN,s=e.options.footnoteBackLabel||MN,l=e.options.footnoteLabel||"Footnotes",o=e.options.footnoteLabelTagName||"h2",c=e.options.footnoteLabelProperties||{className:["sr-only"]},f=[];let d=-1;for(;++d<e.footnoteOrder.length;){const m=e.footnoteById.get(e.footnoteOrder[d]);if(!m)continue;const y=e.all(m),g=String(m.identifier).toUpperCase(),x=Aa(g.toLowerCase());let v=0;const S=[],A=e.footnoteCounts.get(g);for(;A!==void 0&&++v<=A;){S.length>0&&S.push({type:"text",value:" "});let P=typeof r=="string"?r:r(d,v);typeof P=="string"&&(P={type:"text",value:P}),S.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+x+(v>1?"-"+v:""),dataFootnoteBackref:"",ariaLabel:typeof s=="string"?s:s(d,v),className:["data-footnote-backref"]},children:Array.isArray(P)?P:[P]})}const M=y[y.length-1];if(M&&M.type==="element"&&M.tagName==="p"){const P=M.children[M.children.length-1];P&&P.type==="text"?P.value+=" ":M.children.push({type:"text",value:" "}),M.children.push(...S)}else y.push(...S);const T={type:"element",tagName:"li",properties:{id:t+"fn-"+x},children:e.wrap(y,!0)};e.patch(m,T),f.push(T)}if(f.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:o,properties:{...Iu(c),id:"footnote-label"},children:[{type:"text",value:l}]},{type:"text",value:`
101
101
  `},{type:"element",tagName:"ol",properties:{},children:e.wrap(f,!0)},{type:"text",value:`
102
- `}]}}const nc=(function(e){if(e==null)return zN;if(typeof e=="function")return rc(e);if(typeof e=="object")return Array.isArray(e)?MN(e):DN(e);if(typeof e=="string")return LN(e);throw new Error("Expected function, string, or object as test")});function MN(e){const t=[];let r=-1;for(;++r<e.length;)t[r]=nc(e[r]);return rc(s);function s(...l){let u=-1;for(;++u<t.length;)if(t[u].apply(this,l))return!0;return!1}}function DN(e){const t=e;return rc(r);function r(s){const l=s;let u;for(u in e)if(l[u]!==t[u])return!1;return!0}}function LN(e){return rc(t);function t(r){return r&&r.type===e}}function rc(e){return t;function t(r,s,l){return!!(UN(r)&&e.call(this,r,typeof s=="number"?s:void 0,l||void 0))}}function zN(){return!0}function UN(e){return e!==null&&typeof e=="object"&&"type"in e}const _1=[],PN=!0,kd=!1,BN="skip";function k1(e,t,r,s){let l;typeof t=="function"&&typeof r!="function"?(s=r,r=t):l=t;const u=nc(l),c=s?-1:1;f(e,void 0,[])();function f(d,m,y){const g=d&&typeof d=="object"?d:{};if(typeof g.type=="string"){const v=typeof g.tagName=="string"?g.tagName:typeof g.name=="string"?g.name:void 0;Object.defineProperty(x,"name",{value:"node ("+(d.type+(v?"<"+v+">":""))+")"})}return x;function x(){let v=_1,S,j,D;if((!t||u(d,m,y[y.length-1]||void 0))&&(v=HN(r(d,y)),v[0]===kd))return v;if("children"in d&&d.children){const T=d;if(T.children&&v[0]!==BN)for(j=(s?T.children.length:-1)+c,D=y.concat(T);j>-1&&j<T.children.length;){const P=T.children[j];if(S=f(P,j,D)(),S[0]===kd)return S;j=typeof S[1]=="number"?S[1]:j+c}}return v}}}function HN(e){return Array.isArray(e)?e:typeof e=="number"?[PN,e]:e==null?_1:[e]}function lm(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),k1(e,u,f,l);function f(d,m){const y=m[m.length-1],g=y?y.children.indexOf(d):void 0;return c(d,g,y)}}const Ed={}.hasOwnProperty,qN={};function IN(e,t){const r=t||qN,s=new Map,l=new Map,u=new Map,c={...EN,...r.handlers},f={all:m,applyData:$N,definitionById:s,footnoteById:l,footnoteCounts:u,footnoteOrder:[],handlers:c,one:d,options:r,patch:FN,wrap:YN};return lm(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 d(y,g){const x=y.type,v=f.handlers[x];if(Ed.call(f.handlers,x)&&v)return v(f,y,g);if(f.options.passThrough&&f.options.passThrough.includes(x)){if("children"in y){const{children:j,...D}=y,T=Iu(D);return T.children=f.all(y),T}return Iu(y)}return(f.options.unknownHandler||VN)(f,y,g)}function m(y){const g=[];if("children"in y){const x=y.children;let v=-1;for(;++v<x.length;){const S=f.one(x[v],y);if(S){if(v&&x[v-1].type==="break"&&(!Array.isArray(S)&&S.type==="text"&&(S.value=Ab(S.value)),!Array.isArray(S)&&S.type==="element")){const j=S.children[0];j&&j.type==="text"&&(j.value=Ab(j.value))}Array.isArray(S)?g.push(...S):g.push(S)}}}return g}}function FN(e,t){e.position&&(t.position=OC(e))}function $N(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,Iu(u)),"children"in r&&r.children&&l!==null&&l!==void 0&&(r.children=l)}return r}function VN(e,t){const r=t.data||{},s="value"in t&&!(Ed.call(r,"hProperties")||Ed.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 YN(e,t){const r=[];let s=-1;for(t&&r.push({type:"text",value:`
102
+ `}]}}const nc=(function(e){if(e==null)return PN;if(typeof e=="function")return rc(e);if(typeof e=="object")return Array.isArray(e)?LN(e):zN(e);if(typeof e=="string")return UN(e);throw new Error("Expected function, string, or object as test")});function LN(e){const t=[];let r=-1;for(;++r<e.length;)t[r]=nc(e[r]);return rc(s);function s(...l){let o=-1;for(;++o<t.length;)if(t[o].apply(this,l))return!0;return!1}}function zN(e){const t=e;return rc(r);function r(s){const l=s;let o;for(o in e)if(l[o]!==t[o])return!1;return!0}}function UN(e){return rc(t);function t(r){return r&&r.type===e}}function rc(e){return t;function t(r,s,l){return!!(BN(r)&&e.call(this,r,typeof s=="number"?s:void 0,l||void 0))}}function PN(){return!0}function BN(e){return e!==null&&typeof e=="object"&&"type"in e}const w1=[],HN=!0,kd=!1,qN="skip";function S1(e,t,r,s){let l;typeof t=="function"&&typeof r!="function"?(s=r,r=t):l=t;const o=nc(l),c=s?-1:1;f(e,void 0,[])();function f(d,m,y){const g=d&&typeof d=="object"?d:{};if(typeof g.type=="string"){const v=typeof g.tagName=="string"?g.tagName:typeof g.name=="string"?g.name:void 0;Object.defineProperty(x,"name",{value:"node ("+(d.type+(v?"<"+v+">":""))+")"})}return x;function x(){let v=w1,S,A,M;if((!t||o(d,m,y[y.length-1]||void 0))&&(v=IN(r(d,y)),v[0]===kd))return v;if("children"in d&&d.children){const T=d;if(T.children&&v[0]!==qN)for(A=(s?T.children.length:-1)+c,M=y.concat(T);A>-1&&A<T.children.length;){const P=T.children[A];if(S=f(P,A,M)(),S[0]===kd)return S;A=typeof S[1]=="number"?S[1]:A+c}}return v}}}function IN(e){return Array.isArray(e)?e:typeof e=="number"?[HN,e]:e==null?w1:[e]}function lm(e,t,r,s){let l,o,c;typeof t=="function"&&typeof r!="function"?(o=void 0,c=t,l=r):(o=t,c=r,l=s),S1(e,o,f,l);function f(d,m){const y=m[m.length-1],g=y?y.children.indexOf(d):void 0;return c(d,g,y)}}const Ed={}.hasOwnProperty,FN={};function $N(e,t){const r=t||FN,s=new Map,l=new Map,o=new Map,c={...AN,...r.handlers},f={all:m,applyData:YN,definitionById:s,footnoteById:l,footnoteCounts:o,footnoteOrder:[],handlers:c,one:d,options:r,patch:VN,wrap:JN};return lm(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 d(y,g){const x=y.type,v=f.handlers[x];if(Ed.call(f.handlers,x)&&v)return v(f,y,g);if(f.options.passThrough&&f.options.passThrough.includes(x)){if("children"in y){const{children:A,...M}=y,T=Iu(M);return T.children=f.all(y),T}return Iu(y)}return(f.options.unknownHandler||GN)(f,y,g)}function m(y){const g=[];if("children"in y){const x=y.children;let v=-1;for(;++v<x.length;){const S=f.one(x[v],y);if(S){if(v&&x[v-1].type==="break"&&(!Array.isArray(S)&&S.type==="text"&&(S.value=jb(S.value)),!Array.isArray(S)&&S.type==="element")){const A=S.children[0];A&&A.type==="text"&&(A.value=jb(A.value))}Array.isArray(S)?g.push(...S):g.push(S)}}}return g}}function VN(e,t){e.position&&(t.position=MC(e))}function YN(e,t){let r=t;if(e&&e.data){const s=e.data.hName,l=e.data.hChildren,o=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"&&o&&Object.assign(r.properties,Iu(o)),"children"in r&&r.children&&l!==null&&l!==void 0&&(r.children=l)}return r}function GN(e,t){const r=t.data||{},s="value"in t&&!(Ed.call(r,"hProperties")||Ed.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 JN(e,t){const r=[];let s=-1;for(t&&r.push({type:"text",value:`
103
103
  `});++s<e.length;)s&&r.push({type:"text",value:`
104
104
  `}),r.push(e[s]);return t&&e.length>0&&r.push({type:"text",value:`
105
- `}),r}function Ab(e){let t=0,r=e.charCodeAt(t);for(;r===9||r===32;)t++,r=e.charCodeAt(t);return e.slice(t)}function jb(e,t){const r=IN(e,t),s=r.one(e,void 0),l=RN(r),u=Array.isArray(s)?{type:"root",children:s}:s||{type:"root",children:[]};return l&&u.children.push({type:"text",value:`
106
- `},l),u}function GN(e,t){return e&&"run"in e?async function(r,s){const l=jb(r,{file:s,...t});await e.run(l,s)}:function(r,s){return jb(r,{file:s,...e||t})}}function Nb(e){if(e)throw e}var Hh,Tb;function JN(){if(Tb)return Hh;Tb=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,r=Object.defineProperty,s=Object.getOwnPropertyDescriptor,l=function(m){return typeof Array.isArray=="function"?Array.isArray(m):t.call(m)==="[object Array]"},u=function(m){if(!m||t.call(m)!=="[object Object]")return!1;var y=e.call(m,"constructor"),g=m.constructor&&m.constructor.prototype&&e.call(m.constructor.prototype,"isPrototypeOf");if(m.constructor&&!y&&!g)return!1;var x;for(x in m);return typeof x>"u"||e.call(m,x)},c=function(m,y){r&&y.name==="__proto__"?r(m,y.name,{enumerable:!0,configurable:!0,value:y.newValue,writable:!0}):m[y.name]=y.newValue},f=function(m,y){if(y==="__proto__")if(e.call(m,y)){if(s)return s(m,y).value}else return;return m[y]};return Hh=function d(){var m,y,g,x,v,S,j=arguments[0],D=1,T=arguments.length,P=!1;for(typeof j=="boolean"&&(P=j,j=arguments[1]||{},D=2),(j==null||typeof j!="object"&&typeof j!="function")&&(j={});D<T;++D)if(m=arguments[D],m!=null)for(y in m)g=f(j,y),x=f(m,y),j!==x&&(P&&x&&(u(x)||(v=l(x)))?(v?(v=!1,S=g&&l(g)?g:[]):S=g&&u(g)?g:{},c(j,{name:y,newValue:d(P,S,x)})):typeof x<"u"&&c(j,{name:y,newValue:x}));return j},Hh}var XN=JN();const qh=Gb(XN);function Cd(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 KN(){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(d,...m){const y=e[++u];let g=-1;if(d){c(d);return}for(;++g<l.length;)(m[g]===null||m[g]===void 0)&&(m[g]=l[g]);l=m,y?QN(y,f)(...m):c(null,...m)}}function s(l){if(typeof l!="function")throw new TypeError("Expected `middelware` to be a function, not "+l);return e.push(l),t}}function QN(e,t){let r;return s;function s(...c){const f=e.length>c.length;let d;f&&c.push(l);try{d=e.apply(this,c)}catch(m){const y=m;if(f&&r)throw y;return l(y)}f||(d&&d.then&&typeof d.then=="function"?d.then(u,l):d instanceof Error?l(d):u(d))}function l(c,...f){r||(r=!0,t(c,...f))}function u(c){l(null,c)}}const qr={basename:ZN,dirname:WN,extname:eT,join:tT,sep:"/"};function ZN(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Kl(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 WN(e){if(Kl(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 eT(e){Kl(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 tT(...e){let t=-1,r;for(;++t<e.length;)Kl(e[t]),e[t]&&(r=r===void 0?e[t]:r+"/"+e[t]);return r===void 0?".":nT(r)}function nT(e){Kl(e);const t=e.codePointAt(0)===47;let r=rT(e,!t);return r.length===0&&!t&&(r="."),r.length>0&&e.codePointAt(e.length-1)===47&&(r+="/"),t?"/"+r:r}function rT(e,t){let r="",s=0,l=-1,u=0,c=-1,f,d;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(d=r.lastIndexOf("/"),d!==r.length-1){d<0?(r="",s=0):(r=r.slice(0,d),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 Kl(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const iT={cwd:sT};function sT(){return"/"}function Ad(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function aT(e){if(typeof e=="string")e=new URL(e);else if(!Ad(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 lT(e)}function lT(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 Ih=["history","path","basename","stem","extname","dirname"];class E1{constructor(t){let r;t?Ad(t)?r={path:t}:typeof t=="string"||oT(t)?r={value:t}:r=t:r={},this.cwd="cwd"in r?"":iT.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let s=-1;for(;++s<Ih.length;){const u=Ih[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)Ih.includes(l)||(this[l]=r[l])}get basename(){return typeof this.path=="string"?qr.basename(this.path):void 0}set basename(t){$h(t,"basename"),Fh(t,"basename"),this.path=qr.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?qr.dirname(this.path):void 0}set dirname(t){Ob(this.basename,"dirname"),this.path=qr.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?qr.extname(this.path):void 0}set extname(t){if(Fh(t,"extname"),Ob(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=qr.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){Ad(t)&&(t=aT(t)),$h(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?qr.basename(this.path,this.extname):void 0}set stem(t){$h(t,"stem"),Fh(t,"stem"),this.path=qr.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 Nn(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 Fh(e,t){if(e&&e.includes(qr.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+qr.sep+"`")}function $h(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function Ob(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function oT(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const uT=(function(e){const s=this.constructor.prototype,l=s[e],u=function(){return l.apply(u,arguments)};return Object.setPrototypeOf(u,s),u}),cT={}.hasOwnProperty;class om extends uT{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=KN()}copy(){const t=new om;let r=-1;for(;++r<this.attachers.length;){const s=this.attachers[r];t.use(...s)}return t.data(qh(!0,{},this.namespace)),t}data(t,r){return typeof t=="string"?arguments.length===2?(Gh("data",this.frozen),this.namespace[t]=r,this):cT.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Gh("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=bu(t),s=this.parser||this.Parser;return Vh("parse",s),s(String(r),r)}process(t,r){const s=this;return this.freeze(),Vh("process",this.parser||this.Parser),Yh("process",this.compiler||this.Compiler),r?l(void 0,r):new Promise(l);function l(u,c){const f=bu(t),d=s.parse(f);s.run(d,f,function(y,g,x){if(y||!g||!x)return m(y);const v=g,S=s.stringify(v,x);dT(S)?x.value=S:x.result=S,m(y,x)});function m(y,g){y||!g?c(y):u?u(g):r(void 0,g)}}}processSync(t){let r=!1,s;return this.freeze(),Vh("processSync",this.parser||this.Parser),Yh("processSync",this.compiler||this.Compiler),this.process(t,l),Mb("processSync","process",r),s;function l(u,c){r=!0,Nb(u),s=c}}run(t,r,s){Rb(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 d=bu(r);l.run(t,d,m);function m(y,g,x){const v=g||t;y?f(y):c?c(v):s(void 0,v,x)}}}runSync(t,r){let s=!1,l;return this.run(t,r,u),Mb("runSync","run",s),l;function u(c,f){Nb(c),l=f,s=!0}}stringify(t,r){this.freeze();const s=bu(r),l=this.compiler||this.Compiler;return Yh("stringify",l),Rb(t),l(t,s)}use(t,...r){const s=this.attachers,l=this.namespace;if(Gh("use",this.frozen),t!=null)if(typeof t=="function")d(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(m){if(typeof m=="function")d(m,[]);else if(typeof m=="object")if(Array.isArray(m)){const[y,...g]=m;d(y,g)}else c(m);else throw new TypeError("Expected usable value, not `"+m+"`")}function c(m){if(!("plugins"in m)&&!("settings"in m))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(m.plugins),m.settings&&(l.settings=qh(!0,l.settings,m.settings))}function f(m){let y=-1;if(m!=null)if(Array.isArray(m))for(;++y<m.length;){const g=m[y];u(g)}else throw new TypeError("Expected a list of plugins, not `"+m+"`")}function d(m,y){let g=-1,x=-1;for(;++g<s.length;)if(s[g][0]===m){x=g;break}if(x===-1)s.push([m,...y]);else if(y.length>0){let[v,...S]=y;const j=s[x][1];Cd(j)&&Cd(v)&&(v=qh(!0,j,v)),s[x]=[m,v,...S]}}}}const fT=new om().freeze();function Vh(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Yh(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Gh(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 Rb(e){if(!Cd(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function Mb(e,t,r){if(!r)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function bu(e){return hT(e)?e:new E1(e)}function hT(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function dT(e){return typeof e=="string"||mT(e)}function mT(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const pT="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Db=[],Lb={allowDangerousHtml:!0},gT=/^(https?|ircs?|mailto|xmpp)$/i,yT=[{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 zb(e){const t=bT(e),r=xT(e);return vT(t.runSync(t.parse(r),r),e)}function bT(e){const t=e.rehypePlugins||Db,r=e.remarkPlugins||Db,s=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Lb}:Lb;return fT().use(Wj).use(r).use(GN,s).use(t)}function xT(e){const t=e.children||"",r=new E1;return typeof t=="string"&&(r.value=t),r}function vT(e,t){const r=t.allowedElements,s=t.allowElement,l=t.components,u=t.disallowedElements,c=t.skipHtml,f=t.unwrapDisallowed,d=t.urlTransform||wT;for(const y of yT)Object.hasOwn(t,y.from)&&(""+y.from+(y.to?"use `"+y.to+"` instead":"remove it")+pT+y.id,void 0);return lm(e,m),zC(e,{Fragment:b.Fragment,components:l,ignoreInvalidStyle:!0,jsx:b.jsx,jsxs:b.jsxs,passKeys:!0,passNode:!0});function m(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 v;for(v in Uh)if(Object.hasOwn(Uh,v)&&Object.hasOwn(y.properties,v)){const S=y.properties[v],j=Uh[v];(j===null||j.includes(y.tagName))&&(y.properties[v]=d(String(S||""),v,y))}}if(y.type==="element"){let v=r?!r.includes(y.tagName):u?u.includes(y.tagName):!1;if(!v&&s&&typeof g=="number"&&(v=!s(y,g,x)),v&&x&&typeof g=="number")return f&&y.children?x.children.splice(g,1,...y.children):x.children.splice(g,1),g}}}function wT(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||gT.test(e.slice(0,t))?e:""}function Ub(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 ST(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function C1(e,t,r){const l=nc((r||{}).ignore||[]),u=_T(t);let c=-1;for(;++c<u.length;)k1(e,"text",f);function f(m,y){let g=-1,x;for(;++g<y.length;){const v=y[g],S=x?x.children:void 0;if(l(v,S?S.indexOf(v):void 0,x))return;x=v}if(x)return d(m,y)}function d(m,y){const g=y[y.length-1],x=u[c][0],v=u[c][1];let S=0;const D=g.children.indexOf(m);let T=!1,P=[];x.lastIndex=0;let I=x.exec(m.value);for(;I;){const W=I.index,B={index:I.index,input:I.input,stack:[...y,m]};let R=v(...I,B);if(typeof R=="string"&&(R=R.length>0?{type:"text",value:R}:void 0),R===!1?x.lastIndex=W+1:(S!==W&&P.push({type:"text",value:m.value.slice(S,W)}),Array.isArray(R)?P.push(...R):R&&P.push(R),S=W+I[0].length,T=!0),!x.global)break;I=x.exec(m.value)}return T?(S<m.value.length&&P.push({type:"text",value:m.value.slice(S)}),g.children.splice(D,1,...P)):P=[m],D+P.length}}function _T(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([kT(l[0]),ET(l[1])])}return t}function kT(e){return typeof e=="string"?new RegExp(ST(e),"g"):e}function ET(e){return typeof e=="function"?e:function(){return e}}const Jh="phrasing",Xh=["autolink","link","image","label"];function CT(){return{transforms:[MT],enter:{literalAutolink:jT,literalAutolinkEmail:Kh,literalAutolinkHttp:Kh,literalAutolinkWww:Kh},exit:{literalAutolink:RT,literalAutolinkEmail:OT,literalAutolinkHttp:NT,literalAutolinkWww:TT}}}function AT(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Jh,notInConstruct:Xh},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Jh,notInConstruct:Xh},{character:":",before:"[ps]",after:"\\/",inConstruct:Jh,notInConstruct:Xh}]}}function jT(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function Kh(e){this.config.enter.autolinkProtocol.call(this,e)}function NT(e){this.config.exit.autolinkProtocol.call(this,e)}function TT(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 OT(e){this.config.exit.autolinkEmail.call(this,e)}function RT(e){this.exit(e)}function MT(e){C1(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,DT],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),LT]],{ignore:["link","linkReference"]})}function DT(e,t,r,s,l){let u="";if(!A1(l)||(/^w/i.test(t)&&(r=t+r,t="",u="http://"),!zT(r)))return!1;const c=UT(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 LT(e,t,r,s){return!A1(s,!0)||/[-\d_]$/.test(r)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+r,children:[{type:"text",value:t+"@"+r}]}}function zT(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 UT(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=Ub(e,"(");let u=Ub(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 A1(e,t){const r=e.input.charCodeAt(e.index-1);return(e.index===0||vs(r)||Wu(r))&&(!t||r!==47)}j1.peek=YT;function PT(){this.buffer()}function BT(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function HT(){this.buffer()}function qT(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function IT(e){const t=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=Dr(this.sliceSerialize(e)).toLowerCase(),r.label=t}function FT(e){this.exit(e)}function $T(e){const t=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=Dr(this.sliceSerialize(e)).toLowerCase(),r.label=t}function VT(e){this.exit(e)}function YT(){return"["}function j1(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 GT(){return{enter:{gfmFootnoteCallString:PT,gfmFootnoteCall:BT,gfmFootnoteDefinitionLabelString:HT,gfmFootnoteDefinition:qT},exit:{gfmFootnoteCallString:IT,gfmFootnoteCall:FT,gfmFootnoteDefinitionLabelString:$T,gfmFootnoteDefinition:VT}}}function JT(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:r,footnoteReference:j1},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function r(s,l,u,c){const f=u.createTracker(c);let d=f.move("[^");const m=u.enter("footnoteDefinition"),y=u.enter("label");return d+=f.move(u.safe(u.associationId(s),{before:d,after:"]"})),y(),d+=f.move("]:"),s.children&&s.children.length>0&&(f.shift(4),d+=f.move((t?`
107
- `:" ")+u.indentLines(u.containerFlow(s,f.current()),t?N1:XT))),m(),d}}function XT(e,t,r){return t===0?e:N1(e,t,r)}function N1(e,t,r){return(r?"":" ")+e}const KT=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];T1.peek=t3;function QT(){return{canContainEols:["delete"],enter:{strikethrough:WT},exit:{strikethrough:e3}}}function ZT(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:KT}],handlers:{delete:T1}}}function WT(e){this.enter({type:"delete",children:[]},e)}function e3(e){this.exit(e)}function T1(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 t3(){return"~"}function n3(e){return e.length}function r3(e,t){const r=t||{},s=(r.align||[]).concat(),l=r.stringLength||n3,u=[],c=[],f=[],d=[];let m=0,y=-1;for(;++y<e.length;){const j=[],D=[];let T=-1;for(e[y].length>m&&(m=e[y].length);++T<e[y].length;){const P=i3(e[y][T]);if(r.alignDelimiters!==!1){const I=l(P);D[T]=I,(d[T]===void 0||I>d[T])&&(d[T]=I)}j.push(P)}c[y]=j,f[y]=D}let g=-1;if(typeof s=="object"&&"length"in s)for(;++g<m;)u[g]=Pb(s[g]);else{const j=Pb(s);for(;++g<m;)u[g]=j}g=-1;const x=[],v=[];for(;++g<m;){const j=u[g];let D="",T="";j===99?(D=":",T=":"):j===108?D=":":j===114&&(T=":");let P=r.alignDelimiters===!1?1:Math.max(1,d[g]-D.length-T.length);const I=D+"-".repeat(P)+T;r.alignDelimiters!==!1&&(P=D.length+P+T.length,P>d[g]&&(d[g]=P),v[g]=P),x[g]=I}c.splice(1,0,x),f.splice(1,0,v),y=-1;const S=[];for(;++y<c.length;){const j=c[y],D=f[y];g=-1;const T=[];for(;++g<m;){const P=j[g]||"";let I="",W="";if(r.alignDelimiters!==!1){const B=d[g]-(D[g]||0),R=u[g];R===114?I=" ".repeat(B):R===99?B%2?(I=" ".repeat(B/2+.5),W=" ".repeat(B/2-.5)):(I=" ".repeat(B/2),W=I):W=" ".repeat(B)}r.delimiterStart!==!1&&!g&&T.push("|"),r.padding!==!1&&!(r.alignDelimiters===!1&&P==="")&&(r.delimiterStart!==!1||g)&&T.push(" "),r.alignDelimiters!==!1&&T.push(I),T.push(P),r.alignDelimiters!==!1&&T.push(W),r.padding!==!1&&T.push(" "),(r.delimiterEnd!==!1||g!==m-1)&&T.push("|")}S.push(r.delimiterEnd===!1?T.join("").replace(/ +$/,""):T.join(""))}return S.join(`
108
- `)}function i3(e){return e==null?"":String(e)}function Pb(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 s3(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()),a3);return l(),c}function a3(e,t,r){return">"+(r?"":" ")+e}function l3(e,t){return Bb(e,t.inConstruct,!0)&&!Bb(e,t.notInConstruct,!1)}function Bb(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 Hb(e,t,r,s){let l=-1;for(;++l<r.unsafe.length;)if(r.unsafe[l].character===`
109
- `&&l3(r.stack,r.unsafe[l]))return/[ \t]/.test(s.before)?"":" ";return`\\
110
- `}function o3(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 u3(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 c3(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 f3(e,t,r,s){const l=c3(r),u=e.value||"",c=l==="`"?"GraveAccent":"Tilde";if(u3(e,r)){const g=r.enter("codeIndented"),x=r.indentLines(u,h3);return g(),x}const f=r.createTracker(s),d=l.repeat(Math.max(o3(u,l)+1,3)),m=r.enter("codeFenced");let y=f.move(d);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:`
105
+ `}),r}function jb(e){let t=0,r=e.charCodeAt(t);for(;r===9||r===32;)t++,r=e.charCodeAt(t);return e.slice(t)}function Nb(e,t){const r=$N(e,t),s=r.one(e,void 0),l=DN(r),o=Array.isArray(s)?{type:"root",children:s}:s||{type:"root",children:[]};return l&&o.children.push({type:"text",value:`
106
+ `},l),o}function XN(e,t){return e&&"run"in e?async function(r,s){const l=Nb(r,{file:s,...t});await e.run(l,s)}:function(r,s){return Nb(r,{file:s,...e||t})}}function Tb(e){if(e)throw e}var Hh,Ob;function KN(){if(Ob)return Hh;Ob=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,r=Object.defineProperty,s=Object.getOwnPropertyDescriptor,l=function(m){return typeof Array.isArray=="function"?Array.isArray(m):t.call(m)==="[object Array]"},o=function(m){if(!m||t.call(m)!=="[object Object]")return!1;var y=e.call(m,"constructor"),g=m.constructor&&m.constructor.prototype&&e.call(m.constructor.prototype,"isPrototypeOf");if(m.constructor&&!y&&!g)return!1;var x;for(x in m);return typeof x>"u"||e.call(m,x)},c=function(m,y){r&&y.name==="__proto__"?r(m,y.name,{enumerable:!0,configurable:!0,value:y.newValue,writable:!0}):m[y.name]=y.newValue},f=function(m,y){if(y==="__proto__")if(e.call(m,y)){if(s)return s(m,y).value}else return;return m[y]};return Hh=function d(){var m,y,g,x,v,S,A=arguments[0],M=1,T=arguments.length,P=!1;for(typeof A=="boolean"&&(P=A,A=arguments[1]||{},M=2),(A==null||typeof A!="object"&&typeof A!="function")&&(A={});M<T;++M)if(m=arguments[M],m!=null)for(y in m)g=f(A,y),x=f(m,y),A!==x&&(P&&x&&(o(x)||(v=l(x)))?(v?(v=!1,S=g&&l(g)?g:[]):S=g&&o(g)?g:{},c(A,{name:y,newValue:d(P,S,x)})):typeof x<"u"&&c(A,{name:y,newValue:x}));return A},Hh}var QN=KN();const qh=Vb(QN);function Cd(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 ZN(){const e=[],t={run:r,use:s};return t;function r(...l){let o=-1;const c=l.pop();if(typeof c!="function")throw new TypeError("Expected function as last argument, not "+c);f(null,...l);function f(d,...m){const y=e[++o];let g=-1;if(d){c(d);return}for(;++g<l.length;)(m[g]===null||m[g]===void 0)&&(m[g]=l[g]);l=m,y?WN(y,f)(...m):c(null,...m)}}function s(l){if(typeof l!="function")throw new TypeError("Expected `middelware` to be a function, not "+l);return e.push(l),t}}function WN(e,t){let r;return s;function s(...c){const f=e.length>c.length;let d;f&&c.push(l);try{d=e.apply(this,c)}catch(m){const y=m;if(f&&r)throw y;return l(y)}f||(d&&d.then&&typeof d.then=="function"?d.then(o,l):d instanceof Error?l(d):o(d))}function l(c,...f){r||(r=!0,t(c,...f))}function o(c){l(null,c)}}const qr={basename:eT,dirname:tT,extname:nT,join:rT,sep:"/"};function eT(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Kl(e);let r=0,s=-1,l=e.length,o;if(t===void 0||t.length===0||t.length>e.length){for(;l--;)if(e.codePointAt(l)===47){if(o){r=l+1;break}}else s<0&&(o=!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(o){r=l+1;break}}else c<0&&(o=!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 tT(e){if(Kl(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 nT(e){Kl(e);let t=e.length,r=-1,s=0,l=-1,o=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:o!==1&&(o=1):l>-1&&(o=-1)}return l<0||r<0||o===0||o===1&&l===r-1&&l===s+1?"":e.slice(l,r)}function rT(...e){let t=-1,r;for(;++t<e.length;)Kl(e[t]),e[t]&&(r=r===void 0?e[t]:r+"/"+e[t]);return r===void 0?".":iT(r)}function iT(e){Kl(e);const t=e.codePointAt(0)===47;let r=sT(e,!t);return r.length===0&&!t&&(r="."),r.length>0&&e.codePointAt(e.length-1)===47&&(r+="/"),t?"/"+r:r}function sT(e,t){let r="",s=0,l=-1,o=0,c=-1,f,d;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||o===1))if(l!==c-1&&o===2){if(r.length<2||s!==2||r.codePointAt(r.length-1)!==46||r.codePointAt(r.length-2)!==46){if(r.length>2){if(d=r.lastIndexOf("/"),d!==r.length-1){d<0?(r="",s=0):(r=r.slice(0,d),s=r.length-1-r.lastIndexOf("/")),l=c,o=0;continue}}else if(r.length>0){r="",s=0,l=c,o=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,o=0}else f===46&&o>-1?o++:o=-1}return r}function Kl(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const aT={cwd:lT};function lT(){return"/"}function Ad(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function oT(e){if(typeof e=="string")e=new URL(e);else if(!Ad(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 uT(e)}function uT(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 Ih=["history","path","basename","stem","extname","dirname"];class _1{constructor(t){let r;t?Ad(t)?r={path:t}:typeof t=="string"||cT(t)?r={value:t}:r=t:r={},this.cwd="cwd"in r?"":aT.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let s=-1;for(;++s<Ih.length;){const o=Ih[s];o in r&&r[o]!==void 0&&r[o]!==null&&(this[o]=o==="history"?[...r[o]]:r[o])}let l;for(l in r)Ih.includes(l)||(this[l]=r[l])}get basename(){return typeof this.path=="string"?qr.basename(this.path):void 0}set basename(t){$h(t,"basename"),Fh(t,"basename"),this.path=qr.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?qr.dirname(this.path):void 0}set dirname(t){Rb(this.basename,"dirname"),this.path=qr.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?qr.extname(this.path):void 0}set extname(t){if(Fh(t,"extname"),Rb(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=qr.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){Ad(t)&&(t=oT(t)),$h(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?qr.basename(this.path,this.extname):void 0}set stem(t){$h(t,"stem"),Fh(t,"stem"),this.path=qr.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 Nn(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 Fh(e,t){if(e&&e.includes(qr.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+qr.sep+"`")}function $h(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function Rb(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function cT(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const fT=(function(e){const s=this.constructor.prototype,l=s[e],o=function(){return l.apply(o,arguments)};return Object.setPrototypeOf(o,s),o}),hT={}.hasOwnProperty;class om extends fT{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=ZN()}copy(){const t=new om;let r=-1;for(;++r<this.attachers.length;){const s=this.attachers[r];t.use(...s)}return t.data(qh(!0,{},this.namespace)),t}data(t,r){return typeof t=="string"?arguments.length===2?(Gh("data",this.frozen),this.namespace[t]=r,this):hT.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Gh("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=bu(t),s=this.parser||this.Parser;return Vh("parse",s),s(String(r),r)}process(t,r){const s=this;return this.freeze(),Vh("process",this.parser||this.Parser),Yh("process",this.compiler||this.Compiler),r?l(void 0,r):new Promise(l);function l(o,c){const f=bu(t),d=s.parse(f);s.run(d,f,function(y,g,x){if(y||!g||!x)return m(y);const v=g,S=s.stringify(v,x);pT(S)?x.value=S:x.result=S,m(y,x)});function m(y,g){y||!g?c(y):o?o(g):r(void 0,g)}}}processSync(t){let r=!1,s;return this.freeze(),Vh("processSync",this.parser||this.Parser),Yh("processSync",this.compiler||this.Compiler),this.process(t,l),Db("processSync","process",r),s;function l(o,c){r=!0,Tb(o),s=c}}run(t,r,s){Mb(t),this.freeze();const l=this.transformers;return!s&&typeof r=="function"&&(s=r,r=void 0),s?o(void 0,s):new Promise(o);function o(c,f){const d=bu(r);l.run(t,d,m);function m(y,g,x){const v=g||t;y?f(y):c?c(v):s(void 0,v,x)}}}runSync(t,r){let s=!1,l;return this.run(t,r,o),Db("runSync","run",s),l;function o(c,f){Tb(c),l=f,s=!0}}stringify(t,r){this.freeze();const s=bu(r),l=this.compiler||this.Compiler;return Yh("stringify",l),Mb(t),l(t,s)}use(t,...r){const s=this.attachers,l=this.namespace;if(Gh("use",this.frozen),t!=null)if(typeof t=="function")d(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 o(m){if(typeof m=="function")d(m,[]);else if(typeof m=="object")if(Array.isArray(m)){const[y,...g]=m;d(y,g)}else c(m);else throw new TypeError("Expected usable value, not `"+m+"`")}function c(m){if(!("plugins"in m)&&!("settings"in m))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(m.plugins),m.settings&&(l.settings=qh(!0,l.settings,m.settings))}function f(m){let y=-1;if(m!=null)if(Array.isArray(m))for(;++y<m.length;){const g=m[y];o(g)}else throw new TypeError("Expected a list of plugins, not `"+m+"`")}function d(m,y){let g=-1,x=-1;for(;++g<s.length;)if(s[g][0]===m){x=g;break}if(x===-1)s.push([m,...y]);else if(y.length>0){let[v,...S]=y;const A=s[x][1];Cd(A)&&Cd(v)&&(v=qh(!0,A,v)),s[x]=[m,v,...S]}}}}const dT=new om().freeze();function Vh(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Yh(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Gh(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 Mb(e){if(!Cd(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function Db(e,t,r){if(!r)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function bu(e){return mT(e)?e:new _1(e)}function mT(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function pT(e){return typeof e=="string"||gT(e)}function gT(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const yT="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Lb=[],zb={allowDangerousHtml:!0},bT=/^(https?|ircs?|mailto|xmpp)$/i,xT=[{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 vT(e){const t=wT(e),r=ST(e);return _T(t.runSync(t.parse(r),r),e)}function wT(e){const t=e.rehypePlugins||Lb,r=e.remarkPlugins||Lb,s=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...zb}:zb;return dT().use(tN).use(r).use(XN,s).use(t)}function ST(e){const t=e.children||"",r=new _1;return typeof t=="string"&&(r.value=t),r}function _T(e,t){const r=t.allowedElements,s=t.allowElement,l=t.components,o=t.disallowedElements,c=t.skipHtml,f=t.unwrapDisallowed,d=t.urlTransform||k1;for(const y of xT)Object.hasOwn(t,y.from)&&(""+y.from+(y.to?"use `"+y.to+"` instead":"remove it")+yT+y.id,void 0);return lm(e,m),PC(e,{Fragment:b.Fragment,components:l,ignoreInvalidStyle:!0,jsx:b.jsx,jsxs:b.jsxs,passKeys:!0,passNode:!0});function m(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 v;for(v in Uh)if(Object.hasOwn(Uh,v)&&Object.hasOwn(y.properties,v)){const S=y.properties[v],A=Uh[v];(A===null||A.includes(y.tagName))&&(y.properties[v]=d(String(S||""),v,y))}}if(y.type==="element"){let v=r?!r.includes(y.tagName):o?o.includes(y.tagName):!1;if(!v&&s&&typeof g=="number"&&(v=!s(y,g,x)),v&&x&&typeof g=="number")return f&&y.children?x.children.splice(g,1,...y.children):x.children.splice(g,1),g}}}function k1(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||bT.test(e.slice(0,t))?e:""}const kT=/^[a-z][a-z0-9+.-]+:/i;function E1(e){const t=e==null?void 0:e.trim();if(!t||t.startsWith("#")||t.startsWith("//"))return null;if(/^file:/i.test(t))try{const s=decodeURIComponent(new URL(t).pathname);return/^\/[a-z]:/i.test(s)?s.slice(1):s}catch{return null}if(kT.test(t))return null;const r=t.replace(/[?#].*$/,"");try{return decodeURI(r)||null}catch{return r||null}}function ET(e){return E1(e)!==null?e:k1(e)}function CT(e){return e.startsWith("/")||e.startsWith("\\")||/^[a-z]:[\\/]/i.test(e)}function AT(e,t){return!t||CT(e)?e:t.replace(/[^/\\]*$/,"")+e}function jT(e){return e.split(/[/\\]/).filter(Boolean).pop()??e}function NT(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}async function TT(e,t,r,s){const l=[];let o=0,c="application/octet-stream";for(;;){const f=await e("task.file",{id:t,run_id:r,path:s,offset:o});if(f.error)throw new Error(f.error.startsWith("Unknown method")?"Update Palmier on the host to open files.":f.error);const d=NT(f.data??"");if(l.push(d),o+=d.length,f.mime&&(c=f.mime),f.eof||d.length===0)break}return new Blob(l,{type:c})}const OT=["application/json","application/x-ndjson","application/xml","application/yaml"];function RT(e){return e==="text/markdown"?"markdown":e==="text/html"?"html":e.startsWith("image/")?"image":e.startsWith("text/")||OT.includes(e)?"text":"binary"}function MT(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(1)} MB`}function Ub(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 DT(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function C1(e,t,r){const l=nc((r||{}).ignore||[]),o=LT(t);let c=-1;for(;++c<o.length;)S1(e,"text",f);function f(m,y){let g=-1,x;for(;++g<y.length;){const v=y[g],S=x?x.children:void 0;if(l(v,S?S.indexOf(v):void 0,x))return;x=v}if(x)return d(m,y)}function d(m,y){const g=y[y.length-1],x=o[c][0],v=o[c][1];let S=0;const M=g.children.indexOf(m);let T=!1,P=[];x.lastIndex=0;let I=x.exec(m.value);for(;I;){const W=I.index,B={index:I.index,input:I.input,stack:[...y,m]};let D=v(...I,B);if(typeof D=="string"&&(D=D.length>0?{type:"text",value:D}:void 0),D===!1?x.lastIndex=W+1:(S!==W&&P.push({type:"text",value:m.value.slice(S,W)}),Array.isArray(D)?P.push(...D):D&&P.push(D),S=W+I[0].length,T=!0),!x.global)break;I=x.exec(m.value)}return T?(S<m.value.length&&P.push({type:"text",value:m.value.slice(S)}),g.children.splice(M,1,...P)):P=[m],M+P.length}}function LT(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([zT(l[0]),UT(l[1])])}return t}function zT(e){return typeof e=="string"?new RegExp(DT(e),"g"):e}function UT(e){return typeof e=="function"?e:function(){return e}}const Jh="phrasing",Xh=["autolink","link","image","label"];function PT(){return{transforms:[VT],enter:{literalAutolink:HT,literalAutolinkEmail:Kh,literalAutolinkHttp:Kh,literalAutolinkWww:Kh},exit:{literalAutolink:$T,literalAutolinkEmail:FT,literalAutolinkHttp:qT,literalAutolinkWww:IT}}}function BT(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Jh,notInConstruct:Xh},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Jh,notInConstruct:Xh},{character:":",before:"[ps]",after:"\\/",inConstruct:Jh,notInConstruct:Xh}]}}function HT(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function Kh(e){this.config.enter.autolinkProtocol.call(this,e)}function qT(e){this.config.exit.autolinkProtocol.call(this,e)}function IT(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 FT(e){this.config.exit.autolinkEmail.call(this,e)}function $T(e){this.exit(e)}function VT(e){C1(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,YT],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),GT]],{ignore:["link","linkReference"]})}function YT(e,t,r,s,l){let o="";if(!A1(l)||(/^w/i.test(t)&&(r=t+r,t="",o="http://"),!JT(r)))return!1;const c=XT(r+s);if(!c[0])return!1;const f={type:"link",title:null,url:o+t+c[0],children:[{type:"text",value:t+c[0]}]};return c[1]?[f,{type:"text",value:c[1]}]:f}function GT(e,t,r,s){return!A1(s,!0)||/[-\d_]$/.test(r)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+r,children:[{type:"text",value:t+"@"+r}]}}function JT(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 XT(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=Ub(e,"(");let o=Ub(e,")");for(;s!==-1&&l>o;)e+=r.slice(0,s+1),r=r.slice(s+1),s=r.indexOf(")"),o++;return[e,r]}function A1(e,t){const r=e.input.charCodeAt(e.index-1);return(e.index===0||vs(r)||Wu(r))&&(!t||r!==47)}j1.peek=i3;function KT(){this.buffer()}function QT(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function ZT(){this.buffer()}function WT(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function e3(e){const t=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=Dr(this.sliceSerialize(e)).toLowerCase(),r.label=t}function t3(e){this.exit(e)}function n3(e){const t=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=Dr(this.sliceSerialize(e)).toLowerCase(),r.label=t}function r3(e){this.exit(e)}function i3(){return"["}function j1(e,t,r,s){const l=r.createTracker(s);let o=l.move("[^");const c=r.enter("footnoteReference"),f=r.enter("reference");return o+=l.move(r.safe(r.associationId(e),{after:"]",before:o})),f(),c(),o+=l.move("]"),o}function s3(){return{enter:{gfmFootnoteCallString:KT,gfmFootnoteCall:QT,gfmFootnoteDefinitionLabelString:ZT,gfmFootnoteDefinition:WT},exit:{gfmFootnoteCallString:e3,gfmFootnoteCall:t3,gfmFootnoteDefinitionLabelString:n3,gfmFootnoteDefinition:r3}}}function a3(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:r,footnoteReference:j1},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function r(s,l,o,c){const f=o.createTracker(c);let d=f.move("[^");const m=o.enter("footnoteDefinition"),y=o.enter("label");return d+=f.move(o.safe(o.associationId(s),{before:d,after:"]"})),y(),d+=f.move("]:"),s.children&&s.children.length>0&&(f.shift(4),d+=f.move((t?`
107
+ `:" ")+o.indentLines(o.containerFlow(s,f.current()),t?N1:l3))),m(),d}}function l3(e,t,r){return t===0?e:N1(e,t,r)}function N1(e,t,r){return(r?"":" ")+e}const o3=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];T1.peek=d3;function u3(){return{canContainEols:["delete"],enter:{strikethrough:f3},exit:{strikethrough:h3}}}function c3(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:o3}],handlers:{delete:T1}}}function f3(e){this.enter({type:"delete",children:[]},e)}function h3(e){this.exit(e)}function T1(e,t,r,s){const l=r.createTracker(s),o=r.enter("strikethrough");let c=l.move("~~");return c+=r.containerPhrasing(e,{...l.current(),before:c,after:"~"}),c+=l.move("~~"),o(),c}function d3(){return"~"}function m3(e){return e.length}function p3(e,t){const r=t||{},s=(r.align||[]).concat(),l=r.stringLength||m3,o=[],c=[],f=[],d=[];let m=0,y=-1;for(;++y<e.length;){const A=[],M=[];let T=-1;for(e[y].length>m&&(m=e[y].length);++T<e[y].length;){const P=g3(e[y][T]);if(r.alignDelimiters!==!1){const I=l(P);M[T]=I,(d[T]===void 0||I>d[T])&&(d[T]=I)}A.push(P)}c[y]=A,f[y]=M}let g=-1;if(typeof s=="object"&&"length"in s)for(;++g<m;)o[g]=Pb(s[g]);else{const A=Pb(s);for(;++g<m;)o[g]=A}g=-1;const x=[],v=[];for(;++g<m;){const A=o[g];let M="",T="";A===99?(M=":",T=":"):A===108?M=":":A===114&&(T=":");let P=r.alignDelimiters===!1?1:Math.max(1,d[g]-M.length-T.length);const I=M+"-".repeat(P)+T;r.alignDelimiters!==!1&&(P=M.length+P+T.length,P>d[g]&&(d[g]=P),v[g]=P),x[g]=I}c.splice(1,0,x),f.splice(1,0,v),y=-1;const S=[];for(;++y<c.length;){const A=c[y],M=f[y];g=-1;const T=[];for(;++g<m;){const P=A[g]||"";let I="",W="";if(r.alignDelimiters!==!1){const B=d[g]-(M[g]||0),D=o[g];D===114?I=" ".repeat(B):D===99?B%2?(I=" ".repeat(B/2+.5),W=" ".repeat(B/2-.5)):(I=" ".repeat(B/2),W=I):W=" ".repeat(B)}r.delimiterStart!==!1&&!g&&T.push("|"),r.padding!==!1&&!(r.alignDelimiters===!1&&P==="")&&(r.delimiterStart!==!1||g)&&T.push(" "),r.alignDelimiters!==!1&&T.push(I),T.push(P),r.alignDelimiters!==!1&&T.push(W),r.padding!==!1&&T.push(" "),(r.delimiterEnd!==!1||g!==m-1)&&T.push("|")}S.push(r.delimiterEnd===!1?T.join("").replace(/ +$/,""):T.join(""))}return S.join(`
108
+ `)}function g3(e){return e==null?"":String(e)}function Pb(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 y3(e,t,r,s){const l=r.enter("blockquote"),o=r.createTracker(s);o.move("> "),o.shift(2);const c=r.indentLines(r.containerFlow(e,o.current()),b3);return l(),c}function b3(e,t,r){return">"+(r?"":" ")+e}function x3(e,t){return Bb(e,t.inConstruct,!0)&&!Bb(e,t.notInConstruct,!1)}function Bb(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 Hb(e,t,r,s){let l=-1;for(;++l<r.unsafe.length;)if(r.unsafe[l].character===`
109
+ `&&x3(r.stack,r.unsafe[l]))return/[ \t]/.test(s.before)?"":" ";return`\\
110
+ `}function v3(e,t){const r=String(e);let s=r.indexOf(t),l=s,o=0,c=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;s!==-1;)s===l?++o>c&&(c=o):o=1,l=s+t.length,s=r.indexOf(t,l);return c}function w3(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 S3(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 _3(e,t,r,s){const l=S3(r),o=e.value||"",c=l==="`"?"GraveAccent":"Tilde";if(w3(e,r)){const g=r.enter("codeIndented"),x=r.indentLines(o,k3);return g(),x}const f=r.createTracker(s),d=l.repeat(Math.max(v3(o,l)+1,3)),m=r.enter("codeFenced");let y=f.move(d);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:`
111
111
  `,encode:["`"],...f.current()})),g()}return y+=f.move(`
112
- `),u&&(y+=f.move(u+`
113
- `)),y+=f.move(d),m(),y}function h3(e,t,r){return(r?"":" ")+e}function um(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 d3(e,t,r,s){const l=um(r),u=l==='"'?"Quote":"Apostrophe",c=r.enter("definition");let f=r.enter("label");const d=r.createTracker(s);let m=d.move("[");return m+=d.move(r.safe(r.associationId(e),{before:m,after:"]",...d.current()})),m+=d.move("]: "),f(),!e.url||/[\0- \u007F]/.test(e.url)?(f=r.enter("destinationLiteral"),m+=d.move("<"),m+=d.move(r.safe(e.url,{before:m,after:">",...d.current()})),m+=d.move(">")):(f=r.enter("destinationRaw"),m+=d.move(r.safe(e.url,{before:m,after:e.title?" ":`
114
- `,...d.current()}))),f(),e.title&&(f=r.enter(`title${u}`),m+=d.move(" "+l),m+=d.move(r.safe(e.title,{before:m,after:l,...d.current()})),m+=d.move(l),f()),c(),m}function m3(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 Fl(e){return"&#x"+e.toString(16).toUpperCase()+";"}function Fu(e,t,r){const s=wa(e),l=wa(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}}O1.peek=p3;function O1(e,t,r,s){const l=m3(r),u=r.enter("emphasis"),c=r.createTracker(s),f=c.move(l);let d=c.move(r.containerPhrasing(e,{after:l,before:f,...c.current()}));const m=d.charCodeAt(0),y=Fu(s.before.charCodeAt(s.before.length-1),m,l);y.inside&&(d=Fl(m)+d.slice(1));const g=d.charCodeAt(d.length-1),x=Fu(s.after.charCodeAt(0),g,l);x.inside&&(d=d.slice(0,-1)+Fl(g));const v=c.move(l);return u(),r.attentionEncodeSurroundingInfo={after:x.outside,before:y.outside},f+d+v}function p3(e,t,r){return r.options.emphasis||"*"}function g3(e,t){let r=!1;return lm(e,function(s){if("value"in s&&/\r?\n|\r/.test(s.value)||s.type==="break")return r=!0,kd}),!!((!e.depth||e.depth<3)&&em(e)&&(t.options.setext||r))}function y3(e,t,r,s){const l=Math.max(Math.min(6,e.depth||1),1),u=r.createTracker(s);if(g3(e,r)){const y=r.enter("headingSetext"),g=r.enter("phrasing"),x=r.containerPhrasing(e,{...u.current(),before:`
112
+ `),o&&(y+=f.move(o+`
113
+ `)),y+=f.move(d),m(),y}function k3(e,t,r){return(r?"":" ")+e}function um(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 E3(e,t,r,s){const l=um(r),o=l==='"'?"Quote":"Apostrophe",c=r.enter("definition");let f=r.enter("label");const d=r.createTracker(s);let m=d.move("[");return m+=d.move(r.safe(r.associationId(e),{before:m,after:"]",...d.current()})),m+=d.move("]: "),f(),!e.url||/[\0- \u007F]/.test(e.url)?(f=r.enter("destinationLiteral"),m+=d.move("<"),m+=d.move(r.safe(e.url,{before:m,after:">",...d.current()})),m+=d.move(">")):(f=r.enter("destinationRaw"),m+=d.move(r.safe(e.url,{before:m,after:e.title?" ":`
114
+ `,...d.current()}))),f(),e.title&&(f=r.enter(`title${o}`),m+=d.move(" "+l),m+=d.move(r.safe(e.title,{before:m,after:l,...d.current()})),m+=d.move(l),f()),c(),m}function C3(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 Fl(e){return"&#x"+e.toString(16).toUpperCase()+";"}function Fu(e,t,r){const s=wa(e),l=wa(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}}O1.peek=A3;function O1(e,t,r,s){const l=C3(r),o=r.enter("emphasis"),c=r.createTracker(s),f=c.move(l);let d=c.move(r.containerPhrasing(e,{after:l,before:f,...c.current()}));const m=d.charCodeAt(0),y=Fu(s.before.charCodeAt(s.before.length-1),m,l);y.inside&&(d=Fl(m)+d.slice(1));const g=d.charCodeAt(d.length-1),x=Fu(s.after.charCodeAt(0),g,l);x.inside&&(d=d.slice(0,-1)+Fl(g));const v=c.move(l);return o(),r.attentionEncodeSurroundingInfo={after:x.outside,before:y.outside},f+d+v}function A3(e,t,r){return r.options.emphasis||"*"}function j3(e,t){let r=!1;return lm(e,function(s){if("value"in s&&/\r?\n|\r/.test(s.value)||s.type==="break")return r=!0,kd}),!!((!e.depth||e.depth<3)&&em(e)&&(t.options.setext||r))}function N3(e,t,r,s){const l=Math.max(Math.min(6,e.depth||1),1),o=r.createTracker(s);if(j3(e,r)){const y=r.enter("headingSetext"),g=r.enter("phrasing"),x=r.containerPhrasing(e,{...o.current(),before:`
115
115
  `,after:`
116
116
  `});return g(),y(),x+`
117
117
  `+(l===1?"=":"-").repeat(x.length-(Math.max(x.lastIndexOf("\r"),x.lastIndexOf(`
118
- `))+1))}const c="#".repeat(l),f=r.enter("headingAtx"),d=r.enter("phrasing");u.move(c+" ");let m=r.containerPhrasing(e,{before:"# ",after:`
119
- `,...u.current()});return/^[\t ]/.test(m)&&(m=Fl(m.charCodeAt(0))+m.slice(1)),m=m?c+" "+m:c,r.options.closeAtx&&(m+=" "+c),d(),f(),m}R1.peek=b3;function R1(e){return e.value||""}function b3(){return"<"}M1.peek=x3;function M1(e,t,r,s){const l=um(r),u=l==='"'?"Quote":"Apostrophe",c=r.enter("image");let f=r.enter("label");const d=r.createTracker(s);let m=d.move("![");return m+=d.move(r.safe(e.alt,{before:m,after:"]",...d.current()})),m+=d.move("]("),f(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(f=r.enter("destinationLiteral"),m+=d.move("<"),m+=d.move(r.safe(e.url,{before:m,after:">",...d.current()})),m+=d.move(">")):(f=r.enter("destinationRaw"),m+=d.move(r.safe(e.url,{before:m,after:e.title?" ":")",...d.current()}))),f(),e.title&&(f=r.enter(`title${u}`),m+=d.move(" "+l),m+=d.move(r.safe(e.title,{before:m,after:l,...d.current()})),m+=d.move(l),f()),m+=d.move(")"),c(),m}function x3(){return"!"}D1.peek=v3;function D1(e,t,r,s){const l=e.referenceType,u=r.enter("imageReference");let c=r.enter("label");const f=r.createTracker(s);let d=f.move("![");const m=r.safe(e.alt,{before:d,after:"]",...f.current()});d+=f.move(m+"]["),c();const y=r.stack;r.stack=[],c=r.enter("reference");const g=r.safe(r.associationId(e),{before:d,after:"]",...f.current()});return c(),r.stack=y,u(),l==="full"||!m||m!==g?d+=f.move(g+"]"):l==="shortcut"?d=d.slice(0,-1):d+=f.move("]"),d}function v3(){return"!"}L1.peek=w3;function L1(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 d;if(c.atBreak)for(;d=f.exec(s);){let m=d.index;s.charCodeAt(m)===10&&s.charCodeAt(m-1)===13&&m--,s=s.slice(0,m)+" "+s.slice(d.index+1)}}return l+s+l}function w3(){return"`"}function z1(e,t){const r=em(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))}U1.peek=S3;function U1(e,t,r,s){const l=um(r),u=l==='"'?"Quote":"Apostrophe",c=r.createTracker(s);let f,d;if(z1(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"),d=r.enter("label");let m=c.move("[");return m+=c.move(r.containerPhrasing(e,{before:m,after:"](",...c.current()})),m+=c.move("]("),d(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(d=r.enter("destinationLiteral"),m+=c.move("<"),m+=c.move(r.safe(e.url,{before:m,after:">",...c.current()})),m+=c.move(">")):(d=r.enter("destinationRaw"),m+=c.move(r.safe(e.url,{before:m,after:e.title?" ":")",...c.current()}))),d(),e.title&&(d=r.enter(`title${u}`),m+=c.move(" "+l),m+=c.move(r.safe(e.title,{before:m,after:l,...c.current()})),m+=c.move(l),d()),m+=c.move(")"),f(),m}function S3(e,t,r){return z1(e,r)?"<":"["}P1.peek=_3;function P1(e,t,r,s){const l=e.referenceType,u=r.enter("linkReference");let c=r.enter("label");const f=r.createTracker(s);let d=f.move("[");const m=r.containerPhrasing(e,{before:d,after:"]",...f.current()});d+=f.move(m+"]["),c();const y=r.stack;r.stack=[],c=r.enter("reference");const g=r.safe(r.associationId(e),{before:d,after:"]",...f.current()});return c(),r.stack=y,u(),l==="full"||!m||m!==g?d+=f.move(g+"]"):l==="shortcut"?d=d.slice(0,-1):d+=f.move("]"),d}function _3(){return"["}function cm(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 k3(e){const t=cm(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 E3(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 B1(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 C3(e,t,r,s){const l=r.enter("list"),u=r.bulletCurrent;let c=e.ordered?E3(r):cm(r);const f=e.ordered?c==="."?")":".":k3(r);let d=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&&(d=!0),B1(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"){d=!0;break}}}}d&&(c=f),r.bulletCurrent=c;const m=r.containerFlow(e,s);return r.bulletLastUsed=c,r.bulletCurrent=u,l(),m}function A3(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 j3(e,t,r,s){const l=A3(r);let u=r.bulletCurrent||cm(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 d=r.enter("listItem"),m=r.indentLines(r.containerFlow(e,f.current()),y);return d(),m;function y(g,x,v){return x?(v?"":" ".repeat(c))+g:(v?u:u+" ".repeat(c-u.length))+g}}function N3(e,t,r,s){const l=r.enter("paragraph"),u=r.enter("phrasing"),c=r.containerPhrasing(e,s);return u(),l(),c}const T3=nc(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function O3(e,t,r,s){return(e.children.some(function(c){return T3(c)})?r.containerPhrasing:r.containerFlow).call(r,e,s)}function R3(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}H1.peek=M3;function H1(e,t,r,s){const l=R3(r),u=r.enter("strong"),c=r.createTracker(s),f=c.move(l+l);let d=c.move(r.containerPhrasing(e,{after:l,before:f,...c.current()}));const m=d.charCodeAt(0),y=Fu(s.before.charCodeAt(s.before.length-1),m,l);y.inside&&(d=Fl(m)+d.slice(1));const g=d.charCodeAt(d.length-1),x=Fu(s.after.charCodeAt(0),g,l);x.inside&&(d=d.slice(0,-1)+Fl(g));const v=c.move(l+l);return u(),r.attentionEncodeSurroundingInfo={after:x.outside,before:y.outside},f+d+v}function M3(e,t,r){return r.options.strong||"*"}function D3(e,t,r,s){return r.safe(e.value,s)}function L3(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 z3(e,t,r){const s=(B1(r)+(r.options.ruleSpaces?" ":"")).repeat(L3(r));return r.options.ruleSpaces?s.slice(0,-1):s}const q1={blockquote:s3,break:Hb,code:f3,definition:d3,emphasis:O1,hardBreak:Hb,heading:y3,html:R1,image:M1,imageReference:D1,inlineCode:L1,link:U1,linkReference:P1,list:C3,listItem:j3,paragraph:N3,root:O3,strong:H1,text:D3,thematicBreak:z3};function U3(){return{enter:{table:P3,tableData:qb,tableHeader:qb,tableRow:H3},exit:{codeText:q3,table:B3,tableData:Qh,tableHeader:Qh,tableRow:Qh}}}function P3(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 B3(e){this.exit(e),this.data.inTable=void 0}function H3(e){this.enter({type:"tableRow",children:[]},e)}function Qh(e){this.exit(e)}function qb(e){this.enter({type:"tableCell",children:[]},e)}function q3(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,I3));const r=this.stack[this.stack.length-1];r.type,r.value=t,this.exit(e)}function I3(e,t){return t==="|"?t:e}function F3(e){const t=e||{},r=t.tableCellPadding,s=t.tablePipeAlign,l=t.stringLength,u=r?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
120
- `,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:x,table:c,tableCell:d,tableRow:f}};function c(v,S,j,D){return m(y(v,j,D),v.align)}function f(v,S,j,D){const T=g(v,j,D),P=m([T]);return P.slice(0,P.indexOf(`
121
- `))}function d(v,S,j,D){const T=j.enter("tableCell"),P=j.enter("phrasing"),I=j.containerPhrasing(v,{...D,before:u,after:u});return P(),T(),I}function m(v,S){return r3(v,{align:S,alignDelimiters:s,padding:r,stringLength:l})}function y(v,S,j){const D=v.children;let T=-1;const P=[],I=S.enter("table");for(;++T<D.length;)P[T]=g(D[T],S,j);return I(),P}function g(v,S,j){const D=v.children;let T=-1;const P=[],I=S.enter("tableRow");for(;++T<D.length;)P[T]=d(D[T],v,S,j);return I(),P}function x(v,S,j){let D=q1.inlineCode(v,S,j);return j.stack.includes("tableCell")&&(D=D.replace(/\|/g,"\\$&")),D}}function $3(){return{exit:{taskListCheckValueChecked:Ib,taskListCheckValueUnchecked:Ib,paragraph:Y3}}}function V3(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:G3}}}function Ib(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function Y3(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 G3(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 d=q1.listItem(e,t,r,{...s,...f.current()});return u&&(d=d.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,m)),d;function m(y){return y+c}}function J3(){return[CT(),GT(),QT(),U3(),$3()]}function X3(e){return{extensions:[AT(),JT(e),ZT(),F3(e),V3()]}}const K3={tokenize:nO,partial:!0},I1={tokenize:rO,partial:!0},F1={tokenize:iO,partial:!0},$1={tokenize:sO,partial:!0},Q3={tokenize:aO,partial:!0},V1={name:"wwwAutolink",tokenize:eO,previous:G1},Y1={name:"protocolAutolink",tokenize:tO,previous:J1},bi={name:"emailAutolink",tokenize:W3,previous:X1},Yr={};function Z3(){return{text:Yr}}let ys=48;for(;ys<123;)Yr[ys]=bi,ys++,ys===58?ys=65:ys===91&&(ys=97);Yr[43]=bi;Yr[45]=bi;Yr[46]=bi;Yr[95]=bi;Yr[72]=[bi,Y1];Yr[104]=[bi,Y1];Yr[87]=[bi,V1];Yr[119]=[bi,V1];function W3(e,t,r){const s=this;let l,u;return c;function c(g){return!jd(g)||!X1.call(s,s.previous)||fm(s.events)?r(g):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),f(g))}function f(g){return jd(g)?(e.consume(g),f):g===64?(e.consume(g),d):r(g)}function d(g){return g===46?e.check(Q3,y,m)(g):g===45||g===95||jn(g)?(u=!0,e.consume(g),d):y(g)}function m(g){return e.consume(g),l=!0,d}function y(g){return u&&l&&zn(s.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(g)):r(g)}}function eO(e,t,r){const s=this;return l;function l(c){return c!==87&&c!==119||!G1.call(s,s.previous)||fm(s.events)?r(c):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(K3,e.attempt(I1,e.attempt(F1,u),r),r)(c))}function u(c){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(c)}}function tO(e,t,r){const s=this;let l="",u=!1;return c;function c(g){return(g===72||g===104)&&J1.call(s,s.previous)&&!fm(s.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),l+=String.fromCodePoint(g),e.consume(g),f):r(g)}function f(g){if(zn(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),d}return r(g)}function d(g){return g===47?(e.consume(g),u?m:(u=!0,d)):r(g)}function m(g){return g===null||Hu(g)||Lt(g)||vs(g)||Wu(g)?r(g):e.attempt(I1,e.attempt(F1,y),r)(g)}function y(g){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(g)}}function nO(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 rO(e,t,r){let s,l,u;return c;function c(m){return m===46||m===95?e.check($1,d,f)(m):m===null||Lt(m)||vs(m)||m!==45&&Wu(m)?d(m):(u=!0,e.consume(m),c)}function f(m){return m===95?s=!0:(l=s,s=void 0),e.consume(m),c}function d(m){return l||s||!u?r(m):t(m)}}function iO(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($1,t,u)(c):c===null||Lt(c)||vs(c)?t(c):(e.consume(c),l)}function u(c){return c===41&&s++,e.consume(c),l}}function sO(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||Lt(f)||vs(f)?t(f):r(f)}function l(f){return f===null||f===40||f===91||Lt(f)||vs(f)?t(f):s(f)}function u(f){return zn(f)?c(f):r(f)}function c(f){return f===59?(e.consume(f),s):zn(f)?(e.consume(f),c):r(f)}}function aO(e,t,r){return s;function s(u){return e.consume(u),l}function l(u){return jn(u)?r(u):t(u)}}function G1(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Lt(e)}function J1(e){return!zn(e)}function X1(e){return!(e===47||jd(e))}function jd(e){return e===43||e===45||e===46||e===95||jn(e)}function fm(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 lO={tokenize:pO,partial:!0};function oO(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:hO,continuation:{tokenize:dO},exit:mO}},text:{91:{name:"gfmFootnoteCall",tokenize:fO},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:uO,resolveTo:cO}}}}function uO(e,t,r){const s=this;let l=s.events.length;const u=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let c;for(;l--;){const d=s.events[l][1];if(d.type==="labelImage"){c=d;break}if(d.type==="gfmFootnoteCall"||d.type==="labelLink"||d.type==="label"||d.type==="image"||d.type==="link")break}return f;function f(d){if(!c||!c._balanced)return r(d);const m=Dr(s.sliceSerialize({start:c.end,end:s.now()}));return m.codePointAt(0)!==94||!u.includes(m.slice(1))?r(d):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(d),e.exit("gfmFootnoteCallLabelMarker"),t(d))}}function cO(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 fO(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"),d}function d(g){return g!==94?r(g):(e.enter("gfmFootnoteCallMarker"),e.consume(g),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",m)}function m(g){if(u>999||g===93&&!c||g===null||g===91||Lt(g))return r(g);if(g===93){e.exit("chunkString");const x=e.exit("gfmFootnoteCallString");return l.includes(Dr(s.sliceSerialize(x)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(g),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):r(g)}return Lt(g)||(c=!0),u++,e.consume(g),g===92?y:m}function y(g){return g===91||g===92||g===93?(e.consume(g),u++,m):m(g)}}function hO(e,t,r){const s=this,l=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let u,c=0,f;return d;function d(S){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(S),e.exit("gfmFootnoteDefinitionLabelMarker"),m}function m(S){return S===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(S),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",y):r(S)}function y(S){if(c>999||S===93&&!f||S===null||S===91||Lt(S))return r(S);if(S===93){e.exit("chunkString");const j=e.exit("gfmFootnoteDefinitionLabelString");return u=Dr(s.sliceSerialize(j)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(S),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),x}return Lt(S)||(f=!0),c++,e.consume(S),S===92?g:y}function g(S){return S===91||S===92||S===93?(e.consume(S),c++,y):y(S)}function x(S){return S===58?(e.enter("definitionMarker"),e.consume(S),e.exit("definitionMarker"),l.includes(u)||l.push(u),ht(e,v,"gfmFootnoteDefinitionWhitespace")):r(S)}function v(S){return t(S)}}function dO(e,t,r){return e.check(Xl,t,e.attempt(lO,t,r))}function mO(e){e.exit("gfmFootnoteDefinition")}function pO(e,t,r){const s=this;return ht(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 gO(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 d=-1;for(;++d<c.length;)if(c[d][0]==="enter"&&c[d][1].type==="strikethroughSequenceTemporary"&&c[d][1]._close){let m=d;for(;m--;)if(c[m][0]==="exit"&&c[m][1].type==="strikethroughSequenceTemporary"&&c[m][1]._open&&c[d][1].end.offset-c[d][1].start.offset===c[m][1].end.offset-c[m][1].start.offset){c[d][1].type="strikethroughSequence",c[m][1].type="strikethroughSequence";const y={type:"strikethrough",start:Object.assign({},c[m][1].start),end:Object.assign({},c[d][1].end)},g={type:"strikethroughText",start:Object.assign({},c[m][1].end),end:Object.assign({},c[d][1].start)},x=[["enter",y,f],["enter",c[m][1],f],["exit",c[m][1],f],["enter",g,f]],v=f.parser.constructs.insideSpan.null;v&&or(x,x.length,0,ec(v,c.slice(m+1,d),f)),or(x,x.length,0,[["exit",g,f],["enter",c[d][1],f],["exit",c[d][1],f],["exit",y,f]]),or(c,m-1,d-m+3,x),d=m+x.length-2;break}}for(d=-1;++d<c.length;)c[d][1].type==="strikethroughSequenceTemporary"&&(c[d][1].type="data");return c}function u(c,f,d){const m=this.previous,y=this.events;let g=0;return x;function x(S){return m===126&&y[y.length-1][1].type!=="characterEscape"?d(S):(c.enter("strikethroughSequenceTemporary"),v(S))}function v(S){const j=wa(m);if(S===126)return g>1?d(S):(c.consume(S),g++,v);if(g<2&&!r)return d(S);const D=c.exit("strikethroughSequenceTemporary"),T=wa(S);return D._open=!T||T===2&&!!j,D._close=!j||j===2&&!!T,f(S)}}}class yO{constructor(){this.map=[]}add(t,r,s){bO(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 bO(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 xO(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 vO(){return{flow:{null:{name:"table",tokenize:wO,resolveAll:SO}}}}function wO(e,t,r){const s=this;let l=0,u=0,c;return f;function f(L){let X=s.events.length-1;for(;X>-1;){const le=s.events[X][1].type;if(le==="lineEnding"||le==="linePrefix")X--;else break}const G=X>-1?s.events[X][1].type:null,ue=G==="tableHead"||G==="tableRow"?R:d;return ue===R&&s.parser.lazy[s.now().line]?r(L):ue(L)}function d(L){return e.enter("tableHead"),e.enter("tableRow"),m(L)}function m(L){return L===124||(c=!0,u+=1),y(L)}function y(L){return L===null?r(L):He(L)?u>1?(u=0,s.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(L),e.exit("lineEnding"),v):r(L):at(L)?ht(e,y,"whitespace")(L):(u+=1,c&&(c=!1,l+=1),L===124?(e.enter("tableCellDivider"),e.consume(L),e.exit("tableCellDivider"),c=!0,y):(e.enter("data"),g(L)))}function g(L){return L===null||L===124||Lt(L)?(e.exit("data"),y(L)):(e.consume(L),L===92?x:g)}function x(L){return L===92||L===124?(e.consume(L),g):g(L)}function v(L){return s.interrupt=!1,s.parser.lazy[s.now().line]?r(L):(e.enter("tableDelimiterRow"),c=!1,at(L)?ht(e,S,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(L):S(L))}function S(L){return L===45||L===58?D(L):L===124?(c=!0,e.enter("tableCellDivider"),e.consume(L),e.exit("tableCellDivider"),j):B(L)}function j(L){return at(L)?ht(e,D,"whitespace")(L):D(L)}function D(L){return L===58?(u+=1,c=!0,e.enter("tableDelimiterMarker"),e.consume(L),e.exit("tableDelimiterMarker"),T):L===45?(u+=1,T(L)):L===null||He(L)?W(L):B(L)}function T(L){return L===45?(e.enter("tableDelimiterFiller"),P(L)):B(L)}function P(L){return L===45?(e.consume(L),P):L===58?(c=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(L),e.exit("tableDelimiterMarker"),I):(e.exit("tableDelimiterFiller"),I(L))}function I(L){return at(L)?ht(e,W,"whitespace")(L):W(L)}function W(L){return L===124?S(L):L===null||He(L)?!c||l!==u?B(L):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(L)):B(L)}function B(L){return r(L)}function R(L){return e.enter("tableRow"),Z(L)}function Z(L){return L===124?(e.enter("tableCellDivider"),e.consume(L),e.exit("tableCellDivider"),Z):L===null||He(L)?(e.exit("tableRow"),t(L)):at(L)?ht(e,Z,"whitespace")(L):(e.enter("data"),F(L))}function F(L){return L===null||L===124||Lt(L)?(e.exit("data"),Z(L)):(e.consume(L),L===92?V:F)}function V(L){return L===92||L===124?(e.consume(L),F):F(L)}}function SO(e,t){let r=-1,s=!0,l=0,u=[0,0,0,0],c=[0,0,0,0],f=!1,d=0,m,y,g;const x=new yO;for(;++r<e.length;){const v=e[r],S=v[1];v[0]==="enter"?S.type==="tableHead"?(f=!1,d!==0&&(Fb(x,t,d,m,y),y=void 0,d=0),m={type:"table",start:Object.assign({},S.start),end:Object.assign({},S.end)},x.add(r,0,[["enter",m,t]])):S.type==="tableRow"||S.type==="tableDelimiterRow"?(s=!0,g=void 0,u=[0,0,0,0],c=[0,r+1,0,0],f&&(f=!1,y={type:"tableBody",start:Object.assign({},S.start),end:Object.assign({},S.end)},x.add(r,0,[["enter",y,t]])),l=S.type==="tableDelimiterRow"?2:y?3:1):l&&(S.type==="data"||S.type==="tableDelimiterMarker"||S.type==="tableDelimiterFiller")?(s=!1,c[2]===0&&(u[1]!==0&&(c[0]=c[1],g=xu(x,t,u,l,void 0,g),u=[0,0,0,0]),c[2]=r)):S.type==="tableCellDivider"&&(s?s=!1:(u[1]!==0&&(c[0]=c[1],g=xu(x,t,u,l,void 0,g)),u=c,c=[u[1],r,0,0])):S.type==="tableHead"?(f=!0,d=r):S.type==="tableRow"||S.type==="tableDelimiterRow"?(d=r,u[1]!==0?(c[0]=c[1],g=xu(x,t,u,l,r,g)):c[1]!==0&&(g=xu(x,t,c,l,r,g)),l=0):l&&(S.type==="data"||S.type==="tableDelimiterMarker"||S.type==="tableDelimiterFiller")&&(c[3]=r)}for(d!==0&&Fb(x,t,d,m,y),x.consume(t.events),r=-1;++r<t.events.length;){const v=t.events[r];v[0]==="enter"&&v[1].type==="table"&&(v[1]._align=xO(t.events,r))}return e}function xu(e,t,r,s,l,u){const c=s===1?"tableHeader":s===2?"tableDelimiter":"tableData",f="tableContent";r[0]!==0&&(u.end=Object.assign({},la(t.events,r[0])),e.add(r[0],0,[["exit",u,t]]));const d=la(t.events,r[1]);if(u={type:c,start:Object.assign({},d),end:Object.assign({},d)},e.add(r[1],0,[["enter",u,t]]),r[2]!==0){const m=la(t.events,r[2]),y=la(t.events,r[3]),g={type:f,start:Object.assign({},m),end:Object.assign({},y)};if(e.add(r[2],0,[["enter",g,t]]),s!==2){const x=t.events[r[2]],v=t.events[r[3]];if(x[1].end=Object.assign({},v[1].end),x[1].type="chunkText",x[1].contentType="text",r[3]>r[2]+1){const S=r[2]+1,j=r[3]-r[2]-1;e.add(S,j,[])}}e.add(r[3]+1,0,[["exit",g,t]])}return l!==void 0&&(u.end=Object.assign({},la(t.events,l)),e.add(l,0,[["exit",u,t]]),u=void 0),u}function Fb(e,t,r,s,l){const u=[],c=la(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 la(e,t){const r=e[t],s=r[0]==="enter"?"start":"end";return r[1][s]}const _O={name:"tasklistCheck",tokenize:EO};function kO(){return{text:{91:_O}}}function EO(e,t,r){const s=this;return l;function l(d){return s.previous!==null||!s._gfmTasklistFirstContentOfListItem?r(d):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(d),e.exit("taskListCheckMarker"),u)}function u(d){return Lt(d)?(e.enter("taskListCheckValueUnchecked"),e.consume(d),e.exit("taskListCheckValueUnchecked"),c):d===88||d===120?(e.enter("taskListCheckValueChecked"),e.consume(d),e.exit("taskListCheckValueChecked"),c):r(d)}function c(d){return d===93?(e.enter("taskListCheckMarker"),e.consume(d),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),f):r(d)}function f(d){return He(d)?t(d):at(d)?e.check({tokenize:CO},t,r)(d):r(d)}}function CO(e,t,r){return ht(e,s,"whitespace");function s(l){return l===null?r(l):t(l)}}function AO(e){return s1([Z3(),oO(),gO(e),vO(),kO()])}const jO={};function $b(e){const t=this,r=e||jO,s=t.data(),l=s.micromarkExtensions||(s.micromarkExtensions=[]),u=s.fromMarkdownExtensions||(s.fromMarkdownExtensions=[]),c=s.toMarkdownExtensions||(s.toMarkdownExtensions=[]);l.push(AO(r)),u.push(J3()),c.push(X3(r))}function NO(e){C1(e,[/\r?\n|\r/g,TO])}function TO(){return{type:"break"}}function Vb(){return function(e){NO(e)}}function OO({connected:e,hostId:t,request:r,subscribeEvents:s,taskId:l,runId:u}){const c=Vr(),f=Yd(),[d,m]=A.useState(!0),[y,g]=A.useState([]),[x,v]=A.useState(),[S,j]=A.useState(),[D,T]=A.useState(),P=x==="started",I=x==="followup",W=x==="started"||x==="followup",[B,R]=A.useState(null);yd(B!==null,()=>R(null));const[Z,F]=A.useState(!1),[V,L]=A.useState(""),[X,G]=A.useState(!1),ue=A.useRef(null),le=A.useRef(null),re=A.useRef(null),[$,q]=A.useState(u==="latest"?void 0:u),ae=u==="latest"&&$===null;A.useEffect(()=>{if(u!=="latest"){q(u);return}e&&(q(void 0),r("taskrun.list",{task_id:l,limit:1}).then(_=>{var ge,Ce;return q(((Ce=(ge=_.entries)==null?void 0:ge[0])==null?void 0:Ce.run_id)??null)}).catch(()=>q(null)))},[u,l,e,r]);async function be(){if($)try{const _=await r("task.result",{id:l,run_id:$});if(_.error){console.error("No result:",_.error),c(t?`/hosts/${encodeURIComponent(t)}`:"/",{replace:!0});return}g(_.messages??[]),v(_.running_state),j(_.agent),T(_.agent_version)}catch(_){console.error("Failed to load result:",_),c(t?`/hosts/${encodeURIComponent(t)}`:"/",{replace:!0})}finally{m(!1)}}async function M(_){var ge;if($)try{const we=(ge=(await r("task.reports",{id:l,run_id:$,report_files:[_]})).reports)==null?void 0:ge[0];we!=null&&we.data_url?R({file:_,data_url:we.data_url}):R({file:_,content:(we==null?void 0:we.content)??"Report not found."})}catch{R({file:_,content:"Failed to load report."})}}A.useEffect(()=>{!e||!$||(m(!0),be())},[e,l,$]),A.useEffect(()=>!e||!t||!$?void 0:s(t,async ge=>{try{const Ce=JSON.parse(new TextDecoder().decode(ge.data));if(Ce.event_type!=="running-state"&&Ce.event_type!=="result-updated"||ge.subject.split(".").pop()!==l||Ce.event_type==="result-updated"&&Ce.run_id&&Ce.run_id!==$)return;be()}catch{}}),[e,t,l,$,s,r]),A.useEffect(()=>{ue.current&&(ue.current.scrollTop=ue.current.scrollHeight)},[y]),A.useEffect(()=>{d||ae||!$||re.current!==$&&(re.current=$,requestAnimationFrame(()=>{ue.current&&(ue.current.scrollTop=ue.current.scrollHeight),window.scrollTo({top:document.documentElement.scrollHeight,behavior:"auto"})}))},[d,ae,$]);function U(_){if(_==="input")return"User Input";if(_==="permission")return"Permission";if(_==="confirmation")return"Confirmation"}function ee(_){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"]}),ae?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."})]}):d?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:ue,children:[y.map((_,ge)=>{const Ce=W&&_.role==="assistant"&&!y.slice(ge+1).some(we=>we.role==="assistant"||we.role==="user");return _.role==="status"?b.jsxs("div",{className:`chat-status${_.type==="error"?" chat-status--error":""}`,children:[b.jsxs("div",{children:[ee(_.type),_.time>0&&b.jsx("span",{className:"chat-status-time",children:f(_.time)})]}),_.content&&b.jsx("pre",{className:"chat-status-detail",children:_.content})]},ge):b.jsxs("div",{className:`chat-message chat-message--${_.role}${_.role==="assistant"&&_.stream==="stderr"?" chat-message--stderr":""}`,children:[_.role==="assistant"&&S&&b.jsxs("div",{className:"chat-message-agent",children:[gd(S),D&&b.jsxs("span",{className:"chat-message-agent-version",children:[" v",D]})]}),b.jsxs("div",{className:"chat-message-content",children:[b.jsx(zb,{remarkPlugins:[$b,Vb],components:{a:({...we})=>b.jsx("a",{...we,target:"_blank",rel:"noopener noreferrer"})},children:_.content}),Ce&&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(we=>b.jsx("button",{className:"chat-attachment-chip",onClick:()=>M(we),children:we},we))}),b.jsxs("div",{className:"chat-message-meta",children:[U(_.type)&&b.jsx("span",{className:"chat-message-type",children:U(_.type)}),_.time>0&&b.jsx("span",{children:f(_.time)})]})]},ge)}),W&&(()=>{const _=y.filter(ge=>ge.role!=="status");return _.length===0||_[_.length-1].role!=="assistant"})()&&b.jsxs("div",{className:"chat-message chat-message--assistant",children:[S&&b.jsxs("div",{className:"chat-message-agent",children:[gd(S),D&&b.jsxs("span",{className:"chat-message-agent-version",children:[" v",D]})]}),b.jsxs("div",{className:"chat-typing-indicator",children:[b.jsx("span",{}),b.jsx("span",{}),b.jsx("span",{})]})]})]}),P||I?b.jsx("div",{className:"chat-input-bar",children:b.jsx("button",{className:"btn btn-secondary chat-stop-btn",disabled:Z,"aria-label":"Abort task",onClick:async()=>{if(confirm("Abort this task?")){F(!0);try{await r("task.abort",{id:l})}catch(_){console.error("Abort failed:",_)}finally{F(!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 ge=V.trim();if(!(!ge||X)){G(!0);try{await r("task.followup",{id:l,run_id:$,message:ge}),L("")}catch(Ce){console.error("Follow-up failed:",Ce)}finally{G(!1)}}},children:[b.jsx("input",{ref:le,className:"chat-input",type:"text",placeholder:"Follow-up message",value:V,onChange:_=>L(_.target.value),disabled:X}),b.jsx("button",{className:"btn btn-primary chat-send-btn",type:"submit",disabled:!V.trim()||X,children:b.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[b.jsx("line",{x1:"22",y1:"2",x2:"11",y2:"13"}),b.jsx("polygon",{points:"22 2 15 22 11 13 2 9 22 2"})]})})]}),b.jsxs("button",{className:"run-detail-back run-detail-back--footer",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&&b.jsx("div",{className:"report-dialog-overlay",onClick:()=>R(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:B.file}),b.jsx("button",{className:"report-dialog-close",onClick:()=>R(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:B.data_url?b.jsx("img",{src:B.data_url,alt:B.file,style:{maxWidth:"100%",height:"auto"}}):b.jsx(zb,{remarkPlugins:[$b,Vb],components:{a:({..._})=>b.jsx("a",{..._,target:"_blank",rel:"noopener noreferrer"})},children:B.content??""})})]})})]})}function Zh({title:e,message:t,onUpdate:r,onDismiss:s}){return b.jsx("div",{className:"confirm-modal-overlay",children:b.jsxs("div",{className:"confirm-modal",children:[b.jsx("h2",{className:"confirm-modal-title",children:e}),b.jsx("p",{className:"confirm-modal-message",children:t}),b.jsxs("div",{className:"confirm-modal-actions",children:[b.jsx("button",{className:"btn btn-primary",onClick:r,children:"Update Now"}),s&&b.jsx("button",{className:"btn btn-secondary",onClick:s,children:"Dismiss"})]})]})})}function RO(){const{activeHost:e}=yi(),t=A.useRef(null);A.useEffect(()=>{if(cr.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 bE("/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 yE("/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 MO="0.9.9";function vu(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 wu(){const{removePairedHost:e,setHostLanUrl:t,setHostTimezone:r}=Xi(),{connected:s,request:l,subscribeEvents:u,unauthorized:c,activeHost:f}=yi(),d=f.hostId,m=f.clientToken||null,y=Vr(),g=Er(),x=Yu(),v=Fx("(min-width: 768px)"),S=g.pathname.endsWith("/tasks"),j=x.runId?void 0:x.taskId,D=!!(x.taskId&&x.runId),[T,P]=A.useState(!1),[I,W]=A.useState(!1),[B,R]=A.useState(null),[Z,F]=A.useState(null),[V,L]=A.useState(null),[X,G]=A.useState(null),[ue,le]=A.useState({}),[re,$]=A.useState({}),[q,ae]=A.useState(null),[be,M]=A.useState(null),[U,ee]=A.useState(null),[_,ge]=A.useState(null),[Ce,we]=A.useState(new Set),[Te,Ve]=A.useState([]),[Ae,dt]=A.useState(),[qt,ln]=A.useState("loading"),tn=!!m&&_===m,[Gt,on]=A.useState(new Map),[Rt,Kt]=A.useState(new Map),[Pe,ct]=A.useState(new Map),[Ke,bt]=A.useState(new Map),[zt,Pn]=A.useState(new Map),[$e,Tn]=A.useState(new Map),[ce,_e]=A.useState(new Map);RO(),A.useEffect(()=>{window.scrollTo(0,0)},[d]),A.useEffect(()=>{let xe=!1;return QE().then(Ee=>{xe||we(Ee)}),()=>{xe=!0}},[]),A.useEffect(()=>{if(!s){ln("loading");return}ln("loading");let xe=!1;return l("host.info",void 0,{timeout:15e3}).then(Ee=>{var Ie,mt,Xt,It,nn,Bn,Zi;if(xe)return;Ve(Ee.agents??[]),ae(Ee.playwright_cli??null),dt(Ee.host_platform),ge(Ee.linked_client_token??null),RE(Ee.agents??[]);const Ye=Ee.version??null;F(Ye),P(!!Ye&&vu(Ye,MO)),t(d,Ee.lan_url??void 0),r(d,Ee.host_timezone);const We=new Map,Fe=new Map,ft=new Map,rt=new Map;for(const Mt of Ee.pending_prompts??[])if(Mt.type==="confirmation")We.set(Mt.key,{description:((Ie=Mt.meta)==null?void 0:Ie.description)??"",sessionName:(mt=Mt.meta)==null?void 0:mt.session_name});else if(Mt.type==="permission")Fe.set(Mt.key,{permissions:Mt.params??[],sessionName:(Xt=Mt.meta)==null?void 0:Xt.session_name});else if(Mt.type==="input"){const wt=Mt.params??((It=Mt.meta)==null?void 0:It.input_questions)??[];ft.set(Mt.key,{questions:wt,description:(nn=Mt.meta)==null?void 0:nn.description,sessionName:(Bn=Mt.meta)==null?void 0:Bn.session_name,secret:(Zi=Mt.meta)==null?void 0:Zi.secret}),rt.set(Mt.key,new Array(wt.length).fill(""))}on(We),Kt(Fe),ct(ft),bt(rt),ln("ready")}).catch(()=>{xe||ln("error")}),()=>{xe=!0}},[s,d,l,t,r]),A.useEffect(()=>s?u(d,Ee=>{const Ye=Ee.subject.split(".");if(Ye.length<3)return;const We=Ye.slice(2).join(".");let Fe={};try{Fe=JSON.parse(new TextDecoder().decode(Ee.data))}catch{return}const ft=Fe.event_type,rt=Fe.session_id;if(ft==="input-request"&&rt){const Ie=Fe.input_questions,mt=Fe.session_name,Xt=Fe.description,It=Fe.secret;Ie!=null&&Ie.length&&(ct(nn=>{if(nn.has(rt))return nn;const Bn=new Map(nn);return Bn.set(rt,{questions:Ie,description:Xt,sessionName:mt,secret:It}),Bn}),bt(nn=>{if(nn.has(rt))return nn;const Bn=new Map(nn);return Bn.set(rt,new Array(Ie.length).fill("")),Bn}));return}if(ft==="input-resolved"&&rt){ct(Ie=>{if(!Ie.has(rt))return Ie;const mt=new Map(Ie);return mt.delete(rt),mt}),bt(Ie=>{const mt=new Map(Ie);return mt.delete(rt),mt}),Pn(Ie=>{if(!Ie.has(rt))return Ie;const mt=new Map(Ie);return mt.delete(rt),mt});return}if(ft==="confirm-request"&&rt){const Ie=Fe.description,mt=Fe.session_name;Ie&&on(Xt=>{if(Xt.has(rt))return Xt;const It=new Map(Xt);return It.set(rt,{description:Ie,sessionName:mt}),It});return}if(ft==="confirm-resolved"&&rt){on(Ie=>{if(!Ie.has(rt))return Ie;const mt=new Map(Ie);return mt.delete(rt),mt});return}if(ft==="permission-request"){const Ie=Fe.required_permissions,mt=Fe.session_name;Ie!=null&&Ie.length&&Kt(Xt=>{if(Xt.has(We))return Xt;const It=new Map(Xt);return It.set(We,{permissions:Ie,sessionName:mt}),It});return}if(ft==="permission-resolved"){Kt(Ie=>{if(!Ie.has(We))return Ie;const mt=new Map(Ie);return mt.delete(We),mt});return}}):void 0,[s,d,u]);async function Le(xe,Ee,Ye,We){if(!$e.has(xe)){Tn(Fe=>new Map(Fe).set(xe,Ee)),_e(Fe=>{const ft=new Map(Fe);return ft.delete(xe),ft});try{await l("task.user_input",{id:xe,value:Ye},{timeout:3e4}),We()}catch(Fe){console.error("[Dashboard] Failed to send user input:",Fe),_e(ft=>new Map(ft).set(xe,"Couldn't reach the host. Try again."))}finally{Tn(Fe=>{const ft=new Map(Fe);return ft.delete(xe),ft})}}}function Ge(xe,Ee){Le(xe,Ee,[Ee],()=>{on(Ye=>{const We=new Map(Ye);return We.delete(xe),We})})}function et(xe,Ee){Le(xe,Ee,[Ee],()=>{Kt(Ye=>{const We=new Map(Ye);return We.delete(xe),We})})}function un(xe,Ee,Ye){Le(xe,Ee,Ye,()=>{ct(We=>{const Fe=new Map(We);return Fe.delete(xe),Fe}),bt(We=>{const Fe=new Map(We);return Fe.delete(xe),Fe}),Pn(We=>{const Fe=new Map(We);return Fe.delete(xe),Fe})})}function vn(xe,Ee){if(!xs())return;const Ye=`/hosts/${encodeURIComponent(d)}/runs/${encodeURIComponent(xe)}`;y(Ee?`${Ye}/${encodeURIComponent(Ee)}`:Ye)}A.useEffect(()=>{if(!Z)return;let xe=!1;return fetch("https://registry.npmjs.org/palmier/latest").then(Ee=>Ee.ok?Ee.json():null).then(Ee=>{!xe&&(Ee!=null&&Ee.version)&&L(Ee.version)}).catch(()=>{}),()=>{xe=!0}},[Z]),A.useEffect(()=>{let xe=!1;for(const Ee of Te)!Ee.version||!Ee.npmPackage||fetch(`https://registry.npmjs.org/${Ee.npmPackage}/latest`).then(Ye=>Ye.ok?Ye.json():null).then(Ye=>{xe||!(Ye!=null&&Ye.version)||le(We=>We[Ee.key]===Ye.version?We:{...We,[Ee.key]:Ye.version})}).catch(()=>{});return()=>{xe=!0}},[Te]);const Ct=Te.find(xe=>{if(!xe.version)return!1;const Ee=ue[xe.key];return!Ee||!vu(xe.version,Ee)?!1:re[xe.key]!==Ee});function xt(xe,Ee){$(Ye=>({...Ye,[xe]:Ee}))}async function Jt(xe){W("agent"),R(null);try{const Ee=await l("host.updateAgent",{key:xe});if(Ee.error){R(Ee.error),W(!1);return}const Ye=await l("host.info");Ye.agents&&Ve(Ye.agents)}catch(Ee){R(Ee instanceof Error?Ee.message:String(Ee))}finally{W(!1)}}A.useEffect(()=>{if(!(q!=null&&q.npmPackage))return;let xe=!1;return fetch(`https://registry.npmjs.org/${q.npmPackage}/latest`).then(Ee=>Ee.ok?Ee.json():null).then(Ee=>{!xe&&(Ee!=null&&Ee.version)&&M(Ee.version)}).catch(()=>{}),()=>{xe=!0}},[q==null?void 0:q.npmPackage,q==null?void 0:q.version]);const nt=q&&be&&vu(q.version,be)&&U!==be?q:null;function ve(xe){ee(xe)}async function Be(){W("playwright"),R(null);try{const xe=await l("host.updatePlaywrightCli");if(xe.error){R(xe.error),W(!1);return}const Ee=await l("host.info");ae(Ee.playwright_cli??null)}catch(xe){R(xe instanceof Error?xe.message:String(xe))}finally{W(!1)}}const Oe=!T&&!!Z&&!!V&&vu(Z,V)&&X!==V;function _t(){V&&G(V)}async function Qt(){W("daemon"),R(null);try{const xe=await l("host.update");if(xe.error){R(xe.error),W(!1);return}}catch{}setTimeout(()=>window.location.reload(),3e4)}const On=Gt.size>0||Rt.size>0||Pe.size>0,Jn=s&&!c;return b.jsxs("div",{className:"dashboard",children:[v&&b.jsx(K0,{daemonVersion:Z,agents:Te,playwrightCli:q,linkedClientToken:_,request:l,onEnabledCapabilitiesChange:we,onLinkedClientTokenChange:ge}),b.jsxs("div",{className:"dashboard-content",children:[b.jsxs("header",{className:"app-header",children:[b.jsxs("div",{className:"app-title-bar",children:[!v&&b.jsx(K0,{daemonVersion:Z,agents:Te,playwrightCli:q,linkedClientToken:_,request:l,onEnabledCapabilitiesChange:we,onLinkedClientTokenChange:ge}),b.jsx("h1",{className:"app-title",children:"Palmier"}),b.jsx(rC,{})]}),b.jsx("div",{className:"tab-bar",children:b.jsx(JE,{})})]}),b.jsx("main",{className:"dashboard-main",children:c?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:()=>{xs()&&y("/pair")},children:"Re-pair Device"}),b.jsx("button",{className:"btn btn-secondary",onClick:()=>{e(d),y("/",{replace:!0})},children:"Remove Host"})]})]}):Jn?b.jsxs(b.Fragment,{children:[S&&!D&&b.jsx(GE,{connected:s,hostId:d,request:l,subscribeEvents:u,agents:Te,hostPlatform:Ae,isNotificationListener:tn&&Ce.has("notifications"),onViewRun:vn,hostInfoStatus:qt}),D?b.jsx(OO,{connected:s,hostId:d,request:l,subscribeEvents:u,taskId:x.taskId,runId:decodeURIComponent(x.runId)}):S?null:b.jsx(lC,{connected:s,hostId:d,request:l,subscribeEvents:u,agents:Te,hostPlatform:Ae,filterTaskId:j,onClearFilter:()=>{xs()&&y(`/hosts/${encodeURIComponent(d)}`)},hostInfoStatus:qt})]}):b.jsx("div",{className:"empty-state",children:b.jsx("p",{className:"empty-state-text",children:"Connecting to host…"})})}),(T||Oe)&&!I&&!B&&!On&&b.jsx(Zh,{title:T?"Update Required":"Update Available",message:T?`Your Palmier host${Z?` (v${Z})`:""} is too old for this version of the app. Please update to continue.`:`A new version of Palmier (v${V}) is available. You're running v${Z}.`,onUpdate:Qt,onDismiss:T?void 0:_t}),!T&&!Oe&&Ct&&!I&&!B&&!On&&b.jsx(Zh,{title:"Agent Update Available",message:`A new version of ${Ct.label} (v${ue[Ct.key]}) is available. You're running v${Ct.version}.`,onUpdate:()=>Jt(Ct.key),onDismiss:()=>xt(Ct.key,ue[Ct.key])}),!T&&!Oe&&!Ct&&nt&&be&&!I&&!B&&!On&&b.jsx(Zh,{title:"Browser Automation Update Available",message:`A new version of ${nt.label} (v${be}) is available. You're running v${nt.version}.`,onUpdate:Be,onDismiss:()=>ve(be)}),I&&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:I==="daemon"?"Installing update and restarting daemon. Please wait...":"Installing update. Please wait..."})]})}),B&&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:B}),b.jsx("div",{className:"confirm-modal-actions",children:b.jsx("button",{className:"btn btn-secondary",onClick:()=>{R(null)},children:"Retry"})})]})})]}),di.createPortal(b.jsxs(b.Fragment,{children:[[...Gt.entries()].map(([xe,{description:Ee,sessionName:Ye}])=>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"}),Ye&&b.jsx("p",{className:"confirm-modal-subtitle",children:Ye}),b.jsx("p",{className:"confirm-modal-message",children:Ee}),ce.has(xe)&&b.jsx("p",{className:"form-error",children:ce.get(xe)}),b.jsxs("div",{className:"confirm-modal-actions",children:[b.jsxs("button",{className:"btn btn-primary",disabled:$e.has(xe),onClick:()=>Ge(xe,"confirmed"),children:[$e.get(xe)==="confirmed"&&b.jsx("span",{className:"btn-spinner"}),"Confirm"]}),b.jsxs("button",{className:"btn btn-secondary",disabled:$e.has(xe),onClick:()=>Ge(xe,"aborted"),children:[$e.get(xe)==="aborted"&&b.jsx("span",{className:"btn-spinner btn-spinner-current"}),"Abort"]})]})]})},xe)),[...Rt.entries()].map(([xe,{permissions:Ee,sessionName:Ye}])=>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:Ye||xe})}),b.jsx("div",{className:"permission-list",children:Ee.map((We,Fe)=>b.jsxs("div",{className:"permission-item",children:[b.jsx("span",{className:"permission-name",children:We.name}),We.description&&b.jsx("span",{className:"permission-desc",children:We.description})]},Fe))}),ce.has(xe)&&b.jsx("p",{className:"form-error",children:ce.get(xe)}),b.jsxs("div",{className:"permission-actions",children:[b.jsxs("button",{className:"btn btn-primary",disabled:$e.has(xe),onClick:()=>et(xe,"granted"),children:[$e.get(xe)==="granted"&&b.jsx("span",{className:"btn-spinner"}),"Allow Once"]}),b.jsxs("button",{className:"btn btn-secondary",disabled:$e.has(xe),onClick:()=>et(xe,"granted_all"),children:[$e.get(xe)==="granted_all"&&b.jsx("span",{className:"btn-spinner btn-spinner-current"}),"Allow Always"]})]}),b.jsxs("button",{className:"permission-abort-link",disabled:$e.has(xe),onClick:()=>et(xe,"aborted"),children:[$e.get(xe)==="aborted"&&b.jsx("span",{className:"btn-spinner btn-spinner-current"}),"Deny & Abort Task"]})]})},xe)),[...Pe.entries()].map(([xe,{questions:Ee,description:Ye,sessionName:We,secret:Fe}])=>{const ft=Ke.get(xe)??new Array(Ee.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:Fe?"Password Required":"Input Required"}),We&&b.jsx("p",{className:"confirm-modal-subtitle",children:We}),Ye&&b.jsx("p",{className:"confirm-modal-message",children:Ye}),b.jsx("div",{className:"input-list",children:Ee.map((rt,Ie)=>b.jsxs("div",{className:"input-item",children:[b.jsx("label",{className:"input-label",children:rt}),b.jsx("input",{type:Fe?"password":"text",autoComplete:Fe?"off":void 0,className:"input-field",value:ft[Ie]??"",onChange:mt=>{bt(Xt=>{const It=new Map(Xt),nn=[...It.get(xe)??[]];return nn[Ie]=mt.target.value,It.set(xe,nn),It})},disabled:$e.has(xe),autoFocus:Ie===0})]},Ie))}),Fe&&b.jsxs("label",{className:"toggle-label input-save-toggle",children:[b.jsx("input",{type:"checkbox",checked:zt.get(xe)??!0,disabled:$e.has(xe),onChange:rt=>Pn(Ie=>new Map(Ie).set(xe,rt.target.checked))}),"Save this password"]}),ce.has(xe)&&b.jsx("p",{className:"form-error",children:ce.get(xe)}),b.jsx("div",{className:"input-actions",children:b.jsxs("button",{className:"btn btn-primary",disabled:$e.has(xe)||ft.some(rt=>!rt.trim()),onClick:()=>{const rt=Fe?[...ft,zt.get(xe)??!0?"save":"nosave"]:ft;un(xe,"submit",rt)},children:[$e.get(xe)==="submit"&&b.jsx("span",{className:"btn-spinner"}),"Submit"]})}),b.jsxs("button",{className:"permission-abort-link",disabled:$e.has(xe),onClick:()=>un(xe,"aborted",["aborted"]),children:[$e.get(xe)==="aborted"&&b.jsx("span",{className:"btn-spinner btn-spinner-current"}),"Cancel"]})]})},xe)})]}),document.body)]})}const DO=ws("Preferences",{web:()=>Vd(()=>import("./web-Czrd9jjO.js"),[]).then(e=>new e.PreferencesWeb)}),El=!!window.__PALMIER_SERVE__&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"),Yb=cr.isNativePlatform();function LO(){const[e,t]=A.useState(""),[r,s]=A.useState(!0),[l,u]=A.useState(!1),[c,f]=A.useState(null),{addPairedHost:d,pairedHosts:m}=Xi(),y=Vr();async function g(){const x=e.trim().toUpperCase();if(!x){f("Enter a pairing code.");return}u(!0),f(null);try{let v;if(El){const D=await fetch("/pair",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:x,label:navigator.userAgent})});if(!D.ok){const T=await D.json().catch(()=>({error:"Connection failed"}));throw new Error(T.error||`HTTP ${D.status}`)}v=await D.json()}else{const D=await fetch(`${Bu}/api/config`);if(!D.ok)throw new Error("Failed to fetch server config");const T=await D.json();if(!T.natsWsUrl)throw new Error("Server has no NATS WebSocket URL configured");const P=await zx({servers:T.natsWsUrl,authenticator:Ax(T.natsJwt,new TextEncoder().encode(T.natsNkeySeed))}),I=Ru(),W=`pair.${x}`,B=await P.request(W,I.encode(JSON.stringify({label:navigator.userAgent})),{timeout:1e4});v=JSON.parse(I.decode(B.data)),await P.close()}const S={hostId:v.hostId,clientToken:v.clientToken,directUrl:El?window.location.origin:void 0,...v.hostName?{name:v.hostName}:{}};if(d(S),cr.isNativePlatform()&&An){await DO.set({key:"hostId",value:v.hostId});try{const{token:D}=await An.getFcmToken();await fetch(`${Bu}/api/fcm/register`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({hostId:v.hostId,fcmToken:D})})}catch(D){console.warn("FCM token registration failed:",D)}}const j=`/hosts/${encodeURIComponent(v.hostId)}`;y(Yb&&r?`${j}/pair/setup`:j)}catch(v){const S=v instanceof Error?v.message:String(v);S.includes("timeout")||S.includes("TIMEOUT")||S.includes("503")||S.toLowerCase().includes("no responders")?f("Code not found or expired. Check the code and try again."):f(S)}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:El?"Pair":"Pair with Host"}),b.jsx("p",{className:"pair-subtitle",children:El?"Enter the pairing code shown in your terminal.":"Connect this device to a Palmier host"})]}),!El&&b.jsxs("div",{className:"pair-instructions",children:[b.jsxs("div",{className:"pair-instruction-block",children:[b.jsx("h3",{className:"pair-instruction-heading",children:"Setting up a new host?"}),b.jsxs("ol",{className:"pair-steps",children:[b.jsxs("li",{children:["Install Palmier on your host machine.",b.jsx("span",{className:"pair-platform-label",children:"Linux / macOS:"}),b.jsx("code",{className:"pair-command",children:"curl -fsSL https://palmier.me/install.sh | bash"}),b.jsx("span",{className:"pair-platform-label",children:"Windows (PowerShell):"}),b.jsx("code",{className:"pair-command",children:"irm https://palmier.me/install.ps1 | iex"})]}),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:x=>t(x.target.value.toUpperCase()),placeholder:"A7K9M2",className:"form-input form-input-mono pair-code-input",autoFocus:!0,autoComplete:"off",disabled:l})]}),Yb&&b.jsxs("label",{className:"pair-checkbox",children:[b.jsx("input",{type:"checkbox",checked:r,onChange:x=>s(x.target.checked),disabled:l}),b.jsxs("span",{className:"pair-checkbox-text",children:[b.jsx("span",{className:"pair-checkbox-title",children:"Link the host to this device"}),b.jsx("span",{className:"pair-checkbox-hint",children:r?"The host will use this device for SMS, contacts, calendar, location, and alarms. Only one device can be linked to the host.":"This device won't provide SMS, contacts, calendar, location, or alarms to the host. You can link it later from the menu."})]})]}),c&&b.jsx("p",{className:"pair-error",children:c}),b.jsxs("button",{className:"btn btn-primary btn-full",onClick:g,disabled:l||!e.trim(),children:[l&&b.jsx("span",{className:"btn-spinner"}),l?"Pairing...":"Pair"]}),m.length>0&&b.jsx("button",{className:"btn btn-secondary btn-full",onClick:()=>y("/"),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 zO(){const e=Vr(),{connected:t,request:r,activeHost:s}=yi(),{setHostLanUrl:l,pairedHosts:u}=Xi(),c=u.length<=1,[f,d]=A.useState("loading"),[m,y]=A.useState(null),[g,x]=A.useState(null);function v(){e(`/hosts/${encodeURIComponent(s.hostId)}`,{replace:!0})}A.useEffect(()=>{if(!t||f!=="loading")return;let P=!1;return r("host.info").catch(()=>({})).then(I=>{if(P)return;l(s.hostId,I.lan_url??void 0);const W=I.linked_client_token??null;y(W);const B=!!W&&W!==s.clientToken;d(B?"confirming":"linking")}),()=>{P=!0}},[t,f,s,r,l]),A.useEffect(()=>{if(f!=="linking")return;let P=!1;return(async()=>{try{if(An){const{token:I}=await An.getFcmToken();if(!I)throw new Error("Could not read FCM token");await r("device.link",{fcmToken:I})}if(P)return;c?d("wizard"):v()}catch(I){if(P)return;x(I instanceof Error?I.message:String(I)),d("linkError")}})(),()=>{P=!0}},[f]);function S(){d("linking")}function j(){v()}function D(){x(null),d("linking")}const T=f==="confirming"&&di.createPortal(b.jsx("div",{className:"confirm-modal-overlay",onClick:j,children:b.jsxs("div",{className:"confirm-modal",onClick:P=>P.stopPropagation(),children:[b.jsx("h2",{className:"confirm-modal-title",children:"Link the host to this device?"}),b.jsx("p",{className:"confirm-modal-message",children:"Another device is already linked to this host. Only one device can be linked to the host — 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:j,children:"Cancel"}),b.jsx("button",{className:"btn btn-primary",onClick:S,children:"Link"})]})]})}),document.body);if(f==="loading"||f==="confirming"||f==="linking"||f==="linkError"){const P=c,I=f==="loading"||f==="confirming"||f==="linking";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:[I&&b.jsx("span",{className:"spinner spinner-lg"}),f==="loading"&&b.jsx("span",{children:"Connecting to host…"}),f==="confirming"&&b.jsx("span",{children:"Awaiting confirmation…"}),f==="linking"&&b.jsx("span",{children:"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:D,children:"Retry"}),b.jsx("button",{className:"btn btn-secondary",onClick:v,children:"Skip linking"})]})]})]}),T]})}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($x,{}),b.jsx("div",{className:"pair-setup-actions",children:b.jsx("button",{className:"btn btn-primary btn-full",onClick:v,children:"Finish"})})]})})}function UO(){const e=Vr();return A.useEffect(()=>{if(!An)return;const t=An.addListener("deepLink",({path:r})=>e(r));return()=>{t.then(r=>r.remove())}},[e]),null}function PO(){const{pairedHosts:e,lastHostId:t}=Xi();if(e.length===0)return b.jsx(Ul,{to:"/pair",replace:!0});const r=e.find(s=>s.hostId===t)??e[0];return b.jsx(Ul,{to:`/hosts/${encodeURIComponent(r.hostId)}`,replace:!0})}function BO(){const{hostId:e}=Yu(),{pairedHosts:t,setLastHostId:r}=Xi(),s=t.find(l=>l.hostId===e)??null;return A.useEffect(()=>{s&&r(s.hostId)},[s==null?void 0:s.hostId,r]),s?b.jsx(SE,{activeHost:s,children:b.jsxs(ox,{children:[b.jsx(Or,{index:!0,element:b.jsx(wu,{},e)}),b.jsx(Or,{path:"tasks",element:b.jsx(wu,{},e)}),b.jsx(Or,{path:"runs/:taskId",element:b.jsx(wu,{},e)}),b.jsx(Or,{path:"runs/:taskId/:runId",element:b.jsx(wu,{},e)}),b.jsx(Or,{path:"pair/setup",element:b.jsx(zO,{})}),b.jsx(Or,{path:"*",element:b.jsx(Ul,{to:".",replace:!0})})]})},`${s.hostId}|${s.clientToken}`):b.jsx(Ul,{to:"/",replace:!0})}function HO(){return b.jsxs(Y_,{children:[b.jsx(UO,{}),b.jsxs(ox,{children:[b.jsx(Or,{path:"/",element:b.jsx(PO,{})}),b.jsx(Or,{path:"/pair",element:b.jsx(LO,{})}),b.jsx(Or,{path:"/hosts/:hostId/*",element:b.jsx(BO,{})}),b.jsx(Or,{path:"*",element:b.jsx(Ul,{to:"/",replace:!0})})]})]})}dS.createRoot(document.getElementById("root")).render(b.jsx(A.StrictMode,{children:b.jsx(M_,{children:b.jsx(HO,{})})}));export{$d as W};
118
+ `))+1))}const c="#".repeat(l),f=r.enter("headingAtx"),d=r.enter("phrasing");o.move(c+" ");let m=r.containerPhrasing(e,{before:"# ",after:`
119
+ `,...o.current()});return/^[\t ]/.test(m)&&(m=Fl(m.charCodeAt(0))+m.slice(1)),m=m?c+" "+m:c,r.options.closeAtx&&(m+=" "+c),d(),f(),m}R1.peek=T3;function R1(e){return e.value||""}function T3(){return"<"}M1.peek=O3;function M1(e,t,r,s){const l=um(r),o=l==='"'?"Quote":"Apostrophe",c=r.enter("image");let f=r.enter("label");const d=r.createTracker(s);let m=d.move("![");return m+=d.move(r.safe(e.alt,{before:m,after:"]",...d.current()})),m+=d.move("]("),f(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(f=r.enter("destinationLiteral"),m+=d.move("<"),m+=d.move(r.safe(e.url,{before:m,after:">",...d.current()})),m+=d.move(">")):(f=r.enter("destinationRaw"),m+=d.move(r.safe(e.url,{before:m,after:e.title?" ":")",...d.current()}))),f(),e.title&&(f=r.enter(`title${o}`),m+=d.move(" "+l),m+=d.move(r.safe(e.title,{before:m,after:l,...d.current()})),m+=d.move(l),f()),m+=d.move(")"),c(),m}function O3(){return"!"}D1.peek=R3;function D1(e,t,r,s){const l=e.referenceType,o=r.enter("imageReference");let c=r.enter("label");const f=r.createTracker(s);let d=f.move("![");const m=r.safe(e.alt,{before:d,after:"]",...f.current()});d+=f.move(m+"]["),c();const y=r.stack;r.stack=[],c=r.enter("reference");const g=r.safe(r.associationId(e),{before:d,after:"]",...f.current()});return c(),r.stack=y,o(),l==="full"||!m||m!==g?d+=f.move(g+"]"):l==="shortcut"?d=d.slice(0,-1):d+=f.move("]"),d}function R3(){return"!"}L1.peek=M3;function L1(e,t,r){let s=e.value||"",l="`",o=-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+" ");++o<r.unsafe.length;){const c=r.unsafe[o],f=r.compilePattern(c);let d;if(c.atBreak)for(;d=f.exec(s);){let m=d.index;s.charCodeAt(m)===10&&s.charCodeAt(m-1)===13&&m--,s=s.slice(0,m)+" "+s.slice(d.index+1)}}return l+s+l}function M3(){return"`"}function z1(e,t){const r=em(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))}U1.peek=D3;function U1(e,t,r,s){const l=um(r),o=l==='"'?"Quote":"Apostrophe",c=r.createTracker(s);let f,d;if(z1(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"),d=r.enter("label");let m=c.move("[");return m+=c.move(r.containerPhrasing(e,{before:m,after:"](",...c.current()})),m+=c.move("]("),d(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(d=r.enter("destinationLiteral"),m+=c.move("<"),m+=c.move(r.safe(e.url,{before:m,after:">",...c.current()})),m+=c.move(">")):(d=r.enter("destinationRaw"),m+=c.move(r.safe(e.url,{before:m,after:e.title?" ":")",...c.current()}))),d(),e.title&&(d=r.enter(`title${o}`),m+=c.move(" "+l),m+=c.move(r.safe(e.title,{before:m,after:l,...c.current()})),m+=c.move(l),d()),m+=c.move(")"),f(),m}function D3(e,t,r){return z1(e,r)?"<":"["}P1.peek=L3;function P1(e,t,r,s){const l=e.referenceType,o=r.enter("linkReference");let c=r.enter("label");const f=r.createTracker(s);let d=f.move("[");const m=r.containerPhrasing(e,{before:d,after:"]",...f.current()});d+=f.move(m+"]["),c();const y=r.stack;r.stack=[],c=r.enter("reference");const g=r.safe(r.associationId(e),{before:d,after:"]",...f.current()});return c(),r.stack=y,o(),l==="full"||!m||m!==g?d+=f.move(g+"]"):l==="shortcut"?d=d.slice(0,-1):d+=f.move("]"),d}function L3(){return"["}function cm(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 z3(e){const t=cm(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 U3(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 B1(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 P3(e,t,r,s){const l=r.enter("list"),o=r.bulletCurrent;let c=e.ordered?U3(r):cm(r);const f=e.ordered?c==="."?")":".":z3(r);let d=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&&(d=!0),B1(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"){d=!0;break}}}}d&&(c=f),r.bulletCurrent=c;const m=r.containerFlow(e,s);return r.bulletLastUsed=c,r.bulletCurrent=o,l(),m}function B3(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 H3(e,t,r,s){const l=B3(r);let o=r.bulletCurrent||cm(r);t&&t.type==="list"&&t.ordered&&(o=(typeof t.start=="number"&&t.start>-1?t.start:1)+(r.options.incrementListMarker===!1?0:t.children.indexOf(e))+o);let c=o.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(o+" ".repeat(c-o.length)),f.shift(c);const d=r.enter("listItem"),m=r.indentLines(r.containerFlow(e,f.current()),y);return d(),m;function y(g,x,v){return x?(v?"":" ".repeat(c))+g:(v?o:o+" ".repeat(c-o.length))+g}}function q3(e,t,r,s){const l=r.enter("paragraph"),o=r.enter("phrasing"),c=r.containerPhrasing(e,s);return o(),l(),c}const I3=nc(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function F3(e,t,r,s){return(e.children.some(function(c){return I3(c)})?r.containerPhrasing:r.containerFlow).call(r,e,s)}function $3(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}H1.peek=V3;function H1(e,t,r,s){const l=$3(r),o=r.enter("strong"),c=r.createTracker(s),f=c.move(l+l);let d=c.move(r.containerPhrasing(e,{after:l,before:f,...c.current()}));const m=d.charCodeAt(0),y=Fu(s.before.charCodeAt(s.before.length-1),m,l);y.inside&&(d=Fl(m)+d.slice(1));const g=d.charCodeAt(d.length-1),x=Fu(s.after.charCodeAt(0),g,l);x.inside&&(d=d.slice(0,-1)+Fl(g));const v=c.move(l+l);return o(),r.attentionEncodeSurroundingInfo={after:x.outside,before:y.outside},f+d+v}function V3(e,t,r){return r.options.strong||"*"}function Y3(e,t,r,s){return r.safe(e.value,s)}function G3(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 J3(e,t,r){const s=(B1(r)+(r.options.ruleSpaces?" ":"")).repeat(G3(r));return r.options.ruleSpaces?s.slice(0,-1):s}const q1={blockquote:y3,break:Hb,code:_3,definition:E3,emphasis:O1,hardBreak:Hb,heading:N3,html:R1,image:M1,imageReference:D1,inlineCode:L1,link:U1,linkReference:P1,list:P3,listItem:H3,paragraph:q3,root:F3,strong:H1,text:Y3,thematicBreak:J3};function X3(){return{enter:{table:K3,tableData:qb,tableHeader:qb,tableRow:Z3},exit:{codeText:W3,table:Q3,tableData:Qh,tableHeader:Qh,tableRow:Qh}}}function K3(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 Q3(e){this.exit(e),this.data.inTable=void 0}function Z3(e){this.enter({type:"tableRow",children:[]},e)}function Qh(e){this.exit(e)}function qb(e){this.enter({type:"tableCell",children:[]},e)}function W3(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,eO));const r=this.stack[this.stack.length-1];r.type,r.value=t,this.exit(e)}function eO(e,t){return t==="|"?t:e}function tO(e){const t=e||{},r=t.tableCellPadding,s=t.tablePipeAlign,l=t.stringLength,o=r?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
120
+ `,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:x,table:c,tableCell:d,tableRow:f}};function c(v,S,A,M){return m(y(v,A,M),v.align)}function f(v,S,A,M){const T=g(v,A,M),P=m([T]);return P.slice(0,P.indexOf(`
121
+ `))}function d(v,S,A,M){const T=A.enter("tableCell"),P=A.enter("phrasing"),I=A.containerPhrasing(v,{...M,before:o,after:o});return P(),T(),I}function m(v,S){return p3(v,{align:S,alignDelimiters:s,padding:r,stringLength:l})}function y(v,S,A){const M=v.children;let T=-1;const P=[],I=S.enter("table");for(;++T<M.length;)P[T]=g(M[T],S,A);return I(),P}function g(v,S,A){const M=v.children;let T=-1;const P=[],I=S.enter("tableRow");for(;++T<M.length;)P[T]=d(M[T],v,S,A);return I(),P}function x(v,S,A){let M=q1.inlineCode(v,S,A);return A.stack.includes("tableCell")&&(M=M.replace(/\|/g,"\\$&")),M}}function nO(){return{exit:{taskListCheckValueChecked:Ib,taskListCheckValueUnchecked:Ib,paragraph:iO}}}function rO(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:sO}}}function Ib(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function iO(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 o=-1,c;for(;++o<l.length;){const f=l[o];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 sO(e,t,r,s){const l=e.children[0],o=typeof e.checked=="boolean"&&l&&l.type==="paragraph",c="["+(e.checked?"x":" ")+"] ",f=r.createTracker(s);o&&f.move(c);let d=q1.listItem(e,t,r,{...s,...f.current()});return o&&(d=d.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,m)),d;function m(y){return y+c}}function aO(){return[PT(),s3(),u3(),X3(),nO()]}function lO(e){return{extensions:[BT(),a3(e),c3(),tO(e),rO()]}}const oO={tokenize:mO,partial:!0},I1={tokenize:pO,partial:!0},F1={tokenize:gO,partial:!0},$1={tokenize:yO,partial:!0},uO={tokenize:bO,partial:!0},V1={name:"wwwAutolink",tokenize:hO,previous:G1},Y1={name:"protocolAutolink",tokenize:dO,previous:J1},bi={name:"emailAutolink",tokenize:fO,previous:X1},Yr={};function cO(){return{text:Yr}}let ys=48;for(;ys<123;)Yr[ys]=bi,ys++,ys===58?ys=65:ys===91&&(ys=97);Yr[43]=bi;Yr[45]=bi;Yr[46]=bi;Yr[95]=bi;Yr[72]=[bi,Y1];Yr[104]=[bi,Y1];Yr[87]=[bi,V1];Yr[119]=[bi,V1];function fO(e,t,r){const s=this;let l,o;return c;function c(g){return!jd(g)||!X1.call(s,s.previous)||fm(s.events)?r(g):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),f(g))}function f(g){return jd(g)?(e.consume(g),f):g===64?(e.consume(g),d):r(g)}function d(g){return g===46?e.check(uO,y,m)(g):g===45||g===95||jn(g)?(o=!0,e.consume(g),d):y(g)}function m(g){return e.consume(g),l=!0,d}function y(g){return o&&l&&zn(s.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(g)):r(g)}}function hO(e,t,r){const s=this;return l;function l(c){return c!==87&&c!==119||!G1.call(s,s.previous)||fm(s.events)?r(c):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(oO,e.attempt(I1,e.attempt(F1,o),r),r)(c))}function o(c){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(c)}}function dO(e,t,r){const s=this;let l="",o=!1;return c;function c(g){return(g===72||g===104)&&J1.call(s,s.previous)&&!fm(s.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),l+=String.fromCodePoint(g),e.consume(g),f):r(g)}function f(g){if(zn(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),d}return r(g)}function d(g){return g===47?(e.consume(g),o?m:(o=!0,d)):r(g)}function m(g){return g===null||Hu(g)||Lt(g)||vs(g)||Wu(g)?r(g):e.attempt(I1,e.attempt(F1,y),r)(g)}function y(g){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(g)}}function mO(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),o):r(c)}function o(c){return c===null?r(c):t(c)}}function pO(e,t,r){let s,l,o;return c;function c(m){return m===46||m===95?e.check($1,d,f)(m):m===null||Lt(m)||vs(m)||m!==45&&Wu(m)?d(m):(o=!0,e.consume(m),c)}function f(m){return m===95?s=!0:(l=s,s=void 0),e.consume(m),c}function d(m){return l||s||!o?r(m):t(m)}}function gO(e,t){let r=0,s=0;return l;function l(c){return c===40?(r++,e.consume(c),l):c===41&&s<r?o(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($1,t,o)(c):c===null||Lt(c)||vs(c)?t(c):(e.consume(c),l)}function o(c){return c===41&&s++,e.consume(c),l}}function yO(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),o):f===93?(e.consume(f),l):f===60||f===null||Lt(f)||vs(f)?t(f):r(f)}function l(f){return f===null||f===40||f===91||Lt(f)||vs(f)?t(f):s(f)}function o(f){return zn(f)?c(f):r(f)}function c(f){return f===59?(e.consume(f),s):zn(f)?(e.consume(f),c):r(f)}}function bO(e,t,r){return s;function s(o){return e.consume(o),l}function l(o){return jn(o)?r(o):t(o)}}function G1(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Lt(e)}function J1(e){return!zn(e)}function X1(e){return!(e===47||jd(e))}function jd(e){return e===43||e===45||e===46||e===95||jn(e)}function fm(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 xO={tokenize:AO,partial:!0};function vO(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:kO,continuation:{tokenize:EO},exit:CO}},text:{91:{name:"gfmFootnoteCall",tokenize:_O},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:wO,resolveTo:SO}}}}function wO(e,t,r){const s=this;let l=s.events.length;const o=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let c;for(;l--;){const d=s.events[l][1];if(d.type==="labelImage"){c=d;break}if(d.type==="gfmFootnoteCall"||d.type==="labelLink"||d.type==="label"||d.type==="image"||d.type==="link")break}return f;function f(d){if(!c||!c._balanced)return r(d);const m=Dr(s.sliceSerialize({start:c.end,end:s.now()}));return m.codePointAt(0)!==94||!o.includes(m.slice(1))?r(d):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(d),e.exit("gfmFootnoteCallLabelMarker"),t(d))}}function SO(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 o={type:"gfmFootnoteCallString",start:Object.assign({},l.end),end:Object.assign({},e[e.length-1][1].start)},c={type:"chunkString",contentType:"string",start:Object.assign({},o.start),end:Object.assign({},o.end)},f=[e[r+1],e[r+2],["enter",s,t],e[r+3],e[r+4],["enter",l,t],["exit",l,t],["enter",o,t],["enter",c,t],["exit",c,t],["exit",o,t],e[e.length-2],e[e.length-1],["exit",s,t]];return e.splice(r,e.length-r+1,...f),e}function _O(e,t,r){const s=this,l=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let o=0,c;return f;function f(g){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(g),e.exit("gfmFootnoteCallLabelMarker"),d}function d(g){return g!==94?r(g):(e.enter("gfmFootnoteCallMarker"),e.consume(g),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",m)}function m(g){if(o>999||g===93&&!c||g===null||g===91||Lt(g))return r(g);if(g===93){e.exit("chunkString");const x=e.exit("gfmFootnoteCallString");return l.includes(Dr(s.sliceSerialize(x)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(g),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):r(g)}return Lt(g)||(c=!0),o++,e.consume(g),g===92?y:m}function y(g){return g===91||g===92||g===93?(e.consume(g),o++,m):m(g)}}function kO(e,t,r){const s=this,l=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let o,c=0,f;return d;function d(S){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(S),e.exit("gfmFootnoteDefinitionLabelMarker"),m}function m(S){return S===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(S),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",y):r(S)}function y(S){if(c>999||S===93&&!f||S===null||S===91||Lt(S))return r(S);if(S===93){e.exit("chunkString");const A=e.exit("gfmFootnoteDefinitionLabelString");return o=Dr(s.sliceSerialize(A)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(S),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),x}return Lt(S)||(f=!0),c++,e.consume(S),S===92?g:y}function g(S){return S===91||S===92||S===93?(e.consume(S),c++,y):y(S)}function x(S){return S===58?(e.enter("definitionMarker"),e.consume(S),e.exit("definitionMarker"),l.includes(o)||l.push(o),ht(e,v,"gfmFootnoteDefinitionWhitespace")):r(S)}function v(S){return t(S)}}function EO(e,t,r){return e.check(Xl,t,e.attempt(xO,t,r))}function CO(e){e.exit("gfmFootnoteDefinition")}function AO(e,t,r){const s=this;return ht(e,l,"gfmFootnoteDefinitionIndent",5);function l(o){const c=s.events[s.events.length-1];return c&&c[1].type==="gfmFootnoteDefinitionIndent"&&c[2].sliceSerialize(c[1],!0).length===4?t(o):r(o)}}function jO(e){let r=(e||{}).singleTilde;const s={name:"strikethrough",tokenize:o,resolveAll:l};return r==null&&(r=!0),{text:{126:s},insideSpan:{null:[s]},attentionMarkers:{null:[126]}};function l(c,f){let d=-1;for(;++d<c.length;)if(c[d][0]==="enter"&&c[d][1].type==="strikethroughSequenceTemporary"&&c[d][1]._close){let m=d;for(;m--;)if(c[m][0]==="exit"&&c[m][1].type==="strikethroughSequenceTemporary"&&c[m][1]._open&&c[d][1].end.offset-c[d][1].start.offset===c[m][1].end.offset-c[m][1].start.offset){c[d][1].type="strikethroughSequence",c[m][1].type="strikethroughSequence";const y={type:"strikethrough",start:Object.assign({},c[m][1].start),end:Object.assign({},c[d][1].end)},g={type:"strikethroughText",start:Object.assign({},c[m][1].end),end:Object.assign({},c[d][1].start)},x=[["enter",y,f],["enter",c[m][1],f],["exit",c[m][1],f],["enter",g,f]],v=f.parser.constructs.insideSpan.null;v&&ur(x,x.length,0,ec(v,c.slice(m+1,d),f)),ur(x,x.length,0,[["exit",g,f],["enter",c[d][1],f],["exit",c[d][1],f],["exit",y,f]]),ur(c,m-1,d-m+3,x),d=m+x.length-2;break}}for(d=-1;++d<c.length;)c[d][1].type==="strikethroughSequenceTemporary"&&(c[d][1].type="data");return c}function o(c,f,d){const m=this.previous,y=this.events;let g=0;return x;function x(S){return m===126&&y[y.length-1][1].type!=="characterEscape"?d(S):(c.enter("strikethroughSequenceTemporary"),v(S))}function v(S){const A=wa(m);if(S===126)return g>1?d(S):(c.consume(S),g++,v);if(g<2&&!r)return d(S);const M=c.exit("strikethroughSequenceTemporary"),T=wa(S);return M._open=!T||T===2&&!!A,M._close=!A||A===2&&!!T,f(S)}}}class NO{constructor(){this.map=[]}add(t,r,s){TO(this,t,r,s)}consume(t){if(this.map.sort(function(o,c){return o[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 o of l)t.push(o);l=s.pop()}this.map.length=0}}function TO(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 OO(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 o=s.length-1;s[o]=s[o]==="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 RO(){return{flow:{null:{name:"table",tokenize:MO,resolveAll:DO}}}}function MO(e,t,r){const s=this;let l=0,o=0,c;return f;function f(L){let X=s.events.length-1;for(;X>-1;){const oe=s.events[X][1].type;if(oe==="lineEnding"||oe==="linePrefix")X--;else break}const G=X>-1?s.events[X][1].type:null,ce=G==="tableHead"||G==="tableRow"?D:d;return ce===D&&s.parser.lazy[s.now().line]?r(L):ce(L)}function d(L){return e.enter("tableHead"),e.enter("tableRow"),m(L)}function m(L){return L===124||(c=!0,o+=1),y(L)}function y(L){return L===null?r(L):He(L)?o>1?(o=0,s.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(L),e.exit("lineEnding"),v):r(L):at(L)?ht(e,y,"whitespace")(L):(o+=1,c&&(c=!1,l+=1),L===124?(e.enter("tableCellDivider"),e.consume(L),e.exit("tableCellDivider"),c=!0,y):(e.enter("data"),g(L)))}function g(L){return L===null||L===124||Lt(L)?(e.exit("data"),y(L)):(e.consume(L),L===92?x:g)}function x(L){return L===92||L===124?(e.consume(L),g):g(L)}function v(L){return s.interrupt=!1,s.parser.lazy[s.now().line]?r(L):(e.enter("tableDelimiterRow"),c=!1,at(L)?ht(e,S,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(L):S(L))}function S(L){return L===45||L===58?M(L):L===124?(c=!0,e.enter("tableCellDivider"),e.consume(L),e.exit("tableCellDivider"),A):B(L)}function A(L){return at(L)?ht(e,M,"whitespace")(L):M(L)}function M(L){return L===58?(o+=1,c=!0,e.enter("tableDelimiterMarker"),e.consume(L),e.exit("tableDelimiterMarker"),T):L===45?(o+=1,T(L)):L===null||He(L)?W(L):B(L)}function T(L){return L===45?(e.enter("tableDelimiterFiller"),P(L)):B(L)}function P(L){return L===45?(e.consume(L),P):L===58?(c=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(L),e.exit("tableDelimiterMarker"),I):(e.exit("tableDelimiterFiller"),I(L))}function I(L){return at(L)?ht(e,W,"whitespace")(L):W(L)}function W(L){return L===124?S(L):L===null||He(L)?!c||l!==o?B(L):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(L)):B(L)}function B(L){return r(L)}function D(L){return e.enter("tableRow"),Z(L)}function Z(L){return L===124?(e.enter("tableCellDivider"),e.consume(L),e.exit("tableCellDivider"),Z):L===null||He(L)?(e.exit("tableRow"),t(L)):at(L)?ht(e,Z,"whitespace")(L):(e.enter("data"),$(L))}function $(L){return L===null||L===124||Lt(L)?(e.exit("data"),Z(L)):(e.consume(L),L===92?V:$)}function V(L){return L===92||L===124?(e.consume(L),$):$(L)}}function DO(e,t){let r=-1,s=!0,l=0,o=[0,0,0,0],c=[0,0,0,0],f=!1,d=0,m,y,g;const x=new NO;for(;++r<e.length;){const v=e[r],S=v[1];v[0]==="enter"?S.type==="tableHead"?(f=!1,d!==0&&(Fb(x,t,d,m,y),y=void 0,d=0),m={type:"table",start:Object.assign({},S.start),end:Object.assign({},S.end)},x.add(r,0,[["enter",m,t]])):S.type==="tableRow"||S.type==="tableDelimiterRow"?(s=!0,g=void 0,o=[0,0,0,0],c=[0,r+1,0,0],f&&(f=!1,y={type:"tableBody",start:Object.assign({},S.start),end:Object.assign({},S.end)},x.add(r,0,[["enter",y,t]])),l=S.type==="tableDelimiterRow"?2:y?3:1):l&&(S.type==="data"||S.type==="tableDelimiterMarker"||S.type==="tableDelimiterFiller")?(s=!1,c[2]===0&&(o[1]!==0&&(c[0]=c[1],g=xu(x,t,o,l,void 0,g),o=[0,0,0,0]),c[2]=r)):S.type==="tableCellDivider"&&(s?s=!1:(o[1]!==0&&(c[0]=c[1],g=xu(x,t,o,l,void 0,g)),o=c,c=[o[1],r,0,0])):S.type==="tableHead"?(f=!0,d=r):S.type==="tableRow"||S.type==="tableDelimiterRow"?(d=r,o[1]!==0?(c[0]=c[1],g=xu(x,t,o,l,r,g)):c[1]!==0&&(g=xu(x,t,c,l,r,g)),l=0):l&&(S.type==="data"||S.type==="tableDelimiterMarker"||S.type==="tableDelimiterFiller")&&(c[3]=r)}for(d!==0&&Fb(x,t,d,m,y),x.consume(t.events),r=-1;++r<t.events.length;){const v=t.events[r];v[0]==="enter"&&v[1].type==="table"&&(v[1]._align=OO(t.events,r))}return e}function xu(e,t,r,s,l,o){const c=s===1?"tableHeader":s===2?"tableDelimiter":"tableData",f="tableContent";r[0]!==0&&(o.end=Object.assign({},la(t.events,r[0])),e.add(r[0],0,[["exit",o,t]]));const d=la(t.events,r[1]);if(o={type:c,start:Object.assign({},d),end:Object.assign({},d)},e.add(r[1],0,[["enter",o,t]]),r[2]!==0){const m=la(t.events,r[2]),y=la(t.events,r[3]),g={type:f,start:Object.assign({},m),end:Object.assign({},y)};if(e.add(r[2],0,[["enter",g,t]]),s!==2){const x=t.events[r[2]],v=t.events[r[3]];if(x[1].end=Object.assign({},v[1].end),x[1].type="chunkText",x[1].contentType="text",r[3]>r[2]+1){const S=r[2]+1,A=r[3]-r[2]-1;e.add(S,A,[])}}e.add(r[3]+1,0,[["exit",g,t]])}return l!==void 0&&(o.end=Object.assign({},la(t.events,l)),e.add(l,0,[["exit",o,t]]),o=void 0),o}function Fb(e,t,r,s,l){const o=[],c=la(t.events,r);l&&(l.end=Object.assign({},c),o.push(["exit",l,t])),s.end=Object.assign({},c),o.push(["exit",s,t]),e.add(r+1,0,o)}function la(e,t){const r=e[t],s=r[0]==="enter"?"start":"end";return r[1][s]}const LO={name:"tasklistCheck",tokenize:UO};function zO(){return{text:{91:LO}}}function UO(e,t,r){const s=this;return l;function l(d){return s.previous!==null||!s._gfmTasklistFirstContentOfListItem?r(d):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(d),e.exit("taskListCheckMarker"),o)}function o(d){return Lt(d)?(e.enter("taskListCheckValueUnchecked"),e.consume(d),e.exit("taskListCheckValueUnchecked"),c):d===88||d===120?(e.enter("taskListCheckValueChecked"),e.consume(d),e.exit("taskListCheckValueChecked"),c):r(d)}function c(d){return d===93?(e.enter("taskListCheckMarker"),e.consume(d),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),f):r(d)}function f(d){return He(d)?t(d):at(d)?e.check({tokenize:PO},t,r)(d):r(d)}}function PO(e,t,r){return ht(e,s,"whitespace");function s(l){return l===null?r(l):t(l)}}function BO(e){return r1([cO(),vO(),jO(e),RO(),zO()])}const HO={};function qO(e){const t=this,r=e||HO,s=t.data(),l=s.micromarkExtensions||(s.micromarkExtensions=[]),o=s.fromMarkdownExtensions||(s.fromMarkdownExtensions=[]),c=s.toMarkdownExtensions||(s.toMarkdownExtensions=[]);l.push(BO(r)),o.push(aO()),c.push(lO(r))}function IO(e){C1(e,[/\r?\n|\r/g,FO])}function FO(){return{type:"break"}}function $O(){return function(e){IO(e)}}const hm=E.createContext(null);function K1(e,t){const r=E1(t);return e&&r!==null?AT(r,e.baseFile):null}function VO({node:e,href:t,...r}){const s=E.useContext(hm),l=K1(s,t);return!s||l===null?b.jsx("a",{...r,href:t,target:"_blank",rel:"noopener noreferrer"}):b.jsx("a",{...r,href:t,className:"md-file-link",onClick:o=>{o.preventDefault(),s.openFile(l)}})}function YO({node:e,src:t,alt:r,...s}){const l=E.useContext(hm),o=K1(l,typeof t=="string"?t:void 0),[c,f]=E.useState(),[d,m]=E.useState(!1),y=l==null?void 0:l.loadFile;return E.useEffect(()=>{if(o===null||!y)return;let g=!1,x;return m(!1),y(o).then(v=>{g||(x=URL.createObjectURL(v),f(x))}).catch(()=>{g||m(!0)}),()=>{g=!0,x&&URL.revokeObjectURL(x)}},[o,y]),!l||o===null?b.jsx("img",{...s,src:t,alt:r}):d?b.jsx("span",{className:"md-image-missing",children:r||o}):c?b.jsx("img",{...s,src:c,alt:r,className:"md-file-image",onClick:()=>l.openFile(o)}):b.jsx("span",{className:"md-image-loading skeleton-line"})}const GO={a:VO,img:YO};function Q1({content:e,files:t,baseFile:r}){const s=E.useMemo(()=>({openFile:t.openFile,loadFile:t.loadFile,baseFile:r}),[t.openFile,t.loadFile,r]);return b.jsx(hm.Provider,{value:s,children:b.jsx(vT,{remarkPlugins:[qO,$O],urlTransform:ET,components:GO,children:e})})}function JO({filePath:e,files:t,onClose:r}){const[s,l]=E.useState(null),[o,c]=E.useState(null),{loadFile:f}=t;E.useEffect(()=>{let y=!1,g;return l(null),c(null),(async()=>{try{const x=await f(e),v=RT(x.type),S={kind:v,size:x.size};if(v==="markdown"||v==="text"||v==="html"?S.text=await x.text():(g=URL.createObjectURL(x),S.objectUrl=g),y){g&&URL.revokeObjectURL(g);return}l(S)}catch(x){y||c(x instanceof Error?x.message:"Failed to load file.")}})(),()=>{y=!0,g&&URL.revokeObjectURL(g)}},[e,f]);const d=jT(e);function m(){if(o)return b.jsx("p",{className:"file-viewer-message",children:o});if(!s)return b.jsxs("div",{className:"file-viewer-loading",children:[b.jsx("div",{className:"skeleton-line",style:{width:"40%"}}),b.jsx("div",{className:"skeleton-line",style:{width:"100%",height:"8rem"}})]});switch(s.kind){case"markdown":return b.jsx(Q1,{content:s.text??"",files:t,baseFile:e});case"text":return b.jsx("pre",{className:"file-viewer-text",children:s.text});case"html":return b.jsx("iframe",{className:"file-viewer-frame",sandbox:"",srcDoc:s.text,title:d});case"image":return b.jsx("img",{src:s.objectUrl,alt:d,style:{maxWidth:"100%",height:"auto"}});case"binary":return Gn.isNativePlatform()?b.jsx("p",{className:"file-viewer-message",children:"Downloading this file type isn't supported in the app yet."}):b.jsxs("div",{className:"file-viewer-download",children:[b.jsxs("p",{className:"file-viewer-message",children:["This file can't be previewed (",MT(s.size),")."]}),b.jsx("a",{className:"btn btn-primary",href:s.objectUrl,download:d,children:"Download"})]})}}return b.jsx("div",{className:"report-dialog-overlay",onClick:r,children:b.jsxs("div",{className:"report-dialog",onClick:y=>y.stopPropagation(),children:[b.jsxs("div",{className:"report-dialog-header",children:[b.jsx("span",{className:"report-dialog-title",children:d}),b.jsx("button",{className:"report-dialog-close",onClick:r,"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${(s==null?void 0:s.kind)==="html"?" report-dialog-body--frame":""}`,children:m()})]})})}function XO({connected:e,hostId:t,request:r,subscribeEvents:s,taskId:l,runId:o}){const c=Vr(),f=Yd(),[d,m]=E.useState(!0),[y,g]=E.useState([]),[x,v]=E.useState(),[S,A]=E.useState(),[M,T]=E.useState(),P=x==="started",I=x==="followup",W=x==="started"||x==="followup",[B,D]=E.useState(null);yd(B!==null,()=>D(null));const[Z,$]=E.useState(!1),[V,L]=E.useState(""),[X,G]=E.useState(!1),ce=E.useRef(null),oe=E.useRef(null),re=E.useRef(null),[F,q]=E.useState(o==="latest"?void 0:o),le=o==="latest"&&F===null;E.useEffect(()=>{if(o!=="latest"){q(o);return}e&&(q(void 0),r("taskrun.list",{task_id:l,limit:1}).then(ie=>{var Ce,_e;return q(((_e=(Ce=ie.entries)==null?void 0:Ce[0])==null?void 0:_e.run_id)??null)}).catch(()=>q(null)))},[o,l,e,r]);async function be(){if(F)try{const ie=await r("task.result",{id:l,run_id:F});if(ie.error){console.error("No result:",ie.error),c(t?`/hosts/${encodeURIComponent(t)}`:"/",{replace:!0});return}g(ie.messages??[]),v(ie.running_state),A(ie.agent),T(ie.agent_version)}catch(ie){console.error("Failed to load result:",ie),c(t?`/hosts/${encodeURIComponent(t)}`:"/",{replace:!0})}finally{m(!1)}}const O=E.useCallback(ie=>F?TT(r,l,F,ie):Promise.reject(new Error("Run not loaded.")),[r,l,F]),U=E.useMemo(()=>({openFile:D,loadFile:O}),[O]);E.useEffect(()=>{!e||!F||(m(!0),be())},[e,l,F]),E.useEffect(()=>!e||!t||!F?void 0:s(t,async Ce=>{try{const _e=JSON.parse(new TextDecoder().decode(Ce.data));if(_e.event_type!=="running-state"&&_e.event_type!=="result-updated"||Ce.subject.split(".").pop()!==l||_e.event_type==="result-updated"&&_e.run_id&&_e.run_id!==F)return;be()}catch{}}),[e,t,l,F,s,r]),E.useEffect(()=>{ce.current&&(ce.current.scrollTop=ce.current.scrollHeight)},[y]),E.useEffect(()=>{d||le||!F||re.current!==F&&(re.current=F,requestAnimationFrame(()=>{ce.current&&(ce.current.scrollTop=ce.current.scrollHeight),window.scrollTo({top:document.documentElement.scrollHeight,behavior:"auto"})}))},[d,le,F]);function ee(ie){if(ie==="input")return"User Input";if(ie==="permission")return"Permission";if(ie==="confirmation")return"Confirmation"}function j(ie){return ie==="started"?"Task started":ie==="finished"?"Task finished":ie==="failed"?"Task failed":ie==="error"?"Command failed":ie==="aborted"?"Task aborted":ie==="confirmation"?"Task confirmed":ie==="stopped"?"Follow-up stopped":ie??""}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"]}),le?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."})]}):d?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:ce,children:[y.map((ie,Ce)=>{const _e=W&&ie.role==="assistant"&&!y.slice(Ce+1).some(Ee=>Ee.role==="assistant"||Ee.role==="user");return ie.role==="status"?b.jsxs("div",{className:`chat-status${ie.type==="error"?" chat-status--error":""}`,children:[b.jsxs("div",{children:[j(ie.type),ie.time>0&&b.jsx("span",{className:"chat-status-time",children:f(ie.time)})]}),ie.content&&b.jsx("pre",{className:"chat-status-detail",children:ie.content})]},Ce):b.jsxs("div",{className:`chat-message chat-message--${ie.role}${ie.role==="assistant"&&ie.stream==="stderr"?" chat-message--stderr":""}`,children:[ie.role==="assistant"&&S&&b.jsxs("div",{className:"chat-message-agent",children:[gd(S),M&&b.jsxs("span",{className:"chat-message-agent-version",children:[" v",M]})]}),b.jsxs("div",{className:"chat-message-content",children:[b.jsx(Q1,{content:ie.content,files:U}),_e&&b.jsxs("div",{className:"chat-typing-indicator",children:[b.jsx("span",{}),b.jsx("span",{}),b.jsx("span",{})]})]}),ie.attachments&&ie.attachments.length>0&&b.jsx("div",{className:"chat-message-attachments",children:ie.attachments.map(Ee=>b.jsx("button",{className:"chat-attachment-chip",onClick:()=>D(Ee),children:Ee},Ee))}),b.jsxs("div",{className:"chat-message-meta",children:[ee(ie.type)&&b.jsx("span",{className:"chat-message-type",children:ee(ie.type)}),ie.time>0&&b.jsx("span",{children:f(ie.time)})]})]},Ce)}),W&&(()=>{const ie=y.filter(Ce=>Ce.role!=="status");return ie.length===0||ie[ie.length-1].role!=="assistant"})()&&b.jsxs("div",{className:"chat-message chat-message--assistant",children:[S&&b.jsxs("div",{className:"chat-message-agent",children:[gd(S),M&&b.jsxs("span",{className:"chat-message-agent-version",children:[" v",M]})]}),b.jsxs("div",{className:"chat-typing-indicator",children:[b.jsx("span",{}),b.jsx("span",{}),b.jsx("span",{})]})]})]}),P||I?b.jsx("div",{className:"chat-input-bar",children:b.jsx("button",{className:"btn btn-secondary chat-stop-btn",disabled:Z,"aria-label":"Abort task",onClick:async()=>{if(confirm("Abort this task?")){$(!0);try{await r("task.abort",{id:l})}catch(ie){console.error("Abort failed:",ie)}finally{$(!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 ie=>{ie.preventDefault();const Ce=V.trim();if(!(!Ce||X)){G(!0);try{await r("task.followup",{id:l,run_id:F,message:Ce}),L("")}catch(_e){console.error("Follow-up failed:",_e)}finally{G(!1)}}},children:[b.jsx("input",{ref:oe,className:"chat-input",type:"text",placeholder:"Follow-up message",value:V,onChange:ie=>L(ie.target.value),disabled:X}),b.jsx("button",{className:"btn btn-primary chat-send-btn",type:"submit",disabled:!V.trim()||X,children:b.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[b.jsx("line",{x1:"22",y1:"2",x2:"11",y2:"13"}),b.jsx("polygon",{points:"22 2 15 22 11 13 2 9 22 2"})]})})]}),b.jsxs("button",{className:"run-detail-back run-detail-back--footer",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&&b.jsx(JO,{filePath:B,files:U,onClose:()=>D(null)})]})}function Zh({title:e,message:t,onUpdate:r,onDismiss:s}){return b.jsx("div",{className:"confirm-modal-overlay",children:b.jsxs("div",{className:"confirm-modal",children:[b.jsx("h2",{className:"confirm-modal-title",children:e}),b.jsx("p",{className:"confirm-modal-message",children:t}),b.jsxs("div",{className:"confirm-modal-actions",children:[b.jsx("button",{className:"btn btn-primary",onClick:r,children:"Update Now"}),s&&b.jsx("button",{className:"btn btn-secondary",onClick:s,children:"Dismiss"})]})]})})}function KO(){const{activeHost:e}=yi(),t=E.useRef(null);E.useEffect(()=>{if(Gn.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 o=await l.pushManager.getSubscription();if(!o){const{publicKey:f}=await vE("/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}o=await l.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:f})}const c=o.toJSON();await xE("/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 QO="0.9.9";function vu(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 wu(){const{removePairedHost:e,setHostLanUrl:t,setHostTimezone:r}=Xi(),{connected:s,request:l,subscribeEvents:o,unauthorized:c,activeHost:f}=yi(),d=f.hostId,m=f.clientToken||null,y=Vr(),g=Er(),x=Yu(),v=qx("(min-width: 768px)"),S=g.pathname.endsWith("/tasks"),A=x.runId?void 0:x.taskId,M=!!(x.taskId&&x.runId),[T,P]=E.useState(!1),[I,W]=E.useState(!1),[B,D]=E.useState(null),[Z,$]=E.useState(null),[V,L]=E.useState(null),[X,G]=E.useState(null),[ce,oe]=E.useState({}),[re,F]=E.useState({}),[q,le]=E.useState(null),[be,O]=E.useState(null),[U,ee]=E.useState(null),[j,ie]=E.useState(null),[Ce,_e]=E.useState(new Set),[Ee,Ve]=E.useState([]),[je,dt]=E.useState(),[qt,ln]=E.useState("loading"),tn=!!m&&j===m,[Gt,on]=E.useState(new Map),[Rt,Kt]=E.useState(new Map),[Pe,ct]=E.useState(new Map),[Ke,bt]=E.useState(new Map),[zt,Pn]=E.useState(new Map),[$e,Tn]=E.useState(new Map),[fe,Se]=E.useState(new Map);KO(),E.useEffect(()=>{window.scrollTo(0,0)},[d]),E.useEffect(()=>{let xe=!1;return WE().then(Ae=>{xe||_e(Ae)}),()=>{xe=!0}},[]),E.useEffect(()=>{if(!s){ln("loading");return}ln("loading");let xe=!1;return l("host.info",void 0,{timeout:15e3}).then(Ae=>{var Ie,mt,Xt,It,nn,Bn,Zi;if(xe)return;Ve(Ae.agents??[]),le(Ae.playwright_cli??null),dt(Ae.host_platform),ie(Ae.linked_client_token??null),DE(Ae.agents??[]);const Ye=Ae.version??null;$(Ye),P(!!Ye&&vu(Ye,QO)),t(d,Ae.lan_url??void 0),r(d,Ae.host_timezone);const We=new Map,Fe=new Map,ft=new Map,rt=new Map;for(const Mt of Ae.pending_prompts??[])if(Mt.type==="confirmation")We.set(Mt.key,{description:((Ie=Mt.meta)==null?void 0:Ie.description)??"",sessionName:(mt=Mt.meta)==null?void 0:mt.session_name});else if(Mt.type==="permission")Fe.set(Mt.key,{permissions:Mt.params??[],sessionName:(Xt=Mt.meta)==null?void 0:Xt.session_name});else if(Mt.type==="input"){const wt=Mt.params??((It=Mt.meta)==null?void 0:It.input_questions)??[];ft.set(Mt.key,{questions:wt,description:(nn=Mt.meta)==null?void 0:nn.description,sessionName:(Bn=Mt.meta)==null?void 0:Bn.session_name,secret:(Zi=Mt.meta)==null?void 0:Zi.secret}),rt.set(Mt.key,new Array(wt.length).fill(""))}on(We),Kt(Fe),ct(ft),bt(rt),ln("ready")}).catch(()=>{xe||ln("error")}),()=>{xe=!0}},[s,d,l,t,r]),E.useEffect(()=>s?o(d,Ae=>{const Ye=Ae.subject.split(".");if(Ye.length<3)return;const We=Ye.slice(2).join(".");let Fe={};try{Fe=JSON.parse(new TextDecoder().decode(Ae.data))}catch{return}const ft=Fe.event_type,rt=Fe.session_id;if(ft==="input-request"&&rt){const Ie=Fe.input_questions,mt=Fe.session_name,Xt=Fe.description,It=Fe.secret;Ie!=null&&Ie.length&&(ct(nn=>{if(nn.has(rt))return nn;const Bn=new Map(nn);return Bn.set(rt,{questions:Ie,description:Xt,sessionName:mt,secret:It}),Bn}),bt(nn=>{if(nn.has(rt))return nn;const Bn=new Map(nn);return Bn.set(rt,new Array(Ie.length).fill("")),Bn}));return}if(ft==="input-resolved"&&rt){ct(Ie=>{if(!Ie.has(rt))return Ie;const mt=new Map(Ie);return mt.delete(rt),mt}),bt(Ie=>{const mt=new Map(Ie);return mt.delete(rt),mt}),Pn(Ie=>{if(!Ie.has(rt))return Ie;const mt=new Map(Ie);return mt.delete(rt),mt});return}if(ft==="confirm-request"&&rt){const Ie=Fe.description,mt=Fe.session_name;Ie&&on(Xt=>{if(Xt.has(rt))return Xt;const It=new Map(Xt);return It.set(rt,{description:Ie,sessionName:mt}),It});return}if(ft==="confirm-resolved"&&rt){on(Ie=>{if(!Ie.has(rt))return Ie;const mt=new Map(Ie);return mt.delete(rt),mt});return}if(ft==="permission-request"){const Ie=Fe.required_permissions,mt=Fe.session_name;Ie!=null&&Ie.length&&Kt(Xt=>{if(Xt.has(We))return Xt;const It=new Map(Xt);return It.set(We,{permissions:Ie,sessionName:mt}),It});return}if(ft==="permission-resolved"){Kt(Ie=>{if(!Ie.has(We))return Ie;const mt=new Map(Ie);return mt.delete(We),mt});return}}):void 0,[s,d,o]);async function Le(xe,Ae,Ye,We){if(!$e.has(xe)){Tn(Fe=>new Map(Fe).set(xe,Ae)),Se(Fe=>{const ft=new Map(Fe);return ft.delete(xe),ft});try{await l("task.user_input",{id:xe,value:Ye},{timeout:3e4}),We()}catch(Fe){console.error("[Dashboard] Failed to send user input:",Fe),Se(ft=>new Map(ft).set(xe,"Couldn't reach the host. Try again."))}finally{Tn(Fe=>{const ft=new Map(Fe);return ft.delete(xe),ft})}}}function Ge(xe,Ae){Le(xe,Ae,[Ae],()=>{on(Ye=>{const We=new Map(Ye);return We.delete(xe),We})})}function et(xe,Ae){Le(xe,Ae,[Ae],()=>{Kt(Ye=>{const We=new Map(Ye);return We.delete(xe),We})})}function un(xe,Ae,Ye){Le(xe,Ae,Ye,()=>{ct(We=>{const Fe=new Map(We);return Fe.delete(xe),Fe}),bt(We=>{const Fe=new Map(We);return Fe.delete(xe),Fe}),Pn(We=>{const Fe=new Map(We);return Fe.delete(xe),Fe})})}function vn(xe,Ae){if(!xs())return;const Ye=`/hosts/${encodeURIComponent(d)}/runs/${encodeURIComponent(xe)}`;y(Ae?`${Ye}/${encodeURIComponent(Ae)}`:Ye)}E.useEffect(()=>{if(!Z)return;let xe=!1;return fetch("https://registry.npmjs.org/palmier/latest").then(Ae=>Ae.ok?Ae.json():null).then(Ae=>{!xe&&(Ae!=null&&Ae.version)&&L(Ae.version)}).catch(()=>{}),()=>{xe=!0}},[Z]),E.useEffect(()=>{let xe=!1;for(const Ae of Ee)!Ae.version||!Ae.npmPackage||fetch(`https://registry.npmjs.org/${Ae.npmPackage}/latest`).then(Ye=>Ye.ok?Ye.json():null).then(Ye=>{xe||!(Ye!=null&&Ye.version)||oe(We=>We[Ae.key]===Ye.version?We:{...We,[Ae.key]:Ye.version})}).catch(()=>{});return()=>{xe=!0}},[Ee]);const Ct=Ee.find(xe=>{if(!xe.version)return!1;const Ae=ce[xe.key];return!Ae||!vu(xe.version,Ae)?!1:re[xe.key]!==Ae});function xt(xe,Ae){F(Ye=>({...Ye,[xe]:Ae}))}async function Jt(xe){W("agent"),D(null);try{const Ae=await l("host.updateAgent",{key:xe});if(Ae.error){D(Ae.error),W(!1);return}const Ye=await l("host.info");Ye.agents&&Ve(Ye.agents)}catch(Ae){D(Ae instanceof Error?Ae.message:String(Ae))}finally{W(!1)}}E.useEffect(()=>{if(!(q!=null&&q.npmPackage))return;let xe=!1;return fetch(`https://registry.npmjs.org/${q.npmPackage}/latest`).then(Ae=>Ae.ok?Ae.json():null).then(Ae=>{!xe&&(Ae!=null&&Ae.version)&&O(Ae.version)}).catch(()=>{}),()=>{xe=!0}},[q==null?void 0:q.npmPackage,q==null?void 0:q.version]);const nt=q&&be&&vu(q.version,be)&&U!==be?q:null;function ve(xe){ee(xe)}async function Be(){W("playwright"),D(null);try{const xe=await l("host.updatePlaywrightCli");if(xe.error){D(xe.error),W(!1);return}const Ae=await l("host.info");le(Ae.playwright_cli??null)}catch(xe){D(xe instanceof Error?xe.message:String(xe))}finally{W(!1)}}const Oe=!T&&!!Z&&!!V&&vu(Z,V)&&X!==V;function _t(){V&&G(V)}async function Qt(){W("daemon"),D(null);try{const xe=await l("host.update");if(xe.error){D(xe.error),W(!1);return}}catch{}setTimeout(()=>window.location.reload(),3e4)}const On=Gt.size>0||Rt.size>0||Pe.size>0,Xn=s&&!c;return b.jsxs("div",{className:"dashboard",children:[v&&b.jsx(Q0,{daemonVersion:Z,agents:Ee,playwrightCli:q,linkedClientToken:j,request:l,onEnabledCapabilitiesChange:_e,onLinkedClientTokenChange:ie}),b.jsxs("div",{className:"dashboard-content",children:[b.jsxs("header",{className:"app-header",children:[b.jsxs("div",{className:"app-title-bar",children:[!v&&b.jsx(Q0,{daemonVersion:Z,agents:Ee,playwrightCli:q,linkedClientToken:j,request:l,onEnabledCapabilitiesChange:_e,onLinkedClientTokenChange:ie}),b.jsx("h1",{className:"app-title",children:"Palmier"}),b.jsx(sC,{})]}),b.jsx("div",{className:"tab-bar",children:b.jsx(KE,{})})]}),b.jsx("main",{className:"dashboard-main",children:c?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:()=>{xs()&&y("/pair")},children:"Re-pair Device"}),b.jsx("button",{className:"btn btn-secondary",onClick:()=>{e(d),y("/",{replace:!0})},children:"Remove Host"})]})]}):Xn?b.jsxs(b.Fragment,{children:[S&&!M&&b.jsx(XE,{connected:s,hostId:d,request:l,subscribeEvents:o,agents:Ee,hostPlatform:je,isNotificationListener:tn&&Ce.has("notifications"),onViewRun:vn,hostInfoStatus:qt}),M?b.jsx(XO,{connected:s,hostId:d,request:l,subscribeEvents:o,taskId:x.taskId,runId:decodeURIComponent(x.runId)}):S?null:b.jsx(uC,{connected:s,hostId:d,request:l,subscribeEvents:o,agents:Ee,hostPlatform:je,filterTaskId:A,onClearFilter:()=>{xs()&&y(`/hosts/${encodeURIComponent(d)}`)},hostInfoStatus:qt})]}):b.jsx("div",{className:"empty-state",children:b.jsx("p",{className:"empty-state-text",children:"Connecting to host…"})})}),(T||Oe)&&!I&&!B&&!On&&b.jsx(Zh,{title:T?"Update Required":"Update Available",message:T?`Your Palmier host${Z?` (v${Z})`:""} is too old for this version of the app. Please update to continue.`:`A new version of Palmier (v${V}) is available. You're running v${Z}.`,onUpdate:Qt,onDismiss:T?void 0:_t}),!T&&!Oe&&Ct&&!I&&!B&&!On&&b.jsx(Zh,{title:"Agent Update Available",message:`A new version of ${Ct.label} (v${ce[Ct.key]}) is available. You're running v${Ct.version}.`,onUpdate:()=>Jt(Ct.key),onDismiss:()=>xt(Ct.key,ce[Ct.key])}),!T&&!Oe&&!Ct&&nt&&be&&!I&&!B&&!On&&b.jsx(Zh,{title:"Browser Automation Update Available",message:`A new version of ${nt.label} (v${be}) is available. You're running v${nt.version}.`,onUpdate:Be,onDismiss:()=>ve(be)}),I&&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:I==="daemon"?"Installing update and restarting daemon. Please wait...":"Installing update. Please wait..."})]})}),B&&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:B}),b.jsx("div",{className:"confirm-modal-actions",children:b.jsx("button",{className:"btn btn-secondary",onClick:()=>{D(null)},children:"Retry"})})]})})]}),di.createPortal(b.jsxs(b.Fragment,{children:[[...Gt.entries()].map(([xe,{description:Ae,sessionName:Ye}])=>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"}),Ye&&b.jsx("p",{className:"confirm-modal-subtitle",children:Ye}),b.jsx("p",{className:"confirm-modal-message",children:Ae}),fe.has(xe)&&b.jsx("p",{className:"form-error",children:fe.get(xe)}),b.jsxs("div",{className:"confirm-modal-actions",children:[b.jsxs("button",{className:"btn btn-primary",disabled:$e.has(xe),onClick:()=>Ge(xe,"confirmed"),children:[$e.get(xe)==="confirmed"&&b.jsx("span",{className:"btn-spinner"}),"Confirm"]}),b.jsxs("button",{className:"btn btn-secondary",disabled:$e.has(xe),onClick:()=>Ge(xe,"aborted"),children:[$e.get(xe)==="aborted"&&b.jsx("span",{className:"btn-spinner btn-spinner-current"}),"Abort"]})]})]})},xe)),[...Rt.entries()].map(([xe,{permissions:Ae,sessionName:Ye}])=>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:Ye||xe})}),b.jsx("div",{className:"permission-list",children:Ae.map((We,Fe)=>b.jsxs("div",{className:"permission-item",children:[b.jsx("span",{className:"permission-name",children:We.name}),We.description&&b.jsx("span",{className:"permission-desc",children:We.description})]},Fe))}),fe.has(xe)&&b.jsx("p",{className:"form-error",children:fe.get(xe)}),b.jsxs("div",{className:"permission-actions",children:[b.jsxs("button",{className:"btn btn-primary",disabled:$e.has(xe),onClick:()=>et(xe,"granted"),children:[$e.get(xe)==="granted"&&b.jsx("span",{className:"btn-spinner"}),"Allow Once"]}),b.jsxs("button",{className:"btn btn-secondary",disabled:$e.has(xe),onClick:()=>et(xe,"granted_all"),children:[$e.get(xe)==="granted_all"&&b.jsx("span",{className:"btn-spinner btn-spinner-current"}),"Allow Always"]})]}),b.jsxs("button",{className:"permission-abort-link",disabled:$e.has(xe),onClick:()=>et(xe,"aborted"),children:[$e.get(xe)==="aborted"&&b.jsx("span",{className:"btn-spinner btn-spinner-current"}),"Deny & Abort Task"]})]})},xe)),[...Pe.entries()].map(([xe,{questions:Ae,description:Ye,sessionName:We,secret:Fe}])=>{const ft=Ke.get(xe)??new Array(Ae.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:Fe?"Password Required":"Input Required"}),We&&b.jsx("p",{className:"confirm-modal-subtitle",children:We}),Ye&&b.jsx("p",{className:"confirm-modal-message",children:Ye}),b.jsx("div",{className:"input-list",children:Ae.map((rt,Ie)=>b.jsxs("div",{className:"input-item",children:[b.jsx("label",{className:"input-label",children:rt}),b.jsx("input",{type:Fe?"password":"text",autoComplete:Fe?"off":void 0,className:"input-field",value:ft[Ie]??"",onChange:mt=>{bt(Xt=>{const It=new Map(Xt),nn=[...It.get(xe)??[]];return nn[Ie]=mt.target.value,It.set(xe,nn),It})},disabled:$e.has(xe),autoFocus:Ie===0})]},Ie))}),Fe&&b.jsxs("label",{className:"toggle-label input-save-toggle",children:[b.jsx("input",{type:"checkbox",checked:zt.get(xe)??!0,disabled:$e.has(xe),onChange:rt=>Pn(Ie=>new Map(Ie).set(xe,rt.target.checked))}),"Save this password"]}),fe.has(xe)&&b.jsx("p",{className:"form-error",children:fe.get(xe)}),b.jsx("div",{className:"input-actions",children:b.jsxs("button",{className:"btn btn-primary",disabled:$e.has(xe)||ft.some(rt=>!rt.trim()),onClick:()=>{const rt=Fe?[...ft,zt.get(xe)??!0?"save":"nosave"]:ft;un(xe,"submit",rt)},children:[$e.get(xe)==="submit"&&b.jsx("span",{className:"btn-spinner"}),"Submit"]})}),b.jsxs("button",{className:"permission-abort-link",disabled:$e.has(xe),onClick:()=>un(xe,"aborted",["aborted"]),children:[$e.get(xe)==="aborted"&&b.jsx("span",{className:"btn-spinner btn-spinner-current"}),"Abort"]})]})},xe)})]}),document.body)]})}const ZO=ws("Preferences",{web:()=>Vd(()=>import("./web-WpTCk2Nv.js"),[]).then(e=>new e.PreferencesWeb)}),El=!!window.__PALMIER_SERVE__&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"),$b=Gn.isNativePlatform();function WO(){const[e,t]=E.useState(""),[r,s]=E.useState(!0),[l,o]=E.useState(!1),[c,f]=E.useState(null),{addPairedHost:d,pairedHosts:m}=Xi(),y=Vr();async function g(){const x=e.trim().toUpperCase();if(!x){f("Enter a pairing code.");return}o(!0),f(null);try{let v;if(El){const M=await fetch("/pair",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:x,label:navigator.userAgent})});if(!M.ok){const T=await M.json().catch(()=>({error:"Connection failed"}));throw new Error(T.error||`HTTP ${M.status}`)}v=await M.json()}else{const M=await fetch(`${Bu}/api/config`);if(!M.ok)throw new Error("Failed to fetch server config");const T=await M.json();if(!T.natsWsUrl)throw new Error("Server has no NATS WebSocket URL configured");const P=await Dx({servers:T.natsWsUrl,authenticator:Ex(T.natsJwt,new TextEncoder().encode(T.natsNkeySeed))}),I=Ru(),W=`pair.${x}`,B=await P.request(W,I.encode(JSON.stringify({label:navigator.userAgent})),{timeout:1e4});v=JSON.parse(I.decode(B.data)),await P.close()}const S={hostId:v.hostId,clientToken:v.clientToken,directUrl:El?window.location.origin:void 0,...v.hostName?{name:v.hostName}:{}};if(d(S),Gn.isNativePlatform()&&An){await ZO.set({key:"hostId",value:v.hostId});try{const{token:M}=await An.getFcmToken();await fetch(`${Bu}/api/fcm/register`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({hostId:v.hostId,fcmToken:M})})}catch(M){console.warn("FCM token registration failed:",M)}}const A=`/hosts/${encodeURIComponent(v.hostId)}`;y($b&&r?`${A}/pair/setup`:A)}catch(v){const S=v instanceof Error?v.message:String(v);S.includes("timeout")||S.includes("TIMEOUT")||S.includes("503")||S.toLowerCase().includes("no responders")?f("Code not found or expired. Check the code and try again."):f(S)}finally{o(!1)}}return b.jsx("div",{className:"pair-page",children:b.jsxs("div",{className:"pair-card",children:[b.jsxs("div",{className:"pair-header",children:[b.jsx("h1",{className:"pair-title",children:El?"Pair":"Pair with Host"}),b.jsx("p",{className:"pair-subtitle",children:El?"Enter the pairing code shown in your terminal.":"Connect this device to a Palmier host"})]}),!El&&b.jsxs("div",{className:"pair-instructions",children:[b.jsxs("div",{className:"pair-instruction-block",children:[b.jsx("h3",{className:"pair-instruction-heading",children:"Setting up a new host?"}),b.jsxs("ol",{className:"pair-steps",children:[b.jsxs("li",{children:["Install Palmier on your host machine.",b.jsx("span",{className:"pair-platform-label",children:"Linux / macOS:"}),b.jsx("code",{className:"pair-command",children:"curl -fsSL https://palmier.me/install.sh | bash"}),b.jsx("span",{className:"pair-platform-label",children:"Windows (PowerShell):"}),b.jsx("code",{className:"pair-command",children:"irm https://palmier.me/install.ps1 | iex"})]}),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:x=>t(x.target.value.toUpperCase()),placeholder:"A7K9M2",className:"form-input form-input-mono pair-code-input",autoFocus:!0,autoComplete:"off",disabled:l})]}),$b&&b.jsxs("label",{className:"pair-checkbox",children:[b.jsx("input",{type:"checkbox",checked:r,onChange:x=>s(x.target.checked),disabled:l}),b.jsxs("span",{className:"pair-checkbox-text",children:[b.jsx("span",{className:"pair-checkbox-title",children:"Link the host to this device"}),b.jsx("span",{className:"pair-checkbox-hint",children:r?"The host will use this device for SMS, contacts, calendar, location, and alarms. Only one device can be linked to the host.":"This device won't provide SMS, contacts, calendar, location, or alarms to the host. You can link it later from the menu."})]})]}),c&&b.jsx("p",{className:"pair-error",children:c}),b.jsxs("button",{className:"btn btn-primary btn-full",onClick:g,disabled:l||!e.trim(),children:[l&&b.jsx("span",{className:"btn-spinner"}),l?"Pairing...":"Pair"]}),m.length>0&&b.jsx("button",{className:"btn btn-secondary btn-full",onClick:()=>y("/"),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 e4(){const e=Vr(),{connected:t,request:r,activeHost:s}=yi(),{setHostLanUrl:l,pairedHosts:o}=Xi(),c=o.length<=1,[f,d]=E.useState("loading"),[m,y]=E.useState(null),[g,x]=E.useState(null);function v(){e(`/hosts/${encodeURIComponent(s.hostId)}`,{replace:!0})}E.useEffect(()=>{if(!t||f!=="loading")return;let P=!1;return r("host.info").catch(()=>({})).then(I=>{if(P)return;l(s.hostId,I.lan_url??void 0);const W=I.linked_client_token??null;y(W);const B=!!W&&W!==s.clientToken;d(B?"confirming":"linking")}),()=>{P=!0}},[t,f,s,r,l]),E.useEffect(()=>{if(f!=="linking")return;let P=!1;return(async()=>{try{if(An){const{token:I}=await An.getFcmToken();if(!I)throw new Error("Could not read FCM token");await r("device.link",{fcmToken:I})}if(P)return;c?d("wizard"):v()}catch(I){if(P)return;x(I instanceof Error?I.message:String(I)),d("linkError")}})(),()=>{P=!0}},[f]);function S(){d("linking")}function A(){v()}function M(){x(null),d("linking")}const T=f==="confirming"&&di.createPortal(b.jsx("div",{className:"confirm-modal-overlay",onClick:A,children:b.jsxs("div",{className:"confirm-modal",onClick:P=>P.stopPropagation(),children:[b.jsx("h2",{className:"confirm-modal-title",children:"Link the host to this device?"}),b.jsx("p",{className:"confirm-modal-message",children:"Another device is already linked to this host. Only one device can be linked to the host — 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:A,children:"Cancel"}),b.jsx("button",{className:"btn btn-primary",onClick:S,children:"Link"})]})]})}),document.body);if(f==="loading"||f==="confirming"||f==="linking"||f==="linkError"){const P=c,I=f==="loading"||f==="confirming"||f==="linking";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:[I&&b.jsx("span",{className:"spinner spinner-lg"}),f==="loading"&&b.jsx("span",{children:"Connecting to host…"}),f==="confirming"&&b.jsx("span",{children:"Awaiting confirmation…"}),f==="linking"&&b.jsx("span",{children:"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:M,children:"Retry"}),b.jsx("button",{className:"btn btn-secondary",onClick:v,children:"Skip linking"})]})]})]}),T]})}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(Ix,{}),b.jsx("div",{className:"pair-setup-actions",children:b.jsx("button",{className:"btn btn-primary btn-full",onClick:v,children:"Finish"})})]})})}function t4(){const e=Vr();return E.useEffect(()=>{if(!An)return;const t=An.addListener("deepLink",({path:r})=>e(r));return()=>{t.then(r=>r.remove())}},[e]),null}function n4(){const{pairedHosts:e,lastHostId:t}=Xi();if(e.length===0)return b.jsx(Ul,{to:"/pair",replace:!0});const r=e.find(s=>s.hostId===t)??e[0];return b.jsx(Ul,{to:`/hosts/${encodeURIComponent(r.hostId)}`,replace:!0})}function r4(){const{hostId:e}=Yu(),{pairedHosts:t,setLastHostId:r}=Xi(),s=t.find(l=>l.hostId===e)??null;return E.useEffect(()=>{s&&r(s.hostId)},[s==null?void 0:s.hostId,r]),s?b.jsx(kE,{activeHost:s,children:b.jsxs(ax,{children:[b.jsx(Or,{index:!0,element:b.jsx(wu,{},e)}),b.jsx(Or,{path:"tasks",element:b.jsx(wu,{},e)}),b.jsx(Or,{path:"runs/:taskId",element:b.jsx(wu,{},e)}),b.jsx(Or,{path:"runs/:taskId/:runId",element:b.jsx(wu,{},e)}),b.jsx(Or,{path:"pair/setup",element:b.jsx(e4,{})}),b.jsx(Or,{path:"*",element:b.jsx(Ul,{to:".",replace:!0})})]})},`${s.hostId}|${s.clientToken}`):b.jsx(Ul,{to:"/",replace:!0})}function i4(){return b.jsxs(J_,{children:[b.jsx(t4,{}),b.jsxs(ax,{children:[b.jsx(Or,{path:"/",element:b.jsx(n4,{})}),b.jsx(Or,{path:"/pair",element:b.jsx(WO,{})}),b.jsx(Or,{path:"/hosts/:hostId/*",element:b.jsx(r4,{})}),b.jsx(Or,{path:"*",element:b.jsx(Ul,{to:"/",replace:!0})})]})]})}pS.createRoot(document.getElementById("root")).render(b.jsx(E.StrictMode,{children:b.jsx(L_,{children:b.jsx(i4,{})})}));export{$d as W};